canvas-datagrid 0.4.6 → 0.4.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +6 -0
- package/dist/canvas-datagrid.debug.js +6 -4
- package/dist/canvas-datagrid.debug.map +1 -1
- package/dist/canvas-datagrid.js +1 -1
- package/dist/canvas-datagrid.module.js +1 -1
- package/dist/canvas-datagrid.module.js.map +1 -1
- package/dist/types.d.ts +31 -6
- package/lib/docs.js +8 -3
- package/lib/events/index.js +1 -1
- package/lib/selections/index.js +4 -3
- package/package.json +3 -3
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
function _typeof(e){return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},_typeof(e)}function _defineProperty(e,t,o){return t in e?Object.defineProperty(e,t,{value:o,enumerable:!0,configurable:!0,writable:!0}):e[t]=o,e}function ownKeys(e,t){var o=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),o.push.apply(o,r)}return o}function _objectSpread2(e){for(var t=1;t<arguments.length;t++){var o=null!=arguments[t]?arguments[t]:{};t%2?ownKeys(Object(o),!0).forEach((function(t){_defineProperty(e,t,o[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(o)):ownKeys(Object(o)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(o,t))}))}return e}function _newArrowCheck(e,t){if(e!==t)throw new TypeError("Cannot instantiate an arrow function")}function _slicedToArray(e,t){return _arrayWithHoles(e)||_iterableToArrayLimit(e,t)||_unsupportedIterableToArray(e,t)||_nonIterableRest()}function _toConsumableArray(e){return _arrayWithoutHoles(e)||_iterableToArray(e)||_unsupportedIterableToArray(e)||_nonIterableSpread()}function _arrayWithoutHoles(e){if(Array.isArray(e))return _arrayLikeToArray(e)}function _arrayWithHoles(e){if(Array.isArray(e))return e}function _iterableToArray(e){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e))return Array.from(e)}function _iterableToArrayLimit(e,t){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e)){var o=[],r=!0,n=!1,l=void 0;try{for(var i,a=e[Symbol.iterator]();!(r=(i=a.next()).done)&&(o.push(i.value),!t||o.length!==t);r=!0);}catch(e){n=!0,l=e}finally{try{r||null==a.return||a.return()}finally{if(n)throw l}}return o}}function _unsupportedIterableToArray(e,t){if(e){if("string"==typeof e)return _arrayLikeToArray(e,t);var o=Object.prototype.toString.call(e).slice(8,-1);return"Object"===o&&e.constructor&&(o=e.constructor.name),"Map"===o||"Set"===o?Array.from(e):"Arguments"===o||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(o)?_arrayLikeToArray(e,t):void 0}}function _arrayLikeToArray(e,t){(null==t||t>e.length)&&(t=e.length);for(var o=0,r=new Array(t);o<t;o++)r[o]=e[o];return r}function _nonIterableSpread(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _nonIterableRest(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _createForOfIteratorHelper(e,t){var o;if("undefined"==typeof Symbol||null==e[Symbol.iterator]){if(Array.isArray(e)||(o=_unsupportedIterableToArray(e))||t&&e&&"number"==typeof e.length){o&&(e=o);var r=0,n=function(){};return{s:n,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:n}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var l,i=!0,a=!1;return{s:function(){o=e[Symbol.iterator]()},n:function(){var e=o.next();return i=e.done,e},e:function(e){a=!0,l=e},f:function(){try{i||null==o.return||o.return()}finally{if(a)throw l}}}}function defaults(e){e.defaults={attributes:[["allowColumnReordering",!0],["allowColumnResize",!0],["allowColumnResizeFromCell",!1],["allowFreezingRows",!1],["allowFreezingColumns",!1],["allowMovingSelection",!0],["allowRowHeaderResize",!0],["allowRowReordering",!1],["allowRowResize",!0],["allowRowResizeFromCell",!1],["allowSorting",!0],["allowGroupingRows",!0],["allowGroupingColumns",!0],["animationDurationShowContextMenu",50],["animationDurationHideContextMenu",50],["autoGenerateSchema",!1],["autoResizeColumns",!1],["autoResizeRows",!1],["autoScrollOnMousemove",!1],["autoScrollMargin",5],["allowShrinkingSelection",!1],["blanksText","(Blanks)"],["borderDragBehavior","none"],["borderResizeZone",10],["clearCellsWhenShrinkingSelection",!1],["clearSettingsOptionText","Clear saved settings"],["columnHeaderClickBehavior","sort"],["columnSelectorHiddenText"," "],["columnSelectorText","Add/Remove columns"],["columnSelectorVisibleText","✓"],["contextHoverScrollAmount",2],["contextHoverScrollRateMs",5],["copyHeadersOnSelectAll",!0],["copyText","Copy"],["debug",!1],["editable",!0],["ellipsisText","..."],["filterOptionText","Filter %s"],["filterTextPrefix","(filtered) "],["filterFrozenRows",!0],["globalRowResize",!1],["hideColumnText","Hide %s"],["showUnhideColumnsIndicator",!1],["showUnhideRowsIndicator",!1],["showHideRow","Hide row %s"],["showHideRows","Hide rows %s"],["hoverMode","cell"],["keepFocusOnMouseOut",!1],["maxAutoCompleteItems",200],["multiLine",!1],["name",""],["pageUpDownOverlap",1],["pasteText","Paste"],["persistantSelectionMode",!1],["removeFilterOptionText","Remove filter on %s"],["reorderDeadZone",3],["resizeAfterDragged",!1],["resizeScrollZone",20],["rowGrabZoneSize",5],["columnGrabZoneSize",30],["saveAppearance",!0],["scrollAnimationPPSThreshold",.75],["scrollPointerLock",!1],["scrollRepeatRate",75],["selectionFollowsActiveCell",!1],["selectionHandleBehavior","none"],["selectionMode","cell"],["selectionScrollIncrement",20],["selectionScrollZone",20],["showClearSettingsOption",!0],["showColumnHeaders",!0],["showColumnSelector",!0],["showCopy",!1],["showFilter",!0],["showFilterInCell",!1],["showNewRow",!1],["showOrderByOption",!0],["showOrderByOptionTextAsc","Order by %s ascending"],["showOrderByOptionTextDesc","Order by %s descending"],["showGroupColumns","Group columns %s"],["showGroupRows","Group rows %s"],["showRemoveGroupColumns","Remove group %s"],["showRemoveGroupRows","Remove group %s"],["showRemoveAllGroupColumns","Remove all column groups"],["showRemoveAllGroupRows","Remove all row groups"],["showExpandAllGroupColumns","Expand all column groups"],["showExpandAllGroupRows","Expand all row groups"],["showCollapseAllGroupColumns","Collapse all column groups"],["showCollapseAllGroupRows","Collapse all row groups"],["columnGroupIndicatorPosition","right"],["rowGroupIndicatorPosition","bottom"],["showPaste",!1],["showPerformance",!1],["showRowHeaders",!0],["showRowNumbers",!0],["showRowNumberGaps",!0],["singleSelectionMode",!1],["snapToRow",!1],["sortFrozenRows",!0],["touchContextMenuTimeMs",800],["touchDeadZone",3],["touchEasingMethod","easeOutQuad"],["touchReleaseAcceleration",1e3],["touchReleaseAnimationDurationMs",2e3],["touchScrollZone",20],["touchSelectHandleZone",20],["touchZoomSensitivity",.005],["touchZoomMin",.5],["touchZoomMax",1.75],["maxPixelRatio",2],["tree",!1],["treeHorizontalScroll",!1],["rowTree",[]],["rowTreeColIndex",0],["columnTree",[]],["columnTreeRowStartIndex",0],["columnTreeRowEndIndex",0]],styles:[["activeCellBackgroundColor","rgba(255, 255, 255, 1)"],["activeCellBorderColor","rgba(110, 168, 255, 1)"],["activeCellBorderWidth",1],["activeCellColor","rgba(0, 0, 0, 1)"],["activeCellFont","16px sans-serif"],["activeCellHoverBackgroundColor","rgba(255, 255, 255, 1)"],["activeCellHorizontalAlignment","left"],["activeCellHoverColor","rgba(0, 0, 0, 1)"],["activeCellOverlayBorderColor","rgba(66, 133, 244, 1)"],["activeCellOverlayBorderWidth",1],["activeCellPaddingBottom",5],["activeCellPaddingLeft",5],["activeCellPaddingRight",5],["activeCellPaddingTop",5],["activeCellSelectedBackgroundColor","rgba(236, 243, 255, 1)"],["activeCellSelectedColor","rgba(0, 0, 0, 1)"],["activeCellVerticalAlignment","center"],["activeColumnHeaderCellBackgroundColor","rgba(225, 225, 225, 1)"],["activeColumnHeaderCellColor","rgba(0, 0, 0, 1)"],["activeRowHeaderCellBackgroundColor","rgba(225, 225, 225, 1)"],["activeRowHeaderCellColor","rgba(0, 0, 0, 1)"],["autocompleteBottomMargin",60],["autosizeHeaderCellPadding",8],["autosizePadding",5],["buttonActiveBackgroundColor","rgba(255, 255, 255, 1)"],["buttonActiveBorderColor","rgba(110, 168, 255, 1)"],["buttonArrowColor","rgba(50, 50, 50, 1)"],["buttonArrowDownHTML","▼"],["buttonZIndex",1e4],["buttonBackgroundColor","rgba(255, 255, 255, 1)"],["buttonBorderColor","rgba(172, 172, 172, 1)"],["buttonHoverBackgroundColor","rgba(240, 240, 240, 1)"],["buttonMenuWindowMargin",30],["buttonPadding","3px"],["cellAutoResizePadding",13],["cellBackgroundColor","rgba(255, 255, 255, 1)"],["cellBorderColor","rgba(195, 199, 202, 1)"],["cellBorderWidth",1],["cellColor","rgba(0, 0, 0, 1)"],["cellFont","16px sans-serif"],["cellGridHeight",250],["cellHeight",24],["cellHeightWithChildGrid",150],["cellHorizontalAlignment","left"],["cellHoverBackgroundColor","rgba(255, 255, 255, 1)"],["cellHoverColor","rgba(0, 0, 0, 1)"],["cellPaddingBottom",5],["cellPaddingLeft",5],["cellPaddingRight",5],["cellPaddingTop",5],["cellSelectedBackgroundColor","rgba(236, 243, 255, 1)"],["cellSelectedColor","rgba(0, 0, 0, 1)"],["cellTreeIconBorderColor","rgba(162, 174, 207, 1)"],["cellTreeIconFillColor","rgba(240, 240, 240, 1)"],["cellTreeIconHoverFillColor","rgba(198, 217, 233, 1)"],["cellTreeIconLineColor","rgba(43, 53, 81, 1)"],["cellTreeIconLineWidth",1.5],["cellTreeIconMarginLeft",0],["cellTreeIconMarginRight",5],["cellTreeIconMarginTop",6],["cellTreeIconWidth",13],["cellVerticalAlignment","center"],["cellWidth",250],["cellWidthWithChildGrid",250],["cellWhiteSpace","nowrap"],["cellLineHeight",1],["cellLineSpacing",3],["childContextMenuArrowColor","rgba(43, 48, 43, 1)"],["childContextMenuArrowHTML","►"],["childContextMenuMarginLeft",-11],["childContextMenuMarginTop",-6],["columnGroupRowHeight",25],["columnHeaderCellBackgroundColor","rgba(240, 240, 240, 1)"],["columnHeaderCellBorderColor","rgba(172, 172, 172, 1)"],["columnHeaderCellBorderWidth",1],["columnHeaderCellCapBackgroundColor","rgba(240, 240, 240, 1)"],["columnHeaderCellCapBorderColor","rgba(172, 172, 172, 1)"],["columnHeaderCellCapBorderWidth",1],["columnHeaderCellColor","rgba(50, 50, 50, 1)"],["columnHeaderCellFont","16px sans-serif"],["columnHeaderCellHeight",25],["columnHeaderCellHorizontalAlignment","left"],["columnHeaderCellHoverBackgroundColor","rgba(235, 235, 235, 1)"],["columnHeaderCellHoverColor","rgba(0, 0, 0, 1)"],["columnHeaderCellPaddingBottom",5],["columnHeaderCellPaddingLeft",5],["columnHeaderCellPaddingRight",5],["columnHeaderCellPaddingTop",5],["columnHeaderCellVerticalAlignment","center"],["columnHeaderOrderByArrowBorderColor","rgba(195, 199, 202, 1)"],["columnHeaderOrderByArrowBorderWidth",1],["columnHeaderOrderByArrowColor","rgba(155, 155, 155, 1)"],["columnHeaderOrderByArrowHeight",8],["columnHeaderOrderByArrowMarginLeft",0],["columnHeaderOrderByArrowMarginRight",5],["columnHeaderOrderByArrowMarginTop",6],["columnHeaderOrderByArrowWidth",13],["contextFilterButtonBorder","solid 1px rgba(158, 163, 169, 1)"],["contextFilterButtonBorderRadius","3px"],["contextFilterButtonHTML","▼"],["contextFilterInputBackground","rgba(255,255,255,1)"],["contextFilterInputBorder","solid 1px rgba(158, 163, 169, 1)"],["contextFilterInputBorderRadius","0"],["contextFilterInputColor","rgba(0,0,0,1)"],["contextFilterInputFontFamily","sans-serif"],["contextFilterInputFontSize","14px"],["contextFilterInvalidRegExpBackground","rgba(180, 6, 1, 1)"],["contextFilterInvalidRegExpColor","rgba(255, 255, 255, 1)"],["contextMenuArrowColor","rgba(43, 48, 43, 1)"],["contextMenuArrowDownHTML","▼"],["contextMenuArrowUpHTML","▲"],["contextMenuBackground","rgba(240, 240, 240, 1)"],["contextMenuBorder","solid 1px rgba(158, 163, 169, 1)"],["contextMenuBorderRadius","3px"],["contextMenuChildArrowFontSize","12px"],["contextMenuColor","rgba(43, 48, 43, 1)"],["contextMenuCursor","default"],["contextMenuFilterButtonFontFamily","sans-serif"],["contextMenuFilterButtonFontSize","10px"],["contextMenuFilterInvalidExpresion","rgba(237, 155, 156, 1)"],["contextMenuFontFamily","sans-serif"],["contextMenuFontSize","16px"],["contextMenuHoverBackground","rgba(182, 205, 250, 1)"],["contextMenuHoverColor","rgba(43, 48, 153, 1)"],["contextMenuItemBorderRadius","3px"],["contextMenuItemMargin","2px"],["contextMenuLabelDisplay","inline-block"],["contextMenuLabelMargin","0 3px 0 0"],["contextMenuLabelMaxWidth","700px"],["contextMenuLabelMinWidth","75px"],["contextMenuMarginLeft",3],["contextMenuMarginTop",-3],["contextMenuOpacity","0.98"],["contextMenuPadding","2px"],["contextMenuWindowMargin",30],["contextMenuZIndex",1e4],["cornerCellBackgroundColor","rgba(240, 240, 240, 1)"],["cornerCellBorderColor","rgba(202, 202, 202, 1)"],["debugBackgroundColor","rgba(0, 0, 0, .0)"],["debugColor","rgba(255, 15, 24, 1)"],["debugEntitiesColor","rgba(76, 231, 239, 1.00)"],["debugFont","11px sans-serif"],["debugPerfChartBackground","rgba(29, 25, 26, 1.00)"],["debugPerfChartTextColor","rgba(255, 255, 255, 0.8)"],["debugPerformanceColor","rgba(252, 255, 37, 1.00)"],["debugScrollHeightColor","rgba(248, 33, 103, 1.00)"],["debugScrollWidthColor","rgba(66, 255, 27, 1.00)"],["debugTouchPPSXColor","rgba(246, 102, 24, 1.00)"],["debugTouchPPSYColor","rgba(186, 0, 255, 1.00)"],["display","inline-block"],["editCellBackgroundColor","white"],["editCellBorder","solid 1px rgba(110, 168, 255, 1)"],["editCellBoxShadow","0 2px 5px rgba(0,0,0,0.4)"],["editCellColor","black"],["editCellFontFamily","sans-serif"],["editCellFontSize","16px"],["editCellPaddingLeft",4],["editCellZIndex",1e4],["filterButtonActiveBackgroundColor","rgba(225, 225, 225, 1)"],["filterButtonArrowBorderColor","rgba(195, 199, 202, 1)"],["filterButtonArrowBorderWidth",1],["filterButtonArrowClickRadius",5],["filterButtonArrowColor","rgba(50, 50, 50, 1)"],["filterButtonArrowHeight",5],["filterButtonArrowWidth",8],["filterButtonBackgroundColor","rgba(240, 240, 240, 1)"],["filterButtonBorderColor","rgba(172, 172, 172, 1)"],["filterButtonBorderRadius",3],["filterButtonHeight",20],["filterButtonHoverBackgroundColor","rgba(235, 235, 235, 1)"],["filterButtonMenuOffsetTop",10],["filterButtonWidth",20],["frozenMarkerHoverColor","rgba(165, 198, 254, 1)"],["frozenMarkerHoverBorderColor","rgba(165, 198, 254, 1)"],["frozenMarkerActiveColor","rgba(165, 198, 254, 0.2)"],["frozenMarkerActiveBorderColor","rgba(165, 198, 254, 0.5)"],["frozenMarkerActiveHeaderColor","rgba(165, 198, 254, 1)"],["frozenMarkerColor","rgba(221, 221, 221, 1)"],["frozenMarkerBorderColor","rgba(221, 221, 221, 1)"],["frozenMarkerBorderWidth",1],["frozenMarkerHeaderColor","rgba(188, 188, 188, 1)"],["frozenMarkerWidth",4],["groupingAreaBackgroundColor","rgba(240, 240, 240, 1)"],["gridBackgroundColor","rgba(240, 240, 240, 1)"],["gridBorderCollapse","collapse"],["gridBorderColor","rgba(202, 202, 202, 1)"],["gridBorderWidth",1],["groupIndicatorColor","rgba(155, 155, 155, 1)"],["groupIndicatorBackgroundColor","rgba(255, 255, 255, 1)"],["height","auto"],["maxHeight","inherit"],["maxWidth","inherit"],["minColumnWidth",45],["minHeight","inherit"],["minRowHeight",24],["minWidth","inherit"],["mobileContextMenuMargin",10],["mobileEditInputHeight",30],["mobileEditFontFamily","sans-serif"],["mobileEditFontSize","16px"],["moveOverlayBorderWidth",1],["moveOverlayBorderColor","rgba(66, 133, 244, 1)"],["moveOverlayBorderSegments","12, 7"],["name","default"],["overflowY","auto"],["overflowX","auto"],["reorderMarkerBackgroundColor","rgba(0, 0, 0, 0.1)"],["reorderMarkerBorderColor","rgba(0, 0, 0, 0.2)"],["reorderMarkerBorderWidth",1.25],["reorderMarkerIndexBorderColor","rgba(66, 133, 244, 1)"],["reorderMarkerIndexBorderWidth",2.75],["resizeMarkerColor","rgba(0, 0, 0, 0.2)"],["resizeMarkerSize",2],["rowGroupColumnWidth",25],["rowHeaderCellBackgroundColor","rgba(240, 240, 240, 1)"],["rowHeaderCellBorderColor","rgba(200, 200, 200, 1)"],["rowHeaderCellBorderWidth",1],["rowHeaderCellColor","rgba(50, 50, 50, 1)"],["rowHeaderCellFont","16px sans-serif"],["rowHeaderCellHeight",25],["rowHeaderCellHorizontalAlignment","left"],["rowHeaderCellHoverBackgroundColor","rgba(235, 235, 235, 1)"],["rowHeaderCellHoverColor","rgba(0, 0, 0, 1)"],["rowHeaderCellPaddingBottom",5],["rowHeaderCellPaddingLeft",5],["rowHeaderCellPaddingRight",5],["rowHeaderCellPaddingTop",5],["rowHeaderCellRowNumberGapHeight",5],["rowHeaderCellRowNumberGapColor","rgba(50, 50, 50, 1)"],["rowHeaderCellSelectedBackgroundColor","rgba(217, 217, 217, 1)"],["rowHeaderCellSelectedColor","rgba(50, 50, 50, 1)"],["rowHeaderCellVerticalAlignment","center"],["rowHeaderCellWidth",57],["scrollBarActiveColor","rgba(125, 125, 125, 1)"],["scrollBarBackgroundColor","rgba(240, 240, 240, 1)"],["scrollBarBorderColor","rgba(202, 202, 202, 1)"],["scrollBarBorderWidth",.5],["scrollBarBoxBorderRadius",4.125],["scrollBarBoxColor","rgba(192, 192, 192, 1)"],["scrollBarBoxMargin",2],["scrollBarBoxMinSize",15],["scrollBarBoxWidth",8],["scrollBarCornerBackgroundColor","rgba(240, 240, 240, 1)"],["scrollBarCornerBorderColor","rgba(202, 202, 202, 1)"],["scrollBarWidth",11],["selectionHandleBorderColor","rgba(255, 255, 255, 1)"],["selectionHandleBorderWidth",1.5],["selectionHandleColor","rgba(66, 133, 244, 1)"],["selectionHandleSize",8],["selectionHandleType","square"],["fillOverlayBorderColor","rgba(127, 127, 127, 1)"],["fillOverlayBorderWidth",2],["selectionOverlayBorderColor","rgba(66, 133, 244, 1)"],["selectionOverlayBorderWidth",1],["treeArrowBorderColor","rgba(195, 199, 202, 1)"],["treeArrowBorderWidth",1],["treeArrowClickRadius",5],["treeArrowColor","rgba(155, 155, 155, 1)"],["treeArrowHeight",8],["treeArrowMarginLeft",0],["treeArrowMarginRight",5],["treeArrowMarginTop",6],["treeArrowWidth",13],["treeGridHeight",250],["unhideIndicatorColor","rgba(0, 0, 0, 1)"],["unhideIndicatorBackgroundColor","rgba(255, 255, 255, 1)"],["unhideIndicatorBorderColor","rgba(174, 193, 232, 1)"],["unhideIndicatorSize",16],["width","auto"]]}}function component(){var e,t={};return t.dehyphenateProperty=function(e){e=e.replace("--cdg-","");var t,o="";return Array.prototype.forEach.call(e,(function(e){if(t)return t=!1,void(o+=e.toUpperCase());"-"!==e?o+=e:t=!0})),o},t.hyphenateProperty=function(e,t){var o="";return Array.prototype.forEach.call(e,(function(e){e!==e.toUpperCase()?o+=e:o+="-"+e.toLowerCase()})),(t?"--cdg-":"")+o},t.applyComponentStyle=function(o,r){if(r.isComponent){var n=window.getComputedStyle("CANVAS-DATAGRID"===r.tagName?r:r.canvas,null),l={};r.computedStyle=n,defaults(l),l.defaults.styles.forEach((function(o){var l;""===(l=n.getPropertyValue(t.hyphenateProperty(o[0],!0)))&&(l=n.getPropertyValue(t.hyphenateProperty(o[0],!1))),""!==l&&"string"==typeof l&&r.setStyleProperty(o[0],e[_typeof(o[1])](l.replace(/^\s+/,"").replace(/\s+$/,""),o[1]),!0)})),!o&&r.dispatchEvent&&(requestAnimationFrame((function(){r.resize(!0)})),r.dispatchEvent("stylechanged",r.style))}},e={data:function(e){try{return JSON.parse(e)}catch(e){throw new Error("Cannot read JSON data in canvas-datagrid data.")}},schema:function(e){try{return JSON.parse(e)}catch(e){throw new Error("Cannot read JSON data in canvas-datagrid schema attribute.")}},number:function(e,t){var o=parseInt(e,10);return isNaN(o)?t:o},boolean:function(e){return/true/i.test(e)},string:function(e){return e}},t.getObservableAttributes=function(){var e={},t=["data","schema","style","className","name"];return defaults(e),e.defaults.attributes.forEach((function(e){t.push(e[0].toLowerCase())})),t},t.disconnectedCallback=function(){this.connected=!1},t.connectedCallback=function(){var e=this;e.parentDOMNode.innerHTML="",e.parentDOMNode.appendChild(e.canvas),e.connected=!0,t.observe(e),t.applyComponentStyle(!0,e),e.resize(!0)},t.adoptedCallback=function(){this.resize()},t.attributeChangedCallback=function(o,r,n){var l,i,a=this;if("style"!==o){if("data"===o)return"application/x-canvas-datagrid"===a.dataType&&(a.dataType="application/json+x-canvas-datagrid"),void(a.data=n);if("schema"!==o)if("name"!==o){if("class"!==o&&"className"!==o){var s,c,d;if(s="attributes",c=o,defaults(d={}),i=d.defaults[s].filter((function(e){return e[0].toLowerCase()===c.toLowerCase()||t.hyphenateProperty(e[0])===c.toLowerCase()||t.hyphenateProperty(e[0],!0)===c.toLowerCase()}))[0],i)return l=e[_typeof(i[1])],void(a.attributes[i[0]]=l(n));/^on/.test(o)&&a.addEventListener("on"+o,Function("e",n))}}else a.name=n;else a.schema=e.schema(n)}else t.applyComponentStyle(!1,a)},t.observe=function(e){var o;window.MutationObserver&&(e.applyComponentStyle=function(){t.applyComponentStyle(!1,e),e.resize()},(o=new window.MutationObserver((function(t){var o,r;Array.prototype.forEach.call(t,(function(t){"class"!==t.attributeName&&"style"!==t.attributeName&&"STYLE"!==t.target.nodeName?t.target.parentNode&&"STYLE"===t.target.parentNode.nodeName?r=!0:t.target===e&&(t.addedNodes.length>0||"characterData"===t.type)&&(o=!0):r=!0})),r&&e.applyComponentStyle(!1,e),o&&("application/x-canvas-datagrid"===e.dataType&&(e.dataType="application/json+x-canvas-datagrid"),e.data=e.innerHTML)}))).observe(e,{characterData:!0,childList:!0,attributes:!0,subtree:!0}),Array.prototype.forEach.call(document.querySelectorAll("style"),(function(e){o.observe(e,{characterData:!0,childList:!0,attributes:!0,subtree:!0})})))},t}var _this=void 0,SelectionType={UnselectedCells:0,Cells:1,Rows:2,Columns:3},swapProps=function(e,t,o){_newArrowCheck(this,_this);var r=e[t];e[t]=e[o],e[o]=r}.bind(void 0),normalizeSelection=function(e){if(_newArrowCheck(this,_this),!e)return e;switch(e.type){case SelectionType.UnselectedCells:case SelectionType.Cells:"number"!=typeof e.endRow?e.endRow=e.startRow:e.endRow<e.startRow&&swapProps(e,"startRow","endRow"),"number"!=typeof e.endColumn?e.endColumn=e.startColumn:e.endColumn<e.startColumn&&swapProps(e,"startColumn","endColumn");break;case SelectionType.Rows:"number"!=typeof e.endRow?e.endRow=e.startRow:e.endRow<e.startRow&&swapProps(e,"startRow","endRow");break;case SelectionType.Columns:"number"!=typeof e.endColumn?e.endColumn=e.startColumn:e.endColumn<e.startColumn&&swapProps(e,"startColumn","endColumn")}return e}.bind(void 0),getSelectionFromString=function(e){var t=this;if(_newArrowCheck(this,_this),"string"==typeof e){var o=e.indexOf(":");if(!(o<0)){var r=e.slice(0,o),n=e.slice(o+1).split(/[,:;-]+/).map(function(e){return _newArrowCheck(this,t),parseInt(e,10)}.bind(this));switch(r){case"cell":case"cells":case"-cell":case"-cells":return normalizeSelection({type:SelectionType["-"===r[0]?"UnselectedCells":"Cells"],startRow:n[0],startColumn:n[1],endRow:n[2],endColumn:n[3]});case"row":case"rows":return normalizeSelection({type:SelectionType.Rows,startRow:n[0],endRow:n[1]});case"col":case"cols":return normalizeSelection({type:SelectionType.Columns,startColumn:n[0],endColumn:n[1]})}}}}.bind(void 0),isSameCellsBlock=function(e,t){return _newArrowCheck(this,_this),e.startRow===t.startRow&&e.endRow===t.endRow&&e.startColumn===t.startColumn&&e.endColumn===t.endColumn}.bind(void 0),mergeCellsIntoRowsOrColumns=function(e,t){return _newArrowCheck(this,_this),t.type===SelectionType.Rows?e.startRow>=t.startRow&&e.endRow<=t.endRow?t:void 0:e.startColumn>=t.startColumn&&e.endColumn<=t.endColumn?t:void 0}.bind(void 0),mergeSelections=function(e,t){if(_newArrowCheck(this,_this),e.type!==t.type)return t.type<=SelectionType.Cells&&e.type>SelectionType.Cells?mergeCellsIntoRowsOrColumns(t,e):e.type<=SelectionType.Cells&&t.type>SelectionType.Cells?mergeCellsIntoRowsOrColumns(e,t):void 0;var o=e.type===SelectionType.Columns||e.startRow===t.startRow&&e.endRow===t.endRow,r=e.type===SelectionType.Rows||e.startColumn===t.startColumn&&e.endColumn===t.endColumn;if(o){if(r)return e;if(t.startColumn>e.endColumn+1||t.endColumn<e.startColumn-1)return;return Object.assign({},e,{startColumn:Math.min(e.startColumn,t.startColumn),endColumn:Math.max(e.endColumn,t.endColumn)})}if(r){if(t.startRow>e.endRow+1||t.endRow<e.startRow-1)return;return Object.assign({},e,{startRow:Math.min(e.startRow,t.startRow),endRow:Math.max(e.endRow,t.endRow)})}if(e.type===SelectionType.Cells||e.type===SelectionType.UnselectedCells){var n=_getIntersection(e,t);if(n){if(isSameCellsBlock(n,e))return t;if(isSameCellsBlock(n,t))return e}}}.bind(void 0),removePartOfRowsSelection=function(e,t){if(_newArrowCheck(this,_this),!(t.endRow<e.startRow||t.startRow>e.endRow))return t.startRow<=e.startRow?t.endRow>=e.endRow?[]:[Object.assign({},e,{startRow:t.endRow+1})]:t.endRow>=e.endRow?[Object.assign({},e,{endRow:t.startRow-1})]:[Object.assign({},e,{endRow:t.startRow-1}),Object.assign({},e,{startRow:t.endRow+1})]}.bind(void 0),removePartOfColumnsSelection=function(e,t){if(_newArrowCheck(this,_this),!(t.endColumn<e.startColumn||t.startColumn>e.endColumn))return t.startColumn<=e.startColumn?t.endColumn>=e.endColumn?[]:[Object.assign({},e,{startColumn:t.endColumn+1})]:t.endColumn>=e.endColumn?[Object.assign({},e,{endColumn:t.startColumn-1})]:[Object.assign({},e,{endColumn:t.startColumn-1}),Object.assign({},e,{startColumn:t.endColumn+1})]}.bind(void 0),removePartOfCellsSelection=function(e,t){_newArrowCheck(this,_this);var o=_getIntersection(e,t);if(o){if(isSameCellsBlock(e,o))return[];var r=[],n=e.startRow,l=e.endRow,i=e.endColumn;return o.startRow>e.startRow&&(r.push(Object.assign({},e,{endRow:o.startRow-1})),n=o.startRow),o.endColumn<e.endColumn&&(r.push(Object.assign({},e,{startRow:n,startColumn:o.endColumn+1})),i=o.endColumn),o.endRow<e.endRow&&(r.push(Object.assign({},e,{endColumn:i,startRow:o.endRow+1})),l=o.endRow),o.startColumn>e.startColumn&&r.push(Object.assign({},e,{startRow:n,endRow:l,endColumn:o.startColumn-1})),r}}.bind(void 0),_getIntersection=function(e,t){if(_newArrowCheck(this,_this),e.type>t.type)return _getIntersection(t,e);if(e.type<=SelectionType.Cells){if(t.type<=SelectionType.Cells){var o=Math.max(e.startColumn,t.startColumn),r=Math.min(e.endColumn,t.endColumn);if(o>r)return;var n=Math.max(e.startRow,t.startRow),l=Math.min(e.endRow,t.endRow);if(n>l)return;return{type:SelectionType.Cells,startRow:n,startColumn:o,endRow:l,endColumn:r}}if(t.type===SelectionType.Rows){var i=Math.max(e.startRow,t.startRow),a=Math.min(e.endRow,t.endRow);if(i>a)return;return{type:SelectionType.Cells,startRow:i,startColumn:e.startColumn,endRow:a,endColumn:e.endColumn}}var s=Math.max(e.startColumn,t.startColumn),c=Math.min(e.endColumn,t.endColumn);if(s>c)return;return{type:SelectionType.Cells,startColumn:s,startRow:e.startRow,endColumn:c,endRow:e.endRow}}if(e.type===SelectionType.Rows){if(t.type===SelectionType.Rows){var d=Math.max(e.startRow,t.startRow),u=Math.min(e.endRow,t.endRow);if(d>u)return;return{type:SelectionType.Rows,startRow:d,endRow:u}}return{type:SelectionType.Cells,startRow:e.startRow,startColumn:t.startColumn,endRow:e.endRow,endColumn:t.endColumn}}var h=Math.max(e.startColumn,t.startColumn),f=Math.min(e.endColumn,t.endColumn);return h>f?void 0:{type:SelectionType.Columns,startColumn:h,endColumn:f}}.bind(void 0),_addIntoSelections=function(e,t,o){if(_newArrowCheck(this,_this),!t||"number"!=typeof t.type)return!1;if(t.type===SelectionType.Cells){for(var r=0;r<e.length;r++){var n=e[r];if(n.type!==SelectionType.UnselectedCells){if(n.type===SelectionType.Cells){var l=removePartOfCellsSelection(t,n);if(Array.isArray(l)){for(var i=!1,a=0;a<l.length;a++){_addIntoSelections(e,l[a],o)&&(i=!0)}return i&&cleanupSelections(e),i}}}else{var s=removePartOfCellsSelection(n,t);s&&(e.splice.apply(e,[r,1].concat(_toConsumableArray(s))),r+=s.length-1)}}if(o){var c,d,u=0===t.startRow&&t.endRow+1>=o.rows,h=0===t.startColumn&&t.endColumn+1>=o.columns;if(u&&(c=_addIntoSelections(e,{type:SelectionType.Columns,startColumn:t.startColumn,endColumn:t.endColumn},o)),h&&(d=_addIntoSelections(e,{type:SelectionType.Rows,startRow:t.startRow,endRow:t.endRow},o)),u||h)return c||d}return e.push(t),cleanupSelections(e),!0}var f=t.type===SelectionType.Rows;if(f||t.type===SelectionType.Columns){for(var g=0;g<e.length;g++){var m=e[g];if(m.type!==SelectionType.UnselectedCells){if(m.type===t.type){var p=mergeSelections(m,t);if(p){for(var w=g+1;w<e.length;w++)if(e[w].type===t.type){var v=mergeSelections(e[w],p);v&&(e.splice(w,1),w--,p=v)}return e[g]=p,cleanupSelections(e),!0}}}else{var y=removePartOfCellsSelection(m,f?{startRow:t.startRow,endRow:t.endRow,startColumn:0,endColumn:m.endColumn}:{startColumn:t.startColumn,endColumn:t.endColumn,startRow:0,endRow:m.endRow});y&&(e.splice.apply(e,[g,1].concat(_toConsumableArray(y))),g+=y.length-1)}}return e.push(t),cleanupSelections(e),!0}return!1}.bind(void 0),_removeFromSelections=function(e,t,o){if(_newArrowCheck(this,_this),!t||"number"!=typeof t.type)return!1;if(t.type===SelectionType.Cells){for(var r=0;r<e.length;r++){var n=e[r];if(n.type===SelectionType.UnselectedCells){var l=removePartOfCellsSelection(t,n);if(Array.isArray(l)){for(var i=!1,a=0;a<l.length;a++){_removeFromSelections(e,l[a],o)&&(i=!0)}return i&&cleanupSelections(e),i}}if(n.type!==SelectionType.Cells);else{var s=removePartOfCellsSelection(n,t);s&&(e.splice.apply(e,[r,1].concat(_toConsumableArray(s))),r+=s.length-1)}}if(o){var c,d,u=0===t.startRow&&t.endRow+1>=o.rows,h=0===t.startColumn&&t.endColumn+1>=o.columns;if(u&&(c=_removeFromSelections(e,{type:SelectionType.Columns,startColumn:t.startColumn,endColumn:t.endColumn},o)),h&&(d=_removeFromSelections(e,{type:SelectionType.Rows,startRow:t.startRow,endRow:t.endRow},o)),u||h)return c||d}return t.type=SelectionType.UnselectedCells,e.unshift(t),cleanupSelections(e),!0}var f=t.type===SelectionType.Rows;if(f||t.type===SelectionType.Columns){for(var g=!1,m=0;m<e.length;m++){var p=e[m];if(p.type!==SelectionType.Cells)if(p.type!==SelectionType.UnselectedCells)if(p.type===t.type){var w=f?removePartOfRowsSelection(p,t):removePartOfColumnsSelection(p,t);if(!w)continue;g=!0,e.splice.apply(e,[m,1].concat(_toConsumableArray(w))),m+=w.length-1}else{g=!0;var v=void 0;v=p.type===SelectionType.Rows?{type:SelectionType.UnselectedCells,startColumn:t.startColumn,endColumn:t.endColumn,startRow:p.startRow,endRow:p.endRow}:{type:SelectionType.UnselectedCells,startRow:t.startRow,endRow:t.endRow,startColumn:p.startColumn,endColumn:p.endColumn},e.unshift(v)}else f?p.startRow>=t.startRow&&p.endRow<=t.endRow&&(e.splice(m,1),m--):p.startColumn>=t.startColumn&&p.endColumn<=t.endColumn&&(e.splice(m,1),m--);else{var y=removePartOfCellsSelection(p,f?{startRow:t.startRow,endRow:t.endRow,startColumn:0,endColumn:p.endColumn}:{startColumn:t.startColumn,endColumn:t.endColumn,startRow:0,endRow:p.endRow});y&&(e.splice.apply(e,[m,1].concat(_toConsumableArray(y))),m+=y.length-1)}}return g&&cleanupSelections(e),g}return!1}.bind(void 0),cleanupSelections=function(e){var t=this;_newArrowCheck(this,_this);for(var o=[],r=[],n=0;n<e.length;n++){var l=e[n];l.type===SelectionType.UnselectedCells?o.push(l):r.push(l)}o=o.filter(function(e){_newArrowCheck(this,t);for(var o=0;o<r.length;o++)if(_getIntersection(e,r[o]))return!0;return!1}.bind(this));for(var i=!1;!i;){i=!0;for(var a=0;a<r.length;a++){for(var s=r[a],c=a+1;c<r.length;c++){var d=r[c],u=mergeSelections(s,d);if(u){r[a]=u,r.splice(c,1),i=!1;break}}if(!i)break}}for(var h=0,f=0;f<o.length;f++)e[h++]=o[f];for(var g=0;g<r.length;g++)e[h++]=r[g];e.splice(h,e.length-h)}.bind(void 0),isRowSelected=function(e,t){_newArrowCheck(this,_this);for(var o=0;o<e.length;o++){var r=e[o];switch(r.type){case SelectionType.UnselectedCells:if(t>=r.startRow&&t<=r.endRow)return!1;break;case SelectionType.Rows:if(t>=r.startRow&&t<=r.endRow)return!0}}return!1}.bind(void 0),isColumnSelected=function(e,t){_newArrowCheck(this,_this);for(var o=0;o<e.length;o++){var r=e[o];switch(r.type){case SelectionType.UnselectedCells:if(t>=r.startColumn&&t<=r.endColumn)return!1;break;case SelectionType.Columns:if(t>=r.startColumn&&t<=r.endColumn)return!0}}return!1}.bind(void 0),isCellSelected=function(e,t,o){_newArrowCheck(this,_this);for(var r=0;r<e.length;r++){var n=e[r];switch(n.type){case SelectionType.UnselectedCells:case SelectionType.Cells:if(o>=n.startColumn&&o<=n.endColumn&&t>=n.startRow&&t<=n.endRow)return n.type===SelectionType.Cells;break;case SelectionType.Rows:if(t>=n.startRow&&t<=n.endRow)return!0;break;case SelectionType.Columns:if(o>=n.startColumn&&o<=n.endColumn)return!0}}return!1}.bind(void 0),areAllCellsSelected=function(e,t){_newArrowCheck(this,_this);for(var o=t.startRow,r=t.startColumn,n=t.endRow,l=t.endColumn,i=0,a=e.length;i<a;i++){var s=e[i];if(s)switch(s.type){case SelectionType.UnselectedCells:case SelectionType.Cells:var c=r>=s.startColumn&&o>=s.startRow,d=l<=s.endColumn&&n<=s.endRow;if(c||d){if(c&&d)return s.type===SelectionType.Cells;if(c&&r<=s.endColumn&&o<=s.endRow||d&&l>=s.startColumn&&n>=s.startRow)return!1}break;case SelectionType.Rows:if(o>=s.startRow){if(n<=s.endRow)return!0;if(o<=s.endRow)return!1}else if(n>=s.startRow)return!1;break;case SelectionType.Columns:if(r>=s.startColumn){if(l<=s.endColumn)return!0;if(r<=s.endColumn)return!1}else if(l>=s.startColumn)return!1}}return!1}.bind(void 0),getSelectionStateFromCells=function(e,t){var o=this;if(_newArrowCheck(this,_this),!Array.isArray(e)||0===e.length)return!1;if(e=e.filter(function(e){return _newArrowCheck(this,o),("number"!=typeof e.startRow||!(e.endRow<t.startRow||e.startRow>t.endRow))&&(("number"!=typeof e.startColumn||!(e.endColumn<t.startColumn||e.startColumn>t.endColumn))&&e)}.bind(this)),0===e.length)return!1;if(areAllCellsSelected(e,t))return!0;for(var r=t.endColumn-t.startColumn+1,n=new Array(t.endRow-t.startRow+1).fill(null).map(function(){return _newArrowCheck(this,o),new Array(r)}.bind(this)),l=Object.assign({type:SelectionType.Cells},t),i=e.length-1;i>=0;i--){var a=e[i],s=_getIntersection(l,a);if(s)for(var c=a.type!==SelectionType.UnselectedCells,d=s.startRow;d<=s.endRow;d++)for(var u=n[d-t.startRow],h=s.startColumn-t.startColumn,f=s.endColumn-t.startColumn;h<=f;h++)u[h]=c}return n}.bind(void 0),getVerboseSelectionStateFromCells=function(e,t){var o=this;if(_newArrowCheck(this,_this),!Array.isArray(e)||0===e.length)return[];if(e=e.map(function(e){return _newArrowCheck(this,o),"number"==typeof e.startRow&&(e.endRow<t.startRow||e.startRow>t.endRow)||"number"==typeof e.startColumn&&(e.endColumn<t.startColumn||e.startColumn>t.endColumn)?null:e}.bind(this)),0===e.length)return[];for(var r=t.endColumn-t.startColumn+1,n=new Array(t.endRow-t.startRow+1).fill(null).map(function(){return _newArrowCheck(this,o),new Array(r)}.bind(this)),l=Object.assign({type:SelectionType.Cells},t),i=e.length-1;i>=0;i--){var a=e[i];if(a){var s=_getIntersection(l,a);if(s)for(var c=a.type!==SelectionType.UnselectedCells,d=s.startRow;d<=s.endRow;d++)for(var u=n[d-t.startRow],h=s.startColumn-t.startColumn,f=s.endColumn-t.startColumn;h<=f;h++)u[h]=c?i+1:0}}return n}.bind(void 0),getSelectedContiguousColumns=function(e,t){if(_newArrowCheck(this,_this),e&&0!==e.length){for(var o,r=e.length-1;r>=0;r--){var n=e[r];switch(n.type){case SelectionType.Columns:if(o){var l=mergeSelections(o,n);if(l){o=l;break}}o=n;break;case SelectionType.Rows:case SelectionType.Cells:if(!t)return;break;case SelectionType.UnselectedCells:if(!o)return;if(_getIntersection(n,o))return}}return o?[o.startColumn,o.endColumn]:void 0}}.bind(void 0),getSelectedContiguousRows=function(e,t){if(_newArrowCheck(this,_this),e&&0!==e.length){for(var o,r=e.length-1;r>=0;r--){var n=e[r];switch(n.type){case SelectionType.Rows:if(o){var l=mergeSelections(o,n);if(l){o=l;break}}o=n;break;case SelectionType.Columns:case SelectionType.Cells:if(!t)return;break;case SelectionType.UnselectedCells:if(!o)return;if(_getIntersection(n,o))return}}return o?[o.startRow,o.endRow]:void 0}}.bind(void 0),areSelectionsComplex=function(e){var t=this;if(_newArrowCheck(this,_this),!e||e.length<=1)return!1;var o=e[0].type;return o===SelectionType.UnselectedCells||e.findIndex(function(e){return _newArrowCheck(this,t),e.type!==o}.bind(this))>=0}.bind(void 0),areSelectionsNeat=function(e){if(_newArrowCheck(this,_this),!e)return!1;if(1===e.length)return!0;var t=e[0],o=t.type;if(o===SelectionType.UnselectedCells)return!0;for(var r=0;r<e.length;r++){var n=e[r];if(o!==n.type)return!1;if(o===SelectionType.Cells){if(n.startColumn===t.startColumn&&n.endColumn===t.endColumn)continue;if(n.startRow===t.startRow&&n.endRow===t.endRow)continue;return!1}}return!0}.bind(void 0),moveSelections=function(e,t,o){_newArrowCheck(this,_this);for(var r=0;r<e.length;r++){var n=e[r];switch(n.type){case SelectionType.Cells:case SelectionType.UnselectedCells:n.startRow+=o,n.endRow+=o,n.startColumn+=t,n.endColumn+=t;break;case SelectionType.Rows:n.startRow+=o,n.endRow+=o;break;case SelectionType.Columns:n.startColumn+=t,n.endColumn+=t}}}.bind(void 0),cloneSelections=function(e){_newArrowCheck(this,_this);for(var t=[],o=0;o<e.length;o++){var r=e[o];r&&t.push(Object.assign({},r))}return t}.bind(void 0),getSelectionBounds=function(e){_newArrowCheck(this,_this);for(var t=1/0,o=-1/0,r=1/0,n=-1/0,l=0;l<e.length;l++){var i=e[l];i.type!==SelectionType.UnselectedCells&&("number"!=typeof i.startColumn?r=0:i.startColumn<r&&(r=i.startColumn),"number"!=typeof i.endColumn?n=1/0:i.endColumn>n&&(n=i.endColumn),"number"!=typeof i.startRow?t=0:i.startRow<t&&(t=i.startRow),"number"!=typeof i.endRow?o=1/0:i.endRow>o&&(o=i.endRow))}return{top:t,left:r,bottom:o,right:n}}.bind(void 0),shrinkOrExpandSelections=function(e,t,o,r){var n=this;_newArrowCheck(this,_this);var l=t.rowIndex,i=t.columnIndex;if(l<0||i<0)return!1;var a={ArrowLeft:{x:1,y:0,isLeft:!0},ArrowUp:{x:0,y:1,isUp:!0},ArrowRight:{x:-1,y:0,isRight:!0},ArrowDown:{x:0,y:-1,isDown:!0}}[o.key];if(!a)return!1;for(var s=l+a.y,c=i+a.x,d=[],u=0;u<e.length;u++){var h=e[u];switch(h.type){case SelectionType.Cells:case SelectionType.UnselectedCells:if(!(s!==h.startRow&&s!==h.endRow||c!==h.startColumn&&c!==h.endColumn)){if(h.type===SelectionType.UnselectedCells)return!1;d.push(h)}break;case SelectionType.Rows:s!==h.startRow&&s!==h.endRow||d.push(h);break;case SelectionType.Columns:c!==h.startColumn&&c!==h.endColumn||d.push(h)}}if(1!==d.length)return!1;var f=d[0],g=f.startRow===s,m=f.endRow===s,p=f.startColumn===c,w=f.endColumn===c,v=r?r.rows-1:1/0,y=r?r.columns-1:1/0,x=function(){return _newArrowCheck(this,n),cleanupSelections(e),!0}.bind(this);if(g){if(a.isUp)return 0!==f.startRow&&(f.startRow--,x());if(a.isDown&&f.startRow<f.endRow)return f.startRow++,x()}if(m){if(a.isDown)return!(f.endRow>=v)&&(f.endRow++,x());if(a.isUp&&f.startRow<f.endRow)return f.endRow--,x()}if(p){if(a.isLeft)return 0!==f.startColumn&&(f.startColumn--,x());if(a.isRight&&f.startColumn<f.endColumn)return f.startColumn++,x()}if(w){if(a.isRight)return!(f.endColumn>=y)&&(f.endColumn++,x());if(a.isLeft&&f.startColumn<f.endColumn)return f.endColumn--,x()}return!1}.bind(void 0);function draw(e){var t=[],o=!1,r=0,n=300,l=[],i=[],a=[];function s(e,t,o,r){o=o||1;var n,l=[];for(n=e;n<=t;n+=o)l[n]=void 0===r?n:"function"==typeof r?r(n):r;return l}function c(t){var r,n=t.innerHTML||t.formattedValue,l=n.toString()+t.rowIndex.toString()+t.columnIndex.toString(),i=Math.round(t.x+e.canvasOffsetLeft),a=Math.round(t.y+e.canvasOffsetTop);if(e.htmlImageCache[l]){if(r=e.htmlImageCache[l].img,e.htmlImageCache[l].height===t.height&&e.htmlImageCache[l].width===t.width){if(!r.complete)return;return e.ctx.drawImage(r,i,a)}e.htmlImageCache[l]=void 0}else o=!1;r=new Image(t.width,t.height),e.htmlImageCache[l]={img:r,width:t.width,height:t.height},r.onload=function(){var t;e.ctx.drawImage(r,i,a),t=!0,Object.keys(e.htmlImageCache).forEach((function(o){e.htmlImageCache[o].img.complete||(t=!1)})),t&&!o&&(o=!0,e.draw())},r.src="data:image/svg+xml;base64,"+btoa('<svg xmlns="http://www.w3.org/2000/svg" width="'+t.width+'" height="'+t.height+'">\n<foreignObject class="node" x="0" y="0" width="100%" height="100%">\n<body xmlns="http://www.w3.org/1999/xhtml" style="margin:0;padding:0;">\n'+n+"\n</body></foreignObject>\n</svg>\n")}function d(t,o){if(!(t.length<4)){e.ctx.beginPath(),e.ctx.moveTo(t[0]+e.canvasOffsetLeft,t[1]+e.canvasOffsetTop);for(var r=2;r<t.length;r+=2){var n=t[r]+e.canvasOffsetLeft,l=t[r+1]+e.canvasOffsetTop;e.ctx.lineTo(n,l)}o?e.ctx.fill():e.ctx.stroke()}}function u(e,t,o,r){m(e,t,o,o),p(e,t,o,o);var n=e+.5*o,l=t+.5*o;d([e+.2*o,l,e+.78*o,l]),r&&d([n,t+.22*o,n,t+.8*o])}function h(t,o,r,n,l){var i,a,s,c,u=.2*r,h=.3*r,f=r-2*u,g=r-2*h,p=.5*f;switch(n){case"r":c=[t,o,t+r,o,t+r,o+r,t,o+r],s=[i=t+h,a=o+u,i,a+f,i+g,a+p];break;case"l":c=[t+r,o,t,o,t,o+r,t+r,o+r],s=[i=t+r-h,a=o+u,i,a+f,i-g,a+p];break;case"t":c=[t,o+r,t,o,t+r,o,t+r,o+r],s=[i=t+u,a=o+r-h,i+f,a,i+p,a-g];break;case"b":c=[t,o,t,o+r,t+r,o+r,t+r,o],s=[i=t+u,a=o+h,i+f,a,i+p,a+g]}if(l){e.ctx.strokeStyle=e.style.unhideIndicatorBorderColor,e.ctx.lineWidth=2,d(c),e.ctx.fillStyle=e.style.unhideIndicatorBackgroundColor;var w="r"===n||"b"===n?1:0;"l"===n||"r"===n?m(t-w,o,r+w,r):m(t,o-w,r,r+w)}e.ctx.fillStyle=e.style.unhideIndicatorColor,d(s,!0)}function f(t,o,r){var n=r?o.parentCount:0,l=e.style.cellTreeIconWidth*e.scale,i=e.style.cellTreeIconMarginTop*e.scale,a=e.style.cellTreeIconMarginRight*e.scale,s=e.style.cellTreeIconMarginLeft*e.scale+n*(l+t.paddingLeft),c=t.x+t.paddingLeft+e.canvasOffsetLeft+s,d=t.y+e.canvasOffsetTop+i;if(o.icon){e.ctx.beginPath();var u=e.ctx.fillStyle,h=e.ctx.strokeStyle;t.hovered&&e.hovers.onCellTreeIcon?e.ctx.fillStyle=e.style.cellTreeIconHoverFillColor:e.ctx.fillStyle=e.style.cellTreeIconFillColor,e.ctx.fillRect(c,d,l,l),e.ctx.strokeStyle=e.style.cellTreeIconBorderColor,e.ctx.rect(c,d,l,l),e.ctx.stroke(),e.ctx.beginPath(),o.expand?(e.ctx.moveTo(c+3,d+.5*l),e.ctx.lineTo(c+l-3,d+.5*l)):(e.ctx.moveTo(c+2,d+.5*l),e.ctx.lineTo(c+l-2,d+.5*l),e.ctx.moveTo(c+.5*l,d+2),e.ctx.lineTo(c+.5*l,d+l-2)),e.ctx.lineWidth=e.style.cellTreeIconLineWidth,e.ctx.strokeStyle=e.style.cellTreeIconLineColor,e.ctx.stroke(),e.ctx.strokeStyle=h,e.ctx.fillStyle=u}return s+l+a}function g(t,o,r,n,l){var i=(t+=e.canvasOffsetLeft)+r,a=(o+=e.canvasOffsetTop)+n;e.ctx.beginPath(),e.ctx.moveTo(t+l,o),e.ctx.lineTo(i-l,o),e.ctx.quadraticCurveTo(i,o,i,o+l),e.ctx.lineTo(i,o+n-l),e.ctx.quadraticCurveTo(i,a,i-l,a),e.ctx.lineTo(t+l,a),e.ctx.quadraticCurveTo(t,a,t,a-l),e.ctx.lineTo(t,o+l),e.ctx.quadraticCurveTo(t,o,t+l,o)}function m(t,o,r,n){t+=e.canvasOffsetLeft,o+=e.canvasOffsetTop,e.ctx.fillRect(t,o,r,n)}function p(t,o,r,n){t+=e.canvasOffsetLeft,o+=e.canvasOffsetTop,e.ctx.strokeRect(t,o,r,n)}function w(t,o,r){o+=e.canvasOffsetLeft,r+=e.canvasOffsetTop,e.ctx.fillText(t,o,r)}function v(t){e.ctx.beginPath(),0===t&&(e.ctx.moveTo(e.lastFrozenColumnPixel,e.lastFrozenRowPixel),e.ctx.lineTo(e.lastFrozenColumnPixel,e.height),e.ctx.lineTo(e.width,e.height),e.ctx.lineTo(e.width,e.lastFrozenRowPixel)),1===t&&(e.ctx.moveTo(0,e.lastFrozenRowPixel),e.ctx.lineTo(0,e.height),e.ctx.lineTo(e.width,e.height),e.ctx.lineTo(e.width,e.lastFrozenRowPixel)),2===t&&(e.ctx.moveTo(e.lastFrozenColumnPixel,0),e.ctx.lineTo(e.width,0),e.ctx.lineTo(e.width,e.height),e.ctx.lineTo(e.lastFrozenColumnPixel,e.height)),e.ctx.clip()}function y(t,o,r){if("circle"===e.style.selectionHandleType)return function(t,o,r){t+=e.canvasOffsetLeft,o+=e.canvasOffsetTop,e.ctx.beginPath(),e.ctx.arc(t,o,r,0,2*Math.PI),e.ctx.fill()}(t,o,.5*r);m(t-.5*r,o-.5*r,r,r)}function x(t,o,r){if("circle"===e.style.selectionHandleType)return function(t,o,r){t+=e.canvasOffsetLeft,o+=e.canvasOffsetTop,e.ctx.beginPath(),e.ctx.arc(t,o,r,0,2*Math.PI),e.ctx.stroke()}(t,o,.5*r);p(t-.5*r,o-.5*r,r,r)}function C(t,o){e.ctx.beginPath(),{t:function(){e.ctx.moveTo(t.x+e.canvasOffsetLeft,t.y+e.canvasOffsetTop),e.ctx.lineTo(t.x+e.canvasOffsetLeft+t.width,t.y+e.canvasOffsetTop)},r:function(){e.ctx.moveTo(t.x+e.canvasOffsetLeft+t.width,t.y+e.canvasOffsetTop),e.ctx.lineTo(t.x+e.canvasOffsetLeft+t.width,t.y+e.canvasOffsetTop+t.height)},b:function(){e.ctx.moveTo(t.x+e.canvasOffsetLeft,t.y+e.canvasOffsetTop+t.height),e.ctx.lineTo(t.x+e.canvasOffsetLeft+t.width,t.y+e.canvasOffsetTop+t.height)},l:function(){e.ctx.moveTo(t.x+e.canvasOffsetLeft,t.y+e.canvasOffsetTop),e.ctx.lineTo(t.x+e.canvasOffsetLeft,t.y+e.canvasOffsetTop+t.height)}}[o](),e.ctx.stroke()}function b(){for(var t=this,o=0,r=e.getSchema(),n=0,l=Math.min(e.frozenColumn,r.length),i=e.getCollapsedColumnGroups();n<l;){if(r[n].hidden);else i.findIndex(function(e){return _newArrowCheck(this,t),n>=e.from&&n<=e.to}.bind(this))>=0||(o+=e.getColumnWidth(n));n+=1}return o}e.htmlImageCache={},e.draw=function(o){var S=this;if(!e.dispatchEvent("beforedraw",{})&&(e.isChildGrid||e.height&&e.width))if(e.isChildGrid&&o)requestAnimationFrame(e.parentGrid.draw);else if(!1!==e.intf.visible){var R,B,T,I,M,k,A,z,O,H,E,P,L,D,F,W,N,G,j,_,V,U=e.viewData||[],Z="collapse"===e.style.gridBorderCollapse,K=[],q=[],Y=[],X=[],J=U.length,Q=e.currentCell||{},$=e.getColumnHeaderCellHeight(),ee=e.getRowHeaderCellWidth(),te=e.getRowGroupAreaWidth(),oe=e.getColumnGroupAreaHeight(),re={},ne={},le={},ie=e.getCollapsedColumnGroups(),ae=e.getCollapsedRowGroups(),se=e.style.cellHeight,ce=0,de=e.hiddenRowRanges.map(function(e){return _newArrowCheck(this,S),{from:e[0],plus:e[1]-e[0]+1}}.bind(this)).sort(function(e,t){return _newArrowCheck(this,S),e.from-t.from}.bind(this));r+=1,B=performance.now(),e.visibleRowHeights=[],U.length>e.orders.rows.length&&e.createRowOrders(),e.ctx.save(),function(){e.visibleRows=[],D=e.getSchema(),e.visibleCells=[],e.visibleGroups=[],e.visibleUnhideIndicators=[],e.canvasOffsetTop=e.isChildGrid?e.parentNode.offsetTop:.5,e.canvasOffsetLeft=e.isChildGrid?e.parentNode.offsetLeft:-.5,P=e.height,L=e.width;var t=de[0];t&&0===t.from&&(ce=t.plus,de.shift())}(),g(0,0,L,P,0),e.ctx.clip(),e.ctx.fillStyle=e.style.gridBackgroundColor,m(0,0,L,P),e.ctx.translate(te,oe),function(){var t=Math.min(U.length,e.frozenRow);for(H=-e.scrollBox.scrollLeft+e.scrollPixelLeft+e.style.cellBorderWidth,O=$,F=0;F<t&&ge(e.orders.rows[F],F);F+=1);e.attributes.allowFreezingRows&&(O>$&&(O+=e.style.frozenMarkerWidth),O+=e.style.frozenMarkerBorderWidth-.4999999999),e.lastFrozenRowPixel=O}(),function(){e.ctx.save(),e.frozenRow>0&&(g(0,e.lastFrozenRowPixel,e.width,e.height-e.lastFrozenRowPixel,0),e.ctx.clip());var t,o,r,n=D.length;for(H=-e.scrollBox.scrollLeft+e.scrollPixelLeft+e.style.cellBorderWidth,e.attributes.snapToRow||(O+=-e.scrollBox.scrollTop+e.scrollPixelTop+e.style.cellBorderWidth),F=e.frozenRow+e.scrollIndexTop;F<J&&(o=e.orders.rows[F],e.scrollIndexBottom=F,e.scrollPixelBottom=O,e.cellTree.rows.length>0&&Object.keys(e.cellTree.rows[o]).length>0&&e.cellTree.rows[o].hide||ge(o,F));F+=1);if(e.attributes.showNewRow){for(e.attributes.showRowHeaders&&(H+=ee),A=se=e.style.cellHeight,k=!1,t=e.scrollIndexLeft;t<n&&(ue(t)||(r=e.orders.columns[t],H+=fe(e.newRow,U.length,U.length)(D[r],r,t)),!(H>e.width+e.scrollBox.scrollLeft));t+=1);X.push([e.newRow,U.length,U.length,O,A])}e.ctx.restore()}(),function(){if(N){e.ctx.save();var t=e.activeCell.columnIndex+1>e.frozenColumn||e.activeCell.rowIndex+1>e.frozenRow;g(t?e.lastFrozenColumnPixel:0,t?e.lastFrozenRowPixel:0,t?e.width-e.lastFrozenColumnPixel:e.width,t?e.height-e.lastFrozenRowPixel:e.height,0),e.ctx.clip(),"row"===e.attributes.selectionMode?e.activeCell&&e.activeCell.rowIndex===N.rowIndex&&(e.ctx.lineWidth=e.style.activeCellOverlayBorderWidth,e.ctx.strokeStyle=e.style.activeCellOverlayBorderColor,p(1,N.y,e.getHeaderWidth()+ee,e.visibleRowHeights[N.rowIndex])):(e.ctx.lineWidth=e.style.activeCellOverlayBorderWidth,e.ctx.strokeStyle=e.style.activeCellOverlayBorderColor,p(N.x,N.y,N.width,N.height)),e.ctx.restore()}}(),function(){var t,o,r,n,l,i,a=D.length;function s(i,s){for(s=Math.min(s,a),r=i;r<s&&(o=e.orders.columns[r],(l=D[o]).hidden||ue(r)||(t={title:l.title,name:l.name,width:l.width||e.style.cellWidth,style:"columnHeaderCell",type:"string",index:r,order:o},n={columnHeaderCell:l.title||l.name},!((H+=fe(n,-1,-1)(t,o,r))>e.width+e.scrollBox.scrollLeft)));r+=1);}X.forEach((function(t,o){O=t[3],se=t[4],o===e.frozenRow&&(e.ctx.save(),g(0,e.lastFrozenRowPixel,e.width,e.height-e.lastFrozenRowPixel,0),e.ctx.clip()),function(t,o,r){if(e.attributes.showRowHeaders){var n;H=0,n=e.viewData&&o<e.viewData.length?e.getBoundRowIndexFromViewRowIndex(o)+1:e.originalData?e.originalData.length+1:r+1;var l=e.hasActiveFilters()||e.hasCollapsedRowGroup()?n:o+1,i={rowHeaderCell:l+=ce},a={name:"rowHeaderCell",width:e.sizes.columns[-1]||e.style.rowHeaderCellWidth,style:"rowHeaderCell",type:"string",data:l,index:-1};if(k=e.openChildren[o],fe(i,r,o)(a,-1,-1),de[0]&&l>=de[0].from){var s=de.shift().plus;ce+=s}}}(t[0],t[1],t[2])})),e.ctx.restore(),e.attributes.showColumnHeaders&&(H=-e.scrollBox.scrollLeft+e.scrollPixelLeft+e.style.columnHeaderCellBorderWidth,e.attributes.showRowHeaders&&(H+=ee),O=0,se=e.getColumnHeaderCellHeight(),s(e.scrollIndexLeft,a),i=H,H=e.style.columnHeaderCellBorderWidth,e.attributes.showRowHeaders&&(H+=ee),s(0,e.frozenColumn),(H=i)<L&&(E={name:"",width:e.style.scrollBarWidth,style:"columnHeaderCellCap",isColumnHeaderCell:!0,isColumnHeaderCellCap:!0,type:"string",index:D.length},fe({endCap:""},-1,-1)(E,-1,-1)),e.attributes.showRowHeaders&&(z={cornerCell:""},H=0,E={name:"cornerCell",width:e.style.rowHeaderCellWidth,style:"cornerCell",type:"string",index:-1},fe(z,-1,-1)(E,-1,-1)))}(),function(){var t=e.lastFrozenRowPixel-e.style.frozenMarkerWidth,o=e.lastFrozenColumnPixel-e.style.frozenMarkerWidth,r=e.currentCell&&"frozen-row-marker"===e.currentCell.style,n=e.currentCell&&"frozen-column-marker"===e.currentCell.style,l=e.getRowHeaderCellWidth();if(e.ctx.lineWidth=e.style.frozenMarkerBorderWidth,e.attributes.allowFreezingColumns&&((!e.freezeMarkerPosition||e.freezeMarkerPosition&&"frozen-row-marker"===e.dragMode)&&(o>e.style.rowHeaderCellWidth&&(e.ctx.fillStyle=e.style.frozenMarkerColor,e.ctx.strokeStyle=e.style.frozenMarkerBorderColor,m(o,0,e.style.frozenMarkerWidth,e.height),p(o,0,e.style.frozenMarkerWidth,e.height)),e.ctx.fillStyle=n?e.style.frozenMarkerHoverColor:e.style.frozenMarkerHeaderColor,e.ctx.strokeStyle=n?e.style.frozenMarkerHoverBorderColor:e.style.frozenMarkerHeaderColor,m(o,0,e.style.frozenMarkerWidth,e.style.columnHeaderCellHeight),p(o,0,e.style.frozenMarkerWidth,e.style.columnHeaderCellHeight)),(!e.dragStartObject||e.dragStartObject&&"rowHeaderCell"!==e.dragStartObject.style)&&e.visibleCells.unshift({x:o,y:0,height:e.height,width:e.style.frozenMarkerWidth,style:"frozen-column-marker"})),e.attributes.allowFreezingRows){(!e.freezeMarkerPosition||e.freezeMarkerPosition&&"frozen-column-marker"===e.dragMode)&&(t>l&&(e.ctx.fillStyle=e.style.frozenMarkerColor,e.ctx.strokeStyle=e.style.frozenMarkerBorderColor,m(0,t,e.width,e.style.frozenMarkerWidth),p(0,t,e.width,e.style.frozenMarkerWidth)),e.ctx.fillStyle=r?e.style.frozenMarkerHoverColor:e.style.frozenMarkerHeaderColor,e.ctx.strokeStyle=r?e.style.frozenMarkerHoverBorderColor:e.style.frozenMarkerHeaderColor,m(0,t,l,e.style.frozenMarkerWidth),p(0,t,l,e.style.frozenMarkerWidth));var i=e.style.frozenMarkerWidth+e.style.frozenMarkerBorderWidth;(!e.dragStartObject||e.dragStartObject&&"columnHeaderCell"!==e.dragStartObject.style)&&e.visibleCells.unshift({x:0,y:t,height:i,width:e.width,style:"frozen-row-marker"}),ne={y:t,h:i}}if(e.freezeMarkerPosition)if(e.ctx.fillStyle=e.style.frozenMarkerActiveColor,e.ctx.strokeStyle=e.style.frozenMarkerActiveBorderColor,"frozen-column-marker"===e.dragMode){var a=e.freezeMarkerPosition.x,s=e.getCellAt(a,0);if(e.freezeMarkerPosition.isGrab&&(a=o),a>l){var c=s.x-e.style.frozenMarkerWidth-e.style.frozenMarkerBorderWidth;a>c+s.width/2&&(c+=s.width),e.ctx.fillStyle=e.style.frozenMarkerColor,e.ctx.strokeStyle=e.style.frozenMarkerBorderColor,m(c,0,e.style.frozenMarkerWidth,e.height),p(c,0,e.style.frozenMarkerWidth,e.height),e.ctx.fillStyle=e.style.frozenMarkerHeaderColor,e.ctx.strokeStyle=e.style.frozenMarkerHeaderColor,m(c,0,e.style.frozenMarkerWidth,e.style.columnHeaderCellHeight),p(c,0,e.style.frozenMarkerWidth,e.style.columnHeaderCellHeight)}e.ctx.fillStyle=e.style.frozenMarkerActiveHeaderColor,e.ctx.strokeStyle=e.style.frozenMarkerActiveBorderColor,m(a,0,e.style.frozenMarkerWidth,e.style.columnHeaderCellHeight),p(a,0,e.style.frozenMarkerWidth,e.style.columnHeaderCellHeight),e.ctx.fillStyle=e.style.frozenMarkerActiveColor,m(a,0,e.style.frozenMarkerWidth,e.height),p(a,0,e.style.frozenMarkerWidth,e.height)}else{var d=e.freezeMarkerPosition.y,u=e.getCellAt(0,d);if(e.freezeMarkerPosition.isGrab&&(d=t),d>e.style.columnHeaderCellHeight){var h=u.y-e.style.frozenMarkerWidth-e.style.frozenMarkerBorderWidth;d>h+u.height/2&&(h+=u.height),e.ctx.fillStyle=e.style.frozenMarkerColor,e.ctx.strokeStyle=e.style.frozenMarkerBorderColor,m(0,h,e.width,e.style.frozenMarkerWidth),p(0,h,e.width,e.style.frozenMarkerWidth),e.ctx.fillStyle=e.style.frozenMarkerHeaderColor,e.ctx.strokeStyle=e.style.frozenMarkerHeaderColor,m(0,h,l,e.style.frozenMarkerWidth),p(0,h,l,e.style.frozenMarkerWidth)}e.ctx.fillStyle=e.style.frozenMarkerActiveHeaderColor,e.ctx.strokeStyle=e.style.frozenMarkerActiveBorderColor,m(0,d,l,e.style.frozenMarkerWidth),p(0,d,l,e.style.frozenMarkerWidth),e.ctx.fillStyle=e.style.frozenMarkerActiveColor,m(0,d,e.width,e.style.frozenMarkerWidth),p(0,d,e.width,e.style.frozenMarkerWidth)}}(),(e.mobile||e.attributes.allowMovingSelection)&&e.attributes.editable&&(e.ctx.lineWidth=e.style.selectionHandleBorderWidth,e.ctx.strokeStyle=e.style.selectionHandleBorderColor,e.ctx.fillStyle=e.style.selectionHandleColor,Y.forEach((function(t){!function(t,o){var r=e.style.selectionHandleSize;({tr:function(){y(t.x+t.width,t.y,r),x(t.x+t.width,t.y,r)},br:function(){y(t.x+t.width,t.y+t.height,r),x(t.x+t.width,t.y+t.height,r)},tl:function(){y(t.x,t.y,r),x(t.x,t.y,r)},bl:function(){y(t.x,t.y+t.height,r),x(t.x,t.y+t.height,r)}})[o]()}(t[0],t[1]);var o=e.attributes.touchSelectHandleZone/2,r=t[0].x+("tl"===t[1]||"bl"===t[1]?0:t[0].width)-o,n=t[0].y+("bl"===t[1]||"br"===t[1]?t[0].height:0)-o;e.visibleCells.unshift({x:r,y:n,height:e.style.selectionHandleSize+o,width:e.style.selectionHandleSize+o,style:"selection-handle-"+t[1]})}))),function(){if(e.reorderObject){var t={height:e.reorderObject.height,width:e.reorderObject.width,x:e.reorderObject.x+e.reorderObject.dragOffset.x,y:e.reorderObject.y+e.reorderObject.dragOffset.y},o={width:L,height:P,x:0,y:0};e.ctx.fillStyle=e.style.reorderMarkerBackgroundColor,e.ctx.lineWidth=e.style.reorderMarkerBorderWidth,e.ctx.strokeStyle=e.style.reorderMarkerBorderColor,"row-reorder"===e.dragMode?(t.height=e.getSelectedRowsHeight(),t.width=L,t.x=0,o.width=L,o.height=e.currentCell.height,o.y=e.currentCell.y,m(t.x,t.y,t.width,t.height),p(t.x,t.y,t.width,t.height),e.ctx.lineWidth=e.style.reorderMarkerIndexBorderWidth,e.ctx.strokeStyle=e.style.reorderMarkerIndexBorderColor,!e.isRowSelected(e.reorderTarget.sortRowIndex)&&e.currentCell.rowIndex!==e.reorderObject.rowIndex&&e.currentCell.rowIndex>-1&&e.currentCell.rowIndex<J&&C(o,e.reorderTarget.sortRowIndex>e.reorderObject.sortRowIndex?"b":"t")):"column-reorder"===e.dragMode&&e.reorderObject&&(t.width=e.getSelectedColumnsWidth(),t.height=P,t.y=0,o.height=P,o.width=e.currentCell.width,o.y=0,o.x=e.currentCell.x,m(t.x,t.y,t.width,t.height),p(t.x,t.y,t.width,t.height),e.ctx.lineWidth=e.style.reorderMarkerIndexBorderWidth,e.ctx.strokeStyle=e.style.reorderMarkerIndexBorderColor,!e.isColumnSelected(e.reorderTarget.sortColumnIndex)&&e.currentCell.sortColumnIndex!==e.reorderObject.sortColumnIndex&&e.reorderTarget.columnIndex!==e.reorderObject.columnIndex&&e.currentCell.sortColumnIndex>-1&&e.currentCell.sortColumnIndex<D.length&&C(o,e.reorderTarget.columnIndex>e.reorderObject.columnIndex?"r":"l"))}}(),e.movingSelection&&(e.ctx.lineWidth=e.style.moveOverlayBorderWidth,e.ctx.strokeStyle=e.style.moveOverlayBorderColor,e.ctx.setLineDash(e.style.moveOverlayBorderSegments),q.forEach((function(e){C(e[0],e[1])})),e.ctx.setLineDash([])),function(){if(e.attributes.resizeAfterDragged&&e.draggingItem&&e.pendingDragResize&&("ew-resize"==e.dragMode||"ns-resize"==e.dragMode)){var t="ns-resize"==e.dragMode,o=t?e.style.resizeMarkerSize:e.height,r=t?e.width:e.style.resizeMarkerSize,n=e.dragStart.x-(e.resizingStartingWidth-e.style.minColumnWidth),l=e.dragStart.y-(e.resizingStartingHeight-e.style.minRowHeight),i=t?0:Math.max(e.pendingDragResize.x,n),a=t?Math.max(e.pendingDragResize.y,l):0;e.ctx.fillStyle=e.style.resizeMarkerColor,m(i,a,r,o)}}(),e.ctx.lineWidth=e.style.gridBorderWidth,e.ctx.strokeStyle=e.style.gridBorderColor,p(0,0,e.width,e.height),function(){function t(t){e.fillOverlay.handle||(e.ctx.lineWidth=e.style.selectionOverlayBorderWidth,e.ctx.strokeStyle=e.style.selectionOverlayBorderColor,C(t[0],t[1]))}K.filter((function(t){return t[0].rowIndex<e.frozenRow&&t[0].columnIndex<e.frozenColumn})).forEach(t),e.ctx.save(),v(0),K.filter((function(t){return t[0].rowIndex>=e.frozenRow&&t[0].columnIndex>=e.frozenColumn})).forEach(t),e.ctx.restore(),e.ctx.save(),v(1),K.filter((function(t){return t[0].rowIndex>=e.frozenRow&&t[0].columnIndex<e.frozenColumn})).forEach(t),e.ctx.restore(),e.ctx.save(),v(2),K.filter((function(t){return t[0].rowIndex<e.frozenRow&&t[0].columnIndex>=e.frozenColumn})).forEach(t),e.ctx.restore(),function(){if(!e.fillOverlay.handle||!e.fillOverlay.snapTo)return;e.ctx.save();var t=e.fillOverlay,o=t.handle,r=t.snapTo.x,n=t.snapTo.y,l=t.snap,i="x"===t.direction?l?l.x+(t.x<r?0:l.width):t.x:o.x,a=void 0===t.direction||"y"===t.direction?l?l.y+(t.y<n?0:l.height):t.y:o.y,s=Math.max(Math.min(r,i),t.minX),c=Math.max(Math.min(n,a),t.minY),d=Math.max(r,i)-s,u=Math.max(n,a)-c;e.ctx.strokeStyle=e.style.fillOverlayBorderColor,e.ctx.lineWidth=e.style.fillOverlayBorderWidth,e.ctx.setLineDash([3,3]),p(s,c,d,u),e.ctx.setLineDash([]),e.ctx.restore()}()}(),j=e.scrollBox.entities,_=2*e.style.scrollBarBoxMargin,e.ctx.strokeStyle=e.style.scrollBarBorderColor,e.ctx.lineWidth=e.style.scrollBarBorderWidth,e.frozenColumn>0?j.horizontalBox.x=ee+e.style.scrollBarBoxMargin+e.scrollCache.x[e.frozenColumn-1]+(j.horizontalBar.width-e.scrollCache.x[e.frozenColumn-1]-e.scrollBox.scrollBoxWidth)*(e.scrollBox.scrollLeft/e.scrollBox.scrollWidth):j.horizontalBox.x=ee+e.style.scrollBarBoxMargin+(j.horizontalBar.width-e.scrollBox.scrollBoxWidth)*(e.scrollBox.scrollLeft/e.scrollBox.scrollWidth),j.verticalBox.y=$+e.style.scrollBarBoxMargin+e.scrollCache.y[e.frozenRow]+(j.verticalBar.height-e.scrollBox.scrollBoxHeight-e.scrollCache.y[e.frozenRow])*(e.scrollBox.scrollTop/e.scrollBox.scrollHeight),e.scrollBox.horizontalBarVisible&&(e.ctx.fillStyle=e.style.scrollBarBackgroundColor,m(j.horizontalBar.x,j.horizontalBar.y,j.horizontalBar.width+_,j.horizontalBar.height),p(j.horizontalBar.x,j.horizontalBar.y,j.horizontalBar.width+_,j.horizontalBar.height),e.ctx.fillStyle=e.style.scrollBarBoxColor,e.scrollBox.horizontalBoxVisible&&(/horizontal/.test(Q.context)&&(e.ctx.fillStyle=e.style.scrollBarActiveColor),g(j.horizontalBox.x,j.horizontalBox.y,j.horizontalBox.width,j.horizontalBox.height,e.style.scrollBarBoxBorderRadius),e.ctx.stroke(),e.ctx.fill()),G=!0,e.visibleCells.unshift(j.horizontalBar),e.visibleCells.unshift(j.horizontalBox)),e.scrollBox.verticalBarVisible&&(e.ctx.fillStyle=e.style.scrollBarBackgroundColor,m(j.verticalBar.x,j.verticalBar.y,j.verticalBar.width,j.verticalBar.height+_),p(j.verticalBar.x,j.verticalBar.y,j.verticalBar.width,j.verticalBar.height+_),e.scrollBox.verticalBoxVisible&&(e.ctx.fillStyle=e.style.scrollBarBoxColor,/vertical/.test(Q.context)&&(e.ctx.fillStyle=e.style.scrollBarActiveColor),g(j.verticalBox.x,j.verticalBox.y,j.verticalBox.width,j.verticalBox.height,e.style.scrollBarBoxBorderRadius),e.ctx.stroke(),e.ctx.fill()),G=!0,e.visibleCells.unshift(j.verticalBar),e.visibleCells.unshift(j.verticalBox)),G&&(e.ctx.strokeStyle=e.style.scrollBarCornerBorderColor,e.ctx.fillStyle=e.style.scrollBarCornerBackgroundColor,g(j.corner.x,j.corner.y,j.corner.width,j.corner.height,0),e.ctx.stroke(),e.ctx.fill(),e.visibleCells.unshift(j.corner)),R&&e.resize(!0),function(){var t=te,o=oe,r=b(),n=ne.y+ne.h-$,l="left"===e.attributes.columnGroupIndicatorPosition,i="top"===e.attributes.rowGroupIndicatorPosition,a=e.ctx;a.save(),a.fillStyle=e.style.groupingAreaBackgroundColor,m(0,-o,L,o),m(-t,-o,t,P),a.restore();for(var s=[],c=0;c<e.groupedColumns.length;c++)for(var h=e.groupedColumns[c],f=0;f<h.length;f++)s.push(Object.assign({row:c},h[f]));s.length>0&&function(){for(var n=e.style.columnGroupRowHeight,i=.5*n,c=.5*(n-i),h=function(h){var f=this,g=s[h],m=g.row,p=g.collapsed,w=m*n-o,v=w+.5*n,y=w+n-c,x=ee-i-c,C=function(e){return _newArrowCheck(this,f),u(e,w+c,i,g.collapsed)}.bind(this),b=function(r,n){return _newArrowCheck(this,f),e.visibleGroups.push({type:"c",collapsed:p,from:g.from,to:g.to,row:m,x:r+t,y:w+o,x2:n+t,y2:y+o})}.bind(this),S=g.from<e.frozenColumn&&g.to>=e.frozenColumn,R=g.from>=e.frozenColumn;if(p){var B=x+i;if(g.from>0){var T=g.to+1,I=le[T];if(I)B=I.x+c;else{if(T=g.from-1,!(I=le[T]))return"continue";B=I.x+I.w-.5*i}if(T>=e.frozenColumn)if(B<r+ee-c)return"continue"}var M=B+i;a.save(),a.strokeStyle=e.style.groupIndicatorColor,a.fillStyle=e.style.groupIndicatorBackgroundColor,C(B),a.restore(),b(B,M)}var k=void 0,A=le[g.from],z=le[g.to],O=!0,H=!0;for(k=g.from;!A&&k<g.to;)A=le[++k],O=!1;for(k=g.to;!z&&k>g.from;)z=le[--k],H=!1;if(!A||!z)return"continue";var E=z.x+z.w,P=A.x;if(S){var L=le[e.frozenColumn-1];if(L){var D=L.x+L.w;l||(D+=i),D>=E&&(E=(z=L).x+z.w,H=!1)}}var F=ee+(R?r:0);if(E+(l?0:i)<F)return"continue";E-=c,P+=c,a.save(),a.strokeStyle=e.style.groupIndicatorColor,a.fillStyle=e.style.groupIndicatorBackgroundColor;var W=[];l?(P<(F+=2*c)&&(P=F),0===g.from&&(P-=2*c),E>=P?(W.push(P,v,E,v),H&&W.push(E,y)):E=P,C(P-=i),E+=c-1):(P<F&&(P=F),0===g.from&&(P-=2*c),H&&(g.to===e.frozenColumn-1?E-=i:E+=2*c,C(E)),P>E?P=E:(0===g.from&&(O=!0,P=x+i),O&&W.push(P,y),W.push(P,v,E,v)),P-=c+1,H&&(E+=i)),d(W),a.restore(),b(P,E)},f=0;f<s.length;f++)h(f)}();for(var g=[],p=0;p<e.groupedRows.length;p++)for(var w=e.groupedRows[p],v=0;v<w.length;v++)g.push(Object.assign({col:p},w[v]));g.length>0&&function(){for(var r=e.style.rowGroupColumnWidth,l=.5*r,s=.5*(r-l),c=function(c){var h=this,f=g[c],m=f.col,p=f.collapsed,w=m*r-t,v=w+.5*r,y=w+r-s,x=$-l-s,C=function(e){return _newArrowCheck(this,h),u(w+s,e,l,f.collapsed)}.bind(this),b=function(r,n){return _newArrowCheck(this,h),e.visibleGroups.push({type:"r",collapsed:p,from:f.from,to:f.to,col:m,x:w+t,y:r+o,x2:y+t,y2:n+o})}.bind(this),S=f.from<e.frozenRow&&f.to>=e.frozenRow,R=f.from>=e.frozenRow;if(p){var B=x+l;if(f.from>0){var T=f.to+1,I=re[T];if(I)B=I.y;else{if(T=f.from-1,!(I=re[T]))return"continue";B=I.y+I.h-.5*l}if(T>=e.frozenRow)if(B<n+$-s)return"continue"}var M=B+l;a.save(),a.strokeStyle=e.style.groupIndicatorColor,a.fillStyle=e.style.groupIndicatorBackgroundColor,C(B),a.restore(),b(B,M)}var k=void 0,A=re[f.from],z=re[f.to],O=!0,H=!0;for(k=f.from;!A&&k<f.to;)A=re[++k],O=!1;for(k=f.to;!z&&k>f.from;)z=re[--k],H=!1;if(!A||!z)return"continue";var E=z.y+z.h,P=A.y;if(S){var L=re[e.frozenRow-1];if(L){var D=L.y+L.h;i||(D+=l),D>=E&&(E=(z=L).y+z.h,H=!1)}}var F=$+(R?n:0);if(E+(i?0:l)<F)return"continue";E-=s,P+=s,a.save(),a.strokeStyle=e.style.groupIndicatorColor,a.fillStyle=e.style.groupIndicatorBackgroundColor;var W=[];i?(P<(F+=2*s)&&(P=F),0===f.from&&(P-=2*s),E>=P?(W.push(v,P,v,E),H&&W.push(y,E)):E=P,C(P-=l),E+=s-1):(P<F&&(P=F),0===f.from&&(P-=2*s),H&&(f.to===e.frozenRow-1&&(E-=l),C(E)),P>E?P=E:(0===f.from&&(O=!0,P=x+l),O&&W.push(y,P),W.push(v,P,v,E),P-=s+1),H&&(E+=l)),d(W),a.restore(),b(P,E)},h=0;h<g.length;h++)c(h)}()}(),e.ctx.save(),(e.attributes.showPerformance||e.attributes.debug)&&(0===t.length&&(t=s(0,n,1,0)),t.pop(),t.unshift(performance.now()-B)),e.attributes.debug?(e.ctx.font=e.style.debugFont,(V={}).perf=(t.reduce((function(e,t){return e+t}),0)/Math.min(r,t.length)).toFixed(1),V.perfDelta=t[0].toFixed(1),V.frozenColumnsWidth=b(),V.htmlImages=Object.keys(e.htmlImageCache).length,V.reorderObject="x: "+(e.reorderObject||{columnIndex:0}).columnIndex+", y: "+(e.reorderObject||{rowIndex:0}).rowIndex,V.reorderTarget="x: "+(e.reorderTarget||{columnIndex:0}).columnIndex+", y: "+(e.reorderTarget||{rowIndex:0}).rowIndex,V.scale=e.scale,V.startScale=e.startScale,V.scaleDelta=e.scaleDelta,V.zoomDeltaStart=e.zoomDeltaStart,V.touchLength=e.touchLength,V.touches="y0: "+(e.touchPosition||{y:0}).y+" y1: "+(e.touchPosition1||{y:0}).y,V.scrollBox=e.scrollBox.toString(),V.scrollIndex="x: "+e.scrollIndexLeft+", y: "+e.scrollIndexTop,V.scrollPixel="x: "+e.scrollPixelLeft+", y: "+e.scrollPixelTop,V.canvasOffset="x: "+e.canvasOffsetLeft+", y: "+e.canvasOffsetTop,V.touchDelta="x: "+e.touchDelta.x+", y: "+e.touchDelta.y,V.touchAnimateTo="x: "+e.touchAnimateTo.x+", y: "+e.touchAnimateTo.y,V.scrollAnimation="x: "+e.scrollAnimation.x+", y: "+e.scrollAnimation.y,V.touchPPS="x: "+e.xPPS+", y: "+e.yPPS,V.touchPPST="x: "+e.xPPST+", y: "+e.yPPST,V.touchDuration=e.touchDuration,V.pointerLockPosition=e.pointerLockPosition?e.pointerLockPosition.x+", "+e.pointerLockPosition.y:"",V.size="w: "+e.width+", h: "+e.height,V.mouse="x: "+e.mouse.x+", y: "+e.mouse.y,V.touch=e.touchStart?"x: "+e.touchStart.x+", y: "+e.touchStart.y:"",V.entities=e.visibleCells.length,V.hasFocus=e.hasFocus,V.dragMode=e.dragMode,e.currentCell&&(V.columnIndex=e.currentCell.columnIndex,V.rowIndex=e.currentCell.rowIndex,V.sortColumnIndex=e.currentCell.sortColumnIndex,V.sortRowIndex=e.currentCell.sortRowIndex,V.context=e.currentCell.context,V.dragContext=e.currentCell.dragContext,V.style=e.currentCell.style,V.type=e.currentCell.type),e.ctx.textAlign="right",e.ctx.fillStyle=e.style.debugBackgroundColor,m(0,0,e.width,e.height),Object.keys(V).forEach((function(t,o){var r=t+": "+V[t];e.ctx.fillStyle=e.style.debugColor,w(r,L-20,(e.attributes.showPerformance?140:24)+14*o)})),e.ctx.restore()):e.ctx.restore(),function(){if(e.attributes.showPerformance){var o=250,r=e.width-o-e.style.scrollBarWidth-2*e.style.scrollBarBorderWidth,c=$,d=100;0===i.length&&(i=s(0,n,1,(function(){return[0,0]}))),0===a.length&&(a=s(0,n,1,(function(){return[0,0]}))),0===l.length&&(l=s(0,n,1,0)),e.ctx.lineWidth=.5,e.ctx.textAlign="left",e.ctx.font=e.style.debugFont,e.ctx.fillStyle=e.style.debugPerfChartBackground,m(r,c,o,d),[["Scroll Height",i,0,e.scrollBox.scrollHeight,e.style.debugScrollHeightColor,!1],["Scroll Width",i,1,e.scrollBox.scrollWidth,e.style.debugScrollWidthColor,!1],["Performance",t,void 0,200,e.style.debugPerformanceColor,!1],["Entities",l,void 0,1500,e.style.debugEntitiesColor,!1],["TouchPPSX",a,0,1e3,e.style.debugTouchPPSXColor,!0],["TouchPPSY",a,1,1e3,e.style.debugTouchPPSYColor,!0]].forEach((function(e,t){e.push(t),u.apply(null,e)})),e.ctx.fillStyle=e.style.debugPerfChartBackground,l.pop(),l.unshift(e.visibleCells.length),i.pop(),i.unshift([e.scrollBox.scrollTop,e.scrollBox.scrollLeft]),a.pop(),a.unshift([e.yPPS,e.xPPS])}function u(t,n,l,i,a,s,u){var h;!function(t,o,r,n,l,i,a,s,c){var d=t/l.length,u=o/a;r+=e.canvasOffsetLeft,n+=e.canvasOffsetTop,e.ctx.beginPath(),e.ctx.moveTo(r,n+o),l.forEach((function(t){var l,a,s=void 0===i?t:t[i];c&&(s=Math.abs(s)),l=r+d,a=n+o-s*u,e.ctx.lineTo(l,a),r+=d})),e.ctx.moveTo(r+t,n+o),e.ctx.strokeStyle=s,e.ctx.stroke()}(o,d,r,c,n,l,i,a,s),e.ctx.fillStyle=a,m(3+r,c+9+11*u,8,8),e.ctx.fillStyle=e.style.debugPerfChartTextColor,h=void 0!==l?n[0][l]:n[0],w(t+" "+(isNaN(h)?0:h).toFixed(3),14+r,c+16+11*u)}}(),e.dispatchEvent("afterdraw",{})||e.ctx.restore()}function ue(e){var t=this;return ie.findIndex(function(o){return _newArrowCheck(this,t),e>=o.from&&e<=o.to}.bind(this))>=0}function he(t,o,r,n){var l=this;t.selectionBorder="";var i=n?function(t,o){return _newArrowCheck(this,l),isCellSelected(e.selections,t-n.y,o-n.x)}.bind(this):function(t,o){return _newArrowCheck(this,l),isCellSelected(e.selections,t,o)}.bind(this),a=Math.max(D.length-1,0),s=Math.max(U.length-1,0),c=t.isRowHeader,d=t.rowIndex,u=t.columnIndex;!c&&i(d,u)&&(i(d-1,u)&&0!==d||t.isHeader||(o.push([t,"t"]),t[r+"BorderTop"]=!0,t[r+"Border"]+="t"),(d>=s||!i(d+1,u))&&(o.push([t,"b"]),t[r+"BorderBottom"]=!0,t[r+"Border"]+="b"),0!==u&&i(d,u-1)||(o.push([t,"l"]),t[r+"BorderLeft"]=!0,t[r+"Border"]+="l"),(u>=a||!i(d,u+1))&&(o.push([t,"r"]),t[r+"BorderRight"]=!0,t[r+"Border"]+="r"))}function fe(t,o,r){var n=e.orders.rows[e.activeCell.rowIndex]===o||e.isRowSelected(o);return function(l,i,a){var s=this;if(l.hidden)return 0;var d,u,v,y=l.style||"cell",x=/HeaderCell/.test(y),C=/cornerCell/.test(y),b="rowHeaderCell"===y,S="columnHeaderCell"===y,B=e.filterable.rows.includes(r)&&e.filterable.columns.includes(i),M="nowrap"!==e.style.cellWhiteSpace,z=isCellSelected(e.selections,o,a),E=e.hovers.rowIndex===o&&("row"===e.attributes.hoverMode||e.hovers.columnIndex===a),P=e.selectedFilterButton.rowIndex==r&&e.selectedFilterButton.columnIndex==i,F=e.activeCell.rowIndex===o&&e.activeCell.columnIndex===a,W="columnHeaderCellCap"===y,G=t?t[l.name]:void 0,j="canvas-datagrid"===l.type,_=e.formatters[l.type||"string"],V=0,U=0,X=e.sizes.columns[i]||l.width,J={value:G,row:t,header:l},Q=!1;if(!(e.orders.columns[e.activeCell.columnIndex]===i||e.isColumnSelected(e.activeCell.viewColumnIndex))&&!n||-1!==a&&-1!==o||(Q=b?"activeRowHeaderCell":"activeColumnHeaderCell"),W&&(X=L-H),void 0===X&&(X=e.style.cellWidth),X*=e.scale,H+X+e.style.cellBorderWidth<0&&(H+=X+e.style.cellBorderWidth),F&&"cornerCell"!==y&&(y="activeCell"),-1!==e.visibleRows.indexOf(r)||x||e.visibleRows.push(r),v=e.dispatchEvent("formatcellvalue",J),T=H,I=O,"cornerCell"===y?(T=0,I=0):b?T=0:x&&(I=0),(u={type:j?"canvas-datagrid-cell":l.type,style:y,nodeType:"canvas-datagrid-cell",x:T,y:I,fontHeight:(e.style[y+"FontHeight"]||0)*e.scale,horizontalAlignment:e.style[y+"HorizontalAlignment"],verticalAlignment:e.style[y+"VerticalAlignment"],paddingLeft:(e.style[y+"PaddingLeft"]||0)*e.scale,paddingTop:(e.style[y+"PaddingTop"]||0)*e.scale,paddingRight:(e.style[y+"PaddingRight"]||0)*e.scale,paddingBottom:(e.style[y+"PaddingBottom"]||0)*e.scale,whiteSpace:e.style.cellWhiteSpace,lineHeight:e.style.cellLineHeight,lineSpacing:e.style.cellLineSpacing,offsetTop:e.canvasOffsetTop+I,offsetLeft:e.canvasOffsetLeft+T,scrollTop:e.scrollBox.scrollTop,scrollLeft:e.scrollBox.scrollLeft,active:F||Q,hovered:E,selected:z,width:X,height:se,offsetWidth:X,offsetHeight:se,parentNode:e.intf.parentNode,offsetParent:e.intf.parentNode,data:t,isCorner:C,isHeader:x,isColumnHeader:S,isColumnHeaderCellCap:W,isRowHeader:b,isFilterable:B,openedFilter:P,rowOpen:k,header:l,columnIndex:a,rowIndex:o,viewRowIndex:o,viewColumnIndex:a,boundRowIndex:e.getBoundRowIndexFromViewRowIndex(o),boundColumnIndex:e.getBoundColumnIndexFromViewColumnIndex(a),sortColumnIndex:i,sortRowIndex:r,isGrid:j,isNormal:!j&&!C&&!x,gridId:(e.attributes.name||"")+r+":"+i,parentGrid:e.intf,innerHTML:"",activeHeader:Q,value:x&&!b?l.title||l.name:G,isRowTree:o>=0&&a==e.cellTree.rowTreeColIndex&&e.cellTree.rows.length>0&&e.cellTree.rows[o].icon,isColumnTree:a>=0&&e.cellTree.columns[o]&&e.cellTree.columns[o][a].icon}).calculatedLineHeight=u.fontHeight*u.lineHeight+u.lineSpacing,u.paddedWidth=u.width-u.paddingRight-u.paddingLeft,u.paddedHeight=u.height-u.paddingTop-u.paddingBottom,J.cell=u,u.userHeight=u.isHeader?e.sizes.rows[-1]:A,u.userWidth=u.isHeader?e.sizes.columns.cornerCell:e.sizes.columns[i],e.visibleCells.unshift(u),function(e){var t=e.boundRowIndex;if(t>=-1==0){if(-1!==e.rowIndex)return;t=-1}re[t]||(re[t]={y:e.y,h:e.height})}(u),function(e){var t=e.columnIndex;le[t]||(le[t]={x:e.x,w:e.width})}(u),!e.dispatchEvent("beforerendercell",J)){if(e.ctx.fillStyle=e.style[y+"BackgroundColor"],e.ctx.strokeStyle=e.style[y+"BorderColor"],e.ctx.lineWidth=e.style[y+"BorderWidth"],E&&(e.ctx.fillStyle=e.style[y+"HoverBackgroundColor"],e.ctx.strokeStyle=e.style[y+"HoverBorderColor"]),z&&(e.ctx.fillStyle=e.style[y+"SelectedBackgroundColor"],e.ctx.strokeStyle=e.style[y+"SelectedBorderColor"]),Q&&(e.ctx.fillStyle=e.style[Q+"BackgroundColor"]),e.dispatchEvent("rendercell",J),u.isGrid&&(u.height!==A&&(u.height=A||e.style.cellHeightWithChildGrid,R=!0),u.width=e.sizes.columns[i]||e.style.cellWidthWithChildGrid),k&&!u.isRowHeader&&(u.height=e.sizes.rows[r]||e.style.cellHeight),u.isGrid||(m(T,I,u.width,u.height),p(T,I,u.width,u.height)),e.ctx.save(),g(u.x,u.y,u.width,u.height,0),e.ctx.clip(),e.dispatchEvent("afterrendercell",J),u.height===se||k&&!u.isRowHeader||(e.sizes.rows[x?-1:r]=u.height,R=!0),u.width!==X&&(e.sizes.columns[i]=u.width,R=!0),b&&e.attributes.tree&&(e.dispatchEvent("rendertreearrow",J)||(U=function(t,o,r){var n=e.style.treeArrowMarginTop*e.scale,l=e.style.treeArrowMarginRight*e.scale,i=e.style.treeArrowMarginLeft*e.scale,a=e.style.treeArrowWidth*e.scale,s=e.style.treeArrowHeight*e.scale;return o+=e.canvasOffsetLeft,r+=e.canvasOffsetTop,e.ctx.fillStyle=e.style.treeArrowColor,e.ctx.strokeStyle=e.style.treeArrowBorderColor,e.ctx.beginPath(),o+=i,r+=n,e.openChildren[t.rowIndex]?(e.ctx.moveTo(o,r),e.ctx.lineTo(o+a,r),e.ctx.lineTo(o+.5*a,r+s),e.ctx.moveTo(o,r)):(e.ctx.lineTo(o,r),e.ctx.lineTo(o+s,r+.5*a),e.ctx.lineTo(o,r+a),e.ctx.lineTo(o,r)),e.ctx.stroke(),e.ctx.fill(),i+a+l}(u,e.style[y+"PaddingLeft"],I))),e.attributes.showRowNumbers&&b||!b)if(u.isGrid&&!e.dispatchEvent("beforerendercellgrid",J)){if(!e.childGrids[u.gridId]){if((d=e.cellGridAttributes).name=e.attributes.saveAppearance?u.gridId:void 0,d.component=!1,d.parentNode=u,d.data=G,J.cellGridAttributes=d,e.dispatchEvent("beforecreatecellgrid",J))return;e.childGrids[u.gridId]=e.createGrid(d),e.sizes.rows[r]=e.sizes.rows[r]||e.style.cellGridHeight,R=!0}u.grid=e.childGrids[u.gridId],u.grid.parentNode=u,u.grid.visible=!0,u.grid.draw(),e.dispatchEvent("rendercellgrid",J)}else if(!u.isGrid&&(e.childGrids[u.gridId]&&(e.childGrids[u.gridId].parentNode.offsetHeight=0),x&&e.orderBy===l.name&&(e.dispatchEvent("renderorderbyarrow",J)||(V=function(t,o){var r=e.style.columnHeaderOrderByArrowMarginTop*e.scale,n=e.style.columnHeaderOrderByArrowMarginLeft*e.scale,l=e.style.columnHeaderOrderByArrowMarginRight*e.scale,i=e.style.columnHeaderOrderByArrowWidth*e.scale,a=e.style.columnHeaderOrderByArrowHeight*e.scale;return t+=e.canvasOffsetLeft,o+=e.canvasOffsetTop,e.ctx.fillStyle=e.style.columnHeaderOrderByArrowColor,e.ctx.strokeStyle=e.style.columnHeaderOrderByArrowBorderColor,e.ctx.beginPath(),t+=n,o+=r,"asc"===e.orderDirection?(e.ctx.lineTo(t,o+a),e.ctx.lineTo(t+i,o+a),e.ctx.lineTo(t+.5*i,o),e.ctx.lineTo(t,o+a)):(e.ctx.moveTo(t,o),e.ctx.lineTo(t+i,o),e.ctx.lineTo(t+.5*i,o+a),e.ctx.moveTo(t,o)),e.ctx.stroke(),e.ctx.fill(),n+i+l}(T+e.style[y+"PaddingLeft"],0))),e.ctx.fillStyle=e.style[y+"Color"],E&&(e.ctx.fillStyle=e.style[y+"HoverColor"]),z&&(e.ctx.fillStyle=e.style[y+"SelectedColor"]),Q&&(e.ctx.fillStyle=e.style[Q+"Color"]),u.treeArrowWidth=U,u.orderByArrowWidth=V,void 0!==(v=void 0!==v?v:_?_(J):"")||_||(v="",console.warn("canvas-datagrid: Unknown format "+l.type+" add a cellFormater")),u.formattedValue=(null!=v?v:"").toString(),e.columnFilters&&void 0!==e.columnFilters[v]&&x&&(u.formattedValue=e.attributes.filterTextPrefix+v),e.ctx.font=e.style[y+"FontHeight"]*e.scale+"px "+e.style[y+"FontName"],e.dispatchEvent("formattext",J)||(u.text=function(t,o){var r=this;if(!t.formattedValue)return{lines:[{width:0,value:""}],width:0,height:t.calculatedLineHeight};var n,l,i,a,s,c,d=t.formattedValue.split(o),u=t.calculatedLineHeight,h=[],f="nowrap"!==e.style.cellWhiteSpace,g=e.attributes.autoResizeRows&&f,m=e.attributes.ellipsisText,p={width:0,value:""},w=f?t.paddedHeight:t.calculatedLineHeight;for(h.push(p),i=e.ctx.measureText(" "+m).width,n=0;n<d.length;n+=1){var v="-"===(l=d[n])[l.length-1]?"":o,y=e.ctx.measureText(l+v);if(p.width+y.width+i<t.paddedWidth)p.value+=l+v,p.width+=y.width;else if(/\w-\w/.test(l)&&t.paddedWidth<y.width){var x=l.split("-");x=x.map(function(e,t){return _newArrowCheck(this,r),t===x.length-1?e:e+"-"}.bind(this)),d.splice.apply(d,[n,1].concat(_toConsumableArray(x))),n-=1}else{if(p={width:y.width,value:l+v},0===n&&(h=[]).push(p),(u+=t.calculatedLineHeight)>w&&!g){if(0===h.length)break;if((c=h[h.length-1]).width<t.paddedWidth&&1===d.length)break;var C=s=c.value+l;if((a=e.ctx.measureText(s+m).width)>t.paddedWidth)for(var b=parseInt(s.length/2),S=-1;b>0;)s=C.substr(0,b*S+s.length),S=(a=e.ctx.measureText(s+m).width)>t.paddedWidth?-1:1,b=parseInt(b/2);s+=C.length!=s.length?m:"",c.value=s,c.width=a;break}n>0&&h.push(p)}}return{lines:h,width:0,height:t.calculatedLineHeight*h.length}}(u," ")),!e.dispatchEvent("rendertext",J))){if(u.innerHTML||"html"===l.type)c(u);else{var $=0,ee=!0;if(u.columnIndex==e.cellTree.rowTreeColIndex&&!u.isColumnHeader&&e.cellTree.rows.length>0&&Object.keys(e.cellTree.rows[u.rowIndex]).length>1&&($=f(u,e.cellTree.rows[u.rowIndex],!0)),!u.isRowHeader&&u.rowIndex>0&&e.cellTree.columns[u.rowIndex-1]&&e.cellTree.columns[u.rowIndex-1][u.columnIndex].icon)for(var te=u.rowIndex-1;te>=0&&e.cellTree.columns[te]&&e.cellTree.columns[te][u.columnIndex].icon;te--)if(!e.cellTree.columns[te][u.columnIndex].expand){ee=!1;break}ee&&!u.isRowHeader&&e.cellTree.columns[u.rowIndex]&&e.cellTree.columns[u.rowIndex][u.columnIndex].icon&&e.viewData.length>0&&e.viewData[u.rowIndex][u.columnIndex].length>0&&($=f(u,e.cellTree.columns[u.rowIndex][u.columnIndex],!1)),ee&&function(t){var o,r,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,l=(t.text.lines.length,t.fontHeight*t.lineHeight),i="nowrap"!==e.style.cellWhiteSpace,a=0;for(o=0;o<t.text.lines.length;o+=1){r=t.text.lines[o];var s=Math.max(.5*(t.height-(i?t.text.height:t.calculatedLineHeight)),0)+l,c=t.paddingLeft+n+t.treeArrowWidth+t.orderByArrowWidth;"right"===t.horizontalAlignment?c=t.paddingLeft+n+t.paddedWidth-r.width:"center"===t.horizontalAlignment&&(c=t.paddingLeft+n+(t.paddedWidth+t.paddingRight)/2-r.width/2),"top"===t.verticalAlignment?s=t.calculatedLineHeight:"bottom"===t.verticalAlignment&&(s=t.height-t.paddingBottom-t.text.height),r.height=l+t.lineSpacing,r.offsetLeft=c,r.offsetTop=s,r.x=t.x+c,r.y=t.y+a+s,a+=r.height,w(r.value,r.x,r.y)}e.attributes.debug&&t.active&&requestAnimationFrame((function(){e.ctx.font=e.style.debugFont,e.ctx.fillStyle=e.style.debugColor,w(JSON.stringify({x:t.x,y:t.y,h:t.height,w:t.width,pw:t.paddedWidth,idx:t.columnIndex,idx_ord:t.sortColumnIndex},null,"\t"),t.x+14,t.y+14),w(JSON.stringify(t.text.lines.map((function(e){return{w:e.width,v:e.value.length}})),null,"\t"),t.x+14,t.y+30)}))}(u,$)}M&&u.text&&u.text.height>A&&(e.sizes.rows[x?-1:r]=u.text.height,R=!0)}F&&(N=u),he(u,K,"selection"),function(t){(e.attributes.allowMovingSelection||e.mobile)&&(t.selectionBorderTop&&t.selectionBorderRight&&e.mobile&&(Y.push([t,"tr"]),t.selectionHandle="tr"),t.selectionBorderTop&&t.selectionBorderLeft&&(e.mobile&&(Y.push([t,"tl"]),t.selectionHandle="tl"),e.fillOverlay.handle&&(e.fillOverlay.snapTo={x:t.x,y:t.y})),t.selectionBorderBottom&&t.selectionBorderLeft&&e.mobile&&(Y.push([t,"bl"]),t.selectionHandle="bl"),t.selectionBorderBottom&&t.selectionBorderRight&&("none"!==e.attributes.selectionHandleBehavior||e.mobile)&&(Y.push([t,"br"]),t.selectionHandle="br",e.fillOverlay.handle&&(e.fillOverlay.handle.x=t.x+t.width,e.fillOverlay.handle.y=t.y+t.height)),e.fillOverlay.handle&&(-1===e.fillOverlay.snapTo.x&&t.selectionBorderLeft&&(e.fillOverlay.snapTo.x=t.x),-1===e.fillOverlay.snapTo.y&&t.selectionBorderTop&&(e.fillOverlay.snapTo.y=t.y)))}(u),e.movingSelection&&he(u,q,"move",e.moveOffset),e.ctx.restore(),B&&function(t,o){var r=t.x+t.width-e.style.filterButtonWidth-1,n=t.y+t.height-e.style.filterButtonHeight-2;if(e.dispatchEvent("beforerenderfilterbutton",o))return;e.ctx.save(),e.ctx.strokeStyle=e.style.filterButtonBorderColor,e.ctx.fillStyle=e.style.filterButtonBackgroundColor,t.openedFilter?e.ctx.fillStyle=e.style.filterButtonActiveBackgroundColor:t.hovered&&e.hovers.onFilterButton&&(e.ctx.fillStyle=e.style.filterButtonHoverBackgroundColor);g(r,n,e.style.filterButtonWidth,e.style.filterButtonHeight,e.style.filterButtonBorderRadius),e.ctx.stroke(),e.ctx.fill(),function(t,o){var r=(e.style.filterButtonHeight-e.style.filterButtonArrowHeight)/2*e.scale,n=(e.style.filterButtonWidth-e.style.filterButtonArrowWidth)/2*e.scale,l=e.style.filterButtonArrowWidth*e.scale,i=e.style.filterButtonArrowHeight*e.scale;t+=e.canvasOffsetLeft,o+=e.canvasOffsetTop,e.ctx.fillStyle=e.style.filterButtonArrowColor,e.ctx.strokeStyle=e.style.filterButtonArrowBorderColor,e.ctx.beginPath(),t+=n,o+=r,e.ctx.moveTo(t,o),e.ctx.lineTo(t+l,o),e.ctx.lineTo(t+.5*l,o+i),e.ctx.moveTo(t,o),e.ctx.stroke(),e.ctx.fill()}(r,n),e.ctx.clip(),e.dispatchEvent("afterrenderfilterbutton",o),e.ctx.restore()}(u);var oe=e.orderings.columns&&e.orderings.columns.length>0;if(b&&e.attributes.showRowNumbers&&e.attributes.showRowNumberGaps&&!1===oe){var ne=e.getBoundRowIndexFromViewRowIndex(o-1),ie=void 0!==ne&&u.boundRowIndex>0&&u.boundRowIndex-ne>1;if(ie&&ae.length>0&&(ie=ae.find(function(e){return _newArrowCheck(this,s),e.from===ne&&e.to===u.boundRowIndex}.bind(this))>=0),ie&&e.hiddenRowRanges.length>0)for(var de=0;de<e.hiddenRowRanges.length;de++){var ue=_slicedToArray(e.hiddenRowRanges[de],2),fe=ue[0],ge=ue[1];if(u.boundRowIndex===ge+1&&ne===fe-1){ie=!1;break}}if(ie){var me=e.style.rowHeaderCellRowNumberGapHeight,pe=e.style.rowHeaderCellRowNumberGapColor;e.ctx.save(),e.ctx.fillStyle=pe,m(u.x,u.y-me/2,u.width,me),e.ctx.restore()}}if(S&&e.attributes.showUnhideColumnsIndicator){var we,ve,ye=e.hovers.unhideIndicator,xe=e.style.unhideIndicatorSize,Ce=H,be=u.y+Math.max(.5*(u.height-xe),0),Se=function(e){return _newArrowCheck(this,s),ye&&("l"===ye.dir||"r"===ye.dir)&&e>=ye.orderIndex0&&e<=ye.orderIndex1}.bind(this),Re=function(e){return _newArrowCheck(this,s),e>=0&&D[e]&&D[e].hidden}.bind(this),Be=function(t,o,r){if(_newArrowCheck(this,s),e.visibleUnhideIndicators.push({x:t-1,y:be-1,x2:t+xe+2,y2:be+xe+2,orderIndex0:we,orderIndex1:ve,dir:o}),!r){var n=u.text&&u.text.lines&&u.text.lines[0];if(n){var l=V+U,i=l>0?l:n.x,a=n.x+n.width;if(t+xe>=i&&t<=a)return}}h(t,be,xe,o,r)}.bind(this),Te=a-1,Ie=e.orders.columns[Te];if(Re(Ie)){var Me=Se(Ie);for(we=Te,ve=Te;--Te>=0&&Re(e.orders.columns[Te]);)we=Te;Be(Ce,"r",Me)}Te=a+1;var ke=e.orders.columns[Te];if(Re(ke)){var Ae=Se(ke);for(we=Te,ve=Te;++Te<e.orders.columns.length&&Re(e.orders.columns[Te]);)ve=Te;Be(H+u.width-xe,"l",Ae)}}if(b&&e.attributes.showUnhideRowsIndicator&&e.hiddenRowRanges.length>0){var ze=e.hovers.unhideIndicator,Oe=e.style.unhideIndicatorSize,He=u.x+u.width-Oe-2,Ee=O,Pe={},Le={};e.hiddenRowRanges.forEach(function(e){_newArrowCheck(this,s),Pe[e[0]-1]=e,Le[e[1]+1]=e}.bind(this));var De,Fe,We=u.rowIndex+ce,Ne=function(){return _newArrowCheck(this,s),ze&&("t"===ze.dir||"b"===ze.dir)&&We>=ze.orderIndex0-1&&We<=ze.orderIndex1+1}.bind(this),Ge=function(t,o,r){_newArrowCheck(this,s),e.visibleUnhideIndicators.push({x:He-1,y:t-1,x2:He+Oe+2,y2:t+Oe+2,orderIndex0:De,orderIndex1:Fe,dir:o}),h(He,t,Oe,o,r)}.bind(this),je=Pe[We];if(je){var _e=Ee+u.height-Oe,Ve=_slicedToArray(je,2);De=Ve[0],Fe=Ve[1],Ge(_e,"t",Ne())}if(je=Le[We]){var Ue=Ee,Ze=_slicedToArray(je,2);De=Ze[0],Fe=Ze[1],Ge(Ue,"b",Ne())}}return H+=u.width+(Z?0:e.style.cellBorderWidth),u.width}}}function ge(t,o){var r,n,l,i,a=D.length;if(O-2*se>P)return!1;if(W=U[t],k=e.openChildren[t],l=(e.sizes.rows[t]||e.style.cellHeight)*e.scale,n=(k?e.sizes.trees[t]:0)*e.scale,O<-(A=l+n))return!1;for(e.attributes.showRowHeaders&&(H+=ee),se=A,i=e.scrollIndexLeft;i<a;i+=1)if(ue(i)||(r=e.orders.columns[i],H+=fe(W,t,o)(D[r],r,i)),H>e.width){e.scrollIndexRight=i,e.scrollPixelRight=H;break}for(H=1,e.attributes.showRowHeaders&&(H+=ee),i=0;i<e.frozenColumn&&(ue(i)||(r=e.orders.columns[i],H+=fe(W,t,o)(D[r],r,i)),!(H>e.width));i+=1);if(e.lastFrozenColumnPixel=H,se=A,H=-e.scrollBox.scrollLeft+e.scrollPixelLeft+e.style.cellBorderWidth,M=e.childGrids[t],t!==U.length&&k){if(M.visible=!0,M.parentNode={offsetTop:O+l+e.canvasOffsetTop,offsetLeft:ee-1+e.canvasOffsetLeft,offsetHeight:n,offsetWidth:e.width-ee-e.style.scrollBarWidth-1,offsetParent:e.intf.parentNode,parentNode:e.intf.parentNode,style:e.style,nodeType:"canvas-datagrid-tree",scrollTop:e.scrollBox.scrollTop,scrollLeft:e.scrollBox.scrollLeft,rowIndex:t,columnGroupsAreaHeight:oe,rowGroupsAreaWidth:te},e.intf.parentNode){var s=e.intf.parentNode,c=s.columnGroupsAreaHeight,d=s.rowGroupsAreaWidth;M.parentNode.columnGroupsAreaHeight+=c||0,M.parentNode.rowGroupsAreaWidth+=d||0}e.visibleCells.unshift({rowIndex:t,columnIndex:0,y:M.parentNode.offsetTop,x:M.parentNode.offsetLeft,height:M.height,width:M.width,style:"tree-grid",type:M.parentNode.nodeType}),M.draw()}else M&&(M.parentNode.offsetHeight=0,delete e.sizes.trees[t]);return X.push([W,t,o,O,A]),e.visibleRowHeights[t]=A,O+=se+(Z?0:e.style.cellBorderWidth),!0}}}function getDefaultExportFromCjs(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function createCommonjsModule(e,t,o){return e(o={path:t,exports:{},require:function(e,t){return commonjsRequire(e,null==t?o.path:t)}},o.exports),o.exports}function commonjsRequire(){throw new Error("Dynamic requires are not currently supported by @rollup/plugin-commonjs")}var dist=createCommonjsModule((function(e){e.exports=function(e){var t={};function o(r){if(t[r])return t[r].exports;var n=t[r]={i:r,l:!1,exports:{}};return e[r].call(n.exports,n,n.exports,o),n.l=!0,n.exports}return o.m=e,o.c=t,o.d=function(e,t,r){o.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},o.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},o.t=function(e,t){if(1&t&&(e=o(e)),8&t)return e;if(4&t&&"object"==_typeof(e)&&e&&e.__esModule)return e;var r=Object.create(null);if(o.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var n in e)o.d(r,n,function(t){return e[t]}.bind(null,n));return r},o.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return o.d(t,"a",t),t},o.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},o.p="",o(o.s=0)}([function(e,t,o){Object.defineProperty(t,"__esModule",{value:!0});var r=o(1),n=Object.keys(r.default).reduce((function(e,t){return e.concat(r.default[t])}),[]);t.default=function(e){return-1===n.indexOf(e.key)}},function(e,t,o){Object.defineProperty(t,"__esModule",{value:!0}),t.default={modifier:["Alt","AltGraph","CapsLock","Control","Fn","FnLock","Meta","NumLock","ScrollLock","Shift","Symbol","SymbolLock"],legacyModifier:["Hyper","Super"],whiteSpace:["Enter","Tab"],navigation:["ArrowDown","ArrowLeft","ArrowRight","ArrowUp","End","Home","PageDown","PageUp"],editing:["Backspace","Clear","Copy","CrSel","Cut","Delete","EraseEof","ExSel","Insert","Paste","Redo","Undo"],ui:["Accept","Again","Attn","Cancel","ContextMenu","Escape","Execute","Find","Help","Pause","Play","Props","Select","ZoomIn","ZoomOut"],device:["BrightnessDown","BrightnessUp","Eject","LogOff","Power","PowerOff","PrintScreen","Hibernate","Standby","WakeUp"],imeCompositionKeys:["AllCandidates","Alphanumeric","CodeInput","Compose","Convert","Dead","FinalMode","GroupFirst","GroupLast","GroupNext","GroupPrevious","ModeChange","NextCandidate","NonConvert","PreviousCandidate","Process","SingleCandidate"],koreanSpecific:["HangulMode","HanjaMode","JunjaMode"],japaneseSpecific:["Eisu","Hankaku","Hiragana","HiraganaKatakana","KanaMode","KanjiMode","Katakana","Romaji","Zenkaku","ZenkakuHankaku"],commonFunction:["F1","F2","F3","F4","F5","F6","F7","F8","F9","F10","F11","F12","Soft1","Soft2","Soft3","Soft4"],multimedia:["ChannelDown","ChannelUp","Close","MailForward","MailReply","MailSend","MediaClose","MediaFastForward","MediaPause","MediaPlay","MediaPlayPause","MediaRecord","MediaRewind","MediaStop","MediaTrackNext","MediaTrackPrevious","New","Open","Print","Save","SpellCheck"],multimediaNumpad:["Key11","Key12"],audio:["AudioBalanceLeft","AudioBalanceRight","AudioBassBoostDown","AudioBassBoostToggle","AudioBassBoostUp","AudioFaderFront","AudioFaderRear","AudioSurroundModeNext","AudioTrebleDown","AudioTrebleUp","AudioVolumeDown","AudioVolumeUp","AudioVolumeMute","MicrophoneToggle","MicrophoneVolumeDown","MicrophoneVolumeUp","MicrophoneVolumeMute"],speech:["SpeechCorrectionList","SpeechInputToggle"],application:["LaunchApplication1","LaunchApplication2","LaunchCalendar","LaunchContacts","LaunchMail","LaunchMediaPlayer","LaunchMusicPlayer","LaunchPhone","LaunchScreenSaver","LaunchSpreadsheet","LaunchWebBrowser","LaunchWebCam","LaunchWordProcessor"],browser:["BrowserBack","BrowserFavorites","BrowserForward","BrowserHome","BrowserRefresh","BrowserSearch","BrowserStop"],mobilePhone:["AppSwitch","Call","Camera","CameraFocus","EndCall","GoBack","GoHome","HeadsetHook","LastNumberRedial","Notification","MannerMode","VoiceDial"],tv:["TV","TV3DMode","TVAntennaCable","TVAudioDescription","TVAudioDescriptionMixDown","TVAudioDescriptionMixUp","TVContentsMenu","TVDataService","TVInput","TVInputComponent1","TVInputComponent2","TVInputComposite1","TVInputComposite2","TVInputHDMI1","TVInputHDMI2","TVInputHDMI3","TVInputHDMI4","TVInputVGA1","TVMediaContext","TVNetwork","TVNumberEntry","TVPower","TVRadioService","TVSatellite","TVSatelliteBS","TVSatelliteCS","TVSatelliteToggle","TVTerrestrialAnalog","TVTerrestrialDigital","TVTimer"],mediaControls:["AVRInput","AVRPower","ColorF0Red","ColorF1Green","ColorF2Yellow","ColorF3Blue","ColorF4Grey","ColorF5Brown","ClosedCaptionToggle","Dimmer","DisplaySwap","DVR","Exit","FavoriteClear0","FavoriteClear1","FavoriteClear2","FavoriteClear3","FavoriteRecall0","FavoriteRecall1","FavoriteRecall2","FavoriteRecall3","FavoriteStore0","FavoriteStore1","FavoriteStore2","FavoriteStore3","Guide","GuideNextDay","GuidePreviousDay","Info","InstantReplay","Link","ListProgram","LiveContent","Lock","MediaApps","MediaAudioTrack","MediaLast","MediaSkipBackward","MediaSkipForward","MediaStepBackward","MediaStepForward","MediaTopMenu","NavigateIn","NavigateNext","NavigateOut","NavigatePrevious","NextFavoriteChannel","NextUserProfile","OnDemand","Pairing","PinPDown","PinPMove","PinPToggle","PinPUp","PlaySpeedDown","PlaySpeedReset","PlaySpeedUp","RandomToggle","RcLowBattery","RecordSpeedNext","RfBypass","ScanChannelsToggle","ScreenModeNext","Settings","SplitScreenToggle","STBInput","STBPower","Subtitle","Teletext","VideoModeNext","Wink","ZoomToggle"]}}]).default})),isPrintableKeyEvent=getDefaultExportFromCjs(dist),isSupportedHtml=function(e){var t=this;return[/(?:^(<meta[^>]*>)?[\s\S]*<div[^>]*>)/,/(?:^(<meta[^>]*>)?[\s\S]*<table[^>]*>)/,/(?:^(<meta[^>]*>)?[\s\S]*<span[^>]*>)/,/(?:<!--StartFragment-->[\s\S]*<tr[^>]*>)/,/(?:<!--StartFragment-->[\s\S]*<td[^>]*>)/].some(function(o){return _newArrowCheck(this,t),o.test(e)}.bind(this))},IGNORE_NODETYPES=[8,3],isHtmlTable=function(e){return/(?:<table[^>]*>)|(?:<tr[^]*>)/.test(e)},sanitizeElementData=function(e){var t=1===e.nodeType?e.innerText:e.data;return String(t).replace(/\s+/g," ").trim()},parseHtmlText=function(e){var t=this,o=(new DOMParser).parseFromString(e,"text/html"),r=o.querySelector("div")||o.querySelector("span");return sanitizeElementData(r).split("\n").map(function(e){var o=this;return _newArrowCheck(this,t),e.split("\t").map(function(e){return _newArrowCheck(this,o),{value:[{value:e}]}}.bind(this))}.bind(this))},parseHtmlTable=function(e){var t,o=[],r=_createForOfIteratorHelper((new DOMParser).parseFromString(e,"text/html").querySelectorAll("table tr"));try{for(r.s();!(t=r.n()).done;){var n,l=t.value,i=[],a=_createForOfIteratorHelper(l.childNodes);try{for(a.s();!(n=a.n()).done;){var s=n.value;if(!IGNORE_NODETYPES.includes(s.nodeType)){var c={value:[]},d=sanitizeElementData(s);d&&c.value.push({value:d}),i.push(c)}}}catch(e){a.e(e)}finally{a.f()}o.push(i)}}catch(e){r.e(e)}finally{r.f()}return o},parseText=function(e){var t=this;return e.split("\n").map(function(e){var o=this;return _newArrowCheck(this,t),e.split("\t").map(function(e){return _newArrowCheck(this,o),{value:[{value:e}]}}.bind(this))}.bind(this))},parseData=function(e,t){return"text/html"===t&&isHtmlTable(e)?parseHtmlTable(e):"text/html"===t?parseHtmlText(e):parseText(e)},htmlSafe=function(e){return"string"!=typeof e?e:e.replace(/</g,"<").replace(/>/g,">")},createTextString=function(e,t){var o=this;return t?e.map(function(e){return _newArrowCheck(this,o),Object.values(e).join("\t")}.bind(this)).join("\n"):e.map(function(e){return _newArrowCheck(this,o),Object.values(e).join("")}.bind(this)).join("")},createHTMLString=function(e,t){var o=this;if(!t)return createTextString(e,t);var r="<table>";return r+=e.map(function(e){var t=this;return _newArrowCheck(this,o),"<tr>"+Object.values(e).map(function(e){return _newArrowCheck(this,t),["<td>",htmlSafe(e),"</td>"].join("")}.bind(this)).join("")+"</tr>"}.bind(this)).join(""),r+="</table>"};function events(e){var t;e.stopPropagation=function(e){e.stopPropagation()},e.addEventListener=function(t,o){e.events[t]=e.events[t]||[],e.events[t].unshift(o)},e.removeEventListener=function(t,o){(e.events[t]||[]).forEach((function(r,n){o===r&&e.events[t].splice(n,1)}))},e.dispatchEvent=function(t,o){var r;function n(){r=!0}if(o=t.type?t:o||{},t=t.type||t,e.events[t])return e.events[t].forEach((function(t){o.ctx=e.ctx,o.preventDefault=n,t.apply(e.intf,[o])})),r},e.getRatio=function(){return Math.min(e.attributes.maxPixelRatio,(window.devicePixelRatio||1)/(e.ctx.webkitBackingStorePixelRatio||e.ctx.mozBackingStorePixelRatio||e.ctx.msBackingStorePixelRatio||e.ctx.oBackingStorePixelRatio||e.ctx.backingStorePixelRatio||1))},e.refreshScrollCacheX=function(){var t=this,o=e.getSchema();e.scrollCache.x=[];var r=0,n=e.getCollapsedColumnGroups(),l=function(e){var o=this;return _newArrowCheck(this,t),n.findIndex(function(t){return _newArrowCheck(this,o),e>=t.from&&e<=t.to}.bind(this))>=0}.bind(this);return o.reduce((function(t,n,i){var a=e.orders.columns[i],s=e.getColumnWidth(a);return o[a].hidden||l(i)||(t+=s),i<e.frozenColumn?(e.scrollCache.x[i]=t,r=t):e.scrollCache.x[i]=Math.max(r+s,t),t}),0)||0},e.resize=function(t){if(e.canvas){var o,r,n={x:0,y:0,height:0,width:0,style:"vertical-scroll-bar"},l={x:0,y:0,height:0,width:0,style:"horizontal-scroll-bar"},i={x:0,y:0,height:0,width:0,style:"vertical-scroll-box"},a={x:0,y:0,height:0,width:0,style:"horizontal-scroll-box"},s={x:0,y:0,height:0,width:0,isCorner:!0,isScrollBoxCorner:!0,style:"scroll-box-corner"},c=2*e.style.scrollBarBoxMargin,d=2*e.style.scrollBarBorderWidth,u=.5*e.style.scrollBarBoxMargin,h=e.style.scrollBarWidth+2*e.style.scrollBarBorderWidth,f=e.getRatio(),g="collapse"===e.style.gridBorderCollapse?1:2,m=e.style.cellBorderWidth*g,p=e.style.columnHeaderCellBorderWidth*g,w=0,v=0,y=(e.viewData||[]).length,x=e.getColumnHeaderCellHeight(),C=e.getRowHeaderCellWidth(),b=e.getColumnGroupAreaHeight(),S=e.getRowGroupAreaWidth(),R=e.style.cellHeight;for(v=e.refreshScrollCacheX(),e.scrollCache.y=[],o=0;o<y;o+=1)e.scrollCache.y[o]=w,w+=((e.sizes.rows[o]||R)+(e.sizes.trees[o]||0))*e.scale+(e.frozenRow>o&&e.sizes.trees[o]||0);if(y>1&&(e.scrollCache.y[o]=w),e.attributes.showNewRow&&(w+=R),e.attributes.snapToRow&&(w+=e.style.cellHeight),k(),e.isChildGrid?(e.width=e.parentNode.offsetWidth,e.height=e.parentNode.offsetHeight):e.height===e.canvas.offsetHeight&&e.width===e.canvas.offsetWidth||(e.height=e.canvas.offsetHeight,e.width=e.canvas.offsetWidth,e.canvasOffsetLeft=e.args.canvasOffsetLeft||0,e.canvasOffsetTop=e.args.canvasOffsetTop||0),e.scrollBox.top=x+b+p,e.scrollBox.left=C+S,M(),I(),e.scrollBox.horizontalBarVisible&&("auto"!==e.style.height||e.isChildGrid||(e.height+=h),w+=h,k(),M(),I()),e.scrollBox.verticalBarVisible&&("auto"!==e.style.width||e.isChildGrid||(e.width+=h),v+=h,k(),M(),I()),M(),e.scrollBox.scrollWidth=v-e.scrollBox.width,e.scrollBox.scrollHeight=w-e.scrollBox.height,e.frozenColumn>0?e.scrollBox.widthBoxRatio=(e.scrollBox.width-e.scrollCache.x[e.frozenColumn-1])/v:e.scrollBox.widthBoxRatio=e.scrollBox.width/v,e.scrollBox.scrollBoxWidth=e.scrollBox.width*e.scrollBox.widthBoxRatio-e.style.scrollBarWidth-d-u,e.scrollBox.heightBoxRatio=(e.scrollBox.height-x-b-e.scrollCache.y[e.frozenRow])/w,e.scrollBox.scrollBoxHeight=e.scrollBox.height*e.scrollBox.heightBoxRatio-e.style.scrollBarWidth-d-u,e.scrollBox.scrollBoxWidth=Math.max(e.scrollBox.scrollBoxWidth,e.style.scrollBarBoxMinSize),e.scrollBox.scrollBoxHeight=Math.max(e.scrollBox.scrollBoxHeight,e.style.scrollBarBoxMinSize),l.x+=C,l.y+=e.height-e.style.scrollBarWidth-u-b,l.width=e.width-e.style.scrollBarWidth-C-S-u-c,l.height=e.style.scrollBarWidth+e.style.scrollBarBorderWidth+u,a.y=l.y+e.style.scrollBarBoxMargin,a.width=e.scrollBox.scrollBoxWidth,a.height=e.style.scrollBarBoxWidth,n.x+=e.width-S-e.style.scrollBarWidth-e.style.scrollBarBorderWidth-u,n.y+=x+e.scrollCache.y[e.frozenRow],n.width=e.style.scrollBarWidth+e.style.scrollBarBorderWidth+u,n.height=e.height-x-b-e.style.scrollBarWidth-u-c,i.x=n.x+e.style.scrollBarBoxMargin,i.y+=e.scrollCache.y[e.frozenRow],i.width=e.style.scrollBarBoxWidth,i.height=e.scrollBox.scrollBoxHeight,s.x=l.x+l.width+c,s.y=n.y+n.height+c,s.width=e.style.scrollBarWidth+e.style.scrollBarBorderWidth,s.height=e.style.scrollBarWidth+e.style.scrollBarBorderWidth,e.scrollBox.entities={horizontalBar:l,horizontalBox:a,verticalBar:n,verticalBox:i,corner:s},e.scrollBox.bar={v:n,h:l},e.scrollBox.box={v:i,h:a},e.page=Math.max(1,e.visibleRows.length-3-e.attributes.pageUpDownOverlap),!e.isChildGrid){var B=e.width*f,T=e.height*f;e.canvas.width===B&&e.canvas.height===T||(e.canvas.width=B,e.canvas.height=T,e.ctx.scale(f,f))}return e.resizeEditInput(),e.scroll(!0),t&&e.draw(!0),e.dispatchEvent("resize",{}),!0}function I(){e.scrollBox.horizontalBarVisible="auto"!==e.style.width&&v>e.scrollBox.width&&"hidden"!==e.style.overflowX||"scroll"===e.style.overflowX,e.scrollBox.horizontalBoxVisible=v>e.scrollBox.width,e.scrollBox.verticalBarVisible="auto"!==e.style.height&&w>e.scrollBox.height&&"hidden"!==e.style.overflowY||"scroll"===e.style.overflowY,e.scrollBox.verticalBoxVisible=w>e.scrollBox.height}function M(){e.scrollBox.width=e.width-C-S,e.scrollBox.height=e.height-x-b}function k(){e.isChildGrid||(r={height:x+b+w+m+1,width:v+C+m+S},["width","height"].forEach((function(t){-1!==["auto",void 0].indexOf(e.style[t])&&-1!==["auto",void 0].indexOf(e.appliedInlineStyles[t])?e.parentNodeStyle[t]=r[t]+"px":-1==["auto",void 0].indexOf(e.style[t])&&-1==["auto",void 0].indexOf(e.appliedInlineStyles[t])&&(e.parentNodeStyle[t]=e.style[t],e.isComponent&&(e.canvas.style[t]=e.style[t]))})))}},e.scroll=function(t){var o=e.getSchema(),r=(e.viewData||[]).length,n=e.style.cellHeight;for(e.scrollIndexTop=Math.floor(r*(e.scrollBox.scrollTop/e.scrollBox.scrollHeight)-100),e.scrollIndexTop=Math.max(e.scrollIndexTop,0),e.scrollPixelTop=e.scrollCache.y[e.scrollIndexTop],0===e.scrollBox.scrollHeight&&(e.scrollIndexTop=0),e.scrollPixelTop=0,e.scrollIndexLeft=e.frozenColumn,e.scrollPixelLeft=0;e.scrollPixelTop<e.scrollBox.scrollTop&&e.scrollIndexTop<e.viewData.length;)e.scrollIndexTop+=1,e.scrollPixelTop=e.scrollCache.y[e.scrollIndexTop];for(;e.scrollPixelLeft<e.scrollBox.scrollLeft+1&&e.scrollIndexLeft<o.length;)e.scrollPixelLeft=e.scrollCache.x[e.scrollIndexLeft],e.scrollIndexLeft+=1;o.length>0&&(e.scrollIndexLeft=Math.max(e.scrollIndexLeft-1,0),e.scrollPixelLeft-=e.getColumnWidth(e.orders.columns[e.scrollIndexLeft])),(e.viewData||[]).length>0&&(e.scrollIndexTop=Math.max(e.scrollIndexTop-1,0),e.scrollPixelTop=Math.max(e.scrollPixelTop-(e.viewData[e.scrollIndexTop]?(e.sizes.rows[e.scrollIndexTop]||n)+(e.sizes.trees[e.scrollIndexTop]||0):n)*e.scale,0)),e.ellipsisCache={},t||e.draw(!0),requestAnimationFrame(e.resizeEditInput),e.dispatchEvent("scroll",{top:e.scrollBox.scrollTop,left:e.scrollBox.scrollLeft})},e.mousemove=function(t,o){if(!e.contextMenu&&!e.input){if(e.draggingItem&&0===t.which)return e.stopFreezeMove(t),void e.mouseup(t);e.mouse=o||e.getLayerPos(t);var r,n,l,i,a=(t.ctrlKey||t.metaKey||e.attributes.persistantSelectionMode)&&!e.attributes.singleSelectionMode,s=e.getSchema(),c=e.mouse.x,d=e.mouse.y,u=e.getCellAt(c,d),h=!1,f=!1,g={NativeEvent:t,cell:u,x:c,y:d},m=e.currentCell;if(clearTimeout(e.scrollTimer),e.isInGrid({x:c,y:d})||(e.hasFocus=!1),!e.dispatchEvent("mousemove",g)){if(u&&e.currentCell&&(e.rowBoundaryCrossed=e.currentCell.rowIndex!==u.rowIndex,e.columnBoundaryCrossed=e.currentCell.columnIndex!==u.columnIndex,e.cellBoundaryCrossed=e.rowBoundaryCrossed||e.columnBoundaryCrossed,["row","column","cell"].forEach((function(t){e[t+"BoundaryCrossed"]&&(g.cell=m,e.dispatchEvent(t+"mouseout",g),g.cell=u,e.dispatchEvent(t+"mouseover",g))}))),e.currentCell=u,!e.draggingItem&&u&&("cell"===u.context||u.context===e.cursorGrab)){var p=e.getUnhideIndicator(e.mouse.x,e.mouse.y);if(p)return e.cursor="pointer",e.hovers={unhideIndicator:p},void e.draw()}if(e.hovers={},!e.draggingItem&&u){if(e.dragItem=u,e.dragMode=u.dragContext,e.cursor=u.context,"cell"===u.context&&(e.cursor="default",e.hovers={rowIndex:u.rowIndex,columnIndex:u.columnIndex,onFilterButton:!1,onCellTreeIcon:!1},u.isFilterable&&c>u.x+u.width+e.canvasOffsetLeft-e.style.filterButtonWidth&&c<u.x+u.width+e.canvasOffsetLeft&&d>u.y+u.height+e.canvasOffsetTop-e.style.filterButtonHeight&&d<u.y+u.height+e.canvasOffsetTop&&(e.hovers.onFilterButton=!0,e.draw()),u.isRowTree||u.isColumnTree)){var w=u.isRowTree?e.cellTree.rows[u.rowIndex].parentCount:0,v=e.style.cellTreeIconWidth*e.scale,y=u.x+u.paddingLeft+e.canvasOffsetLeft+e.style.cellTreeIconMarginLeft+w*(v+u.paddingLeft),x=u.y+e.canvasOffsetTop+e.style.cellTreeIconMarginTop*e.scale;c>=y&&c<=y+v&&d>=x&&d<x+v&&(e.hovers.onCellTreeIcon=!0,e.draw())}if(e.selecting||e.reorderObject){if(i={x:Math.abs(e.dragStart.x-c),y:Math.abs(e.dragStart.y-d)},-1!==e.dragStartObject.columnIndex&&t.shiftKey&&(e.dragStartObject={rowIndex:e.activeCell.rowIndex,columnIndex:e.activeCell.columnIndex}),n={top:Math.min(e.dragStartObject.rowIndex,u.rowIndex),left:Math.min(e.dragStartObject.columnIndex,u.columnIndex),bottom:Math.max(e.dragStartObject.rowIndex,u.rowIndex),right:Math.max(e.dragStartObject.columnIndex,u.columnIndex)},-1===e.dragStartObject.columnIndex&&(l=e.getSelectionBounds(),n.left=-1,n.right=s.length-1,n.top=Math.min(l.top,u.rowIndex),n.bottom=Math.max(l.bottom,u.rowIndex),n.top<0&&(n.top=0)),-1===e.dragStartObject.rowIndex&&(l=e.getSelectionBounds(),n.left=void 0===u.columnIndex?l.left:Math.min(l.left,u.columnIndex),n.right=void 0===u.columnIndex?l.right:Math.max(l.right,u.columnIndex),n.top=-1,n.bottom=e.viewData.length-1,n.left<0&&(n.left=0),n.left!=n.right?e.isMultiColumnsSelected=!0:e.isMultiRowsSelected=!1),e.dragStartObject.rowIndex===u.rowIndex&&e.dragStartObject.columnIndex===u.columnIndex||(e.ignoreNextClick=!0),e.cellBoundaryCrossed||0===i.x&&0===i.y||"row"===e.attributes.selectionMode)if(void 0===u.rowIndex||"row"!==e.attributes.selectionMode&&-1!==e.dragStartObject.columnIndex||!e.rowBoundaryCrossed)if(void 0===u.rowIndex||"column"!==e.attributes.selectionMode&&-1!==e.dragStartObject.rowIndex||!e.columnBoundaryCrossed){if("row"!==e.attributes.selectionMode){if(u.hovered&&e.hovers.onFilterButton)return u.openedFilter?(u.openedFilter=!1,e.selectedFilterButton={columnIndex:-1,rowIndex:-1}):(e.selectedFilterButton.rowIndex=u.rowIndex,e.selectedFilterButton.columnIndex=u.columnIndex,e.contextmenuEvent(t,{x:u.x+u.width-e.style.filterButtonWidth,y:u.y+u.height,rect:{left:0,top:0}})),void e.draw();if(u.hovered&&e.hovers.onCellTreeIcon&&"mousedown"==t.type)return void e.toggleCollapseTree(u.rowIndex,u.columnIndex);if(e.selectedFilterButton={columnIndex:-1,rowIndex:-1},e.hovers.onFilterButton)return;if(e.hovers.onCellTreeIcon)return;e.dragAddToSelection||void 0===u.rowIndex?e.isCellSelected(u)||e.selectCell(u):e.isCellSelected(u)&&e.unselectCell(u)}}else e.dragStartObject.columnIndex<u.columnIndex?(n.left=e.dragStartObject.columnIndex,n.right=u.columnIndex):(n.left=u.columnIndex,n.right=e.dragStartObject.columnIndex);else e.dragStartObject.rowIndex<u.rowIndex?(n.top=e.dragStartObject.rowIndex,n.bottom=u.rowIndex):(n.top=u.rowIndex,n.bottom=e.dragStartObject.rowIndex);if(!(e.selectionBounds&&n.top===e.selectionBounds.top&&n.left===e.selectionBounds.left&&n.bottom===e.selectionBounds.bottom&&n.right===e.selectionBounds.right||a))if(u.hovered&&e.hovers.onFilterButton||e.clearSelections(),-1===n.top&&(n.top=0),l=n,"row"===e.attributes.selectionMode)for(r=l.top;r<=l.bottom;r+=1)e.selectRow(r,!0,null,!0);else e.selectArea(l,!0),e.activeCell.rowIndex=l.top,e.activeCell.columnIndex=l.left,-1==l.left&&l.top!==l.bottom&&(e.activeCell.columnIndex=0,e.isMultiRowsSelected=!0,e.isMultiColumnsSelected=!1)}else e.movingSelectionHandle&&(i={x:Math.abs(e.dragStart.x-c),y:Math.abs(e.dragStart.y-d)},"y"===e.fillOverlay.direction?f=!0:"x"===e.fillOverlay.direction&&(h=!0));if(i)if(e.attributes.autoScrollOnMousemove||h||f){var C=!h&&i.y>e.attributes.autoScrollMargin,b=!f&&i.x>e.attributes.autoScrollMargin;C&&!b?e.autoScrollZone(t,-1,d,a):b&&!C?e.autoScrollZone(t,c,-1,a):b&&C&&e.autoScrollZone(t,c,d,a)}else e.autoScrollZone(t,c,d,a)}e.getColumnGroupAt(e.mouse.x,e.mouse.y)&&(e.cursor="pointer"),e.getRowGroupAt(e.mouse.x,e.mouse.y)&&(e.cursor="pointer"),e.cellBoundaryCrossed=!1,e.rowBoundaryCrossed=!1,e.columnBoundaryCrossed=!1,e.draw(!0)}}},e.click=function(t,o){var r,n=JSON.stringify(e.getSelectionBounds()),l=(t.ctrlKey||t.metaKey||e.attributes.persistantSelectionMode)&&!e.attributes.singleSelectionMode,i=o||e.getLayerPos(t);if(e.currentCell=e.getCellAt(i.x,i.y),void 0===e.currentCell.grid)if(e.input&&e.endEdit(),e.ignoreNextClick)e.ignoreNextClick=!1;else if(r=e.currentCell,!e.dispatchEvent("click",{NativeEvent:t,cell:e.currentCell})){var a=e.getUnhideIndicator(i.x,i.y);if(a){var s=a.dir,c=a.orderIndex0,d=a.orderIndex1;"l"===s||"r"===s?e.unhideColumns(c,d):e.unhideRows(c,d)}else{var u=e.getColumnGroupAt(i.x,i.y);if(u||(u=e.getRowGroupAt(i.x,i.y)),u&&e.toggleGroup(u))return e.setStorageData(),void e.refresh();if(e.hasFocus){var h=e.getRowGroupAreaWidth(),f=e.getColumnGroupAreaHeight(),g=i.x-h,m=i.y-f;if(-1!==["rowHeaderCell","columnHeaderCell"].indexOf(e.currentCell.style)||l||e.hovers.onFilterButton||e.setActiveCell(r.columnIndex,r.rowIndex),"cell"===e.currentCell.context){if("cornerCell"===e.currentCell.style)return e.selectAll(),e.draw(),void p();if("columnHeaderCell"===e.currentCell.style&&"sort"===e.attributes.columnHeaderClickBehavior)return e.orderBy===r.header.name?e.orderDirection="asc"===e.orderDirection?"desc":"asc":e.orderDirection="asc",e.order(r.header.name,e.orderDirection),void p();if(("row"===e.attributes.selectionMode||"rowHeaderCell"===e.currentCell.style)&&"rowHeaderCell"===e.currentCell.style&&e.attributes.tree&&g>0&&g-e.currentCell.x<e.style.treeArrowWidth+e.style.treeArrowMarginLeft+e.style.treeArrowMarginRight+e.style.treeArrowClickRadius&&m-e.currentCell.y<e.style.treeArrowHeight+e.style.treeArrowMarginTop+e.style.treeArrowClickRadius&&m>0)return void e.toggleTree(r.rowIndex);t.shiftKey&&!l&&(e.selectionBounds=e.getSelectionBounds(),e.selectArea(void 0,!1))}p(),e.draw(!0)}}}function p(){var t=e.getSelectionBounds();n!==JSON.stringify(t)&&e.dispatchEvent("selectionchanged",e.getContextOfSelectionEvent())}},e.dragResizeColumn=function(t){var o,r,n,l="ew-resize"===e.dragMode;if(o=e.getLayerPos(t),r=e.resizingStartingWidth+o.x-e.dragStart.x,n=e.resizingStartingHeight+o.y-e.dragStart.y,r<e.style.minColumnWidth&&(r=e.style.minColumnWidth),n<e.style.minRowHeight&&(n=e.style.minRowHeight),e.dispatchEvent(l?"resizecolumn":"resizerow",{x:r,y:n,width:r,height:n,columnIndex:l?e.draggingItem.columnIndex:void 0,rowIndex:l?void 0:e.draggingItem.rowIndex,draggingItem:e.draggingItem}))return!1;e.attributes.resizeAfterDragged?e.pendingDragResize={item:e.draggingItem,width:r,height:n,x:t.clientX,y:t.clientY}:e.dragResizeApply(e.draggingItem,r,n)},e.dragResizeApply=function(t,o,r){return e.scrollBox.scrollLeft>e.scrollBox.scrollWidth-e.attributes.resizeScrollZone&&"ew-resize"===e.dragMode&&e.resize(!0),"ew-resize"===e.dragMode?(e.sizes.columns["rowHeaderCell"===t.header.style?"cornerCell":t.sortColumnIndex]=o,-1!==["rowHeaderCell","cornerCell"].indexOf(t.header.style)&&e.resize(!0),void e.resizeChildGrids()):"ns-resize"===e.dragMode?(t.rowOpen?e.sizes.trees[t.rowIndex]=r:e.attributes.globalRowResize?e.style.cellHeight=r:e.sizes.rows[t.rowIndex]=r,e.dispatchEvent("resizerow",{row:r}),void e.resizeChildGrids()):void(e.ellipsisCache={})},e.stopDragResize=function(t){var o=e.getLayerPos(t);if(e.attributes.resizeAfterDragged&&(e.dragResizeApply(e.pendingDragResize.item,e.pendingDragResize.width,e.pendingDragResize.height),e.pendingDragResize=void 0),"ew-resize"===e.dragMode){var r=!!(o.x-e.dragStart.x),n=e.isColumnSelected(e.dragItem.columnIndex);if(r&&n){var l=Math.max(e.resizingStartingWidth+o.x-e.dragStart.x,e.style.minColumnWidth);e.fitSelectedColumns(l)}}else if("ns-resize"===e.dragMode){var i=!!(o.y-e.dragStart.y),a=e.isRowSelected(e.dragItem.rowIndex);if(i&&a){var s=Math.max(e.resizingStartingHeight+o.y-e.dragStart.y,e.style.minRowHeight);e.fitSelectedRows(s)}}e.resize(),window.removeEventListener("mousemove",e.dragResizeColumn,!1),window.removeEventListener("mouseup",e.stopDragResize,!1),e.setStorageData(),e.draw(!0),e.ignoreNextClick=!0},e.scrollGrid=function(t){var o=e.getLayerPos(t);return e.attributes.scrollPointerLock&&e.pointerLockPosition&&-1!==["horizontal-scroll-box","vertical-scroll-box"].indexOf(e.scrollStartMode)&&(e.pointerLockPosition.x+=t.movementX,e.pointerLockPosition.y+=t.movementY,e.pointerLockPosition.x=Math.min(e.width-e.style.scrollBarWidth,Math.max(0,e.pointerLockPosition.x)),e.pointerLockPosition.y=Math.min(e.height-e.style.scrollBarWidth,Math.max(0,e.pointerLockPosition.y)),o=e.pointerLockPosition),e.scrollMode=e.getCellAt(o.x,o.y).context,"horizontal-scroll-box"===e.scrollMode&&"horizontal-scroll-box"!==e.scrollStartMode?(e.scrollStartMode="horizontal-scroll-box",e.dragStart=o,e.scrollStart.left=e.scrollBox.scrollLeft,void clearTimeout(e.scrollTimer)):"vertical-scroll-box"===e.scrollMode&&"vertical-scroll-box"!==e.scrollStartMode?(e.scrollStartMode="vertical-scroll-box",e.dragStart=o,e.scrollStart.top=e.scrollBox.scrollTop,void clearTimeout(e.scrollTimer)):("vertical-scroll-box"===e.scrollStartMode&&"vertical-scroll-box"!==e.scrollMode&&(e.scrollMode="vertical-scroll-box"),"horizontal-scroll-box"===e.scrollStartMode&&"horizontal-scroll-box"!==e.scrollMode&&(e.scrollMode="horizontal-scroll-box"),clearTimeout(e.scrollTimer),void(-1!==e.scrollModes.indexOf(e.scrollMode)&&("vertical-scroll-box"===e.scrollMode?e.scrollBox.scrollTop=e.scrollStart.top+(o.y-e.dragStart.y)/e.scrollBox.heightBoxRatio:"vertical-scroll-top"===e.scrollMode?(e.scrollBox.scrollTop-=e.page*e.style.cellHeight,e.scrollTimer=setTimeout(e.scrollGrid,e.attributes.scrollRepeatRate,t)):"vertical-scroll-bottom"===e.scrollMode&&(e.scrollBox.scrollTop+=e.page*e.style.cellHeight,e.scrollTimer=setTimeout(e.scrollGrid,e.attributes.scrollRepeatRate,t)),"horizontal-scroll-box"===e.scrollMode?e.scrollBox.scrollLeft=e.scrollStart.left+(o.x-e.dragStart.x)/e.scrollBox.widthBoxRatio:"horizontal-scroll-right"===e.scrollMode?(e.scrollBox.scrollLeft+=e.attributes.selectionScrollIncrement,e.scrollTimer=setTimeout(e.scrollGrid,e.attributes.scrollRepeatRate,t)):"horizontal-scroll-left"===e.scrollMode&&(e.scrollBox.scrollLeft-=e.attributes.selectionScrollIncrement,e.scrollTimer=setTimeout(e.scrollGrid,e.attributes.scrollRepeatRate,t)))))},e.stopScrollGrid=function(){clearTimeout(e.scrollTimer),document.exitPointerLock&&document.exitPointerLock(),window.removeEventListener("mousemove",e.scrollGrid,!1)},e.dragReorder=function(t){var o,r,n,l="column-reorder"===e.dragMode,i="row-reorder"===e.dragMode;if(r=(o=e.getLayerPos(t)).x-e.dragStart.x,n=o.y-e.dragStart.y,(e.attributes.allowColumnReordering||!l)&&(e.attributes.allowRowReordering||!i)&&((t.ctrlKey||t.metaKey||t.shiftKey)&&e.reorderObject&&("column-reorder"!==e.dragMode||e.isMultiColumnsSelected||e.selectColumn(e.draggingItem.header.index,!1,!1)),!e.dispatchEvent("reordering",{NativeEvent:t,source:e.dragStartObject,target:e.currentCell,dragMode:e.dragMode})&&(Math.abs(r)>e.attributes.reorderDeadZone||Math.abs(n)>e.attributes.reorderDeadZone))){if(e.reorderObject=e.draggingItem,e.isMultiRowsSelected&&(e.reorderObject=e.getVisibleCellByIndex(-1,e.activeCell.rowIndex)),e.isMultiColumnsSelected&&(e.reorderObject=e.getVisibleCellByIndex(e.activeCell.columnIndex,-1)),!e.reorderObject)return;e.reorderTarget=e.currentCell,e.reorderObject.dragOffset={x:r,y:n},e.autoScrollZone(t,l?o.x:-1,i?o.y:-1,!1)}},e.stopDragReorder=function(t){var o,r,n=this,l={"row-reorder":e.orders.rows,"column-reorder":e.orders.columns},i={"row-reorder":"rowIndex","column-reorder":"sortColumnIndex"}[e.dragMode];if(window.removeEventListener("mousemove",e.dragReorder,!1),window.removeEventListener("mouseup",e.stopDragReorder,!1),e.reorderObject&&e.reorderTarget&&("column-reorder"===e.dragMode&&e.reorderTarget.sortColumnIndex>-1&&e.reorderTarget.sortColumnIndex<e.getSchema().length||"row-reorder"===e.dragMode&&e.reorderTarget.rowIndex>-1&&e.reorderTarget.rowIndex<e.viewData.length)&&e.reorderObject[i]!==e.reorderTarget[i]&&!e.dispatchEvent("reorder",{NativeEvent:t,source:e.reorderObject,target:e.reorderTarget,dragMode:e.dragMode})){if(e.ignoreNextClick=!0,o=l[e.dragMode].indexOf(e.reorderObject[i]),r=l[e.dragMode].indexOf(e.reorderTarget[i]),"column-reorder"===e.dragMode){var a=e.getRowSelectionStates(0),s=[],c=[];a&&(o=a[0],a.forEach((function(t){s.push(e.orders.columns[t])})));var d=s.length;if(r<o||r>o&&Math.abs(r-o)>=d){l[e.dragMode].splice(o,d),r>o&&(r-=d-1);for(var u=0;u<s.length;u++)0===u&&(e.activeCell.columnIndex=r),c.push(r+u),l[e.dragMode].splice(r+u,0,s[u]);e.orders.columns=l[e.dragMode],e.selectColumnViewIndexes(c)}}else{var h=e.getRowViewIndexesFromSelection().map(function(t){return _newArrowCheck(this,n),e.viewData[t]}.bind(this));if(r<o||r>o&&Math.abs(r-o)>=h.length){e.viewData.splice(o,h.length),r>o&&(r-=h.length-1),e.activeCell.rowIndex=r;for(var f=0;f<h.length;f++)e.viewData.splice(r+f,0,h[f]);e.moveSelection(0,r)}}e.resize(),e.setStorageData()}e.reorderObject=void 0,e.reorderTarget=void 0,e.draw(!0)},e.dragMove=function(t){if(!e.dispatchEvent("moving",{NativeEvent:t,cell:e.currentCell})){var o=e.getLayerPos(t);e.moveOffset={x:e.currentCell.columnIndex-e.dragStartObject.columnIndex,y:e.currentCell.rowIndex-e.dragStartObject.rowIndex},(Math.abs(o.x)>e.attributes.reorderDeadZone||Math.abs(o.y)>e.attributes.reorderDeadZone)&&setTimeout((function(){e.autoScrollZone(t,o.x,o.y,!1)}),1)}},e.stopDragMove=function(t){window.removeEventListener("mousemove",e.dragMove,!1),window.removeEventListener("mouseup",e.stopDragMove,!1);var o=e.getSelectionBounds();if(e.dispatchEvent("endmove",{NativeEvent:t,cell:e.currentCell}))return e.movingSelection=void 0,e.moveOffset=void 0,void e.draw(!0);e.moveOffset&&(e.moveTo(e.movingSelection,o.left+e.moveOffset.x,o.top+e.moveOffset.y),e.moveSelection(e.moveOffset.x,e.moveOffset.y)),e.movingSelection=void 0,e.moveOffset=void 0,e.draw(!0)},e.freezeMove=function(t){if(!e.dispatchEvent("freezemoving",{NativeEvent:t,cell:e.currentCell})){var o=e.getLayerPos(t);e.ignoreNextClick=!0,e.freezeMarkerPosition=o,o.x-=e.getRowGroupAreaWidth(),o.y-=e.getColumnGroupAreaHeight(),(Math.abs(o.x)>e.attributes.reorderDeadZone||Math.abs(o.y)>e.attributes.reorderDeadZone)&&setTimeout((function(){e.autoScrollZone(t,o.x,o.y,!1)}),1)}},e.stopFreezeMove=function(t){var o=e.getLayerPos(t),r="collapse"===e.style.gridBorderCollapse?1:2,n=e.style.columnHeaderCellBorderWidth*r,l=e.getColumnHeaderCellHeight(),i=e.getRowHeaderCellWidth();if(o.x-=e.getRowGroupAreaWidth(),o.y-=e.getColumnGroupAreaHeight(),e.currentCell&&void 0!==e.currentCell.rowIndex&&"frozen-row-marker"===e.dragMode){e.scrollBox.scrollTop=0,e.frozenRow=e.currentCell.rowIndex+1,e.scrollBox.bar.v.y=l+n+e.scrollCache.y[e.frozenRow],e.scrollBox.box.v.y=l+n+e.scrollCache.y[e.frozenRow];var a=e.scrollCache.y[e.scrollCache.y.length-1];e.scrollBox.heightBoxRatio=(e.scrollBox.height-l-e.scrollCache.y[e.frozenRow])/a,e.scrollBox.scrollBoxHeight=e.scrollBox.height*e.scrollBox.heightBoxRatio-e.style.scrollBarWidth,e.scrollBox.scrollBoxHeight=Math.max(e.scrollBox.scrollBoxHeight,e.style.scrollBarBoxMinSize),e.scrollBox.box.v.height=e.scrollBox.scrollBoxHeight}if(e.currentCell&&void 0!==e.currentCell.columnIndex&&"frozen-column-marker"===e.dragMode){var s=e.refreshScrollCacheX();e.scrollBox.scrollLeft=0;var c=e.currentCell.x-e.style.frozenMarkerWidth-e.style.frozenMarkerBorderWidth;o.x>c+e.currentCell.width/2?e.frozenColumn=e.currentCell.columnIndex+1:e.currentCell.columnIndex>=0&&(e.frozenColumn=e.currentCell.columnIndex),e.scrollBox.bar.h.x=i+e.scrollCache.x[e.frozenColumn],e.scrollBox.widthBoxRatio=(e.scrollBox.width-e.scrollCache.x[e.frozenColumn])/s,e.scrollBox.scrollBoxWidth=e.scrollBox.width*e.scrollBox.widthBoxRatio-e.style.scrollBarWidth,e.scrollBox.scrollBoxWidth=Math.max(e.scrollBox.scrollBoxWidth,e.style.scrollBarBoxMinSize),e.scrollBox.box.h.width=e.scrollBox.scrollBoxWidth}if((Math.abs(o.x)>e.attributes.reorderDeadZone||Math.abs(o.y)>e.attributes.reorderDeadZone)&&setTimeout((function(){e.autoScrollZone(t,o.x,o.y,!1)}),1),window.removeEventListener("mousemove",e.freezeMove,!1),window.removeEventListener("mouseup",e.stopFreezeMove,!1),e.freezeMarkerPosition=void 0,e.dispatchEvent("endfreezemove",{NativeEvent:t,cell:e.currentCell}))return e.frozenRow=e.startFreezeMove.x,e.frozenColumn=e.startFreezeMove.y,void e.draw(!0);e.draw(!0),e.resize()},e.mousedown=function(t,o){if(e.lastMouseDownTarget=t.target,!e.dispatchEvent("mousedown",{NativeEvent:t,cell:e.currentCell})&&e.hasFocus&&2!==t.button&&!e.input){var r=t.ctrlKey||t.metaKey,n=/-move/.test(e.dragMode),l=/frozen-row-marker|frozen-column-marker/.test(e.dragMode),i=/-resize/.test(e.dragMode),a=/selection-handle-br/.test(e.dragMode),s=e.hovers&&e.hovers.unhideIndicator;if(e.dragStart=o||e.getLayerPos(t),e.scrollStart={left:e.scrollBox.scrollLeft,top:e.scrollBox.scrollTop},e.dragStartObject=e.getCellAt(e.dragStart.x,e.dragStart.y),e.dragAddToSelection=!e.dragStartObject.selected,r||t.shiftKey||/(vertical|horizontal)-scroll-(bar|box)/.test(e.dragStartObject.context)||!e.currentCell||e.currentCell.isColumnHeader||n||l||i||a||"row-reorder"==e.dragMode&&e.isMultiRowsSelected||e.currentCell.hovered&&e.hovers.onFilterButton||e.clearSelections(),!e.dragStartObject.isGrid){if(-1!==e.scrollModes.indexOf(e.dragStartObject.context)&&!s)return e.scrollMode=e.dragStartObject.context,e.scrollStartMode=e.dragStartObject.context,e.scrollGrid(t),e.attributes.scrollPointerLock&&-1!==["horizontal-scroll-box","vertical-scroll-box"].indexOf(e.scrollStartMode)&&(e.pointerLockPosition={x:e.dragStart.x,y:e.dragStart.y},e.canvas.requestPointerLock()),window.addEventListener("mousemove",e.scrollGrid,!1),window.addEventListener("mouseup",e.stopScrollGrid,!1),void(e.ignoreNextClick=!0);if("cell"!==e.dragMode){if(a){if(e.movingSelectionHandle=!0,e.fillOverlay={handle:{x:e.dragStartObject.x+e.dragStartObject.width/2,y:e.dragStartObject.y+e.dragStartObject.height/2},snapTo:{x:-1,y:-1},selection:e.getSelectionBounds()},e.dispatchEvent("beginselectionhandlemove",{NativeEvent:t}))return;return window.addEventListener("mousemove",e.selectionHandleMove,!1),window.addEventListener("mouseup",e.stopSelectionHandleMove,!1),e.selectionHandleMove(t)}if(n){if(e.draggingItem=e.dragItem,e.movingSelection=e.cloneSelections(),e.dragging=e.dragStartObject,e.dispatchEvent("beginmove",{NativeEvent:t,cell:e.currentCell}))return;return window.addEventListener("mousemove",e.dragMove,!1),window.addEventListener("mouseup",e.stopDragMove,!1),e.mousemove(t)}if(l){if(e.draggingItem=e.dragItem,e.startFreezeMove={x:e.frozenRow,y:e.frozenColumn},e.dispatchEvent("beginfreezemove",{NativeEvent:t}))return;return e.freezeMarkerPosition=e.getLayerPos(t),e.freezeMarkerPosition.isGrab=!0,window.addEventListener("mousemove",e.freezeMove,!1),window.addEventListener("mouseup",e.stopFreezeMove,!1),e.mousemove(t)}return i&&!s?(e.draggingItem=e.dragItem,e.draggingItem.rowOpen?e.resizingStartingHeight=e.sizes.trees[e.draggingItem.rowIndex]:e.resizingStartingHeight=e.sizes.rows[e.draggingItem.rowIndex]||e.style.cellHeight,e.resizingStartingWidth=e.sizes.columns["rowHeaderCell"===e.draggingItem.header.style?"cornerCell":e.draggingItem.sortColumnIndex]||e.draggingItem.width,window.addEventListener("mousemove",e.dragResizeColumn,!1),void window.addEventListener("mouseup",e.stopDragResize,!1)):-1!==["row-reorder","column-reorder"].indexOf(e.dragMode)?(e.draggingItem=e.dragStartObject,"column-reorder"!==e.dragMode||e.isMultiColumnsSelected?"row-reorder"!==e.dragMode||e.isMultiRowsSelected||e.selectRow(e.dragStartObject.rowIndex,r,null):e.selectColumn(e.currentCell.header.index,r,t.shiftKey),window.addEventListener("mousemove",e.dragReorder,!1),void window.addEventListener("mouseup",e.stopDragReorder,!1)):void 0}if(e.selecting=!0,("row"===e.attributes.selectionMode||-1===e.dragStartObject.columnIndex)&&e.dragStartObject.rowIndex>-1)e.selectRow(e.dragStartObject.rowIndex,r,null);else if(("column"===e.attributes.selectionMode||-1===e.dragStartObject.rowIndex)&&e.dragStartObject.columnIndex>-1)return void e.selectColumn(e.currentCell.header.index,r,t.shiftKey);"row"!==e.attributes.selectionMode&&e.mousemove(t)}}},e.mouseup=function(t){clearTimeout(e.scrollTimer),e.cellBoundaryCrossed=!0,e.rowBoundaryCrossed=!0,e.columnBoundaryCrossed=!0,e.selecting=void 0,e.draggingItem=void 0,e.dragStartObject=void 0,e.dispatchEvent("mouseup",{NativeEvent:t,cell:e.currentCell})||(e.hasFocus||t.target===e.canvas)&&(e.currentCell&&void 0!==e.currentCell.grid||e.contextMenu||e.input||(e.dragStart&&e.isInGrid(e.dragStart)&&e.controlInput.focus(),t.preventDefault()))},e.getAdjacentCells=function(){var t,o=e.getSchema(),r={};for(t=0;t<o.length;t+=1)o[e.orders.columns[t]].hidden||(void 0===r.first&&(r.first=t,r.left=t),r.last=t,t>e.activeCell.columnIndex&&void 0===r.right&&(r.right=t),t<e.activeCell.columnIndex&&(r.left=t));return void 0===r.right&&(r.right=r.last),r},e.keydown=function(t){var o=e.getAdjacentCells(),r=Math.max(e.activeCell.columnIndex,0),n=Math.max(e.activeCell.rowIndex,0),l=t.ctrlKey||t.metaKey,i=e.viewData.length-1,a=e.getSchema().length-1;if(!e.dispatchEvent("keydown",{NativeEvent:t,cell:e.currentCell})&&(e.attributes.keepFocusOnMouseOut||e.hasFocus)){if(isPrintableKeyEvent(t)&&!l)return e.beginEditAt(r,n,t,!0);if(e.attributes.showNewRow&&(i+=1),"Tab"===t.key&&t.preventDefault(),"Escape"===t.key?e.selectNone():l&&"a"===t.key?e.selectAll():["Backspace","Delete"].includes(t.key)?e.deleteSelectedData():"ArrowDown"===t.key?n+=1:"ArrowUp"===t.key?n-=1:"ArrowLeft"===t.key&&!l||t.shiftKey&&"Tab"===t.key?r=o.left:"ArrowRight"===t.key&&!l||!t.shiftKey&&"Tab"===t.key?r=o.right:"PageUp"===t.key?(n-=e.page,t.preventDefault()):"PageDown"===t.key?(n+=e.page,t.preventDefault()):"Home"===t.key||l&&"ArrowUp"===t.key?n=0:"End"===t.key||l&&"ArrowDown"===t.key?n=e.viewData.length-1:l&&"ArrowRight"===t.key?r=o.last:l&&"ArrowLeft"===t.key&&(r=o.first),"Enter"===t.key)return t.preventDefault(),e.beginEditAt(r,n,t);(r<0||Number.isNaN(r))&&(r=o.first),n>i&&(n=i),(n<0||Number.isNaN(n))&&(n=0),r>a&&(r=o.last);var s=["ArrowLeft","ArrowUp","ArrowRight","ArrowDown"].includes(t.key);if(t.shiftKey&&s)e.shrinkOrExpandSelections({rowIndex:n,columnIndex:r},t,!0)&&e.draw(!0);r===e.activeCell.columnIndex&&n===e.activeCell.rowIndex||(e.scrollIntoView(r!==e.activeCell.columnIndex?r:void 0,n===e.activeCell.rowIndex||Number.isNaN(n)?void 0:n),e.setActiveCell(r,n),!t.shiftKey&&e.attributes.selectionFollowsActiveCell&&(l||e.clearSelections(),e.selectCell({rowIndex:n,viewColumnIndex:r})),e.draw(!0))}},e.keyup=function(t){e.dispatchEvent("keyup",{NativeEvent:t,cell:e.currentCell})||e.hasFocus},e.keypress=function(t){e.hasFocus&&e.dispatchEvent("keypress",{NativeEvent:t,cell:e.currentCell})},e.dblclick=function(t){e.dispatchEvent("dblclick",{NativeEvent:t,cell:e.currentCell})||e.hasFocus&&("ew-resize"===e.currentCell.context&&"columnHeaderCell"===e.currentCell.style?e.isColumnSelected(e.currentCell.columnIndex)?e.fitSelectedColumns():e.fitColumnToValues(e.currentCell.header.name):"ew-resize"===e.currentCell.context&&"cornerCell"===e.currentCell.style?e.autosize():!["cell","activeCell"].includes(e.currentCell.style)||e.hovers.onFilterButton||e.hovers.onCellTreeIcon||(e.currentCell.isRowTree||e.currentCell.isColumnTree?(e.cellTreeExpandCollapse(e.currentCell.rowIndex,e.currentCell.columnIndex),e.draw()):e.beginEditAt(e.currentCell.columnIndex,e.currentCell.rowIndex)))},e.scrollWheel=function(o){var r,n,l=o,i=void 0===o.deltaX?o.NativeEvent.deltaX:o.deltaX,a=void 0===o.deltaY?o.NativeEvent.deltaY:o.deltaY,s=void 0===o.deltaMode?o.NativeEvent.deltaMode:o.deltaMode;o.NativeEvent&&(o=o.NativeEvent),t?l.preventDefault(o):e.dispatchEvent("wheel",{NativeEvent:o})||(e.touchHaltAnimation=!0,r=e.scrollBox.scrollLeft,n=e.scrollBox.scrollTop,e.hasFocus&&(1===s&&(a*=17),(e.scrollBox.scrollTop<e.scrollBox.scrollHeight&&a>0||e.scrollBox.scrollLeft<e.scrollBox.scrollWidth&&i>0||e.scrollBox.scrollTop>0&&a<0||e.scrollBox.scrollLeft>0&&i<0)&&l.preventDefault(o),t=setTimeout((function(){t=void 0,e.scrollBox.scrollTo(i+r,a+n)}),1)))},e.pasteData=function(t,o,r,n){var l=this,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0,a=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0;if("text/html"===o&&!isSupportedHtml(t))return console.warn("Unrecognized HTML format. HTML must be a simple table, e.g.: <table><tr><td>data</td></tr></table>."),void console.warn("Data with the mime type text/html not in this format will not be imported as row data.");var s=parseData(t,o),c=s[0].length;if(1===s.length&&1===c&&i<=1&&a<=1){var d=s[0][0].value.map(function(e){return _newArrowCheck(this,l),e.value}.bind(this)).join();e.forEachSelectedCell((function(e,t,o){e[t][o]=d}))}else{var u=null;i>s.length&&a>c?u="both":i>s.length?u="vertical":a>c&&(u="horizontal"),e.insert({rows:s,startRowIndex:r,startColumnIndex:n,minRowsLength:i,minColumnsLength:a,reverseRows:!1,reverseColumns:!1,clearSelections:!0,alwaysFilling:!1,direction:u})}var h=[];return e.forEachSelectedCell(function(e,t,o,r){_newArrowCheck(this,l),h.push([t,r.viewColumnIndex,r.boundRowIndex,r.boundColumnIndex])}.bind(this)),e.dispatchEvent("afterpaste",{cells:h}),s.length},e.insert=function(t){var o=this,r=t.rows,n=void 0===r?[]:r,l=t.startRowIndex,i=void 0===l?0:l,a=t.startColumnIndex,s=void 0===a?0:a,c=t.minRowsLength,d=void 0===c?0:c,u=t.minColumnsLength,h=void 0===u?0:u,f=t.reverseRows,g=void 0!==f&&f,m=t.reverseColumns,p=void 0!==m&&m,w=t.clearSelections,v=void 0!==w&&w,y=t.alwaysFilling,x=void 0!==y&&y,C=t.direction,b=void 0===C?"both":C,S=e.getSchema(),R=Math.max(n.length,d),B=e.fillCellCallback,T=[];v&&(e.selections=[]);for(var I=0,M=0;I<R;I++,M++){M>=n.length&&(M=0);for(var k=I>=n.length,A=g?R-I-1:I,z=e.orders.rows[i+A],O=n[M],H=Math.max(O.length,h),E=e.viewData[z],P=Object.assign({},E),L=B?{rows:n,direction:b,rowData:P,existingRowData:E,rowIndex:z,rowOffset:M,cells:O,reversed:"horizontal"===b?p:g,isFillingRow:k||x,fillingRowPosition:x?I:k?I-n.length:-1,fillingRowLength:x?R:k?R-n.length:-1}:void 0,D=0,F=0;D<H;D++,F++){F>=O.length&&(F=0);var W=D>=O.length,N=s+(p?H-D-1:D),G=S[N];if(G){var j=G.name,_=O[F];_&&_.value&&(_=_.value.map(function(e){return _newArrowCheck(this,o),e.value}.bind(this)).join(""));var V=E[j];P[j]=B&&(W||k||x)?B(_objectSpread2(_objectSpread2({},L),{},{column:G,columnIndex:N,columnOffset:F,newCellData:_,existingCellData:V,isFillingColumn:W||x,fillingColumnPosition:x?D:W?D-O.length:-1,fillingColumnLength:x?H:W?H-O.length:-1})):null==_?V:_,e.selectCell({rowIndex:z,viewColumnIndex:N},!0),(x||k||W)&&T.push([z,N,e.getBoundRowIndexFromViewRowIndex(z),e.getBoundColumnIndexFromViewColumnIndex(N)])}else console.warn("Paste data exceeded grid bounds. Skipping.")}e.originalData[e.boundRowIndexMap.get(z)]=P,e.viewData[z]=P}(T.length>0||x)&&e.dispatchEvent("afterfill",{filledCells:T})},e.getNextVisibleColumnIndex=function(t){var o,r=e.getVisibleSchema();for(o=0;o<r.length;o+=1)if(r[o].columnIndex===t)return r[o+1].columnIndex;return-1},e.getVisibleColumnIndexOf=function(t){var o,r=e.getVisibleSchema();for(o=0;o<r.length;o+=1)if(r[o].columnIndex===t)return o;return-1},e.getSelectionIndex=function(){var t=e.getSelectionBounds(!0);if(t){for(var o=t.top,r=t.bottom,n=o;n<=r;n++){var l=e.getRowSelectionStates(n);if(l){if(void 0===l[0])break;return{row:n,column:l[0]<0?l[1]:l[0],rowLength:r-n+1,columnLength:l.length-(l[0]<0?1:0)}}}return null}},e.paste=function(t){var o=this;if(e.attributes.editable&&!e.dispatchEvent("beforepaste",{NativeEvent:t})){var r=new Map(Array.from(t.clipboardData.items).map(function(e){return _newArrowCheck(this,o),[e.type,e]}.bind(this))),n=["text/html","text/csv","text/plain"],l=n.map(function(e){return _newArrowCheck(this,o),r.get(e)}.bind(this)).filter(function(e){return _newArrowCheck(this,o),!!e}.bind(this));if(0!==l.length){var i=e.getSelectionIndex();if(i){var a=l[0],s=a.type;a.getAsString((function(t){e.pasteData(t,s,i.row,i.column,i.rowLength,i.columnLength),e.draw()}))}}else console.warn("Cannot find supported clipboard data type. Supported types are:",n.join(", "))}},e.cut=function(t){var o=this;if(!e.dispatchEvent("cut",{NativeEvent:t})&&e.hasFocus&&t.clipboardData){e.copySelectedCellsToClipboard(t.clipboardData);var r=e.clearSelectedCells().map(function(e){return _newArrowCheck(this,o),[e.viewRowIndex,e.viewColumnIndex,e.boundRowIndex,e.boundColumnIndex]}.bind(this));e.dispatchEvent("aftercut",{cells:r}),requestAnimationFrame(function(){return _newArrowCheck(this,o),e.draw()}.bind(this)),t.preventDefault()}},e.copy=function(t){e.dispatchEvent("copy",{NativeEvent:t})||e.hasFocus&&t.clipboardData&&(e.copySelectedCellsToClipboard(t.clipboardData),t.preventDefault())},e.selectionHandleMove=function(t){if(e.movingSelectionHandle){var o=e.getClippingRect(t),r=e.currentCell.rowIndex,n=e.currentCell.columnIndex,l=r>=-1&&n>=-1&&e.fillOverlay.selection.left<=n&&e.fillOverlay.selection.right>=n&&e.fillOverlay.selection.top<=r&&e.fillOverlay.selection.bottom>=r;if(e.fillOverlay.minX=o.x,e.fillOverlay.minY=o.y,e.fillOverlay.x=Math.max(o.x,t.clientX),e.fillOverlay.y=Math.max(o.y,t.clientY),l)e.fillOverlay.lastInBoundsLocation={x:t.clientX,y:t.clientY};else if(e.fillOverlay.lastInBoundsLocation||!e.fillOverlay.direction){var i=e.fillOverlay.lastInBoundsLocation;e.fillOverlay.lastInBoundsLocation=void 0;var a=i?i.x:e.fillOverlay.handle.x,s=i?i.y:e.fillOverlay.handle.y,c=Math.abs(t.clientX-a),d=Math.abs(t.clientY-s);(c>5||d>5)&&(e.fillOverlay.direction=c>d?"x":"y")}r>=0&&(e.fillOverlay.rowIndex=r),n>=0&&(e.fillOverlay.columnIndex=n,-1===r&&e.visibleRows.length&&(e.fillOverlay.rowIndex=e.visibleRows[0])),e.fillOverlay.snap=r>=-1&&n>=-1?e.currentCell:void 0}},e.stopSelectionHandleMove=function(t){if(!e.fillOverlay.handle)return!1;e.ignoreNextClick=!0,window.removeEventListener("mousemove",e.selectionHandleMove,!1),window.removeEventListener("mouseup",e.stopSelectionHandleMove,!1);var o=e.fillOverlay,r=e.getSelectionIndex(),n=o.selection;if(r){if(e.movingSelectionHandle=void 0,e.fillOverlay={},o.rowIndex>=0&&o.columnIndex>=0){var l,i,a,s,c=_objectSpread2({},n),d="y"===o.direction,u="x"===o.direction,h=!1,f=!1;if(d?(o.rowIndex<n.top?(n.top=o.rowIndex,h=!0):o.rowIndex>n.bottom&&(n.bottom=o.rowIndex),l=n.top<c.top?n.top:c.bottom+1,i=n.top<c.top?c.top-n.top:n.bottom-c.bottom,a=r.column,s=r.columnLength):u&&(o.columnIndex<n.left?(n.left=o.columnIndex,f=!0):o.columnIndex>n.right&&(n.right=o.columnIndex),a=n.left<c.left?n.left:c.right+1,s=n.left<c.left?c.left-n.left:n.right-c.right,l=r.row,i=r.rowLength),n.left<=n.right&&n.top<=n.bottom&&(n.left<c.left||n.top<c.top||n.right>c.right||n.bottom>c.bottom)){for(var g=e.getSchema(),m=[],p=0;p<Math.min(i,r.rowLength);p++){var w=e.viewData[r.row+p];m[p]=[];for(var v=0;v<Math.min(s,r.columnLength);v++){var y=g[r.column+v];if(y){var x=w[y.name];m[p][v]=x}}}e.insert({rows:m,startRowIndex:l,startColumnIndex:a,minRowsLength:i,minColumnsLength:s,reverseRows:h,reverseColumns:f,clearSelections:!1,alwaysFilling:!0,direction:u?"horizontal":"vertical"}),e.draw()}}return!0}}}function touch(e){var t,o;e.scrollAnimation={},e.touchDelta={},e.touchAnimateTo={},e.animationFrames=0,e.getTouchPos=function(t,o){var r,n=o?t.touches[o]:t.touches[0],l=e.canvas.getBoundingClientRect();if(n)return r={x:n.clientX-l.left,y:n.clientY-l.top},e.isChildGrid&&(r.x-=e.canvasOffsetLeft,r.y-=e.canvasOffsetTop),{x:r.x,y:r.y,rect:l}},e.easingFunctions={linear:function(e){return e},easeInQuad:function(e){return e*e},easeOutQuad:function(e){return e*(2-e)},easeInOutQuad:function(e){return e<.5?2*e*e:(4-2*e)*e-1},easeInCubic:function(e){return e*e*e},easeOutCubic:function(e){return--e*e*e+1},easeInOutCubic:function(e){return e<.5?4*e*e*e:(e-1)*(2*e-2)*(2*e-2)+1},easeInQuart:function(e){return e*e*e*e},easeOutQuart:function(e){return 1- --e*e*e*e},easeInOutQuart:function(e){return e<.5?8*e*e*e*e:1-8*--e*e*e*e},easeInQuint:function(e){return e*e*e*e*e},easeOutQuint:function(e){return 1+--e*e*e*e*e},easeInOutQuint:function(e){return e<.5?16*e*e*e*e*e:1+16*--e*e*e*e*e}},e.easing=function(t,o,r,n){return r*e.easingFunctions[e.attributes.touchEasingMethod](t/n)+o},e.calculatePPSTimed=function(){e.xPPST=-(e.touchDelta.x-e.touchSigmaTimed.x)/(e.touchDelta.t-e.touchSigmaTimed.t),e.yPPST=-(e.touchDelta.y-e.touchSigmaTimed.y)/(e.touchDelta.t-e.touchSigmaTimed.t),e.touchSigmaTimed={x:e.touchDelta.x,y:e.touchDelta.y,t:performance.now()}},e.calculatePPS=function(){e.xPPS=-(e.touchDelta.x-e.touchSigma.x)/(e.touchDelta.t-e.touchSigma.t),e.yPPS=-(e.touchDelta.y-e.touchSigma.y)/(e.touchDelta.t-e.touchSigma.t),e.touchSigma={x:e.touchDelta.x,y:e.touchDelta.y,t:performance.now()}},e.touchEndAnimation=function(){if(!e.canvas||!e.scrollBox.scrollTo)return requestAnimationFrame(e.touchEndAnimation);var t,o=performance.now(),r=e.attributes.touchReleaseAnimationDurationMs;t=o-e.touchDelta.t,e.animationFrames+=1,e.scrollAnimation.x=e.easing(t,e.touchDelta.scrollLeft,e.touchAnimateTo.x,r),e.scrollAnimation.y=e.easing(t,e.touchDelta.scrollTop,e.touchAnimateTo.y,r),t>r||e.scrollAnimation.y===e.scrollBox.scrollTop&&e.scrollAnimation.x===e.scrollBox.scrollLeft||e.stopAnimation||(e.scrollBox.scrollTo(e.scrollAnimation.x,e.scrollAnimation.y),requestAnimationFrame(e.touchEndAnimation))},e.touchEditCell=function(t){e.beginEditAt(t.columnIndex,t.rowIndex)},e.touchstart=function(t){if(t.changedTouches[0]&&(e.touchStart=e.getTouchPos(t),e.startingCell=e.getCellAt(e.touchStart.x,e.touchStart.y,!0)),!e.dispatchEvent("touchstart",{NativeEvent:t,cell:e.startingCell})){if(e.disposeContextMenu(),clearInterval(e.calculatePPSTimer),clearTimeout(e.touchContextTimeout),e.touchStartEvent=t,e.stopAnimation=!0,e.animationFrames=0,e.stopPropagation(t),1===t.touches.length&&t.changedTouches[0]&&!e.zoomAltered){if(e.touchLength=1,e.touchStart=e.touchStart||e.touchStart1,e.touchScrollStart={x:e.scrollBox.scrollLeft,y:e.scrollBox.scrollTop,t:performance.now()},e.touchDelta={x:0,y:0,scrollLeft:e.scrollBox.scrollLeft,scrollTop:e.scrollBox.scrollTop,t:e.touchScrollStart.t},e.touchSigma={x:e.touchDelta.x,y:e.touchDelta.y,t:e.touchDelta.t},e.touchSigmaTimed={x:e.touchDelta.x,y:e.touchDelta.y,t:e.touchDelta.t},e.touchContextTimeout=setTimeout((function(){e.contextmenuEvent(t,e.touchStart)}),e.attributes.touchContextMenuTimeMs),e.calculatePPSTimer=setInterval(e.calculatePPSTimed,50),e.startingCell&&(e.startingCell.isGrid||-1!==["tree","inherit"].indexOf(e.startingCell.context)))return void(e.hasFocus=!1);if(e.hasFocus=!0,e.startingCell.isHeader)return e.startingCell.isRowHeader?(e.selectArea({top:e.startingCell.rowIndex,bottom:e.startingCell.rowIndex,left:0,right:e.getVisibleSchema().length-1}),e.draw(!0)):e.startingCell.isColumnHeader&&("sort"===e.attributes.columnHeaderClickBehavior&&(e.orderBy===e.startingCell.header.name?e.orderDirection="asc"===e.orderDirection?"desc":"asc":e.orderDirection="asc",e.order(e.startingCell.header.name,e.orderDirection)),"select"===e.attributes.columnHeaderClickBehavior&&(e.selectArea({top:0,bottom:e.viewData.length-1,left:e.startingCell.columnIndex,right:e.startingCell.columnIndex}),e.draw(!0))),void e.touchEndEvents(t)}e.zoomAltered||(document.body.addEventListener("touchmove",e.touchmove,{passive:!1}),document.body.addEventListener("touchend",e.touchend,!1),document.body.addEventListener("touchcancel",e.touchcancel,!1),e.draw(!0))}},e.touchSelect=function(t,o){if(void 0!==t.rowIndex&&void 0!==t.columnIndex){e.touchSelecting=!0;var r=e.getSelectionBounds();"selection-handle-bl"===o&&t.rowIndex>=r.top&&t.columnIndex<=r.right?(r.bottom=t.rowIndex,r.left=t.columnIndex):"selection-handle-tl"===o&&t.rowIndex<=r.bottom&&t.columnIndex<=r.right?(r.top=t.rowIndex,r.left=t.columnIndex):"selection-handle-tr"===o&&t.rowIndex<=r.bottom&&t.columnIndex>=r.left?(r.top=t.rowIndex,r.right=t.columnIndex):"selection-handle-br"===o&&t.rowIndex>=r.top&&t.columnIndex>=r.left&&(r.bottom=t.rowIndex,r.right=t.columnIndex),"row"===e.attributes.selectionMode||-1===t.rowIndex?(r.left=0,r.right=e.getSchema().length-1):r.left=Math.max(0,r.left),e.selectArea(r),e.draw(!0)}},e.touchmove=function(r){t||requestAnimationFrame((function(){t=!0,function(t){var r,n,l,i,a,s,c,d,u;if(!e.dispatchEvent("beforetouchmove",{NativeEvent:t})){if(clearTimeout(o),t.changedTouches[0]&&(e.touchPosition=e.getTouchPos(t)),t.changedTouches[1]&&(e.touchPosition1=e.getTouchPos(t,1)),Math.abs(e.touchDelta.x)+Math.abs(e.touchDelta.y)>e.attributes.touchDeadZone&&clearTimeout(e.touchContextTimeout),2===t.touches.length&&e.touchPosition&&e.touchPosition1)return d=e.touchPosition.y,u=e.touchPosition1.y,e.zoomDeltaStart||(e.zoomDeltaStart=Math.abs(d-u),e.startScale=e.scale),e.touchLength=2,e.scaleDelta=e.zoomDeltaStart-Math.abs(d-u),e.scale=e.startScale-e.scaleDelta*e.attributes.touchZoomSensitivity,e.scale=Math.min(Math.max(e.scale,e.attributes.touchZoomMin),e.attributes.touchZoomMax),e.zoomAltered=!0,e.resize(!0),void e.resizeChildGrids();e.zoomAltered||(e.touchLength=1,e.touchPosition=e.touchPosition||e.touchPosition1,r=e.getColumnHeaderCellHeight(),n=e.getRowHeaderCellWidth(),l=e.width-e.style.scrollBarWidth-e.touchPosition.x<e.attributes.selectionScrollZone,i=e.touchPosition.x-n<e.attributes.selectionScrollZone,a=e.height-e.style.scrollBarWidth-e.touchPosition.y<e.attributes.selectionScrollZone,s=e.touchPosition.y-r<e.attributes.selectionScrollZone,c=e.style.scrollBarWidth,t.stopPropagation(),e.touchDelta={x:e.touchPosition.x-e.touchStart.x,y:e.touchPosition.y-e.touchStart.y,scrollLeft:e.scrollBox.scrollLeft,scrollTop:e.scrollBox.scrollTop,t:performance.now()},e.currentCell=e.getCellAt(e.touchPosition.x,e.touchPosition.y),e.dispatchEvent("touchmove",{NativeEvent:t,cell:e.currentCell}),e.calculatePPS(),e.touchDuration=performance.now()-e.touchScrollStart.t,e.stopAnimation=!0,e.animationFrames=0,e.touchSelecting&&(l||i||s||a)&&function t(){var r=e.scrollBox.scrollLeft,n=e.scrollBox.scrollTop;r+=l?e.attributes.selectionScrollIncrement:0,n+=a?e.attributes.selectionScrollIncrement:0,n-=s?e.attributes.selectionScrollIncrement:0,r-=i?e.attributes.selectionScrollIncrement:0,e.scrollBox.scrollTo(r,n),o=setTimeout(t,e.attributes.scrollRepeatRate)}(),/vertical-scroll-/.test(e.startingCell.style)?e.scrollBox.scrollTop=e.scrollBox.scrollHeight*((e.touchPosition.y-r-c)/(e.scrollBox.height-c-r)):/horizontal-scroll-/.test(e.startingCell.style)?e.scrollBox.scrollLeft=e.scrollBox.scrollWidth*((e.touchPosition.x-n-c)/(e.scrollBox.width-c-n)):/selection-handle-/.test(e.startingCell.style)?e.touchSelect(e.currentCell,e.startingCell.style):e.scrollBox.scrollTo(e.touchScrollStart.x-e.touchDelta.x,e.touchScrollStart.y-e.touchDelta.y))}}(r),t=!1}))},e.touchEndEvents=function(t){e.zoomDeltaStart=void 0,e.touchSelecting=!1,clearInterval(e.touchScrollTimeout),clearInterval(e.touchContextTimeout),clearInterval(e.calculatePPSTimer),t.stopPropagation(),document.body.removeEventListener("touchmove",e.touchmove,{passive:!1}),document.body.removeEventListener("touchend",e.touchend,!1),document.body.removeEventListener("touchcancel",e.touchcancel,!1)},e.touchend=function(t){if(!e.dispatchEvent("touchend",{NativeEvent:t,cell:e.currentCell}))if(e.zoomDeltaStart=void 0,t.changedTouches[0]&&(e.touchPosition=void 0),t.changedTouches[1]&&(e.touchPosition1=void 0),e.zoomAltered)0===t.touches.length&&(e.zoomAltered=!1);else{var o=Math.abs(e.touchDelta.x)+Math.abs(e.touchDelta.y)<e.attributes.touchDeadZone;isNaN(e.xPPS)&&(e.xPPS=0),isNaN(e.yPPS)&&(e.yPPS=0),isNaN(e.xPPST)&&(e.xPPST=0),isNaN(e.yPPST)&&(e.yPPST=0),e.touchAnimateTo.x=e.xPPS*e.attributes.touchReleaseAcceleration,e.touchAnimateTo.y=e.yPPS*e.attributes.touchReleaseAcceleration,e.calculatePPSTimed(),o||0!==e.animationFrames||!(Math.abs(e.xPPST)>e.attributes.scrollAnimationPPSThreshold||Math.abs(e.yPPST)>e.attributes.scrollAnimationPPSThreshold)||/-scroll-/.test(e.startingCell.style)||o||(e.stopAnimation=!1,e.touchEndAnimation()),e.touchEndEvents(t)}},e.touchcancel=function(t){e.dispatchEvent("touchcancel",{NativeEvent:t,cell:e.currentCell})||e.touchEndEvents(t)}}function intf(e,t){function o(e,t){var o,r=[];for(o=e;o<=t;o+=1)r[o]=o;return r}var r;e.scale=1,e.orders={rows:[],columns:[]},e.appliedInlineStyles={},e.cellGridAttributes={},e.treeGridAttributes={},e.visibleRowHeights=[],e.hasFocus=!1,e.activeCell={columnIndex:0,rowIndex:0},e.innerHTML="",e.storageName="canvasDataGrid",e.invalidSearchExpClass="canvas-datagrid-invalid-search-regExp",e.localStyleLibraryStorageKey="canvas-datagrid-user-style-library",e.dataType="application/x-canvas-datagrid",e.orderBy=null,e.orderDirection="asc",e.orderings={columns:[],add:function(t,o,r){e.orderings.columns=e.orderings.columns.filter((function(e){return e.orderBy!==t})),e.orderings.columns.push({orderBy:t,orderDirection:o,sortFunction:r})},sort:function(){console.warn("grid.orderings.sort has been deprecated. Please use grid.refresh()."),e.orderings.columns.forEach((function(t){e.viewData.sort(t.sortFunction(t.orderBy,t.orderDirection))}))}},e.columnFilters={},e.filters={},e.frozenRow=0,e.frozenColumn=0,e.ellipsisCache={},e.scrollCache={x:[],y:[]},e.scrollBox={},e.visibleRows=[],e.visibleCells=[],e.visibleUnhideIndicators=[],e.hiddenRowRanges=[],e.visibleGroups=[],e.sizes={rows:{},columns:{},trees:{}},e.fillOverlay={},e.filterable={rows:[],columns:[]},e.selectedFilterButton={columnIndex:-1,rowIndex:-1},e.cellTree={rows:[],columns:{},tempSchema:{},rowTreeColIndex:0,columnTreeRowStartIndex:0,columnTreeRowEndIndex:0,origin:{rows:[],columns:{}}},e.hovers={},e.attributes={},e.style={},e.formatters={},e.sorters={},e.parsers={},e.schemaHashes={},e.events={},e.changes=[],e.scrollIndexTop=0,e.scrollPixelTop=0,e.scrollIndexLeft=0,e.scrollPixelLeft=0,e.childGrids={},e.openChildren={},e.groupedColumns=[],e.groupedRows=[],e.scrollModes=["vertical-scroll-box","vertical-scroll-top","vertical-scroll-bottom","horizontal-scroll-box","horizontal-scroll-right","horizontal-scroll-left"],e.componentL1Events={},e.eventNames=["afterdraw","afterrendercell","afterrenderfilterbutton","aftercreategroup","attributechanged","beforebeginedit","beforecreatecellgrid","beforedraw","beforeendedit","beforerendercell","beforerendercellgrid","beforerenderfilterbutton","beginedit","cellmouseout","cellmouseover","click","collapsetree","columnhide","columnunhide","contextmenu","copy","datachanged","dblclick","endedit","expandtree","formatcellvalue","keydown","keypress","keyup","mousedown","mousemove","mouseup","newrow","ordercolumn","rendercell","rendercellgrid","renderorderbyarrow","rendertext","rendertreearrow","reorder","reordering","resize","resizecolumn","resizerow","schemachanged","scroll","selectionchanged","stylechanged","touchcancel","touchend","touchmove","touchstart","wheel"],e.mouse={x:0,y:0},e.getBoundRowIndexFromViewRowIndex=function(t){if(e.boundRowIndexMap&&e.boundRowIndexMap.has(t))return e.boundRowIndexMap.get(t)},e.getBoundColumnIndexFromViewColumnIndex=function(t){return e.orders.columns[t]},e.getColumnGroupAreaHeight=function(){if(!e.attributes.allowGroupingColumns)return 0;var t=e.groupedColumns.length;return e.style.columnGroupRowHeight*e.scale*t},e.getRowGroupAreaWidth=function(){if(!e.attributes.allowGroupingRows)return 0;var t=e.groupedRows.length;return e.style.rowGroupColumnWidth*e.scale*t},e.getCollapsedColumnGroups=function(){for(var t=[],o=0;o<e.groupedColumns.length;o++)for(var r=e.groupedColumns[o],n=0;n<r.length;n++){var l=r[n];l.collapsed&&t.push(l)}return t},e.getCollapsedRowGroups=function(){for(var t=[],o=0;o<e.groupedRows.length;o++)for(var r=e.groupedRows[o],n=0;n<r.length;n++){var l=r[n];l.collapsed&&t.push(l)}return t},e.toggleGroup=function(t){if("c"===t.type){for(var o,r=t.from,n=t.to,l=e.groupedColumns,i=0;i<l.length;i++){for(var a=l[i],s=0;s<a.length;s++){var c=a[s];if(c.from===r&&c.to===n){o=c;break}}if(o)break}if(!o)return;var d=!o.collapsed;return o.collapsed=d,!0}if("r"===t.type){for(var u,h=t.from,f=t.to,g=e.groupedRows,m=0;m<g.length;m++){for(var p=g[m],w=0;w<p.length;w++){var v=p[w];if(v.from===h&&v.to===f){u=v;break}}if(u)break}if(!u)return;var y=!u.collapsed;return u.collapsed=y,!0}return!1},e.isNewGroupRangeValid=function(e,t,o){for(var r=0;r<e.length;r++)for(var n=e[r],l=0;l<n.length;l++){var i=n[l];if(t===i.to+1)return!1;if(!(t>i.to)){if(t===i.from){if(o===i.to)return!1;if(o>i.to)return!0;break}if(t>i.from){if(o>i.to)return!1;break}return!(o<i.to)}}return!0},e.getColumnHeaderCellHeight=function(){return e.attributes.showColumnHeaders?(e.sizes.rows[-1]||e.style.columnHeaderCellHeight)*e.scale:0},e.getRowHeaderCellWidth=function(){return e.attributes.showRowHeaders?(e.sizes.columns[-1]||e.style.rowHeaderCellWidth)*e.scale:0},e.setStorageData=function(){if(e.attributes.saveAppearance&&e.attributes.name){var t={};e.getSchema().forEach((function(e){t[e.name]=!e.hidden})),localStorage.setItem(e.storageName+"-"+e.attributes.name,JSON.stringify({sizes:{rows:e.sizes.rows,columns:e.sizes.columns},orders:{rows:e.orders.rows,columns:e.orders.columns},orderBy:e.orderBy,orderDirection:e.orderDirection,visibility:t}))}},e.getSchema=function(){return e.schema||e.tempSchema||[]},e.createColumnOrders=function(){var t=e.getSchema();e.orders.columns=o(0,t.length-1)},e.createRowOrders=function(){e.orders.rows=o(0,e.originalData.length-1)},e.getVisibleSchema=function(){return e.getSchema().filter((function(e){return!e.hidden}))},e.applyDefaultValue=function(t,o,r){var n=o.defaultValue||"";"function"==typeof n&&(n=n.apply(e.intf,[o,r])),t[o.name]=n},e.createNewRowData=function(){e.newRow={};e.getSchema().forEach((function(t){e.applyDefaultValue(e.newRow,t,undefined)}))},e.getSchemaNameHash=function(t){for(var o=0;e.schemaHashes[t];)t+=o+=1;return t},e.filter=function(t){var o=e.filters[t];return o||void 0===t||(console.warn("Cannot find filter for type %s, falling back to substring match.",t),o=e.filters.string),o},e.hasActiveFilters=function(){return e.columnFilters&&Object.keys(e.columnFilters).length>0},e.hasCollapsedRowGroup=function(){for(var t=0;t<e.groupedRows.length;t++)for(var o=e.groupedRows[t],r=0;r<o.length;r++){if(o[r].collapsed)return!0}return!1},e.getFilteredAndSortedViewData=function(t){var o=this,r=t.map(function(e,t){return _newArrowCheck(this,o),[e,t]}.bind(this));if(e.hiddenRowRanges.length>0)for(var n=e.hiddenRowRanges.sort(function(e,t){return _newArrowCheck(this,o),t[1]-e[1]}.bind(this)),l=0;l<n.length;l++){var i=_slicedToArray(n[l],2),a=i[0],s=i[1]-a+1;r.splice(a,s)}for(var c=function(){var t=_slicedToArray(u[d],2),o=t[0],n=t[1],l=e.getHeaderByName(o);if(!l)return"continue";var i=l.filter||e.filter(l.type||"string");r=r.filter((function(t){var r=_slicedToArray(t,2),l=r[0],a=r[1];return!!(e.attributes.allowFreezingRows&&!e.attributes.filterFrozenRows&&a<e.frozenRow)||i(l[o],n)}))},d=0,u=Object.entries(e.columnFilters);d<u.length;d++)c();for(var h=[],f=0;f<e.groupedRows.length;f++)for(var g=e.groupedRows[f],m=0;m<g.length;m++){var p=g[m];p.collapsed&&h.push([p.from,p.to])}if(h.length>0){h.sort(function(e,t){return _newArrowCheck(this,o),e[0]-t[0]}.bind(this));for(var w=0,v=h.length,y=0;y<v;y++){var x=h[y];if(y===v-1){h[w++]=x;break}var C=x[1],b=_slicedToArray(h[y+1],2),S=b[0],R=b[1];S>C+1?h[w++]=x:(h[y+1]=x,R>C&&(h[y+1][1]=R))}for(var B=(h=h.slice(0,w)).shift(),T=0;T<r.length;T++){if(!(r[T][1]<B[0])){for(var I=T+1;I<r.length;I++){if(r[I][1]>B[1])break}if(r.splice(T,I-T),!(B=h.shift()))break;T--}}}var M,k=_createForOfIteratorHelper(e.orderings.columns);try{var A=function(){var t=this,o=M.value,n=o.sortFunction(o.orderBy,o.orderDirection);r.sort(function(o,r){_newArrowCheck(this,t);var l=_slicedToArray(o,1)[0],i=_slicedToArray(r,2),a=i[0],s=i[1];return e.attributes.allowFreezingRows&&!e.attributes.sortFrozenRows&&s<e.frozenRow?0:n(l,a)}.bind(this))};for(k.s();!(M=k.n()).done;)A()}catch(e){k.e(e)}finally{k.f()}return{viewData:r.map(function(e){return _newArrowCheck(this,o),_slicedToArray(e,1)[0]}.bind(this)),boundRowIndexMap:new Map(r.map(function(e,t){_newArrowCheck(this,o);var r=_slicedToArray(e,2);r[0];return[t,r[1]]}.bind(this)))}},e.refresh=function(){var t=e.getFilteredAndSortedViewData(e.originalData),o=t.viewData,r=t.boundRowIndexMap;e.viewData=o,e.boundRowIndexMap=r,e.resize(),e.draw(!0)},e.getBestGuessDataType=function(e,t){var o,r,n=t.length;for(r=0;r<n;r+=1)if(void 0!==t[r]&&null!==t[r]&&-1!==[null,void 0].indexOf(t[r][e]))return"object"===(o=_typeof(t[r]))?"string":o;return"string"},e.drawChildGrids=function(){Object.keys(e.childGrids).forEach((function(t){e.childGrids[t].draw()}))},e.resizeChildGrids=function(){Object.keys(e.childGrids).forEach((function(t){e.childGrids[t].resize()}))},e.autoScrollZone=function(t,o,r,n){var l,i=e.getRowHeaderCellWidth(),a=e.getColumnHeaderCellHeight();-1!==o&&(o>e.width-e.attributes.selectionScrollZone&&(e.scrollBox.scrollLeft+=e.attributes.selectionScrollIncrement,l=!0),o-e.attributes.selectionScrollZone-i<0&&(e.scrollBox.scrollLeft-=e.attributes.selectionScrollIncrement,l=!0)),-1!==r&&(r>e.height-e.attributes.selectionScrollZone&&(e.scrollBox.scrollTop+=e.attributes.selectionScrollIncrement,l=!0),r-e.attributes.selectionScrollZone-a<0&&(e.scrollBox.scrollTop-=e.attributes.selectionScrollIncrement,l=!0)),l&&!n&&e.currentCell&&-1!==e.currentCell.columnIndex&&(e.scrollTimer=setTimeout(e.mousemove,e.attributes.scrollRepeatRate,t))},e.validateColumn=function(e,t){if(!e.name)throw new Error("A column must contain at least a name.");if(t.filter((function(t){return t.name===e.name})).length>0)throw new Error("A column with the name "+e.name+" already exists and cannot be added again.");return!0},e.setDefaults=function(e,t,o,r){e[o]=void 0===t[o]?r:t[o]},e.setAttributes=function(){e.defaults.attributes.forEach((function(t){e.setDefaults(e.attributes,e.args,t[0],t[1])}))},e.setStyle=function(){e.defaults.styles.forEach((function(t){e.setDefaults(e.style,e.args.style||{},t[0],t[1])}))},e.autosize=function(t){e.getVisibleSchema().forEach((function(o,r){o.name!==t&&void 0!==t||(e.sizes.columns[r]=Math.max(e.findColumnMaxTextLength(o.name),e.style.minColumnWidth))})),e.sizes.columns[-1]=e.findColumnMaxTextLength("cornerCell")},e.dispose=function(){!e.isChildGrid&&e.canvas&&e.canvas.parentNode&&e.canvas.parentNode.removeChild(e.canvas),e.isChildGrid||document.body.removeChild(e.controlInput),e.eventParent.removeEventListener("mousedown",e.mousedown,!1),e.eventParent.removeEventListener("dblclick",e.dblclick,!1),e.eventParent.removeEventListener("click",e.click,!1),e.eventParent.removeEventListener("mousemove",e.mousemove),e.eventParent.removeEventListener("wheel",e.scrollWheel,!1),e.canvas.removeEventListener("contextmenu",e.contextmenuEvent,!1),e.canvas.removeEventListener("copy",e.copy),e.controlInput.removeEventListener("copy",e.copy),e.controlInput.removeEventListener("cut",e.cut),e.controlInput.removeEventListener("paste",e.paste),e.controlInput.removeEventListener("keypress",e.keypress,!1),e.controlInput.removeEventListener("keyup",e.keyup,!1),e.controlInput.removeEventListener("keydown",e.keydown,!1),window.removeEventListener("mouseup",e.mouseup,!1),window.removeEventListener("mousemove",e.mousemove),window.removeEventListener("resize",e.resize),e.observer&&e.observer.disconnect&&e.observer.disconnect()},e.tryLoadStoredSettings=function(){var t;e.reloadStoredValues(),e.storedSettings&&"object"===_typeof(e.storedSettings.orders)&&null!==e.storedSettings.orders&&(e.storedSettings.orders.rows.length>=(e.viewData||[]).length&&(e.orders.rows=e.storedSettings.orders.rows),t=e.getSchema(),e.storedSettings.orders.columns.length===t.length&&(e.orders.columns=e.storedSettings.orders.columns),e.orderBy=void 0===e.storedSettings.orderBy?t[0].name:e.storedSettings.orderBy,e.orderDirection=void 0===e.storedSettings.orderDirection?"asc":e.storedSettings.orderDirection,void 0!==e.storedSettings.orderBy&&e.getHeaderByName(e.orderBy)&&e.orderDirection&&e.order(e.orderBy,e.orderDirection))},e.toggleCollapseTree=function(t,o,r){var n=this,l=[],i=0;if(o==e.cellTree.rowTreeColIndex&&(t>0||0==t&&e.cellTree.rows[0].icon)){var a=e.cellTree.rows;switch(r){case"Expand":a[t].expand=!0,e.cellTree.origin.rows[a[t].index].expand=!0;break;case"Collapse":a[t].expand=!1,e.cellTree.origin.rows[a[t].index].expand=!1;break;default:a[t].expand=!a[t].expand,e.cellTree.origin.rows[a[t].index].expand=a[t].expand}for(var s=a[t].index+1;s<=a[t].lastchild;s++){var c=e.cellTree.origin.rows[s];a[t].expand?(c.hide=!1,c.icon&&!c.expand&&(s=c.lastchild)):c.hide=!0}}else if(e.cellTree.columns[t]){var d=e.cellTree.columns[t];switch(r){case"Expand":d[o].expand=!0;break;case"Collapse":d[o].expand=!1;break;default:d[o].expand=!d[o].expand}for(var u=d[o].index+1;u<=d[o].lastchild;u++)d[o].expand?e.cellTree.tempSchema[u].hidden=!1:e.cellTree.tempSchema[u].hidden=!0;var h,f=0;if(d[o].expand)for(;f<d[o].child;){h=t+f+1;for(var g=d[o].index;g<=d[o].lastchild;g++)if(e.cellTree.origin.columns[h]&&e.cellTree.origin.columns[h][g].icon&&!e.cellTree.origin.columns[h][g].expand)for(var m=g+1;m<=e.cellTree.origin.columns[h][g].lastchild;m++)e.cellTree.tempSchema[m].hidden=!0;f++}}var p,w={},v=[];for(var y in e.cellTree.rows=[],e.cellTree.columns={},e.cellTree.origin.rows){var x=[],C=e.cellTree.origin.rows[y];if(C.hide){for(var b=0;b<e.cellTree.rowTreeColIndex;b++)x.push(e.viewData[y][b]);w[y]=x,v.push(Array(e.viewData[0].length).fill("")),i++}else{var S=[],R=0;if(y<e.cellTree.columnTreeRowStartIndex)l.push(e.originalData[y]);else if(y>e.cellTree.columnTreeRowEndIndex)w[y]=e.viewData[y],i++;else{for(var B=0;B<e.originalData[y].length;B++)e.cellTree.tempSchema[B].hidden?R++:(B<e.cellTree.rowTreeColIndex&&(Object.prototype.hasOwnProperty.call(w,y)||(w[y]=[]),w[y].push(e.viewData[y][B])),x.push(e.originalData[y][B]),Object.prototype.hasOwnProperty.call(e.cellTree.origin.columns,y)&&S.push(e.cellTree.origin.columns[y][B]));x.push.apply(x,_toConsumableArray(Array(R).fill(""))),S.length&&(S.push.apply(S,_toConsumableArray(Array(R).fill().map(function(){return _newArrowCheck(this,n),{}}.bind(this)))),e.cellTree.columns[y]=S),l.push(x)}e.cellTree.rows.push(C)}}i&&((p=e.cellTree.rows).push.apply(p,_toConsumableArray(Array(i).fill().map(function(t,o){return _newArrowCheck(this,n),{index:e.cellTree.rows.length+o}}.bind(this)))),l.push.apply(l,v));for(var T in w)if(T>e.cellTree.columnTreeRowEndIndex)l[T]=w[T];else for(var I in w[T])l[T][I]=w[T][I];e.viewData=l},e.cellTreeExpandCollapse=function(t,o,r){if(o==e.cellTree.rowTreeColIndex&&(t>0||0==t&&e.cellTree.rows[0].icon)){var n=e.cellTree.rows;switch(r){case"Expand":n[t].expand=!0;break;case"Collapse":n[t].expand=!1;break;default:n[t].expand=!n[t].expand}for(var l=t+1;l<=n[t].lastchild;l++)n[t].expand?(n[l].hide=!1,n[l].icon&&!n[l].expand&&(l=n[l].lastchild)):n[l].hide=!0}else if(e.cellTree.columns[t]){var i=e.cellTree.columns[t];switch(r){case"Expand":i[o].expand=!0;break;case"Collapse":i[o].expand=!1;break;default:i[o].expand=!i[o].expand}for(var a=o+1;a<=i[o].lastchild;a++)i[o].expand?e.tempSchema[a].hidden=!1:e.tempSchema[a].hidden=!0;var s,c=0;if(i[o].expand)for(;c<i[o].child;){s=t+c+1;for(var d=o;d<=i[o].lastchild;d++)if(e.cellTree.columns[s]&&e.cellTree.columns[s][d].icon&&!e.cellTree.columns[s][d].expand)for(var u=d+1;u<=e.cellTree.columns[s][d].lastchild;u++)e.tempSchema[u].hidden=!0;c++}}},e.initCellTreeSettings=function(){var t=this;if(void 0!==e.viewData){if(e.attributes.rowTree.length>0&&e.viewData.length>0){e.cellTree.rows=Array(e.viewData.length).fill().map(function(e,o){return _newArrowCheck(this,t),{index:o}}.bind(this)),e.cellTree.rowTreeColIndex=e.attributes.rowTreeColIndex;var o,r=!1,n=_createForOfIteratorHelper(e.attributes.rowTree);try{for(n.s();!(o=n.n()).done;){var l=o.value;if(e.cellTree.rows.length<=l.end){r=!0;break}for(var i=l.begin;i<=l.end;i++)i==l.begin?(e.cellTree.rows[i].icon=!0,e.cellTree.rows[i].lastchild=l.end,e.cellTree.rows[i].expand=!0,e.cellTree.rows[i].parentCount||(e.cellTree.rows[i].parentCount=0)):(e.cellTree.rows[i].hide=!1,e.cellTree.rows[i].parentIndex=l.begin,e.cellTree.rows[i]&&e.cellTree.rows[i].parentCount?e.cellTree.rows[i].parentCount+=1:e.cellTree.rows[i].parentCount=1)}}catch(e){n.e(e)}finally{n.f()}r&&(e.cellTree.rows={})}if(e.attributes.columnTree.length>0&&e.viewData.length>0){e.cellTree.columnTreeRowStartIndex=e.attributes.columnTreeRowStartIndex,e.cellTree.columnTreeRowEndIndex=e.attributes.columnTreeRowEndIndex;var a,s=Object.keys(e.viewData[0]).length,c=!1,d=_createForOfIteratorHelper(e.attributes.columnTree);try{for(d.s();!(a=d.n()).done;){var u=a.value;if(s<=u.end){c=!0;break}e.cellTree.columns[u.row]||(e.cellTree.columns[u.row]=Array(s).fill().map(function(e,o){return _newArrowCheck(this,t),{index:o}}.bind(this)));for(var h=u.begin;h<=u.end;h++){var f=e.cellTree.columns[u.row][h];h==u.begin&&(f.icon=!0,f.lastchild=u.end,f.length=u.end-u.begin,f.expand=!0,u.child?f.child=u.child:f.child=0)}}}catch(e){d.e(e)}finally{d.f()}e.cellTree.tempSchema=Array(s).fill().map((function(){return{hidden:!1}})),c&&(e.cellTree.columns={})}e.cellTree.origin={rows:e.cellTree.rows,columns:e.cellTree.columns}}},e.getDomRoot=function(){return e.shadowRoot?e.shadowRoot.host:e.parentNode},e.getFontName=function(e){return e.replace(/\d+\.?\d*px/,"")},e.getFontHeight=function(e){return parseFloat(e)},e.parseStyleValue=function(t){if(/Font/.test(t))return e.style[t+"Height"]=e.getFontHeight(e.style[t]),void(e.style[t+"Name"]=e.getFontName(e.style[t]));"moveOverlayBorderSegments"===t&&"string"==typeof e.style[t]&&(e.style[t]=e.style[t].split(",").map((function(e){return parseInt(e,10)})))},e.initProp=function(t){e.args[t]&&Object.keys(e.args[t]).forEach((function(o){e[t][o]=e.args[t][o]}))},e.getStyleProperty=function(t){return-1===e.styleKeys.indexOf(t)?e.parentNodeStyle[t]:e.style[t]},e.setStyleProperty=function(t,o,r){var n=-1!==["height","width","minHeight","minWidth","maxHeight","maxWidth"].indexOf(t);-1===e.styleKeys.indexOf(t)?e.parentNodeStyle[t]=o:(/-/.test(t)&&(t=e.dehyphenateProperty(t)),e.style[t]=o,e.parseStyleValue(t)),n&&e.resize(),r||(e.draw(!0),e.dispatchEvent("stylechanged",{name:"style",value:o}))},e.reloadStoredValues=function(){if(e.attributes.name&&e.attributes.saveAppearance){try{e.storedSettings=localStorage.getItem(e.storageName+"-"+e.attributes.name)}catch(t){console.warn("Error loading stored values. "+t.message),e.storedSettings=void 0}if(e.storedSettings)try{e.storedSettings=JSON.parse(e.storedSettings)}catch(t){console.warn("could not read settings from localStore",t),e.storedSettings=void 0}e.storedSettings&&("object"===_typeof(e.storedSettings.sizes)&&null!==e.storedSettings.sizes&&(e.sizes.rows=e.storedSettings.sizes.rows,e.sizes.columns=e.storedSettings.sizes.columns,["trees","columns","rows"].forEach((function(t){e.sizes[t]||(e.sizes[t]={})}))),"object"===_typeof(e.storedSettings.visibility)&&e.getSchema().forEach((function(t){e.storedSettings.visibility&&void 0!==e.storedSettings.visibility[t.name]&&(t.hidden=!e.storedSettings.visibility[t.name])})))}},e.init=function(){if(!e.initialized){var t={};return e.setAttributes(),e.setStyle(),e.initScrollBox(),e.setDom(),e.nodeType="canvas-datagrid",e.ie=/Trident/.test(window.navigator.userAgent),e.edge=/Edge/.test(window.navigator.userAgent),e.webKit=/WebKit/.test(window.navigator.userAgent),e.moz=/Gecko/.test(window.navigator.userAgent),e.mobile=/Mobile/i.test(window.navigator.userAgent),e.blankValues=[void 0,null,""],e.cursorGrab="grab",e.cursorGrabing="grabbing",e.cursorGrab=e.webKit?"-webkit-grab":e.cursorGrab,e.cursorGrabing=e.moz?"-webkit-grabbing":e.cursorGrabbing,e.pointerLockPosition={x:0,y:0},Object.keys(e.style).forEach(e.parseStyleValue),e.intf.moveSelection=e.moveSelection,e.intf.deleteSelectedData=e.deleteSelectedData,e.intf.moveTo=e.moveTo,e.intf.addEventListener=e.addEventListener,e.intf.removeEventListener=e.removeEventListener,e.intf.dispatchEvent=e.dispatchEvent,e.intf.dispose=e.dispose,e.intf.appendTo=e.appendTo,e.intf.getVisibleCellByIndex=e.getVisibleCellByIndex,e.intf.filters=e.filters,e.intf.sorters=e.sorters,e.intf.autosize=e.autosize,e.intf.beginEditAt=e.beginEditAt,e.intf.endEdit=e.endEdit,e.intf.setActiveCell=e.setActiveCell,e.intf.forEachSelectedCell=e.forEachSelectedCell,e.intf.scrollIntoView=e.scrollIntoView,e.intf.clearChangeLog=e.clearChangeLog,e.intf.gotoCell=e.gotoCell,e.intf.gotoRow=e.gotoRow,e.intf.addButton=e.addButton,e.intf.toggleCellCollapseTree=e.toggleCellCollapseTree,e.intf.expandCollapseCellTree=e.expandCollapseCellTree,e.intf.getHeaderByName=e.getHeaderByName,e.intf.findColumnScrollLeft=e.findColumnScrollLeft,e.intf.findRowScrollTop=e.findRowScrollTop,e.intf.fitColumnToValues=e.fitColumnToValues,e.intf.findColumnMaxTextLength=e.findColumnMaxTextLength,e.intf.disposeContextMenu=e.disposeContextMenu,e.intf.getCellAt=e.getCellAt,e.intf.groupColumns=e.groupColumns,e.intf.groupRows=e.groupRows,e.intf.removeGroupColumns=e.removeGroupColumns,e.intf.removeGroupRows=e.removeGroupRows,e.intf.toggleGroupColumns=e.toggleGroupColumns,e.intf.toggleGroupRows=e.toggleGroupRows,e.intf.getGroupsColumnBelongsTo=e.getGroupsColumnBelongsTo,e.intf.getGroupsRowBelongsTo=e.getGroupsRowBelongsTo,e.intf.isCellVisible=e.isCellVisible,e.intf.isRowVisible=e.isRowVisible,e.intf.isColumnVisible=e.isColumnVisible,e.intf.order=e.order,e.intf.draw=e.draw,e.intf.refresh=e.refresh,e.intf.isComponent=e.isComponent,e.intf.selectArea=e.selectArea,e.intf.clipElement=e.clipElement,e.intf.getSchemaFromData=e.getSchemaFromData,e.intf.setFilter=e.setFilter,e.intf.parentGrid=e.parentGrid,e.intf.toggleTree=e.toggleTree,e.intf.expandTree=e.expandTree,e.intf.collapseTree=e.collapseTree,e.intf.canvas=e.canvas,e.intf.context=e.ctx,e.intf.insertRow=e.insertRow,e.intf.deleteRow=e.deleteRow,e.intf.addRow=e.addRow,e.intf.insertColumn=e.insertColumn,e.intf.deleteColumn=e.deleteColumn,e.intf.addColumn=e.addColumn,e.intf.getClippingRect=e.getClippingRect,e.intf.setRowHeight=e.setRowHeight,e.intf.setColumnWidth=e.setColumnWidth,e.intf.resetColumnWidths=e.resetColumnWidths,e.intf.resetRowHeights=e.resetRowHeights,e.intf.resize=e.resize,e.intf.selectColumn=e.selectColumn,e.intf.selectRow=e.selectRow,e.intf.selectAll=e.selectAll,e.intf.selectNone=e.selectNone,e.intf.drawChildGrids=e.drawChildGrids,e.intf.assertPxColor=e.assertPxColor,e.intf.clearPxColorAssertions=e.clearPxColorAssertions,e.intf.integerToAlpha=e.integerToAlpha,e.intf.copy=e.copy,e.intf.cut=e.cut,e.intf.paste=e.paste,e.intf.setStyleProperty=e.setStyleProperty,e.intf.hideColumns=e.hideColumns,e.intf.unhideColumns=e.unhideColumns,e.intf.hideRows=e.hideRows,e.intf.unhideRows=e.unhideRows,Object.defineProperty(e.intf,"defaults",{get:function(){return{styles:e.defaults.styles.reduce((function(e,t){return e[t[0]]=t[1],e}),{}),attributes:e.defaults.attributes.reduce((function(e,t){return e[t[0]]=t[1],e}),{})}}}),e.styleKeys=Object.keys(e.intf.defaults.styles),e.styleKeys.map((function(t){return e.hyphenateProperty(t,!1)})).forEach(o),e.styleKeys.map((function(t){return e.hyphenateProperty(t,!0)})).forEach(o),e.DOMStyles=window.getComputedStyle(document.body,null),e.styleKeys.concat(Object.keys(e.DOMStyles)).forEach((function(o){t[o]=void 0,Object.defineProperty(t,o,{get:function(){return e.getStyleProperty(o)},set:function(t){e.initialized&&(e.appliedInlineStyles[o]=t),e.setStyleProperty(o,t)}})})),Object.defineProperty(e.intf,"shadowRoot",{get:function(){return e.shadowRoot}}),Object.defineProperty(e.intf,"activeCell",{get:function(){return e.activeCell}}),Object.defineProperty(e.intf,"hasFocus",{get:function(){return e.hasFocus}}),Object.defineProperty(e.intf,"hasActiveFilters",{get:function(){return e.hasActiveFilters()}}),Object.defineProperty(e.intf,"style",{get:function(){return t},set:function(t){Object.keys(t).forEach((function(o){e.setStyleProperty(o,t[o],!0)})),e.draw(!0),e.dispatchEvent("stylechanged",{name:"style",value:t})}}),Object.defineProperty(e.intf,"attributes",{value:{}}),Object.keys(e.attributes).forEach((function(t){Object.defineProperty(e.intf.attributes,t,{get:function(){return e.attributes[t]},set:function(o){e.attributes[t]=o,"name"===t&&e.tryLoadStoredSettings(),"rowTree"!==t&&"columnTree"!==t&&"columnTreeRowEndIndex"!==t||e.initCellTreeSettings(),e.draw(!0),e.dispatchEvent("attributechanged",{name:t,value:o[t]})}})})),e.filters.string=function(t,o){if(o===e.attributes.blanksText)return e.blankValues.includes(null==t?t:String(t).trim());t=String(t);var r,n=/\/(i|g|m)*$/.exec(o),l=n?n[0].substring(1):"",i=l.length;if(e.invalidFilterRegEx=void 0,"/"===o.substring(0,1)&&n){try{r=new RegExp(o.substring(1,o.length-(i+1)),l)}catch(t){return void(e.invalidFilterRegEx=t)}return r.test(t)}return!!t.toString&&-1!==t.toString().toLocaleUpperCase().indexOf(o.toLocaleUpperCase())},e.filters.number=function(t,o){return o===e.attributes.blanksText?e.blankValues.includes(null==t?t:String(t).trim()):!o||t===o},["formatters","filters","sorters"].forEach(e.initProp),e.applyComponentStyle(!1,e.intf),e.reloadStoredValues(),e.args.data&&(e.intf.data=e.args.data),(e.intf.innerText||e.intf.textContent)&&("application/x-canvas-datagrid"===e.intf.dataType&&(e.intf.dataType="application/json+x-canvas-datagrid"),e.intf.data=e.intf.innerText||e.intf.textContent),e.args.schema&&(e.intf.schema=e.args.schema),e.isChildGrid||!e.isComponent?requestAnimationFrame((function(){e.resize(!0)})):e.resize(!0),e.initialized=!0,e}function o(t){-1===e.styleKeys.indexOf(t)&&e.styleKeys.push(t)}},e.intf.blur=function(t){e.hasFocus=!1},e.intf.focus=function(){e.hasFocus=!0,e.controlInput.focus()},(e.shadowRoot||e.isChildGrid)&&(Object.defineProperty(e.intf,"height",{get:function(){return e.shadowRoot?e.shadowRoot.height:e.parentNode.height},set:function(t){e.shadowRoot?e.shadowRoot.height=t:e.parentNode.height=t,e.resize(!0)}}),Object.defineProperty(e.intf,"width",{get:function(){return e.shadowRoot?e.shadowRoot.width:e.parentNode.width},set:function(t){e.shadowRoot?e.shadowRoot.width=t:e.parentNode.width=t,e.resize(!0)}}),Object.defineProperty(e.intf,"parentNode",{get:function(){return e.parentNode},set:function(t){if(!e.isChildGrid)throw new TypeError("Cannot set property parentNode which has only a getter");e.parentNode=t}})),Object.defineProperty(e.intf,"visibleRowHeights",{get:function(){return e.visibleRowHeights}}),Object.defineProperty(e.intf,"openChildren",{get:function(){return e.openChildren}}),Object.defineProperty(e.intf,"childGrids",{get:function(){return Object.keys(e.childGrids).map((function(t){return e.childGrids[t]}))}}),Object.defineProperty(e.intf,"isChildGrid",{get:function(){return e.isChildGrid}}),Object.defineProperty(e,"cursor",{get:function(){return e.parentNodeStyle.cursor},set:function(t){"cell"===t&&(t="default"),e.currentCursor!==t&&(e.parentNodeStyle.cursor=t,e.currentCursor=t)}}),Object.defineProperty(e.intf,"orderDirection",{get:function(){return e.orderDirection},set:function(t){"desc"!==t&&(t="asc"),e.orderDirection=t,e.order(e.orderBy,e.orderDirection)}}),Object.defineProperty(e.intf,"orderBy",{get:function(){return e.orderBy},set:function(t){if(void 0===e.getSchema().find((function(e){return e.name===t})))throw new Error("Cannot sort by unknown column name.");e.orderBy=t,e.order(e.orderBy,e.orderDirection)}}),e.isComponent&&(Object.defineProperty(e.intf,"offsetHeight",{get:function(){return e.canvas.offsetHeight}}),Object.defineProperty(e.intf,"offsetWidth",{get:function(){return e.canvas.offsetWidth}})),Object.defineProperty(e.intf,"scrollHeight",{get:function(){return e.scrollBox.scrollHeight}}),Object.defineProperty(e.intf,"scrollWidth",{get:function(){return e.scrollBox.scrollWidth}}),Object.defineProperty(e.intf,"scrollTop",{get:function(){return e.scrollBox.scrollTop},set:function(t){e.scrollBox.scrollTop=t}}),Object.defineProperty(e.intf,"scrollLeft",{get:function(){return e.scrollBox.scrollLeft},set:function(t){e.scrollBox.scrollLeft=t}}),Object.defineProperty(e.intf,"sizes",{get:function(){return e.sizes}}),Object.defineProperty(e.intf,"parentDOMNode",{get:function(){return e.parentDOMNode}}),Object.defineProperty(e.intf,"input",{get:function(){return e.input}}),Object.defineProperty(e.intf,"controlInput",{get:function(){return e.controlInput}}),Object.defineProperty(e.intf,"currentCell",{get:function(){return e.currentCell}}),Object.defineProperty(e.intf,"visibleCells",{get:function(){return e.visibleCells}}),Object.defineProperty(e.intf,"visibleRows",{get:function(){return e.visibleRows}}),Object.defineProperty(e.intf,"selections",{get:function(){return r||(console.warn("DeprecationWarning: The property 'selections' is deprecated due to performance issue. And it will be removed in the future.Please use new property 'selectionList' instead. Visit this link to get more information: https://github.com/TonyGermaneri/canvas-datagrid/pull/498"),r=!0),e.getObsoleteSelectionMatrix()}}),Object.defineProperty(e.intf,"selectionList",{get:function(){return e.selections}}),Object.defineProperty(e.intf,"dragMode",{get:function(){return e.dragMode}}),Object.defineProperty(e.intf,"changes",{get:function(){return e.changes}}),e.intf.formatters=e.formatters,Object.defineProperty(e.intf,"dataType",{get:function(){return e.dataType},set:function(t){if(!e.parsers[t])throw new Error("No parser for MIME type "+t);e.dataType=t}}),e.eventNames.forEach((function(t){Object.defineProperty(e.intf,"on"+t,{get:function(){return e.componentL1Events[t]},set:function(o){e.events[t]=[],e.componentL1Events[t]=o,o&&e.addEventListener(t,o)}})})),Object.defineProperty(e.intf,"frozenRow",{get:function(){return e.frozenRow},set:function(t){if(isNaN(t))throw new TypeError("Expected value for frozenRow to be a number.");if(e.visibleRows.length<t)throw new RangeError("Cannot set a value larger than the number of visible rows.");e.frozenRow=t}}),Object.defineProperty(e.intf,"frozenColumn",{get:function(){return e.frozenColumn},set:function(t){if(isNaN(t))throw new TypeError("Expected value for frozenRow to be a number.");if(e.getVisibleSchema().length<t)throw new RangeError("Cannot set a value larger than the number of visible columns.");e.frozenColumn=t}}),Object.defineProperty(e.intf,"scrollIndexRect",{get:function(){return{top:e.scrollIndexTop,right:e.scrollIndexRight,bottom:e.scrollIndexBottom,left:e.scrollIndexLeft}}}),Object.defineProperty(e.intf,"scrollPixelRect",{get:function(){return{top:e.scrollPixelTop,right:e.scrollPixelRight,bottom:e.scrollPixelBottom,left:e.scrollPixelLeft}}}),Object.defineProperty(e.intf,"rowOrder",{get:function(){return e.orders.rows},set:function(t){if(!Array.isArray(t))throw new TypeError("Value must be an array.");if(!e.originalData||t.length<e.originalData.length)throw new RangeError("Array length must be equal to or greater than number of rows.");e.orders.rows=t}}),Object.defineProperty(e.intf,"columnOrder",{get:function(){return e.orders.columns},set:function(t){if(!Array.isArray(t))throw new TypeError("Value must be an array.");if(t.length<e.getSchema().length)throw new RangeError("Array length must be equal to or greater than number of columns.");e.orders.columns=t}}),Object.defineProperty(e.intf,"selectionBounds",{get:function(){return e.getSelectionBounds()}}),Object.defineProperty(e.intf,"selectedRows",{get:function(){return e.getSelectedData(!0)}}),Object.defineProperty(e.intf,"selectedCells",{get:function(){return e.getSelectedData()}}),Object.defineProperty(e.intf,"visibleSchema",{get:function(){return e.getVisibleSchema().map((function(e){return e}))}}),Object.defineProperty(e.intf,"treeGridAttributes",{get:function(){return e.treeGridAttributes},set:function(t){e.treeGridAttributes=t}}),Object.defineProperty(e.intf,"cellGridAttributes",{get:function(){return e.cellGridAttributes},set:function(t){e.cellGridAttributes=t}}),Object.defineProperty(e.intf,"fillCellCallback",{get:function(){return e.fillCellCallback},set:function(t){e.fillCellCallback=t}}),Object.defineProperty(e.intf,"ctx",{get:function(){return e.ctx}}),Object.defineProperty(e.intf,"schema",{get:function(){return e.getSchema()},set:function(t){if(void 0===t)return e.schema=void 0,e.tempSchema=void 0,void e.dispatchEvent("schemachanged",{schema:void 0});if(!Array.isArray(t)||"object"!==_typeof(t[0]))throw new Error("Schema must be an array of objects.");if(void 0===t[0].name)throw new Error("Expected schema to contain an object with at least a name property.");e.schema=t.map((function(t,o){return t.width=t.width||e.style.cellWidth,t.filter=t.filter||e.filter(t.type),t.type=t.type||"string",t.index=o,t.columnIndex=o,t.rowIndex=-1,t})),e.tempSchema=void 0,e.createNewRowData(),e.createColumnOrders(),e.tryLoadStoredSettings(),e.storedSettings&&"object"===_typeof(e.storedSettings.visibility)&&e.schema.forEach((function(t,o){e.storedSettings&&void 0!==e.storedSettings.visibility[t.name]&&(t.hidden=!e.storedSettings.visibility[t.name])})),e.resize(!0),e.dispatchEvent("schemachanged",{schema:e.schema})}}),e.intf.getTypes=function(){return Object.keys(e.parsers)},e.parseInnerHtml=function(e){if(!e||/^ +$/.test(e))return[];try{e=JSON.parse(e)}catch(e){console.warn(Error("Cannot parse application/json+x-canvas-datagrid formated data. "+e.message+" \nNote: canvas-datagrid.innerHTML is for string data only. Use the canvas-datagrid.data property to set object data."))}return e},e.parsers["application/json+x-canvas-datagrid"]=function(t,o){e.parsers["application/x-canvas-datagrid"](e.parseInnerHtml(t),(function(e,t){return o(e,t)}))},e.parsers["application/x-canvas-datagrid"]=function(e,t){return t(e)},e.intf.parsers=e.parsers,e.etl=function(t,o){if(!e.intf.parsers[e.dataType])throw new Error("Unsupported data type.");e.intf.parsers[e.dataType](t,(function(t,r){e.originalData=t,e.viewData=Array.from(e.originalData),Array.isArray(r)&&(e.schema=r),e.attributes.autoGenerateSchema&&(e.schema=e.getSchemaFromData(t)),e.schema||(e.tempSchema=e.getSchemaFromData(t)),e.getSchema()&&e.createColumnOrders(),e.refresh(),e.schema||0!==(e.originalData||[]).length||(e.tempSchema=[{name:""}]),e.fitColumnToValues("cornerCell",!0),(e.tempSchema&&!e.schema||e.attributes.autoGenerateSchema)&&(e.createColumnOrders(),e.dispatchEvent("schemachanged",{schema:e.tempSchema})),o()}))},Object.defineProperty(e.intf,"viewData",{get:function(){return e.viewData}}),Object.defineProperty(e.intf,"boundData",{get:function(){return e.originalData}}),Object.defineProperty(e.intf,"data",{get:function(){return e.originalData},set:function(t){e.etl(t,(function(){e.changes=[],e.createNewRowData(),e.attributes.autoResizeColumns&&e.originalData.length>0&&void 0===e.storedSettings&&e.autosize(),e.fitColumnToValues("cornerCell",!0),e.createRowOrders(),e.tryLoadStoredSettings(),e.dispatchEvent("datachanged",{data:e.originalData}),e.initCellTreeSettings(),e.resize(!0)}))}}),e.initScrollBox=function(){var t=0,o=0,r=0,n=0,l=0,i=0,a=20,s=20;function c(t,o){if(isNaN(t))throw new Error("ScrollTop value must be a number");t<0&&(t=0),t>l&&(t=l),l<0&&(t=0),r=t,o||e.scroll(),e.button&&e.moveButtonPos()}function d(t,o){if(isNaN(t))throw new Error("ScrollLeft value must be a number");t<0&&(t=0),t>i&&(t=i),i<0&&(t=0),n=t,o||e.scroll(),e.button&&e.moveButtonPos()}e.scrollBox.toString=function(){return'{"width": '+i.toFixed(2)+', "height": '+l.toFixed(2)+', "left": '+n.toFixed(2)+', "top": '+r.toFixed(2)+', "widthRatio": '+e.scrollBox.widthBoxRatio.toFixed(5)+', "heightRatio": '+e.scrollBox.heightBoxRatio.toFixed(5)+"}"},e.scrollBox.scrollTo=function(e,t,o){d(e,!0),c(t,o)},Object.defineProperty(e.scrollBox,"scrollBoxHeight",{get:function(){return a},set:function(e){a=e}}),Object.defineProperty(e.scrollBox,"scrollBoxWidth",{get:function(){return s},set:function(e){s=e}}),Object.defineProperty(e.scrollBox,"height",{get:function(){return t},set:function(e){t=e}}),Object.defineProperty(e.scrollBox,"width",{get:function(){return o},set:function(e){o=e}}),Object.defineProperty(e.scrollBox,"scrollTop",{get:function(){return r},set:c}),Object.defineProperty(e.scrollBox,"scrollLeft",{get:function(){return n},set:d}),Object.defineProperty(e.scrollBox,"scrollHeight",{get:function(){return l},set:function(e){r>e&&(r=Math.max(e,0)),l=e}}),Object.defineProperty(e.scrollBox,"scrollWidth",{get:function(){return i},set:function(e){n>e&&(n=Math.max(e,0)),i=e}})}}function selections(e){var t=this;function o(t,o,n){if(o){var l=o.top,i=o.bottom,a=o.left,s=o.right,c=i-l+1,d=s-a+1,u=getSelectionStateFromCells(e.selections,{startRow:l,endRow:i,startColumn:a,endColumn:s});if(!1!==u)for(var h=r(a,d),f=l,g=l+c;f<g;f++){var m=e.viewData[f]||{},p=!0===u||u[f-l];if(p)for(var w=a,v=a+d;w<v;w++)if(!0===p||p[w-a]){var y=h[w];if(y&&(!y.hidden||n))t({value:m[y.name],header:y,columnName:y.name,boundRowIndex:e.getBoundRowIndexFromViewRowIndex(f),boundColumnIndex:e.orders.columns[w],viewRowIndex:f,viewColumnIndex:w})}}}}function r(t,o){for(var r=e.getSchema(),n=[],l=t,i=t+o;l<i;l++){var a=r[e.orders.columns[l]];n[l]=a}return n}e.selections=[],e.selectionCache=[],e.selectionCacheWidth=0,e.selectionCacheHeight=0,e.getObsoleteSelectionMatrix=function(o){var r=this;_newArrowCheck(this,t);var n=e.getSelectionBounds(!0,o);if(!n)return[];var l=n.top,i=n.bottom,a=n.left,s=n.right,c=i-l+1,d=s-a+1,u=getSelectionStateFromCells(e.selections,{startRow:l,endRow:i,startColumn:a,endColumn:s});if(!1===u)return[];for(var h=[],f=l,g=l+c;f<g;f++)if(!0!==u){var m=u[f-l];if(m){h[f]=[];for(var p=a,w=a+d;p<w;p++)(!0===m||m[p-a])&&h[f].push(p)}}else h[f]=new Array(d).fill(0).map(function(e,t){return _newArrowCheck(this,r),a+t}.bind(this));for(var v=0;v<e.selections.length;v++){var y=e.selections[v];if(y.type===SelectionType.Rows)for(var x=y.startRow;x<=y.endRow;x++)h[x]?-1!==h[x][0]&&h[x].unshift(-1):h[x]=[-1]}return h}.bind(this),e.getSelectedContiguousColumns=function(t){var o=this;t||(t=e.getSchema());var r=getSelectedContiguousColumns(e.selections,!1);if(Array.isArray(r)){var n=e.orders.columns;return r.map(function(e){_newArrowCheck(this,o);var r=n[e],l=t[r];return Object.assign({},l,{orderIndex:e})}.bind(this))}},e.getSelectedContiguousRows=function(t){var o=getSelectedContiguousRows(e.selections,!1);if(Array.isArray(o)&&(t||o[0]!==o[1]))return o},e.canSelectionsBeCopied=function(){return e.selections.length>0&&!areSelectionsComplex(e.selections)},e.getSelectedRowsHeight=function(){var t=getSelectedContiguousRows(e.selections,!0);if(!t)return 0;for(var o=0,r=t[0];r<=t[1];r++)o+=e.getRowHeight(r);return o},e.getSelectedColumnsWidth=function(){var t=getSelectedContiguousColumns(e.selections,!0);if(!t)return 0;for(var o=0,r=t[0];r<=t[1];r++)o+=e.getColumnWidth(e.orders.columns[r]);return o},e.isCellSelected=function(o){return _newArrowCheck(this,t),isCellSelected(e.selections,o.rowIndex,o.viewColumnIndex)}.bind(this),e.isColumnSelected=function(o){return _newArrowCheck(this,t),"number"==typeof o&&isColumnSelected(e.selections,o)}.bind(this),e.isRowSelected=function(o){return _newArrowCheck(this,t),"number"==typeof o&&isRowSelected(e.selections,o)}.bind(this),e.clearSelections=function(o){_newArrowCheck(this,t),e.selections=[],o&&e.dispatchSelectionChangedEvent()}.bind(this),e.selectNone=function(o){_newArrowCheck(this,t),e.clearSelections(!0),o||e.draw()}.bind(this),e.selectAll=function(t){_addIntoSelections(e.selections,{type:SelectionType.Columns,startColumn:0,endColumn:e.getSchema().length-1})&&!t&&e.draw()},e.unselectCell=function(o,r){_newArrowCheck(this,t);var n=_removeFromSelections(e.selections,normalizeSelection({type:SelectionType.Cells,startRow:o.rowIndex,startColumn:o.viewColumnIndex}));return n&&!r&&e.dispatchSelectionChangedEvent(),n}.bind(this),e.unselectRows=function(o,r,n){_newArrowCheck(this,t);var l=_removeFromSelections(e.selections,normalizeSelection({type:SelectionType.Rows,startRow:o,endRow:r}));return l&&!n&&e.dispatchSelectionChangedEvent(),l}.bind(this),e.selectCell=function(o,r){_newArrowCheck(this,t);var n=_addIntoSelections(e.selections,normalizeSelection({type:SelectionType.Cells,startRow:o.rowIndex,startColumn:o.viewColumnIndex}));return n&&!r&&e.dispatchSelectionChangedEvent(),n}.bind(this),e.moveSelection=function(t,o){moveSelections(e.selections,t,o)},e.dispatchSelectionChangedEvent=function(){_newArrowCheck(this,t),e.dispatchEvent("selectionchanged",e.getContextOfSelectionEvent())}.bind(this),e.getContextOfSelectionEvent=function(){_newArrowCheck(this,t);var o={selectionList:e.cloneSelections()};return Object.defineProperty(o,"selections",{get:function(){return e.getObsoleteSelectionMatrix()}}),Object.defineProperty(o,"selectedData",{get:function(){return e.getSelectedData()}}),Object.defineProperty(o,"selectedCells",{get:function(){return e.getSelectedCells()}}),Object.defineProperty(o,"selectionBounds",{get:function(){return e.getSelectionBounds()}}),o}.bind(this),e.cloneSelections=function(){return _newArrowCheck(this,t),cloneSelections(e.selections)}.bind(this),e.getSelectionBounds=function(o,r){_newArrowCheck(this,t);var n=getSelectionBounds(r||e.selections);if(o){if(n.top>n.bottom||n.left>n.right)return null;e.sanitizeSelectionBounds(n)}return n}.bind(this),e.sanitizeSelectionBounds=function(o){if(_newArrowCheck(this,t),!o)return o;o.top<0&&(o.top=0),o.left<0&&(o.left=0);var r=e.viewData.length;o.bottom>r&&(o.bottom=r-1);var n=e.getSchema().length;return o.right>n&&(o.right=n-1),o}.bind(this),e.getSelectedData=function(o){_newArrowCheck(this,t);var n=e.getSelectionBounds(!0);if(!n)return[];var l=[],i=n.top,a=n.bottom,s=n.left,c=n.right,d=a-i+1,u=c-s+1,h=getSelectionStateFromCells(e.selections,{startRow:i,endRow:a,startColumn:s,endColumn:c});if(!1===h)return[];for(var f=r(s,u),g=i,m=i+d;g<m;g++){var p=e.viewData[g]||{},w={},v=!1,y=!0===h||h[g-i];if(y){for(var x=s,C=s+u;x<C;x++)if(!0===h||y[x-s]){var b=f[x];if(b&&!b.hidden){if(v=!0,o)break;w[b.name]=p[b.name]}}v&&(l[g]=o?Object.assign({},p):w)}}return l}.bind(this),e.getSelectedCells=function(r){var n=this;_newArrowCheck(this,t);var l=[],i=e.getSelectionBounds(!0);return o(function(e){return _newArrowCheck(this,n),l.push(e)}.bind(this),i,r),l}.bind(this),e.clearSelectedCells=function(){var r=this;_newArrowCheck(this,t);var n=[],l=e.getSelectionBounds(!0);return o(function(t){_newArrowCheck(this,r),n.push(t),e.viewData[t.boundRowIndex][t.columnName]=""}.bind(this),l,!1),n}.bind(this),e.deleteSelectedData=function(o){var r=this;_newArrowCheck(this,t);var n=e.clearSelectedCells().map(function(e){return _newArrowCheck(this,r),[e.viewRowIndex,e.viewColumnIndex,e.boundRowIndex,e.boundColumnIndex]}.bind(this));e.dispatchEvent("afterdelete",{cells:n}),o||requestAnimationFrame(function(){return _newArrowCheck(this,r),e.draw()}.bind(this))}.bind(this),e.forEachSelectedCell=function(t,r){var n=this,l=e.getSelectionBounds(!0);o(function(o){return _newArrowCheck(this,n),t(e.viewData,o.viewRowIndex,o.columnName,o)}.bind(this),l,r)},e.copySelectedCellsToClipboard=function(o){_newArrowCheck(this,t);var r=areSelectionsNeat(e.selections),n=e.getSelectedData();if(n.length>0)for(var l=createTextString(n,r),i={"text/plain":l,"text/html":createHTMLString(n,r),"text/csv":l,"application/json":JSON.stringify(n)},a=0,s=Object.entries(i);a<s.length;a++){var c=_slicedToArray(s[a],2),d=c[0],u=c[1];o.setData(d,u)}}.bind(this),e.fitSelectedColumns=function(r){var n=this;_newArrowCheck(this,t);var l=e.getSelectionBounds(!0);if(l){var i="number"==typeof r&&r>0;l.bottom=l.top,o(function(t){_newArrowCheck(this,n);var o=t.columnName,l=t.viewColumnIndex;i?(e.sizes.columns[l]=r,e.dispatchEvent("resizecolumn",{x:r,y:e.resizingStartingHeight,width:r,height:e.resizingStartingHeight,columnIndex:l,draggingItem:e.currentCell})):e.fitColumnToValues(o)}.bind(this),l,!1)}}.bind(this),e.fitSelectedRows=function(o){_newArrowCheck(this,t);var r=e.getSelectionBounds(!0);if(r)for(var n=r.top;n<=r.bottom;n++)e.isRowSelected(n)&&(e.sizes.rows[n]=o,e.dispatchEvent("resizerow",{width:e.resizingStartingWidth,height:o,rowIndex:n,draggingItem:e.currentCell}))}.bind(this),e.selectColumn=function(o,r,n,l){if(_newArrowCheck(this,t),e.isMultiRowsSelected=!1,e.isMultiColumnsSelected=!1,n){if(!e.activeCell)return;var i=Math.min(e.activeCell.columnIndex,o),a=Math.max(e.activeCell.columnIndex,o);_addIntoSelections(e.selections,normalizeSelection({type:SelectionType.Columns,startColumn:i,endColumn:a-1})),i!=a&&(e.isMultiColumnsSelected=!0)}var s;r||n||(e.selections=[],e.activeCell.columnIndex=o,e.activeCell.rowIndex=e.scrollIndexTop),r&&e.isColumnSelected(o)?(s=o,_removeFromSelections(e.selections,normalizeSelection({type:SelectionType.Columns,startColumn:s}))):function(t){_addIntoSelections(e.selections,normalizeSelection({type:SelectionType.Columns,startColumn:t}))}(o),l||e.dispatchSelectionChangedEvent()}.bind(this),e.selectRow=function(o,r,n,l){function i(){l||e.dispatchSelectionChangedEvent()}if(_newArrowCheck(this,t),e.isMultiRowsSelected=!1,(!1===e.dragAddToSelection||void 0===e.dragObject)&&isRowSelected(e.selections,o)&&r)return _removeFromSelections(e.selections,normalizeSelection({type:SelectionType.Rows,startRow:o})),void i();if(!0===e.dragAddToSelection||void 0===e.dragObject)if(n&&void 0===e.dragObject){if(!e.activeCell)return;var a=Math.min(e.activeCell.rowIndex,o),s=Math.max(e.activeCell.rowIndex,o);_addIntoSelections(e.selections,normalizeSelection({type:SelectionType.Rows,startRow:a,endRow:s}))}else c=o,_addIntoSelections(e.selections,normalizeSelection({type:SelectionType.Rows,startRow:c}));var c;i()}.bind(this),e.selectArea=function(t,o){var r=e.getSchema().length;if(t){if(t.right<0&&(t.right=Math.max(r-1,t.left,0)),t.top>t.bottom||t.left>t.right)throw new Error("Impossible selection area");e.selectionBounds=e.sanitizeSelectionBounds(t)}var n=e.selectionBounds,l=n.top,i=n.bottom,a=n.left,s=n.right;if(o||(e.selections=[]),i>=e.viewData.length&&(i=Math.max(e.viewData.length-1,l)),l<-1||a<-1||s>r)throw new Error("Impossible selection area");var c={rows:e.viewData.length,columns:r},d=!1;if(-1===l){var u=Math.max(a,0),h=-1===a?r-1:Math.min(s,r-1);d=_addIntoSelections(e.selections,normalizeSelection({type:SelectionType.Columns,startColumn:u,endColumn:h}),c)}else if(-1===a){var f=Math.max(l,0),g=Math.min(i,e.viewData.length-1);d=_addIntoSelections(e.selections,normalizeSelection({type:SelectionType.Rows,startRow:f,endRow:g}),c)}else d=_addIntoSelections(e.selections,normalizeSelection({type:SelectionType.Cells,startRow:l,endRow:i,startColumn:a,endColumn:s}),c);d&&e.dispatchSelectionChangedEvent()},e.getRowSelectionStates=function(o){var r=this;_newArrowCheck(this,t),("number"!=typeof o||o<0)&&(o=0);var n=e.getSchema().length-1,l=n-0+1,i=getSelectionStateFromCells(e.selections,{startRow:o,startColumn:0,endRow:o,endColumn:n});if(!1!==i){if(!0===i)return new Array(l).fill(!0).map(function(e,t){return _newArrowCheck(this,r),t}.bind(this));var a=i[0];if(a){for(var s=[],c=0;c<a.length;c++)a[c]&&s.push(c);return s}}}.bind(this),e.replaceAllSelections=function(o){_newArrowCheck(this,t),cleanupSelections(o),e.selections=o}.bind(this),e.selectColumnViewIndexes=function(o){var r=this;_newArrowCheck(this,t);var n=o.map(function(e){return _newArrowCheck(this,r),{type:SelectionType.Columns,startColumn:e,endRow:e}}.bind(this));e.replaceAllSelections(n)}.bind(this),e.getRowViewIndexesFromSelection=function(){if(_newArrowCheck(this,t),0===e.selections.length)return[];for(var o=getSelectionBounds(e.selections,!0),r=[],n=o.top;n<=o.bottom;n++)r.push(n);return r}.bind(this),e.shrinkOrExpandSelections=function(o,r,n){_newArrowCheck(this,t);var l=shrinkOrExpandSelections(e.selections,o,r,{columns:e.getSchema().length,rows:e.viewData.length});return l&&!n&&e.dispatchSelectionChangedEvent(),l}.bind(this)}function contextMenu(e){var t,o,r;function n(t){e.createInlineStyle(t,"canvas-datagrid-context-menu-item"+(e.mobile?"-mobile":"")),t.addEventListener("mouseover",(function(){e.createInlineStyle(t,"canvas-datagrid-context-menu-item:hover")})),t.addEventListener("mouseout",(function(){e.createInlineStyle(t,"canvas-datagrid-context-menu-item")}))}function l(r,i,a,s){var c,d,u,h=document.createElement("div"),f=document.createElement("div"),g=document.createElement("div"),m=[],p=-1,w={};if(!Array.isArray(a))throw new Error("createContextMenu expects an array.");function v(){h.scrollTop>0?e.parentDOMNode.appendChild(f):f.parentNode&&f.parentNode.removeChild(f),h.scrollTop>=h.scrollHeight-h.offsetHeight&&g.parentNode?g.parentNode.removeChild(g):h.scrollHeight-h.offsetHeight>0&&!(h.scrollTop>=h.scrollHeight-h.offsetHeight)&&e.parentDOMNode.appendChild(g)}function y(t){return function r(){var n=e.attributes.contextHoverScrollAmount;"up"===t&&0===h.scrollTop||"down"===t&&h.scrollTop===h.scrollHeight||(h.scrollTop+="up"===t?-n:n,o=setTimeout(r,e.attributes.contextHoverScrollRateMs,t))}}function x(e){return function(){clearTimeout(o)}}return w.parentGrid=e.intf,w.parentContextMenu=s,w.container=h,d={},u=e.scrollOffset(e.canvas),void 0===t&&(t=e.style.contextMenuZIndex),a.forEach((function(t){var o,i=document.createElement("div");function a(e){e.relatedTarget===h||t.contextMenu.container===e.relatedTarget||o===e.relatedTarget||i===e.relatedTarget||t.contextMenu.container.contains(e.relatedTarget)||(t.contextMenu.dispose(),m.splice(m.indexOf(t.contextMenu),1),t.contextMenu=void 0,i.removeEventListener("mouseout",a),h.removeEventListener("mouseout",a),i.setAttribute("contextOpen","0"),i.setAttribute("opening","0"))}function s(o){if("1"===i.getAttribute("opening")&&"1"!==i.getAttribute("contextOpen")){var n=i.getBoundingClientRect();n={left:n.left+e.style.childContextMenuMarginLeft+h.offsetWidth,top:n.top+e.style.childContextMenuMarginTop,bottom:n.bottom,right:n.right},t.contextMenu=l(r,n,o,w),i.setAttribute("contextOpen","1"),i.addEventListener("mouseout",a),h.addEventListener("mouseout",a),m.push(t.contextMenu)}}function c(){var e;if("1"!==i.getAttribute("contextOpen")){if(i.setAttribute("opening","1"),"function"==typeof t.items)return e=t.items.apply(w,[function(e){s(e)}]),void(void 0!==e&&Array.isArray(e)&&s(e));s(t.items)}}!function(t){!function e(t){if(null!==t)return"function"==typeof t?e(t(r)):void("object"!==_typeof(t)?(n(i),i.innerHTML=t):i.appendChild(t))}(t.title),t.contextItemContainer=i,(t.items&&t.items.length>0||"function"==typeof t.items)&&(o=document.createElement("div"),e.createInlineStyle(o,"canvas-datagrid-context-child-arrow"),o.innerHTML=e.style.childContextMenuArrowHTML,i.appendChild(o),i.addEventListener("mouseover",c),i.addEventListener("mouseout",(function(){i.setAttribute("opening","0")}))),t.click&&i.addEventListener("click",(function(o){t.click.apply(e,[o])}))}(t),h.appendChild(i)})),e.createInlineStyle(h,"canvas-datagrid-context-menu"+(e.mobile?"-mobile":"")),d.x=i.left-u.left,d.y=i.top-u.top,d.height=0,t+=1,h.style.opacity=0,h.style.position="absolute",f.style.color=e.style.contextMenuArrowColor,g.style.color=e.style.contextMenuArrowColor,[f,g].forEach((function(e){e.style.textAlign="center",e.style.position="absolute",e.style.zIndex=t+1})),h.style.zIndex=t,s&&s.inputDropdown&&(h.style.maxHeight=window.innerHeight-d.y-e.style.autocompleteBottomMargin+"px",h.style.minWidth=i.width+"px",d.y+=i.height),e.mobile&&(h.style.width=i.width+"px"),h.style.left=d.x+"px",h.style.top=d.y+"px",h.addEventListener("scroll",v),h.addEventListener("wheel",(function(t){e.hasFocus&&(h.scrollTop+=t.deltaY,h.scrollLeft+=t.deltaX),v()})),f.innerHTML=e.style.contextMenuArrowUpHTML,g.innerHTML=e.style.contextMenuArrowDownHTML,h.appendChild(f),document.body.appendChild(g),document.body.appendChild(h),function(t){var o=.1;t.style.display="block";var r=setInterval((function(){o>=1&&clearInterval(r),t.style.opacity=o,t.style.filter="alpha(opacity="+100*o+")",o+=.1*o}),.1*e.attributes.animationDurationShowContextMenu)}(h),(c=h.getBoundingClientRect()).bottom>window.innerHeight&&(s&&s.inputDropdown||(d.y-=c.bottom+e.style.contextMenuWindowMargin-window.innerHeight),d.y<0&&(d.y=e.style.contextMenuWindowMargin),h.offsetHeight>window.innerHeight-e.style.contextMenuWindowMargin&&(h.style.height=window.innerHeight-2*e.style.contextMenuWindowMargin+"px")),c.right>window.innerWidth&&(d.x-=c.right-window.innerWidth+e.style.contextMenuWindowMargin),d.x<0&&(d.x=e.style.contextMenuWindowMargin),d.y<0&&(d.y=e.style.contextMenuWindowMargin),h.style.left=d.x+"px",h.style.top=d.y+"px",c=h.getBoundingClientRect(),f.style.top=c.top+"px",g.style.top=c.top+c.height-g.offsetHeight+"px",f.style.left=c.left+"px",g.style.left=c.left+"px",g.style.width=h.offsetWidth+"px",f.style.width=h.offsetWidth+"px",g.addEventListener("mouseover",y("down")),g.addEventListener("mouseout",x()),f.addEventListener("mouseover",y("up")),f.addEventListener("mouseout",x()),v(),w.clickIndex=function(e){a[e].contextItemContainer.dispatchEvent(new Event("click"))},w.rect=c,w.items=a,w.upArrow=f,w.downArrow=g,w.dispose=function(){clearTimeout(o),m.forEach((function(e){e.dispose()})),[g,f,h].forEach((function(t){var o,r,n;o=t,r=1,n=setInterval((function(){r<=.1&&(clearInterval(n),o.style.display="none",o.parentNode&&o.parentNode.removeChild(o)),o.style.opacity=r,o.style.filter="alpha(opacity="+100*r+")",r-=.1*r}),.1*e.attributes.animationDurationHideContextMenu)}))},Object.defineProperty(w,"selectedIndex",{get:function(){return p},set:function(t){if("number"!=typeof t||isNaN(t)||!isFinite(t))throw new Error("Context menu selected index must be a sane number.");(p=t)>a.length-1&&(p=a.length-1),p<0&&(p=0),a.forEach((function(t,o){if(o===p)return e.createInlineStyle(t.contextItemContainer,"canvas-datagrid-context-menu-item:hover");e.createInlineStyle(t.contextItemContainer,"canvas-datagrid-context-menu-item")}))}}),w}function i(t){var o,n=document.createElement("div"),i=document.createElement("div"),a=document.createElement("button"),s=document.createElement("input"),c=t.cell&&t.cell.header?t.cell.header.title||t.cell.header.name:"";function d(){s.style.background=e.style.contextFilterInputBackground,s.style.color=e.style.contextFilterInputColor,e.invalidFilterRegEx&&(s.style.background=e.style.contextFilterInvalidRegExpBackground,s.style.color=e.style.contextFilterInvalidRegExpColor)}function u(n){if(!n||!["ArrowDown","ArrowUp","Enter","Tab"].includes(n.key)){var i,a,c,d=(i=0,a={},c=[],e.viewData.forEach((function(o){var r=null==o[t.cell.header.name]?o[t.cell.header.name]:String(o[t.cell.header.name]).trim(),n=e.blankValues.includes(r)?e.attributes.blanksText:r;a[n]||i>e.attributes.maxAutoCompleteItems||(i+=1,a[n]={title:e.formatters[t.cell.header.type||"string"]({cell:{value:n}}),click:function(t){s.value=n,t.stopPropagation(),s.dispatchEvent(new Event("keyup")),e.disposeAutocomplete()}})})),-1!==Object.keys(a).indexOf(e.attributes.blanksText)&&(c.push(a[e.attributes.blanksText]),delete a[e.attributes.blanksText]),c.concat(Object.keys(a).map((function(e){return a[e]}))));o=s.getBoundingClientRect(),r&&(r.dispose(),r=void 0),(r=l(t,{left:o.left,top:o.top,right:o.right,bottom:o.bottom,height:o.height,width:o.width},d,{inputDropdown:!0})).selectedIndex=0}}e.createInlineStyle(i,"canvas-datagrid-context-menu-label"),e.createInlineStyle(a,"canvas-datagrid-context-menu-filter-button"),e.createInlineStyle(s,"canvas-datagrid-context-menu-filter-input"),d(),s.onclick=e.disposeAutocomplete,s.addEventListener("keydown",(function(t){"ArrowDown"===t.key&&(r.selectedIndex+=1),"ArrowUp"===t.key&&(r.selectedIndex-=1),"Enter"===t.key&&(r.clickIndex(r.selectedIndex),e.disposeContextMenu()),"Tab"===t.key&&(r.clickIndex(r.selectedIndex),t.preventDefault()),"Escape"===t.key&&e.disposeContextMenu()})),s.addEventListener("keyup",(function(){e.setFilter(t.cell.header.name,s.value)})),s.addEventListener("keyup",u),["focus","blur","keydown","keyup","change"].forEach((function(e){s.addEventListener(e,d)})),s.value=t.cell.header&&e.columnFilters[t.cell.header.name]||"",i.innerHTML=e.attributes.filterOptionText.replace(/%s/g,c),a.onclick=function(){if(r)return e.disposeAutocomplete();u()},a.innerHTML=e.style.contextFilterButtonHTML,n.addEventListener("click",(function(e){return e.stopPropagation()})),n.appendChild(i),n.appendChild(s),n.appendChild(a),t.items.push({title:n}),Object.keys(e.columnFilters).length&&Object.keys(e.columnFilters).forEach((function(o){var r=e.getHeaderByName(o);t.items.push({title:e.attributes.removeFilterOptionText.replace(/%s/g,r.title||r.name),click:function(t){t.preventDefault(),e.setFilter(o,""),e.controlInput.focus()}})}))}e.disposeAutocomplete=function(){r&&(r.dispose(),r=void 0)},e.disposeContextMenu=function(o){document.removeEventListener("click",e.disposeContextMenu),t=e.style.contextMenuZIndex,e.disposeAutocomplete(),e.contextMenu&&e.contextMenu.dispose(),e.contextMenu=void 0,o&&(e.canvas.focus(),e.mousedown(o),e.mouseup(o))},e.contextmenuEvent=function(t,o){var r=this;if(e.hasFocus||t.target===e.canvas){for(var a=Object.keys(e.childGrids),s=0;s<a.length;s++){var c=e.childGrids[a[s]],d=c&&c.parentNode;if(d){var u=d.offsetLeft,h=d.offsetWidth,f=d.offsetTop,g=d.offsetHeight;if(!1!=(t.x>=u&&t.x<=u+h)&&!1!=(t.y>=f&&t.y<=f+g))return}}if(e.isChildGrid&&e.parentNode){var m=e.parentGrid&&e.parentGrid.childGrids;if(!m||!Array.isArray(m))return;if(!m.find(function(t){_newArrowCheck(this,r);var o=t.parentNode,n=e.parentNode;return o.offsetTop==n.offsetTop&&o.offsetLeft===n.offsetLeft}.bind(this)))return;for(var p=e.parentNode.offsetLeft,w=e.parentNode.offsetLeft+e.parentNode.offsetWidth,v=e.parentNode.offsetTop,y=e.parentNode.offsetTop+e.parentNode.offsetHeight,x=e.parentNode.parentNode;x;){var C=x,b=C.offsetLeft,S=C.offsetWidth,R=C.offsetTop;b>p&&(p=b),R>v&&(v=R);var B=b+S,T=R+C.offsetHeight;if(B<w&&(w=B),T<y&&(y=T),"canvas-datagrid-tree"!==x.nodeType)break;x=x.parentNode}if(!1==(t.x>=p&&t.x<=w&&t.y>=v&&t.y<=y))return}var I,M=[],k=o||e.getLayerPos(t),A={NativeEvent:t,cell:e.getCellAt(k.x,k.y),pos:k,items:M};A.cell.isGrid||function(t){var o,r=this,l=e.getSchema(),a=function(){var e=this;return _newArrowCheck(this,r),o||(o=new Map(l.map(function(t){return _newArrowCheck(this,e),[t.columnIndex,t]}.bind(this)))),o}.bind(this),s=e.orderings.columns&&e.orderings.columns.length>0,c=!(t.cell.isBackground||t.cell.isColumnHeaderCellCap||t.cell.isScrollBar||t.cell.isCorner||t.cell.isRowHeader)&&t.cell.header;if(e.attributes.showFilter&&c&&i(t),e.attributes.showCopy&&e.canSelectionsBeCopied()&&t.items.push({title:e.attributes.copyText,click:function(){document.execCommand("copy"),e.disposeContextMenu(),e.controlInput.focus()}}),e.attributes.showPaste&&e.clipBoardData&&t.items.push({title:e.attributes.pasteText,click:function(){e.paste(e.clipBoardData),e.draw()}}),e.attributes.showColumnSelector&&(t.items.push({title:e.attributes.columnSelectorText,items:function(){var t=[];return e.getSchema().forEach((function(o){function r(t){o.hidden=!o.hidden,e.dispatchEvent("togglecolumn",{column:o,hidden:o.hidden}),t.preventDefault(),e.stopPropagation(t),e.disposeContextMenu(),e.resize(!0),e.setStorageData()}var l=document.createElement("div");n(l),l.addEventListener("touchstart",r),l.addEventListener("click",r),l.innerHTML=(o.hidden?e.attributes.columnSelectorHiddenText:e.attributes.columnSelectorVisibleText)+(o.title||o.name),t.push({title:l})})),t}}),t.cell&&t.cell.header&&t.cell.columnIndex>-1)){var d=t.cell.columnIndex,u=e.orders.columns[d],h=e.getSelectedContiguousColumns(l),f="";if(h)f=h.map(function(e){return _newArrowCheck(this,r),e.title||e.name}.bind(this)).join("-");else{var g=l[u];g&&(f=g.title||g.name)}t.items.push({title:e.attributes.hideColumnText.replace(/%s/gi,f),click:function(t){t.preventDefault(),e.stopPropagation(t),e.disposeContextMenu(),h?e.hideColumns(h[0].orderIndex,h[1].orderIndex):e.hideColumns(d)}})}if(e.attributes.saveAppearance&&e.attributes.showClearSettingsOption&&(Object.keys(e.sizes.rows).length>0||Object.keys(e.sizes.columns).length>0)&&t.items.push({title:e.attributes.clearSettingsOptionText,click:function(t){t.preventDefault(),e.sizes.rows={},e.sizes.columns={},e.createRowOrders(),e.createColumnOrders(),e.storedSettings=void 0,e.dispatchEvent("resizecolumn",{columnWidth:e.style.cellWidth}),e.dispatchEvent("resizerow",{cellHeight:e.style.cellHeight}),e.setStorageData(),e.resize(!0),e.disposeContextMenu(),e.controlInput.focus()}}),e.attributes.allowSorting&&e.attributes.showOrderByOption&&c&&(t.items.push({title:e.attributes.showOrderByOptionTextAsc.replace("%s",t.cell.header.title||t.cell.header.name),click:function(o){o.preventDefault(),e.order(t.cell.header.name,"asc"),e.controlInput.focus()}}),t.items.push({title:e.attributes.showOrderByOptionTextDesc.replace("%s",t.cell.header.title||t.cell.header.name),click:function(o){o.preventDefault(),e.order(t.cell.header.name,"desc"),e.disposeContextMenu(),e.controlInput.focus()}})),!s&&t.cell.isRowHeader&&t.cell.header){var m=e.getSelectedContiguousRows(!0);if(m){var p,w=m.map(function(t){return _newArrowCheck(this,r),e.getBoundRowIndexFromViewRowIndex(t)}.bind(this));1===w.length?(p="number"==typeof w[0]?w[0]+1:m[0]+1,p=e.attributes.showHideRow.replace("%s",p),t.items.push({title:p,click:function(t){t.preventDefault(),e.hideRows(w[0],w[0])}})):w[0]<=w[1]&&(p=w.map(function(e,t){return _newArrowCheck(this,r),"number"==typeof e?e+1:m[t]+1}.bind(this)).join("-"),p=e.attributes.showHideRows.replace("%s",p),t.items.push({title:p,click:function(t){t.preventDefault(),e.hideRows(w[0],w[1])}}))}}var v=e.getColumnGroupAreaHeight(),y=e.getRowGroupAreaWidth(),x=function(t,o){if(_newArrowCheck(this,r),0!==t.length){for(var n=0;n<t.length;n++)for(var l=t[n],i=0;i<l.length;i++)l[i].collapsed=o;e.refresh()}}.bind(this);t.pos&&t.pos.y<v&&(t.items.push({title:e.attributes.showRemoveAllGroupColumns,click:function(t){t.preventDefault(),e.groupedColumns=[],e.refresh()}}),t.items.push({title:e.attributes.showExpandAllGroupColumns,click:function(t){t.preventDefault(),x(e.groupedColumns,!1)}}),t.items.push({title:e.attributes.showCollapseAllGroupColumns,click:function(t){t.preventDefault(),x(e.groupedColumns,!0)}})),t.pos&&t.pos.x<y&&(t.items.push({title:e.attributes.showRemoveAllGroupRows,click:function(t){t.preventDefault(),e.groupedRows=[],e.refresh()}}),t.items.push({title:e.attributes.showExpandAllGroupRows,click:function(t){t.preventDefault(),x(e.groupedRows,!1)}}),t.items.push({title:e.attributes.showCollapseAllGroupRows,click:function(t){t.preventDefault(),x(e.groupedRows,!0)}}));var C=e.attributes.allowGroupingColumns&&t.cell.isColumnHeader&&t.cell.header&&t.cell.header.index>0,b=e.attributes.allowGroupingColumns&&t.cell.isColumnHeader,S=!s&&e.attributes.allowGroupingRows&&t.cell.isRowHeader&&t.cell.header,R=e.attributes.allowGroupingRows&&t.cell.isRowHeader;if(C){for(var B=[],T=t.cell.header.index,I=T;I>=0&&e.isColumnSelected(I);I--)B[0]=I;for(I=T;e.isColumnSelected(I);I++)B[1]=I;if(I!==T&&2===B.length&&B[1]>B[0]&&e.isNewGroupRangeValid(e.groupedColumns,B[0],B[1])){for(var M=a(),k=[],A=[],z=0;z<B.length;z++){var O=B[z],H=M.get(O);H&&(A.push(H.name),k.push(H.title||H.name||H.index))}A[0]&&A[1]&&t.items.push({title:e.attributes.showGroupColumns.replace("%s",k[0]+"-"+k[1]),click:function(t){t.preventDefault(),e.groupColumns(A[0],A[1]),e.controlInput.focus()}})}}if(b)for(var E=t.cell.columnIndex,P=e.getGroupsColumnBelongsTo(E),L=a(),D=function(o){var r=P[o],n=r.from,l=r.to,i=L.get(n),a=L.get(l);if(i&&a){var s=(i.title||i.name||i.index)+"-"+(a.title||a.name||a.index);t.items.push({title:e.attributes.showRemoveGroupColumns.replace("%s",s),click:function(t){t.preventDefault(),e.removeGroupColumns(i.name,a.name),e.controlInput.focus()}})}else console.warn("Cannot find column ".concat(n," or column ").concat(l))},F=0;F<P.length;F++)D(F);if(S){var W=e.getSelectedContiguousRows(!1)||[],N=W.map(function(t){_newArrowCheck(this,r);var o=e.getBoundRowIndexFromViewRowIndex(t);return"number"==typeof o?o+1:t+1}.bind(this)).join("-");2===W.length&&e.isNewGroupRangeValid(e.groupedRows,W[0],W[1])&&t.items.push({title:e.attributes.showGroupRows.replace("%s",N),click:function(t){t.preventDefault(),e.groupRows(W[0],W[1])}})}if(R)for(var G=t.cell.rowIndex,j=e.getGroupsRowBelongsTo(G),_=function(o){var r=this,n=j[o],l=n.from,i=n.to,a=[l,i].map(function(t){_newArrowCheck(this,r);var o=e.getBoundRowIndexFromViewRowIndex(t);return"number"==typeof o?o+1:t+1}.bind(this)).join("-");t.items.push({title:e.attributes.showRemoveGroupRows.replace("%s",a),click:function(t){t.preventDefault(),e.removeGroupRows(l,i),e.controlInput.focus()}})},V=0;V<j.length;V++)_(V)}(A),"mousedown"!==t.type&&e.dispatchEvent("contextmenu",A)||A.cell.isGrid||(e.contextMenu&&e.disposeContextMenu(),I={left:k.x+k.rect.left+e.style.contextMenuMarginLeft+e.canvasOffsetLeft,top:k.y+k.rect.top+e.style.contextMenuMarginTop+e.canvasOffsetTop,right:A.cell.width+A.cell.x+k.rect.left,bottom:A.cell.height+A.cell.y+k.rect.top,height:A.cell.height,width:A.cell.width},e.mobile&&(I.left=e.style.mobileContextMenuMargin+"px",I.width=e.width-2*e.style.mobileContextMenuMargin+"px"),"mousedown"==t.type&&(I.top+=e.style.filterButtonMenuOffsetTop),e.contextMenu=l(A,I,M),"mousedown"==t.type?window.addEventListener("mouseup",z):z(),t.preventDefault())}function z(){requestAnimationFrame((function(){document.addEventListener("click",e.disposeContextMenu),window.removeEventListener("mouseup",z)}))}}}function button(e){var t;function o(o,n,l){var i=document.createElement("div"),a=document.createElement("div"),s=document.createElement("div"),c={};if(!Array.isArray(n))throw new Error("createButton expects an array.");return c.wrapper=i,c.items=n,function(){var n={},c=e.scrollOffset(e.canvas);if(void 0===t&&(t=e.style.buttonZIndex),function(t){e.createInlineStyle(t,"canvas-datagrid-button-wrapper"),t.addEventListener("mouseover",(function(){e.buttonMenu||e.createInlineStyle(t,"canvas-datagrid-button-wrapper:hover")})),t.addEventListener("mouseout",(function(){e.buttonMenu||e.createInlineStyle(t,"canvas-datagrid-button-wrapper")}))}(i),e.createInlineStyle(s,"canvas-datagrid-button-icon"),e.createInlineStyle(a,"canvas-datagrid-button-arrow"),n.x=o.left-c.left,n.y=o.top-c.top,n.height=0,t+=1,i.style.position="absolute",i.style.zIndex=t,i.style.left=n.x+"px",i.style.top=n.y+"px",i.left=o.left+e.scrollBox.scrollLeft,i.top=o.top+e.scrollBox.scrollTop,a.innerHTML=e.style.buttonArrowDownHTML,l){var d=document.createElement("img");d.setAttribute("src",l),d.style.maxWidth="100%",d.style.height="100%",s.appendChild(d)}i.appendChild(s),i.appendChild(a),document.body.appendChild(i),i.addEventListener("click",r)}(),c.dispose=function(){i.parentNode&&i.parentNode.removeChild(i)},c}function r(){if(e.buttonMenu)e.disposeButtonMenu();else{var o={left:e.button.wrapper.left-e.scrollBox.scrollLeft,top:e.button.wrapper.top+e.button.wrapper.offsetHeight-e.scrollBox.scrollTop};e.buttonMenu=function(o,r){var n,l=document.createElement("div"),i=-1,a={};function s(){function t(t,o){function r(t){null!==t&&("object"!==_typeof(t)?(!function(t){e.createInlineStyle(t,"canvas-datagrid-button-menu-item"+(e.mobile?"-mobile":"")),t.addEventListener("mouseover",(function(){e.createInlineStyle(t,"canvas-datagrid-button-menu-item:hover")})),t.addEventListener("mouseout",(function(){e.createInlineStyle(t,"canvas-datagrid-button-menu-item")}))}(o),o.innerHTML=t):o.appendChild(t))}r(t.title),t.buttonMenuItemContainer=o,t.click&&o.addEventListener("click",(function(o){t.click.apply(e,[o]),e.disposeButton()}))}var o,n=_createForOfIteratorHelper(r);try{for(n.s();!(o=n.n()).done;){var i=o.value,a=document.createElement("div");t(i,a),l.appendChild(a)}}catch(e){n.e(e)}finally{n.f()}}function c(e){r[e].buttonMenuItemContainer.dispatchEvent(new Event("click"))}function d(){var r={},i=e.scrollOffset(e.canvas);void 0===t&&(t=e.style.buttonZIndex),s(),e.createInlineStyle(l,"canvas-datagrid-button-menu"+(e.mobile?"-mobile":"")),r.x=o.left-i.left,r.y=o.top-i.top,r.height=0,t+=1,l.style.position="absolute",l.style.zIndex=t,l.style.left=r.x+"px",l.style.top=r.y+"px",document.body.appendChild(l),(n=l.getBoundingClientRect()).bottom>window.innerHeight&&(r.y=e.button.wrapper.top-l.offsetHeight-e.scrollBox.scrollTop,r.y<0&&(r.y=e.style.buttonMenuWindowMargin),l.offsetHeight>window.innerHeight-e.style.buttonMenuWindowMargin&&(l.style.height=window.innerHeight-2*e.style.buttonMenuWindowMargin+"px")),n.right>window.innerWidth&&(r.x-=n.right-window.innerWidth+e.style.buttonMenuWindowMargin),r.x<0&&(r.x=e.style.buttonMenuWindowMargin),r.y<0&&(r.y=e.style.buttonMenuWindowMargin),l.style.left=r.x+"px",l.style.top=r.y+"px"}return a.buttonMenu=l,d(),a.clickIndex=c,a.rect=n,a.items=r,a.dispose=function(){l.parentNode&&l.parentNode.removeChild(l)},Object.defineProperty(a,"selectedIndex",{get:function(){return i},set:function(t){if("number"!=typeof t||isNaN(t)||!isFinite(t))throw new Error("Button menu selected index must be a sane number.");(i=t)>r.length-1&&(i=r.length-1),i<0&&(i=0),r.forEach((function(t,o){if(o===i)return e.createInlineStyle(t.buttonMenuItemContainer,"canvas-datagrid-button-menu-item:hover");e.createInlineStyle(t.buttonMenuItemContainer,"canvas-datagrid-button-menu-item")}))}}),a}(o,e.button.items),e.createInlineStyle(e.button.wrapper,"canvas-datagrid-button-wrapper:active"),requestAnimationFrame((function(){document.addEventListener("click",e.disposeButtonMenu)}))}}e.disposeButtonMenu=function(){e.buttonMenu&&(document.removeEventListener("click",e.disposeButtonMenu),e.buttonMenu.dispose(),e.buttonMenu=void 0,e.createInlineStyle(e.button.wrapper,"canvas-datagrid-button-wrapper:hover"))},e.disposeButton=function(o){o&&27!==o.keyCode||(document.removeEventListener("keydown",e.disposeButton),t=e.style.buttonZIndex,e.disposeButtonMenu(),e.button&&e.button.dispose(),e.button=void 0)},e.moveButtonPos=function(){e.button.wrapper.style.left=e.button.wrapper.left-e.scrollBox.scrollLeft+"px",e.button.wrapper.style.top=e.button.wrapper.top-e.scrollBox.scrollTop+"px",e.disposeButtonMenu()},e.attachButton=function(t,r,n){e.button&&e.disposeButton(),e.button=o(t,r,n),requestAnimationFrame((function(){document.addEventListener("keydown",e.disposeButton)}))}}function dom(e){e.getClippingRect=function(t){var o=e.position(e.parentNode),r=e.position(t),n=e.scrollOffset(e.canvas),l={x:0,y:0,h:0,w:0},i={x:-1/0,y:-1/0,h:1/0,w:1/0},a=e.getColumnHeaderCellHeight(),s=e.getRowHeaderCellWidth();return o.top-=n.top,o.left-=n.left,r.top-=n.top,r.left-=n.left,l.h=o.top+o.height-t.offsetTop-e.style.scrollBarWidth,l.w=o.left+o.width-t.offsetLeft-e.style.scrollBarWidth,l.x=o.left+-1*r.left+s,l.y=o.top+-1*r.top+a,{x:l.x>i.x?l.x:i.x,y:l.y>i.y?l.y:i.y,h:l.h<i.h?l.h:i.h,w:l.w<i.w?l.w:i.w}},e.clipElement=function(t){var o=e.getClippingRect(t);o.w<0&&(o.w=0),o.h<0&&(o.h=0),t.style.clip="rect("+o.y+"px,"+o.w+"px,"+o.h+"px,"+o.x+"px)"},e.scrollOffset=function(t){for(var o=0,r=0,n=document.scrollingElement||{scrollLeft:0,scrollTop:0};t.parentNode&&"CANVAS-DATAGRID"!==t.nodeName&&t!==e.intf;)"canvas-datagrid-tree"!==t.nodeType&&"canvas-datagrid-cell"!==t.nodeType&&(o-=t.scrollLeft,r-=t.scrollTop),t=t.parentNode;return{left:o-n.scrollLeft,top:r-n.scrollTop}},e.resizeEditInput=function(){if(e.input&&e.input.editCell){var t=e.canvas.getBoundingClientRect(),o=e.scrollOffset(e.intf),r="collapse"===e.style.gridBorderCollapse?1:2,n=e.style.cellBorderWidth*r,l=e.getVisibleCellByIndex(e.input.editCell.columnIndex,e.input.editCell.rowIndex)||{x:-100,y:-100,height:0,width:0};if(e.mobile)return e.input.style.left="0",e.input.style.top=e.height-e.style.mobileEditInputHeight-n-1+"px",e.input.style.height=e.style.mobileEditInputHeight+"px",void(e.input.style.width=e.width-n-1+"px");var i=e.getColumnGroupAreaHeight(),a=e.getRowGroupAreaWidth();if(e.parentNode){var s=e.parentNode,c=s.columnGroupsAreaHeight,d=s.rowGroupsAreaWidth;c&&(i+=c),d&&(a+=d)}e.input.style.left=t.left+l.x+e.canvasOffsetLeft-o.left+a+"px",e.input.style.top=t.top+l.y-e.style.cellBorderWidth+e.canvasOffsetTop-o.top+i+"px",e.input.style.height=l.height-n+"px",e.input.style.width=l.width-e.style.cellPaddingLeft+"px",e.clipElement(e.input)}},e.position=function(t,o){for(var r,n,l=0,i=0,a=t,s=!1;t.offsetParent&&"CANVAS-DATAGRID"!==t.nodeName;){var c="canvas-datagrid-tree"===t.nodeType;c&&s||(l+=t.offsetLeft,i+=t.offsetTop,r=t.offsetHeight,n=t.offsetWidth),c&&(s=!0),t=t.offsetParent}return o?{left:l,top:i,height:r,width:n}:(t=a,{left:l+(a=e.scrollOffset(t)).left,top:i+a.top,height:r,width:n})},e.getLayerPos=function(t){var o=e.canvas.getBoundingClientRect(),r={x:t.clientX-o.left,y:t.clientY-o.top};return e.isChildGrid&&(r.x-=e.canvasOffsetLeft,r.y-=e.canvasOffsetTop,e.parentNode.rowGroupsAreaWidth&&(r.x-=e.parentNode.rowGroupsAreaWidth),e.parentNode.columnGroupsAreaHeight&&(r.y-=e.parentNode.columnGroupsAreaHeight)),{x:r.x,y:r.y,rect:o}},e.endEdit=function(t){var o=e.input.editCell,r=o.rowIndex;if(e.dispatchEvent("beforeendedit",{cell:o,newValue:e.input.value,oldValue:o.value,abort:function(){t=!0},input:e.input}))return!1;if(e.input.value!==o.value&&!t){if(e.changes[r]=e.changes[r]||{},e.changes[r][o.header.name]=e.input.value,o.data||(e.originalData[o.boundRowIndex]={},o.data=e.originalData[o.boundRowIndex]),o.data[o.header.name]=e.input.value,r===e.viewData.length){if(e.dispatchEvent("newrow",{value:e.input.value,defaultValue:o.value,aborted:t,cell:o,input:e.input}))return!1;e.addRow(o.data),e.createNewRowData()}e.draw(!0)}return e.input.parentNode&&e.input.parentNode.removeChild(e.input),e.intf.focus(),e.dispatchEvent("endedit",{cell:o,value:e.input.value,aborted:t,input:e.input}),e.input=void 0,!0},e.beginEditAt=function(t,o,r){var n=arguments.length>3&&void 0!==arguments[3]&&arguments[3];if(e.attributes.editable){e.input&&e.endEdit();var l,i,a,s,c,d=e.getVisibleCellByIndex(t,o);e.getSchema();if(d&&d.header){if(a=d.header.enum,e.dispatchEvent("beforebeginedit",{cell:d,NativeEvent:r}))return!1;if(e.scrollIntoView(t,o),e.setActiveCell(t,o),l=e.getAdjacentCells(),e.input=a?document.createElement("select"):document.createElement(e.attributes.multiLine?"textarea":"input"),d=e.getVisibleCellByIndex(t,o)){a&&("function"==typeof a?i=a.apply(e.intf,[{cell:d}]):Array.isArray(a)&&(i=a),i.forEach((function(t){var o,r,n=document.createElement("option");Array.isArray(t)?(o=t[0],r=t[1]):(o=t,r=t),o===d.value&&(c=!0),n.value=o,n.innerHTML=r,e.input.appendChild(n)})),c||((s=document.createElement("option")).value=d.value,s.innerHTML=d.value,e.input.appendChild(s)),e.input.addEventListener("change",(function(){e.endEdit(),e.draw(!0)}))),e.dispatchEvent("appendeditinput",{cell:d,input:e.input})||document.body.appendChild(e.input),e.createInlineStyle(e.input,e.mobile?"canvas-datagrid-edit-mobile-input":"canvas-datagrid-edit-input"),e.input.style.position="absolute",e.input.editCell=d,e.resizeEditInput(),e.input.style.zIndex=e.style.editCellZIndex,e.input.style.fontSize=parseInt(e.style.editCellFontSize,10)*e.scale+"px";var u=-1!==[null,void 0].indexOf(d.value)||n;e.input.value=u?"":d.value;var h=Math.round(e.input.value.length*parseInt(e.style.editCellFontSize,10)*.7*e.scale);h+e.style.cellPaddingLeft<d.width?h=d.width-e.style.cellPaddingLeft:h>e.width-d.x-e.style.scrollBarWidth&&(h=e.width-d.x-e.style.scrollBarWidth,e.input.style.height="auto"),e.input.style.width=h+"px",e.input.focus(),e.input.addEventListener("click",e.stopPropagation),e.input.addEventListener("dblclick",e.stopPropagation),e.input.addEventListener("mouseup",e.stopPropagation),e.input.addEventListener("mousedown",e.stopPropagation),e.input.addEventListener("keydown",(function(o){var r=d.columnIndex,i=d.rowIndex;if("Escape"===o.key)e.endEdit(!0),e.draw(!0);else if("Enter"===o.key&&e.attributes.multiLine&&o.altKey)e.input.value=e.input.value+"\n",e.input.scrollTop=e.input.scrollHeight;else if("Enter"===o.key){e.endEdit();var a=o.shiftKey?Math.max(0,i-1):Math.min(i+1,e.viewData.length-1);a!==i&&(e.scrollIntoView(r,a),e.setActiveCell(r,a)),e.draw(!0)}else if(["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"].includes(o.key)&&n){switch(o.key){case"ArrowUp":i=Math.max(0,i-1);break;case"ArrowDown":i=Math.min(i+1,e.viewData.length-1);break;case"ArrowLeft":r=Math.max(r-1,0);break;case"ArrowRight":r=l.right}e.endEdit(),e.scrollIntoView(r,i),e.setActiveCell(r,i),e.draw(!0)}else if("Tab"===o.key){if(o.preventDefault(),!e.endEdit())return;r=o.shiftKey?l.left:l.right,l.left===t&&o.shiftKey&&(r=l.last,i-=1),l.right!==t||o.shiftKey||(r=l.first,i+=1),i<0&&(i=e.viewData.length-1),i>e.viewData.length-1&&(i=0),e.scrollIntoView(r,i),e.beginEditAt(r,i,o)}else{var s=Math.round(e.input.value.length*parseInt(e.style.editCellFontSize,10)*.7*e.scale);s+e.style.cellPaddingLeft<d.width?s=d.width-e.style.cellPaddingLeft:s>e.width-d.x-e.style.scrollBarWidth&&(s=e.width-d.x-e.style.scrollBarWidth,e.input.style.height="auto"),e.input.style.width=s+"px"}})),e.dispatchEvent("beginedit",{cell:d,input:e.input})}}}},e.createInlineStyle=function(t,o){var r={"canvas-datagrid-button-wrapper":{display:"inline-block",padding:e.style.buttonPadding,borderWidth:"1px",borderStyle:"solid",borderColor:e.style.buttonBorderColor,cursor:"pointer",background:e.style.buttonBackgroundColor,userSelect:"none"},"canvas-datagrid-button-wrapper:hover":{borderColor:e.style.buttonBorderColor,background:e.style.buttonHoverBackgroundColor},"canvas-datagrid-button-wrapper:active":{borderColor:e.style.buttonActiveBorderColor,background:e.style.buttonActiveBackgroundColor},"canvas-datagrid-button-icon":{width:"18px",height:"18px",display:"inline-block",verticalAlign:"middle"},"canvas-datagrid-button-arrow":{display:"inline-block",color:e.style.buttonArrowColor,fontSize:"9px"},"canvas-datagrid-button-menu-item-mobile":{lineHeight:"normal",fontWeight:"normal",fontFamily:e.style.contextMenuFontFamily,fontSize:e.style.contextMenuFontSize,color:"inherit",background:"inherit",margin:e.style.contextMenuItemMargin,borderRadius:e.style.contextMenuItemBorderRadius,verticalAlign:"middle"},"canvas-datagrid-button-menu-item":{lineHeight:"normal",fontWeight:"normal",fontFamily:e.style.contextMenuFontFamily,fontSize:e.style.contextMenuFontSize,color:"inherit",background:"inherit",margin:e.style.contextMenuItemMargin,borderRadius:e.style.contextMenuItemBorderRadius,verticalAlign:"middle"},"canvas-datagrid-button-menu-item:hover":{background:e.style.contextMenuHoverBackground,color:e.style.contextMenuHoverColor},"canvas-datagrid-button-menu-label":{margin:e.style.contextMenuLabelMargin,display:e.style.contextMenuLabelDisplay,minWidth:e.style.contextMenuLabelMinWidth,maxWidth:e.style.contextMenuLabelMaxWidth},"canvas-datagrid-button-menu-mobile":{lineHeight:"normal",fontWeight:"normal",fontFamily:e.style.contextMenuFontFamily,fontSize:e.style.contextMenuFontSize,background:e.style.contextMenuBackground,color:e.style.contextMenuColor,border:e.style.contextMenuBorder,padding:e.style.contextMenuPadding,borderRadius:e.style.contextMenuBorderRadius,opacity:e.style.contextMenuOpacity,overflow:"hidden",whiteSpace:"nowrap"},"canvas-datagrid-button-menu":{lineHeight:"normal",fontWeight:"normal",fontFamily:e.style.contextMenuFontFamily,fontSize:e.style.contextMenuFontSize,background:e.style.contextMenuBackground,color:e.style.contextMenuColor,border:e.style.contextMenuBorder,padding:e.style.contextMenuPadding,borderRadius:e.style.contextMenuBorderRadius,opacity:e.style.contextMenuOpacity,overflow:"hidden",whiteSpace:"nowrap",cursor:e.style.contextMenuCursor},"canvas-datagrid-context-menu-filter-input":{height:"19px",verticalAlign:"bottom",marginLeft:"2px",padding:"0",background:e.style.contextFilterInputBackground,color:e.style.contextFilterInputColor,border:e.style.contextFilterInputBorder,borderRadius:e.style.contextFilterInputBorderRadius,lineHeight:"normal",fontWeight:"normal",fontFamily:e.style.contextFilterInputFontFamily,fontSize:e.style.contextFilterInputFontSize},"canvas-datagrid-context-menu-filter-button":{height:"19px",verticalAlign:"bottom",marginLeft:"2px",padding:"0",background:e.style.contextMenuBackground,color:e.style.contextMenuColor,border:e.style.contextFilterButtonBorder,borderRadius:e.style.contextFilterButtonBorderRadius,lineHeight:"normal",fontWeight:"normal",fontFamily:e.style.contextMenuFilterButtonFontFamily,fontSize:e.style.contextMenuFilterButtonFontSize},"canvas-datagrid-context-child-arrow":{cssFloat:"right",color:e.style.childContextMenuArrowColor,fontSize:e.style.contextMenuChildArrowFontSize,fontFamily:e.style.contextMenuFontFamily,verticalAlign:"middle"},"canvas-datagrid-autocomplete":{fontFamily:e.style.contextMenuFontFamily,fontSize:e.style.contextMenuFontSize,background:e.style.contextMenuBackground,color:e.style.contextMenuColor,border:e.style.contextMenuBorder,padding:e.style.contextMenuPadding,borderRadius:e.style.contextMenuBorderRadius,opacity:e.style.contextMenuOpacity,position:"absolute",zIndex:9999,overflow:"hidden"},"canvas-datagrid-autocomplete-item":{background:e.style.contextMenuBackground,color:e.style.contextMenuColor},"canvas-datagrid-autocomplete-item:hover":{background:e.style.contextMenuHoverBackground,color:e.style.contextMenuHoverColor},"canvas-datagrid-canvas":{position:"absolute",zIndex:"-1"},"canvas-datagrid":{display:"block"},"canvas-datagrid-control-input":{position:"fixed",top:"-5px",left:"-5px",border:"none",opacity:"0",cursor:"pointer",width:"1px",height:"1px",lineHeight:"normal",fontWeight:"normal",fontFamily:e.style.contextMenuFontFamily,fontSize:e.style.contextMenuFontSize},"canvas-datagrid-edit-mobile-input":{boxSizing:"content-box",outline:"none",margin:"0",padding:"0 0 0 0",lineHeight:"normal",fontWeight:"normal",fontFamily:e.style.mobileEditFontFamily,fontSize:e.style.mobileEditFontSize,border:e.style.editCellBorder,color:e.style.editCellColor,background:e.style.editCellBackgroundColor,appearance:"none",webkitAppearance:"none",mozAppearance:"none",borderRadius:"0"},"canvas-datagrid-edit-input":{boxSizing:"content-box",outline:"none",margin:"0",padding:"0 0 0 "+e.style.editCellPaddingLeft+"px",lineHeight:"normal",fontWeight:"normal",fontFamily:e.style.editCellFontFamily,fontSize:e.style.editCellFontSize,boxShadow:e.style.editCellBoxShadow,border:e.style.editCellBorder,color:e.style.editCellColor,background:e.style.editCellBackgroundColor,appearance:"none",webkitAppearance:"none",mozAppearance:"none",borderRadius:"0"},"canvas-datagrid-context-menu-item-mobile":{lineHeight:"normal",fontWeight:"normal",fontFamily:e.style.contextMenuFontFamily,fontSize:e.style.contextMenuFontSize,color:"inherit",background:"inherit",margin:e.style.contextMenuItemMargin,borderRadius:e.style.contextMenuItemBorderRadius,verticalAlign:"middle"},"canvas-datagrid-context-menu-item":{lineHeight:"normal",fontWeight:"normal",fontFamily:e.style.contextMenuFontFamily,fontSize:e.style.contextMenuFontSize,color:"inherit",background:"inherit",margin:e.style.contextMenuItemMargin,borderRadius:e.style.contextMenuItemBorderRadius,verticalAlign:"middle"},"canvas-datagrid-context-menu-item:hover":{background:e.style.contextMenuHoverBackground,color:e.style.contextMenuHoverColor},"canvas-datagrid-context-menu-label":{margin:e.style.contextMenuLabelMargin,display:e.style.contextMenuLabelDisplay,minWidth:e.style.contextMenuLabelMinWidth,maxWidth:e.style.contextMenuLabelMaxWidth},"canvas-datagrid-context-menu-mobile":{lineHeight:"normal",fontWeight:"normal",fontFamily:e.style.contextMenuFontFamily,fontSize:e.style.contextMenuFontSize,background:e.style.contextMenuBackground,color:e.style.contextMenuColor,border:e.style.contextMenuBorder,padding:e.style.contextMenuPadding,borderRadius:e.style.contextMenuBorderRadius,opacity:e.style.contextMenuOpacity,overflow:"hidden",whiteSpace:"nowrap"},"canvas-datagrid-context-menu":{lineHeight:"normal",fontWeight:"normal",fontFamily:e.style.contextMenuFontFamily,fontSize:e.style.contextMenuFontSize,background:e.style.contextMenuBackground,color:e.style.contextMenuColor,border:e.style.contextMenuBorder,padding:e.style.contextMenuPadding,borderRadius:e.style.contextMenuBorderRadius,opacity:e.style.contextMenuOpacity,overflow:"hidden",whiteSpace:"nowrap",cursor:e.style.contextMenuCursor},"canvas-datagrid-invalid-search-regExp":{background:e.style.contextMenuFilterInvalidExpresion}};r[o]&&(Object.keys(r[o]).map((function(e){t.style[e]=r[o][e]})),t.className=o)},e.appendTo=function(t){e.parentNode=t,e.setDom()},e.setDom=function(){e.isChildGrid?(e.parentGrid=e.parentNode.parentGrid,e.ctx=e.parentGrid.context,e.canvas=e.parentGrid.canvas,e.controlInput=e.parentGrid.controlInput,e.eventParent=e.canvas):(e.controlInput=e.controlInput||document.createElement("input"),e.controlInput.onblur=e.intf.blur,e.createInlineStyle(e.controlInput,"canvas-datagrid-control-input"),e.isChildGrid=!1,e.parentDOMNode=e.parentNode,e.parentIsCanvas=/^canvas$/i.test(e.parentDOMNode.tagName),e.parentIsCanvas?e.canvas=e.parentDOMNode:(e.canvas=document.createElement("canvas"),e.parentDOMNode.appendChild(e.canvas)),document.body.appendChild(e.controlInput),e.createInlineStyle(e.canvas,"canvas-datagrid"),e.ctx=e.canvas.getContext("2d"),e.ctx.textBaseline="alphabetic",e.eventParent=e.canvas),e.parentNodeStyle=e.canvas.style,e.controlInput.setAttribute("readonly",!0),e.controlInput.addEventListener("blur",(function(t){t.target!==e.canvas&&(e.hasFocus=!1)})),e.eventParent.addEventListener("scroll",e.resize,!1),e.eventParent.addEventListener("touchstart",e.touchstart,!1),e.eventParent.addEventListener("mousedown",e.mousedown,!1),e.eventParent.addEventListener("dblclick",e.dblclick,!1),e.eventParent.addEventListener("click",e.click,!1),e.eventParent.addEventListener("mouseup",e.mouseup,!1),window.addEventListener("mousemove",e.mousemove),e[e.isChildGrid?"parentGrid":"eventParent"].addEventListener("wheel",e.scrollWheel,!1),e.canvas.addEventListener("contextmenu",e.contextmenuEvent,!1),e.controlInput.addEventListener("copy",e.copy),e.controlInput.addEventListener("cut",e.cut),e.controlInput.addEventListener("paste",e.paste),e.controlInput.addEventListener("keypress",e.keypress,!1),e.controlInput.addEventListener("keyup",e.keyup,!1),e.controlInput.addEventListener("keydown",e.keydown,!1),window.addEventListener("resize",e.resize)}}var mergeHiddenRowRanges=function(e,t){var o=this,r=_slicedToArray(t,2),n=r[0],l=r[1];if(l<n)return!1;for(var i=!1,a=0;a<e.length;a++){var s=e[a];if(!(n>s[1]+1)){if(n<=s[0]&&l>=s[0]){e[a]=[n,Math.max(l,s[1])],i=!0;break}if(n>=s[0]){e[a]=[s[0],Math.max(l,s[1])],i=!0;break}}}i||e.push([n,l]),e.sort(function(e,t){return _newArrowCheck(this,o),e[0]-t[0]}.bind(this));for(var c=0;c<e.length-1;c++){var d=e[c],u=e[c+1];u[0]<=d[1]+1&&(e[c]=[d[0],Math.max(d[1],u[1])],e.splice(c+1,1),c--)}return!0};function publicMethods(e){function t(t,o,r){for(var n=!1,l="rows"===t?e.groupedRows:e.groupedColumns,i=l.length-1;i>=0;i--){var a=l[i],s=a[0].from,c=a[a.length-1].to;if(o<=s&&r>=c){if(o===s&&r===c&&1===a.length)return}else{for(var d=0;d<a.length;d++){var u=a[d];if(!(o>u.to)){if(o>=u.from){if(r>u.to){if(o===u.from)return l.splice(i,0,[{from:o,to:r,collapsed:!1}]),void e.refresh();throw new Error("Can't group these ".concat(t))}if(r===u.to&&o===u.from)return;n=!0;break}if(r>=u.from){if(r<u.to)throw new Error("Can't group these ".concat(t));l.splice(i,0,[{from:o,to:r,collapsed:!1}])}else a.splice(d,0,{from:o,to:r,collapsed:!1});return void e.refresh()}}if(!n)return a.push({from:o,to:r,collapsed:!1}),void e.refresh()}}n?l.push([{from:o,to:r,collapsed:!1}]):l.unshift([{from:o,to:r,collapsed:!1}]),e.refresh()}function o(t,o,r){for(var n=0;n<t.length;n++)for(var l=t[n],i=0;i<l.length;i++){var a=l[i];if(a.from===o&&a.to===r)return l.length<=1?t.splice(n,1):l.splice(i,1),void e.refresh()}}e.integerToAlpha=function(e){for(var t="a".charCodeAt(0),o="z".charCodeAt(0)-t+1,r="";e>=0;)r=String.fromCharCode(e%o+t)+r,e=Math.floor(e/o)-1;return r},e.insertColumn=function(t,o){var r=e.getSchema();if(r.length<o)throw new Error("Index is beyond the length of the schema.");e.validateColumn(t,r),r.splice(o,0,t),e.originalData.forEach((function(o,r){e.applyDefaultValue(o,t,r)})),e.intf.schema=r,e.refresh()},e.deleteColumn=function(t){var o=e.getSchema();e.originalData.forEach((function(e){delete e[o[t].name]})),o.splice(t,1),e.intf.schema=o,e.refresh()},e.addColumn=function(t){var o=e.getSchema();e.validateColumn(t,o),o.push(t),e.originalData.forEach((function(o,r){e.applyDefaultValue(o,t,r)})),e.intf.schema=o,e.refresh()},e.deleteRow=function(t){e.originalData.splice(t,1),e.setFilter(),e.resize(!0)},e.insertRow=function(t,o){if(e.originalData.length<o)throw new Error("Index is beyond the length of the dataset.");e.originalData.splice(o,0,t),e.getSchema().forEach((function(r){void 0===t[r.name]&&e.applyDefaultValue(e.originalData[o],r,o)})),e.setFilter(),e.resize(!0)},e.addRow=function(t){e.originalData.push(t),e.getSchema().forEach((function(o){void 0===t[o.name]&&e.applyDefaultValue(e.originalData[e.originalData.length-1],o,e.originalData.length-1)})),e.setFilter(),e.resize(!0)},e.setRowHeight=function(t,o){e.sizes.rows[t]=o,e.draw(!0)},e.setColumnWidth=function(t,o){e.sizes.columns[t]=o,e.draw(!0)},e.resetColumnWidths=function(){e.sizes.columns={},e.draw(!0)},e.resetRowHeights=function(){e.sizes.rows={},e.draw(!0)},e.setFilter=function(t,o){void 0===t&&void 0===o?e.columnFilters={}:!t||""!==o&&void 0!==o?(e.columnFilters[t]=o,e.attributes.showFilterInCell&&(e.filterable.rows.push(0),e.orders.columns.forEach((function(t,o){e.filterable.columns.push(o)})))):delete e.columnFilters[t],Object.keys(e.columnFilters).length||(e.filterable={rows:[],columns:[]}),e.refresh()},e.findRowScrollTop=function(t){if(void 0===e.scrollCache.y[t])throw new RangeError("Row index ".concat(t," out of range: ").concat(e.scrollCache.y.length,"."));return e.scrollCache.y[t]},e.findColumnScrollLeft=function(t){var o=Math.max(t-1,0);if(void 0===e.scrollCache.x[o])throw new Error("Column index out of range.");return e.scrollCache.x[o]-e.getColumnWidth(e.orders.columns[t])},e.gotoCell=function(t,o,r,n){var l,i=void 0===t?void 0:e.findColumnScrollLeft(t),a=void 0===o?void 0:e.findRowScrollTop(o),s=e.scrollBox.width-(e.scrollBox.verticalBarVisible?e.style.scrollBarWidth:0),c=e.scrollBox.height-(e.scrollBox.horizontalBarVisible?e.style.scrollBarWidth:0);i-=s*(r=void 0===r?0:r),a-=c*(n=void 0===n?0:n),void 0!==t&&void 0!==o?(e.scrollBox.scrollTo(i,a),requestAnimationFrame((function(){(l=e.getVisibleCellByIndex(t,o))&&(i+=l.width*r,a+=l.height*n,e.scrollBox.scrollTo(i,a))}))):void 0!==t?e.scrollBox.scrollLeft=i:void 0!==o&&(e.scrollBox.scrollTop=a)},e.gotoRow=function(t){e.gotoCell(0,t)},e.addButton=function(t,o,r,n,l){var i=e.visibleCells.filter((function(e){return e.sortColumnIndex===t&&e.sortRowIndex===o}));e.attachButton({top:i[0].y+i[0].height+r.y,left:i[0].x+i[0].width+r.x},n,l)},e.toggleCellCollapseTree=function(t){for(var o in t){var r,n=_createForOfIteratorHelper(t[o]);try{for(n.s();!(r=n.n()).done;){var l=r.value;l.length>0&&e.toggleCollapseTree(l[0],l[1],o)}}catch(e){n.e(e)}finally{n.f()}}e.draw()},e.expandCollapseCellTree=function(t){for(var o in t){var r,n=_createForOfIteratorHelper(t[o]);try{for(n.s();!(r=n.n()).done;){var l=r.value;l.length>0&&e.cellTreeExpandCollapse(l[0],l[1],o)}}catch(e){n.e(e)}finally{n.f()}}e.draw()},e.scrollIntoView=function(t,o,r,n){var l=e.visibleCells.filter((function(r){return(r.rowIndex===o||void 0===o)&&(r.columnIndex===t||void 0===t)&&r.x>0&&r.y>0&&r.x+r.width<e.width&&r.y+r.height<e.height}));1===l.length&&void 0!==t&&void 0!==o&&(l[0].x<e.getRowHeaderCellWidth()||l[0].y<e.getColumnHeaderCellHeight())&&(l.length=0),0===l.length&&e.gotoCell(t,o,r,n)},e.setActiveCell=function(t,o){void 0!==t&&(t<0&&(t=0),o<0&&(o=0),e.activeCell={rowIndex:o,columnIndex:t})},e.collapseTree=function(t){e.dispatchEvent("collapsetree",{childGrid:e.childGrids[t],data:e.viewData[t],rowIndex:t}),e.openChildren[t].blur(),e.openChildren[t].dispose(),delete e.openChildren[t],delete e.sizes.trees[t],delete e.childGrids[t],e.dispatchEvent("resizerow",{cellHeight:e.style.cellHeight}),e.resize(!0),e.draw(!0)},e.expandTree=function(t){var o,r=e.args.treeGridAttributes||{},n=e.getColumnHeaderCellHeight(),l=e.sizes.columns.cornerCell||e.style.rowHeaderCellWidth,i=e.sizes.trees[t]||e.style.treeGridHeight;e.childGrids[t]||(r.debug=e.attributes.debug,r.name=e.attributes.saveAppearance?e.attributes.name+"tree"+t:void 0,r.style=r.style||e.style,r.parentNode={parentGrid:e.intf,nodeType:"canvas-datagrid-tree",offsetHeight:i,offsetWidth:e.width-l,header:{width:e.width-l},offsetLeft:l,offsetTop:n,offsetParent:e.intf.parentNode,parentNode:e.intf.parentNode,style:"tree",data:e.viewData[t]},o=e.createGrid(r),e.childGrids[t]=o),(o=e.childGrids[t]).visible=!0,e.dispatchEvent("expandtree",{treeGrid:o,data:e.viewData[t],rowIndex:t}),e.openChildren[t]=o,e.sizes.trees[t]=i,e.dispatchEvent("resizerow",{height:e.style.cellHeight}),e.resize(!0)},e.toggleTree=function(t){if(e.openChildren[t])return e.collapseTree(t);e.expandTree(t)},e.getHeaderByName=function(t){var o,r=e.getSchema();for(o=0;o<r.length;o+=1)if(r[o].name===t)return r[o]},e.hideColumns=function(t,o){var r=e.getSchema(),n=e.orders.columns,l=[];"number"!=typeof o&&(o=t);for(var i=t;i<=o;i++){var a=n[i];a>=0&&!r[a].hidden&&(l.push(a),r[a].hidden=!0,e.dispatchEvent("columnhide",{columnIndex:a}))}l.length>0&&(e.setStorageData(),setTimeout((function(){e.resize(!0)}),10)),e.dispatchEvent("hidecolumns",{hiddenColumns:l})},e.unhideColumns=function(t,o){for(var r=e.orders.columns,n=e.getSchema(),l=t;l<=o;l++){var i=r[l],a=n[i];a&&a.hidden&&(a.hidden=!1,e.dispatchEvent("columnunhide",{columnIndex:i}))}e.refresh()},e.hideRows=function(t,o){mergeHiddenRowRanges(e.hiddenRowRanges,[t,o])&&e.refresh()},e.unhideRows=function(t,o){var r=this;e.hiddenRowRanges=e.hiddenRowRanges.filter(function(e){return _newArrowCheck(this,r),e[0]!==t||e[1]!==o}.bind(this)),e.refresh()},e.fitColumnToValues=function(t,o){if(e.canvas){var r="cornerCell"===t?-1:e.getHeaderByName(t).index,n=Math.max(e.findColumnMaxTextLength(t),e.style.minColumnWidth);e.sizes.columns[r]=n,e.dispatchEvent("resizecolumn",{x:n,y:e.resizingStartingHeight,draggingItem:e.currentCell}),o||(e.resize(),e.draw(!0))}},e.isCellVisible=function(t,o){if(void 0!==o)return e.visibleCells.filter((function(e){return e.columnIndex===t&&e.rowIndex===o})).length>0;var r,n=e.visibleCells.length;for(r=0;r<n;r+=1)if(t.x===e.visibleCells[r].x&&t.y===e.visibleCells[r].y)return!0;return!1},e.order=function(t,o,r,n){if(e.attributes.allowSorting){var l,i=e.getSchema().filter((function(e){return e.name===t}));if(!e.dispatchEvent("beforesortcolumn",{name:t,direction:o})&&(e.orderBy=t,e.orderDirection=o,e.viewData&&0!==e.viewData.length)){if(0===i.length)throw new Error("Cannot sort. No such column name");(l=r||i[0].sorter||e.sorters[i[0].type])||void 0===i[0].type||console.warn('Cannot sort type "%s" falling back to string sort.',i[0].type),e.orderings.add(t,o,"function"==typeof l?l:e.sorters.string),e.refresh(),e.dispatchEvent("sortcolumn",{name:t,direction:o}),n||e.setStorageData()}}else e.refresh()},e.groupColumns=function(o,r){for(var n,l,i=e.getSchema(),a=0;a<i.length;a++){var s=i[a];if(n&&l)break;s.name!==o?s.name!==r||(l=s):n=s}if(!n)throw new Error("No such column name for first column");if(!l)throw new Error("No such column name for last column");if(l.columnIndex>n.columnIndex!=!0)throw new Error("Can't group these columns");var c=n.columnIndex,d=l.columnIndex,u={group:{type:"columns",from:c,to:d}};try{t("columns",c,d)}catch(e){u.error=e}e.dispatchEvent("aftercreategroup",u)},e.groupRows=function(o,r){if(!Number.isInteger(o)||o<0)throw new Error("No such row for the beginning of the group");var n=e.viewData.length;if(!Number.isInteger(o)||r<=o||r>=n)throw new Error("No such row for the end of the group");var l={group:{type:"rows",from:o,to:r}};try{t("rows",o,r)}catch(e){l.error=e}e.dispatchEvent("aftercreategroup",l)},e.removeGroupColumns=function(t,r){for(var n,l,i=e.getSchema(),a=0;a<i.length;a++){var s=i[a];if(n&&l)break;s.name!==t?s.name!==r||(l=s):n=s}if(!n)throw new Error("No such column name for first column");if(!l)throw new Error("No such column name for last column");var c=n.columnIndex,d=l.columnIndex;o(e.groupedColumns,c,d)},e.removeGroupRows=function(t,r){o(e.groupedRows,t,r)},e.toggleGroupColumns=function(t,o){for(var r,n,l=e.getSchema(),i=0;i<l.length;i++){var a=l[i];if(r&&n)break;a.name!==t?a.name!==o||(n=a):r=a}if(r&&n){var s=r.columnIndex,c=n.columnIndex;e.toggleGroup({type:"c",from:s,to:c})&&(e.disposeContextMenu(),e.setStorageData(),e.refresh())}},e.toggleGroupRows=function(t,o){e.toggleGroup({type:"r",from:t,to:o})&&(e.disposeContextMenu(),e.setStorageData(),e.refresh())},e.isInGrid=function(t){return!(t.x<0||t.x>e.width||t.y<0||t.y>e.height)},e.moveTo=function(t,o,r){t=e.getObsoleteSelectionMatrix(t);var n,l=e.getSelectedData(),i=e.getVisibleSchema(),a=t.length,s=-1/0,c=1/0,d=r-1;t.forEach((function(t,r){r!==a&&0!==t.length&&(c=Math.min(e.getVisibleColumnIndexOf(o),c),s=Math.max(s,t.length),t.forEach((function(t){t=e.getVisibleColumnIndexOf(t),i[t]&&(e.data||(e.data={}),e.data[r]||(e.data[r]={}),e.data[r][i[t].name]=null)})))})),t.forEach((function(t,r){var a;d+=1,n=e.getVisibleColumnIndexOf(o),t.forEach((function(t,o){t=e.getVisibleColumnIndexOf(t),o>0&&(n+=t-a),a=t,-1===t||!i[n]||!i[t]||e.data.length-1<d||d<0||(e.data[d]||(e.data[d]={}),e.data[d][i[n].name]=l[r][i[t].name])}))}))},e.getGroupsColumnBelongsTo=function(t){if(!e.attributes.allowGroupingColumns)return[];for(var o=[],r=0;r<e.groupedColumns.length;r++)for(var n=e.groupedColumns[r],l=0;l<n.length;l++){var i=n[l];if(t>=i.from&&t<=i.to){o.push(i);break}}return o},e.getGroupsRowBelongsTo=function(t){if(!e.attributes.allowGroupingRows)return[];for(var o=[],r=0;r<e.groupedRows.length;r++)for(var n=e.groupedRows[r],l=0;l<n.length;l++){var i=n[l];if(t>=i.from&&t<=i.to){o.push(i);break}}return o},e.isColumnVisible=function(t){return e.visibleCells.filter((function(e){return e.columnIndex===t})).length>0},e.isRowVisible=function(t){return e.visibleCells.filter((function(e){return e.rowIndex===t})).length>0},e.getVisibleCellByIndex=function(t,o){return e.visibleCells.filter((function(e){return e.columnIndex===t&&e.rowIndex===o}))[0]},e.getUnhideIndicator=function(t,o){var r=e.visibleUnhideIndicators;if(!(r.length<=0))for(var n=0;n<r.length;n++){var l=r[n];if(t>=l.x&&o>=l.y&&t<=l.x2&&o<=l.y2)return l}},e.getColumnGroupAt=function(t,o){if(!(e.groupedColumns.length<=0)&&!(o>=e.getColumnGroupAreaHeight()))for(var r=0;r<e.visibleGroups.length;r++){var n=e.visibleGroups[r];if("c"===n.type&&(t>=n.x&&o>=n.y&&t<=n.x2&&o<=n.y2))return n}},e.getRowGroupAt=function(t,o){if(!(e.groupedRows.length<=0)&&!(t>=e.getRowGroupAreaWidth()))for(var r=0;r<e.visibleGroups.length;r++){var n=e.visibleGroups[r];if("r"===n.type&&(t>=n.x&&o>=n.y&&t<=n.x2&&o<=n.y2))return n}},e.getCellAt=function(t,o,r){function n(r){return r.x+r.width-.4*e.attributes.borderResizeZone<t&&r.x+r.width+.6*e.attributes.borderResizeZone>t?"r":r.x-.4*e.attributes.borderResizeZone<t&&r.x+.6*e.attributes.borderResizeZone>t?"l":r.y+r.height-.4*e.attributes.borderResizeZone<o&&r.y+r.height+.6*e.attributes.borderResizeZone>o?"b":r.y-.4*e.attributes.borderResizeZone<o&&r.y+.6*e.attributes.borderResizeZone>o?"t":void 0}if(e.visibleCells){t-=e.getRowGroupAreaWidth(),o-=e.getColumnGroupAreaHeight(),void 0!==e.dragStartObject&&(t<=0&&(t=1),t>=e.width&&(t=e.width-1),o<=0&&(o=1),o>=e.height&&(o=e.height-1));var l,i,a,s,c,d=r?e.attributes.touchScrollZone:0,u="move"===e.attributes.borderDragBehavior,h=e.visibleCells.length,f=u?e.cursorGrab:"ew-resize",g=u?e.cursorGrab:"ns-resize";if(e.visibleCells&&e.visibleCells.length){if(e.hasFocus=!0,!(o<e.height&&o>0&&t<e.width&&t>0))return e.hasFocus=!1,{dragContext:"inherit",context:"inherit"};for(i=0;i<h;i+=1)if(c={x:(s=e.visibleCells[i]).x,y:s.y,height:s.height,width:s.width},r&&/(vertical|horizontal)-scroll-/.test(s.style)&&(c.x-=d,c.y-=d,c.height+=d,c.width+=d),c.x-e.style.cellBorderWidth<t&&c.x+c.width+e.style.cellBorderWidth>t&&c.y-e.style.cellBorderWidth<o&&c.y+c.height+e.style.cellBorderWidth>o){if(/frozen-row-marker/.test(s.style)){if("frozen-column-marker"===e.dragMode)continue;return s.dragContext=s.style,s.context="grab",s}if(/frozen-column-marker/.test(s.style)){if("frozen-row-marker"===e.dragMode)continue;return s.dragContext=s.style,s.context="grab",s}if(/selection-handle-/.test(s.style))return s.dragContext=s.style,s.context="crosshair",s;if(/vertical-scroll-(bar|box)/.test(s.style))return s.dragContext="vertical-scroll-box",s.context="vertical-scroll-box",s.isScrollBar=!0,s.isVerticalScrollBar=!0,o>e.scrollBox.box.v.y+e.scrollBox.scrollBoxHeight?(s.dragContext="vertical-scroll-bottom",s.context="vertical-scroll-bottom"):o<e.scrollBox.box.v.y&&(s.dragContext="vertical-scroll-top",s.context="vertical-scroll-top"),e.cursor="default",s;if(/horizontal-scroll-(bar|box)/.test(s.style))return s.dragContext="horizontal-scroll-box",s.context="horizontal-scroll-box",s.isScrollBar=!0,s.isHorizontalScrollBar=!0,t>e.scrollBox.box.h.x+e.scrollBox.scrollBoxWidth?(s.dragContext="horizontal-scroll-right",s.context="horizontal-scroll-right"):t<e.scrollBox.box.h.x&&(s.dragContext="horizontal-scroll-left",s.context="horizontal-scroll-left"),e.cursor="default",s;if(l=n(c),a=u&&s.selectionBorder&&-1!==s.selectionBorder.indexOf(l),-1!==["l","r"].indexOf(l)&&(e.attributes.allowColumnResize||a)&&(e.attributes.allowColumnResizeFromCell&&s.isNormal||!s.isNormal||a)&&(e.attributes.allowRowHeaderResize&&(s.isRowHeader||s.isCorner)||!s.isRowHeader||!s.isCorner)){if((s.isColumnHeader||s.isCorner||e.attributes.allowColumnResizeFromCell&&s.isNormal)&&"r"===l)return s.context="ew-resize",s.dragContext="ew-resize",s;if(!s.isColumnHeader&&!s.isCorner&&a)return s.context=f,s.dragContext=l+"-move",s}if(-1!==["t","b"].indexOf(l)&&s.rowIndex>-1&&(e.attributes.allowRowResize||a)&&(e.attributes.allowRowResizeFromCell&&s.isNormal||!s.isNormal||a)&&!s.isColumnHeader){if((s.isRowHeader||s.isCorner||e.attributes.allowRowResizeFromCell&&s.isNormal)&&"b"===l)return s.context="ns-resize",s.dragContext="ns-resize",s;if(!s.isRowHeader&&!s.isCorner&&a)return s.context=g,s.dragContext=l+"-move",s}return"columnHeaderCell"===s.style?(!e.isColumnSelected(s.columnIndex)&&s.x+s.width-e.attributes.columnGrabZoneSize-e.style.cellBorderWidth>t||!e.attributes.allowRowReordering?(s.dragContext="cell",s.context="cell"):(s.context=e.cursorGrab,s.dragContext="column-reorder"),s):"rowHeaderCell"===s.style?(!e.isRowSelected(s.rowIndex)&&e.attributes.rowGrabZoneSize+(s.y-e.style.cellBorderWidth)<o||!e.attributes.allowRowReordering?(s.dragContext="cell",s.context="cell"):(s.context=e.cursorGrab,s.dragContext="row-reorder"),s):s.isGrid?(e.hasFocus=!1,s.dragContext="cell-grid",s.context="cell-grid",s):"tree-grid"===s.style?(e.hasFocus=!1,s.dragContext="tree",s.context="tree",s):(s.dragContext="cell",s.context="cell",s)}return e.hasFocus=!0,e.cursor="default",{dragContext:"background",context:"background",style:"background",isBackground:!0}}}},e.getSchemaFromData=function(t){return t=t||e.originalData,Object.keys(t[0]||{" ":""}).map((function(o,r){var n=e.getBestGuessDataType(o,t),l={name:o,title:isNaN(parseInt(o,10))?o:e.integerToAlpha(o).toUpperCase(),index:r,columnIndex:r,type:n,filter:e.filter(n)};return e.storedSettings&&e.storedSettings.visibility&&void 0!==e.storedSettings.visibility[l.name]&&(l.hidden=!e.storedSettings.visibility[l.name]),l}))},e.clearChangeLog=function(){e.changes=[]},e.findColumnMaxTextLength=function(t){var o=-1/0;if("cornerCell"===t)return e.ctx.font=e.style.rowHeaderCellFont,e.ctx.measureText((e.viewData.length+(e.attributes.showNewRow?1:0)).toString()).width+e.style.autosizePadding+e.style.autosizeHeaderCellPadding+e.style.rowHeaderCellPaddingRight+e.style.rowHeaderCellPaddingLeft+(e.attributes.tree?e.style.treeArrowWidth+e.style.treeArrowMarginLeft+e.style.treeArrowMarginRight:0);var r=null;return e.getSchema().forEach((function(n){if(n.name===t){e.ctx.font=e.style.columnHeaderCellFont;var l=e.ctx.measureText(n.title||n.name).width+e.style.columnHeaderCellPaddingRight+e.style.columnHeaderCellPaddingLeft+e.style.cellAutoResizePadding;o=l>o?l:o,r=e.formatters[n.type]}})),e.viewData.forEach((function(n){var l=n[t];r&&(l=r({cell:{value:l}})),e.ctx.font=e.style.cellFont;var i=e.ctx.measureText(l).width+e.style.cellPaddingRight+e.style.cellPaddingLeft+e.style.cellAutoResizePadding;o=i>o?i:o})),o},e.getHeaderWidth=function(){return e.getVisibleSchema().reduce((function(t,o){return t+parseInt(o.width||e.style.cellWidth,10)}),0)},e.getRowHeight=function(t){return(e.sizes.rows[t]||e.style.cellHeight)*e.scale},e.getColumnWidth=function(t){return(e.sizes.columns[t]||e.getSchema()[t].width||e.style.cellWidth)*e.scale},e.formatters.string=function(e){return void 0!==e.cell.value?e.cell.value:""},e.formatters.rowHeaderCell=e.formatters.string,e.formatters.headerCell=e.formatters.string,e.formatters.number=e.formatters.string,e.formatters.int=e.formatters.string,e.formatters.html=e.formatters.string,e.sorters.string=function(e,t){var o="asc"===t;return function(t,r){var n=t[e]||"",l=r[e]||"";return o?n.localeCompare?n.localeCompare(l):1:l.localeCompare?l.localeCompare(n):1}},e.sorters.number=function(e,t){var o="asc"===t;return function(t,r){return o?t[e]-r[e]:r[e]-t[e]}},e.sorters.date=function(e,t){var o="asc"===t;return function(t,r){return o?new Date(t[e]).getTime()-new Date(r[e]).getTime():new Date(r[e]).getTime()-new Date(t[e]).getTime()}}}var webComponent=component(),modules=[defaults,draw,events,touch,intf,selections,contextMenu,button,dom,publicMethods];function Grid(args){args=args||{};var self={};return self.isComponent=void 0===args.component,self.isChildGrid=args.parentNode&&/canvas-datagrid-(cell|tree)/.test(args.parentNode.nodeType),self.isChildGrid?self.intf={}:self.intf=self.isComponent?eval("Reflect.construct(HTMLElement, [], new.target)"):document.createElement("canvas"),self.args=args,self.intf.args=args,self.applyComponentStyle=webComponent.applyComponentStyle,self.hyphenateProperty=webComponent.hyphenateProperty,self.dehyphenateProperty=webComponent.dehyphenateProperty,self.createGrid=function(e){return e.component=!1,new Grid(e)},modules.forEach((function(e){e(self)})),self.isChildGrid?(self.shadowRoot=args.parentNode.shadowRoot,self.parentNode=args.parentNode):(self.shadowRoot=self.intf.attachShadow({mode:"open"}),self.parentNode=self.shadowRoot),self.init(),self.intf}function canvasDatagrid(e){e=e||{};var t,o=["style","formatters","sorters","filters","treeGridAttributes","cellGridAttributes","fillCellCallback","data","schema"];return window.customElements?(t=document.createElement("canvas-datagrid"),Object.keys(e).forEach((function(r){"data"!==r&&"parentNode"!==r&&(-1===o.indexOf(r)?t.attributes[r]=e[r]:o.forEach((function(o){void 0!==e[o]&&o===r&&(-1!==["formatters","sorters","filters"].indexOf(r)?"object"===_typeof(e[o])&&null!==e[o]&&Object.keys(e[o]).forEach((function(r){t[o][r]=e[o][r]})):t[o]=e[o])})))})),e.data&&(t.data=e.data),e.parentNode&&e.parentNode.appendChild(t),t):(e.component=!1,t=new Grid(e),e.parentNode&&e.parentNode.appendChild&&e.parentNode.appendChild(t),t)}window.HTMLElement&&(Grid.prototype=Object.create(window.HTMLElement.prototype)),window.customElements&&(Grid.observedAttributes=webComponent.getObservableAttributes(),Grid.prototype.disconnectedCallback=webComponent.disconnectedCallback,Grid.prototype.attributeChangedCallback=webComponent.attributeChangedCallback,Grid.prototype.connectedCallback=webComponent.connectedCallback,Grid.prototype.adoptedCallback=webComponent.adoptedCallback,window.customElements.define("canvas-datagrid",Grid)),window&&!window.canvasDatagrid&&window.require;export default canvasDatagrid;
|
|
1
|
+
function _typeof(e){return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},_typeof(e)}function _defineProperty(e,t,o){return t in e?Object.defineProperty(e,t,{value:o,enumerable:!0,configurable:!0,writable:!0}):e[t]=o,e}function ownKeys(e,t){var o=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),o.push.apply(o,r)}return o}function _objectSpread2(e){for(var t=1;t<arguments.length;t++){var o=null!=arguments[t]?arguments[t]:{};t%2?ownKeys(Object(o),!0).forEach((function(t){_defineProperty(e,t,o[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(o)):ownKeys(Object(o)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(o,t))}))}return e}function _newArrowCheck(e,t){if(e!==t)throw new TypeError("Cannot instantiate an arrow function")}function _slicedToArray(e,t){return _arrayWithHoles(e)||_iterableToArrayLimit(e,t)||_unsupportedIterableToArray(e,t)||_nonIterableRest()}function _toConsumableArray(e){return _arrayWithoutHoles(e)||_iterableToArray(e)||_unsupportedIterableToArray(e)||_nonIterableSpread()}function _arrayWithoutHoles(e){if(Array.isArray(e))return _arrayLikeToArray(e)}function _arrayWithHoles(e){if(Array.isArray(e))return e}function _iterableToArray(e){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e))return Array.from(e)}function _iterableToArrayLimit(e,t){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e)){var o=[],r=!0,n=!1,l=void 0;try{for(var i,a=e[Symbol.iterator]();!(r=(i=a.next()).done)&&(o.push(i.value),!t||o.length!==t);r=!0);}catch(e){n=!0,l=e}finally{try{r||null==a.return||a.return()}finally{if(n)throw l}}return o}}function _unsupportedIterableToArray(e,t){if(e){if("string"==typeof e)return _arrayLikeToArray(e,t);var o=Object.prototype.toString.call(e).slice(8,-1);return"Object"===o&&e.constructor&&(o=e.constructor.name),"Map"===o||"Set"===o?Array.from(e):"Arguments"===o||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(o)?_arrayLikeToArray(e,t):void 0}}function _arrayLikeToArray(e,t){(null==t||t>e.length)&&(t=e.length);for(var o=0,r=new Array(t);o<t;o++)r[o]=e[o];return r}function _nonIterableSpread(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _nonIterableRest(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _createForOfIteratorHelper(e,t){var o;if("undefined"==typeof Symbol||null==e[Symbol.iterator]){if(Array.isArray(e)||(o=_unsupportedIterableToArray(e))||t&&e&&"number"==typeof e.length){o&&(e=o);var r=0,n=function(){};return{s:n,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:n}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var l,i=!0,a=!1;return{s:function(){o=e[Symbol.iterator]()},n:function(){var e=o.next();return i=e.done,e},e:function(e){a=!0,l=e},f:function(){try{i||null==o.return||o.return()}finally{if(a)throw l}}}}function defaults(e){e.defaults={attributes:[["allowColumnReordering",!0],["allowColumnResize",!0],["allowColumnResizeFromCell",!1],["allowFreezingRows",!1],["allowFreezingColumns",!1],["allowMovingSelection",!0],["allowRowHeaderResize",!0],["allowRowReordering",!1],["allowRowResize",!0],["allowRowResizeFromCell",!1],["allowSorting",!0],["allowGroupingRows",!0],["allowGroupingColumns",!0],["animationDurationShowContextMenu",50],["animationDurationHideContextMenu",50],["autoGenerateSchema",!1],["autoResizeColumns",!1],["autoResizeRows",!1],["autoScrollOnMousemove",!1],["autoScrollMargin",5],["allowShrinkingSelection",!1],["blanksText","(Blanks)"],["borderDragBehavior","none"],["borderResizeZone",10],["clearCellsWhenShrinkingSelection",!1],["clearSettingsOptionText","Clear saved settings"],["columnHeaderClickBehavior","sort"],["columnSelectorHiddenText"," "],["columnSelectorText","Add/Remove columns"],["columnSelectorVisibleText","✓"],["contextHoverScrollAmount",2],["contextHoverScrollRateMs",5],["copyHeadersOnSelectAll",!0],["copyText","Copy"],["debug",!1],["editable",!0],["ellipsisText","..."],["filterOptionText","Filter %s"],["filterTextPrefix","(filtered) "],["filterFrozenRows",!0],["globalRowResize",!1],["hideColumnText","Hide %s"],["showUnhideColumnsIndicator",!1],["showUnhideRowsIndicator",!1],["showHideRow","Hide row %s"],["showHideRows","Hide rows %s"],["hoverMode","cell"],["keepFocusOnMouseOut",!1],["maxAutoCompleteItems",200],["multiLine",!1],["name",""],["pageUpDownOverlap",1],["pasteText","Paste"],["persistantSelectionMode",!1],["removeFilterOptionText","Remove filter on %s"],["reorderDeadZone",3],["resizeAfterDragged",!1],["resizeScrollZone",20],["rowGrabZoneSize",5],["columnGrabZoneSize",30],["saveAppearance",!0],["scrollAnimationPPSThreshold",.75],["scrollPointerLock",!1],["scrollRepeatRate",75],["selectionFollowsActiveCell",!1],["selectionHandleBehavior","none"],["selectionMode","cell"],["selectionScrollIncrement",20],["selectionScrollZone",20],["showClearSettingsOption",!0],["showColumnHeaders",!0],["showColumnSelector",!0],["showCopy",!1],["showFilter",!0],["showFilterInCell",!1],["showNewRow",!1],["showOrderByOption",!0],["showOrderByOptionTextAsc","Order by %s ascending"],["showOrderByOptionTextDesc","Order by %s descending"],["showGroupColumns","Group columns %s"],["showGroupRows","Group rows %s"],["showRemoveGroupColumns","Remove group %s"],["showRemoveGroupRows","Remove group %s"],["showRemoveAllGroupColumns","Remove all column groups"],["showRemoveAllGroupRows","Remove all row groups"],["showExpandAllGroupColumns","Expand all column groups"],["showExpandAllGroupRows","Expand all row groups"],["showCollapseAllGroupColumns","Collapse all column groups"],["showCollapseAllGroupRows","Collapse all row groups"],["columnGroupIndicatorPosition","right"],["rowGroupIndicatorPosition","bottom"],["showPaste",!1],["showPerformance",!1],["showRowHeaders",!0],["showRowNumbers",!0],["showRowNumberGaps",!0],["singleSelectionMode",!1],["snapToRow",!1],["sortFrozenRows",!0],["touchContextMenuTimeMs",800],["touchDeadZone",3],["touchEasingMethod","easeOutQuad"],["touchReleaseAcceleration",1e3],["touchReleaseAnimationDurationMs",2e3],["touchScrollZone",20],["touchSelectHandleZone",20],["touchZoomSensitivity",.005],["touchZoomMin",.5],["touchZoomMax",1.75],["maxPixelRatio",2],["tree",!1],["treeHorizontalScroll",!1],["rowTree",[]],["rowTreeColIndex",0],["columnTree",[]],["columnTreeRowStartIndex",0],["columnTreeRowEndIndex",0]],styles:[["activeCellBackgroundColor","rgba(255, 255, 255, 1)"],["activeCellBorderColor","rgba(110, 168, 255, 1)"],["activeCellBorderWidth",1],["activeCellColor","rgba(0, 0, 0, 1)"],["activeCellFont","16px sans-serif"],["activeCellHoverBackgroundColor","rgba(255, 255, 255, 1)"],["activeCellHorizontalAlignment","left"],["activeCellHoverColor","rgba(0, 0, 0, 1)"],["activeCellOverlayBorderColor","rgba(66, 133, 244, 1)"],["activeCellOverlayBorderWidth",1],["activeCellPaddingBottom",5],["activeCellPaddingLeft",5],["activeCellPaddingRight",5],["activeCellPaddingTop",5],["activeCellSelectedBackgroundColor","rgba(236, 243, 255, 1)"],["activeCellSelectedColor","rgba(0, 0, 0, 1)"],["activeCellVerticalAlignment","center"],["activeColumnHeaderCellBackgroundColor","rgba(225, 225, 225, 1)"],["activeColumnHeaderCellColor","rgba(0, 0, 0, 1)"],["activeRowHeaderCellBackgroundColor","rgba(225, 225, 225, 1)"],["activeRowHeaderCellColor","rgba(0, 0, 0, 1)"],["autocompleteBottomMargin",60],["autosizeHeaderCellPadding",8],["autosizePadding",5],["buttonActiveBackgroundColor","rgba(255, 255, 255, 1)"],["buttonActiveBorderColor","rgba(110, 168, 255, 1)"],["buttonArrowColor","rgba(50, 50, 50, 1)"],["buttonArrowDownHTML","▼"],["buttonZIndex",1e4],["buttonBackgroundColor","rgba(255, 255, 255, 1)"],["buttonBorderColor","rgba(172, 172, 172, 1)"],["buttonHoverBackgroundColor","rgba(240, 240, 240, 1)"],["buttonMenuWindowMargin",30],["buttonPadding","3px"],["cellAutoResizePadding",13],["cellBackgroundColor","rgba(255, 255, 255, 1)"],["cellBorderColor","rgba(195, 199, 202, 1)"],["cellBorderWidth",1],["cellColor","rgba(0, 0, 0, 1)"],["cellFont","16px sans-serif"],["cellGridHeight",250],["cellHeight",24],["cellHeightWithChildGrid",150],["cellHorizontalAlignment","left"],["cellHoverBackgroundColor","rgba(255, 255, 255, 1)"],["cellHoverColor","rgba(0, 0, 0, 1)"],["cellPaddingBottom",5],["cellPaddingLeft",5],["cellPaddingRight",5],["cellPaddingTop",5],["cellSelectedBackgroundColor","rgba(236, 243, 255, 1)"],["cellSelectedColor","rgba(0, 0, 0, 1)"],["cellTreeIconBorderColor","rgba(162, 174, 207, 1)"],["cellTreeIconFillColor","rgba(240, 240, 240, 1)"],["cellTreeIconHoverFillColor","rgba(198, 217, 233, 1)"],["cellTreeIconLineColor","rgba(43, 53, 81, 1)"],["cellTreeIconLineWidth",1.5],["cellTreeIconMarginLeft",0],["cellTreeIconMarginRight",5],["cellTreeIconMarginTop",6],["cellTreeIconWidth",13],["cellVerticalAlignment","center"],["cellWidth",250],["cellWidthWithChildGrid",250],["cellWhiteSpace","nowrap"],["cellLineHeight",1],["cellLineSpacing",3],["childContextMenuArrowColor","rgba(43, 48, 43, 1)"],["childContextMenuArrowHTML","►"],["childContextMenuMarginLeft",-11],["childContextMenuMarginTop",-6],["columnGroupRowHeight",25],["columnHeaderCellBackgroundColor","rgba(240, 240, 240, 1)"],["columnHeaderCellBorderColor","rgba(172, 172, 172, 1)"],["columnHeaderCellBorderWidth",1],["columnHeaderCellCapBackgroundColor","rgba(240, 240, 240, 1)"],["columnHeaderCellCapBorderColor","rgba(172, 172, 172, 1)"],["columnHeaderCellCapBorderWidth",1],["columnHeaderCellColor","rgba(50, 50, 50, 1)"],["columnHeaderCellFont","16px sans-serif"],["columnHeaderCellHeight",25],["columnHeaderCellHorizontalAlignment","left"],["columnHeaderCellHoverBackgroundColor","rgba(235, 235, 235, 1)"],["columnHeaderCellHoverColor","rgba(0, 0, 0, 1)"],["columnHeaderCellPaddingBottom",5],["columnHeaderCellPaddingLeft",5],["columnHeaderCellPaddingRight",5],["columnHeaderCellPaddingTop",5],["columnHeaderCellVerticalAlignment","center"],["columnHeaderOrderByArrowBorderColor","rgba(195, 199, 202, 1)"],["columnHeaderOrderByArrowBorderWidth",1],["columnHeaderOrderByArrowColor","rgba(155, 155, 155, 1)"],["columnHeaderOrderByArrowHeight",8],["columnHeaderOrderByArrowMarginLeft",0],["columnHeaderOrderByArrowMarginRight",5],["columnHeaderOrderByArrowMarginTop",6],["columnHeaderOrderByArrowWidth",13],["contextFilterButtonBorder","solid 1px rgba(158, 163, 169, 1)"],["contextFilterButtonBorderRadius","3px"],["contextFilterButtonHTML","▼"],["contextFilterInputBackground","rgba(255,255,255,1)"],["contextFilterInputBorder","solid 1px rgba(158, 163, 169, 1)"],["contextFilterInputBorderRadius","0"],["contextFilterInputColor","rgba(0,0,0,1)"],["contextFilterInputFontFamily","sans-serif"],["contextFilterInputFontSize","14px"],["contextFilterInvalidRegExpBackground","rgba(180, 6, 1, 1)"],["contextFilterInvalidRegExpColor","rgba(255, 255, 255, 1)"],["contextMenuArrowColor","rgba(43, 48, 43, 1)"],["contextMenuArrowDownHTML","▼"],["contextMenuArrowUpHTML","▲"],["contextMenuBackground","rgba(240, 240, 240, 1)"],["contextMenuBorder","solid 1px rgba(158, 163, 169, 1)"],["contextMenuBorderRadius","3px"],["contextMenuChildArrowFontSize","12px"],["contextMenuColor","rgba(43, 48, 43, 1)"],["contextMenuCursor","default"],["contextMenuFilterButtonFontFamily","sans-serif"],["contextMenuFilterButtonFontSize","10px"],["contextMenuFilterInvalidExpresion","rgba(237, 155, 156, 1)"],["contextMenuFontFamily","sans-serif"],["contextMenuFontSize","16px"],["contextMenuHoverBackground","rgba(182, 205, 250, 1)"],["contextMenuHoverColor","rgba(43, 48, 153, 1)"],["contextMenuItemBorderRadius","3px"],["contextMenuItemMargin","2px"],["contextMenuLabelDisplay","inline-block"],["contextMenuLabelMargin","0 3px 0 0"],["contextMenuLabelMaxWidth","700px"],["contextMenuLabelMinWidth","75px"],["contextMenuMarginLeft",3],["contextMenuMarginTop",-3],["contextMenuOpacity","0.98"],["contextMenuPadding","2px"],["contextMenuWindowMargin",30],["contextMenuZIndex",1e4],["cornerCellBackgroundColor","rgba(240, 240, 240, 1)"],["cornerCellBorderColor","rgba(202, 202, 202, 1)"],["debugBackgroundColor","rgba(0, 0, 0, .0)"],["debugColor","rgba(255, 15, 24, 1)"],["debugEntitiesColor","rgba(76, 231, 239, 1.00)"],["debugFont","11px sans-serif"],["debugPerfChartBackground","rgba(29, 25, 26, 1.00)"],["debugPerfChartTextColor","rgba(255, 255, 255, 0.8)"],["debugPerformanceColor","rgba(252, 255, 37, 1.00)"],["debugScrollHeightColor","rgba(248, 33, 103, 1.00)"],["debugScrollWidthColor","rgba(66, 255, 27, 1.00)"],["debugTouchPPSXColor","rgba(246, 102, 24, 1.00)"],["debugTouchPPSYColor","rgba(186, 0, 255, 1.00)"],["display","inline-block"],["editCellBackgroundColor","white"],["editCellBorder","solid 1px rgba(110, 168, 255, 1)"],["editCellBoxShadow","0 2px 5px rgba(0,0,0,0.4)"],["editCellColor","black"],["editCellFontFamily","sans-serif"],["editCellFontSize","16px"],["editCellPaddingLeft",4],["editCellZIndex",1e4],["filterButtonActiveBackgroundColor","rgba(225, 225, 225, 1)"],["filterButtonArrowBorderColor","rgba(195, 199, 202, 1)"],["filterButtonArrowBorderWidth",1],["filterButtonArrowClickRadius",5],["filterButtonArrowColor","rgba(50, 50, 50, 1)"],["filterButtonArrowHeight",5],["filterButtonArrowWidth",8],["filterButtonBackgroundColor","rgba(240, 240, 240, 1)"],["filterButtonBorderColor","rgba(172, 172, 172, 1)"],["filterButtonBorderRadius",3],["filterButtonHeight",20],["filterButtonHoverBackgroundColor","rgba(235, 235, 235, 1)"],["filterButtonMenuOffsetTop",10],["filterButtonWidth",20],["frozenMarkerHoverColor","rgba(165, 198, 254, 1)"],["frozenMarkerHoverBorderColor","rgba(165, 198, 254, 1)"],["frozenMarkerActiveColor","rgba(165, 198, 254, 0.2)"],["frozenMarkerActiveBorderColor","rgba(165, 198, 254, 0.5)"],["frozenMarkerActiveHeaderColor","rgba(165, 198, 254, 1)"],["frozenMarkerColor","rgba(221, 221, 221, 1)"],["frozenMarkerBorderColor","rgba(221, 221, 221, 1)"],["frozenMarkerBorderWidth",1],["frozenMarkerHeaderColor","rgba(188, 188, 188, 1)"],["frozenMarkerWidth",4],["groupingAreaBackgroundColor","rgba(240, 240, 240, 1)"],["gridBackgroundColor","rgba(240, 240, 240, 1)"],["gridBorderCollapse","collapse"],["gridBorderColor","rgba(202, 202, 202, 1)"],["gridBorderWidth",1],["groupIndicatorColor","rgba(155, 155, 155, 1)"],["groupIndicatorBackgroundColor","rgba(255, 255, 255, 1)"],["height","auto"],["maxHeight","inherit"],["maxWidth","inherit"],["minColumnWidth",45],["minHeight","inherit"],["minRowHeight",24],["minWidth","inherit"],["mobileContextMenuMargin",10],["mobileEditInputHeight",30],["mobileEditFontFamily","sans-serif"],["mobileEditFontSize","16px"],["moveOverlayBorderWidth",1],["moveOverlayBorderColor","rgba(66, 133, 244, 1)"],["moveOverlayBorderSegments","12, 7"],["name","default"],["overflowY","auto"],["overflowX","auto"],["reorderMarkerBackgroundColor","rgba(0, 0, 0, 0.1)"],["reorderMarkerBorderColor","rgba(0, 0, 0, 0.2)"],["reorderMarkerBorderWidth",1.25],["reorderMarkerIndexBorderColor","rgba(66, 133, 244, 1)"],["reorderMarkerIndexBorderWidth",2.75],["resizeMarkerColor","rgba(0, 0, 0, 0.2)"],["resizeMarkerSize",2],["rowGroupColumnWidth",25],["rowHeaderCellBackgroundColor","rgba(240, 240, 240, 1)"],["rowHeaderCellBorderColor","rgba(200, 200, 200, 1)"],["rowHeaderCellBorderWidth",1],["rowHeaderCellColor","rgba(50, 50, 50, 1)"],["rowHeaderCellFont","16px sans-serif"],["rowHeaderCellHeight",25],["rowHeaderCellHorizontalAlignment","left"],["rowHeaderCellHoverBackgroundColor","rgba(235, 235, 235, 1)"],["rowHeaderCellHoverColor","rgba(0, 0, 0, 1)"],["rowHeaderCellPaddingBottom",5],["rowHeaderCellPaddingLeft",5],["rowHeaderCellPaddingRight",5],["rowHeaderCellPaddingTop",5],["rowHeaderCellRowNumberGapHeight",5],["rowHeaderCellRowNumberGapColor","rgba(50, 50, 50, 1)"],["rowHeaderCellSelectedBackgroundColor","rgba(217, 217, 217, 1)"],["rowHeaderCellSelectedColor","rgba(50, 50, 50, 1)"],["rowHeaderCellVerticalAlignment","center"],["rowHeaderCellWidth",57],["scrollBarActiveColor","rgba(125, 125, 125, 1)"],["scrollBarBackgroundColor","rgba(240, 240, 240, 1)"],["scrollBarBorderColor","rgba(202, 202, 202, 1)"],["scrollBarBorderWidth",.5],["scrollBarBoxBorderRadius",4.125],["scrollBarBoxColor","rgba(192, 192, 192, 1)"],["scrollBarBoxMargin",2],["scrollBarBoxMinSize",15],["scrollBarBoxWidth",8],["scrollBarCornerBackgroundColor","rgba(240, 240, 240, 1)"],["scrollBarCornerBorderColor","rgba(202, 202, 202, 1)"],["scrollBarWidth",11],["selectionHandleBorderColor","rgba(255, 255, 255, 1)"],["selectionHandleBorderWidth",1.5],["selectionHandleColor","rgba(66, 133, 244, 1)"],["selectionHandleSize",8],["selectionHandleType","square"],["fillOverlayBorderColor","rgba(127, 127, 127, 1)"],["fillOverlayBorderWidth",2],["selectionOverlayBorderColor","rgba(66, 133, 244, 1)"],["selectionOverlayBorderWidth",1],["treeArrowBorderColor","rgba(195, 199, 202, 1)"],["treeArrowBorderWidth",1],["treeArrowClickRadius",5],["treeArrowColor","rgba(155, 155, 155, 1)"],["treeArrowHeight",8],["treeArrowMarginLeft",0],["treeArrowMarginRight",5],["treeArrowMarginTop",6],["treeArrowWidth",13],["treeGridHeight",250],["unhideIndicatorColor","rgba(0, 0, 0, 1)"],["unhideIndicatorBackgroundColor","rgba(255, 255, 255, 1)"],["unhideIndicatorBorderColor","rgba(174, 193, 232, 1)"],["unhideIndicatorSize",16],["width","auto"]]}}function component(){var e,t={};return t.dehyphenateProperty=function(e){e=e.replace("--cdg-","");var t,o="";return Array.prototype.forEach.call(e,(function(e){if(t)return t=!1,void(o+=e.toUpperCase());"-"!==e?o+=e:t=!0})),o},t.hyphenateProperty=function(e,t){var o="";return Array.prototype.forEach.call(e,(function(e){e!==e.toUpperCase()?o+=e:o+="-"+e.toLowerCase()})),(t?"--cdg-":"")+o},t.applyComponentStyle=function(o,r){if(r.isComponent){var n=window.getComputedStyle("CANVAS-DATAGRID"===r.tagName?r:r.canvas,null),l={};r.computedStyle=n,defaults(l),l.defaults.styles.forEach((function(o){var l;""===(l=n.getPropertyValue(t.hyphenateProperty(o[0],!0)))&&(l=n.getPropertyValue(t.hyphenateProperty(o[0],!1))),""!==l&&"string"==typeof l&&r.setStyleProperty(o[0],e[_typeof(o[1])](l.replace(/^\s+/,"").replace(/\s+$/,""),o[1]),!0)})),!o&&r.dispatchEvent&&(requestAnimationFrame((function(){r.resize(!0)})),r.dispatchEvent("stylechanged",r.style))}},e={data:function(e){try{return JSON.parse(e)}catch(e){throw new Error("Cannot read JSON data in canvas-datagrid data.")}},schema:function(e){try{return JSON.parse(e)}catch(e){throw new Error("Cannot read JSON data in canvas-datagrid schema attribute.")}},number:function(e,t){var o=parseInt(e,10);return isNaN(o)?t:o},boolean:function(e){return/true/i.test(e)},string:function(e){return e}},t.getObservableAttributes=function(){var e={},t=["data","schema","style","className","name"];return defaults(e),e.defaults.attributes.forEach((function(e){t.push(e[0].toLowerCase())})),t},t.disconnectedCallback=function(){this.connected=!1},t.connectedCallback=function(){var e=this;e.parentDOMNode.innerHTML="",e.parentDOMNode.appendChild(e.canvas),e.connected=!0,t.observe(e),t.applyComponentStyle(!0,e),e.resize(!0)},t.adoptedCallback=function(){this.resize()},t.attributeChangedCallback=function(o,r,n){var l,i,a=this;if("style"!==o){if("data"===o)return"application/x-canvas-datagrid"===a.dataType&&(a.dataType="application/json+x-canvas-datagrid"),void(a.data=n);if("schema"!==o)if("name"!==o){if("class"!==o&&"className"!==o){var s,c,d;if(s="attributes",c=o,defaults(d={}),i=d.defaults[s].filter((function(e){return e[0].toLowerCase()===c.toLowerCase()||t.hyphenateProperty(e[0])===c.toLowerCase()||t.hyphenateProperty(e[0],!0)===c.toLowerCase()}))[0],i)return l=e[_typeof(i[1])],void(a.attributes[i[0]]=l(n));/^on/.test(o)&&a.addEventListener("on"+o,Function("e",n))}}else a.name=n;else a.schema=e.schema(n)}else t.applyComponentStyle(!1,a)},t.observe=function(e){var o;window.MutationObserver&&(e.applyComponentStyle=function(){t.applyComponentStyle(!1,e),e.resize()},(o=new window.MutationObserver((function(t){var o,r;Array.prototype.forEach.call(t,(function(t){"class"!==t.attributeName&&"style"!==t.attributeName&&"STYLE"!==t.target.nodeName?t.target.parentNode&&"STYLE"===t.target.parentNode.nodeName?r=!0:t.target===e&&(t.addedNodes.length>0||"characterData"===t.type)&&(o=!0):r=!0})),r&&e.applyComponentStyle(!1,e),o&&("application/x-canvas-datagrid"===e.dataType&&(e.dataType="application/json+x-canvas-datagrid"),e.data=e.innerHTML)}))).observe(e,{characterData:!0,childList:!0,attributes:!0,subtree:!0}),Array.prototype.forEach.call(document.querySelectorAll("style"),(function(e){o.observe(e,{characterData:!0,childList:!0,attributes:!0,subtree:!0})})))},t}var _this=void 0,SelectionType={UnselectedCells:0,Cells:1,Rows:2,Columns:3},swapProps=function(e,t,o){_newArrowCheck(this,_this);var r=e[t];e[t]=e[o],e[o]=r}.bind(void 0),normalizeSelection=function(e){if(_newArrowCheck(this,_this),!e)return e;switch(e.type){case SelectionType.UnselectedCells:case SelectionType.Cells:"number"!=typeof e.endRow?e.endRow=e.startRow:e.endRow<e.startRow&&swapProps(e,"startRow","endRow"),"number"!=typeof e.endColumn?e.endColumn=e.startColumn:e.endColumn<e.startColumn&&swapProps(e,"startColumn","endColumn");break;case SelectionType.Rows:"number"!=typeof e.endRow?e.endRow=e.startRow:e.endRow<e.startRow&&swapProps(e,"startRow","endRow");break;case SelectionType.Columns:"number"!=typeof e.endColumn?e.endColumn=e.startColumn:e.endColumn<e.startColumn&&swapProps(e,"startColumn","endColumn")}return e}.bind(void 0),getSelectionFromString=function(e){var t=this;if(_newArrowCheck(this,_this),"string"==typeof e){var o=e.indexOf(":");if(!(o<0)){var r=e.slice(0,o),n=e.slice(o+1).split(/[,:;-]+/).map(function(e){return _newArrowCheck(this,t),parseInt(e,10)}.bind(this));switch(r){case"cell":case"cells":case"-cell":case"-cells":return normalizeSelection({type:SelectionType["-"===r[0]?"UnselectedCells":"Cells"],startRow:n[0],startColumn:n[1],endRow:n[2],endColumn:n[3]});case"row":case"rows":return normalizeSelection({type:SelectionType.Rows,startRow:n[0],endRow:n[1]});case"col":case"cols":return normalizeSelection({type:SelectionType.Columns,startColumn:n[0],endColumn:n[1]})}}}}.bind(void 0),isSameCellsBlock=function(e,t){return _newArrowCheck(this,_this),e.startRow===t.startRow&&e.endRow===t.endRow&&e.startColumn===t.startColumn&&e.endColumn===t.endColumn}.bind(void 0),mergeCellsIntoRowsOrColumns=function(e,t){return _newArrowCheck(this,_this),t.type===SelectionType.Rows?e.startRow>=t.startRow&&e.endRow<=t.endRow?t:void 0:e.startColumn>=t.startColumn&&e.endColumn<=t.endColumn?t:void 0}.bind(void 0),mergeSelections=function(e,t){if(_newArrowCheck(this,_this),e.type!==t.type)return t.type<=SelectionType.Cells&&e.type>SelectionType.Cells?mergeCellsIntoRowsOrColumns(t,e):e.type<=SelectionType.Cells&&t.type>SelectionType.Cells?mergeCellsIntoRowsOrColumns(e,t):void 0;var o=e.type===SelectionType.Columns||e.startRow===t.startRow&&e.endRow===t.endRow,r=e.type===SelectionType.Rows||e.startColumn===t.startColumn&&e.endColumn===t.endColumn;if(o){if(r)return e;if(t.startColumn>e.endColumn+1||t.endColumn<e.startColumn-1)return;return Object.assign({},e,{startColumn:Math.min(e.startColumn,t.startColumn),endColumn:Math.max(e.endColumn,t.endColumn)})}if(r){if(t.startRow>e.endRow+1||t.endRow<e.startRow-1)return;return Object.assign({},e,{startRow:Math.min(e.startRow,t.startRow),endRow:Math.max(e.endRow,t.endRow)})}if(e.type===SelectionType.Cells||e.type===SelectionType.UnselectedCells){var n=_getIntersection(e,t);if(n){if(isSameCellsBlock(n,e))return t;if(isSameCellsBlock(n,t))return e}}}.bind(void 0),removePartOfRowsSelection=function(e,t){if(_newArrowCheck(this,_this),!(t.endRow<e.startRow||t.startRow>e.endRow))return t.startRow<=e.startRow?t.endRow>=e.endRow?[]:[Object.assign({},e,{startRow:t.endRow+1})]:t.endRow>=e.endRow?[Object.assign({},e,{endRow:t.startRow-1})]:[Object.assign({},e,{endRow:t.startRow-1}),Object.assign({},e,{startRow:t.endRow+1})]}.bind(void 0),removePartOfColumnsSelection=function(e,t){if(_newArrowCheck(this,_this),!(t.endColumn<e.startColumn||t.startColumn>e.endColumn))return t.startColumn<=e.startColumn?t.endColumn>=e.endColumn?[]:[Object.assign({},e,{startColumn:t.endColumn+1})]:t.endColumn>=e.endColumn?[Object.assign({},e,{endColumn:t.startColumn-1})]:[Object.assign({},e,{endColumn:t.startColumn-1}),Object.assign({},e,{startColumn:t.endColumn+1})]}.bind(void 0),removePartOfCellsSelection=function(e,t){_newArrowCheck(this,_this);var o=_getIntersection(e,t);if(o){if(isSameCellsBlock(e,o))return[];var r=[],n=e.startRow,l=e.endRow,i=e.endColumn;return o.startRow>e.startRow&&(r.push(Object.assign({},e,{endRow:o.startRow-1})),n=o.startRow),o.endColumn<e.endColumn&&(r.push(Object.assign({},e,{startRow:n,startColumn:o.endColumn+1})),i=o.endColumn),o.endRow<e.endRow&&(r.push(Object.assign({},e,{endColumn:i,startRow:o.endRow+1})),l=o.endRow),o.startColumn>e.startColumn&&r.push(Object.assign({},e,{startRow:n,endRow:l,endColumn:o.startColumn-1})),r}}.bind(void 0),_getIntersection=function(e,t){if(_newArrowCheck(this,_this),e.type>t.type)return _getIntersection(t,e);if(e.type<=SelectionType.Cells){if(t.type<=SelectionType.Cells){var o=Math.max(e.startColumn,t.startColumn),r=Math.min(e.endColumn,t.endColumn);if(o>r)return;var n=Math.max(e.startRow,t.startRow),l=Math.min(e.endRow,t.endRow);if(n>l)return;return{type:SelectionType.Cells,startRow:n,startColumn:o,endRow:l,endColumn:r}}if(t.type===SelectionType.Rows){var i=Math.max(e.startRow,t.startRow),a=Math.min(e.endRow,t.endRow);if(i>a)return;return{type:SelectionType.Cells,startRow:i,startColumn:e.startColumn,endRow:a,endColumn:e.endColumn}}var s=Math.max(e.startColumn,t.startColumn),c=Math.min(e.endColumn,t.endColumn);if(s>c)return;return{type:SelectionType.Cells,startColumn:s,startRow:e.startRow,endColumn:c,endRow:e.endRow}}if(e.type===SelectionType.Rows){if(t.type===SelectionType.Rows){var d=Math.max(e.startRow,t.startRow),u=Math.min(e.endRow,t.endRow);if(d>u)return;return{type:SelectionType.Rows,startRow:d,endRow:u}}return{type:SelectionType.Cells,startRow:e.startRow,startColumn:t.startColumn,endRow:e.endRow,endColumn:t.endColumn}}var h=Math.max(e.startColumn,t.startColumn),f=Math.min(e.endColumn,t.endColumn);return h>f?void 0:{type:SelectionType.Columns,startColumn:h,endColumn:f}}.bind(void 0),_addIntoSelections=function(e,t,o){if(_newArrowCheck(this,_this),!t||"number"!=typeof t.type)return!1;if(t.type===SelectionType.Cells){for(var r=0;r<e.length;r++){var n=e[r];if(n.type!==SelectionType.UnselectedCells){if(n.type===SelectionType.Cells){var l=removePartOfCellsSelection(t,n);if(Array.isArray(l)){for(var i=!1,a=0;a<l.length;a++){_addIntoSelections(e,l[a],o)&&(i=!0)}return i&&cleanupSelections(e),i}}}else{var s=removePartOfCellsSelection(n,t);s&&(e.splice.apply(e,[r,1].concat(_toConsumableArray(s))),r+=s.length-1)}}if(o){var c,d,u=0===t.startRow&&t.endRow+1>=o.rows,h=0===t.startColumn&&t.endColumn+1>=o.columns;if(u&&(c=_addIntoSelections(e,{type:SelectionType.Columns,startColumn:t.startColumn,endColumn:t.endColumn},o)),h&&(d=_addIntoSelections(e,{type:SelectionType.Rows,startRow:t.startRow,endRow:t.endRow},o)),u||h)return c||d}return e.push(t),cleanupSelections(e),!0}var f=t.type===SelectionType.Rows;if(f||t.type===SelectionType.Columns){for(var g=0;g<e.length;g++){var m=e[g];if(m.type!==SelectionType.UnselectedCells){if(m.type===t.type){var p=mergeSelections(m,t);if(p){for(var w=g+1;w<e.length;w++)if(e[w].type===t.type){var v=mergeSelections(e[w],p);v&&(e.splice(w,1),w--,p=v)}return e[g]=p,cleanupSelections(e),!0}}}else{var y=removePartOfCellsSelection(m,f?{startRow:t.startRow,endRow:t.endRow,startColumn:0,endColumn:m.endColumn}:{startColumn:t.startColumn,endColumn:t.endColumn,startRow:0,endRow:m.endRow});y&&(e.splice.apply(e,[g,1].concat(_toConsumableArray(y))),g+=y.length-1)}}return e.push(t),cleanupSelections(e),!0}return!1}.bind(void 0),_removeFromSelections=function(e,t,o){if(_newArrowCheck(this,_this),!t||"number"!=typeof t.type)return!1;if(t.type===SelectionType.Cells){for(var r=0;r<e.length;r++){var n=e[r];if(n.type===SelectionType.UnselectedCells){var l=removePartOfCellsSelection(t,n);if(Array.isArray(l)){for(var i=!1,a=0;a<l.length;a++){_removeFromSelections(e,l[a],o)&&(i=!0)}return i&&cleanupSelections(e),i}}if(n.type!==SelectionType.Cells);else{var s=removePartOfCellsSelection(n,t);s&&(e.splice.apply(e,[r,1].concat(_toConsumableArray(s))),r+=s.length-1)}}if(o){var c,d,u=0===t.startRow&&t.endRow+1>=o.rows,h=0===t.startColumn&&t.endColumn+1>=o.columns;if(u&&(c=_removeFromSelections(e,{type:SelectionType.Columns,startColumn:t.startColumn,endColumn:t.endColumn},o)),h&&(d=_removeFromSelections(e,{type:SelectionType.Rows,startRow:t.startRow,endRow:t.endRow},o)),u||h)return c||d}return t.type=SelectionType.UnselectedCells,e.unshift(t),cleanupSelections(e),!0}var f=t.type===SelectionType.Rows;if(f||t.type===SelectionType.Columns){for(var g=!1,m=0;m<e.length;m++){var p=e[m];if(p.type!==SelectionType.Cells)if(p.type!==SelectionType.UnselectedCells)if(p.type===t.type){var w=f?removePartOfRowsSelection(p,t):removePartOfColumnsSelection(p,t);if(!w)continue;g=!0,e.splice.apply(e,[m,1].concat(_toConsumableArray(w))),m+=w.length-1}else{g=!0;var v=void 0;v=p.type===SelectionType.Rows?{type:SelectionType.UnselectedCells,startColumn:t.startColumn,endColumn:t.endColumn,startRow:p.startRow,endRow:p.endRow}:{type:SelectionType.UnselectedCells,startRow:t.startRow,endRow:t.endRow,startColumn:p.startColumn,endColumn:p.endColumn},e.unshift(v)}else f?p.startRow>=t.startRow&&p.endRow<=t.endRow&&(e.splice(m,1),m--):p.startColumn>=t.startColumn&&p.endColumn<=t.endColumn&&(e.splice(m,1),m--);else{var y=removePartOfCellsSelection(p,f?{startRow:t.startRow,endRow:t.endRow,startColumn:0,endColumn:p.endColumn}:{startColumn:t.startColumn,endColumn:t.endColumn,startRow:0,endRow:p.endRow});y&&(e.splice.apply(e,[m,1].concat(_toConsumableArray(y))),m+=y.length-1)}}return g&&cleanupSelections(e),g}return!1}.bind(void 0),cleanupSelections=function(e){var t=this;_newArrowCheck(this,_this);for(var o=[],r=[],n=0;n<e.length;n++){var l=e[n];l.type===SelectionType.UnselectedCells?o.push(l):r.push(l)}o=o.filter(function(e){_newArrowCheck(this,t);for(var o=0;o<r.length;o++)if(_getIntersection(e,r[o]))return!0;return!1}.bind(this));for(var i=!1;!i;){i=!0;for(var a=0;a<r.length;a++){for(var s=r[a],c=a+1;c<r.length;c++){var d=r[c],u=mergeSelections(s,d);if(u){r[a]=u,r.splice(c,1),i=!1;break}}if(!i)break}}for(var h=0,f=0;f<o.length;f++)e[h++]=o[f];for(var g=0;g<r.length;g++)e[h++]=r[g];e.splice(h,e.length-h)}.bind(void 0),isRowSelected=function(e,t){_newArrowCheck(this,_this);for(var o=0;o<e.length;o++){var r=e[o];switch(r.type){case SelectionType.UnselectedCells:if(t>=r.startRow&&t<=r.endRow)return!1;break;case SelectionType.Rows:if(t>=r.startRow&&t<=r.endRow)return!0}}return!1}.bind(void 0),isColumnSelected=function(e,t){_newArrowCheck(this,_this);for(var o=0;o<e.length;o++){var r=e[o];switch(r.type){case SelectionType.UnselectedCells:if(t>=r.startColumn&&t<=r.endColumn)return!1;break;case SelectionType.Columns:if(t>=r.startColumn&&t<=r.endColumn)return!0}}return!1}.bind(void 0),isCellSelected=function(e,t,o){_newArrowCheck(this,_this);for(var r=0;r<e.length;r++){var n=e[r];switch(n.type){case SelectionType.UnselectedCells:case SelectionType.Cells:if(o>=n.startColumn&&o<=n.endColumn&&t>=n.startRow&&t<=n.endRow)return n.type===SelectionType.Cells;break;case SelectionType.Rows:if(t>=n.startRow&&t<=n.endRow)return!0;break;case SelectionType.Columns:if(o>=n.startColumn&&o<=n.endColumn)return!0}}return!1}.bind(void 0),areAllCellsSelected=function(e,t){_newArrowCheck(this,_this);for(var o=t.startRow,r=t.startColumn,n=t.endRow,l=t.endColumn,i=0,a=e.length;i<a;i++){var s=e[i];if(s)switch(s.type){case SelectionType.UnselectedCells:case SelectionType.Cells:var c=r>=s.startColumn&&o>=s.startRow,d=l<=s.endColumn&&n<=s.endRow;if(c||d){if(c&&d)return s.type===SelectionType.Cells;if(c&&r<=s.endColumn&&o<=s.endRow||d&&l>=s.startColumn&&n>=s.startRow)return!1}break;case SelectionType.Rows:if(o>=s.startRow){if(n<=s.endRow)return!0;if(o<=s.endRow)return!1}else if(n>=s.startRow)return!1;break;case SelectionType.Columns:if(r>=s.startColumn){if(l<=s.endColumn)return!0;if(r<=s.endColumn)return!1}else if(l>=s.startColumn)return!1}}return!1}.bind(void 0),getSelectionStateFromCells=function(e,t){var o=this;if(_newArrowCheck(this,_this),!Array.isArray(e)||0===e.length)return!1;if(e=e.filter(function(e){return _newArrowCheck(this,o),("number"!=typeof e.startRow||!(e.endRow<t.startRow||e.startRow>t.endRow))&&(("number"!=typeof e.startColumn||!(e.endColumn<t.startColumn||e.startColumn>t.endColumn))&&e)}.bind(this)),0===e.length)return!1;if(areAllCellsSelected(e,t))return!0;for(var r=t.endColumn-t.startColumn+1,n=new Array(t.endRow-t.startRow+1).fill(null).map(function(){return _newArrowCheck(this,o),new Array(r)}.bind(this)),l=Object.assign({type:SelectionType.Cells},t),i=e.length-1;i>=0;i--){var a=e[i],s=_getIntersection(l,a);if(s)for(var c=a.type!==SelectionType.UnselectedCells,d=s.startRow;d<=s.endRow;d++)for(var u=n[d-t.startRow],h=s.startColumn-t.startColumn,f=s.endColumn-t.startColumn;h<=f;h++)u[h]=c}return n}.bind(void 0),getVerboseSelectionStateFromCells=function(e,t){var o=this;if(_newArrowCheck(this,_this),!Array.isArray(e)||0===e.length)return[];if(e=e.map(function(e){return _newArrowCheck(this,o),"number"==typeof e.startRow&&(e.endRow<t.startRow||e.startRow>t.endRow)||"number"==typeof e.startColumn&&(e.endColumn<t.startColumn||e.startColumn>t.endColumn)?null:e}.bind(this)),0===e.length)return[];for(var r=t.endColumn-t.startColumn+1,n=new Array(t.endRow-t.startRow+1).fill(null).map(function(){return _newArrowCheck(this,o),new Array(r)}.bind(this)),l=Object.assign({type:SelectionType.Cells},t),i=e.length-1;i>=0;i--){var a=e[i];if(a){var s=_getIntersection(l,a);if(s)for(var c=a.type!==SelectionType.UnselectedCells,d=s.startRow;d<=s.endRow;d++)for(var u=n[d-t.startRow],h=s.startColumn-t.startColumn,f=s.endColumn-t.startColumn;h<=f;h++)u[h]=c?i+1:0}}return n}.bind(void 0),getSelectedContiguousColumns=function(e,t){if(_newArrowCheck(this,_this),e&&0!==e.length){for(var o,r=e.length-1;r>=0;r--){var n=e[r];switch(n.type){case SelectionType.Columns:if(o){var l=mergeSelections(o,n);if(l){o=l;break}}o=n;break;case SelectionType.Rows:case SelectionType.Cells:if(!t)return;break;case SelectionType.UnselectedCells:if(!o)return;if(_getIntersection(n,o))return}}return o?[o.startColumn,o.endColumn]:void 0}}.bind(void 0),getSelectedContiguousRows=function(e,t){if(_newArrowCheck(this,_this),e&&0!==e.length){for(var o,r=e.length-1;r>=0;r--){var n=e[r];switch(n.type){case SelectionType.Rows:if(o){var l=mergeSelections(o,n);if(l){o=l;break}}o=n;break;case SelectionType.Columns:case SelectionType.Cells:if(!t)return;break;case SelectionType.UnselectedCells:if(!o)return;if(_getIntersection(n,o))return}}return o?[o.startRow,o.endRow]:void 0}}.bind(void 0),areSelectionsComplex=function(e){var t=this;if(_newArrowCheck(this,_this),!e||e.length<=1)return!1;var o=e[0].type;return o===SelectionType.UnselectedCells||e.findIndex(function(e){return _newArrowCheck(this,t),e.type!==o}.bind(this))>=0}.bind(void 0),areSelectionsNeat=function(e){if(_newArrowCheck(this,_this),!e)return!1;if(1===e.length)return!0;var t=e[0],o=t.type;if(o===SelectionType.UnselectedCells)return!0;for(var r=0;r<e.length;r++){var n=e[r];if(o!==n.type)return!1;if(o===SelectionType.Cells){if(n.startColumn===t.startColumn&&n.endColumn===t.endColumn)continue;if(n.startRow===t.startRow&&n.endRow===t.endRow)continue;return!1}}return!0}.bind(void 0),moveSelections=function(e,t,o){_newArrowCheck(this,_this);for(var r=0;r<e.length;r++){var n=e[r];switch(n.type){case SelectionType.Cells:case SelectionType.UnselectedCells:n.startRow+=o,n.endRow+=o,n.startColumn+=t,n.endColumn+=t;break;case SelectionType.Rows:n.startRow+=o,n.endRow+=o;break;case SelectionType.Columns:n.startColumn+=t,n.endColumn+=t}}}.bind(void 0),cloneSelections=function(e){_newArrowCheck(this,_this);for(var t=[],o=0;o<e.length;o++){var r=e[o];r&&t.push(Object.assign({},r))}return t}.bind(void 0),getSelectionBounds=function(e){_newArrowCheck(this,_this);for(var t=1/0,o=-1/0,r=1/0,n=-1/0,l=0;l<e.length;l++){var i=e[l];i.type!==SelectionType.UnselectedCells&&("number"!=typeof i.startColumn?r=0:i.startColumn<r&&(r=i.startColumn),"number"!=typeof i.endColumn?n=1/0:i.endColumn>n&&(n=i.endColumn),"number"!=typeof i.startRow?t=0:i.startRow<t&&(t=i.startRow),"number"!=typeof i.endRow?o=1/0:i.endRow>o&&(o=i.endRow))}return{top:t,left:r,bottom:o,right:n}}.bind(void 0),shrinkOrExpandSelections=function(e,t,o,r){var n=this;_newArrowCheck(this,_this);var l=t.rowIndex,i=t.columnIndex;if(l<0||i<0)return!1;var a={ArrowLeft:{x:1,y:0,isLeft:!0},ArrowUp:{x:0,y:1,isUp:!0},ArrowRight:{x:-1,y:0,isRight:!0},ArrowDown:{x:0,y:-1,isDown:!0}}[o.key];if(!a)return!1;for(var s=l+a.y,c=i+a.x,d=[],u=0;u<e.length;u++){var h=e[u];switch(h.type){case SelectionType.Cells:case SelectionType.UnselectedCells:if(!(s!==h.startRow&&s!==h.endRow||c!==h.startColumn&&c!==h.endColumn)){if(h.type===SelectionType.UnselectedCells)return!1;d.push(h)}break;case SelectionType.Rows:s!==h.startRow&&s!==h.endRow||d.push(h);break;case SelectionType.Columns:c!==h.startColumn&&c!==h.endColumn||d.push(h)}}if(1!==d.length)return!1;var f=d[0],g=f.startRow===s,m=f.endRow===s,p=f.startColumn===c,w=f.endColumn===c,v=r?r.rows-1:1/0,y=r?r.columns-1:1/0,x=function(){return _newArrowCheck(this,n),cleanupSelections(e),!0}.bind(this);if(g){if(a.isUp)return 0!==f.startRow&&(f.startRow--,x());if(a.isDown&&f.startRow<f.endRow)return f.startRow++,x()}if(m){if(a.isDown)return!(f.endRow>=v)&&(f.endRow++,x());if(a.isUp&&f.startRow<f.endRow)return f.endRow--,x()}if(p){if(a.isLeft)return 0!==f.startColumn&&(f.startColumn--,x());if(a.isRight&&f.startColumn<f.endColumn)return f.startColumn++,x()}if(w){if(a.isRight)return!(f.endColumn>=y)&&(f.endColumn++,x());if(a.isLeft&&f.startColumn<f.endColumn)return f.endColumn--,x()}return!1}.bind(void 0);function draw(e){var t=[],o=!1,r=0,n=300,l=[],i=[],a=[];function s(e,t,o,r){o=o||1;var n,l=[];for(n=e;n<=t;n+=o)l[n]=void 0===r?n:"function"==typeof r?r(n):r;return l}function c(t){var r,n=t.innerHTML||t.formattedValue,l=n.toString()+t.rowIndex.toString()+t.columnIndex.toString(),i=Math.round(t.x+e.canvasOffsetLeft),a=Math.round(t.y+e.canvasOffsetTop);if(e.htmlImageCache[l]){if(r=e.htmlImageCache[l].img,e.htmlImageCache[l].height===t.height&&e.htmlImageCache[l].width===t.width){if(!r.complete)return;return e.ctx.drawImage(r,i,a)}e.htmlImageCache[l]=void 0}else o=!1;r=new Image(t.width,t.height),e.htmlImageCache[l]={img:r,width:t.width,height:t.height},r.onload=function(){var t;e.ctx.drawImage(r,i,a),t=!0,Object.keys(e.htmlImageCache).forEach((function(o){e.htmlImageCache[o].img.complete||(t=!1)})),t&&!o&&(o=!0,e.draw())},r.src="data:image/svg+xml;base64,"+btoa('<svg xmlns="http://www.w3.org/2000/svg" width="'+t.width+'" height="'+t.height+'">\n<foreignObject class="node" x="0" y="0" width="100%" height="100%">\n<body xmlns="http://www.w3.org/1999/xhtml" style="margin:0;padding:0;">\n'+n+"\n</body></foreignObject>\n</svg>\n")}function d(t,o){if(!(t.length<4)){e.ctx.beginPath(),e.ctx.moveTo(t[0]+e.canvasOffsetLeft,t[1]+e.canvasOffsetTop);for(var r=2;r<t.length;r+=2){var n=t[r]+e.canvasOffsetLeft,l=t[r+1]+e.canvasOffsetTop;e.ctx.lineTo(n,l)}o?e.ctx.fill():e.ctx.stroke()}}function u(e,t,o,r){m(e,t,o,o),p(e,t,o,o);var n=e+.5*o,l=t+.5*o;d([e+.2*o,l,e+.78*o,l]),r&&d([n,t+.22*o,n,t+.8*o])}function h(t,o,r,n,l){var i,a,s,c,u=.2*r,h=.3*r,f=r-2*u,g=r-2*h,p=.5*f;switch(n){case"r":c=[t,o,t+r,o,t+r,o+r,t,o+r],s=[i=t+h,a=o+u,i,a+f,i+g,a+p];break;case"l":c=[t+r,o,t,o,t,o+r,t+r,o+r],s=[i=t+r-h,a=o+u,i,a+f,i-g,a+p];break;case"t":c=[t,o+r,t,o,t+r,o,t+r,o+r],s=[i=t+u,a=o+r-h,i+f,a,i+p,a-g];break;case"b":c=[t,o,t,o+r,t+r,o+r,t+r,o],s=[i=t+u,a=o+h,i+f,a,i+p,a+g]}if(l){e.ctx.strokeStyle=e.style.unhideIndicatorBorderColor,e.ctx.lineWidth=2,d(c),e.ctx.fillStyle=e.style.unhideIndicatorBackgroundColor;var w="r"===n||"b"===n?1:0;"l"===n||"r"===n?m(t-w,o,r+w,r):m(t,o-w,r,r+w)}e.ctx.fillStyle=e.style.unhideIndicatorColor,d(s,!0)}function f(t,o,r){var n=r?o.parentCount:0,l=e.style.cellTreeIconWidth*e.scale,i=e.style.cellTreeIconMarginTop*e.scale,a=e.style.cellTreeIconMarginRight*e.scale,s=e.style.cellTreeIconMarginLeft*e.scale+n*(l+t.paddingLeft),c=t.x+t.paddingLeft+e.canvasOffsetLeft+s,d=t.y+e.canvasOffsetTop+i;if(o.icon){e.ctx.beginPath();var u=e.ctx.fillStyle,h=e.ctx.strokeStyle;t.hovered&&e.hovers.onCellTreeIcon?e.ctx.fillStyle=e.style.cellTreeIconHoverFillColor:e.ctx.fillStyle=e.style.cellTreeIconFillColor,e.ctx.fillRect(c,d,l,l),e.ctx.strokeStyle=e.style.cellTreeIconBorderColor,e.ctx.rect(c,d,l,l),e.ctx.stroke(),e.ctx.beginPath(),o.expand?(e.ctx.moveTo(c+3,d+.5*l),e.ctx.lineTo(c+l-3,d+.5*l)):(e.ctx.moveTo(c+2,d+.5*l),e.ctx.lineTo(c+l-2,d+.5*l),e.ctx.moveTo(c+.5*l,d+2),e.ctx.lineTo(c+.5*l,d+l-2)),e.ctx.lineWidth=e.style.cellTreeIconLineWidth,e.ctx.strokeStyle=e.style.cellTreeIconLineColor,e.ctx.stroke(),e.ctx.strokeStyle=h,e.ctx.fillStyle=u}return s+l+a}function g(t,o,r,n,l){var i=(t+=e.canvasOffsetLeft)+r,a=(o+=e.canvasOffsetTop)+n;e.ctx.beginPath(),e.ctx.moveTo(t+l,o),e.ctx.lineTo(i-l,o),e.ctx.quadraticCurveTo(i,o,i,o+l),e.ctx.lineTo(i,o+n-l),e.ctx.quadraticCurveTo(i,a,i-l,a),e.ctx.lineTo(t+l,a),e.ctx.quadraticCurveTo(t,a,t,a-l),e.ctx.lineTo(t,o+l),e.ctx.quadraticCurveTo(t,o,t+l,o)}function m(t,o,r,n){t+=e.canvasOffsetLeft,o+=e.canvasOffsetTop,e.ctx.fillRect(t,o,r,n)}function p(t,o,r,n){t+=e.canvasOffsetLeft,o+=e.canvasOffsetTop,e.ctx.strokeRect(t,o,r,n)}function w(t,o,r){o+=e.canvasOffsetLeft,r+=e.canvasOffsetTop,e.ctx.fillText(t,o,r)}function v(t){e.ctx.beginPath(),0===t&&(e.ctx.moveTo(e.lastFrozenColumnPixel,e.lastFrozenRowPixel),e.ctx.lineTo(e.lastFrozenColumnPixel,e.height),e.ctx.lineTo(e.width,e.height),e.ctx.lineTo(e.width,e.lastFrozenRowPixel)),1===t&&(e.ctx.moveTo(0,e.lastFrozenRowPixel),e.ctx.lineTo(0,e.height),e.ctx.lineTo(e.width,e.height),e.ctx.lineTo(e.width,e.lastFrozenRowPixel)),2===t&&(e.ctx.moveTo(e.lastFrozenColumnPixel,0),e.ctx.lineTo(e.width,0),e.ctx.lineTo(e.width,e.height),e.ctx.lineTo(e.lastFrozenColumnPixel,e.height)),e.ctx.clip()}function y(t,o,r){if("circle"===e.style.selectionHandleType)return function(t,o,r){t+=e.canvasOffsetLeft,o+=e.canvasOffsetTop,e.ctx.beginPath(),e.ctx.arc(t,o,r,0,2*Math.PI),e.ctx.fill()}(t,o,.5*r);m(t-.5*r,o-.5*r,r,r)}function x(t,o,r){if("circle"===e.style.selectionHandleType)return function(t,o,r){t+=e.canvasOffsetLeft,o+=e.canvasOffsetTop,e.ctx.beginPath(),e.ctx.arc(t,o,r,0,2*Math.PI),e.ctx.stroke()}(t,o,.5*r);p(t-.5*r,o-.5*r,r,r)}function C(t,o){e.ctx.beginPath(),{t:function(){e.ctx.moveTo(t.x+e.canvasOffsetLeft,t.y+e.canvasOffsetTop),e.ctx.lineTo(t.x+e.canvasOffsetLeft+t.width,t.y+e.canvasOffsetTop)},r:function(){e.ctx.moveTo(t.x+e.canvasOffsetLeft+t.width,t.y+e.canvasOffsetTop),e.ctx.lineTo(t.x+e.canvasOffsetLeft+t.width,t.y+e.canvasOffsetTop+t.height)},b:function(){e.ctx.moveTo(t.x+e.canvasOffsetLeft,t.y+e.canvasOffsetTop+t.height),e.ctx.lineTo(t.x+e.canvasOffsetLeft+t.width,t.y+e.canvasOffsetTop+t.height)},l:function(){e.ctx.moveTo(t.x+e.canvasOffsetLeft,t.y+e.canvasOffsetTop),e.ctx.lineTo(t.x+e.canvasOffsetLeft,t.y+e.canvasOffsetTop+t.height)}}[o](),e.ctx.stroke()}function b(){for(var t=this,o=0,r=e.getSchema(),n=0,l=Math.min(e.frozenColumn,r.length),i=e.getCollapsedColumnGroups();n<l;){if(r[n].hidden);else i.findIndex(function(e){return _newArrowCheck(this,t),n>=e.from&&n<=e.to}.bind(this))>=0||(o+=e.getColumnWidth(n));n+=1}return o}e.htmlImageCache={},e.draw=function(o){var S=this;if(!e.dispatchEvent("beforedraw",{})&&(e.isChildGrid||e.height&&e.width))if(e.isChildGrid&&o)requestAnimationFrame(e.parentGrid.draw);else if(!1!==e.intf.visible){var R,B,T,I,M,k,A,z,O,H,E,P,L,D,F,W,N,G,j,_,V,U=e.viewData||[],Z="collapse"===e.style.gridBorderCollapse,K=[],q=[],Y=[],X=[],J=U.length,Q=e.currentCell||{},$=e.getColumnHeaderCellHeight(),ee=e.getRowHeaderCellWidth(),te=e.getRowGroupAreaWidth(),oe=e.getColumnGroupAreaHeight(),re={},ne={},le={},ie=e.getCollapsedColumnGroups(),ae=e.getCollapsedRowGroups(),se=e.style.cellHeight,ce=0,de=e.hiddenRowRanges.map(function(e){return _newArrowCheck(this,S),{from:e[0],plus:e[1]-e[0]+1}}.bind(this)).sort(function(e,t){return _newArrowCheck(this,S),e.from-t.from}.bind(this));r+=1,B=performance.now(),e.visibleRowHeights=[],U.length>e.orders.rows.length&&e.createRowOrders(),e.ctx.save(),function(){e.visibleRows=[],D=e.getSchema(),e.visibleCells=[],e.visibleGroups=[],e.visibleUnhideIndicators=[],e.canvasOffsetTop=e.isChildGrid?e.parentNode.offsetTop:.5,e.canvasOffsetLeft=e.isChildGrid?e.parentNode.offsetLeft:-.5,P=e.height,L=e.width;var t=de[0];t&&0===t.from&&(ce=t.plus,de.shift())}(),g(0,0,L,P,0),e.ctx.clip(),e.ctx.fillStyle=e.style.gridBackgroundColor,m(0,0,L,P),e.ctx.translate(te,oe),function(){var t=Math.min(U.length,e.frozenRow);for(H=-e.scrollBox.scrollLeft+e.scrollPixelLeft+e.style.cellBorderWidth,O=$,F=0;F<t&&ge(e.orders.rows[F],F);F+=1);e.attributes.allowFreezingRows&&(O>$&&(O+=e.style.frozenMarkerWidth),O+=e.style.frozenMarkerBorderWidth-.4999999999),e.lastFrozenRowPixel=O}(),function(){e.ctx.save(),e.frozenRow>0&&(g(0,e.lastFrozenRowPixel,e.width,e.height-e.lastFrozenRowPixel,0),e.ctx.clip());var t,o,r,n=D.length;for(H=-e.scrollBox.scrollLeft+e.scrollPixelLeft+e.style.cellBorderWidth,e.attributes.snapToRow||(O+=-e.scrollBox.scrollTop+e.scrollPixelTop+e.style.cellBorderWidth),F=e.frozenRow+e.scrollIndexTop;F<J&&(o=e.orders.rows[F],e.scrollIndexBottom=F,e.scrollPixelBottom=O,e.cellTree.rows.length>0&&Object.keys(e.cellTree.rows[o]).length>0&&e.cellTree.rows[o].hide||ge(o,F));F+=1);if(e.attributes.showNewRow){for(e.attributes.showRowHeaders&&(H+=ee),A=se=e.style.cellHeight,k=!1,t=e.scrollIndexLeft;t<n&&(ue(t)||(r=e.orders.columns[t],H+=fe(e.newRow,U.length,U.length)(D[r],r,t)),!(H>e.width+e.scrollBox.scrollLeft));t+=1);X.push([e.newRow,U.length,U.length,O,A])}e.ctx.restore()}(),function(){if(N){e.ctx.save();var t=e.activeCell.columnIndex+1>e.frozenColumn||e.activeCell.rowIndex+1>e.frozenRow;g(t?e.lastFrozenColumnPixel:0,t?e.lastFrozenRowPixel:0,t?e.width-e.lastFrozenColumnPixel:e.width,t?e.height-e.lastFrozenRowPixel:e.height,0),e.ctx.clip(),"row"===e.attributes.selectionMode?e.activeCell&&e.activeCell.rowIndex===N.rowIndex&&(e.ctx.lineWidth=e.style.activeCellOverlayBorderWidth,e.ctx.strokeStyle=e.style.activeCellOverlayBorderColor,p(1,N.y,e.getHeaderWidth()+ee,e.visibleRowHeights[N.rowIndex])):(e.ctx.lineWidth=e.style.activeCellOverlayBorderWidth,e.ctx.strokeStyle=e.style.activeCellOverlayBorderColor,p(N.x,N.y,N.width,N.height)),e.ctx.restore()}}(),function(){var t,o,r,n,l,i,a=D.length;function s(i,s){for(s=Math.min(s,a),r=i;r<s&&(o=e.orders.columns[r],(l=D[o]).hidden||ue(r)||(t={title:l.title,name:l.name,width:l.width||e.style.cellWidth,style:"columnHeaderCell",type:"string",index:r,order:o},n={columnHeaderCell:l.title||l.name},!((H+=fe(n,-1,-1)(t,o,r))>e.width+e.scrollBox.scrollLeft)));r+=1);}X.forEach((function(t,o){O=t[3],se=t[4],o===e.frozenRow&&(e.ctx.save(),g(0,e.lastFrozenRowPixel,e.width,e.height-e.lastFrozenRowPixel,0),e.ctx.clip()),function(t,o,r){if(e.attributes.showRowHeaders){var n;H=0,n=e.viewData&&o<e.viewData.length?e.getBoundRowIndexFromViewRowIndex(o)+1:e.originalData?e.originalData.length+1:r+1;var l=e.hasActiveFilters()||e.hasCollapsedRowGroup()?n:o+1,i={rowHeaderCell:l+=ce},a={name:"rowHeaderCell",width:e.sizes.columns[-1]||e.style.rowHeaderCellWidth,style:"rowHeaderCell",type:"string",data:l,index:-1};if(k=e.openChildren[o],fe(i,r,o)(a,-1,-1),de[0]&&l>=de[0].from){var s=de.shift().plus;ce+=s}}}(t[0],t[1],t[2])})),e.ctx.restore(),e.attributes.showColumnHeaders&&(H=-e.scrollBox.scrollLeft+e.scrollPixelLeft+e.style.columnHeaderCellBorderWidth,e.attributes.showRowHeaders&&(H+=ee),O=0,se=e.getColumnHeaderCellHeight(),s(e.scrollIndexLeft,a),i=H,H=e.style.columnHeaderCellBorderWidth,e.attributes.showRowHeaders&&(H+=ee),s(0,e.frozenColumn),(H=i)<L&&(E={name:"",width:e.style.scrollBarWidth,style:"columnHeaderCellCap",isColumnHeaderCell:!0,isColumnHeaderCellCap:!0,type:"string",index:D.length},fe({endCap:""},-1,-1)(E,-1,-1)),e.attributes.showRowHeaders&&(z={cornerCell:""},H=0,E={name:"cornerCell",width:e.style.rowHeaderCellWidth,style:"cornerCell",type:"string",index:-1},fe(z,-1,-1)(E,-1,-1)))}(),function(){var t=e.lastFrozenRowPixel-e.style.frozenMarkerWidth,o=e.lastFrozenColumnPixel-e.style.frozenMarkerWidth,r=e.currentCell&&"frozen-row-marker"===e.currentCell.style,n=e.currentCell&&"frozen-column-marker"===e.currentCell.style,l=e.getRowHeaderCellWidth();if(e.ctx.lineWidth=e.style.frozenMarkerBorderWidth,e.attributes.allowFreezingColumns&&((!e.freezeMarkerPosition||e.freezeMarkerPosition&&"frozen-row-marker"===e.dragMode)&&(o>e.style.rowHeaderCellWidth&&(e.ctx.fillStyle=e.style.frozenMarkerColor,e.ctx.strokeStyle=e.style.frozenMarkerBorderColor,m(o,0,e.style.frozenMarkerWidth,e.height),p(o,0,e.style.frozenMarkerWidth,e.height)),e.ctx.fillStyle=n?e.style.frozenMarkerHoverColor:e.style.frozenMarkerHeaderColor,e.ctx.strokeStyle=n?e.style.frozenMarkerHoverBorderColor:e.style.frozenMarkerHeaderColor,m(o,0,e.style.frozenMarkerWidth,e.style.columnHeaderCellHeight),p(o,0,e.style.frozenMarkerWidth,e.style.columnHeaderCellHeight)),(!e.dragStartObject||e.dragStartObject&&"rowHeaderCell"!==e.dragStartObject.style)&&e.visibleCells.unshift({x:o,y:0,height:e.height,width:e.style.frozenMarkerWidth,style:"frozen-column-marker"})),e.attributes.allowFreezingRows){(!e.freezeMarkerPosition||e.freezeMarkerPosition&&"frozen-column-marker"===e.dragMode)&&(t>l&&(e.ctx.fillStyle=e.style.frozenMarkerColor,e.ctx.strokeStyle=e.style.frozenMarkerBorderColor,m(0,t,e.width,e.style.frozenMarkerWidth),p(0,t,e.width,e.style.frozenMarkerWidth)),e.ctx.fillStyle=r?e.style.frozenMarkerHoverColor:e.style.frozenMarkerHeaderColor,e.ctx.strokeStyle=r?e.style.frozenMarkerHoverBorderColor:e.style.frozenMarkerHeaderColor,m(0,t,l,e.style.frozenMarkerWidth),p(0,t,l,e.style.frozenMarkerWidth));var i=e.style.frozenMarkerWidth+e.style.frozenMarkerBorderWidth;(!e.dragStartObject||e.dragStartObject&&"columnHeaderCell"!==e.dragStartObject.style)&&e.visibleCells.unshift({x:0,y:t,height:i,width:e.width,style:"frozen-row-marker"}),ne={y:t,h:i}}if(e.freezeMarkerPosition)if(e.ctx.fillStyle=e.style.frozenMarkerActiveColor,e.ctx.strokeStyle=e.style.frozenMarkerActiveBorderColor,"frozen-column-marker"===e.dragMode){var a=e.freezeMarkerPosition.x,s=e.getCellAt(a,0);if(e.freezeMarkerPosition.isGrab&&(a=o),a>l){var c=s.x-e.style.frozenMarkerWidth-e.style.frozenMarkerBorderWidth;a>c+s.width/2&&(c+=s.width),e.ctx.fillStyle=e.style.frozenMarkerColor,e.ctx.strokeStyle=e.style.frozenMarkerBorderColor,m(c,0,e.style.frozenMarkerWidth,e.height),p(c,0,e.style.frozenMarkerWidth,e.height),e.ctx.fillStyle=e.style.frozenMarkerHeaderColor,e.ctx.strokeStyle=e.style.frozenMarkerHeaderColor,m(c,0,e.style.frozenMarkerWidth,e.style.columnHeaderCellHeight),p(c,0,e.style.frozenMarkerWidth,e.style.columnHeaderCellHeight)}e.ctx.fillStyle=e.style.frozenMarkerActiveHeaderColor,e.ctx.strokeStyle=e.style.frozenMarkerActiveBorderColor,m(a,0,e.style.frozenMarkerWidth,e.style.columnHeaderCellHeight),p(a,0,e.style.frozenMarkerWidth,e.style.columnHeaderCellHeight),e.ctx.fillStyle=e.style.frozenMarkerActiveColor,m(a,0,e.style.frozenMarkerWidth,e.height),p(a,0,e.style.frozenMarkerWidth,e.height)}else{var d=e.freezeMarkerPosition.y,u=e.getCellAt(0,d);if(e.freezeMarkerPosition.isGrab&&(d=t),d>e.style.columnHeaderCellHeight){var h=u.y-e.style.frozenMarkerWidth-e.style.frozenMarkerBorderWidth;d>h+u.height/2&&(h+=u.height),e.ctx.fillStyle=e.style.frozenMarkerColor,e.ctx.strokeStyle=e.style.frozenMarkerBorderColor,m(0,h,e.width,e.style.frozenMarkerWidth),p(0,h,e.width,e.style.frozenMarkerWidth),e.ctx.fillStyle=e.style.frozenMarkerHeaderColor,e.ctx.strokeStyle=e.style.frozenMarkerHeaderColor,m(0,h,l,e.style.frozenMarkerWidth),p(0,h,l,e.style.frozenMarkerWidth)}e.ctx.fillStyle=e.style.frozenMarkerActiveHeaderColor,e.ctx.strokeStyle=e.style.frozenMarkerActiveBorderColor,m(0,d,l,e.style.frozenMarkerWidth),p(0,d,l,e.style.frozenMarkerWidth),e.ctx.fillStyle=e.style.frozenMarkerActiveColor,m(0,d,e.width,e.style.frozenMarkerWidth),p(0,d,e.width,e.style.frozenMarkerWidth)}}(),(e.mobile||e.attributes.allowMovingSelection)&&e.attributes.editable&&(e.ctx.lineWidth=e.style.selectionHandleBorderWidth,e.ctx.strokeStyle=e.style.selectionHandleBorderColor,e.ctx.fillStyle=e.style.selectionHandleColor,Y.forEach((function(t){!function(t,o){var r=e.style.selectionHandleSize;({tr:function(){y(t.x+t.width,t.y,r),x(t.x+t.width,t.y,r)},br:function(){y(t.x+t.width,t.y+t.height,r),x(t.x+t.width,t.y+t.height,r)},tl:function(){y(t.x,t.y,r),x(t.x,t.y,r)},bl:function(){y(t.x,t.y+t.height,r),x(t.x,t.y+t.height,r)}})[o]()}(t[0],t[1]);var o=e.attributes.touchSelectHandleZone/2,r=t[0].x+("tl"===t[1]||"bl"===t[1]?0:t[0].width)-o,n=t[0].y+("bl"===t[1]||"br"===t[1]?t[0].height:0)-o;e.visibleCells.unshift({x:r,y:n,height:e.style.selectionHandleSize+o,width:e.style.selectionHandleSize+o,style:"selection-handle-"+t[1]})}))),function(){if(e.reorderObject){var t={height:e.reorderObject.height,width:e.reorderObject.width,x:e.reorderObject.x+e.reorderObject.dragOffset.x,y:e.reorderObject.y+e.reorderObject.dragOffset.y},o={width:L,height:P,x:0,y:0};e.ctx.fillStyle=e.style.reorderMarkerBackgroundColor,e.ctx.lineWidth=e.style.reorderMarkerBorderWidth,e.ctx.strokeStyle=e.style.reorderMarkerBorderColor,"row-reorder"===e.dragMode?(t.height=e.getSelectedRowsHeight(),t.width=L,t.x=0,o.width=L,o.height=e.currentCell.height,o.y=e.currentCell.y,m(t.x,t.y,t.width,t.height),p(t.x,t.y,t.width,t.height),e.ctx.lineWidth=e.style.reorderMarkerIndexBorderWidth,e.ctx.strokeStyle=e.style.reorderMarkerIndexBorderColor,!e.isRowSelected(e.reorderTarget.sortRowIndex)&&e.currentCell.rowIndex!==e.reorderObject.rowIndex&&e.currentCell.rowIndex>-1&&e.currentCell.rowIndex<J&&C(o,e.reorderTarget.sortRowIndex>e.reorderObject.sortRowIndex?"b":"t")):"column-reorder"===e.dragMode&&e.reorderObject&&(t.width=e.getSelectedColumnsWidth(),t.height=P,t.y=0,o.height=P,o.width=e.currentCell.width,o.y=0,o.x=e.currentCell.x,m(t.x,t.y,t.width,t.height),p(t.x,t.y,t.width,t.height),e.ctx.lineWidth=e.style.reorderMarkerIndexBorderWidth,e.ctx.strokeStyle=e.style.reorderMarkerIndexBorderColor,!e.isColumnSelected(e.reorderTarget.sortColumnIndex)&&e.currentCell.sortColumnIndex!==e.reorderObject.sortColumnIndex&&e.reorderTarget.columnIndex!==e.reorderObject.columnIndex&&e.currentCell.sortColumnIndex>-1&&e.currentCell.sortColumnIndex<D.length&&C(o,e.reorderTarget.columnIndex>e.reorderObject.columnIndex?"r":"l"))}}(),e.movingSelection&&(e.ctx.lineWidth=e.style.moveOverlayBorderWidth,e.ctx.strokeStyle=e.style.moveOverlayBorderColor,e.ctx.setLineDash(e.style.moveOverlayBorderSegments),q.forEach((function(e){C(e[0],e[1])})),e.ctx.setLineDash([])),function(){if(e.attributes.resizeAfterDragged&&e.draggingItem&&e.pendingDragResize&&("ew-resize"==e.dragMode||"ns-resize"==e.dragMode)){var t="ns-resize"==e.dragMode,o=t?e.style.resizeMarkerSize:e.height,r=t?e.width:e.style.resizeMarkerSize,n=e.dragStart.x-(e.resizingStartingWidth-e.style.minColumnWidth),l=e.dragStart.y-(e.resizingStartingHeight-e.style.minRowHeight),i=t?0:Math.max(e.pendingDragResize.x,n),a=t?Math.max(e.pendingDragResize.y,l):0;e.ctx.fillStyle=e.style.resizeMarkerColor,m(i,a,r,o)}}(),e.ctx.lineWidth=e.style.gridBorderWidth,e.ctx.strokeStyle=e.style.gridBorderColor,p(0,0,e.width,e.height),function(){function t(t){e.fillOverlay.handle||(e.ctx.lineWidth=e.style.selectionOverlayBorderWidth,e.ctx.strokeStyle=e.style.selectionOverlayBorderColor,C(t[0],t[1]))}K.filter((function(t){return t[0].rowIndex<e.frozenRow&&t[0].columnIndex<e.frozenColumn})).forEach(t),e.ctx.save(),v(0),K.filter((function(t){return t[0].rowIndex>=e.frozenRow&&t[0].columnIndex>=e.frozenColumn})).forEach(t),e.ctx.restore(),e.ctx.save(),v(1),K.filter((function(t){return t[0].rowIndex>=e.frozenRow&&t[0].columnIndex<e.frozenColumn})).forEach(t),e.ctx.restore(),e.ctx.save(),v(2),K.filter((function(t){return t[0].rowIndex<e.frozenRow&&t[0].columnIndex>=e.frozenColumn})).forEach(t),e.ctx.restore(),function(){if(!e.fillOverlay.handle||!e.fillOverlay.snapTo)return;e.ctx.save();var t=e.fillOverlay,o=t.handle,r=t.snapTo.x,n=t.snapTo.y,l=t.snap,i="x"===t.direction?l?l.x+(t.x<r?0:l.width):t.x:o.x,a=void 0===t.direction||"y"===t.direction?l?l.y+(t.y<n?0:l.height):t.y:o.y,s=Math.max(Math.min(r,i),t.minX),c=Math.max(Math.min(n,a),t.minY),d=Math.max(r,i)-s,u=Math.max(n,a)-c;e.ctx.strokeStyle=e.style.fillOverlayBorderColor,e.ctx.lineWidth=e.style.fillOverlayBorderWidth,e.ctx.setLineDash([3,3]),p(s,c,d,u),e.ctx.setLineDash([]),e.ctx.restore()}()}(),j=e.scrollBox.entities,_=2*e.style.scrollBarBoxMargin,e.ctx.strokeStyle=e.style.scrollBarBorderColor,e.ctx.lineWidth=e.style.scrollBarBorderWidth,e.frozenColumn>0?j.horizontalBox.x=ee+e.style.scrollBarBoxMargin+e.scrollCache.x[e.frozenColumn-1]+(j.horizontalBar.width-e.scrollCache.x[e.frozenColumn-1]-e.scrollBox.scrollBoxWidth)*(e.scrollBox.scrollLeft/e.scrollBox.scrollWidth):j.horizontalBox.x=ee+e.style.scrollBarBoxMargin+(j.horizontalBar.width-e.scrollBox.scrollBoxWidth)*(e.scrollBox.scrollLeft/e.scrollBox.scrollWidth),j.verticalBox.y=$+e.style.scrollBarBoxMargin+e.scrollCache.y[e.frozenRow]+(j.verticalBar.height-e.scrollBox.scrollBoxHeight-e.scrollCache.y[e.frozenRow])*(e.scrollBox.scrollTop/e.scrollBox.scrollHeight),e.scrollBox.horizontalBarVisible&&(e.ctx.fillStyle=e.style.scrollBarBackgroundColor,m(j.horizontalBar.x,j.horizontalBar.y,j.horizontalBar.width+_,j.horizontalBar.height),p(j.horizontalBar.x,j.horizontalBar.y,j.horizontalBar.width+_,j.horizontalBar.height),e.ctx.fillStyle=e.style.scrollBarBoxColor,e.scrollBox.horizontalBoxVisible&&(/horizontal/.test(Q.context)&&(e.ctx.fillStyle=e.style.scrollBarActiveColor),g(j.horizontalBox.x,j.horizontalBox.y,j.horizontalBox.width,j.horizontalBox.height,e.style.scrollBarBoxBorderRadius),e.ctx.stroke(),e.ctx.fill()),G=!0,e.visibleCells.unshift(j.horizontalBar),e.visibleCells.unshift(j.horizontalBox)),e.scrollBox.verticalBarVisible&&(e.ctx.fillStyle=e.style.scrollBarBackgroundColor,m(j.verticalBar.x,j.verticalBar.y,j.verticalBar.width,j.verticalBar.height+_),p(j.verticalBar.x,j.verticalBar.y,j.verticalBar.width,j.verticalBar.height+_),e.scrollBox.verticalBoxVisible&&(e.ctx.fillStyle=e.style.scrollBarBoxColor,/vertical/.test(Q.context)&&(e.ctx.fillStyle=e.style.scrollBarActiveColor),g(j.verticalBox.x,j.verticalBox.y,j.verticalBox.width,j.verticalBox.height,e.style.scrollBarBoxBorderRadius),e.ctx.stroke(),e.ctx.fill()),G=!0,e.visibleCells.unshift(j.verticalBar),e.visibleCells.unshift(j.verticalBox)),G&&(e.ctx.strokeStyle=e.style.scrollBarCornerBorderColor,e.ctx.fillStyle=e.style.scrollBarCornerBackgroundColor,g(j.corner.x,j.corner.y,j.corner.width,j.corner.height,0),e.ctx.stroke(),e.ctx.fill(),e.visibleCells.unshift(j.corner)),R&&e.resize(!0),function(){var t=te,o=oe,r=b(),n=ne.y+ne.h-$,l="left"===e.attributes.columnGroupIndicatorPosition,i="top"===e.attributes.rowGroupIndicatorPosition,a=e.ctx;a.save(),a.fillStyle=e.style.groupingAreaBackgroundColor,m(0,-o,L,o),m(-t,-o,t,P),a.restore();for(var s=[],c=0;c<e.groupedColumns.length;c++)for(var h=e.groupedColumns[c],f=0;f<h.length;f++)s.push(Object.assign({row:c},h[f]));s.length>0&&function(){for(var n=e.style.columnGroupRowHeight,i=.5*n,c=.5*(n-i),h=function(h){var f=this,g=s[h],m=g.row,p=g.collapsed,w=m*n-o,v=w+.5*n,y=w+n-c,x=ee-i-c,C=function(e){return _newArrowCheck(this,f),u(e,w+c,i,g.collapsed)}.bind(this),b=function(r,n){return _newArrowCheck(this,f),e.visibleGroups.push({type:"c",collapsed:p,from:g.from,to:g.to,row:m,x:r+t,y:w+o,x2:n+t,y2:y+o})}.bind(this),S=g.from<e.frozenColumn&&g.to>=e.frozenColumn,R=g.from>=e.frozenColumn;if(p){var B=x+i;if(g.from>0){var T=g.to+1,I=le[T];if(I)B=I.x+c;else{if(T=g.from-1,!(I=le[T]))return"continue";B=I.x+I.w-.5*i}if(T>=e.frozenColumn)if(B<r+ee-c)return"continue"}var M=B+i;a.save(),a.strokeStyle=e.style.groupIndicatorColor,a.fillStyle=e.style.groupIndicatorBackgroundColor,C(B),a.restore(),b(B,M)}var k=void 0,A=le[g.from],z=le[g.to],O=!0,H=!0;for(k=g.from;!A&&k<g.to;)A=le[++k],O=!1;for(k=g.to;!z&&k>g.from;)z=le[--k],H=!1;if(!A||!z)return"continue";var E=z.x+z.w,P=A.x;if(S){var L=le[e.frozenColumn-1];if(L){var D=L.x+L.w;l||(D+=i),D>=E&&(E=(z=L).x+z.w,H=!1)}}var F=ee+(R?r:0);if(E+(l?0:i)<F)return"continue";E-=c,P+=c,a.save(),a.strokeStyle=e.style.groupIndicatorColor,a.fillStyle=e.style.groupIndicatorBackgroundColor;var W=[];l?(P<(F+=2*c)&&(P=F),0===g.from&&(P-=2*c),E>=P?(W.push(P,v,E,v),H&&W.push(E,y)):E=P,C(P-=i),E+=c-1):(P<F&&(P=F),0===g.from&&(P-=2*c),H&&(g.to===e.frozenColumn-1?E-=i:E+=2*c,C(E)),P>E?P=E:(0===g.from&&(O=!0,P=x+i),O&&W.push(P,y),W.push(P,v,E,v)),P-=c+1,H&&(E+=i)),d(W),a.restore(),b(P,E)},f=0;f<s.length;f++)h(f)}();for(var g=[],p=0;p<e.groupedRows.length;p++)for(var w=e.groupedRows[p],v=0;v<w.length;v++)g.push(Object.assign({col:p},w[v]));g.length>0&&function(){for(var r=e.style.rowGroupColumnWidth,l=.5*r,s=.5*(r-l),c=function(c){var h=this,f=g[c],m=f.col,p=f.collapsed,w=m*r-t,v=w+.5*r,y=w+r-s,x=$-l-s,C=function(e){return _newArrowCheck(this,h),u(w+s,e,l,f.collapsed)}.bind(this),b=function(r,n){return _newArrowCheck(this,h),e.visibleGroups.push({type:"r",collapsed:p,from:f.from,to:f.to,col:m,x:w+t,y:r+o,x2:y+t,y2:n+o})}.bind(this),S=f.from<e.frozenRow&&f.to>=e.frozenRow,R=f.from>=e.frozenRow;if(p){var B=x+l;if(f.from>0){var T=f.to+1,I=re[T];if(I)B=I.y;else{if(T=f.from-1,!(I=re[T]))return"continue";B=I.y+I.h-.5*l}if(T>=e.frozenRow)if(B<n+$-s)return"continue"}var M=B+l;a.save(),a.strokeStyle=e.style.groupIndicatorColor,a.fillStyle=e.style.groupIndicatorBackgroundColor,C(B),a.restore(),b(B,M)}var k=void 0,A=re[f.from],z=re[f.to],O=!0,H=!0;for(k=f.from;!A&&k<f.to;)A=re[++k],O=!1;for(k=f.to;!z&&k>f.from;)z=re[--k],H=!1;if(!A||!z)return"continue";var E=z.y+z.h,P=A.y;if(S){var L=re[e.frozenRow-1];if(L){var D=L.y+L.h;i||(D+=l),D>=E&&(E=(z=L).y+z.h,H=!1)}}var F=$+(R?n:0);if(E+(i?0:l)<F)return"continue";E-=s,P+=s,a.save(),a.strokeStyle=e.style.groupIndicatorColor,a.fillStyle=e.style.groupIndicatorBackgroundColor;var W=[];i?(P<(F+=2*s)&&(P=F),0===f.from&&(P-=2*s),E>=P?(W.push(v,P,v,E),H&&W.push(y,E)):E=P,C(P-=l),E+=s-1):(P<F&&(P=F),0===f.from&&(P-=2*s),H&&(f.to===e.frozenRow-1&&(E-=l),C(E)),P>E?P=E:(0===f.from&&(O=!0,P=x+l),O&&W.push(y,P),W.push(v,P,v,E),P-=s+1),H&&(E+=l)),d(W),a.restore(),b(P,E)},h=0;h<g.length;h++)c(h)}()}(),e.ctx.save(),(e.attributes.showPerformance||e.attributes.debug)&&(0===t.length&&(t=s(0,n,1,0)),t.pop(),t.unshift(performance.now()-B)),e.attributes.debug?(e.ctx.font=e.style.debugFont,(V={}).perf=(t.reduce((function(e,t){return e+t}),0)/Math.min(r,t.length)).toFixed(1),V.perfDelta=t[0].toFixed(1),V.frozenColumnsWidth=b(),V.htmlImages=Object.keys(e.htmlImageCache).length,V.reorderObject="x: "+(e.reorderObject||{columnIndex:0}).columnIndex+", y: "+(e.reorderObject||{rowIndex:0}).rowIndex,V.reorderTarget="x: "+(e.reorderTarget||{columnIndex:0}).columnIndex+", y: "+(e.reorderTarget||{rowIndex:0}).rowIndex,V.scale=e.scale,V.startScale=e.startScale,V.scaleDelta=e.scaleDelta,V.zoomDeltaStart=e.zoomDeltaStart,V.touchLength=e.touchLength,V.touches="y0: "+(e.touchPosition||{y:0}).y+" y1: "+(e.touchPosition1||{y:0}).y,V.scrollBox=e.scrollBox.toString(),V.scrollIndex="x: "+e.scrollIndexLeft+", y: "+e.scrollIndexTop,V.scrollPixel="x: "+e.scrollPixelLeft+", y: "+e.scrollPixelTop,V.canvasOffset="x: "+e.canvasOffsetLeft+", y: "+e.canvasOffsetTop,V.touchDelta="x: "+e.touchDelta.x+", y: "+e.touchDelta.y,V.touchAnimateTo="x: "+e.touchAnimateTo.x+", y: "+e.touchAnimateTo.y,V.scrollAnimation="x: "+e.scrollAnimation.x+", y: "+e.scrollAnimation.y,V.touchPPS="x: "+e.xPPS+", y: "+e.yPPS,V.touchPPST="x: "+e.xPPST+", y: "+e.yPPST,V.touchDuration=e.touchDuration,V.pointerLockPosition=e.pointerLockPosition?e.pointerLockPosition.x+", "+e.pointerLockPosition.y:"",V.size="w: "+e.width+", h: "+e.height,V.mouse="x: "+e.mouse.x+", y: "+e.mouse.y,V.touch=e.touchStart?"x: "+e.touchStart.x+", y: "+e.touchStart.y:"",V.entities=e.visibleCells.length,V.hasFocus=e.hasFocus,V.dragMode=e.dragMode,e.currentCell&&(V.columnIndex=e.currentCell.columnIndex,V.rowIndex=e.currentCell.rowIndex,V.sortColumnIndex=e.currentCell.sortColumnIndex,V.sortRowIndex=e.currentCell.sortRowIndex,V.context=e.currentCell.context,V.dragContext=e.currentCell.dragContext,V.style=e.currentCell.style,V.type=e.currentCell.type),e.ctx.textAlign="right",e.ctx.fillStyle=e.style.debugBackgroundColor,m(0,0,e.width,e.height),Object.keys(V).forEach((function(t,o){var r=t+": "+V[t];e.ctx.fillStyle=e.style.debugColor,w(r,L-20,(e.attributes.showPerformance?140:24)+14*o)})),e.ctx.restore()):e.ctx.restore(),function(){if(e.attributes.showPerformance){var o=250,r=e.width-o-e.style.scrollBarWidth-2*e.style.scrollBarBorderWidth,c=$,d=100;0===i.length&&(i=s(0,n,1,(function(){return[0,0]}))),0===a.length&&(a=s(0,n,1,(function(){return[0,0]}))),0===l.length&&(l=s(0,n,1,0)),e.ctx.lineWidth=.5,e.ctx.textAlign="left",e.ctx.font=e.style.debugFont,e.ctx.fillStyle=e.style.debugPerfChartBackground,m(r,c,o,d),[["Scroll Height",i,0,e.scrollBox.scrollHeight,e.style.debugScrollHeightColor,!1],["Scroll Width",i,1,e.scrollBox.scrollWidth,e.style.debugScrollWidthColor,!1],["Performance",t,void 0,200,e.style.debugPerformanceColor,!1],["Entities",l,void 0,1500,e.style.debugEntitiesColor,!1],["TouchPPSX",a,0,1e3,e.style.debugTouchPPSXColor,!0],["TouchPPSY",a,1,1e3,e.style.debugTouchPPSYColor,!0]].forEach((function(e,t){e.push(t),u.apply(null,e)})),e.ctx.fillStyle=e.style.debugPerfChartBackground,l.pop(),l.unshift(e.visibleCells.length),i.pop(),i.unshift([e.scrollBox.scrollTop,e.scrollBox.scrollLeft]),a.pop(),a.unshift([e.yPPS,e.xPPS])}function u(t,n,l,i,a,s,u){var h;!function(t,o,r,n,l,i,a,s,c){var d=t/l.length,u=o/a;r+=e.canvasOffsetLeft,n+=e.canvasOffsetTop,e.ctx.beginPath(),e.ctx.moveTo(r,n+o),l.forEach((function(t){var l,a,s=void 0===i?t:t[i];c&&(s=Math.abs(s)),l=r+d,a=n+o-s*u,e.ctx.lineTo(l,a),r+=d})),e.ctx.moveTo(r+t,n+o),e.ctx.strokeStyle=s,e.ctx.stroke()}(o,d,r,c,n,l,i,a,s),e.ctx.fillStyle=a,m(3+r,c+9+11*u,8,8),e.ctx.fillStyle=e.style.debugPerfChartTextColor,h=void 0!==l?n[0][l]:n[0],w(t+" "+(isNaN(h)?0:h).toFixed(3),14+r,c+16+11*u)}}(),e.dispatchEvent("afterdraw",{})||e.ctx.restore()}function ue(e){var t=this;return ie.findIndex(function(o){return _newArrowCheck(this,t),e>=o.from&&e<=o.to}.bind(this))>=0}function he(t,o,r,n){var l=this;t.selectionBorder="";var i=n?function(t,o){return _newArrowCheck(this,l),isCellSelected(e.selections,t-n.y,o-n.x)}.bind(this):function(t,o){return _newArrowCheck(this,l),isCellSelected(e.selections,t,o)}.bind(this),a=Math.max(D.length-1,0),s=Math.max(U.length-1,0),c=t.isRowHeader,d=t.rowIndex,u=t.columnIndex;!c&&i(d,u)&&(i(d-1,u)&&0!==d||t.isHeader||(o.push([t,"t"]),t[r+"BorderTop"]=!0,t[r+"Border"]+="t"),(d>=s||!i(d+1,u))&&(o.push([t,"b"]),t[r+"BorderBottom"]=!0,t[r+"Border"]+="b"),0!==u&&i(d,u-1)||(o.push([t,"l"]),t[r+"BorderLeft"]=!0,t[r+"Border"]+="l"),(u>=a||!i(d,u+1))&&(o.push([t,"r"]),t[r+"BorderRight"]=!0,t[r+"Border"]+="r"))}function fe(t,o,r){var n=e.orders.rows[e.activeCell.rowIndex]===o||e.isRowSelected(o);return function(l,i,a){var s=this;if(l.hidden)return 0;var d,u,v,y=l.style||"cell",x=/HeaderCell/.test(y),C=/cornerCell/.test(y),b="rowHeaderCell"===y,S="columnHeaderCell"===y,B=e.filterable.rows.includes(r)&&e.filterable.columns.includes(i),M="nowrap"!==e.style.cellWhiteSpace,z=isCellSelected(e.selections,o,a),E=e.hovers.rowIndex===o&&("row"===e.attributes.hoverMode||e.hovers.columnIndex===a),P=e.selectedFilterButton.rowIndex==r&&e.selectedFilterButton.columnIndex==i,F=e.activeCell.rowIndex===o&&e.activeCell.columnIndex===a,W="columnHeaderCellCap"===y,G=t?t[l.name]:void 0,j="canvas-datagrid"===l.type,_=e.formatters[l.type||"string"],V=0,U=0,X=e.sizes.columns[i]||l.width,J={value:G,row:t,header:l},Q=!1;if(!(e.orders.columns[e.activeCell.columnIndex]===i||e.isColumnSelected(e.activeCell.viewColumnIndex))&&!n||-1!==a&&-1!==o||(Q=b?"activeRowHeaderCell":"activeColumnHeaderCell"),W&&(X=L-H),void 0===X&&(X=e.style.cellWidth),X*=e.scale,H+X+e.style.cellBorderWidth<0&&(H+=X+e.style.cellBorderWidth),F&&"cornerCell"!==y&&(y="activeCell"),-1!==e.visibleRows.indexOf(r)||x||e.visibleRows.push(r),v=e.dispatchEvent("formatcellvalue",J),T=H,I=O,"cornerCell"===y?(T=0,I=0):b?T=0:x&&(I=0),(u={type:j?"canvas-datagrid-cell":l.type,style:y,nodeType:"canvas-datagrid-cell",x:T,y:I,fontHeight:(e.style[y+"FontHeight"]||0)*e.scale,horizontalAlignment:e.style[y+"HorizontalAlignment"],verticalAlignment:e.style[y+"VerticalAlignment"],paddingLeft:(e.style[y+"PaddingLeft"]||0)*e.scale,paddingTop:(e.style[y+"PaddingTop"]||0)*e.scale,paddingRight:(e.style[y+"PaddingRight"]||0)*e.scale,paddingBottom:(e.style[y+"PaddingBottom"]||0)*e.scale,whiteSpace:e.style.cellWhiteSpace,lineHeight:e.style.cellLineHeight,lineSpacing:e.style.cellLineSpacing,offsetTop:e.canvasOffsetTop+I,offsetLeft:e.canvasOffsetLeft+T,scrollTop:e.scrollBox.scrollTop,scrollLeft:e.scrollBox.scrollLeft,active:F||Q,hovered:E,selected:z,width:X,height:se,offsetWidth:X,offsetHeight:se,parentNode:e.intf.parentNode,offsetParent:e.intf.parentNode,data:t,isCorner:C,isHeader:x,isColumnHeader:S,isColumnHeaderCellCap:W,isRowHeader:b,isFilterable:B,openedFilter:P,rowOpen:k,header:l,columnIndex:a,rowIndex:o,viewRowIndex:o,viewColumnIndex:a,boundRowIndex:e.getBoundRowIndexFromViewRowIndex(o),boundColumnIndex:e.getBoundColumnIndexFromViewColumnIndex(a),sortColumnIndex:i,sortRowIndex:r,isGrid:j,isNormal:!j&&!C&&!x,gridId:(e.attributes.name||"")+r+":"+i,parentGrid:e.intf,innerHTML:"",activeHeader:Q,value:x&&!b?l.title||l.name:G,isRowTree:o>=0&&a==e.cellTree.rowTreeColIndex&&e.cellTree.rows.length>0&&e.cellTree.rows[o].icon,isColumnTree:a>=0&&e.cellTree.columns[o]&&e.cellTree.columns[o][a].icon}).calculatedLineHeight=u.fontHeight*u.lineHeight+u.lineSpacing,u.paddedWidth=u.width-u.paddingRight-u.paddingLeft,u.paddedHeight=u.height-u.paddingTop-u.paddingBottom,J.cell=u,u.userHeight=u.isHeader?e.sizes.rows[-1]:A,u.userWidth=u.isHeader?e.sizes.columns.cornerCell:e.sizes.columns[i],e.visibleCells.unshift(u),function(e){var t=e.boundRowIndex;if(t>=-1==0){if(-1!==e.rowIndex)return;t=-1}re[t]||(re[t]={y:e.y,h:e.height})}(u),function(e){var t=e.columnIndex;le[t]||(le[t]={x:e.x,w:e.width})}(u),!e.dispatchEvent("beforerendercell",J)){if(e.ctx.fillStyle=e.style[y+"BackgroundColor"],e.ctx.strokeStyle=e.style[y+"BorderColor"],e.ctx.lineWidth=e.style[y+"BorderWidth"],E&&(e.ctx.fillStyle=e.style[y+"HoverBackgroundColor"],e.ctx.strokeStyle=e.style[y+"HoverBorderColor"]),z&&(e.ctx.fillStyle=e.style[y+"SelectedBackgroundColor"],e.ctx.strokeStyle=e.style[y+"SelectedBorderColor"]),Q&&(e.ctx.fillStyle=e.style[Q+"BackgroundColor"]),e.dispatchEvent("rendercell",J),u.isGrid&&(u.height!==A&&(u.height=A||e.style.cellHeightWithChildGrid,R=!0),u.width=e.sizes.columns[i]||e.style.cellWidthWithChildGrid),k&&!u.isRowHeader&&(u.height=e.sizes.rows[r]||e.style.cellHeight),u.isGrid||(m(T,I,u.width,u.height),p(T,I,u.width,u.height)),e.ctx.save(),g(u.x,u.y,u.width,u.height,0),e.ctx.clip(),e.dispatchEvent("afterrendercell",J),u.height===se||k&&!u.isRowHeader||(e.sizes.rows[x?-1:r]=u.height,R=!0),u.width!==X&&(e.sizes.columns[i]=u.width,R=!0),b&&e.attributes.tree&&(e.dispatchEvent("rendertreearrow",J)||(U=function(t,o,r){var n=e.style.treeArrowMarginTop*e.scale,l=e.style.treeArrowMarginRight*e.scale,i=e.style.treeArrowMarginLeft*e.scale,a=e.style.treeArrowWidth*e.scale,s=e.style.treeArrowHeight*e.scale;return o+=e.canvasOffsetLeft,r+=e.canvasOffsetTop,e.ctx.fillStyle=e.style.treeArrowColor,e.ctx.strokeStyle=e.style.treeArrowBorderColor,e.ctx.beginPath(),o+=i,r+=n,e.openChildren[t.rowIndex]?(e.ctx.moveTo(o,r),e.ctx.lineTo(o+a,r),e.ctx.lineTo(o+.5*a,r+s),e.ctx.moveTo(o,r)):(e.ctx.lineTo(o,r),e.ctx.lineTo(o+s,r+.5*a),e.ctx.lineTo(o,r+a),e.ctx.lineTo(o,r)),e.ctx.stroke(),e.ctx.fill(),i+a+l}(u,e.style[y+"PaddingLeft"],I))),e.attributes.showRowNumbers&&b||!b)if(u.isGrid&&!e.dispatchEvent("beforerendercellgrid",J)){if(!e.childGrids[u.gridId]){if((d=e.cellGridAttributes).name=e.attributes.saveAppearance?u.gridId:void 0,d.component=!1,d.parentNode=u,d.data=G,J.cellGridAttributes=d,e.dispatchEvent("beforecreatecellgrid",J))return;e.childGrids[u.gridId]=e.createGrid(d),e.sizes.rows[r]=e.sizes.rows[r]||e.style.cellGridHeight,R=!0}u.grid=e.childGrids[u.gridId],u.grid.parentNode=u,u.grid.visible=!0,u.grid.draw(),e.dispatchEvent("rendercellgrid",J)}else if(!u.isGrid&&(e.childGrids[u.gridId]&&(e.childGrids[u.gridId].parentNode.offsetHeight=0),x&&e.orderBy===l.name&&(e.dispatchEvent("renderorderbyarrow",J)||(V=function(t,o){var r=e.style.columnHeaderOrderByArrowMarginTop*e.scale,n=e.style.columnHeaderOrderByArrowMarginLeft*e.scale,l=e.style.columnHeaderOrderByArrowMarginRight*e.scale,i=e.style.columnHeaderOrderByArrowWidth*e.scale,a=e.style.columnHeaderOrderByArrowHeight*e.scale;return t+=e.canvasOffsetLeft,o+=e.canvasOffsetTop,e.ctx.fillStyle=e.style.columnHeaderOrderByArrowColor,e.ctx.strokeStyle=e.style.columnHeaderOrderByArrowBorderColor,e.ctx.beginPath(),t+=n,o+=r,"asc"===e.orderDirection?(e.ctx.lineTo(t,o+a),e.ctx.lineTo(t+i,o+a),e.ctx.lineTo(t+.5*i,o),e.ctx.lineTo(t,o+a)):(e.ctx.moveTo(t,o),e.ctx.lineTo(t+i,o),e.ctx.lineTo(t+.5*i,o+a),e.ctx.moveTo(t,o)),e.ctx.stroke(),e.ctx.fill(),n+i+l}(T+e.style[y+"PaddingLeft"],0))),e.ctx.fillStyle=e.style[y+"Color"],E&&(e.ctx.fillStyle=e.style[y+"HoverColor"]),z&&(e.ctx.fillStyle=e.style[y+"SelectedColor"]),Q&&(e.ctx.fillStyle=e.style[Q+"Color"]),u.treeArrowWidth=U,u.orderByArrowWidth=V,void 0!==(v=void 0!==v?v:_?_(J):"")||_||(v="",console.warn("canvas-datagrid: Unknown format "+l.type+" add a cellFormater")),u.formattedValue=(null!=v?v:"").toString(),e.columnFilters&&void 0!==e.columnFilters[v]&&x&&(u.formattedValue=e.attributes.filterTextPrefix+v),e.ctx.font=e.style[y+"FontHeight"]*e.scale+"px "+e.style[y+"FontName"],e.dispatchEvent("formattext",J)||(u.text=function(t,o){var r=this;if(!t.formattedValue)return{lines:[{width:0,value:""}],width:0,height:t.calculatedLineHeight};var n,l,i,a,s,c,d=t.formattedValue.split(o),u=t.calculatedLineHeight,h=[],f="nowrap"!==e.style.cellWhiteSpace,g=e.attributes.autoResizeRows&&f,m=e.attributes.ellipsisText,p={width:0,value:""},w=f?t.paddedHeight:t.calculatedLineHeight;for(h.push(p),i=e.ctx.measureText(" "+m).width,n=0;n<d.length;n+=1){var v="-"===(l=d[n])[l.length-1]?"":o,y=e.ctx.measureText(l+v);if(p.width+y.width+i<t.paddedWidth)p.value+=l+v,p.width+=y.width;else if(/\w-\w/.test(l)&&t.paddedWidth<y.width){var x=l.split("-");x=x.map(function(e,t){return _newArrowCheck(this,r),t===x.length-1?e:e+"-"}.bind(this)),d.splice.apply(d,[n,1].concat(_toConsumableArray(x))),n-=1}else{if(p={width:y.width,value:l+v},0===n&&(h=[]).push(p),(u+=t.calculatedLineHeight)>w&&!g){if(0===h.length)break;if((c=h[h.length-1]).width<t.paddedWidth&&1===d.length)break;var C=s=c.value+l;if((a=e.ctx.measureText(s+m).width)>t.paddedWidth)for(var b=parseInt(s.length/2),S=-1;b>0;)s=C.substr(0,b*S+s.length),S=(a=e.ctx.measureText(s+m).width)>t.paddedWidth?-1:1,b=parseInt(b/2);s+=C.length!=s.length?m:"",c.value=s,c.width=a;break}n>0&&h.push(p)}}return{lines:h,width:0,height:t.calculatedLineHeight*h.length}}(u," ")),!e.dispatchEvent("rendertext",J))){if(u.innerHTML||"html"===l.type)c(u);else{var $=0,ee=!0;if(u.columnIndex==e.cellTree.rowTreeColIndex&&!u.isColumnHeader&&e.cellTree.rows.length>0&&Object.keys(e.cellTree.rows[u.rowIndex]).length>1&&($=f(u,e.cellTree.rows[u.rowIndex],!0)),!u.isRowHeader&&u.rowIndex>0&&e.cellTree.columns[u.rowIndex-1]&&e.cellTree.columns[u.rowIndex-1][u.columnIndex].icon)for(var te=u.rowIndex-1;te>=0&&e.cellTree.columns[te]&&e.cellTree.columns[te][u.columnIndex].icon;te--)if(!e.cellTree.columns[te][u.columnIndex].expand){ee=!1;break}ee&&!u.isRowHeader&&e.cellTree.columns[u.rowIndex]&&e.cellTree.columns[u.rowIndex][u.columnIndex].icon&&e.viewData.length>0&&e.viewData[u.rowIndex][u.columnIndex].length>0&&($=f(u,e.cellTree.columns[u.rowIndex][u.columnIndex],!1)),ee&&function(t){var o,r,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,l=(t.text.lines.length,t.fontHeight*t.lineHeight),i="nowrap"!==e.style.cellWhiteSpace,a=0;for(o=0;o<t.text.lines.length;o+=1){r=t.text.lines[o];var s=Math.max(.5*(t.height-(i?t.text.height:t.calculatedLineHeight)),0)+l,c=t.paddingLeft+n+t.treeArrowWidth+t.orderByArrowWidth;"right"===t.horizontalAlignment?c=t.paddingLeft+n+t.paddedWidth-r.width:"center"===t.horizontalAlignment&&(c=t.paddingLeft+n+(t.paddedWidth+t.paddingRight)/2-r.width/2),"top"===t.verticalAlignment?s=t.calculatedLineHeight:"bottom"===t.verticalAlignment&&(s=t.height-t.paddingBottom-t.text.height),r.height=l+t.lineSpacing,r.offsetLeft=c,r.offsetTop=s,r.x=t.x+c,r.y=t.y+a+s,a+=r.height,w(r.value,r.x,r.y)}e.attributes.debug&&t.active&&requestAnimationFrame((function(){e.ctx.font=e.style.debugFont,e.ctx.fillStyle=e.style.debugColor,w(JSON.stringify({x:t.x,y:t.y,h:t.height,w:t.width,pw:t.paddedWidth,idx:t.columnIndex,idx_ord:t.sortColumnIndex},null,"\t"),t.x+14,t.y+14),w(JSON.stringify(t.text.lines.map((function(e){return{w:e.width,v:e.value.length}})),null,"\t"),t.x+14,t.y+30)}))}(u,$)}M&&u.text&&u.text.height>A&&(e.sizes.rows[x?-1:r]=u.text.height,R=!0)}F&&(N=u),he(u,K,"selection"),function(t){(e.attributes.allowMovingSelection||e.mobile)&&(t.selectionBorderTop&&t.selectionBorderRight&&e.mobile&&(Y.push([t,"tr"]),t.selectionHandle="tr"),t.selectionBorderTop&&t.selectionBorderLeft&&(e.mobile&&(Y.push([t,"tl"]),t.selectionHandle="tl"),e.fillOverlay.handle&&(e.fillOverlay.snapTo={x:t.x,y:t.y})),t.selectionBorderBottom&&t.selectionBorderLeft&&e.mobile&&(Y.push([t,"bl"]),t.selectionHandle="bl"),t.selectionBorderBottom&&t.selectionBorderRight&&("none"!==e.attributes.selectionHandleBehavior||e.mobile)&&(Y.push([t,"br"]),t.selectionHandle="br",e.fillOverlay.handle&&(e.fillOverlay.handle.x=t.x+t.width,e.fillOverlay.handle.y=t.y+t.height)),e.fillOverlay.handle&&(-1===e.fillOverlay.snapTo.x&&t.selectionBorderLeft&&(e.fillOverlay.snapTo.x=t.x),-1===e.fillOverlay.snapTo.y&&t.selectionBorderTop&&(e.fillOverlay.snapTo.y=t.y)))}(u),e.movingSelection&&he(u,q,"move",e.moveOffset),e.ctx.restore(),B&&function(t,o){var r=t.x+t.width-e.style.filterButtonWidth-1,n=t.y+t.height-e.style.filterButtonHeight-2;if(e.dispatchEvent("beforerenderfilterbutton",o))return;e.ctx.save(),e.ctx.strokeStyle=e.style.filterButtonBorderColor,e.ctx.fillStyle=e.style.filterButtonBackgroundColor,t.openedFilter?e.ctx.fillStyle=e.style.filterButtonActiveBackgroundColor:t.hovered&&e.hovers.onFilterButton&&(e.ctx.fillStyle=e.style.filterButtonHoverBackgroundColor);g(r,n,e.style.filterButtonWidth,e.style.filterButtonHeight,e.style.filterButtonBorderRadius),e.ctx.stroke(),e.ctx.fill(),function(t,o){var r=(e.style.filterButtonHeight-e.style.filterButtonArrowHeight)/2*e.scale,n=(e.style.filterButtonWidth-e.style.filterButtonArrowWidth)/2*e.scale,l=e.style.filterButtonArrowWidth*e.scale,i=e.style.filterButtonArrowHeight*e.scale;t+=e.canvasOffsetLeft,o+=e.canvasOffsetTop,e.ctx.fillStyle=e.style.filterButtonArrowColor,e.ctx.strokeStyle=e.style.filterButtonArrowBorderColor,e.ctx.beginPath(),t+=n,o+=r,e.ctx.moveTo(t,o),e.ctx.lineTo(t+l,o),e.ctx.lineTo(t+.5*l,o+i),e.ctx.moveTo(t,o),e.ctx.stroke(),e.ctx.fill()}(r,n),e.ctx.clip(),e.dispatchEvent("afterrenderfilterbutton",o),e.ctx.restore()}(u);var oe=e.orderings.columns&&e.orderings.columns.length>0;if(b&&e.attributes.showRowNumbers&&e.attributes.showRowNumberGaps&&!1===oe){var ne=e.getBoundRowIndexFromViewRowIndex(o-1),ie=void 0!==ne&&u.boundRowIndex>0&&u.boundRowIndex-ne>1;if(ie&&ae.length>0&&(ie=ae.find(function(e){return _newArrowCheck(this,s),e.from===ne&&e.to===u.boundRowIndex}.bind(this))>=0),ie&&e.hiddenRowRanges.length>0)for(var de=0;de<e.hiddenRowRanges.length;de++){var ue=_slicedToArray(e.hiddenRowRanges[de],2),fe=ue[0],ge=ue[1];if(u.boundRowIndex===ge+1&&ne===fe-1){ie=!1;break}}if(ie){var me=e.style.rowHeaderCellRowNumberGapHeight,pe=e.style.rowHeaderCellRowNumberGapColor;e.ctx.save(),e.ctx.fillStyle=pe,m(u.x,u.y-me/2,u.width,me),e.ctx.restore()}}if(S&&e.attributes.showUnhideColumnsIndicator){var we,ve,ye=e.hovers.unhideIndicator,xe=e.style.unhideIndicatorSize,Ce=H,be=u.y+Math.max(.5*(u.height-xe),0),Se=function(e){return _newArrowCheck(this,s),ye&&("l"===ye.dir||"r"===ye.dir)&&e>=ye.orderIndex0&&e<=ye.orderIndex1}.bind(this),Re=function(e){return _newArrowCheck(this,s),e>=0&&D[e]&&D[e].hidden}.bind(this),Be=function(t,o,r){if(_newArrowCheck(this,s),e.visibleUnhideIndicators.push({x:t-1,y:be-1,x2:t+xe+2,y2:be+xe+2,orderIndex0:we,orderIndex1:ve,dir:o}),!r){var n=u.text&&u.text.lines&&u.text.lines[0];if(n){var l=V+U,i=l>0?l:n.x,a=n.x+n.width;if(t+xe>=i&&t<=a)return}}h(t,be,xe,o,r)}.bind(this),Te=a-1,Ie=e.orders.columns[Te];if(Re(Ie)){var Me=Se(Ie);for(we=Te,ve=Te;--Te>=0&&Re(e.orders.columns[Te]);)we=Te;Be(Ce,"r",Me)}Te=a+1;var ke=e.orders.columns[Te];if(Re(ke)){var Ae=Se(ke);for(we=Te,ve=Te;++Te<e.orders.columns.length&&Re(e.orders.columns[Te]);)ve=Te;Be(H+u.width-xe,"l",Ae)}}if(b&&e.attributes.showUnhideRowsIndicator&&e.hiddenRowRanges.length>0){var ze=e.hovers.unhideIndicator,Oe=e.style.unhideIndicatorSize,He=u.x+u.width-Oe-2,Ee=O,Pe={},Le={};e.hiddenRowRanges.forEach(function(e){_newArrowCheck(this,s),Pe[e[0]-1]=e,Le[e[1]+1]=e}.bind(this));var De,Fe,We=u.rowIndex+ce,Ne=function(){return _newArrowCheck(this,s),ze&&("t"===ze.dir||"b"===ze.dir)&&We>=ze.orderIndex0-1&&We<=ze.orderIndex1+1}.bind(this),Ge=function(t,o,r){_newArrowCheck(this,s),e.visibleUnhideIndicators.push({x:He-1,y:t-1,x2:He+Oe+2,y2:t+Oe+2,orderIndex0:De,orderIndex1:Fe,dir:o}),h(He,t,Oe,o,r)}.bind(this),je=Pe[We];if(je){var _e=Ee+u.height-Oe,Ve=_slicedToArray(je,2);De=Ve[0],Fe=Ve[1],Ge(_e,"t",Ne())}if(je=Le[We]){var Ue=Ee,Ze=_slicedToArray(je,2);De=Ze[0],Fe=Ze[1],Ge(Ue,"b",Ne())}}return H+=u.width+(Z?0:e.style.cellBorderWidth),u.width}}}function ge(t,o){var r,n,l,i,a=D.length;if(O-2*se>P)return!1;if(W=U[t],k=e.openChildren[t],l=(e.sizes.rows[t]||e.style.cellHeight)*e.scale,n=(k?e.sizes.trees[t]:0)*e.scale,O<-(A=l+n))return!1;for(e.attributes.showRowHeaders&&(H+=ee),se=A,i=e.scrollIndexLeft;i<a;i+=1)if(ue(i)||(r=e.orders.columns[i],H+=fe(W,t,o)(D[r],r,i)),H>e.width){e.scrollIndexRight=i,e.scrollPixelRight=H;break}for(H=1,e.attributes.showRowHeaders&&(H+=ee),i=0;i<e.frozenColumn&&(ue(i)||(r=e.orders.columns[i],H+=fe(W,t,o)(D[r],r,i)),!(H>e.width));i+=1);if(e.lastFrozenColumnPixel=H,se=A,H=-e.scrollBox.scrollLeft+e.scrollPixelLeft+e.style.cellBorderWidth,M=e.childGrids[t],t!==U.length&&k){if(M.visible=!0,M.parentNode={offsetTop:O+l+e.canvasOffsetTop,offsetLeft:ee-1+e.canvasOffsetLeft,offsetHeight:n,offsetWidth:e.width-ee-e.style.scrollBarWidth-1,offsetParent:e.intf.parentNode,parentNode:e.intf.parentNode,style:e.style,nodeType:"canvas-datagrid-tree",scrollTop:e.scrollBox.scrollTop,scrollLeft:e.scrollBox.scrollLeft,rowIndex:t,columnGroupsAreaHeight:oe,rowGroupsAreaWidth:te},e.intf.parentNode){var s=e.intf.parentNode,c=s.columnGroupsAreaHeight,d=s.rowGroupsAreaWidth;M.parentNode.columnGroupsAreaHeight+=c||0,M.parentNode.rowGroupsAreaWidth+=d||0}e.visibleCells.unshift({rowIndex:t,columnIndex:0,y:M.parentNode.offsetTop,x:M.parentNode.offsetLeft,height:M.height,width:M.width,style:"tree-grid",type:M.parentNode.nodeType}),M.draw()}else M&&(M.parentNode.offsetHeight=0,delete e.sizes.trees[t]);return X.push([W,t,o,O,A]),e.visibleRowHeights[t]=A,O+=se+(Z?0:e.style.cellBorderWidth),!0}}}function getDefaultExportFromCjs(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function createCommonjsModule(e,t,o){return e(o={path:t,exports:{},require:function(e,t){return commonjsRequire(e,null==t?o.path:t)}},o.exports),o.exports}function commonjsRequire(){throw new Error("Dynamic requires are not currently supported by @rollup/plugin-commonjs")}var dist=createCommonjsModule((function(e){e.exports=function(e){var t={};function o(r){if(t[r])return t[r].exports;var n=t[r]={i:r,l:!1,exports:{}};return e[r].call(n.exports,n,n.exports,o),n.l=!0,n.exports}return o.m=e,o.c=t,o.d=function(e,t,r){o.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},o.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},o.t=function(e,t){if(1&t&&(e=o(e)),8&t)return e;if(4&t&&"object"==_typeof(e)&&e&&e.__esModule)return e;var r=Object.create(null);if(o.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var n in e)o.d(r,n,function(t){return e[t]}.bind(null,n));return r},o.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return o.d(t,"a",t),t},o.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},o.p="",o(o.s=0)}([function(e,t,o){Object.defineProperty(t,"__esModule",{value:!0});var r=o(1),n=Object.keys(r.default).reduce((function(e,t){return e.concat(r.default[t])}),[]);t.default=function(e){return-1===n.indexOf(e.key)}},function(e,t,o){Object.defineProperty(t,"__esModule",{value:!0}),t.default={modifier:["Alt","AltGraph","CapsLock","Control","Fn","FnLock","Meta","NumLock","ScrollLock","Shift","Symbol","SymbolLock"],legacyModifier:["Hyper","Super"],whiteSpace:["Enter","Tab"],navigation:["ArrowDown","ArrowLeft","ArrowRight","ArrowUp","End","Home","PageDown","PageUp"],editing:["Backspace","Clear","Copy","CrSel","Cut","Delete","EraseEof","ExSel","Insert","Paste","Redo","Undo"],ui:["Accept","Again","Attn","Cancel","ContextMenu","Escape","Execute","Find","Help","Pause","Play","Props","Select","ZoomIn","ZoomOut"],device:["BrightnessDown","BrightnessUp","Eject","LogOff","Power","PowerOff","PrintScreen","Hibernate","Standby","WakeUp"],imeCompositionKeys:["AllCandidates","Alphanumeric","CodeInput","Compose","Convert","Dead","FinalMode","GroupFirst","GroupLast","GroupNext","GroupPrevious","ModeChange","NextCandidate","NonConvert","PreviousCandidate","Process","SingleCandidate"],koreanSpecific:["HangulMode","HanjaMode","JunjaMode"],japaneseSpecific:["Eisu","Hankaku","Hiragana","HiraganaKatakana","KanaMode","KanjiMode","Katakana","Romaji","Zenkaku","ZenkakuHankaku"],commonFunction:["F1","F2","F3","F4","F5","F6","F7","F8","F9","F10","F11","F12","Soft1","Soft2","Soft3","Soft4"],multimedia:["ChannelDown","ChannelUp","Close","MailForward","MailReply","MailSend","MediaClose","MediaFastForward","MediaPause","MediaPlay","MediaPlayPause","MediaRecord","MediaRewind","MediaStop","MediaTrackNext","MediaTrackPrevious","New","Open","Print","Save","SpellCheck"],multimediaNumpad:["Key11","Key12"],audio:["AudioBalanceLeft","AudioBalanceRight","AudioBassBoostDown","AudioBassBoostToggle","AudioBassBoostUp","AudioFaderFront","AudioFaderRear","AudioSurroundModeNext","AudioTrebleDown","AudioTrebleUp","AudioVolumeDown","AudioVolumeUp","AudioVolumeMute","MicrophoneToggle","MicrophoneVolumeDown","MicrophoneVolumeUp","MicrophoneVolumeMute"],speech:["SpeechCorrectionList","SpeechInputToggle"],application:["LaunchApplication1","LaunchApplication2","LaunchCalendar","LaunchContacts","LaunchMail","LaunchMediaPlayer","LaunchMusicPlayer","LaunchPhone","LaunchScreenSaver","LaunchSpreadsheet","LaunchWebBrowser","LaunchWebCam","LaunchWordProcessor"],browser:["BrowserBack","BrowserFavorites","BrowserForward","BrowserHome","BrowserRefresh","BrowserSearch","BrowserStop"],mobilePhone:["AppSwitch","Call","Camera","CameraFocus","EndCall","GoBack","GoHome","HeadsetHook","LastNumberRedial","Notification","MannerMode","VoiceDial"],tv:["TV","TV3DMode","TVAntennaCable","TVAudioDescription","TVAudioDescriptionMixDown","TVAudioDescriptionMixUp","TVContentsMenu","TVDataService","TVInput","TVInputComponent1","TVInputComponent2","TVInputComposite1","TVInputComposite2","TVInputHDMI1","TVInputHDMI2","TVInputHDMI3","TVInputHDMI4","TVInputVGA1","TVMediaContext","TVNetwork","TVNumberEntry","TVPower","TVRadioService","TVSatellite","TVSatelliteBS","TVSatelliteCS","TVSatelliteToggle","TVTerrestrialAnalog","TVTerrestrialDigital","TVTimer"],mediaControls:["AVRInput","AVRPower","ColorF0Red","ColorF1Green","ColorF2Yellow","ColorF3Blue","ColorF4Grey","ColorF5Brown","ClosedCaptionToggle","Dimmer","DisplaySwap","DVR","Exit","FavoriteClear0","FavoriteClear1","FavoriteClear2","FavoriteClear3","FavoriteRecall0","FavoriteRecall1","FavoriteRecall2","FavoriteRecall3","FavoriteStore0","FavoriteStore1","FavoriteStore2","FavoriteStore3","Guide","GuideNextDay","GuidePreviousDay","Info","InstantReplay","Link","ListProgram","LiveContent","Lock","MediaApps","MediaAudioTrack","MediaLast","MediaSkipBackward","MediaSkipForward","MediaStepBackward","MediaStepForward","MediaTopMenu","NavigateIn","NavigateNext","NavigateOut","NavigatePrevious","NextFavoriteChannel","NextUserProfile","OnDemand","Pairing","PinPDown","PinPMove","PinPToggle","PinPUp","PlaySpeedDown","PlaySpeedReset","PlaySpeedUp","RandomToggle","RcLowBattery","RecordSpeedNext","RfBypass","ScanChannelsToggle","ScreenModeNext","Settings","SplitScreenToggle","STBInput","STBPower","Subtitle","Teletext","VideoModeNext","Wink","ZoomToggle"]}}]).default})),isPrintableKeyEvent=getDefaultExportFromCjs(dist),isSupportedHtml=function(e){var t=this;return[/(?:^(<meta[^>]*>)?[\s\S]*<div[^>]*>)/,/(?:^(<meta[^>]*>)?[\s\S]*<table[^>]*>)/,/(?:^(<meta[^>]*>)?[\s\S]*<span[^>]*>)/,/(?:<!--StartFragment-->[\s\S]*<tr[^>]*>)/,/(?:<!--StartFragment-->[\s\S]*<td[^>]*>)/].some(function(o){return _newArrowCheck(this,t),o.test(e)}.bind(this))},IGNORE_NODETYPES=[8,3],isHtmlTable=function(e){return/(?:<table[^>]*>)|(?:<tr[^]*>)/.test(e)},sanitizeElementData=function(e){var t=1===e.nodeType?e.innerText:e.data;return String(t).replace(/\s+/g," ").trim()},parseHtmlText=function(e){var t=this,o=(new DOMParser).parseFromString(e,"text/html"),r=o.querySelector("div")||o.querySelector("span");return sanitizeElementData(r).split("\n").map(function(e){var o=this;return _newArrowCheck(this,t),e.split("\t").map(function(e){return _newArrowCheck(this,o),{value:[{value:e}]}}.bind(this))}.bind(this))},parseHtmlTable=function(e){var t,o=[],r=_createForOfIteratorHelper((new DOMParser).parseFromString(e,"text/html").querySelectorAll("table tr"));try{for(r.s();!(t=r.n()).done;){var n,l=t.value,i=[],a=_createForOfIteratorHelper(l.childNodes);try{for(a.s();!(n=a.n()).done;){var s=n.value;if(!IGNORE_NODETYPES.includes(s.nodeType)){var c={value:[]},d=sanitizeElementData(s);d&&c.value.push({value:d}),i.push(c)}}}catch(e){a.e(e)}finally{a.f()}o.push(i)}}catch(e){r.e(e)}finally{r.f()}return o},parseText=function(e){var t=this;return e.split("\n").map(function(e){var o=this;return _newArrowCheck(this,t),e.split("\t").map(function(e){return _newArrowCheck(this,o),{value:[{value:e}]}}.bind(this))}.bind(this))},parseData=function(e,t){return"text/html"===t&&isHtmlTable(e)?parseHtmlTable(e):"text/html"===t?parseHtmlText(e):parseText(e)},htmlSafe=function(e){return"string"!=typeof e?e:e.replace(/</g,"<").replace(/>/g,">")},createTextString=function(e,t){var o=this;return t?e.map(function(e){return _newArrowCheck(this,o),Object.values(e).join("\t")}.bind(this)).join("\n"):e.map(function(e){return _newArrowCheck(this,o),Object.values(e).join("")}.bind(this)).join("")},createHTMLString=function(e,t){var o=this;if(!t)return createTextString(e,t);var r="<table>";return r+=e.map(function(e){var t=this;return _newArrowCheck(this,o),"<tr>"+Object.values(e).map(function(e){return _newArrowCheck(this,t),["<td>",htmlSafe(e),"</td>"].join("")}.bind(this)).join("")+"</tr>"}.bind(this)).join(""),r+="</table>"};function events(e){var t;e.stopPropagation=function(e){e.stopPropagation()},e.addEventListener=function(t,o){e.events[t]=e.events[t]||[],e.events[t].unshift(o)},e.removeEventListener=function(t,o){(e.events[t]||[]).forEach((function(r,n){o===r&&e.events[t].splice(n,1)}))},e.dispatchEvent=function(t,o){var r;function n(){r=!0}if(o=t.type?t:o||{},t=t.type||t,e.events[t])return e.events[t].forEach((function(t){o.ctx=e.ctx,o.preventDefault=n,t.apply(e.intf,[o])})),r},e.getRatio=function(){return Math.min(e.attributes.maxPixelRatio,(window.devicePixelRatio||1)/(e.ctx.webkitBackingStorePixelRatio||e.ctx.mozBackingStorePixelRatio||e.ctx.msBackingStorePixelRatio||e.ctx.oBackingStorePixelRatio||e.ctx.backingStorePixelRatio||1))},e.refreshScrollCacheX=function(){var t=this,o=e.getSchema();e.scrollCache.x=[];var r=0,n=e.getCollapsedColumnGroups(),l=function(e){var o=this;return _newArrowCheck(this,t),n.findIndex(function(t){return _newArrowCheck(this,o),e>=t.from&&e<=t.to}.bind(this))>=0}.bind(this);return o.reduce((function(t,n,i){var a=e.orders.columns[i],s=e.getColumnWidth(a);return o[a].hidden||l(i)||(t+=s),i<e.frozenColumn?(e.scrollCache.x[i]=t,r=t):e.scrollCache.x[i]=Math.max(r+s,t),t}),0)||0},e.resize=function(t){if(e.canvas){var o,r,n={x:0,y:0,height:0,width:0,style:"vertical-scroll-bar"},l={x:0,y:0,height:0,width:0,style:"horizontal-scroll-bar"},i={x:0,y:0,height:0,width:0,style:"vertical-scroll-box"},a={x:0,y:0,height:0,width:0,style:"horizontal-scroll-box"},s={x:0,y:0,height:0,width:0,isCorner:!0,isScrollBoxCorner:!0,style:"scroll-box-corner"},c=2*e.style.scrollBarBoxMargin,d=2*e.style.scrollBarBorderWidth,u=.5*e.style.scrollBarBoxMargin,h=e.style.scrollBarWidth+2*e.style.scrollBarBorderWidth,f=e.getRatio(),g="collapse"===e.style.gridBorderCollapse?1:2,m=e.style.cellBorderWidth*g,p=e.style.columnHeaderCellBorderWidth*g,w=0,v=0,y=(e.viewData||[]).length,x=e.getColumnHeaderCellHeight(),C=e.getRowHeaderCellWidth(),b=e.getColumnGroupAreaHeight(),S=e.getRowGroupAreaWidth(),R=e.style.cellHeight;for(v=e.refreshScrollCacheX(),e.scrollCache.y=[],o=0;o<y;o+=1)e.scrollCache.y[o]=w,w+=((e.sizes.rows[o]||R)+(e.sizes.trees[o]||0))*e.scale+(e.frozenRow>o&&e.sizes.trees[o]||0);if(y>1&&(e.scrollCache.y[o]=w),e.attributes.showNewRow&&(w+=R),e.attributes.snapToRow&&(w+=e.style.cellHeight),k(),e.isChildGrid?(e.width=e.parentNode.offsetWidth,e.height=e.parentNode.offsetHeight):e.height===e.canvas.offsetHeight&&e.width===e.canvas.offsetWidth||(e.height=e.canvas.offsetHeight,e.width=e.canvas.offsetWidth,e.canvasOffsetLeft=e.args.canvasOffsetLeft||0,e.canvasOffsetTop=e.args.canvasOffsetTop||0),e.scrollBox.top=x+b+p,e.scrollBox.left=C+S,M(),I(),e.scrollBox.horizontalBarVisible&&("auto"!==e.style.height||e.isChildGrid||(e.height+=h),w+=h,k(),M(),I()),e.scrollBox.verticalBarVisible&&("auto"!==e.style.width||e.isChildGrid||(e.width+=h),v+=h,k(),M(),I()),M(),e.scrollBox.scrollWidth=v-e.scrollBox.width,e.scrollBox.scrollHeight=w-e.scrollBox.height,e.frozenColumn>0?e.scrollBox.widthBoxRatio=(e.scrollBox.width-e.scrollCache.x[e.frozenColumn-1])/v:e.scrollBox.widthBoxRatio=e.scrollBox.width/v,e.scrollBox.scrollBoxWidth=e.scrollBox.width*e.scrollBox.widthBoxRatio-e.style.scrollBarWidth-d-u,e.scrollBox.heightBoxRatio=(e.scrollBox.height-x-b-e.scrollCache.y[e.frozenRow])/w,e.scrollBox.scrollBoxHeight=e.scrollBox.height*e.scrollBox.heightBoxRatio-e.style.scrollBarWidth-d-u,e.scrollBox.scrollBoxWidth=Math.max(e.scrollBox.scrollBoxWidth,e.style.scrollBarBoxMinSize),e.scrollBox.scrollBoxHeight=Math.max(e.scrollBox.scrollBoxHeight,e.style.scrollBarBoxMinSize),l.x+=C,l.y+=e.height-e.style.scrollBarWidth-u-b,l.width=e.width-e.style.scrollBarWidth-C-S-u-c,l.height=e.style.scrollBarWidth+e.style.scrollBarBorderWidth+u,a.y=l.y+e.style.scrollBarBoxMargin,a.width=e.scrollBox.scrollBoxWidth,a.height=e.style.scrollBarBoxWidth,n.x+=e.width-S-e.style.scrollBarWidth-e.style.scrollBarBorderWidth-u,n.y+=x+e.scrollCache.y[e.frozenRow],n.width=e.style.scrollBarWidth+e.style.scrollBarBorderWidth+u,n.height=e.height-x-b-e.style.scrollBarWidth-u-c,i.x=n.x+e.style.scrollBarBoxMargin,i.y+=e.scrollCache.y[e.frozenRow],i.width=e.style.scrollBarBoxWidth,i.height=e.scrollBox.scrollBoxHeight,s.x=l.x+l.width+c,s.y=n.y+n.height+c,s.width=e.style.scrollBarWidth+e.style.scrollBarBorderWidth,s.height=e.style.scrollBarWidth+e.style.scrollBarBorderWidth,e.scrollBox.entities={horizontalBar:l,horizontalBox:a,verticalBar:n,verticalBox:i,corner:s},e.scrollBox.bar={v:n,h:l},e.scrollBox.box={v:i,h:a},e.page=Math.max(1,e.visibleRows.length-3-e.attributes.pageUpDownOverlap),!e.isChildGrid){var B=e.width*f,T=e.height*f;e.canvas.width===B&&e.canvas.height===T||(e.canvas.width=B,e.canvas.height=T,e.ctx.scale(f,f))}return e.resizeEditInput(),e.scroll(!0),t&&e.draw(!0),e.dispatchEvent("resize",{}),!0}function I(){e.scrollBox.horizontalBarVisible="auto"!==e.style.width&&v>e.scrollBox.width&&"hidden"!==e.style.overflowX||"scroll"===e.style.overflowX,e.scrollBox.horizontalBoxVisible=v>e.scrollBox.width,e.scrollBox.verticalBarVisible="auto"!==e.style.height&&w>e.scrollBox.height&&"hidden"!==e.style.overflowY||"scroll"===e.style.overflowY,e.scrollBox.verticalBoxVisible=w>e.scrollBox.height}function M(){e.scrollBox.width=e.width-C-S,e.scrollBox.height=e.height-x-b}function k(){e.isChildGrid||(r={height:x+b+w+m+1,width:v+C+m+S},["width","height"].forEach((function(t){-1!==["auto",void 0].indexOf(e.style[t])&&-1!==["auto",void 0].indexOf(e.appliedInlineStyles[t])?e.parentNodeStyle[t]=r[t]+"px":-1==["auto",void 0].indexOf(e.style[t])&&-1==["auto",void 0].indexOf(e.appliedInlineStyles[t])&&(e.parentNodeStyle[t]=e.style[t],e.isComponent&&(e.canvas.style[t]=e.style[t]))})))}},e.scroll=function(t){var o=e.getSchema(),r=(e.viewData||[]).length,n=e.style.cellHeight;for(e.scrollIndexTop=Math.floor(r*(e.scrollBox.scrollTop/e.scrollBox.scrollHeight)-100),e.scrollIndexTop=Math.max(e.scrollIndexTop,0),e.scrollPixelTop=e.scrollCache.y[e.scrollIndexTop],0===e.scrollBox.scrollHeight&&(e.scrollIndexTop=0),e.scrollPixelTop=0,e.scrollIndexLeft=e.frozenColumn,e.scrollPixelLeft=0;e.scrollPixelTop<e.scrollBox.scrollTop&&e.scrollIndexTop<e.viewData.length;)e.scrollIndexTop+=1,e.scrollPixelTop=e.scrollCache.y[e.scrollIndexTop];for(;e.scrollPixelLeft<e.scrollBox.scrollLeft+1&&e.scrollIndexLeft<o.length;)e.scrollPixelLeft=e.scrollCache.x[e.scrollIndexLeft],e.scrollIndexLeft+=1;o.length>0&&(e.scrollIndexLeft=Math.max(e.scrollIndexLeft-1,0),e.scrollPixelLeft-=e.getColumnWidth(e.orders.columns[e.scrollIndexLeft])),(e.viewData||[]).length>0&&(e.scrollIndexTop=Math.max(e.scrollIndexTop-1,0),e.scrollPixelTop=Math.max(e.scrollPixelTop-(e.viewData[e.scrollIndexTop]?(e.sizes.rows[e.scrollIndexTop]||n)+(e.sizes.trees[e.scrollIndexTop]||0):n)*e.scale,0)),e.ellipsisCache={},t||e.draw(!0),requestAnimationFrame(e.resizeEditInput),e.dispatchEvent("scroll",{top:e.scrollBox.scrollTop,left:e.scrollBox.scrollLeft})},e.mousemove=function(t,o){if(!e.contextMenu&&!e.input){if(e.draggingItem&&0===t.which)return e.stopFreezeMove(t),void e.mouseup(t);e.mouse=o||e.getLayerPos(t);var r,n,l,i,a=(t.ctrlKey||t.metaKey||e.attributes.persistantSelectionMode)&&!e.attributes.singleSelectionMode,s=e.getSchema(),c=e.mouse.x,d=e.mouse.y,u=e.getCellAt(c,d),h=!1,f=!1,g={NativeEvent:t,cell:u,x:c,y:d},m=e.currentCell;if(clearTimeout(e.scrollTimer),e.isInGrid({x:c,y:d})||(e.hasFocus=!1),!e.dispatchEvent("mousemove",g)){if(u&&e.currentCell&&(e.rowBoundaryCrossed=e.currentCell.rowIndex!==u.rowIndex,e.columnBoundaryCrossed=e.currentCell.columnIndex!==u.columnIndex,e.cellBoundaryCrossed=e.rowBoundaryCrossed||e.columnBoundaryCrossed,["row","column","cell"].forEach((function(t){e[t+"BoundaryCrossed"]&&(g.cell=m,e.dispatchEvent(t+"mouseout",g),g.cell=u,e.dispatchEvent(t+"mouseover",g))}))),e.currentCell=u,!e.draggingItem&&u&&("cell"===u.context||u.context===e.cursorGrab)){var p=e.getUnhideIndicator(e.mouse.x,e.mouse.y);if(p)return e.cursor="pointer",e.hovers={unhideIndicator:p},void e.draw()}if(e.hovers={},!e.draggingItem&&u){if(e.dragItem=u,e.dragMode=u.dragContext,e.cursor=u.context,"cell"===u.context&&(e.cursor="default",e.hovers={rowIndex:u.rowIndex,columnIndex:u.columnIndex,onFilterButton:!1,onCellTreeIcon:!1},u.isFilterable&&c>u.x+u.width+e.canvasOffsetLeft-e.style.filterButtonWidth&&c<u.x+u.width+e.canvasOffsetLeft&&d>u.y+u.height+e.canvasOffsetTop-e.style.filterButtonHeight&&d<u.y+u.height+e.canvasOffsetTop&&(e.hovers.onFilterButton=!0,e.draw()),u.isRowTree||u.isColumnTree)){var w=u.isRowTree?e.cellTree.rows[u.rowIndex].parentCount:0,v=e.style.cellTreeIconWidth*e.scale,y=u.x+u.paddingLeft+e.canvasOffsetLeft+e.style.cellTreeIconMarginLeft+w*(v+u.paddingLeft),x=u.y+e.canvasOffsetTop+e.style.cellTreeIconMarginTop*e.scale;c>=y&&c<=y+v&&d>=x&&d<x+v&&(e.hovers.onCellTreeIcon=!0,e.draw())}if(e.selecting||e.reorderObject){if(i={x:Math.abs(e.dragStart.x-c),y:Math.abs(e.dragStart.y-d)},-1!==e.dragStartObject.columnIndex&&t.shiftKey&&(e.dragStartObject={rowIndex:e.activeCell.rowIndex,columnIndex:e.activeCell.columnIndex}),n={top:Math.min(e.dragStartObject.rowIndex,u.rowIndex),left:Math.min(e.dragStartObject.columnIndex,u.columnIndex),bottom:Math.max(e.dragStartObject.rowIndex,u.rowIndex),right:Math.max(e.dragStartObject.columnIndex,u.columnIndex)},-1===e.dragStartObject.columnIndex&&(l=e.getSelectionBounds(),n.left=-1,n.right=s.length-1,n.top=Math.min(l.top,u.rowIndex),n.bottom=Math.max(l.bottom,u.rowIndex),n.top<0&&(n.top=0)),-1===e.dragStartObject.rowIndex&&(l=e.getSelectionBounds(),n.left=void 0===u.columnIndex?l.left:Math.min(l.left,u.columnIndex),n.right=void 0===u.columnIndex?l.right:Math.max(l.right,u.columnIndex),n.top=-1,n.bottom=e.viewData.length-1,n.left<0&&(n.left=0),n.left!=n.right?e.isMultiColumnsSelected=!0:e.isMultiRowsSelected=!1),e.dragStartObject.rowIndex===u.rowIndex&&e.dragStartObject.columnIndex===u.columnIndex||(e.ignoreNextClick=!0),e.cellBoundaryCrossed||0===i.x&&0===i.y||"row"===e.attributes.selectionMode)if(void 0===u.rowIndex||"row"!==e.attributes.selectionMode&&-1!==e.dragStartObject.columnIndex||!e.rowBoundaryCrossed)if(void 0===u.rowIndex||"column"!==e.attributes.selectionMode&&-1!==e.dragStartObject.rowIndex||!e.columnBoundaryCrossed){if("row"!==e.attributes.selectionMode){if(u.hovered&&e.hovers.onFilterButton)return u.openedFilter?(u.openedFilter=!1,e.selectedFilterButton={columnIndex:-1,rowIndex:-1}):(e.selectedFilterButton.rowIndex=u.rowIndex,e.selectedFilterButton.columnIndex=u.columnIndex,e.contextmenuEvent(t,{x:u.x+u.width-e.style.filterButtonWidth,y:u.y+u.height,rect:{left:0,top:0}})),void e.draw();if(u.hovered&&e.hovers.onCellTreeIcon&&"mousedown"==t.type)return void e.toggleCollapseTree(u.rowIndex,u.columnIndex);if(e.selectedFilterButton={columnIndex:-1,rowIndex:-1},e.hovers.onFilterButton)return;if(e.hovers.onCellTreeIcon)return;e.dragAddToSelection||void 0===u.rowIndex?e.isCellSelected(u)||e.selectCell(u):e.isCellSelected(u)&&e.unselectCell(u)}}else e.dragStartObject.columnIndex<u.columnIndex?(n.left=e.dragStartObject.columnIndex,n.right=u.columnIndex):(n.left=u.columnIndex,n.right=e.dragStartObject.columnIndex);else e.dragStartObject.rowIndex<u.rowIndex?(n.top=e.dragStartObject.rowIndex,n.bottom=u.rowIndex):(n.top=u.rowIndex,n.bottom=e.dragStartObject.rowIndex);if(!(e.selectionBounds&&n.top===e.selectionBounds.top&&n.left===e.selectionBounds.left&&n.bottom===e.selectionBounds.bottom&&n.right===e.selectionBounds.right||a))if(u.hovered&&e.hovers.onFilterButton||e.clearSelections(),-1===n.top&&(n.top=0),l=n,"row"===e.attributes.selectionMode)for(r=l.top;r<=l.bottom;r+=1)e.selectRow(r,!0,null,!0);else e.selectArea(l,!0),e.activeCell.rowIndex=l.top,e.activeCell.columnIndex=l.left,-1==l.left&&l.top!==l.bottom&&(e.activeCell.columnIndex=0,e.isMultiRowsSelected=!0,e.isMultiColumnsSelected=!1)}else e.movingSelectionHandle&&(i={x:Math.abs(e.dragStart.x-c),y:Math.abs(e.dragStart.y-d)},"y"===e.fillOverlay.direction?f=!0:"x"===e.fillOverlay.direction&&(h=!0));if(i)if(e.attributes.autoScrollOnMousemove||h||f){var C=!h&&i.y>e.attributes.autoScrollMargin,b=!f&&i.x>e.attributes.autoScrollMargin;C&&!b?e.autoScrollZone(t,-1,d,a):b&&!C?e.autoScrollZone(t,c,-1,a):b&&C&&e.autoScrollZone(t,c,d,a)}else e.autoScrollZone(t,c,d,a)}e.getColumnGroupAt(e.mouse.x,e.mouse.y)&&(e.cursor="pointer"),e.getRowGroupAt(e.mouse.x,e.mouse.y)&&(e.cursor="pointer"),e.cellBoundaryCrossed=!1,e.rowBoundaryCrossed=!1,e.columnBoundaryCrossed=!1,e.draw(!0)}}},e.click=function(t,o){var r,n=JSON.stringify(e.getSelectionBounds()),l=(t.ctrlKey||t.metaKey||e.attributes.persistantSelectionMode)&&!e.attributes.singleSelectionMode,i=o||e.getLayerPos(t);if(e.currentCell=e.getCellAt(i.x,i.y),void 0===e.currentCell.grid)if(e.input&&e.endEdit(),e.ignoreNextClick)e.ignoreNextClick=!1;else if(r=e.currentCell,!e.dispatchEvent("click",{NativeEvent:t,cell:e.currentCell})){var a=e.getUnhideIndicator(i.x,i.y);if(a){var s=a.dir,c=a.orderIndex0,d=a.orderIndex1;"l"===s||"r"===s?e.unhideColumns(c,d):e.unhideRows(c,d)}else{var u=e.getColumnGroupAt(i.x,i.y);if(u||(u=e.getRowGroupAt(i.x,i.y)),u&&e.toggleGroup(u))return e.setStorageData(),void e.refresh();if(e.hasFocus){var h=e.getRowGroupAreaWidth(),f=e.getColumnGroupAreaHeight(),g=i.x-h,m=i.y-f;if(-1!==["rowHeaderCell","columnHeaderCell"].indexOf(e.currentCell.style)||l||e.hovers.onFilterButton||e.setActiveCell(r.columnIndex,r.rowIndex),"cell"===e.currentCell.context){if("cornerCell"===e.currentCell.style)return e.selectAll(),e.draw(),void p();if("columnHeaderCell"===e.currentCell.style&&"sort"===e.attributes.columnHeaderClickBehavior)return e.orderBy===r.header.name?e.orderDirection="asc"===e.orderDirection?"desc":"asc":e.orderDirection="asc",e.order(r.header.name,e.orderDirection),void p();if(("row"===e.attributes.selectionMode||"rowHeaderCell"===e.currentCell.style)&&"rowHeaderCell"===e.currentCell.style&&e.attributes.tree&&g>0&&g-e.currentCell.x<e.style.treeArrowWidth+e.style.treeArrowMarginLeft+e.style.treeArrowMarginRight+e.style.treeArrowClickRadius&&m-e.currentCell.y<e.style.treeArrowHeight+e.style.treeArrowMarginTop+e.style.treeArrowClickRadius&&m>0)return void e.toggleTree(r.rowIndex);t.shiftKey&&!l&&(e.selectionBounds=e.getSelectionBounds(),e.selectArea(void 0,!1))}p(),e.draw(!0)}}}function p(){var t=e.getSelectionBounds();n!==JSON.stringify(t)&&e.dispatchEvent("selectionchanged",e.getContextOfSelectionEvent())}},e.dragResizeColumn=function(t){var o,r,n,l="ew-resize"===e.dragMode;if(o=e.getLayerPos(t),r=e.resizingStartingWidth+o.x-e.dragStart.x,n=e.resizingStartingHeight+o.y-e.dragStart.y,r<e.style.minColumnWidth&&(r=e.style.minColumnWidth),n<e.style.minRowHeight&&(n=e.style.minRowHeight),e.dispatchEvent(l?"resizecolumn":"resizerow",{x:r,y:n,width:r,height:n,columnIndex:l?e.draggingItem.columnIndex:void 0,rowIndex:l?void 0:e.draggingItem.rowIndex,draggingItem:e.draggingItem}))return!1;e.attributes.resizeAfterDragged?e.pendingDragResize={item:e.draggingItem,width:r,height:n,x:t.clientX,y:t.clientY}:e.dragResizeApply(e.draggingItem,r,n)},e.dragResizeApply=function(t,o,r){return e.scrollBox.scrollLeft>e.scrollBox.scrollWidth-e.attributes.resizeScrollZone&&"ew-resize"===e.dragMode&&e.resize(!0),"ew-resize"===e.dragMode?(e.sizes.columns["rowHeaderCell"===t.header.style?"cornerCell":t.sortColumnIndex]=o,-1!==["rowHeaderCell","cornerCell"].indexOf(t.header.style)&&e.resize(!0),void e.resizeChildGrids()):"ns-resize"===e.dragMode?(t.rowOpen?e.sizes.trees[t.rowIndex]=r:e.attributes.globalRowResize?e.style.cellHeight=r:e.sizes.rows[t.rowIndex]=r,e.dispatchEvent("resizerow",{row:r}),void e.resizeChildGrids()):void(e.ellipsisCache={})},e.stopDragResize=function(t){var o=e.getLayerPos(t);if(e.attributes.resizeAfterDragged&&(e.dragResizeApply(e.pendingDragResize.item,e.pendingDragResize.width,e.pendingDragResize.height),e.pendingDragResize=void 0),"ew-resize"===e.dragMode){var r=!!(o.x-e.dragStart.x),n=e.isColumnSelected(e.dragItem.columnIndex);if(r&&n){var l=Math.max(e.resizingStartingWidth+o.x-e.dragStart.x,e.style.minColumnWidth);e.fitSelectedColumns(l)}}else if("ns-resize"===e.dragMode){var i=!!(o.y-e.dragStart.y),a=e.isRowSelected(e.dragItem.rowIndex);if(i&&a){var s=Math.max(e.resizingStartingHeight+o.y-e.dragStart.y,e.style.minRowHeight);e.fitSelectedRows(s)}}e.resize(),window.removeEventListener("mousemove",e.dragResizeColumn,!1),window.removeEventListener("mouseup",e.stopDragResize,!1),e.setStorageData(),e.draw(!0),e.ignoreNextClick=!0},e.scrollGrid=function(t){var o=e.getLayerPos(t);return e.attributes.scrollPointerLock&&e.pointerLockPosition&&-1!==["horizontal-scroll-box","vertical-scroll-box"].indexOf(e.scrollStartMode)&&(e.pointerLockPosition.x+=t.movementX,e.pointerLockPosition.y+=t.movementY,e.pointerLockPosition.x=Math.min(e.width-e.style.scrollBarWidth,Math.max(0,e.pointerLockPosition.x)),e.pointerLockPosition.y=Math.min(e.height-e.style.scrollBarWidth,Math.max(0,e.pointerLockPosition.y)),o=e.pointerLockPosition),e.scrollMode=e.getCellAt(o.x,o.y).context,"horizontal-scroll-box"===e.scrollMode&&"horizontal-scroll-box"!==e.scrollStartMode?(e.scrollStartMode="horizontal-scroll-box",e.dragStart=o,e.scrollStart.left=e.scrollBox.scrollLeft,void clearTimeout(e.scrollTimer)):"vertical-scroll-box"===e.scrollMode&&"vertical-scroll-box"!==e.scrollStartMode?(e.scrollStartMode="vertical-scroll-box",e.dragStart=o,e.scrollStart.top=e.scrollBox.scrollTop,void clearTimeout(e.scrollTimer)):("vertical-scroll-box"===e.scrollStartMode&&"vertical-scroll-box"!==e.scrollMode&&(e.scrollMode="vertical-scroll-box"),"horizontal-scroll-box"===e.scrollStartMode&&"horizontal-scroll-box"!==e.scrollMode&&(e.scrollMode="horizontal-scroll-box"),clearTimeout(e.scrollTimer),void(-1!==e.scrollModes.indexOf(e.scrollMode)&&("vertical-scroll-box"===e.scrollMode?e.scrollBox.scrollTop=e.scrollStart.top+(o.y-e.dragStart.y)/e.scrollBox.heightBoxRatio:"vertical-scroll-top"===e.scrollMode?(e.scrollBox.scrollTop-=e.page*e.style.cellHeight,e.scrollTimer=setTimeout(e.scrollGrid,e.attributes.scrollRepeatRate,t)):"vertical-scroll-bottom"===e.scrollMode&&(e.scrollBox.scrollTop+=e.page*e.style.cellHeight,e.scrollTimer=setTimeout(e.scrollGrid,e.attributes.scrollRepeatRate,t)),"horizontal-scroll-box"===e.scrollMode?e.scrollBox.scrollLeft=e.scrollStart.left+(o.x-e.dragStart.x)/e.scrollBox.widthBoxRatio:"horizontal-scroll-right"===e.scrollMode?(e.scrollBox.scrollLeft+=e.attributes.selectionScrollIncrement,e.scrollTimer=setTimeout(e.scrollGrid,e.attributes.scrollRepeatRate,t)):"horizontal-scroll-left"===e.scrollMode&&(e.scrollBox.scrollLeft-=e.attributes.selectionScrollIncrement,e.scrollTimer=setTimeout(e.scrollGrid,e.attributes.scrollRepeatRate,t)))))},e.stopScrollGrid=function(){clearTimeout(e.scrollTimer),document.exitPointerLock&&document.exitPointerLock(),window.removeEventListener("mousemove",e.scrollGrid,!1)},e.dragReorder=function(t){var o,r,n,l="column-reorder"===e.dragMode,i="row-reorder"===e.dragMode;if(r=(o=e.getLayerPos(t)).x-e.dragStart.x,n=o.y-e.dragStart.y,(e.attributes.allowColumnReordering||!l)&&(e.attributes.allowRowReordering||!i)&&((t.ctrlKey||t.metaKey||t.shiftKey)&&e.reorderObject&&("column-reorder"!==e.dragMode||e.isMultiColumnsSelected||e.selectColumn(e.draggingItem.header.index,!1,!1)),!e.dispatchEvent("reordering",{NativeEvent:t,source:e.dragStartObject,target:e.currentCell,dragMode:e.dragMode})&&(Math.abs(r)>e.attributes.reorderDeadZone||Math.abs(n)>e.attributes.reorderDeadZone))){if(e.reorderObject=e.draggingItem,e.isMultiRowsSelected&&(e.reorderObject=e.getVisibleCellByIndex(-1,e.activeCell.rowIndex)),e.isMultiColumnsSelected&&(e.reorderObject=e.getVisibleCellByIndex(e.activeCell.columnIndex,-1)),!e.reorderObject)return;e.reorderTarget=e.currentCell,e.reorderObject.dragOffset={x:r,y:n},e.autoScrollZone(t,l?o.x:-1,i?o.y:-1,!1)}},e.stopDragReorder=function(t){var o,r,n=this,l={"row-reorder":e.orders.rows,"column-reorder":e.orders.columns},i={"row-reorder":"rowIndex","column-reorder":"sortColumnIndex"}[e.dragMode];if(window.removeEventListener("mousemove",e.dragReorder,!1),window.removeEventListener("mouseup",e.stopDragReorder,!1),e.reorderObject&&e.reorderTarget&&("column-reorder"===e.dragMode&&e.reorderTarget.sortColumnIndex>-1&&e.reorderTarget.sortColumnIndex<e.getSchema().length||"row-reorder"===e.dragMode&&e.reorderTarget.rowIndex>-1&&e.reorderTarget.rowIndex<e.viewData.length)&&e.reorderObject[i]!==e.reorderTarget[i]&&!e.dispatchEvent("reorder",{NativeEvent:t,source:e.reorderObject,target:e.reorderTarget,dragMode:e.dragMode})){if(e.ignoreNextClick=!0,o=l[e.dragMode].indexOf(e.reorderObject[i]),r=l[e.dragMode].indexOf(e.reorderTarget[i]),"column-reorder"===e.dragMode){var a=e.getRowSelectionStates(0),s=[],c=[];a&&(o=a[0],a.forEach((function(t){s.push(e.orders.columns[t])})));var d=s.length;if(r<o||r>o&&Math.abs(r-o)>=d){l[e.dragMode].splice(o,d),r>o&&(r-=d-1);for(var u=0;u<s.length;u++)0===u&&(e.activeCell.columnIndex=r),c.push(r+u),l[e.dragMode].splice(r+u,0,s[u]);e.orders.columns=l[e.dragMode],e.selectColumnViewIndexes(c)}}else{var h=e.getRowViewIndexesFromSelection().map(function(t){return _newArrowCheck(this,n),e.viewData[t]}.bind(this));if(r<o||r>o&&Math.abs(r-o)>=h.length){e.viewData.splice(o,h.length),r>o&&(r-=h.length-1),e.activeCell.rowIndex=r;for(var f=0;f<h.length;f++)e.viewData.splice(r+f,0,h[f]);e.moveSelection(0,r)}}e.resize(),e.setStorageData()}e.reorderObject=void 0,e.reorderTarget=void 0,e.draw(!0)},e.dragMove=function(t){if(!e.dispatchEvent("moving",{NativeEvent:t,cell:e.currentCell})){var o=e.getLayerPos(t);e.moveOffset={x:e.currentCell.columnIndex-e.dragStartObject.columnIndex,y:e.currentCell.rowIndex-e.dragStartObject.rowIndex},(Math.abs(o.x)>e.attributes.reorderDeadZone||Math.abs(o.y)>e.attributes.reorderDeadZone)&&setTimeout((function(){e.autoScrollZone(t,o.x,o.y,!1)}),1)}},e.stopDragMove=function(t){window.removeEventListener("mousemove",e.dragMove,!1),window.removeEventListener("mouseup",e.stopDragMove,!1);var o=e.getSelectionBounds();if(e.dispatchEvent("endmove",{NativeEvent:t,cell:e.currentCell}))return e.movingSelection=void 0,e.moveOffset=void 0,void e.draw(!0);e.moveOffset&&(e.moveTo(e.movingSelection,o.left+e.moveOffset.x,o.top+e.moveOffset.y),e.moveSelection(e.moveOffset.x,e.moveOffset.y)),e.movingSelection=void 0,e.moveOffset=void 0,e.draw(!0)},e.freezeMove=function(t){if(!e.dispatchEvent("freezemoving",{NativeEvent:t,cell:e.currentCell})){var o=e.getLayerPos(t);e.ignoreNextClick=!0,e.freezeMarkerPosition=o,o.x-=e.getRowGroupAreaWidth(),o.y-=e.getColumnGroupAreaHeight(),(Math.abs(o.x)>e.attributes.reorderDeadZone||Math.abs(o.y)>e.attributes.reorderDeadZone)&&setTimeout((function(){e.autoScrollZone(t,o.x,o.y,!1)}),1)}},e.stopFreezeMove=function(t){var o=e.getLayerPos(t),r="collapse"===e.style.gridBorderCollapse?1:2,n=e.style.columnHeaderCellBorderWidth*r,l=e.getColumnHeaderCellHeight(),i=e.getRowHeaderCellWidth();if(o.x-=e.getRowGroupAreaWidth(),o.y-=e.getColumnGroupAreaHeight(),e.currentCell&&void 0!==e.currentCell.rowIndex&&"frozen-row-marker"===e.dragMode){e.scrollBox.scrollTop=0,e.frozenRow=e.currentCell.rowIndex+1,e.scrollBox.bar.v.y=l+n+e.scrollCache.y[e.frozenRow],e.scrollBox.box.v.y=l+n+e.scrollCache.y[e.frozenRow];var a=e.scrollCache.y[e.scrollCache.y.length-1];e.scrollBox.heightBoxRatio=(e.scrollBox.height-l-e.scrollCache.y[e.frozenRow])/a,e.scrollBox.scrollBoxHeight=e.scrollBox.height*e.scrollBox.heightBoxRatio-e.style.scrollBarWidth,e.scrollBox.scrollBoxHeight=Math.max(e.scrollBox.scrollBoxHeight,e.style.scrollBarBoxMinSize),e.scrollBox.box.v.height=e.scrollBox.scrollBoxHeight}if(e.currentCell&&void 0!==e.currentCell.columnIndex&&"frozen-column-marker"===e.dragMode){var s=e.refreshScrollCacheX();e.scrollBox.scrollLeft=0;var c=e.currentCell.x-e.style.frozenMarkerWidth-e.style.frozenMarkerBorderWidth;o.x>c+e.currentCell.width/2?e.frozenColumn=e.currentCell.columnIndex+1:e.currentCell.columnIndex>=0&&(e.frozenColumn=e.currentCell.columnIndex),e.scrollBox.bar.h.x=i+e.scrollCache.x[e.frozenColumn],e.scrollBox.widthBoxRatio=(e.scrollBox.width-e.scrollCache.x[e.frozenColumn])/s,e.scrollBox.scrollBoxWidth=e.scrollBox.width*e.scrollBox.widthBoxRatio-e.style.scrollBarWidth,e.scrollBox.scrollBoxWidth=Math.max(e.scrollBox.scrollBoxWidth,e.style.scrollBarBoxMinSize),e.scrollBox.box.h.width=e.scrollBox.scrollBoxWidth}if((Math.abs(o.x)>e.attributes.reorderDeadZone||Math.abs(o.y)>e.attributes.reorderDeadZone)&&setTimeout((function(){e.autoScrollZone(t,o.x,o.y,!1)}),1),window.removeEventListener("mousemove",e.freezeMove,!1),window.removeEventListener("mouseup",e.stopFreezeMove,!1),e.freezeMarkerPosition=void 0,e.dispatchEvent("endfreezemove",{NativeEvent:t,cell:e.currentCell}))return e.frozenRow=e.startFreezeMove.x,e.frozenColumn=e.startFreezeMove.y,void e.draw(!0);e.draw(!0),e.resize()},e.mousedown=function(t,o){if(e.lastMouseDownTarget=t.target,!e.dispatchEvent("mousedown",{NativeEvent:t,cell:e.currentCell})&&e.hasFocus&&2!==t.button&&!e.input){var r=t.ctrlKey||t.metaKey,n=/-move/.test(e.dragMode),l=/frozen-row-marker|frozen-column-marker/.test(e.dragMode),i=/-resize/.test(e.dragMode),a=/selection-handle-br/.test(e.dragMode),s=e.hovers&&e.hovers.unhideIndicator;if(e.dragStart=o||e.getLayerPos(t),e.scrollStart={left:e.scrollBox.scrollLeft,top:e.scrollBox.scrollTop},e.dragStartObject=e.getCellAt(e.dragStart.x,e.dragStart.y),e.dragAddToSelection=!e.dragStartObject.selected,r||t.shiftKey||/(vertical|horizontal)-scroll-(bar|box)/.test(e.dragStartObject.context)||!e.currentCell||e.currentCell.isColumnHeader||n||l||i||a||"row-reorder"==e.dragMode&&e.isMultiRowsSelected||e.currentCell.hovered&&e.hovers.onFilterButton||e.clearSelections(),!e.dragStartObject.isGrid){if(-1!==e.scrollModes.indexOf(e.dragStartObject.context)&&!s)return e.scrollMode=e.dragStartObject.context,e.scrollStartMode=e.dragStartObject.context,e.scrollGrid(t),e.attributes.scrollPointerLock&&-1!==["horizontal-scroll-box","vertical-scroll-box"].indexOf(e.scrollStartMode)&&(e.pointerLockPosition={x:e.dragStart.x,y:e.dragStart.y},e.canvas.requestPointerLock()),window.addEventListener("mousemove",e.scrollGrid,!1),window.addEventListener("mouseup",e.stopScrollGrid,!1),void(e.ignoreNextClick=!0);if("cell"!==e.dragMode){if(a){if(e.movingSelectionHandle=!0,e.fillOverlay={handle:{x:e.dragStartObject.x+e.dragStartObject.width/2,y:e.dragStartObject.y+e.dragStartObject.height/2},snapTo:{x:-1,y:-1},selection:e.getSelectionBounds()},e.dispatchEvent("beginselectionhandlemove",{NativeEvent:t}))return;return window.addEventListener("mousemove",e.selectionHandleMove,!1),window.addEventListener("mouseup",e.stopSelectionHandleMove,!1),e.selectionHandleMove(t)}if(n){if(e.draggingItem=e.dragItem,e.movingSelection=e.cloneSelections(),e.dragging=e.dragStartObject,e.dispatchEvent("beginmove",{NativeEvent:t,cell:e.currentCell}))return;return window.addEventListener("mousemove",e.dragMove,!1),window.addEventListener("mouseup",e.stopDragMove,!1),e.mousemove(t)}if(l){if(e.draggingItem=e.dragItem,e.startFreezeMove={x:e.frozenRow,y:e.frozenColumn},e.dispatchEvent("beginfreezemove",{NativeEvent:t}))return;return e.freezeMarkerPosition=e.getLayerPos(t),e.freezeMarkerPosition.isGrab=!0,window.addEventListener("mousemove",e.freezeMove,!1),window.addEventListener("mouseup",e.stopFreezeMove,!1),e.mousemove(t)}return i&&!s?(e.draggingItem=e.dragItem,e.draggingItem.rowOpen?e.resizingStartingHeight=e.sizes.trees[e.draggingItem.rowIndex]:e.resizingStartingHeight=e.sizes.rows[e.draggingItem.rowIndex]||e.style.cellHeight,e.resizingStartingWidth=e.sizes.columns["rowHeaderCell"===e.draggingItem.header.style?"cornerCell":e.draggingItem.sortColumnIndex]||e.draggingItem.width,window.addEventListener("mousemove",e.dragResizeColumn,!1),void window.addEventListener("mouseup",e.stopDragResize,!1)):-1!==["row-reorder","column-reorder"].indexOf(e.dragMode)?(e.draggingItem=e.dragStartObject,"column-reorder"!==e.dragMode||e.isMultiColumnsSelected?"row-reorder"!==e.dragMode||e.isMultiRowsSelected||e.selectRow(e.dragStartObject.rowIndex,r,null):e.selectColumn(e.currentCell.header.index,r,t.shiftKey),window.addEventListener("mousemove",e.dragReorder,!1),void window.addEventListener("mouseup",e.stopDragReorder,!1)):void 0}if(e.selecting=!0,("row"===e.attributes.selectionMode||-1===e.dragStartObject.columnIndex)&&e.dragStartObject.rowIndex>-1)e.selectRow(e.dragStartObject.rowIndex,r,null);else if(("column"===e.attributes.selectionMode||-1===e.dragStartObject.rowIndex)&&e.dragStartObject.columnIndex>-1)return void e.selectColumn(e.currentCell.header.index,r,t.shiftKey);"row"!==e.attributes.selectionMode&&e.mousemove(t)}}},e.mouseup=function(t){clearTimeout(e.scrollTimer),e.cellBoundaryCrossed=!0,e.rowBoundaryCrossed=!0,e.columnBoundaryCrossed=!0,e.selecting=void 0,e.draggingItem=void 0,e.dragStartObject=void 0,e.dispatchEvent("mouseup",{NativeEvent:t,cell:e.currentCell})||(e.hasFocus||t.target===e.canvas)&&(e.currentCell&&void 0!==e.currentCell.grid||e.contextMenu||e.input||(e.dragStart&&e.isInGrid(e.dragStart)&&e.controlInput.focus(),t.preventDefault()))},e.getAdjacentCells=function(){var t,o=e.getSchema(),r={};for(t=0;t<o.length;t+=1)o[e.orders.columns[t]].hidden||(void 0===r.first&&(r.first=t,r.left=t),r.last=t,t>e.activeCell.columnIndex&&void 0===r.right&&(r.right=t),t<e.activeCell.columnIndex&&(r.left=t));return void 0===r.right&&(r.right=r.last),r},e.keydown=function(t){var o=e.getAdjacentCells(),r=Math.max(e.activeCell.columnIndex,0),n=Math.max(e.activeCell.rowIndex,0),l=t.ctrlKey||t.metaKey,i=e.viewData.length-1,a=e.getSchema().length-1;if(!e.dispatchEvent("keydown",{NativeEvent:t,cell:e.currentCell})&&(e.attributes.keepFocusOnMouseOut||e.hasFocus)){if(isPrintableKeyEvent(t)&&!l)return e.beginEditAt(r,n,t,!0);if(e.attributes.showNewRow&&(i+=1),"Tab"===t.key&&t.preventDefault(),"Escape"===t.key?e.selectNone():l&&"a"===t.key?e.selectAll():["Backspace","Delete"].includes(t.key)?e.deleteSelectedData():"ArrowDown"===t.key?n+=1:"ArrowUp"===t.key?n-=1:"ArrowLeft"===t.key&&!l||t.shiftKey&&"Tab"===t.key?r=o.left:"ArrowRight"===t.key&&!l||!t.shiftKey&&"Tab"===t.key?r=o.right:"PageUp"===t.key?(n-=e.page,t.preventDefault()):"PageDown"===t.key?(n+=e.page,t.preventDefault()):"Home"===t.key||l&&"ArrowUp"===t.key?n=0:"End"===t.key||l&&"ArrowDown"===t.key?n=e.viewData.length-1:l&&"ArrowRight"===t.key?r=o.last:l&&"ArrowLeft"===t.key&&(r=o.first),"Enter"===t.key)return t.preventDefault(),e.beginEditAt(r,n,t);(r<0||Number.isNaN(r))&&(r=o.first),n>i&&(n=i),(n<0||Number.isNaN(n))&&(n=0),r>a&&(r=o.last);var s=["ArrowLeft","ArrowUp","ArrowRight","ArrowDown"].includes(t.key);if(t.shiftKey&&s)e.shrinkOrExpandSelections({rowIndex:n,columnIndex:r},t,!0)&&e.draw(!0);r===e.activeCell.columnIndex&&n===e.activeCell.rowIndex||(e.scrollIntoView(r!==e.activeCell.columnIndex?r:void 0,n===e.activeCell.rowIndex||Number.isNaN(n)?void 0:n),e.setActiveCell(r,n),!t.shiftKey&&e.attributes.selectionFollowsActiveCell&&(l||e.clearSelections(),e.selectCell({rowIndex:n,viewColumnIndex:r})),e.draw(!0))}},e.keyup=function(t){e.dispatchEvent("keyup",{NativeEvent:t,cell:e.currentCell})||e.hasFocus},e.keypress=function(t){e.hasFocus&&e.dispatchEvent("keypress",{NativeEvent:t,cell:e.currentCell})},e.dblclick=function(t){e.dispatchEvent("dblclick",{NativeEvent:t,cell:e.currentCell})||e.hasFocus&&("ew-resize"===e.currentCell.context&&"columnHeaderCell"===e.currentCell.style?e.isColumnSelected(e.currentCell.columnIndex)?e.fitSelectedColumns():e.fitColumnToValues(e.currentCell.header.name):"ew-resize"===e.currentCell.context&&"cornerCell"===e.currentCell.style?e.autosize():!["cell","activeCell"].includes(e.currentCell.style)||e.hovers.onFilterButton||e.hovers.onCellTreeIcon||(e.currentCell.isRowTree||e.currentCell.isColumnTree?(e.cellTreeExpandCollapse(e.currentCell.rowIndex,e.currentCell.columnIndex),e.draw()):e.beginEditAt(e.currentCell.columnIndex,e.currentCell.rowIndex)))},e.scrollWheel=function(o){var r,n,l=o,i=void 0===o.deltaX?o.NativeEvent.deltaX:o.deltaX,a=void 0===o.deltaY?o.NativeEvent.deltaY:o.deltaY,s=void 0===o.deltaMode?o.NativeEvent.deltaMode:o.deltaMode;o.NativeEvent&&(o=o.NativeEvent),t?l.preventDefault(o):e.dispatchEvent("wheel",{NativeEvent:o})||(e.touchHaltAnimation=!0,r=e.scrollBox.scrollLeft,n=e.scrollBox.scrollTop,e.hasFocus&&(1===s&&(a*=17),(e.scrollBox.scrollTop<e.scrollBox.scrollHeight&&a>0||e.scrollBox.scrollLeft<e.scrollBox.scrollWidth&&i>0||e.scrollBox.scrollTop>0&&a<0||e.scrollBox.scrollLeft>0&&i<0)&&l.preventDefault(o),t=setTimeout((function(){t=void 0,e.scrollBox.scrollTo(i+r,a+n)}),1)))},e.pasteData=function(t,o,r,n){var l=this,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0,a=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0;if("text/html"===o&&!isSupportedHtml(t))return console.warn("Unrecognized HTML format. HTML must be a simple table, e.g.: <table><tr><td>data</td></tr></table>."),void console.warn("Data with the mime type text/html not in this format will not be imported as row data.");var s=parseData(t,o),c=s[0].length;if(1===s.length&&1===c&&i<=1&&a<=1){var d=s[0][0].value.map(function(e){return _newArrowCheck(this,l),e.value}.bind(this)).join();e.forEachSelectedCell((function(e,t,o){e[t][o]=d}))}else{var u=null;i>s.length&&a>c?u="both":i>s.length?u="vertical":a>c&&(u="horizontal"),e.insert({rows:s,startRowIndex:r,startColumnIndex:n,minRowsLength:i,minColumnsLength:a,reverseRows:!1,reverseColumns:!1,clearSelections:!0,alwaysFilling:!1,direction:u})}var h=[];return e.forEachSelectedCell(function(e,t,o,r){_newArrowCheck(this,l),h.push([t,r.viewColumnIndex,r.boundRowIndex,r.boundColumnIndex])}.bind(this)),e.dispatchEvent("afterpaste",{cells:h}),s.length},e.insert=function(t){var o=this,r=t.rows,n=void 0===r?[]:r,l=t.startRowIndex,i=void 0===l?0:l,a=t.startColumnIndex,s=void 0===a?0:a,c=t.minRowsLength,d=void 0===c?0:c,u=t.minColumnsLength,h=void 0===u?0:u,f=t.reverseRows,g=void 0!==f&&f,m=t.reverseColumns,p=void 0!==m&&m,w=t.clearSelections,v=void 0!==w&&w,y=t.alwaysFilling,x=void 0!==y&&y,C=t.direction,b=void 0===C?"both":C,S=e.getSchema(),R=Math.max(n.length,d),B=e.fillCellCallback,T=[];v&&(e.selections=[]);for(var I=0,M=0;I<R;I++,M++){M>=n.length&&(M=0);for(var k=I>=n.length,A=g?R-I-1:I,z=e.orders.rows[i+A],O=n[M],H=Math.max(O.length,h),E=e.viewData[z],P=Object.assign({},E),L=B?{rows:n,direction:b,rowData:P,existingRowData:E,rowIndex:z,rowOffset:M,cells:O,reversed:"horizontal"===b?p:g,isFillingRow:k||x,fillingRowPosition:x?I:k?I-n.length:-1,fillingRowLength:x?R:k?R-n.length:-1}:void 0,D=0,F=0;D<H;D++,F++){F>=O.length&&(F=0);var W=D>=O.length,N=s+(p?H-D-1:D),G=S[e.orders.columns[N]];if(G){var j=G.name,_=O[F];_&&_.value&&(_=_.value.map(function(e){return _newArrowCheck(this,o),e.value}.bind(this)).join(""));var V=E[j];P[j]=B&&(W||k||x)?B(_objectSpread2(_objectSpread2({},L),{},{column:G,columnIndex:N,columnOffset:F,newCellData:_,existingCellData:V,isFillingColumn:W||x,fillingColumnPosition:x?D:W?D-O.length:-1,fillingColumnLength:x?H:W?H-O.length:-1})):null==_?V:_,e.selectCell({rowIndex:z,viewColumnIndex:N},!0),(x||k||W)&&T.push([z,N,e.getBoundRowIndexFromViewRowIndex(z),e.getBoundColumnIndexFromViewColumnIndex(N)])}else console.warn("Paste data exceeded grid bounds. Skipping.")}e.originalData[e.boundRowIndexMap.get(z)]=P,e.viewData[z]=P}(T.length>0||x)&&e.dispatchEvent("afterfill",{filledCells:T})},e.getNextVisibleColumnIndex=function(t){var o,r=e.getVisibleSchema();for(o=0;o<r.length;o+=1)if(r[o].columnIndex===t)return r[o+1].columnIndex;return-1},e.getVisibleColumnIndexOf=function(t){var o,r=e.getVisibleSchema();for(o=0;o<r.length;o+=1)if(r[o].columnIndex===t)return o;return-1},e.getSelectionIndex=function(){var t=e.getSelectionBounds(!0);if(t){for(var o=t.top,r=t.bottom,n=o;n<=r;n++){var l=e.getRowSelectionStates(n);if(l){if(void 0===l[0])break;return{row:n,column:l[0]<0?l[1]:l[0],rowLength:r-n+1,columnLength:l.length-(l[0]<0?1:0)}}}return null}},e.paste=function(t){var o=this;if(e.attributes.editable&&!e.dispatchEvent("beforepaste",{NativeEvent:t})){var r=new Map(Array.from(t.clipboardData.items).map(function(e){return _newArrowCheck(this,o),[e.type,e]}.bind(this))),n=["text/html","text/csv","text/plain"],l=n.map(function(e){return _newArrowCheck(this,o),r.get(e)}.bind(this)).filter(function(e){return _newArrowCheck(this,o),!!e}.bind(this));if(0!==l.length){var i=e.getSelectionIndex();if(i){var a=l[0],s=a.type;a.getAsString((function(t){e.pasteData(t,s,i.row,i.column,i.rowLength,i.columnLength),e.draw()}))}}else console.warn("Cannot find supported clipboard data type. Supported types are:",n.join(", "))}},e.cut=function(t){var o=this;if(!e.dispatchEvent("cut",{NativeEvent:t})&&e.hasFocus&&t.clipboardData){e.copySelectedCellsToClipboard(t.clipboardData);var r=e.clearSelectedCells().map(function(e){return _newArrowCheck(this,o),[e.viewRowIndex,e.viewColumnIndex,e.boundRowIndex,e.boundColumnIndex]}.bind(this));e.dispatchEvent("aftercut",{cells:r}),requestAnimationFrame(function(){return _newArrowCheck(this,o),e.draw()}.bind(this)),t.preventDefault()}},e.copy=function(t){e.dispatchEvent("copy",{NativeEvent:t})||e.hasFocus&&t.clipboardData&&(e.copySelectedCellsToClipboard(t.clipboardData),t.preventDefault())},e.selectionHandleMove=function(t){if(e.movingSelectionHandle){var o=e.getClippingRect(t),r=e.currentCell.rowIndex,n=e.currentCell.columnIndex,l=r>=-1&&n>=-1&&e.fillOverlay.selection.left<=n&&e.fillOverlay.selection.right>=n&&e.fillOverlay.selection.top<=r&&e.fillOverlay.selection.bottom>=r;if(e.fillOverlay.minX=o.x,e.fillOverlay.minY=o.y,e.fillOverlay.x=Math.max(o.x,t.clientX),e.fillOverlay.y=Math.max(o.y,t.clientY),l)e.fillOverlay.lastInBoundsLocation={x:t.clientX,y:t.clientY};else if(e.fillOverlay.lastInBoundsLocation||!e.fillOverlay.direction){var i=e.fillOverlay.lastInBoundsLocation;e.fillOverlay.lastInBoundsLocation=void 0;var a=i?i.x:e.fillOverlay.handle.x,s=i?i.y:e.fillOverlay.handle.y,c=Math.abs(t.clientX-a),d=Math.abs(t.clientY-s);(c>5||d>5)&&(e.fillOverlay.direction=c>d?"x":"y")}r>=0&&(e.fillOverlay.rowIndex=r),n>=0&&(e.fillOverlay.columnIndex=n,-1===r&&e.visibleRows.length&&(e.fillOverlay.rowIndex=e.visibleRows[0])),e.fillOverlay.snap=r>=-1&&n>=-1?e.currentCell:void 0}},e.stopSelectionHandleMove=function(t){if(!e.fillOverlay.handle)return!1;e.ignoreNextClick=!0,window.removeEventListener("mousemove",e.selectionHandleMove,!1),window.removeEventListener("mouseup",e.stopSelectionHandleMove,!1);var o=e.fillOverlay,r=e.getSelectionIndex(),n=o.selection;if(r){if(e.movingSelectionHandle=void 0,e.fillOverlay={},o.rowIndex>=0&&o.columnIndex>=0){var l,i,a,s,c=_objectSpread2({},n),d="y"===o.direction,u="x"===o.direction,h=!1,f=!1;if(d?(o.rowIndex<n.top?(n.top=o.rowIndex,h=!0):o.rowIndex>n.bottom&&(n.bottom=o.rowIndex),l=n.top<c.top?n.top:c.bottom+1,i=n.top<c.top?c.top-n.top:n.bottom-c.bottom,a=r.column,s=r.columnLength):u&&(o.columnIndex<n.left?(n.left=o.columnIndex,f=!0):o.columnIndex>n.right&&(n.right=o.columnIndex),a=n.left<c.left?n.left:c.right+1,s=n.left<c.left?c.left-n.left:n.right-c.right,l=r.row,i=r.rowLength),n.left<=n.right&&n.top<=n.bottom&&(n.left<c.left||n.top<c.top||n.right>c.right||n.bottom>c.bottom)){for(var g=e.getSchema(),m=[],p=0;p<Math.min(i,r.rowLength);p++){var w=e.viewData[r.row+p];m[p]=[];for(var v=0;v<Math.min(s,r.columnLength);v++){var y=g[r.column+v];if(y){var x=w[y.name];m[p][v]=x}}}e.insert({rows:m,startRowIndex:l,startColumnIndex:a,minRowsLength:i,minColumnsLength:s,reverseRows:h,reverseColumns:f,clearSelections:!1,alwaysFilling:!0,direction:u?"horizontal":"vertical"}),e.draw()}}return!0}}}function touch(e){var t,o;e.scrollAnimation={},e.touchDelta={},e.touchAnimateTo={},e.animationFrames=0,e.getTouchPos=function(t,o){var r,n=o?t.touches[o]:t.touches[0],l=e.canvas.getBoundingClientRect();if(n)return r={x:n.clientX-l.left,y:n.clientY-l.top},e.isChildGrid&&(r.x-=e.canvasOffsetLeft,r.y-=e.canvasOffsetTop),{x:r.x,y:r.y,rect:l}},e.easingFunctions={linear:function(e){return e},easeInQuad:function(e){return e*e},easeOutQuad:function(e){return e*(2-e)},easeInOutQuad:function(e){return e<.5?2*e*e:(4-2*e)*e-1},easeInCubic:function(e){return e*e*e},easeOutCubic:function(e){return--e*e*e+1},easeInOutCubic:function(e){return e<.5?4*e*e*e:(e-1)*(2*e-2)*(2*e-2)+1},easeInQuart:function(e){return e*e*e*e},easeOutQuart:function(e){return 1- --e*e*e*e},easeInOutQuart:function(e){return e<.5?8*e*e*e*e:1-8*--e*e*e*e},easeInQuint:function(e){return e*e*e*e*e},easeOutQuint:function(e){return 1+--e*e*e*e*e},easeInOutQuint:function(e){return e<.5?16*e*e*e*e*e:1+16*--e*e*e*e*e}},e.easing=function(t,o,r,n){return r*e.easingFunctions[e.attributes.touchEasingMethod](t/n)+o},e.calculatePPSTimed=function(){e.xPPST=-(e.touchDelta.x-e.touchSigmaTimed.x)/(e.touchDelta.t-e.touchSigmaTimed.t),e.yPPST=-(e.touchDelta.y-e.touchSigmaTimed.y)/(e.touchDelta.t-e.touchSigmaTimed.t),e.touchSigmaTimed={x:e.touchDelta.x,y:e.touchDelta.y,t:performance.now()}},e.calculatePPS=function(){e.xPPS=-(e.touchDelta.x-e.touchSigma.x)/(e.touchDelta.t-e.touchSigma.t),e.yPPS=-(e.touchDelta.y-e.touchSigma.y)/(e.touchDelta.t-e.touchSigma.t),e.touchSigma={x:e.touchDelta.x,y:e.touchDelta.y,t:performance.now()}},e.touchEndAnimation=function(){if(!e.canvas||!e.scrollBox.scrollTo)return requestAnimationFrame(e.touchEndAnimation);var t,o=performance.now(),r=e.attributes.touchReleaseAnimationDurationMs;t=o-e.touchDelta.t,e.animationFrames+=1,e.scrollAnimation.x=e.easing(t,e.touchDelta.scrollLeft,e.touchAnimateTo.x,r),e.scrollAnimation.y=e.easing(t,e.touchDelta.scrollTop,e.touchAnimateTo.y,r),t>r||e.scrollAnimation.y===e.scrollBox.scrollTop&&e.scrollAnimation.x===e.scrollBox.scrollLeft||e.stopAnimation||(e.scrollBox.scrollTo(e.scrollAnimation.x,e.scrollAnimation.y),requestAnimationFrame(e.touchEndAnimation))},e.touchEditCell=function(t){e.beginEditAt(t.columnIndex,t.rowIndex)},e.touchstart=function(t){if(t.changedTouches[0]&&(e.touchStart=e.getTouchPos(t),e.startingCell=e.getCellAt(e.touchStart.x,e.touchStart.y,!0)),!e.dispatchEvent("touchstart",{NativeEvent:t,cell:e.startingCell})){if(e.disposeContextMenu(),clearInterval(e.calculatePPSTimer),clearTimeout(e.touchContextTimeout),e.touchStartEvent=t,e.stopAnimation=!0,e.animationFrames=0,e.stopPropagation(t),1===t.touches.length&&t.changedTouches[0]&&!e.zoomAltered){if(e.touchLength=1,e.touchStart=e.touchStart||e.touchStart1,e.touchScrollStart={x:e.scrollBox.scrollLeft,y:e.scrollBox.scrollTop,t:performance.now()},e.touchDelta={x:0,y:0,scrollLeft:e.scrollBox.scrollLeft,scrollTop:e.scrollBox.scrollTop,t:e.touchScrollStart.t},e.touchSigma={x:e.touchDelta.x,y:e.touchDelta.y,t:e.touchDelta.t},e.touchSigmaTimed={x:e.touchDelta.x,y:e.touchDelta.y,t:e.touchDelta.t},e.touchContextTimeout=setTimeout((function(){e.contextmenuEvent(t,e.touchStart)}),e.attributes.touchContextMenuTimeMs),e.calculatePPSTimer=setInterval(e.calculatePPSTimed,50),e.startingCell&&(e.startingCell.isGrid||-1!==["tree","inherit"].indexOf(e.startingCell.context)))return void(e.hasFocus=!1);if(e.hasFocus=!0,e.startingCell.isHeader)return e.startingCell.isRowHeader?(e.selectArea({top:e.startingCell.rowIndex,bottom:e.startingCell.rowIndex,left:0,right:e.getVisibleSchema().length-1}),e.draw(!0)):e.startingCell.isColumnHeader&&("sort"===e.attributes.columnHeaderClickBehavior&&(e.orderBy===e.startingCell.header.name?e.orderDirection="asc"===e.orderDirection?"desc":"asc":e.orderDirection="asc",e.order(e.startingCell.header.name,e.orderDirection)),"select"===e.attributes.columnHeaderClickBehavior&&(e.selectArea({top:0,bottom:e.viewData.length-1,left:e.startingCell.columnIndex,right:e.startingCell.columnIndex}),e.draw(!0))),void e.touchEndEvents(t)}e.zoomAltered||(document.body.addEventListener("touchmove",e.touchmove,{passive:!1}),document.body.addEventListener("touchend",e.touchend,!1),document.body.addEventListener("touchcancel",e.touchcancel,!1),e.draw(!0))}},e.touchSelect=function(t,o){if(void 0!==t.rowIndex&&void 0!==t.columnIndex){e.touchSelecting=!0;var r=e.getSelectionBounds();"selection-handle-bl"===o&&t.rowIndex>=r.top&&t.columnIndex<=r.right?(r.bottom=t.rowIndex,r.left=t.columnIndex):"selection-handle-tl"===o&&t.rowIndex<=r.bottom&&t.columnIndex<=r.right?(r.top=t.rowIndex,r.left=t.columnIndex):"selection-handle-tr"===o&&t.rowIndex<=r.bottom&&t.columnIndex>=r.left?(r.top=t.rowIndex,r.right=t.columnIndex):"selection-handle-br"===o&&t.rowIndex>=r.top&&t.columnIndex>=r.left&&(r.bottom=t.rowIndex,r.right=t.columnIndex),"row"===e.attributes.selectionMode||-1===t.rowIndex?(r.left=0,r.right=e.getSchema().length-1):r.left=Math.max(0,r.left),e.selectArea(r),e.draw(!0)}},e.touchmove=function(r){t||requestAnimationFrame((function(){t=!0,function(t){var r,n,l,i,a,s,c,d,u;if(!e.dispatchEvent("beforetouchmove",{NativeEvent:t})){if(clearTimeout(o),t.changedTouches[0]&&(e.touchPosition=e.getTouchPos(t)),t.changedTouches[1]&&(e.touchPosition1=e.getTouchPos(t,1)),Math.abs(e.touchDelta.x)+Math.abs(e.touchDelta.y)>e.attributes.touchDeadZone&&clearTimeout(e.touchContextTimeout),2===t.touches.length&&e.touchPosition&&e.touchPosition1)return d=e.touchPosition.y,u=e.touchPosition1.y,e.zoomDeltaStart||(e.zoomDeltaStart=Math.abs(d-u),e.startScale=e.scale),e.touchLength=2,e.scaleDelta=e.zoomDeltaStart-Math.abs(d-u),e.scale=e.startScale-e.scaleDelta*e.attributes.touchZoomSensitivity,e.scale=Math.min(Math.max(e.scale,e.attributes.touchZoomMin),e.attributes.touchZoomMax),e.zoomAltered=!0,e.resize(!0),void e.resizeChildGrids();e.zoomAltered||(e.touchLength=1,e.touchPosition=e.touchPosition||e.touchPosition1,r=e.getColumnHeaderCellHeight(),n=e.getRowHeaderCellWidth(),l=e.width-e.style.scrollBarWidth-e.touchPosition.x<e.attributes.selectionScrollZone,i=e.touchPosition.x-n<e.attributes.selectionScrollZone,a=e.height-e.style.scrollBarWidth-e.touchPosition.y<e.attributes.selectionScrollZone,s=e.touchPosition.y-r<e.attributes.selectionScrollZone,c=e.style.scrollBarWidth,t.stopPropagation(),e.touchDelta={x:e.touchPosition.x-e.touchStart.x,y:e.touchPosition.y-e.touchStart.y,scrollLeft:e.scrollBox.scrollLeft,scrollTop:e.scrollBox.scrollTop,t:performance.now()},e.currentCell=e.getCellAt(e.touchPosition.x,e.touchPosition.y),e.dispatchEvent("touchmove",{NativeEvent:t,cell:e.currentCell}),e.calculatePPS(),e.touchDuration=performance.now()-e.touchScrollStart.t,e.stopAnimation=!0,e.animationFrames=0,e.touchSelecting&&(l||i||s||a)&&function t(){var r=e.scrollBox.scrollLeft,n=e.scrollBox.scrollTop;r+=l?e.attributes.selectionScrollIncrement:0,n+=a?e.attributes.selectionScrollIncrement:0,n-=s?e.attributes.selectionScrollIncrement:0,r-=i?e.attributes.selectionScrollIncrement:0,e.scrollBox.scrollTo(r,n),o=setTimeout(t,e.attributes.scrollRepeatRate)}(),/vertical-scroll-/.test(e.startingCell.style)?e.scrollBox.scrollTop=e.scrollBox.scrollHeight*((e.touchPosition.y-r-c)/(e.scrollBox.height-c-r)):/horizontal-scroll-/.test(e.startingCell.style)?e.scrollBox.scrollLeft=e.scrollBox.scrollWidth*((e.touchPosition.x-n-c)/(e.scrollBox.width-c-n)):/selection-handle-/.test(e.startingCell.style)?e.touchSelect(e.currentCell,e.startingCell.style):e.scrollBox.scrollTo(e.touchScrollStart.x-e.touchDelta.x,e.touchScrollStart.y-e.touchDelta.y))}}(r),t=!1}))},e.touchEndEvents=function(t){e.zoomDeltaStart=void 0,e.touchSelecting=!1,clearInterval(e.touchScrollTimeout),clearInterval(e.touchContextTimeout),clearInterval(e.calculatePPSTimer),t.stopPropagation(),document.body.removeEventListener("touchmove",e.touchmove,{passive:!1}),document.body.removeEventListener("touchend",e.touchend,!1),document.body.removeEventListener("touchcancel",e.touchcancel,!1)},e.touchend=function(t){if(!e.dispatchEvent("touchend",{NativeEvent:t,cell:e.currentCell}))if(e.zoomDeltaStart=void 0,t.changedTouches[0]&&(e.touchPosition=void 0),t.changedTouches[1]&&(e.touchPosition1=void 0),e.zoomAltered)0===t.touches.length&&(e.zoomAltered=!1);else{var o=Math.abs(e.touchDelta.x)+Math.abs(e.touchDelta.y)<e.attributes.touchDeadZone;isNaN(e.xPPS)&&(e.xPPS=0),isNaN(e.yPPS)&&(e.yPPS=0),isNaN(e.xPPST)&&(e.xPPST=0),isNaN(e.yPPST)&&(e.yPPST=0),e.touchAnimateTo.x=e.xPPS*e.attributes.touchReleaseAcceleration,e.touchAnimateTo.y=e.yPPS*e.attributes.touchReleaseAcceleration,e.calculatePPSTimed(),o||0!==e.animationFrames||!(Math.abs(e.xPPST)>e.attributes.scrollAnimationPPSThreshold||Math.abs(e.yPPST)>e.attributes.scrollAnimationPPSThreshold)||/-scroll-/.test(e.startingCell.style)||o||(e.stopAnimation=!1,e.touchEndAnimation()),e.touchEndEvents(t)}},e.touchcancel=function(t){e.dispatchEvent("touchcancel",{NativeEvent:t,cell:e.currentCell})||e.touchEndEvents(t)}}function intf(e,t){function o(e,t){var o,r=[];for(o=e;o<=t;o+=1)r[o]=o;return r}var r;e.scale=1,e.orders={rows:[],columns:[]},e.appliedInlineStyles={},e.cellGridAttributes={},e.treeGridAttributes={},e.visibleRowHeights=[],e.hasFocus=!1,e.activeCell={columnIndex:0,rowIndex:0},e.innerHTML="",e.storageName="canvasDataGrid",e.invalidSearchExpClass="canvas-datagrid-invalid-search-regExp",e.localStyleLibraryStorageKey="canvas-datagrid-user-style-library",e.dataType="application/x-canvas-datagrid",e.orderBy=null,e.orderDirection="asc",e.orderings={columns:[],add:function(t,o,r){e.orderings.columns=e.orderings.columns.filter((function(e){return e.orderBy!==t})),e.orderings.columns.push({orderBy:t,orderDirection:o,sortFunction:r})},sort:function(){console.warn("grid.orderings.sort has been deprecated. Please use grid.refresh()."),e.orderings.columns.forEach((function(t){e.viewData.sort(t.sortFunction(t.orderBy,t.orderDirection))}))}},e.columnFilters={},e.filters={},e.frozenRow=0,e.frozenColumn=0,e.ellipsisCache={},e.scrollCache={x:[],y:[]},e.scrollBox={},e.visibleRows=[],e.visibleCells=[],e.visibleUnhideIndicators=[],e.hiddenRowRanges=[],e.visibleGroups=[],e.sizes={rows:{},columns:{},trees:{}},e.fillOverlay={},e.filterable={rows:[],columns:[]},e.selectedFilterButton={columnIndex:-1,rowIndex:-1},e.cellTree={rows:[],columns:{},tempSchema:{},rowTreeColIndex:0,columnTreeRowStartIndex:0,columnTreeRowEndIndex:0,origin:{rows:[],columns:{}}},e.hovers={},e.attributes={},e.style={},e.formatters={},e.sorters={},e.parsers={},e.schemaHashes={},e.events={},e.changes=[],e.scrollIndexTop=0,e.scrollPixelTop=0,e.scrollIndexLeft=0,e.scrollPixelLeft=0,e.childGrids={},e.openChildren={},e.groupedColumns=[],e.groupedRows=[],e.scrollModes=["vertical-scroll-box","vertical-scroll-top","vertical-scroll-bottom","horizontal-scroll-box","horizontal-scroll-right","horizontal-scroll-left"],e.componentL1Events={},e.eventNames=["afterdraw","afterrendercell","afterrenderfilterbutton","aftercreategroup","attributechanged","beforebeginedit","beforecreatecellgrid","beforedraw","beforeendedit","beforerendercell","beforerendercellgrid","beforerenderfilterbutton","beginedit","cellmouseout","cellmouseover","click","collapsetree","columnhide","columnunhide","contextmenu","copy","datachanged","dblclick","endedit","expandtree","formatcellvalue","keydown","keypress","keyup","mousedown","mousemove","mouseup","newrow","ordercolumn","rendercell","rendercellgrid","renderorderbyarrow","rendertext","rendertreearrow","reorder","reordering","resize","resizecolumn","resizerow","schemachanged","scroll","selectionchanged","stylechanged","touchcancel","touchend","touchmove","touchstart","wheel"],e.mouse={x:0,y:0},e.getBoundRowIndexFromViewRowIndex=function(t){if(e.boundRowIndexMap&&e.boundRowIndexMap.has(t))return e.boundRowIndexMap.get(t)},e.getBoundColumnIndexFromViewColumnIndex=function(t){return e.orders.columns[t]},e.getColumnGroupAreaHeight=function(){if(!e.attributes.allowGroupingColumns)return 0;var t=e.groupedColumns.length;return e.style.columnGroupRowHeight*e.scale*t},e.getRowGroupAreaWidth=function(){if(!e.attributes.allowGroupingRows)return 0;var t=e.groupedRows.length;return e.style.rowGroupColumnWidth*e.scale*t},e.getCollapsedColumnGroups=function(){for(var t=[],o=0;o<e.groupedColumns.length;o++)for(var r=e.groupedColumns[o],n=0;n<r.length;n++){var l=r[n];l.collapsed&&t.push(l)}return t},e.getCollapsedRowGroups=function(){for(var t=[],o=0;o<e.groupedRows.length;o++)for(var r=e.groupedRows[o],n=0;n<r.length;n++){var l=r[n];l.collapsed&&t.push(l)}return t},e.toggleGroup=function(t){if("c"===t.type){for(var o,r=t.from,n=t.to,l=e.groupedColumns,i=0;i<l.length;i++){for(var a=l[i],s=0;s<a.length;s++){var c=a[s];if(c.from===r&&c.to===n){o=c;break}}if(o)break}if(!o)return;var d=!o.collapsed;return o.collapsed=d,!0}if("r"===t.type){for(var u,h=t.from,f=t.to,g=e.groupedRows,m=0;m<g.length;m++){for(var p=g[m],w=0;w<p.length;w++){var v=p[w];if(v.from===h&&v.to===f){u=v;break}}if(u)break}if(!u)return;var y=!u.collapsed;return u.collapsed=y,!0}return!1},e.isNewGroupRangeValid=function(e,t,o){for(var r=0;r<e.length;r++)for(var n=e[r],l=0;l<n.length;l++){var i=n[l];if(t===i.to+1)return!1;if(!(t>i.to)){if(t===i.from){if(o===i.to)return!1;if(o>i.to)return!0;break}if(t>i.from){if(o>i.to)return!1;break}return!(o<i.to)}}return!0},e.getColumnHeaderCellHeight=function(){return e.attributes.showColumnHeaders?(e.sizes.rows[-1]||e.style.columnHeaderCellHeight)*e.scale:0},e.getRowHeaderCellWidth=function(){return e.attributes.showRowHeaders?(e.sizes.columns[-1]||e.style.rowHeaderCellWidth)*e.scale:0},e.setStorageData=function(){if(e.attributes.saveAppearance&&e.attributes.name){var t={};e.getSchema().forEach((function(e){t[e.name]=!e.hidden})),localStorage.setItem(e.storageName+"-"+e.attributes.name,JSON.stringify({sizes:{rows:e.sizes.rows,columns:e.sizes.columns},orders:{rows:e.orders.rows,columns:e.orders.columns},orderBy:e.orderBy,orderDirection:e.orderDirection,visibility:t}))}},e.getSchema=function(){return e.schema||e.tempSchema||[]},e.createColumnOrders=function(){var t=e.getSchema();e.orders.columns=o(0,t.length-1)},e.createRowOrders=function(){e.orders.rows=o(0,e.originalData.length-1)},e.getVisibleSchema=function(){return e.getSchema().filter((function(e){return!e.hidden}))},e.applyDefaultValue=function(t,o,r){var n=o.defaultValue||"";"function"==typeof n&&(n=n.apply(e.intf,[o,r])),t[o.name]=n},e.createNewRowData=function(){e.newRow={};e.getSchema().forEach((function(t){e.applyDefaultValue(e.newRow,t,undefined)}))},e.getSchemaNameHash=function(t){for(var o=0;e.schemaHashes[t];)t+=o+=1;return t},e.filter=function(t){var o=e.filters[t];return o||void 0===t||(console.warn("Cannot find filter for type %s, falling back to substring match.",t),o=e.filters.string),o},e.hasActiveFilters=function(){return e.columnFilters&&Object.keys(e.columnFilters).length>0},e.hasCollapsedRowGroup=function(){for(var t=0;t<e.groupedRows.length;t++)for(var o=e.groupedRows[t],r=0;r<o.length;r++){if(o[r].collapsed)return!0}return!1},e.getFilteredAndSortedViewData=function(t){var o=this,r=t.map(function(e,t){return _newArrowCheck(this,o),[e,t]}.bind(this));if(e.hiddenRowRanges.length>0)for(var n=e.hiddenRowRanges.sort(function(e,t){return _newArrowCheck(this,o),t[1]-e[1]}.bind(this)),l=0;l<n.length;l++){var i=_slicedToArray(n[l],2),a=i[0],s=i[1]-a+1;r.splice(a,s)}for(var c=function(){var t=_slicedToArray(u[d],2),o=t[0],n=t[1],l=e.getHeaderByName(o);if(!l)return"continue";var i=l.filter||e.filter(l.type||"string");r=r.filter((function(t){var r=_slicedToArray(t,2),l=r[0],a=r[1];return!!(e.attributes.allowFreezingRows&&!e.attributes.filterFrozenRows&&a<e.frozenRow)||i(l[o],n)}))},d=0,u=Object.entries(e.columnFilters);d<u.length;d++)c();for(var h=[],f=0;f<e.groupedRows.length;f++)for(var g=e.groupedRows[f],m=0;m<g.length;m++){var p=g[m];p.collapsed&&h.push([p.from,p.to])}if(h.length>0){h.sort(function(e,t){return _newArrowCheck(this,o),e[0]-t[0]}.bind(this));for(var w=0,v=h.length,y=0;y<v;y++){var x=h[y];if(y===v-1){h[w++]=x;break}var C=x[1],b=_slicedToArray(h[y+1],2),S=b[0],R=b[1];S>C+1?h[w++]=x:(h[y+1]=x,R>C&&(h[y+1][1]=R))}for(var B=(h=h.slice(0,w)).shift(),T=0;T<r.length;T++){if(!(r[T][1]<B[0])){for(var I=T+1;I<r.length;I++){if(r[I][1]>B[1])break}if(r.splice(T,I-T),!(B=h.shift()))break;T--}}}var M,k=_createForOfIteratorHelper(e.orderings.columns);try{var A=function(){var t=this,o=M.value,n=o.sortFunction(o.orderBy,o.orderDirection);r.sort(function(o,r){_newArrowCheck(this,t);var l=_slicedToArray(o,1)[0],i=_slicedToArray(r,2),a=i[0],s=i[1];return e.attributes.allowFreezingRows&&!e.attributes.sortFrozenRows&&s<e.frozenRow?0:n(l,a)}.bind(this))};for(k.s();!(M=k.n()).done;)A()}catch(e){k.e(e)}finally{k.f()}return{viewData:r.map(function(e){return _newArrowCheck(this,o),_slicedToArray(e,1)[0]}.bind(this)),boundRowIndexMap:new Map(r.map(function(e,t){_newArrowCheck(this,o);var r=_slicedToArray(e,2);r[0];return[t,r[1]]}.bind(this)))}},e.refresh=function(){var t=e.getFilteredAndSortedViewData(e.originalData),o=t.viewData,r=t.boundRowIndexMap;e.viewData=o,e.boundRowIndexMap=r,e.resize(),e.draw(!0)},e.getBestGuessDataType=function(e,t){var o,r,n=t.length;for(r=0;r<n;r+=1)if(void 0!==t[r]&&null!==t[r]&&-1!==[null,void 0].indexOf(t[r][e]))return"object"===(o=_typeof(t[r]))?"string":o;return"string"},e.drawChildGrids=function(){Object.keys(e.childGrids).forEach((function(t){e.childGrids[t].draw()}))},e.resizeChildGrids=function(){Object.keys(e.childGrids).forEach((function(t){e.childGrids[t].resize()}))},e.autoScrollZone=function(t,o,r,n){var l,i=e.getRowHeaderCellWidth(),a=e.getColumnHeaderCellHeight();-1!==o&&(o>e.width-e.attributes.selectionScrollZone&&(e.scrollBox.scrollLeft+=e.attributes.selectionScrollIncrement,l=!0),o-e.attributes.selectionScrollZone-i<0&&(e.scrollBox.scrollLeft-=e.attributes.selectionScrollIncrement,l=!0)),-1!==r&&(r>e.height-e.attributes.selectionScrollZone&&(e.scrollBox.scrollTop+=e.attributes.selectionScrollIncrement,l=!0),r-e.attributes.selectionScrollZone-a<0&&(e.scrollBox.scrollTop-=e.attributes.selectionScrollIncrement,l=!0)),l&&!n&&e.currentCell&&-1!==e.currentCell.columnIndex&&(e.scrollTimer=setTimeout(e.mousemove,e.attributes.scrollRepeatRate,t))},e.validateColumn=function(e,t){if(!e.name)throw new Error("A column must contain at least a name.");if(t.filter((function(t){return t.name===e.name})).length>0)throw new Error("A column with the name "+e.name+" already exists and cannot be added again.");return!0},e.setDefaults=function(e,t,o,r){e[o]=void 0===t[o]?r:t[o]},e.setAttributes=function(){e.defaults.attributes.forEach((function(t){e.setDefaults(e.attributes,e.args,t[0],t[1])}))},e.setStyle=function(){e.defaults.styles.forEach((function(t){e.setDefaults(e.style,e.args.style||{},t[0],t[1])}))},e.autosize=function(t){e.getVisibleSchema().forEach((function(o,r){o.name!==t&&void 0!==t||(e.sizes.columns[r]=Math.max(e.findColumnMaxTextLength(o.name),e.style.minColumnWidth))})),e.sizes.columns[-1]=e.findColumnMaxTextLength("cornerCell")},e.dispose=function(){!e.isChildGrid&&e.canvas&&e.canvas.parentNode&&e.canvas.parentNode.removeChild(e.canvas),e.isChildGrid||document.body.removeChild(e.controlInput),e.eventParent.removeEventListener("mousedown",e.mousedown,!1),e.eventParent.removeEventListener("dblclick",e.dblclick,!1),e.eventParent.removeEventListener("click",e.click,!1),e.eventParent.removeEventListener("mousemove",e.mousemove),e.eventParent.removeEventListener("wheel",e.scrollWheel,!1),e.canvas.removeEventListener("contextmenu",e.contextmenuEvent,!1),e.canvas.removeEventListener("copy",e.copy),e.controlInput.removeEventListener("copy",e.copy),e.controlInput.removeEventListener("cut",e.cut),e.controlInput.removeEventListener("paste",e.paste),e.controlInput.removeEventListener("keypress",e.keypress,!1),e.controlInput.removeEventListener("keyup",e.keyup,!1),e.controlInput.removeEventListener("keydown",e.keydown,!1),window.removeEventListener("mouseup",e.mouseup,!1),window.removeEventListener("mousemove",e.mousemove),window.removeEventListener("resize",e.resize),e.observer&&e.observer.disconnect&&e.observer.disconnect()},e.tryLoadStoredSettings=function(){var t;e.reloadStoredValues(),e.storedSettings&&"object"===_typeof(e.storedSettings.orders)&&null!==e.storedSettings.orders&&(e.storedSettings.orders.rows.length>=(e.viewData||[]).length&&(e.orders.rows=e.storedSettings.orders.rows),t=e.getSchema(),e.storedSettings.orders.columns.length===t.length&&(e.orders.columns=e.storedSettings.orders.columns),e.orderBy=void 0===e.storedSettings.orderBy?t[0].name:e.storedSettings.orderBy,e.orderDirection=void 0===e.storedSettings.orderDirection?"asc":e.storedSettings.orderDirection,void 0!==e.storedSettings.orderBy&&e.getHeaderByName(e.orderBy)&&e.orderDirection&&e.order(e.orderBy,e.orderDirection))},e.toggleCollapseTree=function(t,o,r){var n=this,l=[],i=0;if(o==e.cellTree.rowTreeColIndex&&(t>0||0==t&&e.cellTree.rows[0].icon)){var a=e.cellTree.rows;switch(r){case"Expand":a[t].expand=!0,e.cellTree.origin.rows[a[t].index].expand=!0;break;case"Collapse":a[t].expand=!1,e.cellTree.origin.rows[a[t].index].expand=!1;break;default:a[t].expand=!a[t].expand,e.cellTree.origin.rows[a[t].index].expand=a[t].expand}for(var s=a[t].index+1;s<=a[t].lastchild;s++){var c=e.cellTree.origin.rows[s];a[t].expand?(c.hide=!1,c.icon&&!c.expand&&(s=c.lastchild)):c.hide=!0}}else if(e.cellTree.columns[t]){var d=e.cellTree.columns[t];switch(r){case"Expand":d[o].expand=!0;break;case"Collapse":d[o].expand=!1;break;default:d[o].expand=!d[o].expand}for(var u=d[o].index+1;u<=d[o].lastchild;u++)d[o].expand?e.cellTree.tempSchema[u].hidden=!1:e.cellTree.tempSchema[u].hidden=!0;var h,f=0;if(d[o].expand)for(;f<d[o].child;){h=t+f+1;for(var g=d[o].index;g<=d[o].lastchild;g++)if(e.cellTree.origin.columns[h]&&e.cellTree.origin.columns[h][g].icon&&!e.cellTree.origin.columns[h][g].expand)for(var m=g+1;m<=e.cellTree.origin.columns[h][g].lastchild;m++)e.cellTree.tempSchema[m].hidden=!0;f++}}var p,w={},v=[];for(var y in e.cellTree.rows=[],e.cellTree.columns={},e.cellTree.origin.rows){var x=[],C=e.cellTree.origin.rows[y];if(C.hide){for(var b=0;b<e.cellTree.rowTreeColIndex;b++)x.push(e.viewData[y][b]);w[y]=x,v.push(Array(e.viewData[0].length).fill("")),i++}else{var S=[],R=0;if(y<e.cellTree.columnTreeRowStartIndex)l.push(e.originalData[y]);else if(y>e.cellTree.columnTreeRowEndIndex)w[y]=e.viewData[y],i++;else{for(var B=0;B<e.originalData[y].length;B++)e.cellTree.tempSchema[B].hidden?R++:(B<e.cellTree.rowTreeColIndex&&(Object.prototype.hasOwnProperty.call(w,y)||(w[y]=[]),w[y].push(e.viewData[y][B])),x.push(e.originalData[y][B]),Object.prototype.hasOwnProperty.call(e.cellTree.origin.columns,y)&&S.push(e.cellTree.origin.columns[y][B]));x.push.apply(x,_toConsumableArray(Array(R).fill(""))),S.length&&(S.push.apply(S,_toConsumableArray(Array(R).fill().map(function(){return _newArrowCheck(this,n),{}}.bind(this)))),e.cellTree.columns[y]=S),l.push(x)}e.cellTree.rows.push(C)}}i&&((p=e.cellTree.rows).push.apply(p,_toConsumableArray(Array(i).fill().map(function(t,o){return _newArrowCheck(this,n),{index:e.cellTree.rows.length+o}}.bind(this)))),l.push.apply(l,v));for(var T in w)if(T>e.cellTree.columnTreeRowEndIndex)l[T]=w[T];else for(var I in w[T])l[T][I]=w[T][I];e.viewData=l},e.cellTreeExpandCollapse=function(t,o,r){if(o==e.cellTree.rowTreeColIndex&&(t>0||0==t&&e.cellTree.rows[0].icon)){var n=e.cellTree.rows;switch(r){case"Expand":n[t].expand=!0;break;case"Collapse":n[t].expand=!1;break;default:n[t].expand=!n[t].expand}for(var l=t+1;l<=n[t].lastchild;l++)n[t].expand?(n[l].hide=!1,n[l].icon&&!n[l].expand&&(l=n[l].lastchild)):n[l].hide=!0}else if(e.cellTree.columns[t]){var i=e.cellTree.columns[t];switch(r){case"Expand":i[o].expand=!0;break;case"Collapse":i[o].expand=!1;break;default:i[o].expand=!i[o].expand}for(var a=o+1;a<=i[o].lastchild;a++)i[o].expand?e.tempSchema[a].hidden=!1:e.tempSchema[a].hidden=!0;var s,c=0;if(i[o].expand)for(;c<i[o].child;){s=t+c+1;for(var d=o;d<=i[o].lastchild;d++)if(e.cellTree.columns[s]&&e.cellTree.columns[s][d].icon&&!e.cellTree.columns[s][d].expand)for(var u=d+1;u<=e.cellTree.columns[s][d].lastchild;u++)e.tempSchema[u].hidden=!0;c++}}},e.initCellTreeSettings=function(){var t=this;if(void 0!==e.viewData){if(e.attributes.rowTree.length>0&&e.viewData.length>0){e.cellTree.rows=Array(e.viewData.length).fill().map(function(e,o){return _newArrowCheck(this,t),{index:o}}.bind(this)),e.cellTree.rowTreeColIndex=e.attributes.rowTreeColIndex;var o,r=!1,n=_createForOfIteratorHelper(e.attributes.rowTree);try{for(n.s();!(o=n.n()).done;){var l=o.value;if(e.cellTree.rows.length<=l.end){r=!0;break}for(var i=l.begin;i<=l.end;i++)i==l.begin?(e.cellTree.rows[i].icon=!0,e.cellTree.rows[i].lastchild=l.end,e.cellTree.rows[i].expand=!0,e.cellTree.rows[i].parentCount||(e.cellTree.rows[i].parentCount=0)):(e.cellTree.rows[i].hide=!1,e.cellTree.rows[i].parentIndex=l.begin,e.cellTree.rows[i]&&e.cellTree.rows[i].parentCount?e.cellTree.rows[i].parentCount+=1:e.cellTree.rows[i].parentCount=1)}}catch(e){n.e(e)}finally{n.f()}r&&(e.cellTree.rows={})}if(e.attributes.columnTree.length>0&&e.viewData.length>0){e.cellTree.columnTreeRowStartIndex=e.attributes.columnTreeRowStartIndex,e.cellTree.columnTreeRowEndIndex=e.attributes.columnTreeRowEndIndex;var a,s=Object.keys(e.viewData[0]).length,c=!1,d=_createForOfIteratorHelper(e.attributes.columnTree);try{for(d.s();!(a=d.n()).done;){var u=a.value;if(s<=u.end){c=!0;break}e.cellTree.columns[u.row]||(e.cellTree.columns[u.row]=Array(s).fill().map(function(e,o){return _newArrowCheck(this,t),{index:o}}.bind(this)));for(var h=u.begin;h<=u.end;h++){var f=e.cellTree.columns[u.row][h];h==u.begin&&(f.icon=!0,f.lastchild=u.end,f.length=u.end-u.begin,f.expand=!0,u.child?f.child=u.child:f.child=0)}}}catch(e){d.e(e)}finally{d.f()}e.cellTree.tempSchema=Array(s).fill().map((function(){return{hidden:!1}})),c&&(e.cellTree.columns={})}e.cellTree.origin={rows:e.cellTree.rows,columns:e.cellTree.columns}}},e.getDomRoot=function(){return e.shadowRoot?e.shadowRoot.host:e.parentNode},e.getFontName=function(e){return e.replace(/\d+\.?\d*px/,"")},e.getFontHeight=function(e){return parseFloat(e)},e.parseStyleValue=function(t){if(/Font/.test(t))return e.style[t+"Height"]=e.getFontHeight(e.style[t]),void(e.style[t+"Name"]=e.getFontName(e.style[t]));"moveOverlayBorderSegments"===t&&"string"==typeof e.style[t]&&(e.style[t]=e.style[t].split(",").map((function(e){return parseInt(e,10)})))},e.initProp=function(t){e.args[t]&&Object.keys(e.args[t]).forEach((function(o){e[t][o]=e.args[t][o]}))},e.getStyleProperty=function(t){return-1===e.styleKeys.indexOf(t)?e.parentNodeStyle[t]:e.style[t]},e.setStyleProperty=function(t,o,r){var n=-1!==["height","width","minHeight","minWidth","maxHeight","maxWidth"].indexOf(t);-1===e.styleKeys.indexOf(t)?e.parentNodeStyle[t]=o:(/-/.test(t)&&(t=e.dehyphenateProperty(t)),e.style[t]=o,e.parseStyleValue(t)),n&&e.resize(),r||(e.draw(!0),e.dispatchEvent("stylechanged",{name:"style",value:o}))},e.reloadStoredValues=function(){if(e.attributes.name&&e.attributes.saveAppearance){try{e.storedSettings=localStorage.getItem(e.storageName+"-"+e.attributes.name)}catch(t){console.warn("Error loading stored values. "+t.message),e.storedSettings=void 0}if(e.storedSettings)try{e.storedSettings=JSON.parse(e.storedSettings)}catch(t){console.warn("could not read settings from localStore",t),e.storedSettings=void 0}e.storedSettings&&("object"===_typeof(e.storedSettings.sizes)&&null!==e.storedSettings.sizes&&(e.sizes.rows=e.storedSettings.sizes.rows,e.sizes.columns=e.storedSettings.sizes.columns,["trees","columns","rows"].forEach((function(t){e.sizes[t]||(e.sizes[t]={})}))),"object"===_typeof(e.storedSettings.visibility)&&e.getSchema().forEach((function(t){e.storedSettings.visibility&&void 0!==e.storedSettings.visibility[t.name]&&(t.hidden=!e.storedSettings.visibility[t.name])})))}},e.init=function(){if(!e.initialized){var t={};return e.setAttributes(),e.setStyle(),e.initScrollBox(),e.setDom(),e.nodeType="canvas-datagrid",e.ie=/Trident/.test(window.navigator.userAgent),e.edge=/Edge/.test(window.navigator.userAgent),e.webKit=/WebKit/.test(window.navigator.userAgent),e.moz=/Gecko/.test(window.navigator.userAgent),e.mobile=/Mobile/i.test(window.navigator.userAgent),e.blankValues=[void 0,null,""],e.cursorGrab="grab",e.cursorGrabing="grabbing",e.cursorGrab=e.webKit?"-webkit-grab":e.cursorGrab,e.cursorGrabing=e.moz?"-webkit-grabbing":e.cursorGrabbing,e.pointerLockPosition={x:0,y:0},Object.keys(e.style).forEach(e.parseStyleValue),e.intf.moveSelection=e.moveSelection,e.intf.deleteSelectedData=e.deleteSelectedData,e.intf.moveTo=e.moveTo,e.intf.addEventListener=e.addEventListener,e.intf.removeEventListener=e.removeEventListener,e.intf.dispatchEvent=e.dispatchEvent,e.intf.dispose=e.dispose,e.intf.appendTo=e.appendTo,e.intf.getVisibleCellByIndex=e.getVisibleCellByIndex,e.intf.filters=e.filters,e.intf.sorters=e.sorters,e.intf.autosize=e.autosize,e.intf.beginEditAt=e.beginEditAt,e.intf.endEdit=e.endEdit,e.intf.setActiveCell=e.setActiveCell,e.intf.forEachSelectedCell=e.forEachSelectedCell,e.intf.scrollIntoView=e.scrollIntoView,e.intf.clearChangeLog=e.clearChangeLog,e.intf.gotoCell=e.gotoCell,e.intf.gotoRow=e.gotoRow,e.intf.addButton=e.addButton,e.intf.toggleCellCollapseTree=e.toggleCellCollapseTree,e.intf.expandCollapseCellTree=e.expandCollapseCellTree,e.intf.getHeaderByName=e.getHeaderByName,e.intf.findColumnScrollLeft=e.findColumnScrollLeft,e.intf.findRowScrollTop=e.findRowScrollTop,e.intf.fitColumnToValues=e.fitColumnToValues,e.intf.findColumnMaxTextLength=e.findColumnMaxTextLength,e.intf.disposeContextMenu=e.disposeContextMenu,e.intf.getCellAt=e.getCellAt,e.intf.groupColumns=e.groupColumns,e.intf.groupRows=e.groupRows,e.intf.removeGroupColumns=e.removeGroupColumns,e.intf.removeGroupRows=e.removeGroupRows,e.intf.toggleGroupColumns=e.toggleGroupColumns,e.intf.toggleGroupRows=e.toggleGroupRows,e.intf.getGroupsColumnBelongsTo=e.getGroupsColumnBelongsTo,e.intf.getGroupsRowBelongsTo=e.getGroupsRowBelongsTo,e.intf.isCellVisible=e.isCellVisible,e.intf.isRowVisible=e.isRowVisible,e.intf.isColumnVisible=e.isColumnVisible,e.intf.order=e.order,e.intf.draw=e.draw,e.intf.refresh=e.refresh,e.intf.isComponent=e.isComponent,e.intf.selectArea=e.selectArea,e.intf.clipElement=e.clipElement,e.intf.getSchemaFromData=e.getSchemaFromData,e.intf.setFilter=e.setFilter,e.intf.parentGrid=e.parentGrid,e.intf.toggleTree=e.toggleTree,e.intf.expandTree=e.expandTree,e.intf.collapseTree=e.collapseTree,e.intf.canvas=e.canvas,e.intf.context=e.ctx,e.intf.insertRow=e.insertRow,e.intf.deleteRow=e.deleteRow,e.intf.addRow=e.addRow,e.intf.insertColumn=e.insertColumn,e.intf.deleteColumn=e.deleteColumn,e.intf.addColumn=e.addColumn,e.intf.getClippingRect=e.getClippingRect,e.intf.setRowHeight=e.setRowHeight,e.intf.setColumnWidth=e.setColumnWidth,e.intf.resetColumnWidths=e.resetColumnWidths,e.intf.resetRowHeights=e.resetRowHeights,e.intf.resize=e.resize,e.intf.selectColumn=e.selectColumn,e.intf.selectRow=e.selectRow,e.intf.selectAll=e.selectAll,e.intf.selectNone=e.selectNone,e.intf.drawChildGrids=e.drawChildGrids,e.intf.assertPxColor=e.assertPxColor,e.intf.clearPxColorAssertions=e.clearPxColorAssertions,e.intf.integerToAlpha=e.integerToAlpha,e.intf.copy=e.copy,e.intf.cut=e.cut,e.intf.paste=e.paste,e.intf.setStyleProperty=e.setStyleProperty,e.intf.hideColumns=e.hideColumns,e.intf.unhideColumns=e.unhideColumns,e.intf.hideRows=e.hideRows,e.intf.unhideRows=e.unhideRows,Object.defineProperty(e.intf,"defaults",{get:function(){return{styles:e.defaults.styles.reduce((function(e,t){return e[t[0]]=t[1],e}),{}),attributes:e.defaults.attributes.reduce((function(e,t){return e[t[0]]=t[1],e}),{})}}}),e.styleKeys=Object.keys(e.intf.defaults.styles),e.styleKeys.map((function(t){return e.hyphenateProperty(t,!1)})).forEach(o),e.styleKeys.map((function(t){return e.hyphenateProperty(t,!0)})).forEach(o),e.DOMStyles=window.getComputedStyle(document.body,null),e.styleKeys.concat(Object.keys(e.DOMStyles)).forEach((function(o){t[o]=void 0,Object.defineProperty(t,o,{get:function(){return e.getStyleProperty(o)},set:function(t){e.initialized&&(e.appliedInlineStyles[o]=t),e.setStyleProperty(o,t)}})})),Object.defineProperty(e.intf,"shadowRoot",{get:function(){return e.shadowRoot}}),Object.defineProperty(e.intf,"activeCell",{get:function(){return e.activeCell}}),Object.defineProperty(e.intf,"hasFocus",{get:function(){return e.hasFocus}}),Object.defineProperty(e.intf,"hasActiveFilters",{get:function(){return e.hasActiveFilters()}}),Object.defineProperty(e.intf,"style",{get:function(){return t},set:function(t){Object.keys(t).forEach((function(o){e.setStyleProperty(o,t[o],!0)})),e.draw(!0),e.dispatchEvent("stylechanged",{name:"style",value:t})}}),Object.defineProperty(e.intf,"attributes",{value:{}}),Object.keys(e.attributes).forEach((function(t){Object.defineProperty(e.intf.attributes,t,{get:function(){return e.attributes[t]},set:function(o){e.attributes[t]=o,"name"===t&&e.tryLoadStoredSettings(),"rowTree"!==t&&"columnTree"!==t&&"columnTreeRowEndIndex"!==t||e.initCellTreeSettings(),e.draw(!0),e.dispatchEvent("attributechanged",{name:t,value:o[t]})}})})),e.filters.string=function(t,o){if(o===e.attributes.blanksText)return e.blankValues.includes(null==t?t:String(t).trim());t=String(t);var r,n=/\/(i|g|m)*$/.exec(o),l=n?n[0].substring(1):"",i=l.length;if(e.invalidFilterRegEx=void 0,"/"===o.substring(0,1)&&n){try{r=new RegExp(o.substring(1,o.length-(i+1)),l)}catch(t){return void(e.invalidFilterRegEx=t)}return r.test(t)}return!!t.toString&&-1!==t.toString().toLocaleUpperCase().indexOf(o.toLocaleUpperCase())},e.filters.number=function(t,o){return o===e.attributes.blanksText?e.blankValues.includes(null==t?t:String(t).trim()):!o||t===o},["formatters","filters","sorters"].forEach(e.initProp),e.applyComponentStyle(!1,e.intf),e.reloadStoredValues(),e.args.data&&(e.intf.data=e.args.data),(e.intf.innerText||e.intf.textContent)&&("application/x-canvas-datagrid"===e.intf.dataType&&(e.intf.dataType="application/json+x-canvas-datagrid"),e.intf.data=e.intf.innerText||e.intf.textContent),e.args.schema&&(e.intf.schema=e.args.schema),e.isChildGrid||!e.isComponent?requestAnimationFrame((function(){e.resize(!0)})):e.resize(!0),e.initialized=!0,e}function o(t){-1===e.styleKeys.indexOf(t)&&e.styleKeys.push(t)}},e.intf.blur=function(t){e.hasFocus=!1},e.intf.focus=function(){e.hasFocus=!0,e.controlInput.focus()},(e.shadowRoot||e.isChildGrid)&&(Object.defineProperty(e.intf,"height",{get:function(){return e.shadowRoot?e.shadowRoot.height:e.parentNode.height},set:function(t){e.shadowRoot?e.shadowRoot.height=t:e.parentNode.height=t,e.resize(!0)}}),Object.defineProperty(e.intf,"width",{get:function(){return e.shadowRoot?e.shadowRoot.width:e.parentNode.width},set:function(t){e.shadowRoot?e.shadowRoot.width=t:e.parentNode.width=t,e.resize(!0)}}),Object.defineProperty(e.intf,"parentNode",{get:function(){return e.parentNode},set:function(t){if(!e.isChildGrid)throw new TypeError("Cannot set property parentNode which has only a getter");e.parentNode=t}})),Object.defineProperty(e.intf,"visibleRowHeights",{get:function(){return e.visibleRowHeights}}),Object.defineProperty(e.intf,"openChildren",{get:function(){return e.openChildren}}),Object.defineProperty(e.intf,"childGrids",{get:function(){return Object.keys(e.childGrids).map((function(t){return e.childGrids[t]}))}}),Object.defineProperty(e.intf,"isChildGrid",{get:function(){return e.isChildGrid}}),Object.defineProperty(e,"cursor",{get:function(){return e.parentNodeStyle.cursor},set:function(t){"cell"===t&&(t="default"),e.currentCursor!==t&&(e.parentNodeStyle.cursor=t,e.currentCursor=t)}}),Object.defineProperty(e.intf,"orderDirection",{get:function(){return e.orderDirection},set:function(t){"desc"!==t&&(t="asc"),e.orderDirection=t,e.order(e.orderBy,e.orderDirection)}}),Object.defineProperty(e.intf,"orderBy",{get:function(){return e.orderBy},set:function(t){if(void 0===e.getSchema().find((function(e){return e.name===t})))throw new Error("Cannot sort by unknown column name.");e.orderBy=t,e.order(e.orderBy,e.orderDirection)}}),e.isComponent&&(Object.defineProperty(e.intf,"offsetHeight",{get:function(){return e.canvas.offsetHeight}}),Object.defineProperty(e.intf,"offsetWidth",{get:function(){return e.canvas.offsetWidth}})),Object.defineProperty(e.intf,"scrollHeight",{get:function(){return e.scrollBox.scrollHeight}}),Object.defineProperty(e.intf,"scrollWidth",{get:function(){return e.scrollBox.scrollWidth}}),Object.defineProperty(e.intf,"scrollTop",{get:function(){return e.scrollBox.scrollTop},set:function(t){e.scrollBox.scrollTop=t}}),Object.defineProperty(e.intf,"scrollLeft",{get:function(){return e.scrollBox.scrollLeft},set:function(t){e.scrollBox.scrollLeft=t}}),Object.defineProperty(e.intf,"sizes",{get:function(){return e.sizes}}),Object.defineProperty(e.intf,"parentDOMNode",{get:function(){return e.parentDOMNode}}),Object.defineProperty(e.intf,"input",{get:function(){return e.input}}),Object.defineProperty(e.intf,"controlInput",{get:function(){return e.controlInput}}),Object.defineProperty(e.intf,"currentCell",{get:function(){return e.currentCell}}),Object.defineProperty(e.intf,"visibleCells",{get:function(){return e.visibleCells}}),Object.defineProperty(e.intf,"visibleRows",{get:function(){return e.visibleRows}}),Object.defineProperty(e.intf,"selections",{get:function(){return r||(console.warn("DeprecationWarning: The property 'selections' is deprecated due to performance issue. And it will be removed in the future.Please use new property 'selectionList' instead. Visit this link to get more information: https://github.com/TonyGermaneri/canvas-datagrid/pull/498"),r=!0),e.getObsoleteSelectionMatrix()}}),Object.defineProperty(e.intf,"selectionList",{get:function(){return e.selections}}),Object.defineProperty(e.intf,"dragMode",{get:function(){return e.dragMode}}),Object.defineProperty(e.intf,"changes",{get:function(){return e.changes}}),e.intf.formatters=e.formatters,Object.defineProperty(e.intf,"dataType",{get:function(){return e.dataType},set:function(t){if(!e.parsers[t])throw new Error("No parser for MIME type "+t);e.dataType=t}}),e.eventNames.forEach((function(t){Object.defineProperty(e.intf,"on"+t,{get:function(){return e.componentL1Events[t]},set:function(o){e.events[t]=[],e.componentL1Events[t]=o,o&&e.addEventListener(t,o)}})})),Object.defineProperty(e.intf,"frozenRow",{get:function(){return e.frozenRow},set:function(t){if(isNaN(t))throw new TypeError("Expected value for frozenRow to be a number.");if(e.visibleRows.length<t)throw new RangeError("Cannot set a value larger than the number of visible rows.");e.frozenRow=t}}),Object.defineProperty(e.intf,"frozenColumn",{get:function(){return e.frozenColumn},set:function(t){if(isNaN(t))throw new TypeError("Expected value for frozenRow to be a number.");if(e.getVisibleSchema().length<t)throw new RangeError("Cannot set a value larger than the number of visible columns.");e.frozenColumn=t}}),Object.defineProperty(e.intf,"scrollIndexRect",{get:function(){return{top:e.scrollIndexTop,right:e.scrollIndexRight,bottom:e.scrollIndexBottom,left:e.scrollIndexLeft}}}),Object.defineProperty(e.intf,"scrollPixelRect",{get:function(){return{top:e.scrollPixelTop,right:e.scrollPixelRight,bottom:e.scrollPixelBottom,left:e.scrollPixelLeft}}}),Object.defineProperty(e.intf,"rowOrder",{get:function(){return e.orders.rows},set:function(t){if(!Array.isArray(t))throw new TypeError("Value must be an array.");if(!e.originalData||t.length<e.originalData.length)throw new RangeError("Array length must be equal to or greater than number of rows.");e.orders.rows=t}}),Object.defineProperty(e.intf,"columnOrder",{get:function(){return e.orders.columns},set:function(t){if(!Array.isArray(t))throw new TypeError("Value must be an array.");if(t.length<e.getSchema().length)throw new RangeError("Array length must be equal to or greater than number of columns.");e.orders.columns=t}}),Object.defineProperty(e.intf,"selectionBounds",{get:function(){return e.getSelectionBounds()}}),Object.defineProperty(e.intf,"selectedRows",{get:function(){return e.getSelectedData(!0)}}),Object.defineProperty(e.intf,"selectedCells",{get:function(){return e.getSelectedData()}}),Object.defineProperty(e.intf,"visibleSchema",{get:function(){return e.getVisibleSchema().map((function(e){return e}))}}),Object.defineProperty(e.intf,"treeGridAttributes",{get:function(){return e.treeGridAttributes},set:function(t){e.treeGridAttributes=t}}),Object.defineProperty(e.intf,"cellGridAttributes",{get:function(){return e.cellGridAttributes},set:function(t){e.cellGridAttributes=t}}),Object.defineProperty(e.intf,"fillCellCallback",{get:function(){return e.fillCellCallback},set:function(t){e.fillCellCallback=t}}),Object.defineProperty(e.intf,"ctx",{get:function(){return e.ctx}}),Object.defineProperty(e.intf,"schema",{get:function(){return e.getSchema()},set:function(t){if(void 0===t)return e.schema=void 0,e.tempSchema=void 0,void e.dispatchEvent("schemachanged",{schema:void 0});if(!Array.isArray(t)||"object"!==_typeof(t[0]))throw new Error("Schema must be an array of objects.");if(void 0===t[0].name)throw new Error("Expected schema to contain an object with at least a name property.");e.schema=t.map((function(t,o){return t.width=t.width||e.style.cellWidth,t.filter=t.filter||e.filter(t.type),t.type=t.type||"string",t.index=o,t.columnIndex=o,t.rowIndex=-1,t})),e.tempSchema=void 0,e.createNewRowData(),e.createColumnOrders(),e.tryLoadStoredSettings(),e.storedSettings&&"object"===_typeof(e.storedSettings.visibility)&&e.schema.forEach((function(t,o){e.storedSettings&&void 0!==e.storedSettings.visibility[t.name]&&(t.hidden=!e.storedSettings.visibility[t.name])})),e.resize(!0),e.dispatchEvent("schemachanged",{schema:e.schema})}}),e.intf.getTypes=function(){return Object.keys(e.parsers)},e.parseInnerHtml=function(e){if(!e||/^ +$/.test(e))return[];try{e=JSON.parse(e)}catch(e){console.warn(Error("Cannot parse application/json+x-canvas-datagrid formated data. "+e.message+" \nNote: canvas-datagrid.innerHTML is for string data only. Use the canvas-datagrid.data property to set object data."))}return e},e.parsers["application/json+x-canvas-datagrid"]=function(t,o){e.parsers["application/x-canvas-datagrid"](e.parseInnerHtml(t),(function(e,t){return o(e,t)}))},e.parsers["application/x-canvas-datagrid"]=function(e,t){return t(e)},e.intf.parsers=e.parsers,e.etl=function(t,o){if(!e.intf.parsers[e.dataType])throw new Error("Unsupported data type.");e.intf.parsers[e.dataType](t,(function(t,r){e.originalData=t,e.viewData=Array.from(e.originalData),Array.isArray(r)&&(e.schema=r),e.attributes.autoGenerateSchema&&(e.schema=e.getSchemaFromData(t)),e.schema||(e.tempSchema=e.getSchemaFromData(t)),e.getSchema()&&e.createColumnOrders(),e.refresh(),e.schema||0!==(e.originalData||[]).length||(e.tempSchema=[{name:""}]),e.fitColumnToValues("cornerCell",!0),(e.tempSchema&&!e.schema||e.attributes.autoGenerateSchema)&&(e.createColumnOrders(),e.dispatchEvent("schemachanged",{schema:e.tempSchema})),o()}))},Object.defineProperty(e.intf,"viewData",{get:function(){return e.viewData}}),Object.defineProperty(e.intf,"boundData",{get:function(){return e.originalData}}),Object.defineProperty(e.intf,"data",{get:function(){return e.originalData},set:function(t){e.etl(t,(function(){e.changes=[],e.createNewRowData(),e.attributes.autoResizeColumns&&e.originalData.length>0&&void 0===e.storedSettings&&e.autosize(),e.fitColumnToValues("cornerCell",!0),e.createRowOrders(),e.tryLoadStoredSettings(),e.dispatchEvent("datachanged",{data:e.originalData}),e.initCellTreeSettings(),e.resize(!0)}))}}),e.initScrollBox=function(){var t=0,o=0,r=0,n=0,l=0,i=0,a=20,s=20;function c(t,o){if(isNaN(t))throw new Error("ScrollTop value must be a number");t<0&&(t=0),t>l&&(t=l),l<0&&(t=0),r=t,o||e.scroll(),e.button&&e.moveButtonPos()}function d(t,o){if(isNaN(t))throw new Error("ScrollLeft value must be a number");t<0&&(t=0),t>i&&(t=i),i<0&&(t=0),n=t,o||e.scroll(),e.button&&e.moveButtonPos()}e.scrollBox.toString=function(){return'{"width": '+i.toFixed(2)+', "height": '+l.toFixed(2)+', "left": '+n.toFixed(2)+', "top": '+r.toFixed(2)+', "widthRatio": '+e.scrollBox.widthBoxRatio.toFixed(5)+', "heightRatio": '+e.scrollBox.heightBoxRatio.toFixed(5)+"}"},e.scrollBox.scrollTo=function(e,t,o){d(e,!0),c(t,o)},Object.defineProperty(e.scrollBox,"scrollBoxHeight",{get:function(){return a},set:function(e){a=e}}),Object.defineProperty(e.scrollBox,"scrollBoxWidth",{get:function(){return s},set:function(e){s=e}}),Object.defineProperty(e.scrollBox,"height",{get:function(){return t},set:function(e){t=e}}),Object.defineProperty(e.scrollBox,"width",{get:function(){return o},set:function(e){o=e}}),Object.defineProperty(e.scrollBox,"scrollTop",{get:function(){return r},set:c}),Object.defineProperty(e.scrollBox,"scrollLeft",{get:function(){return n},set:d}),Object.defineProperty(e.scrollBox,"scrollHeight",{get:function(){return l},set:function(e){r>e&&(r=Math.max(e,0)),l=e}}),Object.defineProperty(e.scrollBox,"scrollWidth",{get:function(){return i},set:function(e){n>e&&(n=Math.max(e,0)),i=e}})}}function selections(e){var t=this;function o(t,o,n){if(o){var l=o.top,i=o.bottom,a=o.left,s=o.right,c=i-l+1,d=s-a+1,u=getSelectionStateFromCells(e.selections,{startRow:l,endRow:i,startColumn:a,endColumn:s});if(!1!==u)for(var h=r(a,d),f=l,g=l+c;f<g;f++){var m=e.viewData[f]||{},p=!0===u||u[f-l];if(p)for(var w=a,v=a+d;w<v;w++)if(!0===p||p[w-a]){var y=h[w];if(y&&(!y.hidden||n))t({value:m[y.name],header:y,columnName:y.name,boundRowIndex:e.getBoundRowIndexFromViewRowIndex(f),boundColumnIndex:e.orders.columns[w],viewRowIndex:f,viewColumnIndex:w})}}}}function r(t,o){for(var r=e.getSchema(),n=[],l=t,i=t+o;l<i;l++){var a=r[e.orders.columns[l]];n[l]=a}return n}e.selections=[],e.selectionCache=[],e.selectionCacheWidth=0,e.selectionCacheHeight=0,e.getObsoleteSelectionMatrix=function(o){var r=this;_newArrowCheck(this,t);var n=e.getSelectionBounds(!0,o);if(!n)return[];var l=n.top,i=n.bottom,a=n.left,s=n.right,c=i-l+1,d=s-a+1,u=getSelectionStateFromCells(e.selections,{startRow:l,endRow:i,startColumn:a,endColumn:s});if(!1===u)return[];for(var h=[],f=l,g=l+c;f<g;f++)if(!0!==u){var m=u[f-l];if(m){h[f]=[];for(var p=a,w=a+d;p<w;p++)(!0===m||m[p-a])&&h[f].push(p)}}else h[f]=new Array(d).fill(0).map(function(e,t){return _newArrowCheck(this,r),a+t}.bind(this));for(var v=0;v<e.selections.length;v++){var y=e.selections[v];if(y.type===SelectionType.Rows)for(var x=y.startRow;x<=y.endRow;x++)h[x]?-1!==h[x][0]&&h[x].unshift(-1):h[x]=[-1]}return h}.bind(this),e.getSelectedContiguousColumns=function(t){var o=this;t||(t=e.getSchema());var r=getSelectedContiguousColumns(e.selections,!1);if(Array.isArray(r)){var n=e.orders.columns;return r.map(function(e){_newArrowCheck(this,o);var r=n[e],l=t[r];return Object.assign({},l,{orderIndex:e})}.bind(this))}},e.getSelectedContiguousRows=function(t){var o=getSelectedContiguousRows(e.selections,!1);if(Array.isArray(o)&&(t||o[0]!==o[1]))return o},e.canSelectionsBeCopied=function(){return e.selections.length>0&&!areSelectionsComplex(e.selections)},e.getSelectedRowsHeight=function(){var t=getSelectedContiguousRows(e.selections,!0);if(!t)return 0;for(var o=0,r=t[0];r<=t[1];r++)o+=e.getRowHeight(r);return o},e.getSelectedColumnsWidth=function(){var t=getSelectedContiguousColumns(e.selections,!0);if(!t)return 0;for(var o=0,r=t[0];r<=t[1];r++)o+=e.getColumnWidth(e.orders.columns[r]);return o},e.isCellSelected=function(o){return _newArrowCheck(this,t),isCellSelected(e.selections,o.rowIndex,o.viewColumnIndex)}.bind(this),e.isColumnSelected=function(o){return _newArrowCheck(this,t),"number"==typeof o&&isColumnSelected(e.selections,o)}.bind(this),e.isRowSelected=function(o){return _newArrowCheck(this,t),"number"==typeof o&&isRowSelected(e.selections,o)}.bind(this),e.clearSelections=function(o){_newArrowCheck(this,t),e.selections=[],o&&e.dispatchSelectionChangedEvent()}.bind(this),e.selectNone=function(o){_newArrowCheck(this,t),e.clearSelections(!0),o||e.draw()}.bind(this),e.selectAll=function(t){_addIntoSelections(e.selections,{type:SelectionType.Columns,startColumn:0,endColumn:e.getSchema().length-1})&&!t&&e.draw()},e.unselectCell=function(o,r){_newArrowCheck(this,t);var n=_removeFromSelections(e.selections,normalizeSelection({type:SelectionType.Cells,startRow:o.rowIndex,startColumn:o.viewColumnIndex}));return n&&!r&&e.dispatchSelectionChangedEvent(),n}.bind(this),e.unselectRows=function(o,r,n){_newArrowCheck(this,t);var l=_removeFromSelections(e.selections,normalizeSelection({type:SelectionType.Rows,startRow:o,endRow:r}));return l&&!n&&e.dispatchSelectionChangedEvent(),l}.bind(this),e.selectCell=function(o,r){_newArrowCheck(this,t);var n=_addIntoSelections(e.selections,normalizeSelection({type:SelectionType.Cells,startRow:o.rowIndex,startColumn:o.viewColumnIndex}));return n&&!r&&e.dispatchSelectionChangedEvent(),n}.bind(this),e.moveSelection=function(t,o){moveSelections(e.selections,t,o)},e.dispatchSelectionChangedEvent=function(){_newArrowCheck(this,t),e.dispatchEvent("selectionchanged",e.getContextOfSelectionEvent())}.bind(this),e.getContextOfSelectionEvent=function(){_newArrowCheck(this,t);var o={selectionList:e.cloneSelections()};return Object.defineProperty(o,"selections",{get:function(){return e.getObsoleteSelectionMatrix()}}),Object.defineProperty(o,"selectedData",{get:function(){return e.getSelectedData()}}),Object.defineProperty(o,"selectedCells",{get:function(){return e.getSelectedCells()}}),Object.defineProperty(o,"selectionBounds",{get:function(){return e.getSelectionBounds()}}),o}.bind(this),e.cloneSelections=function(){return _newArrowCheck(this,t),cloneSelections(e.selections)}.bind(this),e.getSelectionBounds=function(o,r){_newArrowCheck(this,t);var n=getSelectionBounds(r||e.selections);if(o){if(n.top>n.bottom||n.left>n.right)return null;e.sanitizeSelectionBounds(n)}return n}.bind(this),e.sanitizeSelectionBounds=function(o){if(_newArrowCheck(this,t),!o)return o;o.top<0&&(o.top=0),o.left<0&&(o.left=0);var r=e.viewData.length;o.bottom>r&&(o.bottom=r-1);var n=e.getSchema().length;return o.right>n&&(o.right=n-1),o}.bind(this),e.getSelectedData=function(o){_newArrowCheck(this,t);var n=e.getSelectionBounds(!0);if(!n)return[];var l=[],i=n.top,a=n.bottom,s=n.left,c=n.right,d=a-i+1,u=c-s+1,h=getSelectionStateFromCells(e.selections,{startRow:i,endRow:a,startColumn:s,endColumn:c});if(!1===h)return[];for(var f=r(s,u),g=i,m=i+d;g<m;g++){var p=e.viewData[g]||{},w={},v=!1,y=!0===h||h[g-i];if(y){for(var x=s,C=s+u;x<C;x++)if(!0===h||y[x-s]){var b=f[x];if(b&&!b.hidden){if(v=!0,o)break;w[b.name]=p[b.name]}}v&&(l[g]=o?Object.assign({},p):w)}}return l}.bind(this),e.getSelectedCells=function(r){var n=this;_newArrowCheck(this,t);var l=[],i=e.getSelectionBounds(!0);return o(function(e){return _newArrowCheck(this,n),l.push(e)}.bind(this),i,r),l}.bind(this),e.clearSelectedCells=function(){var r=this;_newArrowCheck(this,t);var n=[],l=e.getSelectionBounds(!0);return o(function(t){_newArrowCheck(this,r),n.push(t),e.viewData[t.viewRowIndex][t.columnName]=""}.bind(this),l,!1),n}.bind(this),e.deleteSelectedData=function(o){var r=this;_newArrowCheck(this,t);var n=e.clearSelectedCells().map(function(e){return _newArrowCheck(this,r),[e.viewRowIndex,e.viewColumnIndex,e.boundRowIndex,e.boundColumnIndex]}.bind(this));e.dispatchEvent("afterdelete",{cells:n}),o||requestAnimationFrame(function(){return _newArrowCheck(this,r),e.draw()}.bind(this))}.bind(this),e.forEachSelectedCell=function(t,r){var n=this,l=e.getSelectionBounds(!0);o(function(o){return _newArrowCheck(this,n),t(e.viewData,o.viewRowIndex,o.columnName,o)}.bind(this),l,r)},e.copySelectedCellsToClipboard=function(o){var r=this;_newArrowCheck(this,t);var n=areSelectionsNeat(e.selections),l=e.getSelectedData().filter(function(e){return _newArrowCheck(this,r),null!=e}.bind(this));if(l.length>0)for(var i=createTextString(l,n),a={"text/plain":i,"text/html":createHTMLString(l,n),"text/csv":i,"application/json":JSON.stringify(l)},s=0,c=Object.entries(a);s<c.length;s++){var d=_slicedToArray(c[s],2),u=d[0],h=d[1];o.setData(u,h)}}.bind(this),e.fitSelectedColumns=function(r){var n=this;_newArrowCheck(this,t);var l=e.getSelectionBounds(!0);if(l){var i="number"==typeof r&&r>0;l.bottom=l.top,o(function(t){_newArrowCheck(this,n);var o=t.columnName,l=t.viewColumnIndex;i?(e.sizes.columns[l]=r,e.dispatchEvent("resizecolumn",{x:r,y:e.resizingStartingHeight,width:r,height:e.resizingStartingHeight,columnIndex:l,draggingItem:e.currentCell})):e.fitColumnToValues(o)}.bind(this),l,!1)}}.bind(this),e.fitSelectedRows=function(o){_newArrowCheck(this,t);var r=e.getSelectionBounds(!0);if(r)for(var n=r.top;n<=r.bottom;n++)e.isRowSelected(n)&&(e.sizes.rows[n]=o,e.dispatchEvent("resizerow",{width:e.resizingStartingWidth,height:o,rowIndex:n,draggingItem:e.currentCell}))}.bind(this),e.selectColumn=function(o,r,n,l){if(_newArrowCheck(this,t),e.isMultiRowsSelected=!1,e.isMultiColumnsSelected=!1,n){if(!e.activeCell)return;var i=Math.min(e.activeCell.columnIndex,o),a=Math.max(e.activeCell.columnIndex,o);_addIntoSelections(e.selections,normalizeSelection({type:SelectionType.Columns,startColumn:i,endColumn:a-1})),i!=a&&(e.isMultiColumnsSelected=!0)}var s;r||n||(e.selections=[],e.activeCell.columnIndex=o,e.activeCell.rowIndex=e.scrollIndexTop),r&&e.isColumnSelected(o)?(s=o,_removeFromSelections(e.selections,normalizeSelection({type:SelectionType.Columns,startColumn:s}))):function(t){_addIntoSelections(e.selections,normalizeSelection({type:SelectionType.Columns,startColumn:t}))}(o),l||e.dispatchSelectionChangedEvent()}.bind(this),e.selectRow=function(o,r,n,l){function i(){l||e.dispatchSelectionChangedEvent()}if(_newArrowCheck(this,t),e.isMultiRowsSelected=!1,(!1===e.dragAddToSelection||void 0===e.dragObject)&&isRowSelected(e.selections,o)&&r)return _removeFromSelections(e.selections,normalizeSelection({type:SelectionType.Rows,startRow:o})),void i();if(!0===e.dragAddToSelection||void 0===e.dragObject)if(n&&void 0===e.dragObject){if(!e.activeCell)return;var a=Math.min(e.activeCell.rowIndex,o),s=Math.max(e.activeCell.rowIndex,o);_addIntoSelections(e.selections,normalizeSelection({type:SelectionType.Rows,startRow:a,endRow:s}))}else c=o,_addIntoSelections(e.selections,normalizeSelection({type:SelectionType.Rows,startRow:c}));var c;i()}.bind(this),e.selectArea=function(t,o){var r=e.getSchema().length;if(t){if(t.right<0&&(t.right=Math.max(r-1,t.left,0)),t.top>t.bottom||t.left>t.right)throw new Error("Impossible selection area");e.selectionBounds=e.sanitizeSelectionBounds(t)}var n=e.selectionBounds,l=n.top,i=n.bottom,a=n.left,s=n.right;if(o||(e.selections=[]),i>=e.viewData.length&&(i=Math.max(e.viewData.length-1,l)),l<-1||a<-1||s>r)throw new Error("Impossible selection area");var c={rows:e.viewData.length,columns:r},d=!1;if(-1===l){var u=Math.max(a,0),h=-1===a?r-1:Math.min(s,r-1);d=_addIntoSelections(e.selections,normalizeSelection({type:SelectionType.Columns,startColumn:u,endColumn:h}),c)}else if(-1===a){var f=Math.max(l,0),g=Math.min(i,e.viewData.length-1);d=_addIntoSelections(e.selections,normalizeSelection({type:SelectionType.Rows,startRow:f,endRow:g}),c)}else d=_addIntoSelections(e.selections,normalizeSelection({type:SelectionType.Cells,startRow:l,endRow:i,startColumn:a,endColumn:s}),c);d&&e.dispatchSelectionChangedEvent()},e.getRowSelectionStates=function(o){var r=this;_newArrowCheck(this,t),("number"!=typeof o||o<0)&&(o=0);var n=e.getSchema().length-1,l=n-0+1,i=getSelectionStateFromCells(e.selections,{startRow:o,startColumn:0,endRow:o,endColumn:n});if(!1!==i){if(!0===i)return new Array(l).fill(!0).map(function(e,t){return _newArrowCheck(this,r),t}.bind(this));var a=i[0];if(a){for(var s=[],c=0;c<a.length;c++)a[c]&&s.push(c);return s}}}.bind(this),e.replaceAllSelections=function(o){_newArrowCheck(this,t),cleanupSelections(o),e.selections=o}.bind(this),e.selectColumnViewIndexes=function(o){var r=this;_newArrowCheck(this,t);var n=o.map(function(e){return _newArrowCheck(this,r),{type:SelectionType.Columns,startColumn:e,endRow:e}}.bind(this));e.replaceAllSelections(n)}.bind(this),e.getRowViewIndexesFromSelection=function(){if(_newArrowCheck(this,t),0===e.selections.length)return[];for(var o=getSelectionBounds(e.selections,!0),r=[],n=o.top;n<=o.bottom;n++)r.push(n);return r}.bind(this),e.shrinkOrExpandSelections=function(o,r,n){_newArrowCheck(this,t);var l=shrinkOrExpandSelections(e.selections,o,r,{columns:e.getSchema().length,rows:e.viewData.length});return l&&!n&&e.dispatchSelectionChangedEvent(),l}.bind(this)}function contextMenu(e){var t,o,r;function n(t){e.createInlineStyle(t,"canvas-datagrid-context-menu-item"+(e.mobile?"-mobile":"")),t.addEventListener("mouseover",(function(){e.createInlineStyle(t,"canvas-datagrid-context-menu-item:hover")})),t.addEventListener("mouseout",(function(){e.createInlineStyle(t,"canvas-datagrid-context-menu-item")}))}function l(r,i,a,s){var c,d,u,h=document.createElement("div"),f=document.createElement("div"),g=document.createElement("div"),m=[],p=-1,w={};if(!Array.isArray(a))throw new Error("createContextMenu expects an array.");function v(){h.scrollTop>0?e.parentDOMNode.appendChild(f):f.parentNode&&f.parentNode.removeChild(f),h.scrollTop>=h.scrollHeight-h.offsetHeight&&g.parentNode?g.parentNode.removeChild(g):h.scrollHeight-h.offsetHeight>0&&!(h.scrollTop>=h.scrollHeight-h.offsetHeight)&&e.parentDOMNode.appendChild(g)}function y(t){return function r(){var n=e.attributes.contextHoverScrollAmount;"up"===t&&0===h.scrollTop||"down"===t&&h.scrollTop===h.scrollHeight||(h.scrollTop+="up"===t?-n:n,o=setTimeout(r,e.attributes.contextHoverScrollRateMs,t))}}function x(e){return function(){clearTimeout(o)}}return w.parentGrid=e.intf,w.parentContextMenu=s,w.container=h,d={},u=e.scrollOffset(e.canvas),void 0===t&&(t=e.style.contextMenuZIndex),a.forEach((function(t){var o,i=document.createElement("div");function a(e){e.relatedTarget===h||t.contextMenu.container===e.relatedTarget||o===e.relatedTarget||i===e.relatedTarget||t.contextMenu.container.contains(e.relatedTarget)||(t.contextMenu.dispose(),m.splice(m.indexOf(t.contextMenu),1),t.contextMenu=void 0,i.removeEventListener("mouseout",a),h.removeEventListener("mouseout",a),i.setAttribute("contextOpen","0"),i.setAttribute("opening","0"))}function s(o){if("1"===i.getAttribute("opening")&&"1"!==i.getAttribute("contextOpen")){var n=i.getBoundingClientRect();n={left:n.left+e.style.childContextMenuMarginLeft+h.offsetWidth,top:n.top+e.style.childContextMenuMarginTop,bottom:n.bottom,right:n.right},t.contextMenu=l(r,n,o,w),i.setAttribute("contextOpen","1"),i.addEventListener("mouseout",a),h.addEventListener("mouseout",a),m.push(t.contextMenu)}}function c(){var e;if("1"!==i.getAttribute("contextOpen")){if(i.setAttribute("opening","1"),"function"==typeof t.items)return e=t.items.apply(w,[function(e){s(e)}]),void(void 0!==e&&Array.isArray(e)&&s(e));s(t.items)}}!function(t){!function e(t){if(null!==t)return"function"==typeof t?e(t(r)):void("object"!==_typeof(t)?(n(i),i.innerHTML=t):i.appendChild(t))}(t.title),t.contextItemContainer=i,(t.items&&t.items.length>0||"function"==typeof t.items)&&(o=document.createElement("div"),e.createInlineStyle(o,"canvas-datagrid-context-child-arrow"),o.innerHTML=e.style.childContextMenuArrowHTML,i.appendChild(o),i.addEventListener("mouseover",c),i.addEventListener("mouseout",(function(){i.setAttribute("opening","0")}))),t.click&&i.addEventListener("click",(function(o){t.click.apply(e,[o])}))}(t),h.appendChild(i)})),e.createInlineStyle(h,"canvas-datagrid-context-menu"+(e.mobile?"-mobile":"")),d.x=i.left-u.left,d.y=i.top-u.top,d.height=0,t+=1,h.style.opacity=0,h.style.position="absolute",f.style.color=e.style.contextMenuArrowColor,g.style.color=e.style.contextMenuArrowColor,[f,g].forEach((function(e){e.style.textAlign="center",e.style.position="absolute",e.style.zIndex=t+1})),h.style.zIndex=t,s&&s.inputDropdown&&(h.style.maxHeight=window.innerHeight-d.y-e.style.autocompleteBottomMargin+"px",h.style.minWidth=i.width+"px",d.y+=i.height),e.mobile&&(h.style.width=i.width+"px"),h.style.left=d.x+"px",h.style.top=d.y+"px",h.addEventListener("scroll",v),h.addEventListener("wheel",(function(t){e.hasFocus&&(h.scrollTop+=t.deltaY,h.scrollLeft+=t.deltaX),v()})),f.innerHTML=e.style.contextMenuArrowUpHTML,g.innerHTML=e.style.contextMenuArrowDownHTML,h.appendChild(f),document.body.appendChild(g),document.body.appendChild(h),function(t){var o=.1;t.style.display="block";var r=setInterval((function(){o>=1&&clearInterval(r),t.style.opacity=o,t.style.filter="alpha(opacity="+100*o+")",o+=.1*o}),.1*e.attributes.animationDurationShowContextMenu)}(h),(c=h.getBoundingClientRect()).bottom>window.innerHeight&&(s&&s.inputDropdown||(d.y-=c.bottom+e.style.contextMenuWindowMargin-window.innerHeight),d.y<0&&(d.y=e.style.contextMenuWindowMargin),h.offsetHeight>window.innerHeight-e.style.contextMenuWindowMargin&&(h.style.height=window.innerHeight-2*e.style.contextMenuWindowMargin+"px")),c.right>window.innerWidth&&(d.x-=c.right-window.innerWidth+e.style.contextMenuWindowMargin),d.x<0&&(d.x=e.style.contextMenuWindowMargin),d.y<0&&(d.y=e.style.contextMenuWindowMargin),h.style.left=d.x+"px",h.style.top=d.y+"px",c=h.getBoundingClientRect(),f.style.top=c.top+"px",g.style.top=c.top+c.height-g.offsetHeight+"px",f.style.left=c.left+"px",g.style.left=c.left+"px",g.style.width=h.offsetWidth+"px",f.style.width=h.offsetWidth+"px",g.addEventListener("mouseover",y("down")),g.addEventListener("mouseout",x()),f.addEventListener("mouseover",y("up")),f.addEventListener("mouseout",x()),v(),w.clickIndex=function(e){a[e].contextItemContainer.dispatchEvent(new Event("click"))},w.rect=c,w.items=a,w.upArrow=f,w.downArrow=g,w.dispose=function(){clearTimeout(o),m.forEach((function(e){e.dispose()})),[g,f,h].forEach((function(t){var o,r,n;o=t,r=1,n=setInterval((function(){r<=.1&&(clearInterval(n),o.style.display="none",o.parentNode&&o.parentNode.removeChild(o)),o.style.opacity=r,o.style.filter="alpha(opacity="+100*r+")",r-=.1*r}),.1*e.attributes.animationDurationHideContextMenu)}))},Object.defineProperty(w,"selectedIndex",{get:function(){return p},set:function(t){if("number"!=typeof t||isNaN(t)||!isFinite(t))throw new Error("Context menu selected index must be a sane number.");(p=t)>a.length-1&&(p=a.length-1),p<0&&(p=0),a.forEach((function(t,o){if(o===p)return e.createInlineStyle(t.contextItemContainer,"canvas-datagrid-context-menu-item:hover");e.createInlineStyle(t.contextItemContainer,"canvas-datagrid-context-menu-item")}))}}),w}function i(t){var o,n=document.createElement("div"),i=document.createElement("div"),a=document.createElement("button"),s=document.createElement("input"),c=t.cell&&t.cell.header?t.cell.header.title||t.cell.header.name:"";function d(){s.style.background=e.style.contextFilterInputBackground,s.style.color=e.style.contextFilterInputColor,e.invalidFilterRegEx&&(s.style.background=e.style.contextFilterInvalidRegExpBackground,s.style.color=e.style.contextFilterInvalidRegExpColor)}function u(n){if(!n||!["ArrowDown","ArrowUp","Enter","Tab"].includes(n.key)){var i,a,c,d=(i=0,a={},c=[],e.viewData.forEach((function(o){var r=null==o[t.cell.header.name]?o[t.cell.header.name]:String(o[t.cell.header.name]).trim(),n=e.blankValues.includes(r)?e.attributes.blanksText:r;a[n]||i>e.attributes.maxAutoCompleteItems||(i+=1,a[n]={title:e.formatters[t.cell.header.type||"string"]({cell:{value:n}}),click:function(t){s.value=n,t.stopPropagation(),s.dispatchEvent(new Event("keyup")),e.disposeAutocomplete()}})})),-1!==Object.keys(a).indexOf(e.attributes.blanksText)&&(c.push(a[e.attributes.blanksText]),delete a[e.attributes.blanksText]),c.concat(Object.keys(a).map((function(e){return a[e]}))));o=s.getBoundingClientRect(),r&&(r.dispose(),r=void 0),(r=l(t,{left:o.left,top:o.top,right:o.right,bottom:o.bottom,height:o.height,width:o.width},d,{inputDropdown:!0})).selectedIndex=0}}e.createInlineStyle(i,"canvas-datagrid-context-menu-label"),e.createInlineStyle(a,"canvas-datagrid-context-menu-filter-button"),e.createInlineStyle(s,"canvas-datagrid-context-menu-filter-input"),d(),s.onclick=e.disposeAutocomplete,s.addEventListener("keydown",(function(t){"ArrowDown"===t.key&&(r.selectedIndex+=1),"ArrowUp"===t.key&&(r.selectedIndex-=1),"Enter"===t.key&&(r.clickIndex(r.selectedIndex),e.disposeContextMenu()),"Tab"===t.key&&(r.clickIndex(r.selectedIndex),t.preventDefault()),"Escape"===t.key&&e.disposeContextMenu()})),s.addEventListener("keyup",(function(){e.setFilter(t.cell.header.name,s.value)})),s.addEventListener("keyup",u),["focus","blur","keydown","keyup","change"].forEach((function(e){s.addEventListener(e,d)})),s.value=t.cell.header&&e.columnFilters[t.cell.header.name]||"",i.innerHTML=e.attributes.filterOptionText.replace(/%s/g,c),a.onclick=function(){if(r)return e.disposeAutocomplete();u()},a.innerHTML=e.style.contextFilterButtonHTML,n.addEventListener("click",(function(e){return e.stopPropagation()})),n.appendChild(i),n.appendChild(s),n.appendChild(a),t.items.push({title:n}),Object.keys(e.columnFilters).length&&Object.keys(e.columnFilters).forEach((function(o){var r=e.getHeaderByName(o);t.items.push({title:e.attributes.removeFilterOptionText.replace(/%s/g,r.title||r.name),click:function(t){t.preventDefault(),e.setFilter(o,""),e.controlInput.focus()}})}))}e.disposeAutocomplete=function(){r&&(r.dispose(),r=void 0)},e.disposeContextMenu=function(o){document.removeEventListener("click",e.disposeContextMenu),t=e.style.contextMenuZIndex,e.disposeAutocomplete(),e.contextMenu&&e.contextMenu.dispose(),e.contextMenu=void 0,o&&(e.canvas.focus(),e.mousedown(o),e.mouseup(o))},e.contextmenuEvent=function(t,o){var r=this;if(e.hasFocus||t.target===e.canvas){for(var a=Object.keys(e.childGrids),s=0;s<a.length;s++){var c=e.childGrids[a[s]],d=c&&c.parentNode;if(d){var u=d.offsetLeft,h=d.offsetWidth,f=d.offsetTop,g=d.offsetHeight;if(!1!=(t.x>=u&&t.x<=u+h)&&!1!=(t.y>=f&&t.y<=f+g))return}}if(e.isChildGrid&&e.parentNode){var m=e.parentGrid&&e.parentGrid.childGrids;if(!m||!Array.isArray(m))return;if(!m.find(function(t){_newArrowCheck(this,r);var o=t.parentNode,n=e.parentNode;return o.offsetTop==n.offsetTop&&o.offsetLeft===n.offsetLeft}.bind(this)))return;for(var p=e.parentNode.offsetLeft,w=e.parentNode.offsetLeft+e.parentNode.offsetWidth,v=e.parentNode.offsetTop,y=e.parentNode.offsetTop+e.parentNode.offsetHeight,x=e.parentNode.parentNode;x;){var C=x,b=C.offsetLeft,S=C.offsetWidth,R=C.offsetTop;b>p&&(p=b),R>v&&(v=R);var B=b+S,T=R+C.offsetHeight;if(B<w&&(w=B),T<y&&(y=T),"canvas-datagrid-tree"!==x.nodeType)break;x=x.parentNode}if(!1==(t.x>=p&&t.x<=w&&t.y>=v&&t.y<=y))return}var I,M=[],k=o||e.getLayerPos(t),A={NativeEvent:t,cell:e.getCellAt(k.x,k.y),pos:k,items:M};A.cell.isGrid||function(t){var o,r=this,l=e.getSchema(),a=function(){var e=this;return _newArrowCheck(this,r),o||(o=new Map(l.map(function(t){return _newArrowCheck(this,e),[t.columnIndex,t]}.bind(this)))),o}.bind(this),s=e.orderings.columns&&e.orderings.columns.length>0,c=!(t.cell.isBackground||t.cell.isColumnHeaderCellCap||t.cell.isScrollBar||t.cell.isCorner||t.cell.isRowHeader)&&t.cell.header;if(e.attributes.showFilter&&c&&i(t),e.attributes.showCopy&&e.canSelectionsBeCopied()&&t.items.push({title:e.attributes.copyText,click:function(){document.execCommand("copy"),e.disposeContextMenu(),e.controlInput.focus()}}),e.attributes.showPaste&&e.clipBoardData&&t.items.push({title:e.attributes.pasteText,click:function(){e.paste(e.clipBoardData),e.draw()}}),e.attributes.showColumnSelector&&(t.items.push({title:e.attributes.columnSelectorText,items:function(){var t=[];return e.getSchema().forEach((function(o){function r(t){o.hidden=!o.hidden,e.dispatchEvent("togglecolumn",{column:o,hidden:o.hidden}),t.preventDefault(),e.stopPropagation(t),e.disposeContextMenu(),e.resize(!0),e.setStorageData()}var l=document.createElement("div");n(l),l.addEventListener("touchstart",r),l.addEventListener("click",r),l.innerHTML=(o.hidden?e.attributes.columnSelectorHiddenText:e.attributes.columnSelectorVisibleText)+(o.title||o.name),t.push({title:l})})),t}}),t.cell&&t.cell.header&&t.cell.columnIndex>-1)){var d=t.cell.columnIndex,u=e.orders.columns[d],h=e.getSelectedContiguousColumns(l),f="";if(h)f=h.map(function(e){return _newArrowCheck(this,r),e.title||e.name}.bind(this)).join("-");else{var g=l[u];g&&(f=g.title||g.name)}t.items.push({title:e.attributes.hideColumnText.replace(/%s/gi,f),click:function(t){t.preventDefault(),e.stopPropagation(t),e.disposeContextMenu(),h?e.hideColumns(h[0].orderIndex,h[1].orderIndex):e.hideColumns(d)}})}if(e.attributes.saveAppearance&&e.attributes.showClearSettingsOption&&(Object.keys(e.sizes.rows).length>0||Object.keys(e.sizes.columns).length>0)&&t.items.push({title:e.attributes.clearSettingsOptionText,click:function(t){t.preventDefault(),e.sizes.rows={},e.sizes.columns={},e.createRowOrders(),e.createColumnOrders(),e.storedSettings=void 0,e.dispatchEvent("resizecolumn",{columnWidth:e.style.cellWidth}),e.dispatchEvent("resizerow",{cellHeight:e.style.cellHeight}),e.setStorageData(),e.resize(!0),e.disposeContextMenu(),e.controlInput.focus()}}),e.attributes.allowSorting&&e.attributes.showOrderByOption&&c&&(t.items.push({title:e.attributes.showOrderByOptionTextAsc.replace("%s",t.cell.header.title||t.cell.header.name),click:function(o){o.preventDefault(),e.order(t.cell.header.name,"asc"),e.controlInput.focus()}}),t.items.push({title:e.attributes.showOrderByOptionTextDesc.replace("%s",t.cell.header.title||t.cell.header.name),click:function(o){o.preventDefault(),e.order(t.cell.header.name,"desc"),e.disposeContextMenu(),e.controlInput.focus()}})),!s&&t.cell.isRowHeader&&t.cell.header){var m=e.getSelectedContiguousRows(!0);if(m){var p,w=m.map(function(t){return _newArrowCheck(this,r),e.getBoundRowIndexFromViewRowIndex(t)}.bind(this));1===w.length?(p="number"==typeof w[0]?w[0]+1:m[0]+1,p=e.attributes.showHideRow.replace("%s",p),t.items.push({title:p,click:function(t){t.preventDefault(),e.hideRows(w[0],w[0])}})):w[0]<=w[1]&&(p=w.map(function(e,t){return _newArrowCheck(this,r),"number"==typeof e?e+1:m[t]+1}.bind(this)).join("-"),p=e.attributes.showHideRows.replace("%s",p),t.items.push({title:p,click:function(t){t.preventDefault(),e.hideRows(w[0],w[1])}}))}}var v=e.getColumnGroupAreaHeight(),y=e.getRowGroupAreaWidth(),x=function(t,o){if(_newArrowCheck(this,r),0!==t.length){for(var n=0;n<t.length;n++)for(var l=t[n],i=0;i<l.length;i++)l[i].collapsed=o;e.refresh()}}.bind(this);t.pos&&t.pos.y<v&&(t.items.push({title:e.attributes.showRemoveAllGroupColumns,click:function(t){t.preventDefault(),e.groupedColumns=[],e.refresh()}}),t.items.push({title:e.attributes.showExpandAllGroupColumns,click:function(t){t.preventDefault(),x(e.groupedColumns,!1)}}),t.items.push({title:e.attributes.showCollapseAllGroupColumns,click:function(t){t.preventDefault(),x(e.groupedColumns,!0)}})),t.pos&&t.pos.x<y&&(t.items.push({title:e.attributes.showRemoveAllGroupRows,click:function(t){t.preventDefault(),e.groupedRows=[],e.refresh()}}),t.items.push({title:e.attributes.showExpandAllGroupRows,click:function(t){t.preventDefault(),x(e.groupedRows,!1)}}),t.items.push({title:e.attributes.showCollapseAllGroupRows,click:function(t){t.preventDefault(),x(e.groupedRows,!0)}}));var C=e.attributes.allowGroupingColumns&&t.cell.isColumnHeader&&t.cell.header&&t.cell.header.index>0,b=e.attributes.allowGroupingColumns&&t.cell.isColumnHeader,S=!s&&e.attributes.allowGroupingRows&&t.cell.isRowHeader&&t.cell.header,R=e.attributes.allowGroupingRows&&t.cell.isRowHeader;if(C){for(var B=[],T=t.cell.header.index,I=T;I>=0&&e.isColumnSelected(I);I--)B[0]=I;for(I=T;e.isColumnSelected(I);I++)B[1]=I;if(I!==T&&2===B.length&&B[1]>B[0]&&e.isNewGroupRangeValid(e.groupedColumns,B[0],B[1])){for(var M=a(),k=[],A=[],z=0;z<B.length;z++){var O=B[z],H=M.get(O);H&&(A.push(H.name),k.push(H.title||H.name||H.index))}A[0]&&A[1]&&t.items.push({title:e.attributes.showGroupColumns.replace("%s",k[0]+"-"+k[1]),click:function(t){t.preventDefault(),e.groupColumns(A[0],A[1]),e.controlInput.focus()}})}}if(b)for(var E=t.cell.columnIndex,P=e.getGroupsColumnBelongsTo(E),L=a(),D=function(o){var r=P[o],n=r.from,l=r.to,i=L.get(n),a=L.get(l);if(i&&a){var s=(i.title||i.name||i.index)+"-"+(a.title||a.name||a.index);t.items.push({title:e.attributes.showRemoveGroupColumns.replace("%s",s),click:function(t){t.preventDefault(),e.removeGroupColumns(i.name,a.name),e.controlInput.focus()}})}else console.warn("Cannot find column ".concat(n," or column ").concat(l))},F=0;F<P.length;F++)D(F);if(S){var W=e.getSelectedContiguousRows(!1)||[],N=W.map(function(t){_newArrowCheck(this,r);var o=e.getBoundRowIndexFromViewRowIndex(t);return"number"==typeof o?o+1:t+1}.bind(this)).join("-");2===W.length&&e.isNewGroupRangeValid(e.groupedRows,W[0],W[1])&&t.items.push({title:e.attributes.showGroupRows.replace("%s",N),click:function(t){t.preventDefault(),e.groupRows(W[0],W[1])}})}if(R)for(var G=t.cell.rowIndex,j=e.getGroupsRowBelongsTo(G),_=function(o){var r=this,n=j[o],l=n.from,i=n.to,a=[l,i].map(function(t){_newArrowCheck(this,r);var o=e.getBoundRowIndexFromViewRowIndex(t);return"number"==typeof o?o+1:t+1}.bind(this)).join("-");t.items.push({title:e.attributes.showRemoveGroupRows.replace("%s",a),click:function(t){t.preventDefault(),e.removeGroupRows(l,i),e.controlInput.focus()}})},V=0;V<j.length;V++)_(V)}(A),"mousedown"!==t.type&&e.dispatchEvent("contextmenu",A)||A.cell.isGrid||(e.contextMenu&&e.disposeContextMenu(),I={left:k.x+k.rect.left+e.style.contextMenuMarginLeft+e.canvasOffsetLeft,top:k.y+k.rect.top+e.style.contextMenuMarginTop+e.canvasOffsetTop,right:A.cell.width+A.cell.x+k.rect.left,bottom:A.cell.height+A.cell.y+k.rect.top,height:A.cell.height,width:A.cell.width},e.mobile&&(I.left=e.style.mobileContextMenuMargin+"px",I.width=e.width-2*e.style.mobileContextMenuMargin+"px"),"mousedown"==t.type&&(I.top+=e.style.filterButtonMenuOffsetTop),e.contextMenu=l(A,I,M),"mousedown"==t.type?window.addEventListener("mouseup",z):z(),t.preventDefault())}function z(){requestAnimationFrame((function(){document.addEventListener("click",e.disposeContextMenu),window.removeEventListener("mouseup",z)}))}}}function button(e){var t;function o(o,n,l){var i=document.createElement("div"),a=document.createElement("div"),s=document.createElement("div"),c={};if(!Array.isArray(n))throw new Error("createButton expects an array.");return c.wrapper=i,c.items=n,function(){var n={},c=e.scrollOffset(e.canvas);if(void 0===t&&(t=e.style.buttonZIndex),function(t){e.createInlineStyle(t,"canvas-datagrid-button-wrapper"),t.addEventListener("mouseover",(function(){e.buttonMenu||e.createInlineStyle(t,"canvas-datagrid-button-wrapper:hover")})),t.addEventListener("mouseout",(function(){e.buttonMenu||e.createInlineStyle(t,"canvas-datagrid-button-wrapper")}))}(i),e.createInlineStyle(s,"canvas-datagrid-button-icon"),e.createInlineStyle(a,"canvas-datagrid-button-arrow"),n.x=o.left-c.left,n.y=o.top-c.top,n.height=0,t+=1,i.style.position="absolute",i.style.zIndex=t,i.style.left=n.x+"px",i.style.top=n.y+"px",i.left=o.left+e.scrollBox.scrollLeft,i.top=o.top+e.scrollBox.scrollTop,a.innerHTML=e.style.buttonArrowDownHTML,l){var d=document.createElement("img");d.setAttribute("src",l),d.style.maxWidth="100%",d.style.height="100%",s.appendChild(d)}i.appendChild(s),i.appendChild(a),document.body.appendChild(i),i.addEventListener("click",r)}(),c.dispose=function(){i.parentNode&&i.parentNode.removeChild(i)},c}function r(){if(e.buttonMenu)e.disposeButtonMenu();else{var o={left:e.button.wrapper.left-e.scrollBox.scrollLeft,top:e.button.wrapper.top+e.button.wrapper.offsetHeight-e.scrollBox.scrollTop};e.buttonMenu=function(o,r){var n,l=document.createElement("div"),i=-1,a={};function s(){function t(t,o){function r(t){null!==t&&("object"!==_typeof(t)?(!function(t){e.createInlineStyle(t,"canvas-datagrid-button-menu-item"+(e.mobile?"-mobile":"")),t.addEventListener("mouseover",(function(){e.createInlineStyle(t,"canvas-datagrid-button-menu-item:hover")})),t.addEventListener("mouseout",(function(){e.createInlineStyle(t,"canvas-datagrid-button-menu-item")}))}(o),o.innerHTML=t):o.appendChild(t))}r(t.title),t.buttonMenuItemContainer=o,t.click&&o.addEventListener("click",(function(o){t.click.apply(e,[o]),e.disposeButton()}))}var o,n=_createForOfIteratorHelper(r);try{for(n.s();!(o=n.n()).done;){var i=o.value,a=document.createElement("div");t(i,a),l.appendChild(a)}}catch(e){n.e(e)}finally{n.f()}}function c(e){r[e].buttonMenuItemContainer.dispatchEvent(new Event("click"))}function d(){var r={},i=e.scrollOffset(e.canvas);void 0===t&&(t=e.style.buttonZIndex),s(),e.createInlineStyle(l,"canvas-datagrid-button-menu"+(e.mobile?"-mobile":"")),r.x=o.left-i.left,r.y=o.top-i.top,r.height=0,t+=1,l.style.position="absolute",l.style.zIndex=t,l.style.left=r.x+"px",l.style.top=r.y+"px",document.body.appendChild(l),(n=l.getBoundingClientRect()).bottom>window.innerHeight&&(r.y=e.button.wrapper.top-l.offsetHeight-e.scrollBox.scrollTop,r.y<0&&(r.y=e.style.buttonMenuWindowMargin),l.offsetHeight>window.innerHeight-e.style.buttonMenuWindowMargin&&(l.style.height=window.innerHeight-2*e.style.buttonMenuWindowMargin+"px")),n.right>window.innerWidth&&(r.x-=n.right-window.innerWidth+e.style.buttonMenuWindowMargin),r.x<0&&(r.x=e.style.buttonMenuWindowMargin),r.y<0&&(r.y=e.style.buttonMenuWindowMargin),l.style.left=r.x+"px",l.style.top=r.y+"px"}return a.buttonMenu=l,d(),a.clickIndex=c,a.rect=n,a.items=r,a.dispose=function(){l.parentNode&&l.parentNode.removeChild(l)},Object.defineProperty(a,"selectedIndex",{get:function(){return i},set:function(t){if("number"!=typeof t||isNaN(t)||!isFinite(t))throw new Error("Button menu selected index must be a sane number.");(i=t)>r.length-1&&(i=r.length-1),i<0&&(i=0),r.forEach((function(t,o){if(o===i)return e.createInlineStyle(t.buttonMenuItemContainer,"canvas-datagrid-button-menu-item:hover");e.createInlineStyle(t.buttonMenuItemContainer,"canvas-datagrid-button-menu-item")}))}}),a}(o,e.button.items),e.createInlineStyle(e.button.wrapper,"canvas-datagrid-button-wrapper:active"),requestAnimationFrame((function(){document.addEventListener("click",e.disposeButtonMenu)}))}}e.disposeButtonMenu=function(){e.buttonMenu&&(document.removeEventListener("click",e.disposeButtonMenu),e.buttonMenu.dispose(),e.buttonMenu=void 0,e.createInlineStyle(e.button.wrapper,"canvas-datagrid-button-wrapper:hover"))},e.disposeButton=function(o){o&&27!==o.keyCode||(document.removeEventListener("keydown",e.disposeButton),t=e.style.buttonZIndex,e.disposeButtonMenu(),e.button&&e.button.dispose(),e.button=void 0)},e.moveButtonPos=function(){e.button.wrapper.style.left=e.button.wrapper.left-e.scrollBox.scrollLeft+"px",e.button.wrapper.style.top=e.button.wrapper.top-e.scrollBox.scrollTop+"px",e.disposeButtonMenu()},e.attachButton=function(t,r,n){e.button&&e.disposeButton(),e.button=o(t,r,n),requestAnimationFrame((function(){document.addEventListener("keydown",e.disposeButton)}))}}function dom(e){e.getClippingRect=function(t){var o=e.position(e.parentNode),r=e.position(t),n=e.scrollOffset(e.canvas),l={x:0,y:0,h:0,w:0},i={x:-1/0,y:-1/0,h:1/0,w:1/0},a=e.getColumnHeaderCellHeight(),s=e.getRowHeaderCellWidth();return o.top-=n.top,o.left-=n.left,r.top-=n.top,r.left-=n.left,l.h=o.top+o.height-t.offsetTop-e.style.scrollBarWidth,l.w=o.left+o.width-t.offsetLeft-e.style.scrollBarWidth,l.x=o.left+-1*r.left+s,l.y=o.top+-1*r.top+a,{x:l.x>i.x?l.x:i.x,y:l.y>i.y?l.y:i.y,h:l.h<i.h?l.h:i.h,w:l.w<i.w?l.w:i.w}},e.clipElement=function(t){var o=e.getClippingRect(t);o.w<0&&(o.w=0),o.h<0&&(o.h=0),t.style.clip="rect("+o.y+"px,"+o.w+"px,"+o.h+"px,"+o.x+"px)"},e.scrollOffset=function(t){for(var o=0,r=0,n=document.scrollingElement||{scrollLeft:0,scrollTop:0};t.parentNode&&"CANVAS-DATAGRID"!==t.nodeName&&t!==e.intf;)"canvas-datagrid-tree"!==t.nodeType&&"canvas-datagrid-cell"!==t.nodeType&&(o-=t.scrollLeft,r-=t.scrollTop),t=t.parentNode;return{left:o-n.scrollLeft,top:r-n.scrollTop}},e.resizeEditInput=function(){if(e.input&&e.input.editCell){var t=e.canvas.getBoundingClientRect(),o=e.scrollOffset(e.intf),r="collapse"===e.style.gridBorderCollapse?1:2,n=e.style.cellBorderWidth*r,l=e.getVisibleCellByIndex(e.input.editCell.columnIndex,e.input.editCell.rowIndex)||{x:-100,y:-100,height:0,width:0};if(e.mobile)return e.input.style.left="0",e.input.style.top=e.height-e.style.mobileEditInputHeight-n-1+"px",e.input.style.height=e.style.mobileEditInputHeight+"px",void(e.input.style.width=e.width-n-1+"px");var i=e.getColumnGroupAreaHeight(),a=e.getRowGroupAreaWidth();if(e.parentNode){var s=e.parentNode,c=s.columnGroupsAreaHeight,d=s.rowGroupsAreaWidth;c&&(i+=c),d&&(a+=d)}e.input.style.left=t.left+l.x+e.canvasOffsetLeft-o.left+a+"px",e.input.style.top=t.top+l.y-e.style.cellBorderWidth+e.canvasOffsetTop-o.top+i+"px",e.input.style.height=l.height-n+"px",e.input.style.width=l.width-e.style.cellPaddingLeft+"px",e.clipElement(e.input)}},e.position=function(t,o){for(var r,n,l=0,i=0,a=t,s=!1;t.offsetParent&&"CANVAS-DATAGRID"!==t.nodeName;){var c="canvas-datagrid-tree"===t.nodeType;c&&s||(l+=t.offsetLeft,i+=t.offsetTop,r=t.offsetHeight,n=t.offsetWidth),c&&(s=!0),t=t.offsetParent}return o?{left:l,top:i,height:r,width:n}:(t=a,{left:l+(a=e.scrollOffset(t)).left,top:i+a.top,height:r,width:n})},e.getLayerPos=function(t){var o=e.canvas.getBoundingClientRect(),r={x:t.clientX-o.left,y:t.clientY-o.top};return e.isChildGrid&&(r.x-=e.canvasOffsetLeft,r.y-=e.canvasOffsetTop,e.parentNode.rowGroupsAreaWidth&&(r.x-=e.parentNode.rowGroupsAreaWidth),e.parentNode.columnGroupsAreaHeight&&(r.y-=e.parentNode.columnGroupsAreaHeight)),{x:r.x,y:r.y,rect:o}},e.endEdit=function(t){var o=e.input.editCell,r=o.rowIndex;if(e.dispatchEvent("beforeendedit",{cell:o,newValue:e.input.value,oldValue:o.value,abort:function(){t=!0},input:e.input}))return!1;if(e.input.value!==o.value&&!t){if(e.changes[r]=e.changes[r]||{},e.changes[r][o.header.name]=e.input.value,o.data||(e.originalData[o.boundRowIndex]={},o.data=e.originalData[o.boundRowIndex]),o.data[o.header.name]=e.input.value,r===e.viewData.length){if(e.dispatchEvent("newrow",{value:e.input.value,defaultValue:o.value,aborted:t,cell:o,input:e.input}))return!1;e.addRow(o.data),e.createNewRowData()}e.draw(!0)}return e.input.parentNode&&e.input.parentNode.removeChild(e.input),e.intf.focus(),e.dispatchEvent("endedit",{cell:o,value:e.input.value,aborted:t,input:e.input}),e.input=void 0,!0},e.beginEditAt=function(t,o,r){var n=arguments.length>3&&void 0!==arguments[3]&&arguments[3];if(e.attributes.editable){e.input&&e.endEdit();var l,i,a,s,c,d=e.getVisibleCellByIndex(t,o);e.getSchema();if(d&&d.header){if(a=d.header.enum,e.dispatchEvent("beforebeginedit",{cell:d,NativeEvent:r}))return!1;if(e.scrollIntoView(t,o),e.setActiveCell(t,o),l=e.getAdjacentCells(),e.input=a?document.createElement("select"):document.createElement(e.attributes.multiLine?"textarea":"input"),d=e.getVisibleCellByIndex(t,o)){a&&("function"==typeof a?i=a.apply(e.intf,[{cell:d}]):Array.isArray(a)&&(i=a),i.forEach((function(t){var o,r,n=document.createElement("option");Array.isArray(t)?(o=t[0],r=t[1]):(o=t,r=t),o===d.value&&(c=!0),n.value=o,n.innerHTML=r,e.input.appendChild(n)})),c||((s=document.createElement("option")).value=d.value,s.innerHTML=d.value,e.input.appendChild(s)),e.input.addEventListener("change",(function(){e.endEdit(),e.draw(!0)}))),e.dispatchEvent("appendeditinput",{cell:d,input:e.input})||document.body.appendChild(e.input),e.createInlineStyle(e.input,e.mobile?"canvas-datagrid-edit-mobile-input":"canvas-datagrid-edit-input"),e.input.style.position="absolute",e.input.editCell=d,e.resizeEditInput(),e.input.style.zIndex=e.style.editCellZIndex,e.input.style.fontSize=parseInt(e.style.editCellFontSize,10)*e.scale+"px";var u=-1!==[null,void 0].indexOf(d.value)||n;e.input.value=u?"":d.value;var h=Math.round(e.input.value.length*parseInt(e.style.editCellFontSize,10)*.7*e.scale);h+e.style.cellPaddingLeft<d.width?h=d.width-e.style.cellPaddingLeft:h>e.width-d.x-e.style.scrollBarWidth&&(h=e.width-d.x-e.style.scrollBarWidth,e.input.style.height="auto"),e.input.style.width=h+"px",e.input.focus(),e.input.addEventListener("click",e.stopPropagation),e.input.addEventListener("dblclick",e.stopPropagation),e.input.addEventListener("mouseup",e.stopPropagation),e.input.addEventListener("mousedown",e.stopPropagation),e.input.addEventListener("keydown",(function(o){var r=d.columnIndex,i=d.rowIndex;if("Escape"===o.key)e.endEdit(!0),e.draw(!0);else if("Enter"===o.key&&e.attributes.multiLine&&o.altKey)e.input.value=e.input.value+"\n",e.input.scrollTop=e.input.scrollHeight;else if("Enter"===o.key){e.endEdit();var a=o.shiftKey?Math.max(0,i-1):Math.min(i+1,e.viewData.length-1);a!==i&&(e.scrollIntoView(r,a),e.setActiveCell(r,a)),e.draw(!0)}else if(["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"].includes(o.key)&&n){switch(o.key){case"ArrowUp":i=Math.max(0,i-1);break;case"ArrowDown":i=Math.min(i+1,e.viewData.length-1);break;case"ArrowLeft":r=Math.max(r-1,0);break;case"ArrowRight":r=l.right}e.endEdit(),e.scrollIntoView(r,i),e.setActiveCell(r,i),e.draw(!0)}else if("Tab"===o.key){if(o.preventDefault(),!e.endEdit())return;r=o.shiftKey?l.left:l.right,l.left===t&&o.shiftKey&&(r=l.last,i-=1),l.right!==t||o.shiftKey||(r=l.first,i+=1),i<0&&(i=e.viewData.length-1),i>e.viewData.length-1&&(i=0),e.scrollIntoView(r,i),e.beginEditAt(r,i,o)}else{var s=Math.round(e.input.value.length*parseInt(e.style.editCellFontSize,10)*.7*e.scale);s+e.style.cellPaddingLeft<d.width?s=d.width-e.style.cellPaddingLeft:s>e.width-d.x-e.style.scrollBarWidth&&(s=e.width-d.x-e.style.scrollBarWidth,e.input.style.height="auto"),e.input.style.width=s+"px"}})),e.dispatchEvent("beginedit",{cell:d,input:e.input})}}}},e.createInlineStyle=function(t,o){var r={"canvas-datagrid-button-wrapper":{display:"inline-block",padding:e.style.buttonPadding,borderWidth:"1px",borderStyle:"solid",borderColor:e.style.buttonBorderColor,cursor:"pointer",background:e.style.buttonBackgroundColor,userSelect:"none"},"canvas-datagrid-button-wrapper:hover":{borderColor:e.style.buttonBorderColor,background:e.style.buttonHoverBackgroundColor},"canvas-datagrid-button-wrapper:active":{borderColor:e.style.buttonActiveBorderColor,background:e.style.buttonActiveBackgroundColor},"canvas-datagrid-button-icon":{width:"18px",height:"18px",display:"inline-block",verticalAlign:"middle"},"canvas-datagrid-button-arrow":{display:"inline-block",color:e.style.buttonArrowColor,fontSize:"9px"},"canvas-datagrid-button-menu-item-mobile":{lineHeight:"normal",fontWeight:"normal",fontFamily:e.style.contextMenuFontFamily,fontSize:e.style.contextMenuFontSize,color:"inherit",background:"inherit",margin:e.style.contextMenuItemMargin,borderRadius:e.style.contextMenuItemBorderRadius,verticalAlign:"middle"},"canvas-datagrid-button-menu-item":{lineHeight:"normal",fontWeight:"normal",fontFamily:e.style.contextMenuFontFamily,fontSize:e.style.contextMenuFontSize,color:"inherit",background:"inherit",margin:e.style.contextMenuItemMargin,borderRadius:e.style.contextMenuItemBorderRadius,verticalAlign:"middle"},"canvas-datagrid-button-menu-item:hover":{background:e.style.contextMenuHoverBackground,color:e.style.contextMenuHoverColor},"canvas-datagrid-button-menu-label":{margin:e.style.contextMenuLabelMargin,display:e.style.contextMenuLabelDisplay,minWidth:e.style.contextMenuLabelMinWidth,maxWidth:e.style.contextMenuLabelMaxWidth},"canvas-datagrid-button-menu-mobile":{lineHeight:"normal",fontWeight:"normal",fontFamily:e.style.contextMenuFontFamily,fontSize:e.style.contextMenuFontSize,background:e.style.contextMenuBackground,color:e.style.contextMenuColor,border:e.style.contextMenuBorder,padding:e.style.contextMenuPadding,borderRadius:e.style.contextMenuBorderRadius,opacity:e.style.contextMenuOpacity,overflow:"hidden",whiteSpace:"nowrap"},"canvas-datagrid-button-menu":{lineHeight:"normal",fontWeight:"normal",fontFamily:e.style.contextMenuFontFamily,fontSize:e.style.contextMenuFontSize,background:e.style.contextMenuBackground,color:e.style.contextMenuColor,border:e.style.contextMenuBorder,padding:e.style.contextMenuPadding,borderRadius:e.style.contextMenuBorderRadius,opacity:e.style.contextMenuOpacity,overflow:"hidden",whiteSpace:"nowrap",cursor:e.style.contextMenuCursor},"canvas-datagrid-context-menu-filter-input":{height:"19px",verticalAlign:"bottom",marginLeft:"2px",padding:"0",background:e.style.contextFilterInputBackground,color:e.style.contextFilterInputColor,border:e.style.contextFilterInputBorder,borderRadius:e.style.contextFilterInputBorderRadius,lineHeight:"normal",fontWeight:"normal",fontFamily:e.style.contextFilterInputFontFamily,fontSize:e.style.contextFilterInputFontSize},"canvas-datagrid-context-menu-filter-button":{height:"19px",verticalAlign:"bottom",marginLeft:"2px",padding:"0",background:e.style.contextMenuBackground,color:e.style.contextMenuColor,border:e.style.contextFilterButtonBorder,borderRadius:e.style.contextFilterButtonBorderRadius,lineHeight:"normal",fontWeight:"normal",fontFamily:e.style.contextMenuFilterButtonFontFamily,fontSize:e.style.contextMenuFilterButtonFontSize},"canvas-datagrid-context-child-arrow":{cssFloat:"right",color:e.style.childContextMenuArrowColor,fontSize:e.style.contextMenuChildArrowFontSize,fontFamily:e.style.contextMenuFontFamily,verticalAlign:"middle"},"canvas-datagrid-autocomplete":{fontFamily:e.style.contextMenuFontFamily,fontSize:e.style.contextMenuFontSize,background:e.style.contextMenuBackground,color:e.style.contextMenuColor,border:e.style.contextMenuBorder,padding:e.style.contextMenuPadding,borderRadius:e.style.contextMenuBorderRadius,opacity:e.style.contextMenuOpacity,position:"absolute",zIndex:9999,overflow:"hidden"},"canvas-datagrid-autocomplete-item":{background:e.style.contextMenuBackground,color:e.style.contextMenuColor},"canvas-datagrid-autocomplete-item:hover":{background:e.style.contextMenuHoverBackground,color:e.style.contextMenuHoverColor},"canvas-datagrid-canvas":{position:"absolute",zIndex:"-1"},"canvas-datagrid":{display:"block"},"canvas-datagrid-control-input":{position:"fixed",top:"-5px",left:"-5px",border:"none",opacity:"0",cursor:"pointer",width:"1px",height:"1px",lineHeight:"normal",fontWeight:"normal",fontFamily:e.style.contextMenuFontFamily,fontSize:e.style.contextMenuFontSize},"canvas-datagrid-edit-mobile-input":{boxSizing:"content-box",outline:"none",margin:"0",padding:"0 0 0 0",lineHeight:"normal",fontWeight:"normal",fontFamily:e.style.mobileEditFontFamily,fontSize:e.style.mobileEditFontSize,border:e.style.editCellBorder,color:e.style.editCellColor,background:e.style.editCellBackgroundColor,appearance:"none",webkitAppearance:"none",mozAppearance:"none",borderRadius:"0"},"canvas-datagrid-edit-input":{boxSizing:"content-box",outline:"none",margin:"0",padding:"0 0 0 "+e.style.editCellPaddingLeft+"px",lineHeight:"normal",fontWeight:"normal",fontFamily:e.style.editCellFontFamily,fontSize:e.style.editCellFontSize,boxShadow:e.style.editCellBoxShadow,border:e.style.editCellBorder,color:e.style.editCellColor,background:e.style.editCellBackgroundColor,appearance:"none",webkitAppearance:"none",mozAppearance:"none",borderRadius:"0"},"canvas-datagrid-context-menu-item-mobile":{lineHeight:"normal",fontWeight:"normal",fontFamily:e.style.contextMenuFontFamily,fontSize:e.style.contextMenuFontSize,color:"inherit",background:"inherit",margin:e.style.contextMenuItemMargin,borderRadius:e.style.contextMenuItemBorderRadius,verticalAlign:"middle"},"canvas-datagrid-context-menu-item":{lineHeight:"normal",fontWeight:"normal",fontFamily:e.style.contextMenuFontFamily,fontSize:e.style.contextMenuFontSize,color:"inherit",background:"inherit",margin:e.style.contextMenuItemMargin,borderRadius:e.style.contextMenuItemBorderRadius,verticalAlign:"middle"},"canvas-datagrid-context-menu-item:hover":{background:e.style.contextMenuHoverBackground,color:e.style.contextMenuHoverColor},"canvas-datagrid-context-menu-label":{margin:e.style.contextMenuLabelMargin,display:e.style.contextMenuLabelDisplay,minWidth:e.style.contextMenuLabelMinWidth,maxWidth:e.style.contextMenuLabelMaxWidth},"canvas-datagrid-context-menu-mobile":{lineHeight:"normal",fontWeight:"normal",fontFamily:e.style.contextMenuFontFamily,fontSize:e.style.contextMenuFontSize,background:e.style.contextMenuBackground,color:e.style.contextMenuColor,border:e.style.contextMenuBorder,padding:e.style.contextMenuPadding,borderRadius:e.style.contextMenuBorderRadius,opacity:e.style.contextMenuOpacity,overflow:"hidden",whiteSpace:"nowrap"},"canvas-datagrid-context-menu":{lineHeight:"normal",fontWeight:"normal",fontFamily:e.style.contextMenuFontFamily,fontSize:e.style.contextMenuFontSize,background:e.style.contextMenuBackground,color:e.style.contextMenuColor,border:e.style.contextMenuBorder,padding:e.style.contextMenuPadding,borderRadius:e.style.contextMenuBorderRadius,opacity:e.style.contextMenuOpacity,overflow:"hidden",whiteSpace:"nowrap",cursor:e.style.contextMenuCursor},"canvas-datagrid-invalid-search-regExp":{background:e.style.contextMenuFilterInvalidExpresion}};r[o]&&(Object.keys(r[o]).map((function(e){t.style[e]=r[o][e]})),t.className=o)},e.appendTo=function(t){e.parentNode=t,e.setDom()},e.setDom=function(){e.isChildGrid?(e.parentGrid=e.parentNode.parentGrid,e.ctx=e.parentGrid.context,e.canvas=e.parentGrid.canvas,e.controlInput=e.parentGrid.controlInput,e.eventParent=e.canvas):(e.controlInput=e.controlInput||document.createElement("input"),e.controlInput.onblur=e.intf.blur,e.createInlineStyle(e.controlInput,"canvas-datagrid-control-input"),e.isChildGrid=!1,e.parentDOMNode=e.parentNode,e.parentIsCanvas=/^canvas$/i.test(e.parentDOMNode.tagName),e.parentIsCanvas?e.canvas=e.parentDOMNode:(e.canvas=document.createElement("canvas"),e.parentDOMNode.appendChild(e.canvas)),document.body.appendChild(e.controlInput),e.createInlineStyle(e.canvas,"canvas-datagrid"),e.ctx=e.canvas.getContext("2d"),e.ctx.textBaseline="alphabetic",e.eventParent=e.canvas),e.parentNodeStyle=e.canvas.style,e.controlInput.setAttribute("readonly",!0),e.controlInput.addEventListener("blur",(function(t){t.target!==e.canvas&&(e.hasFocus=!1)})),e.eventParent.addEventListener("scroll",e.resize,!1),e.eventParent.addEventListener("touchstart",e.touchstart,!1),e.eventParent.addEventListener("mousedown",e.mousedown,!1),e.eventParent.addEventListener("dblclick",e.dblclick,!1),e.eventParent.addEventListener("click",e.click,!1),e.eventParent.addEventListener("mouseup",e.mouseup,!1),window.addEventListener("mousemove",e.mousemove),e[e.isChildGrid?"parentGrid":"eventParent"].addEventListener("wheel",e.scrollWheel,!1),e.canvas.addEventListener("contextmenu",e.contextmenuEvent,!1),e.controlInput.addEventListener("copy",e.copy),e.controlInput.addEventListener("cut",e.cut),e.controlInput.addEventListener("paste",e.paste),e.controlInput.addEventListener("keypress",e.keypress,!1),e.controlInput.addEventListener("keyup",e.keyup,!1),e.controlInput.addEventListener("keydown",e.keydown,!1),window.addEventListener("resize",e.resize)}}var mergeHiddenRowRanges=function(e,t){var o=this,r=_slicedToArray(t,2),n=r[0],l=r[1];if(l<n)return!1;for(var i=!1,a=0;a<e.length;a++){var s=e[a];if(!(n>s[1]+1)){if(n<=s[0]&&l>=s[0]){e[a]=[n,Math.max(l,s[1])],i=!0;break}if(n>=s[0]){e[a]=[s[0],Math.max(l,s[1])],i=!0;break}}}i||e.push([n,l]),e.sort(function(e,t){return _newArrowCheck(this,o),e[0]-t[0]}.bind(this));for(var c=0;c<e.length-1;c++){var d=e[c],u=e[c+1];u[0]<=d[1]+1&&(e[c]=[d[0],Math.max(d[1],u[1])],e.splice(c+1,1),c--)}return!0};function publicMethods(e){function t(t,o,r){for(var n=!1,l="rows"===t?e.groupedRows:e.groupedColumns,i=l.length-1;i>=0;i--){var a=l[i],s=a[0].from,c=a[a.length-1].to;if(o<=s&&r>=c){if(o===s&&r===c&&1===a.length)return}else{for(var d=0;d<a.length;d++){var u=a[d];if(!(o>u.to)){if(o>=u.from){if(r>u.to){if(o===u.from)return l.splice(i,0,[{from:o,to:r,collapsed:!1}]),void e.refresh();throw new Error("Can't group these ".concat(t))}if(r===u.to&&o===u.from)return;n=!0;break}if(r>=u.from){if(r<u.to)throw new Error("Can't group these ".concat(t));l.splice(i,0,[{from:o,to:r,collapsed:!1}])}else a.splice(d,0,{from:o,to:r,collapsed:!1});return void e.refresh()}}if(!n)return a.push({from:o,to:r,collapsed:!1}),void e.refresh()}}n?l.push([{from:o,to:r,collapsed:!1}]):l.unshift([{from:o,to:r,collapsed:!1}]),e.refresh()}function o(t,o,r){for(var n=0;n<t.length;n++)for(var l=t[n],i=0;i<l.length;i++){var a=l[i];if(a.from===o&&a.to===r)return l.length<=1?t.splice(n,1):l.splice(i,1),void e.refresh()}}e.integerToAlpha=function(e){for(var t="a".charCodeAt(0),o="z".charCodeAt(0)-t+1,r="";e>=0;)r=String.fromCharCode(e%o+t)+r,e=Math.floor(e/o)-1;return r},e.insertColumn=function(t,o){var r=e.getSchema();if(r.length<o)throw new Error("Index is beyond the length of the schema.");e.validateColumn(t,r),r.splice(o,0,t),e.originalData.forEach((function(o,r){e.applyDefaultValue(o,t,r)})),e.intf.schema=r,e.refresh()},e.deleteColumn=function(t){var o=e.getSchema();e.originalData.forEach((function(e){delete e[o[t].name]})),o.splice(t,1),e.intf.schema=o,e.refresh()},e.addColumn=function(t){var o=e.getSchema();e.validateColumn(t,o),o.push(t),e.originalData.forEach((function(o,r){e.applyDefaultValue(o,t,r)})),e.intf.schema=o,e.refresh()},e.deleteRow=function(t){e.originalData.splice(t,1),e.setFilter(),e.resize(!0)},e.insertRow=function(t,o){if(e.originalData.length<o)throw new Error("Index is beyond the length of the dataset.");e.originalData.splice(o,0,t),e.getSchema().forEach((function(r){void 0===t[r.name]&&e.applyDefaultValue(e.originalData[o],r,o)})),e.setFilter(),e.resize(!0)},e.addRow=function(t){e.originalData.push(t),e.getSchema().forEach((function(o){void 0===t[o.name]&&e.applyDefaultValue(e.originalData[e.originalData.length-1],o,e.originalData.length-1)})),e.setFilter(),e.resize(!0)},e.setRowHeight=function(t,o){e.sizes.rows[t]=o,e.draw(!0)},e.setColumnWidth=function(t,o){e.sizes.columns[t]=o,e.draw(!0)},e.resetColumnWidths=function(){e.sizes.columns={},e.draw(!0)},e.resetRowHeights=function(){e.sizes.rows={},e.draw(!0)},e.setFilter=function(t,o){void 0===t&&void 0===o?e.columnFilters={}:!t||""!==o&&void 0!==o?(e.columnFilters[t]=o,e.attributes.showFilterInCell&&(e.filterable.rows.push(0),e.orders.columns.forEach((function(t,o){e.filterable.columns.push(o)})))):delete e.columnFilters[t],Object.keys(e.columnFilters).length||(e.filterable={rows:[],columns:[]}),e.refresh()},e.findRowScrollTop=function(t){if(void 0===e.scrollCache.y[t])throw new RangeError("Row index ".concat(t," out of range: ").concat(e.scrollCache.y.length,"."));return e.scrollCache.y[t]},e.findColumnScrollLeft=function(t){var o=Math.max(t-1,0);if(void 0===e.scrollCache.x[o])throw new Error("Column index out of range.");return e.scrollCache.x[o]-e.getColumnWidth(e.orders.columns[t])},e.gotoCell=function(t,o,r,n){var l,i=void 0===t?void 0:e.findColumnScrollLeft(t),a=void 0===o?void 0:e.findRowScrollTop(o),s=e.scrollBox.width-(e.scrollBox.verticalBarVisible?e.style.scrollBarWidth:0),c=e.scrollBox.height-(e.scrollBox.horizontalBarVisible?e.style.scrollBarWidth:0);i-=s*(r=void 0===r?0:r),a-=c*(n=void 0===n?0:n),void 0!==t&&void 0!==o?(e.scrollBox.scrollTo(i,a),requestAnimationFrame((function(){(l=e.getVisibleCellByIndex(t,o))&&(i+=l.width*r,a+=l.height*n,e.scrollBox.scrollTo(i,a))}))):void 0!==t?e.scrollBox.scrollLeft=i:void 0!==o&&(e.scrollBox.scrollTop=a)},e.gotoRow=function(t){e.gotoCell(0,t)},e.addButton=function(t,o,r,n,l){var i=e.visibleCells.filter((function(e){return e.sortColumnIndex===t&&e.sortRowIndex===o}));e.attachButton({top:i[0].y+i[0].height+r.y,left:i[0].x+i[0].width+r.x},n,l)},e.toggleCellCollapseTree=function(t){for(var o in t){var r,n=_createForOfIteratorHelper(t[o]);try{for(n.s();!(r=n.n()).done;){var l=r.value;l.length>0&&e.toggleCollapseTree(l[0],l[1],o)}}catch(e){n.e(e)}finally{n.f()}}e.draw()},e.expandCollapseCellTree=function(t){for(var o in t){var r,n=_createForOfIteratorHelper(t[o]);try{for(n.s();!(r=n.n()).done;){var l=r.value;l.length>0&&e.cellTreeExpandCollapse(l[0],l[1],o)}}catch(e){n.e(e)}finally{n.f()}}e.draw()},e.scrollIntoView=function(t,o,r,n){var l=e.visibleCells.filter((function(r){return(r.rowIndex===o||void 0===o)&&(r.columnIndex===t||void 0===t)&&r.x>0&&r.y>0&&r.x+r.width<e.width&&r.y+r.height<e.height}));1===l.length&&void 0!==t&&void 0!==o&&(l[0].x<e.getRowHeaderCellWidth()||l[0].y<e.getColumnHeaderCellHeight())&&(l.length=0),0===l.length&&e.gotoCell(t,o,r,n)},e.setActiveCell=function(t,o){void 0!==t&&(t<0&&(t=0),o<0&&(o=0),e.activeCell={rowIndex:o,columnIndex:t})},e.collapseTree=function(t){e.dispatchEvent("collapsetree",{childGrid:e.childGrids[t],data:e.viewData[t],rowIndex:t}),e.openChildren[t].blur(),e.openChildren[t].dispose(),delete e.openChildren[t],delete e.sizes.trees[t],delete e.childGrids[t],e.dispatchEvent("resizerow",{cellHeight:e.style.cellHeight}),e.resize(!0),e.draw(!0)},e.expandTree=function(t){var o,r=e.args.treeGridAttributes||{},n=e.getColumnHeaderCellHeight(),l=e.sizes.columns.cornerCell||e.style.rowHeaderCellWidth,i=e.sizes.trees[t]||e.style.treeGridHeight;e.childGrids[t]||(r.debug=e.attributes.debug,r.name=e.attributes.saveAppearance?e.attributes.name+"tree"+t:void 0,r.style=r.style||e.style,r.parentNode={parentGrid:e.intf,nodeType:"canvas-datagrid-tree",offsetHeight:i,offsetWidth:e.width-l,header:{width:e.width-l},offsetLeft:l,offsetTop:n,offsetParent:e.intf.parentNode,parentNode:e.intf.parentNode,style:"tree",data:e.viewData[t]},o=e.createGrid(r),e.childGrids[t]=o),(o=e.childGrids[t]).visible=!0,e.dispatchEvent("expandtree",{treeGrid:o,data:e.viewData[t],rowIndex:t}),e.openChildren[t]=o,e.sizes.trees[t]=i,e.dispatchEvent("resizerow",{height:e.style.cellHeight}),e.resize(!0)},e.toggleTree=function(t){if(e.openChildren[t])return e.collapseTree(t);e.expandTree(t)},e.getHeaderByName=function(t){var o,r=e.getSchema();for(o=0;o<r.length;o+=1)if(r[o].name===t)return r[o]},e.hideColumns=function(t,o){var r=e.getSchema(),n=e.orders.columns,l=[];"number"!=typeof o&&(o=t);for(var i=t;i<=o;i++){var a=n[i];a>=0&&!r[a].hidden&&(l.push(a),r[a].hidden=!0,e.dispatchEvent("columnhide",{columnIndex:a}))}l.length>0&&(e.setStorageData(),setTimeout((function(){e.resize(!0)}),10)),e.dispatchEvent("hidecolumns",{hiddenColumns:l})},e.unhideColumns=function(t,o){for(var r=e.orders.columns,n=e.getSchema(),l=t;l<=o;l++){var i=r[l],a=n[i];a&&a.hidden&&(a.hidden=!1,e.dispatchEvent("columnunhide",{columnIndex:i}))}e.refresh()},e.hideRows=function(t,o){mergeHiddenRowRanges(e.hiddenRowRanges,[t,o])&&e.refresh()},e.unhideRows=function(t,o){var r=this;e.hiddenRowRanges=e.hiddenRowRanges.filter(function(e){return _newArrowCheck(this,r),e[0]!==t||e[1]!==o}.bind(this)),e.refresh()},e.fitColumnToValues=function(t,o){if(e.canvas){var r="cornerCell"===t?-1:e.getHeaderByName(t).index,n=Math.max(e.findColumnMaxTextLength(t),e.style.minColumnWidth);e.sizes.columns[r]=n,e.dispatchEvent("resizecolumn",{x:n,y:e.resizingStartingHeight,draggingItem:e.currentCell}),o||(e.resize(),e.draw(!0))}},e.isCellVisible=function(t,o){if(void 0!==o)return e.visibleCells.filter((function(e){return e.columnIndex===t&&e.rowIndex===o})).length>0;var r,n=e.visibleCells.length;for(r=0;r<n;r+=1)if(t.x===e.visibleCells[r].x&&t.y===e.visibleCells[r].y)return!0;return!1},e.order=function(t,o,r,n){if(e.attributes.allowSorting){var l,i=e.getSchema().filter((function(e){return e.name===t}));if(!e.dispatchEvent("beforesortcolumn",{name:t,direction:o})&&(e.orderBy=t,e.orderDirection=o,e.viewData&&0!==e.viewData.length)){if(0===i.length)throw new Error("Cannot sort. No such column name");(l=r||i[0].sorter||e.sorters[i[0].type])||void 0===i[0].type||console.warn('Cannot sort type "%s" falling back to string sort.',i[0].type),e.orderings.add(t,o,"function"==typeof l?l:e.sorters.string),e.refresh(),e.dispatchEvent("sortcolumn",{name:t,direction:o}),n||e.setStorageData()}}else e.refresh()},e.groupColumns=function(o,r){for(var n,l,i=e.getSchema(),a=0;a<i.length;a++){var s=i[a];if(n&&l)break;s.name!==o?s.name!==r||(l=s):n=s}if(!n)throw new Error("No such column name for first column");if(!l)throw new Error("No such column name for last column");if(l.columnIndex>n.columnIndex!=!0)throw new Error("Can't group these columns");var c=n.columnIndex,d=l.columnIndex,u={group:{type:"columns",from:c,to:d}};try{t("columns",c,d)}catch(e){u.error=e}e.dispatchEvent("aftercreategroup",u)},e.groupRows=function(o,r){if(!Number.isInteger(o)||o<0)throw new Error("No such row for the beginning of the group");var n=e.viewData.length;if(!Number.isInteger(o)||r<=o||r>=n)throw new Error("No such row for the end of the group");var l={group:{type:"rows",from:o,to:r}};try{t("rows",o,r)}catch(e){l.error=e}e.dispatchEvent("aftercreategroup",l)},e.removeGroupColumns=function(t,r){for(var n,l,i=e.getSchema(),a=0;a<i.length;a++){var s=i[a];if(n&&l)break;s.name!==t?s.name!==r||(l=s):n=s}if(!n)throw new Error("No such column name for first column");if(!l)throw new Error("No such column name for last column");var c=n.columnIndex,d=l.columnIndex;o(e.groupedColumns,c,d)},e.removeGroupRows=function(t,r){o(e.groupedRows,t,r)},e.toggleGroupColumns=function(t,o){for(var r,n,l=e.getSchema(),i=0;i<l.length;i++){var a=l[i];if(r&&n)break;a.name!==t?a.name!==o||(n=a):r=a}if(r&&n){var s=r.columnIndex,c=n.columnIndex;e.toggleGroup({type:"c",from:s,to:c})&&(e.disposeContextMenu(),e.setStorageData(),e.refresh())}},e.toggleGroupRows=function(t,o){e.toggleGroup({type:"r",from:t,to:o})&&(e.disposeContextMenu(),e.setStorageData(),e.refresh())},e.isInGrid=function(t){return!(t.x<0||t.x>e.width||t.y<0||t.y>e.height)},e.moveTo=function(t,o,r){t=e.getObsoleteSelectionMatrix(t);var n,l=e.getSelectedData(),i=e.getVisibleSchema(),a=t.length,s=-1/0,c=1/0,d=r-1;t.forEach((function(t,r){r!==a&&0!==t.length&&(c=Math.min(e.getVisibleColumnIndexOf(o),c),s=Math.max(s,t.length),t.forEach((function(t){t=e.getVisibleColumnIndexOf(t),i[t]&&(e.data||(e.data={}),e.data[r]||(e.data[r]={}),e.data[r][i[t].name]=null)})))})),t.forEach((function(t,r){var a;d+=1,n=e.getVisibleColumnIndexOf(o),t.forEach((function(t,o){t=e.getVisibleColumnIndexOf(t),o>0&&(n+=t-a),a=t,-1===t||!i[n]||!i[t]||e.data.length-1<d||d<0||(e.data[d]||(e.data[d]={}),e.data[d][i[n].name]=l[r][i[t].name])}))}))},e.getGroupsColumnBelongsTo=function(t){if(!e.attributes.allowGroupingColumns)return[];for(var o=[],r=0;r<e.groupedColumns.length;r++)for(var n=e.groupedColumns[r],l=0;l<n.length;l++){var i=n[l];if(t>=i.from&&t<=i.to){o.push(i);break}}return o},e.getGroupsRowBelongsTo=function(t){if(!e.attributes.allowGroupingRows)return[];for(var o=[],r=0;r<e.groupedRows.length;r++)for(var n=e.groupedRows[r],l=0;l<n.length;l++){var i=n[l];if(t>=i.from&&t<=i.to){o.push(i);break}}return o},e.isColumnVisible=function(t){return e.visibleCells.filter((function(e){return e.columnIndex===t})).length>0},e.isRowVisible=function(t){return e.visibleCells.filter((function(e){return e.rowIndex===t})).length>0},e.getVisibleCellByIndex=function(t,o){return e.visibleCells.filter((function(e){return e.columnIndex===t&&e.rowIndex===o}))[0]},e.getUnhideIndicator=function(t,o){var r=e.visibleUnhideIndicators;if(!(r.length<=0))for(var n=0;n<r.length;n++){var l=r[n];if(t>=l.x&&o>=l.y&&t<=l.x2&&o<=l.y2)return l}},e.getColumnGroupAt=function(t,o){if(!(e.groupedColumns.length<=0)&&!(o>=e.getColumnGroupAreaHeight()))for(var r=0;r<e.visibleGroups.length;r++){var n=e.visibleGroups[r];if("c"===n.type&&(t>=n.x&&o>=n.y&&t<=n.x2&&o<=n.y2))return n}},e.getRowGroupAt=function(t,o){if(!(e.groupedRows.length<=0)&&!(t>=e.getRowGroupAreaWidth()))for(var r=0;r<e.visibleGroups.length;r++){var n=e.visibleGroups[r];if("r"===n.type&&(t>=n.x&&o>=n.y&&t<=n.x2&&o<=n.y2))return n}},e.getCellAt=function(t,o,r){function n(r){return r.x+r.width-.4*e.attributes.borderResizeZone<t&&r.x+r.width+.6*e.attributes.borderResizeZone>t?"r":r.x-.4*e.attributes.borderResizeZone<t&&r.x+.6*e.attributes.borderResizeZone>t?"l":r.y+r.height-.4*e.attributes.borderResizeZone<o&&r.y+r.height+.6*e.attributes.borderResizeZone>o?"b":r.y-.4*e.attributes.borderResizeZone<o&&r.y+.6*e.attributes.borderResizeZone>o?"t":void 0}if(e.visibleCells){t-=e.getRowGroupAreaWidth(),o-=e.getColumnGroupAreaHeight(),void 0!==e.dragStartObject&&(t<=0&&(t=1),t>=e.width&&(t=e.width-1),o<=0&&(o=1),o>=e.height&&(o=e.height-1));var l,i,a,s,c,d=r?e.attributes.touchScrollZone:0,u="move"===e.attributes.borderDragBehavior,h=e.visibleCells.length,f=u?e.cursorGrab:"ew-resize",g=u?e.cursorGrab:"ns-resize";if(e.visibleCells&&e.visibleCells.length){if(e.hasFocus=!0,!(o<e.height&&o>0&&t<e.width&&t>0))return e.hasFocus=!1,{dragContext:"inherit",context:"inherit"};for(i=0;i<h;i+=1)if(c={x:(s=e.visibleCells[i]).x,y:s.y,height:s.height,width:s.width},r&&/(vertical|horizontal)-scroll-/.test(s.style)&&(c.x-=d,c.y-=d,c.height+=d,c.width+=d),c.x-e.style.cellBorderWidth<t&&c.x+c.width+e.style.cellBorderWidth>t&&c.y-e.style.cellBorderWidth<o&&c.y+c.height+e.style.cellBorderWidth>o){if(/frozen-row-marker/.test(s.style)){if("frozen-column-marker"===e.dragMode)continue;return s.dragContext=s.style,s.context="grab",s}if(/frozen-column-marker/.test(s.style)){if("frozen-row-marker"===e.dragMode)continue;return s.dragContext=s.style,s.context="grab",s}if(/selection-handle-/.test(s.style))return s.dragContext=s.style,s.context="crosshair",s;if(/vertical-scroll-(bar|box)/.test(s.style))return s.dragContext="vertical-scroll-box",s.context="vertical-scroll-box",s.isScrollBar=!0,s.isVerticalScrollBar=!0,o>e.scrollBox.box.v.y+e.scrollBox.scrollBoxHeight?(s.dragContext="vertical-scroll-bottom",s.context="vertical-scroll-bottom"):o<e.scrollBox.box.v.y&&(s.dragContext="vertical-scroll-top",s.context="vertical-scroll-top"),e.cursor="default",s;if(/horizontal-scroll-(bar|box)/.test(s.style))return s.dragContext="horizontal-scroll-box",s.context="horizontal-scroll-box",s.isScrollBar=!0,s.isHorizontalScrollBar=!0,t>e.scrollBox.box.h.x+e.scrollBox.scrollBoxWidth?(s.dragContext="horizontal-scroll-right",s.context="horizontal-scroll-right"):t<e.scrollBox.box.h.x&&(s.dragContext="horizontal-scroll-left",s.context="horizontal-scroll-left"),e.cursor="default",s;if(l=n(c),a=u&&s.selectionBorder&&-1!==s.selectionBorder.indexOf(l),-1!==["l","r"].indexOf(l)&&(e.attributes.allowColumnResize||a)&&(e.attributes.allowColumnResizeFromCell&&s.isNormal||!s.isNormal||a)&&(e.attributes.allowRowHeaderResize&&(s.isRowHeader||s.isCorner)||!s.isRowHeader||!s.isCorner)){if((s.isColumnHeader||s.isCorner||e.attributes.allowColumnResizeFromCell&&s.isNormal)&&"r"===l)return s.context="ew-resize",s.dragContext="ew-resize",s;if(!s.isColumnHeader&&!s.isCorner&&a)return s.context=f,s.dragContext=l+"-move",s}if(-1!==["t","b"].indexOf(l)&&s.rowIndex>-1&&(e.attributes.allowRowResize||a)&&(e.attributes.allowRowResizeFromCell&&s.isNormal||!s.isNormal||a)&&!s.isColumnHeader){if((s.isRowHeader||s.isCorner||e.attributes.allowRowResizeFromCell&&s.isNormal)&&"b"===l)return s.context="ns-resize",s.dragContext="ns-resize",s;if(!s.isRowHeader&&!s.isCorner&&a)return s.context=g,s.dragContext=l+"-move",s}return"columnHeaderCell"===s.style?(!e.isColumnSelected(s.columnIndex)&&s.x+s.width-e.attributes.columnGrabZoneSize-e.style.cellBorderWidth>t||!e.attributes.allowRowReordering?(s.dragContext="cell",s.context="cell"):(s.context=e.cursorGrab,s.dragContext="column-reorder"),s):"rowHeaderCell"===s.style?(!e.isRowSelected(s.rowIndex)&&e.attributes.rowGrabZoneSize+(s.y-e.style.cellBorderWidth)<o||!e.attributes.allowRowReordering?(s.dragContext="cell",s.context="cell"):(s.context=e.cursorGrab,s.dragContext="row-reorder"),s):s.isGrid?(e.hasFocus=!1,s.dragContext="cell-grid",s.context="cell-grid",s):"tree-grid"===s.style?(e.hasFocus=!1,s.dragContext="tree",s.context="tree",s):(s.dragContext="cell",s.context="cell",s)}return e.hasFocus=!0,e.cursor="default",{dragContext:"background",context:"background",style:"background",isBackground:!0}}}},e.getSchemaFromData=function(t){return t=t||e.originalData,Object.keys(t[0]||{" ":""}).map((function(o,r){var n=e.getBestGuessDataType(o,t),l={name:o,title:isNaN(parseInt(o,10))?o:e.integerToAlpha(o).toUpperCase(),index:r,columnIndex:r,type:n,filter:e.filter(n)};return e.storedSettings&&e.storedSettings.visibility&&void 0!==e.storedSettings.visibility[l.name]&&(l.hidden=!e.storedSettings.visibility[l.name]),l}))},e.clearChangeLog=function(){e.changes=[]},e.findColumnMaxTextLength=function(t){var o=-1/0;if("cornerCell"===t)return e.ctx.font=e.style.rowHeaderCellFont,e.ctx.measureText((e.viewData.length+(e.attributes.showNewRow?1:0)).toString()).width+e.style.autosizePadding+e.style.autosizeHeaderCellPadding+e.style.rowHeaderCellPaddingRight+e.style.rowHeaderCellPaddingLeft+(e.attributes.tree?e.style.treeArrowWidth+e.style.treeArrowMarginLeft+e.style.treeArrowMarginRight:0);var r=null;return e.getSchema().forEach((function(n){if(n.name===t){e.ctx.font=e.style.columnHeaderCellFont;var l=e.ctx.measureText(n.title||n.name).width+e.style.columnHeaderCellPaddingRight+e.style.columnHeaderCellPaddingLeft+e.style.cellAutoResizePadding;o=l>o?l:o,r=e.formatters[n.type]}})),e.viewData.forEach((function(n){var l=n[t];r&&(l=r({cell:{value:l}})),e.ctx.font=e.style.cellFont;var i=e.ctx.measureText(l).width+e.style.cellPaddingRight+e.style.cellPaddingLeft+e.style.cellAutoResizePadding;o=i>o?i:o})),o},e.getHeaderWidth=function(){return e.getVisibleSchema().reduce((function(t,o){return t+parseInt(o.width||e.style.cellWidth,10)}),0)},e.getRowHeight=function(t){return(e.sizes.rows[t]||e.style.cellHeight)*e.scale},e.getColumnWidth=function(t){return(e.sizes.columns[t]||e.getSchema()[t].width||e.style.cellWidth)*e.scale},e.formatters.string=function(e){return void 0!==e.cell.value?e.cell.value:""},e.formatters.rowHeaderCell=e.formatters.string,e.formatters.headerCell=e.formatters.string,e.formatters.number=e.formatters.string,e.formatters.int=e.formatters.string,e.formatters.html=e.formatters.string,e.sorters.string=function(e,t){var o="asc"===t;return function(t,r){var n=t[e]||"",l=r[e]||"";return o?n.localeCompare?n.localeCompare(l):1:l.localeCompare?l.localeCompare(n):1}},e.sorters.number=function(e,t){var o="asc"===t;return function(t,r){return o?t[e]-r[e]:r[e]-t[e]}},e.sorters.date=function(e,t){var o="asc"===t;return function(t,r){return o?new Date(t[e]).getTime()-new Date(r[e]).getTime():new Date(r[e]).getTime()-new Date(t[e]).getTime()}}}var webComponent=component(),modules=[defaults,draw,events,touch,intf,selections,contextMenu,button,dom,publicMethods];function Grid(args){args=args||{};var self={};return self.isComponent=void 0===args.component,self.isChildGrid=args.parentNode&&/canvas-datagrid-(cell|tree)/.test(args.parentNode.nodeType),self.isChildGrid?self.intf={}:self.intf=self.isComponent?eval("Reflect.construct(HTMLElement, [], new.target)"):document.createElement("canvas"),self.args=args,self.intf.args=args,self.applyComponentStyle=webComponent.applyComponentStyle,self.hyphenateProperty=webComponent.hyphenateProperty,self.dehyphenateProperty=webComponent.dehyphenateProperty,self.createGrid=function(e){return e.component=!1,new Grid(e)},modules.forEach((function(e){e(self)})),self.isChildGrid?(self.shadowRoot=args.parentNode.shadowRoot,self.parentNode=args.parentNode):(self.shadowRoot=self.intf.attachShadow({mode:"open"}),self.parentNode=self.shadowRoot),self.init(),self.intf}function canvasDatagrid(e){e=e||{};var t,o=["style","formatters","sorters","filters","treeGridAttributes","cellGridAttributes","fillCellCallback","data","schema"];return window.customElements?(t=document.createElement("canvas-datagrid"),Object.keys(e).forEach((function(r){"data"!==r&&"parentNode"!==r&&(-1===o.indexOf(r)?t.attributes[r]=e[r]:o.forEach((function(o){void 0!==e[o]&&o===r&&(-1!==["formatters","sorters","filters"].indexOf(r)?"object"===_typeof(e[o])&&null!==e[o]&&Object.keys(e[o]).forEach((function(r){t[o][r]=e[o][r]})):t[o]=e[o])})))})),e.data&&(t.data=e.data),e.parentNode&&e.parentNode.appendChild(t),t):(e.component=!1,t=new Grid(e),e.parentNode&&e.parentNode.appendChild&&e.parentNode.appendChild(t),t)}window.HTMLElement&&(Grid.prototype=Object.create(window.HTMLElement.prototype)),window.customElements&&(Grid.observedAttributes=webComponent.getObservableAttributes(),Grid.prototype.disconnectedCallback=webComponent.disconnectedCallback,Grid.prototype.attributeChangedCallback=webComponent.attributeChangedCallback,Grid.prototype.connectedCallback=webComponent.connectedCallback,Grid.prototype.adoptedCallback=webComponent.adoptedCallback,window.customElements.define("canvas-datagrid",Grid)),window&&!window.canvasDatagrid&&window.require;export default canvasDatagrid;
|
|
2
2
|
//# sourceMappingURL=canvas-datagrid.module.js.map
|