@omegagrid/bundle 0.9.26 → 0.9.28
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/omegagrid.js +6 -6
- package/package.json +18 -18
package/omegagrid.js
CHANGED
|
@@ -152,7 +152,7 @@
|
|
|
152
152
|
background-color: var(--og-colortype-${bs(xa[t])}-background-color);
|
|
153
153
|
border: 1px solid var(--og-colortype-${bs(xa[t])}-border-color);
|
|
154
154
|
}
|
|
155
|
-
`))],wa([Ln({type:String})],Ca.prototype,"text",void 0),wa([Ln({type:String})],Ca.prototype,"icon",void 0),wa([Ln({type:String,reflect:!0})],Ca.prototype,"type",void 0),wa([Ln({type:Boolean})],Ca.prototype,"closable",void 0),Ca=wa([En("og-alert")],Ca);class Ma extends Event{}class _a extends _n{constructor(){super(...arguments),this.customProperties={}}}const Sa={name:"light",type:"light",definition:{"font-size":$t(G.FONT_SIZE),"font-family":"verdana","base-radius":"3px","base-shadow":"0 4px 12px rgba(0, 0, 0, 0.12)","button-color":"var(--og-accent-color)","button-background-color":"#ffffff","button-background-color-highlight":"#cccccc",background:"#ffffff","background-color":"#ffffff","background-color-2":"#eeeeee","background-color-3":"#eeeeee","text-highlight-color":"#9b8400","text-color":"#000000","text-color-2":"#ffffff","text-color-3":"#000000","text-color-reversed":"#ffffff",border:"#cccccc","border-color":"#cccccc","border-color-2":"#939393","cell-background":"#ffffff","cell-border":"1px solid #cccccc","hcell-background":"#ececec","slider-background-color":"#eeeeee","slider-background-active":"#e2e2e2","slider-bar-color":"#aaaaaa","slider-bar-active":"#aaaaaa","expander-color":"#707070","expander-hover":"#00955d","expander-background-color":"#dbdbdb","sizer-background":"#00955d","frozen-border":"#b7b7b7","inset-shadow-color":"#707070","commands-color":"#000000","commands-background":"#ffffff","commands-header-background":"#cdcdcd","commands-input-background":"#f1f1f1","commands-shadow":"#7e7e7e","dialog-color":"#000000","dialog-background":"#ffffff","dialog-header-background":"#cdcdcd","dialog-shadow":"#7e7e7e","tab-border-color":"#939393","tab-background-color":"#f4f4f4","tab-panel-background-color":"#f4f4f4","tab-background-color-active":"#ffffff","bucket-tab-background-color":"#f4f4f4","bucket-tab-panel-background-color":"#f4f4f4","bucket-tab-background-color-active":"#ffffff","bucket-right-background-color":"#ffffff","bucket-border-color":"#939393","bucket-center-background-color":"#d8d8d8","bucket-left-background-color":"#f3f3f3","bucket-top-background-color":"#e5e5e5","bucket-sidebar-background-color":"#f3f3f3","form-background-color":"#e5e5e5","colortype-yellow-background-color":"#e49f30","colortype-yellow-border-color":"#e49f30","colortype-yellow-text-color":"#FFFFFF","colortype-green-background-color":"#43A047","colortype-green-border-color":"#43A047","colortype-green-text-color":"#FFFFFF","colortype-red-background-color":"#EF5350","colortype-red-border-color":"#EF5350","colortype-red-text-color":"#FFFFFF","colortype-blue-background-color":"#1E88E5","colortype-blue-border-color":"#1E88E5","colortype-blue-text-color":"#FFFFFF","colortype-gray-background-color":"#D9D9D9","colortype-gray-border-color":"#D9D9D9","colortype-gray-text-color":"#212121","colortype-accent-text-color":"#ffffff","switch-background-color":"#cccccc","switch-slider-color":"#ffffff"}},Ea={name:"dark",type:"dark",definition:{"font-size":$t(G.FONT_SIZE),"font-family":"verdana","base-radius":"3px","base-shadow":"0 4px 10px rgba(0,0,0,0.6)","button-color":"var(--og-accent-color)","button-background-color":"#1e1e1e","button-background-color-highlight":"#3a3a3a","background-color":"#181818","background-color-2":"#1f1f1f","background-color-3":"#292929","text-highlight-color":"#FFFF00","text-color":"#9b9b9b","text-color-2":"#ffffff","text-color-3":"#ffffff","text-color-reversed":"#ffffff",border:"#3a3a3a","border-color":"#3a3a3a","border-color-2":"#2a2a2a","cell-background":"#1e1e1e","cell-border":"1px solid #3a3a3a","hcell-background":"#2e2e2e","slider-background-color":"#272727","slider-background-active":"#313131","slider-bar-color":"#494949","slider-bar-active":"#494949","expander-color":"#707070","expander-hover":"#00955d","expander-background-color":"#3F3F3F","sizer-background":"#00955d","frozen-border":"#000000","inset-shadow-color":"#000000","commands-color":"#ffffff","commands-background":"#181818","commands-header-background":"#363636","commands-input-background":"#1D1D1D","commands-shadow":"#151515","dialog-color":"#ffffff","dialog-background":"#181818","dialog-header-background":"#363636","dialog-shadow":"#151515","tab-border-color":"#2a2a2a","tab-background-color":"#181818","tab-panel-background-color":"#181818","tab-background-color-active":"#1f1f1f","bucket-tab-background-color":"#2d2d2d","bucket-tab-panel-background-color":"#252526","bucket-tab-background-color-active":"#1f1f1f","bucket-right-background-color":"#1e1e1e","bucket-border-color":"#2a2a2a","bucket-center-background-color":"#181818","bucket-left-background-color":"#181818","bucket-top-background-color":"#181818","bucket-sidebar-background-color":"#272727","form-background-color":"#323233","colortype-yellow-background-color":"#e49f30","colortype-yellow-border-color":"#e49f30","colortype-yellow-text-color":"#ffffff","colortype-green-background-color":"#2E7D32","colortype-green-border-color":"#2E7D32","colortype-green-text-color":"#ffffff","colortype-red-background-color":"#C62828","colortype-red-border-color":"#C62828","colortype-red-text-color":"#ffffff","colortype-blue-background-color":"#1976D2","colortype-blue-border-color":"#1976D2","colortype-blue-text-color":"#ffffff","colortype-gray-background-color":"#424242","colortype-gray-border-color":"#424242","colortype-gray-text-color":"#ffffff","colortype-accent-text-color":"#ffffff","switch-background-color":"#474747","switch-slider-color":"#ffffff"}},za=Array.from({length:19},((t,e)=>5*(e+1))),Ia=[{from:"accent-color",to:"colortype-accent-background-color",transform:t=>t},{from:"accent-color",to:"colortype-accent-border-color",transform:t=>t},{from:"accent-color",to:"accent-color-alpha",transform:t=>Dr(t)},{from:"accent-color",to:"accent-color-alpha-15",transform:t=>Dr(t,.15)},{from:"accent-color",to:"accent-color-alpha-30",transform:t=>Dr(t,.3)},{from:"accent-color",to:"accent-color-alpha-70",transform:t=>Dr(t,.7)},{from:"accent-color",to:"accent-color-highlight",transform:t=>$r(t)},...Object.values(ya).flatMap((t=>za.map((e=>({from:`colortype-${t}-background-color`,to:`colortype-${t}-background-color-dark-${e}`,transform:t=>$r(t,e/100)})))))],La=Ia;function Ra(){return window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}function Ta(t){const e=new Map,i={...t.definition};t.accentColor&&(i["accent-color"]=t.accentColor);for(const t in i)e.set(`--${G.PREFIX}-${t}`,i[t]);return La.forEach((
|
|
155
|
+
`))],wa([Ln({type:String})],Ca.prototype,"text",void 0),wa([Ln({type:String})],Ca.prototype,"icon",void 0),wa([Ln({type:String,reflect:!0})],Ca.prototype,"type",void 0),wa([Ln({type:Boolean})],Ca.prototype,"closable",void 0),Ca=wa([En("og-alert")],Ca);class Ma extends Event{}class _a extends _n{constructor(){super(...arguments),this.customProperties={}}}const Sa={name:"light",type:"light",definition:{"font-size":$t(G.FONT_SIZE),"font-family":"verdana","base-radius":"3px","base-shadow":"0 4px 12px rgba(0, 0, 0, 0.12)","button-color":"var(--og-accent-color)","button-background-color":"#ffffff","button-background-color-highlight":"#cccccc",background:"#ffffff","background-color":"#ffffff","background-color-2":"#eeeeee","background-color-3":"#eeeeee","text-highlight-color":"#9b8400","text-color":"#000000","text-color-2":"#ffffff","text-color-3":"#000000","text-color-reversed":"#ffffff",border:"#cccccc","border-color":"#cccccc","border-color-2":"#939393","cell-background":"#ffffff","cell-border":"1px solid #cccccc","hcell-background":"#ececec","slider-background-color":"#eeeeee","slider-background-active":"#e2e2e2","slider-bar-color":"#aaaaaa","slider-bar-active":"#aaaaaa","expander-color":"#707070","expander-hover":"#00955d","expander-background-color":"#dbdbdb","sizer-background":"#00955d","frozen-border":"#b7b7b7","inset-shadow-color":"#707070","commands-color":"#000000","commands-background":"#ffffff","commands-header-background":"#cdcdcd","commands-input-background":"#f1f1f1","commands-shadow":"#7e7e7e","dialog-color":"#000000","dialog-background":"#ffffff","dialog-header-background":"#cdcdcd","dialog-shadow":"#7e7e7e","tab-border-color":"#939393","tab-background-color":"#f4f4f4","tab-panel-background-color":"#f4f4f4","tab-background-color-active":"#ffffff","bucket-tab-background-color":"#f4f4f4","bucket-tab-panel-background-color":"#f4f4f4","bucket-tab-background-color-active":"#ffffff","bucket-right-background-color":"#ffffff","bucket-border-color":"#939393","bucket-center-background-color":"#d8d8d8","bucket-left-background-color":"#f3f3f3","bucket-top-background-color":"#e5e5e5","bucket-sidebar-background-color":"#f3f3f3","form-background-color":"#e5e5e5","colortype-yellow-background-color":"#e49f30","colortype-yellow-border-color":"#e49f30","colortype-yellow-text-color":"#FFFFFF","colortype-green-background-color":"#43A047","colortype-green-border-color":"#43A047","colortype-green-text-color":"#FFFFFF","colortype-red-background-color":"#EF5350","colortype-red-border-color":"#EF5350","colortype-red-text-color":"#FFFFFF","colortype-blue-background-color":"#1E88E5","colortype-blue-border-color":"#1E88E5","colortype-blue-text-color":"#FFFFFF","colortype-gray-background-color":"#D9D9D9","colortype-gray-border-color":"#D9D9D9","colortype-gray-text-color":"#212121","colortype-accent-text-color":"#ffffff","switch-background-color":"#cccccc","switch-slider-color":"#ffffff"}},Ea={name:"dark",type:"dark",definition:{"font-size":$t(G.FONT_SIZE),"font-family":"verdana","base-radius":"3px","base-shadow":"0 4px 10px rgba(0,0,0,0.6)","button-color":"var(--og-accent-color)","button-background-color":"#1e1e1e","button-background-color-highlight":"#3a3a3a","background-color":"#181818","background-color-2":"#1f1f1f","background-color-3":"#292929","text-highlight-color":"#FFFF00","text-color":"#9b9b9b","text-color-2":"#ffffff","text-color-3":"#ffffff","text-color-reversed":"#ffffff",border:"#3a3a3a","border-color":"#3a3a3a","border-color-2":"#2a2a2a","cell-background":"#1e1e1e","cell-border":"1px solid #3a3a3a","hcell-background":"#2e2e2e","slider-background-color":"#272727","slider-background-active":"#313131","slider-bar-color":"#494949","slider-bar-active":"#494949","expander-color":"#707070","expander-hover":"#00955d","expander-background-color":"#3F3F3F","sizer-background":"#00955d","frozen-border":"#000000","inset-shadow-color":"#000000","commands-color":"#ffffff","commands-background":"#181818","commands-header-background":"#363636","commands-input-background":"#1D1D1D","commands-shadow":"#151515","dialog-color":"#ffffff","dialog-background":"#181818","dialog-header-background":"#363636","dialog-shadow":"#151515","tab-border-color":"#2a2a2a","tab-background-color":"#181818","tab-panel-background-color":"#181818","tab-background-color-active":"#1f1f1f","bucket-tab-background-color":"#2d2d2d","bucket-tab-panel-background-color":"#252526","bucket-tab-background-color-active":"#1f1f1f","bucket-right-background-color":"#1e1e1e","bucket-border-color":"#2a2a2a","bucket-center-background-color":"#181818","bucket-left-background-color":"#181818","bucket-top-background-color":"#181818","bucket-sidebar-background-color":"#272727","form-background-color":"#323233","colortype-yellow-background-color":"#e49f30","colortype-yellow-border-color":"#e49f30","colortype-yellow-text-color":"#ffffff","colortype-green-background-color":"#2E7D32","colortype-green-border-color":"#2E7D32","colortype-green-text-color":"#ffffff","colortype-red-background-color":"#C62828","colortype-red-border-color":"#C62828","colortype-red-text-color":"#ffffff","colortype-blue-background-color":"#1976D2","colortype-blue-border-color":"#1976D2","colortype-blue-text-color":"#ffffff","colortype-gray-background-color":"#424242","colortype-gray-border-color":"#424242","colortype-gray-text-color":"#ffffff","colortype-accent-text-color":"#ffffff","switch-background-color":"#474747","switch-slider-color":"#ffffff"}},za=Array.from({length:19},((t,e)=>5*(e+1))),Ia=[{from:"accent-color",to:"colortype-accent-background-color",transform:t=>t},{from:"accent-color",to:"colortype-accent-border-color",transform:t=>t},{from:"accent-color",to:"accent-color-alpha",transform:t=>Dr(t)},{from:"accent-color",to:"accent-color-alpha-15",transform:t=>Dr(t,.15)},{from:"accent-color",to:"accent-color-alpha-30",transform:t=>Dr(t,.3)},{from:"accent-color",to:"accent-color-alpha-70",transform:t=>Dr(t,.7)},{from:"accent-color",to:"accent-color-highlight",transform:t=>$r(t)},...Object.values(ya).flatMap((t=>za.map((e=>({from:`colortype-${t}-background-color`,to:`colortype-${t}-background-color-dark-${e}`,transform:t=>$r(t,e/100)}))))),...Object.values(ya).flatMap((t=>za.map((e=>({from:`colortype-${t}-background-color`,to:`colortype-${t}-background-color-light-${e}`,transform:t=>Or(t,e/100)}))))),...Object.values(ya).flatMap((t=>za.map((e=>({from:`colortype-${t}-background-color`,to:`colortype-${t}-background-color-soft-${e}`,transform:(t,i)=>"dark"===i.type?$r(t,e/100):Or(t,e/100)})))))],La=Ia;function Ra(){return window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}function Ta(t){const e=new Map,i={...t.definition};t.accentColor&&(i["accent-color"]=t.accentColor);for(const t in i)e.set(`--${G.PREFIX}-${t}`,i[t]);return La.forEach((o=>{const r=o.transform(i[o.from],t);i[o.to]=r,e.set(`--${G.PREFIX}-${o.to}`,r)})),e.set(`--${G.PREFIX}-bw`,"dark"==t.type?"#000000":"#ffffff"),e.set(`--${G.PREFIX}-bw-inverted`,"dark"==t.type?"#ffffff":"#000000"),e}function Aa(t){const e=Ta(t),i=Array.from(e).map((([t,e])=>`${t}: ${e};`)).join("\n");return bs(i)}function Oa(t,e){return e.forEach(((e,i)=>t.setProperty(i,e))),t}const $a=t=>e=>{const i=Aa(t);return class extends e{static finalizeStyles(t){return t=t?Array.isArray(t)?t:[t]:[],_n.finalizeStyles([i,...t])}}},Da=t=>e=>{let i=[];return t.props.length>0&&(i=Object.values(ya).map((e=>bs(`\n\t\t\t:host([color="${e}"])${t.selector?` ${t.selector}`:""} {\n\t\t\t\t${t.props.map((t=>"color"==t?`color: var(--og-colortype-${e}-text-color);`:"background"==t?`background-color: var(--og-colortype-${e}-background-color);`:"border"==t?`border: 1px solid var(--og-colortype-${e}-border-color);`:void 0)).join("\n")}\n\t\t\t}\n\t\t`)))),class extends e{static finalizeStyles(t){return t=t?Array.isArray(t)?t:[t]:[],_n.finalizeStyles([...i,...t])}}},Na=document.documentElement;class Pa extends Event{constructor(t,e){super(t),this.theme=e}}class ja extends EventTarget{get activeTheme(){return this._activeTheme}constructor(t=Na){super(),this.elm=t,this.themes=new Map}registerTheme(t){t.accentColor=t.accentColor??G.DEFAULT_ACCENT_COLOR,this.themes.set(t.name,t)}activate(t){const e=this.themes.get(t);e?(this._activeTheme=e,Oa(this.elm.style,Ta(e)),this.dispatchEvent(new Pa("change",e))):Er().warn(`Theme "${t}" not found`)}}let Ha;function Fa(){return Ha||(Ha=new ja),Ha}Fa().registerTheme(Sa),Fa().registerTheme(Ea),Fa().activate("light"==Ra()?"light":"dark");const Ba=ys`
|
|
156
156
|
:host {
|
|
157
157
|
box-sizing: border-box;
|
|
158
158
|
font-size: var(--og-font-size);
|
|
@@ -3700,7 +3700,7 @@
|
|
|
3700
3700
|
padding-right: 2px;
|
|
3701
3701
|
}
|
|
3702
3702
|
|
|
3703
|
-
`,Uf={enabled:!1,includeChildren:!0,includeParents:!0},Gf={enabled:!0,reversed:!1},qf={ROW_HEIGHT:22,RESIZE_TRESHOLD:10,ROW_HEADER_WIDTH:60,SLIDER_SIZE:12,EXPANDER_SIZE:13,MAX_CACHE_ITEMS:5e3,CACHE_CLEAN_INTERVAL:30,COMMENT_HIDE_TIMEOUT:1e3,SELECTOR_BORDER_WIDTH:2,MIN_ROW_HEIGHT:5,MIN_COL_WIDTH:5,SPARKLINE_GAP:4,AUTOSCROLL_TRESHOLD:100,AUTOSCROLL_RATIO:1.1,AUTOSCROLL_INTERVAL:100,DEFAULT_SPARKLINE_OPTIONS:{minValue:"auto",maxValue:"auto",type:"line",style:{color:"0094FF",weight:1},marker:{color:"ff0000"}},DEFAULT_OPTIONS:{rows:100,columns:20,readOnly:!1,rowNumbers:!0,rowPriority:2,rowTree:{enabled:!0},columnTree:{enabled:!0},colLetters:!0,emptyPlaceholder:!0,freezeTop:0,fontSize:12,rowHeight:22,rowResize:!0,columnWidth:100,columnResize:!0,columnPriority:1,freezeLeft:0,freezeRight:0,freezeBottom:0,maxSortingColumns:3,numberFormat:null,levelIndentFactor:2,cellIndentFactor:10,emptyClickable:!1,grid:!0,autofill:!0,undoRedo:!0,commandWindow:!0,cellCache:!0,singleCellModel:!1,zoom:1,editing:{rowInsertion:!0,rowDeletion:!0,colInsertion:!0,colDeletion:!0,rowOutline:!0,colOutline:!0,dateCalendarEditor:!1},comments:{hideTimeout:1e3,offsetX:30,offsetY:-30,zIndex:500,headerPosition:"top"},scrolling:{verticalOverscroll:!0,horizontalOverscroll:!0,scrollbarVisibilityTreshold:100},selecting:{enabled:!0,multiSelect:!0},events:{click:{mouseMoveTreshold:10}},clipboard:{pasteProps:["v","dv"],rowPasteMode:"rewrite_append",columnPasteMode:"rewrite"},print:{dpi:600,margins:{left:6.35,right:6.35,top:19.05,bottom:19.05,header:7.62,footer:7.62},orientation:"portrait",paper:"A4"}},MAX_COMMENT_AUTOHEIGHT:300,MIN_COMMENT_AUTOHEIGHT:25,...G},Yf=/^(?!.*[\\\/\*\[\]\:\?"])(.{1,31})$/;function Zf(t){return Yf.test(t)}function Xf(t){return["\\","/","*","[","]",":","?",'"'].forEach((e=>t=t.replace(new RegExp(`\\${e}`,"g"),""))),t}function Qf(t,e){return!isNaN(t)&&null!=t||!isNaN(e)&&null!=e||(t=null==t?"":ct(t.toString()).toLowerCase(),e=null==e?"":ct(e.toString()).toLowerCase()),t>e?1:t<e?-1:0}function Kf(t,e){const i=Q(e);return Q(t)?(t=t.toString().trim()).startsWith("=")?0==Qf(e,i?t.substring(1):parseFloat(t.substring(1))):t.startsWith(">=")?Qf(e,i?t.substring(2):parseFloat(t.substring(2)))>=0:t.startsWith("<=")?Qf(e,i?t.substring(2):parseFloat(t.substring(2)))<=0:t.startsWith(">")?Qf(e,i?t.substring(1):parseFloat(t.substring(1)))>0:t.startsWith("<")?Qf(e,i?t.substring(1):parseFloat(t.substring(1)))<0:0==Qf(e,i?t:isNaN(t)?t||"":parseFloat(t)):e==t}const Jf=new Map([["=",["==",1,0]],["<>",["!=",1,0]],[">",[">",1,0]],["<",["<",1,0]],[">=",[">=",1,0]],["<=",["<=",1,0]],["+",["+",2,0]],["-",["-",2,0]],["*",["*",3,0]],["/",["/",3,0]]]),tv=t=>["=",">","<",">=","<="].includes(t),ev=t=>["+","-","*","/"].includes(t),iv=t=>ev(t)||tv(t);function ov(t,e,i){switch(i){case"+":return t+e;case"-":return t-e;case"*":return t*e;case"/":return t/e;case"=":return 0==Qf(t,e);case">":return Qf(t,e)>0;case"<":return Qf(t,e)<0;case">=":return Qf(t,e)>=0;case"<=":return Qf(t,e)<=0;default:throw new Error(`Invalid operator: ${i}`)}}function rv(t,e,i){const o=Array.isArray(t),r=Array.isArray(e);if(!o&&!r)return[[ov(t,e,i)]];const s=Math.max(o?t.length:0,r?e.length:0),n=Math.max(o?t[0].length:0,r?e[0].length:0),a=[];for(let l=0;l<s;l++){const s=[];for(let a=0;a<n;a++){const n=o?t[l]?.[a]:t,c=r?e[l]?.[a]:e,h=null==n&&null==c?null:ov(n,c,i);s.push(h)}a.push(s)}return a}var sv;!function(t){t[t.Number=0]="Number",t[t.Boolean=1]="Boolean",t[t.String=2]="String",t[t.StringQuote=3]="StringQuote",t[t.Function=4]="Function",t[t.ArgumentSeparator=5]="ArgumentSeparator",t[t.OpenBracket=6]="OpenBracket",t[t.CloseBracket=7]="CloseBracket",t[t.Operator=8]="Operator",t[t.Cell=9]="Cell",t[t.Variable=10]="Variable",t[t.Range=11]="Range",t[t.Sheet=12]="Sheet",t[t.SheetQuote=13]="SheetQuote",t[t.SheetSeparator=14]="SheetSeparator",t[t.Unknown=15]="Unknown",t[t.Operand=16]="Operand"}(sv||(sv={}));const nv=t=>t===sv.Number||t===sv.Boolean||t===sv.String||t===sv.Cell||t===sv.Variable||t===sv.Range,av=t=>t>=48&&t<=57,lv=t=>"true"===(t=t.toLowerCase())||"false"===t,cv=t=>t>=65&&t<=90||t>=97&&t<=122||t>=192&&t<=687,hv={decimalPoint:".",stringQuote:'"',sheetQuote:"'",argumentSeparator:","};class dv{constructor(t){this.options=Object.assign(hv,t)}tokenize(t){const e=[],i=t.length;let o,r,s,n,a=0,l="",c=!1,h=!1,d=!1;for(;a<i;){if(o=t.charAt(a),r=o.charCodeAt(0),"="==o&&0==a)++a;else if(av(r)){for(l=(d?"-":"")+o,++a;a<i;)if(o=t.charAt(a),r=o.charCodeAt(0),av(r))l+=o,++a;else{if(o!==this.options.decimalPoint)break;l+=".",++a}d=!1,e.push([l,sv.Number])}else if(cv(r)||"$"==o){l=o,s=null,++a;do{if(o=t.charAt(a),r=o.charCodeAt(0),cv(r)||av(r)||"."===o||"$"===o||"_"===o)"_"==o?s=sv.Variable:av(r)&&!c&&null==s&&(s=sv.Cell),l+=o,++a,a==i&&e.push([l,s||sv.Variable]);else{if("("==o){e.push([l.toUpperCase(),sv.Function]),e.push([o,sv.OpenBracket]),++a;break}if("'"==o)e.push([l,sv.Sheet]),l="",e.push([o,sv.SheetQuote]),c=!0,++a;else if(":"==o)s=sv.Range,l+=o,++a;else{if(!c||" "!=o){if("!"==o){""!==l&&e.push([l,sv.Sheet]),e.push([o,sv.SheetSeparator]),c=!1,l="",++a;break}e.push([l,s||(lv(l)?sv.Boolean:sv.Variable)]);break}l+=o,++a}}}while(a<i)}else if(iv(o)){if("-"===o&&av(t.charCodeAt(a+1))&&(null==n||"("==n[0]||tv(n[0])||n[1]==sv.ArgumentSeparator))d=!0;else{for(l=o;tv(t.charAt(a+1));)l+=t.charAt(++a);e.push([l,sv.Operator])}++a}else if("("===o)e.push([o,sv.OpenBracket]),++a;else if(")"===o)e.push([o,sv.CloseBracket]),++a;else if("'"===o)e.push([o,sv.SheetQuote]),c=!0,++a;else if(o===this.options.argumentSeparator)e.push([o,sv.ArgumentSeparator]),++a;else if(o===this.options.stringQuote){for(h=!1,e.push([o,sv.StringQuote]),l="";++a<i;){if(o=t.charAt(a),o===this.options.stringQuote){h=!0,++a;break}l+=o}e.push([l,sv.String]),h&&e.push([this.options.stringQuote,sv.StringQuote])}else e.push([o,sv.Unknown]),++a;n=e[e.length-1]}return e}}function uv(t,e,i=null,o=!0){return t+=e,0==e?t:t>=0?i?o?t%i:Math.min(t,i-1):t:o&&i?i+t%i:Math.max(t,0)}const pv=/(?:'?([\w\s]*)'?!)?(\$?)([a-z]*)(\$?)(\d*)(?::(\$?)([a-z]*)(\$?)(\d*))?/i;class gv{constructor(t,e,i,o,r){this.setCoords(t,e,i,o),this.sheet=r}setCoords(t,e,i,o){this.c1=null==t&&null==i?0:t,this.r1=null==e&&null==o?0:e,this.c2=null==o&&null!=t||null!=i?null==i?t:i:1/0,this.r2=null==i&&null!=e||null!=o?null==o?e:o:1/0,this.normalize()}get size(){return{columns:this.c2-this.c1+1,rows:this.r2-this.r1+1}}get count(){const{columns:t,rows:e}=this.size;return t*e}normalize(){const[t,e]=[Math.min(this.c1,this.c2),Math.max(this.c1,this.c2)],[i,o]=[Math.min(this.r1,this.r2),Math.max(this.r1,this.r2)];return this.c1=t,this.c2=e,this.r1=i,this.r2=o,this}move(t,e,i=null,o=null,r=!0){const s=uv(this.c1,t,i,r);r&&(e+=this.c1+t!=s&&0!=t?t>0?1:-1:0),this.c1=s,this.r1=uv(this.r1,e,o,r),this.c2=uv(this.c2,t,i,r),this.r2=uv(this.r2,e,o,r)}contains(t){return t.c1>=this.c1&&t.c2<=this.c2&&t.r1>=this.r1&&t.r2<=this.r2}containsColumn(t){return this.c1<=t&&this.c2>=t}containsRow(t){return this.r1<=t&&this.r2>=t}removeAnchors(){return this.c1Anchor=!1,this.c2Anchor=!1,this.r1Anchor=!1,this.r2Anchor=!1,this}addAnchors(){return this.c1Anchor=!0,this.c2Anchor=!0,this.r1Anchor=!0,this.r2Anchor=!0,this}shiftLeft(t,e=1,i=null,o=!1){return t<=this.c1&&(o||!this.c1Anchor)&&(null==i||this.c1<=i)&&(this.c1-=e),t<=this.c2&&(o||!this.c2Anchor)&&(null==i||this.c2<=i)&&(this.c2-=e),this}shiftRight(t,e=1,i=null,o=!1){return t<=this.c1&&(o||!this.c1Anchor)&&(null==i||this.c1<=i)&&(this.c1+=e),t<=this.c2&&(o||!this.c2Anchor)&&(null==i||this.c2<=i)&&(this.c2+=e),this}shiftUp(t,e=1,i=null,o=!1){return t<=this.r1&&(o||!this.r1Anchor)&&(null==i||this.r1<=i)&&(this.r1-=e),t<=this.r2&&(o||!this.r2Anchor)&&(null==i||this.r2<=i)&&(this.r2-=e),this}shiftDown(t,e=1,i=null,o=!1){return t<=this.r1&&(o||!this.r1Anchor)&&(null==i||this.r1<=i)&&(this.r1+=e),t<=this.r2&&(o||!this.r2Anchor)&&(null==i||this.r2<=i)&&(this.r2+=e),this}shift(t){const{index:e,offset:i,direction:o,maxIndex:r,ignoreAnchors:s}=t;switch(o){case"down":return this.shiftDown(e,i,r,s);case"up":return this.shiftUp(e,i,r,s);case"left":return this.shiftLeft(e,i,r,s);case"right":return this.shiftRight(e,i,r,s)}}intersect(t){this.normalize(),t.normalize();const e=Math.max(t.c1,this.c1),i=Math.min(t.c2,this.c2),o=Math.max(t.r1,this.r1),r=Math.min(t.r2,this.r2);return e<=i&&o<=r?new gv(e,o,i,r,this.sheet):null}unite(t){return this.normalize(),t.normalize(),new gv(Math.min(this.c1,t.c1),Math.min(this.r1,t.r1),Math.max(this.c2,t.c2),Math.max(this.r2,t.r2),this.sheet)}clone(){const t=new gv(this.c1,this.r1,this.c2,this.r2,this.sheet);return t.c1Anchor=this.c1Anchor,t.r1Anchor=this.r1Anchor,t.c2Anchor=this.c2Anchor,t.r2Anchor=this.r2Anchor,t}equals(t,e=!1){return t.c1==this.c1&&t.r1==this.r1&&t.c2==this.c2&&t.r2==this.r2&&(0==e||t.c1Anchor==this.c1Anchor&&t.r1Anchor==this.r1Anchor&&t.c2Anchor==this.c2Anchor&&t.r2Anchor==this.r2Anchor)}get isCell(){return this.c2==this.c2&&this.r2==this.r1}get isRange(){return this.c2!=this.c1||this.r2!=this.r1}get isColumn(){return 0==this.r1&&this.r2==1/0}get isRow(){return 0==this.c1&&this.c2==1/0}get A1(){const t=this.isRange,e=(this.c1Anchor?"$":"")+(0!==this.c1||this.c2!==1/0?vv(this.c1):"")+(0===this.r1&&this.r2===1/0?"":(this.r1Anchor?"$":"")+mv(this.r1)),i=t?(this.c2Anchor?"$":"")+(!isNaN(this.c2)&&this.c2<1/0?vv(this.c2):"")+(this.r2Anchor?"$":"")+(!isNaN(this.r2)&&this.r2<1/0?mv(this.r2):""):e;return(null==this.sheet?"":((o=this.sheet).indexOf(" ")>-1?"'"+o+"'":o)+"!")+(e==i?e:e+":"+i);var o}get bounds(){return[[new gv(this.c1,this.r1),this.c2<1/0?new gv(this.c2,this.r1):null],[this.r2<1/0?new gv(this.c1,this.r2):null,this.r2<1/0&&this.c2<1/0?new gv(this.c2,this.r2):null]]}*cells(){for(let t=this.r1;t<=this.r2;t++)for(let e=this.c1;e<=this.c2;e++)yield new gv(e,t)}static fromA1(t){const e=pv.exec(t),i=new gv(e[3]?bv(e[3]):null,e[5]?fv(e[5]):null,e[7]?bv(e[7]):null,e[9]?fv(e[9]):null,e[1]||null);return!e[2]&&e[3]||(i.c1Anchor=!0),!e[4]&&e[5]||(i.r1Anchor=!0),(e[6]||e[2]&&!e[7])&&(i.c2Anchor=!0),(e[8]||e[4]&&!e[9])&&(i.r2Anchor=!0),i}}function mv(t){return(t+1).toString()}function fv(t){return parseInt(t)-1}function vv(t){++t;let e,i="";for(;t>0;)e=(t-1)%26,i=String.fromCharCode(e+65)+i,t=(t-e-1)/26;return i}function bv(t){const e=t.length;let i=0;for(let o=0;o<e;o++)i+=(t.charCodeAt(o)-64)*Math.pow(26,e-o-1);return i-1}function yv(t){return t.sort(((t,e)=>{const i=Math.min(t.r1,t.r2),o=Math.min(e.r1,e.r2),r=Math.min(t.c1,t.c2),s=Math.min(e.c1,e.c2);return i<o?-1:i>o?1:r<s?-1:s>r?1:0}))}function wv(t){return t.formula.cells.map((e=>t.cell.model.getCellByRange(e[1])))}function xv(t){let e=t;for(;Array.isArray(e);)e=e.length>0?e[0]:null;return e}function kv(t){return Array.isArray(t)?t:[[t]]}function Cv(t,e,i,o){if(!Array.isArray(t))return e(t,i,o);for(let o=0;o<t.length;o++)if(!1===Cv(t[o],e,null==i?o:i,null==i?void 0:o))return!1}gv.fromA1s=(t,e=";")=>t.split(e).map((t=>gv.fromA1(t))),gv.toA1s=(t,e=";")=>t.map((t=>t.A1)).join(e),gv.fromCoords=t=>new gv(t.c1,t.r1,t.c2,t.r2),gv.fullColumn=t=>new gv(t,0,t,1/0),gv.fullRow=t=>new gv(0,t,1/0,t);const Mv=new Set(["SUMPRODUCT","FILTER"]),_v=t=>Mv.has(t),Sv=t=>!!(t&&t.length>0&&"="==t.charAt(0)),Ev=t=>Sv(t)?t:"="+(t??""),zv=t=>Sv(t)?t.substring(1):t,Iv=["#5B97FF","#FF616B","#B77CFF","#00B02C","#FC58BE","#FF9000","#2EB0B3"],Lv=t=>Iv[t%Iv.length],Rv=new Map([["FORMULATEXT","_xlfn."],["CONCAT","_xlfn."],["INDIRECT","_xlfn."],["ISOWEEKNUM","_xlfn."],["SWITCH","_xlfn."],["XOR","_xlfn."]]);class Tv{get fn(){return this._fn??(this._fn=new Function("t","ctx","return "+this.compile()))}get tokens(){return this._tokens}get variables(){return this._variables}get cells(){return this._cells}get ranges(){return this._ranges}get colors(){if(!this._colors){let t;this._colors=new Map,this._tokens.forEach(((e,i)=>{if([sv.Cell,sv.Range].includes(e[1])){const o=(t?"'"+t+"'!":"")+e[0];this._colors.set(o,{color:Lv(this._colors.size),address:e[0],sheet:t,type:e[1],tokenIndex:i}),t=null}else e[1]==sv.Sheet&&(t=e[0])}))}return this._colors}constructor(t,e){this.expression=t,this.tokenizer=e,this._tokens=e.tokenize(this.expression),this.updateDependecies()}findTokenIndexAtPosition(t){let e=0;return this._tokens.findIndex((i=>{const o=i[0].length;if(t>=e&&t<=e+o)return!0;e+=o}))}findSheetTokenIndex(t){const e=this._tokens[t];if(![sv.Cell,sv.Range].includes(e[1]))return-1;if(0==t||this._tokens[t-1][1]!=sv.SheetSeparator)return-1;let i=t-2;for(;i>=0;){if(this._tokens[i][1]==sv.Sheet)return i;i--}return-1}removeSheetToken(t){if(this._tokens[t][1]!=sv.Sheet&&(t=this.findSheetTokenIndex(t)),t>-1){t>0&&this._tokens[t-1][1]==sv.SheetQuote&&t--;let e=t;for(;e<this._tokens.length&&[sv.SheetSeparator,sv.SheetQuote,sv.Sheet].includes(this._tokens[e][1]);)e++;return this._tokens.splice(t,e-t),e-t}return 0}getNamedColor(t){return this.colors.get(t)?.color??"inherit"}getTokenPosition(t){let e=0;for(let i=0;i<t;i++)e+=this._tokens[i][0].length;return{min:e,max:e+this._tokens[t][0].length}}updateToken(t,e){this._fn=null,this._formula=null,this._xlFormula=null,this._tokens[t][0]=e}removeToken(t){this._fn=null,this._formula=null,this._xlFormula=null,this._tokens.splice(t,1)}insertToken(t,e,i){this._fn=null,this._formula=null,this._xlFormula=null;const o=[];return i==sv.Sheet&&/\s/.test(e)?(o.push([this.tokenizer.options.sheetQuote,sv.SheetQuote]),o.push([e,sv.Sheet]),o.push([this.tokenizer.options.sheetQuote,sv.SheetQuote])):o.push([e,i]),o.push(["!",sv.SheetSeparator]),this._tokens.splice(t,0,...o),o.length}clone(){return new Tv(this.createFormulaString(),this.tokenizer)}updateDependecies(){let t;this._variables=[],this._cells=[],this._ranges=[],this._tokens.forEach(((e,i)=>{switch(e[1]){case sv.Sheet:t=e[0];break;case sv.Variable:this._variables.push([i,e[0],t]),t=void 0;break;case sv.Cell:this._cells.push([i,gv.fromA1(e[0]),t]),t=void 0;break;case sv.Range:this._ranges.push([i,gv.fromA1(e[0]),t]),t=void 0}}))}createFormulaString(t=!1,e=!1){const i=this.tokenizer.options;let o,r,s,n="";for(let l=0;l<this._tokens.length;l++)switch(o=this._tokens[l],o[1]){case sv.SheetQuote:n+="'";break;case sv.SheetSeparator:n+="!";break;case sv.Sheet:r=o[0],n+=t?`<span style="font-style:italic">${r}</span>`:r;break;case sv.Variable:n+=o[0];break;case sv.Range:case sv.Cell:s=(r?"'"+r+"'!":"")+o[0],n+=t?`<span style="color:${this.getNamedColor(s)}">${o[0]}</span>`:o[0],r=null;break;case sv.StringQuote:n+=i.stringQuote;break;case sv.String:n+=o[0].replace(new RegExp(i.stringQuote,"g"),"\\"+i.stringQuote);break;case sv.ArgumentSeparator:n+=i.argumentSeparator;break;case sv.Function:n+=(e?(a=o[0],Rv.get(a)??""):"")+o[0];break;case sv.Unknown:n+=t?`<span style="background:#f00;color:#fff">${o[0]}</span>`:o[0];break;default:n+=o[0]}var a;return n}createExpressionTree(){const t=[],e=[],i=this.tokens;let o,r,s,n,a,l=null;for(let c=0;c<i.length;c++)switch(o=i[c],o[1]){case sv.Sheet:l=o[0];break;case sv.Cell:case sv.Range:t.push({t:o[0],tt:o[1],s:l}),l=null;break;case sv.Number:case sv.String:case sv.Boolean:case sv.Variable:t.push({t:o[0],tt:o[1]});break;case sv.Operator:for(0==t.length&&t.push({t:"",tt:sv.Operand}),s=Jf.get(o[0]);e.length>0&&(n=Jf.get(e[e.length-1][0]),n)&&(0===s[2]&&s[1]<=n[1]||1===s[2]&&s[1]<n[1]);)r=e.pop(),a=[t.pop(),t.pop()].reverse(),t.push({t:r[0],tt:r[1],c:a});e.push(o);break;case sv.Function:case sv.OpenBracket:e.push(o);break;case sv.ArgumentSeparator:for(;e.length>0&&(r=e[e.length-1],![sv.OpenBracket,sv.ArgumentSeparator].includes(r[1]));)r=e.pop(),a=[t.pop(),t.pop()].reverse(),t.push({t:r[0],tt:r[1],c:a});e.push(o);break;case sv.CloseBracket:for(a=[];e.length>0&&e[e.length-1][1]!==sv.OpenBracket;)r=e.pop(),r[1]==sv.Operator?a.push({t:r[0],tt:r[1],c:[t.pop(),t.pop()].reverse()}):r[1]==sv.ArgumentSeparator&&t.length>0&&a.push(t.pop());e.pop(),e.length>0&&e[e.length-1][1]===sv.Function?(r=e.pop(),a=a.reverse(),t.length>0&&i[c-1][1]!==sv.OpenBracket&&a.unshift(t.pop()),t.push({t:r[0],tt:r[1],c:a})):t.push(...a)}for(;e.length>0;)r=e.pop(),t.push({t:r[0],tt:r[1],c:[t.pop(),t.pop()].reverse()});return t.pop()}createExpressionJSCode(t,e,i){let o;switch(t.tt){case sv.Range:return"t.rn('"+t.t+"'"+(t.s?",'"+t.s+"'":"")+")";case sv.Cell:return"t.cl('"+t.t+"'"+(t.s?",'"+t.s+"'":"")+")";case sv.Operand:return"t.cl()";case sv.Variable:return i||e?.tt===sv.Function?"t.nr('"+t.t+"'"+(t.s?",'"+t.s+"'":"")+")":"t.nv('"+t.t+"'"+(t.s?",'"+t.s+"'":"")+")";case sv.String:return"'"+t.t.replace(/'/g,"\\'")+"'";case sv.Boolean:return"T"==t.t[0].toUpperCase()?"1":"0";case sv.Function:return o=t.c.map((e=>this.createExpressionJSCode(e,t,i||_v(t.t)))),"t.fn('"+t.t+"').call(ctx"+(o.length>0?","+o.join(","):"")+")";case sv.Operator:return i?(o=t.c.map((e=>this.createExpressionJSCode(e,t,i||_v(t.t)))),"t.op("+o[0]+","+o[1]+",'"+t.t+"')"):Jf.has(t.t)?"("+t.c.map((e=>this.createExpressionJSCode(e,t,i))).join(Jf.get(t.t)[0])+")":null;default:return t.t}}compile(){const t=this.createExpressionTree();return this.createExpressionJSCode(t)}toString(t=!1){return(t?"=":"")+(this._formula??(this._formula=this.createFormulaString()))}toExcelString(){return this._xlFormula??(this._xlFormula=this.createFormulaString(!1,!0))}shift(t){const{index:e,offset:i,direction:o,maxIndex:r,sheet:s,allSheets:n}=t;return this._cells&&this._cells.forEach((t=>{if(n||null==t[2]||t[2]==s){switch(o){case"up":t[1].shiftUp(e,i,r);break;case"right":t[1].shiftRight(e,i,r);break;case"down":t[1].shiftDown(e,i,r);break;case"left":t[1].shiftLeft(e,i,r)}this._tokens[t[0]][0]=t[1].A1}})),this._ranges&&this._ranges.forEach((t=>{if(n||null==t[2]||t[2]==s){switch(o){case"up":t[1].shiftUp(e,i,r);break;case"right":t[1].shiftRight(e,i,r);break;case"down":t[1].shiftDown(e,i,r);break;case"left":t[1].shiftLeft(e,i,r)}this._tokens[t[0]][0]=t[1].A1}})),this}hasSheetReference(t){for(const e of this._cells)if(e[2]==t)return!0;for(const e of this._ranges)if(e[2]==t)return!0;for(const e of this._variables)if(e[2]==t)return!0;return!1}renameSheet(t,e){let i=!1;return this._tokens.forEach((o=>{o[1]==sv.Sheet&&o[0]==t&&(o[0]=e,i=!0)})),i}}function Av(t,e){return e&&(t=ur(this.cell.model.options.locale,vr(e,"d"),!1)(t)),null==t?"":t.toString()}function Ov(t,e){return(t=null==t?"":t.toString()).substring(0,e)}function $v(t,e){return(t=null==t?"":t.toString()).substring(Math.max(0,t.length-e),t.length)}function Dv(t,e,i){return(t=null==t?"":t.toString()).substring(e,e+i)}function Nv(...t){let e="";return Cv(t,(t=>e+=null==t?"":t.toString())),e}function Pv(...t){return Nv(...t)}function jv(t){return(t=null==t?"":t.toString()).length}function Hv(t){return(t=null==t?"":t.toString()).toLowerCase()}function Fv(t){return(t=null==t?"":t.toString()).toUpperCase()}function Bv(t){return t instanceof Date?t:Q(t)?Yo(t,Eo()):rr(t)}function Wv(t){return tt(t)?t:or(t instanceof Date?t:Yo(t,Eo()))}function Vv(t){return Q(t)?Wv(t):t}function Uv(t,e){const i=Bv(t).getDay();switch(e){case 2:return i;case 3:return i-1;default:return i%7+1}}function Gv(t,e,i){return sr(Wv(xv(t)),e)}function qv(){return or(ne(new Date))}function Yv(t){return null==(t=xv(t))||""===t}function Zv(t,e,i){return or(new Date(t,e-1,i))}function Xv(t){return Bv(t).getFullYear()}function Qv(t){return Bv(t).getMonth()+1}function Kv(t){return Bv(t).getDate()}function Jv(t,e){const i=Bv(t);return i.setMonth(i.getMonth()+e+1),i.setDate(0),or(i)}function tb(t){return xi(Bv(t))}function eb(t){return Math.acos(t)}function ib(t){return Math.acosh(t)}function ob(t){return Math.PI/2-Math.atan(t)}function rb(t){return.5*Math.log((t+1)/(t-1))}function sb(t){return Math.asin(t)}function nb(t){return Math.asinh(t)}function ab(t){return Math.atan(t)}function lb(t){return Math.atanh(t)}function cb(t){return Math.cos(t)}function hb(t){return Math.cosh(t)}function db(t){return 1/Math.tan(t)}function ub(t){return 1/Math.tanh(t)}function pb(t){return 1/Math.sin(t)}function gb(t){return 1/Math.sinh(t)}function mb(t){return 180*t/Math.PI}function fb(){return Math.PI}function vb(t){return 1/Math.cos(t)}function bb(t){return 1/Math.cosh(t)}function yb(t){return Math.sin(t)}function wb(t){return Math.sinh(t)}function xb(t){return Math.tan(t)}function kb(t){return Math.tanh(t)}function Cb(t){return Math.abs(t)}function Mb(t){if(t<0)throw new Error("#NUM");return Math.ceil(t)}function _b(t){return(t=Math.ceil(t))%2==0?t:t+1}function Sb(t){return Math.pow(Math.E,t)}function Eb(t){return t<0?-1:0==t?1:t*Eb(t-1)}function zb(t){return t<=0?1:t*zb(t-2)}function Ib(t){return Math.floor(t)}function Lb(t){return t%1!=0}function Rb(t){return!Lb(t)&&t%2==0}function Tb(t){return Lb(t)||t%2==1}function Ab(t){return Math.log(t)}function Ob(t,e){return Math.log(t)/Math.log(e)}function $b(t){return Math.log10(t)}function Db(t,e){return t%e}function Nb(t){return(t=Math.ceil(t))%2==0?t+1:t}function Pb(t,e){return Math.pow(t,e)}function jb(...t){let e=1;return Cv(t,(t=>e*=t||1)),e}function Hb(t,e){return Math.floor(t/e)}function Fb(t){return t*Math.PI/180}function Bb(){return Math.random()}function Wb(t,e){const i=Array(t).fill(null).map((()=>Array(e)));for(let o=0;o<t;o++)for(let t=0;t<e;t++)i[o][t]=Math.random();return i}function Vb(t,e){return t=Math.ceil(t),e=Math.floor(e),Math.floor(Math.random()*(e-t+1))+t}function Ub(t,e){return t.toFixed(e)}function Gb(t,e){return e=e||0,Math.floor(t*Math.pow(10,e))/Math.pow(10,e)}function qb(t,e){return e=e||0,Math.ceil(t*Math.pow(10,e))/Math.pow(10,e)}function Yb(t,e,i=1,o=1){const r=Array(t).fill(null).map((()=>Array(e)));let s=i;for(let i=0;i<t;i++)for(let t=0;t<e;t++)r[i][t]=s,s+=o;return r}function Zb(t){return t<0?-1:t>0?1:0}function Xb(t){return Math.sqrt(t)}function Qb(t){return Math.sqrt(Math.PI*t)}function Kb(...t){let e=0;return Cv(t,(t=>e+=null==t?0:1)),e}function Jb(...t){let e=0;return Cv(t,(t=>e+=null==t?1:0)),e}function ty(t,e){let i=0;return Cv(t,(t=>i+=Kf(e,t)?1:0)),i}function ey(...t){let e=0;const i=new Map;return Cv(t,(t=>{i.has(t)||(i.set(t,t),++e)})),e}function iy(...t){let e=0;return Cv(t,(t=>e+=isNaN(t)||null==t||""===t?0:t)),e}function oy(t,e,i){let o=0;if(i){const r=kv(i);Cv(t,((t,i,s)=>o+=Kf(e,t)&&r[i]&&r[i][s]&&!isNaN(r[i][s])?r[i][s]:0))}else Cv(t,(t=>o+=Kf(e,t)&&!isNaN(t)?t:0));return o}function ry(t,e){let i=0;return Cv(t,(t=>i+=Kf(e,t)&&!isNaN(t)?t*t:0)),i}function sy(...t){let e=0;const i=t.shift();if(0===t.length)Cv(i,(t=>e+=isNaN(t)?0:t));else{const o=kv(t[0]);Cv(i,((t,i,r)=>e+=o[i]&&o[i][r]&&!isNaN(t)&&!isNaN(o[i][r])?t*o[i][r]:0))}return e}function ny(t,e){return t=null==t?"":t.toString(),e?e=>e==t:(t=t.toLowerCase(),e=>(e??"").toString().toLowerCase()==t)}function ay(t,e,i=1){const o=new gv(Math.max((e||0)-1,0),Math.max((t||0)-1,0));return 1!=i&&2!=i||(o.r1Anchor=!0),1!=i&&3!=i||(o.c1Anchor=!0),o.A1}function ly(t,e,i,o=!1){let r,s;const n=ny(t,o);for(r=0;r<e.length;r++)for(s=0;s<e[r].length;s++)if(n(e[r][s]))return e[r][i-1];return null}function cy(t,e,i,o=!1){let r,s;const n=ny(t,o);for(r=0;r<e.length;r++)for(s=0;s<e[r].length;s++)if(n(e[r][s]))return e[i-1][s];return null}function hy(t,e,i){let o,r;t:for(o=0;o<e.length;o++)for(r=0;r<e[o].length;r++)if(e[o][r]==t)break t;return i?i[o]?i[o][r]:null:e[o][e[o].length-1]}function dy(t,...e){let i=null,o=0;return Cv(e,(e=>{if(t==++o)return i=e,!1})),i}function uy(t){return(t?gv.fromA1(t).c1:this.cell.c)+1}function py(t){return(t?gv.fromA1(t).r1:this.cell.r)+1}function gy(t){return Array.isArray(t)?t[0]?.length:1}function my(t){return Array.isArray(t)?t.length:1}function fy(){const t=wv(this)[0];return t&&t.hasFormula?" "+Ev(t.formula):""}function vy(t,e,i){return e=e||1,i=i||1,Array.isArray(t)?t[e-1]?t[e-1][i-1]:null:1==e&&1==i?t:null}function by(t){const e=this.cell,i=e.model,o=i.getCellByA1(t);let r;return i.calculations.dependencies.cellDependencies.has(e.address)?r=i.calculations.dependencies.cellDependencies.get(e.address):(r=new Map,i.calculations.dependencies.cellDependencies.set(e.address,r)),r.set(o.address,[o.range]),i.calculations.dependencies.cellDependants.has(o.address)?r=i.calculations.dependencies.cellDependants.get(o.address):(r=new Map,i.calculations.dependencies.cellDependants.set(o.address,r)),r.set(e.address,[e.range]),o.value}function yy(t,e,i=0){let o,r;for(o=0;o<e.length;o++)for(r=0;r<e[o].length;r++){if(0==i&&e[o][r]==t)return Math.max(o+1,r+1);if(1==i&&e[o][r]>t)return Math.max(o+1,r+1);if(-1==i&&e[o][r]<t)return Math.max(o+1,r+1)}return null}function wy(t,e,i,o,r){const s=wv(this)[0],n=[];o=o||1,r=r||1;for(let t=0;t<o;t++){const o=[];for(let n=0;n<r;n++){const r=s.model.rows[s.r+t+e].cell(s.c+n+i);o.push(r?s.value:null)}n.push(o)}return n}function xy(t,e){const i=[];if(t.length==e.length)for(let o=0;o<t.length;o++){let r=!0;for(let t=0;t<e[o].length;t++)if(!e[o][t]){r=!1;break}r&&i.push(t[o])}return i}const ky=[[3.1611237438705655,113.86415415105016,377.485237685302,3209.3775891384694,.18577770618460315],[.5641884969886701,8.883149794388377,66.11919063714163,298.6351381974001,881.952221241769,1712.0476126340707,2051.0783778260716,1230.3393547979972,2.1531153547440383e-8],[.30532663496123236,.36034489994980445,.12578172611122926,.016083785148742275,.0006587491615298378,.016315387137302097]],Cy=[[23.601290952344122,244.02463793444417,1282.6165260773723,2844.236833439171],[15.744926110709835,117.6939508913125,537.1811018620099,1621.3895745666903,3290.7992357334597,4362.619090143247,3439.3676741437216,1230.3393548037495],[2.568520192289822,1.8729528499234604,.5279051029514285,.06051834131244132,.0023352049762686918]];function My(t){const e=t*t;let i,o=ky[0][4]*e,r=e;for(i=0;i<3;i+=1)o=(o+ky[0][i])*e,r=(r+Cy[0][i])*e;return t*(o+ky[0][3])/(r+Cy[0][3])}function _y(...t){let e=!0;return Cv(t,(t=>{if(!t)return e=!1})),e}function Sy(...t){let e=!1;return Cv(t,(t=>{if(t)return e=!0})),e}function Ey(...t){let e=null;return Cv(t,(t=>{e=null===e?!!t:!!t!=e})),e}function zy(...t){const e=t[0];for(let i=1;i<t.length;i+=2){if(i==t.length-1)return t[i];if(e==t[i])return t[i+1]}return null}function Iy(t,e,i){return t?e:i}function Ly(t){return!t}function Ry(){return!1}function Ty(){return!0}function Ay(t,e){return e=""===e?null:e,this.cell.hasError?(this.cell.error.handled=!0,e):t===1/0||t===-1/0||Number.isNaN(t)?e:t}var Oy=i(235),$y=i.n(Oy),Dy=i(5949),Ny=i.n(Dy);function Py(...t){let e=0,i=0;return Cv(t,(t=>{null==t||isNaN(t)||(e+=t||0,++i)})),e/i}function jy(t,e){const i=Ny()(),o=kv(t),r=kv(e);for(let t=0;t<o.length;t++)for(let e=0;e<o[t].length;e++)i(o[t][e],(r[t]?r[t][e]:1)??1);return i()}function Hy(...t){const e=function(t){const e=[];return Cv(t,(t=>e.push(t))),e}(t),i=$y()(e.length,e,1);return e.reduce(((t,e)=>t+Math.abs(e-i)),0)/e.length}function Fy(...t){let e=1/0;return Cv(t,(t=>e=Math.min(e,t))),e}function By(...t){let e=-1/0;return Cv(t,(t=>e=Math.max(e,t))),e}function Wy(t,e){Object.keys(e).forEach((i=>t.set(nt(i,"_").replace(/_/g,".").toUpperCase(),e[i])))}const Vy=new Map;Wy(Vy,_),Wy(Vy,S),Wy(Vy,E),Wy(Vy,z),Wy(Vy,L),Wy(Vy,I),Wy(Vy,R);class Uy{constructor(t){this.model=t,this.getModel=t=>{const e=t?this.model.getConnectedModel(t):this.model;if(e)return e;throw new Error(`Sheet "${t}" not found`)},this.cl=(t,e)=>{const i=this.getModel(e);if(null==t)return this.currentCell.value;const o=i.getCellByA1(t);return o?o.value:(this.currentCell.error={message:`undefined cell ${t}`},null)},this.rn=(t,e)=>this.getModel(e).getValuesInRange(gv.fromA1(t)),this.nv=(t,e)=>this.getModel(e).getCellByName(t,this.currentCell.range).value,this.nr=(t,e)=>{const i=this.getModel(e).getValueMatrixByName(t);return 1===i.length&&1===i[0].length?i[0][0]:i},this.fn=t=>{const e=Vy.get(t);if(e)return e;throw new Error(`Function "${t}" not found`)},this.op=(t,e,i)=>rv(t,e,i)}}function Gy(t,e){const i=Array(e).fill(null);let o=0,r=[];if(t.length>1){r=t.map((t=>parseFloat(t.value)||0)),o=r[1]-r[0];for(let t=2;t<r.length;t++)if(r[t]-r[t-1]!==o){o=0;break}}if(0==o)for(let o=0;o<e;o++)i[o]=t[o%t.length]?.value;else{let t=r[r.length-1];for(let r=0;r<e;r++)t=i[r]=t+o}return i}function qy(t,e,i){const o=new Tv(t.formula,t.model.calculations.tokenizer),r=[];for(let t=0;t<i;t++)r.push(Ev(o.shift({index:0,offset:1,direction:e,allSheets:!0}).createFormulaString()));return r}function Yy(t,e,i,o){const r=t.getCellMatrix(e);let s;"right"==o?s=qr(r):"down"==o?s=Gr(r):"left"==o?s=Vr(r):"up"==o&&(s=Vr(Gr(r)));const n=new Array(i.size.rows);for(let t=0;t<i.size.rows;t++){n[t]=new Array(i.size.columns);for(let e=0;e<i.size.columns;e++){const i=r.length>t?r[t][r[t].length>e?e:0]:r[0][e];n[t][e]=i.hasDisplayValue?i.displayValue:null}}const a=i.size["down"==o||"up"==o?"rows":"columns"];let l=s.map((t=>t[t.length-1].hasFormula?qy(t[t.length-1],o,a):Gy(t,a)));return"down"==o?l=Gr(l):"left"==o?l=Vr(l):"up"==o&&(l=Ur(Gr(l))),t.spillValues({cell:t.getCellByRange(i.bounds[0][0]),values:l,propertyCell:t.getCellByRange(e.bounds[0][0]),displayValues:n})}function Zy(t){return t.pattern&&"string"==typeof t.pattern&&(t.pattern=new RegExp(t.pattern)),t}function Xy(t,e){const i=t.validation;if(!i)return!0;if(i.allowInvalid)return!0;let o=!0;return i.pattern&&(i.pattern.test((e??"").toString())||(o=!1)),i.validate&&(i.validate(t,e)||(o=!1)),o}class Qy{get address(){return null}get renderer(){return this._renderer}set renderer(t){this._renderer=t}get afterRenderer(){return this._afterRenderer}set afterRenderer(t){this._afterRenderer=t}get commentRenderer(){return this._commentRenderer}set commentRenderer(t){this._commentRenderer=t}get type(){return this._type}set type(t){this._type=t}get name(){return this._name}set name(t){this._name=t}get style(){return this._style}set style(t){this._style=t}get commentable(){return this._commentable}set commentable(t){this._commentable=t}get clickable(){return this._clickable}set clickable(t){this._clickable=t}get editable(){return this._editable}set editable(t){this._editable=t}get validation(){return this._validation}set validation(t){this._validation=t}get hasFormula(){return!!this._formula}get formula(){return this._formula}set formula(t){this._formula=t?t.replace(/^=/,""):null}get value2(){return this.hasFormula?Ev(this.formula):null}get editorContent(){return this._editorContent}set editorContent(t){this._editorContent=t}get adapter(){return this._adapter}set adapter(t){this._adapter=t}get properties(){return this._properties}set properties(t){this._properties=t}getProperty(t){return this._properties?.[t]}setProperty(t,e){this._properties||(this._properties={}),this._properties[t]=e}get format(){return this._format}set format(t){this._format=t,this._valueFormatter=null}get valueFormatter(){return this._valueFormatter}constructor(t,e){this.model=t,this._type=null,this._clickable=!1,e&&this.populate(e)}populate(t){this._renderer=t.renderer,this._afterRenderer=t.afterRenderer,this._commentRenderer=t.commentRenderer,this._name=t.name,this._type=t.t,this._editorContent=t.content,this._adapter=t.adapter,this._format=t.z,this._formula=t.f,this._editable=t.e,this._commentable=t.commentable,this._clickable=t.clickable,this._validation=t.validation?Zy(t.validation):null,this._properties=t.props,this._style=null==t.s?null:this.model.styles.add(t.s)?.id}update(t){const e={};if("renderer"in t&&(e.renderer=this._renderer,this._renderer=t.renderer),"afterRenderer"in t&&(this._afterRenderer=t.afterRenderer),"commentRenderer"in t&&(this._commentRenderer=t.commentRenderer),"name"in t&&(e.name=this._name,this._name=t.name),"t"in t&&(e.t=this._type,this._type=t.t),"content"in t&&(e.content=this._editorContent,this._editorContent=t.content),"adapter"in t&&(e.adapter=this._adapter,this._adapter=t.adapter),"z"in t&&(e.z=this._format,this._format=t.z),"f"in t&&(e.f=this._formula,this._formula=t.f),"e"in t&&(e.e=this._editable,this._editable=t.e),"commentable"in t&&(e.commentable=this._commentable,this._commentable=t.commentable),"clickable"in t&&(e.clickable=this._clickable,this._clickable=t.clickable),"validation"in t&&(e.validation=this._validation,this._validation=Zy(t.validation)),"props"in t&&(e.props=this._properties,this._properties=t.props),"s"in t){const i=this.model.styles.add(t.s).id;this._style!==i&&(e.s=this._style,this._style=i)}return e}getSourceData(){const t={};return null!=this._type&&(t.t=this._type),null!=this._format&&(t.z=this._format),null!=this._formula&&(t.f=this._formula),null!=this._editable&&(t.e=this._editable),null!=this._commentable&&(t.commentable=this._commentable),null!=this._clickable&&(t.clickable=this._clickable),this._properties&&(t.props=rt(this._properties)),null!=this._editorContent&&(t.content=Z(this._editorContent)?rt(this._editorContent):this._editorContent),null!=this._style&&(t.s=this._style),null!=this._name&&(t.name=this._name),t}setStyleProperties(t,e=!1){this.style=e?this.model.styles.set(this.style,t).id:this.model.styles.duplicate(this.style,t).id}removeStyleProperties(t){null!==this.style&&this.model.styles.unset(this.style,t)}get composedStyle(){return this.model.styles.get(this.style)}}function Ky(t){const e={};return t.split(";").forEach((t=>{const[i,o]=t.split(":");e[i]=o.trim()})),e}const Jy=new Map([["thin",{width:1.5,style:"solid"}],["medium",{width:2,style:"solid"}],["thick",{width:3,style:"solid"}],["double",{width:3,style:"double"}],["dotted",{width:1.5,style:"dotted"}],["hair",{width:1,style:"solid"}],["dashed",{width:1.5,style:"dashed"}],["mediumDashed",{width:2,style:"dashed"}],["dashDot",{width:1.5,style:"dashed"}],["mediumDashDot",{width:2,style:"dashed"}],["dashDotDot",{width:1.5,style:"dotted"}],["mediumDashDotDot",{width:2,style:"dotted"}],["slantDashDot",{width:1.5,style:"dashed"}],["none",{width:1.5,style:"solid"}]]),tw=(()=>{const t=new Map;return Jy.forEach(((e,i)=>{let o=t.get(e.style);o||(o=t.set(e.style,new Map).get(e.style)),o.set(e.width,i)})),t})();function ew(t){return"middle"==t?"center":t}function iw(t){return 3==(t="#"==t.charAt(0)?t.substring(1):t).length?t[0]+t[0]+t[1]+t[1]+t[2]+t[2]:t}const ow=t=>{if("none"==t)return null;const e=t.split(" "),i=parseInt(e[0].charAt(0))||1,o=e.length>1?e[1]:"solid",r=tw.get(o);return{style:(r?r.get(i):null)??"thin",color:e.length>2?iw(e[2]):"CCCCCC"}},rw=t=>{const e=Jy.get(t.style||"none");return e?[Dt(e.width),e.style,"none"==t.style?"var(--og-cell-background)":t.color?`#${t.color}`:"var(--og-border-color)"].join(" "):"none"},sw=(t,e)=>{const i="#"+(e.fgColor||"000000"),o="#"+(e.bgColor||"FFFFFF");switch(e.patternType){case"solid":t.backgroundColor=i||o;break;case"darkGray":t.backgroundColor=$r(o,.75);break;case"mediumGray":t.backgroundColor=$r(o,.5);break;case"lightGray":t.backgroundColor=$r(o,.25);break;case"gray125":t.backgroundColor=$r(o,.125);break;case"gray0625":t.backgroundColor=$r(o,.0625);break;case"darkHorizontal":t.backgroundImage=`linear-gradient(0deg, ${i} 33.33%, ${o} 33.33%, ${o} 50%, ${i} 50%, ${i} 83.33%, ${o} 83.33%, ${o} 100%)`,t.backgroundSize="6px 6px";break;case"darkVertical":t.backgroundImage=`linear-gradient(90deg, ${i} 33.33%, ${o} 33.33%, ${o} 50%, ${i} 50%, ${i} 83.33%, ${o} 83.33%, ${o} 100%)`,t.backgroundSize="6px 6px";break;case"darkDown":t.backgroundImage=`linear-gradient(45deg, ${i} 33.33%, ${o} 33.33%, ${o} 50%, ${i} 50%, ${i} 83.33%, ${o} 83.33%, ${o} 100%)`,t.backgroundSize="6px 6px";break;case"darkUp":t.backgroundImage=`linear-gradient(-45deg, ${i} 33.33%, ${o} 33.33%, ${o} 50%, ${i} 50%, ${i} 83.33%, ${o} 83.33%, ${o} 100%)`,t.backgroundSize="6px 6px";break;case"lightHorizontal":t.backgroundImage=`linear-gradient(0deg, ${o} 25%, ${i} 25%, ${i} 50%, ${o} 50%, ${o} 75%, ${i} 75%, ${i} 100%)`,t.backgroundSize="4px 4px";break;case"lightVertical":t.backgroundImage=`linear-gradient(90deg, ${o} 25%, ${i} 25%, ${i} 50%, ${o} 50%, ${o} 75%, ${i} 75%, ${i} 100%)`,t.backgroundSize="4px 4px";break;case"lightDown":t.backgroundImage=`linear-gradient(45deg, ${o} 25%, ${i} 25%, ${i} 50%, ${o} 50%, ${o} 75%, ${i} 75%, ${i} 100%)`,t.backgroundSize="4px 4px";break;case"lightUp":t.backgroundImage=`linear-gradient(-45deg, ${o} 25%, ${i} 25%, ${i} 50%, ${o} 50%, ${o} 75%, ${i} 75%, ${i} 100%)`,t.backgroundSize="4px 4px";break;case"darkGrid":t.backgroundImage=`linear-gradient(${o} 0.5px, transparent 0.5px), linear-gradient(90deg, ${o} 0.5px, transparent 0.5px)`,t.backgroundSize="2px 2px";break;case"lightGrid":t.backgroundImage=`linear-gradient(${o} 0.5px, transparent 0.5px), linear-gradient(90deg, ${o} 0.5px, transparent 0.5px)`,t.backgroundSize="1px 1px";break;case"darkTrellis":t.backgroundImage=`linear-gradient(45deg, ${o} 0.5px, transparent 0.5px), linear-gradient(90deg, ${o} 0.5px, transparent 0.5px)`,t.backgroundSize="2px 2px";break;case"lightTrellis":t.backgroundImage=`linear-gradient(45deg, ${o} 0.5px, transparent 0.5px), linear-gradient(90deg, ${o} 0.5px, transparent 0.5px)`,t.backgroundSize="1px 1px"}return t},nw=(t,e)=>(t.backgroundImage=`linear-gradient(${(e.angle??0)+90}deg,${e.stops.map((t=>`#${t.rgb} ${100*t.v}%`)).join(",")})`,t),aw=t=>{const e=t.cssStyle?{...t.cssStyle}:{};return null!=t.bold&&(e.fontWeight=t.bold?"bold":"normal"),t.italic&&(e.fontStyle="italic"),t.underline?e.textDecoration="underline":t.strike&&(e.textDecoration="line-through"),t.sz&&(e.fontSize=$t(t.sz)),t.color&&(e.color="#"+t.color),t.top&&(e.borderTop=rw(t.top)),t.right&&(e.borderRight=rw(t.right)),t.bottom&&(e.borderBottom=rw(t.bottom)),t.left&&(e.borderLeft=rw(t.left)),(t.top||t.right||t.bottom||t.left)&&(e.zIndex="1"),t.alignment&&t.alignment.vertical&&(e.display="flex",e.justifyContent=t.alignment.horizontal,e.alignItems="top"==t.alignment.vertical?"start":"bottom"==t.alignment.vertical?"end":"center"),t.alignment&&t.alignment.horizontal&&(e.textAlign=t.alignment.horizontal),t.alignment&&t.alignment.wrapText&&(e.display="flex",e.justifyContent=e.justifyContent??e.textAlign??"left",e.alignItems=e.alignItems??"center",e.whiteSpace="pre-wrap"),t.patternType?sw(e,t):t.stops&&t.stops.length?nw(e,t):t.fgColor?e.backgroundColor="#"+t.fgColor:t.bgColor&&(e.backgroundColor="#"+t.bgColor),e},lw=t=>{const e=Z(t)?t:Ky(t),i={};let o;for(const t in e){const r=e[t];if(null!=r)switch(t){case"borderTop":case"border-top":i.top=ow(r);break;case"borderTopColor":case"border-top-color":i.top?i.top.color=iw(r):i.top={style:"thin",color:iw(r)};break;case"borderRight":case"border-right":i.right=ow(r);break;case"borderRightColor":case"border-right-color":i.right?i.right.color=iw(r):i.right={style:"thin",color:iw(r)};break;case"borderBottom":case"border-bottom":i.bottom=ow(r);break;case"borderBottomColor":case"border-bottom-color":i.bottom?i.bottom.color=iw(r):i.bottom={style:"thin",color:iw(r)};break;case"borderLeft":case"border-left":i.left=ow(r);break;case"borderLeftColor":case"border-left-color":i.left?i.left.color=iw(r):i.left={style:"thin",color:iw(r)};break;case"border":o=ow(r),i.top=i.top||o,i.right=i.right||o,i.bottom=i.bottom||o,i.left=i.left||o;break;case"textAlign":case"text-align":i.alignment=i.alignment||{},i.alignment.horizontal=r;break;case"verticalAlign":case"vertical-align":i.alignment=i.alignment||{},i.alignment.vertical=ew(r);break;case"whiteSpace":case"white-space":i.alignment=i.alignment||{},i.alignment.wrapText=r&&"nowrap"!=r;break;case"color":i.color=iw(r);break;case"background":case"backgroundColor":i.fgColor=iw(r);break;case"fontSize":case"font-size":i.sz=parseFloat(r);break;case"fontWeight":case"font-weight":i.bold="bold"==r;break;case"fontStyle":case"font-style":i.italic="italic"==r;break;default:i[t]=r}}return i},cw={n:t=>{const e=Q(t)?parseFloat(t):t;return Number.isNaN(e)?t:e},t:t=>t,d:(t,e)=>{if(null==t||""===t)return null;if(Q(t))try{return K(t)?J(t):or(Yo(t,e.model.options.formatLocale))}catch(i){return e.model.logger.error(`Invalid date value in cell ${e.address}: ${t}`),null}return t instanceof Date?or(t):t},tm:t=>Q(t)?new Date(t):t,dt:t=>Q(t)?new Date(t):t,b:t=>!!t&&"0"!==t&&"false"!==t.toString().toLowerCase(),s:t=>t,m:t=>t,g:t=>{if(null==t||""===t)return null;const e=parseFloat(t);return isNaN(e)?t:e},a:t=>Q(t)&&""!==t?JSON.parse(t):t,h:t=>t},hw=new Map;class dw extends Qy{get tooltip(){return this._tooltip}set tooltip(t){this._tooltip=t}get hasTooltip(){return null!=this._tooltip}get merge(){return this.model.merges.mergedCells.get(this.address)}get row(){return this._row}set row(t){this._row=t}get r(){return this._row.index}get column(){return this._column}set column(t){this._column=t}get c(){return this._column.index}get hasValue(){return null!=this._value}get value(){return this._evaluated||this.evaluate(),this._value}set value(t){if(t&&Sv(t.toString()))this._value=void 0,this.formula=t;else{let e=cw[this.type](t,this);Xy(this,e)||(e=void 0),e!==this._value&&(this._value=e,this._displayValue=void 0),this.row.data&&this.column.data&&(this.row.data[this.column.data]=this._value)}}evaluate(){return this._value=cw[this.type](this.model.calculations.evaluate(this),this),this._evaluated=!0,this._value}get value2(){return this.hasFormula?Ev(this.formula):this.value}get hasDisplayValue(){return null!=this._displayValue}get displayValue(){return this._displayValue}set displayValue(t){this._displayValue=t}get prefersDisplayValue(){return["s","m"].includes(this.type)}get error(){return this._error}set error(t){this._error=t}get hasError(){return!!this._error}clearError(){this._error=void 0}get spillRange(){return this._spillRange}get prevSpillRange(){return this._prevSpillRange}set spillRange(t){!this._spillRange||t&&this._spillRange.equals(t)||(this._prevSpillRange=this._spillRange),this._spillRange=t}get isSpillSource(){return null!=this._spillRange}get spillSource(){return this._spillSource}get isSpilled(){return null!=this._spillSource}spillValue(t,e){this.value=t,this._spillSource=e}clearSpilledValue(){this._spillSource=void 0,this._value=void 0}get hasSparkline(){return null===this._sparkline?this._sparkline=this.model.sparklines.has(this.address):this._sparkline}get hasComment(){return null===this._hasComment?this._hasComment=(this.model.comments.get(this.address)??[]).length>0:this._hasComment}get comments(){return this.model.comments.get(this.address)}get valueFormatter(){const t=super.valueFormatter??this.row.valueFormatter??this.column.valueFormatter;if(t)return t;const e=this.type,i=this.format,{formatLocale:o,fixNumberFormat:r}=this.model.options,s=this.value;if(null==s||""===s)return null;if("n"==e)return null!=i?ur(o,i,r):this.model.options.numberFormatter;if("g"==e){if(null!=i)return ur(o,i,r);if(tt(s))return this.model.options.numberFormatter}else{if("t"==e)return null==i?null:ur(o,i,!1);if("d"==e)return i?Zo(o,i):this.model.options.dateFormatter;if("s"==e&&this.editorContent)return(t=>{if(t=t||null,!hw.has(t))if(t){const e=t.reduce(((t,e)=>t.set(e.k,e.v)),new Map);hw.set(t,(t=>e.has(t)?e.get(t):t))}else hw.set(t,(t=>t));return hw.get(t)})(this.editorContent)}return null}get formattedValue(){return null==this.value?"":this.hasDisplayValue?this.displayValue:this.valueFormatter?this.valueFormatter(this.value):this.value.toString()}get elm1(){return this.row.priority>=this.column.priority?this.row:this.column}get elm2(){return this.row.priority<this.column.priority?this.row:this.column}get clickable(){return super.clickable??this.elm1.clickable??this.elm2.clickable}get type(){return super.type??this.elm1.type??this.elm2.type??"g"}set type(t){this._type=t}get editorContent(){return super.editorContent??this.elm1.editorContent??this.elm2.editorContent??null}get adapter(){return super.adapter??this.elm1.adapter??this.elm2.adapter}set adapter(t){this._adapter=t}get address(){return this.column.address+this.row.address}get range(){return gv.fromA1(this.address)}get validation(){return super.validation??this.elm1.validation??this.elm2.validation??this.model.options.cellValidation}get editable(){return super.editable??this.elm1.editable??this.elm2.editable??this.model.options.editable}set editable(t){this._editable=t}get commentable(){return super.commentable??this.elm1.commentable??this.elm2.commentable??this.model.options.commentable}get renderer(){return super.renderer??this.elm1.renderer??this.elm2.renderer}get afterRenderer(){return super.afterRenderer??this.elm1.afterRenderer??this.elm2.afterRenderer??this.model.options.afterRenderer}get commentRenderer(){return super.commentRenderer??this.elm1.commentRenderer??this.elm2.commentRenderer??this.model.options.comments.renderer}get format(){return super.format??this.elm1.format??this.elm2.format}set format(t){super.format=t}get hyperlink(){return this._hyperlink}set hyperlink(t){this._hyperlink=t}get hasOwnFormula(){return!!this._formula}get hasFormula(){return null==this._hasFormula&&(this._hasFormula=!!this.formula),this._hasFormula}get formula(){return this._formula??this.elm1.formula??this.elm2.formula}set formula(t){super.formula=t,this.refreshFormula()}invalidateValue(){this.hasFormula?(this._value=void 0,this._evaluated=!1):this._evaluated=!0,this.clearError()}refreshFormula(){this.invalidateValue(),this._hasFormula=null}clearFormula(){this._formula=null,this._hasFormula=!1,this._evaluated=!0}constructor(t,e){super(t),this._evaluated=!0,this._sparkline=null,this._hasComment=null,this._hasStyle=null,this.row=t.rows[e.r],this.column=t.columns[e.c],this.populate(e)}populate(t){super.populate(t),this._tooltip=t.tooltip,this._hyperlink=t.hl,null!=t.f&&""!==t.f?this._evaluated=!1:null!=t.v&&(this.value=t.v),this._displayValue=t.dv}update(t){const e=super.update(t);return"tooltip"in t&&(e.tooltip=this._tooltip,this._tooltip=t.tooltip),"hl"in t&&(e.hl=this._hyperlink,this._hyperlink=t.hl),"f"in t?this._evaluated=!1:"v"in t&&(e.v=this.value,this.value=t.v),"dv"in t&&(e.dv=this._displayValue,this._displayValue=t.dv),e}getSourceData(t){const e=super.getSourceData();return this.merge&&(e.cs=this.merge.cs,e.rs=this.merge.rs),null!=this.value&&(e.v=this.value),this.hasTooltip&&(e.tooltip=this._tooltip),this._hyperlink&&(e.hl=this._hyperlink),t&&t.displayValue&&this.hasDisplayValue&&(e.dv=this._displayValue),e}createComposedStyle(t,e,i){const o=[];return t=t||this.column.style,e=e||this.row.style,null!=t&&null!=e?this.column.priority>this.row.priority?o.push(e,t):o.push(t,e):null!=t?o.push(t):null!=e&&o.push(e),null!=this.style&&o.push(this.style),null!=i&&o.push(i),o.length>0?this.model.styles.merge(...o):null}get composedStyle(){if(null===this._hasStyle){const t=this.createComposedStyle(null,null,this.model.conditionalFormats.evaluate(this));this._hasStyle=null!=t,this._composedStyle=t}return this._composedStyle}get calculatedIndent(){const t=this.composedStyle;return t?.alignment?.indent?t.alignment.indent:this.column.levelIndent&&this.row.level>0?this.row.level*this.model.options.levelIndentFactor:null}get cssStyle(){if(!1===this._hasStyle)return null;if(!this._cssStyle){const t=this.composedStyle;t&&(this._cssStyle=aw(t))}return this._cssStyle}invalidateStyle(){this._hasComment=null,this._hasStyle=null,this._composedStyle=null,this._cssStyle=null,this._sparkline=null}setStyleProperties(t){super.setStyleProperties(t),this.invalidateStyle()}removeStyleProperties(t){super.removeStyleProperties(t),this.invalidateStyle()}previewStyleProperties(t,e="cell"){const i=Object.assign({},this.createComposedStyle("column"==e?t:null,"row"==e?t:null)??{});if("cell"==e)for(const e in t)i[e]=t[e];this._hasStyle=!0,this._cssStyle=aw(i)}validate(){return!this.validation||Xy(this,this.value)}toString(){return this.address}}const uw={property:"value",enabled:!0};class pw extends(Lr(Qy)){get comparer(){return this._comparer}set comparer(t){this._comparer=t}get filter(){return this._filter??(this.model.options.filters?.enabled?uw:{enabled:!1})}set filter(t){this._filter=t}get hasFilter(){return this.filter.enabled}get sorting(){return this._sorting??this.model.options.columnSorting}set sorting(t){this._sorting=t}get width(){return this._width??this.model.options.columnWidth}set width(t){this._width=t}get levelIndent(){return this._levelIndent}set levelIndent(t){this._levelIndent=t}get levelButtons(){return this._levelButtons}set levelButtons(t){this._levelButtons=t}get priority(){return this._priority}set priority(t){this._priority=t}get address(){return vv(this.index)}get range(){return new gv(this.index,null,this.index,null)}get hasFormula(){return!!this._formula}get formula(){return this._formula}set formula(t){super.formula=t;const e=this.index;this.model.rows.forEach((t=>t.cells[e]?.refreshFormula()))}constructor(t,e){super(t,e),null==this._priority&&(this._priority=t.options.columnPriority)}get mergedHeaders(){return this._mergedHeaders??(this._mergedHeaders=this._header?.filter((t=>t.cs>1||t.rs>1))??[])}updateMergedHeaders(){this._mergedHeaders=null}set header(t){this._mergedHeaders=null,this._header=t}get header(){if(!this._header||this._header.length<this.model.headerCount){this._header=this._header??[];for(let t=this._header.length;t<this.model.headerCount;t++)this._header.push({r:t})}return this._header}convertSourceHeader(t){return Array.isArray(t)?t.map(((t,e)=>(null==(t=t??{r:e}).height&&(t.height=t.h),t.r=e,null==t.style&&(t.style=t.s),t._style=null==t.style?null:this.model.styles.add(t.style).id,t))):Q(t)?[{label:t,r:0}]:null}populate(t){super.populate(t),this._width=null==t.w||"auto"==t.w?null:t.w,this._levelIndent=t.levelIndent,this._levelButtons=t.levelButtons,this._header=this.convertSourceHeader(t.header),this._sorting=t.sorting,this._filter=Z(t.filter)?Object.assign({enabled:!0},t.filter):t.filter?uw:!1===t.filter?{enabled:!1}:null,this._comparer=t.comparer,this.data=t.data,this._mergedHeaders=null,null!=t.priority&&(this._priority=t.priority)}getSourceData(){const t=super.getSourceData();return null!=this._width&&(t.w=this._width),null!=this._levelIndent&&(t.levelIndent=this._levelIndent),null!=this._levelButtons&&(t.levelButtons=this._levelButtons),null!=this._header&&(t.header=this._header),null!=this._sorting&&(t.sorting=this._sorting),null!=this._filter&&(t.filter=this._filter),null!=this.data&&(t.data=this.data),t}expand(t){super.expand(t),this.model.indexVisibleColumns()}collapse(){super.collapse(),this.model.indexVisibleColumns()}get prev(){return this.model.columns[this.index-1]}get next(){return this.model.columns[this.index+1]}get prevVisible(){const t=this.model.visibleColumnIndex[this.index];return null==t||0===t?null:this.model.visibleColumns[t-1]}get nextVisible(){const t=this.model.visibleColumnIndex[this.index];return null==t?null:this.model.visibleColumns[t+1]}calculateRealColspan(t){let e=1,i=this.nextVisible;for(;i&&i.index-this.index<t&&e<t;)++e,i=i.nextVisible;return e}cell(t){return this.model.rows[t].cell(this.index)}clearCalculatedValues(){this.model.rows.forEach((t=>{const e=t.cells[this.index];e&&this.model.calculations.refreshFormula(e)}))}}var gw;!function(t){t[t.Asc=1]="Asc",t[t.Desc=-1]="Desc"}(gw||(gw={}));const mw={g:(t,e)=>t.value==e.value?0:t.value>e.value?1:-1,t:(t,e)=>(t.value||"").toString().localeCompare((e.value||"").toString()),s:(t,e)=>t.value==e.value?0:t.value>e.value?1:-1,m:(t,e)=>t.value==e.value?0:t.value>e.value?1:-1,n:(t,e)=>t.value-e.value,d:(t,e)=>(t.value instanceof Date?t.value.getTime():0)-(e.value instanceof Date?e.value.getTime():0),tm:(t,e)=>(t.value instanceof Date?t.value.getTime():0)-(e.value instanceof Date?e.value.getTime():0),dt:(t,e)=>(t.value instanceof Date?t.value.getTime():0)-(e.value instanceof Date?e.value.getTime():0),b:(t,e)=>t.value-e.value,h:(t,e)=>(t.value||"").localeCompare(e.value),a:()=>0},fw={g:(t,e)=>e.value==t.value?0:e.value>t.value?1:-1,t:(t,e)=>(e.value||"").toString().localeCompare((t.value||"").toString()),s:(t,e)=>e.value==t.value?0:e.value>t.value?1:-1,m:(t,e)=>e.value==t.value?0:e.value>t.value?1:-1,n:(t,e)=>e.value-t.value,d:(t,e)=>(e.value instanceof Date?e.value.getTime():0)-(t.value instanceof Date?t.value.getTime():0),tm:(t,e)=>(e.value instanceof Date?e.value.getTime():0)-(t.value instanceof Date?t.value.getTime():0),dt:(t,e)=>(e.value instanceof Date?e.value.getTime():0)-(t.value instanceof Date?t.value.getTime():0),b:(t,e)=>e.value-t.value,h:(t,e)=>(e.value||"").localeCompare(t.value),a:()=>0},vw=(t,e)=>t.origIndex-e.origIndex;class bw{get settings(){return this._settings}set settings(t){this._settings=t,this.colMap.clear(),this.settings.length>0&&(this.settings.forEach(((t,e)=>this.colMap.set(t.c,e))),this.applySort(),Er().info(`sorting applied: ${JSON.stringify(this.settings)}`))}constructor(t,e=[]){this.model=t,this.colMap=new Map,this._settings=[],this.settings=e}get(t){return this.colMap.has(t)?this.settings[this.colMap.get(t)]:null}sort(t,e=null,i=!1){let o=this.get(t);return o&&o.ord==gw.Desc&&null===e?(this.settings.splice(this.colMap.get(t),1),o=null):o?(o.ord=gw.Desc,this.settings.splice(this.colMap.get(t),1)):o={c:t,ord:gw.Asc},o&&(null!==e&&(o.ord=e),this.colMap.set(t,0),this.settings.unshift(o)),this.settings.length>this.model.options.maxSortingColumns&&this.settings.pop(),this.colMap.clear(),this.settings.forEach(((t,e)=>{t.index=e,this.colMap.set(t.c,e)})),i||(this.settings.length>0?this.applySort():this.resetSort()),o}applySort(){const t=this.model,e=this.settings.map((e=>{const i=t.columns[e.c];return i?i.comparer?e.ord==gw.Asc?i.comparer:(t,e)=>-i.comparer(t,e):e.ord==gw.Asc?mw[i.type??"t"]:fw[i.type??"t"]:(Er().warn(`Column sorting: Column with index ${e.c} not found`),null)})).filter((t=>t)),i=e.length;let o,r,s;t.rowRoot.sort(((t,n)=>{if(!1===t.sortable||!1===n.sortable)return t.origIndex-n.origIndex;for(r=0;r<i;r++)if(s=this.settings[r].c,o=e[r](t.cell(s),n.cell(s)),0!=o)return o;return 0})),t.indexRowsByTree()}resetSort(){this.settings=[],this.colMap.clear(),this.model.rowRoot.sort(vw),this.model.indexRowsByTree()}persistSort(){this.model.rows.forEach(((t,e)=>t.origIndex=e))}}class yw{get properties(){return this._properties}set properties(t){this._properties=t}constructor(t){t&&this.pupulate(t)}pupulate(t){this.author=t.author,this.text=t.text,this.date=t.date?new Date(t.date):null,this.data=t.data,this.readOnly=!!t.readOnly,this._properties=t.props}getSourceData(){const t={};return this._properties&&(t.props=this._properties),this.author&&(t.author=this.author),this.text&&(t.text=this.text),this.data&&(t.data=this.data),null!==this.readOnly&&(t.readOnly=this.readOnly),this.date&&(t.date=Zo("en-US")(this.date,"yyyy-MM-dd HH:mm:ss")),t}}class ww{constructor(t,e){this.model=t,this._commentMap=new Map,this.has=t=>this._commentMap.has(t),this.delete=t=>this._commentMap.delete(t),this.cleanCell=t=>{this.has(t)&&this._commentMap.set(t,this.get(t).filter((t=>(t.text??"").length>0||null!=t.data)))},this.get=t=>(this.has(t)||this._commentMap.set(t,[]),this._commentMap.get(t)),this.set=(t,e)=>{this._commentMap.set(t,e?.map((t=>t instanceof yw?t:new yw(t)))||[]),this.cleanCell(t)},e&&this.populate(e)}populate(t){t.forEach((t=>{const e=t.a1||new gv(t.c,t.r).A1;this._commentMap.has(e)||this._commentMap.set(e,[]),this._commentMap.get(e).push(new yw(t))})),this._commentMap.forEach((t=>{t.sort(((t,e)=>(e.date?e.date.getTime():0)-(t.date?t.date.getTime():0)))}))}shift(t){Array.from(this._commentMap.keys()).forEach((e=>{const i=gv.fromA1(e);i.shift(t),i.A1!=e&&(this._commentMap.set(i.A1,this._commentMap.get(e)),this._commentMap.delete(e))}))}}function xw(t,e,i){t.forEach((t=>t.forEach((t=>{t[1]==e&&(t[1]=i)}))))}class kw{get cellDependencies(){return this._cellDependencies}get cellDependants(){return this._cellDependants}get rangeDependencies(){return this._rangeDependencies}get rangeDependants(){return this._rangeDependants}get sheetDependencies(){return this._sheetDependencies}get sheetDependants(){return this._sheetDependants}constructor(t,e="calculations"){this.model=t,this.modelPart=e,this._cellDependencies=new Map,this._cellDependants=new Map,this._rangeDependencies=new Map,this._rangeDependants=new Map,this._sheetDependencies=new Map,this._sheetDependants=new Map}clear(){this._cellDependants.clear(),this._cellDependencies.clear(),this._rangeDependencies.clear(),this._rangeDependants.clear()}clearCellDependecies(t){return this._cellDependencies.has(t)&&this._cellDependencies.delete(t),this._rangeDependencies.has(t)&&this._rangeDependants.delete(t),this}has(t){return this._cellDependencies.has(t)||this._rangeDependencies.has(t)}add(t,e,i){const o=gv.fromA1(t).removeAnchors(),r=gv.fromA1(e).removeAnchors();e=r.A1;const s=r.isRange,n=s?this._rangeDependencies:this._cellDependencies;let a=null;if((n.has(t)?n.get(t):n.set(t,new Map).get(t)).set(e,[r,i]),i){const t=this.model.getConnectedModel(i);t&&(t.calculations.dependencies.sheetDependants.set(this.model.name,this.model.name),this.sheetDependencies.set(i,i),a=s?t.calculations.dependencies.rangeDependants:t.calculations.dependencies.cellDependants),i=this.model.name}else a=s?this._rangeDependants:this._cellDependants;a&&(a.has(e)||a.set(e,new Map),a.get(e).set(t,[o,i]))}getDependants(t,e=null){let i,o;const r=t.A1;return e=e??new Map,this._cellDependants.has(r)&&this._cellDependants.get(r).forEach((([t,s])=>{e.has(t)||(s&&(o=this.model.getConnectedModel(s)),i=o||this.model,e.set(t,[i.getCellByRange(t),s]),o?o[this.modelPart].dependencies.getDependants(t).forEach(((t,i)=>{e.set(i,[t[0],t[1]??s])})):(t.A1!=r||o)&&i.calculations.dependencies.getDependants(t,e))})),this._rangeDependants.forEach(((i,o)=>{gv.fromA1(o).contains(t)&&i.forEach((([t,i])=>{e.has(t)||(e.delete(t),this.getDependants(t,e.set(t,[(i?this.model.getConnectedModel(i):this.model).getCellByRange(t),i])))}))})),e}renameSheet(t,e){this._sheetDependants.has(t)&&(this._sheetDependants.delete(t),this._sheetDependants.set(e,e)),this._sheetDependencies.has(t)&&(this._sheetDependencies.delete(t),this._sheetDependencies.set(e,e)),xw(this._cellDependants,t,e),xw(this._cellDependencies,t,e),xw(this._rangeDependants,t,e),xw(this._rangeDependencies,t,e)}}class Cw{get dependencies(){return this._dependencies}constructor(t,e){this.model=t,this._dependencies=new kw(t,e)}}function Mw(t){return t instanceof RangeError?"Maximum call stack size exceeded"==t.message?"infinite loop":t.message:t.toString()}class _w extends Cw{get tokenizer(){return this._tokenizer}get formulas(){return this._formulas}constructor(t){super(t,"calculations"),this._tokenizer=new dv,this._formulas=new Map,this.context=new Uy(t)}createFormula(t){const e=new Tv(t.formula,this.tokenizer);return this._formulas.set(t.address,e),t.hasOwnFormula&&(t.formula=e.createFormulaString()),this.createDependecies(t),e}createDependecies(t){const e=t.address;if(this.formulas.has(e)){const i=this.formulas.get(e);i.ranges.forEach((([t,i,o])=>this._dependencies.add(e,i.A1,o))),i.cells.forEach((([t,i,o])=>this._dependencies.add(e,i.A1,o))),i.variables.forEach((([i,o])=>{const r=this.model.getCellByName(o,t.range);r&&this._dependencies.add(e,r.address,null)}))}return this}refreshFormula(t){return t.refreshFormula(),this.formulas.delete(t.address),this.clearDependecies(t),this}updateDependencies(t){return this.clearDependecies(t).getFormula(t),this}getFormula(t){return this._formulas.has(t.address)?this._formulas.get(t.address):this.createFormula(t)}refresh(){this.dependencies.clear(),this._formulas.clear()}clearDependecies(t){const e=t.address;return this.dependencies.clearCellDependecies(e),this.formulas.delete(e),this}evaluateFormula(t,e){return this.context.currentCell=e,t.fn(this.context,{cell:e,formula:t})}evaluateExpression(t,e){this.context.currentCell=e;const i=new Tv(t,this.tokenizer);return i.fn(this.context,{cell:e,formula:i})}evaluate(t,e){if(!t)return null;let i=null;if(t.hasFormula){const o=this.getFormula(t);try{t.clearError(),this.context.currentCell=t,i=o.fn(this.context,{cell:t,formula:o}),Array.isArray(i)?(e||this.model.spillValues({cell:t,values:i}).range,i=i.length>0&&i[0].length>0?i[0][0]:null,e&&(t.value=i)):t.value=i}catch(e){t.error={message:Mw(e)}}}else i=t.value;return i}evaluateAll(){this.model.rows.forEach((t=>this.model.columns.forEach(((e,i)=>t.cell(i).evaluate()))))}calculateViewport(t){const e=[];return t.rows.forEach((t=>t.cells.forEach((t=>{if(t.hasFormula){if(!t.hasValue&&(this.evaluate(t),t.spillRange))for(const i of this.model.getRangeIterator(t.spillRange))e.push(i);e.push(t)}})))),e}shift(t){this.getFormulaCells().forEach((e=>{e.formula=this.getFormula(e).shift(t).createFormulaString(!1),this.updateDependencies(e)}));const e=this.model.name;return this.dependencies.sheetDependants.forEach((i=>{const o=this.model.getConnectedModel(i);o?.calculations.getFormulaCells().forEach((i=>{const r=o.calculations.getFormula(i);r.hasSheetReference(e)&&(i.formula=r.shift(t).createFormulaString(!1),o.calculations.updateDependencies(i))}))})),this}getFormulaCells(){const t=this.model,e=[];let i;const o=t.rows.length,r=t.columns.length;for(let s=0;s<o;s++){i=t.rows[s];for(let t=0;t<r;t++)i.hasCellFormula(t)&&e.push(i.cell(t))}return e}renameSheet(t,e){let i=!1;return this.dependencies.renameSheet(t,e),this.getFormulaCells().forEach((o=>{const r=this.getFormula(o);r.renameSheet(t,e)&&(o.formula=r.createFormulaString(),this.refreshFormula(o),i=!0)})),i}invalidateCellDependants(t){const e=[];return this.dependencies.getDependants(t.range).forEach((([t,i])=>{e.push([t,i]),t.invalidateValue()})),e}invalidateDependants(t){const e=new Map,i=new Map;for(const i of t)this.invalidateCellDependants(i).forEach((([t,i])=>e.set(t,i)));e.forEach(((t,e)=>i.set(e,t)));for(const i of t)e.set(i,null);return e.forEach(((t,e)=>{this.model.sparklines.dependencies.getDependants(e.range).forEach((([t,e])=>{i.set(t,e)})),this.model.conditionalFormats.dependencies.getDependants(e.range).forEach((([t,e])=>{this.model.conditionalFormats.invalidateExtremes(t),t.invalidateStyle(),i.set(t,e)}))})),i}}const Sw="#ff0000",Ew="#fcd53f",zw="#00bb5e",Iw="#555555",Lw=new Map([["3Arrows",[{icon:["fas","down"],color:Sw},{icon:["fas","right"],color:Ew},{icon:["fas","up"],color:zw}]],["3ArrowsGray",[{icon:["fas","down"],color:Iw},{icon:["fas","right"],color:Iw},{icon:["fas","up"],color:Iw}]],["3Flags",[{icon:["fas","flag-pennant"],color:Sw},{icon:["fas","flag-pennant"],color:Ew},{icon:["fas","flag-pennant"],color:zw}]],["3TrafficLights1",[{icon:["fas","circle"],color:Sw},{icon:["fas","circle"],color:Ew},{icon:["fas","circle"],color:zw}]],["3TrafficLights2",[{icon:["fas","square-o"],color:Sw},{icon:["fas","square-o"],color:Ew},{icon:["fas","square-o"],color:zw}]],["3Signs",[{icon:["fas","square"],rotation:45,color:Sw},{icon:["fas","triangle"],color:Ew},{icon:["fas","circle"],color:zw}]],["3Symbols",[{icon:["fas","circle-xmark"],color:Sw},{icon:["fas","circle-exclamation"],color:Ew},{icon:["fas","circle-check"],color:zw}]],["3Symbols2",[{icon:["fas","xmark"],color:Sw},{icon:["fas","exclamation"],color:Ew},{icon:["fas","check"],color:zw}]],["3Stars",[{icon:["fal","star"],color:Ew},{icon:["fas","star-half-stroke"],color:Ew},{icon:["fas","star"],color:Ew}]],["3Triangles",[{icon:"caret-down",color:Sw},{icon:"dash",color:Ew},{icon:"caret-up",color:zw}]],["4Arrows",[{icon:["fas","down"],color:Sw},{icon:["fas","down-right"],color:Ew},{icon:["fas","up-right"],color:Ew},{icon:["fas","up"],color:zw}]],["4ArrowsGray",[{icon:["fas","down"],color:Iw},{icon:["fas","down-right"],color:Iw},{icon:["fas","up-right"],color:Iw},{icon:["fas","up"],color:Iw}]],["4RedToBlack",[{icon:["fas","circle"],color:"#000000"},{icon:["fas","circle"],color:"#b1b1b1"},{icon:["fas","circle"],color:"#edb2a3"},{icon:["fas","circle"],color:Sw}]],["4Rating",[{icon:"signal-bars-weak",color:"#4a7db1"},{icon:"signal-bars-fair",color:"#4a7db1"},{icon:"signal-bars-good",color:"#4a7db1"},{icon:["fas","signal-bars"],color:"#4a7db1"}]],["4TrafficLights",[{icon:["fas","circle"],color:"#000000"},{icon:["fas","circle"],color:Sw},{icon:["fas","circle"],color:Ew},{icon:["fas","circle"],color:zw}]],["5Arrows",[{icon:["fas","down"],color:Sw},{icon:["fas","down-right"],color:Ew},{icon:["fas","right"],color:Ew},{icon:["fas","up-right"],color:Ew},{icon:["fas","up"],color:zw}]],["5ArrowsGray",[{icon:["fas","down"],color:Iw},{icon:["fas","down-right"],color:Iw},{icon:["fas","right"],color:Iw},{icon:["fas","up-right"],color:Iw},{icon:["fas","up"],color:Iw}]],["5Rating",[{icon:["fal","signal-bars"]},{icon:["fal","signal-bars-weak"],color:"#4a7db1"},{icon:["fal","signal-bars-fair"],color:"#4a7db1"},{icon:["fal","signal-bars-good"],color:"#4a7db1"},{icon:["fas","signal-bars"],color:"#4a7db1"}]],["5Quarters",[{icon:["fal","circle"],color:"#505050"},{icon:["fas","circle-quarter-stroke"],color:"#505050"},{icon:["fas","circle-half-stroke"],color:"#505050"},{icon:["fas","circle-three-quarters-stroke"],color:"#505050"},{icon:["fas","circle"],color:"#505050"}]]]),Rw=(t,e)=>{const i=Lw.get(t);return i?i[e]:null};class Tw extends Cw{constructor(t,e){super(t,"conditionalFormats"),this.formats=[],this.cellFormatMap=new Map,this.extremes=new Map,e&&this.populate(e)}populate(t){t.forEach((t=>{try{this.add(t)}catch(e){Er().error(`conditional format error: ${JSON.stringify(t)}`,e)}}))}refresh(){this.dependencies.clear(),this.cellFormatMap.clear(),this.extremes.clear(),this.formats.forEach((t=>this.initConditionalFormat(t)))}clearCellDependecies(t){const e=t.address;return this.dependencies.clearCellDependecies(e),this.cellFormatMap.get(e).forEach((t=>({cf:t.cf}))),this}getExtremes(t){if(this.extremes.has(t.key))return this.extremes.get(t.key);const e=[1/0,-1/0];return t.ranges.forEach((t=>{for(const i of this.model.getValuesInRange(t))for(const t of i)null!=t&&(isNaN(t)||(e[0]=Math.min(e[0],t),e[1]=Math.max(e[1],t)))})),t.cmin&&("num"==t.cmin.t?e[0]=t.cmin.v:"percent"==t.cmin.t&&(e[0]=e[0]+(e[1]-e[0])*t.cmin.v/100)),t.cmax&&("num"==t.cmax.t?e[1]=t.cmax.v:"percent"==t.cmax.t&&(e[1]=e[0]+(e[1]-e[0])*t.cmax.v/100)),this.extremes.set(t.key,e),e}invalidateExtremes(t){this.cellFormatMap.get(t.address).forEach((t=>this.extremes.delete(t.cf.key)))}evaluateScaleFormat(t,e){const i=t.value;if(null==i)return null;const[o,r]=this.getExtremes(e.cf);let s;const n=(i-o)/(r-o);if(e.cf.cmid?.color)s=.5==n?"#"+e.cf.cmid.color:n>.5?Pr("#"+e.cf.cmid.color,"#"+e.cf.cmax.color,2*(n-.5)):Pr("#"+e.cf.cmin.color,"#"+e.cf.cmid.color,2*n);else{if(!e.cf.cmin?.color||!e.cf.cmax?.color)return null;s=Pr("#"+e.cf.cmin.color,"#"+e.cf.cmax.color,n)}return{color:jr(s).substring(1),fgColor:s.substring(1)}}evaluateBarFormat(t,e){const i=t.value;if(null==i)return null;const o=this.getExtremes(e.cf);let r=o[0];const s=o[1],n=r<0;n||(r-=.1*(s-r));const a=Math.round(100*(i-r)/(s-r));e.initialized||(e.initialized=!0,e.cf.ranges.forEach((e=>this._dependencies.add(t.address,e.A1,null))));const l=[];if(n){const t=Math.round(-100*r/(s-r));i>=0?(l.push(`#00000000 ${t}%`),l.push(`#${e.cf.color} ${t}%`),l.push(`#${e.cf.color} ${a}%`),l.push(`#00000000 ${a}%`)):(l.push(`#00000000 ${a}%`),l.push(`#ff0000 ${a}%`),l.push(`#ff0000 ${t}%`),l.push(`#00000000 ${t}%`))}else l.push(`#${e.cf.color} ${a}%`),l.push(`#00000000 ${a}%`);return{cssStyle:{backgroundClip:"padding-box",backgroundImage:`linear-gradient(90deg, ${l.join(",")})`}}}evaluateFormulaFormat(t,e){if(!e.initialized&&e.cf.condition){e.initialized=!0;const i=t.address,o=new Tv(e.cf.condition,this.model.calculations.tokenizer);e.f=o.shift({index:0,offset:t.c-e.cf.firstCell.c1,direction:"right"}).shift({index:0,offset:t.r-e.cf.firstCell.r1,direction:"down"}),o.cells.forEach((t=>this._dependencies.add(i,t[1].A1,t[2]))),o.ranges.forEach((t=>this._dependencies.add(i,t[1].A1,t[2]))),o.variables.forEach((([e,o])=>{const r=this.model.getCellByName(o,t.range);r&&this._dependencies.add(i,r.address,null)}))}if(e.f&&!this.model.calculations.evaluateFormula(e.f,t))return null;const i={...e.cf.style};return i.color||Hr(jr(Fr(e.cf.style.fgColor))),i}evaluateIconFormat(t,e){const i=t.value;if(null==i)return null;const[o,r]=this.getExtremes(e.cf);let s;for(let t=e.cf.thresh.length-1;t>=0;t--){const n=e.cf.thresh[t];if("percent"===n.t){if(null==s&&(s=100*(i-o)/(r-o)),s>=n.v)return{icon:Rw(e.cf.v,t)}}else if("num"===n.t&&i>=n.v)return{icon:Rw(e.cf.v,t)}}return null}evaluate(t){const e=t.address,i=this.cellFormatMap.get(e);if(!i)return null;let o=null,r=null;for(const e of i){try{switch(e.cf.type){case"formula":r=this.evaluateFormulaFormat(t,e);break;case"scale":r=this.evaluateScaleFormat(t,e);break;case"bar":r=this.evaluateBarFormat(t,e);break;case"icon":r=this.evaluateIconFormat(t,e);break;default:r=null}}catch(t){Er().error(`Conditional format error: ${JSON.stringify(e)}`,t)}if(r&&(o=o?{...o,...r}:r,e.cf.stop))break}return o}initConditionalFormat(t){return t.firstCell=null,t.ranges.forEach((e=>{for(const i of new Bw(e.intersect(this.model.gridRange))){const e=i.A1;"formula"===t.type&&(t.firstCell||(t.firstCell=i,t.formula=t.condition?new Tv(t.condition,this.model.calculations.tokenizer):null)),(this.cellFormatMap.get(e)||this.cellFormatMap.set(e,[]).get(e)).push({cf:t})}})),t}add(t){const e={key:t.ranges,ranges:gv.fromA1s(t.ranges),type:t.type||"formula",firstCell:null,formula:null,style:t.style?this.model.styles.add(t.style):null,condition:t.condition,stop:!!t.stop,cmin:t.cmin,cmid:t.cmid,cmax:t.cmax,color:t.color,v:t.v,thresh:t.thresh};this.formats.push(this.initConditionalFormat(e))}getSourceData(){return this.formats.map((t=>({type:t.type,ranges:gv.toA1s(t.ranges),style:t.style,condition:t.condition,stop:t.stop,cmin:t.cmin,cmid:t.cmid,cmax:t.cmax,color:t.color,v:t.v,thresh:t.thresh})))}}const Aw=(t,e)=>{const i=new RegExp(`${ut(t)}`,"ig");return t=>(i.lastIndex=0,i.test(ct((t[e]??"").toString())))},Ow=(t,e)=>i=>!!i[e]===t,$w=(t,e)=>{const i=t.map((t=>t.key?.toString()));return t=>null!=t[e]&&i.includes(t[e].toString())},Dw=(t,e)=>t=>!1,Nw=(t,e,i)=>(i=i??"value","b"===t?Ow(e,i):"s"===t&&Array.isArray(e)?$w(e,"value"):"s"===t?Aw(e?.toString(),"formattedValue"):"m"===t&&Array.isArray(e)?Dw(e,i):Aw(e?.toString(),"d"===t?"formattedValue":i));class Pw extends Event{constructor(){super("filter",{bubbles:!1,cancelable:!0,composed:!0})}}class jw extends EventTarget{constructor(t){super(),this.model=t,this.settings=new Map,this.custom=!1}get(t){return this.settings.has(t)?this.settings.get(t):null}filter(t,e=!0){null===t.term||""===t.term?this.settings.delete(t.c):this.settings.set(t.c,t),this.custom||(this.settings.size>0?this.applyFilter(!1):this.resetFilter(!1)),e&&this.dispatchEvent(new Pw)}applyFilter(t=!0){const e=[];this.settings.forEach(((t,i)=>{const o=this.model.columns[i];e.push({c:i,matcher:Nw(o.type,t.term,o.filter?.property)})}));const i=e.length,o=this.model.options.filters?.includeParents??!0,r=this.model.options.filters?.includeChildren??!0,s=new Set;this.model.rows.forEach((t=>{const n=s.has(t.index);(t=>{if(!t.filterable)return!0;for(let o=0;o<i;o++)if(!e[o].matcher(t.cell(e[o].c)))return!1;return!0})(t)?(t.filterState=zr.Matched,o&&t.walkUp((t=>{if(s.has(t.index)&&t.filterState>0)return!1;t.filterState=zr.ChildMatched,s.add(t.index)})),r&&t.walk((t=>{if(s.has(t.index)&&t.filterState>0)return!1;t.filterState=zr.ParentMatched,s.add(t.index)}))):n||(t.filterState=zr.Filtered),s.add(t.index)})),this.model.indexRows(),t&&this.dispatchEvent(new Pw)}resetFilter(t=!0){this.settings.clear(),this.model.rows.forEach((t=>t.filterState=zr.Matched)),this.model.indexRows(),t&&this.dispatchEvent(new Pw)}}class Hw extends Cw{constructor(t,e){super(t,"sparklines"),this.model=t,this.map=new Map,this.groups=new Map,this.extremes=new Map,this.maxIndex=0,this.updateRangeMap=!1,this.populate(e)}populate(t){t?.forEach((t=>{try{this.add(gv.fromA1(t.location),Array.isArray(t.data)?t.data.map((t=>[gv.fromA1(t)])):t.data.split(",").map((t=>[gv.fromA1(t)])),ot({},qf.DEFAULT_SPARKLINE_OPTIONS,t.options))}catch(e){this.model.logger.error(`sparkline error: ${JSON.stringify(t)}`,e)}}))}getSourceData(){const t=[];return this.groups.forEach((e=>{t.push({location:e.locRange.A1,data:e.dataRanges.map((t=>t[0].A1)).join(","),options:{minValue:e.minValue,maxValue:e.maxValue,type:e.type,style:e.style,marker:e.marker}})})),t}has(t){return this.map.has(t)}get(t){return this.map.get(t)}createDependencies(t){this.map.get(t)[1].forEach((e=>this._dependencies.add(t,e[0].A1,e[1])))}updateRangeMaps(){this.dependencies.clear(),this.map.clear(),this.groups.forEach(((t,e)=>this.createRangeMap(e,t.locRange,t.dataRanges)))}getValues(t){this.updateRangeMap&&this.updateRangeMaps();const e=this.map.get(t),i=e[1][0][1]?this.model.getConnectedModel(e[1][0][1]):this.model;return this._dependencies.has(t)||this.createDependencies(t),e[1].flatMap((t=>i.getValuesInRange(t[0])[0]))}getExtremes(t){const e=this.map.get(t),i=e[1][0][1]?this.model.getConnectedModel(e[1][0][1]):this.model,o=this.groups.get(e[0]);let r,s,n,a;return null==o.minValue||Q(o.minValue)?"auto"==(o.minValue||"auto")?(r=r??lt(...e[1].map((t=>i.getValuesInRange(t[0])))),n=r[0]):(this.extremes.has(e[0])||this.extremes.set(e[0],lt(...o.dataRanges.map((t=>i.getValuesInRange(t[0]))))),s=this.extremes.get(e[0]),n=s[0]):n=o.minValue,null==o.maxValue||Q(o.maxValue)?"auto"==(o.maxValue||"auto")?(r=r??lt(...e[1].map((t=>i.getValuesInRange(t[0])))),a=r[1]):(this.extremes.has(e[0])||this.extremes.set(e[0],lt(...o.dataRanges.map((t=>i.getValuesInRange(t[0]))))),s=this.extremes.get(e[0]),a=s[1]):a=o.maxValue,[n,a]}createRangeMap(t,e,i){e=e.intersect(this.model.gridRange);const o=i[0][0].size,r=e.size;if(r.columns>1&&r.rows>1)return void this.model.logger?.error(`invalid sparkline location range: ${e.A1}`);let s=!1;if(s=1==r.columns&&1==r.rows?o.rows>1:r.columns>1,s)for(let o=e.c1;o<=e.c2;o++)this.map.set(new gv(o,e.r1).A1,[t,i.map((([t,i])=>[new gv(t.c1+o-e.c1,t.r1,t.c1+o-e.c1,t.r2),i]))]);else for(let o=e.r1;o<=e.r2;o++)this.map.set(new gv(e.c1,o).A1,[t,i.map((([t,i])=>[new gv(t.c1,t.r1+o-e.r1,t.c2,t.r1+o-e.r1),i]))])}add(t,e,i){const o=++this.maxIndex;t&&e&&this.createRangeMap(o,t,e),this.groups.set(o,Object.assign({dataRanges:e,locRange:t},JSON.parse(JSON.stringify(qf.DEFAULT_SPARKLINE_OPTIONS)),i))}update(t,e,i,o){const r=this.groups.get(t);Object.assign(r,{dataRanges:i,locRange:e},o),this.updateRangeMap=!0}delete(t){this.groups.delete(t),this.updateRangeMap=!0}shift(t){this.groups.forEach((e=>{e.dataRanges.forEach((([e])=>e.shift(t))),e.locRange.shift(t)})),this.updateRangeMaps()}}class Fw extends gv{constructor(t,e,i=!1){super(e.c1,e.r1,e.c2,e.r2),this.model=t,this.initializedOnly=i,this.r=0,this.c=-1,this.done=!1}[Symbol.iterator](){return this}nextInitialized(){let t;for(;!this.done&&!t;)this.c<this.size.columns-1?this.c++:this.r<this.size.rows-1&&(this.c=0,this.r++),t=this.model.rows[this.r].cells[this.c],this.done=this.c>=this.size.columns-1&&this.r>=this.size.rows-1;return t}next(){if(this.done)return{done:!0};this.c<this.size.columns-1?this.c++:this.r<this.size.rows-1&&(this.c=0,this.r++),this.done=this.c>=this.size.columns-1&&this.r>=this.size.rows-1;const t=this.model.rows[this.r+this.r1],e=this.c+this.c1,i=this.initializedOnly&&!t.isCellInitialized(e)?this.nextInitialized():t?.cell(e);return i?{done:!1,value:i}:{done:!0}}forEach(t){let e;for(;e=this.next().value;)t(e)}}class Bw extends gv{constructor(t){super(t.c1,t.r1,t.c2,t.r2),this.r=0,this.c=-1,this.done=!1}[Symbol.iterator](){return this}next(){return this.done?{done:!0}:(this.c<this.size.columns-1?this.c++:this.r<this.size.rows-1&&(this.c=0,this.r++),this.done=this.c==this.size.columns-1&&this.r==this.size.rows-1,{done:!1,value:new gv(this.c+this.c1,this.r+this.r1)})}}class Ww extends gv{constructor(t,e,i){super(e.c1,e.r1,e.c2,e.r2),this.model=t,this.i=0,this.done=!1,this.axis=i,this.key="rows"===i?"r1":"c1"}[Symbol.iterator](){return this}next(){if(this.done)return{done:!0};this.i<this.size[this.axis]-1&&this.i++,this.done=this.i>=this.size[this.axis]-1;const t=this.model[this.axis][this.i+this[this.key]];return t?{done:!1,value:t}:{done:!0}}forEach(t){let e;for(;e=this.next().value;)t(e)}}class Vw{constructor(t,e){this.model=t,this.names=new Map,this.rangeMap=new Map,e&&this.populate(e)}populate(t){t.forEach((({name:t,ref:e})=>this.set(t,Z(e)?gv.fromCoords(e):gv.fromA1(e))))}set(t,e){this.names.set(t,e),this.rangeMap.set(e.A1,t)}delete(t){const e=this.names.get(t);e&&(this.rangeMap.delete(e.A1),this.names.delete(t))}findCellByName(t){let e;const i=this.model.rows,o=this.model.columns.length;for(let r=0;r<i.length;r++){e=i[r];for(let i=0;i<o;i++)if(e.hasCellName(i)){const o=e.cell(i);if(o.name==t)return o.range}}return null}getCellByName(t,e){const i=this.names.get(t)??this.findCellByName(t);return i?i.isColumn?this.model.rows.length>e.r1?this.model.columns[i.c1].cell(e.r1):null:i.isRow?this.model.columns.length>e.c1?this.model.rows[i.r1].cell(e.c1):null:this.model.rows[i.r1].cell(i.c1):null}getRangeByName(t,e=!0){const i=this.names.get(t);return e?i?.intersect(this.model.gridRange):i}shift(t){this.names.forEach(((e,i)=>{const o=e.A1;e.shift(t);const r=e.A1;o!=r&&(this.rangeMap.delete(o),this.rangeMap.set(r,i))}))}getSourceData(){const t=[];return this.names.forEach(((e,i)=>{t.push({name:i,ref:e.A1})})),t}}function Uw(t,e=null){const i=ot({},qf.DEFAULT_OPTIONS,e,is(t,e));return i.numberFormat?i.numberFormatter=ur(i.formatLocale,i.numberFormat):i.numberFormatter||(i.numberFormatter=ur(i.formatLocale)),i.dateFormat?i.dateFormatter=Zo(i.formatLocale,i.dateFormat):i.dateFormatter||(i.dateFormatter=Zo(i.formatLocale)),i.columnSorting&&(i.sorting=i.sorting||{enabled:!0}),"boolean"==typeof i.filters&&(i.filters={enabled:i.filters}),i.filters=Object.assign({},Uf,i.filters),"boolean"==typeof i.rowTree&&(i.rowTree={enabled:i.rowTree}),i.rowTree=Object.assign({},Gf,i.rowTree),"boolean"==typeof i.columnTree&&(i.columnTree={enabled:i.columnTree}),i.columnTree=Object.assign({},Gf,i.columnTree),i.cellValidation&&(i.cellValidation=Zy(i.cellValidation)),i}class Gw extends(Lr(Qy)){get cells(){return this._cells}get data(){return this._data}set data(t){this._data=t}get height(){return this._height??this.model.options.rowHeight}set height(t){this._height=t}get priority(){return this._priority}set priority(t){this._priority=t}get address(){return mv(this.index)}get range(){return new gv(null,this.index,null,this.index)}get hasFormula(){return!!this._formula}get formula(){return this._formula}set formula(t){super.formula=t,this.model.columns.forEach((t=>this.cell(t.index).refreshFormula()))}get values(){return this.model.columns.map((t=>this.cell(t.index).value))}cell(t,e){if(this.model.options.singleCellModel)return this._singleCell||(this._singleCell=new dw(this.model,{c:t,r:this.index})),this._singleCell.row=this,this._singleCell.column=this.model.columns[t],this._singleCell;let i=this._cells[t];if((e||!i)&&this.model.columns[t]){if(i=new dw(this.model,e??{c:t,r:this.index}),this._data){const e=this.model.columns[t].data;if(null!=e){const t=this._data[e];Z(t)?(t.comment&&this.model.comments.set(i.address,[t.comment]),i.populate(t)):i.hasValue||(i.value=t)}}i.name&&this.model.names.set(i.name,i.range),this._cells[t]=i}return i}constructor(t,e){super(t,e),this.isCellInitialized=t=>!!this.cells[t],this._cells=[],null==this._priority&&(this._priority=t.options.rowPriority)}populate(t){super.populate(t),this._height=null==t.h||"auto"==t.h?this.model.options.rowHeight:t.h,t.data&&(Array.isArray(t.data)?this._data=[...t.data]:this._data={...t.data}),null!=t.priority&&(this._priority=t.priority)}getSourceData(){const t=super.getSourceData();return null!=this._height&&this._height!=this.model.options.rowHeight&&(t.h=this._height),t}expand(t){super.expand(t),this.model.indexVisibleRows()}collapse(){super.collapse(),this.model.indexVisibleRows()}get prev(){return this.model.rows[this.index-1]}get next(){return this.model.rows[this.index+1]}get prevVisible(){let t=this.prev;for(;t&&!t.visible;)t=t.prev;return t}get nextVisible(){let t=this.next;for(;t&&!t.visible;)t=t.next;return t}hasCellFormula(t){return this.cells[t]&&this.cells[t].hasFormula||this._data&&this._data[this.model.columns[t].data]&&this._data[this.model.columns[t].data].f}hasCellName(t){return this.cells[t]&&null!=this.cells[t].name||this._data&&this._data[this.model.columns[t].data]&&null!=this._data[this.model.columns[t].data].name}insertColumns(t,e,i=!1){let o;const r=this.model.columns.length,s=this.model.calculations;if(i)for(let i=0;i<r;i++)this.hasCellFormula(i)&&(o=this.cell(i),o.formula=s.getFormula(o).shift({index:t,offset:e,direction:"right"}).createFormulaString(!1));t<this.cells.length&&this.cells.splice(t,0,...Array(e).fill(null))}deleteColumns(t,e,i=!1){let o;const r=this.model.columns.length,s=this.model.calculations;if(i)for(let i=0;i<r;i++)this.hasCellFormula(i)&&(o=this.cell(i),o.formula=s.getFormula(o).shift({index:t,offset:e,direction:"left"}).createFormulaString(!1));return t<this.cells.length?this.cells.splice(t,e):null}clearCalculatedValues(){this.cells.forEach((t=>t&&this.model.calculations.refreshFormula(t)))}}var qw=i(4418),Yw=i.n(qw);const Zw=t=>t?"1":"0",Xw=t=>null==t?"_":t,Qw=t=>null==t?"_":t.toString(),Kw=t=>null==t?"_":JSON.stringify(t),Jw=t=>Xw(t&&t.color?t.color:"_")+Xw(t&&t.style?t.style:"_"),tx=t=>Xw(t?t.horizontal:null)+Xw(t?t.vertical:null)+Xw(t?t.horizontal:null)+Qw(t?t.indent:null)+Zw(t?t.wrapText:null)+Qw(t?t.textRotation:null),ex=t=>Yw()("s_"+Zw(t.bold)+Zw(t.italic)+Zw(t.underline)+Qw(t.sz)+Xw(t.font)+Xw(t.color)+Jw(t.top)+Jw(t.right)+Jw(t.bottom)+Jw(t.left)+Xw(t.patternType)+Xw(t.fgColor)+Xw(t.bgColor)+tx(t.alignment)+Qw(t.angle)+Kw(t.stops)+Zw(t.hidden)+Zw(t.editable)+Kw(t.cssStyle)+Kw(t.icon));function ix(t){const e={...t};return delete e.id,delete e.hash,e}class ox{constructor(t){this.model=t,this._count=0,this.hashmap=new Map,this.map=new Map}add(t){if(!isNaN(t))return this.get(t);const e=this.model.options.cssStyles?lw(t):t,i=e.hash?e.hash:ex(e);return this.hashmap.has(i)?this.map.get(this.hashmap.get(i)):(null==e.id&&(e.id=this._count),this._count=Math.max(e.id+1,this._count+1),e.hash=i,this.hashmap.set(i,e.id),this.map.set(e.id,e),e)}populate(t){t.forEach((t=>this.add(t)))}get(t){return this.map.has(t)?this.map.get(t):null}remove(t){const e="object"==typeof t?t:this.map.get(t);this.hashmap.delete(e.hash),this.map.delete(e.id)}merge(...t){const e=Object.assign({},...t.map((t=>Z(t)?t:this.get(t))));return this.add(ix(e))}duplicate(t,e){const i=this.get(t);return this.add(ix({...i,...e}))}set(t,e){let i=this.map.has(t)?this.map.get(t):{};for(const t in e)i[t]=e[t];return i=i.id?i:this.add(i),i}unset(t,e){if(this.map.has(t)){const i=this.map.get(t);for(const t of e)delete i[t]}}getSourceData(){return Array.from(this.map.values())}clean(){const t=new Map(Array.from(this.map.entries()).map((([t])=>[t,0])));this.model.columns.forEach((e=>{const i=t.get(e.style);null!=i&&t.set(e.style,i+1)})),this.model.rows.forEach((e=>{const i=t.get(e.style);null!=i&&t.set(e.style,i+1),e.cells.forEach((e=>{const i=t.get(e.style);null!=i&&t.set(e.style,i+1)}))})),t.forEach(((t,e)=>{0==t&&this.remove(e)}))}}function rx(t,e,i,o){const r=o??("rows"==i?e.rows:e.columns),s=function(t){const e=new Map;for(const i of t)e.has(i.level)||e.set(i.level,[]),e.get(i.level).push(i);return e}(r),n=t[i]??[];for(const t of n){let o;if(o=t.index>-1?[r[t.index]]:t.level>-1?s.get(t.level):r,t.name){const e=t.name instanceof RegExp?t.name:new RegExp(ut(t.name));o=o.filter((t=>e.test(t.name)))}o?.forEach((o=>{null!=t.priority&&(o.priority=t.priority),t.type?e.conditionalFormats.add(Object.assign({ranges:`${o.address}:${o.address}`},t)):(o.style=e.styles.add(t.style).id,"rows"==i&&null!=t.height?o.height=t.height:"columns"==i&&null!=t.width&&(o.width=t.width))}))}}function sx(t,e){for(const i of t)if(e[i.property]!=i.value)return!1;return!0}function nx(t,e,i){const o=t.cells??[];for(const t of o)if(t.conditions?.length){const o=e.getRangeIterator(i??e.gridRange);for(const i of o)sx(t.conditions,i)&&(i.style=e.styles.add(t.style).id)}else if(t.type)e.conditionalFormats.add(Object.assign({ranges:"A:"+e.columns[e.columns.length-1].address},t));else for(const i of e.columns)null==i.style&&(i.style=e.styles.add(t.style).id)}function ax(t,e,i){rx(t,e,"columns",i)}function lx(t,e,i){rx(t,e,"rows",i)}function cx(t,e){nx(t,e),ax(t,e),lx(t,e)}var hx;!function(t){t[t.NONE=0]="NONE",t[t.MERGED=1]="MERGED",t[t.HIDDEN=2]="HIDDEN"}(hx||(hx={}));class dx{get mergedCells(){return this._mergedCells}get hiddenCells(){return this._hiddenCells}constructor(t){this.model=t,this._mergedCells=new Map,this._hiddenCells=new Map}clear(){this._mergedCells.clear(),this._hiddenCells.clear()}getMergeState(t){return this._mergedCells.has(t)?hx.MERGED:this._hiddenCells.has(t)?hx.HIDDEN:hx.NONE}indexMergedRange(t){const e=t.A1,i=this._mergedCells.get(e);if(!i)return;const o=i.r,r=i.c,s=t.clone(),n=this.model.rows[o]?.cell(r);if(n)for(let t=0;t<i.rs;t++)for(let e=0;e<i.cs;e++)0==t&&0==e||(s.r1=o+t,s.c1=r+e,s.r2=s.r1,s.c2=s.c1,this._hiddenCells.set(s.A1,i));else this.remove(e)}add(t){const e=new gv(t.c,t.r),i=e.A1;if(this._mergedCells.has(i))this.remove(i);else if(this._hiddenCells.has(i))return;this._mergedCells.set(i,t),this.indexMergedRange(e)}remove(t){const e=this._mergedCells.get(t);if(!e)return;this._mergedCells.delete(t);const i=e.r,o=e.c,r=new gv(o,i);this._hiddenCells.delete(t);for(let t=0;t<e.rs;t++)for(let s=0;s<e.cs;s++)0==t&&0==s||(r.r1=i+t,r.c1=o+s,r.r2=r.r1,r.c2=r.c1,this._hiddenCells.delete(r.A1))}shift(t){const{index:e,offset:i,direction:o}=t,r={down:t=>{e<=t.r?t.r+=i:e>t.r&&e<t.r+t.rs&&(t.rs+=i)},up:t=>{e<=t.r?t.r-=i:e>t.r&&e<t.r+t.rs&&(t.rs-=i)},right:t=>{e<=t.c?t.c+=i:e>t.c&&e<t.c+t.cs&&(t.cs+=i)},left:t=>{e<=t.c?t.c-=i:e>t.c&&e<t.c+t.cs&&(t.cs-=i)}},s=[...this._mergedCells.values()];s.forEach((t=>this.remove(new gv(t.c,t.r).A1))),s.forEach((t=>{r[o](t),this.add(t)}))}}const ux=["index","name","rows","columns","cells","options","sparklines","rules","comments","styles","names","props","tab","theme"];class px{get mergedHeaders(){return this._mergedHeaders}get hasFilter(){return this._filter}get hasRowTree(){return this._maxRowLevel>0}get hasRowTreeEnabled(){return this.hasRowTree&&this.options.rowTree.enabled}get maxRowLevel(){return this._maxRowLevel}get hasColumnTree(){return this._maxColumnLevel>0}get hasColumnTreeEnabled(){return this.hasColumnTree&&this.options.columnTree.enabled}get maxColumnLevel(){return this._maxColumnLevel}get headerCount(){return this._headerCount}get columnHeaderCount(){return this.headerCount+(this.hasColumnTreeEnabled?1:0)+(this.hasFilter?1:0)}get properties(){return this._properties}set properties(t){this._properties=t}get theme(){return this._theme}set theme(t){this._theme=t}constructor(t,e,i){this.otherModels={},this.autofitColumns=new Set,this.autofitRows=new Set,this.merges=new dx(this),this.styles=new ox(this),this.comments=new ww(this),this.calculations=new _w(this),this.names=new Vw(this),this.sorting=new bw(this),this.sparklines=new Hw(this),this.conditionalFormats=new Tw(this),this._filter=!1,this._maxRowLevel=0,this._maxColumnLevel=0,this._headerCount=0,this._levelBasedRowTree=!0,this._levelBasedColTree=!0,this.clearRows=()=>(this.rowRoot.clearChildren(),this.rows=[],this.rows),this.clearColumns=()=>this.columns=[],this.logger=i,this.options=e??Uw(t.options),this.populate(t)}getConnectedModel(t){return this.group?this.group.get(t):null}getModelByRange(t){return t.sheet?this.getConnectedModel(t.sheet):this}getCellByA1(t){return this.getCellByRange(gv.fromA1(t))}getCellByRange(t){return this.getCellByCoords(t.r1,t.c1)}getCellByCoords(t,e){return this.rows[t]?.cell(e)}cell(t,e){return isNaN(t)?t instanceof gv?this.getCellByRange(t):"string"==typeof t?this.getCellByA1(t):null:this.getCellByCoords(t,e||0)}createRows(t,e=new Gw(this,{l:-1}),i=0){let o=!1,r=!1;this.autofitRows.clear();const s=t.map(((t,e)=>{t||(t={}),isNaN(t.l)||(o=!0),null!=t.p&&(r=!0),"auto"==t.h&&this.autofitRows.add(e);const s=new Gw(this,t);return s.origIndex=e+i,s.name&&this.names.set(s.name,gv.fullRow(e)),s}));let n=-1;return o?n=Rr(s,e,{reverse:this.options.rowTree.reversed}):r?n=Tr(s,e):e.children=s,r||(o=!0),[e,s,n,o]}insertRowData(t,e,i){const o=this.createRows(i,new Gw(this,{l:t.level}),e);if(this._maxRowLevel=Math.max(this._maxRowLevel,o[2]),t.insertChildren(o[0].children,e),this.indexRowsByTree(),this.theme){const t=o[1];lx(this.theme,this,t),nx(this.theme,this,new gv(0,t[0].index,1/0,t[t.length-1].index))}}applyTheme(t,e){if(e)for(const t of this.getInitializedCellIterator())t.invalidateStyle();cx(t,this)}populate(t){this.index=t.index,this.name=t.name??this.name,this.tab=t.tab;let e=!1,i=!1;if(t.columns||(t.columns=new Array(this.options.columns).fill({})),t.rows||(t.rows=new Array(this.options.rows).fill({})),t.styles&&this.styles.populate(t.styles),this.autofitColumns.clear(),this.columns=t.columns.map(((t,o)=>{t||(t={}),t.l>0&&(e=!0),null!=t.p&&(i=!0),"auto"==t.w&&this.autofitColumns.add(o);const r=new pw(this,t);return this._filter=r.hasFilter||this._filter,r.name&&this.names.set(r.name,gv.fullColumn(o)),r})),this._levelBasedColTree=e,this._maxColumnLevel=-1,this.colRoot=new pw(this,{l:-1}),e?this._maxColumnLevel=Rr(this.columns,this.colRoot,{reverse:this.options.columnTree.reversed}):i?this._maxColumnLevel=Tr(this.columns,this.colRoot):this.colRoot.children=this.columns,i||(this._levelBasedColTree=!0),this.indexColumns(),this.indexVisibleColumns(),[this.rowRoot,this.rows,this._maxRowLevel,this._levelBasedRowTree]=this.createRows(t.rows),this.indexRows(),this.indexVisibleRows(),this.options.pageSize&&this.options.pageSize<=this.rows.length&&(this.rowRoot.count=1/0),this.merges.clear(),t.comments=t.comments||[],t.cells?.forEach(((e,i)=>{const o=this.rows[e.r]?this.rows[e.r].cell(e.c,e):null;o?(e.cs>1||e.rs>1)&&this.merges.add({r:o.r,c:o.c,rs:e.rs||1,cs:e.cs||1}):this.logger?.error(`invalid cell definition (index ${i}): ${JSON.stringify(e)}`),o&&e.comment&&t.comments.push(Object.assign(e.comment,{c:e.c,r:e.r}))})),t.sparklines)try{this.sparklines.populate(t.sparklines)}catch(t){Er().error(`Sparkline init error: ${t}`)}if(t.names)try{this.names.populate(t.names)}catch(t){Er().error(`Named range init error: ${t}`)}if(t.rules)try{this.conditionalFormats.populate(t.rules)}catch(t){Er().error(`Conditional formats init error: ${t}`)}if(t.theme)try{this.applyTheme(t.theme),this._theme=t.theme}catch(t){Er().error(`Theme init error: ${t}`)}if(t.comments)try{this.comments.populate(t.comments)}catch(t){Er().error(`Comment init error: ${t}`)}this._properties=t.props,this.otherSourceData={};const o=new Set(ux),r=Object.keys(t).filter((t=>!o.has(t)));r.forEach((e=>this.otherSourceData[e]=t[e])),this.options.sorting?.defaultSettings&&(this.sorting.settings=this.options.sorting.defaultSettings),this.calcHeaderHeights()}getSourceData(){const t={index:this.index,name:this.name,tab:this.tab,columns:this.columns.map((t=>t.getSourceData())),rows:this.rows.map((t=>t.getSourceData())),styles:this.styles.getSourceData(),rules:this.conditionalFormats.getSourceData(),sparklines:this.sparklines.getSourceData(),names:this.names.getSourceData(),options:this.options};this._properties&&(t.props=this._properties);const e=[];let i;for(let t=0;t<this.rows.length;t++)for(let o=0;o<this.columns.length;o++)i=this.rows[t].cell(o).getSourceData(),Object.keys(i).length>0&&(i.r=t,i.c=o,e.push(i));e.length>0&&(t.cells=e);const o=[];return this.styles.clean(),this.styles.map.forEach((t=>o.push(t))),o.length>0&&(t.styles=o),new Set([...Object.keys(this.otherModels??{}),...Object.keys(this.otherSourceData??{})]).forEach((e=>t[e]=this.otherModels[e]?Array.from(this.otherModels[e]).map((t=>t.getSourceData())):this.otherSourceData[e])),t}calcHeaderHeights(){this._headerCount=0,this._headerHeights=[],this.columns.forEach((t=>{this._headerCount=t.header?t.header.length:this._headerCount,this._headerHeights.length<this._headerCount&&this._headerHeights.push(...Array(this._headerCount-this._headerHeights.length).fill(0)),t.header?.forEach(((t,e)=>{e>=this._headerHeights.length&&this._headerHeights.push(0),this._headerHeights[e]=Math.max(this._headerHeights[e],t.height??0)}))}))}indexRows(){this.visibleRows=[],this.rows.forEach(((t,e)=>{t.index=e,t.isLoaded||(t.collapsed=!0),t.hidden||t.filterState==zr.Filtered||(t.visibleIndex=this.visibleRows.length,this.visibleRows.push(t))}))}indexVisibleRows(){this.visibleRows=[];let t=0;if(this._levelBasedRowTree){if(this.rowRoot.walkVisible((e=>{e.visibleIndex=t++,this.visibleRows.push(e)})),this.options.rowTree.reversed){const e=new Array(this.visibleRows.length);this.visibleRows.forEach(((i,o)=>{t=this.visibleRows.length-o-1,i.visibleIndex=t,e[t]=i})),this.visibleRows=e}}else this.rowRoot.walkVisible((t=>this.visibleRows[t.index]=t)),this.visibleRows=this.visibleRows.filter((e=>!!e&&(e.visibleIndex=t++,!0)))}indexRowsByTree(){this.rows=[];let t=0;this.rowRoot.walk((e=>{e.index=t++,this.rows.push(e)})),this.options.rowTree.reversed&&this.rows.reverse(),this.indexVisibleRows()}indexColumns(){this.visibleColumns=[],this.columns.forEach(((t,e)=>{t.index=e,t.hidden||this.visibleColumns.push(t)}))}indexVisibleColumns(){this.visibleColumns=[],this.visibleColumnIndex={};let t=0;if(this.colRoot.walkVisible((e=>{e.visibleIndex=t,this.visibleColumnIndex[e.index]=t++,this.visibleColumns.push(e)})),this.options.columnTree.reversed){this.visibleColumnIndex={};const e=new Array(this.visibleColumns.length);this.visibleColumns.forEach(((i,o)=>{t=this.visibleColumns.length-o-1,i.visibleIndex=t,this.visibleColumnIndex[i.index]=t,e[t]=i})),this.visibleColumns=e}this.indexHeaders()}indexHeaders(){this._mergedHeaders=[],this._headerCount=0,this.colRoot.walkVisible((t=>{this._headerCount=Math.max(t.header?t.header.length:0,this._headerCount),t.mergedHeaders.forEach((e=>this._mergedHeaders.push({h:e,c:t.index,r:e.r,cs:t.calculateRealColspan(e.cs??1),rs:e.rs??1})))})),this._mergedHeaders.forEach((t=>{if(!t.h.hidden)for(let e=t.c;e<t.c+t.cs;e++)for(let i=t.r;i<t.r+t.rs;i++)(i>t.r||e>t.c)&&this.columns[e]&&this.columns[e].header[i]&&(this.columns[e].header[i].hidden=!0)})),this.calcHeaderHeights()}removeHeader(t){this.columns.forEach((e=>{t<e.header.length&&e.header.splice(t,1)})),this.indexHeaders()}clear(){this.clearRows(),this.clearColumns(),this.resetViewport()}resetViewport(){return this._viewport=null,this}getViewport(t,e,i){const o=[],r=[];let s,n,a=e.h,l=0;for(l=0;l<i.t;l++)s=this.visibleRows[l],a-=s.height,o.push(s);for(l=this.visibleRows.length-i.b;l<this.visibleRows.length;l++)s=this.visibleRows[l],a-=s.height;for(l=i.t+t.r;a>0&&l<this.visibleRows.length;)s=this.visibleRows[l++],a-=s.height,o.push(s);for(l=this.visibleRows.length-i.b;l<this.visibleRows.length;l++)o.push(this.visibleRows[l]);let c=e.w,h=0;for(h=0;h<i.l;h++)n=this.visibleColumns[h],c-=n.width,r.push(n);for(h=this.visibleColumns.length-i.r;h<this.visibleColumns.length;h++)n=this.visibleColumns[h],c-=n.width;for(h=i.l+t.c;c>0&&h<this.visibleColumns.length;)n=this.visibleColumns[h++],c-=n.width,r.push(n);for(h=this.visibleColumns.length-i.r;h<this.visibleColumns.length;h++)r.push(this.visibleColumns[h]);return this._viewport={rows:o,columns:r}}calculateViewport(){return this._viewport?this.calculations.calculateViewport(this._viewport):[]}getValuesInRange(t,e=!1){if(!(t=t.intersect(this.gridRange)))return[];const{columns:i,rows:o}=t.size,r=new Array(o);let s,n=0,a=0;for(let o=t.r1;o<=t.r2;o++){r[n]=new Array(i),a=0,s=this.rows[o];for(let i=t.c1;i<=t.c2;i++)r[n][a++]=e?s.cell(i).formattedValue:s.cell(i).value;++n}return r}setRowExpandLevel(t){this.rows.forEach((e=>{e.collapsed=!e.isLoaded&&!e.isPartialyLoaded||e.level>=t,e.level<=t&&(e.hidden=!1)})),this.indexVisibleRows()}setColumnExpandLevel(t){this.columns.forEach((e=>e.collapsed=e.level>=t)),this.indexVisibleColumns()}getViewportRange(){return this._viewport?new gv(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):null}get gridRange(){return new gv(0,0,this.columns.length-1,this.rows.length-1)}getRangeIterator(t,e=!1){return new Fw(this,e&&this._viewport?t.intersect(this.getViewportRange()):t.intersect(this.gridRange))}getInitializedCellIterator(){return new Fw(this,this.gridRange,!0)}getRowIterator(t,e=!1){return t=e&&this._viewport?t.intersect(this.getViewportRange()):t.intersect(this.gridRange),new Ww(this,t,"rows")}getColumnIterator(t,e=!1){return t=e&&this._viewport?t.intersect(this.getViewportRange()):t.intersect(this.gridRange),new Ww(this,t,"columns")}getCellArray(t){const e=[];for(const i of this.getRangeIterator(t))e.push(i);return e}transformRangeToMatrix(t,e){let i,o,r;const s=[];for(let n=(t=t.intersect(this.gridRange)).r1;n<=t.r2;n++)if(i=this.rows[n],i){r=[];for(let s=t.c1;s<=t.c2;s++)o=i.cell(s),o&&r.push(e(o));s.push(r)}return s}getCellMatrix(t){return this.getModelByRange(t)?.transformRangeToMatrix(t,(t=>t))}getValueMatrix(t){return this.getModelByRange(t)?.transformRangeToMatrix(t,(t=>t.value))}shift(t){t.sheet=this.name,this.merges.shift(t),this.calculations.shift(t),this.names.shift(t),this.comments.shift(t),this.sparklines.shift(t)}clearCalculations(t=!1){t&&this.group?this.group.models.forEach((t=>t.calculations.refresh())):this.calculations.refresh()}refreshSparklines(){this.sparklines.updateRangeMaps();for(const t of this.getInitializedCellIterator())t.invalidateStyle()}clearCalculatedStyles(){this.conditionalFormats.refresh();const t=[];for(const e of this.getInitializedCellIterator())t.push(e),e.invalidateStyle()}insertColumns(t,e,i=!1){const o=this.columns[Math.min(this.columns.length-1,t)].parent;i&&++t,this.shift({index:t,offset:e,direction:"right"});for(let i=0;i<this.rows.length;i++)this.rows[i].insertColumns(t,e,!1);const r=new Array(e).fill(null).map((()=>new pw(this)));return this.columns.splice(t,0,...r),this.maxColumnLevel>0&&o.insertChildren(r,t-(o.index||-1)-1),this.indexColumns(),this.clearCalculations(!0),r}deleteColumns(t,e){const i=this.columns[t].parent;this.shift({index:t,offset:e,direction:"left"});const o=[];for(let i=0;i<this.rows.length;i++)o.push(this.rows[i].deleteColumns(t,e,!1));const r=this.columns.splice(t,e);return i?.deleteChildren(r),this.indexColumns(),this.clearCalculations(!0),r}insertRows(t,e,i=!1){const o=Math.min(this.rows.length-1,t),r=o<0?this.rowRoot:this.rows[o].parent;i&&++t;const s=isNaN(e)?e.length:e;this.shift({index:t,offset:s,direction:"down"});const n=isNaN(e)?e:new Array(s).fill(null).map((()=>new Gw(this)));return this.rows.splice(t,0,...n),this.maxRowLevel>0&&r.insertChildren(n,t-(r.index||-1)-1),this.indexRows(),this.theme&&(lx(this.theme,this,n),nx(this.theme,this,new gv(0,n[0].index,1/0,n[n.length-1].index))),this.clearCalculations(!0),n}deleteRows(t,e){const i=this.rows[t].parent;this.shift({index:t,offset:e,direction:"up"});const o=this.rows.splice(t,e);return i?.deleteChildren(o),this.indexRows(),this.clearCalculations(!0),o}moveRows(t,e,i){const o=this.rows.splice(t,e);return this.rows.splice(i,0,...o),this.shift({index:t,offset:i-t,direction:"down",maxIndex:t+e-1}),this.indexRows(),this.clearCalculations(!0),o}moveColumns(t,e,i){const o=this.columns.splice(t,e);return this.columns.splice(i,0,...o),this.shift({index:t,offset:i-t,direction:"right",maxIndex:t+e-1}),this.indexColumns(),this.clearCalculations(!0),o}spillValues(t){const{cell:e,values:i,displayValues:o,propertyCell:r}=t,s=[],n=[],a=0===i.length||0===i[0].length;let l,c;const h=a?null:new gv(e.c,e.r,e.c+i[0].length-1,e.r+i.length-1);if(e.spillRange&&this.getRangeIterator(e.spillRange,!0).forEach((t=>{e==t||h?.contains(t.range)||t.clearSpilledValue()})),e.spillRange=h,a)return{cells:s,oldValues:n,range:null};for(let t=h.r1;t<=h.r2;t++){if(l=this.rows[t],!l)continue;const a=t-h.r1;for(let t=h.c1;t<=h.c2;t++){const d=t-h.c1;c=l.cell(t),c.editable&&(n.push(c.value2),c.spillValue(i[a][d],e),r&&(c.format=r.format,c.type=r.type),o&&null!=o[a][d]&&(c.displayValue=o[a][d]),s.push(c))}}return{cells:s,oldValues:n,range:h}}getCellByName(t,e,i=!0){return this.names.getCellByName(t,e)||(this.group&&i?this.group.getCellByName(t,e):null)}getRangeByName(t,e=!0){return this.names.getRangeByName(t)||(this.group&&e?this.group.getRangeByName(t):null)}getValueMatrixByName(t,e=!0){const i=this.names.getRangeByName(t);return i?this.getValueMatrix(i):this.group&&e?this.group.getValueMatrixByName(t):null}rebuildRowTree(){const t=this._levelBasedRowTree?Rr:Tr;this._maxRowLevel=t(this.rows,this.rowRoot,{reverse:this.options.rowTree.reversed}),this.indexRowsByTree()}rebuildColumnTree(){const t=this._levelBasedColTree?Rr:Tr;this._maxColumnLevel=t(this.columns,this.colRoot,{reverse:this.options.columnTree.reversed}),this.indexColumns()}calculateCellOffset(t){let e=0,i=0;for(let i=0;i<t.c1&&this.columns[i];i++)e+=this.columns[i].width;for(let e=0;e<t.r1&&this.rows[e];e++)i+=this.rows[e].height;return{x:e,y:i}}}class gx{get errors(){return this._errors}get(t){return this.models.get(t)}has(t){return this.models.has(t)}getNewName(){let t;do{t=`sheet${this._max}`}while(this.models.has(t));return t}add(t){if(t.index=t.index??this._max,++this._max,t.name=t.name||this.getNewName(),this.models.has(t.name))throw Error(`sheet "${t.name}" already exists`);return this.models.set(t.name,t),t.group=this,t}duplicate(t){const e=this.get(t);if(!e)return;const i=new px(e.getSourceData(),e.options);let o=1;for(;this.models.has(`${t}_${o}`);)++o;return i.name=`${t}_${o}`,this.add(i),i}remove(t){return this.models.delete(t),this}rename(t,e){if(this.has(t)){if(this.has(e))throw new Error(`Model '${e}' already exists`);const i=this.get(t);i.name=e,this.models.set(e,i),this.models.delete(t),this.models.forEach((i=>{i.calculations.renameSheet(t,e)&&i.calculateViewport()}))}return this}clear(){this.models.clear(),this._errors=[]}constructor(t){this._max=0,this.models=new Map,this.themes=new Map,this._errors=[],t&&this.populate(t)}populate(t){this.clear(),t.models.forEach((t=>{const e=new px(t);try{this.add(e)}catch(t){this.errors.push(t)}})),t.themes&&t.themes.forEach((t=>this.themes.set(t.name,t)))}getSourceData(){const t={models:[]};return this.models.forEach((e=>t.models.push(e.getSourceData()))),t}getCellByName(t,e){for(const i of this.models.values()){const o=i.getCellByName(t,e,!1);if(o)return o}return null}getRangeByName(t){for(const e of this.models.values()){const i=e.getRangeByName(t,!1);if(i)return i}return null}getValueMatrixByName(t){for(const e of this.models.values()){const i=e.getValueMatrixByName(t,!1);if(i)return i}return null}}class mx{constructor(t){this.model=t,this.stack=[],this.restack=[]}push(t){return this.restack=[],t.timestamp||(t.timestamp=Date.now()),this.stack.push(t),this}pop(t=1){let e=0;const i=[];for(;e++<t&&this.stack.length>0;){const t=this.stack.pop();i.push(t),this.restack.push(t)}return i}pop2(t=1){let e=0;const i=[];for(;e++<t&&this.restack.length>0;){const t=this.restack.pop();i.push(t),this.stack.push(t)}return i}}class fx{get activeCellCoords(){return{c:this.range.c1+this.activeCell.c1,r:this.range.r1+this.activeCell.r1}}constructor(t,e,i,o){this.hidden=!1,this.range=new gv(t,e,i,o),this.activeCell=new gv(0,0)}static fromRange(t){return new fx(t.c1,t.r1,t.c2,t.r2)}setCoords(t,e,i,o){this.range.setCoords(t,e,i,o),this.activeCell.setCoords(0,0)}setRange(t){"string"==typeof t&&(t=gv.fromA1(t)),this.range.setCoords(t.c1,t.r1,t.c2,t.r2),this.activeCell.setCoords(0,0)}move(t,e,i,o){this.range.setCoords(this.range.c1+this.activeCell.c1,this.range.r1+this.activeCell.r1,this.range.c1+this.activeCell.c2,this.range.r1+this.activeCell.r2),this.range.move(t,e,i,o,!1),this.activeCell.setCoords(0,0)}moveRange(t,e,i,o){this.range.move(t,e,i,o,!0)}moveActiveCell(t,e){const{columns:i,rows:o}=this.range.size;this.activeCell.move(t,e,i,o,!0)}}const vx={...qf,CUSTOM_CLIPBOARD_TYPE:"web application/json"};class bx{constructor(t,e,i=vx.MAX_CACHE_ITEMS){this.maxCacheItems=i,this.queue=[],this.disabled=!1,this.table=new Array(e).fill(null).map((()=>new Array(t)))}get(t,e){return this.table[e][t]}delete(t,e){return this.table[e][t]=null,this}deleteColumn(t){for(let e=0;e<this.table.length;e++)this.table[e][t]=null;return this}deleteRow(t){return this.table[t]=new Array(this.table[0].length).fill(null),this}set(t,e,i){this.disabled||(this.get(t,e)||this.queue.push([e,t]),this.table[e][t]=i)}clear(){this.queue=[],this.table=this.table.map((t=>new Array(t.length)))}clean(){if(this.maxCacheItems>0&&this.queue.length>this.maxCacheItems){let t=this.queue.length;for(let e=0;e<this.queue.length;e++){const i=this.queue[e];if(!this.table[i[0]][i[1]].parentNode&&(this.queue[e]=null,this.table[i[0]][i[1]]=null,--t<=this.maxCacheItems))break}t<this.queue.length&&(this.queue=this.queue.filter((t=>t)))}}}var yx=function(t,e,i,o){var r,s=arguments.length,n=s<3?e:null===o?o=Object.getOwnPropertyDescriptor(e,i):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)n=Reflect.decorate(t,e,i,o);else for(var a=t.length-1;a>=0;a--)(r=t[a])&&(n=(s<3?r(n):s>3?r(e,i,n):r(e,i))||n);return s>3&&n&&Object.defineProperty(e,i,n),n};let wx=class extends _n{constructor(){super(),this.render=()=>sn`
|
|
3703
|
+
`,Uf={enabled:!1,includeChildren:!0,includeParents:!0},Gf={enabled:!0,reversed:!1},qf={ROW_HEIGHT:22,RESIZE_TRESHOLD:10,ROW_HEADER_WIDTH:60,SLIDER_SIZE:12,EXPANDER_SIZE:13,MAX_CACHE_ITEMS:5e3,CACHE_CLEAN_INTERVAL:30,COMMENT_HIDE_TIMEOUT:1e3,SELECTOR_BORDER_WIDTH:1,MIN_ROW_HEIGHT:5,MIN_COL_WIDTH:5,SPARKLINE_GAP:4,AUTOSCROLL_TRESHOLD:100,AUTOSCROLL_RATIO:1.1,AUTOSCROLL_INTERVAL:100,DEFAULT_SPARKLINE_OPTIONS:{minValue:"auto",maxValue:"auto",type:"line",style:{color:"0094FF",weight:1},marker:{color:"ff0000"}},DEFAULT_OPTIONS:{rows:100,columns:20,readOnly:!1,rowNumbers:!0,rowPriority:2,rowTree:{enabled:!0},columnTree:{enabled:!0},colLetters:!0,emptyPlaceholder:!0,freezeTop:0,fontSize:12,rowHeight:22,rowResize:!0,columnWidth:100,columnResize:!0,columnPriority:1,freezeLeft:0,freezeRight:0,freezeBottom:0,maxSortingColumns:3,numberFormat:null,levelIndentFactor:2,cellIndentFactor:10,emptyClickable:!1,grid:!0,autofill:!0,undoRedo:!0,commandWindow:!0,cellCache:!0,singleCellModel:!1,zoom:1,editing:{rowInsertion:!0,rowDeletion:!0,colInsertion:!0,colDeletion:!0,rowOutline:!0,colOutline:!0,dateCalendarEditor:!1},comments:{hideTimeout:1e3,offsetX:30,offsetY:-30,zIndex:500,headerPosition:"top"},scrolling:{verticalOverscroll:!0,horizontalOverscroll:!0,scrollbarVisibilityTreshold:100},selecting:{enabled:!0,multiSelect:!0},events:{click:{mouseMoveTreshold:10}},clipboard:{pasteProps:["v","dv"],rowPasteMode:"rewrite_append",columnPasteMode:"rewrite"},print:{dpi:600,margins:{left:6.35,right:6.35,top:19.05,bottom:19.05,header:7.62,footer:7.62},orientation:"portrait",paper:"A4"}},MAX_COMMENT_AUTOHEIGHT:300,MIN_COMMENT_AUTOHEIGHT:25,...G},Yf=/^(?!.*[\\\/\*\[\]\:\?"])(.{1,31})$/;function Zf(t){return Yf.test(t)}function Xf(t){return["\\","/","*","[","]",":","?",'"'].forEach((e=>t=t.replace(new RegExp(`\\${e}`,"g"),""))),t}function Qf(t,e){return!isNaN(t)&&null!=t||!isNaN(e)&&null!=e||(t=null==t?"":ct(t.toString()).toLowerCase(),e=null==e?"":ct(e.toString()).toLowerCase()),t>e?1:t<e?-1:0}function Kf(t,e){const i=Q(e);return Q(t)?(t=t.toString().trim()).startsWith("=")?0==Qf(e,i?t.substring(1):parseFloat(t.substring(1))):t.startsWith(">=")?Qf(e,i?t.substring(2):parseFloat(t.substring(2)))>=0:t.startsWith("<=")?Qf(e,i?t.substring(2):parseFloat(t.substring(2)))<=0:t.startsWith(">")?Qf(e,i?t.substring(1):parseFloat(t.substring(1)))>0:t.startsWith("<")?Qf(e,i?t.substring(1):parseFloat(t.substring(1)))<0:0==Qf(e,i?t:isNaN(t)?t||"":parseFloat(t)):e==t}const Jf=new Map([["=",["==",1,0]],["<>",["!=",1,0]],[">",[">",1,0]],["<",["<",1,0]],[">=",[">=",1,0]],["<=",["<=",1,0]],["+",["+",2,0]],["-",["-",2,0]],["*",["*",3,0]],["/",["/",3,0]]]),tv=t=>["=",">","<",">=","<="].includes(t),ev=t=>["+","-","*","/"].includes(t),iv=t=>ev(t)||tv(t);function ov(t,e,i){switch(i){case"+":return t+e;case"-":return t-e;case"*":return t*e;case"/":return t/e;case"=":return 0==Qf(t,e);case">":return Qf(t,e)>0;case"<":return Qf(t,e)<0;case">=":return Qf(t,e)>=0;case"<=":return Qf(t,e)<=0;default:throw new Error(`Invalid operator: ${i}`)}}function rv(t,e,i){const o=Array.isArray(t),r=Array.isArray(e);if(!o&&!r)return[[ov(t,e,i)]];const s=Math.max(o?t.length:0,r?e.length:0),n=Math.max(o?t[0].length:0,r?e[0].length:0),a=[];for(let l=0;l<s;l++){const s=[];for(let a=0;a<n;a++){const n=o?t[l]?.[a]:t,c=r?e[l]?.[a]:e,h=null==n&&null==c?null:ov(n,c,i);s.push(h)}a.push(s)}return a}var sv;!function(t){t[t.Number=0]="Number",t[t.Boolean=1]="Boolean",t[t.String=2]="String",t[t.StringQuote=3]="StringQuote",t[t.Function=4]="Function",t[t.ArgumentSeparator=5]="ArgumentSeparator",t[t.OpenBracket=6]="OpenBracket",t[t.CloseBracket=7]="CloseBracket",t[t.Operator=8]="Operator",t[t.Cell=9]="Cell",t[t.Variable=10]="Variable",t[t.Range=11]="Range",t[t.Sheet=12]="Sheet",t[t.SheetQuote=13]="SheetQuote",t[t.SheetSeparator=14]="SheetSeparator",t[t.Unknown=15]="Unknown",t[t.Operand=16]="Operand"}(sv||(sv={}));const nv=t=>t===sv.Number||t===sv.Boolean||t===sv.String||t===sv.Cell||t===sv.Variable||t===sv.Range,av=t=>t>=48&&t<=57,lv=t=>"true"===(t=t.toLowerCase())||"false"===t,cv=t=>t>=65&&t<=90||t>=97&&t<=122||t>=192&&t<=687,hv={decimalPoint:".",stringQuote:'"',sheetQuote:"'",argumentSeparator:","};class dv{constructor(t){this.options=Object.assign(hv,t)}tokenize(t){const e=[],i=t.length;let o,r,s,n,a=0,l="",c=!1,h=!1,d=!1;for(;a<i;){if(o=t.charAt(a),r=o.charCodeAt(0),"="==o&&0==a)++a;else if(av(r)){for(l=(d?"-":"")+o,++a;a<i;)if(o=t.charAt(a),r=o.charCodeAt(0),av(r))l+=o,++a;else{if(o!==this.options.decimalPoint)break;l+=".",++a}d=!1,e.push([l,sv.Number])}else if(cv(r)||"$"==o){l=o,s=null,++a;do{if(o=t.charAt(a),r=o.charCodeAt(0),cv(r)||av(r)||"."===o||"$"===o||"_"===o)"_"==o?s=sv.Variable:av(r)&&!c&&null==s&&(s=sv.Cell),l+=o,++a,a==i&&e.push([l,s||sv.Variable]);else{if("("==o){e.push([l.toUpperCase(),sv.Function]),e.push([o,sv.OpenBracket]),++a;break}if("'"==o)e.push([l,sv.Sheet]),l="",e.push([o,sv.SheetQuote]),c=!0,++a;else if(":"==o)s=sv.Range,l+=o,++a;else{if(!c||" "!=o){if("!"==o){""!==l&&e.push([l,sv.Sheet]),e.push([o,sv.SheetSeparator]),c=!1,l="",++a;break}e.push([l,s||(lv(l)?sv.Boolean:sv.Variable)]);break}l+=o,++a}}}while(a<i)}else if(iv(o)){if("-"===o&&av(t.charCodeAt(a+1))&&(null==n||"("==n[0]||tv(n[0])||n[1]==sv.ArgumentSeparator))d=!0;else{for(l=o;tv(t.charAt(a+1));)l+=t.charAt(++a);e.push([l,sv.Operator])}++a}else if("("===o)e.push([o,sv.OpenBracket]),++a;else if(")"===o)e.push([o,sv.CloseBracket]),++a;else if("'"===o)e.push([o,sv.SheetQuote]),c=!0,++a;else if(o===this.options.argumentSeparator)e.push([o,sv.ArgumentSeparator]),++a;else if(o===this.options.stringQuote){for(h=!1,e.push([o,sv.StringQuote]),l="";++a<i;){if(o=t.charAt(a),o===this.options.stringQuote){h=!0,++a;break}l+=o}e.push([l,sv.String]),h&&e.push([this.options.stringQuote,sv.StringQuote])}else e.push([o,sv.Unknown]),++a;n=e[e.length-1]}return e}}function uv(t,e,i=null,o=!0){return t+=e,0==e?t:t>=0?i?o?t%i:Math.min(t,i-1):t:o&&i?i+t%i:Math.max(t,0)}const pv=/(?:'?([\w\s]*)'?!)?(\$?)([a-z]*)(\$?)(\d*)(?::(\$?)([a-z]*)(\$?)(\d*))?/i;class gv{constructor(t,e,i,o,r){this.setCoords(t,e,i,o),this.sheet=r}setCoords(t,e,i,o){this.c1=null==t&&null==i?0:t,this.r1=null==e&&null==o?0:e,this.c2=null==o&&null!=t||null!=i?null==i?t:i:1/0,this.r2=null==i&&null!=e||null!=o?null==o?e:o:1/0,this.normalize()}get size(){return{columns:this.c2-this.c1+1,rows:this.r2-this.r1+1}}get count(){const{columns:t,rows:e}=this.size;return t*e}normalize(){const[t,e]=[Math.min(this.c1,this.c2),Math.max(this.c1,this.c2)],[i,o]=[Math.min(this.r1,this.r2),Math.max(this.r1,this.r2)];return this.c1=t,this.c2=e,this.r1=i,this.r2=o,this}move(t,e,i=null,o=null,r=!0){const s=uv(this.c1,t,i,r);r&&(e+=this.c1+t!=s&&0!=t?t>0?1:-1:0),this.c1=s,this.r1=uv(this.r1,e,o,r),this.c2=uv(this.c2,t,i,r),this.r2=uv(this.r2,e,o,r)}contains(t){return t.c1>=this.c1&&t.c2<=this.c2&&t.r1>=this.r1&&t.r2<=this.r2}containsColumn(t){return this.c1<=t&&this.c2>=t}containsRow(t){return this.r1<=t&&this.r2>=t}removeAnchors(){return this.c1Anchor=!1,this.c2Anchor=!1,this.r1Anchor=!1,this.r2Anchor=!1,this}addAnchors(){return this.c1Anchor=!0,this.c2Anchor=!0,this.r1Anchor=!0,this.r2Anchor=!0,this}shiftLeft(t,e=1,i=null,o=!1){return t<=this.c1&&(o||!this.c1Anchor)&&(null==i||this.c1<=i)&&(this.c1-=e),t<=this.c2&&(o||!this.c2Anchor)&&(null==i||this.c2<=i)&&(this.c2-=e),this}shiftRight(t,e=1,i=null,o=!1){return t<=this.c1&&(o||!this.c1Anchor)&&(null==i||this.c1<=i)&&(this.c1+=e),t<=this.c2&&(o||!this.c2Anchor)&&(null==i||this.c2<=i)&&(this.c2+=e),this}shiftUp(t,e=1,i=null,o=!1){return t<=this.r1&&(o||!this.r1Anchor)&&(null==i||this.r1<=i)&&(this.r1-=e),t<=this.r2&&(o||!this.r2Anchor)&&(null==i||this.r2<=i)&&(this.r2-=e),this}shiftDown(t,e=1,i=null,o=!1){return t<=this.r1&&(o||!this.r1Anchor)&&(null==i||this.r1<=i)&&(this.r1+=e),t<=this.r2&&(o||!this.r2Anchor)&&(null==i||this.r2<=i)&&(this.r2+=e),this}shift(t){const{index:e,offset:i,direction:o,maxIndex:r,ignoreAnchors:s}=t;switch(o){case"down":return this.shiftDown(e,i,r,s);case"up":return this.shiftUp(e,i,r,s);case"left":return this.shiftLeft(e,i,r,s);case"right":return this.shiftRight(e,i,r,s)}}intersect(t){this.normalize(),t.normalize();const e=Math.max(t.c1,this.c1),i=Math.min(t.c2,this.c2),o=Math.max(t.r1,this.r1),r=Math.min(t.r2,this.r2);return e<=i&&o<=r?new gv(e,o,i,r,this.sheet):null}unite(t){return this.normalize(),t.normalize(),new gv(Math.min(this.c1,t.c1),Math.min(this.r1,t.r1),Math.max(this.c2,t.c2),Math.max(this.r2,t.r2),this.sheet)}clone(){const t=new gv(this.c1,this.r1,this.c2,this.r2,this.sheet);return t.c1Anchor=this.c1Anchor,t.r1Anchor=this.r1Anchor,t.c2Anchor=this.c2Anchor,t.r2Anchor=this.r2Anchor,t}equals(t,e=!1){return t.c1==this.c1&&t.r1==this.r1&&t.c2==this.c2&&t.r2==this.r2&&(0==e||t.c1Anchor==this.c1Anchor&&t.r1Anchor==this.r1Anchor&&t.c2Anchor==this.c2Anchor&&t.r2Anchor==this.r2Anchor)}get isCell(){return this.c2==this.c2&&this.r2==this.r1}get isRange(){return this.c2!=this.c1||this.r2!=this.r1}get isColumn(){return 0==this.r1&&this.r2==1/0}get isRow(){return 0==this.c1&&this.c2==1/0}get A1(){const t=this.isRange,e=(this.c1Anchor?"$":"")+(0!==this.c1||this.c2!==1/0?vv(this.c1):"")+(0===this.r1&&this.r2===1/0?"":(this.r1Anchor?"$":"")+mv(this.r1)),i=t?(this.c2Anchor?"$":"")+(!isNaN(this.c2)&&this.c2<1/0?vv(this.c2):"")+(this.r2Anchor?"$":"")+(!isNaN(this.r2)&&this.r2<1/0?mv(this.r2):""):e;return(null==this.sheet?"":((o=this.sheet).indexOf(" ")>-1?"'"+o+"'":o)+"!")+(e==i?e:e+":"+i);var o}get bounds(){return[[new gv(this.c1,this.r1),this.c2<1/0?new gv(this.c2,this.r1):null],[this.r2<1/0?new gv(this.c1,this.r2):null,this.r2<1/0&&this.c2<1/0?new gv(this.c2,this.r2):null]]}*cells(){for(let t=this.r1;t<=this.r2;t++)for(let e=this.c1;e<=this.c2;e++)yield new gv(e,t)}static fromA1(t){const e=pv.exec(t),i=new gv(e[3]?bv(e[3]):null,e[5]?fv(e[5]):null,e[7]?bv(e[7]):null,e[9]?fv(e[9]):null,e[1]||null);return!e[2]&&e[3]||(i.c1Anchor=!0),!e[4]&&e[5]||(i.r1Anchor=!0),(e[6]||e[2]&&!e[7])&&(i.c2Anchor=!0),(e[8]||e[4]&&!e[9])&&(i.r2Anchor=!0),i}}function mv(t){return(t+1).toString()}function fv(t){return parseInt(t)-1}function vv(t){++t;let e,i="";for(;t>0;)e=(t-1)%26,i=String.fromCharCode(e+65)+i,t=(t-e-1)/26;return i}function bv(t){const e=t.length;let i=0;for(let o=0;o<e;o++)i+=(t.charCodeAt(o)-64)*Math.pow(26,e-o-1);return i-1}function yv(t){return t.sort(((t,e)=>{const i=Math.min(t.r1,t.r2),o=Math.min(e.r1,e.r2),r=Math.min(t.c1,t.c2),s=Math.min(e.c1,e.c2);return i<o?-1:i>o?1:r<s?-1:s>r?1:0}))}function wv(t){return t.formula.cells.map((e=>t.cell.model.getCellByRange(e[1])))}function xv(t){let e=t;for(;Array.isArray(e);)e=e.length>0?e[0]:null;return e}function kv(t){return Array.isArray(t)?t:[[t]]}function Cv(t,e,i,o){if(!Array.isArray(t))return e(t,i,o);for(let o=0;o<t.length;o++)if(!1===Cv(t[o],e,null==i?o:i,null==i?void 0:o))return!1}gv.fromA1s=(t,e=";")=>t.split(e).map((t=>gv.fromA1(t))),gv.toA1s=(t,e=";")=>t.map((t=>t.A1)).join(e),gv.fromCoords=t=>new gv(t.c1,t.r1,t.c2,t.r2),gv.fullColumn=t=>new gv(t,0,t,1/0),gv.fullRow=t=>new gv(0,t,1/0,t);const Mv=new Set(["SUMPRODUCT","FILTER"]),_v=t=>Mv.has(t),Sv=t=>!!(t&&t.length>0&&"="==t.charAt(0)),Ev=t=>Sv(t)?t:"="+(t??""),zv=t=>Sv(t)?t.substring(1):t,Iv=["#5B97FF","#FF616B","#B77CFF","#00B02C","#FC58BE","#FF9000","#2EB0B3"],Lv=t=>Iv[t%Iv.length],Rv=new Map([["FORMULATEXT","_xlfn."],["CONCAT","_xlfn."],["INDIRECT","_xlfn."],["ISOWEEKNUM","_xlfn."],["SWITCH","_xlfn."],["XOR","_xlfn."]]);class Tv{get fn(){return this._fn??(this._fn=new Function("t","ctx","return "+this.compile()))}get tokens(){return this._tokens}get variables(){return this._variables}get cells(){return this._cells}get ranges(){return this._ranges}get colors(){if(!this._colors){let t;this._colors=new Map,this._tokens.forEach(((e,i)=>{if([sv.Cell,sv.Range].includes(e[1])){const o=(t?"'"+t+"'!":"")+e[0];this._colors.set(o,{color:Lv(this._colors.size),address:e[0],sheet:t,type:e[1],tokenIndex:i}),t=null}else e[1]==sv.Sheet&&(t=e[0])}))}return this._colors}constructor(t,e){this.expression=t,this.tokenizer=e,this._tokens=e.tokenize(this.expression),this.updateDependecies()}findTokenIndexAtPosition(t){let e=0;return this._tokens.findIndex((i=>{const o=i[0].length;if(t>=e&&t<=e+o)return!0;e+=o}))}findSheetTokenIndex(t){const e=this._tokens[t];if(![sv.Cell,sv.Range].includes(e[1]))return-1;if(0==t||this._tokens[t-1][1]!=sv.SheetSeparator)return-1;let i=t-2;for(;i>=0;){if(this._tokens[i][1]==sv.Sheet)return i;i--}return-1}removeSheetToken(t){if(this._tokens[t][1]!=sv.Sheet&&(t=this.findSheetTokenIndex(t)),t>-1){t>0&&this._tokens[t-1][1]==sv.SheetQuote&&t--;let e=t;for(;e<this._tokens.length&&[sv.SheetSeparator,sv.SheetQuote,sv.Sheet].includes(this._tokens[e][1]);)e++;return this._tokens.splice(t,e-t),e-t}return 0}getNamedColor(t){return this.colors.get(t)?.color??"inherit"}getTokenPosition(t){let e=0;for(let i=0;i<t;i++)e+=this._tokens[i][0].length;return{min:e,max:e+this._tokens[t][0].length}}updateToken(t,e){this._fn=null,this._formula=null,this._xlFormula=null,this._tokens[t][0]=e}removeToken(t){this._fn=null,this._formula=null,this._xlFormula=null,this._tokens.splice(t,1)}insertToken(t,e,i){this._fn=null,this._formula=null,this._xlFormula=null;const o=[];return i==sv.Sheet&&/\s/.test(e)?(o.push([this.tokenizer.options.sheetQuote,sv.SheetQuote]),o.push([e,sv.Sheet]),o.push([this.tokenizer.options.sheetQuote,sv.SheetQuote])):o.push([e,i]),o.push(["!",sv.SheetSeparator]),this._tokens.splice(t,0,...o),o.length}clone(){return new Tv(this.createFormulaString(),this.tokenizer)}updateDependecies(){let t;this._variables=[],this._cells=[],this._ranges=[],this._tokens.forEach(((e,i)=>{switch(e[1]){case sv.Sheet:t=e[0];break;case sv.Variable:this._variables.push([i,e[0],t]),t=void 0;break;case sv.Cell:this._cells.push([i,gv.fromA1(e[0]),t]),t=void 0;break;case sv.Range:this._ranges.push([i,gv.fromA1(e[0]),t]),t=void 0}}))}createFormulaString(t=!1,e=!1){const i=this.tokenizer.options;let o,r,s,n="";for(let l=0;l<this._tokens.length;l++)switch(o=this._tokens[l],o[1]){case sv.SheetQuote:n+="'";break;case sv.SheetSeparator:n+="!";break;case sv.Sheet:r=o[0],n+=t?`<span style="font-style:italic">${r}</span>`:r;break;case sv.Variable:n+=o[0];break;case sv.Range:case sv.Cell:s=(r?"'"+r+"'!":"")+o[0],n+=t?`<span style="color:${this.getNamedColor(s)}">${o[0]}</span>`:o[0],r=null;break;case sv.StringQuote:n+=i.stringQuote;break;case sv.String:n+=o[0].replace(new RegExp(i.stringQuote,"g"),"\\"+i.stringQuote);break;case sv.ArgumentSeparator:n+=i.argumentSeparator;break;case sv.Function:n+=(e?(a=o[0],Rv.get(a)??""):"")+o[0];break;case sv.Unknown:n+=t?`<span style="background:#f00;color:#fff">${o[0]}</span>`:o[0];break;default:n+=o[0]}var a;return n}createExpressionTree(){const t=[],e=[],i=this.tokens;let o,r,s,n,a,l=null;for(let c=0;c<i.length;c++)switch(o=i[c],o[1]){case sv.Sheet:l=o[0];break;case sv.Cell:case sv.Range:t.push({t:o[0],tt:o[1],s:l}),l=null;break;case sv.Number:case sv.String:case sv.Boolean:case sv.Variable:t.push({t:o[0],tt:o[1]});break;case sv.Operator:for(0==t.length&&t.push({t:"",tt:sv.Operand}),s=Jf.get(o[0]);e.length>0&&(n=Jf.get(e[e.length-1][0]),n)&&(0===s[2]&&s[1]<=n[1]||1===s[2]&&s[1]<n[1]);)r=e.pop(),a=[t.pop(),t.pop()].reverse(),t.push({t:r[0],tt:r[1],c:a});e.push(o);break;case sv.Function:case sv.OpenBracket:e.push(o);break;case sv.ArgumentSeparator:for(;e.length>0&&(r=e[e.length-1],![sv.OpenBracket,sv.ArgumentSeparator].includes(r[1]));)r=e.pop(),a=[t.pop(),t.pop()].reverse(),t.push({t:r[0],tt:r[1],c:a});e.push(o);break;case sv.CloseBracket:for(a=[];e.length>0&&e[e.length-1][1]!==sv.OpenBracket;)r=e.pop(),r[1]==sv.Operator?a.push({t:r[0],tt:r[1],c:[t.pop(),t.pop()].reverse()}):r[1]==sv.ArgumentSeparator&&t.length>0&&a.push(t.pop());e.pop(),e.length>0&&e[e.length-1][1]===sv.Function?(r=e.pop(),a=a.reverse(),t.length>0&&i[c-1][1]!==sv.OpenBracket&&a.unshift(t.pop()),t.push({t:r[0],tt:r[1],c:a})):t.push(...a)}for(;e.length>0;)r=e.pop(),t.push({t:r[0],tt:r[1],c:[t.pop(),t.pop()].reverse()});return t.pop()}createExpressionJSCode(t,e,i){let o;switch(t.tt){case sv.Range:return"t.rn('"+t.t+"'"+(t.s?",'"+t.s+"'":"")+")";case sv.Cell:return"t.cl('"+t.t+"'"+(t.s?",'"+t.s+"'":"")+")";case sv.Operand:return"t.cl()";case sv.Variable:return i||e?.tt===sv.Function?"t.nr('"+t.t+"'"+(t.s?",'"+t.s+"'":"")+")":"t.nv('"+t.t+"'"+(t.s?",'"+t.s+"'":"")+")";case sv.String:return"'"+t.t.replace(/'/g,"\\'")+"'";case sv.Boolean:return"T"==t.t[0].toUpperCase()?"1":"0";case sv.Function:return o=t.c.map((e=>this.createExpressionJSCode(e,t,i||_v(t.t)))),"t.fn('"+t.t+"').call(ctx"+(o.length>0?","+o.join(","):"")+")";case sv.Operator:return i?(o=t.c.map((e=>this.createExpressionJSCode(e,t,i||_v(t.t)))),"t.op("+o[0]+","+o[1]+",'"+t.t+"')"):Jf.has(t.t)?"("+t.c.map((e=>this.createExpressionJSCode(e,t,i))).join(Jf.get(t.t)[0])+")":null;default:return t.t}}compile(){const t=this.createExpressionTree();return this.createExpressionJSCode(t)}toString(t=!1){return(t?"=":"")+(this._formula??(this._formula=this.createFormulaString()))}toExcelString(){return this._xlFormula??(this._xlFormula=this.createFormulaString(!1,!0))}shift(t){const{index:e,offset:i,direction:o,maxIndex:r,sheet:s,allSheets:n}=t;return this._cells&&this._cells.forEach((t=>{if(n||null==t[2]||t[2]==s){switch(o){case"up":t[1].shiftUp(e,i,r);break;case"right":t[1].shiftRight(e,i,r);break;case"down":t[1].shiftDown(e,i,r);break;case"left":t[1].shiftLeft(e,i,r)}this._tokens[t[0]][0]=t[1].A1}})),this._ranges&&this._ranges.forEach((t=>{if(n||null==t[2]||t[2]==s){switch(o){case"up":t[1].shiftUp(e,i,r);break;case"right":t[1].shiftRight(e,i,r);break;case"down":t[1].shiftDown(e,i,r);break;case"left":t[1].shiftLeft(e,i,r)}this._tokens[t[0]][0]=t[1].A1}})),this}hasSheetReference(t){for(const e of this._cells)if(e[2]==t)return!0;for(const e of this._ranges)if(e[2]==t)return!0;for(const e of this._variables)if(e[2]==t)return!0;return!1}renameSheet(t,e){let i=!1;return this._tokens.forEach((o=>{o[1]==sv.Sheet&&o[0]==t&&(o[0]=e,i=!0)})),i}}function Av(t,e){return e&&(t=ur(this.cell.model.options.locale,vr(e,"d"),!1)(t)),null==t?"":t.toString()}function Ov(t,e){return(t=null==t?"":t.toString()).substring(0,e)}function $v(t,e){return(t=null==t?"":t.toString()).substring(Math.max(0,t.length-e),t.length)}function Dv(t,e,i){return(t=null==t?"":t.toString()).substring(e,e+i)}function Nv(...t){let e="";return Cv(t,(t=>e+=null==t?"":t.toString())),e}function Pv(...t){return Nv(...t)}function jv(t){return(t=null==t?"":t.toString()).length}function Hv(t){return(t=null==t?"":t.toString()).toLowerCase()}function Fv(t){return(t=null==t?"":t.toString()).toUpperCase()}function Bv(t){return t instanceof Date?t:Q(t)?Yo(t,Eo()):rr(t)}function Wv(t){return tt(t)?t:or(t instanceof Date?t:Yo(t,Eo()))}function Vv(t){return Q(t)?Wv(t):t}function Uv(t,e){const i=Bv(t).getDay();switch(e){case 2:return i;case 3:return i-1;default:return i%7+1}}function Gv(t,e,i){return sr(Wv(xv(t)),e)}function qv(){return or(ne(new Date))}function Yv(t){return null==(t=xv(t))||""===t}function Zv(t,e,i){return or(new Date(t,e-1,i))}function Xv(t){return Bv(t).getFullYear()}function Qv(t){return Bv(t).getMonth()+1}function Kv(t){return Bv(t).getDate()}function Jv(t,e){const i=Bv(t);return i.setMonth(i.getMonth()+e+1),i.setDate(0),or(i)}function tb(t){return xi(Bv(t))}function eb(t){return Math.acos(t)}function ib(t){return Math.acosh(t)}function ob(t){return Math.PI/2-Math.atan(t)}function rb(t){return.5*Math.log((t+1)/(t-1))}function sb(t){return Math.asin(t)}function nb(t){return Math.asinh(t)}function ab(t){return Math.atan(t)}function lb(t){return Math.atanh(t)}function cb(t){return Math.cos(t)}function hb(t){return Math.cosh(t)}function db(t){return 1/Math.tan(t)}function ub(t){return 1/Math.tanh(t)}function pb(t){return 1/Math.sin(t)}function gb(t){return 1/Math.sinh(t)}function mb(t){return 180*t/Math.PI}function fb(){return Math.PI}function vb(t){return 1/Math.cos(t)}function bb(t){return 1/Math.cosh(t)}function yb(t){return Math.sin(t)}function wb(t){return Math.sinh(t)}function xb(t){return Math.tan(t)}function kb(t){return Math.tanh(t)}function Cb(t){return Math.abs(t)}function Mb(t){if(t<0)throw new Error("#NUM");return Math.ceil(t)}function _b(t){return(t=Math.ceil(t))%2==0?t:t+1}function Sb(t){return Math.pow(Math.E,t)}function Eb(t){return t<0?-1:0==t?1:t*Eb(t-1)}function zb(t){return t<=0?1:t*zb(t-2)}function Ib(t){return Math.floor(t)}function Lb(t){return t%1!=0}function Rb(t){return!Lb(t)&&t%2==0}function Tb(t){return Lb(t)||t%2==1}function Ab(t){return Math.log(t)}function Ob(t,e){return Math.log(t)/Math.log(e)}function $b(t){return Math.log10(t)}function Db(t,e){return t%e}function Nb(t){return(t=Math.ceil(t))%2==0?t+1:t}function Pb(t,e){return Math.pow(t,e)}function jb(...t){let e=1;return Cv(t,(t=>e*=t||1)),e}function Hb(t,e){return Math.floor(t/e)}function Fb(t){return t*Math.PI/180}function Bb(){return Math.random()}function Wb(t,e){const i=Array(t).fill(null).map((()=>Array(e)));for(let o=0;o<t;o++)for(let t=0;t<e;t++)i[o][t]=Math.random();return i}function Vb(t,e){return t=Math.ceil(t),e=Math.floor(e),Math.floor(Math.random()*(e-t+1))+t}function Ub(t,e){return t.toFixed(e)}function Gb(t,e){return e=e||0,Math.floor(t*Math.pow(10,e))/Math.pow(10,e)}function qb(t,e){return e=e||0,Math.ceil(t*Math.pow(10,e))/Math.pow(10,e)}function Yb(t,e,i=1,o=1){const r=Array(t).fill(null).map((()=>Array(e)));let s=i;for(let i=0;i<t;i++)for(let t=0;t<e;t++)r[i][t]=s,s+=o;return r}function Zb(t){return t<0?-1:t>0?1:0}function Xb(t){return Math.sqrt(t)}function Qb(t){return Math.sqrt(Math.PI*t)}function Kb(...t){let e=0;return Cv(t,(t=>e+=null==t?0:1)),e}function Jb(...t){let e=0;return Cv(t,(t=>e+=null==t?1:0)),e}function ty(t,e){let i=0;return Cv(t,(t=>i+=Kf(e,t)?1:0)),i}function ey(...t){let e=0;const i=new Map;return Cv(t,(t=>{i.has(t)||(i.set(t,t),++e)})),e}function iy(...t){let e=0;return Cv(t,(t=>e+=isNaN(t)||null==t||""===t?0:t)),e}function oy(t,e,i){let o=0;if(i){const r=kv(i);Cv(t,((t,i,s)=>o+=Kf(e,t)&&r[i]&&r[i][s]&&!isNaN(r[i][s])?r[i][s]:0))}else Cv(t,(t=>o+=Kf(e,t)&&!isNaN(t)?t:0));return o}function ry(t,e){let i=0;return Cv(t,(t=>i+=Kf(e,t)&&!isNaN(t)?t*t:0)),i}function sy(...t){let e=0;const i=t.shift();if(0===t.length)Cv(i,(t=>e+=isNaN(t)?0:t));else{const o=kv(t[0]);Cv(i,((t,i,r)=>e+=o[i]&&o[i][r]&&!isNaN(t)&&!isNaN(o[i][r])?t*o[i][r]:0))}return e}function ny(t,e){return t=null==t?"":t.toString(),e?e=>e==t:(t=t.toLowerCase(),e=>(e??"").toString().toLowerCase()==t)}function ay(t,e,i=1){const o=new gv(Math.max((e||0)-1,0),Math.max((t||0)-1,0));return 1!=i&&2!=i||(o.r1Anchor=!0),1!=i&&3!=i||(o.c1Anchor=!0),o.A1}function ly(t,e,i,o=!1){let r,s;const n=ny(t,o);for(r=0;r<e.length;r++)for(s=0;s<e[r].length;s++)if(n(e[r][s]))return e[r][i-1];return null}function cy(t,e,i,o=!1){let r,s;const n=ny(t,o);for(r=0;r<e.length;r++)for(s=0;s<e[r].length;s++)if(n(e[r][s]))return e[i-1][s];return null}function hy(t,e,i){let o,r;t:for(o=0;o<e.length;o++)for(r=0;r<e[o].length;r++)if(e[o][r]==t)break t;return i?i[o]?i[o][r]:null:e[o][e[o].length-1]}function dy(t,...e){let i=null,o=0;return Cv(e,(e=>{if(t==++o)return i=e,!1})),i}function uy(t){return(t?gv.fromA1(t).c1:this.cell.c)+1}function py(t){return(t?gv.fromA1(t).r1:this.cell.r)+1}function gy(t){return Array.isArray(t)?t[0]?.length:1}function my(t){return Array.isArray(t)?t.length:1}function fy(){const t=wv(this)[0];return t&&t.hasFormula?" "+Ev(t.formula):""}function vy(t,e,i){return e=e||1,i=i||1,Array.isArray(t)?t[e-1]?t[e-1][i-1]:null:1==e&&1==i?t:null}function by(t){const e=this.cell,i=e.model,o=i.getCellByA1(t);let r;return i.calculations.dependencies.cellDependencies.has(e.address)?r=i.calculations.dependencies.cellDependencies.get(e.address):(r=new Map,i.calculations.dependencies.cellDependencies.set(e.address,r)),r.set(o.address,[o.range]),i.calculations.dependencies.cellDependants.has(o.address)?r=i.calculations.dependencies.cellDependants.get(o.address):(r=new Map,i.calculations.dependencies.cellDependants.set(o.address,r)),r.set(e.address,[e.range]),o.value}function yy(t,e,i=0){let o,r;for(o=0;o<e.length;o++)for(r=0;r<e[o].length;r++){if(0==i&&e[o][r]==t)return Math.max(o+1,r+1);if(1==i&&e[o][r]>t)return Math.max(o+1,r+1);if(-1==i&&e[o][r]<t)return Math.max(o+1,r+1)}return null}function wy(t,e,i,o,r){const s=wv(this)[0],n=[];o=o||1,r=r||1;for(let t=0;t<o;t++){const o=[];for(let n=0;n<r;n++){const r=s.model.rows[s.r+t+e].cell(s.c+n+i);o.push(r?s.value:null)}n.push(o)}return n}function xy(t,e){const i=[];if(t.length==e.length)for(let o=0;o<t.length;o++){let r=!0;for(let t=0;t<e[o].length;t++)if(!e[o][t]){r=!1;break}r&&i.push(t[o])}return i}const ky=[[3.1611237438705655,113.86415415105016,377.485237685302,3209.3775891384694,.18577770618460315],[.5641884969886701,8.883149794388377,66.11919063714163,298.6351381974001,881.952221241769,1712.0476126340707,2051.0783778260716,1230.3393547979972,2.1531153547440383e-8],[.30532663496123236,.36034489994980445,.12578172611122926,.016083785148742275,.0006587491615298378,.016315387137302097]],Cy=[[23.601290952344122,244.02463793444417,1282.6165260773723,2844.236833439171],[15.744926110709835,117.6939508913125,537.1811018620099,1621.3895745666903,3290.7992357334597,4362.619090143247,3439.3676741437216,1230.3393548037495],[2.568520192289822,1.8729528499234604,.5279051029514285,.06051834131244132,.0023352049762686918]];function My(t){const e=t*t;let i,o=ky[0][4]*e,r=e;for(i=0;i<3;i+=1)o=(o+ky[0][i])*e,r=(r+Cy[0][i])*e;return t*(o+ky[0][3])/(r+Cy[0][3])}function _y(...t){let e=!0;return Cv(t,(t=>{if(!t)return e=!1})),e}function Sy(...t){let e=!1;return Cv(t,(t=>{if(t)return e=!0})),e}function Ey(...t){let e=null;return Cv(t,(t=>{e=null===e?!!t:!!t!=e})),e}function zy(...t){const e=t[0];for(let i=1;i<t.length;i+=2){if(i==t.length-1)return t[i];if(e==t[i])return t[i+1]}return null}function Iy(t,e,i){return t?e:i}function Ly(t){return!t}function Ry(){return!1}function Ty(){return!0}function Ay(t,e){return e=""===e?null:e,this.cell.hasError?(this.cell.error.handled=!0,e):t===1/0||t===-1/0||Number.isNaN(t)?e:t}var Oy=i(235),$y=i.n(Oy),Dy=i(5949),Ny=i.n(Dy);function Py(...t){let e=0,i=0;return Cv(t,(t=>{null==t||isNaN(t)||(e+=t||0,++i)})),e/i}function jy(t,e){const i=Ny()(),o=kv(t),r=kv(e);for(let t=0;t<o.length;t++)for(let e=0;e<o[t].length;e++)i(o[t][e],(r[t]?r[t][e]:1)??1);return i()}function Hy(...t){const e=function(t){const e=[];return Cv(t,(t=>e.push(t))),e}(t),i=$y()(e.length,e,1);return e.reduce(((t,e)=>t+Math.abs(e-i)),0)/e.length}function Fy(...t){let e=1/0;return Cv(t,(t=>e=Math.min(e,t))),e}function By(...t){let e=-1/0;return Cv(t,(t=>e=Math.max(e,t))),e}function Wy(t,e){Object.keys(e).forEach((i=>t.set(nt(i,"_").replace(/_/g,".").toUpperCase(),e[i])))}const Vy=new Map;Wy(Vy,_),Wy(Vy,S),Wy(Vy,E),Wy(Vy,z),Wy(Vy,L),Wy(Vy,I),Wy(Vy,R);class Uy{constructor(t){this.model=t,this.getModel=t=>{const e=t?this.model.getConnectedModel(t):this.model;if(e)return e;throw new Error(`Sheet "${t}" not found`)},this.cl=(t,e)=>{const i=this.getModel(e);if(null==t)return this.currentCell.value;const o=i.getCellByA1(t);return o?o.value:(this.currentCell.error={message:`undefined cell ${t}`},null)},this.rn=(t,e)=>this.getModel(e).getValuesInRange(gv.fromA1(t)),this.nv=(t,e)=>this.getModel(e).getCellByName(t,this.currentCell.range).value,this.nr=(t,e)=>{const i=this.getModel(e).getValueMatrixByName(t);return 1===i.length&&1===i[0].length?i[0][0]:i},this.fn=t=>{const e=Vy.get(t);if(e)return e;throw new Error(`Function "${t}" not found`)},this.op=(t,e,i)=>rv(t,e,i)}}function Gy(t,e){const i=Array(e).fill(null);let o=0,r=[];if(t.length>1){r=t.map((t=>parseFloat(t.value)||0)),o=r[1]-r[0];for(let t=2;t<r.length;t++)if(r[t]-r[t-1]!==o){o=0;break}}if(0==o)for(let o=0;o<e;o++)i[o]=t[o%t.length]?.value;else{let t=r[r.length-1];for(let r=0;r<e;r++)t=i[r]=t+o}return i}function qy(t,e,i){const o=new Tv(t.formula,t.model.calculations.tokenizer),r=[];for(let t=0;t<i;t++)r.push(Ev(o.shift({index:0,offset:1,direction:e,allSheets:!0}).createFormulaString()));return r}function Yy(t,e,i,o){const r=t.getCellMatrix(e);let s;"right"==o?s=qr(r):"down"==o?s=Gr(r):"left"==o?s=Vr(r):"up"==o&&(s=Vr(Gr(r)));const n=new Array(i.size.rows);for(let t=0;t<i.size.rows;t++){n[t]=new Array(i.size.columns);for(let e=0;e<i.size.columns;e++){const i=r.length>t?r[t][r[t].length>e?e:0]:r[0][e];n[t][e]=i.hasDisplayValue?i.displayValue:null}}const a=i.size["down"==o||"up"==o?"rows":"columns"];let l=s.map((t=>t[t.length-1].hasFormula?qy(t[t.length-1],o,a):Gy(t,a)));return"down"==o?l=Gr(l):"left"==o?l=Vr(l):"up"==o&&(l=Ur(Gr(l))),t.spillValues({cell:t.getCellByRange(i.bounds[0][0]),values:l,propertyCell:t.getCellByRange(e.bounds[0][0]),displayValues:n})}function Zy(t){return t.pattern&&"string"==typeof t.pattern&&(t.pattern=new RegExp(t.pattern)),t}function Xy(t,e){const i=t.validation;if(!i)return!0;if(i.allowInvalid)return!0;let o=!0;return i.pattern&&(i.pattern.test((e??"").toString())||(o=!1)),i.validate&&(i.validate(t,e)||(o=!1)),o}class Qy{get address(){return null}get renderer(){return this._renderer}set renderer(t){this._renderer=t}get afterRenderer(){return this._afterRenderer}set afterRenderer(t){this._afterRenderer=t}get commentRenderer(){return this._commentRenderer}set commentRenderer(t){this._commentRenderer=t}get type(){return this._type}set type(t){this._type=t}get name(){return this._name}set name(t){this._name=t}get style(){return this._style}set style(t){this._style=t}get commentable(){return this._commentable}set commentable(t){this._commentable=t}get clickable(){return this._clickable}set clickable(t){this._clickable=t}get editable(){return this._editable}set editable(t){this._editable=t}get validation(){return this._validation}set validation(t){this._validation=t}get hasFormula(){return!!this._formula}get formula(){return this._formula}set formula(t){this._formula=t?t.replace(/^=/,""):null}get value2(){return this.hasFormula?Ev(this.formula):null}get editorContent(){return this._editorContent}set editorContent(t){this._editorContent=t}get adapter(){return this._adapter}set adapter(t){this._adapter=t}get properties(){return this._properties}set properties(t){this._properties=t}getProperty(t){return this._properties?.[t]}setProperty(t,e){this._properties||(this._properties={}),this._properties[t]=e}get format(){return this._format}set format(t){this._format=t,this._valueFormatter=null}get valueFormatter(){return this._valueFormatter}constructor(t,e){this.model=t,this._type=null,this._clickable=!1,e&&this.populate(e)}populate(t){this._renderer=t.renderer,this._afterRenderer=t.afterRenderer,this._commentRenderer=t.commentRenderer,this._name=t.name,this._type=t.t,this._editorContent=t.content,this._adapter=t.adapter,this._format=t.z,this._formula=t.f,this._editable=t.e,this._commentable=t.commentable,this._clickable=t.clickable,this._validation=t.validation?Zy(t.validation):null,this._properties=t.props,this._style=null==t.s?null:this.model.styles.add(t.s)?.id}update(t){const e={};if("renderer"in t&&(e.renderer=this._renderer,this._renderer=t.renderer),"afterRenderer"in t&&(this._afterRenderer=t.afterRenderer),"commentRenderer"in t&&(this._commentRenderer=t.commentRenderer),"name"in t&&(e.name=this._name,this._name=t.name),"t"in t&&(e.t=this._type,this._type=t.t),"content"in t&&(e.content=this._editorContent,this._editorContent=t.content),"adapter"in t&&(e.adapter=this._adapter,this._adapter=t.adapter),"z"in t&&(e.z=this._format,this._format=t.z),"f"in t&&(e.f=this._formula,this._formula=t.f),"e"in t&&(e.e=this._editable,this._editable=t.e),"commentable"in t&&(e.commentable=this._commentable,this._commentable=t.commentable),"clickable"in t&&(e.clickable=this._clickable,this._clickable=t.clickable),"validation"in t&&(e.validation=this._validation,this._validation=Zy(t.validation)),"props"in t&&(e.props=this._properties,this._properties=t.props),"s"in t){const i=this.model.styles.add(t.s).id;this._style!==i&&(e.s=this._style,this._style=i)}return e}getSourceData(){const t={};return null!=this._type&&(t.t=this._type),null!=this._format&&(t.z=this._format),null!=this._formula&&(t.f=this._formula),null!=this._editable&&(t.e=this._editable),null!=this._commentable&&(t.commentable=this._commentable),null!=this._clickable&&(t.clickable=this._clickable),this._properties&&(t.props=rt(this._properties)),null!=this._editorContent&&(t.content=Z(this._editorContent)?rt(this._editorContent):this._editorContent),null!=this._style&&(t.s=this._style),null!=this._name&&(t.name=this._name),t}setStyleProperties(t,e=!1){this.style=e?this.model.styles.set(this.style,t).id:this.model.styles.duplicate(this.style,t).id}removeStyleProperties(t){null!==this.style&&this.model.styles.unset(this.style,t)}get composedStyle(){return this.model.styles.get(this.style)}}function Ky(t){const e={};return t.split(";").forEach((t=>{const[i,o]=t.split(":");e[i]=o.trim()})),e}const Jy=new Map([["thin",{width:1.5,style:"solid"}],["medium",{width:2,style:"solid"}],["thick",{width:3,style:"solid"}],["double",{width:3,style:"double"}],["dotted",{width:1.5,style:"dotted"}],["hair",{width:1,style:"solid"}],["dashed",{width:1.5,style:"dashed"}],["mediumDashed",{width:2,style:"dashed"}],["dashDot",{width:1.5,style:"dashed"}],["mediumDashDot",{width:2,style:"dashed"}],["dashDotDot",{width:1.5,style:"dotted"}],["mediumDashDotDot",{width:2,style:"dotted"}],["slantDashDot",{width:1.5,style:"dashed"}],["none",{width:1.5,style:"solid"}]]),tw=(()=>{const t=new Map;return Jy.forEach(((e,i)=>{let o=t.get(e.style);o||(o=t.set(e.style,new Map).get(e.style)),o.set(e.width,i)})),t})();function ew(t){return"middle"==t?"center":t}function iw(t){return 3==(t="#"==t.charAt(0)?t.substring(1):t).length?t[0]+t[0]+t[1]+t[1]+t[2]+t[2]:t}const ow=t=>{if("none"==t)return null;const e=t.split(" "),i=parseInt(e[0].charAt(0))||1,o=e.length>1?e[1]:"solid",r=tw.get(o);return{style:(r?r.get(i):null)??"thin",color:e.length>2?iw(e[2]):"CCCCCC"}},rw=t=>{const e=Jy.get(t.style||"none");return e?[Dt(e.width),e.style,"none"==t.style?"var(--og-cell-background)":t.color?`#${t.color}`:"var(--og-border-color)"].join(" "):"none"},sw=(t,e)=>{const i="#"+(e.fgColor||"000000"),o="#"+(e.bgColor||"FFFFFF");switch(e.patternType){case"solid":t.backgroundColor=i||o;break;case"darkGray":t.backgroundColor=$r(o,.75);break;case"mediumGray":t.backgroundColor=$r(o,.5);break;case"lightGray":t.backgroundColor=$r(o,.25);break;case"gray125":t.backgroundColor=$r(o,.125);break;case"gray0625":t.backgroundColor=$r(o,.0625);break;case"darkHorizontal":t.backgroundImage=`linear-gradient(0deg, ${i} 33.33%, ${o} 33.33%, ${o} 50%, ${i} 50%, ${i} 83.33%, ${o} 83.33%, ${o} 100%)`,t.backgroundSize="6px 6px";break;case"darkVertical":t.backgroundImage=`linear-gradient(90deg, ${i} 33.33%, ${o} 33.33%, ${o} 50%, ${i} 50%, ${i} 83.33%, ${o} 83.33%, ${o} 100%)`,t.backgroundSize="6px 6px";break;case"darkDown":t.backgroundImage=`linear-gradient(45deg, ${i} 33.33%, ${o} 33.33%, ${o} 50%, ${i} 50%, ${i} 83.33%, ${o} 83.33%, ${o} 100%)`,t.backgroundSize="6px 6px";break;case"darkUp":t.backgroundImage=`linear-gradient(-45deg, ${i} 33.33%, ${o} 33.33%, ${o} 50%, ${i} 50%, ${i} 83.33%, ${o} 83.33%, ${o} 100%)`,t.backgroundSize="6px 6px";break;case"lightHorizontal":t.backgroundImage=`linear-gradient(0deg, ${o} 25%, ${i} 25%, ${i} 50%, ${o} 50%, ${o} 75%, ${i} 75%, ${i} 100%)`,t.backgroundSize="4px 4px";break;case"lightVertical":t.backgroundImage=`linear-gradient(90deg, ${o} 25%, ${i} 25%, ${i} 50%, ${o} 50%, ${o} 75%, ${i} 75%, ${i} 100%)`,t.backgroundSize="4px 4px";break;case"lightDown":t.backgroundImage=`linear-gradient(45deg, ${o} 25%, ${i} 25%, ${i} 50%, ${o} 50%, ${o} 75%, ${i} 75%, ${i} 100%)`,t.backgroundSize="4px 4px";break;case"lightUp":t.backgroundImage=`linear-gradient(-45deg, ${o} 25%, ${i} 25%, ${i} 50%, ${o} 50%, ${o} 75%, ${i} 75%, ${i} 100%)`,t.backgroundSize="4px 4px";break;case"darkGrid":t.backgroundImage=`linear-gradient(${o} 0.5px, transparent 0.5px), linear-gradient(90deg, ${o} 0.5px, transparent 0.5px)`,t.backgroundSize="2px 2px";break;case"lightGrid":t.backgroundImage=`linear-gradient(${o} 0.5px, transparent 0.5px), linear-gradient(90deg, ${o} 0.5px, transparent 0.5px)`,t.backgroundSize="1px 1px";break;case"darkTrellis":t.backgroundImage=`linear-gradient(45deg, ${o} 0.5px, transparent 0.5px), linear-gradient(90deg, ${o} 0.5px, transparent 0.5px)`,t.backgroundSize="2px 2px";break;case"lightTrellis":t.backgroundImage=`linear-gradient(45deg, ${o} 0.5px, transparent 0.5px), linear-gradient(90deg, ${o} 0.5px, transparent 0.5px)`,t.backgroundSize="1px 1px"}return t},nw=(t,e)=>(t.backgroundImage=`linear-gradient(${(e.angle??0)+90}deg,${e.stops.map((t=>`#${t.rgb} ${100*t.v}%`)).join(",")})`,t),aw=t=>{const e=t.cssStyle?{...t.cssStyle}:{};return null!=t.bold&&(e.fontWeight=t.bold?"bold":"normal"),t.italic&&(e.fontStyle="italic"),t.underline?e.textDecoration="underline":t.strike&&(e.textDecoration="line-through"),t.sz&&(e.fontSize=$t(t.sz)),t.color&&(e.color="#"+t.color),t.top&&(e.borderTop=rw(t.top)),t.right&&(e.borderRight=rw(t.right)),t.bottom&&(e.borderBottom=rw(t.bottom)),t.left&&(e.borderLeft=rw(t.left)),(t.top||t.right||t.bottom||t.left)&&(e.zIndex="1"),t.alignment&&t.alignment.vertical&&(e.display="flex",e.justifyContent=t.alignment.horizontal,e.alignItems="top"==t.alignment.vertical?"start":"bottom"==t.alignment.vertical?"end":"center"),t.alignment&&t.alignment.horizontal&&(e.textAlign=t.alignment.horizontal),t.alignment&&t.alignment.wrapText&&(e.display="flex",e.justifyContent=e.justifyContent??e.textAlign??"left",e.alignItems=e.alignItems??"center",e.whiteSpace="pre-wrap"),t.patternType?sw(e,t):t.stops&&t.stops.length?nw(e,t):t.fgColor?e.backgroundColor="#"+t.fgColor:t.bgColor&&(e.backgroundColor="#"+t.bgColor),e},lw=t=>{const e=Z(t)?t:Ky(t),i={};let o;for(const t in e){const r=e[t];if(null!=r)switch(t){case"borderTop":case"border-top":i.top=ow(r);break;case"borderTopColor":case"border-top-color":i.top?i.top.color=iw(r):i.top={style:"thin",color:iw(r)};break;case"borderRight":case"border-right":i.right=ow(r);break;case"borderRightColor":case"border-right-color":i.right?i.right.color=iw(r):i.right={style:"thin",color:iw(r)};break;case"borderBottom":case"border-bottom":i.bottom=ow(r);break;case"borderBottomColor":case"border-bottom-color":i.bottom?i.bottom.color=iw(r):i.bottom={style:"thin",color:iw(r)};break;case"borderLeft":case"border-left":i.left=ow(r);break;case"borderLeftColor":case"border-left-color":i.left?i.left.color=iw(r):i.left={style:"thin",color:iw(r)};break;case"border":o=ow(r),i.top=i.top||o,i.right=i.right||o,i.bottom=i.bottom||o,i.left=i.left||o;break;case"textAlign":case"text-align":i.alignment=i.alignment||{},i.alignment.horizontal=r;break;case"verticalAlign":case"vertical-align":i.alignment=i.alignment||{},i.alignment.vertical=ew(r);break;case"whiteSpace":case"white-space":i.alignment=i.alignment||{},i.alignment.wrapText=r&&"nowrap"!=r;break;case"color":i.color=iw(r);break;case"background":case"backgroundColor":i.fgColor=iw(r);break;case"fontSize":case"font-size":i.sz=parseFloat(r);break;case"fontWeight":case"font-weight":i.bold="bold"==r;break;case"fontStyle":case"font-style":i.italic="italic"==r;break;default:i[t]=r}}return i},cw={n:t=>{const e=Q(t)?parseFloat(t):t;return Number.isNaN(e)?t:e},t:t=>t,d:(t,e)=>{if(null==t||""===t)return null;if(Q(t))try{return K(t)?J(t):or(Yo(t,e.model.options.formatLocale))}catch(i){return e.model.logger.error(`Invalid date value in cell ${e.address}: ${t}`),null}return t instanceof Date?or(t):t},tm:t=>Q(t)?new Date(t):t,dt:t=>Q(t)?new Date(t):t,b:t=>!!t&&"0"!==t&&"false"!==t.toString().toLowerCase(),s:t=>t,m:t=>t,g:t=>{if(null==t||""===t)return null;const e=parseFloat(t);return isNaN(e)?t:e},a:t=>Q(t)&&""!==t?JSON.parse(t):t,h:t=>t},hw=new Map;class dw extends Qy{get tooltip(){return this._tooltip}set tooltip(t){this._tooltip=t}get hasTooltip(){return null!=this._tooltip}get merge(){return this.model.merges.mergedCells.get(this.address)}get row(){return this._row}set row(t){this._row=t}get r(){return this._row.index}get column(){return this._column}set column(t){this._column=t}get c(){return this._column.index}get hasValue(){return null!=this._value}get value(){return this._evaluated||this.evaluate(),this._value}set value(t){if(t&&Sv(t.toString()))this._value=void 0,this.formula=t;else{let e=cw[this.type](t,this);Xy(this,e)||(e=void 0),e!==this._value&&(this._value=e,this._displayValue=void 0),this.row.data&&this.column.data&&(this.row.data[this.column.data]=this._value)}}evaluate(){return this._value=cw[this.type](this.model.calculations.evaluate(this),this),this._evaluated=!0,this._value}get value2(){return this.hasFormula?Ev(this.formula):this.value}get hasDisplayValue(){return null!=this._displayValue}get displayValue(){return this._displayValue}set displayValue(t){this._displayValue=t}get prefersDisplayValue(){return["s","m"].includes(this.type)}get error(){return this._error}set error(t){this._error=t}get hasError(){return!!this._error}clearError(){this._error=void 0}get spillRange(){return this._spillRange}get prevSpillRange(){return this._prevSpillRange}set spillRange(t){!this._spillRange||t&&this._spillRange.equals(t)||(this._prevSpillRange=this._spillRange),this._spillRange=t}get isSpillSource(){return null!=this._spillRange}get spillSource(){return this._spillSource}get isSpilled(){return null!=this._spillSource}spillValue(t,e){this.value=t,this._spillSource=e}clearSpilledValue(){this._spillSource=void 0,this._value=void 0}get hasSparkline(){return null===this._sparkline?this._sparkline=this.model.sparklines.has(this.address):this._sparkline}get hasComment(){return null===this._hasComment?this._hasComment=(this.model.comments.get(this.address)??[]).length>0:this._hasComment}get comments(){return this.model.comments.get(this.address)}get valueFormatter(){const t=super.valueFormatter??this.row.valueFormatter??this.column.valueFormatter;if(t)return t;const e=this.type,i=this.format,{formatLocale:o,fixNumberFormat:r}=this.model.options,s=this.value;if(null==s||""===s)return null;if("n"==e)return null!=i?ur(o,i,r):this.model.options.numberFormatter;if("g"==e){if(null!=i)return ur(o,i,r);if(tt(s))return this.model.options.numberFormatter}else{if("t"==e)return null==i?null:ur(o,i,!1);if("d"==e)return i?Zo(o,i):this.model.options.dateFormatter;if("s"==e&&this.editorContent)return(t=>{if(t=t||null,!hw.has(t))if(t){const e=t.reduce(((t,e)=>t.set(e.k,e.v)),new Map);hw.set(t,(t=>e.has(t)?e.get(t):t))}else hw.set(t,(t=>t));return hw.get(t)})(this.editorContent)}return null}get formattedValue(){return null==this.value?"":this.hasDisplayValue?this.displayValue:this.valueFormatter?this.valueFormatter(this.value):this.value.toString()}get elm1(){return this.row.priority>=this.column.priority?this.row:this.column}get elm2(){return this.row.priority<this.column.priority?this.row:this.column}get clickable(){return super.clickable??this.elm1.clickable??this.elm2.clickable}get type(){return super.type??this.elm1.type??this.elm2.type??"g"}set type(t){this._type=t}get editorContent(){return super.editorContent??this.elm1.editorContent??this.elm2.editorContent??null}get adapter(){return super.adapter??this.elm1.adapter??this.elm2.adapter}set adapter(t){this._adapter=t}get address(){return this.column.address+this.row.address}get range(){return gv.fromA1(this.address)}get validation(){return super.validation??this.elm1.validation??this.elm2.validation??this.model.options.cellValidation}get editable(){return super.editable??this.elm1.editable??this.elm2.editable??this.model.options.editable}set editable(t){this._editable=t}get commentable(){return super.commentable??this.elm1.commentable??this.elm2.commentable??this.model.options.commentable}get renderer(){return super.renderer??this.elm1.renderer??this.elm2.renderer}get afterRenderer(){return super.afterRenderer??this.elm1.afterRenderer??this.elm2.afterRenderer??this.model.options.afterRenderer}get commentRenderer(){return super.commentRenderer??this.elm1.commentRenderer??this.elm2.commentRenderer??this.model.options.comments.renderer}get format(){return super.format??this.elm1.format??this.elm2.format}set format(t){super.format=t}get hyperlink(){return this._hyperlink}set hyperlink(t){this._hyperlink=t}get hasOwnFormula(){return!!this._formula}get hasFormula(){return null==this._hasFormula&&(this._hasFormula=!!this.formula),this._hasFormula}get formula(){return this._formula??this.elm1.formula??this.elm2.formula}set formula(t){super.formula=t,this.refreshFormula()}invalidateValue(){this.hasFormula?(this._value=void 0,this._evaluated=!1):this._evaluated=!0,this.clearError()}refreshFormula(){this.invalidateValue(),this._hasFormula=null}clearFormula(){this._formula=null,this._hasFormula=!1,this._evaluated=!0}constructor(t,e){super(t),this._evaluated=!0,this._sparkline=null,this._hasComment=null,this._hasStyle=null,this.row=t.rows[e.r],this.column=t.columns[e.c],this.populate(e)}populate(t){super.populate(t),this._tooltip=t.tooltip,this._hyperlink=t.hl,null!=t.f&&""!==t.f?this._evaluated=!1:null!=t.v&&(this.value=t.v),this._displayValue=t.dv}update(t){const e=super.update(t);return"tooltip"in t&&(e.tooltip=this._tooltip,this._tooltip=t.tooltip),"hl"in t&&(e.hl=this._hyperlink,this._hyperlink=t.hl),"f"in t?this._evaluated=!1:"v"in t&&(e.v=this.value,this.value=t.v),"dv"in t&&(e.dv=this._displayValue,this._displayValue=t.dv),e}getSourceData(t){const e=super.getSourceData();return this.merge&&(e.cs=this.merge.cs,e.rs=this.merge.rs),null!=this.value&&(e.v=this.value),this.hasTooltip&&(e.tooltip=this._tooltip),this._hyperlink&&(e.hl=this._hyperlink),t&&t.displayValue&&this.hasDisplayValue&&(e.dv=this._displayValue),e}createComposedStyle(t,e,i){const o=[];return t=t||this.column.style,e=e||this.row.style,null!=t&&null!=e?this.column.priority>this.row.priority?o.push(e,t):o.push(t,e):null!=t?o.push(t):null!=e&&o.push(e),null!=this.style&&o.push(this.style),null!=i&&o.push(i),o.length>0?this.model.styles.merge(...o):null}get composedStyle(){if(null===this._hasStyle){const t=this.createComposedStyle(null,null,this.model.conditionalFormats.evaluate(this));this._hasStyle=null!=t,this._composedStyle=t}return this._composedStyle}get calculatedIndent(){const t=this.composedStyle;return t?.alignment?.indent?t.alignment.indent:this.column.levelIndent&&this.row.level>0?this.row.level*this.model.options.levelIndentFactor:null}get cssStyle(){if(!1===this._hasStyle)return null;if(!this._cssStyle){const t=this.composedStyle;t&&(this._cssStyle=aw(t))}return this._cssStyle}invalidateStyle(){this._hasComment=null,this._hasStyle=null,this._composedStyle=null,this._cssStyle=null,this._sparkline=null}setStyleProperties(t){super.setStyleProperties(t),this.invalidateStyle()}removeStyleProperties(t){super.removeStyleProperties(t),this.invalidateStyle()}previewStyleProperties(t,e="cell"){const i=Object.assign({},this.createComposedStyle("column"==e?t:null,"row"==e?t:null)??{});if("cell"==e)for(const e in t)i[e]=t[e];this._hasStyle=!0,this._cssStyle=aw(i)}validate(){return!this.validation||Xy(this,this.value)}toString(){return this.address}}const uw={property:"value",enabled:!0};class pw extends(Lr(Qy)){get comparer(){return this._comparer}set comparer(t){this._comparer=t}get filter(){return this._filter??(this.model.options.filters?.enabled?uw:{enabled:!1})}set filter(t){this._filter=t}get hasFilter(){return this.filter.enabled}get sorting(){return this._sorting??this.model.options.columnSorting}set sorting(t){this._sorting=t}get width(){return this._width??this.model.options.columnWidth}set width(t){this._width=t}get levelIndent(){return this._levelIndent}set levelIndent(t){this._levelIndent=t}get levelButtons(){return this._levelButtons}set levelButtons(t){this._levelButtons=t}get priority(){return this._priority}set priority(t){this._priority=t}get address(){return vv(this.index)}get range(){return new gv(this.index,null,this.index,null)}get hasFormula(){return!!this._formula}get formula(){return this._formula}set formula(t){super.formula=t;const e=this.index;this.model.rows.forEach((t=>t.cells[e]?.refreshFormula()))}constructor(t,e){super(t,e),null==this._priority&&(this._priority=t.options.columnPriority)}get mergedHeaders(){return this._mergedHeaders??(this._mergedHeaders=this._header?.filter((t=>t.cs>1||t.rs>1))??[])}updateMergedHeaders(){this._mergedHeaders=null}set header(t){this._mergedHeaders=null,this._header=t}get header(){if(!this._header||this._header.length<this.model.headerCount){this._header=this._header??[];for(let t=this._header.length;t<this.model.headerCount;t++)this._header.push({r:t})}return this._header}hasHeaderTooltip(t){const e=this.header?.[t];return e&&null!=e.tooltip}convertSourceHeader(t){return Array.isArray(t)?t.map(((t,e)=>(null==(t=t??{r:e}).height&&(t.height=t.h),t.r=e,null==t.style&&(t.style=t.s),t._style=null==t.style?null:this.model.styles.add(t.style).id,t))):Q(t)?[{label:t,r:0}]:null}populate(t){super.populate(t),this._width=null==t.w||"auto"==t.w?null:t.w,this._levelIndent=t.levelIndent,this._levelButtons=t.levelButtons,this._header=this.convertSourceHeader(t.header),this._sorting=t.sorting,this._filter=Z(t.filter)?Object.assign({enabled:!0},t.filter):t.filter?uw:!1===t.filter?{enabled:!1}:null,this._comparer=t.comparer,this.data=t.data,this._mergedHeaders=null,null!=t.priority&&(this._priority=t.priority)}getSourceData(){const t=super.getSourceData();return null!=this._width&&(t.w=this._width),null!=this._levelIndent&&(t.levelIndent=this._levelIndent),null!=this._levelButtons&&(t.levelButtons=this._levelButtons),null!=this._header&&(t.header=this._header),null!=this._sorting&&(t.sorting=this._sorting),null!=this._filter&&(t.filter=this._filter),null!=this.data&&(t.data=this.data),t}expand(t){super.expand(t),this.model.indexVisibleColumns()}collapse(){super.collapse(),this.model.indexVisibleColumns()}get prev(){return this.model.columns[this.index-1]}get next(){return this.model.columns[this.index+1]}get prevVisible(){const t=this.model.visibleColumnIndex[this.index];return null==t||0===t?null:this.model.visibleColumns[t-1]}get nextVisible(){const t=this.model.visibleColumnIndex[this.index];return null==t?null:this.model.visibleColumns[t+1]}calculateRealColspan(t){let e=1,i=this.nextVisible;for(;i&&i.index-this.index<t&&e<t;)++e,i=i.nextVisible;return e}cell(t){return this.model.rows[t].cell(this.index)}clearCalculatedValues(){this.model.rows.forEach((t=>{const e=t.cells[this.index];e&&this.model.calculations.refreshFormula(e)}))}}var gw;!function(t){t[t.Asc=1]="Asc",t[t.Desc=-1]="Desc"}(gw||(gw={}));const mw={g:(t,e)=>t.value==e.value?0:t.value>e.value?1:-1,t:(t,e)=>(t.value||"").toString().localeCompare((e.value||"").toString()),s:(t,e)=>t.value==e.value?0:t.value>e.value?1:-1,m:(t,e)=>t.value==e.value?0:t.value>e.value?1:-1,n:(t,e)=>t.value-e.value,d:(t,e)=>(t.value instanceof Date?t.value.getTime():0)-(e.value instanceof Date?e.value.getTime():0),tm:(t,e)=>(t.value instanceof Date?t.value.getTime():0)-(e.value instanceof Date?e.value.getTime():0),dt:(t,e)=>(t.value instanceof Date?t.value.getTime():0)-(e.value instanceof Date?e.value.getTime():0),b:(t,e)=>t.value-e.value,h:(t,e)=>(t.value||"").localeCompare(e.value),a:()=>0},fw={g:(t,e)=>e.value==t.value?0:e.value>t.value?1:-1,t:(t,e)=>(e.value||"").toString().localeCompare((t.value||"").toString()),s:(t,e)=>e.value==t.value?0:e.value>t.value?1:-1,m:(t,e)=>e.value==t.value?0:e.value>t.value?1:-1,n:(t,e)=>e.value-t.value,d:(t,e)=>(e.value instanceof Date?e.value.getTime():0)-(t.value instanceof Date?t.value.getTime():0),tm:(t,e)=>(e.value instanceof Date?e.value.getTime():0)-(t.value instanceof Date?t.value.getTime():0),dt:(t,e)=>(e.value instanceof Date?e.value.getTime():0)-(t.value instanceof Date?t.value.getTime():0),b:(t,e)=>e.value-t.value,h:(t,e)=>(e.value||"").localeCompare(t.value),a:()=>0},vw=(t,e)=>t.origIndex-e.origIndex;class bw{get settings(){return this._settings}set settings(t){this._settings=t,this.colMap.clear(),this.settings.length>0&&(this.settings.forEach(((t,e)=>this.colMap.set(t.c,e))),this.applySort(),Er().info(`sorting applied: ${JSON.stringify(this.settings)}`))}constructor(t,e=[]){this.model=t,this.colMap=new Map,this._settings=[],this.settings=e}get(t){return this.colMap.has(t)?this.settings[this.colMap.get(t)]:null}sort(t,e=null,i=!1){let o=this.get(t);return o&&o.ord==gw.Desc&&null===e?(this.settings.splice(this.colMap.get(t),1),o=null):o?(o.ord=gw.Desc,this.settings.splice(this.colMap.get(t),1)):o={c:t,ord:gw.Asc},o&&(null!==e&&(o.ord=e),this.colMap.set(t,0),this.settings.unshift(o)),this.settings.length>this.model.options.maxSortingColumns&&this.settings.pop(),this.colMap.clear(),this.settings.forEach(((t,e)=>{t.index=e,this.colMap.set(t.c,e)})),i||(this.settings.length>0?this.applySort():this.resetSort()),o}applySort(){const t=this.model,e=this.settings.map((e=>{const i=t.columns[e.c];return i?i.comparer?e.ord==gw.Asc?i.comparer:(t,e)=>-i.comparer(t,e):e.ord==gw.Asc?mw[i.type??"t"]:fw[i.type??"t"]:(Er().warn(`Column sorting: Column with index ${e.c} not found`),null)})).filter((t=>t)),i=e.length;let o,r,s;t.rowRoot.sort(((t,n)=>{if(!1===t.sortable||!1===n.sortable)return t.origIndex-n.origIndex;for(r=0;r<i;r++)if(s=this.settings[r].c,o=e[r](t.cell(s),n.cell(s)),0!=o)return o;return 0})),t.indexRowsByTree()}resetSort(){this.settings=[],this.colMap.clear(),this.model.rowRoot.sort(vw),this.model.indexRowsByTree()}persistSort(){this.model.rows.forEach(((t,e)=>t.origIndex=e))}}class yw{get properties(){return this._properties}set properties(t){this._properties=t}constructor(t){t&&this.pupulate(t)}pupulate(t){this.author=t.author,this.text=t.text,this.date=t.date?new Date(t.date):null,this.data=t.data,this.readOnly=!!t.readOnly,this._properties=t.props}getSourceData(){const t={};return this._properties&&(t.props=this._properties),this.author&&(t.author=this.author),this.text&&(t.text=this.text),this.data&&(t.data=this.data),null!==this.readOnly&&(t.readOnly=this.readOnly),this.date&&(t.date=Zo("en-US")(this.date,"yyyy-MM-dd HH:mm:ss")),t}}class ww{constructor(t,e){this.model=t,this._commentMap=new Map,this.has=t=>this._commentMap.has(t),this.delete=t=>this._commentMap.delete(t),this.cleanCell=t=>{this.has(t)&&this._commentMap.set(t,this.get(t).filter((t=>(t.text??"").length>0||null!=t.data)))},this.get=t=>(this.has(t)||this._commentMap.set(t,[]),this._commentMap.get(t)),this.set=(t,e)=>{this._commentMap.set(t,e?.map((t=>t instanceof yw?t:new yw(t)))||[]),this.cleanCell(t)},e&&this.populate(e)}populate(t){t.forEach((t=>{const e=t.a1||new gv(t.c,t.r).A1;this._commentMap.has(e)||this._commentMap.set(e,[]),this._commentMap.get(e).push(new yw(t))})),this._commentMap.forEach((t=>{t.sort(((t,e)=>(e.date?e.date.getTime():0)-(t.date?t.date.getTime():0)))}))}shift(t){Array.from(this._commentMap.keys()).forEach((e=>{const i=gv.fromA1(e);i.shift(t),i.A1!=e&&(this._commentMap.set(i.A1,this._commentMap.get(e)),this._commentMap.delete(e))}))}}function xw(t,e,i){t.forEach((t=>t.forEach((t=>{t[1]==e&&(t[1]=i)}))))}class kw{get cellDependencies(){return this._cellDependencies}get cellDependants(){return this._cellDependants}get rangeDependencies(){return this._rangeDependencies}get rangeDependants(){return this._rangeDependants}get sheetDependencies(){return this._sheetDependencies}get sheetDependants(){return this._sheetDependants}constructor(t,e="calculations"){this.model=t,this.modelPart=e,this._cellDependencies=new Map,this._cellDependants=new Map,this._rangeDependencies=new Map,this._rangeDependants=new Map,this._sheetDependencies=new Map,this._sheetDependants=new Map}clear(){this._cellDependants.clear(),this._cellDependencies.clear(),this._rangeDependencies.clear(),this._rangeDependants.clear()}clearCellDependecies(t){return this._cellDependencies.has(t)&&this._cellDependencies.delete(t),this._rangeDependencies.has(t)&&this._rangeDependants.delete(t),this}has(t){return this._cellDependencies.has(t)||this._rangeDependencies.has(t)}add(t,e,i){const o=gv.fromA1(t).removeAnchors(),r=gv.fromA1(e).removeAnchors();e=r.A1;const s=r.isRange,n=s?this._rangeDependencies:this._cellDependencies;let a=null;if((n.has(t)?n.get(t):n.set(t,new Map).get(t)).set(e,[r,i]),i){const t=this.model.getConnectedModel(i);t&&(t.calculations.dependencies.sheetDependants.set(this.model.name,this.model.name),this.sheetDependencies.set(i,i),a=s?t.calculations.dependencies.rangeDependants:t.calculations.dependencies.cellDependants),i=this.model.name}else a=s?this._rangeDependants:this._cellDependants;a&&(a.has(e)||a.set(e,new Map),a.get(e).set(t,[o,i]))}getDependants(t,e=null){let i,o;const r=t.A1;return e=e??new Map,this._cellDependants.has(r)&&this._cellDependants.get(r).forEach((([t,s])=>{e.has(t)||(s&&(o=this.model.getConnectedModel(s)),i=o||this.model,e.set(t,[i.getCellByRange(t),s]),o?o[this.modelPart].dependencies.getDependants(t).forEach(((t,i)=>{e.set(i,[t[0],t[1]??s])})):(t.A1!=r||o)&&i.calculations.dependencies.getDependants(t,e))})),this._rangeDependants.forEach(((i,o)=>{gv.fromA1(o).contains(t)&&i.forEach((([t,i])=>{e.has(t)||(e.delete(t),this.getDependants(t,e.set(t,[(i?this.model.getConnectedModel(i):this.model).getCellByRange(t),i])))}))})),e}renameSheet(t,e){this._sheetDependants.has(t)&&(this._sheetDependants.delete(t),this._sheetDependants.set(e,e)),this._sheetDependencies.has(t)&&(this._sheetDependencies.delete(t),this._sheetDependencies.set(e,e)),xw(this._cellDependants,t,e),xw(this._cellDependencies,t,e),xw(this._rangeDependants,t,e),xw(this._rangeDependencies,t,e)}}class Cw{get dependencies(){return this._dependencies}constructor(t,e){this.model=t,this._dependencies=new kw(t,e)}}function Mw(t){return t instanceof RangeError?"Maximum call stack size exceeded"==t.message?"infinite loop":t.message:t.toString()}class _w extends Cw{get tokenizer(){return this._tokenizer}get formulas(){return this._formulas}constructor(t){super(t,"calculations"),this._tokenizer=new dv,this._formulas=new Map,this.context=new Uy(t)}createFormula(t){const e=new Tv(t.formula,this.tokenizer);return this._formulas.set(t.address,e),t.hasOwnFormula&&(t.formula=e.createFormulaString()),this.createDependecies(t),e}createDependecies(t){const e=t.address;if(this.formulas.has(e)){const i=this.formulas.get(e);i.ranges.forEach((([t,i,o])=>this._dependencies.add(e,i.A1,o))),i.cells.forEach((([t,i,o])=>this._dependencies.add(e,i.A1,o))),i.variables.forEach((([i,o])=>{const r=this.model.getCellByName(o,t.range);r&&this._dependencies.add(e,r.address,null)}))}return this}refreshFormula(t){return t.refreshFormula(),this.formulas.delete(t.address),this.clearDependecies(t),this}updateDependencies(t){return this.clearDependecies(t).getFormula(t),this}getFormula(t){return this._formulas.has(t.address)?this._formulas.get(t.address):this.createFormula(t)}refresh(){this.dependencies.clear(),this._formulas.clear()}clearDependecies(t){const e=t.address;return this.dependencies.clearCellDependecies(e),this.formulas.delete(e),this}evaluateFormula(t,e){return this.context.currentCell=e,t.fn(this.context,{cell:e,formula:t})}evaluateExpression(t,e){this.context.currentCell=e;const i=new Tv(t,this.tokenizer);return i.fn(this.context,{cell:e,formula:i})}evaluate(t,e){if(!t)return null;let i=null;if(t.hasFormula){const o=this.getFormula(t);try{t.clearError(),this.context.currentCell=t,i=o.fn(this.context,{cell:t,formula:o}),Array.isArray(i)?(e||this.model.spillValues({cell:t,values:i}).range,i=i.length>0&&i[0].length>0?i[0][0]:null,e&&(t.value=i)):t.value=i}catch(e){t.error={message:Mw(e)}}}else i=t.value;return i}evaluateAll(){this.model.rows.forEach((t=>this.model.columns.forEach(((e,i)=>t.cell(i).evaluate()))))}calculateViewport(t){const e=[];return t.rows.forEach((t=>t.cells.forEach((t=>{if(t.hasFormula){if(!t.hasValue&&(this.evaluate(t),t.spillRange))for(const i of this.model.getRangeIterator(t.spillRange))e.push(i);e.push(t)}})))),e}shift(t){this.getFormulaCells().forEach((e=>{e.formula=this.getFormula(e).shift(t).createFormulaString(!1),this.updateDependencies(e)}));const e=this.model.name;return this.dependencies.sheetDependants.forEach((i=>{const o=this.model.getConnectedModel(i);o?.calculations.getFormulaCells().forEach((i=>{const r=o.calculations.getFormula(i);r.hasSheetReference(e)&&(i.formula=r.shift(t).createFormulaString(!1),o.calculations.updateDependencies(i))}))})),this}getFormulaCells(){const t=this.model,e=[];let i;const o=t.rows.length,r=t.columns.length;for(let s=0;s<o;s++){i=t.rows[s];for(let t=0;t<r;t++)i.hasCellFormula(t)&&e.push(i.cell(t))}return e}renameSheet(t,e){let i=!1;return this.dependencies.renameSheet(t,e),this.getFormulaCells().forEach((o=>{const r=this.getFormula(o);r.renameSheet(t,e)&&(o.formula=r.createFormulaString(),this.refreshFormula(o),i=!0)})),i}invalidateCellDependants(t){const e=[];return this.dependencies.getDependants(t.range).forEach((([t,i])=>{e.push([t,i]),t.invalidateValue()})),e}invalidateDependants(t){const e=new Map,i=new Map;for(const i of t)this.invalidateCellDependants(i).forEach((([t,i])=>e.set(t,i)));e.forEach(((t,e)=>i.set(e,t)));for(const i of t)e.set(i,null);return e.forEach(((t,e)=>{this.model.sparklines.dependencies.getDependants(e.range).forEach((([t,e])=>{i.set(t,e)})),this.model.conditionalFormats.dependencies.getDependants(e.range).forEach((([t,e])=>{this.model.conditionalFormats.invalidateExtremes(t),t.invalidateStyle(),i.set(t,e)}))})),i}}const Sw="#ff0000",Ew="#fcd53f",zw="#00bb5e",Iw="#555555",Lw=new Map([["3Arrows",[{icon:["fas","down"],color:Sw},{icon:["fas","right"],color:Ew},{icon:["fas","up"],color:zw}]],["3ArrowsGray",[{icon:["fas","down"],color:Iw},{icon:["fas","right"],color:Iw},{icon:["fas","up"],color:Iw}]],["3Flags",[{icon:["fas","flag-pennant"],color:Sw},{icon:["fas","flag-pennant"],color:Ew},{icon:["fas","flag-pennant"],color:zw}]],["3TrafficLights1",[{icon:["fas","circle"],color:Sw},{icon:["fas","circle"],color:Ew},{icon:["fas","circle"],color:zw}]],["3TrafficLights2",[{icon:["fas","square-o"],color:Sw},{icon:["fas","square-o"],color:Ew},{icon:["fas","square-o"],color:zw}]],["3Signs",[{icon:["fas","square"],rotation:45,color:Sw},{icon:["fas","triangle"],color:Ew},{icon:["fas","circle"],color:zw}]],["3Symbols",[{icon:["fas","circle-xmark"],color:Sw},{icon:["fas","circle-exclamation"],color:Ew},{icon:["fas","circle-check"],color:zw}]],["3Symbols2",[{icon:["fas","xmark"],color:Sw},{icon:["fas","exclamation"],color:Ew},{icon:["fas","check"],color:zw}]],["3Stars",[{icon:["fal","star"],color:Ew},{icon:["fas","star-half-stroke"],color:Ew},{icon:["fas","star"],color:Ew}]],["3Triangles",[{icon:"caret-down",color:Sw},{icon:"dash",color:Ew},{icon:"caret-up",color:zw}]],["4Arrows",[{icon:["fas","down"],color:Sw},{icon:["fas","down-right"],color:Ew},{icon:["fas","up-right"],color:Ew},{icon:["fas","up"],color:zw}]],["4ArrowsGray",[{icon:["fas","down"],color:Iw},{icon:["fas","down-right"],color:Iw},{icon:["fas","up-right"],color:Iw},{icon:["fas","up"],color:Iw}]],["4RedToBlack",[{icon:["fas","circle"],color:"#000000"},{icon:["fas","circle"],color:"#b1b1b1"},{icon:["fas","circle"],color:"#edb2a3"},{icon:["fas","circle"],color:Sw}]],["4Rating",[{icon:"signal-bars-weak",color:"#4a7db1"},{icon:"signal-bars-fair",color:"#4a7db1"},{icon:"signal-bars-good",color:"#4a7db1"},{icon:["fas","signal-bars"],color:"#4a7db1"}]],["4TrafficLights",[{icon:["fas","circle"],color:"#000000"},{icon:["fas","circle"],color:Sw},{icon:["fas","circle"],color:Ew},{icon:["fas","circle"],color:zw}]],["5Arrows",[{icon:["fas","down"],color:Sw},{icon:["fas","down-right"],color:Ew},{icon:["fas","right"],color:Ew},{icon:["fas","up-right"],color:Ew},{icon:["fas","up"],color:zw}]],["5ArrowsGray",[{icon:["fas","down"],color:Iw},{icon:["fas","down-right"],color:Iw},{icon:["fas","right"],color:Iw},{icon:["fas","up-right"],color:Iw},{icon:["fas","up"],color:Iw}]],["5Rating",[{icon:["fal","signal-bars"]},{icon:["fal","signal-bars-weak"],color:"#4a7db1"},{icon:["fal","signal-bars-fair"],color:"#4a7db1"},{icon:["fal","signal-bars-good"],color:"#4a7db1"},{icon:["fas","signal-bars"],color:"#4a7db1"}]],["5Quarters",[{icon:["fal","circle"],color:"#505050"},{icon:["fas","circle-quarter-stroke"],color:"#505050"},{icon:["fas","circle-half-stroke"],color:"#505050"},{icon:["fas","circle-three-quarters-stroke"],color:"#505050"},{icon:["fas","circle"],color:"#505050"}]]]),Rw=(t,e)=>{const i=Lw.get(t);return i?i[e]:null};class Tw extends Cw{constructor(t,e){super(t,"conditionalFormats"),this.formats=[],this.cellFormatMap=new Map,this.extremes=new Map,e&&this.populate(e)}populate(t){t.forEach((t=>{try{this.add(t)}catch(e){Er().error(`conditional format error: ${JSON.stringify(t)}`,e)}}))}refresh(){this.dependencies.clear(),this.cellFormatMap.clear(),this.extremes.clear(),this.formats.forEach((t=>this.initConditionalFormat(t)))}clearCellDependecies(t){const e=t.address;return this.dependencies.clearCellDependecies(e),this.cellFormatMap.get(e).forEach((t=>({cf:t.cf}))),this}getExtremes(t){if(this.extremes.has(t.key))return this.extremes.get(t.key);const e=[1/0,-1/0];return t.ranges.forEach((t=>{for(const i of this.model.getValuesInRange(t))for(const t of i)null!=t&&(isNaN(t)||(e[0]=Math.min(e[0],t),e[1]=Math.max(e[1],t)))})),t.cmin&&("num"==t.cmin.t?e[0]=t.cmin.v:"percent"==t.cmin.t&&(e[0]=e[0]+(e[1]-e[0])*t.cmin.v/100)),t.cmax&&("num"==t.cmax.t?e[1]=t.cmax.v:"percent"==t.cmax.t&&(e[1]=e[0]+(e[1]-e[0])*t.cmax.v/100)),this.extremes.set(t.key,e),e}invalidateExtremes(t){this.cellFormatMap.get(t.address).forEach((t=>this.extremes.delete(t.cf.key)))}evaluateScaleFormat(t,e){const i=t.value;if(null==i)return null;const[o,r]=this.getExtremes(e.cf);let s;const n=(i-o)/(r-o);if(e.cf.cmid?.color)s=.5==n?"#"+e.cf.cmid.color:n>.5?Pr("#"+e.cf.cmid.color,"#"+e.cf.cmax.color,2*(n-.5)):Pr("#"+e.cf.cmin.color,"#"+e.cf.cmid.color,2*n);else{if(!e.cf.cmin?.color||!e.cf.cmax?.color)return null;s=Pr("#"+e.cf.cmin.color,"#"+e.cf.cmax.color,n)}return{color:jr(s).substring(1),fgColor:s.substring(1)}}evaluateBarFormat(t,e){const i=t.value;if(null==i)return null;const o=this.getExtremes(e.cf);let r=o[0];const s=o[1],n=r<0;n||(r-=.1*(s-r));const a=Math.round(100*(i-r)/(s-r));e.initialized||(e.initialized=!0,e.cf.ranges.forEach((e=>this._dependencies.add(t.address,e.A1,null))));const l=[];if(n){const t=Math.round(-100*r/(s-r));i>=0?(l.push(`#00000000 ${t}%`),l.push(`#${e.cf.color} ${t}%`),l.push(`#${e.cf.color} ${a}%`),l.push(`#00000000 ${a}%`)):(l.push(`#00000000 ${a}%`),l.push(`#ff0000 ${a}%`),l.push(`#ff0000 ${t}%`),l.push(`#00000000 ${t}%`))}else l.push(`#${e.cf.color} ${a}%`),l.push(`#00000000 ${a}%`);return{cssStyle:{backgroundClip:"padding-box",backgroundImage:`linear-gradient(90deg, ${l.join(",")})`}}}evaluateFormulaFormat(t,e){if(!e.initialized&&e.cf.condition){e.initialized=!0;const i=t.address,o=new Tv(e.cf.condition,this.model.calculations.tokenizer);e.f=o.shift({index:0,offset:t.c-e.cf.firstCell.c1,direction:"right"}).shift({index:0,offset:t.r-e.cf.firstCell.r1,direction:"down"}),o.cells.forEach((t=>this._dependencies.add(i,t[1].A1,t[2]))),o.ranges.forEach((t=>this._dependencies.add(i,t[1].A1,t[2]))),o.variables.forEach((([e,o])=>{const r=this.model.getCellByName(o,t.range);r&&this._dependencies.add(i,r.address,null)}))}if(e.f&&!this.model.calculations.evaluateFormula(e.f,t))return null;const i={...e.cf.style};return i.color||Hr(jr(Fr(e.cf.style.fgColor))),i}evaluateIconFormat(t,e){const i=t.value;if(null==i)return null;const[o,r]=this.getExtremes(e.cf);let s;for(let t=e.cf.thresh.length-1;t>=0;t--){const n=e.cf.thresh[t];if("percent"===n.t){if(null==s&&(s=100*(i-o)/(r-o)),s>=n.v)return{icon:Rw(e.cf.v,t)}}else if("num"===n.t&&i>=n.v)return{icon:Rw(e.cf.v,t)}}return null}evaluate(t){const e=t.address,i=this.cellFormatMap.get(e);if(!i)return null;let o=null,r=null;for(const e of i){try{switch(e.cf.type){case"formula":r=this.evaluateFormulaFormat(t,e);break;case"scale":r=this.evaluateScaleFormat(t,e);break;case"bar":r=this.evaluateBarFormat(t,e);break;case"icon":r=this.evaluateIconFormat(t,e);break;default:r=null}}catch(t){Er().error(`Conditional format error: ${JSON.stringify(e)}`,t)}if(r&&(o=o?{...o,...r}:r,e.cf.stop))break}return o}initConditionalFormat(t){return t.firstCell=null,t.ranges.forEach((e=>{for(const i of new Bw(e.intersect(this.model.gridRange))){const e=i.A1;"formula"===t.type&&(t.firstCell||(t.firstCell=i,t.formula=t.condition?new Tv(t.condition,this.model.calculations.tokenizer):null)),(this.cellFormatMap.get(e)||this.cellFormatMap.set(e,[]).get(e)).push({cf:t})}})),t}add(t){const e={key:t.ranges,ranges:gv.fromA1s(t.ranges),type:t.type||"formula",firstCell:null,formula:null,style:t.style?this.model.styles.add(t.style):null,condition:t.condition,stop:!!t.stop,cmin:t.cmin,cmid:t.cmid,cmax:t.cmax,color:t.color,v:t.v,thresh:t.thresh};this.formats.push(this.initConditionalFormat(e))}getSourceData(){return this.formats.map((t=>({type:t.type,ranges:gv.toA1s(t.ranges),style:t.style,condition:t.condition,stop:t.stop,cmin:t.cmin,cmid:t.cmid,cmax:t.cmax,color:t.color,v:t.v,thresh:t.thresh})))}}const Aw=(t,e)=>{const i=new RegExp(`${ut(t)}`,"ig");return t=>(i.lastIndex=0,i.test(ct((t[e]??"").toString())))},Ow=(t,e)=>i=>!!i[e]===t,$w=(t,e)=>{const i=t.map((t=>t.key?.toString()));return t=>null!=t[e]&&i.includes(t[e].toString())},Dw=(t,e)=>t=>!1,Nw=(t,e,i)=>(i=i??"value","b"===t?Ow(e,i):"s"===t&&Array.isArray(e)?$w(e,"value"):"s"===t?Aw(e?.toString(),"formattedValue"):"m"===t&&Array.isArray(e)?Dw(e,i):Aw(e?.toString(),"d"===t?"formattedValue":i));class Pw extends Event{constructor(){super("filter",{bubbles:!1,cancelable:!0,composed:!0})}}class jw extends EventTarget{constructor(t){super(),this.model=t,this.settings=new Map,this.custom=!1}get(t){return this.settings.has(t)?this.settings.get(t):null}filter(t,e=!0){null===t.term||""===t.term?this.settings.delete(t.c):this.settings.set(t.c,t),this.custom||(this.settings.size>0?this.applyFilter(!1):this.resetFilter(!1)),e&&this.dispatchEvent(new Pw)}applyFilter(t=!0){const e=[];this.settings.forEach(((t,i)=>{const o=this.model.columns[i];e.push({c:i,matcher:Nw(o.type,t.term,o.filter?.property)})}));const i=e.length,o=this.model.options.filters?.includeParents??!0,r=this.model.options.filters?.includeChildren??!0,s=new Set;this.model.rows.forEach((t=>{const n=s.has(t.index);(t=>{if(!t.filterable)return!0;for(let o=0;o<i;o++)if(!e[o].matcher(t.cell(e[o].c)))return!1;return!0})(t)?(t.filterState=zr.Matched,o&&t.walkUp((t=>{if(s.has(t.index)&&t.filterState>0)return!1;t.filterState=zr.ChildMatched,s.add(t.index)})),r&&t.walk((t=>{if(s.has(t.index)&&t.filterState>0)return!1;t.filterState=zr.ParentMatched,s.add(t.index)}))):n||(t.filterState=zr.Filtered),s.add(t.index)})),this.model.indexRows(),t&&this.dispatchEvent(new Pw)}resetFilter(t=!0){this.settings.clear(),this.model.rows.forEach((t=>t.filterState=zr.Matched)),this.model.indexRows(),t&&this.dispatchEvent(new Pw)}}class Hw extends Cw{constructor(t,e){super(t,"sparklines"),this.model=t,this.map=new Map,this.groups=new Map,this.extremes=new Map,this.maxIndex=0,this.updateRangeMap=!1,this.populate(e)}populate(t){t?.forEach((t=>{try{this.add(gv.fromA1(t.location),Array.isArray(t.data)?t.data.map((t=>[gv.fromA1(t)])):t.data.split(",").map((t=>[gv.fromA1(t)])),ot({},qf.DEFAULT_SPARKLINE_OPTIONS,t.options))}catch(e){this.model.logger.error(`sparkline error: ${JSON.stringify(t)}`,e)}}))}getSourceData(){const t=[];return this.groups.forEach((e=>{t.push({location:e.locRange.A1,data:e.dataRanges.map((t=>t[0].A1)).join(","),options:{minValue:e.minValue,maxValue:e.maxValue,type:e.type,style:e.style,marker:e.marker}})})),t}has(t){return this.map.has(t)}get(t){return this.map.get(t)}createDependencies(t){this.map.get(t)[1].forEach((e=>this._dependencies.add(t,e[0].A1,e[1])))}updateRangeMaps(){this.dependencies.clear(),this.map.clear(),this.groups.forEach(((t,e)=>this.createRangeMap(e,t.locRange,t.dataRanges)))}getValues(t){this.updateRangeMap&&this.updateRangeMaps();const e=this.map.get(t),i=e[1][0][1]?this.model.getConnectedModel(e[1][0][1]):this.model;return this._dependencies.has(t)||this.createDependencies(t),e[1].flatMap((t=>i.getValuesInRange(t[0])[0]))}getExtremes(t){const e=this.map.get(t),i=e[1][0][1]?this.model.getConnectedModel(e[1][0][1]):this.model,o=this.groups.get(e[0]);let r,s,n,a;return null==o.minValue||Q(o.minValue)?"auto"==(o.minValue||"auto")?(r=r??lt(...e[1].map((t=>i.getValuesInRange(t[0])))),n=r[0]):(this.extremes.has(e[0])||this.extremes.set(e[0],lt(...o.dataRanges.map((t=>i.getValuesInRange(t[0]))))),s=this.extremes.get(e[0]),n=s[0]):n=o.minValue,null==o.maxValue||Q(o.maxValue)?"auto"==(o.maxValue||"auto")?(r=r??lt(...e[1].map((t=>i.getValuesInRange(t[0])))),a=r[1]):(this.extremes.has(e[0])||this.extremes.set(e[0],lt(...o.dataRanges.map((t=>i.getValuesInRange(t[0]))))),s=this.extremes.get(e[0]),a=s[1]):a=o.maxValue,[n,a]}createRangeMap(t,e,i){e=e.intersect(this.model.gridRange);const o=i[0][0].size,r=e.size;if(r.columns>1&&r.rows>1)return void this.model.logger?.error(`invalid sparkline location range: ${e.A1}`);let s=!1;if(s=1==r.columns&&1==r.rows?o.rows>1:r.columns>1,s)for(let o=e.c1;o<=e.c2;o++)this.map.set(new gv(o,e.r1).A1,[t,i.map((([t,i])=>[new gv(t.c1+o-e.c1,t.r1,t.c1+o-e.c1,t.r2),i]))]);else for(let o=e.r1;o<=e.r2;o++)this.map.set(new gv(e.c1,o).A1,[t,i.map((([t,i])=>[new gv(t.c1,t.r1+o-e.r1,t.c2,t.r1+o-e.r1),i]))])}add(t,e,i){const o=++this.maxIndex;t&&e&&this.createRangeMap(o,t,e),this.groups.set(o,Object.assign({dataRanges:e,locRange:t},JSON.parse(JSON.stringify(qf.DEFAULT_SPARKLINE_OPTIONS)),i))}update(t,e,i,o){const r=this.groups.get(t);Object.assign(r,{dataRanges:i,locRange:e},o),this.updateRangeMap=!0}delete(t){this.groups.delete(t),this.updateRangeMap=!0}shift(t){this.groups.forEach((e=>{e.dataRanges.forEach((([e])=>e.shift(t))),e.locRange.shift(t)})),this.updateRangeMaps()}}class Fw extends gv{constructor(t,e,i=!1){super(e.c1,e.r1,e.c2,e.r2),this.model=t,this.initializedOnly=i,this.r=0,this.c=-1,this.done=!1}[Symbol.iterator](){return this}nextInitialized(){let t;for(;!this.done&&!t;)this.c<this.size.columns-1?this.c++:this.r<this.size.rows-1&&(this.c=0,this.r++),t=this.model.rows[this.r].cells[this.c],this.done=this.c>=this.size.columns-1&&this.r>=this.size.rows-1;return t}next(){if(this.done)return{done:!0};this.c<this.size.columns-1?this.c++:this.r<this.size.rows-1&&(this.c=0,this.r++),this.done=this.c>=this.size.columns-1&&this.r>=this.size.rows-1;const t=this.model.rows[this.r+this.r1],e=this.c+this.c1,i=this.initializedOnly&&!t.isCellInitialized(e)?this.nextInitialized():t?.cell(e);return i?{done:!1,value:i}:{done:!0}}forEach(t){let e;for(;e=this.next().value;)t(e)}}class Bw extends gv{constructor(t){super(t.c1,t.r1,t.c2,t.r2),this.r=0,this.c=-1,this.done=!1}[Symbol.iterator](){return this}next(){return this.done?{done:!0}:(this.c<this.size.columns-1?this.c++:this.r<this.size.rows-1&&(this.c=0,this.r++),this.done=this.c==this.size.columns-1&&this.r==this.size.rows-1,{done:!1,value:new gv(this.c+this.c1,this.r+this.r1)})}}class Ww extends gv{constructor(t,e,i){super(e.c1,e.r1,e.c2,e.r2),this.model=t,this.i=0,this.done=!1,this.axis=i,this.key="rows"===i?"r1":"c1"}[Symbol.iterator](){return this}next(){if(this.done)return{done:!0};this.i<this.size[this.axis]-1&&this.i++,this.done=this.i>=this.size[this.axis]-1;const t=this.model[this.axis][this.i+this[this.key]];return t?{done:!1,value:t}:{done:!0}}forEach(t){let e;for(;e=this.next().value;)t(e)}}class Vw{constructor(t,e){this.model=t,this.names=new Map,this.rangeMap=new Map,e&&this.populate(e)}populate(t){t.forEach((({name:t,ref:e})=>this.set(t,Z(e)?gv.fromCoords(e):gv.fromA1(e))))}set(t,e){this.names.set(t,e),this.rangeMap.set(e.A1,t)}delete(t){const e=this.names.get(t);e&&(this.rangeMap.delete(e.A1),this.names.delete(t))}findCellByName(t){let e;const i=this.model.rows,o=this.model.columns.length;for(let r=0;r<i.length;r++){e=i[r];for(let i=0;i<o;i++)if(e.hasCellName(i)){const o=e.cell(i);if(o.name==t)return o.range}}return null}getCellByName(t,e){const i=this.names.get(t)??this.findCellByName(t);return i?i.isColumn?this.model.rows.length>e.r1?this.model.columns[i.c1].cell(e.r1):null:i.isRow?this.model.columns.length>e.c1?this.model.rows[i.r1].cell(e.c1):null:this.model.rows[i.r1].cell(i.c1):null}getRangeByName(t,e=!0){const i=this.names.get(t);return e?i?.intersect(this.model.gridRange):i}shift(t){this.names.forEach(((e,i)=>{const o=e.A1;e.shift(t);const r=e.A1;o!=r&&(this.rangeMap.delete(o),this.rangeMap.set(r,i))}))}getSourceData(){const t=[];return this.names.forEach(((e,i)=>{t.push({name:i,ref:e.A1})})),t}}function Uw(t,e=null){const i=ot({},qf.DEFAULT_OPTIONS,e,is(t,e));return i.numberFormat?i.numberFormatter=ur(i.formatLocale,i.numberFormat):i.numberFormatter||(i.numberFormatter=ur(i.formatLocale)),i.dateFormat?i.dateFormatter=Zo(i.formatLocale,i.dateFormat):i.dateFormatter||(i.dateFormatter=Zo(i.formatLocale)),i.columnSorting&&(i.sorting=i.sorting||{enabled:!0}),"boolean"==typeof i.filters&&(i.filters={enabled:i.filters}),i.filters=Object.assign({},Uf,i.filters),"boolean"==typeof i.rowTree&&(i.rowTree={enabled:i.rowTree}),i.rowTree=Object.assign({},Gf,i.rowTree),"boolean"==typeof i.columnTree&&(i.columnTree={enabled:i.columnTree}),i.columnTree=Object.assign({},Gf,i.columnTree),i.cellValidation&&(i.cellValidation=Zy(i.cellValidation)),i}class Gw extends(Lr(Qy)){get cells(){return this._cells}get data(){return this._data}set data(t){this._data=t}get height(){return this._height??this.model.options.rowHeight}set height(t){this._height=t}get priority(){return this._priority}set priority(t){this._priority=t}get address(){return mv(this.index)}get range(){return new gv(null,this.index,null,this.index)}get hasFormula(){return!!this._formula}get formula(){return this._formula}set formula(t){super.formula=t,this.model.columns.forEach((t=>this.cell(t.index).refreshFormula()))}get values(){return this.model.columns.map((t=>this.cell(t.index).value))}cell(t,e){if(this.model.options.singleCellModel)return this._singleCell||(this._singleCell=new dw(this.model,{c:t,r:this.index})),this._singleCell.row=this,this._singleCell.column=this.model.columns[t],this._singleCell;let i=this._cells[t];if((e||!i)&&this.model.columns[t]){if(i=new dw(this.model,e??{c:t,r:this.index}),this._data){const e=this.model.columns[t].data;if(null!=e){const t=this._data[e];Z(t)?(t.comment&&this.model.comments.set(i.address,[t.comment]),i.populate(t)):i.hasValue||(i.value=t)}}i.name&&this.model.names.set(i.name,i.range),this._cells[t]=i}return i}constructor(t,e){super(t,e),this.isCellInitialized=t=>!!this.cells[t],this._cells=[],null==this._priority&&(this._priority=t.options.rowPriority)}populate(t){super.populate(t),this._height=null==t.h||"auto"==t.h?this.model.options.rowHeight:t.h,t.data&&(Array.isArray(t.data)?this._data=[...t.data]:this._data={...t.data}),null!=t.priority&&(this._priority=t.priority)}getSourceData(){const t=super.getSourceData();return null!=this._height&&this._height!=this.model.options.rowHeight&&(t.h=this._height),t}expand(t){super.expand(t),this.model.indexVisibleRows()}collapse(){super.collapse(),this.model.indexVisibleRows()}get prev(){return this.model.rows[this.index-1]}get next(){return this.model.rows[this.index+1]}get prevVisible(){let t=this.prev;for(;t&&!t.visible;)t=t.prev;return t}get nextVisible(){let t=this.next;for(;t&&!t.visible;)t=t.next;return t}hasCellFormula(t){return this.cells[t]&&this.cells[t].hasFormula||this._data&&this._data[this.model.columns[t].data]&&this._data[this.model.columns[t].data].f}hasCellName(t){return this.cells[t]&&null!=this.cells[t].name||this._data&&this._data[this.model.columns[t].data]&&null!=this._data[this.model.columns[t].data].name}insertColumns(t,e,i=!1){let o;const r=this.model.columns.length,s=this.model.calculations;if(i)for(let i=0;i<r;i++)this.hasCellFormula(i)&&(o=this.cell(i),o.formula=s.getFormula(o).shift({index:t,offset:e,direction:"right"}).createFormulaString(!1));t<this.cells.length&&this.cells.splice(t,0,...Array(e).fill(null))}deleteColumns(t,e,i=!1){let o;const r=this.model.columns.length,s=this.model.calculations;if(i)for(let i=0;i<r;i++)this.hasCellFormula(i)&&(o=this.cell(i),o.formula=s.getFormula(o).shift({index:t,offset:e,direction:"left"}).createFormulaString(!1));return t<this.cells.length?this.cells.splice(t,e):null}clearCalculatedValues(){this.cells.forEach((t=>t&&this.model.calculations.refreshFormula(t)))}}var qw=i(4418),Yw=i.n(qw);const Zw=t=>t?"1":"0",Xw=t=>null==t?"_":t,Qw=t=>null==t?"_":t.toString(),Kw=t=>null==t?"_":JSON.stringify(t),Jw=t=>Xw(t&&t.color?t.color:"_")+Xw(t&&t.style?t.style:"_"),tx=t=>Xw(t?t.horizontal:null)+Xw(t?t.vertical:null)+Xw(t?t.horizontal:null)+Qw(t?t.indent:null)+Zw(t?t.wrapText:null)+Qw(t?t.textRotation:null),ex=t=>Yw()("s_"+Zw(t.bold)+Zw(t.italic)+Zw(t.underline)+Qw(t.sz)+Xw(t.font)+Xw(t.color)+Jw(t.top)+Jw(t.right)+Jw(t.bottom)+Jw(t.left)+Xw(t.patternType)+Xw(t.fgColor)+Xw(t.bgColor)+tx(t.alignment)+Qw(t.angle)+Kw(t.stops)+Zw(t.hidden)+Zw(t.editable)+Kw(t.cssStyle)+Kw(t.icon));function ix(t){const e={...t};return delete e.id,delete e.hash,e}class ox{constructor(t){this.model=t,this._count=0,this.hashmap=new Map,this.map=new Map}add(t){if(!isNaN(t))return this.get(t);const e=this.model.options.cssStyles?lw(t):t,i=e.hash?e.hash:ex(e);return this.hashmap.has(i)?this.map.get(this.hashmap.get(i)):(null==e.id&&(e.id=this._count),this._count=Math.max(e.id+1,this._count+1),e.hash=i,this.hashmap.set(i,e.id),this.map.set(e.id,e),e)}populate(t){t.forEach((t=>this.add(t)))}get(t){return this.map.has(t)?this.map.get(t):null}remove(t){const e="object"==typeof t?t:this.map.get(t);this.hashmap.delete(e.hash),this.map.delete(e.id)}merge(...t){const e=Object.assign({},...t.map((t=>Z(t)?t:this.get(t))));return this.add(ix(e))}duplicate(t,e){const i=this.get(t);return this.add(ix({...i,...e}))}set(t,e){let i=this.map.has(t)?this.map.get(t):{};for(const t in e)i[t]=e[t];return i=i.id?i:this.add(i),i}unset(t,e){if(this.map.has(t)){const i=this.map.get(t);for(const t of e)delete i[t]}}getSourceData(){return Array.from(this.map.values())}clean(){const t=new Map(Array.from(this.map.entries()).map((([t])=>[t,0])));this.model.columns.forEach((e=>{const i=t.get(e.style);null!=i&&t.set(e.style,i+1)})),this.model.rows.forEach((e=>{const i=t.get(e.style);null!=i&&t.set(e.style,i+1),e.cells.forEach((e=>{const i=t.get(e.style);null!=i&&t.set(e.style,i+1)}))})),t.forEach(((t,e)=>{0==t&&this.remove(e)}))}}function rx(t,e,i,o){const r=o??("rows"==i?e.rows:e.columns),s=function(t){const e=new Map;for(const i of t)e.has(i.level)||e.set(i.level,[]),e.get(i.level).push(i);return e}(r),n=t[i]??[];for(const t of n){let o;if(o=t.index>-1?[r[t.index]]:t.level>-1?s.get(t.level):r,t.name){const e=t.name instanceof RegExp?t.name:new RegExp(ut(t.name));o=o.filter((t=>e.test(t.name)))}o?.forEach((o=>{null!=t.priority&&(o.priority=t.priority),t.type?e.conditionalFormats.add(Object.assign({ranges:`${o.address}:${o.address}`},t)):(o.style=e.styles.add(t.style).id,"rows"==i&&null!=t.height?o.height=t.height:"columns"==i&&null!=t.width&&(o.width=t.width))}))}}function sx(t,e){for(const i of t)if(e[i.property]!=i.value)return!1;return!0}function nx(t,e,i){const o=t.cells??[];for(const t of o)if(t.conditions?.length){const o=e.getRangeIterator(i??e.gridRange);for(const i of o)sx(t.conditions,i)&&(i.style=e.styles.add(t.style).id)}else if(t.type)e.conditionalFormats.add(Object.assign({ranges:"A:"+e.columns[e.columns.length-1].address},t));else for(const i of e.columns)null==i.style&&(i.style=e.styles.add(t.style).id)}function ax(t,e,i){rx(t,e,"columns",i)}function lx(t,e,i){rx(t,e,"rows",i)}function cx(t,e){nx(t,e),ax(t,e),lx(t,e)}var hx;!function(t){t[t.NONE=0]="NONE",t[t.MERGED=1]="MERGED",t[t.HIDDEN=2]="HIDDEN"}(hx||(hx={}));class dx{get mergedCells(){return this._mergedCells}get hiddenCells(){return this._hiddenCells}constructor(t){this.model=t,this._mergedCells=new Map,this._hiddenCells=new Map}clear(){this._mergedCells.clear(),this._hiddenCells.clear()}getMergeState(t){return this._mergedCells.has(t)?hx.MERGED:this._hiddenCells.has(t)?hx.HIDDEN:hx.NONE}indexMergedRange(t){const e=t.A1,i=this._mergedCells.get(e);if(!i)return;const o=i.r,r=i.c,s=t.clone(),n=this.model.rows[o]?.cell(r);if(n)for(let t=0;t<i.rs;t++)for(let e=0;e<i.cs;e++)0==t&&0==e||(s.r1=o+t,s.c1=r+e,s.r2=s.r1,s.c2=s.c1,this._hiddenCells.set(s.A1,i));else this.remove(e)}add(t){const e=new gv(t.c,t.r),i=e.A1;if(this._mergedCells.has(i))this.remove(i);else if(this._hiddenCells.has(i))return;this._mergedCells.set(i,t),this.indexMergedRange(e)}remove(t){const e=this._mergedCells.get(t);if(!e)return;this._mergedCells.delete(t);const i=e.r,o=e.c,r=new gv(o,i);this._hiddenCells.delete(t);for(let t=0;t<e.rs;t++)for(let s=0;s<e.cs;s++)0==t&&0==s||(r.r1=i+t,r.c1=o+s,r.r2=r.r1,r.c2=r.c1,this._hiddenCells.delete(r.A1))}shift(t){const{index:e,offset:i,direction:o}=t,r={down:t=>{e<=t.r?t.r+=i:e>t.r&&e<t.r+t.rs&&(t.rs+=i)},up:t=>{e<=t.r?t.r-=i:e>t.r&&e<t.r+t.rs&&(t.rs-=i)},right:t=>{e<=t.c?t.c+=i:e>t.c&&e<t.c+t.cs&&(t.cs+=i)},left:t=>{e<=t.c?t.c-=i:e>t.c&&e<t.c+t.cs&&(t.cs-=i)}},s=[...this._mergedCells.values()];s.forEach((t=>this.remove(new gv(t.c,t.r).A1))),s.forEach((t=>{r[o](t),this.add(t)}))}}const ux=["index","name","rows","columns","cells","options","sparklines","rules","comments","styles","names","props","tab","theme"];class px{get mergedHeaders(){return this._mergedHeaders}get hasFilter(){return this._filter}get hasRowTree(){return this._maxRowLevel>0}get hasRowTreeEnabled(){return this.hasRowTree&&this.options.rowTree.enabled}get maxRowLevel(){return this._maxRowLevel}get hasColumnTree(){return this._maxColumnLevel>0}get hasColumnTreeEnabled(){return this.hasColumnTree&&this.options.columnTree.enabled}get maxColumnLevel(){return this._maxColumnLevel}get headerCount(){return this._headerCount}get columnHeaderCount(){return this.headerCount+(this.hasColumnTreeEnabled?1:0)+(this.hasFilter?1:0)}get properties(){return this._properties}set properties(t){this._properties=t}get theme(){return this._theme}set theme(t){this._theme=t}constructor(t,e,i){this.otherModels={},this.autofitColumns=new Set,this.autofitRows=new Set,this.merges=new dx(this),this.styles=new ox(this),this.comments=new ww(this),this.calculations=new _w(this),this.names=new Vw(this),this.sorting=new bw(this),this.sparklines=new Hw(this),this.conditionalFormats=new Tw(this),this._filter=!1,this._maxRowLevel=0,this._maxColumnLevel=0,this._headerCount=0,this._levelBasedRowTree=!0,this._levelBasedColTree=!0,this.clearRows=()=>(this.rowRoot.clearChildren(),this.rows=[],this.rows),this.clearColumns=()=>this.columns=[],this.logger=i,this.options=e??Uw(t.options),this.populate(t)}getConnectedModel(t){return this.group?this.group.get(t):null}getModelByRange(t){return t.sheet?this.getConnectedModel(t.sheet):this}getCellByA1(t){return this.getCellByRange(gv.fromA1(t))}getCellByRange(t){return this.getCellByCoords(t.r1,t.c1)}getCellByCoords(t,e){return this.rows[t]?.cell(e)}cell(t,e){return isNaN(t)?t instanceof gv?this.getCellByRange(t):"string"==typeof t?this.getCellByA1(t):null:this.getCellByCoords(t,e||0)}createRows(t,e=new Gw(this,{l:-1}),i=0){let o=!1,r=!1;this.autofitRows.clear();const s=t.map(((t,e)=>{t||(t={}),isNaN(t.l)||(o=!0),null!=t.p&&(r=!0),"auto"==t.h&&this.autofitRows.add(e);const s=new Gw(this,t);return s.origIndex=e+i,s.name&&this.names.set(s.name,gv.fullRow(e)),s}));let n=-1;return o?n=Rr(s,e,{reverse:this.options.rowTree.reversed}):r?n=Tr(s,e):e.children=s,r||(o=!0),[e,s,n,o]}insertRowData(t,e,i){const o=this.createRows(i,new Gw(this,{l:t.level}),e);if(this._maxRowLevel=Math.max(this._maxRowLevel,o[2]),t.insertChildren(o[0].children,e),this.indexRowsByTree(),this.theme){const t=o[1];lx(this.theme,this,t),nx(this.theme,this,new gv(0,t[0].index,1/0,t[t.length-1].index))}}applyTheme(t,e){if(e)for(const t of this.getInitializedCellIterator())t.invalidateStyle();cx(t,this)}populate(t){this.index=t.index,this.name=t.name??this.name,this.tab=t.tab;let e=!1,i=!1;if(t.columns||(t.columns=new Array(this.options.columns).fill({})),t.rows||(t.rows=new Array(this.options.rows).fill({})),t.styles&&this.styles.populate(t.styles),this.autofitColumns.clear(),this.columns=t.columns.map(((t,o)=>{t||(t={}),t.l>0&&(e=!0),null!=t.p&&(i=!0),"auto"==t.w&&this.autofitColumns.add(o);const r=new pw(this,t);return this._filter=r.hasFilter||this._filter,r.name&&this.names.set(r.name,gv.fullColumn(o)),r})),this._levelBasedColTree=e,this._maxColumnLevel=-1,this.colRoot=new pw(this,{l:-1}),e?this._maxColumnLevel=Rr(this.columns,this.colRoot,{reverse:this.options.columnTree.reversed}):i?this._maxColumnLevel=Tr(this.columns,this.colRoot):this.colRoot.children=this.columns,i||(this._levelBasedColTree=!0),this.indexColumns(),this.indexVisibleColumns(),[this.rowRoot,this.rows,this._maxRowLevel,this._levelBasedRowTree]=this.createRows(t.rows),this.indexRows(),this.indexVisibleRows(),this.options.pageSize&&this.options.pageSize<=this.rows.length&&(this.rowRoot.count=1/0),this.merges.clear(),t.comments=t.comments||[],t.cells?.forEach(((e,i)=>{const o=this.rows[e.r]?this.rows[e.r].cell(e.c,e):null;o?(e.cs>1||e.rs>1)&&this.merges.add({r:o.r,c:o.c,rs:e.rs||1,cs:e.cs||1}):this.logger?.error(`invalid cell definition (index ${i}): ${JSON.stringify(e)}`),o&&e.comment&&t.comments.push(Object.assign(e.comment,{c:e.c,r:e.r}))})),t.sparklines)try{this.sparklines.populate(t.sparklines)}catch(t){Er().error(`Sparkline init error: ${t}`)}if(t.names)try{this.names.populate(t.names)}catch(t){Er().error(`Named range init error: ${t}`)}if(t.rules)try{this.conditionalFormats.populate(t.rules)}catch(t){Er().error(`Conditional formats init error: ${t}`)}if(t.theme)try{this.applyTheme(t.theme),this._theme=t.theme}catch(t){Er().error(`Theme init error: ${t}`)}if(t.comments)try{this.comments.populate(t.comments)}catch(t){Er().error(`Comment init error: ${t}`)}this._properties=t.props,this.otherSourceData={};const o=new Set(ux),r=Object.keys(t).filter((t=>!o.has(t)));r.forEach((e=>this.otherSourceData[e]=t[e])),this.options.sorting?.defaultSettings&&(this.sorting.settings=this.options.sorting.defaultSettings),this.calcHeaderHeights()}getSourceData(){const t={index:this.index,name:this.name,tab:this.tab,columns:this.columns.map((t=>t.getSourceData())),rows:this.rows.map((t=>t.getSourceData())),styles:this.styles.getSourceData(),rules:this.conditionalFormats.getSourceData(),sparklines:this.sparklines.getSourceData(),names:this.names.getSourceData(),options:this.options};this._properties&&(t.props=this._properties);const e=[];let i;for(let t=0;t<this.rows.length;t++)for(let o=0;o<this.columns.length;o++)i=this.rows[t].cell(o).getSourceData(),Object.keys(i).length>0&&(i.r=t,i.c=o,e.push(i));e.length>0&&(t.cells=e);const o=[];return this.styles.clean(),this.styles.map.forEach((t=>o.push(t))),o.length>0&&(t.styles=o),new Set([...Object.keys(this.otherModels??{}),...Object.keys(this.otherSourceData??{})]).forEach((e=>t[e]=this.otherModels[e]?Array.from(this.otherModels[e]).map((t=>t.getSourceData())):this.otherSourceData[e])),t}calcHeaderHeights(){this._headerCount=0,this._headerHeights=[],this.columns.forEach((t=>{this._headerCount=t.header?t.header.length:this._headerCount,this._headerHeights.length<this._headerCount&&this._headerHeights.push(...Array(this._headerCount-this._headerHeights.length).fill(0)),t.header?.forEach(((t,e)=>{e>=this._headerHeights.length&&this._headerHeights.push(0),this._headerHeights[e]=Math.max(this._headerHeights[e],t.height??0)}))}))}indexRows(){this.visibleRows=[],this.rows.forEach(((t,e)=>{t.index=e,t.isLoaded||(t.collapsed=!0),t.hidden||t.filterState==zr.Filtered||(t.visibleIndex=this.visibleRows.length,this.visibleRows.push(t))}))}indexVisibleRows(){this.visibleRows=[];let t=0;if(this._levelBasedRowTree){if(this.rowRoot.walkVisible((e=>{e.visibleIndex=t++,this.visibleRows.push(e)})),this.options.rowTree.reversed){const e=new Array(this.visibleRows.length);this.visibleRows.forEach(((i,o)=>{t=this.visibleRows.length-o-1,i.visibleIndex=t,e[t]=i})),this.visibleRows=e}}else this.rowRoot.walkVisible((t=>this.visibleRows[t.index]=t)),this.visibleRows=this.visibleRows.filter((e=>!!e&&(e.visibleIndex=t++,!0)))}indexRowsByTree(){this.rows=[];let t=0;this.rowRoot.walk((e=>{e.index=t++,this.rows.push(e)})),this.options.rowTree.reversed&&this.rows.reverse(),this.indexVisibleRows()}indexColumns(){this.visibleColumns=[],this.columns.forEach(((t,e)=>{t.index=e,t.hidden||this.visibleColumns.push(t)}))}indexVisibleColumns(){this.visibleColumns=[],this.visibleColumnIndex={};let t=0;if(this.colRoot.walkVisible((e=>{e.visibleIndex=t,this.visibleColumnIndex[e.index]=t++,this.visibleColumns.push(e)})),this.options.columnTree.reversed){this.visibleColumnIndex={};const e=new Array(this.visibleColumns.length);this.visibleColumns.forEach(((i,o)=>{t=this.visibleColumns.length-o-1,i.visibleIndex=t,this.visibleColumnIndex[i.index]=t,e[t]=i})),this.visibleColumns=e}this.indexHeaders()}indexHeaders(){this._mergedHeaders=[],this._headerCount=0,this.colRoot.walkVisible((t=>{this._headerCount=Math.max(t.header?t.header.length:0,this._headerCount),t.mergedHeaders.forEach((e=>this._mergedHeaders.push({h:e,c:t.index,r:e.r,cs:t.calculateRealColspan(e.cs??1),rs:e.rs??1})))})),this._mergedHeaders.forEach((t=>{if(!t.h.hidden)for(let e=t.c;e<t.c+t.cs;e++)for(let i=t.r;i<t.r+t.rs;i++)(i>t.r||e>t.c)&&this.columns[e]&&this.columns[e].header[i]&&(this.columns[e].header[i].hidden=!0)})),this.calcHeaderHeights()}removeHeader(t){this.columns.forEach((e=>{t<e.header.length&&e.header.splice(t,1)})),this.indexHeaders()}clear(){this.clearRows(),this.clearColumns(),this.resetViewport()}resetViewport(){return this._viewport=null,this}getViewport(t,e,i){const o=[],r=[];let s,n,a=e.h,l=0;for(l=0;l<i.t;l++)s=this.visibleRows[l],a-=s.height,o.push(s);for(l=this.visibleRows.length-i.b;l<this.visibleRows.length;l++)s=this.visibleRows[l],a-=s.height;for(l=i.t+t.r;a>0&&l<this.visibleRows.length;)s=this.visibleRows[l++],a-=s.height,o.push(s);for(l=this.visibleRows.length-i.b;l<this.visibleRows.length;l++)o.push(this.visibleRows[l]);let c=e.w,h=0;for(h=0;h<i.l;h++)n=this.visibleColumns[h],c-=n.width,r.push(n);for(h=this.visibleColumns.length-i.r;h<this.visibleColumns.length;h++)n=this.visibleColumns[h],c-=n.width;for(h=i.l+t.c;c>0&&h<this.visibleColumns.length;)n=this.visibleColumns[h++],c-=n.width,r.push(n);for(h=this.visibleColumns.length-i.r;h<this.visibleColumns.length;h++)r.push(this.visibleColumns[h]);return this._viewport={rows:o,columns:r}}calculateViewport(){return this._viewport?this.calculations.calculateViewport(this._viewport):[]}getValuesInRange(t,e=!1){if(!(t=t.intersect(this.gridRange)))return[];const{columns:i,rows:o}=t.size,r=new Array(o);let s,n=0,a=0;for(let o=t.r1;o<=t.r2;o++){r[n]=new Array(i),a=0,s=this.rows[o];for(let i=t.c1;i<=t.c2;i++)r[n][a++]=e?s.cell(i).formattedValue:s.cell(i).value;++n}return r}setRowExpandLevel(t){this.rows.forEach((e=>{e.collapsed=!e.isLoaded&&!e.isPartialyLoaded||e.level>=t,e.level<=t&&(e.hidden=!1)})),this.indexVisibleRows()}setColumnExpandLevel(t){this.columns.forEach((e=>e.collapsed=e.level>=t)),this.indexVisibleColumns()}getViewportRange(){return this._viewport?new gv(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):null}get gridRange(){return new gv(0,0,this.columns.length-1,this.rows.length-1)}getRangeIterator(t,e=!1){return new Fw(this,e&&this._viewport?t.intersect(this.getViewportRange()):t.intersect(this.gridRange))}getInitializedCellIterator(){return new Fw(this,this.gridRange,!0)}getRowIterator(t,e=!1){return t=e&&this._viewport?t.intersect(this.getViewportRange()):t.intersect(this.gridRange),new Ww(this,t,"rows")}getColumnIterator(t,e=!1){return t=e&&this._viewport?t.intersect(this.getViewportRange()):t.intersect(this.gridRange),new Ww(this,t,"columns")}getCellArray(t){const e=[];for(const i of this.getRangeIterator(t))e.push(i);return e}transformRangeToMatrix(t,e){let i,o,r;const s=[];for(let n=(t=t.intersect(this.gridRange)).r1;n<=t.r2;n++)if(i=this.rows[n],i){r=[];for(let s=t.c1;s<=t.c2;s++)o=i.cell(s),o&&r.push(e(o));s.push(r)}return s}getCellMatrix(t){return this.getModelByRange(t)?.transformRangeToMatrix(t,(t=>t))}getValueMatrix(t){return this.getModelByRange(t)?.transformRangeToMatrix(t,(t=>t.value))}shift(t){t.sheet=this.name,this.merges.shift(t),this.calculations.shift(t),this.names.shift(t),this.comments.shift(t),this.sparklines.shift(t)}clearCalculations(t=!1){t&&this.group?this.group.models.forEach((t=>t.calculations.refresh())):this.calculations.refresh()}refreshSparklines(){this.sparklines.updateRangeMaps();for(const t of this.getInitializedCellIterator())t.invalidateStyle()}clearCalculatedStyles(){this.conditionalFormats.refresh();const t=[];for(const e of this.getInitializedCellIterator())t.push(e),e.invalidateStyle()}insertColumns(t,e,i=!1){const o=this.columns[Math.min(this.columns.length-1,t)].parent;i&&++t,this.shift({index:t,offset:e,direction:"right"});for(let i=0;i<this.rows.length;i++)this.rows[i].insertColumns(t,e,!1);const r=new Array(e).fill(null).map((()=>new pw(this)));return this.columns.splice(t,0,...r),this.maxColumnLevel>0&&o.insertChildren(r,t-(o.index||-1)-1),this.indexColumns(),this.clearCalculations(!0),r}deleteColumns(t,e){const i=this.columns[t].parent;this.shift({index:t,offset:e,direction:"left"});const o=[];for(let i=0;i<this.rows.length;i++)o.push(this.rows[i].deleteColumns(t,e,!1));const r=this.columns.splice(t,e);return i?.deleteChildren(r),this.indexColumns(),this.clearCalculations(!0),r}insertRows(t,e,i=!1){const o=Math.min(this.rows.length-1,t),r=o<0?this.rowRoot:this.rows[o].parent;i&&++t;const s=isNaN(e)?e.length:e;this.shift({index:t,offset:s,direction:"down"});const n=isNaN(e)?e:new Array(s).fill(null).map((()=>new Gw(this)));return this.rows.splice(t,0,...n),this.maxRowLevel>0&&r.insertChildren(n,t-(r.index||-1)-1),this.indexRows(),this.theme&&(lx(this.theme,this,n),nx(this.theme,this,new gv(0,n[0].index,1/0,n[n.length-1].index))),this.clearCalculations(!0),n}deleteRows(t,e){const i=this.rows[t].parent;this.shift({index:t,offset:e,direction:"up"});const o=this.rows.splice(t,e);return i?.deleteChildren(o),this.indexRows(),this.clearCalculations(!0),o}moveRows(t,e,i){const o=this.rows.splice(t,e);return this.rows.splice(i,0,...o),this.shift({index:t,offset:i-t,direction:"down",maxIndex:t+e-1}),this.indexRows(),this.clearCalculations(!0),o}moveColumns(t,e,i){const o=this.columns.splice(t,e);return this.columns.splice(i,0,...o),this.shift({index:t,offset:i-t,direction:"right",maxIndex:t+e-1}),this.indexColumns(),this.clearCalculations(!0),o}spillValues(t){const{cell:e,values:i,displayValues:o,propertyCell:r}=t,s=[],n=[],a=0===i.length||0===i[0].length;let l,c;const h=a?null:new gv(e.c,e.r,e.c+i[0].length-1,e.r+i.length-1);if(e.spillRange&&this.getRangeIterator(e.spillRange,!0).forEach((t=>{e==t||h?.contains(t.range)||t.clearSpilledValue()})),e.spillRange=h,a)return{cells:s,oldValues:n,range:null};for(let t=h.r1;t<=h.r2;t++){if(l=this.rows[t],!l)continue;const a=t-h.r1;for(let t=h.c1;t<=h.c2;t++){const d=t-h.c1;c=l.cell(t),c.editable&&(n.push(c.value2),c.spillValue(i[a][d],e),r&&(c.format=r.format,c.type=r.type),o&&null!=o[a][d]&&(c.displayValue=o[a][d]),s.push(c))}}return{cells:s,oldValues:n,range:h}}getCellByName(t,e,i=!0){return this.names.getCellByName(t,e)||(this.group&&i?this.group.getCellByName(t,e):null)}getRangeByName(t,e=!0){return this.names.getRangeByName(t)||(this.group&&e?this.group.getRangeByName(t):null)}getValueMatrixByName(t,e=!0){const i=this.names.getRangeByName(t);return i?this.getValueMatrix(i):this.group&&e?this.group.getValueMatrixByName(t):null}rebuildRowTree(){const t=this._levelBasedRowTree?Rr:Tr;this._maxRowLevel=t(this.rows,this.rowRoot,{reverse:this.options.rowTree.reversed}),this.indexRowsByTree()}rebuildColumnTree(){const t=this._levelBasedColTree?Rr:Tr;this._maxColumnLevel=t(this.columns,this.colRoot,{reverse:this.options.columnTree.reversed}),this.indexColumns()}calculateCellOffset(t){let e=0,i=0;for(let i=0;i<t.c1&&this.columns[i];i++)e+=this.columns[i].width;for(let e=0;e<t.r1&&this.rows[e];e++)i+=this.rows[e].height;return{x:e,y:i}}}class gx{get errors(){return this._errors}get(t){return this.models.get(t)}has(t){return this.models.has(t)}getNewName(){let t;do{t=`sheet${this._max}`}while(this.models.has(t));return t}add(t){if(t.index=t.index??this._max,++this._max,t.name=t.name||this.getNewName(),this.models.has(t.name))throw Error(`sheet "${t.name}" already exists`);return this.models.set(t.name,t),t.group=this,t}duplicate(t){const e=this.get(t);if(!e)return;const i=new px(e.getSourceData(),e.options);let o=1;for(;this.models.has(`${t}_${o}`);)++o;return i.name=`${t}_${o}`,this.add(i),i}remove(t){return this.models.delete(t),this}rename(t,e){if(this.has(t)){if(this.has(e))throw new Error(`Model '${e}' already exists`);const i=this.get(t);i.name=e,this.models.set(e,i),this.models.delete(t),this.models.forEach((i=>{i.calculations.renameSheet(t,e)&&i.calculateViewport()}))}return this}clear(){this.models.clear(),this._errors=[]}constructor(t){this._max=0,this.models=new Map,this.themes=new Map,this._errors=[],t&&this.populate(t)}populate(t){this.clear(),t.models.forEach((t=>{const e=new px(t);try{this.add(e)}catch(t){this.errors.push(t)}})),t.themes&&t.themes.forEach((t=>this.themes.set(t.name,t)))}getSourceData(){const t={models:[]};return this.models.forEach((e=>t.models.push(e.getSourceData()))),t}getCellByName(t,e){for(const i of this.models.values()){const o=i.getCellByName(t,e,!1);if(o)return o}return null}getRangeByName(t){for(const e of this.models.values()){const i=e.getRangeByName(t,!1);if(i)return i}return null}getValueMatrixByName(t){for(const e of this.models.values()){const i=e.getValueMatrixByName(t,!1);if(i)return i}return null}}class mx{constructor(t){this.model=t,this.stack=[],this.restack=[]}push(t){return this.restack=[],t.timestamp||(t.timestamp=Date.now()),this.stack.push(t),this}pop(t=1){let e=0;const i=[];for(;e++<t&&this.stack.length>0;){const t=this.stack.pop();i.push(t),this.restack.push(t)}return i}pop2(t=1){let e=0;const i=[];for(;e++<t&&this.restack.length>0;){const t=this.restack.pop();i.push(t),this.stack.push(t)}return i}}class fx{get activeCellCoords(){return{c:this.range.c1+this.activeCell.c1,r:this.range.r1+this.activeCell.r1}}constructor(t,e,i,o){this.hidden=!1,this.range=new gv(t,e,i,o),this.activeCell=new gv(0,0)}static fromRange(t){return new fx(t.c1,t.r1,t.c2,t.r2)}setCoords(t,e,i,o){this.range.setCoords(t,e,i,o),this.activeCell.setCoords(0,0)}setRange(t){"string"==typeof t&&(t=gv.fromA1(t)),this.range.setCoords(t.c1,t.r1,t.c2,t.r2),this.activeCell.setCoords(0,0)}move(t,e,i,o){this.range.setCoords(this.range.c1+this.activeCell.c1,this.range.r1+this.activeCell.r1,this.range.c1+this.activeCell.c2,this.range.r1+this.activeCell.r2),this.range.move(t,e,i,o,!1),this.activeCell.setCoords(0,0)}moveRange(t,e,i,o){this.range.move(t,e,i,o,!0)}moveActiveCell(t,e){const{columns:i,rows:o}=this.range.size;this.activeCell.move(t,e,i,o,!0)}}const vx={...qf,CUSTOM_CLIPBOARD_TYPE:"web application/json"};class bx{constructor(t,e,i=vx.MAX_CACHE_ITEMS){this.maxCacheItems=i,this.queue=[],this.disabled=!1,this.table=new Array(e).fill(null).map((()=>new Array(t)))}get(t,e){return this.table[e][t]}delete(t,e){return this.table[e][t]=null,this}deleteColumn(t){for(let e=0;e<this.table.length;e++)this.table[e][t]=null;return this}deleteRow(t){return this.table[t]=new Array(this.table[0].length).fill(null),this}set(t,e,i){this.disabled||(this.get(t,e)||this.queue.push([e,t]),this.table[e][t]=i)}clear(){this.queue=[],this.table=this.table.map((t=>new Array(t.length)))}clean(){if(this.maxCacheItems>0&&this.queue.length>this.maxCacheItems){let t=this.queue.length;for(let e=0;e<this.queue.length;e++){const i=this.queue[e];if(!this.table[i[0]][i[1]].parentNode&&(this.queue[e]=null,this.table[i[0]][i[1]]=null,--t<=this.maxCacheItems))break}t<this.queue.length&&(this.queue=this.queue.filter((t=>t)))}}}var yx=function(t,e,i,o){var r,s=arguments.length,n=s<3?e:null===o?o=Object.getOwnPropertyDescriptor(e,i):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)n=Reflect.decorate(t,e,i,o);else for(var a=t.length-1;a>=0;a--)(r=t[a])&&(n=(s<3?r(n):s>3?r(e,i,n):r(e,i))||n);return s>3&&n&&Object.defineProperty(e,i,n),n};let wx=class extends _n{constructor(){super(),this.render=()=>sn`
|
|
3704
3704
|
<og-icon id="filterIcon" .icon="${{icon:"filter"}}"></og-icon>
|
|
3705
3705
|
<div class="text">${Y(this.value)?sn`
|
|
3706
3706
|
<og-icon .icon="${this.value?"square-check":"square"}"></og-icon>
|
|
@@ -3939,7 +3939,7 @@
|
|
|
3939
3939
|
overflow: hidden;
|
|
3940
3940
|
outline-width: 0;
|
|
3941
3941
|
cursor: default;
|
|
3942
|
-
font-weight:
|
|
3942
|
+
font-weight: normal;
|
|
3943
3943
|
text-align: center;
|
|
3944
3944
|
position: relative;
|
|
3945
3945
|
}
|
|
@@ -4132,7 +4132,7 @@
|
|
|
4132
4132
|
</style>
|
|
4133
4133
|
|
|
4134
4134
|
${this.table}
|
|
4135
|
-
`,this.clearHeaderCache=()=>{this.resetFreezeLeft(),this.hCache=new bx(this.model.columns.length,this.columnHeaderCount),this.hCache.disabled=!this.model.options.cellCache},this.clearBodyCache=()=>{this.bCache=new bx(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)if(this.offsetWidth>0){let t=0;for(let e=0;e<this.model.options.freezeLeft;e++)t+=this.model.columns[e].width;this._freezeLeft=t<this.offsetWidth/2?this.model.options.freezeLeft:0}else this._freezeLeft=this.model.options.freezeLeft;return this._freezeLeft}get freezeTop(){return null==this._freezeTop&&(this._freezeTop=this.model.options.freezeTop),this._freezeTop}previewZoom(t){Qt(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/vx.MIN_ROW_HEIGHT,this.model.rows.length))}get renderColCount(){return this.renderAll?this.model.visibleColumns.length+this.rowHeaderCount:Math.round(Math.min(this.clientWidth/vx.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+=vx.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-vx.SLIDER_SIZE)/this.zoom,h:(this.clientHeight-this.totalHeaderHeight-vx.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 gv(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=zt(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 Lx("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:vx.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,!1,!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 Nu;e.addEventListener("toggle",(()=>this.grid.rendering.toggleColumn(i.index))),r.expander=e,r.appendChild(e),Ht(e,{l:t/2-vx.EXPANDER_SIZE/2,t:i.level*o+o/2-vx.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&&Vk(r,aw(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 Nu,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"}e.sorting&&o==e.header.length-1&&(t.className+=" sort",r.sortingArrow||(r.sortingArrow=new zx,r.appendChild(r.sortingArrow),Ht(r.sortingArrow,{t:0,r:5})),r.sortingArrow.sortSettings=this.model.sorting.get(e.index)),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.grid.filtering.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||vx.EXPANDER_SIZE+2)/(this.model.maxRowLevel+1),vx.EXPANDER_SIZE+2);if(this.model.hasRowTree)for(let t=0;t<=this.model.maxRowLevel;t++){const i=new Pu;i.level=t,this.cornerDiv.appendChild(i),Ht(i,{l:t*e+e/2-vx.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 Pu;r.level=t,this.cornerDiv.appendChild(r),Ht(r,o?{t:t*i+i/2-vx.EXPANDER_SIZE/2,r:3}:{r:t*e+e/2-vx.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 gv(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&&Bt(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>${mv(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==hx.HIDDEN){const t=d.hiddenCells.get(n.address),i=m.intersect(new gv(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==hx.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"),tC(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 Nu;t.addEventListener("toggle",(()=>this.grid.rendering.toggleRow(e.index))),i.parentElement.expander=t,o.expander=t,o.appendChild(t),Ht(t,{t:r/2-vx.EXPANDER_SIZE/2,l:e.level*s+s/2-vx.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)}};Rx.styles=[Sx],Ix([Ln({type:Object})],Rx.prototype,"model",void 0),Ix([Ln({type:Boolean,reflect:!0})],Rx.prototype,"hideOuterBorder",void 0),Ix([Ln({type:Number,hasChanged:()=>!1})],Rx.prototype,"rowOffset",void 0),Ix([Ln({type:Number,hasChanged:()=>!1})],Rx.prototype,"colOffset",void 0),Ix([Ln({type:Number,reflect:!0})],Rx.prototype,"zoom",void 0),Ix([Ln({type:Boolean,reflect:!0})],Rx.prototype,"nogrid",void 0),Ix([Ln({type:Boolean,reflect:!0})],Rx.prototype,"renderAll",void 0),Rx=Ix([En("og-table")],Rx);const Tx=["F5","F12"];class Ax extends Event{constructor(t){super("grid.error",{bubbles:!0,composed:!0}),this.error=t}}class Ox 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 $x extends Ox{constructor(t){super("edit",t)}}class Dx extends gp{constructor(t,e,i){super(`grid.${t}`,i),this.grid=e}}class Nx extends Dx{constructor(t,e,i,o){super(t,e,o),this.column=i}}class Px extends Dx{constructor(t,e,i,o){super(t,e,o),this.row=i}}class jx{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(Tx.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;const i=this.grid.hSizer,o=this.grid.vSizer,{offsetX:r,offsetY:s}=t;let n=this.model.options.scrolling.scrollbarVisibilityTreshold;n<=0&&(n=Math.max(this.grid.clientWidth,this.grid.clientHeight)),r>this.grid.clientWidth-n?this.grid.vSlider.show():this.grid.vSlider.hide(),s>this.grid.clientHeight-n?this.grid.hSlider.show():this.grid.hSlider.hide();const[a,l]=this.table.findNearestTableCellByOffset(r,s);if(l&&"TH"==l.tagName&&(this.model.options.columnResize&&!i.resizing&&l.classList.contains("hlabel")?l.offsetWidth-t.offsetX+l.offsetLeft<vx.RESIZE_TRESHOLD?(i.snap(l,this.grid),this.grid.rendering.currentResizedColumn=this.model.columns[l.c]):kt(i):this.model.options.rowResize&&!o.resizing&&l.classList.contains("vlabel")&&(l.offsetHeight-t.offsetY+l.offsetTop<vx.RESIZE_TRESHOLD?(o.snap(l,this.grid),this.grid.rendering.currentResizedRow=this.model.rows[l.r]):kt(o))),a&&"TH"==a.tagName)this.grid.selecting.isSelecting&&(this.suspendClick(),this.grid.selecting.updateSelecting(a.c,a.r));else{if(a&&"TD"==a.tagName)if(this.grid.selecting.isSelectorOperationActive||this.grid.selecting.isFormulaSelectorOperationActive){const{top:e,left:i}=Tt(a,this.grid);this.grid.rendering.autoscroll({x:i-this.table.totalHeaderWidth+t.offsetX-a.offsetLeft,y:e-this.table.thead.clientHeight+t.offsetY-a.offsetTop}),this.grid.selecting.isSelecting&&this.suspendClick(),this.grid.selecting.updateSelecting(a.c,a.r)}else{const t=this.model.rows[a.r]?.cell(a.c);t&&t.hasTooltip&&(e=!1,this.grid.tooltip.attachToCell(a,t)),t&&t.hasComment&&(e=!1,this.grid.comment.attachedTo!==a&&this.grid.comment.attachTo(a,t))}e&&(this.grid.tooltip.deatach(),this.grid.comment.deatach(this.model.options.comments.hideTimeout)),kt(i),kt(o)}},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 gv(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 Ox("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 Nx("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 Px("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}=Yy(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 $x({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 Ox("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 Nx("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 Px("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 Hx{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.grid.filtering?.filter?Array.from(this.grid.filtering.filter.settings.values()):null,order:this.grid.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 Ox("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 Ox("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 Ox("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 Ox("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?gv.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${Aa(Fa().themes.get("light")).cssText}\n\t\t\t\t}\n\t\t\t\t${r?"table {break-after: page}":""}\n\t\t\t\t${Rx.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,qf.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)}}),qf.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<qf.AUTOSCROLL_TRESHOLD&&e<i&&e<r-i?(s="left",n=qf.AUTOSCROLL_TRESHOLD-e):o-e<qf.AUTOSCROLL_TRESHOLD&&o-e<i&&o-e<r-i?(s="right",n=qf.AUTOSCROLL_TRESHOLD-o+e):i<qf.AUTOSCROLL_TRESHOLD?(s="up",n=qf.AUTOSCROLL_TRESHOLD-i):r-i<qf.AUTOSCROLL_TRESHOLD&&(s="down",n=qf.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 Ox("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 Ox("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(gv.fromA1(o.address),!!e)){const e=tC(t).call(this.table,r,t)||r;e.style.width="auto",s=Math.max(s,e.offsetWidth)}o.width=s+10,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(gv.fromA1(o.address),!!e)){const e=tC(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)?gv.fromA1(t):new gv(e,t),this.table.rowOffset=i.r1,this.table.colOffset=i.c1,this.requireVerticalUpdate=!0,this.requireHorizontalUpdate=!0,this.debounceRenderCells(),this.updateSliders()}}class Fx{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 fx(0,0,0,0),this.formulaSelectors=new Map,this.debounceMoveSelector=q(((t,e)=>this.moveSelector(t,e)),10)}moveToSelection(){const t=new gv(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 Ox("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 gv(t,null,t,null);this.startSelectingRange=e.clone(),this.select(e,!0)}startRowSelecting(t){this.rowSelecting=!0;const e=new gv(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 Ox("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 Ox("select",{grid:this.grid}))}shiftActiveCell(t,e=!1){this.selection.moveActiveCell(t,0),this.selector.updatePosition(),e&&this.grid.dispatchEvent(new Ox("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=fx.fromRange(gv.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=>Et(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 Bx extends Event{}class Wx extends _n{get isOpen(){return this._open}get isValid(){return this._valid}validate(){return this._valid=!0,this.activeCell&&(this._valid=Xy(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),Qt(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 Bx("activate"))}deactivate(){this.dispatchEvent(new Bx("deactivate"))}}Wx.baseStyles=ys`
|
|
4135
|
+
`,this.clearHeaderCache=()=>{this.resetFreezeLeft(),this.hCache=new bx(this.model.columns.length,this.columnHeaderCount),this.hCache.disabled=!this.model.options.cellCache},this.clearBodyCache=()=>{this.bCache=new bx(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)if(this.offsetWidth>0){let t=0;for(let e=0;e<this.model.options.freezeLeft;e++)t+=this.model.columns[e].width;this._freezeLeft=t<this.offsetWidth/2?this.model.options.freezeLeft:0}else this._freezeLeft=this.model.options.freezeLeft;return this._freezeLeft}get freezeTop(){return null==this._freezeTop&&(this._freezeTop=this.model.options.freezeTop),this._freezeTop}previewZoom(t){Qt(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/vx.MIN_ROW_HEIGHT,this.model.rows.length))}get renderColCount(){return this.renderAll?this.model.visibleColumns.length+this.rowHeaderCount:Math.round(Math.min(this.clientWidth/vx.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+=vx.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-vx.SLIDER_SIZE)/this.zoom,h:(this.clientHeight-this.totalHeaderHeight-vx.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 gv(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=zt(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 Lx("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:vx.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,!1,!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 Nu;e.addEventListener("toggle",(()=>this.grid.rendering.toggleColumn(i.index))),r.expander=e,r.appendChild(e),Ht(e,{l:t/2-vx.EXPANDER_SIZE/2,t:i.level*o+o/2-vx.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&&Vk(r,aw(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 Nu,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"}e.sorting&&o==e.header.length-1&&(t.className+=" sort",r.sortingArrow||(r.sortingArrow=new zx,r.appendChild(r.sortingArrow),Ht(r.sortingArrow,{t:0,r:5})),r.sortingArrow.sortSettings=this.model.sorting.get(e.index)),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.grid.filtering.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||vx.EXPANDER_SIZE+2)/(this.model.maxRowLevel+1),vx.EXPANDER_SIZE+2);if(this.model.hasRowTree)for(let t=0;t<=this.model.maxRowLevel;t++){const i=new Pu;i.level=t,this.cornerDiv.appendChild(i),Ht(i,{l:t*e+e/2-vx.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 Pu;r.level=t,this.cornerDiv.appendChild(r),Ht(r,o?{t:t*i+i/2-vx.EXPANDER_SIZE/2,r:3}:{r:t*e+e/2-vx.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 gv(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&&Bt(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>${mv(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==hx.HIDDEN){const t=d.hiddenCells.get(n.address),i=m.intersect(new gv(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==hx.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"),tC(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 Nu;t.addEventListener("toggle",(()=>this.grid.rendering.toggleRow(e.index))),i.parentElement.expander=t,o.expander=t,o.appendChild(t),Ht(t,{t:r/2-vx.EXPANDER_SIZE/2,l:e.level*s+s/2-vx.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)}};Rx.styles=[Sx],Ix([Ln({type:Object})],Rx.prototype,"model",void 0),Ix([Ln({type:Boolean,reflect:!0})],Rx.prototype,"hideOuterBorder",void 0),Ix([Ln({type:Number,hasChanged:()=>!1})],Rx.prototype,"rowOffset",void 0),Ix([Ln({type:Number,hasChanged:()=>!1})],Rx.prototype,"colOffset",void 0),Ix([Ln({type:Number,reflect:!0})],Rx.prototype,"zoom",void 0),Ix([Ln({type:Boolean,reflect:!0})],Rx.prototype,"nogrid",void 0),Ix([Ln({type:Boolean,reflect:!0})],Rx.prototype,"renderAll",void 0),Rx=Ix([En("og-table")],Rx);const Tx=["F5","F12"];class Ax extends Event{constructor(t){super("grid.error",{bubbles:!0,composed:!0}),this.error=t}}class Ox 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 $x extends Ox{constructor(t){super("edit",t)}}class Dx extends gp{constructor(t,e,i){super(`grid.${t}`,i),this.grid=e}}class Nx extends Dx{constructor(t,e,i,o){super(t,e,o),this.column=i}}class Px extends Dx{constructor(t,e,i,o){super(t,e,o),this.row=i}}class jx{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(Tx.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<vx.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<vx.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 gv(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 Ox("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 Nx("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 Px("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}=Yy(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 $x({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 Ox("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 Nx("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 Px("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 Hx{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.grid.filtering?.filter?Array.from(this.grid.filtering.filter.settings.values()):null,order:this.grid.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 Ox("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 Ox("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 Ox("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 Ox("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?gv.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${Aa(Fa().themes.get("light")).cssText}\n\t\t\t\t}\n\t\t\t\t${r?"table {break-after: page}":""}\n\t\t\t\t${Rx.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,qf.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)}}),qf.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<qf.AUTOSCROLL_TRESHOLD&&e<i&&e<r-i?(s="left",n=qf.AUTOSCROLL_TRESHOLD-e):o-e<qf.AUTOSCROLL_TRESHOLD&&o-e<i&&o-e<r-i?(s="right",n=qf.AUTOSCROLL_TRESHOLD-o+e):i<qf.AUTOSCROLL_TRESHOLD?(s="up",n=qf.AUTOSCROLL_TRESHOLD-i):r-i<qf.AUTOSCROLL_TRESHOLD&&(s="down",n=qf.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 Ox("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 Ox("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(gv.fromA1(o.address),!!e)){const e=tC(t).call(this.table,r,t)||r;e.style.width="auto",s=Math.max(s,e.offsetWidth)}o.width=s+10,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(gv.fromA1(o.address),!!e)){const e=tC(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)?gv.fromA1(t):new gv(e,t),this.table.rowOffset=i.r1,this.table.colOffset=i.c1,this.requireVerticalUpdate=!0,this.requireHorizontalUpdate=!0,this.debounceRenderCells(),this.updateSliders()}}class Fx{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 fx(0,0,0,0),this.formulaSelectors=new Map,this.debounceMoveSelector=q(((t,e)=>this.moveSelector(t,e)),10)}moveToSelection(){const t=new gv(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 Ox("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 gv(t,null,t,null);this.startSelectingRange=e.clone(),this.select(e,!0)}startRowSelecting(t){this.rowSelecting=!0;const e=new gv(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 Ox("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 Ox("select",{grid:this.grid}))}shiftActiveCell(t,e=!1){this.selection.moveActiveCell(t,0),this.selector.updatePosition(),e&&this.grid.dispatchEvent(new Ox("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=fx.fromRange(gv.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=>Et(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 Bx extends Event{}class Wx extends _n{get isOpen(){return this._open}get isValid(){return this._valid}validate(){return this._valid=!0,this.activeCell&&(this._valid=Xy(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),Qt(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 Bx("activate"))}deactivate(){this.dispatchEvent(new Bx("deactivate"))}}Wx.baseStyles=ys`
|
|
4136
4136
|
* { box-sizing: border-box }
|
|
4137
4137
|
|
|
4138
4138
|
:host {
|
|
@@ -4572,7 +4572,7 @@
|
|
|
4572
4572
|
position: absolute;
|
|
4573
4573
|
inset: 0;
|
|
4574
4574
|
}
|
|
4575
|
-
`,Nk([Ln({type:Object})],Pk.prototype,"cell",void 0),Pk=Nk([En("og-grid-sparkline")],Pk);let jk=class extends Ep{constructor(){super()}connectedCallback(){super.connectedCallback()}attachToCell(t,e){this.content=e.tooltip,this.attachTo(t,
|
|
4575
|
+
`,Nk([Ln({type:Object})],Pk.prototype,"cell",void 0),Pk=Nk([En("og-grid-sparkline")],Pk);let jk=class extends Ep{constructor(){super()}connectedCallback(){super.connectedCallback()}attachToCell(t,e,i="right"){this.content=e.tooltip,this.attachTo(t,i)}};jk.styles=[...Ep.styles],jk=function(t,e,i,o){var r,s=arguments.length,n=s<3?e:null===o?o=Object.getOwnPropertyDescriptor(e,i):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)n=Reflect.decorate(t,e,i,o);else for(var a=t.length-1;a>=0;a--)(r=t[a])&&(n=(s<3?r(n):s>3?r(e,i,n):r(e,i))||n);return s>3&&n&&Object.defineProperty(e,i,n),n}([En("og-grid-tooltip")],jk);const Hk=ys`
|
|
4576
4576
|
* {
|
|
4577
4577
|
box-sizing: border-box;
|
|
4578
4578
|
}
|
|
@@ -9333,4 +9333,4 @@ milkdown-block-handle {
|
|
|
9333
9333
|
`:null}
|
|
9334
9334
|
</div>
|
|
9335
9335
|
</og-panel>
|
|
9336
|
-
`: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?gv.fromA1(this.categoryRangeInput.value):null,this.model.seriesRange=this.seriesRangeInput?.value?gv.fromA1(this.seriesRangeInput.value):null,this.model.dataRange=gv.fromA1(this.dataRangeInput.value),this.dispatchEvent(new Yr({value:this.model}))}async updated(){this.editTitle&&this.titleInput&&(await this.titleInput.updateComplete,this.titleInput.focus(),this.titleInput.selectAll())}};Yz.styles=[Gz],qz([Ln({type:Object})],Yz.prototype,"model",void 0),qz([Rn()],Yz.prototype,"editTitle",void 0),qz([An("#title")],Yz.prototype,"titleInput",void 0),qz([An("#type")],Yz.prototype,"typeList",void 0),qz([An("#dataRange")],Yz.prototype,"dataRangeInput",void 0),qz([An("#seriesRange")],Yz.prototype,"seriesRangeInput",void 0),qz([An("#categoryRange")],Yz.prototype,"categoryRangeInput",void 0),Yz=qz([En("og-plugin-chart-form")],Yz);const Zz=Fa().themes.get("dark");Object.assign(Zz.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 Xz=Fa().themes.get("light");Object.assign(Xz.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 Qz=i(6946),Kz=i(6471),Jz=i(4969),tI=i(9502),eI=i(7706),iI=i(1480),oI=i(2006),rI=i(7503),sI=i(7873),nI=i(8746),aI=i(2570),lI=i(8815),cI=i(6390),hI=i(6593),dI=i(895),uI=i(9083),pI=i(6093),gI=i(9685),mI=i(9849),fI=i(8268),vI=i(4693),bI=i(3599),yI=i(782),wI=i(754),xI=i(5700),kI=i(4731),CI=i(7291),MI=i(597),_I=i(1474),SI=i(6224),EI=i(6239),zI=i(6828),II=i(2212),LI=i(863),RI=i(3602),TI=i(1985),AI=i(886),OI=i(7201),$I=i(9937),DI=i(8450),NI=i(9630),PI=i(9766),jI=i(388),HI=i(1903),FI=i(398),BI=i(6105),WI=i(6147),VI=i(5722),UI=i(5576),GI=i(3131),qI=i(6308),YI=i(9645),ZI=i(3199),XI=i(871),QI=i(5251),KI=i(6426),JI=i(2643),tL=i(8522),eL=i(6398),iL=i(2525),oL=i(8434),rL=i(6138),sL=i(5835),nL=i(5654),aL=i(6659),lL=i(2977),cL=i(4480),hL=i(9886),dL=i(6815),uL=i(1582),pL=i(2968),gL=i(394),mL=i(7024),fL=i(7853),vL=i(8249),bL=i(2869),yL=i(486),wL=i(5735),xL=i(470),kL=i(4612),CL=i(4018),ML=i(1476),_L=i(3194),SL=i(3525),EL=i(7541),zL=i(4104),IL=i(6686),LL=i(7719),RL=i(3898),TL=i(8153),AL=i(3690),OL=i(1776),$L=i(4980),DL=i(5578),NL=i(9613),PL=i(1119),jL=i(8444),HL=i(2978),FL=i(9130),BL=i(2127),WL=i(2732),VL=i(4287),UL=i(4045),GL=i(7642),qL=i(1367),YL=i(320),ZL=i(821),XL=i(102),QL=i(7683),KL=i(3980),JL=i(576),tR=i(654),eR=i(73),iR=i(140),oR=i(8129),rR=i(5087),sR=i(6992),nR=i(8247),aR=i(8038),lR=i(5286),cR=i(9179),hR=i(1808),dR=i(9459),uR=i(2883),pR=i(9124),gR=i(7067),mR=i(1054),fR=i(7325),vR=i(1272),bR=i(3359),yR=i(6562),wR=i(4193),xR=i(6348),kR=i(2435),CR=i(9111),MR=i(9318),_R=i(7294),SR=i(4479),ER=i(2409),zR=i(3091),IR=i(5789),LR=i(5890),RR=i(3874),TR=i(2907),AR=i(1175),OR=i(1686),$R=i(703),DR=i(6606),NR=i(4194),PR=i(6228),jR=i(62),HR=i(2072),FR=i(9744),BR=i(25),WR=i(2618),VR=i(1988),UR=i(8013),GR=i(1133),qR=i(362),YR=i(6845),ZR=i(6800),XR=i(1103),QR=i(4933),KR=i(7284),JR=i(2620),tT=i(2366),eT=i(7457),iT=i(2449),oT=i(2),rT=i(5697),sT=i(7069),nT=i(4716),aT=i(4740),lT=i(4557),cT=i(1868),hT=i(8647),dT=i(5127),uT=i(4816),pT=i(4009),gT=i(5104),mT=i(2830),fT=i(3093),vT=i(5029),bT=i(3514),yT=i(2142),wT=i(4999),xT=i(7523),kT=i(346),CT=i(7917),MT=i(3976),_T=i(9801),ST=i(2464),ET=i(5511),zT=i(5210),IT=i(5815),LT=i(3339),RT=i(7472),TT=i(8811),AT=i(8548),OT=i(6880),$T=i(1840),DT=i(5547),NT=i(4788),PT=i(9467),jT=i(9187),HT=i(9217),FT=i(7897),BT=i(2644),WT=i(6204),VT=i(1472),UT=i(1247),GT=i(7406),qT=i(925),YT=i(7455),ZT=i(3771),XT=i(1549),QT=i(3541),KT=i(3140),JT=i(9800),tA=i(229),eA=i(2677),iA=i(1844),oA=i(3245),rA=i(9056),sA=i(7535),nA=i(2359),aA=i(15),lA=i(5569),cA=i(2014),hA=i(1599),dA=i(6521),uA=i(232),pA=i(9745),gA=i(9594),mA=i(6979),fA=i(4494),vA=i(312),bA=i(4983),yA=i(1258),wA=i(6313),xA=i(12),kA=i(8003),CA=i(7830),MA=i(8875),_A=i(3911),SA=i(1817),EA=i(478),zA=i(2585),IA=i(6564),LA=i(2884),RA=i(3825),TA=i(7348),AA=i(9277),OA=i(4118),$A=i(9200),DA=i(51),NA=i(2872),PA=i(4702),jA=i(9281),HA=i(1394),FA=i(7295),BA=i(2936),WA=i(3789),VA=i(3614),UA=i(4827),GA=i(9204),qA=i(9113),YA=i(4058);const ZA=[Qz.mw,Kz.mw,Jz.mw,tI.mw,eI.mw,iI.mw,oI.mw,rI.mw,nI.mw,lI.mw,aI.mw,cI.mw,hI.mw,dI.mw,uI.mw,pI.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,zI.mw,II.mw,LI.mw,RI.mw,TI.mw,AI.mw,OI.mw,$I.mw,DI.mw,NI.mw,PI.mw,jI.mw,HI.mw,BI.mw,FI.mw,WI.mw,VI.mw,UI.mw,GI.mw,qI.mw,YI.mw,ZI.mw,XI.mw,QI.mw,KI.mw,JI.mw,tL.mw,iL.mw,oL.mw,rL.mw,sL.mw,nL.mw,aL.mw,lL.mw,cL.mw,hL.mw,dL.mw,uL.mw,pL.mw,gL.mw,mL.mw,fL.mw,vL.mw,bL.mw,yL.mw,wL.mw,eL.mw,xL.mw,kL.mw,CL.mw,ML.mw,_L.mw,SL.mw,EL.mw,zL.mw,IL.mw,LL.mw,RL.mw,TL.mw,AL.mw,OL.mw,$L.mw,DL.mw,NL.mw,PL.mw,jL.mw,HL.mw,FL.mw,BL.mw,WL.mw,VL.mw,UL.mw,GL.mw,qL.mw,YL.mw,ZL.mw,XL.mw,QL.mw,KL.mw,JL.mw,tR.mw,eR.mw,iR.mw,oR.mw,rR.mw,sR.mw,nR.mw,aR.mw,EI.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,sI.mw],XA=[CR.mw,MR.mw,_R.mw,SR.mw,ER.mw,zR.mw,IR.mw,LR.mw,TR.mw,OR.mw,AR.mw,DR.mw,$R.mw,NR.mw,PR.mw,jR.mw,HR.mw,FR.mw,BR.mw,WR.mw,VR.mw,UR.mw,XR.mw,QR.mw,KR.mw,JR.mw,tT.mw,eT.mw,iT.mw,rT.mw,sT.mw,nT.mw,dT.mw,uT.mw,pT.mw,gT.mw,mT.mw,fT.mw,vT.mw,bT.mw,GR.mw,qR.mw,ZR.mw,YR.mw,yT.mw,wT.mw,xT.mw,kT.mw,CT.mw,MT.mw,_T.mw,ST.mw,aT.mw,lT.mw,cT.mw,hT.mw,zT.mw,IT.mw,LT.mw,RT.mw,TT.mw,AT.mw,OT.mw,$T.mw,DT.mw,NT.mw,PT.mw,jT.mw,HT.mw,FT.mw,BT.mw,WT.mw,VT.mw,UT.mw,GT.mw,ET.mw,qT.mw,YT.mw,ZT.mw,XT.mw,QT.mw,KT.mw,JT.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,kA.mw,CA.mw,MA.mw,_A.mw,SA.mw,EA.mw,zA.mw,IA.mw,LA.mw,RA.mw,TA.mw,AA.mw,oT.mw,OA.mw,$A.mw,DA.mw,NA.mw,PA.mw,jA.mw,HA.mw,FA.mw,BA.mw,WA.mw,VA.mw,UA.mw,GA.mw,qA.mw,YA.mw,RR.mw],QA={xlsx:F,charts:B},KA={name:"@omegagrid/bundle",version:"0.9.
|
|
9336
|
+
`: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?gv.fromA1(this.categoryRangeInput.value):null,this.model.seriesRange=this.seriesRangeInput?.value?gv.fromA1(this.seriesRangeInput.value):null,this.model.dataRange=gv.fromA1(this.dataRangeInput.value),this.dispatchEvent(new Yr({value:this.model}))}async updated(){this.editTitle&&this.titleInput&&(await this.titleInput.updateComplete,this.titleInput.focus(),this.titleInput.selectAll())}};Yz.styles=[Gz],qz([Ln({type:Object})],Yz.prototype,"model",void 0),qz([Rn()],Yz.prototype,"editTitle",void 0),qz([An("#title")],Yz.prototype,"titleInput",void 0),qz([An("#type")],Yz.prototype,"typeList",void 0),qz([An("#dataRange")],Yz.prototype,"dataRangeInput",void 0),qz([An("#seriesRange")],Yz.prototype,"seriesRangeInput",void 0),qz([An("#categoryRange")],Yz.prototype,"categoryRangeInput",void 0),Yz=qz([En("og-plugin-chart-form")],Yz);const Zz=Fa().themes.get("dark");Object.assign(Zz.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 Xz=Fa().themes.get("light");Object.assign(Xz.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 Qz=i(6946),Kz=i(6471),Jz=i(4969),tI=i(9502),eI=i(7706),iI=i(1480),oI=i(2006),rI=i(7503),sI=i(7873),nI=i(8746),aI=i(2570),lI=i(8815),cI=i(6390),hI=i(6593),dI=i(895),uI=i(9083),pI=i(6093),gI=i(9685),mI=i(9849),fI=i(8268),vI=i(4693),bI=i(3599),yI=i(782),wI=i(754),xI=i(5700),kI=i(4731),CI=i(7291),MI=i(597),_I=i(1474),SI=i(6224),EI=i(6239),zI=i(6828),II=i(2212),LI=i(863),RI=i(3602),TI=i(1985),AI=i(886),OI=i(7201),$I=i(9937),DI=i(8450),NI=i(9630),PI=i(9766),jI=i(388),HI=i(1903),FI=i(398),BI=i(6105),WI=i(6147),VI=i(5722),UI=i(5576),GI=i(3131),qI=i(6308),YI=i(9645),ZI=i(3199),XI=i(871),QI=i(5251),KI=i(6426),JI=i(2643),tL=i(8522),eL=i(6398),iL=i(2525),oL=i(8434),rL=i(6138),sL=i(5835),nL=i(5654),aL=i(6659),lL=i(2977),cL=i(4480),hL=i(9886),dL=i(6815),uL=i(1582),pL=i(2968),gL=i(394),mL=i(7024),fL=i(7853),vL=i(8249),bL=i(2869),yL=i(486),wL=i(5735),xL=i(470),kL=i(4612),CL=i(4018),ML=i(1476),_L=i(3194),SL=i(3525),EL=i(7541),zL=i(4104),IL=i(6686),LL=i(7719),RL=i(3898),TL=i(8153),AL=i(3690),OL=i(1776),$L=i(4980),DL=i(5578),NL=i(9613),PL=i(1119),jL=i(8444),HL=i(2978),FL=i(9130),BL=i(2127),WL=i(2732),VL=i(4287),UL=i(4045),GL=i(7642),qL=i(1367),YL=i(320),ZL=i(821),XL=i(102),QL=i(7683),KL=i(3980),JL=i(576),tR=i(654),eR=i(73),iR=i(140),oR=i(8129),rR=i(5087),sR=i(6992),nR=i(8247),aR=i(8038),lR=i(5286),cR=i(9179),hR=i(1808),dR=i(9459),uR=i(2883),pR=i(9124),gR=i(7067),mR=i(1054),fR=i(7325),vR=i(1272),bR=i(3359),yR=i(6562),wR=i(4193),xR=i(6348),kR=i(2435),CR=i(9111),MR=i(9318),_R=i(7294),SR=i(4479),ER=i(2409),zR=i(3091),IR=i(5789),LR=i(5890),RR=i(3874),TR=i(2907),AR=i(1175),OR=i(1686),$R=i(703),DR=i(6606),NR=i(4194),PR=i(6228),jR=i(62),HR=i(2072),FR=i(9744),BR=i(25),WR=i(2618),VR=i(1988),UR=i(8013),GR=i(1133),qR=i(362),YR=i(6845),ZR=i(6800),XR=i(1103),QR=i(4933),KR=i(7284),JR=i(2620),tT=i(2366),eT=i(7457),iT=i(2449),oT=i(2),rT=i(5697),sT=i(7069),nT=i(4716),aT=i(4740),lT=i(4557),cT=i(1868),hT=i(8647),dT=i(5127),uT=i(4816),pT=i(4009),gT=i(5104),mT=i(2830),fT=i(3093),vT=i(5029),bT=i(3514),yT=i(2142),wT=i(4999),xT=i(7523),kT=i(346),CT=i(7917),MT=i(3976),_T=i(9801),ST=i(2464),ET=i(5511),zT=i(5210),IT=i(5815),LT=i(3339),RT=i(7472),TT=i(8811),AT=i(8548),OT=i(6880),$T=i(1840),DT=i(5547),NT=i(4788),PT=i(9467),jT=i(9187),HT=i(9217),FT=i(7897),BT=i(2644),WT=i(6204),VT=i(1472),UT=i(1247),GT=i(7406),qT=i(925),YT=i(7455),ZT=i(3771),XT=i(1549),QT=i(3541),KT=i(3140),JT=i(9800),tA=i(229),eA=i(2677),iA=i(1844),oA=i(3245),rA=i(9056),sA=i(7535),nA=i(2359),aA=i(15),lA=i(5569),cA=i(2014),hA=i(1599),dA=i(6521),uA=i(232),pA=i(9745),gA=i(9594),mA=i(6979),fA=i(4494),vA=i(312),bA=i(4983),yA=i(1258),wA=i(6313),xA=i(12),kA=i(8003),CA=i(7830),MA=i(8875),_A=i(3911),SA=i(1817),EA=i(478),zA=i(2585),IA=i(6564),LA=i(2884),RA=i(3825),TA=i(7348),AA=i(9277),OA=i(4118),$A=i(9200),DA=i(51),NA=i(2872),PA=i(4702),jA=i(9281),HA=i(1394),FA=i(7295),BA=i(2936),WA=i(3789),VA=i(3614),UA=i(4827),GA=i(9204),qA=i(9113),YA=i(4058);const ZA=[Qz.mw,Kz.mw,Jz.mw,tI.mw,eI.mw,iI.mw,oI.mw,rI.mw,nI.mw,lI.mw,aI.mw,cI.mw,hI.mw,dI.mw,uI.mw,pI.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,zI.mw,II.mw,LI.mw,RI.mw,TI.mw,AI.mw,OI.mw,$I.mw,DI.mw,NI.mw,PI.mw,jI.mw,HI.mw,BI.mw,FI.mw,WI.mw,VI.mw,UI.mw,GI.mw,qI.mw,YI.mw,ZI.mw,XI.mw,QI.mw,KI.mw,JI.mw,tL.mw,iL.mw,oL.mw,rL.mw,sL.mw,nL.mw,aL.mw,lL.mw,cL.mw,hL.mw,dL.mw,uL.mw,pL.mw,gL.mw,mL.mw,fL.mw,vL.mw,bL.mw,yL.mw,wL.mw,eL.mw,xL.mw,kL.mw,CL.mw,ML.mw,_L.mw,SL.mw,EL.mw,zL.mw,IL.mw,LL.mw,RL.mw,TL.mw,AL.mw,OL.mw,$L.mw,DL.mw,NL.mw,PL.mw,jL.mw,HL.mw,FL.mw,BL.mw,WL.mw,VL.mw,UL.mw,GL.mw,qL.mw,YL.mw,ZL.mw,XL.mw,QL.mw,KL.mw,JL.mw,tR.mw,eR.mw,iR.mw,oR.mw,rR.mw,sR.mw,nR.mw,aR.mw,EI.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,sI.mw],XA=[CR.mw,MR.mw,_R.mw,SR.mw,ER.mw,zR.mw,IR.mw,LR.mw,TR.mw,OR.mw,AR.mw,DR.mw,$R.mw,NR.mw,PR.mw,jR.mw,HR.mw,FR.mw,BR.mw,WR.mw,VR.mw,UR.mw,XR.mw,QR.mw,KR.mw,JR.mw,tT.mw,eT.mw,iT.mw,rT.mw,sT.mw,nT.mw,dT.mw,uT.mw,pT.mw,gT.mw,mT.mw,fT.mw,vT.mw,bT.mw,GR.mw,qR.mw,ZR.mw,YR.mw,yT.mw,wT.mw,xT.mw,kT.mw,CT.mw,MT.mw,_T.mw,ST.mw,aT.mw,lT.mw,cT.mw,hT.mw,zT.mw,IT.mw,LT.mw,RT.mw,TT.mw,AT.mw,OT.mw,$T.mw,DT.mw,NT.mw,PT.mw,jT.mw,HT.mw,FT.mw,BT.mw,WT.mw,VT.mw,UT.mw,GT.mw,ET.mw,qT.mw,YT.mw,ZT.mw,XT.mw,QT.mw,KT.mw,JT.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,kA.mw,CA.mw,MA.mw,_A.mw,SA.mw,EA.mw,zA.mw,IA.mw,LA.mw,RA.mw,TA.mw,AA.mw,oT.mw,OA.mw,$A.mw,DA.mw,NA.mw,PA.mw,jA.mw,HA.mw,FA.mw,BA.mw,WA.mw,VA.mw,UA.mw,GA.mw,qA.mw,YA.mw,RR.mw],QA={xlsx:F,charts:B},KA={name:"@omegagrid/bundle",version:"0.9.28"};Fa().activate("light"),Ld.styleDefault="fal",Rd.add(ZA),Rd.add(XA)})(),window.Omegagrid=o})();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@omegagrid/bundle",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.28",
|
|
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.9.
|
|
23
|
-
"@omegagrid/calendar": "^0.9.
|
|
24
|
-
"@omegagrid/code": "^0.9.
|
|
25
|
-
"@omegagrid/commands": "^0.9.
|
|
26
|
-
"@omegagrid/core": "^0.9.
|
|
27
|
-
"@omegagrid/dialog": "^0.9.
|
|
28
|
-
"@omegagrid/editor": "^0.9.
|
|
29
|
-
"@omegagrid/form": "^0.9.
|
|
30
|
-
"@omegagrid/grid": "^0.9.
|
|
31
|
-
"@omegagrid/localize": "^0.9.
|
|
32
|
-
"@omegagrid/markdown": "^0.9.
|
|
33
|
-
"@omegagrid/plugin-charts": "^0.9.
|
|
34
|
-
"@omegagrid/plugin-xlsx": "^0.9.
|
|
35
|
-
"@omegagrid/statusbar": "^0.9.
|
|
36
|
-
"@omegagrid/tabs": "^0.9.
|
|
37
|
-
"@omegagrid/toolbar": "^0.9.
|
|
38
|
-
"@omegagrid/tree": "^0.9.
|
|
22
|
+
"@omegagrid/bucket": "^0.9.28",
|
|
23
|
+
"@omegagrid/calendar": "^0.9.28",
|
|
24
|
+
"@omegagrid/code": "^0.9.28",
|
|
25
|
+
"@omegagrid/commands": "^0.9.28",
|
|
26
|
+
"@omegagrid/core": "^0.9.28",
|
|
27
|
+
"@omegagrid/dialog": "^0.9.28",
|
|
28
|
+
"@omegagrid/editor": "^0.9.28",
|
|
29
|
+
"@omegagrid/form": "^0.9.28",
|
|
30
|
+
"@omegagrid/grid": "^0.9.28",
|
|
31
|
+
"@omegagrid/localize": "^0.9.28",
|
|
32
|
+
"@omegagrid/markdown": "^0.9.28",
|
|
33
|
+
"@omegagrid/plugin-charts": "^0.9.28",
|
|
34
|
+
"@omegagrid/plugin-xlsx": "^0.9.28",
|
|
35
|
+
"@omegagrid/statusbar": "^0.9.28",
|
|
36
|
+
"@omegagrid/tabs": "^0.9.28",
|
|
37
|
+
"@omegagrid/toolbar": "^0.9.28",
|
|
38
|
+
"@omegagrid/tree": "^0.9.28",
|
|
39
39
|
"lit": "^3.1.1"
|
|
40
40
|
},
|
|
41
41
|
"devDependencies": {
|