@mog-sdk/node 0.1.12 → 0.1.13

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.
package/dist/index.js CHANGED
@@ -67,10 +67,45 @@ function activeCellToStoreCellData(data, row, col) {
67
67
  }
68
68
  async function getData(ctx, sheetId, row, col) {
69
69
  const cellId = await ctx.computeBridge.getCellIdAt(sheetId, row, col);
70
- if (!cellId) return void 0;
71
- const data = await ctx.computeBridge.getActiveCell(sheetId, cellId);
72
- if (!data) return void 0;
73
- return activeCellToStoreCellData(data, row, col);
70
+ if (cellId) {
71
+ const data = await ctx.computeBridge.getActiveCell(sheetId, cellId);
72
+ if (data) return activeCellToStoreCellData(data, row, col);
73
+ }
74
+ const cellData = await ctx.computeBridge.getCellData(sheetId, row, col);
75
+ if (cellData != null) {
76
+ const obj = cellData;
77
+ const rawValue = obj.value ?? obj.raw;
78
+ if (rawValue != null) {
79
+ const value = parseMirrorValue(rawValue);
80
+ if (value !== null && value !== void 0) {
81
+ return {
82
+ id: obj.cell_id ?? obj.cellId ?? "",
83
+ row,
84
+ col,
85
+ raw: value
86
+ };
87
+ }
88
+ }
89
+ }
90
+ return void 0;
91
+ }
92
+ function parseMirrorValue(json) {
93
+ if (typeof json !== "object" || json === null) return null;
94
+ const obj = json;
95
+ switch (obj.type) {
96
+ case "number":
97
+ return obj.value;
98
+ case "text":
99
+ return obj.value;
100
+ case "boolean":
101
+ return obj.value;
102
+ case "error":
103
+ return obj.value;
104
+ case "null":
105
+ return null;
106
+ default:
107
+ return null;
108
+ }
74
109
  }
