@odoo/o-spreadsheet 18.0.48 → 18.0.49

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -2,9 +2,9 @@
2
2
  /**
3
3
  * This file is generated by o-spreadsheet build tools. Do not edit it.
4
4
  * @see https://github.com/odoo/o-spreadsheet
5
- * @version 18.0.48
6
- * @date 2025-11-12T14:15:38.406Z
7
- * @hash d1efb0b
5
+ * @version 18.0.49
6
+ * @date 2025-11-24T07:40:04.646Z
7
+ * @hash b4ef5b7
8
8
  */
9
9
 
10
10
  'use strict';
@@ -28373,7 +28373,6 @@ class Composer extends owl.Component {
28373
28373
  return;
28374
28374
  }
28375
28375
  const newSelection = this.contentHelper.getCurrentSelection();
28376
- this.props.composerStore.stopComposerRangeSelection();
28377
28376
  this.props.onComposerContentFocused();
28378
28377
  this.props.composerStore.changeComposerCursorSelection(newSelection.start, newSelection.end);
28379
28378
  this.processTokenAtCursor();
@@ -28656,7 +28655,6 @@ function insertTokenAfterArgSeparator(tokenAtCursor, value) {
28656
28655
  // replace the whole token
28657
28656
  start = tokenAtCursor.start;
28658
28657
  }
28659
- this.composer.stopComposerRangeSelection();
28660
28658
  this.composer.changeComposerCursorSelection(start, end);
28661
28659
  this.composer.replaceComposerCursorSelection(value);
28662
28660
  }
@@ -28674,7 +28672,6 @@ function insertTokenAfterLeftParenthesis(tokenAtCursor, value) {
28674
28672
  // replace the whole token
28675
28673
  start = tokenAtCursor.start;
28676
28674
  }
28677
- this.composer.stopComposerRangeSelection();
28678
28675
  this.composer.changeComposerCursorSelection(start, end);
28679
28676
  this.composer.replaceComposerCursorSelection(value);
28680
28677
  }
@@ -39383,6 +39380,7 @@ class AbstractComposerStore extends SpreadsheetStore {
39383
39380
  }
39384
39381
  this.selectionStart = start;
39385
39382
  this.selectionEnd = end;
39383
+ this.editionMode = "editing";
39386
39384
  }
