ooxml-core 1.9.0 → 1.10.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 (126) hide show
  1. package/dist/PptxHandler-5UURGJEV.mjs +2 -0
  2. package/dist/{PptxHandler-EX4WBIQQ.mjs → PptxHandler-ADEFY476.mjs} +2 -2
  3. package/dist/PptxHandler-U5XB2HUE.cjs +11 -0
  4. package/dist/automation/index.cjs +744 -192
  5. package/dist/automation/index.mjs +744 -192
  6. package/dist/{chunk-SWF7KVL5.cjs → chunk-3N6XMMTT.cjs} +1365 -1062
  7. package/dist/{chunk-FIELY5PI.mjs → chunk-5NVJN4E6.mjs} +30 -2
  8. package/dist/{chunk-IGOA57LE.mjs → chunk-A6P7G3UK.mjs} +1 -1
  9. package/dist/{chunk-CPKNMQLX.cjs → chunk-AWIDASUW.cjs} +25 -2
  10. package/dist/{chunk-SVQZXP3F.mjs → chunk-CBNKBVX5.mjs} +25 -2
  11. package/dist/{chunk-OXHMZS7B.mjs → chunk-CCHYFCPD.mjs} +649 -172
  12. package/dist/{chunk-OB277ZGE.mjs → chunk-R6KSBNKX.mjs} +27 -1
  13. package/dist/{chunk-AT66SA5M.cjs → chunk-S6DOCMQC.cjs} +28 -0
  14. package/dist/{chunk-WSO4T2LJ.mjs → chunk-WUE5ZHU3.mjs} +26 -3
  15. package/dist/{chunk-LCS3J3QI.mjs → chunk-ZE53K7DH.mjs} +474 -171
  16. package/dist/{chunk-M76PHYRR.mjs → chunk-ZOUGMAZG.mjs} +1 -1
  17. package/dist/docx/layout/adapt-table.d.ts +2 -2
  18. package/dist/docx/layout/adapt-table.d.ts.map +1 -1
  19. package/dist/docx/layout/flow-table.d.ts.map +1 -1
  20. package/dist/docx/layout/index.cjs +477 -75
  21. package/dist/docx/layout/index.mjs +477 -76
  22. package/dist/docx/layout/nested-frame-profile.d.ts +9 -0
  23. package/dist/docx/layout/nested-frame-profile.d.ts.map +1 -0
  24. package/dist/docx/layout/page-cursor.d.ts +2 -0
  25. package/dist/docx/layout/page-cursor.d.ts.map +1 -1
  26. package/dist/docx/layout/result.d.ts +13 -0
  27. package/dist/docx/layout/result.d.ts.map +1 -1
  28. package/dist/docx/layout/table-border-layout.d.ts +16 -0
  29. package/dist/docx/layout/table-border-layout.d.ts.map +1 -0
  30. package/dist/docx/layout/table-cell-layout.d.ts +2 -1
  31. package/dist/docx/layout/table-cell-layout.d.ts.map +1 -1
  32. package/dist/docx/layout/table-content.d.ts +4 -0
  33. package/dist/docx/layout/table-content.d.ts.map +1 -0
  34. package/dist/docx/layout/table-footnotes.d.ts +5 -0
  35. package/dist/docx/layout/table-footnotes.d.ts.map +1 -1
  36. package/dist/docx/layout/table-frames.d.ts +4 -0
  37. package/dist/docx/layout/table-frames.d.ts.map +1 -0
  38. package/dist/docx/layout/table-layout.d.ts +8 -3
  39. package/dist/docx/layout/table-layout.d.ts.map +1 -1
  40. package/dist/docx/layout/table-note-completion.d.ts +5 -0
  41. package/dist/docx/layout/table-note-completion.d.ts.map +1 -0
  42. package/dist/docx/layout/table-note-stories.d.ts +6 -0
  43. package/dist/docx/layout/table-note-stories.d.ts.map +1 -0
  44. package/dist/pptx/automation/index.cjs +535 -182
  45. package/dist/pptx/automation/index.d.ts +4 -4
  46. package/dist/pptx/automation/index.mjs +5 -5
  47. package/dist/pptx/chunks/{index-BZh-IMkN.d.ts → index-Cuxtr76Y.d.ts} +17 -3
  48. package/dist/pptx/chunks/index-Cuxtr76Y.d.ts.map +1 -0
  49. package/dist/pptx/chunks/{index-B4cnSPNz.d.ts → index-DUCGeZh7.d.ts} +65 -5
  50. package/dist/pptx/chunks/index-DUCGeZh7.d.ts.map +1 -0
  51. package/dist/pptx/chunks/{smart-art-Q2kZQtHh.d.ts → smart-art-D-sXa_Nb.d.ts} +11 -1
  52. package/dist/pptx/chunks/smart-art-D-sXa_Nb.d.ts.map +1 -0
  53. package/dist/pptx/chunks/{text-operations-BLodkuXE.d.ts → text-operations-BqHmLaLA.d.ts} +26 -2
  54. package/dist/pptx/chunks/text-operations-BqHmLaLA.d.ts.map +1 -0
  55. package/dist/pptx/cli/index.cjs +535 -182
  56. package/dist/pptx/cli/index.d.ts +1 -1
  57. package/dist/pptx/cli/index.mjs +4 -4
  58. package/dist/pptx/converter/index.cjs +1 -0
  59. package/dist/pptx/converter/index.d.ts +1 -1
  60. package/dist/pptx/converter/index.mjs +2 -2
  61. package/dist/pptx/editor/render/collaboration-live-patch-target.cjs +2 -2
  62. package/dist/pptx/editor/render/collaboration-live-patch-target.mjs +1 -1
  63. package/dist/pptx/editor/render/find-replace.cjs +18 -18
  64. package/dist/pptx/editor/render/find-replace.d.ts +2 -2
  65. package/dist/pptx/editor/render/find-replace.mjs +2 -2
  66. package/dist/pptx/editor/render/remap-text.cjs +2 -2
  67. package/dist/pptx/editor/render/remap-text.d.ts.map +1 -1
  68. package/dist/pptx/editor/render/remap-text.mjs +1 -1
  69. package/dist/pptx/editor/render/slide-operations.cjs +8 -8
  70. package/dist/pptx/editor/render/slide-operations.mjs +2 -2
  71. package/dist/pptx/index.cjs +762 -182
  72. package/dist/pptx/index.d.ts +5 -5
  73. package/dist/pptx/index.mjs +5 -5
  74. package/dist/pptx/smartart-layouts/index.d.ts +1 -1
  75. package/dist/teams/index.cjs +486 -114
  76. package/dist/teams/index.mjs +486 -114
  77. package/dist/visio/date-cache.d.ts +3 -0
  78. package/dist/visio/date-cache.d.ts.map +1 -0
  79. package/dist/visio/edit-text-field.d.ts.map +1 -1
  80. package/dist/visio/index.cjs +131 -22
  81. package/dist/visio/index.mjs +131 -22
  82. package/dist/visio/shape-metadata.d.ts.map +1 -1
  83. package/dist/visio/text-field-display.d.ts.map +1 -1
  84. package/dist/visio/text-field-fraction.d.ts +3 -0
  85. package/dist/visio/text-field-fraction.d.ts.map +1 -0
  86. package/dist/visio/text-field-numeric.d.ts +1 -1
  87. package/dist/visio/text-field-numeric.d.ts.map +1 -1
  88. package/dist/visio/text-field-system-date.d.ts +4 -0
  89. package/dist/visio/text-field-system-date.d.ts.map +1 -0
  90. package/dist/visio/text-fields.d.ts +1 -0
  91. package/dist/visio/text-fields.d.ts.map +1 -1
  92. package/dist/visio/ui/index.cjs +132 -22
  93. package/dist/visio/ui/index.mjs +132 -22
  94. package/dist/visio/ui/text-field-catalog.d.ts.map +1 -1
  95. package/dist/xlsx/edit/pivots.d.ts.map +1 -1
  96. package/dist/xlsx/index.cjs +614 -170
  97. package/dist/xlsx/index.mjs +614 -170
  98. package/dist/xlsx/load/index.cjs +575 -163
  99. package/dist/xlsx/load/index.mjs +575 -163
  100. package/dist/xlsx/model-pivots.d.ts +23 -2
  101. package/dist/xlsx/model-pivots.d.ts.map +1 -1
  102. package/dist/xlsx/pivot/admission.d.ts.map +1 -1
  103. package/dist/xlsx/pivot/aggregate.d.ts +3 -1
  104. package/dist/xlsx/pivot/aggregate.d.ts.map +1 -1
  105. package/dist/xlsx/pivot/data.d.ts +1 -1
  106. package/dist/xlsx/pivot/data.d.ts.map +1 -1
  107. package/dist/xlsx/pivot/hierarchy-first.d.ts +21 -0
  108. package/dist/xlsx/pivot/hierarchy-first.d.ts.map +1 -0
  109. package/dist/xlsx/pivot/hierarchy.d.ts +2 -4
  110. package/dist/xlsx/pivot/hierarchy.d.ts.map +1 -1
  111. package/dist/xlsx/pivot/measures.d.ts +13 -0
  112. package/dist/xlsx/pivot/measures.d.ts.map +1 -0
  113. package/dist/xlsx/pivot/read.d.ts.map +1 -1
  114. package/dist/xlsx/pivot/table-xml.d.ts.map +1 -1
  115. package/dist/xlsx/pivot/values-axis.d.ts +9 -0
  116. package/dist/xlsx/pivot/values-axis.d.ts.map +1 -0
  117. package/dist/xlsx/ui/commands/i18n/pivots.d.ts.map +1 -1
  118. package/dist/xlsx/ui/index.cjs +547 -127
  119. package/dist/xlsx/ui/index.mjs +547 -127
  120. package/package.json +1 -1
  121. package/dist/PptxHandler-AT7FVG5Q.mjs +0 -2
  122. package/dist/PptxHandler-VFSCECPL.cjs +0 -11
  123. package/dist/pptx/chunks/index-B4cnSPNz.d.ts.map +0 -1
  124. package/dist/pptx/chunks/index-BZh-IMkN.d.ts.map +0 -1
  125. package/dist/pptx/chunks/smart-art-Q2kZQtHh.d.ts.map +0 -1
  126. package/dist/pptx/chunks/text-operations-BLodkuXE.d.ts.map +0 -1
