canvas-datagrid 0.3.22 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,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})(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],["animationDurationShowContextMenu",50],["animationDurationHideContextMenu",50],["autoGenerateSchema",!1],["autoResizeColumns",!1],["autoResizeRows",!1],["autoScrollOnMousemove",!1],["autoScrollMargin",5],["blanksText","(Blanks)"],["borderDragBehavior","none"],["borderResizeZone",10],["clearSettingsOptionText","Clear saved settings"],["columnHeaderClickBehavior","sort"],["columnSelectorHiddenText","&nbsp;&nbsp;&nbsp;"],["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"],["hoverMode","cell"],["keepFocusOnMouseOut",!1],["maxAutoCompleteItems",200],["multiLine",!1],["name",""],["pageUpDownOverlap",1],["pasteText","Paste"],["persistantSelectionMode",!1],["removeFilterOptionText","Remove filter on %s"],["reorderDeadZone",3],["resizeScrollZone",20],["rowGrabZoneSize",5],["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"],["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]],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","&#x25BC;"],["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)"],["cellVerticalAlignment","center"],["cellWidth",250],["cellWidthWithChildGrid",250],["cellWhiteSpace","nowrap"],["cellLineHeight",1],["cellLineSpacing",3],["childContextMenuArrowColor","rgba(43, 48, 43, 1)"],["childContextMenuArrowHTML","&#x25BA;"],["childContextMenuMarginLeft",-11],["childContextMenuMarginTop",-6],["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","&#x25BC;"],["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","&#x25BC;"],["contextMenuArrowUpHTML","&#x25B2;"],["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(236, 243, 255, 1)"],["frozenMarkerHoverBorderColor","rgba(110, 168, 255, 1)"],["frozenMarkerActiveColor","rgba(236, 243, 255, 1)"],["frozenMarkerActiveBorderColor","rgba(110, 168, 255, 1)"],["frozenMarkerColor","rgba(222, 222, 222, 1)"],["frozenMarkerBorderColor","rgba(168, 168, 168, 1)"],["frozenMarkerBorderWidth",1],["frozenMarkerWidth",2],["gridBackgroundColor","rgba(240, 240, 240, 1)"],["gridBorderCollapse","collapse"],["gridBorderColor","rgba(202, 202, 202, 1)"],["gridBorderWidth",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],["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"],["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],["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=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])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}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,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 u(t,o,r,n){t+=e.canvasOffsetLeft,o+=e.canvasOffsetTop,e.ctx.fillRect(t,o,r,n)}function h(t,o,r,n){t+=e.canvasOffsetLeft,o+=e.canvasOffsetTop,e.ctx.strokeRect(t,o,r,n)}function f(t,o,r){o+=e.canvasOffsetLeft,r+=e.canvasOffsetTop,e.ctx.fillText(t,o,r)}function g(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 m(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);u(t-.5*r,o-.5*r,r,r)}function p(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);h(t-.5*r,o-.5*r,r,r)}function x(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()}e.htmlImageCache={},e.draw=function(o){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 y,v,w,b,C,B,S,M,I,T,E,H,k,z,P,A,R,O,L,F,D,W,N,j,G,V=e.viewData||[],_="collapse"===e.style.gridBorderCollapse,Z=[],K=[],U=[],q=[],Y=V.length,J=e.currentCell||{},X=e.getColumnHeaderCellHeight(),Q=e.getRowHeaderCellWidth(),$=e.style.cellHeight;r+=1,v=performance.now(),e.visibleRowHeights=[],V.length>e.orders.rows.length&&e.createRowOrders(),e.ctx.save(),e.visibleRows=[],z=e.getSchema(),e.visibleCells=[],e.canvasOffsetTop=e.isChildGrid?e.parentNode.offsetTop:.5,e.canvasOffsetLeft=e.isChildGrid?e.parentNode.offsetLeft:-.5,H=e.height,d(0,0,k=e.width,H,0),e.ctx.clip(),e.ctx.fillStyle=e.style.gridBackgroundColor,u(0,0,k,H),function(){var t=Math.min(V.length,e.frozenRow);for(T=-e.scrollBox.scrollLeft+e.scrollPixelLeft+e.style.cellBorderWidth,I=X,P=0;P<t&&oe(e.orders.rows[P],P);P+=1);e.attributes.allowFreezingRows&&(I+=e.style.frozenMarkerBorderWidth+e.style.frozenMarkerWidth-.4999999999),e.lastFrozenRowPixel=I}(),function(){e.ctx.save(),e.frozenRow>0&&(d(0,e.lastFrozenRowPixel,e.width,e.height-e.lastFrozenRowPixel,0),e.ctx.clip());var t,o,r,n=z.length;for(T=-e.scrollBox.scrollLeft+e.scrollPixelLeft+e.style.cellBorderWidth,e.attributes.snapToRow||(I+=-e.scrollBox.scrollTop+e.scrollPixelTop+e.style.cellBorderWidth),P=e.frozenRow+e.scrollIndexTop;P<Y&&(o=e.orders.rows[P],e.scrollIndexBottom=P,e.scrollPixelBottom=I,oe(o,P));P+=1);if(e.attributes.showNewRow){for(e.attributes.showRowHeaders&&(T+=Q),S=$=e.style.cellHeight,B=!1,t=e.scrollIndexLeft;t<n&&(r=e.orders.columns[t],!((T+=te(e.newRow,V.length,V.length)(z[r],r,t))>e.width+e.scrollBox.scrollLeft));t+=1);q.push([e.newRow,V.length,V.length,I,S])}e.ctx.restore()}(),function(){if(R){e.ctx.save();var t=e.activeCell.columnIndex+1>e.frozenColumn||e.activeCell.rowIndex+1>e.frozenRow;d(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===R.rowIndex&&(e.ctx.lineWidth=e.style.activeCellOverlayBorderWidth,e.ctx.strokeStyle=e.style.activeCellOverlayBorderColor,h(1,R.y,e.getHeaderWidth()+Q,e.visibleRowHeights[R.rowIndex])):(e.ctx.lineWidth=e.style.activeCellOverlayBorderWidth,e.ctx.strokeStyle=e.style.activeCellOverlayBorderColor,h(R.x,R.y,R.width,R.height)),e.ctx.restore()}}(),function(){var t,o,r,n,l,i,a=z.length;function s(i,s){for(s=Math.min(s,a),r=i;r<s&&(o=e.orders.columns[r],(l=z[o]).hidden||(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},!((T+=te(n,-1,-1)(t,o,r))>e.width+e.scrollBox.scrollLeft)));r+=1);}q.forEach((function(t,o){I=t[3],$=t[4],o===e.frozenRow&&(e.ctx.save(),d(0,e.lastFrozenRowPixel,e.width,e.height-e.lastFrozenRowPixel,0),e.ctx.clip()),function(t,o,r){if(e.attributes.showRowHeaders){T=0;var n=e.viewData&&o<e.viewData.length?e.getBoundRowIndexFromViewRowIndex(o)+1:e.originalData?e.originalData.length+1:r+1,l=e.hasActiveFilters()?n:o+1,i={rowHeaderCell:l},a={name:"rowHeaderCell",width:e.sizes.columns[-1]||e.style.rowHeaderCellWidth,style:"rowHeaderCell",type:"string",data:l,index:-1};B=e.openChildren[o],te(i,r,o)(a,-1,-1)}}(t[0],t[1],t[2])})),e.ctx.restore(),e.attributes.showColumnHeaders&&(T=-e.scrollBox.scrollLeft+e.scrollPixelLeft+e.style.columnHeaderCellBorderWidth,e.attributes.showRowHeaders&&(T+=Q),I=0,$=e.getColumnHeaderCellHeight(),s(e.scrollIndexLeft,a),i=T,T=e.style.columnHeaderCellBorderWidth,e.attributes.showRowHeaders&&(T+=Q),s(0,e.frozenColumn),(T=i)<k&&(E={name:"",width:e.style.scrollBarWidth,style:"columnHeaderCellCap",isColumnHeaderCell:!0,isColumnHeaderCellCap:!0,type:"string",index:z.length},te({endCap:""},-1,-1)(E,-1,-1)),e.attributes.showRowHeaders&&(M={cornerCell:""},T=0,E={name:"cornerCell",width:e.style.rowHeaderCellWidth,style:"cornerCell",type:"string",index:-1},te(M,-1,-1)(E,-1,-1)))}(),O=e.lastFrozenRowPixel-e.style.frozenMarkerWidth,L=e.lastFrozenColumnPixel-e.style.frozenMarkerBorderWidth,F=e.currentCell&&"frozen-row-marker"===e.currentCell.style,D=e.currentCell&&"frozen-column-marker"===e.currentCell.style,e.ctx.lineWidth=e.style.frozenMarkerBorderWidth,e.attributes.allowFreezingColumns&&(e.ctx.fillStyle=D?e.style.frozenMarkerHoverColor:e.style.frozenMarkerColor,e.ctx.strokeStyle=D?e.style.frozenMarkerHoverBorderColor:e.style.frozenMarkerBorderColor,u(L,0,e.style.frozenMarkerWidth,e.height),h(L,0,e.style.frozenMarkerWidth,e.height),e.visibleCells.unshift({x:L,y:0,height:e.height,width:e.style.frozenMarkerWidth+e.style.frozenMarkerBorderWidth,style:"frozen-column-marker"})),e.attributes.allowFreezingRows&&(e.ctx.fillStyle=F?e.style.frozenMarkerHoverColor:e.style.frozenMarkerColor,e.ctx.strokeStyle=F?e.style.frozenMarkerHoverBorderColor:e.style.frozenMarkerBorderColor,u(0,O,e.width,e.style.frozenMarkerWidth),h(0,O,e.width,e.style.frozenMarkerWidth),e.visibleCells.unshift({x:0,y:O,height:e.style.frozenMarkerWidth+e.style.frozenMarkerBorderWidth,width:e.width,style:"frozen-row-marker"})),e.freezeMarkerPosition&&(e.ctx.fillStyle=e.style.frozenMarkerActiveColor,e.ctx.strokeStyle=e.style.frozenMarkerActiveBorderColor,"frozen-column-marker"===e.dragMode?(u(e.freezeMarkerPosition.x,0,e.style.frozenMarkerWidth,e.height),h(e.freezeMarkerPosition.x,0,e.style.frozenMarkerWidth,e.height)):(u(0,e.freezeMarkerPosition.y,e.width,e.style.frozenMarkerWidth),h(0,e.freezeMarkerPosition.y,e.width,e.style.frozenMarkerWidth))),(e.mobile||e.attributes.allowMovingSelection)&&(e.ctx.lineWidth=e.style.selectionHandleBorderWidth,e.ctx.strokeStyle=e.style.selectionHandleBorderColor,e.ctx.fillStyle=e.style.selectionHandleColor,U.forEach((function(t){!function(t,o){var r=e.style.selectionHandleSize;({tr:function(){m(t.x+t.width,t.y,r),p(t.x+t.width,t.y,r)},br:function(){m(t.x+t.width,t.y+t.height,r),p(t.x+t.width,t.y+t.height,r)},tl:function(){m(t.x,t.y,r),p(t.x,t.y,r)},bl:function(){m(t.x,t.y+t.height,r),p(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:k,height:H,x:0,y:0};if(e.ctx.fillStyle=e.style.reorderMarkerBackgroundColor,e.ctx.lineWidth=e.style.reorderMarkerBorderWidth,e.ctx.strokeStyle=e.style.reorderMarkerBorderColor,"row-reorder"===e.dragMode){for(var r=0;r<e.selections.length;r++)e.selections[r]&&r!=e.reorderObject.rowIndex&&(t.height+=e.getRowHeight(r));t.width=k,t.x=0,o.width=k,o.height=e.currentCell.height,o.y=e.currentCell.y,u(t.x,t.y,t.width,t.height),h(t.x,t.y,t.width,t.height),e.ctx.lineWidth=e.style.reorderMarkerIndexBorderWidth,e.ctx.strokeStyle=e.style.reorderMarkerIndexBorderColor,e.currentCell.rowIndex!==e.reorderObject.rowIndex&&e.currentCell.rowIndex>-1&&e.currentCell.rowIndex<Y&&x(o,e.reorderTarget.sortRowIndex>e.reorderObject.sortRowIndex?"b":"t")}else if("column-reorder"===e.dragMode&&e.reorderObject){var n=e.selections[0];for(r=1;r<n.length;r++)t.width+=e.getColumnWidth(e.orders.columns[n[r]]);t.height=H,t.y=0,o.height=H,o.width=e.currentCell.width,o.y=0,o.x=e.currentCell.x,u(t.x,t.y,t.width,t.height),h(t.x,t.y,t.width,t.height),e.ctx.lineWidth=e.style.reorderMarkerIndexBorderWidth,e.ctx.strokeStyle=e.style.reorderMarkerIndexBorderColor,e.currentCell.sortColumnIndex!==e.reorderObject.sortColumnIndex&&e.currentCell.sortColumnIndex>-1&&e.currentCell.sortColumnIndex<z.length&&x(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),K.forEach((function(e){x(e[0],e[1])})),e.ctx.setLineDash([])),e.ctx.lineWidth=e.style.gridBorderWidth,e.ctx.strokeStyle=e.style.gridBorderColor,h(0,0,e.width,e.height),function(){function t(e){x(e[0],e[1])}e.ctx.lineWidth=e.style.selectionOverlayBorderWidth,e.ctx.strokeStyle=e.style.selectionOverlayBorderColor,Z.filter((function(t){return t[0].rowIndex<e.frozenRow&&t[0].columnIndex<e.frozenColumn})).forEach(t),e.ctx.save(),g(0),Z.filter((function(t){return t[0].rowIndex>=e.frozenRow&&t[0].columnIndex>=e.frozenColumn})).forEach(t),e.ctx.restore(),e.ctx.save(),g(1),Z.filter((function(t){return t[0].rowIndex>=e.frozenRow&&t[0].columnIndex<e.frozenColumn})).forEach(t),e.ctx.restore(),e.ctx.save(),g(2),Z.filter((function(t){return t[0].rowIndex<e.frozenRow&&t[0].columnIndex>=e.frozenColumn})).forEach(t),e.ctx.restore()}(),N=e.scrollBox.entities,j=2*e.style.scrollBarBoxMargin,e.ctx.strokeStyle=e.style.scrollBarBorderColor,e.ctx.lineWidth=e.style.scrollBarBorderWidth,e.frozenColumn>0?N.horizontalBox.x=Q+e.style.scrollBarBoxMargin+e.scrollCache.x[e.frozenColumn-1]+(N.horizontalBar.width-e.scrollCache.x[e.frozenColumn-1]-e.scrollBox.scrollBoxWidth)*(e.scrollBox.scrollLeft/e.scrollBox.scrollWidth):N.horizontalBox.x=Q+e.style.scrollBarBoxMargin+(N.horizontalBar.width-e.scrollBox.scrollBoxWidth)*(e.scrollBox.scrollLeft/e.scrollBox.scrollWidth),N.verticalBox.y=X+e.style.scrollBarBoxMargin+e.scrollCache.y[e.frozenRow]+(N.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,u(N.horizontalBar.x,N.horizontalBar.y,N.horizontalBar.width+j,N.horizontalBar.height),h(N.horizontalBar.x,N.horizontalBar.y,N.horizontalBar.width+j,N.horizontalBar.height),e.ctx.fillStyle=e.style.scrollBarBoxColor,e.scrollBox.horizontalBoxVisible&&(/horizontal/.test(J.context)&&(e.ctx.fillStyle=e.style.scrollBarActiveColor),d(N.horizontalBox.x,N.horizontalBox.y,N.horizontalBox.width,N.horizontalBox.height,e.style.scrollBarBoxBorderRadius),e.ctx.stroke(),e.ctx.fill()),W=!0,e.visibleCells.unshift(N.horizontalBar),e.visibleCells.unshift(N.horizontalBox)),e.scrollBox.verticalBarVisible&&(e.ctx.fillStyle=e.style.scrollBarBackgroundColor,u(N.verticalBar.x,N.verticalBar.y,N.verticalBar.width,N.verticalBar.height+j),h(N.verticalBar.x,N.verticalBar.y,N.verticalBar.width,N.verticalBar.height+j),e.scrollBox.verticalBoxVisible&&(e.ctx.fillStyle=e.style.scrollBarBoxColor,/vertical/.test(J.context)&&(e.ctx.fillStyle=e.style.scrollBarActiveColor),d(N.verticalBox.x,N.verticalBox.y,N.verticalBox.width,N.verticalBox.height,e.style.scrollBarBoxBorderRadius),e.ctx.stroke(),e.ctx.fill()),W=!0,e.visibleCells.unshift(N.verticalBar),e.visibleCells.unshift(N.verticalBox)),W&&(e.ctx.strokeStyle=e.style.scrollBarCornerBorderColor,e.ctx.fillStyle=e.style.scrollBarCornerBackgroundColor,d(N.corner.x,N.corner.y,N.corner.width,N.corner.height,0),e.ctx.stroke(),e.ctx.fill(),e.visibleCells.unshift(N.corner)),y&&e.resize(!0),e.ctx.save(),(e.attributes.showPerformance||e.attributes.debug)&&(0===t.length&&(t=s(0,n,1,0)),t.pop(),t.unshift(performance.now()-v)),e.attributes.debug?(e.ctx.font=e.style.debugFont,(G={}).perf=(t.reduce((function(e,t){return e+t}),0)/Math.min(r,t.length)).toFixed(1),G.perfDelta=t[0].toFixed(1),G.frozenColumnsWidth=function(){for(var t=0,o=e.getSchema(),r=0,n=Math.min(e.frozenColumn,o.length);r<n;)o[r].hidden||(t+=e.getColumnWidth(r)),r+=1;return t}(),G.htmlImages=Object.keys(e.htmlImageCache).length,G.reorderObject="x: "+(e.reorderObject||{columnIndex:0}).columnIndex+", y: "+(e.reorderObject||{rowIndex:0}).rowIndex,G.reorderTarget="x: "+(e.reorderTarget||{columnIndex:0}).columnIndex+", y: "+(e.reorderTarget||{rowIndex:0}).rowIndex,G.scale=e.scale,G.startScale=e.startScale,G.scaleDelta=e.scaleDelta,G.zoomDeltaStart=e.zoomDeltaStart,G.touchLength=e.touchLength,G.touches="y0: "+(e.touchPosition||{y:0}).y+" y1: "+(e.touchPosition1||{y:0}).y,G.scrollBox=e.scrollBox.toString(),G.scrollIndex="x: "+e.scrollIndexLeft+", y: "+e.scrollIndexTop,G.scrollPixel="x: "+e.scrollPixelLeft+", y: "+e.scrollPixelTop,G.canvasOffset="x: "+e.canvasOffsetLeft+", y: "+e.canvasOffsetTop,G.touchDelta="x: "+e.touchDelta.x+", y: "+e.touchDelta.y,G.touchAnimateTo="x: "+e.touchAnimateTo.x+", y: "+e.touchAnimateTo.y,G.scrollAnimation="x: "+e.scrollAnimation.x+", y: "+e.scrollAnimation.y,G.touchPPS="x: "+e.xPPS+", y: "+e.yPPS,G.touchPPST="x: "+e.xPPST+", y: "+e.yPPST,G.touchDuration=e.touchDuration,G.pointerLockPosition=e.pointerLockPosition?e.pointerLockPosition.x+", "+e.pointerLockPosition.y:"",G.size="w: "+e.width+", h: "+e.height,G.mouse="x: "+e.mouse.x+", y: "+e.mouse.y,G.touch=e.touchStart?"x: "+e.touchStart.x+", y: "+e.touchStart.y:"",G.entities=e.visibleCells.length,G.hasFocus=e.hasFocus,G.dragMode=e.dragMode,e.currentCell&&(G.columnIndex=e.currentCell.columnIndex,G.rowIndex=e.currentCell.rowIndex,G.sortColumnIndex=e.currentCell.sortColumnIndex,G.sortRowIndex=e.currentCell.sortRowIndex,G.context=e.currentCell.context,G.dragContext=e.currentCell.dragContext,G.style=e.currentCell.style,G.type=e.currentCell.type),e.ctx.textAlign="right",e.ctx.fillStyle=e.style.debugBackgroundColor,u(0,0,e.width,e.height),Object.keys(G).forEach((function(t,o){var r=t+": "+G[t];e.ctx.fillStyle=e.style.debugColor,f(r,k-20,(e.attributes.showPerformance?140:24)+14*o)})),e.ctx.restore()):e.ctx.restore(),function(){if(e.attributes.showPerformance){var o=e.width-250-e.style.scrollBarWidth-2*e.style.scrollBarBorderWidth,r=X;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,u(o,r,250,100),[["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),c.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 c(t,n,l,i,a,s,c){var d;!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()}(250,100,o,r,n,l,i,a,s),e.ctx.fillStyle=a,u(3+o,r+9+11*c,8,8),e.ctx.fillStyle=e.style.debugPerfChartTextColor,d=void 0!==l?n[0][l]:n[0],f(t+" "+(isNaN(d)?0:d).toFixed(3),14+o,r+16+11*c)}}(),e.dispatchEvent("afterdraw",{})||e.ctx.restore()}function ee(t,o,r,n){n=n||{x:0,y:0},t.selectionBorder="",!t.isRowHeader&&e.selections[t.rowIndex+-n.y]&&-1!==e.selections[t.rowIndex+-n.y].indexOf(t.columnIndex+-n.x)&&(e.selections[t.rowIndex-1-n.y]&&-1!==e.selections[t.rowIndex-1-n.y].indexOf(t.columnIndex+-n.x)&&0!==t.rowIndex||t.isHeader||(o.push([t,"t"]),t[r+"BorderTop"]=!0,t[r+"Border"]+="t"),e.selections[t.rowIndex+1+-n.y]&&-1!==e.selections[t.rowIndex+1+-n.y].indexOf(t.columnIndex+-n.x)||(o.push([t,"b"]),t[r+"BorderBottom"]=!0,t[r+"Border"]+="b"),e.selections[t.rowIndex+-n.y]&&0!==t.columnIndex&&-1!==e.selections[t.rowIndex+-n.y].indexOf(t.columnIndex-1-n.x)||(o.push([t,"l"]),t[r+"BorderLeft"]=!0,t[r+"Border"]+="l"),e.selections[t.rowIndex+-n.y]&&t.columnIndex!==z.length&&-1!==e.selections[t.rowIndex+-n.y].indexOf(t.columnIndex+1+-n.x)||(o.push([t,"r"]),t[r+"BorderRight"]=!0,t[r+"Border"]+="r"))}function te(t,o,r){return function(n,l,i){if(n.hidden)return 0;var a,s,g,m=n.style||"cell",p=/HeaderCell/.test(m),x=/cornerCell/.test(m),v="rowHeaderCell"===m,C="columnHeaderCell"===m,M=e.filterable.rows.includes(r)&&e.filterable.columns.includes(l),E="nowrap"!==e.style.cellWhiteSpace,H=e.selections[o]&&-1!==e.selections[o].indexOf(i),z=e.hovers.rowIndex===o&&("row"===e.attributes.hoverMode||e.hovers.columnIndex===i),P=e.selectedFilterButton.rowIndex==r&&e.selectedFilterButton.columnIndex==l,A=e.activeCell.rowIndex===o&&e.activeCell.columnIndex===i,O="columnHeaderCellCap"===m,L=t?t[n.name]:void 0,F="canvas-datagrid"===n.type,D=!(e.orders.rows[e.activeCell.rowIndex]!==o&&e.orders.columns[e.activeCell.columnIndex]!==l||-1!==i&&-1!==o)&&(v?"activeRowHeaderCell":"activeColumnHeaderCell"),W=e.formatters[n.type||"string"],N=0,j=0,G=e.sizes.columns[l]||n.width,V={value:L,row:t,header:n};if(O&&(G=k-T),void 0===G&&(G=e.style.cellWidth),G*=e.scale,T+G+e.style.cellBorderWidth<0&&(T+=G+e.style.cellBorderWidth),A&&"cornerCell"!==m&&(m="activeCell"),-1!==e.visibleRows.indexOf(r)||p||e.visibleRows.push(r),g=e.dispatchEvent("formatcellvalue",V),w=T,b=I,"cornerCell"===m?(w=0,b=0):v?w=0:p&&(b=0),(s={type:F?"canvas-datagrid-cell":n.type,style:m,nodeType:"canvas-datagrid-cell",x:w,y:b,fontHeight:(e.style[m+"FontHeight"]||0)*e.scale,horizontalAlignment:e.style[m+"HorizontalAlignment"],verticalAlignment:e.style[m+"VerticalAlignment"],paddingLeft:(e.style[m+"PaddingLeft"]||0)*e.scale,paddingTop:(e.style[m+"PaddingTop"]||0)*e.scale,paddingRight:(e.style[m+"PaddingRight"]||0)*e.scale,paddingBottom:(e.style[m+"PaddingBottom"]||0)*e.scale,whiteSpace:e.style.cellWhiteSpace,lineHeight:e.style.cellLineHeight,lineSpacing:e.style.cellLineSpacing,offsetTop:e.canvasOffsetTop+b,offsetLeft:e.canvasOffsetLeft+w,scrollTop:e.scrollBox.scrollTop,scrollLeft:e.scrollBox.scrollLeft,active:A||D,hovered:z,selected:H,width:G,height:$,offsetWidth:G,offsetHeight:$,parentNode:e.intf.parentNode,offsetParent:e.intf.parentNode,data:t,isCorner:x,isHeader:p,isColumnHeader:C,isColumnHeaderCellCap:O,isRowHeader:v,isFilterable:M,openedFilter:P,rowOpen:B,header:n,columnIndex:i,rowIndex:o,viewRowIndex:o,viewColumnIndex:i,boundRowIndex:e.getBoundRowIndexFromViewRowIndex(o),boundColumnIndex:e.getBoundColumnIndexFromViewColumnIndex(i),sortColumnIndex:l,sortRowIndex:r,isGrid:F,isNormal:!F&&!x&&!p,gridId:(e.attributes.name||"")+r+":"+l,parentGrid:e.intf,innerHTML:"",activeHeader:D,value:p&&!v?n.title||n.name:L}).calculatedLineHeight=s.fontHeight*s.lineHeight+s.lineSpacing,s.paddedWidth=s.width-s.paddingRight-s.paddingLeft,s.paddedHeight=s.height-s.paddingTop-s.paddingBottom,V.cell=s,s.userHeight=s.isHeader?e.sizes.rows[-1]:S,s.userWidth=s.isHeader?e.sizes.columns.cornerCell:e.sizes.columns[l],e.visibleCells.unshift(s),!e.dispatchEvent("beforerendercell",V)){if(e.ctx.fillStyle=e.style[m+"BackgroundColor"],e.ctx.strokeStyle=e.style[m+"BorderColor"],e.ctx.lineWidth=e.style[m+"BorderWidth"],z&&(e.ctx.fillStyle=e.style[m+"HoverBackgroundColor"],e.ctx.strokeStyle=e.style[m+"HoverBorderColor"]),H&&(e.ctx.fillStyle=e.style[m+"SelectedBackgroundColor"],e.ctx.strokeStyle=e.style[m+"SelectedBorderColor"]),D&&(e.ctx.fillStyle=e.style[D+"BackgroundColor"]),e.dispatchEvent("rendercell",V),s.isGrid&&(s.height!==S&&(s.height=S||e.style.cellHeightWithChildGrid,y=!0),s.width=e.sizes.columns[l]||e.style.cellWidthWithChildGrid),B&&!s.isRowHeader&&(s.height=e.sizes.rows[r]||e.style.cellHeight),s.isGrid||(u(w,b,s.width,s.height),h(w,b,s.width,s.height)),e.ctx.save(),d(s.x,s.y,s.width,s.height,0),e.ctx.clip(),e.dispatchEvent("afterrendercell",V),s.height===$||B&&!s.isRowHeader||(e.sizes.rows[p?-1:r]=s.height,y=!0),s.width!==G&&(e.sizes.columns[l]=s.width,y=!0),v&&e.attributes.tree&&(e.dispatchEvent("rendertreearrow",V)||(j=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}(s,e.style[m+"PaddingLeft"],b))),e.attributes.showRowNumbers&&v||!v)if(s.isGrid&&!e.dispatchEvent("beforerendercellgrid",V)){if(!e.childGrids[s.gridId]){if((a=e.cellGridAttributes).name=e.attributes.saveAppearance?s.gridId:void 0,a.component=!1,a.parentNode=s,a.data=L,V.cellGridAttributes=a,e.dispatchEvent("beforecreatecellgrid",V))return;e.childGrids[s.gridId]=e.createGrid(a),e.sizes.rows[r]=e.sizes.rows[r]||e.style.cellGridHeight,y=!0}s.grid=e.childGrids[s.gridId],s.grid.parentNode=s,s.grid.visible=!0,s.grid.draw(),e.dispatchEvent("rendercellgrid",V)}else s.isGrid||(e.childGrids[s.gridId]&&(e.childGrids[s.gridId].parentNode.offsetHeight=0),p&&e.orderBy===n.name&&(e.dispatchEvent("renderorderbyarrow",V)||(N=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}(w+e.style[m+"PaddingLeft"],0))),e.ctx.fillStyle=e.style[m+"Color"],z&&(e.ctx.fillStyle=e.style[m+"HoverColor"]),H&&(e.ctx.fillStyle=e.style[m+"SelectedColor"]),D&&(e.ctx.fillStyle=e.style[D+"Color"]),s.treeArrowWidth=j,s.orderByArrowWidth=N,void 0!==(g=void 0!==g?g:W?W(V):"")||W||(g="",console.warn("canvas-datagrid: Unknown format "+n.type+" add a cellFormater")),s.formattedValue=(null!=g?g:"").toString(),e.columnFilters&&void 0!==e.columnFilters[g]&&p&&(s.formattedValue=e.attributes.filterTextPrefix+g),e.ctx.font=e.style[m+"FontHeight"]*e.scale+"px "+e.style[m+"FontName"],e.dispatchEvent("formattext",V)||(s.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:""},x=f?t.paddedHeight:t.calculatedLineHeight;for(h.push(p),i=e.ctx.measureText(" "+m).width,n=0;n<d.length;n+=1){var y="-"===(l=d[n])[l.length-1]?"":o,v=e.ctx.measureText(l+y);if(p.width+v.width+i<t.paddedWidth)p.value+=l+y,p.width+=v.width;else if(/\w-\w/.test(l)&&t.paddedWidth<v.width){var w=l.split("-");w=w.map(function(e,t){return _newArrowCheck(this,r),t===w.length-1?e:e+"-"}.bind(this)),d.splice.apply(d,[n,1].concat(_toConsumableArray(w))),n-=1}else{if(p={width:v.width,value:l+y},0===n&&(h=[]).push(p),(u+=t.calculatedLineHeight)>x&&!g){if(0===h.length)break;if((c=h[h.length-1]).width<t.paddedWidth&&1===d.length)break;var b=s=c.value+l;if((a=e.ctx.measureText(s+m).width)>t.paddedWidth)for(var C=parseInt(s.length/2),B=-1;C>0;)s=b.substr(0,C*B+s.length),B=(a=e.ctx.measureText(s+m).width)>t.paddedWidth?-1:1,C=parseInt(C/2);s+=b.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}}(s," ")),e.dispatchEvent("rendertext",V)||(s.innerHTML||"html"===n.type?c(s):function(t){t.text.lines.length;var o,r,n=t.fontHeight*t.lineHeight,l="nowrap"!==e.style.cellWhiteSpace,i=0;for(o=0;o<t.text.lines.length;o+=1){r=t.text.lines[o];var a=Math.max(.5*(t.height-(l?t.text.height:t.calculatedLineHeight)),0)+n,s=t.paddingLeft+t.treeArrowWidth+t.orderByArrowWidth;"right"===t.horizontalAlignment?s=t.paddingLeft+t.paddedWidth-r.width:"center"===t.horizontalAlignment&&(s=t.paddingLeft+(t.paddedWidth+t.paddingRight)/2-r.width/2),"top"===t.verticalAlignment?a=t.calculatedLineHeight:"bottom"===t.verticalAlignment&&(a=t.height-t.paddingBottom-t.text.height),r.height=n+t.lineSpacing,r.offsetLeft=s,r.offsetTop=a,r.x=t.x+s,r.y=t.y+i+a,i+=r.height,f(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,f(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),f(JSON.stringify(t.text.lines.map((function(e){return{w:e.width,v:e.value.length}})),null,"\t"),t.x+14,t.y+30)}))}(s),E&&s.text&&s.text.height>S&&(e.sizes.rows[p?-1:r]=s.text.height,y=!0)));A&&(R=s),ee(s,Z,"selection"),function(t){(e.attributes.allowMovingSelection||e.mobile)&&(t.selectionBorderTop&&t.selectionBorderRight&&e.mobile&&(U.push([t,"tr"]),t.selectionHandle="tr"),t.selectionBorderTop&&t.selectionBorderLeft&&e.mobile&&(U.push([t,"tl"]),t.selectionHandle="tl"),t.selectionBorderBottom&&t.selectionBorderLeft&&e.mobile&&(U.push([t,"bl"]),t.selectionHandle="bl"),t.selectionBorderBottom&&t.selectionBorderRight&&("none"!==e.attributes.selectionHandleBehavior||e.mobile)&&(U.push([t,"br"]),t.selectionHandle="br"))}(s),e.movingSelection&&ee(s,K,"move",e.moveOffset),e.ctx.restore(),M&&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);d(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()}(s);var q=e.orderings.columns&&e.orderings.columns.length>0;if(v&&e.attributes.showRowNumbers&&e.attributes.showRowNumberGaps&&!1===q){var Y=e.getBoundRowIndexFromViewRowIndex(o-1);if(void 0!==Y&&s.boundRowIndex>0&&s.boundRowIndex-Y>1){var J=e.style.rowHeaderCellRowNumberGapHeight,X=e.style.rowHeaderCellRowNumberGapColor;e.ctx.save(),e.ctx.fillStyle=X,u(s.x,s.y-J/2,s.width,J),e.ctx.restore()}}return T+=s.width+(_?0:e.style.cellBorderWidth),s.width}}}function oe(t,o){var r,n,l,i,a=z.length;if(I-2*$>H)return!1;if(A=V[t],B=e.openChildren[t],l=(e.sizes.rows[t]||e.style.cellHeight)*e.scale,n=(B?e.sizes.trees[t]:0)*e.scale,I<-(S=l+n))return!1;for(e.attributes.showRowHeaders&&(T+=Q),$=S,i=e.scrollIndexLeft;i<a;i+=1)if(r=e.orders.columns[i],(T+=te(A,t,o)(z[r],r,i))>e.width){e.scrollIndexRight=i,e.scrollPixelRight=T;break}for(T=0,e.attributes.showRowHeaders&&(T+=Q),i=0;i<e.frozenColumn&&(r=e.orders.columns[i],!((T+=te(A,t,o)(z[r],r,i))>e.width));i+=1);return e.lastFrozenColumnPixel=T,$=S,T=-e.scrollBox.scrollLeft+e.scrollPixelLeft+e.style.cellBorderWidth,C=e.childGrids[t],t!==V.length&&B?(C.visible=!0,C.parentNode={offsetTop:I+l+e.canvasOffsetTop,offsetLeft:Q-1+e.canvasOffsetLeft,offsetHeight:n,offsetWidth:e.width-Q-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},e.visibleCells.unshift({rowIndex:t,columnIndex:0,y:C.parentNode.offsetTop,x:C.parentNode.offsetLeft,height:C.height,width:C.width,style:"tree-grid",type:C.parentNode.nodeType}),C.draw()):C&&(C.parentNode.offsetHeight=0,delete e.sizes.trees[t]),q.push([A,t,o,I,S]),e.visibleRowHeights[t]=S,I+=$+(_?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),_this6=void 0,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 _newArrowCheck(this,_this6),"number"==typeof e?e:e.replace(/</g,"&lt;").replace(/>/g,"&gt;")}.bind(void 0),createTextString=function(e,t){var o=this;return _newArrowCheck(this,_this6),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("")}.bind(void 0),createHTMLString=function(e,t){var o=this;if(_newArrowCheck(this,_this6),!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>"}.bind(this)).join("")+"</tr>"}.bind(this)).join(""),r+="</table>"}.bind(void 0);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.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,x=0,y=0,v=(e.viewData||[]).length,w=e.getColumnHeaderCellHeight(),b=e.getRowHeaderCellWidth(),C=e.style.cellHeight,B=e.getSchema();for(e.scrollCache.x=[],e.scrollCache.y=[],o=0;o<v;o+=1)e.scrollCache.y[o]=x,x+=((e.sizes.rows[o]||C)+(e.sizes.trees[o]||0))*e.scale+(e.frozenRow>o&&e.sizes.trees[o]||0);return v>1&&(e.scrollCache.y[o]=x),y=B.reduce((function(t,o,r){if(B[e.orders.columns[r]].hidden)return e.scrollCache.x[r]=t,t;var n=t+e.getColumnWidth(e.orders.columns[r]);return e.scrollCache.x[r]=n,n}),0)||0,e.attributes.showNewRow&&(x+=C),e.attributes.snapToRow&&(x+=e.style.cellHeight),I(),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=w+p,e.scrollBox.left=b,M(),S(),e.scrollBox.horizontalBarVisible&&("auto"!==e.style.height||e.isChildGrid||(e.height+=h),x+=h,I(),M(),S()),e.scrollBox.verticalBarVisible&&("auto"!==e.style.width||e.isChildGrid||(e.width+=h),y+=h,I(),M(),S()),M(),e.scrollBox.scrollWidth=y-e.scrollBox.width,e.scrollBox.scrollHeight=x-e.scrollBox.height,e.frozenColumn>0?e.scrollBox.widthBoxRatio=(e.scrollBox.width-e.scrollCache.x[e.frozenColumn-1])/y:e.scrollBox.widthBoxRatio=e.scrollBox.width/y,e.scrollBox.scrollBoxWidth=e.scrollBox.width*e.scrollBox.widthBoxRatio-e.style.scrollBarWidth-d-u,e.scrollBox.heightBoxRatio=(e.scrollBox.height-w-e.scrollCache.y[e.frozenRow])/x,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+=b,l.y+=e.height-e.style.scrollBarWidth-u,l.width=e.width-e.style.scrollBarWidth-b-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-e.style.scrollBarWidth-e.style.scrollBarBorderWidth-u,n.y+=w+e.scrollCache.y[e.frozenRow],n.width=e.style.scrollBarWidth+e.style.scrollBarBorderWidth+u,n.height=e.height-w-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||(e.canvas.width=e.width*f,e.canvas.height=e.height*f,e.ctx.scale(f,f)),e.resizeEditInput(),e.scroll(!0),t&&e.draw(!0),e.dispatchEvent("resize",{}),!0}function S(){e.scrollBox.horizontalBarVisible="auto"!==e.style.width&&y>e.scrollBox.width&&"hidden"!==e.style.overflowX||"scroll"===e.style.overflowX,e.scrollBox.horizontalBoxVisible=y>e.scrollBox.width,e.scrollBox.verticalBarVisible="auto"!==e.style.height&&x>e.scrollBox.height&&"hidden"!==e.style.overflowY||"scroll"===e.style.overflowY,e.scrollBox.verticalBoxVisible=x>e.scrollBox.height}function M(){e.scrollBox.width=e.width-b,e.scrollBox.height=e.height-w}function I(){e.isChildGrid||(r={height:w+x+m+1,width:y+b+m},["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){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={NativeEvent:t,cell:u,x:c,y:d},f=e.currentCell;if(clearTimeout(e.scrollTimer),e.isInGrid({x:c,y:d})||(e.hasFocus=!1),!e.dispatchEvent("mousemove",h)){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"]&&(h.cell=f,e.dispatchEvent(t+"mouseout",h),h.cell=u,e.dispatchEvent(t+"mouseover",h))}))),e.currentCell=u,e.hovers={},!e.draggingItem&&u&&(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},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())),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)),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("row"!==e.attributes.selectionMode&&-1!==e.dragStartObject.columnIndex||!e.rowBoundaryCrossed){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(e.selectedFilterButton={columnIndex:-1,rowIndex:-1},e.hovers.onFilterButton)return;if(e.dragAddToSelection||void 0===u.rowIndex){if(e.selections[u.rowIndex]=e.selections[u.rowIndex]||[],-1===e.selections[u.rowIndex].indexOf(u.columnIndex)){e.selections[u.rowIndex].push(u.columnIndex);var g={selections:e.selections,selectedData:e.getSelectedData(),selectedCells:e.getSelectedCells(),selectionBounds:e.getSelectionBounds()};e.dispatchEvent("selectionchanged",g)}}else e.selections[u.rowIndex]&&-1!==e.selections[u.rowIndex].indexOf(u.columnIndex)&&e.selections[u.rowIndex].splice(e.selections[u.rowIndex].indexOf(u.columnIndex),1)}}else e.selectRow(u.rowIndex,a,null,!0);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.selections=[]),-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),-1==l.left&&l.top!==l.bottom&&(e.isMultiRowsSelected=!0);if(e.attributes.autoScrollOnMousemove){var m=i.y>e.attributes.autoScrollMargin,p=i.x>e.attributes.autoScrollMargin;m&&!p?e.autoScrollZone(t,-1,d,a):p&&!m?e.autoScrollZone(t,c,-1,a):p&&m&&e.autoScrollZone(t,c,d,a)}else e.autoScrollZone(t,c,d,a)}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})&&e.hasFocus){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 a();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 a();if(e.selections[r.rowIndex]=e.selections[r.rowIndex]||[],("row"===e.attributes.selectionMode||"rowHeaderCell"===e.currentCell.style)&&"rowHeaderCell"===e.currentCell.style&&e.attributes.tree&&i.x>0&&i.x-e.currentCell.x<e.style.treeArrowWidth+e.style.treeArrowMarginLeft+e.style.treeArrowMarginRight+e.style.treeArrowClickRadius&&i.y-e.currentCell.y<e.style.treeArrowHeight+e.style.treeArrowMarginTop+e.style.treeArrowClickRadius&&i.y>0)return void e.toggleTree(r.rowIndex);t.shiftKey&&!l&&(e.selectionBounds=e.getSelectionBounds(),e.selectArea(void 0,!1))}a(),e.draw(!0)}function a(){var t,o=e.getSelectionBounds();n!==JSON.stringify(o)&&(t={selections:e.selections,selectionBounds:e.getSelectionBounds(),selectedCells:e.getSelectedCells()},Object.defineProperty(t,"selectedData",{get:function(){return e.getSelectedData()}}),e.dispatchEvent("selectionchanged",t))}},e.dragResizeColumn=function(t){var o,r,n;return 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("resizecolumn",{x:r,y:n,draggingItem:e.draggingItem})&&(e.scrollBox.scrollLeft>e.scrollBox.scrollWidth-e.attributes.resizeScrollZone&&"ew-resize"===e.dragMode&&(e.resize(!0),e.scrollBox.scrollLeft+=r),"ew-resize"===e.dragMode?(e.sizes.columns["rowHeaderCell"===e.draggingItem.header.style?"cornerCell":e.draggingItem.sortColumnIndex]=r,-1!==["rowHeaderCell","cornerCell"].indexOf(e.draggingItem.header.style)&&e.resize(!0),void e.resizeChildGrids()):"ns-resize"===e.dragMode?(e.draggingItem.rowOpen?e.sizes.trees[e.draggingItem.rowIndex]=n:e.attributes.globalRowResize?e.style.cellHeight=n:e.sizes.rows[e.draggingItem.rowIndex]=n,e.dispatchEvent("resizerow",{row:n}),void e.resizeChildGrids()):void(e.ellipsisCache={}))},e.stopDragResize=function(t){var o=e.getLayerPos(t),r=!!(o.x-e.dragStart.x),n=e.resizingStartingWidth+o.x-e.dragStart.x;if("ew-resize"===e.dragMode){var l=e.selections[0],i=e.isColumnSelected(e.dragItem.columnIndex);if(i){var a,s=_createForOfIteratorHelper(l);try{for(s.s();!(a=s.n()).done;){var c=a.value,d=e.getBoundColumnIndexFromViewColumnIndex(c);r&&i&&e.isColumnSelected(c)&&(e.sizes.columns[d]=n)}}catch(e){s.e(e)}finally{s.f()}}}e.resize(),document.body.removeEventListener("mousemove",e.dragResizeColumn,!1),document.body.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(),document.removeEventListener("mousemove",e.scrollGrid,!1)},e.dragReorder=function(t){var o,r,n,l="column-reorder"===e.dragMode,i="row-reorder"===e.dragMode;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.draggingItem.header.index)||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)&&(e.reorderObject=e.draggingItem,e.isMultiRowsSelected&&(e.reorderObject=e.getVisibleCellByIndex(-1,e.activeCell.rowIndex)),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=[],l={"row-reorder":e.orders.rows,"column-reorder":e.orders.columns},i={"row-reorder":"rowIndex","column-reorder":"sortColumnIndex"}[e.dragMode];if(document.body.removeEventListener("mousemove",e.dragReorder,!1),document.body.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=[],s=[];e.selections[0]&&e.selections[0].forEach((function(t){a.push(e.orders.columns[t])}));var c=a.length;l[e.dragMode].splice(o,c),r>o&&(r-=c-1);for(i=0;i<a.length;i++)s.push(r+i),l[e.dragMode].splice(r+i,0,a[i]);e.orders.columns=l[e.dragMode],e.viewData.forEach((function(t,o){e.selections[o]=s}))}else{var d=[];e.selections.forEach((function(t,o){t&&(d.push(t),n.push(e.viewData[o]))})),e.viewData.splice(o,n.length),e.selections=[],r>o&&(r-=n.length-1),e.activeCell.rowIndex=r;for(i=0;i<n.length;i++)e.viewData.splice(r+i,0,n[i]),e.selections[r+i]=d[i]}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){document.body.removeEventListener("mousemove",e.dragMove,!1),document.body.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),r="collapse"===e.style.gridBorderCollapse?1:2,n=e.style.columnHeaderCellBorderWidth*r,l=e.getColumnHeaderCellHeight(),i=e.getRowHeaderCellWidth();if(e.ignoreNextClick=!0,e.freezeMarkerPosition=o,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){e.scrollBox.scrollLeft=0,e.frozenColumn=e.currentCell.columnIndex+1,e.scrollBox.bar.h.x=i+e.scrollCache.x[e.frozenColumn-1],e.scrollBox.box.h.x=i+e.scrollCache.x[e.frozenColumn-1];var s=e.scrollCache.x[e.scrollCache.x.length-1];e.scrollBox.widthBoxRatio=(e.scrollBox.width-e.scrollCache.x[e.frozenColumn-1])/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}(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){if(document.body.removeEventListener("mousemove",e.freezeMove,!1),document.body.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.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);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||"row-reorder"==e.dragMode&&e.isMultiRowsSelected||e.currentCell.hovered&&e.hovers.onFilterButton||(e.selections=[]),!e.dragStartObject.isGrid){if(-1!==e.scrollModes.indexOf(e.dragStartObject.context))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()),document.addEventListener("mousemove",e.scrollGrid,!1),document.addEventListener("mouseup",e.stopScrollGrid,!1),void(e.ignoreNextClick=!0);if("cell"===e.dragMode)return e.selecting=!0,void(("row"===e.attributes.selectionMode||-1===e.dragStartObject.columnIndex)&&e.dragStartObject.rowIndex>-1?e.selectRow(e.dragStartObject.rowIndex,r,null):"row"!==e.attributes.selectionMode&&e.mousemove(t));if(n){if(e.draggingItem=e.dragItem,e.movingSelection=e.selections.concat([]),e.dragging=e.dragStartObject,e.dispatchEvent("beginmove",{NativeEvent:t,cell:e.currentCell}))return;return document.body.addEventListener("mousemove",e.dragMove,!1),document.body.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 document.body.addEventListener("mousemove",e.freezeMove,!1),document.body.addEventListener("mouseup",e.stopFreezeMove,!1),e.mousemove(t)}return i?(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,document.body.addEventListener("mousemove",e.dragResizeColumn,!1),void document.body.addEventListener("mouseup",e.stopDragResize,!1)):-1!==["row-reorder","column-reorder"].indexOf(e.dragMode)?(e.draggingItem=e.dragStartObject,"column-reorder"!==e.dragMode||e.isMultiColumnsSelected(e.currentCell.header.index)?"row-reorder"!==e.dragMode||e.isMultiRowsSelected||e.selectRow(e.dragStartObject.rowIndex,r,null):e.selectColumn(e.currentCell.header.index,r,t.shiftKey),document.body.addEventListener("mousemove",e.dragReorder,!1),void document.body.addEventListener("mouseup",e.stopDragReorder,!1)):void 0}}},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,r=this,n=e.getAdjacentCells(),l=Math.max(e.activeCell.columnIndex,0),i=Math.max(e.activeCell.rowIndex,0),a=t.ctrlKey||t.metaKey,s=e.viewData.length-1,c=e.getSchema().length-1;if(!e.dispatchEvent("keydown",{NativeEvent:t,cell:e.currentCell})&&(e.attributes.keepFocusOnMouseOut||e.hasFocus)){if(isPrintableKeyEvent(t)&&!a)return e.beginEditAt(l,i,t,!0);if(e.attributes.showNewRow&&(s+=1),"Tab"===t.key&&t.preventDefault(),"Escape"===t.key?e.selectNone():a&&"a"===t.key?e.selectAll():["Backspace","Delete"].includes(t.key)?e.deleteSelectedData():"ArrowDown"===t.key?i+=1:"ArrowUp"===t.key?i-=1:"ArrowLeft"===t.key&&!a||t.shiftKey&&"Tab"===t.key?l=n.left:"ArrowRight"===t.key&&!a||!t.shiftKey&&"Tab"===t.key?l=n.right:"PageUp"===t.key?(i-=e.page,t.preventDefault()):"PageDown"===t.key?(i+=e.page,t.preventDefault()):"Home"===t.key||a&&"ArrowUp"===t.key?i=0:"End"===t.key||a&&"ArrowDown"===t.key?i=e.viewData.length-1:a&&"ArrowRight"===t.key?l=n.last:a&&"ArrowLeft"===t.key&&(l=n.first),"Enter"===t.key)return t.preventDefault(),e.beginEditAt(l,i,t);(l<0||Number.isNaN(l))&&(l=n.first),i>s&&(i=s),(i<0||Number.isNaN(i))&&(i=0),l>c&&(l=n.last);var d=["ArrowLeft","ArrowUp","ArrowRight","ArrowDown"].includes(t.key);if(t.shiftKey&&d){var u=e.selections.findIndex(function(e){return _newArrowCheck(this,r),!!e}.bind(this)),h=e.selections[u],f=h[0],g=h[h.length-1],m=0===i,p=i===s,x=0===l,y=l===c;"ArrowUp"===t.key&&(i+1>u&&!m?e.selections.pop():i<u?(e.selections[i]=e.selections[i]||[],e.selections[i].push(l)):m&&0!==e.activeCell.rowIndex&&e.selections.pop()),"ArrowDown"===t.key&&(i>u&&i===e.selections.length?(e.selections[i]=e.selections[i]||[],e.selections[i].push(l)):(i>=u&&!p||p&&e.activeCell.rowIndex!==s)&&delete e.selections[i-1]);var v,w=_createForOfIteratorHelper(e.selections);try{for(w.s();!(v=w.n()).done;){var b=v.value;"ArrowRight"===t.key&&b&&(l>g?b.push(l):(l<=g&&!y||y&&e.activeCell.columnIndex!==c)&&b.shift()),"ArrowLeft"===t.key&&b&&(l<f?b.unshift(l):(l>=f&&!x||x&&0!==e.activeCell.columnIndex)&&b.pop())}}catch(e){w.e(e)}finally{w.f()}e.selectionBounds=e.getSelectionBounds(),e.selectArea(void 0,a),e.draw(!0)}l===e.activeCell.columnIndex&&i===e.activeCell.rowIndex||(e.scrollIntoView(l!==e.activeCell.columnIndex?l:void 0,i===e.activeCell.rowIndex||Number.isNaN(i)?void 0:i),e.setActiveCell(l,i),!t.shiftKey&&e.attributes.selectionFollowsActiveCell&&(a||(e.selections=[]),e.selections[i]=e.selections[i]||[],e.selections[i].push(l),o={selectedData:e.getSelectedData(),selections:e.selections,selectionBounds:e.getSelectionBounds(),selectedCells:e.getSelectedCells()},Object.defineProperty(o,"selectedData",{get:function(){return e.getSelectedData()}}),e.dispatchEvent("selectionchanged",o)),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.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=o.NativeEvent||o;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;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 i=e.getSchema(),a=parseData(t,o);if(1===a.length&&1===a[0].length){var s=a[0][0].value.map(function(e){return _newArrowCheck(this,l),e.value}.bind(this)).join();e.forEachSelectedCell((function(e,t,o){e[t][o]=s}))}else{for(var c=[],d=0;d<a.length;d++){var u=e.orders.rows[r+d],h=a[d],f=e.viewData[u],g=Object.assign({},f);c[u]=[];for(var m=0;m<h.length;m++){var p=i[n+m];if(p){var x=p.name;null!=(s=h[m].value.map(function(e){return _newArrowCheck(this,l),e.value}.bind(this)).join(""))?(c[u].push(n+m),g[x]=s):g[x]=f[x]}else console.warn("Paste data exceeded grid bounds. Skipping.")}e.originalData[e.boundRowIndexMap.get(u)]=g,e.viewData[u]=g}e.selections=c}var y=[];return e.selections.forEach((function(t,o){void 0!==o&&t.forEach((function(t){y.push([o,t,e.getBoundRowIndexFromViewRowIndex(o),e.getBoundColumnIndexFromViewColumnIndex(t)])}))})),e.dispatchEvent("afterpaste",{cells:y}),a.length},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.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){for(var i=l[0],a=[],s=0,c=e.selections.length;s<c;s++){var d=e.selections[s];if(d){if(void 0===d[0])return;a=[s,d[0]<0?d[1]:d[0]];break}}var u=i.type;i.getAsString((function(t){e.pasteData(t,u,a[0],a[1]),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();e.dispatchEvent("aftercut",{cells:r}),requestAnimationFrame(function(){return _newArrowCheck(this,o),e.draw()}.bind(this))}},e.copy=function(t){e.dispatchEvent("copy",{NativeEvent:t})||e.hasFocus&&t.clipboardData&&(e.copySelectedCellsToClipboard(t.clipboardData),t.preventDefault())}}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}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.sizes={rows:{},columns:{},trees:{}},e.selections=[],e.filterable={rows:[],columns:[]},e.selectedFilterButton={columnIndex:-1,rowIndex:-1},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.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","attributechanged","beforebeginedit","beforecreatecellgrid","beforedraw","beforeendedit","beforerendercell","beforerendercellgrid","beforerenderfilterbutton","beginedit","cellmouseout","cellmouseover","click","collapsetree","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.getSelectedData=function(t){var o=[],r=e.getSchema(),n=e.viewData.length;return 0===n?[]:(e.selections.forEach((function(l,i){l&&i!==n&&(0!==l.length?(o[i]={},l.forEach((function(n){if(-1!==n&&r[n]){var l=e.orders.columns[n];!t&&r[l].hidden||e.viewData[i]&&(o[i][r[l].name]=e.viewData[i][r[l].name])}}))):o[i]=null)})),o)},e.getSelectedCells=function(t){var o=[],r=e.getSchema();if(0===e.viewData.length)return[];var n,l=_createForOfIteratorHelper(e.selections.entries());try{for(l.s();!(n=l.n()).done;){var i=_slicedToArray(n.value,2),a=i[0],s=i[1];if(s&&0!==s.length){var c,d=_createForOfIteratorHelper(s.entries());try{for(d.s();!(c=d.n()).done;){var u=_slicedToArray(c.value,2)[1];if(-1!==u&&r[u]){var h=e.getBoundColumnIndexFromViewColumnIndex(u);if((t||!r[h].hidden)&&e.viewData[a]){var f=r[h],g={value:e.viewData[a][f.name],header:f,boundRowIndex:e.getBoundRowIndexFromViewRowIndex(a),boundColumnIndex:h,viewRowIndex:a,viewColumnIndex:u};o.push(g)}}}}catch(e){d.e(e)}finally{d.f()}}}}catch(e){l.e(e)}finally{l.f()}return o},e.copySelectedCellsToClipboard=function(t){var o,r,n=[],l=e.getSchema(),i=!0,a=_createForOfIteratorHelper(e.selections.entries());try{for(a.s();!(r=a.n()).done;){var s=_slicedToArray(r.value,2),c=s[0],d=s[1];if(d){var u=d.join(",").toString(),h={};o||(o=d.join(",").toString()),i&&u!==o&&(i=!1);var f,g=e.getBoundRowIndexFromViewRowIndex(c),m=_createForOfIteratorHelper(d);try{for(m.s();!(f=m.n()).done;){var p=f.value;if(!(p<0)){var x=l[e.getBoundColumnIndexFromViewColumnIndex(p)].name,y=e.originalData[g][x];h[x]=y}}}catch(e){m.e(e)}finally{m.f()}n.push(h)}}}catch(e){a.e(e)}finally{a.f()}if(n.length>0)for(var v=createTextString(n,i),w={"text/plain":v,"text/html":createHTMLString(n,i),"text/csv":v,"application/json":JSON.stringify(n)},b=0,C=Object.entries(w);b<C.length;b++){var B=_slicedToArray(C[b],2),S=B[0],M=B[1];t.setData(S,M)}},e.clearSelectedCells=function(){var t,o=e.getSchema(),r=[],n=_createForOfIteratorHelper(e.selections.entries());try{for(n.s();!(t=n.n()).done;){var l=_slicedToArray(t.value,2),i=l[0],a=l[1];if(a){var s,c=e.getBoundRowIndexFromViewRowIndex(i),d=_createForOfIteratorHelper(a);try{for(d.s();!(s=d.n()).done;){var u=s.value;if(!(u<0)){var h=e.getBoundColumnIndexFromViewColumnIndex(u),f=o[h].name;e.viewData[c][f]="",r.push([i,u,c,h])}}}catch(e){d.e(e)}finally{d.f()}}}}catch(e){n.e(e)}finally{n.f()}return r},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.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.fitSelectedColumns=function(){var t,o=e.selections[0],r=e.getSchema(),n=_createForOfIteratorHelper(o);try{for(n.s();!(t=n.n()).done;){var l=t.value;if(l>=0&&e.isColumnSelected(l)){var i=r[e.orders.columns[l]];e.fitColumnToValues(i.name)}}}catch(e){n.e(e)}finally{n.f()}},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.getFilteredAndSortedViewData=function(t){for(var o=this,r=t.map(function(e,t){return _newArrowCheck(this,o),[e,t]}.bind(this)),n=function(){var t=_slicedToArray(i[l],2),o=t[0],n=t[1],a=e.getHeaderByName(o);if(!a)return"continue";var s=a.filter||e.filter(a.type||"string");r=r.filter((function(t){var r=_slicedToArray(t,2),l=r[0],i=r[1];return!!(e.attributes.allowFreezingRows&&!e.attributes.filterFrozenRows&&i<e.frozenRow)||s(l[o],n)}))},l=0,i=Object.entries(e.columnFilters);l<i.length;l++)n();var a,s=_createForOfIteratorHelper(e.orderings.columns);try{var c=function(){var t=this,o=a.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(s.s();!(a=s.n()).done;)c()}catch(e){s.e(e)}finally{s.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("mouseup",e.mouseup,!1),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.contextmenu,!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),document.body.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.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,10)},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.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.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.selectRow=e.selectRow,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,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(),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 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,"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.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 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,x={};if(!Array.isArray(a))throw new Error("createContextMenu expects an array.");function y(){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 v(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 w(e){return function(){clearTimeout(o)}}return x.parentGrid=e.intf,x.parentContextMenu=s,x.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,x),i.setAttribute("contextOpen","1"),i.addEventListener("mouseout",a),h.addEventListener("mouseout",a),m.push(t.contextMenu)}}function c(){var e;"1"!==i.getAttribute("contextOpen")&&(i.setAttribute("opening","1"),"function"!=typeof t.items?s(t.items):void 0!==(e=t.items.apply(x,[function(e){s(e)}]))&&Array.isArray(e)&&s(e))}!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",y),h.addEventListener("wheel",(function(t){e.hasFocus&&(h.scrollTop+=t.deltaY,h.scrollLeft+=t.deltaX),y()})),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",v("down")),g.addEventListener("mouseout",w()),f.addEventListener("mouseover",v("up")),f.addEventListener("mouseout",w()),y(),x.clickIndex=function(e){a[e].contextItemContainer.dispatchEvent(new Event("click"))},x.rect=c,x.items=a,x.upArrow=f,x.downArrow=g,x.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(x,"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")}))}}),x}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){if(e.hasFocus||t.target===e.canvas){var r,a=[],s=o||e.getLayerPos(t),c={NativeEvent:t,cell:e.getCellAt(s.x,s.y),items:a};c.cell.isGrid||function(t){var o=!(t.cell.isBackground||t.cell.isColumnHeaderCellCap||t.cell.isScrollBar||t.cell.isCorner||t.cell.isRowHeader)&&t.cell.header;e.attributes.showFilter&&o&&i(t),e.attributes.showCopy&&e.selections.reduce((function(e,t){return e+t.length}),0)>0&&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,t.cell.columnIndex,t.cell.rowIndex),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&&t.items.push({title:e.attributes.hideColumnText.replace(/%s/gi,t.cell.header.title||t.cell.header.name),click:function(o){e.getSchema()[t.cell.columnIndex].hidden=!0,o.preventDefault(),e.stopPropagation(o),e.disposeContextMenu(),e.setStorageData(),setTimeout((function(){e.resize(!0)}),10)}})),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&&o&&(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()}}))}(c),"mousedown"!==t.type&&e.dispatchEvent("contextmenu",c)||c.cell.isGrid||(e.contextMenu&&e.disposeContextMenu(),r={left:s.x+s.rect.left+e.style.contextMenuMarginLeft+e.canvasOffsetLeft,top:s.y+s.rect.top+e.style.contextMenuMarginTop+e.canvasOffsetTop,right:c.cell.width+c.cell.x+s.rect.left,bottom:c.cell.height+c.cell.y+s.rect.top,height:c.cell.height,width:c.cell.width},e.mobile&&(r.left=e.style.mobileContextMenuMargin+"px",r.width=e.width-2*e.style.mobileContextMenuMargin+"px"),"mousedown"==t.type&&(r.top+=e.style.filterButtonMenuOffsetTop),e.contextMenu=l(c,r,a),"mousedown"==t.type?document.addEventListener("mouseup",d):d(),t.preventDefault())}function d(){requestAnimationFrame((function(){document.addEventListener("click",e.disposeContextMenu),document.removeEventListener("mouseup",d)}))}}}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");e.input.style.left=t.left+l.x+e.canvasOffsetLeft-o.left+"px",e.input.style.top=t.top+l.y-e.style.cellBorderWidth+e.canvasOffsetTop-o.top+"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;t.offsetParent&&"CANVAS-DATAGRID"!==t.nodeName;)l+=t.offsetLeft,i+=t.offsetTop,r=t.offsetHeight,n=t.offsetWidth,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),{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),h=u||n;e.input.value=h?"":d.value,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)}})),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]}))},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("mouseup",e.mouseup,!1),e.eventParent.addEventListener("mousedown",e.mousedown,!1),e.eventParent.addEventListener("dblclick",e.dblclick,!1),e.eventParent.addEventListener("click",e.click,!1),document.body.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)}}function publicMethods(e){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.scrollIntoView=function(t,o,r,n){0===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})).length&&e.gotoCell(t,o,r,n)},e.setActiveCell=function(t,o){t<0&&(t=0),o<0&&(o=0),e.activeCell={rowIndex:o,columnIndex:t}},e.selectNone=function(t){e.selections=[],e.dispatchEvent("selectionchanged",{selectedData:e.getSelectedData(),selections:e.selections,selectionBounds:e.selectionBounds,selectedCells:e.getSelectedCells()}),t||e.draw()},e.selectAll=function(t){e.selectArea({top:0,left:-1,right:e.getSchema().length-1,bottom:e.viewData.length-1}),t||e.draw()},e.isMultiColumnsSelected=function(t){var o=!0;return e.viewData.forEach((function(r,n){var l=e.selections[n];if(!l||l.length<=1||-1===l.indexOf(t))o=!1;else if(l.length>1)if(l[0]!=t)o=!1;else for(var i=0;i<l.length-1;i++)if(l[i]+1!=l[i+1]){o=!1;break}})),o},e.isColumnSelected=function(t){var o=!0;return e.viewData.forEach((function(r,n){e.selections[n]&&-1!==e.selections[n].indexOf(t)||(o=!1)})),o},e.forEachSelectedCell=function(t,o){var r=[],n=o?e.getSchema():e.getVisibleSchema(),l=e.viewData.length;e.selections.forEach((function(o,i){i!==l&&(0!==o.length?(r[i]={},o.forEach((function(o){-1!==o&&n[o]&&t(e.viewData,i,n[o].name)}))):r[i]=null)}))},e.selectColumn=function(t,o,r,n){var l,i,a,s;function c(t){e.viewData.forEach((function(o,r){e.selections[r]=e.selections[r]||[],-1===e.selections[r].indexOf(t)&&e.selections[r].push(t)}))}if(r){if(!e.activeCell)return;for(l=Math.min(e.activeCell.columnIndex,t),i=Math.max(e.activeCell.columnIndex,t),a=l;i>a;a+=1)c(a)}o||r||(e.selections=[],e.activeCell.columnIndex=t,e.activeCell.rowIndex=e.scrollIndexTop),o&&e.isColumnSelected(t)?(s=t,e.viewData.forEach((function(t,o){e.selections[o]=e.selections[o]||[],-1!==e.selections[o].indexOf(s)&&e.selections[o].splice(e.selections[o].indexOf(s),1)}))):c(t),n||e.dispatchEvent("selectionchanged",{selectedData:e.getSelectedData(),selections:e.selections,selectionBounds:e.getSelectionBounds(),selectedCells:e.getSelectedCells()})},e.selectRow=function(t,o,r,n){var l,i,a,s=e.getVisibleSchema();function c(){n||e.dispatchEvent("selectionchanged",{selectedData:e.getSelectedData(),selections:e.selections,selectionBounds:e.selectionBounds,selectedCells:e.getSelectedCells()})}function d(t){e.selections[t]=[],e.selections[t].push(-1),s.forEach((function(o,r){e.selections[t].push(e.orders.columns.indexOf(o.index))}))}if(e.isMultiRowsSelected=!1,(!1===e.dragAddToSelection||void 0===e.dragObject)&&e.selections[t]&&e.selections[t].length-1===s.length&&o)return e.selections[t]=[],void c();if(!0===e.dragAddToSelection||void 0===e.dragObject)if(r&&void 0===e.dragObject){if(!e.activeCell)return;for(i=Math.min(e.activeCell.rowIndex,t),a=Math.max(e.activeCell.rowIndex,t),l=i;a>=l;l+=1)d(l)}else d(t);c()},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.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){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()}},e.isInGrid=function(t){return!(t.x<0||t.x>e.width||t.y<0||t.y>e.height)},e.moveSelection=function(t,o){var r=[];e.selections.forEach((function(e,n){r[n+o]=[],e.forEach((function(e){r[n+o].push(e+t)}))})),e.selections=r},e.deleteSelectedData=function(t){var o=this,r=e.clearSelectedCells();e.dispatchEvent("afterdelete",{cells:r}),t||requestAnimationFrame(function(){return _newArrowCheck(this,o),e.draw()}.bind(this))},e.moveTo=function(t,o,r){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[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.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.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){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))return s.dragContext=s.style,s.context="row-resize",s;if(/frozen-column-marker/.test(s.style))return s.dragContext=s.style,s.context="col-resize",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?(s.context="cell",s.dragContext="column-reorder",s):"rowHeaderCell"===s.style?(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.getSelectionBounds=function(){var t={x:1/0,y:1/0},o={x:-1/0,y:-1/0};return e.selections.forEach((function(e,r){var n,l;t.y=r<t.y?r:t.y,o.y=r>o.y?r:o.y,n=Math.max.apply(null,e),l=Math.min.apply(null,e),t.x=l<t.x?l:t.x,o.x=n>o.x?n:o.x})),{top:t.y,left:t.x,bottom:o.y,right:o.x}},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.selectArea=function(t,o){e.selectionBounds=t||e.selectionBounds;var r,n,l,i=e.getSchema();if(o||(e.selections=[]),e.selectionBounds.top<-1||e.selectionBounds.bottom>e.viewData.length||e.selectionBounds.left<-1||e.selectionBounds.right>i.length)throw new Error("Impossible selection area");for(n=e.selectionBounds.top;n<=e.selectionBounds.bottom;n+=1)for(e.selections[n]=[],l=e.selectionBounds.left;l<=e.selectionBounds.right;l+=1)-1===e.selections[n].indexOf(l)&&e.selections[n].push(l);r={selections:e.selections,selectionBounds:e.selectionBounds,selectedCells:e.getSelectedCells()},Object.defineProperty(r,"selectedData",{get:function(){return e.getSelectedData()}}),e.dispatchEvent("selectionchanged",r)},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.headerCellPaddingRight+e.style.headerCellPaddingLeft;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,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","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})(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],["blanksText","(Blanks)"],["borderDragBehavior","none"],["borderResizeZone",10],["clearSettingsOptionText","Clear saved settings"],["columnHeaderClickBehavior","sort"],["columnSelectorHiddenText","&nbsp;&nbsp;&nbsp;"],["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"],["hoverMode","cell"],["keepFocusOnMouseOut",!1],["maxAutoCompleteItems",200],["multiLine",!1],["name",""],["pageUpDownOverlap",1],["pasteText","Paste"],["persistantSelectionMode",!1],["removeFilterOptionText","Remove filter on %s"],["reorderDeadZone",3],["resizeScrollZone",20],["rowGrabZoneSize",5],["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","&#x25BC;"],["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","&#x25BA;"],["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","&#x25BC;"],["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","&#x25BC;"],["contextMenuArrowUpHTML","&#x25B2;"],["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(236, 243, 255, 1)"],["frozenMarkerHoverBorderColor","rgba(110, 168, 255, 1)"],["frozenMarkerActiveColor","rgba(236, 243, 255, 1)"],["frozenMarkerActiveBorderColor","rgba(110, 168, 255, 1)"],["frozenMarkerColor","rgba(222, 222, 222, 1)"],["frozenMarkerBorderColor","rgba(168, 168, 168, 1)"],["frozenMarkerBorderWidth",1],["frozenMarkerWidth",2],["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],["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"],["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],["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=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])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}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){if(!(t.length<4)){e.ctx.beginPath(),e.ctx.moveTo(t[0]+e.canvasOffsetLeft,t[1]+e.canvasOffsetTop);for(var o=2;o<t.length;o+=2){var r=t[o]+e.canvasOffsetLeft,n=t[o+1]+e.canvasOffsetTop;e.ctx.lineTo(r,n)}e.ctx.stroke()}}function u(e,t,o,r){g(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){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 f(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 g(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 m(t,o,r){o+=e.canvasOffsetLeft,r+=e.canvasOffsetTop,e.ctx.fillText(t,o,r)}function x(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 v(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);g(t-.5*r,o-.5*r,r,r)}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.stroke()}(t,o,.5*r);p(t-.5*r,o-.5*r,r,r)}function w(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){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 C,B,S,T,I,M,R,k,A,E,H,z,O,P,L,D,F,W,N,G,j,V=e.viewData||[],_="collapse"===e.style.gridBorderCollapse,Z=[],K=[],U=[],q=[],Y=V.length,J=e.currentCell||{},X=e.getColumnHeaderCellHeight(),Q=e.getRowHeaderCellWidth(),$=e.getRowGroupAreaWidth(),ee=e.getColumnGroupAreaHeight(),te={},oe={},re={},ne=e.getCollapsedColumnGroups(),le=e.getCollapsedRowGroups(),ie=e.style.cellHeight;r+=1,B=performance.now(),e.visibleRowHeights=[],V.length>e.orders.rows.length&&e.createRowOrders(),e.ctx.save(),e.visibleRows=[],P=e.getSchema(),e.visibleCells=[],e.visibleGroups=[],e.canvasOffsetTop=e.isChildGrid?e.parentNode.offsetTop:.5,e.canvasOffsetLeft=e.isChildGrid?e.parentNode.offsetLeft:-.5,z=e.height,f(0,0,O=e.width,z,0),e.ctx.clip(),e.ctx.fillStyle=e.style.gridBackgroundColor,g(0,0,O,z),e.ctx.translate($,ee),function(){var t=Math.min(V.length,e.frozenRow);for(E=-e.scrollBox.scrollLeft+e.scrollPixelLeft+e.style.cellBorderWidth,A=X,L=0;L<t&&de(e.orders.rows[L],L);L+=1);e.attributes.allowFreezingRows&&(A+=e.style.frozenMarkerBorderWidth+e.style.frozenMarkerWidth-.4999999999),e.lastFrozenRowPixel=A}(),function(){e.ctx.save(),e.frozenRow>0&&(f(0,e.lastFrozenRowPixel,e.width,e.height-e.lastFrozenRowPixel,0),e.ctx.clip());var t,o,r,n=P.length;for(E=-e.scrollBox.scrollLeft+e.scrollPixelLeft+e.style.cellBorderWidth,e.attributes.snapToRow||(A+=-e.scrollBox.scrollTop+e.scrollPixelTop+e.style.cellBorderWidth),L=e.frozenRow+e.scrollIndexTop;L<Y&&(o=e.orders.rows[L],e.scrollIndexBottom=L,e.scrollPixelBottom=A,e.cellTree.rows.length>0&&Object.keys(e.cellTree.rows[o]).length>0&&e.cellTree.rows[o].hide||de(o,L));L+=1);if(e.attributes.showNewRow){for(e.attributes.showRowHeaders&&(E+=Q),R=ie=e.style.cellHeight,M=!1,t=e.scrollIndexLeft;t<n&&(ae(t)||(r=e.orders.columns[t],E+=ce(e.newRow,V.length,V.length)(P[r],r,t)),!(E>e.width+e.scrollBox.scrollLeft));t+=1);q.push([e.newRow,V.length,V.length,A,R])}e.ctx.restore()}(),function(){if(F){e.ctx.save();var t=e.activeCell.columnIndex+1>e.frozenColumn||e.activeCell.rowIndex+1>e.frozenRow;f(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===F.rowIndex&&(e.ctx.lineWidth=e.style.activeCellOverlayBorderWidth,e.ctx.strokeStyle=e.style.activeCellOverlayBorderColor,p(1,F.y,e.getHeaderWidth()+Q,e.visibleRowHeights[F.rowIndex])):(e.ctx.lineWidth=e.style.activeCellOverlayBorderWidth,e.ctx.strokeStyle=e.style.activeCellOverlayBorderColor,p(F.x,F.y,F.width,F.height)),e.ctx.restore()}}(),function(){var t,o,r,n,l,i,a=P.length;function s(i,s){for(s=Math.min(s,a),r=i;r<s&&(o=e.orders.columns[r],(l=P[o]).hidden||ae(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},!((E+=ce(n,-1,-1)(t,o,r))>e.width+e.scrollBox.scrollLeft)));r+=1);}q.forEach((function(t,o){A=t[3],ie=t[4],o===e.frozenRow&&(e.ctx.save(),f(0,e.lastFrozenRowPixel,e.width,e.height-e.lastFrozenRowPixel,0),e.ctx.clip()),function(t,o,r){if(e.attributes.showRowHeaders){E=0;var n=e.viewData&&o<e.viewData.length?e.getBoundRowIndexFromViewRowIndex(o)+1:e.originalData?e.originalData.length+1:r+1,l=e.hasActiveFilters()||e.hasCollapsedRowGroup()?n:o+1,i={rowHeaderCell:l},a={name:"rowHeaderCell",width:e.sizes.columns[-1]||e.style.rowHeaderCellWidth,style:"rowHeaderCell",type:"string",data:l,index:-1};M=e.openChildren[o],ce(i,r,o)(a,-1,-1)}}(t[0],t[1],t[2])})),e.ctx.restore(),e.attributes.showColumnHeaders&&(E=-e.scrollBox.scrollLeft+e.scrollPixelLeft+e.style.columnHeaderCellBorderWidth,e.attributes.showRowHeaders&&(E+=Q),A=0,ie=e.getColumnHeaderCellHeight(),s(e.scrollIndexLeft,a),i=E,E=e.style.columnHeaderCellBorderWidth,e.attributes.showRowHeaders&&(E+=Q),s(0,e.frozenColumn),(E=i)<O&&(H={name:"",width:e.style.scrollBarWidth,style:"columnHeaderCellCap",isColumnHeaderCell:!0,isColumnHeaderCellCap:!0,type:"string",index:P.length},ce({endCap:""},-1,-1)(H,-1,-1)),e.attributes.showRowHeaders&&(k={cornerCell:""},E=0,H={name:"cornerCell",width:e.style.rowHeaderCellWidth,style:"cornerCell",type:"string",index:-1},ce(k,-1,-1)(H,-1,-1)))}(),function(){var t=e.lastFrozenRowPixel-e.style.frozenMarkerWidth,o=e.lastFrozenColumnPixel-e.style.frozenMarkerBorderWidth,r=e.currentCell&&"frozen-row-marker"===e.currentCell.style,n=e.currentCell&&"frozen-column-marker"===e.currentCell.style;if(e.ctx.lineWidth=e.style.frozenMarkerBorderWidth,e.attributes.allowFreezingColumns&&(e.ctx.fillStyle=n?e.style.frozenMarkerHoverColor:e.style.frozenMarkerColor,e.ctx.strokeStyle=n?e.style.frozenMarkerHoverBorderColor:e.style.frozenMarkerBorderColor,g(o,0,e.style.frozenMarkerWidth,e.height),p(o,0,e.style.frozenMarkerWidth,e.height),e.visibleCells.unshift({x:o,y:0,height:e.height,width:e.style.frozenMarkerWidth+e.style.frozenMarkerBorderWidth,style:"frozen-column-marker"})),e.attributes.allowFreezingRows){e.ctx.fillStyle=r?e.style.frozenMarkerHoverColor:e.style.frozenMarkerColor,e.ctx.strokeStyle=r?e.style.frozenMarkerHoverBorderColor:e.style.frozenMarkerBorderColor,g(0,t,e.width,e.style.frozenMarkerWidth),p(0,t,e.width,e.style.frozenMarkerWidth);var l=e.style.frozenMarkerWidth+e.style.frozenMarkerBorderWidth;e.visibleCells.unshift({x:0,y:t,height:l,width:e.width,style:"frozen-row-marker"}),oe={y:t,h:l}}e.freezeMarkerPosition&&(e.ctx.fillStyle=e.style.frozenMarkerActiveColor,e.ctx.strokeStyle=e.style.frozenMarkerActiveBorderColor,"frozen-column-marker"===e.dragMode?(g(e.freezeMarkerPosition.x,0,e.style.frozenMarkerWidth,e.height),p(e.freezeMarkerPosition.x,0,e.style.frozenMarkerWidth,e.height)):(g(0,e.freezeMarkerPosition.y,e.width,e.style.frozenMarkerWidth),p(0,e.freezeMarkerPosition.y,e.width,e.style.frozenMarkerWidth)))}(),(e.mobile||e.attributes.allowMovingSelection)&&(e.ctx.lineWidth=e.style.selectionHandleBorderWidth,e.ctx.strokeStyle=e.style.selectionHandleBorderColor,e.ctx.fillStyle=e.style.selectionHandleColor,U.forEach((function(t){!function(t,o){var r=e.style.selectionHandleSize;({tr:function(){v(t.x+t.width,t.y,r),y(t.x+t.width,t.y,r)},br:function(){v(t.x+t.width,t.y+t.height,r),y(t.x+t.width,t.y+t.height,r)},tl:function(){v(t.x,t.y,r),y(t.x,t.y,r)},bl:function(){v(t.x,t.y+t.height,r),y(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:O,height:z,x:0,y:0};if(e.ctx.fillStyle=e.style.reorderMarkerBackgroundColor,e.ctx.lineWidth=e.style.reorderMarkerBorderWidth,e.ctx.strokeStyle=e.style.reorderMarkerBorderColor,"row-reorder"===e.dragMode){for(var r=0;r<e.selections.length;r++)e.selections[r]&&r!=e.reorderObject.rowIndex&&(t.height+=e.getRowHeight(r));t.width=O,t.x=0,o.width=O,o.height=e.currentCell.height,o.y=e.currentCell.y,g(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.currentCell.rowIndex!==e.reorderObject.rowIndex&&e.currentCell.rowIndex>-1&&e.currentCell.rowIndex<Y&&w(o,e.reorderTarget.sortRowIndex>e.reorderObject.sortRowIndex?"b":"t")}else if("column-reorder"===e.dragMode&&e.reorderObject){var n=e.selections[0];for(r=1;r<n.length;r++)t.width+=e.getColumnWidth(e.orders.columns[n[r]]);t.height=z,t.y=0,o.height=z,o.width=e.currentCell.width,o.y=0,o.x=e.currentCell.x,g(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.currentCell.sortColumnIndex!==e.reorderObject.sortColumnIndex&&e.currentCell.sortColumnIndex>-1&&e.currentCell.sortColumnIndex<P.length&&w(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),K.forEach((function(e){w(e[0],e[1])})),e.ctx.setLineDash([])),e.ctx.lineWidth=e.style.gridBorderWidth,e.ctx.strokeStyle=e.style.gridBorderColor,p(0,0,e.width,e.height),function(){function t(e){w(e[0],e[1])}e.ctx.lineWidth=e.style.selectionOverlayBorderWidth,e.ctx.strokeStyle=e.style.selectionOverlayBorderColor,Z.filter((function(t){return t[0].rowIndex<e.frozenRow&&t[0].columnIndex<e.frozenColumn})).forEach(t),e.ctx.save(),x(0),Z.filter((function(t){return t[0].rowIndex>=e.frozenRow&&t[0].columnIndex>=e.frozenColumn})).forEach(t),e.ctx.restore(),e.ctx.save(),x(1),Z.filter((function(t){return t[0].rowIndex>=e.frozenRow&&t[0].columnIndex<e.frozenColumn})).forEach(t),e.ctx.restore(),e.ctx.save(),x(2),Z.filter((function(t){return t[0].rowIndex<e.frozenRow&&t[0].columnIndex>=e.frozenColumn})).forEach(t),e.ctx.restore()}(),N=e.scrollBox.entities,G=2*e.style.scrollBarBoxMargin,e.ctx.strokeStyle=e.style.scrollBarBorderColor,e.ctx.lineWidth=e.style.scrollBarBorderWidth,e.frozenColumn>0?N.horizontalBox.x=Q+e.style.scrollBarBoxMargin+e.scrollCache.x[e.frozenColumn-1]+(N.horizontalBar.width-e.scrollCache.x[e.frozenColumn-1]-e.scrollBox.scrollBoxWidth)*(e.scrollBox.scrollLeft/e.scrollBox.scrollWidth):N.horizontalBox.x=Q+e.style.scrollBarBoxMargin+(N.horizontalBar.width-e.scrollBox.scrollBoxWidth)*(e.scrollBox.scrollLeft/e.scrollBox.scrollWidth),N.verticalBox.y=X+e.style.scrollBarBoxMargin+e.scrollCache.y[e.frozenRow]+(N.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,g(N.horizontalBar.x,N.horizontalBar.y,N.horizontalBar.width+G,N.horizontalBar.height),p(N.horizontalBar.x,N.horizontalBar.y,N.horizontalBar.width+G,N.horizontalBar.height),e.ctx.fillStyle=e.style.scrollBarBoxColor,e.scrollBox.horizontalBoxVisible&&(/horizontal/.test(J.context)&&(e.ctx.fillStyle=e.style.scrollBarActiveColor),f(N.horizontalBox.x,N.horizontalBox.y,N.horizontalBox.width,N.horizontalBox.height,e.style.scrollBarBoxBorderRadius),e.ctx.stroke(),e.ctx.fill()),W=!0,e.visibleCells.unshift(N.horizontalBar),e.visibleCells.unshift(N.horizontalBox)),e.scrollBox.verticalBarVisible&&(e.ctx.fillStyle=e.style.scrollBarBackgroundColor,g(N.verticalBar.x,N.verticalBar.y,N.verticalBar.width,N.verticalBar.height+G),p(N.verticalBar.x,N.verticalBar.y,N.verticalBar.width,N.verticalBar.height+G),e.scrollBox.verticalBoxVisible&&(e.ctx.fillStyle=e.style.scrollBarBoxColor,/vertical/.test(J.context)&&(e.ctx.fillStyle=e.style.scrollBarActiveColor),f(N.verticalBox.x,N.verticalBox.y,N.verticalBox.width,N.verticalBox.height,e.style.scrollBarBoxBorderRadius),e.ctx.stroke(),e.ctx.fill()),W=!0,e.visibleCells.unshift(N.verticalBar),e.visibleCells.unshift(N.verticalBox)),W&&(e.ctx.strokeStyle=e.style.scrollBarCornerBorderColor,e.ctx.fillStyle=e.style.scrollBarCornerBackgroundColor,f(N.corner.x,N.corner.y,N.corner.width,N.corner.height,0),e.ctx.stroke(),e.ctx.fill(),e.visibleCells.unshift(N.corner)),C&&e.resize(!0),function(){var t=$,o=ee,r=b(),n=oe.y+oe.h-X,l="left"===e.attributes.columnGroupIndicatorPosition,i="top"===e.attributes.rowGroupIndicatorPosition,a=e.ctx;a.save(),a.fillStyle=e.style.groupingAreaBackgroundColor,g(0,-o,O,o),g(-t,-o,t,z),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],p=g.row,m=g.collapsed,x=p*n-o,v=x+.5*n,y=x+n-c,w=Q-i-c,b=function(e){return _newArrowCheck(this,f),u(e,x+c,i,g.collapsed)}.bind(this),C=function(r,n){return _newArrowCheck(this,f),e.visibleGroups.push({type:"c",collapsed:m,from:g.from,to:g.to,row:p,x:r+t,y:x+o,x2:n+t,y2:y+o})}.bind(this),B=g.from<e.frozenColumn&&g.to>=e.frozenColumn,S=g.from>=e.frozenColumn;if(m){var T=w+i;if(g.from>0){var I=g.to+1,M=re[I];if(M)T=M.x+c;else{if(I=g.from-1,!(M=re[I]))return"continue";T=M.x+M.w-.5*i}if(I>=e.frozenColumn)if(T<r+Q-c)return"continue"}var R=T+i;a.save(),a.strokeStyle=e.style.groupIndicatorColor,a.fillStyle=e.style.groupIndicatorBackgroundColor,b(T),a.restore(),C(T,R)}var k=void 0,A=re[g.from],E=re[g.to],H=!0,z=!0;for(k=g.from;!A&&k<g.to;)A=re[++k],H=!1;for(k=g.to;!E&&k>g.from;)E=re[--k],z=!1;if(!A||!E)return"continue";var O=E.x+E.w,P=A.x;if(B){var L=re[e.frozenColumn-1];if(L){var D=L.x+L.w;l||(D+=i),D>=O&&(O=(E=L).x+E.w,z=!1)}}var F=Q+(S?r:0);if(O+(l?0:i)<F)return"continue";O-=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),O>=P?(W.push(P,v,O,v),z&&W.push(O,y)):O=P,b(P-=i),O+=c-1):(P<F&&(P=F),0===g.from&&(P-=2*c),z&&(g.to===e.frozenColumn-1?O-=i:O+=2*c,b(O)),P>O?P=O:(0===g.from&&(H=!0,P=w+i),H&&W.push(P,y),W.push(P,v,O,v)),P-=c+1,z&&(O+=i)),d(W),a.restore(),C(P,O)},f=0;f<s.length;f++)h(f)}();for(var p=[],m=0;m<e.groupedRows.length;m++)for(var x=e.groupedRows[m],v=0;v<x.length;v++)p.push(Object.assign({col:m},x[v]));p.length>0&&function(){for(var r=e.style.rowGroupColumnWidth,l=.5*r,s=.5*(r-l),c=function(c){var h=this,f=p[c],g=f.col,m=f.collapsed,x=g*r-t,v=x+.5*r,y=x+r-s,w=X-l-s,b=function(e){return _newArrowCheck(this,h),u(x+s,e,l,f.collapsed)}.bind(this),C=function(r,n){return _newArrowCheck(this,h),e.visibleGroups.push({type:"r",collapsed:m,from:f.from,to:f.to,col:g,x:x+t,y:r+o,x2:y+t,y2:n+o})}.bind(this),B=f.from<e.frozenRow&&f.to>=e.frozenRow,S=f.from>=e.frozenRow;if(m){var T=w+l;if(f.from>0){var I=f.to+1,M=te[I];if(M)T=M.y;else{if(I=f.from-1,!(M=te[I]))return"continue";T=M.y+M.h-.5*l}if(I>=e.frozenRow)if(T<n+X-s)return"continue"}var R=T+l;a.save(),a.strokeStyle=e.style.groupIndicatorColor,a.fillStyle=e.style.groupIndicatorBackgroundColor,b(T),a.restore(),C(T,R)}var k=void 0,A=te[f.from],E=te[f.to],H=!0,z=!0;for(k=f.from;!A&&k<f.to;)A=te[++k],H=!1;for(k=f.to;!E&&k>f.from;)E=te[--k],z=!1;if(!A||!E)return"continue";var O=E.y+E.h,P=A.y;if(B){var L=te[e.frozenRow-1];if(L){var D=L.y+L.h;i||(D+=l),D>=O&&(O=(E=L).y+E.h,z=!1)}}var F=X+(S?n:0);if(O+(i?0:l)<F)return"continue";O-=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),O>=P?(W.push(v,P,v,O),z&&W.push(y,O)):O=P,b(P-=l),O+=s-1):(P<F&&(P=F),0===f.from&&(P-=2*s),z&&(f.to===e.frozenRow-1&&(O-=l),b(O)),P>O?P=O:(0===f.from&&(H=!0,P=w+l),H&&W.push(y,P),W.push(v,P,v,O),P-=s+1),z&&(O+=l)),d(W),a.restore(),C(P,O)},h=0;h<p.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,(j={}).perf=(t.reduce((function(e,t){return e+t}),0)/Math.min(r,t.length)).toFixed(1),j.perfDelta=t[0].toFixed(1),j.frozenColumnsWidth=b(),j.htmlImages=Object.keys(e.htmlImageCache).length,j.reorderObject="x: "+(e.reorderObject||{columnIndex:0}).columnIndex+", y: "+(e.reorderObject||{rowIndex:0}).rowIndex,j.reorderTarget="x: "+(e.reorderTarget||{columnIndex:0}).columnIndex+", y: "+(e.reorderTarget||{rowIndex:0}).rowIndex,j.scale=e.scale,j.startScale=e.startScale,j.scaleDelta=e.scaleDelta,j.zoomDeltaStart=e.zoomDeltaStart,j.touchLength=e.touchLength,j.touches="y0: "+(e.touchPosition||{y:0}).y+" y1: "+(e.touchPosition1||{y:0}).y,j.scrollBox=e.scrollBox.toString(),j.scrollIndex="x: "+e.scrollIndexLeft+", y: "+e.scrollIndexTop,j.scrollPixel="x: "+e.scrollPixelLeft+", y: "+e.scrollPixelTop,j.canvasOffset="x: "+e.canvasOffsetLeft+", y: "+e.canvasOffsetTop,j.touchDelta="x: "+e.touchDelta.x+", y: "+e.touchDelta.y,j.touchAnimateTo="x: "+e.touchAnimateTo.x+", y: "+e.touchAnimateTo.y,j.scrollAnimation="x: "+e.scrollAnimation.x+", y: "+e.scrollAnimation.y,j.touchPPS="x: "+e.xPPS+", y: "+e.yPPS,j.touchPPST="x: "+e.xPPST+", y: "+e.yPPST,j.touchDuration=e.touchDuration,j.pointerLockPosition=e.pointerLockPosition?e.pointerLockPosition.x+", "+e.pointerLockPosition.y:"",j.size="w: "+e.width+", h: "+e.height,j.mouse="x: "+e.mouse.x+", y: "+e.mouse.y,j.touch=e.touchStart?"x: "+e.touchStart.x+", y: "+e.touchStart.y:"",j.entities=e.visibleCells.length,j.hasFocus=e.hasFocus,j.dragMode=e.dragMode,e.currentCell&&(j.columnIndex=e.currentCell.columnIndex,j.rowIndex=e.currentCell.rowIndex,j.sortColumnIndex=e.currentCell.sortColumnIndex,j.sortRowIndex=e.currentCell.sortRowIndex,j.context=e.currentCell.context,j.dragContext=e.currentCell.dragContext,j.style=e.currentCell.style,j.type=e.currentCell.type),e.ctx.textAlign="right",e.ctx.fillStyle=e.style.debugBackgroundColor,g(0,0,e.width,e.height),Object.keys(j).forEach((function(t,o){var r=t+": "+j[t];e.ctx.fillStyle=e.style.debugColor,m(r,O-20,(e.attributes.showPerformance?140:24)+14*o)})),e.ctx.restore()):e.ctx.restore(),function(){if(e.attributes.showPerformance){var o=e.width-250-e.style.scrollBarWidth-2*e.style.scrollBarBorderWidth,r=X;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,g(o,r,250,100),[["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),c.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 c(t,n,l,i,a,s,c){var d;!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()}(250,100,o,r,n,l,i,a,s),e.ctx.fillStyle=a,g(3+o,r+9+11*c,8,8),e.ctx.fillStyle=e.style.debugPerfChartTextColor,d=void 0!==l?n[0][l]:n[0],m(t+" "+(isNaN(d)?0:d).toFixed(3),14+o,r+16+11*c)}}(),e.dispatchEvent("afterdraw",{})||e.ctx.restore()}function ae(e){var t=this;return ne.findIndex(function(o){return _newArrowCheck(this,t),e>=o.from&&e<=o.to}.bind(this))>=0}function se(t,o,r,n){n=n||{x:0,y:0},t.selectionBorder="",!t.isRowHeader&&e.selections[t.rowIndex+-n.y]&&-1!==e.selections[t.rowIndex+-n.y].indexOf(t.columnIndex+-n.x)&&(e.selections[t.rowIndex-1-n.y]&&-1!==e.selections[t.rowIndex-1-n.y].indexOf(t.columnIndex+-n.x)&&0!==t.rowIndex||t.isHeader||(o.push([t,"t"]),t[r+"BorderTop"]=!0,t[r+"Border"]+="t"),e.selections[t.rowIndex+1+-n.y]&&-1!==e.selections[t.rowIndex+1+-n.y].indexOf(t.columnIndex+-n.x)||(o.push([t,"b"]),t[r+"BorderBottom"]=!0,t[r+"Border"]+="b"),e.selections[t.rowIndex+-n.y]&&0!==t.columnIndex&&-1!==e.selections[t.rowIndex+-n.y].indexOf(t.columnIndex-1-n.x)||(o.push([t,"l"]),t[r+"BorderLeft"]=!0,t[r+"Border"]+="l"),e.selections[t.rowIndex+-n.y]&&t.columnIndex!==P.length&&-1!==e.selections[t.rowIndex+-n.y].indexOf(t.columnIndex+1+-n.x)||(o.push([t,"r"]),t[r+"BorderRight"]=!0,t[r+"Border"]+="r"))}function ce(t,o,r){return function(n,l,i){var a=this;if(n.hidden)return 0;var s,d,u,x=n.style||"cell",v=/HeaderCell/.test(x),y=/cornerCell/.test(x),w="rowHeaderCell"===x,b="columnHeaderCell"===x,B=e.filterable.rows.includes(r)&&e.filterable.columns.includes(l),I="nowrap"!==e.style.cellWhiteSpace,k=e.selections[o]&&-1!==e.selections[o].indexOf(i),H=e.hovers.rowIndex===o&&("row"===e.attributes.hoverMode||e.hovers.columnIndex===i),z=e.selectedFilterButton.rowIndex==r&&e.selectedFilterButton.columnIndex==l,P=e.activeCell.rowIndex===o&&e.activeCell.columnIndex===i,L="columnHeaderCellCap"===x,D=t?t[n.name]:void 0,W="canvas-datagrid"===n.type,N=!(e.orders.rows[e.activeCell.rowIndex]!==o&&e.orders.columns[e.activeCell.columnIndex]!==l||-1!==i&&-1!==o)&&(w?"activeRowHeaderCell":"activeColumnHeaderCell"),G=e.formatters[n.type||"string"],j=0,V=0,q=e.sizes.columns[l]||n.width,Y={value:D,row:t,header:n};if(L&&(q=O-E),void 0===q&&(q=e.style.cellWidth),q*=e.scale,E+q+e.style.cellBorderWidth<0&&(E+=q+e.style.cellBorderWidth),P&&"cornerCell"!==x&&(x="activeCell"),-1!==e.visibleRows.indexOf(r)||v||e.visibleRows.push(r),u=e.dispatchEvent("formatcellvalue",Y),S=E,T=A,"cornerCell"===x?(S=0,T=0):w?S=0:v&&(T=0),(d={type:W?"canvas-datagrid-cell":n.type,style:x,nodeType:"canvas-datagrid-cell",x:S,y:T,fontHeight:(e.style[x+"FontHeight"]||0)*e.scale,horizontalAlignment:e.style[x+"HorizontalAlignment"],verticalAlignment:e.style[x+"VerticalAlignment"],paddingLeft:(e.style[x+"PaddingLeft"]||0)*e.scale,paddingTop:(e.style[x+"PaddingTop"]||0)*e.scale,paddingRight:(e.style[x+"PaddingRight"]||0)*e.scale,paddingBottom:(e.style[x+"PaddingBottom"]||0)*e.scale,whiteSpace:e.style.cellWhiteSpace,lineHeight:e.style.cellLineHeight,lineSpacing:e.style.cellLineSpacing,offsetTop:e.canvasOffsetTop+T,offsetLeft:e.canvasOffsetLeft+S,scrollTop:e.scrollBox.scrollTop,scrollLeft:e.scrollBox.scrollLeft,active:P||N,hovered:H,selected:k,width:q,height:ie,offsetWidth:q,offsetHeight:ie,parentNode:e.intf.parentNode,offsetParent:e.intf.parentNode,data:t,isCorner:y,isHeader:v,isColumnHeader:b,isColumnHeaderCellCap:L,isRowHeader:w,isFilterable:B,openedFilter:z,rowOpen:M,header:n,columnIndex:i,rowIndex:o,viewRowIndex:o,viewColumnIndex:i,boundRowIndex:e.getBoundRowIndexFromViewRowIndex(o),boundColumnIndex:e.getBoundColumnIndexFromViewColumnIndex(i),sortColumnIndex:l,sortRowIndex:r,isGrid:W,isNormal:!W&&!y&&!v,gridId:(e.attributes.name||"")+r+":"+l,parentGrid:e.intf,innerHTML:"",activeHeader:N,value:v&&!w?n.title||n.name:D,isRowTree:o>=0&&i==e.cellTree.rowTreeColIndex&&e.cellTree.rows.length>0&&e.cellTree.rows[o].icon,isColumnTree:i>=0&&e.cellTree.columns[o]&&e.cellTree.columns[o][i].icon}).calculatedLineHeight=d.fontHeight*d.lineHeight+d.lineSpacing,d.paddedWidth=d.width-d.paddingRight-d.paddingLeft,d.paddedHeight=d.height-d.paddingTop-d.paddingBottom,Y.cell=d,d.userHeight=d.isHeader?e.sizes.rows[-1]:R,d.userWidth=d.isHeader?e.sizes.columns.cornerCell:e.sizes.columns[l],e.visibleCells.unshift(d),function(e){var t=e.boundRowIndex;if(t>=-1==0){if(-1!==e.rowIndex)return;t=-1}te[t]||(te[t]={y:e.y,h:e.height})}(d),function(e){var t=e.columnIndex;re[t]||(re[t]={x:e.x,w:e.width})}(d),!e.dispatchEvent("beforerendercell",Y)){if(e.ctx.fillStyle=e.style[x+"BackgroundColor"],e.ctx.strokeStyle=e.style[x+"BorderColor"],e.ctx.lineWidth=e.style[x+"BorderWidth"],H&&(e.ctx.fillStyle=e.style[x+"HoverBackgroundColor"],e.ctx.strokeStyle=e.style[x+"HoverBorderColor"]),k&&(e.ctx.fillStyle=e.style[x+"SelectedBackgroundColor"],e.ctx.strokeStyle=e.style[x+"SelectedBorderColor"]),N&&(e.ctx.fillStyle=e.style[N+"BackgroundColor"]),e.dispatchEvent("rendercell",Y),d.isGrid&&(d.height!==R&&(d.height=R||e.style.cellHeightWithChildGrid,C=!0),d.width=e.sizes.columns[l]||e.style.cellWidthWithChildGrid),M&&!d.isRowHeader&&(d.height=e.sizes.rows[r]||e.style.cellHeight),d.isGrid||(g(S,T,d.width,d.height),p(S,T,d.width,d.height)),e.ctx.save(),f(d.x,d.y,d.width,d.height,0),e.ctx.clip(),e.dispatchEvent("afterrendercell",Y),d.height===ie||M&&!d.isRowHeader||(e.sizes.rows[v?-1:r]=d.height,C=!0),d.width!==q&&(e.sizes.columns[l]=d.width,C=!0),w&&e.attributes.tree&&(e.dispatchEvent("rendertreearrow",Y)||(V=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}(d,e.style[x+"PaddingLeft"],T))),e.attributes.showRowNumbers&&w||!w)if(d.isGrid&&!e.dispatchEvent("beforerendercellgrid",Y)){if(!e.childGrids[d.gridId]){if((s=e.cellGridAttributes).name=e.attributes.saveAppearance?d.gridId:void 0,s.component=!1,s.parentNode=d,s.data=D,Y.cellGridAttributes=s,e.dispatchEvent("beforecreatecellgrid",Y))return;e.childGrids[d.gridId]=e.createGrid(s),e.sizes.rows[r]=e.sizes.rows[r]||e.style.cellGridHeight,C=!0}d.grid=e.childGrids[d.gridId],d.grid.parentNode=d,d.grid.visible=!0,d.grid.draw(),e.dispatchEvent("rendercellgrid",Y)}else if(!d.isGrid&&(e.childGrids[d.gridId]&&(e.childGrids[d.gridId].parentNode.offsetHeight=0),v&&e.orderBy===n.name&&(e.dispatchEvent("renderorderbyarrow",Y)||(j=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}(S+e.style[x+"PaddingLeft"],0))),e.ctx.fillStyle=e.style[x+"Color"],H&&(e.ctx.fillStyle=e.style[x+"HoverColor"]),k&&(e.ctx.fillStyle=e.style[x+"SelectedColor"]),N&&(e.ctx.fillStyle=e.style[N+"Color"]),d.treeArrowWidth=V,d.orderByArrowWidth=j,void 0!==(u=void 0!==u?u:G?G(Y):"")||G||(u="",console.warn("canvas-datagrid: Unknown format "+n.type+" add a cellFormater")),d.formattedValue=(null!=u?u:"").toString(),e.columnFilters&&void 0!==e.columnFilters[u]&&v&&(d.formattedValue=e.attributes.filterTextPrefix+u),e.ctx.font=e.style[x+"FontHeight"]*e.scale+"px "+e.style[x+"FontName"],e.dispatchEvent("formattext",Y)||(d.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,p=e.attributes.ellipsisText,m={width:0,value:""},x=f?t.paddedHeight:t.calculatedLineHeight;for(h.push(m),i=e.ctx.measureText(" "+p).width,n=0;n<d.length;n+=1){var v="-"===(l=d[n])[l.length-1]?"":o,y=e.ctx.measureText(l+v);if(m.width+y.width+i<t.paddedWidth)m.value+=l+v,m.width+=y.width;else if(/\w-\w/.test(l)&&t.paddedWidth<y.width){var w=l.split("-");w=w.map(function(e,t){return _newArrowCheck(this,r),t===w.length-1?e:e+"-"}.bind(this)),d.splice.apply(d,[n,1].concat(_toConsumableArray(w))),n-=1}else{if(m={width:y.width,value:l+v},0===n&&(h=[]).push(m),(u+=t.calculatedLineHeight)>x&&!g){if(0===h.length)break;if((c=h[h.length-1]).width<t.paddedWidth&&1===d.length)break;var b=s=c.value+l;if((a=e.ctx.measureText(s+p).width)>t.paddedWidth)for(var C=parseInt(s.length/2),B=-1;C>0;)s=b.substr(0,C*B+s.length),B=(a=e.ctx.measureText(s+p).width)>t.paddedWidth?-1:1,C=parseInt(C/2);s+=b.length!=s.length?p:"",c.value=s,c.width=a;break}n>0&&h.push(m)}}return{lines:h,width:0,height:t.calculatedLineHeight*h.length}}(d," ")),!e.dispatchEvent("rendertext",Y))){if(d.innerHTML||"html"===n.type)c(d);else{var J=0,X=!0;if(d.columnIndex==e.cellTree.rowTreeColIndex&&!d.isColumnHeader&&e.cellTree.rows.length>0&&Object.keys(e.cellTree.rows[d.rowIndex]).length>1&&(J=h(d,e.cellTree.rows[d.rowIndex],!0)),!d.isRowHeader&&d.rowIndex>0&&e.cellTree.columns[d.rowIndex-1]&&e.cellTree.columns[d.rowIndex-1][d.columnIndex].icon)for(var Q=d.rowIndex-1;Q>=0&&e.cellTree.columns[Q]&&e.cellTree.columns[Q][d.columnIndex].icon;Q--)if(!e.cellTree.columns[Q][d.columnIndex].expand){X=!1;break}X&&!d.isRowHeader&&e.cellTree.columns[d.rowIndex]&&e.cellTree.columns[d.rowIndex][d.columnIndex].icon&&e.viewData.length>0&&e.viewData[d.rowIndex][d.columnIndex].length>0&&(J=h(d,e.cellTree.columns[d.rowIndex][d.columnIndex],!1)),X&&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,m(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,m(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),m(JSON.stringify(t.text.lines.map((function(e){return{w:e.width,v:e.value.length}})),null,"\t"),t.x+14,t.y+30)}))}(d,J)}I&&d.text&&d.text.height>R&&(e.sizes.rows[v?-1:r]=d.text.height,C=!0)}P&&(F=d),se(d,Z,"selection"),function(t){(e.attributes.allowMovingSelection||e.mobile)&&(t.selectionBorderTop&&t.selectionBorderRight&&e.mobile&&(U.push([t,"tr"]),t.selectionHandle="tr"),t.selectionBorderTop&&t.selectionBorderLeft&&e.mobile&&(U.push([t,"tl"]),t.selectionHandle="tl"),t.selectionBorderBottom&&t.selectionBorderLeft&&e.mobile&&(U.push([t,"bl"]),t.selectionHandle="bl"),t.selectionBorderBottom&&t.selectionBorderRight&&("none"!==e.attributes.selectionHandleBehavior||e.mobile)&&(U.push([t,"br"]),t.selectionHandle="br"))}(d),e.movingSelection&&se(d,K,"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);f(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()}(d);var $=e.orderings.columns&&e.orderings.columns.length>0;if(w&&e.attributes.showRowNumbers&&e.attributes.showRowNumberGaps&&!1===$){var ee=e.getBoundRowIndexFromViewRowIndex(o-1),oe=void 0!==ee&&d.boundRowIndex>0&&d.boundRowIndex-ee>1;if(oe&&le.length>0&&(oe=le.find(function(e){return _newArrowCheck(this,a),e.from===ee&&e.to===d.boundRowIndex}.bind(this))>=0),oe){var ne=e.style.rowHeaderCellRowNumberGapHeight,ae=e.style.rowHeaderCellRowNumberGapColor;e.ctx.save(),e.ctx.fillStyle=ae,g(d.x,d.y-ne/2,d.width,ne),e.ctx.restore()}}return E+=d.width+(_?0:e.style.cellBorderWidth),d.width}}}function de(t,o){var r,n,l,i,a=P.length;if(A-2*ie>z)return!1;if(D=V[t],M=e.openChildren[t],l=(e.sizes.rows[t]||e.style.cellHeight)*e.scale,n=(M?e.sizes.trees[t]:0)*e.scale,A<-(R=l+n))return!1;for(e.attributes.showRowHeaders&&(E+=Q),ie=R,i=e.scrollIndexLeft;i<a;i+=1)if(ae(i)||(r=e.orders.columns[i],E+=ce(D,t,o)(P[r],r,i)),E>e.width){e.scrollIndexRight=i,e.scrollPixelRight=E;break}for(E=0,e.attributes.showRowHeaders&&(E+=Q),i=0;i<e.frozenColumn&&(ae(i)||(r=e.orders.columns[i],E+=ce(D,t,o)(P[r],r,i)),!(E>e.width));i+=1);if(e.lastFrozenColumnPixel=E,ie=R,E=-e.scrollBox.scrollLeft+e.scrollPixelLeft+e.style.cellBorderWidth,I=e.childGrids[t],t!==V.length&&M){if(I.visible=!0,I.parentNode={offsetTop:A+l+e.canvasOffsetTop,offsetLeft:Q-1+e.canvasOffsetLeft,offsetHeight:n,offsetWidth:e.width-Q-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:ee,rowGroupsAreaWidth:$},e.intf.parentNode){var s=e.intf.parentNode,c=s.columnGroupsAreaHeight,d=s.rowGroupsAreaWidth;I.parentNode.columnGroupsAreaHeight+=c||0,I.parentNode.rowGroupsAreaWidth+=d||0}e.visibleCells.unshift({rowIndex:t,columnIndex:0,y:I.parentNode.offsetTop,x:I.parentNode.offsetLeft,height:I.height,width:I.width,style:"tree-grid",type:I.parentNode.nodeType}),I.draw()}else I&&(I.parentNode.offsetHeight=0,delete e.sizes.trees[t]);return q.push([D,t,o,A,R]),e.visibleRowHeights[t]=R,A+=ie+(_?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,"&lt;").replace(/>/g,"&gt;")},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.resize=function(t){var o=this;if(e.canvas){var r,n,l={x:0,y:0,height:0,width:0,style:"vertical-scroll-bar"},i={x:0,y:0,height:0,width:0,style:"horizontal-scroll-bar"},a={x:0,y:0,height:0,width:0,style:"vertical-scroll-box"},s={x:0,y:0,height:0,width:0,style:"horizontal-scroll-box"},c={x:0,y:0,height:0,width:0,isCorner:!0,isScrollBoxCorner:!0,style:"scroll-box-corner"},d=2*e.style.scrollBarBoxMargin,u=2*e.style.scrollBarBorderWidth,h=.5*e.style.scrollBarBoxMargin,f=e.style.scrollBarWidth+2*e.style.scrollBarBorderWidth,g=e.getRatio(),p="collapse"===e.style.gridBorderCollapse?1:2,m=e.style.cellBorderWidth*p,x=e.style.columnHeaderCellBorderWidth*p,v=0,y=0,w=(e.viewData||[]).length,b=e.getColumnHeaderCellHeight(),C=e.getRowHeaderCellWidth(),B=e.getColumnGroupAreaHeight(),S=e.getRowGroupAreaWidth(),T=e.style.cellHeight,I=e.getSchema();for(e.scrollCache.x=[],e.scrollCache.y=[],r=0;r<w;r+=1)e.scrollCache.y[r]=v,v+=((e.sizes.rows[r]||T)+(e.sizes.trees[r]||0))*e.scale+(e.frozenRow>r&&e.sizes.trees[r]||0);w>1&&(e.scrollCache.y[r]=v);var M=e.getCollapsedColumnGroups(),R=function(e){var t=this;return _newArrowCheck(this,o),M.findIndex(function(o){return _newArrowCheck(this,t),e>=o.from&&e<=o.to}.bind(this))>=0}.bind(this),k=0;return y=I.reduce((function(t,o,r){var n=e.orders.columns[r],l=e.getColumnWidth(n);return I[n].hidden||R(r)||(t+=l),r<e.frozenColumn?(e.scrollCache.x[r]=t,k=t):e.scrollCache.x[r]=Math.max(k+l,t),t}),0)||0,e.attributes.showNewRow&&(v+=T),e.attributes.snapToRow&&(v+=e.style.cellHeight),H(),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=b+B+x,e.scrollBox.left=C+S,E(),A(),e.scrollBox.horizontalBarVisible&&("auto"!==e.style.height||e.isChildGrid||(e.height+=f),v+=f,H(),E(),A()),e.scrollBox.verticalBarVisible&&("auto"!==e.style.width||e.isChildGrid||(e.width+=f),y+=f,H(),E(),A()),E(),e.scrollBox.scrollWidth=y-e.scrollBox.width,e.scrollBox.scrollHeight=v-e.scrollBox.height,e.frozenColumn>0?e.scrollBox.widthBoxRatio=(e.scrollBox.width-e.scrollCache.x[e.frozenColumn-1])/y:e.scrollBox.widthBoxRatio=e.scrollBox.width/y,e.scrollBox.scrollBoxWidth=e.scrollBox.width*e.scrollBox.widthBoxRatio-e.style.scrollBarWidth-u-h,e.scrollBox.heightBoxRatio=(e.scrollBox.height-b-B-e.scrollCache.y[e.frozenRow])/v,e.scrollBox.scrollBoxHeight=e.scrollBox.height*e.scrollBox.heightBoxRatio-e.style.scrollBarWidth-u-h,e.scrollBox.scrollBoxWidth=Math.max(e.scrollBox.scrollBoxWidth,e.style.scrollBarBoxMinSize),e.scrollBox.scrollBoxHeight=Math.max(e.scrollBox.scrollBoxHeight,e.style.scrollBarBoxMinSize),i.x+=C,i.y+=e.height-e.style.scrollBarWidth-h-B,i.width=e.width-e.style.scrollBarWidth-C-S-h-d,i.height=e.style.scrollBarWidth+e.style.scrollBarBorderWidth+h,s.y=i.y+e.style.scrollBarBoxMargin,s.width=e.scrollBox.scrollBoxWidth,s.height=e.style.scrollBarBoxWidth,l.x+=e.width-S-e.style.scrollBarWidth-e.style.scrollBarBorderWidth-h,l.y+=b+e.scrollCache.y[e.frozenRow],l.width=e.style.scrollBarWidth+e.style.scrollBarBorderWidth+h,l.height=e.height-b-B-e.style.scrollBarWidth-h-d,a.x=l.x+e.style.scrollBarBoxMargin,a.y+=e.scrollCache.y[e.frozenRow],a.width=e.style.scrollBarBoxWidth,a.height=e.scrollBox.scrollBoxHeight,c.x=i.x+i.width+d,c.y=l.y+l.height+d,c.width=e.style.scrollBarWidth+e.style.scrollBarBorderWidth,c.height=e.style.scrollBarWidth+e.style.scrollBarBorderWidth,e.scrollBox.entities={horizontalBar:i,horizontalBox:s,verticalBar:l,verticalBox:a,corner:c},e.scrollBox.bar={v:l,h:i},e.scrollBox.box={v:a,h:s},e.page=Math.max(1,e.visibleRows.length-3-e.attributes.pageUpDownOverlap),e.isChildGrid||(e.canvas.width=e.width*g,e.canvas.height=e.height*g,e.ctx.scale(g,g)),e.resizeEditInput(),e.scroll(!0),t&&e.draw(!0),e.dispatchEvent("resize",{}),!0}function A(){e.scrollBox.horizontalBarVisible="auto"!==e.style.width&&y>e.scrollBox.width&&"hidden"!==e.style.overflowX||"scroll"===e.style.overflowX,e.scrollBox.horizontalBoxVisible=y>e.scrollBox.width,e.scrollBox.verticalBarVisible="auto"!==e.style.height&&v>e.scrollBox.height&&"hidden"!==e.style.overflowY||"scroll"===e.style.overflowY,e.scrollBox.verticalBoxVisible=v>e.scrollBox.height}function E(){e.scrollBox.width=e.width-C-S,e.scrollBox.height=e.height-b-B}function H(){e.isChildGrid||(n={height:b+B+v+m+1,width:y+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]=n[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){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={NativeEvent:t,cell:u,x:c,y:d},f=e.currentCell;if(clearTimeout(e.scrollTimer),e.isInGrid({x:c,y:d})||(e.hasFocus=!1),!e.dispatchEvent("mousemove",h)){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"]&&(h.cell=f,e.dispatchEvent(t+"mouseout",h),h.cell=u,e.dispatchEvent(t+"mouseover",h))}))),e.currentCell=u,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 g=u.isRowTree?e.cellTree.rows[u.rowIndex].parentCount:0,p=e.style.cellTreeIconWidth*e.scale,m=u.x+u.paddingLeft+e.canvasOffsetLeft+e.style.cellTreeIconMarginLeft+g*(p+u.paddingLeft),x=u.y+e.canvasOffsetTop+e.style.cellTreeIconMarginTop*e.scale;c>=m&&c<=m+p&&d>=x&&d<x+p&&(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)),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("row"!==e.attributes.selectionMode&&-1!==e.dragStartObject.columnIndex||!e.rowBoundaryCrossed){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;if(e.dragAddToSelection||void 0===u.rowIndex){if(e.selections[u.rowIndex]=e.selections[u.rowIndex]||[],-1===e.selections[u.rowIndex].indexOf(u.columnIndex)){e.selections[u.rowIndex].push(u.columnIndex);var v={selections:e.selections,selectedData:e.getSelectedData(),selectedCells:e.getSelectedCells(),selectionBounds:e.getSelectionBounds()};e.dispatchEvent("selectionchanged",v)}}else e.selections[u.rowIndex]&&-1!==e.selections[u.rowIndex].indexOf(u.columnIndex)&&e.selections[u.rowIndex].splice(e.selections[u.rowIndex].indexOf(u.columnIndex),1)}}else e.selectRow(u.rowIndex,a,null,!0);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.selections=[]),-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),-1==l.left&&l.top!==l.bottom&&(e.isMultiRowsSelected=!0);if(e.attributes.autoScrollOnMousemove){var y=i.y>e.attributes.autoScrollMargin,w=i.x>e.attributes.autoScrollMargin;y&&!w?e.autoScrollZone(t,-1,d,a):w&&!y?e.autoScrollZone(t,c,-1,a):w&&y&&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.getColumnGroupAt(i.x,i.y);if(a||(a=e.getRowGroupAt(i.x,i.y)),a&&e.toggleGroup(a))return e.setStorageData(),void e.refresh();if(e.hasFocus){var s=e.getRowGroupAreaWidth(),c=e.getColumnGroupAreaHeight(),d=i.x-s,u=i.y-c;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 h();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 h();if(e.selections[r.rowIndex]=e.selections[r.rowIndex]||[],("row"===e.attributes.selectionMode||"rowHeaderCell"===e.currentCell.style)&&"rowHeaderCell"===e.currentCell.style&&e.attributes.tree&&d>0&&d-e.currentCell.x<e.style.treeArrowWidth+e.style.treeArrowMarginLeft+e.style.treeArrowMarginRight+e.style.treeArrowClickRadius&&u-e.currentCell.y<e.style.treeArrowHeight+e.style.treeArrowMarginTop+e.style.treeArrowClickRadius&&u>0)return void e.toggleTree(r.rowIndex);t.shiftKey&&!l&&(e.selectionBounds=e.getSelectionBounds(),e.selectArea(void 0,!1))}h(),e.draw(!0)}}function h(){var t,o=e.getSelectionBounds();n!==JSON.stringify(o)&&(t={selections:e.selections,selectionBounds:e.getSelectionBounds(),selectedCells:e.getSelectedCells()},Object.defineProperty(t,"selectedData",{get:function(){return e.getSelectedData()}}),e.dispatchEvent("selectionchanged",t))}},e.dragResizeColumn=function(t){var o,r,n;return 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("resizecolumn",{x:r,y:n,draggingItem:e.draggingItem})&&(e.scrollBox.scrollLeft>e.scrollBox.scrollWidth-e.attributes.resizeScrollZone&&"ew-resize"===e.dragMode&&e.resize(!0),"ew-resize"===e.dragMode?(e.sizes.columns["rowHeaderCell"===e.draggingItem.header.style?"cornerCell":e.draggingItem.sortColumnIndex]=r,-1!==["rowHeaderCell","cornerCell"].indexOf(e.draggingItem.header.style)&&e.resize(!0),void e.resizeChildGrids()):"ns-resize"===e.dragMode?(e.draggingItem.rowOpen?e.sizes.trees[e.draggingItem.rowIndex]=n:e.attributes.globalRowResize?e.style.cellHeight=n:e.sizes.rows[e.draggingItem.rowIndex]=n,e.dispatchEvent("resizerow",{row:n}),void e.resizeChildGrids()):void(e.ellipsisCache={}))},e.stopDragResize=function(t){var o=e.getLayerPos(t);if("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)}}e.resize(),document.body.removeEventListener("mousemove",e.dragResizeColumn,!1),document.body.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(),document.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.draggingItem.header.index)||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.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=[],l={"row-reorder":e.orders.rows,"column-reorder":e.orders.columns},i={"row-reorder":"rowIndex","column-reorder":"sortColumnIndex"}[e.dragMode];if(document.body.removeEventListener("mousemove",e.dragReorder,!1),document.body.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=[],s=[];e.selections[0]&&e.selections[0].forEach((function(t){a.push(e.orders.columns[t])}));var c=a.length;l[e.dragMode].splice(o,c),r>o&&(r-=c-1);for(i=0;i<a.length;i++)s.push(r+i),l[e.dragMode].splice(r+i,0,a[i]);e.orders.columns=l[e.dragMode],e.viewData.forEach((function(t,o){e.selections[o]=s}))}else{var d=[];e.selections.forEach((function(t,o){t&&(d.push(t),n.push(e.viewData[o]))})),e.viewData.splice(o,n.length),e.selections=[],r>o&&(r-=n.length-1),e.activeCell.rowIndex=r;for(i=0;i<n.length;i++)e.viewData.splice(r+i,0,n[i]),e.selections[r+i]=d[i]}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){document.body.removeEventListener("mousemove",e.dragMove,!1),document.body.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),r="collapse"===e.style.gridBorderCollapse?1:2,n=e.style.columnHeaderCellBorderWidth*r,l=e.getColumnHeaderCellHeight(),i=e.getRowHeaderCellWidth();if(e.ignoreNextClick=!0,e.freezeMarkerPosition=o,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){e.scrollBox.scrollLeft=0,e.frozenColumn=e.currentCell.columnIndex+1,e.scrollBox.bar.h.x=i+e.scrollCache.x[e.frozenColumn-1],e.scrollBox.box.h.x=i+e.scrollCache.x[e.frozenColumn-1];var s=e.scrollCache.x[e.scrollCache.x.length-1];e.scrollBox.widthBoxRatio=(e.scrollBox.width-e.scrollCache.x[e.frozenColumn-1])/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}(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){if(document.body.removeEventListener("mousemove",e.freezeMove,!1),document.body.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.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);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||"row-reorder"==e.dragMode&&e.isMultiRowsSelected||e.currentCell.hovered&&e.hovers.onFilterButton||(e.selections=[]),!e.dragStartObject.isGrid){if(-1!==e.scrollModes.indexOf(e.dragStartObject.context))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()),document.addEventListener("mousemove",e.scrollGrid,!1),document.addEventListener("mouseup",e.stopScrollGrid,!1),void(e.ignoreNextClick=!0);if("cell"===e.dragMode)return e.selecting=!0,void(("row"===e.attributes.selectionMode||-1===e.dragStartObject.columnIndex)&&e.dragStartObject.rowIndex>-1?e.selectRow(e.dragStartObject.rowIndex,r,null):"row"!==e.attributes.selectionMode&&e.mousemove(t));if(n){if(e.draggingItem=e.dragItem,e.movingSelection=e.selections.concat([]),e.dragging=e.dragStartObject,e.dispatchEvent("beginmove",{NativeEvent:t,cell:e.currentCell}))return;return document.body.addEventListener("mousemove",e.dragMove,!1),document.body.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 document.body.addEventListener("mousemove",e.freezeMove,!1),document.body.addEventListener("mouseup",e.stopFreezeMove,!1),e.mousemove(t)}return i?(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,document.body.addEventListener("mousemove",e.dragResizeColumn,!1),void document.body.addEventListener("mouseup",e.stopDragResize,!1)):-1!==["row-reorder","column-reorder"].indexOf(e.dragMode)?(e.draggingItem=e.dragStartObject,"column-reorder"!==e.dragMode||e.isMultiColumnsSelected(e.currentCell.header.index)?"row-reorder"!==e.dragMode||e.isMultiRowsSelected||e.selectRow(e.dragStartObject.rowIndex,r,null):e.selectColumn(e.currentCell.header.index,r,t.shiftKey),document.body.addEventListener("mousemove",e.dragReorder,!1),void document.body.addEventListener("mouseup",e.stopDragReorder,!1)):void 0}}},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,r=this,n=e.getAdjacentCells(),l=Math.max(e.activeCell.columnIndex,0),i=Math.max(e.activeCell.rowIndex,0),a=t.ctrlKey||t.metaKey,s=e.viewData.length-1,c=e.getSchema().length-1;if(!e.dispatchEvent("keydown",{NativeEvent:t,cell:e.currentCell})&&(e.attributes.keepFocusOnMouseOut||e.hasFocus)){if(isPrintableKeyEvent(t)&&!a)return e.beginEditAt(l,i,t,!0);if(e.attributes.showNewRow&&(s+=1),"Tab"===t.key&&t.preventDefault(),"Escape"===t.key?e.selectNone():a&&"a"===t.key?e.selectAll():["Backspace","Delete"].includes(t.key)?e.deleteSelectedData():"ArrowDown"===t.key?i+=1:"ArrowUp"===t.key?i-=1:"ArrowLeft"===t.key&&!a||t.shiftKey&&"Tab"===t.key?l=n.left:"ArrowRight"===t.key&&!a||!t.shiftKey&&"Tab"===t.key?l=n.right:"PageUp"===t.key?(i-=e.page,t.preventDefault()):"PageDown"===t.key?(i+=e.page,t.preventDefault()):"Home"===t.key||a&&"ArrowUp"===t.key?i=0:"End"===t.key||a&&"ArrowDown"===t.key?i=e.viewData.length-1:a&&"ArrowRight"===t.key?l=n.last:a&&"ArrowLeft"===t.key&&(l=n.first),"Enter"===t.key)return t.preventDefault(),e.beginEditAt(l,i,t);(l<0||Number.isNaN(l))&&(l=n.first),i>s&&(i=s),(i<0||Number.isNaN(i))&&(i=0),l>c&&(l=n.last);var d=["ArrowLeft","ArrowUp","ArrowRight","ArrowDown"].includes(t.key);if(t.shiftKey&&d){var u=e.selections.findIndex(function(e){return _newArrowCheck(this,r),!!e}.bind(this)),h=e.selections[u],f=h[0],g=h[h.length-1],p=0===i,m=i===s,x=0===l,v=l===c;"ArrowUp"===t.key&&(i+1>u&&!p?e.selections.pop():i<u?(e.selections[i]=e.selections[i]||[],e.selections[i].push(l)):p&&0!==e.activeCell.rowIndex&&e.selections.pop()),"ArrowDown"===t.key&&(i>u&&i===e.selections.length?(e.selections[i]=e.selections[i]||[],e.selections[i].push(l)):(i>=u&&!m||m&&e.activeCell.rowIndex!==s)&&delete e.selections[i-1]);var y,w=_createForOfIteratorHelper(e.selections);try{for(w.s();!(y=w.n()).done;){var b=y.value;"ArrowRight"===t.key&&b&&(l>g?b.push(l):(l<=g&&!v||v&&e.activeCell.columnIndex!==c)&&b.shift()),"ArrowLeft"===t.key&&b&&(l<f?b.unshift(l):(l>=f&&!x||x&&0!==e.activeCell.columnIndex)&&b.pop())}}catch(e){w.e(e)}finally{w.f()}e.selectionBounds=e.getSelectionBounds(),e.selectArea(void 0,a),e.draw(!0)}l===e.activeCell.columnIndex&&i===e.activeCell.rowIndex||(e.scrollIntoView(l!==e.activeCell.columnIndex?l:void 0,i===e.activeCell.rowIndex||Number.isNaN(i)?void 0:i),e.setActiveCell(l,i),!t.shiftKey&&e.attributes.selectionFollowsActiveCell&&(a||(e.selections=[]),e.selections[i]=e.selections[i]||[],e.selections[i].push(l),o={selectedData:e.getSelectedData(),selections:e.selections,selectionBounds:e.getSelectionBounds(),selectedCells:e.getSelectedCells()},Object.defineProperty(o,"selectedData",{get:function(){return e.getSelectedData()}}),e.dispatchEvent("selectionchanged",o)),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=o.NativeEvent||o;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;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 i=e.getSchema(),a=parseData(t,o);if(1===a.length&&1===a[0].length){var s=a[0][0].value.map(function(e){return _newArrowCheck(this,l),e.value}.bind(this)).join();e.forEachSelectedCell((function(e,t,o){e[t][o]=s}))}else{for(var c=[],d=0;d<a.length;d++){var u=e.orders.rows[r+d],h=a[d],f=e.viewData[u],g=Object.assign({},f);c[u]=[];for(var p=0;p<h.length;p++){var m=i[n+p];if(m){var x=m.name;null!=(s=h[p].value.map(function(e){return _newArrowCheck(this,l),e.value}.bind(this)).join(""))?(c[u].push(n+p),g[x]=s):g[x]=f[x]}else console.warn("Paste data exceeded grid bounds. Skipping.")}e.originalData[e.boundRowIndexMap.get(u)]=g,e.viewData[u]=g}e.selections=c}var v=[];return e.selections.forEach((function(t,o){void 0!==o&&t.forEach((function(t){v.push([o,t,e.getBoundRowIndexFromViewRowIndex(o),e.getBoundColumnIndexFromViewColumnIndex(t)])}))})),e.dispatchEvent("afterpaste",{cells:v}),a.length},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.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){for(var i=l[0],a=[],s=0,c=e.selections.length;s<c;s++){var d=e.selections[s];if(d){if(void 0===d[0])return;a=[s,d[0]<0?d[1]:d[0]];break}}var u=i.type;i.getAsString((function(t){e.pasteData(t,u,a[0],a[1]),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();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())}}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}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.visibleGroups=[],e.sizes={rows:{},columns:{},trees:{}},e.selections=[],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","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.getSelectedData=function(t){var o=[],r=e.getSchema(),n=e.viewData.length;return 0===n?[]:(e.selections.forEach((function(l,i){l&&i!==n&&(0!==l.length?(o[i]={},l.forEach((function(n){if(-1!==n&&r[n]){var l=e.orders.columns[n];!t&&r[l].hidden||e.viewData[i]&&(o[i][r[l].name]=e.viewData[i][r[l].name])}}))):o[i]=null)})),o)},e.getSelectedCells=function(t){var o=[],r=e.getSchema();if(0===e.viewData.length)return[];var n,l=_createForOfIteratorHelper(e.selections.entries());try{for(l.s();!(n=l.n()).done;){var i=_slicedToArray(n.value,2),a=i[0],s=i[1];if(s&&0!==s.length){var c,d=_createForOfIteratorHelper(s.entries());try{for(d.s();!(c=d.n()).done;){var u=_slicedToArray(c.value,2)[1];if(-1!==u&&r[u]){var h=e.getBoundColumnIndexFromViewColumnIndex(u);if((t||!r[h].hidden)&&e.viewData[a]){var f=r[h],g={value:e.viewData[a][f.name],header:f,boundRowIndex:e.getBoundRowIndexFromViewRowIndex(a),boundColumnIndex:h,viewRowIndex:a,viewColumnIndex:u};o.push(g)}}}}catch(e){d.e(e)}finally{d.f()}}}}catch(e){l.e(e)}finally{l.f()}return o},e.copySelectedCellsToClipboard=function(t){var o,r,n=[],l=e.getSchema(),i=!0,a=_createForOfIteratorHelper(e.selections.entries());try{for(a.s();!(r=a.n()).done;){var s=_slicedToArray(r.value,2),c=s[0],d=s[1];if(d){var u=d.join(",").toString(),h={};o||(o=d.join(",").toString()),i&&u!==o&&(i=!1);var f,g=e.getBoundRowIndexFromViewRowIndex(c),p=_createForOfIteratorHelper(d);try{for(p.s();!(f=p.n()).done;){var m=f.value;if(!(m<0)){var x=l[e.getBoundColumnIndexFromViewColumnIndex(m)].name,v=e.originalData[g][x];h[x]=v}}}catch(e){p.e(e)}finally{p.f()}n.push(h)}}}catch(e){a.e(e)}finally{a.f()}if(n.length>0)for(var y=createTextString(n,i),w={"text/plain":y,"text/html":createHTMLString(n,i),"text/csv":y,"application/json":JSON.stringify(n)},b=0,C=Object.entries(w);b<C.length;b++){var B=_slicedToArray(C[b],2),S=B[0],T=B[1];t.setData(S,T)}},e.clearSelectedCells=function(){var t,o=e.getSchema(),r=[],n=_createForOfIteratorHelper(e.selections.entries());try{for(n.s();!(t=n.n()).done;){var l=_slicedToArray(t.value,2),i=l[0],a=l[1];if(a){var s,c=e.getBoundRowIndexFromViewRowIndex(i),d=_createForOfIteratorHelper(a);try{for(d.s();!(s=d.n()).done;){var u=s.value;if(!(u<0)){var h=e.getBoundColumnIndexFromViewColumnIndex(u),f=o[h].name;e.viewData[c][f]="",r.push([i,u,c,h])}}}catch(e){d.e(e)}finally{d.f()}}}}catch(e){n.e(e)}finally{n.f()}return r},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,p=0;p<g.length;p++){for(var m=g[p],x=0;x<m.length;x++){var v=m[x];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.fitSelectedColumns=function(t){var o,r=e.selections[0],n=e.getSchema(),l=_createForOfIteratorHelper(r);try{for(l.s();!(o=l.n()).done;){var i=o.value;if(i>=0&&e.isColumnSelected(i))if(isNaN(t)){var a=n[e.orders.columns[i]];e.fitColumnToValues(a.name)}else e.sizes.columns[i]=t,e.dispatchEvent("resizecolumn",{x:t,y:e.resizingStartingHeight,draggingItem:e.currentCell})}}catch(e){l.e(e)}finally{l.f()}},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){for(var o=this,r=t.map(function(e,t){return _newArrowCheck(this,o),[e,t]}.bind(this)),n=function(){var t=_slicedToArray(i[l],2),o=t[0],n=t[1],a=e.getHeaderByName(o);if(!a)return"continue";var s=a.filter||e.filter(a.type||"string");r=r.filter((function(t){var r=_slicedToArray(t,2),l=r[0],i=r[1];return!!(e.attributes.allowFreezingRows&&!e.attributes.filterFrozenRows&&i<e.frozenRow)||s(l[o],n)}))},l=0,i=Object.entries(e.columnFilters);l<i.length;l++)n();for(var a=[],s=0;s<e.groupedRows.length;s++)for(var c=e.groupedRows[s],d=0;d<c.length;d++){var u=c[d];u.collapsed&&a.push([u.from,u.to])}if(a.length>0){a.sort(function(e,t){return _newArrowCheck(this,o),e[0]-t[0]}.bind(this));for(var h=0,f=a.length,g=0;g<f;g++){var p=a[g];if(g===f-1){a[h++]=p;break}var m=p[1],x=_slicedToArray(a[g+1],2),v=x[0],y=x[1];v>m+1?a[h++]=p:(a[g+1]=p,y>m&&(a[g+1][1]=y))}for(var w=(a=a.slice(0,h)).shift(),b=0;b<r.length;b++){if(!(r[b][1]<w[0])){for(var C=b+1;C<r.length;C++){if(r[C][1]>w[1])break}if(r.splice(b,C-b),!(w=a.shift()))break;b--}}}var B,S=_createForOfIteratorHelper(e.orderings.columns);try{var T=function(){var t=this,o=B.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(S.s();!(B=S.n()).done;)T()}catch(e){S.e(e)}finally{S.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("mouseup",e.mouseup,!1),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.contextmenu,!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),document.body.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 p=g+1;p<=e.cellTree.origin.columns[h][g].lastchild;p++)e.cellTree.tempSchema[p].hidden=!0;f++}}var m,x={},v=[];for(var y in e.cellTree.rows=[],e.cellTree.columns={},e.cellTree.origin.rows){var w=[],b=e.cellTree.origin.rows[y];if(b.hide){for(var C=0;C<e.cellTree.rowTreeColIndex;C++)w.push(e.viewData[y][C]);x[y]=w,v.push(Array(e.viewData[0].length).fill().map((function(){return""}))),i++}else{var B=[],S=0;if(y<e.cellTree.columnTreeRowStartIndex)l.push(e.originalData[y]);else if(y>e.cellTree.columnTreeRowEndIndex)x[y]=e.viewData[y],i++;else{for(var T=0;T<e.originalData[y].length;T++)e.cellTree.tempSchema[T].hidden?S++:(T<e.cellTree.rowTreeColIndex&&(Object.prototype.hasOwnProperty.call(x,y)||(x[y]=[]),x[y].push(e.viewData[y][T])),w.push(e.originalData[y][T]),Object.prototype.hasOwnProperty.call(e.cellTree.origin.columns,y)&&B.push(e.cellTree.origin.columns[y][T]));w.push.apply(w,_toConsumableArray(Array(S).fill().map((function(){return""})))),B.length&&(B.push.apply(B,_toConsumableArray(Array(S).fill().map(function(){return _newArrowCheck(this,n),{}}.bind(this)))),e.cellTree.columns[y]=B),l.push(w)}e.cellTree.rows.push(b)}}i&&((m=e.cellTree.rows).push.apply(m,_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 I in x)if(I>e.cellTree.columnTreeRowEndIndex)l[I]=x[I];else for(var M in x[I])l[I][M]=x[I][M];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,10)},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.selectRow=e.selectRow,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,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 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,"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 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"),p=[],m=-1,x={};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 w(e){return function(){clearTimeout(o)}}return x.parentGrid=e.intf,x.parentContextMenu=s,x.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(),p.splice(p.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,x),i.setAttribute("contextOpen","1"),i.addEventListener("mouseout",a),h.addEventListener("mouseout",a),p.push(t.contextMenu)}}function c(){var e;"1"!==i.getAttribute("contextOpen")&&(i.setAttribute("opening","1"),"function"!=typeof t.items?s(t.items):void 0!==(e=t.items.apply(x,[function(e){s(e)}]))&&Array.isArray(e)&&s(e))}!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",w()),f.addEventListener("mouseover",y("up")),f.addEventListener("mouseout",w()),v(),x.clickIndex=function(e){a[e].contextItemContainer.dispatchEvent(new Event("click"))},x.rect=c,x.items=a,x.upArrow=f,x.downArrow=g,x.dispose=function(){clearTimeout(o),p.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(x,"selectedIndex",{get:function(){return m},set:function(t){if("number"!=typeof t||isNaN(t||!isFinite(t)))throw new Error("Context menu selected index must be a sane number.");(m=t)>a.length-1&&(m=a.length-1),m<0&&(m=0),a.forEach((function(t,o){if(o===m)return e.createInlineStyle(t.contextItemContainer,"canvas-datagrid-context-menu-item:hover");e.createInlineStyle(t.contextItemContainer,"canvas-datagrid-context-menu-item")}))}}),x}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 p=e.parentGrid&&e.parentGrid.childGrids;if(!p||!Array.isArray(p))return;if(!p.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 m=e.parentNode.offsetLeft,x=e.parentNode.offsetLeft+e.parentNode.offsetWidth,v=e.parentNode.offsetTop,y=e.parentNode.offsetTop+e.parentNode.offsetHeight,w=e.parentNode.parentNode;w;){var b=w,C=b.offsetLeft,B=b.offsetWidth,S=b.offsetTop;C>m&&(m=C),S>v&&(v=S);var T=C+B,I=S+b.offsetHeight;if(T<x&&(x=T),I<y&&(y=I),"canvas-datagrid-tree"!==w.nodeType)break;w=w.parentNode}if(!1==(t.x>=m&&t.x<=x&&t.y>=v&&t.y<=y))return}var M,R=[],k=o||e.getLayerPos(t),A={NativeEvent:t,cell:e.getCellAt(k.x,k.y),pos:k,items:R};A.cell.isGrid||function(t){var o=this,r=!(t.cell.isBackground||t.cell.isColumnHeaderCellCap||t.cell.isScrollBar||t.cell.isCorner||t.cell.isRowHeader)&&t.cell.header;e.attributes.showFilter&&r&&i(t),e.attributes.showCopy&&e.selections.reduce((function(e,t){return e+t.length}),0)>0&&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,t.cell.columnIndex,t.cell.rowIndex),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&&t.items.push({title:e.attributes.hideColumnText.replace(/%s/gi,t.cell.header.title||t.cell.header.name),click:function(o){e.getSchema()[t.cell.columnIndex].hidden=!0,o.preventDefault(),e.stopPropagation(o),e.disposeContextMenu(),e.setStorageData(),setTimeout((function(){e.resize(!0)}),10)}})),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&&r&&(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()}}));var l=e.getColumnGroupAreaHeight(),a=e.getRowGroupAreaWidth(),s=function(t,r){if(_newArrowCheck(this,o),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=r;e.refresh()}}.bind(this);t.pos&&t.pos.y<l&&(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(),s(e.groupedColumns,!1)}}),t.items.push({title:e.attributes.showCollapseAllGroupColumns,click:function(t){t.preventDefault(),s(e.groupedColumns,!0)}})),t.pos&&t.pos.x<a&&(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(),s(e.groupedRows,!1)}}),t.items.push({title:e.attributes.showCollapseAllGroupRows,click:function(t){t.preventDefault(),s(e.groupedRows,!0)}}));var c,d,u=e.attributes.allowGroupingColumns&&t.cell.isColumnHeader&&t.cell.header&&t.cell.header.index>0,h=e.attributes.allowGroupingColumns&&t.cell.isColumnHeader,f=e.attributes.allowGroupingRows&&t.cell.isRowHeader&&t.cell.header,g=e.attributes.allowGroupingRows&&t.cell.isRowHeader,p=function(){var t=this;return _newArrowCheck(this,o),d||(c||(c=e.getSchema()),d=new Map(c.map(function(e){return _newArrowCheck(this,t),[e.columnIndex,e]}.bind(this)))),d}.bind(this);if(u){for(var m=[],x=t.cell.header.index,v=x;v>=0&&e.isColumnSelected(v);v--)m[0]=v;for(v=x;e.isColumnSelected(v);v++)m[1]=v;if(v!==x&&2===m.length&&m[1]>m[0]&&e.isNewGroupRangeValid(e.groupedColumns,m[0],m[1])){for(var y=p(),w=[],b=[],C=0;C<m.length;C++){var B=m[C],S=y.get(B);S&&(b.push(S.name),w.push(S.title||S.name||S.index))}b[0]&&b[1]&&t.items.push({title:e.attributes.showGroupColumns.replace("%s",w[0]+"-"+w[1]),click:function(t){t.preventDefault(),e.groupColumns(b[0],b[1]),e.controlInput.focus()}})}}if(h)for(var T=t.cell.columnIndex,I=e.getGroupsColumnBelongsTo(T),M=p(),R=function(o){var r=I[o],n=r.from,l=r.to,i=M.get(n),a=M.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))},k=0;k<I.length;k++)R(k);if(f){var A=[],E=-2,H=!0;e.selections.forEach((function(e,t){if(H)return E<-1?(E=t,void(A[0]=t)):void(t===E+1&&e&&0!==e.length?(E=t,A[1]=t):H=!1)}));var z=A.map(function(t){_newArrowCheck(this,o);var r=e.getBoundRowIndexFromViewRowIndex(t);return"number"==typeof r?r+1:t+1}.bind(this)).join("-");H&&2===A.length&&e.isNewGroupRangeValid(e.groupedRows,A[0],A[1])&&t.items.push({title:e.attributes.showGroupRows.replace("%s",z),click:function(t){t.preventDefault(),e.groupRows(A[0],A[1])}})}if(g)for(var O=t.cell.rowIndex,P=e.getGroupsRowBelongsTo(O),L=function(o){var r=this,n=P[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()}})},D=0;D<P.length;D++)L(D)}(A),"mousedown"!==t.type&&e.dispatchEvent("contextmenu",A)||A.cell.isGrid||(e.contextMenu&&e.disposeContextMenu(),M={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&&(M.left=e.style.mobileContextMenuMargin+"px",M.width=e.width-2*e.style.mobileContextMenuMargin+"px"),"mousedown"==t.type&&(M.top+=e.style.filterButtonMenuOffsetTop),e.contextMenu=l(A,M,R),"mousedown"==t.type?document.addEventListener("mouseup",E):E(),t.preventDefault())}function E(){requestAnimationFrame((function(){document.addEventListener("click",e.disposeContextMenu),document.removeEventListener("mouseup",E)}))}}}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),h=u||n;e.input.value=h?"":d.value,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)}})),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]}))},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("mouseup",e.mouseup,!1),e.eventParent.addEventListener("mousedown",e.mousedown,!1),e.eventParent.addEventListener("dblclick",e.dblclick,!1),e.eventParent.addEventListener("click",e.click,!1),document.body.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)}}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){t<0&&(t=0),o<0&&(o=0),e.activeCell={rowIndex:o,columnIndex:t}},e.selectNone=function(t){e.selections=[],e.dispatchEvent("selectionchanged",{selectedData:e.getSelectedData(),selections:e.selections,selectionBounds:e.selectionBounds,selectedCells:e.getSelectedCells()}),t||e.draw()},e.selectAll=function(t){e.selectArea({top:0,left:-1,right:e.getSchema().length-1,bottom:e.viewData.length-1}),t||e.draw()},e.isMultiColumnsSelected=function(t){var o=!0;return e.viewData.forEach((function(r,n){var l=e.selections[n];if(!l||l.length<=1||-1===l.indexOf(t))o=!1;else if(l.length>1)if(l[0]!=t)o=!1;else for(var i=0;i<l.length-1;i++)if(l[i]+1!=l[i+1]){o=!1;break}})),o},e.isColumnSelected=function(t){var o=!0;return e.viewData.forEach((function(r,n){e.selections[n]&&-1!==e.selections[n].indexOf(t)||(o=!1)})),o},e.forEachSelectedCell=function(t,o){var r=[],n=o?e.getSchema():e.getVisibleSchema(),l=e.viewData.length;e.selections.forEach((function(o,i){i!==l&&(0!==o.length?(r[i]={},o.forEach((function(o){-1!==o&&n[o]&&t(e.viewData,i,n[o].name)}))):r[i]=null)}))},e.selectColumn=function(t,o,r,n){var l,i,a,s;function c(t){e.viewData.forEach((function(o,r){e.selections[r]=e.selections[r]||[],-1===e.selections[r].indexOf(t)&&e.selections[r].push(t)}))}if(r){if(!e.activeCell)return;for(l=Math.min(e.activeCell.columnIndex,t),i=Math.max(e.activeCell.columnIndex,t),a=l;i>a;a+=1)c(a)}o||r||(e.selections=[],e.activeCell.columnIndex=t,e.activeCell.rowIndex=e.scrollIndexTop),o&&e.isColumnSelected(t)?(s=t,e.viewData.forEach((function(t,o){e.selections[o]=e.selections[o]||[],-1!==e.selections[o].indexOf(s)&&e.selections[o].splice(e.selections[o].indexOf(s),1)}))):c(t),n||e.dispatchEvent("selectionchanged",{selectedData:e.getSelectedData(),selections:e.selections,selectionBounds:e.getSelectionBounds(),selectedCells:e.getSelectedCells()})},e.selectRow=function(t,o,r,n){var l,i,a,s=e.getVisibleSchema();function c(){n||e.dispatchEvent("selectionchanged",{selectedData:e.getSelectedData(),selections:e.selections,selectionBounds:e.selectionBounds,selectedCells:e.getSelectedCells()})}function d(t){e.selections[t]=[],e.selections[t].push(-1),s.forEach((function(o,r){e.selections[t].push(e.orders.columns.indexOf(o.index))}))}if(e.isMultiRowsSelected=!1,(!1===e.dragAddToSelection||void 0===e.dragObject)&&e.selections[t]&&e.selections[t].length-1===s.length&&o)return e.selections[t]=[],void c();if(!0===e.dragAddToSelection||void 0===e.dragObject)if(r&&void 0===e.dragObject){if(!e.activeCell)return;for(i=Math.min(e.activeCell.rowIndex,t),a=Math.max(e.activeCell.rowIndex,t),l=i;a>=l;l+=1)d(l)}else d(t);c()},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.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){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()}},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.moveSelection=function(t,o){var r=[];e.selections.forEach((function(e,n){r[n+o]=[],e.forEach((function(e){r[n+o].push(e+t)}))})),e.selections=r},e.deleteSelectedData=function(t){var o=this,r=e.clearSelectedCells();e.dispatchEvent("afterdelete",{cells:r}),t||requestAnimationFrame(function(){return _newArrowCheck(this,o),e.draw()}.bind(this))},e.moveTo=function(t,o,r){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.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();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))return s.dragContext=s.style,s.context="row-resize",s;if(/frozen-column-marker/.test(s.style))return s.dragContext=s.style,s.context="col-resize",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?(s.context="cell",s.dragContext="column-reorder",s):"rowHeaderCell"===s.style?(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.getSelectionBounds=function(){var t={x:1/0,y:1/0},o={x:-1/0,y:-1/0};return e.selections.forEach((function(e,r){var n,l;t.y=r<t.y?r:t.y,o.y=r>o.y?r:o.y,n=Math.max.apply(null,e),l=Math.min.apply(null,e),t.x=l<t.x?l:t.x,o.x=n>o.x?n:o.x})),{top:t.y,left:t.x,bottom:o.y,right:o.x}},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.selectArea=function(t,o){e.selectionBounds=t||e.selectionBounds;var r,n,l,i=e.getSchema();if(o||(e.selections=[]),e.selectionBounds.top<-1||e.selectionBounds.bottom>e.viewData.length||e.selectionBounds.left<-1||e.selectionBounds.right>i.length)throw new Error("Impossible selection area");for(n=e.selectionBounds.top;n<=e.selectionBounds.bottom;n+=1)for(e.selections[n]=[],l=e.selectionBounds.left;l<=e.selectionBounds.right;l+=1)-1===e.selections[n].indexOf(l)&&e.selections[n].push(l);r={selections:e.selections,selectionBounds:e.selectionBounds,selectedCells:e.getSelectedCells()},Object.defineProperty(r,"selectedData",{get:function(){return e.getSelectedData()}}),e.dispatchEvent("selectionchanged",r)},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.headerCellPaddingRight+e.style.headerCellPaddingLeft;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,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","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