@pixerate/editor 0.22.0 → 0.24.0

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.
Files changed (188) hide show
  1. package/README.md +175 -2
  2. package/THIRD_PARTY_NOTICES.md +139 -0
  3. package/dist/agent/index.cjs +87 -111
  4. package/dist/agent/index.cjs.map +1 -1
  5. package/dist/agent/index.d.cts +70 -211
  6. package/dist/agent/index.d.ts +70 -211
  7. package/dist/agent/index.js +78 -102
  8. package/dist/agent/index.js.map +1 -1
  9. package/dist/arrangeShortcuts-B8O3f8-P.d.cts +184 -0
  10. package/dist/arrangeShortcuts-sLlD2rSX.d.ts +184 -0
  11. package/dist/canvas/index.cjs +2075 -86
  12. package/dist/canvas/index.cjs.map +1 -1
  13. package/dist/canvas/index.d.cts +608 -186
  14. package/dist/canvas/index.d.ts +608 -186
  15. package/dist/canvas/index.js +2060 -71
  16. package/dist/canvas/index.js.map +1 -1
  17. package/dist/chunk-26BVFKHU.cjs +453 -0
  18. package/dist/chunk-26BVFKHU.cjs.map +1 -0
  19. package/dist/chunk-2H7ZHPEJ.js +762 -0
  20. package/dist/chunk-2H7ZHPEJ.js.map +1 -0
  21. package/dist/{chunk-DENSCKFC.js → chunk-3CN2WD3X.js} +1730 -189
  22. package/dist/chunk-3CN2WD3X.js.map +1 -0
  23. package/dist/{chunk-JJDLPEWL.js → chunk-3LV6RRPH.js} +2 -2
  24. package/dist/{chunk-MJZBNWG7.js → chunk-5S3Z4PPF.js} +78 -557
  25. package/dist/chunk-5S3Z4PPF.js.map +1 -0
  26. package/dist/chunk-664LQYFJ.js +115 -0
  27. package/dist/chunk-664LQYFJ.js.map +1 -0
  28. package/dist/chunk-7DWMJCAT.js +453 -0
  29. package/dist/chunk-7DWMJCAT.js.map +1 -0
  30. package/dist/chunk-ARRTP33I.js +101 -0
  31. package/dist/chunk-ARRTP33I.js.map +1 -0
  32. package/dist/chunk-CPOKFNBG.cjs +101 -0
  33. package/dist/chunk-CPOKFNBG.cjs.map +1 -0
  34. package/dist/{chunk-AA4ZEVCC.cjs → chunk-D27YFC46.cjs} +101 -580
  35. package/dist/chunk-D27YFC46.cjs.map +1 -0
  36. package/dist/chunk-D6FH2YAX.cjs +131 -0
  37. package/dist/chunk-D6FH2YAX.cjs.map +1 -0
  38. package/dist/{chunk-4SUNJZWB.cjs → chunk-FD4LPFAE.cjs} +48 -200
  39. package/dist/chunk-FD4LPFAE.cjs.map +1 -0
  40. package/dist/chunk-FODNLX5N.js +749 -0
  41. package/dist/chunk-FODNLX5N.js.map +1 -0
  42. package/dist/{chunk-OYXSKQFR.js → chunk-FPENXAEJ.js} +35 -187
  43. package/dist/chunk-FPENXAEJ.js.map +1 -0
  44. package/dist/chunk-G2I4QJOT.cjs +762 -0
  45. package/dist/chunk-G2I4QJOT.cjs.map +1 -0
  46. package/dist/chunk-HLIMTC6N.js +1 -0
  47. package/dist/chunk-HLIMTC6N.js.map +1 -0
  48. package/dist/{chunk-QGHGJ56O.js → chunk-ITBSKI26.js} +1483 -19
  49. package/dist/chunk-ITBSKI26.js.map +1 -0
  50. package/dist/{chunk-6M3BCTBD.cjs → chunk-MA2F5KHF.cjs} +470 -242
  51. package/dist/chunk-MA2F5KHF.cjs.map +1 -0
  52. package/dist/{chunk-SAZRENEZ.cjs → chunk-MCSJFWAO.cjs} +1733 -192
  53. package/dist/chunk-MCSJFWAO.cjs.map +1 -0
  54. package/dist/chunk-MKA3AHLV.cjs +256 -0
  55. package/dist/chunk-MKA3AHLV.cjs.map +1 -0
  56. package/dist/chunk-OLZJXL4R.cjs +749 -0
  57. package/dist/chunk-OLZJXL4R.cjs.map +1 -0
  58. package/dist/chunk-OXSV64JX.js +689 -0
  59. package/dist/chunk-OXSV64JX.js.map +1 -0
  60. package/dist/chunk-P3RQ5UJE.cjs +689 -0
  61. package/dist/chunk-P3RQ5UJE.cjs.map +1 -0
  62. package/dist/chunk-P6ODPZ4W.js +256 -0
  63. package/dist/chunk-P6ODPZ4W.js.map +1 -0
  64. package/dist/chunk-PGNZKFQS.js +685 -0
  65. package/dist/chunk-PGNZKFQS.js.map +1 -0
  66. package/dist/chunk-PL4JB3BF.cjs +1 -0
  67. package/dist/chunk-PL4JB3BF.cjs.map +1 -0
  68. package/dist/{chunk-GVSMRPHB.cjs → chunk-SBCZ6RN5.cjs} +1568 -104
  69. package/dist/chunk-SBCZ6RN5.cjs.map +1 -0
  70. package/dist/{chunk-CL37JGFW.cjs → chunk-SML64VJG.cjs} +4 -4
  71. package/dist/{chunk-CL37JGFW.cjs.map → chunk-SML64VJG.cjs.map} +1 -1
  72. package/dist/chunk-TNNJXF46.cjs +115 -0
  73. package/dist/chunk-TNNJXF46.cjs.map +1 -0
  74. package/dist/chunk-U5HZSFCS.js +131 -0
  75. package/dist/chunk-U5HZSFCS.js.map +1 -0
  76. package/dist/{chunk-RU52I7QO.js → chunk-U5KWZU4X.js} +388 -160
  77. package/dist/chunk-U5KWZU4X.js.map +1 -0
  78. package/dist/chunk-XNORY7M6.cjs +685 -0
  79. package/dist/chunk-XNORY7M6.cjs.map +1 -0
  80. package/dist/commands/index.cjs +860 -0
  81. package/dist/commands/index.cjs.map +1 -0
  82. package/dist/commands/index.d.cts +244 -0
  83. package/dist/commands/index.d.ts +244 -0
  84. package/dist/commands/index.js +860 -0
  85. package/dist/commands/index.js.map +1 -0
  86. package/dist/comment-store-BEMgVlAA.d.cts +135 -0
  87. package/dist/comment-store-BEMgVlAA.d.ts +135 -0
  88. package/dist/compare/index.cjs +15 -0
  89. package/dist/compare/index.cjs.map +1 -0
  90. package/dist/compare/index.d.cts +58 -0
  91. package/dist/compare/index.d.ts +58 -0
  92. package/dist/compare/index.js +15 -0
  93. package/dist/compare/index.js.map +1 -0
  94. package/dist/{controller-B7GIybc4.d.cts → controller-BhLLAoi8.d.cts} +119 -5
  95. package/dist/{controller-B7GIybc4.d.ts → controller-BhLLAoi8.d.ts} +119 -5
  96. package/dist/documents-BQjzJNe2.d.ts +76 -0
  97. package/dist/documents-KRTPhvst.d.cts +76 -0
  98. package/dist/extensions/index.cjs +53 -5
  99. package/dist/extensions/index.cjs.map +1 -1
  100. package/dist/extensions/index.d.cts +7 -3
  101. package/dist/extensions/index.d.ts +7 -3
  102. package/dist/extensions/index.js +52 -4
  103. package/dist/generation/index.cjs +1373 -0
  104. package/dist/generation/index.cjs.map +1 -0
  105. package/dist/generation/index.d.cts +554 -0
  106. package/dist/generation/index.d.ts +554 -0
  107. package/dist/generation/index.js +1373 -0
  108. package/dist/generation/index.js.map +1 -0
  109. package/dist/grammar/index.cjs +48 -3
  110. package/dist/grammar/index.cjs.map +1 -1
  111. package/dist/grammar/index.d.cts +322 -100
  112. package/dist/grammar/index.d.ts +322 -100
  113. package/dist/grammar/index.js +54 -9
  114. package/dist/history/index.cjs +12 -2
  115. package/dist/history/index.cjs.map +1 -1
  116. package/dist/history/index.d.cts +211 -7
  117. package/dist/history/index.d.ts +211 -7
  118. package/dist/history/index.js +13 -3
  119. package/dist/image-editor/index.cjs +2244 -38
  120. package/dist/image-editor/index.cjs.map +1 -1
  121. package/dist/image-editor/index.d.cts +742 -4
  122. package/dist/image-editor/index.d.ts +742 -4
  123. package/dist/image-editor/index.js +2222 -16
  124. package/dist/image-editor/index.js.map +1 -1
  125. package/dist/{index-CCr_z9kF.d.cts → index-BhJBSm2d.d.cts} +370 -4
  126. package/dist/{index-Ck6ajwXh.d.ts → index-fJrlkJCd.d.ts} +370 -4
  127. package/dist/index.cjs +193 -98
  128. package/dist/index.cjs.map +1 -1
  129. package/dist/index.d.cts +17 -48
  130. package/dist/index.d.ts +17 -48
  131. package/dist/index.js +198 -103
  132. package/dist/index.js.map +1 -1
  133. package/dist/migrate-iTlm3a8h.d.cts +112 -0
  134. package/dist/migrate-iTlm3a8h.d.ts +112 -0
  135. package/dist/persistence/index.cjs +676 -0
  136. package/dist/persistence/index.cjs.map +1 -0
  137. package/dist/persistence/index.d.cts +347 -0
  138. package/dist/persistence/index.d.ts +347 -0
  139. package/dist/persistence/index.js +676 -0
  140. package/dist/persistence/index.js.map +1 -0
  141. package/dist/registry-BDe-vlv3.d.ts +171 -0
  142. package/dist/registry-D32LpIc4.d.cts +354 -0
  143. package/dist/registry-DnzpgY27.d.cts +171 -0
  144. package/dist/registry-evKTP4ls.d.ts +354 -0
  145. package/dist/schema-DYDGdYL9.d.cts +41 -0
  146. package/dist/schema-DYDGdYL9.d.ts +41 -0
  147. package/dist/serializers/index.cjs +4 -3
  148. package/dist/serializers/index.cjs.map +1 -1
  149. package/dist/serializers/index.d.cts +2 -1
  150. package/dist/serializers/index.d.ts +2 -1
  151. package/dist/serializers/index.js +3 -2
  152. package/dist/sourcemap-C8AH3MBQ.d.cts +91 -0
  153. package/dist/sourcemap-DA1Evhrv.d.ts +91 -0
  154. package/dist/spreadsheet/index.cjs +53 -3
  155. package/dist/spreadsheet/index.cjs.map +1 -1
  156. package/dist/spreadsheet/index.d.cts +247 -18
  157. package/dist/spreadsheet/index.d.ts +247 -18
  158. package/dist/spreadsheet/index.js +58 -8
  159. package/dist/{tokens-CyLZmIei.d.cts → tokens-D7yXvUU6.d.cts} +15 -2
  160. package/dist/{tokens-CyLZmIei.d.ts → tokens-D7yXvUU6.d.ts} +15 -2
  161. package/dist/{track-changes-BSF58RK0.d.cts → track-changes-BK5sVf4_.d.cts} +18 -136
  162. package/dist/{track-changes-BSF58RK0.d.ts → track-changes-CDjCrwKe.d.ts} +18 -136
  163. package/dist/{types-CJ4U-HHI.d.ts → types-DX4Mh4SL.d.cts} +1 -1
  164. package/dist/{types-CJ4U-HHI.d.cts → types-DX4Mh4SL.d.ts} +1 -1
  165. package/dist/types-GT5a5YAX.d.cts +86 -0
  166. package/dist/types-GT5a5YAX.d.ts +86 -0
  167. package/package.json +23 -2
  168. package/dist/chunk-2TWGLC5K.cjs +0 -262
  169. package/dist/chunk-2TWGLC5K.cjs.map +0 -1
  170. package/dist/chunk-4SUNJZWB.cjs.map +0 -1
  171. package/dist/chunk-6M3BCTBD.cjs.map +0 -1
  172. package/dist/chunk-AA4ZEVCC.cjs.map +0 -1
  173. package/dist/chunk-AXV2ZW34.cjs +0 -118
  174. package/dist/chunk-AXV2ZW34.cjs.map +0 -1
  175. package/dist/chunk-B2ZRLN4S.js +0 -118
  176. package/dist/chunk-B2ZRLN4S.js.map +0 -1
  177. package/dist/chunk-DENSCKFC.js.map +0 -1
  178. package/dist/chunk-GVSMRPHB.cjs.map +0 -1
  179. package/dist/chunk-KAADNAPF.js +0 -262
  180. package/dist/chunk-KAADNAPF.js.map +0 -1
  181. package/dist/chunk-MJZBNWG7.js.map +0 -1
  182. package/dist/chunk-OYXSKQFR.js.map +0 -1
  183. package/dist/chunk-QGHGJ56O.js.map +0 -1
  184. package/dist/chunk-RU52I7QO.js.map +0 -1
  185. package/dist/chunk-SAZRENEZ.cjs.map +0 -1
  186. package/dist/types-BZgcDsC5.d.cts +0 -42
  187. package/dist/types-BZgcDsC5.d.ts +0 -42
  188. /package/dist/{chunk-JJDLPEWL.js.map → chunk-3LV6RRPH.js.map} +0 -0
