@odoo/o-spreadsheet 17.0.67 → 17.0.68

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 17.0.67
6
- * @date 2025-06-23T15:02:54.391Z
7
- * @hash cb0b6a9
5
+ * @version 17.0.68
6
+ * @date 2025-06-27T09:09:05.702Z
7
+ * @hash 33404c6
8
8
  */
9
9
 
10
10
  'use strict';
@@ -55629,26 +55629,28 @@ class SelectionStreamProcessorImpl {
55629
55629
  bottom: Math.min(this.getters.getNumberRows(sheetId) - 1, bottom),
55630
55630
  };
55631
55631
  };
55632
- const { col: refCol, row: refRow } = this.getReferencePosition();
55632
+ const { cell: refCell, zone: refZone } = this.getReferenceAnchor();
55633
+ const { col: refCol, row: refRow } = refCell;
55633
55634
  // check if we can shrink selection
55634
55635
  let n = 0;
55635
55636
  while (result !== null) {
55636
55637
  n++;
55637
55638
  if (deltaCol < 0) {
55638
55639
  const newRight = this.getNextAvailableCol(deltaCol, right - (n - 1), refRow);
55639
- result = refCol <= right - n ? expand({ top, left, bottom, right: newRight }) : null;
55640
+ result = refZone.right <= right - n ? expand({ top, left, bottom, right: newRight }) : null;
55640
55641
  }
55641
55642
  if (deltaCol > 0) {
55642
55643
  const newLeft = this.getNextAvailableCol(deltaCol, left + (n - 1), refRow);
55643
- result = left + n <= refCol ? expand({ top, left: newLeft, bottom, right }) : null;
55644
+ result = left + n <= refZone.left ? expand({ top, left: newLeft, bottom, right }) : null;
55644
55645
  }
55645
55646
  if (deltaRow < 0) {
55646
55647
  const newBottom = this.getNextAvailableRow(deltaRow, refCol, bottom - (n - 1));
55647
- result = refRow <= bottom - n ? expand({ top, left, bottom: newBottom, right }) : null;
55648
+ result =
55649
+ refZone.bottom <= bottom - n ? expand({ top, left, bottom: newBottom, right }) : null;
55648
55650
  }
55649
55651
  if (deltaRow > 0) {
55650
55652
  const newTop = this.getNextAvailableRow(deltaRow, refCol, top + (n - 1));
55651
- result = top + n <= refRow ? expand({ top: newTop, left, bottom, right }) : null;
55653
+ result = top + n <= refZone.top ? expand({ top: newTop, left, bottom, right }) : null;
55652
55654
  }
55653
55655
  result = result ? organizeZone(result) : result;
55654
55656
  if (result && !isEqual(result, anchor.zone)) {
@@ -55877,18 +55879,26 @@ class SelectionStreamProcessorImpl {
55877
55879
  * If the anchor is hidden, browses from left to right and top to bottom to
55878
55880
  * find a visible cell.
55879
55881
  */
55880
- getReferencePosition() {
55882
+ getReferenceAnchor() {
55881
55883
  const sheetId = this.getters.getActiveSheetId();
55882
55884
  const anchor = this.anchor;
55883
55885
  const { left, right, top, bottom } = anchor.zone;
55884
55886
  const { col: anchorCol, row: anchorRow } = anchor.cell;
55887
+ const col = this.getters.isColHidden(sheetId, anchorCol)
55888
+ ? this.getters.findVisibleHeader(sheetId, "COL", left, right) || anchorCol
55889
+ : anchorCol;
55890
+ const row = this.getters.isRowHidden(sheetId, anchorRow)
55891
+ ? this.getters.findVisibleHeader(sheetId, "ROW", top, bottom) || anchorRow
55892
+ : anchorRow;
55893
+ const zone = this.getters.expandZone(sheetId, {
55894
+ left: col,
55895
+ right: col,
55896
+ top: row,
55897
+ bottom: row,
55898
+ });
55885
55899
  return {
55886
- col: this.getters.isColHidden(sheetId, anchorCol)
55887
- ? this.getters.findVisibleHeader(sheetId, "COL", left, right) || anchorCol
55888
- : anchorCol,
55889
- row: this.getters.isRowHidden(sheetId, anchorRow)
55890
- ? this.getters.findVisibleHeader(sheetId, "ROW", top, bottom) || anchorRow
55891
- : anchorRow,
55900
+ cell: { col, row },
55901
+ zone,
55892
55902
  };
55893
55903
  }
55894
55904
  deltaToTarget(position, direction, step) {
@@ -58353,6 +58363,6 @@ exports.setTranslationMethod = setTranslationMethod;
58353
58363
  exports.tokenize = tokenize;
58354
58364
 
58355
58365
 
58356
- __info__.version = "17.0.67";
58357
- __info__.date = "2025-06-23T15:02:54.391Z";
58358
- __info__.hash = "cb0b6a9";
58366
+ __info__.version = "17.0.68";
58367
+ __info__.date = "2025-06-27T09:09:05.702Z";
58368
+ __info__.hash = "33404c6";
@@ -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 17.0.67
6
- * @date 2025-06-23T15:02:54.391Z
7
- * @hash cb0b6a9
5
+ * @version 17.0.68
6
+ * @date 2025-06-27T09:09:05.702Z
7
+ * @hash 33404c6
8
8
  */
9
9
 
10
10
  import { Component, useRef, onMounted, useEffect, onWillPatch, useState, onWillUpdateProps, onPatched, useComponent, useExternalListener, onWillUnmount, onWillStart, xml, useChildSubEnv, useSubEnv, markRaw } from '@odoo/owl';
@@ -55627,26 +55627,28 @@ class SelectionStreamProcessorImpl {
55627
55627
  bottom: Math.min(this.getters.getNumberRows(sheetId) - 1, bottom),
55628
55628
  };
55629
55629
  };
55630
- const { col: refCol, row: refRow } = this.getReferencePosition();
55630
+ const { cell: refCell, zone: refZone } = this.getReferenceAnchor();
55631
+ const { col: refCol, row: refRow } = refCell;
55631
55632
  // check if we can shrink selection
55632
55633
  let n = 0;
55633
55634
  while (result !== null) {
55634
55635
  n++;
55635
55636
  if (deltaCol < 0) {
55636
55637
  const newRight = this.getNextAvailableCol(deltaCol, right - (n - 1), refRow);
55637
- result = refCol <= right - n ? expand({ top, left, bottom, right: newRight }) : null;
55638
+ result = refZone.right <= right - n ? expand({ top, left, bottom, right: newRight }) : null;
55638
55639
  }
55639
55640
  if (deltaCol > 0) {
55640
55641
  const newLeft = this.getNextAvailableCol(deltaCol, left + (n - 1), refRow);
55641
- result = left + n <= refCol ? expand({ top, left: newLeft, bottom, right }) : null;
55642
+ result = left + n <= refZone.left ? expand({ top, left: newLeft, bottom, right }) : null;
55642
55643
  }
55643
55644
  if (deltaRow < 0) {
55644
55645
  const newBottom = this.getNextAvailableRow(deltaRow, refCol, bottom - (n - 1));
55645
- result = refRow <= bottom - n ? expand({ top, left, bottom: newBottom, right }) : null;
55646
+ result =
55647
+ refZone.bottom <= bottom - n ? expand({ top, left, bottom: newBottom, right }) : null;
55646
55648
  }
55647
55649
  if (deltaRow > 0) {
55648
55650
  const newTop = this.getNextAvailableRow(deltaRow, refCol, top + (n - 1));
55649
- result = top + n <= refRow ? expand({ top: newTop, left, bottom, right }) : null;
55651
+ result = top + n <= refZone.top ? expand({ top: newTop, left, bottom, right }) : null;
55650
55652
  }
55651
55653
  result = result ? organizeZone(result) : result;
55652
55654
  if (result && !isEqual(result, anchor.zone)) {
@@ -55875,18 +55877,26 @@ class SelectionStreamProcessorImpl {
55875
55877
  * If the anchor is hidden, browses from left to right and top to bottom to
55876
55878
  * find a visible cell.
55877
55879
  */
55878
- getReferencePosition() {
55880
+ getReferenceAnchor() {
55879
55881
  const sheetId = this.getters.getActiveSheetId();
55880
55882
  const anchor = this.anchor;
55881
55883
  const { left, right, top, bottom } = anchor.zone;
55882
55884
  const { col: anchorCol, row: anchorRow } = anchor.cell;
55885
+ const col = this.getters.isColHidden(sheetId, anchorCol)
55886
+ ? this.getters.findVisibleHeader(sheetId, "COL", left, right) || anchorCol
55887
+ : anchorCol;
55888
+ const row = this.getters.isRowHidden(sheetId, anchorRow)
55889
+ ? this.getters.findVisibleHeader(sheetId, "ROW", top, bottom) || anchorRow
55890
+ : anchorRow;
55891
+ const zone = this.getters.expandZone(sheetId, {
55892
+ left: col,
55893
+ right: col,
55894
+ top: row,
55895
+ bottom: row,
55896
+ });
55883
55897
  return {
55884
- col: this.getters.isColHidden(sheetId, anchorCol)
55885
- ? this.getters.findVisibleHeader(sheetId, "COL", left, right) || anchorCol
55886
- : anchorCol,
55887
- row: this.getters.isRowHidden(sheetId, anchorRow)
55888
- ? this.getters.findVisibleHeader(sheetId, "ROW", top, bottom) || anchorRow
55889
- : anchorRow,
55898
+ cell: { col, row },
55899
+ zone,
55890
55900
  };
55891
55901
  }
55892
55902
  deltaToTarget(position, direction, step) {
@@ -58316,6 +58326,6 @@ const constants = {
58316
58326
  export { AbstractChart, CommandResult, CorePlugin, DispatchResult, EvaluationError, Model, Registry, Revision, SPREADSHEET_DIMENSIONS, Spreadsheet, UIPlugin, __info__, addFunction, astToFormula, compile, compileTokens, components, constants, convertAstNodes, coreTypes, findCellInNewZone, functionCache, helpers, hooks, invalidateCFEvaluationCommands, invalidateDependenciesCommands, invalidateEvaluationCommands, iterateAstNodes, links, load, parse, parseTokens, readonlyAllowedCommands, registries, setDefaultSheetViewSize, setTranslationMethod, tokenize };
58317
58327
 
58318
58328
 
58319
- __info__.version = "17.0.67";
58320
- __info__.date = "2025-06-23T15:02:54.391Z";
58321
- __info__.hash = "cb0b6a9";
58329
+ __info__.version = "17.0.68";
58330
+ __info__.date = "2025-06-27T09:09:05.702Z";
58331
+ __info__.hash = "33404c6";
@@ -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 17.0.67
6
- * @date 2025-06-23T15:02:54.391Z
7
- * @hash cb0b6a9
5
+ * @version 17.0.68
6
+ * @date 2025-06-27T09:09:05.702Z
7
+ * @hash 33404c6
8
8
  */
9
9
 
10
10
  (function (exports, owl) {
@@ -55628,26 +55628,28 @@
55628
55628
  bottom: Math.min(this.getters.getNumberRows(sheetId) - 1, bottom),
55629
55629
  };
55630
55630
  };
55631
- const { col: refCol, row: refRow } = this.getReferencePosition();
55631
+ const { cell: refCell, zone: refZone } = this.getReferenceAnchor();
55632
+ const { col: refCol, row: refRow } = refCell;
55632
55633
  // check if we can shrink selection
55633
55634
  let n = 0;
55634
55635
  while (result !== null) {
55635
55636
  n++;
55636
55637
  if (deltaCol < 0) {
55637
55638
  const newRight = this.getNextAvailableCol(deltaCol, right - (n - 1), refRow);
55638
- result = refCol <= right - n ? expand({ top, left, bottom, right: newRight }) : null;
55639
+ result = refZone.right <= right - n ? expand({ top, left, bottom, right: newRight }) : null;
55639
55640
  }
55640
55641
  if (deltaCol > 0) {
55641
55642
  const newLeft = this.getNextAvailableCol(deltaCol, left + (n - 1), refRow);
55642
- result = left + n <= refCol ? expand({ top, left: newLeft, bottom, right }) : null;
55643
+ result = left + n <= refZone.left ? expand({ top, left: newLeft, bottom, right }) : null;
55643
55644
  }
55644
55645
  if (deltaRow < 0) {
55645
55646
  const newBottom = this.getNextAvailableRow(deltaRow, refCol, bottom - (n - 1));
55646
- result = refRow <= bottom - n ? expand({ top, left, bottom: newBottom, right }) : null;
55647
+ result =
55648
+ refZone.bottom <= bottom - n ? expand({ top, left, bottom: newBottom, right }) : null;
55647
55649
  }
55648
55650
  if (deltaRow > 0) {
55649
55651
  const newTop = this.getNextAvailableRow(deltaRow, refCol, top + (n - 1));
55650
- result = top + n <= refRow ? expand({ top: newTop, left, bottom, right }) : null;
55652
+ result = top + n <= refZone.top ? expand({ top: newTop, left, bottom, right }) : null;
55651
55653
  }
55652
55654
  result = result ? organizeZone(result) : result;
55653
55655
  if (result && !isEqual(result, anchor.zone)) {
@@ -55876,18 +55878,26 @@
55876
55878
  * If the anchor is hidden, browses from left to right and top to bottom to
55877
55879
  * find a visible cell.
55878
55880
  */
55879
- getReferencePosition() {
55881
+ getReferenceAnchor() {
55880
55882
  const sheetId = this.getters.getActiveSheetId();
55881
55883
  const anchor = this.anchor;
55882
55884
  const { left, right, top, bottom } = anchor.zone;
55883
55885
  const { col: anchorCol, row: anchorRow } = anchor.cell;
55886
+ const col = this.getters.isColHidden(sheetId, anchorCol)
55887
+ ? this.getters.findVisibleHeader(sheetId, "COL", left, right) || anchorCol
55888
+ : anchorCol;
55889
+ const row = this.getters.isRowHidden(sheetId, anchorRow)
55890
+ ? this.getters.findVisibleHeader(sheetId, "ROW", top, bottom) || anchorRow
55891
+ : anchorRow;
55892
+ const zone = this.getters.expandZone(sheetId, {
55893
+ left: col,
55894
+ right: col,
55895
+ top: row,
55896
+ bottom: row,
55897
+ });
55884
55898
  return {
55885
- col: this.getters.isColHidden(sheetId, anchorCol)
55886
- ? this.getters.findVisibleHeader(sheetId, "COL", left, right) || anchorCol
55887
- : anchorCol,
55888
- row: this.getters.isRowHidden(sheetId, anchorRow)
55889
- ? this.getters.findVisibleHeader(sheetId, "ROW", top, bottom) || anchorRow
55890
- : anchorRow,
55899
+ cell: { col, row },
55900
+ zone,
55891
55901
  };
55892
55902
  }
55893
55903
  deltaToTarget(position, direction, step) {
@@ -58352,9 +58362,9 @@
58352
58362
  exports.tokenize = tokenize;
58353
58363
 
58354
58364
 
58355
- __info__.version = "17.0.67";
58356
- __info__.date = "2025-06-23T15:02:54.391Z";
58357
- __info__.hash = "cb0b6a9";
58365
+ __info__.version = "17.0.68";
58366
+ __info__.date = "2025-06-27T09:09:05.702Z";
58367
+ __info__.hash = "33404c6";
58358
58368
 
58359
58369
 
58360
58370
  })(this.o_spreadsheet = this.o_spreadsheet || {}, owl);
@@ -2148,7 +2148,7 @@
2148
2148
  width: 100%;
2149
2149
  height: 28px;
2150
2150
  }
2151
- `;class GR extends t.Component{static template="o-spreadsheet-Spreadsheet";static components={TopBar:BR,Grid:EE,BottomBar:RR,SidePanel:NR,SpreadsheetDashboard:TR,HeaderGroupContainer:MR};sidePanel;composer;_focusGrid;keyDownMapping;isViewportTooSmall=!1;get model(){return this.props.model}getStyle(){return this.env.isDashboard()?"grid-template-rows: auto;":"grid-template-rows: 63px auto 37px"}setup(){this.sidePanel=t.useState({isOpen:!1,panelProps:{}}),this.composer=t.useState({topBarFocus:"inactive",gridFocusMode:"inactive"}),this.keyDownMapping={"CTRL+H":()=>this.toggleSidePanel("FindAndReplace",{}),"CTRL+F":()=>this.toggleSidePanel("FindAndReplace",{})};const e=this.model.config.external.fileStore;t.useSubEnv({model:this.model,imageProvider:e?new SR(e):void 0,loadCurrencies:this.model.config.external.loadCurrencies,loadLocales:this.model.config.external.loadLocales,isDashboard:()=>this.model.getters.isDashboard(),openSidePanel:this.openSidePanel.bind(this),toggleSidePanel:this.toggleSidePanel.bind(this),clipboard:this.env.clipboard||new HR(navigator.clipboard),startCellEdition:e=>this.onGridComposerCellFocused(e),focusableElement:new CR}),t.useExternalListener(window,"resize",(()=>this.render(!0))),t.useExternalListener(window,"beforeunload",this.unbindModelEvents.bind(this)),t.useExternalListener(document.body,"wheel",(()=>{})),this.bindModelEvents(),t.onWillUpdateProps((e=>{if(e.model!==this.props.model)throw new Error("Changing the props model is not supported at the moment.")})),t.onMounted((()=>{this.checkViewportSize()})),t.onWillUnmount((()=>this.unbindModelEvents())),t.onPatched((()=>{this.checkViewportSize()}))}get focusTopBarComposer(){return"inactive"===this.model.getters.getEditionMode()?"inactive":this.composer.topBarFocus}get focusGridComposer(){return"inactive"===this.model.getters.getEditionMode()?"inactive":this.composer.gridFocusMode}bindModelEvents(){this.model.on("update",this,(()=>this.render(!0))),this.model.on("notify-ui",this,(e=>this.env.notifyUser(e))),this.model.on("raise-error-ui",this,(({text:e})=>this.env.raiseError(e)))}unbindModelEvents(){this.model.off("update",this),this.model.off("notify-ui",this),this.model.off("raise-error-ui",this)}checkViewportSize(){const{xRatio:e,yRatio:t}=this.env.model.getters.getFrozenSheetViewRatio(this.env.model.getters.getActiveSheetId());if(isFinite(e)&&isFinite(t))if(t>.85||e>.85){if(this.isViewportTooSmall)return;this.env.notifyUser({text:a("The current window is too small to display this sheet properly. Consider resizing your browser window or adjusting frozen rows and columns."),type:"warning",sticky:!1}),this.isViewportTooSmall=!0}else this.isViewportTooSmall=!1}openSidePanel(e,t){this.sidePanel.isOpen&&e!==this.sidePanel.component&&this.sidePanel.panelProps?.onCloseSidePanel?.(),this.sidePanel.component=e,this.sidePanel.panelProps=t,this.sidePanel.isOpen=!0}closeSidePanel(){this.sidePanel.isOpen=!1,this.focusGrid(),this.sidePanel.panelProps?.onCloseSidePanel?.()}toggleSidePanel(e,t){this.sidePanel.isOpen&&e===this.sidePanel.component?(this.sidePanel.isOpen=!1,this.focusGrid()):this.openSidePanel(e,t)}focusGrid(){if(!this._focusGrid)throw new Error("_focusGrid should be exposed by the grid component");this._focusGrid()}onKeydown(e){let t="";Vr(e)&&(t+="CTRL+"),t+=e.key.toUpperCase();let o=this.keyDownMapping[t];if(o)return e.preventDefault(),e.stopPropagation(),void o()}onTopBarComposerFocused(e){this.model.getters.isReadonly()||(this.composer.topBarFocus="contentFocus",this.composer.gridFocusMode="inactive",this.setComposerContent({selection:e}))}onGridComposerContentFocused(e){this.model.getters.isReadonly()||(this.composer.topBarFocus="inactive",this.composer.gridFocusMode="contentFocus",this.setComposerContent({selection:e}))}onGridComposerCellFocused(e,t){this.model.getters.isReadonly()||(this.composer.topBarFocus="inactive",this.composer.gridFocusMode="cellFocus",this.setComposerContent({content:e,selection:t}||{}))}setComposerContent({content:e,selection:t}){"inactive"===this.model.getters.getEditionMode()?this.model.dispatch("START_EDITION",{text:e,selection:t}):e&&this.model.dispatch("SET_CURRENT_CONTENT",{content:e,selection:t})}get gridHeight(){const{height:e}=this.env.model.getters.getSheetViewDimension();return e}get gridContainerStyle(){const e=X*this.rowLayers.length,t=X*this.colLayers.length;return yr({"grid-template-columns":`${e?e+2:0}px auto`,"grid-template-rows":`${t?t+2:0}px auto`})}get rowLayers(){const e=this.env.model.getters.getActiveSheetId();return this.env.model.getters.getVisibleGroupLayers(e,"ROW")}get colLayers(){const e=this.env.model.getters.getActiveSheetId();return this.env.model.getters.getVisibleGroupLayers(e,"COL")}}GR.props={model:Object};class $R{listeners=[];async sendMessage(e){for(const{callback:t}of this.listeners)t(e)}onNewMessage(e,t){this.listeners.push({id:e,callback:t})}leave(e){this.listeners=this.listeners.filter((t=>t.id!==e))}}function WR(e){return Hl.get(e.type)(e)}function qR(e){if("string"==typeof e)return{};if("number"==typeof e)return[];throw new Error("Cannot create new node")}class ZR{buildTransformation;operations;constructor(e,t=[]){this.buildTransformation=e,this.operations=t}getOperations(){return this.operations}getOperation(e){const t=this.operations.find((t=>t.id===e));if(!t)throw new Error(`Operation ${e} not found`);return t}getLastOperationId(){return this.operations[this.operations.length-1]?.id}getFirstOperationAmong(e,t){for(const o of this.operations){if(o.id===e)return e;if(o.id===t)return t}throw new Error(`Operation ${e} and ${t} not found`)}contains(e){return!!this.operations.find((t=>t.id===e))}prepend(e){const t=this.buildTransformation.with(e.data);this.operations=[e,...this.operations.map((e=>e.transformed(t)))]}insert(e,t){const o=this.buildTransformation.with(e.data),{before:s,operation:n,after:i}=this.locateOperation(t);this.operations=[...s,n,e,...i.map((e=>e.transformed(o)))]}append(e){this.operations.push(e)}appendBranch(e){this.operations=this.operations.concat(e.operations)}fork(e){const{after:t}=this.locateOperation(e);return new ZR(this.buildTransformation,t)}transform(e){this.operations=this.operations.map((t=>t.transformed(e)))}cutBefore(e){this.operations=this.locateOperation(e).before}cutAfter(e){const{before:t,operation:o}=this.locateOperation(e);this.operations=t.concat([o])}locateOperation(e){const t=this.operations.findIndex((t=>t.id===e));if(-1===t)throw new Error(`Operation ${e} not found`);return{before:this.operations.slice(0,t),operation:this.operations[t],after:this.operations.slice(t+1)}}}class YR{id;data;constructor(e,t){this.id=e,this.data=t}transformed(e){return new jR(this.id,Xe((()=>e(this.data))))}}class jR{id;lazyData;constructor(e,t){this.id=e,this.lazyData=t}get data(){return this.lazyData()}transformed(e){return new jR(this.id,this.lazyData.map(e))}}class XR{operations;constructor(e){this.operations=e}[Symbol.iterator](){return this.operations[Symbol.iterator]()}stopWith(e){return new XR(function*(e,t){for(const o of e)if(yield o,o.operation.id===t)return}(this.operations,e))}stopBefore(e){return new XR(function*(e,t){for(const o of e){if(o.operation.id===t)return;yield o}}(this.operations,e))}startAfter(e){return new XR(function*(e,t){let o=!0;for(const s of e)o||(yield s),s.operation.id===t&&(o=!1)}(this.operations,e))}}class KR{buildTransformation;branches;branchingOperationIds=new Map;constructor(e,t){this.buildTransformation=e,this.branches=[t]}getLastBranch(){return this.branches[this.branches.length-1]}execution(e){return new XR(De(this._execution(e),this._execution(e)))}revertedExecution(e){return new XR(De(this._revertedExecution(e),this._revertedExecution(e)))}insertOperationLast(e,t){const o=e.getLastOperationId()||this.previousBranch(e)?.getLastOperationId();e.append(t),o&&this.insertPrevious(e,t,o)}insertOperationAfter(e,t,o){e.insert(t,o),this.updateNextWith(e,t,o),this.insertPrevious(e,t,o)}undo(e,t){const o=this.buildTransformation.without(t.data),s=this.branchingOperationIds.get(e);this.branchingOperationIds.set(e,t.id);const n=e.fork(t.id);s&&this.branchingOperationIds.set(n,s),this.insertBranchAfter(e,n),this.transform(n,o)}redo(e){const t=this.nextBranch(e);if(!t)return;const o=this.nextBranch(t);this.removeBranchFromTree(t);const s=this.branchingOperationIds.get(t);s?this.branchingOperationIds.set(e,s):this.branchingOperationIds.delete(e),o&&this.rebaseUp(o)}drop(e){for(const t of this.branches)t.contains(e)&&t.cutBefore(e)}findOperation(e,t){for(const o of this.revertedExecution(e))if(o.operation.id===t)return o;throw new Error(`Operation ${t} not found`)}rebaseUp(e){const{previousBranch:t,branchingOperation:o}=this.findPreviousBranchingOperation(e);if(!t||!o)return;const s=this.buildTransformation.without(o.data),n=t.fork(o.id);this.branchingOperationIds.set(n,this.branchingOperationIds.get(e)),this.removeBranchFromTree(e),this.insertBranchAfter(t,n),n.transform(s);const i=this.nextBranch(n);i&&this.rebaseUp(i)}removeBranchFromTree(e){const t=this.branches.findIndex((t=>t===e));this.branches.splice(t,1)}insertBranchAfter(e,t){const o=this.branches.findIndex((t=>t===e));this.branches.splice(o+1,0,t)}updateNextWith(e,t,o){const s=this.branchingOperationIds.get(e),n=this.nextBranch(e);if(s&&n)if(e.getFirstOperationAmong(o,s)===s){const i=this.addToNextBranch(e,n,s,t,o);this.updateNextWith(n,i,o)}else{const e=this.buildTransformation.with(t.data);this.transform(n,e)}}addToNextBranch(e,t,o,s,n){let i=s;return n===o?(i=this.getTransformedOperation(e,o,s),t.prepend(i)):t.contains(n)?(i=this.getTransformedOperation(e,o,s),t.insert(i,n)):t.append(s),i}getTransformedOperation(e,t,o){const s=e.getOperation(t),n=this.buildTransformation.without(s.data);return o.transformed(n)}shouldExecute(e,t){return t.id!==this.branchingOperationIds.get(e)}transform(e,t){e.transform(t);const o=this.nextBranch(e);o&&this.transform(o,t)}insertPrevious(e,t,o){const{previousBranch:s,branchingOperation:n}=this.findPreviousBranchingOperation(e);if(!s||!n)return;const i=this.buildTransformation.with(n.data),r=e.fork(o);r.transform(i),s.cutAfter(o),s.appendBranch(r);const a=t.transformed(i);this.insertPrevious(s,a,o)}findPreviousBranchingOperation(e){const t=this.previousBranch(e);if(!t)return{previousBranch:void 0,branchingOperation:void 0};const o=this.branchingOperationIds.get(t);return o?{previousBranch:t,branchingOperation:t.getOperation(o)}:{previousBranch:void 0,branchingOperation:void 0}}nextBranch(e){const t=this.branches.findIndex((t=>t===e));if(-1!==t)return this.branches[t+1]}previousBranch(e){const t=this.branches.findIndex((t=>t===e));if(-1!==t)return this.branches[t-1]}*_revertedExecution(e){const t=this.branchingOperationIds.get(e);let o=!!t;const s=e.getOperations();for(let n=s.length-1;n>=0;n--){const i=s[n];i.id===t&&(o=!1),o||(yield{operation:i,branch:e,isCancelled:!this.shouldExecute(e,i)})}const n=this.previousBranch(e);yield*n?this._revertedExecution(n):[]}*_execution(e){for(const t of e.getOperations())if(yield{operation:t,branch:e,isCancelled:!this.shouldExecute(e,t)},t.id===this.branchingOperationIds.get(e)){const t=this.nextBranch(e);return void(yield*t?this._execution(t):[])}if(!this.branchingOperationIds.get(e)){const t=this.nextBranch(e);yield*t?this._execution(t):[]}}}class QR{HEAD_BRANCH;HEAD_OPERATION;tree;applyOperation;revertOperation;buildEmpty;buildTransformation;constructor(e){this.applyOperation=e.applyOperation,this.revertOperation=e.revertOperation,this.buildEmpty=e.buildEmpty,this.buildTransformation=e.buildTransformation,this.HEAD_BRANCH=new ZR(this.buildTransformation),this.tree=new KR(this.buildTransformation,this.HEAD_BRANCH);const t=e.initialOperationId,o=new YR(t,this.buildEmpty(t));this.tree.insertOperationLast(this.HEAD_BRANCH,o),this.HEAD_OPERATION=o}get(e){return this.tree.findOperation(this.HEAD_BRANCH,e).operation.data}append(e,t){const o=new YR(e,t),s=this.tree.getLastBranch();this.tree.insertOperationLast(s,o),this.HEAD_BRANCH=s,this.HEAD_OPERATION=o}insert(e,t,o){const s=new YR(e,t);this.revertTo(o),this.tree.insertOperationAfter(this.HEAD_BRANCH,s,o),this.fastForward()}undo(e,t,o){const{branch:s,operation:n}=this.tree.findOperation(this.HEAD_BRANCH,e);this.revertBefore(e),this.tree.undo(s,n),this.fastForward(),this.insert(t,this.buildEmpty(t),o)}redo(e,t,o){const{branch:s}=this.tree.findOperation(this.HEAD_BRANCH,e);this.revertBefore(e),this.tree.redo(s),this.fastForward(),this.insert(t,this.buildEmpty(t),o)}rebase(e){const t=this.get(e),o=[...this.tree.execution(this.HEAD_BRANCH).startAfter(e)];this.revertBefore(e);const s=this.HEAD_OPERATION.id;this.tree.drop(e),this.insert(e,t,s);for(const{operation:e}of o)this.insert(e.id,e.data,this.HEAD_OPERATION.id)}getRevertedExecution(){const e=[],t=this.tree.revertedExecution(this.HEAD_BRANCH);for(const{operation:o}of t)e.push(o.data);return e}revertBefore(e){const t=this.tree.revertedExecution(this.HEAD_BRANCH).stopWith(e);this.revert(t)}revertTo(e){const t=e?this.tree.revertedExecution(this.HEAD_BRANCH).stopBefore(e):this.tree.revertedExecution(this.HEAD_BRANCH);this.revert(t)}revert(e){for(const{next:t,operation:o,isCancelled:s}of e)s||this.revertOperation(o.data),t&&(this.HEAD_BRANCH=t.branch,this.HEAD_OPERATION=t.operation)}fastForward(){const e=this.HEAD_OPERATION?this.tree.execution(this.HEAD_BRANCH).startAfter(this.HEAD_OPERATION.id):this.tree.execution(this.HEAD_BRANCH);for(const{operation:t,branch:o,isCancelled:s}of e)s||this.applyOperation(t.data),this.HEAD_OPERATION=t,this.HEAD_BRANCH=o}}function JR(e){return new QR({initialOperationId:e.initialRevisionId,applyOperation:t=>{const o=t.commands.slice(),{changes:s}=e.recordChanges((()=>{for(const t of o)e.dispatch(t)}));t.setChanges(s)},revertOperation:e=>function(e){for(const t of e.slice().reverse())for(let e=t.changes.length-1;e>=0;e--){eT(t.changes[e],"before")}}([e]),buildEmpty:e=>new VI(e,"empty",[]),buildTransformation:{with:e=>t=>new VI(t.id,t.clientId,LI(t.commands,e.commands),t.rootCommand,void 0,t.timestamp),without:e=>t=>new VI(t.id,t.clientId,LI(t.commands,e.commands.map(WR).flat()),t.rootCommand,void 0,t.timestamp)}})}function eT(e,t){let o=e.path[0];const s=e.path.at(-1);for(let t=1;t<e.path.slice(0,-1).length;t++){const s=e.path[t];if(void 0===o[s]){const n=e.path[t+1];o[s]=qR(n)}o=o[s]}void 0===e[t]?delete o[s]:o[s]=e[t]}class tT{observers=new Map;defaultSubscription;mainSubscription;registerAsDefault(e,t){this.defaultSubscription={owner:e,callbacks:t},this.mainSubscription||(this.mainSubscription=this.defaultSubscription)}observe(e,t){this.observers.set(e,{owner:e,callbacks:t})}capture(e,t){if(this.observers.get(e))throw new Error("You are already subscribed forever");this.mainSubscription?.owner&&this.mainSubscription.owner!==e&&this.mainSubscription.callbacks.release?.(),this.mainSubscription={owner:e,callbacks:t}}release(e){this.mainSubscription?.owner!==e||this.observers.get(e)||(this.mainSubscription=this.defaultSubscription)}getBackToDefault(){this.mainSubscription!==this.defaultSubscription&&(this.mainSubscription?.callbacks.release?.(),this.mainSubscription=this.defaultSubscription)}isListening(e){return this.mainSubscription?.owner===e}send(e){this.mainSubscription?.callbacks.handleEvent(e),this.observers.forEach((t=>t.callbacks.handleEvent(e)))}}class oT{getters;stream;anchor;defaultAnchor;constructor(e){this.getters=e,this.stream=new tT,this.anchor={cell:{col:0,row:0},zone:Ln({col:0,row:0})},this.defaultAnchor=this.anchor}capture(e,t,o){this.stream.capture(e,o),this.anchor=t}registerAsDefault(e,t,o){this.checkAnchorZoneOrThrow(t),this.stream.registerAsDefault(e,o),this.defaultAnchor=t,this.capture(e,t,o)}resetDefaultAnchor(e,t){this.checkAnchorZoneOrThrow(t),this.stream.isListening(e)&&(this.anchor=t),this.defaultAnchor=t}resetAnchor(e,t){this.checkAnchorZoneOrThrow(t),this.stream.isListening(e)&&(this.anchor=t)}observe(e,t){this.stream.observe(e,t)}release(e){this.stream.isListening(e)&&(this.stream.release(e),this.anchor=this.defaultAnchor)}getBackToDefault(){this.stream.getBackToDefault()}modifyAnchor(e,t,o){const s=this.getters.getActiveSheetId();return e={...e,zone:this.getters.expandZone(s,e.zone)},this.processEvent({options:o,anchor:e,mode:t})}selectZone(e,t={scrollIntoView:!0}){return this.modifyAnchor(e,"overrideSelection",t)}selectCell(e,t){const o=Ln({col:e,row:t});return this.selectZone({zone:o,cell:{col:e,row:t}},{scrollIntoView:!0})}moveAnchorCell(e,t=1){if("end"!==t&&t<=0)return new Io("InvalidSelectionStep");const{col:o,row:s}=this.getNextAvailablePosition(e,t);return this.selectCell(o,s)}setAnchorCorner(e,t){const o=this.getters.getActiveSheetId(),{col:s,row:n}=this.anchor.cell,i={left:Math.min(s,e),top:Math.min(n,t),right:Math.max(s,e),bottom:Math.max(n,t)},r={zone:this.getters.expandZone(o,i),cell:{col:s,row:n}};return this.processEvent({mode:"updateAnchor",anchor:r,options:{scrollIntoView:!1}})}addCellToSelection(e,t){const o=this.getters.getActiveSheetId();({col:e,row:t}=this.getters.getMainCellPosition({sheetId:o,col:e,row:t}));const s=this.getters.expandZone(o,Ln({col:e,row:t}));return this.processEvent({options:{scrollIntoView:!0},anchor:{zone:s,cell:{col:e,row:t}},mode:"newAnchor"})}resizeAnchorZone(e,t=1){if("end"!==t&&t<=0)return new Io("InvalidSelectionStep");const o=this.getters.getActiveSheetId(),s=this.anchor,{col:n,row:i}=s.cell,{left:r,right:a,top:l,bottom:c}=s.zone,h=this.getStartingPosition(e);let[d,u]=this.deltaToTarget(h,e,t);if(0===d&&0===u)return Io.Success;let g=s.zone;const p=e=>{e=Dn(e);const{left:t,right:s,top:n,bottom:i}=this.getters.expandZone(o,e);return{left:Math.max(0,t),right:Math.min(this.getters.getNumberCols(o)-1,s),top:Math.max(0,n),bottom:Math.min(this.getters.getNumberRows(o)-1,i)}},{col:m,row:f}=this.getReferencePosition();let b=0;for(;null!==g;){if(b++,d<0){const e=this.getNextAvailableCol(d,a-(b-1),f);g=m<=a-b?p({top:l,left:r,bottom:c,right:e}):null}if(d>0){const e=this.getNextAvailableCol(d,r+(b-1),f);g=r+b<=m?p({top:l,left:e,bottom:c,right:a}):null}if(u<0){const e=this.getNextAvailableRow(u,m,c-(b-1));g=f<=c-b?p({top:l,left:r,bottom:e,right:a}):null}if(u>0){const e=this.getNextAvailableRow(u,m,l+(b-1));g=l+b<=f?p({top:e,left:r,bottom:c,right:a}):null}if(g=g?Dn(g):g,g&&!wn(g,s.zone))return this.processEvent({options:{scrollIntoView:!0},mode:"updateAnchor",anchor:{zone:g,cell:{col:n,row:i}}})}g=p(En({top:i,bottom:i,left:n,right:n},Dn({top:this.getNextAvailableRow(u,m,l),left:this.getNextAvailableCol(d,r,f),bottom:this.getNextAvailableRow(u,m,c),right:this.getNextAvailableCol(d,a,f)})));const v={zone:g,cell:{col:n,row:i}};return this.processEvent({anchor:v,mode:"updateAnchor",options:{scrollIntoView:!0}})}selectColumn(e,t){const o=this.getters.getActiveSheetId(),s=this.getters.getNumberRows(o)-1;let n={left:e,right:e,top:0,bottom:s};const i=this.getters.findFirstVisibleColRowIndex(o,"ROW");let r,a;switch(t){case"overrideSelection":case"newAnchor":r=e,a=i;break;case"updateAnchor":({col:r,row:a}=this.anchor.cell),n=En(n,{left:r,right:r,top:i,bottom:s})}return this.processEvent({options:{scrollIntoView:!1,unbounded:!0},anchor:{zone:n,cell:{col:r,row:a}},mode:t})}selectRow(e,t){const o=this.getters.getActiveSheetId(),s=this.getters.getNumberCols(o)-1;let n={top:e,bottom:e,left:0,right:s};const i=this.getters.findFirstVisibleColRowIndex(o,"COL");let r,a;switch(t){case"overrideSelection":case"newAnchor":r=i,a=e;break;case"updateAnchor":({col:r,row:a}=this.anchor.cell),n=En(n,{left:i,right:s,top:a,bottom:a})}return this.processEvent({options:{scrollIntoView:!1,unbounded:!0},anchor:{zone:n,cell:{col:r,row:a}},mode:t})}loopSelection(){const e=this.getters.getActiveSheetId(),t=this.anchor;if(wn(this.anchor.zone,this.getters.getSheetZone(e)))return this.modifyAnchor({...t,zone:Ln(t.cell)},"updateAnchor",{scrollIntoView:!1});const o=this.expandZoneToTable(t.zone);return Je(o,t.zone)?this.selectAll():this.modifyAnchor({...t,zone:o},"updateAnchor",{scrollIntoView:!1})}selectTableAroundSelection(){const e=this.expandZoneToTable(this.anchor.zone);return this.modifyAnchor({...this.anchor,zone:e},"updateAnchor",{scrollIntoView:!1})}selectAll(){const e=this.getters.getActiveSheetId(),t={left:0,top:0,bottom:this.getters.getNumberRows(e)-1,right:this.getters.getNumberCols(e)-1};return this.processEvent({mode:"overrideSelection",anchor:{zone:t,cell:this.anchor.cell},options:{scrollIntoView:!1}})}isListening(e){return this.stream.isListening(e)}processEvent(e){const t={...e,previousAnchor:Ae(this.anchor)},o=this.checkEventAnchorZone(t);return"Success"!==o?new Io(o):(this.anchor=t.anchor,this.stream.send(t),Io.Success)}checkEventAnchorZone(e){return this.checkAnchorZone(e.anchor)}checkAnchorZone(e){const{cell:t,zone:o}=e;if(!In(t.col,t.row,o))return"InvalidAnchorZone";const{left:s,right:n,top:i,bottom:r}=o,a=this.getters.getActiveSheetId(),l=this.getters.findVisibleHeader(a,"COL",s,n);return void 0===this.getters.findVisibleHeader(a,"ROW",i,r)||void 0===l?"SelectionOutOfBound":"Success"}checkAnchorZoneOrThrow(e){if("InvalidAnchorZone"===this.checkAnchorZone(e))throw new Error(a("The provided anchor is invalid. The cell must be part of the zone."))}getNextAvailablePosition(e,t=1){const{col:o,row:s}=this.anchor.cell,n=this.deltaToTarget({col:o,row:s},e,t);return{col:this.getNextAvailableCol(n[0],o,s),row:this.getNextAvailableRow(n[1],o,s)}}getNextAvailableCol(e,t,o){const s=this.getters.getActiveSheetId(),n={col:t,row:o};return this.getNextAvailableHeader(e,"COL",t,n,(e=>this.getters.isInSameMerge(s,t,o,e,o)))}getNextAvailableRow(e,t,o){const s=this.getters.getActiveSheetId(),n={col:t,row:o};return this.getNextAvailableHeader(e,"ROW",o,n,(e=>this.getters.isInSameMerge(s,t,o,t,e)))}getNextAvailableHeader(e,t,o,s,n){const i=this.getters.getActiveSheetId();if(0===e)return o;const r=Math.sign(e);let a=o+e;for(;n(a);)a+=r;for(;this.getters.isHeaderHidden(i,t,a);)a+=r;return a<0||a>this.getters.getNumberHeaders(i,t)-1?this.getters.isHeaderHidden(i,t,o)?this.getNextAvailableHeader(-r,t,o,s,n):o:a}getReferencePosition(){const e=this.getters.getActiveSheetId(),t=this.anchor,{left:o,right:s,top:n,bottom:i}=t.zone,{col:r,row:a}=t.cell;return{col:this.getters.isColHidden(e,r)&&this.getters.findVisibleHeader(e,"COL",o,s)||r,row:this.getters.isRowHidden(e,a)&&this.getters.findVisibleHeader(e,"ROW",n,i)||a}}deltaToTarget(e,t,o){switch(t){case"up":return"end"!==o?[0,-o]:[0,this.getEndOfCluster(e,"rows",-1)-e.row];case"down":return"end"!==o?[0,o]:[0,this.getEndOfCluster(e,"rows",1)-e.row];case"left":return"end"!==o?[-o,0]:[this.getEndOfCluster(e,"cols",-1)-e.col,0];case"right":return"end"!==o?[o,0]:[this.getEndOfCluster(e,"cols",1)-e.col,0]}}getStartingPosition(e){let{col:t,row:o}=this.getPosition();const s=this.anchor.zone;switch(e){case"down":case"up":o=o===s.top?s.bottom:s.top;break;case"left":case"right":t=t===s.right?s.left:s.right}return{col:t,row:o}}getEndOfCluster(e,t,o){let s=e;const n=this.getNextCellPosition(e,t,o);let i=this.isEvaluatedCellEmpty(s)||this.isEvaluatedCellEmpty(n)?"nextCluster":"endOfCluster";for(;;){const e=this.getNextCellPosition(s,t,o);if(s.col===e.col&&s.row===e.row)break;const n=this.isEvaluatedCellEmpty(e);if("endOfCluster"===i&&n)break;if("nextCluster"===i&&!n){s=e;break}s=e}return"cols"===t?s.col:s.row}isCellEmpty({col:e,row:t}){const o=this.getters.getActiveSheetId(),s=this.getters.getMainCellPosition({sheetId:o,col:e,row:t});return!(this.getters.getCorrespondingFormulaCell(s)||this.getters.getCell(s)?.content)}isEvaluatedCellEmpty({col:e,row:t}){const o=this.getters.getActiveSheetId(),s=this.getters.getMainCellPosition({sheetId:o,col:e,row:t});return this.getters.getEvaluatedCell(s).type===bo.empty}getNextCellPosition(e,t,o){const s="cols"===t?"col":"row",n={...e},i="cols"===t?this.getNextAvailableCol(o,n.col,n.row):this.getNextAvailableRow(o,n.col,n.row);return n[s]=i,{col:n.col,row:n.row}}getPosition(){return{...this.anchor.cell}}expandZoneToTable(e){const t=e=>{for(const t of Ne(e.left,e.right+1)){if(!this.isCellEmpty({col:t,row:e.top-1}))return{...e,top:e.top-1};if(!this.isCellEmpty({col:t,row:e.bottom+1}))return{...e,bottom:e.bottom+1}}for(const t of Ne(e.top,e.bottom+1)){if(!this.isCellEmpty({col:e.left-1,row:t}))return{...e,left:e.left-1};if(!this.isCellEmpty({col:e.right+1,row:t}))return{...e,right:e.right+1}}return e};let o=!1,s=e;do{o=!1;const e=t(s);wn(s,e)||(o=!0,s=e)}while(o);return s}}class sT{changes;commands=[];recordChanges(e){return this.changes=[],this.commands=[],e(),{changes:this.changes,commands:this.commands}}addCommand(e){this.commands.push(e)}addChange(...e){const t=e.pop();let o=e[0],s=e.at(-1);const n=e.length-2;for(let t=1;t<=n;t++){const s=e[t];if(void 0===o[s]){const n=e[t+1];o[s]=qR(n)}o=o[s]}o[s]!==t&&(this.changes?.push({path:e,before:o[s],after:t}),void 0===t?delete o[s]:o[s]=t)}}const nT=17781237,iT=88853993;function rT(e,t,o){const s=[["xmlns:r",NE],["xmlns:a",TE],["xmlns:c",AE]],n=aT({backgroundColor:e.data.backgroundColor,line:{color:"000000"}});let i=Cw``;e.data.title&&(i=Cw`
2151
+ `;class GR extends t.Component{static template="o-spreadsheet-Spreadsheet";static components={TopBar:BR,Grid:EE,BottomBar:RR,SidePanel:NR,SpreadsheetDashboard:TR,HeaderGroupContainer:MR};sidePanel;composer;_focusGrid;keyDownMapping;isViewportTooSmall=!1;get model(){return this.props.model}getStyle(){return this.env.isDashboard()?"grid-template-rows: auto;":"grid-template-rows: 63px auto 37px"}setup(){this.sidePanel=t.useState({isOpen:!1,panelProps:{}}),this.composer=t.useState({topBarFocus:"inactive",gridFocusMode:"inactive"}),this.keyDownMapping={"CTRL+H":()=>this.toggleSidePanel("FindAndReplace",{}),"CTRL+F":()=>this.toggleSidePanel("FindAndReplace",{})};const e=this.model.config.external.fileStore;t.useSubEnv({model:this.model,imageProvider:e?new SR(e):void 0,loadCurrencies:this.model.config.external.loadCurrencies,loadLocales:this.model.config.external.loadLocales,isDashboard:()=>this.model.getters.isDashboard(),openSidePanel:this.openSidePanel.bind(this),toggleSidePanel:this.toggleSidePanel.bind(this),clipboard:this.env.clipboard||new HR(navigator.clipboard),startCellEdition:e=>this.onGridComposerCellFocused(e),focusableElement:new CR}),t.useExternalListener(window,"resize",(()=>this.render(!0))),t.useExternalListener(window,"beforeunload",this.unbindModelEvents.bind(this)),t.useExternalListener(document.body,"wheel",(()=>{})),this.bindModelEvents(),t.onWillUpdateProps((e=>{if(e.model!==this.props.model)throw new Error("Changing the props model is not supported at the moment.")})),t.onMounted((()=>{this.checkViewportSize()})),t.onWillUnmount((()=>this.unbindModelEvents())),t.onPatched((()=>{this.checkViewportSize()}))}get focusTopBarComposer(){return"inactive"===this.model.getters.getEditionMode()?"inactive":this.composer.topBarFocus}get focusGridComposer(){return"inactive"===this.model.getters.getEditionMode()?"inactive":this.composer.gridFocusMode}bindModelEvents(){this.model.on("update",this,(()=>this.render(!0))),this.model.on("notify-ui",this,(e=>this.env.notifyUser(e))),this.model.on("raise-error-ui",this,(({text:e})=>this.env.raiseError(e)))}unbindModelEvents(){this.model.off("update",this),this.model.off("notify-ui",this),this.model.off("raise-error-ui",this)}checkViewportSize(){const{xRatio:e,yRatio:t}=this.env.model.getters.getFrozenSheetViewRatio(this.env.model.getters.getActiveSheetId());if(isFinite(e)&&isFinite(t))if(t>.85||e>.85){if(this.isViewportTooSmall)return;this.env.notifyUser({text:a("The current window is too small to display this sheet properly. Consider resizing your browser window or adjusting frozen rows and columns."),type:"warning",sticky:!1}),this.isViewportTooSmall=!0}else this.isViewportTooSmall=!1}openSidePanel(e,t){this.sidePanel.isOpen&&e!==this.sidePanel.component&&this.sidePanel.panelProps?.onCloseSidePanel?.(),this.sidePanel.component=e,this.sidePanel.panelProps=t,this.sidePanel.isOpen=!0}closeSidePanel(){this.sidePanel.isOpen=!1,this.focusGrid(),this.sidePanel.panelProps?.onCloseSidePanel?.()}toggleSidePanel(e,t){this.sidePanel.isOpen&&e===this.sidePanel.component?(this.sidePanel.isOpen=!1,this.focusGrid()):this.openSidePanel(e,t)}focusGrid(){if(!this._focusGrid)throw new Error("_focusGrid should be exposed by the grid component");this._focusGrid()}onKeydown(e){let t="";Vr(e)&&(t+="CTRL+"),t+=e.key.toUpperCase();let o=this.keyDownMapping[t];if(o)return e.preventDefault(),e.stopPropagation(),void o()}onTopBarComposerFocused(e){this.model.getters.isReadonly()||(this.composer.topBarFocus="contentFocus",this.composer.gridFocusMode="inactive",this.setComposerContent({selection:e}))}onGridComposerContentFocused(e){this.model.getters.isReadonly()||(this.composer.topBarFocus="inactive",this.composer.gridFocusMode="contentFocus",this.setComposerContent({selection:e}))}onGridComposerCellFocused(e,t){this.model.getters.isReadonly()||(this.composer.topBarFocus="inactive",this.composer.gridFocusMode="cellFocus",this.setComposerContent({content:e,selection:t}||{}))}setComposerContent({content:e,selection:t}){"inactive"===this.model.getters.getEditionMode()?this.model.dispatch("START_EDITION",{text:e,selection:t}):e&&this.model.dispatch("SET_CURRENT_CONTENT",{content:e,selection:t})}get gridHeight(){const{height:e}=this.env.model.getters.getSheetViewDimension();return e}get gridContainerStyle(){const e=X*this.rowLayers.length,t=X*this.colLayers.length;return yr({"grid-template-columns":`${e?e+2:0}px auto`,"grid-template-rows":`${t?t+2:0}px auto`})}get rowLayers(){const e=this.env.model.getters.getActiveSheetId();return this.env.model.getters.getVisibleGroupLayers(e,"ROW")}get colLayers(){const e=this.env.model.getters.getActiveSheetId();return this.env.model.getters.getVisibleGroupLayers(e,"COL")}}GR.props={model:Object};class $R{listeners=[];async sendMessage(e){for(const{callback:t}of this.listeners)t(e)}onNewMessage(e,t){this.listeners.push({id:e,callback:t})}leave(e){this.listeners=this.listeners.filter((t=>t.id!==e))}}function WR(e){return Hl.get(e.type)(e)}function qR(e){if("string"==typeof e)return{};if("number"==typeof e)return[];throw new Error("Cannot create new node")}class ZR{buildTransformation;operations;constructor(e,t=[]){this.buildTransformation=e,this.operations=t}getOperations(){return this.operations}getOperation(e){const t=this.operations.find((t=>t.id===e));if(!t)throw new Error(`Operation ${e} not found`);return t}getLastOperationId(){return this.operations[this.operations.length-1]?.id}getFirstOperationAmong(e,t){for(const o of this.operations){if(o.id===e)return e;if(o.id===t)return t}throw new Error(`Operation ${e} and ${t} not found`)}contains(e){return!!this.operations.find((t=>t.id===e))}prepend(e){const t=this.buildTransformation.with(e.data);this.operations=[e,...this.operations.map((e=>e.transformed(t)))]}insert(e,t){const o=this.buildTransformation.with(e.data),{before:s,operation:n,after:i}=this.locateOperation(t);this.operations=[...s,n,e,...i.map((e=>e.transformed(o)))]}append(e){this.operations.push(e)}appendBranch(e){this.operations=this.operations.concat(e.operations)}fork(e){const{after:t}=this.locateOperation(e);return new ZR(this.buildTransformation,t)}transform(e){this.operations=this.operations.map((t=>t.transformed(e)))}cutBefore(e){this.operations=this.locateOperation(e).before}cutAfter(e){const{before:t,operation:o}=this.locateOperation(e);this.operations=t.concat([o])}locateOperation(e){const t=this.operations.findIndex((t=>t.id===e));if(-1===t)throw new Error(`Operation ${e} not found`);return{before:this.operations.slice(0,t),operation:this.operations[t],after:this.operations.slice(t+1)}}}class YR{id;data;constructor(e,t){this.id=e,this.data=t}transformed(e){return new jR(this.id,Xe((()=>e(this.data))))}}class jR{id;lazyData;constructor(e,t){this.id=e,this.lazyData=t}get data(){return this.lazyData()}transformed(e){return new jR(this.id,this.lazyData.map(e))}}class XR{operations;constructor(e){this.operations=e}[Symbol.iterator](){return this.operations[Symbol.iterator]()}stopWith(e){return new XR(function*(e,t){for(const o of e)if(yield o,o.operation.id===t)return}(this.operations,e))}stopBefore(e){return new XR(function*(e,t){for(const o of e){if(o.operation.id===t)return;yield o}}(this.operations,e))}startAfter(e){return new XR(function*(e,t){let o=!0;for(const s of e)o||(yield s),s.operation.id===t&&(o=!1)}(this.operations,e))}}class KR{buildTransformation;branches;branchingOperationIds=new Map;constructor(e,t){this.buildTransformation=e,this.branches=[t]}getLastBranch(){return this.branches[this.branches.length-1]}execution(e){return new XR(De(this._execution(e),this._execution(e)))}revertedExecution(e){return new XR(De(this._revertedExecution(e),this._revertedExecution(e)))}insertOperationLast(e,t){const o=e.getLastOperationId()||this.previousBranch(e)?.getLastOperationId();e.append(t),o&&this.insertPrevious(e,t,o)}insertOperationAfter(e,t,o){e.insert(t,o),this.updateNextWith(e,t,o),this.insertPrevious(e,t,o)}undo(e,t){const o=this.buildTransformation.without(t.data),s=this.branchingOperationIds.get(e);this.branchingOperationIds.set(e,t.id);const n=e.fork(t.id);s&&this.branchingOperationIds.set(n,s),this.insertBranchAfter(e,n),this.transform(n,o)}redo(e){const t=this.nextBranch(e);if(!t)return;const o=this.nextBranch(t);this.removeBranchFromTree(t);const s=this.branchingOperationIds.get(t);s?this.branchingOperationIds.set(e,s):this.branchingOperationIds.delete(e),o&&this.rebaseUp(o)}drop(e){for(const t of this.branches)t.contains(e)&&t.cutBefore(e)}findOperation(e,t){for(const o of this.revertedExecution(e))if(o.operation.id===t)return o;throw new Error(`Operation ${t} not found`)}rebaseUp(e){const{previousBranch:t,branchingOperation:o}=this.findPreviousBranchingOperation(e);if(!t||!o)return;const s=this.buildTransformation.without(o.data),n=t.fork(o.id);this.branchingOperationIds.set(n,this.branchingOperationIds.get(e)),this.removeBranchFromTree(e),this.insertBranchAfter(t,n),n.transform(s);const i=this.nextBranch(n);i&&this.rebaseUp(i)}removeBranchFromTree(e){const t=this.branches.findIndex((t=>t===e));this.branches.splice(t,1)}insertBranchAfter(e,t){const o=this.branches.findIndex((t=>t===e));this.branches.splice(o+1,0,t)}updateNextWith(e,t,o){const s=this.branchingOperationIds.get(e),n=this.nextBranch(e);if(s&&n)if(e.getFirstOperationAmong(o,s)===s){const i=this.addToNextBranch(e,n,s,t,o);this.updateNextWith(n,i,o)}else{const e=this.buildTransformation.with(t.data);this.transform(n,e)}}addToNextBranch(e,t,o,s,n){let i=s;return n===o?(i=this.getTransformedOperation(e,o,s),t.prepend(i)):t.contains(n)?(i=this.getTransformedOperation(e,o,s),t.insert(i,n)):t.append(s),i}getTransformedOperation(e,t,o){const s=e.getOperation(t),n=this.buildTransformation.without(s.data);return o.transformed(n)}shouldExecute(e,t){return t.id!==this.branchingOperationIds.get(e)}transform(e,t){e.transform(t);const o=this.nextBranch(e);o&&this.transform(o,t)}insertPrevious(e,t,o){const{previousBranch:s,branchingOperation:n}=this.findPreviousBranchingOperation(e);if(!s||!n)return;const i=this.buildTransformation.with(n.data),r=e.fork(o);r.transform(i),s.cutAfter(o),s.appendBranch(r);const a=t.transformed(i);this.insertPrevious(s,a,o)}findPreviousBranchingOperation(e){const t=this.previousBranch(e);if(!t)return{previousBranch:void 0,branchingOperation:void 0};const o=this.branchingOperationIds.get(t);return o?{previousBranch:t,branchingOperation:t.getOperation(o)}:{previousBranch:void 0,branchingOperation:void 0}}nextBranch(e){const t=this.branches.findIndex((t=>t===e));if(-1!==t)return this.branches[t+1]}previousBranch(e){const t=this.branches.findIndex((t=>t===e));if(-1!==t)return this.branches[t-1]}*_revertedExecution(e){const t=this.branchingOperationIds.get(e);let o=!!t;const s=e.getOperations();for(let n=s.length-1;n>=0;n--){const i=s[n];i.id===t&&(o=!1),o||(yield{operation:i,branch:e,isCancelled:!this.shouldExecute(e,i)})}const n=this.previousBranch(e);yield*n?this._revertedExecution(n):[]}*_execution(e){for(const t of e.getOperations())if(yield{operation:t,branch:e,isCancelled:!this.shouldExecute(e,t)},t.id===this.branchingOperationIds.get(e)){const t=this.nextBranch(e);return void(yield*t?this._execution(t):[])}if(!this.branchingOperationIds.get(e)){const t=this.nextBranch(e);yield*t?this._execution(t):[]}}}class QR{HEAD_BRANCH;HEAD_OPERATION;tree;applyOperation;revertOperation;buildEmpty;buildTransformation;constructor(e){this.applyOperation=e.applyOperation,this.revertOperation=e.revertOperation,this.buildEmpty=e.buildEmpty,this.buildTransformation=e.buildTransformation,this.HEAD_BRANCH=new ZR(this.buildTransformation),this.tree=new KR(this.buildTransformation,this.HEAD_BRANCH);const t=e.initialOperationId,o=new YR(t,this.buildEmpty(t));this.tree.insertOperationLast(this.HEAD_BRANCH,o),this.HEAD_OPERATION=o}get(e){return this.tree.findOperation(this.HEAD_BRANCH,e).operation.data}append(e,t){const o=new YR(e,t),s=this.tree.getLastBranch();this.tree.insertOperationLast(s,o),this.HEAD_BRANCH=s,this.HEAD_OPERATION=o}insert(e,t,o){const s=new YR(e,t);this.revertTo(o),this.tree.insertOperationAfter(this.HEAD_BRANCH,s,o),this.fastForward()}undo(e,t,o){const{branch:s,operation:n}=this.tree.findOperation(this.HEAD_BRANCH,e);this.revertBefore(e),this.tree.undo(s,n),this.fastForward(),this.insert(t,this.buildEmpty(t),o)}redo(e,t,o){const{branch:s}=this.tree.findOperation(this.HEAD_BRANCH,e);this.revertBefore(e),this.tree.redo(s),this.fastForward(),this.insert(t,this.buildEmpty(t),o)}rebase(e){const t=this.get(e),o=[...this.tree.execution(this.HEAD_BRANCH).startAfter(e)];this.revertBefore(e);const s=this.HEAD_OPERATION.id;this.tree.drop(e),this.insert(e,t,s);for(const{operation:e}of o)this.insert(e.id,e.data,this.HEAD_OPERATION.id)}getRevertedExecution(){const e=[],t=this.tree.revertedExecution(this.HEAD_BRANCH);for(const{operation:o}of t)e.push(o.data);return e}revertBefore(e){const t=this.tree.revertedExecution(this.HEAD_BRANCH).stopWith(e);this.revert(t)}revertTo(e){const t=e?this.tree.revertedExecution(this.HEAD_BRANCH).stopBefore(e):this.tree.revertedExecution(this.HEAD_BRANCH);this.revert(t)}revert(e){for(const{next:t,operation:o,isCancelled:s}of e)s||this.revertOperation(o.data),t&&(this.HEAD_BRANCH=t.branch,this.HEAD_OPERATION=t.operation)}fastForward(){const e=this.HEAD_OPERATION?this.tree.execution(this.HEAD_BRANCH).startAfter(this.HEAD_OPERATION.id):this.tree.execution(this.HEAD_BRANCH);for(const{operation:t,branch:o,isCancelled:s}of e)s||this.applyOperation(t.data),this.HEAD_OPERATION=t,this.HEAD_BRANCH=o}}function JR(e){return new QR({initialOperationId:e.initialRevisionId,applyOperation:t=>{const o=t.commands.slice(),{changes:s}=e.recordChanges((()=>{for(const t of o)e.dispatch(t)}));t.setChanges(s)},revertOperation:e=>function(e){for(const t of e.slice().reverse())for(let e=t.changes.length-1;e>=0;e--){eT(t.changes[e],"before")}}([e]),buildEmpty:e=>new VI(e,"empty",[]),buildTransformation:{with:e=>t=>new VI(t.id,t.clientId,LI(t.commands,e.commands),t.rootCommand,void 0,t.timestamp),without:e=>t=>new VI(t.id,t.clientId,LI(t.commands,e.commands.map(WR).flat()),t.rootCommand,void 0,t.timestamp)}})}function eT(e,t){let o=e.path[0];const s=e.path.at(-1);for(let t=1;t<e.path.slice(0,-1).length;t++){const s=e.path[t];if(void 0===o[s]){const n=e.path[t+1];o[s]=qR(n)}o=o[s]}void 0===e[t]?delete o[s]:o[s]=e[t]}class tT{observers=new Map;defaultSubscription;mainSubscription;registerAsDefault(e,t){this.defaultSubscription={owner:e,callbacks:t},this.mainSubscription||(this.mainSubscription=this.defaultSubscription)}observe(e,t){this.observers.set(e,{owner:e,callbacks:t})}capture(e,t){if(this.observers.get(e))throw new Error("You are already subscribed forever");this.mainSubscription?.owner&&this.mainSubscription.owner!==e&&this.mainSubscription.callbacks.release?.(),this.mainSubscription={owner:e,callbacks:t}}release(e){this.mainSubscription?.owner!==e||this.observers.get(e)||(this.mainSubscription=this.defaultSubscription)}getBackToDefault(){this.mainSubscription!==this.defaultSubscription&&(this.mainSubscription?.callbacks.release?.(),this.mainSubscription=this.defaultSubscription)}isListening(e){return this.mainSubscription?.owner===e}send(e){this.mainSubscription?.callbacks.handleEvent(e),this.observers.forEach((t=>t.callbacks.handleEvent(e)))}}class oT{getters;stream;anchor;defaultAnchor;constructor(e){this.getters=e,this.stream=new tT,this.anchor={cell:{col:0,row:0},zone:Ln({col:0,row:0})},this.defaultAnchor=this.anchor}capture(e,t,o){this.stream.capture(e,o),this.anchor=t}registerAsDefault(e,t,o){this.checkAnchorZoneOrThrow(t),this.stream.registerAsDefault(e,o),this.defaultAnchor=t,this.capture(e,t,o)}resetDefaultAnchor(e,t){this.checkAnchorZoneOrThrow(t),this.stream.isListening(e)&&(this.anchor=t),this.defaultAnchor=t}resetAnchor(e,t){this.checkAnchorZoneOrThrow(t),this.stream.isListening(e)&&(this.anchor=t)}observe(e,t){this.stream.observe(e,t)}release(e){this.stream.isListening(e)&&(this.stream.release(e),this.anchor=this.defaultAnchor)}getBackToDefault(){this.stream.getBackToDefault()}modifyAnchor(e,t,o){const s=this.getters.getActiveSheetId();return e={...e,zone:this.getters.expandZone(s,e.zone)},this.processEvent({options:o,anchor:e,mode:t})}selectZone(e,t={scrollIntoView:!0}){return this.modifyAnchor(e,"overrideSelection",t)}selectCell(e,t){const o=Ln({col:e,row:t});return this.selectZone({zone:o,cell:{col:e,row:t}},{scrollIntoView:!0})}moveAnchorCell(e,t=1){if("end"!==t&&t<=0)return new Io("InvalidSelectionStep");const{col:o,row:s}=this.getNextAvailablePosition(e,t);return this.selectCell(o,s)}setAnchorCorner(e,t){const o=this.getters.getActiveSheetId(),{col:s,row:n}=this.anchor.cell,i={left:Math.min(s,e),top:Math.min(n,t),right:Math.max(s,e),bottom:Math.max(n,t)},r={zone:this.getters.expandZone(o,i),cell:{col:s,row:n}};return this.processEvent({mode:"updateAnchor",anchor:r,options:{scrollIntoView:!1}})}addCellToSelection(e,t){const o=this.getters.getActiveSheetId();({col:e,row:t}=this.getters.getMainCellPosition({sheetId:o,col:e,row:t}));const s=this.getters.expandZone(o,Ln({col:e,row:t}));return this.processEvent({options:{scrollIntoView:!0},anchor:{zone:s,cell:{col:e,row:t}},mode:"newAnchor"})}resizeAnchorZone(e,t=1){if("end"!==t&&t<=0)return new Io("InvalidSelectionStep");const o=this.getters.getActiveSheetId(),s=this.anchor,{col:n,row:i}=s.cell,{left:r,right:a,top:l,bottom:c}=s.zone,h=this.getStartingPosition(e);let[d,u]=this.deltaToTarget(h,e,t);if(0===d&&0===u)return Io.Success;let g=s.zone;const p=e=>{e=Dn(e);const{left:t,right:s,top:n,bottom:i}=this.getters.expandZone(o,e);return{left:Math.max(0,t),right:Math.min(this.getters.getNumberCols(o)-1,s),top:Math.max(0,n),bottom:Math.min(this.getters.getNumberRows(o)-1,i)}},{cell:m,zone:f}=this.getReferenceAnchor(),{col:b,row:v}=m;let S=0;for(;null!==g;){if(S++,d<0){const e=this.getNextAvailableCol(d,a-(S-1),v);g=f.right<=a-S?p({top:l,left:r,bottom:c,right:e}):null}if(d>0){const e=this.getNextAvailableCol(d,r+(S-1),v);g=r+S<=f.left?p({top:l,left:e,bottom:c,right:a}):null}if(u<0){const e=this.getNextAvailableRow(u,b,c-(S-1));g=f.bottom<=c-S?p({top:l,left:r,bottom:e,right:a}):null}if(u>0){const e=this.getNextAvailableRow(u,b,l+(S-1));g=l+S<=f.top?p({top:e,left:r,bottom:c,right:a}):null}if(g=g?Dn(g):g,g&&!wn(g,s.zone))return this.processEvent({options:{scrollIntoView:!0},mode:"updateAnchor",anchor:{zone:g,cell:{col:n,row:i}}})}g=p(En({top:i,bottom:i,left:n,right:n},Dn({top:this.getNextAvailableRow(u,b,l),left:this.getNextAvailableCol(d,r,v),bottom:this.getNextAvailableRow(u,b,c),right:this.getNextAvailableCol(d,a,v)})));const C={zone:g,cell:{col:n,row:i}};return this.processEvent({anchor:C,mode:"updateAnchor",options:{scrollIntoView:!0}})}selectColumn(e,t){const o=this.getters.getActiveSheetId(),s=this.getters.getNumberRows(o)-1;let n={left:e,right:e,top:0,bottom:s};const i=this.getters.findFirstVisibleColRowIndex(o,"ROW");let r,a;switch(t){case"overrideSelection":case"newAnchor":r=e,a=i;break;case"updateAnchor":({col:r,row:a}=this.anchor.cell),n=En(n,{left:r,right:r,top:i,bottom:s})}return this.processEvent({options:{scrollIntoView:!1,unbounded:!0},anchor:{zone:n,cell:{col:r,row:a}},mode:t})}selectRow(e,t){const o=this.getters.getActiveSheetId(),s=this.getters.getNumberCols(o)-1;let n={top:e,bottom:e,left:0,right:s};const i=this.getters.findFirstVisibleColRowIndex(o,"COL");let r,a;switch(t){case"overrideSelection":case"newAnchor":r=i,a=e;break;case"updateAnchor":({col:r,row:a}=this.anchor.cell),n=En(n,{left:i,right:s,top:a,bottom:a})}return this.processEvent({options:{scrollIntoView:!1,unbounded:!0},anchor:{zone:n,cell:{col:r,row:a}},mode:t})}loopSelection(){const e=this.getters.getActiveSheetId(),t=this.anchor;if(wn(this.anchor.zone,this.getters.getSheetZone(e)))return this.modifyAnchor({...t,zone:Ln(t.cell)},"updateAnchor",{scrollIntoView:!1});const o=this.expandZoneToTable(t.zone);return Je(o,t.zone)?this.selectAll():this.modifyAnchor({...t,zone:o},"updateAnchor",{scrollIntoView:!1})}selectTableAroundSelection(){const e=this.expandZoneToTable(this.anchor.zone);return this.modifyAnchor({...this.anchor,zone:e},"updateAnchor",{scrollIntoView:!1})}selectAll(){const e=this.getters.getActiveSheetId(),t={left:0,top:0,bottom:this.getters.getNumberRows(e)-1,right:this.getters.getNumberCols(e)-1};return this.processEvent({mode:"overrideSelection",anchor:{zone:t,cell:this.anchor.cell},options:{scrollIntoView:!1}})}isListening(e){return this.stream.isListening(e)}processEvent(e){const t={...e,previousAnchor:Ae(this.anchor)},o=this.checkEventAnchorZone(t);return"Success"!==o?new Io(o):(this.anchor=t.anchor,this.stream.send(t),Io.Success)}checkEventAnchorZone(e){return this.checkAnchorZone(e.anchor)}checkAnchorZone(e){const{cell:t,zone:o}=e;if(!In(t.col,t.row,o))return"InvalidAnchorZone";const{left:s,right:n,top:i,bottom:r}=o,a=this.getters.getActiveSheetId(),l=this.getters.findVisibleHeader(a,"COL",s,n);return void 0===this.getters.findVisibleHeader(a,"ROW",i,r)||void 0===l?"SelectionOutOfBound":"Success"}checkAnchorZoneOrThrow(e){if("InvalidAnchorZone"===this.checkAnchorZone(e))throw new Error(a("The provided anchor is invalid. The cell must be part of the zone."))}getNextAvailablePosition(e,t=1){const{col:o,row:s}=this.anchor.cell,n=this.deltaToTarget({col:o,row:s},e,t);return{col:this.getNextAvailableCol(n[0],o,s),row:this.getNextAvailableRow(n[1],o,s)}}getNextAvailableCol(e,t,o){const s=this.getters.getActiveSheetId(),n={col:t,row:o};return this.getNextAvailableHeader(e,"COL",t,n,(e=>this.getters.isInSameMerge(s,t,o,e,o)))}getNextAvailableRow(e,t,o){const s=this.getters.getActiveSheetId(),n={col:t,row:o};return this.getNextAvailableHeader(e,"ROW",o,n,(e=>this.getters.isInSameMerge(s,t,o,t,e)))}getNextAvailableHeader(e,t,o,s,n){const i=this.getters.getActiveSheetId();if(0===e)return o;const r=Math.sign(e);let a=o+e;for(;n(a);)a+=r;for(;this.getters.isHeaderHidden(i,t,a);)a+=r;return a<0||a>this.getters.getNumberHeaders(i,t)-1?this.getters.isHeaderHidden(i,t,o)?this.getNextAvailableHeader(-r,t,o,s,n):o:a}getReferenceAnchor(){const e=this.getters.getActiveSheetId(),t=this.anchor,{left:o,right:s,top:n,bottom:i}=t.zone,{col:r,row:a}=t.cell,l=this.getters.isColHidden(e,r)&&this.getters.findVisibleHeader(e,"COL",o,s)||r,c=this.getters.isRowHidden(e,a)&&this.getters.findVisibleHeader(e,"ROW",n,i)||a;return{cell:{col:l,row:c},zone:this.getters.expandZone(e,{left:l,right:l,top:c,bottom:c})}}deltaToTarget(e,t,o){switch(t){case"up":return"end"!==o?[0,-o]:[0,this.getEndOfCluster(e,"rows",-1)-e.row];case"down":return"end"!==o?[0,o]:[0,this.getEndOfCluster(e,"rows",1)-e.row];case"left":return"end"!==o?[-o,0]:[this.getEndOfCluster(e,"cols",-1)-e.col,0];case"right":return"end"!==o?[o,0]:[this.getEndOfCluster(e,"cols",1)-e.col,0]}}getStartingPosition(e){let{col:t,row:o}=this.getPosition();const s=this.anchor.zone;switch(e){case"down":case"up":o=o===s.top?s.bottom:s.top;break;case"left":case"right":t=t===s.right?s.left:s.right}return{col:t,row:o}}getEndOfCluster(e,t,o){let s=e;const n=this.getNextCellPosition(e,t,o);let i=this.isEvaluatedCellEmpty(s)||this.isEvaluatedCellEmpty(n)?"nextCluster":"endOfCluster";for(;;){const e=this.getNextCellPosition(s,t,o);if(s.col===e.col&&s.row===e.row)break;const n=this.isEvaluatedCellEmpty(e);if("endOfCluster"===i&&n)break;if("nextCluster"===i&&!n){s=e;break}s=e}return"cols"===t?s.col:s.row}isCellEmpty({col:e,row:t}){const o=this.getters.getActiveSheetId(),s=this.getters.getMainCellPosition({sheetId:o,col:e,row:t});return!(this.getters.getCorrespondingFormulaCell(s)||this.getters.getCell(s)?.content)}isEvaluatedCellEmpty({col:e,row:t}){const o=this.getters.getActiveSheetId(),s=this.getters.getMainCellPosition({sheetId:o,col:e,row:t});return this.getters.getEvaluatedCell(s).type===bo.empty}getNextCellPosition(e,t,o){const s="cols"===t?"col":"row",n={...e},i="cols"===t?this.getNextAvailableCol(o,n.col,n.row):this.getNextAvailableRow(o,n.col,n.row);return n[s]=i,{col:n.col,row:n.row}}getPosition(){return{...this.anchor.cell}}expandZoneToTable(e){const t=e=>{for(const t of Ne(e.left,e.right+1)){if(!this.isCellEmpty({col:t,row:e.top-1}))return{...e,top:e.top-1};if(!this.isCellEmpty({col:t,row:e.bottom+1}))return{...e,bottom:e.bottom+1}}for(const t of Ne(e.top,e.bottom+1)){if(!this.isCellEmpty({col:e.left-1,row:t}))return{...e,left:e.left-1};if(!this.isCellEmpty({col:e.right+1,row:t}))return{...e,right:e.right+1}}return e};let o=!1,s=e;do{o=!1;const e=t(s);wn(s,e)||(o=!0,s=e)}while(o);return s}}class sT{changes;commands=[];recordChanges(e){return this.changes=[],this.commands=[],e(),{changes:this.changes,commands:this.commands}}addCommand(e){this.commands.push(e)}addChange(...e){const t=e.pop();let o=e[0],s=e.at(-1);const n=e.length-2;for(let t=1;t<=n;t++){const s=e[t];if(void 0===o[s]){const n=e[t+1];o[s]=qR(n)}o=o[s]}o[s]!==t&&(this.changes?.push({path:e,before:o[s],after:t}),void 0===t?delete o[s]:o[s]=t)}}const nT=17781237,iT=88853993;function rT(e,t,o){const s=[["xmlns:r",NE],["xmlns:a",TE],["xmlns:c",AE]],n=aT({backgroundColor:e.data.backgroundColor,line:{color:"000000"}});let i=Cw``;e.data.title&&(i=Cw`
2152
2152
  <c:title>
2153
2153
  ${cT(e.data.title,e.data.fontColor)}
2154
2154
  <c:overlay val="0" />
@@ -2657,4 +2657,4 @@
2657
2657
  <tableParts count="${e.filterTables.length}">
2658
2658
  ${Sw(a)}
2659
2659
  </tableParts>
2660
- `}var qT;!function(e){e[e.Ready=0]="Ready",e[e.Running=1]="Running",e[e.RunningCore=2]="RunningCore",e[e.Finalizing=3]="Finalizing"}(qT||(qT={}));function ZT(e,t={}){const o=Ae(t);return o.type=e,o}const YT={},jT={MIN_ROW_HEIGHT:10,MIN_COL_WIDTH:5,HEADER_HEIGHT:B,HEADER_WIDTH:H,TOPBAR_HEIGHT:63,BOTTOMBAR_HEIGHT:36,DEFAULT_CELL_WIDTH:z,DEFAULT_CELL_HEIGHT:G,SCROLLBAR_WIDTH:$},XT={autofillModifiersRegistry:hr,autofillRulesRegistry:dr,cellMenuRegistry:bb,colMenuRegistry:tS,linkMenuRegistry:Va,functionRegistry:Hf,featurePluginRegistry:mR,statefulUIPluginRegistry:fR,coreViewsPluginRegistry:bR,corePluginRegistry:pR,rowMenuRegistry:nS,sidePanelRegistry:mC,figureRegistry:Vl,chartSidePanelComponentRegistry:RS,chartComponentRegistry:Nl,chartRegistry:Ml,topbarMenuRegistry:iS,topbarComponentRegistry:fC,clickableCellRegistry:vR,otRegistry:rS,inverseCommandRegistry:Hl,urlRegistry:ji,cellPopoverRegistry:Ba,numberFormatMenuRegistry:oS,repeatLocalCommandTransformRegistry:eR,repeatCommandTransformRegistry:JI},KT={arg:_c,toBoolean:Zo,toJsDate:Yo,toNumber:Vo,toString:$o,toXC:Lt,toZone:gn,toUnboundedZone:un,toCartesian:Dt,numberToLetters:Ot,lettersToNumber:Mt,UuidGenerator:li,formatValue:Ts,createCurrencyFormat:Gs,computeTextWidth:Jn,createEmptyWorkbookData:Qw,createEmptySheet:Kw,createEmptyExcelSheet:Jw,getDefaultChartJsRuntime:nl,chartFontColor:Ti,ChartColors:Ri,EvaluationError:d,CellErrorLevel:h,getFillingMode:cl,rgbaToHex:wt,colorToRGBA:xt,positionToZone:Ln,isDefined:We,isMatrix:Mo,lazy:Xe,genericRepeat:tR,createAction:di,createActions:ci,transformRangeData:gi,deepEquals:Je,isNumber:go,isDateTime:jt},QT={isMarkdownLink:Ve,parseMarkdownLink:Be,markdownLink:Ue,openLink:er,urlRepresentation:Ji},JT={ChartPanel:TS,ChartFigure:Dl,ChartJsComponent:pi,Grid:EE,GridOverlay:iE,ScorecardChart:qi,LineConfigPanel:wS,LineBarPieDesignPanel:CS,BarConfigPanel:gS,LineBarPieConfigPanel:uS,GaugeChartConfigPanel:ES,GaugeChartDesignPanel:yS,ScorecardChartConfigPanel:xS,ScorecardChartDesignPanel:IS,FigureComponent:bC,Menu:Zr,SelectionInput:hS},eA={useDragAndDropListItems:NS};const tA={DEFAULT_LOCALE:Oo};e.AbstractChart=mi,e.CorePlugin=tx,e.DispatchResult=Io,e.EvaluationError=d,e.Model=class extends AI{corePlugins=[];featurePlugins=[];statefulUIPlugins=[];coreViewsPlugins=[];range;session;isReplayingCommand=!1;renderers=[];status=0;config;corePluginConfig;uiPluginConfig;state;selection;getters;coreGetters;uuidGenerator;handlers=[];uiHandlers=[];coreHandlers=[];constructor(e={},r={},a=[],l=new li,c=!0){super(),n===o&&i===s&&(i=()=>!0),a=Yw(e,a);const h=qw(e,c);this.state=new sT,this.uuidGenerator=l,this.config=this.setupConfig(r),this.session=this.setupSession(h.revisionId),this.coreGetters={},this.range=new jx(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.getters={isReadonly:()=>"readonly"===this.config.mode||"dashboard"===this.config.mode,isDashboard:()=>"dashboard"===this.config.mode},this.uuidGenerator.setIsFastStrategy(!0),this.selection=new oT(this.getters),this.coreHandlers.push(this.range),this.handlers.push(this.range),this.corePluginConfig=this.setupCorePluginConfig(),this.uiPluginConfig=this.setupUiPluginConfig();for(let e of pR.getAll())this.setupCorePlugin(e,h);Object.assign(this.getters,this.coreGetters),this.session.loadInitialMessages(a);for(let e of bR.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 fR.getAll()){const t=this.setupUiPlugin(e);this.statefulUIPlugins.push(t),this.handlers.push(t),this.uiHandlers.push(t)}for(let e of mR.getAll()){const t=this.setupUiPlugin(e);this.featurePlugins.push(t),this.handlers.push(t),this.uiHandlers.push(t)}this.uuidGenerator.setIsFastStrategy(!1),this.dispatch("START"),this.selection.observe(this,{handleEvent:()=>this.trigger("update")}),this.setupSessionEvents(),this.joinSession(),r.snapshotRequested&&(this.session.snapshot(this.exportData()),this.garbageCollectExternalResources()),t.markRaw(this)}joinSession(){this.session.join(this.config.client)}async leaveSession(){const e=this.getters.isReadonly()?void 0:Xe((()=>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)}const o=e.layers.map((e=>[t,e]));return this.renderers.push(...o),this.renderers.sort(((e,t)=>e[1]-t[1])),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 UI(JR({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:a("Anonymous").toString()},o=e.transportService||new $R;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})}}setupExternalConfig(e){const t=e.loadLocales||(()=>Promise.resolve(Ao));return{...e,loadLocales:t}}setupCorePluginConfig(){return{getters:this.coreGetters,stateObserver:this.state,range:this.range,dispatch:this.dispatchFromCorePlugin,uuidGenerator:this.uuidGenerator,custom:this.config.custom,external:this.config.external}}setupUiPluginConfig(){return{getters:this.getters,stateObserver:this.state,dispatch:this.dispatch,selection:this.selection,moveClient:this.session.move.bind(this.session),custom:this.config.custom,uiActions:this.config,session:this.session,defaultCurrencyFormat:this.config.defaultCurrencyFormat}}checkDispatchAllowed(e){const t=xo(e)?this.checkDispatchAllowedCoreCommand(e):this.checkDispatchAllowedLocalCommand(e);return t.some((e=>"Success"!==e))?new Io(t.flat()):Io.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}canDispatch=(e,t)=>this.checkDispatchAllowed(ZT(e,t));dispatch=(e,t)=>{const o=ZT(e,t);let s=this.status;if(this.getters.isReadonly()&&(n=o,!yo.has(n.type)))return new Io("Readonly");var n;if(!this.session.canApplyOptimisticUpdate())return new Io("WaitingSessionConfirmation");switch(s){case 0:const t=this.checkDispatchAllowed(o);if(!t.isSuccessful)return t;this.status=1;const{changes:s,commands:n}=this.state.recordChanges((()=>{xo(o)&&this.state.addCommand(o),this.dispatchToHandlers(this.handlers,o),this.finalize()}));this.session.save(o,n,s),this.status=0,this.trigger("update");break;case 1:if(xo(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(xo(o))throw new Error(`A UI plugin cannot dispatch ${e} while handling a core command`);this.dispatchToHandlers(this.handlers,o)}return Io.Success};dispatchFromCorePlugin=(e,t)=>{const o=ZT(e,t),s=this.status;this.status=2;const n=this.isReplayingCommand?this.coreHandlers:this.handlers;return this.dispatchToHandlers(n,o),this.status=s,Io.Success};dispatchToHandlers(e,t){const o=xo(t);for(const s of e)!o&&s instanceof tx||s.beforeHandle(t);for(const s of e)!o&&s instanceof tx||s.handle(t)}drawGrid(e){for(let[t,o]of this.renderers)e.ctx.save(),t.drawGrid(e,o),e.ctx.restore()}exportData(){let e=Qw();for(let t of this.handlers)t instanceof tx&&t.export(e);return e.revisionId=this.session.getRevisionId()||he,e=Ae(e),e}updateMode(e){"normal"!==e&&this.dispatch("CANCEL_EDITION"),this.config.mode=e,this.trigger("update")}exportXLSX(){this.dispatch("EVALUATE_CELLS");let e={...Qw(),sheets:[Jw(Ww,"Sheet1")]};for(let t of this.handlers)t instanceof ex&&t.exportForExcel(e);return e=Ae(e),$T(e)}garbageCollectExternalResources(){for(const e of this.corePlugins)e.garbageCollectExternalResources()}},e.Registry=Zi,e.Revision=VI,e.SPREADSHEET_DIMENSIONS=jT,e.Spreadsheet=GR,e.UIPlugin=Xx,e.__info__=YT,e.addFunction=function e(t,o){return Hf.add(t,o),{addFunction:(t,o)=>e(t,o)}},e.astToFormula=Ex,e.compile=Ax,e.compileTokens=Ox,e.components=JT,e.constants=tA,e.convertAstNodes=bx,e.coreTypes=wo,e.findCellInNewZone=Fn,e.functionCache=Tx,e.helpers=KT,e.hooks=eA,e.invalidateCFEvaluationCommands=Eo,e.invalidateDependenciesCommands=Co,e.invalidateEvaluationCommands=So,e.iterateAstNodes=vx,e.links=QT,e.load=qw,e.parse=mx,e.parseTokens=fx,e.readonlyAllowedCommands=yo,e.registries=XT,e.setDefaultSheetViewSize=function(e){ye=e},e.setTranslationMethod=function(e,t=(()=>!0)){n=e,i=t},e.tokenize=Qr,YT.version="17.0.67",YT.date="2025-06-23T15:02:54.391Z",YT.hash="cb0b6a9"}(this.o_spreadsheet=this.o_spreadsheet||{},owl);
2660
+ `}var qT;!function(e){e[e.Ready=0]="Ready",e[e.Running=1]="Running",e[e.RunningCore=2]="RunningCore",e[e.Finalizing=3]="Finalizing"}(qT||(qT={}));function ZT(e,t={}){const o=Ae(t);return o.type=e,o}const YT={},jT={MIN_ROW_HEIGHT:10,MIN_COL_WIDTH:5,HEADER_HEIGHT:B,HEADER_WIDTH:H,TOPBAR_HEIGHT:63,BOTTOMBAR_HEIGHT:36,DEFAULT_CELL_WIDTH:z,DEFAULT_CELL_HEIGHT:G,SCROLLBAR_WIDTH:$},XT={autofillModifiersRegistry:hr,autofillRulesRegistry:dr,cellMenuRegistry:bb,colMenuRegistry:tS,linkMenuRegistry:Va,functionRegistry:Hf,featurePluginRegistry:mR,statefulUIPluginRegistry:fR,coreViewsPluginRegistry:bR,corePluginRegistry:pR,rowMenuRegistry:nS,sidePanelRegistry:mC,figureRegistry:Vl,chartSidePanelComponentRegistry:RS,chartComponentRegistry:Nl,chartRegistry:Ml,topbarMenuRegistry:iS,topbarComponentRegistry:fC,clickableCellRegistry:vR,otRegistry:rS,inverseCommandRegistry:Hl,urlRegistry:ji,cellPopoverRegistry:Ba,numberFormatMenuRegistry:oS,repeatLocalCommandTransformRegistry:eR,repeatCommandTransformRegistry:JI},KT={arg:_c,toBoolean:Zo,toJsDate:Yo,toNumber:Vo,toString:$o,toXC:Lt,toZone:gn,toUnboundedZone:un,toCartesian:Dt,numberToLetters:Ot,lettersToNumber:Mt,UuidGenerator:li,formatValue:Ts,createCurrencyFormat:Gs,computeTextWidth:Jn,createEmptyWorkbookData:Qw,createEmptySheet:Kw,createEmptyExcelSheet:Jw,getDefaultChartJsRuntime:nl,chartFontColor:Ti,ChartColors:Ri,EvaluationError:d,CellErrorLevel:h,getFillingMode:cl,rgbaToHex:wt,colorToRGBA:xt,positionToZone:Ln,isDefined:We,isMatrix:Mo,lazy:Xe,genericRepeat:tR,createAction:di,createActions:ci,transformRangeData:gi,deepEquals:Je,isNumber:go,isDateTime:jt},QT={isMarkdownLink:Ve,parseMarkdownLink:Be,markdownLink:Ue,openLink:er,urlRepresentation:Ji},JT={ChartPanel:TS,ChartFigure:Dl,ChartJsComponent:pi,Grid:EE,GridOverlay:iE,ScorecardChart:qi,LineConfigPanel:wS,LineBarPieDesignPanel:CS,BarConfigPanel:gS,LineBarPieConfigPanel:uS,GaugeChartConfigPanel:ES,GaugeChartDesignPanel:yS,ScorecardChartConfigPanel:xS,ScorecardChartDesignPanel:IS,FigureComponent:bC,Menu:Zr,SelectionInput:hS},eA={useDragAndDropListItems:NS};const tA={DEFAULT_LOCALE:Oo};e.AbstractChart=mi,e.CorePlugin=tx,e.DispatchResult=Io,e.EvaluationError=d,e.Model=class extends AI{corePlugins=[];featurePlugins=[];statefulUIPlugins=[];coreViewsPlugins=[];range;session;isReplayingCommand=!1;renderers=[];status=0;config;corePluginConfig;uiPluginConfig;state;selection;getters;coreGetters;uuidGenerator;handlers=[];uiHandlers=[];coreHandlers=[];constructor(e={},r={},a=[],l=new li,c=!0){super(),n===o&&i===s&&(i=()=>!0),a=Yw(e,a);const h=qw(e,c);this.state=new sT,this.uuidGenerator=l,this.config=this.setupConfig(r),this.session=this.setupSession(h.revisionId),this.coreGetters={},this.range=new jx(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.getters={isReadonly:()=>"readonly"===this.config.mode||"dashboard"===this.config.mode,isDashboard:()=>"dashboard"===this.config.mode},this.uuidGenerator.setIsFastStrategy(!0),this.selection=new oT(this.getters),this.coreHandlers.push(this.range),this.handlers.push(this.range),this.corePluginConfig=this.setupCorePluginConfig(),this.uiPluginConfig=this.setupUiPluginConfig();for(let e of pR.getAll())this.setupCorePlugin(e,h);Object.assign(this.getters,this.coreGetters),this.session.loadInitialMessages(a);for(let e of bR.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 fR.getAll()){const t=this.setupUiPlugin(e);this.statefulUIPlugins.push(t),this.handlers.push(t),this.uiHandlers.push(t)}for(let e of mR.getAll()){const t=this.setupUiPlugin(e);this.featurePlugins.push(t),this.handlers.push(t),this.uiHandlers.push(t)}this.uuidGenerator.setIsFastStrategy(!1),this.dispatch("START"),this.selection.observe(this,{handleEvent:()=>this.trigger("update")}),this.setupSessionEvents(),this.joinSession(),r.snapshotRequested&&(this.session.snapshot(this.exportData()),this.garbageCollectExternalResources()),t.markRaw(this)}joinSession(){this.session.join(this.config.client)}async leaveSession(){const e=this.getters.isReadonly()?void 0:Xe((()=>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)}const o=e.layers.map((e=>[t,e]));return this.renderers.push(...o),this.renderers.sort(((e,t)=>e[1]-t[1])),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 UI(JR({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:a("Anonymous").toString()},o=e.transportService||new $R;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})}}setupExternalConfig(e){const t=e.loadLocales||(()=>Promise.resolve(Ao));return{...e,loadLocales:t}}setupCorePluginConfig(){return{getters:this.coreGetters,stateObserver:this.state,range:this.range,dispatch:this.dispatchFromCorePlugin,uuidGenerator:this.uuidGenerator,custom:this.config.custom,external:this.config.external}}setupUiPluginConfig(){return{getters:this.getters,stateObserver:this.state,dispatch:this.dispatch,selection:this.selection,moveClient:this.session.move.bind(this.session),custom:this.config.custom,uiActions:this.config,session:this.session,defaultCurrencyFormat:this.config.defaultCurrencyFormat}}checkDispatchAllowed(e){const t=xo(e)?this.checkDispatchAllowedCoreCommand(e):this.checkDispatchAllowedLocalCommand(e);return t.some((e=>"Success"!==e))?new Io(t.flat()):Io.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}canDispatch=(e,t)=>this.checkDispatchAllowed(ZT(e,t));dispatch=(e,t)=>{const o=ZT(e,t);let s=this.status;if(this.getters.isReadonly()&&(n=o,!yo.has(n.type)))return new Io("Readonly");var n;if(!this.session.canApplyOptimisticUpdate())return new Io("WaitingSessionConfirmation");switch(s){case 0:const t=this.checkDispatchAllowed(o);if(!t.isSuccessful)return t;this.status=1;const{changes:s,commands:n}=this.state.recordChanges((()=>{xo(o)&&this.state.addCommand(o),this.dispatchToHandlers(this.handlers,o),this.finalize()}));this.session.save(o,n,s),this.status=0,this.trigger("update");break;case 1:if(xo(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(xo(o))throw new Error(`A UI plugin cannot dispatch ${e} while handling a core command`);this.dispatchToHandlers(this.handlers,o)}return Io.Success};dispatchFromCorePlugin=(e,t)=>{const o=ZT(e,t),s=this.status;this.status=2;const n=this.isReplayingCommand?this.coreHandlers:this.handlers;return this.dispatchToHandlers(n,o),this.status=s,Io.Success};dispatchToHandlers(e,t){const o=xo(t);for(const s of e)!o&&s instanceof tx||s.beforeHandle(t);for(const s of e)!o&&s instanceof tx||s.handle(t)}drawGrid(e){for(let[t,o]of this.renderers)e.ctx.save(),t.drawGrid(e,o),e.ctx.restore()}exportData(){let e=Qw();for(let t of this.handlers)t instanceof tx&&t.export(e);return e.revisionId=this.session.getRevisionId()||he,e=Ae(e),e}updateMode(e){"normal"!==e&&this.dispatch("CANCEL_EDITION"),this.config.mode=e,this.trigger("update")}exportXLSX(){this.dispatch("EVALUATE_CELLS");let e={...Qw(),sheets:[Jw(Ww,"Sheet1")]};for(let t of this.handlers)t instanceof ex&&t.exportForExcel(e);return e=Ae(e),$T(e)}garbageCollectExternalResources(){for(const e of this.corePlugins)e.garbageCollectExternalResources()}},e.Registry=Zi,e.Revision=VI,e.SPREADSHEET_DIMENSIONS=jT,e.Spreadsheet=GR,e.UIPlugin=Xx,e.__info__=YT,e.addFunction=function e(t,o){return Hf.add(t,o),{addFunction:(t,o)=>e(t,o)}},e.astToFormula=Ex,e.compile=Ax,e.compileTokens=Ox,e.components=JT,e.constants=tA,e.convertAstNodes=bx,e.coreTypes=wo,e.findCellInNewZone=Fn,e.functionCache=Tx,e.helpers=KT,e.hooks=eA,e.invalidateCFEvaluationCommands=Eo,e.invalidateDependenciesCommands=Co,e.invalidateEvaluationCommands=So,e.iterateAstNodes=vx,e.links=QT,e.load=qw,e.parse=mx,e.parseTokens=fx,e.readonlyAllowedCommands=yo,e.registries=XT,e.setDefaultSheetViewSize=function(e){ye=e},e.setTranslationMethod=function(e,t=(()=>!0)){n=e,i=t},e.tokenize=Qr,YT.version="17.0.68",YT.date="2025-06-27T09:09:05.702Z",YT.hash="33404c6"}(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 17.0.67
5
- @date 2025-06-23T15:03:28.722Z
6
- @hash cb0b6a9
4
+ @version 17.0.68
5
+ @date 2025-06-27T09:09:39.577Z
6
+ @hash 33404c6
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": "17.0.67",
3
+ "version": "17.0.68",
4
4
  "description": "A spreadsheet component",
5
5
  "type": "module",
6
6
  "main": "dist/o-spreadsheet.cjs.js",