kordoc 4.24.2 → 4.24.3

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 (124) hide show
  1. package/README.md +12 -10
  2. package/dist/{-SRNEV7LS.js → -Q56U3KCA.js} +11 -11
  3. package/dist/{chunk-E7B5CXYI.js → chunk-33NZN73M.js} +2 -2
  4. package/dist/{chunk-NJ5RUDCW.js → chunk-3EWXRIPH.js} +3 -3
  5. package/dist/{chunk-NMFFIUI6.js → chunk-42FSKT7R.js} +2 -2
  6. package/dist/{chunk-M46PB75E.js → chunk-4X73CGIL.js} +2 -2
  7. package/dist/{chunk-PNSALBXH.cjs → chunk-6ZRZLV3J.cjs} +2 -2
  8. package/dist/{chunk-PNSALBXH.cjs.map → chunk-6ZRZLV3J.cjs.map} +1 -1
  9. package/dist/{chunk-W24TJJNN.js → chunk-AEEQN6L3.js} +2 -2
  10. package/dist/{chunk-TW3V6FSH.js → chunk-EEXIFCXC.js} +2 -2
  11. package/dist/{chunk-LMEF7FN5.js → chunk-EWCJCWTT.js} +2 -2
  12. package/dist/{chunk-MHNJOJQV.js → chunk-FZT34MUI.js} +4 -4
  13. package/dist/{chunk-WDSTW3BD.js → chunk-HNX2I7D6.js} +2 -2
  14. package/dist/{chunk-PNX5FYHC.cjs → chunk-HTG3VVET.cjs} +24 -24
  15. package/dist/{chunk-PNX5FYHC.cjs.map → chunk-HTG3VVET.cjs.map} +1 -1
  16. package/dist/{chunk-KUC5I5MB.js → chunk-HU7POUBS.js} +2 -2
  17. package/dist/{chunk-WJAFE3Z6.js → chunk-I2QETSZN.js} +2 -2
  18. package/dist/{chunk-DHMBPMKC.js → chunk-J45OVEUM.js} +139 -15
  19. package/dist/chunk-J45OVEUM.js.map +1 -0
  20. package/dist/{chunk-UNICY546.cjs → chunk-JILIA5EV.cjs} +23 -23
  21. package/dist/{chunk-UNICY546.cjs.map → chunk-JILIA5EV.cjs.map} +1 -1
  22. package/dist/{chunk-TDMBTG7U.js → chunk-KXHNIHLC.js} +2 -2
  23. package/dist/{chunk-JFUUFJZW.cjs → chunk-N65EY5BI.cjs} +6 -6
  24. package/dist/{chunk-JFUUFJZW.cjs.map → chunk-N65EY5BI.cjs.map} +1 -1
  25. package/dist/{chunk-4XC4O7FJ.js → chunk-NKDPCALC.js} +4 -4
  26. package/dist/{chunk-C6ZVB547.js → chunk-OAOM7IEI.js} +11 -11
  27. package/dist/{chunk-4745MFQU.js → chunk-PHZDAHZC.js} +3 -3
  28. package/dist/{chunk-RIRPLFPN.js → chunk-PMX5CPK5.js} +2 -2
  29. package/dist/{chunk-E6VBLBOO.js → chunk-Q2QKRE4P.js} +2 -2
  30. package/dist/{chunk-7NTMM6PO.js → chunk-TZ753B6A.js} +2 -2
  31. package/dist/{chunk-HLTPMSYW.cjs → chunk-VFEI2GIE.cjs} +3 -3
  32. package/dist/{chunk-HLTPMSYW.cjs.map → chunk-VFEI2GIE.cjs.map} +1 -1
  33. package/dist/{chunk-3HN65YAL.js → chunk-W6O7KBOD.js} +2 -2
  34. package/dist/{chunk-VPSF5LEM.js → chunk-XAZ5RGVG.js} +3 -3
  35. package/dist/{chunk-R2GIGE5H.js → chunk-XNNMMYFO.js} +2 -2
  36. package/dist/{chunk-JMOAMKAR.js → chunk-XZOAE2Q7.js} +4 -4
  37. package/dist/{chunk-IGG63DFK.cjs → chunk-YG4YOPK6.cjs} +3 -3
  38. package/dist/{chunk-IGG63DFK.cjs.map → chunk-YG4YOPK6.cjs.map} +1 -1
  39. package/dist/chunks-REYSCBPB.js +10 -0
  40. package/dist/cli.js +30 -30
  41. package/dist/{formula-HK2MNZ3Q.cjs → formula-2BPHF6O7.cjs} +9 -9
  42. package/dist/{formula-HK2MNZ3Q.cjs.map → formula-2BPHF6O7.cjs.map} +1 -1
  43. package/dist/{formula-DSB574H7.js → formula-EA5GDCUD.js} +4 -4
  44. package/dist/{formula-U2LZ67KI.js → formula-IREEAC4T.js} +3 -3
  45. package/dist/{image-ocr-QNIMVE5A.cjs → image-ocr-CCTE7HX3.cjs} +17 -17
  46. package/dist/{image-ocr-QNIMVE5A.cjs.map → image-ocr-CCTE7HX3.cjs.map} +1 -1
  47. package/dist/{image-ocr-J54Q3YWP.js → image-ocr-JQJC5HWK.js} +6 -6
  48. package/dist/{image-ocr-3QB2HLSI.js → image-ocr-LGOFUS3O.js} +9 -9
  49. package/dist/index.cjs +517 -393
  50. package/dist/index.cjs.map +1 -1
  51. package/dist/index.js +139 -15
  52. package/dist/index.js.map +1 -1
  53. package/dist/mcp.js +23 -23
  54. package/dist/{model-bundle-CGWU4ALC.js → model-bundle-YW62Y6UD.js} +5 -5
  55. package/dist/{models-A3TF3BDV.js → models-AAL3IS2R.js} +5 -5
  56. package/dist/{parse-worker-v2-MNUD4WAR.js → parse-worker-v2-3JAHV7NY.js} +12 -12
  57. package/dist/{parser-C3ARF26I.js → parser-4FCKKJ2N.js} +18 -14
  58. package/dist/parser-4FCKKJ2N.js.map +1 -0
  59. package/dist/{parser-RPAHN3OR.cjs → parser-HE45CCSG.cjs} +163 -159
  60. package/dist/parser-HE45CCSG.cjs.map +1 -0
  61. package/dist/{parser-OBGWEWSU.js → parser-ZBP5GOQK.js} +15 -11
  62. package/dist/parser-ZBP5GOQK.js.map +1 -0
  63. package/dist/pdf-ocr-7MDCLWAA.cjs +31 -0
  64. package/dist/{pdf-ocr-GA5QJFNK.cjs.map → pdf-ocr-7MDCLWAA.cjs.map} +1 -1
  65. package/dist/{pdf-ocr-K53REDNY.js → pdf-ocr-HFAEOA7W.js} +6 -6
  66. package/dist/{pdf-ocr-ENLVEEYL.js → pdf-ocr-Q4TPGDDI.js} +9 -9
  67. package/dist/{profile-io-ZGFEO7CB.js → profile-io-EDQTKLLL.js} +3 -3
  68. package/dist/{rasterize-QMC2SAUT.js → rasterize-VD2XGHUJ.js} +3 -3
  69. package/dist/{redact-doc-JH6RZZBE.js → redact-doc-TBIBQJCT.js} +11 -11
  70. package/dist/{render-ZGKQLKPJ.js → render-J5KAZAQH.js} +7 -7
  71. package/dist/seal-H2JNAZU7.js +10 -0
  72. package/dist/{setup-LAQGCYQ2.js → setup-5LYHCQRU.js} +3 -3
  73. package/dist/visual-7EO6GR3M.js +21 -0
  74. package/dist/{watch-7YPB4TKC.js → watch-YP4IWM75.js} +12 -12
  75. package/package.json +1 -1
  76. package/dist/chunk-DHMBPMKC.js.map +0 -1
  77. package/dist/chunks-AL4P5TO5.js +0 -10
  78. package/dist/parser-C3ARF26I.js.map +0 -1
  79. package/dist/parser-OBGWEWSU.js.map +0 -1
  80. package/dist/parser-RPAHN3OR.cjs.map +0 -1
  81. package/dist/pdf-ocr-GA5QJFNK.cjs +0 -31
  82. package/dist/seal-KMGYTJAV.js +0 -10
  83. package/dist/visual-4OYJFGXL.js +0 -21
  84. /package/dist/{-SRNEV7LS.js.map → -Q56U3KCA.js.map} +0 -0
  85. /package/dist/{chunk-E7B5CXYI.js.map → chunk-33NZN73M.js.map} +0 -0
  86. /package/dist/{chunk-NJ5RUDCW.js.map → chunk-3EWXRIPH.js.map} +0 -0
  87. /package/dist/{chunk-NMFFIUI6.js.map → chunk-42FSKT7R.js.map} +0 -0
  88. /package/dist/{chunk-M46PB75E.js.map → chunk-4X73CGIL.js.map} +0 -0
  89. /package/dist/{chunk-W24TJJNN.js.map → chunk-AEEQN6L3.js.map} +0 -0
  90. /package/dist/{chunk-TW3V6FSH.js.map → chunk-EEXIFCXC.js.map} +0 -0
  91. /package/dist/{chunk-LMEF7FN5.js.map → chunk-EWCJCWTT.js.map} +0 -0
  92. /package/dist/{chunk-MHNJOJQV.js.map → chunk-FZT34MUI.js.map} +0 -0
  93. /package/dist/{chunk-WDSTW3BD.js.map → chunk-HNX2I7D6.js.map} +0 -0
  94. /package/dist/{chunk-KUC5I5MB.js.map → chunk-HU7POUBS.js.map} +0 -0
  95. /package/dist/{chunk-WJAFE3Z6.js.map → chunk-I2QETSZN.js.map} +0 -0
  96. /package/dist/{chunk-TDMBTG7U.js.map → chunk-KXHNIHLC.js.map} +0 -0
  97. /package/dist/{chunk-4XC4O7FJ.js.map → chunk-NKDPCALC.js.map} +0 -0
  98. /package/dist/{chunk-C6ZVB547.js.map → chunk-OAOM7IEI.js.map} +0 -0
  99. /package/dist/{chunk-4745MFQU.js.map → chunk-PHZDAHZC.js.map} +0 -0
  100. /package/dist/{chunk-RIRPLFPN.js.map → chunk-PMX5CPK5.js.map} +0 -0
  101. /package/dist/{chunk-E6VBLBOO.js.map → chunk-Q2QKRE4P.js.map} +0 -0
  102. /package/dist/{chunk-7NTMM6PO.js.map → chunk-TZ753B6A.js.map} +0 -0
  103. /package/dist/{chunk-3HN65YAL.js.map → chunk-W6O7KBOD.js.map} +0 -0
  104. /package/dist/{chunk-VPSF5LEM.js.map → chunk-XAZ5RGVG.js.map} +0 -0
  105. /package/dist/{chunk-R2GIGE5H.js.map → chunk-XNNMMYFO.js.map} +0 -0
  106. /package/dist/{chunk-JMOAMKAR.js.map → chunk-XZOAE2Q7.js.map} +0 -0
  107. /package/dist/{chunks-AL4P5TO5.js.map → chunks-REYSCBPB.js.map} +0 -0
  108. /package/dist/{formula-DSB574H7.js.map → formula-EA5GDCUD.js.map} +0 -0
  109. /package/dist/{formula-U2LZ67KI.js.map → formula-IREEAC4T.js.map} +0 -0
  110. /package/dist/{image-ocr-J54Q3YWP.js.map → image-ocr-JQJC5HWK.js.map} +0 -0
  111. /package/dist/{image-ocr-3QB2HLSI.js.map → image-ocr-LGOFUS3O.js.map} +0 -0
  112. /package/dist/{model-bundle-CGWU4ALC.js.map → model-bundle-YW62Y6UD.js.map} +0 -0
  113. /package/dist/{models-A3TF3BDV.js.map → models-AAL3IS2R.js.map} +0 -0
  114. /package/dist/{parse-worker-v2-MNUD4WAR.js.map → parse-worker-v2-3JAHV7NY.js.map} +0 -0
  115. /package/dist/{pdf-ocr-ENLVEEYL.js.map → pdf-ocr-HFAEOA7W.js.map} +0 -0
  116. /package/dist/{pdf-ocr-K53REDNY.js.map → pdf-ocr-Q4TPGDDI.js.map} +0 -0
  117. /package/dist/{profile-io-ZGFEO7CB.js.map → profile-io-EDQTKLLL.js.map} +0 -0
  118. /package/dist/{rasterize-QMC2SAUT.js.map → rasterize-VD2XGHUJ.js.map} +0 -0
  119. /package/dist/{redact-doc-JH6RZZBE.js.map → redact-doc-TBIBQJCT.js.map} +0 -0
  120. /package/dist/{render-ZGKQLKPJ.js.map → render-J5KAZAQH.js.map} +0 -0
  121. /package/dist/{seal-KMGYTJAV.js.map → seal-H2JNAZU7.js.map} +0 -0
  122. /package/dist/{setup-LAQGCYQ2.js.map → setup-5LYHCQRU.js.map} +0 -0
  123. /package/dist/{visual-4OYJFGXL.js.map → visual-7EO6GR3M.js.map} +0 -0
  124. /package/dist/{watch-7YPB4TKC.js.map → watch-YP4IWM75.js.map} +0 -0