@@ -3,6 +3,7 @@
3
3
 
4
4
 
5
5
 
6
+ var _chunkTNNJXF46cjs = require('./chunk-TNNJXF46.cjs');
6
7
 
7
8
 
8
9
 
@@ -12,7 +13,21 @@
12
13
 
13
14
 
14
15
 
15
- var _chunkSAZRENEZcjs = require('./chunk-SAZRENEZ.cjs');
16
+
17
+
18
+
19
+
20
+
21
+
22
+
23
+
24
+
25
+
26
+
27
+
28
+
29
+
30
+ var _chunkMCSJFWAOcjs = require('./chunk-MCSJFWAO.cjs');
16
31
 
17
32
  // src/spreadsheet/formula/dependency-graph.ts
18
33
  var columnDependencyKey = (col) => `${col.toUpperCase()}:`;
@@ -23,22 +38,22 @@ function extractCellDependencies(node) {
23
38
  deps.push({ col: curr.col, row: curr.row });
24
39
  } else if (curr.type === "SpillRef") {
25
40
  deps.push({ col: curr.col, row: curr.row });
26
- } else if (curr.type === "Range" && curr.endRow >= _chunkSAZRENEZcjs.WHOLE_COLUMN_END_ROW) {
27
- const startC = _chunkSAZRENEZcjs.colNameToIndex.call(void 0, curr.startCol);
28
- const endC = _chunkSAZRENEZcjs.colNameToIndex.call(void 0, curr.endCol);
41
+ } else if (curr.type === "Range" && curr.endRow >= _chunkMCSJFWAOcjs.WHOLE_COLUMN_END_ROW) {
42
+ const startC = _chunkMCSJFWAOcjs.colNameToIndex.call(void 0, curr.startCol);
43
+ const endC = _chunkMCSJFWAOcjs.colNameToIndex.call(void 0, curr.endCol);
29
44
  for (let c = Math.min(startC, endC); c <= Math.max(startC, endC); c++) {
30
- deps.push({ col: _chunkSAZRENEZcjs.indexToColName.call(void 0, c), row: 0 });
45
+ deps.push({ col: _chunkMCSJFWAOcjs.indexToColName.call(void 0, c), row: 0 });
31
46
  }
32
47
  } else if (curr.type === "Range") {
33
- const startC = _chunkSAZRENEZcjs.colNameToIndex.call(void 0, curr.startCol);
34
- const endC = _chunkSAZRENEZcjs.colNameToIndex.call(void 0, curr.endCol);
48
+ const startC = _chunkMCSJFWAOcjs.colNameToIndex.call(void 0, curr.startCol);
49
+ const endC = _chunkMCSJFWAOcjs.colNameToIndex.call(void 0, curr.endCol);
35
50
  const minC = Math.min(startC, endC);
36
51
  const maxC = Math.max(startC, endC);
37
52
  const minR = Math.min(curr.startRow, curr.endRow);
38
53
  const maxR = Math.max(curr.startRow, curr.endRow);
39
54
  for (let c = minC; c <= maxC; c++) {
40
55
  for (let r = minR; r <= maxR; r++) {
41
- deps.push({ col: _chunkSAZRENEZcjs.indexToColName.call(void 0, c), row: r });
56
+ deps.push({ col: _chunkMCSJFWAOcjs.indexToColName.call(void 0, c), row: r });
42
57
  }
43
58
  }
44
59
  } else if (curr.type === "BinaryOp") {
@@ -77,7 +92,7 @@ var DependencyGraph = (_class = class {constructor() { _class.prototype.__init.c
77
92
  return;
78
93
  }
79
94
  try {
80
- const ast = _chunkSAZRENEZcjs.parseFormula.call(void 0, formulaStr);
95
+ const ast = _chunkMCSJFWAOcjs.parseFormula.call(void 0, formulaStr);
81
96
  const deps = extractCellDependencies(ast);
82
97
  const newDeps = /* @__PURE__ */ new Set();
83
98
  for (const d of deps) {
@@ -323,19 +338,19 @@ function parsePart(text) {
323
338
  if (cell) {
324
339
  return {
325
340
  colAbs: cell[1],
326
- col: _chunkSAZRENEZcjs.colNameToIndex.call(void 0, cell[2]),
341
+ col: _chunkMCSJFWAOcjs.colNameToIndex.call(void 0, cell[2]),
327
342
  rowAbs: cell[3],
328
343
  row: parseInt(cell[4], 10) - 1
329
344
  };
330
345
  }
331
346
  const column = COLUMN_PART.exec(text);
332
347
  if (column) {
333
- return { colAbs: column[1], col: _chunkSAZRENEZcjs.colNameToIndex.call(void 0, column[2]), rowAbs: "", row: null };
348
+ return { colAbs: column[1], col: _chunkMCSJFWAOcjs.colNameToIndex.call(void 0, column[2]), rowAbs: "", row: null };
334
349
  }
335
350
  return null;
336
351
  }
337
352
  function formatPart(part) {
338
- const col = `${part.colAbs}${_chunkSAZRENEZcjs.indexToColName.call(void 0, part.col)}`;
353
+ const col = `${part.colAbs}${_chunkMCSJFWAOcjs.indexToColName.call(void 0, part.col)}`;
339
354
  return part.row === null ? col : `${col}${part.rowAbs}${part.row + 1}`;
340
355
  }
341
356
  function shiftCoordinate(value, change) {
@@ -382,7 +397,7 @@ function mapFormulaReferences(formula, rewrite) {
382
397
  if (!formula.startsWith("=")) return formula;
383
398
  let tokens;
384
399
  try {
385
- tokens = _chunkSAZRENEZcjs.tokenizeFormula.call(void 0, formula);
400
+ tokens = _chunkMCSJFWAOcjs.tokenizeFormula.call(void 0, formula);
386
401
  } catch (e2) {
387
402
  return formula;
388
403
  }
@@ -520,7 +535,7 @@ function innermostCall(stack) {
520
535
  }
521
536
  var toSuggestion = (def) => ({
522
537
  name: def.name,
523
- signature: _chunkSAZRENEZcjs.getFormulaSignature.call(void 0, def),
538
+ signature: _chunkMCSJFWAOcjs.getFormulaSignature.call(void 0, def),
524
539
  description: def.description,
525
540
  category: def.category
526
541
  });
@@ -529,20 +544,20 @@ function getFormulaHints(input, caret = input.length, options = {}) {
529
544
  let suggestions = [];
530
545
  if (context.prefix) {
531
546
  const query = context.prefix.text.toUpperCase();
532
- suggestions = _chunkSAZRENEZcjs.searchFormulaFunctions.call(void 0, query, { limit: void 0 }).filter((def) => def.name.startsWith(query)).slice(0, _nullishCoalesce(options.limit, () => ( 8))).map(toSuggestion);
547
+ suggestions = _chunkMCSJFWAOcjs.searchFormulaFunctions.call(void 0, query, { limit: void 0 }).filter((def) => def.name.startsWith(query)).slice(0, _nullishCoalesce(options.limit, () => ( 8))).map(toSuggestion);
533
548
  const followedByParen = input.slice(context.prefix.end).trimStart().startsWith("(");
534
549
  if (followedByParen || suggestions.length === 1 && suggestions[0].name === query) suggestions = [];
535
550
  }
536
551
  let activeCall = null;
537
552
  if (context.call) {
538
- const def = _chunkSAZRENEZcjs.getFormulaFunction.call(void 0, context.call.name);
553
+ const def = _chunkMCSJFWAOcjs.getFormulaFunction.call(void 0, context.call.name);
539
554
  if (def) {
540
- const specIndex = _chunkSAZRENEZcjs.getFormulaArgumentSpecIndex.call(void 0, def, context.call.argIndex);
555
+ const specIndex = _chunkMCSJFWAOcjs.getFormulaArgumentSpecIndex.call(void 0, def, context.call.argIndex);
541
556
  activeCall = {
542
557
  name: def.name,
543
- signature: _chunkSAZRENEZcjs.getFormulaSignature.call(void 0, def),
558
+ signature: _chunkMCSJFWAOcjs.getFormulaSignature.call(void 0, def),
544
559
  description: def.description,
545
- parts: _chunkSAZRENEZcjs.getFormulaSignatureParts.call(void 0, def, context.call.argIndex),
560
+ parts: _chunkMCSJFWAOcjs.getFormulaSignatureParts.call(void 0, def, context.call.argIndex),
546
561
  argIndex: context.call.argIndex,
547
562
  argument: specIndex >= 0 ? def.args[specIndex] : null
548
563
  };
@@ -560,6 +575,68 @@ function applyFormulaSuggestion(input, caret, name) {
560
575
  return { value, caret: start + insert.length + (hasParen ? 1 : 0) };
561
576
  }
562
577
 
578
+ // src/spreadsheet/numfmt/presets.ts
579
+ var NUMBER_FORMAT_PRESETS = [
580
+ { id: "general", label: "General", code: "General" },
581
+ { id: "number", label: "Number (0.00)", code: "0.00" },
582
+ { id: "currency", label: "Currency ($1,234.50)", code: '"$"#,##0.00' },
583
+ { id: "percent", label: "Percent (12.5%)", code: "0.0%" },
584
+ { id: "date", label: "Date (3/14/2026)", code: "m/d/yyyy" },
585
+ { id: "time", label: "Time (1:30 PM)", code: "h:mm AM/PM" }
586
+ ];
587
+ function numberFormatForCellFormat(format) {
588
+ switch (format) {
589
+ case "currency":
590
+ return '"$"#,##0.00';
591
+ case "percentage":
592
+ return "0%";
593
+ case "date":
594
+ return "m/d/yyyy";
595
+ default:
596
+ return void 0;
597
+ }
598
+ }
599
+ function cellFormatForNumberFormat(code) {
600
+ switch (_chunkMCSJFWAOcjs.NumberFormat.parseCached(code).kind()) {
601
+ case "number":
602
+ case "fraction":
603
+ case "scientific":
604
+ case "special":
605
+ return "number";
606
+ case "currency":
607
+ case "accounting":
608
+ return "currency";
609
+ case "percentage":
610
+ return "percentage";
611
+ case "date":
612
+ return "date";
613
+ case "text":
614
+ return "text";
615
+ default:
616
+ return void 0;
617
+ }
618
+ }
619
+ var isGeneralNumberFormat = (code) => code === void 0 || _chunkMCSJFWAOcjs.NumberFormat.parseCached(code).isGeneral();
620
+
621
+ // src/spreadsheet/formula/format.ts
622
+ function formatCellForDisplay(cell) {
623
+ if (!cell) return { text: "", numeric: false };
624
+ if (cell.error) return { text: cell.error, numeric: false };
625
+ const { value } = cell;
626
+ const code = _nullishCoalesce(cell.numberFormat, () => ( (typeof value === "number" ? numberFormatForCellFormat(cell.format) : void 0)));
627
+ if (code !== void 0 && !isGeneralNumberFormat(code) && !_chunkMCSJFWAOcjs.isBlank.call(void 0, value) && typeof value !== "boolean") {
628
+ return _chunkMCSJFWAOcjs.NumberFormat.parseCached(code).format(value);
629
+ }
630
+ return { text: _chunkMCSJFWAOcjs.toText.call(void 0, value), numeric: typeof value === "number" };
631
+ }
632
+ function formatCellDisplay(cell) {
633
+ return formatCellForDisplay(cell).text;
634
+ }
635
+ function formatValueWithCode(value, format) {
636
+ const result = _chunkMCSJFWAOcjs.formatTextFunction.call(void 0, value, format);
637
+ return "text" in result ? result.text : null;
638
+ }
639
+
563
640
  // src/spreadsheet/datasource/index.ts
564
641
  var DataSourceBinder = (_class2 = class {constructor() { _class2.prototype.__init6.call(this); }
565
642
  __init6() {this.dataSources = /* @__PURE__ */ new Map()}
@@ -678,28 +755,41 @@ function compareCellValues(a, b, direction = "asc") {
678
755
  const aBlank = isBlankValue(a);
679
756
  const bBlank = isBlankValue(b);
680
757
  if (aBlank || bBlank) return aBlank === bBlank ? 0 : aBlank ? 1 : -1;
681
- const aNum = toNumber(a);
682
- const bNum = toNumber(b);
683
758
  let result;
684
- if (aNum !== null && bNum !== null) result = aNum - bNum;
685
- else if (aNum !== null) result = -1;
686
- else if (bNum !== null) result = 1;
687
- else result = compareText(String(a), String(b));
759
+ if (isPlainText(a) && isPlainText(b) && !(_chunkMCSJFWAOcjs.parseIsoDate.call(void 0, a) && _chunkMCSJFWAOcjs.parseIsoDate.call(void 0, b))) {
760
+ result = compareText(a, b);
761
+ } else {
762
+ result = _chunkMCSJFWAOcjs.sortCompareValues.call(void 0, a, b);
763
+ }
688
764
  if (result === 0) return 0;
689
765
  return direction === "desc" ? -Math.sign(result) : Math.sign(result);
690
766
  }
767
+ var isPlainText = (value) => typeof value === "string" && !_chunkMCSJFWAOcjs.isFormulaError.call(void 0, value);
768
+ function filterValue(value) {
769
+ if (isBlankValue(value) || _chunkMCSJFWAOcjs.isFormulaError.call(void 0, value)) return null;
770
+ if (typeof value === "number") return Number.isFinite(value) ? { value, kind: "number" } : null;
771
+ if (typeof value === "boolean") return { value, kind: "boolean" };
772
+ const num = _chunkMCSJFWAOcjs.numericValue.call(void 0, value);
773
+ if (num !== null) return { value: num, kind: "number" };
774
+ const text = String(value);
775
+ return { value: text, kind: _chunkMCSJFWAOcjs.parseIsoDate.call(void 0, text) ? "number" : "text" };
776
+ }
777
+ function filterOperand(operand) {
778
+ if (typeof operand !== "string") return filterValue(operand);
779
+ if (operand.trim() === "") return null;
780
+ const parsed = _chunkMCSJFWAOcjs.parseCellInput.call(void 0, operand.trim());
781
+ if (parsed.type === "number" || parsed.type === "date" || parsed.type === "boolean") return filterValue(parsed.value);
782
+ return { value: operand, kind: "text" };
783
+ }
691
784
  function compareForFilter(value, operand) {
692
- if (isBlankValue(value) || isBlankValue(operand)) return null;
693
- const a = toNumber(value);
694
- const b = toNumber(operand);
695
- if (a !== null && b !== null) return a - b;
696
- if (a !== null || b !== null) return null;
697
- return compareText(String(value), String(operand));
785
+ const a = filterValue(value);
786
+ const b = filterOperand(operand);
787
+ if (!a || !b || a.kind !== b.kind) return null;
788
+ return _chunkMCSJFWAOcjs.compareValues.call(void 0, a.value, b.value);
698
789
  }
699
790
  function looselyEquals(value, operand) {
700
- const a = toNumber(value);
701
- const b = toNumber(operand);
702
- if (a !== null && b !== null) return a === b;
791
+ const c = compareForFilter(value, operand);
792
+ if (c !== null) return c === 0;
703
793
  return String(_nullishCoalesce(value, () => ( ""))).trim().toLowerCase() === String(_nullishCoalesce(operand, () => ( ""))).trim().toLowerCase();
704
794
  }
705
795
  function matchesFilterRule(value, rule) {
@@ -774,7 +864,8 @@ function classifyFillValue(raw) {
774
864
  if (raw.trim() === "") return { kind: "blank" };
775
865
  const num = toNumber(raw);
776
866
  if (num !== null) return { kind: "number", value: num };
777
- const date = ISO_DATE_PATTERN.exec(raw.trim());
867
+ const typed = _chunkMCSJFWAOcjs.parseCellInput.call(void 0, raw);
868
+ const date = ISO_DATE_PATTERN.exec(typed.type === "date" ? String(typed.value) : raw.trim());
778
869
  if (date) {
779
870
  const [year, month, day] = [Number(date[1]), Number(date[2]), Number(date[3])];
780
871
  const time = Date.UTC(year, month - 1, day);
@@ -892,113 +983,6 @@ function getFillDirection(source, target) {
892
983
  return null;
893
984
  }
894
985
 
895
- // src/spreadsheet/csv.ts
896
- var BOM = "\uFEFF";
897
- function parseCsv(text, options = {}) {
898
- const delimiter = _nullishCoalesce(options.delimiter, () => ( ","));
899
- if (delimiter.length !== 1 || delimiter === '"' || delimiter === "\n" || delimiter === "\r") {
900
- throw new Error(`Invalid CSV delimiter: ${JSON.stringify(delimiter)}`);
901
- }
902
- const input = text.startsWith(BOM) ? text.slice(1) : text;
903
- const records = [];
904
- let record = [];
905
- let field = "";
906
- let i = 0;
907
- let recordStarted = false;
908
- const endField = () => {
909
- record.push(field);
910
- field = "";
911
- };
912
- const endRecord = () => {
913
- endField();
914
- records.push(record);
915
- record = [];
916
- recordStarted = false;
917
- };
918
- let atFieldStart = true;
919
- while (i < input.length) {
920
- const char = input[i];
921
- if (char === '"' && atFieldStart) {
922
- const quoted = readQuoted(input, i, delimiter);
923
- if (quoted.wellFormed || !options.requireWellFormedQuotes) {
924
- recordStarted = true;
925
- atFieldStart = false;
926
- field += quoted.value;
927
- i = quoted.end;
928
- continue;
929
- }
930
- }
931
- if (char === delimiter) {
932
- recordStarted = true;
933
- endField();
934
- atFieldStart = true;
935
- i++;
936
- continue;
937
- }
938
- if (char === "\r" || char === "\n") {
939
- endRecord();
940
- atFieldStart = true;
941
- i += char === "\r" && input[i + 1] === "\n" ? 2 : 1;
942
- continue;
943
- }
944
- recordStarted = true;
945
- atFieldStart = false;
946
- field += char;
947
- i++;
948
- }
949
- if (recordStarted || field !== "" || record.length > 0) endRecord();
950
- return records;
951
- }
952
- function readQuoted(input, start, delimiter) {
953
- let value = "";
954
- let i = start + 1;
955
- while (i < input.length) {
956
- if (input[i] === '"') {
957
- if (input[i + 1] === '"') {
958
- value += '"';
959
- i += 2;
960
- continue;
961
- }
962
- const next = input[i + 1];
963
- const wellFormed = next === void 0 || next === delimiter || next === "\r" || next === "\n";
964
- return { value, end: i + 1, wellFormed };
965
- }
966
- value += input[i];
967
- i++;
968
- }
969
- return { value, end: i, wellFormed: false };
970
- }
971
- function escapeCsvField(value, delimiter = ",", quoteAll = false) {
972
- if (quoteAll || value.includes(delimiter) || /["\r\n]/.test(value)) {
973
- return `"${value.replace(/"/g, '""')}"`;
974
- }
975
- return value;
976
- }
977
- function serializeCsv(rows, options = {}) {
978
- const delimiter = _nullishCoalesce(options.delimiter, () => ( ","));
979
- const lineEnding = _nullishCoalesce(options.lineEnding, () => ( "\r\n"));
980
- const body = rows.map(
981
- (row) => row.map((value) => escapeCsvField(value == null ? "" : String(value), delimiter, options.quoteAll)).join(delimiter)
982
- ).join(lineEnding);
983
- return options.bom ? BOM + body : body;
984
- }
985
- function parseTsv(text) {
986
- const normalized = text.startsWith(BOM) ? text.slice(1) : text;
987
- if (!normalized.includes('"')) {
988
- const body = normalized.replace(/\r\n?/g, "\n").replace(/\n$/, "");
989
- return body === "" ? [] : body.split("\n").map((line) => line.split(" "));
990
- }
991
- return parseCsv(normalized, { delimiter: " ", requireWellFormedQuotes: true });
992
- }
993
- function serializeTsv(rows) {
994
- return rows.map(
995
- (row) => row.map((value) => {
996
- const text = value == null ? "" : String(value);
997
- return /[\t\r\n]/.test(text) || text.startsWith('"') ? `"${text.replace(/"/g, '""')}"` : text;
998
- }).join(" ")
999
- ).join("\n");
1000
- }
1001
-
1002
986
  // src/spreadsheet/clipboard.ts
1003
987
  var SPREADSHEET_CLIPBOARD_MIME = "application/x.pixerate.spreadsheet+json";
1004
988
  var displayText = (value) => value === null || value === void 0 ? "" : String(value);
@@ -1071,11 +1055,16 @@ function parseHtmlTable(html) {
1071
1055
  return rows.length > 0 ? rows : null;
1072
1056
  }
1073
1057
  function createSpreadsheetClipboardData(cells, origin) {
1074
- const values = cells.map((row) => row.map((cell) => cell.value));
1075
- const payload = { type: "pixerate-spreadsheet", version: 1, origin, cells };
1058
+ const texts = cells.map((row) => row.map((cell) => _nullishCoalesce(cell.text, () => ( displayText(cell.value)))));
1059
+ const payload = {
1060
+ type: "pixerate-spreadsheet",
1061
+ version: 1,
1062
+ origin,
1063
+ cells: cells.map((row) => row.map(({ raw, value }) => ({ raw, value })))
1064
+ };
1076
1065
  return {
1077
- "text/plain": serializeTsv(values.map((row) => row.map(displayText))),
1078
- "text/html": serializeHtmlTable(values),
1066
+ "text/plain": _chunkTNNJXF46cjs.serializeTsv.call(void 0, texts),
1067
+ "text/html": serializeHtmlTable(texts),
1079
1068
  [SPREADSHEET_CLIPBOARD_MIME]: JSON.stringify(payload)
1080
1069
  };
1081
1070
  }
@@ -1116,7 +1105,7 @@ function readSpreadsheetClipboard(source) {
1116
1105
  }
1117
1106
  const text = readFormat(source, "text/plain");
1118
1107
  if (text) {
1119
- const rows = parseTsv(text);
1108
+ const rows = _chunkTNNJXF46cjs.parseTsv.call(void 0, text);
1120
1109
  if (rows.length > 0) return { format: "text", rows };
1121
1110
  }
1122
1111
  return null;
@@ -1289,6 +1278,7 @@ function buildSpreadsheetView(doc, getValue) {
1289
1278
 
1290
1279
  // src/spreadsheet/controller.ts
1291
1280
  var nextIdSequence = 0;
1281
+ var DEFAULT_MAX_HISTORY_BYTES = 64 * 1024 * 1024;
1292
1282
  var MAX_SPILL_PASSES = 25;
1293
1283
  var spillCellId = (rowId, colId) => `${rowId}\0${colId}`;
1294
1284
  var SpreadsheetController = (_class3 = class {
@@ -1308,6 +1298,7 @@ var SpreadsheetController = (_class3 = class {
1308
1298
  __init13() {this.undoStack = []}
1309
1299
  __init14() {this.redoStack = []}
1310
1300
  __init15() {this.isApplyingHistory = false}
1301
+
1311
1302
  // Set while importing TSV: history and recalculation are done once at the end.
1312
1303
  __init16() {this.batching = false}
1313
1304
  __init17() {this.pendingCommits = []}
@@ -1349,13 +1340,14 @@ var SpreadsheetController = (_class3 = class {
1349
1340
  ..._optionalChain([options, 'access', _72 => _72.document, 'optionalAccess', _73 => _73.table]) ? { table: options.document.table } : {}
1350
1341
  };
1351
1342
  this.primaryDataSourceId = options.primaryDataSourceId;
1343
+ this.maxHistoryBytes = Math.max(0, _nullishCoalesce(options.maxHistoryBytes, () => ( DEFAULT_MAX_HISTORY_BYTES)));
1352
1344
  this.onDocumentChange = options.onDocumentChange;
1353
1345
  this.onSelectionChange = options.onSelectionChange;
1354
1346
  this.onCellCommit = options.onCellCommit;
1355
1347
  if (options.dataSources) {
1356
1348
  options.dataSources.forEach((ds) => this.binder.register(ds));
1357
1349
  }
1358
- this.evaluator = new (0, _chunkSAZRENEZcjs.FormulaEvaluator)({
1350
+ this.evaluator = new (0, _chunkMCSJFWAOcjs.FormulaEvaluator)({
1359
1351
  resolveCell: (colStr, rowNum) => this.resolveCellByCoord(colStr, rowNum),
1360
1352
  resolveRange: (sCol, sRow, eCol, eRow) => this.resolveRangeByCoords(sCol, sRow, eCol, eRow),
1361
1353
  resolveProperty: (prop) => this.resolveCurrentRowProperty(prop),
@@ -1363,6 +1355,7 @@ var SpreadsheetController = (_class3 = class {
1363
1355
  getFormulaCell: () => this.evaluatingCell
1364
1356
  });
1365
1357
  this.syncWithDataSource();
1358
+ this.rederiveTypedValues();
1366
1359
  this.recalculateAll();
1367
1360
  }
1368
1361
  loadDocument(document) {
@@ -1374,9 +1367,80 @@ var SpreadsheetController = (_class3 = class {
1374
1367
  this.undoStack = [];
1375
1368
  this.redoStack = [];
1376
1369
  this.syncWithDataSource();
1370
+ this.rederiveTypedValues();
1377
1371
  this.recalculateAll();
1378
1372
  this.notifyChange();
1379
1373
  }
1374
+ /**
1375
+ * Re-parses the value of every stored typed (non-formula) cell from its
1376
+ * `raw` input, so documents saved before typed input was parsed (whose
1377
+ * values are text such as `"120"`) compare and sort as numbers. Cells of
1378
+ * bound columns in record rows keep their value: it belongs to the data
1379
+ * source.
1380
+ */
1381
+ rederiveTypedValues() {
1382
+ for (const row of this.document.rows) {
1383
+ const cells = this.document.cells[row.id];
1384
+ if (!cells) continue;
1385
+ for (const col of this.document.columns) {
1386
+ const cell = cells[col.id];
1387
+ if (!cell || typeof cell.raw !== "string" || cell.raw.startsWith("=")) continue;
1388
+ if (col.type === "bound" && col.binding && row.recordId) continue;
1389
+ const typed = this.typedCell(cell.raw, cell.format, col, cell);
1390
+ cell.value = typed.value;
1391
+ if (typed.numberFormat) cell.numberFormat = typed.numberFormat;
1392
+ else delete cell.numberFormat;
1393
+ if (typed.format) cell.format = typed.format;
1394
+ }
1395
+ }
1396
+ }
1397
+ /**
1398
+ * Value of typed (non-formula) input: a number, boolean, ISO date, error
1399
+ * or text (see `parseCellInput`), its automatic number format, and the
1400
+ * `CellFormat` to use: the automatic one (currency, percentage, date,
1401
+ * number) when `format` is unset or `text` (the default of new columns).
1402
+ */
1403
+ typedCell(raw, format, col, existing) {
1404
+ const parsed = _chunkMCSJFWAOcjs.parseCellInput.call(void 0, raw);
1405
+ const fixed = this.fixedNumberFormat(col, existing);
1406
+ const numberFormat = _nullishCoalesce(fixed, () => ( parsed.numberFormat));
1407
+ return {
1408
+ value: parsed.value,
1409
+ ...numberFormat ? { numberFormat } : {},
1410
+ ..._optionalChain([existing, 'optionalAccess', _74 => _74.explicitNumberFormat]) ? { explicitNumberFormat: true } : {},
1411
+ format: fixed === void 0 && parsed.cellFormat && (!format || format === "text") ? parsed.cellFormat : format
1412
+ };
1413
+ }
1414
+ /**
1415
+ * The number format a cell keeps whatever is typed into it: its explicit
1416
+ * one, else its column's. Undefined lets typed input choose one.
1417
+ */
1418
+ fixedNumberFormat(col, existing) {
1419
+ if (_optionalChain([existing, 'optionalAccess', _75 => _75.explicitNumberFormat]) && existing.numberFormat !== void 0) return existing.numberFormat;
1420
+ return _optionalChain([col, 'optionalAccess', _76 => _76.numberFormat]) && !isGeneralNumberFormat(col.numberFormat) ? col.numberFormat : void 0;
1421
+ }
1422
+ /** `numberFormat` / `explicitNumberFormat` fields for a formula, bound or spilled cell. */
1423
+ fixedNumberFormatFields(col, existing) {
1424
+ const numberFormat = this.fixedNumberFormat(col, existing);
1425
+ if (numberFormat === void 0) return {};
1426
+ return _optionalChain([existing, 'optionalAccess', _77 => _77.explicitNumberFormat]) ? { numberFormat, explicitNumberFormat: true } : { numberFormat };
1427
+ }
1428
+ /**
1429
+ * Typed input for a bound field, coerced by the field's declared type:
1430
+ * number, boolean and date fields get a number, boolean or ISO date when
1431
+ * the input parses as one; string and enum fields (and unknown fields)
1432
+ * keep the text exactly as typed.
1433
+ */
1434
+ boundInputValue(dataSourceId, field, raw) {
1435
+ if (raw.startsWith("=")) return raw;
1436
+ const type = _optionalChain([this, 'access', _78 => _78.binder, 'access', _79 => _79.getDataSource, 'call', _80 => _80(dataSourceId), 'optionalAccess', _81 => _81.getFields, 'call', _82 => _82(), 'access', _83 => _83.find, 'call', _84 => _84((f) => f.key === field), 'optionalAccess', _85 => _85.type]);
1437
+ if (type !== "number" && type !== "boolean" && type !== "date") return raw;
1438
+ const parsed = _chunkMCSJFWAOcjs.parseCellInput.call(void 0, raw);
1439
+ if (type === "number" && parsed.type === "number") return parsed.value;
1440
+ if (type === "boolean" && parsed.type === "boolean") return parsed.value;
1441
+ if (type === "date" && parsed.type === "date") return parsed.value;
1442
+ return raw;
1443
+ }
1380
1444
  registerDataSource(ds) {
1381
1445
  this.binder.register(ds);
1382
1446
  this.syncWithDataSource();
@@ -1397,7 +1461,7 @@ var SpreadsheetController = (_class3 = class {
1397
1461
  r.index = idx;
1398
1462
  });
1399
1463
  this.document.columns.forEach((c, idx) => {
1400
- c.key = _chunkSAZRENEZcjs.indexToColName.call(void 0, idx);
1464
+ c.key = _chunkMCSJFWAOcjs.indexToColName.call(void 0, idx);
1401
1465
  });
1402
1466
  }
1403
1467
  getColumn(colIdOrKey) {
@@ -1412,16 +1476,19 @@ var SpreadsheetController = (_class3 = class {
1412
1476
  return this.document.rows.find((r) => r.id === rowIdOrIndex);
1413
1477
  }
1414
1478
  getCell(rowId, colId) {
1415
- const existing = _optionalChain([this, 'access', _74 => _74.document, 'access', _75 => _75.cells, 'access', _76 => _76[rowId], 'optionalAccess', _77 => _77[colId]]);
1479
+ const existing = _optionalChain([this, 'access', _86 => _86.document, 'access', _87 => _87.cells, 'access', _88 => _88[rowId], 'optionalAccess', _89 => _89[colId]]);
1416
1480
  if (existing && existing.raw !== "") return existing;
1417
1481
  if (this.spillCells.size > 0) {
1418
1482
  const spilled = this.spillCells.get(spillCellId(rowId, colId));
1419
1483
  if (spilled) return spilled;
1420
1484
  }
1421
- if (existing) return existing;
1485
+ if (existing && !existing.explicitNumberFormat) return existing;
1422
1486
  const col = this.document.columns.find((c) => c.id === colId);
1423
1487
  const row = this.document.rows.find((r) => r.id === rowId);
1424
- return this.getDerivedCell(row, col);
1488
+ const derived = this.getDerivedCell(row, col);
1489
+ if (!existing) return derived;
1490
+ if (derived.raw === "") return existing;
1491
+ return { ...derived, numberFormat: existing.numberFormat, explicitNumberFormat: true };
1425
1492
  }
1426
1493
  /** Value of a cell with no stored data: bound record value, column formula, or blank. */
1427
1494
  getDerivedCell(row, col) {
@@ -1434,17 +1501,19 @@ var SpreadsheetController = (_class3 = class {
1434
1501
  return {
1435
1502
  raw: boundVal !== void 0 ? String(boundVal) : "",
1436
1503
  value: _nullishCoalesce(boundVal, () => ( "")),
1437
- format: col.format
1504
+ format: col.format,
1505
+ ...this.fixedNumberFormatFields(col, void 0)
1438
1506
  };
1439
1507
  }
1440
1508
  if (col && col.type === "formula" && col.formula) {
1441
1509
  return {
1442
1510
  raw: col.formula,
1443
1511
  value: "",
1444
- format: col.format
1512
+ format: col.format,
1513
+ ...this.fixedNumberFormatFields(col, void 0)
1445
1514
  };
1446
1515
  }
1447
- return { raw: "", value: "", format: _optionalChain([col, 'optionalAccess', _78 => _78.format]) };
1516
+ return { raw: "", value: "", format: _optionalChain([col, 'optionalAccess', _90 => _90.format]), ...this.fixedNumberFormatFields(col, void 0) };
1448
1517
  }
1449
1518
  setCellValue(rowId, colId, raw) {
1450
1519
  this.recordSnapshot();
@@ -1453,21 +1522,21 @@ var SpreadsheetController = (_class3 = class {
1453
1522
  }
1454
1523
  const col = this.document.columns.find((c) => c.id === colId);
1455
1524
  const row = this.document.rows.find((r) => r.id === rowId);
1456
- if (_optionalChain([col, 'optionalAccess', _79 => _79.type]) === "bound" && col.binding && _optionalChain([row, 'optionalAccess', _80 => _80.recordId])) {
1457
- this.binder.commitBoundValue(
1458
- col.binding.dataSource,
1459
- row.recordId,
1460
- col.binding.field,
1461
- raw
1462
- );
1525
+ const isFormula = raw.startsWith("=");
1526
+ const existing = this.document.cells[rowId][colId];
1527
+ let cell;
1528
+ if (_optionalChain([col, 'optionalAccess', _91 => _91.type]) === "bound" && col.binding && _optionalChain([row, 'optionalAccess', _92 => _92.recordId])) {
1529
+ const value = this.boundInputValue(col.binding.dataSource, col.binding.field, raw);
1530
+ this.binder.commitBoundValue(col.binding.dataSource, row.recordId, col.binding.field, value);
1531
+ cell = { raw, value, format: col.format, ...this.fixedNumberFormatFields(col, existing) };
1532
+ } else if (isFormula) {
1533
+ cell = { raw, value: raw, format: _optionalChain([col, 'optionalAccess', _93 => _93.format]), ...this.fixedNumberFormatFields(col, existing) };
1534
+ } else {
1535
+ cell = { raw, ...this.typedCell(raw, _optionalChain([col, 'optionalAccess', _94 => _94.format]), col, existing) };
1463
1536
  }
1464
1537
  const cellKey = this.getCellKey(rowId, colId);
1465
- this.depGraph.setCellFormula(cellKey, raw.startsWith("=") ? raw : null);
1466
- this.document.cells[rowId][colId] = {
1467
- raw,
1468
- value: raw,
1469
- format: _optionalChain([col, 'optionalAccess', _81 => _81.format])
1470
- };
1538
+ this.depGraph.setCellFormula(cellKey, isFormula ? raw : null);
1539
+ this.document.cells[rowId][colId] = cell;
1471
1540
  this.document.updatedAt = Date.now();
1472
1541
  if (this.batching) {
1473
1542
  this.pendingCommits.push([rowId, colId, raw]);
@@ -1475,8 +1544,8 @@ var SpreadsheetController = (_class3 = class {
1475
1544
  }
1476
1545
  this.recalculateCell(rowId, colId);
1477
1546
  this.notifyChange();
1478
- const evaluatedVal = _optionalChain([this, 'access', _82 => _82.document, 'access', _83 => _83.cells, 'access', _84 => _84[rowId], 'access', _85 => _85[colId], 'optionalAccess', _86 => _86.value]);
1479
- _optionalChain([this, 'access', _87 => _87.onCellCommit, 'optionalCall', _88 => _88(rowId, colId, raw, evaluatedVal)]);
1547
+ const evaluatedVal = _optionalChain([this, 'access', _95 => _95.document, 'access', _96 => _96.cells, 'access', _97 => _97[rowId], 'access', _98 => _98[colId], 'optionalAccess', _99 => _99.value]);
1548
+ _optionalChain([this, 'access', _100 => _100.onCellCommit, 'optionalCall', _101 => _101(rowId, colId, raw, evaluatedVal)]);
1480
1549
  }
1481
1550
  getCellKey(rowId, colId) {
1482
1551
  const row = this.document.rows.find((r) => r.id === rowId);
@@ -1527,7 +1596,7 @@ var SpreadsheetController = (_class3 = class {
1527
1596
  const formulaKeys = [];
1528
1597
  for (const row of this.document.rows) {
1529
1598
  for (const col of this.document.columns) {
1530
- const cell = _nullishCoalesce(_optionalChain([this, 'access', _89 => _89.document, 'access', _90 => _90.cells, 'access', _91 => _91[row.id], 'optionalAccess', _92 => _92[col.id]]), () => ( this.getDerivedCell(row, col)));
1599
+ const cell = _nullishCoalesce(_optionalChain([this, 'access', _102 => _102.document, 'access', _103 => _103.cells, 'access', _104 => _104[row.id], 'optionalAccess', _105 => _105[col.id]]), () => ( this.getDerivedCell(row, col)));
1531
1600
  if (cell.raw.startsWith("=")) {
1532
1601
  const cellKey = `${col.key}${row.index + 1}`.toUpperCase();
1533
1602
  this.depGraph.setCellFormula(cellKey, cell.raw);
@@ -1625,7 +1694,7 @@ var SpreadsheetController = (_class3 = class {
1625
1694
  placeSpill(anchor, row, col, array) {
1626
1695
  const { rows, cols } = array;
1627
1696
  const area = { startRow: row, startCol: col, endRow: row + rows - 1, endCol: col + cols - 1 };
1628
- const label = `${_chunkSAZRENEZcjs.indexToColName.call(void 0, area.startCol)}${area.startRow + 1}:${_chunkSAZRENEZcjs.indexToColName.call(void 0, area.endCol)}${area.endRow + 1}`;
1697
+ const label = `${_chunkMCSJFWAOcjs.indexToColName.call(void 0, area.startCol)}${area.startRow + 1}:${_chunkMCSJFWAOcjs.indexToColName.call(void 0, area.endCol)}${area.endRow + 1}`;
1629
1698
  let reason = null;
1630
1699
  const blockers = [];
1631
1700
  if (area.endRow >= this.document.rows.length || area.endCol >= this.document.columns.length) {
@@ -1639,7 +1708,7 @@ var SpreadsheetController = (_class3 = class {
1639
1708
  if (r === row && c === col) continue;
1640
1709
  const rowObj = this.document.rows[r];
1641
1710
  const key = `${column.key}${r + 1}`.toUpperCase();
1642
- const stored = _optionalChain([this, 'access', _93 => _93.document, 'access', _94 => _94.cells, 'access', _95 => _95[rowObj.id], 'optionalAccess', _96 => _96[column.id]]);
1711
+ const stored = _optionalChain([this, 'access', _106 => _106.document, 'access', _107 => _107.cells, 'access', _108 => _108[rowObj.id], 'optionalAccess', _109 => _109[column.id]]);
1643
1712
  const raw = stored ? stored.raw : this.getDerivedCell(rowObj, column).raw;
1644
1713
  const owner = this.spilledBy.get(key);
1645
1714
  if (raw !== "") {
@@ -1666,15 +1735,21 @@ var SpreadsheetController = (_class3 = class {
1666
1735
  const rowObj = this.document.rows[row + r];
1667
1736
  const key = `${column.key}${row + r + 1}`.toUpperCase();
1668
1737
  const value = _nullishCoalesce(array.values[c * rows + r], () => ( ""));
1669
- const display = { raw: "", value, format: column.format, spillAnchor: anchor };
1670
- if (_chunkSAZRENEZcjs.isFormulaError.call(void 0, value)) {
1738
+ const display = {
1739
+ raw: "",
1740
+ value,
1741
+ format: column.format,
1742
+ spillAnchor: anchor,
1743
+ ...this.fixedNumberFormatFields(column, _optionalChain([this, 'access', _110 => _110.document, 'access', _111 => _111.cells, 'access', _112 => _112[rowObj.id], 'optionalAccess', _113 => _113[column.id]]))
1744
+ };
1745
+ if (_chunkMCSJFWAOcjs.isFormulaError.call(void 0, value)) {
1671
1746
  display.error = value;
1672
- display.errorMessage = _chunkSAZRENEZcjs.describeFormulaError.call(void 0, value);
1747
+ display.errorMessage = _chunkMCSJFWAOcjs.describeFormulaError.call(void 0, value);
1673
1748
  }
1674
1749
  this.spillCells.set(spillCellId(rowObj.id, column.id), display);
1675
1750
  if (this.spilledBy.get(key) !== anchor) {
1676
1751
  this.spilledBy.set(key, anchor);
1677
- _optionalChain([this, 'access', _97 => _97.spillChanges, 'optionalAccess', _98 => _98.add, 'call', _99 => _99(key)]);
1752
+ _optionalChain([this, 'access', _114 => _114.spillChanges, 'optionalAccess', _115 => _115.add, 'call', _116 => _116(key)]);
1678
1753
  }
1679
1754
  cells.push({ key, rowId: rowObj.id, colId: column.id });
1680
1755
  }
@@ -1703,13 +1778,13 @@ var SpreadsheetController = (_class3 = class {
1703
1778
  if (this.spilledBy.get(cell.key) !== anchor) return;
1704
1779
  this.spilledBy.delete(cell.key);
1705
1780
  this.spillCells.delete(spillCellId(cell.rowId, cell.colId));
1706
- _optionalChain([this, 'access', _100 => _100.spillChanges, 'optionalAccess', _101 => _101.add, 'call', _102 => _102(cell.key)]);
1781
+ _optionalChain([this, 'access', _117 => _117.spillChanges, 'optionalAccess', _118 => _118.add, 'call', _119 => _119(cell.key)]);
1707
1782
  }
1708
1783
  resolveSpillByCoord(colStr, rowNum) {
1709
1784
  const record = this.spills.get(`${colStr}${rowNum}`.toUpperCase());
1710
1785
  if (record) return { rows: record.rows, cols: record.cols, values: record.values };
1711
1786
  const value = this.resolveCellByCoord(colStr, rowNum);
1712
- return _chunkSAZRENEZcjs.isFormulaError.call(void 0, value) ? value : "#REF!";
1787
+ return _chunkMCSJFWAOcjs.isFormulaError.call(void 0, value) ? value : "#REF!";
1713
1788
  }
1714
1789
  toSpill(record) {
1715
1790
  const row = this.document.rows[record.row];
@@ -1732,7 +1807,7 @@ var SpreadsheetController = (_class3 = class {
1732
1807
  */
1733
1808
  getSpillAt(row, col) {
1734
1809
  if (this.spills.size === 0) return null;
1735
- const key = `${_chunkSAZRENEZcjs.indexToColName.call(void 0, col)}${row + 1}`;
1810
+ const key = `${_chunkMCSJFWAOcjs.indexToColName.call(void 0, col)}${row + 1}`;
1736
1811
  const record = _nullishCoalesce(this.spills.get(key), () => ( this.spills.get(_nullishCoalesce(this.spilledBy.get(key), () => ( "")))));
1737
1812
  return record ? this.toSpill(record) : null;
1738
1813
  }
@@ -1760,15 +1835,15 @@ var SpreadsheetController = (_class3 = class {
1760
1835
  return _nullishCoalesce(this.getCell(row.id, col.id).value, () => ( ""));
1761
1836
  }
1762
1837
  resolveRangeByCoords(sCol, sRow, eCol, eRow) {
1763
- const startC = _chunkSAZRENEZcjs.colNameToIndex.call(void 0, sCol);
1764
- const endC = _chunkSAZRENEZcjs.colNameToIndex.call(void 0, eCol);
1838
+ const startC = _chunkMCSJFWAOcjs.colNameToIndex.call(void 0, sCol);
1839
+ const endC = _chunkMCSJFWAOcjs.colNameToIndex.call(void 0, eCol);
1765
1840
  const minC = Math.min(startC, endC);
1766
1841
  const maxC = Math.max(startC, endC);
1767
1842
  const minR = Math.min(sRow, eRow);
1768
- const maxR = Math.min(Math.max(sRow, eRow), _chunkSAZRENEZcjs.WHOLE_COLUMN_END_ROW, this.document.rows.length);
1843
+ const maxR = Math.min(Math.max(sRow, eRow), _chunkMCSJFWAOcjs.WHOLE_COLUMN_END_ROW, this.document.rows.length);
1769
1844
  const results = [];
1770
1845
  for (let c = minC; c <= maxC; c++) {
1771
- const colName = _chunkSAZRENEZcjs.indexToColName.call(void 0, c);
1846
+ const colName = _chunkMCSJFWAOcjs.indexToColName.call(void 0, c);
1772
1847
  const col = this.document.columns.find((colDef) => colDef.key.toUpperCase() === colName);
1773
1848
  if (!col) continue;
1774
1849
  for (let r = minR; r <= maxR; r++) {
@@ -1780,7 +1855,7 @@ var SpreadsheetController = (_class3 = class {
1780
1855
  return results;
1781
1856
  }
1782
1857
  resolveCurrentRowProperty(prop) {
1783
- const rowIndex = _nullishCoalesce(this.evaluatingRowIndex, () => ( _optionalChain([this, 'access', _103 => _103.activeCell, 'optionalAccess', _104 => _104.row])));
1858
+ const rowIndex = _nullishCoalesce(this.evaluatingRowIndex, () => ( _optionalChain([this, 'access', _120 => _120.activeCell, 'optionalAccess', _121 => _121.row])));
1784
1859
  if (rowIndex === void 0 || rowIndex === null) return 0;
1785
1860
  const row = this.document.rows[rowIndex];
1786
1861
  if (!row || !row.recordId || !this.primaryDataSourceId) return 0;
@@ -1798,8 +1873,8 @@ var SpreadsheetController = (_class3 = class {
1798
1873
  this.activeCell = {
1799
1874
  row: activeRow,
1800
1875
  col: activeCol,
1801
- rowId: _optionalChain([rowObj, 'optionalAccess', _105 => _105.id]),
1802
- colId: _optionalChain([colObj, 'optionalAccess', _106 => _106.id])
1876
+ rowId: _optionalChain([rowObj, 'optionalAccess', _122 => _122.id]),
1877
+ colId: _optionalChain([colObj, 'optionalAccess', _123 => _123.id])
1803
1878
  };
1804
1879
  if (extendSelection && this.selectedRange) {
1805
1880
  this.selectedRange = this.expandRangeToMerges({
@@ -1818,16 +1893,16 @@ var SpreadsheetController = (_class3 = class {
1818
1893
  endCol: clampedCol
1819
1894
  };
1820
1895
  }
1821
- _optionalChain([this, 'access', _107 => _107.onSelectionChange, 'optionalCall', _108 => _108(this.activeCell, this.selectedRange)]);
1896
+ _optionalChain([this, 'access', _124 => _124.onSelectionChange, 'optionalCall', _125 => _125(this.activeCell, this.selectedRange)]);
1822
1897
  }
1823
1898
  selectRange(range) {
1824
1899
  this.selectedRange = range;
1825
- _optionalChain([this, 'access', _109 => _109.onSelectionChange, 'optionalCall', _110 => _110(this.activeCell, this.selectedRange)]);
1900
+ _optionalChain([this, 'access', _126 => _126.onSelectionChange, 'optionalCall', _127 => _127(this.activeCell, this.selectedRange)]);
1826
1901
  }
1827
1902
  startEditing(row, col, initialValue) {
1828
- this.selectCell(_nullishCoalesce(_nullishCoalesce(row, () => ( _optionalChain([this, 'access', _111 => _111.activeCell, 'optionalAccess', _112 => _112.row]))), () => ( 0)), _nullishCoalesce(_nullishCoalesce(col, () => ( _optionalChain([this, 'access', _113 => _113.activeCell, 'optionalAccess', _114 => _114.col]))), () => ( 0)));
1829
- const targetRow = _nullishCoalesce(_optionalChain([this, 'access', _115 => _115.activeCell, 'optionalAccess', _116 => _116.row]), () => ( 0));
1830
- const targetCol = _nullishCoalesce(_optionalChain([this, 'access', _117 => _117.activeCell, 'optionalAccess', _118 => _118.col]), () => ( 0));
1903
+ this.selectCell(_nullishCoalesce(_nullishCoalesce(row, () => ( _optionalChain([this, 'access', _128 => _128.activeCell, 'optionalAccess', _129 => _129.row]))), () => ( 0)), _nullishCoalesce(_nullishCoalesce(col, () => ( _optionalChain([this, 'access', _130 => _130.activeCell, 'optionalAccess', _131 => _131.col]))), () => ( 0)));
1904
+ const targetRow = _nullishCoalesce(_optionalChain([this, 'access', _132 => _132.activeCell, 'optionalAccess', _133 => _133.row]), () => ( 0));
1905
+ const targetCol = _nullishCoalesce(_optionalChain([this, 'access', _134 => _134.activeCell, 'optionalAccess', _135 => _135.col]), () => ( 0));
1831
1906
  const rowObj = this.document.rows[targetRow];
1832
1907
  const colObj = this.document.columns[targetCol];
1833
1908
  if (!rowObj || !colObj) return;
@@ -1881,17 +1956,18 @@ var SpreadsheetController = (_class3 = class {
1881
1956
  // --- Grid Structure Mutations ---
1882
1957
  insertColumn(index, config) {
1883
1958
  this.recordSnapshot();
1884
- const newId = _optionalChain([config, 'optionalAccess', _119 => _119.id]) || this.generateId("col");
1959
+ const newId = _optionalChain([config, 'optionalAccess', _136 => _136.id]) || this.generateId("col");
1885
1960
  const newCol = {
1886
1961
  id: newId,
1887
- key: _chunkSAZRENEZcjs.indexToColName.call(void 0, index),
1888
- title: _optionalChain([config, 'optionalAccess', _120 => _120.title]) || _chunkSAZRENEZcjs.indexToColName.call(void 0, index),
1889
- width: _optionalChain([config, 'optionalAccess', _121 => _121.width]) || 130,
1890
- type: _optionalChain([config, 'optionalAccess', _122 => _122.type]) || "freeform",
1891
- binding: _optionalChain([config, 'optionalAccess', _123 => _123.binding]),
1892
- formula: _optionalChain([config, 'optionalAccess', _124 => _124.formula]),
1893
- format: _optionalChain([config, 'optionalAccess', _125 => _125.format]) || "text",
1894
- readOnly: _optionalChain([config, 'optionalAccess', _126 => _126.readOnly])
1962
+ key: _chunkMCSJFWAOcjs.indexToColName.call(void 0, index),
1963
+ title: _optionalChain([config, 'optionalAccess', _137 => _137.title]) || _chunkMCSJFWAOcjs.indexToColName.call(void 0, index),
1964
+ width: _optionalChain([config, 'optionalAccess', _138 => _138.width]) || 130,
1965
+ type: _optionalChain([config, 'optionalAccess', _139 => _139.type]) || "freeform",
1966
+ binding: _optionalChain([config, 'optionalAccess', _140 => _140.binding]),
1967
+ formula: _optionalChain([config, 'optionalAccess', _141 => _141.formula]),
1968
+ format: _optionalChain([config, 'optionalAccess', _142 => _142.format]) || "text",
1969
+ ..._optionalChain([config, 'optionalAccess', _143 => _143.numberFormat]) ? { numberFormat: config.numberFormat } : {},
1970
+ readOnly: _optionalChain([config, 'optionalAccess', _144 => _144.readOnly])
1895
1971
  };
1896
1972
  this.shiftReferences({ axis: "col", index, type: "insert" });
1897
1973
  this.adjustTableForStructuralChange({ axis: "col", index, type: "insert" });
@@ -1916,13 +1992,13 @@ var SpreadsheetController = (_class3 = class {
1916
1992
  }
1917
1993
  insertRow(index, config) {
1918
1994
  this.recordSnapshot();
1919
- const newId = _optionalChain([config, 'optionalAccess', _127 => _127.id]) || this.generateId("row");
1995
+ const newId = _optionalChain([config, 'optionalAccess', _145 => _145.id]) || this.generateId("row");
1920
1996
  const newRow = {
1921
1997
  id: newId,
1922
1998
  index,
1923
- height: _optionalChain([config, 'optionalAccess', _128 => _128.height]) || 32,
1924
- recordId: _optionalChain([config, 'optionalAccess', _129 => _129.recordId]),
1925
- type: _optionalChain([config, 'optionalAccess', _130 => _130.type]) || "freeform"
1999
+ height: _optionalChain([config, 'optionalAccess', _146 => _146.height]) || 32,
2000
+ recordId: _optionalChain([config, 'optionalAccess', _147 => _147.recordId]),
2001
+ type: _optionalChain([config, 'optionalAccess', _148 => _148.type]) || "freeform"
1926
2002
  };
1927
2003
  this.shiftReferences({ axis: "row", index, type: "insert" });
1928
2004
  this.adjustTableForStructuralChange({ axis: "row", index, type: "insert" });
@@ -1953,14 +2029,14 @@ var SpreadsheetController = (_class3 = class {
1953
2029
  shiftReferences(change) {
1954
2030
  for (const rowCells of Object.values(this.document.cells)) {
1955
2031
  for (const cell of Object.values(rowCells)) {
1956
- if (_optionalChain([cell, 'access', _131 => _131.raw, 'optionalAccess', _132 => _132.startsWith, 'call', _133 => _133("=")])) {
2032
+ if (_optionalChain([cell, 'access', _149 => _149.raw, 'optionalAccess', _150 => _150.startsWith, 'call', _151 => _151("=")])) {
1957
2033
  cell.raw = shiftFormulaReferences(cell.raw, change);
1958
2034
  }
1959
2035
  }
1960
2036
  }
1961
2037
  if (change.axis === "col") {
1962
2038
  for (const col of this.document.columns) {
1963
- if (_optionalChain([col, 'access', _134 => _134.formula, 'optionalAccess', _135 => _135.startsWith, 'call', _136 => _136("=")])) {
2039
+ if (_optionalChain([col, 'access', _152 => _152.formula, 'optionalAccess', _153 => _153.startsWith, 'call', _154 => _154("=")])) {
1964
2040
  col.formula = shiftFormulaReferences(col.formula, change);
1965
2041
  }
1966
2042
  }
@@ -1983,7 +2059,7 @@ var SpreadsheetController = (_class3 = class {
1983
2059
  let maxLen = (col.title || "").length + (col.key ? col.key.length + 3 : 0);
1984
2060
  for (const row of this.document.rows) {
1985
2061
  const cell = this.getCell(row.id, col.id);
1986
- const valStr = cell.value != null ? String(cell.value) : "";
2062
+ const valStr = formatCellDisplay(cell);
1987
2063
  if (valStr.length > maxLen) {
1988
2064
  maxLen = valStr.length;
1989
2065
  }
@@ -2007,8 +2083,7 @@ var SpreadsheetController = (_class3 = class {
2007
2083
  ) : this.document.columns;
2008
2084
  return rows.map(
2009
2085
  (row) => columns.map((col) => {
2010
- const cell = this.getCell(row.id, col.id);
2011
- return String(_nullishCoalesce(cell.value, () => ( ""))).replace(/\t/g, " ");
2086
+ return formatCellDisplay(this.getCell(row.id, col.id)).replace(/\t/g, " ");
2012
2087
  }).join(" ")
2013
2088
  ).join("\n");
2014
2089
  }
@@ -2028,7 +2103,7 @@ var SpreadsheetController = (_class3 = class {
2028
2103
  this.document.rows.push({ id: this.generateId("row"), index, height: 32, type: "freeform" });
2029
2104
  }
2030
2105
  while (colIndex >= this.document.columns.length) {
2031
- const key = _chunkSAZRENEZcjs.indexToColName.call(void 0, this.document.columns.length);
2106
+ const key = _chunkMCSJFWAOcjs.indexToColName.call(void 0, this.document.columns.length);
2032
2107
  this.document.columns.push({
2033
2108
  id: this.generateId("col"),
2034
2109
  key,
@@ -2075,7 +2150,7 @@ var SpreadsheetController = (_class3 = class {
2075
2150
  const commits = this.pendingCommits;
2076
2151
  this.pendingCommits = [];
2077
2152
  for (const [rowId, colId, raw] of commits) {
2078
- _optionalChain([this, 'access', _137 => _137.onCellCommit, 'optionalCall', _138 => _138(rowId, colId, raw, _optionalChain([this, 'access', _139 => _139.document, 'access', _140 => _140.cells, 'access', _141 => _141[rowId], 'optionalAccess', _142 => _142[colId], 'optionalAccess', _143 => _143.value]))]);
2153
+ _optionalChain([this, 'access', _155 => _155.onCellCommit, 'optionalCall', _156 => _156(rowId, colId, raw, _optionalChain([this, 'access', _157 => _157.document, 'access', _158 => _158.cells, 'access', _159 => _159[rowId], 'optionalAccess', _160 => _160[colId], 'optionalAccess', _161 => _161.value]))]);
2079
2154
  }
2080
2155
  }
2081
2156
  // --- CSV ---
@@ -2085,9 +2160,9 @@ var SpreadsheetController = (_class3 = class {
2085
2160
  */
2086
2161
  exportToCsv(options = {}) {
2087
2162
  const matrix = this.readMatrix(_nullishCoalesce(options.range, () => ( null))).map(
2088
- (row) => row.map((cell) => options.formulas ? cell.raw : String(_nullishCoalesce(cell.value, () => ( ""))))
2163
+ (row) => row.map((cell) => options.formulas ? cell.raw : formatCellDisplay(cell))
2089
2164
  );
2090
- return serializeCsv(matrix, {
2165
+ return _chunkTNNJXF46cjs.serializeCsv.call(void 0, matrix, {
2091
2166
  delimiter: options.delimiter,
2092
2167
  lineEnding: options.lineEnding,
2093
2168
  bom: options.bom
@@ -2098,7 +2173,7 @@ var SpreadsheetController = (_class3 = class {
2098
2173
  * as needed. The whole import is a single undo step.
2099
2174
  */
2100
2175
  importFromCsv(csv, options = {}) {
2101
- const matrix = parseCsv(csv, { delimiter: options.delimiter });
2176
+ const matrix = _chunkTNNJXF46cjs.parseCsv.call(void 0, csv, { delimiter: options.delimiter });
2102
2177
  this.writeMatrix(matrix, _nullishCoalesce(options.startRow, () => ( 0)), _nullishCoalesce(options.startCol, () => ( 0)));
2103
2178
  }
2104
2179
  /**
@@ -2126,10 +2201,11 @@ var SpreadsheetController = (_class3 = class {
2126
2201
  const cells = this.readMatrix(r).map(
2127
2202
  (row) => row.map((cell) => {
2128
2203
  const value = cell.error || cell.value;
2204
+ const text = formatCellDisplay(cell);
2129
2205
  if (cell.spillAnchor && !this.spillAnchorInRange(cell.spillAnchor, r)) {
2130
- return { raw: value === null || value === void 0 ? "" : String(value), value };
2206
+ return { raw: text, value, text };
2131
2207
  }
2132
- return { raw: cell.raw, value };
2208
+ return { raw: cell.raw, value, text };
2133
2209
  })
2134
2210
  );
2135
2211
  return createSpreadsheetClipboardData(cells, { row: r.startRow, col: r.startCol });
@@ -2163,7 +2239,7 @@ var SpreadsheetController = (_class3 = class {
2163
2239
  const r = normalizeRange(this.selectedRange);
2164
2240
  return { row: r.startRow, col: r.startCol };
2165
2241
  }
2166
- return { row: _nullishCoalesce(_optionalChain([this, 'access', _144 => _144.activeCell, 'optionalAccess', _145 => _145.row]), () => ( 0)), col: _nullishCoalesce(_optionalChain([this, 'access', _146 => _146.activeCell, 'optionalAccess', _147 => _147.col]), () => ( 0)) };
2242
+ return { row: _nullishCoalesce(_optionalChain([this, 'access', _162 => _162.activeCell, 'optionalAccess', _163 => _163.row]), () => ( 0)), col: _nullishCoalesce(_optionalChain([this, 'access', _164 => _164.activeCell, 'optionalAccess', _165 => _165.col]), () => ( 0)) };
2167
2243
  }
2168
2244
  // --- Table operations: shared helpers ---
2169
2245
  /** The table settings object, created on first use. */
@@ -2197,7 +2273,7 @@ var SpreadsheetController = (_class3 = class {
2197
2273
  remapAllFormulas(moveCell) {
2198
2274
  for (const rowCells of Object.values(this.document.cells)) {
2199
2275
  for (const cell of Object.values(rowCells)) {
2200
- if (_optionalChain([cell, 'access', _148 => _148.raw, 'optionalAccess', _149 => _149.startsWith, 'call', _150 => _150("=")])) {
2276
+ if (_optionalChain([cell, 'access', _166 => _166.raw, 'optionalAccess', _167 => _167.startsWith, 'call', _168 => _168("=")])) {
2201
2277
  cell.raw = remapFormulaReferences(cell.raw, moveCell);
2202
2278
  }
2203
2279
  }
@@ -2209,8 +2285,8 @@ var SpreadsheetController = (_class3 = class {
2209
2285
  * merges reduced to a single cell are dropped.
2210
2286
  */
2211
2287
  adjustTableForStructuralChange(change) {
2212
- const merges = _optionalChain([this, 'access', _151 => _151.document, 'access', _152 => _152.table, 'optionalAccess', _153 => _153.merges]);
2213
- if (!_optionalChain([merges, 'optionalAccess', _154 => _154.length])) return;
2288
+ const merges = _optionalChain([this, 'access', _169 => _169.document, 'access', _170 => _170.table, 'optionalAccess', _171 => _171.merges]);
2289
+ if (!_optionalChain([merges, 'optionalAccess', _172 => _172.length])) return;
2214
2290
  const startKey = change.axis === "row" ? "startRow" : "startCol";
2215
2291
  const endKey = change.axis === "row" ? "endRow" : "endCol";
2216
2292
  const next = [];
@@ -2241,8 +2317,8 @@ var SpreadsheetController = (_class3 = class {
2241
2317
  const colCount = this.document.columns.length;
2242
2318
  const body = this.getBodyRowBounds();
2243
2319
  const range = options.range ? normalizeRange(options.range) : null;
2244
- const startRow = Math.max(_nullishCoalesce(_optionalChain([range, 'optionalAccess', _155 => _155.startRow]), () => ( body.start)), body.start);
2245
- const endRow = Math.min(_nullishCoalesce(_optionalChain([range, 'optionalAccess', _156 => _156.endRow]), () => ( body.end)), body.end);
2320
+ const startRow = Math.max(_nullishCoalesce(_optionalChain([range, 'optionalAccess', _173 => _173.startRow]), () => ( body.start)), body.start);
2321
+ const endRow = Math.min(_nullishCoalesce(_optionalChain([range, 'optionalAccess', _174 => _174.endRow]), () => ( body.end)), body.end);
2246
2322
  const startCol = range ? Math.max(0, range.startCol) : 0;
2247
2323
  const endCol = range ? Math.min(colCount - 1, range.endCol) : colCount - 1;
2248
2324
  if (endRow - startRow < 1 || startCol > endCol) return false;
@@ -2252,7 +2328,7 @@ var SpreadsheetController = (_class3 = class {
2252
2328
  }));
2253
2329
  if (keyCols.length === 0 || keyCols.some((k) => k.index < startCol || k.index > endCol)) return false;
2254
2330
  const area = { startRow, startCol, endRow, endCol };
2255
- if ((_nullishCoalesce(_optionalChain([this, 'access', _157 => _157.document, 'access', _158 => _158.table, 'optionalAccess', _159 => _159.merges]), () => ( []))).some((m) => rangesIntersect(m, area))) return false;
2331
+ if ((_nullishCoalesce(_optionalChain([this, 'access', _175 => _175.document, 'access', _176 => _176.table, 'optionalAccess', _177 => _177.merges]), () => ( []))).some((m) => rangesIntersect(m, area))) return false;
2256
2332
  if (this.intersectsSpill(area)) return false;
2257
2333
  const sourceRows = [];
2258
2334
  for (let r = startRow; r <= endRow; r++) sourceRows.push(r);
@@ -2280,7 +2356,7 @@ var SpreadsheetController = (_class3 = class {
2280
2356
  const colIds = this.document.columns.slice(startCol, endCol + 1).map((c) => c.id);
2281
2357
  const snapshot = sorted.map((oldRow) => {
2282
2358
  const rowId = this.document.rows[oldRow].id;
2283
- return colIds.map((colId) => _optionalChain([this, 'access', _160 => _160.document, 'access', _161 => _161.cells, 'access', _162 => _162[rowId], 'optionalAccess', _163 => _163[colId]]));
2359
+ return colIds.map((colId) => _optionalChain([this, 'access', _178 => _178.document, 'access', _179 => _179.cells, 'access', _180 => _180[rowId], 'optionalAccess', _181 => _181[colId]]));
2284
2360
  });
2285
2361
  snapshot.forEach((cells, i) => {
2286
2362
  const rowId = this.document.rows[startRow + i].id;
@@ -2296,7 +2372,7 @@ var SpreadsheetController = (_class3 = class {
2296
2372
  }
2297
2373
  // --- Filters ---
2298
2374
  getFilterState() {
2299
- return _nullishCoalesce(_optionalChain([this, 'access', _164 => _164.document, 'access', _165 => _165.table, 'optionalAccess', _166 => _166.filter]), () => ( { enabled: false, rules: [] }));
2375
+ return _nullishCoalesce(_optionalChain([this, 'access', _182 => _182.document, 'access', _183 => _183.table, 'optionalAccess', _184 => _184.filter]), () => ( { enabled: false, rules: [] }));
2300
2376
  }
2301
2377
  /** Replaces all filter rules (and turns filters on when there are any). */
2302
2378
  setFilterRules(rules) {
@@ -2373,11 +2449,99 @@ var SpreadsheetController = (_class3 = class {
2373
2449
  }
2374
2450
  setTableCount(key, count, max) {
2375
2451
  const value = Math.max(0, Math.min(Math.floor(count), max));
2376
- if ((_nullishCoalesce(_optionalChain([this, 'access', _167 => _167.document, 'access', _168 => _168.table, 'optionalAccess', _169 => _169[key]]), () => ( 0))) === value) return;
2452
+ if ((_nullishCoalesce(_optionalChain([this, 'access', _185 => _185.document, 'access', _186 => _186.table, 'optionalAccess', _187 => _187[key]]), () => ( 0))) === value) return;
2377
2453
  this.applyTableChange(() => {
2378
2454
  this.table[key] = value;
2379
2455
  });
2380
2456
  }
2457
+ // --- Number formats ---
2458
+ //
2459
+ // Cells are replaced, never mutated in place: framework bindings compare
2460
+ // cell objects by identity to decide what to re-render.
2461
+ /**
2462
+ * Sets an explicit number format code (e.g. `0.00`, `"$"#,##0.00`,
2463
+ * `m/d/yyyy`, `[Red]0;[Blue]-0`) on every cell in `range`, including blank
2464
+ * cells, so values typed later keep it. `null` removes explicit formats: the
2465
+ * cells go back to their column's format or the one chosen for typed input.
2466
+ * Undoable as one step. Returns false when there is no range.
2467
+ */
2468
+ setCellNumberFormat(range, code) {
2469
+ if (!range) return false;
2470
+ const r = normalizeRange(range);
2471
+ this.recordSnapshot();
2472
+ const kind = code === null ? void 0 : cellFormatForNumberFormat(code);
2473
+ for (let ri = r.startRow; ri <= r.endRow; ri++) {
2474
+ const row = this.document.rows[ri];
2475
+ if (!row) continue;
2476
+ for (let ci = r.startCol; ci <= r.endCol; ci++) {
2477
+ const col = this.document.columns[ci];
2478
+ if (!col) continue;
2479
+ const cells = this.document.cells[row.id] ??= {};
2480
+ const existing = cells[col.id];
2481
+ if (code === null) {
2482
+ if (!_optionalChain([existing, 'optionalAccess', _188 => _188.explicitNumberFormat])) continue;
2483
+ if (existing.raw === "" && existing.value === "" && !existing.error) {
2484
+ delete cells[col.id];
2485
+ } else {
2486
+ const { explicitNumberFormat: _explicit, ...rest } = existing;
2487
+ cells[col.id] = this.withNumberFormat(rest, this.implicitNumberFormat(rest, col, row));
2488
+ }
2489
+ } else {
2490
+ cells[col.id] = {
2491
+ ..._nullishCoalesce(existing, () => ( { raw: "", value: "" })),
2492
+ format: _nullishCoalesce(_nullishCoalesce(kind, () => ( _optionalChain([existing, 'optionalAccess', _189 => _189.format]))), () => ( col.format)),
2493
+ numberFormat: code,
2494
+ explicitNumberFormat: true
2495
+ };
2496
+ }
2497
+ this.refreshSpilledNumberFormat(row, col);
2498
+ }
2499
+ }
2500
+ this.document.updatedAt = Date.now();
2501
+ this.notifyChange();
2502
+ return true;
2503
+ }
2504
+ /**
2505
+ * Sets the number format code of a column (`null` or `General` clears it).
2506
+ * Its cells without an explicit format of their own use it, including
2507
+ * values typed later; when cleared they go back to the format chosen for
2508
+ * typed input. Undoable.
2509
+ */
2510
+ setColumnNumberFormat(colId, code) {
2511
+ const col = this.getColumn(colId);
2512
+ if (!col) return;
2513
+ this.recordSnapshot();
2514
+ if (code === null || isGeneralNumberFormat(code)) delete col.numberFormat;
2515
+ else col.numberFormat = code;
2516
+ for (const row of this.document.rows) {
2517
+ const cells = this.document.cells[row.id];
2518
+ const cell = _optionalChain([cells, 'optionalAccess', _190 => _190[col.id]]);
2519
+ if (cells && cell && !cell.explicitNumberFormat) {
2520
+ cells[col.id] = this.withNumberFormat(cell, this.implicitNumberFormat(cell, col, row));
2521
+ }
2522
+ this.refreshSpilledNumberFormat(row, col);
2523
+ }
2524
+ this.document.updatedAt = Date.now();
2525
+ this.notifyChange();
2526
+ }
2527
+ /** The column's format, or the one typed input chose (typed cells only). */
2528
+ implicitNumberFormat(cell, col, row) {
2529
+ const typed = cell.raw !== "" && !cell.raw.startsWith("=") && !(col.type === "bound" && col.binding && row.recordId);
2530
+ return _nullishCoalesce(this.fixedNumberFormat(col, void 0), () => ( (typed ? _chunkMCSJFWAOcjs.parseCellInput.call(void 0, cell.raw).numberFormat : void 0)));
2531
+ }
2532
+ /** A copy of `cell` with `numberFormat` set, or removed when undefined. */
2533
+ withNumberFormat(cell, numberFormat) {
2534
+ const { numberFormat: _old, ...rest } = cell;
2535
+ return numberFormat === void 0 ? rest : { ...rest, numberFormat };
2536
+ }
2537
+ /** Re-applies the stored cell's (or the column's) format to a spilled value shown there. */
2538
+ refreshSpilledNumberFormat(row, col) {
2539
+ const id = spillCellId(row.id, col.id);
2540
+ const spilled = this.spillCells.get(id);
2541
+ if (!spilled) return;
2542
+ const { numberFormat: _old, explicitNumberFormat: _explicit, ...rest } = spilled;
2543
+ this.spillCells.set(id, { ...rest, ...this.fixedNumberFormatFields(col, _optionalChain([this, 'access', _191 => _191.document, 'access', _192 => _192.cells, 'access', _193 => _193[row.id], 'optionalAccess', _194 => _194[col.id]])) });
2544
+ }
2381
2545
  // --- Hide / unhide ---
2382
2546
  hideRows(indices) {
2383
2547
  this.setHidden("row", indices, true);
@@ -2414,7 +2578,7 @@ var SpreadsheetController = (_class3 = class {
2414
2578
  }
2415
2579
  // --- Merged cells ---
2416
2580
  getMerges() {
2417
- return _nullishCoalesce(_optionalChain([this, 'access', _170 => _170.document, 'access', _171 => _171.table, 'optionalAccess', _172 => _172.merges]), () => ( []));
2581
+ return _nullishCoalesce(_optionalChain([this, 'access', _195 => _195.document, 'access', _196 => _196.table, 'optionalAccess', _197 => _197.merges]), () => ( []));
2418
2582
  }
2419
2583
  /** The merge containing (row, col), or null. */
2420
2584
  getMergeAt(row, col) {
@@ -2467,7 +2631,7 @@ var SpreadsheetController = (_class3 = class {
2467
2631
  const rowId = this.document.rows[row].id;
2468
2632
  for (let col = r.startCol; col <= r.endCol; col++) {
2469
2633
  if (row === r.startRow && col === r.startCol) continue;
2470
- _optionalChainDelete([this, 'access', _173 => _173.document, 'access', _174 => _174.cells, 'access', _175 => _175[rowId], 'optionalAccess', _176 => _176[this.document.columns[col].id]]);
2634
+ _optionalChainDelete([this, 'access', _198 => _198.document, 'access', _199 => _199.cells, 'access', _200 => _200[rowId], 'optionalAccess', _201 => _201[this.document.columns[col].id]]);
2471
2635
  }
2472
2636
  }
2473
2637
  this.table.merges = [...merges.filter((m) => !rangeContainsRange(r, m)), r];
@@ -2553,14 +2717,14 @@ var SpreadsheetController = (_class3 = class {
2553
2717
  });
2554
2718
  }
2555
2719
  ungroupRows() {
2556
- if (!_optionalChain([this, 'access', _177 => _177.document, 'access', _178 => _178.table, 'optionalAccess', _179 => _179.grouping])) return;
2720
+ if (!_optionalChain([this, 'access', _202 => _202.document, 'access', _203 => _203.table, 'optionalAccess', _204 => _204.grouping])) return;
2557
2721
  this.applyTableChange(() => {
2558
2722
  delete this.table.grouping;
2559
2723
  });
2560
2724
  }
2561
2725
  /** Sets (or with `null`, removes) the group summary for a column. */
2562
2726
  setGroupSummary(colId, aggregate) {
2563
- const grouping = _optionalChain([this, 'access', _180 => _180.document, 'access', _181 => _181.table, 'optionalAccess', _182 => _182.grouping]);
2727
+ const grouping = _optionalChain([this, 'access', _205 => _205.document, 'access', _206 => _206.table, 'optionalAccess', _207 => _207.grouping]);
2564
2728
  if (!grouping) return;
2565
2729
  this.applyTableChange(() => {
2566
2730
  const others = grouping.summaries.filter((s) => s.colId !== colId);
@@ -2571,7 +2735,7 @@ var SpreadsheetController = (_class3 = class {
2571
2735
  });
2572
2736
  }
2573
2737
  setGroupCollapsed(key, collapsed) {
2574
- const grouping = _optionalChain([this, 'access', _183 => _183.document, 'access', _184 => _184.table, 'optionalAccess', _185 => _185.grouping]);
2738
+ const grouping = _optionalChain([this, 'access', _208 => _208.document, 'access', _209 => _209.table, 'optionalAccess', _210 => _210.grouping]);
2575
2739
  if (!grouping || grouping.collapsed.includes(key) === collapsed) return;
2576
2740
  this.applyTableChange(() => {
2577
2741
  this.table.grouping = {
@@ -2581,7 +2745,7 @@ var SpreadsheetController = (_class3 = class {
2581
2745
  });
2582
2746
  }
2583
2747
  toggleGroupCollapsed(key) {
2584
- const grouping = _optionalChain([this, 'access', _186 => _186.document, 'access', _187 => _187.table, 'optionalAccess', _188 => _188.grouping]);
2748
+ const grouping = _optionalChain([this, 'access', _211 => _211.document, 'access', _212 => _212.table, 'optionalAccess', _213 => _213.grouping]);
2585
2749
  if (!grouping) return;
2586
2750
  this.setGroupCollapsed(key, !grouping.collapsed.includes(key));
2587
2751
  }
@@ -2619,9 +2783,9 @@ var SpreadsheetController = (_class3 = class {
2619
2783
  moved.push({
2620
2784
  row: s.startRow + (c - s.startCol),
2621
2785
  col: s.startCol + (r - s.startRow),
2622
- cell: _optionalChain([this, 'access', _189 => _189.document, 'access', _190 => _190.cells, 'access', _191 => _191[rowId(r)], 'optionalAccess', _192 => _192[colId(c)]])
2786
+ cell: _optionalChain([this, 'access', _214 => _214.document, 'access', _215 => _215.cells, 'access', _216 => _216[rowId(r)], 'optionalAccess', _217 => _217[colId(c)]])
2623
2787
  });
2624
- _optionalChainDelete([this, 'access', _193 => _193.document, 'access', _194 => _194.cells, 'access', _195 => _195[rowId(r)], 'optionalAccess', _196 => _196[colId(c)]]);
2788
+ _optionalChainDelete([this, 'access', _218 => _218.document, 'access', _219 => _219.cells, 'access', _220 => _220[rowId(r)], 'optionalAccess', _221 => _221[colId(c)]]);
2625
2789
  }
2626
2790
  }
2627
2791
  for (const { row, col, cell } of moved) {
@@ -2648,6 +2812,28 @@ var SpreadsheetController = (_class3 = class {
2648
2812
  this.undoStack.push(JSON.stringify(this.document));
2649
2813
  if (this.undoStack.length > 50) this.undoStack.shift();
2650
2814
  this.redoStack = [];
2815
+ this.trimHistory();
2816
+ }
2817
+ /** Drops the oldest snapshots beyond `maxHistoryBytes`, always keeping the newest. */
2818
+ trimHistory() {
2819
+ if (this.maxHistoryBytes <= 0 || this.undoStack.length <= 1) return;
2820
+ let total = 0;
2821
+ for (const s of this.undoStack) total += s.length * 2;
2822
+ for (const s of this.redoStack) total += s.length * 2;
2823
+ while (total > this.maxHistoryBytes && this.undoStack.length > 1) {
2824
+ total -= this.undoStack.shift().length * 2;
2825
+ }
2826
+ }
2827
+ /** Approximate bytes held by the undo/redo snapshots (UTF-16 size). */
2828
+ getHistoryByteSize() {
2829
+ let total = 0;
2830
+ for (const s of this.undoStack) total += s.length * 2;
2831
+ for (const s of this.redoStack) total += s.length * 2;
2832
+ return total;
2833
+ }
2834
+ /** Number of undo / redo snapshots currently held. */
2835
+ getHistoryDepth() {
2836
+ return { undo: this.undoStack.length, redo: this.redoStack.length };
2651
2837
  }
2652
2838
  undo() {
2653
2839
  if (this.undoStack.length === 0) return;
@@ -2674,7 +2860,7 @@ var SpreadsheetController = (_class3 = class {
2674
2860
  }
2675
2861
  }
2676
2862
  notifyChange() {
2677
- _optionalChain([this, 'access', _197 => _197.onDocumentChange, 'optionalCall', _198 => _198(this.document)]);
2863
+ _optionalChain([this, 'access', _222 => _222.onDocumentChange, 'optionalCall', _223 => _223(this.document)]);
2678
2864
  }
2679
2865
  }, _class3);
2680
2866
  function stepInOrder(order, from, delta) {
@@ -2689,6 +2875,17 @@ function stepInOrder(order, from, delta) {
2689
2875
  }
2690
2876
 
2691
2877
  // src/spreadsheet/menu.ts
2878
+ function runSpreadsheetMenuItem(item, ask) {
2879
+ if (!item.input) {
2880
+ item.run();
2881
+ return true;
2882
+ }
2883
+ const prompt = _nullishCoalesce(ask, () => ( ((label, value) => typeof window !== "undefined" && window.prompt ? window.prompt(label, value) : null)));
2884
+ const text = prompt(item.input.label, _nullishCoalesce(item.input.defaultValue, () => ( "")));
2885
+ if (text === null || text === void 0) return false;
2886
+ item.run(text);
2887
+ return true;
2888
+ }
2692
2889
  function clampMenuPosition(point, size, viewport, margin = 4) {
2693
2890
  const place = (start, length, limit) => {
2694
2891
  if (start + length <= limit - margin) return Math.max(margin, start);
@@ -2710,8 +2907,9 @@ function getSpreadsheetMenuItems(controller, cell) {
2710
2907
  const row = doc.rows[cell.row];
2711
2908
  if (!column || !row) return [];
2712
2909
  const selection = controller.selectedRange && rangeContains(controller.selectedRange, cell.row, cell.col) ? normalizeRange(controller.selectedRange) : { startRow: cell.row, startCol: cell.col, endRow: cell.row, endCol: cell.col };
2713
- const colName = _chunkSAZRENEZcjs.indexToColName.call(void 0, cell.col);
2714
- const value = controller.getCell(row.id, column.id).value;
2910
+ const colName = _chunkMCSJFWAOcjs.indexToColName.call(void 0, cell.col);
2911
+ const cellData = controller.getCell(row.id, column.id);
2912
+ const value = cellData.value;
2715
2913
  const table = _nullishCoalesce(doc.table, () => ( {}));
2716
2914
  const filter = controller.getFilterState();
2717
2915
  const grouping = table.grouping;
@@ -2733,7 +2931,7 @@ function getSpreadsheetMenuItems(controller, cell) {
2733
2931
  },
2734
2932
  {
2735
2933
  id: "filter-equals",
2736
- label: `Show only rows where ${colName} = ${quote(value)}`,
2934
+ label: `Show only rows where ${colName} = ${quote(formatCellDisplay(cellData))}`,
2737
2935
  separatorBefore: true,
2738
2936
  run: () => controller.addFilterRule({ colId: column.id, operator: "equals", value: String(_nullishCoalesce(value, () => ( ""))) })
2739
2937
  },
@@ -2822,6 +3020,31 @@ function getSpreadsheetMenuItems(controller, cell) {
2822
3020
  }
2823
3021
  }
2824
3022
  ];
3023
+ const currentFormat = cellData.numberFormat;
3024
+ const presetMatch = NUMBER_FORMAT_PRESETS.find(
3025
+ (p) => p.id === "general" ? isGeneralNumberFormat(currentFormat) : p.code === currentFormat
3026
+ );
3027
+ NUMBER_FORMAT_PRESETS.forEach((preset, i) => {
3028
+ items.push({
3029
+ id: `number-format-${preset.id}`,
3030
+ label: `Format cells: ${preset.label}`,
3031
+ separatorBefore: i === 0,
3032
+ checked: presetMatch === preset,
3033
+ run: () => {
3034
+ controller.setCellNumberFormat(selection, preset.code);
3035
+ }
3036
+ });
3037
+ });
3038
+ items.push({
3039
+ id: "number-format-custom",
3040
+ label: "Format cells: Custom\u2026",
3041
+ checked: !presetMatch,
3042
+ input: { label: "Number format code, e.g. #,##0.00;[Red](#,##0.00)", defaultValue: _nullishCoalesce(currentFormat, () => ( "General")) },
3043
+ run: (code) => {
3044
+ if (code === void 0) return;
3045
+ controller.setCellNumberFormat(selection, code.trim() === "" ? null : code);
3046
+ }
3047
+ });
2825
3048
  if (grouping) {
2826
3049
  items.push(
2827
3050
  {
@@ -2880,6 +3103,8 @@ var SPREADSHEET_TABLE_ACTIONS = [
2880
3103
  "toggleGroupCollapsed",
2881
3104
  "getGroups",
2882
3105
  "transposeRange",
3106
+ "setCellNumberFormat",
3107
+ "setColumnNumberFormat",
2883
3108
  "exportToCsv",
2884
3109
  "importFromCsv",
2885
3110
  "copyToClipboardData",
@@ -2902,7 +3127,7 @@ function delimitedAdapter(id, label, delimiter, mimeTypes, extensions) {
2902
3127
  extensions,
2903
3128
  target: "spreadsheet",
2904
3129
  async import(_input, context) {
2905
- return { rows: parseCsv(await context.readText(), { delimiter }), delimiter };
3130
+ return { rows: _chunkTNNJXF46cjs.parseCsv.call(void 0, await context.readText(), { delimiter }), delimiter };
2906
3131
  }
2907
3132
  };
2908
3133
  }
@@ -2991,5 +3216,8 @@ async function importFileIntoSpreadsheet(controller, input, options) {
2991
3216
 
2992
3217
 
2993
3218
 
2994
- exports.columnDependencyKey = columnDependencyKey; exports.extractCellDependencies = extractCellDependencies; exports.DependencyGraph = DependencyGraph; exports.shiftFormulaReferences = shiftFormulaReferences; exports.mapFormulaReferences = mapFormulaReferences; exports.offsetFormulaReferences = offsetFormulaReferences; exports.remapFormulaReferences = remapFormulaReferences; exports.getFormulaCaretContext = getFormulaCaretContext; exports.getFormulaHints = getFormulaHints; exports.applyFormulaSuggestion = applyFormulaSuggestion; exports.DataSourceBinder = DataSourceBinder; exports.normalizeRange = normalizeRange; exports.rangeContains = rangeContains; exports.rangesIntersect = rangesIntersect; exports.rangeContainsRange = rangeContainsRange; exports.isSingleCellRange = isSingleCellRange; exports.isBlankValue = isBlankValue; exports.toNumber = toNumber; exports.compareCellValues = compareCellValues; exports.matchesFilterRule = matchesFilterRule; exports.aggregateValues = aggregateValues; exports.roundFloat = roundFloat; exports.fillSeries = fillSeries; exports.computeFillTarget = computeFillTarget; exports.getFillDirection = getFillDirection; exports.parseCsv = parseCsv; exports.escapeCsvField = escapeCsvField; exports.serializeCsv = serializeCsv; exports.parseTsv = parseTsv; exports.serializeTsv = serializeTsv; exports.SPREADSHEET_CLIPBOARD_MIME = SPREADSHEET_CLIPBOARD_MIME; exports.serializeHtmlTable = serializeHtmlTable; exports.parseHtmlTable = parseHtmlTable; exports.createSpreadsheetClipboardData = createSpreadsheetClipboardData; exports.readSpreadsheetClipboard = readSpreadsheetClipboard; exports.rebaseClipboardRows = rebaseClipboardRows; exports.DEFAULT_ROW_HEIGHT = DEFAULT_ROW_HEIGHT; exports.DEFAULT_COLUMN_WIDTH = DEFAULT_COLUMN_WIDTH; exports.getTableSections = getTableSections; exports.getRowSection = getRowSection; exports.rowPassesFilters = rowPassesFilters; exports.computeRowGroups = computeRowGroups; exports.buildSpreadsheetView = buildSpreadsheetView; exports.SpreadsheetController = SpreadsheetController; exports.clampMenuPosition = clampMenuPosition; exports.getSpreadsheetMenuItems = getSpreadsheetMenuItems; exports.SPREADSHEET_TABLE_ACTIONS = SPREADSHEET_TABLE_ACTIONS; exports.bindSpreadsheetTableActions = bindSpreadsheetTableActions; exports.csvImportAdapter = csvImportAdapter; exports.tsvImportAdapter = tsvImportAdapter; exports.SPREADSHEET_IMPORT_ADAPTERS = SPREADSHEET_IMPORT_ADAPTERS; exports.registerSpreadsheetImportAdapters = registerSpreadsheetImportAdapters; exports.importFileIntoSpreadsheet = importFileIntoSpreadsheet;
2995
- //# sourceMappingURL=chunk-6M3BCTBD.cjs.map
3219
+
3220
+
3221
+
3222
+ exports.columnDependencyKey = columnDependencyKey; exports.extractCellDependencies = extractCellDependencies; exports.DependencyGraph = DependencyGraph; exports.shiftFormulaReferences = shiftFormulaReferences; exports.mapFormulaReferences = mapFormulaReferences; exports.offsetFormulaReferences = offsetFormulaReferences; exports.remapFormulaReferences = remapFormulaReferences; exports.getFormulaCaretContext = getFormulaCaretContext; exports.getFormulaHints = getFormulaHints; exports.applyFormulaSuggestion = applyFormulaSuggestion; exports.NUMBER_FORMAT_PRESETS = NUMBER_FORMAT_PRESETS; exports.numberFormatForCellFormat = numberFormatForCellFormat; exports.cellFormatForNumberFormat = cellFormatForNumberFormat; exports.isGeneralNumberFormat = isGeneralNumberFormat; exports.formatCellForDisplay = formatCellForDisplay; exports.formatCellDisplay = formatCellDisplay; exports.formatValueWithCode = formatValueWithCode; exports.DataSourceBinder = DataSourceBinder; exports.normalizeRange = normalizeRange; exports.rangeContains = rangeContains; exports.rangesIntersect = rangesIntersect; exports.rangeContainsRange = rangeContainsRange; exports.isSingleCellRange = isSingleCellRange; exports.isBlankValue = isBlankValue; exports.toNumber = toNumber; exports.compareCellValues = compareCellValues; exports.matchesFilterRule = matchesFilterRule; exports.aggregateValues = aggregateValues; exports.roundFloat = roundFloat; exports.fillSeries = fillSeries; exports.computeFillTarget = computeFillTarget; exports.getFillDirection = getFillDirection; exports.SPREADSHEET_CLIPBOARD_MIME = SPREADSHEET_CLIPBOARD_MIME; exports.serializeHtmlTable = serializeHtmlTable; exports.parseHtmlTable = parseHtmlTable; exports.createSpreadsheetClipboardData = createSpreadsheetClipboardData; exports.readSpreadsheetClipboard = readSpreadsheetClipboard; exports.rebaseClipboardRows = rebaseClipboardRows; exports.DEFAULT_ROW_HEIGHT = DEFAULT_ROW_HEIGHT; exports.DEFAULT_COLUMN_WIDTH = DEFAULT_COLUMN_WIDTH; exports.getTableSections = getTableSections; exports.getRowSection = getRowSection; exports.rowPassesFilters = rowPassesFilters; exports.computeRowGroups = computeRowGroups; exports.buildSpreadsheetView = buildSpreadsheetView; exports.SpreadsheetController = SpreadsheetController; exports.runSpreadsheetMenuItem = runSpreadsheetMenuItem; exports.clampMenuPosition = clampMenuPosition; exports.getSpreadsheetMenuItems = getSpreadsheetMenuItems; exports.SPREADSHEET_TABLE_ACTIONS = SPREADSHEET_TABLE_ACTIONS; exports.bindSpreadsheetTableActions = bindSpreadsheetTableActions; exports.csvImportAdapter = csvImportAdapter; exports.tsvImportAdapter = tsvImportAdapter; exports.SPREADSHEET_IMPORT_ADAPTERS = SPREADSHEET_IMPORT_ADAPTERS; exports.registerSpreadsheetImportAdapters = registerSpreadsheetImportAdapters; exports.importFileIntoSpreadsheet = importFileIntoSpreadsheet;
3223
+ //# sourceMappingURL=chunk-MA2F5KHF.cjs.map