@odoo/o-spreadsheet 18.3.14 → 18.3.15
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.
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
/**
|
|
3
3
|
* This file is generated by o-spreadsheet build tools. Do not edit it.
|
|
4
4
|
* @see https://github.com/odoo/o-spreadsheet
|
|
5
|
-
* @version 18.3.
|
|
6
|
-
* @date 2025-
|
|
7
|
-
* @hash
|
|
5
|
+
* @version 18.3.15
|
|
6
|
+
* @date 2025-08-04T06:51:38.674Z
|
|
7
|
+
* @hash 9499d98
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
10
|
'use strict';
|
|
@@ -21964,6 +21964,7 @@ class ChartJsComponent extends owl.Component {
|
|
|
21964
21964
|
}
|
|
21965
21965
|
setup() {
|
|
21966
21966
|
owl.onMounted(() => {
|
|
21967
|
+
registerChartJSExtensions();
|
|
21967
21968
|
const runtime = this.chartRuntime;
|
|
21968
21969
|
this.currentRuntime = runtime;
|
|
21969
21970
|
// Note: chartJS modify the runtime in place, so it's important to give it a copy
|
|
@@ -76366,7 +76367,6 @@ class Spreadsheet extends owl.Component {
|
|
|
76366
76367
|
this.checkViewportSize();
|
|
76367
76368
|
stores.on("store-updated", this, render);
|
|
76368
76369
|
resizeObserver.observe(this.spreadsheetRef.el);
|
|
76369
|
-
registerChartJSExtensions();
|
|
76370
76370
|
});
|
|
76371
76371
|
owl.onWillUnmount(() => {
|
|
76372
76372
|
this.unbindModelEvents();
|
|
@@ -80922,6 +80922,6 @@ exports.tokenColors = tokenColors;
|
|
|
80922
80922
|
exports.tokenize = tokenize;
|
|
80923
80923
|
|
|
80924
80924
|
|
|
80925
|
-
__info__.version = "18.3.
|
|
80926
|
-
__info__.date = "2025-
|
|
80927
|
-
__info__.hash = "
|
|
80925
|
+
__info__.version = "18.3.15";
|
|
80926
|
+
__info__.date = "2025-08-04T06:51:38.674Z";
|
|
80927
|
+
__info__.hash = "9499d98";
|
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
/**
|
|
3
3
|
* This file is generated by o-spreadsheet build tools. Do not edit it.
|
|
4
4
|
* @see https://github.com/odoo/o-spreadsheet
|
|
5
|
-
* @version 18.3.
|
|
6
|
-
* @date 2025-
|
|
7
|
-
* @hash
|
|
5
|
+
* @version 18.3.15
|
|
6
|
+
* @date 2025-08-04T06:51:38.674Z
|
|
7
|
+
* @hash 9499d98
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
10
|
import { useEnv, useSubEnv, onWillUnmount, useComponent, status, Component, useRef, onMounted, useEffect, App, blockDom, useState, onPatched, onWillPatch, onWillUpdateProps, useExternalListener, onWillStart, xml, useChildSubEnv, markRaw, toRaw } from '@odoo/owl';
|
|
@@ -21962,6 +21962,7 @@ class ChartJsComponent extends Component {
|
|
|
21962
21962
|
}
|
|
21963
21963
|
setup() {
|
|
21964
21964
|
onMounted(() => {
|
|
21965
|
+
registerChartJSExtensions();
|
|
21965
21966
|
const runtime = this.chartRuntime;
|
|
21966
21967
|
this.currentRuntime = runtime;
|
|
21967
21968
|
// Note: chartJS modify the runtime in place, so it's important to give it a copy
|
|
@@ -76364,7 +76365,6 @@ class Spreadsheet extends Component {
|
|
|
76364
76365
|
this.checkViewportSize();
|
|
76365
76366
|
stores.on("store-updated", this, render);
|
|
76366
76367
|
resizeObserver.observe(this.spreadsheetRef.el);
|
|
76367
|
-
registerChartJSExtensions();
|
|
76368
76368
|
});
|
|
76369
76369
|
onWillUnmount(() => {
|
|
76370
76370
|
this.unbindModelEvents();
|
|
@@ -80874,6 +80874,6 @@ const chartHelpers = { ...CHART_HELPERS, ...CHART_RUNTIME_HELPERS };
|
|
|
80874
80874
|
export { AbstractCellClipboardHandler, AbstractChart, AbstractFigureClipboardHandler, CellErrorType, CommandResult, CorePlugin, CoreViewPlugin, DispatchResult, EvaluationError, Model, PivotRuntimeDefinition, Registry, Revision, SPREADSHEET_DIMENSIONS, Spreadsheet, SpreadsheetPivotTable, UIPlugin, __info__, addFunction, addRenderingLayer, astToFormula, chartHelpers, compile, compileTokens, components, constants, convertAstNodes, coreTypes, findCellInNewZone, functionCache, helpers, hooks, invalidateCFEvaluationCommands, invalidateChartEvaluationCommands, invalidateDependenciesCommands, invalidateEvaluationCommands, iterateAstNodes, links, load, parse, parseTokens, readonlyAllowedCommands, registries, setDefaultSheetViewSize, setTranslationMethod, stores, tokenColors, tokenize };
|
|
80875
80875
|
|
|
80876
80876
|
|
|
80877
|
-
__info__.version = "18.3.
|
|
80878
|
-
__info__.date = "2025-
|
|
80879
|
-
__info__.hash = "
|
|
80877
|
+
__info__.version = "18.3.15";
|
|
80878
|
+
__info__.date = "2025-08-04T06:51:38.674Z";
|
|
80879
|
+
__info__.hash = "9499d98";
|
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
/**
|
|
3
3
|
* This file is generated by o-spreadsheet build tools. Do not edit it.
|
|
4
4
|
* @see https://github.com/odoo/o-spreadsheet
|
|
5
|
-
* @version 18.3.
|
|
6
|
-
* @date 2025-
|
|
7
|
-
* @hash
|
|
5
|
+
* @version 18.3.15
|
|
6
|
+
* @date 2025-08-04T06:51:38.674Z
|
|
7
|
+
* @hash 9499d98
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
10
|
(function (exports, owl) {
|
|
@@ -21963,6 +21963,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
21963
21963
|
}
|
|
21964
21964
|
setup() {
|
|
21965
21965
|
owl.onMounted(() => {
|
|
21966
|
+
registerChartJSExtensions();
|
|
21966
21967
|
const runtime = this.chartRuntime;
|
|
21967
21968
|
this.currentRuntime = runtime;
|
|
21968
21969
|
// Note: chartJS modify the runtime in place, so it's important to give it a copy
|
|
@@ -76365,7 +76366,6 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
76365
76366
|
this.checkViewportSize();
|
|
76366
76367
|
stores.on("store-updated", this, render);
|
|
76367
76368
|
resizeObserver.observe(this.spreadsheetRef.el);
|
|
76368
|
-
registerChartJSExtensions();
|
|
76369
76369
|
});
|
|
76370
76370
|
owl.onWillUnmount(() => {
|
|
76371
76371
|
this.unbindModelEvents();
|
|
@@ -80921,9 +80921,9 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
80921
80921
|
exports.tokenize = tokenize;
|
|
80922
80922
|
|
|
80923
80923
|
|
|
80924
|
-
__info__.version = "18.3.
|
|
80925
|
-
__info__.date = "2025-
|
|
80926
|
-
__info__.hash = "
|
|
80924
|
+
__info__.version = "18.3.15";
|
|
80925
|
+
__info__.date = "2025-08-04T06:51:38.674Z";
|
|
80926
|
+
__info__.hash = "9499d98";
|
|
80927
80927
|
|
|
80928
80928
|
|
|
80929
80929
|
})(this.o_spreadsheet = this.o_spreadsheet || {}, owl);
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
z-index: ${Fe.FigureTooltip};
|
|
7
7
|
}
|
|
8
8
|
}
|
|
9
|
-
`,Rh.add("chartShowValuesPlugin",{register:e=>e.register(zS),unregister:e=>e.unregister(zS)}),Rh.add("waterfallLinesPlugin",{register:e=>e.register(my),unregister:e=>e.unregister(my)}),Rh.add("funnelController",{register:e=>e.register(Ah()),unregister:e=>e.unregister(Ah())}),Rh.add("funnelElement",{register:e=>e.register(Dh()),unregister:e=>e.unregister(Dh())}),Rh.add("funnelTooltipPositioner",{register:e=>e.Tooltip.positioners.funnelTooltipPositioner=Oh,unregister:e=>e.Tooltip.positioners.funnelTooltipPositioner=void 0}),Rh.add("sunburstLabelsPlugin",{register:e=>e.register(py),unregister:e=>e.unregister(py)}),Rh.add("sunburstHoverPlugin",{register:e=>e.register(uy),unregister:e=>e.unregister(uy)});class by extends t.Component{static template="o-spreadsheet-ChartJsComponent";static props={figureUI:Object};canvas=t.useRef("graphContainer");chart;currentRuntime;currentDevicePixelRatio=window.devicePixelRatio;get background(){return this.chartRuntime.background}get canvasStyle(){return`background-color: ${this.background}`}get chartRuntime(){const e=this.env.model.getters.getChartRuntime(this.props.figureUI.id);if(!("chartJsConfig"in e))throw new Error("Unsupported chart runtime");return e}setup(){t.onMounted((()=>{const e=this.chartRuntime;this.currentRuntime=e,this.createChart(ze(e.chartJsConfig))})),t.onWillUnmount((()=>this.chart?.destroy())),t.useEffect((()=>{const e=this.chartRuntime;e!==this.currentRuntime?(e.chartJsConfig.type!==this.currentRuntime.chartJsConfig.type?(this.chart?.destroy(),this.createChart(ze(e.chartJsConfig))):this.updateChartJs(ze(e.chartJsConfig)),this.currentRuntime=e):this.currentDevicePixelRatio!==window.devicePixelRatio&&(this.currentDevicePixelRatio=window.devicePixelRatio,this.updateChartJs(ze(this.currentRuntime.chartJsConfig)))}))}createChart(e){const t=this.canvas.el.getContext("2d");this.chart=new window.Chart(t,e)}updateChartJs(e){e.data&&e.data.datasets?(this.chart.data=e.data,e.options?.plugins?.title&&(this.chart.config.options.plugins.title=e.options.plugins.title)):this.chart.data.datasets=[],this.chart.config.options=e.options,this.chart.update()}}class Sy{sheetId;title;getters;constructor(e,t,o){this.title=e.title,this.sheetId=t,this.getters=o}static validateChartDefinition(e,t){throw new Error("This method should be implemented by sub class")}static transformDefinition(e,t,o){throw new Error("This method should be implemented by sub class")}static getDefinitionFromContextCreation(e){throw new Error("This method should be implemented by sub class")}}function yy(e,t,o,s,i){if("text"===t||"progress"===t||e?.type!==ai.number||o?.type!==ai.number)return;const n=o.value-e.value;return n>0?s:n<0?i:void 0}function Cy(e,t,o){if("text"===o||e?.type!==ai.number||t?.type!==ai.number)return"neutral";const s=t.value-e.value;return s>0?"up":s<0?"down":"neutral"}function wy(e){return e.keyValue&&!Zr.test(e.keyValue)?"InvalidScorecardKeyValue":"Success"}function Iy(e){return e.baseline&&!Zr.test(e.baseline)?"InvalidScorecardBaseline":"Success"}const xy=new window.Path2D("M8.6 4.8a.5.5 0 0 1 0 .75l-3.9 3.9a.5 .5 0 0 1 -.75 0l-3.8 -3.9a.5 .5 0 0 1 0 -.75l.4-.4a.5.5 0 0 1 .75 0l2.3 2.4v-5.7c0-.25.25-.5.5-.5h.6c.25 0 .5.25.5.5v5.8l2.3 -2.4a.5.5 0 0 1 .75 0z"),Ey=new window.Path2D("M8.7 5.5a.5.5 0 0 0 0-.75l-3.8-4a.5.5 0 0 0-.75 0l-3.8 4a.5.5 0 0 0 0 .75l.4.4a.5.5 0 0 0 .75 0l2.3-2.4v5.8c0 .25.25.5.5.5h.6c.25 0 .5-.25.5-.5v-5.8l2.2 2.4a.5.5 0 0 0 .75 0z");let Ry=class e extends Sy{keyValue;baseline;baselineMode;baselineDescr;progressBar=!1;background;baselineColorUp;baselineColorDown;fontColor;humanize;type="scorecard";constructor(e,t,o){super(e,t,o),this.keyValue=ga(o,t,e.keyValue),this.baseline=ga(o,t,e.baseline),this.baselineMode=e.baselineMode,this.baselineDescr=e.baselineDescr,this.background=e.background,this.baselineColorUp=e.baselineColorUp??Ee,this.baselineColorDown=e.baselineColorDown??Re,this.humanize=e.humanize??!1}static validateChartDefinition(e,t){return e.checkValidations(t,wy,Iy)}static getDefinitionFromContextCreation(e){return{background:e.background,type:"scorecard",keyValue:e.range?e.range[0].dataRange:void 0,title:e.title||{text:""},baselineMode:xe,baselineColorUp:Ee,baselineColorDown:Re,baseline:e.auxiliaryRange||""}}static transformDefinition(e,t,o){let s,i;if(t.baseline){const i=vS(e,t.baseline,o);i!==Ti.InvalidReference&&(s=i)}if(t.keyValue){const s=vS(e,t.keyValue,o);s!==Ti.InvalidReference&&(i=s)}return{...t,baseline:s,keyValue:i}}duplicateInDuplicatedSheet(t){const o=IS(this.sheetId,t,this.baseline),s=IS(this.sheetId,t,this.keyValue),i=this.getDefinitionWithSpecificRanges(o,s,t);return new e(i,t,this.getters)}copyInSheetId(t){const o=this.getDefinitionWithSpecificRanges(this.baseline,this.keyValue,t);return new e(o,t,this.getters)}getDefinition(){return this.getDefinitionWithSpecificRanges(this.baseline,this.keyValue)}getContextCreation(){return{...this,range:this.keyValue?[{dataRange:this.getters.getRangeString(this.keyValue,this.sheetId)}]:void 0,auxiliaryRange:this.baseline?this.getters.getRangeString(this.baseline,this.sheetId):void 0}}getDefinitionWithSpecificRanges(e,t,o){return{baselineColorDown:this.baselineColorDown,baselineColorUp:this.baselineColorUp,baselineMode:this.baselineMode,title:this.title,type:"scorecard",background:this.background,baseline:e?this.getters.getRangeString(e,o||this.sheetId):void 0,baselineDescr:this.baselineDescr,keyValue:t?this.getters.getRangeString(t,o||this.sheetId):void 0,humanize:this.humanize}}getDefinitionForExcel(){}updateRanges(t){const o=xS(this.baseline,t),s=xS(this.keyValue,t);if(this.baseline===o&&this.keyValue===s)return this;const i=this.getDefinitionWithSpecificRanges(o,s);return new e(i,this.sheetId,this.getters)}};function Ty(e,t){const o=t.getContext("2d"),s=window.devicePixelRatio||1;t.width=s*e.canvas.width,t.height=s*e.canvas.height,o.scale(s,s);const i=e.canvas.width-2*j;if(o.fillStyle=e.canvas.backgroundColor,o.fillRect(0,0,e.canvas.width,e.canvas.height),e.title){o.font=e.title.style.font,o.fillStyle=e.title.style.color;const t=o.textBaseline;o.textBaseline="middle",o.fillText(Ua(o,e.title.text,i-e.title.position.x),e.title.position.x,e.title.position.y),o.textBaseline=t}if(e.baseline&&(o.font=e.baseline.style.font,o.fillStyle=e.baseline.style.color,Ba(o,e.baseline.text,e.baseline.position,e.baseline.style.underline,e.baseline.style.strikethrough)),e.baselineArrow&&e.baselineArrow.style.size>0){o.save(),o.fillStyle=e.baselineArrow.style.color,o.translate(e.baselineArrow.position.x,e.baselineArrow.position.y);const t=e.baselineArrow.style.size/10;switch(o.scale(t,t),e.baselineArrow.direction){case"down":o.fill(xy);break;case"up":o.fill(Ey)}o.restore()}if(e.baselineDescr){const t=e.baselineDescr[0];o.font=t.style.font,o.fillStyle=t.style.color;for(const t of e.baselineDescr)o.fillText(Ua(o,t.text,i-t.position.x),t.position.x,t.position.y)}if(e.key&&(o.font=e.key.style.font,o.fillStyle=e.key.style.color,Ba(o,Ua(o,e.key.text,i-e.key.position.x),e.key.position,e.key.style.underline,e.key.style.strikethrough)),e.progressBar){if(o.fillStyle=e.progressBar.style.backgroundColor,o.beginPath(),o.roundRect(e.progressBar.position.x,e.progressBar.position.y,e.progressBar.dimension.width,e.progressBar.dimension.height,e.progressBar.dimension.height/2),o.fill(),o.fillStyle=e.progressBar.style.color,o.beginPath(),e.progressBar.value>0)o.roundRect(e.progressBar.position.x,e.progressBar.position.y,e.progressBar.dimension.width*Math.max(0,Math.min(1,e.progressBar.value)),e.progressBar.dimension.height,e.progressBar.dimension.height/2);else{const t=e.progressBar.dimension.width*Math.max(0,Math.min(1,-e.progressBar.value));o.roundRect(e.progressBar.position.x+e.progressBar.dimension.width-t,e.progressBar.position.y,t,e.progressBar.dimension.height,e.progressBar.dimension.height/2)}o.fill()}}function Ay(e,t){let o,s="";const i=t.getLocale();if(e.keyValue){const n={sheetId:e.keyValue.sheetId,col:e.keyValue.zone.left,row:e.keyValue.zone.top};o=t.getEvaluatedCell(n),s=function(e,t,o){return e?t?wr(e,o):e.formattedValue??String(e.value??""):""}(o,e.humanize??!1,i)}let n;const r=e.baseline;if(r){const e={sheetId:r.sheetId,col:r.zone.left,row:r.zone.top};n=t.getEvaluatedCell(e)}const{background:a,fontColor:l}=t.getStyleOfSingleCellChart(e.background,e.keyValue),c=function(e,t,o,s,i){if(!e)return"";if("text"===o||t?.type!==ai.number||e.type!==ai.number)return s?wr(e,i):e.formattedValue;let{value:n,format:r}=e;return"progress"===o?(n=t.value/n,r="0.0%"):(n=Math.abs(t.value-n),"percentage"===o&&0!==n&&(n/=e.value),"percentage"===o&&(r="0.0%"),r||(n=Math.round(100*n)/100)),s?wr({value:n,format:r},i):sr(n,{format:r,locale:i})}(n,o,e.baselineMode,e.humanize??!1,i),h="progress"===e.baselineMode&&Xs(c,i)?zi(c,i):0;return{title:{...e.title,text:e.title.text?ni(e.title.text):""},keyValue:s,baselineDisplay:c,baselineArrow:Cy(n,o,e.baselineMode),baselineColor:yy(n,e.baselineMode,o,e.baselineColorUp,e.baselineColorDown),baselineDescr:"progress"!==e.baselineMode&&e.baselineDescr?ni(e.baselineDescr):"",fontColor:l,background:a,baselineStyle:"percentage"!==e.baselineMode&&"progress"!==e.baselineMode&&r?t.getCellStyle({sheetId:r.sheetId,col:r.zone.left,row:r.zone.top}):void 0,keyValueStyle:e.keyValue?t.getCellStyle({sheetId:e.keyValue.sheetId,col:e.keyValue.zone.left,row:e.keyValue.zone.top}):void 0,progressBar:"progress"===e.baselineMode?{value:h,color:h>0?e.baselineColorUp:e.baselineColorDown}:void 0}}const Dy=10,_y=.05;function Oy({width:e,height:t},o){return new Fy({width:e,height:t},o).computeDesign()}class Fy{runtime;context;width;height;constructor({width:e,height:t},o){this.runtime=o;const s=document.createElement("canvas");this.width=s.width=e,this.height=s.height=t,this.context=s.getContext("2d")}computeDesign(){const e={canvas:{width:this.width,height:this.height,backgroundColor:this.backgroundColor}},t=this.getTextStyles();let o=0;if(this.title){let s,i;switch(({height:o,width:i}=this.getFullTextDimensions(this.title,t.title.font)),this.runtime.title.align){case"center":s=(this.width-i)/2;break;case"right":s=this.width-i-Dy;break;default:s=Dy}e.title={text:this.title,style:t.title,position:{x:s,y:Dy+o/2}}}const s=t.baselineArrow?.size??0;let{height:i,width:n}=this.getTextDimensions(this.baseline,t.baselineValue.font);this.baseline||(i=this.getTextDimensions(this.baselineDescr,t.baselineDescr.font).height);const r=this.getTextDimensions(this.baselineDescr,t.baselineDescr.font).width;e.baseline={text:this.baseline,style:t.baselineValue,position:{x:(this.width-n-r+s)/2,y:this.keyValue?this.height*(1-_y*(this.runtime.progressBar?1:2)):this.height-(this.height-o-i)/2-Dy}};const a=s+20;if(e.baseline.position.x<a&&(e.baseline.position.x=a),t.baselineArrow&&!this.runtime.progressBar&&(e.baselineArrow={direction:this.baselineArrow,style:t.baselineArrow,position:{x:e.baseline.position.x-s,y:e.baseline.position.y-(i+s)/2}}),this.baselineDescr){const o={x:e.baseline.position.x+n,y:e.baseline.position.y};e.baselineDescr=[{text:this.baselineDescr,style:t.baselineDescr,position:o}]}let l=0;this.runtime.progressBar&&(l=.05*this.height,e.progressBar={position:{x:20,y:.9*this.height-i-l},dimension:{height:l,width:this.width-40},value:this.runtime.progressBar.value,style:{color:this.runtime.progressBar.color,backgroundColor:this.secondaryFontColor}});const{width:c,height:h}=this.getFullTextDimensions(this.keyValue,t.keyValue.font);return this.keyValue&&(e.key={text:this.keyValue,style:t.keyValue,position:{x:Math.max(Dy,(this.width-c)/2),y:.4*this.height+5+(o+h/2)/2}}),e}get title(){return this.runtime.title.text??""}get keyValue(){return this.runtime.keyValue}get baseline(){return this.runtime.baselineDisplay}get baselineDescr(){return function(e,t){const o=e||"";return t&&o?" "+o:o}(this.runtime.baselineDescr,this.baseline)}get baselineArrow(){return this.runtime.baselineArrow}get backgroundColor(){return this.runtime.background}get secondaryFontColor(){return OS(this.backgroundColor)}getTextDimensions(e,t){this.context.font=t;const o=this.context.measureText(e);return{width:o.width,height:o.actualBoundingBoxAscent+o.actualBoundingBoxDescent}}getFullTextDimensions(e,t){this.context.font=t;const o=this.context.measureText(e);return{width:o.width,height:o.fontBoundingBoxAscent+o.fontBoundingBoxDescent}}getTextStyles(){let e=16;const t=Math.floor(.9*e);return this.runtime.progressBar&&(e/=1.5),{title:{font:Ta(this.runtime.title.fontSize??14,this.runtime.title.bold,this.runtime.title.italic),color:this.runtime.title.color??this.secondaryFontColor},keyValue:{color:this.runtime.keyValueStyle?.textColor||this.runtime.fontColor,font:Ta(32,this.runtime.keyValueStyle?.bold,this.runtime.keyValueStyle?.italic),strikethrough:this.runtime.keyValueStyle?.strikethrough,underline:this.runtime.keyValueStyle?.underline},baselineValue:{font:Ta(e,this.runtime.baselineStyle?.bold,this.runtime.baselineStyle?.italic),strikethrough:this.runtime.baselineStyle?.strikethrough,underline:this.runtime.baselineStyle?.underline,color:this.runtime.baselineStyle?.textColor||this.runtime.baselineColor||this.secondaryFontColor},baselineDescr:{font:Ta(t),color:this.secondaryFontColor},baselineArrow:"neutral"===this.baselineArrow||this.runtime.progressBar?void 0:{size:this.keyValue?.8*e:0,color:this.runtime.baselineColor||this.secondaryFontColor}}}}class My extends t.Component{static template="o-spreadsheet-ScorecardChart";static props={figureUI:Object};canvas=t.useRef("chartContainer");get runtime(){return this.env.model.getters.getChartRuntime(this.props.figureUI.id)}get title(){const e=this.env.model.getters.getChartDefinition(this.props.figureUI.id).title.text??"";return ni(e)}setup(){t.useEffect(this.createChart.bind(this),(()=>{const e=this.canvas.el.getBoundingClientRect();return[e.width,e.height,this.runtime,this.canvas.el,window.devicePixelRatio]}))}createChart(){const e=this.canvas.el;Ty(Oy(e.getBoundingClientRect(),this.runtime),e)}}const Py=new n;function Ny(e,t,o,s){const i=[];e=e.toLowerCase();for(const n of e){const e=t.toLocaleLowerCase().indexOf(n);-1!==e&&(i.push({value:t.slice(0,e),color:""},{value:t[e],color:o,classes:[s]}),t=t.slice(e+1))}return i.push({value:t}),i.filter((e=>e.value))}function ky(e,t,o){const{x:s,y:i,width:n,height:r}=o;if(n<0||r<0)return;const l=t.color||a,{ctx:c}=e;c.save(),t.noBorder||(t.dashed&&c.setLineDash([5,3]),c.strokeStyle=l,t.thinLine?(c.lineWidth=1,c.strokeRect(s,i,n,r)):(c.lineWidth=2,c.strokeRect(s+.5,i+.5,n,r))),t.noFill||(c.fillStyle=oo(Wt(l),t.fillAlpha??.12),c.fillRect(s,i,n,r)),c.restore()}Py.add("dataValidation",{displayAllOnInitialContent:!0,canBeToggled:!1,getProposals(e,t){return Ht(t)?[]:this.composer.currentEditedCell?function(e,t){const o=e.getValidationRuleForCell(t);if(!o||"isValueInList"!==o.criterion.type&&"isValueInRange"!==o.criterion.type)return[];let s=[];if("isValueInList"===o.criterion.type)s=o.criterion.values.map((e=>({label:e,value:e})));else{const i=new Set,n=e.getRangeFromSheetXC(t.sheetId,o.criterion.values[0]);for(const t of os(n.zone)){const o=e.getEvaluatedCell({...t,sheetId:n.sheetId});o.formattedValue&&!i.has(o.formattedValue)&&(i.add(o.formattedValue),s.push({label:o.formattedValue,value:o.value}))}}return s}(this.getters,this.composer.currentEditedCell).map((e=>({text:e.value?.toString()||"",htmlContent:[{value:e.label}],fuzzySearchKey:e.label}))):[]},selectProposal(e,t){this.composer.setCurrentContent(t),this.composer.stopEdition()}}),Py.add("functions",{sequence:100,autoSelectFirstProposal:!0,maxDisplayedProposals:10,getProposals(e){if("SYMBOL"!==e.type)return[];const t=e.value;if(!Ht(this.composer.currentContent))return[];const o=Object.entries(Kb.content).filter((([e,{hidden:t}])=>!t)).map((([e,{description:o}])=>({text:e,description:o,htmlContent:Ny(t,e,E,"o-semi-bold")}))).sort(((e,t)=>e.text.length-t.text.length||e.text.localeCompare(t.text)));return o},selectProposal(e,t){let o=e.end,s=e.end;["SYMBOL","FUNCTION"].includes(e.type)&&(o=e.start);const i=this.composer.currentTokens;t+="(";const n=i.map((e=>e.start)).indexOf(e.start);if(n+1<i.length){const e=i[n+1];"LEFT_PAREN"===e?.type&&s++}this.composer.changeComposerCursorSelection(o,s),this.composer.replaceComposerCursorSelection(t)}});class Vy extends vh{mutators=["register","unRegister"];providers=[];constructor(e){super(e),this.onDispose((()=>{this.providers=[]}))}get renderingLayers(){return["Highlights"]}get highlights(){const e=this.getters.getActiveSheetId();return this.providers.flatMap((e=>e.highlights)).filter((t=>t.sheetId===e)).map((e=>{const{numberOfRows:t,numberOfCols:o}=Qo(e.zone),s=t*o==1?this.getters.expandZone(e.sheetId,e.zone):e.zone;return{...e,zone:s}}))}register(e){this.providers.push(e)}unRegister(e){this.providers=this.providers.filter((t=>t!==e))}drawLayer(e,t){if("Highlights"===t)for(const t of this.highlights){ky(e,t,this.getters.getVisibleRect(t.zone))}}}class Ly{mutators=["notifyUser","raiseError","askConfirmation","updateNotificationCallbacks"];notifyUser=e=>window.alert(e.text);askConfirmation=(e,t,o)=>{window.confirm(e)?t():o?.()};raiseError=(e,t)=>{window.alert(e),t?.()};updateNotificationCallbacks(e){this.notifyUser=e.notifyUser||this.notifyUser,this.raiseError=e.raiseError||this.raiseError,this.askConfirmation=e.askConfirmation||this.askConfirmation}}const Hy="#000000",Uy="#3da4ab",By={OPERATOR:Uy,NUMBER:"#02c39a",STRING:"#00a82d",FUNCTION:Hy,DEBUGGER:Uy,LEFT_PAREN:Hy,RIGHT_PAREN:Hy,ARG_SEPARATOR:Hy,ORPHAN_RIGHT_PAREN:"#ff0000"};class zy extends vh{mutators=["startEdition","setCurrentContent","stopEdition","stopComposerRangeSelection","cancelEdition","cycleReferences","toggleEditionMode","changeComposerCursorSelection","replaceComposerCursorSelection","hoverToken"];col=0;row=0;editionMode="inactive";sheetId="";_currentContent="";currentTokens=[];selectionStart=0;selectionEnd=0;initialContent="";colorIndexByRange={};hoveredTokens=[];hoveredContentEvaluation="";notificationStore=this.get(Ly);highlightStore=this.get(Vy);constructor(e){super(e),this.highlightStore.register(this),this.onDispose((()=>{this.highlightStore.unRegister(this)}))}handleEvent(e){const t=this.getters.getActiveSheetId();let o;if(o=e.options.unbounded?this.getters.getUnboundedZone(t,e.anchor.zone):e.anchor.zone,"newAnchor"===e.mode)"selecting"===this.editionMode&&this.insertSelectedRange(o);else"selecting"===this.editionMode?this.replaceSelectedRange(o):this.updateComposerRange(e.previousAnchor.zone,o)}changeComposerCursorSelection(e,t){this.isSelectionValid(this._currentContent.length,e,t)&&(this.selectionStart=e,this.selectionEnd=t,this.computeFormulaCursorContext(),this.computeParenthesisRelatedToCursor())}stopComposerRangeSelection(){this.isSelectingRange&&(this.editionMode="editing")}startEdition(e,t){if(t){const o=e||this.getComposerContent(this.getters.getActivePosition());if(!this.isSelectionValid(o.length,t.start,t.end))return}const{col:o,row:s}=this.getters.getActivePosition();this.model.dispatch("SELECT_FIGURE",{figureId:null}),this.model.dispatch("SCROLL_TO_CELL",{col:o,row:s}),"inactive"!==this.editionMode&&e?this.setContent(e,t):this._startEdition(e,t),this.updateTokenColor(),this.computeFormulaCursorContext(),this.computeParenthesisRelatedToCursor()}cancelEdition(){this.resetContent(),this.cancelEditionAndActivateSheet()}setCurrentContent(e,t){t&&!this.isSelectionValid(e.length,t.start,t.end)||(this.setContent(e,t,!0),this.updateTokenColor(),this.computeFormulaCursorContext(),this.computeParenthesisRelatedToCursor())}replaceComposerCursorSelection(e){this.replaceSelection(e)}handle(e){switch(e.type){case"SELECT_FIGURE":e.figureId&&(this.resetContent(),this.cancelEditionAndActivateSheet());break;case"START_CHANGE_HIGHLIGHT":const{left:t,top:o}=e.zone;this.isSelectingRange&&(this.editionMode="editing"),this.model.selection.resetAnchor(this,{cell:{col:t,row:o},zone:e.zone})}}get currentContent(){return"inactive"===this.editionMode?this.getComposerContent(this.getters.getActivePosition()):this._currentContent}get composerSelection(){return{start:this.selectionStart,end:this.selectionEnd}}get isSelectingRange(){return"selecting"===this.editionMode}get showSelectionIndicator(){return this.isSelectingRange&&this.canStartComposerRangeSelection()}get tokenAtCursor(){const e=Math.min(this.selectionStart,this.selectionEnd),t=Math.max(this.selectionStart,this.selectionEnd);return e===t&&0===t?void 0:this.currentTokens.find((o=>o.start<=e&&o.end>=t))}cycleReferences(){const e=this.getters.getLocale(),t=Zf(this.composerSelection,this._currentContent,e);void 0!==t&&this.setCurrentContent(t.content,t.selection)}toggleEditionMode(){if("inactive"===this.editionMode)return;const e=Math.min(this.selectionStart,this.selectionEnd),t=Math.max(this.selectionStart,this.selectionEnd),o=[...this.currentTokens].reverse().find((o=>o.end>=e&&t>=o.start&&"REFERENCE"===o.type));if("editing"===this.editionMode&&o){const e=this.getters.getActiveSheetId(),{sheetName:t,xc:s}=Jr(o.value),i=this.getters.getSheetIdByName(t);i&&i!==e&&this.model.dispatch("ACTIVATE_SHEET",{sheetIdFrom:e,sheetIdTo:i}),this.selectionStart=this.selectionEnd=o.end;const n=this.getters.getRangeFromSheetXC(this.sheetId,s).zone;this.captureSelection(n),this.editionMode="selecting"}else this.editionMode="editing"}hoverToken(e){this.currentTokens.forEach((e=>e.isInHoverContext=void 0));const t=[...this.currentTokens];if(void 0===e||["ARG_SEPARATOR","SPACE"].includes(t[e].type))return this.hoveredContentEvaluation="",void(this.hoveredTokens=[]);const o=this.getNumberOfMissingParenthesis(t);o>0&&t.push(...Array(o).fill({value:")",type:"RIGHT_PAREN"}));let s=t;if(0!==e){const o=this.getRelatedTokens(t,e),i=t.filter((e=>!o.includes(e)&&"SPACE"!==e.type));s=1===i.length&&i[0]===t[0]?t:o}s.forEach((e=>e.isInHoverContext=!0));let i=s.map((e=>e.value)).join("");Ht(i)||(i=`=${i}`);const n=bl(i,this.getters.getLocale()),r=this.getters.evaluateFormulaResult(this.sheetId,n);this.hoveredTokens=s,this.hoveredContentEvaluation=this.evaluationResultToDisplayString(r)}getRelatedTokens(e,t){try{const o=Nf(e);let s;for(const e of Vf(o))if(t>=e.tokenStartIndex&&t<=e.tokenEndIndex)s=e;else if(t<e.tokenStartIndex)break;return s?e.slice(s.tokenStartIndex,s.tokenEndIndex+1):e}catch(t){if(t instanceof Di)return e;throw t}}evaluationResultToDisplayString(e){const t=this.getters.getLocale();if(Ii(e)){const o=","===t.decimalSeparator?"/":",";return`{${un(e).map((e=>e.map((e=>this.cellValueToDisplayString(e))).join(o))).join(";")}}`}return this.cellValueToDisplayString(e)}cellValueToDisplayString(e){const t=e.value;switch(typeof t){case"number":return sr(t,{locale:this.getters.getLocale(),format:e.format});case"string":return Hi(t)?t:`"${t}"`;case"boolean":return t?"TRUE":"FALSE"}return"0"}captureSelection(e,t,o){this.model.selection.capture(this,{cell:{col:t??e.left,row:o??e.right},zone:e},{handleEvent:this.handleEvent.bind(this),release:()=>{this._stopEdition()}})}isSelectionValid(e,t,o){return t>=0&&t<=e&&o>=0&&o<=e}startComposerRangeSelection(){if(this.sheetId===this.getters.getActiveSheetId()){const e=rs({col:this.col,row:this.row});this.model.selection.resetAnchor(this,{cell:{col:this.col,row:this.row},zone:e})}this.editionMode="selecting"}_startEdition(e,t){const o=this.getters.getActiveCell(),s=this.getters.getLocale();e&&o.format?.includes("%")&&Xs(e,s)&&(t=t||{start:e.length,end:e.length},e=`${e}%`);const{col:i,row:n,sheetId:r}=this.getters.getActivePosition();this.col=i,this.sheetId=r,this.row=n,this.initialContent=this.getComposerContent({sheetId:r,col:i,row:n}),this.editionMode="editing",this.setContent(e||this.initialContent,t),this.colorIndexByRange={};const a=rs({col:this.col,row:this.row});this.captureSelection(a,i,n)}_stopEdition(){if("inactive"!==this.editionMode){this.cancelEditionAndActivateSheet();let e=this.getCurrentCanonicalContent();if(!(this.initialContent!==e))return;if(e&&Ht(e)){const t=this.getNumberOfMissingParenthesis(this.currentTokens);t>0&&(e+=ut(new Array(t).fill(")")))}this.confirmEdition(e)}}getCurrentCanonicalContent(){return bl(this._currentContent,this.getters.getLocale())}cancelEditionAndActivateSheet(){if("inactive"===this.editionMode)return;this._cancelEdition();this.getters.getActiveSheetId()!==this.sheetId&&this.model.dispatch("ACTIVATE_SHEET",{sheetIdFrom:this.getters.getActiveSheetId(),sheetIdTo:this.sheetId})}_cancelEdition(){"inactive"!==this.editionMode&&(this.editionMode="inactive",this.model.selection.release(this),this.colorIndexByRange={},this.hoveredTokens=[],this.hoveredContentEvaluation="")}resetContent(){this.setContent(this.initialContent||"")}setContent(e,t,o){const s=this._currentContent!==e;if(this._currentContent=e,t?(this.selectionStart=t.start,this.selectionEnd=t.end):this.selectionStart=this.selectionEnd=e.length,s||"inactive"!==this.editionMode){const t=this.getters.getLocale();this.currentTokens=Ht(e)?$f(e,t):[],this.currentTokens.length>100&&o&&this.notificationStore.raiseError(ni("This formula has over 100 parts. It can't be processed properly, consider splitting it into multiple cells"))}this.canStartComposerRangeSelection()&&this.startComposerRangeSelection()}getAutoCompleteProviders(){return Py.getAll()}insertSelectedRange(e){const t=Math.min(this.selectionStart,this.selectionEnd),o=this.getZoneReference(e);this.canStartComposerRangeSelection()?this.insertText(o,t):this.insertText(","+o,t)}replaceSelectedRange(e){const t=this.getZoneReference(e),o=this.tokenAtCursor,s="REFERENCE"===o?.type?o.start:this.selectionStart;this.replaceText(t,s,this.selectionEnd)}updateComposerRange(e,t){const o=this.getters.getActiveSheetId(),s=this.tokenAtCursor,i=(s?[s,...this.currentTokens]:this.currentTokens).filter((e=>"REFERENCE"===e.type)).find((t=>{const{xc:s,sheetName:i}=Jr(t.value),n=i||this.getters.getSheetName(this.sheetId);if(!na(this.getters.getSheetName(o),n))return!1;const r=this.getters.getRangeFromSheetXC(o,s);return Yo(this.getters.expandZone(o,r.zone),e)}));if(!i)return;const n=this.getters.getRangeFromSheetXC(o,i.value);this.selectionStart=i.start,this.selectionEnd=this.selectionStart+i.value.length;const r=this.getters.getRangeFromZone(o,t),a=this.getRangeReference(r,n.parts);this.replaceSelection(a)}getZoneReference(e){const t=this.sheetId,o=this.getters.getActiveSheetId(),s=this.getters.getRangeFromZone(o,e);return this.getters.getSelectionRangeString(s,t)}getRangeReference(e,t){const o={...e,parts:[...t]};return this.getters.getSelectionRangeString(o,this.sheetId)}replaceSelection(e){const t=Math.min(this.selectionStart,this.selectionEnd),o=Math.max(this.selectionStart,this.selectionEnd);this.replaceText(e,t,o)}replaceText(e,t,o){this._currentContent=this._currentContent.slice(0,t)+this._currentContent.slice(o,this._currentContent.length),this.insertText(e,t)}insertText(e,t){const o=this._currentContent.slice(0,t)+e+this._currentContent.slice(t),s=t+e.length;this.setCurrentContent(o,{start:s,end:s})}updateTokenColor(){this.updateRangeColor();for(let e=0;e<this.currentTokens.length;e++)this.currentTokens[e].color=this.getTokenColor(this.currentTokens[e])}getTokenColor(e){if("REFERENCE"===e.type){const{xc:t,sheetName:o}=Jr(e.value);return this.rangeColor(t,o)||Hy}if("SYMBOL"===e.type){const t=e.value.toUpperCase();if("TRUE"===t||"FALSE"===t)return By.NUMBER;if(t in Kb.content)return By.FUNCTION}return["LEFT_PAREN","RIGHT_PAREN"].includes(e.type)&&""===e.parenthesesCode?By.ORPHAN_RIGHT_PAREN:By[e.type]||Hy}rangeColor(e,t){const o=t?this.model.getters.getSheetIdByName(t):this.sheetId,s=this.highlights.find((t=>{if(t.sheetId!==o)return!1;let s=this.model.getters.getRangeFromSheetXC(o,e).zone;return s=1===hs(s)?this.model.getters.expandZone(o,s):s,Yo(s,t.zone)}));return s&&s.color?s.color:void 0}computeFormulaCursorContext(){for(let e=0;e<this.currentTokens.length;e++)this.currentTokens[e].isBlurred=!1;if(this.selectionStart!==this.selectionEnd)return;const e=this.getParenthesesCodeAfterCursor(),t=[...this.currentTokens].reverse().find((t=>e.startsWith(t.parenthesesCode)&&"SYMBOL"===t.type));if(t)for(let e=0;e<this.currentTokens.length;e++)(this.currentTokens[e].parenthesesCode||"").startsWith(t.parenthesesCode||"")||(this.currentTokens[e].isBlurred=!0)}getParenthesesCodeAfterCursor(){const e=this.tokenAtCursor?.parenthesesCode||"";return"RIGHT_PAREN"===this.tokenAtCursor?.type?e.slice(0,-1)||"":e}computeParenthesisRelatedToCursor(){for(let e=0;e<this.currentTokens.length;e++)this.currentTokens[e].isParenthesisLinkedToCursor=!1;const e=this.tokenAtCursor;if(e&&""!==e.parenthesesCode&&["LEFT_PAREN","RIGHT_PAREN"].includes(e.type))for(let t=0;t<this.currentTokens.length;t++){const o=this.currentTokens[t];["LEFT_PAREN","RIGHT_PAREN"].includes(o.type)&&o.parenthesesCode===e.parenthesesCode&&o!==e&&(this.currentTokens[t].isParenthesisLinkedToCursor=!0,this.tokenAtCursor.isParenthesisLinkedToCursor=!0)}}updateRangeColor(){if(!Ht(this._currentContent)||"inactive"===this.editionMode)return;const e=this.sheetId,t=this.getReferencedRanges().map((t=>this.getters.getRangeString(t,e))),o={};for(const e of t)void 0!==this.colorIndexByRange[e]&&(o[e]=this.colorIndexByRange[e]);const s=new Set(Object.values(o));let i=0;const n=()=>{for(;s.has(i);)i++;return s.add(i),i};for(const e of t){const t=e in o?o[e]:n();o[e]=t}this.colorIndexByRange=o}get highlights(){if(!Ht(this.currentContent)||"inactive"===this.editionMode)return[];const e=this.sheetId,t=e=>{const t=this.colorIndexByRange[e];return zt[t%zt.length]};return this.getReferencedRanges().map((o=>{const s=this.getters.getRangeString(o,e),{numberOfRows:i,numberOfCols:n}=Qo(o.zone);return{zone:i*n==1?this.getters.expandZone(o.sheetId,o.zone):o.zone,color:t(s),sheetId:o.sheetId,interactive:!0}}))}getReferencedRanges(){const e=this.sheetId;return this.currentTokens.filter((e=>"REFERENCE"===e.type)).map((t=>this.getters.getRangeFromSheetXC(e,t.value))).filter((e=>!e.invalidSheetName&&!e.invalidXc))}get autocompleteProvider(){const e=this.currentContent,t=Ht(e)?this.tokenAtCursor:{type:"STRING",value:e};if("inactive"===this.editionMode||!t||["TRUE","FALSE"].includes(t.value.toUpperCase())||!this.canStartComposerRangeSelection()&&!["SYMBOL","STRING","UNKNOWN"].includes(t.type))return;const o={composer:this,getters:this.getters},s=this.getAutoCompleteProviders().sort(((e,t)=>(e.sequence??1/0)-(t.sequence??1/0))).map((s=>({...s,getProposals:s.getProposals.bind(o,t,e),selectProposal:s.selectProposal.bind(o,t)})));for(const e of s){let o=e.getProposals();const s=o?.find((e=>e.text===t.value)),i=t.value.replace(/[ ,\(\)]/g,"");if(this._currentContent===this.initialContent&&e.displayAllOnInitialContent&&o?.length)return{proposals:o,selectProposal:e.selectProposal,autoSelectFirstProposal:e.autoSelectFirstProposal??!1,canBeToggled:e.canBeToggled};if(s&&this._currentContent!==this.initialContent)return;if(i&&o&&!["ARG_SEPARATOR","LEFT_PAREN","OPERATOR"].includes(t.type)){const e=xa(i,o,(e=>e.fuzzySearchKey||e.text));s&&!e.length||(o=e)}if(e.maxDisplayedProposals&&(o=o?.slice(0,e.maxDisplayedProposals)),o?.length)return{proposals:o,selectProposal:e.selectProposal,autoSelectFirstProposal:e.autoSelectFirstProposal??!1,canBeToggled:e.canBeToggled}}}canStartComposerRangeSelection(){if(Ht(this._currentContent)){const e=this.tokenAtCursor;if(!e)return!1;const t=this.currentTokens.map((e=>e.start)).indexOf(e.start);let o=t,s=e;for(;!["ARG_SEPARATOR","LEFT_PAREN","OPERATOR"].includes(s.type)||Qa.includes(s.value);){if("SPACE"!==s.type||o<1)return!1;o--,s=this.currentTokens[o]}for(o=t+1,s=this.currentTokens[o];s&&!["ARG_SEPARATOR","RIGHT_PAREN","OPERATOR"].includes(s.type);){if("SPACE"!==s.type)return!1;o++,s=this.currentTokens[o]}return!0}return!1}getNumberOfMissingParenthesis(e){return e.filter((e=>"LEFT_PAREN"===e.type)).length-e.filter((e=>"RIGHT_PAREN"===e.type)).length}}const $y=["PIVOT.VALUE","PIVOT.HEADER","PIVOT"];function Gy(e,t){const o=`"${t?`${e.name}:${t}`:e.name}"`,s=e.string!==e.name?e.string+o:o;return{text:o,description:e.string+(e.help?` (${e.help})`:""),htmlContent:[{value:o,color:By.STRING}],fuzzySearchKey:s}}function Wy(e,t){let o=e.end;const s=e.end;"ARG_SEPARATOR"!==e.type&&(o=e.start),this.composer.stopComposerRangeSelection(),this.composer.changeComposerCursorSelection(o,s),this.composer.replaceComposerCursorSelection(t)}function qy(e,t){let o=e.end;const s=e.end;"LEFT_PAREN"!==e.type&&(o=e.start),this.composer.stopComposerRangeSelection(),this.composer.changeComposerCursorSelection(o,s),this.composer.replaceComposerCursorSelection(t)}function Zy(e){const t=e.functionContext?.args[0];if(t&&["STRING","NUMBER"].includes(t.type))return t.value}function jy(e){return mS(e,$y)[0]}function Yy(e){return mS(e,$y).length}const Xy=new n;Xy.add("SPREADSHEET",!1),Py.add("pivot_ids",{sequence:50,autoSelectFirstProposal:!0,getProposals(e){const t=e.functionContext;if(!t||!["PIVOT.VALUE","PIVOT.HEADER","PIVOT"].includes(t.parent.toUpperCase())||0!==t.argPosition)return;const o=this.getters.getPivotIds();return o.includes(e.value)?void 0:o.map((e=>{const t=this.getters.getPivotCoreDefinition(e),o=`${this.getters.getPivotFormulaId(e)}`;return{text:o,description:t.name,htmlContent:[{value:o,color:By.NUMBER}],fuzzySearchKey:o+t.name,alwaysExpanded:!0}})).filter(lt)},selectProposal:qy}),Py.add("pivot_measures",{sequence:50,autoSelectFirstProposal:!0,getProposals(e){const t=e.functionContext;if("PIVOT.VALUE"!==t?.parent.toUpperCase()||1!==t.argPosition)return[];const o=Zy(e),s=this.getters.getPivotId(o);if(!s||!this.getters.isExistingPivot(s))return[];const i=this.getters.getPivot(s);return i.init(),i.isValid()?i.definition.measures.map((e=>{if("__count"===e.fieldName){const e='"__count"';return{text:e,description:ni("Count"),htmlContent:[{value:e,color:By.STRING}],fuzzySearchKey:ni("Count")+e}}return function(e){const t=`"${e.id}"`,o=e.displayName+e.fieldName+t;return{text:t,description:e.displayName,htmlContent:[{value:t,color:By.STRING}],fuzzySearchKey:o}}(e)})).filter(lt):[]},selectProposal:Wy}),Py.add("pivot_group_fields",{sequence:50,autoSelectFirstProposal:!0,getProposals(e){const t=e.functionContext;if(!t||!function(e){const t=e.functionContext;return"PIVOT.VALUE"===t?.parent.toUpperCase()&&t.argPosition>=2&&t.argPosition%2==0}(e)&&!function(e){const t=e.functionContext;return"PIVOT.HEADER"===t?.parent.toUpperCase()&&t.argPosition>=1&&t.argPosition%2==1}(e))return;const o=Zy(e),s=this.getters.getPivotId(o);if(!s||!this.getters.isExistingPivot(s))return;const i=this.getters.getPivot(s);i.init();const n=i.getFields(),{columns:r,rows:a}=i.definition;let l=t.args;"PIVOT.VALUE"===t?.parent.toUpperCase()?(l=l.filter(((e,t)=>t%2==0)),l=l.slice(1,t.argPosition)):l=l.filter(((e,t)=>t%2==1));const c=l.map((e=>e?.value)).filter(lt),h=r.map((e=>e.nameWithGranularity)),d=a.map((e=>e.nameWithGranularity)),u=[];let g=["ARG_SEPARATOR","SPACE"].includes(e.type)?c.at(-1):c.at(-2);const p=Xy.get(i.type);if(p&&g?.startsWith("#")&&(g=g.slice(1)),void 0===g&&(u.push(h[0]),u.push(d[0])),d.includes(g)){const e=d[d.indexOf(g)+1];u.push(e),u.push(h[0])}if(h.includes(g)){const e=h[h.indexOf(g)+1];u.push(e)}const m=u.filter(lt);return m.map((e=>{const[t,o]=e.split(":"),s=n[t];return s?Gy(s,o):void 0})).concat(m.map((e=>{if(!p)return;const t=e.split(":")[0],o=n[t];if(!o)return;const s=`"#${e}"`;return{text:s,description:ni("%s (positional)",o.string)+(o.help?` (${o.help})`:""),htmlContent:[{value:s,color:By.STRING}],fuzzySearchKey:o.string+s}}))).filter(lt)},selectProposal:Wy}),Py.add("pivot_group_values",{sequence:50,autoSelectFirstProposal:!0,getProposals(e){const t=e.functionContext;if(!t||!e||!function(e){const t=e.functionContext;return"PIVOT.VALUE"===t?.parent.toUpperCase()&&t.argPosition>=2&&t.argPosition%2==1}(e)&&!function(e){const t=e.functionContext;return"PIVOT.HEADER"===t?.parent.toUpperCase()&&t.argPosition>=1&&t.argPosition%2==0}(e))return;const o=Zy(e),s=this.getters.getPivotId(o);if(!s||!this.getters.isExistingPivot(s))return;const i=this.getters.getPivot(s);if(!i.isValid())return;const n=t.argPosition,r=e.functionContext?.args[n-1]?.value;if(!r)return;let a;try{a=i.definition.getDimension(r)}catch(e){return}return"month_number"===a.granularity?Object.values(tr).map(((e,t)=>({text:`${t+1}`,fuzzySearchKey:e.toString(),description:e.toString(),htmlContent:[{value:`${t+1}`,color:By.NUMBER}]}))):"quarter_number"===a.granularity?[1,2,3,4].map((e=>({text:`${e}`,fuzzySearchKey:`${e}`,description:ni("Quarter %s",e),htmlContent:[{value:`${e}`,color:By.NUMBER}]}))):"day_of_month"===a.granularity?je(1,32).map((e=>({text:`${e}`,fuzzySearchKey:`${e}`,description:"",htmlContent:[{value:`${e}`,color:By.NUMBER}]}))):"iso_week_number"===a.granularity?je(0,54).map((e=>({text:`${e}`,fuzzySearchKey:`${e}`,description:"",htmlContent:[{value:`${e}`,color:By.NUMBER}]}))):"day_of_week"===a.granularity?je(1,8).map((e=>({text:`${e}`,fuzzySearchKey:`${e}`,description:"",htmlContent:[{value:`${e}`,color:By.NUMBER}]}))):"hour_number"===a.granularity?je(0,24).map((e=>({text:`${e}`,fuzzySearchKey:`${e}`,description:"",htmlContent:[{value:`${e}`,color:By.NUMBER}]}))):"minute_number"===a.granularity?je(0,60).map((e=>({text:`${e}`,fuzzySearchKey:`${e}`,description:"",htmlContent:[{value:`${e}`,color:By.NUMBER}]}))):"second_number"===a.granularity?je(0,60).map((e=>({text:`${e}`,fuzzySearchKey:`${e}`,description:"",htmlContent:[{value:`${e}`,color:By.NUMBER}]}))):i.getPossibleFieldValues(a).map((({value:e,label:t})=>{const o="string"==typeof e,s=o?`"${e}"`:e.toString(),i=t===e?"":t;return{text:s,description:i,htmlContent:[{value:s,color:o?By.STRING:By.NUMBER}],fuzzySearchKey:s+i}}))},selectProposal:Wy}),Py.add("sheet_names",{sequence:150,autoSelectFirstProposal:!0,getProposals(e){return"SYMBOL"===e.type||"UNKNOWN"===e.type&&e.value.startsWith("'")?this.getters.getSheetIds().map((e=>{const t=We(this.getters.getSheetName(e));return{text:t,fuzzySearchKey:t.startsWith("'")?t:"'"+t}})):[]},selectProposal(e,t){const o=e.start,s=e.end;this.composer.changeComposerCursorSelection(o,s),this.composer.replaceComposerCursorSelection(t+"!")}});const Ky=new n;Ky.add("ALPHANUMERIC_INCREMENT_MODIFIER",{apply:(e,t)=>{e.current+=e.increment;const o=`${e.prefix}${e.current.toString().padStart(e.numberPostfixLength||0,"0")}`;return{cellData:{border:t.border,style:t.cell&&t.cell.style,format:t.cell&&t.cell.format,content:o},tooltip:{props:{content:o}}}}}).add("INCREMENT_MODIFIER",{apply:(e,t,o)=>{e.current+=e.increment;const s=e.current.toString(),i=o.getLocale(),n=sr(e.current,{format:t.cell?.format,locale:i});return{cellData:{border:t.border,style:t.cell&&t.cell.style,format:t.cell&&t.cell.format,content:s},tooltip:s?{props:{content:n}}:void 0}}}).add("DATE_INCREMENT_MODIFIER",{apply:(e,t,o)=>{const s=en(e.current,o.getLocale());s.setFullYear(s.getFullYear()+e.increment.years||0),s.setMonth(s.getMonth()+e.increment.months||0),s.setDate(s.getDate()+e.increment.days||0);const i=Ls(s);e.current=i;const n=o.getLocale(),r=sr(i,{format:t.cell?.format,locale:n});return{cellData:{border:t.border,style:t.cell&&t.cell.style,format:t.cell&&t.cell.format,content:i.toString()},tooltip:i?{props:{content:r}}:void 0}}}).add("COPY_MODIFIER",{apply:(e,t,o)=>{const s=t.cell?.content||"",i={locale:o.getLocale(),format:t.cell?.format};return{cellData:{border:t.border,style:t.cell&&t.cell.style,format:t.cell&&t.cell.format,content:s},tooltip:s?{props:{content:t.cell?_r(t.cell,i).formattedValue:""}}:void 0}}}).add("FORMULA_MODIFIER",{apply:(e,t,o,s)=>{e.current+=e.increment;let i=0,n=0;switch(s){case"up":i=0,n=-e.current;break;case"down":i=0,n=e.current;break;case"left":i=-e.current,n=0;break;case"right":i=e.current,n=0}const r=t.cell;if(!r||!r.isFormula)return{cellData:{}};const a=t.sheetId,l=o.getTranslatedCellFormula(a,i,n,r.compiledFormula.tokens);return{cellData:{border:t.border,style:r.style,format:r.format,content:l},tooltip:l?{props:{content:l}}:void 0}}});const Jy=new n,Qy=/(\d+)$/,eC=/^(.*\D+)/,tC=/^(.*\D+)(\d+)$/;function oC(e,t,o){let s=[],i=!1;for(let n of t){n===e&&(i=!0);const t=void 0===n||n.isFormula?void 0:_r(n,{locale:Ci,format:n.format});if(t&&o(t))s.push(t);else{if(i)return s;s=[]}}return s}function sC(e){let t=1;return e.length>=2&&(t=function(e){const t=[];let o=e[0];for(let s=1;s<e.length;s++){const i=e[s];t.push(i-o),o=i}return t.reduce(((e,t)=>e+t),0)/t.length}(e)*e.length),t}function iC(e){if(e.length<2)return 1;const t=e.map((e=>en(e,Ci))),o=function(e){if(e.length<2)return[{years:0,months:0,days:0}];const t=e.map(((t,o)=>{if(0===o)return{years:0,months:0,days:0};const s=Ss.fromTimestamp(e[o-1].getTime()),i=qs(s,t),n=Gs(s,t)%12;s.setFullYear(s.getFullYear()+i),s.setMonth(s.getMonth()+n);return{years:i,months:n,days:Ws(s,t)}}));return t.slice(1)}(t),s=(i=o).length<2?i[0]||{years:0,months:0,days:0}:i.every((e=>e.years===i[0].years&&e.months===i[0].months&&e.days===i[0].days))?i[0]:void 0;var i;if(void 0===s)return;const n=1===Object.values(s).filter((e=>0!==e)).length,r=Object.values(s).every((e=>0===e));if(!n||r){const o=t.map(((e,o)=>{if(0===o)return 0;const s=t[o-1];return Math.floor(e.getTime())-Math.floor(s.getTime())})).slice(1);if(o.every((e=>e===o[0])))return e.length*(e[1]-e[0])}return{years:s.years*e.length,months:s.months*e.length,days:s.days*e.length}}Jy.add("simple_value_copy",{condition:(e,t)=>!(1!==t.length||e.isFormula||e.format&&dr(e.format)),generateRule:()=>({type:"COPY_MODIFIER"}),sequence:10}).add("increment_alphanumeric_value",{condition:e=>!e.isFormula&&_r(e,{locale:Ci}).type===ai.text&&tC.test(e.content),generateRule:(e,t,o)=>{const s=parseInt(e.content.match(Qy)[0]),i=e.content.match(eC)[0],n=e.content.length-i.length,r=oC(e,t,(e=>e.type===ai.text&&tC.test(e.value))).filter((e=>i===(e.value??"").toString().match(eC)[0])).map((e=>parseInt((e.value??"").toString().match(Qy)[0])));let a=sC(r);return["up","left"].includes(o)&&1===r.length&&(a=-a),{type:"ALPHANUMERIC_INCREMENT_MODIFIER",prefix:i,current:s,increment:a,numberPostfixLength:n}},sequence:15}).add("copy_text",{condition:e=>!e.isFormula&&_r(e,{locale:Ci}).type===ai.text,generateRule:()=>({type:"COPY_MODIFIER"}),sequence:20}).add("update_formula",{condition:e=>e.isFormula,generateRule:(e,t)=>({type:"FORMULA_MODIFIER",increment:t.length,current:0}),sequence:30}).add("increment_dates",{condition:(e,t)=>!e.isFormula&&_r(e,{locale:Ci}).type===ai.number&&!!e.format&&dr(e.format),generateRule:(e,t)=>{const o=iC(oC(e,t,(e=>e.type===ai.number&&!!e.format&&dr(e.format))).map((e=>Number(e.value))));if(void 0===o)return{type:"COPY_MODIFIER"};const s=_r(e,{locale:Ci});return"object"==typeof o?{type:"DATE_INCREMENT_MODIFIER",increment:o,current:s.type===ai.number?s.value:0}:{type:"INCREMENT_MODIFIER",increment:o,current:s.type===ai.number?s.value:0}},sequence:25}).add("increment_number",{condition:e=>!e.isFormula&&_r(e,{locale:Ci}).type===ai.number,generateRule:(e,t,o)=>{const s=oC(e,t,(e=>e.type===ai.number&&!dr(e.format||""))).map((e=>Number(e.value)));let i=sC(s);["up","left"].includes(o)&&1===s.length&&(i=-i);const n=_r(e,{locale:Ci});return{type:"INCREMENT_MODIFIER",increment:i,current:n.type===ai.number?n.value:0}},sequence:40});const nC=new n,rC=30,aC=10,lC=20,cC=12,hC=80,dC="#F3F2F1",uC=6,gC=25;function pC(e,t){const o=e.getBoundingClientRect(),s=window.devicePixelRatio||1;e.width=s*o.width,e.height=s*o.height;const i=e.getContext("2d");i.scale(s,s);const n=function(e,t,o){const s=t.maxValue,i=t.minValue,n=t.gaugeValue,r=function(e,t){const o=t?gC:0,s=e.height-lC-o-aC,i=e.width-2*rC;let n,r;i>2*s?(n=2*s,r=s):(n=i,r=i/2);const a=o+aC+(s-r)/2;return{x:rC+(i-n)/2,y:a,width:n,height:r}}(e,t.title.text),a=r.width/6,l=n?(n.value-i.value)/(s.value-i.value):0,c={x:e.width/2,y:r.y+r.height-r.height/12};let h=hC;r.height<300&&(h*=r.height/300);const d=r.width/2,u=n?.label||"-";Da(o,u,{fontSize:h},"px")>d&&(h=function(e,t,o,s=.25){let i=1;if(o(i)>e)return i;if(o(t)<e)return t;let n=(i+t)/2,r=o(n),a=0;for(;Math.abs(r-e)>s&&a<20;)r>=e?t=(i+t)/2:i=(i+t)/2,n=(i+t)/2,r=o(n),a++;return n}(d,h,(e=>Da(o,u,{fontSize:e},"px"))));const g={x:r.x+a/2,y:r.y+r.height+cC},p={x:r.x+r.width-a/2,y:r.y+r.height+cC},m=OS(t.background),f=function(e,t,o,s){const i=e.maxValue,n=e.minValue,r={x:t.x+t.width/2,y:t.y+t.height},a={fontSize:cC},l=[],c=[];for(const h of e.inflectionValues){const e=(h.value-n.value)/(i.value-n.value),d=Da(s,h.label,a,"px"),u=Math.PI-Math.PI*e,g=SC(u,t.height+uC,r.x,r.y,d+2,cC);let p=c.some((e=>bC(e,g)))?cC:0;c.push(g),l.push({rotation:u,label:h.label,fontSize:cC,color:o,offset:p})}return l}(t,r,m,o);let v=0,b=0,S=0;t.title.text&&({width:b,height:S}=Fa(o,t.title.text,{fontSize:K,...t.title},"px"));switch(t.title.align){case"right":v=e.width-b-j;break;case"center":v=(e.width-b)/2;break;default:v=j}return{width:e.width,height:e.height,title:{label:t.title.text??"",fontSize:t.title.fontSize??K,textPosition:{x:v,y:X+S/2},color:t.title.color??m,bold:t.title.bold,italic:t.title.italic},backgroundColor:t.background,gauge:{rect:r,arcWidth:a,percentage:Ze(l,0,1),color:mC(t)},inflectionValues:f,gaugeValue:{label:u,textPosition:c,fontSize:h,color:m},minLabel:{label:t.minValue.label,textPosition:g,fontSize:cC,color:m},maxLabel:{label:t.maxValue.label,textPosition:p,fontSize:cC,color:m}}}(o,t,i);!function(e,t){e.save(),e.fillStyle=t.backgroundColor,e.fillRect(0,0,t.width,t.height),e.restore()}(i,n),function(e,t){e.save();const o=t.gauge,s=o.rect.x+o.rect.width/2,i=o.rect.y+o.rect.height,n=o.rect.height-o.arcWidth/2;if(n<0)return;const r=1===o.percentage?0:Math.PI*(1+o.percentage);e.strokeStyle=dC,e.beginPath(),e.lineWidth=o.arcWidth,e.arc(s,i,n,r,0),e.stroke(),e.strokeStyle=o.color,e.beginPath(),e.arc(s,i,n,Math.PI,r),e.stroke(),e.restore()}(i,n),function(e,t){const{x:o,y:s,width:i,height:n}=t.gauge.rect;for(const r of t.inflectionValues){e.save(),e.translate(o+i/2-.5,s+n-.5),e.rotate(Math.PI/2-r.rotation),e.lineWidth=2,e.strokeStyle=OS(t.backgroundColor)+"aa",e.beginPath(),e.moveTo(0,-(n-t.gauge.arcWidth)),e.lineTo(0,-n-3),e.stroke(),e.textAlign="center",e.font=`${r.fontSize}px ${ve}`,e.fillStyle=r.color;const a=-n-uC-r.offset;e.fillText(r.label,0,a),e.restore()}}(i,n),function(e,t){for(const o of[t.minLabel,t.maxLabel,t.gaugeValue])e.save(),e.textAlign="center",e.fillStyle=o.color,e.font=`${o.fontSize}px ${ve}`,e.fillText(o.label,o.textPosition.x,o.textPosition.y),e.restore()}(i,n),function(e,t){e.save();const o=t.title;e.font=Ta(o.fontSize,o.bold,o.italic),e.textBaseline="middle",e.fillStyle=o.color,e.fillText(o.label,o.textPosition.x,o.textPosition.y),e.restore()}(i,n)}function mC(e){const t=e.gaugeValue?.value;if(void 0===t)return dC;for(let o=0;o<e.inflectionValues.length;o++){const s=e.inflectionValues[o];if("<"===s.operator&&t<s.value)return e.colors[o];if("<="===s.operator&&t<=s.value)return e.colors[o]}return e.colors.at(-1)}function fC(e){return[{start:e.topLeft,end:e.topRight},{start:e.topRight,end:e.bottomRight},{start:e.bottomRight,end:e.bottomLeft},{start:e.bottomLeft,end:e.topLeft}]}function vC(e,t){const o=e.start,s=e.end,i=t.start,n=t.end;function r(e,t,o){return(o.y-e.y)*(t.x-e.x)>(t.y-e.y)*(o.x-e.x)}return r(o,i,n)!==r(s,i,n)&&r(o,s,i)!==r(o,s,n)}function bC(e,t){const o=fC(e),s=fC(t);for(const e of o)for(const t of s)if(vC(e,t))return!0;return!1}function SC(e,t,o,s,i,n){const r=Math.cos(e),a=Math.sin(e),l=r*t,c=a*t,h=a*(i/2),d=r*(i/2),u=r*(t+n),g=a*(t+n);return{bottomLeft:{x:l-h+o,y:s-(c+d)},bottomRight:{x:l+h+o,y:s-(c-d)},topRight:{x:u+h+o,y:s-(g-d)},topLeft:{x:u-h+o,y:s-(g+d)}}}class yC extends t.Component{static template="o-spreadsheet-GaugeChartComponent";canvas=t.useRef("chartContainer");get runtime(){return this.env.model.getters.getChartRuntime(this.props.figureUI.id)}setup(){t.useEffect((()=>pC(this.canvas.el,this.runtime)),(()=>{const e=this.canvas.el.getBoundingClientRect();return[e.width,e.height,this.runtime,this.canvas.el,window.devicePixelRatio]}))}}function CC(e){return 8===(e=Wt(e).replace("#","")).length?e.slice(6)+e.slice(0,6):e}yC.props={figureUI:Object};const wC={responsive:!0,maintainAspectRatio:!1,elements:{line:{fill:!1},point:{hitRadius:15}},animation:!1,events:["mousemove","mouseout","click","touchstart","touchmove","mouseup"]};function IC(e,t,o){const s=document.createElement("div");s.style.width=`${t.width}px`,s.style.height=`${t.height}px`;const i=document.createElement("canvas");let n;if(s.append(i),i.setAttribute("width",t.width.toString()),i.setAttribute("height",t.height.toString()),document.body.append(s),"chartJsConfig"in e){const t=ze(e.chartJsConfig);t.plugins=[EC];const o=new window.Chart(i,t);n=o.toBase64Image(),o.destroy()}else if("scorecard"===o){Ty(Oy(t,e),i),n=i.toDataURL()}else"gauge"===o&&(pC(i,e),n=i.toDataURL());return s.remove(),n}async function xC(e,t,o){const s=document.createElement("div");s.style.width=`${t.width}px`,s.style.height=`${t.height}px`,s.style.position="fixed",s.style.opacity="0";const i=document.createElement("canvas");s.append(i),i.setAttribute("width",t.width.toString()),i.setAttribute("height",t.height.toString()),document.body.append(s);let n=null;if("chartJsConfig"in e){const t=ze(e.chartJsConfig);t.plugins=[EC];const o=new window.Chart(i,t);n=await new Promise((e=>i.toBlob(e,"image/png"))),o.destroy()}else if("scorecard"===o){Ty(Oy(t,e),i),n=await new Promise((e=>i.toBlob(e,"image/png")))}else"gauge"===o&&(pC(i,e),n=await new Promise((e=>i.toBlob(e,"image/png"))));return s.remove(),n?new File([n],"chart.png",{type:"image/png"}):void 0}const EC={id:"customCanvasBackgroundColor",beforeDraw:e=>{const{ctx:t}=e;t.save(),t.globalCompositeOperation="destination-over",t.fillStyle="#ffffff",t.fillRect(0,0,e.width,e.height),t.restore()}},RC={Errors:{InvalidRange:ni("The range is invalid"),FirstArgMissing:ni("The argument is missing. Please provide a value"),SecondArgMissing:ni("The second argument is missing. Please provide a value"),MinNaN:ni("The minpoint must be a number"),MidNaN:ni("The midpoint must be a number"),MaxNaN:ni("The maxpoint must be a number"),ValueUpperInflectionNaN:ni("The first value must be a number"),ValueLowerInflectionNaN:ni("The second value must be a number"),MinBiggerThanMax:ni("Minimum must be smaller then Maximum"),MinBiggerThanMid:ni("Minimum must be smaller then Midpoint"),MidBiggerThanMax:ni("Midpoint must be smaller then Maximum"),LowerBiggerThanUpper:ni("Lower inflection point must be smaller than upper inflection point"),MinInvalidFormula:ni("Invalid Minpoint formula"),MaxInvalidFormula:ni("Invalid Maxpoint formula"),MidInvalidFormula:ni("Invalid Midpoint formula"),ValueUpperInvalidFormula:ni("Invalid upper inflection point formula"),ValueLowerInvalidFormula:ni("Invalid lower inflection point formula"),EmptyRange:ni("A range needs to be defined"),ValueCellIsInvalidFormula:ni("At least one of the provided values is an invalid formula"),Unexpected:ni("The rule is invalid for an unknown reason")},ColorScale:ni("Color scale"),IconSet:ni("Icon set"),DataBar:ni("Data bar")},TC={IsEmpty:ni("Is empty"),IsNotEmpty:ni("Is not empty"),ContainsText:ni("Contains"),NotContains:ni("Does not contain"),BeginsWith:ni("Starts with"),EndsWith:ni("Ends with"),Equal:ni("Is equal to"),NotEqual:ni("Is not equal to"),GreaterThan:ni("Is greater than"),GreaterThanOrEqual:ni("Is greater than or equal to"),LessThan:ni("Is less than"),LessThanOrEqual:ni("Is less than or equal to"),Between:ni("Is between"),NotBetween:ni("Is not between")},AC={Series:ni("Series"),BackgroundColor:ni("Background color"),StackedBarChart:ni("Stacked bar chart"),StackedLineChart:ni("Stacked line chart"),StackedAreaChart:ni("Stacked area chart"),StackedColumnChart:ni("Stacked column chart"),CumulativeData:ni("Cumulative data"),TreatLabelsAsText:ni("Treat labels as text"),AggregatedChart:ni("Aggregate"),Errors:{Unexpected:ni("The chart definition is invalid for an unknown reason"),InvalidDataSet:ni("The dataset is invalid"),InvalidLabelRange:ni("Labels are invalid"),InvalidScorecardKeyValue:ni("The key value is invalid"),InvalidScorecardBaseline:ni("The baseline value is invalid"),InvalidGaugeDataRange:ni("The data range is invalid"),EmptyGaugeRangeMin:ni("A minimum range limit value is needed"),GaugeRangeMinNaN:ni("The minimum range limit value must be a number"),EmptyGaugeRangeMax:ni("A maximum range limit value is needed"),GaugeRangeMaxNaN:ni("The maximum range limit value must be a number"),GaugeLowerInflectionPointNaN:ni("The lower inflection point value must be a number"),GaugeUpperInflectionPointNaN:ni("The upper inflection point value must be a number")},GeoChart:{ColorScales:{blues:ni("Blues"),cividis:ni("Cividis"),greens:ni("Greens"),greys:ni("Greys"),oranges:ni("Oranges"),purples:ni("Purples"),rainbow:ni("Rainbow"),reds:ni("Reds"),viridis:ni("Viridis")}}},DC={Custom:ni("Custom")},_C=ni("Merged cells are preventing this operation. Unmerge those cells and try again."),OC={Errors:{Unexpected:ni("Cannot split the selection for an unknown reason"),NoSplitSeparatorInSelection:ni("There is no match for the selected separator in the selection"),MoreThanOneColumnSelected:ni("Only a selection from a single column can be split"),SplitWillOverwriteContent:ni("Splitting will overwrite existing content")}},FC={Errors:{Unexpected:ni("Cannot remove duplicates for an unknown reason"),MoreThanOneRangeSelected:ni("Please select only one range of cells"),EmptyTarget:ni("Please select a range of cells containing values."),NoColumnsProvided:ni("Please select at latest one column to analyze."),WillRemoveExistingMerge:ni("This operation is not possible due to a merge. Please remove the merges first than try again.")}},MC={DateIs:{today:ni("today"),yesterday:ni("yesterday"),tomorrow:ni("tomorrow"),lastWeek:ni("in the past week"),lastMonth:ni("in the past month"),lastYear:ni("in the past year")},DateIsBefore:{today:ni("today"),yesterday:ni("yesterday"),tomorrow:ni("tomorrow"),lastWeek:ni("one week ago"),lastMonth:ni("one month ago"),lastYear:ni("one year ago")},CriterionError:{notEmptyValue:ni("The value must not be empty"),numberValue:ni("The value must be a number"),dateValue:ni("The value must be a date"),validRange:ni("The value must be a valid range"),validFormula:ni("The formula must be valid")},Errors:{InvalidRange:ni("The range is invalid."),InvalidDataValidationCriterionValue:ni("One or more of the provided criteria values are invalid. Please review and correct them."),InvalidNumberOfCriterionValues:ni("One or more of the provided criteria values are missing."),Unexpected:ni("The rule is invalid for an unknown reason.")}},PC={Errors:{Unexpected:ni("The table zone is invalid for an unknown reason"),TableOverlap:ni("You cannot create overlapping tables."),NonContinuousTargets:ni("A table can only be created on a continuous selection."),InvalidRange:ni("The range is invalid"),TargetOutOfSheet:ni("The range is out of the sheet")},Checkboxes:{hasFilters:ni("Filter button"),headerRow:ni("Header row(s)"),bandedRows:ni("Banded rows"),firstColumn:ni("First column"),lastColumn:ni("Last column"),bandedColumns:ni("Banded columns"),automaticAutofill:ni("Automatically autofill formulas"),totalRow:ni("Total row"),isDynamic:ni("Auto-adjust to formula result")},Tooltips:{filterWithoutHeader:ni("Cannot have filters without a header row"),isDynamic:ni("For tables based on array formulas only")}},NC={labels:{no_calculations:ni("No calculations"),"%_of_grand_total":ni("% of grand total"),"%_of_col_total":ni("% of column total"),"%_of_row_total":ni("% of row total"),"%_of":ni("% of"),"%_of_parent_row_total":ni("% of parent row total"),"%_of_parent_col_total":ni("% of parent column total"),"%_of_parent_total":ni("% of parent total"),difference_from:ni("Difference from"),"%_difference_from":ni("% difference from"),running_total:ni("Running total"),"%_running_total":ni("% Running total"),rank_asc:ni("Rank smallest to largest"),rank_desc:ni("Rank largest to smallest"),index:ni("Index")},descriptions:{"%_of_grand_total":()=>ni("Displayed as % of grand total"),"%_of_col_total":()=>ni("Displayed as % of column total"),"%_of_row_total":()=>ni("Displayed as % of row total"),"%_of":e=>ni('Displayed as % of "%s"',e),"%_of_parent_row_total":e=>ni('Displayed as % of parent row total of "%s"',e),"%_of_parent_col_total":()=>ni("Displayed as % of parent column total"),"%_of_parent_total":e=>ni('Displayed as % of parent "%s" total',e),difference_from:e=>ni('Displayed as difference from "%s"',e),"%_difference_from":e=>ni('Displayed as % difference from "%s"',e),running_total:e=>ni('Displayed as running total based on "%s"',e),"%_running_total":e=>ni('Displayed as % running total based on "%s"',e),rank_asc:e=>ni('Displayed as rank from smallest to largest based on "%s"',e),rank_desc:e=>ni('Displayed as rank largest to smallest based on "%s"',e),index:()=>ni("Displayed as index")},documentation:{no_calculations:ni("Displays the value that is entered in the field."),"%_of_grand_total":ni("Displays values as a percentage of the grand total of all the values or data points in the report."),"%_of_col_total":ni("Displays all the values in each column or series as a percentage of the total for the column or series."),"%_of_row_total":ni("Displays the value in each row or category as a percentage of the total for the row or category."),"%_of":ni("Displays values as a percentage of the value of the Base item in the Base field."),"%_of_parent_row_total":ni("Calculates values as follows:\n(value for the item) / (value for the parent item on rows)"),"%_of_parent_col_total":ni("Calculates values as follows:\n(value for the item) / (value for the parent item on columns)"),"%_of_parent_total":ni("Calculates values as follows:\n(value for the item) / (value for the parent item of the selected Base field)"),difference_from:ni("Displays values as the difference from the value of the Base item in the Base field."),"%_difference_from":ni("Displays values as the percentage difference from the value of the Base item in the Base field."),running_total:ni("Displays the value for successive items in the Base field as a running total."),"%_running_total":ni("Calculates the value as a percentage for successive items in the Base field that are displayed as a running total."),rank_asc:ni("Displays the rank of selected values in a specific field, listing the smallest item in the field as 1, and each larger value with a higher rank value."),rank_desc:ni("Displays the rank of selected values in a specific field, listing the largest item in the field as 1, and each smaller value with a higher rank value."),index:ni("Calculates values as follows:\n((value in cell) x (Grand Total of Grand Totals)) / ((Grand Row Total) x (Grand Column Total))")}},kC={second:1e3,minute:6e4,hour:36e5,day:864e5,month:2592e6,year:31536e6},VC={inSeconds:function(e){return Math.floor(e/kC.second)},inMinutes:function(e){return Math.floor(e/kC.minute)},inHours:function(e){return Math.floor(e/kC.hour)},inDays:function(e){return Math.floor(e/kC.day)},inMonths:function(e){return Math.floor(e/kC.month)},inYears:function(e){return Math.floor(e/kC.year)}},LC=/^((d|dd|m|mm|yyyy|yy|hh|h|ss|a)(-|:|\s|\/))*(d|dd|m|mm|yyyy|yy|hh|h|ss|a)$/i;function HC(e,t,o){const s=function(e){const t=e.indexOf("h");e=t>=0?e.slice(0,t).replace(/m/g,"M")+e.slice(t):e.replace(/m/g,"M");e.includes("a")||(e=e.replace(/h/g,"H"));return e}(t),i=function(e,t,o){const s=e.map((e=>Ns(e,o)?.jsDate));if(s.some((e=>void 0===e))||e.length<2)return;const i=s.map((e=>e.getTime())),n=Mt(i)-Pt(i),r=function(e){if(e.includes("s"))return"second";if(e.includes("m"))return"minute";if(e.includes("h")||e.includes("H"))return"hour";if(e.includes("d"))return"day";if(e.includes("M"))return"month";return"year"}(t);if(kC.second>=kC[r]&&VC.inSeconds(n)<180)return"second";if(kC.minute>=kC[r]&&VC.inMinutes(n)<180)return"minute";if(kC.hour>=kC[r]&&VC.inHours(n)<96)return"hour";if(kC.day>=kC[r]&&VC.inDays(n)<90)return"day";if(kC.month>=kC[r]&&VC.inMonths(n)<36)return"month";return"year"}(e,s,o),n={};return i&&(n[i]=s),{parser:s,displayFormats:n,unit:i??!1}}function UC(e,t,o,s){let i=nw(s,t,o).formattedValues,n=aw(s,t);PS(o,t[0],e.dataSetsHaveTitle||!1)&&i.shift(),({labels:i,dataSetsValues:n}=ow(i,n)),e.aggregated&&({labels:i,dataSetsValues:n}=sw(i,n));const r=rw(s,t,"left"),a=rw(s,t,"right"),l=e.horizontal?{x:r||a}:{y:r,y1:a},c=[];for(const t in n){const{data:o}=n[t],s=e.dataSets?.[t].trend;if(!s?.display||e.horizontal){c.push(void 0);continue}const i=jC(s,o);c.push(i)}return{dataSetsValues:n,trendDataSetsValues:c,axisFormats:l,labels:i,locale:s.getLocale()}}function BC(e,t,o,s){const i=UC(e,t,o,s),n=i.dataSetsValues.filter((e=>!e.hidden)),r=[];if(n[0]){const e=n[0].data.map((e=>e>0?e:0));r.push({...n[0],data:e})}if(n[1]){const e=n[1].data.map((e=>e>0?-e:0));r.push({...n[1],data:e})}return{...i,dataSetsValues:r}}function zC(e,t,o,s){const i=function(e,t,o,s){if(function(e,t,o,s){return!e.labelsAsText&&JC(e,t,o,s)}(e,t,o,s)&&function(){if(!window.Chart)return!1;const e="luxon"===new window.Chart._adapters._date({})._id;e||ew||(ew=!0,console.warn("'chartjs-adapter-luxon' time adapter is not installed. Time scale axes are disabled."));return e}())return"time";if(function(e,t,o,s){return!e.labelsAsText&&QC(e,t,o,s)}(e,t,o,s))return"linear";return"category"}(e,t,o,s),n=nw(s,t,o);let r="linear"===i?n.values:n.formattedValues,a=aw(s,t);const l=PS(o,t[0],e.dataSetsHaveTitle||!1);l&&r.shift(),({labels:r,dataSetsValues:a}=ow(r,a)),"time"===i&&({labels:r,dataSetsValues:a}=function(e,t){if(0===e.length||e.every((e=>!e)))return{labels:e,dataSetsValues:t};const o=[...e],s=ze(t);for(let e=0;e<o.length;e++)if(!o[e]){o[e]=pt(o,e);for(let t of s)t.data[e]=void 0}return{labels:o,dataSetsValues:s}}(r,a)),e.aggregated&&({labels:r,dataSetsValues:a}=sw(r,a)),e.cumulative&&(a=lw(a,"asc"));const c={y:rw(s,t,"left"),y1:rw(s,t,"right"),x:iw(s,o,l)},h=[];for(const t in a){const o=e.dataSets?.[t].trend;if(!o?.display){h.push(void 0);continue}const{data:n}=a[t];h.push(YC(o,n,r,i,s.getLocale()))}return{dataSetsValues:a,axisFormats:c,labels:r,locale:s.getLocale(),trendDataSetsValues:h,axisType:i}}function $C(e,t,o,s){let i=nw(s,t,o).formattedValues,n=aw(s,t);PS(o,t[0],e.dataSetsHaveTitle||!1)&&i.shift(),({labels:i,dataSetsValues:n}=ow(i,n)),e.aggregated&&({labels:i,dataSetsValues:n}=sw(i,n)),({dataSetsValues:n,labels:i}=function(e,t){const o=Math.max(e.length,...t.map((e=>e.data?.length||0))),s=je(0,o).filter((e=>t.some((t=>"number"==typeof t.data[e]&&t.data[e]>0))));return{labels:s.map((t=>e[t]||"")),dataSetsValues:t.map((e=>({...e,data:s.map((t=>"number"==typeof e.data[t]&&e.data[t]>0?e.data[t]:null))})))}}(i,n));return{dataSetsValues:n,axisFormats:{y:rw(s,t,"left")},labels:i,locale:s.getLocale()}}function GC(e,t,o,s){let i=nw(s,t,o).formattedValues,n=aw(s,t);PS(o,t[0],e.dataSetsHaveTitle||!1)&&i.shift(),({labels:i,dataSetsValues:n}=ow(i,n)),e.aggregated&&({labels:i,dataSetsValues:n}=sw(i,n));return{dataSetsValues:n,axisFormats:{r:rw(s,t,"left")||rw(s,t,"right")},labels:i,locale:s.getLocale()}}function WC(e,t,o,s){let i=nw(s,t,o).formattedValues;PS(o,t[0],e.dataSetsHaveTitle||!1)&&i.shift();let n=aw(s,t);({labels:i,dataSetsValues:n}=sw(i,n));return{dataSetsValues:n,axisFormats:{y:rw(s,t,"left")||rw(s,t,"right")},labels:i,locale:s.getLocale(),availableRegions:s.getGeoChartAvailableRegions(),geoFeatureNameToId:s.geoFeatureNameToId,getGeoJsonFeatures:s.getGeoJsonFeatures}}function qC(e,t,o,s){let i=nw(s,t,o).formattedValues,n=aw(s,t);PS(o,t[0],e.dataSetsHaveTitle||!1)&&i.shift(),({labels:i,dataSetsValues:n}=ow(i,n)),e.aggregated&&({labels:i,dataSetsValues:n}=sw(i,n)),e.cumulative&&(n=lw(n,"desc"));return{dataSetsValues:n,axisFormats:{x:rw(s,t,"left")||rw(s,t,"right")},labels:i,locale:s.getLocale()}}function ZC(e,t,o,s){let i=nw(s,t,o).values,n=function(e,t){t=t.filter((t=>!e.isColHidden(t.dataRange.sheetId,t.dataRange.zone.left)));const o=t.map((()=>({data:[],label:""}))),s=t.map((t=>tw(e,t)));if(!s.length)return o;const i=Math.min(...s.map((e=>e.length)));let n=[];const r=t.length-1;for(let e=0;e<i;e++)for(let t=0;t<s.length;t++){let i=s[t][e];null==i&&t!==r&&(i=n[t]),i!==n[t]&&(n=n.slice(0,t),n[t]=i),o[t].data.push(i??null)}return o.filter((e=>e.data.some((e=>null!==e))))}(s,t);const r=PS(o,t[0],e.dataSetsHaveTitle||!1);return r&&i.shift(),({labels:i,dataSetsValues:n}=function(e,t){const o=[],s=[];for(let t=0;t<e.length;t++)Number(e[t])<=0?s.push(t):Number(e[t])>0&&o.push(t);const i=o.length?o:s;return{labels:i.map((t=>e[t])),dataSetsValues:t.map((e=>({...e,data:i.map((t=>e.data[t]))})))}}(i,n)),({labels:i,dataSetsValues:n}=function(e,t){const o=Math.max(e.length,...t.map((e=>e.data?.length||0))),s=e=>null==e||""===e,i=je(0,o).filter((o=>{const i=t.map((e=>e.data?.[o]));if(s(i[0]))return!1;let n=!1;for(const e of i)if(n||=s(e),n&&!s(e))return!1;return e[o]&&!isNaN(Number(e[o]))}));return{labels:i.map((t=>e[t])),dataSetsValues:t.map((e=>({...e,data:i.map((t=>e.data[t]))})))}}(i,n)),{dataSetsValues:n,axisFormats:{y:iw(s,o,r)},labels:i,locale:s.getLocale()}}function jC(e,t){const o=[],s=[],i=[];for(let e=0;e<t.length;e++)"number"==typeof t[e]&&(o.push(t[e]),s.push(e+1)),i.push(e+1);const n=XC(e,o,s,je(.5,i.length+.55,.2));return n.length?n:void 0}function YC(e,t,o,s,i){const n=[],r=[],a=[],l=t.length;if(l<2)return;switch(s){case"category":for(let e=0;e<l;e++)"number"==typeof t[e]&&(n.push(t[e]),r.push(e+1)),a.push(e+1);break;case"linear":for(let e=0;e<t.length;e++){const s=Number(o[e]);isNaN(s)||("number"==typeof t[e]&&(n.push(t[e]),r.push(s)),a.push(s))}break;case"time":for(let e=0;e<t.length;e++){const s=zi({value:o[e]},i);null!==t[e]&&(n.push(t[e]),r.push(s)),a.push(s)}}const c=Math.min(...a),h=Math.max(...a);if(h===c)return;const d=(h-c)/(5*a.length),u=XC(e,n,r,je(c,h+d/2,d));return u.length?u:void 0}function XC(e,t,o,s){if(t.length<2||o.length<2||0===s.length)return[];const{normalizedLabels:i,normalizedNewLabels:n}=function(e,t,o){let s=[],i=[];if("logarithmic"===o.type){const o=Math.max(...e.map(Math.abs));s=e.map((e=>e/o)),i=t.map((e=>e/o))}else{const o=Math.max(...e),n=Math.min(...e),r=o-n;s=e.map((e=>(e-o)/r)),i=t.map((e=>(e-o)/r))}return{normalizedLabels:s,normalizedNewLabels:i}}(o,s,e);try{switch(e.type){case"polynomial":{const o=e.order;if(!o)return s.map((e=>({x:e,y:NaN})));if(1===o)return oc([t],[i],[n],!0)[0].map(((e,t)=>({x:s[t],y:e})));const r=Kl(t,i,o,!0).flat();return n.map(((e,t)=>({x:s[t],y:Ql(r,e,o)})))}case"exponential":{const e=[],o=[];for(let s=0;s<t.length;s++)t[s]>0&&(e.push(Math.log(t[s])),o.push(i[s]));return o.length?ec(oc([e],[o],[n],!0))[0].map(((e,t)=>({x:s[t],y:e}))):s.map((e=>({x:e,y:NaN})))}case"logarithmic":return oc([t],tc([i]),tc([n]),!0)[0].map(((e,t)=>({x:s[t],y:e})));case"trailingMovingAverage":return function(e,t,o=Ae){const s=[];for(let e=0;e<o-1;e++)s.push({x:t[e],y:NaN});for(let i=0;i<=e.length-o;i++){let n=0;for(let t=i;t<i+o;t++)n+=e[t];s.push({x:t[i+o-1],y:n/o})}return s}(t,o,e.window);default:return s.map((e=>({x:e,y:NaN})))}}catch(e){return s.map((e=>({x:e,y:NaN})))}}function KC(e,t,o,s){return JC(e,t,o,s)||QC(e,t,o,s)}function JC(e,t,o,s){if(!o||!QC(e,t,o,s))return!1;const i=iw(s,o,PS(o,t[0],e.dataSetsHaveTitle||!1));return Boolean(i&&LC.test(i))}function QC(e,t,o,s){if(!o)return!1;const i=s.getRangeValues(o);return PS(o,t[0],e.dataSetsHaveTitle||!1)&&i.shift(),!i.some((e=>isNaN(Number(e))&&e))&&!i.every((e=>!e))}let ew=!1;function tw(e,t){if(t.dataRange){const o=t.labelCell?[t.labelCell.zone]:[],s=Fo([t.dataRange.zone],o)[0];if(void 0===s)return[];const i=e.getRangeFromZone(t.dataRange.sheetId,s);return e.getRangeValues(i).map((e=>""===e?void 0:e))}return[]}function ow(e,t){const o=je(0,Math.max(e.length,...t.map((e=>e.data?.length||0)))).filter((o=>{const s=e[o],i=t.map((e=>e.data?.[o]));return s||i.some((e=>"number"==typeof e))}));return{labels:o.map((t=>e[t]||"")),dataSetsValues:t.map((e=>({...e,data:o.map((t=>"number"==typeof e.data[t]?e.data[t]:null))})))}}function sw(e,t){const o=new Set(e),s={};o.forEach((e=>{s[e]=new Array(t.length).fill(0)}));for(const o of je(0,e.length)){const n=e[o];for(const e of je(0,t.length))s[n][e]+="number"==typeof(i=t[e].data[o])?i:0}var i;return{labels:Array.from(o),dataSetsValues:t.map(((e,t)=>({...e,data:Array.from(o).map((e=>s[e][t]))})))}}function iw(e,t,o){if(!t)return;const{sheetId:s,zone:i}=t,n=os(i).map((t=>e.getEvaluatedCell({sheetId:s,...t}).format));return o&&n.shift(),n.find((e=>void 0!==e))}function nw(e,t,o){let s={values:[],formattedValues:[]};if(o){const{left:i}=o.zone;if(o.invalidXc||o.invalidSheetName||e.isColHidden(o.sheetId,i)){if(t[0]){s={formattedValues:je(0,tw(e,t[0]).length).map((e=>e.toString())),values:s.formattedValues}}}else s={formattedValues:e.getRangeFormattedValues(o),values:e.getRangeValues(o).map((e=>String(e??"")))}}else if(1===t.length){const o=tw(e,t[0]).length;for(let e=0;e<o;e++)s.formattedValues.push(""),s.values.push("")}else if(t[0]){s={formattedValues:je(0,tw(e,t[0]).length).map((e=>e.toString())),values:s.formattedValues}}return s}function rw(e,t,o){const s=t.filter((e=>"right"===o==!!e.rightYAxis));for(const t of s){const o=e.getRangeFormats(t.dataRange).find((e=>void 0!==e&&!dr(e)));if(o)return o}}function aw(e,t){const o=[];for(const[s,i]of Object.entries(t)){let t,n=e.isColHidden(i.dataRange.sheetId,i.dataRange.zone.left);if(i.labelCell){const o=i.labelCell,n=o?e.getEvaluatedCell({sheetId:o.sheetId,col:o.zone.left,row:o.zone.top}):void 0;t=n&&o?n.formattedValue:t=`${AC.Series} ${parseInt(s)+1}`}else t=`${AC.Series} ${parseInt(s)+1}`;let r=i.dataRange?tw(e,i):[];r.every((e=>"string"==typeof e&&!Hi(e)))&&r.some((e=>""!==e))?r.fill(1):r.every((e=>null==e||!Xs(e.toString(),Ci)))&&(n=!0),o.push({data:r,label:t,hidden:n})}return o}function lw(e,t){return e.map((e=>{const o=[];let s=0;const i="asc"===t?Object.keys(e.data):Object.keys(e.data).reverse();for(const t of i)isNaN(parseFloat(e.data[t]))?o[t]=e.data[t]:(s+=parseFloat(e.data[t]),o[t]=s);return{...e,data:o}}))}function cw(e){return{padding:{left:j,right:j,top:X,bottom:Y}}}function hw(e,t){return{display:"none"!==e.legendPosition,position:"none"!==e.legendPosition?e.legendPosition:void 0}}function dw(e,t){return{...Sw,...hw(e),...yw(_S(e.background),{pointStyle:"rect",lineWidth:3})}}function uw(e,t){const o=e.fillArea,s=o?"rect":"line",i=o?2:3;return{...Sw,...hw(e),...yw(_S(e.background),{pointStyle:s,lineWidth:i})}}function gw(e,t){const{dataSetsValues:o}=t,s=Math.max(0,...o.map((e=>e?.data?.length??0))),i=HS(new mo(s),o),n=_S(e.background);return{...hw(e),labels:{usePointStyle:!0,generateLabels:e=>e.data.labels?.map(((e,t)=>({text:US(String(e)),strokeStyle:i[t],fillStyle:i[t],pointStyle:"rect",lineWidth:2,fontColor:n})))||[],filter:(e,t)=>!("datasetIndex"in e)||!t.datasets[e.datasetIndex].hidden}}}function pw(e,t){return{...Sw,...hw(e),...yw(_S(e.background),{pointStyle:"circle",strokeStyle:e.background||"#ffffff",lineWidth:8})}}function mw(e,t){return{...Sw,...hw(e),...yw(_S(e.background),{lineWidth:3})}}function fw(e,t){const o=_S(e.background),s=e.negativeValuesColor||A,i=e.positiveValuesColor||T,n=e.subTotalValuesColor||D;return{...hw(e),labels:{usePointStyle:!0,generateLabels:()=>{const t=[{text:ni("Positive values"),fontColor:o,fillStyle:i,strokeStyle:i,pointStyle:"rect"},{text:ni("Negative values"),fontColor:o,fillStyle:s,strokeStyle:s,pointStyle:"rect"}];return(e.showSubTotals||e.firstValueAsSubtotal)&&t.push({text:ni("Subtotals"),fontColor:o,fillStyle:n,strokeStyle:n,pointStyle:"rect"}),t},filter:(e,t)=>!("datasetIndex"in e)||!t.datasets[e.datasetIndex].hidden},onClick:()=>{}}}function vw(e,t){const o=e.fillArea??!1,s=o?"rect":"line",i=o?2:3;return{...Sw,...hw(e),...yw(_S(e.background),{pointStyle:s,lineWidth:i})}}function bw(e,t){const o=_S(e.background);return{...hw(e),labels:{usePointStyle:!0,generateLabels:e=>{const t=e.data.datasets.at(-1);if(!t)return[];return t.groupColors.map((({color:e,label:t})=>({text:US(t),fontColor:o,fillStyle:e,strokeStyle:e,pointStyle:"rect"})))}}}}const Sw={onHover:e=>{const t=e.native?.target;t&&(t.style.cursor="pointer")},onLeave:e=>{const t=e.native?.target;t&&(t.style.cursor="default")},onClick:(e,t,o)=>{if("click"!==e.type)return;const s=t.datasetIndex;o.legendItems&&void 0!==s&&(o.chart.isDatasetVisible(s)?o.chart.hide(s):o.chart.show(s),e.native.preventDefault(),e.native.stopPropagation())}};function yw(e,t){return{labels:{color:e,usePointStyle:!0,generateLabels:o=>o.data.datasets.map(((s,i)=>BS(s.xAxisID)?{text:US(s.label),fontColor:e,strokeStyle:s.borderColor,hidden:!o.isDatasetVisible(i),pointStyle:"line",datasetIndex:i,lineWidth:3}:{text:US(s.label),fontColor:e,strokeStyle:s.borderColor,fillStyle:s.backgroundColor,hidden:!o.isDatasetVisible(i),pointStyle:"line"===s.type?"line":"rect",datasetIndex:i,...t})),filter:(e,t)=>!("datasetIndex"in e)||!t.datasets[e.datasetIndex].hidden}}}function Cw(e,t){let o={};const{trendDataSetsValues:s,locale:i,axisFormats:n}=t,r={stacked:e.stacked,locale:i};if(e.horizontal)o.x=Ow(e,"bottom","values",{...r,format:n?.x}),o.y=Ow(e,"left","labels",r);else{o.x=Ow(e,"bottom","labels",r);const t={...r,format:n?.y};o.y=Ow(e,"left","values",t);const s={...r,format:n?.y1};o.y1=Ow(e,"right","values",s)}if(o=St(o),s&&s.length&&s.some(lt)){const e=Math.max(...s.map((e=>e?.length||0)));o[SS]={...o.x,labels:Array(e).fill(""),offset:!1,display:!1},o[yS]={...o.x,offset:!0,display:!1}}return o}function ww(e,t){const{locale:o,axisType:s,trendDataSetsValues:i,labels:n,axisFormats:r}=t,a=r?.x,l=e.stacked;let c={x:Ow(e,"bottom","labels",{locale:o}),y:Ow(e,"left","values",{locale:o,stacked:l,format:r?.y}),y1:Ow(e,"right","values",{locale:o,stacked:l,format:r?.y1})};if(c=St(c),"time"===s&&n&&a){const e={type:"time",time:HC(n,a,o)};Object.assign(c.x,e),c.x.ticks.maxTicksLimit=15}else"linear"===s&&(c.x.type="linear",c.x.ticks.callback=e=>sr(e,{format:a,locale:o}));if(i&&i.length&&i.some(lt)&&(c[SS]={...c.x,display:!1},c[yS]={...c.x,display:!1},"category"===s||"time"===s)){const e=Math.max(...i.map((e=>e?.length||0)));c[SS].type="category",c[SS].labels=je(0,e).map((e=>e.toString())),c[SS].offset=!1,c[yS].type="category",c[yS].offset=!1}return c}function Iw(e,t){const o=ww(e,t);return{...o,x:{...o.x,grid:{display:!0}}}}function xw(e,t){const{locale:o,axisFormats:s}=t,i=s?.y||s?.y1;e.dataSets;const n={x:{...Ow(e,"bottom","labels",{locale:o}),grid:{display:!1}},y:{position:e.verticalAxisPosition,ticks:{color:_S(e.background),callback:VS({locale:o,format:i})},grid:{lineWidth:e=>0===e.tick.value?2:1},title:_w(e.axesDesign?.y)}},r=n?.y||n?.y1;return r&&(r.grid={lineWidth:e=>0===e.tick.value?2:1}),n}function Ew(e,t){const{dataSetsValues:o}=t,s=Cw(e,t),i=s.x.ticks.callback;s.x.ticks.callback=e=>i(Math.abs(e));const n=Math.max(...o.map((e=>Math.max(...e.data.map(Math.abs)))));return s.x.suggestedMin=-n,s.x.suggestedMax=n,s}function Rw(e,t){const{locale:o,axisFormats:s,dataSetsValues:i}=t,n=Math.min(...i.map((e=>Math.min(...e.data.filter((e=>!isNaN(e)))))));return{r:{beginAtZero:!0,ticks:{callback:VS({format:s?.r,locale:o}),backdropColor:e.background||"#FFFFFF"},pointLabels:{color:_S(e.background),callback:US},suggestedMin:n<0?n-1:0}}}function Tw(e,t){const{locale:o,axisFormats:s,availableRegions:i}=t,n=function(e){switch(e){case"top":return"top-left";case"right":return"top-right";case"bottom":return"bottom-right";case"left":case"none":return"bottom-left"}}(e.legendPosition),r=e.region?i.find((t=>t.id===e.region)):i[0],a=s?.y||s?.y1;return{projection:{projection:Dw(r?.defaultProjection||"mercator"),axis:"x"},color:{axis:"x",display:"none"!==e.legendPosition,border:{color:O},grid:{color:O},ticks:{color:_S(e.background),callback:VS({locale:o,format:a})},legend:{position:n,align:n.includes("right")?"left":"right",margin:Mw(e)},interpolate:Fw(e),missing:e.missingValueColor||"#ffffff"}}}function Aw(e,t){const o=t.dataSetsValues[0];return{x:{display:!1},y:{grid:{offset:!1},ticks:{callback:function(e){return US(this.getLabelForValue(e))}},border:{display:!1}},percentages:{position:"right",border:{display:!1},ticks:{callback:function(e,s,i){const n=o.data?.[s],r=o.data?.[0];return r&&void 0!==n?sr(n/r,{format:"0%",locale:t.locale}):""}},grid:{display:!1}}}}function Dw(e){return"conicConformal"===e?window.ChartGeo.geoConicConformal().rotate([100,0]):e}function _w(e){if(e?.title?.text){const{text:t,color:o,align:s,italic:i,bold:n}=e.title;return{display:!0,text:t,color:o,font:{style:i?"italic":"normal",weight:n?"bold":"normal",size:e.title.fontSize??J},align:"left"===s?"start":"right"===s?"end":"center"}}}function Ow(e,t,o,s){const{useLeftAxis:i,useRightAxis:n}=NS(e);if("left"===t&&!i||"right"===t&&!n)return;const r=_S(e.background);let a;if(a="bottom"===t?e.axesDesign?.x:"left"===t?e.axesDesign?.y:e.axesDesign?.y1,"values"===o){const e=!("right"===t&&i);return{position:t,title:_w(a),grid:{display:e},beginAtZero:!0,stacked:s?.stacked,ticks:{color:r,callback:VS(s)}}}return{ticks:{padding:5,color:r,callback:function(e){return US(this.getLabelForValue(e))}},grid:{display:!1},stacked:s?.stacked,title:_w(a)}}function Fw(e){if(!e.colorScale||"string"==typeof e.colorScale)return e.colorScale||"oranges";const t=[{value:0,color:e.colorScale.minColor}];return e.colorScale.midColor&&t.push({value:.5,color:e.colorScale.midColor}),t.push({value:1,color:e.colorScale.maxColor}),vo(t)}function Mw(e){switch(e.legendPosition){case"top":case"right":return{top:!!e.title.text?X+30:X,left:j,right:j};case"bottom":case"left":case"none":return{left:j,right:j,bottom:Y}}}const Pw={showValues:!1,showLabels:!0,valuesDesign:{align:"center",fontSize:13}};function Nw(e,t){const{axisFormats:o,locale:s}=t;return{horizontal:"horizontal"in e&&e.horizontal,showValues:"showValues"in e&&!!e.showValues,background:e.background,callback:(t,i)=>{const n=function(e,t){if(t.rAxisID)return t.rAxisID;const o="horizontal"in e&&e.horizontal?t.xAxisID:t.yAxisID;return o||"y"}(e,i);return kS(o,s)(t,n)}}}function kw(e,t){const{axisFormats:o,locale:s}=t;return{callback:kS(o,s),showLabels:e.showLabels??Pw.showLabels,showValues:e.showValues??Pw.showValues,style:{fontSize:e.valuesDesign?.fontSize??Pw.valuesDesign.fontSize,align:e.valuesDesign?.align??Pw.valuesDesign.align,bold:e.valuesDesign?.bold??Pw.valuesDesign.bold,italic:e.valuesDesign?.italic??Pw.valuesDesign.italic,textColor:e.valuesDesign?.color??Pw.valuesDesign.color}}}function Vw(e,t){const{axisFormats:o,locale:s}=t;return{horizontal:!0,showValues:"showValues"in e&&!!e.showValues,background:e.background,callback:(e,t)=>0===(e=Math.abs(Number(e)))?"":kS(o,s)(e,t.xAxisID||"x")}}function Lw(e,t){const{axisFormats:o,locale:s,dataSetsValues:i}=t,n=i.reduce(((e,t)=>(e.push((e.at(-1)||-1)+t.data.length+1),e)),[]);return{showValues:"showValues"in e&&!!e.showValues,background:e.background,callback:(t,i,r)=>{const a=i._dataset.data[r],l=a[1]-a[0];let c=l>=0?"+":"";return e.showSubTotals&&n.includes(r)&&"+"===c&&(c=""),`${c}${kS(o,s)(l,i.yAxisID)}`}}}function Hw(e){const t=e.title,o=OS(e.background);return{display:!!t.text,text:ni(t.text),color:t?.color??o,align:"center"===t.align?"center":"right"===t.align?"end":"start",font:{size:e.title.fontSize??K,weight:t.bold?"bold":"normal",style:t.italic?"italic":"normal"},padding:{bottom:"top"===e.legendPosition?0:j}}}const Uw='\n<templates>\n <t t-name="o-spreadsheet-CustomTooltip">\n <div\n class="o-chart-custom-tooltip border rounded px-2 py-1 pe-none mw-100 position-absolute text-nowrap shadow opacity-100">\n <table class="overflow-hidden m-0">\n <thead t-if="title">\n <tr>\n <th class="o-tooltip-title align-baseline border-0 text-truncate" t-esc="title" t-attf-style="max-width: {{ labelsMaxWidth }}"/>\n </tr>\n </thead>\n <tbody>\n <tr t-foreach="tooltipItems" t-as="tooltipItem" t-key="tooltipItem_index">\n <td>\n <span\n class="badge ps-2 py-2 rounded-0 align-middle"\n t-attf-style="background-color: {{ tooltipItem.boxColor }}"\n > </span>\n <small\n t-if="tooltipItem.label"\n class="o-tooltip-label d-inline-block text-truncate align-middle smaller ms-2"\n t-esc="tooltipItem.label"\n t-attf-style="max-width: {{ labelsMaxWidth }}"\n />\n </td>\n <td class="o-tooltip-value ps-2 fw-bolder text-end">\n <small class="smaller d-inline-block text-truncate align-middle" t-attf-style="max-width: {{ valuesMaxWidth }}">\n <t t-esc="tooltipItem.value"/>\n <t t-if="tooltipItem.percentage">\n (\n <t t-esc="tooltipItem.percentage"/>\n %)\n </t>\n </small>\n </td>\n </tr>\n </tbody>\n </table>\n </div>\n </t>\n</templates>\n';let Bw;function zw(e,o={}){return function(e,o={}){Bw||(Bw=new t.App(t.Component,{templates:Uw,translateFn:ni}));const s=Bw.getTemplate(e),i=s(o,{}),n=document.createElement("div");return t.blockDom.mount(i,n),n}(e,o).innerHTML}function $w(e,t){return{enabled:!1,external:Qw,callbacks:{title:function(e){return e.some((e=>!BS(e.dataset.xAxisID)))?void 0:""},beforeLabel:e=>e.dataset?.label||e.label,label:function(o){const s=e.horizontal;let i=s?o.parsed.x:o.parsed.y;null==i&&(i=o.parsed);const n=s?o.dataset.xAxisID:o.dataset.yAxisID;return kS(t.axisFormats,t.locale)(i,n)}}}}function Gw(e,t){const{axisType:o,locale:s,axisFormats:i}=t,n=i?.x,r={enabled:!1,external:Qw,callbacks:{}};return r.callbacks.label="linear"===o?e=>{const t=e.parsed.y;let o=BS(e.dataset.xAxisID)?"":e.parsed.x;"string"==typeof o&&Xs(o,s)&&(o=zi(o,s));const r=sr(o,{locale:s,format:n}),a=e.dataset.yAxisID||"y",l=sr(t,{locale:s,format:i?.[a]});return r?`(${r}, ${l})`:`${l}`}:function(e){const t=e.parsed.y,o=e.dataset.yAxisID;return kS(i,s)(t,o)},r.callbacks.beforeLabel=e=>e.dataset?.label||e.label,r.callbacks.title=function(e){return"linear"!==o&&e.some((e=>!BS(e.dataset.xAxisID)))?void 0:""},r}function Ww(e,t){const{locale:o,axisFormats:s}=t,i=s?.y||s?.y1;return{enabled:!1,external:Qw,callbacks:{title:function(e){return e[0].dataset.label},beforeLabel:e=>e.label||e.dataset.label,label:function(e){const t=function(e,t){const o=e.filter((e=>"number"==typeof e)).reduce(((e,t)=>e+t),0);if(!o)return"";const s=e[t]/o*100;return s.toFixed(2)}(e.dataset.data,e.dataIndex),s=e.parsed.y??e.parsed;return`${sr(s,{format:!i&&s>=1e3?"#,##":i,locale:o})} (${t}%)`}}}}function qw(e,t){const{dataSetsValues:o,locale:s,axisFormats:i,labels:n}=t,r=i?.y||i?.y1,a=o.map((e=>e.label));return{enabled:!1,external:Qw,callbacks:{beforeLabel:function(e){const t=n.length?Math.floor(e.dataIndex/n.length):0;return a[t]},label:function(e){const[t,o]=e.raw,i=o-t;return sr(i,{format:!r&&Math.abs(i)>1e3?"#,##":r,locale:s})}}}}function Zw(e,t){const o=$w(e,t);return{...o,callbacks:{...o.callbacks,label:e=>{const t={...e,parsed:{y:e.parsed.y,x:Math.abs(e.parsed.x)}};return(o?.callbacks?.label)(t)}}}}function jw(e,t){const{locale:o,axisFormats:s}=t;return{enabled:!1,external:Qw,callbacks:{beforeLabel:e=>e.dataset?.label||e.label,label:function(e){return sr(e.parsed.r,{format:s?.r,locale:o})}}}}function Yw(e,t){const{locale:o,axisFormats:s}=t,i=s?.y||s?.y1;return{enabled:!1,external:Qw,filter:function(e){return void 0!==e.raw.value},callbacks:{beforeLabel:e=>e.raw.feature.properties.name,label:function(e){const t=e.raw.value;return sr(t,{format:!i&&Math.abs(t)>=1e3?"#,##":i,locale:o})}}}}function Xw(e,t){return{enabled:!1,external:Qw,position:"funnelTooltipPositioner",callbacks:{title:()=>"",beforeLabel:e=>e.label,label:function(e){const o=e.parsed.x,s=e.dataset.xAxisID;return kS(t.axisFormats,t.locale)(o,s)}}}}function Kw(e,t){const{locale:o,axisFormats:s}=t,i=s?.y||s?.y1;return{enabled:!1,external:Qw,filter:function(e){const t=e.raw;return t?.label!==qS},callbacks:{title:()=>"",beforeLabel:e=>e.raw.groups.join(" / "),label:function(e){const t=e.raw.value;return sr(t,{format:!i&&t>=1e3?"#,##":i,locale:o})}}}}function Jw(e,t){const{locale:o,axisFormats:s}=t,i=s?.y;return{enabled:!1,external:Qw,filter:(e,t,o)=>t===o.length-1,callbacks:{title:()=>"",beforeLabel:e=>{const t=e.raw._data.children[0];if(!t)return"";const o=[];for(let s=0;s<=e.raw.l;s++)o.push(t[s]);return o.join(" / ")},label:e=>{const t=e.raw.v;return sr(t,{format:!i&&t>=1e3?"#,##":i,locale:o})}}}}function Qw({chart:e,tooltip:t}){if(e.canvas.parentNode.querySelector("div.o-chart-custom-tooltip")?.remove(),0===t.opacity||0===t.dataPoints.length)return;const o=t.body.map(((e,o)=>{let s=e.before[0],i=e.lines[0];i||(i=s,s="");const n=t.labelColors[o].backgroundColor;return{label:s,value:i,boxColor:"string"==typeof n?oo(n,1):n}})),s=zw("o-spreadsheet-CustomTooltip",{labelsMaxWidth:Math.floor(.5*e.canvas.clientWidth)+"px",valuesMaxWidth:Math.floor(.25*e.canvas.clientWidth)+"px",title:t.title[0],tooltipItems:o}),i=Object.assign(document.createElement("template"),{innerHTML:s}).content.firstChild;e.canvas.parentNode?.appendChild(i),Object.assign(i.style,{left:eI(e,t,i.clientWidth)+"px",top:Math.floor(t.caretY-i.clientHeight/2)+"px"})}function eI(e,t,o){const s=t.caretX;return s+o>e.chartArea.right?Math.max(0,s-o):s}var tI=Object.freeze({__proto__:null,GHOST_SUNBURST_VALUE:qS,INTERACTIVE_LEGEND_CONFIG:Sw,canChartParseLabels:KC,getBarChartData:UC,getBarChartDatasets:ZS,getBarChartLegend:dw,getBarChartScales:Cw,getBarChartTooltip:$w,getChartColorsGenerator:dy,getChartLabelFormat:iw,getChartLayout:cw,getChartShowValues:Nw,getChartTitle:Hw,getComboChartDatasets:JS,getComboChartLegend:mw,getData:tw,getFunnelChartData:qC,getFunnelChartDatasets:ty,getFunnelChartScales:Aw,getFunnelChartTooltip:Xw,getFunnelLabelColors:oy,getGeoChartData:WC,getGeoChartDatasets:ey,getGeoChartScales:Tw,getGeoChartTooltip:Yw,getHierarchalChartData:ZC,getLineChartData:zC,getLineChartDatasets:YS,getLineChartLegend:uw,getLineChartScales:ww,getLineChartTooltip:Gw,getPieChartData:$C,getPieChartDatasets:KS,getPieChartLegend:gw,getPieChartTooltip:Ww,getPyramidChartData:BC,getPyramidChartScales:Ew,getPyramidChartShowValues:Vw,getPyramidChartTooltip:Zw,getRadarChartData:GC,getRadarChartDatasets:QS,getRadarChartLegend:vw,getRadarChartScales:Rw,getRadarChartTooltip:jw,getScatterChartDatasets:XS,getScatterChartLegend:pw,getScatterChartScales:Iw,getSunburstChartDatasets:sy,getSunburstChartLegend:bw,getSunburstChartTooltip:Kw,getSunburstShowValues:kw,getTreeMapChartDatasets:ay,getTreeMapChartTooltip:Jw,getTrendDatasetForBarChart:jC,getTrendDatasetForLineChart:YC,getWaterfallChartLegend:fw,getWaterfallChartScales:xw,getWaterfallChartShowValues:Lw,getWaterfallChartTooltip:qw,getWaterfallDatasetAndLabels:jS,makeDatasetsCumulative:lw});class oI extends Sy{dataSets;labelRange;background;legendPosition;stacked;aggregated;type="bar";dataSetsHaveTitle;dataSetDesign;axesDesign;horizontal;showValues;constructor(e,t,o){super(e,t,o),this.dataSets=ES(o,e.dataSets,t,e.dataSetsHaveTitle),this.labelRange=ga(o,t,e.labelRange),this.background=e.background,this.legendPosition=e.legendPosition,this.stacked=e.stacked,this.aggregated=e.aggregated,this.dataSetsHaveTitle=e.dataSetsHaveTitle,this.dataSetDesign=e.dataSets,this.axesDesign=e.axesDesign,this.horizontal=e.horizontal,this.showValues=e.showValues}static transformDefinition(e,t,o){return DS(e,t,o)}static validateChartDefinition(e,t){return e.checkValidations(t,FS,MS)}static getDefinitionFromContextCreation(e){return{background:e.background,dataSets:e.range??[],dataSetsHaveTitle:e.dataSetsHaveTitle??!1,stacked:e.stacked??!1,aggregated:e.aggregated??!1,legendPosition:e.legendPosition??"top",title:e.title||{text:""},type:"bar",labelRange:e.auxiliaryRange||void 0,axesDesign:e.axesDesign,showValues:e.showValues}}getContextCreation(){const e=[];for(const[t,o]of this.dataSets.entries())e.push({...this.dataSetDesign?.[t],dataRange:this.getters.getRangeString(o.dataRange,this.sheetId)});return{...this,range:e,auxiliaryRange:this.labelRange?this.getters.getRangeString(this.labelRange,this.sheetId):void 0}}duplicateInDuplicatedSheet(e){const t=wS(this.sheetId,e,this.dataSets),o=IS(this.sheetId,e,this.labelRange),s=this.getDefinitionWithSpecificDataSets(t,o,e);return new oI(s,e,this.getters)}copyInSheetId(e){const t=this.getDefinitionWithSpecificDataSets(this.dataSets,this.labelRange,e);return new oI(t,e,this.getters)}getDefinition(){return this.getDefinitionWithSpecificDataSets(this.dataSets,this.labelRange)}getDefinitionWithSpecificDataSets(e,t,o){const s=[];for(const[t,i]of e.entries())s.push({...this.dataSetDesign?.[t],dataRange:this.getters.getRangeString(i.dataRange,o||this.sheetId)});return{type:"bar",dataSetsHaveTitle:!!e.length&&Boolean(e[0].labelCell),background:this.background,dataSets:s,legendPosition:this.legendPosition,labelRange:t?this.getters.getRangeString(t,o||this.sheetId):void 0,title:this.title,stacked:this.stacked,aggregated:this.aggregated,axesDesign:this.axesDesign,horizontal:this.horizontal,showValues:this.showValues}}getDefinitionForExcel(){const e=this.dataSets.map((e=>TS(this.getters,e))).filter((e=>""!==e.range&&e.range!==Ti.InvalidReference)),t=AS(this.getters,this.labelRange,PS(this.labelRange,this.dataSets[0],this.dataSetsHaveTitle)),o=this.getDefinition();return{...o,backgroundColor:CC(this.background||m),fontColor:CC(_S(this.background)),dataSets:e,labelRange:t,verticalAxis:NS(o)}}updateRanges(e){const{dataSets:t,labelRange:o,isStale:s}=CS(this.getters,e,this.dataSets,this.labelRange);if(!s)return this;const i=this.getDefinitionWithSpecificDataSets(t,o);return new oI(i,this.sheetId,this.getters)}}function sI(e,t){const o=e.getDefinition(),s=UC(o,e.dataSets,e.labelRange,t);return{chartJsConfig:{type:"bar",data:{labels:s.labels,datasets:ZS(o,s)},options:{...wC,indexAxis:e.horizontal?"y":"x",layout:cw(),scales:Cw(o,s),plugins:{title:Hw(o),legend:dw(o),tooltip:$w(o,s),chartShowValuesPlugin:Nw(o,s)}}},background:e.background||m}}class iI extends Sy{dataSets;labelRange;background;legendPosition;aggregated;dataSetsHaveTitle;dataSetDesign;axesDesign;type="combo";showValues;constructor(e,t,o){super(e,t,o),this.dataSets=ES(o,e.dataSets,t,e.dataSetsHaveTitle),this.labelRange=ga(o,t,e.labelRange),this.background=e.background,this.legendPosition=e.legendPosition,this.aggregated=e.aggregated,this.dataSetsHaveTitle=e.dataSetsHaveTitle,this.dataSetDesign=e.dataSets,this.axesDesign=e.axesDesign,this.showValues=e.showValues}static transformDefinition(e,t,o){return DS(e,t,o)}static validateChartDefinition(e,t){return e.checkValidations(t,FS,MS)}getContextCreation(){const e=[];for(const[t,o]of this.dataSets.entries())e.push({...this.dataSetDesign?.[t],dataRange:this.getters.getRangeString(o.dataRange,this.sheetId)});return{...this,range:e,auxiliaryRange:this.labelRange?this.getters.getRangeString(this.labelRange,this.sheetId):void 0}}getDefinition(){return this.getDefinitionWithSpecificDataSets(this.dataSets,this.labelRange)}getDefinitionWithSpecificDataSets(e,t,o){const s=[];for(const[t,i]of e.entries())s.push({...this.dataSetDesign?.[t],dataRange:this.getters.getRangeString(i.dataRange,o||this.sheetId),type:this.dataSetDesign?.[t]?.type??(t?"line":"bar")});return{type:"combo",dataSetsHaveTitle:!!e.length&&Boolean(e[0].labelCell),background:this.background,dataSets:s,legendPosition:this.legendPosition,labelRange:t?this.getters.getRangeString(t,o||this.sheetId):void 0,title:this.title,aggregated:this.aggregated,axesDesign:this.axesDesign,showValues:this.showValues}}getDefinitionForExcel(){if(this.aggregated)return;const e=this.dataSets.map((e=>TS(this.getters,e))).filter((e=>""!==e.range&&e.range!==Ti.InvalidReference)),t=AS(this.getters,this.labelRange,PS(this.labelRange,this.dataSets[0],this.dataSetsHaveTitle)),o=this.getDefinition();return{...o,backgroundColor:CC(this.background||m),fontColor:CC(_S(this.background)),dataSets:e,labelRange:t,verticalAxis:NS(o)}}updateRanges(e){const{dataSets:t,labelRange:o,isStale:s}=CS(this.getters,e,this.dataSets,this.labelRange);if(!s)return this;const i=this.getDefinitionWithSpecificDataSets(t,o);return new iI(i,this.sheetId,this.getters)}static getDefinitionFromContextCreation(e){const t=(e.range??[]).map(((e,t)=>({...e,type:t?"line":"bar"})));return{background:e.background,dataSets:t,dataSetsHaveTitle:e.dataSetsHaveTitle??!1,aggregated:e.aggregated,legendPosition:e.legendPosition??"top",title:e.title||{text:""},labelRange:e.auxiliaryRange||void 0,type:"combo",axesDesign:e.axesDesign,showValues:e.showValues}}duplicateInDuplicatedSheet(e){const t=wS(this.sheetId,e,this.dataSets),o=IS(this.sheetId,e,this.labelRange),s=this.getDefinitionWithSpecificDataSets(t,o,e);return new iI(s,e,this.getters)}copyInSheetId(e){const t=this.getDefinitionWithSpecificDataSets(this.dataSets,this.labelRange,e);return new iI(t,e,this.getters)}}class nI extends Sy{dataSets;labelRange;background;legendPosition;aggregated;type="funnel";dataSetsHaveTitle;dataSetDesign;axesDesign;horizontal=!0;showValues;funnelColors;cumulative;constructor(e,t,o){super(e,t,o),this.dataSets=ES(o,e.dataSets,t,e.dataSetsHaveTitle),this.labelRange=ga(o,t,e.labelRange),this.background=e.background,this.legendPosition=e.legendPosition,this.aggregated=e.aggregated,this.dataSetsHaveTitle=e.dataSetsHaveTitle,this.dataSetDesign=e.dataSets,this.axesDesign=e.axesDesign,this.showValues=e.showValues,this.horizontal=!0,this.funnelColors=e.funnelColors,this.cumulative=e.cumulative}static transformDefinition(e,t,o){return DS(e,t,o)}static validateChartDefinition(e,t){return e.checkValidations(t,FS,MS)}static getDefinitionFromContextCreation(e){return{background:e.background,dataSets:e.range??[],dataSetsHaveTitle:e.dataSetsHaveTitle??!1,aggregated:e.aggregated??!1,legendPosition:"none",title:e.title||{text:""},type:"funnel",labelRange:e.auxiliaryRange||void 0,showValues:e.showValues,axesDesign:e.axesDesign,funnelColors:e.funnelColors,horizontal:!0,cumulative:e.cumulative}}getContextCreation(){const e=[];for(const[t,o]of this.dataSets.entries())e.push({...this.dataSetDesign?.[t],dataRange:this.getters.getRangeString(o.dataRange,this.sheetId)});return{...this,range:e,auxiliaryRange:this.labelRange?this.getters.getRangeString(this.labelRange,this.sheetId):void 0}}duplicateInDuplicatedSheet(e){const t=wS(this.sheetId,e,this.dataSets),o=IS(this.sheetId,e,this.labelRange),s=this.getDefinitionWithSpecificDataSets(t,o,e);return new nI(s,e,this.getters)}copyInSheetId(e){const t=this.getDefinitionWithSpecificDataSets(this.dataSets,this.labelRange,e);return new nI(t,e,this.getters)}getDefinition(){return this.getDefinitionWithSpecificDataSets(this.dataSets,this.labelRange)}getDefinitionWithSpecificDataSets(e,t,o){const s=[];for(const[t,i]of e.entries())s.push({...this.dataSetDesign?.[t],dataRange:this.getters.getRangeString(i.dataRange,o||this.sheetId)});return{type:"funnel",dataSetsHaveTitle:!!e.length&&Boolean(e[0].labelCell),background:this.background,dataSets:s,legendPosition:this.legendPosition,labelRange:t?this.getters.getRangeString(t,o||this.sheetId):void 0,title:this.title,aggregated:this.aggregated,horizontal:this.horizontal,axesDesign:this.axesDesign,showValues:this.showValues,funnelColors:this.funnelColors,cumulative:this.cumulative}}getDefinitionForExcel(){}updateRanges(e){const{dataSets:t,labelRange:o,isStale:s}=CS(this.getters,e,this.dataSets,this.labelRange);if(!s)return this;const i=this.getDefinitionWithSpecificDataSets(t,o);return new nI(i,this.sheetId,this.getters)}}function rI(e){return e.dataRange&&!Zr.test(e.dataRange)?"InvalidGaugeDataRange":"Success"}function aI(e,t){return t((t=>t.sectionRule?e(t.sectionRule.rangeMin,"rangeMin"):"Success"),(t=>t.sectionRule?e(t.sectionRule.rangeMax,"rangeMax"):"Success"))}function lI(e,t){if(""===e)switch(t){case"rangeMin":return"EmptyGaugeRangeMin";case"rangeMax":return"EmptyGaugeRangeMax"}return"Success"}function cI(e,t){if(e.startsWith("="))return"Success";if(isNaN(e))switch(t){case"rangeMin":return"GaugeRangeMinNaN";case"rangeMax":return"GaugeRangeMaxNaN";case"lowerInflectionPointValue":return"GaugeLowerInflectionPointNaN";case"upperInflectionPointValue":return"GaugeUpperInflectionPointNaN"}return"Success"}class hI extends Sy{dataRange;sectionRule;background;type="gauge";constructor(e,t,o){super(e,t,o),this.dataRange=ga(this.getters,this.sheetId,e.dataRange),this.sectionRule=e.sectionRule,this.background=e.background}static validateChartDefinition(e,t){return e.checkValidations(t,rI,e.chainValidations(aI(lI,e.batchValidations),aI(cI,e.batchValidations)),e.chainValidations((o=cI,(0,e.batchValidations)((e=>e.sectionRule?o(e.sectionRule.lowerInflectionPoint.value,"lowerInflectionPointValue"):"Success"),(e=>e.sectionRule?o(e.sectionRule.upperInflectionPoint.value,"upperInflectionPointValue"):"Success")))));var o}static transformDefinition(e,t,o){let s;if(t.dataRange){const i=vS(e,t.dataRange,o);i!==Ti.InvalidReference&&(s=i)}return{...t,dataRange:s}}static getDefinitionFromContextCreation(e){return{background:e.background,title:e.title||{text:""},type:"gauge",dataRange:e.range?e.range[0].dataRange:void 0,sectionRule:{colors:{lowerColor:"#EA6175",middleColor:"#FFD86D",upperColor:"#43C5B1"},rangeMin:"0",rangeMax:"100",lowerInflectionPoint:{type:"percentage",value:"15",operator:"<="},upperInflectionPoint:{type:"percentage",value:"40",operator:"<="}}}}duplicateInDuplicatedSheet(e){const t=IS(this.sheetId,e,this.dataRange),o=pI(this.sectionRule,(t=>this.getters.copyFormulaStringForSheet(this.sheetId,e,t,"moveReference"))),s=this.getDefinitionWithSpecificRanges(t,o,e);return new hI(s,e,this.getters)}copyInSheetId(e){const t=pI(this.sectionRule,(t=>this.getters.copyFormulaStringForSheet(this.sheetId,e,t,"keepSameReference"))),o=this.getDefinitionWithSpecificRanges(this.dataRange,t,e);return new hI(o,e,this.getters)}getDefinition(){return this.getDefinitionWithSpecificRanges(this.dataRange,this.sectionRule)}getDefinitionWithSpecificRanges(e,t,o){return{background:this.background,sectionRule:t,title:this.title,type:"gauge",dataRange:e?this.getters.getRangeString(e,o||this.sheetId):void 0}}getDefinitionForExcel(){}getContextCreation(){return{...this,range:this.dataRange?[{dataRange:this.getters.getRangeString(this.dataRange,this.sheetId)}]:void 0}}updateRanges(e){const t=xS(this.dataRange,e),o=pI(this.sectionRule,(t=>this.getters.adaptFormulaStringDependencies(this.sheetId,t,e))),s=this.getDefinitionWithSpecificRanges(t,o);return new hI(s,this.sheetId,this.getters)}}function dI(e,t){const o=t.getLocale(),s=e.sectionRule.colors;let i,n,r;const a=e.dataRange;if(void 0!==a){const e=t.getEvaluatedCell({sheetId:a.sheetId,col:a.zone.left,row:a.zone.top});e.type===ai.number&&(i=e.value,n=e.formattedValue,r=e.format)}let l=gI(e.sheetId,e.sectionRule.rangeMin,t),c=gI(e.sheetId,e.sectionRule.rangeMax,t);if(void 0===l||void 0===c)return function(e,t){return{background:t.getStyleOfSingleCellChart(e.background,e.dataRange).background,title:e.title??{text:""},minValue:{value:0,label:""},maxValue:{value:100,label:""},gaugeValue:{value:0,label:Ti.GenericError},inflectionValues:[],colors:[]}}(e,t);c<l&&([l,c]=[c,l]);const h=e.sectionRule.lowerInflectionPoint,d=e.sectionRule.upperInflectionPoint,u=uI(e.sheetId,e.sectionRule.lowerInflectionPoint,l,c,t),g=uI(e.sheetId,e.sectionRule.upperInflectionPoint,l,c,t),p=[],m=[];return void 0!==u&&(p.push({value:u,label:sr(u,{locale:o,format:r}),operator:h.operator}),m.push(s.lowerColor)),void 0!==g&&g!==u&&(p.push({value:g,label:sr(g,{locale:o,format:r}),operator:d.operator}),m.push(s.middleColor)),void 0!==g&&void 0!==u&&u>g&&(p.reverse(),m.reverse()),m.push(s.upperColor),{background:t.getStyleOfSingleCellChart(e.background,a).background,title:{...e.title,text:ni(e.title.text??"")},minValue:{value:l,label:sr(l,{locale:o,format:r})},maxValue:{value:c,label:sr(c,{locale:o,format:r})},gaugeValue:void 0!==i&&n?{value:i,label:n}:void 0,inflectionValues:p,colors:m}}function uI(e,t,o,s,i){const n=gI(e,t.value,i);if(void 0===n)return;return Ze("number"===t.type?n:o+(s-o)*n/100,o,s)}function gI(e,t,o){const s=o.evaluateFormula(e,t);return Ii(s)?void 0:$i(s,o.getLocale())}function pI(e,t){return{...e,rangeMin:t(e.rangeMin),rangeMax:t(e.rangeMax),lowerInflectionPoint:{...e.lowerInflectionPoint,value:t(e.lowerInflectionPoint.value)},upperInflectionPoint:{...e.upperInflectionPoint,value:t(e.upperInflectionPoint.value)}}}class mI extends Sy{dataSets;labelRange;background;legendPosition;type="geo";dataSetsHaveTitle;dataSetDesign;colorScale;missingValueColor;region;constructor(e,t,o){super(e,t,o),this.dataSets=ES(o,e.dataSets,t,e.dataSetsHaveTitle),this.labelRange=ga(o,t,e.labelRange),this.background=e.background,this.legendPosition=e.legendPosition,this.dataSetsHaveTitle=e.dataSetsHaveTitle,this.dataSetDesign=e.dataSets,this.colorScale=e.colorScale,this.missingValueColor=e.missingValueColor,this.region=e.region}static transformDefinition(e,t,o){return DS(e,t,o)}static validateChartDefinition(e,t){return e.checkValidations(t,FS,MS)}static getDefinitionFromContextCreation(e){return{background:e.background,dataSets:e.range??[],dataSetsHaveTitle:e.dataSetsHaveTitle??!1,legendPosition:e.legendPosition??"top",title:e.title||{text:""},type:"geo",labelRange:e.auxiliaryRange||void 0}}getContextCreation(){const e=[];for(const[t,o]of this.dataSets.entries())e.push({...this.dataSetDesign?.[t],dataRange:this.getters.getRangeString(o.dataRange,this.sheetId)});return{...this,range:e,auxiliaryRange:this.labelRange?this.getters.getRangeString(this.labelRange,this.sheetId):void 0}}duplicateInDuplicatedSheet(e){const t=wS(this.sheetId,e,this.dataSets),o=IS(this.sheetId,e,this.labelRange),s=this.getDefinitionWithSpecificDataSets(t,o,e);return new mI(s,e,this.getters)}copyInSheetId(e){const t=this.getDefinitionWithSpecificDataSets(this.dataSets,this.labelRange,e);return new mI(t,e,this.getters)}getDefinition(){return this.getDefinitionWithSpecificDataSets(this.dataSets,this.labelRange)}getDefinitionWithSpecificDataSets(e,t,o){const s=[];for(const[t,i]of e.entries())s.push({...this.dataSetDesign?.[t],dataRange:this.getters.getRangeString(i.dataRange,o||this.sheetId)});return{type:"geo",dataSetsHaveTitle:!!e.length&&Boolean(e[0].labelCell),background:this.background,dataSets:s,legendPosition:this.legendPosition,labelRange:t?this.getters.getRangeString(t,o||this.sheetId):void 0,title:this.title,colorScale:this.colorScale,missingValueColor:this.missingValueColor,region:this.region}}getDefinitionForExcel(){}updateRanges(e){const{dataSets:t,labelRange:o,isStale:s}=CS(this.getters,e,this.dataSets,this.labelRange);if(!s)return this;const i=this.getDefinitionWithSpecificDataSets(t,o);return new mI(i,this.sheetId,this.getters)}}class fI extends Sy{dataSets;labelRange;background;legendPosition;labelsAsText;stacked;aggregated;type="line";dataSetsHaveTitle;cumulative;dataSetDesign;axesDesign;fillArea;showValues;constructor(e,t,o){super(e,t,o),this.dataSets=ES(this.getters,e.dataSets,t,e.dataSetsHaveTitle),this.labelRange=ga(this.getters,t,e.labelRange),this.background=e.background,this.legendPosition=e.legendPosition,this.labelsAsText=e.labelsAsText,this.stacked=e.stacked,this.aggregated=e.aggregated,this.dataSetsHaveTitle=e.dataSetsHaveTitle,this.cumulative=e.cumulative,this.dataSetDesign=e.dataSets,this.axesDesign=e.axesDesign,this.fillArea=e.fillArea,this.showValues=e.showValues}static validateChartDefinition(e,t){return e.checkValidations(t,FS,MS)}static transformDefinition(e,t,o){return DS(e,t,o)}static getDefinitionFromContextCreation(e){return{background:e.background,dataSets:e.range??[],dataSetsHaveTitle:e.dataSetsHaveTitle??!1,labelsAsText:e.labelsAsText??!1,legendPosition:e.legendPosition??"top",title:e.title||{text:""},type:"line",labelRange:e.auxiliaryRange||void 0,stacked:e.stacked??!1,aggregated:e.aggregated??!1,cumulative:e.cumulative??!1,axesDesign:e.axesDesign,fillArea:e.fillArea,showValues:e.showValues}}getDefinition(){return this.getDefinitionWithSpecificDataSets(this.dataSets,this.labelRange)}getDefinitionWithSpecificDataSets(e,t,o){const s=[];for(const[t,i]of e.entries())s.push({...this.dataSetDesign?.[t],dataRange:this.getters.getRangeString(i.dataRange,o||this.sheetId)});return{type:"line",dataSetsHaveTitle:!!e.length&&Boolean(e[0].labelCell),background:this.background,dataSets:s,legendPosition:this.legendPosition,labelRange:t?this.getters.getRangeString(t,o||this.sheetId):void 0,title:this.title,labelsAsText:this.labelsAsText,stacked:this.stacked,aggregated:this.aggregated,cumulative:this.cumulative,axesDesign:this.axesDesign,fillArea:this.fillArea,showValues:this.showValues}}getContextCreation(){const e=[];for(const[t,o]of this.dataSets.entries())e.push({...this.dataSetDesign?.[t],dataRange:this.getters.getRangeString(o.dataRange,this.sheetId)});return{...this,range:e,auxiliaryRange:this.labelRange?this.getters.getRangeString(this.labelRange,this.sheetId):void 0}}updateRanges(e){const{dataSets:t,labelRange:o,isStale:s}=CS(this.getters,e,this.dataSets,this.labelRange);if(!s)return this;const i=this.getDefinitionWithSpecificDataSets(t,o);return new fI(i,this.sheetId,this.getters)}getDefinitionForExcel(){const e=this.dataSets.map((e=>TS(this.getters,e))).filter((e=>""!==e.range&&e.range!==Ti.InvalidReference)),t=AS(this.getters,this.labelRange,PS(this.labelRange,this.dataSets[0],this.dataSetsHaveTitle)),o=this.getDefinition();return{...o,backgroundColor:CC(this.background||m),fontColor:CC(_S(this.background)),dataSets:e,labelRange:t,verticalAxis:NS(o)}}duplicateInDuplicatedSheet(e){const t=wS(this.sheetId,e,this.dataSets),o=IS(this.sheetId,e,this.labelRange),s=this.getDefinitionWithSpecificDataSets(t,o,e);return new fI(s,e,this.getters)}copyInSheetId(e){const t=this.getDefinitionWithSpecificDataSets(this.dataSets,this.labelRange,e);return new fI(t,e,this.getters)}}function vI(e,t){const o=e.getDefinition(),s=zC(o,e.dataSets,e.labelRange,t);return{chartJsConfig:{type:"line",data:{labels:s.labels,datasets:YS(o,s)},options:{...wC,layout:cw(),scales:ww(o,s),plugins:{title:Hw(o),legend:uw(o),tooltip:Gw(0,s),chartShowValuesPlugin:Nw(o,s)}}},background:e.background||m}}class bI extends Sy{dataSets;labelRange;background;legendPosition;type="pie";aggregated;dataSetsHaveTitle;isDoughnut;showValues;constructor(e,t,o){super(e,t,o),this.dataSets=ES(o,e.dataSets,t,e.dataSetsHaveTitle),this.labelRange=ga(o,t,e.labelRange),this.background=e.background,this.legendPosition=e.legendPosition,this.aggregated=e.aggregated,this.dataSetsHaveTitle=e.dataSetsHaveTitle,this.isDoughnut=e.isDoughnut,this.showValues=e.showValues}static transformDefinition(e,t,o){return DS(e,t,o)}static validateChartDefinition(e,t){return e.checkValidations(t,FS,MS)}static getDefinitionFromContextCreation(e){return{background:e.background,dataSets:e.range??[],dataSetsHaveTitle:e.dataSetsHaveTitle??!1,legendPosition:e.legendPosition??"top",title:e.title||{text:""},type:"pie",labelRange:e.auxiliaryRange||void 0,aggregated:e.aggregated??!1,isDoughnut:!1,showValues:e.showValues}}getDefinition(){return this.getDefinitionWithSpecificDataSets(this.dataSets,this.labelRange)}getContextCreation(){return{...this,range:this.dataSets.map((e=>({dataRange:this.getters.getRangeString(e.dataRange,this.sheetId)}))),auxiliaryRange:this.labelRange?this.getters.getRangeString(this.labelRange,this.sheetId):void 0}}getDefinitionWithSpecificDataSets(e,t,o){return{type:"pie",dataSetsHaveTitle:!!e.length&&Boolean(e[0].labelCell),background:this.background,dataSets:e.map((e=>({dataRange:this.getters.getRangeString(e.dataRange,o||this.sheetId)}))),legendPosition:this.legendPosition,labelRange:t?this.getters.getRangeString(t,o||this.sheetId):void 0,title:this.title,aggregated:this.aggregated,isDoughnut:this.isDoughnut,showValues:this.showValues}}duplicateInDuplicatedSheet(e){const t=wS(this.sheetId,e,this.dataSets),o=IS(this.sheetId,e,this.labelRange),s=this.getDefinitionWithSpecificDataSets(t,o,e);return new bI(s,e,this.getters)}copyInSheetId(e){const t=this.getDefinitionWithSpecificDataSets(this.dataSets,this.labelRange,e);return new bI(t,e,this.getters)}getDefinitionForExcel(){const e=this.dataSets.map((e=>TS(this.getters,e))).filter((e=>""!==e.range&&e.range!==Ti.InvalidReference)),t=AS(this.getters,this.labelRange,PS(this.labelRange,this.dataSets[0],this.dataSetsHaveTitle));return{...this.getDefinition(),backgroundColor:CC(this.background||m),fontColor:CC(_S(this.background)),dataSets:e,labelRange:t}}updateRanges(e){const{dataSets:t,labelRange:o,isStale:s}=CS(this.getters,e,this.dataSets,this.labelRange);if(!s)return this;const i=this.getDefinitionWithSpecificDataSets(t,o);return new bI(i,this.sheetId,this.getters)}}function SI(e,t){const o=e.getDefinition(),s=$C(o,e.dataSets,e.labelRange,t);return{chartJsConfig:{type:e.isDoughnut?"doughnut":"pie",data:{labels:s.labels,datasets:KS(o,s)},options:{...wC,layout:cw(),plugins:{title:Hw(o),legend:gw(o,s),tooltip:Ww(0,s),chartShowValuesPlugin:Nw(o,s)}}},background:e.background||m}}class yI extends Sy{dataSets;labelRange;background;legendPosition;aggregated;type="pyramid";dataSetsHaveTitle;dataSetDesign;axesDesign;horizontal=!0;stacked=!0;showValues;constructor(e,t,o){super(e,t,o),this.dataSets=ES(o,e.dataSets,t,e.dataSetsHaveTitle).slice(0,2),this.labelRange=ga(o,t,e.labelRange),this.background=e.background,this.legendPosition=e.legendPosition,this.aggregated=e.aggregated,this.dataSetsHaveTitle=e.dataSetsHaveTitle,this.dataSetDesign=e.dataSets,this.axesDesign=e.axesDesign,this.showValues=e.showValues}static transformDefinition(e,t,o){return DS(e,t,o)}static validateChartDefinition(e,t){return e.checkValidations(t,FS,MS)}static getDefinitionFromContextCreation(e){return{background:e.background,dataSets:e.range??[],dataSetsHaveTitle:e.dataSetsHaveTitle??!1,aggregated:e.aggregated??!1,legendPosition:e.legendPosition??"top",title:e.title||{text:""},type:"pyramid",labelRange:e.auxiliaryRange||void 0,axesDesign:e.axesDesign,horizontal:!0,stacked:!0,showValues:e.showValues}}getContextCreation(){const e=[];for(const[t,o]of this.dataSets.entries())e.push({...this.dataSetDesign?.[t],dataRange:this.getters.getRangeString(o.dataRange,this.sheetId)});return{...this,range:e,auxiliaryRange:this.labelRange?this.getters.getRangeString(this.labelRange,this.sheetId):void 0}}duplicateInDuplicatedSheet(e){const t=wS(this.sheetId,e,this.dataSets),o=IS(this.sheetId,e,this.labelRange),s=this.getDefinitionWithSpecificDataSets(t,o,e);return new yI(s,e,this.getters)}copyInSheetId(e){const t=this.getDefinitionWithSpecificDataSets(this.dataSets,this.labelRange,e);return new yI(t,e,this.getters)}getDefinition(){return this.getDefinitionWithSpecificDataSets(this.dataSets,this.labelRange)}getDefinitionWithSpecificDataSets(e,t,o){const s=[];for(const[t,i]of e.entries())s.push({...this.dataSetDesign?.[t],dataRange:this.getters.getRangeString(i.dataRange,o||this.sheetId)});return{type:"pyramid",dataSetsHaveTitle:!!e.length&&Boolean(e[0].labelCell),background:this.background,dataSets:s,legendPosition:this.legendPosition,labelRange:t?this.getters.getRangeString(t,o||this.sheetId):void 0,title:this.title,aggregated:this.aggregated,axesDesign:this.axesDesign,horizontal:!0,stacked:!0,showValues:this.showValues}}getDefinitionForExcel(){}updateRanges(e){const{dataSets:t,labelRange:o,isStale:s}=CS(this.getters,e,this.dataSets,this.labelRange);if(!s)return this;const i=this.getDefinitionWithSpecificDataSets(t,o);return new yI(i,this.sheetId,this.getters)}}class CI extends Sy{dataSets;labelRange;background;legendPosition;stacked;aggregated;type="radar";dataSetsHaveTitle;dataSetDesign;fillArea;showValues;constructor(e,t,o){super(e,t,o),this.dataSets=ES(o,e.dataSets,t,e.dataSetsHaveTitle),this.labelRange=ga(o,t,e.labelRange),this.background=e.background,this.legendPosition=e.legendPosition,this.stacked=e.stacked,this.aggregated=e.aggregated,this.dataSetsHaveTitle=e.dataSetsHaveTitle,this.dataSetDesign=e.dataSets,this.fillArea=e.fillArea,this.showValues=e.showValues}static transformDefinition(e,t,o){return DS(e,t,o)}static validateChartDefinition(e,t){return e.checkValidations(t,FS,MS)}static getDefinitionFromContextCreation(e){return{background:e.background,dataSets:e.range??[],dataSetsHaveTitle:e.dataSetsHaveTitle??!1,stacked:e.stacked??!1,aggregated:e.aggregated??!1,legendPosition:e.legendPosition??"top",title:e.title||{text:""},type:"radar",labelRange:e.auxiliaryRange||void 0,fillArea:e.fillArea??!1,showValues:e.showValues??!1}}getContextCreation(){const e=[];for(const[t,o]of this.dataSets.entries())e.push({...this.dataSetDesign?.[t],dataRange:this.getters.getRangeString(o.dataRange,this.sheetId)});return{...this,range:e,auxiliaryRange:this.labelRange?this.getters.getRangeString(this.labelRange,this.sheetId):void 0}}duplicateInDuplicatedSheet(e){const t=wS(this.sheetId,e,this.dataSets),o=IS(this.sheetId,e,this.labelRange),s=this.getDefinitionWithSpecificDataSets(t,o,e);return new CI(s,e,this.getters)}copyInSheetId(e){const t=this.getDefinitionWithSpecificDataSets(this.dataSets,this.labelRange,e);return new CI(t,e,this.getters)}getDefinition(){return this.getDefinitionWithSpecificDataSets(this.dataSets,this.labelRange)}getDefinitionWithSpecificDataSets(e,t,o){const s=[];for(const[t,i]of e.entries())s.push({...this.dataSetDesign?.[t],dataRange:this.getters.getRangeString(i.dataRange,o||this.sheetId)});return{type:"radar",dataSetsHaveTitle:!!e.length&&Boolean(e[0].labelCell),background:this.background,dataSets:s,legendPosition:this.legendPosition,labelRange:t?this.getters.getRangeString(t,o||this.sheetId):void 0,title:this.title,stacked:this.stacked,aggregated:this.aggregated,fillArea:this.fillArea,showValues:this.showValues}}getDefinitionForExcel(){if(this.aggregated)return;const e=this.dataSets.map((e=>TS(this.getters,e))).filter((e=>""!==e.range&&e.range!==Ti.InvalidReference)),t=AS(this.getters,this.labelRange,PS(this.labelRange,this.dataSets[0],this.dataSetsHaveTitle));return{...this.getDefinition(),backgroundColor:CC(this.background||m),fontColor:CC(_S(this.background)),dataSets:e,labelRange:t}}updateRanges(e){const{dataSets:t,labelRange:o,isStale:s}=CS(this.getters,e,this.dataSets,this.labelRange);if(!s)return this;const i=this.getDefinitionWithSpecificDataSets(t,o);return new CI(i,this.sheetId,this.getters)}}class wI extends Sy{dataSets;labelRange;background;legendPosition;labelsAsText;aggregated;type="scatter";dataSetsHaveTitle;dataSetDesign;axesDesign;showValues;constructor(e,t,o){super(e,t,o),this.dataSets=ES(this.getters,e.dataSets,t,e.dataSetsHaveTitle),this.labelRange=ga(this.getters,t,e.labelRange),this.background=e.background,this.legendPosition=e.legendPosition,this.labelsAsText=e.labelsAsText,this.aggregated=e.aggregated,this.dataSetsHaveTitle=e.dataSetsHaveTitle,this.dataSetDesign=e.dataSets,this.axesDesign=e.axesDesign,this.showValues=e.showValues}static validateChartDefinition(e,t){return e.checkValidations(t,FS,MS)}static transformDefinition(e,t,o){return DS(e,t,o)}static getDefinitionFromContextCreation(e){return{background:e.background,dataSets:e.range??[],dataSetsHaveTitle:e.dataSetsHaveTitle??!1,labelsAsText:e.labelsAsText??!1,legendPosition:e.legendPosition??"top",title:e.title||{text:""},type:"scatter",labelRange:e.auxiliaryRange||void 0,aggregated:e.aggregated??!1,axesDesign:e.axesDesign,showValues:e.showValues}}getDefinition(){return this.getDefinitionWithSpecificDataSets(this.dataSets,this.labelRange)}getDefinitionWithSpecificDataSets(e,t,o){const s=[];for(const[t,i]of e.entries())s.push({...this.dataSetDesign?.[t],dataRange:this.getters.getRangeString(i.dataRange,o||this.sheetId)});return{type:"scatter",dataSetsHaveTitle:!!e.length&&Boolean(e[0].labelCell),background:this.background,dataSets:s,legendPosition:this.legendPosition,labelRange:t?this.getters.getRangeString(t,o||this.sheetId):void 0,title:this.title,labelsAsText:this.labelsAsText,aggregated:this.aggregated,axesDesign:this.axesDesign,showValues:this.showValues}}getContextCreation(){const e=[];for(const[t,o]of this.dataSets.entries())e.push({...this.dataSetDesign?.[t],dataRange:this.getters.getRangeString(o.dataRange,this.sheetId)});return{...this,range:e,auxiliaryRange:this.labelRange?this.getters.getRangeString(this.labelRange,this.sheetId):void 0}}updateRanges(e){const{dataSets:t,labelRange:o,isStale:s}=CS(this.getters,e,this.dataSets,this.labelRange);if(!s)return this;const i=this.getDefinitionWithSpecificDataSets(t,o);return new wI(i,this.sheetId,this.getters)}getDefinitionForExcel(){if(this.aggregated)return;const e=this.dataSets.map((e=>TS(this.getters,e))).filter((e=>""!==e.range)),t=AS(this.getters,this.labelRange,PS(this.labelRange,this.dataSets[0],this.dataSetsHaveTitle)),o=this.getDefinition();return{...o,backgroundColor:CC(this.background||m),fontColor:CC(_S(this.background)),dataSets:e,labelRange:t,verticalAxis:NS(o)}}duplicateInDuplicatedSheet(e){const t=wS(this.sheetId,e,this.dataSets),o=IS(this.sheetId,e,this.labelRange),s=this.getDefinitionWithSpecificDataSets(t,o,e);return new wI(s,e,this.getters)}copyInSheetId(e){const t=this.getDefinitionWithSpecificDataSets(this.dataSets,this.labelRange,e);return new wI(t,e,this.getters)}}class II extends Sy{dataSets;labelRange;background;legendPosition;type="sunburst";dataSetsHaveTitle;showValues;showLabels;valuesDesign;groupColors;constructor(e,t,o){super(e,t,o),this.dataSets=ES(o,e.dataSets,t,e.dataSetsHaveTitle),this.labelRange=ga(o,t,e.labelRange),this.background=e.background,this.legendPosition=e.legendPosition,this.dataSetsHaveTitle=e.dataSetsHaveTitle,this.showValues=e.showValues,this.showLabels=e.showLabels,this.valuesDesign=e.valuesDesign,this.groupColors=e.groupColors}static transformDefinition(e,t,o){return DS(e,t,o)}static validateChartDefinition(e,t){return e.checkValidations(t,FS,MS)}static getDefinitionFromContextCreation(e){const t=[];return e.hierarchicalRanges?.length?t.push(...e.hierarchicalRanges):e.auxiliaryRange&&t.push({...e.range?.[0],dataRange:e.auxiliaryRange}),{background:e.background,dataSets:t,dataSetsHaveTitle:e.dataSetsHaveTitle??!1,legendPosition:e.legendPosition??"top",title:e.title||{text:""},type:"sunburst",labelRange:e.range?.[0]?.dataRange,showValues:e.showValues,showLabels:e.showLabels,valuesDesign:e.valuesDesign,groupColors:e.groupColors}}getDefinition(){return this.getDefinitionWithSpecificDataSets(this.dataSets,this.labelRange)}getContextCreation(){const e=this.dataSets.at(-1)?.dataRange;return{...this,range:this.labelRange?[{dataRange:this.getters.getRangeString(this.labelRange,this.sheetId)}]:[],auxiliaryRange:e?this.getters.getRangeString(e,this.sheetId):void 0,hierarchicalRanges:this.dataSets.map((e=>({dataRange:this.getters.getRangeString(e.dataRange,this.sheetId)})))}}getDefinitionWithSpecificDataSets(e,t,o){return{type:"sunburst",dataSetsHaveTitle:!!e.length&&Boolean(e[0].labelCell),background:this.background,dataSets:e.map((e=>({dataRange:this.getters.getRangeString(e.dataRange,o||this.sheetId)}))),legendPosition:this.legendPosition,labelRange:t?this.getters.getRangeString(t,o||this.sheetId):void 0,title:this.title,showValues:this.showValues,showLabels:this.showLabels,valuesDesign:this.valuesDesign,groupColors:this.groupColors}}duplicateInDuplicatedSheet(e){const t=wS(this.sheetId,e,this.dataSets),o=IS(this.sheetId,e,this.labelRange),s=this.getDefinitionWithSpecificDataSets(t,o,e);return new II(s,e,this.getters)}copyInSheetId(e){const t=this.getDefinitionWithSpecificDataSets(this.dataSets,this.labelRange,e);return new II(t,e,this.getters)}getDefinitionForExcel(){}updateRanges(e){const{dataSets:t,labelRange:o,isStale:s}=CS(this.getters,e,this.dataSets,this.labelRange);if(!s)return this;const i=this.getDefinitionWithSpecificDataSets(t,o);return new II(i,this.sheetId,this.getters)}}class xI extends Sy{static defaults={background:m,legendPosition:"top",dataSetsHaveTitle:!1,showHeaders:!0,headersColor:"#000000"};dataSets;labelRange;background;legendPosition;type="treemap";dataSetsHaveTitle;showHeaders;headerDesign;showValues;showLabels;valuesDesign;coloringOptions;constructor(e,t,o){super(e,t,o),this.dataSets=ES(o,e.dataSets,t,e.dataSetsHaveTitle),this.labelRange=ga(o,t,e.labelRange),this.background=e.background,this.legendPosition=e.legendPosition,this.dataSetsHaveTitle=e.dataSetsHaveTitle,this.showHeaders=e.showHeaders,this.headerDesign=e.headerDesign,this.showValues=e.showValues,this.showLabels=e.showLabels,this.valuesDesign=e.valuesDesign,this.coloringOptions=e.coloringOptions}static transformDefinition(e,t,o){return DS(e,t,o)}static validateChartDefinition(e,t){return e.checkValidations(t,FS,MS)}static getDefinitionFromContextCreation(e){const t=[];return e.hierarchicalRanges?.length?t.push(...e.hierarchicalRanges):e.auxiliaryRange&&t.push({...e.range?.[0],dataRange:e.auxiliaryRange}),{background:e.background,dataSets:t,dataSetsHaveTitle:e.dataSetsHaveTitle??!1,legendPosition:e.legendPosition??"top",title:e.title||{text:""},type:"treemap",labelRange:e.range?.[0]?.dataRange,showValues:e.showValues,showHeaders:e.showHeaders,headerDesign:e.headerDesign,showLabels:e.showLabels,valuesDesign:e.valuesDesign,coloringOptions:e.treemapColoringOptions}}getContextCreation(){const e=this.dataSets.at(-1)?.dataRange;return{...this,range:this.labelRange?[{dataRange:this.getters.getRangeString(this.labelRange,this.sheetId)}]:[],auxiliaryRange:e?this.getters.getRangeString(e,this.sheetId):void 0,hierarchicalRanges:this.dataSets.map((e=>({dataRange:this.getters.getRangeString(e.dataRange,this.sheetId)})))}}duplicateInDuplicatedSheet(e){const t=wS(this.sheetId,e,this.dataSets),o=IS(this.sheetId,e,this.labelRange),s=this.getDefinitionWithSpecificDataSets(t,o,e);return new xI(s,e,this.getters)}copyInSheetId(e){const t=this.getDefinitionWithSpecificDataSets(this.dataSets,this.labelRange,e);return new xI(t,e,this.getters)}getDefinition(){return this.getDefinitionWithSpecificDataSets(this.dataSets,this.labelRange)}getDefinitionWithSpecificDataSets(e,t,o){const s=e.map((e=>({dataRange:this.getters.getRangeString(e.dataRange,o||this.sheetId)})));return{type:"treemap",dataSetsHaveTitle:!!e.length&&Boolean(e[0].labelCell),background:this.background,dataSets:s,legendPosition:this.legendPosition,labelRange:t?this.getters.getRangeString(t,o||this.sheetId):void 0,title:this.title,showValues:this.showValues,showHeaders:this.showHeaders,headerDesign:this.headerDesign,showLabels:this.showLabels,valuesDesign:this.valuesDesign,coloringOptions:this.coloringOptions}}getDefinitionForExcel(){}updateRanges(e){const{dataSets:t,labelRange:o,isStale:s}=CS(this.getters,e,this.dataSets,this.labelRange);if(!s)return this;const i=this.getDefinitionWithSpecificDataSets(t,o);return new xI(i,this.sheetId,this.getters)}}class EI extends Sy{dataSets;labelRange;background;verticalAxisPosition;legendPosition;aggregated;type="waterfall";dataSetsHaveTitle;showSubTotals;firstValueAsSubtotal;showConnectorLines;positiveValuesColor;negativeValuesColor;subTotalValuesColor;dataSetDesign;axesDesign;showValues;constructor(e,t,o){super(e,t,o),this.dataSets=ES(o,e.dataSets,t,e.dataSetsHaveTitle),this.labelRange=ga(o,t,e.labelRange),this.background=e.background,this.verticalAxisPosition=e.verticalAxisPosition,this.legendPosition=e.legendPosition,this.aggregated=e.aggregated,this.dataSetsHaveTitle=e.dataSetsHaveTitle,this.showSubTotals=e.showSubTotals,this.showConnectorLines=e.showConnectorLines,this.positiveValuesColor=e.positiveValuesColor,this.negativeValuesColor=e.negativeValuesColor,this.subTotalValuesColor=e.subTotalValuesColor,this.firstValueAsSubtotal=e.firstValueAsSubtotal,this.dataSetDesign=e.dataSets,this.axesDesign=e.axesDesign,this.showValues=e.showValues}static transformDefinition(e,t,o){return DS(e,t,o)}static validateChartDefinition(e,t){return e.checkValidations(t,FS,MS)}static getDefinitionFromContextCreation(e){return{background:e.background,dataSets:e.range?e.range:[],dataSetsHaveTitle:e.dataSetsHaveTitle??!1,aggregated:e.aggregated??!1,legendPosition:e.legendPosition??"top",title:e.title||{text:""},type:"waterfall",verticalAxisPosition:"left",labelRange:e.auxiliaryRange||void 0,showSubTotals:e.showSubTotals??!1,showConnectorLines:e.showConnectorLines??!0,firstValueAsSubtotal:e.firstValueAsSubtotal??!1,axesDesign:e.axesDesign,showValues:e.showValues}}getContextCreation(){const e=[];for(const[t,o]of this.dataSets.entries())e.push({...this.dataSetDesign?.[t],dataRange:this.getters.getRangeString(o.dataRange,this.sheetId)});return{...this,range:e,auxiliaryRange:this.labelRange?this.getters.getRangeString(this.labelRange,this.sheetId):void 0}}duplicateInDuplicatedSheet(e){const t=wS(this.sheetId,e,this.dataSets),o=IS(this.sheetId,e,this.labelRange),s=this.getDefinitionWithSpecificDataSets(t,o,e);return new EI(s,e,this.getters)}copyInSheetId(e){const t=this.getDefinitionWithSpecificDataSets(this.dataSets,this.labelRange,e);return new EI(t,e,this.getters)}getDefinition(){return this.getDefinitionWithSpecificDataSets(this.dataSets,this.labelRange)}getDefinitionWithSpecificDataSets(e,t,o){const s=[];for(const[t,i]of e.entries())s.push({...this.dataSetDesign?.[t],dataRange:this.getters.getRangeString(i.dataRange,o||this.sheetId)});return{type:"waterfall",dataSetsHaveTitle:!!e.length&&Boolean(e[0].labelCell),background:this.background,dataSets:s,legendPosition:this.legendPosition,verticalAxisPosition:this.verticalAxisPosition,labelRange:t?this.getters.getRangeString(t,o||this.sheetId):void 0,title:this.title,aggregated:this.aggregated,showSubTotals:this.showSubTotals,showConnectorLines:this.showConnectorLines,positiveValuesColor:this.positiveValuesColor,negativeValuesColor:this.negativeValuesColor,subTotalValuesColor:this.subTotalValuesColor,firstValueAsSubtotal:this.firstValueAsSubtotal,axesDesign:this.axesDesign,showValues:this.showValues}}getDefinitionForExcel(){}updateRanges(e){const{dataSets:t,labelRange:o,isStale:s}=CS(this.getters,e,this.dataSets,this.labelRange);if(!s)return this;const i=this.getDefinitionWithSpecificDataSets(t,o);return new EI(i,this.sheetId,this.getters)}}function RI(e,t){const o=e.getDefinition(),s=UC(o,e.dataSets,e.labelRange,t),{labels:i,datasets:n}=jS(o,s);return{chartJsConfig:{type:"bar",data:{labels:i,datasets:n},options:{...wC,layout:cw(),scales:xw(o,s),plugins:{title:Hw(o),legend:fw(o),tooltip:qw(0,s),chartShowValuesPlugin:Lw(o,s),waterfallLinesPlugin:{showConnectorLines:o.showConnectorLines}}}},background:e.background||m}}const TI=new n;TI.add("bar",{match:e=>"bar"===e,createChart:(e,t,o)=>new oI(e,t,o),getChartRuntime:sI,validateChartDefinition:oI.validateChartDefinition,transformDefinition:oI.transformDefinition,getChartDefinitionFromContextCreation:oI.getDefinitionFromContextCreation,sequence:10}),TI.add("combo",{match:e=>"combo"===e,createChart:(e,t,o)=>new iI(e,t,o),getChartRuntime:function(e,t){const o=e.getDefinition(),s=UC(o,e.dataSets,e.labelRange,t);return{chartJsConfig:{type:"bar",data:{labels:s.labels,datasets:JS(o,s)},options:{...wC,layout:cw(),scales:Cw(o,s),plugins:{title:Hw(o),legend:mw(o),tooltip:$w(o,s),chartShowValuesPlugin:Nw(o,s)}}},background:e.background||m}},validateChartDefinition:iI.validateChartDefinition,transformDefinition:iI.transformDefinition,getChartDefinitionFromContextCreation:iI.getDefinitionFromContextCreation,sequence:15}),TI.add("line",{match:e=>"line"===e,createChart:(e,t,o)=>new fI(e,t,o),getChartRuntime:vI,validateChartDefinition:fI.validateChartDefinition,transformDefinition:fI.transformDefinition,getChartDefinitionFromContextCreation:fI.getDefinitionFromContextCreation,sequence:20}),TI.add("pie",{match:e=>"pie"===e,createChart:(e,t,o)=>new bI(e,t,o),getChartRuntime:SI,validateChartDefinition:bI.validateChartDefinition,transformDefinition:bI.transformDefinition,getChartDefinitionFromContextCreation:bI.getDefinitionFromContextCreation,sequence:30}),TI.add("scorecard",{match:e=>"scorecard"===e,createChart:(e,t,o)=>new Ry(e,t,o),getChartRuntime:Ay,validateChartDefinition:Ry.validateChartDefinition,transformDefinition:Ry.transformDefinition,getChartDefinitionFromContextCreation:Ry.getDefinitionFromContextCreation,sequence:40}),TI.add("gauge",{match:e=>"gauge"===e,createChart:(e,t,o)=>new hI(e,t,o),getChartRuntime:dI,validateChartDefinition:hI.validateChartDefinition,transformDefinition:hI.transformDefinition,getChartDefinitionFromContextCreation:hI.getDefinitionFromContextCreation,sequence:50}),TI.add("scatter",{match:e=>"scatter"===e,createChart:(e,t,o)=>new wI(e,t,o),getChartRuntime:function(e,t){const o=e.getDefinition(),s=zC(o,e.dataSets,e.labelRange,t);return{chartJsConfig:{type:"line",data:{labels:s.labels,datasets:XS(o,s)},options:{...wC,layout:cw(),scales:Iw(o,s),plugins:{title:Hw(o),legend:pw(o),tooltip:Gw(0,s),chartShowValuesPlugin:Nw(o,s)}}},background:e.background||m}},validateChartDefinition:wI.validateChartDefinition,transformDefinition:wI.transformDefinition,getChartDefinitionFromContextCreation:wI.getDefinitionFromContextCreation,sequence:60}),TI.add("waterfall",{match:e=>"waterfall"===e,createChart:(e,t,o)=>new EI(e,t,o),getChartRuntime:RI,validateChartDefinition:EI.validateChartDefinition,transformDefinition:EI.transformDefinition,getChartDefinitionFromContextCreation:EI.getDefinitionFromContextCreation,sequence:70}),TI.add("pyramid",{match:e=>"pyramid"===e,createChart:(e,t,o)=>new yI(e,t,o),getChartRuntime:function(e,t){const o=e.getDefinition(),s=BC(o,e.dataSets,e.labelRange,t);return{chartJsConfig:{type:"bar",data:{labels:s.labels,datasets:ZS(o,s)},options:{...wC,indexAxis:"y",layout:cw(),scales:Ew(o,s),plugins:{title:Hw(o),legend:dw(o),tooltip:Zw(o,s),chartShowValuesPlugin:Vw(o,s)}}},background:e.background||m}},validateChartDefinition:yI.validateChartDefinition,transformDefinition:yI.transformDefinition,getChartDefinitionFromContextCreation:yI.getDefinitionFromContextCreation,sequence:80}),TI.add("radar",{match:e=>"radar"===e,createChart:(e,t,o)=>new CI(e,t,o),getChartRuntime:function(e,t){const o=e.getDefinition(),s=GC(o,e.dataSets,e.labelRange,t);return{chartJsConfig:{type:"radar",data:{labels:s.labels,datasets:QS(o,s)},options:{...wC,layout:cw(),scales:Rw(o,s),plugins:{title:Hw(o),legend:vw(o),tooltip:jw(0,s),chartShowValuesPlugin:Nw(o,s)}}},background:e.background||m}},validateChartDefinition:CI.validateChartDefinition,transformDefinition:CI.transformDefinition,getChartDefinitionFromContextCreation:CI.getDefinitionFromContextCreation,sequence:80}),TI.add("geo",{match:e=>"geo"===e,createChart:(e,t,o)=>new mI(e,t,o),getChartRuntime:function(e,t){const o=e.getDefinition(),s=WC(o,e.dataSets,e.labelRange,t);return{chartJsConfig:{type:"choropleth",data:{datasets:ey(o,s)},options:{...wC,layout:cw(),scales:Tw(o,s),plugins:{title:Hw(o),tooltip:Yw(0,s),legend:{display:!1}}}},background:e.background||m}},validateChartDefinition:mI.validateChartDefinition,transformDefinition:mI.transformDefinition,getChartDefinitionFromContextCreation:mI.getDefinitionFromContextCreation,sequence:90}),TI.add("funnel",{match:e=>"funnel"===e,createChart:(e,t,o)=>new nI(e,t,o),getChartRuntime:function(e,t){const o=e.getDefinition(),s=qC(o,e.dataSets,e.labelRange,t);return{chartJsConfig:{type:"funnel",data:{labels:s.labels,datasets:ty(o,s)},options:{...wC,indexAxis:"y",layout:cw(),scales:Aw(0,s),plugins:{title:Hw(o),legend:{display:!1},tooltip:Xw(0,s),chartShowValuesPlugin:Nw(o,s)}}},background:e.background||m}},validateChartDefinition:nI.validateChartDefinition,transformDefinition:nI.transformDefinition,getChartDefinitionFromContextCreation:nI.getDefinitionFromContextCreation,sequence:100}),TI.add("sunburst",{match:e=>"sunburst"===e,createChart:(e,t,o)=>new II(e,t,o),getChartRuntime:function(e,t){const o=e.getDefinition(),s=ZC(o,e.dataSets,e.labelRange,t);return{chartJsConfig:{type:"doughnut",data:{datasets:sy(o,s)},options:{cutout:"25%",...wC,layout:cw(),plugins:{title:Hw(o),legend:bw(o),tooltip:Kw(0,s),sunburstLabelsPlugin:kw(o,s),sunburstHoverPlugin:{enabled:!0}}}},background:e.background||m}},validateChartDefinition:II.validateChartDefinition,transformDefinition:II.transformDefinition,getChartDefinitionFromContextCreation:II.getDefinitionFromContextCreation,sequence:30}),TI.add("treemap",{match:e=>"treemap"===e,createChart:(e,t,o)=>new xI(e,t,o),getChartRuntime:function(e,t){const o=e.getDefinition(),s=ZC(o,e.dataSets,e.labelRange,t);return{chartJsConfig:{type:"treemap",data:{labels:s.labels,datasets:ay(o,s)},options:{...wC,layout:cw(),plugins:{title:Hw(o),legend:{display:!1},tooltip:Jw(0,s)}}},background:e.background||m}},validateChartDefinition:xI.validateChartDefinition,transformDefinition:xI.transformDefinition,getChartDefinitionFromContextCreation:xI.getDefinitionFromContextCreation,sequence:100});const AI=new n;AI.add("line",by),AI.add("bar",by),AI.add("combo",by),AI.add("pie",by),AI.add("gauge",yC),AI.add("scatter",by),AI.add("scorecard",My),AI.add("waterfall",by),AI.add("pyramid",by),AI.add("radar",by),AI.add("geo",by),AI.add("funnel",by),AI.add("sunburst",by),AI.add("treemap",by);const DI={line:ni("Line"),column:ni("Column"),bar:ni("Bar"),area:ni("Area"),pie:ni("Pie"),hierarchical:ni("Hierarchical"),misc:ni("Miscellaneous")},_I=new n;_I.add("line",{matcher:e=>"line"===e.type&&!e.stacked&&!e.fillArea,displayName:ni("Line"),chartType:"line",chartSubtype:"line",subtypeDefinition:{stacked:!1,fillArea:!1},category:"line",preview:"o-spreadsheet-ChartPreview.LINE_CHART"}).add("stacked_line",{matcher:e=>"line"===e.type&&!e.fillArea&&!!e.stacked,displayName:ni("Stacked Line"),chartType:"line",chartSubtype:"stacked_line",subtypeDefinition:{stacked:!0,fillArea:!1},category:"line",preview:"o-spreadsheet-ChartPreview.STACKED_LINE_CHART"}).add("area",{matcher:e=>"line"===e.type&&!e.stacked&&!!e.fillArea,displayName:ni("Area"),chartType:"line",chartSubtype:"area",subtypeDefinition:{stacked:!1,fillArea:!0},category:"area",preview:"o-spreadsheet-ChartPreview.AREA_CHART"}).add("stacked_area",{matcher:e=>"line"===e.type&&e.stacked&&!!e.fillArea,displayName:ni("Stacked Area"),chartType:"line",chartSubtype:"stacked_area",subtypeDefinition:{stacked:!0,fillArea:!0},category:"area",preview:"o-spreadsheet-ChartPreview.STACKED_AREA_CHART"}).add("scatter",{displayName:ni("Scatter"),chartType:"scatter",chartSubtype:"scatter",category:"misc",preview:"o-spreadsheet-ChartPreview.SCATTER_CHART"}).add("column",{matcher:e=>"bar"===e.type&&!e.stacked&&!e.horizontal,displayName:ni("Column"),chartType:"bar",chartSubtype:"column",subtypeDefinition:{stacked:!1,horizontal:!1},category:"column",preview:"o-spreadsheet-ChartPreview.COLUMN_CHART"}).add("stacked_column",{matcher:e=>"bar"===e.type&&e.stacked&&!e.horizontal,displayName:ni("Stacked Column"),chartType:"bar",chartSubtype:"stacked_column",subtypeDefinition:{stacked:!0,horizontal:!1},category:"column",preview:"o-spreadsheet-ChartPreview.STACKED_COLUMN_CHART"}).add("bar",{matcher:e=>"bar"===e.type&&!e.stacked&&!!e.horizontal,displayName:ni("Bar"),chartType:"bar",chartSubtype:"bar",subtypeDefinition:{horizontal:!0,stacked:!1},category:"bar",preview:"o-spreadsheet-ChartPreview.BAR_CHART"}).add("stacked_bar",{matcher:e=>"bar"===e.type&&e.stacked&&!!e.horizontal,displayName:ni("Stacked Bar"),chartType:"bar",chartSubtype:"stacked_bar",subtypeDefinition:{horizontal:!0,stacked:!0},category:"bar",preview:"o-spreadsheet-ChartPreview.STACKED_BAR_CHART"}).add("combo",{displayName:ni("Combo"),chartSubtype:"combo",chartType:"combo",category:"line",preview:"o-spreadsheet-ChartPreview.COMBO_CHART"}).add("pie",{matcher:e=>"pie"===e.type&&!e.isDoughnut,displayName:ni("Pie"),chartSubtype:"pie",chartType:"pie",subtypeDefinition:{isDoughnut:!1},category:"pie",preview:"o-spreadsheet-ChartPreview.PIE_CHART"}).add("doughnut",{matcher:e=>"pie"===e.type&&!!e.isDoughnut,displayName:ni("Doughnut"),chartSubtype:"doughnut",chartType:"pie",subtypeDefinition:{isDoughnut:!0},category:"pie",preview:"o-spreadsheet-ChartPreview.DOUGHNUT_CHART"}).add("gauge",{displayName:ni("Gauge"),chartSubtype:"gauge",chartType:"gauge",category:"misc",preview:"o-spreadsheet-ChartPreview.GAUGE_CHART"}).add("scorecard",{displayName:ni("Scorecard"),chartSubtype:"scorecard",chartType:"scorecard",category:"misc",preview:"o-spreadsheet-ChartPreview.SCORECARD_CHART"}).add("waterfall",{displayName:ni("Waterfall"),chartSubtype:"waterfall",chartType:"waterfall",category:"misc",preview:"o-spreadsheet-ChartPreview.WATERFALL_CHART"}).add("pyramid",{displayName:ni("Population Pyramid"),chartSubtype:"pyramid",chartType:"pyramid",category:"misc",preview:"o-spreadsheet-ChartPreview.POPULATION_PYRAMID_CHART"}).add("radar",{matcher:e=>"radar"===e.type&&!e.fillArea,displayName:ni("Radar"),chartSubtype:"radar",chartType:"radar",subtypeDefinition:{fillArea:!1},category:"misc",preview:"o-spreadsheet-ChartPreview.RADAR_CHART"}).add("filled_radar",{matcher:e=>"radar"===e.type&&!!e.fillArea,displayName:ni("Filled Radar"),chartType:"radar",chartSubtype:"filled_radar",subtypeDefinition:{fillArea:!0},category:"misc",preview:"o-spreadsheet-ChartPreview.FILLED_RADAR_CHART"}).add("geo",{displayName:ni("Geo Chart"),chartSubtype:"geo",chartType:"geo",category:"misc",preview:"o-spreadsheet-ChartPreview.GEO_CHART"}).add("funnel",{displayName:ni("Funnel"),chartSubtype:"funnel",chartType:"funnel",category:"misc",preview:"o-spreadsheet-ChartPreview.FUNNEL_CHART"}).add("sunburst",{matcher:e=>"sunburst"===e.type,displayName:ni("Sunburst"),chartSubtype:"sunburst",chartType:"sunburst",category:"hierarchical",preview:"o-spreadsheet-ChartPreview.SUNBURST_CHART"}).add("treemap",{matcher:e=>"treemap"===e.type,displayName:ni("Tree Map"),chartType:"treemap",chartSubtype:"treemap",category:"hierarchical",preview:"o-spreadsheet-ChartPreview.TREE_MAP_CHART"});const OI=new n;wh`
|
|
9
|
+
`,Rh.add("chartShowValuesPlugin",{register:e=>e.register(zS),unregister:e=>e.unregister(zS)}),Rh.add("waterfallLinesPlugin",{register:e=>e.register(my),unregister:e=>e.unregister(my)}),Rh.add("funnelController",{register:e=>e.register(Ah()),unregister:e=>e.unregister(Ah())}),Rh.add("funnelElement",{register:e=>e.register(Dh()),unregister:e=>e.unregister(Dh())}),Rh.add("funnelTooltipPositioner",{register:e=>e.Tooltip.positioners.funnelTooltipPositioner=Oh,unregister:e=>e.Tooltip.positioners.funnelTooltipPositioner=void 0}),Rh.add("sunburstLabelsPlugin",{register:e=>e.register(py),unregister:e=>e.unregister(py)}),Rh.add("sunburstHoverPlugin",{register:e=>e.register(uy),unregister:e=>e.unregister(uy)});class by extends t.Component{static template="o-spreadsheet-ChartJsComponent";static props={figureUI:Object};canvas=t.useRef("graphContainer");chart;currentRuntime;currentDevicePixelRatio=window.devicePixelRatio;get background(){return this.chartRuntime.background}get canvasStyle(){return`background-color: ${this.background}`}get chartRuntime(){const e=this.env.model.getters.getChartRuntime(this.props.figureUI.id);if(!("chartJsConfig"in e))throw new Error("Unsupported chart runtime");return e}setup(){t.onMounted((()=>{Th();const e=this.chartRuntime;this.currentRuntime=e,this.createChart(ze(e.chartJsConfig))})),t.onWillUnmount((()=>this.chart?.destroy())),t.useEffect((()=>{const e=this.chartRuntime;e!==this.currentRuntime?(e.chartJsConfig.type!==this.currentRuntime.chartJsConfig.type?(this.chart?.destroy(),this.createChart(ze(e.chartJsConfig))):this.updateChartJs(ze(e.chartJsConfig)),this.currentRuntime=e):this.currentDevicePixelRatio!==window.devicePixelRatio&&(this.currentDevicePixelRatio=window.devicePixelRatio,this.updateChartJs(ze(this.currentRuntime.chartJsConfig)))}))}createChart(e){const t=this.canvas.el.getContext("2d");this.chart=new window.Chart(t,e)}updateChartJs(e){e.data&&e.data.datasets?(this.chart.data=e.data,e.options?.plugins?.title&&(this.chart.config.options.plugins.title=e.options.plugins.title)):this.chart.data.datasets=[],this.chart.config.options=e.options,this.chart.update()}}class Sy{sheetId;title;getters;constructor(e,t,o){this.title=e.title,this.sheetId=t,this.getters=o}static validateChartDefinition(e,t){throw new Error("This method should be implemented by sub class")}static transformDefinition(e,t,o){throw new Error("This method should be implemented by sub class")}static getDefinitionFromContextCreation(e){throw new Error("This method should be implemented by sub class")}}function yy(e,t,o,s,i){if("text"===t||"progress"===t||e?.type!==ai.number||o?.type!==ai.number)return;const n=o.value-e.value;return n>0?s:n<0?i:void 0}function Cy(e,t,o){if("text"===o||e?.type!==ai.number||t?.type!==ai.number)return"neutral";const s=t.value-e.value;return s>0?"up":s<0?"down":"neutral"}function wy(e){return e.keyValue&&!Zr.test(e.keyValue)?"InvalidScorecardKeyValue":"Success"}function Iy(e){return e.baseline&&!Zr.test(e.baseline)?"InvalidScorecardBaseline":"Success"}const xy=new window.Path2D("M8.6 4.8a.5.5 0 0 1 0 .75l-3.9 3.9a.5 .5 0 0 1 -.75 0l-3.8 -3.9a.5 .5 0 0 1 0 -.75l.4-.4a.5.5 0 0 1 .75 0l2.3 2.4v-5.7c0-.25.25-.5.5-.5h.6c.25 0 .5.25.5.5v5.8l2.3 -2.4a.5.5 0 0 1 .75 0z"),Ey=new window.Path2D("M8.7 5.5a.5.5 0 0 0 0-.75l-3.8-4a.5.5 0 0 0-.75 0l-3.8 4a.5.5 0 0 0 0 .75l.4.4a.5.5 0 0 0 .75 0l2.3-2.4v5.8c0 .25.25.5.5.5h.6c.25 0 .5-.25.5-.5v-5.8l2.2 2.4a.5.5 0 0 0 .75 0z");let Ry=class e extends Sy{keyValue;baseline;baselineMode;baselineDescr;progressBar=!1;background;baselineColorUp;baselineColorDown;fontColor;humanize;type="scorecard";constructor(e,t,o){super(e,t,o),this.keyValue=ga(o,t,e.keyValue),this.baseline=ga(o,t,e.baseline),this.baselineMode=e.baselineMode,this.baselineDescr=e.baselineDescr,this.background=e.background,this.baselineColorUp=e.baselineColorUp??Ee,this.baselineColorDown=e.baselineColorDown??Re,this.humanize=e.humanize??!1}static validateChartDefinition(e,t){return e.checkValidations(t,wy,Iy)}static getDefinitionFromContextCreation(e){return{background:e.background,type:"scorecard",keyValue:e.range?e.range[0].dataRange:void 0,title:e.title||{text:""},baselineMode:xe,baselineColorUp:Ee,baselineColorDown:Re,baseline:e.auxiliaryRange||""}}static transformDefinition(e,t,o){let s,i;if(t.baseline){const i=vS(e,t.baseline,o);i!==Ti.InvalidReference&&(s=i)}if(t.keyValue){const s=vS(e,t.keyValue,o);s!==Ti.InvalidReference&&(i=s)}return{...t,baseline:s,keyValue:i}}duplicateInDuplicatedSheet(t){const o=IS(this.sheetId,t,this.baseline),s=IS(this.sheetId,t,this.keyValue),i=this.getDefinitionWithSpecificRanges(o,s,t);return new e(i,t,this.getters)}copyInSheetId(t){const o=this.getDefinitionWithSpecificRanges(this.baseline,this.keyValue,t);return new e(o,t,this.getters)}getDefinition(){return this.getDefinitionWithSpecificRanges(this.baseline,this.keyValue)}getContextCreation(){return{...this,range:this.keyValue?[{dataRange:this.getters.getRangeString(this.keyValue,this.sheetId)}]:void 0,auxiliaryRange:this.baseline?this.getters.getRangeString(this.baseline,this.sheetId):void 0}}getDefinitionWithSpecificRanges(e,t,o){return{baselineColorDown:this.baselineColorDown,baselineColorUp:this.baselineColorUp,baselineMode:this.baselineMode,title:this.title,type:"scorecard",background:this.background,baseline:e?this.getters.getRangeString(e,o||this.sheetId):void 0,baselineDescr:this.baselineDescr,keyValue:t?this.getters.getRangeString(t,o||this.sheetId):void 0,humanize:this.humanize}}getDefinitionForExcel(){}updateRanges(t){const o=xS(this.baseline,t),s=xS(this.keyValue,t);if(this.baseline===o&&this.keyValue===s)return this;const i=this.getDefinitionWithSpecificRanges(o,s);return new e(i,this.sheetId,this.getters)}};function Ty(e,t){const o=t.getContext("2d"),s=window.devicePixelRatio||1;t.width=s*e.canvas.width,t.height=s*e.canvas.height,o.scale(s,s);const i=e.canvas.width-2*j;if(o.fillStyle=e.canvas.backgroundColor,o.fillRect(0,0,e.canvas.width,e.canvas.height),e.title){o.font=e.title.style.font,o.fillStyle=e.title.style.color;const t=o.textBaseline;o.textBaseline="middle",o.fillText(Ua(o,e.title.text,i-e.title.position.x),e.title.position.x,e.title.position.y),o.textBaseline=t}if(e.baseline&&(o.font=e.baseline.style.font,o.fillStyle=e.baseline.style.color,Ba(o,e.baseline.text,e.baseline.position,e.baseline.style.underline,e.baseline.style.strikethrough)),e.baselineArrow&&e.baselineArrow.style.size>0){o.save(),o.fillStyle=e.baselineArrow.style.color,o.translate(e.baselineArrow.position.x,e.baselineArrow.position.y);const t=e.baselineArrow.style.size/10;switch(o.scale(t,t),e.baselineArrow.direction){case"down":o.fill(xy);break;case"up":o.fill(Ey)}o.restore()}if(e.baselineDescr){const t=e.baselineDescr[0];o.font=t.style.font,o.fillStyle=t.style.color;for(const t of e.baselineDescr)o.fillText(Ua(o,t.text,i-t.position.x),t.position.x,t.position.y)}if(e.key&&(o.font=e.key.style.font,o.fillStyle=e.key.style.color,Ba(o,Ua(o,e.key.text,i-e.key.position.x),e.key.position,e.key.style.underline,e.key.style.strikethrough)),e.progressBar){if(o.fillStyle=e.progressBar.style.backgroundColor,o.beginPath(),o.roundRect(e.progressBar.position.x,e.progressBar.position.y,e.progressBar.dimension.width,e.progressBar.dimension.height,e.progressBar.dimension.height/2),o.fill(),o.fillStyle=e.progressBar.style.color,o.beginPath(),e.progressBar.value>0)o.roundRect(e.progressBar.position.x,e.progressBar.position.y,e.progressBar.dimension.width*Math.max(0,Math.min(1,e.progressBar.value)),e.progressBar.dimension.height,e.progressBar.dimension.height/2);else{const t=e.progressBar.dimension.width*Math.max(0,Math.min(1,-e.progressBar.value));o.roundRect(e.progressBar.position.x+e.progressBar.dimension.width-t,e.progressBar.position.y,t,e.progressBar.dimension.height,e.progressBar.dimension.height/2)}o.fill()}}function Ay(e,t){let o,s="";const i=t.getLocale();if(e.keyValue){const n={sheetId:e.keyValue.sheetId,col:e.keyValue.zone.left,row:e.keyValue.zone.top};o=t.getEvaluatedCell(n),s=function(e,t,o){return e?t?wr(e,o):e.formattedValue??String(e.value??""):""}(o,e.humanize??!1,i)}let n;const r=e.baseline;if(r){const e={sheetId:r.sheetId,col:r.zone.left,row:r.zone.top};n=t.getEvaluatedCell(e)}const{background:a,fontColor:l}=t.getStyleOfSingleCellChart(e.background,e.keyValue),c=function(e,t,o,s,i){if(!e)return"";if("text"===o||t?.type!==ai.number||e.type!==ai.number)return s?wr(e,i):e.formattedValue;let{value:n,format:r}=e;return"progress"===o?(n=t.value/n,r="0.0%"):(n=Math.abs(t.value-n),"percentage"===o&&0!==n&&(n/=e.value),"percentage"===o&&(r="0.0%"),r||(n=Math.round(100*n)/100)),s?wr({value:n,format:r},i):sr(n,{format:r,locale:i})}(n,o,e.baselineMode,e.humanize??!1,i),h="progress"===e.baselineMode&&Xs(c,i)?zi(c,i):0;return{title:{...e.title,text:e.title.text?ni(e.title.text):""},keyValue:s,baselineDisplay:c,baselineArrow:Cy(n,o,e.baselineMode),baselineColor:yy(n,e.baselineMode,o,e.baselineColorUp,e.baselineColorDown),baselineDescr:"progress"!==e.baselineMode&&e.baselineDescr?ni(e.baselineDescr):"",fontColor:l,background:a,baselineStyle:"percentage"!==e.baselineMode&&"progress"!==e.baselineMode&&r?t.getCellStyle({sheetId:r.sheetId,col:r.zone.left,row:r.zone.top}):void 0,keyValueStyle:e.keyValue?t.getCellStyle({sheetId:e.keyValue.sheetId,col:e.keyValue.zone.left,row:e.keyValue.zone.top}):void 0,progressBar:"progress"===e.baselineMode?{value:h,color:h>0?e.baselineColorUp:e.baselineColorDown}:void 0}}const Dy=10,_y=.05;function Oy({width:e,height:t},o){return new Fy({width:e,height:t},o).computeDesign()}class Fy{runtime;context;width;height;constructor({width:e,height:t},o){this.runtime=o;const s=document.createElement("canvas");this.width=s.width=e,this.height=s.height=t,this.context=s.getContext("2d")}computeDesign(){const e={canvas:{width:this.width,height:this.height,backgroundColor:this.backgroundColor}},t=this.getTextStyles();let o=0;if(this.title){let s,i;switch(({height:o,width:i}=this.getFullTextDimensions(this.title,t.title.font)),this.runtime.title.align){case"center":s=(this.width-i)/2;break;case"right":s=this.width-i-Dy;break;default:s=Dy}e.title={text:this.title,style:t.title,position:{x:s,y:Dy+o/2}}}const s=t.baselineArrow?.size??0;let{height:i,width:n}=this.getTextDimensions(this.baseline,t.baselineValue.font);this.baseline||(i=this.getTextDimensions(this.baselineDescr,t.baselineDescr.font).height);const r=this.getTextDimensions(this.baselineDescr,t.baselineDescr.font).width;e.baseline={text:this.baseline,style:t.baselineValue,position:{x:(this.width-n-r+s)/2,y:this.keyValue?this.height*(1-_y*(this.runtime.progressBar?1:2)):this.height-(this.height-o-i)/2-Dy}};const a=s+20;if(e.baseline.position.x<a&&(e.baseline.position.x=a),t.baselineArrow&&!this.runtime.progressBar&&(e.baselineArrow={direction:this.baselineArrow,style:t.baselineArrow,position:{x:e.baseline.position.x-s,y:e.baseline.position.y-(i+s)/2}}),this.baselineDescr){const o={x:e.baseline.position.x+n,y:e.baseline.position.y};e.baselineDescr=[{text:this.baselineDescr,style:t.baselineDescr,position:o}]}let l=0;this.runtime.progressBar&&(l=.05*this.height,e.progressBar={position:{x:20,y:.9*this.height-i-l},dimension:{height:l,width:this.width-40},value:this.runtime.progressBar.value,style:{color:this.runtime.progressBar.color,backgroundColor:this.secondaryFontColor}});const{width:c,height:h}=this.getFullTextDimensions(this.keyValue,t.keyValue.font);return this.keyValue&&(e.key={text:this.keyValue,style:t.keyValue,position:{x:Math.max(Dy,(this.width-c)/2),y:.4*this.height+5+(o+h/2)/2}}),e}get title(){return this.runtime.title.text??""}get keyValue(){return this.runtime.keyValue}get baseline(){return this.runtime.baselineDisplay}get baselineDescr(){return function(e,t){const o=e||"";return t&&o?" "+o:o}(this.runtime.baselineDescr,this.baseline)}get baselineArrow(){return this.runtime.baselineArrow}get backgroundColor(){return this.runtime.background}get secondaryFontColor(){return OS(this.backgroundColor)}getTextDimensions(e,t){this.context.font=t;const o=this.context.measureText(e);return{width:o.width,height:o.actualBoundingBoxAscent+o.actualBoundingBoxDescent}}getFullTextDimensions(e,t){this.context.font=t;const o=this.context.measureText(e);return{width:o.width,height:o.fontBoundingBoxAscent+o.fontBoundingBoxDescent}}getTextStyles(){let e=16;const t=Math.floor(.9*e);return this.runtime.progressBar&&(e/=1.5),{title:{font:Ta(this.runtime.title.fontSize??14,this.runtime.title.bold,this.runtime.title.italic),color:this.runtime.title.color??this.secondaryFontColor},keyValue:{color:this.runtime.keyValueStyle?.textColor||this.runtime.fontColor,font:Ta(32,this.runtime.keyValueStyle?.bold,this.runtime.keyValueStyle?.italic),strikethrough:this.runtime.keyValueStyle?.strikethrough,underline:this.runtime.keyValueStyle?.underline},baselineValue:{font:Ta(e,this.runtime.baselineStyle?.bold,this.runtime.baselineStyle?.italic),strikethrough:this.runtime.baselineStyle?.strikethrough,underline:this.runtime.baselineStyle?.underline,color:this.runtime.baselineStyle?.textColor||this.runtime.baselineColor||this.secondaryFontColor},baselineDescr:{font:Ta(t),color:this.secondaryFontColor},baselineArrow:"neutral"===this.baselineArrow||this.runtime.progressBar?void 0:{size:this.keyValue?.8*e:0,color:this.runtime.baselineColor||this.secondaryFontColor}}}}class My extends t.Component{static template="o-spreadsheet-ScorecardChart";static props={figureUI:Object};canvas=t.useRef("chartContainer");get runtime(){return this.env.model.getters.getChartRuntime(this.props.figureUI.id)}get title(){const e=this.env.model.getters.getChartDefinition(this.props.figureUI.id).title.text??"";return ni(e)}setup(){t.useEffect(this.createChart.bind(this),(()=>{const e=this.canvas.el.getBoundingClientRect();return[e.width,e.height,this.runtime,this.canvas.el,window.devicePixelRatio]}))}createChart(){const e=this.canvas.el;Ty(Oy(e.getBoundingClientRect(),this.runtime),e)}}const Py=new n;function Ny(e,t,o,s){const i=[];e=e.toLowerCase();for(const n of e){const e=t.toLocaleLowerCase().indexOf(n);-1!==e&&(i.push({value:t.slice(0,e),color:""},{value:t[e],color:o,classes:[s]}),t=t.slice(e+1))}return i.push({value:t}),i.filter((e=>e.value))}function ky(e,t,o){const{x:s,y:i,width:n,height:r}=o;if(n<0||r<0)return;const l=t.color||a,{ctx:c}=e;c.save(),t.noBorder||(t.dashed&&c.setLineDash([5,3]),c.strokeStyle=l,t.thinLine?(c.lineWidth=1,c.strokeRect(s,i,n,r)):(c.lineWidth=2,c.strokeRect(s+.5,i+.5,n,r))),t.noFill||(c.fillStyle=oo(Wt(l),t.fillAlpha??.12),c.fillRect(s,i,n,r)),c.restore()}Py.add("dataValidation",{displayAllOnInitialContent:!0,canBeToggled:!1,getProposals(e,t){return Ht(t)?[]:this.composer.currentEditedCell?function(e,t){const o=e.getValidationRuleForCell(t);if(!o||"isValueInList"!==o.criterion.type&&"isValueInRange"!==o.criterion.type)return[];let s=[];if("isValueInList"===o.criterion.type)s=o.criterion.values.map((e=>({label:e,value:e})));else{const i=new Set,n=e.getRangeFromSheetXC(t.sheetId,o.criterion.values[0]);for(const t of os(n.zone)){const o=e.getEvaluatedCell({...t,sheetId:n.sheetId});o.formattedValue&&!i.has(o.formattedValue)&&(i.add(o.formattedValue),s.push({label:o.formattedValue,value:o.value}))}}return s}(this.getters,this.composer.currentEditedCell).map((e=>({text:e.value?.toString()||"",htmlContent:[{value:e.label}],fuzzySearchKey:e.label}))):[]},selectProposal(e,t){this.composer.setCurrentContent(t),this.composer.stopEdition()}}),Py.add("functions",{sequence:100,autoSelectFirstProposal:!0,maxDisplayedProposals:10,getProposals(e){if("SYMBOL"!==e.type)return[];const t=e.value;if(!Ht(this.composer.currentContent))return[];const o=Object.entries(Kb.content).filter((([e,{hidden:t}])=>!t)).map((([e,{description:o}])=>({text:e,description:o,htmlContent:Ny(t,e,E,"o-semi-bold")}))).sort(((e,t)=>e.text.length-t.text.length||e.text.localeCompare(t.text)));return o},selectProposal(e,t){let o=e.end,s=e.end;["SYMBOL","FUNCTION"].includes(e.type)&&(o=e.start);const i=this.composer.currentTokens;t+="(";const n=i.map((e=>e.start)).indexOf(e.start);if(n+1<i.length){const e=i[n+1];"LEFT_PAREN"===e?.type&&s++}this.composer.changeComposerCursorSelection(o,s),this.composer.replaceComposerCursorSelection(t)}});class Vy extends vh{mutators=["register","unRegister"];providers=[];constructor(e){super(e),this.onDispose((()=>{this.providers=[]}))}get renderingLayers(){return["Highlights"]}get highlights(){const e=this.getters.getActiveSheetId();return this.providers.flatMap((e=>e.highlights)).filter((t=>t.sheetId===e)).map((e=>{const{numberOfRows:t,numberOfCols:o}=Qo(e.zone),s=t*o==1?this.getters.expandZone(e.sheetId,e.zone):e.zone;return{...e,zone:s}}))}register(e){this.providers.push(e)}unRegister(e){this.providers=this.providers.filter((t=>t!==e))}drawLayer(e,t){if("Highlights"===t)for(const t of this.highlights){ky(e,t,this.getters.getVisibleRect(t.zone))}}}class Ly{mutators=["notifyUser","raiseError","askConfirmation","updateNotificationCallbacks"];notifyUser=e=>window.alert(e.text);askConfirmation=(e,t,o)=>{window.confirm(e)?t():o?.()};raiseError=(e,t)=>{window.alert(e),t?.()};updateNotificationCallbacks(e){this.notifyUser=e.notifyUser||this.notifyUser,this.raiseError=e.raiseError||this.raiseError,this.askConfirmation=e.askConfirmation||this.askConfirmation}}const Hy="#000000",Uy="#3da4ab",By={OPERATOR:Uy,NUMBER:"#02c39a",STRING:"#00a82d",FUNCTION:Hy,DEBUGGER:Uy,LEFT_PAREN:Hy,RIGHT_PAREN:Hy,ARG_SEPARATOR:Hy,ORPHAN_RIGHT_PAREN:"#ff0000"};class zy extends vh{mutators=["startEdition","setCurrentContent","stopEdition","stopComposerRangeSelection","cancelEdition","cycleReferences","toggleEditionMode","changeComposerCursorSelection","replaceComposerCursorSelection","hoverToken"];col=0;row=0;editionMode="inactive";sheetId="";_currentContent="";currentTokens=[];selectionStart=0;selectionEnd=0;initialContent="";colorIndexByRange={};hoveredTokens=[];hoveredContentEvaluation="";notificationStore=this.get(Ly);highlightStore=this.get(Vy);constructor(e){super(e),this.highlightStore.register(this),this.onDispose((()=>{this.highlightStore.unRegister(this)}))}handleEvent(e){const t=this.getters.getActiveSheetId();let o;if(o=e.options.unbounded?this.getters.getUnboundedZone(t,e.anchor.zone):e.anchor.zone,"newAnchor"===e.mode)"selecting"===this.editionMode&&this.insertSelectedRange(o);else"selecting"===this.editionMode?this.replaceSelectedRange(o):this.updateComposerRange(e.previousAnchor.zone,o)}changeComposerCursorSelection(e,t){this.isSelectionValid(this._currentContent.length,e,t)&&(this.selectionStart=e,this.selectionEnd=t,this.computeFormulaCursorContext(),this.computeParenthesisRelatedToCursor())}stopComposerRangeSelection(){this.isSelectingRange&&(this.editionMode="editing")}startEdition(e,t){if(t){const o=e||this.getComposerContent(this.getters.getActivePosition());if(!this.isSelectionValid(o.length,t.start,t.end))return}const{col:o,row:s}=this.getters.getActivePosition();this.model.dispatch("SELECT_FIGURE",{figureId:null}),this.model.dispatch("SCROLL_TO_CELL",{col:o,row:s}),"inactive"!==this.editionMode&&e?this.setContent(e,t):this._startEdition(e,t),this.updateTokenColor(),this.computeFormulaCursorContext(),this.computeParenthesisRelatedToCursor()}cancelEdition(){this.resetContent(),this.cancelEditionAndActivateSheet()}setCurrentContent(e,t){t&&!this.isSelectionValid(e.length,t.start,t.end)||(this.setContent(e,t,!0),this.updateTokenColor(),this.computeFormulaCursorContext(),this.computeParenthesisRelatedToCursor())}replaceComposerCursorSelection(e){this.replaceSelection(e)}handle(e){switch(e.type){case"SELECT_FIGURE":e.figureId&&(this.resetContent(),this.cancelEditionAndActivateSheet());break;case"START_CHANGE_HIGHLIGHT":const{left:t,top:o}=e.zone;this.isSelectingRange&&(this.editionMode="editing"),this.model.selection.resetAnchor(this,{cell:{col:t,row:o},zone:e.zone})}}get currentContent(){return"inactive"===this.editionMode?this.getComposerContent(this.getters.getActivePosition()):this._currentContent}get composerSelection(){return{start:this.selectionStart,end:this.selectionEnd}}get isSelectingRange(){return"selecting"===this.editionMode}get showSelectionIndicator(){return this.isSelectingRange&&this.canStartComposerRangeSelection()}get tokenAtCursor(){const e=Math.min(this.selectionStart,this.selectionEnd),t=Math.max(this.selectionStart,this.selectionEnd);return e===t&&0===t?void 0:this.currentTokens.find((o=>o.start<=e&&o.end>=t))}cycleReferences(){const e=this.getters.getLocale(),t=Zf(this.composerSelection,this._currentContent,e);void 0!==t&&this.setCurrentContent(t.content,t.selection)}toggleEditionMode(){if("inactive"===this.editionMode)return;const e=Math.min(this.selectionStart,this.selectionEnd),t=Math.max(this.selectionStart,this.selectionEnd),o=[...this.currentTokens].reverse().find((o=>o.end>=e&&t>=o.start&&"REFERENCE"===o.type));if("editing"===this.editionMode&&o){const e=this.getters.getActiveSheetId(),{sheetName:t,xc:s}=Jr(o.value),i=this.getters.getSheetIdByName(t);i&&i!==e&&this.model.dispatch("ACTIVATE_SHEET",{sheetIdFrom:e,sheetIdTo:i}),this.selectionStart=this.selectionEnd=o.end;const n=this.getters.getRangeFromSheetXC(this.sheetId,s).zone;this.captureSelection(n),this.editionMode="selecting"}else this.editionMode="editing"}hoverToken(e){this.currentTokens.forEach((e=>e.isInHoverContext=void 0));const t=[...this.currentTokens];if(void 0===e||["ARG_SEPARATOR","SPACE"].includes(t[e].type))return this.hoveredContentEvaluation="",void(this.hoveredTokens=[]);const o=this.getNumberOfMissingParenthesis(t);o>0&&t.push(...Array(o).fill({value:")",type:"RIGHT_PAREN"}));let s=t;if(0!==e){const o=this.getRelatedTokens(t,e),i=t.filter((e=>!o.includes(e)&&"SPACE"!==e.type));s=1===i.length&&i[0]===t[0]?t:o}s.forEach((e=>e.isInHoverContext=!0));let i=s.map((e=>e.value)).join("");Ht(i)||(i=`=${i}`);const n=bl(i,this.getters.getLocale()),r=this.getters.evaluateFormulaResult(this.sheetId,n);this.hoveredTokens=s,this.hoveredContentEvaluation=this.evaluationResultToDisplayString(r)}getRelatedTokens(e,t){try{const o=Nf(e);let s;for(const e of Vf(o))if(t>=e.tokenStartIndex&&t<=e.tokenEndIndex)s=e;else if(t<e.tokenStartIndex)break;return s?e.slice(s.tokenStartIndex,s.tokenEndIndex+1):e}catch(t){if(t instanceof Di)return e;throw t}}evaluationResultToDisplayString(e){const t=this.getters.getLocale();if(Ii(e)){const o=","===t.decimalSeparator?"/":",";return`{${un(e).map((e=>e.map((e=>this.cellValueToDisplayString(e))).join(o))).join(";")}}`}return this.cellValueToDisplayString(e)}cellValueToDisplayString(e){const t=e.value;switch(typeof t){case"number":return sr(t,{locale:this.getters.getLocale(),format:e.format});case"string":return Hi(t)?t:`"${t}"`;case"boolean":return t?"TRUE":"FALSE"}return"0"}captureSelection(e,t,o){this.model.selection.capture(this,{cell:{col:t??e.left,row:o??e.right},zone:e},{handleEvent:this.handleEvent.bind(this),release:()=>{this._stopEdition()}})}isSelectionValid(e,t,o){return t>=0&&t<=e&&o>=0&&o<=e}startComposerRangeSelection(){if(this.sheetId===this.getters.getActiveSheetId()){const e=rs({col:this.col,row:this.row});this.model.selection.resetAnchor(this,{cell:{col:this.col,row:this.row},zone:e})}this.editionMode="selecting"}_startEdition(e,t){const o=this.getters.getActiveCell(),s=this.getters.getLocale();e&&o.format?.includes("%")&&Xs(e,s)&&(t=t||{start:e.length,end:e.length},e=`${e}%`);const{col:i,row:n,sheetId:r}=this.getters.getActivePosition();this.col=i,this.sheetId=r,this.row=n,this.initialContent=this.getComposerContent({sheetId:r,col:i,row:n}),this.editionMode="editing",this.setContent(e||this.initialContent,t),this.colorIndexByRange={};const a=rs({col:this.col,row:this.row});this.captureSelection(a,i,n)}_stopEdition(){if("inactive"!==this.editionMode){this.cancelEditionAndActivateSheet();let e=this.getCurrentCanonicalContent();if(!(this.initialContent!==e))return;if(e&&Ht(e)){const t=this.getNumberOfMissingParenthesis(this.currentTokens);t>0&&(e+=ut(new Array(t).fill(")")))}this.confirmEdition(e)}}getCurrentCanonicalContent(){return bl(this._currentContent,this.getters.getLocale())}cancelEditionAndActivateSheet(){if("inactive"===this.editionMode)return;this._cancelEdition();this.getters.getActiveSheetId()!==this.sheetId&&this.model.dispatch("ACTIVATE_SHEET",{sheetIdFrom:this.getters.getActiveSheetId(),sheetIdTo:this.sheetId})}_cancelEdition(){"inactive"!==this.editionMode&&(this.editionMode="inactive",this.model.selection.release(this),this.colorIndexByRange={},this.hoveredTokens=[],this.hoveredContentEvaluation="")}resetContent(){this.setContent(this.initialContent||"")}setContent(e,t,o){const s=this._currentContent!==e;if(this._currentContent=e,t?(this.selectionStart=t.start,this.selectionEnd=t.end):this.selectionStart=this.selectionEnd=e.length,s||"inactive"!==this.editionMode){const t=this.getters.getLocale();this.currentTokens=Ht(e)?$f(e,t):[],this.currentTokens.length>100&&o&&this.notificationStore.raiseError(ni("This formula has over 100 parts. It can't be processed properly, consider splitting it into multiple cells"))}this.canStartComposerRangeSelection()&&this.startComposerRangeSelection()}getAutoCompleteProviders(){return Py.getAll()}insertSelectedRange(e){const t=Math.min(this.selectionStart,this.selectionEnd),o=this.getZoneReference(e);this.canStartComposerRangeSelection()?this.insertText(o,t):this.insertText(","+o,t)}replaceSelectedRange(e){const t=this.getZoneReference(e),o=this.tokenAtCursor,s="REFERENCE"===o?.type?o.start:this.selectionStart;this.replaceText(t,s,this.selectionEnd)}updateComposerRange(e,t){const o=this.getters.getActiveSheetId(),s=this.tokenAtCursor,i=(s?[s,...this.currentTokens]:this.currentTokens).filter((e=>"REFERENCE"===e.type)).find((t=>{const{xc:s,sheetName:i}=Jr(t.value),n=i||this.getters.getSheetName(this.sheetId);if(!na(this.getters.getSheetName(o),n))return!1;const r=this.getters.getRangeFromSheetXC(o,s);return Yo(this.getters.expandZone(o,r.zone),e)}));if(!i)return;const n=this.getters.getRangeFromSheetXC(o,i.value);this.selectionStart=i.start,this.selectionEnd=this.selectionStart+i.value.length;const r=this.getters.getRangeFromZone(o,t),a=this.getRangeReference(r,n.parts);this.replaceSelection(a)}getZoneReference(e){const t=this.sheetId,o=this.getters.getActiveSheetId(),s=this.getters.getRangeFromZone(o,e);return this.getters.getSelectionRangeString(s,t)}getRangeReference(e,t){const o={...e,parts:[...t]};return this.getters.getSelectionRangeString(o,this.sheetId)}replaceSelection(e){const t=Math.min(this.selectionStart,this.selectionEnd),o=Math.max(this.selectionStart,this.selectionEnd);this.replaceText(e,t,o)}replaceText(e,t,o){this._currentContent=this._currentContent.slice(0,t)+this._currentContent.slice(o,this._currentContent.length),this.insertText(e,t)}insertText(e,t){const o=this._currentContent.slice(0,t)+e+this._currentContent.slice(t),s=t+e.length;this.setCurrentContent(o,{start:s,end:s})}updateTokenColor(){this.updateRangeColor();for(let e=0;e<this.currentTokens.length;e++)this.currentTokens[e].color=this.getTokenColor(this.currentTokens[e])}getTokenColor(e){if("REFERENCE"===e.type){const{xc:t,sheetName:o}=Jr(e.value);return this.rangeColor(t,o)||Hy}if("SYMBOL"===e.type){const t=e.value.toUpperCase();if("TRUE"===t||"FALSE"===t)return By.NUMBER;if(t in Kb.content)return By.FUNCTION}return["LEFT_PAREN","RIGHT_PAREN"].includes(e.type)&&""===e.parenthesesCode?By.ORPHAN_RIGHT_PAREN:By[e.type]||Hy}rangeColor(e,t){const o=t?this.model.getters.getSheetIdByName(t):this.sheetId,s=this.highlights.find((t=>{if(t.sheetId!==o)return!1;let s=this.model.getters.getRangeFromSheetXC(o,e).zone;return s=1===hs(s)?this.model.getters.expandZone(o,s):s,Yo(s,t.zone)}));return s&&s.color?s.color:void 0}computeFormulaCursorContext(){for(let e=0;e<this.currentTokens.length;e++)this.currentTokens[e].isBlurred=!1;if(this.selectionStart!==this.selectionEnd)return;const e=this.getParenthesesCodeAfterCursor(),t=[...this.currentTokens].reverse().find((t=>e.startsWith(t.parenthesesCode)&&"SYMBOL"===t.type));if(t)for(let e=0;e<this.currentTokens.length;e++)(this.currentTokens[e].parenthesesCode||"").startsWith(t.parenthesesCode||"")||(this.currentTokens[e].isBlurred=!0)}getParenthesesCodeAfterCursor(){const e=this.tokenAtCursor?.parenthesesCode||"";return"RIGHT_PAREN"===this.tokenAtCursor?.type?e.slice(0,-1)||"":e}computeParenthesisRelatedToCursor(){for(let e=0;e<this.currentTokens.length;e++)this.currentTokens[e].isParenthesisLinkedToCursor=!1;const e=this.tokenAtCursor;if(e&&""!==e.parenthesesCode&&["LEFT_PAREN","RIGHT_PAREN"].includes(e.type))for(let t=0;t<this.currentTokens.length;t++){const o=this.currentTokens[t];["LEFT_PAREN","RIGHT_PAREN"].includes(o.type)&&o.parenthesesCode===e.parenthesesCode&&o!==e&&(this.currentTokens[t].isParenthesisLinkedToCursor=!0,this.tokenAtCursor.isParenthesisLinkedToCursor=!0)}}updateRangeColor(){if(!Ht(this._currentContent)||"inactive"===this.editionMode)return;const e=this.sheetId,t=this.getReferencedRanges().map((t=>this.getters.getRangeString(t,e))),o={};for(const e of t)void 0!==this.colorIndexByRange[e]&&(o[e]=this.colorIndexByRange[e]);const s=new Set(Object.values(o));let i=0;const n=()=>{for(;s.has(i);)i++;return s.add(i),i};for(const e of t){const t=e in o?o[e]:n();o[e]=t}this.colorIndexByRange=o}get highlights(){if(!Ht(this.currentContent)||"inactive"===this.editionMode)return[];const e=this.sheetId,t=e=>{const t=this.colorIndexByRange[e];return zt[t%zt.length]};return this.getReferencedRanges().map((o=>{const s=this.getters.getRangeString(o,e),{numberOfRows:i,numberOfCols:n}=Qo(o.zone);return{zone:i*n==1?this.getters.expandZone(o.sheetId,o.zone):o.zone,color:t(s),sheetId:o.sheetId,interactive:!0}}))}getReferencedRanges(){const e=this.sheetId;return this.currentTokens.filter((e=>"REFERENCE"===e.type)).map((t=>this.getters.getRangeFromSheetXC(e,t.value))).filter((e=>!e.invalidSheetName&&!e.invalidXc))}get autocompleteProvider(){const e=this.currentContent,t=Ht(e)?this.tokenAtCursor:{type:"STRING",value:e};if("inactive"===this.editionMode||!t||["TRUE","FALSE"].includes(t.value.toUpperCase())||!this.canStartComposerRangeSelection()&&!["SYMBOL","STRING","UNKNOWN"].includes(t.type))return;const o={composer:this,getters:this.getters},s=this.getAutoCompleteProviders().sort(((e,t)=>(e.sequence??1/0)-(t.sequence??1/0))).map((s=>({...s,getProposals:s.getProposals.bind(o,t,e),selectProposal:s.selectProposal.bind(o,t)})));for(const e of s){let o=e.getProposals();const s=o?.find((e=>e.text===t.value)),i=t.value.replace(/[ ,\(\)]/g,"");if(this._currentContent===this.initialContent&&e.displayAllOnInitialContent&&o?.length)return{proposals:o,selectProposal:e.selectProposal,autoSelectFirstProposal:e.autoSelectFirstProposal??!1,canBeToggled:e.canBeToggled};if(s&&this._currentContent!==this.initialContent)return;if(i&&o&&!["ARG_SEPARATOR","LEFT_PAREN","OPERATOR"].includes(t.type)){const e=xa(i,o,(e=>e.fuzzySearchKey||e.text));s&&!e.length||(o=e)}if(e.maxDisplayedProposals&&(o=o?.slice(0,e.maxDisplayedProposals)),o?.length)return{proposals:o,selectProposal:e.selectProposal,autoSelectFirstProposal:e.autoSelectFirstProposal??!1,canBeToggled:e.canBeToggled}}}canStartComposerRangeSelection(){if(Ht(this._currentContent)){const e=this.tokenAtCursor;if(!e)return!1;const t=this.currentTokens.map((e=>e.start)).indexOf(e.start);let o=t,s=e;for(;!["ARG_SEPARATOR","LEFT_PAREN","OPERATOR"].includes(s.type)||Qa.includes(s.value);){if("SPACE"!==s.type||o<1)return!1;o--,s=this.currentTokens[o]}for(o=t+1,s=this.currentTokens[o];s&&!["ARG_SEPARATOR","RIGHT_PAREN","OPERATOR"].includes(s.type);){if("SPACE"!==s.type)return!1;o++,s=this.currentTokens[o]}return!0}return!1}getNumberOfMissingParenthesis(e){return e.filter((e=>"LEFT_PAREN"===e.type)).length-e.filter((e=>"RIGHT_PAREN"===e.type)).length}}const $y=["PIVOT.VALUE","PIVOT.HEADER","PIVOT"];function Gy(e,t){const o=`"${t?`${e.name}:${t}`:e.name}"`,s=e.string!==e.name?e.string+o:o;return{text:o,description:e.string+(e.help?` (${e.help})`:""),htmlContent:[{value:o,color:By.STRING}],fuzzySearchKey:s}}function Wy(e,t){let o=e.end;const s=e.end;"ARG_SEPARATOR"!==e.type&&(o=e.start),this.composer.stopComposerRangeSelection(),this.composer.changeComposerCursorSelection(o,s),this.composer.replaceComposerCursorSelection(t)}function qy(e,t){let o=e.end;const s=e.end;"LEFT_PAREN"!==e.type&&(o=e.start),this.composer.stopComposerRangeSelection(),this.composer.changeComposerCursorSelection(o,s),this.composer.replaceComposerCursorSelection(t)}function Zy(e){const t=e.functionContext?.args[0];if(t&&["STRING","NUMBER"].includes(t.type))return t.value}function jy(e){return mS(e,$y)[0]}function Yy(e){return mS(e,$y).length}const Xy=new n;Xy.add("SPREADSHEET",!1),Py.add("pivot_ids",{sequence:50,autoSelectFirstProposal:!0,getProposals(e){const t=e.functionContext;if(!t||!["PIVOT.VALUE","PIVOT.HEADER","PIVOT"].includes(t.parent.toUpperCase())||0!==t.argPosition)return;const o=this.getters.getPivotIds();return o.includes(e.value)?void 0:o.map((e=>{const t=this.getters.getPivotCoreDefinition(e),o=`${this.getters.getPivotFormulaId(e)}`;return{text:o,description:t.name,htmlContent:[{value:o,color:By.NUMBER}],fuzzySearchKey:o+t.name,alwaysExpanded:!0}})).filter(lt)},selectProposal:qy}),Py.add("pivot_measures",{sequence:50,autoSelectFirstProposal:!0,getProposals(e){const t=e.functionContext;if("PIVOT.VALUE"!==t?.parent.toUpperCase()||1!==t.argPosition)return[];const o=Zy(e),s=this.getters.getPivotId(o);if(!s||!this.getters.isExistingPivot(s))return[];const i=this.getters.getPivot(s);return i.init(),i.isValid()?i.definition.measures.map((e=>{if("__count"===e.fieldName){const e='"__count"';return{text:e,description:ni("Count"),htmlContent:[{value:e,color:By.STRING}],fuzzySearchKey:ni("Count")+e}}return function(e){const t=`"${e.id}"`,o=e.displayName+e.fieldName+t;return{text:t,description:e.displayName,htmlContent:[{value:t,color:By.STRING}],fuzzySearchKey:o}}(e)})).filter(lt):[]},selectProposal:Wy}),Py.add("pivot_group_fields",{sequence:50,autoSelectFirstProposal:!0,getProposals(e){const t=e.functionContext;if(!t||!function(e){const t=e.functionContext;return"PIVOT.VALUE"===t?.parent.toUpperCase()&&t.argPosition>=2&&t.argPosition%2==0}(e)&&!function(e){const t=e.functionContext;return"PIVOT.HEADER"===t?.parent.toUpperCase()&&t.argPosition>=1&&t.argPosition%2==1}(e))return;const o=Zy(e),s=this.getters.getPivotId(o);if(!s||!this.getters.isExistingPivot(s))return;const i=this.getters.getPivot(s);i.init();const n=i.getFields(),{columns:r,rows:a}=i.definition;let l=t.args;"PIVOT.VALUE"===t?.parent.toUpperCase()?(l=l.filter(((e,t)=>t%2==0)),l=l.slice(1,t.argPosition)):l=l.filter(((e,t)=>t%2==1));const c=l.map((e=>e?.value)).filter(lt),h=r.map((e=>e.nameWithGranularity)),d=a.map((e=>e.nameWithGranularity)),u=[];let g=["ARG_SEPARATOR","SPACE"].includes(e.type)?c.at(-1):c.at(-2);const p=Xy.get(i.type);if(p&&g?.startsWith("#")&&(g=g.slice(1)),void 0===g&&(u.push(h[0]),u.push(d[0])),d.includes(g)){const e=d[d.indexOf(g)+1];u.push(e),u.push(h[0])}if(h.includes(g)){const e=h[h.indexOf(g)+1];u.push(e)}const m=u.filter(lt);return m.map((e=>{const[t,o]=e.split(":"),s=n[t];return s?Gy(s,o):void 0})).concat(m.map((e=>{if(!p)return;const t=e.split(":")[0],o=n[t];if(!o)return;const s=`"#${e}"`;return{text:s,description:ni("%s (positional)",o.string)+(o.help?` (${o.help})`:""),htmlContent:[{value:s,color:By.STRING}],fuzzySearchKey:o.string+s}}))).filter(lt)},selectProposal:Wy}),Py.add("pivot_group_values",{sequence:50,autoSelectFirstProposal:!0,getProposals(e){const t=e.functionContext;if(!t||!e||!function(e){const t=e.functionContext;return"PIVOT.VALUE"===t?.parent.toUpperCase()&&t.argPosition>=2&&t.argPosition%2==1}(e)&&!function(e){const t=e.functionContext;return"PIVOT.HEADER"===t?.parent.toUpperCase()&&t.argPosition>=1&&t.argPosition%2==0}(e))return;const o=Zy(e),s=this.getters.getPivotId(o);if(!s||!this.getters.isExistingPivot(s))return;const i=this.getters.getPivot(s);if(!i.isValid())return;const n=t.argPosition,r=e.functionContext?.args[n-1]?.value;if(!r)return;let a;try{a=i.definition.getDimension(r)}catch(e){return}return"month_number"===a.granularity?Object.values(tr).map(((e,t)=>({text:`${t+1}`,fuzzySearchKey:e.toString(),description:e.toString(),htmlContent:[{value:`${t+1}`,color:By.NUMBER}]}))):"quarter_number"===a.granularity?[1,2,3,4].map((e=>({text:`${e}`,fuzzySearchKey:`${e}`,description:ni("Quarter %s",e),htmlContent:[{value:`${e}`,color:By.NUMBER}]}))):"day_of_month"===a.granularity?je(1,32).map((e=>({text:`${e}`,fuzzySearchKey:`${e}`,description:"",htmlContent:[{value:`${e}`,color:By.NUMBER}]}))):"iso_week_number"===a.granularity?je(0,54).map((e=>({text:`${e}`,fuzzySearchKey:`${e}`,description:"",htmlContent:[{value:`${e}`,color:By.NUMBER}]}))):"day_of_week"===a.granularity?je(1,8).map((e=>({text:`${e}`,fuzzySearchKey:`${e}`,description:"",htmlContent:[{value:`${e}`,color:By.NUMBER}]}))):"hour_number"===a.granularity?je(0,24).map((e=>({text:`${e}`,fuzzySearchKey:`${e}`,description:"",htmlContent:[{value:`${e}`,color:By.NUMBER}]}))):"minute_number"===a.granularity?je(0,60).map((e=>({text:`${e}`,fuzzySearchKey:`${e}`,description:"",htmlContent:[{value:`${e}`,color:By.NUMBER}]}))):"second_number"===a.granularity?je(0,60).map((e=>({text:`${e}`,fuzzySearchKey:`${e}`,description:"",htmlContent:[{value:`${e}`,color:By.NUMBER}]}))):i.getPossibleFieldValues(a).map((({value:e,label:t})=>{const o="string"==typeof e,s=o?`"${e}"`:e.toString(),i=t===e?"":t;return{text:s,description:i,htmlContent:[{value:s,color:o?By.STRING:By.NUMBER}],fuzzySearchKey:s+i}}))},selectProposal:Wy}),Py.add("sheet_names",{sequence:150,autoSelectFirstProposal:!0,getProposals(e){return"SYMBOL"===e.type||"UNKNOWN"===e.type&&e.value.startsWith("'")?this.getters.getSheetIds().map((e=>{const t=We(this.getters.getSheetName(e));return{text:t,fuzzySearchKey:t.startsWith("'")?t:"'"+t}})):[]},selectProposal(e,t){const o=e.start,s=e.end;this.composer.changeComposerCursorSelection(o,s),this.composer.replaceComposerCursorSelection(t+"!")}});const Ky=new n;Ky.add("ALPHANUMERIC_INCREMENT_MODIFIER",{apply:(e,t)=>{e.current+=e.increment;const o=`${e.prefix}${e.current.toString().padStart(e.numberPostfixLength||0,"0")}`;return{cellData:{border:t.border,style:t.cell&&t.cell.style,format:t.cell&&t.cell.format,content:o},tooltip:{props:{content:o}}}}}).add("INCREMENT_MODIFIER",{apply:(e,t,o)=>{e.current+=e.increment;const s=e.current.toString(),i=o.getLocale(),n=sr(e.current,{format:t.cell?.format,locale:i});return{cellData:{border:t.border,style:t.cell&&t.cell.style,format:t.cell&&t.cell.format,content:s},tooltip:s?{props:{content:n}}:void 0}}}).add("DATE_INCREMENT_MODIFIER",{apply:(e,t,o)=>{const s=en(e.current,o.getLocale());s.setFullYear(s.getFullYear()+e.increment.years||0),s.setMonth(s.getMonth()+e.increment.months||0),s.setDate(s.getDate()+e.increment.days||0);const i=Ls(s);e.current=i;const n=o.getLocale(),r=sr(i,{format:t.cell?.format,locale:n});return{cellData:{border:t.border,style:t.cell&&t.cell.style,format:t.cell&&t.cell.format,content:i.toString()},tooltip:i?{props:{content:r}}:void 0}}}).add("COPY_MODIFIER",{apply:(e,t,o)=>{const s=t.cell?.content||"",i={locale:o.getLocale(),format:t.cell?.format};return{cellData:{border:t.border,style:t.cell&&t.cell.style,format:t.cell&&t.cell.format,content:s},tooltip:s?{props:{content:t.cell?_r(t.cell,i).formattedValue:""}}:void 0}}}).add("FORMULA_MODIFIER",{apply:(e,t,o,s)=>{e.current+=e.increment;let i=0,n=0;switch(s){case"up":i=0,n=-e.current;break;case"down":i=0,n=e.current;break;case"left":i=-e.current,n=0;break;case"right":i=e.current,n=0}const r=t.cell;if(!r||!r.isFormula)return{cellData:{}};const a=t.sheetId,l=o.getTranslatedCellFormula(a,i,n,r.compiledFormula.tokens);return{cellData:{border:t.border,style:r.style,format:r.format,content:l},tooltip:l?{props:{content:l}}:void 0}}});const Jy=new n,Qy=/(\d+)$/,eC=/^(.*\D+)/,tC=/^(.*\D+)(\d+)$/;function oC(e,t,o){let s=[],i=!1;for(let n of t){n===e&&(i=!0);const t=void 0===n||n.isFormula?void 0:_r(n,{locale:Ci,format:n.format});if(t&&o(t))s.push(t);else{if(i)return s;s=[]}}return s}function sC(e){let t=1;return e.length>=2&&(t=function(e){const t=[];let o=e[0];for(let s=1;s<e.length;s++){const i=e[s];t.push(i-o),o=i}return t.reduce(((e,t)=>e+t),0)/t.length}(e)*e.length),t}function iC(e){if(e.length<2)return 1;const t=e.map((e=>en(e,Ci))),o=function(e){if(e.length<2)return[{years:0,months:0,days:0}];const t=e.map(((t,o)=>{if(0===o)return{years:0,months:0,days:0};const s=Ss.fromTimestamp(e[o-1].getTime()),i=qs(s,t),n=Gs(s,t)%12;s.setFullYear(s.getFullYear()+i),s.setMonth(s.getMonth()+n);return{years:i,months:n,days:Ws(s,t)}}));return t.slice(1)}(t),s=(i=o).length<2?i[0]||{years:0,months:0,days:0}:i.every((e=>e.years===i[0].years&&e.months===i[0].months&&e.days===i[0].days))?i[0]:void 0;var i;if(void 0===s)return;const n=1===Object.values(s).filter((e=>0!==e)).length,r=Object.values(s).every((e=>0===e));if(!n||r){const o=t.map(((e,o)=>{if(0===o)return 0;const s=t[o-1];return Math.floor(e.getTime())-Math.floor(s.getTime())})).slice(1);if(o.every((e=>e===o[0])))return e.length*(e[1]-e[0])}return{years:s.years*e.length,months:s.months*e.length,days:s.days*e.length}}Jy.add("simple_value_copy",{condition:(e,t)=>!(1!==t.length||e.isFormula||e.format&&dr(e.format)),generateRule:()=>({type:"COPY_MODIFIER"}),sequence:10}).add("increment_alphanumeric_value",{condition:e=>!e.isFormula&&_r(e,{locale:Ci}).type===ai.text&&tC.test(e.content),generateRule:(e,t,o)=>{const s=parseInt(e.content.match(Qy)[0]),i=e.content.match(eC)[0],n=e.content.length-i.length,r=oC(e,t,(e=>e.type===ai.text&&tC.test(e.value))).filter((e=>i===(e.value??"").toString().match(eC)[0])).map((e=>parseInt((e.value??"").toString().match(Qy)[0])));let a=sC(r);return["up","left"].includes(o)&&1===r.length&&(a=-a),{type:"ALPHANUMERIC_INCREMENT_MODIFIER",prefix:i,current:s,increment:a,numberPostfixLength:n}},sequence:15}).add("copy_text",{condition:e=>!e.isFormula&&_r(e,{locale:Ci}).type===ai.text,generateRule:()=>({type:"COPY_MODIFIER"}),sequence:20}).add("update_formula",{condition:e=>e.isFormula,generateRule:(e,t)=>({type:"FORMULA_MODIFIER",increment:t.length,current:0}),sequence:30}).add("increment_dates",{condition:(e,t)=>!e.isFormula&&_r(e,{locale:Ci}).type===ai.number&&!!e.format&&dr(e.format),generateRule:(e,t)=>{const o=iC(oC(e,t,(e=>e.type===ai.number&&!!e.format&&dr(e.format))).map((e=>Number(e.value))));if(void 0===o)return{type:"COPY_MODIFIER"};const s=_r(e,{locale:Ci});return"object"==typeof o?{type:"DATE_INCREMENT_MODIFIER",increment:o,current:s.type===ai.number?s.value:0}:{type:"INCREMENT_MODIFIER",increment:o,current:s.type===ai.number?s.value:0}},sequence:25}).add("increment_number",{condition:e=>!e.isFormula&&_r(e,{locale:Ci}).type===ai.number,generateRule:(e,t,o)=>{const s=oC(e,t,(e=>e.type===ai.number&&!dr(e.format||""))).map((e=>Number(e.value)));let i=sC(s);["up","left"].includes(o)&&1===s.length&&(i=-i);const n=_r(e,{locale:Ci});return{type:"INCREMENT_MODIFIER",increment:i,current:n.type===ai.number?n.value:0}},sequence:40});const nC=new n,rC=30,aC=10,lC=20,cC=12,hC=80,dC="#F3F2F1",uC=6,gC=25;function pC(e,t){const o=e.getBoundingClientRect(),s=window.devicePixelRatio||1;e.width=s*o.width,e.height=s*o.height;const i=e.getContext("2d");i.scale(s,s);const n=function(e,t,o){const s=t.maxValue,i=t.minValue,n=t.gaugeValue,r=function(e,t){const o=t?gC:0,s=e.height-lC-o-aC,i=e.width-2*rC;let n,r;i>2*s?(n=2*s,r=s):(n=i,r=i/2);const a=o+aC+(s-r)/2;return{x:rC+(i-n)/2,y:a,width:n,height:r}}(e,t.title.text),a=r.width/6,l=n?(n.value-i.value)/(s.value-i.value):0,c={x:e.width/2,y:r.y+r.height-r.height/12};let h=hC;r.height<300&&(h*=r.height/300);const d=r.width/2,u=n?.label||"-";Da(o,u,{fontSize:h},"px")>d&&(h=function(e,t,o,s=.25){let i=1;if(o(i)>e)return i;if(o(t)<e)return t;let n=(i+t)/2,r=o(n),a=0;for(;Math.abs(r-e)>s&&a<20;)r>=e?t=(i+t)/2:i=(i+t)/2,n=(i+t)/2,r=o(n),a++;return n}(d,h,(e=>Da(o,u,{fontSize:e},"px"))));const g={x:r.x+a/2,y:r.y+r.height+cC},p={x:r.x+r.width-a/2,y:r.y+r.height+cC},m=OS(t.background),f=function(e,t,o,s){const i=e.maxValue,n=e.minValue,r={x:t.x+t.width/2,y:t.y+t.height},a={fontSize:cC},l=[],c=[];for(const h of e.inflectionValues){const e=(h.value-n.value)/(i.value-n.value),d=Da(s,h.label,a,"px"),u=Math.PI-Math.PI*e,g=SC(u,t.height+uC,r.x,r.y,d+2,cC);let p=c.some((e=>bC(e,g)))?cC:0;c.push(g),l.push({rotation:u,label:h.label,fontSize:cC,color:o,offset:p})}return l}(t,r,m,o);let v=0,b=0,S=0;t.title.text&&({width:b,height:S}=Fa(o,t.title.text,{fontSize:K,...t.title},"px"));switch(t.title.align){case"right":v=e.width-b-j;break;case"center":v=(e.width-b)/2;break;default:v=j}return{width:e.width,height:e.height,title:{label:t.title.text??"",fontSize:t.title.fontSize??K,textPosition:{x:v,y:X+S/2},color:t.title.color??m,bold:t.title.bold,italic:t.title.italic},backgroundColor:t.background,gauge:{rect:r,arcWidth:a,percentage:Ze(l,0,1),color:mC(t)},inflectionValues:f,gaugeValue:{label:u,textPosition:c,fontSize:h,color:m},minLabel:{label:t.minValue.label,textPosition:g,fontSize:cC,color:m},maxLabel:{label:t.maxValue.label,textPosition:p,fontSize:cC,color:m}}}(o,t,i);!function(e,t){e.save(),e.fillStyle=t.backgroundColor,e.fillRect(0,0,t.width,t.height),e.restore()}(i,n),function(e,t){e.save();const o=t.gauge,s=o.rect.x+o.rect.width/2,i=o.rect.y+o.rect.height,n=o.rect.height-o.arcWidth/2;if(n<0)return;const r=1===o.percentage?0:Math.PI*(1+o.percentage);e.strokeStyle=dC,e.beginPath(),e.lineWidth=o.arcWidth,e.arc(s,i,n,r,0),e.stroke(),e.strokeStyle=o.color,e.beginPath(),e.arc(s,i,n,Math.PI,r),e.stroke(),e.restore()}(i,n),function(e,t){const{x:o,y:s,width:i,height:n}=t.gauge.rect;for(const r of t.inflectionValues){e.save(),e.translate(o+i/2-.5,s+n-.5),e.rotate(Math.PI/2-r.rotation),e.lineWidth=2,e.strokeStyle=OS(t.backgroundColor)+"aa",e.beginPath(),e.moveTo(0,-(n-t.gauge.arcWidth)),e.lineTo(0,-n-3),e.stroke(),e.textAlign="center",e.font=`${r.fontSize}px ${ve}`,e.fillStyle=r.color;const a=-n-uC-r.offset;e.fillText(r.label,0,a),e.restore()}}(i,n),function(e,t){for(const o of[t.minLabel,t.maxLabel,t.gaugeValue])e.save(),e.textAlign="center",e.fillStyle=o.color,e.font=`${o.fontSize}px ${ve}`,e.fillText(o.label,o.textPosition.x,o.textPosition.y),e.restore()}(i,n),function(e,t){e.save();const o=t.title;e.font=Ta(o.fontSize,o.bold,o.italic),e.textBaseline="middle",e.fillStyle=o.color,e.fillText(o.label,o.textPosition.x,o.textPosition.y),e.restore()}(i,n)}function mC(e){const t=e.gaugeValue?.value;if(void 0===t)return dC;for(let o=0;o<e.inflectionValues.length;o++){const s=e.inflectionValues[o];if("<"===s.operator&&t<s.value)return e.colors[o];if("<="===s.operator&&t<=s.value)return e.colors[o]}return e.colors.at(-1)}function fC(e){return[{start:e.topLeft,end:e.topRight},{start:e.topRight,end:e.bottomRight},{start:e.bottomRight,end:e.bottomLeft},{start:e.bottomLeft,end:e.topLeft}]}function vC(e,t){const o=e.start,s=e.end,i=t.start,n=t.end;function r(e,t,o){return(o.y-e.y)*(t.x-e.x)>(t.y-e.y)*(o.x-e.x)}return r(o,i,n)!==r(s,i,n)&&r(o,s,i)!==r(o,s,n)}function bC(e,t){const o=fC(e),s=fC(t);for(const e of o)for(const t of s)if(vC(e,t))return!0;return!1}function SC(e,t,o,s,i,n){const r=Math.cos(e),a=Math.sin(e),l=r*t,c=a*t,h=a*(i/2),d=r*(i/2),u=r*(t+n),g=a*(t+n);return{bottomLeft:{x:l-h+o,y:s-(c+d)},bottomRight:{x:l+h+o,y:s-(c-d)},topRight:{x:u+h+o,y:s-(g-d)},topLeft:{x:u-h+o,y:s-(g+d)}}}class yC extends t.Component{static template="o-spreadsheet-GaugeChartComponent";canvas=t.useRef("chartContainer");get runtime(){return this.env.model.getters.getChartRuntime(this.props.figureUI.id)}setup(){t.useEffect((()=>pC(this.canvas.el,this.runtime)),(()=>{const e=this.canvas.el.getBoundingClientRect();return[e.width,e.height,this.runtime,this.canvas.el,window.devicePixelRatio]}))}}function CC(e){return 8===(e=Wt(e).replace("#","")).length?e.slice(6)+e.slice(0,6):e}yC.props={figureUI:Object};const wC={responsive:!0,maintainAspectRatio:!1,elements:{line:{fill:!1},point:{hitRadius:15}},animation:!1,events:["mousemove","mouseout","click","touchstart","touchmove","mouseup"]};function IC(e,t,o){const s=document.createElement("div");s.style.width=`${t.width}px`,s.style.height=`${t.height}px`;const i=document.createElement("canvas");let n;if(s.append(i),i.setAttribute("width",t.width.toString()),i.setAttribute("height",t.height.toString()),document.body.append(s),"chartJsConfig"in e){const t=ze(e.chartJsConfig);t.plugins=[EC];const o=new window.Chart(i,t);n=o.toBase64Image(),o.destroy()}else if("scorecard"===o){Ty(Oy(t,e),i),n=i.toDataURL()}else"gauge"===o&&(pC(i,e),n=i.toDataURL());return s.remove(),n}async function xC(e,t,o){const s=document.createElement("div");s.style.width=`${t.width}px`,s.style.height=`${t.height}px`,s.style.position="fixed",s.style.opacity="0";const i=document.createElement("canvas");s.append(i),i.setAttribute("width",t.width.toString()),i.setAttribute("height",t.height.toString()),document.body.append(s);let n=null;if("chartJsConfig"in e){const t=ze(e.chartJsConfig);t.plugins=[EC];const o=new window.Chart(i,t);n=await new Promise((e=>i.toBlob(e,"image/png"))),o.destroy()}else if("scorecard"===o){Ty(Oy(t,e),i),n=await new Promise((e=>i.toBlob(e,"image/png")))}else"gauge"===o&&(pC(i,e),n=await new Promise((e=>i.toBlob(e,"image/png"))));return s.remove(),n?new File([n],"chart.png",{type:"image/png"}):void 0}const EC={id:"customCanvasBackgroundColor",beforeDraw:e=>{const{ctx:t}=e;t.save(),t.globalCompositeOperation="destination-over",t.fillStyle="#ffffff",t.fillRect(0,0,e.width,e.height),t.restore()}},RC={Errors:{InvalidRange:ni("The range is invalid"),FirstArgMissing:ni("The argument is missing. Please provide a value"),SecondArgMissing:ni("The second argument is missing. Please provide a value"),MinNaN:ni("The minpoint must be a number"),MidNaN:ni("The midpoint must be a number"),MaxNaN:ni("The maxpoint must be a number"),ValueUpperInflectionNaN:ni("The first value must be a number"),ValueLowerInflectionNaN:ni("The second value must be a number"),MinBiggerThanMax:ni("Minimum must be smaller then Maximum"),MinBiggerThanMid:ni("Minimum must be smaller then Midpoint"),MidBiggerThanMax:ni("Midpoint must be smaller then Maximum"),LowerBiggerThanUpper:ni("Lower inflection point must be smaller than upper inflection point"),MinInvalidFormula:ni("Invalid Minpoint formula"),MaxInvalidFormula:ni("Invalid Maxpoint formula"),MidInvalidFormula:ni("Invalid Midpoint formula"),ValueUpperInvalidFormula:ni("Invalid upper inflection point formula"),ValueLowerInvalidFormula:ni("Invalid lower inflection point formula"),EmptyRange:ni("A range needs to be defined"),ValueCellIsInvalidFormula:ni("At least one of the provided values is an invalid formula"),Unexpected:ni("The rule is invalid for an unknown reason")},ColorScale:ni("Color scale"),IconSet:ni("Icon set"),DataBar:ni("Data bar")},TC={IsEmpty:ni("Is empty"),IsNotEmpty:ni("Is not empty"),ContainsText:ni("Contains"),NotContains:ni("Does not contain"),BeginsWith:ni("Starts with"),EndsWith:ni("Ends with"),Equal:ni("Is equal to"),NotEqual:ni("Is not equal to"),GreaterThan:ni("Is greater than"),GreaterThanOrEqual:ni("Is greater than or equal to"),LessThan:ni("Is less than"),LessThanOrEqual:ni("Is less than or equal to"),Between:ni("Is between"),NotBetween:ni("Is not between")},AC={Series:ni("Series"),BackgroundColor:ni("Background color"),StackedBarChart:ni("Stacked bar chart"),StackedLineChart:ni("Stacked line chart"),StackedAreaChart:ni("Stacked area chart"),StackedColumnChart:ni("Stacked column chart"),CumulativeData:ni("Cumulative data"),TreatLabelsAsText:ni("Treat labels as text"),AggregatedChart:ni("Aggregate"),Errors:{Unexpected:ni("The chart definition is invalid for an unknown reason"),InvalidDataSet:ni("The dataset is invalid"),InvalidLabelRange:ni("Labels are invalid"),InvalidScorecardKeyValue:ni("The key value is invalid"),InvalidScorecardBaseline:ni("The baseline value is invalid"),InvalidGaugeDataRange:ni("The data range is invalid"),EmptyGaugeRangeMin:ni("A minimum range limit value is needed"),GaugeRangeMinNaN:ni("The minimum range limit value must be a number"),EmptyGaugeRangeMax:ni("A maximum range limit value is needed"),GaugeRangeMaxNaN:ni("The maximum range limit value must be a number"),GaugeLowerInflectionPointNaN:ni("The lower inflection point value must be a number"),GaugeUpperInflectionPointNaN:ni("The upper inflection point value must be a number")},GeoChart:{ColorScales:{blues:ni("Blues"),cividis:ni("Cividis"),greens:ni("Greens"),greys:ni("Greys"),oranges:ni("Oranges"),purples:ni("Purples"),rainbow:ni("Rainbow"),reds:ni("Reds"),viridis:ni("Viridis")}}},DC={Custom:ni("Custom")},_C=ni("Merged cells are preventing this operation. Unmerge those cells and try again."),OC={Errors:{Unexpected:ni("Cannot split the selection for an unknown reason"),NoSplitSeparatorInSelection:ni("There is no match for the selected separator in the selection"),MoreThanOneColumnSelected:ni("Only a selection from a single column can be split"),SplitWillOverwriteContent:ni("Splitting will overwrite existing content")}},FC={Errors:{Unexpected:ni("Cannot remove duplicates for an unknown reason"),MoreThanOneRangeSelected:ni("Please select only one range of cells"),EmptyTarget:ni("Please select a range of cells containing values."),NoColumnsProvided:ni("Please select at latest one column to analyze."),WillRemoveExistingMerge:ni("This operation is not possible due to a merge. Please remove the merges first than try again.")}},MC={DateIs:{today:ni("today"),yesterday:ni("yesterday"),tomorrow:ni("tomorrow"),lastWeek:ni("in the past week"),lastMonth:ni("in the past month"),lastYear:ni("in the past year")},DateIsBefore:{today:ni("today"),yesterday:ni("yesterday"),tomorrow:ni("tomorrow"),lastWeek:ni("one week ago"),lastMonth:ni("one month ago"),lastYear:ni("one year ago")},CriterionError:{notEmptyValue:ni("The value must not be empty"),numberValue:ni("The value must be a number"),dateValue:ni("The value must be a date"),validRange:ni("The value must be a valid range"),validFormula:ni("The formula must be valid")},Errors:{InvalidRange:ni("The range is invalid."),InvalidDataValidationCriterionValue:ni("One or more of the provided criteria values are invalid. Please review and correct them."),InvalidNumberOfCriterionValues:ni("One or more of the provided criteria values are missing."),Unexpected:ni("The rule is invalid for an unknown reason.")}},PC={Errors:{Unexpected:ni("The table zone is invalid for an unknown reason"),TableOverlap:ni("You cannot create overlapping tables."),NonContinuousTargets:ni("A table can only be created on a continuous selection."),InvalidRange:ni("The range is invalid"),TargetOutOfSheet:ni("The range is out of the sheet")},Checkboxes:{hasFilters:ni("Filter button"),headerRow:ni("Header row(s)"),bandedRows:ni("Banded rows"),firstColumn:ni("First column"),lastColumn:ni("Last column"),bandedColumns:ni("Banded columns"),automaticAutofill:ni("Automatically autofill formulas"),totalRow:ni("Total row"),isDynamic:ni("Auto-adjust to formula result")},Tooltips:{filterWithoutHeader:ni("Cannot have filters without a header row"),isDynamic:ni("For tables based on array formulas only")}},NC={labels:{no_calculations:ni("No calculations"),"%_of_grand_total":ni("% of grand total"),"%_of_col_total":ni("% of column total"),"%_of_row_total":ni("% of row total"),"%_of":ni("% of"),"%_of_parent_row_total":ni("% of parent row total"),"%_of_parent_col_total":ni("% of parent column total"),"%_of_parent_total":ni("% of parent total"),difference_from:ni("Difference from"),"%_difference_from":ni("% difference from"),running_total:ni("Running total"),"%_running_total":ni("% Running total"),rank_asc:ni("Rank smallest to largest"),rank_desc:ni("Rank largest to smallest"),index:ni("Index")},descriptions:{"%_of_grand_total":()=>ni("Displayed as % of grand total"),"%_of_col_total":()=>ni("Displayed as % of column total"),"%_of_row_total":()=>ni("Displayed as % of row total"),"%_of":e=>ni('Displayed as % of "%s"',e),"%_of_parent_row_total":e=>ni('Displayed as % of parent row total of "%s"',e),"%_of_parent_col_total":()=>ni("Displayed as % of parent column total"),"%_of_parent_total":e=>ni('Displayed as % of parent "%s" total',e),difference_from:e=>ni('Displayed as difference from "%s"',e),"%_difference_from":e=>ni('Displayed as % difference from "%s"',e),running_total:e=>ni('Displayed as running total based on "%s"',e),"%_running_total":e=>ni('Displayed as % running total based on "%s"',e),rank_asc:e=>ni('Displayed as rank from smallest to largest based on "%s"',e),rank_desc:e=>ni('Displayed as rank largest to smallest based on "%s"',e),index:()=>ni("Displayed as index")},documentation:{no_calculations:ni("Displays the value that is entered in the field."),"%_of_grand_total":ni("Displays values as a percentage of the grand total of all the values or data points in the report."),"%_of_col_total":ni("Displays all the values in each column or series as a percentage of the total for the column or series."),"%_of_row_total":ni("Displays the value in each row or category as a percentage of the total for the row or category."),"%_of":ni("Displays values as a percentage of the value of the Base item in the Base field."),"%_of_parent_row_total":ni("Calculates values as follows:\n(value for the item) / (value for the parent item on rows)"),"%_of_parent_col_total":ni("Calculates values as follows:\n(value for the item) / (value for the parent item on columns)"),"%_of_parent_total":ni("Calculates values as follows:\n(value for the item) / (value for the parent item of the selected Base field)"),difference_from:ni("Displays values as the difference from the value of the Base item in the Base field."),"%_difference_from":ni("Displays values as the percentage difference from the value of the Base item in the Base field."),running_total:ni("Displays the value for successive items in the Base field as a running total."),"%_running_total":ni("Calculates the value as a percentage for successive items in the Base field that are displayed as a running total."),rank_asc:ni("Displays the rank of selected values in a specific field, listing the smallest item in the field as 1, and each larger value with a higher rank value."),rank_desc:ni("Displays the rank of selected values in a specific field, listing the largest item in the field as 1, and each smaller value with a higher rank value."),index:ni("Calculates values as follows:\n((value in cell) x (Grand Total of Grand Totals)) / ((Grand Row Total) x (Grand Column Total))")}},kC={second:1e3,minute:6e4,hour:36e5,day:864e5,month:2592e6,year:31536e6},VC={inSeconds:function(e){return Math.floor(e/kC.second)},inMinutes:function(e){return Math.floor(e/kC.minute)},inHours:function(e){return Math.floor(e/kC.hour)},inDays:function(e){return Math.floor(e/kC.day)},inMonths:function(e){return Math.floor(e/kC.month)},inYears:function(e){return Math.floor(e/kC.year)}},LC=/^((d|dd|m|mm|yyyy|yy|hh|h|ss|a)(-|:|\s|\/))*(d|dd|m|mm|yyyy|yy|hh|h|ss|a)$/i;function HC(e,t,o){const s=function(e){const t=e.indexOf("h");e=t>=0?e.slice(0,t).replace(/m/g,"M")+e.slice(t):e.replace(/m/g,"M");e.includes("a")||(e=e.replace(/h/g,"H"));return e}(t),i=function(e,t,o){const s=e.map((e=>Ns(e,o)?.jsDate));if(s.some((e=>void 0===e))||e.length<2)return;const i=s.map((e=>e.getTime())),n=Mt(i)-Pt(i),r=function(e){if(e.includes("s"))return"second";if(e.includes("m"))return"minute";if(e.includes("h")||e.includes("H"))return"hour";if(e.includes("d"))return"day";if(e.includes("M"))return"month";return"year"}(t);if(kC.second>=kC[r]&&VC.inSeconds(n)<180)return"second";if(kC.minute>=kC[r]&&VC.inMinutes(n)<180)return"minute";if(kC.hour>=kC[r]&&VC.inHours(n)<96)return"hour";if(kC.day>=kC[r]&&VC.inDays(n)<90)return"day";if(kC.month>=kC[r]&&VC.inMonths(n)<36)return"month";return"year"}(e,s,o),n={};return i&&(n[i]=s),{parser:s,displayFormats:n,unit:i??!1}}function UC(e,t,o,s){let i=nw(s,t,o).formattedValues,n=aw(s,t);PS(o,t[0],e.dataSetsHaveTitle||!1)&&i.shift(),({labels:i,dataSetsValues:n}=ow(i,n)),e.aggregated&&({labels:i,dataSetsValues:n}=sw(i,n));const r=rw(s,t,"left"),a=rw(s,t,"right"),l=e.horizontal?{x:r||a}:{y:r,y1:a},c=[];for(const t in n){const{data:o}=n[t],s=e.dataSets?.[t].trend;if(!s?.display||e.horizontal){c.push(void 0);continue}const i=jC(s,o);c.push(i)}return{dataSetsValues:n,trendDataSetsValues:c,axisFormats:l,labels:i,locale:s.getLocale()}}function BC(e,t,o,s){const i=UC(e,t,o,s),n=i.dataSetsValues.filter((e=>!e.hidden)),r=[];if(n[0]){const e=n[0].data.map((e=>e>0?e:0));r.push({...n[0],data:e})}if(n[1]){const e=n[1].data.map((e=>e>0?-e:0));r.push({...n[1],data:e})}return{...i,dataSetsValues:r}}function zC(e,t,o,s){const i=function(e,t,o,s){if(function(e,t,o,s){return!e.labelsAsText&&JC(e,t,o,s)}(e,t,o,s)&&function(){if(!window.Chart)return!1;const e="luxon"===new window.Chart._adapters._date({})._id;e||ew||(ew=!0,console.warn("'chartjs-adapter-luxon' time adapter is not installed. Time scale axes are disabled."));return e}())return"time";if(function(e,t,o,s){return!e.labelsAsText&&QC(e,t,o,s)}(e,t,o,s))return"linear";return"category"}(e,t,o,s),n=nw(s,t,o);let r="linear"===i?n.values:n.formattedValues,a=aw(s,t);const l=PS(o,t[0],e.dataSetsHaveTitle||!1);l&&r.shift(),({labels:r,dataSetsValues:a}=ow(r,a)),"time"===i&&({labels:r,dataSetsValues:a}=function(e,t){if(0===e.length||e.every((e=>!e)))return{labels:e,dataSetsValues:t};const o=[...e],s=ze(t);for(let e=0;e<o.length;e++)if(!o[e]){o[e]=pt(o,e);for(let t of s)t.data[e]=void 0}return{labels:o,dataSetsValues:s}}(r,a)),e.aggregated&&({labels:r,dataSetsValues:a}=sw(r,a)),e.cumulative&&(a=lw(a,"asc"));const c={y:rw(s,t,"left"),y1:rw(s,t,"right"),x:iw(s,o,l)},h=[];for(const t in a){const o=e.dataSets?.[t].trend;if(!o?.display){h.push(void 0);continue}const{data:n}=a[t];h.push(YC(o,n,r,i,s.getLocale()))}return{dataSetsValues:a,axisFormats:c,labels:r,locale:s.getLocale(),trendDataSetsValues:h,axisType:i}}function $C(e,t,o,s){let i=nw(s,t,o).formattedValues,n=aw(s,t);PS(o,t[0],e.dataSetsHaveTitle||!1)&&i.shift(),({labels:i,dataSetsValues:n}=ow(i,n)),e.aggregated&&({labels:i,dataSetsValues:n}=sw(i,n)),({dataSetsValues:n,labels:i}=function(e,t){const o=Math.max(e.length,...t.map((e=>e.data?.length||0))),s=je(0,o).filter((e=>t.some((t=>"number"==typeof t.data[e]&&t.data[e]>0))));return{labels:s.map((t=>e[t]||"")),dataSetsValues:t.map((e=>({...e,data:s.map((t=>"number"==typeof e.data[t]&&e.data[t]>0?e.data[t]:null))})))}}(i,n));return{dataSetsValues:n,axisFormats:{y:rw(s,t,"left")},labels:i,locale:s.getLocale()}}function GC(e,t,o,s){let i=nw(s,t,o).formattedValues,n=aw(s,t);PS(o,t[0],e.dataSetsHaveTitle||!1)&&i.shift(),({labels:i,dataSetsValues:n}=ow(i,n)),e.aggregated&&({labels:i,dataSetsValues:n}=sw(i,n));return{dataSetsValues:n,axisFormats:{r:rw(s,t,"left")||rw(s,t,"right")},labels:i,locale:s.getLocale()}}function WC(e,t,o,s){let i=nw(s,t,o).formattedValues;PS(o,t[0],e.dataSetsHaveTitle||!1)&&i.shift();let n=aw(s,t);({labels:i,dataSetsValues:n}=sw(i,n));return{dataSetsValues:n,axisFormats:{y:rw(s,t,"left")||rw(s,t,"right")},labels:i,locale:s.getLocale(),availableRegions:s.getGeoChartAvailableRegions(),geoFeatureNameToId:s.geoFeatureNameToId,getGeoJsonFeatures:s.getGeoJsonFeatures}}function qC(e,t,o,s){let i=nw(s,t,o).formattedValues,n=aw(s,t);PS(o,t[0],e.dataSetsHaveTitle||!1)&&i.shift(),({labels:i,dataSetsValues:n}=ow(i,n)),e.aggregated&&({labels:i,dataSetsValues:n}=sw(i,n)),e.cumulative&&(n=lw(n,"desc"));return{dataSetsValues:n,axisFormats:{x:rw(s,t,"left")||rw(s,t,"right")},labels:i,locale:s.getLocale()}}function ZC(e,t,o,s){let i=nw(s,t,o).values,n=function(e,t){t=t.filter((t=>!e.isColHidden(t.dataRange.sheetId,t.dataRange.zone.left)));const o=t.map((()=>({data:[],label:""}))),s=t.map((t=>tw(e,t)));if(!s.length)return o;const i=Math.min(...s.map((e=>e.length)));let n=[];const r=t.length-1;for(let e=0;e<i;e++)for(let t=0;t<s.length;t++){let i=s[t][e];null==i&&t!==r&&(i=n[t]),i!==n[t]&&(n=n.slice(0,t),n[t]=i),o[t].data.push(i??null)}return o.filter((e=>e.data.some((e=>null!==e))))}(s,t);const r=PS(o,t[0],e.dataSetsHaveTitle||!1);return r&&i.shift(),({labels:i,dataSetsValues:n}=function(e,t){const o=[],s=[];for(let t=0;t<e.length;t++)Number(e[t])<=0?s.push(t):Number(e[t])>0&&o.push(t);const i=o.length?o:s;return{labels:i.map((t=>e[t])),dataSetsValues:t.map((e=>({...e,data:i.map((t=>e.data[t]))})))}}(i,n)),({labels:i,dataSetsValues:n}=function(e,t){const o=Math.max(e.length,...t.map((e=>e.data?.length||0))),s=e=>null==e||""===e,i=je(0,o).filter((o=>{const i=t.map((e=>e.data?.[o]));if(s(i[0]))return!1;let n=!1;for(const e of i)if(n||=s(e),n&&!s(e))return!1;return e[o]&&!isNaN(Number(e[o]))}));return{labels:i.map((t=>e[t])),dataSetsValues:t.map((e=>({...e,data:i.map((t=>e.data[t]))})))}}(i,n)),{dataSetsValues:n,axisFormats:{y:iw(s,o,r)},labels:i,locale:s.getLocale()}}function jC(e,t){const o=[],s=[],i=[];for(let e=0;e<t.length;e++)"number"==typeof t[e]&&(o.push(t[e]),s.push(e+1)),i.push(e+1);const n=XC(e,o,s,je(.5,i.length+.55,.2));return n.length?n:void 0}function YC(e,t,o,s,i){const n=[],r=[],a=[],l=t.length;if(l<2)return;switch(s){case"category":for(let e=0;e<l;e++)"number"==typeof t[e]&&(n.push(t[e]),r.push(e+1)),a.push(e+1);break;case"linear":for(let e=0;e<t.length;e++){const s=Number(o[e]);isNaN(s)||("number"==typeof t[e]&&(n.push(t[e]),r.push(s)),a.push(s))}break;case"time":for(let e=0;e<t.length;e++){const s=zi({value:o[e]},i);null!==t[e]&&(n.push(t[e]),r.push(s)),a.push(s)}}const c=Math.min(...a),h=Math.max(...a);if(h===c)return;const d=(h-c)/(5*a.length),u=XC(e,n,r,je(c,h+d/2,d));return u.length?u:void 0}function XC(e,t,o,s){if(t.length<2||o.length<2||0===s.length)return[];const{normalizedLabels:i,normalizedNewLabels:n}=function(e,t,o){let s=[],i=[];if("logarithmic"===o.type){const o=Math.max(...e.map(Math.abs));s=e.map((e=>e/o)),i=t.map((e=>e/o))}else{const o=Math.max(...e),n=Math.min(...e),r=o-n;s=e.map((e=>(e-o)/r)),i=t.map((e=>(e-o)/r))}return{normalizedLabels:s,normalizedNewLabels:i}}(o,s,e);try{switch(e.type){case"polynomial":{const o=e.order;if(!o)return s.map((e=>({x:e,y:NaN})));if(1===o)return oc([t],[i],[n],!0)[0].map(((e,t)=>({x:s[t],y:e})));const r=Kl(t,i,o,!0).flat();return n.map(((e,t)=>({x:s[t],y:Ql(r,e,o)})))}case"exponential":{const e=[],o=[];for(let s=0;s<t.length;s++)t[s]>0&&(e.push(Math.log(t[s])),o.push(i[s]));return o.length?ec(oc([e],[o],[n],!0))[0].map(((e,t)=>({x:s[t],y:e}))):s.map((e=>({x:e,y:NaN})))}case"logarithmic":return oc([t],tc([i]),tc([n]),!0)[0].map(((e,t)=>({x:s[t],y:e})));case"trailingMovingAverage":return function(e,t,o=Ae){const s=[];for(let e=0;e<o-1;e++)s.push({x:t[e],y:NaN});for(let i=0;i<=e.length-o;i++){let n=0;for(let t=i;t<i+o;t++)n+=e[t];s.push({x:t[i+o-1],y:n/o})}return s}(t,o,e.window);default:return s.map((e=>({x:e,y:NaN})))}}catch(e){return s.map((e=>({x:e,y:NaN})))}}function KC(e,t,o,s){return JC(e,t,o,s)||QC(e,t,o,s)}function JC(e,t,o,s){if(!o||!QC(e,t,o,s))return!1;const i=iw(s,o,PS(o,t[0],e.dataSetsHaveTitle||!1));return Boolean(i&&LC.test(i))}function QC(e,t,o,s){if(!o)return!1;const i=s.getRangeValues(o);return PS(o,t[0],e.dataSetsHaveTitle||!1)&&i.shift(),!i.some((e=>isNaN(Number(e))&&e))&&!i.every((e=>!e))}let ew=!1;function tw(e,t){if(t.dataRange){const o=t.labelCell?[t.labelCell.zone]:[],s=Fo([t.dataRange.zone],o)[0];if(void 0===s)return[];const i=e.getRangeFromZone(t.dataRange.sheetId,s);return e.getRangeValues(i).map((e=>""===e?void 0:e))}return[]}function ow(e,t){const o=je(0,Math.max(e.length,...t.map((e=>e.data?.length||0)))).filter((o=>{const s=e[o],i=t.map((e=>e.data?.[o]));return s||i.some((e=>"number"==typeof e))}));return{labels:o.map((t=>e[t]||"")),dataSetsValues:t.map((e=>({...e,data:o.map((t=>"number"==typeof e.data[t]?e.data[t]:null))})))}}function sw(e,t){const o=new Set(e),s={};o.forEach((e=>{s[e]=new Array(t.length).fill(0)}));for(const o of je(0,e.length)){const n=e[o];for(const e of je(0,t.length))s[n][e]+="number"==typeof(i=t[e].data[o])?i:0}var i;return{labels:Array.from(o),dataSetsValues:t.map(((e,t)=>({...e,data:Array.from(o).map((e=>s[e][t]))})))}}function iw(e,t,o){if(!t)return;const{sheetId:s,zone:i}=t,n=os(i).map((t=>e.getEvaluatedCell({sheetId:s,...t}).format));return o&&n.shift(),n.find((e=>void 0!==e))}function nw(e,t,o){let s={values:[],formattedValues:[]};if(o){const{left:i}=o.zone;if(o.invalidXc||o.invalidSheetName||e.isColHidden(o.sheetId,i)){if(t[0]){s={formattedValues:je(0,tw(e,t[0]).length).map((e=>e.toString())),values:s.formattedValues}}}else s={formattedValues:e.getRangeFormattedValues(o),values:e.getRangeValues(o).map((e=>String(e??"")))}}else if(1===t.length){const o=tw(e,t[0]).length;for(let e=0;e<o;e++)s.formattedValues.push(""),s.values.push("")}else if(t[0]){s={formattedValues:je(0,tw(e,t[0]).length).map((e=>e.toString())),values:s.formattedValues}}return s}function rw(e,t,o){const s=t.filter((e=>"right"===o==!!e.rightYAxis));for(const t of s){const o=e.getRangeFormats(t.dataRange).find((e=>void 0!==e&&!dr(e)));if(o)return o}}function aw(e,t){const o=[];for(const[s,i]of Object.entries(t)){let t,n=e.isColHidden(i.dataRange.sheetId,i.dataRange.zone.left);if(i.labelCell){const o=i.labelCell,n=o?e.getEvaluatedCell({sheetId:o.sheetId,col:o.zone.left,row:o.zone.top}):void 0;t=n&&o?n.formattedValue:t=`${AC.Series} ${parseInt(s)+1}`}else t=`${AC.Series} ${parseInt(s)+1}`;let r=i.dataRange?tw(e,i):[];r.every((e=>"string"==typeof e&&!Hi(e)))&&r.some((e=>""!==e))?r.fill(1):r.every((e=>null==e||!Xs(e.toString(),Ci)))&&(n=!0),o.push({data:r,label:t,hidden:n})}return o}function lw(e,t){return e.map((e=>{const o=[];let s=0;const i="asc"===t?Object.keys(e.data):Object.keys(e.data).reverse();for(const t of i)isNaN(parseFloat(e.data[t]))?o[t]=e.data[t]:(s+=parseFloat(e.data[t]),o[t]=s);return{...e,data:o}}))}function cw(e){return{padding:{left:j,right:j,top:X,bottom:Y}}}function hw(e,t){return{display:"none"!==e.legendPosition,position:"none"!==e.legendPosition?e.legendPosition:void 0}}function dw(e,t){return{...Sw,...hw(e),...yw(_S(e.background),{pointStyle:"rect",lineWidth:3})}}function uw(e,t){const o=e.fillArea,s=o?"rect":"line",i=o?2:3;return{...Sw,...hw(e),...yw(_S(e.background),{pointStyle:s,lineWidth:i})}}function gw(e,t){const{dataSetsValues:o}=t,s=Math.max(0,...o.map((e=>e?.data?.length??0))),i=HS(new mo(s),o),n=_S(e.background);return{...hw(e),labels:{usePointStyle:!0,generateLabels:e=>e.data.labels?.map(((e,t)=>({text:US(String(e)),strokeStyle:i[t],fillStyle:i[t],pointStyle:"rect",lineWidth:2,fontColor:n})))||[],filter:(e,t)=>!("datasetIndex"in e)||!t.datasets[e.datasetIndex].hidden}}}function pw(e,t){return{...Sw,...hw(e),...yw(_S(e.background),{pointStyle:"circle",strokeStyle:e.background||"#ffffff",lineWidth:8})}}function mw(e,t){return{...Sw,...hw(e),...yw(_S(e.background),{lineWidth:3})}}function fw(e,t){const o=_S(e.background),s=e.negativeValuesColor||A,i=e.positiveValuesColor||T,n=e.subTotalValuesColor||D;return{...hw(e),labels:{usePointStyle:!0,generateLabels:()=>{const t=[{text:ni("Positive values"),fontColor:o,fillStyle:i,strokeStyle:i,pointStyle:"rect"},{text:ni("Negative values"),fontColor:o,fillStyle:s,strokeStyle:s,pointStyle:"rect"}];return(e.showSubTotals||e.firstValueAsSubtotal)&&t.push({text:ni("Subtotals"),fontColor:o,fillStyle:n,strokeStyle:n,pointStyle:"rect"}),t},filter:(e,t)=>!("datasetIndex"in e)||!t.datasets[e.datasetIndex].hidden},onClick:()=>{}}}function vw(e,t){const o=e.fillArea??!1,s=o?"rect":"line",i=o?2:3;return{...Sw,...hw(e),...yw(_S(e.background),{pointStyle:s,lineWidth:i})}}function bw(e,t){const o=_S(e.background);return{...hw(e),labels:{usePointStyle:!0,generateLabels:e=>{const t=e.data.datasets.at(-1);if(!t)return[];return t.groupColors.map((({color:e,label:t})=>({text:US(t),fontColor:o,fillStyle:e,strokeStyle:e,pointStyle:"rect"})))}}}}const Sw={onHover:e=>{const t=e.native?.target;t&&(t.style.cursor="pointer")},onLeave:e=>{const t=e.native?.target;t&&(t.style.cursor="default")},onClick:(e,t,o)=>{if("click"!==e.type)return;const s=t.datasetIndex;o.legendItems&&void 0!==s&&(o.chart.isDatasetVisible(s)?o.chart.hide(s):o.chart.show(s),e.native.preventDefault(),e.native.stopPropagation())}};function yw(e,t){return{labels:{color:e,usePointStyle:!0,generateLabels:o=>o.data.datasets.map(((s,i)=>BS(s.xAxisID)?{text:US(s.label),fontColor:e,strokeStyle:s.borderColor,hidden:!o.isDatasetVisible(i),pointStyle:"line",datasetIndex:i,lineWidth:3}:{text:US(s.label),fontColor:e,strokeStyle:s.borderColor,fillStyle:s.backgroundColor,hidden:!o.isDatasetVisible(i),pointStyle:"line"===s.type?"line":"rect",datasetIndex:i,...t})),filter:(e,t)=>!("datasetIndex"in e)||!t.datasets[e.datasetIndex].hidden}}}function Cw(e,t){let o={};const{trendDataSetsValues:s,locale:i,axisFormats:n}=t,r={stacked:e.stacked,locale:i};if(e.horizontal)o.x=Ow(e,"bottom","values",{...r,format:n?.x}),o.y=Ow(e,"left","labels",r);else{o.x=Ow(e,"bottom","labels",r);const t={...r,format:n?.y};o.y=Ow(e,"left","values",t);const s={...r,format:n?.y1};o.y1=Ow(e,"right","values",s)}if(o=St(o),s&&s.length&&s.some(lt)){const e=Math.max(...s.map((e=>e?.length||0)));o[SS]={...o.x,labels:Array(e).fill(""),offset:!1,display:!1},o[yS]={...o.x,offset:!0,display:!1}}return o}function ww(e,t){const{locale:o,axisType:s,trendDataSetsValues:i,labels:n,axisFormats:r}=t,a=r?.x,l=e.stacked;let c={x:Ow(e,"bottom","labels",{locale:o}),y:Ow(e,"left","values",{locale:o,stacked:l,format:r?.y}),y1:Ow(e,"right","values",{locale:o,stacked:l,format:r?.y1})};if(c=St(c),"time"===s&&n&&a){const e={type:"time",time:HC(n,a,o)};Object.assign(c.x,e),c.x.ticks.maxTicksLimit=15}else"linear"===s&&(c.x.type="linear",c.x.ticks.callback=e=>sr(e,{format:a,locale:o}));if(i&&i.length&&i.some(lt)&&(c[SS]={...c.x,display:!1},c[yS]={...c.x,display:!1},"category"===s||"time"===s)){const e=Math.max(...i.map((e=>e?.length||0)));c[SS].type="category",c[SS].labels=je(0,e).map((e=>e.toString())),c[SS].offset=!1,c[yS].type="category",c[yS].offset=!1}return c}function Iw(e,t){const o=ww(e,t);return{...o,x:{...o.x,grid:{display:!0}}}}function xw(e,t){const{locale:o,axisFormats:s}=t,i=s?.y||s?.y1;e.dataSets;const n={x:{...Ow(e,"bottom","labels",{locale:o}),grid:{display:!1}},y:{position:e.verticalAxisPosition,ticks:{color:_S(e.background),callback:VS({locale:o,format:i})},grid:{lineWidth:e=>0===e.tick.value?2:1},title:_w(e.axesDesign?.y)}},r=n?.y||n?.y1;return r&&(r.grid={lineWidth:e=>0===e.tick.value?2:1}),n}function Ew(e,t){const{dataSetsValues:o}=t,s=Cw(e,t),i=s.x.ticks.callback;s.x.ticks.callback=e=>i(Math.abs(e));const n=Math.max(...o.map((e=>Math.max(...e.data.map(Math.abs)))));return s.x.suggestedMin=-n,s.x.suggestedMax=n,s}function Rw(e,t){const{locale:o,axisFormats:s,dataSetsValues:i}=t,n=Math.min(...i.map((e=>Math.min(...e.data.filter((e=>!isNaN(e)))))));return{r:{beginAtZero:!0,ticks:{callback:VS({format:s?.r,locale:o}),backdropColor:e.background||"#FFFFFF"},pointLabels:{color:_S(e.background),callback:US},suggestedMin:n<0?n-1:0}}}function Tw(e,t){const{locale:o,axisFormats:s,availableRegions:i}=t,n=function(e){switch(e){case"top":return"top-left";case"right":return"top-right";case"bottom":return"bottom-right";case"left":case"none":return"bottom-left"}}(e.legendPosition),r=e.region?i.find((t=>t.id===e.region)):i[0],a=s?.y||s?.y1;return{projection:{projection:Dw(r?.defaultProjection||"mercator"),axis:"x"},color:{axis:"x",display:"none"!==e.legendPosition,border:{color:O},grid:{color:O},ticks:{color:_S(e.background),callback:VS({locale:o,format:a})},legend:{position:n,align:n.includes("right")?"left":"right",margin:Mw(e)},interpolate:Fw(e),missing:e.missingValueColor||"#ffffff"}}}function Aw(e,t){const o=t.dataSetsValues[0];return{x:{display:!1},y:{grid:{offset:!1},ticks:{callback:function(e){return US(this.getLabelForValue(e))}},border:{display:!1}},percentages:{position:"right",border:{display:!1},ticks:{callback:function(e,s,i){const n=o.data?.[s],r=o.data?.[0];return r&&void 0!==n?sr(n/r,{format:"0%",locale:t.locale}):""}},grid:{display:!1}}}}function Dw(e){return"conicConformal"===e?window.ChartGeo.geoConicConformal().rotate([100,0]):e}function _w(e){if(e?.title?.text){const{text:t,color:o,align:s,italic:i,bold:n}=e.title;return{display:!0,text:t,color:o,font:{style:i?"italic":"normal",weight:n?"bold":"normal",size:e.title.fontSize??J},align:"left"===s?"start":"right"===s?"end":"center"}}}function Ow(e,t,o,s){const{useLeftAxis:i,useRightAxis:n}=NS(e);if("left"===t&&!i||"right"===t&&!n)return;const r=_S(e.background);let a;if(a="bottom"===t?e.axesDesign?.x:"left"===t?e.axesDesign?.y:e.axesDesign?.y1,"values"===o){const e=!("right"===t&&i);return{position:t,title:_w(a),grid:{display:e},beginAtZero:!0,stacked:s?.stacked,ticks:{color:r,callback:VS(s)}}}return{ticks:{padding:5,color:r,callback:function(e){return US(this.getLabelForValue(e))}},grid:{display:!1},stacked:s?.stacked,title:_w(a)}}function Fw(e){if(!e.colorScale||"string"==typeof e.colorScale)return e.colorScale||"oranges";const t=[{value:0,color:e.colorScale.minColor}];return e.colorScale.midColor&&t.push({value:.5,color:e.colorScale.midColor}),t.push({value:1,color:e.colorScale.maxColor}),vo(t)}function Mw(e){switch(e.legendPosition){case"top":case"right":return{top:!!e.title.text?X+30:X,left:j,right:j};case"bottom":case"left":case"none":return{left:j,right:j,bottom:Y}}}const Pw={showValues:!1,showLabels:!0,valuesDesign:{align:"center",fontSize:13}};function Nw(e,t){const{axisFormats:o,locale:s}=t;return{horizontal:"horizontal"in e&&e.horizontal,showValues:"showValues"in e&&!!e.showValues,background:e.background,callback:(t,i)=>{const n=function(e,t){if(t.rAxisID)return t.rAxisID;const o="horizontal"in e&&e.horizontal?t.xAxisID:t.yAxisID;return o||"y"}(e,i);return kS(o,s)(t,n)}}}function kw(e,t){const{axisFormats:o,locale:s}=t;return{callback:kS(o,s),showLabels:e.showLabels??Pw.showLabels,showValues:e.showValues??Pw.showValues,style:{fontSize:e.valuesDesign?.fontSize??Pw.valuesDesign.fontSize,align:e.valuesDesign?.align??Pw.valuesDesign.align,bold:e.valuesDesign?.bold??Pw.valuesDesign.bold,italic:e.valuesDesign?.italic??Pw.valuesDesign.italic,textColor:e.valuesDesign?.color??Pw.valuesDesign.color}}}function Vw(e,t){const{axisFormats:o,locale:s}=t;return{horizontal:!0,showValues:"showValues"in e&&!!e.showValues,background:e.background,callback:(e,t)=>0===(e=Math.abs(Number(e)))?"":kS(o,s)(e,t.xAxisID||"x")}}function Lw(e,t){const{axisFormats:o,locale:s,dataSetsValues:i}=t,n=i.reduce(((e,t)=>(e.push((e.at(-1)||-1)+t.data.length+1),e)),[]);return{showValues:"showValues"in e&&!!e.showValues,background:e.background,callback:(t,i,r)=>{const a=i._dataset.data[r],l=a[1]-a[0];let c=l>=0?"+":"";return e.showSubTotals&&n.includes(r)&&"+"===c&&(c=""),`${c}${kS(o,s)(l,i.yAxisID)}`}}}function Hw(e){const t=e.title,o=OS(e.background);return{display:!!t.text,text:ni(t.text),color:t?.color??o,align:"center"===t.align?"center":"right"===t.align?"end":"start",font:{size:e.title.fontSize??K,weight:t.bold?"bold":"normal",style:t.italic?"italic":"normal"},padding:{bottom:"top"===e.legendPosition?0:j}}}const Uw='\n<templates>\n <t t-name="o-spreadsheet-CustomTooltip">\n <div\n class="o-chart-custom-tooltip border rounded px-2 py-1 pe-none mw-100 position-absolute text-nowrap shadow opacity-100">\n <table class="overflow-hidden m-0">\n <thead t-if="title">\n <tr>\n <th class="o-tooltip-title align-baseline border-0 text-truncate" t-esc="title" t-attf-style="max-width: {{ labelsMaxWidth }}"/>\n </tr>\n </thead>\n <tbody>\n <tr t-foreach="tooltipItems" t-as="tooltipItem" t-key="tooltipItem_index">\n <td>\n <span\n class="badge ps-2 py-2 rounded-0 align-middle"\n t-attf-style="background-color: {{ tooltipItem.boxColor }}"\n > </span>\n <small\n t-if="tooltipItem.label"\n class="o-tooltip-label d-inline-block text-truncate align-middle smaller ms-2"\n t-esc="tooltipItem.label"\n t-attf-style="max-width: {{ labelsMaxWidth }}"\n />\n </td>\n <td class="o-tooltip-value ps-2 fw-bolder text-end">\n <small class="smaller d-inline-block text-truncate align-middle" t-attf-style="max-width: {{ valuesMaxWidth }}">\n <t t-esc="tooltipItem.value"/>\n <t t-if="tooltipItem.percentage">\n (\n <t t-esc="tooltipItem.percentage"/>\n %)\n </t>\n </small>\n </td>\n </tr>\n </tbody>\n </table>\n </div>\n </t>\n</templates>\n';let Bw;function zw(e,o={}){return function(e,o={}){Bw||(Bw=new t.App(t.Component,{templates:Uw,translateFn:ni}));const s=Bw.getTemplate(e),i=s(o,{}),n=document.createElement("div");return t.blockDom.mount(i,n),n}(e,o).innerHTML}function $w(e,t){return{enabled:!1,external:Qw,callbacks:{title:function(e){return e.some((e=>!BS(e.dataset.xAxisID)))?void 0:""},beforeLabel:e=>e.dataset?.label||e.label,label:function(o){const s=e.horizontal;let i=s?o.parsed.x:o.parsed.y;null==i&&(i=o.parsed);const n=s?o.dataset.xAxisID:o.dataset.yAxisID;return kS(t.axisFormats,t.locale)(i,n)}}}}function Gw(e,t){const{axisType:o,locale:s,axisFormats:i}=t,n=i?.x,r={enabled:!1,external:Qw,callbacks:{}};return r.callbacks.label="linear"===o?e=>{const t=e.parsed.y;let o=BS(e.dataset.xAxisID)?"":e.parsed.x;"string"==typeof o&&Xs(o,s)&&(o=zi(o,s));const r=sr(o,{locale:s,format:n}),a=e.dataset.yAxisID||"y",l=sr(t,{locale:s,format:i?.[a]});return r?`(${r}, ${l})`:`${l}`}:function(e){const t=e.parsed.y,o=e.dataset.yAxisID;return kS(i,s)(t,o)},r.callbacks.beforeLabel=e=>e.dataset?.label||e.label,r.callbacks.title=function(e){return"linear"!==o&&e.some((e=>!BS(e.dataset.xAxisID)))?void 0:""},r}function Ww(e,t){const{locale:o,axisFormats:s}=t,i=s?.y||s?.y1;return{enabled:!1,external:Qw,callbacks:{title:function(e){return e[0].dataset.label},beforeLabel:e=>e.label||e.dataset.label,label:function(e){const t=function(e,t){const o=e.filter((e=>"number"==typeof e)).reduce(((e,t)=>e+t),0);if(!o)return"";const s=e[t]/o*100;return s.toFixed(2)}(e.dataset.data,e.dataIndex),s=e.parsed.y??e.parsed;return`${sr(s,{format:!i&&s>=1e3?"#,##":i,locale:o})} (${t}%)`}}}}function qw(e,t){const{dataSetsValues:o,locale:s,axisFormats:i,labels:n}=t,r=i?.y||i?.y1,a=o.map((e=>e.label));return{enabled:!1,external:Qw,callbacks:{beforeLabel:function(e){const t=n.length?Math.floor(e.dataIndex/n.length):0;return a[t]},label:function(e){const[t,o]=e.raw,i=o-t;return sr(i,{format:!r&&Math.abs(i)>1e3?"#,##":r,locale:s})}}}}function Zw(e,t){const o=$w(e,t);return{...o,callbacks:{...o.callbacks,label:e=>{const t={...e,parsed:{y:e.parsed.y,x:Math.abs(e.parsed.x)}};return(o?.callbacks?.label)(t)}}}}function jw(e,t){const{locale:o,axisFormats:s}=t;return{enabled:!1,external:Qw,callbacks:{beforeLabel:e=>e.dataset?.label||e.label,label:function(e){return sr(e.parsed.r,{format:s?.r,locale:o})}}}}function Yw(e,t){const{locale:o,axisFormats:s}=t,i=s?.y||s?.y1;return{enabled:!1,external:Qw,filter:function(e){return void 0!==e.raw.value},callbacks:{beforeLabel:e=>e.raw.feature.properties.name,label:function(e){const t=e.raw.value;return sr(t,{format:!i&&Math.abs(t)>=1e3?"#,##":i,locale:o})}}}}function Xw(e,t){return{enabled:!1,external:Qw,position:"funnelTooltipPositioner",callbacks:{title:()=>"",beforeLabel:e=>e.label,label:function(e){const o=e.parsed.x,s=e.dataset.xAxisID;return kS(t.axisFormats,t.locale)(o,s)}}}}function Kw(e,t){const{locale:o,axisFormats:s}=t,i=s?.y||s?.y1;return{enabled:!1,external:Qw,filter:function(e){const t=e.raw;return t?.label!==qS},callbacks:{title:()=>"",beforeLabel:e=>e.raw.groups.join(" / "),label:function(e){const t=e.raw.value;return sr(t,{format:!i&&t>=1e3?"#,##":i,locale:o})}}}}function Jw(e,t){const{locale:o,axisFormats:s}=t,i=s?.y;return{enabled:!1,external:Qw,filter:(e,t,o)=>t===o.length-1,callbacks:{title:()=>"",beforeLabel:e=>{const t=e.raw._data.children[0];if(!t)return"";const o=[];for(let s=0;s<=e.raw.l;s++)o.push(t[s]);return o.join(" / ")},label:e=>{const t=e.raw.v;return sr(t,{format:!i&&t>=1e3?"#,##":i,locale:o})}}}}function Qw({chart:e,tooltip:t}){if(e.canvas.parentNode.querySelector("div.o-chart-custom-tooltip")?.remove(),0===t.opacity||0===t.dataPoints.length)return;const o=t.body.map(((e,o)=>{let s=e.before[0],i=e.lines[0];i||(i=s,s="");const n=t.labelColors[o].backgroundColor;return{label:s,value:i,boxColor:"string"==typeof n?oo(n,1):n}})),s=zw("o-spreadsheet-CustomTooltip",{labelsMaxWidth:Math.floor(.5*e.canvas.clientWidth)+"px",valuesMaxWidth:Math.floor(.25*e.canvas.clientWidth)+"px",title:t.title[0],tooltipItems:o}),i=Object.assign(document.createElement("template"),{innerHTML:s}).content.firstChild;e.canvas.parentNode?.appendChild(i),Object.assign(i.style,{left:eI(e,t,i.clientWidth)+"px",top:Math.floor(t.caretY-i.clientHeight/2)+"px"})}function eI(e,t,o){const s=t.caretX;return s+o>e.chartArea.right?Math.max(0,s-o):s}var tI=Object.freeze({__proto__:null,GHOST_SUNBURST_VALUE:qS,INTERACTIVE_LEGEND_CONFIG:Sw,canChartParseLabels:KC,getBarChartData:UC,getBarChartDatasets:ZS,getBarChartLegend:dw,getBarChartScales:Cw,getBarChartTooltip:$w,getChartColorsGenerator:dy,getChartLabelFormat:iw,getChartLayout:cw,getChartShowValues:Nw,getChartTitle:Hw,getComboChartDatasets:JS,getComboChartLegend:mw,getData:tw,getFunnelChartData:qC,getFunnelChartDatasets:ty,getFunnelChartScales:Aw,getFunnelChartTooltip:Xw,getFunnelLabelColors:oy,getGeoChartData:WC,getGeoChartDatasets:ey,getGeoChartScales:Tw,getGeoChartTooltip:Yw,getHierarchalChartData:ZC,getLineChartData:zC,getLineChartDatasets:YS,getLineChartLegend:uw,getLineChartScales:ww,getLineChartTooltip:Gw,getPieChartData:$C,getPieChartDatasets:KS,getPieChartLegend:gw,getPieChartTooltip:Ww,getPyramidChartData:BC,getPyramidChartScales:Ew,getPyramidChartShowValues:Vw,getPyramidChartTooltip:Zw,getRadarChartData:GC,getRadarChartDatasets:QS,getRadarChartLegend:vw,getRadarChartScales:Rw,getRadarChartTooltip:jw,getScatterChartDatasets:XS,getScatterChartLegend:pw,getScatterChartScales:Iw,getSunburstChartDatasets:sy,getSunburstChartLegend:bw,getSunburstChartTooltip:Kw,getSunburstShowValues:kw,getTreeMapChartDatasets:ay,getTreeMapChartTooltip:Jw,getTrendDatasetForBarChart:jC,getTrendDatasetForLineChart:YC,getWaterfallChartLegend:fw,getWaterfallChartScales:xw,getWaterfallChartShowValues:Lw,getWaterfallChartTooltip:qw,getWaterfallDatasetAndLabels:jS,makeDatasetsCumulative:lw});class oI extends Sy{dataSets;labelRange;background;legendPosition;stacked;aggregated;type="bar";dataSetsHaveTitle;dataSetDesign;axesDesign;horizontal;showValues;constructor(e,t,o){super(e,t,o),this.dataSets=ES(o,e.dataSets,t,e.dataSetsHaveTitle),this.labelRange=ga(o,t,e.labelRange),this.background=e.background,this.legendPosition=e.legendPosition,this.stacked=e.stacked,this.aggregated=e.aggregated,this.dataSetsHaveTitle=e.dataSetsHaveTitle,this.dataSetDesign=e.dataSets,this.axesDesign=e.axesDesign,this.horizontal=e.horizontal,this.showValues=e.showValues}static transformDefinition(e,t,o){return DS(e,t,o)}static validateChartDefinition(e,t){return e.checkValidations(t,FS,MS)}static getDefinitionFromContextCreation(e){return{background:e.background,dataSets:e.range??[],dataSetsHaveTitle:e.dataSetsHaveTitle??!1,stacked:e.stacked??!1,aggregated:e.aggregated??!1,legendPosition:e.legendPosition??"top",title:e.title||{text:""},type:"bar",labelRange:e.auxiliaryRange||void 0,axesDesign:e.axesDesign,showValues:e.showValues}}getContextCreation(){const e=[];for(const[t,o]of this.dataSets.entries())e.push({...this.dataSetDesign?.[t],dataRange:this.getters.getRangeString(o.dataRange,this.sheetId)});return{...this,range:e,auxiliaryRange:this.labelRange?this.getters.getRangeString(this.labelRange,this.sheetId):void 0}}duplicateInDuplicatedSheet(e){const t=wS(this.sheetId,e,this.dataSets),o=IS(this.sheetId,e,this.labelRange),s=this.getDefinitionWithSpecificDataSets(t,o,e);return new oI(s,e,this.getters)}copyInSheetId(e){const t=this.getDefinitionWithSpecificDataSets(this.dataSets,this.labelRange,e);return new oI(t,e,this.getters)}getDefinition(){return this.getDefinitionWithSpecificDataSets(this.dataSets,this.labelRange)}getDefinitionWithSpecificDataSets(e,t,o){const s=[];for(const[t,i]of e.entries())s.push({...this.dataSetDesign?.[t],dataRange:this.getters.getRangeString(i.dataRange,o||this.sheetId)});return{type:"bar",dataSetsHaveTitle:!!e.length&&Boolean(e[0].labelCell),background:this.background,dataSets:s,legendPosition:this.legendPosition,labelRange:t?this.getters.getRangeString(t,o||this.sheetId):void 0,title:this.title,stacked:this.stacked,aggregated:this.aggregated,axesDesign:this.axesDesign,horizontal:this.horizontal,showValues:this.showValues}}getDefinitionForExcel(){const e=this.dataSets.map((e=>TS(this.getters,e))).filter((e=>""!==e.range&&e.range!==Ti.InvalidReference)),t=AS(this.getters,this.labelRange,PS(this.labelRange,this.dataSets[0],this.dataSetsHaveTitle)),o=this.getDefinition();return{...o,backgroundColor:CC(this.background||m),fontColor:CC(_S(this.background)),dataSets:e,labelRange:t,verticalAxis:NS(o)}}updateRanges(e){const{dataSets:t,labelRange:o,isStale:s}=CS(this.getters,e,this.dataSets,this.labelRange);if(!s)return this;const i=this.getDefinitionWithSpecificDataSets(t,o);return new oI(i,this.sheetId,this.getters)}}function sI(e,t){const o=e.getDefinition(),s=UC(o,e.dataSets,e.labelRange,t);return{chartJsConfig:{type:"bar",data:{labels:s.labels,datasets:ZS(o,s)},options:{...wC,indexAxis:e.horizontal?"y":"x",layout:cw(),scales:Cw(o,s),plugins:{title:Hw(o),legend:dw(o),tooltip:$w(o,s),chartShowValuesPlugin:Nw(o,s)}}},background:e.background||m}}class iI extends Sy{dataSets;labelRange;background;legendPosition;aggregated;dataSetsHaveTitle;dataSetDesign;axesDesign;type="combo";showValues;constructor(e,t,o){super(e,t,o),this.dataSets=ES(o,e.dataSets,t,e.dataSetsHaveTitle),this.labelRange=ga(o,t,e.labelRange),this.background=e.background,this.legendPosition=e.legendPosition,this.aggregated=e.aggregated,this.dataSetsHaveTitle=e.dataSetsHaveTitle,this.dataSetDesign=e.dataSets,this.axesDesign=e.axesDesign,this.showValues=e.showValues}static transformDefinition(e,t,o){return DS(e,t,o)}static validateChartDefinition(e,t){return e.checkValidations(t,FS,MS)}getContextCreation(){const e=[];for(const[t,o]of this.dataSets.entries())e.push({...this.dataSetDesign?.[t],dataRange:this.getters.getRangeString(o.dataRange,this.sheetId)});return{...this,range:e,auxiliaryRange:this.labelRange?this.getters.getRangeString(this.labelRange,this.sheetId):void 0}}getDefinition(){return this.getDefinitionWithSpecificDataSets(this.dataSets,this.labelRange)}getDefinitionWithSpecificDataSets(e,t,o){const s=[];for(const[t,i]of e.entries())s.push({...this.dataSetDesign?.[t],dataRange:this.getters.getRangeString(i.dataRange,o||this.sheetId),type:this.dataSetDesign?.[t]?.type??(t?"line":"bar")});return{type:"combo",dataSetsHaveTitle:!!e.length&&Boolean(e[0].labelCell),background:this.background,dataSets:s,legendPosition:this.legendPosition,labelRange:t?this.getters.getRangeString(t,o||this.sheetId):void 0,title:this.title,aggregated:this.aggregated,axesDesign:this.axesDesign,showValues:this.showValues}}getDefinitionForExcel(){if(this.aggregated)return;const e=this.dataSets.map((e=>TS(this.getters,e))).filter((e=>""!==e.range&&e.range!==Ti.InvalidReference)),t=AS(this.getters,this.labelRange,PS(this.labelRange,this.dataSets[0],this.dataSetsHaveTitle)),o=this.getDefinition();return{...o,backgroundColor:CC(this.background||m),fontColor:CC(_S(this.background)),dataSets:e,labelRange:t,verticalAxis:NS(o)}}updateRanges(e){const{dataSets:t,labelRange:o,isStale:s}=CS(this.getters,e,this.dataSets,this.labelRange);if(!s)return this;const i=this.getDefinitionWithSpecificDataSets(t,o);return new iI(i,this.sheetId,this.getters)}static getDefinitionFromContextCreation(e){const t=(e.range??[]).map(((e,t)=>({...e,type:t?"line":"bar"})));return{background:e.background,dataSets:t,dataSetsHaveTitle:e.dataSetsHaveTitle??!1,aggregated:e.aggregated,legendPosition:e.legendPosition??"top",title:e.title||{text:""},labelRange:e.auxiliaryRange||void 0,type:"combo",axesDesign:e.axesDesign,showValues:e.showValues}}duplicateInDuplicatedSheet(e){const t=wS(this.sheetId,e,this.dataSets),o=IS(this.sheetId,e,this.labelRange),s=this.getDefinitionWithSpecificDataSets(t,o,e);return new iI(s,e,this.getters)}copyInSheetId(e){const t=this.getDefinitionWithSpecificDataSets(this.dataSets,this.labelRange,e);return new iI(t,e,this.getters)}}class nI extends Sy{dataSets;labelRange;background;legendPosition;aggregated;type="funnel";dataSetsHaveTitle;dataSetDesign;axesDesign;horizontal=!0;showValues;funnelColors;cumulative;constructor(e,t,o){super(e,t,o),this.dataSets=ES(o,e.dataSets,t,e.dataSetsHaveTitle),this.labelRange=ga(o,t,e.labelRange),this.background=e.background,this.legendPosition=e.legendPosition,this.aggregated=e.aggregated,this.dataSetsHaveTitle=e.dataSetsHaveTitle,this.dataSetDesign=e.dataSets,this.axesDesign=e.axesDesign,this.showValues=e.showValues,this.horizontal=!0,this.funnelColors=e.funnelColors,this.cumulative=e.cumulative}static transformDefinition(e,t,o){return DS(e,t,o)}static validateChartDefinition(e,t){return e.checkValidations(t,FS,MS)}static getDefinitionFromContextCreation(e){return{background:e.background,dataSets:e.range??[],dataSetsHaveTitle:e.dataSetsHaveTitle??!1,aggregated:e.aggregated??!1,legendPosition:"none",title:e.title||{text:""},type:"funnel",labelRange:e.auxiliaryRange||void 0,showValues:e.showValues,axesDesign:e.axesDesign,funnelColors:e.funnelColors,horizontal:!0,cumulative:e.cumulative}}getContextCreation(){const e=[];for(const[t,o]of this.dataSets.entries())e.push({...this.dataSetDesign?.[t],dataRange:this.getters.getRangeString(o.dataRange,this.sheetId)});return{...this,range:e,auxiliaryRange:this.labelRange?this.getters.getRangeString(this.labelRange,this.sheetId):void 0}}duplicateInDuplicatedSheet(e){const t=wS(this.sheetId,e,this.dataSets),o=IS(this.sheetId,e,this.labelRange),s=this.getDefinitionWithSpecificDataSets(t,o,e);return new nI(s,e,this.getters)}copyInSheetId(e){const t=this.getDefinitionWithSpecificDataSets(this.dataSets,this.labelRange,e);return new nI(t,e,this.getters)}getDefinition(){return this.getDefinitionWithSpecificDataSets(this.dataSets,this.labelRange)}getDefinitionWithSpecificDataSets(e,t,o){const s=[];for(const[t,i]of e.entries())s.push({...this.dataSetDesign?.[t],dataRange:this.getters.getRangeString(i.dataRange,o||this.sheetId)});return{type:"funnel",dataSetsHaveTitle:!!e.length&&Boolean(e[0].labelCell),background:this.background,dataSets:s,legendPosition:this.legendPosition,labelRange:t?this.getters.getRangeString(t,o||this.sheetId):void 0,title:this.title,aggregated:this.aggregated,horizontal:this.horizontal,axesDesign:this.axesDesign,showValues:this.showValues,funnelColors:this.funnelColors,cumulative:this.cumulative}}getDefinitionForExcel(){}updateRanges(e){const{dataSets:t,labelRange:o,isStale:s}=CS(this.getters,e,this.dataSets,this.labelRange);if(!s)return this;const i=this.getDefinitionWithSpecificDataSets(t,o);return new nI(i,this.sheetId,this.getters)}}function rI(e){return e.dataRange&&!Zr.test(e.dataRange)?"InvalidGaugeDataRange":"Success"}function aI(e,t){return t((t=>t.sectionRule?e(t.sectionRule.rangeMin,"rangeMin"):"Success"),(t=>t.sectionRule?e(t.sectionRule.rangeMax,"rangeMax"):"Success"))}function lI(e,t){if(""===e)switch(t){case"rangeMin":return"EmptyGaugeRangeMin";case"rangeMax":return"EmptyGaugeRangeMax"}return"Success"}function cI(e,t){if(e.startsWith("="))return"Success";if(isNaN(e))switch(t){case"rangeMin":return"GaugeRangeMinNaN";case"rangeMax":return"GaugeRangeMaxNaN";case"lowerInflectionPointValue":return"GaugeLowerInflectionPointNaN";case"upperInflectionPointValue":return"GaugeUpperInflectionPointNaN"}return"Success"}class hI extends Sy{dataRange;sectionRule;background;type="gauge";constructor(e,t,o){super(e,t,o),this.dataRange=ga(this.getters,this.sheetId,e.dataRange),this.sectionRule=e.sectionRule,this.background=e.background}static validateChartDefinition(e,t){return e.checkValidations(t,rI,e.chainValidations(aI(lI,e.batchValidations),aI(cI,e.batchValidations)),e.chainValidations((o=cI,(0,e.batchValidations)((e=>e.sectionRule?o(e.sectionRule.lowerInflectionPoint.value,"lowerInflectionPointValue"):"Success"),(e=>e.sectionRule?o(e.sectionRule.upperInflectionPoint.value,"upperInflectionPointValue"):"Success")))));var o}static transformDefinition(e,t,o){let s;if(t.dataRange){const i=vS(e,t.dataRange,o);i!==Ti.InvalidReference&&(s=i)}return{...t,dataRange:s}}static getDefinitionFromContextCreation(e){return{background:e.background,title:e.title||{text:""},type:"gauge",dataRange:e.range?e.range[0].dataRange:void 0,sectionRule:{colors:{lowerColor:"#EA6175",middleColor:"#FFD86D",upperColor:"#43C5B1"},rangeMin:"0",rangeMax:"100",lowerInflectionPoint:{type:"percentage",value:"15",operator:"<="},upperInflectionPoint:{type:"percentage",value:"40",operator:"<="}}}}duplicateInDuplicatedSheet(e){const t=IS(this.sheetId,e,this.dataRange),o=pI(this.sectionRule,(t=>this.getters.copyFormulaStringForSheet(this.sheetId,e,t,"moveReference"))),s=this.getDefinitionWithSpecificRanges(t,o,e);return new hI(s,e,this.getters)}copyInSheetId(e){const t=pI(this.sectionRule,(t=>this.getters.copyFormulaStringForSheet(this.sheetId,e,t,"keepSameReference"))),o=this.getDefinitionWithSpecificRanges(this.dataRange,t,e);return new hI(o,e,this.getters)}getDefinition(){return this.getDefinitionWithSpecificRanges(this.dataRange,this.sectionRule)}getDefinitionWithSpecificRanges(e,t,o){return{background:this.background,sectionRule:t,title:this.title,type:"gauge",dataRange:e?this.getters.getRangeString(e,o||this.sheetId):void 0}}getDefinitionForExcel(){}getContextCreation(){return{...this,range:this.dataRange?[{dataRange:this.getters.getRangeString(this.dataRange,this.sheetId)}]:void 0}}updateRanges(e){const t=xS(this.dataRange,e),o=pI(this.sectionRule,(t=>this.getters.adaptFormulaStringDependencies(this.sheetId,t,e))),s=this.getDefinitionWithSpecificRanges(t,o);return new hI(s,this.sheetId,this.getters)}}function dI(e,t){const o=t.getLocale(),s=e.sectionRule.colors;let i,n,r;const a=e.dataRange;if(void 0!==a){const e=t.getEvaluatedCell({sheetId:a.sheetId,col:a.zone.left,row:a.zone.top});e.type===ai.number&&(i=e.value,n=e.formattedValue,r=e.format)}let l=gI(e.sheetId,e.sectionRule.rangeMin,t),c=gI(e.sheetId,e.sectionRule.rangeMax,t);if(void 0===l||void 0===c)return function(e,t){return{background:t.getStyleOfSingleCellChart(e.background,e.dataRange).background,title:e.title??{text:""},minValue:{value:0,label:""},maxValue:{value:100,label:""},gaugeValue:{value:0,label:Ti.GenericError},inflectionValues:[],colors:[]}}(e,t);c<l&&([l,c]=[c,l]);const h=e.sectionRule.lowerInflectionPoint,d=e.sectionRule.upperInflectionPoint,u=uI(e.sheetId,e.sectionRule.lowerInflectionPoint,l,c,t),g=uI(e.sheetId,e.sectionRule.upperInflectionPoint,l,c,t),p=[],m=[];return void 0!==u&&(p.push({value:u,label:sr(u,{locale:o,format:r}),operator:h.operator}),m.push(s.lowerColor)),void 0!==g&&g!==u&&(p.push({value:g,label:sr(g,{locale:o,format:r}),operator:d.operator}),m.push(s.middleColor)),void 0!==g&&void 0!==u&&u>g&&(p.reverse(),m.reverse()),m.push(s.upperColor),{background:t.getStyleOfSingleCellChart(e.background,a).background,title:{...e.title,text:ni(e.title.text??"")},minValue:{value:l,label:sr(l,{locale:o,format:r})},maxValue:{value:c,label:sr(c,{locale:o,format:r})},gaugeValue:void 0!==i&&n?{value:i,label:n}:void 0,inflectionValues:p,colors:m}}function uI(e,t,o,s,i){const n=gI(e,t.value,i);if(void 0===n)return;return Ze("number"===t.type?n:o+(s-o)*n/100,o,s)}function gI(e,t,o){const s=o.evaluateFormula(e,t);return Ii(s)?void 0:$i(s,o.getLocale())}function pI(e,t){return{...e,rangeMin:t(e.rangeMin),rangeMax:t(e.rangeMax),lowerInflectionPoint:{...e.lowerInflectionPoint,value:t(e.lowerInflectionPoint.value)},upperInflectionPoint:{...e.upperInflectionPoint,value:t(e.upperInflectionPoint.value)}}}class mI extends Sy{dataSets;labelRange;background;legendPosition;type="geo";dataSetsHaveTitle;dataSetDesign;colorScale;missingValueColor;region;constructor(e,t,o){super(e,t,o),this.dataSets=ES(o,e.dataSets,t,e.dataSetsHaveTitle),this.labelRange=ga(o,t,e.labelRange),this.background=e.background,this.legendPosition=e.legendPosition,this.dataSetsHaveTitle=e.dataSetsHaveTitle,this.dataSetDesign=e.dataSets,this.colorScale=e.colorScale,this.missingValueColor=e.missingValueColor,this.region=e.region}static transformDefinition(e,t,o){return DS(e,t,o)}static validateChartDefinition(e,t){return e.checkValidations(t,FS,MS)}static getDefinitionFromContextCreation(e){return{background:e.background,dataSets:e.range??[],dataSetsHaveTitle:e.dataSetsHaveTitle??!1,legendPosition:e.legendPosition??"top",title:e.title||{text:""},type:"geo",labelRange:e.auxiliaryRange||void 0}}getContextCreation(){const e=[];for(const[t,o]of this.dataSets.entries())e.push({...this.dataSetDesign?.[t],dataRange:this.getters.getRangeString(o.dataRange,this.sheetId)});return{...this,range:e,auxiliaryRange:this.labelRange?this.getters.getRangeString(this.labelRange,this.sheetId):void 0}}duplicateInDuplicatedSheet(e){const t=wS(this.sheetId,e,this.dataSets),o=IS(this.sheetId,e,this.labelRange),s=this.getDefinitionWithSpecificDataSets(t,o,e);return new mI(s,e,this.getters)}copyInSheetId(e){const t=this.getDefinitionWithSpecificDataSets(this.dataSets,this.labelRange,e);return new mI(t,e,this.getters)}getDefinition(){return this.getDefinitionWithSpecificDataSets(this.dataSets,this.labelRange)}getDefinitionWithSpecificDataSets(e,t,o){const s=[];for(const[t,i]of e.entries())s.push({...this.dataSetDesign?.[t],dataRange:this.getters.getRangeString(i.dataRange,o||this.sheetId)});return{type:"geo",dataSetsHaveTitle:!!e.length&&Boolean(e[0].labelCell),background:this.background,dataSets:s,legendPosition:this.legendPosition,labelRange:t?this.getters.getRangeString(t,o||this.sheetId):void 0,title:this.title,colorScale:this.colorScale,missingValueColor:this.missingValueColor,region:this.region}}getDefinitionForExcel(){}updateRanges(e){const{dataSets:t,labelRange:o,isStale:s}=CS(this.getters,e,this.dataSets,this.labelRange);if(!s)return this;const i=this.getDefinitionWithSpecificDataSets(t,o);return new mI(i,this.sheetId,this.getters)}}class fI extends Sy{dataSets;labelRange;background;legendPosition;labelsAsText;stacked;aggregated;type="line";dataSetsHaveTitle;cumulative;dataSetDesign;axesDesign;fillArea;showValues;constructor(e,t,o){super(e,t,o),this.dataSets=ES(this.getters,e.dataSets,t,e.dataSetsHaveTitle),this.labelRange=ga(this.getters,t,e.labelRange),this.background=e.background,this.legendPosition=e.legendPosition,this.labelsAsText=e.labelsAsText,this.stacked=e.stacked,this.aggregated=e.aggregated,this.dataSetsHaveTitle=e.dataSetsHaveTitle,this.cumulative=e.cumulative,this.dataSetDesign=e.dataSets,this.axesDesign=e.axesDesign,this.fillArea=e.fillArea,this.showValues=e.showValues}static validateChartDefinition(e,t){return e.checkValidations(t,FS,MS)}static transformDefinition(e,t,o){return DS(e,t,o)}static getDefinitionFromContextCreation(e){return{background:e.background,dataSets:e.range??[],dataSetsHaveTitle:e.dataSetsHaveTitle??!1,labelsAsText:e.labelsAsText??!1,legendPosition:e.legendPosition??"top",title:e.title||{text:""},type:"line",labelRange:e.auxiliaryRange||void 0,stacked:e.stacked??!1,aggregated:e.aggregated??!1,cumulative:e.cumulative??!1,axesDesign:e.axesDesign,fillArea:e.fillArea,showValues:e.showValues}}getDefinition(){return this.getDefinitionWithSpecificDataSets(this.dataSets,this.labelRange)}getDefinitionWithSpecificDataSets(e,t,o){const s=[];for(const[t,i]of e.entries())s.push({...this.dataSetDesign?.[t],dataRange:this.getters.getRangeString(i.dataRange,o||this.sheetId)});return{type:"line",dataSetsHaveTitle:!!e.length&&Boolean(e[0].labelCell),background:this.background,dataSets:s,legendPosition:this.legendPosition,labelRange:t?this.getters.getRangeString(t,o||this.sheetId):void 0,title:this.title,labelsAsText:this.labelsAsText,stacked:this.stacked,aggregated:this.aggregated,cumulative:this.cumulative,axesDesign:this.axesDesign,fillArea:this.fillArea,showValues:this.showValues}}getContextCreation(){const e=[];for(const[t,o]of this.dataSets.entries())e.push({...this.dataSetDesign?.[t],dataRange:this.getters.getRangeString(o.dataRange,this.sheetId)});return{...this,range:e,auxiliaryRange:this.labelRange?this.getters.getRangeString(this.labelRange,this.sheetId):void 0}}updateRanges(e){const{dataSets:t,labelRange:o,isStale:s}=CS(this.getters,e,this.dataSets,this.labelRange);if(!s)return this;const i=this.getDefinitionWithSpecificDataSets(t,o);return new fI(i,this.sheetId,this.getters)}getDefinitionForExcel(){const e=this.dataSets.map((e=>TS(this.getters,e))).filter((e=>""!==e.range&&e.range!==Ti.InvalidReference)),t=AS(this.getters,this.labelRange,PS(this.labelRange,this.dataSets[0],this.dataSetsHaveTitle)),o=this.getDefinition();return{...o,backgroundColor:CC(this.background||m),fontColor:CC(_S(this.background)),dataSets:e,labelRange:t,verticalAxis:NS(o)}}duplicateInDuplicatedSheet(e){const t=wS(this.sheetId,e,this.dataSets),o=IS(this.sheetId,e,this.labelRange),s=this.getDefinitionWithSpecificDataSets(t,o,e);return new fI(s,e,this.getters)}copyInSheetId(e){const t=this.getDefinitionWithSpecificDataSets(this.dataSets,this.labelRange,e);return new fI(t,e,this.getters)}}function vI(e,t){const o=e.getDefinition(),s=zC(o,e.dataSets,e.labelRange,t);return{chartJsConfig:{type:"line",data:{labels:s.labels,datasets:YS(o,s)},options:{...wC,layout:cw(),scales:ww(o,s),plugins:{title:Hw(o),legend:uw(o),tooltip:Gw(0,s),chartShowValuesPlugin:Nw(o,s)}}},background:e.background||m}}class bI extends Sy{dataSets;labelRange;background;legendPosition;type="pie";aggregated;dataSetsHaveTitle;isDoughnut;showValues;constructor(e,t,o){super(e,t,o),this.dataSets=ES(o,e.dataSets,t,e.dataSetsHaveTitle),this.labelRange=ga(o,t,e.labelRange),this.background=e.background,this.legendPosition=e.legendPosition,this.aggregated=e.aggregated,this.dataSetsHaveTitle=e.dataSetsHaveTitle,this.isDoughnut=e.isDoughnut,this.showValues=e.showValues}static transformDefinition(e,t,o){return DS(e,t,o)}static validateChartDefinition(e,t){return e.checkValidations(t,FS,MS)}static getDefinitionFromContextCreation(e){return{background:e.background,dataSets:e.range??[],dataSetsHaveTitle:e.dataSetsHaveTitle??!1,legendPosition:e.legendPosition??"top",title:e.title||{text:""},type:"pie",labelRange:e.auxiliaryRange||void 0,aggregated:e.aggregated??!1,isDoughnut:!1,showValues:e.showValues}}getDefinition(){return this.getDefinitionWithSpecificDataSets(this.dataSets,this.labelRange)}getContextCreation(){return{...this,range:this.dataSets.map((e=>({dataRange:this.getters.getRangeString(e.dataRange,this.sheetId)}))),auxiliaryRange:this.labelRange?this.getters.getRangeString(this.labelRange,this.sheetId):void 0}}getDefinitionWithSpecificDataSets(e,t,o){return{type:"pie",dataSetsHaveTitle:!!e.length&&Boolean(e[0].labelCell),background:this.background,dataSets:e.map((e=>({dataRange:this.getters.getRangeString(e.dataRange,o||this.sheetId)}))),legendPosition:this.legendPosition,labelRange:t?this.getters.getRangeString(t,o||this.sheetId):void 0,title:this.title,aggregated:this.aggregated,isDoughnut:this.isDoughnut,showValues:this.showValues}}duplicateInDuplicatedSheet(e){const t=wS(this.sheetId,e,this.dataSets),o=IS(this.sheetId,e,this.labelRange),s=this.getDefinitionWithSpecificDataSets(t,o,e);return new bI(s,e,this.getters)}copyInSheetId(e){const t=this.getDefinitionWithSpecificDataSets(this.dataSets,this.labelRange,e);return new bI(t,e,this.getters)}getDefinitionForExcel(){const e=this.dataSets.map((e=>TS(this.getters,e))).filter((e=>""!==e.range&&e.range!==Ti.InvalidReference)),t=AS(this.getters,this.labelRange,PS(this.labelRange,this.dataSets[0],this.dataSetsHaveTitle));return{...this.getDefinition(),backgroundColor:CC(this.background||m),fontColor:CC(_S(this.background)),dataSets:e,labelRange:t}}updateRanges(e){const{dataSets:t,labelRange:o,isStale:s}=CS(this.getters,e,this.dataSets,this.labelRange);if(!s)return this;const i=this.getDefinitionWithSpecificDataSets(t,o);return new bI(i,this.sheetId,this.getters)}}function SI(e,t){const o=e.getDefinition(),s=$C(o,e.dataSets,e.labelRange,t);return{chartJsConfig:{type:e.isDoughnut?"doughnut":"pie",data:{labels:s.labels,datasets:KS(o,s)},options:{...wC,layout:cw(),plugins:{title:Hw(o),legend:gw(o,s),tooltip:Ww(0,s),chartShowValuesPlugin:Nw(o,s)}}},background:e.background||m}}class yI extends Sy{dataSets;labelRange;background;legendPosition;aggregated;type="pyramid";dataSetsHaveTitle;dataSetDesign;axesDesign;horizontal=!0;stacked=!0;showValues;constructor(e,t,o){super(e,t,o),this.dataSets=ES(o,e.dataSets,t,e.dataSetsHaveTitle).slice(0,2),this.labelRange=ga(o,t,e.labelRange),this.background=e.background,this.legendPosition=e.legendPosition,this.aggregated=e.aggregated,this.dataSetsHaveTitle=e.dataSetsHaveTitle,this.dataSetDesign=e.dataSets,this.axesDesign=e.axesDesign,this.showValues=e.showValues}static transformDefinition(e,t,o){return DS(e,t,o)}static validateChartDefinition(e,t){return e.checkValidations(t,FS,MS)}static getDefinitionFromContextCreation(e){return{background:e.background,dataSets:e.range??[],dataSetsHaveTitle:e.dataSetsHaveTitle??!1,aggregated:e.aggregated??!1,legendPosition:e.legendPosition??"top",title:e.title||{text:""},type:"pyramid",labelRange:e.auxiliaryRange||void 0,axesDesign:e.axesDesign,horizontal:!0,stacked:!0,showValues:e.showValues}}getContextCreation(){const e=[];for(const[t,o]of this.dataSets.entries())e.push({...this.dataSetDesign?.[t],dataRange:this.getters.getRangeString(o.dataRange,this.sheetId)});return{...this,range:e,auxiliaryRange:this.labelRange?this.getters.getRangeString(this.labelRange,this.sheetId):void 0}}duplicateInDuplicatedSheet(e){const t=wS(this.sheetId,e,this.dataSets),o=IS(this.sheetId,e,this.labelRange),s=this.getDefinitionWithSpecificDataSets(t,o,e);return new yI(s,e,this.getters)}copyInSheetId(e){const t=this.getDefinitionWithSpecificDataSets(this.dataSets,this.labelRange,e);return new yI(t,e,this.getters)}getDefinition(){return this.getDefinitionWithSpecificDataSets(this.dataSets,this.labelRange)}getDefinitionWithSpecificDataSets(e,t,o){const s=[];for(const[t,i]of e.entries())s.push({...this.dataSetDesign?.[t],dataRange:this.getters.getRangeString(i.dataRange,o||this.sheetId)});return{type:"pyramid",dataSetsHaveTitle:!!e.length&&Boolean(e[0].labelCell),background:this.background,dataSets:s,legendPosition:this.legendPosition,labelRange:t?this.getters.getRangeString(t,o||this.sheetId):void 0,title:this.title,aggregated:this.aggregated,axesDesign:this.axesDesign,horizontal:!0,stacked:!0,showValues:this.showValues}}getDefinitionForExcel(){}updateRanges(e){const{dataSets:t,labelRange:o,isStale:s}=CS(this.getters,e,this.dataSets,this.labelRange);if(!s)return this;const i=this.getDefinitionWithSpecificDataSets(t,o);return new yI(i,this.sheetId,this.getters)}}class CI extends Sy{dataSets;labelRange;background;legendPosition;stacked;aggregated;type="radar";dataSetsHaveTitle;dataSetDesign;fillArea;showValues;constructor(e,t,o){super(e,t,o),this.dataSets=ES(o,e.dataSets,t,e.dataSetsHaveTitle),this.labelRange=ga(o,t,e.labelRange),this.background=e.background,this.legendPosition=e.legendPosition,this.stacked=e.stacked,this.aggregated=e.aggregated,this.dataSetsHaveTitle=e.dataSetsHaveTitle,this.dataSetDesign=e.dataSets,this.fillArea=e.fillArea,this.showValues=e.showValues}static transformDefinition(e,t,o){return DS(e,t,o)}static validateChartDefinition(e,t){return e.checkValidations(t,FS,MS)}static getDefinitionFromContextCreation(e){return{background:e.background,dataSets:e.range??[],dataSetsHaveTitle:e.dataSetsHaveTitle??!1,stacked:e.stacked??!1,aggregated:e.aggregated??!1,legendPosition:e.legendPosition??"top",title:e.title||{text:""},type:"radar",labelRange:e.auxiliaryRange||void 0,fillArea:e.fillArea??!1,showValues:e.showValues??!1}}getContextCreation(){const e=[];for(const[t,o]of this.dataSets.entries())e.push({...this.dataSetDesign?.[t],dataRange:this.getters.getRangeString(o.dataRange,this.sheetId)});return{...this,range:e,auxiliaryRange:this.labelRange?this.getters.getRangeString(this.labelRange,this.sheetId):void 0}}duplicateInDuplicatedSheet(e){const t=wS(this.sheetId,e,this.dataSets),o=IS(this.sheetId,e,this.labelRange),s=this.getDefinitionWithSpecificDataSets(t,o,e);return new CI(s,e,this.getters)}copyInSheetId(e){const t=this.getDefinitionWithSpecificDataSets(this.dataSets,this.labelRange,e);return new CI(t,e,this.getters)}getDefinition(){return this.getDefinitionWithSpecificDataSets(this.dataSets,this.labelRange)}getDefinitionWithSpecificDataSets(e,t,o){const s=[];for(const[t,i]of e.entries())s.push({...this.dataSetDesign?.[t],dataRange:this.getters.getRangeString(i.dataRange,o||this.sheetId)});return{type:"radar",dataSetsHaveTitle:!!e.length&&Boolean(e[0].labelCell),background:this.background,dataSets:s,legendPosition:this.legendPosition,labelRange:t?this.getters.getRangeString(t,o||this.sheetId):void 0,title:this.title,stacked:this.stacked,aggregated:this.aggregated,fillArea:this.fillArea,showValues:this.showValues}}getDefinitionForExcel(){if(this.aggregated)return;const e=this.dataSets.map((e=>TS(this.getters,e))).filter((e=>""!==e.range&&e.range!==Ti.InvalidReference)),t=AS(this.getters,this.labelRange,PS(this.labelRange,this.dataSets[0],this.dataSetsHaveTitle));return{...this.getDefinition(),backgroundColor:CC(this.background||m),fontColor:CC(_S(this.background)),dataSets:e,labelRange:t}}updateRanges(e){const{dataSets:t,labelRange:o,isStale:s}=CS(this.getters,e,this.dataSets,this.labelRange);if(!s)return this;const i=this.getDefinitionWithSpecificDataSets(t,o);return new CI(i,this.sheetId,this.getters)}}class wI extends Sy{dataSets;labelRange;background;legendPosition;labelsAsText;aggregated;type="scatter";dataSetsHaveTitle;dataSetDesign;axesDesign;showValues;constructor(e,t,o){super(e,t,o),this.dataSets=ES(this.getters,e.dataSets,t,e.dataSetsHaveTitle),this.labelRange=ga(this.getters,t,e.labelRange),this.background=e.background,this.legendPosition=e.legendPosition,this.labelsAsText=e.labelsAsText,this.aggregated=e.aggregated,this.dataSetsHaveTitle=e.dataSetsHaveTitle,this.dataSetDesign=e.dataSets,this.axesDesign=e.axesDesign,this.showValues=e.showValues}static validateChartDefinition(e,t){return e.checkValidations(t,FS,MS)}static transformDefinition(e,t,o){return DS(e,t,o)}static getDefinitionFromContextCreation(e){return{background:e.background,dataSets:e.range??[],dataSetsHaveTitle:e.dataSetsHaveTitle??!1,labelsAsText:e.labelsAsText??!1,legendPosition:e.legendPosition??"top",title:e.title||{text:""},type:"scatter",labelRange:e.auxiliaryRange||void 0,aggregated:e.aggregated??!1,axesDesign:e.axesDesign,showValues:e.showValues}}getDefinition(){return this.getDefinitionWithSpecificDataSets(this.dataSets,this.labelRange)}getDefinitionWithSpecificDataSets(e,t,o){const s=[];for(const[t,i]of e.entries())s.push({...this.dataSetDesign?.[t],dataRange:this.getters.getRangeString(i.dataRange,o||this.sheetId)});return{type:"scatter",dataSetsHaveTitle:!!e.length&&Boolean(e[0].labelCell),background:this.background,dataSets:s,legendPosition:this.legendPosition,labelRange:t?this.getters.getRangeString(t,o||this.sheetId):void 0,title:this.title,labelsAsText:this.labelsAsText,aggregated:this.aggregated,axesDesign:this.axesDesign,showValues:this.showValues}}getContextCreation(){const e=[];for(const[t,o]of this.dataSets.entries())e.push({...this.dataSetDesign?.[t],dataRange:this.getters.getRangeString(o.dataRange,this.sheetId)});return{...this,range:e,auxiliaryRange:this.labelRange?this.getters.getRangeString(this.labelRange,this.sheetId):void 0}}updateRanges(e){const{dataSets:t,labelRange:o,isStale:s}=CS(this.getters,e,this.dataSets,this.labelRange);if(!s)return this;const i=this.getDefinitionWithSpecificDataSets(t,o);return new wI(i,this.sheetId,this.getters)}getDefinitionForExcel(){if(this.aggregated)return;const e=this.dataSets.map((e=>TS(this.getters,e))).filter((e=>""!==e.range)),t=AS(this.getters,this.labelRange,PS(this.labelRange,this.dataSets[0],this.dataSetsHaveTitle)),o=this.getDefinition();return{...o,backgroundColor:CC(this.background||m),fontColor:CC(_S(this.background)),dataSets:e,labelRange:t,verticalAxis:NS(o)}}duplicateInDuplicatedSheet(e){const t=wS(this.sheetId,e,this.dataSets),o=IS(this.sheetId,e,this.labelRange),s=this.getDefinitionWithSpecificDataSets(t,o,e);return new wI(s,e,this.getters)}copyInSheetId(e){const t=this.getDefinitionWithSpecificDataSets(this.dataSets,this.labelRange,e);return new wI(t,e,this.getters)}}class II extends Sy{dataSets;labelRange;background;legendPosition;type="sunburst";dataSetsHaveTitle;showValues;showLabels;valuesDesign;groupColors;constructor(e,t,o){super(e,t,o),this.dataSets=ES(o,e.dataSets,t,e.dataSetsHaveTitle),this.labelRange=ga(o,t,e.labelRange),this.background=e.background,this.legendPosition=e.legendPosition,this.dataSetsHaveTitle=e.dataSetsHaveTitle,this.showValues=e.showValues,this.showLabels=e.showLabels,this.valuesDesign=e.valuesDesign,this.groupColors=e.groupColors}static transformDefinition(e,t,o){return DS(e,t,o)}static validateChartDefinition(e,t){return e.checkValidations(t,FS,MS)}static getDefinitionFromContextCreation(e){const t=[];return e.hierarchicalRanges?.length?t.push(...e.hierarchicalRanges):e.auxiliaryRange&&t.push({...e.range?.[0],dataRange:e.auxiliaryRange}),{background:e.background,dataSets:t,dataSetsHaveTitle:e.dataSetsHaveTitle??!1,legendPosition:e.legendPosition??"top",title:e.title||{text:""},type:"sunburst",labelRange:e.range?.[0]?.dataRange,showValues:e.showValues,showLabels:e.showLabels,valuesDesign:e.valuesDesign,groupColors:e.groupColors}}getDefinition(){return this.getDefinitionWithSpecificDataSets(this.dataSets,this.labelRange)}getContextCreation(){const e=this.dataSets.at(-1)?.dataRange;return{...this,range:this.labelRange?[{dataRange:this.getters.getRangeString(this.labelRange,this.sheetId)}]:[],auxiliaryRange:e?this.getters.getRangeString(e,this.sheetId):void 0,hierarchicalRanges:this.dataSets.map((e=>({dataRange:this.getters.getRangeString(e.dataRange,this.sheetId)})))}}getDefinitionWithSpecificDataSets(e,t,o){return{type:"sunburst",dataSetsHaveTitle:!!e.length&&Boolean(e[0].labelCell),background:this.background,dataSets:e.map((e=>({dataRange:this.getters.getRangeString(e.dataRange,o||this.sheetId)}))),legendPosition:this.legendPosition,labelRange:t?this.getters.getRangeString(t,o||this.sheetId):void 0,title:this.title,showValues:this.showValues,showLabels:this.showLabels,valuesDesign:this.valuesDesign,groupColors:this.groupColors}}duplicateInDuplicatedSheet(e){const t=wS(this.sheetId,e,this.dataSets),o=IS(this.sheetId,e,this.labelRange),s=this.getDefinitionWithSpecificDataSets(t,o,e);return new II(s,e,this.getters)}copyInSheetId(e){const t=this.getDefinitionWithSpecificDataSets(this.dataSets,this.labelRange,e);return new II(t,e,this.getters)}getDefinitionForExcel(){}updateRanges(e){const{dataSets:t,labelRange:o,isStale:s}=CS(this.getters,e,this.dataSets,this.labelRange);if(!s)return this;const i=this.getDefinitionWithSpecificDataSets(t,o);return new II(i,this.sheetId,this.getters)}}class xI extends Sy{static defaults={background:m,legendPosition:"top",dataSetsHaveTitle:!1,showHeaders:!0,headersColor:"#000000"};dataSets;labelRange;background;legendPosition;type="treemap";dataSetsHaveTitle;showHeaders;headerDesign;showValues;showLabels;valuesDesign;coloringOptions;constructor(e,t,o){super(e,t,o),this.dataSets=ES(o,e.dataSets,t,e.dataSetsHaveTitle),this.labelRange=ga(o,t,e.labelRange),this.background=e.background,this.legendPosition=e.legendPosition,this.dataSetsHaveTitle=e.dataSetsHaveTitle,this.showHeaders=e.showHeaders,this.headerDesign=e.headerDesign,this.showValues=e.showValues,this.showLabels=e.showLabels,this.valuesDesign=e.valuesDesign,this.coloringOptions=e.coloringOptions}static transformDefinition(e,t,o){return DS(e,t,o)}static validateChartDefinition(e,t){return e.checkValidations(t,FS,MS)}static getDefinitionFromContextCreation(e){const t=[];return e.hierarchicalRanges?.length?t.push(...e.hierarchicalRanges):e.auxiliaryRange&&t.push({...e.range?.[0],dataRange:e.auxiliaryRange}),{background:e.background,dataSets:t,dataSetsHaveTitle:e.dataSetsHaveTitle??!1,legendPosition:e.legendPosition??"top",title:e.title||{text:""},type:"treemap",labelRange:e.range?.[0]?.dataRange,showValues:e.showValues,showHeaders:e.showHeaders,headerDesign:e.headerDesign,showLabels:e.showLabels,valuesDesign:e.valuesDesign,coloringOptions:e.treemapColoringOptions}}getContextCreation(){const e=this.dataSets.at(-1)?.dataRange;return{...this,range:this.labelRange?[{dataRange:this.getters.getRangeString(this.labelRange,this.sheetId)}]:[],auxiliaryRange:e?this.getters.getRangeString(e,this.sheetId):void 0,hierarchicalRanges:this.dataSets.map((e=>({dataRange:this.getters.getRangeString(e.dataRange,this.sheetId)})))}}duplicateInDuplicatedSheet(e){const t=wS(this.sheetId,e,this.dataSets),o=IS(this.sheetId,e,this.labelRange),s=this.getDefinitionWithSpecificDataSets(t,o,e);return new xI(s,e,this.getters)}copyInSheetId(e){const t=this.getDefinitionWithSpecificDataSets(this.dataSets,this.labelRange,e);return new xI(t,e,this.getters)}getDefinition(){return this.getDefinitionWithSpecificDataSets(this.dataSets,this.labelRange)}getDefinitionWithSpecificDataSets(e,t,o){const s=e.map((e=>({dataRange:this.getters.getRangeString(e.dataRange,o||this.sheetId)})));return{type:"treemap",dataSetsHaveTitle:!!e.length&&Boolean(e[0].labelCell),background:this.background,dataSets:s,legendPosition:this.legendPosition,labelRange:t?this.getters.getRangeString(t,o||this.sheetId):void 0,title:this.title,showValues:this.showValues,showHeaders:this.showHeaders,headerDesign:this.headerDesign,showLabels:this.showLabels,valuesDesign:this.valuesDesign,coloringOptions:this.coloringOptions}}getDefinitionForExcel(){}updateRanges(e){const{dataSets:t,labelRange:o,isStale:s}=CS(this.getters,e,this.dataSets,this.labelRange);if(!s)return this;const i=this.getDefinitionWithSpecificDataSets(t,o);return new xI(i,this.sheetId,this.getters)}}class EI extends Sy{dataSets;labelRange;background;verticalAxisPosition;legendPosition;aggregated;type="waterfall";dataSetsHaveTitle;showSubTotals;firstValueAsSubtotal;showConnectorLines;positiveValuesColor;negativeValuesColor;subTotalValuesColor;dataSetDesign;axesDesign;showValues;constructor(e,t,o){super(e,t,o),this.dataSets=ES(o,e.dataSets,t,e.dataSetsHaveTitle),this.labelRange=ga(o,t,e.labelRange),this.background=e.background,this.verticalAxisPosition=e.verticalAxisPosition,this.legendPosition=e.legendPosition,this.aggregated=e.aggregated,this.dataSetsHaveTitle=e.dataSetsHaveTitle,this.showSubTotals=e.showSubTotals,this.showConnectorLines=e.showConnectorLines,this.positiveValuesColor=e.positiveValuesColor,this.negativeValuesColor=e.negativeValuesColor,this.subTotalValuesColor=e.subTotalValuesColor,this.firstValueAsSubtotal=e.firstValueAsSubtotal,this.dataSetDesign=e.dataSets,this.axesDesign=e.axesDesign,this.showValues=e.showValues}static transformDefinition(e,t,o){return DS(e,t,o)}static validateChartDefinition(e,t){return e.checkValidations(t,FS,MS)}static getDefinitionFromContextCreation(e){return{background:e.background,dataSets:e.range?e.range:[],dataSetsHaveTitle:e.dataSetsHaveTitle??!1,aggregated:e.aggregated??!1,legendPosition:e.legendPosition??"top",title:e.title||{text:""},type:"waterfall",verticalAxisPosition:"left",labelRange:e.auxiliaryRange||void 0,showSubTotals:e.showSubTotals??!1,showConnectorLines:e.showConnectorLines??!0,firstValueAsSubtotal:e.firstValueAsSubtotal??!1,axesDesign:e.axesDesign,showValues:e.showValues}}getContextCreation(){const e=[];for(const[t,o]of this.dataSets.entries())e.push({...this.dataSetDesign?.[t],dataRange:this.getters.getRangeString(o.dataRange,this.sheetId)});return{...this,range:e,auxiliaryRange:this.labelRange?this.getters.getRangeString(this.labelRange,this.sheetId):void 0}}duplicateInDuplicatedSheet(e){const t=wS(this.sheetId,e,this.dataSets),o=IS(this.sheetId,e,this.labelRange),s=this.getDefinitionWithSpecificDataSets(t,o,e);return new EI(s,e,this.getters)}copyInSheetId(e){const t=this.getDefinitionWithSpecificDataSets(this.dataSets,this.labelRange,e);return new EI(t,e,this.getters)}getDefinition(){return this.getDefinitionWithSpecificDataSets(this.dataSets,this.labelRange)}getDefinitionWithSpecificDataSets(e,t,o){const s=[];for(const[t,i]of e.entries())s.push({...this.dataSetDesign?.[t],dataRange:this.getters.getRangeString(i.dataRange,o||this.sheetId)});return{type:"waterfall",dataSetsHaveTitle:!!e.length&&Boolean(e[0].labelCell),background:this.background,dataSets:s,legendPosition:this.legendPosition,verticalAxisPosition:this.verticalAxisPosition,labelRange:t?this.getters.getRangeString(t,o||this.sheetId):void 0,title:this.title,aggregated:this.aggregated,showSubTotals:this.showSubTotals,showConnectorLines:this.showConnectorLines,positiveValuesColor:this.positiveValuesColor,negativeValuesColor:this.negativeValuesColor,subTotalValuesColor:this.subTotalValuesColor,firstValueAsSubtotal:this.firstValueAsSubtotal,axesDesign:this.axesDesign,showValues:this.showValues}}getDefinitionForExcel(){}updateRanges(e){const{dataSets:t,labelRange:o,isStale:s}=CS(this.getters,e,this.dataSets,this.labelRange);if(!s)return this;const i=this.getDefinitionWithSpecificDataSets(t,o);return new EI(i,this.sheetId,this.getters)}}function RI(e,t){const o=e.getDefinition(),s=UC(o,e.dataSets,e.labelRange,t),{labels:i,datasets:n}=jS(o,s);return{chartJsConfig:{type:"bar",data:{labels:i,datasets:n},options:{...wC,layout:cw(),scales:xw(o,s),plugins:{title:Hw(o),legend:fw(o),tooltip:qw(0,s),chartShowValuesPlugin:Lw(o,s),waterfallLinesPlugin:{showConnectorLines:o.showConnectorLines}}}},background:e.background||m}}const TI=new n;TI.add("bar",{match:e=>"bar"===e,createChart:(e,t,o)=>new oI(e,t,o),getChartRuntime:sI,validateChartDefinition:oI.validateChartDefinition,transformDefinition:oI.transformDefinition,getChartDefinitionFromContextCreation:oI.getDefinitionFromContextCreation,sequence:10}),TI.add("combo",{match:e=>"combo"===e,createChart:(e,t,o)=>new iI(e,t,o),getChartRuntime:function(e,t){const o=e.getDefinition(),s=UC(o,e.dataSets,e.labelRange,t);return{chartJsConfig:{type:"bar",data:{labels:s.labels,datasets:JS(o,s)},options:{...wC,layout:cw(),scales:Cw(o,s),plugins:{title:Hw(o),legend:mw(o),tooltip:$w(o,s),chartShowValuesPlugin:Nw(o,s)}}},background:e.background||m}},validateChartDefinition:iI.validateChartDefinition,transformDefinition:iI.transformDefinition,getChartDefinitionFromContextCreation:iI.getDefinitionFromContextCreation,sequence:15}),TI.add("line",{match:e=>"line"===e,createChart:(e,t,o)=>new fI(e,t,o),getChartRuntime:vI,validateChartDefinition:fI.validateChartDefinition,transformDefinition:fI.transformDefinition,getChartDefinitionFromContextCreation:fI.getDefinitionFromContextCreation,sequence:20}),TI.add("pie",{match:e=>"pie"===e,createChart:(e,t,o)=>new bI(e,t,o),getChartRuntime:SI,validateChartDefinition:bI.validateChartDefinition,transformDefinition:bI.transformDefinition,getChartDefinitionFromContextCreation:bI.getDefinitionFromContextCreation,sequence:30}),TI.add("scorecard",{match:e=>"scorecard"===e,createChart:(e,t,o)=>new Ry(e,t,o),getChartRuntime:Ay,validateChartDefinition:Ry.validateChartDefinition,transformDefinition:Ry.transformDefinition,getChartDefinitionFromContextCreation:Ry.getDefinitionFromContextCreation,sequence:40}),TI.add("gauge",{match:e=>"gauge"===e,createChart:(e,t,o)=>new hI(e,t,o),getChartRuntime:dI,validateChartDefinition:hI.validateChartDefinition,transformDefinition:hI.transformDefinition,getChartDefinitionFromContextCreation:hI.getDefinitionFromContextCreation,sequence:50}),TI.add("scatter",{match:e=>"scatter"===e,createChart:(e,t,o)=>new wI(e,t,o),getChartRuntime:function(e,t){const o=e.getDefinition(),s=zC(o,e.dataSets,e.labelRange,t);return{chartJsConfig:{type:"line",data:{labels:s.labels,datasets:XS(o,s)},options:{...wC,layout:cw(),scales:Iw(o,s),plugins:{title:Hw(o),legend:pw(o),tooltip:Gw(0,s),chartShowValuesPlugin:Nw(o,s)}}},background:e.background||m}},validateChartDefinition:wI.validateChartDefinition,transformDefinition:wI.transformDefinition,getChartDefinitionFromContextCreation:wI.getDefinitionFromContextCreation,sequence:60}),TI.add("waterfall",{match:e=>"waterfall"===e,createChart:(e,t,o)=>new EI(e,t,o),getChartRuntime:RI,validateChartDefinition:EI.validateChartDefinition,transformDefinition:EI.transformDefinition,getChartDefinitionFromContextCreation:EI.getDefinitionFromContextCreation,sequence:70}),TI.add("pyramid",{match:e=>"pyramid"===e,createChart:(e,t,o)=>new yI(e,t,o),getChartRuntime:function(e,t){const o=e.getDefinition(),s=BC(o,e.dataSets,e.labelRange,t);return{chartJsConfig:{type:"bar",data:{labels:s.labels,datasets:ZS(o,s)},options:{...wC,indexAxis:"y",layout:cw(),scales:Ew(o,s),plugins:{title:Hw(o),legend:dw(o),tooltip:Zw(o,s),chartShowValuesPlugin:Vw(o,s)}}},background:e.background||m}},validateChartDefinition:yI.validateChartDefinition,transformDefinition:yI.transformDefinition,getChartDefinitionFromContextCreation:yI.getDefinitionFromContextCreation,sequence:80}),TI.add("radar",{match:e=>"radar"===e,createChart:(e,t,o)=>new CI(e,t,o),getChartRuntime:function(e,t){const o=e.getDefinition(),s=GC(o,e.dataSets,e.labelRange,t);return{chartJsConfig:{type:"radar",data:{labels:s.labels,datasets:QS(o,s)},options:{...wC,layout:cw(),scales:Rw(o,s),plugins:{title:Hw(o),legend:vw(o),tooltip:jw(0,s),chartShowValuesPlugin:Nw(o,s)}}},background:e.background||m}},validateChartDefinition:CI.validateChartDefinition,transformDefinition:CI.transformDefinition,getChartDefinitionFromContextCreation:CI.getDefinitionFromContextCreation,sequence:80}),TI.add("geo",{match:e=>"geo"===e,createChart:(e,t,o)=>new mI(e,t,o),getChartRuntime:function(e,t){const o=e.getDefinition(),s=WC(o,e.dataSets,e.labelRange,t);return{chartJsConfig:{type:"choropleth",data:{datasets:ey(o,s)},options:{...wC,layout:cw(),scales:Tw(o,s),plugins:{title:Hw(o),tooltip:Yw(0,s),legend:{display:!1}}}},background:e.background||m}},validateChartDefinition:mI.validateChartDefinition,transformDefinition:mI.transformDefinition,getChartDefinitionFromContextCreation:mI.getDefinitionFromContextCreation,sequence:90}),TI.add("funnel",{match:e=>"funnel"===e,createChart:(e,t,o)=>new nI(e,t,o),getChartRuntime:function(e,t){const o=e.getDefinition(),s=qC(o,e.dataSets,e.labelRange,t);return{chartJsConfig:{type:"funnel",data:{labels:s.labels,datasets:ty(o,s)},options:{...wC,indexAxis:"y",layout:cw(),scales:Aw(0,s),plugins:{title:Hw(o),legend:{display:!1},tooltip:Xw(0,s),chartShowValuesPlugin:Nw(o,s)}}},background:e.background||m}},validateChartDefinition:nI.validateChartDefinition,transformDefinition:nI.transformDefinition,getChartDefinitionFromContextCreation:nI.getDefinitionFromContextCreation,sequence:100}),TI.add("sunburst",{match:e=>"sunburst"===e,createChart:(e,t,o)=>new II(e,t,o),getChartRuntime:function(e,t){const o=e.getDefinition(),s=ZC(o,e.dataSets,e.labelRange,t);return{chartJsConfig:{type:"doughnut",data:{datasets:sy(o,s)},options:{cutout:"25%",...wC,layout:cw(),plugins:{title:Hw(o),legend:bw(o),tooltip:Kw(0,s),sunburstLabelsPlugin:kw(o,s),sunburstHoverPlugin:{enabled:!0}}}},background:e.background||m}},validateChartDefinition:II.validateChartDefinition,transformDefinition:II.transformDefinition,getChartDefinitionFromContextCreation:II.getDefinitionFromContextCreation,sequence:30}),TI.add("treemap",{match:e=>"treemap"===e,createChart:(e,t,o)=>new xI(e,t,o),getChartRuntime:function(e,t){const o=e.getDefinition(),s=ZC(o,e.dataSets,e.labelRange,t);return{chartJsConfig:{type:"treemap",data:{labels:s.labels,datasets:ay(o,s)},options:{...wC,layout:cw(),plugins:{title:Hw(o),legend:{display:!1},tooltip:Jw(0,s)}}},background:e.background||m}},validateChartDefinition:xI.validateChartDefinition,transformDefinition:xI.transformDefinition,getChartDefinitionFromContextCreation:xI.getDefinitionFromContextCreation,sequence:100});const AI=new n;AI.add("line",by),AI.add("bar",by),AI.add("combo",by),AI.add("pie",by),AI.add("gauge",yC),AI.add("scatter",by),AI.add("scorecard",My),AI.add("waterfall",by),AI.add("pyramid",by),AI.add("radar",by),AI.add("geo",by),AI.add("funnel",by),AI.add("sunburst",by),AI.add("treemap",by);const DI={line:ni("Line"),column:ni("Column"),bar:ni("Bar"),area:ni("Area"),pie:ni("Pie"),hierarchical:ni("Hierarchical"),misc:ni("Miscellaneous")},_I=new n;_I.add("line",{matcher:e=>"line"===e.type&&!e.stacked&&!e.fillArea,displayName:ni("Line"),chartType:"line",chartSubtype:"line",subtypeDefinition:{stacked:!1,fillArea:!1},category:"line",preview:"o-spreadsheet-ChartPreview.LINE_CHART"}).add("stacked_line",{matcher:e=>"line"===e.type&&!e.fillArea&&!!e.stacked,displayName:ni("Stacked Line"),chartType:"line",chartSubtype:"stacked_line",subtypeDefinition:{stacked:!0,fillArea:!1},category:"line",preview:"o-spreadsheet-ChartPreview.STACKED_LINE_CHART"}).add("area",{matcher:e=>"line"===e.type&&!e.stacked&&!!e.fillArea,displayName:ni("Area"),chartType:"line",chartSubtype:"area",subtypeDefinition:{stacked:!1,fillArea:!0},category:"area",preview:"o-spreadsheet-ChartPreview.AREA_CHART"}).add("stacked_area",{matcher:e=>"line"===e.type&&e.stacked&&!!e.fillArea,displayName:ni("Stacked Area"),chartType:"line",chartSubtype:"stacked_area",subtypeDefinition:{stacked:!0,fillArea:!0},category:"area",preview:"o-spreadsheet-ChartPreview.STACKED_AREA_CHART"}).add("scatter",{displayName:ni("Scatter"),chartType:"scatter",chartSubtype:"scatter",category:"misc",preview:"o-spreadsheet-ChartPreview.SCATTER_CHART"}).add("column",{matcher:e=>"bar"===e.type&&!e.stacked&&!e.horizontal,displayName:ni("Column"),chartType:"bar",chartSubtype:"column",subtypeDefinition:{stacked:!1,horizontal:!1},category:"column",preview:"o-spreadsheet-ChartPreview.COLUMN_CHART"}).add("stacked_column",{matcher:e=>"bar"===e.type&&e.stacked&&!e.horizontal,displayName:ni("Stacked Column"),chartType:"bar",chartSubtype:"stacked_column",subtypeDefinition:{stacked:!0,horizontal:!1},category:"column",preview:"o-spreadsheet-ChartPreview.STACKED_COLUMN_CHART"}).add("bar",{matcher:e=>"bar"===e.type&&!e.stacked&&!!e.horizontal,displayName:ni("Bar"),chartType:"bar",chartSubtype:"bar",subtypeDefinition:{horizontal:!0,stacked:!1},category:"bar",preview:"o-spreadsheet-ChartPreview.BAR_CHART"}).add("stacked_bar",{matcher:e=>"bar"===e.type&&e.stacked&&!!e.horizontal,displayName:ni("Stacked Bar"),chartType:"bar",chartSubtype:"stacked_bar",subtypeDefinition:{horizontal:!0,stacked:!0},category:"bar",preview:"o-spreadsheet-ChartPreview.STACKED_BAR_CHART"}).add("combo",{displayName:ni("Combo"),chartSubtype:"combo",chartType:"combo",category:"line",preview:"o-spreadsheet-ChartPreview.COMBO_CHART"}).add("pie",{matcher:e=>"pie"===e.type&&!e.isDoughnut,displayName:ni("Pie"),chartSubtype:"pie",chartType:"pie",subtypeDefinition:{isDoughnut:!1},category:"pie",preview:"o-spreadsheet-ChartPreview.PIE_CHART"}).add("doughnut",{matcher:e=>"pie"===e.type&&!!e.isDoughnut,displayName:ni("Doughnut"),chartSubtype:"doughnut",chartType:"pie",subtypeDefinition:{isDoughnut:!0},category:"pie",preview:"o-spreadsheet-ChartPreview.DOUGHNUT_CHART"}).add("gauge",{displayName:ni("Gauge"),chartSubtype:"gauge",chartType:"gauge",category:"misc",preview:"o-spreadsheet-ChartPreview.GAUGE_CHART"}).add("scorecard",{displayName:ni("Scorecard"),chartSubtype:"scorecard",chartType:"scorecard",category:"misc",preview:"o-spreadsheet-ChartPreview.SCORECARD_CHART"}).add("waterfall",{displayName:ni("Waterfall"),chartSubtype:"waterfall",chartType:"waterfall",category:"misc",preview:"o-spreadsheet-ChartPreview.WATERFALL_CHART"}).add("pyramid",{displayName:ni("Population Pyramid"),chartSubtype:"pyramid",chartType:"pyramid",category:"misc",preview:"o-spreadsheet-ChartPreview.POPULATION_PYRAMID_CHART"}).add("radar",{matcher:e=>"radar"===e.type&&!e.fillArea,displayName:ni("Radar"),chartSubtype:"radar",chartType:"radar",subtypeDefinition:{fillArea:!1},category:"misc",preview:"o-spreadsheet-ChartPreview.RADAR_CHART"}).add("filled_radar",{matcher:e=>"radar"===e.type&&!!e.fillArea,displayName:ni("Filled Radar"),chartType:"radar",chartSubtype:"filled_radar",subtypeDefinition:{fillArea:!0},category:"misc",preview:"o-spreadsheet-ChartPreview.FILLED_RADAR_CHART"}).add("geo",{displayName:ni("Geo Chart"),chartSubtype:"geo",chartType:"geo",category:"misc",preview:"o-spreadsheet-ChartPreview.GEO_CHART"}).add("funnel",{displayName:ni("Funnel"),chartSubtype:"funnel",chartType:"funnel",category:"misc",preview:"o-spreadsheet-ChartPreview.FUNNEL_CHART"}).add("sunburst",{matcher:e=>"sunburst"===e.type,displayName:ni("Sunburst"),chartSubtype:"sunburst",chartType:"sunburst",category:"hierarchical",preview:"o-spreadsheet-ChartPreview.SUNBURST_CHART"}).add("treemap",{matcher:e=>"treemap"===e.type,displayName:ni("Tree Map"),chartType:"treemap",chartSubtype:"treemap",category:"hierarchical",preview:"o-spreadsheet-ChartPreview.TREE_MAP_CHART"});const OI=new n;wh`
|
|
10
10
|
.o-chart-container {
|
|
11
11
|
width: 100%;
|
|
12
12
|
height: 100%;
|
|
@@ -2575,7 +2575,7 @@
|
|
|
2575
2575
|
color: ${P};
|
|
2576
2576
|
}
|
|
2577
2577
|
}
|
|
2578
|
-
`;class tL extends t.Component{static template="o-spreadsheet-Spreadsheet";static props={model:Object,notifyUser:{type:Function,optional:!0},raiseError:{type:Function,optional:!0},askConfirmation:{type:Function,optional:!0}};static components={TopBar:QV,Grid:HN,BottomBar:FV,SidePanel:HV,SpreadsheetDashboard:PV,HeaderGroupContainer:LV};sidePanel;spreadsheetRef=t.useRef("spreadsheet");spreadsheetRect=VT();_focusGrid;isViewportTooSmall=!1;notificationStore;composerFocusStore;get model(){return this.props.model}getStyle(){const e={};return this.env.isDashboard()?e["grid-template-rows"]="auto":e["grid-template-rows"]="min-content auto min-content",e["grid-template-columns"]=`auto ${this.sidePanel.panelSize}px`,Eh(e)}setup(){const e=lh();e.inject(ph,this.model),this.notificationStore=ch(Ly),this.composerFocusStore=ch(Sh),this.sidePanel=ch(NN);const o=this.model.config.external.fileStore;if(t.useSubEnv({model:this.model,imageProvider:o?new xV(o):void 0,loadCurrencies:this.model.config.external.loadCurrencies,loadLocales:this.model.config.external.loadLocales,isDashboard:()=>this.model.getters.isDashboard(),openSidePanel:this.sidePanel.open.bind(this.sidePanel),toggleSidePanel:this.sidePanel.toggle.bind(this.sidePanel),clipboard:this.env.clipboard||new eL(navigator.clipboard),startCellEdition:e=>this.composerFocusStore.focusActiveComposer({content:e}),notifyUser:e=>this.notificationStore.notifyUser(e),askConfirmation:(e,t,o)=>this.notificationStore.askConfirmation(e,t,o),raiseError:(e,t)=>this.notificationStore.raiseError(e,t)}),!("isSmall"in this.env)){const e=function(){const e=VT();return{get isSmall(){return e.width<768}}}();t.useSubEnv({get isSmall(){return e.isSmall}})}this.notificationStore.updateNotificationCallbacks({...this.props}),t.useEffect((()=>{!this.spreadsheetRef.el.contains(document.activeElement)&&document.activeElement?.contains(this.spreadsheetRef.el)&&this.focusGrid()}),(()=>[this.env.model.getters.getActiveSheetId()])),t.useExternalListener(window,"resize",(()=>this.render(!0))),t.useExternalListener(document.body,"wheel",(()=>{})),this.bindModelEvents(),t.onWillUpdateProps((e=>{if(e.model!==this.props.model)throw new Error("Changing the props model is not supported at the moment.");e.notifyUser===this.props.notifyUser&&e.askConfirmation===this.props.askConfirmation&&e.raiseError===this.props.raiseError||this.notificationStore.updateNotificationCallbacks({...e})}));const s=function(e){let t=!1;return async(...o)=>{t||(t=!0,await Promise.resolve(),t=!1,e(...o))}}(this.render.bind(this,!0));t.onMounted((()=>{this.checkViewportSize(),e.on("store-updated",this,s),i.observe(this.spreadsheetRef.el),Th()})),t.onWillUnmount((()=>{this.unbindModelEvents(),e.off("store-updated",this),i.disconnect(),function(){if(window.Chart)for(const e of Rh.getAll())e.unregister(window.Chart)}()})),t.onPatched((()=>{this.checkViewportSize()}));const i=new ResizeObserver((()=>{this.sidePanel.changePanelSize(this.sidePanel.panelSize,this.spreadsheetRect.width)}))}bindModelEvents(){this.model.on("update",this,(()=>this.render(!0))),this.model.on("notify-ui",this,(e=>this.notificationStore.notifyUser(e))),this.model.on("raise-error-ui",this,(({text:e})=>this.notificationStore.raiseError(e)))}unbindModelEvents(){this.model.off("update",this),this.model.off("notify-ui",this),this.model.off("raise-error-ui",this)}checkViewportSize(){const{xRatio:e,yRatio:t}=this.env.model.getters.getFrozenSheetViewRatio(this.env.model.getters.getActiveSheetId());if(isFinite(e)&&isFinite(t))if(t>.85||e>.85){if(this.isViewportTooSmall)return;this.notificationStore.notifyUser({text:ni("The current window is too small to display this sheet properly. Consider resizing your browser window or adjusting frozen rows and columns."),type:"warning",sticky:!1}),this.isViewportTooSmall=!0}else this.isViewportTooSmall=!1}focusGrid(){this._focusGrid&&this._focusGrid()}get gridHeight(){return this.env.model.getters.getSheetViewDimension().height}get gridContainerStyle(){const e=ce*this.rowLayers.length,t=ce*this.colLayers.length;return Eh({"grid-template-columns":`${e?e+2:0}px auto`,"grid-template-rows":`${t?t+2:0}px auto`})}get rowLayers(){const e=this.env.model.getters.getActiveSheetId();return this.env.model.getters.getVisibleGroupLayers(e,"ROW")}get colLayers(){const e=this.env.model.getters.getActiveSheetId();return this.env.model.getters.getVisibleGroupLayers(e,"COL")}}class oL{listeners=[];async sendMessage(e){for(const{callback:t}of this.listeners)t(e)}onNewMessage(e,t){this.listeners.push({id:e,callback:t})}leave(e){this.listeners=this.listeners.filter((t=>t.id!==e))}}function sL(e){return Sx.get(e.type)(e)}class iL{buildTransformation;operations;constructor(e,t=[]){this.buildTransformation=e,this.operations=t}getOperations(){return this.operations}getOperation(e){const t=this.operations.find((t=>t.id===e));if(!t)throw new Error(`Operation ${e} not found`);return t}getLastOperationId(){return this.operations[this.operations.length-1]?.id}getFirstOperationAmong(e,t){for(const o of this.operations){if(o.id===e)return e;if(o.id===t)return t}throw new Error(`Operation ${e} and ${t} not found`)}contains(e){return!!this.operations.find((t=>t.id===e))}prepend(e){const t=this.buildTransformation.with(e.data);this.operations=[e,...this.operations.map((e=>e.transformed(t)))]}insert(e,t){const o=this.buildTransformation.with(e.data),{before:s,operation:i,after:n}=this.locateOperation(t);this.operations=[...s,i,e,...n.map((e=>e.transformed(o)))]}append(e){this.operations.push(e)}appendBranch(e){this.operations=this.operations.concat(e.operations)}fork(e){const{after:t}=this.locateOperation(e);return new iL(this.buildTransformation,t)}transform(e){this.operations=this.operations.map((t=>t.transformed(e)))}cutBefore(e){this.operations=this.locateOperation(e).before}cutAfter(e){const{before:t,operation:o}=this.locateOperation(e);this.operations=t.concat([o])}locateOperation(e){const t=this.operations.findIndex((t=>t.id===e));if(-1===t)throw new Error(`Operation ${e} not found`);return{before:this.operations.slice(0,t),operation:this.operations[t],after:this.operations.slice(t+1)}}}class nL{id;data;constructor(e,t){this.id=e,this.data=t}transformed(e){return new rL(this.id,gt((()=>e(this.data))))}}class rL{id;lazyData;constructor(e,t){this.id=e,this.lazyData=t}get data(){return this.lazyData()}transformed(e){return new rL(this.id,this.lazyData.map(e))}}class aL{operations;constructor(e){this.operations=e}[Symbol.iterator](){return this.operations[Symbol.iterator]()}stopWith(e){return new aL(function*(e,t){for(const o of e)if(yield o,o.operation.id===t)return}(this.operations,e))}stopBefore(e){return new aL(function*(e,t){for(const o of e){if(o.operation.id===t)return;yield o}}(this.operations,e))}startAfter(e){return new aL(function*(e,t){let o=!0;for(const s of e)o||(yield s),s.operation.id===t&&(o=!1)}(this.operations,e))}}class lL{buildTransformation;branches;branchingOperationIds=new Map;constructor(e,t){this.buildTransformation=e,this.branches=[t]}getLastBranch(){return this.branches[this.branches.length-1]}execution(e){return new aL(Xe(this._execution(e),this._execution(e)))}revertedExecution(e){return new aL(Xe(this._revertedExecution(e),this._revertedExecution(e)))}insertOperationLast(e,t){const o=e.getLastOperationId()||this.previousBranch(e)?.getLastOperationId();e.append(t),o&&this.insertPrevious(e,t,o)}insertOperationAfter(e,t,o){e.insert(t,o),this.updateNextWith(e,t,o),this.insertPrevious(e,t,o)}undo(e,t){const o=this.buildTransformation.without(t.data),s=this.branchingOperationIds.get(e);this.branchingOperationIds.set(e,t.id);const i=e.fork(t.id);s&&this.branchingOperationIds.set(i,s),this.insertBranchAfter(e,i),this.transform(i,o)}redo(e){const t=this.nextBranch(e);if(!t)return;const o=this.nextBranch(t);this.removeBranchFromTree(t);const s=this.branchingOperationIds.get(t);s?this.branchingOperationIds.set(e,s):this.branchingOperationIds.delete(e),o&&this.rebaseUp(o)}drop(e){for(const t of this.branches)t.contains(e)&&t.cutBefore(e)}findOperation(e,t){for(const o of this.revertedExecution(e))if(o.operation.id===t)return o;throw new Error(`Operation ${t} not found`)}rebaseUp(e){const{previousBranch:t,branchingOperation:o}=this.findPreviousBranchingOperation(e);if(!t||!o)return;const s=this.buildTransformation.without(o.data),i=t.fork(o.id);this.branchingOperationIds.set(i,this.branchingOperationIds.get(e)),this.removeBranchFromTree(e),this.insertBranchAfter(t,i),i.transform(s);const n=this.nextBranch(i);n&&this.rebaseUp(n)}removeBranchFromTree(e){const t=this.branches.findIndex((t=>t===e));this.branches.splice(t,1)}insertBranchAfter(e,t){const o=this.branches.findIndex((t=>t===e));this.branches.splice(o+1,0,t)}updateNextWith(e,t,o){const s=this.branchingOperationIds.get(e),i=this.nextBranch(e);if(s&&i)if(e.getFirstOperationAmong(o,s)===s){const n=this.addToNextBranch(e,i,s,t,o);this.updateNextWith(i,n,o)}else{const e=this.buildTransformation.with(t.data);this.transform(i,e)}}addToNextBranch(e,t,o,s,i){let n=s;return i===o?(n=this.getTransformedOperation(e,o,s),t.prepend(n)):t.contains(i)?(n=this.getTransformedOperation(e,o,s),t.insert(n,i)):t.append(s),n}getTransformedOperation(e,t,o){const s=e.getOperation(t),i=this.buildTransformation.without(s.data);return o.transformed(i)}shouldExecute(e,t){return t.id!==this.branchingOperationIds.get(e)}transform(e,t){e.transform(t);const o=this.nextBranch(e);o&&this.transform(o,t)}insertPrevious(e,t,o){const{previousBranch:s,branchingOperation:i}=this.findPreviousBranchingOperation(e);if(!s||!i)return;const n=this.buildTransformation.with(i.data),r=e.fork(o);r.transform(n),s.cutAfter(o),s.appendBranch(r);const a=t.transformed(n);this.insertPrevious(s,a,o)}findPreviousBranchingOperation(e){const t=this.previousBranch(e);if(!t)return{previousBranch:void 0,branchingOperation:void 0};const o=this.branchingOperationIds.get(t);return o?{previousBranch:t,branchingOperation:t.getOperation(o)}:{previousBranch:void 0,branchingOperation:void 0}}nextBranch(e){const t=this.branches.findIndex((t=>t===e));if(-1!==t)return this.branches[t+1]}previousBranch(e){const t=this.branches.findIndex((t=>t===e));if(-1!==t)return this.branches[t-1]}*_revertedExecution(e){const t=this.branchingOperationIds.get(e);let o=!!t;const s=e.getOperations();for(let i=s.length-1;i>=0;i--){const n=s[i];n.id===t&&(o=!1),o||(yield{operation:n,branch:e,isCancelled:!this.shouldExecute(e,n)})}const i=this.previousBranch(e);yield*i?this._revertedExecution(i):[]}*_execution(e){for(const t of e.getOperations())if(yield{operation:t,branch:e,isCancelled:!this.shouldExecute(e,t)},t.id===this.branchingOperationIds.get(e)){const t=this.nextBranch(e);return void(yield*t?this._execution(t):[])}if(!this.branchingOperationIds.get(e)){const t=this.nextBranch(e);yield*t?this._execution(t):[]}}}class cL{HEAD_BRANCH;HEAD_OPERATION;tree;applyOperation;revertOperation;buildEmpty;buildTransformation;constructor(e){this.applyOperation=e.applyOperation,this.revertOperation=e.revertOperation,this.buildEmpty=e.buildEmpty,this.buildTransformation=e.buildTransformation,this.HEAD_BRANCH=new iL(this.buildTransformation),this.tree=new lL(this.buildTransformation,this.HEAD_BRANCH);const t=e.initialOperationId,o=new nL(t,this.buildEmpty(t));this.tree.insertOperationLast(this.HEAD_BRANCH,o),this.HEAD_OPERATION=o}get(e){return this.tree.findOperation(this.HEAD_BRANCH,e).operation.data}append(e,t){const o=new nL(e,t),s=this.tree.getLastBranch();this.tree.insertOperationLast(s,o),this.HEAD_BRANCH=s,this.HEAD_OPERATION=o}insert(e,t,o){const s=new nL(e,t);this.revertTo(o),this.tree.insertOperationAfter(this.HEAD_BRANCH,s,o),this.fastForward()}undo(e,t,o){const{branch:s,operation:i}=this.tree.findOperation(this.HEAD_BRANCH,e);this.revertBefore(e),this.tree.undo(s,i),this.fastForward(),this.insert(t,this.buildEmpty(t),o)}redo(e,t,o){const{branch:s}=this.tree.findOperation(this.HEAD_BRANCH,e);this.revertBefore(e),this.tree.redo(s),this.fastForward(),this.insert(t,this.buildEmpty(t),o)}rebase(e){const t=this.get(e),o=[...this.tree.execution(this.HEAD_BRANCH).startAfter(e)];this.revertBefore(e);const s=this.HEAD_OPERATION.id;this.tree.drop(e),this.insert(e,t,s);for(const{operation:e}of o)this.insert(e.id,e.data,this.HEAD_OPERATION.id)}revertBefore(e){const t=this.tree.revertedExecution(this.HEAD_BRANCH).stopWith(e);this.revert(t)}revertTo(e){const t=e?this.tree.revertedExecution(this.HEAD_BRANCH).stopBefore(e):this.tree.revertedExecution(this.HEAD_BRANCH);this.revert(t)}revert(e){for(const{next:t,operation:o,isCancelled:s}of e)s||this.revertOperation(o.data),t&&(this.HEAD_BRANCH=t.branch,this.HEAD_OPERATION=t.operation)}fastForward(){const e=this.HEAD_OPERATION?this.tree.execution(this.HEAD_BRANCH).startAfter(this.HEAD_OPERATION.id):this.tree.execution(this.HEAD_BRANCH);for(const{operation:t,branch:o,isCancelled:s}of e)s||this.applyOperation(t.data),this.HEAD_OPERATION=t,this.HEAD_BRANCH=o}}function hL(e){return new cL({initialOperationId:e.initialRevisionId,applyOperation:t=>{const o=t.commands.slice(),{changes:s}=e.recordChanges((()=>{for(const t of o)e.dispatch(t)}));t.setChanges(s)},revertOperation:e=>function(e){for(const t of e.slice().reverse())for(let e=t.changes.length-1;e>=0;e--){dL(t.changes[e])}}([e]),buildEmpty:e=>new Jk(e,"empty",[]),buildTransformation:{with:e=>t=>new Jk(t.id,t.clientId,Xk(t.commands,e.commands),t.rootCommand,void 0,t.timestamp),without:e=>t=>new Jk(t.id,t.clientId,Xk(t.commands,e.commands.map(sL).flat()),t.rootCommand,void 0,t.timestamp)}})}function dL(e){const t=e.target,o=e.key,s=e.before;void 0===s?delete t[o]:t[o]=s}class uL{observers=new Map;defaultSubscription;mainSubscription;registerAsDefault(e,t){this.defaultSubscription={owner:e,callbacks:t},this.mainSubscription||(this.mainSubscription=this.defaultSubscription)}observe(e,t){this.observers.set(e,{owner:e,callbacks:t})}detachObserver(e){this.observers.delete(e)}capture(e,t){if(this.observers.get(e))throw new Error("You are already subscribed forever");this.mainSubscription?.owner&&this.mainSubscription.owner!==e&&this.mainSubscription.callbacks.release?.(),this.mainSubscription={owner:e,callbacks:t}}release(e){this.mainSubscription?.owner!==e||this.observers.get(e)||(this.mainSubscription=this.defaultSubscription)}getBackToDefault(){this.mainSubscription!==this.defaultSubscription&&(this.mainSubscription?.callbacks.release?.(),this.mainSubscription=this.defaultSubscription)}isListening(e){return this.mainSubscription?.owner===e}send(e){this.mainSubscription?.callbacks.handleEvent(e),this.observers.forEach((t=>t.callbacks.handleEvent(e)))}}class gL{getters;stream;anchor;defaultAnchor;constructor(e){this.getters=e,this.stream=new uL,this.anchor={cell:{col:0,row:0},zone:rs({col:0,row:0})},this.defaultAnchor=this.anchor}capture(e,t,o){this.stream.capture(e,o),this.anchor=t}registerAsDefault(e,t,o){this.checkAnchorZoneOrThrow(t),this.stream.registerAsDefault(e,o),this.defaultAnchor=t,this.capture(e,t,o)}resetDefaultAnchor(e,t){this.checkAnchorZoneOrThrow(t),this.stream.isListening(e)&&(this.anchor=t),this.defaultAnchor=t}resetAnchor(e,t){this.checkAnchorZoneOrThrow(t),this.stream.isListening(e)&&(this.anchor=t)}observe(e,t){this.stream.observe(e,t)}detachObserver(e){this.stream.detachObserver(e)}release(e){this.stream.isListening(e)&&(this.stream.release(e),this.anchor=this.defaultAnchor)}getBackToDefault(){this.stream.getBackToDefault()}modifyAnchor(e,t,o){const s=this.getters.getActiveSheetId();return e={...e,zone:this.getters.expandZone(s,e.zone)},this.processEvent({options:o,anchor:e,mode:t})}selectZone(e,t={scrollIntoView:!0}){return this.modifyAnchor(e,"overrideSelection",t)}selectCell(e,t){const o=rs({col:e,row:t});return this.selectZone({zone:o,cell:{col:e,row:t}},{scrollIntoView:!0})}moveAnchorCell(e,t=1){if("end"!==t&&t<=0)return new vi("InvalidSelectionStep");const{col:o,row:s}=this.getNextAvailablePosition(e,t);return this.selectCell(o,s)}setAnchorCorner(e,t){const o=this.getters.getActiveSheetId(),{col:s,row:i}=this.anchor.cell,n={left:Math.min(s,e),top:Math.min(i,t),right:Math.max(s,e),bottom:Math.max(i,t)},r={zone:this.getters.expandZone(o,n),cell:{col:s,row:i}};return this.processEvent({mode:"updateAnchor",anchor:r,options:{scrollIntoView:!1}})}addCellToSelection(e,t){const o=this.getters.getActiveSheetId();({col:e,row:t}=this.getters.getMainCellPosition({sheetId:o,col:e,row:t}));const s=this.getters.expandZone(o,rs({col:e,row:t}));return this.processEvent({options:{scrollIntoView:!0},anchor:{zone:s,cell:{col:e,row:t}},mode:"newAnchor"})}resizeAnchorZone(e,t=1){if("end"!==t&&t<=0)return new vi("InvalidSelectionStep");const o=this.getters.getActiveSheetId(),s=this.anchor,{col:i,row:n}=s.cell,{left:r,right:a,top:l,bottom:c}=s.zone,h=this.getStartingPosition(e);let[d,u]=this.deltaToTarget(h,e,t);if(0===d&&0===u)return vi.Success;let g=s.zone;const p=e=>{e=ss(e);const{left:t,right:s,top:i,bottom:n}=this.getters.expandZone(o,e);return{left:Math.max(0,t),right:Math.min(this.getters.getNumberCols(o)-1,s),top:Math.max(0,i),bottom:Math.min(this.getters.getNumberRows(o)-1,n)}},{cell:m,zone:f}=this.getReferenceAnchor(),{col:v,row:b}=m;let S=0;for(;null!==g;){if(S++,d<0){const e=this.getNextAvailableCol(d,a-(S-1),b);g=f.right<=a-S?p({top:l,left:r,bottom:c,right:e}):null}if(d>0){const e=this.getNextAvailableCol(d,r+(S-1),b);g=r+S<=f.left?p({top:l,left:e,bottom:c,right:a}):null}if(u<0){const e=this.getNextAvailableRow(u,v,c-(S-1));g=f.bottom<=c-S?p({top:l,left:r,bottom:e,right:a}):null}if(u>0){const e=this.getNextAvailableRow(u,v,l+(S-1));g=l+S<=f.top?p({top:e,left:r,bottom:c,right:a}):null}if(g=g?ss(g):g,g&&!Yo(g,s.zone))return this.processEvent({options:{scrollIntoView:!0},mode:"updateAnchor",anchor:{zone:g,cell:{col:i,row:n}}})}g=p(Zo({top:n,bottom:n,left:i,right:i},ss({top:this.getNextAvailableRow(u,v,l),left:this.getNextAvailableCol(d,r,b),bottom:this.getNextAvailableRow(u,v,c),right:this.getNextAvailableCol(d,a,b)})));const y={zone:g,cell:{col:i,row:n}};return this.processEvent({anchor:y,mode:"updateAnchor",options:{scrollIntoView:!0}})}selectColumn(e,t){const o=this.getters.getActiveSheetId(),s=this.getters.getNumberRows(o)-1;let i={left:e,right:e,top:0,bottom:s};const n=this.getters.findFirstVisibleColRowIndex(o,"ROW");let r,a;switch(t){case"overrideSelection":case"newAnchor":r=e,a=n;break;case"updateAnchor":({col:r,row:a}=this.anchor.cell),i=Zo(i,{left:r,right:r,top:n,bottom:s})}return this.processEvent({options:{scrollIntoView:!1,unbounded:!0},anchor:{zone:i,cell:{col:r,row:a}},mode:t})}selectRow(e,t){const o=this.getters.getActiveSheetId(),s=this.getters.getNumberCols(o)-1;let i={top:e,bottom:e,left:0,right:s};const n=this.getters.findFirstVisibleColRowIndex(o,"COL");let r,a;switch(t){case"overrideSelection":case"newAnchor":r=n,a=e;break;case"updateAnchor":({col:r,row:a}=this.anchor.cell),i=Zo(i,{left:n,right:s,top:a,bottom:a})}return this.processEvent({options:{scrollIntoView:!1,unbounded:!0},anchor:{zone:i,cell:{col:r,row:a}},mode:t})}loopSelection(){const e=this.getters.getActiveSheetId(),t=this.anchor;if(Yo(this.anchor.zone,this.getters.getSheetZone(e)))return this.modifyAnchor({...t,zone:rs(t.cell)},"updateAnchor",{scrollIntoView:!1});const o=this.getters.getContiguousZone(e,t.zone);return ft(o,t.zone)?this.selectAll():this.modifyAnchor({...t,zone:o},"updateAnchor",{scrollIntoView:!1})}selectTableAroundSelection(){const e=this.getters.getActiveSheetId(),t=this.getters.getContiguousZone(e,this.anchor.zone);return this.modifyAnchor({...this.anchor,zone:t},"updateAnchor",{scrollIntoView:!1})}selectAll(){const e=this.getters.getActiveSheetId(),t={left:0,top:0,bottom:this.getters.getNumberRows(e)-1,right:this.getters.getNumberCols(e)-1};return this.processEvent({mode:"overrideSelection",anchor:{zone:t,cell:this.anchor.cell},options:{scrollIntoView:!1}})}isListening(e){return this.stream.isListening(e)}processEvent(e){const t={...e,previousAnchor:ze(this.anchor)},o=this.checkEventAnchorZone(t);return"Success"!==o?new vi(o):(this.anchor=t.anchor,this.stream.send(t),vi.Success)}checkEventAnchorZone(e){return this.checkAnchorZone(e.anchor)}checkAnchorZone(e){const{cell:t,zone:o}=e;if(!Ko(t.col,t.row,o))return"InvalidAnchorZone";const{left:s,right:i,top:n,bottom:r}=o,a=this.getters.getActiveSheetId(),l=this.getters.findVisibleHeader(a,"COL",s,i);return void 0===this.getters.findVisibleHeader(a,"ROW",n,r)||void 0===l?"SelectionOutOfBound":"Success"}checkAnchorZoneOrThrow(e){if("InvalidAnchorZone"===this.checkAnchorZone(e))throw new Error("The provided anchor is invalid. The cell must be part of the zone.")}getNextAvailablePosition(e,t=1){const{col:o,row:s}=this.anchor.cell,i=this.deltaToTarget({col:o,row:s},e,t);return{col:this.getNextAvailableCol(i[0],o,s),row:this.getNextAvailableRow(i[1],o,s)}}getNextAvailableCol(e,t,o){const s=this.getters.getActiveSheetId(),i={col:t,row:o};return this.getNextAvailableHeader(e,"COL",t,i,(e=>this.getters.isInSameMerge(s,t,o,e,o)))}getNextAvailableRow(e,t,o){const s=this.getters.getActiveSheetId(),i={col:t,row:o};return this.getNextAvailableHeader(e,"ROW",o,i,(e=>this.getters.isInSameMerge(s,t,o,t,e)))}getNextAvailableHeader(e,t,o,s,i){const n=this.getters.getActiveSheetId();if(0===e)return o;const r=Math.sign(e);let a=o+e;for(;i(a);)a+=r;for(;this.getters.isHeaderHidden(n,t,a);)a+=r;return a<0||a>this.getters.getNumberHeaders(n,t)-1?this.getters.isHeaderHidden(n,t,o)?this.getNextAvailableHeader(-r,t,o,s,i):o:a}getReferenceAnchor(){const e=this.getters.getActiveSheetId(),t=this.anchor,{left:o,right:s,top:i,bottom:n}=t.zone,{col:r,row:a}=t.cell,l=this.getters.isColHidden(e,r)&&this.getters.findVisibleHeader(e,"COL",o,s)||r,c=this.getters.isRowHidden(e,a)&&this.getters.findVisibleHeader(e,"ROW",i,n)||a;return{cell:{col:l,row:c},zone:this.getters.expandZone(e,{left:l,right:l,top:c,bottom:c})}}deltaToTarget(e,t,o){switch(t){case"up":return"end"!==o?[0,-o]:[0,this.getEndOfCluster(e,"rows",-1)-e.row];case"down":return"end"!==o?[0,o]:[0,this.getEndOfCluster(e,"rows",1)-e.row];case"left":return"end"!==o?[-o,0]:[this.getEndOfCluster(e,"cols",-1)-e.col,0];case"right":return"end"!==o?[o,0]:[this.getEndOfCluster(e,"cols",1)-e.col,0]}}getStartingPosition(e){let{col:t,row:o}=this.getPosition();const s=this.anchor.zone;switch(e){case"down":case"up":o=o===s.top?s.bottom:s.top;break;case"left":case"right":t=t===s.right?s.left:s.right}return{col:t,row:o}}getEndOfCluster(e,t,o){const s=this.getters.getActiveSheetId();let i=e;const n=this.getNextCellPosition(e,t,o);let r=this.isCellSkippableInCluster({...i,sheetId:s})||this.isCellSkippableInCluster({...n,sheetId:s})?"nextCluster":"endOfCluster";for(;;){const e=this.getNextCellPosition(i,t,o);if(i.col===e.col&&i.row===e.row)break;const n=this.isCellSkippableInCluster({...e,sheetId:s});if("endOfCluster"===r&&n)break;if("nextCluster"===r&&!n){i=e;break}i=e}return"cols"===t?i.col:i.row}getNextCellPosition(e,t,o){const s={...e};return s["cols"===t?"col":"row"]="cols"===t?this.getNextAvailableCol(o,s.col,s.row):this.getNextAvailableRow(o,s.col,s.row),{col:s.col,row:s.row}}getPosition(){return{...this.anchor.cell}}isCellSkippableInCluster(e){const t=this.getters.getMainCellPosition(e),o=this.getters.getEvaluatedCell(t);return o.type===ai.empty||o.type===ai.text&&""===o.value}}function pL(e){if("string"==typeof e)return{};if("number"==typeof e)return[];throw new Error("Cannot create new node")}class mL{changes;commands=[];recordChanges(e){return this.changes=[],this.commands=[],e(),{changes:this.changes,commands:this.commands}}addCommand(e){this.commands.push(e)}addChange(...e){const t=e.pop();let o=e[0],s=e.at(-1);const i=e.length-2;for(let t=1;t<=i;t++){const s=e[t];if(void 0===o[s]){const i=e[t+1];o[s]=pL(i)}o=o[s]}o[s]!==t&&(this.changes?.push({key:s,target:o,before:o[s]}),void 0===t?delete o[s]:o[s]=t)}}const fL=17781237,vL=17781238,bL=88853993,SL=88853994;function yL(e,t,o){const s=[["xmlns:r",Fx],["xmlns:a",Tx],["xmlns:c",Ax]],i=CL({backgroundColor:e.data.backgroundColor,line:{color:"000000"}});let n=ux``;if(e.data.title?.text){const t=CC(OS(e.data.backgroundColor)),o=e.data.title.fontSize??K;n=ux`
|
|
2578
|
+
`;class tL extends t.Component{static template="o-spreadsheet-Spreadsheet";static props={model:Object,notifyUser:{type:Function,optional:!0},raiseError:{type:Function,optional:!0},askConfirmation:{type:Function,optional:!0}};static components={TopBar:QV,Grid:HN,BottomBar:FV,SidePanel:HV,SpreadsheetDashboard:PV,HeaderGroupContainer:LV};sidePanel;spreadsheetRef=t.useRef("spreadsheet");spreadsheetRect=VT();_focusGrid;isViewportTooSmall=!1;notificationStore;composerFocusStore;get model(){return this.props.model}getStyle(){const e={};return this.env.isDashboard()?e["grid-template-rows"]="auto":e["grid-template-rows"]="min-content auto min-content",e["grid-template-columns"]=`auto ${this.sidePanel.panelSize}px`,Eh(e)}setup(){const e=lh();e.inject(ph,this.model),this.notificationStore=ch(Ly),this.composerFocusStore=ch(Sh),this.sidePanel=ch(NN);const o=this.model.config.external.fileStore;if(t.useSubEnv({model:this.model,imageProvider:o?new xV(o):void 0,loadCurrencies:this.model.config.external.loadCurrencies,loadLocales:this.model.config.external.loadLocales,isDashboard:()=>this.model.getters.isDashboard(),openSidePanel:this.sidePanel.open.bind(this.sidePanel),toggleSidePanel:this.sidePanel.toggle.bind(this.sidePanel),clipboard:this.env.clipboard||new eL(navigator.clipboard),startCellEdition:e=>this.composerFocusStore.focusActiveComposer({content:e}),notifyUser:e=>this.notificationStore.notifyUser(e),askConfirmation:(e,t,o)=>this.notificationStore.askConfirmation(e,t,o),raiseError:(e,t)=>this.notificationStore.raiseError(e,t)}),!("isSmall"in this.env)){const e=function(){const e=VT();return{get isSmall(){return e.width<768}}}();t.useSubEnv({get isSmall(){return e.isSmall}})}this.notificationStore.updateNotificationCallbacks({...this.props}),t.useEffect((()=>{!this.spreadsheetRef.el.contains(document.activeElement)&&document.activeElement?.contains(this.spreadsheetRef.el)&&this.focusGrid()}),(()=>[this.env.model.getters.getActiveSheetId()])),t.useExternalListener(window,"resize",(()=>this.render(!0))),t.useExternalListener(document.body,"wheel",(()=>{})),this.bindModelEvents(),t.onWillUpdateProps((e=>{if(e.model!==this.props.model)throw new Error("Changing the props model is not supported at the moment.");e.notifyUser===this.props.notifyUser&&e.askConfirmation===this.props.askConfirmation&&e.raiseError===this.props.raiseError||this.notificationStore.updateNotificationCallbacks({...e})}));const s=function(e){let t=!1;return async(...o)=>{t||(t=!0,await Promise.resolve(),t=!1,e(...o))}}(this.render.bind(this,!0));t.onMounted((()=>{this.checkViewportSize(),e.on("store-updated",this,s),i.observe(this.spreadsheetRef.el)})),t.onWillUnmount((()=>{this.unbindModelEvents(),e.off("store-updated",this),i.disconnect(),function(){if(window.Chart)for(const e of Rh.getAll())e.unregister(window.Chart)}()})),t.onPatched((()=>{this.checkViewportSize()}));const i=new ResizeObserver((()=>{this.sidePanel.changePanelSize(this.sidePanel.panelSize,this.spreadsheetRect.width)}))}bindModelEvents(){this.model.on("update",this,(()=>this.render(!0))),this.model.on("notify-ui",this,(e=>this.notificationStore.notifyUser(e))),this.model.on("raise-error-ui",this,(({text:e})=>this.notificationStore.raiseError(e)))}unbindModelEvents(){this.model.off("update",this),this.model.off("notify-ui",this),this.model.off("raise-error-ui",this)}checkViewportSize(){const{xRatio:e,yRatio:t}=this.env.model.getters.getFrozenSheetViewRatio(this.env.model.getters.getActiveSheetId());if(isFinite(e)&&isFinite(t))if(t>.85||e>.85){if(this.isViewportTooSmall)return;this.notificationStore.notifyUser({text:ni("The current window is too small to display this sheet properly. Consider resizing your browser window or adjusting frozen rows and columns."),type:"warning",sticky:!1}),this.isViewportTooSmall=!0}else this.isViewportTooSmall=!1}focusGrid(){this._focusGrid&&this._focusGrid()}get gridHeight(){return this.env.model.getters.getSheetViewDimension().height}get gridContainerStyle(){const e=ce*this.rowLayers.length,t=ce*this.colLayers.length;return Eh({"grid-template-columns":`${e?e+2:0}px auto`,"grid-template-rows":`${t?t+2:0}px auto`})}get rowLayers(){const e=this.env.model.getters.getActiveSheetId();return this.env.model.getters.getVisibleGroupLayers(e,"ROW")}get colLayers(){const e=this.env.model.getters.getActiveSheetId();return this.env.model.getters.getVisibleGroupLayers(e,"COL")}}class oL{listeners=[];async sendMessage(e){for(const{callback:t}of this.listeners)t(e)}onNewMessage(e,t){this.listeners.push({id:e,callback:t})}leave(e){this.listeners=this.listeners.filter((t=>t.id!==e))}}function sL(e){return Sx.get(e.type)(e)}class iL{buildTransformation;operations;constructor(e,t=[]){this.buildTransformation=e,this.operations=t}getOperations(){return this.operations}getOperation(e){const t=this.operations.find((t=>t.id===e));if(!t)throw new Error(`Operation ${e} not found`);return t}getLastOperationId(){return this.operations[this.operations.length-1]?.id}getFirstOperationAmong(e,t){for(const o of this.operations){if(o.id===e)return e;if(o.id===t)return t}throw new Error(`Operation ${e} and ${t} not found`)}contains(e){return!!this.operations.find((t=>t.id===e))}prepend(e){const t=this.buildTransformation.with(e.data);this.operations=[e,...this.operations.map((e=>e.transformed(t)))]}insert(e,t){const o=this.buildTransformation.with(e.data),{before:s,operation:i,after:n}=this.locateOperation(t);this.operations=[...s,i,e,...n.map((e=>e.transformed(o)))]}append(e){this.operations.push(e)}appendBranch(e){this.operations=this.operations.concat(e.operations)}fork(e){const{after:t}=this.locateOperation(e);return new iL(this.buildTransformation,t)}transform(e){this.operations=this.operations.map((t=>t.transformed(e)))}cutBefore(e){this.operations=this.locateOperation(e).before}cutAfter(e){const{before:t,operation:o}=this.locateOperation(e);this.operations=t.concat([o])}locateOperation(e){const t=this.operations.findIndex((t=>t.id===e));if(-1===t)throw new Error(`Operation ${e} not found`);return{before:this.operations.slice(0,t),operation:this.operations[t],after:this.operations.slice(t+1)}}}class nL{id;data;constructor(e,t){this.id=e,this.data=t}transformed(e){return new rL(this.id,gt((()=>e(this.data))))}}class rL{id;lazyData;constructor(e,t){this.id=e,this.lazyData=t}get data(){return this.lazyData()}transformed(e){return new rL(this.id,this.lazyData.map(e))}}class aL{operations;constructor(e){this.operations=e}[Symbol.iterator](){return this.operations[Symbol.iterator]()}stopWith(e){return new aL(function*(e,t){for(const o of e)if(yield o,o.operation.id===t)return}(this.operations,e))}stopBefore(e){return new aL(function*(e,t){for(const o of e){if(o.operation.id===t)return;yield o}}(this.operations,e))}startAfter(e){return new aL(function*(e,t){let o=!0;for(const s of e)o||(yield s),s.operation.id===t&&(o=!1)}(this.operations,e))}}class lL{buildTransformation;branches;branchingOperationIds=new Map;constructor(e,t){this.buildTransformation=e,this.branches=[t]}getLastBranch(){return this.branches[this.branches.length-1]}execution(e){return new aL(Xe(this._execution(e),this._execution(e)))}revertedExecution(e){return new aL(Xe(this._revertedExecution(e),this._revertedExecution(e)))}insertOperationLast(e,t){const o=e.getLastOperationId()||this.previousBranch(e)?.getLastOperationId();e.append(t),o&&this.insertPrevious(e,t,o)}insertOperationAfter(e,t,o){e.insert(t,o),this.updateNextWith(e,t,o),this.insertPrevious(e,t,o)}undo(e,t){const o=this.buildTransformation.without(t.data),s=this.branchingOperationIds.get(e);this.branchingOperationIds.set(e,t.id);const i=e.fork(t.id);s&&this.branchingOperationIds.set(i,s),this.insertBranchAfter(e,i),this.transform(i,o)}redo(e){const t=this.nextBranch(e);if(!t)return;const o=this.nextBranch(t);this.removeBranchFromTree(t);const s=this.branchingOperationIds.get(t);s?this.branchingOperationIds.set(e,s):this.branchingOperationIds.delete(e),o&&this.rebaseUp(o)}drop(e){for(const t of this.branches)t.contains(e)&&t.cutBefore(e)}findOperation(e,t){for(const o of this.revertedExecution(e))if(o.operation.id===t)return o;throw new Error(`Operation ${t} not found`)}rebaseUp(e){const{previousBranch:t,branchingOperation:o}=this.findPreviousBranchingOperation(e);if(!t||!o)return;const s=this.buildTransformation.without(o.data),i=t.fork(o.id);this.branchingOperationIds.set(i,this.branchingOperationIds.get(e)),this.removeBranchFromTree(e),this.insertBranchAfter(t,i),i.transform(s);const n=this.nextBranch(i);n&&this.rebaseUp(n)}removeBranchFromTree(e){const t=this.branches.findIndex((t=>t===e));this.branches.splice(t,1)}insertBranchAfter(e,t){const o=this.branches.findIndex((t=>t===e));this.branches.splice(o+1,0,t)}updateNextWith(e,t,o){const s=this.branchingOperationIds.get(e),i=this.nextBranch(e);if(s&&i)if(e.getFirstOperationAmong(o,s)===s){const n=this.addToNextBranch(e,i,s,t,o);this.updateNextWith(i,n,o)}else{const e=this.buildTransformation.with(t.data);this.transform(i,e)}}addToNextBranch(e,t,o,s,i){let n=s;return i===o?(n=this.getTransformedOperation(e,o,s),t.prepend(n)):t.contains(i)?(n=this.getTransformedOperation(e,o,s),t.insert(n,i)):t.append(s),n}getTransformedOperation(e,t,o){const s=e.getOperation(t),i=this.buildTransformation.without(s.data);return o.transformed(i)}shouldExecute(e,t){return t.id!==this.branchingOperationIds.get(e)}transform(e,t){e.transform(t);const o=this.nextBranch(e);o&&this.transform(o,t)}insertPrevious(e,t,o){const{previousBranch:s,branchingOperation:i}=this.findPreviousBranchingOperation(e);if(!s||!i)return;const n=this.buildTransformation.with(i.data),r=e.fork(o);r.transform(n),s.cutAfter(o),s.appendBranch(r);const a=t.transformed(n);this.insertPrevious(s,a,o)}findPreviousBranchingOperation(e){const t=this.previousBranch(e);if(!t)return{previousBranch:void 0,branchingOperation:void 0};const o=this.branchingOperationIds.get(t);return o?{previousBranch:t,branchingOperation:t.getOperation(o)}:{previousBranch:void 0,branchingOperation:void 0}}nextBranch(e){const t=this.branches.findIndex((t=>t===e));if(-1!==t)return this.branches[t+1]}previousBranch(e){const t=this.branches.findIndex((t=>t===e));if(-1!==t)return this.branches[t-1]}*_revertedExecution(e){const t=this.branchingOperationIds.get(e);let o=!!t;const s=e.getOperations();for(let i=s.length-1;i>=0;i--){const n=s[i];n.id===t&&(o=!1),o||(yield{operation:n,branch:e,isCancelled:!this.shouldExecute(e,n)})}const i=this.previousBranch(e);yield*i?this._revertedExecution(i):[]}*_execution(e){for(const t of e.getOperations())if(yield{operation:t,branch:e,isCancelled:!this.shouldExecute(e,t)},t.id===this.branchingOperationIds.get(e)){const t=this.nextBranch(e);return void(yield*t?this._execution(t):[])}if(!this.branchingOperationIds.get(e)){const t=this.nextBranch(e);yield*t?this._execution(t):[]}}}class cL{HEAD_BRANCH;HEAD_OPERATION;tree;applyOperation;revertOperation;buildEmpty;buildTransformation;constructor(e){this.applyOperation=e.applyOperation,this.revertOperation=e.revertOperation,this.buildEmpty=e.buildEmpty,this.buildTransformation=e.buildTransformation,this.HEAD_BRANCH=new iL(this.buildTransformation),this.tree=new lL(this.buildTransformation,this.HEAD_BRANCH);const t=e.initialOperationId,o=new nL(t,this.buildEmpty(t));this.tree.insertOperationLast(this.HEAD_BRANCH,o),this.HEAD_OPERATION=o}get(e){return this.tree.findOperation(this.HEAD_BRANCH,e).operation.data}append(e,t){const o=new nL(e,t),s=this.tree.getLastBranch();this.tree.insertOperationLast(s,o),this.HEAD_BRANCH=s,this.HEAD_OPERATION=o}insert(e,t,o){const s=new nL(e,t);this.revertTo(o),this.tree.insertOperationAfter(this.HEAD_BRANCH,s,o),this.fastForward()}undo(e,t,o){const{branch:s,operation:i}=this.tree.findOperation(this.HEAD_BRANCH,e);this.revertBefore(e),this.tree.undo(s,i),this.fastForward(),this.insert(t,this.buildEmpty(t),o)}redo(e,t,o){const{branch:s}=this.tree.findOperation(this.HEAD_BRANCH,e);this.revertBefore(e),this.tree.redo(s),this.fastForward(),this.insert(t,this.buildEmpty(t),o)}rebase(e){const t=this.get(e),o=[...this.tree.execution(this.HEAD_BRANCH).startAfter(e)];this.revertBefore(e);const s=this.HEAD_OPERATION.id;this.tree.drop(e),this.insert(e,t,s);for(const{operation:e}of o)this.insert(e.id,e.data,this.HEAD_OPERATION.id)}revertBefore(e){const t=this.tree.revertedExecution(this.HEAD_BRANCH).stopWith(e);this.revert(t)}revertTo(e){const t=e?this.tree.revertedExecution(this.HEAD_BRANCH).stopBefore(e):this.tree.revertedExecution(this.HEAD_BRANCH);this.revert(t)}revert(e){for(const{next:t,operation:o,isCancelled:s}of e)s||this.revertOperation(o.data),t&&(this.HEAD_BRANCH=t.branch,this.HEAD_OPERATION=t.operation)}fastForward(){const e=this.HEAD_OPERATION?this.tree.execution(this.HEAD_BRANCH).startAfter(this.HEAD_OPERATION.id):this.tree.execution(this.HEAD_BRANCH);for(const{operation:t,branch:o,isCancelled:s}of e)s||this.applyOperation(t.data),this.HEAD_OPERATION=t,this.HEAD_BRANCH=o}}function hL(e){return new cL({initialOperationId:e.initialRevisionId,applyOperation:t=>{const o=t.commands.slice(),{changes:s}=e.recordChanges((()=>{for(const t of o)e.dispatch(t)}));t.setChanges(s)},revertOperation:e=>function(e){for(const t of e.slice().reverse())for(let e=t.changes.length-1;e>=0;e--){dL(t.changes[e])}}([e]),buildEmpty:e=>new Jk(e,"empty",[]),buildTransformation:{with:e=>t=>new Jk(t.id,t.clientId,Xk(t.commands,e.commands),t.rootCommand,void 0,t.timestamp),without:e=>t=>new Jk(t.id,t.clientId,Xk(t.commands,e.commands.map(sL).flat()),t.rootCommand,void 0,t.timestamp)}})}function dL(e){const t=e.target,o=e.key,s=e.before;void 0===s?delete t[o]:t[o]=s}class uL{observers=new Map;defaultSubscription;mainSubscription;registerAsDefault(e,t){this.defaultSubscription={owner:e,callbacks:t},this.mainSubscription||(this.mainSubscription=this.defaultSubscription)}observe(e,t){this.observers.set(e,{owner:e,callbacks:t})}detachObserver(e){this.observers.delete(e)}capture(e,t){if(this.observers.get(e))throw new Error("You are already subscribed forever");this.mainSubscription?.owner&&this.mainSubscription.owner!==e&&this.mainSubscription.callbacks.release?.(),this.mainSubscription={owner:e,callbacks:t}}release(e){this.mainSubscription?.owner!==e||this.observers.get(e)||(this.mainSubscription=this.defaultSubscription)}getBackToDefault(){this.mainSubscription!==this.defaultSubscription&&(this.mainSubscription?.callbacks.release?.(),this.mainSubscription=this.defaultSubscription)}isListening(e){return this.mainSubscription?.owner===e}send(e){this.mainSubscription?.callbacks.handleEvent(e),this.observers.forEach((t=>t.callbacks.handleEvent(e)))}}class gL{getters;stream;anchor;defaultAnchor;constructor(e){this.getters=e,this.stream=new uL,this.anchor={cell:{col:0,row:0},zone:rs({col:0,row:0})},this.defaultAnchor=this.anchor}capture(e,t,o){this.stream.capture(e,o),this.anchor=t}registerAsDefault(e,t,o){this.checkAnchorZoneOrThrow(t),this.stream.registerAsDefault(e,o),this.defaultAnchor=t,this.capture(e,t,o)}resetDefaultAnchor(e,t){this.checkAnchorZoneOrThrow(t),this.stream.isListening(e)&&(this.anchor=t),this.defaultAnchor=t}resetAnchor(e,t){this.checkAnchorZoneOrThrow(t),this.stream.isListening(e)&&(this.anchor=t)}observe(e,t){this.stream.observe(e,t)}detachObserver(e){this.stream.detachObserver(e)}release(e){this.stream.isListening(e)&&(this.stream.release(e),this.anchor=this.defaultAnchor)}getBackToDefault(){this.stream.getBackToDefault()}modifyAnchor(e,t,o){const s=this.getters.getActiveSheetId();return e={...e,zone:this.getters.expandZone(s,e.zone)},this.processEvent({options:o,anchor:e,mode:t})}selectZone(e,t={scrollIntoView:!0}){return this.modifyAnchor(e,"overrideSelection",t)}selectCell(e,t){const o=rs({col:e,row:t});return this.selectZone({zone:o,cell:{col:e,row:t}},{scrollIntoView:!0})}moveAnchorCell(e,t=1){if("end"!==t&&t<=0)return new vi("InvalidSelectionStep");const{col:o,row:s}=this.getNextAvailablePosition(e,t);return this.selectCell(o,s)}setAnchorCorner(e,t){const o=this.getters.getActiveSheetId(),{col:s,row:i}=this.anchor.cell,n={left:Math.min(s,e),top:Math.min(i,t),right:Math.max(s,e),bottom:Math.max(i,t)},r={zone:this.getters.expandZone(o,n),cell:{col:s,row:i}};return this.processEvent({mode:"updateAnchor",anchor:r,options:{scrollIntoView:!1}})}addCellToSelection(e,t){const o=this.getters.getActiveSheetId();({col:e,row:t}=this.getters.getMainCellPosition({sheetId:o,col:e,row:t}));const s=this.getters.expandZone(o,rs({col:e,row:t}));return this.processEvent({options:{scrollIntoView:!0},anchor:{zone:s,cell:{col:e,row:t}},mode:"newAnchor"})}resizeAnchorZone(e,t=1){if("end"!==t&&t<=0)return new vi("InvalidSelectionStep");const o=this.getters.getActiveSheetId(),s=this.anchor,{col:i,row:n}=s.cell,{left:r,right:a,top:l,bottom:c}=s.zone,h=this.getStartingPosition(e);let[d,u]=this.deltaToTarget(h,e,t);if(0===d&&0===u)return vi.Success;let g=s.zone;const p=e=>{e=ss(e);const{left:t,right:s,top:i,bottom:n}=this.getters.expandZone(o,e);return{left:Math.max(0,t),right:Math.min(this.getters.getNumberCols(o)-1,s),top:Math.max(0,i),bottom:Math.min(this.getters.getNumberRows(o)-1,n)}},{cell:m,zone:f}=this.getReferenceAnchor(),{col:v,row:b}=m;let S=0;for(;null!==g;){if(S++,d<0){const e=this.getNextAvailableCol(d,a-(S-1),b);g=f.right<=a-S?p({top:l,left:r,bottom:c,right:e}):null}if(d>0){const e=this.getNextAvailableCol(d,r+(S-1),b);g=r+S<=f.left?p({top:l,left:e,bottom:c,right:a}):null}if(u<0){const e=this.getNextAvailableRow(u,v,c-(S-1));g=f.bottom<=c-S?p({top:l,left:r,bottom:e,right:a}):null}if(u>0){const e=this.getNextAvailableRow(u,v,l+(S-1));g=l+S<=f.top?p({top:e,left:r,bottom:c,right:a}):null}if(g=g?ss(g):g,g&&!Yo(g,s.zone))return this.processEvent({options:{scrollIntoView:!0},mode:"updateAnchor",anchor:{zone:g,cell:{col:i,row:n}}})}g=p(Zo({top:n,bottom:n,left:i,right:i},ss({top:this.getNextAvailableRow(u,v,l),left:this.getNextAvailableCol(d,r,b),bottom:this.getNextAvailableRow(u,v,c),right:this.getNextAvailableCol(d,a,b)})));const y={zone:g,cell:{col:i,row:n}};return this.processEvent({anchor:y,mode:"updateAnchor",options:{scrollIntoView:!0}})}selectColumn(e,t){const o=this.getters.getActiveSheetId(),s=this.getters.getNumberRows(o)-1;let i={left:e,right:e,top:0,bottom:s};const n=this.getters.findFirstVisibleColRowIndex(o,"ROW");let r,a;switch(t){case"overrideSelection":case"newAnchor":r=e,a=n;break;case"updateAnchor":({col:r,row:a}=this.anchor.cell),i=Zo(i,{left:r,right:r,top:n,bottom:s})}return this.processEvent({options:{scrollIntoView:!1,unbounded:!0},anchor:{zone:i,cell:{col:r,row:a}},mode:t})}selectRow(e,t){const o=this.getters.getActiveSheetId(),s=this.getters.getNumberCols(o)-1;let i={top:e,bottom:e,left:0,right:s};const n=this.getters.findFirstVisibleColRowIndex(o,"COL");let r,a;switch(t){case"overrideSelection":case"newAnchor":r=n,a=e;break;case"updateAnchor":({col:r,row:a}=this.anchor.cell),i=Zo(i,{left:n,right:s,top:a,bottom:a})}return this.processEvent({options:{scrollIntoView:!1,unbounded:!0},anchor:{zone:i,cell:{col:r,row:a}},mode:t})}loopSelection(){const e=this.getters.getActiveSheetId(),t=this.anchor;if(Yo(this.anchor.zone,this.getters.getSheetZone(e)))return this.modifyAnchor({...t,zone:rs(t.cell)},"updateAnchor",{scrollIntoView:!1});const o=this.getters.getContiguousZone(e,t.zone);return ft(o,t.zone)?this.selectAll():this.modifyAnchor({...t,zone:o},"updateAnchor",{scrollIntoView:!1})}selectTableAroundSelection(){const e=this.getters.getActiveSheetId(),t=this.getters.getContiguousZone(e,this.anchor.zone);return this.modifyAnchor({...this.anchor,zone:t},"updateAnchor",{scrollIntoView:!1})}selectAll(){const e=this.getters.getActiveSheetId(),t={left:0,top:0,bottom:this.getters.getNumberRows(e)-1,right:this.getters.getNumberCols(e)-1};return this.processEvent({mode:"overrideSelection",anchor:{zone:t,cell:this.anchor.cell},options:{scrollIntoView:!1}})}isListening(e){return this.stream.isListening(e)}processEvent(e){const t={...e,previousAnchor:ze(this.anchor)},o=this.checkEventAnchorZone(t);return"Success"!==o?new vi(o):(this.anchor=t.anchor,this.stream.send(t),vi.Success)}checkEventAnchorZone(e){return this.checkAnchorZone(e.anchor)}checkAnchorZone(e){const{cell:t,zone:o}=e;if(!Ko(t.col,t.row,o))return"InvalidAnchorZone";const{left:s,right:i,top:n,bottom:r}=o,a=this.getters.getActiveSheetId(),l=this.getters.findVisibleHeader(a,"COL",s,i);return void 0===this.getters.findVisibleHeader(a,"ROW",n,r)||void 0===l?"SelectionOutOfBound":"Success"}checkAnchorZoneOrThrow(e){if("InvalidAnchorZone"===this.checkAnchorZone(e))throw new Error("The provided anchor is invalid. The cell must be part of the zone.")}getNextAvailablePosition(e,t=1){const{col:o,row:s}=this.anchor.cell,i=this.deltaToTarget({col:o,row:s},e,t);return{col:this.getNextAvailableCol(i[0],o,s),row:this.getNextAvailableRow(i[1],o,s)}}getNextAvailableCol(e,t,o){const s=this.getters.getActiveSheetId(),i={col:t,row:o};return this.getNextAvailableHeader(e,"COL",t,i,(e=>this.getters.isInSameMerge(s,t,o,e,o)))}getNextAvailableRow(e,t,o){const s=this.getters.getActiveSheetId(),i={col:t,row:o};return this.getNextAvailableHeader(e,"ROW",o,i,(e=>this.getters.isInSameMerge(s,t,o,t,e)))}getNextAvailableHeader(e,t,o,s,i){const n=this.getters.getActiveSheetId();if(0===e)return o;const r=Math.sign(e);let a=o+e;for(;i(a);)a+=r;for(;this.getters.isHeaderHidden(n,t,a);)a+=r;return a<0||a>this.getters.getNumberHeaders(n,t)-1?this.getters.isHeaderHidden(n,t,o)?this.getNextAvailableHeader(-r,t,o,s,i):o:a}getReferenceAnchor(){const e=this.getters.getActiveSheetId(),t=this.anchor,{left:o,right:s,top:i,bottom:n}=t.zone,{col:r,row:a}=t.cell,l=this.getters.isColHidden(e,r)&&this.getters.findVisibleHeader(e,"COL",o,s)||r,c=this.getters.isRowHidden(e,a)&&this.getters.findVisibleHeader(e,"ROW",i,n)||a;return{cell:{col:l,row:c},zone:this.getters.expandZone(e,{left:l,right:l,top:c,bottom:c})}}deltaToTarget(e,t,o){switch(t){case"up":return"end"!==o?[0,-o]:[0,this.getEndOfCluster(e,"rows",-1)-e.row];case"down":return"end"!==o?[0,o]:[0,this.getEndOfCluster(e,"rows",1)-e.row];case"left":return"end"!==o?[-o,0]:[this.getEndOfCluster(e,"cols",-1)-e.col,0];case"right":return"end"!==o?[o,0]:[this.getEndOfCluster(e,"cols",1)-e.col,0]}}getStartingPosition(e){let{col:t,row:o}=this.getPosition();const s=this.anchor.zone;switch(e){case"down":case"up":o=o===s.top?s.bottom:s.top;break;case"left":case"right":t=t===s.right?s.left:s.right}return{col:t,row:o}}getEndOfCluster(e,t,o){const s=this.getters.getActiveSheetId();let i=e;const n=this.getNextCellPosition(e,t,o);let r=this.isCellSkippableInCluster({...i,sheetId:s})||this.isCellSkippableInCluster({...n,sheetId:s})?"nextCluster":"endOfCluster";for(;;){const e=this.getNextCellPosition(i,t,o);if(i.col===e.col&&i.row===e.row)break;const n=this.isCellSkippableInCluster({...e,sheetId:s});if("endOfCluster"===r&&n)break;if("nextCluster"===r&&!n){i=e;break}i=e}return"cols"===t?i.col:i.row}getNextCellPosition(e,t,o){const s={...e};return s["cols"===t?"col":"row"]="cols"===t?this.getNextAvailableCol(o,s.col,s.row):this.getNextAvailableRow(o,s.col,s.row),{col:s.col,row:s.row}}getPosition(){return{...this.anchor.cell}}isCellSkippableInCluster(e){const t=this.getters.getMainCellPosition(e),o=this.getters.getEvaluatedCell(t);return o.type===ai.empty||o.type===ai.text&&""===o.value}}function pL(e){if("string"==typeof e)return{};if("number"==typeof e)return[];throw new Error("Cannot create new node")}class mL{changes;commands=[];recordChanges(e){return this.changes=[],this.commands=[],e(),{changes:this.changes,commands:this.commands}}addCommand(e){this.commands.push(e)}addChange(...e){const t=e.pop();let o=e[0],s=e.at(-1);const i=e.length-2;for(let t=1;t<=i;t++){const s=e[t];if(void 0===o[s]){const i=e[t+1];o[s]=pL(i)}o=o[s]}o[s]!==t&&(this.changes?.push({key:s,target:o,before:o[s]}),void 0===t?delete o[s]:o[s]=t)}}const fL=17781237,vL=17781238,bL=88853993,SL=88853994;function yL(e,t,o){const s=[["xmlns:r",Fx],["xmlns:a",Tx],["xmlns:c",Ax]],i=CL({backgroundColor:e.data.backgroundColor,line:{color:"000000"}});let n=ux``;if(e.data.title?.text){const t=CC(OS(e.data.backgroundColor)),o=e.data.title.fontSize??K;n=ux`
|
|
2579
2579
|
<c:title>
|
|
2580
2580
|
${IL(e.data.title.text,t,o,e.data.title)}
|
|
2581
2581
|
<c:overlay val="0" />
|
|
@@ -3312,4 +3312,4 @@
|
|
|
3312
3312
|
<tableParts count="${e.tables.length}">
|
|
3313
3313
|
${dx(a)}
|
|
3314
3314
|
</tableParts>
|
|
3315
|
-
`}var mH;!function(e){e[e.Ready=0]="Ready",e[e.Running=1]="Running",e[e.RunningCore=2]="RunningCore",e[e.Finalizing=3]="Finalizing"}(mH||(mH={}));function fH(e,t={}){const o=ze(t);return o.type=e,o}const vH={},bH={MIN_ROW_HEIGHT:10,MIN_COL_WIDTH:5,HEADER_HEIGHT:te,HEADER_WIDTH:oe,BOTTOMBAR_HEIGHT:36,DEFAULT_CELL_WIDTH:se,DEFAULT_CELL_HEIGHT:ie,SCROLLBAR_WIDTH:ne},SH={autoCompleteProviders:Py,autofillModifiersRegistry:Ky,autofillRulesRegistry:Jy,cellMenuRegistry:VD,colMenuRegistry:IO,errorTypes:Ai,linkMenuRegistry:rA,functionRegistry:Kb,featurePluginRegistry:yV,iconsOnCellRegistry:$x,statefulUIPluginRegistry:CV,coreViewsPluginRegistry:wV,corePluginRegistry:SV,rowMenuRegistry:TO,sidePanelRegistry:kP,figureRegistry:mx,chartSidePanelComponentRegistry:XF,chartComponentRegistry:AI,chartRegistry:TI,chartSubtypeRegistry:_I,topbarMenuRegistry:DO,topbarComponentRegistry:VP,clickableCellRegistry:IV,otRegistry:_O,inverseCommandRegistry:Sx,urlRegistry:Tn,cellPopoverRegistry:nC,numberFormatMenuRegistry:xO,repeatLocalCommandTransformRegistry:gV,repeatCommandTransformRegistry:uV,clipboardHandlersRegistries:th,pivotRegistry:lP,pivotTimeAdapterRegistry:vc,pivotSidePanelRegistry:uP,pivotNormalizationValueRegistry:jc,supportedPivotPositionalFormulaRegistry:Xy,pivotToFunctionValueRegistry:Yc,migrationStepRegistry:fT,chartJsExtensionRegistry:Rh},yH={arg:Ph,isEvaluationError:Hi,toBoolean:Qi,toJsDate:en,toNumber:zi,toString:Xi,toNormalizedPivotValue:Gc,toFunctionPivotValue:qc,toXC:Oo,toZone:Ho,toUnboundedZone:Lo,toCartesian:_o,numberToLetters:yo,lettersToNumber:Co,UuidGenerator:$a,formatValue:sr,createCurrencyFormat:vr,ColorGenerator:mo,computeTextWidth:Da,createEmptyWorkbookData:TT,createEmptySheet:RT,createEmptyExcelSheet:AT,rgbaToHex:Xt,colorToRGBA:Kt,positionToZone:rs,isDefined:lt,isMatrix:Ii,lazy:gt,genericRepeat:pV,createAction:i,createActions:o,transformRangeData:sh,deepEquals:ft,overlap:Xo,union:Zo,isInside:Ko,deepCopy:ze,expandZoneOnInsertion:$o,reduceZoneOnDeletion:qo,unquote:Ge,getMaxObjectId:kc,getFunctionsFromTokens:mS,getFirstPivotFunction:jy,getNumberOfPivotFunctions:Yy,parseDimension:Hc,isDateOrDatetimeField:Uc,makeFieldProposal:Gy,insertTokenAfterArgSeparator:Wy,insertTokenAfterLeftParenthesis:qy,mergeContiguousZones:us,getPivotHighlights:AO,pivotTimeAdapter:bc,UNDO_REDO_PIVOT_COMMANDS:kk,createPivotFormula:$c,areDomainArgsFieldsValid:zc,splitReference:Jr,sanitizeSheetName:qe,getUniqueText:Lt,isNumber:Xs,isDateTime:Ms},CH={isMarkdownLink:et,parseMarkdownLink:st,markdownLink:ot,openLink:Fn,urlRepresentation:On},wH={Checkbox:WT,Section:OO,RoundColorPicker:lF,ChartDataSeries:$O,ChartErrorSection:WO,ChartLabelRange:qO,ChartTitle:nF,ChartPanel:QF,ChartFigure:FI,ChartJsComponent:by,Grid:HN,GridOverlay:fN,ScorecardChart:My,LineConfigPanel:LF,BarConfigPanel:jO,PieChartDesignPanel:HF,GenericChartConfigPanel:ZO,ChartWithAxisDesignPanel:gF,GaugeChartConfigPanel:fF,GaugeChartDesignPanel:FF,ScorecardChartConfigPanel:BF,ScorecardChartDesignPanel:zF,GeoChartDesignPanel:kF,RadarChartDesignPanel:UF,WaterfallChartDesignPanel:YF,ComboChartDesignPanel:pF,FunnelChartDesignPanel:mF,ChartTypePicker:KF,FigureComponent:LP,Menu:aA,Popover:HT,SelectionInput:zO,ValidationMessages:GO,AddDimensionButton:VM,PivotDimensionGranularity:BM,PivotDimensionOrder:zM,PivotDimension:UM,PivotLayoutConfigurator:WM,PivotHTMLRenderer:UN,PivotDeferUpdate:NM,PivotTitleSection:qM,CogWheelMenu:HM,TextInput:LM,SidePanelCollapsible:XO,RadioSelection:aF,GeoChartRegionSelectSection:MF},IH={useDragAndDropListItems:MO,useHighlights:sM,useHighlightsOnHover:oM},xH={useStoreProvider:lh,DependencyContainer:nh,CellPopoverStore:PT,ComposerFocusStore:Sh,CellComposerStore:KP,FindAndReplaceStore:DM,HighlightStore:Vy,DelayedHoveredCellStore:MT,HoveredTableStore:pN,ModelStore:ph,NotificationStore:Ly,RendererStore:fh,SelectionInputStore:BO,SpreadsheetStore:vh,useStore:ch,useLocalStore:hh,SidePanelStore:NN,PivotSidePanelStore:hP,PivotMeasureDisplayPanelStore:MM};const EH={DEFAULT_LOCALE:Ci,HIGHLIGHT_COLOR:a,PIVOT_TABLE_CONFIG:Ve,ChartTerms:AC},RH={...ex,...tI};e.AbstractCellClipboardHandler=Ja,e.AbstractChart=Sy,e.AbstractFigureClipboardHandler=eh,e.CellErrorType=Ti,e.CorePlugin=zN,e.CoreViewPlugin=XN,e.DispatchResult=vi,e.EvaluationError=Di,e.Model=class extends ih{corePlugins=[];statefulUIPlugins=[];range;session;isReplayingCommand=!1;renderers={};status=0;config;corePluginConfig;coreViewPluginConfig;uiPluginConfig;state;selection;getters;coreGetters;uuidGenerator;handlers=[];uiHandlers=[];coreHandlers=[];constructor(e={},o={},s=[],i=new $a,n=!1){const r=performance.now();console.debug("##### Model creation #####"),super(),oi===ei&&si===ti&&(si=()=>!0),s=xT(e,s);const a=CT(e,n);this.state=new mL,this.uuidGenerator=i,this.config=this.setupConfig(o),this.session=this.setupSession(a.revisionId),this.coreGetters={},this.range=new jN(this.coreGetters),this.coreGetters.getRangeString=this.range.getRangeString.bind(this.range),this.coreGetters.getRangeFromSheetXC=this.range.getRangeFromSheetXC.bind(this.range),this.coreGetters.createAdaptedRanges=this.range.createAdaptedRanges.bind(this.range),this.coreGetters.getRangeData=this.range.getRangeData.bind(this.range),this.coreGetters.getRangeDataFromXc=this.range.getRangeDataFromXc.bind(this.range),this.coreGetters.getRangeDataFromZone=this.range.getRangeDataFromZone.bind(this.range),this.coreGetters.getRangeFromRangeData=this.range.getRangeFromRangeData.bind(this.range),this.coreGetters.getRangeFromZone=this.range.getRangeFromZone.bind(this.range),this.coreGetters.recomputeRanges=this.range.recomputeRanges.bind(this.range),this.coreGetters.isRangeValid=this.range.isRangeValid.bind(this.range),this.coreGetters.extendRange=this.range.extendRange.bind(this.range),this.coreGetters.getRangesUnion=this.range.getRangesUnion.bind(this.range),this.coreGetters.removeRangesSheetPrefix=this.range.removeRangesSheetPrefix.bind(this.range),this.coreGetters.adaptFormulaStringDependencies=this.range.adaptFormulaStringDependencies.bind(this.range),this.coreGetters.copyFormulaStringForSheet=this.range.copyFormulaStringForSheet.bind(this.range),this.getters={isReadonly:()=>"readonly"===this.config.mode||"dashboard"===this.config.mode,isDashboard:()=>"dashboard"===this.config.mode},this.selection=new gL(this.getters),this.coreHandlers.push(this.range),this.handlers.push(this.range),this.corePluginConfig=this.setupCorePluginConfig(),this.coreViewPluginConfig=this.setupCoreViewPluginConfig(),this.uiPluginConfig=this.setupUiPluginConfig();for(let e of SV.getAll())this.setupCorePlugin(e,a);Object.assign(this.getters,this.coreGetters),this.session.loadInitialMessages(s);for(let e of wV.getAll()){const t=this.setupCoreViewPlugin(e);this.handlers.push(t),this.uiHandlers.push(t),this.coreHandlers.push(t)}for(let e of CV.getAll()){const t=this.setupUiPlugin(e);this.statefulUIPlugins.push(t),this.handlers.push(t),this.uiHandlers.push(t)}for(let e of yV.getAll()){const t=this.setupUiPlugin(e);this.handlers.push(t),this.uiHandlers.push(t)}if(this.dispatch("START"),this.selection.observe(this,{handleEvent:()=>this.trigger("update")}),this.setupSessionEvents(),this.joinSession(),o.snapshotRequested||e["[Content_Types].xml"]&&!this.getters.isReadonly()){const e=performance.now();console.debug("Snapshot requested"),this.session.snapshot(this.exportData()),this.garbageCollectExternalResources(),console.debug("Snapshot taken in",performance.now()-e,"ms")}t.markRaw(this),console.debug("Model created in",performance.now()-r,"ms"),console.debug("######")}joinSession(){this.session.join(this.config.client)}async leaveSession(){const e=this.getters.isReadonly()?void 0:gt((()=>this.exportData()));await this.session.leave(e)}setupUiPlugin(e){const t=new e(this.uiPluginConfig);for(let o of e.getters){if(!(o in t))throw new Error(`Invalid getter name: ${o} for plugin ${t.constructor}`);if(o in this.getters)throw new Error(`Getter "${o}" is already defined.`);this.getters[o]=t[o].bind(t)}for(const o of e.layers)this.renderers[o]||(this.renderers[o]=[]),this.renderers[o].push(t);return t}setupCoreViewPlugin(e){const t=new e(this.coreViewPluginConfig);for(let o of e.getters){if(!(o in t))throw new Error(`Invalid getter name: ${o} for plugin ${t.constructor}`);if(o in this.getters)throw new Error(`Getter "${o}" is already defined.`);this.getters[o]=t[o].bind(t)}return t}setupCorePlugin(e,t){const o=new e(this.corePluginConfig);for(let t of e.getters){if(!(t in o))throw new Error(`Invalid getter name: ${t} for plugin ${o.constructor}`);if(t in this.coreGetters)throw new Error(`Getter "${t}" is already defined.`);this.coreGetters[t]=o[t].bind(o)}o.import(t),this.corePlugins.push(o),this.coreHandlers.push(o),this.handlers.push(o)}onRemoteRevisionReceived({commands:e}){for(let t of e){const e=this.status;this.status=2,this.dispatchToHandlers(this.statefulUIPlugins,t),this.status=e}this.finalize()}setupSession(e){return new eV(hL({initialRevisionId:e,recordChanges:this.state.recordChanges.bind(this.state),dispatch:e=>{this.checkDispatchAllowed(e).isSuccessful?(this.isReplayingCommand=!0,this.dispatchToHandlers(this.coreHandlers,e),this.isReplayingCommand=!1):this.dispatchToHandlers(this.coreHandlers,{type:"UNDO",commands:[e]})}}),this.config.transportService,e)}setupSessionEvents(){this.session.on("remote-revision-received",this,this.onRemoteRevisionReceived),this.session.on("revision-undone",this,(({commands:e})=>{this.dispatchFromCorePlugin("UNDO",{commands:e}),this.finalize()})),this.session.on("revision-redone",this,(({commands:e})=>{this.dispatchFromCorePlugin("REDO",{commands:e}),this.finalize()})),this.session.on("unexpected-revision-id",this,(()=>this.trigger("unexpected-revision-id"))),this.session.on("collaborative-event-received",this,(()=>{this.trigger("update")}))}setupConfig(e){const t=e.client||{id:this.uuidGenerator.smallUuid(),name:ni("Anonymous").toString()},o=e.transportService||new oL;return{...e,mode:e.mode||"normal",custom:e.custom||{},external:this.setupExternalConfig(e.external||{}),transportService:o,client:t,moveClient:()=>{},snapshotRequested:!1,notifyUI:e=>this.trigger("notify-ui",e),raiseBlockingErrorUI:e=>this.trigger("raise-error-ui",{text:e}),customColors:e.customColors||[]}}setupExternalConfig(e){const t=e.loadLocales||(()=>Promise.resolve(yi));return{...e,loadLocales:t}}setupCorePluginConfig(){return{getters:this.coreGetters,stateObserver:this.state,range:this.range,dispatch:this.dispatchFromCorePlugin,canDispatch:this.canDispatch,custom:this.config.custom,external:this.config.external}}setupCoreViewPluginConfig(){return{getters:this.getters,stateObserver:this.state,selection:this.selection,moveClient:this.session.move.bind(this.session),custom:this.config.custom,uiActions:this.config,session:this.session,defaultCurrency:this.config.defaultCurrency,customColors:this.config.customColors||[],external:this.config.external}}setupUiPluginConfig(){return{getters:this.getters,stateObserver:this.state,dispatch:this.dispatch,canDispatch:this.canDispatch,selection:this.selection,moveClient:this.session.move.bind(this.session),custom:this.config.custom,uiActions:this.config,session:this.session,defaultCurrency:this.config.defaultCurrency,customColors:this.config.customColors||[],external:this.config.external}}checkDispatchAllowed(e){const t=fi(e)?this.checkDispatchAllowedCoreCommand(e):this.checkDispatchAllowedLocalCommand(e);return t.some((e=>"Success"!==e))?new vi(t.flat()):vi.Success}checkDispatchAllowedCoreCommand(e){const t=this.corePlugins.map((t=>t.allowDispatch(e)));return t.push(this.range.allowDispatch(e)),t}checkDispatchAllowedLocalCommand(e){return this.uiHandlers.map((t=>t.allowDispatch(e)))}finalize(){this.status=3;for(const e of this.handlers)e.finalize();this.status=0,this.trigger("command-finalized")}canDispatch=(e,t)=>this.checkDispatchAllowed(fH(e,t));dispatch=(e,t)=>{const o=fH(e,t);let s=this.status;if(this.getters.isReadonly()&&(i=o,!pi.has(i.type)))return new vi("Readonly");var i;if(!this.session.canApplyOptimisticUpdate())return new vi("WaitingSessionConfirmation");switch(s){case 0:const t=this.checkDispatchAllowed(o);if(!t.isSuccessful)return this.trigger("update"),t;this.status=1;const{changes:s,commands:i}=this.state.recordChanges((()=>{const t=performance.now();fi(o)&&this.state.addCommand(o),this.dispatchToHandlers(this.handlers,o),this.finalize();const s=performance.now()-t;s>5&&console.debug(e,s,"ms")}));this.session.save(o,i,s),this.status=0,this.trigger("update");break;case 1:if(fi(o)){const e=this.checkDispatchAllowed(o);if(!e.isSuccessful)return e;this.state.addCommand(o)}this.dispatchToHandlers(this.handlers,o);break;case 3:throw new Error("Cannot dispatch commands in the finalize state");case 2:if(fi(o))throw new Error(`A UI plugin cannot dispatch ${e} while handling a core command`);this.dispatchToHandlers(this.handlers,o)}return vi.Success};dispatchFromCorePlugin=(e,t)=>{const o=fH(e,t),s=this.status;this.status=2;const i=this.isReplayingCommand?this.coreHandlers:this.handlers;return this.dispatchToHandlers(i,o),this.status=s,vi.Success};dispatchToHandlers(e,t){const o=fi(t);for(const s of e)!o&&s instanceof zN||s.beforeHandle(t);for(const s of e)!o&&s instanceof zN||s.handle(t);this.trigger("command-dispatched",t)}drawLayer(e,t){const o=this.renderers[t];if(o)for(const s of o)e.ctx.save(),s.drawLayer(e,t),e.ctx.restore()}exportData(){let e=TT();for(let t of this.handlers)t instanceof zN&&t.export(e);return e.revisionId=this.session.getRevisionId()||ye,e=ze(e),e}updateMode(e){this.config.mode=e,this.trigger("update")}exportXLSX(){this.dispatch("EVALUATE_CELLS");let e={...TT(),sheets:[AT(yT,"Sheet1")]};for(let t of this.handlers)t instanceof BN&&t.exportForExcel(e);return e=ze(e),gH(e)}garbageCollectExternalResources(){for(const e of this.corePlugins)e.garbageCollectExternalResources()}},e.PivotRuntimeDefinition=ZM,e.Registry=n,e.Revision=Jk,e.SPREADSHEET_DIMENSIONS=bH,e.Spreadsheet=tL,e.SpreadsheetPivotTable=XM,e.UIPlugin=Lk,e.__info__=vH,e.addFunction=function e(t,o){return Kb.add(t,o),{addFunction:(t,o)=>e(t,o)}},e.addRenderingLayer=function(e,t){if(Ei[e])throw new Error(`Layer ${e} already exists`);Ei[e]=t},e.astToFormula=Uf,e.chartHelpers=RH,e.compile=hS,e.compileTokens=dS,e.components=wH,e.constants=EH,e.convertAstNodes=kf,e.coreTypes=mi,e.findCellInNewZone=ns,e.functionCache=cS,e.helpers=yH,e.hooks=IH,e.invalidateCFEvaluationCommands=ui,e.invalidateChartEvaluationCommands=hi,e.invalidateDependenciesCommands=di,e.invalidateEvaluationCommands=ci,e.iterateAstNodes=Vf,e.links=CH,e.load=CT,e.parse=Pf,e.parseTokens=Nf,e.readonlyAllowedCommands=pi,e.registries=SH,e.setDefaultSheetViewSize=function(e){Me=e},e.setTranslationMethod=function(e,t=(()=>!0)){oi=e,si=t},e.stores=xH,e.tokenColors=By,e.tokenize=tl,vH.version="18.3.14",vH.date="2025-07-30T11:18:53.973Z",vH.hash="2a7178a"}(this.o_spreadsheet=this.o_spreadsheet||{},owl);
|
|
3315
|
+
`}var mH;!function(e){e[e.Ready=0]="Ready",e[e.Running=1]="Running",e[e.RunningCore=2]="RunningCore",e[e.Finalizing=3]="Finalizing"}(mH||(mH={}));function fH(e,t={}){const o=ze(t);return o.type=e,o}const vH={},bH={MIN_ROW_HEIGHT:10,MIN_COL_WIDTH:5,HEADER_HEIGHT:te,HEADER_WIDTH:oe,BOTTOMBAR_HEIGHT:36,DEFAULT_CELL_WIDTH:se,DEFAULT_CELL_HEIGHT:ie,SCROLLBAR_WIDTH:ne},SH={autoCompleteProviders:Py,autofillModifiersRegistry:Ky,autofillRulesRegistry:Jy,cellMenuRegistry:VD,colMenuRegistry:IO,errorTypes:Ai,linkMenuRegistry:rA,functionRegistry:Kb,featurePluginRegistry:yV,iconsOnCellRegistry:$x,statefulUIPluginRegistry:CV,coreViewsPluginRegistry:wV,corePluginRegistry:SV,rowMenuRegistry:TO,sidePanelRegistry:kP,figureRegistry:mx,chartSidePanelComponentRegistry:XF,chartComponentRegistry:AI,chartRegistry:TI,chartSubtypeRegistry:_I,topbarMenuRegistry:DO,topbarComponentRegistry:VP,clickableCellRegistry:IV,otRegistry:_O,inverseCommandRegistry:Sx,urlRegistry:Tn,cellPopoverRegistry:nC,numberFormatMenuRegistry:xO,repeatLocalCommandTransformRegistry:gV,repeatCommandTransformRegistry:uV,clipboardHandlersRegistries:th,pivotRegistry:lP,pivotTimeAdapterRegistry:vc,pivotSidePanelRegistry:uP,pivotNormalizationValueRegistry:jc,supportedPivotPositionalFormulaRegistry:Xy,pivotToFunctionValueRegistry:Yc,migrationStepRegistry:fT,chartJsExtensionRegistry:Rh},yH={arg:Ph,isEvaluationError:Hi,toBoolean:Qi,toJsDate:en,toNumber:zi,toString:Xi,toNormalizedPivotValue:Gc,toFunctionPivotValue:qc,toXC:Oo,toZone:Ho,toUnboundedZone:Lo,toCartesian:_o,numberToLetters:yo,lettersToNumber:Co,UuidGenerator:$a,formatValue:sr,createCurrencyFormat:vr,ColorGenerator:mo,computeTextWidth:Da,createEmptyWorkbookData:TT,createEmptySheet:RT,createEmptyExcelSheet:AT,rgbaToHex:Xt,colorToRGBA:Kt,positionToZone:rs,isDefined:lt,isMatrix:Ii,lazy:gt,genericRepeat:pV,createAction:i,createActions:o,transformRangeData:sh,deepEquals:ft,overlap:Xo,union:Zo,isInside:Ko,deepCopy:ze,expandZoneOnInsertion:$o,reduceZoneOnDeletion:qo,unquote:Ge,getMaxObjectId:kc,getFunctionsFromTokens:mS,getFirstPivotFunction:jy,getNumberOfPivotFunctions:Yy,parseDimension:Hc,isDateOrDatetimeField:Uc,makeFieldProposal:Gy,insertTokenAfterArgSeparator:Wy,insertTokenAfterLeftParenthesis:qy,mergeContiguousZones:us,getPivotHighlights:AO,pivotTimeAdapter:bc,UNDO_REDO_PIVOT_COMMANDS:kk,createPivotFormula:$c,areDomainArgsFieldsValid:zc,splitReference:Jr,sanitizeSheetName:qe,getUniqueText:Lt,isNumber:Xs,isDateTime:Ms},CH={isMarkdownLink:et,parseMarkdownLink:st,markdownLink:ot,openLink:Fn,urlRepresentation:On},wH={Checkbox:WT,Section:OO,RoundColorPicker:lF,ChartDataSeries:$O,ChartErrorSection:WO,ChartLabelRange:qO,ChartTitle:nF,ChartPanel:QF,ChartFigure:FI,ChartJsComponent:by,Grid:HN,GridOverlay:fN,ScorecardChart:My,LineConfigPanel:LF,BarConfigPanel:jO,PieChartDesignPanel:HF,GenericChartConfigPanel:ZO,ChartWithAxisDesignPanel:gF,GaugeChartConfigPanel:fF,GaugeChartDesignPanel:FF,ScorecardChartConfigPanel:BF,ScorecardChartDesignPanel:zF,GeoChartDesignPanel:kF,RadarChartDesignPanel:UF,WaterfallChartDesignPanel:YF,ComboChartDesignPanel:pF,FunnelChartDesignPanel:mF,ChartTypePicker:KF,FigureComponent:LP,Menu:aA,Popover:HT,SelectionInput:zO,ValidationMessages:GO,AddDimensionButton:VM,PivotDimensionGranularity:BM,PivotDimensionOrder:zM,PivotDimension:UM,PivotLayoutConfigurator:WM,PivotHTMLRenderer:UN,PivotDeferUpdate:NM,PivotTitleSection:qM,CogWheelMenu:HM,TextInput:LM,SidePanelCollapsible:XO,RadioSelection:aF,GeoChartRegionSelectSection:MF},IH={useDragAndDropListItems:MO,useHighlights:sM,useHighlightsOnHover:oM},xH={useStoreProvider:lh,DependencyContainer:nh,CellPopoverStore:PT,ComposerFocusStore:Sh,CellComposerStore:KP,FindAndReplaceStore:DM,HighlightStore:Vy,DelayedHoveredCellStore:MT,HoveredTableStore:pN,ModelStore:ph,NotificationStore:Ly,RendererStore:fh,SelectionInputStore:BO,SpreadsheetStore:vh,useStore:ch,useLocalStore:hh,SidePanelStore:NN,PivotSidePanelStore:hP,PivotMeasureDisplayPanelStore:MM};const EH={DEFAULT_LOCALE:Ci,HIGHLIGHT_COLOR:a,PIVOT_TABLE_CONFIG:Ve,ChartTerms:AC},RH={...ex,...tI};e.AbstractCellClipboardHandler=Ja,e.AbstractChart=Sy,e.AbstractFigureClipboardHandler=eh,e.CellErrorType=Ti,e.CorePlugin=zN,e.CoreViewPlugin=XN,e.DispatchResult=vi,e.EvaluationError=Di,e.Model=class extends ih{corePlugins=[];statefulUIPlugins=[];range;session;isReplayingCommand=!1;renderers={};status=0;config;corePluginConfig;coreViewPluginConfig;uiPluginConfig;state;selection;getters;coreGetters;uuidGenerator;handlers=[];uiHandlers=[];coreHandlers=[];constructor(e={},o={},s=[],i=new $a,n=!1){const r=performance.now();console.debug("##### Model creation #####"),super(),oi===ei&&si===ti&&(si=()=>!0),s=xT(e,s);const a=CT(e,n);this.state=new mL,this.uuidGenerator=i,this.config=this.setupConfig(o),this.session=this.setupSession(a.revisionId),this.coreGetters={},this.range=new jN(this.coreGetters),this.coreGetters.getRangeString=this.range.getRangeString.bind(this.range),this.coreGetters.getRangeFromSheetXC=this.range.getRangeFromSheetXC.bind(this.range),this.coreGetters.createAdaptedRanges=this.range.createAdaptedRanges.bind(this.range),this.coreGetters.getRangeData=this.range.getRangeData.bind(this.range),this.coreGetters.getRangeDataFromXc=this.range.getRangeDataFromXc.bind(this.range),this.coreGetters.getRangeDataFromZone=this.range.getRangeDataFromZone.bind(this.range),this.coreGetters.getRangeFromRangeData=this.range.getRangeFromRangeData.bind(this.range),this.coreGetters.getRangeFromZone=this.range.getRangeFromZone.bind(this.range),this.coreGetters.recomputeRanges=this.range.recomputeRanges.bind(this.range),this.coreGetters.isRangeValid=this.range.isRangeValid.bind(this.range),this.coreGetters.extendRange=this.range.extendRange.bind(this.range),this.coreGetters.getRangesUnion=this.range.getRangesUnion.bind(this.range),this.coreGetters.removeRangesSheetPrefix=this.range.removeRangesSheetPrefix.bind(this.range),this.coreGetters.adaptFormulaStringDependencies=this.range.adaptFormulaStringDependencies.bind(this.range),this.coreGetters.copyFormulaStringForSheet=this.range.copyFormulaStringForSheet.bind(this.range),this.getters={isReadonly:()=>"readonly"===this.config.mode||"dashboard"===this.config.mode,isDashboard:()=>"dashboard"===this.config.mode},this.selection=new gL(this.getters),this.coreHandlers.push(this.range),this.handlers.push(this.range),this.corePluginConfig=this.setupCorePluginConfig(),this.coreViewPluginConfig=this.setupCoreViewPluginConfig(),this.uiPluginConfig=this.setupUiPluginConfig();for(let e of SV.getAll())this.setupCorePlugin(e,a);Object.assign(this.getters,this.coreGetters),this.session.loadInitialMessages(s);for(let e of wV.getAll()){const t=this.setupCoreViewPlugin(e);this.handlers.push(t),this.uiHandlers.push(t),this.coreHandlers.push(t)}for(let e of CV.getAll()){const t=this.setupUiPlugin(e);this.statefulUIPlugins.push(t),this.handlers.push(t),this.uiHandlers.push(t)}for(let e of yV.getAll()){const t=this.setupUiPlugin(e);this.handlers.push(t),this.uiHandlers.push(t)}if(this.dispatch("START"),this.selection.observe(this,{handleEvent:()=>this.trigger("update")}),this.setupSessionEvents(),this.joinSession(),o.snapshotRequested||e["[Content_Types].xml"]&&!this.getters.isReadonly()){const e=performance.now();console.debug("Snapshot requested"),this.session.snapshot(this.exportData()),this.garbageCollectExternalResources(),console.debug("Snapshot taken in",performance.now()-e,"ms")}t.markRaw(this),console.debug("Model created in",performance.now()-r,"ms"),console.debug("######")}joinSession(){this.session.join(this.config.client)}async leaveSession(){const e=this.getters.isReadonly()?void 0:gt((()=>this.exportData()));await this.session.leave(e)}setupUiPlugin(e){const t=new e(this.uiPluginConfig);for(let o of e.getters){if(!(o in t))throw new Error(`Invalid getter name: ${o} for plugin ${t.constructor}`);if(o in this.getters)throw new Error(`Getter "${o}" is already defined.`);this.getters[o]=t[o].bind(t)}for(const o of e.layers)this.renderers[o]||(this.renderers[o]=[]),this.renderers[o].push(t);return t}setupCoreViewPlugin(e){const t=new e(this.coreViewPluginConfig);for(let o of e.getters){if(!(o in t))throw new Error(`Invalid getter name: ${o} for plugin ${t.constructor}`);if(o in this.getters)throw new Error(`Getter "${o}" is already defined.`);this.getters[o]=t[o].bind(t)}return t}setupCorePlugin(e,t){const o=new e(this.corePluginConfig);for(let t of e.getters){if(!(t in o))throw new Error(`Invalid getter name: ${t} for plugin ${o.constructor}`);if(t in this.coreGetters)throw new Error(`Getter "${t}" is already defined.`);this.coreGetters[t]=o[t].bind(o)}o.import(t),this.corePlugins.push(o),this.coreHandlers.push(o),this.handlers.push(o)}onRemoteRevisionReceived({commands:e}){for(let t of e){const e=this.status;this.status=2,this.dispatchToHandlers(this.statefulUIPlugins,t),this.status=e}this.finalize()}setupSession(e){return new eV(hL({initialRevisionId:e,recordChanges:this.state.recordChanges.bind(this.state),dispatch:e=>{this.checkDispatchAllowed(e).isSuccessful?(this.isReplayingCommand=!0,this.dispatchToHandlers(this.coreHandlers,e),this.isReplayingCommand=!1):this.dispatchToHandlers(this.coreHandlers,{type:"UNDO",commands:[e]})}}),this.config.transportService,e)}setupSessionEvents(){this.session.on("remote-revision-received",this,this.onRemoteRevisionReceived),this.session.on("revision-undone",this,(({commands:e})=>{this.dispatchFromCorePlugin("UNDO",{commands:e}),this.finalize()})),this.session.on("revision-redone",this,(({commands:e})=>{this.dispatchFromCorePlugin("REDO",{commands:e}),this.finalize()})),this.session.on("unexpected-revision-id",this,(()=>this.trigger("unexpected-revision-id"))),this.session.on("collaborative-event-received",this,(()=>{this.trigger("update")}))}setupConfig(e){const t=e.client||{id:this.uuidGenerator.smallUuid(),name:ni("Anonymous").toString()},o=e.transportService||new oL;return{...e,mode:e.mode||"normal",custom:e.custom||{},external:this.setupExternalConfig(e.external||{}),transportService:o,client:t,moveClient:()=>{},snapshotRequested:!1,notifyUI:e=>this.trigger("notify-ui",e),raiseBlockingErrorUI:e=>this.trigger("raise-error-ui",{text:e}),customColors:e.customColors||[]}}setupExternalConfig(e){const t=e.loadLocales||(()=>Promise.resolve(yi));return{...e,loadLocales:t}}setupCorePluginConfig(){return{getters:this.coreGetters,stateObserver:this.state,range:this.range,dispatch:this.dispatchFromCorePlugin,canDispatch:this.canDispatch,custom:this.config.custom,external:this.config.external}}setupCoreViewPluginConfig(){return{getters:this.getters,stateObserver:this.state,selection:this.selection,moveClient:this.session.move.bind(this.session),custom:this.config.custom,uiActions:this.config,session:this.session,defaultCurrency:this.config.defaultCurrency,customColors:this.config.customColors||[],external:this.config.external}}setupUiPluginConfig(){return{getters:this.getters,stateObserver:this.state,dispatch:this.dispatch,canDispatch:this.canDispatch,selection:this.selection,moveClient:this.session.move.bind(this.session),custom:this.config.custom,uiActions:this.config,session:this.session,defaultCurrency:this.config.defaultCurrency,customColors:this.config.customColors||[],external:this.config.external}}checkDispatchAllowed(e){const t=fi(e)?this.checkDispatchAllowedCoreCommand(e):this.checkDispatchAllowedLocalCommand(e);return t.some((e=>"Success"!==e))?new vi(t.flat()):vi.Success}checkDispatchAllowedCoreCommand(e){const t=this.corePlugins.map((t=>t.allowDispatch(e)));return t.push(this.range.allowDispatch(e)),t}checkDispatchAllowedLocalCommand(e){return this.uiHandlers.map((t=>t.allowDispatch(e)))}finalize(){this.status=3;for(const e of this.handlers)e.finalize();this.status=0,this.trigger("command-finalized")}canDispatch=(e,t)=>this.checkDispatchAllowed(fH(e,t));dispatch=(e,t)=>{const o=fH(e,t);let s=this.status;if(this.getters.isReadonly()&&(i=o,!pi.has(i.type)))return new vi("Readonly");var i;if(!this.session.canApplyOptimisticUpdate())return new vi("WaitingSessionConfirmation");switch(s){case 0:const t=this.checkDispatchAllowed(o);if(!t.isSuccessful)return this.trigger("update"),t;this.status=1;const{changes:s,commands:i}=this.state.recordChanges((()=>{const t=performance.now();fi(o)&&this.state.addCommand(o),this.dispatchToHandlers(this.handlers,o),this.finalize();const s=performance.now()-t;s>5&&console.debug(e,s,"ms")}));this.session.save(o,i,s),this.status=0,this.trigger("update");break;case 1:if(fi(o)){const e=this.checkDispatchAllowed(o);if(!e.isSuccessful)return e;this.state.addCommand(o)}this.dispatchToHandlers(this.handlers,o);break;case 3:throw new Error("Cannot dispatch commands in the finalize state");case 2:if(fi(o))throw new Error(`A UI plugin cannot dispatch ${e} while handling a core command`);this.dispatchToHandlers(this.handlers,o)}return vi.Success};dispatchFromCorePlugin=(e,t)=>{const o=fH(e,t),s=this.status;this.status=2;const i=this.isReplayingCommand?this.coreHandlers:this.handlers;return this.dispatchToHandlers(i,o),this.status=s,vi.Success};dispatchToHandlers(e,t){const o=fi(t);for(const s of e)!o&&s instanceof zN||s.beforeHandle(t);for(const s of e)!o&&s instanceof zN||s.handle(t);this.trigger("command-dispatched",t)}drawLayer(e,t){const o=this.renderers[t];if(o)for(const s of o)e.ctx.save(),s.drawLayer(e,t),e.ctx.restore()}exportData(){let e=TT();for(let t of this.handlers)t instanceof zN&&t.export(e);return e.revisionId=this.session.getRevisionId()||ye,e=ze(e),e}updateMode(e){this.config.mode=e,this.trigger("update")}exportXLSX(){this.dispatch("EVALUATE_CELLS");let e={...TT(),sheets:[AT(yT,"Sheet1")]};for(let t of this.handlers)t instanceof BN&&t.exportForExcel(e);return e=ze(e),gH(e)}garbageCollectExternalResources(){for(const e of this.corePlugins)e.garbageCollectExternalResources()}},e.PivotRuntimeDefinition=ZM,e.Registry=n,e.Revision=Jk,e.SPREADSHEET_DIMENSIONS=bH,e.Spreadsheet=tL,e.SpreadsheetPivotTable=XM,e.UIPlugin=Lk,e.__info__=vH,e.addFunction=function e(t,o){return Kb.add(t,o),{addFunction:(t,o)=>e(t,o)}},e.addRenderingLayer=function(e,t){if(Ei[e])throw new Error(`Layer ${e} already exists`);Ei[e]=t},e.astToFormula=Uf,e.chartHelpers=RH,e.compile=hS,e.compileTokens=dS,e.components=wH,e.constants=EH,e.convertAstNodes=kf,e.coreTypes=mi,e.findCellInNewZone=ns,e.functionCache=cS,e.helpers=yH,e.hooks=IH,e.invalidateCFEvaluationCommands=ui,e.invalidateChartEvaluationCommands=hi,e.invalidateDependenciesCommands=di,e.invalidateEvaluationCommands=ci,e.iterateAstNodes=Vf,e.links=CH,e.load=CT,e.parse=Pf,e.parseTokens=Nf,e.readonlyAllowedCommands=pi,e.registries=SH,e.setDefaultSheetViewSize=function(e){Me=e},e.setTranslationMethod=function(e,t=(()=>!0)){oi=e,si=t},e.stores=xH,e.tokenColors=By,e.tokenize=tl,vH.version="18.3.15",vH.date="2025-08-04T06:51:38.674Z",vH.hash="9499d98"}(this.o_spreadsheet=this.o_spreadsheet||{},owl);
|
package/dist/o_spreadsheet.xml
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
<!--
|
|
2
2
|
This file is generated by o-spreadsheet build tools. Do not edit it.
|
|
3
3
|
@see https://github.com/odoo/o-spreadsheet
|
|
4
|
-
@version 18.3.
|
|
5
|
-
@date 2025-
|
|
6
|
-
@hash
|
|
4
|
+
@version 18.3.15
|
|
5
|
+
@date 2025-08-04T06:52:24.863Z
|
|
6
|
+
@hash 9499d98
|
|
7
7
|
-->
|
|
8
8
|
<odoo>
|
|
9
9
|
<t t-name="o-spreadsheet-ValidationMessages">
|