@odoo/o-spreadsheet 16.4.18 → 16.4.20

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.
@@ -451,7 +451,7 @@ function isBoolean(str) {
451
451
  const upperCased = str.toUpperCase();
452
452
  return upperCased === "TRUE" || upperCased === "FALSE";
453
453
  }
454
- const MARKDOWN_LINK_REGEX = /^\[([^\[]+)\]\((.+)\)$/;
454
+ const MARKDOWN_LINK_REGEX = /^\[(.+)\]\((.+)\)$/;
455
455
  //link must start with http or https
456
456
  //https://stackoverflow.com/a/3809435/4760614
457
457
  const WEB_LINK_REGEX = /^https?:\/\/(www\.)?[-a-zA-Z0-9@:%._\+~#=]{2,256}\.[a-z]{2,4}\b([-a-zA-Z0-9@:%_\+.~#?&//=]*)$/;
@@ -2219,27 +2219,30 @@ function roundFormat(format) {
2219
2219
  }
2220
2220
  function createLargeNumberFormat(format, magnitude, postFix, locale) {
2221
2221
  const internalFormat = parseFormat(format || "#,##0");
2222
- const largeNumberFormat = internalFormat
2223
- .map((formatPart) => {
2224
- if (formatPart.type === "NUMBER") {
2225
- return [
2226
- {
2227
- ...formatPart,
2228
- format: {
2229
- ...formatPart.format,
2230
- magnitude,
2231
- decimalPart: undefined,
2232
- },
2233
- },
2234
- {
2235
- type: "STRING",
2236
- format: postFix,
2237
- },
2238
- ];
2222
+ const largeNumberFormat = [];
2223
+ for (let i = 0; i < internalFormat.length; i++) {
2224
+ const formatPart = internalFormat[i];
2225
+ if (formatPart.type !== "NUMBER") {
2226
+ largeNumberFormat.push(formatPart);
2227
+ continue;
2239
2228
  }
2240
- return formatPart;
2241
- })
2242
- .flat();
2229
+ largeNumberFormat.push({
2230
+ ...formatPart,
2231
+ format: {
2232
+ ...formatPart.format,
2233
+ magnitude,
2234
+ decimalPart: undefined,
2235
+ },
2236
+ });
2237
+ largeNumberFormat.push({
2238
+ type: "STRING",
2239
+ format: postFix,
2240
+ });
2241
+ const nextFormatPart = internalFormat[i + 1];
2242
+ if (nextFormatPart?.type === "STRING" && ["k", "m", "b"].includes(nextFormatPart.format)) {
2243
+ i++;
2244
+ }
2245
+ }
2243
2246
  return convertInternalFormatToFormat(largeNumberFormat);
2244
2247
  }
2245
2248
  function changeDecimalPlaces(format, step, locale) {
@@ -4258,71 +4261,72 @@ exports.CommandResult = void 0;
4258
4261
  CommandResult[CommandResult["InputAlreadyFocused"] = 30] = "InputAlreadyFocused";
4259
4262
  CommandResult[CommandResult["MaximumRangesReached"] = 31] = "MaximumRangesReached";
4260
4263
  CommandResult[CommandResult["MinimumRangesReached"] = 32] = "MinimumRangesReached";
4261
- CommandResult[CommandResult["InvalidChartDefinition"] = 33] = "InvalidChartDefinition";
4262
- CommandResult[CommandResult["InvalidDataSet"] = 34] = "InvalidDataSet";
4263
- CommandResult[CommandResult["InvalidLabelRange"] = 35] = "InvalidLabelRange";
4264
- CommandResult[CommandResult["InvalidScorecardKeyValue"] = 36] = "InvalidScorecardKeyValue";
4265
- CommandResult[CommandResult["InvalidScorecardBaseline"] = 37] = "InvalidScorecardBaseline";
4266
- CommandResult[CommandResult["InvalidGaugeDataRange"] = 38] = "InvalidGaugeDataRange";
4267
- CommandResult[CommandResult["EmptyGaugeRangeMin"] = 39] = "EmptyGaugeRangeMin";
4268
- CommandResult[CommandResult["GaugeRangeMinNaN"] = 40] = "GaugeRangeMinNaN";
4269
- CommandResult[CommandResult["EmptyGaugeRangeMax"] = 41] = "EmptyGaugeRangeMax";
4270
- CommandResult[CommandResult["GaugeRangeMaxNaN"] = 42] = "GaugeRangeMaxNaN";
4271
- CommandResult[CommandResult["GaugeRangeMinBiggerThanRangeMax"] = 43] = "GaugeRangeMinBiggerThanRangeMax";
4272
- CommandResult[CommandResult["GaugeLowerInflectionPointNaN"] = 44] = "GaugeLowerInflectionPointNaN";
4273
- CommandResult[CommandResult["GaugeUpperInflectionPointNaN"] = 45] = "GaugeUpperInflectionPointNaN";
4274
- CommandResult[CommandResult["GaugeLowerBiggerThanUpper"] = 46] = "GaugeLowerBiggerThanUpper";
4275
- CommandResult[CommandResult["InvalidAutofillSelection"] = 47] = "InvalidAutofillSelection";
4276
- CommandResult[CommandResult["WrongComposerSelection"] = 48] = "WrongComposerSelection";
4277
- CommandResult[CommandResult["MinBiggerThanMax"] = 49] = "MinBiggerThanMax";
4278
- CommandResult[CommandResult["LowerBiggerThanUpper"] = 50] = "LowerBiggerThanUpper";
4279
- CommandResult[CommandResult["MidBiggerThanMax"] = 51] = "MidBiggerThanMax";
4280
- CommandResult[CommandResult["MinBiggerThanMid"] = 52] = "MinBiggerThanMid";
4281
- CommandResult[CommandResult["FirstArgMissing"] = 53] = "FirstArgMissing";
4282
- CommandResult[CommandResult["SecondArgMissing"] = 54] = "SecondArgMissing";
4283
- CommandResult[CommandResult["MinNaN"] = 55] = "MinNaN";
4284
- CommandResult[CommandResult["MidNaN"] = 56] = "MidNaN";
4285
- CommandResult[CommandResult["MaxNaN"] = 57] = "MaxNaN";
4286
- CommandResult[CommandResult["ValueUpperInflectionNaN"] = 58] = "ValueUpperInflectionNaN";
4287
- CommandResult[CommandResult["ValueLowerInflectionNaN"] = 59] = "ValueLowerInflectionNaN";
4288
- CommandResult[CommandResult["MinInvalidFormula"] = 60] = "MinInvalidFormula";
4289
- CommandResult[CommandResult["MidInvalidFormula"] = 61] = "MidInvalidFormula";
4290
- CommandResult[CommandResult["MaxInvalidFormula"] = 62] = "MaxInvalidFormula";
4291
- CommandResult[CommandResult["ValueUpperInvalidFormula"] = 63] = "ValueUpperInvalidFormula";
4292
- CommandResult[CommandResult["ValueLowerInvalidFormula"] = 64] = "ValueLowerInvalidFormula";
4293
- CommandResult[CommandResult["InvalidSortZone"] = 65] = "InvalidSortZone";
4294
- CommandResult[CommandResult["WaitingSessionConfirmation"] = 66] = "WaitingSessionConfirmation";
4295
- CommandResult[CommandResult["MergeOverlap"] = 67] = "MergeOverlap";
4296
- CommandResult[CommandResult["TooManyHiddenElements"] = 68] = "TooManyHiddenElements";
4297
- CommandResult[CommandResult["Readonly"] = 69] = "Readonly";
4298
- CommandResult[CommandResult["InvalidViewportSize"] = 70] = "InvalidViewportSize";
4299
- CommandResult[CommandResult["InvalidScrollingDirection"] = 71] = "InvalidScrollingDirection";
4300
- CommandResult[CommandResult["FigureDoesNotExist"] = 72] = "FigureDoesNotExist";
4301
- CommandResult[CommandResult["InvalidConditionalFormatId"] = 73] = "InvalidConditionalFormatId";
4302
- CommandResult[CommandResult["InvalidCellPopover"] = 74] = "InvalidCellPopover";
4303
- CommandResult[CommandResult["EmptyTarget"] = 75] = "EmptyTarget";
4304
- CommandResult[CommandResult["InvalidFreezeQuantity"] = 76] = "InvalidFreezeQuantity";
4305
- CommandResult[CommandResult["FrozenPaneOverlap"] = 77] = "FrozenPaneOverlap";
4306
- CommandResult[CommandResult["ValuesNotChanged"] = 78] = "ValuesNotChanged";
4307
- CommandResult[CommandResult["InvalidFilterZone"] = 79] = "InvalidFilterZone";
4308
- CommandResult[CommandResult["FilterOverlap"] = 80] = "FilterOverlap";
4309
- CommandResult[CommandResult["FilterNotFound"] = 81] = "FilterNotFound";
4310
- CommandResult[CommandResult["MergeInFilter"] = 82] = "MergeInFilter";
4311
- CommandResult[CommandResult["NonContinuousTargets"] = 83] = "NonContinuousTargets";
4312
- CommandResult[CommandResult["DuplicatedFigureId"] = 84] = "DuplicatedFigureId";
4313
- CommandResult[CommandResult["InvalidSelectionStep"] = 85] = "InvalidSelectionStep";
4314
- CommandResult[CommandResult["DuplicatedChartId"] = 86] = "DuplicatedChartId";
4315
- CommandResult[CommandResult["ChartDoesNotExist"] = 87] = "ChartDoesNotExist";
4316
- CommandResult[CommandResult["InvalidHeaderIndex"] = 88] = "InvalidHeaderIndex";
4317
- CommandResult[CommandResult["InvalidQuantity"] = 89] = "InvalidQuantity";
4318
- CommandResult[CommandResult["MoreThanOneColumnSelected"] = 90] = "MoreThanOneColumnSelected";
4319
- CommandResult[CommandResult["EmptySplitSeparator"] = 91] = "EmptySplitSeparator";
4320
- CommandResult[CommandResult["SplitWillOverwriteContent"] = 92] = "SplitWillOverwriteContent";
4321
- CommandResult[CommandResult["NoSplitSeparatorInSelection"] = 93] = "NoSplitSeparatorInSelection";
4322
- CommandResult[CommandResult["NoActiveSheet"] = 94] = "NoActiveSheet";
4323
- CommandResult[CommandResult["InvalidLocale"] = 95] = "InvalidLocale";
4324
- CommandResult[CommandResult["AlreadyInPaintingFormatMode"] = 96] = "AlreadyInPaintingFormatMode";
4325
- CommandResult[CommandResult["NoChanges"] = 97] = "NoChanges";
4264
+ CommandResult[CommandResult["InvalidInputId"] = 33] = "InvalidInputId";
4265
+ CommandResult[CommandResult["InvalidChartDefinition"] = 34] = "InvalidChartDefinition";
4266
+ CommandResult[CommandResult["InvalidDataSet"] = 35] = "InvalidDataSet";
4267
+ CommandResult[CommandResult["InvalidLabelRange"] = 36] = "InvalidLabelRange";
4268
+ CommandResult[CommandResult["InvalidScorecardKeyValue"] = 37] = "InvalidScorecardKeyValue";
4269
+ CommandResult[CommandResult["InvalidScorecardBaseline"] = 38] = "InvalidScorecardBaseline";
4270
+ CommandResult[CommandResult["InvalidGaugeDataRange"] = 39] = "InvalidGaugeDataRange";
4271
+ CommandResult[CommandResult["EmptyGaugeRangeMin"] = 40] = "EmptyGaugeRangeMin";
4272
+ CommandResult[CommandResult["GaugeRangeMinNaN"] = 41] = "GaugeRangeMinNaN";
4273
+ CommandResult[CommandResult["EmptyGaugeRangeMax"] = 42] = "EmptyGaugeRangeMax";
4274
+ CommandResult[CommandResult["GaugeRangeMaxNaN"] = 43] = "GaugeRangeMaxNaN";
4275
+ CommandResult[CommandResult["GaugeRangeMinBiggerThanRangeMax"] = 44] = "GaugeRangeMinBiggerThanRangeMax";
4276
+ CommandResult[CommandResult["GaugeLowerInflectionPointNaN"] = 45] = "GaugeLowerInflectionPointNaN";
4277
+ CommandResult[CommandResult["GaugeUpperInflectionPointNaN"] = 46] = "GaugeUpperInflectionPointNaN";
4278
+ CommandResult[CommandResult["GaugeLowerBiggerThanUpper"] = 47] = "GaugeLowerBiggerThanUpper";
4279
+ CommandResult[CommandResult["InvalidAutofillSelection"] = 48] = "InvalidAutofillSelection";
4280
+ CommandResult[CommandResult["WrongComposerSelection"] = 49] = "WrongComposerSelection";
4281
+ CommandResult[CommandResult["MinBiggerThanMax"] = 50] = "MinBiggerThanMax";
4282
+ CommandResult[CommandResult["LowerBiggerThanUpper"] = 51] = "LowerBiggerThanUpper";
4283
+ CommandResult[CommandResult["MidBiggerThanMax"] = 52] = "MidBiggerThanMax";
4284
+ CommandResult[CommandResult["MinBiggerThanMid"] = 53] = "MinBiggerThanMid";
4285
+ CommandResult[CommandResult["FirstArgMissing"] = 54] = "FirstArgMissing";
4286
+ CommandResult[CommandResult["SecondArgMissing"] = 55] = "SecondArgMissing";
4287
+ CommandResult[CommandResult["MinNaN"] = 56] = "MinNaN";
4288
+ CommandResult[CommandResult["MidNaN"] = 57] = "MidNaN";
4289
+ CommandResult[CommandResult["MaxNaN"] = 58] = "MaxNaN";
4290
+ CommandResult[CommandResult["ValueUpperInflectionNaN"] = 59] = "ValueUpperInflectionNaN";
4291
+ CommandResult[CommandResult["ValueLowerInflectionNaN"] = 60] = "ValueLowerInflectionNaN";
4292
+ CommandResult[CommandResult["MinInvalidFormula"] = 61] = "MinInvalidFormula";
4293
+ CommandResult[CommandResult["MidInvalidFormula"] = 62] = "MidInvalidFormula";
4294
+ CommandResult[CommandResult["MaxInvalidFormula"] = 63] = "MaxInvalidFormula";
4295
+ CommandResult[CommandResult["ValueUpperInvalidFormula"] = 64] = "ValueUpperInvalidFormula";
4296
+ CommandResult[CommandResult["ValueLowerInvalidFormula"] = 65] = "ValueLowerInvalidFormula";
4297
+ CommandResult[CommandResult["InvalidSortZone"] = 66] = "InvalidSortZone";
4298
+ CommandResult[CommandResult["WaitingSessionConfirmation"] = 67] = "WaitingSessionConfirmation";
4299
+ CommandResult[CommandResult["MergeOverlap"] = 68] = "MergeOverlap";
4300
+ CommandResult[CommandResult["TooManyHiddenElements"] = 69] = "TooManyHiddenElements";
4301
+ CommandResult[CommandResult["Readonly"] = 70] = "Readonly";
4302
+ CommandResult[CommandResult["InvalidViewportSize"] = 71] = "InvalidViewportSize";
4303
+ CommandResult[CommandResult["InvalidScrollingDirection"] = 72] = "InvalidScrollingDirection";
4304
+ CommandResult[CommandResult["FigureDoesNotExist"] = 73] = "FigureDoesNotExist";
4305
+ CommandResult[CommandResult["InvalidConditionalFormatId"] = 74] = "InvalidConditionalFormatId";
4306
+ CommandResult[CommandResult["InvalidCellPopover"] = 75] = "InvalidCellPopover";
4307
+ CommandResult[CommandResult["EmptyTarget"] = 76] = "EmptyTarget";
4308
+ CommandResult[CommandResult["InvalidFreezeQuantity"] = 77] = "InvalidFreezeQuantity";
4309
+ CommandResult[CommandResult["FrozenPaneOverlap"] = 78] = "FrozenPaneOverlap";
4310
+ CommandResult[CommandResult["ValuesNotChanged"] = 79] = "ValuesNotChanged";
4311
+ CommandResult[CommandResult["InvalidFilterZone"] = 80] = "InvalidFilterZone";
4312
+ CommandResult[CommandResult["FilterOverlap"] = 81] = "FilterOverlap";
4313
+ CommandResult[CommandResult["FilterNotFound"] = 82] = "FilterNotFound";
4314
+ CommandResult[CommandResult["MergeInFilter"] = 83] = "MergeInFilter";
4315
+ CommandResult[CommandResult["NonContinuousTargets"] = 84] = "NonContinuousTargets";
4316
+ CommandResult[CommandResult["DuplicatedFigureId"] = 85] = "DuplicatedFigureId";
4317
+ CommandResult[CommandResult["InvalidSelectionStep"] = 86] = "InvalidSelectionStep";
4318
+ CommandResult[CommandResult["DuplicatedChartId"] = 87] = "DuplicatedChartId";
4319
+ CommandResult[CommandResult["ChartDoesNotExist"] = 88] = "ChartDoesNotExist";
4320
+ CommandResult[CommandResult["InvalidHeaderIndex"] = 89] = "InvalidHeaderIndex";
4321
+ CommandResult[CommandResult["InvalidQuantity"] = 90] = "InvalidQuantity";
4322
+ CommandResult[CommandResult["MoreThanOneColumnSelected"] = 91] = "MoreThanOneColumnSelected";
4323
+ CommandResult[CommandResult["EmptySplitSeparator"] = 92] = "EmptySplitSeparator";
4324
+ CommandResult[CommandResult["SplitWillOverwriteContent"] = 93] = "SplitWillOverwriteContent";
4325
+ CommandResult[CommandResult["NoSplitSeparatorInSelection"] = 94] = "NoSplitSeparatorInSelection";
4326
+ CommandResult[CommandResult["NoActiveSheet"] = 95] = "NoActiveSheet";
4327
+ CommandResult[CommandResult["InvalidLocale"] = 96] = "InvalidLocale";
4328
+ CommandResult[CommandResult["AlreadyInPaintingFormatMode"] = 97] = "AlreadyInPaintingFormatMode";
4329
+ CommandResult[CommandResult["NoChanges"] = 98] = "NoChanges";
4326
4330
  })(exports.CommandResult || (exports.CommandResult = {}));
4327
4331
 
4328
4332
  const borderStyles = ["thin", "medium", "thick", "dashed", "dotted"];
@@ -16107,11 +16111,11 @@ function checkDataset(definition) {
16107
16111
  if (definition.dataSets) {
16108
16112
  const invalidRanges = definition.dataSets.find((range) => !rangeReference.test(range)) !== undefined;
16109
16113
  if (invalidRanges) {
16110
- return 34 /* CommandResult.InvalidDataSet */;
16114
+ return 35 /* CommandResult.InvalidDataSet */;
16111
16115
  }
16112
16116
  const zones = definition.dataSets.map(toUnboundedZone);
16113
16117
  if (zones.some((zone) => zone.top !== zone.bottom && isFullRow(zone))) {
16114
- return 34 /* CommandResult.InvalidDataSet */;
16118
+ return 35 /* CommandResult.InvalidDataSet */;
16115
16119
  }
16116
16120
  }
16117
16121
  return 0 /* CommandResult.Success */;
@@ -16120,7 +16124,7 @@ function checkLabelRange(definition) {
16120
16124
  if (definition.labelRange) {
16121
16125
  const invalidLabels = !rangeReference.test(definition.labelRange || "");
16122
16126
  if (invalidLabels) {
16123
- return 35 /* CommandResult.InvalidLabelRange */;
16127
+ return 36 /* CommandResult.InvalidLabelRange */;
16124
16128
  }
16125
16129
  }
16126
16130
  return 0 /* CommandResult.Success */;
@@ -16207,22 +16211,22 @@ function getChartPositionAtCenterOfViewport(getters, chartSize) {
16207
16211
  const CfTerms = {
16208
16212
  Errors: {
16209
16213
  [26 /* CommandResult.InvalidRange */]: _lt("The range is invalid"),
16210
- [53 /* CommandResult.FirstArgMissing */]: _lt("The argument is missing. Please provide a value"),
16211
- [54 /* CommandResult.SecondArgMissing */]: _lt("The second argument is missing. Please provide a value"),
16212
- [55 /* CommandResult.MinNaN */]: _lt("The minpoint must be a number"),
16213
- [56 /* CommandResult.MidNaN */]: _lt("The midpoint must be a number"),
16214
- [57 /* CommandResult.MaxNaN */]: _lt("The maxpoint must be a number"),
16215
- [58 /* CommandResult.ValueUpperInflectionNaN */]: _lt("The first value must be a number"),
16216
- [59 /* CommandResult.ValueLowerInflectionNaN */]: _lt("The second value must be a number"),
16217
- [49 /* CommandResult.MinBiggerThanMax */]: _lt("Minimum must be smaller then Maximum"),
16218
- [52 /* CommandResult.MinBiggerThanMid */]: _lt("Minimum must be smaller then Midpoint"),
16219
- [51 /* CommandResult.MidBiggerThanMax */]: _lt("Midpoint must be smaller then Maximum"),
16220
- [50 /* CommandResult.LowerBiggerThanUpper */]: _lt("Lower inflection point must be smaller than upper inflection point"),
16221
- [60 /* CommandResult.MinInvalidFormula */]: _lt("Invalid Minpoint formula"),
16222
- [62 /* CommandResult.MaxInvalidFormula */]: _lt("Invalid Maxpoint formula"),
16223
- [61 /* CommandResult.MidInvalidFormula */]: _lt("Invalid Midpoint formula"),
16224
- [63 /* CommandResult.ValueUpperInvalidFormula */]: _lt("Invalid upper inflection point formula"),
16225
- [64 /* CommandResult.ValueLowerInvalidFormula */]: _lt("Invalid lower inflection point formula"),
16214
+ [54 /* CommandResult.FirstArgMissing */]: _lt("The argument is missing. Please provide a value"),
16215
+ [55 /* CommandResult.SecondArgMissing */]: _lt("The second argument is missing. Please provide a value"),
16216
+ [56 /* CommandResult.MinNaN */]: _lt("The minpoint must be a number"),
16217
+ [57 /* CommandResult.MidNaN */]: _lt("The midpoint must be a number"),
16218
+ [58 /* CommandResult.MaxNaN */]: _lt("The maxpoint must be a number"),
16219
+ [59 /* CommandResult.ValueUpperInflectionNaN */]: _lt("The first value must be a number"),
16220
+ [60 /* CommandResult.ValueLowerInflectionNaN */]: _lt("The second value must be a number"),
16221
+ [50 /* CommandResult.MinBiggerThanMax */]: _lt("Minimum must be smaller then Maximum"),
16222
+ [53 /* CommandResult.MinBiggerThanMid */]: _lt("Minimum must be smaller then Midpoint"),
16223
+ [52 /* CommandResult.MidBiggerThanMax */]: _lt("Midpoint must be smaller then Maximum"),
16224
+ [51 /* CommandResult.LowerBiggerThanUpper */]: _lt("Lower inflection point must be smaller than upper inflection point"),
16225
+ [61 /* CommandResult.MinInvalidFormula */]: _lt("Invalid Minpoint formula"),
16226
+ [63 /* CommandResult.MaxInvalidFormula */]: _lt("Invalid Maxpoint formula"),
16227
+ [62 /* CommandResult.MidInvalidFormula */]: _lt("Invalid Midpoint formula"),
16228
+ [64 /* CommandResult.ValueUpperInvalidFormula */]: _lt("Invalid upper inflection point formula"),
16229
+ [65 /* CommandResult.ValueLowerInvalidFormula */]: _lt("Invalid lower inflection point formula"),
16226
16230
  [25 /* CommandResult.EmptyRange */]: _lt("A range needs to be defined"),
16227
16231
  Unexpected: _lt("The rule is invalid for an unknown reason"),
16228
16232
  },
@@ -16250,20 +16254,20 @@ const ChartTerms = {
16250
16254
  Errors: {
16251
16255
  Unexpected: _lt("The chart definition is invalid for an unknown reason"),
16252
16256
  // BASIC CHART ERRORS (LINE | BAR | PIE)
16253
- [34 /* CommandResult.InvalidDataSet */]: _lt("The dataset is invalid"),
16254
- [35 /* CommandResult.InvalidLabelRange */]: _lt("Labels are invalid"),
16257
+ [35 /* CommandResult.InvalidDataSet */]: _lt("The dataset is invalid"),
16258
+ [36 /* CommandResult.InvalidLabelRange */]: _lt("Labels are invalid"),
16255
16259
  // SCORECARD CHART ERRORS
16256
- [36 /* CommandResult.InvalidScorecardKeyValue */]: _lt("The key value is invalid"),
16257
- [37 /* CommandResult.InvalidScorecardBaseline */]: _lt("The baseline value is invalid"),
16260
+ [37 /* CommandResult.InvalidScorecardKeyValue */]: _lt("The key value is invalid"),
16261
+ [38 /* CommandResult.InvalidScorecardBaseline */]: _lt("The baseline value is invalid"),
16258
16262
  // GAUGE CHART ERRORS
16259
- [38 /* CommandResult.InvalidGaugeDataRange */]: _lt("The data range is invalid"),
16260
- [39 /* CommandResult.EmptyGaugeRangeMin */]: _lt("A minimum range limit value is needed"),
16261
- [40 /* CommandResult.GaugeRangeMinNaN */]: _lt("The minimum range limit value must be a number"),
16262
- [41 /* CommandResult.EmptyGaugeRangeMax */]: _lt("A maximum range limit value is needed"),
16263
- [42 /* CommandResult.GaugeRangeMaxNaN */]: _lt("The maximum range limit value must be a number"),
16264
- [43 /* CommandResult.GaugeRangeMinBiggerThanRangeMax */]: _lt("Minimum range limit must be smaller than maximum range limit"),
16265
- [44 /* CommandResult.GaugeLowerInflectionPointNaN */]: _lt("The lower inflection point value must be a number"),
16266
- [45 /* CommandResult.GaugeUpperInflectionPointNaN */]: _lt("The upper inflection point value must be a number"),
16263
+ [39 /* CommandResult.InvalidGaugeDataRange */]: _lt("The data range is invalid"),
16264
+ [40 /* CommandResult.EmptyGaugeRangeMin */]: _lt("A minimum range limit value is needed"),
16265
+ [41 /* CommandResult.GaugeRangeMinNaN */]: _lt("The minimum range limit value must be a number"),
16266
+ [42 /* CommandResult.EmptyGaugeRangeMax */]: _lt("A maximum range limit value is needed"),
16267
+ [43 /* CommandResult.GaugeRangeMaxNaN */]: _lt("The maximum range limit value must be a number"),
16268
+ [44 /* CommandResult.GaugeRangeMinBiggerThanRangeMax */]: _lt("Minimum range limit must be smaller than maximum range limit"),
16269
+ [45 /* CommandResult.GaugeLowerInflectionPointNaN */]: _lt("The lower inflection point value must be a number"),
16270
+ [46 /* CommandResult.GaugeUpperInflectionPointNaN */]: _lt("The upper inflection point value must be a number"),
16267
16271
  },
16268
16272
  };
16269
16273
  const CustomCurrencyTerms = {
@@ -16273,9 +16277,9 @@ const MergeErrorMessage = _lt("Merged cells are preventing this operation. Unmer
16273
16277
  const SplitToColumnsTerms = {
16274
16278
  Errors: {
16275
16279
  Unexpected: _lt("Cannot split the selection for an unknown reason"),
16276
- [93 /* CommandResult.NoSplitSeparatorInSelection */]: _lt("There is no match for the selected separator in the selection"),
16277
- [90 /* CommandResult.MoreThanOneColumnSelected */]: _lt("Only a selection from a single column can be split"),
16278
- [92 /* CommandResult.SplitWillOverwriteContent */]: _lt("Splitting will overwrite existing content"),
16280
+ [94 /* CommandResult.NoSplitSeparatorInSelection */]: _lt("There is no match for the selected separator in the selection"),
16281
+ [91 /* CommandResult.MoreThanOneColumnSelected */]: _lt("Only a selection from a single column can be split"),
16282
+ [93 /* CommandResult.SplitWillOverwriteContent */]: _lt("Splitting will overwrite existing content"),
16279
16283
  },
16280
16284
  };
16281
16285
 
@@ -16680,7 +16684,7 @@ function createBarChartRuntime(chart, getters) {
16680
16684
 
16681
16685
  function isDataRangeValid(definition) {
16682
16686
  return definition.dataRange && !rangeReference.test(definition.dataRange)
16683
- ? 38 /* CommandResult.InvalidGaugeDataRange */
16687
+ ? 39 /* CommandResult.InvalidGaugeDataRange */
16684
16688
  : 0 /* CommandResult.Success */;
16685
16689
  }
16686
16690
  function checkRangeLimits(check, batchValidations) {
@@ -16712,7 +16716,7 @@ function checkInflectionPointsValue(check, batchValidations) {
16712
16716
  function checkRangeMinBiggerThanRangeMax(definition) {
16713
16717
  if (definition.sectionRule) {
16714
16718
  if (Number(definition.sectionRule.rangeMin) >= Number(definition.sectionRule.rangeMax)) {
16715
- return 43 /* CommandResult.GaugeRangeMinBiggerThanRangeMax */;
16719
+ return 44 /* CommandResult.GaugeRangeMinBiggerThanRangeMax */;
16716
16720
  }
16717
16721
  }
16718
16722
  return 0 /* CommandResult.Success */;
@@ -16721,9 +16725,9 @@ function checkEmpty(value, valueName) {
16721
16725
  if (value === "") {
16722
16726
  switch (valueName) {
16723
16727
  case "rangeMin":
16724
- return 39 /* CommandResult.EmptyGaugeRangeMin */;
16728
+ return 40 /* CommandResult.EmptyGaugeRangeMin */;
16725
16729
  case "rangeMax":
16726
- return 41 /* CommandResult.EmptyGaugeRangeMax */;
16730
+ return 42 /* CommandResult.EmptyGaugeRangeMax */;
16727
16731
  }
16728
16732
  }
16729
16733
  return 0 /* CommandResult.Success */;
@@ -16732,13 +16736,13 @@ function checkNaN(value, valueName) {
16732
16736
  if (isNaN(value)) {
16733
16737
  switch (valueName) {
16734
16738
  case "rangeMin":
16735
- return 40 /* CommandResult.GaugeRangeMinNaN */;
16739
+ return 41 /* CommandResult.GaugeRangeMinNaN */;
16736
16740
  case "rangeMax":
16737
- return 42 /* CommandResult.GaugeRangeMaxNaN */;
16741
+ return 43 /* CommandResult.GaugeRangeMaxNaN */;
16738
16742
  case "lowerInflectionPointValue":
16739
- return 44 /* CommandResult.GaugeLowerInflectionPointNaN */;
16743
+ return 45 /* CommandResult.GaugeLowerInflectionPointNaN */;
16740
16744
  case "upperInflectionPointValue":
16741
- return 45 /* CommandResult.GaugeUpperInflectionPointNaN */;
16745
+ return 46 /* CommandResult.GaugeUpperInflectionPointNaN */;
16742
16746
  }
16743
16747
  }
16744
16748
  return 0 /* CommandResult.Success */;
@@ -17534,12 +17538,12 @@ function createPieChartRuntime(chart, getters) {
17534
17538
 
17535
17539
  function checkKeyValue(definition) {
17536
17540
  return definition.keyValue && !rangeReference.test(definition.keyValue)
17537
- ? 36 /* CommandResult.InvalidScorecardKeyValue */
17541
+ ? 37 /* CommandResult.InvalidScorecardKeyValue */
17538
17542
  : 0 /* CommandResult.Success */;
17539
17543
  }
17540
17544
  function checkBaseline(definition) {
17541
17545
  return definition.baseline && !rangeReference.test(definition.baseline)
17542
- ? 37 /* CommandResult.InvalidScorecardBaseline */
17546
+ ? 38 /* CommandResult.InvalidScorecardBaseline */
17543
17547
  : 0 /* CommandResult.Success */;
17544
17548
  }
17545
17549
  class ScorecardChart extends AbstractChart {
@@ -18066,7 +18070,7 @@ const AddMergeInteractiveContent = {
18066
18070
  };
18067
18071
  function interactiveAddMerge(env, sheetId, target) {
18068
18072
  const result = env.model.dispatch("ADD_MERGE", { sheetId, target });
18069
- if (result.isCancelledBecause(82 /* CommandResult.MergeInFilter */)) {
18073
+ if (result.isCancelledBecause(83 /* CommandResult.MergeInFilter */)) {
18070
18074
  env.raiseError(AddMergeInteractiveContent.MergeInFilter);
18071
18075
  }
18072
18076
  else if (result.isCancelledBecause(3 /* CommandResult.MergeIsDestructive */)) {
@@ -18093,7 +18097,7 @@ function handlePasteResult(env, result) {
18093
18097
  else if (result.reasons.includes(23 /* CommandResult.WrongFigurePasteOption */)) {
18094
18098
  env.raiseError(PasteInteractiveContent.wrongFigurePasteOption);
18095
18099
  }
18096
- else if (result.reasons.includes(77 /* CommandResult.FrozenPaneOverlap */)) {
18100
+ else if (result.reasons.includes(78 /* CommandResult.FrozenPaneOverlap */)) {
18097
18101
  env.raiseError(PasteInteractiveContent.frozenPaneOverlap);
18098
18102
  }
18099
18103
  }
@@ -19268,7 +19272,7 @@ function interactiveSortSelection(env, sheetId, anchor, zone, sortDirection) {
19268
19272
  });
19269
19273
  }
19270
19274
  }
19271
- if (result.isCancelledBecause(65 /* CommandResult.InvalidSortZone */)) {
19275
+ if (result.isCancelledBecause(66 /* CommandResult.InvalidSortZone */)) {
19272
19276
  const { col, row } = anchor;
19273
19277
  env.model.selection.selectZone({ cell: { col, row }, zone });
19274
19278
  env.raiseError(_lt("Cannot sort. To sort, select only cells or only merges that have the same size."));
@@ -19282,13 +19286,13 @@ const AddFilterInteractiveContent = {
19282
19286
  };
19283
19287
  function interactiveAddFilter(env, sheetId, target) {
19284
19288
  const result = env.model.dispatch("CREATE_FILTER_TABLE", { target, sheetId });
19285
- if (result.isCancelledBecause(80 /* CommandResult.FilterOverlap */)) {
19289
+ if (result.isCancelledBecause(81 /* CommandResult.FilterOverlap */)) {
19286
19290
  env.raiseError(AddFilterInteractiveContent.filterOverlap);
19287
19291
  }
19288
- else if (result.isCancelledBecause(82 /* CommandResult.MergeInFilter */)) {
19292
+ else if (result.isCancelledBecause(83 /* CommandResult.MergeInFilter */)) {
19289
19293
  env.raiseError(AddFilterInteractiveContent.mergeInFilter);
19290
19294
  }
19291
- else if (result.isCancelledBecause(83 /* CommandResult.NonContinuousTargets */)) {
19295
+ else if (result.isCancelledBecause(84 /* CommandResult.NonContinuousTargets */)) {
19292
19296
  env.raiseError(AddFilterInteractiveContent.nonContinuousTargets);
19293
19297
  }
19294
19298
  }
@@ -19725,7 +19729,7 @@ function interactiveFreezeColumnsRows(env, dimension, base) {
19725
19729
  const sheetId = env.model.getters.getActiveSheetId();
19726
19730
  const cmd = dimension === "COL" ? "FREEZE_COLUMNS" : "FREEZE_ROWS";
19727
19731
  const result = env.model.dispatch(cmd, { sheetId, quantity: base });
19728
- if (result.isCancelledBecause(67 /* CommandResult.MergeOverlap */)) {
19732
+ if (result.isCancelledBecause(68 /* CommandResult.MergeOverlap */)) {
19729
19733
  env.raiseError(MergeErrorMessage);
19730
19734
  }
19731
19735
  }
@@ -20865,10 +20869,10 @@ class LineBarPieConfigPanel extends owl.Component {
20865
20869
  return cancelledReasons.map((error) => ChartTerms.Errors[error] || ChartTerms.Errors.Unexpected);
20866
20870
  }
20867
20871
  get isDatasetInvalid() {
20868
- return !!this.state.datasetDispatchResult?.isCancelledBecause(34 /* CommandResult.InvalidDataSet */);
20872
+ return !!this.state.datasetDispatchResult?.isCancelledBecause(35 /* CommandResult.InvalidDataSet */);
20869
20873
  }
20870
20874
  get isLabelInvalid() {
20871
- return !!this.state.labelsDispatchResult?.isCancelledBecause(35 /* CommandResult.InvalidLabelRange */);
20875
+ return !!this.state.labelsDispatchResult?.isCancelledBecause(36 /* CommandResult.InvalidLabelRange */);
20872
20876
  }
20873
20877
  onUpdateDataSetsHaveTitle(ev) {
20874
20878
  this.props.updateChart(this.props.figureId, {
@@ -21542,7 +21546,7 @@ class GaugeChartConfigPanel extends owl.Component {
21542
21546
  return cancelledReasons.map((error) => ChartTerms.Errors[error] || ChartTerms.Errors.Unexpected);
21543
21547
  }
21544
21548
  get isDataRangeInvalid() {
21545
- return !!this.state.dataRangeDispatchResult?.isCancelledBecause(38 /* CommandResult.InvalidGaugeDataRange */);
21549
+ return !!this.state.dataRangeDispatchResult?.isCancelledBecause(39 /* CommandResult.InvalidGaugeDataRange */);
21546
21550
  }
21547
21551
  onDataRangeChanged(ranges) {
21548
21552
  this.dataRange = ranges[0];
@@ -21626,25 +21630,25 @@ class GaugeChartDesignPanel extends owl.Component {
21626
21630
  });
21627
21631
  }
21628
21632
  isRangeMinInvalid() {
21629
- return !!(this.state.sectionRuleDispatchResult?.isCancelledBecause(39 /* CommandResult.EmptyGaugeRangeMin */) ||
21630
- this.state.sectionRuleDispatchResult?.isCancelledBecause(40 /* CommandResult.GaugeRangeMinNaN */) ||
21631
- this.state.sectionRuleDispatchResult?.isCancelledBecause(43 /* CommandResult.GaugeRangeMinBiggerThanRangeMax */));
21633
+ return !!(this.state.sectionRuleDispatchResult?.isCancelledBecause(40 /* CommandResult.EmptyGaugeRangeMin */) ||
21634
+ this.state.sectionRuleDispatchResult?.isCancelledBecause(41 /* CommandResult.GaugeRangeMinNaN */) ||
21635
+ this.state.sectionRuleDispatchResult?.isCancelledBecause(44 /* CommandResult.GaugeRangeMinBiggerThanRangeMax */));
21632
21636
  }
21633
21637
  isRangeMaxInvalid() {
21634
- return !!(this.state.sectionRuleDispatchResult?.isCancelledBecause(41 /* CommandResult.EmptyGaugeRangeMax */) ||
21635
- this.state.sectionRuleDispatchResult?.isCancelledBecause(42 /* CommandResult.GaugeRangeMaxNaN */) ||
21636
- this.state.sectionRuleDispatchResult?.isCancelledBecause(43 /* CommandResult.GaugeRangeMinBiggerThanRangeMax */));
21638
+ return !!(this.state.sectionRuleDispatchResult?.isCancelledBecause(42 /* CommandResult.EmptyGaugeRangeMax */) ||
21639
+ this.state.sectionRuleDispatchResult?.isCancelledBecause(43 /* CommandResult.GaugeRangeMaxNaN */) ||
21640
+ this.state.sectionRuleDispatchResult?.isCancelledBecause(44 /* CommandResult.GaugeRangeMinBiggerThanRangeMax */));
21637
21641
  }
21638
21642
  // ---------------------------------------------------------------------------
21639
21643
  // COLOR_SECTION_TEMPLATE
21640
21644
  // ---------------------------------------------------------------------------
21641
21645
  get isLowerInflectionPointInvalid() {
21642
- return !!(this.state.sectionRuleDispatchResult?.isCancelledBecause(44 /* CommandResult.GaugeLowerInflectionPointNaN */) ||
21643
- this.state.sectionRuleDispatchResult?.isCancelledBecause(46 /* CommandResult.GaugeLowerBiggerThanUpper */));
21646
+ return !!(this.state.sectionRuleDispatchResult?.isCancelledBecause(45 /* CommandResult.GaugeLowerInflectionPointNaN */) ||
21647
+ this.state.sectionRuleDispatchResult?.isCancelledBecause(47 /* CommandResult.GaugeLowerBiggerThanUpper */));
21644
21648
  }
21645
21649
  get isUpperInflectionPointInvalid() {
21646
- return !!(this.state.sectionRuleDispatchResult?.isCancelledBecause(45 /* CommandResult.GaugeUpperInflectionPointNaN */) ||
21647
- this.state.sectionRuleDispatchResult?.isCancelledBecause(46 /* CommandResult.GaugeLowerBiggerThanUpper */));
21650
+ return !!(this.state.sectionRuleDispatchResult?.isCancelledBecause(46 /* CommandResult.GaugeUpperInflectionPointNaN */) ||
21651
+ this.state.sectionRuleDispatchResult?.isCancelledBecause(47 /* CommandResult.GaugeLowerBiggerThanUpper */));
21648
21652
  }
21649
21653
  updateSectionColor(target, color) {
21650
21654
  const sectionRule = deepCopy(this.state.sectionRule);
@@ -21732,10 +21736,10 @@ class ScorecardChartConfigPanel extends owl.Component {
21732
21736
  return cancelledReasons.map((error) => ChartTerms.Errors[error] || ChartTerms.Errors.Unexpected);
21733
21737
  }
21734
21738
  get isKeyValueInvalid() {
21735
- return !!this.state.keyValueDispatchResult?.isCancelledBecause(36 /* CommandResult.InvalidScorecardKeyValue */);
21739
+ return !!this.state.keyValueDispatchResult?.isCancelledBecause(37 /* CommandResult.InvalidScorecardKeyValue */);
21736
21740
  }
21737
21741
  get isBaselineInvalid() {
21738
- return !!this.state.keyValueDispatchResult?.isCancelledBecause(37 /* CommandResult.InvalidScorecardBaseline */);
21742
+ return !!this.state.keyValueDispatchResult?.isCancelledBecause(38 /* CommandResult.InvalidScorecardBaseline */);
21739
21743
  }
21740
21744
  onKeyValueRangeChanged(ranges) {
21741
21745
  this.keyValue = ranges[0];
@@ -22630,10 +22634,10 @@ class ConditionalFormattingPanel extends owl.Component {
22630
22634
  * Cell Is Rule
22631
22635
  ****************************************************************************/
22632
22636
  get isValue1Invalid() {
22633
- return !!this.state.errors?.includes(53 /* CommandResult.FirstArgMissing */);
22637
+ return !!this.state.errors?.includes(54 /* CommandResult.FirstArgMissing */);
22634
22638
  }
22635
22639
  get isValue2Invalid() {
22636
- return !!this.state.errors?.includes(54 /* CommandResult.SecondArgMissing */);
22640
+ return !!this.state.errors?.includes(55 /* CommandResult.SecondArgMissing */);
22637
22641
  }
22638
22642
  toggleStyle(tool) {
22639
22643
  const style = this.state.rules.cellIs.style;
@@ -22650,17 +22654,17 @@ class ConditionalFormattingPanel extends owl.Component {
22650
22654
  isValueInvalid(threshold) {
22651
22655
  switch (threshold) {
22652
22656
  case "minimum":
22653
- return (this.state.errors.includes(60 /* CommandResult.MinInvalidFormula */) ||
22654
- this.state.errors.includes(52 /* CommandResult.MinBiggerThanMid */) ||
22655
- this.state.errors.includes(49 /* CommandResult.MinBiggerThanMax */) ||
22656
- this.state.errors.includes(55 /* CommandResult.MinNaN */));
22657
+ return (this.state.errors.includes(61 /* CommandResult.MinInvalidFormula */) ||
22658
+ this.state.errors.includes(53 /* CommandResult.MinBiggerThanMid */) ||
22659
+ this.state.errors.includes(50 /* CommandResult.MinBiggerThanMax */) ||
22660
+ this.state.errors.includes(56 /* CommandResult.MinNaN */));
22657
22661
  case "midpoint":
22658
- return (this.state.errors.includes(61 /* CommandResult.MidInvalidFormula */) ||
22659
- this.state.errors.includes(56 /* CommandResult.MidNaN */) ||
22660
- this.state.errors.includes(51 /* CommandResult.MidBiggerThanMax */));
22662
+ return (this.state.errors.includes(62 /* CommandResult.MidInvalidFormula */) ||
22663
+ this.state.errors.includes(57 /* CommandResult.MidNaN */) ||
22664
+ this.state.errors.includes(52 /* CommandResult.MidBiggerThanMax */));
22661
22665
  case "maximum":
22662
- return (this.state.errors.includes(62 /* CommandResult.MaxInvalidFormula */) ||
22663
- this.state.errors.includes(57 /* CommandResult.MaxNaN */));
22666
+ return (this.state.errors.includes(63 /* CommandResult.MaxInvalidFormula */) ||
22667
+ this.state.errors.includes(58 /* CommandResult.MaxNaN */));
22664
22668
  default:
22665
22669
  return false;
22666
22670
  }
@@ -22708,13 +22712,13 @@ class ConditionalFormattingPanel extends owl.Component {
22708
22712
  isInflectionPointInvalid(inflectionPoint) {
22709
22713
  switch (inflectionPoint) {
22710
22714
  case "lowerInflectionPoint":
22711
- return (this.state.errors.includes(59 /* CommandResult.ValueLowerInflectionNaN */) ||
22712
- this.state.errors.includes(64 /* CommandResult.ValueLowerInvalidFormula */) ||
22713
- this.state.errors.includes(50 /* CommandResult.LowerBiggerThanUpper */));
22715
+ return (this.state.errors.includes(60 /* CommandResult.ValueLowerInflectionNaN */) ||
22716
+ this.state.errors.includes(65 /* CommandResult.ValueLowerInvalidFormula */) ||
22717
+ this.state.errors.includes(51 /* CommandResult.LowerBiggerThanUpper */));
22714
22718
  case "upperInflectionPoint":
22715
- return (this.state.errors.includes(58 /* CommandResult.ValueUpperInflectionNaN */) ||
22716
- this.state.errors.includes(63 /* CommandResult.ValueUpperInvalidFormula */) ||
22717
- this.state.errors.includes(50 /* CommandResult.LowerBiggerThanUpper */));
22719
+ return (this.state.errors.includes(59 /* CommandResult.ValueUpperInflectionNaN */) ||
22720
+ this.state.errors.includes(64 /* CommandResult.ValueUpperInvalidFormula */) ||
22721
+ this.state.errors.includes(51 /* CommandResult.LowerBiggerThanUpper */));
22718
22722
  default:
22719
22723
  return true;
22720
22724
  }
@@ -23077,7 +23081,7 @@ const SplitToColumnsInteractiveContent = {
23077
23081
  };
23078
23082
  function interactiveSplitToColumns(env, separator, addNewColumns) {
23079
23083
  let result = env.model.dispatch("SPLIT_TEXT_INTO_COLUMNS", { separator, addNewColumns });
23080
- if (result.isCancelledBecause(92 /* CommandResult.SplitWillOverwriteContent */)) {
23084
+ if (result.isCancelledBecause(93 /* CommandResult.SplitWillOverwriteContent */)) {
23081
23085
  env.askConfirmation(SplitToColumnsInteractiveContent.SplitIsDestructive, () => {
23082
23086
  result = env.model.dispatch("SPLIT_TEXT_INTO_COLUMNS", {
23083
23087
  separator,
@@ -23141,8 +23145,8 @@ class SplitIntoColumnsPanel extends owl.Component {
23141
23145
  const errors = new Set();
23142
23146
  for (const reason of cancelledReasons) {
23143
23147
  switch (reason) {
23144
- case 92 /* CommandResult.SplitWillOverwriteContent */:
23145
- case 91 /* CommandResult.EmptySplitSeparator */:
23148
+ case 93 /* CommandResult.SplitWillOverwriteContent */:
23149
+ case 92 /* CommandResult.EmptySplitSeparator */:
23146
23150
  break;
23147
23151
  default:
23148
23152
  errors.add(SplitToColumnsTerms.Errors[reason] || SplitToColumnsTerms.Errors.Unexpected);
@@ -23157,8 +23161,8 @@ class SplitIntoColumnsPanel extends owl.Component {
23157
23161
  addNewColumns: this.state.addNewColumns,
23158
23162
  force: false,
23159
23163
  }).reasons;
23160
- if (cancelledReasons.includes(92 /* CommandResult.SplitWillOverwriteContent */)) {
23161
- warnings.push(SplitToColumnsTerms.Errors[92 /* CommandResult.SplitWillOverwriteContent */]);
23164
+ if (cancelledReasons.includes(93 /* CommandResult.SplitWillOverwriteContent */)) {
23165
+ warnings.push(SplitToColumnsTerms.Errors[93 /* CommandResult.SplitWillOverwriteContent */]);
23162
23166
  }
23163
23167
  return warnings;
23164
23168
  }
@@ -24378,6 +24382,9 @@ class Composer extends owl.Component {
24378
24382
  const token = tokens.filter((token) => token.value.includes(currentSelectedText) &&
24379
24383
  token.start <= currentSelection.start &&
24380
24384
  token.end >= currentSelection.end)[0];
24385
+ if (!token) {
24386
+ return;
24387
+ }
24381
24388
  if (token.type === "REFERENCE") {
24382
24389
  this.env.model.dispatch("CHANGE_COMPOSER_CURSOR_SELECTION", {
24383
24390
  start: token.start,
@@ -31682,7 +31689,7 @@ class BordersPlugin extends CorePlugin {
31682
31689
  const currentBorder = this.getCellBorder(cmd);
31683
31690
  const areAllNewBordersUndefined = !cmd.border?.bottom && !cmd.border?.left && !cmd.border?.right && !cmd.border?.top;
31684
31691
  if ((!currentBorder && areAllNewBordersUndefined) || deepEquals(currentBorder, cmd.border)) {
31685
- return 97 /* CommandResult.NoChanges */;
31692
+ return 98 /* CommandResult.NoChanges */;
31686
31693
  }
31687
31694
  return 0 /* CommandResult.Success */;
31688
31695
  }
@@ -32193,9 +32200,9 @@ class CellPlugin extends CorePlugin {
32193
32200
  checkUselessClearCell(cmd) {
32194
32201
  const cell = this.getters.getCell(cmd);
32195
32202
  if (!cell)
32196
- return 97 /* CommandResult.NoChanges */;
32203
+ return 98 /* CommandResult.NoChanges */;
32197
32204
  if (!cell.content && !cell.style && !cell.format) {
32198
- return 97 /* CommandResult.NoChanges */;
32205
+ return 98 /* CommandResult.NoChanges */;
32199
32206
  }
32200
32207
  return 0 /* CommandResult.Success */;
32201
32208
  }
@@ -32420,13 +32427,13 @@ class ChartPlugin extends CorePlugin {
32420
32427
  }
32421
32428
  checkChartDuplicate(cmd) {
32422
32429
  return this.getters.getFigureSheetId(cmd.id)
32423
- ? 86 /* CommandResult.DuplicatedChartId */
32430
+ ? 87 /* CommandResult.DuplicatedChartId */
32424
32431
  : 0 /* CommandResult.Success */;
32425
32432
  }
32426
32433
  checkChartExists(cmd) {
32427
32434
  return this.getters.getFigureSheetId(cmd.id)
32428
32435
  ? 0 /* CommandResult.Success */
32429
- : 87 /* CommandResult.ChartDoesNotExist */;
32436
+ : 88 /* CommandResult.ChartDoesNotExist */;
32430
32437
  }
32431
32438
  }
32432
32439
 
@@ -32638,10 +32645,10 @@ class ConditionalFormatPlugin extends CorePlugin {
32638
32645
  return 28 /* CommandResult.InvalidSheetId */;
32639
32646
  const ruleIndex = this.cfRules[sheetId].findIndex((cf) => cf.id === cfId);
32640
32647
  if (ruleIndex === -1)
32641
- return 73 /* CommandResult.InvalidConditionalFormatId */;
32648
+ return 74 /* CommandResult.InvalidConditionalFormatId */;
32642
32649
  const cfIndex2 = direction === "up" ? ruleIndex - 1 : ruleIndex + 1;
32643
32650
  if (cfIndex2 < 0 || cfIndex2 >= this.cfRules[sheetId].length) {
32644
- return 73 /* CommandResult.InvalidConditionalFormatId */;
32651
+ return 74 /* CommandResult.InvalidConditionalFormatId */;
32645
32652
  }
32646
32653
  return 0 /* CommandResult.Success */;
32647
32654
  }
@@ -32682,10 +32689,10 @@ class ConditionalFormatPlugin extends CorePlugin {
32682
32689
  const errors = [];
32683
32690
  const isEmpty = (value) => value === undefined || value === "";
32684
32691
  if (expectedNumber >= 1 && isEmpty(rule.values[0])) {
32685
- errors.push(53 /* CommandResult.FirstArgMissing */);
32692
+ errors.push(54 /* CommandResult.FirstArgMissing */);
32686
32693
  }
32687
32694
  if (expectedNumber >= 2 && isEmpty(rule.values[1])) {
32688
- errors.push(54 /* CommandResult.SecondArgMissing */);
32695
+ errors.push(55 /* CommandResult.SecondArgMissing */);
32689
32696
  }
32690
32697
  return errors.length ? errors : 0 /* CommandResult.Success */;
32691
32698
  }
@@ -32697,15 +32704,15 @@ class ConditionalFormatPlugin extends CorePlugin {
32697
32704
  (threshold.value === "" || isNaN(threshold.value))) {
32698
32705
  switch (thresholdName) {
32699
32706
  case "min":
32700
- return 55 /* CommandResult.MinNaN */;
32707
+ return 56 /* CommandResult.MinNaN */;
32701
32708
  case "max":
32702
- return 57 /* CommandResult.MaxNaN */;
32709
+ return 58 /* CommandResult.MaxNaN */;
32703
32710
  case "mid":
32704
- return 56 /* CommandResult.MidNaN */;
32711
+ return 57 /* CommandResult.MidNaN */;
32705
32712
  case "upperInflectionPoint":
32706
- return 58 /* CommandResult.ValueUpperInflectionNaN */;
32713
+ return 59 /* CommandResult.ValueUpperInflectionNaN */;
32707
32714
  case "lowerInflectionPoint":
32708
- return 59 /* CommandResult.ValueLowerInflectionNaN */;
32715
+ return 60 /* CommandResult.ValueLowerInflectionNaN */;
32709
32716
  }
32710
32717
  }
32711
32718
  return 0 /* CommandResult.Success */;
@@ -32719,15 +32726,15 @@ class ConditionalFormatPlugin extends CorePlugin {
32719
32726
  catch (error) {
32720
32727
  switch (thresholdName) {
32721
32728
  case "min":
32722
- return 60 /* CommandResult.MinInvalidFormula */;
32729
+ return 61 /* CommandResult.MinInvalidFormula */;
32723
32730
  case "max":
32724
- return 62 /* CommandResult.MaxInvalidFormula */;
32731
+ return 63 /* CommandResult.MaxInvalidFormula */;
32725
32732
  case "mid":
32726
- return 61 /* CommandResult.MidInvalidFormula */;
32733
+ return 62 /* CommandResult.MidInvalidFormula */;
32727
32734
  case "upperInflectionPoint":
32728
- return 63 /* CommandResult.ValueUpperInvalidFormula */;
32735
+ return 64 /* CommandResult.ValueUpperInvalidFormula */;
32729
32736
  case "lowerInflectionPoint":
32730
- return 64 /* CommandResult.ValueLowerInvalidFormula */;
32737
+ return 65 /* CommandResult.ValueLowerInvalidFormula */;
32731
32738
  }
32732
32739
  }
32733
32740
  return 0 /* CommandResult.Success */;
@@ -32744,7 +32751,7 @@ class ConditionalFormatPlugin extends CorePlugin {
32744
32751
  if (["number", "percentage", "percentile"].includes(rule.lowerInflectionPoint.type) &&
32745
32752
  rule.lowerInflectionPoint.type === rule.upperInflectionPoint.type &&
32746
32753
  Number(minValue) > Number(maxValue)) {
32747
- return 50 /* CommandResult.LowerBiggerThanUpper */;
32754
+ return 51 /* CommandResult.LowerBiggerThanUpper */;
32748
32755
  }
32749
32756
  return 0 /* CommandResult.Success */;
32750
32757
  }
@@ -32754,7 +32761,7 @@ class ConditionalFormatPlugin extends CorePlugin {
32754
32761
  if (["number", "percentage", "percentile"].includes(rule.minimum.type) &&
32755
32762
  rule.minimum.type === rule.maximum.type &&
32756
32763
  stringToNumber(minValue) >= stringToNumber(maxValue)) {
32757
- return 49 /* CommandResult.MinBiggerThanMax */;
32764
+ return 50 /* CommandResult.MinBiggerThanMax */;
32758
32765
  }
32759
32766
  return 0 /* CommandResult.Success */;
32760
32767
  }
@@ -32765,7 +32772,7 @@ class ConditionalFormatPlugin extends CorePlugin {
32765
32772
  ["number", "percentage", "percentile"].includes(rule.midpoint.type) &&
32766
32773
  rule.midpoint.type === rule.maximum.type &&
32767
32774
  stringToNumber(midValue) >= stringToNumber(maxValue)) {
32768
- return 51 /* CommandResult.MidBiggerThanMax */;
32775
+ return 52 /* CommandResult.MidBiggerThanMax */;
32769
32776
  }
32770
32777
  return 0 /* CommandResult.Success */;
32771
32778
  }
@@ -32776,7 +32783,7 @@ class ConditionalFormatPlugin extends CorePlugin {
32776
32783
  ["number", "percentage", "percentile"].includes(rule.midpoint.type) &&
32777
32784
  rule.minimum.type === rule.midpoint.type &&
32778
32785
  stringToNumber(minValue) >= stringToNumber(midValue)) {
32779
- return 52 /* CommandResult.MinBiggerThanMid */;
32786
+ return 53 /* CommandResult.MinBiggerThanMid */;
32780
32787
  }
32781
32788
  return 0 /* CommandResult.Success */;
32782
32789
  }
@@ -32908,13 +32915,13 @@ class FigurePlugin extends CorePlugin {
32908
32915
  }
32909
32916
  checkFigureExists(sheetId, figureId) {
32910
32917
  if (this.figures[sheetId]?.[figureId] === undefined) {
32911
- return 72 /* CommandResult.FigureDoesNotExist */;
32918
+ return 73 /* CommandResult.FigureDoesNotExist */;
32912
32919
  }
32913
32920
  return 0 /* CommandResult.Success */;
32914
32921
  }
32915
32922
  checkFigureDuplicate(figureId) {
32916
32923
  if (Object.values(this.figures).find((sheet) => sheet?.[figureId])) {
32917
- return 84 /* CommandResult.DuplicatedFigureId */;
32924
+ return 85 /* CommandResult.DuplicatedFigureId */;
32918
32925
  }
32919
32926
  return 0 /* CommandResult.Success */;
32920
32927
  }
@@ -33026,12 +33033,12 @@ class FiltersPlugin extends CorePlugin {
33026
33033
  switch (cmd.type) {
33027
33034
  case "CREATE_FILTER_TABLE":
33028
33035
  if (!areZonesContinuous(...cmd.target)) {
33029
- return 83 /* CommandResult.NonContinuousTargets */;
33036
+ return 84 /* CommandResult.NonContinuousTargets */;
33030
33037
  }
33031
33038
  const zone = union(...cmd.target);
33032
33039
  const checkFilterOverlap = () => {
33033
33040
  if (this.getFilterTables(cmd.sheetId).some((filter) => overlap(filter.zone, zone))) {
33034
- return 80 /* CommandResult.FilterOverlap */;
33041
+ return 81 /* CommandResult.FilterOverlap */;
33035
33042
  }
33036
33043
  return 0 /* CommandResult.Success */;
33037
33044
  };
@@ -33039,7 +33046,7 @@ class FiltersPlugin extends CorePlugin {
33039
33046
  const mergesInTarget = this.getters.getMergesInZone(cmd.sheetId, zone);
33040
33047
  for (let merge of mergesInTarget) {
33041
33048
  if (overlap(zone, merge)) {
33042
- return 82 /* CommandResult.MergeInFilter */;
33049
+ return 83 /* CommandResult.MergeInFilter */;
33043
33050
  }
33044
33051
  }
33045
33052
  return 0 /* CommandResult.Success */;
@@ -33049,7 +33056,7 @@ class FiltersPlugin extends CorePlugin {
33049
33056
  for (let merge of cmd.target) {
33050
33057
  for (let filterTable of this.getFilterTables(cmd.sheetId)) {
33051
33058
  if (overlap(filterTable.zone, merge)) {
33052
- return 82 /* CommandResult.MergeInFilter */;
33059
+ return 83 /* CommandResult.MergeInFilter */;
33053
33060
  }
33054
33061
  }
33055
33062
  }
@@ -33418,10 +33425,10 @@ class HeaderVisibilityPlugin extends CorePlugin {
33418
33425
  : this.getters.getNumberRows(cmd.sheetId);
33419
33426
  const hiddenElements = new Set((hiddenGroup || []).flat().concat(cmd.elements));
33420
33427
  if (hiddenElements.size >= elements) {
33421
- return 68 /* CommandResult.TooManyHiddenElements */;
33428
+ return 69 /* CommandResult.TooManyHiddenElements */;
33422
33429
  }
33423
33430
  else if (Math.min(...cmd.elements) < 0 || Math.max(...cmd.elements) > elements) {
33424
- return 88 /* CommandResult.InvalidHeaderIndex */;
33431
+ return 89 /* CommandResult.InvalidHeaderIndex */;
33425
33432
  }
33426
33433
  else {
33427
33434
  return 0 /* CommandResult.Success */;
@@ -33985,7 +33992,7 @@ class MergePlugin extends CorePlugin {
33985
33992
  for (const zone of target) {
33986
33993
  for (const zone2 of target) {
33987
33994
  if (zone !== zone2 && overlap(zone, zone2)) {
33988
- return 67 /* CommandResult.MergeOverlap */;
33995
+ return 68 /* CommandResult.MergeOverlap */;
33989
33996
  }
33990
33997
  }
33991
33998
  }
@@ -33999,7 +34006,7 @@ class MergePlugin extends CorePlugin {
33999
34006
  for (const zone of target) {
34000
34007
  if ((zone.left < xSplit && zone.right >= xSplit) ||
34001
34008
  (zone.top < ySplit && zone.bottom >= ySplit)) {
34002
- return 77 /* CommandResult.FrozenPaneOverlap */;
34009
+ return 78 /* CommandResult.FrozenPaneOverlap */;
34003
34010
  }
34004
34011
  }
34005
34012
  return 0 /* CommandResult.Success */;
@@ -34522,9 +34529,9 @@ class RangeAdapter {
34522
34529
  * Get a Xc string that represent a part of a range
34523
34530
  */
34524
34531
  getRangePartString(range, part) {
34525
- const colFixed = range.parts && range.parts[part].colFixed ? "$" : "";
34532
+ const colFixed = range.parts && range.parts[part]?.colFixed ? "$" : "";
34526
34533
  const col = part === 0 ? numberToLetters(range.zone.left) : numberToLetters(range.zone.right);
34527
- const rowFixed = range.parts && range.parts[part].rowFixed ? "$" : "";
34534
+ const rowFixed = range.parts && range.parts[part]?.rowFixed ? "$" : "";
34528
34535
  const row = part === 0 ? String(range.zone.top + 1) : String(range.zone.bottom + 1);
34529
34536
  let str = "";
34530
34537
  if (range.isFullCol) {
@@ -34632,10 +34639,10 @@ class SheetPlugin extends CorePlugin {
34632
34639
  ? this.getNumberCols(cmd.sheetId)
34633
34640
  : this.getNumberRows(cmd.sheetId);
34634
34641
  if (cmd.base < 0 || cmd.base >= elements) {
34635
- return 88 /* CommandResult.InvalidHeaderIndex */;
34642
+ return 89 /* CommandResult.InvalidHeaderIndex */;
34636
34643
  }
34637
34644
  else if (cmd.quantity <= 0) {
34638
- return 89 /* CommandResult.InvalidQuantity */;
34645
+ return 90 /* CommandResult.InvalidQuantity */;
34639
34646
  }
34640
34647
  return 0 /* CommandResult.Success */;
34641
34648
  case "REMOVE_COLUMNS_ROWS": {
@@ -34643,7 +34650,7 @@ class SheetPlugin extends CorePlugin {
34643
34650
  ? this.getNumberCols(cmd.sheetId)
34644
34651
  : this.getNumberRows(cmd.sheetId);
34645
34652
  if (Math.min(...cmd.elements) < 0 || Math.max(...cmd.elements) > elements) {
34646
- return 88 /* CommandResult.InvalidHeaderIndex */;
34653
+ return 89 /* CommandResult.InvalidHeaderIndex */;
34647
34654
  }
34648
34655
  else if (this.checkElementsIncludeAllNonFrozenHeaders(cmd.sheetId, cmd.dimension, cmd.elements)) {
34649
34656
  return 8 /* CommandResult.NotEnoughElements */;
@@ -35123,18 +35130,18 @@ class SheetPlugin extends CorePlugin {
35123
35130
  checkRowFreezeQuantity(cmd) {
35124
35131
  return cmd.quantity >= 1 && cmd.quantity < this.getNumberRows(cmd.sheetId)
35125
35132
  ? 0 /* CommandResult.Success */
35126
- : 76 /* CommandResult.InvalidFreezeQuantity */;
35133
+ : 77 /* CommandResult.InvalidFreezeQuantity */;
35127
35134
  }
35128
35135
  checkColFreezeQuantity(cmd) {
35129
35136
  return cmd.quantity >= 1 && cmd.quantity < this.getNumberCols(cmd.sheetId)
35130
35137
  ? 0 /* CommandResult.Success */
35131
- : 76 /* CommandResult.InvalidFreezeQuantity */;
35138
+ : 77 /* CommandResult.InvalidFreezeQuantity */;
35132
35139
  }
35133
35140
  checkRowFreezeOverlapMerge(cmd) {
35134
35141
  const merges = this.getters.getMerges(cmd.sheetId);
35135
35142
  for (let merge of merges) {
35136
35143
  if (merge.top < cmd.quantity && cmd.quantity <= merge.bottom) {
35137
- return 67 /* CommandResult.MergeOverlap */;
35144
+ return 68 /* CommandResult.MergeOverlap */;
35138
35145
  }
35139
35146
  }
35140
35147
  return 0 /* CommandResult.Success */;
@@ -35143,7 +35150,7 @@ class SheetPlugin extends CorePlugin {
35143
35150
  const merges = this.getters.getMerges(cmd.sheetId);
35144
35151
  for (let merge of merges) {
35145
35152
  if (merge.left < cmd.quantity && cmd.quantity <= merge.right) {
35146
- return 67 /* CommandResult.MergeOverlap */;
35153
+ return 68 /* CommandResult.MergeOverlap */;
35147
35154
  }
35148
35155
  }
35149
35156
  return 0 /* CommandResult.Success */;
@@ -35464,7 +35471,7 @@ class SettingsPlugin extends CorePlugin {
35464
35471
  allowDispatch(cmd) {
35465
35472
  switch (cmd.type) {
35466
35473
  case "UPDATE_LOCALE":
35467
- return isValidLocale(cmd.locale) ? 0 /* CommandResult.Success */ : 95 /* CommandResult.InvalidLocale */;
35474
+ return isValidLocale(cmd.locale) ? 0 /* CommandResult.Success */ : 96 /* CommandResult.InvalidLocale */;
35468
35475
  }
35469
35476
  return 0 /* CommandResult.Success */;
35470
35477
  }
@@ -35545,22 +35552,17 @@ class CompilationParametersBuilder {
35545
35552
  * The `compute` of the formula's function must process it completely
35546
35553
  */
35547
35554
  refFn(range, isMeta, functionName, paramNumber) {
35555
+ this.assertRangeValid(range);
35548
35556
  if (isMeta) {
35549
35557
  // Use zoneToXc of zone instead of getRangeString to avoid sending unbounded ranges
35550
35558
  return { value: zoneToXc(range.zone) };
35551
35559
  }
35552
- if (!isZoneValid(range.zone)) {
35553
- throw new InvalidReferenceError();
35554
- }
35555
35560
  // if the formula definition could have accepted a range, we would pass through the _range function and not here
35556
35561
  if (range.zone.bottom !== range.zone.top || range.zone.left !== range.zone.right) {
35557
35562
  throw new Error(paramNumber
35558
35563
  ? _lt("Function %s expects the parameter %s to be a single value or a single cell reference, not a range.", functionName.toString(), paramNumber.toString())
35559
35564
  : _lt("Function %s expects its parameters to be single values or single cell references, not ranges.", functionName.toString()));
35560
35565
  }
35561
- if (range.invalidSheetName) {
35562
- throw new Error(_lt("Invalid sheet name: %s", range.invalidSheetName));
35563
- }
35564
35566
  return this.readCell(range);
35565
35567
  }
35566
35568
  readCell(range) {
@@ -35595,10 +35597,10 @@ class CompilationParametersBuilder {
35595
35597
  * Note that each col is possibly sparse: it only contain the values of cells
35596
35598
  * that are actually present in the grid.
35597
35599
  */
35598
- range({ sheetId, zone }) {
35599
- if (!isZoneValid(zone)) {
35600
- throw new InvalidReferenceError();
35601
- }
35600
+ range(range) {
35601
+ this.assertRangeValid(range);
35602
+ const sheetId = range.sheetId;
35603
+ const zone = range.zone;
35602
35604
  // Performance issue: Avoid fetching data on positions that are out of the spreadsheet
35603
35605
  // e.g. A1:ZZZ9999 in a sheet with 10 cols and 10 rows should ignore everything past J10 and return a 10x10 array
35604
35606
  const sheetZone = this.getters.getSheetZone(sheetId);
@@ -35641,6 +35643,14 @@ class CompilationParametersBuilder {
35641
35643
  this.rangeCache[cacheKey] = result;
35642
35644
  return result;
35643
35645
  }
35646
+ assertRangeValid(range) {
35647
+ if (!isZoneValid(range.zone)) {
35648
+ throw new InvalidReferenceError();
35649
+ }
35650
+ if (range.invalidSheetName) {
35651
+ throw new Error(_lt("Invalid sheet name: %s", range.invalidSheetName));
35652
+ }
35653
+ }
35644
35654
  }
35645
35655
 
35646
35656
  function quickselect(arr, k, left, right, compare) {
@@ -37919,7 +37929,7 @@ class AutofillPlugin extends UIPlugin {
37919
37929
  if (this.lastCellSelected.col !== undefined && this.lastCellSelected.row !== undefined) {
37920
37930
  return 0 /* CommandResult.Success */;
37921
37931
  }
37922
- return 47 /* CommandResult.InvalidAutofillSelection */;
37932
+ return 48 /* CommandResult.InvalidAutofillSelection */;
37923
37933
  case "AUTOFILL_AUTO":
37924
37934
  const zone = this.getters.getSelectedZone();
37925
37935
  return zone.top === zone.bottom
@@ -38538,7 +38548,7 @@ class CellPopoverPlugin extends UIPlugin {
38538
38548
  cellPopoverRegistry.get(cmd.popoverType);
38539
38549
  }
38540
38550
  catch (error) {
38541
- return 74 /* CommandResult.InvalidCellPopover */;
38551
+ return 75 /* CommandResult.InvalidCellPopover */;
38542
38552
  }
38543
38553
  return 0 /* CommandResult.Success */;
38544
38554
  default:
@@ -40678,27 +40688,6 @@ class SelectionInputPlugin extends UIPlugin {
40678
40688
  // ---------------------------------------------------------------------------
40679
40689
  // Command Handling
40680
40690
  // ---------------------------------------------------------------------------
40681
- allowDispatch(cmd) {
40682
- switch (cmd.type) {
40683
- case "ADD_RANGE":
40684
- case "ADD_EMPTY_RANGE":
40685
- if (this.inputHasSingleRange && this.ranges.length === 1) {
40686
- return 31 /* CommandResult.MaximumRangesReached */;
40687
- }
40688
- break;
40689
- case "REMOVE_RANGE":
40690
- if (this.ranges.length === 1) {
40691
- return 32 /* CommandResult.MinimumRangesReached */;
40692
- }
40693
- break;
40694
- case "CHANGE_RANGE":
40695
- if (this.inputHasSingleRange && cmd.value.split(",").length > 1) {
40696
- return 31 /* CommandResult.MaximumRangesReached */;
40697
- }
40698
- break;
40699
- }
40700
- return 0 /* CommandResult.Success */;
40701
- }
40702
40691
  handleEvent(event) {
40703
40692
  const inputSheetId = this.activeSheet;
40704
40693
  const sheetId = this.getters.getActiveSheetId();
@@ -40918,6 +40907,15 @@ class SelectionInputsManagerPlugin extends UIPlugin {
40918
40907
  // Command Handling
40919
40908
  // ---------------------------------------------------------------------------
40920
40909
  allowDispatch(cmd) {
40910
+ switch (cmd.type) {
40911
+ case "FOCUS_RANGE":
40912
+ case "CHANGE_RANGE":
40913
+ case "ADD_EMPTY_RANGE":
40914
+ case "REMOVE_RANGE":
40915
+ if (!this.inputs[cmd.id]) {
40916
+ return 33 /* CommandResult.InvalidInputId */;
40917
+ }
40918
+ }
40921
40919
  switch (cmd.type) {
40922
40920
  case "FOCUS_RANGE":
40923
40921
  const index = this.currentInput?.getIndex(cmd.rangeId);
@@ -40925,9 +40923,25 @@ class SelectionInputsManagerPlugin extends UIPlugin {
40925
40923
  return 30 /* CommandResult.InputAlreadyFocused */;
40926
40924
  }
40927
40925
  break;
40928
- }
40929
- if (this.currentInput) {
40930
- return this.currentInput.allowDispatch(cmd);
40926
+ case "ADD_RANGE":
40927
+ case "ADD_EMPTY_RANGE":
40928
+ const input = this.inputs[cmd.id];
40929
+ if (input.inputHasSingleRange && input.ranges.length === 1) {
40930
+ return 31 /* CommandResult.MaximumRangesReached */;
40931
+ }
40932
+ break;
40933
+ case "REMOVE_RANGE":
40934
+ if (this.inputs[cmd.id].ranges.length === 1) {
40935
+ return 32 /* CommandResult.MinimumRangesReached */;
40936
+ }
40937
+ break;
40938
+ case "CHANGE_RANGE": {
40939
+ const input = this.inputs[cmd.id];
40940
+ if (input.inputHasSingleRange && cmd.value.split(",").length > 1) {
40941
+ return 31 /* CommandResult.MaximumRangesReached */;
40942
+ }
40943
+ break;
40944
+ }
40931
40945
  }
40932
40946
  return 0 /* CommandResult.Success */;
40933
40947
  }
@@ -41057,7 +41071,7 @@ class SortPlugin extends UIPlugin {
41057
41071
  /*Test the presence of single cells*/
41058
41072
  const singleCells = positions(zone).some(({ col, row }) => !this.getters.isInMerge({ sheetId, col, row }));
41059
41073
  if (singleCells) {
41060
- return 65 /* CommandResult.InvalidSortZone */;
41074
+ return 66 /* CommandResult.InvalidSortZone */;
41061
41075
  }
41062
41076
  return 0 /* CommandResult.Success */;
41063
41077
  }
@@ -41076,7 +41090,7 @@ class SortPlugin extends UIPlugin {
41076
41090
  ];
41077
41091
  return widthCurrent === widthFirst && heightCurrent === heightFirst;
41078
41092
  })) {
41079
- return 65 /* CommandResult.InvalidSortZone */;
41093
+ return 66 /* CommandResult.InvalidSortZone */;
41080
41094
  }
41081
41095
  return 0 /* CommandResult.Success */;
41082
41096
  }
@@ -41514,7 +41528,7 @@ class SheetUIPlugin extends UIPlugin {
41514
41528
  const sheetId = "sheetId" in cmd ? cmd.sheetId : this.getters.tryGetActiveSheetId();
41515
41529
  const zones = this.getters.getCommandZones(cmd);
41516
41530
  if (!sheetId && zones.length > 0) {
41517
- return 94 /* CommandResult.NoActiveSheet */;
41531
+ return 95 /* CommandResult.NoActiveSheet */;
41518
41532
  }
41519
41533
  if (sheetId && zones.length > 0) {
41520
41534
  return this.getters.checkZonesExistInSheet(sheetId, zones);
@@ -41996,13 +42010,13 @@ class SplitToColumnsPlugin extends UIPlugin {
41996
42010
  }
41997
42011
  checkSingleColSelected() {
41998
42012
  if (!this.getters.isSingleColSelected()) {
41999
- return 90 /* CommandResult.MoreThanOneColumnSelected */;
42013
+ return 91 /* CommandResult.MoreThanOneColumnSelected */;
42000
42014
  }
42001
42015
  return 0 /* CommandResult.Success */;
42002
42016
  }
42003
42017
  checkNonEmptySelector(cmd) {
42004
42018
  if (cmd.separator === "") {
42005
- return 91 /* CommandResult.EmptySplitSeparator */;
42019
+ return 92 /* CommandResult.EmptySplitSeparator */;
42006
42020
  }
42007
42021
  return 0 /* CommandResult.Success */;
42008
42022
  }
@@ -42013,7 +42027,7 @@ class SplitToColumnsPlugin extends UIPlugin {
42013
42027
  const selection = this.getters.getSelectedZones()[0];
42014
42028
  const splitted = this.getSplittedCols(selection, cmd.separator);
42015
42029
  if (this.willSplittedColsOverwriteContent(selection, splitted)) {
42016
- return 92 /* CommandResult.SplitWillOverwriteContent */;
42030
+ return 93 /* CommandResult.SplitWillOverwriteContent */;
42017
42031
  }
42018
42032
  return 0 /* CommandResult.Success */;
42019
42033
  }
@@ -42024,7 +42038,7 @@ class SplitToColumnsPlugin extends UIPlugin {
42024
42038
  return 0 /* CommandResult.Success */;
42025
42039
  }
42026
42040
  }
42027
- return 93 /* CommandResult.NoSplitSeparatorInSelection */;
42041
+ return 94 /* CommandResult.NoSplitSeparatorInSelection */;
42028
42042
  }
42029
42043
  }
42030
42044
 
@@ -42172,7 +42186,7 @@ class ClipboardCellsState extends ClipboardCellsAbstractState {
42172
42186
  for (const zone of this.getPasteZones(target)) {
42173
42187
  if ((zone.left < xSplit && zone.right >= xSplit) ||
42174
42188
  (zone.top < ySplit && zone.bottom >= ySplit)) {
42175
- return 77 /* CommandResult.FrozenPaneOverlap */;
42189
+ return 78 /* CommandResult.FrozenPaneOverlap */;
42176
42190
  }
42177
42191
  }
42178
42192
  return 0 /* CommandResult.Success */;
@@ -42624,7 +42638,7 @@ class ClipboardFigureState {
42624
42638
  }
42625
42639
  isPasteAllowed(target, option) {
42626
42640
  if (target.length === 0) {
42627
- return 75 /* CommandResult.EmptyTarget */;
42641
+ return 76 /* CommandResult.EmptyTarget */;
42628
42642
  }
42629
42643
  if (option?.pasteOption !== undefined) {
42630
42644
  return 23 /* CommandResult.WrongFigurePasteOption */;
@@ -42857,7 +42871,7 @@ class ClipboardPlugin extends UIPlugin {
42857
42871
  }
42858
42872
  case "ACTIVATE_PAINT_FORMAT": {
42859
42873
  if (this.paintFormatStatus !== "inactive") {
42860
- return 96 /* CommandResult.AlreadyInPaintingFormatMode */;
42874
+ return 97 /* CommandResult.AlreadyInPaintingFormatMode */;
42861
42875
  }
42862
42876
  }
42863
42877
  }
@@ -43435,7 +43449,7 @@ class EditionPlugin extends UIPlugin {
43435
43449
  validateSelection(length, start, end) {
43436
43450
  return start >= 0 && start <= length && end >= 0 && end <= length
43437
43451
  ? 0 /* CommandResult.Success */
43438
- : 48 /* CommandResult.WrongComposerSelection */;
43452
+ : 49 /* CommandResult.WrongComposerSelection */;
43439
43453
  }
43440
43454
  onColumnsRemoved(cmd) {
43441
43455
  if (cmd.elements.includes(this.col) && this.mode !== "inactive") {
@@ -43747,9 +43761,10 @@ class EditionPlugin extends UIPlugin {
43747
43761
  */
43748
43762
  getReferencedRanges() {
43749
43763
  const editionSheetId = this.getters.getCurrentEditedCell().sheetId;
43750
- return this.currentTokens
43764
+ const referenceRanges = this.currentTokens
43751
43765
  .filter((token) => token.type === "REFERENCE")
43752
43766
  .map((token) => this.getters.getRangeFromSheetXC(editionSheetId, token.value));
43767
+ return referenceRanges.filter((range) => !range.invalidSheetName && !range.invalidXc);
43753
43768
  }
43754
43769
  /**
43755
43770
  * Function used to determine when composer selection can start.
@@ -43816,7 +43831,7 @@ class FilterEvaluationPlugin extends UIPlugin {
43816
43831
  switch (cmd.type) {
43817
43832
  case "UPDATE_FILTER":
43818
43833
  if (!this.getters.getFilterId(cmd)) {
43819
- return 81 /* CommandResult.FilterNotFound */;
43834
+ return 82 /* CommandResult.FilterNotFound */;
43820
43835
  }
43821
43836
  break;
43822
43837
  }
@@ -44611,7 +44626,7 @@ class GridSelectionPlugin extends UIPlugin {
44611
44626
  const headers = [cmd.base, ...cmd.elements];
44612
44627
  const maxHeaderValue = isCol ? this.getters.getNumberCols(id) : this.getters.getNumberRows(id);
44613
44628
  if (headers.some((h) => h < 0 || h >= maxHeaderValue)) {
44614
- return 88 /* CommandResult.InvalidHeaderIndex */;
44629
+ return 89 /* CommandResult.InvalidHeaderIndex */;
44615
44630
  }
44616
44631
  return 0 /* CommandResult.Success */;
44617
44632
  }
@@ -45427,7 +45442,7 @@ class SheetViewPlugin extends UIPlugin {
45427
45442
  }
45428
45443
  checkPositiveDimension(cmd) {
45429
45444
  if (cmd.width < 0 || cmd.height < 0) {
45430
- return 70 /* CommandResult.InvalidViewportSize */;
45445
+ return 71 /* CommandResult.InvalidViewportSize */;
45431
45446
  }
45432
45447
  return 0 /* CommandResult.Success */;
45433
45448
  }
@@ -45437,7 +45452,7 @@ class SheetViewPlugin extends UIPlugin {
45437
45452
  cmd.gridOffsetY === this.gridOffsetY &&
45438
45453
  cmd.width === width &&
45439
45454
  cmd.height === height) {
45440
- return 78 /* CommandResult.ValuesNotChanged */;
45455
+ return 79 /* CommandResult.ValuesNotChanged */;
45441
45456
  }
45442
45457
  return 0 /* CommandResult.Success */;
45443
45458
  }
@@ -45445,7 +45460,7 @@ class SheetViewPlugin extends UIPlugin {
45445
45460
  const pane = this.getMainInternalViewport(this.getters.getActiveSheetId());
45446
45461
  if ((!pane.canScrollHorizontally && offsetX > 0) ||
45447
45462
  (!pane.canScrollVertically && offsetY > 0)) {
45448
- return 71 /* CommandResult.InvalidScrollingDirection */;
45463
+ return 72 /* CommandResult.InvalidScrollingDirection */;
45449
45464
  }
45450
45465
  return 0 /* CommandResult.Success */;
45451
45466
  }
@@ -48904,7 +48919,7 @@ class SelectionStreamProcessorImpl {
48904
48919
  */
48905
48920
  moveAnchorCell(direction, step = 1) {
48906
48921
  if (step !== "end" && step <= 0) {
48907
- return new DispatchResult(85 /* CommandResult.InvalidSelectionStep */);
48922
+ return new DispatchResult(86 /* CommandResult.InvalidSelectionStep */);
48908
48923
  }
48909
48924
  const { col, row } = this.getNextAvailablePosition(direction, step);
48910
48925
  return this.selectCell(col, row);
@@ -48950,7 +48965,7 @@ class SelectionStreamProcessorImpl {
48950
48965
  */
48951
48966
  resizeAnchorZone(direction, step = 1) {
48952
48967
  if (step !== "end" && step <= 0) {
48953
- return new DispatchResult(85 /* CommandResult.InvalidSelectionStep */);
48968
+ return new DispatchResult(86 /* CommandResult.InvalidSelectionStep */);
48954
48969
  }
48955
48970
  const sheetId = this.getters.getActiveSheetId();
48956
48971
  const anchor = this.anchor;
@@ -51307,10 +51322,10 @@ class Model extends EventBus {
51307
51322
  const command = createCommand(type, payload);
51308
51323
  let status = this.status;
51309
51324
  if (this.getters.isReadonly() && !canExecuteInReadonly(command)) {
51310
- return new DispatchResult(69 /* CommandResult.Readonly */);
51325
+ return new DispatchResult(70 /* CommandResult.Readonly */);
51311
51326
  }
51312
51327
  if (!this.session.canApplyOptimisticUpdate()) {
51313
- return new DispatchResult(66 /* CommandResult.WaitingSessionConfirmation */);
51328
+ return new DispatchResult(67 /* CommandResult.WaitingSessionConfirmation */);
51314
51329
  }
51315
51330
  switch (status) {
51316
51331
  case 0 /* Status.Ready */:
@@ -51597,6 +51612,6 @@ exports.setTranslationMethod = setTranslationMethod;
51597
51612
  exports.tokenize = tokenize;
51598
51613
 
51599
51614
 
51600
- __info__.version = '16.4.18';
51601
- __info__.date = '2024-01-12T13:43:10.143Z';
51602
- __info__.hash = 'f438e08';
51615
+ __info__.version = '16.4.20';
51616
+ __info__.date = '2024-01-29T13:50:12.345Z';
51617
+ __info__.hash = '06c0ecf';