@odoo/o-spreadsheet 18.3.26 → 18.3.27
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.
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
z-index: ${Fe.FigureTooltip};
|
|
7
7
|
}
|
|
8
8
|
}
|
|
9
|
-
`,Dh.add("chartShowValuesPlugin",{register:e=>e.register(qS),unregister:e=>e.unregister(qS)}),Dh.add("waterfallLinesPlugin",{register:e=>e.register(Sy),unregister:e=>e.unregister(Sy)}),Dh.add("funnelController",{register:e=>e.register(Oh()),unregister:e=>e.unregister(Oh())}),Dh.add("funnelElement",{register:e=>e.register(Fh()),unregister:e=>e.unregister(Fh())}),Dh.add("funnelTooltipPositioner",{register:e=>e.Tooltip.positioners.funnelTooltipPositioner=Ph,unregister:e=>e.Tooltip.positioners.funnelTooltipPositioner=void 0}),Dh.add("sunburstLabelsPlugin",{register:e=>e.register(by),unregister:e=>e.unregister(by)}),Dh.add("sunburstHoverPlugin",{register:e=>e.register(fy),unregister:e=>e.unregister(fy)});class wy 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((()=>{_h();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 Iy{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 xy(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 Ey(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 Ry(e){return e.keyValue&&!Zr.test(e.keyValue)?"InvalidScorecardKeyValue":"Success"}function Ty(e){return e.baseline&&!Zr.test(e.baseline)?"InvalidScorecardBaseline":"Success"}const Ay=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"),Dy=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 _y=class e extends Iy{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,Ry,Ty)}static getDefinitionFromContextCreation(e){return{background:e.background,type:"scorecard",keyValue:e.range?.[0]?.dataRange,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=CS(e,t.baseline,o);i!==Ti.InvalidReference&&(s=i)}if(t.keyValue){const s=CS(e,t.keyValue,o);s!==Ti.InvalidReference&&(i=s)}return{...t,baseline:s,keyValue:i}}duplicateInDuplicatedSheet(t){const o=TS(this.sheetId,t,this.baseline),s=TS(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=AS(this.baseline,t),s=AS(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 Oy(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(Ba(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,za(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(Ay);break;case"up":o.fill(Dy)}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(Ba(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,za(o,Ba(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 Fy(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:Ey(n,o,e.baselineMode),baselineColor:xy(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 My=10,Py=.05;function Ny({width:e,height:t},o){return new ky({width:e,height:t},o).computeDesign()}class ky{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-My;break;default:s=My}e.title={text:this.title,style:t.title,position:{x:s,y:My+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-Py*(this.runtime.progressBar?1:2)):this.height-(this.height-o-i)/2-My}};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(My,(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 NS(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:Aa(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:Aa(32,this.runtime.keyValueStyle?.bold,this.runtime.keyValueStyle?.italic),strikethrough:this.runtime.keyValueStyle?.strikethrough,underline:this.runtime.keyValueStyle?.underline},baselineValue:{font:Aa(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:Aa(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 Vy 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;Oy(Ny(e.getBoundingClientRect(),this.runtime),e)}}const Ly=new n;function Hy(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 Uy(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()}Ly.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()}}),Ly.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(tS.content).filter((([e,{hidden:t}])=>!t)).map((([e,{description:o}])=>({text:e,description:o,htmlContent:Hy(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 By extends yh{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){Uy(e,t,this.getters.getVisibleRect(t.zone))}}}class zy{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 $y="#000000",Gy="#3da4ab",Wy={OPERATOR:Gy,NUMBER:"#02c39a",STRING:"#00a82d",FUNCTION:$y,DEBUGGER:Gy,LEFT_PAREN:$y,RIGHT_PAREN:$y,ARG_SEPARATOR:$y,ORPHAN_RIGHT_PAREN:"#ff0000"};class qy extends yh{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(zy);highlightStore=this.get(By);constructor(e){super(e),this.highlightStore.register(this),this.onDispose((()=>{this.highlightStore.unRegister(this),this._cancelEdition()}))}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=Kf(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=Sl(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=Lf(e);let s;for(const e of Uf(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 Sl(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)?qf(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 Ly.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)||$y}if("SYMBOL"===e.type){const t=e.value.toUpperCase();if("TRUE"===t||"FALSE"===t)return Wy.NUMBER;if(t in tS.content)return Wy.FUNCTION}return["LEFT_PAREN","RIGHT_PAREN"].includes(e.type)&&""===e.parenthesesCode?Wy.ORPHAN_RIGHT_PAREN:Wy[e.type]||$y}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=Ea(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)||el.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 Zy=["PIVOT.VALUE","PIVOT.HEADER","PIVOT"];function jy(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:Wy.STRING}],fuzzySearchKey:s}}function Yy(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 Xy(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 Ky(e){const t=e.functionContext?.args[0];if(t&&["STRING","NUMBER"].includes(t.type))return t.value}function Jy(e){return SS(e,Zy)[0]}function Qy(e){return SS(e,Zy).length}const eC=new n;eC.add("SPREADSHEET",!1),Ly.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:Wy.NUMBER}],fuzzySearchKey:o+t.name,alwaysExpanded:!0}})).filter(lt)},selectProposal:Xy}),Ly.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=Ky(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:Wy.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:Wy.STRING}],fuzzySearchKey:o}}(e)})).filter(lt):[]},selectProposal:Yy}),Ly.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=Ky(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=eC.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?jy(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:Wy.STRING}],fuzzySearchKey:o.string+s}}))).filter(lt)},selectProposal:Yy}),Ly.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=Ky(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:Wy.NUMBER}]}))):"quarter_number"===a.granularity?[1,2,3,4].map((e=>({text:`${e}`,fuzzySearchKey:`${e}`,description:ni("Quarter %s",e),htmlContent:[{value:`${e}`,color:Wy.NUMBER}]}))):"day_of_month"===a.granularity?je(1,32).map((e=>({text:`${e}`,fuzzySearchKey:`${e}`,description:"",htmlContent:[{value:`${e}`,color:Wy.NUMBER}]}))):"iso_week_number"===a.granularity?je(0,54).map((e=>({text:`${e}`,fuzzySearchKey:`${e}`,description:"",htmlContent:[{value:`${e}`,color:Wy.NUMBER}]}))):"day_of_week"===a.granularity?je(1,8).map((e=>({text:`${e}`,fuzzySearchKey:`${e}`,description:"",htmlContent:[{value:`${e}`,color:Wy.NUMBER}]}))):"hour_number"===a.granularity?je(0,24).map((e=>({text:`${e}`,fuzzySearchKey:`${e}`,description:"",htmlContent:[{value:`${e}`,color:Wy.NUMBER}]}))):"minute_number"===a.granularity?je(0,60).map((e=>({text:`${e}`,fuzzySearchKey:`${e}`,description:"",htmlContent:[{value:`${e}`,color:Wy.NUMBER}]}))):"second_number"===a.granularity?je(0,60).map((e=>({text:`${e}`,fuzzySearchKey:`${e}`,description:"",htmlContent:[{value:`${e}`,color:Wy.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?Wy.STRING:Wy.NUMBER}],fuzzySearchKey:s+i}}))},selectProposal:Yy}),Ly.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 tC=new n;tC.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 oC=new n,sC=/(\d+)$/,iC=/^(.*\D+)/,nC=/^(.*\D+)(\d+)$/;function rC(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 aC(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 lC(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}}oC.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&&nC.test(e.content),generateRule:(e,t,o)=>{const s=parseInt(e.content.match(sC)[0]),i=e.content.match(iC)[0],n=e.content.length-i.length,r=rC(e,t,(e=>e.type===ai.text&&nC.test(e.value))).filter((e=>i===(e.value??"").toString().match(iC)[0])).map((e=>parseInt((e.value??"").toString().match(sC)[0])));let a=aC(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=lC(rC(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=rC(e,t,(e=>e.type===ai.number&&!dr(e.format||""))).map((e=>Number(e.value)));let i=aC(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 cC=new n,hC=30,dC=10,uC=20,gC=12,pC=80,mC="#F3F2F1",fC=6,vC=25;function bC(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?vC:0,s=e.height-uC-o-dC,i=e.width-2*hC;let n,r;i>2*s?(n=2*s,r=s):(n=i,r=i/2);const a=o+dC+(s-r)/2;return{x:hC+(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=pC;r.height<300&&(h*=r.height/300);const d=r.width/2,u=n?.label||"-";_a(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=>_a(o,u,{fontSize:e},"px"))));const g={x:r.x+a/2,y:r.y+r.height+gC},p={x:r.x+r.width-a/2,y:r.y+r.height+gC},m=NS(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:gC},l=[],c=[];for(const h of e.inflectionValues){const e=(h.value-n.value)/(i.value-n.value),d=_a(s,h.label,a,"px"),u=Math.PI-Math.PI*e,g=IC(u,t.height+fC,r.x,r.y,d+2,gC);let p=c.some((e=>wC(e,g)))?gC:0;c.push(g),l.push({rotation:u,label:h.label,fontSize:gC,color:o,offset:p})}return l}(t,r,m,o);let v=0,b=0,S=0;t.title.text&&({width:b,height:S}=Ma(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:SC(t)},inflectionValues:f,gaugeValue:{label:u,textPosition:c,fontSize:h,color:m},minLabel:{label:t.minValue.label,textPosition:g,fontSize:gC,color:m},maxLabel:{label:t.maxValue.label,textPosition:p,fontSize:gC,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=mC,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=NS(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-fC-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=Aa(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 SC(e){const t=e.gaugeValue?.value;if(void 0===t)return mC;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 yC(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 CC(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 wC(e,t){const o=yC(e),s=yC(t);for(const e of o)for(const t of s)if(CC(e,t))return!0;return!1}function IC(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 xC 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((()=>bC(this.canvas.el,this.runtime)),(()=>{const e=this.canvas.el.getBoundingClientRect();return[e.width,e.height,this.runtime,this.canvas.el,window.devicePixelRatio]}))}}function EC(e){return 8===(e=Wt(e).replace("#","")).length?e.slice(6)+e.slice(0,6):e}xC.props={figureUI:Object};const RC={responsive:!0,maintainAspectRatio:!1,elements:{line:{fill:!1},point:{hitRadius:15}},animation:!1,events:["mousemove","mouseout","click","touchstart","touchmove","mouseup"]};function TC(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=[DC];const o=new window.Chart(i,t);n=o.toBase64Image(),o.destroy()}else if("scorecard"===o){Oy(Ny(t,e),i),n=i.toDataURL()}else"gauge"===o&&(bC(i,e),n=i.toDataURL());return s.remove(),n}async function AC(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=[DC];const o=new window.Chart(i,t);n=await new Promise((e=>i.toBlob(e,"image/png"))),o.destroy()}else if("scorecard"===o){Oy(Ny(t,e),i),n=await new Promise((e=>i.toBlob(e,"image/png")))}else"gauge"===o&&(bC(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 DC={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()}},_C={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")},OC={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")},FC={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")}}},MC={Custom:ni("Custom")},PC=ni("Merged cells are preventing this operation. Unmerge those cells and try again."),NC=ni("The header row of a table can't be moved."),kC={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")}},VC={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.")}},LC={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.")}},HC={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")}},UC={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))")}},BC={second:1e3,minute:6e4,hour:36e5,day:864e5,month:2592e6,year:31536e6},zC={inSeconds:function(e){return Math.floor(e/BC.second)},inMinutes:function(e){return Math.floor(e/BC.minute)},inHours:function(e){return Math.floor(e/BC.hour)},inDays:function(e){return Math.floor(e/BC.day)},inMonths:function(e){return Math.floor(e/BC.month)},inYears:function(e){return Math.floor(e/BC.year)}},$C=/^((d|dd|m|mm|yyyy|yy|hh|h|ss|a)(-|:|\s|\/))*(d|dd|m|mm|yyyy|yy|hh|h|ss|a)$/i;function GC(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(BC.second>=BC[r]&&zC.inSeconds(n)<180)return"second";if(BC.minute>=BC[r]&&zC.inMinutes(n)<180)return"minute";if(BC.hour>=BC[r]&&zC.inHours(n)<96)return"hour";if(BC.day>=BC[r]&&zC.inDays(n)<90)return"day";if(BC.month>=BC[r]&&zC.inMonths(n)<36)return"month";return"year"}(e,s,o),n={};return i&&(n[i]=s),{parser:s,displayFormats:n,unit:i??!1,tooltipFormat:s}}function WC(e,t,o,s){let i=hw(s,t,o).formattedValues,n=uw(s,t);LS(o,t[0],e.dataSetsHaveTitle||!1)&&i.shift(),({labels:i,dataSetsValues:n}=aw(i,n)),e.aggregated&&({labels:i,dataSetsValues:n}=lw(i,n));const r=dw(s,t,"left"),a=dw(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=QC(s,o);c.push(i)}return{dataSetsValues:n,trendDataSetsValues:c,axisFormats:l,labels:i,locale:s.getLocale()}}function qC(e,t,o,s){const i=WC(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&&sw(e,t,o,s)}(e,t,o,s)&&function(){if(!window.Chart)return!1;const e="luxon"===new window.Chart._adapters._date({})._id;e||nw||(nw=!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&&iw(e,t,o,s)}(e,t,o,s))return"linear";return"category"}(e,t,o,s),n=hw(s,t,o);let r="linear"===i?n.values:n.formattedValues,a=uw(s,t);const l=LS(o,t[0],e.dataSetsHaveTitle||!1);l&&r.shift(),({labels:r,dataSetsValues:a}=aw(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}=lw(r,a)),e.cumulative&&(a=gw(a,"asc"));const c={y:dw(s,t,"left"),y1:dw(s,t,"right"),x:cw(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(ew(o,n,r,i,s.getLocale()))}return{dataSetsValues:a,axisFormats:c,labels:r,locale:s.getLocale(),trendDataSetsValues:h,axisType:i}}function jC(e,t,o,s){let i=hw(s,t,o).formattedValues,n=uw(s,t);LS(o,t[0],e.dataSetsHaveTitle||!1)&&i.shift(),({labels:i,dataSetsValues:n}=aw(i,n)),e.aggregated&&({labels:i,dataSetsValues:n}=lw(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:dw(s,t,"left")},labels:i,locale:s.getLocale()}}function YC(e,t,o,s){let i=hw(s,t,o).formattedValues,n=uw(s,t);LS(o,t[0],e.dataSetsHaveTitle||!1)&&i.shift(),({labels:i,dataSetsValues:n}=aw(i,n)),e.aggregated&&({labels:i,dataSetsValues:n}=lw(i,n));return{dataSetsValues:n,axisFormats:{r:dw(s,t,"left")||dw(s,t,"right")},labels:i,locale:s.getLocale()}}function XC(e,t,o,s){let i=hw(s,t,o).formattedValues;LS(o,t[0],e.dataSetsHaveTitle||!1)&&i.shift();let n=uw(s,t);({labels:i,dataSetsValues:n}=lw(i,n));return{dataSetsValues:n,axisFormats:{y:dw(s,t,"left")||dw(s,t,"right")},labels:i,locale:s.getLocale(),availableRegions:s.getGeoChartAvailableRegions(),geoFeatureNameToId:s.geoFeatureNameToId,getGeoJsonFeatures:s.getGeoJsonFeatures}}function KC(e,t,o,s){let i=hw(s,t,o).formattedValues,n=uw(s,t);LS(o,t[0],e.dataSetsHaveTitle||!1)&&i.shift(),({labels:i,dataSetsValues:n}=aw(i,n)),e.aggregated&&({labels:i,dataSetsValues:n}=lw(i,n)),e.cumulative&&(n=gw(n,"desc"));return{dataSetsValues:n,axisFormats:{x:dw(s,t,"left")||dw(s,t,"right")},labels:i,locale:s.getLocale()}}function JC(e,t,o,s){let i=hw(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=>rw(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=LS(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:cw(s,o,r)},labels:i,locale:s.getLocale()}}function QC(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=tw(e,o,s,je(.5,i.length+.55,.2));return n.length?n:void 0}function ew(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=tw(e,n,r,je(c,h+d/2,d));return u.length?u:void 0}function tw(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 sc([t],[i],[n],!0)[0].map(((e,t)=>({x:s[t],y:e})));const r=Jl(t,i,o,!0).flat();return n.map(((e,t)=>({x:s[t],y:ec(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?tc(sc([e],[o],[n],!0))[0].map(((e,t)=>({x:s[t],y:e}))):s.map((e=>({x:e,y:NaN})))}case"logarithmic":return sc([t],oc([i]),oc([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 ow(e,t,o,s){return sw(e,t,o,s)||iw(e,t,o,s)}function sw(e,t,o,s){if(!o||!iw(e,t,o,s))return!1;const i=cw(s,o,LS(o,t[0],e.dataSetsHaveTitle||!1));return Boolean(i&&$C.test(i))}function iw(e,t,o,s){if(!o)return!1;const i=s.getRangeValues(o);return LS(o,t[0],e.dataSetsHaveTitle||!1)&&i.shift(),!i.some((e=>isNaN(Number(e))&&e))&&!i.every((e=>!e))}let nw=!1;function rw(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 aw(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 lw(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 cw(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 hw(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,rw(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=rw(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,rw(e,t[0]).length).map((e=>e.toString())),values:s.formattedValues}}return s}function dw(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 uw(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=`${FC.Series} ${parseInt(s)+1}`}else t=`${FC.Series} ${parseInt(s)+1}`;let r=i.dataRange?rw(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 gw(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 pw(e){return{padding:{left:j,right:j,top:X,bottom:Y}}}function mw(e,t){return{display:"none"!==e.legendPosition,position:"none"!==e.legendPosition?e.legendPosition:void 0}}function fw(e,t){return{...xw,...mw(e),...Ew(PS(e.background),{pointStyle:"rect",lineWidth:3})}}function vw(e,t){const o=e.fillArea,s=o?"rect":"line",i=o?2:3;return{...xw,...mw(e),...Ew(PS(e.background),{pointStyle:s,lineWidth:i})}}function bw(e,t){const{dataSetsValues:o}=t,s=Math.max(0,...o.map((e=>e?.data?.length??0))),i=$S(new mo(s),o),n=PS(e.background);return{...mw(e),labels:{usePointStyle:!0,generateLabels:e=>e.data.labels?.map(((e,t)=>({text:GS(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 Sw(e,t){return{...xw,...mw(e),...Ew(PS(e.background),{pointStyle:"circle",strokeStyle:e.background||"#ffffff",lineWidth:8})}}function yw(e,t){return{...xw,...mw(e),...Ew(PS(e.background),{lineWidth:3})}}function Cw(e,t){const o=PS(e.background),s=e.negativeValuesColor||A,i=e.positiveValuesColor||T,n=e.subTotalValuesColor||D;return{...mw(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 ww(e,t){const o=e.fillArea??!1,s=o?"rect":"line",i=o?2:3;return{...xw,...mw(e),...Ew(PS(e.background),{pointStyle:s,lineWidth:i})}}function Iw(e,t){const o=PS(e.background);return{...mw(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:GS(t),fontColor:o,fillStyle:e,strokeStyle:e,pointStyle:"rect"})))}}}}const xw={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 Ew(e,t){return{labels:{color:e,usePointStyle:!0,generateLabels:o=>o.data.datasets.map(((s,i)=>WS(s.xAxisID)?{text:GS(s.label),fontColor:e,strokeStyle:s.borderColor,hidden:!o.isDatasetVisible(i),pointStyle:"line",datasetIndex:i,lineWidth:3}:{text:GS(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 Rw(e,t){let o={};const{trendDataSetsValues:s,locale:i,axisFormats:n}=t,r={stacked:e.stacked,locale:i};if(e.horizontal)o.x=kw(e,"bottom","values",{...r,format:n?.x}),o.y=kw(e,"left","labels",r);else{o.x=kw(e,"bottom","labels",r);const t={...r,format:n?.y};o.y=kw(e,"left","values",t);const s={...r,format:n?.y1};o.y1=kw(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[IS]={...o.x,labels:Array(e).fill(""),offset:!1,display:!1},o[xS]={...o.x,offset:!0,display:!1}}return o}function Tw(e,t){const{locale:o,axisType:s,trendDataSetsValues:i,labels:n,axisFormats:r}=t,a=r?.x,l=e.stacked;let c={x:kw(e,"bottom","labels",{locale:o}),y:kw(e,"left","values",{locale:o,stacked:l,format:r?.y}),y1:kw(e,"right","values",{locale:o,stacked:l,format:r?.y1})};if(c=St(c),"time"===s&&n&&a){const e={type:"time",time:GC(n,a,o)};Object.assign(c.x,e),c.x.ticks.maxTicksLimit=15,delete c?.x?.ticks?.callback}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[IS]={...c.x,display:!1},c[xS]={...c.x,display:!1},"category"===s||"time"===s)){const e=Math.max(...i.map((e=>e?.length||0)));c[IS].type="category",c[IS].labels=je(0,e).map((e=>e.toString())),c[IS].offset=!1,c[xS].type="category",c[xS].offset=!1}return c}function Aw(e,t){const o=Tw(e,t);return{...o,x:{...o.x,grid:{display:!0}}}}function Dw(e,t){const{locale:o,axisFormats:s}=t,i=s?.y||s?.y1;e.dataSets;const n={x:{...kw(e,"bottom","labels",{locale:o}),grid:{display:!1}},y:{position:e.verticalAxisPosition,ticks:{color:PS(e.background),callback:BS({locale:o,format:i})},grid:{lineWidth:e=>0===e.tick.value?2:1},title:Nw(e.axesDesign?.y)}},r=n?.y||n?.y1;return r&&(r.grid={lineWidth:e=>0===e.tick.value?2:1}),n}function _w(e,t){const{dataSetsValues:o}=t,s=Rw(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 Ow(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:BS({format:s?.r,locale:o}),backdropColor:e.background||"#FFFFFF"},pointLabels:{color:PS(e.background),callback:GS},suggestedMin:n<0?n-1:0}}}function Fw(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:Pw(r?.defaultProjection||"mercator"),axis:"x"},color:{axis:"x",display:"none"!==e.legendPosition,border:{color:O},grid:{color:O},ticks:{color:PS(e.background),callback:BS({locale:o,format:a})},legend:{position:n,align:n.includes("right")?"left":"right",margin:Lw(e)},interpolate:Vw(e),missing:e.missingValueColor||"#ffffff"}}}function Mw(e,t){const o=t.dataSetsValues[0];return{x:{display:!1},y:{grid:{offset:!1},ticks:{callback:function(e){return GS(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 Pw(e){return"conicConformal"===e?window.ChartGeo.geoConicConformal().rotate([100,0]):e}function Nw(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 kw(e,t,o,s){const{useLeftAxis:i,useRightAxis:n}=HS(e);if("left"===t&&!i||"right"===t&&!n)return;const r=PS(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:Nw(a),grid:{display:e},beginAtZero:!0,stacked:s?.stacked,ticks:{color:r,callback:BS(s)}}}return{ticks:{padding:5,color:r,callback:function(e){return GS(this.getLabelForValue(e))}},grid:{display:!1},stacked:s?.stacked,title:Nw(a)}}function Vw(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 Lw(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 Hw={showValues:!1,showLabels:!0,valuesDesign:{align:"center",fontSize:13}};function Uw(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 US(o,s)(t,n)}}}function Bw(e,t){const{axisFormats:o,locale:s}=t;return{callback:US(o,s),showLabels:e.showLabels??Hw.showLabels,showValues:e.showValues??Hw.showValues,style:{fontSize:e.valuesDesign?.fontSize??Hw.valuesDesign.fontSize,align:e.valuesDesign?.align??Hw.valuesDesign.align,bold:e.valuesDesign?.bold??Hw.valuesDesign.bold,italic:e.valuesDesign?.italic??Hw.valuesDesign.italic,textColor:e.valuesDesign?.color??Hw.valuesDesign.color}}}function zw(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)))?"":US(o,s)(e,t.xAxisID||"x")}}function $w(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}${US(o,s)(l,i.yAxisID)}`}}}function Gw(e){const t=e.title,o=NS(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 Ww='\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 qw;function Zw(e,o={}){return function(e,o={}){qw||(qw=new t.App(t.Component,{templates:Ww,translateFn:ni}));const s=qw.getTemplate(e),i=s(o,{}),n=document.createElement("div");return t.blockDom.mount(i,n),n}(e,o).innerHTML}function jw(e,t){return{enabled:!1,external:iI,callbacks:{title:function(e){return e.some((e=>!WS(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 US(t.axisFormats,t.locale)(i,n)}}}}function Yw(e,t){const{axisType:o,locale:s,axisFormats:i}=t,n=i?.x,r={enabled:!1,external:iI,callbacks:{}};return r.callbacks.label="linear"===o?e=>{const t=e.parsed.y;let o=WS(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 US(i,s)(t,o)},r.callbacks.beforeLabel=e=>e.dataset?.label||e.label,r.callbacks.title=function(e){return"linear"!==o&&e.some((e=>!WS(e.dataset.xAxisID)))?void 0:""},r}function Xw(e,t){const{locale:o,axisFormats:s}=t,i=s?.y||s?.y1;return{enabled:!1,external:iI,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 Kw(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:iI,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 Jw(e,t){const o=jw(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 Qw(e,t){const{locale:o,axisFormats:s}=t;return{enabled:!1,external:iI,callbacks:{beforeLabel:e=>e.dataset?.label||e.label,label:function(e){return sr(e.parsed.r,{format:s?.r,locale:o})}}}}function eI(e,t){const{locale:o,axisFormats:s}=t,i=s?.y||s?.y1;return{enabled:!1,external:iI,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 tI(e,t){return{enabled:!1,external:iI,position:"funnelTooltipPositioner",callbacks:{title:()=>"",beforeLabel:e=>e.label,label:function(e){const o=e.parsed.x,s=e.dataset.xAxisID;return US(t.axisFormats,t.locale)(o,s)}}}}function oI(e,t){const{locale:o,axisFormats:s}=t,i=s?.y||s?.y1;return{enabled:!1,external:iI,filter:function(e){const t=e.raw;return t?.label!==XS},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 sI(e,t){const{locale:o,axisFormats:s}=t,i=s?.y;return{enabled:!1,external:iI,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 iI({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:nI(e,t,i.clientWidth)+"px",top:Math.floor(t.caretY-i.clientHeight/2)+"px"})}function nI(e,t,o){const s=t.caretX;return s+o>e.chartArea.right?Math.max(0,s-o):s}var rI=Object.freeze({__proto__:null,GHOST_SUNBURST_VALUE:XS,INTERACTIVE_LEGEND_CONFIG:xw,canChartParseLabels:ow,getBarChartData:WC,getBarChartDatasets:KS,getBarChartLegend:fw,getBarChartScales:Rw,getBarChartTooltip:jw,getChartColorsGenerator:my,getChartLabelFormat:cw,getChartLayout:pw,getChartShowValues:Uw,getChartTitle:Gw,getComboChartDatasets:oy,getComboChartLegend:yw,getData:rw,getFunnelChartData:KC,getFunnelChartDatasets:ny,getFunnelChartScales:Mw,getFunnelChartTooltip:tI,getFunnelLabelColors:ry,getGeoChartData:XC,getGeoChartDatasets:iy,getGeoChartScales:Fw,getGeoChartTooltip:eI,getHierarchalChartData:JC,getLineChartData:ZC,getLineChartDatasets:QS,getLineChartLegend:vw,getLineChartScales:Tw,getLineChartTooltip:Yw,getPieChartData:jC,getPieChartDatasets:ty,getPieChartLegend:bw,getPieChartTooltip:Xw,getPyramidChartData:qC,getPyramidChartScales:_w,getPyramidChartShowValues:zw,getPyramidChartTooltip:Jw,getRadarChartData:YC,getRadarChartDatasets:sy,getRadarChartLegend:ww,getRadarChartScales:Ow,getRadarChartTooltip:Qw,getScatterChartDatasets:ey,getScatterChartLegend:Sw,getScatterChartScales:Aw,getSunburstChartDatasets:ay,getSunburstChartLegend:Iw,getSunburstChartTooltip:oI,getSunburstShowValues:Bw,getTreeMapChartDatasets:dy,getTreeMapChartTooltip:sI,getTrendDatasetForBarChart:QC,getTrendDatasetForLineChart:ew,getWaterfallChartLegend:Cw,getWaterfallChartScales:Dw,getWaterfallChartShowValues:$w,getWaterfallChartTooltip:Kw,getWaterfallDatasetAndLabels:JS,makeDatasetsCumulative:gw});class aI extends Iy{dataSets;labelRange;background;legendPosition;stacked;aggregated;type="bar";dataSetsHaveTitle;dataSetDesign;axesDesign;horizontal;showValues;constructor(e,t,o){super(e,t,o),this.dataSets=DS(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 MS(e,t,o)}static validateChartDefinition(e,t){return e.checkValidations(t,kS,VS)}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=RS(this.sheetId,e,this.dataSets),o=TS(this.sheetId,e,this.labelRange),s=this.getDefinitionWithSpecificDataSets(t,o,e);return new aI(s,e,this.getters)}copyInSheetId(e){const t=this.getDefinitionWithSpecificDataSets(this.dataSets,this.labelRange,e);return new aI(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=>OS(this.getters,e))).filter((e=>""!==e.range&&e.range!==Ti.InvalidReference)),t=FS(this.getters,this.labelRange,LS(this.labelRange,this.dataSets[0],this.dataSetsHaveTitle)),o=this.getDefinition();return{...o,backgroundColor:EC(this.background||m),fontColor:EC(PS(this.background)),dataSets:e,labelRange:t,verticalAxis:HS(o)}}updateRanges(e){const{dataSets:t,labelRange:o,isStale:s}=ES(this.getters,e,this.dataSets,this.labelRange);if(!s)return this;const i=this.getDefinitionWithSpecificDataSets(t,o);return new aI(i,this.sheetId,this.getters)}}function lI(e,t){const o=e.getDefinition(),s=WC(o,e.dataSets,e.labelRange,t);return{chartJsConfig:{type:"bar",data:{labels:s.labels,datasets:KS(o,s)},options:{...RC,indexAxis:e.horizontal?"y":"x",layout:pw(),scales:Rw(o,s),plugins:{title:Gw(o),legend:fw(o),tooltip:jw(o,s),chartShowValuesPlugin:Uw(o,s)}}},background:e.background||m}}class cI extends Iy{dataSets;labelRange;background;legendPosition;aggregated;dataSetsHaveTitle;dataSetDesign;axesDesign;type="combo";showValues;constructor(e,t,o){super(e,t,o),this.dataSets=DS(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 MS(e,t,o)}static validateChartDefinition(e,t){return e.checkValidations(t,kS,VS)}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(){const e=this.dataSets.map((e=>OS(this.getters,e))).filter((e=>""!==e.range&&e.range!==Ti.InvalidReference)),t=FS(this.getters,this.labelRange,LS(this.labelRange,this.dataSets[0],this.dataSetsHaveTitle)),o=this.getDefinition();return{...o,backgroundColor:EC(this.background||m),fontColor:EC(PS(this.background)),dataSets:e,labelRange:t,verticalAxis:HS(o)}}updateRanges(e){const{dataSets:t,labelRange:o,isStale:s}=ES(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)}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=RS(this.sheetId,e,this.dataSets),o=TS(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)}}class hI extends Iy{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=DS(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 MS(e,t,o)}static validateChartDefinition(e,t){return e.checkValidations(t,kS,VS)}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=RS(this.sheetId,e,this.dataSets),o=TS(this.sheetId,e,this.labelRange),s=this.getDefinitionWithSpecificDataSets(t,o,e);return new hI(s,e,this.getters)}copyInSheetId(e){const t=this.getDefinitionWithSpecificDataSets(this.dataSets,this.labelRange,e);return new hI(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}=ES(this.getters,e,this.dataSets,this.labelRange);if(!s)return this;const i=this.getDefinitionWithSpecificDataSets(t,o);return new hI(i,this.sheetId,this.getters)}}function dI(e){return e.dataRange&&!Zr.test(e.dataRange)?"InvalidGaugeDataRange":"Success"}function uI(e,t){return t((t=>t.sectionRule?e(t.sectionRule.rangeMin,"rangeMin"):"Success"),(t=>t.sectionRule?e(t.sectionRule.rangeMax,"rangeMax"):"Success"))}function gI(e,t){if(""===e)switch(t){case"rangeMin":return"EmptyGaugeRangeMin";case"rangeMax":return"EmptyGaugeRangeMax"}return"Success"}function pI(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 mI extends Iy{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,dI,e.chainValidations(uI(gI,e.batchValidations),uI(pI,e.batchValidations)),e.chainValidations((o=pI,(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=CS(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?.[0]?.dataRange,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=TS(this.sheetId,e,this.dataRange),o=SI(this.sectionRule,(t=>this.getters.copyFormulaStringForSheet(this.sheetId,e,t,"moveReference"))),s=this.getDefinitionWithSpecificRanges(t,o,e);return new mI(s,e,this.getters)}copyInSheetId(e){const t=SI(this.sectionRule,(t=>this.getters.copyFormulaStringForSheet(this.sheetId,e,t,"keepSameReference"))),o=this.getDefinitionWithSpecificRanges(this.dataRange,t,e);return new mI(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,t,o){const s=AS(this.dataRange,e),i=SI(this.sectionRule,(s=>yS(this.sheetId,s,{applyChange:e,sheetId:t,sheetName:o}))),n=this.getDefinitionWithSpecificRanges(s,i);return new mI(n,this.sheetId,this.getters)}}function fI(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=bI(e.sheetId,e.sectionRule.rangeMin,t),c=bI(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=vI(e.sheetId,e.sectionRule.lowerInflectionPoint,l,c,t),g=vI(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 vI(e,t,o,s,i){const n=bI(e,t.value,i);if(void 0===n)return;return Ze("number"===t.type?n:o+(s-o)*n/100,o,s)}function bI(e,t,o){const s=o.evaluateFormula(e,t);return Ii(s)?void 0:$i(s,o.getLocale())}function SI(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 yI extends Iy{dataSets;labelRange;background;legendPosition;type="geo";dataSetsHaveTitle;dataSetDesign;colorScale;missingValueColor;region;constructor(e,t,o){super(e,t,o),this.dataSets=DS(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 MS(e,t,o)}static validateChartDefinition(e,t){return e.checkValidations(t,kS,VS)}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=RS(this.sheetId,e,this.dataSets),o=TS(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:"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}=ES(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 Iy{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=DS(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,kS,VS)}static transformDefinition(e,t,o){return MS(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}=ES(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)}getDefinitionForExcel(){const e=this.dataSets.map((e=>OS(this.getters,e))).filter((e=>""!==e.range&&e.range!==Ti.InvalidReference)),t=FS(this.getters,this.labelRange,LS(this.labelRange,this.dataSets[0],this.dataSetsHaveTitle)),o=this.getDefinition();return{...o,backgroundColor:EC(this.background||m),fontColor:EC(PS(this.background)),dataSets:e,labelRange:t,verticalAxis:HS(o)}}duplicateInDuplicatedSheet(e){const t=RS(this.sheetId,e,this.dataSets),o=TS(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)}}function wI(e,t){const o=e.getDefinition(),s=ZC(o,e.dataSets,e.labelRange,t);return{chartJsConfig:{type:"line",data:{labels:s.labels,datasets:QS(o,s)},options:{...RC,layout:pw(),scales:Tw(o,s),plugins:{title:Gw(o),legend:vw(o),tooltip:Yw(0,s),chartShowValuesPlugin:Uw(o,s)}}},background:e.background||m}}class II extends Iy{dataSets;labelRange;background;legendPosition;type="pie";aggregated;dataSetsHaveTitle;isDoughnut;showValues;constructor(e,t,o){super(e,t,o),this.dataSets=DS(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 MS(e,t,o)}static validateChartDefinition(e,t){return e.checkValidations(t,kS,VS)}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=RS(this.sheetId,e,this.dataSets),o=TS(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(){const e=this.dataSets.map((e=>OS(this.getters,e))).filter((e=>""!==e.range&&e.range!==Ti.InvalidReference)),t=FS(this.getters,this.labelRange,LS(this.labelRange,this.dataSets[0],this.dataSetsHaveTitle));return{...this.getDefinition(),backgroundColor:EC(this.background||m),fontColor:EC(PS(this.background)),dataSets:e,labelRange:t}}updateRanges(e){const{dataSets:t,labelRange:o,isStale:s}=ES(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)}}function xI(e,t){const o=e.getDefinition(),s=jC(o,e.dataSets,e.labelRange,t);return{chartJsConfig:{type:e.isDoughnut?"doughnut":"pie",data:{labels:s.labels,datasets:ty(o,s)},options:{...RC,layout:pw(),plugins:{title:Gw(o),legend:bw(o,s),tooltip:Xw(0,s),chartShowValuesPlugin:Uw(o,s)}}},background:e.background||m}}class EI extends Iy{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=DS(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 MS(e,t,o)}static validateChartDefinition(e,t){return e.checkValidations(t,kS,VS)}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=RS(this.sheetId,e,this.dataSets),o=TS(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:"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}=ES(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)}}class RI extends Iy{dataSets;labelRange;background;legendPosition;stacked;aggregated;type="radar";dataSetsHaveTitle;dataSetDesign;fillArea;showValues;constructor(e,t,o){super(e,t,o),this.dataSets=DS(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 MS(e,t,o)}static validateChartDefinition(e,t){return e.checkValidations(t,kS,VS)}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=RS(this.sheetId,e,this.dataSets),o=TS(this.sheetId,e,this.labelRange),s=this.getDefinitionWithSpecificDataSets(t,o,e);return new RI(s,e,this.getters)}copyInSheetId(e){const t=this.getDefinitionWithSpecificDataSets(this.dataSets,this.labelRange,e);return new RI(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(){const e=this.dataSets.map((e=>OS(this.getters,e))).filter((e=>""!==e.range&&e.range!==Ti.InvalidReference)),t=FS(this.getters,this.labelRange,LS(this.labelRange,this.dataSets[0],this.dataSetsHaveTitle));return{...this.getDefinition(),backgroundColor:EC(this.background||m),fontColor:EC(PS(this.background)),dataSets:e,labelRange:t}}updateRanges(e){const{dataSets:t,labelRange:o,isStale:s}=ES(this.getters,e,this.dataSets,this.labelRange);if(!s)return this;const i=this.getDefinitionWithSpecificDataSets(t,o);return new RI(i,this.sheetId,this.getters)}}class TI extends Iy{dataSets;labelRange;background;legendPosition;labelsAsText;aggregated;type="scatter";dataSetsHaveTitle;dataSetDesign;axesDesign;showValues;constructor(e,t,o){super(e,t,o),this.dataSets=DS(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,kS,VS)}static transformDefinition(e,t,o){return MS(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}=ES(this.getters,e,this.dataSets,this.labelRange);if(!s)return this;const i=this.getDefinitionWithSpecificDataSets(t,o);return new TI(i,this.sheetId,this.getters)}getDefinitionForExcel(){const e=this.dataSets.map((e=>OS(this.getters,e))).filter((e=>""!==e.range)),t=FS(this.getters,this.labelRange,LS(this.labelRange,this.dataSets[0],this.dataSetsHaveTitle)),o=this.getDefinition();return{...o,backgroundColor:EC(this.background||m),fontColor:EC(PS(this.background)),dataSets:e,labelRange:t,verticalAxis:HS(o)}}duplicateInDuplicatedSheet(e){const t=RS(this.sheetId,e,this.dataSets),o=TS(this.sheetId,e,this.labelRange),s=this.getDefinitionWithSpecificDataSets(t,o,e);return new TI(s,e,this.getters)}copyInSheetId(e){const t=this.getDefinitionWithSpecificDataSets(this.dataSets,this.labelRange,e);return new TI(t,e,this.getters)}}class AI extends Iy{dataSets;labelRange;background;legendPosition;type="sunburst";dataSetsHaveTitle;showValues;showLabels;valuesDesign;groupColors;constructor(e,t,o){super(e,t,o),this.dataSets=DS(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 MS(e,t,o)}static validateChartDefinition(e,t){return e.checkValidations(t,kS,VS)}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=RS(this.sheetId,e,this.dataSets),o=TS(this.sheetId,e,this.labelRange),s=this.getDefinitionWithSpecificDataSets(t,o,e);return new AI(s,e,this.getters)}copyInSheetId(e){const t=this.getDefinitionWithSpecificDataSets(this.dataSets,this.labelRange,e);return new AI(t,e,this.getters)}getDefinitionForExcel(){}updateRanges(e){const{dataSets:t,labelRange:o,isStale:s}=ES(this.getters,e,this.dataSets,this.labelRange);if(!s)return this;const i=this.getDefinitionWithSpecificDataSets(t,o);return new AI(i,this.sheetId,this.getters)}}class DI extends Iy{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=DS(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 MS(e,t,o)}static validateChartDefinition(e,t){return e.checkValidations(t,kS,VS)}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=RS(this.sheetId,e,this.dataSets),o=TS(this.sheetId,e,this.labelRange),s=this.getDefinitionWithSpecificDataSets(t,o,e);return new DI(s,e,this.getters)}copyInSheetId(e){const t=this.getDefinitionWithSpecificDataSets(this.dataSets,this.labelRange,e);return new DI(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}=ES(this.getters,e,this.dataSets,this.labelRange);if(!s)return this;const i=this.getDefinitionWithSpecificDataSets(t,o);return new DI(i,this.sheetId,this.getters)}}class _I extends Iy{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=DS(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 MS(e,t,o)}static validateChartDefinition(e,t){return e.checkValidations(t,kS,VS)}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=RS(this.sheetId,e,this.dataSets),o=TS(this.sheetId,e,this.labelRange),s=this.getDefinitionWithSpecificDataSets(t,o,e);return new _I(s,e,this.getters)}copyInSheetId(e){const t=this.getDefinitionWithSpecificDataSets(this.dataSets,this.labelRange,e);return new _I(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}=ES(this.getters,e,this.dataSets,this.labelRange);if(!s)return this;const i=this.getDefinitionWithSpecificDataSets(t,o);return new _I(i,this.sheetId,this.getters)}}function OI(e,t){const o=e.getDefinition(),s=WC(o,e.dataSets,e.labelRange,t),{labels:i,datasets:n}=JS(o,s);return{chartJsConfig:{type:"bar",data:{labels:i,datasets:n},options:{...RC,layout:pw(),scales:Dw(o,s),plugins:{title:Gw(o),legend:Cw(o),tooltip:Kw(0,s),chartShowValuesPlugin:$w(o,s),waterfallLinesPlugin:{showConnectorLines:o.showConnectorLines}}}},background:e.background||m}}const FI=new n;FI.add("bar",{match:e=>"bar"===e,createChart:(e,t,o)=>new aI(e,t,o),getChartRuntime:lI,validateChartDefinition:aI.validateChartDefinition,transformDefinition:aI.transformDefinition,getChartDefinitionFromContextCreation:aI.getDefinitionFromContextCreation,sequence:10}),FI.add("combo",{match:e=>"combo"===e,createChart:(e,t,o)=>new cI(e,t,o),getChartRuntime:function(e,t){const o=e.getDefinition(),s=WC(o,e.dataSets,e.labelRange,t);return{chartJsConfig:{type:"bar",data:{labels:s.labels,datasets:oy(o,s)},options:{...RC,layout:pw(),scales:Rw(o,s),plugins:{title:Gw(o),legend:yw(o),tooltip:jw(o,s),chartShowValuesPlugin:Uw(o,s)}}},background:e.background||m}},validateChartDefinition:cI.validateChartDefinition,transformDefinition:cI.transformDefinition,getChartDefinitionFromContextCreation:cI.getDefinitionFromContextCreation,sequence:15}),FI.add("line",{match:e=>"line"===e,createChart:(e,t,o)=>new CI(e,t,o),getChartRuntime:wI,validateChartDefinition:CI.validateChartDefinition,transformDefinition:CI.transformDefinition,getChartDefinitionFromContextCreation:CI.getDefinitionFromContextCreation,sequence:20}),FI.add("pie",{match:e=>"pie"===e,createChart:(e,t,o)=>new II(e,t,o),getChartRuntime:xI,validateChartDefinition:II.validateChartDefinition,transformDefinition:II.transformDefinition,getChartDefinitionFromContextCreation:II.getDefinitionFromContextCreation,sequence:30}),FI.add("scorecard",{match:e=>"scorecard"===e,createChart:(e,t,o)=>new _y(e,t,o),getChartRuntime:Fy,validateChartDefinition:_y.validateChartDefinition,transformDefinition:_y.transformDefinition,getChartDefinitionFromContextCreation:_y.getDefinitionFromContextCreation,sequence:40}),FI.add("gauge",{match:e=>"gauge"===e,createChart:(e,t,o)=>new mI(e,t,o),getChartRuntime:fI,validateChartDefinition:mI.validateChartDefinition,transformDefinition:mI.transformDefinition,getChartDefinitionFromContextCreation:mI.getDefinitionFromContextCreation,sequence:50}),FI.add("scatter",{match:e=>"scatter"===e,createChart:(e,t,o)=>new TI(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:ey(o,s)},options:{...RC,layout:pw(),scales:Aw(o,s),plugins:{title:Gw(o),legend:Sw(o),tooltip:Yw(0,s),chartShowValuesPlugin:Uw(o,s)}}},background:e.background||m}},validateChartDefinition:TI.validateChartDefinition,transformDefinition:TI.transformDefinition,getChartDefinitionFromContextCreation:TI.getDefinitionFromContextCreation,sequence:60}),FI.add("waterfall",{match:e=>"waterfall"===e,createChart:(e,t,o)=>new _I(e,t,o),getChartRuntime:OI,validateChartDefinition:_I.validateChartDefinition,transformDefinition:_I.transformDefinition,getChartDefinitionFromContextCreation:_I.getDefinitionFromContextCreation,sequence:70}),FI.add("pyramid",{match:e=>"pyramid"===e,createChart:(e,t,o)=>new EI(e,t,o),getChartRuntime:function(e,t){const o=e.getDefinition(),s=qC(o,e.dataSets,e.labelRange,t);return{chartJsConfig:{type:"bar",data:{labels:s.labels,datasets:KS(o,s)},options:{...RC,indexAxis:"y",layout:pw(),scales:_w(o,s),plugins:{title:Gw(o),legend:fw(o),tooltip:Jw(o,s),chartShowValuesPlugin:zw(o,s)}}},background:e.background||m}},validateChartDefinition:EI.validateChartDefinition,transformDefinition:EI.transformDefinition,getChartDefinitionFromContextCreation:EI.getDefinitionFromContextCreation,sequence:80}),FI.add("radar",{match:e=>"radar"===e,createChart:(e,t,o)=>new RI(e,t,o),getChartRuntime:function(e,t){const o=e.getDefinition(),s=YC(o,e.dataSets,e.labelRange,t);return{chartJsConfig:{type:"radar",data:{labels:s.labels,datasets:sy(o,s)},options:{...RC,layout:pw(),scales:Ow(o,s),plugins:{title:Gw(o),legend:ww(o),tooltip:Qw(0,s),chartShowValuesPlugin:Uw(o,s)}}},background:e.background||m}},validateChartDefinition:RI.validateChartDefinition,transformDefinition:RI.transformDefinition,getChartDefinitionFromContextCreation:RI.getDefinitionFromContextCreation,sequence:80}),FI.add("geo",{match:e=>"geo"===e,createChart:(e,t,o)=>new yI(e,t,o),getChartRuntime:function(e,t){const o=e.getDefinition(),s=XC(o,e.dataSets,e.labelRange,t);return{chartJsConfig:{type:"choropleth",data:{datasets:iy(o,s)},options:{...RC,layout:pw(),scales:Fw(o,s),plugins:{title:Gw(o),tooltip:eI(0,s),legend:{display:!1}}}},background:e.background||m}},validateChartDefinition:yI.validateChartDefinition,transformDefinition:yI.transformDefinition,getChartDefinitionFromContextCreation:yI.getDefinitionFromContextCreation,sequence:90}),FI.add("funnel",{match:e=>"funnel"===e,createChart:(e,t,o)=>new hI(e,t,o),getChartRuntime:function(e,t){const o=e.getDefinition(),s=KC(o,e.dataSets,e.labelRange,t);return{chartJsConfig:{type:"funnel",data:{labels:s.labels,datasets:ny(o,s)},options:{...RC,indexAxis:"y",layout:pw(),scales:Mw(0,s),plugins:{title:Gw(o),legend:{display:!1},tooltip:tI(0,s),chartShowValuesPlugin:Uw(o,s)}}},background:e.background||m}},validateChartDefinition:hI.validateChartDefinition,transformDefinition:hI.transformDefinition,getChartDefinitionFromContextCreation:hI.getDefinitionFromContextCreation,sequence:100}),FI.add("sunburst",{match:e=>"sunburst"===e,createChart:(e,t,o)=>new AI(e,t,o),getChartRuntime:function(e,t){const o=e.getDefinition(),s=JC(o,e.dataSets,e.labelRange,t);return{chartJsConfig:{type:"doughnut",data:{datasets:ay(o,s)},options:{cutout:"25%",...RC,layout:pw(),plugins:{title:Gw(o),legend:Iw(o),tooltip:oI(0,s),sunburstLabelsPlugin:Bw(o,s),sunburstHoverPlugin:{enabled:!0}}}},background:e.background||m}},validateChartDefinition:AI.validateChartDefinition,transformDefinition:AI.transformDefinition,getChartDefinitionFromContextCreation:AI.getDefinitionFromContextCreation,sequence:30}),FI.add("treemap",{match:e=>"treemap"===e,createChart:(e,t,o)=>new DI(e,t,o),getChartRuntime:function(e,t){const o=e.getDefinition(),s=JC(o,e.dataSets,e.labelRange,t);return{chartJsConfig:{type:"treemap",data:{labels:s.labels,datasets:dy(o,s)},options:{...RC,layout:pw(),plugins:{title:Gw(o),legend:{display:!1},tooltip:sI(0,s)}}},background:e.background||m}},validateChartDefinition:DI.validateChartDefinition,transformDefinition:DI.transformDefinition,getChartDefinitionFromContextCreation:DI.getDefinitionFromContextCreation,sequence:100});const MI=new n;MI.add("line",wy),MI.add("bar",wy),MI.add("combo",wy),MI.add("pie",wy),MI.add("gauge",xC),MI.add("scatter",wy),MI.add("scorecard",Vy),MI.add("waterfall",wy),MI.add("pyramid",wy),MI.add("radar",wy),MI.add("geo",wy),MI.add("funnel",wy),MI.add("sunburst",wy),MI.add("treemap",wy);const PI={line:ni("Line"),column:ni("Column"),bar:ni("Bar"),area:ni("Area"),pie:ni("Pie"),hierarchical:ni("Hierarchical"),misc:ni("Miscellaneous")},NI=new n;NI.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 kI=new n;Eh`
|
|
9
|
+
`,Dh.add("chartShowValuesPlugin",{register:e=>e.register(qS),unregister:e=>e.unregister(qS)}),Dh.add("waterfallLinesPlugin",{register:e=>e.register(Sy),unregister:e=>e.unregister(Sy)}),Dh.add("funnelController",{register:e=>e.register(Oh()),unregister:e=>e.unregister(Oh())}),Dh.add("funnelElement",{register:e=>e.register(Fh()),unregister:e=>e.unregister(Fh())}),Dh.add("funnelTooltipPositioner",{register:e=>e.Tooltip.positioners.funnelTooltipPositioner=Ph,unregister:e=>e.Tooltip.positioners.funnelTooltipPositioner=void 0}),Dh.add("sunburstLabelsPlugin",{register:e=>e.register(by),unregister:e=>e.unregister(by)}),Dh.add("sunburstHoverPlugin",{register:e=>e.register(fy),unregister:e=>e.unregister(fy)});class wy 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((()=>{_h();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 Iy{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 xy(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 Ey(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 Ry(e){return e.keyValue&&!Zr.test(e.keyValue)?"InvalidScorecardKeyValue":"Success"}function Ty(e){return e.baseline&&!Zr.test(e.baseline)?"InvalidScorecardBaseline":"Success"}const Ay=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"),Dy=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 _y=class e extends Iy{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,Ry,Ty)}static getDefinitionFromContextCreation(e){return{background:e.background,type:"scorecard",keyValue:e.range?.[0]?.dataRange,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=CS(e,t.baseline,o);i!==Ti.InvalidReference&&(s=i)}if(t.keyValue){const s=CS(e,t.keyValue,o);s!==Ti.InvalidReference&&(i=s)}return{...t,baseline:s,keyValue:i}}duplicateInDuplicatedSheet(t){const o=TS(this.sheetId,t,this.baseline),s=TS(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=AS(this.baseline,t),s=AS(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 Oy(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(Ba(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,za(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(Ay);break;case"up":o.fill(Dy)}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(Ba(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,za(o,Ba(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 Fy(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:Ey(n,o,e.baselineMode),baselineColor:xy(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 My=10,Py=.05;function Ny({width:e,height:t},o){return new ky({width:e,height:t},o).computeDesign()}class ky{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-My;break;default:s=My}e.title={text:this.title,style:t.title,position:{x:s,y:My+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-Py*(this.runtime.progressBar?1:2)):this.height-(this.height-o-i)/2-My}};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(My,(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 NS(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:Aa(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:Aa(32,this.runtime.keyValueStyle?.bold,this.runtime.keyValueStyle?.italic),strikethrough:this.runtime.keyValueStyle?.strikethrough,underline:this.runtime.keyValueStyle?.underline},baselineValue:{font:Aa(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:Aa(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 Vy 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;Oy(Ny(e.getBoundingClientRect(),this.runtime),e)}}const Ly=new n;function Hy(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 Uy(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()}Ly.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()}}),Ly.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(tS.content).filter((([e,{hidden:t}])=>!t)).map((([e,{description:o}])=>({text:e,description:o,htmlContent:Hy(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 By extends yh{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){Uy(e,t,this.getters.getVisibleRect(t.zone))}}}class zy{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 $y="#000000",Gy="#3da4ab",Wy={OPERATOR:Gy,NUMBER:"#02c39a",STRING:"#00a82d",FUNCTION:$y,DEBUGGER:Gy,LEFT_PAREN:$y,RIGHT_PAREN:$y,ARG_SEPARATOR:$y,ORPHAN_RIGHT_PAREN:"#ff0000"};class qy extends yh{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(zy);highlightStore=this.get(By);constructor(e){super(e),this.highlightStore.register(this),this.onDispose((()=>{this.highlightStore.unRegister(this),this._cancelEdition()}))}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.editionMode="editing",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=Kf(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=Sl(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=Lf(e);let s;for(const e of Uf(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 Sl(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)?qf(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 Ly.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)||$y}if("SYMBOL"===e.type){const t=e.value.toUpperCase();if("TRUE"===t||"FALSE"===t)return Wy.NUMBER;if(t in tS.content)return Wy.FUNCTION}return["LEFT_PAREN","RIGHT_PAREN"].includes(e.type)&&""===e.parenthesesCode?Wy.ORPHAN_RIGHT_PAREN:Wy[e.type]||$y}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=Ea(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)||el.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 Zy=["PIVOT.VALUE","PIVOT.HEADER","PIVOT"];function jy(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:Wy.STRING}],fuzzySearchKey:s}}function Yy(e,t){let o=e.end;const s=e.end;"ARG_SEPARATOR"!==e.type&&(o=e.start),this.composer.changeComposerCursorSelection(o,s),this.composer.replaceComposerCursorSelection(t)}function Xy(e,t){let o=e.end;const s=e.end;"LEFT_PAREN"!==e.type&&(o=e.start),this.composer.changeComposerCursorSelection(o,s),this.composer.replaceComposerCursorSelection(t)}function Ky(e){const t=e.functionContext?.args[0];if(t&&["STRING","NUMBER"].includes(t.type))return t.value}function Jy(e){return SS(e,Zy)[0]}function Qy(e){return SS(e,Zy).length}const eC=new n;eC.add("SPREADSHEET",!1),Ly.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:Wy.NUMBER}],fuzzySearchKey:o+t.name,alwaysExpanded:!0}})).filter(lt)},selectProposal:Xy}),Ly.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=Ky(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:Wy.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:Wy.STRING}],fuzzySearchKey:o}}(e)})).filter(lt):[]},selectProposal:Yy}),Ly.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=Ky(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=eC.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?jy(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:Wy.STRING}],fuzzySearchKey:o.string+s}}))).filter(lt)},selectProposal:Yy}),Ly.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=Ky(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:Wy.NUMBER}]}))):"quarter_number"===a.granularity?[1,2,3,4].map((e=>({text:`${e}`,fuzzySearchKey:`${e}`,description:ni("Quarter %s",e),htmlContent:[{value:`${e}`,color:Wy.NUMBER}]}))):"day_of_month"===a.granularity?je(1,32).map((e=>({text:`${e}`,fuzzySearchKey:`${e}`,description:"",htmlContent:[{value:`${e}`,color:Wy.NUMBER}]}))):"iso_week_number"===a.granularity?je(0,54).map((e=>({text:`${e}`,fuzzySearchKey:`${e}`,description:"",htmlContent:[{value:`${e}`,color:Wy.NUMBER}]}))):"day_of_week"===a.granularity?je(1,8).map((e=>({text:`${e}`,fuzzySearchKey:`${e}`,description:"",htmlContent:[{value:`${e}`,color:Wy.NUMBER}]}))):"hour_number"===a.granularity?je(0,24).map((e=>({text:`${e}`,fuzzySearchKey:`${e}`,description:"",htmlContent:[{value:`${e}`,color:Wy.NUMBER}]}))):"minute_number"===a.granularity?je(0,60).map((e=>({text:`${e}`,fuzzySearchKey:`${e}`,description:"",htmlContent:[{value:`${e}`,color:Wy.NUMBER}]}))):"second_number"===a.granularity?je(0,60).map((e=>({text:`${e}`,fuzzySearchKey:`${e}`,description:"",htmlContent:[{value:`${e}`,color:Wy.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?Wy.STRING:Wy.NUMBER}],fuzzySearchKey:s+i}}))},selectProposal:Yy}),Ly.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 tC=new n;tC.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 oC=new n,sC=/(\d+)$/,iC=/^(.*\D+)/,nC=/^(.*\D+)(\d+)$/;function rC(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 aC(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 lC(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}}oC.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&&nC.test(e.content),generateRule:(e,t,o)=>{const s=parseInt(e.content.match(sC)[0]),i=e.content.match(iC)[0],n=e.content.length-i.length,r=rC(e,t,(e=>e.type===ai.text&&nC.test(e.value))).filter((e=>i===(e.value??"").toString().match(iC)[0])).map((e=>parseInt((e.value??"").toString().match(sC)[0])));let a=aC(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=lC(rC(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=rC(e,t,(e=>e.type===ai.number&&!dr(e.format||""))).map((e=>Number(e.value)));let i=aC(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 cC=new n,hC=30,dC=10,uC=20,gC=12,pC=80,mC="#F3F2F1",fC=6,vC=25;function bC(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?vC:0,s=e.height-uC-o-dC,i=e.width-2*hC;let n,r;i>2*s?(n=2*s,r=s):(n=i,r=i/2);const a=o+dC+(s-r)/2;return{x:hC+(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=pC;r.height<300&&(h*=r.height/300);const d=r.width/2,u=n?.label||"-";_a(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=>_a(o,u,{fontSize:e},"px"))));const g={x:r.x+a/2,y:r.y+r.height+gC},p={x:r.x+r.width-a/2,y:r.y+r.height+gC},m=NS(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:gC},l=[],c=[];for(const h of e.inflectionValues){const e=(h.value-n.value)/(i.value-n.value),d=_a(s,h.label,a,"px"),u=Math.PI-Math.PI*e,g=IC(u,t.height+fC,r.x,r.y,d+2,gC);let p=c.some((e=>wC(e,g)))?gC:0;c.push(g),l.push({rotation:u,label:h.label,fontSize:gC,color:o,offset:p})}return l}(t,r,m,o);let v=0,b=0,S=0;t.title.text&&({width:b,height:S}=Ma(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:SC(t)},inflectionValues:f,gaugeValue:{label:u,textPosition:c,fontSize:h,color:m},minLabel:{label:t.minValue.label,textPosition:g,fontSize:gC,color:m},maxLabel:{label:t.maxValue.label,textPosition:p,fontSize:gC,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=mC,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=NS(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-fC-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=Aa(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 SC(e){const t=e.gaugeValue?.value;if(void 0===t)return mC;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 yC(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 CC(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 wC(e,t){const o=yC(e),s=yC(t);for(const e of o)for(const t of s)if(CC(e,t))return!0;return!1}function IC(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 xC 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((()=>bC(this.canvas.el,this.runtime)),(()=>{const e=this.canvas.el.getBoundingClientRect();return[e.width,e.height,this.runtime,this.canvas.el,window.devicePixelRatio]}))}}function EC(e){return 8===(e=Wt(e).replace("#","")).length?e.slice(6)+e.slice(0,6):e}xC.props={figureUI:Object};const RC={responsive:!0,maintainAspectRatio:!1,elements:{line:{fill:!1},point:{hitRadius:15}},animation:!1,events:["mousemove","mouseout","click","touchstart","touchmove","mouseup"]};function TC(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=[DC];const o=new window.Chart(i,t);n=o.toBase64Image(),o.destroy()}else if("scorecard"===o){Oy(Ny(t,e),i),n=i.toDataURL()}else"gauge"===o&&(bC(i,e),n=i.toDataURL());return s.remove(),n}async function AC(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=[DC];const o=new window.Chart(i,t);n=await new Promise((e=>i.toBlob(e,"image/png"))),o.destroy()}else if("scorecard"===o){Oy(Ny(t,e),i),n=await new Promise((e=>i.toBlob(e,"image/png")))}else"gauge"===o&&(bC(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 DC={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()}},_C={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")},OC={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")},FC={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")}}},MC={Custom:ni("Custom")},PC=ni("Merged cells are preventing this operation. Unmerge those cells and try again."),NC=ni("The header row of a table can't be moved."),kC={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")}},VC={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.")}},LC={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.")}},HC={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")}},UC={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))")}},BC={second:1e3,minute:6e4,hour:36e5,day:864e5,month:2592e6,year:31536e6},zC={inSeconds:function(e){return Math.floor(e/BC.second)},inMinutes:function(e){return Math.floor(e/BC.minute)},inHours:function(e){return Math.floor(e/BC.hour)},inDays:function(e){return Math.floor(e/BC.day)},inMonths:function(e){return Math.floor(e/BC.month)},inYears:function(e){return Math.floor(e/BC.year)}},$C=/^((d|dd|m|mm|yyyy|yy|hh|h|ss|a)(-|:|\s|\/))*(d|dd|m|mm|yyyy|yy|hh|h|ss|a)$/i;function GC(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(BC.second>=BC[r]&&zC.inSeconds(n)<180)return"second";if(BC.minute>=BC[r]&&zC.inMinutes(n)<180)return"minute";if(BC.hour>=BC[r]&&zC.inHours(n)<96)return"hour";if(BC.day>=BC[r]&&zC.inDays(n)<90)return"day";if(BC.month>=BC[r]&&zC.inMonths(n)<36)return"month";return"year"}(e,s,o),n={};return i&&(n[i]=s),{parser:s,displayFormats:n,unit:i??!1,tooltipFormat:s}}function WC(e,t,o,s){let i=hw(s,t,o).formattedValues,n=uw(s,t);LS(o,t[0],e.dataSetsHaveTitle||!1)&&i.shift(),({labels:i,dataSetsValues:n}=aw(i,n)),e.aggregated&&({labels:i,dataSetsValues:n}=lw(i,n));const r=dw(s,t,"left"),a=dw(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=QC(s,o);c.push(i)}return{dataSetsValues:n,trendDataSetsValues:c,axisFormats:l,labels:i,locale:s.getLocale()}}function qC(e,t,o,s){const i=WC(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&&sw(e,t,o,s)}(e,t,o,s)&&function(){if(!window.Chart)return!1;const e="luxon"===new window.Chart._adapters._date({})._id;e||nw||(nw=!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&&iw(e,t,o,s)}(e,t,o,s))return"linear";return"category"}(e,t,o,s),n=hw(s,t,o);let r="linear"===i?n.values:n.formattedValues,a=uw(s,t);const l=LS(o,t[0],e.dataSetsHaveTitle||!1);l&&r.shift(),({labels:r,dataSetsValues:a}=aw(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}=lw(r,a)),e.cumulative&&(a=gw(a,"asc"));const c={y:dw(s,t,"left"),y1:dw(s,t,"right"),x:cw(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(ew(o,n,r,i,s.getLocale()))}return{dataSetsValues:a,axisFormats:c,labels:r,locale:s.getLocale(),trendDataSetsValues:h,axisType:i}}function jC(e,t,o,s){let i=hw(s,t,o).formattedValues,n=uw(s,t);LS(o,t[0],e.dataSetsHaveTitle||!1)&&i.shift(),({labels:i,dataSetsValues:n}=aw(i,n)),e.aggregated&&({labels:i,dataSetsValues:n}=lw(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:dw(s,t,"left")},labels:i,locale:s.getLocale()}}function YC(e,t,o,s){let i=hw(s,t,o).formattedValues,n=uw(s,t);LS(o,t[0],e.dataSetsHaveTitle||!1)&&i.shift(),({labels:i,dataSetsValues:n}=aw(i,n)),e.aggregated&&({labels:i,dataSetsValues:n}=lw(i,n));return{dataSetsValues:n,axisFormats:{r:dw(s,t,"left")||dw(s,t,"right")},labels:i,locale:s.getLocale()}}function XC(e,t,o,s){let i=hw(s,t,o).formattedValues;LS(o,t[0],e.dataSetsHaveTitle||!1)&&i.shift();let n=uw(s,t);({labels:i,dataSetsValues:n}=lw(i,n));return{dataSetsValues:n,axisFormats:{y:dw(s,t,"left")||dw(s,t,"right")},labels:i,locale:s.getLocale(),availableRegions:s.getGeoChartAvailableRegions(),geoFeatureNameToId:s.geoFeatureNameToId,getGeoJsonFeatures:s.getGeoJsonFeatures}}function KC(e,t,o,s){let i=hw(s,t,o).formattedValues,n=uw(s,t);LS(o,t[0],e.dataSetsHaveTitle||!1)&&i.shift(),({labels:i,dataSetsValues:n}=aw(i,n)),e.aggregated&&({labels:i,dataSetsValues:n}=lw(i,n)),e.cumulative&&(n=gw(n,"desc"));return{dataSetsValues:n,axisFormats:{x:dw(s,t,"left")||dw(s,t,"right")},labels:i,locale:s.getLocale()}}function JC(e,t,o,s){let i=hw(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=>rw(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=LS(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:cw(s,o,r)},labels:i,locale:s.getLocale()}}function QC(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=tw(e,o,s,je(.5,i.length+.55,.2));return n.length?n:void 0}function ew(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=tw(e,n,r,je(c,h+d/2,d));return u.length?u:void 0}function tw(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 sc([t],[i],[n],!0)[0].map(((e,t)=>({x:s[t],y:e})));const r=Jl(t,i,o,!0).flat();return n.map(((e,t)=>({x:s[t],y:ec(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?tc(sc([e],[o],[n],!0))[0].map(((e,t)=>({x:s[t],y:e}))):s.map((e=>({x:e,y:NaN})))}case"logarithmic":return sc([t],oc([i]),oc([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 ow(e,t,o,s){return sw(e,t,o,s)||iw(e,t,o,s)}function sw(e,t,o,s){if(!o||!iw(e,t,o,s))return!1;const i=cw(s,o,LS(o,t[0],e.dataSetsHaveTitle||!1));return Boolean(i&&$C.test(i))}function iw(e,t,o,s){if(!o)return!1;const i=s.getRangeValues(o);return LS(o,t[0],e.dataSetsHaveTitle||!1)&&i.shift(),!i.some((e=>isNaN(Number(e))&&e))&&!i.every((e=>!e))}let nw=!1;function rw(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 aw(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 lw(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 cw(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 hw(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,rw(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=rw(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,rw(e,t[0]).length).map((e=>e.toString())),values:s.formattedValues}}return s}function dw(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 uw(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=`${FC.Series} ${parseInt(s)+1}`}else t=`${FC.Series} ${parseInt(s)+1}`;let r=i.dataRange?rw(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 gw(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 pw(e){return{padding:{left:j,right:j,top:X,bottom:Y}}}function mw(e,t){return{display:"none"!==e.legendPosition,position:"none"!==e.legendPosition?e.legendPosition:void 0}}function fw(e,t){return{...xw,...mw(e),...Ew(PS(e.background),{pointStyle:"rect",lineWidth:3})}}function vw(e,t){const o=e.fillArea,s=o?"rect":"line",i=o?2:3;return{...xw,...mw(e),...Ew(PS(e.background),{pointStyle:s,lineWidth:i})}}function bw(e,t){const{dataSetsValues:o}=t,s=Math.max(0,...o.map((e=>e?.data?.length??0))),i=$S(new mo(s),o),n=PS(e.background);return{...mw(e),labels:{usePointStyle:!0,generateLabels:e=>e.data.labels?.map(((e,t)=>({text:GS(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 Sw(e,t){return{...xw,...mw(e),...Ew(PS(e.background),{pointStyle:"circle",strokeStyle:e.background||"#ffffff",lineWidth:8})}}function yw(e,t){return{...xw,...mw(e),...Ew(PS(e.background),{lineWidth:3})}}function Cw(e,t){const o=PS(e.background),s=e.negativeValuesColor||A,i=e.positiveValuesColor||T,n=e.subTotalValuesColor||D;return{...mw(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 ww(e,t){const o=e.fillArea??!1,s=o?"rect":"line",i=o?2:3;return{...xw,...mw(e),...Ew(PS(e.background),{pointStyle:s,lineWidth:i})}}function Iw(e,t){const o=PS(e.background);return{...mw(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:GS(t),fontColor:o,fillStyle:e,strokeStyle:e,pointStyle:"rect"})))}}}}const xw={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 Ew(e,t){return{labels:{color:e,usePointStyle:!0,generateLabels:o=>o.data.datasets.map(((s,i)=>WS(s.xAxisID)?{text:GS(s.label),fontColor:e,strokeStyle:s.borderColor,hidden:!o.isDatasetVisible(i),pointStyle:"line",datasetIndex:i,lineWidth:3}:{text:GS(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 Rw(e,t){let o={};const{trendDataSetsValues:s,locale:i,axisFormats:n}=t,r={stacked:e.stacked,locale:i};if(e.horizontal)o.x=kw(e,"bottom","values",{...r,format:n?.x}),o.y=kw(e,"left","labels",r);else{o.x=kw(e,"bottom","labels",r);const t={...r,format:n?.y};o.y=kw(e,"left","values",t);const s={...r,format:n?.y1};o.y1=kw(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[IS]={...o.x,labels:Array(e).fill(""),offset:!1,display:!1},o[xS]={...o.x,offset:!0,display:!1}}return o}function Tw(e,t){const{locale:o,axisType:s,trendDataSetsValues:i,labels:n,axisFormats:r}=t,a=r?.x,l=e.stacked;let c={x:kw(e,"bottom","labels",{locale:o}),y:kw(e,"left","values",{locale:o,stacked:l,format:r?.y}),y1:kw(e,"right","values",{locale:o,stacked:l,format:r?.y1})};if(c=St(c),"time"===s&&n&&a){const e={type:"time",time:GC(n,a,o)};Object.assign(c.x,e),c.x.ticks.maxTicksLimit=15,delete c?.x?.ticks?.callback}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[IS]={...c.x,display:!1},c[xS]={...c.x,display:!1},"category"===s||"time"===s)){const e=Math.max(...i.map((e=>e?.length||0)));c[IS].type="category",c[IS].labels=je(0,e).map((e=>e.toString())),c[IS].offset=!1,c[xS].type="category",c[xS].offset=!1}return c}function Aw(e,t){const o=Tw(e,t);return{...o,x:{...o.x,grid:{display:!0}}}}function Dw(e,t){const{locale:o,axisFormats:s}=t,i=s?.y||s?.y1;e.dataSets;const n={x:{...kw(e,"bottom","labels",{locale:o}),grid:{display:!1}},y:{position:e.verticalAxisPosition,ticks:{color:PS(e.background),callback:BS({locale:o,format:i})},grid:{lineWidth:e=>0===e.tick.value?2:1},title:Nw(e.axesDesign?.y)}},r=n?.y||n?.y1;return r&&(r.grid={lineWidth:e=>0===e.tick.value?2:1}),n}function _w(e,t){const{dataSetsValues:o}=t,s=Rw(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 Ow(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:BS({format:s?.r,locale:o}),backdropColor:e.background||"#FFFFFF"},pointLabels:{color:PS(e.background),callback:GS},suggestedMin:n<0?n-1:0}}}function Fw(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:Pw(r?.defaultProjection||"mercator"),axis:"x"},color:{axis:"x",display:"none"!==e.legendPosition,border:{color:O},grid:{color:O},ticks:{color:PS(e.background),callback:BS({locale:o,format:a})},legend:{position:n,align:n.includes("right")?"left":"right",margin:Lw(e)},interpolate:Vw(e),missing:e.missingValueColor||"#ffffff"}}}function Mw(e,t){const o=t.dataSetsValues[0];return{x:{display:!1},y:{grid:{offset:!1},ticks:{callback:function(e){return GS(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 Pw(e){return"conicConformal"===e?window.ChartGeo.geoConicConformal().rotate([100,0]):e}function Nw(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 kw(e,t,o,s){const{useLeftAxis:i,useRightAxis:n}=HS(e);if("left"===t&&!i||"right"===t&&!n)return;const r=PS(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:Nw(a),grid:{display:e},beginAtZero:!0,stacked:s?.stacked,ticks:{color:r,callback:BS(s)}}}return{ticks:{padding:5,color:r,callback:function(e){return GS(this.getLabelForValue(e))}},grid:{display:!1},stacked:s?.stacked,title:Nw(a)}}function Vw(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 Lw(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 Hw={showValues:!1,showLabels:!0,valuesDesign:{align:"center",fontSize:13}};function Uw(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 US(o,s)(t,n)}}}function Bw(e,t){const{axisFormats:o,locale:s}=t;return{callback:US(o,s),showLabels:e.showLabels??Hw.showLabels,showValues:e.showValues??Hw.showValues,style:{fontSize:e.valuesDesign?.fontSize??Hw.valuesDesign.fontSize,align:e.valuesDesign?.align??Hw.valuesDesign.align,bold:e.valuesDesign?.bold??Hw.valuesDesign.bold,italic:e.valuesDesign?.italic??Hw.valuesDesign.italic,textColor:e.valuesDesign?.color??Hw.valuesDesign.color}}}function zw(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)))?"":US(o,s)(e,t.xAxisID||"x")}}function $w(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}${US(o,s)(l,i.yAxisID)}`}}}function Gw(e){const t=e.title,o=NS(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 Ww='\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 qw;function Zw(e,o={}){return function(e,o={}){qw||(qw=new t.App(t.Component,{templates:Ww,translateFn:ni}));const s=qw.getTemplate(e),i=s(o,{}),n=document.createElement("div");return t.blockDom.mount(i,n),n}(e,o).innerHTML}function jw(e,t){return{enabled:!1,external:iI,callbacks:{title:function(e){return e.some((e=>!WS(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 US(t.axisFormats,t.locale)(i,n)}}}}function Yw(e,t){const{axisType:o,locale:s,axisFormats:i}=t,n=i?.x,r={enabled:!1,external:iI,callbacks:{}};return r.callbacks.label="linear"===o?e=>{const t=e.parsed.y;let o=WS(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 US(i,s)(t,o)},r.callbacks.beforeLabel=e=>e.dataset?.label||e.label,r.callbacks.title=function(e){return"linear"!==o&&e.some((e=>!WS(e.dataset.xAxisID)))?void 0:""},r}function Xw(e,t){const{locale:o,axisFormats:s}=t,i=s?.y||s?.y1;return{enabled:!1,external:iI,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 Kw(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:iI,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 Jw(e,t){const o=jw(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 Qw(e,t){const{locale:o,axisFormats:s}=t;return{enabled:!1,external:iI,callbacks:{beforeLabel:e=>e.dataset?.label||e.label,label:function(e){return sr(e.parsed.r,{format:s?.r,locale:o})}}}}function eI(e,t){const{locale:o,axisFormats:s}=t,i=s?.y||s?.y1;return{enabled:!1,external:iI,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 tI(e,t){return{enabled:!1,external:iI,position:"funnelTooltipPositioner",callbacks:{title:()=>"",beforeLabel:e=>e.label,label:function(e){const o=e.parsed.x,s=e.dataset.xAxisID;return US(t.axisFormats,t.locale)(o,s)}}}}function oI(e,t){const{locale:o,axisFormats:s}=t,i=s?.y||s?.y1;return{enabled:!1,external:iI,filter:function(e){const t=e.raw;return t?.label!==XS},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 sI(e,t){const{locale:o,axisFormats:s}=t,i=s?.y;return{enabled:!1,external:iI,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 iI({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:nI(e,t,i.clientWidth)+"px",top:Math.floor(t.caretY-i.clientHeight/2)+"px"})}function nI(e,t,o){const s=t.caretX;return s+o>e.chartArea.right?Math.max(0,s-o):s}var rI=Object.freeze({__proto__:null,GHOST_SUNBURST_VALUE:XS,INTERACTIVE_LEGEND_CONFIG:xw,canChartParseLabels:ow,getBarChartData:WC,getBarChartDatasets:KS,getBarChartLegend:fw,getBarChartScales:Rw,getBarChartTooltip:jw,getChartColorsGenerator:my,getChartLabelFormat:cw,getChartLayout:pw,getChartShowValues:Uw,getChartTitle:Gw,getComboChartDatasets:oy,getComboChartLegend:yw,getData:rw,getFunnelChartData:KC,getFunnelChartDatasets:ny,getFunnelChartScales:Mw,getFunnelChartTooltip:tI,getFunnelLabelColors:ry,getGeoChartData:XC,getGeoChartDatasets:iy,getGeoChartScales:Fw,getGeoChartTooltip:eI,getHierarchalChartData:JC,getLineChartData:ZC,getLineChartDatasets:QS,getLineChartLegend:vw,getLineChartScales:Tw,getLineChartTooltip:Yw,getPieChartData:jC,getPieChartDatasets:ty,getPieChartLegend:bw,getPieChartTooltip:Xw,getPyramidChartData:qC,getPyramidChartScales:_w,getPyramidChartShowValues:zw,getPyramidChartTooltip:Jw,getRadarChartData:YC,getRadarChartDatasets:sy,getRadarChartLegend:ww,getRadarChartScales:Ow,getRadarChartTooltip:Qw,getScatterChartDatasets:ey,getScatterChartLegend:Sw,getScatterChartScales:Aw,getSunburstChartDatasets:ay,getSunburstChartLegend:Iw,getSunburstChartTooltip:oI,getSunburstShowValues:Bw,getTreeMapChartDatasets:dy,getTreeMapChartTooltip:sI,getTrendDatasetForBarChart:QC,getTrendDatasetForLineChart:ew,getWaterfallChartLegend:Cw,getWaterfallChartScales:Dw,getWaterfallChartShowValues:$w,getWaterfallChartTooltip:Kw,getWaterfallDatasetAndLabels:JS,makeDatasetsCumulative:gw});class aI extends Iy{dataSets;labelRange;background;legendPosition;stacked;aggregated;type="bar";dataSetsHaveTitle;dataSetDesign;axesDesign;horizontal;showValues;constructor(e,t,o){super(e,t,o),this.dataSets=DS(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 MS(e,t,o)}static validateChartDefinition(e,t){return e.checkValidations(t,kS,VS)}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=RS(this.sheetId,e,this.dataSets),o=TS(this.sheetId,e,this.labelRange),s=this.getDefinitionWithSpecificDataSets(t,o,e);return new aI(s,e,this.getters)}copyInSheetId(e){const t=this.getDefinitionWithSpecificDataSets(this.dataSets,this.labelRange,e);return new aI(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=>OS(this.getters,e))).filter((e=>""!==e.range&&e.range!==Ti.InvalidReference)),t=FS(this.getters,this.labelRange,LS(this.labelRange,this.dataSets[0],this.dataSetsHaveTitle)),o=this.getDefinition();return{...o,backgroundColor:EC(this.background||m),fontColor:EC(PS(this.background)),dataSets:e,labelRange:t,verticalAxis:HS(o)}}updateRanges(e){const{dataSets:t,labelRange:o,isStale:s}=ES(this.getters,e,this.dataSets,this.labelRange);if(!s)return this;const i=this.getDefinitionWithSpecificDataSets(t,o);return new aI(i,this.sheetId,this.getters)}}function lI(e,t){const o=e.getDefinition(),s=WC(o,e.dataSets,e.labelRange,t);return{chartJsConfig:{type:"bar",data:{labels:s.labels,datasets:KS(o,s)},options:{...RC,indexAxis:e.horizontal?"y":"x",layout:pw(),scales:Rw(o,s),plugins:{title:Gw(o),legend:fw(o),tooltip:jw(o,s),chartShowValuesPlugin:Uw(o,s)}}},background:e.background||m}}class cI extends Iy{dataSets;labelRange;background;legendPosition;aggregated;dataSetsHaveTitle;dataSetDesign;axesDesign;type="combo";showValues;constructor(e,t,o){super(e,t,o),this.dataSets=DS(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 MS(e,t,o)}static validateChartDefinition(e,t){return e.checkValidations(t,kS,VS)}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(){const e=this.dataSets.map((e=>OS(this.getters,e))).filter((e=>""!==e.range&&e.range!==Ti.InvalidReference)),t=FS(this.getters,this.labelRange,LS(this.labelRange,this.dataSets[0],this.dataSetsHaveTitle)),o=this.getDefinition();return{...o,backgroundColor:EC(this.background||m),fontColor:EC(PS(this.background)),dataSets:e,labelRange:t,verticalAxis:HS(o)}}updateRanges(e){const{dataSets:t,labelRange:o,isStale:s}=ES(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)}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=RS(this.sheetId,e,this.dataSets),o=TS(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)}}class hI extends Iy{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=DS(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 MS(e,t,o)}static validateChartDefinition(e,t){return e.checkValidations(t,kS,VS)}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=RS(this.sheetId,e,this.dataSets),o=TS(this.sheetId,e,this.labelRange),s=this.getDefinitionWithSpecificDataSets(t,o,e);return new hI(s,e,this.getters)}copyInSheetId(e){const t=this.getDefinitionWithSpecificDataSets(this.dataSets,this.labelRange,e);return new hI(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}=ES(this.getters,e,this.dataSets,this.labelRange);if(!s)return this;const i=this.getDefinitionWithSpecificDataSets(t,o);return new hI(i,this.sheetId,this.getters)}}function dI(e){return e.dataRange&&!Zr.test(e.dataRange)?"InvalidGaugeDataRange":"Success"}function uI(e,t){return t((t=>t.sectionRule?e(t.sectionRule.rangeMin,"rangeMin"):"Success"),(t=>t.sectionRule?e(t.sectionRule.rangeMax,"rangeMax"):"Success"))}function gI(e,t){if(""===e)switch(t){case"rangeMin":return"EmptyGaugeRangeMin";case"rangeMax":return"EmptyGaugeRangeMax"}return"Success"}function pI(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 mI extends Iy{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,dI,e.chainValidations(uI(gI,e.batchValidations),uI(pI,e.batchValidations)),e.chainValidations((o=pI,(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=CS(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?.[0]?.dataRange,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=TS(this.sheetId,e,this.dataRange),o=SI(this.sectionRule,(t=>this.getters.copyFormulaStringForSheet(this.sheetId,e,t,"moveReference"))),s=this.getDefinitionWithSpecificRanges(t,o,e);return new mI(s,e,this.getters)}copyInSheetId(e){const t=SI(this.sectionRule,(t=>this.getters.copyFormulaStringForSheet(this.sheetId,e,t,"keepSameReference"))),o=this.getDefinitionWithSpecificRanges(this.dataRange,t,e);return new mI(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,t,o){const s=AS(this.dataRange,e),i=SI(this.sectionRule,(s=>yS(this.sheetId,s,{applyChange:e,sheetId:t,sheetName:o}))),n=this.getDefinitionWithSpecificRanges(s,i);return new mI(n,this.sheetId,this.getters)}}function fI(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=bI(e.sheetId,e.sectionRule.rangeMin,t),c=bI(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=vI(e.sheetId,e.sectionRule.lowerInflectionPoint,l,c,t),g=vI(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 vI(e,t,o,s,i){const n=bI(e,t.value,i);if(void 0===n)return;return Ze("number"===t.type?n:o+(s-o)*n/100,o,s)}function bI(e,t,o){const s=o.evaluateFormula(e,t);return Ii(s)?void 0:$i(s,o.getLocale())}function SI(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 yI extends Iy{dataSets;labelRange;background;legendPosition;type="geo";dataSetsHaveTitle;dataSetDesign;colorScale;missingValueColor;region;constructor(e,t,o){super(e,t,o),this.dataSets=DS(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 MS(e,t,o)}static validateChartDefinition(e,t){return e.checkValidations(t,kS,VS)}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=RS(this.sheetId,e,this.dataSets),o=TS(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:"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}=ES(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 Iy{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=DS(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,kS,VS)}static transformDefinition(e,t,o){return MS(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}=ES(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)}getDefinitionForExcel(){const e=this.dataSets.map((e=>OS(this.getters,e))).filter((e=>""!==e.range&&e.range!==Ti.InvalidReference)),t=FS(this.getters,this.labelRange,LS(this.labelRange,this.dataSets[0],this.dataSetsHaveTitle)),o=this.getDefinition();return{...o,backgroundColor:EC(this.background||m),fontColor:EC(PS(this.background)),dataSets:e,labelRange:t,verticalAxis:HS(o)}}duplicateInDuplicatedSheet(e){const t=RS(this.sheetId,e,this.dataSets),o=TS(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)}}function wI(e,t){const o=e.getDefinition(),s=ZC(o,e.dataSets,e.labelRange,t);return{chartJsConfig:{type:"line",data:{labels:s.labels,datasets:QS(o,s)},options:{...RC,layout:pw(),scales:Tw(o,s),plugins:{title:Gw(o),legend:vw(o),tooltip:Yw(0,s),chartShowValuesPlugin:Uw(o,s)}}},background:e.background||m}}class II extends Iy{dataSets;labelRange;background;legendPosition;type="pie";aggregated;dataSetsHaveTitle;isDoughnut;showValues;constructor(e,t,o){super(e,t,o),this.dataSets=DS(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 MS(e,t,o)}static validateChartDefinition(e,t){return e.checkValidations(t,kS,VS)}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=RS(this.sheetId,e,this.dataSets),o=TS(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(){const e=this.dataSets.map((e=>OS(this.getters,e))).filter((e=>""!==e.range&&e.range!==Ti.InvalidReference)),t=FS(this.getters,this.labelRange,LS(this.labelRange,this.dataSets[0],this.dataSetsHaveTitle));return{...this.getDefinition(),backgroundColor:EC(this.background||m),fontColor:EC(PS(this.background)),dataSets:e,labelRange:t}}updateRanges(e){const{dataSets:t,labelRange:o,isStale:s}=ES(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)}}function xI(e,t){const o=e.getDefinition(),s=jC(o,e.dataSets,e.labelRange,t);return{chartJsConfig:{type:e.isDoughnut?"doughnut":"pie",data:{labels:s.labels,datasets:ty(o,s)},options:{...RC,layout:pw(),plugins:{title:Gw(o),legend:bw(o,s),tooltip:Xw(0,s),chartShowValuesPlugin:Uw(o,s)}}},background:e.background||m}}class EI extends Iy{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=DS(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 MS(e,t,o)}static validateChartDefinition(e,t){return e.checkValidations(t,kS,VS)}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=RS(this.sheetId,e,this.dataSets),o=TS(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:"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}=ES(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)}}class RI extends Iy{dataSets;labelRange;background;legendPosition;stacked;aggregated;type="radar";dataSetsHaveTitle;dataSetDesign;fillArea;showValues;constructor(e,t,o){super(e,t,o),this.dataSets=DS(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 MS(e,t,o)}static validateChartDefinition(e,t){return e.checkValidations(t,kS,VS)}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=RS(this.sheetId,e,this.dataSets),o=TS(this.sheetId,e,this.labelRange),s=this.getDefinitionWithSpecificDataSets(t,o,e);return new RI(s,e,this.getters)}copyInSheetId(e){const t=this.getDefinitionWithSpecificDataSets(this.dataSets,this.labelRange,e);return new RI(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(){const e=this.dataSets.map((e=>OS(this.getters,e))).filter((e=>""!==e.range&&e.range!==Ti.InvalidReference)),t=FS(this.getters,this.labelRange,LS(this.labelRange,this.dataSets[0],this.dataSetsHaveTitle));return{...this.getDefinition(),backgroundColor:EC(this.background||m),fontColor:EC(PS(this.background)),dataSets:e,labelRange:t}}updateRanges(e){const{dataSets:t,labelRange:o,isStale:s}=ES(this.getters,e,this.dataSets,this.labelRange);if(!s)return this;const i=this.getDefinitionWithSpecificDataSets(t,o);return new RI(i,this.sheetId,this.getters)}}class TI extends Iy{dataSets;labelRange;background;legendPosition;labelsAsText;aggregated;type="scatter";dataSetsHaveTitle;dataSetDesign;axesDesign;showValues;constructor(e,t,o){super(e,t,o),this.dataSets=DS(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,kS,VS)}static transformDefinition(e,t,o){return MS(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}=ES(this.getters,e,this.dataSets,this.labelRange);if(!s)return this;const i=this.getDefinitionWithSpecificDataSets(t,o);return new TI(i,this.sheetId,this.getters)}getDefinitionForExcel(){const e=this.dataSets.map((e=>OS(this.getters,e))).filter((e=>""!==e.range)),t=FS(this.getters,this.labelRange,LS(this.labelRange,this.dataSets[0],this.dataSetsHaveTitle)),o=this.getDefinition();return{...o,backgroundColor:EC(this.background||m),fontColor:EC(PS(this.background)),dataSets:e,labelRange:t,verticalAxis:HS(o)}}duplicateInDuplicatedSheet(e){const t=RS(this.sheetId,e,this.dataSets),o=TS(this.sheetId,e,this.labelRange),s=this.getDefinitionWithSpecificDataSets(t,o,e);return new TI(s,e,this.getters)}copyInSheetId(e){const t=this.getDefinitionWithSpecificDataSets(this.dataSets,this.labelRange,e);return new TI(t,e,this.getters)}}class AI extends Iy{dataSets;labelRange;background;legendPosition;type="sunburst";dataSetsHaveTitle;showValues;showLabels;valuesDesign;groupColors;constructor(e,t,o){super(e,t,o),this.dataSets=DS(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 MS(e,t,o)}static validateChartDefinition(e,t){return e.checkValidations(t,kS,VS)}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=RS(this.sheetId,e,this.dataSets),o=TS(this.sheetId,e,this.labelRange),s=this.getDefinitionWithSpecificDataSets(t,o,e);return new AI(s,e,this.getters)}copyInSheetId(e){const t=this.getDefinitionWithSpecificDataSets(this.dataSets,this.labelRange,e);return new AI(t,e,this.getters)}getDefinitionForExcel(){}updateRanges(e){const{dataSets:t,labelRange:o,isStale:s}=ES(this.getters,e,this.dataSets,this.labelRange);if(!s)return this;const i=this.getDefinitionWithSpecificDataSets(t,o);return new AI(i,this.sheetId,this.getters)}}class DI extends Iy{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=DS(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 MS(e,t,o)}static validateChartDefinition(e,t){return e.checkValidations(t,kS,VS)}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=RS(this.sheetId,e,this.dataSets),o=TS(this.sheetId,e,this.labelRange),s=this.getDefinitionWithSpecificDataSets(t,o,e);return new DI(s,e,this.getters)}copyInSheetId(e){const t=this.getDefinitionWithSpecificDataSets(this.dataSets,this.labelRange,e);return new DI(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}=ES(this.getters,e,this.dataSets,this.labelRange);if(!s)return this;const i=this.getDefinitionWithSpecificDataSets(t,o);return new DI(i,this.sheetId,this.getters)}}class _I extends Iy{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=DS(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 MS(e,t,o)}static validateChartDefinition(e,t){return e.checkValidations(t,kS,VS)}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=RS(this.sheetId,e,this.dataSets),o=TS(this.sheetId,e,this.labelRange),s=this.getDefinitionWithSpecificDataSets(t,o,e);return new _I(s,e,this.getters)}copyInSheetId(e){const t=this.getDefinitionWithSpecificDataSets(this.dataSets,this.labelRange,e);return new _I(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}=ES(this.getters,e,this.dataSets,this.labelRange);if(!s)return this;const i=this.getDefinitionWithSpecificDataSets(t,o);return new _I(i,this.sheetId,this.getters)}}function OI(e,t){const o=e.getDefinition(),s=WC(o,e.dataSets,e.labelRange,t),{labels:i,datasets:n}=JS(o,s);return{chartJsConfig:{type:"bar",data:{labels:i,datasets:n},options:{...RC,layout:pw(),scales:Dw(o,s),plugins:{title:Gw(o),legend:Cw(o),tooltip:Kw(0,s),chartShowValuesPlugin:$w(o,s),waterfallLinesPlugin:{showConnectorLines:o.showConnectorLines}}}},background:e.background||m}}const FI=new n;FI.add("bar",{match:e=>"bar"===e,createChart:(e,t,o)=>new aI(e,t,o),getChartRuntime:lI,validateChartDefinition:aI.validateChartDefinition,transformDefinition:aI.transformDefinition,getChartDefinitionFromContextCreation:aI.getDefinitionFromContextCreation,sequence:10}),FI.add("combo",{match:e=>"combo"===e,createChart:(e,t,o)=>new cI(e,t,o),getChartRuntime:function(e,t){const o=e.getDefinition(),s=WC(o,e.dataSets,e.labelRange,t);return{chartJsConfig:{type:"bar",data:{labels:s.labels,datasets:oy(o,s)},options:{...RC,layout:pw(),scales:Rw(o,s),plugins:{title:Gw(o),legend:yw(o),tooltip:jw(o,s),chartShowValuesPlugin:Uw(o,s)}}},background:e.background||m}},validateChartDefinition:cI.validateChartDefinition,transformDefinition:cI.transformDefinition,getChartDefinitionFromContextCreation:cI.getDefinitionFromContextCreation,sequence:15}),FI.add("line",{match:e=>"line"===e,createChart:(e,t,o)=>new CI(e,t,o),getChartRuntime:wI,validateChartDefinition:CI.validateChartDefinition,transformDefinition:CI.transformDefinition,getChartDefinitionFromContextCreation:CI.getDefinitionFromContextCreation,sequence:20}),FI.add("pie",{match:e=>"pie"===e,createChart:(e,t,o)=>new II(e,t,o),getChartRuntime:xI,validateChartDefinition:II.validateChartDefinition,transformDefinition:II.transformDefinition,getChartDefinitionFromContextCreation:II.getDefinitionFromContextCreation,sequence:30}),FI.add("scorecard",{match:e=>"scorecard"===e,createChart:(e,t,o)=>new _y(e,t,o),getChartRuntime:Fy,validateChartDefinition:_y.validateChartDefinition,transformDefinition:_y.transformDefinition,getChartDefinitionFromContextCreation:_y.getDefinitionFromContextCreation,sequence:40}),FI.add("gauge",{match:e=>"gauge"===e,createChart:(e,t,o)=>new mI(e,t,o),getChartRuntime:fI,validateChartDefinition:mI.validateChartDefinition,transformDefinition:mI.transformDefinition,getChartDefinitionFromContextCreation:mI.getDefinitionFromContextCreation,sequence:50}),FI.add("scatter",{match:e=>"scatter"===e,createChart:(e,t,o)=>new TI(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:ey(o,s)},options:{...RC,layout:pw(),scales:Aw(o,s),plugins:{title:Gw(o),legend:Sw(o),tooltip:Yw(0,s),chartShowValuesPlugin:Uw(o,s)}}},background:e.background||m}},validateChartDefinition:TI.validateChartDefinition,transformDefinition:TI.transformDefinition,getChartDefinitionFromContextCreation:TI.getDefinitionFromContextCreation,sequence:60}),FI.add("waterfall",{match:e=>"waterfall"===e,createChart:(e,t,o)=>new _I(e,t,o),getChartRuntime:OI,validateChartDefinition:_I.validateChartDefinition,transformDefinition:_I.transformDefinition,getChartDefinitionFromContextCreation:_I.getDefinitionFromContextCreation,sequence:70}),FI.add("pyramid",{match:e=>"pyramid"===e,createChart:(e,t,o)=>new EI(e,t,o),getChartRuntime:function(e,t){const o=e.getDefinition(),s=qC(o,e.dataSets,e.labelRange,t);return{chartJsConfig:{type:"bar",data:{labels:s.labels,datasets:KS(o,s)},options:{...RC,indexAxis:"y",layout:pw(),scales:_w(o,s),plugins:{title:Gw(o),legend:fw(o),tooltip:Jw(o,s),chartShowValuesPlugin:zw(o,s)}}},background:e.background||m}},validateChartDefinition:EI.validateChartDefinition,transformDefinition:EI.transformDefinition,getChartDefinitionFromContextCreation:EI.getDefinitionFromContextCreation,sequence:80}),FI.add("radar",{match:e=>"radar"===e,createChart:(e,t,o)=>new RI(e,t,o),getChartRuntime:function(e,t){const o=e.getDefinition(),s=YC(o,e.dataSets,e.labelRange,t);return{chartJsConfig:{type:"radar",data:{labels:s.labels,datasets:sy(o,s)},options:{...RC,layout:pw(),scales:Ow(o,s),plugins:{title:Gw(o),legend:ww(o),tooltip:Qw(0,s),chartShowValuesPlugin:Uw(o,s)}}},background:e.background||m}},validateChartDefinition:RI.validateChartDefinition,transformDefinition:RI.transformDefinition,getChartDefinitionFromContextCreation:RI.getDefinitionFromContextCreation,sequence:80}),FI.add("geo",{match:e=>"geo"===e,createChart:(e,t,o)=>new yI(e,t,o),getChartRuntime:function(e,t){const o=e.getDefinition(),s=XC(o,e.dataSets,e.labelRange,t);return{chartJsConfig:{type:"choropleth",data:{datasets:iy(o,s)},options:{...RC,layout:pw(),scales:Fw(o,s),plugins:{title:Gw(o),tooltip:eI(0,s),legend:{display:!1}}}},background:e.background||m}},validateChartDefinition:yI.validateChartDefinition,transformDefinition:yI.transformDefinition,getChartDefinitionFromContextCreation:yI.getDefinitionFromContextCreation,sequence:90}),FI.add("funnel",{match:e=>"funnel"===e,createChart:(e,t,o)=>new hI(e,t,o),getChartRuntime:function(e,t){const o=e.getDefinition(),s=KC(o,e.dataSets,e.labelRange,t);return{chartJsConfig:{type:"funnel",data:{labels:s.labels,datasets:ny(o,s)},options:{...RC,indexAxis:"y",layout:pw(),scales:Mw(0,s),plugins:{title:Gw(o),legend:{display:!1},tooltip:tI(0,s),chartShowValuesPlugin:Uw(o,s)}}},background:e.background||m}},validateChartDefinition:hI.validateChartDefinition,transformDefinition:hI.transformDefinition,getChartDefinitionFromContextCreation:hI.getDefinitionFromContextCreation,sequence:100}),FI.add("sunburst",{match:e=>"sunburst"===e,createChart:(e,t,o)=>new AI(e,t,o),getChartRuntime:function(e,t){const o=e.getDefinition(),s=JC(o,e.dataSets,e.labelRange,t);return{chartJsConfig:{type:"doughnut",data:{datasets:ay(o,s)},options:{cutout:"25%",...RC,layout:pw(),plugins:{title:Gw(o),legend:Iw(o),tooltip:oI(0,s),sunburstLabelsPlugin:Bw(o,s),sunburstHoverPlugin:{enabled:!0}}}},background:e.background||m}},validateChartDefinition:AI.validateChartDefinition,transformDefinition:AI.transformDefinition,getChartDefinitionFromContextCreation:AI.getDefinitionFromContextCreation,sequence:30}),FI.add("treemap",{match:e=>"treemap"===e,createChart:(e,t,o)=>new DI(e,t,o),getChartRuntime:function(e,t){const o=e.getDefinition(),s=JC(o,e.dataSets,e.labelRange,t);return{chartJsConfig:{type:"treemap",data:{labels:s.labels,datasets:dy(o,s)},options:{...RC,layout:pw(),plugins:{title:Gw(o),legend:{display:!1},tooltip:sI(0,s)}}},background:e.background||m}},validateChartDefinition:DI.validateChartDefinition,transformDefinition:DI.transformDefinition,getChartDefinitionFromContextCreation:DI.getDefinitionFromContextCreation,sequence:100});const MI=new n;MI.add("line",wy),MI.add("bar",wy),MI.add("combo",wy),MI.add("pie",wy),MI.add("gauge",xC),MI.add("scatter",wy),MI.add("scorecard",Vy),MI.add("waterfall",wy),MI.add("pyramid",wy),MI.add("radar",wy),MI.add("geo",wy),MI.add("funnel",wy),MI.add("sunburst",wy),MI.add("treemap",wy);const PI={line:ni("Line"),column:ni("Column"),bar:ni("Bar"),area:ni("Area"),pie:ni("Pie"),hierarchical:ni("Hierarchical"),misc:ni("Miscellaneous")},NI=new n;NI.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 kI=new n;Eh`
|
|
10
10
|
.o-chart-container {
|
|
11
11
|
width: 100%;
|
|
12
12
|
height: 100%;
|
|
@@ -830,7 +830,7 @@
|
|
|
830
830
|
}
|
|
831
831
|
}
|
|
832
832
|
}
|
|
833
|
-
`;class NF extends t.Component{static template="o-spreadsheet-Composer";static props={focus:{validate:e=>["inactive","cellFocus","contentFocus"].includes(e)},inputStyle:{type:String,optional:!0},rect:{type:Object,optional:!0},delimitation:{type:Object,optional:!0},onComposerCellFocused:{type:Function,optional:!0},onComposerContentFocused:Function,isDefaultFocus:{type:Boolean,optional:!0},onInputContextMenu:{type:Function,optional:!0},composerStore:Object,placeholder:{type:String,optional:!0}};static components={TextValueProvider:xF,FunctionDescriptionProvider:AF,SpeechBubble:DF};static defaultProps={inputStyle:"",isDefaultFocus:!1};DOMFocusableElementStore;composerRef=t.useRef("o_composer");contentHelper=new RF(this.composerRef.el);composerState=t.useState({positionStart:0,positionEnd:0,hoveredRect:void 0});autoCompleteState;functionDescriptionState=t.useState({showDescription:!1,functionDescription:{},argsToFocus:[]});assistant=t.useState({forcedClosed:!1});compositionActive=!1;spreadsheetRect=$T();lastHoveredTokenIndex=void 0;debouncedHover=dt(((e,t)=>{const o=this.contentHelper.getCurrentSelection();if(o.start!==o.end)return;const s=this.props.composerStore.hoveredTokens;this.props.composerStore.hoverToken(e),ft(s,this.props.composerStore.hoveredTokens)||(this.composerState.hoveredRect=t)}),120);get assistantStyleProperties(){const e=this.composerRef.el.getBoundingClientRect(),t={},o=Math.min(this.props.rect?.width||1/0,OF);t["min-width"]=`${o}px`;const s=this.autoCompleteState.provider?.proposals,i=s?.some((e=>e.description));if((this.functionDescriptionState.showDescription||i)&&(t.width="300px"),this.props.delimitation&&this.props.rect){const{x:e,y:o,height:s}=this.props.rect,i=this.props.delimitation.height-(o+s);if(t["max-height"]=`${i}px`,o>i){const e=o;t["max-height"]=e-9+"px",t.top="-3px",t.transform="translate(0, -100%)"}e+OF>this.props.delimitation.width&&(t.right="0px")}else t["max-height"]=this.spreadsheetRect.height-e.bottom-1+"px",e.left+OF+ne+9>this.spreadsheetRect.width&&(t.right="9px");return t}get assistantStyle(){const e=this.assistantStyleProperties;return Ah({"max-height":e["max-height"],width:e.width,"min-width":e["min-width"]})}get assistantContainerStyle(){const e=this.assistantStyleProperties;return Ah({top:e.top,right:e.right,transform:e.transform})}shouldProcessInputEvents=!1;tokens=[];keyMapping={Enter:e=>this.processEnterKey(e,"down"),"Shift+Enter":e=>this.processEnterKey(e,"up"),"Alt+Enter":this.processNewLineEvent,"Ctrl+Enter":this.processNewLineEvent,Escape:this.processEscapeKey,F2:e=>this.toggleEditionMode(e),F4:e=>this.processF4Key(e),Tab:e=>this.processTabKey(e,"right"),"Shift+Tab":e=>this.processTabKey(e,"left")};keyCodeMapping={NumpadDecimal:this.processNumpadDecimal};setup(){this.DOMFocusableElementStore=uh(IF),this.autoCompleteState=gh(EF),t.onMounted((()=>{const e=this.composerRef.el;this.props.isDefaultFocus&&this.DOMFocusableElementStore.setFocusableElement(e),this.contentHelper.updateEl(e)})),this.env.model.selection.observe(this,{handleEvent:()=>this.autoCompleteState.hide()}),t.onWillUnmount((()=>{this.env.model.selection.detachObserver(this),this.debouncedHover.stopDebounce()})),t.useEffect((()=>{this.processContent(),document.activeElement!==this.contentHelper.el||"inactive"!==this.props.composerStore.editionMode||this.props.isDefaultFocus||this.DOMFocusableElementStore.focus()})),t.useEffect((()=>{this.processTokenAtCursor()}),(()=>["inactive"!==this.props.composerStore.editionMode])),t.useEffect((()=>{this.contentHelper.scrollSelectionIntoView()}),(()=>[this.props.composerStore.composerSelection.start,this.props.composerStore.composerSelection.end]))}processArrowKeys(e){const t=this.props.composerStore.tokenAtCursor;if((this.props.composerStore.isSelectingRange||"inactive"===this.props.composerStore.editionMode)&&(!["ArrowUp","ArrowDown"].includes(e.key)||!this.autoCompleteState.provider||"REFERENCE"===t?.type))return this.functionDescriptionState.showDescription=!1,this.autoCompleteState.hide(),e.preventDefault(),e.stopPropagation(),void WO(e,this.env.model.selection);const o=this.props.composerStore.currentContent;"cellFocus"!==this.props.focus||this.autoCompleteState.provider||Ht(o)?(e.stopPropagation(),this.handleArrowKeysForAutocomplete(e)):this.props.composerStore.stopEdition()}handleArrowKeysForAutocomplete(e){["ArrowUp","ArrowDown"].includes(e.key)&&this.autoCompleteState.provider&&(e.preventDefault(),this.autoCompleteState.moveSelection("ArrowDown"===e.key?"next":"previous"))}processTabKey(e,t){if(e.preventDefault(),e.stopPropagation(),"inactive"!==this.props.composerStore.editionMode){const e=this.autoCompleteState;if(e.provider&&void 0!==e.selectedIndex){const t=e.provider.proposals[e.selectedIndex]?.text;if(t)return void this.autoComplete(t)}this.props.composerStore.stopEdition(t)}}processEnterKey(e,t){e.preventDefault(),e.stopPropagation();const o=this.autoCompleteState;if(o.provider&&void 0!==o.selectedIndex){const e=o.provider.proposals[o.selectedIndex]?.text;if(e)return void this.autoComplete(e)}this.props.composerStore.stopEdition(t)}processNewLineEvent(e){e.preventDefault(),e.stopPropagation();const t=this.contentHelper.getText(),o=this.contentHelper.getCurrentSelection(),s=Math.min(o.start,o.end),i=Math.max(o.start,o.end);this.props.composerStore.stopComposerRangeSelection(),this.props.composerStore.setCurrentContent(t.slice(0,s)+Ne+t.slice(i),{start:s+1,end:s+1}),this.processContent()}processEscapeKey(e){this.props.composerStore.cancelEdition(),e.stopPropagation(),e.preventDefault()}processF4Key(e){e.stopPropagation(),this.props.composerStore.cycleReferences(),this.processContent()}toggleEditionMode(e){e.stopPropagation(),this.props.composerStore.toggleEditionMode(),this.processContent()}processNumpadDecimal(e){e.stopPropagation(),e.preventDefault();const t=this.env.model.getters.getLocale(),o=this.contentHelper.getCurrentSelection(),s=this.props.composerStore.currentContent,i=s.slice(0,o.start)+t.decimalSeparator+s.slice(o.end);this.props.composerStore.setCurrentContent(i,{start:o.start+1,end:o.start+1}),this.processContent()}onCompositionStart(){this.compositionActive=!0}onCompositionEnd(){this.compositionActive=!1}onKeydown(e){if("inactive"===this.props.composerStore.editionMode)return;if(e.key.startsWith("Arrow"))return void this.processArrowKeys(e);let t=this.keyMapping[jI(e)]||this.keyCodeMapping[jI(e,"code")];t?t.call(this,e):e.stopPropagation()}onPaste(e){"inactive"!==this.props.composerStore.editionMode?e.stopPropagation():e.preventDefault()}onInput(e){if(!this.shouldProcessInputEvents)return;let t;if(e.stopPropagation(),t="inactive"===this.props.composerStore.editionMode?e.data||"":this.contentHelper.getText(),"inactive"===this.props.focus)return this.props.onComposerCellFocused?.(t);let o=this.contentHelper.getCurrentSelection();this.props.composerStore.stopComposerRangeSelection(),this.props.composerStore.setCurrentContent(t,o),this.processTokenAtCursor()}onKeyup(e){if(this.contentHelper.el===document.activeElement){if(this.autoCompleteState.provider&&["ArrowUp","ArrowDown"].includes(e.key))return;if(this.props.composerStore.isSelectingRange&&e.key?.startsWith("Arrow"))return;const{start:t,end:o}=this.props.composerStore.composerSelection,{start:s,end:i}=this.contentHelper.getCurrentSelection();s===t&&i===o||this.props.composerStore.changeComposerCursorSelection(s,i),this.processTokenAtCursor()}}onBlur(e){if("inactive"===this.props.composerStore.editionMode)return;const t=e.relatedTarget;t&&t instanceof HTMLElement?t.attributes.getNamedItem("composerFocusableElement")?this.contentHelper.el.focus():t.classList.contains("o-composer")||this.props.composerStore.stopEdition():this.props.composerStore.stopEdition()}updateAutoCompleteIndex(e){this.autoCompleteState.selectIndex(Ze(0,e,10))}onMousedown(e){e.button>0||(this.debouncedHover.stopDebounce(),this.contentHelper.removeSelection())}onMouseup(){if(this.env.model.getters.isReadonly())return;const e=this.contentHelper.getCurrentSelection();e.start!==e.end&&this.props.composerStore.hoverToken(void 0)}onClick(){if(this.env.model.getters.isReadonly())return;const e=this.contentHelper.getCurrentSelection();this.props.composerStore.stopComposerRangeSelection(),this.props.onComposerContentFocused(),this.props.composerStore.changeComposerCursorSelection(e.start,e.end),this.processTokenAtCursor()}onDblClick(){if(this.env.model.getters.isReadonly())return;const e=this.props.composerStore.currentContent;if(Ht(e)){const t=this.props.composerStore.currentTokens,o=this.contentHelper.getCurrentSelection();if(o.start===o.end)return;const s=e.substring(o.start,o.end),i=t.filter((e=>e.value.includes(s)&&e.start<=o.start&&e.end>=o.end))[0];if(!i)return;"REFERENCE"===i.type&&this.props.composerStore.changeComposerCursorSelection(i.start,i.end)}}onContextMenu(e){"inactive"===this.props.composerStore.editionMode&&this.props.onInputContextMenu?.(e)}closeAssistant(){this.canBeToggled&&(this.assistant.forcedClosed=!0)}openAssistant(){this.canBeToggled&&(this.assistant.forcedClosed=!1)}onWheel(e){this.composerRef.el&&this.composerRef.el.scrollHeight>this.composerRef.el.clientHeight&&e.stopPropagation()}get canBeToggled(){return this.autoCompleteState.provider?.canBeToggled??!0}processContent(){if(this.compositionActive)return;this.shouldProcessInputEvents=!1,"inactive"!==this.props.focus&&document.activeElement!==this.contentHelper.el&&this.contentHelper.el.focus();const e=this.getContentLines();if(this.contentHelper.setText(e),0!==e.length&&0!==e.length[0]&&"inactive"!==this.props.focus){const{start:e,end:t}=this.props.composerStore.composerSelection;this.contentHelper.selectRange(e,t)}this.shouldProcessInputEvents=!0}getContentLines(){let e=this.props.composerStore.currentContent;const t=Ht(e);return""===e?[]:t&&"inactive"!==this.props.focus?this.splitHtmlContentIntoLines(this.getHtmlContentFromTokens()):this.splitHtmlContentIntoLines([{value:e,classes:[]}])}getHtmlContentFromTokens(){const e=this.props.composerStore.currentTokens,t=[],{end:o,start:s}=this.props.composerStore.composerSelection;for(let i=0;i<e.length;i++){const n=e[i];let r=n.color||$y;n.isBlurred&&(r=oo(r,.5));const a=[];"REFERENCE"===n.type&&this.props.composerStore.tokenAtCursor===n&&"selecting"===this.props.composerStore.editionMode&&a.push("text-decoration-underline"),o===s&&n.isParenthesisLinkedToCursor&&a.push(MF),n.isInHoverContext&&a.push(PF),this.props.composerStore.showSelectionIndicator&&o===s&&o===n.end&&a.push(FF),t.push({value:n.value,color:r,classes:a,onHover:e=>this.onTokenHover(i,e),onStopHover:()=>this.onTokenHover(void 0)})}return t}onTokenHover(e,t){this.lastHoveredTokenIndex!==e&&(this.lastHoveredTokenIndex=e,this.debouncedHover(e,t))}splitHtmlContentIntoLines(e){const t=[];let o=[];for(const s of e)if(s.value.includes(Ne)){const e=s.value.split(Ne),i=e.pop();for(const i of e)o.push({color:s.color,value:i}),t.push(o),o=[];o.push({...s,value:i})}else o.push(s);o.length&&t.push(o);const s=[];for(const e of t)e.every(this.isContentEmpty)?s.push([e[0]]):s.push(e.filter((e=>!this.isContentEmpty(e))));return s}isContentEmpty(e){return!(e.value||e.classes?.length)}processTokenAtCursor(){const e=this.props.composerStore;this.autoCompleteState.provider&&this.autoCompleteState.hide(),this.functionDescriptionState.showDescription=!1;const t=this.props.composerStore.autocompleteProvider;t&&this.autoCompleteState.useProvider(t);const o=this.props.composerStore.tokenAtCursor;if(Ht(e.currentContent)&&o&&"SYMBOL"!==o.type){const e=o.functionContext,t=e?.parent.toUpperCase();if(e&&t&&t in _F&&"UNKNOWN"!==o.type){const s=_F[t],i=e.argPosition,n=e.args.length;this.functionDescriptionState.functionDescription=s;const r=this.props.composerStore.currentTokens.some((e=>"RIGHT_PAREN"===e.type&&e.parenthesesCode===o.parenthesesCode));this.functionDescriptionState.argsToFocus=this.getArgsToFocus(r,s,n,i),this.functionDescriptionState.showDescription=!0}}}getArgsToFocus(e,t,o,s){const{nbrArgRepeating:i,minArgRequired:n,nbrArgOptional:r,maxArgPossible:a}=t;if(e){const e=Hh(t,Math.max(Math.min(a,o),n))(s);return void 0!==e?[e]:[]}const l=Math.max(o,n),c=i?n+Math.ceil((l-n)/i)*i+r:a,h=[];for(let e=l;e<=c;e++){const o=Hh(t,e)(s);void 0!==o&&h.push(o)}return[...new Set(h)]}autoComplete(e){!e||this.assistant.forcedClosed&&this.canBeToggled||(this.autoCompleteState.provider?.selectProposal(e),this.processTokenAtCursor())}get displaySpeechBubble(){return!("inactive"===this.props.focus||!this.composerState.hoveredRect||!this.props.composerStore.hoveredContentEvaluation)}}class kF extends qy{args;constructor(e,t){super(e),this.args=t,this._currentContent=this.getComposerContent()}getAutoCompleteProviders(){const e=super.getAutoCompleteProviders(),t=this.args().contextualAutocomplete;return t&&e.push(t),e}getZoneReference(e){const t=super.getZoneReference(e);return this.args().defaultStatic?Yf(t,"colrow"):t}getComposerContent(){let e=this._currentContent;if("inactive"===this.editionMode){const t=this.args().defaultRangeSheetId;e=Rf(this.args().content).map((e=>{if("REFERENCE"===e.type){const o=this.getters.getRangeFromSheetXC(t,e.value);return this.getters.getRangeString(o,this.getters.getActiveSheetId())}return e.value})).join("")}return Cl(e,this.getters.getLocale())}stopEdition(){this._stopEdition()}confirmEdition(e){this.args().onConfirm(e)}getTokenColor(e){if("SYMBOL"===e.type){const t=this.args().getContextualColoredSymbolToken?.(e);if(t)return t}return super.getTokenColor(e)}}Eh`
|
|
833
|
+
`;class NF extends t.Component{static template="o-spreadsheet-Composer";static props={focus:{validate:e=>["inactive","cellFocus","contentFocus"].includes(e)},inputStyle:{type:String,optional:!0},rect:{type:Object,optional:!0},delimitation:{type:Object,optional:!0},onComposerCellFocused:{type:Function,optional:!0},onComposerContentFocused:Function,isDefaultFocus:{type:Boolean,optional:!0},onInputContextMenu:{type:Function,optional:!0},composerStore:Object,placeholder:{type:String,optional:!0}};static components={TextValueProvider:xF,FunctionDescriptionProvider:AF,SpeechBubble:DF};static defaultProps={inputStyle:"",isDefaultFocus:!1};DOMFocusableElementStore;composerRef=t.useRef("o_composer");contentHelper=new RF(this.composerRef.el);composerState=t.useState({positionStart:0,positionEnd:0,hoveredRect:void 0});autoCompleteState;functionDescriptionState=t.useState({showDescription:!1,functionDescription:{},argsToFocus:[]});assistant=t.useState({forcedClosed:!1});compositionActive=!1;spreadsheetRect=$T();lastHoveredTokenIndex=void 0;debouncedHover=dt(((e,t)=>{const o=this.contentHelper.getCurrentSelection();if(o.start!==o.end)return;const s=this.props.composerStore.hoveredTokens;this.props.composerStore.hoverToken(e),ft(s,this.props.composerStore.hoveredTokens)||(this.composerState.hoveredRect=t)}),120);get assistantStyleProperties(){const e=this.composerRef.el.getBoundingClientRect(),t={},o=Math.min(this.props.rect?.width||1/0,OF);t["min-width"]=`${o}px`;const s=this.autoCompleteState.provider?.proposals,i=s?.some((e=>e.description));if((this.functionDescriptionState.showDescription||i)&&(t.width="300px"),this.props.delimitation&&this.props.rect){const{x:e,y:o,height:s}=this.props.rect,i=this.props.delimitation.height-(o+s);if(t["max-height"]=`${i}px`,o>i){const e=o;t["max-height"]=e-9+"px",t.top="-3px",t.transform="translate(0, -100%)"}e+OF>this.props.delimitation.width&&(t.right="0px")}else t["max-height"]=this.spreadsheetRect.height-e.bottom-1+"px",e.left+OF+ne+9>this.spreadsheetRect.width&&(t.right="9px");return t}get assistantStyle(){const e=this.assistantStyleProperties;return Ah({"max-height":e["max-height"],width:e.width,"min-width":e["min-width"]})}get assistantContainerStyle(){const e=this.assistantStyleProperties;return Ah({top:e.top,right:e.right,transform:e.transform})}shouldProcessInputEvents=!1;tokens=[];keyMapping={Enter:e=>this.processEnterKey(e,"down"),"Shift+Enter":e=>this.processEnterKey(e,"up"),"Alt+Enter":this.processNewLineEvent,"Ctrl+Enter":this.processNewLineEvent,Escape:this.processEscapeKey,F2:e=>this.toggleEditionMode(e),F4:e=>this.processF4Key(e),Tab:e=>this.processTabKey(e,"right"),"Shift+Tab":e=>this.processTabKey(e,"left")};keyCodeMapping={NumpadDecimal:this.processNumpadDecimal};setup(){this.DOMFocusableElementStore=uh(IF),this.autoCompleteState=gh(EF),t.onMounted((()=>{const e=this.composerRef.el;this.props.isDefaultFocus&&this.DOMFocusableElementStore.setFocusableElement(e),this.contentHelper.updateEl(e)})),this.env.model.selection.observe(this,{handleEvent:()=>this.autoCompleteState.hide()}),t.onWillUnmount((()=>{this.env.model.selection.detachObserver(this),this.debouncedHover.stopDebounce()})),t.useEffect((()=>{this.processContent(),document.activeElement!==this.contentHelper.el||"inactive"!==this.props.composerStore.editionMode||this.props.isDefaultFocus||this.DOMFocusableElementStore.focus()})),t.useEffect((()=>{this.processTokenAtCursor()}),(()=>["inactive"!==this.props.composerStore.editionMode])),t.useEffect((()=>{this.contentHelper.scrollSelectionIntoView()}),(()=>[this.props.composerStore.composerSelection.start,this.props.composerStore.composerSelection.end]))}processArrowKeys(e){const t=this.props.composerStore.tokenAtCursor;if((this.props.composerStore.isSelectingRange||"inactive"===this.props.composerStore.editionMode)&&(!["ArrowUp","ArrowDown"].includes(e.key)||!this.autoCompleteState.provider||"REFERENCE"===t?.type))return this.functionDescriptionState.showDescription=!1,this.autoCompleteState.hide(),e.preventDefault(),e.stopPropagation(),void WO(e,this.env.model.selection);const o=this.props.composerStore.currentContent;"cellFocus"!==this.props.focus||this.autoCompleteState.provider||Ht(o)?(e.stopPropagation(),this.handleArrowKeysForAutocomplete(e)):this.props.composerStore.stopEdition()}handleArrowKeysForAutocomplete(e){["ArrowUp","ArrowDown"].includes(e.key)&&this.autoCompleteState.provider&&(e.preventDefault(),this.autoCompleteState.moveSelection("ArrowDown"===e.key?"next":"previous"))}processTabKey(e,t){if(e.preventDefault(),e.stopPropagation(),"inactive"!==this.props.composerStore.editionMode){const e=this.autoCompleteState;if(e.provider&&void 0!==e.selectedIndex){const t=e.provider.proposals[e.selectedIndex]?.text;if(t)return void this.autoComplete(t)}this.props.composerStore.stopEdition(t)}}processEnterKey(e,t){e.preventDefault(),e.stopPropagation();const o=this.autoCompleteState;if(o.provider&&void 0!==o.selectedIndex){const e=o.provider.proposals[o.selectedIndex]?.text;if(e)return void this.autoComplete(e)}this.props.composerStore.stopEdition(t)}processNewLineEvent(e){e.preventDefault(),e.stopPropagation();const t=this.contentHelper.getText(),o=this.contentHelper.getCurrentSelection(),s=Math.min(o.start,o.end),i=Math.max(o.start,o.end);this.props.composerStore.stopComposerRangeSelection(),this.props.composerStore.setCurrentContent(t.slice(0,s)+Ne+t.slice(i),{start:s+1,end:s+1}),this.processContent()}processEscapeKey(e){this.props.composerStore.cancelEdition(),e.stopPropagation(),e.preventDefault()}processF4Key(e){e.stopPropagation(),this.props.composerStore.cycleReferences(),this.processContent()}toggleEditionMode(e){e.stopPropagation(),this.props.composerStore.toggleEditionMode(),this.processContent()}processNumpadDecimal(e){e.stopPropagation(),e.preventDefault();const t=this.env.model.getters.getLocale(),o=this.contentHelper.getCurrentSelection(),s=this.props.composerStore.currentContent,i=s.slice(0,o.start)+t.decimalSeparator+s.slice(o.end);this.props.composerStore.setCurrentContent(i,{start:o.start+1,end:o.start+1}),this.processContent()}onCompositionStart(){this.compositionActive=!0}onCompositionEnd(){this.compositionActive=!1}onKeydown(e){if("inactive"===this.props.composerStore.editionMode)return;if(e.key.startsWith("Arrow"))return void this.processArrowKeys(e);let t=this.keyMapping[jI(e)]||this.keyCodeMapping[jI(e,"code")];t?t.call(this,e):e.stopPropagation()}onPaste(e){"inactive"!==this.props.composerStore.editionMode?e.stopPropagation():e.preventDefault()}onInput(e){if(!this.shouldProcessInputEvents)return;let t;if(e.stopPropagation(),t="inactive"===this.props.composerStore.editionMode?e.data||"":this.contentHelper.getText(),"inactive"===this.props.focus)return this.props.onComposerCellFocused?.(t);let o=this.contentHelper.getCurrentSelection();this.props.composerStore.stopComposerRangeSelection(),this.props.composerStore.setCurrentContent(t,o),this.processTokenAtCursor()}onKeyup(e){if(this.contentHelper.el===document.activeElement){if(this.autoCompleteState.provider&&["ArrowUp","ArrowDown"].includes(e.key))return;if(this.props.composerStore.isSelectingRange&&e.key?.startsWith("Arrow"))return;const{start:t,end:o}=this.props.composerStore.composerSelection,{start:s,end:i}=this.contentHelper.getCurrentSelection();s===t&&i===o||this.props.composerStore.changeComposerCursorSelection(s,i),this.processTokenAtCursor()}}onBlur(e){if("inactive"===this.props.composerStore.editionMode)return;const t=e.relatedTarget;t&&t instanceof HTMLElement?t.attributes.getNamedItem("composerFocusableElement")?this.contentHelper.el.focus():t.classList.contains("o-composer")||this.props.composerStore.stopEdition():this.props.composerStore.stopEdition()}updateAutoCompleteIndex(e){this.autoCompleteState.selectIndex(Ze(0,e,10))}onMousedown(e){e.button>0||(this.debouncedHover.stopDebounce(),this.contentHelper.removeSelection())}onMouseup(){if(this.env.model.getters.isReadonly())return;const e=this.contentHelper.getCurrentSelection();e.start!==e.end&&this.props.composerStore.hoverToken(void 0)}onClick(){if(this.env.model.getters.isReadonly())return;const e=this.contentHelper.getCurrentSelection();this.props.onComposerContentFocused(),this.props.composerStore.changeComposerCursorSelection(e.start,e.end),this.processTokenAtCursor()}onDblClick(){if(this.env.model.getters.isReadonly())return;const e=this.props.composerStore.currentContent;if(Ht(e)){const t=this.props.composerStore.currentTokens,o=this.contentHelper.getCurrentSelection();if(o.start===o.end)return;const s=e.substring(o.start,o.end),i=t.filter((e=>e.value.includes(s)&&e.start<=o.start&&e.end>=o.end))[0];if(!i)return;"REFERENCE"===i.type&&this.props.composerStore.changeComposerCursorSelection(i.start,i.end)}}onContextMenu(e){"inactive"===this.props.composerStore.editionMode&&this.props.onInputContextMenu?.(e)}closeAssistant(){this.canBeToggled&&(this.assistant.forcedClosed=!0)}openAssistant(){this.canBeToggled&&(this.assistant.forcedClosed=!1)}onWheel(e){this.composerRef.el&&this.composerRef.el.scrollHeight>this.composerRef.el.clientHeight&&e.stopPropagation()}get canBeToggled(){return this.autoCompleteState.provider?.canBeToggled??!0}processContent(){if(this.compositionActive)return;this.shouldProcessInputEvents=!1,"inactive"!==this.props.focus&&document.activeElement!==this.contentHelper.el&&this.contentHelper.el.focus();const e=this.getContentLines();if(this.contentHelper.setText(e),0!==e.length&&0!==e.length[0]&&"inactive"!==this.props.focus){const{start:e,end:t}=this.props.composerStore.composerSelection;this.contentHelper.selectRange(e,t)}this.shouldProcessInputEvents=!0}getContentLines(){let e=this.props.composerStore.currentContent;const t=Ht(e);return""===e?[]:t&&"inactive"!==this.props.focus?this.splitHtmlContentIntoLines(this.getHtmlContentFromTokens()):this.splitHtmlContentIntoLines([{value:e,classes:[]}])}getHtmlContentFromTokens(){const e=this.props.composerStore.currentTokens,t=[],{end:o,start:s}=this.props.composerStore.composerSelection;for(let i=0;i<e.length;i++){const n=e[i];let r=n.color||$y;n.isBlurred&&(r=oo(r,.5));const a=[];"REFERENCE"===n.type&&this.props.composerStore.tokenAtCursor===n&&"selecting"===this.props.composerStore.editionMode&&a.push("text-decoration-underline"),o===s&&n.isParenthesisLinkedToCursor&&a.push(MF),n.isInHoverContext&&a.push(PF),this.props.composerStore.showSelectionIndicator&&o===s&&o===n.end&&a.push(FF),t.push({value:n.value,color:r,classes:a,onHover:e=>this.onTokenHover(i,e),onStopHover:()=>this.onTokenHover(void 0)})}return t}onTokenHover(e,t){this.lastHoveredTokenIndex!==e&&(this.lastHoveredTokenIndex=e,this.debouncedHover(e,t))}splitHtmlContentIntoLines(e){const t=[];let o=[];for(const s of e)if(s.value.includes(Ne)){const e=s.value.split(Ne),i=e.pop();for(const i of e)o.push({color:s.color,value:i}),t.push(o),o=[];o.push({...s,value:i})}else o.push(s);o.length&&t.push(o);const s=[];for(const e of t)e.every(this.isContentEmpty)?s.push([e[0]]):s.push(e.filter((e=>!this.isContentEmpty(e))));return s}isContentEmpty(e){return!(e.value||e.classes?.length)}processTokenAtCursor(){const e=this.props.composerStore;this.autoCompleteState.provider&&this.autoCompleteState.hide(),this.functionDescriptionState.showDescription=!1;const t=this.props.composerStore.autocompleteProvider;t&&this.autoCompleteState.useProvider(t);const o=this.props.composerStore.tokenAtCursor;if(Ht(e.currentContent)&&o&&"SYMBOL"!==o.type){const e=o.functionContext,t=e?.parent.toUpperCase();if(e&&t&&t in _F&&"UNKNOWN"!==o.type){const s=_F[t],i=e.argPosition,n=e.args.length;this.functionDescriptionState.functionDescription=s;const r=this.props.composerStore.currentTokens.some((e=>"RIGHT_PAREN"===e.type&&e.parenthesesCode===o.parenthesesCode));this.functionDescriptionState.argsToFocus=this.getArgsToFocus(r,s,n,i),this.functionDescriptionState.showDescription=!0}}}getArgsToFocus(e,t,o,s){const{nbrArgRepeating:i,minArgRequired:n,nbrArgOptional:r,maxArgPossible:a}=t;if(e){const e=Hh(t,Math.max(Math.min(a,o),n))(s);return void 0!==e?[e]:[]}const l=Math.max(o,n),c=i?n+Math.ceil((l-n)/i)*i+r:a,h=[];for(let e=l;e<=c;e++){const o=Hh(t,e)(s);void 0!==o&&h.push(o)}return[...new Set(h)]}autoComplete(e){!e||this.assistant.forcedClosed&&this.canBeToggled||(this.autoCompleteState.provider?.selectProposal(e),this.processTokenAtCursor())}get displaySpeechBubble(){return!("inactive"===this.props.focus||!this.composerState.hoveredRect||!this.props.composerStore.hoveredContentEvaluation)}}class kF extends qy{args;constructor(e,t){super(e),this.args=t,this._currentContent=this.getComposerContent()}getAutoCompleteProviders(){const e=super.getAutoCompleteProviders(),t=this.args().contextualAutocomplete;return t&&e.push(t),e}getZoneReference(e){const t=super.getZoneReference(e);return this.args().defaultStatic?Yf(t,"colrow"):t}getComposerContent(){let e=this._currentContent;if("inactive"===this.editionMode){const t=this.args().defaultRangeSheetId;e=Rf(this.args().content).map((e=>{if("REFERENCE"===e.type){const o=this.getters.getRangeFromSheetXC(t,e.value);return this.getters.getRangeString(o,this.getters.getActiveSheetId())}return e.value})).join("")}return Cl(e,this.getters.getLocale())}stopEdition(){this._stopEdition()}confirmEdition(e){this.args().onConfirm(e)}getTokenColor(e){if("SYMBOL"===e.type){const t=this.args().getContextualColoredSymbolToken?.(e);if(t)return t}return super.getTokenColor(e)}}Eh`
|
|
834
834
|
.o-spreadsheet {
|
|
835
835
|
.o-standalone-composer {
|
|
836
836
|
min-height: 24px;
|
|
@@ -1676,7 +1676,7 @@
|
|
|
1676
1676
|
.o-paint-format-cursor {
|
|
1677
1677
|
cursor: url("data:image/svg+xml,${encodeURIComponent('\n<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="14" height="16"><path d="M6.5.4c1.3-.8 2.9-.1 3.8 1.4l2.9 5.1c.2.4.9 1.6-.4 2.3l-1.6.9 1.8 3.1c.2.4.1 1-.2 1.2l-1.6 1c-.3.1-.9 0-1.1-.4l-1.8-3.1-1.6 1c-.6.4-1.7 0-2.2-.8L0 4.3"/><path fill="#fff" d="M9.1 2a1.4 1.1 60 0 0-1.7-.6L5.5 2.5l.9 1.6-1 .6-.9-1.6-.6.4 1.8 3.1-1.3.7-1.8-3.1-1 .6 3.8 6.6 6.8-3.98M3.9 8.8 10.82 5l.795 1.4-6.81 3.96"/></svg>\n')}"), auto;
|
|
1678
1678
|
}
|
|
1679
|
-
`;class wN extends t.Component{static template="o-spreadsheet-GridOverlay";static props={onCellDoubleClicked:{type:Function,optional:!0},onCellClicked:{type:Function,optional:!0},onCellRightClicked:{type:Function,optional:!0},onGridResized:{type:Function,optional:!0},onFigureDeleted:{type:Function,optional:!0},onGridMoved:Function,gridOverlayDimensions:String,slots:{type:Object,optional:!0}};static components={FiguresContainer:pN,DataValidationOverlay:cN,GridAddRowsFooter:vN,FilterIconsOverlay:fN};static defaultProps={onCellDoubleClicked:()=>{},onCellClicked:()=>{},onCellRightClicked:()=>{},onGridResized:()=>{},onFigureDeleted:()=>{}};gridOverlay=t.useRef("gridOverlay");gridOverlayRect=GT(this.gridOverlay);cellPopovers;paintFormatStore;setup(){CN(this.env,this.gridOverlay);const e=new ResizeObserver((()=>{const e=this.gridOverlayEl.getBoundingClientRect();this.props.onGridResized({x:e.left,y:e.top,height:this.gridOverlayEl.clientHeight,width:this.gridOverlayEl.clientWidth})}));t.onMounted((()=>{e.observe(this.gridOverlayEl)})),t.onWillUnmount((()=>{e.disconnect()})),this.cellPopovers=uh(UT),this.paintFormatStore=uh(SN)}get gridOverlayEl(){if(!this.gridOverlay.el)throw new Error("GridOverlay el is not defined.");return this.gridOverlay.el}get style(){return this.props.gridOverlayDimensions}get isPaintingFormat(){return this.paintFormatStore.isActive}onMouseDown(e){if(e.button>0)return;e.target===this.gridOverlay.el&&this.cellPopovers.isOpen&&this.cellPopovers.close();const[t,o]=this.getCartesianCoordinates(e);this.props.onCellClicked(t,o,{expandZone:e.shiftKey,addZone:XI(e)},e)}onDoubleClick(e){const[t,o]=this.getCartesianCoordinates(e);this.props.onCellDoubleClicked(t,o)}onContextMenu(e){const[t,o]=this.getCartesianCoordinates(e);this.props.onCellRightClicked(t,o,{x:e.clientX,y:e.clientY})}getCartesianCoordinates(e){const t=e.clientX-this.gridOverlayRect.x,o=e.clientY-this.gridOverlayRect.y;return[this.env.model.getters.getColIndex(t),this.env.model.getters.getRowIndex(o)]}}class IN extends t.Component{static template="o-spreadsheet-GridPopover";static props={onClosePopover:Function,onMouseWheel:Function,gridRect:Object};static components={Popover:WT};cellPopovers;zIndex=Fe.GridPopover;setup(){this.cellPopovers=uh(UT)}get cellPopover(){const e=this.cellPopovers.cellPopover;if(!e.isOpen)return{isOpen:!1};const t=e.anchorRect;return{...e,anchorRect:{...t,x:t.x+this.props.gridRect.x,y:t.y+this.props.gridRect.y}}}}class xN extends t.Component{static template="o-spreadsheet-UnhideRowHeaders";static props={headersGroups:Array,headerRange:Object,offset:{type:Number,optional:!0}};static defaultProps={offset:0};get sheetId(){return this.env.model.getters.getActiveSheetId()}getUnhidePreviousButtonStyle(e){const t=this.env.model.getters.getRect(rs({col:0,row:e}));return Ah({top:t.y+t.height-te-this.props.offset+"px","margin-right":"1px"})}getUnhideNextButtonStyle(e){return Ah({top:this.env.model.getters.getRect(rs({col:0,row:e})).y-te-this.props.offset+"px","margin-right":"1px"})}unhide(e){this.env.model.dispatch("UNHIDE_COLUMNS_ROWS",{sheetId:this.sheetId,dimension:"ROW",elements:e})}isVisible(e){return e>=this.props.headerRange.start&&e<=this.props.headerRange.end}}class EN extends t.Component{static template="o-spreadsheet-UnhideColumnHeaders";static props={headersGroups:Array,headerRange:Object,offset:{type:Number,optional:!0}};static defaultProps={offset:0};get sheetId(){return this.env.model.getters.getActiveSheetId()}getUnhidePreviousButtonStyle(e){const t=this.env.model.getters.getRect(rs({col:e,row:0}));return Ah({left:t.x+t.width-oe-this.props.offset+"px"})}getUnhideNextButtonStyle(e){return Ah({left:this.env.model.getters.getRect(rs({col:e,row:0})).x-oe-this.props.offset+"px"})}unhide(e){this.env.model.dispatch("UNHIDE_COLUMNS_ROWS",{sheetId:this.sheetId,dimension:"COL",elements:e})}isVisible(e){return e>=this.props.headerRange.start&&e<=this.props.headerRange.end}}class RN extends t.Component{static props={onOpenContextMenu:Function};composerFocusStore;PADDING=0;MAX_SIZE_MARGIN=0;MIN_ELEMENT_SIZE=0;lastSelectedElementIndex=null;state=t.useState({resizerIsActive:!1,isResizing:!1,isMoving:!1,isSelecting:!1,waitingForMove:!1,activeElement:0,draggerLinePosition:0,draggerShadowPosition:0,draggerShadowThickness:0,delta:0,base:0,position:"before"});dragNDropGrid=KP(this.env);setup(){this.composerFocusStore=uh(wh)}_computeHandleDisplay(e){const t=this._getEvOffset(e),o=this._getElementIndex(t);if(o<0)return;const s=this._getDimensionsInViewport(o);t-s.start<this.PADDING&&o!==this._getViewportOffset()?(this.state.resizerIsActive=!0,this.state.draggerLinePosition=s.start,this.state.activeElement=this._getPreviousVisibleElement(o)):s.end-t<this.PADDING?(this.state.resizerIsActive=!0,this.state.draggerLinePosition=s.end,this.state.activeElement=o):this.state.resizerIsActive=!1}_computeGrabDisplay(e){const t=this._getElementIndex(this._getEvOffset(e)),o=this._getActiveElements(),s=this._getSelectedZoneStart(),i=this._getSelectedZoneEnd();o.has(s)&&s<=t&&t<=i?this.state.waitingForMove=!0:this.state.waitingForMove=!1}onMouseMove(e){this.state.isResizing||this.state.isMoving||this.state.isSelecting||(this._computeHandleDisplay(e),this._computeGrabDisplay(e))}onMouseLeave(){this.state.resizerIsActive=this.state.isResizing,this.state.waitingForMove=!1}onDblClick(e){this._fitElementSize(this.state.activeElement),this.state.isResizing=!1,this._computeHandleDisplay(e),this._computeGrabDisplay(e)}onMouseDown(e){this.state.isResizing=!0,this.state.delta=0;const t=this._getClientPosition(e),o=this.state.draggerLinePosition,s=this._getElementSize(this.state.activeElement),i=o-s+this.MIN_ELEMENT_SIZE,n=this._getMaxSize();LO((e=>{this.state.delta=this._getClientPosition(e)-t,this.state.draggerLinePosition=o+this.state.delta,this.state.draggerLinePosition<i&&(this.state.draggerLinePosition=i,this.state.delta=this.MIN_ELEMENT_SIZE-s),this.state.draggerLinePosition>n&&(this.state.draggerLinePosition=n,this.state.delta=n-o)}),(e=>{this.state.isResizing=!1,0!==this.state.delta&&this._updateSize()}))}select(e){if(e.button>0)return;const t=this._getElementIndex(this._getEvOffset(e));t<0||(this.state.waitingForMove?this.env.model.getters.isGridSelectionActive()?this.startMovement(e):this._selectElement(t,!1):("editing"===this.composerFocusStore.activeComposer.editionMode&&this.env.model.selection.getBackToDefault(),this.startSelection(e,t)))}startMovement(e){this.state.waitingForMove=!1,this.state.isMoving=!0;const t=this._getDimensionsInViewport(this._getSelectedZoneStart()),o=this._getDimensionsInViewport(this._getSelectedZoneEnd()),s=t.start;this.state.draggerLinePosition=s,this.state.base=this._getSelectedZoneStart(),this.state.draggerShadowPosition=s,this.state.draggerShadowThickness=o.end-t.start;this.dragNDropGrid.start(e,((e,o)=>{let s="COL"===this._getType()?e:o;if(s>=0){const e=this._getDimensionsInViewport(s);s<=this._getSelectedZoneStart()?(this.state.draggerLinePosition=e.start,this.state.draggerShadowPosition=e.start,this.state.base=s,this.state.position="before"):this._getSelectedZoneEnd()<s?(this.state.draggerLinePosition=e.end,this.state.draggerShadowPosition=e.end-this.state.draggerShadowThickness,this.state.base=s,this.state.position="after"):(this.state.draggerLinePosition=t.start,this.state.draggerShadowPosition=t.start,this.state.base=this._getSelectedZoneStart())}}),(()=>{this.state.isMoving=!1,this.state.base!==this._getSelectedZoneStart()&&this._moveElements(),this._computeGrabDisplay(e)}))}startSelection(e,t){this.state.isSelecting=!0,e.shiftKey?this._increaseSelection(t):this._selectElement(t,XI(e)),this.lastSelectedElementIndex=t;this.dragNDropGrid.start(e,((e,t)=>{let o="COL"===this._getType()?e:t;o!==this.lastSelectedElementIndex&&-1!==o&&(this._increaseSelection(o),this.lastSelectedElementIndex=o)}),(()=>{this.state.isSelecting=!1,this.lastSelectedElementIndex=null,this._computeGrabDisplay(e)}))}onMouseUp(e){this.lastSelectedElementIndex=null}onContextMenu(e){e.preventDefault();const t=this._getElementIndex(this._getEvOffset(e));if(t<0)return;this._getActiveElements().has(t)||this._selectElement(t,!1);const o=this._getType();this.props.onOpenContextMenu(o,e.clientX,e.clientY)}}Eh`
|
|
1679
|
+
`;class wN extends t.Component{static template="o-spreadsheet-GridOverlay";static props={onCellDoubleClicked:{type:Function,optional:!0},onCellClicked:{type:Function,optional:!0},onCellRightClicked:{type:Function,optional:!0},onGridResized:{type:Function,optional:!0},onFigureDeleted:{type:Function,optional:!0},onGridMoved:Function,gridOverlayDimensions:String,slots:{type:Object,optional:!0}};static components={FiguresContainer:pN,DataValidationOverlay:cN,GridAddRowsFooter:vN,FilterIconsOverlay:fN};static defaultProps={onCellDoubleClicked:()=>{},onCellClicked:()=>{},onCellRightClicked:()=>{},onGridResized:()=>{},onFigureDeleted:()=>{}};gridOverlay=t.useRef("gridOverlay");gridOverlayRect=GT(this.gridOverlay);cellPopovers;paintFormatStore;setup(){CN(this.env,this.gridOverlay);const e=new ResizeObserver((()=>{const e=this.gridOverlayEl.getBoundingClientRect();this.props.onGridResized({x:e.left,y:e.top,height:this.gridOverlayEl.clientHeight,width:this.gridOverlayEl.clientWidth})}));t.onMounted((()=>{e.observe(this.gridOverlayEl)})),t.onWillUnmount((()=>{e.disconnect()})),this.cellPopovers=uh(UT),this.paintFormatStore=uh(SN)}get gridOverlayEl(){if(!this.gridOverlay.el)throw new Error("GridOverlay el is not defined.");return this.gridOverlay.el}get style(){return this.props.gridOverlayDimensions}get isPaintingFormat(){return this.paintFormatStore.isActive}onMouseDown(e){if(e.button>0)return;e.target===this.gridOverlay.el&&this.cellPopovers.isOpen&&this.cellPopovers.close();const[t,o]=this.getCartesianCoordinates(e);this.props.onCellClicked(t,o,{expandZone:e.shiftKey,addZone:XI(e)},e)}onDoubleClick(e){const[t,o]=this.getCartesianCoordinates(e);this.props.onCellDoubleClicked(t,o)}onContextMenu(e){const[t,o]=this.getCartesianCoordinates(e);this.props.onCellRightClicked(t,o,{x:e.clientX,y:e.clientY})}getCartesianCoordinates(e){const t=e.clientX-this.gridOverlayRect.x,o=e.clientY-this.gridOverlayRect.y;return[this.env.model.getters.getColIndex(t),this.env.model.getters.getRowIndex(o)]}}class IN extends t.Component{static template="o-spreadsheet-GridPopover";static props={onClosePopover:Function,onMouseWheel:Function,gridRect:Object};static components={Popover:WT};cellPopovers;zIndex=Fe.GridPopover;setup(){this.cellPopovers=uh(UT)}get cellPopover(){const e=this.cellPopovers.cellPopover;if(!e.isOpen)return{isOpen:!1};const t=e.anchorRect;return{...e,anchorRect:{...t,x:t.x+this.props.gridRect.x,y:t.y+this.props.gridRect.y}}}}class xN extends t.Component{static template="o-spreadsheet-UnhideRowHeaders";static props={headersGroups:Array,headerRange:Object,offset:{type:Number,optional:!0}};static defaultProps={offset:0};get sheetId(){return this.env.model.getters.getActiveSheetId()}getUnhidePreviousButtonStyle(e){const t=this.env.model.getters.getRect(rs({col:0,row:e}));return Ah({top:t.y+t.height-te-this.props.offset+"px","margin-right":"1px"})}getUnhideNextButtonStyle(e){return Ah({top:this.env.model.getters.getRect(rs({col:0,row:e})).y-te-this.props.offset+"px","margin-right":"1px"})}unhide(e){this.env.model.dispatch("UNHIDE_COLUMNS_ROWS",{sheetId:this.sheetId,dimension:"ROW",elements:e})}isVisible(e){return e>=this.props.headerRange.start&&e<=this.props.headerRange.end}}class EN extends t.Component{static template="o-spreadsheet-UnhideColumnHeaders";static props={headersGroups:Array,headerRange:Object,offset:{type:Number,optional:!0}};static defaultProps={offset:0};get sheetId(){return this.env.model.getters.getActiveSheetId()}getUnhidePreviousButtonStyle(e){const t=this.env.model.getters.getRect(rs({col:e,row:0}));return Ah({left:t.x+t.width-oe-this.props.offset+"px"})}getUnhideNextButtonStyle(e){return Ah({left:this.env.model.getters.getRect(rs({col:e,row:0})).x-oe-this.props.offset+"px"})}unhide(e){this.env.model.dispatch("UNHIDE_COLUMNS_ROWS",{sheetId:this.sheetId,dimension:"COL",elements:e})}isVisible(e){return e>=this.props.headerRange.start&&e<=this.props.headerRange.end}}class RN extends t.Component{static props={onOpenContextMenu:Function};composerFocusStore;PADDING=0;MAX_SIZE_MARGIN=0;MIN_ELEMENT_SIZE=0;lastSelectedElementIndex=null;state=t.useState({resizerIsActive:!1,isResizing:!1,isMoving:!1,isSelecting:!1,waitingForMove:!1,activeElement:0,draggerLinePosition:0,draggerShadowPosition:0,draggerShadowThickness:0,delta:0,base:0,position:"before"});dragNDropGrid=KP(this.env);setup(){this.composerFocusStore=uh(wh)}_computeHandleDisplay(e){const t=this._getEvOffset(e),o=this._getElementIndex(t);if(o<0)return;const s=this._getDimensionsInViewport(o);t-s.start<this.PADDING&&o!==this._getViewportOffset()?(this.state.resizerIsActive=!0,this.state.draggerLinePosition=s.start,this.state.activeElement=this._getPreviousVisibleElement(o)):s.end-t<this.PADDING?(this.state.resizerIsActive=!0,this.state.draggerLinePosition=s.end,this.state.activeElement=o):this.state.resizerIsActive=!1}_computeGrabDisplay(e){const t=this._getElementIndex(this._getEvOffset(e)),o=this._getActiveElements(),s=this._getSelectedZoneStart(),i=this._getSelectedZoneEnd();o.has(s)&&s<=t&&t<=i?this.state.waitingForMove=!0:this.state.waitingForMove=!1}onMouseMove(e){this.env.model.getters.isReadonly()||this.state.isResizing||this.state.isMoving||this.state.isSelecting||(this._computeHandleDisplay(e),this._computeGrabDisplay(e))}onMouseLeave(){this.state.resizerIsActive=this.state.isResizing,this.state.waitingForMove=!1}onDblClick(e){this._fitElementSize(this.state.activeElement),this.state.isResizing=!1,this._computeHandleDisplay(e),this._computeGrabDisplay(e)}onMouseDown(e){this.state.isResizing=!0,this.state.delta=0;const t=this._getClientPosition(e),o=this.state.draggerLinePosition,s=this._getElementSize(this.state.activeElement),i=o-s+this.MIN_ELEMENT_SIZE,n=this._getMaxSize();LO((e=>{this.state.delta=this._getClientPosition(e)-t,this.state.draggerLinePosition=o+this.state.delta,this.state.draggerLinePosition<i&&(this.state.draggerLinePosition=i,this.state.delta=this.MIN_ELEMENT_SIZE-s),this.state.draggerLinePosition>n&&(this.state.draggerLinePosition=n,this.state.delta=n-o)}),(e=>{this.state.isResizing=!1,0!==this.state.delta&&this._updateSize()}))}select(e){if(e.button>0)return;const t=this._getElementIndex(this._getEvOffset(e));t<0||(this.env.model.getters.isReadonly()?this._selectElement(t,!1):this.state.waitingForMove?this.env.model.getters.isGridSelectionActive()?this.startMovement(e):this._selectElement(t,!1):("editing"===this.composerFocusStore.activeComposer.editionMode&&this.env.model.selection.getBackToDefault(),this.startSelection(e,t)))}startMovement(e){this.state.waitingForMove=!1,this.state.isMoving=!0;const t=this._getDimensionsInViewport(this._getSelectedZoneStart()),o=this._getDimensionsInViewport(this._getSelectedZoneEnd()),s=t.start;this.state.draggerLinePosition=s,this.state.base=this._getSelectedZoneStart(),this.state.draggerShadowPosition=s,this.state.draggerShadowThickness=o.end-t.start;this.dragNDropGrid.start(e,((e,o)=>{let s="COL"===this._getType()?e:o;if(s>=0){const e=this._getDimensionsInViewport(s);s<=this._getSelectedZoneStart()?(this.state.draggerLinePosition=e.start,this.state.draggerShadowPosition=e.start,this.state.base=s,this.state.position="before"):this._getSelectedZoneEnd()<s?(this.state.draggerLinePosition=e.end,this.state.draggerShadowPosition=e.end-this.state.draggerShadowThickness,this.state.base=s,this.state.position="after"):(this.state.draggerLinePosition=t.start,this.state.draggerShadowPosition=t.start,this.state.base=this._getSelectedZoneStart())}}),(()=>{this.state.isMoving=!1,this.state.base!==this._getSelectedZoneStart()&&this._moveElements(),this._computeGrabDisplay(e)}))}startSelection(e,t){this.state.isSelecting=!0,e.shiftKey?this._increaseSelection(t):this._selectElement(t,XI(e)),this.lastSelectedElementIndex=t;this.dragNDropGrid.start(e,((e,t)=>{let o="COL"===this._getType()?e:t;o!==this.lastSelectedElementIndex&&-1!==o&&(this._increaseSelection(o),this.lastSelectedElementIndex=o)}),(()=>{this.state.isSelecting=!1,this.lastSelectedElementIndex=null,this._computeGrabDisplay(e)}))}onMouseUp(e){this.lastSelectedElementIndex=null}onContextMenu(e){e.preventDefault();const t=this._getElementIndex(this._getEvOffset(e));if(t<0)return;this._getActiveElements().has(t)||this._selectElement(t,!1);const o=this._getType();this.props.onOpenContextMenu(o,e.clientX,e.clientY)}}Eh`
|
|
1680
1680
|
.o-col-resizer {
|
|
1681
1681
|
position: absolute;
|
|
1682
1682
|
top: 0;
|
|
@@ -1865,7 +1865,7 @@
|
|
|
1865
1865
|
offset="offset"
|
|
1866
1866
|
direction="'vertical'"
|
|
1867
1867
|
onScroll.bind="onScroll"
|
|
1868
|
-
/>`;static defaultProps={topOffset:0};get offset(){return this.env.model.getters.getActiveSheetScrollInfo().scrollY}get height(){return this.env.model.getters.getMainViewportRect().height}get isDisplayed(){const{yRatio:e}=this.env.model.getters.getFrozenSheetViewRatio(this.env.model.getters.getActiveSheetId());return e<1}get position(){const{y:e}=this.env.model.getters.getMainViewportRect();return{top:`${this.props.topOffset+e}px`,right:"0px",width:"15px",bottom:QI()?"15px":"0"}}onScroll(e){const{scrollX:t}=this.env.model.getters.getActiveSheetScrollInfo();this.env.model.dispatch("SET_VIEWPORT_OFFSET",{offsetX:t,offsetY:e})}}const UN=350;class BN extends yh{mutators=["open","toggle","close","changePanelSize","resetPanelSize"];
|
|
1868
|
+
/>`;static defaultProps={topOffset:0};get offset(){return this.env.model.getters.getActiveSheetScrollInfo().scrollY}get height(){return this.env.model.getters.getMainViewportRect().height}get isDisplayed(){const{yRatio:e}=this.env.model.getters.getFrozenSheetViewRatio(this.env.model.getters.getActiveSheetId());return e<1}get position(){const{y:e}=this.env.model.getters.getMainViewportRect();return{top:`${this.props.topOffset+e}px`,right:"0px",width:"15px",bottom:QI()?"15px":"0"}}onScroll(e){const{scrollX:t}=this.env.model.getters.getActiveSheetScrollInfo();this.env.model.dispatch("SET_VIEWPORT_OFFSET",{offsetX:t,offsetY:e})}}const UN=350;class BN extends yh{mutators=["open","toggle","close","changePanelSize","resetPanelSize"];currentPanelProps={};componentTag="";panelSize=UN;get isOpen(){return!!this.componentTag&&this.computeState(this.componentTag,this.currentPanelProps).isOpen}get panelProps(){const e=this.computeState(this.componentTag,this.currentPanelProps);return e.isOpen?e.props??{}:{}}get panelKey(){const e=this.computeState(this.componentTag,this.currentPanelProps);if(e.isOpen)return e.key}open(e,t={}){const o=this.computeState(e,t);o.isOpen&&(this.isOpen&&e!==this.componentTag&&this.currentPanelProps?.onCloseSidePanel?.(),this.componentTag=e,this.currentPanelProps=o.props??{})}toggle(e,t){this.isOpen&&e===this.componentTag?this.close():this.open(e,t)}close(){this.currentPanelProps.onCloseSidePanel?.(),this.currentPanelProps={},this.componentTag=""}changePanelSize(e,t){this.panelSize=e<UN?UN:e>t-150?Math.max(t-150,UN):e}resetPanelSize(){this.panelSize=UN}computeState(e,t){const o=zP.get(e).computeState;if(o){const e=o(this.getters,t);return e.isOpen&&(this.currentPanelProps=e.props??this.currentPanelProps),e}return{isOpen:!0,props:t}}}const zN="#777";Eh`
|
|
1869
1869
|
.o-table-resizer {
|
|
1870
1870
|
width: ${6}px;
|
|
1871
1871
|
height: ${6}px;
|
|
@@ -2507,7 +2507,7 @@
|
|
|
2507
2507
|
border-radius: 4px;
|
|
2508
2508
|
font-weight: 500;
|
|
2509
2509
|
font-size: 14px;
|
|
2510
|
-
height: 32px;
|
|
2510
|
+
min-height: 32px;
|
|
2511
2511
|
line-height: 16px;
|
|
2512
2512
|
flex-grow: 1;
|
|
2513
2513
|
background-color: ${L};
|
|
@@ -3313,4 +3313,4 @@
|
|
|
3313
3313
|
<tableParts count="${e.tables.length}">
|
|
3314
3314
|
${fx(a)}
|
|
3315
3315
|
</tableParts>
|
|
3316
|
-
`}var CH;!function(e){e[e.Ready=0]="Ready",e[e.Running=1]="Running",e[e.RunningCore=2]="RunningCore",e[e.Finalizing=3]="Finalizing"}(CH||(CH={}));function wH(e,t={}){const o=ze(t);return o.type=e,o}const IH={},xH={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},EH={autoCompleteProviders:Ly,autofillModifiersRegistry:tC,autofillRulesRegistry:oC,cellMenuRegistry:$D,colMenuRegistry:DO,errorTypes:Ai,linkMenuRegistry:uA,functionRegistry:tS,featurePluginRegistry:RV,iconsOnCellRegistry:jx,statefulUIPluginRegistry:TV,coreViewsPluginRegistry:AV,corePluginRegistry:EV,rowMenuRegistry:MO,sidePanelRegistry:zP,figureRegistry:yx,chartSidePanelComponentRegistry:oM,chartComponentRegistry:MI,chartRegistry:FI,chartSubtypeRegistry:NI,topbarMenuRegistry:NO,topbarComponentRegistry:$P,clickableCellRegistry:DV,otRegistry:kO,inverseCommandRegistry:xx,urlRegistry:Tn,cellPopoverRegistry:cC,numberFormatMenuRegistry:_O,repeatLocalCommandTransformRegistry:SV,repeatCommandTransformRegistry:bV,clipboardHandlersRegistries:ih,pivotRegistry:pP,pivotTimeAdapterRegistry:yc,pivotSidePanelRegistry:bP,pivotNormalizationValueRegistry:Kc,supportedPivotPositionalFormulaRegistry:eC,pivotToFunctionValueRegistry:Jc,migrationStepRegistry:wT,chartJsExtensionRegistry:Dh},RH={arg:Vh,isEvaluationError:Hi,toBoolean:Qi,toJsDate:en,toNumber:zi,toString:Xi,toNormalizedPivotValue:Zc,toFunctionPivotValue:Yc,toXC:Oo,toZone:Ho,toUnboundedZone:Lo,toCartesian:_o,numberToLetters:yo,lettersToNumber:Co,UuidGenerator:Ga,formatValue:sr,createCurrencyFormat:vr,ColorGenerator:mo,computeTextWidth:_a,createEmptyWorkbookData:MT,createEmptySheet:FT,createEmptyExcelSheet:PT,rgbaToHex:Xt,colorToRGBA:Kt,positionToZone:rs,isDefined:lt,isMatrix:Ii,lazy:gt,genericRepeat:yV,createAction:i,createActions:o,transformRangeData:rh,deepEquals:ft,overlap:Xo,union:Zo,isInside:Ko,deepCopy:ze,expandZoneOnInsertion:$o,reduceZoneOnDeletion:qo,unquote:Ge,getMaxObjectId:Hc,getFunctionsFromTokens:SS,getFirstPivotFunction:Jy,getNumberOfPivotFunctions:Qy,parseDimension:zc,isDateOrDatetimeField:$c,makeFieldProposal:jy,insertTokenAfterArgSeparator:Yy,insertTokenAfterLeftParenthesis:Xy,mergeContiguousZones:us,getPivotHighlights:PO,pivotTimeAdapter:Cc,UNDO_REDO_PIVOT_COMMANDS:zk,createPivotFormula:qc,areDomainArgsFieldsValid:Wc,splitReference:Jr,sanitizeSheetName:qe,getUniqueText:Lt,isNumber:Xs,isDateTime:Ms},TH={isMarkdownLink:et,parseMarkdownLink:st,markdownLink:ot,openLink:Fn,urlRepresentation:On},AH={Checkbox:KT,Section:VO,RoundColorPicker:pF,ChartDataSeries:YO,ChartErrorSection:KO,ChartLabelRange:JO,ChartTitle:dF,ChartPanel:nM,ChartFigure:VI,ChartJsComponent:wy,Grid:WN,GridOverlay:wN,ScorecardChart:Vy,LineConfigPanel:GF,BarConfigPanel:eF,PieChartDesignPanel:WF,GenericChartConfigPanel:QO,ChartWithAxisDesignPanel:SF,GaugeChartConfigPanel:wF,GaugeChartDesignPanel:LF,ScorecardChartConfigPanel:ZF,ScorecardChartDesignPanel:jF,GeoChartDesignPanel:zF,RadarChartDesignPanel:qF,WaterfallChartDesignPanel:tM,ComboChartDesignPanel:yF,FunnelChartDesignPanel:CF,ChartTypePicker:sM,FigureComponent:GP,Menu:gA,Popover:WT,SelectionInput:jO,ValidationMessages:XO,AddDimensionButton:$M,PivotDimensionGranularity:ZM,PivotDimensionOrder:jM,PivotDimension:qM,PivotLayoutConfigurator:KM,PivotHTMLRenderer:qN,PivotDeferUpdate:BM,PivotTitleSection:JM,CogWheelMenu:WM,TextInput:GM,SidePanelCollapsible:oF,RadioSelection:gF,GeoChartRegionSelectSection:HF},DH={useDragAndDropListItems:HO,useHighlights:cM,useHighlightsOnHover:lM},_H={useStoreProvider:dh,DependencyContainer:lh,CellPopoverStore:UT,ComposerFocusStore:wh,CellComposerStore:sN,FindAndReplaceStore:NM,HighlightStore:By,DelayedHoveredCellStore:HT,HoveredTableStore:yN,ModelStore:vh,NotificationStore:zy,RendererStore:Sh,SelectionInputStore:ZO,SpreadsheetStore:yh,useStore:uh,useLocalStore:gh,SidePanelStore:BN,PivotSidePanelStore:fP,PivotMeasureDisplayPanelStore:HM};const OH={DEFAULT_LOCALE:Ci,HIGHLIGHT_COLOR:a,PIVOT_TABLE_CONFIG:Ve,ChartTerms:FC},FH={...nx,...rI};e.AbstractCellClipboardHandler=Qa,e.AbstractChart=Iy,e.AbstractFigureClipboardHandler=sh,e.CellErrorType=Ti,e.CorePlugin=jN,e.CoreViewPlugin=ok,e.DispatchResult=vi,e.EvaluationError=Di,e.Model=class extends ah{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 Ga,n=!1){const r=performance.now();console.debug("##### Model creation #####"),super(),oi===ei&&si===ti&&(si=()=>!0),s=_T(e,s);const a=TT(e,n);this.state=new CL,this.uuidGenerator=i,this.config=this.setupConfig(o),this.session=this.setupSession(a.revisionId),this.coreGetters={},this.range=new ek(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 SL(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 EV.getAll())this.setupCorePlugin(e,a);Object.assign(this.getters,this.coreGetters),this.session.loadInitialMessages(s);for(let e of AV.getAll()){const t=this.setupCoreViewPlugin(e);this.handlers.push(t),this.uiHandlers.push(t),this.coreHandlers.push(t)}for(let e of TV.getAll()){const t=this.setupUiPlugin(e);this.statefulUIPlugins.push(t),this.handlers.push(t),this.uiHandlers.push(t)}for(let e of RV.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 rV(fL({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 lL;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(wH(e,t));dispatch=(e,t)=>{const o=wH(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=wH(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 jN||s.beforeHandle(t);for(const s of e)!o&&s instanceof jN||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=MT();for(let t of this.handlers)t instanceof jN&&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={...MT(),sheets:[PT(RT,"Sheet1")]};for(let t of this.handlers)t instanceof ZN&&t.exportForExcel(e);return e=ze(e),SH(e)}garbageCollectExternalResources(){for(const e of this.corePlugins)e.garbageCollectExternalResources()}},e.PivotRuntimeDefinition=QM,e.Registry=n,e.Revision=iV,e.SPREADSHEET_DIMENSIONS=xH,e.Spreadsheet=aL,e.SpreadsheetPivotTable=oP,e.UIPlugin=Gk,e.__info__=IH,e.addFunction=function e(t,o){return tS.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=$f,e.chartHelpers=FH,e.compile=pS,e.compileTokens=mS,e.components=AH,e.constants=OH,e.convertAstNodes=Hf,e.coreTypes=mi,e.findCellInNewZone=ns,e.functionCache=gS,e.helpers=RH,e.hooks=DH,e.invalidateCFEvaluationCommands=ui,e.invalidateChartEvaluationCommands=hi,e.invalidateDependenciesCommands=di,e.invalidateEvaluationCommands=ci,e.iterateAstNodes=Uf,e.links=TH,e.load=TT,e.parse=Vf,e.parseTokens=Lf,e.readonlyAllowedCommands=pi,e.registries=EH,e.setDefaultSheetViewSize=function(e){Me=e},e.setTranslationMethod=function(e,t=(()=>!0)){oi=e,si=t},e.stores=_H,e.tokenColors=Wy,e.tokenize=ol,IH.version="18.3.26",IH.date="2025-11-12T14:15:33.133Z",IH.hash="f31a752"}(this.o_spreadsheet=this.o_spreadsheet||{},owl);
|
|
3316
|
+
`}var CH;!function(e){e[e.Ready=0]="Ready",e[e.Running=1]="Running",e[e.RunningCore=2]="RunningCore",e[e.Finalizing=3]="Finalizing"}(CH||(CH={}));function wH(e,t={}){const o=ze(t);return o.type=e,o}const IH={},xH={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},EH={autoCompleteProviders:Ly,autofillModifiersRegistry:tC,autofillRulesRegistry:oC,cellMenuRegistry:$D,colMenuRegistry:DO,errorTypes:Ai,linkMenuRegistry:uA,functionRegistry:tS,featurePluginRegistry:RV,iconsOnCellRegistry:jx,statefulUIPluginRegistry:TV,coreViewsPluginRegistry:AV,corePluginRegistry:EV,rowMenuRegistry:MO,sidePanelRegistry:zP,figureRegistry:yx,chartSidePanelComponentRegistry:oM,chartComponentRegistry:MI,chartRegistry:FI,chartSubtypeRegistry:NI,topbarMenuRegistry:NO,topbarComponentRegistry:$P,clickableCellRegistry:DV,otRegistry:kO,inverseCommandRegistry:xx,urlRegistry:Tn,cellPopoverRegistry:cC,numberFormatMenuRegistry:_O,repeatLocalCommandTransformRegistry:SV,repeatCommandTransformRegistry:bV,clipboardHandlersRegistries:ih,pivotRegistry:pP,pivotTimeAdapterRegistry:yc,pivotSidePanelRegistry:bP,pivotNormalizationValueRegistry:Kc,supportedPivotPositionalFormulaRegistry:eC,pivotToFunctionValueRegistry:Jc,migrationStepRegistry:wT,chartJsExtensionRegistry:Dh},RH={arg:Vh,isEvaluationError:Hi,toBoolean:Qi,toJsDate:en,toNumber:zi,toString:Xi,toNormalizedPivotValue:Zc,toFunctionPivotValue:Yc,toXC:Oo,toZone:Ho,toUnboundedZone:Lo,toCartesian:_o,numberToLetters:yo,lettersToNumber:Co,UuidGenerator:Ga,formatValue:sr,createCurrencyFormat:vr,ColorGenerator:mo,computeTextWidth:_a,createEmptyWorkbookData:MT,createEmptySheet:FT,createEmptyExcelSheet:PT,rgbaToHex:Xt,colorToRGBA:Kt,positionToZone:rs,isDefined:lt,isMatrix:Ii,lazy:gt,genericRepeat:yV,createAction:i,createActions:o,transformRangeData:rh,deepEquals:ft,overlap:Xo,union:Zo,isInside:Ko,deepCopy:ze,expandZoneOnInsertion:$o,reduceZoneOnDeletion:qo,unquote:Ge,getMaxObjectId:Hc,getFunctionsFromTokens:SS,getFirstPivotFunction:Jy,getNumberOfPivotFunctions:Qy,parseDimension:zc,isDateOrDatetimeField:$c,makeFieldProposal:jy,insertTokenAfterArgSeparator:Yy,insertTokenAfterLeftParenthesis:Xy,mergeContiguousZones:us,getPivotHighlights:PO,pivotTimeAdapter:Cc,UNDO_REDO_PIVOT_COMMANDS:zk,createPivotFormula:qc,areDomainArgsFieldsValid:Wc,splitReference:Jr,sanitizeSheetName:qe,getUniqueText:Lt,isNumber:Xs,isDateTime:Ms},TH={isMarkdownLink:et,parseMarkdownLink:st,markdownLink:ot,openLink:Fn,urlRepresentation:On},AH={Checkbox:KT,Section:VO,RoundColorPicker:pF,ChartDataSeries:YO,ChartErrorSection:KO,ChartLabelRange:JO,ChartTitle:dF,ChartPanel:nM,ChartFigure:VI,ChartJsComponent:wy,Grid:WN,GridOverlay:wN,ScorecardChart:Vy,LineConfigPanel:GF,BarConfigPanel:eF,PieChartDesignPanel:WF,GenericChartConfigPanel:QO,ChartWithAxisDesignPanel:SF,GaugeChartConfigPanel:wF,GaugeChartDesignPanel:LF,ScorecardChartConfigPanel:ZF,ScorecardChartDesignPanel:jF,GeoChartDesignPanel:zF,RadarChartDesignPanel:qF,WaterfallChartDesignPanel:tM,ComboChartDesignPanel:yF,FunnelChartDesignPanel:CF,ChartTypePicker:sM,FigureComponent:GP,Menu:gA,Popover:WT,SelectionInput:jO,ValidationMessages:XO,AddDimensionButton:$M,PivotDimensionGranularity:ZM,PivotDimensionOrder:jM,PivotDimension:qM,PivotLayoutConfigurator:KM,PivotHTMLRenderer:qN,PivotDeferUpdate:BM,PivotTitleSection:JM,CogWheelMenu:WM,TextInput:GM,SidePanelCollapsible:oF,RadioSelection:gF,GeoChartRegionSelectSection:HF},DH={useDragAndDropListItems:HO,useHighlights:cM,useHighlightsOnHover:lM},_H={useStoreProvider:dh,DependencyContainer:lh,CellPopoverStore:UT,ComposerFocusStore:wh,CellComposerStore:sN,FindAndReplaceStore:NM,HighlightStore:By,DelayedHoveredCellStore:HT,HoveredTableStore:yN,ModelStore:vh,NotificationStore:zy,RendererStore:Sh,SelectionInputStore:ZO,SpreadsheetStore:yh,useStore:uh,useLocalStore:gh,SidePanelStore:BN,PivotSidePanelStore:fP,PivotMeasureDisplayPanelStore:HM};const OH={DEFAULT_LOCALE:Ci,HIGHLIGHT_COLOR:a,PIVOT_TABLE_CONFIG:Ve,ChartTerms:FC},FH={...nx,...rI};e.AbstractCellClipboardHandler=Qa,e.AbstractChart=Iy,e.AbstractFigureClipboardHandler=sh,e.CellErrorType=Ti,e.CorePlugin=jN,e.CoreViewPlugin=ok,e.DispatchResult=vi,e.EvaluationError=Di,e.Model=class extends ah{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 Ga,n=!1){const r=performance.now();console.debug("##### Model creation #####"),super(),oi===ei&&si===ti&&(si=()=>!0),s=_T(e,s);const a=TT(e,n);this.state=new CL,this.uuidGenerator=i,this.config=this.setupConfig(o),this.session=this.setupSession(a.revisionId),this.coreGetters={},this.range=new ek(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 SL(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 EV.getAll())this.setupCorePlugin(e,a);Object.assign(this.getters,this.coreGetters),this.session.loadInitialMessages(s);for(let e of AV.getAll()){const t=this.setupCoreViewPlugin(e);this.handlers.push(t),this.uiHandlers.push(t),this.coreHandlers.push(t)}for(let e of TV.getAll()){const t=this.setupUiPlugin(e);this.statefulUIPlugins.push(t),this.handlers.push(t),this.uiHandlers.push(t)}for(let e of RV.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 rV(fL({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 lL;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(wH(e,t));dispatch=(e,t)=>{const o=wH(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=wH(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 jN||s.beforeHandle(t);for(const s of e)!o&&s instanceof jN||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=MT();for(let t of this.handlers)t instanceof jN&&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={...MT(),sheets:[PT(RT,"Sheet1")]};for(let t of this.handlers)t instanceof ZN&&t.exportForExcel(e);return e=ze(e),SH(e)}garbageCollectExternalResources(){for(const e of this.corePlugins)e.garbageCollectExternalResources()}},e.PivotRuntimeDefinition=QM,e.Registry=n,e.Revision=iV,e.SPREADSHEET_DIMENSIONS=xH,e.Spreadsheet=aL,e.SpreadsheetPivotTable=oP,e.UIPlugin=Gk,e.__info__=IH,e.addFunction=function e(t,o){return tS.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=$f,e.chartHelpers=FH,e.compile=pS,e.compileTokens=mS,e.components=AH,e.constants=OH,e.convertAstNodes=Hf,e.coreTypes=mi,e.findCellInNewZone=ns,e.functionCache=gS,e.helpers=RH,e.hooks=DH,e.invalidateCFEvaluationCommands=ui,e.invalidateChartEvaluationCommands=hi,e.invalidateDependenciesCommands=di,e.invalidateEvaluationCommands=ci,e.iterateAstNodes=Uf,e.links=TH,e.load=TT,e.parse=Vf,e.parseTokens=Lf,e.readonlyAllowedCommands=pi,e.registries=EH,e.setDefaultSheetViewSize=function(e){Me=e},e.setTranslationMethod=function(e,t=(()=>!0)){oi=e,si=t},e.stores=_H,e.tokenColors=Wy,e.tokenize=ol,IH.version="18.3.27",IH.date="2025-11-24T07:40:29.469Z",IH.hash="57b11b8"}(this.o_spreadsheet=this.o_spreadsheet||{},owl);
|