package/dist/index.js CHANGED
@@ -2,7 +2,7 @@ import {
2
2
  blocksToPages,
3
3
  bmpToPng,
4
4
  inlineImagesIntoMarkdown
5
- } from "./chunk-3HN65YAL.js";
5
+ } from "./chunk-W6O7KBOD.js";
6
6
  import {
7
7
  parsePageRange
8
8
  } from "./chunk-V4BH5SRQ.js";
@@ -43,7 +43,7 @@ import {
43
43
  validateOcrOptions,
44
44
  visibleText,
45
45
  wrapScript
46
- } from "./chunk-TW3V6FSH.js";
46
+ } from "./chunk-EEXIFCXC.js";
47
47
  import {
48
48
  KordocError,
49
49
  OPTIONAL_DEP_INSTALL_HINT,
@@ -61,7 +61,7 @@ import {
61
61
  toArrayBuffer,
62
62
  unescapeHtml,
63
63
  unzipLimitBytes
64
- } from "./chunk-WJAFE3Z6.js";
64
+ } from "./chunk-I2QETSZN.js";
65
65
 
66
66
  // src/plain-markdown.ts
67
67
  function toPlainMarkdown(md2) {
@@ -24620,7 +24620,7 @@ var MIN_SIDE = 24;
24620
24620
  async function ocrEmbeddedImages(blocks, options, warnings) {
24621
24621
  const ocr = options?.ocr;
24622
24622
  if (ocr !== true && ocr !== "force" && typeof ocr !== "function") return false;
24623
- const { parseImageDocument } = await import("./image-ocr-J54Q3YWP.js");
24623
+ const { parseImageDocument } = await import("./image-ocr-JQJC5HWK.js");
24624
24624
  let inserted = false, unreadable = 0;
24625
24625
  let failed = null;
24626
24626
  const walk = async (list, depth) => {
@@ -52495,6 +52495,12 @@ function solveRowHeights(cells, rowCount, maxTotal = Number.POSITIVE_INFINITY, s
52495
52495
  for (const r of missing) h[r] = each;
52496
52496
  return true;
52497
52497
  };
52498
+ for (let r = 0; r < rowCount; r++) {
52499
+ if (h[r] !== 0) continue;
52500
+ let need = 0;
52501
+ for (const { c, rows } of spans) if (rows[rows.length - 1] === r && rows.slice(0, -1).every((q) => h[q] > 0)) need = Math.max(need, c.height - rows.slice(0, -1).reduce((t, q) => t + h[q], 0));
52502
+ if (need > 0) h[r] = need;
52503
+ }
52498
52504
  for (let again = true; again; ) {
52499
52505
  again = false;
52500
52506
  for (let k = 0; k < spans.length; k++) if (!done.has(k) && solve(k, true)) again = true;
@@ -52973,6 +52979,7 @@ function splitTableRows(tbl2, top, lim, bodyH, styles, notes) {
52973
52979
  const fl = () => notes && nN > 0 ? Math.min(floor, bodyH - notes.area((moved ? 0 : notes.n0) + nN, (moved ? 0 : notes.s0) + nS)) : floor;
52974
52980
  const sp = num2(tbl2, "cellSpacing");
52975
52981
  const cells = mode === "CELL" ? collectCells(tbl2) : [];
52982
+ const tableCells = mode === "TABLE" ? collectCells(tbl2) : [];
52976
52983
  const record = mode === "CELL" ? /* @__PURE__ */ new Map() : void 0;
52977
52984
  const carries = /* @__PURE__ */ new Map();
52978
52985
  for (let r = 0; r < rows.length; r++) {
@@ -53001,7 +53008,20 @@ function splitTableRows(tbl2, top, lim, bodyH, styles, notes) {
53001
53008
  y += h;
53002
53009
  continue;
53003
53010
  }
53004
- if (y + h + outB > fl() && !(moved && y === outT + headH)) {
53011
+ let need = h;
53012
+ if (!tableCells.some((c) => c.ra < r && c.ra + c.rs > r)) {
53013
+ let end = r + 1;
53014
+ for (let grown = true; grown; ) {
53015
+ grown = false;
53016
+ for (const c of tableCells) if (c.ra >= r && c.ra < end && c.ra + c.rs > end) {
53017
+ end = c.ra + c.rs;
53018
+ grown = true;
53019
+ }
53020
+ }
53021
+ const groupH = rows.slice(r, end).reduce((a, b) => a + b, 0);
53022
+ if (end > r + 1 && groupH <= bodyH - outT - outB - headH) need = groupH;
53023
+ }
53024
+ if (y + need + outB > fl() && !(moved && y === outT + headH)) {
53005
53025
  if (!moved && r === 0) splitWhole = true;
53006
53026
  y = outT + headH;
53007
53027
  floor = bodyH;
@@ -54609,6 +54629,26 @@ function cellLineBoxes(c) {
54609
54629
  function cellLines(c) {
54610
54630
  return cellLineBoxes(c).map((b) => [b.top, b.bottom]);
54611
54631
  }
54632
+ function spanPartRows(cells, rowY) {
54633
+ const out = /* @__PURE__ */ new Set();
54634
+ for (const c of cells) {
54635
+ if (c.rs < 2) continue;
54636
+ const bs = cellLineBoxes(c);
54637
+ const parts = bs.length ? bs[bs.length - 1].part : 0;
54638
+ let s = c.ra;
54639
+ for (let k = 0; k < parts; k++) {
54640
+ const inK = bs.filter((b) => b.part === k);
54641
+ if (!inK.length) break;
54642
+ const ext = Math.max(...inK.map((b) => b.bottom)) - inK[0].origin + c.marginT + c.marginB;
54643
+ let r = s + 1;
54644
+ while (r < c.ra + c.rs && rowY[r] - rowY[s] < ext - 100) r++;
54645
+ if (r >= c.ra + c.rs) break;
54646
+ out.add(r);
54647
+ s = r;
54648
+ }
54649
+ }
54650
+ return out;
54651
+ }
54612
54652
  function planTableRows(tbl2, cells, rowH, ty, MT, BODY_H, slack = 0, floatSpan, nested = false, contMT = MT) {
54613
54653
  if (nested) slack = 0;
54614
54654
  const nRows = rowH.length;
@@ -54641,9 +54681,15 @@ function planTableRows(tbl2, cells, rowH, ty, MT, BODY_H, slack = 0, floatSpan,
54641
54681
  const out = [];
54642
54682
  const flows = (findChildByLocalName(tbl2, "pos")?.getAttribute("vertRelTo") ?? "PARA") === "PARA";
54643
54683
  let page = 0, y = ty, first = !flows || ty - MT < 2e3;
54684
+ const spanStarts = cellSplit ? spanPartRows(cells, rowY) : /* @__PURE__ */ new Set();
54644
54685
  for (let r = 0; r < nRows; r++) {
54645
54686
  let h = rowH[r];
54646
54687
  const pieces = [];
54688
+ if (!first && r >= hdrRows && spanStarts.has(r)) {
54689
+ page++;
54690
+ y = contTop;
54691
+ first = true;
54692
+ }
54647
54693
  const rowCells = cells.filter((c) => c.ra === r && c.rs === 1);
54648
54694
  const splittable = cellSplit && r >= hdrRows && rowCells.length > 0;
54649
54695
  const stack = splittable && rowCells.length === 1 ? stackedFloats(rowCells[0]) : [];
@@ -54858,6 +54904,21 @@ function planTableRows(tbl2, cells, rowH, ty, MT, BODY_H, slack = 0, floatSpan,
54858
54904
  page++;
54859
54905
  y = contTop;
54860
54906
  first = true;
54907
+ } else if (!first && tbl2.getAttribute("pageBreak") === "TABLE" && r >= hdrRows && !cells.some((c) => c.ra < r && c.ra + c.rs > r)) {
54908
+ let end = r + 1;
54909
+ for (let grown = true; grown; ) {
54910
+ grown = false;
54911
+ for (const c of cells) if (c.ra >= r && c.ra < end && c.ra + c.rs > end) {
54912
+ end = c.ra + c.rs;
54913
+ grown = true;
54914
+ }
54915
+ }
54916
+ const groupH = rowY[Math.min(end, nRows)] - rowY[r];
54917
+ if (end > r + 1 && y + groupH + outB > pageBottom && groupH <= pageBottom - contTop) {
54918
+ page++;
54919
+ y = contTop;
54920
+ first = true;
54921
+ }
54861
54922
  }
54862
54923
  out.push([{ page, y, h }]);
54863
54924
  y += h;
@@ -54900,12 +54961,27 @@ function renderingMatrix(el) {
54900
54961
  const info = findChildByLocalName(el, "renderingInfo");
54901
54962
  if (!info) return null;
54902
54963
  let m = null;
54964
+ let pendingS = null;
54965
+ const apply = (n) => {
54966
+ m = m ? mulAffine(m, n) : n;
54967
+ };
54903
54968
  for (const c of elements(info)) {
54904
54969
  const tag = ln(c);
54905
54970
  if (tag !== "transMatrix" && tag !== "scaMatrix" && tag !== "rotMatrix") continue;
54906
54971
  const n = [num2(c, "e1", 1), num2(c, "e4"), num2(c, "e2"), num2(c, "e5", 1), num2(c, "e3"), num2(c, "e6")];
54907
- m = m ? mulAffine(m, n) : n;
54972
+ if (tag === "scaMatrix") {
54973
+ if (pendingS) apply(pendingS);
54974
+ pendingS = n;
54975
+ continue;
54976
+ }
54977
+ if (tag === "rotMatrix" && pendingS) {
54978
+ apply(mulAffine(n, pendingS));
54979
+ pendingS = null;
54980
+ continue;
54981
+ }
54982
+ apply(n);
54908
54983
  }
54984
+ if (pendingS) apply(pendingS);
54909
54985
  return m;
54910
54986
  }
54911
54987
  function objectGeometry(el, x, y, w, h, boxW = w, boxH = h) {
@@ -55012,7 +55088,7 @@ function linePushedBy(o, lineV, paraTop) {
55012
55088
  const raw = num2(pos, "vertOffset"), vo = (pos?.getAttribute("vertRelTo") ?? "PARA") === "PARA" ? Math.max(0, raw >= 2 ** 31 ? raw - 2 ** 32 : raw) : 0;
55013
55089
  return Math.abs(lineV - (vo + num2(om, "top") + o.height + num2(om, "bottom")) - paraTop) <= 10;
55014
55090
  }
55015
- function anchorObject(o, ox, oy, baseV, areaW, ctx, anchorLineV, stayLine = false, paraStartV, lineH, lineSB = 0) {
55091
+ function anchorObject(o, ox, oy, baseV, areaW, ctx, anchorLineV, stayLine = false, paraStartV, lineH, lineSB = 0, anchorAt = "end") {
55016
55092
  const { PW, PH, ML, MT, BODY_W, BODY_H } = ctx.geom;
55017
55093
  const pos = findChildByLocalName(o.el, "pos");
55018
55094
  const om = findChildByLocalName(o.el, "outMargin");
@@ -55040,8 +55116,9 @@ function anchorObject(o, ox, oy, baseV, areaW, ctx, anchorLineV, stayLine = fals
55040
55116
  y = oy + anchor + omT + vo;
55041
55117
  } else {
55042
55118
  const origin = vrel === "PARA" && wrap === "SQUARE" ? paraStartV ?? baseV : baseV;
55043
- const later = vrel === "PARA" && wrap === "SQUARE" && anchorLineV !== void 0 && anchorLineV > baseV;
55044
- y = later ? oy + anchorLineV + vo + omT : oy + Math.max(origin + vo, wrap === "SQUARE" && anchorLineV !== void 0 ? anchorLineV : -Infinity) + omT;
55119
+ const later = vrel === "PARA" && wrap === "SQUARE" && anchorAt === "end" && anchorLineV !== void 0 && anchorLineV > baseV;
55120
+ const midLater = vrel === "PARA" && wrap === "SQUARE" && anchorAt === "top" && anchorLineV !== void 0 && anchorLineV > baseV;
55121
+ y = later ? oy + anchorLineV + vo + omT : oy + Math.max(origin + vo, wrap === "SQUARE" && !midLater && anchorLineV !== void 0 ? anchorLineV : -Infinity) + omT;
55045
55122
  }
55046
55123
  let x;
55047
55124
  const omL = num2(om, "left"), omR = num2(om, "right");
@@ -55571,7 +55648,8 @@ function drawPara(p, ox, oy, areaW, ctx, depth, segPages) {
55571
55648
  const plan = plans[planIdx];
55572
55649
  if (segPages && segPages[planIdx] !== void 0) ctx.page = segPages[planIdx];
55573
55650
  const x = ox + plan.seg.horzpos + plan.xoff + advanceTo(m, ctx.styles, plan, o.index) + o.omL;
55574
- const eqAsc = o.tag === "equation" && Number(o.el.getAttribute("baseLine")) > 0 ? Math.round(o.height * Number(o.el.getAttribute("baseLine")) / 100) : o.tag === "pic" ? Math.round(o.height * 0.85) : o.height;
55651
+ const shadowed = o.tag === "pic" && !!findChildByLocalName(findChildByLocalName(o.el, "effects") ?? o.el, "shadow") && plan.seg.textheight > o.height && Math.abs(plan.seg.baseline - Math.round(plan.seg.textheight * 0.85)) <= 2;
55652
+ const eqAsc = o.tag === "equation" && Number(o.el.getAttribute("baseLine")) > 0 ? Math.round(o.height * Number(o.el.getAttribute("baseLine")) / 100) : shadowed ? Math.round(plan.seg.textheight * 0.85) : o.tag === "pic" ? Math.round(o.height * 0.85) : o.height;
55575
55653
  const iom = findChildByLocalName(o.el, "outMargin"), iomT = num2(iom, "top"), iomB = num2(iom, "bottom");
55576
55654
  const yTop = oy + plan.seg.vertpos + Math.max(iomT, plan.seg.baseline - eqAsc - iomB - captionExtra(o.el));
55577
55655
  drawObject(o, x, yTop, baseV, areaW, ctx, depth);
@@ -55585,9 +55663,11 @@ function drawPara(p, ox, oy, areaW, ctx, depth, segPages) {
55585
55663
  }
55586
55664
  let anchorLineV;
55587
55665
  let anchorLineH = 0;
55666
+ let anchorSeg;
55588
55667
  for (const pl of plans) if (pl.start <= o.index) {
55589
55668
  anchorLineV = pl.seg.vertpos;
55590
55669
  anchorLineH = pl.seg.textheight;
55670
+ anchorSeg = pl.seg;
55591
55671
  }
55592
55672
  let objBaseV = baseV;
55593
55673
  const pTop = depth === 0 ? ctx.paraTops?.get(p) : void 0;
@@ -55598,6 +55678,9 @@ function drawPara(p, ox, oy, areaW, ctx, depth, segPages) {
55598
55678
  if (baseV > start + 100) {
55599
55679
  objBaseV = start;
55600
55680
  if (anchorLineV === baseV) anchorLineV = start;
55681
+ } else if (depth > 0 && start > top0 && Math.abs(baseV - start) <= 100) {
55682
+ objBaseV = top0;
55683
+ if (anchorLineV === baseV) anchorLineV = top0;
55601
55684
  }
55602
55685
  }
55603
55686
  const tbFloats = m.objs.filter((q) => !q.inline && (q.el.getAttribute("textWrap") ?? "TOP_AND_BOTTOM") === "TOP_AND_BOTTOM" && (findChildByLocalName(q.el, "pos")?.getAttribute("vertRelTo") ?? "PARA") === "PARA").length;
@@ -55605,7 +55688,21 @@ function drawPara(p, ox, oy, areaW, ctx, depth, segPages) {
55605
55688
  const sbA = m.paraPrId != null ? ctx.styles.paraGeom.get(m.paraPrId)?.spaceBefore ?? 0 : 0;
55606
55689
  if (stay && wrapA === "TOP_AND_BOTTOM" && linePushedBy(o, anchorLineV ?? baseV, pTop ?? (depth > 0 ? cellParaTop(p, ctx.styles.paraGeom) : void 0))) stay = false;
55607
55690
  const firstLine = anchorLineV === void 0 || anchorLineV === baseV;
55608
- let { x, y } = anchorObject(o, ax, oy, objBaseV, aw, ctx, anchorLineV, stay ? sbA : false, (firstLine || wrapA === "SQUARE") && pTop !== void 0 && pTop < baseV ? pTop : void 0, anchorLineH, firstLine ? sbA : 0);
55691
+ let { x, y } = anchorObject(
55692
+ o,
55693
+ ax,
55694
+ oy,
55695
+ objBaseV,
55696
+ aw,
55697
+ ctx,
55698
+ anchorLineV,
55699
+ stay ? sbA : false,
55700
+ (firstLine || wrapA === "SQUARE") && pTop !== void 0 && pTop < baseV ? pTop : void 0,
55701
+ anchorLineH,
55702
+ firstLine ? sbA : 0,
55703
+ // 문단 중간 글자 앵커인데 첫 줄부터 앵커 줄만큼 좁게 저장됐으면 개체는 문단 위에 있다(같은 판 한컴 PDF: 둘째 줄 앵커 사진, 네 줄 모두 34602)
55704
+ m.chars.slice(o.index).some((c) => c.ch.trim() !== "") && !!anchorSeg && plans.length > 0 && plans[0].seg !== anchorSeg && Math.abs(plans[0].seg.horzsize - anchorSeg.horzsize) <= 100 && anchorSeg.horzpos + anchorSeg.horzsize < aw - 1e3 ? "top" : m.chars.slice(o.index).some((c) => c.ch.trim() !== "") ? "mid" : "end"
55705
+ );
55609
55706
  let stackTop = depth === 0 ? pTop ?? 0 : cellParaTop(p, ctx.styles.paraGeom);
55610
55707
  if (tbFloats >= 2 && wrapA === "TOP_AND_BOTTOM" && stackTop !== void 0) {
55611
55708
  if (!tbStack) {
@@ -55860,10 +55957,28 @@ function drawTable(tbl2, tx, ty, ctx, depth) {
55860
55957
  pcs.forEach((pc, k) => geom.push({ c, page: startPage + pc.page, ...xw(c), y: pc.y, h: pc.h, pieces: k === 0 ? pcs : [] }));
55861
55958
  continue;
55862
55959
  }
55960
+ if (c.rs > 1) {
55961
+ const span2 = plan.slice(c.ra, Math.min(c.ra + c.rs, nRows)).flat();
55962
+ const pages = [...new Set(span2.map((pc) => pc.page))];
55963
+ if (pages.length > 1) {
55964
+ const bs = cellLineBoxes(c);
55965
+ const partTop = (k) => bs.find((b) => b.part === k);
55966
+ const groups = pages.map((pg, k) => {
55967
+ const on = span2.filter((pc) => pc.page === pg);
55968
+ const y0 = Math.min(...on.map((pc) => pc.y)), y1 = Math.max(...on.map((pc) => pc.y + pc.h));
55969
+ const from = k === 0 ? 0 : partTop(k)?.origin ?? Number.POSITIVE_INFINITY;
55970
+ const to = k === pages.length - 1 ? Number.POSITIVE_INFINITY : partTop(k + 1)?.top ?? Number.POSITIVE_INFINITY;
55971
+ return { page: pg, y: y0, h: y1 - y0, range: /* @__PURE__ */ new Map([[c.el, [from, to]]]) };
55972
+ });
55973
+ groups.forEach((pc, k) => geom.push({ c, page: startPage + pc.page, ...xw(c), y: pc.y, h: pc.h, pieces: k === 0 ? groups : [] }));
55974
+ continue;
55975
+ }
55976
+ }
55863
55977
  const h = c.rs === 1 ? pcs[0].h : rowY[Math.min(c.ra + c.rs, nRows)] - rowY[c.ra];
55864
55978
  geom.push({ c, page: startPage + pcs[0].page, ...xw(c), y: pcs[0].y, h });
55865
55979
  }
55866
- for (const page of contPages) for (const c of cells) if (c.ra < hdrRows) geom.push({ c, page, ...xw(c), y: ctx.geom.MT + num2(findChildByLocalName(tbl2, "outMargin"), "top") + rowY[c.ra], h: rowY[Math.min(c.ra + c.rs, nRows)] - rowY[c.ra] });
55980
+ const contBase = depth !== 1 && ctx.splitContMT !== void 0 ? ctx.splitContMT : ctx.geom.MT;
55981
+ for (const page of contPages) for (const c of cells) if (c.ra < hdrRows) geom.push({ c, page, ...xw(c), y: contBase + num2(findChildByLocalName(tbl2, "outMargin"), "top") + rowY[c.ra], h: rowY[Math.min(c.ra + c.rs, nRows)] - rowY[c.ra] });
55867
55982
  for (const g3 of geom) {
55868
55983
  ctx.page = g3.page;
55869
55984
  const bf = g3.c.bfId != null ? ctx.styles.borderFill.get(g3.c.bfId) : void 0;
@@ -55908,7 +56023,7 @@ function drawTable(tbl2, tx, ty, ctx, depth) {
55908
56023
  });
55909
56024
  ctx.splitCell = splitHere;
55910
56025
  const contMTSaved = ctx.splitContMT;
55911
- ctx.splitContMT = ctx.geom.MT + num2(findChildByLocalName(tbl2, "outMargin"), "top") + rowY[hdrRows] + c.marginT;
56026
+ ctx.splitContMT = (depth > 1 && contMTSaved !== void 0 ? contMTSaved : ctx.geom.MT) + num2(findChildByLocalName(tbl2, "outMargin"), "top") + rowY[hdrRows] + c.marginT;
55912
56027
  drawPara(p, g3.x + c.marginL, base, g3.w - c.marginL - c.marginR, ctx, depth + 1, pages);
55913
56028
  ctx.splitContMT = contMTSaved;
55914
56029
  ctx.splitCell = false;
@@ -56555,6 +56670,7 @@ async function renderHwpxInternal(input, options) {
56555
56670
  }
56556
56671
  const roots = [];
56557
56672
  let noCacheSkipped = false;
56673
+ const lastParity = /* @__PURE__ */ new Map();
56558
56674
  for (let si = 0; si < secXmls.length; si++) {
56559
56675
  const secXml = secXmls[si];
56560
56676
  const hasCache = /<(?:[A-Za-z][\w.-]*:)?linesegarray[\s/>]/.test(secXml);
@@ -56571,6 +56687,14 @@ async function renderHwpxInternal(input, options) {
56571
56687
  }
56572
56688
  const secPr = findFirst(root, "secPr");
56573
56689
  const referenced = secPr ? elements(secPr).filter((el) => ln(el) === "masterPage").map((el) => masterPages.get(el.getAttribute("idRef") || "")).filter((el) => !!el) : [];
56690
+ const typeOf = (m) => m.getAttribute("type") || "BOTH";
56691
+ const has3 = (t) => referenced.some((m) => typeOf(m) === t);
56692
+ if (!has3("BOTH")) for (const [t, other] of [["EVEN", "ODD"], ["ODD", "EVEN"]]) {
56693
+ const prev = lastParity.get(t);
56694
+ if (prev && !has3(t) && has3(other)) referenced.unshift(prev);
56695
+ }
56696
+ for (const m of referenced) if (typeOf(m) === "EVEN" || typeOf(m) === "ODD") lastParity.set(typeOf(m), m);
56697
+ if (has3("BOTH")) lastParity.clear();
56574
56698
  roots.push({ root, index: si, masterPages: referenced, hasDeletionMarkers: secXml.includes("deleteBegin") || secXml.includes("deleteEnd") });
56575
56699
  }
56576
56700
  if (roots.length === 0) {
@@ -57605,7 +57729,7 @@ function scriptsOff(r, off) {
57605
57729
  }
57606
57730
  async function parseImage(buffer, options) {
57607
57731
  try {
57608
- const { parseImageDocument } = await import("./image-ocr-J54Q3YWP.js");
57732
+ const { parseImageDocument } = await import("./image-ocr-JQJC5HWK.js");
57609
57733
  const { blocks, warnings, lines } = await parseImageDocument(buffer, options);
57610
57734
  stripScriptTags({ blocks });
57611
57735
  return {
@@ -57669,7 +57793,7 @@ async function parseHwp(buffer, options) {
57669
57793
  async function parsePdf(buffer, options) {
57670
57794
  let parsePdfDocument;
57671
57795
  try {
57672
- const mod = await import("./parser-OBGWEWSU.js");
57796
+ const mod = await import("./parser-ZBP5GOQK.js");
57673
57797
  parsePdfDocument = mod.parsePdfDocument;
57674
57798
  } catch {
57675
57799
  return {