kordoc 4.17.3 → 4.17.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{-WP4ZCXHV.js → -R64MUZYI.js} +11 -11
- package/dist/{chunk-JORDNRVS.js → chunk-2DA5KVHL.js} +2 -2
- package/dist/{chunk-DPMDJYHX.js → chunk-3CBCXXMW.js} +2 -2
- package/dist/{chunk-UJZABAVA.js → chunk-3OAC2DOI.js} +200 -97
- package/dist/chunk-3OAC2DOI.js.map +1 -0
- package/dist/{chunk-TTSXZO2A.js → chunk-43QRXSO2.js} +3 -3
- package/dist/{chunk-C3MC7HOB.js → chunk-55MXXUO5.js} +2 -2
- package/dist/{chunk-WFXZRYFS.js → chunk-6UNH3R5O.js} +2 -2
- package/dist/{chunk-5HIJXVED.js → chunk-CEN6GPOI.js} +2 -2
- package/dist/{chunk-4PY2V33D.js → chunk-DV6QO76R.js} +2 -2
- package/dist/{chunk-VNDVI3MJ.js → chunk-FL32PTUU.js} +349 -330
- package/dist/chunk-FL32PTUU.js.map +1 -0
- package/dist/{chunk-OOUW3ROZ.js → chunk-FSEYF24M.js} +4 -4
- package/dist/{chunk-2VMTMIGD.cjs → chunk-GGB6Q2DZ.cjs} +12 -12
- package/dist/chunk-GGB6Q2DZ.cjs.map +1 -0
- package/dist/chunk-GS7T56RP.cjs.map +1 -1
- package/dist/chunk-J55UQC5H.cjs.map +1 -1
- package/dist/{chunk-JPQNRW7C.js → chunk-JBFGXC7Q.js} +2 -2
- package/dist/{chunk-K2GXTJPK.cjs → chunk-KOYJ4ZIV.cjs} +439 -340
- package/dist/chunk-KOYJ4ZIV.cjs.map +1 -0
- package/dist/{chunk-UTKVDI22.js → chunk-L4QCMV7B.js} +2 -2
- package/dist/{chunk-JNCWHGJG.js → chunk-M3F6AGZ2.js} +2 -2
- package/dist/{chunk-ZWPINXUX.cjs → chunk-Q7VVEQI3.cjs} +2 -2
- package/dist/chunk-Q7VVEQI3.cjs.map +1 -0
- package/dist/{chunk-DUHHMIPS.cjs → chunk-S6KI2DO4.cjs} +3 -3
- package/dist/chunk-S6KI2DO4.cjs.map +1 -0
- package/dist/{chunk-HNPRQKLZ.cjs → chunk-TGSNDG2T.cjs} +6 -6
- package/dist/chunk-TGSNDG2T.cjs.map +1 -0
- package/dist/{chunk-BAEABKCB.js → chunk-TKAMX4O3.js} +2 -2
- package/dist/{chunk-TOPQ7T4N.js → chunk-TTEDRIWZ.js} +2 -2
- package/dist/{chunk-CKF5HTM6.js → chunk-USQM542U.js} +302 -75
- package/dist/chunk-USQM542U.js.map +1 -0
- package/dist/{chunk-EM2J3MAE.js → chunk-UYNZAEE3.js} +2 -2
- package/dist/{chunk-UHGWEWZI.js → chunk-XHOMGWUB.js} +2 -2
- package/dist/{chunk-YDWHS7FP.js → chunk-XYVRNYED.js} +3 -3
- package/dist/{chunk-K7W5L4GI.js → chunk-Y4JTKUYC.js} +429 -250
- package/dist/chunk-Y4JTKUYC.js.map +1 -0
- package/dist/{chunk-Q7SPGAAA.js → chunk-YAIMKWBV.js} +3 -3
- package/dist/chunk-YAIMKWBV.js.map +1 -0
- package/dist/{chunk-YKL7GP7E.cjs → chunk-Z3LXCCIB.cjs} +3 -3
- package/dist/chunk-Z3LXCCIB.cjs.map +1 -0
- package/dist/{chunk-5BDNDGUI.js → chunk-ZG7V4LAC.js} +2 -2
- package/dist/chunks-JFONNZNK.js +10 -0
- package/dist/cli.js +26 -26
- package/dist/{formula-Y3L3RPPI.cjs → formula-2PPRV75T.cjs} +9 -9
- package/dist/formula-2PPRV75T.cjs.map +1 -0
- package/dist/{formula-H2NAOQHD.js → formula-655OJTYT.js} +4 -4
- package/dist/{formula-NZ7G4AXC.js → formula-AODR6NCO.js} +3 -3
- package/dist/{image-ocr-UTSJ2Q4Q.js → image-ocr-BGVJ2CHC.js} +9 -9
- package/dist/{image-ocr-BGMQPELF.js → image-ocr-YXXZQHON.js} +6 -6
- package/dist/{image-ocr-QYLWWB7R.cjs → image-ocr-ZA2TM3K4.cjs} +15 -15
- package/dist/image-ocr-ZA2TM3K4.cjs.map +1 -0
- package/dist/index.cjs +1193 -863
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +520 -190
- package/dist/index.js.map +1 -1
- package/dist/mcp.js +22 -22
- package/dist/{model-bundle-QHZYIAUP.js → model-bundle-R2VUWXEN.js} +5 -5
- package/dist/{models-MCBWWGBX.js → models-BIML5V3Q.js} +5 -5
- package/dist/page-range-QHHFTL7X.cjs.map +1 -1
- package/dist/{parser-BEPVGAMI.cjs → parser-CATQZG3R.cjs} +225 -198
- package/dist/parser-CATQZG3R.cjs.map +1 -0
- package/dist/{parser-IGTNLJ6E.js → parser-VODVQE4B.js} +39 -12
- package/dist/parser-VODVQE4B.js.map +1 -0
- package/dist/{parser-72NGANOD.js → parser-WMPQ6ZRT.js} +42 -15
- package/dist/parser-WMPQ6ZRT.js.map +1 -0
- package/dist/pdf-ocr-22UEFX5Q.js +19 -0
- package/dist/pdf-ocr-635HWHUS.js +15 -0
- package/dist/pdf-ocr-E7QWBW25.cjs +16 -0
- package/dist/pdf-ocr-E7QWBW25.cjs.map +1 -0
- package/dist/{profile-io-H2BCBNRL.js → profile-io-QFLRG2EA.js} +3 -3
- package/dist/{rasterize-HIEA3MGV.js → rasterize-ZRPBD4YU.js} +3 -3
- package/dist/{redact-doc-MHIY4AWT.js → redact-doc-DXY2ZDDN.js} +11 -11
- package/dist/{render-NIX6VP3C.js → render-WI6N54BP.js} +7 -7
- package/dist/seal-KEJ34B4R.js +10 -0
- package/dist/{setup-DU5WIHAX.js → setup-2D4EJV67.js} +3 -3
- package/dist/visual-TON626IM.js +20 -0
- package/dist/{watch-XW6CSLL7.js → watch-5J72AED4.js} +12 -12
- package/package.json +1 -1
- package/dist/chunk-2VMTMIGD.cjs.map +0 -1
- package/dist/chunk-CKF5HTM6.js.map +0 -1
- package/dist/chunk-DUHHMIPS.cjs.map +0 -1
- package/dist/chunk-HNPRQKLZ.cjs.map +0 -1
- package/dist/chunk-K2GXTJPK.cjs.map +0 -1
- package/dist/chunk-K7W5L4GI.js.map +0 -1
- package/dist/chunk-Q7SPGAAA.js.map +0 -1
- package/dist/chunk-UJZABAVA.js.map +0 -1
- package/dist/chunk-VNDVI3MJ.js.map +0 -1
- package/dist/chunk-YKL7GP7E.cjs.map +0 -1
- package/dist/chunk-ZWPINXUX.cjs.map +0 -1
- package/dist/chunks-S7XODMX4.js +0 -10
- package/dist/formula-Y3L3RPPI.cjs.map +0 -1
- package/dist/image-ocr-QYLWWB7R.cjs.map +0 -1
- package/dist/parser-72NGANOD.js.map +0 -1
- package/dist/parser-BEPVGAMI.cjs.map +0 -1
- package/dist/parser-IGTNLJ6E.js.map +0 -1
- package/dist/pdf-ocr-BW6RUT4H.cjs +0 -16
- package/dist/pdf-ocr-BW6RUT4H.cjs.map +0 -1
- package/dist/pdf-ocr-EWG24RNY.js +0 -15
- package/dist/pdf-ocr-TCDSJFQT.js +0 -19
- package/dist/seal-QTCJFT7G.js +0 -10
- package/dist/visual-TU2BS63P.js +0 -20
- /package/dist/{-WP4ZCXHV.js.map → -R64MUZYI.js.map} +0 -0
- /package/dist/{chunk-JORDNRVS.js.map → chunk-2DA5KVHL.js.map} +0 -0
- /package/dist/{chunk-DPMDJYHX.js.map → chunk-3CBCXXMW.js.map} +0 -0
- /package/dist/{chunk-TTSXZO2A.js.map → chunk-43QRXSO2.js.map} +0 -0
- /package/dist/{chunk-C3MC7HOB.js.map → chunk-55MXXUO5.js.map} +0 -0
- /package/dist/{chunk-WFXZRYFS.js.map → chunk-6UNH3R5O.js.map} +0 -0
- /package/dist/{chunk-5HIJXVED.js.map → chunk-CEN6GPOI.js.map} +0 -0
- /package/dist/{chunk-4PY2V33D.js.map → chunk-DV6QO76R.js.map} +0 -0
- /package/dist/{chunk-OOUW3ROZ.js.map → chunk-FSEYF24M.js.map} +0 -0
- /package/dist/{chunk-JPQNRW7C.js.map → chunk-JBFGXC7Q.js.map} +0 -0
- /package/dist/{chunk-UTKVDI22.js.map → chunk-L4QCMV7B.js.map} +0 -0
- /package/dist/{chunk-JNCWHGJG.js.map → chunk-M3F6AGZ2.js.map} +0 -0
- /package/dist/{chunk-BAEABKCB.js.map → chunk-TKAMX4O3.js.map} +0 -0
- /package/dist/{chunk-TOPQ7T4N.js.map → chunk-TTEDRIWZ.js.map} +0 -0
- /package/dist/{chunk-EM2J3MAE.js.map → chunk-UYNZAEE3.js.map} +0 -0
- /package/dist/{chunk-UHGWEWZI.js.map → chunk-XHOMGWUB.js.map} +0 -0
- /package/dist/{chunk-YDWHS7FP.js.map → chunk-XYVRNYED.js.map} +0 -0
- /package/dist/{chunk-5BDNDGUI.js.map → chunk-ZG7V4LAC.js.map} +0 -0
- /package/dist/{chunks-S7XODMX4.js.map → chunks-JFONNZNK.js.map} +0 -0
- /package/dist/{formula-H2NAOQHD.js.map → formula-655OJTYT.js.map} +0 -0
- /package/dist/{formula-NZ7G4AXC.js.map → formula-AODR6NCO.js.map} +0 -0
- /package/dist/{image-ocr-UTSJ2Q4Q.js.map → image-ocr-BGVJ2CHC.js.map} +0 -0
- /package/dist/{image-ocr-BGMQPELF.js.map → image-ocr-YXXZQHON.js.map} +0 -0
- /package/dist/{model-bundle-QHZYIAUP.js.map → model-bundle-R2VUWXEN.js.map} +0 -0
- /package/dist/{models-MCBWWGBX.js.map → models-BIML5V3Q.js.map} +0 -0
- /package/dist/{pdf-ocr-EWG24RNY.js.map → pdf-ocr-22UEFX5Q.js.map} +0 -0
- /package/dist/{pdf-ocr-TCDSJFQT.js.map → pdf-ocr-635HWHUS.js.map} +0 -0
- /package/dist/{profile-io-H2BCBNRL.js.map → profile-io-QFLRG2EA.js.map} +0 -0
- /package/dist/{rasterize-HIEA3MGV.js.map → rasterize-ZRPBD4YU.js.map} +0 -0
- /package/dist/{redact-doc-MHIY4AWT.js.map → redact-doc-DXY2ZDDN.js.map} +0 -0
- /package/dist/{render-NIX6VP3C.js.map → render-WI6N54BP.js.map} +0 -0
- /package/dist/{seal-QTCJFT7G.js.map → seal-KEJ34B4R.js.map} +0 -0
- /package/dist/{setup-DU5WIHAX.js.map → setup-2D4EJV67.js.map} +0 -0
- /package/dist/{visual-TU2BS63P.js.map → visual-TON626IM.js.map} +0 -0
- /package/dist/{watch-XW6CSLL7.js.map → watch-5J72AED4.js.map} +0 -0
|
@@ -50,17 +50,17 @@ import {
|
|
|
50
50
|
unknownFontWarnings,
|
|
51
51
|
usesGaejosikMunche,
|
|
52
52
|
validateHwpx
|
|
53
|
-
} from "./chunk-
|
|
53
|
+
} from "./chunk-3OAC2DOI.js";
|
|
54
54
|
import {
|
|
55
55
|
blocksToPages
|
|
56
|
-
} from "./chunk-
|
|
56
|
+
} from "./chunk-CEN6GPOI.js";
|
|
57
57
|
import {
|
|
58
58
|
applySplices,
|
|
59
59
|
buildParagraphSplices,
|
|
60
60
|
buildRangeSplices,
|
|
61
61
|
placeSealHwpx,
|
|
62
62
|
scanSectionXml
|
|
63
|
-
} from "./chunk-
|
|
63
|
+
} from "./chunk-43QRXSO2.js";
|
|
64
64
|
import {
|
|
65
65
|
DEFAULT_REDACT_RULES,
|
|
66
66
|
redactMarkdown,
|
|
@@ -68,7 +68,7 @@ import {
|
|
|
68
68
|
} from "./chunk-3WSNLH4B.js";
|
|
69
69
|
import {
|
|
70
70
|
blocksToChunks
|
|
71
|
-
} from "./chunk-
|
|
71
|
+
} from "./chunk-2DA5KVHL.js";
|
|
72
72
|
import {
|
|
73
73
|
SPACE_EM_FIXED,
|
|
74
74
|
SPACE_EM_FONT,
|
|
@@ -93,20 +93,20 @@ import {
|
|
|
93
93
|
renderSceneToHtml,
|
|
94
94
|
simulateWrap,
|
|
95
95
|
simulateWrapKeepWord
|
|
96
|
-
} from "./chunk-
|
|
96
|
+
} from "./chunk-USQM542U.js";
|
|
97
97
|
import "./chunk-7FCNOKOR.js";
|
|
98
|
-
import "./chunk-
|
|
98
|
+
import "./chunk-L4QCMV7B.js";
|
|
99
99
|
import "./chunk-VQFA55IC.js";
|
|
100
|
-
import "./chunk-
|
|
100
|
+
import "./chunk-YAIMKWBV.js";
|
|
101
101
|
import {
|
|
102
102
|
blocksToMarkdown,
|
|
103
103
|
flattenLayoutTables,
|
|
104
104
|
hasStructuredCellContent
|
|
105
|
-
} from "./chunk-
|
|
106
|
-
import "./chunk-
|
|
105
|
+
} from "./chunk-55MXXUO5.js";
|
|
106
|
+
import "./chunk-M3F6AGZ2.js";
|
|
107
107
|
import {
|
|
108
108
|
VERSION
|
|
109
|
-
} from "./chunk-
|
|
109
|
+
} from "./chunk-ZG7V4LAC.js";
|
|
110
110
|
export {
|
|
111
111
|
BUILTIN_TEMPLATES,
|
|
112
112
|
DEFAULT_REDACT_RULES,
|
|
@@ -196,4 +196,4 @@ export {
|
|
|
196
196
|
usesGaejosikMunche,
|
|
197
197
|
validateHwpx
|
|
198
198
|
};
|
|
199
|
-
//# sourceMappingURL=-
|
|
199
|
+
//# sourceMappingURL=-R64MUZYI.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import {
|
|
3
3
|
blocksToMarkdown
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-55MXXUO5.js";
|
|
5
5
|
|
|
6
6
|
// src/chunks.ts
|
|
7
7
|
var LIST_MARKER_RE = /^(?:[□■◇◆○◎●◦ㅇ•▪▸▶※-]|\d{1,3}[.)]|[가나다라마바사아자차카타파하][.)]|\([가나다라마바사아자차카타파하0-9]{1,3}\)|[①-⑳㉮-㉻㈎-㈛])\s/;
|
|
@@ -79,4 +79,4 @@ function blocksToChunks(blocks, options) {
|
|
|
79
79
|
export {
|
|
80
80
|
blocksToChunks
|
|
81
81
|
};
|
|
82
|
-
//# sourceMappingURL=chunk-
|
|
82
|
+
//# sourceMappingURL=chunk-2DA5KVHL.js.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// src/utils.ts
|
|
2
|
-
var VERSION = true ? "4.17.
|
|
2
|
+
var VERSION = true ? "4.17.5" : "0.0.0-dev";
|
|
3
3
|
function toArrayBuffer(buf) {
|
|
4
4
|
if (buf.byteOffset === 0 && buf.byteLength === buf.buffer.byteLength) {
|
|
5
5
|
return buf.buffer;
|
|
@@ -154,4 +154,4 @@ export {
|
|
|
154
154
|
OPTIONAL_DEP_INSTALL_HINT,
|
|
155
155
|
classifyError
|
|
156
156
|
};
|
|
157
|
-
//# sourceMappingURL=chunk-
|
|
157
|
+
//# sourceMappingURL=chunk-3CBCXXMW.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import {
|
|
3
3
|
blocksToPages
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-CEN6GPOI.js";
|
|
5
5
|
import {
|
|
6
6
|
allLinesegRemovalSplices,
|
|
7
7
|
applySplices,
|
|
@@ -15,7 +15,7 @@ import {
|
|
|
15
15
|
paraTextPureT,
|
|
16
16
|
patchZipEntries,
|
|
17
17
|
scanSectionXml
|
|
18
|
-
} from "./chunk-
|
|
18
|
+
} from "./chunk-43QRXSO2.js";
|
|
19
19
|
import {
|
|
20
20
|
CONVERT_MAP,
|
|
21
21
|
FLAG_COMPRESSED,
|
|
@@ -61,7 +61,7 @@ import {
|
|
|
61
61
|
renderDocumentToScene,
|
|
62
62
|
romanNumeral,
|
|
63
63
|
simulateWrap
|
|
64
|
-
} from "./chunk-
|
|
64
|
+
} from "./chunk-USQM542U.js";
|
|
65
65
|
import {
|
|
66
66
|
CELL_EDGES,
|
|
67
67
|
HEADING_RATIO_H1,
|
|
@@ -72,7 +72,7 @@ import {
|
|
|
72
72
|
tidyScriptTags,
|
|
73
73
|
unframeLayoutTables,
|
|
74
74
|
wrapScript
|
|
75
|
-
} from "./chunk-
|
|
75
|
+
} from "./chunk-L4QCMV7B.js";
|
|
76
76
|
import {
|
|
77
77
|
parsePageRange
|
|
78
78
|
} from "./chunk-VQFA55IC.js";
|
|
@@ -91,7 +91,7 @@ import {
|
|
|
91
91
|
findChildByLocalName,
|
|
92
92
|
localName,
|
|
93
93
|
rawTextContent
|
|
94
|
-
} from "./chunk-
|
|
94
|
+
} from "./chunk-YAIMKWBV.js";
|
|
95
95
|
import {
|
|
96
96
|
MAX_COLS,
|
|
97
97
|
MAX_ROWS,
|
|
@@ -106,7 +106,7 @@ import {
|
|
|
106
106
|
hasStructuredCellContent,
|
|
107
107
|
mapPuaText,
|
|
108
108
|
noteSuffix
|
|
109
|
-
} from "./chunk-
|
|
109
|
+
} from "./chunk-55MXXUO5.js";
|
|
110
110
|
import {
|
|
111
111
|
KordocError,
|
|
112
112
|
classifyError,
|
|
@@ -121,7 +121,7 @@ import {
|
|
|
121
121
|
toArrayBuffer,
|
|
122
122
|
unescapeHtml,
|
|
123
123
|
unzipLimitBytes
|
|
124
|
-
} from "./chunk-
|
|
124
|
+
} from "./chunk-ZG7V4LAC.js";
|
|
125
125
|
|
|
126
126
|
// src/table/visual.ts
|
|
127
127
|
import { readFile as readFile2 } from "fs/promises";
|
|
@@ -665,6 +665,131 @@ function detectHwpxHeadings(blocks, styleMap) {
|
|
|
665
665
|
}
|
|
666
666
|
}
|
|
667
667
|
|
|
668
|
+
// src/hwpx/section-shape.ts
|
|
669
|
+
var DELETABLE_OBJECT_TAGS = /* @__PURE__ */ new Set([
|
|
670
|
+
"tbl",
|
|
671
|
+
"pic",
|
|
672
|
+
"shape",
|
|
673
|
+
"drawingObject",
|
|
674
|
+
"drawText",
|
|
675
|
+
"caption",
|
|
676
|
+
"rect",
|
|
677
|
+
"ellipse",
|
|
678
|
+
"polygon",
|
|
679
|
+
"line",
|
|
680
|
+
"arc",
|
|
681
|
+
"curve",
|
|
682
|
+
"connectLine",
|
|
683
|
+
"container"
|
|
684
|
+
]);
|
|
685
|
+
function collectImageRefs(el, refs, depth = 0) {
|
|
686
|
+
if (depth > MAX_XML_DEPTH) return;
|
|
687
|
+
const tag = (el.tagName || el.localName || "").replace(/^[^:]+:/, "");
|
|
688
|
+
const ref = el.getAttribute("binaryItemIDRef") || (["img", "imgRect", "imgClip"].includes(tag) ? el.getAttribute("href") : "");
|
|
689
|
+
if (ref) refs.add(ref);
|
|
690
|
+
const children = el.childNodes;
|
|
691
|
+
for (let i = 0; i < (children?.length ?? 0); i++) {
|
|
692
|
+
const child = children[i];
|
|
693
|
+
if (child.nodeType === 1) collectImageRefs(child, refs, depth + 1);
|
|
694
|
+
}
|
|
695
|
+
}
|
|
696
|
+
function markDeletedObjects(node, deletedObjects, refs) {
|
|
697
|
+
let deleteDepth = 0;
|
|
698
|
+
const walk = (parent, depth) => {
|
|
699
|
+
if (depth > MAX_XML_DEPTH) return;
|
|
700
|
+
const children = parent.childNodes;
|
|
701
|
+
for (let i = 0; i < (children?.length ?? 0); i++) {
|
|
702
|
+
const child = children[i];
|
|
703
|
+
if (child.nodeType !== 1) continue;
|
|
704
|
+
const tag = (child.tagName || child.localName || "").replace(/^[^:]+:/, "");
|
|
705
|
+
if (tag === "deleteBegin") {
|
|
706
|
+
deleteDepth++;
|
|
707
|
+
continue;
|
|
708
|
+
}
|
|
709
|
+
if (tag === "deleteEnd") {
|
|
710
|
+
if (deleteDepth > 0) deleteDepth--;
|
|
711
|
+
continue;
|
|
712
|
+
}
|
|
713
|
+
if (deleteDepth > 0 && DELETABLE_OBJECT_TAGS.has(tag)) {
|
|
714
|
+
deletedObjects.add(child);
|
|
715
|
+
collectImageRefs(child, refs);
|
|
716
|
+
continue;
|
|
717
|
+
}
|
|
718
|
+
if (tag === "switch") {
|
|
719
|
+
const branch = findChildByLocalName(child, "case") ?? findChildByLocalName(child, "default");
|
|
720
|
+
if (branch) walk(branch, depth + 1);
|
|
721
|
+
} else if (tag !== "hiddenComment" && tag !== "shapeComment" && tag !== "parameters") walk(child, depth + 1);
|
|
722
|
+
}
|
|
723
|
+
};
|
|
724
|
+
walk(node, 0);
|
|
725
|
+
}
|
|
726
|
+
function inIndependentDeletionStory(track, extract) {
|
|
727
|
+
const hostDeleteDepth = track.deleteDepth;
|
|
728
|
+
track.deleteDepth = 0;
|
|
729
|
+
try {
|
|
730
|
+
return extract();
|
|
731
|
+
} finally {
|
|
732
|
+
track.deleteDepth = hostDeleteDepth;
|
|
733
|
+
}
|
|
734
|
+
}
|
|
735
|
+
function extractImageRef(el, depth = 0, deletedObjects) {
|
|
736
|
+
if (depth > MAX_XML_DEPTH) return null;
|
|
737
|
+
const children = el.childNodes;
|
|
738
|
+
if (!children) return null;
|
|
739
|
+
for (let i = 0; i < children.length; i++) {
|
|
740
|
+
const child = children[i];
|
|
741
|
+
if (child.nodeType !== 1 || deletedObjects?.has(child)) continue;
|
|
742
|
+
const tag = (child.tagName || child.localName || "").replace(/^[^:]+:/, "");
|
|
743
|
+
if (tag === "imgRect" || tag === "img" || tag === "imgClip") {
|
|
744
|
+
const ref = child.getAttribute("binaryItemIDRef") || child.getAttribute("href") || "";
|
|
745
|
+
if (ref) return ref;
|
|
746
|
+
}
|
|
747
|
+
const nested = extractImageRef(child, depth + 1, deletedObjects);
|
|
748
|
+
if (nested) return nested;
|
|
749
|
+
}
|
|
750
|
+
const directRef = el.getAttribute("binaryItemIDRef") || "";
|
|
751
|
+
if (directRef) return directRef;
|
|
752
|
+
return null;
|
|
753
|
+
}
|
|
754
|
+
function userShapeComment(el) {
|
|
755
|
+
const commentEl = findChildByLocalName(el, "shapeComment");
|
|
756
|
+
if (!commentEl) return void 0;
|
|
757
|
+
const text = extractTextFromNode(commentEl);
|
|
758
|
+
if (!text) return void 0;
|
|
759
|
+
if (/^그림입니다/.test(text)) return void 0;
|
|
760
|
+
if (/^(?:모서리가 둥근 |둥근 )?[^\n]{1,20}입니다\.?$/.test(text)) return void 0;
|
|
761
|
+
return text;
|
|
762
|
+
}
|
|
763
|
+
function findDescendant(node, targetTag, depth = 0, deletedObjects) {
|
|
764
|
+
if (depth > 5) return null;
|
|
765
|
+
const children = node.childNodes;
|
|
766
|
+
if (!children) return null;
|
|
767
|
+
for (let i = 0; i < children.length; i++) {
|
|
768
|
+
const child = children[i];
|
|
769
|
+
if (child.nodeType !== 1 || deletedObjects?.has(child)) continue;
|
|
770
|
+
const tag = (child.tagName || child.localName || "").replace(/^[^:]+:/, "");
|
|
771
|
+
if (tag === targetTag) return child;
|
|
772
|
+
const found = findDescendant(child, targetTag, depth + 1, deletedObjects);
|
|
773
|
+
if (found) return found;
|
|
774
|
+
}
|
|
775
|
+
return null;
|
|
776
|
+
}
|
|
777
|
+
function findTopLevelTbls(el, out, deletedObjects, depth = 0) {
|
|
778
|
+
if (depth > MAX_XML_DEPTH) return;
|
|
779
|
+
const kids = el.childNodes;
|
|
780
|
+
if (!kids) return;
|
|
781
|
+
for (let i = 0; i < kids.length; i++) {
|
|
782
|
+
const ch = kids[i];
|
|
783
|
+
if (ch.nodeType !== 1 || deletedObjects.has(ch)) continue;
|
|
784
|
+
const tag = (ch.tagName || ch.localName || "").replace(/^[^:]+:/, "");
|
|
785
|
+
if (tag === "tbl") {
|
|
786
|
+
out.push(ch);
|
|
787
|
+
continue;
|
|
788
|
+
}
|
|
789
|
+
findTopLevelTbls(ch, out, deletedObjects, depth + 1);
|
|
790
|
+
}
|
|
791
|
+
}
|
|
792
|
+
|
|
668
793
|
// src/hwpx/para-heading.ts
|
|
669
794
|
var HANGUL_JAMO_SEQ = "\u3131\u3134\u3137\u3139\u3141\u3142\u3145\u3147\u3148\u314A\u314B\u314C\u314D\u314E";
|
|
670
795
|
function formatHeadNumber(n, numFormat) {
|
|
@@ -855,11 +980,11 @@ var numAttr = (el, name) => {
|
|
|
855
980
|
const n = v == null ? NaN : Number(v);
|
|
856
981
|
return Number.isFinite(n) ? n : 0;
|
|
857
982
|
};
|
|
858
|
-
var
|
|
983
|
+
var findDescendant2 = (root, local, maxDepth = 8) => {
|
|
859
984
|
if (maxDepth < 0) return null;
|
|
860
985
|
for (const c of childElements(root)) {
|
|
861
986
|
if (localName2(c) === local) return c;
|
|
862
|
-
const found =
|
|
987
|
+
const found = findDescendant2(c, local, maxDepth - 1);
|
|
863
988
|
if (found) return found;
|
|
864
989
|
}
|
|
865
990
|
return null;
|
|
@@ -900,7 +1025,7 @@ function tableIntraBreaks(tbl2) {
|
|
|
900
1025
|
return sum;
|
|
901
1026
|
}
|
|
902
1027
|
function detectHwpxSectionPages(root) {
|
|
903
|
-
const colPr =
|
|
1028
|
+
const colPr = findDescendant2(root, "colPr");
|
|
904
1029
|
const multiCol = colPr ? numAttr(colPr, "colCount") > 1 : false;
|
|
905
1030
|
const paraPage = /* @__PURE__ */ new Map();
|
|
906
1031
|
let cur = 0;
|
|
@@ -1148,25 +1273,6 @@ function parseSectionXml(xml, styleMap, warnings, sectionNum, shared) {
|
|
|
1148
1273
|
walkSection(doc.documentElement, blocks, null, [], ctx);
|
|
1149
1274
|
return blocks;
|
|
1150
1275
|
}
|
|
1151
|
-
function extractImageRef(el, depth = 0) {
|
|
1152
|
-
if (depth > MAX_XML_DEPTH) return null;
|
|
1153
|
-
const children = el.childNodes;
|
|
1154
|
-
if (!children) return null;
|
|
1155
|
-
for (let i = 0; i < children.length; i++) {
|
|
1156
|
-
const child = children[i];
|
|
1157
|
-
if (child.nodeType !== 1) continue;
|
|
1158
|
-
const tag = (child.tagName || child.localName || "").replace(/^[^:]+:/, "");
|
|
1159
|
-
if (tag === "imgRect" || tag === "img" || tag === "imgClip") {
|
|
1160
|
-
const ref = child.getAttribute("binaryItemIDRef") || child.getAttribute("href") || "";
|
|
1161
|
-
if (ref) return ref;
|
|
1162
|
-
}
|
|
1163
|
-
const nested = extractImageRef(child, depth + 1);
|
|
1164
|
-
if (nested) return nested;
|
|
1165
|
-
}
|
|
1166
|
-
const directRef = el.getAttribute("binaryItemIDRef") || "";
|
|
1167
|
-
if (directRef) return directRef;
|
|
1168
|
-
return null;
|
|
1169
|
-
}
|
|
1170
1276
|
function walkSection(node, blocks, tableCtx, tableStack, ctx, depth = 0) {
|
|
1171
1277
|
if (depth > MAX_XML_DEPTH) return;
|
|
1172
1278
|
const children = node.childNodes;
|
|
@@ -1174,6 +1280,7 @@ function walkSection(node, blocks, tableCtx, tableStack, ctx, depth = 0) {
|
|
|
1174
1280
|
for (let i = 0; i < children.length; i++) {
|
|
1175
1281
|
const el = children[i];
|
|
1176
1282
|
if (el.nodeType !== 1) continue;
|
|
1283
|
+
if (ctx.shared.track.deletedObjects.has(el)) continue;
|
|
1177
1284
|
const tag = el.tagName || el.localName || "";
|
|
1178
1285
|
const localTag = tag.replace(/^[^:]+:/, "");
|
|
1179
1286
|
switch (localTag) {
|
|
@@ -1385,8 +1492,10 @@ function walkSection(node, blocks, tableCtx, tableStack, ctx, depth = 0) {
|
|
|
1385
1492
|
}
|
|
1386
1493
|
}
|
|
1387
1494
|
function handleShape(el, sink, ctx) {
|
|
1388
|
-
const
|
|
1389
|
-
|
|
1495
|
+
const capEl = findChildByLocalName(el, "caption");
|
|
1496
|
+
if (capEl) markDeletedObjects(capEl, ctx.shared.track.deletedObjects, ctx.shared.track.deletedImageRefs);
|
|
1497
|
+
const imgRef = extractImageRef(el, 0, ctx.shared.track.deletedObjects);
|
|
1498
|
+
const drawTextChild = findDescendant(el, "drawText", 0, ctx.shared.track.deletedObjects);
|
|
1390
1499
|
if (imgRef) {
|
|
1391
1500
|
const block = { type: "image", text: imgRef, pageNumber: ctx.page };
|
|
1392
1501
|
const alt = userShapeComment(el);
|
|
@@ -1396,7 +1505,6 @@ function handleShape(el, sink, ctx) {
|
|
|
1396
1505
|
if (drawTextChild) {
|
|
1397
1506
|
extractDrawTextBlocks(drawTextChild, sink, ctx);
|
|
1398
1507
|
}
|
|
1399
|
-
const capEl = findChildByLocalName(el, "caption");
|
|
1400
1508
|
if (capEl) {
|
|
1401
1509
|
const capText = collectSubListText(capEl, ctx);
|
|
1402
1510
|
if (capText) sink.push({ type: "paragraph", text: capText, pageNumber: ctx.page });
|
|
@@ -1406,15 +1514,6 @@ function handleShape(el, sink, ctx) {
|
|
|
1406
1514
|
ctx.warnings.push({ page: ctx.page, message: `\uC2A4\uD0B5\uB41C \uC694\uC18C: ${localTag}`, code: "SKIPPED_IMAGE" });
|
|
1407
1515
|
}
|
|
1408
1516
|
}
|
|
1409
|
-
function userShapeComment(el) {
|
|
1410
|
-
const commentEl = findChildByLocalName(el, "shapeComment");
|
|
1411
|
-
if (!commentEl) return void 0;
|
|
1412
|
-
const text = extractTextFromNode(commentEl);
|
|
1413
|
-
if (!text) return void 0;
|
|
1414
|
-
if (/^그림입니다/.test(text)) return void 0;
|
|
1415
|
-
if (/^(?:모서리가 둥근 |둥근 )?[^\n]{1,20}입니다\.?$/.test(text)) return void 0;
|
|
1416
|
-
return text;
|
|
1417
|
-
}
|
|
1418
1517
|
function mergeBlocksIntoCell(cell2, sink) {
|
|
1419
1518
|
for (const b of sink) {
|
|
1420
1519
|
if ((b.type === "paragraph" || b.type === "heading") && b.text) {
|
|
@@ -1472,7 +1571,7 @@ function hasPageAutoNum(el, depth = 0) {
|
|
|
1472
1571
|
return false;
|
|
1473
1572
|
}
|
|
1474
1573
|
function collectSubListText(el, ctx, depth = 0) {
|
|
1475
|
-
return collectSubListContent(el, ctx, depth).text;
|
|
1574
|
+
return inIndependentDeletionStory(ctx.shared.track, () => collectSubListContent(el, ctx, depth).text);
|
|
1476
1575
|
}
|
|
1477
1576
|
function collectSubListContent(el, ctx, depth = 0, sep = "\n") {
|
|
1478
1577
|
const out = { text: "", blocks: [], hasStructure: false };
|
|
@@ -1482,7 +1581,7 @@ function collectSubListContent(el, ctx, depth = 0, sep = "\n") {
|
|
|
1482
1581
|
if (!children) return out;
|
|
1483
1582
|
for (let i = 0; i < children.length; i++) {
|
|
1484
1583
|
const ch = children[i];
|
|
1485
|
-
if (ch.nodeType !== 1) continue;
|
|
1584
|
+
if (ch.nodeType !== 1 || ctx.shared.track.deletedObjects.has(ch)) continue;
|
|
1486
1585
|
const tag = (ch.tagName || ch.localName || "").replace(/^[^:]+:/, "");
|
|
1487
1586
|
if (tag === "p" || tag === "para") {
|
|
1488
1587
|
let t = extractParagraphInfo(ch, ctx.styleMap, ctx).text;
|
|
@@ -1493,7 +1592,7 @@ function collectSubListContent(el, ctx, depth = 0, sep = "\n") {
|
|
|
1493
1592
|
out.blocks.push({ type: "paragraph", text: t, pageNumber: ctx.page });
|
|
1494
1593
|
}
|
|
1495
1594
|
const tbls = [];
|
|
1496
|
-
findTopLevelTbls(ch, tbls);
|
|
1595
|
+
findTopLevelTbls(ch, tbls, ctx.shared.track.deletedObjects);
|
|
1497
1596
|
for (const tbl2 of tbls) {
|
|
1498
1597
|
const built = buildSubListTable(tbl2, ctx, depth);
|
|
1499
1598
|
if (built.text) parts.push(built.text);
|
|
@@ -1531,7 +1630,7 @@ function drawTextParaTexts(para2, ctx) {
|
|
|
1531
1630
|
if (!kids) return;
|
|
1532
1631
|
for (let i = 0; i < kids.length; i++) {
|
|
1533
1632
|
const ch = kids[i];
|
|
1534
|
-
if (ch.nodeType !== 1) continue;
|
|
1633
|
+
if (ch.nodeType !== 1 || ctx.shared.track.deletedObjects.has(ch)) continue;
|
|
1535
1634
|
const tag = (ch.tagName || ch.localName || "").replace(/^[^:]+:/, "");
|
|
1536
1635
|
if (tag === "tbl" || tag === "footNote" || tag === "endNote") continue;
|
|
1537
1636
|
if (tag === "drawText") {
|
|
@@ -1561,21 +1660,6 @@ function buildSubListTable(el, ctx, depth) {
|
|
|
1561
1660
|
completeTable(st, [], built, ctx);
|
|
1562
1661
|
return { text: flat, block: built.find((b) => b.type === "table") ?? null };
|
|
1563
1662
|
}
|
|
1564
|
-
function findTopLevelTbls(el, out, depth = 0) {
|
|
1565
|
-
if (depth > MAX_XML_DEPTH) return;
|
|
1566
|
-
const kids = el.childNodes;
|
|
1567
|
-
if (!kids) return;
|
|
1568
|
-
for (let i = 0; i < kids.length; i++) {
|
|
1569
|
-
const ch = kids[i];
|
|
1570
|
-
if (ch.nodeType !== 1) continue;
|
|
1571
|
-
const tag = (ch.tagName || ch.localName || "").replace(/^[^:]+:/, "");
|
|
1572
|
-
if (tag === "tbl") {
|
|
1573
|
-
out.push(ch);
|
|
1574
|
-
continue;
|
|
1575
|
-
}
|
|
1576
|
-
findTopLevelTbls(ch, out, depth + 1);
|
|
1577
|
-
}
|
|
1578
|
-
}
|
|
1579
1663
|
function walkParagraphChildren(node, blocks, tableCtx, tableStack, ctx, depth = 0, onTbl) {
|
|
1580
1664
|
if (depth > MAX_XML_DEPTH) return tableCtx;
|
|
1581
1665
|
const children = node.childNodes;
|
|
@@ -1587,6 +1671,7 @@ function walkParagraphChildren(node, blocks, tableCtx, tableStack, ctx, depth =
|
|
|
1587
1671
|
for (let i = 0; i < kids.length; i++) {
|
|
1588
1672
|
const el = kids[i];
|
|
1589
1673
|
if (el.nodeType !== 1) continue;
|
|
1674
|
+
if (ctx.shared.track.deletedObjects.has(el)) continue;
|
|
1590
1675
|
const tag = el.tagName || el.localName || "";
|
|
1591
1676
|
const localTag = tag.replace(/^[^:]+:/, "");
|
|
1592
1677
|
if (localTag === "tbl") {
|
|
@@ -1664,21 +1749,10 @@ function formButtonText(el, radio) {
|
|
|
1664
1749
|
const caption = (el.getAttribute("caption") ?? "").trim();
|
|
1665
1750
|
return caption && width >= FORM_CAPTION_MIN_WIDTH ? `${mark} ${caption}` : mark;
|
|
1666
1751
|
}
|
|
1667
|
-
function findDescendant2(node, targetTag, depth = 0) {
|
|
1668
|
-
if (depth > 5) return null;
|
|
1669
|
-
const children = node.childNodes;
|
|
1670
|
-
if (!children) return null;
|
|
1671
|
-
for (let i = 0; i < children.length; i++) {
|
|
1672
|
-
const child = children[i];
|
|
1673
|
-
if (child.nodeType !== 1) continue;
|
|
1674
|
-
const tag = (child.tagName || child.localName || "").replace(/^[^:]+:/, "");
|
|
1675
|
-
if (tag === targetTag) return child;
|
|
1676
|
-
const found = findDescendant2(child, targetTag, depth + 1);
|
|
1677
|
-
if (found) return found;
|
|
1678
|
-
}
|
|
1679
|
-
return null;
|
|
1680
|
-
}
|
|
1681
1752
|
function extractDrawTextBlocks(drawTextNode, blocks, ctx) {
|
|
1753
|
+
inIndependentDeletionStory(ctx.shared.track, () => extractDrawTextStory(drawTextNode, blocks, ctx));
|
|
1754
|
+
}
|
|
1755
|
+
function extractDrawTextStory(drawTextNode, blocks, ctx) {
|
|
1682
1756
|
const children = drawTextNode.childNodes;
|
|
1683
1757
|
if (!children) return;
|
|
1684
1758
|
for (let i = 0; i < children.length; i++) {
|
|
@@ -1687,7 +1761,7 @@ function extractDrawTextBlocks(drawTextNode, blocks, ctx) {
|
|
|
1687
1761
|
const tag = (child.tagName || child.localName || "").replace(/^[^:]+:/, "");
|
|
1688
1762
|
if (tag === "subList" || tag === "p" || tag === "para") {
|
|
1689
1763
|
if (tag === "subList") {
|
|
1690
|
-
|
|
1764
|
+
extractDrawTextStory(child, blocks, ctx);
|
|
1691
1765
|
} else {
|
|
1692
1766
|
const info = extractParagraphInfo(child, ctx.styleMap, ctx);
|
|
1693
1767
|
let text = info.text.trim();
|
|
@@ -1801,6 +1875,11 @@ function extractParagraphInfo(para2, styleMap, ctx) {
|
|
|
1801
1875
|
const k = kids[j];
|
|
1802
1876
|
if (k.nodeType !== 1) continue;
|
|
1803
1877
|
const ktag = (k.tagName || k.localName || "").replace(/^[^:]+:/, "");
|
|
1878
|
+
if (isInDeletedRange(ctx) && DELETABLE_OBJECT_TAGS.has(ktag)) {
|
|
1879
|
+
ctx.shared.track.deletedObjects.add(k);
|
|
1880
|
+
collectImageRefs(k, ctx.shared.track.deletedImageRefs);
|
|
1881
|
+
continue;
|
|
1882
|
+
}
|
|
1804
1883
|
switch (ktag) {
|
|
1805
1884
|
// 머리말/꼬리말 — 문서당 1회 수집, 본문 앞/뒤 배치
|
|
1806
1885
|
// 페이지 번호 크롬(autoNum PAGE + 문자 없는 잔여 텍스트, 예: "- 1 -")은 본문 정보가
|
|
@@ -1891,6 +1970,11 @@ function extractParagraphInfo(para2, styleMap, ctx) {
|
|
|
1891
1970
|
}
|
|
1892
1971
|
if (child.nodeType !== 1) continue;
|
|
1893
1972
|
const tag = (child.tagName || child.localName || "").replace(/^[^:]+:/, "");
|
|
1973
|
+
if (isInDeletedRange(ctx) && DELETABLE_OBJECT_TAGS.has(tag)) {
|
|
1974
|
+
ctx.shared.track.deletedObjects.add(child);
|
|
1975
|
+
collectImageRefs(child, ctx.shared.track.deletedImageRefs);
|
|
1976
|
+
continue;
|
|
1977
|
+
}
|
|
1894
1978
|
switch (tag) {
|
|
1895
1979
|
case "t":
|
|
1896
1980
|
walk(child, depth + 1);
|
|
@@ -2143,7 +2227,7 @@ function collectImageBlocks(blocks, out, ownerCell, depth = 0) {
|
|
|
2143
2227
|
if (block.children?.length) collectImageBlocks(block.children, out, ownerCell, depth + 1);
|
|
2144
2228
|
}
|
|
2145
2229
|
}
|
|
2146
|
-
async function extractImagesFromZip(zip, blocks, decompressed, warnings, sweepUnreferenced) {
|
|
2230
|
+
async function extractImagesFromZip(zip, blocks, decompressed, warnings, sweepUnreferenced, deletedRefs) {
|
|
2147
2231
|
const images = [];
|
|
2148
2232
|
let imageIndex = 0;
|
|
2149
2233
|
const usedPaths = /* @__PURE__ */ new Set();
|
|
@@ -2212,6 +2296,8 @@ async function extractImagesFromZip(zip, blocks, decompressed, warnings, sweepUn
|
|
|
2212
2296
|
const binEntries = zip.file(/(?:^|\/)BinData\//i);
|
|
2213
2297
|
for (const file of binEntries) {
|
|
2214
2298
|
if (file.dir || usedPaths.has(file.name) || isPathTraversal(file.name)) continue;
|
|
2299
|
+
const basename = file.name.slice(file.name.lastIndexOf("/") + 1);
|
|
2300
|
+
if (deletedRefs?.has(file.name) || deletedRefs?.has(basename) || deletedRefs?.has(file.name.replace(/\.[^/.]+$/, "")) || deletedRefs?.has(basename.replace(/\.[^.]+$/, ""))) continue;
|
|
2215
2301
|
try {
|
|
2216
2302
|
const data = await file.async("uint8array");
|
|
2217
2303
|
decompressed.total += data.length;
|
|
@@ -2558,7 +2644,7 @@ async function parseHwpxDocument(buffer, options) {
|
|
|
2558
2644
|
}
|
|
2559
2645
|
const blocks = allBlocks;
|
|
2560
2646
|
applyPageText(blocks, shared);
|
|
2561
|
-
const images = await extractImagesFromZip(zip, blocks, decompressed, warnings, !options?.pages);
|
|
2647
|
+
const images = await extractImagesFromZip(zip, blocks, decompressed, warnings, !options?.pages, shared.track.deletedImageRefs);
|
|
2562
2648
|
const shown = options?.layoutTables === "keep" ? blocks : unframeLayoutTables(blocks, !!options?.keepTrailingEmptyCols);
|
|
2563
2649
|
detectHwpxHeadings(shown, styleMap);
|
|
2564
2650
|
const outline = shown.filter((b) => b.type === "heading" && b.level && b.text).map((b) => ({ level: b.level, text: b.text, pageNumber: b.pageNumber }));
|
|
@@ -23028,17 +23114,34 @@ function profileColWidths(tp, colCnt) {
|
|
|
23028
23114
|
return null;
|
|
23029
23115
|
}
|
|
23030
23116
|
var CELL_PAD = 1200;
|
|
23031
|
-
function
|
|
23117
|
+
function markdownCellLines(text) {
|
|
23118
|
+
return text.split(/<br\s*\/?>/i).map((seg) => {
|
|
23119
|
+
if (!/[\\`*_!\[<~\x00]/.test(seg)) return seg.trim();
|
|
23120
|
+
return parseInlineMarkdown(seg.replace(/!\[[^\]]*\]\([^)]*\)/g, "")).map((span) => span.text).join("").trim();
|
|
23121
|
+
});
|
|
23122
|
+
}
|
|
23123
|
+
function markdownTableLines(rows) {
|
|
23124
|
+
const cache = /* @__PURE__ */ new Map();
|
|
23125
|
+
return rows.map((row) => row.map((cell2) => {
|
|
23126
|
+
let lines = cache.get(cell2);
|
|
23127
|
+
if (!lines) {
|
|
23128
|
+
lines = markdownCellLines(cell2);
|
|
23129
|
+
cache.set(cell2, lines);
|
|
23130
|
+
}
|
|
23131
|
+
return lines;
|
|
23132
|
+
}));
|
|
23133
|
+
}
|
|
23134
|
+
function cellContentWidth(lines, charHeight) {
|
|
23032
23135
|
let max = 0;
|
|
23033
|
-
for (const seg of
|
|
23136
|
+
for (const seg of lines) {
|
|
23034
23137
|
const w = measureTextWidth(seg.trim(), charHeight, 100, { faceClass: curFace });
|
|
23035
23138
|
if (w > max) max = w;
|
|
23036
23139
|
}
|
|
23037
23140
|
return max;
|
|
23038
23141
|
}
|
|
23039
|
-
function cellMinWordWidth(
|
|
23142
|
+
function cellMinWordWidth(lines, charHeight) {
|
|
23040
23143
|
let max = 0;
|
|
23041
|
-
for (const seg of
|
|
23144
|
+
for (const seg of lines) {
|
|
23042
23145
|
for (const word of seg.trim().split(/[ \t]+/)) {
|
|
23043
23146
|
const w = measureTextWidth(word, charHeight, 100, { faceClass: curFace });
|
|
23044
23147
|
if (w > max) max = w;
|
|
@@ -23050,8 +23153,8 @@ var REMARK_HEAD = /^(비고|비고란|비고사항|참고|참고사항|출처|(
|
|
|
23050
23153
|
var CONTENT_HEAD = /(내용|사항|실적|계획|방안|사유|개요|설명|임무|역할|현황|성과)$/u;
|
|
23051
23154
|
var REMARK_SHARE = 0.25;
|
|
23052
23155
|
var CONTENT_WEIGHT = 2;
|
|
23053
|
-
function colRoles(headers) {
|
|
23054
|
-
const clean = headers.map((h) => (h ?? "").replace(/!\[[^\]]*\]\([^)\s]+\)/g, "").replace(/\*\*|__|`|\s+/g, ""));
|
|
23156
|
+
function colRoles(headers, markdown = true) {
|
|
23157
|
+
const clean = headers.map((h) => markdown ? markdownCellLines(h ?? "").join("").replace(/\s+/g, "") : (h ?? "").replace(/!\[[^\]]*\]\([^)\s]+\)/g, "").replace(/\*\*|__|`|\s+/g, ""));
|
|
23055
23158
|
const roles = clean.map((h) => REMARK_HEAD.test(h) ? "remark" : h.length <= 12 && CONTENT_HEAD.test(h) ? "content" : null);
|
|
23056
23159
|
const last = roles.length - 1;
|
|
23057
23160
|
if (roles.length >= 3 && roles.includes("content") && roles[last] === null) roles[last] = "remark";
|
|
@@ -23125,14 +23228,12 @@ function computeColWidths(colMax, totalWidth, colMinWord = [], roles = [], slack
|
|
|
23125
23228
|
}
|
|
23126
23229
|
return widths;
|
|
23127
23230
|
}
|
|
23128
|
-
function estimateRowHeight(
|
|
23231
|
+
function estimateRowHeight(cellWidths, widths, charHeight) {
|
|
23129
23232
|
let maxLines = 1;
|
|
23130
|
-
|
|
23233
|
+
cellWidths.forEach((cell2, c) => {
|
|
23131
23234
|
const usable = Math.max((widths[c] ?? widths[widths.length - 1]) - CELL_PAD, 1e3);
|
|
23132
23235
|
let lines = 0;
|
|
23133
|
-
for (const
|
|
23134
|
-
lines += Math.max(1, Math.ceil(measureTextWidth(seg.trim(), charHeight, 100, { faceClass: curFace }) / usable));
|
|
23135
|
-
}
|
|
23236
|
+
for (const w of cell2) lines += Math.max(1, Math.ceil(w / usable));
|
|
23136
23237
|
if (lines > maxLines) maxLines = lines;
|
|
23137
23238
|
});
|
|
23138
23239
|
return maxLines * Math.round(charHeight * 1.6) + 282;
|
|
@@ -23142,7 +23243,7 @@ function requiredTableWidth(rows, charHeight, faceClass = "hcr") {
|
|
|
23142
23243
|
curFace = faceClass;
|
|
23143
23244
|
const colCnt = Math.max(...rows.map((r) => r.length), 1);
|
|
23144
23245
|
const colMax = Array(colCnt).fill(0);
|
|
23145
|
-
for (const row of rows) row.forEach((cell2, c) => {
|
|
23246
|
+
for (const row of markdownTableLines(rows)) row.forEach((cell2, c) => {
|
|
23146
23247
|
const w = cellContentWidth(cell2, charHeight);
|
|
23147
23248
|
if (w > colMax[c]) colMax[c] = w;
|
|
23148
23249
|
});
|
|
@@ -23161,8 +23262,10 @@ function generateTable(rows, theme, style = null, remap = null, seq = 0, images
|
|
|
23161
23262
|
const colMax = Array(colCnt).fill(0);
|
|
23162
23263
|
const colMaxBody = Array(colCnt).fill(0);
|
|
23163
23264
|
const colMinWord = Array(colCnt).fill(0);
|
|
23164
|
-
|
|
23165
|
-
|
|
23265
|
+
const cellLines = markdownTableLines(rows);
|
|
23266
|
+
const cellWidths = cellLines.map((row) => row.map((lines) => lines.map((line) => measureTextWidth(line, measureH, 100, { faceClass: curFace }))));
|
|
23267
|
+
cellLines.forEach((row, r) => row.forEach((cell2, c) => {
|
|
23268
|
+
const w = cellWidths[r][c].reduce((max, width) => Math.max(max, width), 0);
|
|
23166
23269
|
if (w > colMax[c]) colMax[c] = w;
|
|
23167
23270
|
if (r > 0 && w > colMaxBody[c]) colMaxBody[c] = w;
|
|
23168
23271
|
const mw = cellMinWordWidth(cell2, measureH);
|
|
@@ -23175,7 +23278,7 @@ function generateTable(rows, theme, style = null, remap = null, seq = 0, images
|
|
|
23175
23278
|
const tblId = nextTableId();
|
|
23176
23279
|
const useHeaderStyle = !style && (theme.tableHeader !== theme.body || theme.tableHeaderBold);
|
|
23177
23280
|
const mapId = style ? (id) => id === CHAR_NORMAL ? style.charPr : id === CHAR_BOLD ? style.boldCharPr : id : void 0;
|
|
23178
|
-
const rowHeights =
|
|
23281
|
+
const rowHeights = cellWidths.map((row) => style ? estimateRowHeight(row, colWidths, measureH) : 1500);
|
|
23179
23282
|
const trElements = rows.map((row, rowIdx) => {
|
|
23180
23283
|
const cells = row.length < colCnt ? [...row, ...Array(colCnt - row.length).fill("")] : row;
|
|
23181
23284
|
const isHeaderRow = rowIdx === 0;
|
|
@@ -23280,7 +23383,7 @@ function generateHtmlTableXml(rawHtml, theme, totalWidth = 44e3, style = null, r
|
|
|
23280
23383
|
const cellLines = cellParsed.map((p) => p.lines);
|
|
23281
23384
|
placed.forEach((cell2, i) => {
|
|
23282
23385
|
const w = Math.max(...cellLines[i].map((l) => measureTextWidth(l.trim(), measureH, 100, { faceClass: curFace })), 0) / cell2.colSpan;
|
|
23283
|
-
const mw = cell2.colSpan === 1 ?
|
|
23386
|
+
const mw = cell2.colSpan === 1 ? cellMinWordWidth(cellLines[i].flatMap((line) => line.replace(/!\[[^\]]*\]\([^)\s]+\)/g, "").replace(/\*\*|__|`/g, "").split(/<br\s*\/?>/i)), measureH) : 0;
|
|
23284
23387
|
for (let dc = 0; dc < cell2.colSpan; dc++) {
|
|
23285
23388
|
const c = cell2.c + dc;
|
|
23286
23389
|
if (w > colMax[c]) colMax[c] = w;
|
|
@@ -23290,7 +23393,7 @@ function generateHtmlTableXml(rawHtml, theme, totalWidth = 44e3, style = null, r
|
|
|
23290
23393
|
});
|
|
23291
23394
|
const headers = Array.from({ length: colCnt }, () => "");
|
|
23292
23395
|
for (const [i, cell2] of placed.entries()) if (cell2.r === 0 && cell2.c < colCnt) headers[cell2.c] = cellLines[i].join(" ");
|
|
23293
|
-
const roles = style ? colRoles(headers) : [];
|
|
23396
|
+
const roles = style ? colRoles(headers, false) : [];
|
|
23294
23397
|
const colWidths = profileColWidths(prof, colCnt) ?? computeColWidths(colMax, totalWidth, colMinWord, roles, colSlack(curFace));
|
|
23295
23398
|
const colCentered = colWidths.map((w, c) => roles[c] !== "content" && colMaxBody[c] + CELL_PAD <= w);
|
|
23296
23399
|
const cellH = style ? Math.round(measureH * 1.6) + 282 : 1500;
|
|
@@ -29626,7 +29729,7 @@ function scriptsOff(r, off) {
|
|
|
29626
29729
|
}
|
|
29627
29730
|
async function parseImage(buffer, options) {
|
|
29628
29731
|
try {
|
|
29629
|
-
const { parseImageDocument } = await import("./image-ocr-
|
|
29732
|
+
const { parseImageDocument } = await import("./image-ocr-BGVJ2CHC.js");
|
|
29630
29733
|
const { blocks, warnings } = await parseImageDocument(buffer, options);
|
|
29631
29734
|
stripScriptTags({ blocks });
|
|
29632
29735
|
return {
|
|
@@ -29686,7 +29789,7 @@ async function parseHwp(buffer, options) {
|
|
|
29686
29789
|
async function parsePdf(buffer, options) {
|
|
29687
29790
|
let parsePdfDocument;
|
|
29688
29791
|
try {
|
|
29689
|
-
const mod = await import("./parser-
|
|
29792
|
+
const mod = await import("./parser-WMPQ6ZRT.js");
|
|
29690
29793
|
parsePdfDocument = mod.parsePdfDocument;
|
|
29691
29794
|
} catch {
|
|
29692
29795
|
return {
|
|
@@ -29898,4 +30001,4 @@ export {
|
|
|
29898
30001
|
parseHwpml,
|
|
29899
30002
|
fillForm
|
|
29900
30003
|
};
|
|
29901
|
-
//# sourceMappingURL=chunk-
|
|
30004
|
+
//# sourceMappingURL=chunk-3OAC2DOI.js.map
|