@@ -12217,7 +12217,6 @@ function visioWallClock(date2) {
12217
12217
  );
12218
12218
  }
12219
12219
  var EPOCH = Date.UTC(1899, 11, 30);
12220
- var visioDateSerial = (date2) => Number(((date2.getTime() - EPOCH) / 864e5).toFixed(8));
12221
12220
  var visioSerialDate = (serial) => Number.isFinite(serial) && Math.abs(serial) < 3e6 ? new Date(EPOCH + Math.round(serial * 864e5)) : void 0;
12222
12221
  function evaluateVisioTextField(formula, context) {
12223
12222
  let ast;
@@ -12328,7 +12327,10 @@ function formatNumber(value, picture) {
12328
12327
  if (!match) return void 0;
12329
12328
  const decimals = match[2]?.length ?? 0;
12330
12329
  const optional = match[2]?.startsWith("#") ?? false;
12331
- let text7 = value.toFixed(decimals);
12330
+ const [coefficient, exponent = "0"] = Math.abs(value).toString().split("e");
12331
+ const shifted = Number(coefficient + "e" + (Number(exponent) + decimals));
12332
+ const rounded = Math.floor(shifted + 0.5) / 10 ** decimals;
12333
+ let text7 = (Math.sign(value) * rounded).toFixed(decimals);
12332
12334
  if (optional && text7.includes(".")) text7 = text7.replace(/\.?0+$/, "");
12333
12335
  if (match[1]) {
12334
12336
  const [whole, fraction] = text7.split(".");
@@ -12338,6 +12340,7 @@ function formatNumber(value, picture) {
12338
12340
  }
12339
12341
  var VISIO_FIELD_FORMATS = {
12340
12342
  shortDate: "{{M/d/yyyy}}",
12343
+ isoDate: "{{yyyy-MM-dd}}",
12341
12344
  longDate: "{{dddd, MMMM d, yyyy}}",
12342
12345
  time: "{{h:mm tt}}",
12343
12346
  dateTime: "{{M/d/yyyy h:mm tt}}",
@@ -12367,9 +12370,35 @@ function formatVisioFieldValue(value, format4 = "") {
12367
12370
  return units2 || body === "" ? `${text7}${suffix}` : text7;
12368
12371
  }
12369
12372
 
12373
+ // visio/text-field-fraction.ts
12374
+ function fractionalFieldNumber(value, maxDenominator) {
12375
+ if (!Number.isFinite(value) || Math.abs(value) > 1e15) return void 0;
12376
+ const absolute = Math.abs(value);
12377
+ let whole = Math.floor(absolute);
12378
+ const remainder = absolute - whole;
12379
+ let numerator = 0, denominator = 1, error = remainder;
12380
+ for (let candidate = 1; candidate <= maxDenominator; candidate++) {
12381
+ const top = Math.round(remainder * candidate);
12382
+ const fraction = top / candidate;
12383
+ const distance4 = Math.abs(remainder - fraction);
12384
+ if (distance4 < error || distance4 === error && fraction > numerator / denominator) {
12385
+ numerator = top;
12386
+ denominator = candidate;
12387
+ error = distance4;
12388
+ }
12389
+ }
12390
+ if (numerator === denominator) {
12391
+ whole++;
12392
+ numerator = 0;
12393
+ }
12394
+ const text7 = numerator ? `${whole ? whole + " " : ""}${numerator}/${denominator}` : String(whole);
12395
+ return value < 0 && text7 !== "0" ? "-" + text7 : text7;
12396
+ }
12397
+
12370
12398
  // visio/text-field-numeric.ts
12371
12399
  function numericFieldPicture(value, code, displayUnit) {
12372
- if (value.kind !== "number" || code < 2 || code > 9 || !Number.isInteger(code)) return void 0;
12400
+ if (value.kind !== "number" || code < 0 || code > 18 || code > 9 && code < 15 || !Number.isInteger(code))
12401
+ return void 0;
12373
12402
  const unit3 = displayUnit?.toUpperCase() ?? "NUM";
12374
12403
  const units2 = {
12375
12404
  NUM: ["scalar", 1, ""],
@@ -12382,21 +12411,106 @@ function numericFieldPicture(value, code, displayUnit) {
12382
12411
  };
12383
12412
  const definition = Object.hasOwn(units2, unit3) ? units2[unit3] : void 0;
12384
12413
  if (!definition || definition[0] !== value.unit) return void 0;
12385
- const decimals = Math.floor((code - 2) / 2);
12386
- const picture = decimals ? `0.${"0".repeat(decimals)}` : "0";
12387
- const text7 = formatVisioFieldValue(
12388
- { kind: "number", value: value.value * definition[1], unit: "scalar" },
12389
- picture
12390
- );
12414
+ const general = code < 2;
12415
+ const decimals = general ? 4 : Math.floor((code - 2) / 2);
12416
+ const picture = general ? "0.####" : decimals ? `0.${"0".repeat(decimals)}` : "0";
12417
+ const displayed = value.value * definition[1];
12418
+ if (!Number.isFinite(displayed)) return void 0;
12419
+ if (code >= 15) {
12420
+ const fraction = fractionalFieldNumber(displayed, code < 17 ? 9 : 99);
12421
+ return fraction === void 0 ? void 0 : fraction + (code % 2 === 0 ? definition[2] : "");
12422
+ }
12423
+ if ((general || !decimals) && Math.abs(displayed) > 1e15) return void 0;
12424
+ const scientific = decimals > 0 && (Math.abs(displayed) >= 1e15 || displayed !== 0 && Math.abs(displayed) < 0.5 / 10 ** decimals);
12425
+ let text7;
12426
+ if (scientific) {
12427
+ const [coefficient, power] = displayed.toExponential().split("e");
12428
+ let exponent = Number(power);
12429
+ let precision = Math.abs(displayed) >= 1e15 ? decimals : decimals - 1;
12430
+ const mantissaPicture = precision ? `0.${"0".repeat(precision)}` : "0";
12431
+ let mantissa = formatVisioFieldValue(
12432
+ { kind: "number", value: Number(coefficient), unit: "scalar" },
12433
+ mantissaPicture
12434
+ );
12435
+ if (mantissa === void 0) return void 0;
12436
+ if (Math.abs(Number(mantissa)) >= 10) {
12437
+ exponent += 1;
12438
+ precision = decimals;
12439
+ mantissa = Math.sign(displayed).toFixed(precision);
12440
+ }
12441
+ if (general) mantissa = mantissa.replace(/\.?0+$/, "");
12442
+ else if (!mantissa.includes(".")) mantissa += ".";
12443
+ text7 = mantissa + (code % 2 ? "e" : "E") + exponent;
12444
+ } else {
12445
+ text7 = formatVisioFieldValue({ kind: "number", value: displayed, unit: "scalar" }, picture);
12446
+ }
12391
12447
  return text7 === void 0 ? void 0 : text7 + (code % 2 ? definition[2] : "");
12392
12448
  }
12393
12449
 
12450
+ // visio/date-cache.ts
12451
+ function visioIsoDateSerial(text7) {
12452
+ const match = /^(\d{4})-(\d{2})-(\d{2})(?:T(\d{2}):(\d{2})(?::(\d{2})(?:\.(\d+))?)?)?$/.exec(
12453
+ text7.trim()
12454
+ );
12455
+ if (!match) return void 0;
12456
+ const year = Number(match[1]), month = Number(match[2]), day = Number(match[3]);
12457
+ const hour = Number(match[4] ?? 0), minute = Number(match[5] ?? 0), second = Number(match[6] ?? 0);
12458
+ const millisecond = Number((match[7] ?? "").padEnd(3, "0").slice(0, 3));
12459
+ if (year < 1 || hour > 23 || minute > 59 || second > 59) return void 0;
12460
+ const date2 = /* @__PURE__ */ new Date(0);
12461
+ date2.setUTCFullYear(year, month - 1, day);
12462
+ date2.setUTCHours(hour, minute, second, millisecond);
12463
+ if (date2.getUTCFullYear() !== year || date2.getUTCMonth() !== month - 1 || date2.getUTCDate() !== day)
12464
+ return void 0;
12465
+ return (date2.getTime() - Date.UTC(1899, 11, 30)) / 864e5;
12466
+ }
12467
+
12468
+ // visio/text-field-system-date.ts
12469
+ var LONG_DATE = "{{dddd, MMMM d, yyyy}}";
12470
+ function englishLongDateProfile(cached5) {
12471
+ const match = /^[A-Za-z]+, [A-Za-z]+ ([1-9]|[12]\d|3[01]), (\d{4})$/.exec(cached5);
12472
+ if (!match) return false;
12473
+ for (let month = 0; month < 12; month++) {
12474
+ const candidate = /* @__PURE__ */ new Date(0);
12475
+ candidate.setUTCFullYear(Number(match[2]), month, Number(match[1]));
12476
+ if (candidate.getUTCMonth() === month && candidate.getTime() >= Date.UTC(1899, 11, 30) && formatVisioFieldValue({ kind: "date", date: candidate }, LONG_DATE) === cached5)
12477
+ return true;
12478
+ }
12479
+ return false;
12480
+ }
12481
+ function systemDatePicture(date2, code, cached5) {
12482
+ if (!Number.isFinite(date2.getTime()) || date2.getTime() < Date.UTC(1899, 11, 30) || date2.getUTCFullYear() > 9999)
12483
+ return void 0;
12484
+ if (code === "204") return formatVisioFieldValue({ kind: "date", date: date2 }, "{{yyyy-MM-dd}}");
12485
+ if (code === "21" || code === "201")
12486
+ return englishLongDateProfile(cached5) ? formatVisioFieldValue({ kind: "date", date: date2 }, LONG_DATE) : void 0;
12487
+ if (code === "20" || code === "200") {
12488
+ if (!/^\d{4}-\d{2}-\d{2}$/.test(cached5) || visioIsoDateSerial(cached5) === void 0)
12489
+ return void 0;
12490
+ return formatVisioFieldValue({ kind: "date", date: date2 }, "{{yyyy-MM-dd}}");
12491
+ }
12492
+ if (code !== "211" && code !== "212") return void 0;
12493
+ const match = /^(\d{4}-\d{2}-\d{2}) ([1-9]|1[0-2]):([0-5]\d)(?::([0-5]\d))? (AM|PM)$/.exec(
12494
+ cached5
12495
+ );
12496
+ if (!match || code === "212" !== (match[4] !== void 0)) return void 0;
12497
+ const hour = Number(match[2]) % 12 + (match[5] === "PM" ? 12 : 0);
12498
+ if (visioIsoDateSerial(
12499
+ `${match[1]}T${String(hour).padStart(2, "0")}:${match[3]}:${match[4] ?? "00"}`
12500
+ ) === void 0)
12501
+ return void 0;
12502
+ return formatVisioFieldValue(
12503
+ { kind: "date", date: date2 },
12504
+ code === "211" ? "{{yyyy-MM-dd h:mm tt}}" : "{{yyyy-MM-dd h:mm:ss tt}}"
12505
+ );
12506
+ }
12507
+
12394
12508
  // visio/text-field-display.ts
12395
12509
  function cachedValue(value, unit3) {
12396
12510
  if (value === void 0) return void 0;
12397
12511
  if (unit3 === "STR") return { kind: "string", text: value };
12398
12512
  if (unit3 === "DATE") {
12399
- const date2 = visioSerialDate(Number(value));
12513
+ const date2 = visioSerialDate(visioIsoDateSerial(value) ?? Number(value));
12400
12514
  return date2 ? { kind: "date", date: date2 } : void 0;
12401
12515
  }
12402
12516
  try {
@@ -12426,6 +12540,8 @@ function textFieldDisplay(element2, sheet, context) {
12426
12540
  }
12427
12541
  if (source?.kind === "number" && code !== void 0)
12428
12542
  text8 = numericFieldPicture(source, Number(code), value?.unit) ?? cached5;
12543
+ if (source?.kind === "date" && code !== void 0)
12544
+ text8 = systemDatePicture(source.date, code, cached5) ?? cached5;
12429
12545
  return { text: text8, ...result };
12430
12546
  }
12431
12547
  const text7 = source ? formatVisioFieldValue(source, picture) : void 0;
@@ -13629,15 +13745,6 @@ function booleanValue(text7) {
13629
13745
  const value = numeric3(text7);
13630
13746
  return value === void 0 ? void 0 : value !== 0;
13631
13747
  }
13632
- function isoSerialDays(text7) {
13633
- const match = /^(\d{4})-(\d{2})-(\d{2})(?:T(\d{2}):(\d{2})(?::(\d{2}(?:\.\d+)?))?)?$/.exec(
13634
- text7.trim()
13635
- );
13636
- if (!match) return void 0;
13637
- const [year, month, day, hour, minute, second] = match.slice(1).map((part) => Number(part ?? 0));
13638
- const time = Date.UTC(year, month - 1, day, hour, minute, second);
13639
- return Number.isFinite(time) ? (time - Date.UTC(1899, 11, 30)) / 864e5 : void 0;
13640
- }
13641
13748
  function property(row2, budget, report) {
13642
13749
  const get = (key2) => cached2(row2.cells, key2, budget, report);
13643
13750
  const rawType = get("Type"), rawValue = get("Value");
@@ -13648,7 +13755,7 @@ function property(row2, budget, report) {
13648
13755
  if (rawValue !== void 0 && row2.cells.get("Value")?.error === void 0) {
13649
13756
  if (type === 0 || type === 1 || type === 4) value = budget.retain(rawValue);
13650
13757
  else if (type === 3) value = booleanValue(rawValue);
13651
- else if (type === 5) value = numeric3(rawValue) ?? isoSerialDays(rawValue);
13758
+ else if (type === 5) value = numeric3(rawValue) ?? visioIsoDateSerial(rawValue);
13652
13759
  else if (valueKind !== "unparsed") value = numeric3(rawValue);
13653
13760
  }
13654
13761
  if (value === void 0) {
@@ -21354,7 +21461,8 @@ function shapeResolver(shape) {
21354
21461
  }
21355
21462
  function valueCell(value) {
21356
21463
  if (value.kind === "string") return { v: value.text, u: "STR", type: 0 };
21357
- if (value.kind === "date") return { v: String(visioDateSerial(value.date)), u: "DATE", type: 5 };
21464
+ if (value.kind === "date")
21465
+ return { v: value.date.toISOString().replace(/Z$/, ""), u: "DATE", type: 5 };
21358
21466
  const unit3 = value.unit === "length" ? "IN" : value.unit === "angle" ? "DEG" : void 0;
21359
21467
  return { v: String(Number(value.value.toFixed(10))), ...unit3 ? { u: unit3 } : {}, type: 2 };
21360
21468
  }
@@ -21441,7 +21549,8 @@ async function insertVisioTextField(pkg, pagePaths, roots2, document, edit, chec
21441
21549
  };
21442
21550
  const stored = valueCell(value);
21443
21551
  cell("Value", stored.v, { ...stored.u ? { U: stored.u } : {}, F: edit.formula });
21444
- if (edit.format) cell("Format", edit.format, { F: `"${edit.format.replaceAll('"', '""')}"` });
21552
+ if (edit.format)
21553
+ cell("Format", edit.format, { U: "STR", F: `"${edit.format.replaceAll('"', '""')}"` });
21445
21554
  cell("Type", String(stored.type));
21446
21555
  section3.appendChild(row2);
21447
21556
  const field3 = owner.createElementNS(ns, "fld");
@@ -32790,6 +32899,7 @@ function visioTextBlockEdit(page, shape, frame) {
32790
32899
  // visio/ui/text-field-catalog.ts
32791
32900
  var dateFormats = [
32792
32901
  { label: "Short date (10/9/2026)", format: VISIO_FIELD_FORMATS.shortDate },
32902
+ { label: "ISO date (2026-10-09)", format: VISIO_FIELD_FORMATS.isoDate },
32793
32903
  { label: "Long date (Friday, October 9, 2026)", format: VISIO_FIELD_FORMATS.longDate },
32794
32904
  { label: "Time (2:05 PM)", format: VISIO_FIELD_FORMATS.time },
32795
32905
  { label: "Date and time", format: VISIO_FIELD_FORMATS.dateTime }
@@ -12211,7 +12211,6 @@ function visioWallClock(date2) {
12211
12211
  );
12212
12212
  }
12213
12213
  var EPOCH = Date.UTC(1899, 11, 30);
12214
- var visioDateSerial = (date2) => Number(((date2.getTime() - EPOCH) / 864e5).toFixed(8));
12215
12214
  var visioSerialDate = (serial) => Number.isFinite(serial) && Math.abs(serial) < 3e6 ? new Date(EPOCH + Math.round(serial * 864e5)) : void 0;
12216
12215
  function evaluateVisioTextField(formula, context) {
12217
12216
  let ast;
@@ -12322,7 +12321,10 @@ function formatNumber(value, picture) {
12322
12321
  if (!match) return void 0;
12323
12322
  const decimals = match[2]?.length ?? 0;
12324
12323
  const optional = match[2]?.startsWith("#") ?? false;
12325
- let text7 = value.toFixed(decimals);
12324
+ const [coefficient, exponent = "0"] = Math.abs(value).toString().split("e");
12325
+ const shifted = Number(coefficient + "e" + (Number(exponent) + decimals));
12326
+ const rounded = Math.floor(shifted + 0.5) / 10 ** decimals;
12327
+ let text7 = (Math.sign(value) * rounded).toFixed(decimals);
12326
12328
  if (optional && text7.includes(".")) text7 = text7.replace(/\.?0+$/, "");
12327
12329
  if (match[1]) {
12328
12330
  const [whole, fraction] = text7.split(".");
@@ -12332,6 +12334,7 @@ function formatNumber(value, picture) {
12332
12334
  }
12333
12335
  var VISIO_FIELD_FORMATS = {
12334
12336
  shortDate: "{{M/d/yyyy}}",
12337
+ isoDate: "{{yyyy-MM-dd}}",
12335
12338
  longDate: "{{dddd, MMMM d, yyyy}}",
12336
12339
  time: "{{h:mm tt}}",
12337
12340
  dateTime: "{{M/d/yyyy h:mm tt}}",
@@ -12361,9 +12364,35 @@ function formatVisioFieldValue(value, format4 = "") {
12361
12364
  return units2 || body === "" ? `${text7}${suffix}` : text7;
12362
12365
  }
12363
12366
 
12367
+ // visio/text-field-fraction.ts
12368
+ function fractionalFieldNumber(value, maxDenominator) {
12369
+ if (!Number.isFinite(value) || Math.abs(value) > 1e15) return void 0;
12370
+ const absolute = Math.abs(value);
12371
+ let whole = Math.floor(absolute);
12372
+ const remainder = absolute - whole;
12373
+ let numerator = 0, denominator = 1, error = remainder;
12374
+ for (let candidate = 1; candidate <= maxDenominator; candidate++) {
12375
+ const top = Math.round(remainder * candidate);
12376
+ const fraction = top / candidate;
12377
+ const distance4 = Math.abs(remainder - fraction);
12378
+ if (distance4 < error || distance4 === error && fraction > numerator / denominator) {
12379
+ numerator = top;
12380
+ denominator = candidate;
12381
+ error = distance4;
12382
+ }
12383
+ }
12384
+ if (numerator === denominator) {
12385
+ whole++;
12386
+ numerator = 0;
12387
+ }
12388
+ const text7 = numerator ? `${whole ? whole + " " : ""}${numerator}/${denominator}` : String(whole);
12389
+ return value < 0 && text7 !== "0" ? "-" + text7 : text7;
12390
+ }
12391
+
12364
12392
  // visio/text-field-numeric.ts
12365
12393
  function numericFieldPicture(value, code, displayUnit) {
12366
- if (value.kind !== "number" || code < 2 || code > 9 || !Number.isInteger(code)) return void 0;
12394
+ if (value.kind !== "number" || code < 0 || code > 18 || code > 9 && code < 15 || !Number.isInteger(code))
12395
+ return void 0;
12367
12396
  const unit3 = displayUnit?.toUpperCase() ?? "NUM";
12368
12397
  const units2 = {
12369
12398
  NUM: ["scalar", 1, ""],
@@ -12376,21 +12405,106 @@ function numericFieldPicture(value, code, displayUnit) {
12376
12405
  };
12377
12406
  const definition = Object.hasOwn(units2, unit3) ? units2[unit3] : void 0;
12378
12407
  if (!definition || definition[0] !== value.unit) return void 0;
12379
- const decimals = Math.floor((code - 2) / 2);
12380
- const picture = decimals ? `0.${"0".repeat(decimals)}` : "0";
12381
- const text7 = formatVisioFieldValue(
12382
- { kind: "number", value: value.value * definition[1], unit: "scalar" },
12383
- picture
12384
- );
12408
+ const general = code < 2;
12409
+ const decimals = general ? 4 : Math.floor((code - 2) / 2);
12410
+ const picture = general ? "0.####" : decimals ? `0.${"0".repeat(decimals)}` : "0";
12411
+ const displayed = value.value * definition[1];
12412
+ if (!Number.isFinite(displayed)) return void 0;
12413
+ if (code >= 15) {
12414
+ const fraction = fractionalFieldNumber(displayed, code < 17 ? 9 : 99);
12415
+ return fraction === void 0 ? void 0 : fraction + (code % 2 === 0 ? definition[2] : "");
12416
+ }
12417
+ if ((general || !decimals) && Math.abs(displayed) > 1e15) return void 0;
12418
+ const scientific = decimals > 0 && (Math.abs(displayed) >= 1e15 || displayed !== 0 && Math.abs(displayed) < 0.5 / 10 ** decimals);
12419
+ let text7;
12420
+ if (scientific) {
12421
+ const [coefficient, power] = displayed.toExponential().split("e");
12422
+ let exponent = Number(power);
12423
+ let precision = Math.abs(displayed) >= 1e15 ? decimals : decimals - 1;
12424
+ const mantissaPicture = precision ? `0.${"0".repeat(precision)}` : "0";
12425
+ let mantissa = formatVisioFieldValue(
12426
+ { kind: "number", value: Number(coefficient), unit: "scalar" },
12427
+ mantissaPicture
12428
+ );
12429
+ if (mantissa === void 0) return void 0;
12430
+ if (Math.abs(Number(mantissa)) >= 10) {
12431
+ exponent += 1;
12432
+ precision = decimals;
12433
+ mantissa = Math.sign(displayed).toFixed(precision);
12434
+ }
12435
+ if (general) mantissa = mantissa.replace(/\.?0+$/, "");
12436
+ else if (!mantissa.includes(".")) mantissa += ".";
12437
+ text7 = mantissa + (code % 2 ? "e" : "E") + exponent;
12438
+ } else {
12439
+ text7 = formatVisioFieldValue({ kind: "number", value: displayed, unit: "scalar" }, picture);
12440
+ }
12385
12441
  return text7 === void 0 ? void 0 : text7 + (code % 2 ? definition[2] : "");
12386
12442
  }
12387
12443
 
12444
+ // visio/date-cache.ts
12445
+ function visioIsoDateSerial(text7) {
12446
+ const match = /^(\d{4})-(\d{2})-(\d{2})(?:T(\d{2}):(\d{2})(?::(\d{2})(?:\.(\d+))?)?)?$/.exec(
12447
+ text7.trim()
12448
+ );
12449
+ if (!match) return void 0;
12450
+ const year = Number(match[1]), month = Number(match[2]), day = Number(match[3]);
12451
+ const hour = Number(match[4] ?? 0), minute = Number(match[5] ?? 0), second = Number(match[6] ?? 0);
12452
+ const millisecond = Number((match[7] ?? "").padEnd(3, "0").slice(0, 3));
12453
+ if (year < 1 || hour > 23 || minute > 59 || second > 59) return void 0;
12454
+ const date2 = /* @__PURE__ */ new Date(0);
12455
+ date2.setUTCFullYear(year, month - 1, day);
12456
+ date2.setUTCHours(hour, minute, second, millisecond);
12457
+ if (date2.getUTCFullYear() !== year || date2.getUTCMonth() !== month - 1 || date2.getUTCDate() !== day)
12458
+ return void 0;
12459
+ return (date2.getTime() - Date.UTC(1899, 11, 30)) / 864e5;
12460
+ }
12461
+
12462
+ // visio/text-field-system-date.ts
12463
+ var LONG_DATE = "{{dddd, MMMM d, yyyy}}";
12464
+ function englishLongDateProfile(cached5) {
12465
+ const match = /^[A-Za-z]+, [A-Za-z]+ ([1-9]|[12]\d|3[01]), (\d{4})$/.exec(cached5);
12466
+ if (!match) return false;
12467
+ for (let month = 0; month < 12; month++) {
12468
+ const candidate = /* @__PURE__ */ new Date(0);
12469
+ candidate.setUTCFullYear(Number(match[2]), month, Number(match[1]));
12470
+ if (candidate.getUTCMonth() === month && candidate.getTime() >= Date.UTC(1899, 11, 30) && formatVisioFieldValue({ kind: "date", date: candidate }, LONG_DATE) === cached5)
12471
+ return true;
12472
+ }
12473
+ return false;
12474
+ }
12475
+ function systemDatePicture(date2, code, cached5) {
12476
+ if (!Number.isFinite(date2.getTime()) || date2.getTime() < Date.UTC(1899, 11, 30) || date2.getUTCFullYear() > 9999)
12477
+ return void 0;
12478
+ if (code === "204") return formatVisioFieldValue({ kind: "date", date: date2 }, "{{yyyy-MM-dd}}");
12479
+ if (code === "21" || code === "201")
12480
+ return englishLongDateProfile(cached5) ? formatVisioFieldValue({ kind: "date", date: date2 }, LONG_DATE) : void 0;
12481
+ if (code === "20" || code === "200") {
12482
+ if (!/^\d{4}-\d{2}-\d{2}$/.test(cached5) || visioIsoDateSerial(cached5) === void 0)
12483
+ return void 0;
12484
+ return formatVisioFieldValue({ kind: "date", date: date2 }, "{{yyyy-MM-dd}}");
12485
+ }
12486
+ if (code !== "211" && code !== "212") return void 0;
12487
+ const match = /^(\d{4}-\d{2}-\d{2}) ([1-9]|1[0-2]):([0-5]\d)(?::([0-5]\d))? (AM|PM)$/.exec(
12488
+ cached5
12489
+ );
12490
+ if (!match || code === "212" !== (match[4] !== void 0)) return void 0;
12491
+ const hour = Number(match[2]) % 12 + (match[5] === "PM" ? 12 : 0);
12492
+ if (visioIsoDateSerial(
12493
+ `${match[1]}T${String(hour).padStart(2, "0")}:${match[3]}:${match[4] ?? "00"}`
12494
+ ) === void 0)
12495
+ return void 0;
12496
+ return formatVisioFieldValue(
12497
+ { kind: "date", date: date2 },
12498
+ code === "211" ? "{{yyyy-MM-dd h:mm tt}}" : "{{yyyy-MM-dd h:mm:ss tt}}"
12499
+ );
12500
+ }
12501
+
12388
12502
  // visio/text-field-display.ts
12389
12503
  function cachedValue(value, unit3) {
12390
12504
  if (value === void 0) return void 0;
12391
12505
  if (unit3 === "STR") return { kind: "string", text: value };
12392
12506
  if (unit3 === "DATE") {
12393
- const date2 = visioSerialDate(Number(value));
12507
+ const date2 = visioSerialDate(visioIsoDateSerial(value) ?? Number(value));
12394
12508
  return date2 ? { kind: "date", date: date2 } : void 0;
12395
12509
  }
12396
12510
  try {
@@ -12420,6 +12534,8 @@ function textFieldDisplay(element2, sheet, context) {
12420
12534
  }
12421
12535
  if (source?.kind === "number" && code !== void 0)
12422
12536
  text8 = numericFieldPicture(source, Number(code), value?.unit) ?? cached5;
12537
+ if (source?.kind === "date" && code !== void 0)
12538
+ text8 = systemDatePicture(source.date, code, cached5) ?? cached5;
12423
12539
  return { text: text8, ...result };
12424
12540
  }
12425
12541
  const text7 = source ? formatVisioFieldValue(source, picture) : void 0;
@@ -13623,15 +13739,6 @@ function booleanValue(text7) {
13623
13739
  const value = numeric3(text7);
13624
13740
  return value === void 0 ? void 0 : value !== 0;
13625
13741
  }
13626
- function isoSerialDays(text7) {
13627
- const match = /^(\d{4})-(\d{2})-(\d{2})(?:T(\d{2}):(\d{2})(?::(\d{2}(?:\.\d+)?))?)?$/.exec(
13628
- text7.trim()
13629
- );
13630
- if (!match) return void 0;
13631
- const [year, month, day, hour, minute, second] = match.slice(1).map((part) => Number(part ?? 0));
13632
- const time = Date.UTC(year, month - 1, day, hour, minute, second);
13633
- return Number.isFinite(time) ? (time - Date.UTC(1899, 11, 30)) / 864e5 : void 0;
13634
- }
13635
13742
  function property(row2, budget, report) {
13636
13743
  const get = (key2) => cached2(row2.cells, key2, budget, report);
13637
13744
  const rawType = get("Type"), rawValue = get("Value");
@@ -13642,7 +13749,7 @@ function property(row2, budget, report) {
13642
13749
  if (rawValue !== void 0 && row2.cells.get("Value")?.error === void 0) {
13643
13750
  if (type === 0 || type === 1 || type === 4) value = budget.retain(rawValue);
13644
13751
  else if (type === 3) value = booleanValue(rawValue);
13645
- else if (type === 5) value = numeric3(rawValue) ?? isoSerialDays(rawValue);
13752
+ else if (type === 5) value = numeric3(rawValue) ?? visioIsoDateSerial(rawValue);
13646
13753
  else if (valueKind !== "unparsed") value = numeric3(rawValue);
13647
13754
  }
13648
13755
  if (value === void 0) {
@@ -21348,7 +21455,8 @@ function shapeResolver(shape) {
21348
21455
  }
21349
21456
  function valueCell(value) {
21350
21457
  if (value.kind === "string") return { v: value.text, u: "STR", type: 0 };
21351
- if (value.kind === "date") return { v: String(visioDateSerial(value.date)), u: "DATE", type: 5 };
21458
+ if (value.kind === "date")
21459
+ return { v: value.date.toISOString().replace(/Z$/, ""), u: "DATE", type: 5 };
21352
21460
  const unit3 = value.unit === "length" ? "IN" : value.unit === "angle" ? "DEG" : void 0;
21353
21461
  return { v: String(Number(value.value.toFixed(10))), ...unit3 ? { u: unit3 } : {}, type: 2 };
21354
21462
  }
@@ -21435,7 +21543,8 @@ async function insertVisioTextField(pkg, pagePaths, roots2, document, edit, chec
21435
21543
  };
21436
21544
  const stored = valueCell(value);
21437
21545
  cell("Value", stored.v, { ...stored.u ? { U: stored.u } : {}, F: edit.formula });
21438
- if (edit.format) cell("Format", edit.format, { F: `"${edit.format.replaceAll('"', '""')}"` });
21546
+ if (edit.format)
21547
+ cell("Format", edit.format, { U: "STR", F: `"${edit.format.replaceAll('"', '""')}"` });
21439
21548
  cell("Type", String(stored.type));
21440
21549
  section3.appendChild(row2);
21441
21550
  const field3 = owner.createElementNS(ns, "fld");
@@ -32784,6 +32893,7 @@ function visioTextBlockEdit(page, shape, frame) {
32784
32893
  // visio/ui/text-field-catalog.ts
32785
32894
  var dateFormats = [
32786
32895
  { label: "Short date (10/9/2026)", format: VISIO_FIELD_FORMATS.shortDate },
32896
+ { label: "ISO date (2026-10-09)", format: VISIO_FIELD_FORMATS.isoDate },
32787
32897
  { label: "Long date (Friday, October 9, 2026)", format: VISIO_FIELD_FORMATS.longDate },
32788
32898
  { label: "Time (2:05 PM)", format: VISIO_FIELD_FORMATS.time },
32789
32899
  { label: "Date and time", format: VISIO_FIELD_FORMATS.dateTime }
@@ -1 +1 @@
1
- {"version":3,"file":"text-field-catalog.d.ts","sourceRoot":"","sources":["../../../visio/ui/text-field-catalog.ts"],"names":[],"mappings":"AAEA,MAAM,MAAM,kBAAkB,GAAG,MAAM,GAAG,UAAU,GAAG,MAAM,GAAG,UAAU,GAAG,QAAQ,CAAC;AACtF,MAAM,WAAW,gBAAgB;IAChC,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;CAChB;AACD,MAAM,WAAW,sBAAsB;IACtC,EAAE,EAAE,kBAAkB,CAAC;IACvB,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,SAAS,gBAAgB,EAAE,CAAC;IACpC,OAAO,EAAE,SAAS;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC;CACtD;AAkBD,2FAA2F;AAC3F,eAAO,MAAM,sBAAsB,EAAE,SAAS,sBAAsB,EAiDnE,CAAC"}
1
+ {"version":3,"file":"text-field-catalog.d.ts","sourceRoot":"","sources":["../../../visio/ui/text-field-catalog.ts"],"names":[],"mappings":"AAEA,MAAM,MAAM,kBAAkB,GAAG,MAAM,GAAG,UAAU,GAAG,MAAM,GAAG,UAAU,GAAG,QAAQ,CAAC;AACtF,MAAM,WAAW,gBAAgB;IAChC,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;CAChB;AACD,MAAM,WAAW,sBAAsB;IACtC,EAAE,EAAE,kBAAkB,CAAC;IACvB,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,SAAS,gBAAgB,EAAE,CAAC;IACpC,OAAO,EAAE,SAAS;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC;CACtD;AAmBD,2FAA2F;AAC3F,eAAO,MAAM,sBAAsB,EAAE,SAAS,sBAAsB,EAiDnE,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"pivots.d.ts","sourceRoot":"","sources":["../../../xlsx/edit/pivots.ts"],"names":[],"mappings":"AAAA,OAAO,EAMN,KAAK,WAAW,EAEhB,MAAM,YAAY,CAAC;AAEpB,OAAO,KAAK,EAAc,iBAAiB,EAAE,eAAe,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AAIzF,OAAO,EAAE,KAAK,WAAW,EAAW,MAAM,WAAW,CAAC;AAetD,wBAAgB,kBAAkB,CAAC,QAAQ,EAAE,QAAQ,GAAG,GAAG,CAAC,MAAM,CAAC,CASlE;AA4GD,wBAAgB,gBAAgB,CAC/B,GAAG,EAAE,WAAW,EAChB,CAAC,EAAE,MAAM,EACT,WAAW,EAAE,WAAW,EACxB,OAAO,EAAE,iBAAiB,GACxB,MAAM,CAyBR;AAED,wBAAgB,iBAAiB,CAChC,GAAG,EAAE,WAAW,EAChB,CAAC,EAAE,MAAM,EACT,IAAI,EAAE,MAAM,EACZ,KAAK,GAAE,eAAoB,GACzB,IAAI,CA6BN;AAED,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,WAAW,EAAE,CAAC,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,IAAI,CAgBhF"}
1
+ {"version":3,"file":"pivots.d.ts","sourceRoot":"","sources":["../../../xlsx/edit/pivots.ts"],"names":[],"mappings":"AAAA,OAAO,EAMN,KAAK,WAAW,EAEhB,MAAM,YAAY,CAAC;AAEpB,OAAO,KAAK,EAAc,iBAAiB,EAAE,eAAe,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AAIzF,OAAO,EAAE,KAAK,WAAW,EAAW,MAAM,WAAW,CAAC;AAgBtD,wBAAgB,kBAAkB,CAAC,QAAQ,EAAE,QAAQ,GAAG,GAAG,CAAC,MAAM,CAAC,CASlE;AAiHD,wBAAgB,gBAAgB,CAC/B,GAAG,EAAE,WAAW,EAChB,CAAC,EAAE,MAAM,EACT,WAAW,EAAE,WAAW,EACxB,OAAO,EAAE,iBAAiB,GACxB,MAAM,CA8BR;AAED,wBAAgB,iBAAiB,CAChC,GAAG,EAAE,WAAW,EAChB,CAAC,EAAE,MAAM,EACT,IAAI,EAAE,MAAM,EACZ,KAAK,GAAE,eAAoB,GACzB,IAAI,CAsCN;AAED,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,WAAW,EAAE,CAAC,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,IAAI,CAgBhF"}