@omegagrid/bundle 0.10.49 → 0.10.50

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/omegagrid.js +2 -2
  2. package/package.json +18 -18
package/omegagrid.js CHANGED
@@ -4393,7 +4393,7 @@
4393
4393
  </style>
4394
4394
 
4395
4395
  ${this.table}
4396
- `,this.clearHeaderCache=()=>{this.resetFreezeLeft(),this.hCache=new Dx(this.model.columns.length,this.columnHeaderCount),this.hCache.disabled=!this.model.options.cellCache},this.clearBodyCache=()=>{this.bCache=new Dx(this.model.columns.length,this.model.rows.length),this.bCache.disabled=!this.model.options.cellCache},this.cellRenderSchedules=new WeakMap}get thead(){return this._thead?this._thead:this._thead=yt("thead")}get tbody(){return this._tbody?this._tbody:this._tbody=yt("tbody")}get colgroup(){return this._colgroup?this._colgroup:this._colgroup=yt("colgroup")}get table(){return this._table||(this._table=yt("table"),this._table.appendChild(this.colgroup),this._table.appendChild(this.thead),this._table.appendChild(this.tbody)),this._table}get colMap(){return this._colMap}get rowMap(){return this._rowMap}get freezeLeft(){if(null==this._freezeLeft){const t=this.model.options.freezeLeft;if(t>=this.model.columns.length)this._freezeLeft=0;else if(this.offsetWidth>0){let e=0;for(let i=0;i<t;i++)e+=this.model.columns[i].width;this._freezeLeft=e<this.offsetWidth/2?t:0}else this._freezeLeft=t}return this._freezeLeft}get freezeTop(){return null==this._freezeTop&&(this._freezeTop=this.model.options.freezeTop),this._freezeTop}previewZoom(t){Jt(this.table,t)}highlightColHeaderCells(t){if(!this.model.options.colLetters)return;this._highlightedColHeaderCells.forEach((t=>t.className="hlabel")),this._highlightedColHeaderCells=[];const e=this.rowHeaderCount;t.forEach((t=>{const i=this.hRows[this.model.hasColumnTreeEnabled?1:0].children[this.colMap.get(t)+e];i&&(this._highlightedColHeaderCells.push(i),i.className="hlabel selected")}))}highlightRowHeaderCells(t){this.model.options.rowNumbers&&0!=this.model.rows.length&&(this._highlightedRowHeaderCells.forEach((t=>t.className="vlabel")),this._highlightedRowHeaderCells=[],t.forEach((t=>{const e=this.getRowByModelIndex(t)?.children[this.model.hasRowTreeEnabled?1:0];e&&(this._highlightedRowHeaderCells.push(e),e.className="vlabel selected")})))}get columnHeaderCount(){return this.model.headerCount+(this.model.hasColumnTreeEnabled?1:0)+(this.model.hasFilter?1:0)+(this.model.options.colLetters?1:0)}get rowHeaderCount(){return(this.model.hasRowTreeEnabled?1:0)+(this.model.options.rowNumbers?1:0)}get renderRowCount(){return this.renderAll?this.model.visibleRows.length:Math.round(Math.min(this.clientHeight/Ax.MIN_ROW_HEIGHT,this.model.rows.length))}get renderColCount(){return this.renderAll?this.model.visibleColumns.length+this.rowHeaderCount:Math.round(Math.min(this.clientWidth/Ax.MIN_COL_WIDTH||5,this.model.columns.length+this.rowHeaderCount))}get totalHeaderHeight(){let t=0,e=0;this.model.hasColumnTreeEnabled&&(t+=this.treeHeaderHeight,++e),this.model.options.colLetters&&(t+=this.thead.children[e].offsetHeight||this.model.options.rowHeight,++e);for(let i=0;i<this.model.headerCount;i++)t+=this.thead.children[e+i].offsetHeight||this.model.options.rowHeight;return this.model.hasFilter&&(t+=this.model.options.rowHeight),t}get treeHeaderWidth(){return this.model.hasRowTreeEnabled?15*this.model.maxRowLevel+20:0}get treeHeaderHeight(){return this.model.hasColumnTree?15*this.model.maxColumnLevel+20:0}get totalHeaderWidth(){let t=0;return this.model.options.rowNumbers&&(t+=Ax.ROW_HEADER_WIDTH),t+=this.treeHeaderWidth,t}get viewportSize(){return this._viewportSize||(this._viewportSize=this.renderAll?{w:1/0,h:1/0}:{w:(this.clientWidth-this.totalHeaderWidth-Ax.SLIDER_SIZE)/this.zoom,h:(this.clientHeight-this.totalHeaderHeight-Ax.SLIDER_SIZE)/this.zoom}),this._viewportSize}get viewport(){return this._viewport||(this._viewport=this.model.getViewport({c:this.colOffset,r:this.rowOffset},this.viewportSize,{t:this.model.options.freezeTop,l:this.freezeLeft,b:this.model.options.freezeBottom,r:this.model.options.freezeRight})),this._viewport}get viewportRange(){return 0==this.viewport.columns.length||0==this.viewport.rows.length?null:new Ev(this.viewport.columns[0].index,this.viewport.rows[0].index,this.viewport.columns[this.viewport.columns.length-1].index,this.viewport.rows[this.viewport.rows.length-1].index)}findColumnIndexByOffset(t){let e=0;const i=this.colgroup.children;for(let o=0;o<i.length;o++)if(e+=i[o].offsetWidth,e>=t)return o;return-1}findRowByOffset(t){const e=(t>this.thead.offsetHeight?this.tbody:this.thead).children;t>this.thead.offsetHeight&&(t-=this.thead.offsetHeight);let i=0;for(let o=0;o<e.length;o++){const r=e[o];if(i+=r.offsetHeight,i>=t)return r}return null}findTableCellByOffset(t,e){t/=this.zoom,e/=this.zoom;const i=this.findRowByOffset(e),o=this.findColumnIndexByOffset(t),r=i&&o>-1?i.children[o]:null;return r&&!Ct(r)?r:null}findNearestTableCellByOffset(t,e){let i,o;t/=this.zoom,e/=this.zoom;const r=this.findRowByOffset(e),s=this.findColumnIndexByOffset(t);i=e<0?this.tbody.children[0]:e>this.tbody.offsetHeight+this.thead.offsetHeight?this.tbody.children[this.viewport.rows.length-1]:r,o=t<0?this.rowHeaderCount:t>=this.tbody.offsetWidth?this.viewport.columns.length+this.rowHeaderCount-1:s;let n=i&&o>-1?i.children[o]:null;for(;n&&Ct(n);)n=n.previousElementSibling;const a=r&&s>-1?r.children[s]:null;return[n,a&&!Ct(a)?a:null]}connectedCallback(){super.connectedCallback(),this.grid=Et(this,"og-grid")}willUpdate(){this._viewport=null,this._viewportSize=null,this.model&&(this.clearHeaderCache(),this.clearBodyCache())}updated(){this.model&&(this.createColumns(),this.createHeaderRows(),this.createBodyRows(),this.renderCells())}refresh(){this.clearHeaderCache(),this.clearBodyCache(),this.requestUpdate()}createColumns(){this._freezeLeft=null;const t=this.renderColCount;if(!this.cols||this.cols.length!=t){this.cols=new Array(t);for(let e=0;e<t;e++)this.cols[e]=yt("col"),this.cols.forEach((()=>this.colgroup.appendChild(this.cols[e])))}}createHeaderRows(){const t=this.columnHeaderCount,e=this.renderColCount;if(St(this.thead),!this.hRows||this.hRows.length!=t||!this.hRows[0]||this.hRows[0].children.length!=e){this.hRows=new Array(t);for(let i=0;i<t;i++){this.hRows[i]=yt("tr");for(let t=0;t<e;t++)this.hRows[i].appendChild(yt("th"))}}St(this.thead),this.hRows.forEach((t=>this.thead.appendChild(t)))}createBodyRows(){const t=this.renderRowCount,e=this.renderColCount,i=this.rowHeaderCount;if(!this.bRows||0==this.bRows.length||this.bRows.length!=t||this.bRows[0].children.length!=e)if(0==t&&this.grid.options.emptyPlaceholder)this.bRows=[yt("tr")],this.bRows[0].appendChild(yt("td"));else{this.bRows=new Array(t);for(let o=0;o<t;o++){this.bRows[o]=yt("tr");for(let t=0;t<i;t++)this.bRows[o].appendChild(yt("th"));for(let t=i;t<e;t++)this.bRows[o].appendChild(yt("td"))}}St(this.tbody),this.bRows.forEach((t=>this.tbody.appendChild(t)))}renderCells(t={vertical:!0,horizontal:!0}){this.table&&(t.vertical||t.horizontal)&&(this._viewport=null,t.horizontal&&this.renderHeader(),this.model.rows.length>0?(this.renderBody(),t.vertical&&this.renderRowTree()):this.model.options.emptyPlaceholder&&(this.renderEmptyBody(),this.table.appendChild(this.tbody)),this.dispatchEvent(new Gx("rendercells")))}renderEmptyBody(){const t=this.bRows[0].children[0];t.innerHTML="no data",t.className="empty-placeholder",t.colSpan=this.viewport.columns.length+this.rowHeaderCount}renderHeader(){let t;this.colMap.clear();const e=this.rowHeaderCount,i=this.viewport;this.model.hasRowTreeEnabled&&Nt(this.colgroup.children[0],{w:this.treeHeaderWidth},!0),this.model.options.rowNumbers&&Nt(this.colgroup.children[e-1],{w:Ax.ROW_HEADER_WIDTH},!0);for(let o=0;o<i.columns.length;o++)t=i.columns[o],this.model.autofitColumns.has(t.index)&&(this.grid.rendering.autofitColumn(t.index,!0,!1),this.model.autofitColumns.delete(t.index)),this.colMap.set(t.index,o),Nt(this.colgroup.children[o+e],{w:t.width}),jt(this.colgroup.children[o+e],{w:t.width}),Pt(this.colgroup.children[o+e],{w:t.width});let o=0;this.model.hasColumnTreeEnabled&&(this.renderHeaderRowTree(this.hRows[o],o),++o),this.model.options.colLetters&&(Nt(this.hRows[o],{h:this.model.options.rowHeight}),this.renderHeaderRowLetters(this.hRows[o],o),++o);for(let t=0;t<this.model.headerCount;t++)this.renderHeaderRowLabels(this.hRows[o+t],o+t,t);o+=this.model.headerCount,this.model.hasFilter&&(Nt(this.hRows[o],{h:this.model.options.rowHeight}),this.renderHeaderRowFilters(this.hRows[o],o))}renderHeaderRowLetters(t,e){let i,o;const r=this.viewport,s=e-this.columnHeaderCount;let n=0;if(Nt(t,{h:this.model.options.rowHeight}),(this.model.hasRowTree||this.model.options.rowNumbers)&&!this.model.hasColumnTreeEnabled){i=t.children[n],i.colSpan=this.rowHeaderCount,i.rowSpan=this.columnHeaderCount;const e=n-this.rowHeaderCount,o=this.model.options.levelButtonCell;(!o||s==o.r&&e==o.c)&&this.renderHeaderRowCornerCell(i),n++}for(let e=n;e<this.rowHeaderCount;e++)_t(t.children[e]),n++;for(let e=n;e<t.children.length;e++)o=e-n,i=t.children[e],i.className="hlabel",r.columns.length>o?(i.innerHTML=r.columns[o].address,i.c=r.columns[o].index,Mt(i)):_t(i)}renderHeaderRowTree(t,e){if(!this.model.hasColumnTreeEnabled)return;let i,o,r=0;const s=e-this.columnHeaderCount,n=this.viewport,a=this.model.options.rowNumbers,l=this.model.hasRowTreeEnabled;if(Nt(t,{h:this.treeHeaderHeight}),i=t.children[r],!i)return;i.rowSpan=a||l?this.columnHeaderCount:1,i.colSpan=this.rowHeaderCount;const c=r-this.rowHeaderCount,h=this.model.options.levelButtonCell;let d=null;(!h&&(a||l)||h&&s==h.r&&c==h.c)&&(d=c,this.renderHeaderRowCornerCell(i)),(a||l)&&++r;for(let s=r;s<t.children.length;s++)o=s-r,i=t.children[s],n.columns.length>o?(d!=s&&(i.innerHTML="",i.className="htree",this.renderHeaderRowTreeCell(t,e,n.columns[o],i)),Mt(i)):_t(i)}renderHeaderRowTreeCell(t,e,i,o){let r=this.hCache.get(i.index,e);if(!r){r=yt("div"),this.hCache.set(i.index,e,r);const t=i.width+1,o=this.treeHeaderHeight/this.model.maxColumnLevel;if(i.hasChildren){const e=new qu;e.addEventListener("toggle",(()=>this.grid.rendering.toggleColumn(i.index))),r.expander=e,r.appendChild(e),Ht(e,{l:t/2-Ax.EXPANDER_SIZE/2,t:i.level*o+o/2-Ax.EXPANDER_SIZE/2}),r.expanderLine=this.createExpanderLine("h"),r.appendChild(r.expanderLine),Ht(r.expanderLine,{l:this.model.options.columnTree.reversed?0:t/2,t:i.level*o+o/2}),Nt(r.expanderLine,{h:o/2,w:t/2+1})}if(i.hasParent){let e=i;for(;e.hasParent;){e=e.parent;const i=this.createExpanderLine("h");r.appendChild(i),Nt(i,{h:o/2,w:t-1}),Ht(i,{l:0,t:e.level*o+o/2})}}}r.expander&&(r.expander.state=i.collapsed?"closed":"open"),o.appendChild(r)}createExpanderLine(t){const e=yt("div");return e.className=`${t}tree-line`,e}renderHeaderRowLabels(t,e,i){let o,r,s,n,a=0;const l=this.viewport,c=e-this.columnHeaderCount,h=this.model.options.levelButtonCell;let d;this.model.hasRowTreeEnabled&&(r=t.children[a],r.innerHTML="",this.model.hasColumnTreeEnabled||this.model.options.colLetters||i>0?_t(r):(r.rowSpan=this.columnHeaderCount,r.colSpan=this.rowHeaderCount,this.renderHeaderRowCornerCell(r)),++a),this.model.options.rowNumbers&&(r=t.children[a],r.innerHTML="",this.model.hasRowTreeEnabled||this.model.options.colLetters||this.model.hasColumnTreeEnabled||i>0?_t(r):(r.rowSpan=this.columnHeaderCount,r.colSpan=this.rowHeaderCount,this.renderHeaderRowCornerCell(r)),++a);for(let u=a;u<t.children.length;u++)if(n=u-a,r=t.children[u],r.className="hlabel",r.innerHTML="",l.columns.length>n)if(o=l.columns[n],s=o.header[i],s.height&&(d=Math.max(s.height,d||0)),r.colSpan=1,r.rowSpan=1,r.c=o.index,r.r=i,s?.hidden)if(n==this.freezeLeft){let t=o.prevVisible,s=0;for(;t&&t.header[i]?.hidden;)t=t.prevVisible,++s;t&&t.header[i].cs?(Mt(r),r.colSpan=t.header[i].cs-s-1,r.rowSpan=t.header[i].rs||1,this.renderHeaderRowLabelCell(r,t,e,i)):_t(r)}else _t(r);else{if(o.header&&o.header[i]){const t=o.header[i].cs||1;r.colSpan=t>1?o.calculateRealColspan(t):1,r.rowSpan=o.header[i].rs||1}Mt(r),this.renderHeaderRowLabelCell(r,o,e,i),h&&h.r==c&&h.c==o.index&&this.renderHeaderRowCornerCell(r)}else _t(r);Nt(t,{h:d??this.model.options.rowHeight})}renderHeaderRowLabelCell(t,e,i,o){let r=this.hCache.get(e.index,i);const s=e.header[o];if(r||(r=yt("div"),s?s.html?r.innerHTML=s.label??"":r.innerText=s.label??"":r.innerHTML="",s&&null!=s._style&&bC(r,xw(this.model.styles.get(s._style))),this.hCache.set(e.index,i,r)),this.model.options.columnHeaderTreeButtons&&e.hasChildren&&o==e.level){let t=r.expander;t||(t=new qu,t.addEventListener("toggle",(()=>this.grid.rendering.toggleColumn(e.index))),r.expander=t,r.prepend(t),Ht(t,{l:4,t:4})),t.state=e.collapsed?"closed":"open"}if(e.sorting&&o==e.header.length-1&&(t.className+=" sort",r.sortingArrow||(r.sortingArrow=yt("og-sortingarrow"),r.appendChild(r.sortingArrow),Ht(r.sortingArrow,{t:2,r:5})),r.sortingArrow.sortSettings=this.model.sorting.get(e.index)),e.hasHeaderTooltip(o)){const t=yt("div");t.className="crn",r.appendChild(t),r.classList.add("tt")}t.appendChild(r)}renderHeaderRowFilters(t,e){let i,o,r=0;const s=this.viewport;this.model.hasRowTreeEnabled&&(i=t.children[r],i.innerHTML="",this.model.columnHeaderCount>1?_t(i):i.colSpan=this.model.columnHeaderCount,++r),this.model.options.rowNumbers&&(i=t.children[r],i.innerHTML="",this.model.hasRowTreeEnabled||this.model.options.colLetters||this.model.hasColumnTreeEnabled||this.model.headerCount>0?_t(i):(i.rowSpan=this.columnHeaderCount,i.colSpan=this.rowHeaderCount,this.renderHeaderRowCornerCell(i)),++r);for(let n=r;n<t.children.length;n++)if(o=n-r,i=t.children[n],s.columns.length>o){Mt(i);const r=s.columns[o];r.hasFilter?this.renderHeaderRowFilterCell(t,e,r,i):i.innerHTML=""}else _t(i)}renderHeaderRowFilterCell(t,e,i,o){o.innerHTML="",o.className="filter",o.c=i.index;let r=this.hCache.get(i.index,e);r||(r=yt("div"),r.filter=yt("og-filter-label"),r.appendChild(r.filter),this.hCache.set(i.index,e,r));const s=this.model.filter.get(i.index)?.term;r.filter.value=Array.isArray(s)?s.map((t=>t.value??t.key)).join(", "):s,o.appendChild(r)}renderHeaderRowCornerCell(t){this.cornerDiv=yt("div");const e=Math.max((this.treeHeaderWidth||Ax.EXPANDER_SIZE+2)/(this.model.maxRowLevel+1),Ax.EXPANDER_SIZE+2);if(this.model.hasRowTree)for(let t=0;t<=this.model.maxRowLevel;t++){const i=new Yu;i.level=t,this.cornerDiv.appendChild(i),Ht(i,{l:t*e+e/2-Ax.EXPANDER_SIZE/2,b:3}),i.addEventListener("mousedown",(t=>t.stopPropagation())),i.addEventListener("toggle",(t=>{this.model.columns.filter((t=>t.levelButtons)).forEach((t=>this.bCache.deleteColumn(t.index))),this.grid.rendering.setRowExpandLevel(t.level)}))}if(this.model.hasColumnTree){const i=(this.model.hasColumnTree?this.treeHeaderHeight:t.clientHeight)/(this.model.maxColumnLevel+1),o=15*this.model.maxColumnLevel+20<=t.clientHeight;for(let t=0;t<=this.model.maxColumnLevel;t++){const r=new Yu;r.level=t,this.cornerDiv.appendChild(r),Ht(r,o?{t:t*i+i/2-Ax.EXPANDER_SIZE/2,r:3}:{r:t*e+e/2-Ax.EXPANDER_SIZE/2,b:3}),r.addEventListener("mousedown",(t=>t.stopPropagation())),r.addEventListener("toggle",(t=>{this.grid.rendering.setColumnExpandLevel(t.level)}))}}St(t),t.appendChild(this.cornerDiv)}renderBody(){let t,e,i,o,r,s,n,a,l;const c=this.freezeLeft||0,h=this.rowHeaderCount,d=this.model.merges,u=this.model.options.rowNumbers,p=this.viewport,g=this.viewportRange;if(!g)return;const m=new Ev(this.colOffset+c,this.rowOffset,g.c2,g.r2);this.rowMap.clear();for(let c=0;c<this.bRows.length;c++)if(t=this.bRows[c],c<p.rows.length){i=p.rows[c],o=i.index,this.model.autofitRows.has(o)&&(this.grid.rendering.autofitRow(o,!1,!1),this.model.autofitRows.delete(o)),Nt(t,{h:i.height}),i.height<this.model.options.rowHeight&&Vt(t,i.height),this.rowMap.set(o,c),u&&(e=t.children[h-1],e.className="vlabel",e.r=o,e.c=-1,e.innerHTML=`<div>${Lv(o)}</div>`);for(let c=h;c<t.children.length;c++)if(e=t.children[c],c-h<p.columns.length){if(s=p.columns[c-h],r=s.index,e.r=o,e.c=r,n=i.cell(r),a=n.address,l=d.getMergeState(a),l==zx.HIDDEN){const t=d.hiddenCells.get(n.address),i=m.intersect(new Ev(t.c,t.r,t.c+t.cs-1,t.r+t.rs-1));if(!i||n.c!=i.c1||n.r!=i.r1){_t(e);continue}n=this.model.rows[t.r].cell(t.c),e.colSpan=i.size.columns,e.rowSpan=i.size.rows,e.c=n.c,e.r=n.r}else if(l==zx.MERGED){const t=n.merge;e.colSpan=t.cs,e.rowSpan=t.rs}else e.colSpan=1,e.rowSpan=1;Mt(e),this.renderBodyCell(n,e)}else _t(e);t.style.display="table-row",t.className=i.filterState>1?"filtered":""}else t.style.display="none"}scheduleRenderBodyCell(t,e){this.cellRenderSchedules.has(e)&&(window.clearTimeout(this.cellRenderSchedules.get(e)),this.cellRenderSchedules.delete(e)),this.cellRenderSchedules.set(e,window.setTimeout((()=>this.renderBodyCell(t,e))))}fixCellBorders(t,e){"none"==e.bottom?.style&&(t.style.borderBottomColor="transparent"),"none"==e.top?.style&&(t.style.borderTop="transparent"),"none"==e.right?.style&&(t.style.borderRight="transparent"),"none"==e.left?.style&&(t.style.borderLeft="transparent")}renderBodyCell(t,e){const i=!e;if(e=e||this.getCellByCellModel(t)){let o=i?null:this.bCache.get(t.c,t.r);if(o||(o=yt("div"),IC(t).call(this,o,t),this.bCache.set(t.c,t.r,o)),this.renderAll){const i=t.composedStyle;i&&this.fixCellBorders(e,i)}St(e),e.appendChild(o)}else this.bCache.delete(t.c,t.r)}mergeBodyCells(t){let e;const i=new Set;for(const o of t)if(e=this.bRows[o.r].cells[o.c],e&&!i.has(e))for(let t=o.r;t<o.r+o.rs;t++)for(let r=o.c;r<o.c+o.cs;r++)e=this.bRows[t].cells[r],e&&(t==o.r&&r==o.c?(e.colSpan=o.cs,e.rowSpan=o.rs):(i.add(e),_t(e)))}renderRowTree(){if(!this.model.hasRowTreeEnabled)return;let t;const e=this.viewport,i=-this.rowHeaderCount;for(let o=0;o<this.bRows.length;o++)t=this.bRows[o].children[0],t.innerHTML="",o<e.rows.length&&(t.className="vtree",this.renderRowTreeCell(i,e.rows[o],t))}renderRowTreeCell(t,e,i){let o=this.bCache.get(t,e.index);if(!o){o=yt("div"),this.bCache.set(t,e.index,o);const r=e.height+1,s=this.treeHeaderWidth/this.model.maxRowLevel;if(e.hasChildren){const t=new qu;t.addEventListener("toggle",(()=>this.grid.rendering.toggleRow(e.index))),i.parentElement.expander=t,o.expander=t,o.appendChild(t),Ht(t,{t:r/2-Ax.EXPANDER_SIZE/2,l:e.level*s+s/2-Ax.EXPANDER_SIZE/2});const n=this.createExpanderLine("v");o.appendChild(n),Ht(n,{t:this.model.options.rowTree.reversed?0:r/2,l:e.level*s+s/2}),Nt(n,{w:s/2,h:r/2+1})}if(e.hasParent){let t=e;for(;t.hasParent;){t=t.parent;const e=this.createExpanderLine("v");o.appendChild(e),Nt(e,{w:s/2,h:r+2}),Ht(e,{t:-1,l:t.level*s+s/2})}}}o.expander&&(o.expander.state=e.collapsed?"closed":"open"),i.appendChild(o)}};qx.styles=[Vx],Ux([$n({type:Object})],qx.prototype,"model",void 0),Ux([$n({type:Boolean,reflect:!0})],qx.prototype,"hideOuterBorder",void 0),Ux([$n({type:Number,hasChanged:()=>!1})],qx.prototype,"rowOffset",void 0),Ux([$n({type:Number,hasChanged:()=>!1})],qx.prototype,"colOffset",void 0),Ux([$n({type:Number,reflect:!0})],qx.prototype,"zoom",void 0),Ux([$n({type:Boolean,reflect:!0})],qx.prototype,"nogrid",void 0),Ux([$n({type:Boolean,reflect:!0})],qx.prototype,"renderAll",void 0),qx=Ux([In("og-table")],qx);const Yx=["F5","F12"];class Zx extends Event{constructor(t){super("grid.error",{bubbles:!0,composed:!0}),this.error=t}}class Xx extends Event{get selection(){return this.grid.selecting.selection}get activeCell(){return this.selection.activeCell}constructor(t,e){super(`grid.${t}`,{bubbles:!0,composed:!0}),Object.assign(this,e),this.cell&&(this.row=this.cell.row,this.column=this.cell.column)}}class Qx extends Xx{constructor(t){super("edit",t)}}class Kx extends Sp{constructor(t,e,i){super(`grid.${t}`,i),this.grid=e}}class Jx extends Kx{constructor(t,e,i,o){super(t,e,o),this.column=i}}class tk extends Kx{constructor(t,e,i,o){super(t,e,o),this.row=i}}class ek{get model(){return this.grid.model}get selection(){return this.grid.selection}get table(){return this.grid.table}constructor(t){this.grid=t,this.clickDisabled=!1,this.editDisabled=!1,this.clicked=!1,this.startOffset={x:0,y:0},this.suspendClick=()=>this.clickDisabled=!0,this.resumeClick=(t=!1)=>{this.isSliding||(t?setTimeout((()=>this.clickDisabled=!1),100):this.clickDisabled=!1)},this._onKeyDown=t=>{switch(Yx.includes(t.key)||t.preventDefault(),t.key){case"Tab":t.preventDefault(),this.grid.selecting.shiftActiveCell(t.shiftKey?-1:1,!0);break;case"ArrowRight":this.grid.selecting.debounceMoveSelector(1,0);break;case"ArrowLeft":this.grid.selecting.debounceMoveSelector(-1,0);break;case"ArrowDown":this.grid.selecting.debounceMoveSelector(0,1);break;case"ArrowUp":this.grid.selecting.debounceMoveSelector(0,-1);break;case"PageUp":this.grid.selecting.debounceMoveSelector(0,-this.table.viewport.rows.length);break;case"PageDown":this.grid.selecting.debounceMoveSelector(0,this.table.viewport.rows.length);break;case"Home":this.grid.selecting.debounceMoveSelector(-this.selection.range.c1,t.ctrlKey?-this.selection.range.r1:0);break;case"End":this.grid.selecting.debounceMoveSelector(this.model.gridRange.c2-this.selection.range.c1,t.ctrlKey?this.model.gridRange.r2-this.selection.range.r1:0);break;case"Enter":this.grid.selecting.enter();break;case"Escape":this.grid.selecting.hideCopySelector();break;case"c":case"C":t.ctrlKey&&this.grid.editing.copySelection();break;case"v":case"V":t.ctrlKey&&this.grid.editing.paste();break;case"z":case"Z":if(!this.grid.options.undoRedo)return;t.ctrlKey&&this.grid.editing.undo();break;case"y":case"Y":if(!this.grid.options.undoRedo)return;t.ctrlKey&&this.grid.editing.redo();break;case"F2":t.preventDefault(),this.grid.editing.startEdit();break;case"Delete":t.preventDefault(),this.grid.objects.delete(),this.grid.editing.clearSelection();break;case"Backspace":t.preventDefault(),this.grid.editing.clearSelection();break;case"F1":if(!this.grid.options.commandWindow)return;t.preventDefault(),this.grid.openCommands()}1!=t.key.length||t.ctrlKey||this.grid.editing.startEdit(t.key)},this._onMouseMove=t=>{if(!this.model)return;let e=!0,i=!0;const o=this.grid.hSizer,r=this.grid.vSizer,{offsetX:s,offsetY:n}=t;let a=this.model.options.scrolling.scrollbarVisibilityTreshold;a<=0&&(a=Math.max(this.grid.clientWidth,this.grid.clientHeight)),s>this.grid.clientWidth-a?this.grid.vSlider.show():this.grid.vSlider.hide(),n>this.grid.clientHeight-a?this.grid.hSlider.show():this.grid.hSlider.hide();const[l,c]=this.table.findNearestTableCellByOffset(s,n);if(c&&"TH"==c.tagName&&(this.model.options.columnResize&&!o.resizing&&c.classList.contains("hlabel")?c.offsetWidth-t.offsetX+c.offsetLeft<Ax.RESIZE_TRESHOLD?(o.snap(c,this.grid),this.grid.rendering.currentResizedColumn=this.model.columns[c.c]):kt(o):this.model.options.rowResize&&!r.resizing&&c.classList.contains("vlabel")&&(c.offsetHeight-t.offsetY+c.offsetTop<Ax.RESIZE_TRESHOLD?(r.snap(c,this.grid),this.grid.rendering.currentResizedRow=this.model.rows[c.r]):kt(r)),null!=c.c)){const t=this.model.columns[c.c];t?.hasHeaderTooltip(c.r)&&(e=!1,this.grid.tooltip.attachToCell(c,t.header[c.r],"bottom"))}if(l&&"TH"==l.tagName)this.grid.selecting.isSelecting&&(this.suspendClick(),this.grid.selecting.updateSelecting(l.c,l.r)),i=!1;else if(l&&"TD"==l.tagName)if(this.grid.selecting.isSelectorOperationActive||this.grid.selecting.isFormulaSelectorOperationActive){const{top:e,left:i}=Tt(l,this.grid);this.grid.rendering.autoscroll({x:i-this.table.totalHeaderWidth+t.offsetX-l.offsetLeft,y:e-this.table.thead.clientHeight+t.offsetY-l.offsetTop}),this.grid.selecting.isSelecting&&this.suspendClick(),this.grid.selecting.updateSelecting(l.c,l.r)}else{const t=this.model.rows[l.r]?.cell(l.c);t&&t.hasTooltip&&(e=!1,this.grid.tooltip.attachToCell(l,t)),t&&t.hasComment&&(e=!1,this.grid.comment.attachedTo!==l&&this.grid.comment.attachTo(l,t))}e&&(this.grid.tooltip.deatach(),this.grid.comment.deatach(this.model.options.comments.hideTimeout)),i&&(kt(o),kt(r))},this._onMouseDown=t=>{if(1&t.buttons){this.grid.setPointerCapture(t.pointerId),this.startOffset={x:t.offsetX,y:t.offsetY};for(const e of t.composedPath()){if("TD"==e.tagName){const t=e;this.grid.selecting.startCellSelecting(new Ev(t.c,t.r));break}if("TH"==e.tagName){const t=e;e.matches(".sort")?this.grid.sorting.sort(t.c):t.classList.contains("filter")?this.grid.filtering.openFilter(this.model.columns[t.c],t):t.classList.contains("hlabel")?this.grid.selecting.startColumnSelecting(t.c):t.classList.contains("vlabel")&&this.grid.selecting.startRowSelecting(t.r);break}}}},this._onMouseUp=t=>{if(0!=t.buttons)return;const e=Math.abs(this.startOffset.x-t.offsetX),i=Math.abs(this.startOffset.y-t.offsetY);Math.sqrt(Math.pow(e,2)+Math.pow(i,2))<this.model.options.events.click.mouseMoveTreshold&&this.resumeClick(),this.grid.releasePointerCapture(t.pointerId),this.grid.selecting.stopSelectOperations()},this._onClick=t=>{if(this.clickDisabled)return;if(this.grid.clientHeight-t.offsetY<this.grid.hSlider.offsetHeight)return;if(this.grid.clientWidth-t.offsetX<this.grid.vSlider.offsetWidth)return;const e=this.table.findTableCellByOffset(t.offsetX,t.offsetY),i="TD"==e?.tagName?this.model.rows[e.r]?.cell(e.c):null;this.grid.dispatchEvent(new Xx("click",{grid:this.grid,cell:i}))},this._onContextMenu=t=>{t.preventDefault();for(const e of t.composedPath())if("TD"==e.tagName){const i=e;this.grid.menus.openCellMenu(this.model.rows[i.r].cell(i.c),{x:t.pageX,y:t.pageY})}else if("TH"==e.tagName){const i=e;i.classList.contains("hlabel")?this.grid.menus.openColumnMenu(this.model.columns[i.c],{x:t.pageX,y:t.pageY}):i.classList.contains("vlabel")&&this.grid.menus.openRowMenu(this.model.rows[i.r],{x:t.pageX,y:t.pageY})}},this._onVerticalSlide=t=>{this.table.rowOffset=Math.min(t.value,this.model.visibleRows.length-1),this.grid.rendering.requireVerticalUpdate=!0,this.grid.rendering.renderCells()},this._onHorizontalSlide=t=>{this.table.colOffset=Math.min(t.value,this.model.visibleColumns.length-1),this.grid.rendering.requireHorizontalUpdate=!0,this.grid.rendering.renderCells()},this._onSlideStart=()=>{this.suspendClick()},this._onSlideStop=()=>{this.resumeClick(!0)},this._denbounceHorizontalScroll=q((t=>this.grid.rendering.scrollHorizontalByPixels(t)),50),this._onWheel=t=>{t.ctrlKey||(0!=t.deltaY&&this.grid.rendering.scrollVerticalByPixels(t.deltaY),0!=t.deltaX&&this._denbounceHorizontalScroll(Math.sign(t.deltaX)*Math.min(100,Math.abs(t.deltaX))))},this._onTouchStart=t=>{this.grid.rendering.touchStartX=t.touches[0],this.grid.rendering.touchStartY=t.touches[0]},this._onTouchEnd=t=>{this.grid.rendering.touchStartX=t.touches[0],this.grid.rendering.touchStartY=t.touches[0]},this._onTouchMove=t=>{const e=this.grid.rendering;if(e.touchStartY){const i=e.touchStartY.clientY-t.touches[0].clientY;Math.abs(i)>this.model.options.rowHeight&&this.table.viewport.rows.length>0&&(e.scrollVerticalByPixels(i),e.touchStartY=t.touches[0])}if(e.touchStartX){const i=e.touchStartX.clientX-t.touches[0].clientX;Math.abs(i)>this.model.options.columnWidth&&this.table.viewport.columns.length>0&&(e.scrollHorizontalByPixels(i),e.touchStartX=t.touches[0])}},this._onHorizontalResizeStart=()=>{this.grid.rendering.resizing=!0,this.grid.rendering.currentResizedColumnWidth=this.grid.rendering.currentResizedColumn.width},this._onHorizontalResizeStop=t=>{this.suspendClick(),this.grid.rendering.resizing=!1,this.table.clearHeaderCache(),this.table.renderCells({horizontal:!0}),this.grid.dispatchEvent(new Jx("column.resize",this.grid,this.grid.rendering.currentResizedColumn,t))},this._onHorizontalResize=t=>{const e=this.grid.rendering;e.currentResizedColumn.width=e.currentResizedColumnWidth+t.deltaX,Nt(this.table.getColumnByModelIndex(e.currentResizedColumn.index),{w:e.currentResizedColumn.width},!0),this.grid.selecting.updateSelector()},this._onVerticalResizeStart=()=>{this.grid.rendering.resizing=!0,this.grid.rendering.currentResizedRowHeight=this.grid.rendering.currentResizedRow.height},this._onVerticalResizeStop=t=>{this.suspendClick(),this.grid.rendering.resizing=!1,this.table.clearBodyCache(),this.table.renderCells({vertical:!0}),this.grid.dispatchEvent(new tk("row.resize",this.grid,this.grid.rendering.currentResizedRow,t))},this._onVerticalResize=t=>{const e=this.grid.rendering;e.currentResizedRow.height=e.currentResizedRowHeight+t.deltaY,Nt(this.table.getRowByModelIndex(e.currentResizedRow.index),{h:e.currentResizedRow.height},!1),this.grid.selecting.updateSelector()},this._onCommentCommit=t=>{this.grid.model.comments.set(t.cell.address,t.items),t.cell.invalidateStyle(),this.grid.rendering.updateCells([t.cell])},this._onAutofill=t=>{if(this.suspendClick(),this.grid.selection.range.equals(t.selector.autofillRange))return;const{cells:e,oldValues:i}=lw(this.model,this.grid.selection.range,t.selector.autofillRange,t.selector.autofillDirection);this.grid.rendering.updateCells(e,!0),this.grid.selection.setRange(this.grid.selection.range.unite(t.selector.autofillRange)),this.grid.selecting.updateSelector(),this.grid.dispatchEvent(new Qx({grid:this.grid,editType:"autofill",cells:e,oldValues:i,newValues:e.map((t=>t.value2))}))},this._onEdit=t=>{if(t.fromHistory)return;const e=[],i=[],o=this.model.names.rangeMap;let r=[],s=[],n=[],a=[];switch(t.editType){case"value":r=t.newValues,s=t.newProps,n=t.oldValues,a=t.oldProps,t.cells.forEach((t=>{const r=t.address;e.push(r),i.push(o.get(r))}));break;case"insert_column":case"insert_row":t.newValues.forEach((t=>{const s=t.address;e.push(s),i.push(o.get(s)),r.push(t.getSourceData())}))}this.grid.history.push({type:t.editType,addresses:e,names:i,oldValues:n,oldProps:a,newValues:r,newProps:s})},this._onSelectorMove=t=>{this.suspendClick(),this.selection.setRange(t.toRange),t.fromRange.isRow?this.grid.editing.moveRows({index:t.fromRange.r1,count:t.fromRange.size.rows,targetIndex:t.toRange.r1}):t.fromRange.isColumn?this.grid.editing.moveColumns({index:t.fromRange.c1,count:t.fromRange.size.columns,targetIndex:t.toRange.c1}):console.log(t)},this._onMouseLeave=()=>{this.grid.rendering.hideSliders()},this.debounceHideSliders=q((()=>this.grid.rendering.hideSliders()),1e3,{isImmediate:!1}),this._onRender=()=>{const t=this.grid;t.selecting.updateSelectors(),t.dispatchEvent(new Xx("render",{grid:this.grid})),t.adapter&&t.options.pageSize&&t.rendering.isLastRowInViewport()&&t.rendering.loadNextPage(),t.rendering.updateSliderVisibility(),this.model.options.scrolling.scrollbarVisibilityTreshold>0&&this.debounceHideSliders()},this._onHorizontalSizerDblClick=t=>{t.stopPropagation(),this.editDisabled=!0,this.grid.rendering.autofitColumn(this.grid.rendering.currentResizedColumn.index),this.grid.dispatchEvent(new Jx("column.resize",this.grid,this.grid.rendering.currentResizedColumn,t))},this._onVerticalSizerDblClick=t=>{t.stopPropagation(),this.editDisabled=!0,this.grid.rendering.autofitRow(this.grid.rendering.currentResizedRow.index),this.grid.dispatchEvent(new tk("row.resize",this.grid,this.grid.rendering.currentResizedRow,t))},this._onDblClick=()=>{this.editDisabled?this.editDisabled=!1:this.grid.editing.startEdit()}}get isSliding(){return this.grid.hSlider.sliding||this.grid.vSlider.sliding}async init(){await this.grid.updateComplete,await this.table.updateComplete;const t=this.grid;t.addEventListener("wheel",this._onWheel,{passive:!0}),t.addEventListener("touchstart",this._onTouchStart,{passive:!0}),t.addEventListener("touchend",this._onTouchEnd,{passive:!0}),t.addEventListener("touchmove",this._onTouchMove,{passive:!0}),t.hSizer.addEventListener("resizestart",this._onHorizontalResizeStart),t.hSizer.addEventListener("resizestop",this._onHorizontalResizeStop),t.hSizer.addEventListener("resize",this._onHorizontalResize),t.hSizer.addEventListener("dblclick",this._onHorizontalSizerDblClick),t.vSizer.addEventListener("resizestart",this._onVerticalResizeStart),t.vSizer.addEventListener("resizestop",this._onVerticalResizeStop),t.vSizer.addEventListener("resize",this._onVerticalResize),t.vSizer.addEventListener("dblclick",this._onVerticalSizerDblClick),t.comment.addEventListener("comment.commit",this._onCommentCommit),t.addEventListener("keydown",this._onKeyDown),t.addEventListener("click",this._onClick),t.addEventListener("contextmenu",this._onContextMenu),t.addEventListener("toggle",(()=>t.rendering.debounceCalculateViewport())),t.addEventListener("pointerup",this._onMouseUp),t.addEventListener("pointerdown",this._onMouseDown);const e=q(this._onMouseMove,20,{maxWait:50,isImmediate:!0});t.addEventListener("pointermove",e),t.addEventListener("mouseleave",this._onMouseLeave),t.table.addEventListener("rendercells",this._onRender),t.selector.addEventListener("grid.selector.autofill",this._onAutofill),t.selector.addEventListener("grid.selector.move",this._onSelectorMove),t.addEventListener("dblclick",this._onDblClick),t.addEventListener("grid.edit",this._onEdit)}}class ik{get vScrolling(){return this._vScrolling}get hScrolling(){return this._hScrolling}get model(){return this.grid.model}get selection(){return this.grid.selection}get table(){return this.grid.table}constructor(t){this.grid=t,this.requireVerticalUpdate=!0,this.requireHorizontalUpdate=!1,this.resizing=!1,this._vScrolling=!0,this._hScrolling=!0,this.debounceRenderCells=q(this.renderCells,50,{isImmediate:!1,maxWait:100}),this.debounceCalculateViewport=q(this.calculateViewport,200)}isLastRowInViewport(){const t=this.grid.table.viewport.rows,e=this.model.visibleRows;return t[t.length-1]==e[e.length-1]}renderCells(t){t=t||{vertical:this.requireVerticalUpdate,horizontal:this.requireHorizontalUpdate},this.grid.comment.deatach(),this.grid.table.renderCells(t),this.requireHorizontalUpdate=!1,this.requireVerticalUpdate=!1,this.debounceCalculateViewport(),this.grid.objects.updatePostions()}renderAll(t=!1){this.grid.group?this.grid.group.grids.forEach((e=>e.rendering.render(t))):this.render(t)}async render(t=!1){this.grid.table&&this.model&&(this.grid.table.clearHeaderCache(),this.grid.table.clearBodyCache(),this.grid.table.isConnected&&(t&&(this.grid.table.requestUpdate(),await this.grid.table.updateComplete),this.grid.table.renderCells({horizontal:!0,vertical:!0}),this.calculateViewport()))}updateRange(t,e=!1){for(const i of this.model.getRangeIterator(t))this.updateCells([i],e)}updateCell(t,e=!1){this.updateCells([t],e)}updateSpilledCells(t){let e;t.prevSpillRange&&(e=new Set,this.model.getRangeIterator(t.prevSpillRange).forEach((t=>e.add(t)))),t.spillRange&&(e=e||new Set,this.model.getRangeIterator(t.spillRange).forEach((t=>e.add(t)))),e?.size>0&&this.updateCells(e)}updateCells(t,e=!1){if(e)for(const e of t)e.invalidateStyle(),e.invalidateValue(),this.model.calculations.clearDependecies(e).evaluate(e),this.updateSpilledCells(e);const i=this.grid.table;for(const e of t)i.renderBodyCell(e);e&&(this.model.calculations.invalidateDependants(t).forEach(((t,e)=>{t?this.grid.group.getGrid(t)?.table.renderBodyCell(e):i.renderBodyCell(e),this.updateSpilledCells(e)})),this.grid.dispatchGridEvent("calculate",{cells:Array.from(t)}))}updateHeaders(){this.model.indexVisibleColumns(),this.table.clearHeaderCache(),this.table.createHeaderRows(),this.table.renderHeader()}calculateViewport(t=!1){this.grid.logger.info("calculate viwport"),this.updateCells(this.model.calculateViewport(),t)}updateSliders(){const t=this.table.viewportSize;this.grid.vSlider.maxValue=this.model.visibleRows.length,this.grid.vSlider.pageSize=t.h/this.model.options.rowHeight,this.grid.vSlider.value=this.table.rowOffset,this.grid.hSlider.maxValue=this.model.visibleColumns.length,this.grid.hSlider.pageSize=t.w/this.model.options.columnWidth,this.grid.hSlider.value=this.table.colOffset}isVerticalScrollingEnabled(){return!1!==this.grid.options.scrolling.verticalOverscroll||this.table.viewport.rows.length<this.model.visibleRows.length}isHorizontalScrollingEnabled(){return!1!==this.grid.options.scrolling.horizontalOverscroll||this.table.viewport.columns.length<this.model.visibleColumns.length}updateSliderVisibility(){this._vScrolling=this.isVerticalScrollingEnabled(),this._vScrolling?(this.grid.vSlider.show(),xt(this.grid.vSlider)):(this.grid.vSlider.hide(),kt(this.grid.vSlider)),this._hScrolling=this.isHorizontalScrollingEnabled(),this._hScrolling?(this.grid.hSlider.show(),xt(this.grid.hSlider)):(this.grid.hSlider.hide(),kt(this.grid.hSlider))}hideSliders(){this.grid.vSlider.hide(),this.grid.hSlider.hide()}scrollVerticalByPixels(t){if(!this.vScrolling)return;let e,i=this.table.rowOffset,o=0,r=0;if(t>0){for(;o<t&&i+r<this.model.visibleRows.length;)o+=this.model.visibleRows[i+r++].height+2;i+=r}else if(t<0){for(t=Math.abs(t);o<t&&i+r>=0;)e=this.model.visibleRows[Math.min(this.model.visibleRows.length-1,i+r--)],o+=(e?e.height:0)+2;i+=r}i>=this.model.visibleRows.length&&(i=this.model.visibleRows.length-1),this.requireVerticalUpdate=!0,this.table.rowOffset=Math.max(0,i),this.debounceRenderCells(),this.updateSliders()}scrollHorizontalByPixels(t){if(!this.hScrolling)return;let e=this.table.colOffset,i=0,o=0;if(t>0){for(;i<t&&e+o<this.model.visibleColumns.length;)i+=this.model.visibleColumns[e+o++].width+2;e+=o}else if(t<0){for(t=Math.abs(t);i<t&&e+o>=0;)i+=this.model.visibleColumns[Math.min(this.model.visibleColumns.length-1,e+o--)].width+2;e+=o}e>=this.model.visibleColumns.length&&(e=this.model.visibleColumns.length-1),this.requireHorizontalUpdate=!0,this.table.colOffset=Math.max(0,e),this.debounceRenderCells(),this.updateSliders()}updateCellSelectionRange(){const t=this.table;for(const e of this.model.getRangeIterator(this.selection.range,!1))t.renderBodyCell(e)}getAdapterRequestFilters(){return{offset:0,filter:this.model?.filter?Array.from(this.model.filter.settings.values()):null,order:this.model?.sorting?.settings}}async toggleRow(t,e=!0){const i=this.model.rows[t];if(i.isLoaded||i.isPartialyLoaded)i.toggleCollapse(!1,this.model.options.unhideRowAfterExpand),this.table.renderCells({vertical:!0});else if(this.grid.adapter){const e=this.table.getRowByModelIndex(t);e&&e.expander&&(e.expander.state="waiting"),i.collapsed=!1;const o=Object.assign(this.getAdapterRequestFilters(),{parent:{r:i.index,props:i.properties}}),[r]=await Promise.all([this.grid.adapter.getRows(o)]);this.model.insertRowData(i,0,r),o.rows=r;const[s]=await Promise.all([this.grid.adapter.getCells(o)]);s?.map((t=>this.model.getCellByCoords(t.r,t.c)?.update(t))),this.table.requestUpdate()}this.updateSliders(),e&&this.grid.dispatchEvent(new Xx("row.toggle",{grid:this.grid,row:i}))}toggleColumn(t,e=!0){const i=this.model.columns[t];i.toggleCollapse(!1,this.model.options.unhideColumnAfterExpand),this.table.renderCells({horizontal:!0}),this.updateSliders(),e&&this.grid.dispatchEvent(new Xx("column.toggle",{grid:this.grid,column:i}))}setRowExpandLevel(t){this.model.setRowExpandLevel(t),this.table.rowOffset=0,this.table.renderCells({vertical:!0}),this.updateSliders(),this.grid.dispatchEvent(new Xx("row.toggle",{grid:this.grid}))}setColumnExpandLevel(t){this.model.setColumnExpandLevel(t),this.table.colOffset=0,this.table.renderCells({horizontal:!0}),this.updateSliders(),this.grid.dispatchEvent(new Xx("column.toggle",{grid:this.grid}))}async exportHTML(){const t=yt("div");kt(t),document.body.appendChild(t);const e=yt("og-table");e.grid=this.grid,e.model=this.model,e.renderAll=!0,t.appendChild(e),await e.updateComplete;const i=this.model.options?.print?.rowBreaks,o=e.table,r=i&&i.length>0;if(r){const t=o.querySelector("colgroup"),r=[...o.tBodies[0].rows],s=this.model.options?.print?.rowTitles?Ev.fromA1(this.model.options?.print?.rowTitles):null,n=s?Array.from({length:s.r2-s.r1+1},((t,i)=>r[e.rowMap.get(s.r1+i)])):[];for(let o=0;o<i.length;o++){const s=yt("table");s.appendChild(t.cloneNode(!0));const a=yt("tbody");s.appendChild(a);const l=e.rowMap.get(i[o]),c=o<i.length-1?e.rowMap.get(i[o+1]):this.model.visibleRows.length-1;n.forEach((t=>a.appendChild(t.cloneNode(!0))));for(let t=l;t<=c;t++)a.appendChild(r[t]);e.shadowRoot.appendChild(s)}t.cloneNode(!0)}const s=`\n\t\t\t<style>\n\t\t\t\thtml {\n\t\t\t\t\t${Ua(Ja().themes.get("og-light")).cssText}\n\t\t\t\t}\n\t\t\t\t${r?"table {break-after: page}":""}\n\t\t\t\t${qx.styles.map((t=>t.cssText)).join("\n")}\n\t\t\t</style>\n\n\t\t`,n=s+e.shadowRoot.innerHTML.replace(/<!---->/g,"");return t.remove(),n}stopAutoscroll(){this.autoscrollTimer&&window.clearInterval(this.autoscrollTimer)}startAutoscroll(){this.stopAutoscroll(),this.autoscrollTimer=window.setInterval((()=>{if(0==this.autoscrollValue)return this.stopAutoscroll();const t=Math.pow(this.autoscrollValue,av.AUTOSCROLL_RATIO);switch(this.autoscrollDirection){case"down":this.scrollVerticalByPixels(t);break;case"up":this.scrollVerticalByPixels(-t);break;case"left":this.scrollHorizontalByPixels(-t);break;case"right":this.scrollHorizontalByPixels(t)}}),av.AUTOSCROLL_INTERVAL)}autoscroll(t){const{x:e,y:i}=t,o=this.table.clientWidth/this.table.zoom-this.table.totalHeaderWidth,r=this.table.clientHeight/this.table.zoom-this.table.totalHeaderHeight;let s,n=0;e<av.AUTOSCROLL_TRESHOLD&&e<i&&e<r-i?(s="left",n=av.AUTOSCROLL_TRESHOLD-e):o-e<av.AUTOSCROLL_TRESHOLD&&o-e<i&&o-e<r-i?(s="right",n=av.AUTOSCROLL_TRESHOLD-o+e):i<av.AUTOSCROLL_TRESHOLD?(s="up",n=av.AUTOSCROLL_TRESHOLD-i):r-i<av.AUTOSCROLL_TRESHOLD&&(s="down",n=av.AUTOSCROLL_TRESHOLD-r+i),this.autoscrollDirection=s,this.autoscrollValue=n,this.stopAutoscroll(),n>0&&this.startAutoscroll()}async load(t){t=t||this.getAdapterRequestFilters();const e=t.parent?.r??null,i=null!=e?this.model.rows[e]:this.model.rowRoot,[o]=await Promise.all([this.grid.adapter.getRows(t)]);o.length>0&&null===e&&this.model.insertRowData(i,t.offset,o);const[r]=await Promise.all([this.grid.adapter.getCells(t)]);r?.map((t=>this.model.getCellByCoords(t.r,t.c)?.update(t))),this.table.requestUpdate(),o.length>=this.model.options.pageSize?i.count=1/0:i.count=i.children.length,this.grid.logger.info(`loaded ${o.length} rows`),this.grid.loading=!1,this.grid.dispatchEvent(new Xx("afterLoad",{grid:this.grid}))}async loadNextPage(t=null,e=!1){if(this.grid.loading)return;const i=null!=t?this.model.rows[t]:this.model.rowRoot;if(!e&&i.isLoaded)return;this.grid.dispatchEvent(new Xx("beforeLoad",{grid:this.grid})),this.grid.loading=!0;const o=this.model.rows.length;this.grid.logger.info(`loading rows offset = ${o}`),await this.load(Object.assign(this.getAdapterRequestFilters(),{offset:o,parent:{r:t,props:null}}))}get totalSize(){return{width:this.table.totalHeaderWidth+this.model.visibleColumns.reduce(((t,e)=>t+e.width),0),height:this.table.thead.offsetHeight+this.model.visibleRows.reduce(((t,e)=>t+e.height),0)}}autofitColumn(t,e=!1,i=!0){const o="number"==typeof t?this.model.columns[t]:t,r=this.autofitDiv??(this.autofitDiv=yt("div"));r.style.position="absolute",r.style.zIndex="100000",Ht(r,{l:-1e3,t:-1e3}),this.grid.shadowRoot.appendChild(r);let s=0;for(const t of this.model.getRangeIterator(Ev.fromA1(o.address),!!e)){const e=IC(t).call(this.table,r,t)||r;e.style.width="auto",s=Math.max(s,e.offsetWidth)}if(o.header){for(const t of o.header)t&&(t.html?r.innerHTML=t.label??"":r.innerText=t.label??"",s=Math.max(s,r.offsetWidth));r.innerHTML=""}o.width=s+22,i&&this.table.renderCells({horizontal:!0})}autofitColumns(t=!1){this.model.columns.forEach((e=>this.autofitColumn(e,t,!1))),this.table.renderCells({horizontal:!0})}autofitRow(t,e=!1,i=!0){const o="number"==typeof t?this.model.rows[t]:t,r=this.autofitDiv??(this.autofitDiv=yt("div"));r.style.position="absolute",r.style.zIndex="100000",Ht(r,{l:-1e3,t:-1e3}),this.grid.shadowRoot.appendChild(r);let s=0;for(const t of this.model.getRangeIterator(Ev.fromA1(o.address),!!e)){const e=IC(t).call(this.table,r,t)||r;e.style.height="auto",s=Math.max(s,e.offsetHeight)}o.height=s+8,i&&this.table.renderCells({vertical:!0})}autofitRows(t=!1){this.model.rows.forEach((e=>this.autofitRow(e,t,!1))),this.table.renderCells({vertical:!0})}scrollTo(t,e=0){let i;i=Q(t)?Ev.fromA1(t):new Ev(e,t),this.table.rowOffset=i.r1,this.table.colOffset=i.c1,this.requireVerticalUpdate=!0,this.requireHorizontalUpdate=!0,this.debounceRenderCells(),this.updateSliders()}}class ok{get model(){return this.grid.model}get selection(){return this.grid.editing.isFormulaMode?this.formulaSelection:this.grid.selection}get selector(){return this.grid.editing.isFormulaMode?this.grid.formulaSelector:this.grid.selector}get formulaSelection(){return this._formulaSelection}get events(){return this.grid.events}get table(){return this.grid.table}get isSelecting(){return this.isCellSelecting||this.columnSelecting||this.rowSelecting}get isCellSelecting(){return this.selector.isSelecting}get isAutofilling(){return this.selector.isAutofilling}get isMoving(){return this.selector.isMoving}get isSelectorOperationActive(){return this.selector.isSelectorOperationActive}get isFormulaSelectorOperationActive(){if(!this.grid.editing.isFormulaMode)return!1;for(const t of this.formulaSelectors.values())if(t.isSelectorOperationActive)return!0;return!1}get activeCell(){const{c:t,r:e}=this.selection.activeCellCoords;return this.model.rows[e]?.cell(t)}constructor(t){this.grid=t,this.columnSelecting=!1,this.rowSelecting=!1,this._formulaSelection=new $x(0,0,0,0),this.formulaSelectors=new Map,this.debounceMoveSelector=q(((t,e)=>this.moveSelector(t,e)),10)}moveToSelection(){const t=new Ev(this.selection.range.c1,this.selection.range.r1);this.table.viewportRange.contains(t)}select(t,e=!1){this.selection.setRange(t),this.updateSelector(),e&&this.grid.dispatchEvent(new Xx("select",{grid:this.grid}))}startCellSelecting(t){this.grid.style.cursor="cell",this.startSelectingRange=t.clone(),this.select(t,!0),this.selector.startSelecting(t)}startColumnSelecting(t){this.columnSelecting=!0;const e=new Ev(t,null,t,null);this.startSelectingRange=e.clone(),this.select(e,!0)}startRowSelecting(t){this.rowSelecting=!0;const e=new Ev(null,t,null,t);this.startSelectingRange=e.clone(),this.select(e,!0)}updateSelecting(t,e){const i=this.model.options.selecting.multiSelect;(this.isCellSelecting||this.rowSelecting)&&(i||(this.selection.range.r1=e),this.selection.range.r2=e),(this.isCellSelecting||this.columnSelecting)&&(i||(this.selection.range.c1=t),this.selection.range.c2=t),this.grid.editing.isFormulaMode?(this.updateFormulaSelector(),this.formulaSelectors.forEach((i=>i.updateMovingOperations(t,e)))):(this.updateSelector(),this.hideFormulaSelector(),this.selector.updateMovingOperations(t,e))}stopSelecting(){this.grid.rendering.stopAutoscroll(),this.isSelecting&&!this.selection.range.equals(this.startSelectingRange)&&this.grid.dispatchEvent(new Xx("select",{grid:this.grid})),this.columnSelecting=!1,this.rowSelecting=!1,this.startSelectingRange=null,this.selector.stopSelectorOperations()}highlightSelection(){const t=this.selection.range,[e,i]=[Math.min(t.c1,t.c2),Math.max(t.c1,t.c2)],[o,r]=[Math.min(t.r1,t.r2),Math.max(t.r1,t.r2)],s=i-e+1,n=r-o+1;this.table.highlightColHeaderCells(s<1/0?Array.from(new Array(s),((t,i)=>i+e)):[]),this.table.highlightRowHeaderCells(n<1/0?Array.from(new Array(n),((t,e)=>e+o)):[])}updateSelector(t=!0){this.model.options.selecting.enabled?(this.showSelector(t),this.highlightSelection()):this.hideSelector(),this.grid.editing.isFormulaMode||this.grid.editing.endEdit()}showSelector(t=!0){this.selector&&(this.selector.show(),this.selector.select(this.selection.range,t))}hideSelector(){this.selector.hide()}moveSelector(t,e){if(this.selection.move(t,e,this.model.columns.length,this.model.rows.length),0!=e&&!this.model.rows[this.selection.range.r1].visible){const t=e>0?this.model.rows[this.selection.range.r1].nextVisible:this.model.rows[this.selection.range.r1].prevVisible;t&&(this.selection.range.r1=t.index,this.selection.range.r2=t.index)}if(0!=t&&!this.model.columns[this.selection.range.c1].visible){const e=t>0?this.model.columns[this.selection.range.c1].nextVisible:this.model.columns[this.selection.range.c1].prevVisible;e&&(this.selection.range.c1=e.index,this.selection.range.c2=e.index)}this.selector.selection=this.selection.range,this.selector.updatePosition();const i={c:0,r:0};(e>0&&this.selector.offsetTop+this.selector.offsetHeight>this.grid.clientHeight||e<0&&this.selector.offsetTop<this.table.totalHeaderHeight-1||e>=this.table.viewport.rows.length)&&(i.r+=e),(t>0&&this.selector.offsetLeft+this.selector.offsetWidth>this.grid.clientWidth||t<0&&this.selector.offsetLeft<this.table.totalHeaderWidth-1)&&(i.c+=t),0==i.c&&0==i.r||(this.table.colOffset=Math.max(0,this.table.colOffset+i.c),this.table.rowOffset=Math.min(Math.max(0,this.table.rowOffset+i.r),this.model.visibleRows.length-1),this.table.renderCells({horizontal:0!=i.c,vertical:0!=i.r}),this.grid.rendering.updateSliders()),this.grid.editing.isFormulaMode||this.grid.editing.endEdit(),this.highlightSelection(),this.grid.dispatchEvent(new Xx("select",{grid:this.grid}))}shiftActiveCell(t,e=!1){this.selection.moveActiveCell(t,0),this.selector.updatePosition(),e&&this.grid.dispatchEvent(new Xx("select",{grid:this.grid}))}updateFormulaSelector(t=!0){this.grid.editing.isFormulaMode?this.showFormulaSelector(t):this.hideFormulaSelector()}showFormulaSelector(t=!0){this.grid.formulaSelector.show(),this.grid.formulaSelector?.select(this.formulaSelection.range,t)}hideFormulaSelector(){this.grid.formulaSelector.hide()}updateFormulaSelectors(){this.formulaSelectors.forEach((t=>t.updatePosition()))}highlightColorItem(t){const e=$x.fromRange(Ev.fromA1(t.address)),i=yt("og-selector");this.grid.shadowRoot.appendChild(i),i.addEventListener("grid.selector.move",(t=>this.select(t.selector.selection.clone()))),i.addEventListener("grid.selector.resize",(t=>this.select(t.selector.selection.clone()))),i.grid=this.grid,i.color=t.color,i.subselector=!1,i.movable=!0,i.resizable=!0,i.index=t.tokenIndex,this.formulaSelectors.set(t.tokenIndex,i),i.select(e.range.clone(),!1),i.show()}highlightFormula(t){this.removeFormulaHighlight(),this.formulaSelectors.clear();const e=new Set;t.colors.forEach((t=>{if(null==t.sheet||t.sheet==this.model.name)this.highlightColorItem(t);else if(this.grid.group){const i=this.grid.group.getGrid(t.sheet);if(!i)return;e.has(i)||(e.add(i),i.selecting.removeFormulaHighlight()),i.isConnected&&i.selecting.highlightColorItem(t)}}))}removeFormulaHighlight(){this.formulaSelectors?.forEach((t=>zt(t))),this.formulaSelectors.clear()}updateCopySelector(){this.grid.copySelector.isVisible&&this.grid.copySelector.updatePosition()}showCopySelector(){this.grid.copySelector.show(),this.grid.copySelector?.select(this.selection.range.clone(),!1)}hideCopySelector(){this.grid.copySelector.hide()}updateSelectors(){this.updateSelector(!1),this.updateCopySelector(),this.updateFormulaSelectors()}stopSelectOperations(){this.stopSelecting(),this.formulaSelectors.forEach((t=>t.stopSelectorOperations())),this.grid.style.removeProperty("cursor")}enter(){const t=this.grid.group;if(this.grid.editing.isFormulaMode&&t){const e=t.formulaModeGrid;e.editing.commitEdit(),t.activateGrid(e.model.name)}else this.debounceMoveSelector(0,1)}}class rk extends Event{}class sk extends En{get isOpen(){return this._open}get isValid(){return this._valid}validate(){return this._valid=!0,this.activeCell&&(this._valid=hw(this.activeCellModel,this.getValue())),this.classList.toggle("invalid",!this._valid),this._valid}constructor(){super(),this.cancel=!1,this._open=!1,this._valid=!0,this.init()}getDisplayValue(){return null}init(){this.addEventListener("keydown",(t=>{"Enter"==t.key?this.close():"Escape"==t.key?(this.cancel=!0,this.close()):t.stopPropagation()}))}connectedCallback(){super.connectedCallback(),this.performUpdate()}alignWithCell(){if(!this.activeCell)return;const t=Tt(this.activeCell,this.grid);Ht(this,{t:t.top*this.grid.zoom,l:t.left*this.grid.zoom}),Nt(this,{w:this.activeCell.offsetWidth,h:this.activeCell.offsetHeight})}open(t,e=null,i=!0){this._valid=!0,this.initialValue=e,this._open=!0,this.grid=t;const o=t.selecting.activeCell;return this.activeCellModel=o,this.activeCell=this.grid.table.getCellByModelIndex(o.c,o.r),this.grid.selector.hide(),xt(this),i&&this.alignWithCell(),this.activate(o),null!==e&&this.setValue(e),Jt(this,this.grid.zoom),this}commit(){this._open&&!this.cancel&&this.activeCellModel&&(this.grid.editing.updateCell(this.activeCellModel,{v:this.getValue(),dv:this.getDisplayValue()}),this.grid.rendering.updateCell(this.activeCellModel,!0)),this.cancel=!1}close(){this._open&&(this.deactivate(),kt(this),this.grid.table.renderBodyCell(this.activeCellModel),this.grid.selecting.showSelector(),this.grid.focus(),this._open=!1,this.grid.editing.endEdit()),this.cancel=!1}activate(t){this.activeCellModel=t,this.dispatchEvent(new rk("activate"))}deactivate(){this.dispatchEvent(new rk("deactivate"))}}sk.baseStyles=ks`
4396
+ `,this.clearHeaderCache=()=>{this.resetFreezeLeft(),this.hCache=new Dx(this.model.columns.length,this.columnHeaderCount),this.hCache.disabled=!this.model.options.cellCache},this.clearBodyCache=()=>{this.bCache=new Dx(this.model.columns.length,this.model.rows.length),this.bCache.disabled=!this.model.options.cellCache},this.cellRenderSchedules=new WeakMap}get thead(){return this._thead?this._thead:this._thead=yt("thead")}get tbody(){return this._tbody?this._tbody:this._tbody=yt("tbody")}get colgroup(){return this._colgroup?this._colgroup:this._colgroup=yt("colgroup")}get table(){return this._table||(this._table=yt("table"),this._table.appendChild(this.colgroup),this._table.appendChild(this.thead),this._table.appendChild(this.tbody)),this._table}get colMap(){return this._colMap}get rowMap(){return this._rowMap}get freezeLeft(){if(null==this._freezeLeft){const t=this.model.options.freezeLeft;if(t>=this.model.columns.length)this._freezeLeft=0;else if(this.offsetWidth>0){let e=0;for(let i=0;i<t;i++)e+=this.model.columns[i].width;this._freezeLeft=e<this.offsetWidth/2?t:0}else this._freezeLeft=t}return this._freezeLeft}get freezeTop(){return null==this._freezeTop&&(this._freezeTop=this.model.options.freezeTop),this._freezeTop}previewZoom(t){Jt(this.table,t)}highlightColHeaderCells(t){if(!this.model.options.colLetters)return;this._highlightedColHeaderCells.forEach((t=>t.className="hlabel")),this._highlightedColHeaderCells=[];const e=this.rowHeaderCount;t.forEach((t=>{const i=this.hRows[this.model.hasColumnTreeEnabled?1:0].children[this.colMap.get(t)+e];i&&(this._highlightedColHeaderCells.push(i),i.className="hlabel selected")}))}highlightRowHeaderCells(t){this.model.options.rowNumbers&&0!=this.model.rows.length&&(this._highlightedRowHeaderCells.forEach((t=>t.className="vlabel")),this._highlightedRowHeaderCells=[],t.forEach((t=>{const e=this.getRowByModelIndex(t)?.children[this.model.hasRowTreeEnabled?1:0];e&&(this._highlightedRowHeaderCells.push(e),e.className="vlabel selected")})))}get columnHeaderCount(){return this.model.headerCount+(this.model.hasColumnTreeEnabled?1:0)+(this.model.hasFilter?1:0)+(this.model.options.colLetters?1:0)}get rowHeaderCount(){return(this.model.hasRowTreeEnabled?1:0)+(this.model.options.rowNumbers?1:0)}get renderRowCount(){return this.renderAll?this.model.visibleRows.length:Math.round(Math.min(this.clientHeight/Ax.MIN_ROW_HEIGHT,this.model.rows.length))}get renderColCount(){return this.renderAll?this.model.visibleColumns.length+this.rowHeaderCount:Math.round(Math.min(this.clientWidth/Ax.MIN_COL_WIDTH||5,this.model.columns.length+this.rowHeaderCount))}get totalHeaderHeight(){let t=0,e=0;this.model.hasColumnTreeEnabled&&(t+=this.treeHeaderHeight,++e),this.model.options.colLetters&&(t+=this.thead.children[e].offsetHeight||this.model.options.rowHeight,++e);for(let i=0;i<this.model.headerCount;i++)t+=this.thead.children[e+i].offsetHeight||this.model.options.rowHeight;return this.model.hasFilter&&(t+=this.model.options.rowHeight),t}get treeHeaderWidth(){return this.model.hasRowTreeEnabled?15*this.model.maxRowLevel+20:0}get treeHeaderHeight(){return this.model.hasColumnTree?15*this.model.maxColumnLevel+20:0}get totalHeaderWidth(){let t=0;return this.model.options.rowNumbers&&(t+=Ax.ROW_HEADER_WIDTH),t+=this.treeHeaderWidth,t}get viewportSize(){return this._viewportSize||(this._viewportSize=this.renderAll?{w:1/0,h:1/0}:{w:(this.clientWidth-this.totalHeaderWidth-Ax.SLIDER_SIZE)/this.zoom,h:(this.clientHeight-this.totalHeaderHeight-Ax.SLIDER_SIZE)/this.zoom}),this._viewportSize}get viewport(){return this._viewport||(this._viewport=this.model.getViewport({c:this.colOffset,r:this.rowOffset},this.viewportSize,{t:this.model.options.freezeTop,l:this.freezeLeft,b:this.model.options.freezeBottom,r:this.model.options.freezeRight})),this._viewport}get viewportRange(){return 0==this.viewport.columns.length||0==this.viewport.rows.length?null:new Ev(this.viewport.columns[0].index,this.viewport.rows[0].index,this.viewport.columns[this.viewport.columns.length-1].index,this.viewport.rows[this.viewport.rows.length-1].index)}findColumnIndexByOffset(t){let e=0;const i=this.colgroup.children;for(let o=0;o<i.length;o++)if(e+=i[o].offsetWidth,e>=t)return o;return-1}findRowByOffset(t){const e=(t>this.thead.offsetHeight?this.tbody:this.thead).children;t>this.thead.offsetHeight&&(t-=this.thead.offsetHeight);let i=0;for(let o=0;o<e.length;o++){const r=e[o];if(i+=r.offsetHeight,i>=t)return r}return null}findTableCellByOffset(t,e){t/=this.zoom,e/=this.zoom;const i=this.findRowByOffset(e),o=this.findColumnIndexByOffset(t),r=i&&o>-1?i.children[o]:null;return r&&!Ct(r)?r:null}findNearestTableCellByOffset(t,e){let i,o;t/=this.zoom,e/=this.zoom;const r=this.findRowByOffset(e),s=this.findColumnIndexByOffset(t);i=e<0?this.tbody.children[0]:e>this.tbody.offsetHeight+this.thead.offsetHeight?this.tbody.children[this.viewport.rows.length-1]:r,o=t<0?this.rowHeaderCount:t>=this.tbody.offsetWidth?this.viewport.columns.length+this.rowHeaderCount-1:s;let n=i&&o>-1?i.children[o]:null;for(;n&&Ct(n);)n=n.previousElementSibling;const a=r&&s>-1?r.children[s]:null;return[n,a&&!Ct(a)?a:null]}connectedCallback(){super.connectedCallback(),this.grid=Et(this,"og-grid")}willUpdate(){this._viewport=null,this._viewportSize=null,this.model&&(this.clearHeaderCache(),this.clearBodyCache())}updated(){this.model&&(this.createColumns(),this.createHeaderRows(),this.createBodyRows(),this.renderCells())}refresh(){this.clearHeaderCache(),this.clearBodyCache(),this.requestUpdate()}createColumns(){this._freezeLeft=null;const t=this.renderColCount;if(!this.cols||this.cols.length!=t){this.cols=new Array(t);for(let e=0;e<t;e++)this.cols[e]=yt("col"),this.cols.forEach((()=>this.colgroup.appendChild(this.cols[e])))}}createHeaderRows(){const t=this.columnHeaderCount,e=this.renderColCount;if(St(this.thead),!this.hRows||this.hRows.length!=t||!this.hRows[0]||this.hRows[0].children.length!=e){this.hRows=new Array(t);for(let i=0;i<t;i++){this.hRows[i]=yt("tr");for(let t=0;t<e;t++)this.hRows[i].appendChild(yt("th"))}}St(this.thead),this.hRows.forEach((t=>this.thead.appendChild(t)))}createBodyRows(){const t=this.renderRowCount,e=this.renderColCount,i=this.rowHeaderCount;if(!this.bRows||0==this.bRows.length||this.bRows.length!=t||this.bRows[0].children.length!=e)if(0==t&&this.grid.options.emptyPlaceholder)this.bRows=[yt("tr")],this.bRows[0].appendChild(yt("td"));else{this.bRows=new Array(t);for(let o=0;o<t;o++){this.bRows[o]=yt("tr");for(let t=0;t<i;t++)this.bRows[o].appendChild(yt("th"));for(let t=i;t<e;t++)this.bRows[o].appendChild(yt("td"))}}St(this.tbody),this.bRows.forEach((t=>this.tbody.appendChild(t)))}renderCells(t={vertical:!0,horizontal:!0}){this.table&&(t.vertical||t.horizontal)&&(this._viewport=null,t.horizontal&&this.renderHeader(),this.model.rows.length>0?(this.renderBody(),t.vertical&&this.renderRowTree()):this.model.options.emptyPlaceholder&&(this.renderEmptyBody(),this.table.appendChild(this.tbody)),this.dispatchEvent(new Gx("rendercells")))}renderEmptyBody(){const t=this.bRows[0].children[0];t.innerHTML="no data",t.className="empty-placeholder",t.colSpan=this.viewport.columns.length+this.rowHeaderCount}renderHeader(){let t;this.colMap.clear();const e=this.rowHeaderCount,i=this.viewport;this.model.hasRowTreeEnabled&&Nt(this.colgroup.children[0],{w:this.treeHeaderWidth},!0),this.model.options.rowNumbers&&Nt(this.colgroup.children[e-1],{w:Ax.ROW_HEADER_WIDTH},!0);for(let o=0;o<i.columns.length;o++)t=i.columns[o],this.model.autofitColumns.has(t.index)&&(this.grid.rendering.autofitColumn(t.index,!0,!1),this.model.autofitColumns.delete(t.index)),this.colMap.set(t.index,o),Nt(this.colgroup.children[o+e],{w:t.width}),jt(this.colgroup.children[o+e],{w:t.width}),Pt(this.colgroup.children[o+e],{w:t.width});let o=0;this.model.hasColumnTreeEnabled&&(this.renderHeaderRowTree(this.hRows[o],o),++o),this.model.options.colLetters&&(Nt(this.hRows[o],{h:this.model.options.rowHeight}),this.renderHeaderRowLetters(this.hRows[o],o),++o);for(let t=0;t<this.model.headerCount;t++)this.renderHeaderRowLabels(this.hRows[o+t],o+t,t);o+=this.model.headerCount,this.model.hasFilter&&(Nt(this.hRows[o],{h:this.model.options.rowHeight}),this.renderHeaderRowFilters(this.hRows[o],o))}renderHeaderRowLetters(t,e){let i,o;const r=this.viewport,s=e-this.columnHeaderCount;let n=0;if(Nt(t,{h:this.model.options.rowHeight}),(this.model.hasRowTree||this.model.options.rowNumbers)&&!this.model.hasColumnTreeEnabled){i=t.children[n],i.colSpan=this.rowHeaderCount,i.rowSpan=this.columnHeaderCount;const e=n-this.rowHeaderCount,o=this.model.options.levelButtonCell;(!o||s==o.r&&e==o.c)&&this.renderHeaderRowCornerCell(i),n++}for(let e=n;e<this.rowHeaderCount;e++)_t(t.children[e]),n++;for(let e=n;e<t.children.length;e++)o=e-n,i=t.children[e],i.className="hlabel",r.columns.length>o?(i.innerHTML=r.columns[o].address,i.c=r.columns[o].index,Mt(i)):_t(i)}renderHeaderRowTree(t,e){if(!this.model.hasColumnTreeEnabled)return;let i,o,r=0;const s=e-this.columnHeaderCount,n=this.viewport,a=this.model.options.rowNumbers,l=this.model.hasRowTreeEnabled;if(Nt(t,{h:this.treeHeaderHeight}),i=t.children[r],!i)return;i.rowSpan=a||l?this.columnHeaderCount:1,i.colSpan=this.rowHeaderCount;const c=r-this.rowHeaderCount,h=this.model.options.levelButtonCell;let d=null;(!h&&(a||l)||h&&s==h.r&&c==h.c)&&(d=c,this.renderHeaderRowCornerCell(i)),(a||l)&&++r;for(let s=r;s<t.children.length;s++)o=s-r,i=t.children[s],n.columns.length>o?(d!=s&&(i.innerHTML="",i.className="htree",this.renderHeaderRowTreeCell(t,e,n.columns[o],i)),Mt(i)):_t(i)}renderHeaderRowTreeCell(t,e,i,o){let r=this.hCache.get(i.index,e);if(!r){r=yt("div"),this.hCache.set(i.index,e,r);const t=i.width+1,o=this.treeHeaderHeight/this.model.maxColumnLevel;if(i.hasChildren){const e=new qu;e.addEventListener("toggle",(()=>this.grid.rendering.toggleColumn(i.index))),r.expander=e,r.appendChild(e),Ht(e,{l:t/2-Ax.EXPANDER_SIZE/2,t:i.level*o+o/2-Ax.EXPANDER_SIZE/2}),r.expanderLine=this.createExpanderLine("h"),r.appendChild(r.expanderLine),Ht(r.expanderLine,{l:this.model.options.columnTree.reversed?0:t/2,t:i.level*o+o/2}),Nt(r.expanderLine,{h:o/2,w:t/2+1})}if(i.hasParent){let e=i;for(;e.hasParent;){e=e.parent;const i=this.createExpanderLine("h");r.appendChild(i),Nt(i,{h:o/2,w:t-1}),Ht(i,{l:0,t:e.level*o+o/2})}}}r.expander&&(r.expander.state=i.collapsed?"closed":"open"),o.appendChild(r)}createExpanderLine(t){const e=yt("div");return e.className=`${t}tree-line`,e}renderHeaderRowLabels(t,e,i){let o,r,s,n,a=0;const l=this.viewport,c=e-this.columnHeaderCount,h=this.model.options.levelButtonCell;let d;this.model.hasRowTreeEnabled&&(r=t.children[a],r.innerHTML="",this.model.hasColumnTreeEnabled||this.model.options.colLetters||i>0?_t(r):(r.rowSpan=this.columnHeaderCount,r.colSpan=this.rowHeaderCount,this.renderHeaderRowCornerCell(r)),++a),this.model.options.rowNumbers&&(r=t.children[a],r.innerHTML="",this.model.hasRowTreeEnabled||this.model.options.colLetters||this.model.hasColumnTreeEnabled||i>0?_t(r):(r.rowSpan=this.columnHeaderCount,r.colSpan=this.rowHeaderCount,this.renderHeaderRowCornerCell(r)),++a);for(let u=a;u<t.children.length;u++)if(n=u-a,r=t.children[u],r.className="hlabel",r.innerHTML="",l.columns.length>n)if(o=l.columns[n],s=o.header[i],s.height&&(d=Math.max(s.height,d||0)),r.colSpan=1,r.rowSpan=1,r.c=o.index,r.r=i,s?.hidden)if(n==this.freezeLeft){let t=o.prevVisible,s=0;for(;t&&t.header[i]?.hidden;)t=t.prevVisible,++s;t&&t.header[i].cs?(Mt(r),r.colSpan=t.header[i].cs-s-1,r.rowSpan=t.header[i].rs||1,this.renderHeaderRowLabelCell(r,t,e,i)):_t(r)}else _t(r);else{if(o.header&&o.header[i]){const t=o.header[i].cs||1;r.colSpan=t>1?o.calculateRealColspan(t):1,r.rowSpan=o.header[i].rs||1}Mt(r),this.renderHeaderRowLabelCell(r,o,e,i),h&&h.r==c&&h.c==o.index&&this.renderHeaderRowCornerCell(r)}else _t(r);Nt(t,{h:d??this.model.options.rowHeight})}renderHeaderRowLabelCell(t,e,i,o){let r=this.hCache.get(e.index,i);const s=e.header[o];if(r||(r=yt("div"),s?s.html?r.innerHTML=s.label??"":r.innerText=s.label??"":r.innerHTML="",s&&null!=s._style&&bC(r,xw(this.model.styles.get(s._style))),this.hCache.set(e.index,i,r)),this.model.options.columnHeaderTreeButtons&&e.hasChildren&&o==e.level){let t=r.expander;t||(t=new qu,t.addEventListener("toggle",(()=>this.grid.rendering.toggleColumn(e.index))),r.expander=t,r.prepend(t),Ht(t,{l:4,t:4})),t.state=e.collapsed?"closed":"open"}if(e.sorting&&o==e.header.length-1&&(t.className+=" sort",r.sortingArrow||(r.sortingArrow=yt("og-sortingarrow"),r.appendChild(r.sortingArrow),Ht(r.sortingArrow,{t:2,r:5})),r.sortingArrow.sortSettings=this.model.sorting.get(e.index)),e.hasHeaderTooltip(o)){const t=yt("div");t.className="crn",r.appendChild(t),r.classList.add("tt")}t.appendChild(r)}renderHeaderRowFilters(t,e){let i,o,r=0;const s=this.viewport;this.model.hasRowTreeEnabled&&(i=t.children[r],i.innerHTML="",this.model.columnHeaderCount>1?_t(i):i.colSpan=this.model.columnHeaderCount,++r),this.model.options.rowNumbers&&(i=t.children[r],i.innerHTML="",this.model.hasRowTreeEnabled||this.model.options.colLetters||this.model.hasColumnTreeEnabled||this.model.headerCount>0?_t(i):(i.rowSpan=this.columnHeaderCount,i.colSpan=this.rowHeaderCount,this.renderHeaderRowCornerCell(i)),++r);for(let n=r;n<t.children.length;n++)if(o=n-r,i=t.children[n],s.columns.length>o){Mt(i);const r=s.columns[o];r.hasFilter?this.renderHeaderRowFilterCell(t,e,r,i):i.innerHTML=""}else _t(i)}renderHeaderRowFilterCell(t,e,i,o){o.innerHTML="",o.className="filter",o.c=i.index;let r=this.hCache.get(i.index,e);r||(r=yt("div"),r.filter=yt("og-filter-label"),r.appendChild(r.filter),this.hCache.set(i.index,e,r));const s=this.model.filter.get(i.index)?.term;r.filter.value=Array.isArray(s)?s.map((t=>t.value??t.key)).join(", "):s,o.appendChild(r)}renderHeaderRowCornerCell(t){this.cornerDiv=yt("div");const e=Math.max((this.treeHeaderWidth||Ax.EXPANDER_SIZE+2)/(this.model.maxRowLevel+1),Ax.EXPANDER_SIZE+2);if(this.model.hasRowTree)for(let t=0;t<=this.model.maxRowLevel;t++){const i=new Yu;i.level=t,this.cornerDiv.appendChild(i),Ht(i,{l:t*e+e/2-Ax.EXPANDER_SIZE/2,b:3}),i.addEventListener("mousedown",(t=>t.stopPropagation())),i.addEventListener("toggle",(t=>{this.model.columns.filter((t=>t.levelButtons)).forEach((t=>this.bCache.deleteColumn(t.index))),this.grid.rendering.setRowExpandLevel(t.level)}))}if(this.model.hasColumnTree){const i=(this.model.hasColumnTree?this.treeHeaderHeight:t.clientHeight)/(this.model.maxColumnLevel+1),o=15*this.model.maxColumnLevel+20<=t.clientHeight;for(let t=0;t<=this.model.maxColumnLevel;t++){const r=new Yu;r.level=t,this.cornerDiv.appendChild(r),Ht(r,o?{t:t*i+i/2-Ax.EXPANDER_SIZE/2,r:3}:{r:t*e+e/2-Ax.EXPANDER_SIZE/2,b:3}),r.addEventListener("mousedown",(t=>t.stopPropagation())),r.addEventListener("toggle",(t=>{this.grid.rendering.setColumnExpandLevel(t.level)}))}}St(t),t.appendChild(this.cornerDiv)}renderBody(){let t,e,i,o,r,s,n,a,l;const c=this.freezeLeft||0,h=this.rowHeaderCount,d=this.model.merges,u=this.model.options.rowNumbers,p=this.viewport,g=this.viewportRange;if(!g)return;const m=new Ev(this.colOffset+c,this.rowOffset,g.c2,g.r2);this.rowMap.clear();for(let c=0;c<this.bRows.length;c++)if(t=this.bRows[c],c<p.rows.length){i=p.rows[c],o=i.index,this.model.autofitRows.has(o)&&(this.grid.rendering.autofitRow(o,!1,!1),this.model.autofitRows.delete(o)),Nt(t,{h:i.height}),i.height<this.model.options.rowHeight&&Vt(t,i.height),this.rowMap.set(o,c),u&&(e=t.children[h-1],e.className="vlabel",e.r=o,e.c=-1,e.innerHTML=`<div>${Lv(o)}</div>`);for(let c=h;c<t.children.length;c++)if(e=t.children[c],c-h<p.columns.length){if(s=p.columns[c-h],r=s.index,e.r=o,e.c=r,n=i.cell(r),a=n.address,l=d.getMergeState(a),l==zx.HIDDEN){const t=d.hiddenCells.get(n.address),i=m.intersect(new Ev(t.c,t.r,t.c+t.cs-1,t.r+t.rs-1));if(!i||n.c!=i.c1||n.r!=i.r1){_t(e);continue}n=this.model.rows[t.r].cell(t.c),e.colSpan=i.size.columns,e.rowSpan=i.size.rows,e.c=n.c,e.r=n.r}else if(l==zx.MERGED){const t=n.merge;e.colSpan=t.cs,e.rowSpan=t.rs}else e.colSpan=1,e.rowSpan=1;Mt(e),this.renderBodyCell(n,e)}else _t(e);t.style.display="table-row",t.className=i.filterState>1?"filtered":""}else t.style.display="none"}scheduleRenderBodyCell(t,e){this.cellRenderSchedules.has(e)&&(window.clearTimeout(this.cellRenderSchedules.get(e)),this.cellRenderSchedules.delete(e)),this.cellRenderSchedules.set(e,window.setTimeout((()=>this.renderBodyCell(t,e))))}fixCellBorders(t,e){"none"==e.bottom?.style&&(t.style.borderBottomColor="transparent"),"none"==e.top?.style&&(t.style.borderTop="transparent"),"none"==e.right?.style&&(t.style.borderRight="transparent"),"none"==e.left?.style&&(t.style.borderLeft="transparent")}renderBodyCell(t,e){const i=!e;if(e=e||this.getCellByCellModel(t)){let o=i?null:this.bCache.get(t.c,t.r);if(o||(o=yt("div"),IC(t).call(this,o,t),this.bCache.set(t.c,t.r,o)),this.renderAll){const i=t.composedStyle;i&&this.fixCellBorders(e,i)}St(e),e.appendChild(o)}else this.bCache.delete(t.c,t.r)}mergeBodyCells(t){let e;const i=new Set;for(const o of t)if(e=this.bRows[o.r].cells[o.c],e&&!i.has(e))for(let t=o.r;t<o.r+o.rs;t++)for(let r=o.c;r<o.c+o.cs;r++)e=this.bRows[t].cells[r],e&&(t==o.r&&r==o.c?(e.colSpan=o.cs,e.rowSpan=o.rs):(i.add(e),_t(e)))}renderRowTree(){if(!this.model.hasRowTreeEnabled)return;let t;const e=this.viewport,i=-this.rowHeaderCount;for(let o=0;o<this.bRows.length;o++)t=this.bRows[o].children[0],t.innerHTML="",o<e.rows.length&&(t.className="vtree",this.renderRowTreeCell(i,e.rows[o],t))}renderRowTreeCell(t,e,i){let o=this.bCache.get(t,e.index);if(!o){o=yt("div"),this.bCache.set(t,e.index,o);const r=e.height+1,s=this.treeHeaderWidth/this.model.maxRowLevel;if(e.hasChildren){const t=new qu;t.addEventListener("toggle",(()=>this.grid.rendering.toggleRow(e.index))),i.parentElement.expander=t,o.expander=t,o.appendChild(t),Ht(t,{t:r/2-Ax.EXPANDER_SIZE/2,l:e.level*s+s/2-Ax.EXPANDER_SIZE/2});const n=this.createExpanderLine("v");o.appendChild(n),Ht(n,{t:this.model.options.rowTree.reversed?0:r/2,l:e.level*s+s/2}),Nt(n,{w:s/2,h:r/2+1})}if(e.hasParent){let t=e;for(;t.hasParent;){t=t.parent;const e=this.createExpanderLine("v");o.appendChild(e),Nt(e,{w:s/2,h:r+2}),Ht(e,{t:-1,l:t.level*s+s/2})}}}o.expander&&(o.expander.state=e.collapsed?"closed":"open"),i.appendChild(o)}};qx.styles=[Vx],Ux([$n({type:Object})],qx.prototype,"model",void 0),Ux([$n({type:Boolean,reflect:!0})],qx.prototype,"hideOuterBorder",void 0),Ux([$n({type:Number,hasChanged:()=>!1})],qx.prototype,"rowOffset",void 0),Ux([$n({type:Number,hasChanged:()=>!1})],qx.prototype,"colOffset",void 0),Ux([$n({type:Number,reflect:!0})],qx.prototype,"zoom",void 0),Ux([$n({type:Boolean,reflect:!0})],qx.prototype,"nogrid",void 0),Ux([$n({type:Boolean,reflect:!0})],qx.prototype,"renderAll",void 0),qx=Ux([In("og-table")],qx);const Yx=["F5","F12"];class Zx extends Event{constructor(t){super("grid.error",{bubbles:!0,composed:!0}),this.error=t}}class Xx extends Event{get selection(){return this.grid.selecting.selection}get activeCell(){return this.selection.activeCell}constructor(t,e){super(`grid.${t}`,{bubbles:!0,composed:!0}),Object.assign(this,e),this.cell&&(this.row=this.cell.row,this.column=this.cell.column)}}class Qx extends Xx{constructor(t){super("edit",t)}}class Kx extends Sp{constructor(t,e,i){super(`grid.${t}`,i),this.grid=e}}class Jx extends Kx{constructor(t,e,i,o){super(t,e,o),this.column=i}}class tk extends Kx{constructor(t,e,i,o){super(t,e,o),this.row=i}}class ek{get model(){return this.grid.model}get selection(){return this.grid.selection}get table(){return this.grid.table}constructor(t){this.grid=t,this.clickDisabled=!1,this.editDisabled=!1,this.clicked=!1,this.startOffset={x:0,y:0},this.suspendClick=()=>this.clickDisabled=!0,this.resumeClick=(t=!1)=>{this.isSliding||(t?setTimeout((()=>this.clickDisabled=!1),100):this.clickDisabled=!1)},this._onKeyDown=t=>{switch(Yx.includes(t.key)||t.preventDefault(),t.key){case"Tab":t.preventDefault(),this.grid.selecting.shiftActiveCell(t.shiftKey?-1:1,!0);break;case"ArrowRight":this.grid.selecting.debounceMoveSelector(1,0);break;case"ArrowLeft":this.grid.selecting.debounceMoveSelector(-1,0);break;case"ArrowDown":this.grid.selecting.debounceMoveSelector(0,1);break;case"ArrowUp":this.grid.selecting.debounceMoveSelector(0,-1);break;case"PageUp":this.grid.selecting.debounceMoveSelector(0,-this.table.viewport.rows.length);break;case"PageDown":this.grid.selecting.debounceMoveSelector(0,this.table.viewport.rows.length);break;case"Home":this.grid.selecting.debounceMoveSelector(-this.selection.range.c1,t.ctrlKey?-this.selection.range.r1:0);break;case"End":this.grid.selecting.debounceMoveSelector(this.model.gridRange.c2-this.selection.range.c1,t.ctrlKey?this.model.gridRange.r2-this.selection.range.r1:0);break;case"Enter":this.grid.selecting.enter();break;case"Escape":this.grid.selecting.hideCopySelector();break;case"c":case"C":t.ctrlKey&&this.grid.editing.copySelection();break;case"v":case"V":t.ctrlKey&&this.grid.editing.paste();break;case"z":case"Z":if(!this.grid.options.undoRedo)return;t.ctrlKey&&this.grid.editing.undo();break;case"y":case"Y":if(!this.grid.options.undoRedo)return;t.ctrlKey&&this.grid.editing.redo();break;case"F2":t.preventDefault(),this.grid.editing.startEdit();break;case"Delete":t.preventDefault(),this.grid.objects.delete(),this.grid.editing.clearSelection();break;case"Backspace":t.preventDefault(),this.grid.editing.clearSelection();break;case"F1":if(!this.grid.options.commandWindow)return;t.preventDefault(),this.grid.openCommands()}1!=t.key.length||t.ctrlKey||this.grid.editing.startEdit(t.key)},this._onMouseMove=t=>{if(!this.model)return;let e=!0,i=!0;const o=this.grid.hSizer,r=this.grid.vSizer,{offsetX:s,offsetY:n}=t;let a=this.model.options.scrolling.scrollbarVisibilityTreshold;a<=0&&(a=Math.max(this.grid.clientWidth,this.grid.clientHeight)),s>this.grid.clientWidth-a?this.grid.vSlider.show():this.grid.vSlider.hide(),n>this.grid.clientHeight-a?this.grid.hSlider.show():this.grid.hSlider.hide();const[l,c]=this.table.findNearestTableCellByOffset(s,n);if(c&&"TH"==c.tagName&&(this.model.options.columnResize&&!o.resizing&&c.classList.contains("hlabel")?c.offsetWidth-t.offsetX+c.offsetLeft<Ax.RESIZE_TRESHOLD?(o.snap(c,this.grid),this.grid.rendering.currentResizedColumn=this.model.columns[c.c]):kt(o):this.model.options.rowResize&&!r.resizing&&c.classList.contains("vlabel")&&(c.offsetHeight-t.offsetY+c.offsetTop<Ax.RESIZE_TRESHOLD?(r.snap(c,this.grid),this.grid.rendering.currentResizedRow=this.model.rows[c.r]):kt(r)),null!=c.c)){const t=this.model.columns[c.c];t?.hasHeaderTooltip(c.r)&&(e=!1,this.grid.tooltip.attachToCell(c,t.header[c.r],"bottom"))}if(l&&"TH"==l.tagName)this.grid.selecting.isSelecting&&(this.suspendClick(),this.grid.selecting.updateSelecting(l.c,l.r)),i=!1;else if(l&&"TD"==l.tagName)if(this.grid.selecting.isSelectorOperationActive||this.grid.selecting.isFormulaSelectorOperationActive){const{top:e,left:i}=Tt(l,this.grid);this.grid.rendering.autoscroll({x:i-this.table.totalHeaderWidth+t.offsetX-l.offsetLeft,y:e-this.table.thead.clientHeight+t.offsetY-l.offsetTop}),this.grid.selecting.isSelecting&&this.suspendClick(),this.grid.selecting.updateSelecting(l.c,l.r)}else{const t=this.model.rows[l.r]?.cell(l.c);t&&t.hasTooltip&&(e=!1,this.grid.tooltip.attachToCell(l,t)),t&&t.hasComment&&(e=!1,this.grid.comment.attachedTo!==l&&this.grid.comment.attachTo(l,t))}e&&(this.grid.tooltip.deatach(),this.grid.comment.deatach(this.model.options.comments.hideTimeout)),i&&(kt(o),kt(r))},this._onMouseDown=t=>{if(!(1&t.buttons))return;this.grid.setPointerCapture(t.pointerId),this.startOffset={x:t.offsetX,y:t.offsetY};const e=t.shiftKey;for(const i of t.composedPath()){if("TD"==i.tagName){const t=i;this.grid.selecting.startCellSelecting(new Ev(t.c,t.r),e);break}if("TH"==i.tagName){const t=i;i.matches(".sort")?this.grid.sorting.sort(t.c):t.classList.contains("filter")?this.grid.filtering.openFilter(this.model.columns[t.c],t):t.classList.contains("hlabel")?this.grid.selecting.startColumnSelecting(t.c,e):t.classList.contains("vlabel")&&this.grid.selecting.startRowSelecting(t.r,e);break}}},this._onMouseUp=t=>{if(0!=t.buttons)return;const e=Math.abs(this.startOffset.x-t.offsetX),i=Math.abs(this.startOffset.y-t.offsetY);Math.sqrt(Math.pow(e,2)+Math.pow(i,2))<this.model.options.events.click.mouseMoveTreshold&&this.resumeClick(),this.grid.releasePointerCapture(t.pointerId),this.grid.selecting.stopSelectOperations()},this._onClick=t=>{if(this.clickDisabled)return;if(this.grid.clientHeight-t.offsetY<this.grid.hSlider.offsetHeight)return;if(this.grid.clientWidth-t.offsetX<this.grid.vSlider.offsetWidth)return;const e=this.table.findTableCellByOffset(t.offsetX,t.offsetY),i="TD"==e?.tagName?this.model.rows[e.r]?.cell(e.c):null;this.grid.dispatchEvent(new Xx("click",{grid:this.grid,cell:i}))},this._onContextMenu=t=>{t.preventDefault();for(const e of t.composedPath())if("TD"==e.tagName){const i=e;this.grid.menus.openCellMenu(this.model.rows[i.r].cell(i.c),{x:t.pageX,y:t.pageY})}else if("TH"==e.tagName){const i=e;i.classList.contains("hlabel")?this.grid.menus.openColumnMenu(this.model.columns[i.c],{x:t.pageX,y:t.pageY}):i.classList.contains("vlabel")&&this.grid.menus.openRowMenu(this.model.rows[i.r],{x:t.pageX,y:t.pageY})}},this._onVerticalSlide=t=>{this.table.rowOffset=Math.min(t.value,this.model.visibleRows.length-1),this.grid.rendering.requireVerticalUpdate=!0,this.grid.rendering.renderCells()},this._onHorizontalSlide=t=>{this.table.colOffset=Math.min(t.value,this.model.visibleColumns.length-1),this.grid.rendering.requireHorizontalUpdate=!0,this.grid.rendering.renderCells()},this._onSlideStart=()=>{this.suspendClick()},this._onSlideStop=()=>{this.resumeClick(!0)},this._denbounceHorizontalScroll=q((t=>this.grid.rendering.scrollHorizontalByPixels(t)),50),this._onWheel=t=>{t.ctrlKey||(0!=t.deltaY&&this.grid.rendering.scrollVerticalByPixels(t.deltaY),0!=t.deltaX&&this._denbounceHorizontalScroll(Math.sign(t.deltaX)*Math.min(100,Math.abs(t.deltaX))))},this._onTouchStart=t=>{this.grid.rendering.touchStartX=t.touches[0],this.grid.rendering.touchStartY=t.touches[0]},this._onTouchEnd=t=>{this.grid.rendering.touchStartX=t.touches[0],this.grid.rendering.touchStartY=t.touches[0]},this._onTouchMove=t=>{const e=this.grid.rendering;if(e.touchStartY){const i=e.touchStartY.clientY-t.touches[0].clientY;Math.abs(i)>this.model.options.rowHeight&&this.table.viewport.rows.length>0&&(e.scrollVerticalByPixels(i),e.touchStartY=t.touches[0])}if(e.touchStartX){const i=e.touchStartX.clientX-t.touches[0].clientX;Math.abs(i)>this.model.options.columnWidth&&this.table.viewport.columns.length>0&&(e.scrollHorizontalByPixels(i),e.touchStartX=t.touches[0])}},this._onHorizontalResizeStart=()=>{this.grid.rendering.resizing=!0,this.grid.rendering.currentResizedColumnWidth=this.grid.rendering.currentResizedColumn.width},this._onHorizontalResizeStop=t=>{this.suspendClick(),this.grid.rendering.resizing=!1,this.table.clearHeaderCache(),this.table.renderCells({horizontal:!0}),this.grid.dispatchEvent(new Jx("column.resize",this.grid,this.grid.rendering.currentResizedColumn,t))},this._onHorizontalResize=t=>{const e=this.grid.rendering;e.currentResizedColumn.width=e.currentResizedColumnWidth+t.deltaX,Nt(this.table.getColumnByModelIndex(e.currentResizedColumn.index),{w:e.currentResizedColumn.width},!0),this.grid.selecting.updateSelector()},this._onVerticalResizeStart=()=>{this.grid.rendering.resizing=!0,this.grid.rendering.currentResizedRowHeight=this.grid.rendering.currentResizedRow.height},this._onVerticalResizeStop=t=>{this.suspendClick(),this.grid.rendering.resizing=!1,this.table.clearBodyCache(),this.table.renderCells({vertical:!0}),this.grid.dispatchEvent(new tk("row.resize",this.grid,this.grid.rendering.currentResizedRow,t))},this._onVerticalResize=t=>{const e=this.grid.rendering;e.currentResizedRow.height=e.currentResizedRowHeight+t.deltaY,Nt(this.table.getRowByModelIndex(e.currentResizedRow.index),{h:e.currentResizedRow.height},!1),this.grid.selecting.updateSelector()},this._onCommentCommit=t=>{this.grid.model.comments.set(t.cell.address,t.items),t.cell.invalidateStyle(),this.grid.rendering.updateCells([t.cell])},this._onAutofill=t=>{if(this.suspendClick(),this.grid.selection.range.equals(t.selector.autofillRange))return;const{cells:e,oldValues:i}=lw(this.model,this.grid.selection.range,t.selector.autofillRange,t.selector.autofillDirection);this.grid.rendering.updateCells(e,!0),this.grid.selection.setRange(this.grid.selection.range.unite(t.selector.autofillRange)),this.grid.selecting.updateSelector(),this.grid.dispatchEvent(new Qx({grid:this.grid,editType:"autofill",cells:e,oldValues:i,newValues:e.map((t=>t.value2))}))},this._onEdit=t=>{if(t.fromHistory)return;const e=[],i=[],o=this.model.names.rangeMap;let r=[],s=[],n=[],a=[];switch(t.editType){case"value":r=t.newValues,s=t.newProps,n=t.oldValues,a=t.oldProps,t.cells.forEach((t=>{const r=t.address;e.push(r),i.push(o.get(r))}));break;case"insert_column":case"insert_row":t.newValues.forEach((t=>{const s=t.address;e.push(s),i.push(o.get(s)),r.push(t.getSourceData())}))}this.grid.history.push({type:t.editType,addresses:e,names:i,oldValues:n,oldProps:a,newValues:r,newProps:s})},this._onSelectorMove=t=>{this.suspendClick(),this.selection.setRange(t.toRange),t.fromRange.isRow?this.grid.editing.moveRows({index:t.fromRange.r1,count:t.fromRange.size.rows,targetIndex:t.toRange.r1}):t.fromRange.isColumn?this.grid.editing.moveColumns({index:t.fromRange.c1,count:t.fromRange.size.columns,targetIndex:t.toRange.c1}):console.log(t)},this._onMouseLeave=()=>{this.grid.rendering.hideSliders()},this.debounceHideSliders=q((()=>this.grid.rendering.hideSliders()),1e3,{isImmediate:!1}),this._onRender=()=>{const t=this.grid;t.selecting.updateSelectors(),t.dispatchEvent(new Xx("render",{grid:this.grid})),t.adapter&&t.options.pageSize&&t.rendering.isLastRowInViewport()&&t.rendering.loadNextPage(),t.rendering.updateSliderVisibility(),this.model.options.scrolling.scrollbarVisibilityTreshold>0&&this.debounceHideSliders()},this._onHorizontalSizerDblClick=t=>{t.stopPropagation(),this.editDisabled=!0,this.grid.rendering.autofitColumn(this.grid.rendering.currentResizedColumn.index),this.grid.dispatchEvent(new Jx("column.resize",this.grid,this.grid.rendering.currentResizedColumn,t))},this._onVerticalSizerDblClick=t=>{t.stopPropagation(),this.editDisabled=!0,this.grid.rendering.autofitRow(this.grid.rendering.currentResizedRow.index),this.grid.dispatchEvent(new tk("row.resize",this.grid,this.grid.rendering.currentResizedRow,t))},this._onDblClick=()=>{this.editDisabled?this.editDisabled=!1:this.grid.editing.startEdit()}}get isSliding(){return this.grid.hSlider.sliding||this.grid.vSlider.sliding}async init(){await this.grid.updateComplete,await this.table.updateComplete;const t=this.grid;t.addEventListener("wheel",this._onWheel,{passive:!0}),t.addEventListener("touchstart",this._onTouchStart,{passive:!0}),t.addEventListener("touchend",this._onTouchEnd,{passive:!0}),t.addEventListener("touchmove",this._onTouchMove,{passive:!0}),t.hSizer.addEventListener("resizestart",this._onHorizontalResizeStart),t.hSizer.addEventListener("resizestop",this._onHorizontalResizeStop),t.hSizer.addEventListener("resize",this._onHorizontalResize),t.hSizer.addEventListener("dblclick",this._onHorizontalSizerDblClick),t.vSizer.addEventListener("resizestart",this._onVerticalResizeStart),t.vSizer.addEventListener("resizestop",this._onVerticalResizeStop),t.vSizer.addEventListener("resize",this._onVerticalResize),t.vSizer.addEventListener("dblclick",this._onVerticalSizerDblClick),t.comment.addEventListener("comment.commit",this._onCommentCommit),t.addEventListener("keydown",this._onKeyDown),t.addEventListener("click",this._onClick),t.addEventListener("contextmenu",this._onContextMenu),t.addEventListener("toggle",(()=>t.rendering.debounceCalculateViewport())),t.addEventListener("pointerup",this._onMouseUp),t.addEventListener("pointerdown",this._onMouseDown);const e=q(this._onMouseMove,20,{maxWait:50,isImmediate:!0});t.addEventListener("pointermove",e),t.addEventListener("mouseleave",this._onMouseLeave),t.table.addEventListener("rendercells",this._onRender),t.selector.addEventListener("grid.selector.autofill",this._onAutofill),t.selector.addEventListener("grid.selector.move",this._onSelectorMove),t.addEventListener("dblclick",this._onDblClick),t.addEventListener("grid.edit",this._onEdit)}}class ik{get vScrolling(){return this._vScrolling}get hScrolling(){return this._hScrolling}get model(){return this.grid.model}get selection(){return this.grid.selection}get table(){return this.grid.table}constructor(t){this.grid=t,this.requireVerticalUpdate=!0,this.requireHorizontalUpdate=!1,this.resizing=!1,this._vScrolling=!0,this._hScrolling=!0,this.debounceRenderCells=q(this.renderCells,50,{isImmediate:!1,maxWait:100}),this.debounceCalculateViewport=q(this.calculateViewport,200)}isLastRowInViewport(){const t=this.grid.table.viewport.rows,e=this.model.visibleRows;return t[t.length-1]==e[e.length-1]}renderCells(t){t=t||{vertical:this.requireVerticalUpdate,horizontal:this.requireHorizontalUpdate},this.grid.comment.deatach(),this.grid.table.renderCells(t),this.requireHorizontalUpdate=!1,this.requireVerticalUpdate=!1,this.debounceCalculateViewport(),this.grid.objects.updatePostions()}renderAll(t=!1){this.grid.group?this.grid.group.grids.forEach((e=>e.rendering.render(t))):this.render(t)}async render(t=!1){this.grid.table&&this.model&&(this.grid.table.clearHeaderCache(),this.grid.table.clearBodyCache(),this.grid.table.isConnected&&(t&&(this.grid.table.requestUpdate(),await this.grid.table.updateComplete),this.grid.table.renderCells({horizontal:!0,vertical:!0}),this.calculateViewport()))}updateRange(t,e=!1){for(const i of this.model.getRangeIterator(t))this.updateCells([i],e)}updateCell(t,e=!1){this.updateCells([t],e)}updateSpilledCells(t){let e;t.prevSpillRange&&(e=new Set,this.model.getRangeIterator(t.prevSpillRange).forEach((t=>e.add(t)))),t.spillRange&&(e=e||new Set,this.model.getRangeIterator(t.spillRange).forEach((t=>e.add(t)))),e?.size>0&&this.updateCells(e)}updateCells(t,e=!1){if(e)for(const e of t)e.invalidateStyle(),e.invalidateValue(),this.model.calculations.clearDependecies(e).evaluate(e),this.updateSpilledCells(e);const i=this.grid.table;for(const e of t)i.renderBodyCell(e);e&&(this.model.calculations.invalidateDependants(t).forEach(((t,e)=>{t?this.grid.group.getGrid(t)?.table.renderBodyCell(e):i.renderBodyCell(e),this.updateSpilledCells(e)})),this.grid.dispatchGridEvent("calculate",{cells:Array.from(t)}))}updateHeaders(){this.model.indexVisibleColumns(),this.table.clearHeaderCache(),this.table.createHeaderRows(),this.table.renderHeader()}calculateViewport(t=!1){this.grid.logger.info("calculate viwport"),this.updateCells(this.model.calculateViewport(),t)}updateSliders(){const t=this.table.viewportSize;this.grid.vSlider.maxValue=this.model.visibleRows.length,this.grid.vSlider.pageSize=t.h/this.model.options.rowHeight,this.grid.vSlider.value=this.table.rowOffset,this.grid.hSlider.maxValue=this.model.visibleColumns.length,this.grid.hSlider.pageSize=t.w/this.model.options.columnWidth,this.grid.hSlider.value=this.table.colOffset}isVerticalScrollingEnabled(){return!1!==this.grid.options.scrolling.verticalOverscroll||this.table.viewport.rows.length<this.model.visibleRows.length}isHorizontalScrollingEnabled(){return!1!==this.grid.options.scrolling.horizontalOverscroll||this.table.viewport.columns.length<this.model.visibleColumns.length}updateSliderVisibility(){this._vScrolling=this.isVerticalScrollingEnabled(),this._vScrolling?(this.grid.vSlider.show(),xt(this.grid.vSlider)):(this.grid.vSlider.hide(),kt(this.grid.vSlider)),this._hScrolling=this.isHorizontalScrollingEnabled(),this._hScrolling?(this.grid.hSlider.show(),xt(this.grid.hSlider)):(this.grid.hSlider.hide(),kt(this.grid.hSlider))}hideSliders(){this.grid.vSlider.hide(),this.grid.hSlider.hide()}scrollVerticalByPixels(t){if(!this.vScrolling)return;let e,i=this.table.rowOffset,o=0,r=0;if(t>0){for(;o<t&&i+r<this.model.visibleRows.length;)o+=this.model.visibleRows[i+r++].height+2;i+=r}else if(t<0){for(t=Math.abs(t);o<t&&i+r>=0;)e=this.model.visibleRows[Math.min(this.model.visibleRows.length-1,i+r--)],o+=(e?e.height:0)+2;i+=r}i>=this.model.visibleRows.length&&(i=this.model.visibleRows.length-1),this.requireVerticalUpdate=!0,this.table.rowOffset=Math.max(0,i),this.debounceRenderCells(),this.updateSliders()}scrollHorizontalByPixels(t){if(!this.hScrolling)return;let e=this.table.colOffset,i=0,o=0;if(t>0){for(;i<t&&e+o<this.model.visibleColumns.length;)i+=this.model.visibleColumns[e+o++].width+2;e+=o}else if(t<0){for(t=Math.abs(t);i<t&&e+o>=0;)i+=this.model.visibleColumns[Math.min(this.model.visibleColumns.length-1,e+o--)].width+2;e+=o}e>=this.model.visibleColumns.length&&(e=this.model.visibleColumns.length-1),this.requireHorizontalUpdate=!0,this.table.colOffset=Math.max(0,e),this.debounceRenderCells(),this.updateSliders()}updateCellSelectionRange(){const t=this.table;for(const e of this.model.getRangeIterator(this.selection.range,!1))t.renderBodyCell(e)}getAdapterRequestFilters(){return{offset:0,filter:this.model?.filter?Array.from(this.model.filter.settings.values()):null,order:this.model?.sorting?.settings}}async toggleRow(t,e=!0){const i=this.model.rows[t];if(i.isLoaded||i.isPartialyLoaded)i.toggleCollapse(!1,this.model.options.unhideRowAfterExpand),this.table.renderCells({vertical:!0});else if(this.grid.adapter){const e=this.table.getRowByModelIndex(t);e&&e.expander&&(e.expander.state="waiting"),i.collapsed=!1;const o=Object.assign(this.getAdapterRequestFilters(),{parent:{r:i.index,props:i.properties}}),[r]=await Promise.all([this.grid.adapter.getRows(o)]);this.model.insertRowData(i,0,r),o.rows=r;const[s]=await Promise.all([this.grid.adapter.getCells(o)]);s?.map((t=>this.model.getCellByCoords(t.r,t.c)?.update(t))),this.table.requestUpdate()}this.updateSliders(),e&&this.grid.dispatchEvent(new Xx("row.toggle",{grid:this.grid,row:i}))}toggleColumn(t,e=!0){const i=this.model.columns[t];i.toggleCollapse(!1,this.model.options.unhideColumnAfterExpand),this.table.renderCells({horizontal:!0}),this.updateSliders(),e&&this.grid.dispatchEvent(new Xx("column.toggle",{grid:this.grid,column:i}))}setRowExpandLevel(t){this.model.setRowExpandLevel(t),this.table.rowOffset=0,this.table.renderCells({vertical:!0}),this.updateSliders(),this.grid.dispatchEvent(new Xx("row.toggle",{grid:this.grid}))}setColumnExpandLevel(t){this.model.setColumnExpandLevel(t),this.table.colOffset=0,this.table.renderCells({horizontal:!0}),this.updateSliders(),this.grid.dispatchEvent(new Xx("column.toggle",{grid:this.grid}))}async exportHTML(){const t=yt("div");kt(t),document.body.appendChild(t);const e=yt("og-table");e.grid=this.grid,e.model=this.model,e.renderAll=!0,t.appendChild(e),await e.updateComplete;const i=this.model.options?.print?.rowBreaks,o=e.table,r=i&&i.length>0;if(r){const t=o.querySelector("colgroup"),r=[...o.tBodies[0].rows],s=this.model.options?.print?.rowTitles?Ev.fromA1(this.model.options?.print?.rowTitles):null,n=s?Array.from({length:s.r2-s.r1+1},((t,i)=>r[e.rowMap.get(s.r1+i)])):[];for(let o=0;o<i.length;o++){const s=yt("table");s.appendChild(t.cloneNode(!0));const a=yt("tbody");s.appendChild(a);const l=e.rowMap.get(i[o]),c=o<i.length-1?e.rowMap.get(i[o+1]):this.model.visibleRows.length-1;n.forEach((t=>a.appendChild(t.cloneNode(!0))));for(let t=l;t<=c;t++)a.appendChild(r[t]);e.shadowRoot.appendChild(s)}t.cloneNode(!0)}const s=`\n\t\t\t<style>\n\t\t\t\thtml {\n\t\t\t\t\t${Ua(Ja().themes.get("og-light")).cssText}\n\t\t\t\t}\n\t\t\t\t${r?"table {break-after: page}":""}\n\t\t\t\t${qx.styles.map((t=>t.cssText)).join("\n")}\n\t\t\t</style>\n\n\t\t`,n=s+e.shadowRoot.innerHTML.replace(/<!---->/g,"");return t.remove(),n}stopAutoscroll(){this.autoscrollTimer&&window.clearInterval(this.autoscrollTimer)}startAutoscroll(){this.stopAutoscroll(),this.autoscrollTimer=window.setInterval((()=>{if(0==this.autoscrollValue)return this.stopAutoscroll();const t=Math.pow(this.autoscrollValue,av.AUTOSCROLL_RATIO);switch(this.autoscrollDirection){case"down":this.scrollVerticalByPixels(t);break;case"up":this.scrollVerticalByPixels(-t);break;case"left":this.scrollHorizontalByPixels(-t);break;case"right":this.scrollHorizontalByPixels(t)}}),av.AUTOSCROLL_INTERVAL)}autoscroll(t){const{x:e,y:i}=t,o=this.table.clientWidth/this.table.zoom-this.table.totalHeaderWidth,r=this.table.clientHeight/this.table.zoom-this.table.totalHeaderHeight;let s,n=0;e<av.AUTOSCROLL_TRESHOLD&&e<i&&e<r-i?(s="left",n=av.AUTOSCROLL_TRESHOLD-e):o-e<av.AUTOSCROLL_TRESHOLD&&o-e<i&&o-e<r-i?(s="right",n=av.AUTOSCROLL_TRESHOLD-o+e):i<av.AUTOSCROLL_TRESHOLD?(s="up",n=av.AUTOSCROLL_TRESHOLD-i):r-i<av.AUTOSCROLL_TRESHOLD&&(s="down",n=av.AUTOSCROLL_TRESHOLD-r+i),this.autoscrollDirection=s,this.autoscrollValue=n,this.stopAutoscroll(),n>0&&this.startAutoscroll()}async load(t){t=t||this.getAdapterRequestFilters();const e=t.parent?.r??null,i=null!=e?this.model.rows[e]:this.model.rowRoot,[o]=await Promise.all([this.grid.adapter.getRows(t)]);o.length>0&&null===e&&this.model.insertRowData(i,t.offset,o);const[r]=await Promise.all([this.grid.adapter.getCells(t)]);r?.map((t=>this.model.getCellByCoords(t.r,t.c)?.update(t))),this.table.requestUpdate(),o.length>=this.model.options.pageSize?i.count=1/0:i.count=i.children.length,this.grid.logger.info(`loaded ${o.length} rows`),this.grid.loading=!1,this.grid.dispatchEvent(new Xx("afterLoad",{grid:this.grid}))}async loadNextPage(t=null,e=!1){if(this.grid.loading)return;const i=null!=t?this.model.rows[t]:this.model.rowRoot;if(!e&&i.isLoaded)return;this.grid.dispatchEvent(new Xx("beforeLoad",{grid:this.grid})),this.grid.loading=!0;const o=this.model.rows.length;this.grid.logger.info(`loading rows offset = ${o}`),await this.load(Object.assign(this.getAdapterRequestFilters(),{offset:o,parent:{r:t,props:null}}))}get totalSize(){return{width:this.table.totalHeaderWidth+this.model.visibleColumns.reduce(((t,e)=>t+e.width),0),height:this.table.thead.offsetHeight+this.model.visibleRows.reduce(((t,e)=>t+e.height),0)}}autofitColumn(t,e=!1,i=!0){const o="number"==typeof t?this.model.columns[t]:t,r=this.autofitDiv??(this.autofitDiv=yt("div"));r.style.position="absolute",r.style.zIndex="100000",Ht(r,{l:-1e3,t:-1e3}),this.grid.shadowRoot.appendChild(r);let s=0;for(const t of this.model.getRangeIterator(Ev.fromA1(o.address),!!e)){const e=IC(t).call(this.table,r,t)||r;e.style.width="auto",s=Math.max(s,e.offsetWidth)}if(o.header){for(const t of o.header)t&&(t.html?r.innerHTML=t.label??"":r.innerText=t.label??"",s=Math.max(s,r.offsetWidth));r.innerHTML=""}o.width=s+22,i&&this.table.renderCells({horizontal:!0})}autofitColumns(t=!1){this.model.columns.forEach((e=>this.autofitColumn(e,t,!1))),this.table.renderCells({horizontal:!0})}autofitRow(t,e=!1,i=!0){const o="number"==typeof t?this.model.rows[t]:t,r=this.autofitDiv??(this.autofitDiv=yt("div"));r.style.position="absolute",r.style.zIndex="100000",Ht(r,{l:-1e3,t:-1e3}),this.grid.shadowRoot.appendChild(r);let s=0;for(const t of this.model.getRangeIterator(Ev.fromA1(o.address),!!e)){const e=IC(t).call(this.table,r,t)||r;e.style.height="auto",s=Math.max(s,e.offsetHeight)}o.height=s+8,i&&this.table.renderCells({vertical:!0})}autofitRows(t=!1){this.model.rows.forEach((e=>this.autofitRow(e,t,!1))),this.table.renderCells({vertical:!0})}scrollTo(t,e=0){let i;i=Q(t)?Ev.fromA1(t):new Ev(e,t),this.table.rowOffset=i.r1,this.table.colOffset=i.c1,this.requireVerticalUpdate=!0,this.requireHorizontalUpdate=!0,this.debounceRenderCells(),this.updateSliders()}}class ok{get model(){return this.grid.model}get selection(){return this.grid.editing.isFormulaMode?this.formulaSelection:this.grid.selection}get selector(){return this.grid.editing.isFormulaMode?this.grid.formulaSelector:this.grid.selector}get formulaSelection(){return this._formulaSelection}get events(){return this.grid.events}get table(){return this.grid.table}get isSelecting(){return this.isCellSelecting||this.columnSelecting||this.rowSelecting}get isCellSelecting(){return this.selector.isSelecting}get isAutofilling(){return this.selector.isAutofilling}get isMoving(){return this.selector.isMoving}get isSelectorOperationActive(){return this.selector.isSelectorOperationActive}get isFormulaSelectorOperationActive(){if(!this.grid.editing.isFormulaMode)return!1;for(const t of this.formulaSelectors.values())if(t.isSelectorOperationActive)return!0;return!1}get activeCell(){const{c:t,r:e}=this.selection.activeCellCoords;return this.model.rows[e]?.cell(t)}constructor(t){this.grid=t,this.columnSelecting=!1,this.rowSelecting=!1,this._formulaSelection=new $x(0,0,0,0),this.formulaSelectors=new Map,this.debounceMoveSelector=q(((t,e)=>this.moveSelector(t,e)),10)}moveToSelection(){const t=new Ev(this.selection.range.c1,this.selection.range.r1);this.table.viewportRange.contains(t)}select(t,e=!1){this.selection.setRange(t),this.updateSelector(),e&&this.grid.dispatchEvent(new Xx("select",{grid:this.grid}))}canExtend(){const{enabled:t,multiSelect:e}=this.model.options.selecting;return t&&e&&this.selector?.isVisible}startCellSelecting(t,e=!1){this.grid.style.cursor="cell",e&&this.canExtend()?(this.columnSelecting=!1,this.rowSelecting=!1,this.selection.range.c2=t.c1,this.selection.range.r2=t.r1,this.startSelectingRange=t.clone(),this.selector.startSelecting(this.selection.range.clone()),this.grid.editing.isFormulaMode?this.updateFormulaSelector():this.updateSelector(),this.grid.dispatchEvent(new Xx("select",{grid:this.grid}))):(this.startSelectingRange=t.clone(),this.select(t,!0),this.selector.startSelecting(t))}startColumnSelecting(t,e=!1){if(e&&this.canExtend()&&!this.selection.range.isRow)this.columnSelecting=!0,this.rowSelecting=!1,this.selection.range.r1=0,this.selection.range.r2=1/0,this.selection.range.c2=t,this.startSelectingRange=new Ev(t,null,t,null),this.updateSelector(),this.grid.dispatchEvent(new Xx("select",{grid:this.grid}));else{this.columnSelecting=!0;const e=new Ev(t,null,t,null);this.startSelectingRange=e.clone(),this.select(e,!0)}}startRowSelecting(t,e=!1){if(e&&this.canExtend()&&!this.selection.range.isColumn)this.rowSelecting=!0,this.columnSelecting=!1,this.selection.range.c1=0,this.selection.range.c2=1/0,this.selection.range.r2=t,this.startSelectingRange=new Ev(null,t,null,t),this.updateSelector(),this.grid.dispatchEvent(new Xx("select",{grid:this.grid}));else{this.rowSelecting=!0;const e=new Ev(null,t,null,t);this.startSelectingRange=e.clone(),this.select(e,!0)}}updateSelecting(t,e){const i=this.model.options.selecting.multiSelect;(this.isCellSelecting||this.rowSelecting)&&(i||(this.selection.range.r1=e),this.selection.range.r2=e),(this.isCellSelecting||this.columnSelecting)&&(i||(this.selection.range.c1=t),this.selection.range.c2=t),this.grid.editing.isFormulaMode?(this.updateFormulaSelector(),this.formulaSelectors.forEach((i=>i.updateMovingOperations(t,e)))):(this.updateSelector(),this.hideFormulaSelector(),this.selector.updateMovingOperations(t,e))}stopSelecting(){this.grid.rendering.stopAutoscroll(),this.isSelecting&&!this.selection.range.equals(this.startSelectingRange)&&this.grid.dispatchEvent(new Xx("select",{grid:this.grid})),this.columnSelecting=!1,this.rowSelecting=!1,this.startSelectingRange=null,this.selector.stopSelectorOperations()}highlightSelection(){const t=this.selection.range,[e,i]=[Math.min(t.c1,t.c2),Math.max(t.c1,t.c2)],[o,r]=[Math.min(t.r1,t.r2),Math.max(t.r1,t.r2)],s=i-e+1,n=r-o+1;this.table.highlightColHeaderCells(s<1/0?Array.from(new Array(s),((t,i)=>i+e)):[]),this.table.highlightRowHeaderCells(n<1/0?Array.from(new Array(n),((t,e)=>e+o)):[])}updateSelector(t=!0){this.model.options.selecting.enabled?(this.showSelector(t),this.highlightSelection()):this.hideSelector(),this.grid.editing.isFormulaMode||this.grid.editing.endEdit()}showSelector(t=!0){this.selector&&(this.selector.show(),this.selector.select(this.selection.range,t))}hideSelector(){this.selector.hide()}moveSelector(t,e){if(this.selection.move(t,e,this.model.columns.length,this.model.rows.length),0!=e&&!this.model.rows[this.selection.range.r1].visible){const t=e>0?this.model.rows[this.selection.range.r1].nextVisible:this.model.rows[this.selection.range.r1].prevVisible;t&&(this.selection.range.r1=t.index,this.selection.range.r2=t.index)}if(0!=t&&!this.model.columns[this.selection.range.c1].visible){const e=t>0?this.model.columns[this.selection.range.c1].nextVisible:this.model.columns[this.selection.range.c1].prevVisible;e&&(this.selection.range.c1=e.index,this.selection.range.c2=e.index)}this.selector.selection=this.selection.range,this.selector.updatePosition();const i={c:0,r:0};(e>0&&this.selector.offsetTop+this.selector.offsetHeight>this.grid.clientHeight||e<0&&this.selector.offsetTop<this.table.totalHeaderHeight-1||e>=this.table.viewport.rows.length)&&(i.r+=e),(t>0&&this.selector.offsetLeft+this.selector.offsetWidth>this.grid.clientWidth||t<0&&this.selector.offsetLeft<this.table.totalHeaderWidth-1)&&(i.c+=t),0==i.c&&0==i.r||(this.table.colOffset=Math.max(0,this.table.colOffset+i.c),this.table.rowOffset=Math.min(Math.max(0,this.table.rowOffset+i.r),this.model.visibleRows.length-1),this.table.renderCells({horizontal:0!=i.c,vertical:0!=i.r}),this.grid.rendering.updateSliders()),this.grid.editing.isFormulaMode||this.grid.editing.endEdit(),this.highlightSelection(),this.grid.dispatchEvent(new Xx("select",{grid:this.grid}))}shiftActiveCell(t,e=!1){this.selection.moveActiveCell(t,0),this.selector.updatePosition(),e&&this.grid.dispatchEvent(new Xx("select",{grid:this.grid}))}updateFormulaSelector(t=!0){this.grid.editing.isFormulaMode?this.showFormulaSelector(t):this.hideFormulaSelector()}showFormulaSelector(t=!0){this.grid.formulaSelector.show(),this.grid.formulaSelector?.select(this.formulaSelection.range,t)}hideFormulaSelector(){this.grid.formulaSelector.hide()}updateFormulaSelectors(){this.formulaSelectors.forEach((t=>t.updatePosition()))}highlightColorItem(t){const e=$x.fromRange(Ev.fromA1(t.address)),i=yt("og-selector");this.grid.shadowRoot.appendChild(i),i.addEventListener("grid.selector.move",(t=>this.select(t.selector.selection.clone()))),i.addEventListener("grid.selector.resize",(t=>this.select(t.selector.selection.clone()))),i.grid=this.grid,i.color=t.color,i.subselector=!1,i.movable=!0,i.resizable=!0,i.index=t.tokenIndex,this.formulaSelectors.set(t.tokenIndex,i),i.select(e.range.clone(),!1),i.show()}highlightFormula(t){this.removeFormulaHighlight(),this.formulaSelectors.clear();const e=new Set;t.colors.forEach((t=>{if(null==t.sheet||t.sheet==this.model.name)this.highlightColorItem(t);else if(this.grid.group){const i=this.grid.group.getGrid(t.sheet);if(!i)return;e.has(i)||(e.add(i),i.selecting.removeFormulaHighlight()),i.isConnected&&i.selecting.highlightColorItem(t)}}))}removeFormulaHighlight(){this.formulaSelectors?.forEach((t=>zt(t))),this.formulaSelectors.clear()}updateCopySelector(){this.grid.copySelector.isVisible&&this.grid.copySelector.updatePosition()}showCopySelector(){this.grid.copySelector.show(),this.grid.copySelector?.select(this.selection.range.clone(),!1)}hideCopySelector(){this.grid.copySelector.hide()}updateSelectors(){this.updateSelector(!1),this.updateCopySelector(),this.updateFormulaSelectors()}stopSelectOperations(){this.stopSelecting(),this.formulaSelectors.forEach((t=>t.stopSelectorOperations())),this.grid.style.removeProperty("cursor")}enter(){const t=this.grid.group;if(this.grid.editing.isFormulaMode&&t){const e=t.formulaModeGrid;e.editing.commitEdit(),t.activateGrid(e.model.name)}else this.debounceMoveSelector(0,1)}}class rk extends Event{}class sk extends En{get isOpen(){return this._open}get isValid(){return this._valid}validate(){return this._valid=!0,this.activeCell&&(this._valid=hw(this.activeCellModel,this.getValue())),this.classList.toggle("invalid",!this._valid),this._valid}constructor(){super(),this.cancel=!1,this._open=!1,this._valid=!0,this.init()}getDisplayValue(){return null}init(){this.addEventListener("keydown",(t=>{"Enter"==t.key?this.close():"Escape"==t.key?(this.cancel=!0,this.close()):t.stopPropagation()}))}connectedCallback(){super.connectedCallback(),this.performUpdate()}alignWithCell(){if(!this.activeCell)return;const t=Tt(this.activeCell,this.grid);Ht(this,{t:t.top*this.grid.zoom,l:t.left*this.grid.zoom}),Nt(this,{w:this.activeCell.offsetWidth,h:this.activeCell.offsetHeight})}open(t,e=null,i=!0){this._valid=!0,this.initialValue=e,this._open=!0,this.grid=t;const o=t.selecting.activeCell;return this.activeCellModel=o,this.activeCell=this.grid.table.getCellByModelIndex(o.c,o.r),this.grid.selector.hide(),xt(this),i&&this.alignWithCell(),this.activate(o),null!==e&&this.setValue(e),Jt(this,this.grid.zoom),this}commit(){this._open&&!this.cancel&&this.activeCellModel&&(this.grid.editing.updateCell(this.activeCellModel,{v:this.getValue(),dv:this.getDisplayValue()}),this.grid.rendering.updateCell(this.activeCellModel,!0)),this.cancel=!1}close(){this._open&&(this.deactivate(),kt(this),this.grid.table.renderBodyCell(this.activeCellModel),this.grid.selecting.showSelector(),this.grid.focus(),this._open=!1,this.grid.editing.endEdit()),this.cancel=!1}activate(t){this.activeCellModel=t,this.dispatchEvent(new rk("activate"))}deactivate(){this.dispatchEvent(new rk("deactivate"))}}sk.baseStyles=ks`
4397
4397
  * { box-sizing: border-box }
