@mescius/wijmo.grid 5.20232.939

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.
@@ -0,0 +1,14 @@
1
+ /*!
2
+ *
3
+ * Wijmo Library 5.20232.939
4
+ * https://developer.mescius.com/wijmo
5
+ *
6
+ * Copyright(c) MESCIUS inc. All rights reserved.
7
+ *
8
+ * Licensed under the End-User License Agreement For MESCIUS Wijmo Software.
9
+ * us.sales@mescius.com
10
+ * https://developer.mescius.com/wijmo/licensing
11
+ *
12
+ */
13
+
14
+ "use strict";var __importStar=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var i in e)Object.hasOwnProperty.call(e,i)&&(t[i]=e[i]);t.default=e;return t};Object.defineProperty(exports,"__esModule",{value:!0});const wijmo_1=require("@mescius/wijmo"),wijmo_input_1=require("@mescius/wijmo.input"),mInput=__importStar(require("@mescius/wijmo.input")),selfModule=__importStar(require("@mescius/wijmo.grid"));let _safariVer=null;function _getSafariVer(){return _safariVer}exports._getSafariVer=_getSafariVer;if(wijmo_1.isSafari()){let e=navigator.userAgent.match(/version\/([\d\.]+)/i);if(null!=e){const t=e[1],i=(e=t.match(/(\d+)/g)).map(e=>parseInt(e));_safariVer={full:t,major:i[0],minor:i[1]}}}var DataMapEditor,CellType,SelectionMode,SelectedState,SelMove,RowColFlags,AllowSorting,AllowPinning,HeadersVisibility,ClipStringOptions,HeadersFocusability,FrozenRowCol,AllowMerging;!function(e){e[e.AutoComplete=0]="AutoComplete";e[e.DropDownList=1]="DropDownList";e[e.RadioButtons=2]="RadioButtons"}(DataMapEditor=exports.DataMapEditor||(exports.DataMapEditor={}));class DataMap{constructor(e,t,i){this._keyPath="";this._displayPath="";this._sortByVal=!0;this._editable=!1;this._serK=!0;this.mapChanged=new wijmo_1.Event;if(wijmo_1.isArray(e)&&!t&&!i){e=e.map(e=>({value:e}));t=i="value"}this._cv=wijmo_1.asCollectionView(e);this._keyPath=wijmo_1.asString(t,!1);this._displayPath=wijmo_1.asString(i,!1);this._cv.collectionChanged.addHandler(this.onMapChanged,this)}get sortByDisplayValues(){return this._sortByVal}set sortByDisplayValues(e){this._sortByVal=wijmo_1.asBoolean(e)}get serializeKeys(){return this._serK}set serializeKeys(e){if((e=wijmo_1.asBoolean(e))!==this._serK){let t=this._map,i=t&&t.size;this._map=null;this._serK=e;i&&this.onMapChanged(wijmo_1.EventArgs.empty)}}get collectionView(){return this._cv}get selectedValuePath(){return this._keyPath}get displayMemberPath(){return this._displayPath}getDataItem(e){if(!this._map){let e=this._cv.sourceCollection,t=new wijmo_1._Map(this.serializeKeys);wijmo_1.isArray(e)&&this._keyPath&&e.forEach(e=>{let i=e[this._keyPath];t.has(i)||t.set(i,e)});this._map=t}return this._map.get(e)}getDisplayValue(e){let t=this._displayPath,i=this.getDataItem(e);return t&&i?i[t]:e}getKeyValue(e,t){let i=this._displayPath,l=this._indexOf(e,i,t,!0);l<0&&(l=this._indexOf(e,i,t,!1));return l>-1?this._cv.sourceCollection[l][this._keyPath]:null}getDisplayValues(e){return this._cv&&this._displayPath?this._cv.items.map(e=>e[this._displayPath]):[]}getKeyValues(){return this._cv&&this._keyPath?this._cv.items.map(e=>e[this._keyPath]):[]}get isEditable(){return this._editable}set isEditable(e){this._editable=wijmo_1.asBoolean(e)}get search(){return this._search}set search(e){e&&(this._search=wijmo_1.asFunction(e))}onMapChanged(e){this._map=null;this.mapChanged.raise(this,e)}_indexOf(e,t,i,l){let s=-1,o=-1;if(this._cv&&t){let n=null!=e?e.toString():"";n&&i&&(e=wijmo_1.toPlainText(n));let r=l?n:n.toLowerCase(),a=this._cv.sourceCollection;for(let h=0;h<a.length;h++){let d=a[h],c=d[t];null!=c&&null!=c||(c="");i&&wijmo_1.isString(c)&&(c=wijmo_1.toPlainText(c));c==e?s=h:l||c.length!=r.length||c.toLowerCase()!=r?null!=c&&c.toString()==n&&(s=h):s=h;if(s==h){if(!this._cv.filter||this._cv.filter(d))return s;o<0&&(o=s)}}}return o}}exports.DataMap=DataMap;class CellRange{constructor(e=-1,t=-1,i=e,l=t){this.setRange(e,t,i,l)}setRange(e=-1,t=-1,i=e,l=t){this._row=wijmo_1.asInt(e);this._col=wijmo_1.asInt(t);this._row2=wijmo_1.asInt(i);this._col2=wijmo_1.asInt(l)}get row(){return this._row}set row(e){this._row=wijmo_1.asInt(e)}get col(){return this._col}set col(e){this._col=wijmo_1.asInt(e)}get row2(){return this._row2}set row2(e){this._row2=wijmo_1.asInt(e)}get col2(){return this._col2}set col2(e){this._col2=wijmo_1.asInt(e)}clone(){return new CellRange(this._row,this._col,this._row2,this._col2)}copy(e){this.setRange(e._row,e._col,e._row2,e._col2)}get rowSpan(){return Math.abs(this._row2-this._row)+1}get columnSpan(){return Math.abs(this._col2-this._col)+1}get topRow(){return Math.min(this._row,this._row2)}get bottomRow(){return Math.max(this._row,this._row2)}get leftCol(){return Math.min(this._col,this._col2)}get rightCol(){return Math.max(this._col,this._col2)}get isValid(){return this._row>-1&&this._col>-1&&this._row2>-1&&this._col2>-1}get isSingleCell(){return this._row==this._row2&&this._col==this._col2}contains(e,t){let i=wijmo_1.tryCast(e,CellRange);if(i)return i.topRow>=this.topRow&&i.bottomRow<=this.bottomRow&&i.leftCol>=this.leftCol&&i.rightCol<=this.rightCol;if(wijmo_1.isInt(e)&&wijmo_1.isInt(t))return e>=this.topRow&&e<=this.bottomRow&&t>=this.leftCol&&t<=this.rightCol;throw"contains expects a CellRange or row/column indices."}containsRow(e){return wijmo_1.asInt(e)>=this.topRow&&e<=this.bottomRow}containsColumn(e){return wijmo_1.asInt(e)>=this.leftCol&&e<=this.rightCol}intersects(e){return this.intersectsRow(e)&&this.intersectsColumn(e)}intersectsRow(e){return e&&!(this.bottomRow<e.topRow||this.topRow>e.bottomRow)}intersectsColumn(e){return e&&!(this.rightCol<e.leftCol||this.leftCol>e.rightCol)}getRenderSize(e){let t=new wijmo_1.Size(0,0);if(this.isValid){for(let i=this.topRow;i<=this.bottomRow;i++)e.rows[i]&&(t.height+=e.rows[i].renderSize);for(let i=this.leftCol;i<=this.rightCol;i++)e.columns[i]&&(t.width+=e.columns[i].renderSize)}return t}equals(e){return e instanceof CellRange&&this._row==e._row&&this._col==e._col&&this._row2==e._row2&&this._col2==e._col2}combine(e){return e?new CellRange(Math.min(this.topRow,e.topRow),Math.min(this.leftCol,e.leftCol),Math.max(this.bottomRow,e.bottomRow),Math.max(this.rightCol,e.rightCol)):this}toString(){return wijmo_1.format("({row}, {col})-({row2}, {col2})",this)}}exports.CellRange=CellRange;!function(e){e[e.None=0]="None";e[e.Cell=1]="Cell";e[e.ColumnHeader=2]="ColumnHeader";e[e.RowHeader=3]="RowHeader";e[e.TopLeft=4]="TopLeft";e[e.ColumnFooter=5]="ColumnFooter";e[e.BottomLeft=6]="BottomLeft"}(CellType=exports.CellType||(exports.CellType={}));class GridPanel{constructor(e,t,i,l,s){this._offsetY=0;this._rng=new CellRange;this._g=wijmo_1.asType(e,FlexGrid);this._ct=wijmo_1.asInt(t);this._rows=wijmo_1.asType(i,RowCollection);this._cols=wijmo_1.asType(l,ColumnCollection);this._e=wijmo_1.asType(s,HTMLElement);this._vrb=new CellRange;this._uid=wijmo_1.uidGenerator()}get grid(){return this._g}get cellType(){return this._ct}get viewRange(){return this._getViewRange()}get width(){return this._cols.getTotalSize()}get height(){return this._rows.getTotalSize()}get rows(){return this._rows}get columns(){return this._cols}getCellData(e,t,i){let l,s=this._g,o=this._rows[wijmo_1.asNumber(e,!1,!0)],n=null;if(!o)return null;t=this._toIndex(t);l=this._cols[wijmo_1.asNumber(t,!1,!0)];let r=s?s._getBindingColumn(this,e,l):l,a=null;o instanceof GroupRow&&o.dataItem instanceof wijmo_1.CollectionViewGroup&&!s.childItemsPath&&(a=o.dataItem);r.binding&&o.dataItem&&!a?n=r._binding.getValue(o.dataItem):o._ubv&&(n=o._ubv[l._hash]);if(null==n){let i=CellType;switch(this._ct){case i.TopLeft:case i.ColumnHeader:e!=this._rows.length-1&&r==l||(n=r.header);break;case i.ColumnFooter:if(o instanceof GroupRow&&r.aggregate!=wijmo_1.Aggregate.None){let e=this._g.collectionView;if(e){let t=wijmo_1.tryCast(e,wijmo_1.CollectionView);n=t?t.getAggregate(r.aggregate,r.binding):wijmo_1.getAggregate(r.aggregate,e.items,r.binding)}}break;case i.Cell:o instanceof GroupRow&&(t==this._cols.firstVisibleIndex?n=o.getGroupHeader():a&&r.aggregate!=wijmo_1.Aggregate.None&&(n=a.getAggregate(r.aggregate,r.binding,this._g.collectionView,this._g)))}}if(i){let e=r.dataMap||o.dataMap;if(this.cellType==CellType.Cell&&r._edt&&r._edt._ctl instanceof wijmo_input_1.MultiSelect&&n){let e=new wijmo_1.Binding(r._edt._ctl.displayMemberPath),t=e&&wijmo_1.isArray(n)?n.map(t=>e.getValue(t)):n;if(wijmo_1.isArray(t)&&t.length>0){let e=t.join(", ");n=wijmo_1.format(e||wijmo_1.culture.MultiSelect.itemsSelected,{count:t.length})}}else this.cellType==CellType.Cell&&e&&(n=e.getDisplayValue(n));n=null!=n?wijmo_1.Globalize.format(n,r.format||o.format):""}return n}setCellData(e,t,i,l=!0,s=!0,o=!1){let n=this._g,r=this._rows[wijmo_1.asNumber(e,!1,!0)],a=this._cols[wijmo_1.asNumber(this._toIndex(t),!1,!0)],h=wijmo_1.DataType;if(!r)return!1;let d=n?n._getBindingColumn(this,e,a):a,c=d.dataMap||r.dataMap;if(this._ct==CellType.Cell){let s=d.getIsRequired(r),a=d.isContentHtml||r.isContentHtml;if(!o&&c&&null!=i){let e=c.getKeyValue(i,a);if(null==e&&null==c.getDisplayValue(null)){if(c.getDisplayValue(i)!=i);else if(!c.isEditable||c.displayMemberPath!=c.selectedValuePath){if(""!=i||s||!n.commitEmptyEdits)return!1;i=null}}else i=e}let _=h.Object,u=d.dataType||r.dataType,g=this.getCellData(e,t,!1);_=u||wijmo_1.getType(g);if(null==i||""===i&&l&&!c){if(s||!n.commitEmptyEdits&&(null==g||""===g))return!1;_!=h.String&&(i=null);l=!1}if("NaN"==i&&Number.isNaN(g)&&!n.commitEmptyEdits)return!1;if(l){let e=d.format||r.format;e||_!=h.Date||(e="d");d.mask&&wijmo_1.isString(i)&&_!=h.String&&(i=i.replace(/_/g,""));i=wijmo_1.changeType(i,_,e,g);if(_!=h.Object&&wijmo_1.getType(i)!=_)return!1}}if(r.dataItem&&d.binding){let e=d._binding,t=r.dataItem,l=e.getValue(t);if(i!==l&&(c&&!c.serializeKeys||!wijmo_1.DateTime.equals(i,l))){let l=n.collectionView,s=l instanceof wijmo_1.CollectionView&&t!=l.currentEditItem&&l.trackChanges,o=null;s&&(o=l._extend({},t));e.setValue(t,i);if(s){let e=new wijmo_1.NotifyCollectionChangedEventArgs(wijmo_1.NotifyCollectionChangedAction.Change,t,l.items.indexOf(t));l.onCollectionChanged(e,o)}}}else{r._ubv||(r._ubv={});r._ubv[a._hash]=i}s&&n&&n.invalidate();return!0}getCellBoundingRect(e,t,i){let l=this._g,s=this.rows[e],o=this.columns[this._toIndex(t)],n=new wijmo_1.Rect(o.pos,s.pos,o.renderSize,s.renderSize);if(l.rightToLeft){n.left=this.hostElement.clientWidth-n.right;wijmo_1.isIE()||(n.left-=l._root.offsetWidth-l._root.clientWidth)}if(!i){let e=this.hostElement.getBoundingClientRect();n.left+=e.left;n.top+=e.top-this._offsetY}e<this.rows.frozen&&(n.top-=l.scrollPosition.y);Number(t)<Number(this.columns.frozen)&&(n.left-=l.scrollPosition.x*(l.rightToLeft?-1:1));return n}getCellElement(e,t){let i=this.hostElement.children,l=Math.min(e+2,i.length);t=this._toIndex(t);for(let s=0;s<l;s++){let l=i[s].children,o=Math.min(t+2,l.length);for(let i=0;i<o;i++){let s=l[i],o=s[GridPanel._INDEX_KEY];if(o&&(o.row==e&&o.col==t||o.rng&&o.rng.contains(e,t)))return s}}return null}getSelectedState(e,t,i){let l=this._g,s=l.selectionMode,o=l._selHdl.selection,n=SelectionMode,r=SelectedState;if(s==n.None)return r.None;t=this._toIndex(t);switch(this._ct){case CellType.Cell:i||(i=l.getMergedRange(this,e,t));var a=l._getAnchorCell();if(i){if(i.contains(o.row,o.col)){if(!l.anchorCursor||null==a)return l.showMarquee?r.Active:r.Cursor;if(e==a.y&&t==a.x||i.row==a.y&&i.col==a.x)return l.showMarquee?r.Active:r.Cursor}if(i.intersects(o)&&l.anchorCursor&&null!=a&&(e==a.y&&t==a.x||i.row==a.y&&i.col==a.x))return l.showMarquee?r.Active:r.Cursor;if(i.intersects(o)&&s!=n.ListBox)return r.Selected;for(let e=i.leftCol;e<=i.rightCol;e++)if(l.columns[e]&&l.columns[e].isSelected)return r.Selected;for(let e=i.topRow;e<=i.bottomRow;e++)if(l.rows[e].isSelected)return r.Selected}if(l.anchorCursor&&null!=a){if(e==a.y&&t==a.x)return l.showMarquee?r.Active:r.Cursor}else if(o.row==e&&o.col==t)return l.showMarquee?r.Active:r.Cursor;if(l.rows[e].isSelected||l.columns[t].isSelected)return r.Selected;if(s==n.MultiRange){let s=l._selHdl.extendedSelection;for(let l=0;l<s.length;l++)if(s[l].contains(e,t)||i&&i.intersects(s[l]))return r.Selected}if(i)switch(s){case n.Row:case n.RowRange:if(i.containsRow(o.row))return r.Selected}return s==n.ListBox?r.None:(o=this._getAdjustedSelection(o)).containsRow(e)&&o.containsColumn(t)?r.Selected:r.None;case CellType.ColumnHeader:if(l.showSelectedHeaders&HeadersVisibility.Column&&(l.columns[t].isSelected||o.containsColumn(t)||o.intersectsColumn(i))){i&&(e=i.bottomRow);if(e==this.rows.length-1)return r.Selected}break;case CellType.RowHeader:if(l.showSelectedHeaders&HeadersVisibility.Row&&(l.rows[e].isSelected||o.containsRow(e)||o.intersectsRow(i))){i&&(t=i.rightCol);if(t==this.columns.length-1)return r.Selected}}return r.None}get hostElement(){return this._e}_toIndex(e){if(wijmo_1.isString(e)&&(e=this._cols.indexOf(e))<0)throw"Invalid column name or binding.";return e}_getAdjustedSelection(e){let t=this._g,i=this._rng,l=SelectionMode;switch(t.selectionMode){case l.Cell:i.setRange(e.row,e.col,e.row,e.col);break;case l.Row:i.setRange(e.row,0,e.row,t.columns.length-1);break;case l.RowRange:case l.ListBox:i.setRange(e.row,0,e.row2,t.columns.length-1);break;default:i.copy(e)}return i}_getOffsetY(){return this._offsetY}_updateContent(e,t,i){let l=this._g,s=this._e,o=this._rows,n=this._cols,r=this._ct;if(r==CellType.ColumnHeader||r==CellType.ColumnFooter||r==CellType.RowHeader){let e=l._ptScrl,t=s.style;r==CellType.RowHeader?t.top=e.y+"px":l.rightToLeft?t.right=e.x+"px":t.left=e.x+"px"}if(this._offsetY!=i){e=!1;this._offsetY=i}let a=this._getViewRange(),h=a;if(h.isValid){let e=o.length<=l._vtRows?o.length:0,t=n.length<=l._vtCols?n.length:0;h=new CellRange(Math.max(a.row-e,o.frozen),Math.max(a.col-t,n.frozen),Math.min(a.row2+e,o.length-1),Math.min(a.col2+t,n.length-1))}if(e&&!t&&this._vrb.contains(a)&&!o.frozen&&!n.frozen)return this._activeCell;e&&h.equals(this._vrb)||(t=!1);e&&!t&&this._ct!=CellType.TopLeft&&this._reorderCells(h,this._vrb);this._activeCell=null;this._vru=a;this._vrb=h;this._recycle=e;let d=0;this._ct!=CellType.Cell||[HeadersFocusability.All,HeadersFocusability.Column].includes(this._g.headersFocusability)||(d=this._renderColHdrRow(h,t));this._updateCells(t,d);return this._activeCell}_updateCells(e,t){this._e;let i=this._rows;for(let l=0;l<i.frozen&&l<i.length;l++)t=this._renderRow(l,this._vrb,e,t);for(let i=this._vrb.topRow;i<=this._vrb.bottomRow&&i>-1;i++)t=this._renderRow(i,this._vrb,e,t);this._scanAndRemoveExtraCells(t)}_scanAndRemoveExtraCells(e){let t=this._e;for(;t.childElementCount>e;){let e=t.lastElementChild;wijmo_1.removeChild(e);this._removeExtraCells(e,0)}}_clearCells(){let e=this.hostElement,t=this._g.cellFactory;for(let i=e.childElementCount-1;i>=0;i--){let l=e.children[i];wijmo_1.removeChild(l);for(let e=l.childElementCount-1;e>=0;e--)t.disposeCell(l.children[e])}}_reorderCells(e,t){if(!(this._g._reorderCells&&t.isValid&&e.isValid&&e.intersects(t)))return;const relocateForScrollToBeginning=(e,t,i,l,s,o)=>{wijmo_1.assert(i<0,"Scroll delta must be a negative number");let n,r,a=-i,h=t+(l-s+1),d=e.childElementCount-h;if(d<a&&d>0){n=d;r=a-d}else{n=a;r=0}if(n>0){let i=this._createRange(e,h,h+n);i&&e.insertBefore(i.extractContents(),e.children[t])}if(r>0){let i=e.children[t];for(let t=0;t<r;t++){let t=document.createElement("div");t.className=o;e.insertBefore(t,i)}}};if(e.row!=t.row){let i=this._e,l=e.row-t.row;if(0!=l){let s=this._ct==CellType.Cell?1:0,o=i.childElementCount;s+=this.rows.frozen;if(l>0){let e=s,t=Math.min(s+l,o),n=this._createRange(i,e,t);n&&i.appendChild(n.extractContents())}else relocateForScrollToBeginning(i,s,l,e.row2,t.row,"wj-row")}}if(e.col!=t.col){let i=this._e,l=e.col-t.col;if(0!=l){let s=this._ct==CellType.Cell&&this._g.rowHeaderPath?1:0;s+=this.columns.frozen;for(let o=0;o<i.children.length;o++){let n=i.children[o],r=n.children.length;if(wijmo_1.hasClass(n,"wj-row"))if(l>0){let e=s,t=Math.min(s+l,r),i=this._createRange(n,e,t);i&&n.appendChild(i.extractContents())}else relocateForScrollToBeginning(n,s,l,e.col2,t.col,"wj-cell")}}}}_createRange(e,t,i){if(i>t&&i<=e.children.length&&t>-1){this._docRange||(this._docRange=document.createRange());let l=this._docRange;l.setStart(e,t);l.setEnd(e,i);return l}return null}_renderColHdrRow(e,t){if(t)return 1;let i=this._e.children[0];i||(i=wijmo_1.createElement('<div class="wj-row" role="row"></div>',this._e));let l=this._g,s=l?l.columnHeaders.rows.ariaLabel:null;wijmo_1.setAttribute(i,"aria-label",s);wijmo_1.setAttribute(i,"aria-selected",null);let o=0,n=this._g._getRowHeaderPath();n&&(o=this._renderRowHdrCell(i,-1,n.path));for(let l=0;l<this.columns.frozen&&l<this.columns.length;l++)o=this._renderColHdrCell(i,l,e,t,o);for(let l=e.leftCol;l<=e.rightCol&&l>-1;l++)o=this._renderColHdrCell(i,l,e,t,o);[HeadersVisibility.None,HeadersVisibility.Row].includes(l.headersVisibility)&&wijmo_1.setAttribute(i.closest(".wj-row"),"aria-hidden","true");this._removeExtraCells(i,o);return 1}_renderColHdrCell(e,t,i,l,s){let o=this.grid,n=this.columns[t];if(n.renderSize<=0)return s;if(l)return s+1;let r=e.children[s];r||(r=wijmo_1.createElement(GridPanel._HTML_CELL,e));if(r&&this._recycle&&o._lazyRender){let e=r[GridPanel._INDEX_KEY];if(e&&-1==e.row&&e.col==t&&t>=this.columns.frozen)return s+1}r.textContent=this.columns[t].header;wijmo_1.setCss(r,{position:"fixed",left:n.pos,top:-32e3,width:n.renderSize,height:.1,overflow:"hidden",opacity:"0",pointerEvents:"none"});exports.colHdrAriaAttributes(r,n,this,o);r[GridPanel._INDEX_KEY]={row:-1,col:t,panel:this};return s+1}_renderRowHdrCell(e,t,i){let l=e.children[0];l||(l=wijmo_1.createElement(GridPanel._HTML_CELL,e));l.setAttribute("role",t<0?"columnheader":"rowheader");l.textContent=i?i.toString():"";wijmo_1.setCss(l,{position:"fixed",left:-32e3,top:-32e3,width:.1,height:.1,overflow:"hidden",opacity:"0"});l[GridPanel._INDEX_KEY]={row:t,col:-1,panel:this};return 1}_renderRow(e,t,i,l){let s=this._g,o=this.rows[e];if(o.renderSize<=0)return l;let n=this._e.children[l];n||(n=wijmo_1.createElement('<div class="wj-row"></div>',this._e));if(this._ct==CellType.Cell){n.setAttribute("role","row");let t=SelectionMode,i=o.isSelected;switch(s.selectionMode){case t.Row:case t.RowRange:i=i||this._g._selHdl.selection.containsRow(e)}wijmo_1.setAttribute(n,"aria-selected",!!i||null);wijmo_1.setAttribute(n,"aria-level",o instanceof GroupRow?o.level+1:null);wijmo_1.setAttribute(n,"aria-expanded",o instanceof GroupRow?!o.isCollapsed:null);this.rows.ariaLabel&&wijmo_1.setAttribute(n,"aria-label",this.rows.ariaLabel)}let r=0;if(this._ct==CellType.Cell){let t=this._g._getRowHeaderPath();t&&(r=this._renderRowHdrCell(n,e,t.getValue(o.dataItem)))}for(let l=0;l<this.columns.frozen&&l<this.columns.length;l++)r=this._renderCell(n,e,l,t,i,r);for(let l=t.leftCol;l<=t.rightCol&&l>-1;l++)r=this._renderCell(n,e,l,t,i,r);this._removeExtraCells(n,r);return l+1}_renderCell(e,t,i,l,s,o){let n=this._g,r=this._ct==CellType.Cell?n.getMergedRange(this,t,i,!1):n.getMergedRange(this,t,i);if(r){for(let e=Math.max(l.row,r.row);e<t;e++)if(this.rows[e].renderSize)return o;for(let e=Math.max(l.col,r.col);e<i;e++)if(this.columns[e].renderSize)return o;if(t>=r.row&&t<=r.row2&&i>r.col&&i<=r.col2&&this._ct===CellType.Cell&&r.isSingleCell)return o;var a=this.columns.frozen;if(a&&r.col<a&&r.col2>=a&&i>r.col)return o}let h=this.columns[i];if((!h||h.renderSize<=0)&&(!r||r.getRenderSize(this).width<=0))return o;let d=e.children[o];if(d&&!s&&this._recycle&&n._lazyRender&&!n.activeEditor){let e=d[GridPanel._INDEX_KEY];e&&e.row==t&&e.col==i&&e.rng==r&&t>=this.rows.frozen&&i>=this.columns.frozen&&(s=!0)}let c=SelectedState,_=this.getSelectedState(t,i,r),u=_==c.Cursor||_==c.Active;if(d&&s){wijmo_1.toggleClass(d,"wj-state-active",u);wijmo_1.toggleClass(d,"wj-state-selected",_==c.Cursor);wijmo_1.toggleClass(d,"wj-state-multi-selected",_==c.Selected);const e=d.querySelector(".wj-column-selector");e?u||_!=c.None?wijmo_1.setAttribute(d,"aria-selected",!!e.checked):wijmo_1.setAttribute(d,"aria-selected",null):wijmo_1.setAttribute(d,"aria-selected",!(!u&&_==c.None)||null);u&&(this._activeCell=d);return o+1}d||(d=wijmo_1.createElement(GridPanel._HTML_CELL,e));u&&(this._activeCell=d);if(this._ct==CellType.Cell){wijmo_1.setAttribute(d,"role","gridcell");wijmo_1.setAttribute(d,"aria-selected",!(_==c.None&&!u)||null);let e=!n.canEditCell(t,i)||null;wijmo_1.setAttribute(d,"aria-readonly",e);wijmo_1.setAttribute(d,"aria-required",e?null:h.getIsRequired())}n.cellFactory.updateCell(this,t,i,d,r);d[GridPanel._INDEX_KEY]={row:t,col:i,rng:r,panel:this};return o+1}_removeExtraCells(e,t){let i=this._g.cellFactory;for(;e.childElementCount>t;){let t=e.lastElementChild;wijmo_1.removeChild(t);i.disposeCell(t)}for(let t=e.childElementCount-1;t>-1;--t){const[l,s]=[e.children[t],e.children[t-1]];if(!l||!s)continue;const o=l.getAttribute("style")===s.getAttribute("style"),n=l.innerHTML===s.innerHTML;if(!o||!n)break;wijmo_1.removeChild(l);i.disposeCell(l)}}_getViewRange(){let e=this._g,t=e._ptScrl,i=e._szClientSB,l=this._rows,s=this._cols,o=new CellRange(0,0,l.length-1,s.length-1);if(this._ct==CellType.Cell||this._ct==CellType.RowHeader){let s=-t.y+this._offsetY,n=i.height,r=Math.min(l.frozen,l.length-1);if(r>0){let e=l[r-1].pos;s+=e;n-=e}if(r>0&&l[r].pos>i.height)o.row=o.row2=-1;else{o.row=Math.min(l.length-1,Math.max(r,l.getItemAt(s)));o.row2=Math.max(o.row,l.getItemAt(s+n))}let a=e.hostElement;if(e._clipToScreen&&a){let t=a.getBoundingClientRect(),i=-t.top-e.cells._e.offsetTop;t.top<0&&(o.row=Math.max(o.row,l.getItemAt(i)-1));t.bottom>innerHeight&&(o.row2=Math.min(o.row2,l.getItemAt(i+innerHeight)+1))}}if(this._ct==CellType.Cell||this._ct==CellType.ColumnHeader){let e=-t.x,l=i.width,n=Math.min(s.frozen,s.length-1);if(n>0){let t=s[n-1].pos;e+=t;l-=t}if(n>0&&s[n].pos>i.width)o.col=o.col2=-1;else{o.col=Math.min(s.length-1,Math.max(n,s.getItemAt(e)));o.col2=Math.max(o.col,s.getItemAt(e+l))}}l.length<=l.frozen&&(o.row=o.row2=-1);s.length<=s.frozen&&(o.col=o.col2=-1);return o}_getFrozenPos(){let e=this._rows.frozen,t=this._cols.frozen,i=e>0?this._rows[e-1]:null,l=t>0?this._cols[t-1]:null,s=i?i.pos+i.renderSize:0,o=l?l.pos+l.renderSize:0;return new wijmo_1.Point(o,s)}}GridPanel._INDEX_KEY="wj-cell-index";GridPanel._HTML_CELL='<div class="wj-cell" tabindex="-1"></div>';exports.GridPanel=GridPanel;class CellRangeEventArgs extends wijmo_1.CancelEventArgs{constructor(e,t,i){super();this._p=wijmo_1.asType(e,GridPanel,!0);this._rng=wijmo_1.asType(t,CellRange,!0);this._data=i}get panel(){return this._p}get range(){return this._rng.clone()}get row(){return this._rng.row}get col(){return this._rng.col}get data(){return this._data}set data(e){this._data=e}getRow(){return this._p&&this.row>-1?this._p.rows[this.row]:null}getColumn(e){let t=this._p,i=t&&this.col>-1?t.columns[this.col]:null;if(i&&e){let e=t.grid;i=t.cellType===CellType.ColumnHeader&&e._hasColumnGroups()?e._getColumnGroup(this.row,this.col):t.grid._getBindingColumn(t,this.row,i)}return i}}exports.CellRangeEventArgs=CellRangeEventArgs;class FormatItemEventArgs extends CellRangeEventArgs{constructor(e,t,i,l=!0){super(e,t);this._updateContent=!0;this._cell=wijmo_1.asType(i,HTMLElement)}get cell(){return this._cell}get updateContent(){return this._updateContent}}exports.FormatItemEventArgs=FormatItemEventArgs;class CellEditEndingEventArgs extends CellRangeEventArgs{constructor(){super(...arguments);this._stayInEditMode=!1;this._refresh=!0}get stayInEditMode(){return this._stayInEditMode}set stayInEditMode(e){this._stayInEditMode=wijmo_1.asBoolean(e)}get refresh(){return this._refresh}set refresh(e){this._refresh=wijmo_1.asBoolean(e)}get previousData(){return null!=this._previousData?this._previousData:this._data}set previousData(e){this._previousData=e}}exports.CellEditEndingEventArgs=CellEditEndingEventArgs;!function(e){e[e.None=0]="None";e[e.Cell=1]="Cell";e[e.CellRange=2]="CellRange";e[e.Row=3]="Row";e[e.RowRange=4]="RowRange";e[e.ListBox=5]="ListBox";e[e.MultiRange=6]="MultiRange"}(SelectionMode=exports.SelectionMode||(exports.SelectionMode={}));!function(e){e[e.None=0]="None";e[e.Selected=1]="Selected";e[e.Cursor=2]="Cursor";e[e.Active=3]="Active"}(SelectedState=exports.SelectedState||(exports.SelectedState={}));!function(e){e[e.None=0]="None";e[e.Next=1]="Next";e[e.Prev=2]="Prev";e[e.NextPage=3]="NextPage";e[e.PrevPage=4]="PrevPage";e[e.Home=5]="Home";e[e.End=6]="End";e[e.NextCell=7]="NextCell";e[e.PrevCell=8]="PrevCell";e[e.NextEditableCell=9]="NextEditableCell";e[e.PrevEditableCell=10]="PrevEditableCell"}(SelMove=exports.SelMove||(exports.SelMove={}));class _SelectionHandler{constructor(e){this._sel=new CellRange(0,0);this._xSel=new wijmo_1.ObservableArray;this._mode=SelectionMode.CellRange;this._g=e;this._e=new CellRangeEventArgs(e.cells,new CellRange(0,0));this._xSel.collectionChanged.addHandler(()=>{e.invalidate()})}get selectionMode(){return this._mode}set selectionMode(e){e!=this._mode&&this._setSelectionMode(e)}get selection(){return this._sel}set selection(e){this.select(e)}get extendedSelection(){return this._xSel}select(e,t=!0,i=!1){let l=this._g,s=this._e.range,o=this._sel,n=s,r=!1,a=SelectionMode;if(wijmo_1.isNumber(e)&&wijmo_1.isString(t)){let i=l.columns.indexOf(t);if(i<0)throw"Invalid column name or binding.";s.setRange(e,i);t=!0}else if(wijmo_1.isNumber(e)&&wijmo_1.isNumber(t)){s.setRange(e,t);t=!0}else e instanceof CellRange?s.copy(e):wijmo_1.assert(!1,"CellRange expected");switch(l.selectionMode){case a.Cell:n.row2=n.row;n.col2=n.col;break;case a.Row:n.row2=n.row;break;case a.ListBox:r=!0}let h=n.equals(o);if(h&&r)for(let e=0;e<l.rows.length;e++)if(l.rows[e].isSelected!==n.containsRow(e)){h=!1;break}if(h){t&&l.isRangeValid(n)&&this._showSelection();return!0}let d=wijmo_1.Control.getControl(wijmo_1.closest(wijmo_1.getActiveElement(),".wj-flexgrid"));if(d&&d.activeEditor&&!d.finishEditing())return!1;let c=this._e;c._rng=n;c.cancel=!1;if(!l.onSelectionChanging(c)&&!i)return!1;r&&l.rows.forEach((e,t)=>{e._setFlag(RowColFlags.Selected,n.containsRow(t),!0)});n.row=Math.min(n.row,l.rows.length-1);n.row2=Math.min(n.row2,l.rows.length-1);this._sel.copy(n);l.refreshCells(!1,!0,!0);t&&this._showSelection();let _=l.collectionView;if(_){let e=l._getCvIndex(n.row);_.moveCurrentToPosition(e)}this._g.errorTip.hide();const u=wijmo_1.getActiveElement();u.classList.contains("wj-state-invalid")&&this._g.errorTip._showAutoTip(void 0,u);l.onSelectionChanged(c);return!0}moveSelection(e,t,i){let l=this._g,s=this._sel,o=i&&l.anchorCursor?new CellRange(s.row2,s.col2):new CellRange(s.row,s.col),n=o.row,r=o.col,a=l.columns,h=Math.max(0,l._szClient.height-l.columnHeaders.height),d=SelMove,c=-1;var _=l.getMergedRange(l.cells,n,r);_&&(t==d.NextCell||t==d.NextEditableCell?r=_.rightCol:t!=d.PrevCell&&t!=d.PrevEditableCell||(r=_.leftCol));switch(t){case d.NextCell:case d.NextEditableCell:c=r;(r=this._getNextColumnCell(n,c,t))!=c&&(_=l.getMergedRange(l.cells,n,r))&&r<_.col2&&(r=_.col2);if(r==c)for(;;){if(n==l.rows.length-1){r=o.col;n=o.row;break}let e=!1;if((n=this._getNextRowCell(n,r,t))>o.row){c=-1;for(;c<a.length;){if((r=this._getNextColumnCell(n,c,t))==c){e=!0;break}(_=l.getMergedRange(l.cells,n,r))&&r<_.col2&&(r=_.col2);break}if(e)continue}break}l.select(n,r);break;case d.PrevCell:case d.PrevEditableCell:c=r;(r=this._getNextColumnCell(n,c,t))!=c&&(_=l.getMergedRange(l.cells,n,r))&&r>_.col&&(r=_.col);if(r==c)for(;;){if(0==n){r=o.col;n=o.row;break}let e=!1;if((n=this._getNextRowCell(n,r,t))<o.row){c=a.length;for(;c>-1;){(r=this._getNextColumnCell(n,c,t))!=c?(_=l.getMergedRange(l.cells,n,r))&&r>_.col&&(r=_.col):e=!0;break}if(e)continue}break}l.select(n,r);break;default:if(!this.moveHeaderCells(e,t,n,r)){n=this._getNextRowCell(n,r,e,h);r=this._getNextColumnCell(n,r,t,h);i?l.selection=l.anchorCursor?new CellRange(s.row,s.col,n,r):new CellRange(n,r,s.row2,s.col2):l.select(n,r);break}}}moveHeaderCells(e,t,i,l){const s=this._g,o=[HeadersFocusability.Column,HeadersFocusability.All].includes(s.headersFocusability),n=[HeadersFocusability.Row,HeadersFocusability.All].includes(s.headersFocusability),r=s.activePanelType===CellType.ColumnHeader,a=s.activePanelType===CellType.RowHeader,h=s.activePanelType===CellType.TopLeft,d=s.activePanelType===CellType.Cell,c=2===e?"up":1===e?"down":2===t?"left":1===t?"right":void 0,_=Array.from(s.activePanel.hostElement.getElementsByClassName("wj-focus-header-cell"))[0];if(d&&o&&0===i&&"up"===c){s.activePanelType=CellType.ColumnHeader;const e=Array.from(s.activePanel.hostElement.getElementsByClassName("wj-row")),t=Array.from(s._gpCells.hostElement.getElementsByClassName("wj-row"))[0],i=e[e.length-1];(Array.from(t.getElementsByClassName("wj-cell")).find(e=>e["wj-cell-index"].col===l)||Array.from(t.getElementsByClassName("wj-cell"))[0]).setAttribute("tabindex","-1");const o=Array.from(i.getElementsByClassName("wj-cell")).find(e=>e["wj-cell-index"].col===l);o.classList.add("wj-focus-header-cell");o.setAttribute("tabindex","0");s._hideMarquee();o.focus();return!0}if(d&&n&&0===l&&"left"===c){s.activePanelType=CellType.RowHeader;const e=Array.from(s.activePanel.hostElement.getElementsByClassName("wj-row")).find(e=>Array.from(e.getElementsByClassName("wj-cell")).some(e=>e["wj-cell-index"].row===i));if(!e)return!0;const t=Array.from(e.getElementsByClassName("wj-cell")),l=t[t.length-1];l.classList.add("wj-focus-header-cell");l.setAttribute("tabindex","0");s._hideMarquee();l.focus();return!0}if(r&&_){const e=_.nextElementSibling,t=_.previousElementSibling;if(_&&"right"===c&&e){_.classList.remove("wj-focus-header-cell");_.setAttribute("tabindex","-1");s.scrollIntoView(0,_["wj-cell-index"].col+1);setTimeout(()=>{e.classList.add("wj-focus-header-cell");e.setAttribute("tabindex","0");s._hideMarquee();e.focus()},10)}else if(_&&"left"===c){_.classList.remove("wj-focus-header-cell");_.setAttribute("tabindex","-1");if(t){s.scrollIntoView(0,_["wj-cell-index"].col-1);setTimeout(()=>{t.classList.add("wj-focus-header-cell");t.setAttribute("tabindex","0");s._hideMarquee();t.focus()},10)}else{s.activePanelType=CellType.TopLeft;const e=Array.from(s.activePanel.hostElement.getElementsByClassName("wj-cell"))[0];e&&setTimeout(()=>{e.classList.add("wj-focus-header-cell");e.setAttribute("tabindex","0");s._hideMarquee();e.focus()},10)}}else if(_&&"down"===c){const e=Array.from(_.parentElement.children).indexOf(_);s.activePanelType=CellType.Cell;s.focus();s.select(0,e);s._updateMarquee()}return!0}if(a&&_){const e=Array.from(_.parentElement.children).indexOf(_),t=_["wj-cell-index"].row,i=_.parentElement.nextElementSibling&&Array.from(_.parentElement.nextElementSibling.children)[e],l=_.parentElement.previousElementSibling&&Array.from(_.parentElement.previousElementSibling.children)[e];if("up"===c){_.classList.remove("wj-focus-header-cell");_.setAttribute("tabindex","-1");if(l){s.scrollIntoView(t-1,0);setTimeout(()=>{l.classList.add("wj-focus-header-cell");l.setAttribute("tabindex","0");l.focus()},10)}else{s.activePanelType=CellType.TopLeft;const e=Array.from(s.activePanel.hostElement.getElementsByClassName("wj-cell"))[0];e&&setTimeout(()=>{e.classList.add("wj-focus-header-cell");e.setAttribute("tabindex","0");s._hideMarquee();e.focus()},10)}}else if("down"===c&&i){_.classList.remove("wj-focus-header-cell");_.setAttribute("tabindex","-1");s.scrollIntoView(t+1,0);setTimeout(()=>{i.classList.add("wj-focus-header-cell");i.setAttribute("tabindex","0");i.focus()},10)}else if(_&&"right"===c){s.activePanelType=CellType.Cell;_.classList.remove("wj-focus-header-cell");_.setAttribute("tabindex","-1");s.focus();s.select(t,0)}return!0}if(h&&_){if("down"===c&&n){s.activePanelType=CellType.RowHeader;_.classList.remove("wj-focus-header-cell");_.setAttribute("tabindex","-1");const e=Array.from(s.activePanel.hostElement.getElementsByClassName("wj-cell"))[0];e&&setTimeout(()=>{e.classList.add("wj-focus-header-cell");e.setAttribute("tabindex","0");e.focus()},10)}if("right"===c&&o){s.activePanelType=CellType.ColumnHeader;_.classList.remove("wj-focus-header-cell");_.setAttribute("tabindex","-1");const e=Array.from(s.activePanel.hostElement.getElementsByClassName("wj-cell"))[0];e&&setTimeout(()=>{e.classList.add("wj-focus-header-cell");e.setAttribute("tabindex","0");e.focus()},10)}return!0}return!1}_getNextColumnCell(e,t,i,l=0){return this._g.columns.getNextCell(t,i,l)}_getNextRowCell(e,t,i,l=0){return this._g.rows.getNextCell(e,i,l)}_setSelectionMode(e){let t=this._g,i=t.rows;this._mode=e;this._xSel.clear();if(i.length){this._adjustSelection(this._sel,e,!0);t.invalidate()}}_adjustSelection(e,t,i=!1){const l=this._g.rows,s=SelectionMode;let o=this._g.hostElement.querySelector("input.wj-column-selector")instanceof HTMLInputElement;if(!o)for(let e=0;e<l.length;e++)l[e]._setFlag(RowColFlags.Selected,!1,!0);let n=e.clone();switch(t){case s.None:n=new CellRange;break;case s.Cell:n=new CellRange(e.row,e.col);break;case s.ListBox:if(o)return;for(let e=0;e<l.length;e++)l[e]._setFlag(RowColFlags.Selected,n.containsRow(e),!0)}this.select(n,!1,i)}_expandSelection(){let e=this._g,t=e.selectionMode;if(e.expandSelectionOnCopyPaste&&t){let i=this.selection,l=SelectionMode;switch(t){case l.Cell:case l.Row:break;case l.ListBox:this._expandSelectedRows();break;case l.RowRange:i=new CellRange(i.topRow,0,i.bottomRow,e.columns.length-1);default:let t=this._expandSelectionRange(i);t&&this.select(t,!1)}}}_deselectRange(e){let t=this.selection,i=this.extendedSelection;if(t.contains(e)){let e=i.length;this._sel=e?i[e-1]:new CellRange;e&&i.removeAt(e-1);return!0}for(let t=0;t<i.length;t++)if(i[t].contains(e)){i.removeAt(t);return!0}return!1}_expandSelectedRows(){wijmo_1.assert(this.selectionMode==SelectionMode.ListBox,"ListBox mode expected");let e=this._g,t=e.selectedRows.map(e=>e.index),i=[];for(let l=0;l<t.length;l++){let s=new CellRange(t[l],0,t[l],e.columns.length-1),o=this._expandSelectionRange(s)||s;for(let e=o.topRow;e<=o.bottomRow;e++)-1===i.indexOf(e)&&i.push(e)}i.sort();this._selectRows(i)}_expandSelectionRange(e){let t=this._g,i=t.cells,l=t.getMergedRange(i,e.topRow,e.leftCol,!1),s=t.getMergedRange(i,e.bottomRow,e.leftCol,!1),o=t.getMergedRange(i,e.topRow,e.rightCol,!1),n=t.getMergedRange(i,e.bottomRow,e.rightCol,!1);if(l||s||o||n){l=l||new CellRange(e.topRow,e.leftCol);s=s||new CellRange(e.bottomRow,e.leftCol);o=o||new CellRange(e.topRow,e.rightCol);n=n||new CellRange(e.bottomRow,e.rightCol);return new CellRange(Math.min(l.topRow,s.topRow,o.topRow,n.topRow),Math.min(l.leftCol,s.leftCol,o.leftCol,n.leftCol),Math.max(l.bottomRow,s.bottomRow,o.bottomRow,n.bottomRow),Math.max(l.rightCol,s.rightCol,o.rightCol,n.rightCol))}return null}_selectRows(e){wijmo_1.assert(this.selectionMode==SelectionMode.ListBox,"ListBox mode expected");let t=this._g;for(let i=0,l=!0;i<t.rows.length;i++){let s=t.rows[i],o=e&&e.indexOf(s.index)>-1;if(o&&l){l=!1;this.select(i,this.selection.col)}s.isSelected=o}}_showSelection(){let e=this._g,t=this._sel;e.anchorCursor?e.scrollIntoView(t.row2,t.col2):e.scrollIntoView(t.row,t.col)}_adjustReferenceCell(e,t,i){let l=this._g,s=l.getMergedRange(l.cells,e.row,e.col);if(s&&!s.isSingleCell){let l=SelMove;switch(t){case l.Next:case l.NextCell:case l.NextEditableCell:e.row=s.bottomRow;break;case l.Prev:case l.PrevCell:case l.PrevEditableCell:e.row=s.topRow}switch(i){case l.Next:case l.NextCell:case l.NextEditableCell:e.col=s.rightCol;break;case l.Prev:case l.PrevCell:case l.PrevEditableCell:e.col=s.leftCol}}}}exports._SelectionHandler=_SelectionHandler;!function(e){e[e.Visible=1]="Visible";e[e.AllowResizing=2]="AllowResizing";e[e.AllowDragging=4]="AllowDragging";e[e.AllowMerging=8]="AllowMerging";e[e.AllowSorting=16]="AllowSorting";e[e.AutoGenerated=32]="AutoGenerated";e[e.Collapsed=64]="Collapsed";e[e.ParentCollapsed=128]="ParentCollapsed";e[e.Selected=256]="Selected";e[e.ReadOnly=512]="ReadOnly";e[e.HtmlContent=1024]="HtmlContent";e[e.WordWrap=2048]="WordWrap";e[e.MultiLine=4096]="MultiLine";e[e.HasTemplate=8192]="HasTemplate";e[e.RowDefault=3]="RowDefault";e[e.ColumnDefault=23]="ColumnDefault"}(RowColFlags=exports.RowColFlags||(exports.RowColFlags={}));class RowCol{constructor(){this._type=null;this._align=null;this._inpType=null;this._mask=null;this._maxLen=null;this._required=null;this._fmt=null;this._map=null;this._ddCssClass=null;this._cssClass=null;this._cssClassAll=null;this._szMin=null;this._szMax=null;this._sz=null;this._pos=0;this._idx=-1;this._idxVis=-1;this._idxData=-1;this.gridChanged=new wijmo_1.Event}get binding(){return this._binding?this._binding.path:null}set binding(e){if(e!=this.binding){let t=wijmo_1.asString(e);this._binding=t?new wijmo_1.Binding(t):null;if(!this._type&&this.grid&&this._binding){let e=this.grid.collectionView;if(e&&e.sourceCollection&&e.sourceCollection.length){let t=e.sourceCollection[0];this._type=wijmo_1.getType(this._binding.getValue(t))}}this.onPropertyChanged()}}get sortMemberPath(){return this._bindingSort?this._bindingSort.path:null}set sortMemberPath(e){if(e!=this.sortMemberPath){let t=wijmo_1.asString(e);this._bindingSort=t?new wijmo_1.Binding(t):null;this.onPropertyChanged()}}get dataType(){return this._type}set dataType(e){e=wijmo_1.asEnum(e,wijmo_1.DataType,!0);if(this._type!=e){this._type=e;this.grid&&this.grid.invalidate()}}get inputType(){return this._inpType}set inputType(e){this._inpType=wijmo_1.asString(e,!0)}get mask(){return this._mask}set mask(e){this._mask=wijmo_1.asString(e,!0)}get maxLength(){return this._maxLen}set maxLength(e){this._maxLen=wijmo_1.asNumber(e,!0,!0)}get align(){return this._align}set align(e){if(this._align!=e){this._align=e;this.onPropertyChanged()}}get format(){return this._fmt}set format(e){if(this._fmt!=e){this._fmt=e;this.onPropertyChanged()}}get dataMap(){return this._map}set dataMap(e){if(this._map!=e){this._map&&this._map.mapChanged.removeHandler(this.onPropertyChanged,this);wijmo_1.isArray(e)&&(e=new DataMap(e,null,null));this._map=wijmo_1.asType(e,DataMap,!0);this._map&&this._map.mapChanged.addHandler(this.onPropertyChanged,this);this.onPropertyChanged()}}get dataMapEditor(){return null!=this._mapEditor?this._mapEditor:DataMapEditor.DropDownList}set dataMapEditor(e){if(e!=this._mapEditor){this._mapEditor=wijmo_1.asEnum(e,DataMapEditor);this.grid&&this.grid.invalidate()}}get showDropDown(){return this.dataMapEditor==DataMapEditor.DropDownList}set showDropDown(e){wijmo_1._deprecated("showDropDown","dataMapEditor");this.dataMapEditor=e?DataMapEditor.DropDownList:DataMapEditor.AutoComplete}get dropDownCssClass(){return this._ddCssClass}set dropDownCssClass(e){this._ddCssClass=wijmo_1.asString(e)}get visible(){return this._getFlag(RowColFlags.Visible)}set visible(e){this._setFlag(RowColFlags.Visible,e)}get isVisible(){return!!this._getFlag(RowColFlags.Visible)&&(!this._getFlag(RowColFlags.ParentCollapsed)||this instanceof _NewRowTemplate)}get pos(){this._list&&this._list._dirty&&this._list._update();return this._pos}get index(){this._list&&this._list._dirty&&this._list._update();return this._idx}get visibleIndex(){this._list&&this._list._dirty&&this._list._update();return this.isVisible?this._idxVis:-1}get size(){return this._sz}set size(e){if(e!=this._sz){this._sz=wijmo_1.asNumber(e,!0);this.onPropertyChanged()}}get renderSize(){let e=0,t=this._list;if(this.isVisible){(null==(e=this._sz)||e<0)&&(e=t?t.defaultSize:0);t&&null!=t.minSize&&e<t.minSize&&(e=t.minSize);t&&null!=t.maxSize&&e>t.maxSize&&(e=t.maxSize);null!=this._szMin&&e<this._szMin&&(e=this._szMin);null!=this._szMax&&e>this._szMax&&(e=this._szMax)}return e}get allowResizing(){return this._getFlag(RowColFlags.AllowResizing)}set allowResizing(e){this._setFlag(RowColFlags.AllowResizing,e)}get allowDragging(){return this._getFlag(RowColFlags.AllowDragging)}set allowDragging(e){this._setFlag(RowColFlags.AllowDragging,e)}get allowMerging(){return this._getFlag(RowColFlags.AllowMerging)}set allowMerging(e){this._setFlag(RowColFlags.AllowMerging,e)}get isSelected(){return this._getFlag(RowColFlags.Selected)}set isSelected(e){if(!!e!=this.isSelected){let t=this.grid;if(t){let i=new CellRangeEventArgs(t?t.cells:null,t.selection);if(t.onSelectionChanging(i)&&this._setFlag(RowColFlags.Selected,e,!0)){t.refreshCells(!1,!0,!0);t.onSelectionChanged(i)}}else this._setFlag(RowColFlags.Selected,e)}}get isReadOnly(){return this._getFlag(RowColFlags.ReadOnly)}set isReadOnly(e){this._setFlag(RowColFlags.ReadOnly,e)}get isRequired(){return this._required}set isRequired(e){this._required=wijmo_1.asBoolean(e,!0)}get isContentHtml(){return this._getFlag(RowColFlags.HtmlContent)}set isContentHtml(e){if(this.isContentHtml!=e){this._setFlag(RowColFlags.HtmlContent,e);this.grid&&this.grid.invalidate()}}get wordWrap(){return this._getFlag(RowColFlags.WordWrap)}set wordWrap(e){this._setFlag(RowColFlags.WordWrap,e)}get multiLine(){return this._getFlag(RowColFlags.MultiLine)}set multiLine(e){this._setFlag(RowColFlags.MultiLine,e)}get cssClass(){return this._cssClass}set cssClass(e){if(e!=this._cssClass){this._cssClass=wijmo_1.asString(e);this.grid&&this.grid.invalidate()}}get cssClassAll(){return this._cssClassAll}set cssClassAll(e){if(e!=this._cssClassAll){this._cssClassAll=wijmo_1.asString(e);this.grid&&this.grid.invalidate()}}get grid(){return this._list?this._list._g:null}get collectionView(){return this.grid?this.grid.collectionView:null}onPropertyChanged(){if(this._list){this._list._dirty=!0;this.grid.invalidate()}}onGridChanged(e){this.gridChanged.raise(this,e)}_setList(e){if(e!=this._list){this._list=e;this.onGridChanged()}}_getFlag(e){return 0!=(this._f&e)}_setFlag(e,t,i){if(!!t!=this._getFlag(e)){this._f=t?this._f|e:this._f&~e;i||this.onPropertyChanged();return!0}return!1}}exports.RowCol=RowCol;class Column extends RowCol{constructor(e){super();this._hdr=null;this._name=null;this._agg=null;this._quickSize=null;this._descById=null;this._tpl=null;this._f=RowColFlags.ColumnDefault;this._hash=Column._ctr.toString(36);Column._ctr++;wijmo_1.copy(this,e);this._uid=wijmo_1.uidGenerator()}get name(){return this._name}set name(e){this._name=e}get width(){return null!=this._szStar?this._szStar:this.size}set width(e){if(null!=Column._parseStarSize(e)){this._szStar=e;this.onPropertyChanged()}else{this._szStar=null;this.size=wijmo_1.asNumber(e,!0)}}get minWidth(){return this._szMin}set minWidth(e){if(e!=this._szMin){this._szMin=wijmo_1.asNumber(e,!0,!0);this.onPropertyChanged()}}get maxWidth(){return this._szMax}set maxWidth(e){if(e!=this._szMax){this._szMax=wijmo_1.asNumber(e,!0,!0);this.onPropertyChanged()}}get quickAutoSize(){return this._quickSize}set quickAutoSize(e){this._quickSize=wijmo_1.asBoolean(e,!0)}_getQuickAutoSize(){return!!this.grid._getQuickAutoSize()&&(wijmo_1.isBoolean(this._quickSize)?this._quickSize:!(this.isContentHtml||this.wordWrap||this.multiLine||this._getFlag(RowColFlags.HasTemplate)))}get renderWidth(){return this.renderSize}get header(){return this._hdr?this._hdr:this.binding}set header(e){if(this._hdr!=e){this._hdr=e;this.onPropertyChanged()}}get cellTemplate(){return this._tpl}set cellTemplate(e){if(e!=this._tpl){wijmo_1.assert(null==e||wijmo_1.isString(e)||wijmo_1.isFunction(e),"cellTemplate should be a string or an ICellTemplateFunction.");this._tpl=e;this._setFlag(RowColFlags.HasTemplate,null!=e&&""!=e);this.onPropertyChanged()}}get editor(){let e=this._edt;return e?e.control:null}set editor(e){if(e!=this.editor){if(this._edt){this._edt.dispose();this._edt=null}if(null!=e){e=wijmo_1.asType(e,wijmo_1.Control);this._edt=new _CustomEditor(this,e)}}}get allowSorting(){return this._getFlag(RowColFlags.AllowSorting)}set allowSorting(e){this._setFlag(RowColFlags.AllowSorting,e)}get currentSort(){let e=this.currentSortIndex;if(e>-1){return this.grid.collectionView.sortDescriptions[e].ascending?"+":"-"}return null}get currentSortIndex(){let e=this.grid?this.grid.collectionView:null,t=e?e.sortDescriptions:null,i=t&&t.length?this._getBindingSort():null;if(i)for(let e=0;e<t.length;e++)if(t[e].property==i)return e;return-1}get aggregate(){return null!=this._agg?this._agg:wijmo_1.Aggregate.None}set aggregate(e){if((e=wijmo_1.asEnum(e,wijmo_1.Aggregate))!=this._agg){this._agg=e;this.onPropertyChanged()}}get describedById(){return this._descById}set describedById(e){if(e!=this._descById){this._descById=wijmo_1.asString(e);this.grid&&this.grid.invalidate()}}getIsRequired(e){return null!=this._required?this._required:e&&null!=e.isRequired?e.isRequired:this.dataType==wijmo_1.DataType.String?null!=this.dataMap||null!=this._mask&&this._mask.length>0:!e||e.dataType!=wijmo_1.DataType.String||(null!=e.dataMap||null!=e.mask&&e.mask.length>0)}getAlignment(e){if(null!=this._align)return this._align;if(e&&null!=e.align)return e.align;if(!this._map)switch(this.dataType){case wijmo_1.DataType.Boolean:return"center";case wijmo_1.DataType.Number:return"right"}if(e&&!e.dataMap)switch(e.dataType){case wijmo_1.DataType.Boolean:return"center";case wijmo_1.DataType.Number:return"right"}return""}_getBindingSort(){return this.sortMemberPath?this.sortMemberPath:this.binding?this.binding:null}static _parseStarSize(e){if(wijmo_1.isString(e)){let t=e.length;if(t>0&&"*"==e[t-1]){let i=1==t?1:parseFloat(e);if(i>0&&!isNaN(i))return i}}return null}}Column._ctr=0;exports.Column=Column;class Row extends RowCol{constructor(e){super();this.resizedManually=!1;this._f=RowColFlags.ColumnDefault;this._data=e||null}get dataItem(){return this._data}set dataItem(e){this._data=e}get dataIndex(){this._list&&this._list._dirty&&this._list._update();return this._idxData}get height(){return this.size}set height(e){this.size=e}get renderHeight(){return this.renderSize}}exports.Row=Row;class GroupRow extends Row{constructor(e){super(e);this._level=-1;this.level=e instanceof wijmo_1.CollectionViewGroup?e.level:-1;this.isReadOnly=!0}get level(){return this._level}set level(e){wijmo_1.asInt(e);if(e!=this._level){this._level=e;this.onPropertyChanged()}}get hasChildren(){if(null!=this.grid&&null!=this._list){this._list._update();let e=this.index<this._list.length-1?this._list[this.index+1]:null,t=wijmo_1.tryCast(e,GroupRow),i=wijmo_1.tryCast(e,_NewRowTemplate);return null!=e&&null==i&&(null==t||t.level>this.level)}return!0}get isCollapsed(){return this._getFlag(RowColFlags.Collapsed)}set isCollapsed(e){!!e!=this.isCollapsed&&null!=this._list&&this._setCollapsed(wijmo_1.asBoolean(e))}getGroupHeader(){let e=this.grid,t=e.groupHeaderFormat||wijmo_1.culture.FlexGrid.groupHeaderFormat,i=this.dataItem;if(i instanceof wijmo_1.CollectionViewGroup&&t&&e.showGroups&&!e.childItemsPath){let l=i.groupDescription.propertyName,s=i.name,o=e.getColumn(l),n=this.isContentHtml;if(o){n=n||o.isContentHtml;o.header&&(l=o.header);let e=o.dataMap;e&&(s=e.getDisplayValue(s));o.dataType==wijmo_1.getType(s)&&(s=wijmo_1.Globalize.format(s,o.format))}else l=wijmo_1.toHeaderCase(l);let r=i.getAggregate(wijmo_1.Aggregate.CntAll,null,e.collectionView);return wijmo_1.format(t,{name:wijmo_1.escapeHtml(l),value:n?s:wijmo_1.escapeHtml(s),level:i.level,count:r})}return""}_setCollapsed(e){let t=this.grid,i=t.rows,l=this.getCellRange(),s=new CellRangeEventArgs(t.cells,new CellRange(this.index,-1));if(t.onGroupCollapsedChanging(s)){t.deferUpdate(()=>{i.deferUpdate(()=>{this._setFlag(RowColFlags.Collapsed,e,!0);for(let t=l.topRow+1;t<=l.bottomRow&&t>-1&&t<i.length;t++){i[t]._setFlag(RowColFlags.ParentCollapsed,e,!0);let l=i[t];l instanceof GroupRow&&l.isCollapsed&&(t=l.getCellRange().bottomRow)}})});t.onGroupCollapsedChanged(s)}}getCellRange(){let e=this._list,t=this.index,i=e.length-1;for(let l=t+1;l<=i;l++){let t=e[l];if(t instanceof GroupRow&&t.level<=this.level){i=l-1;break}}return new CellRange(t,0,i,this.grid.columns.length-1)}}exports.GroupRow=GroupRow;class RowColCollection extends wijmo_1.ObservableArray{constructor(e,t){super();this.frozenDetailChildren=0;this._frozen=0;this._lastFrozen=-1;this._firstVisible=-1;this._vlen=0;this._szDef=28;this._szTot=0;this._szCustom=!1;this._dirty=!1;this._g=wijmo_1.asType(e,FlexGrid);this._szDef=wijmo_1.asNumber(t,!1,!0);this._uid=wijmo_1.uidGenerator()}get grid(){return this._g}get defaultSize(){return this._szDef}set defaultSize(e){this._szCustom=!0;if(this._szDef!=e){this._szDef=wijmo_1.asNumber(e,!1,!0);this._dirty=!0;this._g.invalidate()}}get frozen(){return this._frozen}set frozen(e){if(e!=this._frozen){this._frozen=wijmo_1.asNumber(e,!1,!0);this._dirty=!0;this._g.invalidate()}}isFrozen(e){return e<this.frozen}get minSize(){return this._szMin}set minSize(e){if(e!=this._szMin){this._szMin=wijmo_1.asNumber(e,!0,!0);this._dirty=!0;this._g.invalidate()}}get maxSize(){return this._szMax}set maxSize(e){if(e!=this._szMax){this._szMax=wijmo_1.asNumber(e,!0,!0);this._dirty=!0;this._g.invalidate()}}getTotalSize(){this._dirty&&this._update();return this._szTot}get visibleLength(){this._dirty&&this._update();return this._vlen}getItemAt(e){this._dirty&&this._update();if(e<=0&&this.length>0&&this[0].renderSize)return 0;let t,i,l=this.length,s=0,o=l-1;for(;s<=o;)if((i=this[t=s+o>>>1])._pos>=e&&t>0)o=t-1;else{if(!(i._pos+i.renderSize<=e&&t<l-1)){for(;t>0&&!this[t].renderSize;)t--;for(;t<l-1&&!this[t].renderSize;)t++;return t}s=t+1}return o}getNextCell(e,t,i=0){let l,s=SelMove;switch(t){case s.Next:case s.NextCell:for(l=e+1;l<this.length;l++)if(this[l].renderSize>0)return l;break;case s.NextEditableCell:for(l=e+1;l<this.length;l++)if(this[l].renderSize>0&&!this[l].isReadOnly)return l;break;case s.Prev:case s.PrevCell:for(l=e-1;l>=0;l--)if(this[l].renderSize>0)return l;break;case s.PrevEditableCell:for(l=e-1;l>=0;l--)if(this[l].renderSize>0&&!this[l].isReadOnly)return l;break;case s.End:for(l=this.length-1;l>=0;l--)if(this[l].renderSize>0)return l;break;case s.Home:for(l=0;l<this.length;l++)if(this[l].renderSize>0)return l;break;case s.NextPage:return(l=this.getItemAt(this[e].pos+this[e].renderSize+i))<0?this.getNextCell(e,SelMove.End,i):l==e&&l<this.length-1&&this[l+1].renderSize?l+1:l;case s.PrevPage:return(l=this.getItemAt(this[e].pos-i))<0?this.getNextCell(e,SelMove.Home,i):l==e&&l>0&&this[l-1].renderSize?l-1:l}return e}canMoveElement(e,t,i=!0){if(t==e)return!1;if(e<0||e>=this.length||t>=this.length)return!1;if(i){t<0&&(t=this.length-1);let i=Math.min(e,t),l=Math.max(e,t);for(let e=i;e<=l;e++)if(!this[e].allowDragging)return!1}return!(this[t]instanceof _NewRowTemplate)}moveElement(e,t,i=!0){if(this.canMoveElement(e,t,i)){let l=this[e];this.removeAt(e);t<0&&(t=this.length);this.insert(t,l);if(i){let i=this.frozen;e<i&&t>=i?this.frozen--:e>=i&&t<i&&this.frozen++}return!0}return!1}onCollectionChanged(e=wijmo_1.NotifyCollectionChangedEventArgs.reset){this._dirty=!0;this._g.invalidate();super.onCollectionChanged(e)}push(e){e._setList(this);return super.push(e)}splice(e,t,...i){for(let i=e;i<e+t&&i<this.length;i++){let e=this[i];e instanceof RowCol&&e._setList(null)}i.forEach(e=>e._setList(this));return super.splice(e,t,...i)}beginUpdate(){this._update();super.beginUpdate()}_setDefaultSize(e){if(!this._szCustom){this.defaultSize=e;this._szCustom=!1}}_update(){if(this._dirty&&!this.isUpdating){this._dirty=!1;this._lastFrozen=-1;this._firstVisible=-1;let e,t,i=0,l=0;for(let s=0;s<this.length;s++){(t=this[s])._idx=s;t._idxVis=i;t._pos=l;t._setList(this);if((e=t.renderSize)>0){l+=e;i++;s<this._frozen&&(this._lastFrozen=s)}this._firstVisible<0&&t.visible&&(this._firstVisible=s)}this._vlen=i;this._szTot=l;return!0}return!1}}exports.RowColCollection=RowColCollection;class ColumnCollection extends RowColCollection{getColumn(e){let t=wijmo_1.isNumber(e)?e:this.indexOf(e);return t>-1?this[t]:null}indexOf(e){if(e instanceof Column)return super.indexOf(e);for(let t=0;t<this.length;t++)if(this[t].name==e)return t;for(let t=0;t<this.length;t++)if(this[t].binding==e)return t;return-1}get describedById(){return this._descById}set describedById(e){if(e!=this._descById){this._descById=wijmo_1.asString(e);this._g&&this._g.invalidate()}}get firstVisibleIndex(){this._dirty&&this._update();return this._firstVisible}_updateStarSizes(e){let t,i=!1,l=0;e-=.5;for(let i=0;i<this.length;i++){let s=this[i];if(s.isVisible)if(s._szStar){l+=Column._parseStarSize(s._szStar);t=s}else e-=s.renderWidth}if(t){let s=e;for(let o=0;o<this.length;o++){let n=this[o];if(n.isVisible&&n._szStar){let o=n._sz;n==t&&s>0?o=s:s-=o=Math.max(0,Math.round(Column._parseStarSize(n._szStar)/l*e));if(o!=n._sz){n._sz=o;i=!0}}}if(i){this._dirty=!0;this._update()}return i}return!1}}exports.ColumnCollection=ColumnCollection;class RowCollection extends RowColCollection{constructor(){super(...arguments);this._maxLevel=-1}get ariaLabel(){return this._ariaLabel}set ariaLabel(e){if(e!=this.ariaLabel){this._ariaLabel=wijmo_1.asString(e);this._g&&this._g.refresh()}}get maxGroupLevel(){this._dirty&&this._update();return this._maxLevel}_update(){if(super._update()){let e=this.grid?this.grid.collectionView:null,t=e?e.items:null,i=0;this._maxLevel=-1;this.forEach(e=>{e instanceof GroupRow&&e.level>this._maxLevel&&(this._maxLevel=e.level);let l=e.dataItem;l&&t?l===t[i]?e._idxData=i:l===t[i+1]?e._idxData=++i:l!==t[e._idxData]&&(e._idxData=-1):e._idxData=-1});return!0}return!1}}exports.RowCollection=RowCollection;exports.colHdrAriaAttributes=(e,t,i,l,s=!1)=>{wijmo_1.setAttribute(e,"role",s?"rowheader":"columnheader");if(t.describedById||i.columns.describedById){let l=[t.describedById,i.columns.describedById].join(" ").trim();wijmo_1.setAttribute(e,"aria-describedby",l||null)}if(l.allowSorting){let s="none";switch(l._getBindingColumn(i,0,t).currentSort){case"+":s="ascending";break;case"-":s="descending"}wijmo_1.setAttribute(e,"aria-sort",s)}if(!l.isReadOnly){wijmo_1.setAttribute(e,"aria-readonly",t.isReadOnly);wijmo_1.setAttribute(e,"aria-required",t.isReadOnly?null:t.getIsRequired())}const o=e.closest(".wj-row");wijmo_1.setAttribute(o,"role","row")};class _ColumnGroupHandler{constructor(e){this._updatingCollection=0;this._initialized=!1;this._grid=e;this._initializeColumnGroups();this._initialized=!0}get columnGroups(){return this._colGroups}createColumnGroups(e){this._initialized=!1;this._createColumnGroups(e);this._initialized=!0}hasColumnGroups(){return null!=this._colGroups&&this._colGroups.length>0}getGroupDefinitions(){return this._groupDefs}getColumnGroup(e,t){return this._getColumnGroup(e,t)}canMoveColumnGroup(e,t,i,l){if(e==i&&t==l)return!1;let s=this._grid,o=s.columnHeaders.rows,n=s.columns;if(e<0||e>=o.length||t<0||t>=n.length||i<0||i>=o.length||l<0||l>=n.length)return!1;let r=this._getColumnGroup(e,t),a=this._getColumnGroup(i,l);if(!r||!a||r==a)return!1;if(r.level<a.level&&r._containsGroup(a))return!1;let h=r.parentGroup,d=a.parentGroup;return!h||h===d||!h._isCollapseTo(r)}moveColumnGroup(e,t,i,l,s){if(this.canMoveColumnGroup(e,t,i,l)){let o=this._getColumnGroup(e,t),n=this._getColumnGroup(i,l);if(!o||!n||o==n)return!1;if(s&&!n.isEmpty)return!1;let r=this._getCollection(o),a=s?n.columns:this._getCollection(n);if(!r||!a)return!1;let h=s?0:a.indexOf(n);if(h<0)return!1;!s&&r!=a&&l>t&&h++;this._deferCollectionUpdate(()=>{if(!r.remove(o))return!1;a.insert(h,o)});return!0}return!1}handleCollectionChange(){if(this._initialized&&!this._updatingCollection){this._initialized=!1;this._buildColumnGroups();this._initialized=!0}}handlePropertyChange(e){if(e&&this._initialized){let t=this._grid,i=e._rng,l=e.header;if(l!=e._curr_header)for(let s=i.topRow;s<=i.bottomRow;s++)for(let o=i.leftCol;o<=i.rightCol;o++){t.columnHeaders.setCellData(s,o,l);e._curr_header=l}e.columns.length>0&&t.invalidate()}}_initializeColumnGroups(){let e=this._grid;const t=new ColumnGroupCollection;this._groupDefs=t;this._colGroups=t;this._colGroups._setOwner(e);this._colGroups._setChangeHandler(this)}_createColumnGroups(e){this._grid;this._groupDefs=wijmo_1.asArray(e);this._colGroups&&this._colGroups._setOwner(null);this._colGroups=ColumnGroupCollection._parse(e);this._buildColumnGroups()}_buildColumnGroups(){let e=this._grid;this._colGroups._removeChangeHandler();this._assertColumnGroups(this._colGroups);e.autoGenerateColumns=!1;e.columns.clear();this._colGroups._setOwner(e);this._colGroups.forEach(e=>{e._beginBuild()});let t=0;this._colGroups.forEach(e=>{this._addColumnGroup(e);t=Math.max(t,e._getMaxLevel())});this._colGroups.forEach(e=>{e._expandRange(t)});let i=e.columnHeaders.rows;i.clear();for(let e=0;e<=t;e++){let l=new Row;i.splice(e,0,l);e<t&&(l.cssClassAll="wj-colgroup")}for(let t=0;t<i.length;t++)for(let i=0;i<e.columns.length;i++){let l=this._getColumnGroup(t,i);if(l){let s=l.header||wijmo_1.toHeaderCase(l.binding);e.columnHeaders.setCellData(t,i,s);if(l.height){let i=e.columnHeaders.rows[t].height;e.columnHeaders.rows[t].height=i<=l.height?l.height:i}l._curr_header=l.header}}this._colGroups._setChangeHandler(this);this._colGroups.forEach(e=>{e._checkIfCollapsed()})}_getColumnGroup(e,t){let i=this._grid;if(e<i.columnHeaders.rows.length&&t<i.columns.length)for(let i=this._colGroups;i;){let l=i;for(let l=0;l<i.length;l++){let s=i[l],o=s._rng;if(o.containsColumn(t)){if(o.containsRow(e)||0==s.columns.length)return s;i=s.columns;break}}if(i==l)break}return null}_getCollection(e){const t=e.parentGroup;return t?t.columns:this._colGroups}_assertColumnGroups(e){wijmo_1.assert(e instanceof ColumnGroupCollection,"column groups contain items of invalid collection type");e.forEach(e=>{wijmo_1.assert(e instanceof ColumnGroup,"column groups contain items of invalid type");this._assertColumnGroups(e.columns)})}_addColumnGroup(e){let t=this._grid;e._rng.col=t.columns.length;0==e.columns.length?t.columns.push(e):e.columns.forEach(e=>{this._addColumnGroup(e)});e._rng.col2=t.columns.length-1}_beginCollectionUpdate(){this._updatingCollection++}_endCollectionUpdate(){this._updatingCollection--;this._updatingCollection<=0&&this.handleCollectionChange()}_deferCollectionUpdate(e){try{this._beginCollectionUpdate();e()}finally{this._endCollectionUpdate()}}}exports._ColumnGroupHandler=_ColumnGroupHandler;class ColumnGroup extends Column{constructor(e,t){super();this._rng=new CellRange(0,-1);this._lvl=0;this._collapsed=!1;this._cols=new ColumnGroupCollection;wijmo_1.copy(this,e);const i=t&&t.columns;i&&i.indexOf(this)<0&&i.push(this)}_copy(e,t){if("columns"==e){const e=wijmo_1.asArray(t);this._cols=ColumnGroupCollection._parse(e);return!0}return!1}get columns(){return this._cols}get columnGroups(){return this._cols}get height(){return this._cgHeight}set height(e){this._cgHeight=e}get isEmpty(){return 0===this._cols.length}get parentGroup(){const e=this._ownerList,t=e&&e.owner;return t instanceof ColumnGroup?t:null}get level(){let e=this,t=0;for(;e.parentGroup;){e=e.parentGroup;t++}return t}get collapseTo(){return this._collTo}set collapseTo(e){wijmo_1.assert(wijmo_1.isArray(e)||wijmo_1.isString(e),"collapseTo should be an array or a string.");if(this._collTo!=e){this._collTo=e;this._updateCollapsedState()}}get isCollapsed(){return this._collapsed}set isCollapsed(e){let t=this.grid,i=null;if(e!=this._collapsed)if(t){i=new CellRangeEventArgs(t.columnHeaders,this._rng,this);t.onColumnGroupCollapsedChanging(i)?this._collapsed=wijmo_1.asBoolean(e):i=null}else this._collapsed=wijmo_1.asBoolean(e);this._updateCollapsedState();t&&i&&t.onColumnGroupCollapsedChanged(i)}get grid(){const e=this._ownerList,t=e&&e.owner;return t instanceof ColumnGroup?t.grid:t instanceof FlexGrid?t:null}_beginBuild(){this._lvl=0;for(let e=this.parentGroup;e;e=e.parentGroup)this._lvl++;setTimeout(()=>{if(this.parentGroup&&0!==this._lvl&&this.parentGroup.width&&(null===this.width||void 0===this.width)){let e=0,t=0;this.parentGroup._cols.forEach(i=>{e+=i.width;null!==i.width&&void 0!==i.width||t++});this.width=(this.parentGroup.width-e)/t}},0);this._rng=new CellRange(0,-1);this._rng.row=this._rng.row2=this._lvl;this._cols.forEach(e=>{e._beginBuild()})}_setChangeHandler(e){this._changeHdl=e;this._cols._setChangeHandler(e)}_removeChangeHandler(){this._changeHdl=null;this._cols._removeChangeHandler()}_setOwnerList(e){e!=this._ownerList&&(this._ownerList=e)}_checkIfCollapsed(){let e=this.grid;(e?e.columns:null)&&(this._collapsed?this._updateCollapsedState():this._cols.forEach(e=>{e._checkIfCollapsed()}))}_updateCollapsedState(){let e=this.grid,t=e?e.columns:null,i=this._rng,l=this._collapsed;if(!t)return;this._cols.forEach(e=>{if(e instanceof ColumnGroup){e._collapsed=l;e._updateCollapsedState()}});let s=this._getCollapseToIndices();for(let e=i.leftCol;e<=i.rightCol;e++){const i=!l||s.indexOf(e)>-1;t[e]._setFlag(RowColFlags.ParentCollapsed,!i)}}_getMaxLevel(){let e=this._lvl;this.columns.forEach(t=>{e=Math.max(e,t._getMaxLevel())});return e}_expandRange(e){let t=e-this._getMaxLevel();if(t>0){this._rng.row2+=t;this._cols.forEach(e=>{e._shiftRange(t)})}let i=this.grid.columns,l=this._rng;for(let t=l.col;t<=l.col2;t++){i[t]._rng.row2=e}}_shiftRange(e){this._rng.row+=e;this._rng.row2+=e;this._cols.forEach(t=>{t._shiftRange(e)})}_containsGroup(e){for(let t=0;t<this._cols.length;t++){let i=this._cols[t];if(i==e||i._containsGroup(e))return!0}return!1}_isCollapseTo(e){let t=this.grid,i=t?t.columns:null;if(!e||!i)return!1;let l=this._getCollapseToBindings();if(l&&l.length)for(let t=0;t<l.length;t++)switch(l[t]){case"$first":case"$last":continue;default:if(e===i.getColumn(l[t]))return!0}return!1}_getCollapseToBindings(){let e=this.collapseTo;return wijmo_1.isString(e)?[e]:e}_getCollapseToIndices(){let e=this.grid,t=this._rng,i=this._getCollapseToBindings();if(i&&i.length){let l=[],s=e.columns;for(let e=0;e<i.length;e++)switch(i[e]){case"$first":l.push(t.leftCol);break;case"$last":l.push(t.rightCol);break;default:let o=s.getColumn(i[e]),n=s.indexOf(o);o&&t.containsColumn(n)&&l.push(n)}if(l.length)return l}return[t.rightCol]}onPropertyChanged(){const e=this._changeHdl;e&&e.handlePropertyChange(this);super.onPropertyChanged()}}exports.ColumnGroup=ColumnGroup;class ColumnGroupCollection extends wijmo_1.ObservableArray{getColumn(e){return wijmo_1.isNumber(e)?this._getColByIdx(e):this._findColByProp("name",e)||this._findColByProp("binding",e)}get owner(){return this._owner}push(e){e._setOwnerList(this);return super.push(e)}splice(e,t,...i){for(let i=e;i<e+t&&i<this.length;i++){let e=this[i];e instanceof ColumnGroup&&e._setOwnerList(null)}i.forEach(e=>e._setOwnerList(this));return super.splice(e,t,...i)}static _parse(e){let t=null;if(e)if(e instanceof ColumnGroupCollection)t=e;else{t=new ColumnGroupCollection;e.forEach(e=>{let i=e instanceof ColumnGroup?e:new ColumnGroup(e);t.indexOf(i)<0&&t.push(i)})}else t=new ColumnGroupCollection;return t}_setChangeHandler(e){this._changeHdl=e;this.forEach(t=>t._setChangeHandler(e))}_removeChangeHandler(){this._changeHdl=null;this.forEach(e=>e._removeChangeHandler())}_setOwner(e){this._owner=e;this.forEach(e=>e.columns._setOwner(e))}_getColByIdx(e){return e>-1&&e<this.length?this[e]:null}_findColByProp(e,t){for(let i=0;i<this.length;i++){let l=this[i];if(l[e]===t)return l;if(null!==(l=l.columns._findColByProp(e,t)))return l}return null}onCollectionChanged(e=wijmo_1.NotifyCollectionChangedEventArgs.reset){const t=this._changeHdl;t&&t.handleCollectionChange();super.onCollectionChanged(e)}}exports.ColumnGroupCollection=ColumnGroupCollection;wijmo_1._addCultureInfo("FlexGrid",{groupHeaderFormat:"{name}: <b>{value}</b> ({count:n0} items)",ariaLabels:{toggleDropDown:"Toggle Dropdown",toggleGroup:"Toggle Group"}});!function(e){e[e.None=0]="None";e[e.SingleColumn=1]="SingleColumn";e[e.MultiColumn=2]="MultiColumn"}(AllowSorting=exports.AllowSorting||(exports.AllowSorting={}));!function(e){e[e.None=0]="None";e[e.SingleColumn=1]="SingleColumn";e[e.ColumnRange=2]="ColumnRange";e[e.Both=3]="Both"}(AllowPinning=exports.AllowPinning||(exports.AllowPinning={}));!function(e){e[e.None=0]="None";e[e.Column=1]="Column";e[e.Row=2]="Row";e[e.All=3]="All"}(HeadersVisibility=exports.HeadersVisibility||(exports.HeadersVisibility={}));!function(e){e[e.Default=0]="Default";e[e.CSV=1]="CSV";e[e.QuoteAll=2]="QuoteAll";e[e.SkipMerged=4]="SkipMerged";e[e.Unformatted=8]="Unformatted";e[e.InvisibleRows=16]="InvisibleRows";e[e.InvisibleColumns=32]="InvisibleColumns";e[e.InvisibleCells=48]="InvisibleCells"}(ClipStringOptions=exports.ClipStringOptions||(exports.ClipStringOptions={}));!function(e){e[e.None=0]="None";e[e.Column=1]="Column";e[e.Row=2]="Row";e[e.All=3]="All"}(HeadersFocusability=exports.HeadersFocusability||(exports.HeadersFocusability={}));!function(e){e[e.Column=0]="Column";e[e.Row=1]="Row"}(FrozenRowCol=exports.FrozenRowCol||(exports.FrozenRowCol={}));class FlexGrid extends wijmo_1.Control{constructor(e,t){super(e,null,!0);this._activeCell=null;this._activePanelType=CellType.Cell;this._szClient=new wijmo_1.Size(0,0);this._szClientSB=new wijmo_1.Size(0,0);this._offsetY=0;this._cssPage=0;this._ptScrl=new wijmo_1.Point(0,0);this._cellPadLeft=3;this._cellPadHorz=3;this._cellPadVert=0;this._clipToScreen=!1;this._anchorCell=null;this._autoGenCols=!0;this._autoClipboard=!0;this._xOnCopyPaste=!0;this._autoScroll=!0;this._autoSearch=!1;this._caseSensitive=!1;this._readOnly=!1;this._indent=14;this._autoSizeMode=AutoSizeMode.Both;this._autoHeights=!1;this._quickSize=null;this._hdrVis=HeadersVisibility.All;this._hdrFoc=HeadersFocusability.None;this._alSorting=AllowSorting.SingleColumn;this._alPinning=AllowPinning.None;this._alAddNew=!1;this._alDelete=!1;this._alResizing=AllowResizing.Columns;this._alDragging=AllowDragging.Columns;this._alMerging=AllowMerging.None;this._ssHdr=HeadersVisibility.None;this._shSort=!0;this._shGroups=!0;this._shMarquee=!1;this._shPlcHld=!1;this._altStep=1;this._shErr=!0;this._shDropDown=!0;this._valEdt=!0;this._gHdrFmt=null;this._childItemsPath=null;this._sortRowIndex=null;this._editColIndex=null;this._deferResizing=!1;this._pSel=!0;this._pOutline=!0;this._stickyHdr=!1;this._anchorCursor=!1;this._copyHeaders=HeadersVisibility.None;this._bigChecks=!1;this._skipMerged=!1;this._commitEmptyEdits=!0;this._fzClone=null;this._vt=0;this._vtRows=0;this._vtCols=0;this._lazyRender=!0;this._refreshOnEdit=!0;this._reorderCells=!0;this._isISChanging=!1;this._isScrollingByWheel=!1;this._touchEdit=!1;this.itemsSourceChanging=new wijmo_1.Event;this.itemsSourceChanged=new wijmo_1.Event;this.scrollPositionChanged=new wijmo_1.Event;this.selectionChanging=new wijmo_1.Event;this.selectionChanged=new wijmo_1.Event;this.loadingRows=new wijmo_1.Event;this.loadedRows=new wijmo_1.Event;this.updatingLayout=new wijmo_1.Event;this.updatedLayout=new wijmo_1.Event;this.resizingColumn=new wijmo_1.Event;this.resizedColumn=new wijmo_1.Event;this.autoSizingColumn=new wijmo_1.Event;this.autoSizedColumn=new wijmo_1.Event;this.starSizedColumns=new wijmo_1.Event;this.draggingColumn=new wijmo_1.Event;this.draggingColumnOver=new wijmo_1.Event;this.draggedColumn=new wijmo_1.Event;this.pinningColumn=new wijmo_1.Event;this.pinnedColumn=new wijmo_1.Event;this.resizingRow=new wijmo_1.Event;this.resizedRow=new wijmo_1.Event;this.autoSizingRow=new wijmo_1.Event;this.autoSizedRow=new wijmo_1.Event;this.draggingRow=new wijmo_1.Event;this.draggingRowOver=new wijmo_1.Event;this.draggedRow=new wijmo_1.Event;this.groupCollapsedChanging=new wijmo_1.Event;this.groupCollapsedChanged=new wijmo_1.Event;this.columnGroupCollapsedChanging=new wijmo_1.Event;this.columnGroupCollapsedChanged=new wijmo_1.Event;this.sortingColumn=new wijmo_1.Event;this.sortedColumn=new wijmo_1.Event;this.beginningEdit=new wijmo_1.Event;this.prepareCellForEdit=new wijmo_1.Event;this.cellEditEnding=new wijmo_1.Event;this.cellEditEnded=new wijmo_1.Event;this.rowEditStarting=new wijmo_1.Event;this.rowEditStarted=new wijmo_1.Event;this.rowEditEnding=new wijmo_1.Event;this.rowEditEnded=new wijmo_1.Event;this.rowAdded=new wijmo_1.Event;this.deletingRow=new wijmo_1.Event;this.deletedRow=new wijmo_1.Event;this.copying=new wijmo_1.Event;this.copied=new wijmo_1.Event;this.pasting=new wijmo_1.Event;this.pasted=new wijmo_1.Event;this.pastingCell=new wijmo_1.Event;this.pastedCell=new wijmo_1.Event;this.formatItem=new wijmo_1.Event(()=>{this._clearCells()});this.updatingView=new wijmo_1.Event;this.updatedView=new wijmo_1.Event;this._mappedColumns=null;let i=this.hostElement;wijmo_1.isIE()&&(i.style.borderRadius="0");let l=this.getTemplate();this.applyTemplate("wj-control wj-content wj-flexgrid",l,{_root:"root",_eSz:"sz",_eCt:"cells",_fCt:"fcells",_eTL:"tl",_eBL:"bl",_eCHdr:"ch",_eRHdr:"rh",_eCFtr:"cf",_eTLCt:"tlcells",_eBLCt:"blcells",_eCHdrCt:"chcells",_eCFtrCt:"cfcells",_eRHdrCt:"rhcells",_eMarquee:"marquee",_eFocus:"focus"});wijmo_1.setCss(this._root.parentElement,{position:"relative",left:"0",top:"0",width:"100%",height:"100%",overflow:"hidden",minWidth:"inherit",minHeight:"inherit",maxWidth:"inherit",maxHeight:"inherit"});wijmo_1.setCss(this._root,{position:"absolute",left:"0",top:"0",width:"100%",height:"100%",minWidth:"inherit",minHeight:"inherit",maxWidth:"inherit",maxHeight:"inherit",overflow:"auto",webkitOverflowScrolling:"touch"});wijmo_1.setCss(this._eCt,{position:"absolute"});wijmo_1.setCss(this._eMarquee,{display:"none"});wijmo_1.setCss(this._eMarquee.firstChild,{width:"100%",height:"100%"});wijmo_1.setCss(this._fCt,{position:"absolute",top:0,left:0,overflow:"hidden",pointerEvents:"none"});wijmo_1.setCss(this._eFocus,{position:"fixed",left:"-32000px"});wijmo_1.setCss(this._eSz,{position:"relative",visibility:"hidden"});[this._eRHdr,this._eCFtr,this._eCHdr,this._eBL,this._eTL].forEach(e=>{wijmo_1.setAttribute(e,"aria-hidden",!0);wijmo_1.setCss(e,{position:"absolute",overflow:"hidden",outline:"none"});wijmo_1.setCss(e.firstElementChild,{position:"relative"})});[this._eFocus,this._eMarquee,this._fCt,this._eSz].forEach(e=>{wijmo_1.setAttribute(e,"aria-hidden",!0)});if(wijmo_1.isIE9()||wijmo_1.isIE10()){let e=this._eMarquee;["click","dblclick","mousedown","mouseup"].forEach(t=>{this.addEventListener(e,t,i=>{let l=e.style.display;e.style.display="none";let s=document.elementFromPoint(i.clientX,i.clientY);e.style.display=l;let o=document.createEvent("Event");o.initEvent(t,!0,!0);for(let e in i)try{o[e]=i[e]}catch(e){}s.dispatchEvent(o)})})}i.tabIndex=-1;this._uid=wijmo_1.uidGenerator();this.deferUpdate(()=>{let e=this._getDefaultRowHeight();this._rows=new RowCollection(this,e);this._cols=new ColumnCollection(this,4*e);this._hdrRows=new RowCollection(this,e);this._hdrCols=new ColumnCollection(this,Math.round(1.25*e));this._ftrRows=new RowCollection(this,e);let i=CellType;this._gpTL=new GridPanel(this,i.TopLeft,this._hdrRows,this._hdrCols,this._eTLCt);this._gpCHdr=new GridPanel(this,i.ColumnHeader,this._hdrRows,this._cols,this._eCHdrCt);this._gpRHdr=new GridPanel(this,i.RowHeader,this._rows,this._hdrCols,this._eRHdrCt);this._gpCells=new GridPanel(this,i.Cell,this._rows,this._cols,this._eCt);this._gpBL=new GridPanel(this,i.BottomLeft,this._ftrRows,this._hdrCols,this._eBLCt);this._gpCFtr=new GridPanel(this,i.ColumnFooter,this._ftrRows,this._cols,this._eCFtrCt);this.activePanel=this._gpCells;this._hdrRows.push(new Row);this._hdrCols.push(new Column({align:"center"}));this._cf=new CellFactory;this._keyHdl=new _KeyboardHandler(this);this._mouseHdl=new _MouseHandler(this);this._edtHdl=new _EditHandler(this);this._selHdl=this._createSelHdl();this._addHdl=new _AddNewHandler(this);this._grpHdl=new _ColumnGroupHandler(this);this._mrgMgr=new MergeManager;this._bndSortConverter=this._sortConverter.bind(this);this._errorTip=new wijmo_1.Tooltip({isContentHtml:!1,showDelay:0,cssClass:"wj-error-tip"});this.selectionMode=SelectionMode.CellRange;this._root.tabIndex=-1;this.initialize(t)});this.addEventListener(this._root,"scroll",e=>{if(this._updateScrollPosition()||this._forceScrollUpdate){let e=this.activeEditor,t=this.activeCell,i=t?t.className:null;if((wijmo_1.hasClass(t,"wj-detail")||wijmo_1.hasClass(e,"wj-numeric"))&&wijmo_1.Control.sharedState.InvalidScroll){setTimeout(()=>{wijmo_1.Control.sharedState.InvalidScroll=!1},0);return}this._forceScrollUpdate||wijmo_1.Control.sharedState.InvalidScroll||this.finishEditing();this._forceScrollUpdate=!1;if("React"===this.workingAs)requestAnimationFrame(()=>{this._updateContent(!0);setTimeout(()=>{wijmo_1.Control.sharedState.InvalidScroll=!1},0)});else{this._updateContent(!0);setTimeout(()=>{wijmo_1.Control.sharedState.InvalidScroll=!1},0)}let l=this.activeEditor,s=this.activeCell;if(l&&s&&e&&i){l.value=e.value;s.className=i;this._setFocusNoScroll(l)}else l&&!s&&(wijmo_1.Control.sharedState.InvalidScroll||this.finishEditing(!0));this.columns.frozen&&setTimeout(()=>{let e=this.columnHeaders.hostElement.style,t=parseInt(e.left),i=this._ptScrl.x;Math.abs(t-i)>1&&this.invalidate()});setTimeout(()=>{this._isScrollingByWheel=!1;wijmo_1.Control.sharedState.InvalidScroll=!1},0)}});this.addEventListener(i,"focus",e=>{if(i.tabIndex>-1){let t=e.target;t instanceof HTMLElement&&t.tabIndex<0&&this._setFocus(!0)}},!0)}set activePanel(e){this._activePanel=e}get activePanel(){return this._activePanel}set activePanelType(e){if(this._activePanelType!==e){Array.from(this.hostElement.getElementsByClassName("wj-focus-header-cell")).forEach(e=>{e.classList.remove("wj-focus-header-cell");e.setAttribute("tabindex","-1")});this._activePanelType=e;e!==CellType.Cell?e!==CellType.ColumnHeader?e!==CellType.RowHeader?e!==CellType.TopLeft||(this.activePanel=this._gpTL):this.activePanel=this._gpRHdr:this.activePanel=this._gpCHdr:this.activePanel=this._gpCells}}get activePanelType(){return this._activePanelType}_handleResize(){this._rcBounds=null;this.activeEditor&&this.isTouching||this._touchEdit?setTimeout(()=>{if(!this.activeEditor){this._touchEdit=!0;this.startEditing(!0)}},50):super._handleResize();this._touchEdit=!1}get headersVisibility(){return this._hdrVis}set headersVisibility(e){if((e=wijmo_1.asEnum(e,HeadersVisibility))!=this._hdrVis){this._hdrVis=e;this.invalidate()}}get headersFocusability(){return this._hdrFoc}set headersFocusability(e){if((e=wijmo_1.asEnum(e,HeadersFocusability))!=this._hdrFoc){this._hdrFoc=e;this.invalidate()}}get stickyHeaders(){return this._stickyHdr}set stickyHeaders(e){if(e!=this._stickyHdr){this._stickyHdr=wijmo_1.asBoolean(e);this._updateStickyHeaders();this.invalidate()}}get preserveSelectedState(){return this._pSel}set preserveSelectedState(e){this._pSel=wijmo_1.asBoolean(e)}get preserveOutlineState(){return this._pOutline}set preserveOutlineState(e){this._pOutline=wijmo_1.asBoolean(e)}get anchorCursor(){return this._anchorCursor}set anchorCursor(e){this._anchorCursor=wijmo_1.asBoolean(e)}get copyHeaders(){return this._copyHeaders}set copyHeaders(e){this._copyHeaders=wijmo_1.asEnum(e,HeadersVisibility)}get lazyRender(){return this._lazyRender}set lazyRender(e){this._lazyRender=wijmo_1.asBoolean(e)}get refreshOnEdit(){return this._refreshOnEdit}set refreshOnEdit(e){this._refreshOnEdit=wijmo_1.asBoolean(e)}get virtualizationThreshold(){return this._vt}set virtualizationThreshold(e){this._vt=e;if(wijmo_1.isNumber(e))this._vtRows=this._vtCols=wijmo_1.asNumber(e);else if(e)if(wijmo_1.isArray(e)&&2==e.length){this._vtRows=wijmo_1.asNumber(e[0]);this._vtCols=wijmo_1.asNumber(e[1])}else wijmo_1.assert(!1,"virtualizationThreshold should be a number or an array with two numbers.");else this._vtRows=this._vtCols=0}get autoGenerateColumns(){return this._autoGenCols}set autoGenerateColumns(e){this._autoGenCols=wijmo_1.asBoolean(e)}get autoClipboard(){return this._autoClipboard}set autoClipboard(e){this._autoClipboard=wijmo_1.asBoolean(e)}get expandSelectionOnCopyPaste(){return this._xOnCopyPaste}set expandSelectionOnCopyPaste(e){this._xOnCopyPaste=wijmo_1.asBoolean(e)}get autoScroll(){return this._autoScroll}set autoScroll(e){this._autoScroll=wijmo_1.asBoolean(e)}get autoSearch(){return this._autoSearch}set autoSearch(e){this._autoSearch=wijmo_1.asBoolean(e)}get caseSensitiveSearch(){return this._caseSensitive}set caseSensitiveSearch(e){this._caseSensitive=wijmo_1.asBoolean(e)}get columnLayout(){let e=this._hasColumnGroups(),t=e?ColumnGroup:Column,i=e?"columnGroups":"columns",l=FlexGrid._getSerializableProperties(t),s=e?["collapseTo"]:[],o=["size"],n=new t,r=e?this.getColumnGroups():this.columns;const serializeColumns=t=>{let i=[];t.forEach(t=>{let r={};l.forEach(e=>{let i=t[e];((e,t)=>t!=n[e]&&o.indexOf(e)<0&&(wijmo_1.isPrimitive(t)||s.indexOf(e)>-1))(e,i)&&(r[e]=i)});if(e){let e=t.columns;e.length&&(r.columns=serializeColumns(e))}i.push(r)});return i};let a=serializeColumns(r);return JSON.stringify({[i]:a})}set columnLayout(e){let t=JSON.parse(wijmo_1.asString(e));wijmo_1.assert(t,"Invalid columnLayout data.");this.columns.deferUpdate(()=>{this.columns.clear();this._hasColumnGroups()&&(this.columnGroups=new ColumnGroupCollection);this.initialize(t)})}get columnGroups(){return this._grpHdl.getGroupDefinitions()}set columnGroups(e){this.columns.clear();this._grpHdl.createColumnGroups(wijmo_1.asArray(e))}getColumnGroups(){return this._grpHdl.columnGroups}get isReadOnly(){return this._readOnly}set isReadOnly(e){if(e!=this._readOnly){this._readOnly=wijmo_1.asBoolean(e);this.finishEditing();this.invalidate(!0);this._addHdl.updateNewRowTemplate();wijmo_1.toggleClass(this.hostElement,"wj-state-readonly",this.isReadOnly);this._setAria("readonly",this.isReadOnly?"true":null)}}get bigCheckboxes(){return this._bigChecks}set bigCheckboxes(e){this._bigChecks=wijmo_1.asBoolean(e)}get skipMerged(){return this._skipMerged}set skipMerged(e){this._skipMerged=wijmo_1.asBoolean(e)}get isDisabled(){return this._e&&null!=this._e.getAttribute("disabled")}set isDisabled(e){if((e=wijmo_1.asBoolean(e,!0))!=this.isDisabled){let t=this._e;if(t){wijmo_1.enable(t,!e);this._updateTabIndex();this.invalidate()}}}get imeEnabled(){return null!=this._imeHdl}set imeEnabled(e){if(wijmo_1.asBoolean(e)!=this.imeEnabled&&this.finishEditing()){let t=this.containsFocus();if(this._imeHdl){this._imeHdl.dispose();this._imeHdl=null}e&&(this._imeHdl=new _ImeHandler(this));t&&this.focus()}}get allowResizing(){return this._alResizing}set allowResizing(e){this._alResizing=wijmo_1.asEnum(e,AllowResizing)}get deferResizing(){return this._deferResizing}set deferResizing(e){this._deferResizing=wijmo_1.asBoolean(e)}get autoSizeMode(){return this._autoSizeMode}set autoSizeMode(e){this._autoSizeMode=wijmo_1.asEnum(e,AutoSizeMode)}get autoRowHeights(){return this._autoHeights}set autoRowHeights(e){this._autoHeights=wijmo_1.asBoolean(e);this._autoRowHeights()}get quickAutoSize(){return this._quickSize}set quickAutoSize(e){this._quickSize=wijmo_1.asBoolean(e,!0)}_getQuickAutoSize(){return wijmo_1.isBoolean(this._quickSize)?this._quickSize:!this.formatItem.hasHandlers&&null==this.itemFormatter}get allowSorting(){return this._alSorting}set allowSorting(e){wijmo_1.isBoolean(e)&&(e=e?AllowSorting.SingleColumn:AllowSorting.None);this._alSorting=wijmo_1.asEnum(e,AllowSorting)}get allowPinning(){return this._alPinning}set allowPinning(e){if(e!=this._alPinning){wijmo_1.isBoolean(e)&&(e=e?AllowPinning.SingleColumn:AllowPinning.None);this._alPinning=wijmo_1.asEnum(e,AllowPinning);this.invalidate()}}get allowAddNew(){return this._alAddNew}set allowAddNew(e){if(e!=this._alAddNew){this._alAddNew=wijmo_1.asBoolean(e);this._addHdl.updateNewRowTemplate()}}get newRowAtTop(){return this._addHdl.newRowAtTop}set newRowAtTop(e){this._addHdl.newRowAtTop=wijmo_1.asBoolean(e)}get allowDelete(){return this._alDelete}set allowDelete(e){e!=this._alDelete&&(this._alDelete=wijmo_1.asBoolean(e))}get allowMerging(){return this._alMerging}set allowMerging(e){if((e=wijmo_1.asEnum(e,AllowMerging))!=this._alMerging){this._alMerging=e;this.invalidate()}}get showSelectedHeaders(){return this._ssHdr}set showSelectedHeaders(e){if((e=wijmo_1.asEnum(e,HeadersVisibility))!=this._ssHdr){this._ssHdr=e;this.invalidate()}}get showMarquee(){return this._shMarquee}set showMarquee(e){if(e!=this._shMarquee){this._shMarquee=wijmo_1.asBoolean(e);this.invalidate()}}get showPlaceholders(){return this._shPlcHld}set showPlaceholders(e){this._shPlcHld=wijmo_1.asBoolean(e)}get showSort(){return this._shSort}set showSort(e){if(e!=this._shSort){this._shSort=wijmo_1.asBoolean(e);this.invalidate()}}get showGroups(){return this._shGroups}set showGroups(e){if(e!=this._shGroups){this._shGroups=wijmo_1.asBoolean(e);this._bindGrid(!1)}}get alternatingRowStep(){return this._altStep}set alternatingRowStep(e){if(e!=this._altStep){this._altStep=wijmo_1.asInt(e,!1,!0);this.invalidate()}}get showAlternatingRows(){return this._altStep>0}set showAlternatingRows(e){wijmo_1._deprecated("showAlternatingRows","alternatingRowStep");this.alternatingRowStep=e?1:0}get showErrors(){return this._shErr}set showErrors(e){if(e!=this._shErr){this._clearCells();this._shErr=wijmo_1.asBoolean(e)}}get errorTip(){return this._errorTip}set errorTip(e){if(e!=this._errorTip){this._clearCells();this._errorTip=wijmo_1.asType(e,wijmo_1.Tooltip,!0)}}get itemValidator(){return this._itemValidator}set itemValidator(e){if(e!=this.itemValidator){this._itemValidator=wijmo_1.asFunction(e);this.invalidate()}}get validateEdits(){return this._valEdt}set validateEdits(e){this._setvalidateEdits(e)}_setvalidateEdits(e){this._valEdt=wijmo_1.asBoolean(e)}get groupHeaderFormat(){return this._gHdrFmt}set groupHeaderFormat(e){if(e!=this._gHdrFmt){this._gHdrFmt=wijmo_1.asString(e);this._bindGrid(!1)}}get allowDragging(){return this._alDragging}set allowDragging(e){if((e=wijmo_1.asEnum(e,AllowDragging))!=this._alDragging){this._alDragging=e;this.invalidate()}}get ariaLabel(){return this._ariaLabel}set ariaLabel(e){this._ariaLabel=e}get itemsSource(){return this._items}set itemsSource(e){if(e!=this._items){let t=new wijmo_1.CancelEventArgs;if(this.onItemsSourceChanging(t)){if(this._cv){let e=this._cv;e.currentChanged.removeHandler(null,this);e.collectionChanged.removeHandler(null,this);e instanceof wijmo_1.CollectionView&&e.sortConverter==this._bndSortConverter&&(e.sortConverter=null);this._cv=null}this._items=e;this._cv=this._getCollectionView(e);this._lastCount=0;if(this._cv){let t=this._cv;t.currentChanged.addHandler((e,t)=>this._cvCurrentChanged(e,t),this);t.collectionChanged.addHandler((e,t)=>this._cvCollectionChanged(e,t),this);if(t instanceof wijmo_1.CollectionView){e&&(t.trackChanges=Boolean(e.trackChanges));t.sortConverter||(t.sortConverter=this._bndSortConverter)}}this._isISChanging=!0;this._bindGrid(!0);this._isISChanging=!1;this.onItemsSourceChanged(t)}}}get collectionView(){return this._cv}get editableCollectionView(){return wijmo_1.tryCast(this._cv,"IEditableCollectionView")}get childItemsPath(){return this._childItemsPath}set childItemsPath(e){if(e!=this._childItemsPath){wijmo_1.assert(null==e||wijmo_1.isArray(e)||wijmo_1.isString(e),"childItemsPath should be an array or a string.");this._childItemsPath=e;this._bindGrid(!0)}}get rowHeaderPath(){return this._rowHdrPath?this._rowHdrPath.path:null}set rowHeaderPath(e){if(e!=this.rowHeaderPath){e=wijmo_1.asString(e);this._rowHdrPath=e?new wijmo_1.Binding(e):null;this.invalidate()}}get cells(){return this._gpCells}get columnHeaders(){return this._gpCHdr}get columnFooters(){return this._gpCFtr}get rowHeaders(){return this._gpRHdr}get topLeftCells(){return this._gpTL}get bottomLeftCells(){return this._gpBL}get rows(){return this._rows}get columns(){return this._cols}getColumn(e,t){if(this._hasColumnGroups()&&t){const t=this.getColumnGroups();return null!==t?t.getColumn(e):null}return this.columns.getColumn(e)}get frozenRows(){return this.rows.frozen-this.rows.frozenDetailChildren}set frozenRows(e){this.rows.frozen=e+this.rows.frozenDetailChildren}get frozenColumns(){return this.columns.frozen}set frozenColumns(e){this.columns.frozen=e}get cloneFrozenCells(){return this._fzClone}set cloneFrozenCells(e){if(e!=this._fzClone){wijmo_1.setText(this._fCt,null);this._fzClone=wijmo_1.asBoolean(e,!0);this.invalidate()}}get sortRowIndex(){return this._sortRowIndex}set sortRowIndex(e){if(e!=this._sortRowIndex){this._sortRowIndex=wijmo_1.asNumber(e,!0);this.invalidate()}}get editColumnIndex(){return this._editColIndex}set editColumnIndex(e){if(e!=this._editColIndex){this._editColIndex=wijmo_1.asNumber(e,!0);this.invalidate()}}get scrollPosition(){return this._ptScrl.clone()}set scrollPosition(e){let t=this._root,i=-e.x;if(this.rightToLeft)switch(FlexGrid._getRtlMode()){case"rev":i=t.scrollWidth-t.clientWidth+e.x;break;case"neg":i=e.x;break;default:i=-e.x}t.scrollLeft=i;t.scrollTop=-e.y;this._updateScrollPosition()&&(this._forceScrollUpdate=!0)}get commitEmptyEdits(){return this._commitEmptyEdits}set commitEmptyEdits(e){if(e!=this._commitEmptyEdits){this._commitEmptyEdits=wijmo_1.asBoolean(e);this.invalidate()}}get clientSize(){return this._szClient}get controlRect(){this._rcBounds||(this._rcBounds=wijmo_1.getElementRect(this._root));return this._rcBounds}get scrollSize(){return new wijmo_1.Size(this._gpCells.width,this._heightBrowser)}get viewRange(){return this._gpCells.viewRange}get cellFactory(){return this._cf}set cellFactory(e){if(e!=this._cf){this._clearCells();this._cf=wijmo_1.asType(e,CellFactory,!1)}}get itemFormatter(){return this._itemFormatter}set itemFormatter(e){if(e!=this._itemFormatter){this._clearCells();this._itemFormatter=wijmo_1.asFunction(e)}}canEditCell(e,t){return this._edtHdl._allowEdit(e,t)}getCellData(e,t,i){return this.cells.getCellData(e,t,i)}getCellBoundingRect(e,t,i){return this.cells.getCellBoundingRect(e,t,i)}setCellData(e,t,i,l=!0,s=!0){return this.cells.setCellData(e,t,i,l,s)}hitTest(e,t){wijmo_1.isNumber(e)&&wijmo_1.isNumber(t)&&(e=new wijmo_1.Point(e,t));wijmo_1.isBoolean(t)&&t&&(this._rcBounds=null);return new HitTestInfo(this,e)}getClipString(e,t,i,l){let s;s=this.skipMerged?ClipStringOptions.SkipMerged:null==t||wijmo_1.isBoolean(t)?t?ClipStringOptions.CSV:ClipStringOptions.Default:t;wijmo_1.assert(wijmo_1.isNumber(s),"Unexpected value for ClipStringOptions parameter.");return this._edtHdl.getClipString(e,s,i,l)}setClipString(e,t){this._edtHdl.setClipString(e,t)}focus(e){this.isDisabled||this._setFocus(e)}dispose(){this.finishEditing(!0);this.itemsSource=null;super.dispose()}refresh(e=!0){super.refresh(e);this.finishEditing();if(e){this._updateColumnTypes();this.scrollPosition=this._ptScrl;this._updateDefaultSizes();clearTimeout(this._toInv);this._toInv=null}this.refreshCells(e);let t=this._e;t&&(this._szCtl=new wijmo_1.Size(t.offsetWidth,t.offsetHeight))}refreshCells(e,t,i){this.isUpdating||(e?this._updateLayout():this._updateContent(t,i))}refreshRange(e){for(let t=e.topRow;t<=e.bottomRow;t++)for(let i=e.leftCol;i<=e.rightCol;i++){let e=this.cells.getCellElement(t,i);if(e){let l=e[GridPanel._INDEX_KEY];this.cellFactory.updateCell(this.cells,t,i,e,l.rng)}}}autoSizeColumn(e,t=!1,i=4){this.autoSizeColumns(e,e,t,i)}autoSizeColumns(e,t,i=!1,l=4){let s=0,o=i?this.topLeftCells:this.columnHeaders,n=i?this.bottomLeftCells:this.columnFooters,r=i?this.rowHeaders:this.cells,a=this.viewRange;e=null==e?0:wijmo_1.asInt(e);t=null==t?r.columns.length-1:wijmo_1.asInt(t);a.row=Math.max(0,a.row-1e3);a.row2=Math.min(a.row2+1e3,this.rows.length-1);this.finishEditing()&&this.columns.deferUpdate(()=>{wijmo_1.setCss(this._eCt,{width:this._gpCells.width});let i=wijmo_1.createElement("<div "+FlexGrid._WJS_MEASURE+'="true"/>',r.hostElement,{visibility:"hidden"}),h=this._getCanvasContext();for(let d=e;d<=t&&d>-1&&d<r.columns.length;d++){let e=r.columns[d];if(e.isVisible){s=0;if(this.autoSizeMode&AutoSizeMode.Headers){for(let e=0;e<o.rows.length;e++)o.rows[e].isVisible&&(s=Math.max(this._getDesiredWidth(o,e,d,i),s));for(let e=0;e<n.rows.length;e++)n.rows[e].isVisible&&(s=Math.max(this._getDesiredWidth(n,e,d,i),s))}if(this.autoSizeMode&AutoSizeMode.Cells&&a.row>-1&&a.row2>-1)if(e._getQuickAutoSize()){let e=this._getWidestRow(r,a,d,h);s=Math.max(this._getDesiredWidth(r,e,d,i),s)}else for(let e=a.row;e<=a.row2&&e<r.rows.length;e++)r.rows[e].isVisible&&(s=Math.max(this._getDesiredWidth(r,e,d,i),s));s>0&&(e.width=s+l+2)}}this.cellFactory.disposeCell(i);wijmo_1.removeChild(i)})}autoSizeRow(e,t=!1,i=0){this.autoSizeRows(e,e,t,i)}autoSizeRows(e,t,i=!1,l=0){let s=0,o=1==i?this.topLeftCells:null==i?this.bottomLeftCells:this.rowHeaders,n=1==i?this.columnHeaders:null==i?this.columnFooters:this.cells;l=wijmo_1.asNumber(l);e=null==e?0:wijmo_1.asInt(e);if((t=null==t?n.rows.length-1:wijmo_1.asInt(t))>=e&&this.finishEditing()){wijmo_1.setCss(this._eCt,{width:this._gpCells.width});let i=wijmo_1.createElement("<div "+FlexGrid._WJS_MEASURE+'="true"/>',n.hostElement,{visibility:"hidden"});this.rows.deferUpdate(()=>{let r={},a=this._autoSizeMode,h=AutoSizeMode;for(let d=e;d<=t&&d>-1&&d<n.rows.length;d++){if(n.rows[d].isVisible){s=0;a&h.Headers&&(s=this._getDesiredRowHeight(o,d,i,r));a&h.Cells&&(s=Math.max(this._getDesiredRowHeight(n,d,i,r),s));s>0&&(n.rows[d].height=s+l)}}});this.cellFactory.disposeCell(i);wijmo_1.removeChild(i)}}get treeIndent(){return this._indent}set treeIndent(e){if(e!=this._indent){this._indent=wijmo_1.asNumber(e,!1,!0);this.columns.onCollectionChanged()}}collapseGroupsToLevel(e){this.finishEditing()&&this.deferUpdate(()=>{let t=this.rows;t.deferUpdate(()=>{for(let i=0;i<t.length;i++){let l=t[i];l instanceof GroupRow&&(l.isCollapsed=l.level>=e)}})})}get selectionMode(){return this._selHdl.selectionMode}set selectionMode(e){if((e=wijmo_1.asEnum(e,SelectionMode))!=this.selectionMode){this._selHdl.selectionMode=e;this._updateTabIndex()}}get selection(){return this._selHdl.selection.clone()}set selection(e){this._selHdl.selection=e}select(e,t=!0){this.activePanelType=CellType.Cell;return this._selHdl.select(e,t)}selectAll(){let e=this.rows.length,t=this.columns.length;return!(!e||!t)&&this.select(new CellRange(0,0,e-1,t-1),!1)}getSelectedState(e,t){return this.cells.getSelectedState(e,t)}get selectedRows(){let e=this.selectionMode,t=this.rows.filter(e=>e.isSelected);if(0==t.length&&e!=SelectionMode.None){let e=[];this.selectedRanges.forEach(t=>{for(let i=t.topRow;i<=t.bottomRow&&i>-1&&i<this.rows.length;i++)e.indexOf(i)<0&&e.push(i)});e.sort();t=e.map(e=>this.rows[e])}return t}set selectedRows(e){wijmo_1.assert(this.selectionMode==SelectionMode.ListBox,"This property can be set only in ListBox mode.");e=wijmo_1.asArray(e);this.deferUpdate(()=>{for(let t=0,i=!0;t<this.rows.length;t++){let l=this.rows[t],s=e&&e.indexOf(l)>-1;if(s&&i){i=!1;this.select(t,this.selection.col)}l.isSelected=s}})}get selectedItems(){let e=[];this.selectedRows.forEach(t=>{let i=t?t.dataItem:null;i&&e.indexOf(i)<0&&e.push(i)});return e}set selectedItems(e){wijmo_1.assert(this.selectionMode==SelectionMode.ListBox,"This property can be set only in ListBox mode.");e=wijmo_1.asArray(e);this.deferUpdate(()=>{for(let t=0,i=!0;t<this.rows.length;t++){let l=this.rows[t],s=e&&e.indexOf(l.dataItem)>-1;if(s&&i){i=!1;this.select(t,this.selection.col)}l.isSelected=s}})}get selectedRanges(){let e=[this.selection];this._selHdl.extendedSelection.forEach(t=>{e.push(t)});return e}set selectedRanges(e){if((e=wijmo_1.asArray(e))&&e.length>0){this.select(e[0]);if(this.selectionMode==SelectionMode.MultiRange){let t=this._selHdl.extendedSelection;t.deferUpdate(()=>{t.clear();for(let i=1;i<e.length;i++)t.push(e[i])})}}}scrollIntoView(e,t,i){(null==this._maxOffsetY||this._rows._dirty||this._cols._dirty)&&this._updateLayout();let l=this.scrollPosition,s=this._szClient,o=s.width,n=s.height-this._gpCFtr.rows.getTotalSize(),r=this.cells._getFrozenPos();e=wijmo_1.asInt(e);let a=this._rows[e];if(e>-1&&e<this._rows.length&&e>=this._rows.frozen){let e=this._getCssPage(a.pos);if(e!=this._cssPage){let t=this._maxOffsetY,i=Math.round(t*e);for(;i>a.pos;e-=.1)i=Math.round(t*e);this._offsetY=i}let t=a.pos-this._offsetY,i=t+a.renderSize;i>n-l.y&&(l.y=Math.max(-t,n-i));t-r.y<-l.y&&(l.y=-(t-r.y));e!=this._cssPage&&(this._cssPage=this._getCssPage(-l.y))}wijmo_1.isString(t)&&(t=this.columns.indexOf(t));if((t=wijmo_1.asInt(t))>-1&&t<this._cols.length&&t>=this._cols.frozen){let e=this._cols[t],i=e.pos+e.renderSize;i>-l.x+o&&(l.x=Math.max(-e.pos,o-i));e.pos-r.x<-l.x&&(l.x=-(e.pos-r.x))}if(!l.equals(this._ptScrl)){l.x<this._ptScrl.x&&(0!==l.x?l.x-=1:this.rightToLeft&&(l.x+=1));0!==l.y&&l.y<this._ptScrl.y&&(l.y-=1);this.scrollPosition=l;if(i){this._updateScrollPosition();this._forceScrollUpdate=!1;this.refresh()}return!0}if(a&&this.hostElement.clientHeight>document.scrollingElement.clientHeight){const e=document.scrollingElement.scrollTop-r.y,t=e+document.scrollingElement.clientHeight;let i=this.hostElement.offsetTop+this.cells.hostElement.offsetTop+a.pos;const l=i+a.renderSize;this._stickyHdr&&(i-=this._eCHdr.offsetHeight);let s;i<e?s=e-(e-i)+r.y:l>t&&(s=e+(l-t)+r.y);void 0!==s&&document.scrollingElement.scrollTo({top:s})}if(this._activeCell&&e>-1&&t>-1){let e=this._root,t=e.scrollWidth==e.clientWidth,i=e.scrollHeight==e.clientHeight;if(t||i){let e=this._activeCell.getBoundingClientRect(),s=innerWidth,o=innerHeight,n=e.right<0||e.left>s,r=e.bottom<0||e.top>o;l.x=pageXOffset+(e.left<0?e.left:e.right>s?e.right-s:0);l.y=pageYOffset+(e.top<0?e.top:e.bottom>o?e.bottom-o:0);n&&t&&r&&i?scrollTo(l.x,l.y):n&&t?scrollTo(l.x,document.documentElement.scrollLeft):r&&i&&scrollTo(document.documentElement.scrollTop,l.y)}}return!1}isRangeValid(e){return e&&e.isValid&&e.bottomRow<this.rows.length&&e.rightCol<this.columns.length}startEditing(e=!0,t,i,l,s){return this._edtHdl.startEditing(e,t,i,l,s)}finishEditing(e){return this._edtHdl.finishEditing(e)}get activeCell(){return this._activeCell}get activeEditor(){let e=this._edtHdl;return e?e.activeEditor:null}get editRange(){let e=this._edtHdl.editRange;return e?e.clone():null}get mergeManager(){return this._mrgMgr}set mergeManager(e){if(e!=this._mrgMgr){this._mrgMgr=wijmo_1.asType(e,MergeManager,!0);this.invalidate()}}getMergedRange(e,t,i,l=!0){return this._mrgMgr?this._mrgMgr.getMergedRange(e,t,i,l):null}get keyActionTab(){return this._keyHdl._kaTab}set keyActionTab(e){this._keyHdl._kaTab=wijmo_1.asEnum(e,KeyAction)}get keyActionEnter(){return this._keyHdl._kaEnter}set keyActionEnter(e){this._keyHdl._kaEnter=wijmo_1.asEnum(e,KeyAction)}get preserveWhiteSpace(){return wijmo_1.hasClass(this.hostElement,FlexGrid._WJS_WSPRE)}set preserveWhiteSpace(e){wijmo_1.toggleClass(this.hostElement,FlexGrid._WJS_WSPRE,wijmo_1.asBoolean(e))}get showDropDown(){return this._shDropDown}set showDropDown(e){if(e!=this._shDropDown){this._shDropDown=wijmo_1.asBoolean(e,!0);this.invalidate()}}toggleDropDownList(){if(!this._tglDropDown){this._tglDropDown=!0;this._edtHdl._toggleListBox(null);this._tglDropDown=!1}return null!=this._edtHdl._lbx}static get defaultTypeWidth(){return FlexGrid._defTypeWidth}onItemsSourceChanging(e){this.itemsSourceChanging.raise(this,e);return!e.cancel}onItemsSourceChanged(e){this.itemsSourceChanged.raise(this,e)}onScrollPositionChanged(e){this.scrollPositionChanged.raise(this,e)}onSelectionChanging(e){this.selectionChanging.raise(this,e);return!e.cancel}onSelectionChanged(e){this.selectionChanged.raise(this,e)}onLoadingRows(e){this.loadingRows.raise(this,e);return!e.cancel}onLoadedRows(e){this.loadedRows.raise(this,e);this._autoRowHeights()}onUpdatingLayout(e){this.updatingLayout.raise(this,e);return!e.cancel}onUpdatedLayout(e){this.updatedLayout.raise(this,e)}onResizingColumn(e){this.resizingColumn.raise(this,e);return!e.cancel}onResizedColumn(e){this.resizedColumn.raise(this,e);this._autoRowHeights()}onAutoSizingColumn(e){this.autoSizingColumn.raise(this,e);return!e.cancel}onAutoSizedColumn(e){this.autoSizedColumn.raise(this,e)}onStarSizedColumns(e){this.starSizedColumns.raise(this,e);this._autoRowHeights()}onDraggingColumn(e){this.draggingColumn.raise(this,e);return!e.cancel}onDraggingColumnOver(e){this.draggingColumnOver.raise(this,e);return!e.cancel}onDraggedColumn(e){this.draggedColumn.raise(this,e)}onPinningColumn(e){this.pinningColumn.raise(this,e);return!e.cancel}onPinnedColumn(e){this.pinnedColumn.raise(this,e)}onResizingRow(e){this.resizingRow.raise(this,e);return!e.cancel}onResizedRow(e){this.resizedRow.raise(this,e)}onAutoSizingRow(e){this.autoSizingRow.raise(this,e);return!e.cancel}onAutoSizedRow(e){this.autoSizedRow.raise(this,e)}onDraggingRow(e){this.draggingRow.raise(this,e);return!e.cancel}onDraggingRowOver(e){this.draggingRowOver.raise(this,e);return!e.cancel}onDraggedRow(e){this.draggedRow.raise(this,e)}onGroupCollapsedChanging(e){this.groupCollapsedChanging.raise(this,e);return!e.cancel}onGroupCollapsedChanged(e){this.groupCollapsedChanged.raise(this,e)}onColumnGroupCollapsedChanging(e){this.columnGroupCollapsedChanging.raise(this,e);return!e.cancel}onColumnGroupCollapsedChanged(e){this.columnGroupCollapsedChanged.raise(this,e)}onSortingColumn(e){this.sortingColumn.raise(this,e);return!e.cancel}onSortedColumn(e){this.sortedColumn.raise(this,e)}onBeginningEdit(e){this._addHdl._beginningEdit(this,e);e.cancel||this.beginningEdit.raise(this,e);return!e.cancel}onPrepareCellForEdit(e){this.prepareCellForEdit.raise(this,e)}onCellEditEnding(e){this.cellEditEnding.raise(this,e);return!e.cancel&&!e.stayInEditMode}onCellEditEnded(e){this.cellEditEnded.raise(this,e);this._autoRowHeights()}onRowEditStarting(e){this._addHdl._rowEditStarting(this,e);e.cancel||this.rowEditStarting.raise(this,e);return!e.cancel}onRowEditStarted(e){this.rowEditStarted.raise(this,e)}onRowEditEnding(e){this._addHdl._rowEditEnding(this,e);this.rowEditEnding.raise(this,e)}onRowEditEnded(e){this.rowEditEnded.raise(this,e);this._addHdl._rowEditEnded(this,e);this._autoRowHeights()}onRowAdded(e){this.rowAdded.raise(this,e);return!e.cancel}onDeletingRow(e){this.deletingRow.raise(this,e);return!e.cancel}onDeletedRow(e){this.deletedRow.raise(this,e)}onCopying(e){this.copying.raise(this,e);return!e.cancel}onCopied(e){this.copied.raise(this,e)}onPasting(e){this.pasting.raise(this,e);return!e.cancel}onPasted(e){this.pasted.raise(this,e)}onPastingCell(e){this.pastingCell.raise(this,e);return!e.cancel}onPastedCell(e){this.pastedCell.raise(this,e)}onFormatItem(e){this.formatItem.raise(this,e)}onUpdatingView(e){this.updatingView.raise(this,e);return!e.cancel}onUpdatedView(e){this.updatedView.raise(this,e)}_createSelHdl(){return new _SelectionHandler(this)}_getTabIndex(){return this._orgTabIndex}_setTabOrder(e){this._orgTabIndex=e;this._updateTabIndex()}_updateTabIndex(){let e=this.isDisabled?-1:this._orgTabIndex,t=this._imeHdl;t&&t._updateImeFocus();let i=this._activeCell,l=this._root,s=this._eFocus;if(i){i.tabIndex=e;s.tabIndex=-1;l.tabIndex=-1}else if(this.selectionMode!=SelectionMode.None){s.tabIndex=e;l.tabIndex=-1}else{l.tabIndex=e;s.tabIndex=-1}}_autoRowHeights(){if(this._autoHeights){this.rows.length>100&&[this.columnHeaders,this.rowHeaders].forEach(e=>{e._updateContent(!0,!1,e._getOffsetY())});clearTimeout(this._toAutoHeights);this._toAutoHeights=setTimeout(()=>{this._toAutoHeights=null;this.editRange||this._autoSizeRows()},wijmo_1.Control._REFRESH_INTERVAL)}}_autoSizeRows(){let e=this.autoSizeMode,t=AutoSizeMode;if(e&t.Headers){this._autoSizeMode=t.Both;this.autoSizeRows(0,this.columnHeaders.rows.length-1,!0);this._autoSizeMode=e}e&t.Cells&&this.autoSizeRows()}_getShowErrors(){return this.showErrors&&this._hasValidation}_getHasValidation(){return this._hasValidation}_getError(e,t,i,l){if(wijmo_1.isFunction(this.itemValidator)){if(e==this.cells)return this.itemValidator(t,i,l);if(e==this.rowHeaders){let l=e.rows,o=this.columns,n=l[t].dataItem,r=null,a=[],h=this.getMergedRange(e,t,i,!1),d=t;if(h){for(t=d=h.row;t<l.length&&(l[t].dataItem==n||h&&h.rowSpan>1&&h.row2>=t);t++)for(var s=0;s<o.length;s++)if(r=this.itemValidator(t,s,!1)){let e=this.getMergedRange(this.cells,t,s);e&&(e.columnSpan>1&&e.col<s||e.rowSpan>1&&e.row<t)||a.push(r)}}else for(s=0;s<this.columns.length;s++){const e=this.itemValidator(t,s,!1);e&&a.push(e)}if(a.length){let e=this.errorTip,t=!!e&&e.isContentHtml;r=a.join(t?"<br/>":"\n")}return r}}let o=this._cv,n=o?o.getError:null;if(wijmo_1.isFunction(n)){let o=e.rows,r=this.columns,a=o[t].dataItem;if(a&&!(a instanceof wijmo_1.CollectionViewGroup))if(e==this.cells)for(;t<o.length&&o[t].dataItem==a;t++){return n(a,this._getBindingColumn(this.cells,t,r[i]).binding,l)}else if(e==this.rowHeaders){let l=n(a,null,!1);if(!l){let h=[],d=this.getMergedRange(e,t,i,!1),c=t;d&&(c=d.row);for(t=c;t<o.length&&(o[t].dataItem==a||d&&d.rowSpan>1&&d.row2>=t);t++)for(s=0;s<r.length;s++){let e=this._getBindingColumn(this.cells,t,r[s]);if(l=n(o[t].dataItem,e.binding,!1)){let e=this.getMergedRange(this.cells,t,s);e&&(e.columnSpan>1&&e.col<s||e.rowSpan>1&&e.row<t)||h.push(l)}}if(h.length){let e=this.errorTip,t=!!e&&e.isContentHtml;l=h.join(t?"<br/>":"\n")}}return l}}return null}_setAria(e,t){wijmo_1.setAttribute(this.cells.hostElement,"aria-"+e,t)}_setFocus(e){if(this.hostElement){let t=wijmo_1.getActiveElement(),i=this.activeEditor,l=this._activeCell,s=this._eFocus,o=this._root,n=this._getTabIndex(),r=this.containsFocus();if(!e&&r&&this.selectionMode!=SelectionMode.None){if(this.rows.length>0&&this.selection.row>=0&&this.selection.col>=0){let e=this._getBindingColumn(this.cells,this.selection.row,this.columns[this.selection.col]),i=e&&e._edt;!l||wijmo_1.contains(l,t)||this.imeEnabled||i||this._correctFocusOfActiveCell(l)}}else if(e||!r){if(i){if(!wijmo_1.contains(i,t)){i.focus();s.tabIndex=-1;o.tabIndex=-1}}else if(l)wijmo_1.contains(l,t)||this._correctFocusOfActiveCell(l);else if(!wijmo_1.contains(s,t)&&t!=o)if(this.selectionMode!=SelectionMode.None){s.tabIndex=n;this._setFocusNoScroll(s)}else{o.tabIndex=n;this._setFocusNoScroll(o)}if(!this.containsFocus())if(this.selectionMode!=SelectionMode.None){s.tabIndex=n;this._setFocusNoScroll(s)}else{o.tabIndex=n;this._setFocusNoScroll(o)}}}}_correctFocusOfActiveCell(e){var t=this._getTabIndex();if(wijmo_1.getActiveElement()!=this._root){wijmo_1.isIE()&&wijmo_1.hasClass(e,"wj-group")&&(e=e.querySelector("."+CellFactory._WJC_COLLAPSE)||e);e.tabIndex=t;this._setFocusNoScroll(e)}else e.tabIndex=t;this._eFocus.tabIndex=-1}_setFocusNoScroll(e){if(wijmo_1.getActiveElement()!=e){if(wijmo_1.supportsFocusOptions())e.focus({preventScroll:!0});else{let t=this.scrollPosition,i=e.style,l=i.position;i.position="fixed";e.focus();i.position=l;this.scrollPosition=t}this._fixScroll()}}_clearAnchorCell(){this._anchorCell=null}_setAnchorCell(e,t){let i=this.getMergedRange(this.cells,e,t);this._anchorCell=i?new wijmo_1.Point(i.col,i.row):new wijmo_1.Point(t,e)}_getAnchorCell(){return this._anchorCell}_updateDefaultSizes(){let e=this._getDefaultRowHeight();this._rows._setDefaultSize(e);this._cols._setDefaultSize(4*e);this._hdrRows._setDefaultSize(e);this._hdrCols._setDefaultSize(Math.round(1.25*e));this._ftrRows._setDefaultSize(e);return e}_getDefaultRowHeight(){let e=this.hostElement,t=this._eFocus,i=null;if(!t.offsetHeight){i=wijmo_1.createElement('<div><div class="wj-cell">0</div></div>',document.body);e&&i.setAttribute("class",e.getAttribute("class"));t=i.children[0]}let l=t.offsetHeight;(isNaN(l)||l<=6)&&(l=28);wijmo_1.removeChild(i);return l}_getCollectionView(e){return wijmo_1.asCollectionView(e)}_getCanvasContext(){let e=document.createElement("canvas").getContext("2d"),t=getComputedStyle(this.hostElement);e.font=t.fontSize+" "+t.fontFamily.split(",")[0];return e}_getWidestRow(e,t,i,l){let s=0,o=0,n=1===this._getRowsPerItem()&&e.columns[i].dataType==wijmo_1.DataType.Boolean;for(let r=t.row;r<=t.row2;r++)if(e.rows[r].isVisible){let t=e.getCellData(r,i,!0),a=l.measureText(t).width,h=this.getMergedRange(e,r,i,!1);h&&h.columnSpan>1&&(a/=h.columnSpan);if(a>o){o=a;s=r}if(n)break;r+=h?h.rowSpan-1:0}return s}_getDesiredWidth(e,t,i,l){let s=this.getMergedRange(e,t,i,!1),o=l.style;this.cellFactory.updateCell(e,t,i,l,s);o.width=o.top=o.left="";return l.offsetWidth/(s&&s.columnSpan>1?s.columnSpan:1)}_getDesiredHeight(e,t,i,l){let s=l.style,o=this.getMergedRange(e,t,i,!1),n=o?o.rowSpan:1;this.cellFactory.updateCell(e,t,i,l,o);l.innerHTML.trim()||(l.innerHTML="&nbsp;");s.height=s.top=s.left="";return l.offsetHeight/n}_getDesiredRowHeight(e,t,i,l){let s=0,o=(e.rows[t],this._getQuickAutoSize());for(let n=0;n<e.columns.length;n++){if(e.columns[n].isVisible){let r,a=this.getMergedRange(e,t,n,!1);if(o){let s={ct:e.cellType,col:n,spr:a&&a.rowSpan>1?a.rowSpan:1,spc:a&&a.columnSpan>1?a.columnSpan:1,data:e.getCellData(t,n,!0)||"1"},o=JSON.stringify(s);if(null==(r=l[o])){r=this._getDesiredHeight(e,t,n,i);l[o]=r}}else r=this._getDesiredHeight(e,t,n,i);s=Math.max(r,s);n+=a?a.columnSpan-1:0}}return s}_getSortRowIndex(){return null!=this._sortRowIndex?this._sortRowIndex:this.columnHeaders.rows.length-1}_getDeleteColumnIndex(){return 0}_getEditColumnIndex(){return null!=this._editColIndex?this._editColIndex:this.rowHeaders.columns.length-1}_sortConverter(e,t,i,l){let s;if(l){this._mappedColumns=null;this._cv&&this._cv.sortDescriptions.forEach(e=>{if((s=this.getColumn(e.property))&&s.dataMap){this._mappedColumns||(this._mappedColumns={});this._mappedColumns[s.binding]=s.dataMap}});if(this._mouseHdl._htDown&&this._mouseHdl._htDown.col>-1){s=this.columns[this._mouseHdl._htDown.col];this._mappedColumns&&s.dataMap&&(this._mappedColumns[s.binding]=s.dataMap)}}if(this._mappedColumns){let t=this._mappedColumns[e.property];t&&t.sortByDisplayValues&&(i=t.getDisplayValue(i))}return i}_bindGrid(e){this.finishEditing();this.deferUpdate(()=>{this.autoGenerateColumns&&0==this._lastCount&&wijmo_1.hasItems(this._cv)&&(e=!0);let t;this.preserveSelectedState&&(t=this._getMap())&&this.rows.forEach(e=>{e.isSelected&&e.dataItem&&t.set(e.dataItem,!0)});let i,l=this._getMap();l&&this.rows.forEach(e=>{e.isReadOnly&&e.dataItem&&l.set(e.dataItem,!0)});if(this.preserveOutlineState&&this.rows.maxGroupLevel>-1&&(i=this._getMap()))for(let e=0;e<this.rows.length;e++){let t=this.rows[e];if(t instanceof GroupRow&&t.isCollapsed&&t.dataItem){let e=t.dataItem;e instanceof wijmo_1.CollectionViewGroup&&(e=e._path);i.set(e,!0)}}e&&this.columns.deferUpdate(()=>{this._bindColumns()});let s=new wijmo_1.CancelEventArgs;if(this.onLoadingRows(s)){this.rows.deferUpdate(()=>{this._bindRows()});this.onLoadedRows(s)}this._selHdl.extendedSelection.clear();let o=0;t&&t.size&&this.rows.forEach(e=>{let i=e.dataItem;if(i&&t.has(i)){e.isSelected=!0;o++}});l&&l.size&&this.rows.forEach(e=>{let t=e.dataItem;t&&l.has(t)&&(e.isReadOnly=!0)});if(0==o&&this.selectionMode==SelectionMode.ListBox){let e=this.selection;for(let t=e.topRow;t<=e.bottomRow&&t>-1&&t<this.rows.length;t++)this.rows[t]._setFlag(RowColFlags.Selected,!0,!0)}i&&i.size&&this.rows.deferUpdate(()=>{this.rows.forEach(e=>{if(e instanceof GroupRow){let t=e.dataItem;t instanceof wijmo_1.CollectionViewGroup&&(t=t._path);i.has(t)&&(e.isCollapsed=!0)}})});if(!this._lastCount){let e=this._cv;e&&e.items&&(this._lastCount=e.items.length)}});if(this._cv){let t=e&&!this._toInv;this._syncSelection(t)}else{const e=this.selection,t=new CellRange(-1,e.col,-1,e.col2);this._selHdl._adjustSelection(t,this.selectionMode)}}_getMap(){return window.Map?new Map:null}_cvCollectionChanged(e,t){if(this.autoGenerateColumns&&0==this.columns.length){this._bindGrid(!0);return}let i=wijmo_1.NotifyCollectionChangedAction;if(this.childItemsPath&&t.action!=i.Change)this._bindGrid(!1);else{switch(t.action){case i.Change:this.invalidate();return;case i.Add:if(t.index==this._cv.items.length-1){let e=this.rows.length;this.rows[e-1]instanceof _NewRowTemplate&&e--;this.rows.insert(e,new Row(t.item));return}wijmo_1.assert(!1,"added item should be the last one.");break;case i.Remove:let e=this._findRow(t.item);if(e>-1){this.rows.removeAt(e);this._syncSelection(!1);return}wijmo_1.assert(!1,"removed item not found on grid.")}this._bindGrid(!1)}}_cvCurrentChanged(e,t){this._syncSelection(!1)}_syncSelection(e){if(this._cv&&this.selectionMode!=SelectionMode.None){let t=this._selHdl,i=t.selection,l=i.row>-1&&i.row<this.rows.length?this.rows[i.row]:null,s=l?l.dataItem:null,o=this._cv;if(o instanceof wijmo_1.CollectionView&&o.isUpdating)return;if(this.newRowAtTop&&l instanceof _NewRowTemplate)return;s instanceof wijmo_1.CollectionViewGroup&&(s=null);const n=this._isISChanging;if(e||s!=o.currentItem||i.row>=this.rows.length||i.row2>=this.rows.length||n&&i.row!==i.row2){let e=this.editableCollectionView;if(!this.childItemsPath||!e||!e.currentAddItem){let e=this._getRowIndex(o.currentPosition);if(e!=i.row||!this.childItemsPath){const l=n?i.col:i.col2;i=new CellRange(e,i.col,e,l);t._adjustSelection(i,this.selectionMode);this.selectionMode&&!this._updating&&this.scrollIntoView(i.row,-1)}}}}}_getRowIndex(e){if(this._cv){let t=this.rows;if(e>-1){let i=this._cv.items[e];for(;e<t.length;e++)if(t[e].dataItem===i)return e;return-1}{if(1==t.length&&t[0]instanceof _NewRowTemplate)return 0;let e=this.selection.row,i=e>-1?t[e]:null;return i&&(i instanceof GroupRow||null==i.dataItem)?e:-1}}return this.selection.row}_getCvIndex(e){return e>-1&&e<this.rows.length?this.rows[e].dataIndex:-1}_findRow(e){for(let t=0;t<this.rows.length;t++)if(this.rows[t].dataItem==e)return t;return-1}_preWidth(){let e=this._root,t=this._hdrVis&HeadersVisibility.Row?this._hdrCols.getTotalSize():0;return e.clientWidth-t}_updateLayout(){let e=new wijmo_1.CancelEventArgs;if(!this.onUpdatingLayout(e))return;let t=this._hdrVis&HeadersVisibility.Row?this._hdrCols.getTotalSize():0,i=this._hdrVis&HeadersVisibility.Column?this._hdrRows.getTotalSize():0,l=this._ftrRows.getTotalSize(),s=this._rows.getTotalSize()+l;s<1&&(s=1);this._heightReal=s;this._heightBrowser=Math.min(s,FlexGrid._getMaxSupportedCssHeight());this._maxOffsetY=Math.max(0,s-this._heightBrowser);let o=getComputedStyle(this._eFocus);this._cellPadVert=parseInt(o.paddingTop)+parseInt(o.paddingBottom);this._cellPadHorz=parseInt(o.paddingLeft)+parseInt(o.paddingRight);this._cellPadLeft=parseInt(this.rightToLeft?o.paddingRight:o.paddingLeft);let n=this._heightBrowser+i-l,r=this._gpCells.width,a=this._heightBrowser;!r&&this.rows.length&&(r=.1);!a&&this.columns.length&&(a=.1);if(this.rightToLeft){wijmo_1.setCss(this._eTL,{right:0,top:0,width:t,height:i});wijmo_1.setCss(this._eCHdr,{right:t,top:0,height:i});wijmo_1.setCss(this._eRHdr,{right:0,top:i,width:t});wijmo_1.setCss(this._eCt,{right:t,top:i,width:r,height:a});wijmo_1.setCss(this._fCt,{right:t,top:i});wijmo_1.setCss(this._eBL,{right:0,top:n,width:t,height:l});wijmo_1.setCss(this._eCFtr,{right:t,top:n,height:l})}else{wijmo_1.setCss(this._eTL,{left:0,top:0,width:t,height:i});wijmo_1.setCss(this._eCHdr,{left:t,top:0,height:i});wijmo_1.setCss(this._eRHdr,{left:0,top:i,width:t});wijmo_1.setCss(this._eCt,{left:t,top:i,width:r,height:a});wijmo_1.setCss(this._fCt,{left:t,top:i});wijmo_1.setCss(this._eBL,{left:0,top:n,width:t,height:l});wijmo_1.setCss(this._eCFtr,{left:t,top:n,height:l})}this._stickyHdr&&this._updateStickyHeaders();const h=this.rows.frozen||this.columns.frozen;wijmo_1.setCss([this._eTL,this._eBL,this._eCFtr,this._eRHdr],{zIndex:h?"4":"3"});wijmo_1.setCss(this._eCHdr,{zIndex:h?"5":"3"});wijmo_1.setCss(this._eMarquee,{zIndex:h?"3":"1"});this._eCHdr.closest(".wj-cell")&&wijmo_1.setCss(this._eCHdr,{zIndex:h?"4":"2"});wijmo_1.isIE()&&(this._fCt.style.zIndex=h?"3":"");let d=this._root,c=d.offsetWidth-d.clientWidth,_=d.offsetHeight-d.clientHeight;wijmo_1.setCss(this._eSz,{width:t+c+this._gpCells.width,height:i+_+this._heightBrowser});let u=null;if(this.columns._updateStarSizes(d.clientWidth-t)){u=d.clientWidth;wijmo_1.setCss(this._eCt,{width:this._gpCells.width});this.onStarSizedColumns()}this._szClient=new wijmo_1.Size(d.clientWidth-t,d.clientHeight-i);this._szClientSB=new wijmo_1.Size(d.offsetWidth-t,d.offsetHeight-i);this._rcBounds=null;this._updateScrollHandler();this._updateContent(!1);c=d.offsetWidth-d.clientWidth;_=d.offsetHeight-d.clientHeight;wijmo_1.setCss(this._eSz,{width:t+c+this._gpCells.width,height:i+_+this._heightBrowser});this._szClient=new wijmo_1.Size(d.clientWidth-t,d.clientHeight-i);if(u&&u!=d.clientWidth&&this.columns._updateStarSizes(d.clientWidth-t)){wijmo_1.setCss(this._eCt,{width:this._gpCells.width});this._updateContent(!1)}wijmo_1.setCss([this._eCHdr,this._eCFtr,this._fCt],{width:this._szClient.width});wijmo_1.setCss([this._eRHdr,this._fCt],{height:this._szClient.height});if(l){n=Math.min(n,this._szClient.height+i-l);wijmo_1.setCss([this._eBL,this._eCFtr],{top:n})}window.addEventListener("load",()=>{wijmo_1.setCss(this._root,{"overflow-y":this._root.scrollHeight===this._root.parentElement.clientHeight?"hidden":"auto","overflow-x":this._root.scrollWidth===this._root.parentElement.clientWidth?"hidden":"auto"})});this.onUpdatedLayout(e)}_updateStickyHeaders(){let e=!1,t=0;if(this._stickyHdr){let i=0,l=null;for(let e=this.hostElement;e;e=e.parentElement)if("inline"!=getComputedStyle(e).display){let t=e.getBoundingClientRect();null==l&&(l=t.top);i=Math.max(i,t.top)}t=-(l=Math.max(0,i-l-1));e=l>0;this._rcBounds=null}this._eTL.style.top=this._eCHdr.style.top=e?-t+"px":"";wijmo_1.toggleClass(this._eTL,FlexGrid._WJS_STICKY,e);wijmo_1.toggleClass(this._eCHdr,FlexGrid._WJS_STICKY,e)}_updateScrollHandler(){this._clipToScreen=this._getClipToScreen();let e=this._stickyHdr||this._clipToScreen;if(e!=this._scrollHandlerAttached){this._scrollHandlerAttached=e;e?this.addEventListener(window,"scroll",this._scroll.bind(this),!0):this.removeEventListener(window,"scroll")}}_getClipToScreen(){if(this.rows.length<=FlexGrid._MIN_VIRT_ROWS)return!1;if(this._root.scrollHeight>this._root.clientHeight)return!1;for(let e=this.hostElement;e&&e!=document.documentElement;e=e.parentElement){if("auto"==getComputedStyle(e).overflow)return!1}return!0}_scroll(e){if(wijmo_1.contains(e.target,this.hostElement)){if(this._clipToScreen){this._afClip&&cancelAnimationFrame(this._afClip);this._afClip=requestAnimationFrame(()=>{this._afClip=null;this.finishEditing();this._updateContent(!0)})}if(this._stickyHdr){this._afSticky&&cancelAnimationFrame(this._afSticky);this._afSticky=requestAnimationFrame(()=>{this._afSticky=null;let e=new wijmo_1.CancelEventArgs;if(this.onUpdatingLayout(e)){this._updateStickyHeaders();this.onUpdatedLayout(e)}})}}}_getCssPage(e){if(this._heightReal>this._heightBrowser){let t=this._szClient.height-this._gpCFtr.rows.getTotalSize();if(this._heightBrowser>t)return wijmo_1.clamp(Math.round(e/(this._heightBrowser-t)*10)/10,0,1)}return 0}_updateScrollPosition(){let e=this._root,t=e.scrollTop,i=e.scrollLeft;this.rightToLeft&&"rev"==FlexGrid._getRtlMode()&&(i=e.scrollWidth-e.clientWidth-i);let l=new wijmo_1.Point(-Math.abs(i),-t);if(!this._ptScrl.equals(l)){this._ptScrl=l;this._updateMarquee();this.onScrollPositionChanged();return!0}return!1}_updateContent(e,t){let i=this._root,l=this.hostElement,s=this.cells.hostElement,o=this._activeCell,n=wijmo_1.getActiveElement(),r=wijmo_1.contains(l,n),a=wijmo_1.closest(n,".wj-flexgrid")==l?n:null,h=new wijmo_1.CancelEventArgs;if(!this.onUpdatingView(h))return;if([HeadersFocusability.All,HeadersFocusability.Column].includes(this.headersFocusability)){wijmo_1.setAttribute(this.hostElement,"role",this.rows.maxGroupLevel<0?"grid":"treegrid");wijmo_1.setAttribute(this.hostElement,"aria-label",this.ariaLabel)}else{wijmo_1.setAttribute(s,"role",this.rows.maxGroupLevel<0?"grid":"treegrid");wijmo_1.setAttribute(s,"aria-label",this.ariaLabel)}this._hasValidation=wijmo_1.isFunction(this._itemValidator)||this._cv&&wijmo_1.isFunction(this._cv.getError);let d=!t&&this._errorTip&&this._errorTip._tips.length,c=this._getCssPage(-this._ptScrl.y);if(c!=this._cssPage){this._cssPage=c;this._offsetY=Math.round(this._maxOffsetY*c)}this._updateScrollPosition();this._updateMarquee();let _=this._gpCells._updateContent(e,t,this._offsetY),u=this._hdrVis;if(u&HeadersVisibility.Column&&(!t||this._ssHdr&u)){this._gpCHdr._updateContent(e,t,0);this.rightToLeft||(this._eCHdr.scrollLeft=0)}if(u&HeadersVisibility.Row&&(!t||this._ssHdr&u)){this._gpRHdr._updateContent(e,t,this._offsetY);this._eRHdr.scrollTop=0}u&&!t&&this._gpTL._updateContent(e,t,0);if(this._gpCFtr.rows.length){this._gpBL._updateContent(e,t,0);this._gpCFtr._updateContent(e,t,0)}if(d&&this._errorTip&&this._errorTip._tips.length){clearTimeout(this._toErrorTips);this._toErrorTips=setTimeout(()=>{let e=this._errorTip;if(e){e.hide();let t=e._tips;for(let i=0;i<t.length;i++){let l=t[i].element;if(!l.offsetHeight||!wijmo_1.hasClass(l,"wj-state-invalid")){e.setTooltip(l,null);i--}}}},250)}if(this._useFrozenDiv()){this._updateFrozenCells(t);_&&wijmo_1.hasClass(_,"wj-frozen")&&(_=null)}this._fCt.style.display=this._fCt.childElementCount?"":"none";this._activeCell=_;if(a)if(a!=i&&a!=this._eFocus&&wijmo_1.contains(l,a)&&!wijmo_1.contains(s,a)){wijmo_1.getActiveElement()!==a&&a.focus();if(wijmo_1.isIE()&&a instanceof HTMLInputElement&&!a.type.match(/checkbox|radio|range/i)){let e=a.selectionStart,t=a.selectionEnd;a.setSelectionRange(e,t)}}else{let e=_!==o;this._setFocus(e)}!a&&_&&(_.tabIndex=this.isDisabled?-1:this._orgTabIndex);o&&o!=_&&(o.tabIndex=-1);if(this.selectionMode!=SelectionMode.None)this._eFocus.tabIndex=null!=_||this.isDisabled?-1:this._orgTabIndex;else{this._eFocus.tabIndex=-1;this._root.tabIndex=null!=_||this.isDisabled?-1:this._orgTabIndex}r&&this.focus();this._fixScroll();this._rcBounds=null;this._updateMarquee();this.onUpdatedView(h)}_fixScroll(){let e=this._root;if(!this._updating){let t=this.hostElement,i=e?e.parentElement:null,l=this.rightToLeft;if(t){t.scrollTop&&(t.scrollTop=0);t.scrollLeft&&!l&&(t.scrollLeft=0)}if(i){i.scrollTop&&(i.scrollTop=0);i.scrollLeft&&!l&&(i.scrollLeft=0)}}const t=_getSafariVer();if(e&&t&&14==t.major&&t.minor>=1){e.style.transform="";e.style.transform="translateZ(0)"}}_clearCells(){for(let e in this)if("_"==e[0]){let t=this[e];t instanceof GridPanel&&t._clearCells()}this.invalidate()}_useFrozenDiv(){return wijmo_1.isBoolean(this._fzClone)?this._fzClone:wijmo_1.isIE()||wijmo_1.isFirefox()||wijmo_1.isSafari()||wijmo_1.isMobile()}_updateFrozenCells(e){let t=this._fCt;if(this.rows.frozen||this.columns.frozen){let i=this._eCt.querySelectorAll(".wj-frozen");if(e&&t.children.length==i.length){for(let e=0;e<i.length;e++)t.children[e].className=i[e].className;return}wijmo_1.setText(t,null);if(!this.activeEditor){let e=this._errorTip,l=navigator.userAgent.indexOf("MSIE")>=0;for(let s=0;s<i.length;s++){let o=i[s];if(wijmo_1.closest(o,".wj-flexgrid")==this.hostElement){let n=o[GridPanel._INDEX_KEY],r=o.firstElementChild,a=null;if(n&&r){let e=n.panel,t=this._getBindingColumn(e,n.row,e.columns[n.col]);a=wijmo_1.isFunction(t.cellTemplate)?r.onclick:null}if(l){let e="input[type=checkbox]",t=o.querySelector(e);o=o.cloneNode(!0);if(t){o.querySelector(e).checked=t.checked}}else o=o.cloneNode(!0);r=o.firstElementChild;a&&r&&(r.onclick=a);o[GridPanel._INDEX_KEY]=n;if(e){let t=e.getTooltip(i[s]);t&&e.setTooltip(o,t)}t.appendChild(o)}}}}else wijmo_1.setText(t,null)}_updateMarquee(){const e=this._eMarquee,t=this._getMarqueeRect();if(t&&t.width&&t.height){const i=this.cells.hostElement,l=e.firstChild,s=e.offsetWidth-l.offsetWidth,o=e.offsetHeight-l.offsetHeight;wijmo_1.setCss(e,{width:t.width+s,height:t.height+o,top:t.top+i.offsetTop-o/2,left:t.left+i.offsetLeft-s/2,display:""})}else e.style.display="none"}_hideMarquee(){let e=this._eMarquee;wijmo_1.setCss(e,{display:"none"})}_getMarqueeRect(){if(!this._shMarquee||!this.selectionMode)return null;let e=this._selHdl.selection;if(!this.isRangeValid(e))return null;e=(e=(e=this.cells._getAdjustedSelection(e)).combine(this.getMergedRange(this.cells,e.topRow,e.leftCol,!1))).combine(this.getMergedRange(this.cells,e.bottomRow,e.rightCol,!1));let t=this.cells.getCellBoundingRect(e.topRow,e.leftCol,!0),i=this.cells.getCellBoundingRect(e.bottomRow,e.rightCol,!0);if(this.rows.frozen){let l=Math.min(this.rows.length,this.rows.frozen),s=this.cells.getCellBoundingRect(l-1,0,!0);e.topRow>=l&&t.top<s.bottom&&(t.top=s.bottom);e.bottomRow>=l&&i.bottom<s.bottom&&(i.height=s.bottom-i.top)}if(this.columns.frozen){let l=Math.min(this.columns.length,this.columns.frozen),s=this.cells.getCellBoundingRect(0,l-1,!0);if(this.rightToLeft){e.leftCol>=l&&t.right>s.left&&(t.left=s.left-t.width);e.rightCol>=l&&i.left>s.left&&(i.left=s.left)}else{e.leftCol>=l&&t.left<s.right&&(t.left=s.right);e.rightCol>=l&&i.right<s.right&&(i.width=s.right-i.left)}}return this.rightToLeft?new wijmo_1.Rect(i.left,t.top,t.right-i.left,i.bottom-t.top):new wijmo_1.Rect(t.left,t.top,i.right-t.left,i.bottom-t.top)}_bindColumns(){let e=this.columns;for(let t=0;t<e.length;t++){if(e[t]._getFlag(RowColFlags.AutoGenerated)){e.removeAt(t);t--}}let t=this._cv,i=t?t.items:null;i&&i.length&&this.autoGenerateColumns&&this._getColumnTypes(i).forEach(t=>{let i=new Column(t);i._setFlag(RowColFlags.AutoGenerated,!0);i.name=i.binding;i.header=wijmo_1.toHeaderCase(i.binding);let l=FlexGrid._defTypeWidth[i.dataType];if(null!=l){if(wijmo_1.isString(l)){let t=Math.round(parseFloat(l));l=l.indexOf("*")>-1?t*e.defaultSize:t}wijmo_1.isNumber(l)&&l>0&&(i.width=l)}e.push(i)});this._updateColumnTypes()}_getColumnTypes(e){return wijmo_1.getTypes(e)}_updateColumnTypes(){let e=this._cv;if(wijmo_1.hasItems(e)){let t=e.items[0];this.columns.forEach(e=>{null==e.dataType&&e._binding&&(e.dataType=wijmo_1.getType(e._binding.getValue(t)))})}}_getMapEditor(e,t){return t.editor?null!=t.editor.isDroppedDown?t.dataMapEditor:null:!e.dataMap||e instanceof GroupRow?t.dataMap?t.dataMapEditor:null:e.dataMapEditor}_getBindingColumn(e,t,i){return i}_getBindingColumns(){return this.columns}_getRowsPerItem(){return 1}_isTransposed(){return!1}_getRowHeaderPath(){return this._rowHdrPath}_bindRows(){this.rows.clear();let e=this._cv;if(e&&e.items){let t=e.items,i=e.groups;if(this.childItemsPath)for(let e=0;e<t.length;e++)this._addNode(t,e,0);else if(null!=i&&i.length>0&&this.showGroups)for(let e=0;e<i.length;e++)this._addGroup(i[e]);else for(let e=0;e<t.length;e++)this._addBoundRow(t,e)}}_addBoundRow(e,t){let i=new Row(e[t]),l=this.rows;i._list=l;l[l.length++]=i}_addGroupRow(e){this.rows.push(new GroupRow(e))}_addNode(e,t,i){let l=e[t],s=this.childItemsPath,o=l[wijmo_1.isArray(s)?s[i]:s],n=new GroupRow(l);n.level=i;this.rows.push(n);if(wijmo_1.isArray(o))for(let e=0;e<o.length;e++)this._addNode(o,e,i+1)}_addGroup(e){this._addGroupRow(e);if(e.isBottomLevel){let t=e.items;for(let e=0;e<t.length;e++)this._addBoundRow(t,e)}else for(let t=0;t<e.groups.length;t++)this._addGroup(e.groups[t])}static _getSerializableProperties(e){let t=[];for(e=e.prototype;e!=Object.prototype;e=Object.getPrototypeOf(e)){let i=Object.getOwnPropertyNames(e);for(let l=0;l<i.length;l++){let s=i[l],o=Object.getOwnPropertyDescriptor(e,s);o&&o.set&&o.get&&"_"!=s[0]&&!s.match(/^(disabled|required|showDropDown)$/)&&t.push(s)}}return t}_hasColumnGroups(){return this._grpHdl.hasColumnGroups()}_getColumnGroup(e,t){return this._grpHdl.getColumnGroup(e,t)}_canMoveColumnGroup(e,t,i,l){return this._grpHdl.canMoveColumnGroup(e,t,i,l)}_moveColumnGroup(e,t,i,l,s){return this._grpHdl.moveColumnGroup(e,t,i,l,s)}_copy(e,t){if("columns"==e){let e=wijmo_1.asArray(t);if(e.some(e=>null!=e.columns))this.columnGroups=e;else{this.columns.clear();e.forEach(e=>{let t=new Column(e);this.columns.push(t)})}return!0}return!1}_isInputElement(e){return e instanceof HTMLElement&&!wijmo_1.hasClass(e,"wj-btn-glyph")&&("true"==e.contentEditable||null!=e.tagName.match(/^(INPUT|TEXTAREA|BUTTON|A|SELECT|OPTION)$/i))}_isNativeCheckbox(e){return e instanceof HTMLInputElement&&"checkbox"==e.type&&!e.disabled&&!e.readOnly&&wijmo_1.hasClass(e,CellFactory._WJC_CHECKBOX)&&wijmo_1.closest(e,".wj-flexgrid")==this.hostElement}_wantsInput(e){return this._isInputElement(e)&&!this.activeEditor&&!this._isNativeCheckbox(e)&&!wijmo_1.hasClass(e,"wj-grid-ime")&&wijmo_1.contains(document.body,e)}static _getMaxSupportedCssHeight(){if(!FlexGrid._maxCssHeight){let e=265e5;wijmo_1.isIE()?e=15e5:wijmo_1.isFirefox()&&(e=175e5);FlexGrid._maxCssHeight=e}return FlexGrid._maxCssHeight}static _getRtlMode(){if(!FlexGrid._rtlMode){let e=wijmo_1.createElement('<div dir="rtl"><div></div></div>');wijmo_1.setCss(e,{visibility:"hidden",width:100,height:100,overflow:"auto"});wijmo_1.setCss(e.firstChild,{width:2e3,height:2e3});document.body.appendChild(e);let t=e.scrollLeft;e.scrollLeft=-1e3;let i=e.scrollLeft;wijmo_1.removeChild(e);FlexGrid._rtlMode=i<0?"neg":t>0?"rev":"std"}return FlexGrid._rtlMode}getEmptyRequiredCell(e){return this._getEmptyRequiredCell(e)}_getEmptyRequiredCell(e){if(e>=0)for(let t=0;t<this.columns.length;t++){let i=this.getCellData(e,t,!1);if(this.columns[t].getIsRequired(this.rows[e])&&(""===i||null==i)){if(!this.columns[t].isReadOnly)return t;console.warn(`Incorrect data. Column ${t} is at the same time required, empty and read-only`)}}return null}adjustFrozenRowColSize(e,t,i){const l=t===FrozenRowCol.Column,s=l?this.columns:this.rows,o=l?this.columns.frozen:this.rows.frozen,n=l?this._szClient.width:this._szClient.height;if(e<0||e>=s.length)return;if(e>=o)return;let r=0;for(let t=0;t<o;t++)t!==e&&(r+=s[t].size||s[t].renderSize);const a=n-r-5;let h=(s[e].size||s[e].renderSize)+i;h>a&&(h=a);s[e].size=h}}FlexGrid._WJS_STICKY="wj-state-sticky";FlexGrid._WJS_MEASURE="wj-state-measuring";FlexGrid._WJS_UPDATING="wj-state-updating";FlexGrid._WJS_WSPRE="wj-whitespace-pre";FlexGrid._MIN_VIRT_ROWS=200;FlexGrid._defTypeWidth={[wijmo_1.DataType.Number]:"0.714285714*"};FlexGrid.controlTemplate='<div> <div wj-part="ch"><div wj-part="chcells" class="wj-colheaders"></div></div><div wj-part="root"><div wj-part="cells" class="wj-cells"></div><div wj-part="marquee" class="wj-marquee"><div></div></div></div><div wj-part="fcells" aria-hidden="true" class="wj-cells wj-frozen-clone"></div><div wj-part="rh"><div wj-part="rhcells" class="wj-rowheaders"></div></div><div wj-part="cf"><div wj-part="cfcells" class="wj-colfooters"></div></div><div wj-part="bl"><div wj-part="blcells" class="wj-bottomleft"></div></div><div wj-part="tl"><div wj-part="tlcells" class="wj-topleft"></div></div><div wj-part="focus" class="wj-cell">0</div><div wj-part="sz"></div></div>';exports.FlexGrid=FlexGrid;class _ImeHandler{constructor(e){this._updateImeFocusAsyncBnd=this._updateImeFocusAsync.bind(this);this._cmpstartBnd=this._compositionstart.bind(this);this._keypressBnd=this._keypress.bind(this);this._g=e;let t=wijmo_1.createElement('<textarea class="wj-grid-editor wj-form-control wj-grid-ime" aria-hidden="true"/>');wijmo_1.setCss(t,_ImeHandler._cssHidden);wijmo_1.disableAutoComplete(t);t.tabIndex=-1;this._tbx=t;this._maskProvider=new wijmo_1._MaskProvider(t);e._root.appendChild(t);this._updateImeFocus();let i=e.hostElement,l=e.addEventListener.bind(e),s=this._updateImeFocusAsyncBnd;l(i,"blur",s,!0);l(i,"focus",s,!0);l(t,"compositionstart",this._cmpstartBnd);wijmo_1.isiOS()&&l(i,"keypress",this._keypressBnd);e.selectionChanged.addHandler(s,this);e.cellEditEnded.addHandler(this._cellEditEnded,this);e.cellEditEnding.addHandler(this._cellEditEnding,this);l(i,"mousedown",t=>{wijmo_1.closest(wijmo_1.getActiveElement(),".wj-flexgrid")==e.hostElement&&e.hitTest(t).panel==e.cells&&wijmo_1.hasClass(e.hitTest(t).target,"wj-cell")&&(e.isReadOnly||t.preventDefault())});e.gotFocus.addHandler(()=>this._updateImeFocus())}dispose(){let e=this._g,t=e.hostElement,i=this._tbx,l=e.removeEventListener.bind(e),s=this._updateImeFocusAsyncBnd;l(t,"blur",s);l(t,"focus",s);l(t,"keypress",this._keypressBnd);l(i,"compositionstart",this._cmpstartBnd);e.selectionChanged.removeHandler(s);e.cellEditEnded.removeHandler(this._cellEditEnded);e.cellEditEnding.removeHandler(this._cellEditEnding);wijmo_1.removeChild(i)}_compositionstart(e){let t=this._g;if(!t.activeEditor){let i=t._selHdl.selection;if(t.startEditing(!1,i.row,i.col,!1,e)){if(t.activeEditor&&"checkbox"!=t.activeEditor.type){i=t.editRange;let e=t._getBindingColumn(t.cells,i.row,t.columns[i.col]),l=e&&e._edt,s=t.activeEditor,o=this._tbx,n=t.cells.hostElement,r=t.columns[i.col].pos+n.offsetLeft,a=t.rows[i.row].pos+n.offsetTop,h=t.getCellBoundingRect(i.row,i.col),d=t.cells.getCellElement(i.row,i.col);h.width=d.offsetWidth;h.height=d.offsetHeight;i.row<t.rows.frozen&&(a+=t._root.scrollTop);i.col<t.columns.frozen&&(r+=t._root.scrollLeft);let c=d.querySelector(".wj-btn.wj-right");c&&(h.width-=c.offsetWidth);"minLength,maxLength,pattern".split(",").forEach(e=>{wijmo_1.setAttribute(o,e,s.getAttribute(e))});let _=s instanceof HTMLTextAreaElement;wijmo_1.setAttribute(o,"wrap",_?"soft":"off");let u=getComputedStyle(d),g=u.paddingTop;if(i.rowSpan>1&&!_){let e=parseFloat(u.lineHeight);isNaN(e)&&(e=1.2*parseFloat(u.fontSize));g=Math.max(0,(h.height-e)/2)+"px"}let w={position:"absolute",left:r,top:a,width:h.width-1,height:h.height-1,paddingTop:g,paddingLeft:u.paddingLeft,paddingRight:u.paddingRight,textAlign:u.textAlign,zIndex:d.style.zIndex};if(t.rightToLeft){w.right=parseInt(d.style.right)+parseInt(t.cells.hostElement.style.right);w.left=""}wijmo_1.setCss(o,w);if(l){let e=l._tbx.getBoundingClientRect(),i=o.getBoundingClientRect(),s=window.getComputedStyle(o),n=parseFloat(s.left),r=parseFloat(s.right),a=parseFloat(s.top);t.rightToLeft?wijmo_1.setCss(o,{right:r+i.right-e.right+"px",top:a+e.top-i.top+"px",width:e.width+"px",height:e.height+"px"}):wijmo_1.setCss(o,{left:n+e.left-i.left+"px",top:a+e.top-i.top+"px",width:e.width+"px",height:e.height+"px"})}t._edtHdl._edt=o;o.select();let m=s.value;if(wijmo_1.isSafari()){" "!=o.value&&" "!=o.value||(o.value=m);wijmo_1.setSelectionRange(o,o.value.length)}else setTimeout(()=>{" "!=o.value&&" "!=o.value||(o.value=m);wijmo_1.setSelectionRange(o,o.value.length)},20);wijmo_1.Control.sharedState.InvalidScroll=wijmo_1.isEdge();o.placeholder=s.placeholder;s.placeholder="";s.value=""}}else{this._tbx.blur();setTimeout(()=>{this._tbx.focus();t._setFocusNoScroll(t.hostElement)},20)}}}_cellEditEnding(){let e=this._maskProvider;e&&e.mask&&e._valueChanged()}_cellEditEnded(){let e=this._tbx,t=this._g;if(this._enableIme()){let i=wijmo_1.getActiveElement();i.blur();if(t._isScrollingByWheel)setTimeout(()=>{i.focus();t._setFocusNoScroll(t.hostElement);e.value="";i.focus()},20);else{i.focus();t._setFocusNoScroll(t.hostElement);i.focus()}}e.value="";wijmo_1.setCss(e,_ImeHandler._cssHidden);this._updateImeFocus()}_keypress(e){if(!e.defaultPrevented&&e.target==this._tbx&&!(e.ctrlKey||e.altKey||e.metaKey||27==e.keyCode||this._g.activeEditor)){this._tbx.value="";this._compositionstart(e);e.stopPropagation()}}_updateImeFocus(){let e=this._g,t=this._tbx,i=wijmo_1.getActiveElement(),l=e._getTabIndex();if(e.activeEditor||wijmo_1.closest(i,".wj-flexgrid")!=e.hostElement)(e.isDisabled||l<0)&&t.tabIndex>=0&&(t.tabIndex=-1);else if(this._enableIme()&&!e._wantsInput(i)){if(i!=t){e.activeCell&&(e.activeCell.tabIndex=-1);t.tabIndex=l;t.disabled=!1;t.value="";if(!e.isTouching)if(window&&window.top!=window.self){wijmo_1.setSelectionRange(t,0,0,!1);e._setFocusNoScroll(t)}else{wijmo_1.setSelectionRange(t,0);t.focus()}}let s=e._selHdl.selection,o=s.isValid?e._getBindingColumn(e.cells,s.row,e.columns[s.col]):null;this._maskProvider.mask=o?o.mask:null}else{t.tabIndex=-1;t.disabled=!0;t.value="";if(i==t){t.blur();let i=e.activeCell;if(i){i.tabIndex=l;i.focus()}else e.focus()}}}_updateImeFocusAsync(){this._toFocus&&clearTimeout(this._toFocus);this._toFocus=setTimeout(()=>{this._toFocus=null;this._updateImeFocus()},100)}_resetTabIndex(){this._tbx.tabIndex=-1}_enableIme(){let e=this._g,t=e._selHdl.selection;if(!e.canEditCell(t.row,t.col))return!1;let i=t.isValid?e._getBindingColumn(e.cells,t.row,e.columns[t.col]):null;return!(!i||i.dataType==wijmo_1.DataType.Boolean)&&(!i||!i.dataMap||i.dataMapEditor!=DataMapEditor.RadioButtons)}}_ImeHandler._cssHidden={position:"fixed",width:"1px",left:-32e3,top:-32e3,overflow:"hidden"};exports._ImeHandler=_ImeHandler;class _AddNewHandler{constructor(e){this._nrt=new _NewRowTemplate;this._top=!1;this._keydownBnd=this._keydown.bind(this);this._committing=!1;this._pasting=!1;this._g=e;this._attach()}get newRowAtTop(){return this._top}set newRowAtTop(e){if(e!=this.newRowAtTop){this._top=wijmo_1.asBoolean(e);this.updateNewRowTemplate();let t=this._g;if(this._top&&t.selectionMode==SelectionMode.ListBox){t.rows.forEach((e,t)=>{e._setFlag(RowColFlags.Selected,0==t,!0)});t.select(0,t.selection.col)}}}updateNewRowTemplate(){let e=this._g,t=e.editableCollectionView,i=e.rows,l=this._nrt,s=t&&t.canAddNew&&e.allowAddNew&&!e.isReadOnly,o=i.indexOf(l),n=this._top?0:i.length-1,r=!1;if(!s&&o>-1){let t=e.selection;t.row==o&&e.select(t.row-1,t.col);i.removeAt(o)}else if(s){if(o<0)r=!0;else if(o!=n){i.removeAt(o);r=!0}r&&(this._top?i.insert(0,l):i.push(l));if(l){l._ubv=null;l._setFlag(RowColFlags.ParentCollapsed,!1);this._top&&e.selectionMode==SelectionMode.ListBox||l._setFlag(RowColFlags.Selected,!1)}}}_attach(){let e=this._g;if(e){e.pasting.addHandler(this._pastingData,this);e.pasted.addHandler(this._pastedData,this);e.loadedRows.addHandler(this.updateNewRowTemplate,this);e.hostElement.addEventListener("keydown",this._keydownBnd,!0)}}_detach(){let e=this._g;if(e){e.pasting.removeHandler(this._pastingData,this);e.pasted.removeHandler(this._pastedData,this);e.loadedRows.removeHandler(this.updateNewRowTemplate);e.hostElement.removeEventListener("keydown",this._keydownBnd,!0)}}_keydown(e){if(!e.defaultPrevented&&e.keyCode==wijmo_1.Key.Escape&&null==this._g.activeEditor&&this._top&&this._nrt.dataItem){this._nrt.dataItem=null;this._g.invalidate()}}_beginningEdit(e,t){if(!t.cancel){let i=e.rows[t.row];i instanceof _NewRowTemplate&&this._handleEditStarting(e,t,i)}}_pastingData(e,t){t.cancel||(this._pasting=!0)}_pastedData(e,t){this._pasting=!1}_rowEditStarting(e,t){if(this._pasting){let i=e.rows[t.row];i instanceof _NewRowTemplate&&this._handleEditStarting(e,t,i)}}_rowEditEnding(e,t){let i=e.editableCollectionView,l=this._nrt.dataItem;if(i&&this._top&&l&&!t.cancel){let e=i.currentAddItem;if(!(e&&e==l)){e=i.addNew();for(let t in l)e[t]=l[t]}}}_rowEditEnded(e,t){let i=e.editableCollectionView;if(i&&!this._committing)if(this._top){if(t.cancel)return;let l=this._nrt.dataItem;if(l){this._committing=!0;this._nrt.dataItem=null;let s=this._g.rows,o=i.items.indexOf(l)+1;o<s.length&&t._rng.setRange(o,-1);e.onRowAdded(t)?i.commitNew():i.cancelNew();this._committing=!1}let s=e.rows[t.row];setTimeout(()=>{s instanceof _NewRowTemplate&&e.select(0,e.columns.firstVisibleIndex);this.updateNewRowTemplate()},20)}else i.isAddingNew&&i.commitNew()}_handleEditStarting(e,t,i){let l=e.editableCollectionView;if(l&&l.canAddNew)if(this._top)if(null==this._nrt.dataItem){let e=null,t=l.sourceCollection,i=l.newItemCreator;e=wijmo_1.isFunction(i)?i():t&&t.length?new t[0].constructor:{};this._nrt.dataItem=e}else l.currentAddItem&&(e.onRowAdded(t)||l.cancelNew());else{let s=l.currentAddItem&&l.currentAddItem==i.dataItem?l.currentAddItem:l.addNew();l.moveCurrentTo(s);let o=this._nrt.isSelected;this.updateNewRowTemplate();o&&t.row>-1&&(e.rows[t.row].isSelected=!0);e.isUpdating||e.refresh(!0);e.onRowAdded(t)||l.cancelNew()}}}exports._AddNewHandler=_AddNewHandler;class _NewRowTemplate extends Row{}exports._NewRowTemplate=_NewRowTemplate;!function(e){e[e.None=0]="None";e[e.Cells=1]="Cells";e[e.ColumnHeaders=2]="ColumnHeaders";e[e.RowHeaders=4]="RowHeaders";e[e.AllHeaders=6]="AllHeaders";e[e.All=7]="All"}(AllowMerging=exports.AllowMerging||(exports.AllowMerging={}));class MergeManager{constructor(e){null!=e&&console.error('** WARNING: the "grid" parameter has been deprecated. Please remove it.')}getMergedRange(e,t,i,l=!0){let s=e.grid,o=e.cellType,n=e.columns,r=e.rows,a=r[t],h=n[i];if(a instanceof _NewRowTemplate)return null;if(!(a instanceof Row&&h instanceof Column))return null;if(e==s.columnHeaders){let l=s._getColumnGroup(t,i);if(l){let t=l._rng,s=e.columns;if(s.isFrozen(t.col)!=s.isFrozen(t.col2)){t=t.clone();s.isFrozen(i)?t.col2=s.frozen-1:t.col=s.frozen}return t}}if(s.showGroups&&!s.childItemsPath&&a instanceof GroupRow&&a.dataItem instanceof wijmo_1.CollectionViewGroup&&o==CellType.Cell){let e=new CellRange(t,i);if(h.aggregate==wijmo_1.Aggregate.None){for(;e.col>0&&n[e.col-1].aggregate==wijmo_1.Aggregate.None&&e.col!=n.frozen;)e.col--;for(;e.col2<n.length-1&&n[e.col2+1].aggregate==wijmo_1.Aggregate.None&&e.col2+1!=n.frozen;)e.col2++}for(;e.col<i&&!n[e.col].visible;)e.col++;return e.isSingleCell?null:e}let d=!1,c=AllowMerging,_=CellType;switch(s.allowMerging){case c.None:d=!0;break;case c.Cells:d=o!=_.Cell;break;case c.ColumnHeaders:d=o!=_.ColumnHeader&&o!=_.TopLeft;break;case c.RowHeaders:d=o!=_.RowHeader&&o!=_.TopLeft;break;case c.AllHeaders:d=o==_.Cell}if(d)return null;if(o==_.Cell){let e=s.editableCollectionView,t=e?e.currentAddItem:null;if(t&&a.dataItem==t)return null}if(n[i].allowMerging){let n=new CellRange(t,i),a=e._vrb,h=0,d=r.length-1;if(t>=r.frozen){if(l&&(o==CellType.Cell||o==CellType.RowHeader)&&s._vtRows<r.length&&a){h=a.topRow;d=a.bottomRow}}else r.length>r.frozen&&(d=r.frozen-1);for(let l=t-1;l>=h&&this._mergeCell(e,l,i,t,i);l--)n.row=l;for(let l=t+1;l<=d&&this._mergeCell(e,t,i,l,i);l++)n.row2=l;for(;n.row<t&&!r[n.row].visible;)n.row++;if(!n.isSingleCell)return n}if(r[t].allowMerging){let r=new CellRange(t,i),a=e._vrb,h=0,d=n.length-1;if(i>=n.frozen){if(l&&(o==CellType.Cell||o==CellType.ColumnHeader)&&s._vtCols<n.length&&a){h=a.leftCol;d=a.rightCol}}else d=n.frozen-1;for(let l=i-1;l>=h&&this._mergeCell(e,t,l,t,i);l--)r.col=l;for(let l=i+1;l<=d&&this._mergeCell(e,t,i,t,l);l++)r.col2=l;for(;r.col<i&&!n[r.col].visible;)r.col++;if(!r.isSingleCell)return r}return null}_mergeCell(e,t,i,l,s){let o=e.rows[t],n=e.rows[l];if(!o||!n)return!1;if(o instanceof GroupRow||o instanceof _NewRowTemplate||n instanceof GroupRow||n instanceof _NewRowTemplate)return!1;let r=e.grid.editableCollectionView,a=r?r.currentAddItem:null;if(a&&(o.dataItem==a||n.dataItem==a))return!1;if(t!=l&&e.rows.isFrozen(t)!=e.rows.isFrozen(l))return!1;if(i!=s&&e.columns.isFrozen(i)!=e.columns.isFrozen(s))return!1;if(t!=l){if(i>0&&(o.allowMerging&&this._mergeCell(e,t,i-1,t,i)||n.allowMerging&&this._mergeCell(e,l,i-1,l,i)))return!1;if(s<e.columns.length-1&&(o.allowMerging&&this._mergeCell(e,t,s,t,s+1)||n.allowMerging&&this._mergeCell(e,l,s,l,s+1)))return!1}return e.getCellData(t,i,!0)==e.getCellData(l,s,!0)}}exports.MergeManager=MergeManager;class HitTestInfo{constructor(e,t){this._row=-1;this._col=-1;this._edge=0;this._clickChildGrid=!1;let i;if(t instanceof Element){if(wijmo_1.closest(t,".wj-flexgrid")!=e.hostElement)return;e=t;this._target=t}if(e instanceof Element&&!(e instanceof FlexGrid)){let t=wijmo_1.closest(e,".wj-cell"),i=t?t[GridPanel._INDEX_KEY]:null;if(i){this._target=e;this._row=i.row;this._col=i.col;this._rng=i.rng;this._p=i.panel;this._g=i.panel.grid}return}if(e instanceof FlexGrid){this._target=e.hostElement;i=this._g=e}else{if(!(e instanceof GridPanel))throw"First parameter should be a FlexGrid or GridPanel.";this._target=e.hostElement;this._p=e;i=this._g=this._p.grid}if(t instanceof MouseEvent){this._target=t.target;let l=wijmo_1.closest(this._target,".wj-flexgrid");"mousedown"==t.type&&null!=l&&e instanceof FlexGrid&&l!=e.hostElement&&(this._clickChildGrid=!0);"mousedown"==t.type&&(i._rcBounds=null)}t=wijmo_1.mouseToPage(t);this._pt=t.clone();let l=i.controlRect,s=i._szClient,o=i.topLeftCells,n=i._eTL,r=i.headersVisibility,a=HeadersVisibility,h=r&a.Row?o.columns.getTotalSize():0,d=r&a.Column?o.rows.getTotalSize():0,c=r&a.Column?d+n.offsetTop:0,_=i._eBL,u=_.offsetHeight;const g=getComputedStyle(i.hostElement),w=g&&g.borderLeftWidth?parseFloat(g.borderLeftWidth):0,m=g&&g.borderTopWidth?parseFloat(g.borderTopWidth):0;t.x-=l.left-w;t.y-=l.top-m;i.rightToLeft&&(t.x=l.width-t.x);this._p||t.x>=0&&t.y>=n.offsetTop&&s&&t.x<=s.width+h&&t.y<=s.height+d&&(t.y<c?this._p=t.x<h?i.topLeftCells:i.columnHeaders:t.y<_.offsetTop?this._p=t.x<h?i.rowHeaders:i.cells:this._p=t.x<h?i.bottomLeftCells:i.columnFooters);if(null!=this._p){let e=this._p.rows,l=this._p.columns,s=this._p.cellType,o=CellType,n=this._p._getFrozenPos(),r=s==o.TopLeft||s==o.ColumnHeader?d:s==o.BottomLeft||s==o.ColumnFooter?u:e.getTotalSize(),a=s==o.TopLeft||s==o.BottomLeft||s==o.RowHeader?h:l.getTotalSize();if(s==o.RowHeader||s==o.Cell){t.y-=d;if(t.y>n.y||n.y<=0){t.y-=i._ptScrl.y;t.y+=this._p._getOffsetY()}}else s!=o.BottomLeft&&s!=o.ColumnFooter||(t.y-=_.offsetTop);if(s==o.ColumnHeader||s==o.Cell||s==o.ColumnFooter){t.x-=h;(t.x>n.x||n.x<=0)&&(t.x-=i._ptScrl.x)}s!=o.ColumnHeader&&s!=o.TopLeft||(t.y-=c-d);this._edge=0;let g=HitTestInfo._SZEDGE[this._g.isTouching?1:0];if(this._g.isTouching){g=HitTestInfo._SZEDGE[1];t.x-=g/2}this._row=t.y>r?-1:e.getItemAt(t.y);this._col=t.x>a?-1:l.getItemAt(t.x);if(this._row<0||this._col<0){this._p=null;return}if(this._col>-1){let e=l[this._col];t.x-e.pos<=g&&(this._edge|=1);let i=e.pos+e.renderSize-t.x;if(i<=g){this._edge|=4;i<=g/2&&(this._edge|=16)}}if(this._row>-1){let i=e[this._row];t.y-i.pos<=g&&(this._edge|=2);let l=i.pos+i.renderSize-t.y;if(l<=g){this._edge|=8;l<=g/2&&(this._edge|=32)}}}}get point(){return this._pt}get cellType(){return this._p?this._p.cellType:CellType.None}get panel(){return this._p}get grid(){return this._p?this._p.grid:null}get row(){return this._row}getRow(){return this._p&&this._row>-1?this._p.rows[this._row]:null}get col(){return this._col}getColumn(e){let t=this._p,i=t&&this._col>-1?t.columns[this._col]:null;if(i&&e){let e=t.grid;i=t.cellType===CellType.ColumnHeader&&e._hasColumnGroups()?e._getColumnGroup(this._row,this._col):e._getBindingColumn(t,this._row,i)}return i}get range(){this._rng||(this._rng=new CellRange(this._row,this._col));return this._rng}get edgeLeft(){return 0!=(1&this._edge)}get edgeTop(){return 0!=(2&this._edge)}get edgeRight(){return 0!=(4&this._edge)}get edgeFarRight(){return 0!=(16&this._edge)}get edgeBottom(){return 0!=(8&this._edge)}get edgeFarBottom(){return 0!=(32&this._edge)}get target(){return this._target}}HitTestInfo._SZEDGE=[6,30];exports.HitTestInfo=HitTestInfo;function softInput(){return wijmo_1._getModule("wijmo.input")}exports.softInput=softInput;const _MASK_PROVIDER="$WJ-MSKP";class CellFactory{updateCell(e,t,i,l,s,o){let n=e.grid,r=n.rightToLeft,a=e.rows,h=e.columns,d=a[t],c=h[i],_=t,u=i,g=d instanceof GroupRow?d:null,w=d instanceof _NewRowTemplate?d:null,m=c.renderWidth,p=d.renderHeight,f=e.cellType,C="wj-cell",R="",E={display:""},y=CellType;0!=o&&l.firstElementChild&&(1==l.childNodes.length&&"checkbox"==l.firstElementChild.type||(l.textContent=""));if(s&&!s.isSingleCell){t=s.row;i=s.col;_=s.row2;u=s.col2;d=a[t];c=h[i];g=d instanceof GroupRow?d:null;let l=s.getRenderSize(e);p=l.height;m=l.width}let v,S,b,j,x,H,T=n._getBindingColumn(e,t,c),M=T?T.dataType:d?d.dataType:void 0;b=f==y.RowHeader||f==y.Cell&&(!g||n.childItemsPath);H=T&&T.isContentHtml||d&&d.isContentHtml;v=T.dataMap||d.dataMap,S=f==y.Cell?n._getMapEditor(d,T):null;j=b&&S==DataMapEditor.RadioButtons;x=M==wijmo_1.DataType.Boolean&&!v;let z=c.pos,I=d.pos,A=n._ptScrl;if(n._useFrozenDiv()&&f==y.Cell&&!n.editRange)i<h.frozen&&_>=a.frozen?I+=A.y:t<a.frozen&&u>=h.frozen&&(z+=A.x);else{let e=n._szClient;if(_<a.frozen){I=Math.min(I,e.height);p=Math.min(p,Math.max(0,e.height-I));I-=A.y}if(u<h.frozen){let t=0!=e.width?e.width:n._preWidth();z=Math.min(z,t);m=Math.min(m,Math.max(0,t-z));z-=A.x}}r?E.right=z+"px":E.left=z+"px";_>=a.frozen&&(I-=e._getOffsetY());E.top=I+"px";E.width=m+"px";E.height=p+"px";E.zIndex=0;i<h.frozen&&(E.zIndex+=1);t<a.frozen&&(E.zIndex+=2);let D=!1,L=n.alternatingRowStep;if(L&&(!s||s.row==s.row2)){D=d.visibleIndex%(L+1)==0;1==L&&(D=!D)}if(f==y.Cell){g&&(C+=" wj-group");D&&(C+=" wj-alt");(t<a.frozen||i<h.frozen)&&(C+=" wj-frozen");w&&(C+=" wj-new");d&&d.cssClass&&(C+=" "+d.cssClass);T&&T.cssClass&&(C+=" "+T.cssClass)}else{C+=" wj-header";D&&(C+=" wj-header-alt");d&&d.cssClass&&f==y.ColumnHeader&&(C+=" "+d.cssClass);T&&T.cssClass&&f==y.RowHeader&&(C+=" "+T.cssClass);let t=!1;f!=y.ColumnHeader&&f!=y.TopLeft||n.allowResizing&AllowResizing.Columns&&(t=null!=n._mouseHdl._getResizeCol(e,u));t||f!=y.RowHeader||n.allowResizing&AllowResizing.Rows&&(t=null!=n._mouseHdl._getResizeRow(e,_));t&&(C+=" wj-big-header")}d&&d.cssClassAll&&(C+=" "+d.cssClassAll);T&&T.cssClassAll&&(C+=" "+T.cssClassAll);let F=SelectedState,P=e.getSelectedState(t,i,s);P!=F.None&&f==y.Cell&&!x&&n.editRange&&n.editRange.contains(t,i)&&(P=F.None);switch(P){case F.Active:C+=" wj-state-active";break;case F.Cursor:C+=" wj-state-selected wj-state-active";break;case F.Selected:C+=" wj-state-multi-selected"}if(_<=a._lastFrozen){C+=" wj-frozen-row";_===a._lastFrozen&&(C+=" wj-last-frozen-row")}u==h._lastFrozen&&(C+=" wj-frozen-col");(T&&T.wordWrap||d&&d.wordWrap)&&(C+=" wj-wrap");(T&&T.multiLine||d&&d.multiLine)&&(C+=" wj-multiline");let k=T?T.getAlignment(d):void 0;k&&(R=" wj-align-"+k);let N=f,B=n._isTransposed(),G=(N==y.ColumnHeader&&!B||N==y.RowHeader&&B)&&n._hasColumnGroups()?n._getColumnGroup(t,i):null;G&&G.align&&(R=" wj-align-"+G.align);E.paddingLeft=E.paddingRight=E.paddingTop=E.paddingBottom="";if(f==y.Cell&&n.rows.maxGroupLevel>-1&&i==h.firstVisibleIndex&&n.treeIndent){let e=g?Math.max(0,g.level):a.maxGroupLevel+1,t=Math.min(n.treeIndent*e+n._cellPadLeft,m-n._cellPadHorz)+"px";r?E.paddingRight=t:E.paddingLeft=t}m<=n._cellPadHorz&&null==l.getAttribute(FlexGrid._WJS_MEASURE)&&(E.paddingLeft=E.paddingRight=0);let V=f==y.Cell&&i==h.firstVisibleIndex&&g&&g.hasChildren&&!_isEditingCell(n,t,i);V&&(R="");if(0!=o&&T){let s=e.getCellData(t,i,!1),o=e.getCellData(t,i,!0);if(V){let e=_getTreeBtn(g,l);o=g.getGroupHeader()||wijmo_1.escapeHtml(o);l.innerHTML=e.outerHTML+" "+o}else if(f!=y.ColumnHeader||_!=n._getSortRowIndex()&&T==c)if(f==y.RowHeader&&!o&&(()=>{let e=!1;if(i==n._getEditColumnIndex()){let t=n.editableCollectionView,i=t?t.currentEditItem:null;o=l.innerHTML=i&&d.dataItem==i?_getGlyph("pencil"):d instanceof _NewRowTemplate?_getGlyph("asterisk"):"";e=!0}let t=T._tpl;if(t){_renderTemplate(t,l,s,o,d,T);e=!0}return e})());else if(f!=y.Cell||M!=wijmo_1.DataType.Boolean||v||g&&!wijmo_1.isBoolean(s))if(f==y.Cell&&!j&&_isEditingCell(n,t,i)){let s=T.inputType||d.inputType;s||(s=M!=wijmo_1.DataType.Number||v?"text":"tel");if(!v&&!T.mask&&!d.mask){let l=e.getCellData(t,i,!1);wijmo_1.isNumber(l)&&(o=_getEditString(l,T.format||d.format))}l.innerHTML=(T.multiLine||d.multiLine)&&"checkbox"!=s?'<textarea wrap="soft"></textarea>':'<input type="'+s+'"/>';let r=l.children[0];wijmo_1.addClass(r,"wj-grid-editor wj-form-control");wijmo_1.disableAutoComplete(r);H&&v&&!v.isEditable&&(o=wijmo_1.toPlainText(o));r.value=o;r.tabIndex=-1;r.required=T.getIsRequired(d);wijmo_1.setAttribute(r,"aria-required",r.required);let a=T.maxLength||d.maxLength;a&&(r.maxLength=a);r.style.textAlign=T.getAlignment(d);let h=T.mask||d.mask;h&&(r[_MASK_PROVIDER]=new wijmo_1._MaskProvider(r,h));n.showPlaceholders&&(r.placeholder=T.header);(wijmo_1.isSafari()||wijmo_1.Control.sharedState.InvalidScroll)&&n._edtHdl&&n._edtHdl._edt&&(r.value=n._edtHdl._edt.value);n._edtHdl._edt=r}else{if(j){let s=[],o=e.getCellData(t,i,!1);v.getDisplayValues(d.dataItem).forEach(e=>{let t=v.getKeyValue(e)==o?" checked":"",i=n.isReadOnly||d.isReadOnly||c.isReadOnly?" disabled":"",l=wijmo_1.escapeHtml(e);s.push('<label><input type="radio" tabindex="-1"'+t+i+' value="'+l+'"><span>'+l+"</span></label>")});l.innerHTML=s.join(" ");C+=" "+CellFactory._WJC_RADIOMAP}let r=b?T._tpl:null;r?_renderTemplate(r,l,s,o,d,T):j||(f==y.Cell&&H?l.innerHTML=o:l.textContent=o||"");if(G&&G.collapseTo){let e=G._rng;if(e&&(f==y.ColumnHeader&&e.columnSpan>1||f==y.RowHeader&&e.rowSpan>1)){let e=G.isCollapsed;l.innerHTML='<div role="button" class="'+CellFactory._WJC_COLLAPSE+'">'+_getGlyph(e?"plus":"minus")+"</div>&nbsp;"+l.innerHTML;e&&wijmo_1.addClass(l,"wj-state-collapsed")}}}else{let e=l.firstChild;if(!n._isNativeCheckbox(e)){l.innerHTML='<label><input type="checkbox" class="'+CellFactory._WJC_CHECKBOX+'" tabindex="-1"/><span></span></label>';e=l.querySelector("input")}wijmo_1.setChecked(e,s);e.disabled=!n.canEditCell(t,i);e.disabled&&(e.style.cursor="default");n.editRange&&n.editRange.contains(t,i)&&(n._edtHdl._edt=e)}else{l.innerHTML=wijmo_1.escapeHtml(o);let e=T.currentSort;if(e&&n.showSort){C+=" wj-sort-"+("+"==e?"asc":"desc");l.innerHTML+="&nbsp;"+_getSortGlyph(T)}n.allowPinning&&wijmo_1.contains(n.hostElement,l)&&_addPinButton(l,i<n.columns.frozen)}if(S==DataMapEditor.DropDownList&&n.showDropDown&&n.canEditCell(t,i)&&softInput()){let e=_getDropDownBtn();l.insertBefore(e,l.firstChild);_isEditingCell(n,t,i)&&(C+=" wj-hasdropdown")}}if(f==y.RowHeader||f==y.ColumnHeader){let e=f==y.RowHeader?!g&&!w&&d.allowDragging&&0!=(n.allowDragging&AllowDragging.Rows):(G||c).allowDragging&&0!=(n.allowDragging&AllowDragging.Columns);wijmo_1.setAttribute(l,"draggable",e?"true":null)}if([y.ColumnHeader,y.RowHeader].includes(f)&&[HeadersFocusability.All,HeadersFocusability.Column].includes(n.headersFocusability)){exports.colHdrAriaAttributes(l,c,e,n,y.RowHeader===f);wijmo_1.setAttribute(e.hostElement.parentElement,"aria-hidden",!1)}C+=R;l.className!=C&&(l.className=C);let O=l.style;for(let e in E)O[e]!==E[e]&&(O[e]=E[e]);if(n._edtHdl._edt&&n._edtHdl._edt.parentElement==l){let e=n._root,t=e.getBoundingClientRect(),i=l.getBoundingClientRect(),s=t.top+e.clientHeight-i.top,o=t.left+e.clientWidth-i.left;i.height>s&&(l.style.height=s+"px");i.width>o&&(l.style.width=o+"px")}if((f==y.Cell||f==y.RowHeader)&&n._getShowErrors()){let s=n._getError(e,t,i,!1);n._edtHdl._setCellError(l,s)}n.itemFormatter&&n.itemFormatter(e,t,i,l);if(n.formatItem.hasHandlers){let s=CellFactory._fmtItemArgs;if(s){s._p=e;s._rng.setRange(t,i,_,u);s._cell=l}else s=CellFactory._fmtItemArgs=new FormatItemEventArgs(e,new CellRange(t,i,_,u),l);s._updateContent=!1!==o;n.onFormatItem(s)}}disposeCell(e){}getEditorValue(e){let t=e._edtHdl._edt;if(t instanceof HTMLInputElement)switch(t.type){case"checkbox":return t.checked;case"radio":return t.value}if(t instanceof HTMLInputElement||t instanceof HTMLTextAreaElement){let e=t[_MASK_PROVIDER],i=e?e._applyMask():t.value,l=t.maxLength;if(wijmo_1.isNumber(l)&&l>-1&&i.length>l){let e=wijmo_1.culture.Globalize.numberFormat["%"]||"%",t=i.length&&i[i.length-1]==e;i=i.substr(0,l);t&&i.indexOf(e)<0&&(i+=e)}return i}return null}}CellFactory._WJC_RADIOMAP="wj-radio-map";CellFactory._WJC_CHECKBOX="wj-cell-check";CellFactory._WJC_COLLAPSE="wj-elem-collapse";CellFactory._WJC_DROPDOWN="wj-elem-dropdown";CellFactory._WJC_PIN="wj-elem-pin";CellFactory._tplDdBtn=_getButton(CellFactory._WJC_DROPDOWN,"down");CellFactory._tplCtx={row:null,col:null,value:null,text:null,item:null};exports.CellFactory=CellFactory;function _renderTemplate(e,t,i,l,s,o){let n=CellFactory._tplCtx;n.value=i;n.text=l;n.item=s.dataItem;n.row=s;n.col=o;let r=wijmo_1.isString(e)?wijmo_1.evalTemplate(e,n):e(n,t);null!=r&&(t.innerHTML=r)}function _getEditString(e,t){t=t||"n";let i=wijmo_1.Globalize._parseNumericFormat(t);switch(i.spec){case"d":case"x":break;case"e":t=t.replace(/[0-9]/g,"");break;default:t="p"==i.spec?"P15":"r";i.scale&&(t+=Array(i.scale/3+1).join(","))}return wijmo_1.Globalize.formatNumber(e,t,!0)}function _isEditingCell(e,t,i){return e.editRange&&e.editRange.contains(t,i)}function _getDropDownBtn(){let e=CellFactory._ddBtn;if(!e){e=CellFactory._ddBtn=wijmo_1.createElement(CellFactory._tplDdBtn);wijmo_1.setAriaLabel(e,wijmo_1.culture.FlexGrid.ariaLabels.toggleDropDown);wijmo_1.setAttribute(e,"aria-expanded",!1)}return e.cloneNode(!0)}function _addPinButton(e,t){let i=_getButton(CellFactory._WJC_PIN,"pin"),l=wijmo_1.createElement(i);wijmo_1.toggleClass(l,"wj-state-pinned",t);wijmo_1.setAttribute(l,"aria-pressed",t);e.insertBefore(l,e.firstChild)}function _getSortGlyph(e){let t=_getGlyph("+"==e.currentSort?"up":"down"),i=e.grid.collectionView;if(i&&i.sortDescriptions.length>1){let i=e.currentSortIndex;i>-1&&(t+='<span class="wj-sort-index">'+(i+1)+"</span>")}return t}function _getTreeBtn(e,t){let i=CellFactory._WJC_COLLAPSE,l=(e.isCollapsed?"":"down-")+(e.grid.rightToLeft?"left":"right"),s=wijmo_1.createElement('<button class="wj-btn wj-btn-glyph '+i+'" type="button" tabindex="-1">'+_getGlyph(l)+"</button>");wijmo_1.setAriaLabel(s,wijmo_1.culture.FlexGrid.ariaLabels.toggleGroup);wijmo_1.setAttribute(s,"aria-expanded",!e.isCollapsed);wijmo_1.setAttribute(t,"aria-expanded",!e.isCollapsed);return s}function _getGlyph(e){return'<span class="wj-glyph-'+e+'"></span>'}function _getButton(e,t){return'<button class="wj-btn wj-btn-glyph wj-right {cls}" type="button" tabindex="-1">{glyph}</button>'.replace("{cls}",e).replace("{glyph}",_getGlyph(t))}const _LB_PAGE_SIZE=4;class _EditHandler{constructor(e){this._rng=null;this._edt=null;this._edItem=null;this._edtCanceled=!1;this._list=null;this._mapSearch=null;this._fullEdit=!1;this._evtInput=null;this._evtChange=null;this._cstEdtValue=null;this._validating=!1;this._composing=!1;this._g=e;this._evtInput=document.createEvent("HTMLEvents");this._evtInput.initEvent("input",!0,!1);this._evtChange=document.createEvent("HTMLEvents");this._evtChange.initEvent("change",!0,!1);e.selectionChanging.addHandler((e,t)=>this._selectionChanging(t));e.lostFocus.addHandler(()=>{let e=wijmo_1.getActiveElement();e&&"fixed"==getComputedStyle(e).position?this.finishEditing():this._commitRowEdits()});let t=e.hostElement;e.addEventListener(t,"mousedown",t=>{if(t.defaultPrevented||0!=t.button)return;if(e._mouseHdl._szRowCol)return;let i=e.hitTest(t);i.cellType!=CellType.Cell&&i.cellType!=CellType.None&&(this.finishEditing()||this.finishEditing(!0))},!0);e.addEventListener(t,"compositionend",()=>{this._composing=!1;this._keypress.bind(this)});e.addEventListener(t,"compositionstart",t=>{let i=this._getCustomEditor(e);var l=null!=t?wijmo_1.closest(t.target,".wj-flexgrid"):null,s=wijmo_1.Control.getControl(l);let o=s&&s._edtHdl?null!=s._edtHdl.activeEditor:null!=this.activeEditor;if(!i||o||e.imeEnabled)this._composing=!0;else{let e=window.getSelection(),t=e.rangeCount>0?e.getRangeAt(0):null,i=document.activeElement;if(null!=i){i.blur();window.getSelection().removeAllRanges();setTimeout(()=>{null!=t&&window.getSelection().addRange(t);i.focus()},20)}}})}startEditing(e=!0,t,i,l,s){let o=this._g,n=o._selHdl.selection;t=wijmo_1.asNumber(t,!0,!0);i=wijmo_1.isString(i)?o.columns.indexOf(i):wijmo_1.asNumber(i,!0,!0);null==t&&(t=n.row);null==i&&(i=n.col);null==l&&(l=!0);if(!this._allowEdit(t,i))return!1;let r=o.getMergedRange(o.cells,t,i,!1);r||(r=new CellRange(t,i));let a=o.rows[t].dataItem;o.scrollIntoView(r.row,r.col,!0);if(!o.select(r,!0))return!1;if(!o.rows[t]||a!=o.rows[t].dataItem)return!1;if(this.activeEditor){if(r.equals(this._rng))return!0;if(!this.finishEditing())return!1}let h=new CellRangeEventArgs(o.cells,r,s);if(!o.onBeginningEdit(h))return!1;let d=o.editableCollectionView,c=!1;if(d){(c=(a=o.rows[t].dataItem)!=d.currentEditItem)&&o.onRowEditStarting(h);d.editItem(a);if(c){o.onRowEditStarted(h);this._edItem=a}}let _=o.rows[t],u=o._getBindingColumn(o.cells,t,o.columns[i]),g=u.dataMap||_.dataMap,w=DataMapEditor.RadioButtons,m=_.dataMap&&_.dataMapEditor==w||u.dataMap&&u.dataMapEditor==w;this._fullEdit=wijmo_1.asBoolean(e);this._rng=r;this._list=null;if(g&&!m&&!u.editor){let e=g.getDisplayValues(a);(u.isContentHtml||_.isContentHtml)&&(e=e.map(e=>wijmo_1.toPlainText(e)));this._list=e;this._mapSearch=g.search}if(m){let e=o._activeCell||o.hostElement.querySelector(".wj-cell.wj-state-active");if(e){let i=s?s.target:null;i instanceof HTMLSpanElement&&(i=wijmo_1.closest(i,"label"));i instanceof HTMLLabelElement&&(i=i.querySelector("input"));if(i instanceof HTMLInputElement)this._edt=i;else{var p=e.querySelectorAll("input[checked]");p.length>0?this._edt=p[0]:this._edt=e.querySelector("input")}this._updateRowHeaderCell(t)}}else r.isSingleCell?this._updateEditorCell(t,i,c):o.refresh(!1);let f=this._edt;if(f){if("checkbox"==f.type||"radio"==f.type)this._fullEdit=!1;else if(l){let e=0,l=f.value.length,n=!1,r=wijmo_1.culture.Globalize.numberFormat["%"]||"%",a=o.getCellData(t,i,!1);wijmo_1.isNumber(a)?n=f.value.indexOf(r)>-1:null==a&&(n=/^p/i.test(u.format))&&f.value.indexOf(r)<0&&(f.value+=r);if(n){let t=f.value;e=0;l=t.length;for(;l>0&&(t[l-1]==r||" "==t[l-1]);)l--;for(;e<l&&t[e]==r;)e++}s&&"keydown"==s.type&&s.keyCode==wijmo_1.Key.Space&&(e=l);this._setSelectionRange(f,e,l,!0,wijmo_1.isEdge());wijmo_1.isIE()&&"right"==f.style.textAlign&&(f.style.paddingRight="1px")}o.onPrepareCellForEdit(h)}l&&!o.containsFocus()&&o.focus();return null!=f&&!f.disabled&&!f.readOnly}finishEditing(e){let t=this._edt;if(!t){this._removeListBox();return!0}let i=this._g,l=this._rng,s=new CellEditEndingEventArgs(i.cells,l),o=i.containsFocus();if(!e){let e=i.hostElement.querySelector(".wj-control.wj-state-focused");if(e){let t=wijmo_1.Control.getControl(e);t&&(t.containsFocus()||t._focus)&&t.onLostFocus(s)}}s.cancel=e;if(!e&&i.validateEdits){let e=this._getValidationError();if(e){s.cancel=!0;let t=i.cells.getCellElement(l.row,l.col);if(t){this._setCellError(t,e);s.stayInEditMode=!0}}}this._cstEdtValue=null;s.data=i.cells.getCellData(l.topRow,l.leftCol,!1);if(!i.onCellEditEnding(s)&&s.stayInEditMode){o?setTimeout(()=>{t.select()}):t.select();this._fullEdit=!0;return!1}if(!s.cancel){let e=null,o=!1;if(null!=this._lbx_SelectedValue){e=this._lbx_SelectedValue;o=!0}else{let t=this._cstEdtValue;e=t&&!wijmo_1.isUndefined(t.value)?t.value:this._lbx_SelectedValue?this._lbx_SelectedValue:i.cellFactory.getEditorValue(i);o=null!=this._lbx_SelectedValue}for(let t=l.topRow;t<=l.bottomRow&&t<i.rows.length;t++)for(let n=l.leftCol;n<=l.rightCol&&n<i.columns.length;n++){let r=i._getBindingColumn(i.cells,t,i.columns[n]),a=i.rows[t],h=r&&r.dataMap||a&&a.dataMap,d=!h||h.serializeKeys;if((o||!h||!this.isEqualValue(h.getDisplayValue(s.data),e))&&(!i.cells.setCellData(t,n,e,d,!1,o)&&i.validateEdits)){let e=this._getValidationError(!0);if(e){s.cancel=!0;let t=i.cells.getCellElement(l.row,l.col);if(t){this._setCellError(t,e);s.stayInEditMode=!0}return!1}}}t.value==this._edtValue&&t.dispatchEvent(this._evtChange)}this._edt=null;this._rng=null;this._list=null;this._edtValue=null;this._edtCanceled=s.cancel;this._removeListBox();this._lbx_SelectedValue=null;let n=wijmo_1.closest(t,".wj-cell");if(wijmo_1.contains(n,wijmo_1.getActiveElement())){i._setFocusNoScroll(n);i._isScrollingByWheel=!1}!s.cancel&&s.refresh&&i._refreshOnEdit?i.refresh(!1):this._updateEditorCell(l.row,l.col,!1);o&&i.focus();i.onCellEditEnded(s);return!0}_setSelectionRange(e,t,i,l=!0,s=!1){if(!s)return wijmo_1.setSelectionRange(e,t,i,l);if(wijmo_1.contains(document.body,e)&&!e.disabled&&e.offsetHeight){try{e.setSelectionRange(t,i,"backward")}catch(e){}if(l)try{this._g._setFocusNoScroll(e);return!0}catch(e){}}return!1}_setCustomEditorValue(e){this._cstEdtValue={value:e}}_getCustomEditor(e){let t=null,i=e.selection;if(null!=i){let l=e._getBindingColumn(e.cells,i.row,e.columns[i.col]);t=l&&l._edt}return t}_setCellError(e,t){let i=this._g;""==t&&(t=null);wijmo_1.toggleClass(e,"wj-state-invalid",null!=t);let l=i.errorTip,s=i.activeEditor;if(l){l.setTooltip(e,t);s&&wijmo_1.contains(e,s)&&wijmo_1.setAttribute(s,"title","")}else wijmo_1.setAttribute(e,"title",t);s&&e==i.activeCell&&!wijmo_1.contains(e,s)&&l&&l.setTooltip(s,t)}get activeEditor(){return this._edt}get editRange(){return this._rng}getClipString(e,t,i,l){let s,o=this._g,n=o.selectionMode,r=[],a=0!=(t&ClipStringOptions.CSV),h=a?"\r\n":"\n",d=a?",":"\t",c=0!=(t&ClipStringOptions.InvisibleRows),_=SelectionMode,u=null!=e;if(!e&&n!=_.ListBox){let e=o.rows;for(let t=0;t<e.length;t++)if(e[t].isSelected){n=_.ListBox;break}}if(!e){o._selHdl._expandSelection();e=o.selection;switch(n){case _.Row:case _.RowRange:case _.ListBox:e.col=0;e.col2=o.columns.length-1;break;case _.MultiRange:let s=o.selectedRanges;if(s.length>1){let e=this._sameCols(s),o=this._sameRows(s);if(e||o){(s=s.slice()).sort((e,t)=>{let i=e.topRow-t.topRow;return i||e.leftCol-t.leftCol});for(let e=0;e<s.length;e++){let t=s[e];for(let i=e+1;i<s.length;i++)if(t.contains(s[i])){s.splice(i,1);i--}}if(e){let e=[];s.forEach(s=>{e.push(this.getClipString(s,t,i,l));i=!1});return e.join(h)}if(o){let e;s.forEach(s=>{let o=this.getClipString(s,t,i,l).split(h);if(null==e){e=o;l=!1}else o.forEach((t,i)=>{e[i]+=d+t})});return e.join(h)}}}}}const g=e.col>-1&&e.col2>-1;i&&g&&(s=o.columnHeaders).rows.forEach((i,o)=>{if(c||i.isVisible){let i=this._getRowClipString(s,o,e,t,l);r.push(i)}});if(e.row>-1&&e.row2>-1){s=o.cells;if(n!=_.ListBox||u){wijmo_1.assert(e.bottomRow<s.rows.length,"Row index must be less than the number of rows.");for(let i=e.topRow;i<=e.bottomRow;i++)if(c||s.rows[i].isVisible){let o=this._getRowClipString(s,i,e,t,l);r.push(o)}}else s.rows.forEach((i,o)=>{if(i.isSelected&&(c||i.isVisible)){let i=this._getRowClipString(s,o,e,t,l);r.push(i)}})}return r.join(h)}_getRowClipString(e,t,i,l,s){let o=[],n=e.rows[t],r=ClipStringOptions,a=0!=(l&r.CSV),h=0!=(l&r.InvisibleColumns),d=0==(l&r.Unformatted),c=0!=(l&r.SkipMerged);if(n.isVisible){if(s){let i=e.cellType==CellType.ColumnHeader?e.grid.topLeftCells:e.grid.rowHeaders;for(let s=0;s<i.columns.length;s++)if(h||i.columns[s].isVisible){let n=i.getCellData(t,s,!0);c&&this._skipMergedCell(e,null,t,s)&&(n="");o.push(this._getCellClipString(n,l))}}if(i.col>-1&&i.col2>-1){wijmo_1.assert(i.rightCol<e.columns.length,"Column index must be less than the number of columns.");for(let s=i.leftCol;s<=i.rightCol;s++)if(h||e.columns[s].isVisible){let i=e.getCellData(t,s,d);!i&&n instanceof GroupRow&&s==e.columns.firstVisibleIndex&&(i=wijmo_1.toPlainText(n.getGroupHeader()));c&&this._skipMergedCell(e,null,t,s)&&(i="");o.push(this._getCellClipString(i,l))}}}return o.join(a?",":"\t")}_skipMergedCell(e,t,i,l){let s=e.grid.getMergedRange(e,i,l,!1);if(s){if(t){s.row=Math.max(t.topRow,s.row);s.col=Math.max(t.leftCol,s.col)}if(s.row!=i||s.col!=l)return!0}return!1}_getCellClipString(e,t){wijmo_1.isString(e)||(e=wijmo_1.isDate(e)?e.toJSON():null!=e?e.toString():"");e=e.replace(/\t/g," ");let i=0!=(t&ClipStringOptions.QuoteAll);(i=i||/\n|^"|"$/.test(e))||0==(t&ClipStringOptions.CSV)||(i=e.indexOf(",")>-1);i&&(e='"'+(e=e.replace(/"/g,'""'))+'"');return e}_sameRows(e){let t=e[0];for(let i=1;i<e.length;i++)if(e[i].topRow!=t.topRow||e[i].bottomRow!=t.bottomRow)return!1;return!0}_sameCols(e){let t=e[0];for(let i=1;i<e.length;i++)if(e[i].leftCol!=t.leftCol||e[i].rightCol!=t.rightCol)return!1;return!0}setClipString(e,t){let i=this._g,l=i.editableCollectionView,s=null==t,o=SelectionMode;if(s){i._selHdl._expandSelection();t=i.selection;switch(i.selectionMode){case o.Row:case o.RowRange:case o.ListBox:t.col=0;t.col2=i.columns.length-1;break;case o.MultiRange:let s=i.selectedRanges;if(s.length>1){l&&l.beginUpdate();s.forEach(t=>{i.setClipString(e,t)});l&&l.endUpdate();i.selectedRanges=s;return}}}t=wijmo_1.asType(t,CellRange);let n=this._parseClipString(wijmo_1.asString(e));!s&&n.length>t.rowSpan&&(n=n.slice(0,t.rowSpan));this._expandClipRows(n,t);let r=0;if(n.length){const e=t.leftCol,l=i.columns.length;for(let t=0;t<n[0].length;t++){let s=e+t+r;for(;s<l&&!i.columns[s].visible;){r++;s++}}}let a=s?new CellRange(t.topRow,t.leftCol,Math.min(t.topRow+n.length-1,i.rows.length-1),Math.min(t.leftCol+n[0].length-1+r,i.columns.length-1)):t,h=new CellRangeEventArgs(i.cells,a,e);if(!i.onPasting(h))return!1;a=new CellRange(t.topRow,t.leftCol);let d=new CellRangeEventArgs(i.cells,new CellRange(t.topRow,-1)),c=!1,_=0,u=t.topRow,g=i.rows,w=i.columns,m=i._getRowsPerItem(),p=n.length>m,f=this._deferPaste(t,n.length);wijmo_1.assert(m>=1,"Invalid RPI value = "+m);i.deferUpdate(()=>{let e=-1;if(l&&f){e=l.currentPosition;l.beginUpdate()}for(let e=0;e<n.length&&u<g.length;e++,u++){let s=g[u];if(!s.isVisible){e--;continue}if(p&&s.isReadOnly)continue;let o=s.dataItem,r=l?l.currentEditItem:null;if(r&&o!=r){i.onRowEditEnding(d);i.onRowEditEnded(d)}if(s instanceof _NewRowTemplate&&l){if(f){s.dataItem=l.addNew();d._rng.setRange(i.newRowAtTop?0:u,-1);if(!i.onRowEditStarting(d)){u--;l.cancelNew();continue}i.onRowEditStarted(d)}else if(1==m||(u+1)%m==1){d._rng.setRange(i.newRowAtTop?u%m:u,-1);if(!i.onRowEditStarting(d)){u--;continue}i.onRowEditStarted(d)}}else if(o!=r){d._rng.setRange(u,-1);i.onRowEditStarting(d);i.onRowEditStarted(d)}let h=n[e],C=t.leftCol;for(let e=0;e<h.length&&C<w.length;e++,C++){let t=w[C];if(!t.isVisible){e--;continue}if(p&&t.isReadOnly)continue;let n=i.getMergedRange(i.cells,u,C,!1);if(!(n&&(n.leftCol!=C||n.topRow!=u))&&this._allowEdit(u,C)){let n=h[e],r=n.length;r>1&&'"'==n[0]&&'"'==n[r-1]&&n.indexOf("\n")>-1&&(n=n.substr(1,r-2));let d=t.maxLength||s.maxLength;d&&(n=n.substr(0,d));let g=new CellRangeEventArgs(i.cells,new CellRange(u+_,C),n);if(i.onPastingCell(g)){if(l){l.editItem(o);this._edItem=l.currentEditItem}let e=i.getCellData(u,C,!1),t=g.data,s=softInput();if(s){let l=i._getBindingColumn(i.cells,u,i.columns[C]),o=l.editor,n=null,r=null;if(o instanceof s.InputNumber){n=o.clamp.bind(o);r=wijmo_1.DataType.Number}else if(o instanceof s.InputDate||o instanceof s.InputTime){n=o._clamp.bind(o);r=wijmo_1.DataType.Date}if(n){t=wijmo_1.changeType(t,r,l.format,e);wijmo_1.getType(t)==r&&(t=n(t))}}if(i.setCellData(u,C,t)){g.data=e;i.onPastedCell(g);c=!0}}a.row2=Math.max(a.row2,u+_);a.col2=Math.max(a.col2,C)}}if(this._edItem&&l instanceof wijmo_1.CollectionView){let e=new wijmo_1.NotifyCollectionChangedEventArgs(wijmo_1.NotifyCollectionChangedAction.Change,this._edItem,u);l.onCollectionChanged(e,l._edtClone)}if(s instanceof _NewRowTemplate&&l)if(f){s.dataItem=null;if(c){d._rng.setRange(i.newRowAtTop?0:u,-1);i.onRowEditEnding(d);i.onRowEditEnded(d);u--;_++;l.commitNew()}else l.cancelNew()}else if(p&&m>1&&(u+1)%m==0&&c){d._rng.setRange(i.newRowAtTop?u%m:u,-1);i.onRowEditEnding(d);i.onRowEditEnded(d);u-=m;_++}}if(l)if(f){if(l.currentEditItem){l.commitEdit();i.onRowEditEnding(d);i.onRowEditEnded(d)}l.moveCurrentToPosition(e);l.endUpdate(!0)}else{let e=l.currentAddItem;!e&&0==t.row&&i.newRowAtTop&&g[0]instanceof _NewRowTemplate&&(e=g[0].dataItem);if(e){l.editItem(e);this._edItem=e}}a.rowSpan>1&&0==a.topRow&&g[0]instanceof _NewRowTemplate&&(a.row=a.row2=0);i.select(a)});i.onPasted(h);if(c&&wijmo_1.closest(i.hostElement,"form")){let e=document.createEvent("HTMLEvents"),t=wijmo_1.createElement("<input>",i.hostElement);e.initEvent("change",!0,!1);t.dispatchEvent(e);wijmo_1.removeChild(t)}}_deferPaste(e,t){let i=this._g.rows,l=i.length;if(t>1){if(l>1&&i[0].dataItem!=i[1].dataItem)return!0;if(1==l&&i[0]instanceof _NewRowTemplate)return!0}return!1}_parseClipString(e){const t=[],i=(e=(e=e.replace(/\r\n/g,"\n").replace(/\r/g,"\n")).replace(/\n$/,"")).length,isTabOrNewLineChar=e=>"\n"===e||"\t"===e;let l=0,s=0;for(l=0;l<i;l++){let o=!1,n=!1,r=!1;if('"'===e[l]){let t=!1,s=!1;for(let o=l+1;o<i;o++){let l=e[o];if('"'===l){const t=o+1;if(t<i){isTabOrNewLineChar(e[t])&&(s=!0)}else s=!0}else!t&&isTabOrNewLineChar(l)&&(t=!0);if(s)break}s&&t&&(o=!0)}for(s=l;s<i&&!r;s++){let a=e[s];if('"'===a)o&&(n=!n);else if(isTabOrNewLineChar(a)&&!n){this._parseClipCell(t,e,l,s,"\n"==a);l=s;s==i-1&&(l=s+1);r=!0}}if(s==i){this._parseClipCell(t,e,l,s,!1);break}}0==t.length&&t.push([""]);return t}_parseClipCell(e,t,i,l,s){e.length||e.push([]);let o=t.substr(i,l-i),n=o.length;if(n>2&&'"'==o[0]&&'"'==o[n-1]){const e=o.substr(1,n-2),unquotedStringHasChar=t=>e.indexOf(t)>-1;(unquotedStringHasChar('""')||unquotedStringHasChar("\t")||unquotedStringHasChar("\n"))&&(o=e.replace(/""/g,'"'))}else"\t"==o&&(o="");e[e.length-1].push(o);s&&e.push([])}_expandClipRows(e,t){let i=e.length,l=0;for(let t=0;t<i;t++)l=Math.max(l,e[t].length);let s=this._g,o=0,n=0;for(let e=t.topRow;e<=t.bottomRow;e++)s.rows[e].isVisible&&o++;for(let e=t.leftCol;e<=t.rightCol;e++)s.columns[e].isVisible&&n++;if(o>1||n>1){1==o&&(o=i);1==n&&(n=l);if(n%l==0&&o%i==0){for(let t=l;t<n;t++)for(let s=0;s<i;s++)e[s].push(e[s%i][t%l]);for(let t=i;t<o;t++)e.push(e[t%i])}}}_updateEditorCell(e,t,i){let l=this._g,s=l.cells.getCellElement(e,t),o=l._useFrozenDiv()&&(e<l.rows.frozen||t<l.columns.frozen);if(!s||o||l._hasPendingUpdates())l.refresh(!1);else if(l.onUpdatingView(new wijmo_1.CancelEventArgs)){this._updateCell(s);(i||l._getHasValidation())&&this._updateRowHeaderCell(e);l.onUpdatedView()}}_updateRowHeaderCell(e){let t=this._g;if(t.headersVisibility&HeadersVisibility.Row){let i=t.rowHeaders,l=t._getEditColumnIndex(),s=i.getCellElement(e,l);s&&this._updateCell(s)}}_updateCell(e){let t=new HitTestInfo(e,null),i=FlexGrid._WJS_UPDATING;if(t.panel){wijmo_1.addClass(e,i);t.grid.cellFactory.updateCell(t.panel,t.row,t.col,e,t.range);wijmo_1.removeClass(e,i)}}_getValidationError(e){let t=this._g,i="";if(t&&this._rng&&!this._validating){let l=this._rng.row,s=this._rng.col,o=t.activeEditor,n=t.cellFactory.getEditorValue(t),r=t.getCellData(l,s,!1);e&&(i=t._getError(t.cells,l,s,!0));if(!i&&t._getHasValidation()){o&&(i=o.validationMessage);if(!i){let e=t.columns[s],o=t.rows[l];!t._getBindingColumn(t.cells,l,e).getIsRequired(o)||null!=n&&""!==n||(i=this._getRequiredMsg())}if(!i&&t.setCellData(l,s,n,!0,!1)){i=t._getError(t.cells,l,s,!1);t.setCellData(l,s,r,!1,!1)}}if(!i){let e=wijmo_1.Control.getControl(wijmo_1.closest(o,".wj-control"));if(e&&e!=t&&e.invalidInput.hasHandlers){let invInputHandler=(e,o)=>{if(o.cancel){i=t._getError(t.cells,l,s,!0)||this._getBadInputMsg();o.cancel=!1}};this._validating=!0;let n=o.value;e.invalidInput.addHandler(invInputHandler);if(e._containsFocus()){let t=wijmo_1.closest(e.hostElement,".wj-cell");t&&t.focus()}e.onLostFocus();e.invalidInput.removeHandler(invInputHandler);o.value=n;i&&o.select();this._validating=!1}}}return i}_getRequiredMsg(){if(!_EditHandler._msgRequired){let e=document.createElement("input");e.required=!0;_EditHandler._msgRequired=e.validationMessage}return _EditHandler._msgRequired}_getBadInputMsg(){if(!_EditHandler._msgBadInput){let e=document.createElement("input");e.pattern="x";e.value="a";_EditHandler._msgBadInput=e.validationMessage||"Bad Input"}return _EditHandler._msgBadInput}_allowEdit(e,t){let i=this._g;if(i.isReadOnly||i.selectionMode==SelectionMode.None)return!1;if(i.collectionView&&!i.editableCollectionView)return!1;if(null!=e){if(e<0||e>=i.rows.length)return!1;let t=i.rows[e];if(!t||t.isReadOnly||!t.isVisible)return!1}if(null!=t){if(t<0||t>=i.columns.length)return!1;let l=i._getBindingColumn(i.cells,e,i.columns[t]);if(!l||l.isReadOnly||!l.isVisible)return!1}return!0}_commitRowEdits(){let e=this._g;if(this.finishEditing()&&this._edItem){let t=e.editableCollectionView;if(t&&(t.currentEditItem||t.currentAddItem)){let i=new CellRangeEventArgs(e.cells,e.selection);e.onRowEditEnding(i);t.commitEdit();e.onRowEditEnded(i)}this._edItem=null}}_keydown(e){let t=this._edt;switch(e.keyCode){case wijmo_1.Key.F2:this._fullEdit=!this._fullEdit;e.preventDefault();return!0;case wijmo_1.Key.F4:this._toggleListBox(e);e.preventDefault();return!0;case wijmo_1.Key.Space:if(t&&"checkbox"==t.type&&!t.disabled&&!t.readOnly){wijmo_1.setChecked(t,t.indeterminate||!t.checked);this.finishEditing();e.preventDefault()}return!0;case wijmo_1.Key.Enter:e.preventDefault();if(t&&e.altKey){let t=e.target;if(t instanceof HTMLTextAreaElement&&"soft"==t.wrap){if(this._composing){t.blur();t.focus()}t.style.setProperty("ime-mode","auto","important");let e=t.value,i=t.selectionStart,l=t.selectionEnd;t.value=e.substr(0,i)+"\n"+e.substr(l);wijmo_1.setSelectionRange(t,i+1);t.blur();t.focus();t.style.imeMode=""}return!0}if(t&&this._lbx){let t=this._g,i=t._selHdl.selection,l=t.rows[i.row],s=t._getBindingColumn(t.cells,i.row,t.columns[i.col]);this._lbx_SelectedValue=this._findKeyValue(l.dataMap||s.dataMap,s.isContentHtml||l.isContentHtml);this._toggleListBox(e);this.finishEditing();return!0}return!this.finishEditing();case wijmo_1.Key.Tab:e.preventDefault();return!this.finishEditing();case wijmo_1.Key.Escape:e.preventDefault();this.finishEditing(!0);return!0;case wijmo_1.Key.Up:case wijmo_1.Key.Down:case wijmo_1.Key.Left:case wijmo_1.Key.Right:case wijmo_1.Key.PageUp:case wijmo_1.Key.PageDown:case wijmo_1.Key.Home:case wijmo_1.Key.End:if(this._lbx)return this._keydownListBox(e);if(e.altKey)switch(e.keyCode){case wijmo_1.Key.Up:case wijmo_1.Key.Down:this._toggleListBox(e);e.preventDefault();return!0}if(this._fullEdit)switch(e.keyCode){case wijmo_1.Key.PageUp:case wijmo_1.Key.PageDown:e.preventDefault()}else if(this.finishEditing())return!1}return!0}_keydownListBox(e){let t=!0;if(this._lbx)switch(e.keyCode){case wijmo_1.Key.Up:e.altKey?this._toggleListBox(e):this._lbx.selectedIndex>0&&this._lbx.selectedIndex--;break;case wijmo_1.Key.Down:e.altKey?this._toggleListBox(e):this._lbx.selectedIndex++;break;case wijmo_1.Key.Home:case wijmo_1.Key.PageUp:this._lbx.selectedIndex=0;break;case wijmo_1.Key.End:case wijmo_1.Key.PageDown:this._lbx.selectedIndex=this._lbx.collectionView.items.length-1;break;default:t=!1}if(t){e.preventDefault();return!0}return!1}_keypress(e){if("AltLeft"==e.code||"AltRight"==e.code){e.preventDefault();return}let t=this._edt,i=e.charCode||32,l=this._list;if(wijmo_1.isEdge()){let e=t;e&&(1==e.value.length||0==e.selectionStart&&e.selectionEnd==e.value.length)&&(wijmo_1.Control.sharedState.InvalidScroll=!0)}if(t&&"checkbox"!=t.type&&wijmo_1.getActiveElement()==t&&l&&l.length>0&&i>=32){let i=t.selectionStart,s=t.value.substr(0,i);if(e.target==t&&e.charCode){s+=String.fromCharCode(e.charCode);i++}const o=this._mapSearch;let n=-1;if(o)for(let e=0;e<l.length;e++){const t=l[e];if(o(null==t?t:t.toString(),s)){n=e;break}}else(n=this._findString(l,s,!0))<0&&!this._g.caseSensitiveSearch&&(n=this._findString(l,s,!1));if(n>-1){let s=this._lbx;s&&(s.selectedIndex=n);t.value=l[n];wijmo_1.setSelectionRange(t,i,t.value.length);t.dispatchEvent(this._evtInput);e.preventDefault&&e.preventDefault()}else this._lbx&&(this._lbx_SelectedValue=null)}}_findString(e,t,i){i||(t=t.toLowerCase());for(let l=0;l<e.length;l++){let s=e[l];if(null!=s){s=s.toString();i||(s=s.toLowerCase());if(0==s.indexOf(t))return l}}return-1}_toggleListBox(e,t){let i=this._g,l=i._selHdl.selection,s=i.isTouching;t||(t=l);if(this._lbx){this._removeListBox();if(l.intersects(t)){i.activeEditor?i.activeEditor.focus():i.containsFocus()||i.focus();return!0}}if(!t.isValid)return!1;let o=i.rows[t.row],n=i._getBindingColumn(i.cells,t.row,i.columns[t.col]),r=o.dataMap||n.dataMap,a=i._getMapEditor(o,n);if(!r||a!=DataMapEditor.DropDownList||!softInput())return!1;if(null!=n.editor)return!1;if(!t.intersects(i.editRange)&&!this.startEditing(!0,t.row,t.col,!s,e))return!1;let h=this._lbx=this._createListBox();requestAnimationFrame(()=>h.showSelection());s&&h.focus();return!0}_createListBox(){let e=this._g,t=e.activeEditor,i=this._rng,l=e.rows[i.row],s=e._getBindingColumn(e.cells,i.row,e.columns[i.col]),o=s.isContentHtml||l.isContentHtml,n=s.dataMap||l.dataMap,r=s.dropDownCssClass||l.dropDownCssClass,a=document.createElement("div");this._removeListBox();wijmo_1.addClass(a,"wj-dropdown-panel wj-grid-listbox");wijmo_1.addClass(a,r);let h=t?t.value:e.getCellData(i.row,i.col,!0),d=new mInput.ListBox(a,{maxHeight:l.renderHeight*_LB_PAGE_SIZE,isContentHtml:o,itemsSource:n.getDisplayValues(l.dataItem)});if(n._displayPath==n._keyPath)d.selectedValue=h;else{let t=e.getCellData(i.row,i.col,!1),l=-1,s=this._findDuplicateValues(n,h,o),r=n._cv.items.findIndex(e=>this.isEqualValue(e[n._keyPath],t,o));if(r>-1){let e=n._cv.items[r][n._displayPath];if(this.isEqualValue(h,e,o))if(1==s.length)l=r>d.itemsSource.length||!this.isEqualValue(d.itemsSource[r],h,o)?d.itemsSource.findIndex(t=>this.isEqualValue(e,t,o)):r;else for(var c=-1,_=0;_<d.itemsSource.length;_++)if(this.isEqualValue(d.itemsSource[_],e,o)){c++;if(this.isEqualValue(s[c],t,o)){l=_;break}}}l<0&&(l=d.itemsSource.findIndex(e=>this.isEqualValue(h,e,o)));l>=0?d.selectedIndex=l:d.selectedValue=null}d.addEventListener(a,"keydown",t=>{switch(t.keyCode){case wijmo_1.Key.Enter:case wijmo_1.Key.Escape:this._removeListBox();e.focus()}});d.addEventListener(a,"click",()=>{this._lbx&&(this._lbx_SelectedValue=this._findKeyValue(n,o));this._removeListBox();e.focus();this.finishEditing()});d.gotFocus.addHandler(()=>{d.containsFocus()&&t&&!wijmo_1.isEdge()&&t.focus()});d.selectedIndexChanged.addHandler(()=>{let t=e.activeEditor;if(t){t.value=this._list[d.selectedIndex];t.dispatchEvent(this._evtInput);wijmo_1.setSelectionRange(t,0,t.value.length)}});let u=e.cells.getCellElement(i.row,i.col);if(u){wijmo_1.showPopup(a,u,!1,!1,!1);let e=u.querySelector("."+CellFactory._WJC_DROPDOWN);wijmo_1.setAttribute(e,"aria-expanded",!0)}else{wijmo_1.showPopup(a,e.getCellBoundingRect(i.row,i.col));a[wijmo_1.Control._OWNR_KEY]=e.hostElement}return d}_findKeyValue(e,t=!1){let i=this._lbx.selectedValue,l=this._findDuplicateValues(e,i,t),s=e.getKeyValue(i);if(this._lbx.selectedIndex>0&&l.length>1){for(var o=-1,n=0;n<=this._lbx.selectedIndex;n++)this.isEqualValue(this._lbx.itemsSource[n],i,t)&&o++;o>=0&&(s=l[o])}return s}_findDuplicateValues(e,t,i=!1){let l=[],s=e.getKeyValues();for(var o=0;o<s.length;o++)this.isEqualValue(e.getDisplayValue(s[o]),t,i)&&l.push(s[o]);return l}_removeListBox(){let e=this._lbx;if(e){this._lbx=null;wijmo_1.hidePopup(e.hostElement,()=>{e.dispose()})}}isEqualValue(e,t,i=!1){if(e instanceof Date&&t instanceof Date)return e.getTime()==t.getTime();null!=e&&null!=e||(e="");null!=t&&null!=t||(t="");Number.isNaN(e)&&(e="NaN");Number.isNaN(t)&&(t="NaN");if(i){wijmo_1.isString(e)&&e.indexOf("<")>-1&&(e=wijmo_1.toPlainText(e));wijmo_1.isString(t)&&t.indexOf("<")>-1&&(t=wijmo_1.toPlainText(t))}return e.toString()==t.toString()}_selectionChanging(e){if(this.finishEditing()){let t=this._g._selHdl.selection.row;if(t!=e.row){let i=this._g.rows.length;if((t>-1&&t<i?this._g.rows[t].dataItem:null)!=(e.row>-1&&e.row<i?this._g.rows[e.row].dataItem:null)){this._commitRowEdits();if(this._g._getHasValidation()&&this._g.validateEdits){let i=!this._g.rows[t]||this._g.rows[t]&&Object.getPrototypeOf(this._g.rows[t])!==Row.prototype?null:this._g.getEmptyRequiredCell(t);null!==i&&setTimeout(()=>{this._g.select(new CellRange(t,i));this.startEditing(!0,t,i,!0,e)})}}}}else e.cancel=!0}}_EditHandler._msgRequired="";_EditHandler._msgBadInput="";exports._EditHandler=_EditHandler;class _CustomEditor{constructor(e,t){this._col=wijmo_1.asType(e,Column);this._ctl=t;this._tbx=t.hostElement.querySelector("input");wijmo_1.assert(this._col instanceof Column,"Invalid Column");wijmo_1.assert(this._ctl instanceof wijmo_1.Control,"Invalid edit control");wijmo_1.assert(this._tbx instanceof HTMLInputElement,"Input element not found in editor");let i=this._ctl;this._prop=wijmo_1.isUndefined(i.value)?wijmo_1.isUndefined(i.checkedItems)?wijmo_1.isUndefined(i.text)?null:"text":"checkedItems":"value";wijmo_1.assert(null!=this._prop,"value, text properties not found in editor");let l=softInput();if(l){this._isDropDown=i instanceof l.DropDown;this._isComboBox=i instanceof l.ComboBox;this._isAutoComplete=i instanceof l.AutoComplete;this._isInputDateTime=i instanceof l.InputDateTime;this._isInputNumber=i instanceof l.InputNumber;this._isInputMask=i instanceof l.InputMask}this._updateFocusBnd=this._updateFocus.bind(this);this._keydownBnd=this._keydown.bind(this);this._cmpstartBnd=this._cmpstart.bind(this);this._mousedownBnd=this._mousedown.bind(this);this._connect();this._col.gridChanged.addHandler(this._connect,this);this._hideEditor();this._updateFocus()}get grid(){return this._g}get column(){return this._col}get control(){return this._ctl}dispose(){this._disconnect();this._isDropDown&&(this._isDropDown=!1);this._g=this._col=this._ctl=this._tbx=null}_connect(){let e=this._col?this._col.grid:null;if(e!=this._g){this._disconnect();if(e){let t=e.hostElement,i=e.addEventListener.bind(e),l=this._updateFocusBnd;this._g=e;this._hideEditor();this._updateFocus();i(t,"keydown",this._keydownBnd,!0);i(t,"mousedown",this._mousedownBnd,!0);i(t,"mouseup",l,!0);i(t,"blur",l,!0);i(t,"focus",l);i(this._tbx,"compositionstart",this._cmpstartBnd);e.gotFocus.addHandler(l,this);e.selectionChanged.addHandler(l,this);e.prepareCellForEdit.addHandler(this._prepareCellForEdit,this);e.cellEditEnding.addHandler(this._cellEditEnding,this);e.cellEditEnded.addHandler(this._cellEditEnded,this)}}}_disconnect(){let e=this._g;if(e){let t=e.hostElement,i=e.removeEventListener.bind(e),l=this._updateFocusBnd;i(t,"keydown",this._keydownBnd);i(t,"mousedown",this._mousedownBnd);i(t,"mouseup",l);i(t,"blur",l);i(t,"focus",l);i(this._tbx,"compositionstart",this._cmpstartBnd);e.gotFocus.removeHandler(l,this);e.selectionChanged.removeHandler(l,this);e.prepareCellForEdit.removeHandler(this._prepareCellForEdit,this);e.cellEditEnding.removeHandler(this._cellEditEnding,this);e.cellEditEnded.removeHandler(this._cellEditEnded,this);this._g=null}}_prepareCellForEdit(e,t){if(!t.cancel&&t.getColumn(!0)==this._col){let e=this.grid,i=this._ctl,l=this._tbx,s=this._prop,o=t.range,n=t.data,r=n&&void 0!==n.type?n.type:"",a=e.getCellData(o.row,o.col,"text"==s||this._isInputMask),h=!1;if(this._isComboBox){""!=a&&(i._emptyValueAction=!1);this._isInputDateTime&&i._setDropdown(i._ddDate)}this._isInputMask&&(i._fullEdit=!0);if("checkedItems"==s){if(i.showFilterInput){i.showFilterInput=!1;i.showFilterInput=!0}if(null==a||0==a.length){i[s]=[];i.selectedIndex=0}}if(null!=a||!i.isRequired){if("checkedItems"==s){let e=[];if(i.selectedValuePath)for(let t=0;t<a.length;t++){const l=i.collectionView.items.findIndex(e=>null!=a[t][i.selectedValuePath]&&e[i.selectedValuePath]===a[t][i.selectedValuePath]);if(l>=0){i._lbx.toggleItemChecked(l);e.push(i.collectionView.items[l])}}else wijmo_1.isArray(a)?e=a:a.length>0&&(e=a.split(","));i[s]=e}else i[s]=a;if(this._isAutoComplete){clearTimeout(i._toSearch);let e=i.collectionView;if(e&&(e.filter||i._rxHighlight)){i._rxHighlight=null;e.filter=null}if(a){let e=i._findNext(a,1,-1);i.selectedIndex!=e&&(i.selectedIndex=e)}}}switch(r){case"keydown":case"mousedown":if(wijmo_1.isUndefined(n.keyCode)||n.keyCode==wijmo_1.Key.F4||n.altKey){h=this._isDropDown;if(this._isAutoComplete&&(null==a||wijmo_1.isString(a))){let e=i.collectionView;if(e){if(e.filter||i._rxHighlight){i._rxHighlight=null;e.filter=null}let t=a?i._findNext(a,1,-1):-1;i.selectedIndex!=t&&(i.selectedIndex=t)}}}}e.showPlaceholders&&!i.placeholder&&(l.placeholder=this._col.header);this._showEditor();e._edtHdl._fullEdit=!0;if(0==r.indexOf("key")&&32==n.keyCode){wijmo_1.setSelectionRange(l,l.value.length);n.preventDefault()}if(wijmo_1.isIE()&&!e.imeEnabled)if("keypress"==r&&n.key){setTimeout(()=>{l.value=n.key;wijmo_1.setSelectionRange(l,1);let e=document.createEvent("HTMLEvents");e.initEvent("input",!0,!1);l.dispatchEvent(e)});n.preventDefault()}else if("compositionstart"==r){let e=l.value.length;wijmo_1.setSelectionRange(l,e)}this._isDropDown&&(i.isDroppedDown=h)}}_cellEditEnding(e,t){if(!t.cancel&&t.getColumn(!0)==this._col){let e=this.grid,i=this._ctl,l=this._prop;if(this._isAutoComplete){let e=i.selectedIndex;if(wijmo_1.isNumber(e)&&e<0){let e=i.collectionView;e&&1==e.items.length?i.selectedIndex=0:this._col.isRequired&&(t.cancel=!0)}}if(!t.cancel&&l){let t=!1;if(this._isInputMask){let l=i;if(null!=l){e._edtHdl._setCustomEditorValue(l._msk._applyMask());t=!0}}t||e._edtHdl._setCustomEditorValue(i[l])}}}_cellEditEnded(e,t){this._hideEditor();this._updateFocus()}_cmpstart(e){this.grid.imeEnabled&&(wijmo_1.isIE()?setTimeout(()=>{this._activateEditor(e)}):this._activateEditor(e))}_keydown(e){if(!e.defaultPrevented&&this._checkColumn(e.target))if(this.grid.activeEditor){if(e.keyCode==wijmo_1.Key.Enter&&this._isDropDown){let t=this._ctl;if(t.isDroppedDown){t.isDroppedDown=!1;e.preventDefault();e.stopImmediatePropagation()}}}else if(this._isDropDown){let t=e.keyCode;switch(t){case wijmo_1.Key.F4:case wijmo_1.Key.Up:case wijmo_1.Key.Down:if(t==wijmo_1.Key.F4||e.altKey){this._activateEditor(e);e.preventDefault()}}}}_checkColumn(e){let t=this._g;if(wijmo_1.contains(e,this._tbx)||null!=e&&this._imeEditor()===e){let e=t._selHdl.selection;return t._getBindingColumn(t.cells,e.row,t.columns[e.col])==this._col}return!1}_mousedown(e){if(!e.defaultPrevented&&0==e.button&&!e.shiftKey&&!e.ctrlKey&&!e.metaKey&&this._isDropDown&&wijmo_1.closestClass(e.target,CellFactory._WJC_DROPDOWN)){let t=this.grid,i=t.hitTest(e);if(!i._clickChildGrid&&i.getColumn(!0)==this._col){t.select(i.range);t.refresh();this._activateEditor(e);e.preventDefault()}}}_activateEditor(e){let t=this.grid;if(!t.activeEditor){let i=t._selHdl.selection;if(i.isValid)return t.startEditing(!0,i.row,i.col,!0,e)}return!1}_showEditor(){let e=this.grid,t=e.activeEditor,i=wijmo_1.closest(t,".wj-cell");if(i){let l=this._tbx,s=this._ctl.hostElement;wijmo_1.setCss(s,_CustomEditor._cssVisible);wijmo_1.toggleClass(l,"wj-grid-ime",!1);i.innerHTML="";i.appendChild(s);e._edtHdl._edt=l;if(this._imeEditor())this._initImeEditInput();else{l.select();l.focus();t.value=""}}}_hideEditor(){let e=this.grid,t=this._ctl.hostElement,i=this._tbx;this._isDropDown&&(this._ctl.isDroppedDown=!1);i.setCustomValidity("");let l=i.value;i.value=l+" ";i.value=l;wijmo_1.setCss(t,_CustomEditor._cssHidden);wijmo_1.toggleClass(i,"wj-grid-ime",!0);e&&t.parentElement!=e._root&&e._root.appendChild(t)}_resetTabIndex(){this._tbx.tabIndex=-1}_updateFocus(){let e=this.grid;if(e&&!e.activeEditor){let t=e.hostElement,i=".wj-flexgrid",l=this._tbx,s=wijmo_1.getActiveElement(),o=e._getTabIndex();if(wijmo_1.closest(s,i)==t)if(wijmo_1.closest(l,i)!=t)this._hideEditor();else if(e.imeEnabled)l.tabIndex>-1&&(l.tabIndex=-1);else{let t=e._selHdl.selection,i=e._getBindingColumn(e.cells,t.row,e.columns[t.col]);if(i&&i==this._col&&e.canEditCell(t.row,t.col)){if(s!==l){e.activeCell&&(e.activeCell.tabIndex=-1);l.tabIndex=o;if(!e.isTouching){l.select();l.focus()}}}else if(l.tabIndex>-1){l.tabIndex=-1;s==l&&e.focus(!0)}}}}_initImeEditInput(){let e=this._imeEditor();if(e){let t=this._tbx,i=t&&t.style.color,l=this._ctl,compEndEh=()=>{e.removeEventListener("compositionend",compEndEh);wijmo_1.setCss(e,_ImeHandler._cssHidden);if(t){t.style.color=i;var gotF=()=>{l.gotFocus.removeHandler(gotF);this._g._edtHdl._edt=t;let i=e.value;if(i){t.value=i;this._isInputMask?setTimeout(()=>{_CustomEditor._setSelectionRange(t,i.length,i.length)},0):_CustomEditor._setSelectionRange(t,i.length,i.length);let e=document.createEvent("HTMLEvents");e.initEvent("input",!0,!1);t.dispatchEvent(e)}};l.gotFocus.addHandler(gotF);t.focus()}};e.addEventListener("compositionend",compEndEh);t&&(t.style.color="transparent")}}static _setSelectionRange(e,t,i=t){if(wijmo_1.contains(document.body,e)&&!e.disabled&&"none"!=e.style.display)try{e.setSelectionRange(wijmo_1.asNumber(t),wijmo_1.asNumber(i),wijmo_1.isIE()?null:"backward");e.focus()}catch(e){}}_imeEditor(){let e=this.grid;if(e&&e.imeEnabled){let e=wijmo_1.getActiveElement();if(e&&(e instanceof HTMLInputElement||e instanceof HTMLTextAreaElement)&&wijmo_1.hasClass(e,"wj-grid-ime"))return e}return null}}_CustomEditor._cssHidden={position:"fixed",left:-32e3,top:-32e3,width:"1px",height:"1px",overflow:"hidden",border:"none"};_CustomEditor._cssVisible={position:"absolute",left:0,top:0,width:"100%",height:"100%"};exports._CustomEditor=_CustomEditor;var KeyAction;!function(e){e[e.None=0]="None";e[e.MoveDown=1]="MoveDown";e[e.MoveAcross=2]="MoveAcross";e[e.Cycle=3]="Cycle";e[e.CycleOut=4]="CycleOut";e[e.CycleEditable=5]="CycleEditable"}(KeyAction=exports.KeyAction||(exports.KeyAction={}));class _KeyboardHandler{constructor(e){this._kaTab=KeyAction.None;this._kaEnter=KeyAction.MoveDown;this._g=e;let t=e.hostElement;e.addEventListener(t,"keypress",this._keypress.bind(this));e.addEventListener(t,"keydown",this._keydown.bind(this))}_keydown(e){let t=this._g,i=t._edtHdl,l=t.selection,s=e.ctrlKey||e.metaKey,o=e.shiftKey,n=e.altKey,r=e.target,a=e.char||e.key,h=!0;if(!s&&!n&&a&&1==a.length&&wijmo_1.closest(r,".wj-cell")&&r.firstElementChild&&(" "!=a||!o)){let t=r.querySelectorAll("."+CellFactory._WJC_RADIOMAP+" label input");if(t&&t.length){let i=-1;for(let e=0;e<t.length;e++)if(t[e].checked){i=e;break}a=a.toLowerCase();for(let e=0;e<t.length;e++){let l=t[(i+e+1)%t.length];if(" "==a||l.value.toLowerCase()[0]==a){l.click();break}}e.preventDefault();return}}if(t._wantsInput(r))return;let d=wijmo_1.tryCast(t.rows[l.row],GroupRow),c=t.editableCollectionView,_=t._getKeyCode(e),u=SelMove,g=SelectionMode,w=e.defaultPrevented&&!(r instanceof HTMLInputElement);if((!t.isRangeValid(l)||w)&&(!s||65!=_))return;if(t.activeEditor&&i._keydown(e)&&!t._isNativeCheckbox(t.activeEditor))return;if(t.autoClipboard){if(s&&(67==_||45==_)){let i=new CellRangeEventArgs(t.cells,l);if(t.onCopying(i)){let e=HeadersVisibility,l=0!=(t.copyHeaders&e.Column),s=0!=(t.copyHeaders&e.Row),o=t.getClipString(null,!1,l,s)+"\r\n";t._eFocus.focus();wijmo_1.Clipboard.copy(o);t.onCopied(i)}e.stopPropagation();return}if(s&&86==_||o&&45==_){t.isReadOnly||wijmo_1.Clipboard.paste(e=>{t.setClipString(e)});e.stopPropagation();return}}(o||s)&&"Space"==e.code&&(_=wijmo_1.Key.Space);const m=e.target,p=m.closest(".wj-cell"),f=m&&p&&p["wj-cell-index"]&&p["wj-cell-index"].panel,C=[HeadersFocusability.Column,HeadersFocusability.All].includes(t.headersFocusability),R=[HeadersFocusability.Row,HeadersFocusability.All].includes(t.headersFocusability);switch(_){case wijmo_1.Key.Space:if(p&&f&&[CellType.RowHeader,CellType.TopLeft,CellType.ColumnHeader].includes(f._ct)&&R){const e=t.activePanelType;t.activePanelType=e;const i=p.querySelector(".wj-cell-check"),l=i&&!i.checked;setTimeout(()=>{t.activePanelType=e;p.classList.add("wj-focus-header-cell");t._hideMarquee();p.focus();l&&t._activeCell&&t._activeCell.classList.add("wj-state-multi-selected")},200);t._activeCell=null}else if(o&&l.isValid)switch(t.selectionMode){case g.CellRange:case g.MultiRange:case g.Row:case g.RowRange:case g.ListBox:t.select(new CellRange(l.row,0,l.row,t.columns.length-1),!1)}else if(s&&l.isValid)switch(t.selectionMode){case g.CellRange:case g.MultiRange:t.select(new CellRange(0,l.col,t.rows.length-1,l.col),!1)}else{(h=this._startEditing(!0,e))&&setTimeout(()=>{let e=t.activeEditor;if(e)if(e.disabled||e.readOnly&&!wijmo_1.closest(e,".wj-control"))t.finishEditing();else if("checkbox"==e.type){wijmo_1.setChecked(e,e.indeterminate||!e.checked);t.finishEditing()}});h=!0}break;case 65:if(s)switch(t.selectionMode){case g.None:case g.Cell:break;default:t.selectAll()}else h=!1;break;case wijmo_1.Key.Left:if(p&&f&&f._ct===CellType.ColumnHeader&&C){e.preventDefault();t._selHdl.moveSelection(SelMove.None,SelMove.Prev,!1)}else if(s||n)h=!1;else if(l.isValid&&0==l.leftCol&&d&&!d.isCollapsed&&d.hasChildren)d.isCollapsed=!0;else if(R&&d&&!d.isCollapsed&&d.hasChildren)d.isCollapsed=!0;else{if(t.selectionMode==g.None)return;this._moveSel(u.None,s?u.Home:u.Prev,o)}break;case wijmo_1.Key.Right:if(p&&f&&f._ct===CellType.ColumnHeader&&C){e.preventDefault();t._selHdl.moveSelection(SelMove.None,SelMove.Next,!1)}else if(s||e.altKey)h=!1;else if(l.isValid&&0==l.leftCol&&d&&d.isCollapsed)d.isCollapsed=!1;else if(R&&d&&d.isCollapsed&&(!f||f&&f._ct===CellType.Cell))d.isCollapsed=!1;else{if(t.selectionMode==g.None)return;this._moveSel(u.None,s?u.End:u.Next,o)}break;case wijmo_1.Key.Up:if(s)h=!1;else if(e.altKey&&i._toggleListBox(e))h=!0;else{if(t.selectionMode==g.None)return;this._moveSel(u.Prev,u.None,o)}break;case wijmo_1.Key.Down:if(s)h=!1;else if(e.altKey&&i._toggleListBox(e))h=!0;else{if(t.selectionMode==g.None)return;this._moveSel(u.Next,u.None,o)}break;case wijmo_1.Key.PageUp:this._moveSel(e.altKey?u.Home:u.PrevPage,u.None,o);if(t.rows.frozen&&t.selection.row<t.rows.frozen){let e=t.scrollPosition;e.y&&(t.scrollPosition=new wijmo_1.Point(e.x,0))}break;case wijmo_1.Key.PageDown:this._moveSel(e.altKey?u.End:u.NextPage,u.None,o);break;case wijmo_1.Key.Home:this._moveSel(s?u.Home:u.None,u.Home,o);break;case wijmo_1.Key.End:this._moveSel(s?u.End:u.None,u.End,o);break;case wijmo_1.Key.Tab:if(!(h=this._performKeyAction(t.keyActionTab,o))&&!t.activeCell){t.focus(!0);if(t.imeEnabled){let e=t._imeHdl;e&&e._resetTabIndex()}else{let e=this._getCustomEditor(t,l.row,l.col);e&&e._resetTabIndex()}}break;case wijmo_1.Key.Enter:if(p&&f&&f._ct===CellType.ColumnHeader&&C){e.preventDefault();p.click();setTimeout(()=>{t.activePanelType=CellType.ColumnHeader;p.classList.add("wj-focus-header-cell");t._hideMarquee();p.focus()},30)}else if(p&&f&&f._ct===CellType.RowHeader&&R){e.preventDefault();t._selHdl.moveSelection(SelMove.Next,SelMove.None,!1)}else{t.rows[l.row]instanceof _NewRowTemplate||(h=this._performKeyAction(t.keyActionEnter,o));this._getCustomEditor(t,l.row,l.col)||t.focus(!0);!o&&c&&null!=c.currentEditItem&&i._commitRowEdits()}break;case wijmo_1.Key.Escape:h=!1;if(c&&(c.currentAddItem||c.currentEditItem)){let e=new CellRangeEventArgs(t.cells,t.selection);e.cancel=!0;t.onRowEditEnding(e);c.currentAddItem&&c.cancelNew();c.currentEditItem&&c.cancelEdit();t.onRowEditEnded(e);h=!0}t._mouseHdl.resetMouseState();break;case wijmo_1.Key.Delete:case wijmo_1.Key.Back:h=this._deleteSel(e);break;case wijmo_1.Key.F2:h=this._startEditing(!0,e);break;case wijmo_1.Key.F4:h=i._toggleListBox(e);break;default:h=!1}if(h){t.containsFocus()||t.focus();e.preventDefault();e.stopPropagation()}}_performKeyAction(e,t){let i=KeyAction,l=SelMove;switch(e){case i.MoveDown:this._moveSel(t?l.Prev:l.Next,l.None,!1);return!0;case i.MoveAcross:this._moveSel(l.None,t?l.Prev:l.Next,!1);return!0;case i.Cycle:this._moveSel(l.None,t?l.PrevCell:l.NextCell,!1);return!0;case i.CycleEditable:this._moveSel(l.None,t?l.PrevEditableCell:l.NextEditableCell,!1);return!0;case i.CycleOut:let e=this._g.selection;this._moveSel(l.None,t?l.PrevCell:l.NextCell,!1);return!e.equals(this._g.selection)}return!1}_keypress(e){let t=this._g;if(t._wantsInput(e.target)||e.defaultPrevented)return;let i=t._edtHdl;if(t.activeEditor)i._keypress(e);else if(e.charCode>wijmo_1.Key.Space&&"AltLeft"!=e.code&&"AltRight"!=e.code)if(this._startEditing(!1,e)&&t.activeEditor){let l=wijmo_1.getActiveElement();if(l instanceof HTMLInputElement&&"checkbox"!=l.type||l instanceof HTMLTextAreaElement){let s=t._selHdl.selection,o=t.getCellData(s.row,s.col,!0),n=t.getCellData(s.row,s.col,!1),r=wijmo_1.culture.Globalize.numberFormat["%"]||"%",a=String.fromCharCode(e.charCode),h=wijmo_1.isNumber(n)&&o.indexOf(r)>-1||""==o&&l.value==r,d=!0,initEditor=()=>{l.value=h?a+r:a;wijmo_1.setSelectionRange(l,1);l.dispatchEvent(i._evtInput);i._keypress(e);i._edtValue=l.value!=o?l.value:null};if(t.imeEnabled){let e=this._getCustomEditor(t,s.row,s.col),i=e&&e.control;if(i&&!i._focus){let gotF=()=>{i.gotFocus.removeHandler(gotF);d=!1;initEditor()};i.gotFocus.addHandler(gotF)}}d&&initEditor();e.preventDefault()}}else if(t.autoSearch){let i=!1,l=t._selHdl.selection;if(e.charCode>32||32==e.charCode&&this._search){e.preventDefault();this._search+=String.fromCharCode(e.charCode);this._toSearch&&clearTimeout(this._toSearch);this._toSearch=setTimeout(()=>{this._toSearch=null;this._search=""},wijmo_1.Control._SEARCH_DELAY);let s=this._findNext(l.row,l.col);if(s<0&&this._search.length>1){this._search=this._search[this._search.length-1];s=this._findNext(l.row,l.col)}if(s>-1){i=!0;t.select(s,l.col)}}i||(this._search="")}}_getCustomEditor(e,t,i){let l=e._getBindingColumn(e.cells,t,e.columns[i]);return l&&l._edt}_findNext(e,t){let i=this._g,l=i.rows.length;(e<0||1==this._search.length)&&e++;let s=this._search,o=i.caseSensitiveSearch;o||(s=s.toLowerCase());let n=i.columns[t].isContentHtml;for(let r=0;r<l;r++){let a=(e+r)%l,h=i.getCellData(a,t,!0).trim();n&&(h=wijmo_1.toPlainText(h));o||(h=h.toLowerCase());if(0==h.indexOf(s))return a}return-1}_moveSel(e,t,i){let l=this._g,s=l.selectionMode,o=l._selHdl;if(s!=SelectionMode.None){s==SelectionMode.MultiRange&&o.extendedSelection.clear();o.moveSelection(e,t,i)}}_deleteSel(e){let t=this._g,i=t.rows,l=t.editableCollectionView,s=t.selection,o=[],n=new CellRange,r=new CellEditEndingEventArgs(t.cells,n,e),a=SelectionMode;if(!t._edtHdl._allowEdit())return!1;if(t.allowDelete&&(null==l||l.canRemove&&!l.isAddingNew&&!l.isEditingItem)){if(0==(o=i.filter(e=>e.isSelected)).length)switch(t.selectionMode){case a.CellRange:case a.MultiRange:let e=t._getDeleteColumnIndex();t.selectedRanges.forEach(l=>{if(l.leftCol==e&&l.rightCol==t.columns.length-1)for(let e=l.topRow;e>-1&&e<=l.bottomRow;e++){let t=i[e];o.indexOf(t)<0&&o.push(t)}});break;case a.Row:s.topRow>-1&&o.push(i[s.topRow]);break;case a.RowRange:for(let e=s.topRow;e>-1&&e<=s.bottomRow;e++)o.push(i[e])}o=o.reduce((e,t)=>{e.find(e=>e.dataItem===t.dataItem)||e.push(t);return e},[])}if(o.length>0){let e=0;t.deferUpdate(()=>{l&&l.beginUpdate();for(let i=o.length-1;i>=0;i--){let s=o[i];if(!(s instanceof _NewRowTemplate)){n.setRange(s.index,-1);t.onDeletingRow(r);if(!r.cancel){l&&s.dataItem?l.remove(s.dataItem):t.rows.removeAt(s.index);e++;t.onDeletedRow(r)}}}l&&l.endUpdate(!1)});if(e>0){let e=s.topRow;e=Math.min(e,t.rows.length-1);for(;e>0&&t.rows[e]instanceof _NewRowTemplate;)e--;s.row=s.row2=e;t.select(s,!1);t.childItemsPath&&l&&l.refresh()}return!0}if(0==o.length){t.deferUpdate(()=>{let n=t.scrollPosition,r=-1;o=i.filter(e=>e.isSelected);let h=t.selectedRanges.length>1||o.length>1||s.isValid&&i[s.row].dataItem!=i[s.row2].dataItem;l&&l.beginUpdate();if(o.length){let i=new CellRange(0,0,0,t.columns.length-1);o.forEach(t=>{i.row=i.row2=t.index;this._deleteRange(e,i);r=i.bottomRow})}else{this._deleteRange(e,s);r=s.bottomRow;t.selectionMode==a.MultiRange&&t._selHdl.extendedSelection.forEach(t=>{this._deleteRange(e,t);r=t.bottomRow})}t.select(s,!1);t.scrollPosition=n;if(l){if(h&&l.currentEditItem){l.commitEdit();let e=new CellRangeEventArgs(t.cells,new CellRange(r,-1));t.onRowEditEnding(e);t.onRowEditEnded(e)}l.endUpdate(!1)}});return!0}return!1}_deleteRange(e,t){let i=this._g,l=i.editableCollectionView,s=new CellRange,o=new CellEditEndingEventArgs(i.cells,s,e),n=new CellRangeEventArgs(i.cells,new CellRange(t.topRow,-1));for(let e=t.topRow;e<=t.bottomRow;e++){let r=i.rows[e];if(!r.isReadOnly)for(let a=t.leftCol;a<=t.rightCol;a++){let h=i._getBindingColumn(i.cells,e,i.columns[a]);if(!h.getIsRequired(r)&&!h.isReadOnly){let h=i.getCellData(e,a,!1);if(i.getCellData(e,a,!0)){s.setRange(e,a);o.cancel=!1;if(i.onBeginningEdit(o)){let s=r.dataItem,d=l?l.currentEditItem:null;if(d&&s!=d&&a===t.rightCol){i.onRowEditEnding(n);i.onRowEditEnded(n)}if(s!=d&&a===t.leftCol){n._rng.setRange(e,-1);i.onRowEditStarting(n);i.onRowEditStarted(n)}if(l){l.editItem(s);i._edtHdl._edItem=s}i.setCellData(e,a,"",!0,!1);o.previousData=h;i.onCellEditEnding(o);i.onCellEditEnded(o)}}}}}}_startEditing(e,t,i,l){return this._g._edtHdl.startEditing(e,i,l,!0,t)}}exports._KeyboardHandler=_KeyboardHandler;const _AR_ALLCELLS=4,_WJC_DRAGSRC="wj-state-dragsrc",_WJC_FLEXGRID="wj-flexgrid";var AllowResizing,AutoSizeMode,AllowDragging;!function(e){e[e.None=0]="None";e[e.Columns=1]="Columns";e[e.Rows=2]="Rows";e[e.Both=3]="Both";e[e.ColumnsAllCells=e.Columns|_AR_ALLCELLS]="ColumnsAllCells";e[e.RowsAllCells=e.Rows|_AR_ALLCELLS]="RowsAllCells";e[e.BothAllCells=e.Both|_AR_ALLCELLS]="BothAllCells"}(AllowResizing=exports.AllowResizing||(exports.AllowResizing={}));!function(e){e[e.None=0]="None";e[e.Headers=1]="Headers";e[e.Cells=2]="Cells";e[e.Both=3]="Both"}(AutoSizeMode=exports.AutoSizeMode||(exports.AutoSizeMode={}));!function(e){e[e.None=0]="None";e[e.Columns=1]="Columns";e[e.Rows=2]="Rows";e[e.Both=3]="Both"}(AllowDragging=exports.AllowDragging||(exports.AllowDragging={}));class _MouseHandler{constructor(e){let t=e.hostElement,i=e.addEventListener.bind(e),l=e.removeEventListener.bind(e);this._g=e;this._dvMarker=wijmo_1.createElement('<div class="wj-marker">&nbsp;</div>');i(t,"mousedown",t=>{e._rcBounds=null;if(!t.defaultPrevented&&0==t.button){let s=t.target;if(!e.containsFocus()){let t=s instanceof HTMLElement&&s.tabIndex>-1?s:e._eFocus;e._setFocusNoScroll(t)}setTimeout(()=>{t.defaultPrevented||e.focus()});let o=wijmo_1.closestClass(s,_WJC_FLEXGRID);if(o&&o!=e.hostElement||!e.activeEditor&&e._isInputElement(s)&&!this._hasRadioMap(t)&&!e._isNativeCheckbox(s)){let i=e.hitTest(t),l=CellType;switch(i.cellType){case l.Cell:e.select(i.range,!1);s instanceof HTMLElement&&"root"!=s.getAttribute("wj-part")&&s.focus();break;case l.ColumnHeader:case l.ColumnFooter:e.scrollIntoView(-1,i.col);break;case l.RowHeader:e.scrollIntoView(i.row,-1)}wijmo_1.isIE()&&i.cellType!=l.Cell&&e._isInputElement(s)&&s.focus();return}if(e._isNativeCheckbox(s)&&wijmo_1.hasClass(s,"wj-column-selector")&&e.hitTest(t).cellType==CellType.RowHeader)return;let n=document;l(n,"mousemove");l(n,"mouseup");i(n,"mousemove",mouseMove);i(n,"mouseup",mouseUp);this._isDown=!0;this._mousedown(t)}});let mouseMove=e=>{this._mousemove(e)},mouseUp=e=>{this._isDown=!1;l(document,"mousemove");l(document,"mouseup");this._mouseup(e)};i(t,"mouseenter",t=>{e._rcBounds=null});i(t,"mousemove",this._hover.bind(this));i(t,"dblclick",this._dblclick.bind(this));i(t,"click",this._click.bind(this));i(t,"selectstart",t=>{e._isInputElement(t.target)||t.preventDefault()});wijmo_1.isSafari()&&i(t,"mousewheel",t=>{t.defaultPrevented||!t.wheelDeltaY||t.ctrlKey||t.metaKey||(e._isScrollingByWheel=!0)});i(t,"wheel",t=>{if(!t.defaultPrevented&&t.deltaY&&!t.ctrlKey&&!t.metaKey){let i=e._root,l=t.deltaY;if((t.shiftKey?i.scrollWidth>i.clientWidth:i.scrollHeight>i.clientHeight)&&wijmo_1.closestClass(t.target,_WJC_FLEXGRID)==e.hostElement){switch(t.deltaMode){case 1:l=e.rows.defaultSize*(l<0?-1:1);break;case 2:l=(t.shiftKey?i.clientWidth:i.clientHeight)*(l<0?-1:1);break;case 0:default:wijmo_1.isSafari()&&(l=wijmo_1.clamp(l,-150,150))}e._isScrollingByWheel=!0;wijmo_1.isEdge()&&(wijmo_1.Control.sharedState.InvalidScroll=!1);e.finishEditing(!1)&&(t.shiftKey?i.scrollLeft+=l:i.scrollTop+=l);t.preventDefault();t.stopImmediatePropagation()}}});i(t,"dragstart",this._dragstart.bind(this));i(t,"dragover",this._dragover.bind(this));i(t,"dragleave",this._dragleave.bind(this));i(t,"drop",this._drop.bind(this));i(t,"dragend",this._dragend.bind(this))}resetMouseState(){let e=this._g,t=e.hostElement;if(this._updating){this._updating=!1;e.endUpdate()}this._dragSrc&&wijmo_1.removeClass(this._dragSrc,_WJC_DRAGSRC);this._showDragMarker(null);t&&(t.style.cursor="");wijmo_1.isSafari()&&this._szRowCol&&e.invalidate();e.removeEventListener(document,"mousemove");e.removeEventListener(document,"mouseup");this._eMouse=null;this._isDown=null;this._htDown=null;this._lbSelState=null;this._lbSelStateRows={};this._lbSel=null;this._szRowCol=null;this._szArgs=null;e._rcBounds=null;this._anchorCol=-1}_mousedown(e){let t=this._g,i=e.target,l=t.hitTest(e),s=l.cellType,o=CellType,n=e.ctrlKey||e.metaKey;this._selDown=t.selection;this._ignoreClick=!1;if(null==l.panel&&null==t.cells||l.panel&&t.cells&&l.panel._uid==t.cells._uid){if(wijmo_1.closestClass(i,CellFactory._WJC_DROPDOWN)){let l=t.hitTest(i);t._edtHdl._toggleListBox(e,l.range);e.preventDefault();this._ignoreClick=!0;return}let s=t.editRange;if(s&&s.contains(l.range)){wijmo_1.Control.sharedState.InvalidScroll=wijmo_1.isEdge();return}}let r=wijmo_1.getActiveElement();if(i==r&&t._isInputElement(i))return;if(s==o.None){t.finishEditing();i!=t._root&&i!=t._fCt&&t._edtHdl._commitRowEdits();return}this._htDown=l;this._eMouse=e;this._anchorCol=l.col;if(null!=this._szRowCol){let i=t._eFocus;if(r!=i){i.tabIndex=0;i.focus()}this._ignoreClick=!0;this._handleResizing(e);return}let a=t.allowResizing,h=AllowResizing;if((s==o.RowHeader||s==o.TopLeft)&&l.edgeBottom&&a&h.Rows&&this._getResizeRowHt(l)){this._ignoreClick=!0;return}if((s==o.ColumnHeader||s==o.TopLeft)&&l.edgeRight&&a&h.Columns&&this._getResizeColHt(l)){this._ignoreClick=!0;return}let d=t.allowDragging,c=AllowDragging;switch(s){case o.Cell:case o.RowHeader:if(n&&t.selectionMode==SelectionMode.ListBox){this._lbSelState=t.rows[l.row].isSelected;wijmo_1.closest(i,".wj-elem-collapse")&&(this._lbSelState=!1)}this._mouseSelect(e,e.shiftKey);if(s==o.RowHeader&&!(d&c.Rows)){e.preventDefault();t.focus()}break;case o.ColumnHeader:t.allowSorting||d&c.Columns||wijmo_1.closest(i,"button")||this._mouseSelect(e,e.shiftKey)}}_mousemove(e){if(this._htDown&&!e.defaultPrevented){if(0==e.buttons&&this._eMouse&&e.timeStamp-this._eMouse.timeStamp>600){this.resetMouseState();return}this._eMouse=e;if(this._szRowCol)this._handleResizing(e);else{let t=this._g,i=t.allowDragging,l=AllowDragging,s=CellType;switch(this._htDown.cellType){case s.Cell:this._mouseSelect(e,!0);break;case s.RowHeader:i&l.Rows||this._mouseSelect(e,!0);break;case s.ColumnHeader:i&l.Columns||t.allowSorting||this._mouseSelect(e,!0)}}}}_mouseup(e){let t=this._g;if(t.isTouching&&(this._dragSrc||e.target instanceof HTMLHtmlElement))return;let i=t.hitTest(e),l=this._htDown;if(l&&!e.defaultPrevented){this._szArgs&&this._finishResizing(e);if(!this._szArgs&&(null==i.panel&&null==l.panel||i.panel&&l.panel&&i.panel._uid==l.panel._uid)&&i.row==l.row&&i.col==l.col){let t=i.getColumn();if(t){if(!(t._getFlag(RowColFlags.HasTemplate)&&!t.cellTemplate)){let t=i.target;if(t!=l.target&&t instanceof HTMLElement){if(l.target instanceof HTMLInputElement){let e=i.point,s=l.point;Math.abs(e.x-s.x)+Math.abs(e.y-s.y)<10&&(t=t.querySelector("input")||t)}let s=document.createEvent("Event");s.initEvent("click",!0,!0);for(let t in e)/Key$|X$|Y$|^button|^(x|y|which)$/.test(t)&&(s[t]=e[t]);t.dispatchEvent(s)}}}}}this.resetMouseState()}_click(e){if(this._ignoreClick){this._ignoreClick=!1;e.preventDefault()}if(!e.defaultPrevented){let t=this._g,i=e.target,l=t.hitTest(i),s=wijmo_1.tryCast(i,HTMLInputElement),o="input."+CellFactory._WJC_CHECKBOX;if(!s){let e=wijmo_1.closest(i,"label");e&&(s=e.querySelector(o))}!s&&t.bigCheckboxes&&(s=i.querySelector(o));if(s!=t.activeEditor&&t._isNativeCheckbox(s)){if(null==l.panel&&null==t.cells||l.panel&&t.cells&&l.panel._uid==t.cells._uid){let i=t.getCellData(l.row,l.col,!1);if(t.startEditing(!1,l.row,l.col,!1,e)){t.activeEditor.checked=!i;t.finishEditing();t.focus()}else"boolean"!=typeof i&&null!=i||(s.checked=i)}return}if(this._hasRadioMap(e)){this._handleClick(e);return}let n=e.ctrlKey||e.metaKey;if(t.rows.maxGroupLevel>-1&&wijmo_1.closestClass(i,CellFactory._WJC_COLLAPSE)){let e=t.rows[l.row];if(null==l.panel&&null==t.cells||l.panel&&t.cells&&l.panel._uid==t.cells._uid&&e instanceof GroupRow){n?t.collapseGroupsToLevel(e.isCollapsed?e.level+1:e.level):e.isCollapsed=!e.isCollapsed;return}}if(!n&&!e.shiftKey&&!t.activeEditor&&(null==l.panel&&null==t.cells||l.panel&&t.cells&&l.panel._uid==t.cells._uid)){let i=t._selHdl.selection;if(i.equals(this._selDown)&&l.range.contains(i)){t.startEditing(!0,null,null,!0,e);return}}this._handleClick(e)}}_handleClick(e){let t=this._g,i=e.target,l=t.hitTest(i),s=e.ctrlKey||e.metaKey,o=l.panel;if(!e.defaultPrevented&&l.grid&&t&&l.grid._uid==t._uid){if(o&&t.cells&&o._uid==t.cells._uid&&this._hasRadioMap(e)){let s=wijmo_1.closest(i,"label"),o=s&&s.querySelector("input");o&&!o.disabled&&t.startEditing(!1,l.row,l.col,!1,e)&&t.finishEditing()&&(t._edtHdl._edtCanceled?e.preventDefault():t.setCellData(l.row,l.col,s.textContent,!0,t.refreshOnEdit));return}if(!t._isInputElement(i)){if(o&&t.topLeftCells&&o._uid==t.topLeftCells._uid){let e=SelectionMode;switch(t.selectionMode){case e.None:case e.Cell:break;default:t.selectAll()}return}if(o&&t.columnHeaders&&o._uid==t.columnHeaders._uid){if(t.allowPinning&&wijmo_1.closestClass(i,CellFactory._WJC_PIN))this._clickPin(e,l);else if(!t._isTransposed()&&wijmo_1.closestClass(e.target,CellFactory._WJC_COLLAPSE)){let e=t._getColumnGroup(l.row,l.col);if(e)if(s){let i=e.isCollapsed,s=e.level,o=[];for(let n=0;n<t.columns.length;n++)if((e=t._getColumnGroup(l.row,n))&&e.collapseTo&&e.level==s&&o.indexOf(e)<0){o.push(e);e.isCollapsed=!i}}else e.isCollapsed=!e.isCollapsed}else{i instanceof HTMLSpanElement&&i.parentElement instanceof HTMLLabelElement&&(i=i.parentElement.querySelector("input"));i instanceof HTMLInputElement||this._clickSort(e,l);t.focus()}return}if(o&&t.rowHeaders&&o._uid==t.rowHeaders._uid){if(t._isTransposed()&&wijmo_1.closestClass(e.target,CellFactory._WJC_COLLAPSE)){let e=t._getColumnGroup(l.row,l.col);if(e)if(s){let i=e.isCollapsed,s=e.level,o=[];for(let n=0;n<t.rows.length;n++)if((e=t._getColumnGroup(n,l.col))&&e.collapseTo&&e.level==s&&o.indexOf(e)<0){o.push(e);e.isCollapsed=!i}}else e.isCollapsed=!e.isCollapsed}return}if(o&&t.cells&&o._uid==t.cells._uid){if(l.row<0){this._clickSort(e,l);return}if(wijmo_1.closestClass(i,CellFactory._WJC_COLLAPSE)){let e=t.rows[l.row];e instanceof GroupRow&&(s?t.collapseGroupsToLevel(e.isCollapsed?e.level+1:e.level):e.isCollapsed=!e.isCollapsed);return}wijmo_1.closestClass(i,CellFactory._WJC_DROPDOWN)&&t._edtHdl._toggleListBox(e,l.range)}}}}_hasRadioMap(e){let t=e.target;if(wijmo_1.closest(t,"label")){let e=wijmo_1.closestClass(t,CellFactory._WJC_RADIOMAP);return wijmo_1.closestClass(e,_WJC_FLEXGRID)==this._g.hostElement}return!1}_clickSort(e,t){let i=this._g,l=i.allowSorting,s=i.collectionView,o=s?s.sortDescriptions:null,n=e.ctrlKey||e.metaKey,r=e.shiftKey;if(!s||!s.canSort||l==AllowSorting.None)return;let a=t.panel.columns[t.col],h=i._getBindingColumn(t.panel,t.row,a),d=h?h._getBindingSort():null;if(!h.allowSorting||!d)return;if(a&&h&&a._uid==h._uid){let e=i.getMergedRange(t.panel,t.row,t.col,!1);if(e&&e.columnSpan>1)return}let c=new CellRangeEventArgs(t.panel,t.range,e);if(i.onSortingColumn(c)){i._edtHdl._commitRowEdits();let e=-1,t=null;for(let i=0;i<o.length;i++)if(o[i].property==d){e=i;t=o[i];break}o.deferUpdate(()=>{if(n&&r)o.clear();else if(t){let l=n;!l&&i.isTouching&&(l=0==t.ascending);l?o.removeAt(e):o[e]=new wijmo_1.SortDescription(d,!t.ascending)}else{l!=AllowSorting.MultiColumn&&o.clear();let e=new wijmo_1.SortDescription(d,!0);o.push(e)}});i.onSortedColumn(c)}}_clickPin(e,t){let i=this._g,l=i.columns,s=l.frozen,o=i.allowPinning;o==AllowPinning.Both&&(o=e.shiftKey?AllowPinning.ColumnRange:AllowPinning.SingleColumn);let n=new CellRangeEventArgs(i.cells,t.range);if(i.onPinningColumn(n)){if(o==AllowPinning.SingleColumn)if(t.col>=s){l.moveElement(t.col,s,!1);l.frozen++}else{l.moveElement(t.col,s-1,!1);l.frozen--}o==AllowPinning.ColumnRange&&(t.col+1!=s?l.frozen=t.col+1:l.frozen=0);i.onPinnedColumn(n)}}_dblclick(e){if(e.defaultPrevented)return;let t,i=this._g,l=i.hitTest(e),s=e.ctrlKey||e.metaKey,o=l.range,n=l.cellType,r=CellType,a=i.selection,h=i.allowResizing,d=AllowResizing;if(l.edgeRight&&h&d.Columns){if(n==r.TopLeft){if(l.panel.columns[l.col].allowResizing){t=new CellRangeEventArgs(l.panel,new CellRange(-1,l.col));if(i.onAutoSizingColumn(t)&&i.onResizingColumn(t)){this._ignoreClick=!0;i.autoSizeColumn(l.col,!0);i.onAutoSizedColumn(t);i.onResizedColumn(t);e.preventDefault()}}}else if(n==r.ColumnHeader||h&_AR_ALLCELLS){n==r.ColumnHeader&&s&&a.containsColumn(l.col)&&(o=a);let h=n==r.RowHeader||n==r.BottomLeft;for(let s=o.leftCol;s<=o.rightCol;s++)if(l.panel.columns[s].allowResizing){t=new CellRangeEventArgs(l.panel,new CellRange(-1,s));if(i.onAutoSizingColumn(t)&&i.onResizingColumn(t)){this._ignoreClick=!0;i.autoSizeColumn(s,h);i.onResizedColumn(t);i.onAutoSizedColumn(t);e.preventDefault()}}}this.resetMouseState()}else if(l.edgeBottom&&h&d.Rows){if(n==r.TopLeft||n==r.BottomLeft){if(l.getRow().allowResizing){let s=n==r.TopLeft||null;t=new CellRangeEventArgs(l.panel,new CellRange(l.row,-1));if(i.onAutoSizingRow(t)&&i.onResizingRow(t)){this._ignoreClick=!0;i.autoSizeRow(l.row,s);i.onResizedRow(t);i.onAutoSizedRow(t);e.preventDefault()}}}else if(n==r.RowHeader||h&_AR_ALLCELLS){let n=l.panel,r=n==i.columnHeaders||n==i.columnFooters&&null;s&&a.containsRow(l.row)&&n&&i.cells&&n._uid==i.cells._uid&&(o=a);for(let l=o.topRow;l<=o.bottomRow;l++)if(n.rows[l].allowResizing){t=new CellRangeEventArgs(n,new CellRange(l,-1));if(i.onAutoSizingRow(t)&&i.onResizingRow(t)){this._ignoreClick=!0;i.autoSizeRow(l,r);i.onResizedRow(t);i.onAutoSizedRow(t);e.preventDefault()}}}this.resetMouseState()}else;}_hover(e){if(!this._isDown){let t=this._g,i=t.hitTest(e),l="";this._szRowCol=this._getResizeColHt(i)||this._getResizeRowHt(i);this._szRowCol instanceof Column?l="col-resize":this._szRowCol instanceof Row&&(l="row-resize");this._szStart=this._szRowCol?this._szRowCol.renderSize:0;t.hostElement.style.cursor=l;return i}return null}_getResizeColHt(e){let t,i=this._g.allowResizing,l=e.cellType,s=CellType;if(i&AllowResizing.Columns&&(l==s.ColumnHeader||l==s.TopLeft||i&_AR_ALLCELLS)){e.edgeRight&&(t=e.getColumn());e.edgeFarRight&&(t=this._getResizeCol(e.panel,e.col)||e.getColumn());e.edgeLeft&&(t=this._getResizeCol(e.panel,e.col,!0)||t)}return t&&t.allowResizing?t:null}_getResizeRowHt(e){let t,i=this._g.allowResizing,l=AllowResizing,s=e.cellType,o=CellType;if(i&l.Rows&&(s==o.RowHeader||s==o.TopLeft||i&_AR_ALLCELLS)){e.edgeBottom&&(t=e.getRow());e.edgeFarBottom&&(t=this._getResizeRow(e.panel,e.row)||e.getRow());e.edgeTop&&(t=this._getResizeRow(e.panel,e.row,!0)||t)}return t&&t.allowResizing?t:null}_getResizeCol(e,t,i=!1){let l=this._g,s=e.columns;if(i){for(let e=t-1;e>=0;e--){let t=s[e];if(t.isVisible)return this._asResizable(t)}if(s==l.columns&&0!=(l.headersVisibility&HeadersVisibility.Row))for(let e=(s=l.rowHeaders.columns).length-1;e>=0;e--){let t=s[e];if(t.isVisible)return this._asResizable(t)}return null}for(let e=t+1;e<s.length;e++){let t=s[e];if(t.isVisible)return this._asResizable(t)}if(t==s.length-1&&s==l.rowHeaders.columns){s=l.columns;for(let e=0;e<s.length;e++){let t=s[e];if(t.isVisible)return this._asResizable(t)}}return null}_getResizeRow(e,t,i=!1){let l=this._g,s=e.rows;if(i){for(let e=t-1;e>=0;e--){let t=s[e];if(t.isVisible)return this._asResizable(t)}if(s==l.rows&&0!=(l.headersVisibility&HeadersVisibility.Column))for(let e=(s=l.columnHeaders.rows).length-1;e>=0;e--){let t=s[e];if(t.isVisible)return this._asResizable(t)}return null}for(let e=t+1;e<s.length;e++){let t=s[e];if(t.isVisible)return this._asResizable(t)}if(t==s.length-1&&s==l.columnHeaders.rows){s=l.rows;for(let e=0;e<s.length;e++){let t=s[e];if(t.isVisible)return this._asResizable(t)}}return null}_asResizable(e){return 0==e.renderSize&&e.allowResizing?e:null}_mouseSelect(e,t){let i=this._g;if(e&&this._htDown&&this._htDown.panel&&i.selectionMode!=SelectionMode.None){let l=new HitTestInfo(this._htDown.panel,e);this._handleSelection(l,t);!wijmo_1.isIE9()&&e.button>=0&&e.target!=i._root&&((l=new HitTestInfo(i,e)).panel||setTimeout(()=>{this._isDown&&this._eMouse&&this._mouseSelect(this._eMouse,t)},100))}}_handleResizing(e){"mousedown"==e.type&&(wijmo_1.isSafari()?wijmo_1.setAttribute(e.target,"draggable",null):e.preventDefault());let t=this._szRowCol,i=CellType;if(t instanceof Column){let l=this._g,s=wijmo_1.mouseToPage(e).x,o=Math.round(Math.max(_MouseHandler._SZ_MIN,this._szStart+(s-this._htDown.point.x)*(l.rightToLeft?-1:1)));if(t.renderSize!=o){if(null==this._szArgs){let e=l.rowHeaders.columns.indexOf(t)>-1?l.rowHeaders:l.cells;this._szArgs=new CellRangeEventArgs(e,new CellRange(-1,t.index))}this._szArgs.cancel=!1;if(l.onResizingColumn(this._szArgs))if(l.deferResizing){let e=l.columns.indexOf(t);if(l.columns.isFrozen(e)&&(this._htDown.cellType==i.ColumnHeader||this._htDown.cellType===i.Cell)){let t=0;for(let i=0;i<l.columns.frozen;i++)i!=e&&(t+=null==l.columns[i].width?l.columns[i].renderWidth:l.columns[i].width);let i=l._szClient.width-t-5;o>i&&(o=i)}this._showResizeMarker(o)}else t.width=o}}let l=this._szRowCol;if(l instanceof Row){let t=this._g,s=wijmo_1.mouseToPage(e).y,o=Math.round(Math.max(_MouseHandler._SZ_MIN,this._szStart+(s-this._htDown.point.y)));if(l.renderSize!=o){if(null==this._szArgs){let e=t.columnHeaders.rows.indexOf(l)>-1?t.columnHeaders:t.columnFooters.rows.indexOf(l)>-1?t.columnFooters:t.cells;this._szArgs=new CellRangeEventArgs(e,new CellRange(l.index,-1))}this._szArgs.cancel=!1;if(t.onResizingRow(this._szArgs))if(t.deferResizing){let e=t.rows.indexOf(l);if(t.rows.isFrozen(e)&&(this._htDown.cellType==i.RowHeader||this._htDown.cellType===i.Cell)){let i=0;for(let l=0;l<t.rows.frozen;l++)l!=e&&(i+=null==t.rows[l].height?t.rows[l].renderHeight:t.rows[l].height);let l=t._szClient.height-i-5;o>l&&(o=l)}this._showResizeMarker(o)}else l.height=o}}this._szArgs&&e.preventDefault()}_dragstart(e){let t=this._g,i=this._htDown,l=AllowDragging,s=CellType;if(i){this._dragSrc=null;this._htDrag=null;this._chldColGrpMarker=!1;if(!this._szRowCol){let o=new CellRangeEventArgs(i.panel,i.range),n=t.allowDragging,r=i.cellType,a=i.panel.rows,h=i.getColumn(!0);h&&h.allowDragging&&(r==s.ColumnHeader||r==s.TopLeft)&&n&l.Columns&&(t.onDraggingColumn(o)?this._dragSrc=e.target:e.preventDefault());if(!this._dragSrc&&i.row>-1&&a[i.row].allowDragging){let h=a[i.row];h instanceof GroupRow||h instanceof _NewRowTemplate||r==s.RowHeader&&n&l.Rows&&(t.onDraggingRow(o)?this._dragSrc=e.target:e.preventDefault())}}if(this._dragSrc&&e.dataTransfer&&!e.defaultPrevented){this._htDrag=i;wijmo_1._startDrag(e.dataTransfer,"move");e.stopPropagation();wijmo_1.addClass(this._dragSrc,_WJC_DRAGSRC);t.beginUpdate();this._updating=!0}}}_dragend(e){this._dragSrc=null;this._htDrag=null;this.resetMouseState()}_dragover(e){let t=this._g,i=this._hitTest(e),l=this._dragSrc?this._htDrag:null,s=CellType,o=!1;if(l&&i.cellType==l.cellType){let e=new CellRangeEventArgs(i.panel,i.range,l);if(i.cellType==s.ColumnHeader&&t._hasColumnGroups()){e.cancel=!t._canMoveColumnGroup(l.row,l.col,i.row,i.col);o=t.onDraggingColumnOver(e)}else if(i.cellType==s.ColumnHeader){e.cancel=!t.columns.canMoveElement(l.col,i.col);o=t.onDraggingColumnOver(e)}else if(i.cellType==s.RowHeader){e.cancel=!t.rows.canMoveElement(l.row,i.row);o=t.onDraggingRowOver(e)}else if(i.cellType==s.TopLeft){e.cancel=!t.topLeftCells.columns.canMoveElement(l.col,i.col);o=t.onDraggingColumnOver(e)}}if(o){e.dataTransfer.dropEffect="move";e.preventDefault();e.stopPropagation();this._showDragMarker(i)}else this._showDragMarker(null);if(l&&t.autoScroll){let i=t.controlRect,s=t.scrollPosition,o=wijmo_1.Control._DRAG_SCROLL_EDGE,n=wijmo_1.Control._DRAG_SCROLL_STEP;if(l.panel==t.columnHeaders){e.pageX-i.left<o&&(s.x+=n);i.right-e.pageX<o&&(s.x-=n)}else if(l.panel==t.rowHeaders){e.pageY-i.top<o&&(s.y+=n);i.bottom-e.pageY<o&&(s.y-=n)}if(!s.equals(t._ptScrl)){t.scrollPosition=s;t._rcBounds=null}}}_dragleave(e){this._showDragMarker(null)}_drop(e){let t=this._g,i=this._hitTest(e),l=this._dragSrc?this._htDrag:null,s=CellType;if(l&&i.cellType==l.cellType){let e=t.selection,o=new CellRangeEventArgs(i.panel,i.range,l);if(i.cellType==s.ColumnHeader&&t._hasColumnGroups()){let s=t._getColumnGroup(l.row,l.col).columns.length,n=s>0?s:1,r=t.columns.frozen;t._moveColumnGroup(l.row,l.col,i.row,i.col,this._chldColGrpMarker);l.col<r&&i.col>=r?t.columns.frozen-=n:l.col>=r&&i.col<r&&(t.columns.frozen+=n);t.select(e.row,i.col);t.onDraggedColumn(o)}else if(i.cellType==s.ColumnHeader){t.columns.moveElement(l.col,i.col);t.select(e.row,i.col);t.onDraggedColumn(o)}else if(i.cellType==s.RowHeader){t.rows.moveElement(l.row,i.row);t.select(i.row,e.col);t.onDraggedRow(o)}else if(i.cellType==s.TopLeft){t.topLeftCells.columns.moveElement(l.col,i.col);t.onDraggedColumn(o)}}this.resetMouseState()}_hitTest(e){let t=this._g;t._rcBounds=null;return t.hitTest(e)}_showResizeMarker(e){let t,i=this._g,l=i._ptScrl,s=this._szArgs.panel.cellType,o=CellType,n=this._dvMarker,r=i.cells.hostElement;n.parentElement!=r&&r.appendChild(n);if(this._szRowCol instanceof Column){t={left:this._szRowCol.pos+e-1,top:-1e3,right:"",bottom:0,width:3,height:""};s!=o.TopLeft&&s!=o.RowHeader||(t.left-=i._eTL.offsetWidth+l.x);s==o.Cell&&this._szRowCol.index<i.columns.frozen&&(t.left-=l.x);i.rightToLeft&&(t.left=r.clientWidth-t.left-t.width)}else{t={left:-1e3,top:this._szRowCol.pos+e-1,right:0,bottom:"",width:"",height:3};s!=o.TopLeft&&s!=o.ColumnHeader||(t.top-=i._eTL.offsetHeight+l.y);s==o.Cell&&this._szRowCol.index<i.rows.frozen&&(t.top-=l.y)}wijmo_1.setCss(n,t)}_showDragMarker(e){let t=this._dvMarker;if(!e||!e.panel){wijmo_1.removeChild(t);this._rngTarget=null;return}if(e.range.equals(this._rngTarget))return;this._rngTarget=e.range;let i=e.panel.hostElement;t.parentElement!=i&&i.appendChild(t);let l=this._g,s=l._ptScrl,o=CellType,n={left:0,top:0,width:6,height:6,right:"",bottom:""};switch(e.cellType){case o.ColumnHeader:let i=l._getColumnGroup(e.row,e.col);if(i){let s=i._rng,o=e.panel.rows,r=e.panel.columns;if(i.isEmpty&&null===i.binding){let i=o[s.bottomRow],a=r[s.leftCol],h=l.rightToLeft,d=h?t.parentElement.clientWidth-e.point.x:e.point.x,c=Math.max(a.renderWidth/5,_MouseHandler._SZ_MAX_COLGRP_EDGE),_=a.pos+c,u=a.pos+a.renderWidth-c,g=this._htDown&&e.col>this._htDown.col;if(!g&&d>_||g&&d<u){n.top=i.pos-n.height/2+i.renderHeight;n.left=h?t.parentElement.clientWidth-a.pos-a.renderWidth:a.pos;n.width=a.renderWidth;this._chldColGrpMarker=!0;break}}this._chldColGrpMarker=!1;n.top=0;n.height=0;for(let e=0;e<s.topRow;e++)n.top+=o[e].renderHeight;for(let e=s.topRow;e<=s.bottomRow;e++)n.height+=o[e].renderHeight;n.left=0;if(this._htDown&&e.col>this._htDown.col){let e=r[s.rightCol];n.left=e.pos-n.width/2+e.renderWidth}else{let e=r[s.leftCol];n.left=e.pos-n.width/2}l.rightToLeft&&(n.left=t.parentElement.clientWidth-n.left-n.width);break}case o.TopLeft:case o.ColumnHeader:let r=e.panel.columns[e.col];n.left=r.pos-n.width/2;n.height=e.panel.height;this._htDown&&e.col>this._htDown.col&&(n.left+=r.renderWidth);e.cellType==o.ColumnHeader&&e.col<l.columns.frozen&&(n.left-=s.x);l.rightToLeft&&(n.left=t.parentElement.clientWidth-n.left-n.width);break;case o.RowHeader:let a=e.getRow();n.top=a.pos-n.height/2;n.width=e.panel.width;e.row>this._htDown.row&&(n.top+=a.renderHeight);e.row<l.rows.frozen&&(n.top-=s.y)}wijmo_1.setCss(t,n)}_finishResizing(e){let t=this._g,i=t.selection,l=this._szArgs,s=this._eMouse,o=s&&(s.ctrlKey||s.metaKey),n=CellType;if(l&&!l.cancel){if(l.col>-1){let s=l.col,r=wijmo_1.mouseToPage(e).x,a=Math.round(Math.max(_MouseHandler._SZ_MIN,this._szStart+(r-this._htDown.point.x)*(this._g.rightToLeft?-1:1)));if(t.columns.isFrozen(s)&&(this._htDown.cellType==n.ColumnHeader||this._htDown.cellType===n.Cell)){let e=0;for(let i=0;i<t.columns.frozen;i++)i!=s&&(e+=null==t.columns[i].width?t.columns[i].renderWidth:t.columns[i].width);let i=t._szClient.width-e-5;a>i&&(a=i)}l.panel.columns[s].width=Math.round(a);t.onResizedColumn(l);if(o&&this._htDown.cellType==n.ColumnHeader&&i.containsColumn(s)){let e=t.columns[s].size;for(let o=i.leftCol;o<=i.rightCol;o++)if(t.columns[o].allowResizing&&o!=s){l=new CellRangeEventArgs(t.cells,new CellRange(-1,o));if(t.onResizingColumn(l)){if(t.columns.isFrozen(o)){let i=t.columns[s].size*t.columns.frozen;t._szClient.width<=i&&(e=t._szClient.width/t.columns.frozen-5)}t.columns[o].size=e;t.onResizedColumn(l)}}t.columns.isFrozen(s)&&(t.columns[s].size=e)}e.preventDefault()}if(l.row>-1){let s=l.row,r=wijmo_1.mouseToPage(e).y,a=Math.round(Math.max(_MouseHandler._SZ_MIN,this._szStart+(r-this._htDown.point.y)));if(t.rows.isFrozen(s)&&(this._htDown.cellType==n.RowHeader||this._htDown.cellType===n.Cell)){let e=0;for(let i=0;i<t.rows.frozen;i++)i!=s&&(e+=null==t.rows[i].height?t.rows[i].renderHeight:t.rows[i].height);let i=t._szClient.height-e-5;a>i&&(a=i)}l.getRow().height=Math.round(a);if("setHeights"in t){const e=t;e.setHeights(Array.from(e.rows).map(e=>e.height))}t.onResizedRow(l);if(o&&this._htDown.cellType==n.RowHeader&&i.containsRow(s)){let e=t.rows[s].size;for(let o=i.topRow;o<=i.bottomRow;o++)if(t.rows[o].allowResizing&&o!=s){l=new CellRangeEventArgs(t.cells,new CellRange(o,-1));if(t.onResizingRow(l)){if(t.rows.isFrozen(o)){let i=t.rows[s].size*t.rows.frozen;t._szClient.height<=i&&(e=t._szClient.height/t.rows.frozen-5)}t.rows[o].size=e;t.onResizedRow(l)}}t.rows.isFrozen(s)&&(t.rows[s].size=e)}t.rows[s].resizedManually=!0;e.preventDefault()}}}_handleSelection(e,t){let i=this._g,l=i._selHdl.selection,s=new CellRange(e.row,e.col),o=CellType,n=SelectionMode,r=null,a=e.col>=this._anchorCol;if(s.isValid)if(null==this._lbSelState){e.cellType!=o.ColumnHeader&&i._clearAnchorCell();switch(e.cellType){case o.RowHeader:s.col=0;s.col2=i.columns.length-1;break;case o.ColumnHeader:switch(i.selectionMode){case n.Row:case n.Cell:s.row=s.row2=l.row;t=!1;break;default:s.row=0;s.row2=i.rows.length-1;if(null!=(r=i._getColumnGroup(e.row,e.col))){if(i.anchorCursor){r._rng.col<=this._anchorCol&&this._anchorCol<=r._rng.col2&&(this._anchorCol=r._rng.col2);i._setAnchorCell(0,this._anchorCol)}else r._rng.col<this._anchorCol&&this._anchorCol<=r._rng.col2&&(this._anchorCol=r._rng.col);if(a){s.col=r._rng.col2;s.col2=r._rng.col}else{s.col=r._rng.col;s.col2=r._rng.col2;l.col2<s.col2&&(l.col2=s.col2)}}}}if(t){if(e.cellType==o.ColumnHeader){i.anchorCursor?null==i._getAnchorCell()&&i.selectionMode!=SelectionMode.Row&&i.selectionMode!=SelectionMode.Cell&&i._setAnchorCell(l.row,l.col):i._clearAnchorCell();s.row2=l.row2;!a&&l.col>l.col2?s.col2=l.col:s.col2=l.col2;null!=r&&a&&s.col2>r._rng.col&&(s.col2=r._rng.col)}else if(i.anchorCursor){s.row=l.row;s.col=l.col}else{s.row2=l.row2;s.col2=l.col2}if(!s.isValid){let e=this._htDown;e&&(s=new CellRange(e.row,e.col))}}if(i.selectionMode==SelectionMode.MultiRange){let l=i._mouseHdl._eMouse,o=l&&(l.ctrlKey||l.metaKey),n=i._selHdl,r=n.selection,a=n.extendedSelection,h=e.panel!=i.cells;wijmo_1.closest(l.target,".wj-elem-collapse")&&(o=!1);if(o){if(!t&&n._deselectRange(s))n.selection.isValid&&(s=null);else if(r.isValid&&(h||!r.intersects(s))){let e=this._g,t=e._selHdl,i=t.extendedSelection;if(e._getProductInfo().indexOf("MultiRow")>-1){let e=!1;r=t.selection.clone();for(let t=0;t<i.length&&!e;t++)i[t].equals(r)&&(e=!0);e||i.push(r)}else{let e=t.selection;(h?this._splitRange(e):[e.clone()]).forEach(e=>{let t=!1;for(let l=0;l<i.length&&!t;l++)i[l].equals(e)&&(t=!0);t||i.push(e)})}}}else a.clear()}if(s){i.select(s,!1);switch(e.cellType){case o.RowHeader:i.scrollIntoView(e.row,-1);break;case o.ColumnHeader:i.scrollIntoView(-1,e.col);break;default:i.scrollIntoView(e.row,e.col)}}else{let t=new CellRangeEventArgs(i.cells,new CellRange(e.row,e.col));i.onSelectionChanging(t);i.onSelectionChanged(t);i.invalidate()}}else{let t=this._htDown.row,l=e.row,s=this._lbSel;if(t>l){l=t;t=e.row}let o=this._lbSelStateRows||{};if(this._lbSel)for(let e=s.row;e<=s.row2;e++)(e<t||e>l)&&(i.rows[e].isSelected=o[e]);for(let e=t;e<=l;e++){o.hasOwnProperty(e)||(o[e]=i.rows[e].isSelected);i.rows[e].isSelected=!this._lbSelState}this._lbSel=new CellRange(t,0,l,0);i.scrollIntoView(e.row,e.col)}}_splitRange(e){let t=this._g,i=t.columns.length,l=t.rows.length,s=[];if(e.columnSpan==i)for(let t=e.topRow;t<=e.bottomRow;t++)s.push(new CellRange(t,0,t,i-1));else if(e.rowSpan==l)for(let t=e.leftCol;t<=e.rightCol;t++)s.push(new CellRange(0,t,l-1,t));else s.push(e.clone());return s}}_MouseHandler._SZ_MIN=0;_MouseHandler._SZ_MAX_COLGRP_EDGE=50;exports._MouseHandler=_MouseHandler;wijmo_1._registerModule("wijmo.grid",selfModule);