kordoc 4.2.7 → 4.2.9
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/{-7TEU6IRU.js → -ECUCTQTR.js} +9 -9
- package/dist/{chunk-AES6PHIG.js → chunk-27Z4PUZZ.js} +3 -3
- package/dist/{chunk-62DHK6KT.js → chunk-3PLF5UIS.js} +2 -2
- package/dist/{chunk-G2AS6ICC.js → chunk-3TSTZGCJ.js} +2 -2
- package/dist/{chunk-RS5OID2J.cjs → chunk-4ZWKFDUC.cjs} +9 -9
- package/dist/{chunk-RS5OID2J.cjs.map → chunk-4ZWKFDUC.cjs.map} +1 -1
- package/dist/{chunk-VWXA47AW.cjs → chunk-6GM2QLM3.cjs} +4 -4
- package/dist/{chunk-VWXA47AW.cjs.map → chunk-6GM2QLM3.cjs.map} +1 -1
- package/dist/{chunk-IVX3YLQH.js → chunk-7ZARSBQ3.js} +2 -2
- package/dist/chunk-7ZARSBQ3.js.map +1 -0
- package/dist/{chunk-LPRNVK4G.js → chunk-G3DMDTZI.js} +64 -39
- package/dist/chunk-G3DMDTZI.js.map +1 -0
- package/dist/{chunk-HH4SD5RE.cjs → chunk-GZ7W64QU.cjs} +2 -2
- package/dist/{chunk-HH4SD5RE.cjs.map → chunk-GZ7W64QU.cjs.map} +1 -1
- package/dist/{chunk-PK5GLL5C.js → chunk-KTPZYXN2.js} +2 -2
- package/dist/{chunk-GJO3ORFW.js → chunk-LM7C6HI2.js} +1 -1
- package/dist/chunk-LM7C6HI2.js.map +1 -0
- package/dist/{chunk-5HFKMCAX.js → chunk-LXE7OR6N.js} +2 -2
- package/dist/{chunk-T6BTWUTC.js → chunk-MHMVFI2N.js} +2 -2
- package/dist/{chunk-NAWC6HTC.js → chunk-NIISBGSR.js} +2 -2
- package/dist/chunk-NIISBGSR.js.map +1 -0
- package/dist/{chunk-YTRJDQ4Q.cjs → chunk-PATPZTH7.cjs} +3 -3
- package/dist/{chunk-YTRJDQ4Q.cjs.map → chunk-PATPZTH7.cjs.map} +1 -1
- package/dist/{chunk-YAQRGQUJ.js → chunk-STYN45MS.js} +2 -2
- package/dist/{chunk-2CHFQQXM.js → chunk-VEHC4EJL.js} +2 -2
- package/dist/{chunk-FSUCQ6ZM.js → chunk-WTT2KJOM.js} +4 -4
- package/dist/chunk-WTT2KJOM.js.map +1 -0
- package/dist/{chunk-ESV4KOSE.js → chunk-XU4VWOKL.js} +3 -3
- package/dist/{chunk-NKERQ6GB.js → chunk-YR4PF56B.js} +2 -2
- package/dist/chunks-VFIMYK36.js +10 -0
- package/dist/cli.js +17 -17
- package/dist/{image-ocr-UX4QM35J.cjs → image-ocr-J5656BEE.cjs} +9 -9
- package/dist/{image-ocr-UX4QM35J.cjs.map → image-ocr-J5656BEE.cjs.map} +1 -1
- package/dist/{image-ocr-PGQ7JPDP.js → image-ocr-KZTNJ62U.js} +5 -5
- package/dist/{image-ocr-OS4ETBOL.js → image-ocr-PS7XCV6K.js} +4 -4
- package/dist/index.cjs +491 -466
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +6 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.js +60 -35
- package/dist/index.js.map +1 -1
- package/dist/mcp.js +15 -15
- package/dist/{parser-2JAC5WMM.js → parser-A34NAYKA.js} +5 -5
- package/dist/{parser-GAZROLSA.cjs → parser-CSYU3CAW.cjs} +24 -24
- package/dist/{parser-GAZROLSA.cjs.map → parser-CSYU3CAW.cjs.map} +1 -1
- package/dist/{parser-T74C7Q57.js → parser-WNFWMBSL.js} +6 -6
- package/dist/pdf-ocr-KBMWPG2L.js +12 -0
- package/dist/{pdf-ocr-3A3QLPID.js → pdf-ocr-NPZG67FN.js} +5 -5
- package/dist/pdf-ocr-O44DAGTY.cjs +13 -0
- package/dist/{pdf-ocr-2SKGRXIR.cjs.map → pdf-ocr-O44DAGTY.cjs.map} +1 -1
- package/dist/{profile-io-6GX564CO.js → profile-io-43MF52H6.js} +3 -3
- package/dist/{rasterize-4V7PKE7A.js → rasterize-OG7KXBJS.js} +2 -2
- package/dist/render-336CJHAS.js +10 -0
- package/dist/seal-TM2XCE2R.js +10 -0
- package/dist/{watch-JVRAAJNA.js → watch-SOHQMZN2.js} +9 -9
- package/package.json +1 -1
- package/dist/chunk-FSUCQ6ZM.js.map +0 -1
- package/dist/chunk-GJO3ORFW.js.map +0 -1
- package/dist/chunk-IVX3YLQH.js.map +0 -1
- package/dist/chunk-LPRNVK4G.js.map +0 -1
- package/dist/chunk-NAWC6HTC.js.map +0 -1
- package/dist/chunks-TLAOHNPB.js +0 -10
- package/dist/pdf-ocr-2SKGRXIR.cjs +0 -13
- package/dist/pdf-ocr-WBOTDQ4D.js +0 -12
- package/dist/render-2AF7GZVN.js +0 -10
- package/dist/seal-2ES6UAN6.js +0 -10
- /package/dist/{-7TEU6IRU.js.map → -ECUCTQTR.js.map} +0 -0
- /package/dist/{chunk-AES6PHIG.js.map → chunk-27Z4PUZZ.js.map} +0 -0
- /package/dist/{chunk-62DHK6KT.js.map → chunk-3PLF5UIS.js.map} +0 -0
- /package/dist/{chunk-G2AS6ICC.js.map → chunk-3TSTZGCJ.js.map} +0 -0
- /package/dist/{chunk-PK5GLL5C.js.map → chunk-KTPZYXN2.js.map} +0 -0
- /package/dist/{chunk-5HFKMCAX.js.map → chunk-LXE7OR6N.js.map} +0 -0
- /package/dist/{chunk-T6BTWUTC.js.map → chunk-MHMVFI2N.js.map} +0 -0
- /package/dist/{chunk-YAQRGQUJ.js.map → chunk-STYN45MS.js.map} +0 -0
- /package/dist/{chunk-2CHFQQXM.js.map → chunk-VEHC4EJL.js.map} +0 -0
- /package/dist/{chunk-ESV4KOSE.js.map → chunk-XU4VWOKL.js.map} +0 -0
- /package/dist/{chunk-NKERQ6GB.js.map → chunk-YR4PF56B.js.map} +0 -0
- /package/dist/{chunks-TLAOHNPB.js.map → chunks-VFIMYK36.js.map} +0 -0
- /package/dist/{image-ocr-PGQ7JPDP.js.map → image-ocr-KZTNJ62U.js.map} +0 -0
- /package/dist/{image-ocr-OS4ETBOL.js.map → image-ocr-PS7XCV6K.js.map} +0 -0
- /package/dist/{parser-2JAC5WMM.js.map → parser-A34NAYKA.js.map} +0 -0
- /package/dist/{parser-T74C7Q57.js.map → parser-WNFWMBSL.js.map} +0 -0
- /package/dist/{pdf-ocr-3A3QLPID.js.map → pdf-ocr-KBMWPG2L.js.map} +0 -0
- /package/dist/{pdf-ocr-WBOTDQ4D.js.map → pdf-ocr-NPZG67FN.js.map} +0 -0
- /package/dist/{profile-io-6GX564CO.js.map → profile-io-43MF52H6.js.map} +0 -0
- /package/dist/{rasterize-4V7PKE7A.js.map → rasterize-OG7KXBJS.js.map} +0 -0
- /package/dist/{render-2AF7GZVN.js.map → render-336CJHAS.js.map} +0 -0
- /package/dist/{seal-2ES6UAN6.js.map → seal-TM2XCE2R.js.map} +0 -0
- /package/dist/{watch-JVRAAJNA.js.map → watch-SOHQMZN2.js.map} +0 -0
package/dist/index.cjs
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
|
|
9
9
|
|
|
10
10
|
|
|
11
|
-
var
|
|
11
|
+
var _chunk6GM2QLM3cjs = require('./chunk-6GM2QLM3.cjs');
|
|
12
12
|
|
|
13
13
|
|
|
14
14
|
var _chunkDCZVOIEOcjs = require('./chunk-DCZVOIEO.cjs');
|
|
@@ -27,7 +27,7 @@ var _chunkDCZVOIEOcjs = require('./chunk-DCZVOIEO.cjs');
|
|
|
27
27
|
|
|
28
28
|
|
|
29
29
|
|
|
30
|
-
var
|
|
30
|
+
var _chunkGZ7W64QUcjs = require('./chunk-GZ7W64QU.cjs');
|
|
31
31
|
|
|
32
32
|
|
|
33
33
|
var _chunkGS7T56RPcjs = require('./chunk-GS7T56RP.cjs');
|
|
@@ -413,7 +413,7 @@ function comResultToParseResult(pages, pageCount, warnings) {
|
|
|
413
413
|
var _xmldom = require('@xmldom/xmldom');
|
|
414
414
|
var MAX_DECOMPRESS_SIZE = 256 * 1024 * 1024;
|
|
415
415
|
var MAX_ZIP_ENTRIES = 500;
|
|
416
|
-
var ZipBombError = class extends
|
|
416
|
+
var ZipBombError = class extends _chunkGZ7W64QUcjs.KordocError {
|
|
417
417
|
constructor(message) {
|
|
418
418
|
super(message);
|
|
419
419
|
this.name = "ZipBombError";
|
|
@@ -429,7 +429,7 @@ function createSectionShared() {
|
|
|
429
429
|
function createXmlParser(warnings) {
|
|
430
430
|
return new (0, _xmldom.DOMParser)({
|
|
431
431
|
onError(level, msg2) {
|
|
432
|
-
if (level === "fatalError") throw new (0,
|
|
432
|
+
if (level === "fatalError") throw new (0, _chunkGZ7W64QUcjs.KordocError)(`XML \uD30C\uC2F1 \uC2E4\uD328: ${msg2}`);
|
|
433
433
|
_optionalChain([warnings, 'optionalAccess', _3 => _3.push, 'call', _4 => _4({ code: "MALFORMED_XML", message: `XML ${level === "warning" ? "\uACBD\uACE0" : "\uC624\uB958"}: ${msg2}` })]);
|
|
434
434
|
}
|
|
435
435
|
});
|
|
@@ -506,10 +506,10 @@ async function extractHwpxStyles(zip, decompressed) {
|
|
|
506
506
|
const xml = await file.async("text");
|
|
507
507
|
if (decompressed) {
|
|
508
508
|
decompressed.total += xml.length * 2;
|
|
509
|
-
if (decompressed.total > MAX_DECOMPRESS_SIZE) throw new (0,
|
|
509
|
+
if (decompressed.total > MAX_DECOMPRESS_SIZE) throw new (0, _chunkGZ7W64QUcjs.KordocError)("ZIP \uC555\uCD95 \uD574\uC81C \uD06C\uAE30 \uCD08\uACFC (ZIP bomb \uC758\uC2EC)");
|
|
510
510
|
}
|
|
511
511
|
const parser = createXmlParser();
|
|
512
|
-
const doc = parser.parseFromString(
|
|
512
|
+
const doc = parser.parseFromString(_chunkGZ7W64QUcjs.stripDtd.call(void 0, xml), "text/xml");
|
|
513
513
|
if (!doc.documentElement) continue;
|
|
514
514
|
const domDoc = doc;
|
|
515
515
|
parseCharProperties(domDoc, result.charProperties);
|
|
@@ -696,9 +696,9 @@ function detectHwpxHeadings(blocks, styleMap) {
|
|
|
696
696
|
let level = 0;
|
|
697
697
|
if (baseFontSize > 0 && _optionalChain([block, 'access', _11 => _11.style, 'optionalAccess', _12 => _12.fontSize])) {
|
|
698
698
|
const ratio = block.style.fontSize / baseFontSize;
|
|
699
|
-
if (ratio >=
|
|
700
|
-
else if (ratio >=
|
|
701
|
-
else if (ratio >=
|
|
699
|
+
if (ratio >= _chunkGZ7W64QUcjs.HEADING_RATIO_H1) level = 1;
|
|
700
|
+
else if (ratio >= _chunkGZ7W64QUcjs.HEADING_RATIO_H2) level = 2;
|
|
701
|
+
else if (ratio >= _chunkGZ7W64QUcjs.HEADING_RATIO_H3) level = 3;
|
|
702
702
|
}
|
|
703
703
|
const compactText = text.replace(/\s+/g, "");
|
|
704
704
|
if (/^제\d+[조장절편]/.test(compactText) && text.length <= 50) {
|
|
@@ -1623,7 +1623,7 @@ function needsGaejosikAssets(gongmun) {
|
|
|
1623
1623
|
}
|
|
1624
1624
|
function assertFiniteRange(name, value, min, max) {
|
|
1625
1625
|
if (!Number.isFinite(value) || value < min || value > max) {
|
|
1626
|
-
throw new (0,
|
|
1626
|
+
throw new (0, _chunkGZ7W64QUcjs.KordocError)(`${name} must be a finite number between ${min} and ${max}`);
|
|
1627
1627
|
}
|
|
1628
1628
|
}
|
|
1629
1629
|
function validateGongmunOptions(opts) {
|
|
@@ -1638,10 +1638,10 @@ function validateGongmunOptions(opts) {
|
|
|
1638
1638
|
assertFiniteRange(`margins.${side}`, value, 0, 200);
|
|
1639
1639
|
}
|
|
1640
1640
|
if (opts.margins.left + opts.margins.right >= 210) {
|
|
1641
|
-
throw new (0,
|
|
1641
|
+
throw new (0, _chunkGZ7W64QUcjs.KordocError)("margins.left + margins.right must be less than 210");
|
|
1642
1642
|
}
|
|
1643
1643
|
if (opts.margins.top + opts.margins.bottom >= 297) {
|
|
1644
|
-
throw new (0,
|
|
1644
|
+
throw new (0, _chunkGZ7W64QUcjs.KordocError)("margins.top + margins.bottom must be less than 297");
|
|
1645
1645
|
}
|
|
1646
1646
|
}
|
|
1647
1647
|
if (opts.sizes) {
|
|
@@ -1650,7 +1650,7 @@ function validateGongmunOptions(opts) {
|
|
|
1650
1650
|
}
|
|
1651
1651
|
}
|
|
1652
1652
|
if (opts.approval && opts.approval.length > 6) {
|
|
1653
|
-
throw new (0,
|
|
1653
|
+
throw new (0, _chunkGZ7W64QUcjs.KordocError)("approval must contain at most 6 labels");
|
|
1654
1654
|
}
|
|
1655
1655
|
}
|
|
1656
1656
|
function incompatibleGongmunWarnings(opts) {
|
|
@@ -1915,15 +1915,16 @@ function resolveParaHeading(paraEl, ctx) {
|
|
|
1915
1915
|
|
|
1916
1916
|
// src/hwpx/table-build.ts
|
|
1917
1917
|
function buildTableWithCellMeta(state, keepAnchoredEmptyCols) {
|
|
1918
|
-
const table2 =
|
|
1918
|
+
const table2 = _chunk6GM2QLM3cjs.buildTable.call(void 0, state.rows, { keepAnchoredEmptyCols });
|
|
1919
1919
|
if (state.caption) table2.caption = state.caption;
|
|
1920
|
+
if (_optionalChain([state, 'access', _25 => _25.captionBlocks, 'optionalAccess', _26 => _26.length])) table2.captionBlocks = state.captionBlocks;
|
|
1920
1921
|
const anchors = [];
|
|
1921
1922
|
{
|
|
1922
1923
|
const covered = /* @__PURE__ */ new Set();
|
|
1923
1924
|
for (let r = 0; r < table2.rows; r++) {
|
|
1924
1925
|
for (let c = 0; c < table2.cols; c++) {
|
|
1925
1926
|
if (covered.has(`${r},${c}`)) continue;
|
|
1926
|
-
const cell2 = _optionalChain([table2, 'access',
|
|
1927
|
+
const cell2 = _optionalChain([table2, 'access', _27 => _27.cells, 'access', _28 => _28[r], 'optionalAccess', _29 => _29[c]]);
|
|
1927
1928
|
if (!cell2) continue;
|
|
1928
1929
|
for (let dr = 0; dr < cell2.rowSpan; dr++) {
|
|
1929
1930
|
for (let dc = 0; dc < cell2.colSpan; dc++) {
|
|
@@ -1948,7 +1949,7 @@ function buildTableWithCellMeta(state, keepAnchoredEmptyCols) {
|
|
|
1948
1949
|
let target;
|
|
1949
1950
|
const trimmed = src.text.trim();
|
|
1950
1951
|
if (src.rowAddr !== void 0 && src.colAddr !== void 0) {
|
|
1951
|
-
const cand = _optionalChain([table2, 'access',
|
|
1952
|
+
const cand = _optionalChain([table2, 'access', _30 => _30.cells, 'access', _31 => _31[src.rowAddr], 'optionalAccess', _32 => _32[src.colAddr]]);
|
|
1952
1953
|
if (cand && cand.text === trimmed && !claimed.has(cand)) target = cand;
|
|
1953
1954
|
}
|
|
1954
1955
|
if (!target) {
|
|
@@ -1981,11 +1982,11 @@ function completeTable(newTable, tableStack, blocks, ctx) {
|
|
|
1981
1982
|
}
|
|
1982
1983
|
const ir = buildTableWithCellMeta(newTable, ctx.shared.keepTrailingEmptyCols);
|
|
1983
1984
|
const block = { type: "table", table: ir, pageNumber: ctx.sectionNum };
|
|
1984
|
-
if (_optionalChain([parentTable, 'optionalAccess',
|
|
1985
|
+
if (_optionalChain([parentTable, 'optionalAccess', _33 => _33.cell])) {
|
|
1985
1986
|
const cell2 = parentTable.cell;
|
|
1986
1987
|
(cell2.blocks ??= []).push(block);
|
|
1987
1988
|
cell2.hasStructure = true;
|
|
1988
|
-
let flat =
|
|
1989
|
+
let flat = _chunk6GM2QLM3cjs.convertTableToText.call(void 0, newTable.rows);
|
|
1989
1990
|
if (newTable.caption) flat = newTable.caption + (flat ? "\n" + flat : "");
|
|
1990
1991
|
if (flat) {
|
|
1991
1992
|
const inlineJoin = newTable.inline === true && cell2.lineOpen === true;
|
|
@@ -2001,7 +2002,7 @@ function completeTable(newTable, tableStack, blocks, ctx) {
|
|
|
2001
2002
|
// src/hwpx/section-walker.ts
|
|
2002
2003
|
function parseSectionXml(xml, styleMap, warnings, sectionNum, shared) {
|
|
2003
2004
|
const parser = createXmlParser(warnings);
|
|
2004
|
-
const doc = parser.parseFromString(
|
|
2005
|
+
const doc = parser.parseFromString(_chunkGZ7W64QUcjs.stripDtd.call(void 0, xml), "text/xml");
|
|
2005
2006
|
if (!doc.documentElement) return [];
|
|
2006
2007
|
const ctx = { styleMap, warnings, sectionNum, shared: _nullishCoalesce(shared, () => ( createSectionShared())) };
|
|
2007
2008
|
ctx.shared.track.deleteDepth = 0;
|
|
@@ -2064,12 +2065,13 @@ function walkSection(node, blocks, tableCtx, tableStack, ctx, depth = 0) {
|
|
|
2064
2065
|
}
|
|
2065
2066
|
// 표/도표 캡션 — IRTable.caption으로 보존 (v3.0, 기존 무음 드롭 수정)
|
|
2066
2067
|
case "caption": {
|
|
2067
|
-
const
|
|
2068
|
-
if (
|
|
2068
|
+
const cap = collectSubListContent(el, ctx);
|
|
2069
|
+
if (cap.text) {
|
|
2069
2070
|
if (tableCtx) {
|
|
2070
|
-
tableCtx.caption = (tableCtx.caption ? tableCtx.caption + "\n" : "") +
|
|
2071
|
+
tableCtx.caption = (tableCtx.caption ? tableCtx.caption + "\n" : "") + cap.text;
|
|
2072
|
+
if (cap.hasStructure) (tableCtx.captionBlocks ??= []).push(...cap.blocks);
|
|
2071
2073
|
} else {
|
|
2072
|
-
blocks.push({ type: "paragraph", text:
|
|
2074
|
+
blocks.push({ type: "paragraph", text: cap.text, pageNumber: ctx.sectionNum });
|
|
2073
2075
|
}
|
|
2074
2076
|
}
|
|
2075
2077
|
break;
|
|
@@ -2094,7 +2096,7 @@ function walkSection(node, blocks, tableCtx, tableStack, ctx, depth = 0) {
|
|
|
2094
2096
|
}
|
|
2095
2097
|
break;
|
|
2096
2098
|
case "cellAddr":
|
|
2097
|
-
if (_optionalChain([tableCtx, 'optionalAccess',
|
|
2099
|
+
if (_optionalChain([tableCtx, 'optionalAccess', _34 => _34.cell])) {
|
|
2098
2100
|
const ca = parseInt(el.getAttribute("colAddr") || "", 10);
|
|
2099
2101
|
const ra = parseInt(el.getAttribute("rowAddr") || "", 10);
|
|
2100
2102
|
if (!isNaN(ca)) tableCtx.cell.colAddr = ca;
|
|
@@ -2102,13 +2104,13 @@ function walkSection(node, blocks, tableCtx, tableStack, ctx, depth = 0) {
|
|
|
2102
2104
|
}
|
|
2103
2105
|
break;
|
|
2104
2106
|
case "cellSpan":
|
|
2105
|
-
if (_optionalChain([tableCtx, 'optionalAccess',
|
|
2107
|
+
if (_optionalChain([tableCtx, 'optionalAccess', _35 => _35.cell])) {
|
|
2106
2108
|
const rawCs = parseInt(el.getAttribute("colSpan") || "1", 10);
|
|
2107
2109
|
const cs = isNaN(rawCs) ? 1 : rawCs;
|
|
2108
2110
|
const rawRs = parseInt(el.getAttribute("rowSpan") || "1", 10);
|
|
2109
2111
|
const rs = isNaN(rawRs) ? 1 : rawRs;
|
|
2110
|
-
tableCtx.cell.colSpan = clampSpan(cs,
|
|
2111
|
-
tableCtx.cell.rowSpan = clampSpan(rs,
|
|
2112
|
+
tableCtx.cell.colSpan = clampSpan(cs, _chunk6GM2QLM3cjs.MAX_COLS);
|
|
2113
|
+
tableCtx.cell.rowSpan = clampSpan(rs, _chunk6GM2QLM3cjs.MAX_ROWS);
|
|
2112
2114
|
}
|
|
2113
2115
|
break;
|
|
2114
2116
|
case "p": {
|
|
@@ -2117,14 +2119,14 @@ function walkSection(node, blocks, tableCtx, tableStack, ctx, depth = 0) {
|
|
|
2117
2119
|
let headingLevel;
|
|
2118
2120
|
const ph = resolveParaHeading(el, ctx);
|
|
2119
2121
|
if (text) {
|
|
2120
|
-
if (_optionalChain([ph, 'optionalAccess',
|
|
2121
|
-
headingLevel = _optionalChain([ph, 'optionalAccess',
|
|
2122
|
+
if (_optionalChain([ph, 'optionalAccess', _36 => _36.prefix])) text = ph.prefix + " " + text;
|
|
2123
|
+
headingLevel = _optionalChain([ph, 'optionalAccess', _37 => _37.headingLevel]);
|
|
2122
2124
|
}
|
|
2123
2125
|
if (segments) {
|
|
2124
|
-
const cell2 = _nullishCoalesce(_optionalChain([tableCtx, 'optionalAccess',
|
|
2126
|
+
const cell2 = _nullishCoalesce(_optionalChain([tableCtx, 'optionalAccess', _38 => _38.cell]), () => ( null));
|
|
2125
2127
|
if (cell2) cell2.lineOpen = false;
|
|
2126
2128
|
const segs = [...segments];
|
|
2127
|
-
if (_optionalChain([ph, 'optionalAccess',
|
|
2129
|
+
if (_optionalChain([ph, 'optionalAccess', _39 => _39.prefix])) {
|
|
2128
2130
|
const fi = segs.findIndex((s) => s);
|
|
2129
2131
|
if (fi >= 0) segs[fi] = ph.prefix + " " + segs[fi];
|
|
2130
2132
|
}
|
|
@@ -2152,13 +2154,13 @@ function walkSection(node, blocks, tableCtx, tableStack, ctx, depth = 0) {
|
|
|
2152
2154
|
break;
|
|
2153
2155
|
}
|
|
2154
2156
|
if (text) {
|
|
2155
|
-
if (_optionalChain([tableCtx, 'optionalAccess',
|
|
2157
|
+
if (_optionalChain([tableCtx, 'optionalAccess', _40 => _40.cell])) {
|
|
2156
2158
|
const cell2 = tableCtx.cell;
|
|
2157
2159
|
if (footnote) text += ` (\uC8FC: ${footnote})`;
|
|
2158
2160
|
cell2.text += (cell2.text ? "\n" : "") + text;
|
|
2159
2161
|
const cellBlock = { type: "paragraph", text, pageNumber: ctx.sectionNum };
|
|
2160
2162
|
const cellSpanMode = spanModeOf(ctx.shared.kordocLayout);
|
|
2161
|
-
if (cellSpanMode && !_optionalChain([ph, 'optionalAccess',
|
|
2163
|
+
if (cellSpanMode && !_optionalChain([ph, 'optionalAccess', _41 => _41.prefix])) {
|
|
2162
2164
|
const spans = extractRunSpans(el, ctx, cellSpanMode, cellSpanMode !== "kordoc");
|
|
2163
2165
|
if (spans && spans.map((s) => s.text).join("").replace(/[ \t]+/g, " ").trim() === text) {
|
|
2164
2166
|
cellBlock.spans = spans;
|
|
@@ -2177,7 +2179,7 @@ function walkSection(node, blocks, tableCtx, tableStack, ctx, depth = 0) {
|
|
|
2177
2179
|
if (style) block.style = style;
|
|
2178
2180
|
if (href) block.href = href;
|
|
2179
2181
|
if (footnote) block.footnoteText = footnote;
|
|
2180
|
-
const ind = _optionalChain([ctx, 'access',
|
|
2182
|
+
const ind = _optionalChain([ctx, 'access', _42 => _42.styleMap, 'optionalAccess', _43 => _43.paraIndents, 'access', _44 => _44.get, 'call', _45 => _45(_nullishCoalesce(el.getAttribute("paraPrIDRef"), () => ( "")))]);
|
|
2181
2183
|
if (ind) {
|
|
2182
2184
|
const eff = ind.left + Math.max(0, ind.intent);
|
|
2183
2185
|
if (eff > 0) block.indent = eff;
|
|
@@ -2188,7 +2190,7 @@ function walkSection(node, blocks, tableCtx, tableStack, ctx, depth = 0) {
|
|
|
2188
2190
|
}
|
|
2189
2191
|
const spanMode = spanModeOf(ctx.shared.kordocLayout);
|
|
2190
2192
|
if (!headingLevel && spanMode) {
|
|
2191
|
-
if (!_optionalChain([ph, 'optionalAccess',
|
|
2193
|
+
if (!_optionalChain([ph, 'optionalAccess', _46 => _46.prefix])) {
|
|
2192
2194
|
const spans = extractRunSpans(el, ctx, spanMode, spanMode === "gongmun");
|
|
2193
2195
|
if (spans && spans.map((s) => s.text).join("").replace(/[ \t]+/g, " ").trim() === text) {
|
|
2194
2196
|
block.spans = spans;
|
|
@@ -2208,7 +2210,7 @@ function walkSection(node, blocks, tableCtx, tableStack, ctx, depth = 0) {
|
|
|
2208
2210
|
case "pic":
|
|
2209
2211
|
case "shape":
|
|
2210
2212
|
case "drawingObject": {
|
|
2211
|
-
if (_optionalChain([tableCtx, 'optionalAccess',
|
|
2213
|
+
if (_optionalChain([tableCtx, 'optionalAccess', _47 => _47.cell])) {
|
|
2212
2214
|
const sink = [];
|
|
2213
2215
|
handleShape(el, sink, ctx);
|
|
2214
2216
|
mergeBlocksIntoCell(tableCtx.cell, sink);
|
|
@@ -2313,46 +2315,66 @@ function hasPageAutoNum(el, depth = 0) {
|
|
|
2313
2315
|
const ch = children[i];
|
|
2314
2316
|
if (ch.nodeType !== 1) continue;
|
|
2315
2317
|
const tag = (ch.tagName || ch.localName || "").replace(/^[^:]+:/, "");
|
|
2316
|
-
if (tag === "autoNum" && _optionalChain([ch, 'access',
|
|
2318
|
+
if (tag === "autoNum" && _optionalChain([ch, 'access', _48 => _48.getAttribute, 'optionalCall', _49 => _49("numType")]) === "PAGE") return true;
|
|
2317
2319
|
if (hasPageAutoNum(ch, depth + 1)) return true;
|
|
2318
2320
|
}
|
|
2319
2321
|
return false;
|
|
2320
2322
|
}
|
|
2321
2323
|
function collectSubListText(el, ctx, depth = 0) {
|
|
2322
|
-
|
|
2324
|
+
return collectSubListContent(el, ctx, depth).text;
|
|
2325
|
+
}
|
|
2326
|
+
function collectSubListContent(el, ctx, depth = 0) {
|
|
2327
|
+
const out = { text: "", blocks: [], hasStructure: false };
|
|
2328
|
+
if (depth > 10) return out;
|
|
2323
2329
|
const parts = [];
|
|
2324
2330
|
const children = el.childNodes;
|
|
2325
|
-
if (!children) return
|
|
2331
|
+
if (!children) return out;
|
|
2326
2332
|
for (let i = 0; i < children.length; i++) {
|
|
2327
2333
|
const ch = children[i];
|
|
2328
2334
|
if (ch.nodeType !== 1) continue;
|
|
2329
2335
|
const tag = (ch.tagName || ch.localName || "").replace(/^[^:]+:/, "");
|
|
2330
2336
|
if (tag === "p" || tag === "para") {
|
|
2331
2337
|
const t = extractParagraphInfo(ch, ctx.styleMap, ctx).text;
|
|
2332
|
-
if (t)
|
|
2338
|
+
if (t) {
|
|
2339
|
+
parts.push(t);
|
|
2340
|
+
out.blocks.push({ type: "paragraph", text: t, pageNumber: ctx.sectionNum });
|
|
2341
|
+
}
|
|
2333
2342
|
const tbls = [];
|
|
2334
2343
|
findTopLevelTbls(ch, tbls);
|
|
2335
2344
|
for (const tbl2 of tbls) {
|
|
2336
|
-
const
|
|
2337
|
-
if (
|
|
2345
|
+
const built = buildSubListTable(tbl2, ctx, depth);
|
|
2346
|
+
if (built.text) parts.push(built.text);
|
|
2347
|
+
if (built.block) {
|
|
2348
|
+
out.blocks.push(built.block);
|
|
2349
|
+
out.hasStructure = true;
|
|
2350
|
+
}
|
|
2338
2351
|
}
|
|
2339
2352
|
} else if (tag === "tbl") {
|
|
2340
|
-
const
|
|
2341
|
-
if (
|
|
2353
|
+
const built = buildSubListTable(ch, ctx, depth);
|
|
2354
|
+
if (built.text) parts.push(built.text);
|
|
2355
|
+
if (built.block) {
|
|
2356
|
+
out.blocks.push(built.block);
|
|
2357
|
+
out.hasStructure = true;
|
|
2358
|
+
}
|
|
2342
2359
|
} else {
|
|
2343
|
-
const
|
|
2344
|
-
if (
|
|
2360
|
+
const sub = collectSubListContent(ch, ctx, depth + 1);
|
|
2361
|
+
if (sub.text) parts.push(sub.text);
|
|
2362
|
+
out.blocks.push(...sub.blocks);
|
|
2363
|
+
if (sub.hasStructure) out.hasStructure = true;
|
|
2345
2364
|
}
|
|
2346
2365
|
}
|
|
2347
|
-
|
|
2366
|
+
out.text = parts.join("\n").trim();
|
|
2367
|
+
return out;
|
|
2348
2368
|
}
|
|
2349
|
-
function
|
|
2369
|
+
function buildSubListTable(el, ctx, depth) {
|
|
2350
2370
|
const sink = [];
|
|
2351
2371
|
const st = { rows: [], currentRow: [], cell: null };
|
|
2352
2372
|
walkSection(el, sink, st, [], ctx, depth + 1);
|
|
2353
|
-
let flat =
|
|
2373
|
+
let flat = _chunk6GM2QLM3cjs.convertTableToText.call(void 0, st.rows);
|
|
2354
2374
|
if (st.caption) flat = st.caption + (flat ? "\n" + flat : "");
|
|
2355
|
-
|
|
2375
|
+
const built = [];
|
|
2376
|
+
completeTable(st, [], built, ctx);
|
|
2377
|
+
return { text: flat, block: _nullishCoalesce(built.find((b) => b.type === "table"), () => ( null)) };
|
|
2356
2378
|
}
|
|
2357
2379
|
function findTopLevelTbls(el, out, depth = 0) {
|
|
2358
2380
|
if (depth > MAX_XML_DEPTH) return;
|
|
@@ -2398,14 +2420,16 @@ function walkParagraphChildren(node, blocks, tableCtx, tableStack, ctx, depth =
|
|
|
2398
2420
|
walkSection(el, blocks, newTable, tableStack, ctx, d + 1);
|
|
2399
2421
|
tableCtx = completeTable(newTable, tableStack, blocks, ctx);
|
|
2400
2422
|
} else if (localTag === "caption" && !inShape) {
|
|
2401
|
-
const
|
|
2402
|
-
if (
|
|
2403
|
-
if (_optionalChain([tableCtx, 'optionalAccess',
|
|
2404
|
-
else if (tableCtx)
|
|
2405
|
-
|
|
2423
|
+
const cap = collectSubListContent(el, ctx);
|
|
2424
|
+
if (cap.text) {
|
|
2425
|
+
if (_optionalChain([tableCtx, 'optionalAccess', _50 => _50.cell])) mergeBlocksIntoCell(tableCtx.cell, [{ type: "paragraph", text: cap.text, pageNumber: ctx.sectionNum }]);
|
|
2426
|
+
else if (tableCtx) {
|
|
2427
|
+
tableCtx.caption = (tableCtx.caption ? tableCtx.caption + "\n" : "") + cap.text;
|
|
2428
|
+
if (cap.hasStructure) (tableCtx.captionBlocks ??= []).push(...cap.blocks);
|
|
2429
|
+
} else blocks.push({ type: "paragraph", text: cap.text, pageNumber: ctx.sectionNum });
|
|
2406
2430
|
}
|
|
2407
2431
|
} else if (localTag === "pic" || localTag === "shape" || localTag === "drawingObject") {
|
|
2408
|
-
if (_optionalChain([tableCtx, 'optionalAccess',
|
|
2432
|
+
if (_optionalChain([tableCtx, 'optionalAccess', _51 => _51.cell])) {
|
|
2409
2433
|
const sink = [];
|
|
2410
2434
|
handleShape(el, sink, ctx);
|
|
2411
2435
|
mergeBlocksIntoCell(tableCtx.cell, sink);
|
|
@@ -2413,7 +2437,7 @@ function walkParagraphChildren(node, blocks, tableCtx, tableStack, ctx, depth =
|
|
|
2413
2437
|
handleShape(el, blocks, ctx);
|
|
2414
2438
|
}
|
|
2415
2439
|
} else if (localTag === "drawText") {
|
|
2416
|
-
if (_optionalChain([tableCtx, 'optionalAccess',
|
|
2440
|
+
if (_optionalChain([tableCtx, 'optionalAccess', _52 => _52.cell])) {
|
|
2417
2441
|
const sink = [];
|
|
2418
2442
|
extractDrawTextBlocks(el, sink, ctx);
|
|
2419
2443
|
mergeBlocksIntoCell(tableCtx.cell, sink);
|
|
@@ -2431,7 +2455,7 @@ function walkParagraphChildren(node, blocks, tableCtx, tableStack, ctx, depth =
|
|
|
2431
2455
|
return tableCtx;
|
|
2432
2456
|
}
|
|
2433
2457
|
function isInlineTbl(tbl2) {
|
|
2434
|
-
return _optionalChain([findChildByLocalName, 'call',
|
|
2458
|
+
return _optionalChain([findChildByLocalName, 'call', _53 => _53(tbl2, "pos"), 'optionalAccess', _54 => _54.getAttribute, 'call', _55 => _55("treatAsChar")]) === "1";
|
|
2435
2459
|
}
|
|
2436
2460
|
function findDescendant(node, targetTag, depth = 0) {
|
|
2437
2461
|
if (depth > 5) return null;
|
|
@@ -2462,7 +2486,7 @@ function extractDrawTextBlocks(drawTextNode, blocks, ctx) {
|
|
|
2462
2486
|
let text = info.text.trim();
|
|
2463
2487
|
const ph = resolveParaHeading(child, ctx);
|
|
2464
2488
|
if (text) {
|
|
2465
|
-
if (_optionalChain([ph, 'optionalAccess',
|
|
2489
|
+
if (_optionalChain([ph, 'optionalAccess', _56 => _56.prefix])) text = ph.prefix + " " + text;
|
|
2466
2490
|
const block = { type: "paragraph", text, style: _nullishCoalesce(info.style, () => ( void 0)), pageNumber: ctx.sectionNum };
|
|
2467
2491
|
if (info.href) block.href = info.href;
|
|
2468
2492
|
if (info.footnote) block.footnoteText = info.footnote;
|
|
@@ -2487,13 +2511,13 @@ function extractHyperlinkHref(fieldBegin) {
|
|
|
2487
2511
|
let url = (ch.textContent || "").trim();
|
|
2488
2512
|
if (!url) continue;
|
|
2489
2513
|
url = url.replace(/^https?:\/\/(?=https?:\/\/)/i, "");
|
|
2490
|
-
const safe =
|
|
2514
|
+
const safe = _chunkGZ7W64QUcjs.sanitizeHref.call(void 0, url);
|
|
2491
2515
|
if (safe) return safe;
|
|
2492
2516
|
}
|
|
2493
2517
|
return void 0;
|
|
2494
2518
|
}
|
|
2495
2519
|
function isInDeletedRange(ctx) {
|
|
2496
|
-
return (_nullishCoalesce(_optionalChain([ctx, 'optionalAccess',
|
|
2520
|
+
return (_nullishCoalesce(_optionalChain([ctx, 'optionalAccess', _57 => _57.shared, 'access', _58 => _58.track, 'access', _59 => _59.deleteDepth]), () => ( 0))) > 0;
|
|
2497
2521
|
}
|
|
2498
2522
|
function extractParagraphInfo(para2, styleMap, ctx) {
|
|
2499
2523
|
let text = "";
|
|
@@ -2514,7 +2538,7 @@ function extractParagraphInfo(para2, styleMap, ctx) {
|
|
|
2514
2538
|
};
|
|
2515
2539
|
const onFieldEnd = () => {
|
|
2516
2540
|
const open = openFields.pop();
|
|
2517
|
-
if (_optionalChain([open, 'optionalAccess',
|
|
2541
|
+
if (_optionalChain([open, 'optionalAccess', _60 => _60.rangeIdx]) !== void 0) linkRanges[open.rangeIdx].end = text.length;
|
|
2518
2542
|
};
|
|
2519
2543
|
const handleCtrl = (ctrlEl) => {
|
|
2520
2544
|
const kids2 = ctrlEl.childNodes;
|
|
@@ -2565,7 +2589,7 @@ function extractParagraphInfo(para2, styleMap, ctx) {
|
|
|
2565
2589
|
// 삽입분은 최종본에 포함
|
|
2566
2590
|
// 숨은 설명 — 본문 혼입 차단
|
|
2567
2591
|
case "hiddenComment": {
|
|
2568
|
-
if (_optionalChain([ctx, 'optionalAccess',
|
|
2592
|
+
if (_optionalChain([ctx, 'optionalAccess', _61 => _61.warnings]) && extractTextFromNode(k)) {
|
|
2569
2593
|
ctx.warnings.push({ page: ctx.sectionNum, message: "\uC228\uC740 \uC124\uBA85 \uD14D\uC2A4\uD2B8 \uC81C\uC678: hiddenComment", code: "HIDDEN_TEXT_FILTERED" });
|
|
2570
2594
|
}
|
|
2571
2595
|
break;
|
|
@@ -2585,7 +2609,7 @@ function extractParagraphInfo(para2, styleMap, ctx) {
|
|
|
2585
2609
|
break;
|
|
2586
2610
|
// 미지원 요소 — 텍스트를 가졌으면 무음 손실 대신 경고
|
|
2587
2611
|
default: {
|
|
2588
|
-
if (_optionalChain([ctx, 'optionalAccess',
|
|
2612
|
+
if (_optionalChain([ctx, 'optionalAccess', _62 => _62.warnings]) && extractTextFromNode(k)) {
|
|
2589
2613
|
ctx.warnings.push({ page: ctx.sectionNum, message: `\uBBF8\uC9C0\uC6D0 \uC81C\uC5B4 \uC694\uC18C\uC758 \uD14D\uC2A4\uD2B8 \uC190\uC2E4: ${ktag}`, code: "UNSUPPORTED_ELEMENT" });
|
|
2590
2614
|
}
|
|
2591
2615
|
}
|
|
@@ -2603,7 +2627,7 @@ function extractParagraphInfo(para2, styleMap, ctx) {
|
|
|
2603
2627
|
if (isInDeletedRange(ctx)) {
|
|
2604
2628
|
if (t && ctx && !ctx.shared.track.warned) {
|
|
2605
2629
|
ctx.shared.track.warned = true;
|
|
2606
|
-
_optionalChain([ctx, 'access',
|
|
2630
|
+
_optionalChain([ctx, 'access', _63 => _63.warnings, 'optionalAccess', _64 => _64.push, 'call', _65 => _65({ page: ctx.sectionNum, message: "\uBCC0\uACBD\uCD94\uC801 \uC0AD\uC81C \uD14D\uC2A4\uD2B8 \uCD9C\uB825 \uC81C\uC678", code: "HIDDEN_TEXT_FILTERED" })]);
|
|
2607
2631
|
}
|
|
2608
2632
|
} else {
|
|
2609
2633
|
text += t.replace(/\x1E/g, "");
|
|
@@ -2647,7 +2671,7 @@ function extractParagraphInfo(para2, styleMap, ctx) {
|
|
|
2647
2671
|
case "hyperlink": {
|
|
2648
2672
|
const url = child.getAttribute("url") || child.getAttribute("href") || "";
|
|
2649
2673
|
if (url) {
|
|
2650
|
-
const safe =
|
|
2674
|
+
const safe = _chunkGZ7W64QUcjs.sanitizeHref.call(void 0, url);
|
|
2651
2675
|
if (safe) href = safe;
|
|
2652
2676
|
}
|
|
2653
2677
|
walk(child, depth + 1);
|
|
@@ -2794,13 +2818,13 @@ function extractRunSpans(para2, ctx, mode, requireMixed) {
|
|
|
2794
2818
|
if (tag !== "run" && tag !== "r") return null;
|
|
2795
2819
|
let text = "";
|
|
2796
2820
|
const rkids = child.childNodes;
|
|
2797
|
-
for (let j = 0; j < (_nullishCoalesce(_optionalChain([rkids, 'optionalAccess',
|
|
2821
|
+
for (let j = 0; j < (_nullishCoalesce(_optionalChain([rkids, 'optionalAccess', _66 => _66.length]), () => ( 0))); j++) {
|
|
2798
2822
|
const rc = rkids[j];
|
|
2799
2823
|
if (rc.nodeType !== 1) continue;
|
|
2800
2824
|
const rtag = (rc.tagName || rc.localName || "").replace(/^[^:]+:/, "");
|
|
2801
2825
|
if (rtag === "t") {
|
|
2802
2826
|
const tkids = rc.childNodes;
|
|
2803
|
-
for (let k = 0; k < (_nullishCoalesce(_optionalChain([tkids, 'optionalAccess',
|
|
2827
|
+
for (let k = 0; k < (_nullishCoalesce(_optionalChain([tkids, 'optionalAccess', _67 => _67.length]), () => ( 0))); k++) {
|
|
2804
2828
|
const tk = tkids[k];
|
|
2805
2829
|
if (tk.nodeType === 3) text += tk.textContent || "";
|
|
2806
2830
|
else if (tk.nodeType === 1) return null;
|
|
@@ -2818,9 +2842,9 @@ function extractRunSpans(para2, ctx, mode, requireMixed) {
|
|
|
2818
2842
|
const span = { text };
|
|
2819
2843
|
if (mode !== "foreign" && prId === KORDOC_CHAR_CODE) span.code = true;
|
|
2820
2844
|
else {
|
|
2821
|
-
if (_optionalChain([cp, 'optionalAccess',
|
|
2822
|
-
if (_optionalChain([cp, 'optionalAccess',
|
|
2823
|
-
if (_optionalChain([cp, 'optionalAccess',
|
|
2845
|
+
if (_optionalChain([cp, 'optionalAccess', _68 => _68.bold])) span.bold = true;
|
|
2846
|
+
if (_optionalChain([cp, 'optionalAccess', _69 => _69.italic])) span.italic = true;
|
|
2847
|
+
if (_optionalChain([cp, 'optionalAccess', _70 => _70.strike])) span.strike = true;
|
|
2824
2848
|
}
|
|
2825
2849
|
if (span.bold || span.italic || span.strike || span.code) styled = true;
|
|
2826
2850
|
spans.push(span);
|
|
@@ -2843,12 +2867,12 @@ function gongmunDepthFromIndent(para2, left, ctx) {
|
|
|
2843
2867
|
if (!styleMap) return null;
|
|
2844
2868
|
let unit = 0;
|
|
2845
2869
|
const kids2 = para2.childNodes;
|
|
2846
|
-
for (let i = 0; i < (_nullishCoalesce(_optionalChain([kids2, 'optionalAccess',
|
|
2870
|
+
for (let i = 0; i < (_nullishCoalesce(_optionalChain([kids2, 'optionalAccess', _71 => _71.length]), () => ( 0))); i++) {
|
|
2847
2871
|
const child = kids2[i];
|
|
2848
2872
|
if (child.nodeType !== 1) continue;
|
|
2849
2873
|
const tag = (child.tagName || child.localName || "").replace(/^[^:]+:/, "");
|
|
2850
2874
|
if (tag !== "run" && tag !== "r") continue;
|
|
2851
|
-
const size = _optionalChain([styleMap, 'access',
|
|
2875
|
+
const size = _optionalChain([styleMap, 'access', _72 => _72.charProperties, 'access', _73 => _73.get, 'call', _74 => _74(_nullishCoalesce(child.getAttribute("charPrIDRef"), () => ( ""))), 'optionalAccess', _75 => _75.fontSize]);
|
|
2852
2876
|
if (size) unit = size * 100;
|
|
2853
2877
|
break;
|
|
2854
2878
|
}
|
|
@@ -2921,7 +2945,7 @@ function decompressStream(data) {
|
|
|
2921
2945
|
return _zlib.inflateRawSync.call(void 0, data, opts);
|
|
2922
2946
|
}
|
|
2923
2947
|
function parseFileHeader(data) {
|
|
2924
|
-
if (data.length < 40) throw new (0,
|
|
2948
|
+
if (data.length < 40) throw new (0, _chunkGZ7W64QUcjs.KordocError)("FileHeader\uAC00 \uB108\uBB34 \uC9E7\uC2B5\uB2C8\uB2E4 (\uCD5C\uC18C 40\uBC14\uC774\uD2B8)");
|
|
2925
2949
|
const sig = data.subarray(0, 32).toString("utf8").replace(/\0+$/, "");
|
|
2926
2950
|
return {
|
|
2927
2951
|
signature: sig,
|
|
@@ -3054,7 +3078,7 @@ function appendParaText(state, data, resolveControl) {
|
|
|
3054
3078
|
const resolveAt = (byteOffset, extended) => {
|
|
3055
3079
|
const ctrlId = data.readUInt32LE(byteOffset);
|
|
3056
3080
|
const idx = extended ? state.ctrlIdx : -1;
|
|
3057
|
-
const replacement = _optionalChain([resolveControl, 'optionalCall',
|
|
3081
|
+
const replacement = _optionalChain([resolveControl, 'optionalCall', _76 => _76(idx, ctrlId)]);
|
|
3058
3082
|
if (replacement) result += replacement;
|
|
3059
3083
|
if (extended) state.ctrlIdx++;
|
|
3060
3084
|
};
|
|
@@ -3256,7 +3280,7 @@ function extractHwp5Images(fileIndex, blocks, warnings, sweepUnreferenced) {
|
|
|
3256
3280
|
const binDataMap = /* @__PURE__ */ new Map();
|
|
3257
3281
|
if (fileIndex) {
|
|
3258
3282
|
for (const entry of fileIndex) {
|
|
3259
|
-
if (!_optionalChain([entry, 'optionalAccess',
|
|
3283
|
+
if (!_optionalChain([entry, 'optionalAccess', _77 => _77.name]) || !entry.content) continue;
|
|
3260
3284
|
const match = entry.name.match(BIN_ENTRY_RE);
|
|
3261
3285
|
if (!match) continue;
|
|
3262
3286
|
const idx = parseInt(match[1], 16);
|
|
@@ -3332,7 +3356,7 @@ function collectImageBlocks2(blocks, out, ownerCell, depth = 0) {
|
|
|
3332
3356
|
} else if (block.type === "table" && block.table) {
|
|
3333
3357
|
for (const row of block.table.cells) {
|
|
3334
3358
|
for (const cell2 of row) {
|
|
3335
|
-
if (_optionalChain([cell2, 'access',
|
|
3359
|
+
if (_optionalChain([cell2, 'access', _78 => _78.blocks, 'optionalAccess', _79 => _79.length])) collectImageBlocks2(cell2.blocks, out, cell2, depth + 1);
|
|
3336
3360
|
}
|
|
3337
3361
|
}
|
|
3338
3362
|
}
|
|
@@ -3370,13 +3394,13 @@ async function extractImagesFromZip(zip, blocks, decompressed, warnings, sweepUn
|
|
|
3370
3394
|
}
|
|
3371
3395
|
const allCandidates = resolvedPath ? [resolvedPath, ...candidates] : candidates;
|
|
3372
3396
|
for (const path of allCandidates) {
|
|
3373
|
-
if (
|
|
3397
|
+
if (_chunkGZ7W64QUcjs.isPathTraversal.call(void 0, path)) continue;
|
|
3374
3398
|
const file = zip.file(path);
|
|
3375
3399
|
if (!file) continue;
|
|
3376
3400
|
try {
|
|
3377
3401
|
const data = await file.async("uint8array");
|
|
3378
3402
|
decompressed.total += data.length;
|
|
3379
|
-
if (decompressed.total > MAX_DECOMPRESS_SIZE) throw new (0,
|
|
3403
|
+
if (decompressed.total > MAX_DECOMPRESS_SIZE) throw new (0, _chunkGZ7W64QUcjs.KordocError)("ZIP \uC555\uCD95 \uD574\uC81C \uD06C\uAE30 \uCD08\uACFC (ZIP bomb \uC758\uC2EC)");
|
|
3380
3404
|
const ext = path.includes(".") ? path.split(".").pop() || "png" : "png";
|
|
3381
3405
|
const mimeType = imageExtToMime(ext);
|
|
3382
3406
|
imageIndex++;
|
|
@@ -3386,10 +3410,10 @@ async function extractImagesFromZip(zip, blocks, decompressed, warnings, sweepUn
|
|
|
3386
3410
|
usedPaths.add(path);
|
|
3387
3411
|
break;
|
|
3388
3412
|
} catch (err) {
|
|
3389
|
-
if (err instanceof
|
|
3413
|
+
if (err instanceof _chunkGZ7W64QUcjs.KordocError) throw err;
|
|
3390
3414
|
}
|
|
3391
3415
|
}
|
|
3392
|
-
if (!img) _optionalChain([warnings, 'optionalAccess',
|
|
3416
|
+
if (!img) _optionalChain([warnings, 'optionalAccess', _80 => _80.push, 'call', _81 => _81({ page: block.pageNumber, message: `\uC774\uBBF8\uC9C0 \uD30C\uC77C \uC5C6\uC74C: ${ref}`, code: "SKIPPED_IMAGE" })]);
|
|
3393
3417
|
resolved.set(ref, img);
|
|
3394
3418
|
}
|
|
3395
3419
|
if (!img) {
|
|
@@ -3406,11 +3430,11 @@ async function extractImagesFromZip(zip, blocks, decompressed, warnings, sweepUn
|
|
|
3406
3430
|
if (sweepUnreferenced) {
|
|
3407
3431
|
const binEntries = zip.file(/(?:^|\/)BinData\//i);
|
|
3408
3432
|
for (const file of binEntries) {
|
|
3409
|
-
if (file.dir || usedPaths.has(file.name) ||
|
|
3433
|
+
if (file.dir || usedPaths.has(file.name) || _chunkGZ7W64QUcjs.isPathTraversal.call(void 0, file.name)) continue;
|
|
3410
3434
|
try {
|
|
3411
3435
|
const data = await file.async("uint8array");
|
|
3412
3436
|
decompressed.total += data.length;
|
|
3413
|
-
if (decompressed.total > MAX_DECOMPRESS_SIZE) throw new (0,
|
|
3437
|
+
if (decompressed.total > MAX_DECOMPRESS_SIZE) throw new (0, _chunkGZ7W64QUcjs.KordocError)("ZIP \uC555\uCD95 \uD574\uC81C \uD06C\uAE30 \uCD08\uACFC (ZIP bomb \uC758\uC2EC)");
|
|
3414
3438
|
const ext = file.name.includes(".") ? file.name.split(".").pop() || "" : "";
|
|
3415
3439
|
let mimeType = imageExtToMime(ext);
|
|
3416
3440
|
if (mimeType === "application/octet-stream") {
|
|
@@ -3424,8 +3448,8 @@ async function extractImagesFromZip(zip, blocks, decompressed, warnings, sweepUn
|
|
|
3424
3448
|
images.push(img);
|
|
3425
3449
|
blocks.push({ type: "image", text: filename, imageData: { data, mimeType, filename: file.name } });
|
|
3426
3450
|
} catch (err) {
|
|
3427
|
-
if (err instanceof
|
|
3428
|
-
_optionalChain([warnings, 'optionalAccess',
|
|
3451
|
+
if (err instanceof _chunkGZ7W64QUcjs.KordocError) throw err;
|
|
3452
|
+
_optionalChain([warnings, 'optionalAccess', _82 => _82.push, 'call', _83 => _83({ message: `\uC774\uBBF8\uC9C0 \uCD94\uCD9C \uC2E4\uD328: ${file.name}`, code: "SKIPPED_IMAGE" })]);
|
|
3429
3453
|
}
|
|
3430
3454
|
}
|
|
3431
3455
|
}
|
|
@@ -3475,7 +3499,7 @@ function extractFromBrokenZip(buffer) {
|
|
|
3475
3499
|
}
|
|
3476
3500
|
const nameBytes = data.slice(pos + 30, pos + 30 + nameLen);
|
|
3477
3501
|
const name = new TextDecoder().decode(nameBytes);
|
|
3478
|
-
if (
|
|
3502
|
+
if (_chunkGZ7W64QUcjs.isPathTraversal.call(void 0, name)) {
|
|
3479
3503
|
pos = fileStart + compSize;
|
|
3480
3504
|
continue;
|
|
3481
3505
|
}
|
|
@@ -3493,16 +3517,16 @@ function extractFromBrokenZip(buffer) {
|
|
|
3493
3517
|
continue;
|
|
3494
3518
|
}
|
|
3495
3519
|
totalDecompressed += content.length * 2;
|
|
3496
|
-
if (totalDecompressed > MAX_DECOMPRESS_SIZE) throw new (0,
|
|
3520
|
+
if (totalDecompressed > MAX_DECOMPRESS_SIZE) throw new (0, _chunkGZ7W64QUcjs.KordocError)("\uC555\uCD95 \uD574\uC81C \uD06C\uAE30 \uCD08\uACFC");
|
|
3497
3521
|
sectionNum++;
|
|
3498
3522
|
blocks.push(...parseSectionXml(content, void 0, warnings, sectionNum, shared));
|
|
3499
3523
|
} catch (e16) {
|
|
3500
3524
|
continue;
|
|
3501
3525
|
}
|
|
3502
3526
|
}
|
|
3503
|
-
if (blocks.length === 0) throw new (0,
|
|
3527
|
+
if (blocks.length === 0) throw new (0, _chunkGZ7W64QUcjs.KordocError)("\uC190\uC0C1\uB41C HWPX\uC5D0\uC11C \uC139\uC158 \uB370\uC774\uD130\uB97C \uBCF5\uAD6C\uD560 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4");
|
|
3504
3528
|
applyPageText(blocks, shared);
|
|
3505
|
-
const markdown =
|
|
3529
|
+
const markdown = _chunk6GM2QLM3cjs.blocksToMarkdown.call(void 0, blocks);
|
|
3506
3530
|
return { markdown, blocks, warnings: warnings.length > 0 ? warnings : void 0 };
|
|
3507
3531
|
}
|
|
3508
3532
|
async function readKordocLayout(zip) {
|
|
@@ -3511,7 +3535,7 @@ async function readKordocLayout(zip) {
|
|
|
3511
3535
|
try {
|
|
3512
3536
|
const xml = await file.async("text");
|
|
3513
3537
|
if (!/<opf:meta\b[^>]*name="generator"[^>]*content="kordoc"/.test(xml)) return null;
|
|
3514
|
-
return _nullishCoalesce(_optionalChain([xml, 'access',
|
|
3538
|
+
return _nullishCoalesce(_optionalChain([xml, 'access', _84 => _84.match, 'call', _85 => _85(/<opf:meta\b[^>]*name="kordoc-layout"[^>]*content="([^"]*)"/), 'optionalAccess', _86 => _86[1]]), () => ( null));
|
|
3515
3539
|
} catch (e17) {
|
|
3516
3540
|
return null;
|
|
3517
3541
|
}
|
|
@@ -3527,18 +3551,18 @@ async function resolveSectionPaths(zip) {
|
|
|
3527
3551
|
if (paths.length > 0) return paths;
|
|
3528
3552
|
}
|
|
3529
3553
|
const sectionFiles = zip.file(/[Ss]ection\d+\.xml$/);
|
|
3530
|
-
return sectionFiles.map((f) => f.name).sort(
|
|
3554
|
+
return sectionFiles.map((f) => f.name).sort(_chunkGZ7W64QUcjs.compareSectionPaths);
|
|
3531
3555
|
}
|
|
3532
3556
|
function parseSectionPathsFromManifest(xml) {
|
|
3533
3557
|
const parser = createXmlParser();
|
|
3534
|
-
const doc = parser.parseFromString(
|
|
3558
|
+
const doc = parser.parseFromString(_chunkGZ7W64QUcjs.stripDtd.call(void 0, xml), "text/xml");
|
|
3535
3559
|
const items = doc.getElementsByTagName("opf:item");
|
|
3536
3560
|
const spine = doc.getElementsByTagName("opf:itemref");
|
|
3537
3561
|
const idToHref = /* @__PURE__ */ new Map();
|
|
3538
3562
|
for (let i = 0; i < items.length; i++) {
|
|
3539
3563
|
const item = items[i];
|
|
3540
3564
|
const id = item.getAttribute("id") || "";
|
|
3541
|
-
const href =
|
|
3565
|
+
const href = _chunkGZ7W64QUcjs.normalizeSectionHref.call(void 0, item.getAttribute("href") || "");
|
|
3542
3566
|
if (id && href) idToHref.set(id, href);
|
|
3543
3567
|
}
|
|
3544
3568
|
if (spine.length > 0) {
|
|
@@ -3549,7 +3573,7 @@ function parseSectionPathsFromManifest(xml) {
|
|
|
3549
3573
|
}
|
|
3550
3574
|
if (ordered.length > 0) return ordered;
|
|
3551
3575
|
}
|
|
3552
|
-
return Array.from(idToHref.values()).sort(
|
|
3576
|
+
return Array.from(idToHref.values()).sort(_chunkGZ7W64QUcjs.compareSectionPaths);
|
|
3553
3577
|
}
|
|
3554
3578
|
|
|
3555
3579
|
// src/hwpx/metadata.ts
|
|
@@ -3562,7 +3586,7 @@ async function extractHwpxMetadata(zip, metadata, decompressed) {
|
|
|
3562
3586
|
const xml = await file.async("text");
|
|
3563
3587
|
if (decompressed) {
|
|
3564
3588
|
decompressed.total += xml.length * 2;
|
|
3565
|
-
if (decompressed.total > MAX_DECOMPRESS_SIZE) throw new (0,
|
|
3589
|
+
if (decompressed.total > MAX_DECOMPRESS_SIZE) throw new (0, _chunkGZ7W64QUcjs.KordocError)("ZIP \uC555\uCD95 \uD574\uC81C \uD06C\uAE30 \uCD08\uACFC (ZIP bomb \uC758\uC2EC)");
|
|
3566
3590
|
}
|
|
3567
3591
|
parseDublinCoreMetadata(xml, metadata);
|
|
3568
3592
|
if (metadata.title || metadata.author) return;
|
|
@@ -3572,13 +3596,13 @@ async function extractHwpxMetadata(zip, metadata, decompressed) {
|
|
|
3572
3596
|
}
|
|
3573
3597
|
function parseDublinCoreMetadata(xml, metadata) {
|
|
3574
3598
|
const parser = createXmlParser();
|
|
3575
|
-
const doc = parser.parseFromString(
|
|
3599
|
+
const doc = parser.parseFromString(_chunkGZ7W64QUcjs.stripDtd.call(void 0, xml), "text/xml");
|
|
3576
3600
|
if (!doc.documentElement) return;
|
|
3577
3601
|
const getText = (tagNames) => {
|
|
3578
3602
|
for (const tag of tagNames) {
|
|
3579
3603
|
const els = doc.getElementsByTagName(tag);
|
|
3580
3604
|
if (els.length > 0) {
|
|
3581
|
-
const text = _optionalChain([els, 'access',
|
|
3605
|
+
const text = _optionalChain([els, 'access', _87 => _87[0], 'access', _88 => _88.textContent, 'optionalAccess', _89 => _89.trim, 'call', _90 => _90()]);
|
|
3582
3606
|
if (text) return text;
|
|
3583
3607
|
}
|
|
3584
3608
|
}
|
|
@@ -3597,7 +3621,7 @@ function parseDublinCoreMetadata(xml, metadata) {
|
|
|
3597
3621
|
|
|
3598
3622
|
// src/hwpx/parser.ts
|
|
3599
3623
|
async function parseHwpxDocument(buffer, options) {
|
|
3600
|
-
|
|
3624
|
+
_chunkGZ7W64QUcjs.precheckZipSize.call(void 0, buffer, MAX_DECOMPRESS_SIZE, MAX_ZIP_ENTRIES);
|
|
3601
3625
|
let zip;
|
|
3602
3626
|
try {
|
|
3603
3627
|
zip = await _jszip2.default.loadAsync(buffer);
|
|
@@ -3606,19 +3630,19 @@ async function parseHwpxDocument(buffer, options) {
|
|
|
3606
3630
|
}
|
|
3607
3631
|
const actualEntryCount = Object.keys(zip.files).length;
|
|
3608
3632
|
if (actualEntryCount > MAX_ZIP_ENTRIES) {
|
|
3609
|
-
throw new (0,
|
|
3633
|
+
throw new (0, _chunkGZ7W64QUcjs.KordocError)("ZIP \uC5D4\uD2B8\uB9AC \uC218 \uCD08\uACFC (ZIP bomb \uC758\uC2EC)");
|
|
3610
3634
|
}
|
|
3611
3635
|
const manifestFile = zip.file("META-INF/manifest.xml");
|
|
3612
3636
|
if (manifestFile) {
|
|
3613
3637
|
const manifestXml = await manifestFile.async("text");
|
|
3614
3638
|
if (isEncryptedHwpx(manifestXml)) {
|
|
3615
|
-
if (isComFallbackAvailable() && _optionalChain([options, 'optionalAccess',
|
|
3639
|
+
if (isComFallbackAvailable() && _optionalChain([options, 'optionalAccess', _91 => _91.filePath])) {
|
|
3616
3640
|
const { pages, pageCount, warnings: warnings2 } = extractTextViaCom(options.filePath);
|
|
3617
3641
|
if (pages.some((p) => p && p.trim().length > 0)) {
|
|
3618
3642
|
return comResultToParseResult(pages, pageCount, warnings2);
|
|
3619
3643
|
}
|
|
3620
3644
|
}
|
|
3621
|
-
throw new (0,
|
|
3645
|
+
throw new (0, _chunkGZ7W64QUcjs.KordocError)("DRM \uC554\uD638\uD654\uB41C HWPX \uD30C\uC77C\uC785\uB2C8\uB2E4. Windows + \uD55C\uCEF4 \uC624\uD53C\uC2A4 \uC124\uCE58 \uC2DC \uC790\uB3D9 \uCD94\uCD9C\uB429\uB2C8\uB2E4.");
|
|
3622
3646
|
}
|
|
3623
3647
|
}
|
|
3624
3648
|
const decompressed = { total: 0 };
|
|
@@ -3627,14 +3651,14 @@ async function parseHwpxDocument(buffer, options) {
|
|
|
3627
3651
|
const styleMap = await extractHwpxStyles(zip, decompressed);
|
|
3628
3652
|
const warnings = [];
|
|
3629
3653
|
const sectionPaths = await resolveSectionPaths(zip);
|
|
3630
|
-
if (sectionPaths.length === 0) throw new (0,
|
|
3654
|
+
if (sectionPaths.length === 0) throw new (0, _chunkGZ7W64QUcjs.KordocError)("HWPX\uC5D0\uC11C \uC139\uC158 \uD30C\uC77C\uC744 \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4");
|
|
3631
3655
|
metadata.pageCount = sectionPaths.length;
|
|
3632
|
-
const pageFilter = _optionalChain([options, 'optionalAccess',
|
|
3656
|
+
const pageFilter = _optionalChain([options, 'optionalAccess', _92 => _92.pages]) ? _chunkDCZVOIEOcjs.parsePageRange.call(void 0, options.pages, sectionPaths.length) : null;
|
|
3633
3657
|
const totalTarget = pageFilter ? pageFilter.size : sectionPaths.length;
|
|
3634
3658
|
const blocks = [];
|
|
3635
3659
|
const shared = createSectionShared();
|
|
3636
3660
|
shared.kordocLayout = await readKordocLayout(zip);
|
|
3637
|
-
shared.keepTrailingEmptyCols = _optionalChain([options, 'optionalAccess',
|
|
3661
|
+
shared.keepTrailingEmptyCols = _optionalChain([options, 'optionalAccess', _93 => _93.keepTrailingEmptyCols]);
|
|
3638
3662
|
let parsedSections = 0;
|
|
3639
3663
|
for (let si = 0; si < sectionPaths.length; si++) {
|
|
3640
3664
|
if (pageFilter && !pageFilter.has(si + 1)) continue;
|
|
@@ -3646,7 +3670,7 @@ async function parseHwpxDocument(buffer, options) {
|
|
|
3646
3670
|
if (decompressed.total > MAX_DECOMPRESS_SIZE) throw new ZipBombError("ZIP \uC555\uCD95 \uD574\uC81C \uD06C\uAE30 \uCD08\uACFC (ZIP bomb \uC758\uC2EC)");
|
|
3647
3671
|
blocks.push(...parseSectionXml(xml, styleMap, warnings, si + 1, shared));
|
|
3648
3672
|
parsedSections++;
|
|
3649
|
-
_optionalChain([options, 'optionalAccess',
|
|
3673
|
+
_optionalChain([options, 'optionalAccess', _94 => _94.onProgress, 'optionalCall', _95 => _95(parsedSections, totalTarget)]);
|
|
3650
3674
|
} catch (secErr) {
|
|
3651
3675
|
if (secErr instanceof ZipBombError) throw secErr;
|
|
3652
3676
|
warnings.push({ page: si + 1, message: `\uC139\uC158 ${si + 1} \uD30C\uC2F1 \uC2E4\uD328: ${secErr instanceof Error ? secErr.message : "\uC54C \uC218 \uC5C6\uB294 \uC624\uB958"}`, code: "PARTIAL_PARSE" });
|
|
@@ -3656,7 +3680,7 @@ async function parseHwpxDocument(buffer, options) {
|
|
|
3656
3680
|
const images = await extractImagesFromZip(zip, blocks, decompressed, warnings, !pageFilter);
|
|
3657
3681
|
detectHwpxHeadings(blocks, styleMap);
|
|
3658
3682
|
const outline = blocks.filter((b) => b.type === "heading" && b.level && b.text).map((b) => ({ level: b.level, text: b.text, pageNumber: b.pageNumber }));
|
|
3659
|
-
const markdown =
|
|
3683
|
+
const markdown = _chunk6GM2QLM3cjs.blocksToMarkdown.call(void 0, blocks);
|
|
3660
3684
|
return { markdown, blocks, metadata, outline: outline.length > 0 ? outline : void 0, warnings: warnings.length > 0 ? warnings : void 0, images: images.length > 0 ? images : void 0 };
|
|
3661
3685
|
}
|
|
3662
3686
|
|
|
@@ -4835,22 +4859,22 @@ function parseHwp5Document(buffer, options) {
|
|
|
4835
4859
|
lenientCfb = parseLenientCfb(buffer);
|
|
4836
4860
|
warnings.push({ message: "\uC190\uC0C1\uB41C CFB \uCEE8\uD14C\uC774\uB108 \u2014 lenient \uBAA8\uB4DC\uB85C \uBCF5\uAD6C", code: "LENIENT_CFB_RECOVERY" });
|
|
4837
4861
|
} catch (e22) {
|
|
4838
|
-
throw new (0,
|
|
4862
|
+
throw new (0, _chunkGZ7W64QUcjs.KordocError)("CFB \uCEE8\uD14C\uC774\uB108 \uD30C\uC2F1 \uC2E4\uD328 (strict \uBC0F lenient \uBAA8\uB450)");
|
|
4839
4863
|
}
|
|
4840
4864
|
}
|
|
4841
4865
|
const findStream = (path) => {
|
|
4842
4866
|
if (cfb) {
|
|
4843
4867
|
const entry = CFB.find(cfb, path);
|
|
4844
|
-
return _optionalChain([entry, 'optionalAccess',
|
|
4868
|
+
return _optionalChain([entry, 'optionalAccess', _96 => _96.content]) ? Buffer.from(entry.content) : null;
|
|
4845
4869
|
}
|
|
4846
4870
|
return lenientCfb.findStream(path);
|
|
4847
4871
|
};
|
|
4848
4872
|
const headerData = findStream("/FileHeader");
|
|
4849
|
-
if (!headerData) throw new (0,
|
|
4873
|
+
if (!headerData) throw new (0, _chunkGZ7W64QUcjs.KordocError)("FileHeader \uC2A4\uD2B8\uB9BC \uC5C6\uC74C");
|
|
4850
4874
|
const header = parseFileHeader(headerData);
|
|
4851
|
-
if (header.signature !== "HWP Document File") throw new (0,
|
|
4852
|
-
if (header.flags & FLAG_ENCRYPTED) throw new (0,
|
|
4853
|
-
if (header.flags & FLAG_DRM) throw new (0,
|
|
4875
|
+
if (header.signature !== "HWP Document File") throw new (0, _chunkGZ7W64QUcjs.KordocError)("HWP \uC2DC\uADF8\uB2C8\uCC98 \uBD88\uC77C\uCE58");
|
|
4876
|
+
if (header.flags & FLAG_ENCRYPTED) throw new (0, _chunkGZ7W64QUcjs.KordocError)("\uC554\uD638\uD654\uB41C HWP\uB294 \uC9C0\uC6D0\uD558\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4");
|
|
4877
|
+
if (header.flags & FLAG_DRM) throw new (0, _chunkGZ7W64QUcjs.KordocError)("DRM \uBCF4\uD638\uB41C HWP\uB294 \uC9C0\uC6D0\uD558\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4");
|
|
4854
4878
|
const compressed = (header.flags & FLAG_COMPRESSED) !== 0;
|
|
4855
4879
|
const distribution = (header.flags & FLAG_DISTRIBUTION) !== 0;
|
|
4856
4880
|
const metadata = {
|
|
@@ -4859,13 +4883,13 @@ function parseHwp5Document(buffer, options) {
|
|
|
4859
4883
|
if (cfb) extractHwp5Metadata(cfb, metadata);
|
|
4860
4884
|
const docInfo = cfb ? parseDocInfoStream(cfb, compressed) : parseDocInfoFromStream(findStream("/DocInfo"), compressed);
|
|
4861
4885
|
const sections = distribution ? cfb ? findViewTextSections(cfb, compressed) : findViewTextSectionsLenient(lenientCfb, compressed) : cfb ? findSections(cfb) : findSectionsLenient(lenientCfb, compressed);
|
|
4862
|
-
if (sections.length === 0) throw new (0,
|
|
4886
|
+
if (sections.length === 0) throw new (0, _chunkGZ7W64QUcjs.KordocError)("\uC139\uC158 \uC2A4\uD2B8\uB9BC\uC744 \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4");
|
|
4863
4887
|
metadata.pageCount = sections.length;
|
|
4864
|
-
const pageFilter = _optionalChain([options, 'optionalAccess',
|
|
4888
|
+
const pageFilter = _optionalChain([options, 'optionalAccess', _97 => _97.pages]) ? _chunkDCZVOIEOcjs.parsePageRange.call(void 0, options.pages, sections.length) : null;
|
|
4865
4889
|
const totalTarget = pageFilter ? pageFilter.size : sections.length;
|
|
4866
4890
|
const bodyBlocks = [];
|
|
4867
4891
|
const doc = createHwp5DocState();
|
|
4868
|
-
doc.keepTrailingEmptyCols = _optionalChain([options, 'optionalAccess',
|
|
4892
|
+
doc.keepTrailingEmptyCols = _optionalChain([options, 'optionalAccess', _98 => _98.keepTrailingEmptyCols]);
|
|
4869
4893
|
let totalDecompressed = 0;
|
|
4870
4894
|
let parsedSections = 0;
|
|
4871
4895
|
for (let si = 0; si < sections.length; si++) {
|
|
@@ -4874,22 +4898,22 @@ function parseHwp5Document(buffer, options) {
|
|
|
4874
4898
|
const sectionData = sections[si];
|
|
4875
4899
|
const data = !distribution && compressed ? decompressStream(Buffer.from(sectionData)) : Buffer.from(sectionData);
|
|
4876
4900
|
totalDecompressed += data.length;
|
|
4877
|
-
if (totalDecompressed > MAX_TOTAL_DECOMPRESS) throw new (0,
|
|
4901
|
+
if (totalDecompressed > MAX_TOTAL_DECOMPRESS) throw new (0, _chunkGZ7W64QUcjs.KordocError)("\uCD1D \uC555\uCD95 \uD574\uC81C \uD06C\uAE30 \uCD08\uACFC (decompression bomb \uC758\uC2EC)");
|
|
4878
4902
|
const records = readRecords(data);
|
|
4879
4903
|
const sectionBlocks = parseSection(records, docInfo, warnings, si + 1, doc);
|
|
4880
4904
|
bodyBlocks.push(...sectionBlocks);
|
|
4881
4905
|
parsedSections++;
|
|
4882
|
-
_optionalChain([options, 'optionalAccess',
|
|
4906
|
+
_optionalChain([options, 'optionalAccess', _99 => _99.onProgress, 'optionalCall', _100 => _100(parsedSections, totalTarget)]);
|
|
4883
4907
|
} catch (secErr) {
|
|
4884
|
-
if (secErr instanceof
|
|
4908
|
+
if (secErr instanceof _chunkGZ7W64QUcjs.KordocError) throw secErr;
|
|
4885
4909
|
warnings.push({ page: si + 1, message: `\uC139\uC158 ${si + 1} \uD30C\uC2F1 \uC2E4\uD328: ${secErr instanceof Error ? secErr.message : "\uC54C \uC218 \uC5C6\uB294 \uC624\uB958"}`, code: "PARTIAL_PARSE" });
|
|
4886
4910
|
}
|
|
4887
4911
|
}
|
|
4888
4912
|
const blocks = [...doc.headerBlocks, ...bodyBlocks, ...doc.footerBlocks];
|
|
4889
4913
|
const images = cfb ? extractHwp5Images(cfb.FileIndex, blocks, warnings, !pageFilter) : extractHwp5ImagesLenient(lenientCfb, blocks, warnings, !pageFilter);
|
|
4890
|
-
let flatBlocks =
|
|
4891
|
-
if (_optionalChain([options, 'optionalAccess',
|
|
4892
|
-
const deduped =
|
|
4914
|
+
let flatBlocks = _chunk6GM2QLM3cjs.flattenLayoutTables.call(void 0, blocks);
|
|
4915
|
+
if (_optionalChain([options, 'optionalAccess', _101 => _101.dedupeRunningHeaders])) {
|
|
4916
|
+
const deduped = _chunk6GM2QLM3cjs.dedupeRunningHeaders.call(void 0, flatBlocks);
|
|
4893
4917
|
const removed = flatBlocks.length - deduped.length;
|
|
4894
4918
|
if (removed > 0) warnings.push({ message: `\uBC18\uBCF5 \uB7EC\uB2DD \uD5E4\uB354 ${removed}\uAC1C \uC81C\uAC70`, code: "HIDDEN_TEXT_FILTERED" });
|
|
4895
4919
|
flatBlocks = deduped;
|
|
@@ -4898,10 +4922,10 @@ function parseHwp5Document(buffer, options) {
|
|
|
4898
4922
|
detectHwp5Headings(flatBlocks, docInfo);
|
|
4899
4923
|
}
|
|
4900
4924
|
const outline = flatBlocks.filter((b) => b.type === "heading" && b.level && b.text).map((b) => ({ level: b.level, text: b.text, pageNumber: b.pageNumber }));
|
|
4901
|
-
let markdown =
|
|
4902
|
-
if (_optionalChain([options, 'optionalAccess',
|
|
4925
|
+
let markdown = _chunk6GM2QLM3cjs.blocksToMarkdown.call(void 0, flatBlocks);
|
|
4926
|
+
if (_optionalChain([options, 'optionalAccess', _102 => _102.inlineImages]) && images.length > 0) {
|
|
4903
4927
|
try {
|
|
4904
|
-
markdown =
|
|
4928
|
+
markdown = _chunk6GM2QLM3cjs.inlineImagesIntoMarkdown.call(void 0, markdown, images, { compress: true });
|
|
4905
4929
|
} catch (inlineErr) {
|
|
4906
4930
|
warnings.push({ message: `\uC774\uBBF8\uC9C0 \uC778\uB77C\uC778 \uC2E4\uD328 \u2014 \uC6D0\uBCF8 \uD30C\uC77C \uCC38\uC870\uB85C \uD3F4\uBC31: ${inlineErr instanceof Error ? inlineErr.message : "\uC54C \uC218 \uC5C6\uB294 \uC624\uB958"}`, code: "SKIPPED_IMAGE" });
|
|
4907
4931
|
}
|
|
@@ -4911,7 +4935,7 @@ function parseHwp5Document(buffer, options) {
|
|
|
4911
4935
|
function parseDocInfoStream(cfb, compressed) {
|
|
4912
4936
|
try {
|
|
4913
4937
|
const entry = CFB.find(cfb, "/DocInfo");
|
|
4914
|
-
if (!_optionalChain([entry, 'optionalAccess',
|
|
4938
|
+
if (!_optionalChain([entry, 'optionalAccess', _103 => _103.content])) return null;
|
|
4915
4939
|
const data = compressed ? decompressStream(Buffer.from(entry.content)) : Buffer.from(entry.content);
|
|
4916
4940
|
const records = readRecords(data);
|
|
4917
4941
|
return parseDocInfo(records);
|
|
@@ -4932,7 +4956,7 @@ function detectHwp5Headings(blocks, docInfo) {
|
|
|
4932
4956
|
let baseFontSize = 0;
|
|
4933
4957
|
const sizeFreq = /* @__PURE__ */ new Map();
|
|
4934
4958
|
for (const b of blocks) {
|
|
4935
|
-
if (_optionalChain([b, 'access',
|
|
4959
|
+
if (_optionalChain([b, 'access', _104 => _104.style, 'optionalAccess', _105 => _105.fontSize]) && b.text) {
|
|
4936
4960
|
sizeFreq.set(b.style.fontSize, (sizeFreq.get(b.style.fontSize) || 0) + b.text.length);
|
|
4937
4961
|
}
|
|
4938
4962
|
}
|
|
@@ -4948,7 +4972,7 @@ function detectHwp5Headings(blocks, docInfo) {
|
|
|
4948
4972
|
const name = (style.nameKo || style.name).toLowerCase();
|
|
4949
4973
|
if (name.includes("\uBC14\uD0D5") || name.includes("\uBCF8\uBB38") || name === "normal" || name === "body") {
|
|
4950
4974
|
const cs = docInfo.charShapes[style.charShapeId];
|
|
4951
|
-
if (_optionalChain([cs, 'optionalAccess',
|
|
4975
|
+
if (_optionalChain([cs, 'optionalAccess', _106 => _106.fontSize]) > 0) {
|
|
4952
4976
|
baseFontSize = cs.fontSize / 10;
|
|
4953
4977
|
break;
|
|
4954
4978
|
}
|
|
@@ -4963,11 +4987,11 @@ function detectHwp5Headings(blocks, docInfo) {
|
|
|
4963
4987
|
if (text.length === 0 || text.length > 200) continue;
|
|
4964
4988
|
if (/^\d+$/.test(text)) continue;
|
|
4965
4989
|
let level = 0;
|
|
4966
|
-
if (_optionalChain([block, 'access',
|
|
4990
|
+
if (_optionalChain([block, 'access', _107 => _107.style, 'optionalAccess', _108 => _108.fontSize]) && baseFontSize > 0) {
|
|
4967
4991
|
const ratio = block.style.fontSize / baseFontSize;
|
|
4968
|
-
if (ratio >=
|
|
4969
|
-
else if (ratio >=
|
|
4970
|
-
else if (ratio >=
|
|
4992
|
+
if (ratio >= _chunkGZ7W64QUcjs.HEADING_RATIO_H1) level = 1;
|
|
4993
|
+
else if (ratio >= _chunkGZ7W64QUcjs.HEADING_RATIO_H2) level = 2;
|
|
4994
|
+
else if (ratio >= _chunkGZ7W64QUcjs.HEADING_RATIO_H3) level = 3;
|
|
4971
4995
|
}
|
|
4972
4996
|
if (/^제\d+[장절편]\s/.test(text) && text.length <= 50) {
|
|
4973
4997
|
if (level === 0) level = 2;
|
|
@@ -4983,7 +5007,7 @@ function detectHwp5Headings(blocks, docInfo) {
|
|
|
4983
5007
|
function extractHwp5Metadata(cfb, metadata) {
|
|
4984
5008
|
try {
|
|
4985
5009
|
const summaryEntry = CFB.find(cfb, "/HwpSummaryInformation") || CFB.find(cfb, "/SummaryInformation");
|
|
4986
|
-
if (!_optionalChain([summaryEntry, 'optionalAccess',
|
|
5010
|
+
if (!_optionalChain([summaryEntry, 'optionalAccess', _109 => _109.content])) return;
|
|
4987
5011
|
const data = Buffer.from(summaryEntry.content);
|
|
4988
5012
|
if (data.length < 48) return;
|
|
4989
5013
|
const numSets = data.readUInt32LE(24);
|
|
@@ -5016,7 +5040,7 @@ function findViewTextSections(cfb, compressed) {
|
|
|
5016
5040
|
const sections = [];
|
|
5017
5041
|
for (let i = 0; i < MAX_SECTIONS; i++) {
|
|
5018
5042
|
const entry = CFB.find(cfb, `/ViewText/Section${i}`);
|
|
5019
|
-
if (!_optionalChain([entry, 'optionalAccess',
|
|
5043
|
+
if (!_optionalChain([entry, 'optionalAccess', _110 => _110.content])) break;
|
|
5020
5044
|
try {
|
|
5021
5045
|
const decrypted = decryptViewText(Buffer.from(entry.content), compressed);
|
|
5022
5046
|
sections.push({ idx: i, content: decrypted });
|
|
@@ -5030,13 +5054,13 @@ function findSections(cfb) {
|
|
|
5030
5054
|
const sections = [];
|
|
5031
5055
|
for (let i = 0; i < MAX_SECTIONS; i++) {
|
|
5032
5056
|
const entry = CFB.find(cfb, `/BodyText/Section${i}`);
|
|
5033
|
-
if (!_optionalChain([entry, 'optionalAccess',
|
|
5057
|
+
if (!_optionalChain([entry, 'optionalAccess', _111 => _111.content])) break;
|
|
5034
5058
|
sections.push({ idx: i, content: Buffer.from(entry.content) });
|
|
5035
5059
|
}
|
|
5036
5060
|
if (sections.length === 0 && cfb.FileIndex) {
|
|
5037
5061
|
for (const entry of cfb.FileIndex) {
|
|
5038
5062
|
if (sections.length >= MAX_SECTIONS) break;
|
|
5039
|
-
if (_optionalChain([entry, 'access',
|
|
5063
|
+
if (_optionalChain([entry, 'access', _112 => _112.name, 'optionalAccess', _113 => _113.startsWith, 'call', _114 => _114("Section")]) && entry.content) {
|
|
5040
5064
|
const idx = parseInt(entry.name.replace("Section", ""), 10) || 0;
|
|
5041
5065
|
sections.push({ idx, content: Buffer.from(entry.content) });
|
|
5042
5066
|
}
|
|
@@ -5052,7 +5076,7 @@ function findSectionsLenient(lcfb, compressed) {
|
|
|
5052
5076
|
if (!raw) break;
|
|
5053
5077
|
const content = compressed ? decompressStream(raw) : raw;
|
|
5054
5078
|
totalDecompressed += content.length;
|
|
5055
|
-
if (totalDecompressed > MAX_TOTAL_DECOMPRESS) throw new (0,
|
|
5079
|
+
if (totalDecompressed > MAX_TOTAL_DECOMPRESS) throw new (0, _chunkGZ7W64QUcjs.KordocError)("\uCD1D \uC555\uCD95 \uD574\uC81C \uD06C\uAE30 \uCD08\uACFC (decompression bomb \uC758\uC2EC)");
|
|
5056
5080
|
sections.push({ idx: i, content });
|
|
5057
5081
|
}
|
|
5058
5082
|
if (sections.length === 0) {
|
|
@@ -5064,7 +5088,7 @@ function findSectionsLenient(lcfb, compressed) {
|
|
|
5064
5088
|
if (raw) {
|
|
5065
5089
|
const content = compressed ? decompressStream(raw) : raw;
|
|
5066
5090
|
totalDecompressed += content.length;
|
|
5067
|
-
if (totalDecompressed > MAX_TOTAL_DECOMPRESS) throw new (0,
|
|
5091
|
+
if (totalDecompressed > MAX_TOTAL_DECOMPRESS) throw new (0, _chunkGZ7W64QUcjs.KordocError)("\uCD1D \uC555\uCD95 \uD574\uC81C \uD06C\uAE30 \uCD08\uACFC (decompression bomb \uC758\uC2EC)");
|
|
5068
5092
|
sections.push({ idx, content });
|
|
5069
5093
|
}
|
|
5070
5094
|
}
|
|
@@ -5081,7 +5105,7 @@ function findViewTextSectionsLenient(lcfb, compressed) {
|
|
|
5081
5105
|
try {
|
|
5082
5106
|
const content = decryptViewText(raw, compressed);
|
|
5083
5107
|
totalDecompressed += content.length;
|
|
5084
|
-
if (totalDecompressed > MAX_TOTAL_DECOMPRESS) throw new (0,
|
|
5108
|
+
if (totalDecompressed > MAX_TOTAL_DECOMPRESS) throw new (0, _chunkGZ7W64QUcjs.KordocError)("\uCD1D \uC555\uCD95 \uD574\uC81C \uD06C\uAE30 \uCD08\uACFC (decompression bomb \uC758\uC2EC)");
|
|
5085
5109
|
sections.push({ idx: i, content });
|
|
5086
5110
|
} catch (e27) {
|
|
5087
5111
|
break;
|
|
@@ -5182,9 +5206,9 @@ function parseParagraph(records, start, end, ctx) {
|
|
|
5182
5206
|
const applied = [];
|
|
5183
5207
|
for (const r of ranges) {
|
|
5184
5208
|
const ctrl = ctrls[r.ctrlIdx];
|
|
5185
|
-
if (!_optionalChain([ctrl, 'optionalAccess',
|
|
5209
|
+
if (!_optionalChain([ctrl, 'optionalAccess', _115 => _115.href]) || r.end <= r.start) continue;
|
|
5186
5210
|
if (applied.some(([s, e]) => r.start < e && r.end > s)) continue;
|
|
5187
|
-
const href =
|
|
5211
|
+
const href = _chunkGZ7W64QUcjs.sanitizeHref.call(void 0, ctrl.href);
|
|
5188
5212
|
if (!href) continue;
|
|
5189
5213
|
const anchor = text.slice(r.start, r.end);
|
|
5190
5214
|
if (!anchor.trim()) continue;
|
|
@@ -5202,7 +5226,7 @@ function parseParagraph(records, start, end, ctx) {
|
|
|
5202
5226
|
}
|
|
5203
5227
|
if (ps.headType === 1 || ps.headType === 2) {
|
|
5204
5228
|
const nid = ps.numberingId || (ps.headType === 1 ? ctx.doc.outlineNumberingId : 0);
|
|
5205
|
-
const numbering = nid >= 1 ? _optionalChain([ctx, 'access',
|
|
5229
|
+
const numbering = nid >= 1 ? _optionalChain([ctx, 'access', _116 => _116.docInfo, 'optionalAccess', _117 => _117.numberings, 'access', _118 => _118[nid - 1]]) : void 0;
|
|
5206
5230
|
if (numbering) {
|
|
5207
5231
|
const counters = ctx.doc.numbering.advance(nid, ps.paraLevel);
|
|
5208
5232
|
const fmt = numbering.levelFormats[Math.min(ps.paraLevel, 6)];
|
|
@@ -5212,7 +5236,7 @@ function parseParagraph(records, start, end, ctx) {
|
|
|
5212
5236
|
}
|
|
5213
5237
|
}
|
|
5214
5238
|
} else if (ps.headType === 3) {
|
|
5215
|
-
const bullet = ps.numberingId >= 1 ? _optionalChain([ctx, 'access',
|
|
5239
|
+
const bullet = ps.numberingId >= 1 ? _optionalChain([ctx, 'access', _119 => _119.docInfo, 'optionalAccess', _120 => _120.bullets, 'access', _121 => _121[ps.numberingId - 1]]) : void 0;
|
|
5216
5240
|
if (bullet && bullet.char !== "\uFFFF") headMarker = bullet.char;
|
|
5217
5241
|
}
|
|
5218
5242
|
}
|
|
@@ -5420,8 +5444,8 @@ function parseTableControl(ctrl, records, ctx) {
|
|
|
5420
5444
|
let tableIdx = -1;
|
|
5421
5445
|
for (let i2 = childStart; i2 < childEnd; i2++) {
|
|
5422
5446
|
if (records[i2].tagId === TAG_TABLE && records[i2].data.length >= 8) {
|
|
5423
|
-
rows = Math.min(records[i2].data.readUInt16LE(4),
|
|
5424
|
-
cols = Math.min(records[i2].data.readUInt16LE(6),
|
|
5447
|
+
rows = Math.min(records[i2].data.readUInt16LE(4), _chunk6GM2QLM3cjs.MAX_ROWS);
|
|
5448
|
+
cols = Math.min(records[i2].data.readUInt16LE(6), _chunk6GM2QLM3cjs.MAX_COLS);
|
|
5425
5449
|
tableIdx = i2;
|
|
5426
5450
|
break;
|
|
5427
5451
|
}
|
|
@@ -5461,7 +5485,7 @@ function parseTableControl(ctrl, records, ctx) {
|
|
|
5461
5485
|
const cellRows2 = arrangeCells(rows, cols, cells);
|
|
5462
5486
|
const irCells = cellRows2.map((row) => row.map((c) => {
|
|
5463
5487
|
const ir = { text: c.text.trim(), colSpan: c.colSpan, rowSpan: c.rowSpan };
|
|
5464
|
-
if (_optionalChain([c, 'access',
|
|
5488
|
+
if (_optionalChain([c, 'access', _122 => _122.blocks, 'optionalAccess', _123 => _123.length])) ir.blocks = c.blocks;
|
|
5465
5489
|
if (c.isHeader) ir.isHeader = true;
|
|
5466
5490
|
return ir;
|
|
5467
5491
|
}));
|
|
@@ -5470,7 +5494,7 @@ function parseTableControl(ctrl, records, ctx) {
|
|
|
5470
5494
|
return table3;
|
|
5471
5495
|
}
|
|
5472
5496
|
const cellRows = arrangeCells(rows, cols, cells);
|
|
5473
|
-
const table2 =
|
|
5497
|
+
const table2 = _chunk6GM2QLM3cjs.buildTable.call(void 0, cellRows, { keepAnchoredEmptyCols: ctx.doc.keepTrailingEmptyCols });
|
|
5474
5498
|
if (caption && table2.rows > 0) table2.caption = caption;
|
|
5475
5499
|
return table2.rows > 0 ? table2 : null;
|
|
5476
5500
|
}
|
|
@@ -5487,8 +5511,8 @@ function parseCell(records, lhIdx, end, ctx) {
|
|
|
5487
5511
|
rowAddr = rec.data.readUInt16LE(10);
|
|
5488
5512
|
const cs = rec.data.readUInt16LE(12);
|
|
5489
5513
|
const rs = rec.data.readUInt16LE(14);
|
|
5490
|
-
if (cs > 0) colSpan = Math.min(cs,
|
|
5491
|
-
if (rs > 0) rowSpan = Math.min(rs,
|
|
5514
|
+
if (cs > 0) colSpan = Math.min(cs, _chunk6GM2QLM3cjs.MAX_COLS);
|
|
5515
|
+
if (rs > 0) rowSpan = Math.min(rs, _chunk6GM2QLM3cjs.MAX_ROWS);
|
|
5492
5516
|
}
|
|
5493
5517
|
const blocks = ctx.depth < MAX_NEST_DEPTH ? parseParagraphList(records, lhIdx + 1, end, { ...ctx, depth: ctx.depth + 1 }) : [];
|
|
5494
5518
|
const parts = [];
|
|
@@ -5498,7 +5522,7 @@ function parseCell(records, lhIdx, end, ctx) {
|
|
|
5498
5522
|
parts.push(``);
|
|
5499
5523
|
hasStructure = true;
|
|
5500
5524
|
} else if (b.type === "table" && b.table) {
|
|
5501
|
-
const flat =
|
|
5525
|
+
const flat = _chunk6GM2QLM3cjs.convertTableToText.call(void 0, b.table.cells);
|
|
5502
5526
|
if (flat) parts.push(flat);
|
|
5503
5527
|
hasStructure = true;
|
|
5504
5528
|
} else if (b.text) {
|
|
@@ -5595,8 +5619,8 @@ function pictureToImageBlock(data, ctx) {
|
|
|
5595
5619
|
if (data.length < 73) return null;
|
|
5596
5620
|
const binDataId = data.readUInt16LE(71);
|
|
5597
5621
|
if (binDataId === 0) return null;
|
|
5598
|
-
const item = _optionalChain([ctx, 'access',
|
|
5599
|
-
if (_optionalChain([item, 'optionalAccess',
|
|
5622
|
+
const item = _optionalChain([ctx, 'access', _124 => _124.docInfo, 'optionalAccess', _125 => _125.binData, 'access', _126 => _126[binDataId - 1]]);
|
|
5623
|
+
if (_optionalChain([item, 'optionalAccess', _127 => _127.kind]) === "link") {
|
|
5600
5624
|
ctx.warnings.push({ page: ctx.sectionNum, message: `\uC678\uBD80 \uC5F0\uACB0 \uC774\uBBF8\uC9C0 (binDataId ${binDataId})`, code: "SKIPPED_IMAGE" });
|
|
5601
5625
|
return null;
|
|
5602
5626
|
}
|
|
@@ -17547,9 +17571,8 @@ function decodeJohab(ch) {
|
|
|
17547
17571
|
const jongIdx = ch & 31;
|
|
17548
17572
|
const cho = CHO_MAP[choIdx];
|
|
17549
17573
|
const jung = JUNG_MAP[jungIdx];
|
|
17550
|
-
|
|
17551
|
-
if (cho !== -1 && jung !== -1) {
|
|
17552
|
-
if (jong === -1) jong = 0;
|
|
17574
|
+
const jong = JONG_MAP[jongIdx];
|
|
17575
|
+
if (cho !== -1 && jung !== -1 && jong !== -1) {
|
|
17553
17576
|
return 44032 + cho * 588 + jung * 28 + jong;
|
|
17554
17577
|
}
|
|
17555
17578
|
const hit = lookupSymbol(ch);
|
|
@@ -17718,8 +17741,6 @@ var LINE_INFO_SIZE = 14;
|
|
|
17718
17741
|
var INLINE_CHAR_SHAPE_SIZE = 31;
|
|
17719
17742
|
var SIMPLE_CTRL = /* @__PURE__ */ new Map([
|
|
17720
17743
|
[9, { extraBytes: 6, extraHchar: 3, emit: " " }],
|
|
17721
|
-
[7, { extraBytes: 6, extraHchar: 3, emit: "\uFFFC" }],
|
|
17722
|
-
[8, { extraBytes: 6, extraHchar: 3, emit: "\uFFFC" }],
|
|
17723
17744
|
[18, { extraBytes: 6, extraHchar: 3, emit: " " }],
|
|
17724
17745
|
// AutoNumber → 공백 (HWP5 패턴)
|
|
17725
17746
|
[19, { extraBytes: 6, extraHchar: 3, emit: "\uFFFC" }],
|
|
@@ -17728,7 +17749,8 @@ var SIMPLE_CTRL = /* @__PURE__ */ new Map([
|
|
|
17728
17749
|
[22, { extraBytes: 22, extraHchar: 11, emit: "\uFFFC" }],
|
|
17729
17750
|
[23, { extraBytes: 8, extraHchar: 4, emit: "\uFFFC" }],
|
|
17730
17751
|
[24, { extraBytes: 4, extraHchar: 2, emit: "-" }],
|
|
17731
|
-
[25, { extraBytes: 4, extraHchar: 2, emit:
|
|
17752
|
+
[25, { extraBytes: 4, extraHchar: 2, emit: null }],
|
|
17753
|
+
// 차례 표식 — 비가시 (rhwp #2765)
|
|
17732
17754
|
[26, { extraBytes: 244, extraHchar: 122, emit: "\uFFFC" }],
|
|
17733
17755
|
[28, { extraBytes: 62, extraHchar: 31, emit: "\uFFFC" }],
|
|
17734
17756
|
[30, { extraBytes: 2, extraHchar: 1, emit: "\xA0" }],
|
|
@@ -17750,7 +17772,7 @@ function parseHwp3Document(buffer, _options) {
|
|
|
17750
17772
|
try {
|
|
17751
17773
|
body = _zlib.inflateRawSync.call(void 0, tail, { maxOutputLength: MAX_DECOMPRESS_SIZE3 });
|
|
17752
17774
|
} catch (err) {
|
|
17753
|
-
if (_optionalChain([err, 'optionalAccess',
|
|
17775
|
+
if (_optionalChain([err, 'optionalAccess', _128 => _128.code]) === "ERR_BUFFER_TOO_LARGE") {
|
|
17754
17776
|
throw new Error(`HWP3 \uC555\uCD95 \uD574\uC81C \uACB0\uACFC\uAC00 \uCD5C\uB300 \uD5C8\uC6A9 \uD06C\uAE30(${MAX_DECOMPRESS_SIZE3 / 1024 / 1024}MB)\uB97C \uCD08\uACFC\uD588\uC2B5\uB2C8\uB2E4`);
|
|
17755
17777
|
}
|
|
17756
17778
|
const msg2 = err instanceof Error ? err.message : String(err);
|
|
@@ -17872,9 +17894,6 @@ function parseCharStream(reader, charCount, ctx) {
|
|
|
17872
17894
|
case 11:
|
|
17873
17895
|
parsePicture(reader, ctx);
|
|
17874
17896
|
break;
|
|
17875
|
-
case 12:
|
|
17876
|
-
reader.skip(84);
|
|
17877
|
-
break;
|
|
17878
17897
|
case 14:
|
|
17879
17898
|
reader.skip(84);
|
|
17880
17899
|
break;
|
|
@@ -17899,6 +17918,12 @@ function parseCharStream(reader, charCount, ctx) {
|
|
|
17899
17918
|
case 6:
|
|
17900
17919
|
reader.skip(34);
|
|
17901
17920
|
break;
|
|
17921
|
+
case 7:
|
|
17922
|
+
reader.skip(76);
|
|
17923
|
+
break;
|
|
17924
|
+
case 8:
|
|
17925
|
+
reader.skip(88);
|
|
17926
|
+
break;
|
|
17902
17927
|
case 29:
|
|
17903
17928
|
if (headerVal1 < 1e6) reader.skip(headerVal1);
|
|
17904
17929
|
break;
|
|
@@ -17985,15 +18010,15 @@ function getElements(parent, tagName) {
|
|
|
17985
18010
|
const result = [];
|
|
17986
18011
|
for (let i = 0; i < nodes.length; i++) result.push(nodes[i]);
|
|
17987
18012
|
if (result.length > 0) return result;
|
|
17988
|
-
const nsNodes = _optionalChain([parent, 'access',
|
|
18013
|
+
const nsNodes = _optionalChain([parent, 'access', _129 => _129.getElementsByTagNameNS, 'optionalCall', _130 => _130("*", tagName)]);
|
|
17989
18014
|
if (nsNodes) for (let i = 0; i < nsNodes.length; i++) result.push(nsNodes[i]);
|
|
17990
18015
|
return result;
|
|
17991
18016
|
}
|
|
17992
18017
|
function getTextContent(el) {
|
|
17993
|
-
return _nullishCoalesce(_optionalChain([el, 'access',
|
|
18018
|
+
return _nullishCoalesce(_optionalChain([el, 'access', _131 => _131.textContent, 'optionalAccess', _132 => _132.trim, 'call', _133 => _133()]), () => ( ""));
|
|
17994
18019
|
}
|
|
17995
18020
|
function parseXml(text) {
|
|
17996
|
-
return new (0, _xmldom.DOMParser)().parseFromString(
|
|
18021
|
+
return new (0, _xmldom.DOMParser)().parseFromString(_chunkGZ7W64QUcjs.stripDtd.call(void 0, text), "text/xml");
|
|
17997
18022
|
}
|
|
17998
18023
|
function collectRichText(root) {
|
|
17999
18024
|
let out = "";
|
|
@@ -18002,7 +18027,7 @@ function collectRichText(root) {
|
|
|
18002
18027
|
for (let i = 0; i < children.length; i++) {
|
|
18003
18028
|
if (children[i].nodeType !== 1) continue;
|
|
18004
18029
|
const el = children[i];
|
|
18005
|
-
const local = el.localName || _optionalChain([el, 'access',
|
|
18030
|
+
const local = el.localName || _optionalChain([el, 'access', _134 => _134.tagName, 'optionalAccess', _135 => _135.replace, 'call', _136 => _136(/^[^:]+:/, "")]) || "";
|
|
18006
18031
|
if (local === "rPh") continue;
|
|
18007
18032
|
if (local === "t") out += _nullishCoalesce(el.textContent, () => ( ""));
|
|
18008
18033
|
else walk(el);
|
|
@@ -18221,14 +18246,14 @@ function sheetToBlocks(sheetName, grid, merges, maxRow, maxCol, sheetIndex, keep
|
|
|
18221
18246
|
const merge = mergeMap.get(key);
|
|
18222
18247
|
row.push({
|
|
18223
18248
|
text,
|
|
18224
|
-
colSpan: _nullishCoalesce(_optionalChain([merge, 'optionalAccess',
|
|
18225
|
-
rowSpan: _nullishCoalesce(_optionalChain([merge, 'optionalAccess',
|
|
18249
|
+
colSpan: _nullishCoalesce(_optionalChain([merge, 'optionalAccess', _137 => _137.colSpan]), () => ( 1)),
|
|
18250
|
+
rowSpan: _nullishCoalesce(_optionalChain([merge, 'optionalAccess', _138 => _138.rowSpan]), () => ( 1))
|
|
18226
18251
|
});
|
|
18227
18252
|
}
|
|
18228
18253
|
cellRows.push(row);
|
|
18229
18254
|
}
|
|
18230
18255
|
if (cellRows.length > 0) {
|
|
18231
|
-
const table2 =
|
|
18256
|
+
const table2 = _chunk6GM2QLM3cjs.buildTable.call(void 0, cellRows, { keepAnchoredEmptyCols });
|
|
18232
18257
|
if (table2.rows > 0) {
|
|
18233
18258
|
blocks.push({ type: "table", table: table2, pageNumber: sheetIndex + 1 });
|
|
18234
18259
|
}
|
|
@@ -18236,12 +18261,12 @@ function sheetToBlocks(sheetName, grid, merges, maxRow, maxCol, sheetIndex, keep
|
|
|
18236
18261
|
return blocks;
|
|
18237
18262
|
}
|
|
18238
18263
|
async function parseXlsxDocument(buffer, options) {
|
|
18239
|
-
|
|
18264
|
+
_chunkGZ7W64QUcjs.precheckZipSize.call(void 0, buffer, MAX_DECOMPRESS_SIZE4);
|
|
18240
18265
|
const zip = await _jszip2.default.loadAsync(buffer);
|
|
18241
18266
|
const warnings = [];
|
|
18242
18267
|
const workbookFile = zip.file("xl/workbook.xml");
|
|
18243
18268
|
if (!workbookFile) {
|
|
18244
|
-
throw new (0,
|
|
18269
|
+
throw new (0, _chunkGZ7W64QUcjs.KordocError)("\uC720\uD6A8\uD558\uC9C0 \uC54A\uC740 XLSX \uD30C\uC77C: xl/workbook.xml\uC774 \uC5C6\uC2B5\uB2C8\uB2E4");
|
|
18245
18270
|
}
|
|
18246
18271
|
let sharedStrings = [];
|
|
18247
18272
|
const ssFile = zip.file("xl/sharedStrings.xml");
|
|
@@ -18250,7 +18275,7 @@ async function parseXlsxDocument(buffer, options) {
|
|
|
18250
18275
|
}
|
|
18251
18276
|
const { sheets, date1904 } = parseWorkbook(await workbookFile.async("text"));
|
|
18252
18277
|
if (sheets.length === 0) {
|
|
18253
|
-
throw new (0,
|
|
18278
|
+
throw new (0, _chunkGZ7W64QUcjs.KordocError)("XLSX \uD30C\uC77C\uC5D0 \uC2DC\uD2B8\uAC00 \uC5C6\uC2B5\uB2C8\uB2E4");
|
|
18254
18279
|
}
|
|
18255
18280
|
let dateXfs = /* @__PURE__ */ new Map();
|
|
18256
18281
|
const stylesFile = zip.file("xl/styles.xml");
|
|
@@ -18266,7 +18291,7 @@ async function parseXlsxDocument(buffer, options) {
|
|
|
18266
18291
|
relsMap = parseRels(await relsFile.async("text"));
|
|
18267
18292
|
}
|
|
18268
18293
|
let pageFilter = null;
|
|
18269
|
-
if (_optionalChain([options, 'optionalAccess',
|
|
18294
|
+
if (_optionalChain([options, 'optionalAccess', _139 => _139.pages])) {
|
|
18270
18295
|
const { parsePageRange: parsePageRange2 } = await Promise.resolve().then(() => _interopRequireWildcard(require("./page-range-P7SDW6LR.cjs")));
|
|
18271
18296
|
pageFilter = parsePageRange2(options.pages, sheets.length);
|
|
18272
18297
|
}
|
|
@@ -18275,7 +18300,7 @@ async function parseXlsxDocument(buffer, options) {
|
|
|
18275
18300
|
for (let i = 0; i < processedSheets; i++) {
|
|
18276
18301
|
if (pageFilter && !pageFilter.has(i + 1)) continue;
|
|
18277
18302
|
const sheet = sheets[i];
|
|
18278
|
-
_optionalChain([options, 'optionalAccess',
|
|
18303
|
+
_optionalChain([options, 'optionalAccess', _140 => _140.onProgress, 'optionalCall', _141 => _141(i + 1, processedSheets)]);
|
|
18279
18304
|
let sheetPath = relsMap.get(sheet.rId);
|
|
18280
18305
|
if (sheetPath) {
|
|
18281
18306
|
if (!sheetPath.startsWith("xl/") && !sheetPath.startsWith("/")) {
|
|
@@ -18298,7 +18323,7 @@ async function parseXlsxDocument(buffer, options) {
|
|
|
18298
18323
|
try {
|
|
18299
18324
|
const sheetXml = await sheetFile.async("text");
|
|
18300
18325
|
const { grid, merges, maxRow, maxCol } = parseWorksheet(sheetXml, sharedStrings, dateXfs, date1904);
|
|
18301
|
-
const sheetBlocks = sheetToBlocks(sheet.name, grid, merges, maxRow, maxCol, i, _optionalChain([options, 'optionalAccess',
|
|
18326
|
+
const sheetBlocks = sheetToBlocks(sheet.name, grid, merges, maxRow, maxCol, i, _optionalChain([options, 'optionalAccess', _142 => _142.keepTrailingEmptyCols]));
|
|
18302
18327
|
blocks.push(...sheetBlocks);
|
|
18303
18328
|
} catch (err) {
|
|
18304
18329
|
warnings.push({
|
|
@@ -18330,7 +18355,7 @@ async function parseXlsxDocument(buffer, options) {
|
|
|
18330
18355
|
} catch (e29) {
|
|
18331
18356
|
}
|
|
18332
18357
|
}
|
|
18333
|
-
const markdown =
|
|
18358
|
+
const markdown = _chunk6GM2QLM3cjs.blocksToMarkdown.call(void 0, blocks);
|
|
18334
18359
|
return { markdown, blocks, metadata, warnings: warnings.length > 0 ? warnings : void 0 };
|
|
18335
18360
|
}
|
|
18336
18361
|
|
|
@@ -18781,11 +18806,11 @@ function processGlobals(records) {
|
|
|
18781
18806
|
const xfFmtIds = [];
|
|
18782
18807
|
const firstBof = records[0];
|
|
18783
18808
|
if (!firstBof || firstBof.opcode !== OP_BOF) {
|
|
18784
|
-
throw new (0,
|
|
18809
|
+
throw new (0, _chunkGZ7W64QUcjs.KordocError)("XLS: \uCCAB \uB808\uCF54\uB4DC\uAC00 BOF\uAC00 \uC544\uB2D8");
|
|
18785
18810
|
}
|
|
18786
18811
|
const bof = decodeBof(firstBof.data);
|
|
18787
18812
|
if (!bof || bof.dt !== DT_GLOBALS) {
|
|
18788
|
-
throw new (0,
|
|
18813
|
+
throw new (0, _chunkGZ7W64QUcjs.KordocError)("XLS: Globals \uC11C\uBE0C\uC2A4\uD2B8\uB9BC BOF \uB204\uB77D");
|
|
18789
18814
|
}
|
|
18790
18815
|
let i = 1;
|
|
18791
18816
|
while (i < records.length) {
|
|
@@ -18913,14 +18938,14 @@ function sheetToBlocks2(sheetName, sheet, sheetIndex, keepAnchoredEmptyCols) {
|
|
|
18913
18938
|
const merge = mergeMap.get(key);
|
|
18914
18939
|
row.push({
|
|
18915
18940
|
text: grid[r][c],
|
|
18916
|
-
colSpan: _nullishCoalesce(_optionalChain([merge, 'optionalAccess',
|
|
18917
|
-
rowSpan: _nullishCoalesce(_optionalChain([merge, 'optionalAccess',
|
|
18941
|
+
colSpan: _nullishCoalesce(_optionalChain([merge, 'optionalAccess', _143 => _143.colSpan]), () => ( 1)),
|
|
18942
|
+
rowSpan: _nullishCoalesce(_optionalChain([merge, 'optionalAccess', _144 => _144.rowSpan]), () => ( 1))
|
|
18918
18943
|
});
|
|
18919
18944
|
}
|
|
18920
18945
|
cellRows.push(row);
|
|
18921
18946
|
}
|
|
18922
18947
|
if (cellRows.length > 0) {
|
|
18923
|
-
const table2 =
|
|
18948
|
+
const table2 = _chunk6GM2QLM3cjs.buildTable.call(void 0, cellRows, { keepAnchoredEmptyCols });
|
|
18924
18949
|
if (table2.rows > 0) {
|
|
18925
18950
|
blocks.push({ type: "table", table: table2, pageNumber: sheetIndex + 1 });
|
|
18926
18951
|
}
|
|
@@ -18933,21 +18958,21 @@ async function parseXlsDocument(buffer, options) {
|
|
|
18933
18958
|
try {
|
|
18934
18959
|
cfb = parseLenientCfb(buf);
|
|
18935
18960
|
} catch (e) {
|
|
18936
|
-
throw new (0,
|
|
18961
|
+
throw new (0, _chunkGZ7W64QUcjs.KordocError)(
|
|
18937
18962
|
`XLS: OLE2 \uC2DC\uADF8\uB2C8\uCC98 \uAC80\uC99D \uC2E4\uD328 \u2014 ${e instanceof Error ? e.message : "\uC54C \uC218 \uC5C6\uB294 \uC624\uB958"}`
|
|
18938
18963
|
);
|
|
18939
18964
|
}
|
|
18940
18965
|
const wb = _nullishCoalesce(cfb.findStream("/Workbook"), () => ( cfb.findStream("/Book")));
|
|
18941
18966
|
if (!wb) {
|
|
18942
|
-
throw new (0,
|
|
18967
|
+
throw new (0, _chunkGZ7W64QUcjs.KordocError)("XLS: Workbook \uC2A4\uD2B8\uB9BC\uC774 \uC5C6\uC74C (BIFF5 \uB610\uB294 \uBE44\uD45C\uC900 \uD30C\uC77C)");
|
|
18943
18968
|
}
|
|
18944
18969
|
const records = readRecords2(wb);
|
|
18945
18970
|
if (records.length === 0) {
|
|
18946
|
-
throw new (0,
|
|
18971
|
+
throw new (0, _chunkGZ7W64QUcjs.KordocError)("XLS: \uC2DC\uADF8\uB2C8\uCC98 \uB808\uCF54\uB4DC\uAC00 \uC5C6\uC74C (Workbook \uC2A4\uD2B8\uB9BC \uC190\uC0C1)");
|
|
18947
18972
|
}
|
|
18948
18973
|
const firstBof = decodeBof(records[0].data);
|
|
18949
18974
|
if (firstBof && firstBof.vers !== 1536) {
|
|
18950
|
-
throw new (0,
|
|
18975
|
+
throw new (0, _chunkGZ7W64QUcjs.KordocError)(
|
|
18951
18976
|
`XLS: BIFF8(0x0600)\uB9CC \uC9C0\uC6D0 \u2014 \uBCF8 \uD30C\uC77C\uC740 0x${firstBof.vers.toString(16)}`
|
|
18952
18977
|
);
|
|
18953
18978
|
}
|
|
@@ -18976,7 +19001,7 @@ async function parseXlsDocument(buffer, options) {
|
|
|
18976
19001
|
} : void 0;
|
|
18977
19002
|
const totalSheets = Math.min(globals.sheets.length, MAX_SHEETS2);
|
|
18978
19003
|
let pageFilter = null;
|
|
18979
|
-
if (_optionalChain([options, 'optionalAccess',
|
|
19004
|
+
if (_optionalChain([options, 'optionalAccess', _145 => _145.pages])) {
|
|
18980
19005
|
const { parsePageRange: parsePageRange2 } = await Promise.resolve().then(() => _interopRequireWildcard(require("./page-range-P7SDW6LR.cjs")));
|
|
18981
19006
|
pageFilter = parsePageRange2(options.pages, totalSheets);
|
|
18982
19007
|
}
|
|
@@ -18985,7 +19010,7 @@ async function parseXlsDocument(buffer, options) {
|
|
|
18985
19010
|
if (pageFilter && !pageFilter.has(i + 1)) continue;
|
|
18986
19011
|
const meta = globals.sheets[i];
|
|
18987
19012
|
if (meta.dt !== 0) continue;
|
|
18988
|
-
_optionalChain([options, 'optionalAccess',
|
|
19013
|
+
_optionalChain([options, 'optionalAccess', _146 => _146.onProgress, 'optionalCall', _147 => _147(i + 1, totalSheets)]);
|
|
18989
19014
|
const bofIdx = findSheetBofIndex(records, meta.lbPlyPos);
|
|
18990
19015
|
if (bofIdx < 0) {
|
|
18991
19016
|
warnings.push({
|
|
@@ -19001,7 +19026,7 @@ async function parseXlsDocument(buffer, options) {
|
|
|
19001
19026
|
}
|
|
19002
19027
|
try {
|
|
19003
19028
|
const { sheet } = extractSheetCells(records, bofIdx, globals.sst, convertNum);
|
|
19004
|
-
const blocks = sheetToBlocks2(meta.name, sheet, i, _optionalChain([options, 'optionalAccess',
|
|
19029
|
+
const blocks = sheetToBlocks2(meta.name, sheet, i, _optionalChain([options, 'optionalAccess', _148 => _148.keepTrailingEmptyCols]));
|
|
19005
19030
|
allBlocks.push(...blocks);
|
|
19006
19031
|
} catch (e) {
|
|
19007
19032
|
warnings.push({
|
|
@@ -19015,7 +19040,7 @@ async function parseXlsDocument(buffer, options) {
|
|
|
19015
19040
|
pageCount: totalSheets
|
|
19016
19041
|
};
|
|
19017
19042
|
return {
|
|
19018
|
-
markdown:
|
|
19043
|
+
markdown: _chunk6GM2QLM3cjs.blocksToMarkdown.call(void 0, allBlocks),
|
|
19019
19044
|
blocks: allBlocks,
|
|
19020
19045
|
metadata,
|
|
19021
19046
|
warnings: warnings.length > 0 ? warnings : void 0
|
|
@@ -19028,7 +19053,7 @@ async function parseXlsDocument(buffer, options) {
|
|
|
19028
19053
|
|
|
19029
19054
|
// src/docx/equation.ts
|
|
19030
19055
|
function lname(el) {
|
|
19031
|
-
return el.localName || _optionalChain([el, 'access',
|
|
19056
|
+
return el.localName || _optionalChain([el, 'access', _149 => _149.tagName, 'optionalAccess', _150 => _150.replace, 'call', _151 => _151(/^[^:]+:/, "")]) || "";
|
|
19032
19057
|
}
|
|
19033
19058
|
function kids(parent, name) {
|
|
19034
19059
|
const out = [];
|
|
@@ -19417,7 +19442,7 @@ function isDisplayMath(el) {
|
|
|
19417
19442
|
// src/docx/parser.ts
|
|
19418
19443
|
var MAX_DECOMPRESS_SIZE5 = 100 * 1024 * 1024;
|
|
19419
19444
|
function matchesLocal(el, localName2) {
|
|
19420
|
-
return el.localName === localName2 || (_nullishCoalesce(_optionalChain([el, 'access',
|
|
19445
|
+
return el.localName === localName2 || (_nullishCoalesce(_optionalChain([el, 'access', _152 => _152.tagName, 'optionalAccess', _153 => _153.endsWith, 'call', _154 => _154(`:${localName2}`)]), () => ( false)));
|
|
19421
19446
|
}
|
|
19422
19447
|
function effectiveChildElements(parent) {
|
|
19423
19448
|
const result = [];
|
|
@@ -19452,7 +19477,7 @@ function findElements(parent, localName2) {
|
|
|
19452
19477
|
const child = children[i];
|
|
19453
19478
|
if (child.nodeType === 1) {
|
|
19454
19479
|
const el = child;
|
|
19455
|
-
if (el.localName === localName2 || _optionalChain([el, 'access',
|
|
19480
|
+
if (el.localName === localName2 || _optionalChain([el, 'access', _155 => _155.tagName, 'optionalAccess', _156 => _156.endsWith, 'call', _157 => _157(`:${localName2}`)])) {
|
|
19456
19481
|
result.push(el);
|
|
19457
19482
|
}
|
|
19458
19483
|
walk(el);
|
|
@@ -19471,7 +19496,7 @@ function getAttr(el, localName2) {
|
|
|
19471
19496
|
return null;
|
|
19472
19497
|
}
|
|
19473
19498
|
function parseXml2(text) {
|
|
19474
|
-
return new (0, _xmldom.DOMParser)().parseFromString(
|
|
19499
|
+
return new (0, _xmldom.DOMParser)().parseFromString(_chunkGZ7W64QUcjs.stripDtd.call(void 0, text), "text/xml");
|
|
19475
19500
|
}
|
|
19476
19501
|
function parseStyles(xml) {
|
|
19477
19502
|
const doc = parseXml2(xml);
|
|
@@ -19588,7 +19613,7 @@ function collectOmmlRoots(p) {
|
|
|
19588
19613
|
const child = children[i];
|
|
19589
19614
|
if (child.nodeType !== 1) continue;
|
|
19590
19615
|
const el = child;
|
|
19591
|
-
const tag = el.localName || _optionalChain([el, 'access',
|
|
19616
|
+
const tag = el.localName || _optionalChain([el, 'access', _158 => _158.tagName, 'optionalAccess', _159 => _159.replace, 'call', _160 => _160(/^[^:]+:/, "")]) || "";
|
|
19592
19617
|
if (tag === "oMath" || tag === "oMathPara") {
|
|
19593
19618
|
out.push(el);
|
|
19594
19619
|
} else if (tag === "txbxContent" || tag === "Fallback") {
|
|
@@ -19629,7 +19654,7 @@ function fieldUrlFromInstr(instr) {
|
|
|
19629
19654
|
function makeLink(text, rawHref) {
|
|
19630
19655
|
if (!text) return "";
|
|
19631
19656
|
if (!rawHref) return text;
|
|
19632
|
-
const href =
|
|
19657
|
+
const href = _chunkGZ7W64QUcjs.sanitizeHref.call(void 0, rawHref);
|
|
19633
19658
|
return href ? `[${text}](${href})` : text;
|
|
19634
19659
|
}
|
|
19635
19660
|
function collectInline(p, footnotes, rels) {
|
|
@@ -19731,7 +19756,7 @@ function parseParagraph2(p, styles, numbering, footnotes, rels) {
|
|
|
19731
19756
|
const { text, bold: hasBold, italic: hasItalic, footnoteText } = collectInline(p, footnotes, rels);
|
|
19732
19757
|
if (!text) return null;
|
|
19733
19758
|
const style = styles.get(styleId);
|
|
19734
|
-
if (_optionalChain([style, 'optionalAccess',
|
|
19759
|
+
if (_optionalChain([style, 'optionalAccess', _161 => _161.outlineLevel]) !== void 0 && style.outlineLevel >= 0 && style.outlineLevel <= 5) {
|
|
19735
19760
|
return {
|
|
19736
19761
|
type: "heading",
|
|
19737
19762
|
text,
|
|
@@ -19740,8 +19765,8 @@ function parseParagraph2(p, styles, numbering, footnotes, rels) {
|
|
|
19740
19765
|
}
|
|
19741
19766
|
if (numId && numId !== "0") {
|
|
19742
19767
|
const numDef = numbering.get(numId);
|
|
19743
|
-
const levelInfo = _optionalChain([numDef, 'optionalAccess',
|
|
19744
|
-
const listType = _optionalChain([levelInfo, 'optionalAccess',
|
|
19768
|
+
const levelInfo = _optionalChain([numDef, 'optionalAccess', _162 => _162.get, 'call', _163 => _163(ilvl)]);
|
|
19769
|
+
const listType = _optionalChain([levelInfo, 'optionalAccess', _164 => _164.numFmt]) === "bullet" ? "unordered" : "ordered";
|
|
19745
19770
|
return { type: "list", text, listType };
|
|
19746
19771
|
}
|
|
19747
19772
|
const block = { type: "paragraph", text };
|
|
@@ -19823,7 +19848,7 @@ ${cell2.text}` : cell2.text;
|
|
|
19823
19848
|
return { text: cell2.text, colSpan: cell2.colSpan, rowSpan, colAddr: cell2.col, rowAddr: r };
|
|
19824
19849
|
})
|
|
19825
19850
|
);
|
|
19826
|
-
const table2 =
|
|
19851
|
+
const table2 = _chunk6GM2QLM3cjs.buildTable.call(void 0, cellRows, { keepAnchoredEmptyCols: keepEmptyCols });
|
|
19827
19852
|
if (table2.rows === 0 || table2.cols === 0) return null;
|
|
19828
19853
|
return { type: "table", table: table2 };
|
|
19829
19854
|
}
|
|
@@ -19833,10 +19858,10 @@ function collectCellText(tc2, styles, numbering, footnotes, rels, depth) {
|
|
|
19833
19858
|
for (const el of effectiveChildElements(tc2)) {
|
|
19834
19859
|
if (matchesLocal(el, "p")) {
|
|
19835
19860
|
const block = parseParagraph2(el, styles, numbering, footnotes, rels);
|
|
19836
|
-
if (_optionalChain([block, 'optionalAccess',
|
|
19861
|
+
if (_optionalChain([block, 'optionalAccess', _165 => _165.text])) parts.push(block.text);
|
|
19837
19862
|
for (const tp of collectTextboxParagraphs(el)) {
|
|
19838
19863
|
const tb = parseParagraph2(tp, styles, numbering, footnotes, rels);
|
|
19839
|
-
if (_optionalChain([tb, 'optionalAccess',
|
|
19864
|
+
if (_optionalChain([tb, 'optionalAccess', _166 => _166.text])) parts.push(tb.text);
|
|
19840
19865
|
}
|
|
19841
19866
|
} else if (matchesLocal(el, "tbl")) {
|
|
19842
19867
|
for (const tr of getChildElements(el, "tr")) {
|
|
@@ -19871,7 +19896,7 @@ async function buildImageMap(zip, rels, doc, warnings) {
|
|
|
19871
19896
|
try {
|
|
19872
19897
|
const data = await imgFile.async("uint8array");
|
|
19873
19898
|
imgIdx++;
|
|
19874
|
-
const ext = _nullishCoalesce(_optionalChain([imgPath, 'access',
|
|
19899
|
+
const ext = _nullishCoalesce(_optionalChain([imgPath, 'access', _167 => _167.split, 'call', _168 => _168("."), 'access', _169 => _169.pop, 'call', _170 => _170(), 'optionalAccess', _171 => _171.toLowerCase, 'call', _172 => _172()]), () => ( "png"));
|
|
19875
19900
|
const mimeMap = {
|
|
19876
19901
|
png: "image/png",
|
|
19877
19902
|
jpg: "image/jpeg",
|
|
@@ -19925,12 +19950,12 @@ function emitParagraphImages(p, imageMap, linked, out) {
|
|
|
19925
19950
|
}
|
|
19926
19951
|
}
|
|
19927
19952
|
async function parseDocxDocument(buffer, options) {
|
|
19928
|
-
|
|
19953
|
+
_chunkGZ7W64QUcjs.precheckZipSize.call(void 0, buffer, MAX_DECOMPRESS_SIZE5);
|
|
19929
19954
|
const zip = await _jszip2.default.loadAsync(buffer);
|
|
19930
19955
|
const warnings = [];
|
|
19931
19956
|
const docFile = zip.file("word/document.xml");
|
|
19932
19957
|
if (!docFile) {
|
|
19933
|
-
throw new (0,
|
|
19958
|
+
throw new (0, _chunkGZ7W64QUcjs.KordocError)("\uC720\uD6A8\uD558\uC9C0 \uC54A\uC740 DOCX \uD30C\uC77C: word/document.xml\uC774 \uC5C6\uC2B5\uB2C8\uB2E4");
|
|
19934
19959
|
}
|
|
19935
19960
|
let rels = /* @__PURE__ */ new Map();
|
|
19936
19961
|
const relsFile = zip.file("word/_rels/document.xml.rels");
|
|
@@ -19977,7 +20002,7 @@ async function parseDocxDocument(buffer, options) {
|
|
|
19977
20002
|
const doc = parseXml2(docXml);
|
|
19978
20003
|
const body = findElements(doc, "body");
|
|
19979
20004
|
if (body.length === 0) {
|
|
19980
|
-
throw new (0,
|
|
20005
|
+
throw new (0, _chunkGZ7W64QUcjs.KordocError)("DOCX \uBCF8\uBB38(w:body)\uC744 \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4");
|
|
19981
20006
|
}
|
|
19982
20007
|
const { imageMap, images } = await buildImageMap(zip, rels, doc, warnings);
|
|
19983
20008
|
const linkedImages = /* @__PURE__ */ new Set();
|
|
@@ -19985,7 +20010,7 @@ async function parseDocxDocument(buffer, options) {
|
|
|
19985
20010
|
const bodyEl = body[0];
|
|
19986
20011
|
const topLevel = effectiveChildElements(bodyEl);
|
|
19987
20012
|
for (const el of topLevel) {
|
|
19988
|
-
const localName2 = _nullishCoalesce(el.localName, () => ( _optionalChain([el, 'access',
|
|
20013
|
+
const localName2 = _nullishCoalesce(el.localName, () => ( _optionalChain([el, 'access', _173 => _173.tagName, 'optionalAccess', _174 => _174.split, 'call', _175 => _175(":"), 'access', _176 => _176.pop, 'call', _177 => _177()])));
|
|
19989
20014
|
if (localName2 === "p") {
|
|
19990
20015
|
const block = parseParagraph2(el, styles, numbering, footnotes, rels);
|
|
19991
20016
|
if (block) blocks.push(block);
|
|
@@ -19996,7 +20021,7 @@ async function parseDocxDocument(buffer, options) {
|
|
|
19996
20021
|
if (imageMap.size > 0) emitParagraphImages(tp, imageMap, linkedImages, blocks);
|
|
19997
20022
|
}
|
|
19998
20023
|
} else if (localName2 === "tbl") {
|
|
19999
|
-
const block = parseTable(el, styles, numbering, footnotes, rels, _optionalChain([options, 'optionalAccess',
|
|
20024
|
+
const block = parseTable(el, styles, numbering, footnotes, rels, _optionalChain([options, 'optionalAccess', _178 => _178.keepTrailingEmptyCols]));
|
|
20000
20025
|
if (block) blocks.push(block);
|
|
20001
20026
|
}
|
|
20002
20027
|
}
|
|
@@ -20028,7 +20053,7 @@ async function parseDocxDocument(buffer, options) {
|
|
|
20028
20053
|
}
|
|
20029
20054
|
}
|
|
20030
20055
|
const outline = blocks.filter((b) => b.type === "heading").map((b) => ({ level: _nullishCoalesce(b.level, () => ( 2)), text: _nullishCoalesce(b.text, () => ( "")) }));
|
|
20031
|
-
const markdown =
|
|
20056
|
+
const markdown = _chunk6GM2QLM3cjs.blocksToMarkdown.call(void 0, blocks);
|
|
20032
20057
|
return {
|
|
20033
20058
|
markdown,
|
|
20034
20059
|
blocks,
|
|
@@ -20051,7 +20076,7 @@ function parseHwpmlDocument(buffer, options) {
|
|
|
20051
20076
|
}
|
|
20052
20077
|
const text = new TextDecoder("utf-8").decode(buffer).replace(/^\uFEFF/, "");
|
|
20053
20078
|
const normalized = text.replace(/ /g, " ");
|
|
20054
|
-
const xml =
|
|
20079
|
+
const xml = _chunkGZ7W64QUcjs.stripDtd.call(void 0, normalized);
|
|
20055
20080
|
const warnings = [];
|
|
20056
20081
|
const parser = new (0, _xmldom.DOMParser)({
|
|
20057
20082
|
onError: (_level, msg2) => {
|
|
@@ -20079,7 +20104,7 @@ function parseHwpmlDocument(buffer, options) {
|
|
|
20079
20104
|
return { markdown: "", blocks: [], metadata, warnings };
|
|
20080
20105
|
}
|
|
20081
20106
|
const blocks = [];
|
|
20082
|
-
const pageFilter = _optionalChain([options, 'optionalAccess',
|
|
20107
|
+
const pageFilter = _optionalChain([options, 'optionalAccess', _179 => _179.pages]) ? _chunkDCZVOIEOcjs.parsePageRange.call(void 0, options.pages, countSections(body)) : null;
|
|
20083
20108
|
let sectionIdx = 0;
|
|
20084
20109
|
const children = body.childNodes;
|
|
20085
20110
|
for (let i = 0; i < children.length; i++) {
|
|
@@ -20088,10 +20113,10 @@ function parseHwpmlDocument(buffer, options) {
|
|
|
20088
20113
|
if (localName(el) !== "SECTION") continue;
|
|
20089
20114
|
sectionIdx++;
|
|
20090
20115
|
if (pageFilter && !pageFilter.has(sectionIdx)) continue;
|
|
20091
|
-
parseSection2(el, blocks, paraShapeMap, sectionIdx, warnings, _nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
20116
|
+
parseSection2(el, blocks, paraShapeMap, sectionIdx, warnings, _nullishCoalesce(_optionalChain([options, 'optionalAccess', _180 => _180.keepTrailingEmptyCols]), () => ( false)));
|
|
20092
20117
|
}
|
|
20093
20118
|
const outline = blocks.filter((b) => b.type === "heading" && b.text).map((b) => ({ level: _nullishCoalesce(b.level, () => ( 1)), text: b.text, pageNumber: b.pageNumber }));
|
|
20094
|
-
const markdown =
|
|
20119
|
+
const markdown = _chunk6GM2QLM3cjs.blocksToMarkdown.call(void 0, blocks);
|
|
20095
20120
|
return {
|
|
20096
20121
|
markdown,
|
|
20097
20122
|
blocks,
|
|
@@ -20177,7 +20202,7 @@ function parseParagraph3(el, blocks, paraShapeMap, sectionNum) {
|
|
|
20177
20202
|
const shapeInfo = paraShapeMap.get(paraShapeId);
|
|
20178
20203
|
const text = extractParagraphText(el);
|
|
20179
20204
|
if (!text) return;
|
|
20180
|
-
if (_optionalChain([shapeInfo, 'optionalAccess',
|
|
20205
|
+
if (_optionalChain([shapeInfo, 'optionalAccess', _181 => _181.headingLevel]) != null) {
|
|
20181
20206
|
blocks.push({ type: "heading", text, level: shapeInfo.headingLevel, pageNumber: sectionNum });
|
|
20182
20207
|
} else {
|
|
20183
20208
|
blocks.push({ type: "paragraph", text, pageNumber: sectionNum });
|
|
@@ -20236,7 +20261,7 @@ function parseTable2(el, blocks, paraShapeMap, sectionNum, warnings, keep) {
|
|
|
20236
20261
|
const r = Math.min(Math.max(_nullishCoalesce(cell2.rowAddr, () => ( 0)), 0), rowCount - 1);
|
|
20237
20262
|
cellRows[r].push(cell2);
|
|
20238
20263
|
}
|
|
20239
|
-
const table2 =
|
|
20264
|
+
const table2 = _chunk6GM2QLM3cjs.buildTable.call(void 0, cellRows, { keepAnchoredEmptyCols: keep });
|
|
20240
20265
|
const caption = extractShapeCaption(el);
|
|
20241
20266
|
if (caption.text && caption.before) {
|
|
20242
20267
|
blocks.push({ type: "paragraph", text: caption.text, pageNumber: sectionNum });
|
|
@@ -20496,7 +20521,7 @@ function fillInCellPatterns(cellText, values, matchedLabels, blockedLabels) {
|
|
|
20496
20521
|
(match, prefix, suffix) => {
|
|
20497
20522
|
const label = prefix + suffix;
|
|
20498
20523
|
const normalizedLabel = normalizeLabel(label);
|
|
20499
|
-
if (_optionalChain([blockedLabels, 'optionalAccess',
|
|
20524
|
+
if (_optionalChain([blockedLabels, 'optionalAccess', _182 => _182.has, 'call', _183 => _183(normalizedLabel)])) return match;
|
|
20500
20525
|
const matchKey = values.available(normalizedLabel) ? normalizedLabel : values.available(normalizeLabel(prefix)) ? normalizeLabel(prefix) : void 0;
|
|
20501
20526
|
if (matchKey === void 0) return match;
|
|
20502
20527
|
const newValue = values.consume(matchKey);
|
|
@@ -20575,17 +20600,17 @@ function matchInlineSegment(seg, values, blockedLabels) {
|
|
|
20575
20600
|
const nlabel = normalizeLabel(seg.label);
|
|
20576
20601
|
if (seg.extLabel !== void 0) {
|
|
20577
20602
|
const nExt = normalizeLabel(seg.extLabel);
|
|
20578
|
-
if (nExt !== nlabel && !_optionalChain([blockedLabels, 'optionalAccess',
|
|
20603
|
+
if (nExt !== nlabel && !_optionalChain([blockedLabels, 'optionalAccess', _184 => _184.has, 'call', _185 => _185(nExt)]) && values.has(nExt)) {
|
|
20579
20604
|
return { key: nExt, label: seg.extLabel, viaExt: true };
|
|
20580
20605
|
}
|
|
20581
20606
|
}
|
|
20582
|
-
if (_optionalChain([blockedLabels, 'optionalAccess',
|
|
20607
|
+
if (_optionalChain([blockedLabels, 'optionalAccess', _186 => _186.has, 'call', _187 => _187(nlabel)])) return void 0;
|
|
20583
20608
|
const key = findMatchingKey(nlabel, values);
|
|
20584
20609
|
return key !== void 0 ? { key, label: seg.label, viaExt: false } : void 0;
|
|
20585
20610
|
}
|
|
20586
20611
|
function clampSegmentEnd(text, seg, next, nextViaExt) {
|
|
20587
20612
|
let ve = seg.valueEnd;
|
|
20588
|
-
if (nextViaExt && _optionalChain([next, 'optionalAccess',
|
|
20613
|
+
if (nextViaExt && _optionalChain([next, 'optionalAccess', _188 => _188.extStart]) !== void 0 && next.extStart < ve) ve = next.extStart;
|
|
20589
20614
|
while (ve > seg.valueStart && /\s/.test(text[ve - 1])) ve--;
|
|
20590
20615
|
return ve;
|
|
20591
20616
|
}
|
|
@@ -20600,7 +20625,7 @@ function normalizeValues(values, warnings) {
|
|
|
20600
20625
|
const { value, format } = typeof raw === "object" && !Array.isArray(raw) ? raw : { value: raw, format: void 0 };
|
|
20601
20626
|
const key = normalizeLabel(label);
|
|
20602
20627
|
if (map.has(key)) {
|
|
20603
|
-
_optionalChain([warnings, 'optionalAccess',
|
|
20628
|
+
_optionalChain([warnings, 'optionalAccess', _189 => _189.push, 'call', _190 => _190(`\uC785\uB825 \uB77C\uBCA8 "${label}"\uC774 \uC815\uADDC\uD654 \uD0A4 "${key}"\uC5D0\uC11C \uB2E4\uB978 \uB77C\uBCA8\uACFC \uCDA9\uB3CC \u2014 \uB4A4 \uAC12\uC73C\uB85C \uB36E\uC5B4\uC500`)]);
|
|
20604
20629
|
}
|
|
20605
20630
|
map.set(key, Array.isArray(value) ? value.map((v) => formatFillValue(v, format)) : formatFillValue(value, format));
|
|
20606
20631
|
}
|
|
@@ -20775,8 +20800,8 @@ function extractFromTable(table2) {
|
|
|
20775
20800
|
if (table2.cols >= 2) {
|
|
20776
20801
|
for (let r = 0; r < table2.rows; r++) {
|
|
20777
20802
|
for (let c = 0; c < table2.cols - 1; c++) {
|
|
20778
|
-
const labelCell = _optionalChain([table2, 'access',
|
|
20779
|
-
const valueCell = _optionalChain([table2, 'access',
|
|
20803
|
+
const labelCell = _optionalChain([table2, 'access', _191 => _191.cells, 'access', _192 => _192[r], 'optionalAccess', _193 => _193[c]]);
|
|
20804
|
+
const valueCell = _optionalChain([table2, 'access', _194 => _194.cells, 'access', _195 => _195[r], 'optionalAccess', _196 => _196[c + 1]]);
|
|
20780
20805
|
if (!labelCell || !valueCell) continue;
|
|
20781
20806
|
if (isLabelCell(labelCell.text)) {
|
|
20782
20807
|
fields.push({
|
|
@@ -20791,15 +20816,15 @@ function extractFromTable(table2) {
|
|
|
20791
20816
|
}
|
|
20792
20817
|
if (fields.length === 0 && table2.rows >= 2 && table2.cols >= 2) {
|
|
20793
20818
|
const headerRow = table2.cells[0];
|
|
20794
|
-
const allLabels = _nullishCoalesce(_optionalChain([headerRow, 'optionalAccess',
|
|
20795
|
-
const t = _nullishCoalesce(_optionalChain([cell2, 'optionalAccess',
|
|
20819
|
+
const allLabels = _nullishCoalesce(_optionalChain([headerRow, 'optionalAccess', _197 => _197.every, 'call', _198 => _198((cell2) => {
|
|
20820
|
+
const t = _nullishCoalesce(_optionalChain([cell2, 'optionalAccess', _199 => _199.text, 'access', _200 => _200.trim, 'call', _201 => _201()]), () => ( ""));
|
|
20796
20821
|
return t.length > 0 && t.length <= 20;
|
|
20797
20822
|
})]), () => ( false));
|
|
20798
20823
|
if (allLabels) {
|
|
20799
20824
|
for (let r = 1; r < table2.rows; r++) {
|
|
20800
20825
|
for (let c = 0; c < table2.cols; c++) {
|
|
20801
|
-
const label = _nullishCoalesce(_optionalChain([headerRow, 'access',
|
|
20802
|
-
const value = _nullishCoalesce(_optionalChain([table2, 'access',
|
|
20826
|
+
const label = _nullishCoalesce(_optionalChain([headerRow, 'access', _202 => _202[c], 'optionalAccess', _203 => _203.text, 'access', _204 => _204.trim, 'call', _205 => _205()]), () => ( ""));
|
|
20827
|
+
const value = _nullishCoalesce(_optionalChain([table2, 'access', _206 => _206.cells, 'access', _207 => _207[r], 'optionalAccess', _208 => _208[c], 'optionalAccess', _209 => _209.text, 'access', _210 => _210.trim, 'call', _211 => _211()]), () => ( ""));
|
|
20803
20828
|
if (label && value) {
|
|
20804
20829
|
fields.push({ label, value, row: r, col: c });
|
|
20805
20830
|
}
|
|
@@ -20893,7 +20918,7 @@ function fillFormFields(blocks, values, blockedLabels) {
|
|
|
20893
20918
|
for (const table2 of allTables) {
|
|
20894
20919
|
for (let r = 0; r < table2.rows; r++) {
|
|
20895
20920
|
for (let c = 0; c < table2.cols; c++) {
|
|
20896
|
-
const cell2 = _optionalChain([table2, 'access',
|
|
20921
|
+
const cell2 = _optionalChain([table2, 'access', _212 => _212.cells, 'access', _213 => _213[r], 'optionalAccess', _214 => _214[c]]);
|
|
20897
20922
|
if (!cell2) continue;
|
|
20898
20923
|
const result = fillInCellPatterns(cell2.text, cursor, matchedLabels, blockedLabels);
|
|
20899
20924
|
if (result) {
|
|
@@ -20925,7 +20950,7 @@ function collectIRTables(blocks, depth) {
|
|
|
20925
20950
|
out.push(block.table);
|
|
20926
20951
|
for (const row of block.table.cells) {
|
|
20927
20952
|
for (const cell2 of row) {
|
|
20928
|
-
if (_optionalChain([cell2, 'optionalAccess',
|
|
20953
|
+
if (_optionalChain([cell2, 'optionalAccess', _215 => _215.blocks, 'optionalAccess', _216 => _216.length])) out.push(...collectIRTables(cell2.blocks, depth + 1));
|
|
20929
20954
|
}
|
|
20930
20955
|
}
|
|
20931
20956
|
}
|
|
@@ -20936,7 +20961,7 @@ function coveredPositions(table2) {
|
|
|
20936
20961
|
for (let r = 0; r < table2.rows; r++) {
|
|
20937
20962
|
for (let c = 0; c < table2.cols; c++) {
|
|
20938
20963
|
if (covered.has(`${r},${c}`)) continue;
|
|
20939
|
-
const cell2 = _optionalChain([table2, 'access',
|
|
20964
|
+
const cell2 = _optionalChain([table2, 'access', _217 => _217.cells, 'access', _218 => _218[r], 'optionalAccess', _219 => _219[c]]);
|
|
20940
20965
|
if (!cell2) continue;
|
|
20941
20966
|
for (let dr = 0; dr < cell2.rowSpan; dr++) {
|
|
20942
20967
|
for (let dc = 0; dc < cell2.colSpan; dc++) {
|
|
@@ -20952,15 +20977,15 @@ function coveredPositions(table2) {
|
|
|
20952
20977
|
function isHeaderDataTable(table2, covered) {
|
|
20953
20978
|
if (table2.rows < 2) return false;
|
|
20954
20979
|
const headerRow = table2.cells[0];
|
|
20955
|
-
if (!_optionalChain([headerRow, 'optionalAccess',
|
|
20980
|
+
if (!_optionalChain([headerRow, 'optionalAccess', _220 => _220.length])) return false;
|
|
20956
20981
|
const allLabels = headerRow.every((cell2) => {
|
|
20957
|
-
const t = _nullishCoalesce(_optionalChain([cell2, 'optionalAccess',
|
|
20982
|
+
const t = _nullishCoalesce(_optionalChain([cell2, 'optionalAccess', _221 => _221.text, 'access', _222 => _222.trim, 'call', _223 => _223()]), () => ( ""));
|
|
20958
20983
|
return t.length > 0 && t.length <= 20 && isLabelCell(t);
|
|
20959
20984
|
});
|
|
20960
20985
|
if (!allLabels) return false;
|
|
20961
20986
|
for (let c = 0; c < table2.cols; c++) {
|
|
20962
20987
|
if (covered.has(`1,${c}`)) continue;
|
|
20963
|
-
const cell2 = _optionalChain([table2, 'access',
|
|
20988
|
+
const cell2 = _optionalChain([table2, 'access', _224 => _224.cells, 'access', _225 => _225[1], 'optionalAccess', _226 => _226[c]]);
|
|
20964
20989
|
if (!cell2) break;
|
|
20965
20990
|
return !isLabelCell(cell2.text);
|
|
20966
20991
|
}
|
|
@@ -20973,7 +20998,7 @@ function fillTable(table2, values, filled, matchedLabels, patternFilledCells, bl
|
|
|
20973
20998
|
for (let r = skipHeaderRow ? 1 : 0; r < table2.rows; r++) {
|
|
20974
20999
|
for (let c = 0; c < table2.cols; c++) {
|
|
20975
21000
|
if (covered.has(`${r},${c}`)) continue;
|
|
20976
|
-
const labelCell = _optionalChain([table2, 'access',
|
|
21001
|
+
const labelCell = _optionalChain([table2, 'access', _227 => _227.cells, 'access', _228 => _228[r], 'optionalAccess', _229 => _229[c]]);
|
|
20977
21002
|
if (!labelCell) continue;
|
|
20978
21003
|
if (!isLabelCell(labelCell.text)) continue;
|
|
20979
21004
|
let vc = c + labelCell.colSpan;
|
|
@@ -20984,12 +21009,12 @@ function fillTable(table2, values, filled, matchedLabels, patternFilledCells, bl
|
|
|
20984
21009
|
if (isKeywordLabel(valueCell.text)) continue;
|
|
20985
21010
|
const normalizedCellLabel = normalizeLabel(labelCell.text);
|
|
20986
21011
|
if (!normalizedCellLabel) continue;
|
|
20987
|
-
if (_optionalChain([blockedLabels, 'optionalAccess',
|
|
21012
|
+
if (_optionalChain([blockedLabels, 'optionalAccess', _230 => _230.has, 'call', _231 => _231(normalizedCellLabel)])) continue;
|
|
20988
21013
|
const matchKey = findMatchingKey(normalizedCellLabel, values);
|
|
20989
21014
|
if (matchKey === void 0) continue;
|
|
20990
21015
|
const newValue = values.consume(matchKey);
|
|
20991
21016
|
if (newValue === void 0) continue;
|
|
20992
|
-
if (_optionalChain([patternFilledCells, 'optionalAccess',
|
|
21017
|
+
if (_optionalChain([patternFilledCells, 'optionalAccess', _232 => _232.has, 'call', _233 => _233(valueCell)])) {
|
|
20993
21018
|
valueCell.text = newValue + " " + valueCell.text;
|
|
20994
21019
|
} else {
|
|
20995
21020
|
valueCell.text = newValue;
|
|
@@ -21006,8 +21031,8 @@ function fillTable(table2, values, filled, matchedLabels, patternFilledCells, bl
|
|
|
21006
21031
|
}
|
|
21007
21032
|
if (table2.rows >= 2 && table2.cols >= 2) {
|
|
21008
21033
|
const headerRow = table2.cells[0];
|
|
21009
|
-
const allLabels = _nullishCoalesce(_optionalChain([headerRow, 'optionalAccess',
|
|
21010
|
-
const t = _nullishCoalesce(_optionalChain([cell2, 'optionalAccess',
|
|
21034
|
+
const allLabels = _nullishCoalesce(_optionalChain([headerRow, 'optionalAccess', _234 => _234.every, 'call', _235 => _235((cell2) => {
|
|
21035
|
+
const t = _nullishCoalesce(_optionalChain([cell2, 'optionalAccess', _236 => _236.text, 'access', _237 => _237.trim, 'call', _238 => _238()]), () => ( ""));
|
|
21011
21036
|
return t.length > 0 && t.length <= 20 && isLabelCell(t);
|
|
21012
21037
|
})]), () => ( false));
|
|
21013
21038
|
if (!allLabels) return;
|
|
@@ -21015,16 +21040,16 @@ function fillTable(table2, values, filled, matchedLabels, patternFilledCells, bl
|
|
|
21015
21040
|
for (let c = 0; c < table2.cols; c++) {
|
|
21016
21041
|
if (covered.has(`${r},${c}`)) continue;
|
|
21017
21042
|
const headerCell = headerRow[c];
|
|
21018
|
-
const valueCell = _optionalChain([table2, 'access',
|
|
21043
|
+
const valueCell = _optionalChain([table2, 'access', _239 => _239.cells, 'access', _240 => _240[r], 'optionalAccess', _241 => _241[c]]);
|
|
21019
21044
|
if (!headerCell || !valueCell) continue;
|
|
21020
21045
|
const headerLabel = normalizeLabel(headerCell.text);
|
|
21021
|
-
if (_optionalChain([blockedLabels, 'optionalAccess',
|
|
21046
|
+
if (_optionalChain([blockedLabels, 'optionalAccess', _242 => _242.has, 'call', _243 => _243(headerLabel)])) continue;
|
|
21022
21047
|
const matchKey = findMatchingKey(headerLabel, values);
|
|
21023
21048
|
if (matchKey === void 0) continue;
|
|
21024
21049
|
if (!values.isArray(matchKey) && matchedLabels.has(matchKey)) continue;
|
|
21025
21050
|
const newValue = values.consume(matchKey);
|
|
21026
21051
|
if (newValue === void 0) continue;
|
|
21027
|
-
if (_optionalChain([patternFilledCells, 'optionalAccess',
|
|
21052
|
+
if (_optionalChain([patternFilledCells, 'optionalAccess', _244 => _244.has, 'call', _245 => _245(valueCell)])) {
|
|
21028
21053
|
valueCell.text = newValue + " " + valueCell.text;
|
|
21029
21054
|
} else {
|
|
21030
21055
|
valueCell.text = newValue;
|
|
@@ -21056,7 +21081,7 @@ function fillInlineFields(text, values, filled, matchedLabels, blockedLabels) {
|
|
|
21056
21081
|
if (newValue === void 0) continue;
|
|
21057
21082
|
matchedLabels.add(matchKey);
|
|
21058
21083
|
filled.push({ label: matched.label.trim(), value: newValue, row: -1, col: -1, key: matchKey });
|
|
21059
|
-
const ve = clampSegmentEnd(text, seg, segments[i + 1], _nullishCoalesce(_optionalChain([matches, 'access',
|
|
21084
|
+
const ve = clampSegmentEnd(text, seg, segments[i + 1], _nullishCoalesce(_optionalChain([matches, 'access', _246 => _246[i + 1], 'optionalAccess', _247 => _247.viaExt]), () => ( false)));
|
|
21060
21085
|
out += text.slice(pos, seg.valueStart);
|
|
21061
21086
|
out += seg.valueStart === ve ? padInsertion(text, seg.valueStart, newValue) : newValue;
|
|
21062
21087
|
pos = ve;
|
|
@@ -21618,19 +21643,19 @@ function parseCentralDirectory(buf) {
|
|
|
21618
21643
|
}
|
|
21619
21644
|
}
|
|
21620
21645
|
}
|
|
21621
|
-
if (eocdOffset < 0) throw new (0,
|
|
21646
|
+
if (eocdOffset < 0) throw new (0, _chunkGZ7W64QUcjs.KordocError)("ZIP EOCD\uB97C \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4");
|
|
21622
21647
|
const totalEntries = view.getUint16(eocdOffset + 10, true);
|
|
21623
21648
|
const cdSize = view.getUint32(eocdOffset + 12, true);
|
|
21624
21649
|
const cdOffset = view.getUint32(eocdOffset + 16, true);
|
|
21625
|
-
if (cdOffset === 4294967295 || totalEntries === 65535) throw new (0,
|
|
21650
|
+
if (cdOffset === 4294967295 || totalEntries === 65535) throw new (0, _chunkGZ7W64QUcjs.KordocError)("ZIP64\uB294 \uC9C0\uC6D0\uD558\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4");
|
|
21626
21651
|
if (eocdOffset >= 20 && view.getUint32(eocdOffset - 20, true) === ZIP64_EOCD_LOC_SIG) {
|
|
21627
|
-
throw new (0,
|
|
21652
|
+
throw new (0, _chunkGZ7W64QUcjs.KordocError)("ZIP64\uB294 \uC9C0\uC6D0\uD558\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4");
|
|
21628
21653
|
}
|
|
21629
21654
|
const decoder = new TextDecoder("utf-8");
|
|
21630
21655
|
const entries = [];
|
|
21631
21656
|
let pos = cdOffset;
|
|
21632
21657
|
for (let i = 0; i < totalEntries; i++) {
|
|
21633
|
-
if (view.getUint32(pos, true) !== CD_SIG) throw new (0,
|
|
21658
|
+
if (view.getUint32(pos, true) !== CD_SIG) throw new (0, _chunkGZ7W64QUcjs.KordocError)("ZIP Central Directory \uC190\uC0C1");
|
|
21634
21659
|
const flags = view.getUint16(pos + 8, true);
|
|
21635
21660
|
const method = view.getUint16(pos + 10, true);
|
|
21636
21661
|
const crc = view.getUint32(pos + 16, true);
|
|
@@ -21641,7 +21666,7 @@ function parseCentralDirectory(buf) {
|
|
|
21641
21666
|
const commentLen = view.getUint16(pos + 32, true);
|
|
21642
21667
|
const localOffset = view.getUint32(pos + 42, true);
|
|
21643
21668
|
if (compSize === 4294967295 || uncompSize === 4294967295 || localOffset === 4294967295) {
|
|
21644
|
-
throw new (0,
|
|
21669
|
+
throw new (0, _chunkGZ7W64QUcjs.KordocError)("ZIP64\uB294 \uC9C0\uC6D0\uD558\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4");
|
|
21645
21670
|
}
|
|
21646
21671
|
const name = decoder.decode(buf.subarray(pos + 46, pos + 46 + nameLen));
|
|
21647
21672
|
const cdEnd = pos + 46 + nameLen + extraLen + commentLen;
|
|
@@ -21670,11 +21695,11 @@ function patchZipEntries(original, replacements, additions) {
|
|
|
21670
21695
|
const { entries, cdOffset, eocdOffset } = parseCentralDirectory(original);
|
|
21671
21696
|
const view = new DataView(original.buffer, original.byteOffset, original.byteLength);
|
|
21672
21697
|
for (const name of replacements.keys()) {
|
|
21673
|
-
if (!entries.some((e) => e.name === name)) throw new (0,
|
|
21698
|
+
if (!entries.some((e) => e.name === name)) throw new (0, _chunkGZ7W64QUcjs.KordocError)(`ZIP\uC5D0 \uC5C6\uB294 \uC5D4\uD2B8\uB9AC: ${name}`);
|
|
21674
21699
|
}
|
|
21675
21700
|
if (additions) {
|
|
21676
21701
|
for (const name of additions.keys()) {
|
|
21677
|
-
if (entries.some((e) => e.name === name)) throw new (0,
|
|
21702
|
+
if (entries.some((e) => e.name === name)) throw new (0, _chunkGZ7W64QUcjs.KordocError)(`ZIP\uC5D0 \uC774\uBBF8 \uC788\uB294 \uC5D4\uD2B8\uB9AC: ${name}`);
|
|
21678
21703
|
}
|
|
21679
21704
|
}
|
|
21680
21705
|
const byLocal = [...entries].sort((a, b) => a.localOffset - b.localOffset);
|
|
@@ -21693,7 +21718,7 @@ function patchZipEntries(original, replacements, additions) {
|
|
|
21693
21718
|
offset += seg.length;
|
|
21694
21719
|
continue;
|
|
21695
21720
|
}
|
|
21696
|
-
if (view.getUint32(e.localOffset, true) !== LOCAL_SIG) throw new (0,
|
|
21721
|
+
if (view.getUint32(e.localOffset, true) !== LOCAL_SIG) throw new (0, _chunkGZ7W64QUcjs.KordocError)("ZIP \uB85C\uCEEC \uD5E4\uB354 \uC2DC\uADF8\uB2C8\uCC98 \uBD88\uC77C\uCE58");
|
|
21697
21722
|
const nameLen = view.getUint16(e.localOffset + 26, true);
|
|
21698
21723
|
const extraLen = view.getUint16(e.localOffset + 28, true);
|
|
21699
21724
|
const headerLen = 30 + nameLen + extraLen;
|
|
@@ -21701,7 +21726,7 @@ function patchZipEntries(original, replacements, additions) {
|
|
|
21701
21726
|
const hview = new DataView(header.buffer, header.byteOffset, header.byteLength);
|
|
21702
21727
|
const method = e.method;
|
|
21703
21728
|
if (method !== 0 && method !== 8) {
|
|
21704
|
-
throw new (0,
|
|
21729
|
+
throw new (0, _chunkGZ7W64QUcjs.KordocError)(`\uC9C0\uC6D0\uD558\uC9C0 \uC54A\uB294 ZIP \uC555\uCD95 \uBC29\uC2DD(method=${method}): ${e.name} \u2014 STORE(0)/DEFLATE(8)\uB9CC \uAD50\uCCB4 \uAC00\uB2A5`);
|
|
21705
21730
|
}
|
|
21706
21731
|
const compData = method === 0 ? newData : new Uint8Array(_zlib.deflateRawSync.call(void 0, newData));
|
|
21707
21732
|
const crc = crc32(newData);
|
|
@@ -21802,7 +21827,7 @@ async function fillHwpx(hwpxBuffer, values, blockedLabels) {
|
|
|
21802
21827
|
const zip = await _jszip2.default.loadAsync(hwpxBuffer);
|
|
21803
21828
|
const sectionPaths = Object.keys(zip.files).filter((name) => /[Ss]ection\d+\.xml$/i.test(name)).sort();
|
|
21804
21829
|
if (sectionPaths.length === 0) {
|
|
21805
|
-
throw new (0,
|
|
21830
|
+
throw new (0, _chunkGZ7W64QUcjs.KordocError)("HWPX\uC5D0\uC11C \uC139\uC158 \uD30C\uC77C\uC744 \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4");
|
|
21806
21831
|
}
|
|
21807
21832
|
const warnings = [];
|
|
21808
21833
|
const normalizedValues = normalizeValues(values, warnings);
|
|
@@ -21886,7 +21911,7 @@ async function fillHwpx(hwpxBuffer, values, blockedLabels) {
|
|
|
21886
21911
|
if (isKeywordLabel(cellLabelText(valueCell))) continue;
|
|
21887
21912
|
const normalizedCellLabel = normalizeLabel(labelText);
|
|
21888
21913
|
if (!normalizedCellLabel) continue;
|
|
21889
|
-
if (_optionalChain([blockedLabels, 'optionalAccess',
|
|
21914
|
+
if (_optionalChain([blockedLabels, 'optionalAccess', _248 => _248.has, 'call', _249 => _249(normalizedCellLabel)])) continue;
|
|
21890
21915
|
const matchKey = findMatchingKey(normalizedCellLabel, cursor);
|
|
21891
21916
|
if (matchKey === void 0) continue;
|
|
21892
21917
|
if (patternApplied.has(valueCell)) {
|
|
@@ -21944,7 +21969,7 @@ async function fillHwpx(hwpxBuffer, values, blockedLabels) {
|
|
|
21944
21969
|
const dataCells = table2.rows[rowIdx];
|
|
21945
21970
|
for (let colIdx = 0; colIdx < Math.min(headerCells.length, dataCells.length); colIdx++) {
|
|
21946
21971
|
const headerLabel = normalizeLabel(cellLabelText(headerCells[colIdx]));
|
|
21947
|
-
if (_optionalChain([blockedLabels, 'optionalAccess',
|
|
21972
|
+
if (_optionalChain([blockedLabels, 'optionalAccess', _250 => _250.has, 'call', _251 => _251(headerLabel)])) continue;
|
|
21948
21973
|
const matchKey = findMatchingKey(headerLabel, cursor);
|
|
21949
21974
|
if (matchKey === void 0) continue;
|
|
21950
21975
|
if (!cursor.isArray(matchKey) && matchedLabels.has(matchKey)) continue;
|
|
@@ -21998,7 +22023,7 @@ async function fillHwpx(hwpxBuffer, values, blockedLabels) {
|
|
|
21998
22023
|
}
|
|
21999
22024
|
for (const para2 of [...scan.bodyParagraphs, ...scan.excludedParagraphs]) {
|
|
22000
22025
|
const existing = ledger.get(para2);
|
|
22001
|
-
if (_optionalChain([existing, 'optionalAccess',
|
|
22026
|
+
if (_optionalChain([existing, 'optionalAccess', _252 => _252.fullText]) !== void 0) continue;
|
|
22002
22027
|
const text = matchText(para2);
|
|
22003
22028
|
const segments = scanInlineSegments(text);
|
|
22004
22029
|
const matches = segments.map((seg) => matchInlineSegment(seg, cursor, blockedLabels));
|
|
@@ -22009,7 +22034,7 @@ async function fillHwpx(hwpxBuffer, values, blockedLabels) {
|
|
|
22009
22034
|
const matchKey = matched.key;
|
|
22010
22035
|
const newValue = cursor.consume(matchKey);
|
|
22011
22036
|
if (newValue === void 0) continue;
|
|
22012
|
-
const ve = clampSegmentEnd(text, seg, segments[i + 1], _nullishCoalesce(_optionalChain([matches, 'access',
|
|
22037
|
+
const ve = clampSegmentEnd(text, seg, segments[i + 1], _nullishCoalesce(_optionalChain([matches, 'access', _253 => _253[i + 1], 'optionalAccess', _254 => _254.viaExt]), () => ( false)));
|
|
22013
22038
|
const replacement = seg.valueStart === ve ? padInsertion(text, seg.valueStart, newValue) : newValue;
|
|
22014
22039
|
const l = led(para2);
|
|
22015
22040
|
l.ranges.push({ start: seg.valueStart, end: ve, replacement });
|
|
@@ -22115,16 +22140,16 @@ var PARA_LIST = 7;
|
|
|
22115
22140
|
var DEFAULT_TEXT_COLOR = "#000000";
|
|
22116
22141
|
function resolveTheme(theme) {
|
|
22117
22142
|
return {
|
|
22118
|
-
h1: _nullishCoalesce(_optionalChain([theme, 'optionalAccess',
|
|
22119
|
-
h2: _nullishCoalesce(_optionalChain([theme, 'optionalAccess',
|
|
22120
|
-
h3: _nullishCoalesce(_optionalChain([theme, 'optionalAccess',
|
|
22121
|
-
h4: _nullishCoalesce(_nullishCoalesce(_optionalChain([theme, 'optionalAccess',
|
|
22122
|
-
body: _nullishCoalesce(_optionalChain([theme, 'optionalAccess',
|
|
22123
|
-
quote: _nullishCoalesce(_optionalChain([theme, 'optionalAccess',
|
|
22143
|
+
h1: _nullishCoalesce(_optionalChain([theme, 'optionalAccess', _255 => _255.headingColors, 'optionalAccess', _256 => _256[1]]), () => ( DEFAULT_TEXT_COLOR)),
|
|
22144
|
+
h2: _nullishCoalesce(_optionalChain([theme, 'optionalAccess', _257 => _257.headingColors, 'optionalAccess', _258 => _258[2]]), () => ( DEFAULT_TEXT_COLOR)),
|
|
22145
|
+
h3: _nullishCoalesce(_optionalChain([theme, 'optionalAccess', _259 => _259.headingColors, 'optionalAccess', _260 => _260[3]]), () => ( DEFAULT_TEXT_COLOR)),
|
|
22146
|
+
h4: _nullishCoalesce(_nullishCoalesce(_optionalChain([theme, 'optionalAccess', _261 => _261.headingColors, 'optionalAccess', _262 => _262[4]]), () => ( _optionalChain([theme, 'optionalAccess', _263 => _263.headingColors, 'optionalAccess', _264 => _264[3]]))), () => ( DEFAULT_TEXT_COLOR)),
|
|
22147
|
+
body: _nullishCoalesce(_optionalChain([theme, 'optionalAccess', _265 => _265.bodyColor]), () => ( DEFAULT_TEXT_COLOR)),
|
|
22148
|
+
quote: _nullishCoalesce(_optionalChain([theme, 'optionalAccess', _266 => _266.quoteColor]), () => ( DEFAULT_TEXT_COLOR)),
|
|
22124
22149
|
/** quoteColor가 명시되었는지 — blockquote charPr 분기에 사용 (baseline 호환) */
|
|
22125
|
-
hasQuoteOption: _optionalChain([theme, 'optionalAccess',
|
|
22126
|
-
tableHeader: _nullishCoalesce(_nullishCoalesce(_optionalChain([theme, 'optionalAccess',
|
|
22127
|
-
tableHeaderBold: !!_optionalChain([theme, 'optionalAccess',
|
|
22150
|
+
hasQuoteOption: _optionalChain([theme, 'optionalAccess', _267 => _267.quoteColor]) !== void 0,
|
|
22151
|
+
tableHeader: _nullishCoalesce(_nullishCoalesce(_optionalChain([theme, 'optionalAccess', _268 => _268.tableHeaderColor]), () => ( _optionalChain([theme, 'optionalAccess', _269 => _269.bodyColor]))), () => ( DEFAULT_TEXT_COLOR)),
|
|
22152
|
+
tableHeaderBold: !!_optionalChain([theme, 'optionalAccess', _270 => _270.tableHeaderBold])
|
|
22128
22153
|
};
|
|
22129
22154
|
}
|
|
22130
22155
|
function escapeXml(text) {
|
|
@@ -22539,7 +22564,7 @@ function assertSequentialIds(rows, label, startId) {
|
|
|
22539
22564
|
const m = rows[i].match(/\bid="(\d+)"/);
|
|
22540
22565
|
const got = m ? Number(m[1]) : NaN;
|
|
22541
22566
|
if (got !== startId + i) {
|
|
22542
|
-
throw new (0,
|
|
22567
|
+
throw new (0, _chunkGZ7W64QUcjs.KordocError)(
|
|
22543
22568
|
`\uB0B4\uBD80 \uC624\uB958: ${label} id \uD30C\uD2F0\uC158 \uB4DC\uB9AC\uD504\uD2B8 \u2014 ${startId + i} \uC704\uCE58\uC5D0 id=${m ? m[1] : "?"} \uBC29\uCD9C. id \uC0C1\uC218(gen-ids)\uC640 \uC2E4\uC81C \uBC29\uCD9C \uC218\uAC00 \uC5B4\uAE0B\uB0AC\uB2E4 (GJ_CHAR_COUNT\uB958 \uCE74\uC6B4\uD2B8\xB7base \uC0B0\uC220 \uD655\uC778)`
|
|
22544
22569
|
);
|
|
22545
22570
|
}
|
|
@@ -22623,7 +22648,7 @@ function buildCharProperties(theme, gongmun, ratioVariants = [], extraCharPrXmls
|
|
|
22623
22648
|
}
|
|
22624
22649
|
const expectedBase = charVariantBase(richAssets, !!gongmun);
|
|
22625
22650
|
if (rows.length !== expectedBase) {
|
|
22626
|
-
throw new (0,
|
|
22651
|
+
throw new (0, _chunkGZ7W64QUcjs.KordocError)(
|
|
22627
22652
|
`\uB0B4\uBD80 \uC624\uB958: charPr \uAE30\uBCF8 \uBE14\uB85D \uBC29\uCD9C \uC218(${rows.length}) \u2260 charVariantBase(${expectedBase}) \u2014 gen-header \uBC29\uCD9C \uD589\uACFC gen-ids \uCE74\uC6B4\uD2B8 \uC0C1\uC218\uAC00 \uC5B4\uAE0B\uB0AC\uB2E4`
|
|
22628
22653
|
);
|
|
22629
22654
|
}
|
|
@@ -22851,7 +22876,7 @@ function buildStyles(gongmun) {
|
|
|
22851
22876
|
</hh:styles>`;
|
|
22852
22877
|
}
|
|
22853
22878
|
function generateHeaderXml(theme, gongmun, ratioVariants = [], extraBorderFills = [], extraCharPrXmls = [], listIndentVariants = [], extraFonts = []) {
|
|
22854
|
-
const bodyFace = _nullishCoalesce(_optionalChain([gongmun, 'optionalAccess',
|
|
22879
|
+
const bodyFace = _nullishCoalesce(_optionalChain([gongmun, 'optionalAccess', _271 => _271.fonts, 'access', _272 => _272.body]), () => ( (_optionalChain([gongmun, 'optionalAccess', _273 => _273.bodyFont]) === "gothic" ? "\uB9D1\uC740 \uACE0\uB515" : "\uD568\uCD08\uB86C\uBC14\uD0D5")));
|
|
22855
22880
|
const charPropsXml = buildCharProperties(theme, gongmun, ratioVariants, extraCharPrXmls);
|
|
22856
22881
|
const paraPropsXml = buildParaProperties(gongmun, gongmun ? listIndentVariants : []);
|
|
22857
22882
|
return `<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
|
|
@@ -22980,8 +23005,8 @@ function parseChartFence(text) {
|
|
|
22980
23005
|
const spec = chartSpec(type);
|
|
22981
23006
|
let finalSeries = spec.pie ? [series[0]] : series;
|
|
22982
23007
|
finalSeries = finalSeries.map((s) => ({ ...s }));
|
|
22983
|
-
const ptLen = Math.max(_nullishCoalesce(_optionalChain([cat, 'optionalAccess',
|
|
22984
|
-
const catFinal = Array.from({ length: ptLen }, (_, i) => _nullishCoalesce(_optionalChain([cat, 'optionalAccess',
|
|
23008
|
+
const ptLen = Math.max(_nullishCoalesce(_optionalChain([cat, 'optionalAccess', _274 => _274.length]), () => ( 0)), ...finalSeries.map((s) => s.values.length));
|
|
23009
|
+
const catFinal = Array.from({ length: ptLen }, (_, i) => _nullishCoalesce(_optionalChain([cat, 'optionalAccess', _275 => _275[i]]), () => ( `\uD56D\uBAA9 ${i + 1}`)));
|
|
22985
23010
|
if (!spec.scatter) {
|
|
22986
23011
|
finalSeries = finalSeries.map((s) => ({ ...s, values: catFinal.map((_, i) => _nullishCoalesce(s.values[i], () => ( 0))) }));
|
|
22987
23012
|
}
|
|
@@ -23023,7 +23048,7 @@ function serSpPr(color, stroke) {
|
|
|
23023
23048
|
return stroke ? `<c:spPr><a:ln w="28575" cap="flat" cmpd="sng" algn="ctr">${f}<a:prstDash val="solid"/><a:round/></a:ln></c:spPr>` : `<c:spPr>${f}</c:spPr>`;
|
|
23024
23049
|
}
|
|
23025
23050
|
function dPtXml(pointColors, pie) {
|
|
23026
|
-
if (!_optionalChain([pointColors, 'optionalAccess',
|
|
23051
|
+
if (!_optionalChain([pointColors, 'optionalAccess', _276 => _276.length])) return "";
|
|
23027
23052
|
return pointColors.map((col, i) => {
|
|
23028
23053
|
const f = chartColorFill(col);
|
|
23029
23054
|
if (!f) return "";
|
|
@@ -23262,8 +23287,8 @@ function buildGaejosikCover(title, gongmun, bodyWidth = GAEJOSIK_BASE_WIDTH) {
|
|
|
23262
23287
|
const botRow = cell({ bf: GJ_BF_BAR_DARK, col: 0, row: 2, w: g.botDarkW, h: g.botBarH, paras: barEmpty }) + cell({ bf: GJ_BF_BAR_LIGHT, col: 1, colSpan: 2, row: 2, w: g.botLightW, h: g.botBarH, paras: barEmpty });
|
|
23263
23288
|
const tbl2 = table([topRow, titleRow, botRow], g.totalW, g.barH + g.titleH + g.botBarH, 3, 1, bodyWidth);
|
|
23264
23289
|
const host = `<hp:p paraPrIDRef="${PARA_NORMAL}" styleIDRef="0"><hp:run charPrIDRef="${CHAR_NORMAL}">${tbl2}</hp:run></hp:p>`;
|
|
23265
|
-
const date = _nullishCoalesce(_optionalChain([gongmun, 'access',
|
|
23266
|
-
const org = _nullishCoalesce(_optionalChain([gongmun, 'access',
|
|
23290
|
+
const date = _nullishCoalesce(_optionalChain([gongmun, 'access', _277 => _277.cover, 'optionalAccess', _278 => _278.date]), () => ( formatGaejosikDate(/* @__PURE__ */ new Date())));
|
|
23291
|
+
const org = _nullishCoalesce(_optionalChain([gongmun, 'access', _279 => _279.cover, 'optionalAccess', _280 => _280.org]), () => ( ""));
|
|
23267
23292
|
const sub = (t) => `<hp:p paraPrIDRef="${GJ_PARA_COVER}" styleIDRef="0"><hp:run charPrIDRef="${GJ_CHAR_COVER_SUB}"><hp:t>${escapeXml(t)}</hp:t></hp:run></hp:p>`;
|
|
23268
23293
|
const subEmpty = emptyPara(GJ_PARA_COVER, false, GJ_CHAR_COVER_SUB);
|
|
23269
23294
|
return [
|
|
@@ -23519,7 +23544,7 @@ function escapeGfm(text) {
|
|
|
23519
23544
|
}
|
|
23520
23545
|
var HWP_SHAPE_ALT_TEXT_RE = /^(?:모서리가 둥근 |둥근 )?(?:사각형|직사각형|정사각형|원|타원|삼각형|이등변 삼각형|직각 삼각형|선|직선|곡선|화살표|굵은 화살표|이중 화살표|오각형|육각형|팔각형|별|[4-8]점별|십자|십자형|구름|구름형|마름모|도넛|평행사변형|사다리꼴|부채꼴|호|반원|물결|번개|하트|빗금|블록 화살표|수식|표|그림|개체|그리기\s?개체|묶음\s?개체|글상자|수식\s?개체|OLE\s?개체)\s?입니다\.?$/gm;
|
|
23521
23546
|
function sanitizeText(text) {
|
|
23522
|
-
let result =
|
|
23547
|
+
let result = _chunk6GM2QLM3cjs.mapPuaText.call(void 0, text).replace(/[\u{F0000}-\u{FFFFD}]/gu, "").replace(HWP_SHAPE_ALT_TEXT_RE, "").replace(/ +/g, " ").trim();
|
|
23523
23548
|
if (result.length <= 30 && result.includes(" ")) {
|
|
23524
23549
|
const tokens = result.split(" ");
|
|
23525
23550
|
const koreanSingleCharCount = tokens.filter((t) => t.length === 1 && /[가-ㄱ-ㆎ]/.test(t)).length;
|
|
@@ -23549,7 +23574,7 @@ function replicateGfmTable(table2) {
|
|
|
23549
23574
|
for (let r = 0; r < numRows; r++) {
|
|
23550
23575
|
for (let c = 0; c < numCols; c++) {
|
|
23551
23576
|
if (skip.has(`${r},${c}`)) continue;
|
|
23552
|
-
const cell2 = _optionalChain([cells, 'access',
|
|
23577
|
+
const cell2 = _optionalChain([cells, 'access', _281 => _281[r], 'optionalAccess', _282 => _282[c]]);
|
|
23553
23578
|
if (!cell2) continue;
|
|
23554
23579
|
display[r][c] = {
|
|
23555
23580
|
text: escapeGfm(sanitizeText(cell2.text)).replace(/\|/g, "\\|").replace(/\n/g, "<br>"),
|
|
@@ -23603,7 +23628,7 @@ function unescapeGfmCell(text) {
|
|
|
23603
23628
|
return text.replace(/<br\s*\/?>/gi, "\n").replace(/\\\|/g, "|").replace(/\\([~*_`])/g, "$1");
|
|
23604
23629
|
}
|
|
23605
23630
|
function replicateCellInnerHtml(cell2) {
|
|
23606
|
-
if (_optionalChain([cell2, 'access',
|
|
23631
|
+
if (_optionalChain([cell2, 'access', _283 => _283.blocks, 'optionalAccess', _284 => _284.length])) {
|
|
23607
23632
|
return cell2.blocks.map((b) => {
|
|
23608
23633
|
if (b.type === "table" && b.table) {
|
|
23609
23634
|
const cap = b.table.caption ? sanitizeText(b.table.caption) : "";
|
|
@@ -23642,7 +23667,7 @@ function replicateHtmlTable(table2) {
|
|
|
23642
23667
|
const rowCells = [];
|
|
23643
23668
|
for (let c = 0; c < numCols; c++) {
|
|
23644
23669
|
if (skip.has(`${r},${c}`)) continue;
|
|
23645
|
-
const cell2 = _optionalChain([cells, 'access',
|
|
23670
|
+
const cell2 = _optionalChain([cells, 'access', _285 => _285[r], 'optionalAccess', _286 => _286[c]]);
|
|
23646
23671
|
if (!cell2) continue;
|
|
23647
23672
|
for (let dr = 0; dr < cell2.rowSpan; dr++) {
|
|
23648
23673
|
for (let dc = 0; dc < cell2.colSpan; dc++) {
|
|
@@ -23688,10 +23713,10 @@ function parseHtmlTable(raw) {
|
|
|
23688
23713
|
}
|
|
23689
23714
|
} else {
|
|
23690
23715
|
if (!isClose) {
|
|
23691
|
-
const cs = parseInt(_optionalChain([attrs, 'access',
|
|
23692
|
-
const rs = parseInt(_optionalChain([attrs, 'access',
|
|
23716
|
+
const cs = parseInt(_optionalChain([attrs, 'access', _287 => _287.match, 'call', _288 => _288(/colspan\s*=\s*["']?(\d+)/i), 'optionalAccess', _289 => _289[1]]) || "1", 10);
|
|
23717
|
+
const rs = parseInt(_optionalChain([attrs, 'access', _290 => _290.match, 'call', _291 => _291(/rowspan\s*=\s*["']?(\d+)/i), 'optionalAccess', _292 => _292[1]]) || "1", 10);
|
|
23693
23718
|
cellStart = m.index + m[0].length;
|
|
23694
|
-
cellInfo = { colSpan: clampSpan(isNaN(cs) ? 1 : cs,
|
|
23719
|
+
cellInfo = { colSpan: clampSpan(isNaN(cs) ? 1 : cs, _chunk6GM2QLM3cjs.MAX_COLS), rowSpan: clampSpan(isNaN(rs) ? 1 : rs, _chunk6GM2QLM3cjs.MAX_ROWS) };
|
|
23695
23720
|
} else if (cellStart >= 0 && cellInfo && currentRow) {
|
|
23696
23721
|
currentRow.push({ inner: raw.slice(cellStart, m.index), colSpan: cellInfo.colSpan, rowSpan: cellInfo.rowSpan });
|
|
23697
23722
|
cellStart = -1;
|
|
@@ -23715,7 +23740,7 @@ function htmlCellInnerToLines(inner) {
|
|
|
23715
23740
|
hadNonText = true;
|
|
23716
23741
|
work = work.replace(/<img\s(?:"[^"]*"|'[^']*'|[^>"'])*?>/gi, (tag) => {
|
|
23717
23742
|
const m = /\bsrc\s*=\s*(?:"([^"]*)"|'([^']*)')/i.exec(tag);
|
|
23718
|
-
const src = _nullishCoalesce(_optionalChain([m, 'optionalAccess',
|
|
23743
|
+
const src = _nullishCoalesce(_optionalChain([m, 'optionalAccess', _293 => _293[1]]), () => ( _optionalChain([m, 'optionalAccess', _294 => _294[2]])));
|
|
23719
23744
|
if (src) imgSrcs.push(src);
|
|
23720
23745
|
return "";
|
|
23721
23746
|
});
|
|
@@ -23858,7 +23883,7 @@ function edgeXml(tag, d) {
|
|
|
23858
23883
|
return d ? `<hh:${tag} type="${escapeXml(d.type)}" width="${escapeXml(d.width)}" color="${escapeXml(d.color)}"/>` : `<hh:${tag} type="NONE" width="0.1 mm" color="#000000"/>`;
|
|
23859
23884
|
}
|
|
23860
23885
|
function borderFillDefToXml(id, def) {
|
|
23861
|
-
const fill = _optionalChain([def, 'access',
|
|
23886
|
+
const fill = _optionalChain([def, 'access', _295 => _295.fill, 'optionalAccess', _296 => _296.faceColor]) ? `<hh:fillBrush><hh:winBrush faceColor="${escapeXml(def.fill.faceColor)}" hatchColor="#000000" alpha="0"/></hh:fillBrush>` : "";
|
|
23862
23887
|
return ` <hh:borderFill id="${id}" threeD="0" shadow="0" centerLine="NONE" breakCellSeparateLine="0">
|
|
23863
23888
|
<hh:slash type="NONE" Crooked="0" isCounter="0"/>
|
|
23864
23889
|
<hh:backSlash type="NONE" Crooked="0" isCounter="0"/>
|
|
@@ -24263,11 +24288,11 @@ function estimateRowHeight(cells, widths, charHeight) {
|
|
|
24263
24288
|
function generateTable(rows, theme, style = null, remap = null, seq = 0, images = null) {
|
|
24264
24289
|
const rowCnt = rows.length;
|
|
24265
24290
|
const colCnt = Math.max(...rows.map((r) => r.length), 1);
|
|
24266
|
-
const reg = _nullishCoalesce(_optionalChain([style, 'optionalAccess',
|
|
24291
|
+
const reg = _nullishCoalesce(_optionalChain([style, 'optionalAccess', _297 => _297.bfRegistry]), () => ( null));
|
|
24267
24292
|
const totalW = style ? reg ? style.totalWidth - DATA_TABLE_INSET : style.totalWidth : 44e3;
|
|
24268
|
-
const measureH = _nullishCoalesce(_optionalChain([style, 'optionalAccess',
|
|
24293
|
+
const measureH = _nullishCoalesce(_optionalChain([style, 'optionalAccess', _298 => _298.charHeight]), () => ( 1e3));
|
|
24269
24294
|
const rowAnchor = normalizeRowAnchor((_nullishCoalesce(rows[0], () => ( []))).map((c) => c.replace(/!\[[^\]]*\]\([^)]*\)/g, "")));
|
|
24270
|
-
const prof = takeProfile(remap, rowCnt, colCnt, anchorOfMarkdownCell(_nullishCoalesce(_optionalChain([rows, 'access',
|
|
24295
|
+
const prof = takeProfile(remap, rowCnt, colCnt, anchorOfMarkdownCell(_nullishCoalesce(_optionalChain([rows, 'access', _299 => _299[0], 'optionalAccess', _300 => _300[0]]), () => ( ""))), seq, rowAnchor);
|
|
24271
24296
|
const colMax = Array(colCnt).fill(0);
|
|
24272
24297
|
const colMaxBody = Array(colCnt).fill(0);
|
|
24273
24298
|
const colMinWord = Array(colCnt).fill(0);
|
|
@@ -24295,7 +24320,7 @@ function generateTable(rows, theme, style = null, remap = null, seq = 0, images
|
|
|
24295
24320
|
const k = `${rowIdx},${colIdx}`;
|
|
24296
24321
|
const isLabelCell2 = labelCol0 && colIdx === 0;
|
|
24297
24322
|
const defaultCharPr = style ? reg && (isHeaderRow || isLabelCell2) ? style.boldCharPr : style.charPr : isHeaderRow ? headerCharPr : baseCharPr;
|
|
24298
|
-
const cellCharPr = _nullishCoalesce(_optionalChain([prof, 'optionalAccess',
|
|
24323
|
+
const cellCharPr = _nullishCoalesce(_optionalChain([prof, 'optionalAccess', _301 => _301.cellChar, 'access', _302 => _302.get, 'call', _303 => _303(k)]), () => ( defaultCharPr));
|
|
24299
24324
|
const centered = isHeaderRow || colCentered[colIdx];
|
|
24300
24325
|
const paraPrId = style ? centered ? _nullishCoalesce(style.tblCenterParaPr, () => ( style.centerParaPr)) : reg ? _nullishCoalesce(style.tblLeftParaPr, () => ( PARA_NORMAL)) : PARA_NORMAL : PARA_NORMAL;
|
|
24301
24326
|
const p = cell2.split(/<br\s*\/?>/i).map((seg) => {
|
|
@@ -24313,11 +24338,11 @@ function generateTable(rows, theme, style = null, remap = null, seq = 0, images
|
|
|
24313
24338
|
}
|
|
24314
24339
|
}
|
|
24315
24340
|
}
|
|
24316
|
-
const runs = generateRuns(seg, cellCharPr, _optionalChain([prof, 'optionalAccess',
|
|
24341
|
+
const runs = generateRuns(seg, cellCharPr, _optionalChain([prof, 'optionalAccess', _304 => _304.cellChar, 'access', _305 => _305.has, 'call', _306 => _306(k)]) ? void 0 : mapId);
|
|
24317
24342
|
const body = (runs || (picRuns ? "" : `<hp:run charPrIDRef="${cellCharPr}"><hp:t></hp:t></hp:run>`)) + picRuns;
|
|
24318
24343
|
return `<hp:p paraPrIDRef="${paraPrId}" styleIDRef="0">${body}</hp:p>`;
|
|
24319
24344
|
}).join("");
|
|
24320
|
-
const bf = _nullishCoalesce(_optionalChain([prof, 'optionalAccess',
|
|
24345
|
+
const bf = _nullishCoalesce(_optionalChain([prof, 'optionalAccess', _307 => _307.cellBf, 'access', _308 => _308.get, 'call', _309 => _309(k)]), () => ( (reg ? reg.get(dataCellSpec({
|
|
24321
24346
|
row: rowIdx,
|
|
24322
24347
|
rowEnd: rowIdx,
|
|
24323
24348
|
col: colIdx,
|
|
@@ -24327,7 +24352,7 @@ function generateTable(rows, theme, style = null, remap = null, seq = 0, images
|
|
|
24327
24352
|
headerRows: 1,
|
|
24328
24353
|
fill: isHeaderRow ? _nullishCoalesce(style.headerFill, () => ( "#E6E6E6")) : isLabelCell2 ? _nullishCoalesce(style.labelFill, () => ( "#E7E7E7")) : void 0
|
|
24329
24354
|
})) : style && isHeaderRow ? style.headerBf : 2)));
|
|
24330
|
-
const h = _nullishCoalesce(_optionalChain([prof, 'optionalAccess',
|
|
24355
|
+
const h = _nullishCoalesce(_optionalChain([prof, 'optionalAccess', _310 => _310.cellH, 'access', _311 => _311.get, 'call', _312 => _312(k)]), () => ( cellH));
|
|
24331
24356
|
return `<hp:tc name="" header="${isHeaderRow ? 1 : 0}" hasMargin="0" protect="0" editable="1" dirty="0" borderFillIDRef="${bf}"><hp:subList id="" textDirection="HORIZONTAL" lineWrap="BREAK" vertAlign="${style ? "CENTER" : "TOP"}" linkListIDRef="0" linkListNextIDRef="0" textWidth="0" textHeight="0" hasTextRef="0" hasNumRef="0">${p}</hp:subList><hp:cellAddr colAddr="${colIdx}" rowAddr="${rowIdx}"/><hp:cellSpan colSpan="1" rowSpan="1"/><hp:cellSz width="${colWidths[colIdx]}" height="${h}"/><hp:cellMargin left="141" right="141" top="141" bottom="141"/></hp:tc>`;
|
|
24332
24357
|
}).join("");
|
|
24333
24358
|
return `<hp:tr>${tdElements}</hp:tr>`;
|
|
@@ -24336,7 +24361,7 @@ function generateTable(rows, theme, style = null, remap = null, seq = 0, images
|
|
|
24336
24361
|
const tblH = rowHeights.reduce((a, b) => a + b, 0);
|
|
24337
24362
|
const tblInner = `<hp:sz width="${tblW}" widthRelTo="ABSOLUTE" height="${tblH}" heightRelTo="ABSOLUTE" protect="0"/><hp:pos treatAsChar="1" affectLSpacing="0" flowWithText="0" allowOverlap="0" holdAnchorAndSO="0" vertRelTo="PARA" horzRelTo="PARA" vertAlign="TOP" horzAlign="LEFT" vertOffset="0" horzOffset="0"/><hp:outMargin left="0" right="0" top="0" bottom="0"/><hp:inMargin left="510" right="510" top="141" bottom="141"/>` + trElements;
|
|
24338
24363
|
const tbl2 = `<hp:tbl id="${tblId}" zOrder="0" numberingType="TABLE" pageBreak="CELL" repeatHeader="${style ? 1 : 0}" rowCnt="${rowCnt}" colCnt="${colCnt}" cellSpacing="0" borderFillIDRef="2" noShading="0">${tblInner}</hp:tbl>`;
|
|
24339
|
-
const hostPr = reg && _optionalChain([style, 'optionalAccess',
|
|
24364
|
+
const hostPr = reg && _optionalChain([style, 'optionalAccess', _313 => _313.rightParaPr]) !== void 0 ? style.rightParaPr : 0;
|
|
24340
24365
|
return `<hp:p paraPrIDRef="${hostPr}" styleIDRef="0"><hp:run charPrIDRef="0">${tbl2}</hp:run></hp:p>`;
|
|
24341
24366
|
}
|
|
24342
24367
|
function layoutHtmlRows(rows) {
|
|
@@ -24347,8 +24372,8 @@ function layoutHtmlRows(rows) {
|
|
|
24347
24372
|
let c = 0;
|
|
24348
24373
|
for (const cell2 of rows[r].cells) {
|
|
24349
24374
|
while (occupied.has(`${r},${c}`)) c++;
|
|
24350
|
-
const colSpan = clampSpan(cell2.colSpan,
|
|
24351
|
-
const rowSpan = clampSpan(cell2.rowSpan,
|
|
24375
|
+
const colSpan = clampSpan(cell2.colSpan, _chunk6GM2QLM3cjs.MAX_COLS);
|
|
24376
|
+
const rowSpan = clampSpan(cell2.rowSpan, _chunk6GM2QLM3cjs.MAX_ROWS);
|
|
24352
24377
|
placed.push({ r, c, colSpan, rowSpan, inner: cell2.inner, isHeader: rows[r].tag === "th" });
|
|
24353
24378
|
for (let dr = 0; dr < rowSpan; dr++) {
|
|
24354
24379
|
for (let dc = 0; dc < colSpan; dc++) occupied.add(`${r + dr},${c + dc}`);
|
|
@@ -24376,7 +24401,7 @@ function generateHtmlTableXml(rawHtml, theme, totalWidth = 44e3, style = null, r
|
|
|
24376
24401
|
if (!rows || rows.length === 0) return null;
|
|
24377
24402
|
const { placed, rowCnt, colCnt } = layoutHtmlRows(rows);
|
|
24378
24403
|
if (rowCnt === 0 || colCnt === 0) return null;
|
|
24379
|
-
const measureH = _nullishCoalesce(_optionalChain([style, 'optionalAccess',
|
|
24404
|
+
const measureH = _nullishCoalesce(_optionalChain([style, 'optionalAccess', _314 => _314.charHeight]), () => ( 1e3));
|
|
24380
24405
|
const first = _nullishCoalesce(placed.find((p) => p.r === 0 && p.c === 0), () => ( placed[0]));
|
|
24381
24406
|
const row0 = Array.from({ length: colCnt }, () => "");
|
|
24382
24407
|
for (const cell2 of placed) {
|
|
@@ -24405,7 +24430,7 @@ function generateHtmlTableXml(rawHtml, theme, totalWidth = 44e3, style = null, r
|
|
|
24405
24430
|
const tblId = nextTableId();
|
|
24406
24431
|
const useHeaderStyle = !style && (theme.tableHeader !== theme.body || theme.tableHeaderBold);
|
|
24407
24432
|
const spanW = (cell2) => colWidths.slice(cell2.c, cell2.c + cell2.colSpan).reduce((a, b) => a + b, 0);
|
|
24408
|
-
const reg = _nullishCoalesce(_optionalChain([style, 'optionalAccess',
|
|
24433
|
+
const reg = _nullishCoalesce(_optionalChain([style, 'optionalAccess', _315 => _315.bfRegistry]), () => ( null));
|
|
24409
24434
|
let htmlHeaderRows = 0;
|
|
24410
24435
|
while (htmlHeaderRows < rows.length && rows[htmlHeaderRows].tag === "th") htmlHeaderRows++;
|
|
24411
24436
|
const tableRowHeights = Array(rowCnt).fill(cellH);
|
|
@@ -24419,7 +24444,7 @@ function generateHtmlTableXml(rawHtml, theme, totalWidth = 44e3, style = null, r
|
|
|
24419
24444
|
const nestedW = Math.max(Math.min(Math.max(sw - 1020, 4e3), sw - 282), 500);
|
|
24420
24445
|
const nestedXml = generateHtmlTableXml(nested, theme, nestedW, style ? { ...style, totalWidth: nestedW } : null);
|
|
24421
24446
|
if (nestedXml) {
|
|
24422
|
-
const szH = _optionalChain([nestedXml, 'access',
|
|
24447
|
+
const szH = _optionalChain([nestedXml, 'access', _316 => _316.match, 'call', _317 => _317(/<hp:sz [^>]*height="(\d+)"/), 'optionalAccess', _318 => _318[1]]);
|
|
24423
24448
|
nestedH += (szH ? Number(szH) : (_nullishCoalesce(nested.match(/<tr[\s>]/gi), () => ( []))).length * cellH) + 300;
|
|
24424
24449
|
}
|
|
24425
24450
|
return nestedXml;
|
|
@@ -24430,7 +24455,7 @@ function generateHtmlTableXml(rawHtml, theme, totalWidth = 44e3, style = null, r
|
|
|
24430
24455
|
for (const line of lines) wrapLines += Math.max(1, Math.ceil(measureTextWidth(unescapeHtml(line).trim(), measureH, 100) / usable));
|
|
24431
24456
|
const lineH = style ? Math.round(measureH * 1.6) : 800;
|
|
24432
24457
|
const contentH = Math.max(cellH * rowSpan, Math.max(wrapLines, 1) * lineH + nestedH);
|
|
24433
|
-
const cellHeight = Math.max(_nullishCoalesce(_optionalChain([prof, 'optionalAccess',
|
|
24458
|
+
const cellHeight = Math.max(_nullishCoalesce(_optionalChain([prof, 'optionalAccess', _319 => _319.cellH, 'access', _320 => _320.get, 'call', _321 => _321(`${cell2.r},${cell2.c}`)]), () => ( 0)), contentH);
|
|
24434
24459
|
const perRow = Math.ceil(cellHeight / rowSpan);
|
|
24435
24460
|
for (let r = cell2.r; r < cell2.r + rowSpan; r++) tableRowHeights[r] = Math.max(tableRowHeights[r], perRow);
|
|
24436
24461
|
return { cell: cell2, rowSpan, lines, nestedXmls, segLines, imgSrcs: cellParsed[i].imgSrcs };
|
|
@@ -24441,7 +24466,7 @@ function generateHtmlTableXml(rawHtml, theme, totalWidth = 44e3, style = null, r
|
|
|
24441
24466
|
const baseCharPr = style ? style.charPr : CHAR_NORMAL;
|
|
24442
24467
|
const headerCharPr = isHeader && useHeaderStyle ? CHAR_TABLE_HEADER : baseCharPr;
|
|
24443
24468
|
const defaultCharPr = style && reg && isHeader ? style.boldCharPr : isHeader ? headerCharPr : baseCharPr;
|
|
24444
|
-
const charPrId = _nullishCoalesce(_optionalChain([prof, 'optionalAccess',
|
|
24469
|
+
const charPrId = _nullishCoalesce(_optionalChain([prof, 'optionalAccess', _322 => _322.cellChar, 'access', _323 => _323.get, 'call', _324 => _324(k)]), () => ( defaultCharPr));
|
|
24445
24470
|
const centered = isHeader || colCentered[cell2.c];
|
|
24446
24471
|
const paraPrId = style ? centered ? reg ? _nullishCoalesce(style.tblCenterParaPr, () => ( style.centerParaPr)) : style.centerParaPr : reg ? _nullishCoalesce(style.tblLeftParaPr, () => ( PARA_NORMAL)) : PARA_NORMAL : PARA_NORMAL;
|
|
24447
24472
|
const picUrls = images ? [...imgSrcs] : [];
|
|
@@ -24481,7 +24506,7 @@ function generateHtmlTableXml(rawHtml, theme, totalWidth = 44e3, style = null, r
|
|
|
24481
24506
|
let cellHeight = 0;
|
|
24482
24507
|
for (let r = cell2.r; r < cell2.r + rowSpan; r++) cellHeight += tableRowHeights[r];
|
|
24483
24508
|
const rowEnd = cell2.r + rowSpan - 1;
|
|
24484
|
-
const bf = _nullishCoalesce(_optionalChain([prof, 'optionalAccess',
|
|
24509
|
+
const bf = _nullishCoalesce(_optionalChain([prof, 'optionalAccess', _325 => _325.cellBf, 'access', _326 => _326.get, 'call', _327 => _327(k)]), () => ( (reg ? reg.get(dataCellSpec({
|
|
24485
24510
|
row: cell2.r,
|
|
24486
24511
|
rowEnd,
|
|
24487
24512
|
col: cell2.c,
|
|
@@ -24651,7 +24676,7 @@ function buildPressHead(g, ids, bodyWidth, reg) {
|
|
|
24651
24676
|
return [`<hp:p paraPrIDRef="${PARA_NORMAL}" styleIDRef="0"><hp:run charPrIDRef="${CHAR_NORMAL}">${table2}</hp:run></hp:p>`, blank()];
|
|
24652
24677
|
}
|
|
24653
24678
|
function buildPressContact(g, ids, bodyWidth, reg) {
|
|
24654
|
-
const c = _optionalChain([g, 'access',
|
|
24679
|
+
const c = _optionalChain([g, 'access', _328 => _328.press, 'optionalAccess', _329 => _329.contact]);
|
|
24655
24680
|
if (!c || !c.dept && !c.manager && !c.phone) return [];
|
|
24656
24681
|
const w = bodyWidth - 280;
|
|
24657
24682
|
const cells = [["\uB2F4\uB2F9 \uBD80\uC11C", _nullishCoalesce(c.dept, () => ( ""))], ["\uB2F4\uB2F9\uC790", _nullishCoalesce(c.manager, () => ( ""))], ["\uC5F0\uB77D\uCC98", _nullishCoalesce(c.phone, () => ( ""))]];
|
|
@@ -25032,7 +25057,7 @@ function generateSecPr(gongmun) {
|
|
|
25032
25057
|
}
|
|
25033
25058
|
const secPr = `<hp:secPr textDirection="HORIZONTAL" spaceColumns="1134" tabStop="8000" outlineShapeIDRef="1" memoShapeIDRef="0" textVerticalWidthHead="0" masterPageCnt="0"><hp:grid lineGrid="0" charGrid="0" wonggojiFormat="0"/><hp:startNum pageStartsOn="BOTH" page="0" pic="0" tbl="0" equation="0"/><hp:visibility hideFirstHeader="0" hideFirstFooter="0" hideFirstMasterPage="0" border="SHOW_ALL" fill="SHOW_ALL" hideFirstPageNum="0" hideFirstEmptyLine="0" showLineNumber="0"/><hp:pagePr landscape="WIDELY" width="${A4_W_HU}" height="${A4_H_HU}" gutterType="LEFT_ONLY"><hp:margin header="${m.header}" footer="${m.footer}" gutter="0" left="${m.left}" right="${m.right}" top="${m.top}" bottom="${m.bottom}"/></hp:pagePr><hp:footNotePr><hp:autoNumFormat type="DIGIT" userChar="" prefixChar="" suffixChar=")" supscript="0"/><hp:noteLine length="-1" type="SOLID" width="0.12 mm" color="#000000"/><hp:noteSpacing betweenNotes="283" belowLine="567" aboveLine="850"/><hp:numbering type="CONTINUOUS" newNum="1"/><hp:placement place="EACH_COLUMN" beneathText="0"/></hp:footNotePr><hp:endNotePr><hp:autoNumFormat type="DIGIT" userChar="" prefixChar="" suffixChar=")" supscript="0"/><hp:noteLine length="14692344" type="SOLID" width="0.12 mm" color="#000000"/><hp:noteSpacing betweenNotes="0" belowLine="567" aboveLine="850"/><hp:numbering type="CONTINUOUS" newNum="1"/><hp:placement place="END_OF_DOCUMENT" beneathText="0"/></hp:endNotePr></hp:secPr>`;
|
|
25034
25059
|
const colPr = `<hp:ctrl><hp:colPr id="" type="NEWSPAPER" layout="LEFT" colCount="1" sameSz="1" sameGap="0"/></hp:ctrl>`;
|
|
25035
|
-
return secPr + colPr + (_optionalChain([gongmun, 'optionalAccess',
|
|
25060
|
+
return secPr + colPr + (_optionalChain([gongmun, 'optionalAccess', _330 => _330.pageNumbers]) ? pageNumCtrl() : "");
|
|
25036
25061
|
}
|
|
25037
25062
|
var SectionOpener = (_class6 = class {
|
|
25038
25063
|
constructor(gongmun) {;_class6.prototype.__init12.call(this);
|
|
@@ -25071,19 +25096,19 @@ function buildPreamble(blocks, ctx) {
|
|
|
25071
25096
|
const { gongmun, dfIds, bfReg, tableStyle, richAssets, gjBodyW } = ctx;
|
|
25072
25097
|
const preamble = [];
|
|
25073
25098
|
let hasFrontPages = false;
|
|
25074
|
-
if (_optionalChain([gongmun, 'optionalAccess',
|
|
25099
|
+
if (_optionalChain([gongmun, 'optionalAccess', _331 => _331.reportInfo]) && dfIds) {
|
|
25075
25100
|
preamble.push(buildReportInfo(gongmun, dfIds));
|
|
25076
25101
|
}
|
|
25077
|
-
if (_optionalChain([gongmun, 'optionalAccess',
|
|
25102
|
+
if (_optionalChain([gongmun, 'optionalAccess', _332 => _332.approval]) && bfReg) {
|
|
25078
25103
|
preamble.push(buildApprovalTable(gongmun.approval, bfReg, richAssets ? GJ_CHAR_APPROVAL : GONGMUN_APPROVAL_CHAR));
|
|
25079
25104
|
}
|
|
25080
|
-
if (_optionalChain([gongmun, 'optionalAccess',
|
|
25105
|
+
if (_optionalChain([gongmun, 'optionalAccess', _333 => _333.docHead]) && dfIds) {
|
|
25081
25106
|
preamble.push(...buildDocHead(gongmun, dfIds));
|
|
25082
25107
|
}
|
|
25083
|
-
if (_optionalChain([gongmun, 'optionalAccess',
|
|
25108
|
+
if (_optionalChain([gongmun, 'optionalAccess', _334 => _334.noticeHead]) && dfIds) {
|
|
25084
25109
|
preamble.push(...buildNoticeHead(gongmun));
|
|
25085
25110
|
}
|
|
25086
|
-
if (_optionalChain([gongmun, 'optionalAccess',
|
|
25111
|
+
if (_optionalChain([gongmun, 'optionalAccess', _335 => _335.press]) && dfIds && bfReg && tableStyle) {
|
|
25087
25112
|
preamble.push(...buildPressHead(gongmun, dfIds, tableStyle.totalWidth, bfReg));
|
|
25088
25113
|
}
|
|
25089
25114
|
if (gongmun && (gongmun.cover || gongmun.toc)) {
|
|
@@ -25112,7 +25137,7 @@ function buildPreamble(blocks, ctx) {
|
|
|
25112
25137
|
}
|
|
25113
25138
|
if (gongmun && !ctx.gaejosik && ctx.coverH1Idx < 0 && bfReg && (gongmun.preset === "report" || gongmun.preset === "plan" || gongmun.preset === "notice")) {
|
|
25114
25139
|
ctx.titleBoxH1Idx = blocks.findIndex((b) => b.type === "heading" && (_nullishCoalesce(b.level, () => ( 1))) === 1);
|
|
25115
|
-
} else if (_optionalChain([gongmun, 'optionalAccess',
|
|
25140
|
+
} else if (_optionalChain([gongmun, 'optionalAccess', _336 => _336.press]) && ctx.coverH1Idx < 0 && dfIds) {
|
|
25116
25141
|
ctx.pressH1Idx = blocks.findIndex((b) => b.type === "heading" && (_nullishCoalesce(b.level, () => ( 1))) === 1);
|
|
25117
25142
|
}
|
|
25118
25143
|
if (preamble.length > 0) {
|
|
@@ -25127,7 +25152,7 @@ function renderHeading(block, blockIdx, ctx) {
|
|
|
25127
25152
|
if (gongmun && blockIdx === ctx.coverH1Idx) return "";
|
|
25128
25153
|
if (gongmun && blockIdx === ctx.pressH1Idx && dfIds) {
|
|
25129
25154
|
const parts = [generateParagraph((block.text || "").trim(), GONGMUN_CENTER, dfIds.pressTitle)];
|
|
25130
|
-
for (const s of _nullishCoalesce(_optionalChain([gongmun, 'access',
|
|
25155
|
+
for (const s of _nullishCoalesce(_optionalChain([gongmun, 'access', _337 => _337.press, 'optionalAccess', _338 => _338.sub]), () => ( []))) {
|
|
25131
25156
|
parts.push(generateParagraph(`- ${s} -`, GONGMUN_CENTER, dfIds.pressSub));
|
|
25132
25157
|
}
|
|
25133
25158
|
return parts.join("\n ");
|
|
@@ -25221,8 +25246,8 @@ function renderListItem(block, blockIdx, ctx) {
|
|
|
25221
25246
|
const { gongmun, gongmunList, measured, fit, vBase, dfIds } = ctx;
|
|
25222
25247
|
if (gongmun && gongmunList) {
|
|
25223
25248
|
const info = gongmunList.items.get(blockIdx);
|
|
25224
|
-
const depth = _nullishCoalesce(_optionalChain([info, 'optionalAccess',
|
|
25225
|
-
const marker2 = _nullishCoalesce(_optionalChain([info, 'optionalAccess',
|
|
25249
|
+
const depth = _nullishCoalesce(_optionalChain([info, 'optionalAccess', _339 => _339.depth]), () => ( 0));
|
|
25250
|
+
const marker2 = _nullishCoalesce(_optionalChain([info, 'optionalAccess', _340 => _340.marker]), () => ( ""));
|
|
25226
25251
|
const content = block.text || "";
|
|
25227
25252
|
if (measured && content.trimStart().startsWith("\u203B")) {
|
|
25228
25253
|
return generateParagraph(content.trim(), GJ_PARA_CHAM, GJ_CHAR_CHAM, ctx.chamMap);
|
|
@@ -25231,7 +25256,7 @@ function renderListItem(block, blockIdx, ctx) {
|
|
|
25231
25256
|
return generateParagraph(`* ${content.trim()}`, GJ_PARA_CHAM, GJ_CHAR_CHAM, ctx.chamMap);
|
|
25232
25257
|
}
|
|
25233
25258
|
const text = marker2 ? `${marker2} ${content}` : content;
|
|
25234
|
-
const listParaPr = marker2 ? _optionalChain([info, 'optionalAccess',
|
|
25259
|
+
const listParaPr = marker2 ? _optionalChain([info, 'optionalAccess', _341 => _341.indentVariant]) !== void 0 ? GONGMUN_LIST_VARIANT_BASE + info.indentVariant : GONGMUN_LIST_BASE + depth : GONGMUN_LIST_PLAIN_BASE + depth;
|
|
25235
25260
|
let listCharPr = gongmun.numbering === "report" && depth === 0 ? CHAR_BOLD : CHAR_NORMAL;
|
|
25236
25261
|
let mapId = fit ? variantMapper(fit, blockIdx, vBase) : void 0;
|
|
25237
25262
|
if (measured && depth === 0 && gongmun.numbering !== "standard") {
|
|
@@ -25290,18 +25315,18 @@ function renderHtmlTable(block, ctx) {
|
|
|
25290
25315
|
}
|
|
25291
25316
|
function appendPostamble(blocks, ctx) {
|
|
25292
25317
|
const { gongmun, dfIds, bfReg, tableStyle, paraXmls } = ctx;
|
|
25293
|
-
if (_optionalChain([gongmun, 'optionalAccess',
|
|
25318
|
+
if (_optionalChain([gongmun, 'optionalAccess', _342 => _342.noticeHead]) && dfIds) {
|
|
25294
25319
|
paraXmls.push(...buildNoticeFoot(gongmun));
|
|
25295
25320
|
}
|
|
25296
|
-
if (_optionalChain([gongmun, 'optionalAccess',
|
|
25297
|
-
const lastBlock = [...blocks].reverse().find((b) => (b.text || "").trim() || b.type === "table" && _optionalChain([b, 'access',
|
|
25321
|
+
if (_optionalChain([gongmun, 'optionalAccess', _343 => _343.endMark]) && paraXmls.length > 0) {
|
|
25322
|
+
const lastBlock = [...blocks].reverse().find((b) => (b.text || "").trim() || b.type === "table" && _optionalChain([b, 'access', _344 => _344.rows, 'optionalAccess', _345 => _345.length]));
|
|
25298
25323
|
const lastText = lastBlock && (lastBlock.type === "paragraph" || lastBlock.type === "list_item") ? lastBlock.text || "" : "";
|
|
25299
25324
|
if (!hasEndMark(lastText)) paraXmls.push(buildEndMark());
|
|
25300
25325
|
}
|
|
25301
|
-
if (_optionalChain([gongmun, 'optionalAccess',
|
|
25326
|
+
if (_optionalChain([gongmun, 'optionalAccess', _346 => _346.docFoot]) && dfIds) {
|
|
25302
25327
|
paraXmls.push(...buildDocFoot(gongmun, dfIds));
|
|
25303
25328
|
}
|
|
25304
|
-
if (_optionalChain([gongmun, 'optionalAccess',
|
|
25329
|
+
if (_optionalChain([gongmun, 'optionalAccess', _347 => _347.press]) && dfIds && bfReg && tableStyle) {
|
|
25305
25330
|
paraXmls.push(...buildPressContact(gongmun, dfIds, tableStyle.totalWidth, bfReg));
|
|
25306
25331
|
}
|
|
25307
25332
|
}
|
|
@@ -25321,7 +25346,7 @@ function blocksToSectionXml(blocks, theme, gongmun, gongmunList = gongmun ? prec
|
|
|
25321
25346
|
remap,
|
|
25322
25347
|
dfIds,
|
|
25323
25348
|
images,
|
|
25324
|
-
gaejosik: _optionalChain([gongmun, 'optionalAccess',
|
|
25349
|
+
gaejosik: _optionalChain([gongmun, 'optionalAccess', _348 => _348.preset]) === "gaejosik",
|
|
25325
25350
|
measured,
|
|
25326
25351
|
richAssets,
|
|
25327
25352
|
vBase: charVariantBase(richAssets, !!gongmun),
|
|
@@ -25427,18 +25452,18 @@ function blocksToSectionXml(blocks, theme, gongmun, gongmunList = gongmun ? prec
|
|
|
25427
25452
|
|
|
25428
25453
|
// src/hwpx/generator.ts
|
|
25429
25454
|
async function markdownToHwpx(markdown, options) {
|
|
25430
|
-
const theme = resolveTheme(_optionalChain([options, 'optionalAccess',
|
|
25431
|
-
const gongmun = _optionalChain([options, 'optionalAccess',
|
|
25455
|
+
const theme = resolveTheme(_optionalChain([options, 'optionalAccess', _349 => _349.theme]));
|
|
25456
|
+
const gongmun = _optionalChain([options, 'optionalAccess', _350 => _350.gongmun]) ? resolveGongmun(options.gongmun) : null;
|
|
25432
25457
|
const measured = !!gongmun && usesReportFonts(gongmun.preset);
|
|
25433
25458
|
const richAssets = !!gongmun && needsGaejosikAssets(gongmun);
|
|
25434
25459
|
const blocks = parseMarkdownToBlocks(markdown);
|
|
25435
25460
|
const gongmunList = gongmun ? precomputeGongmunList(blocks, gongmun) : null;
|
|
25436
25461
|
const fit = gongmun && gongmunList ? computeGongmunFitPlan(blocks, gongmun, gongmunList) : null;
|
|
25437
25462
|
const staticBfEnd = staticBorderFillNext(gongmun);
|
|
25438
|
-
const remap = _optionalChain([options, 'optionalAccess',
|
|
25439
|
-
const bfReg = gongmun ? new TableBfRegistry(staticBfEnd + (_nullishCoalesce(_optionalChain([remap, 'optionalAccess',
|
|
25463
|
+
const remap = _optionalChain([options, 'optionalAccess', _351 => _351.profile]) ? buildProfileRemap(options.profile, charVariantBase(richAssets, !!gongmun) + (_nullishCoalesce(_optionalChain([fit, 'optionalAccess', _352 => _352.variants, 'optionalAccess', _353 => _353.length]), () => ( 0))) * 4, staticBfEnd, staticFontNext(gongmun)) : null;
|
|
25464
|
+
const bfReg = gongmun ? new TableBfRegistry(staticBfEnd + (_nullishCoalesce(_optionalChain([remap, 'optionalAccess', _354 => _354.borderFillXmls, 'access', _355 => _355.length]), () => ( 0)))) : null;
|
|
25440
25465
|
const dfActive = !!gongmun && docframeActive(gongmun);
|
|
25441
|
-
const dfBase = charVariantBase(richAssets, !!gongmun) + (_nullishCoalesce(_optionalChain([fit, 'optionalAccess',
|
|
25466
|
+
const dfBase = charVariantBase(richAssets, !!gongmun) + (_nullishCoalesce(_optionalChain([fit, 'optionalAccess', _356 => _356.variants, 'optionalAccess', _357 => _357.length]), () => ( 0))) * 4 + (_nullishCoalesce(_optionalChain([remap, 'optionalAccess', _358 => _358.charPrXmls, 'access', _359 => _359.length]), () => ( 0)));
|
|
25442
25467
|
const dfIds = dfActive ? docframeIds(dfBase) : null;
|
|
25443
25468
|
const chartParts = [];
|
|
25444
25469
|
const images = new ImageRegistry();
|
|
@@ -25449,7 +25474,7 @@ async function markdownToHwpx(markdown, options) {
|
|
|
25449
25474
|
console.warn(`[kordoc] format profile: \uD504\uB85C\uD544 \uD45C ${unused}\uAC1C\uAC00 \uBB38\uC11C \uD45C\uC640 \uB9E4\uCE6D\uB418\uC9C0 \uC54A\uC544 \uBBF8\uC801\uC6A9 (\uD589\xB7\uC5F4/\uCCAB \uC140 \uD14D\uC2A4\uD2B8 \uBD88\uC77C\uCE58)`);
|
|
25450
25475
|
}
|
|
25451
25476
|
}
|
|
25452
|
-
const extraBorderFills = [..._nullishCoalesce(_optionalChain([remap, 'optionalAccess',
|
|
25477
|
+
const extraBorderFills = [..._nullishCoalesce(_optionalChain([remap, 'optionalAccess', _360 => _360.borderFillXmls]), () => ( [])), ..._nullishCoalesce(_optionalChain([bfReg, 'optionalAccess', _361 => _361.emit, 'call', _362 => _362()]), () => ( []))];
|
|
25453
25478
|
const zip = new (0, _jszip2.default)();
|
|
25454
25479
|
zip.file("mimetype", "application/hwp+zip", { compression: "STORE" });
|
|
25455
25480
|
zip.file("META-INF/container.xml", generateContainerXml());
|
|
@@ -25458,11 +25483,11 @@ async function markdownToHwpx(markdown, options) {
|
|
|
25458
25483
|
zip.file("Contents/header.xml", generateHeaderXml(
|
|
25459
25484
|
theme,
|
|
25460
25485
|
gongmun,
|
|
25461
|
-
_nullishCoalesce(_optionalChain([fit, 'optionalAccess',
|
|
25486
|
+
_nullishCoalesce(_optionalChain([fit, 'optionalAccess', _363 => _363.variants]), () => ( [])),
|
|
25462
25487
|
extraBorderFills,
|
|
25463
|
-
[..._nullishCoalesce(_optionalChain([remap, 'optionalAccess',
|
|
25464
|
-
_nullishCoalesce(_optionalChain([gongmunList, 'optionalAccess',
|
|
25465
|
-
_nullishCoalesce(_optionalChain([remap, 'optionalAccess',
|
|
25488
|
+
[..._nullishCoalesce(_optionalChain([remap, 'optionalAccess', _364 => _364.charPrXmls]), () => ( [])), ...dfActive ? docframeCharPrXmls(dfBase, richAssets) : []],
|
|
25489
|
+
_nullishCoalesce(_optionalChain([gongmunList, 'optionalAccess', _365 => _365.indentVariants]), () => ( [])),
|
|
25490
|
+
_nullishCoalesce(_optionalChain([remap, 'optionalAccess', _366 => _366.fontFaces]), () => ( []))
|
|
25466
25491
|
));
|
|
25467
25492
|
zip.file("Contents/section0.xml", sectionXml);
|
|
25468
25493
|
for (const part of chartParts) zip.file(part.name, part.xml);
|
|
@@ -25513,7 +25538,7 @@ function alignBlocks(a, b) {
|
|
|
25513
25538
|
const m = a.length, n = b.length;
|
|
25514
25539
|
if (m * n > 1e7) return fallbackAlign(a, b);
|
|
25515
25540
|
const lenOf = (blk) => {
|
|
25516
|
-
const t = blk.text !== void 0 ? blk.text : blk.type === "table" && blk.table ? blk.table.cells.flat().map((c) => _nullishCoalesce(_optionalChain([c, 'optionalAccess',
|
|
25541
|
+
const t = blk.text !== void 0 ? blk.text : blk.type === "table" && blk.table ? blk.table.cells.flat().map((c) => _nullishCoalesce(_optionalChain([c, 'optionalAccess', _367 => _367.text]), () => ( ""))).join(" ") : "";
|
|
25517
25542
|
return t.replace(/\s+/g, " ").trim().length;
|
|
25518
25543
|
};
|
|
25519
25544
|
const aLen = a.map(lenOf);
|
|
@@ -25586,8 +25611,8 @@ function blockSimilarity(a, b) {
|
|
|
25586
25611
|
}
|
|
25587
25612
|
function tableSimilarity(a, b) {
|
|
25588
25613
|
const dimSim = 1 - Math.abs(a.rows * a.cols - b.rows * b.cols) / Math.max(a.rows * a.cols, b.rows * b.cols, 1);
|
|
25589
|
-
const textsA = a.cells.flat().map((c) => _nullishCoalesce(_optionalChain([c, 'optionalAccess',
|
|
25590
|
-
const textsB = b.cells.flat().map((c) => _nullishCoalesce(_optionalChain([c, 'optionalAccess',
|
|
25614
|
+
const textsA = a.cells.flat().map((c) => _nullishCoalesce(_optionalChain([c, 'optionalAccess', _368 => _368.text]), () => ( ""))).join(" ");
|
|
25615
|
+
const textsB = b.cells.flat().map((c) => _nullishCoalesce(_optionalChain([c, 'optionalAccess', _369 => _369.text]), () => ( ""))).join(" ");
|
|
25591
25616
|
const contentSim = normalizedSimilarity(textsA, textsB);
|
|
25592
25617
|
return dimSim * 0.3 + contentSim * 0.7;
|
|
25593
25618
|
}
|
|
@@ -25598,8 +25623,8 @@ function diffTableCells(a, b) {
|
|
|
25598
25623
|
for (let r = 0; r < maxRows; r++) {
|
|
25599
25624
|
const row = [];
|
|
25600
25625
|
for (let c = 0; c < maxCols; c++) {
|
|
25601
|
-
const cellA = r < a.rows && c < a.cols ? _optionalChain([a, 'access',
|
|
25602
|
-
const cellB = r < b.rows && c < b.cols ? _optionalChain([b, 'access',
|
|
25626
|
+
const cellA = r < a.rows && c < a.cols ? _optionalChain([a, 'access', _370 => _370.cells, 'access', _371 => _371[r], 'optionalAccess', _372 => _372[c], 'optionalAccess', _373 => _373.text]) : void 0;
|
|
25627
|
+
const cellB = r < b.rows && c < b.cols ? _optionalChain([b, 'access', _374 => _374.cells, 'access', _375 => _375[r], 'optionalAccess', _376 => _376[c], 'optionalAccess', _377 => _377.text]) : void 0;
|
|
25603
25628
|
let type;
|
|
25604
25629
|
if (cellA === void 0) type = "added";
|
|
25605
25630
|
else if (cellB === void 0) type = "removed";
|
|
@@ -25765,7 +25790,7 @@ function parseRenderStyles(headXml) {
|
|
|
25765
25790
|
const underlineEl = findChildByLocalName(el, "underline");
|
|
25766
25791
|
const textColor = el.getAttribute("textColor");
|
|
25767
25792
|
const fontRef = findChildByLocalName(el, "fontRef");
|
|
25768
|
-
const fontId = _nullishCoalesce(_optionalChain([fontRef, 'optionalAccess',
|
|
25793
|
+
const fontId = _nullishCoalesce(_optionalChain([fontRef, 'optionalAccess', _378 => _378.getAttribute, 'call', _379 => _379("hangul")]), () => ( _optionalChain([fontRef, 'optionalAccess', _380 => _380.getAttribute, 'call', _381 => _381("latin")])));
|
|
25769
25794
|
const face = fontId != null ? hangulFonts.get(fontId) : void 0;
|
|
25770
25795
|
styles.charPr.set(id, {
|
|
25771
25796
|
height: Number(el.getAttribute("height")) || 1e3,
|
|
@@ -25773,8 +25798,8 @@ function parseRenderStyles(headXml) {
|
|
|
25773
25798
|
italic: findChildByLocalName(el, "italic") != null,
|
|
25774
25799
|
underline: underlineEl != null && (_nullishCoalesce(underlineEl.getAttribute("type"), () => ( "NONE"))) !== "NONE",
|
|
25775
25800
|
color: textColor && textColor !== "#000000" && textColor.toLowerCase() !== "none" ? textColor : void 0,
|
|
25776
|
-
ratio: Number(_optionalChain([ratioEl, 'optionalAccess',
|
|
25777
|
-
spacing: Number(_optionalChain([spacingEl, 'optionalAccess',
|
|
25801
|
+
ratio: Number(_optionalChain([ratioEl, 'optionalAccess', _382 => _382.getAttribute, 'call', _383 => _383("hangul")])) || 100,
|
|
25802
|
+
spacing: Number(_optionalChain([spacingEl, 'optionalAccess', _384 => _384.getAttribute, 'call', _385 => _385("hangul")])) || 0,
|
|
25778
25803
|
fontFamily: face ? hwpFaceToCssStack(face) : void 0,
|
|
25779
25804
|
face
|
|
25780
25805
|
});
|
|
@@ -25783,7 +25808,7 @@ function parseRenderStyles(headXml) {
|
|
|
25783
25808
|
const id = el.getAttribute("id");
|
|
25784
25809
|
if (id != null) {
|
|
25785
25810
|
const align = findChildByLocalName(el, "align");
|
|
25786
|
-
styles.paraAlign.set(id, _optionalChain([align, 'optionalAccess',
|
|
25811
|
+
styles.paraAlign.set(id, _optionalChain([align, 'optionalAccess', _386 => _386.getAttribute, 'call', _387 => _387("horizontal")]) || "JUSTIFY");
|
|
25787
25812
|
styles.paraGeom.set(id, parseParaGeom(el));
|
|
25788
25813
|
}
|
|
25789
25814
|
} else if (tag === "borderFill") {
|
|
@@ -25797,7 +25822,7 @@ function parseRenderStyles(headXml) {
|
|
|
25797
25822
|
};
|
|
25798
25823
|
const fillBrush = findChildByLocalName(el, "fillBrush");
|
|
25799
25824
|
const winBrush = fillBrush ? findChildByLocalName(fillBrush, "winBrush") : null;
|
|
25800
|
-
const face = _optionalChain([winBrush, 'optionalAccess',
|
|
25825
|
+
const face = _optionalChain([winBrush, 'optionalAccess', _388 => _388.getAttribute, 'call', _389 => _389("faceColor")]);
|
|
25801
25826
|
if (face && face.toLowerCase() !== "none") bf.fill = face;
|
|
25802
25827
|
styles.borderFill.set(id, bf);
|
|
25803
25828
|
}
|
|
@@ -25869,7 +25894,7 @@ function collectSites(scan) {
|
|
|
25869
25894
|
}
|
|
25870
25895
|
function attrOf(openTag, name) {
|
|
25871
25896
|
const m = openTag.match(new RegExp(`\\b${name}="([^"]*)"`));
|
|
25872
|
-
return _optionalChain([m, 'optionalAccess',
|
|
25897
|
+
return _optionalChain([m, 'optionalAccess', _390 => _390[1]]);
|
|
25873
25898
|
}
|
|
25874
25899
|
function paraOpenTag(xml, para2) {
|
|
25875
25900
|
const end = xml.indexOf(">", para2.start);
|
|
@@ -25884,7 +25909,7 @@ function anchorRunInfo(xml, para2, anchor) {
|
|
|
25884
25909
|
if (!tr) return null;
|
|
25885
25910
|
const before = xml.slice(Math.max(0, para2.start), tr.contentStart);
|
|
25886
25911
|
const runOpen = [...before.matchAll(/<([A-Za-z0-9]+):run\b[^>]*>/g)].pop();
|
|
25887
|
-
const prefix = _nullishCoalesce(_nullishCoalesce(_optionalChain([runOpen, 'optionalAccess',
|
|
25912
|
+
const prefix = _nullishCoalesce(_nullishCoalesce(_optionalChain([runOpen, 'optionalAccess', _391 => _391[1]]), () => ( tr.prefix)), () => ( "hp"));
|
|
25888
25913
|
const charPr2 = runOpen && attrOf(runOpen[0], "charPrIDRef") || "0";
|
|
25889
25914
|
const close = xml.indexOf(`</${prefix}:run>`, tr.contentEnd);
|
|
25890
25915
|
if (close === -1) return null;
|
|
@@ -25911,7 +25936,7 @@ function cellContentWidthMm(xml, cell2) {
|
|
|
25911
25936
|
if (width === null) return null;
|
|
25912
25937
|
let content = width;
|
|
25913
25938
|
const win = cellAddrWindow(xml, cell2);
|
|
25914
|
-
const mg = _optionalChain([win, 'optionalAccess',
|
|
25939
|
+
const mg = _optionalChain([win, 'optionalAccess', _392 => _392.match, 'call', _393 => _393(/<[A-Za-z0-9]+:cellMargin\b[^>]*>/)]);
|
|
25915
25940
|
if (mg) {
|
|
25916
25941
|
content -= Number(_nullishCoalesce(attrOf(mg[0], "left"), () => ( 0))) + Number(_nullishCoalesce(attrOf(mg[0], "right"), () => ( 0)));
|
|
25917
25942
|
}
|
|
@@ -25945,11 +25970,11 @@ function buildFloatPicXml(itemId, sizeHu, posXHu, posYHu, ids) {
|
|
|
25945
25970
|
return `<hp:pic xmlns:hc="http://www.hancom.co.kr/hwpml/2011/core" id="${ids.id}" zOrder="0" numberingType="PICTURE" textWrap="IN_FRONT_OF_TEXT" textFlow="BOTH_SIDES" lock="0" dropcapstyle="None" href="" groupLevel="0" instid="${ids.instid}" reverse="0"><hp:offset x="0" y="0"/><hp:orgSz width="${w}" height="${h}"/><hp:curSz width="${w}" height="${h}"/><hp:flip horizontal="0" vertical="0"/><hp:rotationInfo angle="0" centerX="${Math.round(w / 2)}" centerY="${Math.round(h / 2)}" rotateimage="1"/><hp:renderingInfo><hc:transMatrix e1="1" e2="0" e3="0" e4="0" e5="1" e6="0"/><hc:scaMatrix e1="1" e2="0" e3="0" e4="0" e5="1" e6="0"/><hc:rotMatrix e1="1" e2="0" e3="0" e4="0" e5="1" e6="0"/></hp:renderingInfo><hp:imgRect><hc:pt0 x="0" y="0"/><hc:pt1 x="${w}" y="0"/><hc:pt2 x="${w}" y="${h}"/><hc:pt3 x="0" y="${h}"/></hp:imgRect><hp:imgClip left="0" right="${w}" top="0" bottom="${h}"/><hp:inMargin left="0" right="0" top="0" bottom="0"/><hp:imgDim dimwidth="${w}" dimheight="${h}"/><hc:img binaryItemIDRef="${itemId}" bright="0" contrast="0" effect="REAL_PIC" alpha="0"/><hp:effects/><hp:sz width="${w}" widthRelTo="ABSOLUTE" height="${h}" heightRelTo="ABSOLUTE" protect="0"/><hp:pos treatAsChar="0" affectLSpacing="0" flowWithText="0" allowOverlap="1" holdAnchorAndSO="0" vertRelTo="PARA" horzRelTo="COLUMN" vertAlign="TOP" horzAlign="LEFT" vertOffset="${posYHu}" horzOffset="${posXHu}"/><hp:outMargin left="0" right="0" top="0" bottom="0"/><hp:shapeComment>kordoc seal</hp:shapeComment></hp:pic>`;
|
|
25946
25971
|
}
|
|
25947
25972
|
async function placeSealHwpx(hwpxBuffer, ops) {
|
|
25948
|
-
if (ops.length === 0) throw new (0,
|
|
25973
|
+
if (ops.length === 0) throw new (0, _chunkGZ7W64QUcjs.KordocError)("place_seal: \uBC30\uCE58\uD560 \uB3C4\uC7A5\uC774 \uC5C6\uC2B5\uB2C8\uB2E4");
|
|
25949
25974
|
const u8 = new Uint8Array(hwpxBuffer);
|
|
25950
25975
|
const zip = await _jszip2.default.loadAsync(hwpxBuffer);
|
|
25951
|
-
const sectionPaths = Object.keys(zip.files).filter((name) => /[Ss]ection\d+\.xml$/i.test(name)).sort((a, b) => Number(_nullishCoalesce(_optionalChain([a, 'access',
|
|
25952
|
-
if (sectionPaths.length === 0) throw new (0,
|
|
25976
|
+
const sectionPaths = Object.keys(zip.files).filter((name) => /[Ss]ection\d+\.xml$/i.test(name)).sort((a, b) => Number(_nullishCoalesce(_optionalChain([a, 'access', _394 => _394.match, 'call', _395 => _395(/(\d+)\.xml$/i), 'optionalAccess', _396 => _396[1]]), () => ( 0))) - Number(_nullishCoalesce(_optionalChain([b, 'access', _397 => _397.match, 'call', _398 => _398(/(\d+)\.xml$/i), 'optionalAccess', _399 => _399[1]]), () => ( 0))));
|
|
25977
|
+
if (sectionPaths.length === 0) throw new (0, _chunkGZ7W64QUcjs.KordocError)("HWPX\uC5D0\uC11C \uC139\uC158 \uD30C\uC77C\uC744 \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4");
|
|
25953
25978
|
const manifestPath = Object.keys(zip.files).find((name) => /\.hpf$/i.test(name));
|
|
25954
25979
|
const headerPath = Object.keys(zip.files).find((name) => /(^|\/)header\.xml$/i.test(name));
|
|
25955
25980
|
const styles = headerPath ? parseRenderStyles(await zip.file(headerPath).async("text")) : null;
|
|
@@ -25990,11 +26015,11 @@ async function placeSealHwpx(hwpxBuffer, ops) {
|
|
|
25990
26015
|
const manifestItems = [];
|
|
25991
26016
|
const placed = [];
|
|
25992
26017
|
for (const op of ops) {
|
|
25993
|
-
if (!op.anchor) throw new (0,
|
|
25994
|
-
if (!op.image || op.image.length === 0) throw new (0,
|
|
26018
|
+
if (!op.anchor) throw new (0, _chunkGZ7W64QUcjs.KordocError)("place_seal: anchor \uBB38\uAD6C\uAC00 \uD544\uC694\uD569\uB2C8\uB2E4");
|
|
26019
|
+
if (!op.image || op.image.length === 0) throw new (0, _chunkGZ7W64QUcjs.KordocError)("place_seal: \uB3C4\uC7A5 \uC774\uBBF8\uC9C0\uAC00 \uD544\uC694\uD569\uB2C8\uB2E4");
|
|
25995
26020
|
const ext = (_nullishCoalesce(op.ext, () => ( "png"))).toLowerCase();
|
|
25996
|
-
if (!MIME[ext]) throw new (0,
|
|
25997
|
-
if (!imageMagicMatches(op.image, ext)) throw new (0,
|
|
26021
|
+
if (!MIME[ext]) throw new (0, _chunkGZ7W64QUcjs.KordocError)(`place_seal: \uC9C0\uC6D0\uD558\uC9C0 \uC54A\uB294 \uC774\uBBF8\uC9C0 \uD655\uC7A5\uC790 .${ext} (png/jpg/bmp/gif)`);
|
|
26022
|
+
if (!imageMagicMatches(op.image, ext)) throw new (0, _chunkGZ7W64QUcjs.KordocError)(`place_seal: \uC774\uBBF8\uC9C0 \uB0B4\uC6A9\uC774 .${ext} \uD615\uC2DD\uC774 \uC544\uB2D9\uB2C8\uB2E4 (\uB9E4\uC9C1\uBC14\uC774\uD2B8 \uBD88\uC77C\uCE58)`);
|
|
25998
26023
|
const wantOcc = _nullishCoalesce(op.occurrence, () => ( 0));
|
|
25999
26024
|
let found = null;
|
|
26000
26025
|
let total = 0;
|
|
@@ -26027,7 +26052,7 @@ async function placeSealHwpx(hwpxBuffer, ops) {
|
|
|
26027
26052
|
}
|
|
26028
26053
|
}
|
|
26029
26054
|
}
|
|
26030
|
-
throw new (0,
|
|
26055
|
+
throw new (0, _chunkGZ7W64QUcjs.KordocError)(
|
|
26031
26056
|
`place_seal: \uC575\uCEE4 "${op.anchor}" ${wantOcc}\uBC88\uC9F8 \uB4F1\uC7A5\uC744 \uCC3E\uC9C0 \uBABB\uD588\uC2B5\uB2C8\uB2E4 (\uBCF8\uBB38 \uB0B4 ${total}\uD68C \uB4F1\uC7A5 \u2014 occurrence 0..${Math.max(0, total - 1)})`
|
|
26032
26057
|
);
|
|
26033
26058
|
}
|
|
@@ -26035,9 +26060,9 @@ async function placeSealHwpx(hwpxBuffer, ops) {
|
|
|
26035
26060
|
const xml = sectionXmls[si];
|
|
26036
26061
|
const run = anchorRunInfo(xml, site.para, op.anchor);
|
|
26037
26062
|
if (!run) {
|
|
26038
|
-
throw new (0,
|
|
26063
|
+
throw new (0, _chunkGZ7W64QUcjs.KordocError)(`place_seal: \uC575\uCEE4 "${op.anchor}" \uBB38\uB2E8\uC5D0\uC11C run\uC744 \uCC3E\uC9C0 \uBABB\uD588\uC2B5\uB2C8\uB2E4`);
|
|
26039
26064
|
}
|
|
26040
|
-
const charPrHeight = _nullishCoalesce(_optionalChain([styles, 'optionalAccess',
|
|
26065
|
+
const charPrHeight = _nullishCoalesce(_optionalChain([styles, 'optionalAccess', _400 => _400.charPr, 'access', _401 => _401.get, 'call', _402 => _402(run.charPr), 'optionalAccess', _403 => _403.height]), () => ( 1e3));
|
|
26041
26066
|
const fontPt = charPrHeight / 100;
|
|
26042
26067
|
const emMm = fontPt * 25.4 / 72;
|
|
26043
26068
|
const lineHMm = emMm;
|
|
@@ -26046,7 +26071,7 @@ async function placeSealHwpx(hwpxBuffer, ops) {
|
|
|
26046
26071
|
const sizeMm = op.sizeMm != null && Number.isFinite(op.sizeMm) && op.sizeMm > 0 ? op.sizeMm : Math.max(7, Math.min(18, lineHMm * 1.6));
|
|
26047
26072
|
const availMm = _nullishCoalesce((site.cell ? cellContentWidthMm(xml, site.cell) : null), () => ( bodyColumnWidthMm(xml)));
|
|
26048
26073
|
const paraPrId = _nullishCoalesce(attrOf(paraOpenTag(xml, site.para), "paraPrIDRef"), () => ( "0"));
|
|
26049
|
-
const align = _optionalChain([styles, 'optionalAccess',
|
|
26074
|
+
const align = _optionalChain([styles, 'optionalAccess', _404 => _404.paraAlign, 'access', _405 => _405.get, 'call', _406 => _406(paraPrId)]);
|
|
26050
26075
|
let alignShiftMm = 0;
|
|
26051
26076
|
if (align === "CENTER" || align === "RIGHT") {
|
|
26052
26077
|
const paraWMm = measureMm(site.para.text, emMm);
|
|
@@ -26142,7 +26167,7 @@ function parseBorderFills(headerDoc) {
|
|
|
26142
26167
|
};
|
|
26143
26168
|
const fillBrush = findChildByLocalName(bf, "fillBrush");
|
|
26144
26169
|
const winBrush = fillBrush ? findChildByLocalName(fillBrush, "winBrush") : null;
|
|
26145
|
-
const face = _optionalChain([winBrush, 'optionalAccess',
|
|
26170
|
+
const face = _optionalChain([winBrush, 'optionalAccess', _407 => _407.getAttribute, 'call', _408 => _408("faceColor")]);
|
|
26146
26171
|
if (face && face !== "none") def.fill = { faceColor: face };
|
|
26147
26172
|
map.set(id, def);
|
|
26148
26173
|
}
|
|
@@ -26174,7 +26199,7 @@ function parseCharPrs(headerDoc, hangulFonts) {
|
|
|
26174
26199
|
if (cp.getAttribute("italic") === "1") def.italic = true;
|
|
26175
26200
|
if (findChildByLocalName(cp, "underline")) def.underline = true;
|
|
26176
26201
|
const fontRef = findChildByLocalName(cp, "fontRef");
|
|
26177
|
-
const hangul = _optionalChain([fontRef, 'optionalAccess',
|
|
26202
|
+
const hangul = _optionalChain([fontRef, 'optionalAccess', _409 => _409.getAttribute, 'call', _410 => _410("hangul")]);
|
|
26178
26203
|
if (hangul) {
|
|
26179
26204
|
def.fontRef_hangul = hangul;
|
|
26180
26205
|
const face = hangulFonts.get(hangul);
|
|
@@ -26202,7 +26227,7 @@ function parseTable3(tbl2, tableIndex, borderFills, charPrs) {
|
|
|
26202
26227
|
const rows = _nullishCoalesce(num(tbl2.getAttribute("rowCnt")), () => ( 0));
|
|
26203
26228
|
const cols = _nullishCoalesce(num(tbl2.getAttribute("colCnt")), () => ( 0));
|
|
26204
26229
|
const sz = findChildByLocalName(tbl2, "sz");
|
|
26205
|
-
const width = _optionalChain([sz, 'optionalAccess',
|
|
26230
|
+
const width = _optionalChain([sz, 'optionalAccess', _411 => _411.getAttribute, 'call', _412 => _412("width")]) || void 0;
|
|
26206
26231
|
const cells = [];
|
|
26207
26232
|
const usedBf = /* @__PURE__ */ new Set();
|
|
26208
26233
|
const usedCp = /* @__PURE__ */ new Set();
|
|
@@ -26215,17 +26240,17 @@ function parseTable3(tbl2, tableIndex, borderFills, charPrs) {
|
|
|
26215
26240
|
const addr = findChildByLocalName(tc2, "cellAddr");
|
|
26216
26241
|
const span = findChildByLocalName(tc2, "cellSpan");
|
|
26217
26242
|
const csz = findChildByLocalName(tc2, "cellSz");
|
|
26218
|
-
const row = _nullishCoalesce(num(_optionalChain([addr, 'optionalAccess',
|
|
26219
|
-
const col = _nullishCoalesce(num(_optionalChain([addr, 'optionalAccess',
|
|
26243
|
+
const row = _nullishCoalesce(num(_optionalChain([addr, 'optionalAccess', _413 => _413.getAttribute, 'call', _414 => _414("rowAddr")])), () => ( 0));
|
|
26244
|
+
const col = _nullishCoalesce(num(_optionalChain([addr, 'optionalAccess', _415 => _415.getAttribute, 'call', _416 => _416("colAddr")])), () => ( 0));
|
|
26220
26245
|
if (row === 0 && col === 0 && !anchorText) anchorText = directCellText(tc2);
|
|
26221
26246
|
if (row === 0) row0Texts.set(col, directCellText(tc2));
|
|
26222
|
-
const colSpan = _nullishCoalesce(num(_optionalChain([span, 'optionalAccess',
|
|
26223
|
-
const rowSpan = _nullishCoalesce(num(_optionalChain([span, 'optionalAccess',
|
|
26247
|
+
const colSpan = _nullishCoalesce(num(_optionalChain([span, 'optionalAccess', _417 => _417.getAttribute, 'call', _418 => _418("colSpan")])), () => ( 1));
|
|
26248
|
+
const rowSpan = _nullishCoalesce(num(_optionalChain([span, 'optionalAccess', _419 => _419.getAttribute, 'call', _420 => _420("rowSpan")])), () => ( 1));
|
|
26224
26249
|
const bfId = tc2.getAttribute("borderFillIDRef") || void 0;
|
|
26225
26250
|
const cpId = firstRunCharPr(tc2);
|
|
26226
26251
|
const cell2 = { row, col, rowSpan, colSpan };
|
|
26227
|
-
const w = _optionalChain([csz, 'optionalAccess',
|
|
26228
|
-
const hh = _optionalChain([csz, 'optionalAccess',
|
|
26252
|
+
const w = _optionalChain([csz, 'optionalAccess', _421 => _421.getAttribute, 'call', _422 => _422("width")]);
|
|
26253
|
+
const hh = _optionalChain([csz, 'optionalAccess', _423 => _423.getAttribute, 'call', _424 => _424("height")]);
|
|
26229
26254
|
if (w) cell2.width_hwpunit = w;
|
|
26230
26255
|
if (hh) cell2.height_hwpunit = hh;
|
|
26231
26256
|
if (bfId) {
|
|
@@ -26313,16 +26338,16 @@ function pick(map, keys) {
|
|
|
26313
26338
|
return out;
|
|
26314
26339
|
}
|
|
26315
26340
|
async function hwpxToProfile(input) {
|
|
26316
|
-
const buf = input instanceof ArrayBuffer ? input :
|
|
26341
|
+
const buf = input instanceof ArrayBuffer ? input : _chunkGZ7W64QUcjs.toArrayBuffer.call(void 0, input);
|
|
26317
26342
|
const zip = await _jszip2.default.loadAsync(buf);
|
|
26318
26343
|
const parser = createXmlParser();
|
|
26319
|
-
const headerFile = _nullishCoalesce(zip.file("Contents/header.xml"), () => ( _optionalChain([zip, 'access',
|
|
26344
|
+
const headerFile = _nullishCoalesce(zip.file("Contents/header.xml"), () => ( _optionalChain([zip, 'access', _425 => _425.file, 'call', _426 => _426(/[Hh]eader\.xml$/), 'optionalAccess', _427 => _427[0]])));
|
|
26320
26345
|
let headerXml = "<root/>";
|
|
26321
26346
|
if (headerFile) headerXml = await headerFile.async("text");
|
|
26322
26347
|
const headerDoc = parser.parseFromString(headerXml, "text/xml");
|
|
26323
26348
|
const borderFills = parseBorderFills(headerDoc);
|
|
26324
26349
|
const charPrs = parseCharPrs(headerDoc, parseHangulFonts(headerDoc));
|
|
26325
|
-
const sectionFiles = zip.file(/[Ss]ection\d+\.xml$/).sort((a, b) => (_nullishCoalesce(num(_nullishCoalesce(_optionalChain([a, 'access',
|
|
26350
|
+
const sectionFiles = zip.file(/[Ss]ection\d+\.xml$/).sort((a, b) => (_nullishCoalesce(num(_nullishCoalesce(_optionalChain([a, 'access', _428 => _428.name, 'access', _429 => _429.match, 'call', _430 => _430(/(\d+)\.xml$/), 'optionalAccess', _431 => _431[1]]), () => ( null))), () => ( 0))) - (_nullishCoalesce(num(_nullishCoalesce(_optionalChain([b, 'access', _432 => _432.name, 'access', _433 => _433.match, 'call', _434 => _434(/(\d+)\.xml$/), 'optionalAccess', _435 => _435[1]]), () => ( null))), () => ( 0))));
|
|
26326
26351
|
const tables = [];
|
|
26327
26352
|
let tableIndex = 0;
|
|
26328
26353
|
for (const f of sectionFiles) {
|
|
@@ -26636,7 +26661,7 @@ var ROW_OBJECT_RE = /<(?:[A-Za-z0-9_]+:)?(?:tbl|pic|equation|ole|container|shape
|
|
|
26636
26661
|
var TAG_AT_RE = /<[A-Za-z0-9_:]+(?:"[^"]*"|'[^']*'|[^>"'])*>/y;
|
|
26637
26662
|
function patchTableRows(input) {
|
|
26638
26663
|
const { table: table2, scanTable, ctx, skip, origKeys, editedKeys } = input;
|
|
26639
|
-
const xml = _optionalChain([ctx, 'access',
|
|
26664
|
+
const xml = _optionalChain([ctx, 'access', _436 => _436.scans, 'access', _437 => _437[scanTable.sectionIndex], 'optionalAccess', _438 => _438.xml]);
|
|
26640
26665
|
if (!xml) return skip("\uC139\uC158 XML \uB9E4\uD551 \uC2E4\uD328");
|
|
26641
26666
|
const numRows = table2.rows;
|
|
26642
26667
|
if (origKeys.length !== numRows) return skip("\uD45C \uD589 \uC88C\uD45C \uBD88\uC77C\uCE58 \u2014 \uD589 \uCD94\uAC00/\uC0AD\uC81C \uBBF8\uC9C0\uC6D0");
|
|
@@ -26803,7 +26828,7 @@ function buildRowFragment(xml, scanTable, template, cells, finalRow, hasExplicit
|
|
|
26803
26828
|
const rr = scanTable.rowRanges[template];
|
|
26804
26829
|
const wrapped = FRAG_OPEN + xml.slice(rr.start, rr.end) + FRAG_CLOSE;
|
|
26805
26830
|
const scan = scanSectionXml(wrapped, 0);
|
|
26806
|
-
const row = _optionalChain([scan, 'access',
|
|
26831
|
+
const row = _optionalChain([scan, 'access', _439 => _439.tables, 'access', _440 => _440[0], 'optionalAccess', _441 => _441.rows, 'access', _442 => _442[0]]);
|
|
26807
26832
|
if (!row || row.length !== cells.length) return null;
|
|
26808
26833
|
const splices = allLinesegRemovalSplices(wrapped);
|
|
26809
26834
|
for (let i = 0; i < cells.length; i++) {
|
|
@@ -26846,7 +26871,7 @@ function rowHeightOf(fragment) {
|
|
|
26846
26871
|
}
|
|
26847
26872
|
function tableSzHeightSplice(xml, scanTable, tblOpenLen, delta) {
|
|
26848
26873
|
const from = scanTable.start + tblOpenLen;
|
|
26849
|
-
const to = _nullishCoalesce(_optionalChain([scanTable, 'access',
|
|
26874
|
+
const to = _nullishCoalesce(_optionalChain([scanTable, 'access', _443 => _443.rowRanges, 'access', _444 => _444[0], 'optionalAccess', _445 => _445.start]), () => ( from));
|
|
26850
26875
|
const slice = xml.slice(from, to);
|
|
26851
26876
|
const szM = slice.match(/<(?:[A-Za-z0-9_]+:)?sz\b(?:"[^"]*"|'[^']*'|[^>"'])*>/);
|
|
26852
26877
|
if (!szM || szM.index === void 0) return null;
|
|
@@ -27035,9 +27060,9 @@ function patchHtmlTableRows(table2, scanTable, replica, editedRows, ctx, skip, d
|
|
|
27035
27060
|
});
|
|
27036
27061
|
}
|
|
27037
27062
|
function patchNestedTables(table2, scanTable, oc, origTables, editedTables, ctx, skip, depth) {
|
|
27038
|
-
const irCell = _optionalChain([table2, 'access',
|
|
27063
|
+
const irCell = _optionalChain([table2, 'access', _446 => _446.cells, 'access', _447 => _447[oc.gridR], 'optionalAccess', _448 => _448[oc.gridC]]);
|
|
27039
27064
|
const scanCell = scanTable.cellByAnchor.get(`${oc.gridR},${oc.gridC}`);
|
|
27040
|
-
const nestedIRs = (_nullishCoalesce(_optionalChain([irCell, 'optionalAccess',
|
|
27065
|
+
const nestedIRs = (_nullishCoalesce(_optionalChain([irCell, 'optionalAccess', _449 => _449.blocks]), () => ( []))).filter((b) => b.type === "table" && b.table).map((b) => b.table);
|
|
27041
27066
|
if (!scanCell || nestedIRs.length !== origTables.length || scanCell.tables.length !== origTables.length) {
|
|
27042
27067
|
return skip("\uC911\uCCA9\uD45C \uC18C\uC2A4\uB9F5 \uB9E4\uD551 \uC2E4\uD328");
|
|
27043
27068
|
}
|
|
@@ -27105,7 +27130,7 @@ function applyCellEdit(table2, scanTable, gridR, gridC, newLines, ctx, before, a
|
|
|
27105
27130
|
};
|
|
27106
27131
|
const cell2 = scanTable.cellByAnchor.get(`${gridR},${gridC}`);
|
|
27107
27132
|
if (!cell2) return skip("\uC140 \uC88C\uD45C \uB9E4\uD551 \uC2E4\uD328 (\uBCD1\uD569 \uC601\uC5ED\uC758 \uBE48 \uCE78\uC774\uAC70\uB098 \uC88C\uD45C \uBD88\uC77C\uCE58)");
|
|
27108
|
-
const irCell = _optionalChain([table2, 'access',
|
|
27133
|
+
const irCell = _optionalChain([table2, 'access', _450 => _450.cells, 'access', _451 => _451[gridR], 'optionalAccess', _452 => _452[gridC]]);
|
|
27109
27134
|
const scanJoined = cell2.paragraphs.map((p) => p.text).filter((t) => normForMatch(t)).join("\n");
|
|
27110
27135
|
if (irCell && normForMatch(scanJoined) !== normForMatch(stripCellTokens(irCell.text))) {
|
|
27111
27136
|
if (normForMatch(irCell.text) !== "" || normForMatch(scanJoined) !== "") {
|
|
@@ -27129,7 +27154,7 @@ function applyCellEdit(table2, scanTable, gridR, gridC, newLines, ctx, before, a
|
|
|
27129
27154
|
const target = cell2.paragraphs[0];
|
|
27130
27155
|
if (!target) return skip("\uBE48 \uC140\uC5D0 \uBB38\uB2E8\uC774 \uC5C6\uC5B4 \uD14D\uC2A4\uD2B8 \uC0BD\uC785 \uBD88\uAC00");
|
|
27131
27156
|
const value = newLines.join(" ");
|
|
27132
|
-
const xml = _optionalChain([ctx, 'access',
|
|
27157
|
+
const xml = _optionalChain([ctx, 'access', _453 => _453.scans, 'access', _454 => _454[target.sectionIndex], 'optionalAccess', _455 => _455.xml]);
|
|
27133
27158
|
const rawT = xml ? paraTText(target, xml) : null;
|
|
27134
27159
|
let sp;
|
|
27135
27160
|
if (xml && rawT !== null && rawT.length > 0 && rawT.trim() === "") {
|
|
@@ -27160,7 +27185,7 @@ function applyCellEdit(table2, scanTable, gridR, gridC, newLines, ctx, before, a
|
|
|
27160
27185
|
}
|
|
27161
27186
|
for (let i = 0; i < nonEmpty.length; i++) {
|
|
27162
27187
|
if (assigned[i] === nonEmpty[i].text || normForMatch(assigned[i]) === normForMatch(nonEmpty[i].text)) continue;
|
|
27163
|
-
const sp = buildParagraphSplices(nonEmpty[i], assigned[i], _optionalChain([ctx, 'access',
|
|
27188
|
+
const sp = buildParagraphSplices(nonEmpty[i], assigned[i], _optionalChain([ctx, 'access', _456 => _456.scans, 'access', _457 => _457[nonEmpty[i].sectionIndex], 'optionalAccess', _458 => _458.xml]));
|
|
27164
27189
|
if (sp === null) return skip("\uC140 \uBB38\uB2E8\uC5D0 \uD14D\uC2A4\uD2B8 \uB178\uB4DC\uB97C \uB9CC\uB4E4 \uC218 \uC5C6\uC74C");
|
|
27165
27190
|
splices.push(...sp);
|
|
27166
27191
|
sectionIndex = nonEmpty[i].sectionIndex;
|
|
@@ -27241,7 +27266,7 @@ async function resolveSectionEntryNames(zip) {
|
|
|
27241
27266
|
const paths = sectionPathsFromManifest(xml).filter((p) => zip.file(p) !== null);
|
|
27242
27267
|
if (paths.length > 0) return paths;
|
|
27243
27268
|
}
|
|
27244
|
-
return Object.keys(zip.files).filter((n) => /[Ss]ection\d+\.xml$/.test(n)).sort(
|
|
27269
|
+
return Object.keys(zip.files).filter((n) => /[Ss]ection\d+\.xml$/.test(n)).sort(_chunkGZ7W64QUcjs.compareSectionPaths);
|
|
27245
27270
|
}
|
|
27246
27271
|
function sectionPathsFromManifest(xml) {
|
|
27247
27272
|
const attr = (tag, name) => {
|
|
@@ -27251,7 +27276,7 @@ function sectionPathsFromManifest(xml) {
|
|
|
27251
27276
|
const idToHref = /* @__PURE__ */ new Map();
|
|
27252
27277
|
for (const m of xml.matchAll(/<opf:item(\s(?:"[^"]*"|'[^']*'|[^>"'])*?)\/?>/g)) {
|
|
27253
27278
|
const id = attr(m[1], "id");
|
|
27254
|
-
const href =
|
|
27279
|
+
const href = _chunkGZ7W64QUcjs.normalizeSectionHref.call(void 0, attr(m[1], "href"));
|
|
27255
27280
|
if (id && href) idToHref.set(id, href);
|
|
27256
27281
|
}
|
|
27257
27282
|
const ordered = [];
|
|
@@ -27260,7 +27285,7 @@ function sectionPathsFromManifest(xml) {
|
|
|
27260
27285
|
if (href) ordered.push(href);
|
|
27261
27286
|
}
|
|
27262
27287
|
if (ordered.length > 0) return ordered;
|
|
27263
|
-
return Array.from(idToHref.values()).sort(
|
|
27288
|
+
return Array.from(idToHref.values()).sort(_chunkGZ7W64QUcjs.compareSectionPaths);
|
|
27264
27289
|
}
|
|
27265
27290
|
|
|
27266
27291
|
// src/roundtrip/patcher.ts
|
|
@@ -27352,7 +27377,7 @@ async function patchHwpx(original, editedMarkdown, options) {
|
|
|
27352
27377
|
}
|
|
27353
27378
|
}
|
|
27354
27379
|
let verification;
|
|
27355
|
-
if (_optionalChain([options, 'optionalAccess',
|
|
27380
|
+
if (_optionalChain([options, 'optionalAccess', _459 => _459.verify]) !== false) {
|
|
27356
27381
|
try {
|
|
27357
27382
|
const reparsed = await parseHwpxDocument(u8ToArrayBuffer(data));
|
|
27358
27383
|
verification = diffUnitLists(splitMarkdownUnits(reparsed.markdown), editedUnits);
|
|
@@ -27370,17 +27395,17 @@ function buildOrigUnits(blocks) {
|
|
|
27370
27395
|
let chunk;
|
|
27371
27396
|
if (block.type === "paragraph" && block.text && /^\[별표\s*\d+/.test(sanitizeText(block.text))) {
|
|
27372
27397
|
const next = blocks[i + 1];
|
|
27373
|
-
if (_optionalChain([next, 'optionalAccess',
|
|
27374
|
-
chunk =
|
|
27398
|
+
if (_optionalChain([next, 'optionalAccess', _460 => _460.type]) === "paragraph" && next.text && /관련\)?$/.test(next.text)) consume = 2;
|
|
27399
|
+
chunk = _chunk6GM2QLM3cjs.blocksToMarkdown.call(void 0, blocks.slice(i, i + consume));
|
|
27375
27400
|
} else {
|
|
27376
|
-
chunk =
|
|
27401
|
+
chunk = _chunk6GM2QLM3cjs.blocksToMarkdown.call(void 0, [block]);
|
|
27377
27402
|
}
|
|
27378
27403
|
if (chunk) {
|
|
27379
27404
|
const subUnits = splitMarkdownUnits(chunk);
|
|
27380
27405
|
const isFragment = consume === 2 || (block.type === "paragraph" || block.type === "heading") && subUnits.length > 1;
|
|
27381
27406
|
for (let s = 0; s < subUnits.length; s++) {
|
|
27382
27407
|
const u = { ...subUnits[s], blockIdx: i, fragment: isFragment || void 0 };
|
|
27383
|
-
if (block.type === "table" && _optionalChain([block, 'access',
|
|
27408
|
+
if (block.type === "table" && _optionalChain([block, 'access', _461 => _461.table, 'optionalAccess', _462 => _462.caption]) && s === 0 && subUnits.length > 1 && u.kind === "text" && u.raw.startsWith("**")) {
|
|
27384
27409
|
u.role = "caption";
|
|
27385
27410
|
}
|
|
27386
27411
|
units.push(u);
|
|
@@ -27491,7 +27516,7 @@ function convertParagraphToTable(block, orig, edited, ctx, skip) {
|
|
|
27491
27516
|
const ti = ctx.tableInsert;
|
|
27492
27517
|
if (!ti) return skip("\uBB38\uB2E8\u2192\uD45C \uBCC0\uD658 \uBD88\uAC00 \u2014 header \uC5D4\uD2B8\uB9AC(borderFills) \uD574\uC11D \uC2E4\uD328");
|
|
27493
27518
|
const mapping = ctx.paraMap.get(orig.blockIdx);
|
|
27494
|
-
if (!_optionalChain([mapping, 'optionalAccess',
|
|
27519
|
+
if (!_optionalChain([mapping, 'optionalAccess', _463 => _463.para])) return skip("\uBB38\uB2E8 \uC18C\uC2A4\uB9F5 \uB9E4\uD551 \uC2E4\uD328 (\uBA38\uB9AC\uB9D0/\uAE00\uC0C1\uC790/\uCEA1\uC158 \uC601\uC5ED) \u2014 \uD45C \uBCC0\uD658 \uBD88\uAC00");
|
|
27495
27520
|
const para2 = mapping.para;
|
|
27496
27521
|
if (para2.kind !== "body") return skip("\uBCF8\uBB38 \uC678 \uC601\uC5ED(\uD45C \uC140/\uAE00\uC0C1\uC790) \uBB38\uB2E8\uC758 \uD45C \uBCC0\uD658\uC740 \uBBF8\uC9C0\uC6D0");
|
|
27497
27522
|
const scan = ctx.scans[para2.sectionIndex];
|
|
@@ -27519,7 +27544,7 @@ function convertParagraphToTable(block, orig, edited, ctx, skip) {
|
|
|
27519
27544
|
}
|
|
27520
27545
|
function patchParagraphUnit(block, orig, edited, ctx, skip) {
|
|
27521
27546
|
const mapping = ctx.paraMap.get(orig.blockIdx);
|
|
27522
|
-
if (!_optionalChain([mapping, 'optionalAccess',
|
|
27547
|
+
if (!_optionalChain([mapping, 'optionalAccess', _464 => _464.para])) return skip("\uBB38\uB2E8 \uC18C\uC2A4\uB9F5 \uB9E4\uD551 \uC2E4\uD328 (\uBA38\uB9AC\uB9D0/\uAE00\uC0C1\uC790/\uCEA1\uC158 \uC601\uC5ED\uC774\uAC70\uB098 \uD14D\uC2A4\uD2B8 \uBD88\uC77C\uCE58)");
|
|
27523
27548
|
if (block.text && block.text.includes("\n")) {
|
|
27524
27549
|
return skip("\uBB38\uB2E8 \uB0B4 \uAC15\uC81C \uC904\uBC14\uAFC8 \uD3EC\uD568 \u2014 \uC218\uC815 \uC2DC \uC904\uBC14\uAFC8 \uBCF4\uC874 \uBD88\uAC00\uB85C \uBBF8\uC9C0\uC6D0 (v1)");
|
|
27525
27550
|
}
|
|
@@ -27550,7 +27575,7 @@ function patchParagraphUnit(block, orig, edited, ctx, skip) {
|
|
|
27550
27575
|
if (sanitizeText(newPlain) !== newPlain) {
|
|
27551
27576
|
return skip("\uACF5\uBC31 \uC815\uADDC\uD654 \uBD88\uC548\uC815 \uD14D\uC2A4\uD2B8 \u2014 \uD328\uCE58 \uC2DC \uC6D0\uBB38 \uBCF4\uC874 \uBD88\uAC00\uB85C \uBBF8\uC9C0\uC6D0");
|
|
27552
27577
|
}
|
|
27553
|
-
const splices = buildParagraphSplices(mapping.para, newPlain, _optionalChain([ctx, 'access',
|
|
27578
|
+
const splices = buildParagraphSplices(mapping.para, newPlain, _optionalChain([ctx, 'access', _465 => _465.scans, 'access', _466 => _466[mapping.para.sectionIndex], 'optionalAccess', _467 => _467.xml]));
|
|
27554
27579
|
if (splices === null) return skip("\uBB38\uB2E8\uC5D0 \uD14D\uC2A4\uD2B8 \uB178\uB4DC\uB97C \uB9CC\uB4E4 \uC218 \uC5C6\uC74C");
|
|
27555
27580
|
ctx.sectionSplices[mapping.para.sectionIndex].push(...splices);
|
|
27556
27581
|
return 1;
|
|
@@ -27739,7 +27764,7 @@ var Surgeon = (_class7 = class {
|
|
|
27739
27764
|
/** 디렉토리 트리에서 경로 해석 (형제 = L/R 이진 트리, 자식 = child) */
|
|
27740
27765
|
findEntry(path) {
|
|
27741
27766
|
const parts = path.replace(/^\//, "").split("/");
|
|
27742
|
-
let scope = _nullishCoalesce(_optionalChain([this, 'access',
|
|
27767
|
+
let scope = _nullishCoalesce(_optionalChain([this, 'access', _468 => _468.entries, 'access', _469 => _469[0], 'optionalAccess', _470 => _470.child]), () => ( -1));
|
|
27743
27768
|
let current;
|
|
27744
27769
|
for (const part of parts) {
|
|
27745
27770
|
const search = (idx) => {
|
|
@@ -27978,8 +28003,8 @@ function serializeRecords(recs, repl, inserts) {
|
|
|
27978
28003
|
parts.push(header, data);
|
|
27979
28004
|
};
|
|
27980
28005
|
for (let i = 0; i < recs.length; i++) {
|
|
27981
|
-
for (const ins of _nullishCoalesce(_optionalChain([inserts, 'optionalAccess',
|
|
27982
|
-
push(recs[i].tagId, recs[i].level, _nullishCoalesce(_optionalChain([repl, 'optionalAccess',
|
|
28006
|
+
for (const ins of _nullishCoalesce(_optionalChain([inserts, 'optionalAccess', _471 => _471.get, 'call', _472 => _472(i)]), () => ( []))) push(ins.tagId, ins.level, ins.data);
|
|
28007
|
+
push(recs[i].tagId, recs[i].level, _nullishCoalesce(_optionalChain([repl, 'optionalAccess', _473 => _473.get, 'call', _474 => _474(i)]), () => ( recs[i].data)));
|
|
27983
28008
|
}
|
|
27984
28009
|
return Buffer.concat(parts);
|
|
27985
28010
|
}
|
|
@@ -28097,7 +28122,7 @@ async function patchHwp(original, editedMarkdown, options) {
|
|
|
28097
28122
|
return fail(`CFB \uCEE8\uD14C\uC774\uB108 \uD30C\uC2F1 \uC2E4\uD328: ${msg(err)}`);
|
|
28098
28123
|
}
|
|
28099
28124
|
const fhEntry = CFB2.find(cfb, "/FileHeader");
|
|
28100
|
-
if (!_optionalChain([fhEntry, 'optionalAccess',
|
|
28125
|
+
if (!_optionalChain([fhEntry, 'optionalAccess', _475 => _475.content])) return fail("FileHeader \uC2A4\uD2B8\uB9BC\uC774 \uC5C6\uC2B5\uB2C8\uB2E4 \u2014 HWP 5.x \uD30C\uC77C\uC774 \uC544\uB2D9\uB2C8\uB2E4");
|
|
28101
28126
|
let flags;
|
|
28102
28127
|
try {
|
|
28103
28128
|
flags = parseFileHeader(Buffer.from(fhEntry.content)).flags;
|
|
@@ -28119,7 +28144,7 @@ async function patchHwp(original, editedMarkdown, options) {
|
|
|
28119
28144
|
const scans = [];
|
|
28120
28145
|
for (let i = 0; i < sectionPaths.length; i++) {
|
|
28121
28146
|
const entry = CFB2.find(cfb, sectionPaths[i]);
|
|
28122
|
-
if (!_optionalChain([entry, 'optionalAccess',
|
|
28147
|
+
if (!_optionalChain([entry, 'optionalAccess', _476 => _476.content])) return fail(`\uC139\uC158 \uC2A4\uD2B8\uB9BC \uC77D\uAE30 \uC2E4\uD328: ${sectionPaths[i]}`);
|
|
28123
28148
|
let stream;
|
|
28124
28149
|
try {
|
|
28125
28150
|
stream = compressed ? decompressStream(Buffer.from(entry.content)) : Buffer.from(entry.content);
|
|
@@ -28170,7 +28195,7 @@ async function patchHwp(original, editedMarkdown, options) {
|
|
|
28170
28195
|
}
|
|
28171
28196
|
}
|
|
28172
28197
|
let verification;
|
|
28173
|
-
if (_optionalChain([options, 'optionalAccess',
|
|
28198
|
+
if (_optionalChain([options, 'optionalAccess', _477 => _477.verify]) !== false) {
|
|
28174
28199
|
try {
|
|
28175
28200
|
const reparsed = parseHwp5Document(Buffer.from(data));
|
|
28176
28201
|
const normBr = (u) => ({ ...u, raw: u.raw.replace(/<br\s*\/?\s*>/gi, "\n") });
|
|
@@ -28260,7 +28285,7 @@ function tableContentScore(irTable, scanTable) {
|
|
|
28260
28285
|
for (const [key, scanCell] of scanTable.cells) {
|
|
28261
28286
|
const comma = key.indexOf(",");
|
|
28262
28287
|
const r = Number(key.slice(0, comma)), c = Number(key.slice(comma + 1));
|
|
28263
|
-
const irCell = _optionalChain([irTable, 'access',
|
|
28288
|
+
const irCell = _optionalChain([irTable, 'access', _478 => _478.cells, 'access', _479 => _479[r], 'optionalAccess', _480 => _480[c]]);
|
|
28264
28289
|
if (!irCell) continue;
|
|
28265
28290
|
const a = normForMatch(scanCell.paras.map((p) => p.rawText).join(" "));
|
|
28266
28291
|
const b = normForMatch(stripCellTokens(irCell.text));
|
|
@@ -28296,7 +28321,7 @@ function handleModified(orig, edited, ctx) {
|
|
|
28296
28321
|
}
|
|
28297
28322
|
function patchParagraph(block, orig, edited, ctx, skip) {
|
|
28298
28323
|
const mapping = ctx.paraMap.get(orig.blockIdx);
|
|
28299
|
-
if (!_optionalChain([mapping, 'optionalAccess',
|
|
28324
|
+
if (!_optionalChain([mapping, 'optionalAccess', _481 => _481.para])) return skip("\uBB38\uB2E8 \uC18C\uC2A4\uB9F5 \uB9E4\uD551 \uC2E4\uD328 (\uBA38\uB9AC\uB9D0/\uAE00\uC0C1\uC790/\uCEA1\uC158 \uC601\uC5ED\uC774\uAC70\uB098 \uD14D\uC2A4\uD2B8 \uBD88\uC77C\uCE58)");
|
|
28300
28325
|
const restoreBr = (s) => s.replace(/(?:\s*<br\s*\/?\s*>\s*)+/gi, "\n");
|
|
28301
28326
|
let newPlain = restoreBr(textUnitToPlain(edited.raw, block));
|
|
28302
28327
|
if (block.text && block.text.includes("\n") && !newPlain.includes("\n")) {
|
|
@@ -28495,7 +28520,7 @@ function applyCellEdit5(table2, scanTable, gridR, gridC, newLines, ctx, before,
|
|
|
28495
28520
|
};
|
|
28496
28521
|
const cell2 = scanTable.cells.get(`${gridR},${gridC}`);
|
|
28497
28522
|
if (!cell2) return skip("\uC140 \uC88C\uD45C \uB9E4\uD551 \uC2E4\uD328 (\uBCD1\uD569 \uC601\uC5ED\uC758 \uBE48 \uCE78\uC774\uAC70\uB098 \uC88C\uD45C \uBD88\uC77C\uCE58)");
|
|
28498
|
-
const irCell = _optionalChain([table2, 'access',
|
|
28523
|
+
const irCell = _optionalChain([table2, 'access', _482 => _482.cells, 'access', _483 => _483[gridR], 'optionalAccess', _484 => _484[gridC]]);
|
|
28499
28524
|
const scanJoined = cell2.paras.map((p) => p.rawText).filter((t) => normForMatch(t)).join("\n");
|
|
28500
28525
|
if (irCell && normForMatch(scanJoined) !== normForMatch(stripCellTokens(irCell.text))) {
|
|
28501
28526
|
if (normForMatch(irCell.text) !== "" || normForMatch(scanJoined) !== "") {
|
|
@@ -28902,11 +28927,11 @@ var RULES2 = {
|
|
|
28902
28927
|
}
|
|
28903
28928
|
};
|
|
28904
28929
|
function redactText(text, options) {
|
|
28905
|
-
const maskChar = _nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
28930
|
+
const maskChar = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _485 => _485.maskChar]), () => ( "\u25CF"));
|
|
28906
28931
|
if (maskChar.length !== 1 || /[0-9A-Za-z]/.test(maskChar)) {
|
|
28907
28932
|
throw new Error(`maskChar\uB294 \uC601\uC22B\uC790\uAC00 \uC544\uB2CC 1\uAE00\uC790\uC5EC\uC57C \uD568: ${JSON.stringify(maskChar)}`);
|
|
28908
28933
|
}
|
|
28909
|
-
const enabled = _nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
28934
|
+
const enabled = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _486 => _486.rules]), () => ( DEFAULT_REDACT_RULES));
|
|
28910
28935
|
const hits = [];
|
|
28911
28936
|
if (text === "" || enabled.length === 0) return { text, hits };
|
|
28912
28937
|
const occupied = [];
|
|
@@ -28961,8 +28986,8 @@ function sameBreadcrumb(a, b) {
|
|
|
28961
28986
|
return a.length === b.length && a.every((v, i) => v === b[i]);
|
|
28962
28987
|
}
|
|
28963
28988
|
function blocksToChunks(blocks, options) {
|
|
28964
|
-
const granularity = _nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
28965
|
-
const includeCells = _nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
28989
|
+
const granularity = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _487 => _487.granularity]), () => ( "section"));
|
|
28990
|
+
const includeCells = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _488 => _488.includeTableCells]), () => ( false));
|
|
28966
28991
|
const chunks = [];
|
|
28967
28992
|
const headingStack = [];
|
|
28968
28993
|
const listStack = [];
|
|
@@ -28976,12 +29001,12 @@ function blocksToChunks(blocks, options) {
|
|
|
28976
29001
|
let run = null;
|
|
28977
29002
|
const flushRun = () => {
|
|
28978
29003
|
if (!run) return;
|
|
28979
|
-
push("text", run.breadcrumb,
|
|
29004
|
+
push("text", run.breadcrumb, _chunk6GM2QLM3cjs.blocksToMarkdown.call(void 0, run.blocks), [run.start, run.end], run.page);
|
|
28980
29005
|
run = null;
|
|
28981
29006
|
};
|
|
28982
29007
|
for (let i = 0; i < blocks.length; i++) {
|
|
28983
29008
|
const block = blocks[i];
|
|
28984
|
-
const md2 =
|
|
29009
|
+
const md2 = _chunk6GM2QLM3cjs.blocksToMarkdown.call(void 0, [block]);
|
|
28985
29010
|
if (!md2) continue;
|
|
28986
29011
|
if (block.type === "heading") {
|
|
28987
29012
|
flushRun();
|
|
@@ -29097,7 +29122,7 @@ var HwpxSession = (_class8 = class _HwpxSession {
|
|
|
29097
29122
|
const block = st.blocks[blockIndex];
|
|
29098
29123
|
if (!block) return void 0;
|
|
29099
29124
|
if (block.type === "paragraph" || block.type === "heading") {
|
|
29100
|
-
const para2 = _optionalChain([st, 'access',
|
|
29125
|
+
const para2 = _optionalChain([st, 'access', _489 => _489.paraMap, 'access', _490 => _490.get, 'call', _491 => _491(blockIndex), 'optionalAccess', _492 => _492.para]);
|
|
29101
29126
|
if (!para2) return void 0;
|
|
29102
29127
|
return { kind: "paragraph", sectionIndex: para2.sectionIndex, xmlStart: para2.start };
|
|
29103
29128
|
}
|
|
@@ -29122,7 +29147,7 @@ var HwpxSession = (_class8 = class _HwpxSession {
|
|
|
29122
29147
|
if (block.text && block.text.includes("\n")) {
|
|
29123
29148
|
return { capability: "locked", reason: "\uBB38\uB2E8 \uB0B4 \uAC15\uC81C \uC904\uBC14\uAFC8 \uD3EC\uD568 \u2014 \uC218\uC815 \uC2DC \uC904\uBC14\uAFC8 \uBCF4\uC874 \uBD88\uAC00\uB85C \uBBF8\uC9C0\uC6D0 (v1)" };
|
|
29124
29149
|
}
|
|
29125
|
-
if (!_optionalChain([st, 'access',
|
|
29150
|
+
if (!_optionalChain([st, 'access', _493 => _493.paraMap, 'access', _494 => _494.get, 'call', _495 => _495(blockIndex), 'optionalAccess', _496 => _496.para])) {
|
|
29126
29151
|
return { capability: "locked", reason: "\uBB38\uB2E8 \uC18C\uC2A4\uB9F5 \uB9E4\uD551 \uC2E4\uD328 (\uBA38\uB9AC\uB9D0/\uAE00\uC0C1\uC790/\uCEA1\uC158 \uC601\uC5ED\uC774\uAC70\uB098 \uD14D\uC2A4\uD2B8 \uBD88\uC77C\uCE58)" };
|
|
29127
29152
|
}
|
|
29128
29153
|
return { capability: "text" };
|
|
@@ -29188,7 +29213,7 @@ var HwpxSession = (_class8 = class _HwpxSession {
|
|
|
29188
29213
|
continue;
|
|
29189
29214
|
}
|
|
29190
29215
|
if (block.type === "table" && block.table) {
|
|
29191
|
-
if (!_optionalChain([edit, 'access',
|
|
29216
|
+
if (!_optionalChain([edit, 'access', _497 => _497.cells, 'optionalAccess', _498 => _498.length])) {
|
|
29192
29217
|
skipped.push({ reason: "\uD45C \uBE14\uB85D\uC5D0\uB294 cells \uD3B8\uC9D1\uB9CC \uC9C0\uC6D0", before: summarize(_nullishCoalesce(block.table.caption, () => ( "(\uD45C)"))) });
|
|
29193
29218
|
continue;
|
|
29194
29219
|
}
|
|
@@ -29208,7 +29233,7 @@ var HwpxSession = (_class8 = class _HwpxSession {
|
|
|
29208
29233
|
skipped.push({ reason: "\uAC19\uC740 \uC140\uC5D0 \uC911\uBCF5 \uD3B8\uC9D1 \u2014 \uBA3C\uC800 \uC801\uC6A9\uB41C \uD3B8\uC9D1 \uC720\uC9C0", after: summarize(cellEdit.text) });
|
|
29209
29234
|
continue;
|
|
29210
29235
|
}
|
|
29211
|
-
const irCell = _optionalChain([block, 'access',
|
|
29236
|
+
const irCell = _optionalChain([block, 'access', _499 => _499.table, 'access', _500 => _500.cells, 'access', _501 => _501[cellEdit.row], 'optionalAccess', _502 => _502[cellEdit.col]]);
|
|
29212
29237
|
if (!irCell) {
|
|
29213
29238
|
skipped.push({ reason: `\uC140 \uC88C\uD45C \uBC94\uC704 \uBC16: ${cellEdit.row},${cellEdit.col}`, after: summarize(cellEdit.text) });
|
|
29214
29239
|
continue;
|
|
@@ -29264,7 +29289,7 @@ var HwpxSession = (_class8 = class _HwpxSession {
|
|
|
29264
29289
|
}
|
|
29265
29290
|
if (replacements.size === 0) {
|
|
29266
29291
|
let changes2;
|
|
29267
|
-
if (_optionalChain([options, 'optionalAccess',
|
|
29292
|
+
if (_optionalChain([options, 'optionalAccess', _503 => _503.verify]) !== false) {
|
|
29268
29293
|
const units = splitMarkdownUnits(st.markdown);
|
|
29269
29294
|
changes2 = diffUnitLists(units, units);
|
|
29270
29295
|
}
|
|
@@ -29285,7 +29310,7 @@ var HwpxSession = (_class8 = class _HwpxSession {
|
|
|
29285
29310
|
}
|
|
29286
29311
|
this.state = newState;
|
|
29287
29312
|
let changes;
|
|
29288
|
-
if (_optionalChain([options, 'optionalAccess',
|
|
29313
|
+
if (_optionalChain([options, 'optionalAccess', _504 => _504.verify]) !== false) {
|
|
29289
29314
|
changes = diffUnitLists(splitMarkdownUnits(beforeMarkdown), splitMarkdownUnits(newState.markdown));
|
|
29290
29315
|
}
|
|
29291
29316
|
return { success: true, data: new Uint8Array(data), applied, skipped, changes };
|
|
@@ -29305,7 +29330,7 @@ var HwpxSession = (_class8 = class _HwpxSession {
|
|
|
29305
29330
|
return skip("\uBB38\uB2E8 \uB0B4 \uAC15\uC81C \uC904\uBC14\uAFC8 \uD3EC\uD568 \u2014 \uC218\uC815 \uC2DC \uC904\uBC14\uAFC8 \uBCF4\uC874 \uBD88\uAC00\uB85C \uBBF8\uC9C0\uC6D0 (v1)");
|
|
29306
29331
|
}
|
|
29307
29332
|
const mapping = st.paraMap.get(blockIndex);
|
|
29308
|
-
if (!_optionalChain([mapping, 'optionalAccess',
|
|
29333
|
+
if (!_optionalChain([mapping, 'optionalAccess', _505 => _505.para])) {
|
|
29309
29334
|
return skip("\uBB38\uB2E8 \uC18C\uC2A4\uB9F5 \uB9E4\uD551 \uC2E4\uD328 (\uBA38\uB9AC\uB9D0/\uAE00\uC0C1\uC790/\uCEA1\uC158 \uC601\uC5ED\uC774\uAC70\uB098 \uD14D\uC2A4\uD2B8 \uBD88\uC77C\uCE58)");
|
|
29310
29335
|
}
|
|
29311
29336
|
let newPlain = newTextRaw.split("\n").map((l) => l.trim()).filter(Boolean).join(" ");
|
|
@@ -29325,14 +29350,14 @@ var HwpxSession = (_class8 = class _HwpxSession {
|
|
|
29325
29350
|
if (sanitizeText(newPlain) !== newPlain) {
|
|
29326
29351
|
return skip("\uACF5\uBC31 \uC815\uADDC\uD654 \uBD88\uC548\uC815 \uD14D\uC2A4\uD2B8 \u2014 \uD328\uCE58 \uC2DC \uC6D0\uBB38 \uBCF4\uC874 \uBD88\uAC00\uB85C \uBBF8\uC9C0\uC6D0");
|
|
29327
29352
|
}
|
|
29328
|
-
const splices = buildParagraphSplices(mapping.para, newPlain, _optionalChain([st, 'access',
|
|
29353
|
+
const splices = buildParagraphSplices(mapping.para, newPlain, _optionalChain([st, 'access', _506 => _506.scans, 'access', _507 => _507[mapping.para.sectionIndex], 'optionalAccess', _508 => _508.xml]));
|
|
29329
29354
|
if (splices === null) return skip("\uBB38\uB2E8\uC5D0 \uD14D\uC2A4\uD2B8 \uB178\uB4DC\uB97C \uB9CC\uB4E4 \uC218 \uC5C6\uC74C");
|
|
29330
29355
|
sectionSplices[mapping.para.sectionIndex].push(...splices);
|
|
29331
29356
|
return 1;
|
|
29332
29357
|
}
|
|
29333
29358
|
}, _class8);
|
|
29334
29359
|
function cellStaticCheck(table2, scanTable, r, c) {
|
|
29335
|
-
const irCell = _optionalChain([table2, 'access',
|
|
29360
|
+
const irCell = _optionalChain([table2, 'access', _509 => _509.cells, 'access', _510 => _510[r], 'optionalAccess', _511 => _511[c]]);
|
|
29336
29361
|
if (!irCell) return { editable: false, reason: "\uC140 \uC88C\uD45C \uBC94\uC704 \uBC16" };
|
|
29337
29362
|
const cell2 = scanTable.cellByAnchor.get(`${r},${c}`);
|
|
29338
29363
|
if (!cell2) return { editable: false, reason: "\uBCD1\uD569 \uC601\uC5ED\uC758 \uBE48 \uCE78\uC774\uAC70\uB098 \uC88C\uD45C \uBD88\uC77C\uCE58" };
|
|
@@ -29416,11 +29441,11 @@ var md = new (0, _markdownit2.default)({
|
|
|
29416
29441
|
breaks: false
|
|
29417
29442
|
});
|
|
29418
29443
|
function renderHtml(markdown, options) {
|
|
29419
|
-
const preset = _nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
29420
|
-
const css = PRESETS[preset] + (_nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
29444
|
+
const preset = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _512 => _512.preset]), () => ( "default"));
|
|
29445
|
+
const css = PRESETS[preset] + (_nullishCoalesce(_optionalChain([options, 'optionalAccess', _513 => _513.extraCss]), () => ( "")));
|
|
29421
29446
|
const body = md.render(markdown);
|
|
29422
|
-
const watermark = _optionalChain([options, 'optionalAccess',
|
|
29423
|
-
const watermarkCss = _optionalChain([options, 'optionalAccess',
|
|
29447
|
+
const watermark = _optionalChain([options, 'optionalAccess', _514 => _514.watermark]) ? `<div class="watermark">${escapeHtml(options.watermark)}</div>` : "";
|
|
29448
|
+
const watermarkCss = _optionalChain([options, 'optionalAccess', _515 => _515.watermark]) ? `
|
|
29424
29449
|
.watermark {
|
|
29425
29450
|
position: fixed;
|
|
29426
29451
|
top: 50%; left: 50%;
|
|
@@ -29451,13 +29476,13 @@ async function htmlToPdf(html, options) {
|
|
|
29451
29476
|
try {
|
|
29452
29477
|
puppeteer = await Promise.resolve().then(() => _interopRequireWildcard(require("puppeteer-core")));
|
|
29453
29478
|
} catch (e32) {
|
|
29454
|
-
throw new (0,
|
|
29479
|
+
throw new (0, _chunkGZ7W64QUcjs.KordocError)(
|
|
29455
29480
|
"PDF \uC0DD\uC131\uC5D0 puppeteer-core\uAC00 \uD544\uC694\uD569\uB2C8\uB2E4. \uC124\uCE58: npm install puppeteer-core"
|
|
29456
29481
|
);
|
|
29457
29482
|
}
|
|
29458
29483
|
const executablePath = _nullishCoalesce(process.env.PUPPETEER_EXECUTABLE_PATH, () => ( findChromiumPath()));
|
|
29459
29484
|
if (!executablePath) {
|
|
29460
|
-
throw new (0,
|
|
29485
|
+
throw new (0, _chunkGZ7W64QUcjs.KordocError)(
|
|
29461
29486
|
"Chromium \uC2E4\uD589 \uD30C\uC77C\uC744 \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4. PUPPETEER_EXECUTABLE_PATH \uD658\uACBD\uBCC0\uC218\uB97C \uC124\uC815\uD558\uC138\uC694."
|
|
29462
29487
|
);
|
|
29463
29488
|
}
|
|
@@ -29469,10 +29494,10 @@ async function htmlToPdf(html, options) {
|
|
|
29469
29494
|
try {
|
|
29470
29495
|
const page = await browser.newPage();
|
|
29471
29496
|
await page.setContent(html, { waitUntil: "networkidle0" });
|
|
29472
|
-
const margin = _optionalChain([options, 'optionalAccess',
|
|
29497
|
+
const margin = _optionalChain([options, 'optionalAccess', _516 => _516.margin]);
|
|
29473
29498
|
const pdf = await page.pdf({
|
|
29474
|
-
format: _nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
29475
|
-
landscape: _optionalChain([options, 'optionalAccess',
|
|
29499
|
+
format: _nullishCoalesce(_optionalChain([options, 'optionalAccess', _517 => _517.pageSize]), () => ( "A4")),
|
|
29500
|
+
landscape: _optionalChain([options, 'optionalAccess', _518 => _518.orientation]) === "landscape",
|
|
29476
29501
|
printBackground: true,
|
|
29477
29502
|
margin: margin ? {
|
|
29478
29503
|
top: toCss(margin.top),
|
|
@@ -29480,9 +29505,9 @@ async function htmlToPdf(html, options) {
|
|
|
29480
29505
|
bottom: toCss(margin.bottom),
|
|
29481
29506
|
left: toCss(margin.left)
|
|
29482
29507
|
} : void 0,
|
|
29483
|
-
displayHeaderFooter: !!(_optionalChain([options, 'optionalAccess',
|
|
29484
|
-
headerTemplate: _nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
29485
|
-
footerTemplate: _nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
29508
|
+
displayHeaderFooter: !!(_optionalChain([options, 'optionalAccess', _519 => _519.header]) || _optionalChain([options, 'optionalAccess', _520 => _520.footer])),
|
|
29509
|
+
headerTemplate: _nullishCoalesce(_optionalChain([options, 'optionalAccess', _521 => _521.header]), () => ( "<div></div>")),
|
|
29510
|
+
footerTemplate: _nullishCoalesce(_optionalChain([options, 'optionalAccess', _522 => _522.footer]), () => ( '<div style="font-size:8pt;width:100%;text-align:center;color:#777;"><span class="pageNumber"></span>/<span class="totalPages"></span></div>'))
|
|
29486
29511
|
});
|
|
29487
29512
|
return Buffer.from(pdf);
|
|
29488
29513
|
} finally {
|
|
@@ -29516,7 +29541,7 @@ async function markdownToPdf(markdown, options) {
|
|
|
29516
29541
|
return htmlToPdf(html, options);
|
|
29517
29542
|
}
|
|
29518
29543
|
async function blocksToPdf(blocks, options) {
|
|
29519
|
-
const markdown =
|
|
29544
|
+
const markdown = _chunk6GM2QLM3cjs.blocksToMarkdown.call(void 0, blocks);
|
|
29520
29545
|
return markdownToPdf(markdown, options);
|
|
29521
29546
|
}
|
|
29522
29547
|
|
|
@@ -29695,7 +29720,7 @@ function reflowPara(p, doc, styles, areaW, startV, mode) {
|
|
|
29695
29720
|
}
|
|
29696
29721
|
const wrapAttr = _nullishCoalesce(o.el.getAttribute("textWrap"), () => ( ""));
|
|
29697
29722
|
if (wrapAttr === "BEHIND_TEXT" || wrapAttr === "IN_FRONT_OF_TEXT") continue;
|
|
29698
|
-
const vertRel = _nullishCoalesce(_optionalChain([pos, 'optionalAccess',
|
|
29723
|
+
const vertRel = _nullishCoalesce(_optionalChain([pos, 'optionalAccess', _523 => _523.getAttribute, 'call', _524 => _524("vertRelTo")]), () => ( "PARA"));
|
|
29699
29724
|
if (vertRel === "PAGE" || vertRel === "PAPER") continue;
|
|
29700
29725
|
const vo = Math.max(0, num2(pos, "vertOffset"));
|
|
29701
29726
|
if (wrapAttr === "TOP_AND_BOTTOM") {
|
|
@@ -29756,7 +29781,7 @@ function reflowBlockFlow(container, doc, styles, areaW, mode, counter, bodyH) {
|
|
|
29756
29781
|
if (ln(p) !== "p") continue;
|
|
29757
29782
|
reflowTablesIn(p, doc, styles, mode, counter);
|
|
29758
29783
|
const g = styles.paraGeom.get(_nullishCoalesce(p.getAttribute("paraPrIDRef"), () => ( "")));
|
|
29759
|
-
const startV = cursorV + prevSpaceAfter + (_nullishCoalesce(_optionalChain([g, 'optionalAccess',
|
|
29784
|
+
const startV = cursorV + prevSpaceAfter + (_nullishCoalesce(_optionalChain([g, 'optionalAccess', _525 => _525.spaceBefore]), () => ( 0)));
|
|
29760
29785
|
const res = reflowPara(p, doc, styles, areaW, startV, mode);
|
|
29761
29786
|
if (!res) {
|
|
29762
29787
|
const lsa = findChildByLocalName(p, "linesegarray");
|
|
@@ -29769,7 +29794,7 @@ function reflowBlockFlow(container, doc, styles, areaW, mode, counter, bodyH) {
|
|
|
29769
29794
|
}
|
|
29770
29795
|
if (Number.isFinite(bottom)) {
|
|
29771
29796
|
cursorV = bottom;
|
|
29772
|
-
prevSpaceAfter = _nullishCoalesce(_optionalChain([g, 'optionalAccess',
|
|
29797
|
+
prevSpaceAfter = _nullishCoalesce(_optionalChain([g, 'optionalAccess', _526 => _526.spaceAfter]), () => ( 0));
|
|
29773
29798
|
}
|
|
29774
29799
|
}
|
|
29775
29800
|
continue;
|
|
@@ -29818,7 +29843,7 @@ function findFirst(el, name, depth = 0) {
|
|
|
29818
29843
|
return null;
|
|
29819
29844
|
}
|
|
29820
29845
|
function escapeXml3(s) {
|
|
29821
|
-
return s.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """);
|
|
29846
|
+
return s.replace(/[\x00-\x08\x0B\x0C\x0E-\x1F]/g, "").replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """);
|
|
29822
29847
|
}
|
|
29823
29848
|
var OBJ_TAGS = /* @__PURE__ */ new Set(["tbl", "pic", "container", "equation", "rect", "ellipse", "polygon", "curv", "line", "arc", "ole", "textart"]);
|
|
29824
29849
|
var pt = (u) => String(Math.round(u) / 100);
|
|
@@ -29879,7 +29904,7 @@ function buildPara(p) {
|
|
|
29879
29904
|
el: ch,
|
|
29880
29905
|
tag: cn,
|
|
29881
29906
|
index: chars.length,
|
|
29882
|
-
inline: _optionalChain([pos, 'optionalAccess',
|
|
29907
|
+
inline: _optionalChain([pos, 'optionalAccess', _527 => _527.getAttribute, 'call', _528 => _528("treatAsChar")]) === "1",
|
|
29883
29908
|
width: w,
|
|
29884
29909
|
height: h
|
|
29885
29910
|
});
|
|
@@ -30131,15 +30156,15 @@ function drawShape(o, x, y, ctx, depth) {
|
|
|
30131
30156
|
const sx = ow > 0 ? w / ow : 1;
|
|
30132
30157
|
const sy = oh > 0 ? h / oh : 1;
|
|
30133
30158
|
const lineShape = findChildByLocalName(el, "lineShape");
|
|
30134
|
-
const lstyle = _nullishCoalesce(_optionalChain([lineShape, 'optionalAccess',
|
|
30135
|
-
const strokeCol = _optionalChain([lineShape, 'optionalAccess',
|
|
30159
|
+
const lstyle = _nullishCoalesce(_optionalChain([lineShape, 'optionalAccess', _529 => _529.getAttribute, 'call', _530 => _530("style")]), () => ( "SOLID"));
|
|
30160
|
+
const strokeCol = _optionalChain([lineShape, 'optionalAccess', _531 => _531.getAttribute, 'call', _532 => _532("color")]) || "#000000";
|
|
30136
30161
|
const hasStroke = lstyle !== "NONE";
|
|
30137
30162
|
const strokeW = hasStroke ? shapeStrokePt(lineShape ? num3(lineShape, "width") : 33) : 0;
|
|
30138
30163
|
const dash = /DASH|DOT/.test(lstyle) ? ` stroke-dasharray="${lstyle.includes("DOT") ? "1,1.5" : "3,1.5"}"` : "";
|
|
30139
30164
|
const strokeAttr = hasStroke ? ` stroke="${escapeXml3(strokeCol)}" stroke-width="${strokeW.toFixed(2)}"${dash}` : "";
|
|
30140
30165
|
const fillBrush = findChildByLocalName(el, "fillBrush");
|
|
30141
30166
|
const winBrush = fillBrush ? findChildByLocalName(fillBrush, "winBrush") : null;
|
|
30142
|
-
const face = _optionalChain([winBrush, 'optionalAccess',
|
|
30167
|
+
const face = _optionalChain([winBrush, 'optionalAccess', _533 => _533.getAttribute, 'call', _534 => _534("faceColor")]);
|
|
30143
30168
|
const fill = face && face.toLowerCase() !== "none" ? face : "none";
|
|
30144
30169
|
const fillAttr = ` fill="${fill === "none" ? "none" : escapeXml3(fill)}"`;
|
|
30145
30170
|
if (o.tag === "rect") {
|
|
@@ -30166,14 +30191,14 @@ function drawShape(o, x, y, ctx, depth) {
|
|
|
30166
30191
|
}
|
|
30167
30192
|
function cellContentExtent(cell2, memo) {
|
|
30168
30193
|
if (!cell2.sub) return 0;
|
|
30169
|
-
const hit = _optionalChain([memo, 'optionalAccess',
|
|
30194
|
+
const hit = _optionalChain([memo, 'optionalAccess', _535 => _535.cell, 'access', _536 => _536.get, 'call', _537 => _537(cell2.el)]);
|
|
30170
30195
|
if (hit !== void 0) return hit;
|
|
30171
30196
|
let ext = 0;
|
|
30172
30197
|
for (const p of elements2(cell2.sub)) {
|
|
30173
30198
|
if (ln2(p) !== "p") continue;
|
|
30174
30199
|
const m = buildPara(p);
|
|
30175
30200
|
for (const s of m.segs) ext = Math.max(ext, s.vertpos + s.textheight);
|
|
30176
|
-
const baseV = _nullishCoalesce(_optionalChain([m, 'access',
|
|
30201
|
+
const baseV = _nullishCoalesce(_optionalChain([m, 'access', _538 => _538.segs, 'access', _539 => _539[0], 'optionalAccess', _540 => _540.vertpos]), () => ( 0));
|
|
30177
30202
|
for (const o of m.objs) {
|
|
30178
30203
|
if (o.inline) {
|
|
30179
30204
|
const h = o.tag === "tbl" ? Math.max(o.height, measureTableHeight(o.el, memo)) : o.height;
|
|
@@ -30181,14 +30206,14 @@ function cellContentExtent(cell2, memo) {
|
|
|
30181
30206
|
continue;
|
|
30182
30207
|
}
|
|
30183
30208
|
const pos = findChildByLocalName(o.el, "pos");
|
|
30184
|
-
if ((_nullishCoalesce(_optionalChain([pos, 'optionalAccess',
|
|
30209
|
+
if ((_nullishCoalesce(_optionalChain([pos, 'optionalAccess', _541 => _541.getAttribute, 'call', _542 => _542("vertRelTo")]), () => ( "PARA"))) !== "PARA") continue;
|
|
30185
30210
|
const om = findChildByLocalName(o.el, "outMargin");
|
|
30186
30211
|
const pushed = baseV - (num3(om, "top") + o.height + num3(om, "bottom"));
|
|
30187
30212
|
const anchor = pushed >= -100 ? pushed : baseV;
|
|
30188
30213
|
ext = Math.max(ext, anchor + num3(om, "top") + num3(pos, "vertOffset") + o.height);
|
|
30189
30214
|
}
|
|
30190
30215
|
}
|
|
30191
|
-
_optionalChain([memo, 'optionalAccess',
|
|
30216
|
+
_optionalChain([memo, 'optionalAccess', _543 => _543.cell, 'access', _544 => _544.set, 'call', _545 => _545(cell2.el, ext)]);
|
|
30192
30217
|
return ext;
|
|
30193
30218
|
}
|
|
30194
30219
|
function edgeLine(x1, y1, x2, y2, e) {
|
|
@@ -30230,7 +30255,7 @@ function collectCells(tbl2) {
|
|
|
30230
30255
|
return cells;
|
|
30231
30256
|
}
|
|
30232
30257
|
function measureTableHeight(tbl2, memo) {
|
|
30233
|
-
const hit = _optionalChain([memo, 'optionalAccess',
|
|
30258
|
+
const hit = _optionalChain([memo, 'optionalAccess', _546 => _546.table, 'access', _547 => _547.get, 'call', _548 => _548(tbl2)]);
|
|
30234
30259
|
if (hit !== void 0) return hit;
|
|
30235
30260
|
const cells = collectCells(tbl2);
|
|
30236
30261
|
if (cells.length === 0 || cells.length > 4096) return 0;
|
|
@@ -30241,7 +30266,7 @@ function measureTableHeight(tbl2, memo) {
|
|
|
30241
30266
|
);
|
|
30242
30267
|
let sum = 0;
|
|
30243
30268
|
for (const h of rowH) sum += h;
|
|
30244
|
-
_optionalChain([memo, 'optionalAccess',
|
|
30269
|
+
_optionalChain([memo, 'optionalAccess', _549 => _549.table, 'access', _550 => _550.set, 'call', _551 => _551(tbl2, sum)]);
|
|
30245
30270
|
return sum;
|
|
30246
30271
|
}
|
|
30247
30272
|
function drawTable(tbl2, tx, ty, ctx, depth) {
|
|
@@ -30272,7 +30297,7 @@ function drawTable(tbl2, tx, ty, ctx, depth) {
|
|
|
30272
30297
|
}));
|
|
30273
30298
|
for (const g of geom) {
|
|
30274
30299
|
const bf = g.c.bfId != null ? ctx.styles.borderFill.get(g.c.bfId) : void 0;
|
|
30275
|
-
if (_optionalChain([bf, 'optionalAccess',
|
|
30300
|
+
if (_optionalChain([bf, 'optionalAccess', _552 => _552.fill])) emit(ctx, `<rect x="${pt(g.x)}" y="${pt(g.y)}" width="${pt(g.w)}" height="${pt(g.h)}" fill="${escapeXml3(bf.fill)}"/>`);
|
|
30276
30301
|
}
|
|
30277
30302
|
for (const g of geom) {
|
|
30278
30303
|
const { c } = g;
|
|
@@ -30310,7 +30335,7 @@ function drawPic(pic, x, y, ctx) {
|
|
|
30310
30335
|
const sz = findChildByLocalName(pic, "sz");
|
|
30311
30336
|
const w = num3(sz, "width", 5669), h = num3(sz, "height", 5669);
|
|
30312
30337
|
const img = findFirst(pic, "img");
|
|
30313
|
-
const ref = _optionalChain([img, 'optionalAccess',
|
|
30338
|
+
const ref = _optionalChain([img, 'optionalAccess', _553 => _553.getAttribute, 'call', _554 => _554("binaryItemIDRef")]);
|
|
30314
30339
|
const loaded = ref != null ? ctx.images.get(ref) : void 0;
|
|
30315
30340
|
if (!loaded) {
|
|
30316
30341
|
emit(ctx, `<rect x="${pt(x)}" y="${pt(y)}" width="${pt(w)}" height="${pt(h)}" fill="#eee" stroke="#c00" stroke-width="0.5"/>`);
|
|
@@ -30350,7 +30375,7 @@ function readSectionGeom(root) {
|
|
|
30350
30375
|
const pagePr = findFirst(root, "pagePr");
|
|
30351
30376
|
const margin = pagePr ? findChildByLocalName(pagePr, "margin") : null;
|
|
30352
30377
|
let PW = num3(pagePr, "width", 59528), PH = num3(pagePr, "height", 84188);
|
|
30353
|
-
if (_optionalChain([pagePr, 'optionalAccess',
|
|
30378
|
+
if (_optionalChain([pagePr, 'optionalAccess', _555 => _555.getAttribute, 'call', _556 => _556("landscape")]) === "NARROWLY" && PW < PH) {
|
|
30354
30379
|
const t = PW;
|
|
30355
30380
|
PW = PH;
|
|
30356
30381
|
PH = t;
|
|
@@ -30408,17 +30433,17 @@ function renderSectionToPages(root, geom, ctxBase, doReflow, reflowMode) {
|
|
|
30408
30433
|
return { pages: ctx.pages, pageH };
|
|
30409
30434
|
}
|
|
30410
30435
|
async function renderHwpxToSvg(input, options) {
|
|
30411
|
-
const maxImg = _nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
30436
|
+
const maxImg = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _557 => _557.maxImageBytes]), () => ( 40 * 1024 * 1024));
|
|
30412
30437
|
const ab = input instanceof Uint8Array ? input.buffer.slice(input.byteOffset, input.byteOffset + input.byteLength) : input;
|
|
30413
|
-
|
|
30438
|
+
_chunkGZ7W64QUcjs.precheckZipSize.call(void 0, ab, MAX_DECOMPRESS_SIZE, MAX_ZIP_ENTRIES);
|
|
30414
30439
|
let zip;
|
|
30415
30440
|
try {
|
|
30416
30441
|
zip = await _jszip2.default.loadAsync(input);
|
|
30417
30442
|
} catch (e33) {
|
|
30418
|
-
throw new (0,
|
|
30443
|
+
throw new (0, _chunkGZ7W64QUcjs.KordocError)("HWPX(ZIP) \uD615\uC2DD\uC774 \uC544\uB2D9\uB2C8\uB2E4 \u2014 \uB80C\uB354\uB294 HWPX\uB9CC \uC9C0\uC6D0");
|
|
30419
30444
|
}
|
|
30420
30445
|
const secFiles = zip.file(/Contents\/section\d+\.xml$/i).sort((a, b) => a.name.localeCompare(b.name));
|
|
30421
|
-
if (secFiles.length === 0) throw new (0,
|
|
30446
|
+
if (secFiles.length === 0) throw new (0, _chunkGZ7W64QUcjs.KordocError)("Contents/section0.xml \uC5C6\uC74C \u2014 HWPX\uAC00 \uC544\uB2C8\uAC70\uB098 \uC190\uC0C1\uB428");
|
|
30422
30447
|
const warnings = [];
|
|
30423
30448
|
const headFile = _nullishCoalesce(zip.file("Contents/header.xml"), () => ( zip.file("Contents/head.xml")));
|
|
30424
30449
|
const styles = headFile ? parseRenderStyles(await headFile.async("string")) : { charPr: /* @__PURE__ */ new Map(), paraAlign: /* @__PURE__ */ new Map(), paraGeom: /* @__PURE__ */ new Map(), borderFill: /* @__PURE__ */ new Map() };
|
|
@@ -30426,7 +30451,7 @@ async function renderHwpxToSvg(input, options) {
|
|
|
30426
30451
|
const secXmls = [];
|
|
30427
30452
|
for (const f of secFiles) {
|
|
30428
30453
|
const xml = await f.async("string");
|
|
30429
|
-
if (xml.length > MAX_DECOMPRESS_SIZE) throw new (0,
|
|
30454
|
+
if (xml.length > MAX_DECOMPRESS_SIZE) throw new (0, _chunkGZ7W64QUcjs.KordocError)("\uC139\uC158 XML\uC774 \uD5C8\uC6A9 \uD06C\uAE30\uB97C \uCD08\uACFC");
|
|
30430
30455
|
secXmls.push(xml);
|
|
30431
30456
|
}
|
|
30432
30457
|
const binmap = /* @__PURE__ */ new Map();
|
|
@@ -30450,7 +30475,7 @@ async function renderHwpxToSvg(input, options) {
|
|
|
30450
30475
|
let href = binmap.get(ref);
|
|
30451
30476
|
if (!href) {
|
|
30452
30477
|
const cand = zip.file(new RegExp(`BinData/.*${ref.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")}`, "i"))[0];
|
|
30453
|
-
href = _optionalChain([cand, 'optionalAccess',
|
|
30478
|
+
href = _optionalChain([cand, 'optionalAccess', _558 => _558.name]);
|
|
30454
30479
|
}
|
|
30455
30480
|
if (!href) continue;
|
|
30456
30481
|
const f = _nullishCoalesce(zip.file(href), () => ( zip.file("Contents/" + href)));
|
|
@@ -30471,7 +30496,7 @@ async function renderHwpxToSvg(input, options) {
|
|
|
30471
30496
|
styles,
|
|
30472
30497
|
images,
|
|
30473
30498
|
defs: [],
|
|
30474
|
-
highlights: (_nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
30499
|
+
highlights: (_nullishCoalesce(_optionalChain([options, 'optionalAccess', _559 => _559.highlights]), () => ( []))).map((s) => s.trim().toLowerCase()).filter((s) => s.length > 0),
|
|
30475
30500
|
warnings,
|
|
30476
30501
|
warned: /* @__PURE__ */ new Set(),
|
|
30477
30502
|
stats: { texts: 0, images: 0, tables: 0 },
|
|
@@ -30482,7 +30507,7 @@ async function renderHwpxToSvg(input, options) {
|
|
|
30482
30507
|
for (let si = 0; si < secXmls.length; si++) {
|
|
30483
30508
|
const secXml = secXmls[si];
|
|
30484
30509
|
const hasCache = /<(?:[A-Za-z][\w.-]*:)?linesegarray[\s/>]/.test(secXml);
|
|
30485
|
-
if (!hasCache && !_optionalChain([options, 'optionalAccess',
|
|
30510
|
+
if (!hasCache && !_optionalChain([options, 'optionalAccess', _560 => _560.reflow])) {
|
|
30486
30511
|
noCacheSkipped = true;
|
|
30487
30512
|
warnings.push(`\uAD6C\uC5ED ${si}: \uC870\uD310 \uCE90\uC2DC \uC5C6\uC74C \u2014 reflow \uC635\uC158 \uD544\uC694, \uC0DD\uB7B5`);
|
|
30488
30513
|
continue;
|
|
@@ -30494,14 +30519,14 @@ async function renderHwpxToSvg(input, options) {
|
|
|
30494
30519
|
continue;
|
|
30495
30520
|
}
|
|
30496
30521
|
const geom = readSectionGeom(root);
|
|
30497
|
-
const { pages, pageH } = renderSectionToPages(root, geom, ctxBase, !!_optionalChain([options, 'optionalAccess',
|
|
30522
|
+
const { pages, pageH } = renderSectionToPages(root, geom, ctxBase, !!_optionalChain([options, 'optionalAccess', _561 => _561.reflow]), _nullishCoalesce(_optionalChain([options, 'optionalAccess', _562 => _562.reflowMode]), () => ( "keep")));
|
|
30498
30523
|
rendered.push({ pages, PW: geom.PW, pageH, clipId: `pgclip${si}` });
|
|
30499
30524
|
}
|
|
30500
30525
|
if (rendered.length === 0) {
|
|
30501
30526
|
if (noCacheSkipped) {
|
|
30502
|
-
throw new (0,
|
|
30527
|
+
throw new (0, _chunkGZ7W64QUcjs.KordocError)("\uC870\uD310 \uCE90\uC2DC(linesegarray) \uC5C6\uC74C \u2014 \uD55C\uCEF4\uC5D0\uC11C \uC800\uC7A5\uD55C HWPX\uB9CC \uB80C\uB354 \uAC00\uB2A5 (reflow \uC635\uC158\uC73C\uB85C \uD569\uC131 \uB80C\uB354 \uAC00\uB2A5)");
|
|
30503
30528
|
}
|
|
30504
|
-
throw new (0,
|
|
30529
|
+
throw new (0, _chunkGZ7W64QUcjs.KordocError)("\uB80C\uB354\uD560 \uAD6C\uC5ED\uC774 \uC5C6\uC2B5\uB2C8\uB2E4 \u2014 HWPX\uAC00 \uC190\uC0C1\uB418\uC5C8\uC744 \uC218 \uC788\uC2B5\uB2C8\uB2E4");
|
|
30505
30530
|
}
|
|
30506
30531
|
const GAP = 2400;
|
|
30507
30532
|
const clipDefs = [];
|
|
@@ -30533,17 +30558,17 @@ ${groups.join("\n")}
|
|
|
30533
30558
|
// src/index.ts
|
|
30534
30559
|
async function parse(input, options) {
|
|
30535
30560
|
let buffer;
|
|
30536
|
-
const opts = typeof input === "string" && !_optionalChain([options, 'optionalAccess',
|
|
30561
|
+
const opts = typeof input === "string" && !_optionalChain([options, 'optionalAccess', _563 => _563.filePath]) ? { ...options, filePath: input } : options;
|
|
30537
30562
|
if (typeof input === "string") {
|
|
30538
30563
|
try {
|
|
30539
30564
|
const buf = await _promises.readFile.call(void 0, input);
|
|
30540
|
-
buffer =
|
|
30565
|
+
buffer = _chunkGZ7W64QUcjs.toArrayBuffer.call(void 0, buf);
|
|
30541
30566
|
} catch (err) {
|
|
30542
30567
|
const msg2 = err instanceof Error && "code" in err && err.code === "ENOENT" ? `\uD30C\uC77C\uC744 \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4: ${input}` : `\uD30C\uC77C \uC77D\uAE30 \uC2E4\uD328: ${input}`;
|
|
30543
30568
|
return { success: false, fileType: "unknown", error: msg2, code: "PARSE_ERROR" };
|
|
30544
30569
|
}
|
|
30545
30570
|
} else if (Buffer.isBuffer(input)) {
|
|
30546
|
-
buffer =
|
|
30571
|
+
buffer = _chunkGZ7W64QUcjs.toArrayBuffer.call(void 0, input);
|
|
30547
30572
|
} else {
|
|
30548
30573
|
buffer = input;
|
|
30549
30574
|
}
|
|
@@ -30577,18 +30602,18 @@ async function parse(input, options) {
|
|
|
30577
30602
|
}
|
|
30578
30603
|
async function parseImage(buffer, options) {
|
|
30579
30604
|
try {
|
|
30580
|
-
const { parseImageDocument } = await Promise.resolve().then(() => _interopRequireWildcard(require("./image-ocr-
|
|
30605
|
+
const { parseImageDocument } = await Promise.resolve().then(() => _interopRequireWildcard(require("./image-ocr-J5656BEE.cjs")));
|
|
30581
30606
|
const { blocks, warnings } = await parseImageDocument(buffer, options);
|
|
30582
30607
|
return {
|
|
30583
30608
|
success: true,
|
|
30584
30609
|
fileType: "image",
|
|
30585
|
-
markdown:
|
|
30610
|
+
markdown: _chunk6GM2QLM3cjs.blocksToMarkdown.call(void 0, blocks),
|
|
30586
30611
|
blocks,
|
|
30587
30612
|
warnings: warnings.length ? warnings : void 0,
|
|
30588
30613
|
pageCount: 1
|
|
30589
30614
|
};
|
|
30590
30615
|
} catch (err) {
|
|
30591
|
-
return { success: false, fileType: "image", error:
|
|
30616
|
+
return { success: false, fileType: "image", error: _chunkGZ7W64QUcjs.sanitizeError.call(void 0, err), code: _chunkGZ7W64QUcjs.classifyError.call(void 0, err) };
|
|
30592
30617
|
}
|
|
30593
30618
|
}
|
|
30594
30619
|
async function parseHwp3(buffer, options) {
|
|
@@ -30596,21 +30621,21 @@ async function parseHwp3(buffer, options) {
|
|
|
30596
30621
|
const { markdown, blocks, metadata, outline, warnings } = parseHwp3Document(buffer, options);
|
|
30597
30622
|
return { success: true, fileType: "hwp3", markdown, blocks, metadata, outline, warnings };
|
|
30598
30623
|
} catch (err) {
|
|
30599
|
-
return { success: false, fileType: "hwp3", error:
|
|
30624
|
+
return { success: false, fileType: "hwp3", error: _chunkGZ7W64QUcjs.sanitizeError.call(void 0, err), code: _chunkGZ7W64QUcjs.classifyError.call(void 0, err) };
|
|
30600
30625
|
}
|
|
30601
30626
|
}
|
|
30602
30627
|
async function parseHwpx(buffer, options) {
|
|
30603
30628
|
try {
|
|
30604
30629
|
const { markdown, blocks, metadata, outline, warnings, images } = await parseHwpxDocument(buffer, options);
|
|
30605
|
-
return { success: true, fileType: "hwpx", markdown, blocks, metadata, outline, warnings, images: _optionalChain([images, 'optionalAccess',
|
|
30630
|
+
return { success: true, fileType: "hwpx", markdown, blocks, metadata, outline, warnings, images: _optionalChain([images, 'optionalAccess', _564 => _564.length]) ? images : void 0 };
|
|
30606
30631
|
} catch (err) {
|
|
30607
|
-
return { success: false, fileType: "hwpx", error:
|
|
30632
|
+
return { success: false, fileType: "hwpx", error: _chunkGZ7W64QUcjs.sanitizeError.call(void 0, err), code: _chunkGZ7W64QUcjs.classifyError.call(void 0, err) };
|
|
30608
30633
|
}
|
|
30609
30634
|
}
|
|
30610
30635
|
async function parseHwp(buffer, options) {
|
|
30611
30636
|
try {
|
|
30612
30637
|
const { markdown, blocks, metadata, outline, warnings, images } = parseHwp5Document(Buffer.from(buffer), options);
|
|
30613
|
-
if (isDistributionSentinel(markdown) && isComFallbackAvailable() && _optionalChain([options, 'optionalAccess',
|
|
30638
|
+
if (isDistributionSentinel(markdown) && isComFallbackAvailable() && _optionalChain([options, 'optionalAccess', _565 => _565.filePath])) {
|
|
30614
30639
|
try {
|
|
30615
30640
|
const { pages, pageCount, warnings: comWarns } = extractTextViaCom(options.filePath);
|
|
30616
30641
|
if (pages.some((p) => p && p.trim().length > 0)) {
|
|
@@ -30627,15 +30652,15 @@ async function parseHwp(buffer, options) {
|
|
|
30627
30652
|
} catch (e34) {
|
|
30628
30653
|
}
|
|
30629
30654
|
}
|
|
30630
|
-
return { success: true, fileType: "hwp", markdown, blocks, metadata, outline, warnings, images: _optionalChain([images, 'optionalAccess',
|
|
30655
|
+
return { success: true, fileType: "hwp", markdown, blocks, metadata, outline, warnings, images: _optionalChain([images, 'optionalAccess', _566 => _566.length]) ? images : void 0 };
|
|
30631
30656
|
} catch (err) {
|
|
30632
|
-
return { success: false, fileType: "hwp", error:
|
|
30657
|
+
return { success: false, fileType: "hwp", error: _chunkGZ7W64QUcjs.sanitizeError.call(void 0, err), code: _chunkGZ7W64QUcjs.classifyError.call(void 0, err) };
|
|
30633
30658
|
}
|
|
30634
30659
|
}
|
|
30635
30660
|
async function parsePdf(buffer, options) {
|
|
30636
30661
|
let parsePdfDocument;
|
|
30637
30662
|
try {
|
|
30638
|
-
const mod = await Promise.resolve().then(() => _interopRequireWildcard(require("./parser-
|
|
30663
|
+
const mod = await Promise.resolve().then(() => _interopRequireWildcard(require("./parser-CSYU3CAW.cjs")));
|
|
30639
30664
|
parsePdfDocument = mod.parsePdfDocument;
|
|
30640
30665
|
} catch (e35) {
|
|
30641
30666
|
return {
|
|
@@ -30650,7 +30675,7 @@ async function parsePdf(buffer, options) {
|
|
|
30650
30675
|
return { success: true, fileType: "pdf", markdown, blocks, metadata, outline, warnings, isImageBased, pageQuality, qualitySummary, images };
|
|
30651
30676
|
} catch (err) {
|
|
30652
30677
|
const isImageBased = err instanceof Error && "isImageBased" in err ? true : void 0;
|
|
30653
|
-
return { success: false, fileType: "pdf", error:
|
|
30678
|
+
return { success: false, fileType: "pdf", error: _chunkGZ7W64QUcjs.sanitizeError.call(void 0, err), code: _chunkGZ7W64QUcjs.classifyError.call(void 0, err), isImageBased };
|
|
30654
30679
|
}
|
|
30655
30680
|
}
|
|
30656
30681
|
async function parseXlsx(buffer, options) {
|
|
@@ -30658,7 +30683,7 @@ async function parseXlsx(buffer, options) {
|
|
|
30658
30683
|
const { markdown, blocks, metadata, warnings } = await parseXlsxDocument(buffer, options);
|
|
30659
30684
|
return { success: true, fileType: "xlsx", markdown, blocks, metadata, warnings };
|
|
30660
30685
|
} catch (err) {
|
|
30661
|
-
return { success: false, fileType: "xlsx", error:
|
|
30686
|
+
return { success: false, fileType: "xlsx", error: _chunkGZ7W64QUcjs.sanitizeError.call(void 0, err), code: _chunkGZ7W64QUcjs.classifyError.call(void 0, err) };
|
|
30662
30687
|
}
|
|
30663
30688
|
}
|
|
30664
30689
|
async function parseXls(buffer, options) {
|
|
@@ -30666,15 +30691,15 @@ async function parseXls(buffer, options) {
|
|
|
30666
30691
|
const { markdown, blocks, metadata, warnings } = await parseXlsDocument(buffer, options);
|
|
30667
30692
|
return { success: true, fileType: "xls", markdown, blocks, metadata, warnings };
|
|
30668
30693
|
} catch (err) {
|
|
30669
|
-
return { success: false, fileType: "xls", error:
|
|
30694
|
+
return { success: false, fileType: "xls", error: _chunkGZ7W64QUcjs.sanitizeError.call(void 0, err), code: _chunkGZ7W64QUcjs.classifyError.call(void 0, err) };
|
|
30670
30695
|
}
|
|
30671
30696
|
}
|
|
30672
30697
|
async function parseDocx(buffer, options) {
|
|
30673
30698
|
try {
|
|
30674
30699
|
const { markdown, blocks, metadata, outline, warnings, images } = await parseDocxDocument(buffer, options);
|
|
30675
|
-
return { success: true, fileType: "docx", markdown, blocks, metadata, outline, warnings, images: _optionalChain([images, 'optionalAccess',
|
|
30700
|
+
return { success: true, fileType: "docx", markdown, blocks, metadata, outline, warnings, images: _optionalChain([images, 'optionalAccess', _567 => _567.length]) ? images : void 0 };
|
|
30676
30701
|
} catch (err) {
|
|
30677
|
-
return { success: false, fileType: "docx", error:
|
|
30702
|
+
return { success: false, fileType: "docx", error: _chunkGZ7W64QUcjs.sanitizeError.call(void 0, err), code: _chunkGZ7W64QUcjs.classifyError.call(void 0, err) };
|
|
30678
30703
|
}
|
|
30679
30704
|
}
|
|
30680
30705
|
async function parseHwpml(buffer, options) {
|
|
@@ -30682,16 +30707,16 @@ async function parseHwpml(buffer, options) {
|
|
|
30682
30707
|
const { markdown, blocks, metadata, outline, warnings } = parseHwpmlDocument(buffer, options);
|
|
30683
30708
|
return { success: true, fileType: "hwpml", markdown, blocks, metadata, outline, warnings };
|
|
30684
30709
|
} catch (err) {
|
|
30685
|
-
return { success: false, fileType: "hwpml", error:
|
|
30710
|
+
return { success: false, fileType: "hwpml", error: _chunkGZ7W64QUcjs.sanitizeError.call(void 0, err), code: _chunkGZ7W64QUcjs.classifyError.call(void 0, err) };
|
|
30686
30711
|
}
|
|
30687
30712
|
}
|
|
30688
30713
|
async function fillForm(input, values, outputFormat = "markdown") {
|
|
30689
30714
|
let buffer;
|
|
30690
30715
|
if (typeof input === "string") {
|
|
30691
30716
|
const buf = await _promises.readFile.call(void 0, input);
|
|
30692
|
-
buffer =
|
|
30717
|
+
buffer = _chunkGZ7W64QUcjs.toArrayBuffer.call(void 0, buf);
|
|
30693
30718
|
} else if (Buffer.isBuffer(input)) {
|
|
30694
|
-
buffer =
|
|
30719
|
+
buffer = _chunkGZ7W64QUcjs.toArrayBuffer.call(void 0, input);
|
|
30695
30720
|
} else {
|
|
30696
30721
|
buffer = input;
|
|
30697
30722
|
}
|
|
@@ -30717,7 +30742,7 @@ async function fillForm(input, values, outputFormat = "markdown") {
|
|
|
30717
30742
|
throw new Error(`\uC11C\uC2DD \uD30C\uC2F1 \uC2E4\uD328: ${parsed.error}`);
|
|
30718
30743
|
}
|
|
30719
30744
|
const fill = fillFormFields(parsed.blocks, values);
|
|
30720
|
-
const markdown =
|
|
30745
|
+
const markdown = _chunk6GM2QLM3cjs.blocksToMarkdown.call(void 0, fill.blocks);
|
|
30721
30746
|
if (outputFormat === "hwpx") {
|
|
30722
30747
|
const hwpxBuffer = await markdownToHwpx(markdown);
|
|
30723
30748
|
return { output: hwpxBuffer, format: "hwpx", fill };
|
|
@@ -30791,5 +30816,5 @@ async function fillForm(input, values, outputFormat = "markdown") {
|
|
|
30791
30816
|
|
|
30792
30817
|
|
|
30793
30818
|
|
|
30794
|
-
exports.DEFAULT_REDACT_RULES = DEFAULT_REDACT_RULES; exports.HwpxSession = HwpxSession; exports.PRESET_ALIAS = PRESET_ALIAS; exports.SPACE_EM_FIXED = SPACE_EM_FIXED; exports.SPACE_EM_FONT = SPACE_EM_FONT; exports.VERSION =
|
|
30819
|
+
exports.DEFAULT_REDACT_RULES = DEFAULT_REDACT_RULES; exports.HwpxSession = HwpxSession; exports.PRESET_ALIAS = PRESET_ALIAS; exports.SPACE_EM_FIXED = SPACE_EM_FIXED; exports.SPACE_EM_FONT = SPACE_EM_FONT; exports.VERSION = _chunkGZ7W64QUcjs.VERSION; exports.ValueCursor = ValueCursor; exports.applySplices = applySplices; exports.blocksToChunks = blocksToChunks; exports.blocksToMarkdown = _chunk6GM2QLM3cjs.blocksToMarkdown; exports.blocksToPdf = blocksToPdf; exports.buildParagraphSplices = buildParagraphSplices; exports.buildRangeSplices = buildRangeSplices; exports.charWidthEm1000 = charWidthEm1000; exports.compare = compare; exports.detectFormat = detectFormat; exports.detectOle2Format = detectOle2Format; exports.detectZipFormat = detectZipFormat; exports.diffBlocks = diffBlocks; exports.extractFormFields = extractFormFields; exports.extractFormSchema = extractFormSchema; exports.fillForm = fillForm; exports.fillFormFields = fillFormFields; exports.fillHwpx = fillHwpx; exports.fillWithUniqueGuard = fillWithUniqueGuard; exports.fitRatioForFewerLines = fitRatioForFewerLines; exports.formatFillValue = formatFillValue; exports.gongmunLintWarnings = gongmunLintWarnings; exports.hwpxToProfile = hwpxToProfile; exports.incompatibleGongmunWarnings = incompatibleGongmunWarnings; exports.inferFieldType = inferFieldType; exports.isHwpxFile = isHwpxFile; exports.isKnownFont = isKnownFont; exports.isLabelCell = isLabelCell; exports.isOldHwpFile = isOldHwpFile; exports.isPdfFile = isPdfFile; exports.isZipFile = isZipFile; exports.lintGongmunText = lintGongmunText; exports.markdownToHwpx = markdownToHwpx; exports.markdownToPdf = markdownToPdf; exports.measureTextWidth = measureTextWidth; exports.normalizeGongmunPreset = normalizeGongmunPreset; exports.openHwpxDocument = openHwpxDocument; exports.parse = parse; exports.parseDocx = parseDocx; exports.parseHwp = parseHwp; exports.parseHwp3 = parseHwp3; exports.parseHwpml = parseHwpml; exports.parseHwpx = parseHwpx; exports.parseImage = parseImage; exports.parsePdf = parsePdf; exports.parseXls = parseXls; exports.parseXlsx = parseXlsx; exports.patchHwp = patchHwp; exports.patchHwpx = patchHwpx; exports.patchHwpxBlocks = patchHwpxBlocks; exports.placeSealHwpx = placeSealHwpx; exports.redactMarkdown = redactMarkdown; exports.redactText = redactText; exports.renderHtml = renderHtml; exports.renderHwpxToSvg = renderHwpxToSvg; exports.scanSectionXml = scanSectionXml; exports.simulateWrap = simulateWrap; exports.simulateWrapKeepWord = simulateWrapKeepWord; exports.unknownFontWarnings = unknownFontWarnings; exports.validateHwpx = validateHwpx;
|
|
30795
30820
|
//# sourceMappingURL=index.cjs.map
|