75
110
  function getEffectiveValue(data) {
76
111
  if (data.formula !== void 0) {
@@ -5010,10 +5045,11 @@ var init_compute_core = __esm({
5010
5045
  * Requires at least CONTEXT_SET phase (the engine may or may not have been started yet).
5011
5046
  * After fullRecalc completes, the bridge transitions to STARTED phase.
5012
5047
  */
5013
- async fullRecalc() {
5048
+ async fullRecalc(options) {
5014
5049
  this.ensurePhase("CONTEXT_SET", "fullRecalc");
5015
5050
  const result = await this.transport.call("compute_full_recalc", {
5016
- docId: this.docId
5051
+ docId: this.docId,
5052
+ options: options ?? {}
5017
5053
  });
5018
5054
  this._phase = "STARTED";
5019
5055
  this.mutationHandler?.applyAndNotify({ recalc: result });
@@ -6649,6 +6685,9 @@ var init_compute_bridge_gen = __esm({
6649
6685
  pivotUnregisterDef(sheetId, pivotName) {
6650
6686
  return this.core.mutatePlain(this.core.transport.call("compute_pivot_unregister_def", { docId: this.core.docId, sheetId, pivotName }));
6651
6687
  }
6688
+ pivotMaterialize(sheetId, pivotId, expansionState) {
6689
+ return this.core.query(this.core.transport.call("compute_pivot_materialize", { docId: this.core.docId, sheetId, pivotId, expansionState }));
6690
+ }
6652
6691
  registerViewport(viewportId, sheetId, startRow, startCol, endRow, endCol) {
6653
6692
  return this.core.mutatePlain(this.core.transport.call("compute_register_viewport", { docId: this.core.docId, viewportId, sheetId, startRow, startCol, endRow, endCol }));
6654
6693
  }
@@ -6905,8 +6944,8 @@ var init_compute_bridge = __esm({
6905
6944
  // ===========================================================================
6906
6945
  // Error Recovery delegates
6907
6946
  // ===========================================================================
6908
- fullRecalc() {
6909
- return this.core.fullRecalc();
6947
+ fullRecalc(options) {
6948
+ return this.core.fullRecalc(options);
6910
6949
  }
6911
6950
  exportToXlsxBytes() {
6912
6951
  return this.core.exportToXlsxBytes();
@@ -7791,6 +7830,15 @@ function letterToCol(letters) {
7791
7830
  function toA12(row, col) {
7792
7831
  return `${colToLetter3(col)}${row + 1}`;
7793
7832
  }
7833
+ function quoteSheetName(name) {
7834
+ if (/[^A-Za-z0-9_]/.test(name) || /^\d/.test(name)) {
7835
+ return `'${name.replace(/'/g, "''")}'`;
7836
+ }
7837
+ return name;
7838
+ }
7839
+ function toSheetA1(row, col, sheetName) {
7840
+ return `${quoteSheetName(sheetName)}!${colToLetter3(col)}${row + 1}`;
7841
+ }
7794
7842
  function parseCellAddress(ref) {
7795
7843
  const match = ref.match(CELL_ADDRESS_REGEX);
7796
7844
  if (!match) return null;
@@ -13217,6 +13265,15 @@ __export(chart_bridge_exports, {
13217
13265
  createChartBridge: () => createChartBridge,
13218
13266
  initChartWasm: () => initChartWasm
13219
13267
  });
13268
+ function normalizeAxisForRendering(axis) {
13269
+ const normAxis = (a) => a ? { ...a, type: a.type ?? a.axisType, show: a.show ?? a.visible } : a;
13270
+ return {
13271
+ ...axis,
13272
+ xAxis: normAxis(axis.categoryAxis ?? axis.xAxis),
13273
+ yAxis: normAxis(axis.valueAxis ?? axis.yAxis),
13274
+ secondaryYAxis: normAxis(axis.secondaryValueAxis ?? axis.secondaryYAxis)
13275
+ };
13276
+ }
13220
13277
  function toChartConfig(chart) {
13221
13278
  return {
13222
13279
  type: chart.chartType ?? "bar",
@@ -13231,12 +13288,13 @@ function toChartConfig(chart) {
13231
13288
  title: chart.title,
13232
13289
  subtitle: chart.subtitle,
13233
13290
  legend: chart.legend,
13234
- axis: chart.axis,
13291
+ axis: chart.axis ? normalizeAxisForRendering(chart.axis) : chart.axis,
13235
13292
  colors: chart.colors,
13236
13293
  series: chart.series,
13237
13294
  dataLabels: chart.dataLabels,
13238
13295
  pieSlice: chart.pieSlice,
13239
- trendline: chart.trendline,
13296
+ trendline: Array.isArray(chart.trendline) ? chart.trendline[0] : chart.trendline,
13297
+ trendlines: chart.trendline,
13240
13298
  showLines: chart.showLines,
13241
13299
  smoothLines: chart.smoothLines,
13242
13300
  radarFilled: chart.radarFilled,
@@ -13252,7 +13310,7 @@ function toChartConfig(chart) {
13252
13310
  splitType: chart.splitType,
13253
13311
  splitValue: chart.splitValue,
13254
13312
  subType: chart.subType,
13255
- extra: chart.definition
13313
+ extra: chart.ooxml
13256
13314
  };
13257
13315
  }
13258
13316
  function initChartWasm(exports) {
@@ -13650,7 +13708,7 @@ var init_chart_bridge = __esm({
13650
13708
  type: "nominal"
13651
13709
  };
13652
13710
  }
13653
- const chartTitle = chart.definition && typeof chart.definition === "object" ? chart.definition.chartTitle : void 0;
13711
+ const chartTitle = chart.ooxml && typeof chart.ooxml === "object" ? chart.ooxml.chartTitle : void 0;
13654
13712
  let titleSpec;
13655
13713
  if (chart.title) {
13656
13714
  titleSpec = {
@@ -13692,7 +13750,7 @@ var init_chart_bridge = __esm({
13692
13750
  if (chart.colors && chart.colors.length > 0) {
13693
13751
  specConfig.range = { category: chart.colors };
13694
13752
  }
13695
- const chartArea = chart.definition && typeof chart.definition === "object" ? chart.definition.chartArea : void 0;
13753
+ const chartArea = chart.ooxml && typeof chart.ooxml === "object" ? chart.ooxml.chartArea : void 0;
13696
13754
  if (chartArea?.fill && typeof chartArea.fill === "object") {
13697
13755
  specConfig.background = chartArea.fill.color;
13698
13756
  }
@@ -15717,10 +15775,11 @@ var init_cell_properties = __esm({
15717
15775
  });
15718
15776
 
15719
15777
  // ../../kernel/src/api/internal/value-conversions.ts
15720
- function viewportCellValueToCellValue(cv) {
15778
+ function normalizeCellValue(cv) {
15779
+ if (cv !== null && isCellError(cv)) return errorDisplayString(cv.value);
15721
15780
  return cv;
15722
15781
  }
15723
- function viewportCellValueToString(cv) {
15782
+ function cellValueToString(cv) {
15724
15783
  if (cv === null || cv === void 0) return "";
15725
15784
  if (typeof cv === "string") return cv;
15726
15785
  if (typeof cv === "number") return String(cv);
@@ -15884,15 +15943,14 @@ function buildBaseFields(data) {
15884
15943
  name: data.name,
15885
15944
  visible: data.visible,
15886
15945
  groupId: data.groupId,
15887
- altText: data.altText,
15946
+ altText: "altText" in data ? data.altText : void 0,
15888
15947
  createdAt: data.createdAt,
15889
15948
  updatedAt: data.updatedAt
15890
15949
  };
15891
15950
  }
15892
- function toShapeObject(data) {
15893
- const d = data;
15951
+ function toShapeObject(d) {
15894
15952
  return {
15895
- ...buildBaseFields(data),
15953
+ ...buildBaseFields(d),
15896
15954
  type: "shape",
15897
15955
  shapeType: d.shapeType ?? "rect",
15898
15956
  fill: d.fill,
@@ -15902,10 +15960,9 @@ function toShapeObject(data) {
15902
15960
  adjustments: d.adjustments
15903
15961
  };
15904
15962
  }
15905
- function toPictureObject(data) {
15906
- const d = data;
15963
+ function toPictureObject(d) {
15907
15964
  return {
15908
- ...buildBaseFields(data),
15965
+ ...buildBaseFields(d),
15909
15966
  type: "picture",
15910
15967
  src: d.src ?? "",
15911
15968
  originalWidth: d.originalWidth ?? 0,
@@ -15914,10 +15971,9 @@ function toPictureObject(data) {
15914
15971
  adjustments: d.adjustments
15915
15972
  };
15916
15973
  }
15917
- function toTextBoxObject(data) {
15918
- const d = data;
15974
+ function toTextBoxObject(d) {
15919
15975
  return {
15920
- ...buildBaseFields(data),
15976
+ ...buildBaseFields(d),
15921
15977
  type: "textbox",
15922
15978
  content: d.content ?? "",
15923
15979
  defaultFormat: d.defaultFormat,
@@ -15928,10 +15984,9 @@ function toTextBoxObject(data) {
15928
15984
  wordArt: d.wordArt
15929
15985
  };
15930
15986
  }
15931
- function toConnectorObject(data) {
15932
- const d = data;
15987
+ function toConnectorObject(d) {
15933
15988
  return {
15934
- ...buildBaseFields(data),
15989
+ ...buildBaseFields(d),
15935
15990
  type: "connector",
15936
15991
  shapeType: d.shapeType ?? "connector",
15937
15992
  startConnection: d.startConnection,
@@ -15940,8 +15995,7 @@ function toConnectorObject(data) {
15940
15995
  outline: d.outline
15941
15996
  };
15942
15997
  }
15943
- function toChartObject(data) {
15944
- const d = data;
15998
+ function toChartObject(d) {
15945
15999
  const chartConfig = {
15946
16000
  subType: d.subType,
15947
16001
  seriesOrientation: d.seriesOrientation,
@@ -15970,41 +16024,38 @@ function toChartObject(data) {
15970
16024
  tableCategoryColumn: d.tableCategoryColumn,
15971
16025
  useTableColumnNamesAsLabels: d.useTableColumnNamesAsLabels,
15972
16026
  tableColumnNames: d.tableColumnNames,
15973
- definition: d.definition,
15974
16027
  ooxml: d.ooxml
15975
16028
  };
15976
16029
  return {
15977
- ...buildBaseFields(data),
16030
+ ...buildBaseFields(d),
15978
16031
  type: "chart",
15979
16032
  chartType: d.chartType ?? "column",
15980
- anchorMode: data.anchor.anchorMode === "twoCell" ? "twoCell" : "oneCell",
15981
- widthCells: d.widthCells ?? data.width ?? 8,
15982
- heightCells: d.heightCells ?? data.height ?? 15,
16033
+ anchorMode: d.anchor.anchorMode === "twoCell" ? "twoCell" : "oneCell",
16034
+ widthCells: d.widthCells ?? d.width ?? 8,
16035
+ heightCells: d.heightCells ?? d.height ?? 15,
15983
16036
  chartConfig,
15984
16037
  dataRangeIdentity: d.dataRangeIdentity,
15985
16038
  seriesRangeIdentity: d.seriesRangeIdentity,
15986
16039
  categoryRangeIdentity: d.categoryRangeIdentity
15987
16040
  };
15988
16041
  }
15989
- function toEquationObject(data) {
15990
- const d = data;
16042
+ function toEquationObject(d) {
16043
+ const equation = typeof d.equation === "string" ? { id: d.id, omml: d.equation } : d.equation;
15991
16044
  return {
15992
- ...buildBaseFields(data),
16045
+ ...buildBaseFields(d),
15993
16046
  type: "equation",
15994
- equation: d.equation
16047
+ equation
15995
16048
  };
15996
16049
  }
15997
- function toSmartArtObject(data) {
15998
- const d = data;
16050
+ function toSmartArtObject(d) {
15999
16051
  return {
16000
- ...buildBaseFields(data),
16052
+ ...buildBaseFields(d),
16001
16053
  type: "smartart",
16002
16054
  diagram: d.definition ?? {}
16003
16055
  };
16004
16056
  }
16005
- function toDrawingObject(data) {
16006
- const common = buildBaseFields(data);
16007
- const d = data;
16057
+ function toDrawingObject(d) {
16058
+ const common = buildBaseFields(d);
16008
16059
  const strokes = /* @__PURE__ */ new Map();
16009
16060
  if (d.strokes) {
16010
16061
  for (const [id, stroke] of Object.entries(d.strokes)) {
@@ -16029,10 +16080,9 @@ function toDrawingObject(data) {
16029
16080
  backgroundColor: d.backgroundColor
16030
16081
  };
16031
16082
  }
16032
- function toOleObjectObject(data) {
16033
- const d = data;
16083
+ function toOleObjectObject(d) {
16034
16084
  return {
16035
- ...buildBaseFields(data),
16085
+ ...buildBaseFields(d),
16036
16086
  type: "oleObject",
16037
16087
  progId: d.progId ?? "",
16038
16088
  dvAspect: d.dvAspect ?? "content",
@@ -16043,8 +16093,7 @@ function toOleObjectObject(data) {
16043
16093
  };
16044
16094
  }
16045
16095
  function toFloatingObject(data) {
16046
- const objectType = data.type ?? "shape";
16047
- switch (objectType) {
16096
+ switch (data.type) {
16048
16097
  case "shape":
16049
16098
  return toShapeObject(data);
16050
16099
  case "picture":
@@ -16064,10 +16113,43 @@ function toFloatingObject(data) {
16064
16113
  case "drawing":
16065
16114
  return toDrawingObject(data);
16066
16115
  case "slicer":
16067
- default:
16068
- return toShapeObject({ ...data, type: "shape" });
16116
+ case "camera":
16117
+ case "formControl":
16118
+ default: {
16119
+ const fallback = Object.assign({}, data, { type: "shape" });
16120
+ return toShapeObject(fallback);
16121
+ }
16069
16122
  }
16070
16123
  }
16124
+ function createMinimalFloatingObject(type, id, sheetId, extras) {
16125
+ const wire = {
16126
+ id,
16127
+ sheetId,
16128
+ type,
16129
+ anchor: {
16130
+ anchorRow: 0,
16131
+ anchorCol: 0,
16132
+ anchorRowOffset: 0,
16133
+ anchorColOffset: 0,
16134
+ anchorMode: "absolute"
16135
+ },
16136
+ width: 100,
16137
+ height: 100,
16138
+ zIndex: 0,
16139
+ rotation: 0,
16140
+ flipH: false,
16141
+ flipV: false,
16142
+ locked: false,
16143
+ visible: true,
16144
+ printable: true,
16145
+ opacity: 1,
16146
+ name: "",
16147
+ createdAt: 0,
16148
+ updatedAt: 0,
16149
+ ...extras
16150
+ };
16151
+ return toFloatingObject(wire);
16152
+ }
16071
16153
  var init_floating_object_mapper = __esm({
16072
16154
  "../../kernel/src/bridges/compute/floating-object-mapper.ts"() {
16073
16155
  "use strict";
@@ -25191,7 +25273,7 @@ var init_pivot_bridge = __esm({
25191
25273
  expandedColumns: {}
25192
25274
  };
25193
25275
  try {
25194
- const result = await this.ctx.computeBridge.pivotComputeFromSource(
25276
+ const result = await this.ctx.computeBridge.pivotMaterialize(
25195
25277
  sheetId,
25196
25278
  pivotId,
25197
25279
  expansionState ?? null
@@ -25395,7 +25477,7 @@ var init_pivot_bridge = __esm({
25395
25477
  const rowData = [];
25396
25478
  for (let col = range2.startCol; col <= range2.endCol; col++) {
25397
25479
  const cell = cellMap.get(`${row},${col}`);
25398
- rowData.push(cell ? viewportCellValueToCellValue(cell.value) ?? null : null);
25480
+ rowData.push(cell ? normalizeCellValue(cell.value) ?? null : null);
25399
25481
  }
25400
25482
  data.push(rowData);
25401
25483
  }
@@ -78836,22 +78918,18 @@ async function batchGetCellPositions(ctx, sheetId, cellIds) {
78836
78918
 
78837
78919
  // ../../kernel/src/api/worksheet/operations/dependency-operations.ts
78838
78920
  init_esm_shims();
78839
- function colToLetter4(col) {
78840
- let result = "";
78841
- let c = col;
78842
- while (c >= 0) {
78843
- result = String.fromCharCode(c % 26 + 65) + result;
78844
- c = Math.floor(c / 26) - 1;
78845
- }
78846
- return result;
78847
- }
78921
+ init_a1();
78848
78922
  async function getDependents(ctx, sheetId, row, col) {
78849
78923
  const results = await ctx.computeBridge.getDependents(sheetId, row, col);
78850
- return results.map((r) => `${colToLetter4(r.col)}${r.row + 1}`);
78924
+ return results.map(
78925
+ (r) => r.sheetId === sheetId ? toA12(r.row, r.col) : toSheetA1(r.row, r.col, r.sheetName)
78926
+ );
78851
78927
  }
78852
78928
  async function getPrecedents(ctx, sheetId, row, col) {
78853
78929
  const results = await ctx.computeBridge.getPrecedents(sheetId, row, col);
78854
- return results.map((r) => `${colToLetter4(r.col)}${r.row + 1}`);
78930
+ return results.map(
78931
+ (r) => r.sheetId === sheetId ? toA12(r.row, r.col) : toSheetA1(r.row, r.col, r.sheetName)
78932
+ );
78855
78933
  }
78856
78934
 
78857
78935
  // ../../kernel/src/api/worksheet/operations/fill-operations.ts
@@ -79172,7 +79250,7 @@ async function findCells(ctx, sheetId, predicate) {
79172
79250
  const results = [];
79173
79251
  for (const cell of rangeResult.cells) {
79174
79252
  const cellData = {
79175
- value: viewportCellValueToCellValue(cell.value),
79253
+ value: normalizeCellValue(cell.value),
79176
79254
  formula: cell.formula
79177
79255
  };
79178
79256
  if (predicate(cellData, cell.row, cell.col)) {
@@ -79225,18 +79303,18 @@ async function regexSearch(ctx, sheetId, patterns, options) {
79225
79303
  bounds.maxCol
79226
79304
  );
79227
79305
  for (const cell of rangeResult.cells) {
79228
- const valueStr = cell.formatted ?? viewportCellValueToString(cell.value);
79306
+ const valueStr = cell.formatted ?? cellValueToString(cell.value);
79229
79307
  for (const { regex, source } of compiledPatterns) {
79230
79308
  regex.lastIndex = 0;
79231
79309
  if (regex.test(valueStr)) {
79232
- const address = `${colToLetter3(cell.col)}${cell.row + 1}`;
79310
+ const address = toA12(cell.row, cell.col);
79233
79311
  results.push({ address, value: valueStr, sheetName, matchedPattern: source });
79234
79312
  break;
79235
79313
  }
79236
79314
  if (options?.includeFormulas && cell.formula) {
79237
79315
  regex.lastIndex = 0;
79238
79316
  if (regex.test(cell.formula)) {
79239
- const address = `${colToLetter3(cell.col)}${cell.row + 1}`;
79317
+ const address = toA12(cell.row, cell.col);
79240
79318
  results.push({ address, value: valueStr, sheetName, matchedPattern: source });
79241
79319
  break;
79242
79320
  }
@@ -79269,9 +79347,9 @@ async function getRangeWithIdentity(ctx, sheetId, startRow, startCol, endRow, en
79269
79347
  cellId: cell.cellId,
79270
79348
  row: cell.row,
79271
79349
  col: cell.col,
79272
- value: viewportCellValueToCellValue(cell.value),
79350
+ value: normalizeCellValue(cell.value),
79273
79351
  formulaText: cell.formula,
79274
- displayString: cell.formatted ?? viewportCellValueToString(cell.value)
79352
+ displayString: cell.formatted ?? cellValueToString(cell.value)
79275
79353
  }));
79276
79354
  }
79277
79355
 
@@ -79300,7 +79378,7 @@ async function getRange(ctx, sheetId, range2) {
79300
79378
  if (!cell) {
79301
79379
  rowData.push({ value: null });
79302
79380
  } else {
79303
- const value = viewportCellValueToCellValue(cell.value);
79381
+ const value = normalizeCellValue(cell.value);
79304
79382
  rowData.push({
79305
79383
  value: value ?? null,
79306
79384
  formula: cell.formula,
@@ -79482,7 +79560,7 @@ async function getDisplayText(ctx, sheetId, range2) {
79482
79560
  if (!cell) {
79483
79561
  rowData.push("");
79484
79562
  } else {
79485
- rowData.push(cell.formatted ?? viewportCellValueToString(cell.value));
79563
+ rowData.push(cell.formatted ?? cellValueToString(cell.value));
79486
79564
  }
79487
79565
  }
79488
79566
  result.push(rowData);
@@ -79510,7 +79588,7 @@ async function getValueTypes(ctx, sheetId, range2) {
79510
79588
  if (!cell) {
79511
79589
  rowData.push(RangeValueType2.Empty);
79512
79590
  } else {
79513
- rowData.push(classifyValueType(viewportCellValueToCellValue(cell.value)));
79591
+ rowData.push(classifyValueType(normalizeCellValue(cell.value)));
79514
79592
  }
79515
79593
  }
79516
79594
  result.push(rowData);
@@ -79519,7 +79597,11 @@ async function getValueTypes(ctx, sheetId, range2) {
79519
79597
  }
79520
79598
  function classifyValueType(value) {
79521
79599
  if (value === null || value === void 0) return RangeValueType2.Empty;
79522
- if (typeof value === "string") return value === "" ? RangeValueType2.Empty : RangeValueType2.String;
79600
+ if (typeof value === "string") {
79601
+ if (value === "") return RangeValueType2.Empty;
79602
+ if (value.startsWith("#")) return RangeValueType2.Error;
79603
+ return RangeValueType2.String;
79604
+ }
79523
79605
  if (typeof value === "number") return RangeValueType2.Double;
79524
79606
  if (typeof value === "boolean") return RangeValueType2.Boolean;
79525
79607
  if (typeof value === "object" && value !== null && "type" in value) return RangeValueType2.Error;
@@ -79545,7 +79627,7 @@ async function findInRange(ctx, sheetId, range2, text, options) {
79545
79627
  n.endCol
79546
79628
  );
79547
79629
  for (const cell of rangeResult.cells) {
79548
- const valueStr = cell.formatted ?? viewportCellValueToString(cell.value);
79630
+ const valueStr = cell.formatted ?? cellValueToString(cell.value);
79549
79631
  if (pattern.test(valueStr)) {
79550
79632
  return {
79551
79633
  address: `${colToLetter3(cell.col)}${cell.row + 1}`,
@@ -79577,7 +79659,7 @@ async function replaceAll(ctx, sheetId, range2, text, replacement, options) {
79577
79659
  const edits = [];
79578
79660
  for (const cell of rangeResult.cells) {
79579
79661
  if (cell.formula) continue;
79580
- const valueStr = viewportCellValueToString(cell.value);
79662
+ const valueStr = cellValueToString(cell.value);
79581
79663
  if (!valueStr) continue;
79582
79664
  pattern.lastIndex = 0;
79583
79665
  if (pattern.test(valueStr)) {
@@ -79702,9 +79784,18 @@ init_esm_shims();
79702
79784
  // ../../kernel/src/api/worksheet/collections/object-collection-impl.ts
79703
79785
  init_esm_shims();
79704
79786
 
79787
+ // ../../kernel/src/api/worksheet/handles/floating-object-handle-factory.ts
79788
+ init_esm_shims();
79789
+
79705
79790
  // ../../kernel/src/api/worksheet/handles/floating-object-handle-impl.ts
79706
79791
  init_esm_shims();
79707
79792
  init_errors();
79793
+ function narrowHandle(handle, expected) {
79794
+ if (handle.type !== expected) {
79795
+ throw new KernelError("OPERATION_FAILED", `Expected ${expected}, got ${handle.type}`);
79796
+ }
79797
+ return handle;
79798
+ }
79708
79799
  var FloatingObjectHandleImpl = class _FloatingObjectHandleImpl {
79709
79800
  constructor(id, type, objectsImpl, boundsReader) {
79710
79801
  this.id = id;
@@ -79751,11 +79842,11 @@ var FloatingObjectHandleImpl = class _FloatingObjectHandleImpl {
79751
79842
  return this.boundsReader?.getBounds(this.id) ?? null;
79752
79843
  }
79753
79844
  async getData() {
79754
- const info = await this.objectsImpl.get(this.id);
79755
- if (!info) throw new KernelError("OPERATION_FAILED", `Object ${this.id} not found`);
79756
- return info;
79845
+ const obj = await this.objectsImpl.getFullObject(this.id);
79846
+ if (!obj) throw new KernelError("OPERATION_FAILED", `Object ${this.id} not found`);
79847
+ return obj;
79757
79848
  }
79758
- // -- Type narrowing --
79849
+ // -- Type narrowing (is* predicates) --
79759
79850
  isShape() {
79760
79851
  return this.type === "shape";
79761
79852
  }
@@ -79792,58 +79883,43 @@ var FloatingObjectHandleImpl = class _FloatingObjectHandleImpl {
79792
79883
  isSlicer() {
79793
79884
  return this.type === "slicer";
79794
79885
  }
79795
- /** @internal Throw if this handle's type doesn't match expected. */
79796
- assertType(expected) {
79797
- if (this.type !== expected) {
79798
- throw new KernelError("OPERATION_FAILED", `Expected ${expected}, got ${this.type}`);
79799
- }
79800
- }
79886
+ /**
79887
+ * Type-checked narrowing — throws if this handle's type does not match.
79888
+ * The factory (createFloatingObjectHandle) guarantees that when type === 'shape',
79889
+ * `this` is a ShapeHandleImpl which implements ShapeHandle, etc.
79890
+ */
79801
79891
  asShape() {
79802
- this.assertType("shape");
79803
- return this;
79892
+ return narrowHandle(this, "shape");
79804
79893
  }
79805
79894
  asPicture() {
79806
- this.assertType("picture");
79807
- return this;
79895
+ return narrowHandle(this, "picture");
79808
79896
  }
79809
79897
  asTextBox() {
79810
- this.assertType("textbox");
79811
- return this;
79898
+ return narrowHandle(this, "textbox");
79812
79899
  }
79813
79900
  asDrawing() {
79814
- this.assertType("drawing");
79815
- return this;
79901
+ return narrowHandle(this, "drawing");
79816
79902
  }
79817
79903
  asEquation() {
79818
- this.assertType("equation");
79819
- return this;
79904
+ return narrowHandle(this, "equation");
79820
79905
  }
79821
79906
  asWordArt() {
79822
- this.assertType("wordart");
79823
- return this;
79907
+ throw new KernelError("OPERATION_FAILED", `Expected wordart, got ${this.type}`);
79824
79908
  }
79825
79909
  asSmartArt() {
79826
- this.assertType("smartart");
79827
- return this;
79910
+ return narrowHandle(this, "smartart");
79828
79911
  }
79829
79912
  asChart() {
79830
- this.assertType("chart");
79831
- return this;
79832
- }
79833
- asCamera() {
79834
- throw new KernelError("OPERATION_FAILED", "Camera objects are no longer supported");
79913
+ return narrowHandle(this, "chart");
79835
79914
  }
79836
79915
  asConnector() {
79837
- this.assertType("connector");
79838
- return this;
79916
+ return narrowHandle(this, "connector");
79839
79917
  }
79840
79918
  asOleObject() {
79841
- this.assertType("oleObject");
79842
- return this;
79919
+ return narrowHandle(this, "oleObject");
79843
79920
  }
79844
79921
  asSlicer() {
79845
- this.assertType("slicer");
79846
- return this;
79922
+ return narrowHandle(this, "slicer");
79847
79923
  }
79848
79924
  };
79849
79925
 
@@ -79863,9 +79939,9 @@ var ShapeHandleImpl = class _ShapeHandleImpl extends FloatingObjectHandleImpl {
79863
79939
  return new _ShapeHandleImpl(receipt.id, this.shapeType, this.objectsImpl, this.boundsReader);
79864
79940
  }
79865
79941
  async getData() {
79866
- const shape = await this.objectsImpl.getShape(this.id);
79867
- if (!shape) throw new KernelError("OPERATION_FAILED", `Shape ${this.id} not found`);
79868
- return shape;
79942
+ const obj = await this.objectsImpl.getFullObject(this.id);
79943
+ if (!obj || obj.type !== "shape") throw new KernelError("OPERATION_FAILED", `Shape ${this.id} not found`);
79944
+ return obj;
79869
79945
  }
79870
79946
  };
79871
79947
 
@@ -79884,9 +79960,9 @@ var PictureHandleImpl = class _PictureHandleImpl extends FloatingObjectHandleImp
79884
79960
  return new _PictureHandleImpl(receipt.id, this.objectsImpl, this.boundsReader);
79885
79961
  }
79886
79962
  async getData() {
79887
- const info = await this.objectsImpl.get(this.id);
79888
- if (!info) throw new KernelError("OPERATION_FAILED", `Picture ${this.id} not found`);
79889
- return info;
79963
+ const obj = await this.objectsImpl.getFullObject(this.id);
79964
+ if (!obj || obj.type !== "picture") throw new KernelError("OPERATION_FAILED", `Picture ${this.id} not found`);
79965
+ return obj;
79890
79966
  }
79891
79967
  };
79892
79968
 
@@ -79905,9 +79981,9 @@ var TextBoxHandleImpl = class _TextBoxHandleImpl extends FloatingObjectHandleImp
79905
79981
  return new _TextBoxHandleImpl(receipt.id, this.objectsImpl, this.boundsReader);
79906
79982
  }
79907
79983
  async getData() {
79908
- const info = await this.objectsImpl.get(this.id);
79909
- if (!info) throw new KernelError("OPERATION_FAILED", `TextBox ${this.id} not found`);
79910
- return info;
79984
+ const obj = await this.objectsImpl.getFullObject(this.id);
79985
+ if (!obj || obj.type !== "textbox") throw new KernelError("OPERATION_FAILED", `TextBox ${this.id} not found`);
79986
+ return obj;
79911
79987
  }
79912
79988
  };
79913
79989
 
@@ -79962,9 +80038,9 @@ var EquationHandleImpl = class _EquationHandleImpl extends FloatingObjectHandleI
79962
80038
  return new _EquationHandleImpl(receipt.id, this.objectsImpl, this.boundsReader);
79963
80039
  }
79964
80040
  async getData() {
79965
- const info = await this.objectsImpl.get(this.id);
79966
- if (!info) throw new KernelError("OPERATION_FAILED", `Equation ${this.id} not found`);
79967
- return info;
80041
+ const obj = await this.objectsImpl.getFullObject(this.id);
80042
+ if (!obj || obj.type !== "equation") throw new KernelError("OPERATION_FAILED", `Equation ${this.id} not found`);
80043
+ return obj;
79968
80044
  }
79969
80045
  };
79970
80046
 
@@ -79983,9 +80059,9 @@ var ConnectorHandleImpl = class _ConnectorHandleImpl extends FloatingObjectHandl
79983
80059
  return new _ConnectorHandleImpl(receipt.id, this.objectsImpl, this.boundsReader);
79984
80060
  }
79985
80061
  async getData() {
79986
- const info = await this.objectsImpl.get(this.id);
79987
- if (!info) throw new KernelError("OPERATION_FAILED", `Connector ${this.id} not found`);
79988
- return info;
80062
+ const obj = await this.objectsImpl.getFullObject(this.id);
80063
+ if (!obj || obj.type !== "connector") throw new KernelError("OPERATION_FAILED", `Connector ${this.id} not found`);
80064
+ return obj;
79989
80065
  }
79990
80066
  };
79991
80067
 
@@ -80001,9 +80077,9 @@ var ChartHandleImpl = class _ChartHandleImpl extends FloatingObjectHandleImpl {
80001
80077
  return new _ChartHandleImpl(receipt.id, this.objectsImpl, this.boundsReader);
80002
80078
  }
80003
80079
  async getData() {
80004
- const info = await this.objectsImpl.get(this.id);
80005
- if (!info) throw new KernelError("OPERATION_FAILED", `Chart ${this.id} not found`);
80006
- return info;
80080
+ const obj = await this.objectsImpl.getFullObject(this.id);
80081
+ if (!obj || obj.type !== "chart") throw new KernelError("OPERATION_FAILED", `Chart ${this.id} not found`);
80082
+ return obj;
80007
80083
  }
80008
80084
  };
80009
80085
 
@@ -80019,9 +80095,9 @@ var SmartArtHandleImpl = class _SmartArtHandleImpl extends FloatingObjectHandleI
80019
80095
  return new _SmartArtHandleImpl(receipt.id, this.objectsImpl, this.boundsReader);
80020
80096
  }
80021
80097
  async getData() {
80022
- const info = await this.objectsImpl.get(this.id);
80023
- if (!info) throw new KernelError("OPERATION_FAILED", `SmartArt ${this.id} not found`);
80024
- return info;
80098
+ const obj = await this.objectsImpl.getFullObject(this.id);
80099
+ if (!obj || obj.type !== "smartart") throw new KernelError("OPERATION_FAILED", `SmartArt ${this.id} not found`);
80100
+ return obj;
80025
80101
  }
80026
80102
  };
80027
80103
 
@@ -80037,9 +80113,9 @@ var SlicerHandleImpl = class _SlicerHandleImpl extends FloatingObjectHandleImpl
80037
80113
  return new _SlicerHandleImpl(receipt.id, this.objectsImpl, this.boundsReader);
80038
80114
  }
80039
80115
  async getData() {
80040
- const info = await this.objectsImpl.get(this.id);
80041
- if (!info) throw new KernelError("OPERATION_FAILED", `Slicer ${this.id} not found`);
80042
- return info;
80116
+ const obj = await this.objectsImpl.getFullObject(this.id);
80117
+ if (!obj) throw new KernelError("OPERATION_FAILED", `Slicer ${this.id} not found`);
80118
+ return obj;
80043
80119
  }
80044
80120
  };
80045
80121
 
@@ -80055,12 +80131,50 @@ var OleObjectHandleImpl = class _OleObjectHandleImpl extends FloatingObjectHandl
80055
80131
  return new _OleObjectHandleImpl(receipt.id, this.objectsImpl, this.boundsReader);
80056
80132
  }
80057
80133
  async getData() {
80058
- const info = await this.objectsImpl.get(this.id);
80059
- if (!info) throw new KernelError("OPERATION_FAILED", `OleObject ${this.id} not found`);
80060
- return info;
80134
+ const obj = await this.objectsImpl.getFullObject(this.id);
80135
+ if (!obj || obj.type !== "oleObject") throw new KernelError("OPERATION_FAILED", `OleObject ${this.id} not found`);
80136
+ return obj;
80061
80137
  }
80062
80138
  };
80063
80139
 
80140
+ // ../../kernel/src/api/worksheet/handles/floating-object-handle-factory.ts
80141
+ function createFloatingObjectHandle(id, type, objectsImpl, boundsReader, shapeType) {
80142
+ switch (type) {
80143
+ case "shape":
80144
+ return new ShapeHandleImpl(
80145
+ id,
80146
+ shapeType ?? "rect",
80147
+ objectsImpl,
80148
+ boundsReader
80149
+ );
80150
+ case "picture":
80151
+ return new PictureHandleImpl(id, objectsImpl, boundsReader);
80152
+ case "textbox":
80153
+ return new TextBoxHandleImpl(id, objectsImpl, boundsReader);
80154
+ case "drawing":
80155
+ return new DrawingHandleImpl(id, objectsImpl, boundsReader);
80156
+ case "equation":
80157
+ return new EquationHandleImpl(id, objectsImpl, boundsReader);
80158
+ case "connector":
80159
+ return new ConnectorHandleImpl(id, objectsImpl, boundsReader);
80160
+ case "chart":
80161
+ return new ChartHandleImpl(id, objectsImpl, boundsReader);
80162
+ case "smartart":
80163
+ return new SmartArtHandleImpl(id, objectsImpl, boundsReader);
80164
+ case "slicer":
80165
+ return new SlicerHandleImpl(id, objectsImpl, boundsReader);
80166
+ case "oleObject":
80167
+ return new OleObjectHandleImpl(id, objectsImpl, boundsReader);
80168
+ default:
80169
+ return new FloatingObjectHandleImpl(
80170
+ id,
80171
+ type,
80172
+ objectsImpl,
80173
+ boundsReader
80174
+ );
80175
+ }
80176
+ }
80177
+
80064
80178
  // ../../kernel/src/api/worksheet/collections/object-collection-impl.ts
80065
80179
  var WorksheetObjectCollectionImpl = class {
80066
80180
  constructor(objectsImpl, boundsReader) {
@@ -80129,30 +80243,7 @@ var WorksheetObjectCollectionImpl = class {
80129
80243
  return this.objectsImpl.ungroup(groupId);
80130
80244
  }
80131
80245
  createHandle(id, type) {
80132
- switch (type) {
80133
- case "shape":
80134
- return new ShapeHandleImpl(id, "rect", this.objectsImpl, this.boundsReader);
80135
- case "picture":
80136
- return new PictureHandleImpl(id, this.objectsImpl, this.boundsReader);
80137
- case "textbox":
80138
- return new TextBoxHandleImpl(id, this.objectsImpl, this.boundsReader);
80139
- case "drawing":
80140
- return new DrawingHandleImpl(id, this.objectsImpl, this.boundsReader);
80141
- case "equation":
80142
- return new EquationHandleImpl(id, this.objectsImpl, this.boundsReader);
80143
- case "connector":
80144
- return new ConnectorHandleImpl(id, this.objectsImpl, this.boundsReader);
80145
- case "chart":
80146
- return new ChartHandleImpl(id, this.objectsImpl, this.boundsReader);
80147
- case "smartart":
80148
- return new SmartArtHandleImpl(id, this.objectsImpl, this.boundsReader);
80149
- case "slicer":
80150
- return new SlicerHandleImpl(id, this.objectsImpl, this.boundsReader);
80151
- case "oleObject":
80152
- return new OleObjectHandleImpl(id, this.objectsImpl, this.boundsReader);
80153
- default:
80154
- return new FloatingObjectHandleImpl(id, type, this.objectsImpl, this.boundsReader);
80155
- }
80246
+ return createFloatingObjectHandle(id, type, this.objectsImpl, this.boundsReader);
80156
80247
  }
80157
80248
  };
80158
80249
 
@@ -80300,9 +80391,9 @@ var WordArtHandleImpl = class _WordArtHandleImpl extends FloatingObjectHandleImp
80300
80391
  return new _WordArtHandleImpl(receipt.id, this.objectsImpl, this.boundsReader);
80301
80392
  }
80302
80393
  async getData() {
80303
- const info = await this.objectsImpl.get(this.id);
80304
- if (!info) throw new KernelError("OPERATION_FAILED", `WordArt ${this.id} not found`);
80305
- return info;
80394
+ const obj = await this.objectsImpl.getFullObject(this.id);
80395
+ if (!obj || obj.type !== "textbox") throw new KernelError("OPERATION_FAILED", `WordArt ${this.id} not found`);
80396
+ return obj;
80306
80397
  }
80307
80398
  };
80308
80399
 
@@ -80580,7 +80671,7 @@ function chartConfigToInternal(config) {
80580
80671
  series: config.series,
80581
80672
  dataLabels: config.dataLabels,
80582
80673
  pieSlice: config.pieSlice,
80583
- trendline: config.trendline,
80674
+ trendline: config.trendlines ?? (config.trendline ? [config.trendline] : void 0),
80584
80675
  showLines: config.showLines,
80585
80676
  smoothLines: config.smoothLines,
80586
80677
  radarFilled: config.radarFilled,
@@ -80597,7 +80688,7 @@ function chartConfigToInternal(config) {
80597
80688
  splitValue: config.splitValue,
80598
80689
  widthCells: config.width,
80599
80690
  heightCells: config.height,
80600
- definition: buildStatisticalExtra(config)
80691
+ ooxml: buildStatisticalExtra(config)
80601
80692
  };
80602
80693
  }
80603
80694
  function chartUpdatesToInternal(updates) {
@@ -80624,7 +80715,11 @@ function chartUpdatesToInternal(updates) {
80624
80715
  if (updates.series !== void 0) result.series = updates.series;
80625
80716
  if (updates.dataLabels !== void 0) result.dataLabels = updates.dataLabels;
80626
80717
  if (updates.pieSlice !== void 0) result.pieSlice = updates.pieSlice;
80627
- if (updates.trendline !== void 0) result.trendline = updates.trendline;
80718
+ if (updates.trendlines !== void 0) {
80719
+ result.trendline = updates.trendlines;
80720
+ } else if (updates.trendline !== void 0) {
80721
+ result.trendline = updates.trendline ? [updates.trendline] : void 0;
80722
+ }
80628
80723
  if (updates.showLines !== void 0) result.showLines = updates.showLines;
80629
80724
  if (updates.smoothLines !== void 0) result.smoothLines = updates.smoothLines;
80630
80725
  if (updates.radarFilled !== void 0) result.radarFilled = updates.radarFilled;
@@ -80641,7 +80736,7 @@ function chartUpdatesToInternal(updates) {
80641
80736
  if (updates.splitValue !== void 0) result.splitValue = updates.splitValue;
80642
80737
  if (updates.name !== void 0) result.name = updates.name;
80643
80738
  const statisticalExtra = buildStatisticalExtra(updates);
80644
- if (statisticalExtra) result.definition = statisticalExtra;
80739
+ if (statisticalExtra) result.ooxml = statisticalExtra;
80645
80740
  return result;
80646
80741
  }
80647
80742
  function serializedChartToChart(chart) {
@@ -80666,7 +80761,8 @@ function serializedChartToChart(chart) {
80666
80761
  series: chart.series,
80667
80762
  dataLabels: chart.dataLabels,
80668
80763
  pieSlice: chart.pieSlice,
80669
- trendline: chart.trendline,
80764
+ trendline: Array.isArray(chart.trendline) ? chart.trendline[0] : chart.trendline,
80765
+ trendlines: chart.trendline,
80670
80766
  showLines: chart.showLines,
80671
80767
  smoothLines: chart.smoothLines,
80672
80768
  radarFilled: chart.radarFilled,
@@ -80681,7 +80777,7 @@ function serializedChartToChart(chart) {
80681
80777
  bubbleScale: chart.bubbleScale,
80682
80778
  splitType: chart.splitType,
80683
80779
  splitValue: chart.splitValue,
80684
- ...unpackStatisticalExtra(chart.definition),
80780
+ ...unpackStatisticalExtra(chart.ooxml),
80685
80781
  name: chart.name || void 0,
80686
80782
  createdAt: chart.createdAt,
80687
80783
  updatedAt: chart.updatedAt
@@ -80709,7 +80805,10 @@ async function applyUpdate(ctx, sheetId, chartId, updates) {
80709
80805
  function ensurePointsArray(series, minLength) {
80710
80806
  const points = [...series.points ?? []];
80711
80807
  while (points.length <= minLength) {
80712
- points.push({});
80808
+ points.push({ idx: points.length });
80809
+ }
80810
+ for (let i = 0; i < points.length; i++) {
80811
+ points[i].idx = i;
80713
80812
  }
80714
80813
  return points;
80715
80814
  }
@@ -80936,40 +81035,6 @@ init_esm_shims();
80936
81035
  init_a1();
80937
81036
  init_compute_core();
80938
81037
  init_errors();
80939
- function cellRefToA1(cellRef) {
80940
- const parts = cellRef.split(":");
80941
- if (parts.length !== 2) return cellRef;
80942
- const col = parseInt(parts[0], 10);
80943
- const row = parseInt(parts[1], 10);
80944
- if (isNaN(col) || isNaN(row)) return cellRef;
80945
- return toA12(row, col);
80946
- }
80947
- function toApiComment(c) {
80948
- const text = c.content ?? c.runs.map((r) => r.text).join("");
80949
- return {
80950
- id: c.id,
80951
- cellId: c.cellRef,
80952
- cellAddress: cellRefToA1(c.cellRef),
80953
- author: c.author,
80954
- authorId: c.authorId,
80955
- text,
80956
- content: c.runs.length > 0 ? c.runs.map((r) => ({
80957
- text: r.text,
80958
- bold: r.bold || void 0,
80959
- italic: r.italic || void 0,
80960
- underline: r.underline || void 0,
80961
- strikethrough: r.strikethrough || void 0,
80962
- color: r.color ?? void 0,
80963
- fontName: r.fontName ?? void 0,
80964
- fontSize: r.fontSize ?? void 0
80965
- })) : void 0,
80966
- threadId: c.threadId || void 0,
80967
- parentId: c.parentId ?? void 0,
80968
- resolved: c.resolved ?? void 0,
80969
- createdAt: c.createdAt ?? 0,
80970
- modifiedAt: c.modifiedAt ?? void 0
80971
- };
80972
- }
80973
81038
  function propagateResolved(comments) {
80974
81039
  const rootResolved = /* @__PURE__ */ new Map();
80975
81040
  for (const c of comments) {
@@ -81095,7 +81160,7 @@ var WorksheetCommentsImpl = class {
81095
81160
  "addCommentByPosition: no comment returned in MutationResult.data"
81096
81161
  );
81097
81162
  }
81098
- return toApiComment(comment);
81163
+ return comment;
81099
81164
  }
81100
81165
  async update(commentId, text) {
81101
81166
  if (!text || text.trim().length === 0) {
@@ -81114,7 +81179,7 @@ var WorksheetCommentsImpl = class {
81114
81179
  }
81115
81180
  async list() {
81116
81181
  const comments = await this.ctx.computeBridge.getAllComments(this.sheetId);
81117
- return propagateResolved(comments.map(toApiComment));
81182
+ return propagateResolved(comments);
81118
81183
  }
81119
81184
  async getForCell(a, b) {
81120
81185
  const { row, col } = resolveCell(a, b);
@@ -81123,7 +81188,7 @@ var WorksheetCommentsImpl = class {
81123
81188
  row,
81124
81189
  col
81125
81190
  );
81126
- return comments.map(toApiComment);
81191
+ return comments;
81127
81192
  }
81128
81193
  async addReply(commentId, text, author) {
81129
81194
  const parent = await this.ctx.computeBridge.getComment(this.sheetId, commentId);
@@ -81140,7 +81205,7 @@ var WorksheetCommentsImpl = class {
81140
81205
  author,
81141
81206
  { parentId: commentId }
81142
81207
  );
81143
- return toApiComment(comment);
81208
+ return comment;
81144
81209
  }
81145
81210
  async getThread(commentId) {
81146
81211
  const comment = await this.ctx.computeBridge.getComment(this.sheetId, commentId);
@@ -81149,11 +81214,11 @@ var WorksheetCommentsImpl = class {
81149
81214
  }
81150
81215
  const threadId = comment.threadId ?? comment.id;
81151
81216
  const thread = await this.ctx.computeBridge.getCommentThread(this.sheetId, threadId);
81152
- return propagateResolved(thread.map(toApiComment));
81217
+ return propagateResolved(thread);
81153
81218
  }
81154
81219
  async getById(commentId) {
81155
81220
  const comment = await this.ctx.computeBridge.getComment(this.sheetId, commentId);
81156
- return comment ? toApiComment(comment) : null;
81221
+ return comment ?? null;
81157
81222
  }
81158
81223
  };
81159
81224
 
@@ -81376,18 +81441,9 @@ var WorksheetFiltersImpl = class {
81376
81441
  const filters = await this.ctx.computeBridge.getFiltersInSheet(this.sheetId);
81377
81442
  if (filters.length === 0) return null;
81378
81443
  const filter = filters[0];
81379
- const columns = /* @__PURE__ */ new Map();
81380
- if (filter.columnFilters) {
81381
- for (const [key, value] of Object.entries(filter.columnFilters)) {
81382
- const colIdx = parseInt(key, 10);
81383
- if (!isNaN(colIdx) && value) {
81384
- columns.set(colIdx, value);
81385
- }
81386
- }
81387
- }
81388
81444
  return {
81389
81445
  range: `${toA12(filter.startRow ?? 0, filter.startCol ?? 0)}:${toA12(filter.endRow ?? 0, filter.endCol ?? 0)}`,
81390
- columns
81446
+ columnFilters: filter.columnFilters ?? {}
81391
81447
  };
81392
81448
  }
81393
81449
  async getForRange(range2) {
@@ -81458,9 +81514,9 @@ var WorksheetFiltersImpl = class {
81458
81514
  async list() {
81459
81515
  const raw = await this.ctx.computeBridge.getFiltersInSheet(this.sheetId);
81460
81516
  return raw.map((f) => ({
81461
- id: f.id ?? f.filterId,
81462
- range: f.range,
81463
- columns: f.columns
81517
+ id: f.id,
81518
+ range: void 0,
81519
+ columnFilters: f.columnFilters
81464
81520
  }));
81465
81521
  }
81466
81522
  async listDetails() {
@@ -81478,13 +81534,22 @@ var WorksheetFiltersImpl = class {
81478
81534
  }
81479
81535
  async getSortState(filterId) {
81480
81536
  try {
81481
- return await this.ctx.computeBridge.getFilterSortState(this.sheetId, filterId);
81537
+ const sortState = await this.ctx.computeBridge.getFilterSortState(this.sheetId, filterId);
81538
+ if (!sortState) return null;
81539
+ return {
81540
+ column: sortState.columnCellId,
81541
+ direction: sortState.order === "asc" ? "asc" : "desc"
81542
+ };
81482
81543
  } catch {
81483
81544
  return null;
81484
81545
  }
81485
81546
  }
81486
81547
  async setSortState(filterId, state) {
81487
- await this.ctx.computeBridge.setFilterSortState(this.sheetId, filterId, state);
81548
+ await this.ctx.computeBridge.setFilterSortState(this.sheetId, filterId, {
81549
+ columnCellId: String(state.column),
81550
+ order: state.direction === "asc" ? "asc" : "desc",
81551
+ sortBy: "value"
81552
+ });
81488
81553
  }
81489
81554
  };
81490
81555
 
@@ -81518,6 +81583,25 @@ init_esm_shims();
81518
81583
 
81519
81584
  // ../../number-formats/src/constants.ts
81520
81585
  init_esm_shims();
81586
+ import {
81587
+ ACCOUNTING_FORMATS,
81588
+ CURRENCY_FORMATS,
81589
+ CURRENCY_SYMBOLS,
81590
+ DATE_FORMATS,
81591
+ DEFAULT_FORMAT_BY_TYPE,
81592
+ EXCEL_BUILTIN_FORMATS,
81593
+ FORMAT_CATEGORIES,
81594
+ FORMAT_PRESETS,
81595
+ FRACTION_FORMATS,
81596
+ GENERAL_FORMATS,
81597
+ NEGATIVE_FORMATS,
81598
+ NUMBER_FORMATS,
81599
+ PERCENTAGE_FORMATS,
81600
+ SCIENTIFIC_FORMATS,
81601
+ SPECIAL_FORMATS,
81602
+ TEXT_FORMATS,
81603
+ TIME_FORMATS
81604
+ } from "@mog-sdk/spreadsheet-contracts/number-formats/constants";
81521
81605
 
81522
81606
  // ../../number-formats/src/format-utils.ts
81523
81607
  init_esm_shims();
@@ -82860,7 +82944,12 @@ var WorksheetPivotsImpl = class _WorksheetPivotsImpl {
82860
82944
  }
82861
82945
  async queryPivot(pivotName, filters) {
82862
82946
  const pivot = await this.findPivotByName(pivotName);
82863
- if (!pivot) return null;
82947
+ if (!pivot) {
82948
+ throw new KernelError(
82949
+ "COMPUTE_ERROR",
82950
+ `queryPivot: Pivot table "${pivotName}" not found on this sheet`
82951
+ );
82952
+ }
82864
82953
  const pivotId = pivot.id ?? pivot.name;
82865
82954
  const result = await this.ctx.pivot.compute(this.sheetId, pivotId);
82866
82955
  if (!result) return null;
@@ -83641,12 +83730,35 @@ var WorksheetSlicersImpl = class {
83641
83730
  }
83642
83731
  async add(config) {
83643
83732
  const caption = config.caption ?? config.name ?? "";
83733
+ const source = config.source ?? {
83734
+ type: "table",
83735
+ tableId: config.tableName ?? "",
83736
+ columnCellId: config.columnName ?? ""
83737
+ };
83738
+ const defaultStyle = {
83739
+ columnCount: 1,
83740
+ buttonHeight: 30,
83741
+ showSelectionIndicator: true,
83742
+ crossFilter: "showItemsWithDataAtTop",
83743
+ customListSort: true,
83744
+ showItemsWithNoData: true,
83745
+ sortOrder: "ascending"
83746
+ };
83644
83747
  const storedConfig = {
83645
- ...config,
83646
- caption
83748
+ id: config.id ?? "",
83749
+ sheetId: config.sheetId ?? "",
83750
+ source,
83751
+ caption,
83752
+ style: config.style ?? defaultStyle,
83753
+ position: config.position,
83754
+ zIndex: config.zIndex ?? 0,
83755
+ locked: config.locked ?? false,
83756
+ showHeader: config.showHeader ?? true,
83757
+ multiSelect: config.multiSelect ?? true,
83758
+ selectedValues: config.selectedValues ?? []
83647
83759
  };
83648
83760
  await this.ctx.computeBridge.createSlicer(this.sheetId, storedConfig);
83649
- return storedConfig.id ?? "";
83761
+ return storedConfig.id;
83650
83762
  }
83651
83763
  async remove(slicerId) {
83652
83764
  validateSlicerId(slicerId, "deleteSlicer");
@@ -83808,11 +83920,15 @@ var WorksheetSlicersImpl = class {
83808
83920
  }
83809
83921
  async updateConfig(slicerId, updates) {
83810
83922
  validateSlicerId(slicerId, "updateSlicerConfig");
83811
- await this.ctx.computeBridge.updateSlicerConfig(
83812
- this.sheetId,
83813
- slicerId,
83814
- updates
83815
- );
83923
+ const bridgeUpdate = {};
83924
+ if (updates.caption !== void 0) bridgeUpdate.caption = updates.caption;
83925
+ if (updates.name !== void 0 && bridgeUpdate.caption === void 0) {
83926
+ bridgeUpdate.caption = updates.name;
83927
+ }
83928
+ if (updates.style !== void 0) bridgeUpdate.style = updates.style;
83929
+ if (updates.position !== void 0) bridgeUpdate.position = updates.position;
83930
+ if (updates.showHeader !== void 0) bridgeUpdate.showHeader = updates.showHeader;
83931
+ await this.ctx.computeBridge.updateSlicerConfig(this.sheetId, slicerId, bridgeUpdate);
83816
83932
  }
83817
83933
  async getState(slicerId) {
83818
83934
  const state = await this.ctx.computeBridge.getSlicerState(this.sheetId, slicerId);
@@ -84406,6 +84522,7 @@ function toBridgeTextToColumnsOptions(options) {
84406
84522
  // ../../kernel/src/api/worksheet/tables.ts
84407
84523
  init_esm_shims();
84408
84524
  init_errors();
84525
+ init_value_conversions();
84409
84526
 
84410
84527
  // ../../kernel/src/api/worksheet/operations/table-operations.ts
84411
84528
  init_esm_shims();
@@ -84427,31 +84544,15 @@ function bridgeTableToTableInfo(table) {
84427
84544
  const endRowA1 = table.range.endRow + 1;
84428
84545
  const range2 = `${startLetter}${startRowA1}:${endLetter}${endRowA1}`;
84429
84546
  return {
84430
- id: table.id,
84431
- name: table.name,
84432
- range: range2,
84433
- hasHeaders: table.hasHeaderRow,
84434
- showTotals: table.hasTotalsRow,
84435
- style: table.style || void 0,
84436
- highlightFirstColumn: table.emphasizeFirstColumn,
84437
- highlightLastColumn: table.emphasizeLastColumn,
84438
- showBandedColumns: table.bandedColumns,
84439
- showBandedRows: table.bandedRows,
84440
- showFilterButton: table.showFilterButtons,
84441
- showHeaders: table.hasHeaderRow,
84442
- columns: table.columns.map((col) => ({
84443
- name: col.name,
84444
- index: col.index,
84445
- totalFunction: col.totalsFunction ?? void 0,
84446
- calculatedFormula: col.calculatedFormula ?? void 0
84447
- }))
84547
+ ...table,
84548
+ range: range2
84448
84549
  };
84449
84550
  }
84450
84551
  function getTableColumnDataCellsFromInfo(table, colIndex) {
84451
84552
  const parsed = parseA1Range(table.range);
84452
84553
  if (!parsed) return [];
84453
- const dataStartRow = table.hasHeaders ? parsed.startRow + 1 : parsed.startRow;
84454
- const dataEndRow = table.showTotals ? parsed.endRow - 1 : parsed.endRow;
84554
+ const dataStartRow = table.hasHeaderRow ? parsed.startRow + 1 : parsed.startRow;
84555
+ const dataEndRow = table.hasTotalsRow ? parsed.endRow - 1 : parsed.endRow;
84455
84556
  if (dataStartRow > dataEndRow) return [];
84456
84557
  const col = parsed.startCol + colIndex;
84457
84558
  if (col > parsed.endCol) return [];
@@ -84464,15 +84565,15 @@ function getTableColumnDataCellsFromInfo(table, colIndex) {
84464
84565
  function getDataBodyRangeFromInfo(table) {
84465
84566
  const parsed = parseA1Range(table.range);
84466
84567
  if (!parsed) return null;
84467
- const dataStartRow = table.hasHeaders ? parsed.startRow + 1 : parsed.startRow;
84468
- const dataEndRow = table.showTotals ? parsed.endRow - 1 : parsed.endRow;
84568
+ const dataStartRow = table.hasHeaderRow ? parsed.startRow + 1 : parsed.startRow;
84569
+ const dataEndRow = table.hasTotalsRow ? parsed.endRow - 1 : parsed.endRow;
84469
84570
  if (dataStartRow > dataEndRow) return null;
84470
84571
  const startLetter = colToLetter3(parsed.startCol);
84471
84572
  const endLetter = colToLetter3(parsed.endCol);
84472
84573
  return `${startLetter}${dataStartRow + 1}:${endLetter}${dataEndRow + 1}`;
84473
84574
  }
84474
84575
  function getHeaderRowRangeFromInfo(table) {
84475
- if (!table.hasHeaders) return null;
84576
+ if (!table.hasHeaderRow) return null;
84476
84577
  const parsed = parseA1Range(table.range);
84477
84578
  if (!parsed) return null;
84478
84579
  const startLetter = colToLetter3(parsed.startCol);
@@ -84481,7 +84582,7 @@ function getHeaderRowRangeFromInfo(table) {
84481
84582
  return `${startLetter}${headerRow}:${endLetter}${headerRow}`;
84482
84583
  }
84483
84584
  function getTotalRowRangeFromInfo(table) {
84484
- if (!table.showTotals) return null;
84585
+ if (!table.hasTotalsRow) return null;
84485
84586
  const parsed = parseA1Range(table.range);
84486
84587
  if (!parsed) return null;
84487
84588
  const startLetter = colToLetter3(parsed.startCol);
@@ -84577,23 +84678,23 @@ var WorksheetTablesImpl = class {
84577
84678
  if (updates.name !== void 0) {
84578
84679
  await this.ctx.computeBridge.renameTable(tableName, updates.name);
84579
84680
  }
84580
- const boolOptionMap = {
84581
- highlightFirstColumn: "emphasizeFirstColumn",
84582
- highlightLastColumn: "emphasizeLastColumn",
84583
- showBandedColumns: "bandedColumns",
84584
- showBandedRows: "bandedRows",
84585
- showFilterButton: "showFilterButtons"
84586
- };
84587
- for (const [key, bridgeOption] of Object.entries(boolOptionMap)) {
84681
+ const boolOptions = [
84682
+ "emphasizeFirstColumn",
84683
+ "emphasizeLastColumn",
84684
+ "bandedColumns",
84685
+ "bandedRows",
84686
+ "showFilterButtons"
84687
+ ];
84688
+ for (const key of boolOptions) {
84588
84689
  if (updates[key] !== void 0) {
84589
- await this.ctx.computeBridge.setTableBoolOption(tableName, bridgeOption, updates[key]);
84690
+ await this.ctx.computeBridge.setTableBoolOption(tableName, key, updates[key]);
84590
84691
  }
84591
84692
  }
84592
- if (updates.showHeaders !== void 0) {
84593
- await this.setShowHeaders(tableName, updates.showHeaders);
84693
+ if (updates.hasHeaderRow !== void 0) {
84694
+ await this.setShowHeaders(tableName, updates.hasHeaderRow);
84594
84695
  }
84595
- if (updates.showTotals !== void 0) {
84596
- await this.setShowTotals(tableName, updates.showTotals);
84696
+ if (updates.hasTotalsRow !== void 0) {
84697
+ await this.setShowTotals(tableName, updates.hasTotalsRow);
84597
84698
  }
84598
84699
  }
84599
84700
  async getAtCell(row, col) {
@@ -84714,14 +84815,14 @@ var WorksheetTablesImpl = class {
84714
84815
  async setShowHeaders(tableName, visible) {
84715
84816
  const table = await this.get(tableName);
84716
84817
  if (!table) throw new KernelError("COMPUTE_ERROR", `Table not found: ${tableName}`);
84717
- if (table.hasHeaders !== visible) {
84818
+ if (table.hasHeaderRow !== visible) {
84718
84819
  await this.ctx.computeBridge.toggleHeaderRow(tableName);
84719
84820
  }
84720
84821
  }
84721
84822
  async setShowTotals(tableName, visible) {
84722
84823
  const table = await this.get(tableName);
84723
84824
  if (!table) throw new KernelError("COMPUTE_ERROR", `Table not found: ${tableName}`);
84724
- if ((table.showTotals ?? false) !== visible) {
84825
+ if (table.hasTotalsRow !== visible) {
84725
84826
  await this.ctx.computeBridge.toggleTotalsRow(tableName);
84726
84827
  }
84727
84828
  }
@@ -84755,8 +84856,8 @@ var WorksheetTablesImpl = class {
84755
84856
  if (!table) throw new KernelError("COMPUTE_ERROR", `Table not found: ${tableName}`);
84756
84857
  const parsed = parseA1Range2(table.range);
84757
84858
  if (!parsed) return 0;
84758
- const dataStartRow = table.hasHeaders ? parsed.startRow + 1 : parsed.startRow;
84759
- const dataEndRow = table.showTotals ? parsed.endRow - 1 : parsed.endRow;
84859
+ const dataStartRow = table.hasHeaderRow ? parsed.startRow + 1 : parsed.startRow;
84860
+ const dataEndRow = table.hasTotalsRow ? parsed.endRow - 1 : parsed.endRow;
84760
84861
  return Math.max(0, dataEndRow - dataStartRow + 1);
84761
84862
  }
84762
84863
  async getRowRange(tableName, index) {
@@ -84764,7 +84865,7 @@ var WorksheetTablesImpl = class {
84764
84865
  if (!table) throw new KernelError("COMPUTE_ERROR", `Table not found: ${tableName}`);
84765
84866
  const parsed = parseA1Range2(table.range);
84766
84867
  if (!parsed) throw new KernelError("COMPUTE_ERROR", `Invalid table range: ${table.range}`);
84767
- const dataStartRow = table.hasHeaders ? parsed.startRow + 1 : parsed.startRow;
84868
+ const dataStartRow = table.hasHeaderRow ? parsed.startRow + 1 : parsed.startRow;
84768
84869
  const absRow = dataStartRow + index;
84769
84870
  const startLetter = colToLetter3(parsed.startCol);
84770
84871
  const endLetter = colToLetter3(parsed.endCol);
@@ -84775,7 +84876,7 @@ var WorksheetTablesImpl = class {
84775
84876
  if (!table) throw new KernelError("COMPUTE_ERROR", `Table not found: ${tableName}`);
84776
84877
  const parsed = parseA1Range2(table.range);
84777
84878
  if (!parsed) return [];
84778
- const dataStartRow = table.hasHeaders ? parsed.startRow + 1 : parsed.startRow;
84879
+ const dataStartRow = table.hasHeaderRow ? parsed.startRow + 1 : parsed.startRow;
84779
84880
  const absRow = dataStartRow + index;
84780
84881
  return queryRangeValues(this.ctx, this.sheetId, absRow, parsed.startCol, absRow, parsed.endCol);
84781
84882
  }
@@ -84784,7 +84885,7 @@ var WorksheetTablesImpl = class {
84784
84885
  if (!table) throw new KernelError("COMPUTE_ERROR", `Table not found: ${tableName}`);
84785
84886
  const parsed = parseA1Range2(table.range);
84786
84887
  if (!parsed) return;
84787
- const dataStartRow = table.hasHeaders ? parsed.startRow + 1 : parsed.startRow;
84888
+ const dataStartRow = table.hasHeaderRow ? parsed.startRow + 1 : parsed.startRow;
84788
84889
  const absRow = dataStartRow + index;
84789
84890
  const edits = values.map((val, i) => ({
84790
84891
  row: absRow,
@@ -84803,15 +84904,15 @@ var WorksheetTablesImpl = class {
84803
84904
  if (!parsed) return null;
84804
84905
  const col = parsed.startCol + columnIndex;
84805
84906
  if (col > parsed.endCol) return null;
84806
- const dataStartRow = table.hasHeaders ? parsed.startRow + 1 : parsed.startRow;
84807
- const dataEndRow = table.showTotals ? parsed.endRow - 1 : parsed.endRow;
84907
+ const dataStartRow = table.hasHeaderRow ? parsed.startRow + 1 : parsed.startRow;
84908
+ const dataEndRow = table.hasTotalsRow ? parsed.endRow - 1 : parsed.endRow;
84808
84909
  if (dataStartRow > dataEndRow) return null;
84809
84910
  const letter = colToLetter3(col);
84810
84911
  return `${letter}${dataStartRow + 1}:${letter}${dataEndRow + 1}`;
84811
84912
  }
84812
84913
  async getColumnHeaderRange(tableName, columnIndex) {
84813
84914
  const table = await this.get(tableName);
84814
- if (!table || !table.hasHeaders) return null;
84915
+ if (!table || !table.hasHeaderRow) return null;
84815
84916
  const parsed = parseA1Range2(table.range);
84816
84917
  if (!parsed) return null;
84817
84918
  const col = parsed.startCol + columnIndex;
@@ -84832,7 +84933,7 @@ var WorksheetTablesImpl = class {
84832
84933
  }
84833
84934
  async getColumnTotalRange(tableName, columnIndex) {
84834
84935
  const table = await this.get(tableName);
84835
- if (!table || !table.showTotals) return null;
84936
+ if (!table || !table.hasTotalsRow) return null;
84836
84937
  const parsed = parseA1Range2(table.range);
84837
84938
  if (!parsed) return null;
84838
84939
  const col = parsed.startCol + columnIndex;
@@ -84848,8 +84949,8 @@ var WorksheetTablesImpl = class {
84848
84949
  if (!parsed) return [];
84849
84950
  const col = parsed.startCol + columnIndex;
84850
84951
  if (col > parsed.endCol) return [];
84851
- const dataStartRow = table.hasHeaders ? parsed.startRow + 1 : parsed.startRow;
84852
- const dataEndRow = table.showTotals ? parsed.endRow - 1 : parsed.endRow;
84952
+ const dataStartRow = table.hasHeaderRow ? parsed.startRow + 1 : parsed.startRow;
84953
+ const dataEndRow = table.hasTotalsRow ? parsed.endRow - 1 : parsed.endRow;
84853
84954
  if (dataStartRow > dataEndRow) return [];
84854
84955
  return queryRangeValues(this.ctx, this.sheetId, dataStartRow, col, dataEndRow, col);
84855
84956
  }
@@ -84860,7 +84961,7 @@ var WorksheetTablesImpl = class {
84860
84961
  if (!parsed) return;
84861
84962
  const col = parsed.startCol + columnIndex;
84862
84963
  if (col > parsed.endCol) return;
84863
- const dataStartRow = table.hasHeaders ? parsed.startRow + 1 : parsed.startRow;
84964
+ const dataStartRow = table.hasHeaderRow ? parsed.startRow + 1 : parsed.startRow;
84864
84965
  const edits = values.map((val, i) => ({
84865
84966
  row: dataStartRow + i,
84866
84967
  col,
@@ -84876,8 +84977,8 @@ var WorksheetTablesImpl = class {
84876
84977
  if (!table) throw new KernelError("COMPUTE_ERROR", `Table not found: ${tableName}`);
84877
84978
  const parsed = parseA1Range2(table.range);
84878
84979
  if (!parsed) return;
84879
- const dataStartRow = table.hasHeaders ? parsed.startRow + 1 : parsed.startRow;
84880
- const dataEndRow = table.showTotals ? parsed.endRow - 1 : parsed.endRow;
84980
+ const dataStartRow = table.hasHeaderRow ? parsed.startRow + 1 : parsed.startRow;
84981
+ const dataEndRow = table.hasTotalsRow ? parsed.endRow - 1 : parsed.endRow;
84881
84982
  if (dataStartRow > dataEndRow) return;
84882
84983
  const numCols = parsed.endCol - parsed.startCol + 1;
84883
84984
  const numRows = dataEndRow - dataStartRow + 1;
@@ -84897,7 +84998,7 @@ var WorksheetTablesImpl = class {
84897
84998
  const row = [];
84898
84999
  for (let c = 0; c < numCols; c++) {
84899
85000
  const cell = cellMap.get(`${dataStartRow + r},${parsed.startCol + c}`);
84900
- row.push(cell?.value ?? null);
85001
+ row.push(normalizeCellValue(cell?.value ?? null));
84901
85002
  }
84902
85003
  rows.push(row);
84903
85004
  }
@@ -84969,7 +85070,7 @@ async function queryRangeValues(ctx, sheetId, startRow, startCol, endRow, endCol
84969
85070
  for (let r = startRow; r <= endRow; r++) {
84970
85071
  for (let c = startCol; c <= endCol; c++) {
84971
85072
  const cell = cellMap.get(`${r},${c}`);
84972
- values.push(cell?.value ?? null);
85073
+ values.push(normalizeCellValue(cell?.value ?? null));
84973
85074
  }
84974
85075
  }
84975
85076
  return values;
@@ -85559,6 +85660,117 @@ var WorksheetViewImpl = class {
85559
85660
  }
85560
85661
  };
85561
85662
 
85663
+ // ../../kernel/src/api/worksheet/what-if.ts
85664
+ init_esm_shims();
85665
+
85666
+ // ../../kernel/src/api/worksheet/operations/data-table-operations.ts
85667
+ init_esm_shims();
85668
+ init_errors();
85669
+ async function dataTable(ctx, sheetId, formulaCell, options) {
85670
+ const formulaPos = resolveCell(formulaCell);
85671
+ const formulaCellId = await getCellIdAt2(ctx, sheetId, formulaPos.row, formulaPos.col);
85672
+ if (!formulaCellId) {
85673
+ throw new KernelError("COMPUTE_ERROR", `Formula cell ${formulaCell} has no content.`);
85674
+ }
85675
+ let rowInputCellId = null;
85676
+ if (options.rowInputCell) {
85677
+ const pos = resolveCell(options.rowInputCell);
85678
+ const cid = await getCellIdAt2(ctx, sheetId, pos.row, pos.col);
85679
+ if (!cid) {
85680
+ throw new KernelError(
85681
+ "COMPUTE_ERROR",
85682
+ `Row input cell ${options.rowInputCell} must contain a value before calling dataTable().`
85683
+ );
85684
+ }
85685
+ rowInputCellId = cid;
85686
+ }
85687
+ let colInputCellId = null;
85688
+ if (options.colInputCell) {
85689
+ const pos = resolveCell(options.colInputCell);
85690
+ const cid = await getCellIdAt2(ctx, sheetId, pos.row, pos.col);
85691
+ if (!cid) {
85692
+ throw new KernelError(
85693
+ "COMPUTE_ERROR",
85694
+ `Column input cell ${options.colInputCell} must contain a value before calling dataTable().`
85695
+ );
85696
+ }
85697
+ colInputCellId = cid;
85698
+ }
85699
+ const bridgeResult = await ctx.computeBridge.dataTable({
85700
+ formula_cell: formulaCellId,
85701
+ row_input_cell: rowInputCellId,
85702
+ col_input_cell: colInputCellId,
85703
+ row_values: options.rowValues,
85704
+ col_values: options.colValues
85705
+ });
85706
+ const result = bridgeResult;
85707
+ return {
85708
+ results: result.results,
85709
+ cellCount: result.cellCount ?? result.cell_count ?? 0,
85710
+ elapsedMs: result.elapsedMs ?? result.elapsed_ms ?? 0,
85711
+ cancelled: result.cancelled ?? false
85712
+ };
85713
+ }
85714
+
85715
+ // ../../kernel/src/api/worksheet/operations/goal-seek-operations.ts
85716
+ init_esm_shims();
85717
+ init_errors();
85718
+ async function goalSeek(ctx, sheetId, targetCell, targetValue, changingCell) {
85719
+ const targetPos = resolveCell(targetCell);
85720
+ const changingPos = resolveCell(changingCell);
85721
+ const formulaCellId = await getCellIdAt2(
85722
+ ctx,
85723
+ sheetId,
85724
+ targetPos.row,
85725
+ targetPos.col
85726
+ );
85727
+ if (!formulaCellId) {
85728
+ throw new KernelError("COMPUTE_ERROR", `Target cell ${targetCell} has no content.`);
85729
+ }
85730
+ const inputCellId = await getCellIdAt2(
85731
+ ctx,
85732
+ sheetId,
85733
+ changingPos.row,
85734
+ changingPos.col
85735
+ );
85736
+ if (!inputCellId) {
85737
+ throw new KernelError("COMPUTE_ERROR", `Changing cell ${changingCell} has no content.`);
85738
+ }
85739
+ const changingData = await getCell(ctx, sheetId, changingPos.row, changingPos.col);
85740
+ const initialGuess = typeof changingData?.value === "number" ? changingData.value : 0;
85741
+ const bridgeResult = await ctx.computeBridge.goalSeek({
85742
+ formula_cell: formulaCellId,
85743
+ target: targetValue,
85744
+ input_cell: inputCellId,
85745
+ initial_guess: initialGuess
85746
+ });
85747
+ const result = bridgeResult;
85748
+ const solutionValue = result.solutionValue ?? result.solution_value;
85749
+ const iterations = result.iterations;
85750
+ if (result.found && solutionValue != null) {
85751
+ await setCell(ctx, sheetId, changingPos.row, changingPos.col, solutionValue);
85752
+ }
85753
+ return {
85754
+ found: result.found,
85755
+ value: solutionValue,
85756
+ iterations
85757
+ };
85758
+ }
85759
+
85760
+ // ../../kernel/src/api/worksheet/what-if.ts
85761
+ var WorksheetWhatIfImpl = class {
85762
+ constructor(ctx, sheetId) {
85763
+ this.ctx = ctx;
85764
+ this.sheetId = sheetId;
85765
+ }
85766
+ async goalSeek(targetCell, targetValue, changingCell) {
85767
+ return goalSeek(this.ctx, this.sheetId, targetCell, targetValue, changingCell);
85768
+ }
85769
+ async dataTable(formulaCell, options) {
85770
+ return dataTable(this.ctx, this.sheetId, formulaCell, options);
85771
+ }
85772
+ };
85773
+
85562
85774
  // ../../kernel/src/api/worksheet/objects.ts
85563
85775
  init_esm_shims();
85564
85776
  init_errors();
@@ -86262,8 +86474,8 @@ function objectToInfo(obj) {
86262
86474
  flipH: obj.position?.flipH,
86263
86475
  flipV: obj.position?.flipV,
86264
86476
  zIndex: obj.zIndex,
86265
- visible: obj.visible,
86266
- groupId: obj.groupId,
86477
+ visible: "visible" in obj ? obj.visible : void 0,
86478
+ groupId: "groupId" in obj ? obj.groupId : void 0,
86267
86479
  anchorType: obj.position?.anchorType,
86268
86480
  altText: obj.altText
86269
86481
  };
@@ -86476,7 +86688,7 @@ async function getConnectorData(manager, connectorId) {
86476
86688
  }
86477
86689
  async function getGroupMembers(manager, _ctx, sheetId, groupId) {
86478
86690
  const objects = await manager.getObjectsInSheet(sheetId);
86479
- return objects.filter((obj) => obj.groupId === groupId).map((obj) => obj.id);
86691
+ return objects.filter((obj) => "groupId" in obj && obj.groupId === groupId).map((obj) => obj.id);
86480
86692
  }
86481
86693
  function deriveImageFormat(src) {
86482
86694
  const dataUrlMatch = src.match(/^data:image\/([^;,]+)/);
@@ -86525,6 +86737,7 @@ async function getConnectionSiteCount(manager, objectId) {
86525
86737
 
86526
86738
  // ../../kernel/src/api/worksheet/operations/shape-operations.ts
86527
86739
  init_esm_shims();
86740
+ init_floating_object_mapper();
86528
86741
  function shapeObjectToShape(shape, sheetId) {
86529
86742
  return {
86530
86743
  id: shape.id,
@@ -86564,7 +86777,7 @@ function buildMutationReceipt2(change, action) {
86564
86777
  domain: "floatingObject",
86565
86778
  action,
86566
86779
  id: change.objectId,
86567
- object: change.data,
86780
+ object: change.data ? toFloatingObject(change.data) : createMinimalFloatingObject("shape", change.objectId, ""),
86568
86781
  bounds
86569
86782
  };
86570
86783
  }
@@ -86599,7 +86812,7 @@ async function createShape(ctx, sheetId, config) {
86599
86812
  domain: "floatingObject",
86600
86813
  action: "create",
86601
86814
  id: "",
86602
- object: { id: "", sheetId, type: "shape", shapeType: config.type },
86815
+ object: createMinimalFloatingObject("shape", "", sheetId),
86603
86816
  bounds: {
86604
86817
  x: 0,
86605
86818
  y: 0,
@@ -86689,7 +86902,7 @@ async function updateShape(ctx, sheetId, shapeId, updates) {
86689
86902
  domain: "floatingObject",
86690
86903
  action: "update",
86691
86904
  id: shapeId,
86692
- object: { id: shapeId, sheetId, type: "shape" },
86905
+ object: createMinimalFloatingObject("shape", shapeId, sheetId),
86693
86906
  bounds: { x: 0, y: 0, width: 0, height: 0, rotation: 0 }
86694
86907
  };
86695
86908
  }
@@ -86965,6 +87178,15 @@ var WorksheetObjectsImpl = class {
86965
87178
  async get(objectId) {
86966
87179
  return await getFloatingObject(this.mgr, this.ctx, this.sheetId, objectId);
86967
87180
  }
87181
+ /**
87182
+ * Get the full domain-typed FloatingObject for an object by ID.
87183
+ * Returns the discriminated union variant (ShapeObject, PictureObject, etc.)
87184
+ * directly from the manager, bypassing the API-level FloatingObjectInfo projection.
87185
+ */
87186
+ async getFullObject(objectId) {
87187
+ const obj = await this.mgr.getObject(objectId);
87188
+ return obj ?? null;
87189
+ }
86968
87190
  async computeObjectBounds(objectId) {
86969
87191
  const obj = await this.mgr.getObject(objectId);
86970
87192
  if (!obj) return null;
@@ -87333,7 +87555,7 @@ var WorksheetImpl = class {
87333
87555
  async getValue(a, b) {
87334
87556
  const { row, col } = resolveCell(a, b);
87335
87557
  const data = await getCell(this.ctx, this.sheetId, row, col);
87336
- return data?.value ?? null;
87558
+ return normalizeCellValue(data?.value ?? null);
87337
87559
  }
87338
87560
  async getData() {
87339
87561
  const range2 = await getUsedRange2(this.ctx, this.sheetId);
@@ -87345,7 +87567,7 @@ var WorksheetImpl = class {
87345
87567
  endRow: range2.endRow,
87346
87568
  endCol: range2.endCol
87347
87569
  });
87348
- return cellData.map((row) => row.map((cell) => cell.value ?? null));
87570
+ return cellData.map((row) => row.map((cell) => normalizeCellValue(cell.value ?? null)));
87349
87571
  }
87350
87572
  async getRange(a, b, c, d) {
87351
87573
  const bounds = resolveRange(a, b, c, d);
@@ -87469,7 +87691,7 @@ var WorksheetImpl = class {
87469
87691
  rowData.push({ value: null });
87470
87692
  } else {
87471
87693
  rowData.push({
87472
- value: viewportCellValueToCellValue(vc.value) ?? null,
87694
+ value: normalizeCellValue(vc.value) ?? null,
87473
87695
  formula: vc.formula,
87474
87696
  format: vc.format ?? void 0
87475
87697
  });
@@ -87496,10 +87718,10 @@ var WorksheetImpl = class {
87496
87718
  const { row, col } = resolveCell(address);
87497
87719
  const data = await getCell(this.ctx, this.sheetId, row, col);
87498
87720
  if (!data) return "";
87499
- const displayValue = await getDisplayValue2(this.ctx, this.sheetId, row, col);
87500
- let result = displayValue;
87721
+ const rawValue = cellValueToString(data.value);
87722
+ let result = rawValue;
87501
87723
  if (data.formula) {
87502
- result = displayValue !== "" ? `${displayValue}(${data.formula})` : `(${data.formula})`;
87724
+ result = rawValue !== "" ? `${rawValue}(${data.formula})` : `(${data.formula})`;
87503
87725
  }
87504
87726
  const styleHintsStr = await getStyleHints(this.ctx, this.sheetId, row, col);
87505
87727
  if (styleHintsStr) {
@@ -87540,7 +87762,7 @@ var WorksheetImpl = class {
87540
87762
  row,
87541
87763
  col,
87542
87764
  formula: vc.formula,
87543
- value: viewportCellValueToCellValue(vc.value)
87765
+ value: normalizeCellValue(vc.value)
87544
87766
  });
87545
87767
  }
87546
87768
  }
@@ -87565,8 +87787,8 @@ var WorksheetImpl = class {
87565
87787
  rowValues.push(`${cellAddr}:`);
87566
87788
  continue;
87567
87789
  }
87568
- const displayValue = vc.formatted ?? viewportCellValueToString(vc.value);
87569
- let cellStr = displayValue;
87790
+ const rawValue = cellValueToString(vc.value);
87791
+ let cellStr = rawValue;
87570
87792
  if (vc.formula) {
87571
87793
  const abbreviation = formulaAnalysis.formulaToId.get(`${row},${col}`);
87572
87794
  if (abbreviation) {
@@ -87587,7 +87809,7 @@ var WorksheetImpl = class {
87587
87809
  const styleCells = rangeData.cells.map((vc) => ({
87588
87810
  row: vc.row,
87589
87811
  col: vc.col,
87590
- value: viewportCellValueToCellValue(vc.value),
87812
+ value: normalizeCellValue(vc.value),
87591
87813
  format: vc.format
87592
87814
  }));
87593
87815
  const styleLines = analyzeStylePatterns(styleCells);
@@ -87609,7 +87831,7 @@ var WorksheetImpl = class {
87609
87831
  const leftCellData = leftRange.cells.map((vc) => ({
87610
87832
  row: vc.row,
87611
87833
  col: vc.col,
87612
- value: viewportCellValueToCellValue(vc.value),
87834
+ value: normalizeCellValue(vc.value),
87613
87835
  formatted: vc.formatted ?? void 0,
87614
87836
  indent: 0
87615
87837
  // indent not available from queryRange; would need format.indent
@@ -87638,7 +87860,7 @@ var WorksheetImpl = class {
87638
87860
  const aboveCellData = aboveRange.cells.map((vc) => ({
87639
87861
  row: vc.row,
87640
87862
  col: vc.col,
87641
- value: viewportCellValueToCellValue(vc.value),
87863
+ value: normalizeCellValue(vc.value),
87642
87864
  formatted: vc.formatted ?? void 0
87643
87865
  }));
87644
87866
  const aboveLine = buildAboveContext(
@@ -87777,7 +87999,7 @@ var WorksheetImpl = class {
87777
87999
  const cells = (rowMap.get(row) ?? []).slice().sort((a, b) => a.col - b.col);
87778
88000
  const rowData = [];
87779
88001
  for (const vc of cells) {
87780
- const rawValue = viewportCellValueToString(vc.value);
88002
+ const rawValue = cellValueToString(vc.value);
87781
88003
  const addr = toA12(vc.row, vc.col);
87782
88004
  if (vc.formula) {
87783
88005
  rowData.push(`${addr}:${rawValue}(=${vc.formula})`);
@@ -87985,7 +88207,7 @@ var WorksheetImpl = class {
87985
88207
  fields.push("");
87986
88208
  continue;
87987
88209
  }
87988
- let str = cell.formatted != null && cell.formatted !== "" ? cell.formatted : isCellError(val) ? `#${val.value}!` : String(val);
88210
+ let str = cell.formatted != null && cell.formatted !== "" ? cell.formatted : String(normalizeCellValue(val));
87989
88211
  if (str.length > 0 && "=+-@".includes(str[0])) {
87990
88212
  str = " " + str;
87991
88213
  }
@@ -88038,7 +88260,7 @@ var WorksheetImpl = class {
88038
88260
  const row = cellData[i];
88039
88261
  const obj = {};
88040
88262
  for (let j = 0; j < headers.length; j++) {
88041
- obj[headers[j]] = row[j]?.value ?? null;
88263
+ obj[headers[j]] = normalizeCellValue(row[j]?.value ?? null);
88042
88264
  }
88043
88265
  result.push(obj);
88044
88266
  }
@@ -88089,48 +88311,6 @@ var WorksheetImpl = class {
88089
88311
  });
88090
88312
  return formatValues(this.ctx, bridgeEntries);
88091
88313
  }
88092
- async goalSeek(targetCell, targetValue, changingCell) {
88093
- const sheetId = this.sheetId;
88094
- const targetPos = resolveCell(targetCell);
88095
- const changingPos = resolveCell(changingCell);
88096
- const formulaCellId = await getCellIdAt2(
88097
- this.ctx,
88098
- sheetId,
88099
- targetPos.row,
88100
- targetPos.col
88101
- );
88102
- if (!formulaCellId) {
88103
- throw new KernelError("COMPUTE_ERROR", `Target cell ${targetCell} has no content.`);
88104
- }
88105
- const inputCellId = await getCellIdAt2(
88106
- this.ctx,
88107
- sheetId,
88108
- changingPos.row,
88109
- changingPos.col
88110
- );
88111
- if (!inputCellId) {
88112
- throw new KernelError("COMPUTE_ERROR", `Changing cell ${changingCell} has no content.`);
88113
- }
88114
- const changingData = await getCell(this.ctx, sheetId, changingPos.row, changingPos.col);
88115
- const initialGuess = typeof changingData?.value === "number" ? changingData.value : 0;
88116
- const bridgeResult = await this.ctx.computeBridge.goalSeek({
88117
- formula_cell: formulaCellId,
88118
- target: targetValue,
88119
- input_cell: inputCellId,
88120
- initial_guess: initialGuess
88121
- });
88122
- const result = bridgeResult;
88123
- const solutionValue = result.solutionValue ?? result.solution_value;
88124
- const iterations = result.iterations;
88125
- if (result.found && solutionValue != null) {
88126
- await setCell(this.ctx, sheetId, changingPos.row, changingPos.col, solutionValue);
88127
- }
88128
- return {
88129
- found: result.found,
88130
- value: solutionValue,
88131
- iterations
88132
- };
88133
- }
88134
88314
  // ===========================================================================
88135
88315
  // Visibility
88136
88316
  // ===========================================================================
@@ -88468,6 +88648,9 @@ var WorksheetImpl = class {
88468
88648
  get protection() {
88469
88649
  return this._protection ??= new WorksheetProtectionImpl(this.ctx, this.sheetId);
88470
88650
  }
88651
+ get whatIf() {
88652
+ return this._whatIf ??= new WorksheetWhatIfImpl(this.ctx, this.sheetId);
88653
+ }
88471
88654
  get print() {
88472
88655
  return this._print ??= new WorksheetPrintImpl(this.ctx, this.sheetId);
88473
88656
  }
@@ -88699,8 +88882,7 @@ var WorkbookStylesImpl = class {
88699
88882
  this.ctx = ctx;
88700
88883
  }
88701
88884
  async getTableStyles() {
88702
- const styles = await this.ctx.computeBridge.getAllCustomTableStyles();
88703
- return styles;
88885
+ return this.ctx.computeBridge.getAllCustomTableStyles();
88704
88886
  }
88705
88887
  async createTableStyle(config) {
88706
88888
  const result = await this.ctx.computeBridge.createCustomTableStyle(
@@ -90628,24 +90810,41 @@ var WorkbookImpl = class {
90628
90810
  timestamp: cp.timestamp
90629
90811
  }));
90630
90812
  }
90631
- async calculate(calculationType) {
90632
- const type = calculationType ?? "full";
90633
- try {
90634
- switch (type) {
90635
- case "recalculate":
90636
- await this.ctx.computeBridge.fullRecalc();
90637
- break;
90638
- case "full":
90639
- await this.ctx.computeBridge.fullRecalc();
90640
- break;
90641
- case "fullRebuild":
90642
- await this.ctx.computeBridge.fullRecalc();
90643
- break;
90813
+ async calculate(options) {
90814
+ const opts = typeof options === "string" ? { calculationType: options } : options ?? {};
90815
+ const recalcOptions = {};
90816
+ if (opts.iterative !== void 0) {
90817
+ if (typeof opts.iterative === "boolean") {
90818
+ recalcOptions.iterative = opts.iterative;
90819
+ } else {
90820
+ recalcOptions.iterative = true;
90821
+ if (opts.iterative.maxIterations !== void 0) {
90822
+ recalcOptions.maxIterations = opts.iterative.maxIterations;
90823
+ }
90824
+ if (opts.iterative.maxChange !== void 0) {
90825
+ recalcOptions.maxChange = opts.iterative.maxChange;
90826
+ }
90644
90827
  }
90828
+ }
90829
+ try {
90830
+ const result = await this.ctx.computeBridge.fullRecalc(recalcOptions);
90831
+ return {
90832
+ hasCircularRefs: result.metrics?.hasCircularRefs ?? false,
90833
+ converged: result.metrics?.iterativeConverged ?? false,
90834
+ iterations: result.metrics?.iterativeIterations ?? 0,
90835
+ maxDelta: result.metrics?.iterativeMaxDelta ?? 0,
90836
+ circularCellCount: result.metrics?.circularCellCount ?? 0
90837
+ };
90645
90838
  } catch (e) {
90646
90839
  const msg = String(e);
90647
90840
  if (msg.includes("Unknown napi method") || msg.includes("not a function") || msg.includes("not found")) {
90648
- return;
90841
+ return {
90842
+ hasCircularRefs: false,
90843
+ converged: false,
90844
+ iterations: 0,
90845
+ maxDelta: 0,
90846
+ circularCellCount: 0
90847
+ };
90649
90848
  }
90650
90849
  throw new KernelError("COMPUTE_ERROR", `Full recalculation failed: ${msg}`);
90651
90850
  }
@@ -91107,6 +91306,7 @@ var api_spec_default = {
91107
91306
  viewport: "WorkbookViewport"
91108
91307
  },
91109
91308
  ws: {
91309
+ whatIf: "WorksheetWhatIf",
91110
91310
  smartArt: "WorksheetSmartArt",
91111
91311
  changes: "WorksheetChanges",
91112
91312
  formats: "WorksheetFormats",
@@ -91204,10 +91404,12 @@ var api_spec_default = {
91204
91404
  ]
91205
91405
  },
91206
91406
  calculate: {
91207
- signature: "calculate(calculationType?: CalculationType): Promise<void>;",
91208
- docstring: "Trigger recalculation of formulas.\n@param calculationType - Type of recalculation (default: 'full')\n - 'recalculate' \u2014 recalculate dirty cells only\n - 'full' \u2014 recalculate all cells\n - 'fullRebuild' \u2014 rebuild dependency graph and recalculate all",
91407
+ signature: "calculate(options?: CalculateOptions | CalculationType): Promise<CalculateResult>;",
91408
+ docstring: "Trigger recalculation of formulas.\n@param options - Calculation options, or a CalculationType string for backward compatibility",
91209
91409
  usedTypes: [
91210
- "CalculationType"
91410
+ "CalculateOptions",
91411
+ "CalculationType",
91412
+ "CalculateResult"
91211
91413
  ]
91212
91414
  },
91213
91415
  getCalculationMode: {
@@ -91227,17 +91429,17 @@ var api_spec_default = {
91227
91429
  },
91228
91430
  setIterativeCalculation: {
91229
91431
  signature: "setIterativeCalculation(enabled: boolean): Promise<void>;",
91230
- docstring: "Set whether iterative calculation is enabled for circular references.\nConvenience mutator \u2014 patches `calculationSettings.enableIterativeCalculation`.",
91432
+ docstring: "Set whether iterative calculation is enabled for circular references.\nConvenience mutator \u2014 patches `calculationSettings.enableIterativeCalculation`.\n@deprecated Use calculate({ iterative: ... }) instead.",
91231
91433
  usedTypes: []
91232
91434
  },
91233
91435
  setMaxIterations: {
91234
91436
  signature: "setMaxIterations(n: number): Promise<void>;",
91235
- docstring: "Set the maximum number of iterations for iterative calculation.\nConvenience mutator \u2014 patches `calculationSettings.maxIterations`.",
91437
+ docstring: "Set the maximum number of iterations for iterative calculation.\nConvenience mutator \u2014 patches `calculationSettings.maxIterations`.\n@deprecated Use calculate({ iterative: { maxIterations: n } }) instead.",
91236
91438
  usedTypes: []
91237
91439
  },
91238
91440
  setConvergenceThreshold: {
91239
91441
  signature: "setConvergenceThreshold(threshold: number): Promise<void>;",
91240
- docstring: "Set the convergence threshold (maximum change) for iterative calculation.\nConvenience mutator \u2014 patches `calculationSettings.maxChange`.",
91442
+ docstring: "Set the convergence threshold (maximum change) for iterative calculation.\nConvenience mutator \u2014 patches `calculationSettings.maxChange`.\n@deprecated Use calculate({ iterative: { maxChange: threshold } }) instead.",
91241
91443
  usedTypes: []
91242
91444
  },
91243
91445
  getUsePrecisionAsDisplayed: {
@@ -91695,13 +91897,6 @@ var api_spec_default = {
91695
91897
  "FormatEntry"
91696
91898
  ]
91697
91899
  },
91698
- goalSeek: {
91699
- signature: "goalSeek(targetCell: string, targetValue: number, changingCell: string): Promise<GoalSeekResult>;",
91700
- docstring: "Run a goal seek to find the input value that produces a target result.",
91701
- usedTypes: [
91702
- "GoalSeekResult"
91703
- ]
91704
- },
91705
91900
  isVisible: {
91706
91901
  signature: "isVisible(): boolean;",
91707
91902
  docstring: "Check if the sheet is visible (sync -- local metadata).",
@@ -92223,6 +92418,25 @@ var api_spec_default = {
92223
92418
  }
92224
92419
  }
92225
92420
  },
92421
+ WorksheetWhatIf: {
92422
+ docstring: "Sub-API for What-If analysis operations.",
92423
+ functions: {
92424
+ goalSeek: {
92425
+ signature: "goalSeek(targetCell: string, targetValue: number, changingCell: string): Promise<GoalSeekResult>;",
92426
+ docstring: "Run a goal seek to find the input value that produces a target result.",
92427
+ usedTypes: [
92428
+ "GoalSeekResult"
92429
+ ]
92430
+ },
92431
+ dataTable: {
92432
+ signature: "dataTable(\n formulaCell: string,\n options: {\n rowInputCell?: string | null;\n colInputCell?: string | null;\n rowValues: (string | number | boolean | null)[];\n colValues: (string | number | boolean | null)[];\n },\n ): Promise<DataTableResult>;",
92433
+ docstring: "Evaluate a formula with different input values (What-If Data Table).\n\nOne-variable table: provide either `rowInputCell` or `colInputCell` (not both).\nTwo-variable table: provide both `rowInputCell` and `colInputCell`.\n\nFor one-variable tables, pass an empty array for the unused dimension's values.\n\nInput cells must already contain a value before calling this method.\n\n@param formulaCell - A1 address of the cell containing the formula to evaluate\n@param options - Input cells and substitution values\n@returns 2D grid of computed results",
92434
+ usedTypes: [
92435
+ "DataTableResult"
92436
+ ]
92437
+ }
92438
+ }
92439
+ },
92226
92440
  WorksheetSmartArt: {
92227
92441
  docstring: "",
92228
92442
  functions: {
@@ -92362,7 +92576,18 @@ var api_spec_default = {
92362
92576
  functions: {
92363
92577
  set: {
92364
92578
  signature: "set(address: string, format: CellFormat): Promise<FormatChangeResult>;",
92365
- docstring: 'Set format for a single cell.\n\n@param address - A1-style cell address (e.g. "A1", "B3")\n@param format - Format properties to apply',
92579
+ docstring: `Set format for a single cell.
92580
+
92581
+ @param address - A1-style cell address (e.g. "A1", "B3")
92582
+ @param format - Format properties to apply
92583
+
92584
+ @example
92585
+ // Bold red currency
92586
+ await ws.formats.set('A1', { bold: true, fontColor: '#ff0000', numberFormat: '$#,##0.00' });
92587
+ // Date format
92588
+ await ws.formats.set('B1', { numberFormat: 'YYYY-MM-DD' });
92589
+ // Header style
92590
+ await ws.formats.set('A1', { bold: true, fontSize: 14, backgroundColor: '#4472c4', fontColor: '#ffffff' });`,
92366
92591
  usedTypes: [
92367
92592
  "CellFormat",
92368
92593
  "FormatChangeResult"
@@ -92370,7 +92595,21 @@ var api_spec_default = {
92370
92595
  },
92371
92596
  setRange: {
92372
92597
  signature: "setRange(range: string, format: CellFormat): Promise<FormatChangeResult>;",
92373
- docstring: 'Set format for a contiguous range.\n\n@param range - A1-style range string (e.g. "A1:B2")\n@param format - Format properties to apply',
92598
+ docstring: `Set format for a contiguous range.
92599
+
92600
+ @param range - A1-style range string (e.g. "A1:B2")
92601
+ @param format - Format properties to apply
92602
+
92603
+ @example
92604
+ // Currency column
92605
+ await ws.formats.setRange('B2:B100', { numberFormat: '$#,##0.00' });
92606
+ // Header row with borders
92607
+ await ws.formats.setRange('A1:F1', {
92608
+ bold: true,
92609
+ backgroundColor: '#4472c4',
92610
+ fontColor: '#ffffff',
92611
+ borders: { bottom: { style: 'medium', color: '#2f5496' } }
92612
+ });`,
92374
92613
  usedTypes: [
92375
92614
  "CellFormat",
92376
92615
  "FormatChangeResult"
@@ -94547,8 +94786,8 @@ var api_spec_default = {
94547
94786
  },
94548
94787
  AxisConfig: {
94549
94788
  name: "AxisConfig",
94550
- definition: "{\n xAxis?: {\n type: AxisType;\n title?: string;\n min?: number;\n max?: number;\n gridLines?: boolean;\n /** Show minor gridlines between major gridlines */\n minorGridLines?: boolean;\n majorUnit?: number;\n minorUnit?: number;\n tickMarks?: 'inside' | 'outside' | 'cross' | 'none';\n /** Minor tick mark style (separate from major tickMarks) */\n minorTickMarks?: 'inside' | 'outside' | 'cross' | 'none';\n numberFormat?: string;\n reverse?: boolean;\n visible?: boolean;\n position?: 'bottom' | 'top' | 'left' | 'right';\n logBase?: number;\n displayUnit?: string;\n };\n yAxis?: {\n type: AxisType;\n title?: string;\n min?: number;\n max?: number;\n gridLines?: boolean;\n /** Show minor gridlines between major gridlines */\n minorGridLines?: boolean;\n majorUnit?: number;\n minorUnit?: number;\n tickMarks?: 'inside' | 'outside' | 'cross' | 'none';\n /** Minor tick mark style (separate from major tickMarks) */\n minorTickMarks?: 'inside' | 'outside' | 'cross' | 'none';\n numberFormat?: string;\n reverse?: boolean;\n visible?: boolean;\n position?: 'bottom' | 'top' | 'left' | 'right';\n logBase?: number;\n displayUnit?: string;\n };\n secondaryYAxis?: {\n type: AxisType;\n title?: string;\n min?: number;\n max?: number;\n show: boolean;\n majorUnit?: number;\n minorUnit?: number;\n tickMarks?: 'inside' | 'outside' | 'cross' | 'none';\n /** Minor tick mark style (separate from major tickMarks) */\n minorTickMarks?: 'inside' | 'outside' | 'cross' | 'none';\n numberFormat?: string;\n reverse?: boolean;\n visible?: boolean;\n position?: 'bottom' | 'top' | 'left' | 'right';\n logBase?: number;\n displayUnit?: string;\n };\n}",
94551
- docstring: "Axis configuration"
94789
+ definition: "{\n categoryAxis?: SingleAxisConfig;\n valueAxis?: SingleAxisConfig;\n secondaryCategoryAxis?: SingleAxisConfig;\n secondaryValueAxis?: SingleAxisConfig;\n /** @deprecated Use categoryAxis instead */\n xAxis?: SingleAxisConfig;\n /** @deprecated Use valueAxis instead */\n yAxis?: SingleAxisConfig;\n /** @deprecated Use secondaryValueAxis instead */\n secondaryYAxis?: SingleAxisConfig;\n}",
94790
+ docstring: "Axis configuration (matches AxisData wire type).\n\nWire field names: categoryAxis, valueAxis, secondaryCategoryAxis, secondaryValueAxis.\nLegacy aliases: xAxis, yAxis, secondaryYAxis (mapped in chart-bridge)."
94552
94791
  },
94553
94792
  AxisType: {
94554
94793
  name: "AxisType",
@@ -94703,7 +94942,34 @@ var api_spec_default = {
94703
94942
  CellFormat: {
94704
94943
  name: "CellFormat",
94705
94944
  definition: `{
94945
+ /** Excel-compatible number format code string.
94946
+
94947
+ Common format codes:
94948
+ - Currency: '$#,##0.00'
94949
+ - Accounting: '_($* #,##0.00_);_($* (#,##0.00);_($* "-"??_);_(@_)'
94950
+ - Percentage: '0.00%'
94951
+ - Date: 'M/D/YYYY', 'YYYY-MM-DD', 'MMM D, YYYY'
94952
+ - Time: 'h:mm AM/PM', 'HH:mm:ss'
94953
+ - Number: '#,##0.00', '0.00'
94954
+ - Scientific: '0.00E+00'
94955
+ - Text: '@'
94956
+ - Fraction: '# ?/?'
94957
+
94958
+ See the \`formatPresets\` section in api-spec.json for the full catalog
94959
+ of 85+ pre-defined format codes with examples.
94960
+
94961
+ @example
94962
+ // Currency
94963
+ { numberFormat: '$#,##0.00' }
94964
+ // Percentage with 1 decimal
94965
+ { numberFormat: '0.0%' }
94966
+ // ISO date
94967
+ { numberFormat: 'YYYY-MM-DD' } */
94706
94968
  numberFormat?: string;
94969
+ /** Number format category hint. Auto-detected from numberFormat when not set.
94970
+ Valid values: 'general' | 'number' | 'currency' | 'accounting' | 'date' |
94971
+ 'time' | 'percentage' | 'fraction' | 'scientific' | 'text' |
94972
+ 'special' | 'custom' */
94707
94973
  numberFormatType?: NumberFormatType;
94708
94974
  fontFamily?: string;
94709
94975
  fontSize?: number;
@@ -94922,8 +95188,8 @@ Example: { ignoreError: true } to suppress error indicators. */
94922
95188
  },
94923
95189
  ChartBorder: {
94924
95190
  name: "ChartBorder",
94925
- definition: "{\n color?: string;\n width?: number;\n style?: 'solid' | 'dashed' | 'dotted' | 'none';\n}",
94926
- docstring: "Shared chart border configuration"
95191
+ definition: "{\n color?: string;\n width?: number;\n style?: string;\n}",
95192
+ docstring: "Shared chart border configuration (matches ChartBorderData wire type)"
94927
95193
  },
94928
95194
  ChartConfig: {
94929
95195
  name: "ChartConfig",
@@ -94954,7 +95220,10 @@ Example: { ignoreError: true } to suppress error indicators. */
94954
95220
  series?: SeriesConfig[];
94955
95221
  dataLabels?: DataLabelConfig;
94956
95222
  pieSlice?: PieSliceConfig;
95223
+ /** @deprecated Use trendlines[] instead \u2014 kept for backward compat */
94957
95224
  trendline?: TrendlineConfig;
95225
+ /** Wire-compatible trendline array */
95226
+ trendlines?: TrendlineConfig[];
94958
95227
  /** Connect scatter points with lines (scatter-lines variant) */
94959
95228
  showLines?: boolean;
94960
95229
  /** Use smooth curves for scatter lines (scatter-smooth-lines variant) */
@@ -95064,11 +95333,6 @@ that are stored on the chart but not part of the core config schema. */
95064
95333
  definition: "{\n /** Column index to write to (0-indexed) */\n columnIndex: number;\n /** JSONPath or field name to extract from data */\n dataPath: string;\n /** Optional transform formula (receives value as input) */\n transform?: string;\n /** Header text (if headerRow >= 0) */\n headerText?: string;\n}",
95065
95334
  docstring: "Column mapping for a sheet data binding."
95066
95335
  },
95067
- Comment: {
95068
- name: "Comment",
95069
- definition: "{\n id: string;\n cellId: string;\n cellAddress: string;\n text: string;\n author: string;\n threadId?: string;\n resolved?: boolean;\n createdAt?: number;\n parentId?: string;\n authorId?: string;\n modifiedAt?: number;\n content?: RichTextSegment[];\n}",
95070
- docstring: "A cell comment (thread-aware)."
95071
- },
95072
95336
  ConditionalFormat: {
95073
95337
  name: "ConditionalFormat",
95074
95338
  definition: "{\n /** Unique format identifier. */\n id: string;\n /** Cell ranges this format applies to. */\n ranges: CellRange[];\n /** Rules to evaluate (sorted by priority). */\n rules: CFRule[];\n}",
@@ -95126,8 +95390,8 @@ that are stored on the chart but not part of the core config schema. */
95126
95390
  },
95127
95391
  DataLabelConfig: {
95128
95392
  name: "DataLabelConfig",
95129
- definition: "{\n show: boolean;\n position?: 'inside' | 'outside' | 'top' | 'bottom' | 'left' | 'right';\n format?: string;\n showCategoryName?: boolean;\n showSeriesName?: boolean;\n showPercentage?: boolean;\n showBubbleSize?: boolean;\n showLegendKey?: boolean;\n separator?: string;\n /** Show leader lines connecting data labels to their data points (pie/doughnut charts) */\n showLeaderLines?: boolean;\n}",
95130
- docstring: "Data label configuration"
95393
+ definition: "{\n show: boolean;\n position?: string;\n format?: string;\n showValue?: boolean;\n showCategoryName?: boolean;\n showSeriesName?: boolean;\n showPercentage?: boolean;\n showBubbleSize?: boolean;\n showLegendKey?: boolean;\n separator?: string;\n showLeaderLines?: boolean;\n text?: string;\n}",
95394
+ docstring: "Data label configuration (matches DataLabelData wire type)"
95131
95395
  },
95132
95396
  DatePeriod: {
95133
95397
  name: "DatePeriod",
@@ -95181,8 +95445,8 @@ that are stored on the chart but not part of the core config schema. */
95181
95445
  },
95182
95446
  ErrorBarConfig: {
95183
95447
  name: "ErrorBarConfig",
95184
- definition: "{\n visible?: boolean;\n type?: 'fixedValue' | 'percentage' | 'standardDeviation' | 'standardError' | 'custom';\n include?: 'both' | 'plus' | 'minus';\n value?: number;\n}",
95185
- docstring: "Error bar configuration for series"
95448
+ definition: "{\n visible?: boolean;\n direction?: string;\n barType?: string;\n valueType?: string;\n value?: number;\n noEndCap?: boolean;\n}",
95449
+ docstring: "Error bar configuration for series (matches ErrorBarData wire type)"
95186
95450
  },
95187
95451
  ErrorVariant: {
95188
95452
  name: "ErrorVariant",
@@ -95224,7 +95488,7 @@ Used in condition filters where users specify rules like
95224
95488
  },
95225
95489
  FilterDetailInfo: {
95226
95490
  name: "FilterDetailInfo",
95227
- definition: "{\n /** Filter ID */\n id: string;\n /** Resolved numeric range of the filter */\n range: { startRow: number; startCol: number; endRow: number; endCol: number };\n /** Per-column filter criteria, keyed by header cell ID */\n columnFilters: Record<string, ColumnFilterCriteria>;\n}",
95491
+ definition: "{\n /** Filter ID */\n id: string;\n /** Resolved numeric range of the filter */\n range: { startRow: number; startCol: number; endRow: number; endCol: number };\n /** Per-column filter criteria, keyed by header cell ID */\n columnFilters: Record<string, ColumnFilter>;\n}",
95228
95492
  docstring: "Detailed filter information including resolved numeric range and column filters."
95229
95493
  },
95230
95494
  FilterInfo: {
@@ -95239,8 +95503,8 @@ Used in condition filters where users specify rules like
95239
95503
  },
95240
95504
  FilterState: {
95241
95505
  name: "FilterState",
95242
- definition: "{\n /** The range the auto-filter is applied to (A1 notation) */\n range: string;\n /** Per-column filter criteria, keyed by column index */\n columns: Map<number, ColumnFilterCriteria>;\n}",
95243
- docstring: "Current auto-filter state for a sheet."
95506
+ definition: "{\n /** The range the auto-filter is applied to (A1 notation) */\n range: string;\n /** Per-column filter criteria, keyed by column identifier (string) */\n columnFilters: Record<string, ColumnFilter>;\n}",
95507
+ docstring: "API filter state \u2014 derived from Rust FilterState with A1-notation range."
95244
95508
  },
95245
95509
  FloatingObject: {
95246
95510
  name: "FloatingObject",
@@ -95342,13 +95606,8 @@ Used in condition filters where users specify rules like
95342
95606
  },
95343
95607
  LegendConfig: {
95344
95608
  name: "LegendConfig",
95345
- definition: "{\n show: boolean;\n position: LegendPosition;\n visible?: boolean;\n overlay?: boolean;\n font?: ChartFont;\n}",
95346
- docstring: "Legend configuration"
95347
- },
95348
- LegendPosition: {
95349
- name: "LegendPosition",
95350
- definition: "'top' | 'bottom' | 'left' | 'right' | 'none'",
95351
- docstring: "Legend position options"
95609
+ definition: "{\n show: boolean;\n position: string;\n visible: boolean;\n overlay?: boolean;\n font?: ChartFont;\n}",
95610
+ docstring: "Legend configuration (matches LegendData wire type)"
95352
95611
  },
95353
95612
  LineDash: {
95354
95613
  name: "LineDash",
@@ -95413,7 +95672,7 @@ Used in condition filters where users specify rules like
95413
95672
  Note: {
95414
95673
  name: "Note",
95415
95674
  definition: "{\n content: string;\n author: string;\n cellAddress: string;\n}",
95416
- docstring: "A cell note (simple, single string per cell)."
95675
+ docstring: "A cell note (simple, single string per cell). API-only type (no Rust equivalent)."
95417
95676
  },
95418
95677
  NumberFormatCategory: {
95419
95678
  name: "NumberFormatCategory",
@@ -95434,11 +95693,6 @@ Used in condition filters where users specify rules like
95434
95693
  },
95435
95694
  docstring: "Number format category classification.\nMatches the FormatType enum from Rust compute-formats."
95436
95695
  },
95437
- NumberFormatType: {
95438
- name: "NumberFormatType",
95439
- definition: "| 'general'\n | 'number'\n | 'currency'\n | 'accounting'\n | 'date'\n | 'time'\n | 'percentage'\n | 'fraction'\n | 'scientific'\n | 'text'\n | 'special'\n | 'custom'",
95440
- docstring: "Number format types"
95441
- },
95442
95696
  ObjectAnchorType: {
95443
95697
  name: "ObjectAnchorType",
95444
95698
  definition: "| 'twoCell' // Anchored to two cells (moves and resizes with cells)\n | 'oneCell' // Anchored to one cell (moves but doesn't resize)\n | 'absolute'",
@@ -95550,8 +95804,8 @@ Used in condition filters where users specify rules like
95550
95804
  },
95551
95805
  PieSliceConfig: {
95552
95806
  name: "PieSliceConfig",
95553
- definition: "{\n /** Index of slice to explode (pull out from center) */\n explodedIndex?: number;\n /** Array of indices to explode */\n explodedIndices?: number[];\n /** Distance to explode (0-1, default 0.1) */\n explodeOffset?: number;\n /** Allow clicking to select/explode slices */\n selectable?: boolean;\n}",
95554
- docstring: "Pie/doughnut slice configuration for exploded slices"
95807
+ definition: "{\n explosion?: number;\n explodedIndices?: number[];\n explodeOffset?: number;\n}",
95808
+ docstring: "Pie/doughnut slice configuration (matches PieSliceData wire type)"
95555
95809
  },
95556
95810
  PivotQueryRecord: {
95557
95811
  name: "PivotQueryRecord",
@@ -95590,8 +95844,8 @@ Used in condition filters where users specify rules like
95590
95844
  },
95591
95845
  PointFormat: {
95592
95846
  name: "PointFormat",
95593
- definition: "{\n fill?: string;\n border?: ChartBorder;\n dataLabel?: DataLabelConfig;\n}",
95594
- docstring: "Per-point formatting for individual data points in a series"
95847
+ definition: "{\n idx: number;\n fill?: string;\n border?: ChartBorder;\n dataLabel?: DataLabelConfig;\n}",
95848
+ docstring: "Per-point formatting for individual data points (matches PointFormatData wire type)"
95595
95849
  },
95596
95850
  PrintSettings: {
95597
95851
  name: "PrintSettings",
@@ -95640,11 +95894,6 @@ Used in condition filters where users specify rules like
95640
95894
  definition: "{\n [K in keyof CellFormat]-?: CellFormat[K] | null;\n}",
95641
95895
  docstring: "Dense cell format where every property is explicitly present (null when unset). Returned by formats.get()."
95642
95896
  },
95643
- RichTextSegment: {
95644
- name: "RichTextSegment",
95645
- definition: "{\n text: string;\n bold?: boolean;\n italic?: boolean;\n underline?: boolean;\n strikethrough?: boolean;\n color?: string;\n fontName?: string;\n fontSize?: number;\n}",
95646
- docstring: "A single segment of rich text content."
95647
- },
95648
95897
  Scenario: {
95649
95898
  name: "Scenario",
95650
95899
  definition: "{\n /** Unique scenario ID */\n id: string;\n /** Creation timestamp (Unix ms) */\n createdAt: number;\n}",
@@ -95672,46 +95921,8 @@ Used in condition filters where users specify rules like
95672
95921
  },
95673
95922
  SeriesConfig: {
95674
95923
  name: "SeriesConfig",
95675
- definition: `{
95676
- name?: string;
95677
- type?: ChartType;
95678
- color?: string;
95679
- yAxisIndex?: 0 | 1;
95680
- showMarkers?: boolean;
95681
- markerSize?: number;
95682
- markerStyle?: | 'circle'
95683
- | 'dash'
95684
- | 'diamond'
95685
- | 'dot'
95686
- | 'picture'
95687
- | 'plus'
95688
- | 'square'
95689
- | 'star'
95690
- | 'triangle'
95691
- | 'x'
95692
- | 'auto'
95693
- | 'none';
95694
- lineWidth?: number;
95695
- smooth?: boolean;
95696
- dataLabels?: DataLabelConfig;
95697
- trendline?: TrendlineConfig;
95698
- errorBars?: ErrorBarConfig;
95699
- /** Separate X-axis error bars (for scatter/bubble charts) */
95700
- xErrorBars?: ErrorBarConfig;
95701
- /** Separate Y-axis error bars (for scatter/bubble charts) */
95702
- yErrorBars?: ErrorBarConfig;
95703
- /** Whether to invert the fill color for negative values */
95704
- invertIfNegative?: boolean;
95705
- /** Explosion distance for pie/doughnut per-series (0-400%) */
95706
- explosion?: number;
95707
- /** Data values range in A1 notation (e.g., "B2:B10") */
95708
- values?: string;
95709
- /** Category labels range in A1 notation (e.g., "A2:A10") */
95710
- categories?: string;
95711
- /** Per-point formatting overrides */
95712
- points?: PointFormat[];
95713
- }`,
95714
- docstring: "Individual series configuration"
95924
+ definition: "{\n name?: string;\n type?: string;\n color?: string;\n values?: string;\n categories?: string;\n bubbleSize?: string;\n smooth?: boolean;\n explosion?: number;\n invertIfNegative?: boolean;\n yAxisIndex?: number;\n showMarkers?: boolean;\n markerSize?: number;\n markerStyle?: string;\n lineWidth?: number;\n points?: PointFormat[];\n dataLabels?: DataLabelConfig;\n trendlines?: TrendlineConfig[];\n errorBars?: ErrorBarConfig;\n xErrorBars?: ErrorBarConfig;\n yErrorBars?: ErrorBarConfig;\n idx?: number;\n order?: number;\n /** @deprecated Use trendlines[] instead */\n trendline?: TrendlineConfig;\n}",
95925
+ docstring: "Individual series configuration (matches ChartSeriesData wire type)"
95715
95926
  },
95716
95927
  SeriesOrientation: {
95717
95928
  name: "SeriesOrientation",
@@ -95788,6 +95999,11 @@ Used in condition filters where users specify rules like
95788
95999
  definition: "{\n /** Sheet ID */\n id: string;\n /** Sheet name */\n name: string;\n /** Sheet index (0-based) */\n index: number;\n /** Range containing all non-empty cells (A1 notation), or null if empty */\n usedRange: string | null;\n /** Number of cells with data */\n cellCount: number;\n /** Number of cells with formulas */\n formulaCount: number;\n /** Number of charts in this sheet */\n chartCount: number;\n /** Sheet dimensions */\n dimensions: { rows: number; cols: number };\n}",
95789
96000
  docstring: "A summary snapshot of a single sheet."
95790
96001
  },
96002
+ SingleAxisConfig: {
96003
+ name: "SingleAxisConfig",
96004
+ definition: "{\n title?: string;\n visible: boolean;\n min?: number;\n max?: number;\n axisType?: string;\n gridLines?: boolean;\n minorGridLines?: boolean;\n majorUnit?: number;\n minorUnit?: number;\n tickMarks?: string;\n minorTickMarks?: string;\n numberFormat?: string;\n reverse?: boolean;\n position?: string;\n logBase?: number;\n displayUnit?: string;\n /** @deprecated Alias for axisType \u2014 kept for backward compat with charts package */\n type?: AxisType;\n /** @deprecated Alias for visible \u2014 kept for backward compat with charts package */\n show?: boolean;\n}",
96005
+ docstring: "Single axis configuration (matches SingleAxisData wire type)."
96006
+ },
95791
96007
  Slicer: {
95792
96008
  name: "Slicer",
95793
96009
  definition: "{\n /** Currently selected filter items */\n selectedItems: CellValue[];\n /** Position and dimensions in pixels */\n position: { x: number; y: number; width: number; height: number };\n}",
@@ -95795,7 +96011,7 @@ Used in condition filters where users specify rules like
95795
96011
  },
95796
96012
  SlicerConfig: {
95797
96013
  name: "SlicerConfig",
95798
- definition: "{\n /** Name of the table to connect the slicer to */\n tableName?: string;\n /** Column name within the table to filter on */\n columnName?: string;\n /** Display name for the slicer (auto-generated if omitted) */\n name?: string;\n /** Position and dimensions in pixels */\n position?: { x: number; y: number; width: number; height: number };\n /** Data source connection (rich alternative to tableName/columnName) */\n source?: SlicerSource;\n /** Slicer caption (header text) */\n caption?: string;\n /** Style configuration (partial for incremental updates) */\n style?: Partial<SlicerStyle>;\n /** Show slicer header */\n showHeader?: boolean;\n /** Currently selected date range start (timeline slicers) */\n selectedStartDate?: number;\n /** Currently selected date range end (timeline slicers) */\n selectedEndDate?: number;\n /** Current aggregation level (timeline slicers) */\n timelineLevel?: TimelineLevel;\n}",
96014
+ definition: "{\n /** Slicer ID (generated if omitted) */\n id?: string;\n /** Sheet ID the slicer belongs to */\n sheetId?: string;\n /** Name of the table to connect the slicer to */\n tableName?: string;\n /** Column name within the table to filter on */\n columnName?: string;\n /** Display name for the slicer (auto-generated if omitted) */\n name?: string;\n /** Position and dimensions in pixels */\n position?: { x: number; y: number; width: number; height: number };\n /** Data source connection (rich alternative to tableName/columnName) */\n source?: SlicerSource;\n /** Slicer caption (header text) */\n caption?: string;\n /** Style configuration */\n style?: SlicerStyle;\n /** Show slicer header */\n showHeader?: boolean;\n /** Z-order within the sheet */\n zIndex?: number;\n /** Whether slicer position is locked */\n locked?: boolean;\n /** Whether multi-select is enabled */\n multiSelect?: boolean;\n /** Initial selected values */\n selectedValues?: CellValue[];\n /** Currently selected date range start (timeline slicers) */\n selectedStartDate?: number;\n /** Currently selected date range end (timeline slicers) */\n selectedEndDate?: number;\n /** Current aggregation level (timeline slicers) */\n timelineLevel?: TimelineLevel;\n}",
95799
96015
  docstring: "Configuration for creating a new slicer."
95800
96016
  },
95801
96017
  SlicerCustomStyle: {
@@ -95905,13 +96121,13 @@ Used in condition filters where users specify rules like
95905
96121
  },
95906
96122
  TableColumn: {
95907
96123
  name: "TableColumn",
95908
- definition: "{\n /** Column header name */\n name: string;\n /** Column index within the table (0-based) */\n index: number;\n /** Total row function type */\n totalFunction?: TotalFunction;\n /** Calculated column formula */\n calculatedFormula?: string;\n}",
95909
- docstring: "A single column in a table."
96124
+ definition: "{\n /** Unique column ID */\n id: string;\n /** Column header name */\n name: string;\n /** Column index within the table (0-based) */\n index: number;\n /** Total row function type */\n totalsFunction: TotalsFunction | null;\n /** Total row label */\n totalsLabel: string | null;\n /** Calculated column formula */\n calculatedFormula?: string;\n}",
96125
+ docstring: "A single column in a table.\n\nField names match the Rust-generated `TableColumn` type (compute-types.gen.ts)."
95910
96126
  },
95911
96127
  TableInfo: {
95912
96128
  name: "TableInfo",
95913
- definition: "{\n /** Internal table identifier (opaque string) */\n id?: string;\n /** Table name */\n name: string;\n /** Table range in A1 notation */\n range: string;\n /** Whether the table has a header row */\n hasHeaders: boolean;\n /** Table style preset name */\n style?: TableStylePreset;\n /** Column definitions */\n columns: TableColumn[];\n /** Whether the total row is visible */\n showTotals?: boolean;\n /** Whether first column is highlighted */\n highlightFirstColumn?: boolean;\n /** Whether last column is highlighted */\n highlightLastColumn?: boolean;\n /** Whether banded columns are shown */\n showBandedColumns?: boolean;\n /** Whether banded rows are shown */\n showBandedRows?: boolean;\n /** Whether filter buttons are shown */\n showFilterButton?: boolean;\n /** Whether the header row is shown (mirrors hasHeaders) */\n showHeaders?: boolean;\n}",
95914
- docstring: "Information about an existing table."
96129
+ definition: "{\n /** Internal table identifier */\n id: string;\n /** Table name */\n name: string;\n /** Display name */\n displayName: string;\n /** Sheet the table belongs to */\n sheetId: string;\n /** Table range in A1 notation (converted from Rust SheetRange) */\n range: string;\n /** Column definitions */\n columns: TableColumn[];\n /** Whether the table has a header row */\n hasHeaderRow: boolean;\n /** Whether the totals row is visible */\n hasTotalsRow: boolean;\n /** Table style name */\n style: string;\n /** Whether banded rows are shown */\n bandedRows: boolean;\n /** Whether banded columns are shown */\n bandedColumns: boolean;\n /** Whether first column is emphasized */\n emphasizeFirstColumn: boolean;\n /** Whether last column is emphasized */\n emphasizeLastColumn: boolean;\n /** Whether filter buttons are shown */\n showFilterButtons: boolean;\n}",
96130
+ docstring: "Information about an existing table.\n\nField names match the Rust-generated `Table` type (compute-types.gen.ts)\nexcept `range` which is converted from `SheetRange` to A1 notation string."
95915
96131
  },
95916
96132
  TableOptions: {
95917
96133
  name: "TableOptions",
@@ -95923,16 +96139,6 @@ Used in condition filters where users specify rules like
95923
96139
  definition: "{\n /** Style name */\n name: string;\n}",
95924
96140
  docstring: "Configuration for creating/updating a custom table style."
95925
96141
  },
95926
- TableStyleInfo: {
95927
- name: "TableStyleInfo",
95928
- definition: "{\n /** Style name/ID */\n name: string;\n /** Display name */\n displayName?: string;\n /** Whether this is a built-in style */\n isBuiltIn?: boolean;\n}",
95929
- docstring: "Information about a custom table style."
95930
- },
95931
- TableStylePreset: {
95932
- name: "TableStylePreset",
95933
- definition: "| 'none'\n // Light styles\n | 'light1'\n | 'light2'\n | 'light3'\n | 'light4'\n | 'light5'\n | 'light6'\n | 'light7'\n | 'light8'\n | 'light9'\n | 'light10'\n | 'light11'\n | 'light12'\n | 'light13'\n | 'light14'\n | 'light15'\n | 'light16'\n | 'light17'\n | 'light18'\n | 'light19'\n | 'light20'\n | 'light21'\n // Medium styles\n | 'medium1'\n | 'medium2'\n | 'medium3'\n | 'medium4'\n | 'medium5'\n | 'medium6'\n | 'medium7'\n | 'medium8'\n | 'medium9'\n | 'medium10'\n | 'medium11'\n | 'medium12'\n | 'medium13'\n | 'medium14'\n | 'medium15'\n | 'medium16'\n | 'medium17'\n | 'medium18'\n | 'medium19'\n | 'medium20'\n | 'medium21'\n | 'medium22'\n | 'medium23'\n | 'medium24'\n | 'medium25'\n | 'medium26'\n | 'medium27'\n | 'medium28'\n // Dark styles\n | 'dark1'\n | 'dark2'\n | 'dark3'\n | 'dark4'\n | 'dark5'\n | 'dark6'\n | 'dark7'\n | 'dark8'\n | 'dark9'\n | 'dark10'\n | 'dark11'",
95934
- docstring: "Table style presets matching Excel's table style gallery.\nLight styles (1-21), Medium styles (1-28), Dark styles (1-11)."
95935
- },
95936
96142
  TextBoxBorder: {
95937
96143
  name: "TextBoxBorder",
95938
96144
  definition: "{\n /** Corner radius in pixels (for rounded corners) */\n radius?: number;\n}",
@@ -95992,20 +96198,15 @@ Used in condition filters where users specify rules like
95992
96198
  definition: "{\n text?: string;\n visible?: boolean;\n position?: 'top' | 'bottom' | 'left' | 'right' | 'overlay';\n font?: ChartFont;\n}",
95993
96199
  docstring: "Rich title configuration"
95994
96200
  },
95995
- TotalFunction: {
95996
- name: "TotalFunction",
95997
- definition: "| 'none'\n | 'sum'\n | 'count'\n | 'average'\n | 'min'\n | 'max'\n | 'stdDev'\n | 'var'\n | 'countNums'\n | 'custom'",
95998
- docstring: "Total row function types.\nMaps to Excel's total row dropdown options."
96201
+ TotalsFunction: {
96202
+ name: "TotalsFunction",
96203
+ definition: "| 'average'\n | 'count'\n | 'countNums'\n | 'max'\n | 'min'\n | 'stdDev'\n | 'sum'\n | 'var'\n | 'custom'\n | 'none'",
96204
+ docstring: "Totals function type (matches Rust TotalsFunction)."
95999
96205
  },
96000
96206
  TrendlineConfig: {
96001
96207
  name: "TrendlineConfig",
96002
- definition: "{\n show: boolean;\n type: TrendlineType;\n color?: string;\n lineWidth?: number;\n showEquation?: boolean;\n showR2?: boolean;\n order?: number;\n period?: number;\n intercept?: number;\n forwardPeriod?: number;\n backwardPeriod?: number;\n name?: string;\n}",
96003
- docstring: "Trendline configuration"
96004
- },
96005
- TrendlineType: {
96006
- name: "TrendlineType",
96007
- definition: "| 'linear'\n | 'exponential'\n | 'logarithmic'\n | 'polynomial'\n | 'power'\n | 'moving-average'",
96008
- docstring: "Trendline types for scatter charts"
96208
+ definition: "{\n show?: boolean;\n type?: string;\n color?: string;\n lineWidth?: number;\n order?: number;\n period?: number;\n forward?: number;\n backward?: number;\n intercept?: number;\n displayEquation?: boolean;\n displayRSquared?: boolean;\n name?: string;\n /** @deprecated Use displayEquation instead */\n showEquation?: boolean;\n /** @deprecated Use displayRSquared instead */\n showR2?: boolean;\n /** @deprecated Use forward instead */\n forwardPeriod?: number;\n /** @deprecated Use backward instead */\n backwardPeriod?: number;\n}",
96209
+ docstring: "Trendline configuration (matches TrendlineData wire type)"
96009
96210
  },
96010
96211
  UndoHistoryEntry: {
96011
96212
  name: "UndoHistoryEntry",
@@ -96124,6 +96325,415 @@ Used in condition filters where users specify rules like
96124
96325
  definition: "{\n /** All sheets in the workbook */\n sheets: SheetSnapshot[];\n /** ID of the currently active sheet */\n activeSheetId: string;\n /** Total number of sheets */\n sheetCount: number;\n}",
96125
96326
  docstring: "A summary snapshot of the entire workbook state."
96126
96327
  }
96328
+ },
96329
+ formatPresets: {
96330
+ general: {
96331
+ default: {
96332
+ code: "General",
96333
+ description: "",
96334
+ example: "1234.5"
96335
+ }
96336
+ },
96337
+ number: {
96338
+ integer: {
96339
+ code: "0",
96340
+ description: "No decimal places",
96341
+ example: "1235"
96342
+ },
96343
+ decimal1: {
96344
+ code: "0.0",
96345
+ description: "1 decimal place",
96346
+ example: "1234.5"
96347
+ },
96348
+ decimal2: {
96349
+ code: "0.00",
96350
+ description: "2 decimal places",
96351
+ example: "1234.50"
96352
+ },
96353
+ decimal3: {
96354
+ code: "0.000",
96355
+ description: "3 decimal places",
96356
+ example: "1234.500"
96357
+ },
96358
+ thousands: {
96359
+ code: "#,##0",
96360
+ description: "Thousands separator, no decimals",
96361
+ example: "1,235"
96362
+ },
96363
+ thousandsDecimal1: {
96364
+ code: "#,##0.0",
96365
+ description: "Thousands separator, 1 decimal",
96366
+ example: "1,234.5"
96367
+ },
96368
+ thousandsDecimal2: {
96369
+ code: "#,##0.00",
96370
+ description: "Thousands separator, 2 decimals",
96371
+ example: "1,234.50"
96372
+ },
96373
+ negativeRed: {
96374
+ code: "#,##0.00;[Red]-#,##0.00",
96375
+ description: "Red negative numbers",
96376
+ example: "-1,234.50"
96377
+ },
96378
+ negativeParens: {
96379
+ code: "#,##0.00;(#,##0.00)",
96380
+ description: "Parentheses for negatives",
96381
+ example: "(1,234.50)"
96382
+ },
96383
+ negativeParensRed: {
96384
+ code: "#,##0.00;[Red](#,##0.00)",
96385
+ description: "Red parentheses for negatives",
96386
+ example: "(1,234.50)"
96387
+ }
96388
+ },
96389
+ currency: {
96390
+ usd: {
96391
+ code: "$#,##0.00",
96392
+ description: "US Dollar",
96393
+ example: "$1,234.50"
96394
+ },
96395
+ usdNegMinus: {
96396
+ code: "$#,##0.00;-$#,##0.00",
96397
+ description: "USD minus",
96398
+ example: "-$1,234.50"
96399
+ },
96400
+ usdNegParens: {
96401
+ code: "$#,##0.00;($#,##0.00)",
96402
+ description: "USD parentheses",
96403
+ example: "($1,234.50)"
96404
+ },
96405
+ usdNegRed: {
96406
+ code: "$#,##0.00;[Red]-$#,##0.00",
96407
+ description: "USD red minus",
96408
+ example: "-$1,234.50"
96409
+ },
96410
+ usdNegParensRed: {
96411
+ code: "$#,##0.00;[Red]($#,##0.00)",
96412
+ description: "USD red parentheses",
96413
+ example: "($1,234.50)"
96414
+ },
96415
+ eur: {
96416
+ code: "\u20AC#,##0.00",
96417
+ description: "Euro",
96418
+ example: "\u20AC1,234.50"
96419
+ },
96420
+ gbp: {
96421
+ code: "\xA3#,##0.00",
96422
+ description: "British Pound",
96423
+ example: "\xA31,234.50"
96424
+ },
96425
+ jpy: {
96426
+ code: "\xA5#,##0",
96427
+ description: "Japanese Yen (no decimals)",
96428
+ example: "\xA51,235"
96429
+ },
96430
+ cny: {
96431
+ code: "\xA5#,##0.00",
96432
+ description: "Chinese Yuan",
96433
+ example: "\xA51,234.50"
96434
+ },
96435
+ inr: {
96436
+ code: "\u20B9#,##0.00",
96437
+ description: "Indian Rupee",
96438
+ example: "\u20B91,234.50"
96439
+ },
96440
+ krw: {
96441
+ code: "\u20A9#,##0",
96442
+ description: "Korean Won (no decimals)",
96443
+ example: "\u20A91,235"
96444
+ },
96445
+ chf: {
96446
+ code: "CHF #,##0.00",
96447
+ description: "Swiss Franc",
96448
+ example: "CHF 1,234.50"
96449
+ },
96450
+ cad: {
96451
+ code: "CA$#,##0.00",
96452
+ description: "Canadian Dollar",
96453
+ example: "CA$1,234.50"
96454
+ },
96455
+ aud: {
96456
+ code: "A$#,##0.00",
96457
+ description: "Australian Dollar",
96458
+ example: "A$1,234.50"
96459
+ }
96460
+ },
96461
+ accounting: {
96462
+ usd: {
96463
+ code: '_($* #,##0.00_);_($* (#,##0.00);_($* "-"??_);_(@_)',
96464
+ description: "USD Accounting",
96465
+ example: "$ 1,234.50"
96466
+ },
96467
+ eur: {
96468
+ code: '_(\u20AC* #,##0.00_);_(\u20AC* (#,##0.00);_(\u20AC* "-"??_);_(@_)',
96469
+ description: "EUR Accounting",
96470
+ example: "\u20AC 1,234.50"
96471
+ },
96472
+ gbp: {
96473
+ code: '_(\xA3* #,##0.00_);_(\xA3* (#,##0.00);_(\xA3* "-"??_);_(@_)',
96474
+ description: "GBP Accounting",
96475
+ example: "\xA3 1,234.50"
96476
+ }
96477
+ },
96478
+ date: {
96479
+ shortUS: {
96480
+ code: "m/d/yyyy",
96481
+ description: "Short date (US)",
96482
+ example: "12/13/2025"
96483
+ },
96484
+ mediumUS: {
96485
+ code: "mmm d, yyyy",
96486
+ description: "Medium date (US)",
96487
+ example: "Dec 13, 2025"
96488
+ },
96489
+ longUS: {
96490
+ code: "mmmm d, yyyy",
96491
+ description: "Long date (US)",
96492
+ example: "December 13, 2025"
96493
+ },
96494
+ fullUS: {
96495
+ code: "dddd, mmmm d, yyyy",
96496
+ description: "Full date (US)",
96497
+ example: "Saturday, December 13, 2025"
96498
+ },
96499
+ iso: {
96500
+ code: "yyyy-mm-dd",
96501
+ description: "ISO 8601",
96502
+ example: "2025-12-13"
96503
+ },
96504
+ shortEU: {
96505
+ code: "d/m/yyyy",
96506
+ description: "Short date (EU)",
96507
+ example: "13/12/2025"
96508
+ },
96509
+ mediumEU: {
96510
+ code: "d mmm yyyy",
96511
+ description: "Medium date (EU)",
96512
+ example: "13 Dec 2025"
96513
+ },
96514
+ longEU: {
96515
+ code: "d mmmm yyyy",
96516
+ description: "Long date (EU)",
96517
+ example: "13 December 2025"
96518
+ },
96519
+ monthYear: {
96520
+ code: "mmmm yyyy",
96521
+ description: "Month and year",
96522
+ example: "December 2025"
96523
+ },
96524
+ monthYearShort: {
96525
+ code: "mmm yyyy",
96526
+ description: "Short month and year",
96527
+ example: "Dec 2025"
96528
+ },
96529
+ dayMonth: {
96530
+ code: "d mmmm",
96531
+ description: "Day and month",
96532
+ example: "13 December"
96533
+ },
96534
+ dayMonthShort: {
96535
+ code: "d mmm",
96536
+ description: "Short day and month",
96537
+ example: "13 Dec"
96538
+ },
96539
+ excelShort: {
96540
+ code: "m/d/yy",
96541
+ description: "Excel short date",
96542
+ example: "12/13/25"
96543
+ },
96544
+ excelMedium: {
96545
+ code: "d-mmm-yy",
96546
+ description: "Excel medium date",
96547
+ example: "13-Dec-25"
96548
+ },
96549
+ excelLong: {
96550
+ code: "d-mmm-yyyy",
96551
+ description: "Excel long date",
96552
+ example: "13-Dec-2025"
96553
+ }
96554
+ },
96555
+ time: {
96556
+ short12: {
96557
+ code: "h:mm AM/PM",
96558
+ description: "12-hour short",
96559
+ example: "3:45 PM"
96560
+ },
96561
+ long12: {
96562
+ code: "h:mm:ss AM/PM",
96563
+ description: "12-hour with seconds",
96564
+ example: "3:45:30 PM"
96565
+ },
96566
+ short24: {
96567
+ code: "HH:mm",
96568
+ description: "24-hour short",
96569
+ example: "15:45"
96570
+ },
96571
+ long24: {
96572
+ code: "HH:mm:ss",
96573
+ description: "24-hour with seconds",
96574
+ example: "15:45:30"
96575
+ },
96576
+ dateTime12: {
96577
+ code: "m/d/yyyy h:mm AM/PM",
96578
+ description: "Date and 12-hour time",
96579
+ example: "12/13/2025 3:45 PM"
96580
+ },
96581
+ dateTime24: {
96582
+ code: "yyyy-mm-dd HH:mm",
96583
+ description: "ISO date and 24-hour time",
96584
+ example: "2025-12-13 15:45"
96585
+ },
96586
+ durationHM: {
96587
+ code: "[h]:mm",
96588
+ description: "Hours and minutes (elapsed)",
96589
+ example: "25:30"
96590
+ },
96591
+ durationHMS: {
96592
+ code: "[h]:mm:ss",
96593
+ description: "Hours, minutes, seconds (elapsed)",
96594
+ example: "25:30:45"
96595
+ },
96596
+ durationMS: {
96597
+ code: "[mm]:ss",
96598
+ description: "Minutes and seconds (elapsed)",
96599
+ example: "1530:45"
96600
+ }
96601
+ },
96602
+ percentage: {
96603
+ integer: {
96604
+ code: "0%",
96605
+ description: "No decimal places",
96606
+ example: "50%"
96607
+ },
96608
+ decimal1: {
96609
+ code: "0.0%",
96610
+ description: "1 decimal place",
96611
+ example: "50.0%"
96612
+ },
96613
+ decimal2: {
96614
+ code: "0.00%",
96615
+ description: "2 decimal places",
96616
+ example: "50.00%"
96617
+ },
96618
+ decimal3: {
96619
+ code: "0.000%",
96620
+ description: "3 decimal places",
96621
+ example: "50.000%"
96622
+ }
96623
+ },
96624
+ fraction: {
96625
+ halves: {
96626
+ code: "# ?/2",
96627
+ description: "Halves (1/2)",
96628
+ example: "1 1/2"
96629
+ },
96630
+ quarters: {
96631
+ code: "# ?/4",
96632
+ description: "Quarters (1/4)",
96633
+ example: "1 1/4"
96634
+ },
96635
+ eighths: {
96636
+ code: "# ?/8",
96637
+ description: "Eighths (1/8)",
96638
+ example: "1 3/8"
96639
+ },
96640
+ sixteenths: {
96641
+ code: "# ??/16",
96642
+ description: "Sixteenths (1/16)",
96643
+ example: "1 5/16"
96644
+ },
96645
+ tenths: {
96646
+ code: "# ?/10",
96647
+ description: "Tenths (1/10)",
96648
+ example: "1 3/10"
96649
+ },
96650
+ hundredths: {
96651
+ code: "# ??/100",
96652
+ description: "Hundredths (1/100)",
96653
+ example: "1 25/100"
96654
+ },
96655
+ upToOneDigit: {
96656
+ code: "# ?/?",
96657
+ description: "Up to one digit (1/4)",
96658
+ example: "1 2/3"
96659
+ },
96660
+ upToTwoDigits: {
96661
+ code: "# ??/??",
96662
+ description: "Up to two digits (21/25)",
96663
+ example: "1 25/67"
96664
+ },
96665
+ upToThreeDigits: {
96666
+ code: "# ???/???",
96667
+ description: "Up to three digits (312/943)",
96668
+ example: "1 312/943"
96669
+ }
96670
+ },
96671
+ scientific: {
96672
+ default: {
96673
+ code: "0.00E+00",
96674
+ description: "2 decimal places",
96675
+ example: "1.23E+03"
96676
+ },
96677
+ decimal1: {
96678
+ code: "0.0E+00",
96679
+ description: "1 decimal place",
96680
+ example: "1.2E+03"
96681
+ },
96682
+ decimal3: {
96683
+ code: "0.000E+00",
96684
+ description: "3 decimal places",
96685
+ example: "1.235E+03"
96686
+ },
96687
+ noDecimals: {
96688
+ code: "0E+00",
96689
+ description: "No decimal places",
96690
+ example: "1E+03"
96691
+ }
96692
+ },
96693
+ text: {
96694
+ default: {
96695
+ code: "@",
96696
+ description: "Display as entered",
96697
+ example: "1234"
96698
+ }
96699
+ },
96700
+ special: {
96701
+ zipCode: {
96702
+ code: "00000",
96703
+ description: "ZIP Code (5-digit)",
96704
+ example: "01234"
96705
+ },
96706
+ zipPlus4: {
96707
+ code: "00000-0000",
96708
+ description: "ZIP+4 Code",
96709
+ example: "01234-5678"
96710
+ },
96711
+ phone: {
96712
+ code: "(###) ###-####",
96713
+ description: "Phone Number",
96714
+ example: "(555) 123-4567"
96715
+ },
96716
+ ssn: {
96717
+ code: "000-00-0000",
96718
+ description: "Social Security Number",
96719
+ example: "123-45-6789"
96720
+ }
96721
+ },
96722
+ custom: {}
96723
+ },
96724
+ defaultFormats: {
96725
+ accounting: '_($* #,##0.00_);_($* (#,##0.00);_($* "-"??_);_(@_)',
96726
+ currency: "$#,##0.00",
96727
+ custom: "General",
96728
+ date: "m/d/yyyy",
96729
+ fraction: "# ?/?",
96730
+ general: "General",
96731
+ number: "#,##0.00",
96732
+ percentage: "0.00%",
96733
+ scientific: "0.00E+00",
96734
+ special: "00000",
96735
+ text: "@",
96736
+ time: "h:mm AM/PM"
96127
96737
  }
96128
96738
  };
96129
96739