39387
39385
  stopComposerRangeSelection() {
39388
39386
  if (this.isSelectingRange) {
@@ -48768,7 +48766,10 @@ class AbstractResizer extends owl.Component {
48768
48766
  this.state.waitingForMove = false;
48769
48767
  }
48770
48768
  onMouseMove(ev) {
48771
- if (this.state.isResizing || this.state.isMoving || this.state.isSelecting) {
48769
+ if (this.env.model.getters.isReadonly() ||
48770
+ this.state.isResizing ||
48771
+ this.state.isMoving ||
48772
+ this.state.isSelecting) {
48772
48773
  return;
48773
48774
  }
48774
48775
  this._computeHandleDisplay(ev);
@@ -48821,6 +48822,10 @@ class AbstractResizer extends owl.Component {
48821
48822
  if (index < 0) {
48822
48823
  return;
48823
48824
  }
48825
+ if (this.env.model.getters.isReadonly()) {
48826
+ this._selectElement(index, false);
48827
+ return;
48828
+ }
48824
48829
  if (this.state.waitingForMove === true) {
48825
48830
  if (!this.env.model.getters.isGridSelectionActive()) {
48826
48831
  this._selectElement(index, false);
@@ -50463,24 +50468,24 @@ const DEFAULT_SIDE_PANEL_SIZE = 350;
50463
50468
  const MIN_SHEET_VIEW_WIDTH = 150;
50464
50469
  class SidePanelStore extends SpreadsheetStore {
50465
50470
  mutators = ["open", "toggle", "close", "changePanelSize", "resetPanelSize"];
50466
- initialPanelProps = {};
50471
+ currentPanelProps = {};
50467
50472
  componentTag = "";
50468
50473
  panelSize = DEFAULT_SIDE_PANEL_SIZE;
50469
50474
  get isOpen() {
50470
50475
  if (!this.componentTag) {
50471
50476
  return false;
50472
50477
  }
50473
- return this.computeState(this.componentTag, this.initialPanelProps).isOpen;
50478
+ return this.computeState(this.componentTag, this.currentPanelProps).isOpen;
50474
50479
  }
50475
50480
  get panelProps() {
50476
- const state = this.computeState(this.componentTag, this.initialPanelProps);
50481
+ const state = this.computeState(this.componentTag, this.currentPanelProps);
50477
50482
  if (state.isOpen) {
50478
50483
  return state.props ?? {};
50479
50484
  }
50480
50485
  return {};
50481
50486
  }
50482
50487
  get panelKey() {
50483
- const state = this.computeState(this.componentTag, this.initialPanelProps);
50488
+ const state = this.computeState(this.componentTag, this.currentPanelProps);
50484
50489
  if (state.isOpen) {
50485
50490
  return state.key;
50486
50491
  }
@@ -50492,10 +50497,10 @@ class SidePanelStore extends SpreadsheetStore {
50492
50497
  return;
50493
50498
  }
50494
50499
  if (this.isOpen && componentTag !== this.componentTag) {
50495
- this.initialPanelProps?.onCloseSidePanel?.();
50500
+ this.currentPanelProps?.onCloseSidePanel?.();
50496
50501
  }
50497
50502
  this.componentTag = componentTag;
50498
- this.initialPanelProps = state.props ?? {};
50503
+ this.currentPanelProps = state.props ?? {};
50499
50504
  }
50500
50505
  toggle(componentTag, panelProps) {
50501
50506
  if (this.isOpen && componentTag === this.componentTag) {
@@ -50506,8 +50511,8 @@ class SidePanelStore extends SpreadsheetStore {
50506
50511
  }
50507
50512
  }
50508
50513
  close() {
50509
- this.initialPanelProps.onCloseSidePanel?.();
50510
- this.initialPanelProps = {};
50514
+ this.currentPanelProps.onCloseSidePanel?.();
50515
+ this.currentPanelProps = {};
50511
50516
  this.componentTag = "";
50512
50517
  }
50513
50518
  changePanelSize(size, spreadsheetElWidth) {
@@ -50533,7 +50538,11 @@ class SidePanelStore extends SpreadsheetStore {
50533
50538
  };
50534
50539
  }
50535
50540
  else {
50536
- return customComputeState(this.getters, panelProps);
50541
+ const state = customComputeState(this.getters, panelProps);
50542
+ if (state.isOpen) {
50543
+ this.currentPanelProps = state.props ?? this.currentPanelProps;
50544
+ }
50545
+ return state;
50537
50546
  }
50538
50547
  }
50539
50548
  }
@@ -74763,6 +74772,6 @@ exports.tokenColors = tokenColors;
74763
74772
  exports.tokenize = tokenize;
74764
74773
 
74765
74774
 
74766
- __info__.version = "18.0.48";
74767
- __info__.date = "2025-11-12T14:15:38.406Z";
74768
- __info__.hash = "d1efb0b";
74775
+ __info__.version = "18.0.49";
74776
+ __info__.date = "2025-11-24T07:40:04.646Z";
74777
+ __info__.hash = "b4ef5b7";
@@ -7727,7 +7727,7 @@ interface ClosedSidePanel {
7727
7727
  type SidePanelState = OpenSidePanel | ClosedSidePanel;
7728
7728
  declare class SidePanelStore extends SpreadsheetStore {
7729
7729
  mutators: readonly ["open", "toggle", "close", "changePanelSize", "resetPanelSize"];
7730
- initialPanelProps: SidePanelProps;
7730
+ currentPanelProps: SidePanelProps;
7731
7731
  componentTag: string;
7732
7732
  panelSize: number;
7733
7733
  get isOpen(): boolean;
@@ -2,9 +2,9 @@
2
2
  /**
3
3
  * This file is generated by o-spreadsheet build tools. Do not edit it.
4
4
  * @see https://github.com/odoo/o-spreadsheet
5
- * @version 18.0.48
6
- * @date 2025-11-12T14:15:38.406Z
7
- * @hash d1efb0b
5
+ * @version 18.0.49
6
+ * @date 2025-11-24T07:40:04.646Z
7
+ * @hash b4ef5b7
8
8
  */
9
9
 
10
10
  import { useEnv, useSubEnv, onWillUnmount, useComponent, status, Component, useRef, onMounted, useEffect, useState, onPatched, onWillPatch, onWillUpdateProps, useExternalListener, onWillStart, xml, useChildSubEnv, markRaw, toRaw } from '@odoo/owl';
@@ -28371,7 +28371,6 @@ class Composer extends Component {
28371
28371
  return;
28372
28372
  }
28373
28373
  const newSelection = this.contentHelper.getCurrentSelection();
28374
- this.props.composerStore.stopComposerRangeSelection();
28375
28374
  this.props.onComposerContentFocused();
28376
28375
  this.props.composerStore.changeComposerCursorSelection(newSelection.start, newSelection.end);
28377
28376
  this.processTokenAtCursor();
@@ -28654,7 +28653,6 @@ function insertTokenAfterArgSeparator(tokenAtCursor, value) {
28654
28653
  // replace the whole token
28655
28654
  start = tokenAtCursor.start;
28656
28655
  }
28657
- this.composer.stopComposerRangeSelection();
28658
28656
  this.composer.changeComposerCursorSelection(start, end);
28659
28657
  this.composer.replaceComposerCursorSelection(value);
28660
28658
  }
@@ -28672,7 +28670,6 @@ function insertTokenAfterLeftParenthesis(tokenAtCursor, value) {
28672
28670
  // replace the whole token
28673
28671
  start = tokenAtCursor.start;
28674
28672
  }
28675
- this.composer.stopComposerRangeSelection();
28676
28673
  this.composer.changeComposerCursorSelection(start, end);
28677
28674
  this.composer.replaceComposerCursorSelection(value);
28678
28675
  }
@@ -39381,6 +39378,7 @@ class AbstractComposerStore extends SpreadsheetStore {
39381
39378
  }
39382
39379
  this.selectionStart = start;
39383
39380
  this.selectionEnd = end;
39381
+ this.editionMode = "editing";
39384
39382
  }
39385
39383
  stopComposerRangeSelection() {
39386
39384
  if (this.isSelectingRange) {
@@ -48766,7 +48764,10 @@ class AbstractResizer extends Component {
48766
48764
  this.state.waitingForMove = false;
48767
48765
  }
48768
48766
  onMouseMove(ev) {
48769
- if (this.state.isResizing || this.state.isMoving || this.state.isSelecting) {
48767
+ if (this.env.model.getters.isReadonly() ||
48768
+ this.state.isResizing ||
48769
+ this.state.isMoving ||
48770
+ this.state.isSelecting) {
48770
48771
  return;
48771
48772
  }
48772
48773
  this._computeHandleDisplay(ev);
@@ -48819,6 +48820,10 @@ class AbstractResizer extends Component {
48819
48820
  if (index < 0) {
48820
48821
  return;
48821
48822
  }
48823
+ if (this.env.model.getters.isReadonly()) {
48824
+ this._selectElement(index, false);
48825
+ return;
48826
+ }
48822
48827
  if (this.state.waitingForMove === true) {
48823
48828
  if (!this.env.model.getters.isGridSelectionActive()) {
48824
48829
  this._selectElement(index, false);
@@ -50461,24 +50466,24 @@ const DEFAULT_SIDE_PANEL_SIZE = 350;
50461
50466
  const MIN_SHEET_VIEW_WIDTH = 150;
50462
50467
  class SidePanelStore extends SpreadsheetStore {
50463
50468
  mutators = ["open", "toggle", "close", "changePanelSize", "resetPanelSize"];
50464
- initialPanelProps = {};
50469
+ currentPanelProps = {};
50465
50470
  componentTag = "";
50466
50471
  panelSize = DEFAULT_SIDE_PANEL_SIZE;
50467
50472
  get isOpen() {
50468
50473
  if (!this.componentTag) {
50469
50474
  return false;
50470
50475
  }
50471
- return this.computeState(this.componentTag, this.initialPanelProps).isOpen;
50476
+ return this.computeState(this.componentTag, this.currentPanelProps).isOpen;
50472
50477
  }
50473
50478
  get panelProps() {
50474
- const state = this.computeState(this.componentTag, this.initialPanelProps);
50479
+ const state = this.computeState(this.componentTag, this.currentPanelProps);
50475
50480
  if (state.isOpen) {
50476
50481
  return state.props ?? {};
50477
50482
  }
50478
50483
  return {};
50479
50484
  }
50480
50485
  get panelKey() {
50481
- const state = this.computeState(this.componentTag, this.initialPanelProps);
50486
+ const state = this.computeState(this.componentTag, this.currentPanelProps);
50482
50487
  if (state.isOpen) {
50483
50488
  return state.key;
50484
50489
  }
@@ -50490,10 +50495,10 @@ class SidePanelStore extends SpreadsheetStore {
50490
50495
  return;
50491
50496
  }
50492
50497
  if (this.isOpen && componentTag !== this.componentTag) {
50493
- this.initialPanelProps?.onCloseSidePanel?.();
50498
+ this.currentPanelProps?.onCloseSidePanel?.();
50494
50499
  }
50495
50500
  this.componentTag = componentTag;
50496
- this.initialPanelProps = state.props ?? {};
50501
+ this.currentPanelProps = state.props ?? {};
50497
50502
  }
50498
50503
  toggle(componentTag, panelProps) {
50499
50504
  if (this.isOpen && componentTag === this.componentTag) {
@@ -50504,8 +50509,8 @@ class SidePanelStore extends SpreadsheetStore {
50504
50509
  }
50505
50510
  }
50506
50511
  close() {
50507
- this.initialPanelProps.onCloseSidePanel?.();
50508
- this.initialPanelProps = {};
50512
+ this.currentPanelProps.onCloseSidePanel?.();
50513
+ this.currentPanelProps = {};
50509
50514
  this.componentTag = "";
50510
50515
  }
50511
50516
  changePanelSize(size, spreadsheetElWidth) {
@@ -50531,7 +50536,11 @@ class SidePanelStore extends SpreadsheetStore {
50531
50536
  };
50532
50537
  }
50533
50538
  else {
50534
- return customComputeState(this.getters, panelProps);
50539
+ const state = customComputeState(this.getters, panelProps);
50540
+ if (state.isOpen) {
50541
+ this.currentPanelProps = state.props ?? this.currentPanelProps;
50542
+ }
50543
+ return state;
50535
50544
  }
50536
50545
  }
50537
50546
  }
@@ -74718,6 +74727,6 @@ const constants = {
74718
74727
  export { AbstractCellClipboardHandler, AbstractChart, AbstractFigureClipboardHandler, CellErrorType, CommandResult, CorePlugin, DispatchResult, EvaluationError, Model, PivotRuntimeDefinition, Registry, Revision, SPREADSHEET_DIMENSIONS, Spreadsheet, SpreadsheetPivotTable, UIPlugin, __info__, addFunction, addRenderingLayer, astToFormula, compile, compileTokens, components, constants, convertAstNodes, coreTypes, findCellInNewZone, functionCache, helpers, hooks, invalidateCFEvaluationCommands, invalidateDependenciesCommands, invalidateEvaluationCommands, iterateAstNodes, links, load, parse, parseTokens, readonlyAllowedCommands, registries, setDefaultSheetViewSize, setTranslationMethod, stores, tokenColors, tokenize };
74719
74728
 
74720
74729
 
74721
- __info__.version = "18.0.48";
74722
- __info__.date = "2025-11-12T14:15:38.406Z";
74723
- __info__.hash = "d1efb0b";
74730
+ __info__.version = "18.0.49";
74731
+ __info__.date = "2025-11-24T07:40:04.646Z";
74732
+ __info__.hash = "b4ef5b7";
@@ -2,9 +2,9 @@
2
2
  /**
3
3
  * This file is generated by o-spreadsheet build tools. Do not edit it.
4
4
  * @see https://github.com/odoo/o-spreadsheet
5
- * @version 18.0.48
6
- * @date 2025-11-12T14:15:38.406Z
7
- * @hash d1efb0b
5
+ * @version 18.0.49
6
+ * @date 2025-11-24T07:40:04.646Z
7
+ * @hash b4ef5b7
8
8
  */
9
9
 
10
10
  (function (exports, owl) {
@@ -28372,7 +28372,6 @@ stores.inject(MyMetaStore, storeInstance);
28372
28372
  return;
28373
28373
  }
28374
28374
  const newSelection = this.contentHelper.getCurrentSelection();
28375
- this.props.composerStore.stopComposerRangeSelection();
28376
28375
  this.props.onComposerContentFocused();
28377
28376
  this.props.composerStore.changeComposerCursorSelection(newSelection.start, newSelection.end);
28378
28377
  this.processTokenAtCursor();
@@ -28655,7 +28654,6 @@ stores.inject(MyMetaStore, storeInstance);
28655
28654
  // replace the whole token
28656
28655
  start = tokenAtCursor.start;
28657
28656
  }
28658
- this.composer.stopComposerRangeSelection();
28659
28657
  this.composer.changeComposerCursorSelection(start, end);
28660
28658
  this.composer.replaceComposerCursorSelection(value);
28661
28659
  }
@@ -28673,7 +28671,6 @@ stores.inject(MyMetaStore, storeInstance);
28673
28671
  // replace the whole token
28674
28672
  start = tokenAtCursor.start;
28675
28673
  }
28676
- this.composer.stopComposerRangeSelection();
28677
28674
  this.composer.changeComposerCursorSelection(start, end);
28678
28675
  this.composer.replaceComposerCursorSelection(value);
28679
28676
  }
@@ -39382,6 +39379,7 @@ stores.inject(MyMetaStore, storeInstance);
39382
39379
  }
39383
39380
  this.selectionStart = start;
39384
39381
  this.selectionEnd = end;
39382
+ this.editionMode = "editing";
39385
39383
  }
39386
39384
  stopComposerRangeSelection() {
39387
39385
  if (this.isSelectingRange) {
@@ -48767,7 +48765,10 @@ stores.inject(MyMetaStore, storeInstance);
48767
48765
  this.state.waitingForMove = false;
48768
48766
  }
48769
48767
  onMouseMove(ev) {
48770
- if (this.state.isResizing || this.state.isMoving || this.state.isSelecting) {
48768
+ if (this.env.model.getters.isReadonly() ||
48769
+ this.state.isResizing ||
48770
+ this.state.isMoving ||
48771
+ this.state.isSelecting) {
48771
48772
  return;
48772
48773
  }
48773
48774
  this._computeHandleDisplay(ev);
@@ -48820,6 +48821,10 @@ stores.inject(MyMetaStore, storeInstance);
48820
48821
  if (index < 0) {
48821
48822
  return;
48822
48823
  }
48824
+ if (this.env.model.getters.isReadonly()) {
48825
+ this._selectElement(index, false);
48826
+ return;
48827
+ }
48823
48828
  if (this.state.waitingForMove === true) {
48824
48829
  if (!this.env.model.getters.isGridSelectionActive()) {
48825
48830
  this._selectElement(index, false);
@@ -50462,24 +50467,24 @@ stores.inject(MyMetaStore, storeInstance);
50462
50467
  const MIN_SHEET_VIEW_WIDTH = 150;
50463
50468
  class SidePanelStore extends SpreadsheetStore {
50464
50469
  mutators = ["open", "toggle", "close", "changePanelSize", "resetPanelSize"];
50465
- initialPanelProps = {};
50470
+ currentPanelProps = {};
50466
50471
  componentTag = "";
50467
50472
  panelSize = DEFAULT_SIDE_PANEL_SIZE;
50468
50473
  get isOpen() {
50469
50474
  if (!this.componentTag) {
50470
50475
  return false;
50471
50476
  }
50472
- return this.computeState(this.componentTag, this.initialPanelProps).isOpen;
50477
+ return this.computeState(this.componentTag, this.currentPanelProps).isOpen;
50473
50478
  }
50474
50479
  get panelProps() {
50475
- const state = this.computeState(this.componentTag, this.initialPanelProps);
50480
+ const state = this.computeState(this.componentTag, this.currentPanelProps);
50476
50481
  if (state.isOpen) {
50477
50482
  return state.props ?? {};
50478
50483
  }
50479
50484
  return {};
50480
50485
  }
50481
50486
  get panelKey() {
50482
- const state = this.computeState(this.componentTag, this.initialPanelProps);
50487
+ const state = this.computeState(this.componentTag, this.currentPanelProps);
50483
50488
  if (state.isOpen) {
50484
50489
  return state.key;
50485
50490
  }
@@ -50491,10 +50496,10 @@ stores.inject(MyMetaStore, storeInstance);
50491
50496
  return;
50492
50497
  }
50493
50498
  if (this.isOpen && componentTag !== this.componentTag) {
50494
- this.initialPanelProps?.onCloseSidePanel?.();
50499
+ this.currentPanelProps?.onCloseSidePanel?.();
50495
50500
  }
50496
50501
  this.componentTag = componentTag;
50497
- this.initialPanelProps = state.props ?? {};
50502
+ this.currentPanelProps = state.props ?? {};
50498
50503
  }
50499
50504
  toggle(componentTag, panelProps) {
50500
50505
  if (this.isOpen && componentTag === this.componentTag) {
@@ -50505,8 +50510,8 @@ stores.inject(MyMetaStore, storeInstance);
50505
50510
  }
50506
50511
  }
50507
50512
  close() {
50508
- this.initialPanelProps.onCloseSidePanel?.();
50509
- this.initialPanelProps = {};
50513
+ this.currentPanelProps.onCloseSidePanel?.();
50514
+ this.currentPanelProps = {};
50510
50515
  this.componentTag = "";
50511
50516
  }
50512
50517
  changePanelSize(size, spreadsheetElWidth) {
@@ -50532,7 +50537,11 @@ stores.inject(MyMetaStore, storeInstance);
50532
50537
  };
50533
50538
  }
50534
50539
  else {
50535
- return customComputeState(this.getters, panelProps);
50540
+ const state = customComputeState(this.getters, panelProps);
50541
+ if (state.isOpen) {
50542
+ this.currentPanelProps = state.props ?? this.currentPanelProps;
50543
+ }
50544
+ return state;
50536
50545
  }
50537
50546
  }
50538
50547
  }
@@ -74762,9 +74771,9 @@ stores.inject(MyMetaStore, storeInstance);
74762
74771
  exports.tokenize = tokenize;
74763
74772
 
74764
74773
 
74765
- __info__.version = "18.0.48";
74766
- __info__.date = "2025-11-12T14:15:38.406Z";
74767
- __info__.hash = "d1efb0b";
74774
+ __info__.version = "18.0.49";
74775
+ __info__.date = "2025-11-24T07:40:04.646Z";
74776
+ __info__.hash = "b4ef5b7";
74768
74777
 
74769
74778
 
74770
74779
  })(this.o_spreadsheet = this.o_spreadsheet || {}, owl);
@@ -134,7 +134,7 @@
134
134
  }
135
135
  }
136
136
  }
137
- `;class XE 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:UE,FunctionDescriptionProvider:$E};static defaultProps={inputStyle:"",isDefaultFocus:!1};DOMFocusableElementStore;composerRef=t.useRef("o_composer");contentHelper=new BE(this.composerRef.el);composerState=t.useState({positionStart:0,positionEnd:0});autoCompleteState;functionDescriptionState=t.useState({showDescription:!1,functionName:"",functionDescription:{},argToFocus:0});assistant=t.useState({forcedClosed:!1});compositionActive=!1;spreadsheetRect=NE();get assistantStyleProperties(){const e=this.composerRef.el.getBoundingClientRect(),t={},o=Math.min(this.props.rect?.width||1/0,WE);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+WE>this.props.delimitation.width&&(t.right="0px")}else t["max-height"]=this.spreadsheetRect.height-e.bottom-1+"px",e.left+WE+J+9>this.spreadsheetRect.width&&(t.right="9px");return t}get assistantStyle(){const e=this.assistantStyleProperties;return Hh({"max-height":e["max-height"],width:e.width,"min-width":e["min-width"]})}get assistantContainerStyle(){const e=this.assistantStyleProperties;return Hh({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:()=>console.warn("Not implemented"),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=Ac(xE),this.autoCompleteState=_c(HE),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)})),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]))}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 VE(e,this.env.model.selection);const o=this.props.composerStore.currentContent;"cellFocus"!==this.props.focus||this.autoCompleteState.provider||o.startsWith("=")?(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)+_e+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()}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[FE(e)]||this.keyCodeMapping[FE(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(Be(0,e,10))}onMousedown(e){e.button>0||this.contentHelper.removeSelection()}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(e.startsWith("=")){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]){if("inactive"!==this.props.focus){const{start:e,end:t}=this.props.composerStore.composerSelection;this.contentHelper.selectRange(e,t)}this.contentHelper.scrollSelectionIntoView()}this.shouldProcessInputEvents=!0}getContentLines(){let e=this.props.composerStore.currentContent;const t=e.startsWith("=");return""===e?[]:t&&"inactive"!==this.props.focus?this.splitHtmlContentIntoLines(this.getColoredTokens()):this.splitHtmlContentIntoLines([{value:e}])}getColoredTokens(){const e=this.props.composerStore.currentTokens,t=this.props.composerStore.tokenAtCursor,o=[],{end:s,start:i}=this.props.composerStore.composerSelection;for(const n of e){switch(n.type){case"OPERATOR":case"NUMBER":case"ARG_SEPARATOR":case"STRING":o.push({value:n.value,color:YE[n.type]||"#000"});break;case"REFERENCE":const{xc:e,sheetName:s}=Fr(n.value);o.push({value:n.value,color:this.rangeColor(e,s)||"#000"});break;case"SYMBOL":const i=n.value.toUpperCase();"TRUE"===i||"FALSE"===i?o.push({value:n.value,color:YE.NUMBER}):i in rS.content?o.push({value:n.value,color:YE.FUNCTION}):o.push({value:n.value,color:"#000"});break;case"LEFT_PAREN":case"RIGHT_PAREN":t&&["LEFT_PAREN","RIGHT_PAREN"].includes(t.type)&&t.parenIndex&&t.parenIndex===n.parenIndex?o.push({value:n.value,color:YE.MATCHING_PAREN||"#000"}):o.push({value:n.value,color:YE[n.type]||"#000"});break;default:o.push({value:n.value,color:"#000"})}this.props.composerStore.showSelectionIndicator&&s===i&&s===n.end&&(o[o.length-1].class=qE)}return o}splitHtmlContentIntoLines(e){const t=[];let o=[];for(const s of e)if(s.value.includes(_e)){const e=s.value.split(_e),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.class)}rangeColor(e,t){if("inactive"===this.props.focus)return;const o=this.props.composerStore.highlights,s=t?this.env.model.getters.getSheetIdByName(t):this.props.composerStore.sheetId,i=o.find((t=>{if(t.sheetId!==s)return!1;let o=this.env.model.getters.getRangeFromSheetXC(s,e).zone;return o=1===Jo(o)?this.env.model.getters.expandZone(s,o):o,Uo(o,t.zone)}));return i&&i.color?i.color:void 0}processTokenAtCursor(){let e=this.props.composerStore.currentContent;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(e.startsWith("=")&&o&&"SYMBOL"!==o.type){const e=o.functionContext,t=e?.parent.toUpperCase();if(e&&t&&t in GE&&"UNKNOWN"!==o.type){const o=GE[t],s=e.argPosition;this.functionDescriptionState.functionName=t,this.functionDescriptionState.functionDescription=o,this.functionDescriptionState.argToFocus=o.getArgToFocus(s+1)-1,this.functionDescriptionState.showDescription=!0}}}autoComplete(e){!e||this.assistant.forcedClosed&&this.canBeToggled||(this.autoCompleteState.provider?.selectProposal(e),this.processTokenAtCursor())}}const KE=["PIVOT.VALUE","PIVOT.HEADER","PIVOT"];function QE(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:YE.STRING}],fuzzySearchKey:s}}function JE(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 ex(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 tx(e){const t=e.functionContext?.args[0];if(t&&["STRING","NUMBER"].includes(t.type))return t.value}function ox(e){return xS(e,KE)[0]}function sx(e){return xS(e,KE).length}const ix=new n;ix.add("SPREADSHEET",!1),wE.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:YE.NUMBER}],fuzzySearchKey:o+t.name}})).filter(ot)},selectProposal:ex}),wE.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=tx(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:Ro("Count"),htmlContent:[{value:e,color:YE.STRING}],fuzzySearchKey:Ro("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:YE.STRING}],fuzzySearchKey:o}}(e)})).filter(ot):[]},selectProposal:JE}),wE.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=tx(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(ot),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=ix.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(ot);return m.map((e=>{const[t,o]=e.split(":"),s=n[t];return s?QE(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:Ro("%s (positional)",o.string)+(o.help?` (${o.help})`:""),htmlContent:[{value:s,color:YE.STRING}],fuzzySearchKey:o.string+s}}))).filter(ot)},selectProposal:JE}),wE.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=tx(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(Nn).map(((e,t)=>({text:`${t+1}`,fuzzySearchKey:e.toString(),description:e.toString(),htmlContent:[{value:`${t+1}`,color:YE.NUMBER}]}))):"quarter_number"===a.granularity?[1,2,3,4].map((e=>({text:`${e}`,fuzzySearchKey:`${e}`,description:Ro("Quarter %s",e),htmlContent:[{value:`${e}`,color:YE.NUMBER}]}))):"day_of_month"===a.granularity?ze(1,32).map((e=>({text:`${e}`,fuzzySearchKey:`${e}`,description:"",htmlContent:[{value:`${e}`,color:YE.NUMBER}]}))):"iso_week_number"===a.granularity?ze(0,54).map((e=>({text:`${e}`,fuzzySearchKey:`${e}`,description:"",htmlContent:[{value:`${e}`,color:YE.NUMBER}]}))):"day_of_week"===a.granularity?ze(1,8).map((e=>({text:`${e}`,fuzzySearchKey:`${e}`,description:"",htmlContent:[{value:`${e}`,color:YE.NUMBER}]}))):"hour_number"===a.granularity?ze(0,24).map((e=>({text:`${e}`,fuzzySearchKey:`${e}`,description:"",htmlContent:[{value:`${e}`,color:YE.NUMBER}]}))):"minute_number"===a.granularity?ze(0,60).map((e=>({text:`${e}`,fuzzySearchKey:`${e}`,description:"",htmlContent:[{value:`${e}`,color:YE.NUMBER}]}))):"second_number"===a.granularity?ze(0,60).map((e=>({text:`${e}`,fuzzySearchKey:`${e}`,description:"",htmlContent:[{value:`${e}`,color:YE.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?YE.STRING:YE.NUMBER}],fuzzySearchKey:s+i}}))},selectProposal:JE}),wE.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=Ue(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 nx=new n;nx.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=Ln(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=Pi(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=Rs(s);e.current=i;const n=o.getLocale(),r=Ln(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?hr(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 rx=new n,ax=/(\d+)$/,lx=/^(.*\D+)/,cx=/^(.*\D+)(\d+)$/;function hx(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:hr(n,{locale:oi,format:n.format});if(t&&o(t))s.push(t);else{if(i)return s;s=[]}}return s}function dx(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 ux(e){if(e.length<2)return 1;const t=e.map((e=>Pi(e,oi))),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=as.fromTimestamp(e[o-1].getTime()),i=Ps(s,t),n=Fs(s,t)%12;s.setFullYear(s.getFullYear()+i),s.setMonth(s.getMonth()+n);return{years:i,months:n,days:Ms(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}}rx.add("simple_value_copy",{condition:(e,t)=>!(1!==t.length||e.isFormula||e.format&&Wn(e.format)),generateRule:()=>({type:"COPY_MODIFIER"}),sequence:10}).add("increment_alphanumeric_value",{condition:e=>!e.isFormula&&hr(e,{locale:oi}).type===zs.text&&cx.test(e.content),generateRule:(e,t,o)=>{const s=parseInt(e.content.match(ax)[0]),i=e.content.match(lx)[0],n=e.content.length-i.length,r=hx(e,t,(e=>e.type===zs.text&&cx.test(e.value))).filter((e=>i===(e.value??"").toString().match(lx)[0])).map((e=>parseInt((e.value??"").toString().match(ax)[0])));let a=dx(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&&hr(e,{locale:oi}).type===zs.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&&hr(e,{locale:oi}).type===zs.number&&!!e.format&&Wn(e.format),generateRule:(e,t)=>{const o=ux(hx(e,t,(e=>e.type===zs.number&&!!e.format&&Wn(e.format))).map((e=>Number(e.value))));if(void 0===o)return{type:"COPY_MODIFIER"};const s=hr(e,{locale:oi});return"object"==typeof o?{type:"DATE_INCREMENT_MODIFIER",increment:o,current:s.type===zs.number?s.value:0}:{type:"INCREMENT_MODIFIER",increment:o,current:s.type===zs.number?s.value:0}},sequence:25}).add("increment_number",{condition:e=>!e.isFormula&&hr(e,{locale:oi}).type===zs.number,generateRule:(e,t,o)=>{const s=hx(e,t,(e=>e.type===zs.number&&!Wn(e.format||""))).map((e=>Number(e.value)));let i=dx(s);["up","left"].includes(o)&&1===s.length&&(i=-i);const n=hr(e,{locale:oi});return{type:"INCREMENT_MODIFIER",increment:i,current:n.type===zs.number?n.value:0}},sequence:40});const gx=new n;class px extends t.Component{static template="o-spreadsheet-GaugeChartComponent";canvas=t.useRef("chartContainer");get runtime(){return this.env.model.getters.getChartRuntime(this.props.figure.id)}setup(){t.useEffect((()=>Bw(this.canvas.el,this.runtime)),(()=>{const e=this.canvas.el.getBoundingClientRect();return[e.width,e.height,this.runtime,this.canvas.el,window.devicePixelRatio]}))}}function mx(e){return 8===(e=Nt(e).replace("#","")).length?e.slice(6)+e.slice(0,6):e}px.props={figure:Object};class fx extends Zw{dataSets;labelRange;background;legendPosition;stacked;aggregated;type="bar";dataSetsHaveTitle;dataSetDesign;axesDesign;horizontal;showValues;constructor(e,t,o){super(e,t,o),this.dataSets=Gc(o,e.dataSets,t,e.dataSetsHaveTitle),this.labelRange=kr(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){return jc(e,t)}static validateChartDefinition(e,t){return e.checkValidations(t,Xc,Kc)}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}}copyForSheetId(e){const t=Bc(this.sheetId,e,this.dataSets),o=zc(this.sheetId,e,this.labelRange),s=this.getDefinitionWithSpecificDataSets(t,o,e);return new fx(s,e,this.getters)}copyInSheetId(e){const t=this.getDefinitionWithSpecificDataSets(this.dataSets,this.labelRange,e);return new fx(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=>qc(this.getters,e))).filter((e=>""!==e.range&&e.range!==li.InvalidReference)),t=Zc(this.getters,this.labelRange,Qc(this.labelRange,this.dataSets[0],this.dataSetsHaveTitle)),o=this.getDefinition();return{...o,backgroundColor:mx(this.background||m),fontColor:mx(Yc(this.background)),dataSets:e,labelRange:t,verticalAxis:eh(o)}}updateRanges(e){const{dataSets:t,labelRange:o,isStale:s}=Hc(this.getters,e,this.dataSets,this.labelRange);if(!s)return this;const i=this.getDefinitionWithSpecificDataSets(t,o);return new fx(i,this.sheetId,this.getters)}}function vx(e,t){let o=uE(t,e.dataSets,e.labelRange).formattedValues,s=pE(t,e.dataSets);Qc(e.labelRange,e.dataSets[0],e.dataSetsHaveTitle)&&o.shift(),({labels:o,dataSetsValues:s}=aE(o,s)),e.aggregated&&({labels:o,dataSetsValues:s}=lE(o,s));const i={format:gE(t,e.dataSets),locale:t.getLocale()},n=Yc(e.background),r=hE(e,o,n,{...i,horizontalChart:e.horizontal}),a=bE(n);"none"===e.legendPosition?a.display=!1:a.position=e.legendPosition,r.options.plugins.legend={...r.options.plugins?.legend,...a},r.options.layout={padding:th({displayTitle:!!e.title.text,displayLegend:"top"===e.legendPosition})},r.options.indexAxis=e.horizontal?"y":"x",r.options.scales={};const l={ticks:{padding:5,color:n}},c={beginAtZero:!0,ticks:{color:n,callback:nh(i)}},h=e.horizontal?c:l,d=e.horizontal?l:c,{useLeftAxis:u,useRightAxis:g}=eh(e.getDefinition());r.options.scales.x={...h,title:Jc(e.axesDesign?.x)},u&&(r.options.scales.y={...d,position:"left",title:Jc(e.axesDesign?.y)}),g&&(r.options.scales.y1={...d,position:"right",title:Jc(e.axesDesign?.y1)}),e.stacked&&(r.options.scales.x.stacked=!0,u&&(r.options.scales.y.stacked=!0),g&&(r.options.scales.y1.stacked=!0)),r.options.plugins.chartShowValuesPlugin={showValues:e.showValues,background:e.background,horizontal:e.horizontal,callback:nh(i)};const p=e.getDefinition(),f=rh(p,s.length),v=[];for(const t in s){const{label:o,data:i,hidden:n}=s[t],a=f.next(),l={label:o,data:i,hidden:n,borderColor:p.background||m,borderWidth:p.stacked?1:0,backgroundColor:a};if(r.data.datasets.push(l),p.dataSets?.[t]?.label){const e=p.dataSets[t].label;l.label=e}p.dataSets?.[t]?.yAxisId&&!e.horizontal&&(l.yAxisID=p.dataSets[t].yAxisId);const c=p.dataSets?.[t].trend;if(!c?.display||e.horizontal)continue;const h=oh(c,l);h&&v.push(h)}if(v.length){const e=Math.max(...v.map((e=>e.data.length)));r.options.scales[Uc]={...h,labels:Array(e).fill(""),offset:!1,display:!1},v.forEach((e=>r.data.datasets.push(e))),r.options.plugins.tooltip.callbacks.title=function(e){return e.some((e=>e.dataset.xAxisID!==Uc))?void 0:""}}return{chartJsConfig:r,background:e.background||m}}const bx={second:1e3,minute:6e4,hour:36e5,day:864e5,month:2592e6,year:31536e6},Sx={inSeconds:function(e){return Math.floor(e/bx.second)},inMinutes:function(e){return Math.floor(e/bx.minute)},inHours:function(e){return Math.floor(e/bx.hour)},inDays:function(e){return Math.floor(e/bx.day)},inMonths:function(e){return Math.floor(e/bx.month)},inYears:function(e){return Math.floor(e/bx.year)}},yx=/^((d|dd|m|mm|yyyy|yy|hh|h|ss|a)(-|:|\s|\/))*(d|dd|m|mm|yyyy|yy|hh|h|ss|a)$/i;function Cx(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=>Es(e,o)?.jsDate));if(s.some((e=>void 0===e))||e.length<2)return;const i=s.map((e=>e.getTime())),n=Rt(i)-Tt(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(bx.second>=bx[r]&&Sx.inSeconds(n)<180)return"second";if(bx.minute>=bx[r]&&Sx.inMinutes(n)<180)return"minute";if(bx.hour>=bx[r]&&Sx.inHours(n)<96)return"hour";if(bx.day>=bx[r]&&Sx.inDays(n)<90)return"day";if(bx.month>=bx[r]&&Sx.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 wx(e,t){return xx(e,t)||Ix(e,t)}function Ex(e,t){return function(e,t){return!e.labelsAsText&&xx(e,t)}(e,t)&&function(){const e=SE();if(!e)return!1;const t="luxon"===new e._adapters._date({})._id;t||Rx||(Rx=!0,console.warn("'chartjs-adapter-luxon' time adapter is not installed. Time scale axes are disabled."));return t}()?"time":function(e,t){return!e.labelsAsText&&Ix(e,t)}(e,t)?"linear":"category"}function xx(e,t){if(!e.labelRange||!Ix(e,t))return!1;const o=dE(t,e.labelRange,Qc(e.labelRange,e.dataSets[0],e.dataSetsHaveTitle));return Boolean(o&&yx.test(o))}function Ix(e,t){if(!e.labelRange)return!1;const o=t.getRangeValues(e.labelRange);return Qc(e.labelRange,e.dataSets[0],e.dataSetsHaveTitle)&&o.shift(),!o.some((e=>isNaN(Number(e))&&e))&&!o.every((e=>!e))}let Rx=!1;function Tx(e,t,o,s){const i=[],n=[],r=[],a=t.data.length;if(t.hidden)return;if(a<2)return;switch(o){case"category":for(let e=0;e<a;e++)"number"==typeof t.data[e]&&(i.push(t.data[e]),n.push(e+1)),r.push(e+1);break;case"linear":for(const e of t.data){const t=Number(e.x);isNaN(t)||("number"==typeof e.y&&(i.push(e.y),n.push(t)),r.push(t))}break;case"time":for(const e of t.data){const t=wi({value:e.x},s);null!==e.y&&(i.push(e.y),n.push(t)),r.push(t)}}const l=Math.min(...r),c=Math.max(...r);if(c===l)return;const h=(c-l)/(5*r.length),d=ze(l,c+h/2,h),u=ih(e,i,n,d);return u.length?sh(t,e,u,d):void 0}function Ax(e,t){const o=Ex(e,t),s=uE(t,e.dataSets,e.labelRange);let i="linear"===o?s.values:s.formattedValues,n=pE(t,e.dataSets);const r=Qc(e.labelRange,e.dataSets[0],e.dataSetsHaveTitle);r&&i.shift(),({labels:i,dataSetsValues:n}=aE(i,n)),"time"===o&&({labels:i,dataSetsValues:n}=function(e,t){if(0===e.length||e.every((e=>!e)))return{labels:e,dataSetsValues:t};const o=[...e],s=ke(t);for(let e=0;e<o.length;e++)if(!o[e]){o[e]=lt(o,e);for(let t of s)t.data[e]=void 0}return{labels:o,dataSetsValues:s}}(i,n)),e.aggregated&&({labels:i,dataSetsValues:n}=lE(i,n));const a=t.getLocale(),l="category"===o,c=gE(t,e.dataSets),h={format:c,locale:a,truncateLabels:l},d=Yc(e.background),u=hE(e,i,d,h),g=bE(d,{labels:{generateLabels(e){const{data:t}=e,o=SE().defaults.plugins.legend.labels.generateLabels(e);for(const[e,s]of o.entries())s.fillStyle=t.datasets[e].borderColor;return o}}});"none"===e.legendPosition?g.display=!1:g.position=e.legendPosition,Object.assign(u.options.plugins.legend||{},g),u.options.layout={padding:th({displayTitle:!!e.title.text,displayLegend:"top"===e.legendPosition})};const p={ticks:{padding:5,color:d},title:Jc(e.axesDesign?.x)};u.options.scales={x:p};const f={beginAtZero:!0,ticks:{color:d,callback:nh(h)}},{useLeftAxis:v,useRightAxis:b}=eh(e.getDefinition());v&&(u.options.scales.y={...f,position:"left",title:Jc(e.axesDesign?.y)}),b&&(u.options.scales.y1={...f,position:"right",title:Jc(e.axesDesign?.y1)}),"stacked"in e&&e.stacked&&(v&&(u.options.scales.y.stacked=!0),b&&(u.options.scales.y1.stacked=!0)),u.options.plugins.chartShowValuesPlugin={showValues:e.showValues,background:e.background,callback:nh(h)};const S=dE(t,e.labelRange,r);if("time"===o){const e={type:"time",time:Cx(i,S,a)};Object.assign(u.options.scales.x,e),u.options.scales.x.ticks.maxTicksLimit=15}else"linear"===o&&(u.options.scales.x.type="linear",u.options.scales.x.ticks.callback=e=>Ln(e,{format:S,locale:a}),u.options.plugins.tooltip.callbacks.label=e=>{let t,o;e.dataset.xAxisID===Uc?(t=n[e.datasetIndex].data[e.dataIndex].y,o=""):(t=n[e.datasetIndex].data[e.dataIndex],o=s.values[e.dataIndex]),Vs(o,a)&&(o=wi(o,a));const i=Ln(o,{locale:a,format:S}),r=Ln(t,{locale:a,format:c}),l=e.dataset.label;return i?`${l}: (${i}, ${r})`:`${l}: ${r}`});const y="fillArea"in e&&e.fillArea,C="stacked"in e&&e.stacked,w="cumulative"in e&&e.cumulative,E=e.getDefinition(),x=rh(E,n.length);for(let[e,{label:t,data:s,hidden:r}]of n.entries()){const n=x.next();let a=Bt(n);if(y&&(a.a=we),w){let e=0;s=s.map((t=>isNaN(t)?t:(e+=parseFloat(t),e)))}["linear","time"].includes(o)&&(s=s.map(((e,t)=>({x:i[t]||void 0,y:e}))));const l={label:t,data:s,hidden:r,tension:0,borderColor:n,backgroundColor:Ht(a),pointBackgroundColor:n,fill:!!y&&mE(e,C)};u.data.datasets.push(l)}let I=0;const R=[];for(const[e,t]of u.data.datasets.entries()){if(E.dataSets?.[e]?.label){const o=E.dataSets[e].label;t.label=o}E.dataSets?.[e]?.yAxisId&&(t.yAxisID=E.dataSets[e].yAxisId);const s=E.dataSets?.[e].trend;if(!s?.display)continue;const i=Tx(s,t,o,a);i&&(I=Math.max(I,i.data.length),R.push(i),n.push(i))}return R.length&&(u.options.scales[Uc]={...p,display:!1},"category"!==o&&"time"!==o||(u.options.scales[Uc].type="category",u.options.scales[Uc].labels=ze(0,I).map((e=>e.toString())),u.options.scales[Uc].offset=!1),R.forEach((e=>u.data.datasets.push(e)))),u.options.plugins.tooltip.callbacks.title=function(e){return"linear"!==o&&e.some((e=>e.dataset.xAxisID!==Uc))?void 0:""},{chartJsConfig:u,background:e.background||m}}class _x extends Zw{dataSets;labelRange;background;legendPosition;aggregated;dataSetsHaveTitle;dataSetDesign;axesDesign;type="combo";showValues;constructor(e,t,o){super(e,t,o),this.dataSets=Gc(o,e.dataSets,t,e.dataSetsHaveTitle),this.labelRange=kr(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){return jc(e,t)}static validateChartDefinition(e,t){return e.checkValidations(t,Xc,Kc)}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=>qc(this.getters,e))).filter((e=>""!==e.range&&e.range!==li.InvalidReference)),t=Zc(this.getters,this.labelRange,Qc(this.labelRange,this.dataSets[0],this.dataSetsHaveTitle)),o=this.getDefinition();return{...o,backgroundColor:mx(this.background||m),fontColor:mx(Yc(this.background)),dataSets:e,labelRange:t,verticalAxis:eh(o)}}updateRanges(e){const{dataSets:t,labelRange:o,isStale:s}=Hc(this.getters,e,this.dataSets,this.labelRange);if(!s)return this;const i=this.getDefinitionWithSpecificDataSets(t,o);return new _x(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}}copyForSheetId(e){const t=Bc(this.sheetId,e,this.dataSets),o=zc(this.sheetId,e,this.labelRange),s=this.getDefinitionWithSpecificDataSets(t,o,e);return new _x(s,e,this.getters)}copyInSheetId(e){const t=this.getDefinitionWithSpecificDataSets(this.dataSets,this.labelRange,e);return new _x(t,e,this.getters)}}function Dx(e){return e.dataRange&&!Tr.test(e.dataRange)?"InvalidGaugeDataRange":"Success"}function Ox(e,t){return t((t=>t.sectionRule?e(t.sectionRule.rangeMin,"rangeMin"):"Success"),(t=>t.sectionRule?e(t.sectionRule.rangeMax,"rangeMax"):"Success"))}function Fx(e){return e.sectionRule&&Number(e.sectionRule.rangeMin)>=Number(e.sectionRule.rangeMax)?"GaugeRangeMinBiggerThanRangeMax":"Success"}function Mx(e,t){if(""===e)switch(t){case"rangeMin":return"EmptyGaugeRangeMin";case"rangeMax":return"EmptyGaugeRangeMax"}return"Success"}function Px(e,t){if(isNaN(e))switch(t){case"rangeMin":return"GaugeRangeMinNaN";case"rangeMax":return"GaugeRangeMaxNaN";case"lowerInflectionPointValue":return"GaugeLowerInflectionPointNaN";case"upperInflectionPointValue":return"GaugeUpperInflectionPointNaN"}return"Success"}class Nx extends Zw{dataRange;sectionRule;background;type="gauge";constructor(e,t,o){super(e,t,o),this.dataRange=kr(this.getters,this.sheetId,e.dataRange),this.sectionRule=e.sectionRule,this.background=e.background}static validateChartDefinition(e,t){return e.checkValidations(t,Dx,e.chainValidations(Ox(Mx,e.batchValidations),Ox(Px,e.batchValidations),Fx),e.chainValidations((o=Px,(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){let o;return e.dataRange&&(o=Cc(Ao(e.dataRange),t)),{...e,dataRange:o?Fo(o):void 0}}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:"<="}}}}copyForSheetId(e){const t=zc(this.sheetId,e,this.dataRange),o=this.getDefinitionWithSpecificRanges(t,e);return new Nx(o,e,this.getters)}copyInSheetId(e){const t=this.getDefinitionWithSpecificRanges(this.dataRange,e);return new Nx(t,e,this.getters)}getDefinition(){return this.getDefinitionWithSpecificRanges(this.dataRange)}getDefinitionWithSpecificRanges(e,t){return{background:this.background,sectionRule:this.sectionRule,title:this.title,type:"gauge",dataRange:e?this.getters.getRangeString(e,t||this.sheetId):void 0}}getDefinitionForExcel(){}getContextCreation(){return{...this,range:this.dataRange?[{dataRange:this.getters.getRangeString(this.dataRange,this.sheetId)}]:void 0}}updateRanges(e){const t=$c(this.dataRange,e);if(this.dataRange===t)return this;const o=this.getDefinitionWithSpecificRanges(t);return new Nx(o,this.sheetId,this.getters)}}function kx(e,t,o){if(""===e.value||isNaN(Number(e.value)))return;const s=Number(e.value);return Be("number"===e.type?s:t+(o-t)*s/100,t,o)}class Lx extends Zw{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=Gc(this.getters,e.dataSets,t,e.dataSetsHaveTitle),this.labelRange=kr(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,Xc,Kc)}static transformDefinition(e,t){return jc(e,t)}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}=Hc(this.getters,e,this.dataSets,this.labelRange);if(!s)return this;const i=this.getDefinitionWithSpecificDataSets(t,o);return new Lx(i,this.sheetId,this.getters)}getDefinitionForExcel(){const e=this.dataSets.map((e=>qc(this.getters,e))).filter((e=>""!==e.range&&e.range!==li.InvalidReference)),t=Zc(this.getters,this.labelRange,Qc(this.labelRange,this.dataSets[0],this.dataSetsHaveTitle)),o=this.getDefinition();return{...o,backgroundColor:mx(this.background||m),fontColor:mx(Yc(this.background)),dataSets:e,labelRange:t,verticalAxis:eh(o)}}copyForSheetId(e){const t=Bc(this.sheetId,e,this.dataSets),o=zc(this.sheetId,e,this.labelRange),s=this.getDefinitionWithSpecificDataSets(t,o,e);return new Lx(s,e,this.getters)}copyInSheetId(e){const t=this.getDefinitionWithSpecificDataSets(this.dataSets,this.labelRange,e);return new Lx(t,e,this.getters)}}class Vx extends Zw{dataSets;labelRange;background;legendPosition;type="pie";aggregated;dataSetsHaveTitle;isDoughnut;showValues;constructor(e,t,o){super(e,t,o),this.dataSets=Gc(o,e.dataSets,t,e.dataSetsHaveTitle),this.labelRange=kr(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){return jc(e,t)}static validateChartDefinition(e,t){return e.checkValidations(t,Xc,Kc)}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}}copyForSheetId(e){const t=Bc(this.sheetId,e,this.dataSets),o=zc(this.sheetId,e,this.labelRange),s=this.getDefinitionWithSpecificDataSets(t,o,e);return new Vx(s,e,this.getters)}copyInSheetId(e){const t=this.getDefinitionWithSpecificDataSets(this.dataSets,this.labelRange,e);return new Vx(t,e,this.getters)}getDefinitionForExcel(){const e=this.dataSets.map((e=>qc(this.getters,e))).filter((e=>""!==e.range&&e.range!==li.InvalidReference)),t=Zc(this.getters,this.labelRange,Qc(this.labelRange,this.dataSets[0],this.dataSetsHaveTitle));return{...this.getDefinition(),backgroundColor:mx(this.background||m),fontColor:mx(Yc(this.background)),dataSets:e,labelRange:t}}updateRanges(e){const{dataSets:t,labelRange:o,isStale:s}=Hc(this.getters,e,this.dataSets,this.labelRange);if(!s)return this;const i=this.getDefinitionWithSpecificDataSets(t,o);return new Vx(i,this.sheetId,this.getters)}}class Ux extends Zw{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=Gc(o,e.dataSets,t,e.dataSetsHaveTitle).slice(0,2),this.labelRange=kr(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){return jc(e,t)}static validateChartDefinition(e,t){return e.checkValidations(t,Xc,Kc)}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}}copyForSheetId(e){const t=Bc(this.sheetId,e,this.dataSets),o=zc(this.sheetId,e,this.labelRange),s=this.getDefinitionWithSpecificDataSets(t,o,e);return new Ux(s,e,this.getters)}copyInSheetId(e){const t=this.getDefinitionWithSpecificDataSets(this.dataSets,this.labelRange,e);return new Ux(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}=Hc(this.getters,e,this.dataSets,this.labelRange);if(!s)return this;const i=this.getDefinitionWithSpecificDataSets(t,o);return new Ux(i,this.sheetId,this.getters)}}class Hx extends Zw{dataSets;labelRange;background;legendPosition;labelsAsText;aggregated;type="scatter";dataSetsHaveTitle;dataSetDesign;axesDesign;showValues;constructor(e,t,o){super(e,t,o),this.dataSets=Gc(this.getters,e.dataSets,t,e.dataSetsHaveTitle),this.labelRange=kr(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,Xc,Kc)}static transformDefinition(e,t){return jc(e,t)}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}=Hc(this.getters,e,this.dataSets,this.labelRange);if(!s)return this;const i=this.getDefinitionWithSpecificDataSets(t,o);return new Hx(i,this.sheetId,this.getters)}getDefinitionForExcel(){const e=this.dataSets.map((e=>qc(this.getters,e))).filter((e=>""!==e.range)),t=Zc(this.getters,this.labelRange,Qc(this.labelRange,this.dataSets[0],this.dataSetsHaveTitle)),o=this.getDefinition();return{...o,backgroundColor:mx(this.background||m),fontColor:mx(Yc(this.background)),dataSets:e,labelRange:t,verticalAxis:eh(o)}}copyForSheetId(e){const t=Bc(this.sheetId,e,this.dataSets),o=zc(this.sheetId,e,this.labelRange),s=this.getDefinitionWithSpecificDataSets(t,o,e);return new Hx(s,e,this.getters)}copyInSheetId(e){const t=this.getDefinitionWithSpecificDataSets(this.dataSets,this.labelRange,e);return new Hx(t,e,this.getters)}}class Bx extends Zw{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=Gc(o,e.dataSets,t,e.dataSetsHaveTitle),this.labelRange=kr(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){return jc(e,t)}static validateChartDefinition(e,t){return e.checkValidations(t,Xc,Kc)}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}}copyForSheetId(e){const t=Bc(this.sheetId,e,this.dataSets),o=zc(this.sheetId,e,this.labelRange),s=this.getDefinitionWithSpecificDataSets(t,o,e);return new Bx(s,e,this.getters)}copyInSheetId(e){const t=this.getDefinitionWithSpecificDataSets(this.dataSets,this.labelRange,e);return new Bx(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}=Hc(this.getters,e,this.dataSets,this.labelRange);if(!s)return this;const i=this.getDefinitionWithSpecificDataSets(t,o);return new Bx(i,this.sheetId,this.getters)}}const zx=new n;zx.add("bar",{match:e=>"bar"===e,createChart:(e,t,o)=>new fx(e,t,o),getChartRuntime:vx,validateChartDefinition:fx.validateChartDefinition,transformDefinition:fx.transformDefinition,getChartDefinitionFromContextCreation:fx.getDefinitionFromContextCreation,sequence:10}),zx.add("combo",{match:e=>"combo"===e,createChart:(e,t,o)=>new _x(e,t,o),getChartRuntime:function(e,t){const o=e.dataSets.length?gE(t,[e.dataSets[0]]):void 0,s=gE(t,e.dataSets.slice(1)),i=t.getLocale();let n=uE(t,e.dataSets,e.labelRange).formattedValues,r=pE(t,e.dataSets);Qc(e.labelRange,e.dataSets[0],e.dataSetsHaveTitle)&&n.shift(),({labels:n,dataSetsValues:r}=aE(n,r)),e.aggregated&&({labels:n,dataSetsValues:r}=lE(n,r));const a={format:o,locale:i},l=Yc(e.background),c=hE(e,n,l,a),h=bE(l);"none"===e.legendPosition?h.display=!1:h.position=e.legendPosition,c.options.plugins.legend={...c.options.plugins?.legend,...h},c.options.layout={padding:th({displayTitle:!!e.title.text,displayLegend:"top"===e.legendPosition})},c.options.scales={x:{ticks:{padding:5,color:l},title:Jc(e.axesDesign?.x)}};const d={beginAtZero:!0,ticks:{color:l,callback:nh({format:o,locale:i})}},u={beginAtZero:!0,ticks:{color:l,callback:nh({format:s,locale:i})}},g=e.getDefinition(),{useLeftAxis:p,useRightAxis:f}=eh(g);p&&(c.options.scales.y={...d,position:"left",title:Jc(e.axesDesign?.y)}),f&&(c.options.scales.y1={...u,position:"right",grid:{display:!1},title:Jc(e.axesDesign?.y1)}),c.options.plugins.chartShowValuesPlugin={showValues:e.showValues,background:e.background,callback:nh({format:o,locale:i})};const v=rh(g,r.length);let b=0;const S=[];for(let[e,{label:t,data:o,hidden:s}]of r.entries()){const i=g.dataSets[e],n=v.next(),a=i?.type??"line",l={label:i?.label??t,data:o,hidden:s,borderColor:n,backgroundColor:n,yAxisID:i?.yAxisId??"y",type:a,order:"bar"===a?r.length+e:e};c.data.datasets.push(l);const h=g.dataSets?.[e].trend;if(!h?.display)continue;b=Math.max(b,o.length);const d=oh(h,l);d&&S.push(d)}if(S.length){const e=Math.max(...S.map((e=>e.data.length)));c.options.scales[Uc]={labels:Array(Math.round(e)).fill(""),offset:!1,display:!1},S.forEach((e=>c.data.datasets.push(e))),c.options.plugins.tooltip.callbacks.title=function(e){return e.some((e=>e.dataset.xAxisID!==Uc))?void 0:""}}return{chartJsConfig:c,background:e.background||m}},validateChartDefinition:_x.validateChartDefinition,transformDefinition:_x.transformDefinition,getChartDefinitionFromContextCreation:_x.getDefinitionFromContextCreation,sequence:15}),zx.add("line",{match:e=>"line"===e,createChart:(e,t,o)=>new Lx(e,t,o),getChartRuntime:Ax,validateChartDefinition:Lx.validateChartDefinition,transformDefinition:Lx.transformDefinition,getChartDefinitionFromContextCreation:Lx.getDefinitionFromContextCreation,sequence:20}),zx.add("pie",{match:e=>"pie"===e,createChart:(e,t,o)=>new Vx(e,t,o),getChartRuntime:function(e,t){let o=uE(t,e.dataSets,e.labelRange).formattedValues,s=pE(t,e.dataSets).filter((e=>!e.hidden));Qc(e.labelRange,e.dataSets[0],e.dataSetsHaveTitle)&&o.shift(),({labels:o,dataSetsValues:s}=aE(o,s)),e.aggregated&&({labels:o,dataSetsValues:s}=lE(o,s)),({dataSetsValues:s,labels:o}=function(e,t){const o=e.reduce(((e,o,s)=>(t.some((e=>{const t=e.data[s];return"number"!=typeof t||t>=0}))&&e.push(s),e)),[]);return{labels:o.map((t=>e[t]||"")),dataSetsValues:t.map((e=>({...e,data:o.map((t=>{const o=e.data[t];return"number"!=typeof o||o>=0?o:0}))})))}}(o,s));const i=function(e,t,o){const s=Yc(e.background),i=hE(e,t,s,o),n={labels:{color:s}};return!e.labelRange&&1===e.dataSets.length||"none"===e.legendPosition?n.display=!1:n.position=e.legendPosition,Object.assign(i.options.plugins.legend||{},n),i.options.layout={padding:{left:20,right:20,top:e.title?10:25,bottom:10}},i.options.plugins.tooltip.callbacks.title=function(e){return e[0].dataset.label},i.options.plugins.tooltip.callbacks.label=function(e){const{format:t,locale:s}=o,i=function(e,t){const o=e.filter((e=>"number"==typeof e)).reduce(((e,t)=>e+t),0);if(!o)return"";return(e[t]/o*100).toFixed(2)}(e.dataset.data,e.dataIndex),n=e.label||e.dataset.label,r=e.parsed.y??e.parsed,a=Ln(r,{format:!t&&r>=1e3?"#,##":t,locale:s});return n?`${n}: ${a} (${i}%)`:`${a} (${i}%)`},i.options.plugins.chartShowValuesPlugin={showValues:e.showValues,callback:nh(o)},i}(e,o,{format:gE(t,e.dataSets),locale:t.getLocale()}),n=Math.max(0,...s.map((e=>e?.data?.length??0))),r=function(e,t){const o=[],s=Rt(t.map((e=>e.data.length)));for(let t=0;t<=s;t++)o.push(e.next());return o}(new to(n),s);for(const{label:t,data:o}of s){const s={label:t,data:o,borderColor:e.background||"#FFFFFF",backgroundColor:r,hoverOffset:30};i.data.datasets.push(s)}return e.isDoughnut&&(i.type="doughnut"),{chartJsConfig:i,background:e.background||m}},validateChartDefinition:Vx.validateChartDefinition,transformDefinition:Vx.transformDefinition,getChartDefinitionFromContextCreation:Vx.getDefinitionFromContextCreation,sequence:30}),zx.add("scorecard",{match:e=>"scorecard"===e,createChart:(e,t,o)=>new eE(e,t,o),getChartRuntime:function(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?or(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!==zs.number||e.type!==zs.number)return s?or(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?or({value:n,format:r},i):Ln(n,{format:r,locale:i})}(n,o,e.baselineMode,e.humanize??!1,i),h="progress"===e.baselineMode&&Vs(c,i)?wi(c,i):0;return{title:{...e.title,text:e.title.text?Ro(e.title.text):""},keyValue:s,baselineDisplay:c,baselineArrow:Yw(n,o,e.baselineMode),baselineColor:jw(n,e.baselineMode,o,e.baselineColorUp,e.baselineColorDown),baselineDescr:"progress"!==e.baselineMode&&e.baselineDescr?Ro(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}},validateChartDefinition:eE.validateChartDefinition,transformDefinition:eE.transformDefinition,getChartDefinitionFromContextCreation:eE.getDefinitionFromContextCreation,sequence:40}),zx.add("gauge",{match:e=>"gauge"===e,createChart:(e,t,o)=>new Nx(e,t,o),getChartRuntime:function(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===zs.number&&(i=e.value,n=e.formattedValue,r=e.format)}const l=Number(e.sectionRule.rangeMin),c=Number(e.sectionRule.rangeMax),h=e.sectionRule.lowerInflectionPoint,d=e.sectionRule.upperInflectionPoint,u=kx(h,l,c),g=kx(d,l,c),p=[],m=[];return void 0!==u&&(p.push({value:u,label:Ln(u,{locale:o,format:r}),operator:h.operator}),m.push(s.lowerColor)),void 0!==g&&g!==u&&(p.push({value:g,label:Ln(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:Ro(e.title.text??"")},minValue:{value:l,label:Ln(l,{locale:o,format:r})},maxValue:{value:c,label:Ln(c,{locale:o,format:r})},gaugeValue:void 0!==i&&n?{value:i,label:n}:void 0,inflectionValues:p,colors:m}},validateChartDefinition:Nx.validateChartDefinition,transformDefinition:Nx.transformDefinition,getChartDefinitionFromContextCreation:Nx.getDefinitionFromContextCreation,sequence:50}),zx.add("scatter",{match:e=>"scatter"===e,createChart:(e,t,o)=>new Hx(e,t,o),getChartRuntime:function(e,t){const{chartJsConfig:o,background:s}=Ax(e,t);o.type="line";for(const e of o.data.datasets)e.showLine="showLine"in e&&e.showLine;return{chartJsConfig:o,background:s}},validateChartDefinition:Hx.validateChartDefinition,transformDefinition:Hx.transformDefinition,getChartDefinitionFromContextCreation:Hx.getDefinitionFromContextCreation,sequence:60}),zx.add("waterfall",{match:e=>"waterfall"===e,createChart:(e,t,o)=>new Bx(e,t,o),getChartRuntime:function(e,t){let o=uE(t,e.dataSets,e.labelRange).formattedValues,s=pE(t,e.dataSets).filter((e=>!e.hidden));Qc(e.labelRange,e.dataSets[0],e.dataSetsHaveTitle)&&o.shift(),({labels:o,dataSetsValues:s}=aE(o,s)),e.aggregated&&({labels:o,dataSetsValues:s}=lE(o,s)),e.showSubTotals&&o.push(Ro("Subtotal"));const i=gE(t,e.dataSets),n=t.getLocale(),r=function(e,t,o,s,i){const{locale:n,format:r}=s,a=Yc(e.background),l=hE(e,t,a,s),c=e.negativeValuesColor||T,h=e.positiveValuesColor||R,d=e.subTotalValuesColor||A,u={labels:{generateLabels:()=>{const t=[{text:Ro("Positive values"),fontColor:a,fillStyle:h,strokeStyle:h},{text:Ro("Negative values"),fontColor:a,fillStyle:c,strokeStyle:c}];return(e.showSubTotals||e.firstValueAsSubtotal)&&t.push({text:Ro("Subtotals"),fontColor:a,fillStyle:d,strokeStyle:d}),t}}};"none"===e.legendPosition?u.display=!1:u.position=e.legendPosition,l.options.plugins.legend={...l.options.plugins?.legend,...u},l.options.layout={padding:{left:20,right:20,top:e.title?10:25,bottom:10}},l.options.scales={x:{ticks:{padding:5,color:a},grid:{display:!1},title:Jc(e.axesDesign?.x)},y:{position:e.verticalAxisPosition,ticks:{color:a,callback:e=>(e=Number(e),isNaN(e)?e:Ln(e,{locale:n,format:!r&&Math.abs(e)>1e3?"#,##":r}))},grid:{lineWidth:e=>0===e.tick.value?2:1},title:Jc(e.axesDesign?.y)}},l.options.plugins.tooltip={callbacks:{label:function(e){const[s,i]=e.raw,a=i-s,l=Math.floor(e.dataIndex/t.length),c=o[l],h=Ln(a,{format:!r&&Math.abs(a)>1e3?"#,##":r,locale:n});return c?`${c}: ${h}`:h}}},l.options.plugins.waterfallLinesPlugin={showConnectorLines:e.showConnectorLines};const g=i.reduce(((e,t)=>(e.push((e.at(-1)||-1)+t.data.length+1),e)),[]);return l.options.plugins.chartShowValuesPlugin={showValues:e.showValues,background:e.background,callback:(t,o,i)=>{const n=o._dataset.data[i],r=n[1]-n[0];let a=r>=0?"+":"";return e.showSubTotals&&g.includes(i)&&"+"===a&&(a=""),`${a}${nh(s)(r)}`}},l}(e,o,s.map((e=>e.label)),{format:i,locale:n},s);r.type="bar";const a=e.negativeValuesColor||T,l=e.positiveValuesColor||R,c=e.subTotalValuesColor||A,h=[],d=[],u={label:"",data:d,backgroundColor:h},g=[];let p=0;for(const t of s){for(let i=0;i<t.data.length;i++){const n=t.data[i];if(g.push(o[i]),isNaN(Number(n))){d.push([p,p]),h.push("");continue}d.push([p,n+p]);let r=n>=0?l:a;0===i&&t===s[0]&&e.firstValueAsSubtotal&&(r=c),h.push(r),p+=n}e.showSubTotals&&(g.push(Ro("Subtotal")),d.push([0,p]),h.push(c))}return r.data.datasets.push(u),r.data.labels=g.map(cE),{chartJsConfig:r,background:e.background||m}},validateChartDefinition:Bx.validateChartDefinition,transformDefinition:Bx.transformDefinition,getChartDefinitionFromContextCreation:Bx.getDefinitionFromContextCreation,sequence:70}),zx.add("pyramid",{match:e=>"pyramid"===e,createChart:(e,t,o)=>new Ux(e,t,o),getChartRuntime:function(e,t){const o={...e.getDefinition(),type:"bar"},s=vx(new fx(o,e.sheetId,t),t).chartJsConfig;let i=s.data?.datasets.filter((e=>!e.hidden));i&&i[0]&&(i[0].data=i[0].data.map((e=>e>0?e:0))),i&&i[1]&&(i[1].data=i[1].data.map((e=>e>0?-e:0)));const n=Math.max(...s.data?.datasets.map((e=>Math.max(...e.data.map(Math.abs))))),r=s.options.scales,a=r.x.ticks.callback;r.x.ticks.callback=e=>a(Math.abs(e)),r.x.suggestedMin=-n,r.x.suggestedMax=n;const l=s.options.plugins.tooltip.callbacks.label;s.options.plugins.tooltip.callbacks.label=e=>{const t={...e,parsed:{y:e.parsed.y,x:Math.abs(e.parsed.x)}};return l(t)};const c=s.options.plugins.chartShowValuesPlugin.callback;return s.options.plugins.chartShowValuesPlugin.callback=(e,t,o)=>c(Math.abs(e),t,o),{chartJsConfig:s,background:e.background||m}},validateChartDefinition:Ux.validateChartDefinition,transformDefinition:Ux.transformDefinition,getChartDefinitionFromContextCreation:Ux.getDefinitionFromContextCreation,sequence:80});const $x=new n;$x.add("line",yE),$x.add("bar",yE),$x.add("combo",yE),$x.add("pie",yE),$x.add("gauge",px),$x.add("scatter",yE),$x.add("scorecard",CE),$x.add("waterfall",yE),$x.add("pyramid",yE);const Gx={line:Ro("Line"),column:Ro("Column"),bar:Ro("Bar"),area:Ro("Area"),pie:Ro("Pie"),misc:Ro("Miscellaneous")},Wx=new n;Wx.add("line",{matcher:e=>"line"===e.type&&!e.stacked&&!e.fillArea,displayName:Ro("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:Ro("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:Ro("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:Ro("Stacked Area"),chartType:"line",chartSubtype:"stacked_area",subtypeDefinition:{stacked:!0,fillArea:!0},category:"area",preview:"o-spreadsheet-ChartPreview.STACKED_AREA_CHART"}).add("scatter",{displayName:Ro("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:Ro("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:Ro("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:Ro("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:Ro("Stacked Bar"),chartType:"bar",chartSubtype:"stacked_bar",subtypeDefinition:{horizontal:!0,stacked:!0},category:"bar",preview:"o-spreadsheet-ChartPreview.STACKED_BAR_CHART"}).add("combo",{displayName:Ro("Combo"),chartSubtype:"combo",chartType:"combo",category:"line",preview:"o-spreadsheet-ChartPreview.COMBO_CHART"}).add("pie",{matcher:e=>"pie"===e.type&&!e.isDoughnut,displayName:Ro("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:Ro("Doughnut"),chartSubtype:"doughnut",chartType:"pie",subtypeDefinition:{isDoughnut:!0},category:"pie",preview:"o-spreadsheet-ChartPreview.DOUGHNUT_CHART"}).add("gauge",{displayName:Ro("Gauge"),chartSubtype:"gauge",chartType:"gauge",category:"misc",preview:"o-spreadsheet-ChartPreview.GAUGE_CHART"}).add("scorecard",{displayName:Ro("Scorecard"),chartSubtype:"scorecard",chartType:"scorecard",category:"misc",preview:"o-spreadsheet-ChartPreview.SCORECARD_CHART"}).add("waterfall",{displayName:Ro("Waterfall"),chartSubtype:"waterfall",chartType:"waterfall",category:"misc",preview:"o-spreadsheet-ChartPreview.WATERFALL_CHART"}).add("pyramid",{displayName:Ro("Population Pyramid"),chartSubtype:"pyramid",chartType:"pyramid",category:"misc",preview:"o-spreadsheet-ChartPreview.POPULATION_PYRAMID_CHART"});const qx=new n;Lh`
137
+ `;class XE 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:UE,FunctionDescriptionProvider:$E};static defaultProps={inputStyle:"",isDefaultFocus:!1};DOMFocusableElementStore;composerRef=t.useRef("o_composer");contentHelper=new BE(this.composerRef.el);composerState=t.useState({positionStart:0,positionEnd:0});autoCompleteState;functionDescriptionState=t.useState({showDescription:!1,functionName:"",functionDescription:{},argToFocus:0});assistant=t.useState({forcedClosed:!1});compositionActive=!1;spreadsheetRect=NE();get assistantStyleProperties(){const e=this.composerRef.el.getBoundingClientRect(),t={},o=Math.min(this.props.rect?.width||1/0,WE);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+WE>this.props.delimitation.width&&(t.right="0px")}else t["max-height"]=this.spreadsheetRect.height-e.bottom-1+"px",e.left+WE+J+9>this.spreadsheetRect.width&&(t.right="9px");return t}get assistantStyle(){const e=this.assistantStyleProperties;return Hh({"max-height":e["max-height"],width:e.width,"min-width":e["min-width"]})}get assistantContainerStyle(){const e=this.assistantStyleProperties;return Hh({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:()=>console.warn("Not implemented"),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=Ac(xE),this.autoCompleteState=_c(HE),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)})),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]))}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 VE(e,this.env.model.selection);const o=this.props.composerStore.currentContent;"cellFocus"!==this.props.focus||this.autoCompleteState.provider||o.startsWith("=")?(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)+_e+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()}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[FE(e)]||this.keyCodeMapping[FE(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(Be(0,e,10))}onMousedown(e){e.button>0||this.contentHelper.removeSelection()}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(e.startsWith("=")){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]){if("inactive"!==this.props.focus){const{start:e,end:t}=this.props.composerStore.composerSelection;this.contentHelper.selectRange(e,t)}this.contentHelper.scrollSelectionIntoView()}this.shouldProcessInputEvents=!0}getContentLines(){let e=this.props.composerStore.currentContent;const t=e.startsWith("=");return""===e?[]:t&&"inactive"!==this.props.focus?this.splitHtmlContentIntoLines(this.getColoredTokens()):this.splitHtmlContentIntoLines([{value:e}])}getColoredTokens(){const e=this.props.composerStore.currentTokens,t=this.props.composerStore.tokenAtCursor,o=[],{end:s,start:i}=this.props.composerStore.composerSelection;for(const n of e){switch(n.type){case"OPERATOR":case"NUMBER":case"ARG_SEPARATOR":case"STRING":o.push({value:n.value,color:YE[n.type]||"#000"});break;case"REFERENCE":const{xc:e,sheetName:s}=Fr(n.value);o.push({value:n.value,color:this.rangeColor(e,s)||"#000"});break;case"SYMBOL":const i=n.value.toUpperCase();"TRUE"===i||"FALSE"===i?o.push({value:n.value,color:YE.NUMBER}):i in rS.content?o.push({value:n.value,color:YE.FUNCTION}):o.push({value:n.value,color:"#000"});break;case"LEFT_PAREN":case"RIGHT_PAREN":t&&["LEFT_PAREN","RIGHT_PAREN"].includes(t.type)&&t.parenIndex&&t.parenIndex===n.parenIndex?o.push({value:n.value,color:YE.MATCHING_PAREN||"#000"}):o.push({value:n.value,color:YE[n.type]||"#000"});break;default:o.push({value:n.value,color:"#000"})}this.props.composerStore.showSelectionIndicator&&s===i&&s===n.end&&(o[o.length-1].class=qE)}return o}splitHtmlContentIntoLines(e){const t=[];let o=[];for(const s of e)if(s.value.includes(_e)){const e=s.value.split(_e),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.class)}rangeColor(e,t){if("inactive"===this.props.focus)return;const o=this.props.composerStore.highlights,s=t?this.env.model.getters.getSheetIdByName(t):this.props.composerStore.sheetId,i=o.find((t=>{if(t.sheetId!==s)return!1;let o=this.env.model.getters.getRangeFromSheetXC(s,e).zone;return o=1===Jo(o)?this.env.model.getters.expandZone(s,o):o,Uo(o,t.zone)}));return i&&i.color?i.color:void 0}processTokenAtCursor(){let e=this.props.composerStore.currentContent;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(e.startsWith("=")&&o&&"SYMBOL"!==o.type){const e=o.functionContext,t=e?.parent.toUpperCase();if(e&&t&&t in GE&&"UNKNOWN"!==o.type){const o=GE[t],s=e.argPosition;this.functionDescriptionState.functionName=t,this.functionDescriptionState.functionDescription=o,this.functionDescriptionState.argToFocus=o.getArgToFocus(s+1)-1,this.functionDescriptionState.showDescription=!0}}}autoComplete(e){!e||this.assistant.forcedClosed&&this.canBeToggled||(this.autoCompleteState.provider?.selectProposal(e),this.processTokenAtCursor())}}const KE=["PIVOT.VALUE","PIVOT.HEADER","PIVOT"];function QE(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:YE.STRING}],fuzzySearchKey:s}}function JE(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 ex(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 tx(e){const t=e.functionContext?.args[0];if(t&&["STRING","NUMBER"].includes(t.type))return t.value}function ox(e){return xS(e,KE)[0]}function sx(e){return xS(e,KE).length}const ix=new n;ix.add("SPREADSHEET",!1),wE.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:YE.NUMBER}],fuzzySearchKey:o+t.name}})).filter(ot)},selectProposal:ex}),wE.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=tx(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:Ro("Count"),htmlContent:[{value:e,color:YE.STRING}],fuzzySearchKey:Ro("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:YE.STRING}],fuzzySearchKey:o}}(e)})).filter(ot):[]},selectProposal:JE}),wE.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=tx(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(ot),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=ix.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(ot);return m.map((e=>{const[t,o]=e.split(":"),s=n[t];return s?QE(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:Ro("%s (positional)",o.string)+(o.help?` (${o.help})`:""),htmlContent:[{value:s,color:YE.STRING}],fuzzySearchKey:o.string+s}}))).filter(ot)},selectProposal:JE}),wE.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=tx(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(Nn).map(((e,t)=>({text:`${t+1}`,fuzzySearchKey:e.toString(),description:e.toString(),htmlContent:[{value:`${t+1}`,color:YE.NUMBER}]}))):"quarter_number"===a.granularity?[1,2,3,4].map((e=>({text:`${e}`,fuzzySearchKey:`${e}`,description:Ro("Quarter %s",e),htmlContent:[{value:`${e}`,color:YE.NUMBER}]}))):"day_of_month"===a.granularity?ze(1,32).map((e=>({text:`${e}`,fuzzySearchKey:`${e}`,description:"",htmlContent:[{value:`${e}`,color:YE.NUMBER}]}))):"iso_week_number"===a.granularity?ze(0,54).map((e=>({text:`${e}`,fuzzySearchKey:`${e}`,description:"",htmlContent:[{value:`${e}`,color:YE.NUMBER}]}))):"day_of_week"===a.granularity?ze(1,8).map((e=>({text:`${e}`,fuzzySearchKey:`${e}`,description:"",htmlContent:[{value:`${e}`,color:YE.NUMBER}]}))):"hour_number"===a.granularity?ze(0,24).map((e=>({text:`${e}`,fuzzySearchKey:`${e}`,description:"",htmlContent:[{value:`${e}`,color:YE.NUMBER}]}))):"minute_number"===a.granularity?ze(0,60).map((e=>({text:`${e}`,fuzzySearchKey:`${e}`,description:"",htmlContent:[{value:`${e}`,color:YE.NUMBER}]}))):"second_number"===a.granularity?ze(0,60).map((e=>({text:`${e}`,fuzzySearchKey:`${e}`,description:"",htmlContent:[{value:`${e}`,color:YE.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?YE.STRING:YE.NUMBER}],fuzzySearchKey:s+i}}))},selectProposal:JE}),wE.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=Ue(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 nx=new n;nx.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=Ln(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=Pi(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=Rs(s);e.current=i;const n=o.getLocale(),r=Ln(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?hr(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 rx=new n,ax=/(\d+)$/,lx=/^(.*\D+)/,cx=/^(.*\D+)(\d+)$/;function hx(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:hr(n,{locale:oi,format:n.format});if(t&&o(t))s.push(t);else{if(i)return s;s=[]}}return s}function dx(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 ux(e){if(e.length<2)return 1;const t=e.map((e=>Pi(e,oi))),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=as.fromTimestamp(e[o-1].getTime()),i=Ps(s,t),n=Fs(s,t)%12;s.setFullYear(s.getFullYear()+i),s.setMonth(s.getMonth()+n);return{years:i,months:n,days:Ms(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}}rx.add("simple_value_copy",{condition:(e,t)=>!(1!==t.length||e.isFormula||e.format&&Wn(e.format)),generateRule:()=>({type:"COPY_MODIFIER"}),sequence:10}).add("increment_alphanumeric_value",{condition:e=>!e.isFormula&&hr(e,{locale:oi}).type===zs.text&&cx.test(e.content),generateRule:(e,t,o)=>{const s=parseInt(e.content.match(ax)[0]),i=e.content.match(lx)[0],n=e.content.length-i.length,r=hx(e,t,(e=>e.type===zs.text&&cx.test(e.value))).filter((e=>i===(e.value??"").toString().match(lx)[0])).map((e=>parseInt((e.value??"").toString().match(ax)[0])));let a=dx(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&&hr(e,{locale:oi}).type===zs.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&&hr(e,{locale:oi}).type===zs.number&&!!e.format&&Wn(e.format),generateRule:(e,t)=>{const o=ux(hx(e,t,(e=>e.type===zs.number&&!!e.format&&Wn(e.format))).map((e=>Number(e.value))));if(void 0===o)return{type:"COPY_MODIFIER"};const s=hr(e,{locale:oi});return"object"==typeof o?{type:"DATE_INCREMENT_MODIFIER",increment:o,current:s.type===zs.number?s.value:0}:{type:"INCREMENT_MODIFIER",increment:o,current:s.type===zs.number?s.value:0}},sequence:25}).add("increment_number",{condition:e=>!e.isFormula&&hr(e,{locale:oi}).type===zs.number,generateRule:(e,t,o)=>{const s=hx(e,t,(e=>e.type===zs.number&&!Wn(e.format||""))).map((e=>Number(e.value)));let i=dx(s);["up","left"].includes(o)&&1===s.length&&(i=-i);const n=hr(e,{locale:oi});return{type:"INCREMENT_MODIFIER",increment:i,current:n.type===zs.number?n.value:0}},sequence:40});const gx=new n;class px extends t.Component{static template="o-spreadsheet-GaugeChartComponent";canvas=t.useRef("chartContainer");get runtime(){return this.env.model.getters.getChartRuntime(this.props.figure.id)}setup(){t.useEffect((()=>Bw(this.canvas.el,this.runtime)),(()=>{const e=this.canvas.el.getBoundingClientRect();return[e.width,e.height,this.runtime,this.canvas.el,window.devicePixelRatio]}))}}function mx(e){return 8===(e=Nt(e).replace("#","")).length?e.slice(6)+e.slice(0,6):e}px.props={figure:Object};class fx extends Zw{dataSets;labelRange;background;legendPosition;stacked;aggregated;type="bar";dataSetsHaveTitle;dataSetDesign;axesDesign;horizontal;showValues;constructor(e,t,o){super(e,t,o),this.dataSets=Gc(o,e.dataSets,t,e.dataSetsHaveTitle),this.labelRange=kr(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){return jc(e,t)}static validateChartDefinition(e,t){return e.checkValidations(t,Xc,Kc)}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}}copyForSheetId(e){const t=Bc(this.sheetId,e,this.dataSets),o=zc(this.sheetId,e,this.labelRange),s=this.getDefinitionWithSpecificDataSets(t,o,e);return new fx(s,e,this.getters)}copyInSheetId(e){const t=this.getDefinitionWithSpecificDataSets(this.dataSets,this.labelRange,e);return new fx(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=>qc(this.getters,e))).filter((e=>""!==e.range&&e.range!==li.InvalidReference)),t=Zc(this.getters,this.labelRange,Qc(this.labelRange,this.dataSets[0],this.dataSetsHaveTitle)),o=this.getDefinition();return{...o,backgroundColor:mx(this.background||m),fontColor:mx(Yc(this.background)),dataSets:e,labelRange:t,verticalAxis:eh(o)}}updateRanges(e){const{dataSets:t,labelRange:o,isStale:s}=Hc(this.getters,e,this.dataSets,this.labelRange);if(!s)return this;const i=this.getDefinitionWithSpecificDataSets(t,o);return new fx(i,this.sheetId,this.getters)}}function vx(e,t){let o=uE(t,e.dataSets,e.labelRange).formattedValues,s=pE(t,e.dataSets);Qc(e.labelRange,e.dataSets[0],e.dataSetsHaveTitle)&&o.shift(),({labels:o,dataSetsValues:s}=aE(o,s)),e.aggregated&&({labels:o,dataSetsValues:s}=lE(o,s));const i={format:gE(t,e.dataSets),locale:t.getLocale()},n=Yc(e.background),r=hE(e,o,n,{...i,horizontalChart:e.horizontal}),a=bE(n);"none"===e.legendPosition?a.display=!1:a.position=e.legendPosition,r.options.plugins.legend={...r.options.plugins?.legend,...a},r.options.layout={padding:th({displayTitle:!!e.title.text,displayLegend:"top"===e.legendPosition})},r.options.indexAxis=e.horizontal?"y":"x",r.options.scales={};const l={ticks:{padding:5,color:n}},c={beginAtZero:!0,ticks:{color:n,callback:nh(i)}},h=e.horizontal?c:l,d=e.horizontal?l:c,{useLeftAxis:u,useRightAxis:g}=eh(e.getDefinition());r.options.scales.x={...h,title:Jc(e.axesDesign?.x)},u&&(r.options.scales.y={...d,position:"left",title:Jc(e.axesDesign?.y)}),g&&(r.options.scales.y1={...d,position:"right",title:Jc(e.axesDesign?.y1)}),e.stacked&&(r.options.scales.x.stacked=!0,u&&(r.options.scales.y.stacked=!0),g&&(r.options.scales.y1.stacked=!0)),r.options.plugins.chartShowValuesPlugin={showValues:e.showValues,background:e.background,horizontal:e.horizontal,callback:nh(i)};const p=e.getDefinition(),f=rh(p,s.length),v=[];for(const t in s){const{label:o,data:i,hidden:n}=s[t],a=f.next(),l={label:o,data:i,hidden:n,borderColor:p.background||m,borderWidth:p.stacked?1:0,backgroundColor:a};if(r.data.datasets.push(l),p.dataSets?.[t]?.label){const e=p.dataSets[t].label;l.label=e}p.dataSets?.[t]?.yAxisId&&!e.horizontal&&(l.yAxisID=p.dataSets[t].yAxisId);const c=p.dataSets?.[t].trend;if(!c?.display||e.horizontal)continue;const h=oh(c,l);h&&v.push(h)}if(v.length){const e=Math.max(...v.map((e=>e.data.length)));r.options.scales[Uc]={...h,labels:Array(e).fill(""),offset:!1,display:!1},v.forEach((e=>r.data.datasets.push(e))),r.options.plugins.tooltip.callbacks.title=function(e){return e.some((e=>e.dataset.xAxisID!==Uc))?void 0:""}}return{chartJsConfig:r,background:e.background||m}}const bx={second:1e3,minute:6e4,hour:36e5,day:864e5,month:2592e6,year:31536e6},Sx={inSeconds:function(e){return Math.floor(e/bx.second)},inMinutes:function(e){return Math.floor(e/bx.minute)},inHours:function(e){return Math.floor(e/bx.hour)},inDays:function(e){return Math.floor(e/bx.day)},inMonths:function(e){return Math.floor(e/bx.month)},inYears:function(e){return Math.floor(e/bx.year)}},yx=/^((d|dd|m|mm|yyyy|yy|hh|h|ss|a)(-|:|\s|\/))*(d|dd|m|mm|yyyy|yy|hh|h|ss|a)$/i;function Cx(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=>Es(e,o)?.jsDate));if(s.some((e=>void 0===e))||e.length<2)return;const i=s.map((e=>e.getTime())),n=Rt(i)-Tt(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(bx.second>=bx[r]&&Sx.inSeconds(n)<180)return"second";if(bx.minute>=bx[r]&&Sx.inMinutes(n)<180)return"minute";if(bx.hour>=bx[r]&&Sx.inHours(n)<96)return"hour";if(bx.day>=bx[r]&&Sx.inDays(n)<90)return"day";if(bx.month>=bx[r]&&Sx.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 wx(e,t){return xx(e,t)||Ix(e,t)}function Ex(e,t){return function(e,t){return!e.labelsAsText&&xx(e,t)}(e,t)&&function(){const e=SE();if(!e)return!1;const t="luxon"===new e._adapters._date({})._id;t||Rx||(Rx=!0,console.warn("'chartjs-adapter-luxon' time adapter is not installed. Time scale axes are disabled."));return t}()?"time":function(e,t){return!e.labelsAsText&&Ix(e,t)}(e,t)?"linear":"category"}function xx(e,t){if(!e.labelRange||!Ix(e,t))return!1;const o=dE(t,e.labelRange,Qc(e.labelRange,e.dataSets[0],e.dataSetsHaveTitle));return Boolean(o&&yx.test(o))}function Ix(e,t){if(!e.labelRange)return!1;const o=t.getRangeValues(e.labelRange);return Qc(e.labelRange,e.dataSets[0],e.dataSetsHaveTitle)&&o.shift(),!o.some((e=>isNaN(Number(e))&&e))&&!o.every((e=>!e))}let Rx=!1;function Tx(e,t,o,s){const i=[],n=[],r=[],a=t.data.length;if(t.hidden)return;if(a<2)return;switch(o){case"category":for(let e=0;e<a;e++)"number"==typeof t.data[e]&&(i.push(t.data[e]),n.push(e+1)),r.push(e+1);break;case"linear":for(const e of t.data){const t=Number(e.x);isNaN(t)||("number"==typeof e.y&&(i.push(e.y),n.push(t)),r.push(t))}break;case"time":for(const e of t.data){const t=wi({value:e.x},s);null!==e.y&&(i.push(e.y),n.push(t)),r.push(t)}}const l=Math.min(...r),c=Math.max(...r);if(c===l)return;const h=(c-l)/(5*r.length),d=ze(l,c+h/2,h),u=ih(e,i,n,d);return u.length?sh(t,e,u,d):void 0}function Ax(e,t){const o=Ex(e,t),s=uE(t,e.dataSets,e.labelRange);let i="linear"===o?s.values:s.formattedValues,n=pE(t,e.dataSets);const r=Qc(e.labelRange,e.dataSets[0],e.dataSetsHaveTitle);r&&i.shift(),({labels:i,dataSetsValues:n}=aE(i,n)),"time"===o&&({labels:i,dataSetsValues:n}=function(e,t){if(0===e.length||e.every((e=>!e)))return{labels:e,dataSetsValues:t};const o=[...e],s=ke(t);for(let e=0;e<o.length;e++)if(!o[e]){o[e]=lt(o,e);for(let t of s)t.data[e]=void 0}return{labels:o,dataSetsValues:s}}(i,n)),e.aggregated&&({labels:i,dataSetsValues:n}=lE(i,n));const a=t.getLocale(),l="category"===o,c=gE(t,e.dataSets),h={format:c,locale:a,truncateLabels:l},d=Yc(e.background),u=hE(e,i,d,h),g=bE(d,{labels:{generateLabels(e){const{data:t}=e,o=SE().defaults.plugins.legend.labels.generateLabels(e);for(const[e,s]of o.entries())s.fillStyle=t.datasets[e].borderColor;return o}}});"none"===e.legendPosition?g.display=!1:g.position=e.legendPosition,Object.assign(u.options.plugins.legend||{},g),u.options.layout={padding:th({displayTitle:!!e.title.text,displayLegend:"top"===e.legendPosition})};const p={ticks:{padding:5,color:d},title:Jc(e.axesDesign?.x)};u.options.scales={x:p};const f={beginAtZero:!0,ticks:{color:d,callback:nh(h)}},{useLeftAxis:v,useRightAxis:b}=eh(e.getDefinition());v&&(u.options.scales.y={...f,position:"left",title:Jc(e.axesDesign?.y)}),b&&(u.options.scales.y1={...f,position:"right",title:Jc(e.axesDesign?.y1)}),"stacked"in e&&e.stacked&&(v&&(u.options.scales.y.stacked=!0),b&&(u.options.scales.y1.stacked=!0)),u.options.plugins.chartShowValuesPlugin={showValues:e.showValues,background:e.background,callback:nh(h)};const S=dE(t,e.labelRange,r);if("time"===o){const e={type:"time",time:Cx(i,S,a)};Object.assign(u.options.scales.x,e),u.options.scales.x.ticks.maxTicksLimit=15}else"linear"===o&&(u.options.scales.x.type="linear",u.options.scales.x.ticks.callback=e=>Ln(e,{format:S,locale:a}),u.options.plugins.tooltip.callbacks.label=e=>{let t,o;e.dataset.xAxisID===Uc?(t=n[e.datasetIndex].data[e.dataIndex].y,o=""):(t=n[e.datasetIndex].data[e.dataIndex],o=s.values[e.dataIndex]),Vs(o,a)&&(o=wi(o,a));const i=Ln(o,{locale:a,format:S}),r=Ln(t,{locale:a,format:c}),l=e.dataset.label;return i?`${l}: (${i}, ${r})`:`${l}: ${r}`});const y="fillArea"in e&&e.fillArea,C="stacked"in e&&e.stacked,w="cumulative"in e&&e.cumulative,E=e.getDefinition(),x=rh(E,n.length);for(let[e,{label:t,data:s,hidden:r}]of n.entries()){const n=x.next();let a=Bt(n);if(y&&(a.a=we),w){let e=0;s=s.map((t=>isNaN(t)?t:(e+=parseFloat(t),e)))}["linear","time"].includes(o)&&(s=s.map(((e,t)=>({x:i[t]||void 0,y:e}))));const l={label:t,data:s,hidden:r,tension:0,borderColor:n,backgroundColor:Ht(a),pointBackgroundColor:n,fill:!!y&&mE(e,C)};u.data.datasets.push(l)}let I=0;const R=[];for(const[e,t]of u.data.datasets.entries()){if(E.dataSets?.[e]?.label){const o=E.dataSets[e].label;t.label=o}E.dataSets?.[e]?.yAxisId&&(t.yAxisID=E.dataSets[e].yAxisId);const s=E.dataSets?.[e].trend;if(!s?.display)continue;const i=Tx(s,t,o,a);i&&(I=Math.max(I,i.data.length),R.push(i),n.push(i))}return R.length&&(u.options.scales[Uc]={...p,display:!1},"category"!==o&&"time"!==o||(u.options.scales[Uc].type="category",u.options.scales[Uc].labels=ze(0,I).map((e=>e.toString())),u.options.scales[Uc].offset=!1),R.forEach((e=>u.data.datasets.push(e)))),u.options.plugins.tooltip.callbacks.title=function(e){return"linear"!==o&&e.some((e=>e.dataset.xAxisID!==Uc))?void 0:""},{chartJsConfig:u,background:e.background||m}}class _x extends Zw{dataSets;labelRange;background;legendPosition;aggregated;dataSetsHaveTitle;dataSetDesign;axesDesign;type="combo";showValues;constructor(e,t,o){super(e,t,o),this.dataSets=Gc(o,e.dataSets,t,e.dataSetsHaveTitle),this.labelRange=kr(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){return jc(e,t)}static validateChartDefinition(e,t){return e.checkValidations(t,Xc,Kc)}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=>qc(this.getters,e))).filter((e=>""!==e.range&&e.range!==li.InvalidReference)),t=Zc(this.getters,this.labelRange,Qc(this.labelRange,this.dataSets[0],this.dataSetsHaveTitle)),o=this.getDefinition();return{...o,backgroundColor:mx(this.background||m),fontColor:mx(Yc(this.background)),dataSets:e,labelRange:t,verticalAxis:eh(o)}}updateRanges(e){const{dataSets:t,labelRange:o,isStale:s}=Hc(this.getters,e,this.dataSets,this.labelRange);if(!s)return this;const i=this.getDefinitionWithSpecificDataSets(t,o);return new _x(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}}copyForSheetId(e){const t=Bc(this.sheetId,e,this.dataSets),o=zc(this.sheetId,e,this.labelRange),s=this.getDefinitionWithSpecificDataSets(t,o,e);return new _x(s,e,this.getters)}copyInSheetId(e){const t=this.getDefinitionWithSpecificDataSets(this.dataSets,this.labelRange,e);return new _x(t,e,this.getters)}}function Dx(e){return e.dataRange&&!Tr.test(e.dataRange)?"InvalidGaugeDataRange":"Success"}function Ox(e,t){return t((t=>t.sectionRule?e(t.sectionRule.rangeMin,"rangeMin"):"Success"),(t=>t.sectionRule?e(t.sectionRule.rangeMax,"rangeMax"):"Success"))}function Fx(e){return e.sectionRule&&Number(e.sectionRule.rangeMin)>=Number(e.sectionRule.rangeMax)?"GaugeRangeMinBiggerThanRangeMax":"Success"}function Mx(e,t){if(""===e)switch(t){case"rangeMin":return"EmptyGaugeRangeMin";case"rangeMax":return"EmptyGaugeRangeMax"}return"Success"}function Px(e,t){if(isNaN(e))switch(t){case"rangeMin":return"GaugeRangeMinNaN";case"rangeMax":return"GaugeRangeMaxNaN";case"lowerInflectionPointValue":return"GaugeLowerInflectionPointNaN";case"upperInflectionPointValue":return"GaugeUpperInflectionPointNaN"}return"Success"}class Nx extends Zw{dataRange;sectionRule;background;type="gauge";constructor(e,t,o){super(e,t,o),this.dataRange=kr(this.getters,this.sheetId,e.dataRange),this.sectionRule=e.sectionRule,this.background=e.background}static validateChartDefinition(e,t){return e.checkValidations(t,Dx,e.chainValidations(Ox(Mx,e.batchValidations),Ox(Px,e.batchValidations),Fx),e.chainValidations((o=Px,(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){let o;return e.dataRange&&(o=Cc(Ao(e.dataRange),t)),{...e,dataRange:o?Fo(o):void 0}}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:"<="}}}}copyForSheetId(e){const t=zc(this.sheetId,e,this.dataRange),o=this.getDefinitionWithSpecificRanges(t,e);return new Nx(o,e,this.getters)}copyInSheetId(e){const t=this.getDefinitionWithSpecificRanges(this.dataRange,e);return new Nx(t,e,this.getters)}getDefinition(){return this.getDefinitionWithSpecificRanges(this.dataRange)}getDefinitionWithSpecificRanges(e,t){return{background:this.background,sectionRule:this.sectionRule,title:this.title,type:"gauge",dataRange:e?this.getters.getRangeString(e,t||this.sheetId):void 0}}getDefinitionForExcel(){}getContextCreation(){return{...this,range:this.dataRange?[{dataRange:this.getters.getRangeString(this.dataRange,this.sheetId)}]:void 0}}updateRanges(e){const t=$c(this.dataRange,e);if(this.dataRange===t)return this;const o=this.getDefinitionWithSpecificRanges(t);return new Nx(o,this.sheetId,this.getters)}}function kx(e,t,o){if(""===e.value||isNaN(Number(e.value)))return;const s=Number(e.value);return Be("number"===e.type?s:t+(o-t)*s/100,t,o)}class Lx extends Zw{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=Gc(this.getters,e.dataSets,t,e.dataSetsHaveTitle),this.labelRange=kr(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,Xc,Kc)}static transformDefinition(e,t){return jc(e,t)}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}=Hc(this.getters,e,this.dataSets,this.labelRange);if(!s)return this;const i=this.getDefinitionWithSpecificDataSets(t,o);return new Lx(i,this.sheetId,this.getters)}getDefinitionForExcel(){const e=this.dataSets.map((e=>qc(this.getters,e))).filter((e=>""!==e.range&&e.range!==li.InvalidReference)),t=Zc(this.getters,this.labelRange,Qc(this.labelRange,this.dataSets[0],this.dataSetsHaveTitle)),o=this.getDefinition();return{...o,backgroundColor:mx(this.background||m),fontColor:mx(Yc(this.background)),dataSets:e,labelRange:t,verticalAxis:eh(o)}}copyForSheetId(e){const t=Bc(this.sheetId,e,this.dataSets),o=zc(this.sheetId,e,this.labelRange),s=this.getDefinitionWithSpecificDataSets(t,o,e);return new Lx(s,e,this.getters)}copyInSheetId(e){const t=this.getDefinitionWithSpecificDataSets(this.dataSets,this.labelRange,e);return new Lx(t,e,this.getters)}}class Vx extends Zw{dataSets;labelRange;background;legendPosition;type="pie";aggregated;dataSetsHaveTitle;isDoughnut;showValues;constructor(e,t,o){super(e,t,o),this.dataSets=Gc(o,e.dataSets,t,e.dataSetsHaveTitle),this.labelRange=kr(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){return jc(e,t)}static validateChartDefinition(e,t){return e.checkValidations(t,Xc,Kc)}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}}copyForSheetId(e){const t=Bc(this.sheetId,e,this.dataSets),o=zc(this.sheetId,e,this.labelRange),s=this.getDefinitionWithSpecificDataSets(t,o,e);return new Vx(s,e,this.getters)}copyInSheetId(e){const t=this.getDefinitionWithSpecificDataSets(this.dataSets,this.labelRange,e);return new Vx(t,e,this.getters)}getDefinitionForExcel(){const e=this.dataSets.map((e=>qc(this.getters,e))).filter((e=>""!==e.range&&e.range!==li.InvalidReference)),t=Zc(this.getters,this.labelRange,Qc(this.labelRange,this.dataSets[0],this.dataSetsHaveTitle));return{...this.getDefinition(),backgroundColor:mx(this.background||m),fontColor:mx(Yc(this.background)),dataSets:e,labelRange:t}}updateRanges(e){const{dataSets:t,labelRange:o,isStale:s}=Hc(this.getters,e,this.dataSets,this.labelRange);if(!s)return this;const i=this.getDefinitionWithSpecificDataSets(t,o);return new Vx(i,this.sheetId,this.getters)}}class Ux extends Zw{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=Gc(o,e.dataSets,t,e.dataSetsHaveTitle).slice(0,2),this.labelRange=kr(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){return jc(e,t)}static validateChartDefinition(e,t){return e.checkValidations(t,Xc,Kc)}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}}copyForSheetId(e){const t=Bc(this.sheetId,e,this.dataSets),o=zc(this.sheetId,e,this.labelRange),s=this.getDefinitionWithSpecificDataSets(t,o,e);return new Ux(s,e,this.getters)}copyInSheetId(e){const t=this.getDefinitionWithSpecificDataSets(this.dataSets,this.labelRange,e);return new Ux(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}=Hc(this.getters,e,this.dataSets,this.labelRange);if(!s)return this;const i=this.getDefinitionWithSpecificDataSets(t,o);return new Ux(i,this.sheetId,this.getters)}}class Hx extends Zw{dataSets;labelRange;background;legendPosition;labelsAsText;aggregated;type="scatter";dataSetsHaveTitle;dataSetDesign;axesDesign;showValues;constructor(e,t,o){super(e,t,o),this.dataSets=Gc(this.getters,e.dataSets,t,e.dataSetsHaveTitle),this.labelRange=kr(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,Xc,Kc)}static transformDefinition(e,t){return jc(e,t)}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}=Hc(this.getters,e,this.dataSets,this.labelRange);if(!s)return this;const i=this.getDefinitionWithSpecificDataSets(t,o);return new Hx(i,this.sheetId,this.getters)}getDefinitionForExcel(){const e=this.dataSets.map((e=>qc(this.getters,e))).filter((e=>""!==e.range)),t=Zc(this.getters,this.labelRange,Qc(this.labelRange,this.dataSets[0],this.dataSetsHaveTitle)),o=this.getDefinition();return{...o,backgroundColor:mx(this.background||m),fontColor:mx(Yc(this.background)),dataSets:e,labelRange:t,verticalAxis:eh(o)}}copyForSheetId(e){const t=Bc(this.sheetId,e,this.dataSets),o=zc(this.sheetId,e,this.labelRange),s=this.getDefinitionWithSpecificDataSets(t,o,e);return new Hx(s,e,this.getters)}copyInSheetId(e){const t=this.getDefinitionWithSpecificDataSets(this.dataSets,this.labelRange,e);return new Hx(t,e,this.getters)}}class Bx extends Zw{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=Gc(o,e.dataSets,t,e.dataSetsHaveTitle),this.labelRange=kr(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){return jc(e,t)}static validateChartDefinition(e,t){return e.checkValidations(t,Xc,Kc)}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}}copyForSheetId(e){const t=Bc(this.sheetId,e,this.dataSets),o=zc(this.sheetId,e,this.labelRange),s=this.getDefinitionWithSpecificDataSets(t,o,e);return new Bx(s,e,this.getters)}copyInSheetId(e){const t=this.getDefinitionWithSpecificDataSets(this.dataSets,this.labelRange,e);return new Bx(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}=Hc(this.getters,e,this.dataSets,this.labelRange);if(!s)return this;const i=this.getDefinitionWithSpecificDataSets(t,o);return new Bx(i,this.sheetId,this.getters)}}const zx=new n;zx.add("bar",{match:e=>"bar"===e,createChart:(e,t,o)=>new fx(e,t,o),getChartRuntime:vx,validateChartDefinition:fx.validateChartDefinition,transformDefinition:fx.transformDefinition,getChartDefinitionFromContextCreation:fx.getDefinitionFromContextCreation,sequence:10}),zx.add("combo",{match:e=>"combo"===e,createChart:(e,t,o)=>new _x(e,t,o),getChartRuntime:function(e,t){const o=e.dataSets.length?gE(t,[e.dataSets[0]]):void 0,s=gE(t,e.dataSets.slice(1)),i=t.getLocale();let n=uE(t,e.dataSets,e.labelRange).formattedValues,r=pE(t,e.dataSets);Qc(e.labelRange,e.dataSets[0],e.dataSetsHaveTitle)&&n.shift(),({labels:n,dataSetsValues:r}=aE(n,r)),e.aggregated&&({labels:n,dataSetsValues:r}=lE(n,r));const a={format:o,locale:i},l=Yc(e.background),c=hE(e,n,l,a),h=bE(l);"none"===e.legendPosition?h.display=!1:h.position=e.legendPosition,c.options.plugins.legend={...c.options.plugins?.legend,...h},c.options.layout={padding:th({displayTitle:!!e.title.text,displayLegend:"top"===e.legendPosition})},c.options.scales={x:{ticks:{padding:5,color:l},title:Jc(e.axesDesign?.x)}};const d={beginAtZero:!0,ticks:{color:l,callback:nh({format:o,locale:i})}},u={beginAtZero:!0,ticks:{color:l,callback:nh({format:s,locale:i})}},g=e.getDefinition(),{useLeftAxis:p,useRightAxis:f}=eh(g);p&&(c.options.scales.y={...d,position:"left",title:Jc(e.axesDesign?.y)}),f&&(c.options.scales.y1={...u,position:"right",grid:{display:!1},title:Jc(e.axesDesign?.y1)}),c.options.plugins.chartShowValuesPlugin={showValues:e.showValues,background:e.background,callback:nh({format:o,locale:i})};const v=rh(g,r.length);let b=0;const S=[];for(let[e,{label:t,data:o,hidden:s}]of r.entries()){const i=g.dataSets[e],n=v.next(),a=i?.type??"line",l={label:i?.label??t,data:o,hidden:s,borderColor:n,backgroundColor:n,yAxisID:i?.yAxisId??"y",type:a,order:"bar"===a?r.length+e:e};c.data.datasets.push(l);const h=g.dataSets?.[e].trend;if(!h?.display)continue;b=Math.max(b,o.length);const d=oh(h,l);d&&S.push(d)}if(S.length){const e=Math.max(...S.map((e=>e.data.length)));c.options.scales[Uc]={labels:Array(Math.round(e)).fill(""),offset:!1,display:!1},S.forEach((e=>c.data.datasets.push(e))),c.options.plugins.tooltip.callbacks.title=function(e){return e.some((e=>e.dataset.xAxisID!==Uc))?void 0:""}}return{chartJsConfig:c,background:e.background||m}},validateChartDefinition:_x.validateChartDefinition,transformDefinition:_x.transformDefinition,getChartDefinitionFromContextCreation:_x.getDefinitionFromContextCreation,sequence:15}),zx.add("line",{match:e=>"line"===e,createChart:(e,t,o)=>new Lx(e,t,o),getChartRuntime:Ax,validateChartDefinition:Lx.validateChartDefinition,transformDefinition:Lx.transformDefinition,getChartDefinitionFromContextCreation:Lx.getDefinitionFromContextCreation,sequence:20}),zx.add("pie",{match:e=>"pie"===e,createChart:(e,t,o)=>new Vx(e,t,o),getChartRuntime:function(e,t){let o=uE(t,e.dataSets,e.labelRange).formattedValues,s=pE(t,e.dataSets).filter((e=>!e.hidden));Qc(e.labelRange,e.dataSets[0],e.dataSetsHaveTitle)&&o.shift(),({labels:o,dataSetsValues:s}=aE(o,s)),e.aggregated&&({labels:o,dataSetsValues:s}=lE(o,s)),({dataSetsValues:s,labels:o}=function(e,t){const o=e.reduce(((e,o,s)=>(t.some((e=>{const t=e.data[s];return"number"!=typeof t||t>=0}))&&e.push(s),e)),[]);return{labels:o.map((t=>e[t]||"")),dataSetsValues:t.map((e=>({...e,data:o.map((t=>{const o=e.data[t];return"number"!=typeof o||o>=0?o:0}))})))}}(o,s));const i=function(e,t,o){const s=Yc(e.background),i=hE(e,t,s,o),n={labels:{color:s}};return!e.labelRange&&1===e.dataSets.length||"none"===e.legendPosition?n.display=!1:n.position=e.legendPosition,Object.assign(i.options.plugins.legend||{},n),i.options.layout={padding:{left:20,right:20,top:e.title?10:25,bottom:10}},i.options.plugins.tooltip.callbacks.title=function(e){return e[0].dataset.label},i.options.plugins.tooltip.callbacks.label=function(e){const{format:t,locale:s}=o,i=function(e,t){const o=e.filter((e=>"number"==typeof e)).reduce(((e,t)=>e+t),0);if(!o)return"";return(e[t]/o*100).toFixed(2)}(e.dataset.data,e.dataIndex),n=e.label||e.dataset.label,r=e.parsed.y??e.parsed,a=Ln(r,{format:!t&&r>=1e3?"#,##":t,locale:s});return n?`${n}: ${a} (${i}%)`:`${a} (${i}%)`},i.options.plugins.chartShowValuesPlugin={showValues:e.showValues,callback:nh(o)},i}(e,o,{format:gE(t,e.dataSets),locale:t.getLocale()}),n=Math.max(0,...s.map((e=>e?.data?.length??0))),r=function(e,t){const o=[],s=Rt(t.map((e=>e.data.length)));for(let t=0;t<=s;t++)o.push(e.next());return o}(new to(n),s);for(const{label:t,data:o}of s){const s={label:t,data:o,borderColor:e.background||"#FFFFFF",backgroundColor:r,hoverOffset:30};i.data.datasets.push(s)}return e.isDoughnut&&(i.type="doughnut"),{chartJsConfig:i,background:e.background||m}},validateChartDefinition:Vx.validateChartDefinition,transformDefinition:Vx.transformDefinition,getChartDefinitionFromContextCreation:Vx.getDefinitionFromContextCreation,sequence:30}),zx.add("scorecard",{match:e=>"scorecard"===e,createChart:(e,t,o)=>new eE(e,t,o),getChartRuntime:function(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?or(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!==zs.number||e.type!==zs.number)return s?or(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?or({value:n,format:r},i):Ln(n,{format:r,locale:i})}(n,o,e.baselineMode,e.humanize??!1,i),h="progress"===e.baselineMode&&Vs(c,i)?wi(c,i):0;return{title:{...e.title,text:e.title.text?Ro(e.title.text):""},keyValue:s,baselineDisplay:c,baselineArrow:Yw(n,o,e.baselineMode),baselineColor:jw(n,e.baselineMode,o,e.baselineColorUp,e.baselineColorDown),baselineDescr:"progress"!==e.baselineMode&&e.baselineDescr?Ro(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}},validateChartDefinition:eE.validateChartDefinition,transformDefinition:eE.transformDefinition,getChartDefinitionFromContextCreation:eE.getDefinitionFromContextCreation,sequence:40}),zx.add("gauge",{match:e=>"gauge"===e,createChart:(e,t,o)=>new Nx(e,t,o),getChartRuntime:function(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===zs.number&&(i=e.value,n=e.formattedValue,r=e.format)}const l=Number(e.sectionRule.rangeMin),c=Number(e.sectionRule.rangeMax),h=e.sectionRule.lowerInflectionPoint,d=e.sectionRule.upperInflectionPoint,u=kx(h,l,c),g=kx(d,l,c),p=[],m=[];return void 0!==u&&(p.push({value:u,label:Ln(u,{locale:o,format:r}),operator:h.operator}),m.push(s.lowerColor)),void 0!==g&&g!==u&&(p.push({value:g,label:Ln(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:Ro(e.title.text??"")},minValue:{value:l,label:Ln(l,{locale:o,format:r})},maxValue:{value:c,label:Ln(c,{locale:o,format:r})},gaugeValue:void 0!==i&&n?{value:i,label:n}:void 0,inflectionValues:p,colors:m}},validateChartDefinition:Nx.validateChartDefinition,transformDefinition:Nx.transformDefinition,getChartDefinitionFromContextCreation:Nx.getDefinitionFromContextCreation,sequence:50}),zx.add("scatter",{match:e=>"scatter"===e,createChart:(e,t,o)=>new Hx(e,t,o),getChartRuntime:function(e,t){const{chartJsConfig:o,background:s}=Ax(e,t);o.type="line";for(const e of o.data.datasets)e.showLine="showLine"in e&&e.showLine;return{chartJsConfig:o,background:s}},validateChartDefinition:Hx.validateChartDefinition,transformDefinition:Hx.transformDefinition,getChartDefinitionFromContextCreation:Hx.getDefinitionFromContextCreation,sequence:60}),zx.add("waterfall",{match:e=>"waterfall"===e,createChart:(e,t,o)=>new Bx(e,t,o),getChartRuntime:function(e,t){let o=uE(t,e.dataSets,e.labelRange).formattedValues,s=pE(t,e.dataSets).filter((e=>!e.hidden));Qc(e.labelRange,e.dataSets[0],e.dataSetsHaveTitle)&&o.shift(),({labels:o,dataSetsValues:s}=aE(o,s)),e.aggregated&&({labels:o,dataSetsValues:s}=lE(o,s)),e.showSubTotals&&o.push(Ro("Subtotal"));const i=gE(t,e.dataSets),n=t.getLocale(),r=function(e,t,o,s,i){const{locale:n,format:r}=s,a=Yc(e.background),l=hE(e,t,a,s),c=e.negativeValuesColor||T,h=e.positiveValuesColor||R,d=e.subTotalValuesColor||A,u={labels:{generateLabels:()=>{const t=[{text:Ro("Positive values"),fontColor:a,fillStyle:h,strokeStyle:h},{text:Ro("Negative values"),fontColor:a,fillStyle:c,strokeStyle:c}];return(e.showSubTotals||e.firstValueAsSubtotal)&&t.push({text:Ro("Subtotals"),fontColor:a,fillStyle:d,strokeStyle:d}),t}}};"none"===e.legendPosition?u.display=!1:u.position=e.legendPosition,l.options.plugins.legend={...l.options.plugins?.legend,...u},l.options.layout={padding:{left:20,right:20,top:e.title?10:25,bottom:10}},l.options.scales={x:{ticks:{padding:5,color:a},grid:{display:!1},title:Jc(e.axesDesign?.x)},y:{position:e.verticalAxisPosition,ticks:{color:a,callback:e=>(e=Number(e),isNaN(e)?e:Ln(e,{locale:n,format:!r&&Math.abs(e)>1e3?"#,##":r}))},grid:{lineWidth:e=>0===e.tick.value?2:1},title:Jc(e.axesDesign?.y)}},l.options.plugins.tooltip={callbacks:{label:function(e){const[s,i]=e.raw,a=i-s,l=Math.floor(e.dataIndex/t.length),c=o[l],h=Ln(a,{format:!r&&Math.abs(a)>1e3?"#,##":r,locale:n});return c?`${c}: ${h}`:h}}},l.options.plugins.waterfallLinesPlugin={showConnectorLines:e.showConnectorLines};const g=i.reduce(((e,t)=>(e.push((e.at(-1)||-1)+t.data.length+1),e)),[]);return l.options.plugins.chartShowValuesPlugin={showValues:e.showValues,background:e.background,callback:(t,o,i)=>{const n=o._dataset.data[i],r=n[1]-n[0];let a=r>=0?"+":"";return e.showSubTotals&&g.includes(i)&&"+"===a&&(a=""),`${a}${nh(s)(r)}`}},l}(e,o,s.map((e=>e.label)),{format:i,locale:n},s);r.type="bar";const a=e.negativeValuesColor||T,l=e.positiveValuesColor||R,c=e.subTotalValuesColor||A,h=[],d=[],u={label:"",data:d,backgroundColor:h},g=[];let p=0;for(const t of s){for(let i=0;i<t.data.length;i++){const n=t.data[i];if(g.push(o[i]),isNaN(Number(n))){d.push([p,p]),h.push("");continue}d.push([p,n+p]);let r=n>=0?l:a;0===i&&t===s[0]&&e.firstValueAsSubtotal&&(r=c),h.push(r),p+=n}e.showSubTotals&&(g.push(Ro("Subtotal")),d.push([0,p]),h.push(c))}return r.data.datasets.push(u),r.data.labels=g.map(cE),{chartJsConfig:r,background:e.background||m}},validateChartDefinition:Bx.validateChartDefinition,transformDefinition:Bx.transformDefinition,getChartDefinitionFromContextCreation:Bx.getDefinitionFromContextCreation,sequence:70}),zx.add("pyramid",{match:e=>"pyramid"===e,createChart:(e,t,o)=>new Ux(e,t,o),getChartRuntime:function(e,t){const o={...e.getDefinition(),type:"bar"},s=vx(new fx(o,e.sheetId,t),t).chartJsConfig;let i=s.data?.datasets.filter((e=>!e.hidden));i&&i[0]&&(i[0].data=i[0].data.map((e=>e>0?e:0))),i&&i[1]&&(i[1].data=i[1].data.map((e=>e>0?-e:0)));const n=Math.max(...s.data?.datasets.map((e=>Math.max(...e.data.map(Math.abs))))),r=s.options.scales,a=r.x.ticks.callback;r.x.ticks.callback=e=>a(Math.abs(e)),r.x.suggestedMin=-n,r.x.suggestedMax=n;const l=s.options.plugins.tooltip.callbacks.label;s.options.plugins.tooltip.callbacks.label=e=>{const t={...e,parsed:{y:e.parsed.y,x:Math.abs(e.parsed.x)}};return l(t)};const c=s.options.plugins.chartShowValuesPlugin.callback;return s.options.plugins.chartShowValuesPlugin.callback=(e,t,o)=>c(Math.abs(e),t,o),{chartJsConfig:s,background:e.background||m}},validateChartDefinition:Ux.validateChartDefinition,transformDefinition:Ux.transformDefinition,getChartDefinitionFromContextCreation:Ux.getDefinitionFromContextCreation,sequence:80});const $x=new n;$x.add("line",yE),$x.add("bar",yE),$x.add("combo",yE),$x.add("pie",yE),$x.add("gauge",px),$x.add("scatter",yE),$x.add("scorecard",CE),$x.add("waterfall",yE),$x.add("pyramid",yE);const Gx={line:Ro("Line"),column:Ro("Column"),bar:Ro("Bar"),area:Ro("Area"),pie:Ro("Pie"),misc:Ro("Miscellaneous")},Wx=new n;Wx.add("line",{matcher:e=>"line"===e.type&&!e.stacked&&!e.fillArea,displayName:Ro("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:Ro("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:Ro("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:Ro("Stacked Area"),chartType:"line",chartSubtype:"stacked_area",subtypeDefinition:{stacked:!0,fillArea:!0},category:"area",preview:"o-spreadsheet-ChartPreview.STACKED_AREA_CHART"}).add("scatter",{displayName:Ro("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:Ro("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:Ro("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:Ro("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:Ro("Stacked Bar"),chartType:"bar",chartSubtype:"stacked_bar",subtypeDefinition:{horizontal:!0,stacked:!0},category:"bar",preview:"o-spreadsheet-ChartPreview.STACKED_BAR_CHART"}).add("combo",{displayName:Ro("Combo"),chartSubtype:"combo",chartType:"combo",category:"line",preview:"o-spreadsheet-ChartPreview.COMBO_CHART"}).add("pie",{matcher:e=>"pie"===e.type&&!e.isDoughnut,displayName:Ro("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:Ro("Doughnut"),chartSubtype:"doughnut",chartType:"pie",subtypeDefinition:{isDoughnut:!0},category:"pie",preview:"o-spreadsheet-ChartPreview.DOUGHNUT_CHART"}).add("gauge",{displayName:Ro("Gauge"),chartSubtype:"gauge",chartType:"gauge",category:"misc",preview:"o-spreadsheet-ChartPreview.GAUGE_CHART"}).add("scorecard",{displayName:Ro("Scorecard"),chartSubtype:"scorecard",chartType:"scorecard",category:"misc",preview:"o-spreadsheet-ChartPreview.SCORECARD_CHART"}).add("waterfall",{displayName:Ro("Waterfall"),chartSubtype:"waterfall",chartType:"waterfall",category:"misc",preview:"o-spreadsheet-ChartPreview.WATERFALL_CHART"}).add("pyramid",{displayName:Ro("Population Pyramid"),chartSubtype:"pyramid",chartType:"pyramid",category:"misc",preview:"o-spreadsheet-ChartPreview.POPULATION_PYRAMID_CHART"});const qx=new n;Lh`
138
138
  .o-chart-container {
139
139
  width: 100%;
140
140
  height: 100%;
@@ -889,7 +889,7 @@
889
889
  }
890
890
  }
891
891
  }
892
- `;class L_ extends t.Component{static template="o-spreadsheet-ChartPanel";static components={Section:o_,ChartTypePicker:N_};static props={onCloseSidePanel:Function,figureId:String};store;get figureId(){return this.props.figureId}setup(){this.store=_c(k_)}updateChart(e,t){if(e!==this.figureId)return;const o={...this.getChartDefinition(this.figureId),...t};return this.env.model.dispatch("UPDATE_CHART",{definition:o,id:e,sheetId:this.env.model.getters.getFigureSheetId(e)})}canUpdateChart(e,t){if(e!==this.figureId||!this.env.model.getters.isChartDefined(e))return;const o={...this.getChartDefinition(this.figureId),...t};return this.env.model.canDispatch("UPDATE_CHART",{definition:o,id:e,sheetId:this.env.model.getters.getFigureSheetId(e)})}onTypeChange(e){this.figureId&&this.store.changeChartType(this.figureId,e)}get chartPanel(){if(!this.figureId)throw new Error("Chart not defined.");const e=this.env.model.getters.getChartType(this.figureId);if(!e)throw new Error("Chart not defined.");const t=P_.get(e);if(!t)throw new Error(`Component is not defined for type ${e}`);return t}getChartDefinition(e){return this.env.model.getters.getChartDefinition(e)}}class V_{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}}class U_ extends kc{mutators=["startEdition","setCurrentContent","stopEdition","stopComposerRangeSelection","cancelEdition","cycleReferences","changeComposerCursorSelection","replaceComposerCursorSelection"];col=0;row=0;editionMode="inactive";sheetId="";_currentContent="";currentTokens=[];selectionStart=0;selectionEnd=0;initialContent="";colorIndexByRange={};notificationStore=this.get(V_);highlightStore=this.get(QA);constructor(e){super(e),this.highlightStore.register(this),this.onDispose((()=>{this.highlightStore.unRegister(this)}))}handleEvent(e){const t=this.getters.getActiveSheetId();let o;if(o=e.options.unbounded?this.getters.getUnboundedZone(t,e.anchor.zone):e.anchor.zone,"newAnchor"===e.mode)"selecting"===this.editionMode&&this.insertSelectedRange(o);else"selecting"===this.editionMode?this.replaceSelectedRange(o):this.updateComposerRange(e.previousAnchor.zone,o)}changeComposerCursorSelection(e,t){this.isSelectionValid(this._currentContent.length,e,t)&&(this.selectionStart=e,this.selectionEnd=t)}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",{id:null}),this.model.dispatch("SCROLL_TO_CELL",{col:o,row:s}),"inactive"!==this.editionMode&&e?this.setContent(e,t):this._startEdition(e,t),this.updateRangeColor()}cancelEdition(){this.resetContent(),this.cancelEditionAndActivateSheet()}setCurrentContent(e,t){t&&!this.isSelectionValid(e.length,t.start,t.end)||(this.setContent(e,t,!0),this.updateRangeColor())}replaceComposerCursorSelection(e){this.replaceSelection(e)}handle(e){switch(e.type){case"SELECT_FIGURE":e.id&&(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=ov(this.composerSelection,this._currentContent,e);void 0!==t&&this.setCurrentContent(t.content,t.selection)}isSelectionValid(e,t,o){return t>=0&&t<=e&&o>=0&&o<=e}startComposerRangeSelection(){if(this.sheetId===this.getters.getActiveSheetId()){const e=Xo({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("%")&&Vs(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=Xo({col:this.col,row:this.row});this.model.selection.capture(this,{cell:{col:this.col,row:this.row},zone:a},{handleEvent:this.handleEvent.bind(this),release:()=>{this._stopEdition()}})}_stopEdition(){if("inactive"!==this.editionMode){this.cancelEditionAndActivateSheet();let e=this.getCurrentCanonicalContent();if(!(this.initialContent!==e))return;if(e&&e.startsWith("=")){const t=this.currentTokens.filter((e=>"LEFT_PAREN"===e.type)).length-this.currentTokens.filter((e=>"RIGHT_PAREN"===e.type)).length;t>0&&(e+=rt(new Array(t).fill(")")))}this.confirmEdition(e)}}getCurrentCanonicalContent(){return La(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={})}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=e.startsWith("=")?Qf(e,t):[],this.currentTokens.length>100&&o&&this.notificationStore.raiseError(Ro("This formula has over 100 parts. It can't be processed properly, consider splitting it into multiple cells"))}this.canStartComposerRangeSelection()&&this.startComposerRangeSelection()}getAutoCompleteProviders(){return wE.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}=Fr(t.value),n=i||this.getters.getSheetName(this.sheetId);if(!Gr(this.getters.getSheetName(o),n))return!1;const r=this.getters.getRangeFromSheetXC(o,s);return Uo(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){let o=[...t];const s=e.clone({parts:o});return this.getters.getSelectionRangeString(s,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})}updateRangeColor(){if(!this._currentContent.startsWith("=")||"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(!this.currentContent.startsWith("=")||"inactive"===this.editionMode)return[];const e=this.sheetId,t=e=>{const t=this.colorIndexByRange[e];return Mt[t%Mt.length]};return this.getReferencedRanges().map((o=>{const s=this.getters.getRangeString(o,e),{numberOfRows:i,numberOfCols:n}=$o(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=e.startsWith("=")?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=Vr(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(this._currentContent.startsWith("=")){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)||ba.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}}class H_ extends U_{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}getComposerContent(){let e=this._currentContent;if("inactive"===this.editionMode){const t=this.args().defaultRangeSheetId;e=Mf(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 Ua(e,this.getters.getLocale())}stopEdition(){this._stopEdition()}confirmEdition(e){this.args().onConfirm(e)}}Lh`
892
+ `;class L_ extends t.Component{static template="o-spreadsheet-ChartPanel";static components={Section:o_,ChartTypePicker:N_};static props={onCloseSidePanel:Function,figureId:String};store;get figureId(){return this.props.figureId}setup(){this.store=_c(k_)}updateChart(e,t){if(e!==this.figureId)return;const o={...this.getChartDefinition(this.figureId),...t};return this.env.model.dispatch("UPDATE_CHART",{definition:o,id:e,sheetId:this.env.model.getters.getFigureSheetId(e)})}canUpdateChart(e,t){if(e!==this.figureId||!this.env.model.getters.isChartDefined(e))return;const o={...this.getChartDefinition(this.figureId),...t};return this.env.model.canDispatch("UPDATE_CHART",{definition:o,id:e,sheetId:this.env.model.getters.getFigureSheetId(e)})}onTypeChange(e){this.figureId&&this.store.changeChartType(this.figureId,e)}get chartPanel(){if(!this.figureId)throw new Error("Chart not defined.");const e=this.env.model.getters.getChartType(this.figureId);if(!e)throw new Error("Chart not defined.");const t=P_.get(e);if(!t)throw new Error(`Component is not defined for type ${e}`);return t}getChartDefinition(e){return this.env.model.getters.getChartDefinition(e)}}class V_{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}}class U_ extends kc{mutators=["startEdition","setCurrentContent","stopEdition","stopComposerRangeSelection","cancelEdition","cycleReferences","changeComposerCursorSelection","replaceComposerCursorSelection"];col=0;row=0;editionMode="inactive";sheetId="";_currentContent="";currentTokens=[];selectionStart=0;selectionEnd=0;initialContent="";colorIndexByRange={};notificationStore=this.get(V_);highlightStore=this.get(QA);constructor(e){super(e),this.highlightStore.register(this),this.onDispose((()=>{this.highlightStore.unRegister(this)}))}handleEvent(e){const t=this.getters.getActiveSheetId();let o;if(o=e.options.unbounded?this.getters.getUnboundedZone(t,e.anchor.zone):e.anchor.zone,"newAnchor"===e.mode)"selecting"===this.editionMode&&this.insertSelectedRange(o);else"selecting"===this.editionMode?this.replaceSelectedRange(o):this.updateComposerRange(e.previousAnchor.zone,o)}changeComposerCursorSelection(e,t){this.isSelectionValid(this._currentContent.length,e,t)&&(this.selectionStart=e,this.selectionEnd=t,this.editionMode="editing")}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",{id:null}),this.model.dispatch("SCROLL_TO_CELL",{col:o,row:s}),"inactive"!==this.editionMode&&e?this.setContent(e,t):this._startEdition(e,t),this.updateRangeColor()}cancelEdition(){this.resetContent(),this.cancelEditionAndActivateSheet()}setCurrentContent(e,t){t&&!this.isSelectionValid(e.length,t.start,t.end)||(this.setContent(e,t,!0),this.updateRangeColor())}replaceComposerCursorSelection(e){this.replaceSelection(e)}handle(e){switch(e.type){case"SELECT_FIGURE":e.id&&(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=ov(this.composerSelection,this._currentContent,e);void 0!==t&&this.setCurrentContent(t.content,t.selection)}isSelectionValid(e,t,o){return t>=0&&t<=e&&o>=0&&o<=e}startComposerRangeSelection(){if(this.sheetId===this.getters.getActiveSheetId()){const e=Xo({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("%")&&Vs(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=Xo({col:this.col,row:this.row});this.model.selection.capture(this,{cell:{col:this.col,row:this.row},zone:a},{handleEvent:this.handleEvent.bind(this),release:()=>{this._stopEdition()}})}_stopEdition(){if("inactive"!==this.editionMode){this.cancelEditionAndActivateSheet();let e=this.getCurrentCanonicalContent();if(!(this.initialContent!==e))return;if(e&&e.startsWith("=")){const t=this.currentTokens.filter((e=>"LEFT_PAREN"===e.type)).length-this.currentTokens.filter((e=>"RIGHT_PAREN"===e.type)).length;t>0&&(e+=rt(new Array(t).fill(")")))}this.confirmEdition(e)}}getCurrentCanonicalContent(){return La(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={})}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=e.startsWith("=")?Qf(e,t):[],this.currentTokens.length>100&&o&&this.notificationStore.raiseError(Ro("This formula has over 100 parts. It can't be processed properly, consider splitting it into multiple cells"))}this.canStartComposerRangeSelection()&&this.startComposerRangeSelection()}getAutoCompleteProviders(){return wE.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}=Fr(t.value),n=i||this.getters.getSheetName(this.sheetId);if(!Gr(this.getters.getSheetName(o),n))return!1;const r=this.getters.getRangeFromSheetXC(o,s);return Uo(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){let o=[...t];const s=e.clone({parts:o});return this.getters.getSelectionRangeString(s,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})}updateRangeColor(){if(!this._currentContent.startsWith("=")||"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(!this.currentContent.startsWith("=")||"inactive"===this.editionMode)return[];const e=this.sheetId,t=e=>{const t=this.colorIndexByRange[e];return Mt[t%Mt.length]};return this.getReferencedRanges().map((o=>{const s=this.getters.getRangeString(o,e),{numberOfRows:i,numberOfCols:n}=$o(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=e.startsWith("=")?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=Vr(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(this._currentContent.startsWith("=")){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)||ba.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}}class H_ extends U_{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}getComposerContent(){let e=this._currentContent;if("inactive"===this.editionMode){const t=this.args().defaultRangeSheetId;e=Mf(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 Ua(e,this.getters.getLocale())}stopEdition(){this._stopEdition()}confirmEdition(e){this.args().onConfirm(e)}}Lh`
893
893
  .o-spreadsheet {
894
894
  .o-standalone-composer {
895
895
  min-height: 24px;
@@ -1632,7 +1632,7 @@
1632
1632
  .o-paint-format-cursor {
1633
1633
  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;
1634
1634
  }
1635
- `;class lF extends t.Component{static template="o-spreadsheet-GridOverlay";static props={onCellHovered:{type:Function,optional:!0},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};static components={FiguresContainer:tF,DataValidationOverlay:qO,GridAddRowsFooter:iF,FilterIconsOverlay:sF};static defaultProps={onCellHovered:()=>{},onCellDoubleClicked:()=>{},onCellClicked:()=>{},onCellRightClicked:()=>{},onGridResized:()=>{},onFigureDeleted:()=>{}};gridOverlay=t.useRef("gridOverlay");gridOverlayRect=kE(this.gridOverlay);cellPopovers;paintFormatStore;setup(){aF(this.env,this.gridOverlay,this.props.onCellHovered);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=Ac(rI),this.paintFormatStore=Ac(rF)}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:PE(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 cF extends t.Component{static template="o-spreadsheet-GridPopover";static props={onClosePopover:Function,onMouseWheel:Function,gridRect:Object};static components={Popover:hI};cellPopovers;zIndex=Re.GridPopover;setup(){this.cellPopovers=Ac(rI)}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 hF 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"});setup(){this.composerFocusStore=Ac(Vc)}_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();m_((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||(!0!==this.state.waitingForMove?("editing"===this.composerFocusStore.activeComposer.editionMode&&this.env.model.selection.getBackToDefault(),this.startSelection(e,t)):this.env.model.getters.isGridSelectionActive()?this.startMovement(e):this._selectElement(t,!1))}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;f_(this.env,((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,PE(e)),this.lastSelectedElementIndex=t;f_(this.env,((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)}}Lh`
1635
+ `;class lF extends t.Component{static template="o-spreadsheet-GridOverlay";static props={onCellHovered:{type:Function,optional:!0},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};static components={FiguresContainer:tF,DataValidationOverlay:qO,GridAddRowsFooter:iF,FilterIconsOverlay:sF};static defaultProps={onCellHovered:()=>{},onCellDoubleClicked:()=>{},onCellClicked:()=>{},onCellRightClicked:()=>{},onGridResized:()=>{},onFigureDeleted:()=>{}};gridOverlay=t.useRef("gridOverlay");gridOverlayRect=kE(this.gridOverlay);cellPopovers;paintFormatStore;setup(){aF(this.env,this.gridOverlay,this.props.onCellHovered);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=Ac(rI),this.paintFormatStore=Ac(rF)}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:PE(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 cF extends t.Component{static template="o-spreadsheet-GridPopover";static props={onClosePopover:Function,onMouseWheel:Function,gridRect:Object};static components={Popover:hI};cellPopovers;zIndex=Re.GridPopover;setup(){this.cellPopovers=Ac(rI)}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 hF 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"});setup(){this.composerFocusStore=Ac(Vc)}_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();m_((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):!0!==this.state.waitingForMove?("editing"===this.composerFocusStore.activeComposer.editionMode&&this.env.model.selection.getBackToDefault(),this.startSelection(e,t)):this.env.model.getters.isGridSelectionActive()?this.startMovement(e):this._selectElement(t,!1))}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;f_(this.env,((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,PE(e)),this.lastSelectedElementIndex=t;f_(this.env,((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)}}Lh`
1636
1636
  .o-col-resizer {
1637
1637
  position: absolute;
1638
1638
  top: 0;
@@ -1819,7 +1819,7 @@
1819
1819
  offset="offset"
1820
1820
  direction="'vertical'"
1821
1821
  onScroll.bind="onScroll"
1822
- />`;static defaultProps={topOffset:0};get offset(){return this.env.model.getters.getActiveSheetDOMScrollInfo().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:"0px"}}onScroll(e){const{scrollX:t}=this.env.model.getters.getActiveSheetDOMScrollInfo();this.env.model.dispatch("SET_VIEWPORT_OFFSET",{offsetX:t,offsetY:e})}}const IF=350;class RF extends kc{mutators=["open","toggle","close","changePanelSize","resetPanelSize"];initialPanelProps={};componentTag="";panelSize=IF;get isOpen(){return!!this.componentTag&&this.computeState(this.componentTag,this.initialPanelProps).isOpen}get panelProps(){const e=this.computeState(this.componentTag,this.initialPanelProps);return e.isOpen?e.props??{}:{}}get panelKey(){const e=this.computeState(this.componentTag,this.initialPanelProps);if(e.isOpen)return e.key}open(e,t={}){const o=this.computeState(e,t);!1!==o.isOpen&&(this.isOpen&&e!==this.componentTag&&this.initialPanelProps?.onCloseSidePanel?.(),this.componentTag=e,this.initialPanelProps=o.props??{})}toggle(e,t){this.isOpen&&e===this.componentTag?this.close():this.open(e,t)}close(){this.initialPanelProps.onCloseSidePanel?.(),this.initialPanelProps={},this.componentTag=""}changePanelSize(e,t){this.panelSize=e<IF?IF:e>t-150?Math.max(t-150,IF):e}resetPanelSize(){this.panelSize=IF}computeState(e,t){const o=TO.get(e).computeState;return o?o(this.getters,t):{isOpen:!0,props:t}}}const TF="#777";Lh`
1822
+ />`;static defaultProps={topOffset:0};get offset(){return this.env.model.getters.getActiveSheetDOMScrollInfo().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:"0px"}}onScroll(e){const{scrollX:t}=this.env.model.getters.getActiveSheetDOMScrollInfo();this.env.model.dispatch("SET_VIEWPORT_OFFSET",{offsetX:t,offsetY:e})}}const IF=350;class RF extends kc{mutators=["open","toggle","close","changePanelSize","resetPanelSize"];currentPanelProps={};componentTag="";panelSize=IF;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);!1!==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<IF?IF:e>t-150?Math.max(t-150,IF):e}resetPanelSize(){this.panelSize=IF}computeState(e,t){const o=TO.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 TF="#777";Lh`
1823
1823
  .o-table-resizer {
1824
1824
  width: ${3}px;
1825
1825
  height: ${3}px;
@@ -3275,4 +3275,4 @@
3275
3275
  <tableParts count="${e.tables.length}">
3276
3276
  ${MC(a)}
3277
3277
  </tableParts>
3278
- `}var QN;!function(e){e[e.Ready=0]="Ready",e[e.Running=1]="Running",e[e.RunningCore=2]="RunningCore",e[e.Finalizing=3]="Finalizing"}(QN||(QN={}));function JN(e,t={}){const o=ke(t);return o.type=e,o}const ek={},tk={MIN_ROW_HEIGHT:10,MIN_COL_WIDTH:5,HEADER_HEIGHT:Y,HEADER_WIDTH:X,TOPBAR_HEIGHT:63,BOTTOMBAR_HEIGHT:36,DEFAULT_CELL_WIDTH:K,DEFAULT_CELL_HEIGHT:Q,SCROLLBAR_WIDTH:J},ok={autoCompleteProviders:wE,autofillModifiersRegistry:nx,autofillRulesRegistry:rx,cellMenuRegistry:nT,colMenuRegistry:WA,errorTypes:ci,linkMenuRegistry:DI,functionRegistry:rS,featurePluginRegistry:cP,iconsOnCellRegistry:Ph,statefulUIPluginRegistry:hP,coreViewsPluginRegistry:dP,corePluginRegistry:lP,rowMenuRegistry:YA,sidePanelRegistry:TO,figureRegistry:Xx,chartSidePanelComponentRegistry:P_,chartComponentRegistry:$x,chartRegistry:zx,chartSubtypeRegistry:Wx,topbarMenuRegistry:JA,topbarComponentRegistry:AO,clickableCellRegistry:uP,otRegistry:e_,inverseCommandRegistry:eI,urlRegistry:an,cellPopoverRegistry:gx,numberFormatMenuRegistry:qA,repeatLocalCommandTransformRegistry:sP,repeatCommandTransformRegistry:oP,clipboardHandlersRegistries:yc,pivotRegistry:JD,pivotTimeAdapterRegistry:Ll,pivotSidePanelRegistry:sO,pivotNormalizationValueRegistry:pc,supportedPivotPositionalFormulaRegistry:ix,pivotToFunctionValueRegistry:mc,migrationStepRegistry:ow},sk={arg:qh,isEvaluationError:yi,toBoolean:Mi,toJsDate:Pi,toNumber:wi,toString:Di,toNormalizedPivotValue:hc,toXC:po,toZone:_o,toUnboundedZone:Ao,toCartesian:go,numberToLetters:oo,lettersToNumber:so,UuidGenerator:la,formatValue:Ln,createCurrencyFormat:Kn,ColorGenerator:to,computeTextWidth:Yr,createEmptyWorkbookData:hw,createEmptySheet:cw,createEmptyExcelSheet:dw,getDefaultChartJsRuntime:hE,chartFontColor:Yc,getChartAxisTitleRuntime:Jc,getChartAxisType:Ex,getTrendDatasetForBarChart:oh,getTrendDatasetForLineChart:Tx,getFillingMode:mE,rgbaToHex:Ht,colorToRGBA:Bt,positionToZone:Xo,isDefined:ot,isMatrix:ii,lazy:at,genericRepeat:iP,createAction:i,createActions:o,transformRangeData:wc,deepEquals:ht,overlap:Ho,union:Lo,isInside:Bo,deepCopy:ke,expandZoneOnInsertion:Mo,reduceZoneOnDeletion:ko,unquote:Ve,getMaxObjectId:oc,getFunctionsFromTokens:xS,getFirstPivotFunction:ox,getNumberOfPivotFunctions:sx,parseDimension:nc,isDateOrDatetimeField:rc,makeFieldProposal:QE,insertTokenAfterArgSeparator:JE,insertTokenAfterLeftParenthesis:ex,mergeContiguousZones:ts,getPivotHighlights:XA,pivotTimeAdapter:Vl,UNDO_REDO_PIVOT_COMMANDS:_M,createPivotFormula:cc,areDomainArgsFieldsValid:lc,splitReference:Fr,formatTickValue:nh,sanitizeSheetName:He,isNumber:Vs,isDateTime:Cs},ik={isMarkdownLink:je,parseMarkdownLink:Ke,markdownLink:Xe,openLink:un,urlRepresentation:dn},nk={Checkbox:t_,Section:o_,RoundColorPicker:C_,ChartDataSeries:r_,ChartErrorSection:l_,ChartLabelRange:c_,ChartTitle:E_,ChartPanel:L_,ChartFigure:Zx,ChartJsComponent:yE,Grid:DF,GridOverlay:lF,ScorecardChart:CE,LineConfigPanel:__,BarConfigPanel:d_,PieChartDesignPanel:D_,GenericChartConfigPanel:h_,ChartWithAxisDesignPanel:R_,GaugeChartConfigPanel:T_,GaugeChartDesignPanel:A_,ScorecardChartConfigPanel:O_,ScorecardChartDesignPanel:F_,ChartTypePicker:N_,FigureComponent:_O,Menu:OI,Popover:hI,SelectionInput:n_,ValidationMessages:a_,AddDimensionButton:_D,PivotDimensionGranularity:MD,PivotDimensionOrder:PD,PivotDimension:FD,PivotLayoutConfigurator:kD,PivotHTMLRenderer:FF,EditableName:OF,PivotDeferUpdate:AD,PivotTitleSection:LD,CogWheelMenu:OD,TextInput:DD,SidePanelCollapsible:g_},rk={useDragAndDropListItems:$_,useHighlights:X_,useHighlightsOnHover:Y_},ak={useStoreProvider:Tc,DependencyContainer:xc,CellPopoverStore:rI,ComposerFocusStore:Vc,CellComposerStore:HO,FindAndReplaceStore:wD,HighlightStore:QA,HoveredCellStore:nI,ModelStore:Mc,NotificationStore:V_,RendererStore:Nc,SelectionInputStore:i_,SpreadsheetStore:kc,useStore:Ac,useLocalStore:_c,SidePanelStore:RF,PivotSidePanelStore:tO,PivotMeasureDisplayPanelStore:RD};const lk={DEFAULT_LOCALE:oi,HIGHLIGHT_COLOR:a,PIVOT_TABLE_CONFIG:Oe,TREND_LINE_XAXIS_ID:Uc,CHART_AXIS_CHOICES:ah,ChartTerms:bw};e.AbstractCellClipboardHandler=va,e.AbstractChart=Zw,e.AbstractFigureClipboardHandler=Sc,e.CellErrorType=li,e.CorePlugin=PF,e.DispatchResult=Qs,e.EvaluationError=hi,e.Model=class extends Ec{corePlugins=[];featurePlugins=[];statefulUIPlugins=[];coreViewsPlugins=[];range;session;isReplayingCommand=!1;renderers={};status=0;config;corePluginConfig;uiPluginConfig;state;selection;getters;coreGetters;uuidGenerator;handlers=[];uiHandlers=[];coreHandlers=[];constructor(e={},o={},s=[],i=new la,n=!1){const r=performance.now();console.debug("##### Model creation #####"),super(),Eo===Co&&xo===wo&&(xo=()=>!0),s=aw(e,s);const a=rw(e,n);this.state=new JP,this.uuidGenerator=i,this.config=this.setupConfig(o),this.session=this.setupSession(a.revisionId),this.coreGetters={},this.range=new BF(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.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.getters={isReadonly:()=>"readonly"===this.config.mode||"dashboard"===this.config.mode,isDashboard:()=>"dashboard"===this.config.mode},this.selection=new KP(this.getters),this.coreHandlers.push(this.range),this.handlers.push(this.range),this.corePluginConfig=this.setupCorePluginConfig(),this.uiPluginConfig=this.setupUiPluginConfig();for(let e of lP.getAll())this.setupCorePlugin(e,a);Object.assign(this.getters,this.coreGetters),this.session.loadInitialMessages(s);for(let e of dP.getAll()){const t=this.setupUiPlugin(e);this.coreViewsPlugins.push(t),this.handlers.push(t),this.uiHandlers.push(t),this.coreHandlers.push(t)}for(let e of hP.getAll()){const t=this.setupUiPlugin(e);this.statefulUIPlugins.push(t),this.handlers.push(t),this.uiHandlers.push(t)}for(let e of cP.getAll()){const t=this.setupUiPlugin(e);this.featurePlugins.push(t),this.handlers.push(t),this.uiHandlers.push(t)}if(this.uuidGenerator.setIsFastStrategy(!1),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:at((()=>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}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 GM(jP({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:Ro("Anonymous").toString()},o=e.transportService||new HP;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(ti));return{...e,loadLocales:t}}setupCorePluginConfig(){return{getters:this.coreGetters,stateObserver:this.state,range:this.range,dispatch:this.dispatchFromCorePlugin,canDispatch:this.canDispatch,uuidGenerator:this.uuidGenerator,custom:this.config.custom,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||[]}}checkDispatchAllowed(e){const t=Ks(e)?this.checkDispatchAllowedCoreCommand(e):this.checkDispatchAllowedLocalCommand(e);return t.some((e=>"Success"!==e))?new Qs(t.flat()):Qs.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(JN(e,t));dispatch=(e,t)=>{const o=JN(e,t);let s=this.status;if(this.getters.isReadonly()&&(i=o,!Ys.has(i.type)))return new Qs("Readonly");var i;if(!this.session.canApplyOptimisticUpdate())return new Qs("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();Ks(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(Ks(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(Ks(o))throw new Error(`A UI plugin cannot dispatch ${e} while handling a core command`);this.dispatchToHandlers(this.handlers,o)}return Qs.Success};dispatchFromCorePlugin=(e,t)=>{const o=JN(e,t),s=this.status;this.status=2;const i=this.isReplayingCommand?this.coreHandlers:this.handlers;return this.dispatchToHandlers(i,o),this.status=s,Qs.Success};dispatchToHandlers(e,t){const o=Ks(t);for(const s of e)!o&&s instanceof PF||s.beforeHandle(t);for(const s of e)!o&&s instanceof PF||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=hw();for(let t of this.handlers)t instanceof PF&&t.export(e);return e.revisionId=this.session.getRevisionId()||me,e=ke(e),e}updateMode(e){this.config.mode=e,this.trigger("update")}exportXLSX(){this.dispatch("EVALUATE_CELLS");let e={...hw(),sheets:[dw(nw,"Sheet1")]};for(let t of this.handlers)t instanceof MF&&t.exportForExcel(e);return e=ke(e),XN(e)}garbageCollectExternalResources(){for(const e of this.corePlugins)e.garbageCollectExternalResources()}},e.PivotRuntimeDefinition=VD,e.Registry=n,e.Revision=zM,e.SPREADSHEET_DIMENSIONS=tk,e.Spreadsheet=UP,e.SpreadsheetPivotTable=BD,e.UIPlugin=$F,e.__info__=ek,e.addFunction=function e(t,o){return rS.add(t,o),{addFunction:(t,o)=>e(t,o)}},e.addRenderingLayer=function(e,t){if(ri[e])throw new Error(`Layer ${e} already exists`);ri[e]=t},e.astToFormula=Yf,e.compile=SS,e.compileTokens=yS,e.components=nk,e.constants=lk,e.convertAstNodes=Wf,e.coreTypes=Xs,e.findCellInNewZone=Yo,e.functionCache=bS,e.helpers=sk,e.hooks=rk,e.invalidateCFEvaluationCommands=Zs,e.invalidateDependenciesCommands=qs,e.invalidateEvaluationCommands=Gs,e.iterateAstNodes=qf,e.links=ik,e.load=rw,e.parse=$f,e.parseTokens=Gf,e.readonlyAllowedCommands=Ys,e.registries=ok,e.setDefaultSheetViewSize=function(e){Te=e},e.setTranslationMethod=function(e,t=(()=>!0)){Eo=e,xo=t},e.stores=ak,e.tokenColors=YE,e.tokenize=ya,ek.version="18.0.48",ek.date="2025-11-12T14:15:38.406Z",ek.hash="d1efb0b"}(this.o_spreadsheet=this.o_spreadsheet||{},owl);
3278
+ `}var QN;!function(e){e[e.Ready=0]="Ready",e[e.Running=1]="Running",e[e.RunningCore=2]="RunningCore",e[e.Finalizing=3]="Finalizing"}(QN||(QN={}));function JN(e,t={}){const o=ke(t);return o.type=e,o}const ek={},tk={MIN_ROW_HEIGHT:10,MIN_COL_WIDTH:5,HEADER_HEIGHT:Y,HEADER_WIDTH:X,TOPBAR_HEIGHT:63,BOTTOMBAR_HEIGHT:36,DEFAULT_CELL_WIDTH:K,DEFAULT_CELL_HEIGHT:Q,SCROLLBAR_WIDTH:J},ok={autoCompleteProviders:wE,autofillModifiersRegistry:nx,autofillRulesRegistry:rx,cellMenuRegistry:nT,colMenuRegistry:WA,errorTypes:ci,linkMenuRegistry:DI,functionRegistry:rS,featurePluginRegistry:cP,iconsOnCellRegistry:Ph,statefulUIPluginRegistry:hP,coreViewsPluginRegistry:dP,corePluginRegistry:lP,rowMenuRegistry:YA,sidePanelRegistry:TO,figureRegistry:Xx,chartSidePanelComponentRegistry:P_,chartComponentRegistry:$x,chartRegistry:zx,chartSubtypeRegistry:Wx,topbarMenuRegistry:JA,topbarComponentRegistry:AO,clickableCellRegistry:uP,otRegistry:e_,inverseCommandRegistry:eI,urlRegistry:an,cellPopoverRegistry:gx,numberFormatMenuRegistry:qA,repeatLocalCommandTransformRegistry:sP,repeatCommandTransformRegistry:oP,clipboardHandlersRegistries:yc,pivotRegistry:JD,pivotTimeAdapterRegistry:Ll,pivotSidePanelRegistry:sO,pivotNormalizationValueRegistry:pc,supportedPivotPositionalFormulaRegistry:ix,pivotToFunctionValueRegistry:mc,migrationStepRegistry:ow},sk={arg:qh,isEvaluationError:yi,toBoolean:Mi,toJsDate:Pi,toNumber:wi,toString:Di,toNormalizedPivotValue:hc,toXC:po,toZone:_o,toUnboundedZone:Ao,toCartesian:go,numberToLetters:oo,lettersToNumber:so,UuidGenerator:la,formatValue:Ln,createCurrencyFormat:Kn,ColorGenerator:to,computeTextWidth:Yr,createEmptyWorkbookData:hw,createEmptySheet:cw,createEmptyExcelSheet:dw,getDefaultChartJsRuntime:hE,chartFontColor:Yc,getChartAxisTitleRuntime:Jc,getChartAxisType:Ex,getTrendDatasetForBarChart:oh,getTrendDatasetForLineChart:Tx,getFillingMode:mE,rgbaToHex:Ht,colorToRGBA:Bt,positionToZone:Xo,isDefined:ot,isMatrix:ii,lazy:at,genericRepeat:iP,createAction:i,createActions:o,transformRangeData:wc,deepEquals:ht,overlap:Ho,union:Lo,isInside:Bo,deepCopy:ke,expandZoneOnInsertion:Mo,reduceZoneOnDeletion:ko,unquote:Ve,getMaxObjectId:oc,getFunctionsFromTokens:xS,getFirstPivotFunction:ox,getNumberOfPivotFunctions:sx,parseDimension:nc,isDateOrDatetimeField:rc,makeFieldProposal:QE,insertTokenAfterArgSeparator:JE,insertTokenAfterLeftParenthesis:ex,mergeContiguousZones:ts,getPivotHighlights:XA,pivotTimeAdapter:Vl,UNDO_REDO_PIVOT_COMMANDS:_M,createPivotFormula:cc,areDomainArgsFieldsValid:lc,splitReference:Fr,formatTickValue:nh,sanitizeSheetName:He,isNumber:Vs,isDateTime:Cs},ik={isMarkdownLink:je,parseMarkdownLink:Ke,markdownLink:Xe,openLink:un,urlRepresentation:dn},nk={Checkbox:t_,Section:o_,RoundColorPicker:C_,ChartDataSeries:r_,ChartErrorSection:l_,ChartLabelRange:c_,ChartTitle:E_,ChartPanel:L_,ChartFigure:Zx,ChartJsComponent:yE,Grid:DF,GridOverlay:lF,ScorecardChart:CE,LineConfigPanel:__,BarConfigPanel:d_,PieChartDesignPanel:D_,GenericChartConfigPanel:h_,ChartWithAxisDesignPanel:R_,GaugeChartConfigPanel:T_,GaugeChartDesignPanel:A_,ScorecardChartConfigPanel:O_,ScorecardChartDesignPanel:F_,ChartTypePicker:N_,FigureComponent:_O,Menu:OI,Popover:hI,SelectionInput:n_,ValidationMessages:a_,AddDimensionButton:_D,PivotDimensionGranularity:MD,PivotDimensionOrder:PD,PivotDimension:FD,PivotLayoutConfigurator:kD,PivotHTMLRenderer:FF,EditableName:OF,PivotDeferUpdate:AD,PivotTitleSection:LD,CogWheelMenu:OD,TextInput:DD,SidePanelCollapsible:g_},rk={useDragAndDropListItems:$_,useHighlights:X_,useHighlightsOnHover:Y_},ak={useStoreProvider:Tc,DependencyContainer:xc,CellPopoverStore:rI,ComposerFocusStore:Vc,CellComposerStore:HO,FindAndReplaceStore:wD,HighlightStore:QA,HoveredCellStore:nI,ModelStore:Mc,NotificationStore:V_,RendererStore:Nc,SelectionInputStore:i_,SpreadsheetStore:kc,useStore:Ac,useLocalStore:_c,SidePanelStore:RF,PivotSidePanelStore:tO,PivotMeasureDisplayPanelStore:RD};const lk={DEFAULT_LOCALE:oi,HIGHLIGHT_COLOR:a,PIVOT_TABLE_CONFIG:Oe,TREND_LINE_XAXIS_ID:Uc,CHART_AXIS_CHOICES:ah,ChartTerms:bw};e.AbstractCellClipboardHandler=va,e.AbstractChart=Zw,e.AbstractFigureClipboardHandler=Sc,e.CellErrorType=li,e.CorePlugin=PF,e.DispatchResult=Qs,e.EvaluationError=hi,e.Model=class extends Ec{corePlugins=[];featurePlugins=[];statefulUIPlugins=[];coreViewsPlugins=[];range;session;isReplayingCommand=!1;renderers={};status=0;config;corePluginConfig;uiPluginConfig;state;selection;getters;coreGetters;uuidGenerator;handlers=[];uiHandlers=[];coreHandlers=[];constructor(e={},o={},s=[],i=new la,n=!1){const r=performance.now();console.debug("##### Model creation #####"),super(),Eo===Co&&xo===wo&&(xo=()=>!0),s=aw(e,s);const a=rw(e,n);this.state=new JP,this.uuidGenerator=i,this.config=this.setupConfig(o),this.session=this.setupSession(a.revisionId),this.coreGetters={},this.range=new BF(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.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.getters={isReadonly:()=>"readonly"===this.config.mode||"dashboard"===this.config.mode,isDashboard:()=>"dashboard"===this.config.mode},this.selection=new KP(this.getters),this.coreHandlers.push(this.range),this.handlers.push(this.range),this.corePluginConfig=this.setupCorePluginConfig(),this.uiPluginConfig=this.setupUiPluginConfig();for(let e of lP.getAll())this.setupCorePlugin(e,a);Object.assign(this.getters,this.coreGetters),this.session.loadInitialMessages(s);for(let e of dP.getAll()){const t=this.setupUiPlugin(e);this.coreViewsPlugins.push(t),this.handlers.push(t),this.uiHandlers.push(t),this.coreHandlers.push(t)}for(let e of hP.getAll()){const t=this.setupUiPlugin(e);this.statefulUIPlugins.push(t),this.handlers.push(t),this.uiHandlers.push(t)}for(let e of cP.getAll()){const t=this.setupUiPlugin(e);this.featurePlugins.push(t),this.handlers.push(t),this.uiHandlers.push(t)}if(this.uuidGenerator.setIsFastStrategy(!1),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:at((()=>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}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 GM(jP({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:Ro("Anonymous").toString()},o=e.transportService||new HP;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(ti));return{...e,loadLocales:t}}setupCorePluginConfig(){return{getters:this.coreGetters,stateObserver:this.state,range:this.range,dispatch:this.dispatchFromCorePlugin,canDispatch:this.canDispatch,uuidGenerator:this.uuidGenerator,custom:this.config.custom,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||[]}}checkDispatchAllowed(e){const t=Ks(e)?this.checkDispatchAllowedCoreCommand(e):this.checkDispatchAllowedLocalCommand(e);return t.some((e=>"Success"!==e))?new Qs(t.flat()):Qs.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(JN(e,t));dispatch=(e,t)=>{const o=JN(e,t);let s=this.status;if(this.getters.isReadonly()&&(i=o,!Ys.has(i.type)))return new Qs("Readonly");var i;if(!this.session.canApplyOptimisticUpdate())return new Qs("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();Ks(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(Ks(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(Ks(o))throw new Error(`A UI plugin cannot dispatch ${e} while handling a core command`);this.dispatchToHandlers(this.handlers,o)}return Qs.Success};dispatchFromCorePlugin=(e,t)=>{const o=JN(e,t),s=this.status;this.status=2;const i=this.isReplayingCommand?this.coreHandlers:this.handlers;return this.dispatchToHandlers(i,o),this.status=s,Qs.Success};dispatchToHandlers(e,t){const o=Ks(t);for(const s of e)!o&&s instanceof PF||s.beforeHandle(t);for(const s of e)!o&&s instanceof PF||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=hw();for(let t of this.handlers)t instanceof PF&&t.export(e);return e.revisionId=this.session.getRevisionId()||me,e=ke(e),e}updateMode(e){this.config.mode=e,this.trigger("update")}exportXLSX(){this.dispatch("EVALUATE_CELLS");let e={...hw(),sheets:[dw(nw,"Sheet1")]};for(let t of this.handlers)t instanceof MF&&t.exportForExcel(e);return e=ke(e),XN(e)}garbageCollectExternalResources(){for(const e of this.corePlugins)e.garbageCollectExternalResources()}},e.PivotRuntimeDefinition=VD,e.Registry=n,e.Revision=zM,e.SPREADSHEET_DIMENSIONS=tk,e.Spreadsheet=UP,e.SpreadsheetPivotTable=BD,e.UIPlugin=$F,e.__info__=ek,e.addFunction=function e(t,o){return rS.add(t,o),{addFunction:(t,o)=>e(t,o)}},e.addRenderingLayer=function(e,t){if(ri[e])throw new Error(`Layer ${e} already exists`);ri[e]=t},e.astToFormula=Yf,e.compile=SS,e.compileTokens=yS,e.components=nk,e.constants=lk,e.convertAstNodes=Wf,e.coreTypes=Xs,e.findCellInNewZone=Yo,e.functionCache=bS,e.helpers=sk,e.hooks=rk,e.invalidateCFEvaluationCommands=Zs,e.invalidateDependenciesCommands=qs,e.invalidateEvaluationCommands=Gs,e.iterateAstNodes=qf,e.links=ik,e.load=rw,e.parse=$f,e.parseTokens=Gf,e.readonlyAllowedCommands=Ys,e.registries=ok,e.setDefaultSheetViewSize=function(e){Te=e},e.setTranslationMethod=function(e,t=(()=>!0)){Eo=e,xo=t},e.stores=ak,e.tokenColors=YE,e.tokenize=ya,ek.version="18.0.49",ek.date="2025-11-24T07:40:04.646Z",ek.hash="b4ef5b7"}(this.o_spreadsheet=this.o_spreadsheet||{},owl);
@@ -1,9 +1,9 @@
1
1
  <!--
2
2
  This file is generated by o-spreadsheet build tools. Do not edit it.
3
3
  @see https://github.com/odoo/o-spreadsheet
4
- @version 18.0.48
5
- @date 2025-11-12T14:16:31.402Z
6
- @hash d1efb0b
4
+ @version 18.0.49
5
+ @date 2025-11-24T07:41:03.014Z
6
+ @hash b4ef5b7
7
7
  -->
8
8
  <odoo>
9
9
  <t t-name="o-spreadsheet-ActionButton">
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@odoo/o-spreadsheet",
3
- "version": "18.0.48",
3
+ "version": "18.0.49",
4
4
  "description": "A spreadsheet component",
5
5
  "type": "module",
6
6
  "main": "dist/o-spreadsheet.cjs.js",