4398
4398
 
4399
4399
  :host {
@@ -9955,4 +9955,4 @@ milkdown-block-handle {
9955
9955
  `:null}
9956
9956
  </div>
9957
9957
  </og-panel>
9958
- `:null,this.addEventListener("mousedown",(t=>t.stopPropagation()))}getTypeIndex(t){const e=this.types.findIndex((e=>e.type==t.type&&e.grouping==(t.grouping||"standard")));return e>-1?e:null}updateModel(){if(this.editTitle=!1,!this.model)return;this.titleInput&&(this.model.title=this.titleInput.value);const t=this.types[this.typeList.value];this.model.type=t.type,this.model.grouping=t.grouping,this.model.categoriesRange=this.categoryRangeInput?.value?Ev.fromA1(this.categoryRangeInput.value):null,this.model.seriesRange=this.seriesRangeInput?.value?Ev.fromA1(this.seriesRangeInput.value):null,this.model.dataRange=Ev.fromA1(this.dataRangeInput.value),this.dispatchEvent(new Qr({value:this.model}))}async updated(){this.editTitle&&this.titleInput&&(await this.titleInput.updateComplete,this.titleInput.focus(),this.titleInput.selectAll())}};AL.styles=[TL],$L([$n({type:Object})],AL.prototype,"model",void 0),$L([An()],AL.prototype,"editTitle",void 0),$L([On("#title")],AL.prototype,"titleInput",void 0),$L([On("#type")],AL.prototype,"typeList",void 0),$L([On("#dataRange")],AL.prototype,"dataRangeInput",void 0),$L([On("#seriesRange")],AL.prototype,"seriesRangeInput",void 0),$L([On("#categoryRange")],AL.prototype,"categoryRangeInput",void 0),AL=$L([In("og-plugin-chart-form")],AL);const DL=Ja().themes.get("og-dark");Object.assign(DL.definition,{"highcharts-title-font-size":"16px","highcharts-subtitle-font-size":"14px","highcharts-color-0":"#2caffe","highcharts-color-1":"#544fc5","highcharts-color-2":"#00e272","highcharts-color-3":"#fe6a35","highcharts-color-4":"#6b8abc","highcharts-color-5":"#d568fb","highcharts-color-6":"#2ee0ca","highcharts-color-7":"#fa4b42","highcharts-color-8":"#feb56a","highcharts-color-9":"#91e8e1","highcharts-background-color":"rgb(48, 48, 48)","highcharts-neutral-color-100":"rgb(255, 255, 255)","highcharts-neutral-color-80":"rgb(214, 214, 214)","highcharts-neutral-color-60":"rgb(173, 173, 173)","highcharts-neutral-color-40":"rgb(133, 133, 133)","highcharts-neutral-color-20":"rgb(92, 92, 92)","highcharts-neutral-color-10":"rgb(71, 71, 71)","highcharts-neutral-color-5":"rgb(61, 61, 61)","highcharts-neutral-color-3":"rgb(57, 57, 57)","highcharts-highlight-color-100":"rgb(122, 167, 255)","highcharts-highlight-color-80":"rgb(108, 144, 214)","highcharts-highlight-color-60":"rgb(94, 121, 173)","highcharts-highlight-color-20":"rgb(65, 74, 92)","highcharts-highlight-color-10":"rgb(58, 63, 71)"});const OL=Ja().themes.get("og-light");Object.assign(OL.definition,{"highcharts-title-font-size":"16px","chart-background-color":"#2a2a2b","highcharts-color-0":"#2caffe","highcharts-color-1":"#544fc5","highcharts-color-2":"#00e272","highcharts-color-3":"#fe6a35","highcharts-color-4":"#6b8abc","highcharts-color-5":"#d568fb","highcharts-color-6":"#2ee0ca","highcharts-color-7":"#fa4b42","highcharts-color-8":"#feb56a","highcharts-color-9":"#91e8e1","highcharts-background-color":"#ffffff","highcharts-neutral-color-100":"#000000","highcharts-neutral-color-80":"#333333","highcharts-neutral-color-60":"#666666","highcharts-neutral-color-40":"#999999","highcharts-neutral-color-20":"#cccccc","highcharts-neutral-color-10":"#e6e6e6","highcharts-neutral-color-5":"#f2f2f2","highcharts-neutral-color-3":"#f7f7f7","highcharts-highlight-color-100":"#0022ff","highcharts-highlight-color-80":"#334eff","highcharts-highlight-color-60":"#667aff","highcharts-highlight-color-20":"#ccd3ff","highcharts-highlight-color-10":"#e6e9ff","highcharts-positive-color":"#06b535","highcharts-negative-color":"#f21313","highcharts-annotation-color-0":"rgba(130, 170, 255, 0.4)","highcharts-annotation-color-1":"rgba(139, 191, 216, 0.4)","highcharts-annotation-color-2":"rgba(150, 216, 192, 0.4)","highcharts-annotation-color-3":"rgba(156, 229, 161, 0.4)","highcharts-annotation-color-4":"rgba(162, 241, 130, 0.4)","highcharts-annotation-color-5":"rgba(169, 255, 101, 0.4)"});var NL=i(6946),PL=i(6471),jL=i(4969),HL=i(9502),FL=i(7706),BL=i(1480),WL=i(2006),VL=i(7503),UL=i(7873),GL=i(8746),qL=i(2570),YL=i(8815),ZL=i(6390),XL=i(6593),QL=i(895),KL=i(9083),JL=i(6093),tI=i(9685),eI=i(9849),iI=i(8268),oI=i(4693),rI=i(3599),sI=i(782),nI=i(754),aI=i(5700),lI=i(4731),cI=i(7291),hI=i(597),dI=i(1474),uI=i(6224),pI=i(6239),gI=i(6828),mI=i(2212),fI=i(863),vI=i(3602),bI=i(1985),yI=i(886),wI=i(7201),xI=i(9937),kI=i(8450),CI=i(9630),MI=i(9766),_I=i(388),SI=i(1903),zI=i(398),EI=i(6105),LI=i(6147),II=i(5722),RI=i(5576),TI=i(3131),$I=i(6308),AI=i(9645),DI=i(3199),OI=i(871),NI=i(5251),PI=i(6426),jI=i(2643),HI=i(8522),FI=i(6398),BI=i(2525),WI=i(8434),VI=i(6138),UI=i(5835),GI=i(5654),qI=i(6659),YI=i(2977),ZI=i(4480),XI=i(9886),QI=i(6815),KI=i(1582),JI=i(2968),tR=i(394),eR=i(7024),iR=i(7853),oR=i(8249),rR=i(2869),sR=i(486),nR=i(5735),aR=i(470),lR=i(4612),cR=i(4018),hR=i(1476),dR=i(3194),uR=i(3525),pR=i(7541),gR=i(4104),mR=i(6686),fR=i(7719),vR=i(3898),bR=i(8153),yR=i(3690),wR=i(1776),xR=i(4980),kR=i(5578),CR=i(9613),MR=i(1119),_R=i(8444),SR=i(2978),zR=i(9130),ER=i(2127),LR=i(2732),IR=i(4287),RR=i(4045),TR=i(7642),$R=i(1367),AR=i(320),DR=i(821),OR=i(102),NR=i(7683),PR=i(3980),jR=i(576),HR=i(654),FR=i(73),BR=i(140),WR=i(8129),VR=i(5087),UR=i(6992),GR=i(8247),qR=i(8038),YR=i(5286),ZR=i(9179),XR=i(1808),QR=i(9459),KR=i(2883),JR=i(9124),tT=i(7067),eT=i(1054),iT=i(7325),oT=i(1272),rT=i(3359),sT=i(6562),nT=i(4193),aT=i(6348),lT=i(2435),cT=i(7544),hT=i(4470),dT=i(9111),uT=i(9318),pT=i(7294),gT=i(4479),mT=i(2409),fT=i(3091),vT=i(5789),bT=i(5890),yT=i(3874),wT=i(2907),xT=i(1175),kT=i(1686),CT=i(703),MT=i(6606),_T=i(4194),ST=i(6228),zT=i(62),ET=i(2072),LT=i(9744),IT=i(25),RT=i(2618),TT=i(1988),$T=i(8013),AT=i(1133),DT=i(362),OT=i(6845),NT=i(6800),PT=i(1103),jT=i(4933),HT=i(7284),FT=i(2620),BT=i(2366),WT=i(7457),VT=i(2449),UT=i(2),GT=i(5697),qT=i(7069),YT=i(4716),ZT=i(4740),XT=i(4557),QT=i(1868),KT=i(8647),JT=i(5127),t$=i(4816),e$=i(4009),i$=i(5104),o$=i(2830),r$=i(3093),s$=i(5029),n$=i(3514),a$=i(2142),l$=i(4999),c$=i(7523),h$=i(346),d$=i(7917),u$=i(3976),p$=i(9801),g$=i(2464),m$=i(5511),f$=i(5210),v$=i(5815),b$=i(3339),y$=i(7472),w$=i(8811),x$=i(8548),k$=i(6880),C$=i(1840),M$=i(5547),_$=i(4788),S$=i(9467),z$=i(9187),E$=i(9217),L$=i(7897),I$=i(2644),R$=i(6204),T$=i(1472),$$=i(1247),A$=i(7406),D$=i(925),O$=i(7455),N$=i(3771),P$=i(1549),j$=i(3541),H$=i(3140),F$=i(9800),B$=i(229),W$=i(2677),V$=i(1844),U$=i(3245),G$=i(9056),q$=i(7535),Y$=i(2359),Z$=i(15),X$=i(5569),Q$=i(2014),K$=i(1599),J$=i(6521),tA=i(232),eA=i(9745),iA=i(9594),oA=i(6979),rA=i(4494),sA=i(312),nA=i(4983),aA=i(1258),lA=i(6313),cA=i(12),hA=i(8003),dA=i(7830),uA=i(8875),pA=i(3911),gA=i(1817),mA=i(478),fA=i(2585),vA=i(6564),bA=i(2884),yA=i(3825),wA=i(7348),xA=i(9277),kA=i(4118),CA=i(9200),MA=i(51),_A=i(2872),SA=i(4702),zA=i(9281),EA=i(1394),LA=i(7295),IA=i(2936),RA=i(3789),TA=i(3614),$A=i(4827),AA=i(9204),DA=i(9113),OA=i(4058),NA=i(9939),PA=i(1139);const jA=[NL.mw,PL.mw,jL.mw,HL.mw,FL.mw,BL.mw,WL.mw,VL.mw,GL.mw,YL.mw,qL.mw,ZL.mw,XL.mw,QL.mw,KL.mw,JL.mw,tI.mw,eI.mw,iI.mw,oI.mw,rI.mw,sI.mw,nI.mw,aI.mw,lI.mw,cI.mw,hI.mw,dI.mw,uI.mw,gI.mw,mI.mw,fI.mw,vI.mw,bI.mw,yI.mw,wI.mw,xI.mw,kI.mw,CI.mw,MI.mw,_I.mw,SI.mw,EI.mw,zI.mw,LI.mw,II.mw,RI.mw,TI.mw,$I.mw,AI.mw,DI.mw,OI.mw,NI.mw,PI.mw,jI.mw,HI.mw,BI.mw,WI.mw,VI.mw,UI.mw,GI.mw,qI.mw,YI.mw,ZI.mw,XI.mw,QI.mw,KI.mw,JI.mw,tR.mw,eR.mw,iR.mw,oR.mw,rR.mw,sR.mw,nR.mw,FI.mw,aR.mw,lR.mw,cR.mw,hR.mw,dR.mw,uR.mw,pR.mw,gR.mw,mR.mw,fR.mw,vR.mw,bR.mw,yR.mw,wR.mw,xR.mw,kR.mw,CR.mw,MR.mw,_R.mw,SR.mw,zR.mw,ER.mw,LR.mw,IR.mw,RR.mw,TR.mw,$R.mw,AR.mw,DR.mw,OR.mw,NR.mw,PR.mw,jR.mw,HR.mw,FR.mw,BR.mw,WR.mw,VR.mw,UR.mw,GR.mw,qR.mw,pI.mw,YR.mw,ZR.mw,XR.mw,QR.mw,KR.mw,JR.mw,tT.mw,eT.mw,iT.mw,oT.mw,rT.mw,sT.mw,nT.mw,aT.mw,lT.mw,UL.mw,cT.mw,hT.mw],HA=[dT.mw,uT.mw,pT.mw,gT.mw,mT.mw,fT.mw,vT.mw,bT.mw,wT.mw,kT.mw,xT.mw,MT.mw,CT.mw,_T.mw,ST.mw,zT.mw,ET.mw,LT.mw,IT.mw,RT.mw,TT.mw,$T.mw,PT.mw,jT.mw,HT.mw,FT.mw,BT.mw,WT.mw,VT.mw,GT.mw,qT.mw,YT.mw,JT.mw,t$.mw,e$.mw,i$.mw,o$.mw,r$.mw,s$.mw,n$.mw,AT.mw,DT.mw,NT.mw,OT.mw,a$.mw,l$.mw,c$.mw,h$.mw,d$.mw,u$.mw,p$.mw,g$.mw,ZT.mw,XT.mw,QT.mw,KT.mw,f$.mw,v$.mw,b$.mw,y$.mw,w$.mw,x$.mw,k$.mw,C$.mw,M$.mw,_$.mw,S$.mw,z$.mw,E$.mw,L$.mw,I$.mw,R$.mw,T$.mw,$$.mw,A$.mw,m$.mw,D$.mw,O$.mw,N$.mw,P$.mw,j$.mw,H$.mw,F$.mw,B$.mw,W$.mw,V$.mw,U$.mw,G$.mw,q$.mw,Y$.mw,Z$.mw,X$.mw,Q$.mw,K$.mw,J$.mw,tA.mw,eA.mw,iA.mw,oA.mw,rA.mw,sA.mw,nA.mw,aA.mw,lA.mw,cA.mw,hA.mw,dA.mw,uA.mw,pA.mw,gA.mw,mA.mw,fA.mw,vA.mw,bA.mw,yA.mw,wA.mw,xA.mw,UT.mw,kA.mw,CA.mw,MA.mw,_A.mw,SA.mw,zA.mw,EA.mw,LA.mw,IA.mw,RA.mw,TA.mw,$A.mw,AA.mw,DA.mw,OA.mw,yT.mw,NA.mw,PA.mw],FA={xlsx:F,charts:B},BA={name:"@omegagrid/bundle",version:"0.10.49"};Ja().activate("light"),Wd.styleDefault="fal",Vd.add(jA),Vd.add(HA)})(),window.Omegagrid=o})();
9958
+ `:null,this.addEventListener("mousedown",(t=>t.stopPropagation()))}getTypeIndex(t){const e=this.types.findIndex((e=>e.type==t.type&&e.grouping==(t.grouping||"standard")));return e>-1?e:null}updateModel(){if(this.editTitle=!1,!this.model)return;this.titleInput&&(this.model.title=this.titleInput.value);const t=this.types[this.typeList.value];this.model.type=t.type,this.model.grouping=t.grouping,this.model.categoriesRange=this.categoryRangeInput?.value?Ev.fromA1(this.categoryRangeInput.value):null,this.model.seriesRange=this.seriesRangeInput?.value?Ev.fromA1(this.seriesRangeInput.value):null,this.model.dataRange=Ev.fromA1(this.dataRangeInput.value),this.dispatchEvent(new Qr({value:this.model}))}async updated(){this.editTitle&&this.titleInput&&(await this.titleInput.updateComplete,this.titleInput.focus(),this.titleInput.selectAll())}};AL.styles=[TL],$L([$n({type:Object})],AL.prototype,"model",void 0),$L([An()],AL.prototype,"editTitle",void 0),$L([On("#title")],AL.prototype,"titleInput",void 0),$L([On("#type")],AL.prototype,"typeList",void 0),$L([On("#dataRange")],AL.prototype,"dataRangeInput",void 0),$L([On("#seriesRange")],AL.prototype,"seriesRangeInput",void 0),$L([On("#categoryRange")],AL.prototype,"categoryRangeInput",void 0),AL=$L([In("og-plugin-chart-form")],AL);const DL=Ja().themes.get("og-dark");Object.assign(DL.definition,{"highcharts-title-font-size":"16px","highcharts-subtitle-font-size":"14px","highcharts-color-0":"#2caffe","highcharts-color-1":"#544fc5","highcharts-color-2":"#00e272","highcharts-color-3":"#fe6a35","highcharts-color-4":"#6b8abc","highcharts-color-5":"#d568fb","highcharts-color-6":"#2ee0ca","highcharts-color-7":"#fa4b42","highcharts-color-8":"#feb56a","highcharts-color-9":"#91e8e1","highcharts-background-color":"rgb(48, 48, 48)","highcharts-neutral-color-100":"rgb(255, 255, 255)","highcharts-neutral-color-80":"rgb(214, 214, 214)","highcharts-neutral-color-60":"rgb(173, 173, 173)","highcharts-neutral-color-40":"rgb(133, 133, 133)","highcharts-neutral-color-20":"rgb(92, 92, 92)","highcharts-neutral-color-10":"rgb(71, 71, 71)","highcharts-neutral-color-5":"rgb(61, 61, 61)","highcharts-neutral-color-3":"rgb(57, 57, 57)","highcharts-highlight-color-100":"rgb(122, 167, 255)","highcharts-highlight-color-80":"rgb(108, 144, 214)","highcharts-highlight-color-60":"rgb(94, 121, 173)","highcharts-highlight-color-20":"rgb(65, 74, 92)","highcharts-highlight-color-10":"rgb(58, 63, 71)"});const OL=Ja().themes.get("og-light");Object.assign(OL.definition,{"highcharts-title-font-size":"16px","chart-background-color":"#2a2a2b","highcharts-color-0":"#2caffe","highcharts-color-1":"#544fc5","highcharts-color-2":"#00e272","highcharts-color-3":"#fe6a35","highcharts-color-4":"#6b8abc","highcharts-color-5":"#d568fb","highcharts-color-6":"#2ee0ca","highcharts-color-7":"#fa4b42","highcharts-color-8":"#feb56a","highcharts-color-9":"#91e8e1","highcharts-background-color":"#ffffff","highcharts-neutral-color-100":"#000000","highcharts-neutral-color-80":"#333333","highcharts-neutral-color-60":"#666666","highcharts-neutral-color-40":"#999999","highcharts-neutral-color-20":"#cccccc","highcharts-neutral-color-10":"#e6e6e6","highcharts-neutral-color-5":"#f2f2f2","highcharts-neutral-color-3":"#f7f7f7","highcharts-highlight-color-100":"#0022ff","highcharts-highlight-color-80":"#334eff","highcharts-highlight-color-60":"#667aff","highcharts-highlight-color-20":"#ccd3ff","highcharts-highlight-color-10":"#e6e9ff","highcharts-positive-color":"#06b535","highcharts-negative-color":"#f21313","highcharts-annotation-color-0":"rgba(130, 170, 255, 0.4)","highcharts-annotation-color-1":"rgba(139, 191, 216, 0.4)","highcharts-annotation-color-2":"rgba(150, 216, 192, 0.4)","highcharts-annotation-color-3":"rgba(156, 229, 161, 0.4)","highcharts-annotation-color-4":"rgba(162, 241, 130, 0.4)","highcharts-annotation-color-5":"rgba(169, 255, 101, 0.4)"});var NL=i(6946),PL=i(6471),jL=i(4969),HL=i(9502),FL=i(7706),BL=i(1480),WL=i(2006),VL=i(7503),UL=i(7873),GL=i(8746),qL=i(2570),YL=i(8815),ZL=i(6390),XL=i(6593),QL=i(895),KL=i(9083),JL=i(6093),tI=i(9685),eI=i(9849),iI=i(8268),oI=i(4693),rI=i(3599),sI=i(782),nI=i(754),aI=i(5700),lI=i(4731),cI=i(7291),hI=i(597),dI=i(1474),uI=i(6224),pI=i(6239),gI=i(6828),mI=i(2212),fI=i(863),vI=i(3602),bI=i(1985),yI=i(886),wI=i(7201),xI=i(9937),kI=i(8450),CI=i(9630),MI=i(9766),_I=i(388),SI=i(1903),zI=i(398),EI=i(6105),LI=i(6147),II=i(5722),RI=i(5576),TI=i(3131),$I=i(6308),AI=i(9645),DI=i(3199),OI=i(871),NI=i(5251),PI=i(6426),jI=i(2643),HI=i(8522),FI=i(6398),BI=i(2525),WI=i(8434),VI=i(6138),UI=i(5835),GI=i(5654),qI=i(6659),YI=i(2977),ZI=i(4480),XI=i(9886),QI=i(6815),KI=i(1582),JI=i(2968),tR=i(394),eR=i(7024),iR=i(7853),oR=i(8249),rR=i(2869),sR=i(486),nR=i(5735),aR=i(470),lR=i(4612),cR=i(4018),hR=i(1476),dR=i(3194),uR=i(3525),pR=i(7541),gR=i(4104),mR=i(6686),fR=i(7719),vR=i(3898),bR=i(8153),yR=i(3690),wR=i(1776),xR=i(4980),kR=i(5578),CR=i(9613),MR=i(1119),_R=i(8444),SR=i(2978),zR=i(9130),ER=i(2127),LR=i(2732),IR=i(4287),RR=i(4045),TR=i(7642),$R=i(1367),AR=i(320),DR=i(821),OR=i(102),NR=i(7683),PR=i(3980),jR=i(576),HR=i(654),FR=i(73),BR=i(140),WR=i(8129),VR=i(5087),UR=i(6992),GR=i(8247),qR=i(8038),YR=i(5286),ZR=i(9179),XR=i(1808),QR=i(9459),KR=i(2883),JR=i(9124),tT=i(7067),eT=i(1054),iT=i(7325),oT=i(1272),rT=i(3359),sT=i(6562),nT=i(4193),aT=i(6348),lT=i(2435),cT=i(7544),hT=i(4470),dT=i(9111),uT=i(9318),pT=i(7294),gT=i(4479),mT=i(2409),fT=i(3091),vT=i(5789),bT=i(5890),yT=i(3874),wT=i(2907),xT=i(1175),kT=i(1686),CT=i(703),MT=i(6606),_T=i(4194),ST=i(6228),zT=i(62),ET=i(2072),LT=i(9744),IT=i(25),RT=i(2618),TT=i(1988),$T=i(8013),AT=i(1133),DT=i(362),OT=i(6845),NT=i(6800),PT=i(1103),jT=i(4933),HT=i(7284),FT=i(2620),BT=i(2366),WT=i(7457),VT=i(2449),UT=i(2),GT=i(5697),qT=i(7069),YT=i(4716),ZT=i(4740),XT=i(4557),QT=i(1868),KT=i(8647),JT=i(5127),t$=i(4816),e$=i(4009),i$=i(5104),o$=i(2830),r$=i(3093),s$=i(5029),n$=i(3514),a$=i(2142),l$=i(4999),c$=i(7523),h$=i(346),d$=i(7917),u$=i(3976),p$=i(9801),g$=i(2464),m$=i(5511),f$=i(5210),v$=i(5815),b$=i(3339),y$=i(7472),w$=i(8811),x$=i(8548),k$=i(6880),C$=i(1840),M$=i(5547),_$=i(4788),S$=i(9467),z$=i(9187),E$=i(9217),L$=i(7897),I$=i(2644),R$=i(6204),T$=i(1472),$$=i(1247),A$=i(7406),D$=i(925),O$=i(7455),N$=i(3771),P$=i(1549),j$=i(3541),H$=i(3140),F$=i(9800),B$=i(229),W$=i(2677),V$=i(1844),U$=i(3245),G$=i(9056),q$=i(7535),Y$=i(2359),Z$=i(15),X$=i(5569),Q$=i(2014),K$=i(1599),J$=i(6521),tA=i(232),eA=i(9745),iA=i(9594),oA=i(6979),rA=i(4494),sA=i(312),nA=i(4983),aA=i(1258),lA=i(6313),cA=i(12),hA=i(8003),dA=i(7830),uA=i(8875),pA=i(3911),gA=i(1817),mA=i(478),fA=i(2585),vA=i(6564),bA=i(2884),yA=i(3825),wA=i(7348),xA=i(9277),kA=i(4118),CA=i(9200),MA=i(51),_A=i(2872),SA=i(4702),zA=i(9281),EA=i(1394),LA=i(7295),IA=i(2936),RA=i(3789),TA=i(3614),$A=i(4827),AA=i(9204),DA=i(9113),OA=i(4058),NA=i(9939),PA=i(1139);const jA=[NL.mw,PL.mw,jL.mw,HL.mw,FL.mw,BL.mw,WL.mw,VL.mw,GL.mw,YL.mw,qL.mw,ZL.mw,XL.mw,QL.mw,KL.mw,JL.mw,tI.mw,eI.mw,iI.mw,oI.mw,rI.mw,sI.mw,nI.mw,aI.mw,lI.mw,cI.mw,hI.mw,dI.mw,uI.mw,gI.mw,mI.mw,fI.mw,vI.mw,bI.mw,yI.mw,wI.mw,xI.mw,kI.mw,CI.mw,MI.mw,_I.mw,SI.mw,EI.mw,zI.mw,LI.mw,II.mw,RI.mw,TI.mw,$I.mw,AI.mw,DI.mw,OI.mw,NI.mw,PI.mw,jI.mw,HI.mw,BI.mw,WI.mw,VI.mw,UI.mw,GI.mw,qI.mw,YI.mw,ZI.mw,XI.mw,QI.mw,KI.mw,JI.mw,tR.mw,eR.mw,iR.mw,oR.mw,rR.mw,sR.mw,nR.mw,FI.mw,aR.mw,lR.mw,cR.mw,hR.mw,dR.mw,uR.mw,pR.mw,gR.mw,mR.mw,fR.mw,vR.mw,bR.mw,yR.mw,wR.mw,xR.mw,kR.mw,CR.mw,MR.mw,_R.mw,SR.mw,zR.mw,ER.mw,LR.mw,IR.mw,RR.mw,TR.mw,$R.mw,AR.mw,DR.mw,OR.mw,NR.mw,PR.mw,jR.mw,HR.mw,FR.mw,BR.mw,WR.mw,VR.mw,UR.mw,GR.mw,qR.mw,pI.mw,YR.mw,ZR.mw,XR.mw,QR.mw,KR.mw,JR.mw,tT.mw,eT.mw,iT.mw,oT.mw,rT.mw,sT.mw,nT.mw,aT.mw,lT.mw,UL.mw,cT.mw,hT.mw],HA=[dT.mw,uT.mw,pT.mw,gT.mw,mT.mw,fT.mw,vT.mw,bT.mw,wT.mw,kT.mw,xT.mw,MT.mw,CT.mw,_T.mw,ST.mw,zT.mw,ET.mw,LT.mw,IT.mw,RT.mw,TT.mw,$T.mw,PT.mw,jT.mw,HT.mw,FT.mw,BT.mw,WT.mw,VT.mw,GT.mw,qT.mw,YT.mw,JT.mw,t$.mw,e$.mw,i$.mw,o$.mw,r$.mw,s$.mw,n$.mw,AT.mw,DT.mw,NT.mw,OT.mw,a$.mw,l$.mw,c$.mw,h$.mw,d$.mw,u$.mw,p$.mw,g$.mw,ZT.mw,XT.mw,QT.mw,KT.mw,f$.mw,v$.mw,b$.mw,y$.mw,w$.mw,x$.mw,k$.mw,C$.mw,M$.mw,_$.mw,S$.mw,z$.mw,E$.mw,L$.mw,I$.mw,R$.mw,T$.mw,$$.mw,A$.mw,m$.mw,D$.mw,O$.mw,N$.mw,P$.mw,j$.mw,H$.mw,F$.mw,B$.mw,W$.mw,V$.mw,U$.mw,G$.mw,q$.mw,Y$.mw,Z$.mw,X$.mw,Q$.mw,K$.mw,J$.mw,tA.mw,eA.mw,iA.mw,oA.mw,rA.mw,sA.mw,nA.mw,aA.mw,lA.mw,cA.mw,hA.mw,dA.mw,uA.mw,pA.mw,gA.mw,mA.mw,fA.mw,vA.mw,bA.mw,yA.mw,wA.mw,xA.mw,UT.mw,kA.mw,CA.mw,MA.mw,_A.mw,SA.mw,zA.mw,EA.mw,LA.mw,IA.mw,RA.mw,TA.mw,$A.mw,AA.mw,DA.mw,OA.mw,yT.mw,NA.mw,PA.mw],FA={xlsx:F,charts:B},BA={name:"@omegagrid/bundle",version:"0.10.50"};Ja().activate("light"),Wd.styleDefault="fal",Vd.add(jA),Vd.add(HA)})(),window.Omegagrid=o})();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@omegagrid/bundle",
3
- "version": "0.10.49",
3
+ "version": "0.10.50",
4
4
  "license": "UNLICENSED",
5
5
  "description": "Distribution package for Omegagrid library",
6
6
  "main": "omegagrid.js",
@@ -19,23 +19,23 @@
19
19
  "@fortawesome/fontawesome-svg-core": "^7.0.1",
20
20
  "@fortawesome/pro-light-svg-icons": "^7.0.1",
21
21
  "@fortawesome/pro-solid-svg-icons": "^7.0.1",
22
- "@omegagrid/bucket": "^0.10.49",
23
- "@omegagrid/calendar": "^0.10.49",
24
- "@omegagrid/code": "^0.10.49",
25
- "@omegagrid/commands": "^0.10.49",
26
- "@omegagrid/core": "^0.10.49",
27
- "@omegagrid/dialog": "^0.10.49",
28
- "@omegagrid/editor": "^0.10.49",
29
- "@omegagrid/form": "^0.10.49",
30
- "@omegagrid/grid": "^0.10.49",
31
- "@omegagrid/localize": "^0.10.49",
32
- "@omegagrid/markdown": "^0.10.49",
33
- "@omegagrid/plugin-charts": "^0.10.49",
34
- "@omegagrid/plugin-xlsx": "^0.10.49",
35
- "@omegagrid/statusbar": "^0.10.49",
36
- "@omegagrid/tabs": "^0.10.49",
37
- "@omegagrid/toolbar": "^0.10.49",
38
- "@omegagrid/tree": "^0.10.49",
22
+ "@omegagrid/bucket": "^0.10.50",
23
+ "@omegagrid/calendar": "^0.10.50",
24
+ "@omegagrid/code": "^0.10.50",
25
+ "@omegagrid/commands": "^0.10.50",
26
+ "@omegagrid/core": "^0.10.50",
27
+ "@omegagrid/dialog": "^0.10.50",
28
+ "@omegagrid/editor": "^0.10.50",
29
+ "@omegagrid/form": "^0.10.50",
30
+ "@omegagrid/grid": "^0.10.50",
31
+ "@omegagrid/localize": "^0.10.50",
32
+ "@omegagrid/markdown": "^0.10.50",
33
+ "@omegagrid/plugin-charts": "^0.10.50",
34
+ "@omegagrid/plugin-xlsx": "^0.10.50",
35
+ "@omegagrid/statusbar": "^0.10.50",
36
+ "@omegagrid/tabs": "^0.10.50",
37
+ "@omegagrid/toolbar": "^0.10.50",
38
+ "@omegagrid/tree": "^0.10.50",
39
39
  "lit": "^3.1.1"
40
40
  },
41
41
  "devDependencies": {