text: /*! For license information please see 8921.7a197b64ad40a4f01276.js.LICENSE.txt */
  "use strict";(self.webpackChunk_JUPYTERLAB_CORE_OUTPUT=self.webpackChunk_JUPYTERLAB_CORE_OUTPUT||[]).push([[8921],{28921:(t,e,i)=>{i.r(e),i.d(e,{BasicKeyHandler:()=>u,BasicMouseHandler:()=>d,BasicSelectionModel:()=>v,BooleanCellEditor:()=>P,CellEditor:()=>H,CellRenderer:()=>g,DataGrid:()=>q,DataModel:()=>W,DateCellEditor:()=>L,DynamicOptionCellEditor:()=>B,GraphicsContext:()=>I,InputCellEditor:()=>R,IntegerCellEditor:()=>k,IntegerInputValidator:()=>M,JSONModel:()=>J,MutableDataModel:()=>T,NumberCellEditor:()=>E,NumberInputValidator:()=>O,OptionCellEditor:()=>D,PassInputValidator:()=>x,Private:()=>o,RendererMap:()=>Y,SelectionModel:()=>y,TextCellEditor:()=>z,TextInputValidator:()=>C,TextRenderer:()=>A});var o,n=i(33513),r=i(34938),s=i(43800),a=i(62867),l=i(75138),h=i(61389),c=i(32151),u=function(){function t(){this._disposed=!1}return Object.defineProperty(t.prototype,"isDisposed",{get:function(){return this._disposed},enumerable:!0,configurable:!0}),t.prototype.dispose=function(){this._disposed=!0},t.prototype.onKeyDown=function(t,e){if(t.editable&&-1!==t.selectionModel.cursorRow&&-1!==t.selectionModel.cursorColumn){var i=String.fromCharCode(e.keyCode);if(/[a-zA-Z0-9-_ ]/.test(i)){var o={grid:t,row:t.selectionModel.cursorRow,column:t.selectionModel.cursorColumn};return t.editorController.edit(o),void("Space"===(0,r.Vc)().keyForKeydownEvent(e)&&(e.stopPropagation(),e.preventDefault()))}}switch((0,r.Vc)().keyForKeydownEvent(e)){case"ArrowLeft":this.onArrowLeft(t,e);break;case"ArrowRight":this.onArrowRight(t,e);break;case"ArrowUp":this.onArrowUp(t,e);break;case"ArrowDown":this.onArrowDown(t,e);break;case"PageUp":this.onPageUp(t,e);break;case"PageDown":this.onPageDown(t,e);break;case"Escape":this.onEscape(t,e);break;case"Delete":this.onDelete(t,e);break;case"C":this.onKeyC(t,e);break;case"Enter":t.selectionModel&&(t.moveCursor(e.shiftKey?"up":"down"),t.scrollToCursor());break;case"Tab":t.selectionModel&&(t.moveCursor(e.shiftKey?"left":"right"),t.scrollToCursor(),e.stopPropagation(),e.preventDefault())}},t.prototype.onArrowLeft=function(t,e){e.preventDefault(),e.stopPropagation();var i=t.selectionModel,o=e.shiftKey,r=n.Platform.accelKey(e);if(i||!r)if(i){var s=i.selectionMode;if("row"===s&&r)t.scrollTo(0,t.scrollY);else if("row"!==s){var a,l,h,c,u,d,p,f=i.cursorRow,_=i.cursorColumn,m=i.currentSelection();r&&o?(a=m?m.r1:0,l=m?m.r2:0,h=m?m.c1:0,c=0,u=f,d=_,p="current"):o?(a=m?m.r1:0,l=m?m.r2:0,h=m?m.c1:0,c=m?m.c2-1:0,u=f,d=_,p="current"):r?(l=f,c=0,u=a=f,d=h=0,p="all"):(l=f,c=_-1,u=a=f,d=h=_-1,p="all"),i.select({r1:a,c1:h,r2:l,c2:c,cursorRow:u,cursorColumn:d,clear:p}),(m=i.currentSelection())&&(o||"column"===s?t.scrollToColumn(m.c2):t.scrollToCursor())}else t.scrollByStep("left")}else t.scrollByStep("left");else t.scrollTo(0,t.scrollY)},t.prototype.onArrowRight=function(t,e){e.preventDefault(),e.stopPropagation();var i=t.selectionModel,o=e.shiftKey,r=n.Platform.accelKey(e);if(i||!r)if(i){var s=i.selectionMode;if("row"===s&&r)t.scrollTo(t.maxScrollX,t.scrollY);else if("row"!==s){var a,l,h,c,u,d,p,f=i.cursorRow,_=i.cursorColumn,m=i.currentSelection();r&&o?(a=m?m.r1:0,l=m?m.r2:0,h=m?m.c1:0,c=1/0,u=f,d=_,p="current"):o?(a=m?m.r1:0,l=m?m.r2:0,h=m?m.c1:0,c=m?m.c2+1:0,u=f,d=_,p="current"):r?(l=f,c=1/0,u=a=f,d=h=1/0,p="all"):(l=f,c=_+1,u=a=f,d=h=_+1,p="all"),i.select({r1:a,c1:h,r2:l,c2:c,cursorRow:u,cursorColumn:d,clear:p}),(m=i.currentSelection())&&(o||"column"===s?t.scrollToColumn(m.c2):t.scrollToCursor())}else t.scrollByStep("right")}else t.scrollByStep("right");else t.scrollTo(t.maxScrollX,t.scrollY)},t.prototype.onArrowUp=function(t,e){e.preventDefault(),e.stopPropagation();var i=t.selectionModel,o=e.shiftKey,r=n.Platform.accelKey(e);if(i||!r)if(i){var s=i.selectionMode;if("column"===s&&r)t.scrollTo(t.scrollX,0);else if("column"!==s){var a,l,h,c,u,d,p,f=i.cursorRow,_=i.cursorColumn,m=i.currentSelection();r&&o?(a=m?m.r1:0,l=0,h=m?m.c1:0,c=m?m.c2:0,u=f,d=_,p="current"):o?(a=m?m.r1:0,l=m?m.r2-1:0,h=m?m.c1:0,c=m?m.c2:0,u=f,d=_,p="current"):r?(l=0,c=_,u=a=0,d=h=_,p="all"):(l=f-1,c=_,u=a=f-1,d=h=_,p="all"),i.select({r1:a,c1:h,r2:l,c2:c,cursorRow:u,cursorColumn:d,clear:p}),(m=i.currentSelection())&&(o||"row"===s?t.scrollToRow(m.r2):t.scrollToCursor())}else t.scrollByStep("up")}else t.scrollByStep("up");else t.scrollTo(t.scrollX,0)},t.prototype.onArrowDown=function(t,e){e.preventDefault(),e.stopPropagation();var i=t.selectionModel,o=e.shiftKey,r=n.Platform.accelKey(e);if(i||!r)if(i){var s=i.selectionMode;if("column"===s&&r)t.scrollTo(t.scrollX,t.maxScrollY);else if("column"!==s){var a,l,h,c,u,d,p,f=i.cursorRow,_=i.cursorColumn,m=i.currentSelection();r&&o?(a=m?m.r1:0,l=1/0,h=m?m.c1:0,c=m?m.c2:0,u=f,d=_,p="current"):o?(a=m?m.r1:0,l=m?m.r2+1:0,h=m?m.c1:0,c=m?m.c2:0,u=f,d=_,p="current"):r?(l=1/0,c=_,u=a=1/0,d=h=_,p="all"):(l=f+1,c=_,u=a=f+1,d=h=_,p="all"),i.select({r1:a,c1:h,r2:l,c2:c,cursorRow:u,cursorColumn:d,clear:p}),(m=i.currentSelection())&&(o||"row"===s?t.scrollToRow(m.r2):t.scrollToCursor())}else t.scrollByStep("down")}else t.scrollByStep("down");else t.scrollTo(t.scrollX,t.maxScrollY)},t.prototype.onPageUp=function(t,e){if(!n.Platform.accelKey(e)){e.preventDefault(),e.stopPropagation();var i=t.selectionModel;if(i&&"column"!==i.selectionMode){var o,r,s,a,l,h,c,u=Math.floor(t.pageHeight/t.defaultSizes.rowHeight),d=i.cursorRow,p=i.cursorColumn,f=i.currentSelection();e.shiftKey?(o=f?f.r1:0,r=f?f.r2-u:0,s=f?f.c1:0,a=f?f.c2:0,l=d,h=p,c="current"):(r=o=f?f.r1-u:0,s=p,a=p,l=o,h=p,c="all"),i.select({r1:o,c1:s,r2:r,c2:a,cursorRow:l,cursorColumn:h,clear:c}),(f=i.currentSelection())&&t.scrollToRow(f.r2)}else t.scrollByPage("up")}},t.prototype.onPageDown=function(t,e){if(!n.Platform.accelKey(e)){e.preventDefault(),e.stopPropagation();var i=t.selectionModel;if(i&&"column"!==i.selectionMode){var o,r,s,a,l,h,c,u=Math.floor(t.pageHeight/t.defaultSizes.rowHeight),d=i.cursorRow,p=i.cursorColumn,f=i.currentSelection();e.shiftKey?(o=f?f.r1:0,r=f?f.r2+u:0,s=f?f.c1:0,a=f?f.c2:0,l=d,h=p,c="current"):(r=o=f?f.r1+u:0,s=p,a=p,l=o,h=p,c="all"),i.select({r1:o,c1:s,r2:r,c2:a,cursorRow:l,cursorColumn:h,clear:c}),(f=i.currentSelection())&&t.scrollToRow(f.r2)}else t.scrollByPage("down")}},t.prototype.onEscape=function(t,e){t.selectionModel&&t.selectionModel.clear()},t.prototype.onDelete=function(t,e){if(t.editable&&!t.selectionModel.isEmpty)for(var i=t.dataModel,o=i.rowCount("body")-1,n=i.columnCount("body")-1,r=t.selectionModel.selections(),s=void 0;void 0!==(s=r.next());)for(var a=Math.max(0,Math.min(s.r1,o)),l=Math.max(0,Math.min(s.c1,n)),h=Math.max(0,Math.min(s.r2,o)),c=Math.max(0,Math.min(s.c2,n)),u=a;u<=h;++u)for(var d=l;d<=c;++d)i.setData("body",u,d,null)},t.prototype.onKeyC=function(t,e){!e.shiftKey&&n.Platform.accelKey(e)&&(e.preventDefault(),e.stopPropagation(),t.copyToClipboard())},t}(),d=function(){function t(){this._disposed=!1,this._pressData=null}return t.prototype.dispose=function(){this._disposed||(this.release(),this._disposed=!0)},Object.defineProperty(t.prototype,"isDisposed",{get:function(){return this._disposed},enumerable:!0,configurable:!0}),t.prototype.release=function(){this._pressData&&("select"===this._pressData.type&&(this._pressData.timeout=-1),this._pressData.override.dispose(),this._pressData=null)},t.prototype.onMouseHover=function(t,e){var i=t.hitTest(e.clientX,e.clientY),n=o.resizeHandleForHitTest(i),r=this.cursorForHandle(n);t.viewport.node.style.cursor=r},t.prototype.onMouseLeave=function(t,e){t.viewport.node.style.cursor=""},t.prototype.onMouseDown=function(t,e){var i=e.clientX,r=e.clientY,a=t.hitTest(i,r),l=a.region,h=a.row,c=a.column;if("void"!==l){var u=e.shiftKey,d=n.Platform.accelKey(e);if("body"===l){var p=t.selectionModel;if(!p)return;var f,_,m,y,v,g,w,b=s.Drag.overrideCursor("default");return this._pressData={type:"select",region:l,row:h,column:c,override:b,localX:-1,localY:-1,timeout:-1},d?(f=h,m=h,_=c,y=c,v=h,g=c,w="none"):u?(f=p.cursorRow,m=h,_=p.cursorColumn,y=c,v=p.cursorRow,g=p.cursorColumn,w="current"):(f=h,m=h,_=c,y=c,v=h,g=c,w="all"),p.selectionMode="cell",void p.select({r1:f,c1:_,r2:m,c2:y,cursorRow:v,cursorColumn:g,clear:w})}var S=o.resizeHandleForHitTest(a),x=this.cursorForHandle(S);if("left"!==S&&"right"!==S)if("top"!==S&&"bottom"!==S){var C=t.selectionModel;if(C){var M,O,H,R,z,E,k,L=s.Drag.overrideCursor("default");switch(this._pressData={type:"select",region:l,row:h,column:c,override:L,localX:-1,localY:-1,timeout:-1},"corner-header"===l?(M=0,H=1/0,O=0,R=1/0,z=d?0:u?C.cursorRow:0,E=d?0:u?C.cursorColumn:0,k=d?"none":u?"current":"all"):"row-header"===l?(M=d?h:u?C.cursorRow:h,H=h,O=0,R=1/0,z=d?h:u?C.cursorRow:h,E=d?0:u?C.cursorColumn:0,k=d?"none":u?"current":"all"):"column-header"===l?(M=0,H=1/0,O=d?c:u?C.cursorColumn:c,R=c,z=d?0:u?C.cursorRow:0,E=d?c:u?C.cursorColumn:c,k=d?"none":u?"current":"all"):(M=d?h:u?C.cursorRow:h,H=h,O=d?c:u?C.cursorColumn:c,R=c,z=d?h:u?C.cursorRow:h,E=d?c:u?C.cursorColumn:c,k=d?"none":u?"current":"all"),l){case"column-header":C.selectionMode="column";break;case"row-header":C.selectionMode="row";break;default:C.selectionMode="cell"}C.select({r1:M,c1:O,r2:H,c2:R,cursorRow:z,cursorColumn:E,clear:k})}}else{D="row-resize",B="row-header"===l?"body":"column-header",W="top"===S?h-1:h,T=t.rowSize(B,W);var P=s.Drag.overrideCursor(x);this._pressData={type:D,region:B,index:W,size:T,clientY:r,override:P}}else{var D="column-resize",B="column-header"===l?"body":"row-header",W="left"===S?c-1:c,T=t.columnSize(B,W),G=s.Drag.overrideCursor(x);this._pressData={type:D,region:B,index:W,size:T,clientX:i,override:G}}}},t.prototype.onMouseMove=function(t,e){var i=this._pressData;if(i)if("row-resize"!==i.type)if("column-resize"!==i.type){if("corner-header"!==i.region){var n=t.selectionModel;if(n){var r=t.mapToLocal(e.clientX,e.clientY),s=r.lx,a=r.ly;i.localX=s,i.localY=a;var l=t.headerWidth,h=t.headerHeight,c=t.viewportWidth,u=t.viewportHeight,d=t.scrollX,p=t.scrollY,f=t.maxScrollY,_=t.maxScrollY,m=n.selectionMode,y=-1;if("row-header"===i.region||"row"===m?a<h&&p>0?y=o.computeTimeout(h-a):a>=u&&p<_&&(y=o.computeTimeout(a-u)):"column-header"===i.region||"column"===m?s<l&&d>0?y=o.computeTimeout(l-s):s>=c&&d<f&&(y=o.computeTimeout(s-c)):s<l&&d>0?y=o.computeTimeout(l-s):s>=c&&d<f?y=o.computeTimeout(s-c):a<h&&p>0?y=o.computeTimeout(h-a):a>=u&&p<_&&(y=o.computeTimeout(a-u)),y>=0)i.timeout<0?(i.timeout=y,setTimeout((function(){o.autoselect(t,i)}),y)):i.timeout=y;else{i.timeout=-1;var v,g,w,b,S=t.mapToVirtual(e.clientX,e.clientY),x=S.vx,C=S.vy;x=Math.max(0,Math.min(x,t.bodyWidth-1)),C=Math.max(0,Math.min(C,t.bodyHeight-1));var M=n.cursorRow,O=n.cursorColumn;"row-header"===i.region||"row"===m?(v=i.row,w=t.rowAt("body",C),g=0,b=1/0):"column-header"===i.region||"column"===m?(v=0,w=1/0,g=i.column,b=t.columnAt("body",x)):(v=M,w=t.rowAt("body",C),g=O,b=t.columnAt("body",x)),n.select({r1:v,c1:g,r2:w,c2:b,cursorRow:M,cursorColumn:O,clear:"current"})}}}}else{var H=e.clientX-i.clientX;t.resizeColumn(i.region,i.index,i.size+H)}else{var R=e.clientY-i.clientY;t.resizeRow(i.region,i.index,i.size+R)}},t.prototype.onMouseUp=function(t,e){this.release()},t.prototype.onMouseDoubleClick=function(t,e){if(t.dataModel){var i=e.clientX,o=e.clientY,n=t.hitTest(i,o),r=n.region,s=n.row,a=n.column;if("void"!==r){if("body"===r&&t.editable){var l={grid:t,row:s,column:a};t.editorController.edit(l)}this.release()}else this.release()}else this.release()},t.prototype.onContextMenu=function(t,e){},t.prototype.onWheel=function(t,e){if(!this._pressData){var i=e.deltaX,o=e.deltaY;switch(e.deltaMode){case 0:break;case 1:var n=t.defaultSizes;i*=n.columnWidth,o*=n.rowHeight;break;case 2:i*=t.pageWidth,o*=t.pageHeight;break;default:throw"unreachable"}t.scrollBy(i,o)}},t.prototype.cursorForHandle=function(t){return o.cursorMap[t]},Object.defineProperty(t.prototype,"pressData",{get:function(){return this._pressData},enumerable:!0,configurable:!0}),t}();!function(t){t.resizeHandleForHitTest=function(t){var e,i=t.row,o=t.column,n=t.x,r=t.y,s=t.width-t.x,a=t.height-t.y;switch(t.region){case"corner-header":case"column-header":case"row-header":e=o>0&&n<=5?"left":s<=6?"right":i>0&&r<=5?"top":a<=6?"bottom":"none";break;case"body":case"void":e="none";break;default:throw"unreachable"}return e},t.autoselect=function t(e,i){if(!(i.timeout<0)){var o=e.selectionModel;if(o){var n=o.currentSelection();if(n){var r=i.localX,s=i.localY,a=n.r1,l=n.c1,h=n.r2,c=n.c2,u=o.cursorRow,d=o.cursorColumn,p=e.headerWidth,f=e.headerHeight,_=e.viewportWidth,m=e.viewportHeight,y=o.selectionMode;"row-header"===i.region||"row"===y?h+=s<=f?-1:s>=m?1:0:("column-header"===i.region||"column"===y||(h+=s<=f?-1:s>=m?1:0),c+=r<=p?-1:r>=_?1:0),o.select({r1:a,c1:l,r2:h,c2:c,cursorRow:u,cursorColumn:d,clear:"current"}),(n=o.currentSelection())&&("row-header"===i.region||"row"===y?e.scrollToRow(n.r2):"column-header"===i.region||"column"==y?e.scrollToColumn(n.c2):"cell"===y&&e.scrollToCell(n.r2,n.c2),setTimeout((function(){t(e,i)}),i.timeout))}}}},t.computeTimeout=function(t){return 5+120*(1-Math.min(128,Math.abs(t))/128)},t.cursorMap={top:"ns-resize",left:"ew-resize",right:"ew-resize",bottom:"ns-resize",none:"default"}}(o||(o={}));var p=function(t,e){return(p=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])})(t,e)};function f(t,e){function i(){this.constructor=t}p(t,e),t.prototype=null===e?Object.create(e):(i.prototype=e.prototype,new i)}var _,m=function(){return(m=Object.assign||function(t){for(var e,i=1,o=arguments.length;i<o;i++)for(var n in e=arguments[i])Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t}).apply(this,arguments)},y=function(){function t(t){this._changed=new l.Signal(this),this._selectionMode="cell",this.dataModel=t.dataModel,this._selectionMode=t.selectionMode||"cell",this.dataModel.changed.connect(this.onDataModelChanged,this)}return Object.defineProperty(t.prototype,"changed",{get:function(){return this._changed},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"selectionMode",{get:function(){return this._selectionMode},set:function(t){this._selectionMode!==t&&(this._selectionMode=t,this.clear())},enumerable:!0,configurable:!0}),t.prototype.isRowSelected=function(t){return(0,a.some)(this.selections(),(function(e){return _.containsRow(e,t)}))},t.prototype.isColumnSelected=function(t){return(0,a.some)(this.selections(),(function(e){return _.containsColumn(e,t)}))},t.prototype.isCellSelected=function(t,e){return(0,a.some)(this.selections(),(function(i){return _.containsCell(i,t,e)}))},t.prototype.onDataModelChanged=function(t,e){},t.prototype.emitChanged=function(){this._changed.emit(void 0)},t}();!function(t){function e(t,e){var i=t.r1,o=t.r2;return e>=i&&e<=o||e>=o&&e<=i}function i(t,e){var i=t.c1,o=t.c2;return e>=i&&e<=o||e>=o&&e<=i}t.containsRow=e,t.containsColumn=i,t.containsCell=function(t,o,n){return e(t,o)&&i(t,n)}}(_||(_={}));var v=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e._cursorRow=-1,e._cursorColumn=-1,e._cursorRectIndex=-1,e._selections=[],e}return f(e,t),Object.defineProperty(e.prototype,"isEmpty",{get:function(){return 0===this._selections.length},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"cursorRow",{get:function(){return this._cursorRow},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"cursorColumn",{get:function(){return this._cursorColumn},enumerable:!0,configurable:!0}),e.prototype.moveCursorWithinSelections=function(t){var e=this;if(!this.isEmpty&&-1!==this.cursorRow&&-1!==this._cursorColumn){var i=this._selections[0];if(1!==this._selections.length||i.r1!==i.r2||i.c1!==i.c2){-1===this._cursorRectIndex&&(this._cursorRectIndex=this._selections.length-1);var o=this._selections[this._cursorRectIndex],n="down"===t?1:"up"===t?-1:0,r="right"===t?1:"left"===t?-1:0,s=this._cursorRow+n,a=this._cursorColumn+r,l=Math.min(o.r1,o.r2),h=Math.max(o.r1,o.r2),c=Math.min(o.c1,o.c2),u=Math.max(o.c1,o.c2),d=function(){e._cursorRectIndex=(e._cursorRectIndex+1)%e._selections.length,o=e._selections[e._cursorRectIndex],s=Math.min(o.r1,o.r2),a=Math.min(o.c1,o.c2)},p=function(){e._cursorRectIndex=0===e._cursorRectIndex?e._selections.length-1:e._cursorRectIndex-1,o=e._selections[e._cursorRectIndex],s=Math.max(o.r1,o.r2),a=Math.max(o.c1,o.c2)};s>h?(s=l,(a+=1)>u&&d()):s<l?(s=h,(a-=1)<c&&p()):a>u?(a=c,(s+=1)>h&&d()):a<c&&(a=u,(s-=1)<l&&p()),this._cursorRow=s,this._cursorColumn=a,this.emitChanged()}}},e.prototype.currentSelection=function(){return this._selections[this._selections.length-1]||null},e.prototype.selections=function(){return(0,a.iter)(this._selections)},e.prototype.select=function(t){var e=this.dataModel.rowCount("body"),i=this.dataModel.columnCount("body");if(!(e<=0||i<=0)){var o=t.r1,n=t.c1,r=t.r2,s=t.c2,a=t.cursorRow,l=t.cursorColumn,h=t.clear;"all"===h?this._selections.length=0:"current"===h&&this._selections.pop(),o=Math.max(0,Math.min(o,e-1)),r=Math.max(0,Math.min(r,e-1)),n=Math.max(0,Math.min(n,i-1)),s=Math.max(0,Math.min(s,i-1)),"row"===this.selectionMode?(n=0,s=i-1):"column"===this.selectionMode&&(o=0,r=e-1);var c=a,u=l;(c<0||c<o&&c<r||c>o&&c>r)&&(c=o),(u<0||u<n&&u<s||u>n&&u>s)&&(u=n),this._cursorRow=c,this._cursorColumn=u,this._cursorRectIndex=this._selections.length,this._selections.push({r1:o,c1:n,r2:r,c2:s}),this.emitChanged()}},e.prototype.clear=function(){0!==this._selections.length&&(this._cursorRow=-1,this._cursorColumn=-1,this._cursorRectIndex=-1,this._selections.length=0,this.emitChanged())},e.prototype.onDataModelChanged=function(t,e){if(0!==this._selections.length&&"cells-changed"!==e.type&&"rows-moved"!==e.type&&"columns-moved"!==e.type){var i=t.rowCount("body")-1,o=t.columnCount("body")-1;if(i<0||o<0)return this._selections.length=0,void this.emitChanged();for(var n=this.selectionMode,r=0,s=0,a=this._selections.length;s<a;++s){var l=this._selections[s],h=l.r1,c=l.c1,u=l.r2,d=l.c2;i<h&&i<u||o<c&&o<d||("row"===n?(h=Math.max(0,Math.min(h,i)),u=Math.max(0,Math.min(u,i)),c=0,d=o):"column"===n?(h=0,u=i,c=Math.max(0,Math.min(c,o)),d=Math.max(0,Math.min(d,o))):(h=Math.max(0,Math.min(h,i)),u=Math.max(0,Math.min(u,i)),c=Math.max(0,Math.min(c,o)),d=Math.max(0,Math.min(d,o))),this._selections[r++]={r1:h,c1:c,r2:u,c2:d})}this._selections.length=r,this.emitChanged()}},e}(y),g=function(){};!function(t){t.resolveOption=function(t,e){return"function"==typeof t?t(e):t}}(g||(g={}));var w,b=function(t){function e(e){var i=t.call(this,{node:w.createNode()})||this;return i._message="",i.addClass("lm-DataGrid-notification"),i.setFlag(h.Widget.Flag.DisallowLayout),i._target=e.target,i._message=e.message||"",i._placement=e.placement||"bottom",h.Widget.attach(i,document.body),e.timeout&&e.timeout>0&&setTimeout((function(){i.close()}),e.timeout),i}return f(e,t),e.prototype.handleEvent=function(t){switch(t.type){case"mousedown":this._evtMouseDown(t);break;case"contextmenu":t.preventDefault(),t.stopPropagation()}},Object.defineProperty(e.prototype,"placement",{get:function(){return this._placement},set:function(t){this._placement!==t&&(this._placement=t,this.update())},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"message",{get:function(){return this._message},set:function(t){this._message!==t&&(this._message=t,this.update())},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"messageNode",{get:function(){return this.node.getElementsByClassName("lm-DataGrid-notificationMessage")[0]},enumerable:!0,configurable:!0}),e.prototype.onBeforeAttach=function(t){this.node.addEventListener("mousedown",this),this.update()},e.prototype.onAfterDetach=function(t){this.node.removeEventListener("mousedown",this)},e.prototype.onUpdateRequest=function(t){var e=this._target.getBoundingClientRect(),i=this.node.style;switch(this._placement){case"bottom":i.left=e.left+"px",i.top=e.bottom+"px";break;case"top":i.left=e.left+"px",i.height=e.top+"px",i.top="0",i.alignItems="flex-end",i.justifyContent="flex-end";break;case"left":i.left="0",i.width=e.left+"px",i.top=e.top+"px",i.alignItems="flex-end",i.justifyContent="flex-end";break;case"right":i.left=e.right+"px",i.top=e.top+"px"}this.messageNode.innerHTML=this._message},e.prototype._evtMouseDown=function(t){0===t.button&&(t.preventDefault(),t.stopPropagation(),this.close())},e}(h.Widget);!function(t){t.createNode=function(){var t=document.createElement("div"),e=document.createElement("div");e.className="lm-DataGrid-notificationContainer";var i=document.createElement("span");return i.className="lm-DataGrid-notificationMessage",e.appendChild(i),t.appendChild(e),t}}(w||(w={}));var S="Invalid input!",x=function(){function t(){}return t.prototype.validate=function(t,e){return{valid:!0}},t}(),C=function(){function t(){this.minLength=Number.NaN,this.maxLength=Number.NaN,this.pattern=null}return t.prototype.validate=function(t,e){return null===e?{valid:!0}:"string"!=typeof e?{valid:!1,message:"Input must be valid text"}:!isNaN(this.minLength)&&e.length<this.minLength?{valid:!1,message:"Text length must be greater than "+this.minLength}:!isNaN(this.maxLength)&&e.length>this.maxLength?{valid:!1,message:"Text length must be less than "+this.maxLength}:this.pattern&&!this.pattern.test(e)?{valid:!1,message:"Text doesn't match the required pattern"}:{valid:!0}},t}(),M=function(){function t(){this.min=Number.NaN,this.max=Number.NaN}return t.prototype.validate=function(t,e){return null===e?{valid:!0}:isNaN(e)||e%1!=0?{valid:!1,message:"Input must be valid integer"}:!isNaN(this.min)&&e<this.min?{valid:!1,message:"Input must be greater than "+this.min}:!isNaN(this.max)&&e>this.max?{valid:!1,message:"Input must be less than "+this.max}:{valid:!0}},t}(),O=function(){function t(){this.min=Number.NaN,this.max=Number.NaN}return t.prototype.validate=function(t,e){return null===e?{valid:!0}:isNaN(e)?{valid:!1,message:"Input must be valid number"}:!isNaN(this.min)&&e<this.min?{valid:!1,message:"Input must be greater than "+this.min}:!isNaN(this.max)&&e>this.max?{valid:!1,message:"Input must be less than "+this.max}:{valid:!0}},t}(),H=function(){function t(){var t=this;this.inputChanged=new l.Signal(this),this.validityNotification=null,this._disposed=!1,this._validInput=!0,this._gridWheelEventHandler=null,this.inputChanged.connect((function(){t.validate()}))}return Object.defineProperty(t.prototype,"isDisposed",{get:function(){return this._disposed},enumerable:!0,configurable:!0}),t.prototype.dispose=function(){this._disposed||(this._gridWheelEventHandler&&(this.cell.grid.node.removeEventListener("wheel",this._gridWheelEventHandler),this._gridWheelEventHandler=null),this._closeValidityNotification(),this._disposed=!0,this.cell.grid.node.removeChild(this.viewportOccluder))},t.prototype.edit=function(t,e){var i=this;this.cell=t,this.onCommit=e&&e.onCommit,this.onCancel=e&&e.onCancel,this.validator=e&&e.validator?e.validator:this.createValidatorBasedOnType(),this._gridWheelEventHandler=function(){i._closeValidityNotification(),i.updatePosition()},t.grid.node.addEventListener("wheel",this._gridWheelEventHandler),this._addContainer(),this.updatePosition(),this.startEditing()},t.prototype.cancel=function(){this._disposed||(this.dispose(),this.onCancel&&this.onCancel())},Object.defineProperty(t.prototype,"validInput",{get:function(){return this._validInput},enumerable:!0,configurable:!0}),t.prototype.validate=function(){var t;try{t=this.getInput()}catch(t){return console.log("Input error: "+t.message),void this.setValidity(!1,t.message||S)}if(this.validator){var e=this.validator.validate(this.cell,t);e.valid?this.setValidity(!0):this.setValidity(!1,e.message||S)}else this.setValidity(!0)},t.prototype.setValidity=function(t,e){void 0===e&&(e=""),this._validInput=t,this._closeValidityNotification(),t?this.editorContainer.classList.remove("lm-mod-invalid"):(this.editorContainer.classList.add("lm-mod-invalid"),""!==e&&(this.validityNotification=new b({target:this.editorContainer,message:e,placement:"bottom",timeout:5e3}),this.validityNotification.show()))},t.prototype.createValidatorBasedOnType=function(){var t=this.cell,e=t.grid.dataModel.metadata("body",t.row,t.column);switch(e&&e.type){case"string":var i=new C;if("string"==typeof e.format)switch(e.format){case"email":i.pattern=new RegExp("^([a-z0-9_.-]+)@([da-z.-]+).([a-z.]{2,6})$");break;case"uuid":i.pattern=new RegExp("[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}")}return e.constraint&&(void 0!==e.constraint.minLength&&(i.minLength=e.constraint.minLength),void 0!==e.constraint.maxLength&&(i.maxLength=e.constraint.maxLength),"string"==typeof e.constraint.pattern&&(i.pattern=new RegExp(e.constraint.pattern))),i;case"number":return i=new O,e.constraint&&(void 0!==e.constraint.minimum&&(i.min=e.constraint.minimum),void 0!==e.constraint.maximum&&(i.max=e.constraint.maximum)),i;case"integer":return i=new M,e.constraint&&(void 0!==e.constraint.minimum&&(i.min=e.constraint.minimum),void 0!==e.constraint.maximum&&(i.max=e.constraint.maximum)),i}},t.prototype.getCellInfo=function(t){var e=t.grid,i=t.row,o=t.column,n=e.dataModel.data("body",i,o),r=e.headerWidth-e.scrollX+e.columnOffset("body",o),s=e.headerHeight-e.scrollY+e.rowOffset("body",i),a=e.columnSize("body",o),l=e.rowSize("body",i);return{grid:e,row:i,column:o,data:n,x:r,y:s,width:a,height:l}},t.prototype.updatePosition=function(){var t=this.cell.grid,e=this.getCellInfo(this.cell),i=t.headerHeight,o=t.headerWidth;this.viewportOccluder.style.top=i+"px",this.viewportOccluder.style.left=o+"px",this.viewportOccluder.style.width=t.viewportWidth-o+"px",this.viewportOccluder.style.height=t.viewportHeight-i+"px",this.viewportOccluder.style.position="absolute",this.editorContainer.style.left=e.x-1-o+"px",this.editorContainer.style.top=e.y-1-i+"px",this.editorContainer.style.width=e.width+1+"px",this.editorContainer.style.height=e.height+1+"px",this.editorContainer.style.visibility="visible",this.editorContainer.style.position="absolute"},t.prototype.commit=function(t){if(void 0===t&&(t="none"),this.validate(),!this._validInput)return!1;var e;try{e=this.getInput()}catch(t){return console.log("Input error: "+t.message),!1}return this.dispose(),this.onCommit&&this.onCommit({cell:this.cell,value:e,cursorMovement:t}),!0},t.prototype._addContainer=function(){var t=this;this.viewportOccluder=document.createElement("div"),this.viewportOccluder.className="lm-DataGrid-cellEditorOccluder",this.cell.grid.node.appendChild(this.viewportOccluder),this.editorContainer=document.createElement("div"),this.editorContainer.className="lm-DataGrid-cellEditorContainer",this.viewportOccluder.appendChild(this.editorContainer),this.editorContainer.addEventListener("mouseleave",(function(e){t.viewportOccluder.style.pointerEvents=t._validInput?"none":"auto"})),this.editorContainer.addEventListener("mouseenter",(function(e){t.viewportOccluder.style.pointerEvents="none"}))},t.prototype._closeValidityNotification=function(){this.validityNotification&&(this.validityNotification.close(),this.validityNotification=null)},t}(),R=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return f(e,t),e.prototype.handleEvent=function(t){switch(t.type){case"keydown":this._onKeyDown(t);break;case"blur":this._onBlur(t);break;case"input":this._onInput(t)}},e.prototype.dispose=function(){this.isDisposed||(this._unbindEvents(),t.prototype.dispose.call(this))},e.prototype.startEditing=function(){this.createWidget();var t=this.cell,e=this.getCellInfo(t);this.input.value=this.deserialize(e.data),this.editorContainer.appendChild(this.input),this.input.focus(),this.input.select(),this.bindEvents()},e.prototype.deserialize=function(t){return null==t?"":t.toString()},e.prototype.createWidget=function(){var t=document.createElement("input");t.classList.add("lm-DataGrid-cellEditorWidget"),t.classList.add("lm-DataGrid-cellEditorInput"),t.spellcheck=!1,t.type=this.inputType,this.input=t},e.prototype.bindEvents=function(){this.input.addEventListener("keydown",this),this.input.addEventListener("blur",this),this.input.addEventListener("input",this)},e.prototype._unbindEvents=function(){this.input.removeEventListener("keydown",this),this.input.removeEventListener("blur",this),this.input.removeEventListener("input",this)},e.prototype._onKeyDown=function(t){switch((0,r.Vc)().keyForKeydownEvent(t)){case"Enter":this.commit(t.shiftKey?"up":"down");break;case"Tab":this.commit(t.shiftKey?"left":"right"),t.stopPropagation(),t.preventDefault();break;case"Escape":this.cancel()}},e.prototype._onBlur=function(t){this.isDisposed||this.commit()||(t.preventDefault(),t.stopPropagation(),this.input.focus())},e.prototype._onInput=function(t){this.inputChanged.emit(void 0)},e}(H),z=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.inputType="text",e}return f(e,t),e.prototype.getInput=function(){return this.input.value},e}(R),E=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.inputType="number",e}return f(e,t),e.prototype.startEditing=function(){t.prototype.startEditing.call(this),this.input.step="any";var e=this.cell,i=e.grid.dataModel.metadata("body",e.row,e.column).constraint;i&&(i.minimum&&(this.input.min=i.minimum),i.maximum&&(this.input.max=i.maximum))},e.prototype.getInput=function(){var t=this.input.value;if(""===t.trim())return null;var e=parseFloat(t);if(isNaN(e))throw new Error("Invalid input");return e},e}(R),k=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.inputType="number",e}return f(e,t),e.prototype.startEditing=function(){t.prototype.startEditing.call(this),this.input.step="1";var e=this.cell,i=e.grid.dataModel.metadata("body",e.row,e.column).constraint;i&&(i.minimum&&(this.input.min=i.minimum),i.maximum&&(this.input.max=i.maximum))},e.prototype.getInput=function(){var t=this.input.value;if(""===t.trim())return null;var e=parseInt(t);if(isNaN(e))throw new Error("Invalid input");return e},e}(R),L=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return f(e,t),e.prototype.handleEvent=function(t){switch(t.type){case"keydown":this._onKeyDown(t);break;case"blur":this._onBlur(t)}},e.prototype.dispose=function(){this.isDisposed||(this._unbindEvents(),t.prototype.dispose.call(this))},e.prototype.startEditing=function(){this._createWidget();var t=this.cell,e=this.getCellInfo(t);this._input.value=this._deserialize(e.data),this.editorContainer.appendChild(this._input),this._input.focus(),this._bindEvents()},e.prototype.getInput=function(){return this._input.value},e.prototype._deserialize=function(t){return null==t?"":t.toString()},e.prototype._createWidget=function(){var t=document.createElement("input");t.type="date",t.pattern="d{4}-d{2}-d{2}",t.classList.add("lm-DataGrid-cellEditorWidget"),t.classList.add("lm-DataGrid-cellEditorInput"),this._input=t},e.prototype._bindEvents=function(){this._input.addEventListener("keydown",this),this._input.addEventListener("blur",this)},e.prototype._unbindEvents=function(){this._input.removeEventListener("keydown",this),this._input.removeEventListener("blur",this)},e.prototype._onKeyDown=function(t){switch((0,r.Vc)().keyForKeydownEvent(t)){case"Enter":this.commit(t.shiftKey?"up":"down");break;case"Tab":this.commit(t.shiftKey?"left":"right"),t.stopPropagation(),t.preventDefault();break;case"Escape":this.cancel()}},e.prototype._onBlur=function(t){this.isDisposed||this.commit()||(t.preventDefault(),t.stopPropagation(),this._input.focus())},e}(H),P=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return f(e,t),e.prototype.handleEvent=function(t){switch(t.type){case"keydown":this._onKeyDown(t);break;case"mousedown":this._input.focus(),t.stopPropagation(),t.preventDefault();break;case"blur":this._onBlur(t)}},e.prototype.dispose=function(){this.isDisposed||(this._unbindEvents(),t.prototype.dispose.call(this))},e.prototype.startEditing=function(){this._createWidget();var t=this.cell,e=this.getCellInfo(t);this._input.checked=this._deserialize(e.data),this.editorContainer.appendChild(this._input),this._input.focus(),this._bindEvents()},e.prototype.getInput=function(){return this._input.checked},e.prototype._deserialize=function(t){return null!=t&&1==t},e.prototype._createWidget=function(){var t=document.createElement("input");t.classList.add("lm-DataGrid-cellEditorWidget"),t.classList.add("lm-DataGrid-cellEditorCheckbox"),t.type="checkbox",t.spellcheck=!1,this._input=t},e.prototype._bindEvents=function(){this._input.addEventListener("keydown",this),this._input.addEventListener("mousedown",this),this._input.addEventListener("blur",this)},e.prototype._unbindEvents=function(){this._input.removeEventListener("keydown",this),this._input.removeEventListener("mousedown",this),this._input.removeEventListener("blur",this)},e.prototype._onKeyDown=function(t){switch((0,r.Vc)().keyForKeydownEvent(t)){case"Enter":this.commit(t.shiftKey?"up":"down");break;case"Tab":this.commit(t.shiftKey?"left":"right"),t.stopPropagation(),t.preventDefault();break;case"Escape":this.cancel()}},e.prototype._onBlur=function(t){this.isDisposed||this.commit()||(t.preventDefault(),t.stopPropagation(),this._input.focus())},e}(H),D=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e._isMultiSelect=!1,e}return f(e,t),e.prototype.dispose=function(){this.isDisposed||(t.prototype.dispose.call(this),this._isMultiSelect&&document.body.removeChild(this._select))},e.prototype.startEditing=function(){var t=this.cell,e=this.getCellInfo(t),i=t.grid.dataModel.metadata("body",t.row,t.column);if(this._isMultiSelect="array"===i.type,this._createWidget(),this._isMultiSelect){this._select.multiple=!0;for(var o=this._deserialize(e.data),n=0;n<this._select.options.length;++n){var r=this._select.options.item(n);r.selected=-1!==o.indexOf(r.value)}document.body.appendChild(this._select)}else this._select.value=this._deserialize(e.data),this.editorContainer.appendChild(this._select);this._select.focus(),this._bindEvents(),this.updatePosition()},e.prototype.getInput=function(){if(this._isMultiSelect){for(var t=[],e=0;e<this._select.selectedOptions.length;++e)t.push(this._select.selectedOptions.item(e).value);return t}return this._select.value},e.prototype.updatePosition=function(){if(t.prototype.updatePosition.call(this),this._isMultiSelect){var e=this.getCellInfo(this.cell);this._select.style.position="absolute";var i=this.editorContainer.getBoundingClientRect();this._select.style.left=i.left+"px",this._select.style.top=i.top+e.height+"px",this._select.style.width=i.width+"px",this._select.style.maxHeight="60px",this.editorContainer.style.visibility="hidden"}},e.prototype._deserialize=function(t){if(null==t)return"";if(this._isMultiSelect){var e=[];if(Array.isArray(t))for(var i=0,o=t;i<o.length;i++){var n=o[i];e.push(n.toString())}return e}return t.toString()},e.prototype._createWidget=function(){var t=this.cell,e=t.grid.dataModel.metadata("body",t.row,t.column).constraint.enum,i=document.createElement("select");i.classList.add("lm-DataGrid-cellEditorWidget");for(var o=0,n=e;o<n.length;o++){var r=n[o],s=document.createElement("option");s.value=r,s.text=r,i.appendChild(s)}this._select=i},e.prototype._bindEvents=function(){this._select.addEventListener("keydown",this._onKeyDown.bind(this)),this._select.addEventListener("blur",this._onBlur.bind(this))},e.prototype._onKeyDown=function(t){switch((0,r.Vc)().keyForKeydownEvent(t)){case"Enter":this.commit(t.shiftKey?"up":"down");break;case"Tab":this.commit(t.shiftKey?"left":"right"),t.stopPropagation(),t.preventDefault();break;case"Escape":this.cancel()}},e.prototype._onBlur=function(t){this.isDisposed||this.commit()||(t.preventDefault(),t.stopPropagation(),this._select.focus())},e}(H),B=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return f(e,t),e.prototype.handleEvent=function(t){switch(t.type){case"keydown":this._onKeyDown(t);break;case"blur":this._onBlur(t)}},e.prototype.dispose=function(){this.isDisposed||(this._unbindEvents(),t.prototype.dispose.call(this))},e.prototype.startEditing=function(){this._createWidget();var t=this.cell,e=this.getCellInfo(t);this._input.value=this._deserialize(e.data),this.editorContainer.appendChild(this._input),this._input.focus(),this._input.select(),this._bindEvents()},e.prototype.getInput=function(){return this._input.value},e.prototype._deserialize=function(t){return null==t?"":t.toString()},e.prototype._createWidget=function(){var t=this.cell,e=t.grid.dataModel,i=e.rowCount("body"),o="cell-editor-list",n=document.createElement("datalist");n.id=o;var r=document.createElement("input");r.classList.add("lm-DataGrid-cellEditorWidget"),r.classList.add("lm-DataGrid-cellEditorInput");for(var s=new Set,a=0;a<i;++a){var l=e.data("body",a,t.column);l&&s.add(l)}s.forEach((function(t){var e=document.createElement("option");e.value=t,e.text=t,n.appendChild(e)})),this.editorContainer.appendChild(n),r.setAttribute("list",o),this._input=r},e.prototype._bindEvents=function(){this._input.addEventListener("keydown",this),this._input.addEventListener("blur",this)},e.prototype._unbindEvents=function(){this._input.removeEventListener("keydown",this),this._input.removeEventListener("blur",this)},e.prototype._onKeyDown=function(t){switch((0,r.Vc)().keyForKeydownEvent(t)){case"Enter":this.commit(t.shiftKey?"up":"down");break;case"Tab":this.commit(t.shiftKey?"left":"right"),t.stopPropagation(),t.preventDefault();break;case"Escape":this.cancel()}},e.prototype._onBlur=function(t){this.isDisposed||this.commit()||(t.preventDefault(),t.stopPropagation(),this._input.focus())},e}(H),W=function(){function t(){this._changed=new l.Signal(this)}return Object.defineProperty(t.prototype,"changed",{get:function(){return this._changed},enumerable:!0,configurable:!0}),t.prototype.metadata=function(e,i,o){return t.emptyMetadata},t.prototype.emitChanged=function(t){this._changed.emit(t)},t}(),T=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return f(e,t),e}(W);!function(t){t.emptyMetadata=Object.freeze({})}(W||(W={}));var G,I=function(){function t(t){this._disposed=!1,this._context=t,this._state=G.State.create(t)}return t.prototype.dispose=function(){if(!this._disposed)for(this._disposed=!0;this._state.next;)this._state=this._state.next,this._context.restore()},Object.defineProperty(t.prototype,"isDisposed",{get:function(){return this._disposed},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"fillStyle",{get:function(){return this._context.fillStyle},set:function(t){this._state.fillStyle!==t&&(this._state.fillStyle=t,this._context.fillStyle=t)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"strokeStyle",{get:function(){return this._context.strokeStyle},set:function(t){this._state.strokeStyle!==t&&(this._state.strokeStyle=t,this._context.strokeStyle=t)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"font",{get:function(){return this._context.font},set:function(t){this._state.font!==t&&(this._state.font=t,this._context.font=t)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"textAlign",{get:function(){return this._context.textAlign},set:function(t){this._state.textAlign!==t&&(this._state.textAlign=t,this._context.textAlign=t)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"textBaseline",{get:function(){return this._context.textBaseline},set:function(t){this._state.textBaseline!==t&&(this._state.textBaseline=t,this._context.textBaseline=t)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"lineCap",{get:function(){return this._context.lineCap},set:function(t){this._state.lineCap!==t&&(this._state.lineCap=t,this._context.lineCap=t)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"lineDashOffset",{get:function(){return this._context.lineDashOffset},set:function(t){this._state.lineDashOffset!==t&&(this._state.lineDashOffset=t,this._context.lineDashOffset=t)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"lineJoin",{get:function(){return this._context.lineJoin},set:function(t){this._state.lineJoin!==t&&(this._state.lineJoin=t,this._context.lineJoin=t)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"lineWidth",{get:function(){return this._context.lineWidth},set:function(t){this._state.lineWidth!==t&&(this._state.lineWidth=t,this._context.lineWidth=t)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"miterLimit",{get:function(){return this._context.miterLimit},set:function(t){this._state.miterLimit!==t&&(this._state.miterLimit=t,this._context.miterLimit=t)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"shadowBlur",{get:function(){return this._context.shadowBlur},set:function(t){this._state.shadowBlur!==t&&(this._state.shadowBlur=t,this._context.shadowBlur=t)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"shadowColor",{get:function(){return this._context.shadowColor},set:function(t){this._state.shadowColor!==t&&(this._state.shadowColor=t,this._context.shadowColor=t)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"shadowOffsetX",{get:function(){return this._context.shadowOffsetX},set:function(t){this._state.shadowOffsetX!==t&&(this._state.shadowOffsetX=t,this._context.shadowOffsetX=t)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"shadowOffsetY",{get:function(){return this._context.shadowOffsetY},set:function(t){this._state.shadowOffsetY!==t&&(this._state.shadowOffsetY=t,this._context.shadowOffsetY=t)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"imageSmoothingEnabled",{get:function(){return this._context.imageSmoothingEnabled},set:function(t){this._state.imageSmoothingEnabled!==t&&(this._state.imageSmoothingEnabled=t,this._context.imageSmoothingEnabled=t)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"globalAlpha",{get:function(){return this._context.globalAlpha},set:function(t){this._state.globalAlpha!==t&&(this._state.globalAlpha=t,this._context.globalAlpha=t)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"globalCompositeOperation",{get:function(){return this._context.globalCompositeOperation},set:function(t){this._state.globalCompositeOperation!==t&&(this._state.globalCompositeOperation=t,this._context.globalCompositeOperation=t)},enumerable:!0,configurable:!0}),t.prototype.getLineDash=function(){return this._context.getLineDash()},t.prototype.setLineDash=function(t){this._context.setLineDash(t)},t.prototype.rotate=function(t){this._context.rotate(t)},t.prototype.scale=function(t,e){this._context.scale(t,e)},t.prototype.transform=function(t,e,i,o,n,r){this._context.transform(t,e,i,o,n,r)},t.prototype.translate=function(t,e){this._context.translate(t,e)},t.prototype.setTransform=function(t,e,i,o,n,r){this._context.setTransform(t,e,i,o,n,r)},t.prototype.save=function(){this._state=G.State.push(this._state),this._context.save()},t.prototype.restore=function(){this._state.next&&(this._state=G.State.pop(this._state),this._context.restore())},t.prototype.beginPath=function(){return this._context.beginPath()},t.prototype.closePath=function(){this._context.closePath()},t.prototype.isPointInPath=function(t,e,i){return 2===arguments.length?this._context.isPointInPath(t,e):this._context.isPointInPath(t,e,i)},t.prototype.arc=function(t,e,i,o,n,r){5===arguments.length?this._context.arc(t,e,i,o,n):this._context.arc(t,e,i,o,n,r)},t.prototype.arcTo=function(t,e,i,o,n){this._context.arcTo(t,e,i,o,n)},t.prototype.bezierCurveTo=function(t,e,i,o,n,r){this._context.bezierCurveTo(t,e,i,o,n,r)},t.prototype.ellipse=function(t,e,i,o,n,r,s,a){7===arguments.length?this._context.ellipse(t,e,i,o,n,r,s):this._context.ellipse(t,e,i,o,n,r,s,a)},t.prototype.lineTo=function(t,e){this._context.lineTo(t,e)},t.prototype.moveTo=function(t,e){this._context.moveTo(t,e)},t.prototype.quadraticCurveTo=function(t,e,i,o){this._context.quadraticCurveTo(t,e,i,o)},t.prototype.rect=function(t,e,i,o){this._context.rect(t,e,i,o)},t.prototype.clip=function(t){0===arguments.length?this._context.clip():this._context.clip(t)},t.prototype.fill=function(t){0===arguments.length?this._context.fill():this._context.fill(t)},t.prototype.stroke=function(){this._context.stroke()},t.prototype.clearRect=function(t,e,i,o){return this._context.clearRect(t,e,i,o)},t.prototype.fillRect=function(t,e,i,o){this._context.fillRect(t,e,i,o)},t.prototype.fillText=function(t,e,i,o){3===arguments.length?this._context.fillText(t,e,i):this._context.fillText(t,e,i,o)},t.prototype.strokeRect=function(t,e,i,o){this._context.strokeRect(t,e,i,o)},t.prototype.strokeText=function(t,e,i,o){3===arguments.length?this._context.strokeText(t,e,i):this._context.strokeText(t,e,i,o)},t.prototype.measureText=function(t){return this._context.measureText(t)},t.prototype.createLinearGradient=function(t,e,i,o){return this._context.createLinearGradient(t,e,i,o)},t.prototype.createRadialGradient=function(t,e,i,o,n,r){return this._context.createRadialGradient(t,e,i,o,n,r)},t.prototype.createPattern=function(t,e){return this._context.createPattern(t,e)},t.prototype.createImageData=function(){return this._context.createImageData.apply(this._context,arguments)},t.prototype.getImageData=function(t,e,i,o){return this._context.getImageData(t,e,i,o)},t.prototype.putImageData=function(){this._context.putImageData.apply(this._context,arguments)},t.prototype.drawImage=function(){this._context.drawImage.apply(this._context,arguments)},t.prototype.drawFocusIfNeeded=function(t){this._context.drawFocusIfNeeded(t)},t}();!function(t){var e=-1,i=[],o=function(){function t(){}return t.create=function(o){var n=e<0?new t:i[e--];return n.next=null,n.fillStyle=o.fillStyle,n.font=o.font,n.globalAlpha=o.globalAlpha,n.globalCompositeOperation=o.globalCompositeOperation,n.imageSmoothingEnabled=o.imageSmoothingEnabled,n.lineCap=o.lineCap,n.lineDashOffset=o.lineDashOffset,n.lineJoin=o.lineJoin,n.lineWidth=o.lineWidth,n.miterLimit=o.miterLimit,n.shadowBlur=o.shadowBlur,n.shadowColor=o.shadowColor,n.shadowOffsetX=o.shadowOffsetX,n.shadowOffsetY=o.shadowOffsetY,n.strokeStyle=o.strokeStyle,n.textAlign=o.textAlign,n.textBaseline=o.textBaseline,n},t.push=function(o){var n=e<0?new t:i[e--];return n.next=o,n.fillStyle=o.fillStyle,n.font=o.font,n.globalAlpha=o.globalAlpha,n.globalCompositeOperation=o.globalCompositeOperation,n.imageSmoothingEnabled=o.imageSmoothingEnabled,n.lineCap=o.lineCap,n.lineDashOffset=o.lineDashOffset,n.lineJoin=o.lineJoin,n.lineWidth=o.lineWidth,n.miterLimit=o.miterLimit,n.shadowBlur=o.shadowBlur,n.shadowColor=o.shadowColor,n.shadowOffsetX=o.shadowOffsetX,n.shadowOffsetY=o.shadowOffsetY,n.strokeStyle=o.strokeStyle,n.textAlign=o.textAlign,n.textBaseline=o.textBaseline,n},t.pop=function(t){return t.fillStyle="",t.strokeStyle="",i[++e]=t,t.next},t}();t.State=o}(G||(G={}));var j,A=function(t){function e(i){void 0===i&&(i={});var o=t.call(this)||this;return o.font=i.font||"12px sans-serif",o.textColor=i.textColor||"#000000",o.backgroundColor=i.backgroundColor||"",o.verticalAlignment=i.verticalAlignment||"center",o.horizontalAlignment=i.horizontalAlignment||"left",o.format=i.format||e.formatGeneric(),o.elideDirection=i.elideDirection||"right",o.wrapText=i.wrapText||!1,o}return f(e,t),e.prototype.paint=function(t,e){this.drawBackground(t,e),this.drawText(t,e)},e.prototype.drawBackground=function(t,e){var i=g.resolveOption(this.backgroundColor,e);i&&(t.fillStyle=i,t.fillRect(e.x,e.y,e.width,e.height))},e.prototype.drawText=function(t,i){var o=g.resolveOption(this.font,i);if(o){var n=g.resolveOption(this.textColor,i);if(n){var r=(0,this.format)(i);if(r){var s=g.resolveOption(this.verticalAlignment,i),a=g.resolveOption(this.horizontalAlignment,i),l=g.resolveOption(this.elideDirection,i),h=g.resolveOption(this.wrapText,i),c=i.height-("center"===s?1:2);if(!(c<=0)){var u,d,p,f=e.measureFontHeight(o);switch(s){case"top":d=i.y+2+f;break;case"center":d=i.y+i.height/2+f/2;break;case"bottom":d=i.y+i.height-2;break;default:throw"unreachable"}switch(a){case"left":u=i.x+8,p=i.width-14;break;case"center":u=i.x+i.width/2,p=i.width;break;case"right":u=i.x+i.width-8,p=i.width-14;break;default:throw"unreachable"}f>c&&(t.beginPath(),t.rect(i.x,i.y,i.width,i.height-1),t.clip()),t.font=o,t.fillStyle=n,t.textAlign=a,t.textBaseline="bottom";var _=t.measureText(r).width;if(h&&_>p){t.beginPath(),t.rect(i.x,i.y,i.width,i.height-1),t.clip();var m=r.split(/\s(?=\b)/),y=d,v=m.shift();if(0===m.length)for(var w=t.measureText(v).width;w>p&&""!==v;)for(var b=v.length;b>0;b--){var S=v.substring(0,b);if(t.measureText(S).width<p||1===S.length){var x=v.substring(b,v.length);v=x,w=t.measureText(v).width,t.fillText(S,u,y),y+=f;break}}else for(;0!==m.length;){var C=m.shift(),M=[v,C].join(" ");t.measureText(M).width>p?(t.fillText(v,u,y),y+=f,v=C):v=M}t.fillText(v,u,y)}else{var O="…";if("right"===l)for(;_>p&&r.length>1;)r=r.length>4&&_>=2*p?r.substring(0,r.length/2+1)+O:r.substring(0,r.length-2)+O,_=t.measureText(r).width;else for(;_>p&&r.length>1;)r=r.length>4&&_>=2*p?O+r.substring(r.length/2):O+r.substring(2),_=t.measureText(r).width;t.fillText(r,u,d)}}}}}},e}(g);!function(t){t.formatGeneric=function(t){void 0===t&&(t={});var e=t.missing||"";return function(t){var i=t.value;return null==i?e:String(i)}},t.formatFixed=function(t){void 0===t&&(t={});var e=t.digits,i=t.missing||"";return function(t){var o=t.value;return null==o?i:Number(o).toFixed(e)}},t.formatPrecision=function(t){void 0===t&&(t={});var e=t.digits,i=t.missing||"";return function(t){var o=t.value;return null==o?i:Number(o).toPrecision(e)}},t.formatExponential=function(t){void 0===t&&(t={});var e=t.digits,i=t.missing||"";return function(t){var o=t.value;return null==o?i:Number(o).toExponential(e)}},t.formatIntlNumber=function(t){void 0===t&&(t={});var e=t.missing||"",i=new Intl.NumberFormat(t.locales,t.options);return function(t){var o=t.value;return null==o?e:i.format(o)}},t.formatDate=function(t){void 0===t&&(t={});var e=t.missing||"";return function(t){var i=t.value;return null==i?e:i instanceof Date?i.toDateString():new Date(i).toDateString()}},t.formatTime=function(t){void 0===t&&(t={});var e=t.missing||"";return function(t){var i=t.value;return null==i?e:i instanceof Date?i.toTimeString():new Date(i).toTimeString()}},t.formatISODateTime=function(t){void 0===t&&(t={});var e=t.missing||"";return function(t){var i=t.value;return null==i?e:i instanceof Date?i.toISOString():new Date(i).toISOString()}},t.formatUTCDateTime=function(t){void 0===t&&(t={});var e=t.missing||"";return function(t){var i=t.value;return null==i?e:i instanceof Date?i.toUTCString():new Date(i).toUTCString()}},t.formatIntlDateTime=function(t){void 0===t&&(t={});var e=t.missing||"",i=new Intl.DateTimeFormat(t.locales,t.options);return function(t){var o=t.value;return null==o?e:i.format(o)}},t.measureFontHeight=function(t){var e=j.fontHeightCache[t];if(void 0!==e)return e;j.fontMeasurementGC.font=t;var i=j.fontMeasurementGC.font;return j.fontMeasurementNode.style.font=i,document.body.appendChild(j.fontMeasurementNode),e=j.fontMeasurementNode.offsetHeight,document.body.removeChild(j.fontMeasurementNode),j.fontHeightCache[t]=e,j.fontHeightCache[i]=e,e}}(A||(A={})),function(t){var e,i;t.fontHeightCache=Object.create(null),t.fontMeasurementNode=((e=document.createElement("div")).style.position="absolute",e.style.top="-99999px",e.style.left="-99999px",e.style.visibility="hidden",e.textContent="M",e),t.fontMeasurementGC=((i=document.createElement("canvas")).width=0,i.height=0,i.getContext("2d"))}(j||(j={}));var V,Y=function(){function t(t,e){void 0===t&&(t={}),this._changed=new l.Signal(this),this._values=m({},t),this._fallback=e||new A}return Object.defineProperty(t.prototype,"changed",{get:function(){return this._changed},enumerable:!0,configurable:!0}),t.prototype.get=function(t){var e=this._values[t.region];if("function"==typeof e)try{e=e(t)}catch(t){e=void 0,console.error(t)}return e||this._fallback},t.prototype.update=function(t,e){void 0===t&&(t={}),this._values=m(m({},this._values),t),this._fallback=e||this._fallback,this._changed.emit(void 0)},t}(),X=function(){function t(t){this._count=0,this._length=0,this._sections=[],this._minimumSize=t.minimumSize||2,this._defaultSize=Math.max(this._minimumSize,Math.floor(t.defaultSize))}return Object.defineProperty(t.prototype,"length",{get:function(){return this._length},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"count",{get:function(){return this._count},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"minimumSize",{get:function(){return this._minimumSize},set:function(t){t=Math.max(2,Math.floor(t)),this._minimumSize!==t&&(this._minimumSize=t,t>this._defaultSize&&(this.defaultSize=t))},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"defaultSize",{get:function(){return this._defaultSize},set:function(t){if(t=Math.max(this._minimumSize,Math.floor(t)),this._defaultSize!==t){var e=t-this._defaultSize;if(this._defaultSize=t,this._length+=e*(this._count-this._sections.length),0!==this._sections.length)for(var i=0,o=this._sections.length;i<o;++i){var n=this._sections[i-1],r=this._sections[i];if(n){var s=r.index-n.index-1;r.offset=n.offset+n.size+s*t}else r.offset=r.index*t}}},enumerable:!0,configurable:!0}),t.prototype.clampSize=function(t){return Math.max(this._minimumSize,Math.floor(t))},t.prototype.indexOf=function(t){if(t<0||t>=this._length||0===this._count)return-1;if(0===this._sections.length)return Math.floor(t/this._defaultSize);var e=a.ArrayExt.lowerBound(this._sections,t,V.offsetCmp);if(e<this._sections.length&&this._sections[e].offset<=t)return this._sections[e].index;if(0===e)return Math.floor(t/this._defaultSize);var i=this._sections[e-1],o=t-(i.offset+i.size);return i.index+Math.floor(o/this._defaultSize)+1},t.prototype.offsetOf=function(t){if(t<0||t>=this._count)return-1;if(0===this._sections.length)return t*this._defaultSize;var e=a.ArrayExt.lowerBound(this._sections,t,V.indexCmp);if(e<this._sections.length&&this._sections[e].index===t)return this._sections[e].offset;if(0===e)return t*this._defaultSize;var i=this._sections[e-1],o=t-i.index-1;return i.offset+i.size+o*this._defaultSize},t.prototype.extentOf=function(t){if(t<0||t>=this._count)return-1;if(0===this._sections.length)return(t+1)*this._defaultSize-1;var e=a.ArrayExt.lowerBound(this._sections,t,V.indexCmp);if(e<this._sections.length&&this._sections[e].index===t)return this._sections[e].offset+this._sections[e].size-1;if(0===e)return(t+1)*this._defaultSize-1;var i=this._sections[e-1],o=t-i.index;return i.offset+i.size+o*this._defaultSize-1},t.prototype.sizeOf=function(t){if(t<0||t>=this._count)return-1;if(0===this._sections.length)return this._defaultSize;var e=a.ArrayExt.lowerBound(this._sections,t,V.indexCmp);return e<this._sections.length&&this._sections[e].index===t?this._sections[e].size:this._defaultSize},t.prototype.resize=function(t,e){if(!(t<0||t>=this._count)){e=Math.max(this._minimumSize,Math.floor(e));var i,o=a.ArrayExt.lowerBound(this._sections,t,V.indexCmp);if(o<this._sections.length&&this._sections[o].index===t)i=e-(r=this._sections[o]).size,r.size=e;else if(0===o){var n=t*this._defaultSize;a.ArrayExt.insert(this._sections,o,{index:t,offset:n,size:e}),i=e-this._defaultSize}else{var r,s=t-(r=this._sections[o-1]).index-1;n=r.offset+r.size+s*this._defaultSize,a.ArrayExt.insert(this._sections,o,{index:t,offset:n,size:e}),i=e-this._defaultSize}this._length+=i;for(var l=o+1,h=this._sections.length;l<h;++l)this._sections[l].offset+=i}},t.prototype.insert=function(t,e){if(!(e<=0)){t=Math.max(0,Math.min(t,this._count));var i=e*this._defaultSize;if(this._count+=e,this._length+=i,0!==this._sections.length)for(var o=a.ArrayExt.lowerBound(this._sections,t,V.indexCmp),n=this._sections.length;o<n;++o){var r=this._sections[o];r.index+=e,r.offset+=i}}},t.prototype.remove=function(t,e){if(!(t<0||t>=this._count||e<=0)){if(e=Math.min(this._count-t,e),0===this._sections.length)return this._count-=e,void(this._length-=e*this._defaultSize);if(e===this._count)return this._length=0,this._count=0,void(this._sections.length=0);for(var i=a.ArrayExt.lowerBound(this._sections,t,V.indexCmp),o=a.ArrayExt.lowerBound(this._sections,t+e,V.indexCmp),n=this._sections.splice(i,o-i),r=(e-n.length)*this._defaultSize,s=0,l=n.length;s<l;++s)r+=n[s].size;for(this._count-=e,this._length-=r,s=i,l=this._sections.length;s<l;++s){var h=this._sections[s];h.index-=e,h.offset-=r}}},t.prototype.move=function(t,e,i){if(!(t<0||t>=this._count||e<=0)&&0!==this._sections.length&&(e=Math.min(e,this._count-t),t!==(i=Math.min(Math.max(0,i),this._count-e)))){var o=Math.min(t,i),n=a.ArrayExt.lowerBound(this._sections,o,V.indexCmp);if(n!==this._sections.length){var r=Math.max(t+e-1,i+e-1),s=a.ArrayExt.upperBound(this._sections,r,V.indexCmp)-1;if(!(s<n)){for(var l=i<t?t:t+e,h=l-o,c=r-l+1,u=h*this._defaultSize,d=c*this._defaultSize,p=n;p<=s;++p)(_=this._sections[p]).index<l?u+=_.size-this._defaultSize:d+=_.size-this._defaultSize;var f=a.ArrayExt.lowerBound(this._sections,l,V.indexCmp);for(n<=f&&f<=s&&a.ArrayExt.rotate(this._sections,f-n,n,s),p=n;p<=s;++p){var _;(_=this._sections[p]).index<l?(_.index+=c,_.offset+=d):(_.index-=h,_.offset-=u)}}}}},t.prototype.reset=function(){this._sections.length=0,this._length=this._count*this._defaultSize},t.prototype.clear=function(){this._count=0,this._length=0,this._sections.length=0},t}();function F(t,e){return"function"==typeof t?t(e):t}!function(t){t.offsetCmp=function(t,e){return e<t.offset?1:t.offset+t.size<=e?-1:0},t.indexCmp=function(t,e){return t.index-e}}(V||(V={}));var N,K=function(){function t(){this._editor=null,this._cell=null,this._typeBasedOverrides=new Map,this._metadataBasedOverrides=new Map}return t.prototype.setEditor=function(t,e){if("string"==typeof t)this._typeBasedOverrides.set(t,e);else{var i=this._metadataIdentifierToKey(t);this._metadataBasedOverrides.set(i,[t,e])}},t.prototype.edit=function(t,e){if(!t.grid.editable)return console.error("Grid cannot be edited!"),!1;if(this.cancel(),this._cell=t,(e=e||{}).onCommit=e.onCommit||this._onCommit.bind(this),e.onCancel=e.onCancel||this._onCancel.bind(this),e.editor)return this._editor=e.editor,e.editor.edit(t,e),!0;var i=this._getEditor(t);return!!i&&(this._editor=i,i.edit(t,e),!0)},t.prototype.cancel=function(){this._editor&&(this._editor.cancel(),this._editor=null),this._cell=null},t.prototype._onCommit=function(t){var e=this._cell;if(e){var i=e.grid;i.dataModel.setData("body",e.row,e.column,t.value),i.viewport.node.focus(),"none"!==t.cursorMovement&&(i.moveCursor(t.cursorMovement),i.scrollToCursor())}},t.prototype._onCancel=function(){this._cell&&this._cell.grid.viewport.node.focus()},t.prototype._getDataTypeKey=function(t){var e=t.grid.dataModel?t.grid.dataModel.metadata("body",t.row,t.column):null;if(!e)return"default";var i="";return e&&(i=e.type),e.constraint&&e.constraint.enum&&("dynamic"===e.constraint.enum?i+=":dynamic-option":i+=":option"),i},t.prototype._objectToKey=function(t){var e="";for(var i in t){var o=t[i];e+="object"==typeof o?i+":"+this._objectToKey(o):"["+i+":"+o+"]"}return e},t.prototype._metadataIdentifierToKey=function(t){return this._objectToKey(t)},t.prototype._metadataMatchesIdentifier=function(t,e){for(var i in e){if(!t.hasOwnProperty(i))return!1;var o=e[i],n=t[i];if("object"==typeof o){if(!this._metadataMatchesIdentifier(n,o))return!1}else if(n!==o)return!1}return!0},t.prototype._getMetadataBasedEditor=function(t){var e,i=this,o=t.grid.dataModel.metadata("body",t.row,t.column);return o&&this._metadataBasedOverrides.forEach((function(n){if(!e){var r=n[0],s=n[1];i._metadataMatchesIdentifier(o,r)&&(e=F(s,t))}})),e},t.prototype._getEditor=function(t){var e,i=this._getDataTypeKey(t);if(this._typeBasedOverrides.has(i))return F(e=this._typeBasedOverrides.get(i),t);if(this._metadataBasedOverrides.size>0&&(e=this._getMetadataBasedEditor(t)))return e;switch(i){case"string":return new z;case"number":return new E;case"integer":return new k;case"boolean":return new P;case"date":return new L;case"string:option":case"number:option":case"integer:option":case"date:option":case"array:option":return new D;case"string:dynamic-option":case"number:dynamic-option":case"integer:dynamic-option":case"date:dynamic-option":return new B}if(this._typeBasedOverrides.has("default"))return F(e=this._typeBasedOverrides.get("default"),t);var o=t.grid.dataModel.data("body",t.row,t.column);return o&&"object"==typeof o?void 0:new z},t}(),q=function(t){function e(i){void 0===i&&(i={});var o=t.call(this)||this;o._scrollX=0,o._scrollY=0,o._viewportWidth=0,o._viewportHeight=0,o._mousedown=!1,o._keyHandler=null,o._mouseHandler=null,o._vScrollBarMinWidth=0,o._hScrollBarMinHeight=0,o._dpiRatio=Math.ceil(window.devicePixelRatio),o._dataModel=null,o._selectionModel=null,o._editingEnabled=!1,o.addClass("lm-DataGrid"),o.addClass("p-DataGrid"),o._style=i.style||e.defaultStyle,o._stretchLastRow=i.stretchLastRow||!1,o._stretchLastColumn=i.stretchLastColumn||!1,o._headerVisibility=i.headerVisibility||"all",o._cellRenderers=i.cellRenderers||new Y,o._copyConfig=i.copyConfig||e.defaultCopyConfig,o._cellRenderers.changed.connect(o._onRenderersChanged,o);var n=i.defaultSizes||e.defaultSizes,r=i.minimumSizes||e.minimumSizes;o._rowSections=new X({defaultSize:n.rowHeight,minimumSize:r.rowHeight}),o._columnSections=new X({defaultSize:n.columnWidth,minimumSize:r.columnWidth}),o._rowHeaderSections=new X({defaultSize:n.rowHeaderWidth,minimumSize:r.rowHeaderWidth}),o._columnHeaderSections=new X({defaultSize:n.columnHeaderHeight,minimumSize:r.columnHeaderHeight}),o._canvas=N.createCanvas(),o._buffer=N.createCanvas(),o._overlay=N.createCanvas(),o._canvasGC=o._canvas.getContext("2d"),o._bufferGC=o._buffer.getContext("2d"),o._overlayGC=o._overlay.getContext("2d"),o._canvas.style.position="absolute",o._canvas.style.top="0px",o._canvas.style.left="0px",o._canvas.style.width="0px",o._canvas.style.height="0px",o._overlay.style.position="absolute",o._overlay.style.top="0px",o._overlay.style.left="0px",o._overlay.style.width="0px",o._overlay.style.height="0px",o._viewport=new h.Widget,o._viewport.node.tabIndex=-1,o._viewport.node.style.outline="none",o._vScrollBar=new h.ScrollBar({orientation:"vertical"}),o._hScrollBar=new h.ScrollBar({orientation:"horizontal"}),o._scrollCorner=new h.Widget,o._editorController=new K,o._viewport.addClass("lm-DataGrid-viewport"),o._vScrollBar.addClass("lm-DataGrid-scrollBar"),o._hScrollBar.addClass("lm-DataGrid-scrollBar"),o._scrollCorner.addClass("lm-DataGrid-scrollCorner"),o._viewport.addClass("p-DataGrid-viewport"),o._vScrollBar.addClass("p-DataGrid-scrollBar"),o._hScrollBar.addClass("p-DataGrid-scrollBar"),o._scrollCorner.addClass("p-DataGrid-scrollCorner"),o._viewport.node.appendChild(o._canvas),o._viewport.node.appendChild(o._overlay),c.MessageLoop.installMessageHook(o._viewport,o),c.MessageLoop.installMessageHook(o._hScrollBar,o),c.MessageLoop.installMessageHook(o._vScrollBar,o),o._vScrollBar.hide(),o._hScrollBar.hide(),o._scrollCorner.hide(),o._vScrollBar.thumbMoved.connect(o._onThumbMoved,o),o._hScrollBar.thumbMoved.connect(o._onThumbMoved,o),o._vScrollBar.pageRequested.connect(o._onPageRequested,o),o._hScrollBar.pageRequested.connect(o._onPageRequested,o),o._vScrollBar.stepRequested.connect(o._onStepRequested,o),o._hScrollBar.stepRequested.connect(o._onStepRequested,o),h.GridLayout.setCellConfig(o._viewport,{row:0,column:0}),h.GridLayout.setCellConfig(o._vScrollBar,{row:0,column:1}),h.GridLayout.setCellConfig(o._hScrollBar,{row:1,column:0}),h.GridLayout.setCellConfig(o._scrollCorner,{row:1,column:1});var s=new h.GridLayout({rowCount:2,columnCount:2,rowSpacing:0,columnSpacing:0,fitPolicy:"set-no-constraint"});return s.setRowStretch(0,1),s.setRowStretch(1,0),s.setColumnStretch(0,1),s.setColumnStretch(1,0),s.addWidget(o._viewport),s.addWidget(o._vScrollBar),s.addWidget(o._hScrollBar),s.addWidget(o._scrollCorner),o.layout=s,o}return f(e,t),e.prototype.dispose=function(){this._releaseMouse(),this._keyHandler&&this._keyHandler.dispose(),this._mouseHandler&&this._mouseHandler.dispose(),this._keyHandler=null,this._mouseHandler=null,this._dataModel=null,this._selectionModel=null,this._rowSections.clear(),this._columnSections.clear(),this._rowHeaderSections.clear(),this._columnHeaderSections.clear(),t.prototype.dispose.call(this)},Object.defineProperty(e.prototype,"dataModel",{get:function(){return this._dataModel},set:function(t){this._dataModel!==t&&(this._releaseMouse(),this.selectionModel=null,this._dataModel&&this._dataModel.changed.disconnect(this._onDataModelChanged,this),t&&t.changed.connect(this._onDataModelChanged,this),this._dataModel=t,this._rowSections.clear(),this._columnSections.clear(),this._rowHeaderSections.clear(),this._columnHeaderSections.clear(),t&&(this._rowSections.insert(0,t.rowCount("body")),this._columnSections.insert(0,t.columnCount("body")),this._rowHeaderSections.insert(0,t.columnCount("row-header")),this._columnHeaderSections.insert(0,t.rowCount("column-header"))),this._scrollX=0,this._scrollY=0,this._syncViewport())},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"selectionModel",{get:function(){return this._selectionModel},set:function(t){if(this._selectionModel!==t){if(this._releaseMouse(),t&&t.dataModel!==this._dataModel)throw new Error("SelectionModel.dataModel !== DataGrid.dataModel");this._selectionModel&&this._selectionModel.changed.disconnect(this._onSelectionsChanged,this),t&&t.changed.connect(this._onSelectionsChanged,this),this._selectionModel=t,this.repaintOverlay()}},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"keyHandler",{get:function(){return this._keyHandler},set:function(t){this._keyHandler=t},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"mouseHandler",{get:function(){return this._mouseHandler},set:function(t){this._mouseHandler!==t&&(this._releaseMouse(),this._mouseHandler=t)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"style",{get:function(){return this._style},set:function(t){this._style!==t&&(this._style=m({},t),this.repaintContent(),this.repaintOverlay())},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"cellRenderers",{get:function(){return this._cellRenderers},set:function(t){this._cellRenderers!==t&&(this._cellRenderers.changed.disconnect(this._onRenderersChanged,this),t.changed.connect(this._onRenderersChanged,this),this._cellRenderers=t,this.repaintContent())},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"headerVisibility",{get:function(){return this._headerVisibility},set:function(t){this._headerVisibility!==t&&(this._headerVisibility=t,this._syncViewport())},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"defaultSizes",{get:function(){return{rowHeight:this._rowSections.defaultSize,columnWidth:this._columnSections.defaultSize,rowHeaderWidth:this._rowHeaderSections.defaultSize,columnHeaderHeight:this._columnHeaderSections.defaultSize}},set:function(t){this._rowSections.defaultSize=t.rowHeight,this._columnSections.defaultSize=t.columnWidth,this._rowHeaderSections.defaultSize=t.rowHeaderWidth,this._columnHeaderSections.defaultSize=t.columnHeaderHeight,this._syncViewport()},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"minimumSizes",{get:function(){return{rowHeight:this._rowSections.minimumSize,columnWidth:this._columnSections.minimumSize,rowHeaderWidth:this._rowHeaderSections.minimumSize,columnHeaderHeight:this._columnHeaderSections.minimumSize}},set:function(t){this._rowSections.minimumSize=t.rowHeight,this._columnSections.minimumSize=t.columnWidth,this._rowHeaderSections.minimumSize=t.rowHeaderWidth,this._columnHeaderSections.minimumSize=t.columnHeaderHeight,this._syncViewport()},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"copyConfig",{get:function(){return this._copyConfig},set:function(t){this._copyConfig=t},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"stretchLastRow",{get:function(){return this._stretchLastRow},set:function(t){t!==this._stretchLastRow&&(this._stretchLastRow=t,this._syncViewport())},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"stretchLastColumn",{get:function(){return this._stretchLastColumn},set:function(t){t!==this._stretchLastColumn&&(this._stretchLastColumn=t,this._syncViewport())},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"headerWidth",{get:function(){return"none"===this._headerVisibility||"column"===this._headerVisibility?0:this._rowHeaderSections.length},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"headerHeight",{get:function(){return"none"===this._headerVisibility||"row"===this._headerVisibility?0:this._columnHeaderSections.length},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"bodyWidth",{get:function(){return this._columnSections.length},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"bodyHeight",{get:function(){return this._rowSections.length},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"totalWidth",{get:function(){return this.headerWidth+this.bodyWidth},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"totalHeight",{get:function(){return this.headerHeight+this.bodyHeight},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"viewportWidth",{get:function(){return this._viewportWidth},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"viewportHeight",{get:function(){return this._viewportHeight},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"pageWidth",{get:function(){return Math.max(0,this.viewportWidth-this.headerWidth)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"pageHeight",{get:function(){return Math.max(0,this.viewportHeight-this.headerHeight)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"scrollX",{get:function(){return this._hScrollBar.value},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"scrollY",{get:function(){return this._vScrollBar.value},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"maxScrollX",{get:function(){return Math.max(0,this.bodyWidth-this.pageWidth-1)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"maxScrollY",{get:function(){return Math.max(0,this.bodyHeight-this.pageHeight-1)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"viewport",{get:function(){return this._viewport},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"editorController",{get:function(){return this._editorController},set:function(t){this._editorController=t},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"editingEnabled",{get:function(){return this._editingEnabled},set:function(t){this._editingEnabled=t},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"editable",{get:function(){return this._editingEnabled&&null!==this._selectionModel&&null!==this._editorController&&this.dataModel instanceof T},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"canvasGC",{get:function(){return this._canvasGC},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"rowSections",{get:function(){return this._rowSections},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"columnSections",{get:function(){return this._columnSections},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"rowHeaderSections",{get:function(){return this._rowHeaderSections},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"columnHeaderSections",{get:function(){return this._columnHeaderSections},enumerable:!0,configurable:!0}),e.prototype.scrollToRow=function(t){var e=this._rowSections.count;if(0!==e){t=Math.floor(t),t=Math.max(0,Math.min(t,e-1));var i=this._rowSections.offsetOf(t),o=this._rowSections.extentOf(t),n=this._scrollY,r=this._scrollY+this.pageHeight-1,s=0;i<n?s=i-n-10:o>r&&(s=o-r+10),0!==s&&this.scrollBy(0,s)}},e.prototype.scrollToColumn=function(t){var e=this._columnSections.count;if(0!==e){t=Math.floor(t),t=Math.max(0,Math.min(t,e-1));var i=this._columnSections.offsetOf(t),o=this._columnSections.extentOf(t),n=this._scrollX,r=this._scrollX+this.pageWidth-1,s=0;i<n?s=i-n-10:o>r&&(s=o-r+10),0!==s&&this.scrollBy(s,0)}},e.prototype.scrollToCell=function(t,e){var i=this._rowSections.count,o=this._columnSections.count;if(0!==i&&0!==o){t=Math.floor(t),e=Math.floor(e),t=Math.max(0,Math.min(t,i-1)),e=Math.max(0,Math.min(e,o-1));var n=this._columnSections.offsetOf(e),r=this._columnSections.extentOf(e),s=this._rowSections.offsetOf(t),a=this._rowSections.extentOf(t),l=this._scrollX,h=this._scrollX+this.pageWidth-1,c=this._scrollY,u=this._scrollY+this.pageHeight-1,d=0,p=0;n<l?d=n-l-10:r>h&&(d=r-h+10),s<c?p=s-c-10:a>u&&(p=a-u+10),0===d&&0===p||this.scrollBy(d,p)}},e.prototype.moveCursor=function(t){if(this.dataModel&&this._selectionModel&&!this._selectionModel.isEmpty){var e=this._selectionModel.selections();if(e.next()&&!e.next()){var i=this._selectionModel.currentSelection();if(i.r1===i.r2&&i.c1===i.c2){var o="down"===t?1:"up"===t?-1:0,n="right"===t?1:"left"===t?-1:0,r=i.r1+o,s=i.c1+n,a=this.dataModel.rowCount("body"),l=this.dataModel.columnCount("body");return r>=a?(r=0,s+=1):-1===r&&(r=a-1,s-=1),s>=l?(s=0,(r+=1)>=a&&(r=0)):-1===s&&(s=l-1,-1==(r-=1)&&(r=a-1)),void this._selectionModel.select({r1:r,c1:s,r2:r,c2:s,cursorRow:r,cursorColumn:s,clear:"all"})}}this._selectionModel.moveCursorWithinSelections(t)}},e.prototype.scrollToCursor=function(){if(this._selectionModel){var t=this._selectionModel.cursorRow,e=this._selectionModel.cursorColumn;this.scrollToCell(t,e)}},e.prototype.scrollBy=function(t,e){this.scrollTo(this.scrollX+t,this.scrollY+e)},e.prototype.scrollByPage=function(t){var e=0,i=0;switch(t){case"up":i=-this.pageHeight;break;case"down":i=this.pageHeight;break;case"left":e=-this.pageWidth;break;case"right":e=this.pageWidth;break;default:throw"unreachable"}this.scrollTo(this.scrollX+e,this.scrollY+i)},e.prototype.scrollByStep=function(t){var e,i,o=this.scrollX,n=this.scrollY,r=this._rowSections,s=this._columnSections;switch(t){case"up":n=(e=r.indexOf(n-1))<0?n:r.offsetOf(e);break;case"down":n=(e=r.indexOf(n))<0?n:r.offsetOf(e)+r.sizeOf(e);break;case"left":o=(i=s.indexOf(o-1))<0?o:s.offsetOf(i);break;case"right":o=(i=s.indexOf(o))<0?o:s.offsetOf(i)+s.sizeOf(i);break;default:throw"unreachable"}this.scrollTo(o,n)},e.prototype.scrollTo=function(t,e){t=Math.max(0,Math.min(Math.floor(t),this.maxScrollX)),e=Math.max(0,Math.min(Math.floor(e),this.maxScrollY)),this._hScrollBar.value=t,this._vScrollBar.value=e,c.MessageLoop.postMessage(this._viewport,N.ScrollRequest)},e.prototype.rowCount=function(t){return"body"===t?this._rowSections.count:this._columnHeaderSections.count},e.prototype.columnCount=function(t){return"body"===t?this._columnSections.count:this._rowHeaderSections.count},e.prototype.rowAt=function(t,e){if(e<0)return-1;if("column-header"===t)return this._columnHeaderSections.indexOf(e);var i=this._rowSections.indexOf(e);if(i>=0)return i;if(!this._stretchLastRow)return-1;var o=this.bodyHeight,n=this.pageHeight;return n<=o||e>=n?-1:this._rowSections.count-1},e.prototype.columnAt=function(t,e){if(e<0)return-1;if("row-header"===t)return this._rowHeaderSections.indexOf(e);var i=this._columnSections.indexOf(e);if(i>=0)return i;if(!this._stretchLastColumn)return-1;var o=this.bodyWidth,n=this.pageWidth;return n<=o||e>=n?-1:this._columnSections.count-1},e.prototype.rowOffset=function(t,e){return"body"===t?this._rowSections.offsetOf(e):this._columnHeaderSections.offsetOf(e)},e.prototype.columnOffset=function(t,e){return"body"===t?this._columnSections.offsetOf(e):this._rowHeaderSections.offsetOf(e)},e.prototype.rowSize=function(t,e){if("column-header"===t)return this._columnHeaderSections.sizeOf(e);var i=this._rowSections.sizeOf(e);if(i<0)return i;if(!this._stretchLastRow)return i;if(e<this._rowSections.count-1)return i;var o=this.bodyHeight,n=this.pageHeight;return n<=o?i:i+(n-o)},e.prototype.columnSize=function(t,e){if("row-header"===t)return this._rowHeaderSections.sizeOf(e);var i=this._columnSections.sizeOf(e);if(i<0)return i;if(!this._stretchLastColumn)return i;if(e<this._columnSections.count-1)return i;var o=this.bodyWidth,n=this.pageWidth;return n<=o?i:i+(n-o)},e.prototype.resizeRow=function(t,e,i){var o=new N.RowResizeRequest(t,e,i);c.MessageLoop.postMessage(this._viewport,o)},e.prototype.resizeColumn=function(t,e,i){var o=new N.ColumnResizeRequest(t,e,i);c.MessageLoop.postMessage(this._viewport,o)},e.prototype.resetRows=function(t){switch(t){case"all":this._rowSections.reset(),this._columnHeaderSections.reset();break;case"body":this._rowSections.reset();break;case"column-header":this._columnHeaderSections.reset();break;default:throw"unreachable"}this.repaintContent(),this.repaintOverlay()},e.prototype.resetColumns=function(t){switch(t){case"all":this._columnSections.reset(),this._rowHeaderSections.reset();break;case"body":this._columnSections.reset();break;case"row-header":this._rowHeaderSections.reset();break;default:throw"unreachable"}this.repaintContent(),this.repaintOverlay()},e.prototype.mapToLocal=function(t,e){var i=this._viewport.node.getBoundingClientRect(),o=i.left,n=i.top;return{lx:t-(o=Math.floor(o)),ly:e-(n=Math.floor(n))}},e.prototype.mapToVirtual=function(t,e){var i=this.mapToLocal(t,e),o=i.lx,n=i.ly;return{vx:o+this.scrollX-this.headerWidth,vy:n+this.scrollY-this.headerHeight}},e.prototype.hitTest=function(t,e){var i=this.mapToLocal(t,e),o=i.lx,n=i.ly,r=this.headerWidth,s=this.headerHeight,a=this.bodyWidth,l=this.bodyHeight,h=this.pageHeight,c=this.pageWidth;if(this._stretchLastColumn&&c>a&&(a=c),this._stretchLastRow&&h>l&&(l=h),o>=0&&o<r&&n>=0&&n<s){var u=o,d=n,p=this.rowAt("column-header",d),f=this.columnAt("row-header",u);return{region:"corner-header",row:p,column:f,x:u-this.columnOffset("row-header",f),y:d-this.rowOffset("column-header",p),width:this.columnSize("row-header",f),height:this.rowSize("column-header",p)}}if(n>=0&&n<s&&o>=0&&o<r+a){u=o+this._scrollX-r,d=n;var _=this.rowAt("column-header",d),m=this.columnAt("body",u);return{region:"column-header",row:_,column:m,x:u-this.columnOffset("body",m),y:d-this.rowOffset("column-header",_),width:this.columnSize("body",m),height:this.rowSize("column-header",_)}}if(o>=0&&o<r&&n>=0&&n<s+l){u=o,d=n+this._scrollY-s;var y=this.rowAt("body",d),v=this.columnAt("row-header",u);return{region:"row-header",row:y,column:v,x:u-this.columnOffset("row-header",v),y:d-this.rowOffset("body",y),width:this.columnSize("row-header",v),height:this.rowSize("body",y)}}if(o>=r&&o<r+a&&n>=s&&n<s+l){u=o+this._scrollX-r,d=n+this._scrollY-s;var g=this.rowAt("body",d),w=this.columnAt("body",u);return{region:"body",row:g,column:w,x:u-this.columnOffset("body",w),y:d-this.rowOffset("body",g),width:this.columnSize("body",w),height:this.rowSize("body",g)}}return{region:"void",row:-1,column:-1,x:-1,y:-1,width:-1,height:-1}},e.prototype.copyToClipboard=function(){var t,e,i=this._dataModel;if(i){var o=this._selectionModel;if(o){var r=(0,a.toArray)(o.selections());if(0!==r.length)if(r.length>1)alert("Cannot copy multiple grid selections.");else{var s=i.rowCount("body"),l=i.columnCount("body");if(0!==s&&0!==l){var h=r[0],c=h.r1,u=h.c1,d=h.r2,p=h.c2;c=Math.max(0,Math.min(c,s-1)),u=Math.max(0,Math.min(u,l-1)),d=Math.max(0,Math.min(d,s-1)),p=Math.max(0,Math.min(p,l-1)),d<c&&(c=(t=[d,c])[0],d=t[1]),p<u&&(u=(e=[p,u])[0],p=e[1]);var f=i.columnCount("row-header"),_=i.rowCount("column-header"),m=this._copyConfig.separator,y=this._copyConfig.format,v=this._copyConfig.headers,g=this._copyConfig.warningThreshold,w=d-c+1,b=p-u+1;switch(v){case"none":f=0,_=0;break;case"row":_=0,b+=f;break;case"column":f=0,w+=_;break;case"all":w+=_,b+=f;break;default:throw"unreachable"}var S=w*b;if(S>g){var x="Copying "+S+" cells may take a while. Continue?";if(!window.confirm(x))return}for(var C={region:"body",row:0,column:0,value:null,metadata:{}},M=new Array(w),O=0;O<w;++O){for(var H=new Array(b),R=0;R<b;++R){var z=void 0,E=void 0,k=void 0;O<_&&R<f?(z="corner-header",E=O,k=R):O<_?(z="column-header",E=O,k=R-f+u):R<f?(z="row-header",E=O-_+c,k=R):(z="body",E=O-_+c,k=R-f+u),C.region=z,C.row=E,C.column=k,C.value=i.data(z,E,k),C.metadata=i.metadata(z,E,k),H[R]=y(C)}M[O]=H}var L=M.map((function(t){return t.join(m)})).join("\n");n.ClipboardExt.copyText(L)}}}}},e.prototype.processMessage=function(e){if("child-shown"!==e.type&&"child-hidden"!==e.type){if("fit-request"===e.type){var i=n.ElementExt.sizeLimits(this._vScrollBar.node),o=n.ElementExt.sizeLimits(this._hScrollBar.node);this._vScrollBarMinWidth=i.minWidth,this._hScrollBarMinHeight=o.minHeight}t.prototype.processMessage.call(this,e)}},e.prototype.messageHook=function(t,e){return t===this._viewport?(this._processViewportMessage(e),!0):t===this._hScrollBar&&"activate-request"===e.type?(this.activate(),!1):t!==this._vScrollBar||"activate-request"!==e.type||(this.activate(),!1)},e.prototype.handleEvent=function(t){switch(t.type){case"keydown":this._evtKeyDown(t);break;case"mousedown":this._evtMouseDown(t);break;case"mousemove":this._evtMouseMove(t);break;case"mouseup":this._evtMouseUp(t);break;case"dblclick":this._evtMouseDoubleClick(t);break;case"mouseleave":this._evtMouseLeave(t);break;case"contextmenu":this._evtContextMenu(t);break;case"wheel":this._evtWheel(t);break;case"resize":this._refreshDPI()}},e.prototype.onActivateRequest=function(t){this.viewport.node.focus()},e.prototype.onBeforeAttach=function(t){window.addEventListener("resize",this),this.node.addEventListener("wheel",this),this._viewport.node.addEventListener("keydown",this),this._viewport.node.addEventListener("mousedown",this),this._viewport.node.addEventListener("mousemove",this),this._viewport.node.addEventListener("dblclick",this),this._viewport.node.addEventListener("mouseleave",this),this._viewport.node.addEventListener("contextmenu",this),this.repaintContent(),this.repaintOverlay()},e.prototype.onAfterDetach=function(t){window.removeEventListener("resize",this),this.node.removeEventListener("wheel",this),this._viewport.node.removeEventListener("keydown",this),this._viewport.node.removeEventListener("mousedown",this),this._viewport.node.removeEventListener("mousemove",this),this._viewport.node.removeEventListener("mouseleave",this),this._viewport.node.removeEventListener("dblclick",this),this._viewport.node.removeEventListener("contextmenu",this),this._releaseMouse()},e.prototype.onBeforeShow=function(t){this.repaintContent(),this.repaintOverlay()},e.prototype.onResize=function(t){this._editorController&&this._editorController.cancel(),this._syncScrollState()},e.prototype.repaintContent=function(){var t=new N.PaintRequest("all",0,0,0,0);c.MessageLoop.postMessage(this._viewport,t)},e.prototype.repaintRegion=function(t,e,i,o,n){var r=new N.PaintRequest(t,e,i,o,n);c.MessageLoop.postMessage(this._viewport,r)},e.prototype.repaintOverlay=function(){c.MessageLoop.postMessage(this._viewport,N.OverlayPaintRequest)},e.prototype._resizeCanvasIfNeeded=function(t,e){t*=this._dpiRatio,e*=this._dpiRatio;var i=512*(Math.ceil((t+1)/512)+1),o=512*(Math.ceil((e+1)/512)+1),n=this._canvas.width,r=this._canvas.height;if(!(n>=t&&r>=e&&n<=i&&r<=o)){var s=i-512,a=o-512;this._canvasGC.setTransform(1,0,0,1,0,0),this._bufferGC.setTransform(1,0,0,1,0,0),this._overlayGC.setTransform(1,0,0,1,0,0),n<t?this._buffer.width=s:n>i&&(this._buffer.width=i),r<e?this._buffer.height=a:r>o&&(this._buffer.height=o);var l=r>0&&r>0&&t>0&&e>0;l&&this._bufferGC.drawImage(this._canvas,0,0),n<t?(this._canvas.width=s,this._canvas.style.width=s/this._dpiRatio+"px"):n>i&&(this._canvas.width=i,this._canvas.style.width=i/this._dpiRatio+"px"),r<e?(this._canvas.height=a,this._canvas.style.height=a/this._dpiRatio+"px"):r>o&&(this._canvas.height=o,this._canvas.style.height=o/this._dpiRatio+"px"),l&&this._canvasGC.drawImage(this._buffer,0,0),l&&this._bufferGC.drawImage(this._overlay,0,0),n<t?(this._overlay.width=s,this._overlay.style.width=s/this._dpiRatio+"px"):n>i&&(this._overlay.width=i,this._overlay.style.width=i/this._dpiRatio+"px"),r<e?(this._overlay.height=a,this._overlay.style.height=a/this._dpiRatio+"px"):r>o&&(this._overlay.height=o,this._overlay.style.height=o/this._dpiRatio+"px"),l&&this._overlayGC.drawImage(this._buffer,0,0)}},e.prototype._syncScrollState=function(){var t=this.bodyWidth,e=this.bodyHeight,i=this.pageWidth,o=this.pageHeight,n=!this._vScrollBar.isHidden,r=!this._hScrollBar.isHidden,s=this._vScrollBarMinWidth,a=this._hScrollBarMinHeight,l=i+(n?s:0),u=o+(r?a:0),d=u<e-1,p=l<t-1;d&&!p&&(p=l-s<t-1),p&&!d&&(d=u-a<e-1),d===n&&p===r||(this._vScrollBar.setHidden(!d),this._hScrollBar.setHidden(!p),this._scrollCorner.setHidden(!d||!p),c.MessageLoop.sendMessage(this,h.Widget.Msg.FitRequest)),this._vScrollBar.maximum=this.maxScrollY,this._vScrollBar.page=this.pageHeight,this._hScrollBar.maximum=this.maxScrollX,this._hScrollBar.page=this.pageWidth,this._scrollTo(this._scrollX,this._scrollY)},e.prototype._syncViewport=function(){this.repaintContent(),this.repaintOverlay(),this._syncScrollState()},e.prototype._processViewportMessage=function(t){switch(t.type){case"resize":this._onViewportResize(t);break;case"scroll-request":this._onViewportScrollRequest(t);break;case"paint-request":this._onViewportPaintRequest(t);break;case"overlay-paint-request":this._onViewportOverlayPaintRequest(t);break;case"row-resize-request":this._onViewportRowResizeRequest(t);break;case"column-resize-request":this._onViewportColumnResizeRequest(t)}},e.prototype._onViewportResize=function(t){if(this._viewport.isVisible){var e=t.width,i=t.height;-1===e&&(e=this._viewport.node.offsetWidth),-1===i&&(i=this._viewport.node.offsetHeight),e=Math.round(e),i=Math.round(i);var o=this._viewportWidth,n=this._viewportHeight;if(this._viewportWidth=e,this._viewportHeight=i,this._resizeCanvasIfNeeded(e,i),0!==e&&0!==i){if(0===o||0===n)return this.paintContent(0,0,e,i),void this._paintOverlay();if(this._stretchLastColumn&&this.pageWidth>this.bodyWidth){var r=this._columnSections.offsetOf(this._columnSections.count-1),s=Math.min(this.headerWidth+r,o);this.paintContent(s,0,e-s,i)}else e>o&&this.paintContent(o,0,e-o,i);if(this._stretchLastRow&&this.pageHeight>this.bodyHeight){var a=this._rowSections.offsetOf(this._rowSections.count-1),l=Math.min(this.headerHeight+a,n);this.paintContent(0,l,e,i-l)}else i>n&&this.paintContent(0,n,e,i-n);this._paintOverlay()}}},e.prototype._onViewportScrollRequest=function(t){this._scrollTo(this._hScrollBar.value,this._vScrollBar.value)},e.prototype._onViewportPaintRequest=function(t){if(this._viewport.isVisible&&0!==this._viewportWidth&&0!==this._viewportHeight){var e,i,o,n,r=this._viewportWidth-1,s=this._viewportHeight-1,a=this._scrollX,l=this._scrollY,h=this.headerWidth,c=this.headerHeight,u=this._rowSections,d=this._columnSections,p=this._rowHeaderSections,f=this._columnHeaderSections,_=t.region,m=t.r1,y=t.c1,v=t.r2,g=t.c2;switch(_){case"all":e=0,i=0,o=r,n=s;break;case"body":m=Math.max(0,Math.min(m,u.count)),y=Math.max(0,Math.min(y,d.count)),v=Math.max(0,Math.min(v,u.count)),g=Math.max(0,Math.min(g,d.count)),e=d.offsetOf(y)-a+h,i=u.offsetOf(m)-l+c,o=d.extentOf(g)-a+h,n=u.extentOf(v)-l+c;break;case"row-header":m=Math.max(0,Math.min(m,u.count)),y=Math.max(0,Math.min(y,p.count)),v=Math.max(0,Math.min(v,u.count)),g=Math.max(0,Math.min(g,p.count)),e=p.offsetOf(y),i=u.offsetOf(m)-l+c,o=p.extentOf(g),n=u.extentOf(v)-l+c;break;case"column-header":m=Math.max(0,Math.min(m,f.count)),y=Math.max(0,Math.min(y,d.count)),v=Math.max(0,Math.min(v,f.count)),g=Math.max(0,Math.min(g,d.count)),e=d.offsetOf(y)-a+h,i=f.offsetOf(m),o=d.extentOf(g)-a+h,n=f.extentOf(v);break;case"corner-header":m=Math.max(0,Math.min(m,f.count)),y=Math.max(0,Math.min(y,p.count)),v=Math.max(0,Math.min(v,f.count)),g=Math.max(0,Math.min(g,p.count)),e=p.offsetOf(y),i=f.offsetOf(m),o=p.extentOf(g),n=f.extentOf(v);break;default:throw"unreachable"}o<0||n<0||e>r||i>s||(e=Math.max(0,Math.min(e,r)),i=Math.max(0,Math.min(i,s)),o=Math.max(0,Math.min(o,r)),n=Math.max(0,Math.min(n,s)),this.paintContent(e,i,o-e+1,n-i+1))}},e.prototype._onViewportOverlayPaintRequest=function(t){this._viewport.isVisible&&0!==this._viewportWidth&&0!==this._viewportHeight&&this._paintOverlay()},e.prototype._onViewportRowResizeRequest=function(t){"body"===t.region?this._resizeRow(t.index,t.size):this._resizeColumnHeader(t.index,t.size)},e.prototype._onViewportColumnResizeRequest=function(t){"body"===t.region?this._resizeColumn(t.index,t.size):this._resizeRowHeader(t.index,t.size)},e.prototype._onThumbMoved=function(t){c.MessageLoop.postMessage(this._viewport,N.ScrollRequest)},e.prototype._onPageRequested=function(t,e){t===this._vScrollBar?this.scrollByPage("decrement"===e?"up":"down"):this.scrollByPage("decrement"===e?"left":"right")},e.prototype._onStepRequested=function(t,e){t===this._vScrollBar?this.scrollByStep("decrement"===e?"up":"down"):this.scrollByStep("decrement"===e?"left":"right")},e.prototype._onDataModelChanged=function(t,e){switch(e.type){case"rows-inserted":this._onRowsInserted(e);break;case"columns-inserted":this._onColumnsInserted(e);break;case"rows-removed":this._onRowsRemoved(e);break;case"columns-removed":this._onColumnsRemoved(e);break;case"rows-moved":this._onRowsMoved(e);break;case"columns-moved":this._onColumnsMoved(e);break;case"cells-changed":this._onCellsChanged(e);break;case"model-reset":this._onModelReset(e);break;default:throw"unreachable"}},e.prototype._onSelectionsChanged=function(t){this.repaintOverlay()},e.prototype._onRowsInserted=function(t){var e,i=t.region,o=t.index,n=t.span;n<=0||(e="body"===i?this._rowSections:this._columnHeaderSections,this._scrollY===this.maxScrollY&&this.maxScrollY>0?(e.insert(o,n),this._scrollY=this.maxScrollY):e.insert(o,n),this._syncViewport())},e.prototype._onColumnsInserted=function(t){var e,i=t.region,o=t.index,n=t.span;n<=0||(e="body"===i?this._columnSections:this._rowHeaderSections,this._scrollX===this.maxScrollX&&this.maxScrollX>0?(e.insert(o,n),this._scrollX=this.maxScrollX):e.insert(o,n),this._syncViewport())},e.prototype._onRowsRemoved=function(t){var e,i=t.region,o=t.index,n=t.span;n<=0||(e="body"===i?this._rowSections:this._columnHeaderSections,o<0||o>=e.count||(this._scrollY===this.maxScrollY&&this.maxScrollY>0?(e.remove(o,n),this._scrollY=this.maxScrollY):e.remove(o,n),this._syncViewport()))},e.prototype._onColumnsRemoved=function(t){var e,i=t.region,o=t.index,n=t.span;n<=0||(e="body"===i?this._columnSections:this._rowHeaderSections,o<0||o>=e.count||(this._scrollX===this.maxScrollX&&this.maxScrollX>0?(e.remove(o,n),this._scrollX=this.maxScrollX):e.remove(o,n),this._syncViewport()))},e.prototype._onRowsMoved=function(t){var e,i=t.region,o=t.index,n=t.span,r=t.destination;if(!(n<=0||(e="body"===i?this._rowSections:this._columnHeaderSections,o<0||o>=e.count||(n=Math.min(n,e.count-o),o===(r=Math.min(Math.max(0,r),e.count-n)))))){var s=Math.min(o,r),a=Math.max(o+n-1,r+n-1);e.move(o,n,r),"body"===i?(this.repaintRegion("body",s,0,a,1/0),this.repaintRegion("row-header",s,0,a,1/0)):(this.repaintRegion("column-header",s,0,a,1/0),this.repaintRegion("corner-header",s,0,a,1/0)),this._syncViewport()}},e.prototype._onColumnsMoved=function(t){var e,i=t.region,o=t.index,n=t.span,r=t.destination;if(!(n<=0||(e="body"===i?this._columnSections:this._rowHeaderSections,o<0||o>=e.count||(n=Math.min(n,e.count-o),o===(r=Math.min(Math.max(0,r),e.count-n)))))){e.move(o,n,r);var s=Math.min(o,r),a=Math.max(o+n-1,r+n-1);"body"===i?(this.repaintRegion("body",0,s,1/0,a),this.repaintRegion("column-header",0,s,1/0,a)):(this.repaintRegion("row-header",0,s,1/0,a),this.repaintRegion("corner-header",0,s,1/0,a)),this._syncViewport()}},e.prototype._onCellsChanged=function(t){var e=t.region,i=t.row,o=t.column,n=t.rowSpan,r=t.columnSpan;if(!(n<=0&&r<=0)){var s=i,a=o,l=s+n-1,h=a+r-1;this.repaintRegion(e,s,a,l,h)}},e.prototype._onModelReset=function(t){var e=this._rowSections.count,i=this._columnSections.count,o=this._rowHeaderSections.count,n=this._columnHeaderSections.count,r=this._dataModel.rowCount("body")-e,s=this._dataModel.columnCount("body")-i,a=this._dataModel.columnCount("row-header")-o,l=this._dataModel.rowCount("column-header")-n;r>0?this._rowSections.insert(e,r):r<0&&this._rowSections.remove(e+r,-r),s>0?this._columnSections.insert(i,s):s<0&&this._columnSections.remove(i+s,-s),a>0?this._rowHeaderSections.insert(o,a):a<0&&this._rowHeaderSections.remove(o+a,-a),l>0?this._columnHeaderSections.insert(n,l):l<0&&this._columnHeaderSections.remove(n+l,-l),this._syncViewport()},e.prototype._onRenderersChanged=function(){this.repaintContent()},e.prototype._evtKeyDown=function(t){this._mousedown?(t.preventDefault(),t.stopPropagation()):this._keyHandler&&this._keyHandler.onKeyDown(this,t)},e.prototype._evtMouseDown=function(t){0===t.button&&(this.activate(),t.preventDefault(),t.stopPropagation(),document.addEventListener("keydown",this,!0),document.addEventListener("mouseup",this,!0),document.addEventListener("mousedown",this,!0),document.addEventListener("mousemove",this,!0),document.addEventListener("contextmenu",this,!0),this._mousedown=!0,this._mouseHandler&&this._mouseHandler.onMouseDown(this,t))},e.prototype._evtMouseMove=function(t){this._mousedown&&(t.preventDefault(),t.stopPropagation()),this._mouseHandler&&(this._mousedown?this._mouseHandler.onMouseMove(this,t):this._mouseHandler.onMouseHover(this,t))},e.prototype._evtMouseUp=function(t){0===t.button&&(t.preventDefault(),t.stopPropagation(),this._mouseHandler&&this._mouseHandler.onMouseUp(this,t),this._releaseMouse())},e.prototype._evtMouseDoubleClick=function(t){0===t.button&&(t.preventDefault(),t.stopPropagation(),this._mouseHandler&&this._mouseHandler.onMouseDoubleClick(this,t),this._releaseMouse())},e.prototype._evtMouseLeave=function(t){this._mousedown?(t.preventDefault(),t.stopPropagation()):this._mouseHandler&&this._mouseHandler.onMouseLeave(this,t)},e.prototype._evtContextMenu=function(t){this._mousedown?(t.preventDefault(),t.stopPropagation()):this._mouseHandler&&this._mouseHandler.onContextMenu(this,t)},e.prototype._evtWheel=function(t){n.Platform.accelKey(t)||this._mouseHandler&&(t.preventDefault(),t.stopPropagation(),this._mouseHandler.onWheel(this,t))},e.prototype._releaseMouse=function(){this._mousedown=!1,this._mouseHandler&&this._mouseHandler.release(),document.removeEventListener("keydown",this,!0),document.removeEventListener("mouseup",this,!0),document.removeEventListener("mousedown",this,!0),document.removeEventListener("mousemove",this,!0),document.removeEventListener("contextmenu",this,!0)},e.prototype._refreshDPI=function(){var t=Math.ceil(window.devicePixelRatio);this._dpiRatio!==t&&(this._dpiRatio=t,this.repaintContent(),this.repaintOverlay(),this._resizeCanvasIfNeeded(this._viewportWidth,this._viewportHeight),this._canvas.style.width=this._canvas.width/this._dpiRatio+"px",this._canvas.style.height=this._canvas.height/this._dpiRatio+"px",this._overlay.style.width=this._overlay.width/this._dpiRatio+"px",this._overlay.style.height=this._overlay.height/this._dpiRatio+"px")},e.prototype._resizeRow=function(t,e){var i=this._rowSections;if(!(t<0||t>=i.count)){var o=i.sizeOf(t),n=i.clampSize(e);if(o!==n){i.resize(t,n);var r=this._viewportWidth,s=this._viewportHeight;if(this._viewport.isVisible&&0!==r&&0!==s){var a=n-o,l=this.headerHeight,h=i.offsetOf(t)+l-this._scrollY;if(l>=s||h>=s)this._syncScrollState();else{if(h+o<=l)return this._scrollY+=a,void this._syncScrollState();var c=Math.max(l,h);if(h+o>=s||h+n>=s)return this.paintContent(0,c,r,s-c),this._paintOverlay(),void this._syncScrollState();var u,d,p,f=r;if(h+n<=l?(d=s-(u=l-a),p=l):(d=s-(u=h+o),p=u+a),this._blitContent(this._canvas,0,u,f,d,0,p),n>0&&h+n>l&&this.paintContent(0,c,r,h+n-c),this._stretchLastRow&&this.pageHeight>this.bodyHeight){var _=this._rowSections.count-1,m=l+this._rowSections.offsetOf(_);this.paintContent(0,m,r,s-m)}else a<0&&this.paintContent(0,s+a,r,-a);this._paintOverlay(),this._syncScrollState()}}else this._syncScrollState()}}},e.prototype._resizeColumn=function(t,e){var i=this._columnSections;if(!(t<0||t>=i.count)){var o=i.sizeOf(t),n=i.clampSize(e);if(o!==n){i.resize(t,n);var r=this._viewportWidth,s=this._viewportHeight;if(this._viewport.isVisible&&0!==r&&0!==s){var a=n-o,l=this.headerWidth,h=i.offsetOf(t)+l-this._scrollX;if(l>=r||h>=r)this._syncScrollState();else{if(h+o<=l)return this._scrollX+=a,void this._syncScrollState();var c=Math.max(l,h);if(h+o>=r||h+n>=r)return this.paintContent(c,0,r-c,s),this._paintOverlay(),void this._syncScrollState();var u,d,p,f=s;if(h+n<=l?(d=r-(u=l-a),p=l):(d=r-(u=h+o),p=u+a),this._blitContent(this._canvas,u,0,d,f,p,0),n>0&&h+n>l&&this.paintContent(c,0,h+n-c,s),this._stretchLastColumn&&this.pageWidth>this.bodyWidth){var _=this._columnSections.count-1,m=l+this._columnSections.offsetOf(_);this.paintContent(m,0,r-m,s)}else a<0&&this.paintContent(r+a,0,-a,s);this._paintOverlay(),this._syncScrollState()}}else this._syncScrollState()}}},e.prototype._resizeRowHeader=function(t,e){var i=this._rowHeaderSections;if(!(t<0||t>=i.count)){var o=i.sizeOf(t),n=i.clampSize(e);if(o!==n){i.resize(t,n);var r=this._viewportWidth,s=this._viewportHeight;if(this._viewport.isVisible&&0!==r&&0!==s){var a=n-o,l=i.offsetOf(t);if(l>=r)this._syncScrollState();else{if(l+o>=r||l+n>=r)return this.paintContent(l,0,r-l,s),this._paintOverlay(),void this._syncScrollState();var h=l+o,c=r-h,u=s,d=h+a;if(this._blitContent(this._canvas,h,0,c,u,d,0),n>0&&this.paintContent(l,0,n,s),this._stretchLastColumn&&this.pageWidth>this.bodyWidth){var p=this._columnSections.count-1,f=this.headerWidth+this._columnSections.offsetOf(p);this.paintContent(f,0,r-f,s)}else a<0&&this.paintContent(r+a,0,-a,s);this._paintOverlay(),this._syncScrollState()}}else this._syncScrollState()}}},e.prototype._resizeColumnHeader=function(t,e){var i=this._columnHeaderSections;if(!(t<0||t>=i.count)){var o=i.sizeOf(t),n=i.clampSize(e);if(o!==n){i.resize(t,n);var r=this._viewportWidth,s=this._viewportHeight;if(this._viewport.isVisible&&0!==r&&0!==s){this._paintOverlay();var a=n-o,l=i.offsetOf(t);if(l>=s)this._syncScrollState();else{if(l+o>=s||l+n>=s)return this.paintContent(0,l,r,s-l),this._paintOverlay(),void this._syncScrollState();var h=l+o,c=r,u=s-h,d=h+a;if(this._blitContent(this._canvas,0,h,c,u,0,d),n>0&&this.paintContent(0,l,r,n),this._stretchLastRow&&this.pageHeight>this.bodyHeight){var p=this._rowSections.count-1,f=this.headerHeight+this._rowSections.offsetOf(p);this.paintContent(0,f,r,s-f)}else a<0&&this.paintContent(0,s+a,r,-a);this._paintOverlay(),this._syncScrollState()}}else this._syncScrollState()}}},e.prototype._scrollTo=function(t,e){t=Math.max(0,Math.min(Math.floor(t),this.maxScrollX)),e=Math.max(0,Math.min(Math.floor(e),this.maxScrollY)),this._hScrollBar.value=t,this._vScrollBar.value=e;var i=t-this._scrollX,o=e-this._scrollY;if(0!==i||0!==o){if(!this._viewport.isVisible)return this._scrollX=t,void(this._scrollY=e);var n=this._viewportWidth,r=this._viewportHeight;if(0===n||0===r)return this._scrollX=t,void(this._scrollY=e);var s=this.headerWidth,a=this.headerHeight,l=n-s,h=r-a;if(l<=0&&h<=0)return this._scrollX=t,void(this._scrollY=e);var c=0;0!==i&&l>0&&(c=Math.abs(i)>=l?l*r:Math.abs(i)*r);var u=0;if(0!==o&&h>0&&(u=Math.abs(o)>=h?n*h:n*Math.abs(o)),c+u>=n*r)return this._scrollX=t,this._scrollY=e,this.paintContent(0,0,n,r),void this._paintOverlay();if(this._scrollY=e,0!==o&&h>0)if(Math.abs(o)>=h)this.paintContent(0,a,n,h);else{var d=o<0?a:a+o,p=n,f=h-Math.abs(o);this._blitContent(this._canvas,0,d,p,f,0,d-o),this.paintContent(0,o<0?a:r-o,n,Math.abs(o))}if(this._scrollX=t,0!==i&&l>0)if(Math.abs(i)>=l)this.paintContent(s,0,l,r);else{var _=i<0?s:s+i;p=l-Math.abs(i),f=r,this._blitContent(this._canvas,_,0,p,f,_-i,0),this.paintContent(i<0?s:n-i,0,Math.abs(i),r)}this._paintOverlay()}},e.prototype._blitContent=function(t,e,i,o,n,r,s){e*=this._dpiRatio,i*=this._dpiRatio,o*=this._dpiRatio,n*=this._dpiRatio,r*=this._dpiRatio,s*=this._dpiRatio,this._canvasGC.save(),this._canvasGC.setTransform(1,0,0,1,0,0),this._canvasGC.drawImage(t,e,i,o,n,r,s,o,n),this._canvasGC.restore()},e.prototype.paintContent=function(t,e,i,o){this._canvasGC.setTransform(this._dpiRatio,0,0,this._dpiRatio,0,0),this._bufferGC.setTransform(this._dpiRatio,0,0,this._dpiRatio,0,0),this._canvasGC.clearRect(t,e,i,o),this._drawVoidRegion(t,e,i,o),this._drawBodyRegion(t,e,i,o),this._drawRowHeaderRegion(t,e,i,o),this._drawColumnHeaderRegion(t,e,i,o),this.drawCornerHeaderRegion(t,e,i,o)},e.prototype._paintOverlay=function(){this._overlayGC.setTransform(this._dpiRatio,0,0,this._dpiRatio,0,0),this._overlayGC.clearRect(0,0,this._overlay.width,this._overlay.height),this._drawBodySelections(),this._drawRowHeaderSelections(),this._drawColumnHeaderSelections(),this._drawCursor(),this._drawShadows()},e.prototype._drawVoidRegion=function(t,e,i,o){var n=this._style.voidColor;n&&(this._canvasGC.fillStyle=n,this._canvasGC.fillRect(t,e,i,o))},e.prototype._drawBodyRegion=function(t,e,i,o){var n=this._columnSections.length-this._scrollX,r=this._rowSections.length-this._scrollY;if(!(n<=0||r<=0)){var s=this.headerWidth,a=this.headerHeight;if(!(t+i<=s||e+o<=a||t>=s+n||e>=a+r)){var l=this.bodyHeight,h=this.bodyWidth,c=this.pageHeight,u=this.pageWidth,d=Math.max(t,s),p=Math.max(e,a),f=Math.min(t+i-1,s+n-1),_=Math.min(e+o-1,a+r-1),m=this._rowSections.indexOf(p-a+this._scrollY),y=this._columnSections.indexOf(d-s+this._scrollX),v=this._rowSections.indexOf(_-a+this._scrollY),g=this._columnSections.indexOf(f-s+this._scrollX),w=this._rowSections.count-1,b=this._columnSections.count-1;v<0&&(v=w),g<0&&(g=b);for(var S=this._columnSections.offsetOf(y)+s-this._scrollX,x=this._rowSections.offsetOf(m)+a-this._scrollY,C=0,M=0,O=new Array(v-m+1),H=new Array(g-y+1),R=m;R<=v;++R){var z=this._rowSections.sizeOf(R);O[R-m]=z,M+=z}for(var E=y;E<=g;++E)z=this._columnSections.sizeOf(E),H[E-y]=z,C+=z;if(this._stretchLastRow&&c>l&&v===w){var k=this.pageHeight-this.bodyHeight;O[O.length-1]+=k,M+=k,_+=k}if(this._stretchLastColumn&&u>h&&g===b){var L=this.pageWidth-this.bodyWidth;H[H.length-1]+=L,C+=L,f+=L}var P={region:"body",xMin:d,yMin:p,xMax:f,yMax:_,x:S,y:x,width:C,height:M,row:m,column:y,rowSizes:O,columnSizes:H};this._drawBackground(P,this._style.backgroundColor),this._drawRowBackground(P,this._style.rowBackgroundColor),this._drawColumnBackground(P,this._style.columnBackgroundColor),this._drawCells(P),this._drawHorizontalGridLines(P,this._style.horizontalGridLineColor||this._style.gridLineColor),this._drawVerticalGridLines(P,this._style.verticalGridLineColor||this._style.gridLineColor)}}},e.prototype._drawRowHeaderRegion=function(t,e,i,o){var n=this.headerWidth,r=this.bodyHeight-this._scrollY;if(!(n<=0||r<=0)){var s=this.headerHeight;if(!(t+i<=0||e+o<=s||t>=0+n||e>=s+r)){var a=this.bodyHeight,l=this.pageHeight,h=t,c=Math.max(e,s),u=Math.min(t+i-1,0+n-1),d=Math.min(e+o-1,s+r-1),p=this._rowSections.indexOf(c-s+this._scrollY),f=this._rowHeaderSections.indexOf(h),_=this._rowSections.indexOf(d-s+this._scrollY),m=this._rowHeaderSections.indexOf(u),y=this._rowSections.count-1,v=this._rowHeaderSections.count-1;_<0&&(_=y),m<0&&(m=v);for(var g=this._rowHeaderSections.offsetOf(f),w=this._rowSections.offsetOf(p)+s-this._scrollY,b=0,S=0,x=new Array(_-p+1),C=new Array(m-f+1),M=p;M<=_;++M){var O=this._rowSections.sizeOf(M);x[M-p]=O,S+=O}for(var H=f;H<=m;++H)O=this._rowHeaderSections.sizeOf(H),C[H-f]=O,b+=O;if(this._stretchLastRow&&l>a&&_===y){var R=this.pageHeight-this.bodyHeight;x[x.length-1]+=R,S+=R,d+=R}var z={region:"row-header",xMin:h,yMin:c,xMax:u,yMax:d,x:g,y:w,width:b,height:S,row:p,column:f,rowSizes:x,columnSizes:C};this._drawBackground(z,this._style.headerBackgroundColor),this._drawCells(z),this._drawHorizontalGridLines(z,this._style.headerHorizontalGridLineColor||this._style.headerGridLineColor),this._drawVerticalGridLines(z,this._style.headerVerticalGridLineColor||this._style.headerGridLineColor)}}},e.prototype._drawColumnHeaderRegion=function(t,e,i,o){var n=this.bodyWidth-this._scrollX,r=this.headerHeight;if(!(n<=0||r<=0)){var s=this.headerWidth;if(!(t+i<=s||e+o<=0||t>=s+n||e>=0+r)){var a=this.bodyWidth,l=this.pageWidth,h=Math.max(t,s),c=e,u=Math.min(t+i-1,s+n-1),d=Math.min(e+o-1,0+r-1),p=this._columnHeaderSections.indexOf(c),f=this._columnSections.indexOf(h-s+this._scrollX),_=this._columnHeaderSections.indexOf(d),m=this._columnSections.indexOf(u-s+this._scrollX),y=this._columnHeaderSections.count-1,v=this._columnSections.count-1;_<0&&(_=y),m<0&&(m=v);for(var g=this._columnSections.offsetOf(f)+s-this._scrollX,w=this._columnHeaderSections.offsetOf(p),b=0,S=0,x=new Array(_-p+1),C=new Array(m-f+1),M=p;M<=_;++M){var O=this._columnHeaderSections.sizeOf(M);x[M-p]=O,S+=O}for(var H=f;H<=m;++H)O=this._columnSections.sizeOf(H),C[H-f]=O,b+=O;if(this._stretchLastColumn&&l>a&&m===v){var R=this.pageWidth-this.bodyWidth;C[C.length-1]+=R,b+=R,u+=R}var z={region:"column-header",xMin:h,yMin:c,xMax:u,yMax:d,x:g,y:w,width:b,height:S,row:p,column:f,rowSizes:x,columnSizes:C};this._drawBackground(z,this._style.headerBackgroundColor),this._drawCells(z),this._drawHorizontalGridLines(z,this._style.headerHorizontalGridLineColor||this._style.headerGridLineColor),this._drawVerticalGridLines(z,this._style.headerVerticalGridLineColor||this._style.headerGridLineColor)}}},e.prototype.drawCornerHeaderRegion=function(t,e,i,o){var n=this.headerWidth,r=this.headerHeight;if(!(n<=0||r<=0||t+i<=0||e+o<=0||t>=0+n||e>=0+r)){var s=t,a=e,l=Math.min(t+i-1,0+n-1),h=Math.min(e+o-1,0+r-1),c=this._columnHeaderSections.indexOf(a),u=this._rowHeaderSections.indexOf(s),d=this._columnHeaderSections.indexOf(h),p=this._rowHeaderSections.indexOf(l);d<0&&(d=this._columnHeaderSections.count-1),p<0&&(p=this._rowHeaderSections.count-1);for(var f=this._rowHeaderSections.offsetOf(u),_=this._columnHeaderSections.offsetOf(c),m=0,y=0,v=new Array(d-c+1),g=new Array(p-u+1),w=c;w<=d;++w){var b=this._columnHeaderSections.sizeOf(w);v[w-c]=b,y+=b}for(var S=u;S<=p;++S)b=this._rowHeaderSections.sizeOf(S),g[S-u]=b,m+=b;var x={region:"corner-header",xMin:s,yMin:a,xMax:l,yMax:h,x:f,y:_,width:m,height:y,row:c,column:u,rowSizes:v,columnSizes:g};this._drawBackground(x,this._style.headerBackgroundColor),this._drawCells(x),this._drawHorizontalGridLines(x,this._style.headerHorizontalGridLineColor||this._style.headerGridLineColor),this._drawVerticalGridLines(x,this._style.headerVerticalGridLineColor||this._style.headerGridLineColor)}},e.prototype._drawBackground=function(t,e){if(e){var i=t.xMin,o=t.yMin,n=t.xMax,r=t.yMax;this._canvasGC.fillStyle=e,this._canvasGC.fillRect(i,o,n-i+1,r-o+1)}},e.prototype._drawRowBackground=function(t,e){if(e)for(var i=Math.max(t.xMin,t.x),o=Math.min(t.x+t.width-1,t.xMax),n=t.y,r=0,s=t.rowSizes.length;r<s;++r){var a=t.rowSizes[r];if(0!==a){var l=e(t.row+r);if(l){var h=Math.max(t.yMin,n),c=Math.min(n+a-1,t.yMax);this._canvasGC.fillStyle=l,this._canvasGC.fillRect(i,h,o-i+1,c-h+1)}n+=a}}},e.prototype._drawColumnBackground=function(t,e){if(e)for(var i=Math.max(t.yMin,t.y),o=Math.min(t.y+t.height-1,t.yMax),n=t.x,r=0,s=t.columnSizes.length;r<s;++r){var a=t.columnSizes[r];if(0!==a){var l=e(t.column+r);if(l){var h=Math.max(t.xMin,n),c=Math.min(n+a-1,t.xMax);this._canvasGC.fillStyle=l,this._canvasGC.fillRect(h,i,c-h+1,o-i+1)}n+=a}}},e.prototype._drawCells=function(t){if(this._dataModel){var e={x:0,y:0,width:0,height:0,region:t.region,row:0,column:0,value:null,metadata:W.emptyMetadata};this._bufferGC.save();for(var i=new I(this._bufferGC),o=Math.max(t.yMin,t.y),n=Math.min(t.y+t.height-1,t.yMax),r=t.x,s=0,a=t.columnSizes.length;s<a;++s){var l=t.columnSizes[s];if(0!==l){var h=t.column+s;e.x=r,e.width=l,e.column=h,i.clearRect(r,t.y,l,t.height),i.save();for(var c=t.y,u=0,d=t.rowSizes.length;u<d;++u){var p=t.rowSizes[u];if(0!==p){var f=t.row+u,_=void 0;try{_=this._dataModel.data(t.region,f,h)}catch(t){_=void 0,console.error(t)}var m=void 0;try{m=this._dataModel.metadata(t.region,f,h)}catch(t){m=W.emptyMetadata,console.error(t)}e.y=c,e.height=p,e.row=f,e.value=_,e.metadata=m;var y=this._cellRenderers.get(e);i.save();try{y.paint(i,e)}catch(t){console.error(t)}i.restore(),c+=p}}i.restore();var v=Math.max(t.xMin,r),g=Math.min(r+l-1,t.xMax);this._blitContent(this._buffer,v,o,g-v+1,n-o+1,v,o),r+=l}}i.dispose(),this._bufferGC.restore()}},e.prototype._drawHorizontalGridLines=function(t,e){if(e){var i=Math.max(t.xMin,t.x),o=Math.min(t.x+t.width,t.xMax+1);this._canvasGC.beginPath(),this._canvasGC.lineWidth=1;var n=this.bodyHeight,r=this.pageHeight,s=t.rowSizes.length;this._stretchLastRow&&r>n&&t.row+s===this._rowSections.count&&(s-=1);for(var a=t.y,l=0;l<s;++l){var h=t.rowSizes[l];if(0!==h){var c=a+h-1;c>=t.yMin&&c<=t.yMax&&(this._canvasGC.moveTo(i,c+.5),this._canvasGC.lineTo(o,c+.5)),a+=h}}this._canvasGC.strokeStyle=e,this._canvasGC.stroke()}},e.prototype._drawVerticalGridLines=function(t,e){if(e){var i=Math.max(t.yMin,t.y),o=Math.min(t.y+t.height,t.yMax+1);this._canvasGC.beginPath(),this._canvasGC.lineWidth=1;var n=this.bodyWidth,r=this.pageWidth,s=t.columnSizes.length;this._stretchLastColumn&&r>n&&t.column+s===this._columnSections.count&&(s-=1);for(var a=t.x,l=0;l<s;++l){var h=t.columnSizes[l];if(0!==h){var c=a+h-1;c>=t.xMin&&c<=t.xMax&&(this._canvasGC.moveTo(c+.5,i),this._canvasGC.lineTo(c+.5,o)),a+=h}}this._canvasGC.strokeStyle=e,this._canvasGC.stroke()}},e.prototype._drawBodySelections=function(){var t=this._selectionModel;if(t&&!t.isEmpty){var e=this._style.selectionFillColor,i=this._style.selectionBorderColor;if(e||i){var o=this._scrollX,n=this._scrollY,r=this._rowSections.indexOf(n),s=this._columnSections.indexOf(o);if(!(r<0||s<0)){var a=this.bodyWidth,l=this.bodyHeight,h=this.pageWidth,c=this.pageHeight,u=this.headerWidth,d=this.headerHeight,p=this._rowSections.indexOf(n+c),f=this._columnSections.indexOf(o+h),_=this._rowSections.count-1,m=this._columnSections.count-1;p=p<0?_:p,f=f<0?m:f;var y=this._overlayGC;y.save(),y.beginPath(),y.rect(u,d,h,c),y.clip(),e&&(y.fillStyle=e),i&&(y.strokeStyle=i,y.lineWidth=1);for(var v,g=t.selections();void 0!==(v=g.next());)if(!(v.r1<r&&v.r2<r||v.r1>p&&v.r2>p||v.c1<s&&v.c2<s||v.c1>f&&v.c2>f)){var w=Math.max(0,Math.min(v.r1,_)),b=Math.max(0,Math.min(v.c1,m)),S=Math.max(0,Math.min(v.r2,_)),x=Math.max(0,Math.min(v.c2,m)),C=void 0;w>S&&(C=w,w=S,S=C),b>x&&(C=b,b=x,x=C);var M=this._columnSections.offsetOf(b)-o+u,O=this._rowSections.offsetOf(w)-n+d,H=this._columnSections.extentOf(x)-o+u,R=this._rowSections.extentOf(S)-n+d;this._stretchLastColumn&&h>a&&x===m&&(H=u+h-1),this._stretchLastRow&&c>l&&S===_&&(R=d+c-1),M=Math.max(u-1,M),O=Math.max(d-1,O),H=Math.min(u+h+1,H),R=Math.min(d+c+1,R),H<M||R<O||(e&&y.fillRect(M,O,H-M+1,R-O+1),i&&y.strokeRect(M-.5,O-.5,H-M+1,R-O+1))}y.restore()}}}},e.prototype._drawRowHeaderSelections=function(){var t=this._selectionModel;if(t&&!t.isEmpty&&"column"!=t.selectionMode&&0!==this.headerWidth&&0!==this.pageHeight){var e=this._style.headerSelectionFillColor,i=this._style.headerSelectionBorderColor;if(e||i){var o=this._scrollY,n=this.bodyHeight,r=this.pageHeight,s=this.headerWidth,a=this.headerHeight,l=this._rowSections,h=this._overlayGC;h.save(),h.beginPath(),h.rect(0,a,s,r),h.clip(),e&&(h.fillStyle=e),i&&(h.strokeStyle=i,h.lineWidth=1);var c=l.count-1,u=l.indexOf(o),d=l.indexOf(o+r-1);d=d<0?c:d;for(var p=u;p<=d;++p)if(t.isRowSelected(p)){var f=l.offsetOf(p)-o+a,_=l.sizeOf(p);this._stretchLastRow&&r>n&&p===c&&(_=a+r-f),0!==_&&(e&&h.fillRect(0,f,s,_),i&&(h.beginPath(),h.moveTo(s-.5,f-1),h.lineTo(s-.5,f+_),h.stroke()))}h.restore()}}},e.prototype._drawColumnHeaderSelections=function(){var t=this._selectionModel;if(t&&!t.isEmpty&&"row"!=t.selectionMode&&0!==this.headerHeight&&0!==this.pageWidth){var e=this._style.headerSelectionFillColor,i=this._style.headerSelectionBorderColor;if(e||i){var o=this._scrollX,n=this.bodyWidth,r=this.pageWidth,s=this.headerWidth,a=this.headerHeight,l=this._columnSections,h=this._overlayGC;h.save(),h.beginPath(),h.rect(s,0,r,a),h.clip(),e&&(h.fillStyle=e),i&&(h.strokeStyle=i,h.lineWidth=1);var c=l.count-1,u=l.indexOf(o),d=l.indexOf(o+r-1);d=d<0?c:d;for(var p=u;p<=d;++p)if(t.isColumnSelected(p)){var f=l.offsetOf(p)-o+s,_=l.sizeOf(p);this._stretchLastColumn&&r>n&&p===c&&(_=s+r-f),0!==_&&(e&&h.fillRect(f,0,_,a),i&&(h.beginPath(),h.moveTo(f-1,a-.5),h.lineTo(f+_,a-.5),h.stroke()))}h.restore()}}},e.prototype._drawCursor=function(){var t=this._selectionModel;if(t&&!t.isEmpty&&"cell"===t.selectionMode){var e=this._style.cursorFillColor,i=this._style.cursorBorderColor;if(e||i){var o=t.cursorRow,n=t.cursorColumn,r=this._rowSections.count-1,s=this._columnSections.count-1;if(!(o<0||o>r||n<0||n>s)){var a=this._scrollX,l=this._scrollY,h=this.bodyWidth,c=this.bodyHeight,u=this.pageWidth,d=this.pageHeight,p=this.headerWidth,f=this.headerHeight,_=this._viewportWidth,m=this._viewportHeight,y=this._columnSections.offsetOf(n)-a+p,v=this._columnSections.extentOf(n)-a+p,g=this._rowSections.offsetOf(o)-l+f,w=this._rowSections.extentOf(o)-l+f;if(this._stretchLastColumn&&u>h&&n===s&&(v=_-1),this._stretchLastRow&&d>c&&o===r&&(w=m-1),!(v<y||w<g||y-1>=_||g-1>=m||v+1<p||w+1<f)){var b=this._overlayGC;b.save(),b.beginPath(),b.rect(p,f,u,d),b.clip(),b.clearRect(y,g,v-y+1,w-g+1),e&&(b.fillStyle=e,b.fillRect(y,g,v-y+1,w-g+1)),i&&(b.strokeStyle=i,b.lineWidth=2,b.strokeRect(y,g,v-y,w-g)),b.restore()}}}}},e.prototype._drawShadows=function(){var t=this._style.scrollShadow;if(t){var e=this._scrollX,i=this._scrollY,o=this.maxScrollX,n=this.maxScrollY,r=this.headerWidth,s=this.headerHeight,a=this.pageWidth,l=this.pageHeight,h=this._viewportWidth,c=this._viewportHeight,u=this.bodyWidth,d=this.bodyHeight;this._stretchLastRow&&l>d&&(d=l),this._stretchLastColumn&&a>u&&(u=a);var p,f=this._overlayGC;if(f.save(),i>0){var _=0,m=0,y=(S=s)+t.size;(p=f.createLinearGradient(_,S,m,y)).addColorStop(0,t.color1),p.addColorStop(.5,t.color2),p.addColorStop(1,t.color3);var v=0,g=s,w=r+Math.min(a,u-e),b=t.size;f.fillStyle=p,f.fillRect(v,g,w,b)}if(e>0){var S=0;m=(_=r)+t.size,y=0,(p=f.createLinearGradient(_,S,m,y)).addColorStop(0,t.color1),p.addColorStop(.5,t.color2),p.addColorStop(1,t.color3),v=r,g=0,w=t.size,b=s+Math.min(l,d-i),f.fillStyle=p,f.fillRect(v,g,w,b)}if(i<n&&(_=0,S=c,m=0,y=c-t.size,(p=f.createLinearGradient(_,S,m,y)).addColorStop(0,t.color1),p.addColorStop(.5,t.color2),p.addColorStop(1,t.color3),v=0,g=c-t.size,w=r+Math.min(a,u-e),b=t.size,f.fillStyle=p,f.fillRect(v,g,w,b)),e<o)_=h,S=0,m=h-t.size,y=0,(p=f.createLinearGradient(_,S,m,y)).addColorStop(0,t.color1),p.addColorStop(.5,t.color2),p.addColorStop(1,t.color3),v=h-t.size,g=0,w=t.size,b=s+Math.min(l,d-i),f.fillStyle=p,f.fillRect(v,g,w,b);f.restore()}},e}(h.Widget);!function(t){function e(t){return null===t.value||void 0===t.value?"":String(t.value)}t.copyFormatGeneric=e,t.defaultStyle={voidColor:"#F3F3F3",backgroundColor:"#FFFFFF",gridLineColor:"rgba(20, 20, 20, 0.15)",headerBackgroundColor:"#F3F3F3",headerGridLineColor:"rgba(20, 20, 20, 0.25)",selectionFillColor:"rgba(49, 119, 229, 0.2)",selectionBorderColor:"rgba(0, 107, 247, 1.0)",cursorBorderColor:"rgba(0, 107, 247, 1.0)",headerSelectionFillColor:"rgba(20, 20, 20, 0.1)",headerSelectionBorderColor:"rgba(0, 107, 247, 1.0)",scrollShadow:{size:10,color1:"rgba(0, 0, 0, 0.20)",color2:"rgba(0, 0, 0, 0.05)",color3:"rgba(0, 0, 0, 0.00)"}},t.defaultSizes={rowHeight:20,columnWidth:64,rowHeaderWidth:64,columnHeaderHeight:20},t.minimumSizes={rowHeight:20,columnWidth:10,rowHeaderWidth:10,columnHeaderHeight:20},t.defaultCopyConfig={separator:"\t",format:e,headers:"none",warningThreshold:1e6}}(q||(q={})),function(t){t.ScrollRequest=new c.ConflatableMessage("scroll-request"),t.OverlayPaintRequest=new c.ConflatableMessage("overlay-paint-request"),t.createCanvas=function(){var t=document.createElement("canvas");return t.width=0,t.height=0,t};var e=function(t){function e(e,i,o,n,r){var s=t.call(this,"paint-request")||this;return s._region=e,s._r1=i,s._c1=o,s._r2=n,s._c2=r,s}return f(e,t),Object.defineProperty(e.prototype,"region",{get:function(){return this._region},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"r1",{get:function(){return this._r1},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"c1",{get:function(){return this._c1},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"r2",{get:function(){return this._r2},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"c2",{get:function(){return this._c2},enumerable:!0,configurable:!0}),e.prototype.conflate=function(t){return"all"===this._region||("all"===t._region?(this._region="all",!0):this._region===t._region&&(this._r1=Math.min(this._r1,t._r1),this._c1=Math.min(this._c1,t._c1),this._r2=Math.max(this._r2,t._r2),this._c2=Math.max(this._c2,t._c2),!0))},e}(c.ConflatableMessage);t.PaintRequest=e;var i=function(t){function e(e,i,o){var n=t.call(this,"row-resize-request")||this;return n._region=e,n._index=i,n._size=o,n}return f(e,t),Object.defineProperty(e.prototype,"region",{get:function(){return this._region},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"index",{get:function(){return this._index},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"size",{get:function(){return this._size},enumerable:!0,configurable:!0}),e.prototype.conflate=function(t){return this._region===t._region&&this._index===t._index&&(this._size=t._size,!0)},e}(c.ConflatableMessage);t.RowResizeRequest=i;var o=function(t){function e(e,i,o){var n=t.call(this,"column-resize-request")||this;return n._region=e,n._index=i,n._size=o,n}return f(e,t),Object.defineProperty(e.prototype,"region",{get:function(){return this._region},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"index",{get:function(){return this._index},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"size",{get:function(){return this._size},enumerable:!0,configurable:!0}),e.prototype.conflate=function(t){return this._region===t._region&&this._index===t._index&&(this._size=t._size,!0)},e}(c.ConflatableMessage);t.ColumnResizeRequest=o}(N||(N={}));var U,J=function(t){function e(e){var i=t.call(this)||this,o=U.splitFields(e.schema);return i._data=e.data,i._bodyFields=o.bodyFields,i._headerFields=o.headerFields,i._missingValues=U.createMissingMap(e.schema),i}return f(e,t),e.prototype.rowCount=function(t){return"body"===t?this._data.length:1},e.prototype.columnCount=function(t){return"body"===t?this._bodyFields.length:this._headerFields.length},e.prototype.data=function(t,e,i){var o,n;switch(t){case"body":o=this._bodyFields[i],n=this._data[e][o.name];break;case"column-header":n=(o=this._bodyFields[i]).title||o.name;break;case"row-header":o=this._headerFields[i],n=this._data[e][o.name];break;case"corner-header":n=(o=this._headerFields[i]).title||o.name;break;default:throw"unreachable"}return null!==this._missingValues&&"string"==typeof n&&!0===this._missingValues[n]?null:n},e.prototype.metadata=function(t,e,i){return"body"===t||"column-header"===t?this._bodyFields[i]:this._headerFields[i]},e}(W);!function(t){t.splitFields=function(t){var e;e=void 0===t.primaryKey?[]:"string"==typeof t.primaryKey?[t.primaryKey]:t.primaryKey;for(var i=[],o=[],n=0,r=t.fields;n<r.length;n++){var s=r[n];-1===e.indexOf(s.name)?i.push(s):o.push(s)}return{bodyFields:i,headerFields:o}},t.createMissingMap=function(t){if(!t.missingValues||0===t.missingValues.length)return null;for(var e=Object.create(null),i=0,o=t.missingValues;i<o.length;i++)e[o[i]]=!0;return e}}(U||(U={}))},34938:(t,e,i)=>{function o(){return r.keyboardLayout}i.d(e,{Vc:()=>o});var n=function(){function t(e,i){this.name=e,this._codes=i,this._keys=t.extractKeys(i)}return t.prototype.keys=function(){return Object.keys(this._keys)},t.prototype.isValidKey=function(t){return t in this._keys},t.prototype.keyForKeydownEvent=function(t){return this._codes[t.keyCode]||""},t}();!function(t){t.extractKeys=function(t){var e=Object.create(null);for(var i in t)e[t[i]]=!0;return e}}(n||(n={}));var r,s=new n("en-us",{8:"Backspace",9:"Tab",13:"Enter",19:"Pause",27:"Escape",32:"Space",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",45:"Insert",46:"Delete",48:"0",49:"1",50:"2",51:"3",52:"4",53:"5",54:"6",55:"7",56:"8",57:"9",59:";",61:"=",65:"A",66:"B",67:"C",68:"D",69:"E",70:"F",71:"G",72:"H",73:"I",74:"J",75:"K",76:"L",77:"M",78:"N",79:"O",80:"P",81:"Q",82:"R",83:"S",84:"T",85:"U",86:"V",87:"W",88:"X",89:"Y",90:"Z",93:"ContextMenu",96:"0",97:"1",98:"2",99:"3",100:"4",101:"5",102:"6",103:"7",104:"8",105:"9",106:"*",107:"+",109:"-",110:".",111:"/",112:"F1",113:"F2",114:"F3",115:"F4",116:"F5",117:"F6",118:"F7",119:"F8",120:"F9",121:"F10",122:"F11",123:"F12",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'"});!function(t){t.keyboardLayout=s}(r||(r={}))}}]);
  //# sourceMappingURL=8921.7a197b64ad40a4f01276.js.map