kordoc 3.4.1 → 3.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +6 -0
- package/dist/{-YOQGQ22S.js → -GKNSTVEZ.js} +7 -3
- package/dist/{chunk-W7JHJQ2O.cjs → chunk-4JLD2IT7.cjs} +2 -2
- package/dist/{chunk-W7JHJQ2O.cjs.map → chunk-4JLD2IT7.cjs.map} +1 -1
- package/dist/{chunk-FPFB7AFX.js → chunk-A4LSWJEC.js} +2 -2
- package/dist/{chunk-SE3KEL4G.js → chunk-AHDNELBR.js} +2 -2
- package/dist/{chunk-CGHPBI3X.js → chunk-GTCJQANY.js} +165 -9
- package/dist/chunk-GTCJQANY.js.map +1 -0
- package/dist/cli.js +6 -23
- package/dist/cli.js.map +1 -1
- package/dist/index.cjs +302 -146
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +9 -3
- package/dist/index.d.ts +9 -3
- package/dist/index.js +164 -8
- package/dist/index.js.map +1 -1
- package/dist/mcp.js +39 -3
- package/dist/mcp.js.map +1 -1
- package/dist/{parser-JAZCZJI6.cjs → parser-25ISHR7Q.cjs} +14 -14
- package/dist/{parser-JAZCZJI6.cjs.map → parser-25ISHR7Q.cjs.map} +1 -1
- package/dist/{parser-5HDZZWDH.js → parser-LBLPN3KY.js} +2 -2
- package/dist/{parser-ET64VEEX.js → parser-LMBDB7RM.js} +2 -2
- package/dist/{watch-56GNC2YN.js → watch-77CYT54V.js} +3 -3
- package/package.json +1 -1
- package/dist/chunk-CGHPBI3X.js.map +0 -1
- /package/dist/{-YOQGQ22S.js.map → -GKNSTVEZ.js.map} +0 -0
- /package/dist/{chunk-FPFB7AFX.js.map → chunk-A4LSWJEC.js.map} +0 -0
- /package/dist/{chunk-SE3KEL4G.js.map → chunk-AHDNELBR.js.map} +0 -0
- /package/dist/{parser-5HDZZWDH.js.map → parser-LBLPN3KY.js.map} +0 -0
- /package/dist/{parser-ET64VEEX.js.map → parser-LMBDB7RM.js.map} +0 -0
- /package/dist/{watch-56GNC2YN.js.map → watch-77CYT54V.js.map} +0 -0
package/dist/index.cjs
CHANGED
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
|
|
18
18
|
|
|
19
19
|
|
|
20
|
-
var
|
|
20
|
+
var _chunk4JLD2IT7cjs = require('./chunk-4JLD2IT7.cjs');
|
|
21
21
|
|
|
22
22
|
|
|
23
23
|
var _chunkX34YWRL5cjs = require('./chunk-X34YWRL5.cjs');
|
|
@@ -828,7 +828,7 @@ function createSectionShared() {
|
|
|
828
828
|
function createXmlParser(warnings) {
|
|
829
829
|
return new (0, _xmldom.DOMParser)({
|
|
830
830
|
onError(level, msg2) {
|
|
831
|
-
if (level === "fatalError") throw new (0,
|
|
831
|
+
if (level === "fatalError") throw new (0, _chunk4JLD2IT7cjs.KordocError)(`XML \uD30C\uC2F1 \uC2E4\uD328: ${msg2}`);
|
|
832
832
|
_optionalChain([warnings, 'optionalAccess', _3 => _3.push, 'call', _4 => _4({ code: "MALFORMED_XML", message: `XML ${level === "warn" ? "\uACBD\uACE0" : "\uC624\uB958"}: ${msg2}` })]);
|
|
833
833
|
}
|
|
834
834
|
});
|
|
@@ -850,10 +850,10 @@ async function extractHwpxStyles(zip, decompressed) {
|
|
|
850
850
|
const xml = await file.async("text");
|
|
851
851
|
if (decompressed) {
|
|
852
852
|
decompressed.total += xml.length * 2;
|
|
853
|
-
if (decompressed.total > MAX_DECOMPRESS_SIZE) throw new (0,
|
|
853
|
+
if (decompressed.total > MAX_DECOMPRESS_SIZE) throw new (0, _chunk4JLD2IT7cjs.KordocError)("ZIP \uC555\uCD95 \uD574\uC81C \uD06C\uAE30 \uCD08\uACFC (ZIP bomb \uC758\uC2EC)");
|
|
854
854
|
}
|
|
855
855
|
const parser = createXmlParser();
|
|
856
|
-
const doc = parser.parseFromString(
|
|
856
|
+
const doc = parser.parseFromString(_chunk4JLD2IT7cjs.stripDtd.call(void 0, xml), "text/xml");
|
|
857
857
|
if (!doc.documentElement) continue;
|
|
858
858
|
parseCharProperties(doc, result.charProperties);
|
|
859
859
|
parseStyleElements(doc, result.styles);
|
|
@@ -1075,7 +1075,7 @@ function resolveParaHeading(paraEl, ctx) {
|
|
|
1075
1075
|
return { prefix, headingLevel };
|
|
1076
1076
|
}
|
|
1077
1077
|
async function parseHwpxDocument(buffer, options) {
|
|
1078
|
-
|
|
1078
|
+
_chunk4JLD2IT7cjs.precheckZipSize.call(void 0, buffer, MAX_DECOMPRESS_SIZE, MAX_ZIP_ENTRIES);
|
|
1079
1079
|
let zip;
|
|
1080
1080
|
try {
|
|
1081
1081
|
zip = await _jszip2.default.loadAsync(buffer);
|
|
@@ -1084,7 +1084,7 @@ async function parseHwpxDocument(buffer, options) {
|
|
|
1084
1084
|
}
|
|
1085
1085
|
const actualEntryCount = Object.keys(zip.files).length;
|
|
1086
1086
|
if (actualEntryCount > MAX_ZIP_ENTRIES) {
|
|
1087
|
-
throw new (0,
|
|
1087
|
+
throw new (0, _chunk4JLD2IT7cjs.KordocError)("ZIP \uC5D4\uD2B8\uB9AC \uC218 \uCD08\uACFC (ZIP bomb \uC758\uC2EC)");
|
|
1088
1088
|
}
|
|
1089
1089
|
const manifestFile = zip.file("META-INF/manifest.xml");
|
|
1090
1090
|
if (manifestFile) {
|
|
@@ -1096,7 +1096,7 @@ async function parseHwpxDocument(buffer, options) {
|
|
|
1096
1096
|
return comResultToParseResult(pages, pageCount, warnings2);
|
|
1097
1097
|
}
|
|
1098
1098
|
}
|
|
1099
|
-
throw new (0,
|
|
1099
|
+
throw new (0, _chunk4JLD2IT7cjs.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.");
|
|
1100
1100
|
}
|
|
1101
1101
|
}
|
|
1102
1102
|
const decompressed = { total: 0 };
|
|
@@ -1105,7 +1105,7 @@ async function parseHwpxDocument(buffer, options) {
|
|
|
1105
1105
|
const styleMap = await extractHwpxStyles(zip, decompressed);
|
|
1106
1106
|
const warnings = [];
|
|
1107
1107
|
const sectionPaths = await resolveSectionPaths(zip);
|
|
1108
|
-
if (sectionPaths.length === 0) throw new (0,
|
|
1108
|
+
if (sectionPaths.length === 0) throw new (0, _chunk4JLD2IT7cjs.KordocError)("HWPX\uC5D0\uC11C \uC139\uC158 \uD30C\uC77C\uC744 \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4");
|
|
1109
1109
|
metadata.pageCount = sectionPaths.length;
|
|
1110
1110
|
const pageFilter = _optionalChain([options, 'optionalAccess', _12 => _12.pages]) ? _chunkX34YWRL5cjs.parsePageRange.call(void 0, options.pages, sectionPaths.length) : null;
|
|
1111
1111
|
const totalTarget = pageFilter ? pageFilter.size : sectionPaths.length;
|
|
@@ -1119,12 +1119,12 @@ async function parseHwpxDocument(buffer, options) {
|
|
|
1119
1119
|
try {
|
|
1120
1120
|
const xml = await file.async("text");
|
|
1121
1121
|
decompressed.total += xml.length * 2;
|
|
1122
|
-
if (decompressed.total > MAX_DECOMPRESS_SIZE) throw new (0,
|
|
1122
|
+
if (decompressed.total > MAX_DECOMPRESS_SIZE) throw new (0, _chunk4JLD2IT7cjs.KordocError)("ZIP \uC555\uCD95 \uD574\uC81C \uD06C\uAE30 \uCD08\uACFC (ZIP bomb \uC758\uC2EC)");
|
|
1123
1123
|
blocks.push(...parseSectionXml(xml, styleMap, warnings, si + 1, shared));
|
|
1124
1124
|
parsedSections++;
|
|
1125
1125
|
_optionalChain([options, 'optionalAccess', _13 => _13.onProgress, 'optionalCall', _14 => _14(parsedSections, totalTarget)]);
|
|
1126
1126
|
} catch (secErr) {
|
|
1127
|
-
if (secErr instanceof
|
|
1127
|
+
if (secErr instanceof _chunk4JLD2IT7cjs.KordocError) throw secErr;
|
|
1128
1128
|
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" });
|
|
1129
1129
|
}
|
|
1130
1130
|
}
|
|
@@ -1132,7 +1132,7 @@ async function parseHwpxDocument(buffer, options) {
|
|
|
1132
1132
|
const images = await extractImagesFromZip(zip, blocks, decompressed, warnings);
|
|
1133
1133
|
detectHwpxHeadings(blocks, styleMap);
|
|
1134
1134
|
const outline = blocks.filter((b) => b.type === "heading" && b.level && b.text).map((b) => ({ level: b.level, text: b.text, pageNumber: b.pageNumber }));
|
|
1135
|
-
const markdown =
|
|
1135
|
+
const markdown = _chunk4JLD2IT7cjs.blocksToMarkdown.call(void 0, blocks);
|
|
1136
1136
|
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 };
|
|
1137
1137
|
}
|
|
1138
1138
|
function applyPageText(blocks, shared) {
|
|
@@ -1221,13 +1221,13 @@ async function extractImagesFromZip(zip, blocks, decompressed, warnings) {
|
|
|
1221
1221
|
let found = false;
|
|
1222
1222
|
const allCandidates = resolvedPath ? [resolvedPath, ...candidates] : candidates;
|
|
1223
1223
|
for (const path of allCandidates) {
|
|
1224
|
-
if (
|
|
1224
|
+
if (_chunk4JLD2IT7cjs.isPathTraversal.call(void 0, path)) continue;
|
|
1225
1225
|
const file = zip.file(path);
|
|
1226
1226
|
if (!file) continue;
|
|
1227
1227
|
try {
|
|
1228
1228
|
const data = await file.async("uint8array");
|
|
1229
1229
|
decompressed.total += data.length;
|
|
1230
|
-
if (decompressed.total > MAX_DECOMPRESS_SIZE) throw new (0,
|
|
1230
|
+
if (decompressed.total > MAX_DECOMPRESS_SIZE) throw new (0, _chunk4JLD2IT7cjs.KordocError)("ZIP \uC555\uCD95 \uD574\uC81C \uD06C\uAE30 \uCD08\uACFC (ZIP bomb \uC758\uC2EC)");
|
|
1231
1231
|
const actualPath = path;
|
|
1232
1232
|
const ext = actualPath.includes(".") ? actualPath.split(".").pop() || "png" : "png";
|
|
1233
1233
|
const mimeType = imageExtToMime(ext);
|
|
@@ -1240,7 +1240,7 @@ async function extractImagesFromZip(zip, blocks, decompressed, warnings) {
|
|
|
1240
1240
|
found = true;
|
|
1241
1241
|
break;
|
|
1242
1242
|
} catch (err) {
|
|
1243
|
-
if (err instanceof
|
|
1243
|
+
if (err instanceof _chunk4JLD2IT7cjs.KordocError) throw err;
|
|
1244
1244
|
}
|
|
1245
1245
|
}
|
|
1246
1246
|
if (!found) {
|
|
@@ -1261,7 +1261,7 @@ async function extractHwpxMetadata(zip, metadata, decompressed) {
|
|
|
1261
1261
|
const xml = await file.async("text");
|
|
1262
1262
|
if (decompressed) {
|
|
1263
1263
|
decompressed.total += xml.length * 2;
|
|
1264
|
-
if (decompressed.total > MAX_DECOMPRESS_SIZE) throw new (0,
|
|
1264
|
+
if (decompressed.total > MAX_DECOMPRESS_SIZE) throw new (0, _chunk4JLD2IT7cjs.KordocError)("ZIP \uC555\uCD95 \uD574\uC81C \uD06C\uAE30 \uCD08\uACFC (ZIP bomb \uC758\uC2EC)");
|
|
1265
1265
|
}
|
|
1266
1266
|
parseDublinCoreMetadata(xml, metadata);
|
|
1267
1267
|
if (metadata.title || metadata.author) return;
|
|
@@ -1271,7 +1271,7 @@ async function extractHwpxMetadata(zip, metadata, decompressed) {
|
|
|
1271
1271
|
}
|
|
1272
1272
|
function parseDublinCoreMetadata(xml, metadata) {
|
|
1273
1273
|
const parser = createXmlParser();
|
|
1274
|
-
const doc = parser.parseFromString(
|
|
1274
|
+
const doc = parser.parseFromString(_chunk4JLD2IT7cjs.stripDtd.call(void 0, xml), "text/xml");
|
|
1275
1275
|
if (!doc.documentElement) return;
|
|
1276
1276
|
const getText = (tagNames) => {
|
|
1277
1277
|
for (const tag of tagNames) {
|
|
@@ -1331,7 +1331,7 @@ function extractFromBrokenZip(buffer) {
|
|
|
1331
1331
|
}
|
|
1332
1332
|
const nameBytes = data.slice(pos + 30, pos + 30 + nameLen);
|
|
1333
1333
|
const name = new TextDecoder().decode(nameBytes);
|
|
1334
|
-
if (
|
|
1334
|
+
if (_chunk4JLD2IT7cjs.isPathTraversal.call(void 0, name)) {
|
|
1335
1335
|
pos = fileStart + compSize;
|
|
1336
1336
|
continue;
|
|
1337
1337
|
}
|
|
@@ -1349,16 +1349,16 @@ function extractFromBrokenZip(buffer) {
|
|
|
1349
1349
|
continue;
|
|
1350
1350
|
}
|
|
1351
1351
|
totalDecompressed += content.length * 2;
|
|
1352
|
-
if (totalDecompressed > MAX_DECOMPRESS_SIZE) throw new (0,
|
|
1352
|
+
if (totalDecompressed > MAX_DECOMPRESS_SIZE) throw new (0, _chunk4JLD2IT7cjs.KordocError)("\uC555\uCD95 \uD574\uC81C \uD06C\uAE30 \uCD08\uACFC");
|
|
1353
1353
|
sectionNum++;
|
|
1354
1354
|
blocks.push(...parseSectionXml(content, void 0, warnings, sectionNum, shared));
|
|
1355
1355
|
} catch (e13) {
|
|
1356
1356
|
continue;
|
|
1357
1357
|
}
|
|
1358
1358
|
}
|
|
1359
|
-
if (blocks.length === 0) throw new (0,
|
|
1359
|
+
if (blocks.length === 0) throw new (0, _chunk4JLD2IT7cjs.KordocError)("\uC190\uC0C1\uB41C HWPX\uC5D0\uC11C \uC139\uC158 \uB370\uC774\uD130\uB97C \uBCF5\uAD6C\uD560 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4");
|
|
1360
1360
|
applyPageText(blocks, shared);
|
|
1361
|
-
const markdown =
|
|
1361
|
+
const markdown = _chunk4JLD2IT7cjs.blocksToMarkdown.call(void 0, blocks);
|
|
1362
1362
|
return { markdown, blocks, warnings: warnings.length > 0 ? warnings : void 0 };
|
|
1363
1363
|
}
|
|
1364
1364
|
async function resolveSectionPaths(zip) {
|
|
@@ -1376,7 +1376,7 @@ async function resolveSectionPaths(zip) {
|
|
|
1376
1376
|
}
|
|
1377
1377
|
function parseSectionPathsFromManifest(xml) {
|
|
1378
1378
|
const parser = createXmlParser();
|
|
1379
|
-
const doc = parser.parseFromString(
|
|
1379
|
+
const doc = parser.parseFromString(_chunk4JLD2IT7cjs.stripDtd.call(void 0, xml), "text/xml");
|
|
1380
1380
|
const items = doc.getElementsByTagName("opf:item");
|
|
1381
1381
|
const spine = doc.getElementsByTagName("opf:itemref");
|
|
1382
1382
|
const isSectionId = (id) => /^s/i.test(id) || id.toLowerCase().includes("section");
|
|
@@ -1424,9 +1424,9 @@ function detectHwpxHeadings(blocks, styleMap) {
|
|
|
1424
1424
|
let level = 0;
|
|
1425
1425
|
if (baseFontSize > 0 && _optionalChain([block, 'access', _25 => _25.style, 'optionalAccess', _26 => _26.fontSize])) {
|
|
1426
1426
|
const ratio = block.style.fontSize / baseFontSize;
|
|
1427
|
-
if (ratio >=
|
|
1428
|
-
else if (ratio >=
|
|
1429
|
-
else if (ratio >=
|
|
1427
|
+
if (ratio >= _chunk4JLD2IT7cjs.HEADING_RATIO_H1) level = 1;
|
|
1428
|
+
else if (ratio >= _chunk4JLD2IT7cjs.HEADING_RATIO_H2) level = 2;
|
|
1429
|
+
else if (ratio >= _chunk4JLD2IT7cjs.HEADING_RATIO_H3) level = 3;
|
|
1430
1430
|
}
|
|
1431
1431
|
const compactText = text.replace(/\s+/g, "");
|
|
1432
1432
|
if (/^제\d+[조장절편]/.test(compactText) && text.length <= 50) {
|
|
@@ -1439,7 +1439,7 @@ function detectHwpxHeadings(blocks, styleMap) {
|
|
|
1439
1439
|
}
|
|
1440
1440
|
}
|
|
1441
1441
|
function buildTableWithCellMeta(state) {
|
|
1442
|
-
const table =
|
|
1442
|
+
const table = _chunk4JLD2IT7cjs.buildTable.call(void 0, state.rows);
|
|
1443
1443
|
if (state.caption) table.caption = state.caption;
|
|
1444
1444
|
const claimed = /* @__PURE__ */ new Set();
|
|
1445
1445
|
for (const row of state.rows) {
|
|
@@ -1482,7 +1482,7 @@ function completeTable(newTable, tableStack, blocks, ctx) {
|
|
|
1482
1482
|
const cell = parentTable.cell;
|
|
1483
1483
|
(cell.blocks ??= []).push(block);
|
|
1484
1484
|
cell.hasStructure = true;
|
|
1485
|
-
let flat =
|
|
1485
|
+
let flat = _chunk4JLD2IT7cjs.convertTableToText.call(void 0, newTable.rows);
|
|
1486
1486
|
if (newTable.caption) flat = newTable.caption + (flat ? "\n" + flat : "");
|
|
1487
1487
|
if (flat) cell.text += (cell.text ? "\n" : "") + flat;
|
|
1488
1488
|
} else {
|
|
@@ -1492,7 +1492,7 @@ function completeTable(newTable, tableStack, blocks, ctx) {
|
|
|
1492
1492
|
}
|
|
1493
1493
|
function parseSectionXml(xml, styleMap, warnings, sectionNum, shared) {
|
|
1494
1494
|
const parser = createXmlParser(warnings);
|
|
1495
|
-
const doc = parser.parseFromString(
|
|
1495
|
+
const doc = parser.parseFromString(_chunk4JLD2IT7cjs.stripDtd.call(void 0, xml), "text/xml");
|
|
1496
1496
|
if (!doc.documentElement) return [];
|
|
1497
1497
|
const ctx = { styleMap, warnings, sectionNum, shared: _nullishCoalesce(shared, () => ( createSectionShared())) };
|
|
1498
1498
|
ctx.shared.track.deleteDepth = 0;
|
|
@@ -1583,8 +1583,8 @@ function walkSection(node, blocks, tableCtx, tableStack, ctx, depth = 0) {
|
|
|
1583
1583
|
const cs = isNaN(rawCs) ? 1 : rawCs;
|
|
1584
1584
|
const rawRs = parseInt(el.getAttribute("rowSpan") || "1", 10);
|
|
1585
1585
|
const rs = isNaN(rawRs) ? 1 : rawRs;
|
|
1586
|
-
tableCtx.cell.colSpan = clampSpan(cs,
|
|
1587
|
-
tableCtx.cell.rowSpan = clampSpan(rs,
|
|
1586
|
+
tableCtx.cell.colSpan = clampSpan(cs, _chunk4JLD2IT7cjs.MAX_COLS);
|
|
1587
|
+
tableCtx.cell.rowSpan = clampSpan(rs, _chunk4JLD2IT7cjs.MAX_ROWS);
|
|
1588
1588
|
}
|
|
1589
1589
|
break;
|
|
1590
1590
|
case "p": {
|
|
@@ -1806,7 +1806,7 @@ function extractHyperlinkHref(fieldBegin) {
|
|
|
1806
1806
|
let url = (ch.textContent || "").trim();
|
|
1807
1807
|
if (!url) continue;
|
|
1808
1808
|
url = url.replace(/^https?:\/\/(?=https?:\/\/)/i, "");
|
|
1809
|
-
const safe =
|
|
1809
|
+
const safe = _chunk4JLD2IT7cjs.sanitizeHref.call(void 0, url);
|
|
1810
1810
|
if (safe) return safe;
|
|
1811
1811
|
}
|
|
1812
1812
|
return void 0;
|
|
@@ -1941,7 +1941,7 @@ function extractParagraphInfo(para, styleMap, ctx) {
|
|
|
1941
1941
|
case "hyperlink": {
|
|
1942
1942
|
const url = child.getAttribute("url") || child.getAttribute("href") || "";
|
|
1943
1943
|
if (url) {
|
|
1944
|
-
const safe =
|
|
1944
|
+
const safe = _chunk4JLD2IT7cjs.sanitizeHref.call(void 0, url);
|
|
1945
1945
|
if (safe) href = safe;
|
|
1946
1946
|
}
|
|
1947
1947
|
walk(child);
|
|
@@ -2131,7 +2131,7 @@ function decompressStream(data) {
|
|
|
2131
2131
|
return _zlib.inflateRawSync.call(void 0, data, opts);
|
|
2132
2132
|
}
|
|
2133
2133
|
function parseFileHeader(data) {
|
|
2134
|
-
if (data.length < 40) throw new (0,
|
|
2134
|
+
if (data.length < 40) throw new (0, _chunk4JLD2IT7cjs.KordocError)("FileHeader\uAC00 \uB108\uBB34 \uC9E7\uC2B5\uB2C8\uB2E4 (\uCD5C\uC18C 40\uBC14\uC774\uD2B8)");
|
|
2135
2135
|
const sig = data.subarray(0, 32).toString("utf8").replace(/\0+$/, "");
|
|
2136
2136
|
return {
|
|
2137
2137
|
signature: sig,
|
|
@@ -3655,7 +3655,7 @@ function parseHwp5Document(buffer, options) {
|
|
|
3655
3655
|
lenientCfb = parseLenientCfb(buffer);
|
|
3656
3656
|
warnings.push({ message: "\uC190\uC0C1\uB41C CFB \uCEE8\uD14C\uC774\uB108 \u2014 lenient \uBAA8\uB4DC\uB85C \uBCF5\uAD6C", code: "LENIENT_CFB_RECOVERY" });
|
|
3657
3657
|
} catch (e20) {
|
|
3658
|
-
throw new (0,
|
|
3658
|
+
throw new (0, _chunk4JLD2IT7cjs.KordocError)("CFB \uCEE8\uD14C\uC774\uB108 \uD30C\uC2F1 \uC2E4\uD328 (strict \uBC0F lenient \uBAA8\uB450)");
|
|
3659
3659
|
}
|
|
3660
3660
|
}
|
|
3661
3661
|
const findStream = (path) => {
|
|
@@ -3666,11 +3666,11 @@ function parseHwp5Document(buffer, options) {
|
|
|
3666
3666
|
return lenientCfb.findStream(path);
|
|
3667
3667
|
};
|
|
3668
3668
|
const headerData = findStream("/FileHeader");
|
|
3669
|
-
if (!headerData) throw new (0,
|
|
3669
|
+
if (!headerData) throw new (0, _chunk4JLD2IT7cjs.KordocError)("FileHeader \uC2A4\uD2B8\uB9BC \uC5C6\uC74C");
|
|
3670
3670
|
const header = parseFileHeader(headerData);
|
|
3671
|
-
if (header.signature !== "HWP Document File") throw new (0,
|
|
3672
|
-
if (header.flags & FLAG_ENCRYPTED) throw new (0,
|
|
3673
|
-
if (header.flags & FLAG_DRM) throw new (0,
|
|
3671
|
+
if (header.signature !== "HWP Document File") throw new (0, _chunk4JLD2IT7cjs.KordocError)("HWP \uC2DC\uADF8\uB2C8\uCC98 \uBD88\uC77C\uCE58");
|
|
3672
|
+
if (header.flags & FLAG_ENCRYPTED) throw new (0, _chunk4JLD2IT7cjs.KordocError)("\uC554\uD638\uD654\uB41C HWP\uB294 \uC9C0\uC6D0\uD558\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4");
|
|
3673
|
+
if (header.flags & FLAG_DRM) throw new (0, _chunk4JLD2IT7cjs.KordocError)("DRM \uBCF4\uD638\uB41C HWP\uB294 \uC9C0\uC6D0\uD558\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4");
|
|
3674
3674
|
const compressed = (header.flags & FLAG_COMPRESSED) !== 0;
|
|
3675
3675
|
const distribution = (header.flags & FLAG_DISTRIBUTION) !== 0;
|
|
3676
3676
|
const metadata = {
|
|
@@ -3679,7 +3679,7 @@ function parseHwp5Document(buffer, options) {
|
|
|
3679
3679
|
if (cfb) extractHwp5Metadata(cfb, metadata);
|
|
3680
3680
|
const docInfo = cfb ? parseDocInfoStream(cfb, compressed) : parseDocInfoFromStream(findStream("/DocInfo"), compressed);
|
|
3681
3681
|
const sections = distribution ? cfb ? findViewTextSections(cfb, compressed) : findViewTextSectionsLenient(lenientCfb, compressed) : cfb ? findSections(cfb) : findSectionsLenient(lenientCfb, compressed);
|
|
3682
|
-
if (sections.length === 0) throw new (0,
|
|
3682
|
+
if (sections.length === 0) throw new (0, _chunk4JLD2IT7cjs.KordocError)("\uC139\uC158 \uC2A4\uD2B8\uB9BC\uC744 \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4");
|
|
3683
3683
|
metadata.pageCount = sections.length;
|
|
3684
3684
|
const pageFilter = _optionalChain([options, 'optionalAccess', _51 => _51.pages]) ? _chunkX34YWRL5cjs.parsePageRange.call(void 0, options.pages, sections.length) : null;
|
|
3685
3685
|
const totalTarget = pageFilter ? pageFilter.size : sections.length;
|
|
@@ -3693,25 +3693,25 @@ function parseHwp5Document(buffer, options) {
|
|
|
3693
3693
|
const sectionData = sections[si];
|
|
3694
3694
|
const data = !distribution && compressed ? decompressStream(Buffer.from(sectionData)) : Buffer.from(sectionData);
|
|
3695
3695
|
totalDecompressed += data.length;
|
|
3696
|
-
if (totalDecompressed > MAX_TOTAL_DECOMPRESS) throw new (0,
|
|
3696
|
+
if (totalDecompressed > MAX_TOTAL_DECOMPRESS) throw new (0, _chunk4JLD2IT7cjs.KordocError)("\uCD1D \uC555\uCD95 \uD574\uC81C \uD06C\uAE30 \uCD08\uACFC (decompression bomb \uC758\uC2EC)");
|
|
3697
3697
|
const records = readRecords(data);
|
|
3698
3698
|
const sectionBlocks = parseSection(records, docInfo, warnings, si + 1, doc);
|
|
3699
3699
|
bodyBlocks.push(...sectionBlocks);
|
|
3700
3700
|
parsedSections++;
|
|
3701
3701
|
_optionalChain([options, 'optionalAccess', _52 => _52.onProgress, 'optionalCall', _53 => _53(parsedSections, totalTarget)]);
|
|
3702
3702
|
} catch (secErr) {
|
|
3703
|
-
if (secErr instanceof
|
|
3703
|
+
if (secErr instanceof _chunk4JLD2IT7cjs.KordocError) throw secErr;
|
|
3704
3704
|
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" });
|
|
3705
3705
|
}
|
|
3706
3706
|
}
|
|
3707
3707
|
const blocks = [...doc.headerBlocks, ...bodyBlocks, ...doc.footerBlocks];
|
|
3708
3708
|
const images = cfb ? extractHwp5Images(cfb.FileIndex, blocks, warnings) : extractHwp5ImagesLenient(lenientCfb, blocks, warnings);
|
|
3709
|
-
const flatBlocks =
|
|
3709
|
+
const flatBlocks = _chunk4JLD2IT7cjs.flattenLayoutTables.call(void 0, blocks);
|
|
3710
3710
|
if (docInfo) {
|
|
3711
3711
|
detectHwp5Headings(flatBlocks, docInfo);
|
|
3712
3712
|
}
|
|
3713
3713
|
const outline = flatBlocks.filter((b) => b.type === "heading" && b.level && b.text).map((b) => ({ level: b.level, text: b.text, pageNumber: b.pageNumber }));
|
|
3714
|
-
const markdown =
|
|
3714
|
+
const markdown = _chunk4JLD2IT7cjs.blocksToMarkdown.call(void 0, flatBlocks);
|
|
3715
3715
|
return { markdown, blocks: flatBlocks, metadata, outline: outline.length > 0 ? outline : void 0, warnings: warnings.length > 0 ? warnings : void 0, images: images.length > 0 ? images : void 0 };
|
|
3716
3716
|
}
|
|
3717
3717
|
function parseDocInfoStream(cfb, compressed) {
|
|
@@ -3771,9 +3771,9 @@ function detectHwp5Headings(blocks, docInfo) {
|
|
|
3771
3771
|
let level = 0;
|
|
3772
3772
|
if (_optionalChain([block, 'access', _58 => _58.style, 'optionalAccess', _59 => _59.fontSize]) && baseFontSize > 0) {
|
|
3773
3773
|
const ratio = block.style.fontSize / baseFontSize;
|
|
3774
|
-
if (ratio >=
|
|
3775
|
-
else if (ratio >=
|
|
3776
|
-
else if (ratio >=
|
|
3774
|
+
if (ratio >= _chunk4JLD2IT7cjs.HEADING_RATIO_H1) level = 1;
|
|
3775
|
+
else if (ratio >= _chunk4JLD2IT7cjs.HEADING_RATIO_H2) level = 2;
|
|
3776
|
+
else if (ratio >= _chunk4JLD2IT7cjs.HEADING_RATIO_H3) level = 3;
|
|
3777
3777
|
}
|
|
3778
3778
|
if (/^제\d+[장절편]\s/.test(text) && text.length <= 50) {
|
|
3779
3779
|
if (level === 0) level = 2;
|
|
@@ -3858,7 +3858,7 @@ function findSectionsLenient(lcfb, compressed) {
|
|
|
3858
3858
|
if (!raw) break;
|
|
3859
3859
|
const content = compressed ? decompressStream(raw) : raw;
|
|
3860
3860
|
totalDecompressed += content.length;
|
|
3861
|
-
if (totalDecompressed > MAX_TOTAL_DECOMPRESS) throw new (0,
|
|
3861
|
+
if (totalDecompressed > MAX_TOTAL_DECOMPRESS) throw new (0, _chunk4JLD2IT7cjs.KordocError)("\uCD1D \uC555\uCD95 \uD574\uC81C \uD06C\uAE30 \uCD08\uACFC (decompression bomb \uC758\uC2EC)");
|
|
3862
3862
|
sections.push({ idx: i, content });
|
|
3863
3863
|
}
|
|
3864
3864
|
if (sections.length === 0) {
|
|
@@ -3870,7 +3870,7 @@ function findSectionsLenient(lcfb, compressed) {
|
|
|
3870
3870
|
if (raw) {
|
|
3871
3871
|
const content = compressed ? decompressStream(raw) : raw;
|
|
3872
3872
|
totalDecompressed += content.length;
|
|
3873
|
-
if (totalDecompressed > MAX_TOTAL_DECOMPRESS) throw new (0,
|
|
3873
|
+
if (totalDecompressed > MAX_TOTAL_DECOMPRESS) throw new (0, _chunk4JLD2IT7cjs.KordocError)("\uCD1D \uC555\uCD95 \uD574\uC81C \uD06C\uAE30 \uCD08\uACFC (decompression bomb \uC758\uC2EC)");
|
|
3874
3874
|
sections.push({ idx, content });
|
|
3875
3875
|
}
|
|
3876
3876
|
}
|
|
@@ -3887,7 +3887,7 @@ function findViewTextSectionsLenient(lcfb, compressed) {
|
|
|
3887
3887
|
try {
|
|
3888
3888
|
const content = decryptViewText(raw, compressed);
|
|
3889
3889
|
totalDecompressed += content.length;
|
|
3890
|
-
if (totalDecompressed > MAX_TOTAL_DECOMPRESS) throw new (0,
|
|
3890
|
+
if (totalDecompressed > MAX_TOTAL_DECOMPRESS) throw new (0, _chunk4JLD2IT7cjs.KordocError)("\uCD1D \uC555\uCD95 \uD574\uC81C \uD06C\uAE30 \uCD08\uACFC (decompression bomb \uC758\uC2EC)");
|
|
3891
3891
|
sections.push({ idx: i, content });
|
|
3892
3892
|
} catch (e25) {
|
|
3893
3893
|
break;
|
|
@@ -3990,7 +3990,7 @@ function parseParagraph(records, start, end, ctx) {
|
|
|
3990
3990
|
const ctrl = ctrls[r.ctrlIdx];
|
|
3991
3991
|
if (!_optionalChain([ctrl, 'optionalAccess', _66 => _66.href]) || r.end <= r.start) continue;
|
|
3992
3992
|
if (applied.some(([s, e]) => r.start < e && r.end > s)) continue;
|
|
3993
|
-
const href =
|
|
3993
|
+
const href = _chunk4JLD2IT7cjs.sanitizeHref.call(void 0, ctrl.href);
|
|
3994
3994
|
if (!href) continue;
|
|
3995
3995
|
const anchor = text.slice(r.start, r.end);
|
|
3996
3996
|
if (!anchor.trim()) continue;
|
|
@@ -4223,8 +4223,8 @@ function parseTableControl(ctrl, records, ctx) {
|
|
|
4223
4223
|
let tableIdx = -1;
|
|
4224
4224
|
for (let i2 = childStart; i2 < childEnd; i2++) {
|
|
4225
4225
|
if (records[i2].tagId === TAG_TABLE && records[i2].data.length >= 8) {
|
|
4226
|
-
rows = Math.min(records[i2].data.readUInt16LE(4),
|
|
4227
|
-
cols = Math.min(records[i2].data.readUInt16LE(6),
|
|
4226
|
+
rows = Math.min(records[i2].data.readUInt16LE(4), _chunk4JLD2IT7cjs.MAX_ROWS);
|
|
4227
|
+
cols = Math.min(records[i2].data.readUInt16LE(6), _chunk4JLD2IT7cjs.MAX_COLS);
|
|
4228
4228
|
tableIdx = i2;
|
|
4229
4229
|
break;
|
|
4230
4230
|
}
|
|
@@ -4273,7 +4273,7 @@ function parseTableControl(ctrl, records, ctx) {
|
|
|
4273
4273
|
return table2;
|
|
4274
4274
|
}
|
|
4275
4275
|
const cellRows = arrangeCells(rows, cols, cells);
|
|
4276
|
-
const table =
|
|
4276
|
+
const table = _chunk4JLD2IT7cjs.buildTable.call(void 0, cellRows);
|
|
4277
4277
|
if (caption && table.rows > 0) table.caption = caption;
|
|
4278
4278
|
return table.rows > 0 ? table : null;
|
|
4279
4279
|
}
|
|
@@ -4290,8 +4290,8 @@ function parseCell(records, lhIdx, end, ctx) {
|
|
|
4290
4290
|
rowAddr = rec.data.readUInt16LE(10);
|
|
4291
4291
|
const cs = rec.data.readUInt16LE(12);
|
|
4292
4292
|
const rs = rec.data.readUInt16LE(14);
|
|
4293
|
-
if (cs > 0) colSpan = Math.min(cs,
|
|
4294
|
-
if (rs > 0) rowSpan = Math.min(rs,
|
|
4293
|
+
if (cs > 0) colSpan = Math.min(cs, _chunk4JLD2IT7cjs.MAX_COLS);
|
|
4294
|
+
if (rs > 0) rowSpan = Math.min(rs, _chunk4JLD2IT7cjs.MAX_ROWS);
|
|
4295
4295
|
}
|
|
4296
4296
|
const blocks = ctx.depth < MAX_NEST_DEPTH ? parseParagraphList(records, lhIdx + 1, end, { ...ctx, depth: ctx.depth + 1 }) : [];
|
|
4297
4297
|
const parts = [];
|
|
@@ -4301,7 +4301,7 @@ function parseCell(records, lhIdx, end, ctx) {
|
|
|
4301
4301
|
parts.push(``);
|
|
4302
4302
|
hasStructure = true;
|
|
4303
4303
|
} else if (b.type === "table" && b.table) {
|
|
4304
|
-
const flat =
|
|
4304
|
+
const flat = _chunk4JLD2IT7cjs.convertTableToText.call(void 0, b.table.cells);
|
|
4305
4305
|
if (flat) parts.push(flat);
|
|
4306
4306
|
hasStructure = true;
|
|
4307
4307
|
} else if (b.text) {
|
|
@@ -16735,7 +16735,7 @@ function getTextContent(el) {
|
|
|
16735
16735
|
return _nullishCoalesce(_optionalChain([el, 'access', _79 => _79.textContent, 'optionalAccess', _80 => _80.trim, 'call', _81 => _81()]), () => ( ""));
|
|
16736
16736
|
}
|
|
16737
16737
|
function parseXml(text) {
|
|
16738
|
-
return new (0, _xmldom.DOMParser)().parseFromString(
|
|
16738
|
+
return new (0, _xmldom.DOMParser)().parseFromString(_chunk4JLD2IT7cjs.stripDtd.call(void 0, text), "text/xml");
|
|
16739
16739
|
}
|
|
16740
16740
|
function parseSharedStrings(xml) {
|
|
16741
16741
|
const doc = parseXml(xml);
|
|
@@ -16879,7 +16879,7 @@ function sheetToBlocks(sheetName, grid, merges, maxRow, maxCol, sheetIndex) {
|
|
|
16879
16879
|
cellRows.push(row);
|
|
16880
16880
|
}
|
|
16881
16881
|
if (cellRows.length > 0) {
|
|
16882
|
-
const table =
|
|
16882
|
+
const table = _chunk4JLD2IT7cjs.buildTable.call(void 0, cellRows);
|
|
16883
16883
|
if (table.rows > 0) {
|
|
16884
16884
|
blocks.push({ type: "table", table, pageNumber: sheetIndex + 1 });
|
|
16885
16885
|
}
|
|
@@ -16887,12 +16887,12 @@ function sheetToBlocks(sheetName, grid, merges, maxRow, maxCol, sheetIndex) {
|
|
|
16887
16887
|
return blocks;
|
|
16888
16888
|
}
|
|
16889
16889
|
async function parseXlsxDocument(buffer, options) {
|
|
16890
|
-
|
|
16890
|
+
_chunk4JLD2IT7cjs.precheckZipSize.call(void 0, buffer, MAX_DECOMPRESS_SIZE3);
|
|
16891
16891
|
const zip = await _jszip2.default.loadAsync(buffer);
|
|
16892
16892
|
const warnings = [];
|
|
16893
16893
|
const workbookFile = zip.file("xl/workbook.xml");
|
|
16894
16894
|
if (!workbookFile) {
|
|
16895
|
-
throw new (0,
|
|
16895
|
+
throw new (0, _chunk4JLD2IT7cjs.KordocError)("\uC720\uD6A8\uD558\uC9C0 \uC54A\uC740 XLSX \uD30C\uC77C: xl/workbook.xml\uC774 \uC5C6\uC2B5\uB2C8\uB2E4");
|
|
16896
16896
|
}
|
|
16897
16897
|
let sharedStrings = [];
|
|
16898
16898
|
const ssFile = zip.file("xl/sharedStrings.xml");
|
|
@@ -16901,7 +16901,7 @@ async function parseXlsxDocument(buffer, options) {
|
|
|
16901
16901
|
}
|
|
16902
16902
|
const sheets = parseWorkbook(await workbookFile.async("text"));
|
|
16903
16903
|
if (sheets.length === 0) {
|
|
16904
|
-
throw new (0,
|
|
16904
|
+
throw new (0, _chunk4JLD2IT7cjs.KordocError)("XLSX \uD30C\uC77C\uC5D0 \uC2DC\uD2B8\uAC00 \uC5C6\uC2B5\uB2C8\uB2E4");
|
|
16905
16905
|
}
|
|
16906
16906
|
let relsMap = /* @__PURE__ */ new Map();
|
|
16907
16907
|
const relsFile = zip.file("xl/_rels/workbook.xml.rels");
|
|
@@ -16973,7 +16973,7 @@ async function parseXlsxDocument(buffer, options) {
|
|
|
16973
16973
|
} catch (e26) {
|
|
16974
16974
|
}
|
|
16975
16975
|
}
|
|
16976
|
-
const markdown =
|
|
16976
|
+
const markdown = _chunk4JLD2IT7cjs.blocksToMarkdown.call(void 0, blocks);
|
|
16977
16977
|
return { markdown, blocks, metadata, warnings: warnings.length > 0 ? warnings : void 0 };
|
|
16978
16978
|
}
|
|
16979
16979
|
|
|
@@ -17380,11 +17380,11 @@ function processGlobals(records) {
|
|
|
17380
17380
|
let encrypted = false;
|
|
17381
17381
|
const firstBof = records[0];
|
|
17382
17382
|
if (!firstBof || firstBof.opcode !== OP_BOF) {
|
|
17383
|
-
throw new (0,
|
|
17383
|
+
throw new (0, _chunk4JLD2IT7cjs.KordocError)("XLS: \uCCAB \uB808\uCF54\uB4DC\uAC00 BOF\uAC00 \uC544\uB2D8");
|
|
17384
17384
|
}
|
|
17385
17385
|
const bof = decodeBof(firstBof.data);
|
|
17386
17386
|
if (!bof || bof.dt !== DT_GLOBALS) {
|
|
17387
|
-
throw new (0,
|
|
17387
|
+
throw new (0, _chunk4JLD2IT7cjs.KordocError)("XLS: Globals \uC11C\uBE0C\uC2A4\uD2B8\uB9BC BOF \uB204\uB77D");
|
|
17388
17388
|
}
|
|
17389
17389
|
let i = 1;
|
|
17390
17390
|
while (i < records.length) {
|
|
@@ -17499,7 +17499,7 @@ function sheetToBlocks2(sheetName, sheet, sheetIndex) {
|
|
|
17499
17499
|
cellRows.push(row);
|
|
17500
17500
|
}
|
|
17501
17501
|
if (cellRows.length > 0) {
|
|
17502
|
-
const table =
|
|
17502
|
+
const table = _chunk4JLD2IT7cjs.buildTable.call(void 0, cellRows);
|
|
17503
17503
|
if (table.rows > 0) {
|
|
17504
17504
|
blocks.push({ type: "table", table, pageNumber: sheetIndex + 1 });
|
|
17505
17505
|
}
|
|
@@ -17512,21 +17512,21 @@ async function parseXlsDocument(buffer, options) {
|
|
|
17512
17512
|
try {
|
|
17513
17513
|
cfb = parseLenientCfb(buf);
|
|
17514
17514
|
} catch (e) {
|
|
17515
|
-
throw new (0,
|
|
17515
|
+
throw new (0, _chunk4JLD2IT7cjs.KordocError)(
|
|
17516
17516
|
`XLS: OLE2 \uC2DC\uADF8\uB2C8\uCC98 \uAC80\uC99D \uC2E4\uD328 \u2014 ${e instanceof Error ? e.message : "\uC54C \uC218 \uC5C6\uB294 \uC624\uB958"}`
|
|
17517
17517
|
);
|
|
17518
17518
|
}
|
|
17519
17519
|
const wb = _nullishCoalesce(cfb.findStream("/Workbook"), () => ( cfb.findStream("/Book")));
|
|
17520
17520
|
if (!wb) {
|
|
17521
|
-
throw new (0,
|
|
17521
|
+
throw new (0, _chunk4JLD2IT7cjs.KordocError)("XLS: Workbook \uC2A4\uD2B8\uB9BC\uC774 \uC5C6\uC74C (BIFF5 \uB610\uB294 \uBE44\uD45C\uC900 \uD30C\uC77C)");
|
|
17522
17522
|
}
|
|
17523
17523
|
const records = readRecords2(wb);
|
|
17524
17524
|
if (records.length === 0) {
|
|
17525
|
-
throw new (0,
|
|
17525
|
+
throw new (0, _chunk4JLD2IT7cjs.KordocError)("XLS: \uC2DC\uADF8\uB2C8\uCC98 \uB808\uCF54\uB4DC\uAC00 \uC5C6\uC74C (Workbook \uC2A4\uD2B8\uB9BC \uC190\uC0C1)");
|
|
17526
17526
|
}
|
|
17527
17527
|
const firstBof = decodeBof(records[0].data);
|
|
17528
17528
|
if (firstBof && firstBof.vers !== 1536) {
|
|
17529
|
-
throw new (0,
|
|
17529
|
+
throw new (0, _chunk4JLD2IT7cjs.KordocError)(
|
|
17530
17530
|
`XLS: BIFF8(0x0600)\uB9CC \uC9C0\uC6D0 \u2014 \uBCF8 \uD30C\uC77C\uC740 0x${firstBof.vers.toString(16)}`
|
|
17531
17531
|
);
|
|
17532
17532
|
}
|
|
@@ -17586,7 +17586,7 @@ async function parseXlsDocument(buffer, options) {
|
|
|
17586
17586
|
pageCount: totalSheets
|
|
17587
17587
|
};
|
|
17588
17588
|
return {
|
|
17589
|
-
markdown:
|
|
17589
|
+
markdown: _chunk4JLD2IT7cjs.blocksToMarkdown.call(void 0, allBlocks),
|
|
17590
17590
|
blocks: allBlocks,
|
|
17591
17591
|
metadata,
|
|
17592
17592
|
warnings: warnings.length > 0 ? warnings : void 0
|
|
@@ -18024,7 +18024,7 @@ function getAttr(el, localName2) {
|
|
|
18024
18024
|
return null;
|
|
18025
18025
|
}
|
|
18026
18026
|
function parseXml2(text) {
|
|
18027
|
-
return new (0, _xmldom.DOMParser)().parseFromString(
|
|
18027
|
+
return new (0, _xmldom.DOMParser)().parseFromString(_chunk4JLD2IT7cjs.stripDtd.call(void 0, text), "text/xml");
|
|
18028
18028
|
}
|
|
18029
18029
|
function parseStyles(xml) {
|
|
18030
18030
|
const doc = parseXml2(xml);
|
|
@@ -18343,12 +18343,12 @@ async function extractImages(zip, rels, doc) {
|
|
|
18343
18343
|
return { blocks, images };
|
|
18344
18344
|
}
|
|
18345
18345
|
async function parseDocxDocument(buffer, options) {
|
|
18346
|
-
|
|
18346
|
+
_chunk4JLD2IT7cjs.precheckZipSize.call(void 0, buffer, MAX_DECOMPRESS_SIZE4);
|
|
18347
18347
|
const zip = await _jszip2.default.loadAsync(buffer);
|
|
18348
18348
|
const warnings = [];
|
|
18349
18349
|
const docFile = zip.file("word/document.xml");
|
|
18350
18350
|
if (!docFile) {
|
|
18351
|
-
throw new (0,
|
|
18351
|
+
throw new (0, _chunk4JLD2IT7cjs.KordocError)("\uC720\uD6A8\uD558\uC9C0 \uC54A\uC740 DOCX \uD30C\uC77C: word/document.xml\uC774 \uC5C6\uC2B5\uB2C8\uB2E4");
|
|
18352
18352
|
}
|
|
18353
18353
|
let rels = /* @__PURE__ */ new Map();
|
|
18354
18354
|
const relsFile = zip.file("word/_rels/document.xml.rels");
|
|
@@ -18383,7 +18383,7 @@ async function parseDocxDocument(buffer, options) {
|
|
|
18383
18383
|
const doc = parseXml2(docXml);
|
|
18384
18384
|
const body = findElements(doc, "body");
|
|
18385
18385
|
if (body.length === 0) {
|
|
18386
|
-
throw new (0,
|
|
18386
|
+
throw new (0, _chunk4JLD2IT7cjs.KordocError)("DOCX \uBCF8\uBB38(w:body)\uC744 \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4");
|
|
18387
18387
|
}
|
|
18388
18388
|
const blocks = [];
|
|
18389
18389
|
const bodyEl = body[0];
|
|
@@ -18420,7 +18420,7 @@ async function parseDocxDocument(buffer, options) {
|
|
|
18420
18420
|
}
|
|
18421
18421
|
}
|
|
18422
18422
|
const outline = blocks.filter((b) => b.type === "heading").map((b) => ({ level: _nullishCoalesce(b.level, () => ( 2)), text: _nullishCoalesce(b.text, () => ( "")) }));
|
|
18423
|
-
const markdown =
|
|
18423
|
+
const markdown = _chunk4JLD2IT7cjs.blocksToMarkdown.call(void 0, blocks);
|
|
18424
18424
|
return {
|
|
18425
18425
|
markdown,
|
|
18426
18426
|
blocks,
|
|
@@ -18443,7 +18443,7 @@ function parseHwpmlDocument(buffer, options) {
|
|
|
18443
18443
|
}
|
|
18444
18444
|
const text = new TextDecoder("utf-8").decode(buffer).replace(/^\uFEFF/, "");
|
|
18445
18445
|
const normalized = text.replace(/ /g, " ");
|
|
18446
|
-
const xml =
|
|
18446
|
+
const xml = _chunk4JLD2IT7cjs.stripDtd.call(void 0, normalized);
|
|
18447
18447
|
const warnings = [];
|
|
18448
18448
|
const parser = new (0, _xmldom.DOMParser)({
|
|
18449
18449
|
onError: (_level, msg2) => {
|
|
@@ -18483,7 +18483,7 @@ function parseHwpmlDocument(buffer, options) {
|
|
|
18483
18483
|
parseSection2(el, blocks, paraShapeMap, sectionIdx, warnings);
|
|
18484
18484
|
}
|
|
18485
18485
|
const outline = blocks.filter((b) => b.type === "heading" && b.text).map((b) => ({ level: _nullishCoalesce(b.level, () => ( 1)), text: b.text, pageNumber: b.pageNumber }));
|
|
18486
|
-
const markdown =
|
|
18486
|
+
const markdown = _chunk4JLD2IT7cjs.blocksToMarkdown.call(void 0, blocks);
|
|
18487
18487
|
return {
|
|
18488
18488
|
markdown,
|
|
18489
18489
|
blocks,
|
|
@@ -18625,7 +18625,7 @@ function parseTable2(el, blocks, paraShapeMap, sectionNum, warnings) {
|
|
|
18625
18625
|
const cellRows = grid.map(
|
|
18626
18626
|
(row) => row.map((cell) => _nullishCoalesce(cell, () => ( { text: "", colSpan: 1, rowSpan: 1 })))
|
|
18627
18627
|
);
|
|
18628
|
-
const table =
|
|
18628
|
+
const table = _chunk4JLD2IT7cjs.buildTable.call(void 0, cellRows);
|
|
18629
18629
|
blocks.push({ type: "table", table, pageNumber: sectionNum });
|
|
18630
18630
|
}
|
|
18631
18631
|
function extractCellText(cellEl) {
|
|
@@ -19652,19 +19652,19 @@ function parseCentralDirectory(buf) {
|
|
|
19652
19652
|
}
|
|
19653
19653
|
}
|
|
19654
19654
|
}
|
|
19655
|
-
if (eocdOffset < 0) throw new (0,
|
|
19655
|
+
if (eocdOffset < 0) throw new (0, _chunk4JLD2IT7cjs.KordocError)("ZIP EOCD\uB97C \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4");
|
|
19656
19656
|
const totalEntries = view.getUint16(eocdOffset + 10, true);
|
|
19657
19657
|
const cdSize = view.getUint32(eocdOffset + 12, true);
|
|
19658
19658
|
const cdOffset = view.getUint32(eocdOffset + 16, true);
|
|
19659
|
-
if (cdOffset === 4294967295 || totalEntries === 65535) throw new (0,
|
|
19659
|
+
if (cdOffset === 4294967295 || totalEntries === 65535) throw new (0, _chunk4JLD2IT7cjs.KordocError)("ZIP64\uB294 \uC9C0\uC6D0\uD558\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4");
|
|
19660
19660
|
if (eocdOffset >= 20 && view.getUint32(eocdOffset - 20, true) === ZIP64_EOCD_LOC_SIG) {
|
|
19661
|
-
throw new (0,
|
|
19661
|
+
throw new (0, _chunk4JLD2IT7cjs.KordocError)("ZIP64\uB294 \uC9C0\uC6D0\uD558\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4");
|
|
19662
19662
|
}
|
|
19663
19663
|
const decoder = new TextDecoder("utf-8");
|
|
19664
19664
|
const entries = [];
|
|
19665
19665
|
let pos = cdOffset;
|
|
19666
19666
|
for (let i = 0; i < totalEntries; i++) {
|
|
19667
|
-
if (view.getUint32(pos, true) !== CD_SIG) throw new (0,
|
|
19667
|
+
if (view.getUint32(pos, true) !== CD_SIG) throw new (0, _chunk4JLD2IT7cjs.KordocError)("ZIP Central Directory \uC190\uC0C1");
|
|
19668
19668
|
const flags = view.getUint16(pos + 8, true);
|
|
19669
19669
|
const method = view.getUint16(pos + 10, true);
|
|
19670
19670
|
const crc = view.getUint32(pos + 16, true);
|
|
@@ -19675,7 +19675,7 @@ function parseCentralDirectory(buf) {
|
|
|
19675
19675
|
const commentLen = view.getUint16(pos + 32, true);
|
|
19676
19676
|
const localOffset = view.getUint32(pos + 42, true);
|
|
19677
19677
|
if (compSize === 4294967295 || uncompSize === 4294967295 || localOffset === 4294967295) {
|
|
19678
|
-
throw new (0,
|
|
19678
|
+
throw new (0, _chunk4JLD2IT7cjs.KordocError)("ZIP64\uB294 \uC9C0\uC6D0\uD558\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4");
|
|
19679
19679
|
}
|
|
19680
19680
|
const name = decoder.decode(buf.subarray(pos + 46, pos + 46 + nameLen));
|
|
19681
19681
|
const cdEnd = pos + 46 + nameLen + extraLen + commentLen;
|
|
@@ -19704,7 +19704,7 @@ function patchZipEntries(original, replacements) {
|
|
|
19704
19704
|
const { entries, cdOffset, eocdOffset } = parseCentralDirectory(original);
|
|
19705
19705
|
const view = new DataView(original.buffer, original.byteOffset, original.byteLength);
|
|
19706
19706
|
for (const name of replacements.keys()) {
|
|
19707
|
-
if (!entries.some((e) => e.name === name)) throw new (0,
|
|
19707
|
+
if (!entries.some((e) => e.name === name)) throw new (0, _chunk4JLD2IT7cjs.KordocError)(`ZIP\uC5D0 \uC5C6\uB294 \uC5D4\uD2B8\uB9AC: ${name}`);
|
|
19708
19708
|
}
|
|
19709
19709
|
const byLocal = [...entries].sort((a, b) => a.localOffset - b.localOffset);
|
|
19710
19710
|
const segments = [];
|
|
@@ -19722,7 +19722,7 @@ function patchZipEntries(original, replacements) {
|
|
|
19722
19722
|
offset += seg.length;
|
|
19723
19723
|
continue;
|
|
19724
19724
|
}
|
|
19725
|
-
if (view.getUint32(e.localOffset, true) !== LOCAL_SIG) throw new (0,
|
|
19725
|
+
if (view.getUint32(e.localOffset, true) !== LOCAL_SIG) throw new (0, _chunk4JLD2IT7cjs.KordocError)("ZIP \uB85C\uCEEC \uD5E4\uB354 \uC2DC\uADF8\uB2C8\uCC98 \uBD88\uC77C\uCE58");
|
|
19726
19726
|
const nameLen = view.getUint16(e.localOffset + 26, true);
|
|
19727
19727
|
const extraLen = view.getUint16(e.localOffset + 28, true);
|
|
19728
19728
|
const headerLen = 30 + nameLen + extraLen;
|
|
@@ -19777,7 +19777,7 @@ async function fillHwpx(hwpxBuffer, values) {
|
|
|
19777
19777
|
const zip = await _jszip2.default.loadAsync(hwpxBuffer);
|
|
19778
19778
|
const sectionPaths = Object.keys(zip.files).filter((name) => /[Ss]ection\d+\.xml$/i.test(name)).sort();
|
|
19779
19779
|
if (sectionPaths.length === 0) {
|
|
19780
|
-
throw new (0,
|
|
19780
|
+
throw new (0, _chunk4JLD2IT7cjs.KordocError)("HWPX\uC5D0\uC11C \uC139\uC158 \uD30C\uC77C\uC744 \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4");
|
|
19781
19781
|
}
|
|
19782
19782
|
const normalizedValues = normalizeValues(values);
|
|
19783
19783
|
const matchedLabels = /* @__PURE__ */ new Set();
|
|
@@ -20013,8 +20013,30 @@ var PRESET_DEFAULTS = {
|
|
|
20013
20013
|
notice: { bodyPt: 15, lineSpacing: 160, numbering: "standard" },
|
|
20014
20014
|
minutes: { bodyPt: 14, lineSpacing: 130, numbering: "standard" }
|
|
20015
20015
|
};
|
|
20016
|
+
var PRESET_ALIAS = {
|
|
20017
|
+
official: "official",
|
|
20018
|
+
\uAE30\uC548\uBB38: "official",
|
|
20019
|
+
\uC2DC\uD589\uBB38: "official",
|
|
20020
|
+
\uACF5\uBB38: "official",
|
|
20021
|
+
\uACF5\uBB38\uC11C: "official",
|
|
20022
|
+
report: "report",
|
|
20023
|
+
\uBCF4\uACE0\uC11C: "report",
|
|
20024
|
+
plan: "plan",
|
|
20025
|
+
\uACC4\uD68D\uC11C: "plan",
|
|
20026
|
+
\uACC4\uD68D: "plan",
|
|
20027
|
+
notice: "notice",
|
|
20028
|
+
\uD1B5\uC9C0: "notice",
|
|
20029
|
+
\uC54C\uB9BC: "notice",
|
|
20030
|
+
\uC548\uB0B4: "notice",
|
|
20031
|
+
minutes: "minutes",
|
|
20032
|
+
\uD68C\uC758\uB85D: "minutes"
|
|
20033
|
+
};
|
|
20034
|
+
function normalizeGongmunPreset(preset) {
|
|
20035
|
+
if (!preset) return "official";
|
|
20036
|
+
return _nullishCoalesce(PRESET_ALIAS[preset.trim()], () => ( "official"));
|
|
20037
|
+
}
|
|
20016
20038
|
function resolveGongmun(opts) {
|
|
20017
|
-
const preset =
|
|
20039
|
+
const preset = normalizeGongmunPreset(opts.preset);
|
|
20018
20040
|
const d = PRESET_DEFAULTS[preset];
|
|
20019
20041
|
const bodyPt = _nullishCoalesce(opts.bodyPt, () => ( d.bodyPt));
|
|
20020
20042
|
return {
|
|
@@ -20927,7 +20949,7 @@ function escapeGfm(text) {
|
|
|
20927
20949
|
}
|
|
20928
20950
|
var HWP_SHAPE_ALT_TEXT_RE = /(?:모서리가 둥근 |둥근 )?(?:사각형|직사각형|정사각형|원|타원|삼각형|이등변 삼각형|직각 삼각형|선|직선|곡선|화살표|굵은 화살표|이중 화살표|오각형|육각형|팔각형|별|[4-8]점별|십자|십자형|구름|구름형|마름모|도넛|평행사변형|사다리꼴|부채꼴|호|반원|물결|번개|하트|빗금|블록 화살표|수식|표|그림|개체|그리기\s?개체|묶음\s?개체|글상자|수식\s?개체|OLE\s?개체)\s?입니다\.?/g;
|
|
20929
20951
|
function sanitizeText(text) {
|
|
20930
|
-
let result =
|
|
20952
|
+
let result = _chunk4JLD2IT7cjs.mapPuaText.call(void 0, text).replace(/[\u{F0000}-\u{FFFFD}]/gu, "").replace(HWP_SHAPE_ALT_TEXT_RE, "").replace(/ +/g, " ").trim();
|
|
20931
20953
|
if (result.length <= 30 && result.includes(" ")) {
|
|
20932
20954
|
const tokens = result.split(" ");
|
|
20933
20955
|
const koreanSingleCharCount = tokens.filter((t) => t.length === 1 && /[가-ㄱ-ㆎ]/.test(t)).length;
|
|
@@ -21384,6 +21406,67 @@ function applyCellEdit(table, scanTable, gridR, gridC, newLines, ctx, before, af
|
|
|
21384
21406
|
return 1;
|
|
21385
21407
|
}
|
|
21386
21408
|
|
|
21409
|
+
// src/roundtrip/table-insert.ts
|
|
21410
|
+
var TABLE_USABLE_WIDTH = 44e3;
|
|
21411
|
+
var TABLE_ROW_HEIGHT = 1500;
|
|
21412
|
+
function collectMaxNumericId(xmls) {
|
|
21413
|
+
let max = -1;
|
|
21414
|
+
for (const xml of xmls) {
|
|
21415
|
+
for (const m of xml.matchAll(/\bid(?:Ref)?="(\d{1,10})"/g)) {
|
|
21416
|
+
const v = parseInt(m[1], 10);
|
|
21417
|
+
if (!isNaN(v) && v > max) max = v;
|
|
21418
|
+
}
|
|
21419
|
+
}
|
|
21420
|
+
return max;
|
|
21421
|
+
}
|
|
21422
|
+
function cellBorderFillXml(id) {
|
|
21423
|
+
return `<hh:borderFill id="${id}" threeD="0" shadow="0" centerLine="0" breakCellSeparateLine="0"><hh:slash type="NONE" Crooked="0" isCounter="0"/><hh:backSlash type="NONE" Crooked="0" isCounter="0"/><hh:leftBorder type="SOLID" width="0.12 mm" color="#000000"/><hh:rightBorder type="SOLID" width="0.12 mm" color="#000000"/><hh:topBorder type="SOLID" width="0.12 mm" color="#000000"/><hh:bottomBorder type="SOLID" width="0.12 mm" color="#000000"/><hh:diagonal type="NONE" width="0.1 mm" color="#000000"/><hh:fillInfo/></hh:borderFill>`;
|
|
21424
|
+
}
|
|
21425
|
+
function injectCellBorderFill(headerXml, newId) {
|
|
21426
|
+
const openM = headerXml.match(/<hh:borderFills\b([^>]*)>/);
|
|
21427
|
+
if (!openM || openM.index === void 0) return null;
|
|
21428
|
+
const closeIdx = headerXml.indexOf("</hh:borderFills>");
|
|
21429
|
+
if (closeIdx < 0) return null;
|
|
21430
|
+
const splices = [];
|
|
21431
|
+
const itemCntM = openM[1].match(/\bitemCnt="(\d+)"/);
|
|
21432
|
+
if (itemCntM && itemCntM.index !== void 0) {
|
|
21433
|
+
const cnt = parseInt(itemCntM[1], 10);
|
|
21434
|
+
const attrStart = openM.index + "<hh:borderFills".length + itemCntM.index;
|
|
21435
|
+
const valStart = attrStart + itemCntM[0].indexOf('"') + 1;
|
|
21436
|
+
const valEnd = valStart + String(cnt).length;
|
|
21437
|
+
splices.push({ start: valStart, end: valEnd, replacement: String(cnt + 1) });
|
|
21438
|
+
}
|
|
21439
|
+
splices.push({ start: closeIdx, end: closeIdx, replacement: cellBorderFillXml(newId) });
|
|
21440
|
+
return { borderFillId: newId, headerSplices: splices };
|
|
21441
|
+
}
|
|
21442
|
+
function cellPlainText(raw) {
|
|
21443
|
+
let t = unescapeGfmCell(raw);
|
|
21444
|
+
t = t.replace(/\*\*\*([^*]+)\*\*\*/g, "$1").replace(/\*\*([^*]+)\*\*/g, "$1").replace(/\*([^*]+)\*/g, "$1").replace(/`([^`]+)`/g, "$1");
|
|
21445
|
+
return t.replace(/\s*\n\s*/g, " ").trim();
|
|
21446
|
+
}
|
|
21447
|
+
function buildTableParagraphXml(rows, opts) {
|
|
21448
|
+
const { borderFillId, outerParaPrId, cellParaPrId, cellCharPrId, tableId } = opts;
|
|
21449
|
+
const rowCnt = rows.length;
|
|
21450
|
+
const colCnt = Math.max(...rows.map((r) => r.length), 1);
|
|
21451
|
+
const cellW = Math.floor(TABLE_USABLE_WIDTH / colCnt);
|
|
21452
|
+
const cellH = TABLE_ROW_HEIGHT;
|
|
21453
|
+
const tblW = cellW * colCnt;
|
|
21454
|
+
const tblH = cellH * rowCnt;
|
|
21455
|
+
const trElements = rows.map((row, rowIdx) => {
|
|
21456
|
+
const cells = row.length < colCnt ? [...row, ...Array(colCnt - row.length).fill("")] : row;
|
|
21457
|
+
const isHeaderRow = rowIdx === 0;
|
|
21458
|
+
const tdElements = cells.map((cell, colIdx) => {
|
|
21459
|
+
const text = escapeXmlText(cellPlainText(cell));
|
|
21460
|
+
const cellP = `<hp:p paraPrIDRef="${cellParaPrId}" styleIDRef="0"><hp:run charPrIDRef="${cellCharPrId}"><hp:t>${text}</hp:t></hp:run></hp:p>`;
|
|
21461
|
+
return `<hp:tc name="" header="${isHeaderRow ? 1 : 0}" hasMargin="0" protect="0" editable="1" dirty="0" borderFillIDRef="${borderFillId}"><hp:subList id="" textDirection="HORIZONTAL" lineWrap="BREAK" vertAlign="TOP" linkListIDRef="0" linkListNextIDRef="0" textWidth="0" textHeight="0" hasTextRef="0" hasNumRef="0">${cellP}</hp:subList><hp:cellAddr colAddr="${colIdx}" rowAddr="${rowIdx}"/><hp:cellSpan colSpan="1" rowSpan="1"/><hp:cellSz width="${cellW}" height="${cellH}"/><hp:cellMargin left="141" right="141" top="141" bottom="141"/></hp:tc>`;
|
|
21462
|
+
}).join("");
|
|
21463
|
+
return `<hp:tr>${tdElements}</hp:tr>`;
|
|
21464
|
+
}).join("");
|
|
21465
|
+
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;
|
|
21466
|
+
const tbl = `<hp:tbl id="${tableId}" zOrder="0" numberingType="TABLE" pageBreak="CELL" repeatHeader="0" rowCnt="${rowCnt}" colCnt="${colCnt}" cellSpacing="0" borderFillIDRef="${borderFillId}" noShading="0">${tblInner}</hp:tbl>`;
|
|
21467
|
+
return `<hp:p paraPrIDRef="${outerParaPrId}" styleIDRef="0"><hp:run charPrIDRef="${cellCharPrId}">${tbl}</hp:run></hp:p>`;
|
|
21468
|
+
}
|
|
21469
|
+
|
|
21387
21470
|
// src/roundtrip/hwpx-entries.ts
|
|
21388
21471
|
async function resolveSectionEntryNames(zip) {
|
|
21389
21472
|
for (const mp of ["Contents/content.hpf", "content.hpf"]) {
|
|
@@ -21445,6 +21528,13 @@ async function patchHwpx(original, editedMarkdown, options) {
|
|
|
21445
21528
|
const xml = await zip.file(sectionPaths[i]).async("text");
|
|
21446
21529
|
scans.push(scanSectionXml(xml, i));
|
|
21447
21530
|
}
|
|
21531
|
+
let tableInsert;
|
|
21532
|
+
const headerEntryName = await resolveHeaderEntryName(zip);
|
|
21533
|
+
if (headerEntryName) {
|
|
21534
|
+
const headerXml = await zip.file(headerEntryName).async("text");
|
|
21535
|
+
const maxId = collectMaxNumericId([...scans.map((s) => s.xml), headerXml]);
|
|
21536
|
+
tableInsert = { headerEntryName, headerXml, headerSplices: [], borderFillId: null, nextId: maxId + 1 };
|
|
21537
|
+
}
|
|
21448
21538
|
const origUnits = buildOrigUnits(origBlocks);
|
|
21449
21539
|
const editedUnits = splitMarkdownUnits(editedMarkdown);
|
|
21450
21540
|
const pairs = alignUnits(origUnits.map((u) => u.raw), editedUnits.map((u) => u.raw));
|
|
@@ -21464,7 +21554,8 @@ async function patchHwpx(original, editedMarkdown, options) {
|
|
|
21464
21554
|
scanTables,
|
|
21465
21555
|
obTableOrdinals,
|
|
21466
21556
|
sectionSplices,
|
|
21467
|
-
skipped
|
|
21557
|
+
skipped,
|
|
21558
|
+
tableInsert
|
|
21468
21559
|
});
|
|
21469
21560
|
} else if (oi !== null) {
|
|
21470
21561
|
skipped.push({ reason: "\uBE14\uB85D \uC0AD\uC81C\uB294 \uBBF8\uC9C0\uC6D0 (v1) \u2014 \uC6D0\uBCF8 \uC720\uC9C0", before: summarize(origUnits[oi].raw) });
|
|
@@ -21481,6 +21572,10 @@ async function patchHwpx(original, editedMarkdown, options) {
|
|
|
21481
21572
|
const newXml = applySplices(scans[i].xml, sectionSplices[i]);
|
|
21482
21573
|
replacements.set(sectionPaths[i], encoder.encode(newXml));
|
|
21483
21574
|
}
|
|
21575
|
+
if (tableInsert && tableInsert.headerSplices.length > 0) {
|
|
21576
|
+
const newHeader = applySplices(tableInsert.headerXml, tableInsert.headerSplices);
|
|
21577
|
+
replacements.set(tableInsert.headerEntryName, encoder.encode(newHeader));
|
|
21578
|
+
}
|
|
21484
21579
|
} catch (err) {
|
|
21485
21580
|
return { success: false, applied: 0, skipped, error: `\uC18C\uC2A4\uB9F5 splice \uC2E4\uD328: ${err instanceof Error ? err.message : String(err)}` };
|
|
21486
21581
|
}
|
|
@@ -21514,9 +21609,9 @@ function buildOrigUnits(blocks) {
|
|
|
21514
21609
|
if (block.type === "paragraph" && block.text && /^\[별표\s*\d+/.test(sanitizeText(block.text))) {
|
|
21515
21610
|
const next = blocks[i + 1];
|
|
21516
21611
|
if (_optionalChain([next, 'optionalAccess', _198 => _198.type]) === "paragraph" && next.text && /관련\)?$/.test(next.text)) consume = 2;
|
|
21517
|
-
chunk =
|
|
21612
|
+
chunk = _chunk4JLD2IT7cjs.blocksToMarkdown.call(void 0, blocks.slice(i, i + consume));
|
|
21518
21613
|
} else {
|
|
21519
|
-
chunk =
|
|
21614
|
+
chunk = _chunk4JLD2IT7cjs.blocksToMarkdown.call(void 0, [block]);
|
|
21520
21615
|
}
|
|
21521
21616
|
if (chunk) {
|
|
21522
21617
|
const subUnits = splitMarkdownUnits(chunk);
|
|
@@ -21693,14 +21788,52 @@ function handleModifiedUnit(orig, edited, ctx) {
|
|
|
21693
21788
|
if (orig.kind === "html-table") return patchHtmlTable(block.table, scanTable, orig, edited, ctx, skip);
|
|
21694
21789
|
return patchTextChunkTable(block.table, scanTable, orig, edited, ctx, skip);
|
|
21695
21790
|
}
|
|
21696
|
-
if ((block.type === "paragraph" || block.type === "heading") && orig.kind === "text"
|
|
21697
|
-
return patchParagraphUnit(block, orig, edited, ctx, skip);
|
|
21791
|
+
if ((block.type === "paragraph" || block.type === "heading") && orig.kind === "text") {
|
|
21792
|
+
if (edited.kind === "text") return patchParagraphUnit(block, orig, edited, ctx, skip);
|
|
21793
|
+
if (edited.kind === "gfm-table") return convertParagraphToTable(block, orig, edited, ctx, skip);
|
|
21794
|
+
if (edited.kind === "html-table") return skip("\uBB38\uB2E8\u2192\uBCD1\uD569\uD45C(HTML) \uBCC0\uD658\uC740 \uBBF8\uC9C0\uC6D0 \u2014 GFM \uD45C(| \uD5E4\uB354 | \u2026 |)\uB85C \uC791\uC131\uD558\uC138\uC694");
|
|
21698
21795
|
}
|
|
21699
21796
|
return skip("\uC9C0\uC6D0\uD558\uC9C0 \uC54A\uB294 \uBE14\uB85D \uC720\uD615 \uBCC0\uACBD");
|
|
21700
21797
|
}
|
|
21798
|
+
function extractParaPrIdRef(xml, start) {
|
|
21799
|
+
const gt = xml.indexOf(">", start);
|
|
21800
|
+
if (gt < 0) return null;
|
|
21801
|
+
const m = xml.slice(start, gt + 1).match(/paraPrIDRef="(\d+)"/);
|
|
21802
|
+
return m ? parseInt(m[1], 10) : null;
|
|
21803
|
+
}
|
|
21804
|
+
function convertParagraphToTable(block, orig, edited, ctx, skip) {
|
|
21805
|
+
const ti = ctx.tableInsert;
|
|
21806
|
+
if (!ti) return skip("\uBB38\uB2E8\u2192\uD45C \uBCC0\uD658 \uBD88\uAC00 \u2014 header \uC5D4\uD2B8\uB9AC(borderFills) \uD574\uC11D \uC2E4\uD328");
|
|
21807
|
+
const mapping = ctx.paraMap.get(orig.blockIdx);
|
|
21808
|
+
if (!_optionalChain([mapping, 'optionalAccess', _201 => _201.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");
|
|
21809
|
+
const para = mapping.para;
|
|
21810
|
+
if (para.kind !== "body") return skip("\uBCF8\uBB38 \uC678 \uC601\uC5ED(\uD45C \uC140/\uAE00\uC0C1\uC790) \uBB38\uB2E8\uC758 \uD45C \uBCC0\uD658\uC740 \uBBF8\uC9C0\uC6D0");
|
|
21811
|
+
const scan = ctx.scans[para.sectionIndex];
|
|
21812
|
+
if (!scan) return skip("\uC139\uC158 \uB9E4\uD551 \uC2E4\uD328");
|
|
21813
|
+
const pEnd = findElementEnd(scan.xml, para.start);
|
|
21814
|
+
if (pEnd < 0) return skip("\uBB38\uB2E8 \uB05D \uC704\uCE58 \uD0D0\uC0C9 \uC2E4\uD328");
|
|
21815
|
+
const rows = parseGfmTable(edited.lines);
|
|
21816
|
+
if (rows.length === 0 || rows.every((r) => r.length === 0)) return skip("\uD45C \uB0B4\uC6A9\uC774 \uBE44\uC5B4 \uC788\uC74C");
|
|
21817
|
+
if (ti.borderFillId === null) {
|
|
21818
|
+
const inj = injectCellBorderFill(ti.headerXml, ti.nextId++);
|
|
21819
|
+
if (!inj) return skip("header <hh:borderFills> \uAD6C\uC870\uB97C \uCC3E\uC744 \uC218 \uC5C6\uC5B4 \uD45C \uD14C\uB450\uB9AC \uC0DD\uC131 \uBD88\uAC00");
|
|
21820
|
+
ti.borderFillId = inj.borderFillId;
|
|
21821
|
+
ti.headerSplices.push(...inj.headerSplices);
|
|
21822
|
+
}
|
|
21823
|
+
const outerParaPrId = _nullishCoalesce(extractParaPrIdRef(scan.xml, para.start), () => ( 0));
|
|
21824
|
+
const tableXml = buildTableParagraphXml(rows, {
|
|
21825
|
+
borderFillId: ti.borderFillId,
|
|
21826
|
+
outerParaPrId,
|
|
21827
|
+
cellParaPrId: 0,
|
|
21828
|
+
cellCharPrId: 0,
|
|
21829
|
+
tableId: ti.nextId++
|
|
21830
|
+
});
|
|
21831
|
+
ctx.sectionSplices[para.sectionIndex].push({ start: para.start, end: pEnd, replacement: tableXml });
|
|
21832
|
+
return 1;
|
|
21833
|
+
}
|
|
21701
21834
|
function patchParagraphUnit(block, orig, edited, ctx, skip) {
|
|
21702
21835
|
const mapping = ctx.paraMap.get(orig.blockIdx);
|
|
21703
|
-
if (!_optionalChain([mapping, 'optionalAccess',
|
|
21836
|
+
if (!_optionalChain([mapping, 'optionalAccess', _202 => _202.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)");
|
|
21704
21837
|
if (block.text && block.text.includes("\n")) {
|
|
21705
21838
|
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)");
|
|
21706
21839
|
}
|
|
@@ -21731,7 +21864,7 @@ function patchParagraphUnit(block, orig, edited, ctx, skip) {
|
|
|
21731
21864
|
if (sanitizeText(newPlain) !== newPlain) {
|
|
21732
21865
|
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");
|
|
21733
21866
|
}
|
|
21734
|
-
const splices = buildParagraphSplices(mapping.para, newPlain, _optionalChain([ctx, 'access',
|
|
21867
|
+
const splices = buildParagraphSplices(mapping.para, newPlain, _optionalChain([ctx, 'access', _203 => _203.scans, 'access', _204 => _204[mapping.para.sectionIndex], 'optionalAccess', _205 => _205.xml]));
|
|
21735
21868
|
if (splices === null) return skip("\uBB38\uB2E8\uC5D0 \uD14D\uC2A4\uD2B8 \uB178\uB4DC\uB97C \uB9CC\uB4E4 \uC218 \uC5C6\uC74C");
|
|
21736
21869
|
ctx.sectionSplices[mapping.para.sectionIndex].push(...splices);
|
|
21737
21870
|
return 1;
|
|
@@ -21778,6 +21911,24 @@ function unitToBlock(u) {
|
|
|
21778
21911
|
function u8ToArrayBuffer(u8) {
|
|
21779
21912
|
return u8.buffer.slice(u8.byteOffset, u8.byteOffset + u8.byteLength);
|
|
21780
21913
|
}
|
|
21914
|
+
async function resolveHeaderEntryName(zip) {
|
|
21915
|
+
for (const p of ["Contents/header.xml", "header.xml"]) {
|
|
21916
|
+
if (zip.file(p)) return p;
|
|
21917
|
+
}
|
|
21918
|
+
for (const mp of ["Contents/content.hpf", "content.hpf"]) {
|
|
21919
|
+
const f = zip.file(mp);
|
|
21920
|
+
if (!f) continue;
|
|
21921
|
+
const xml = await f.async("text");
|
|
21922
|
+
const m = xml.match(/<opf:item\b[^>]*\bid="header"[^>]*\bhref="([^"]+)"/i) || xml.match(/<opf:item\b[^>]*\bhref="([^"]*header[^"]*\.xml)"/i);
|
|
21923
|
+
if (m) {
|
|
21924
|
+
let href = m[1];
|
|
21925
|
+
if (!href.startsWith("/") && !href.startsWith("Contents/")) href = "Contents/" + href;
|
|
21926
|
+
if (zip.file(href)) return href;
|
|
21927
|
+
}
|
|
21928
|
+
}
|
|
21929
|
+
const found = Object.keys(zip.files).find((n) => /header\.xml$/i.test(n));
|
|
21930
|
+
return _nullishCoalesce(found, () => ( null));
|
|
21931
|
+
}
|
|
21781
21932
|
|
|
21782
21933
|
// src/roundtrip/hwp5-patch.ts
|
|
21783
21934
|
|
|
@@ -21899,7 +22050,7 @@ var Surgeon = (_class3 = class {
|
|
|
21899
22050
|
/** 디렉토리 트리에서 경로 해석 (형제 = L/R 이진 트리, 자식 = child) */
|
|
21900
22051
|
findEntry(path) {
|
|
21901
22052
|
const parts = path.replace(/^\//, "").split("/");
|
|
21902
|
-
let scope = _nullishCoalesce(_optionalChain([this, 'access',
|
|
22053
|
+
let scope = _nullishCoalesce(_optionalChain([this, 'access', _206 => _206.entries, 'access', _207 => _207[0], 'optionalAccess', _208 => _208.child]), () => ( -1));
|
|
21903
22054
|
let current;
|
|
21904
22055
|
for (const part of parts) {
|
|
21905
22056
|
const search = (idx) => {
|
|
@@ -22105,7 +22256,7 @@ function readRecordsStrict(stream) {
|
|
|
22105
22256
|
function serializeRecords(recs, repl) {
|
|
22106
22257
|
const parts = [];
|
|
22107
22258
|
for (let i = 0; i < recs.length; i++) {
|
|
22108
|
-
const data = _nullishCoalesce(_optionalChain([repl, 'optionalAccess',
|
|
22259
|
+
const data = _nullishCoalesce(_optionalChain([repl, 'optionalAccess', _209 => _209.get, 'call', _210 => _210(i)]), () => ( recs[i].data));
|
|
22109
22260
|
const ext = data.length >= 4095;
|
|
22110
22261
|
const header = Buffer.alloc(ext ? 8 : 4);
|
|
22111
22262
|
header.writeUInt32LE((recs[i].tagId & 1023 | (recs[i].level & 1023) << 10 | (ext ? 4095 : data.length) << 20) >>> 0, 0);
|
|
@@ -22228,7 +22379,7 @@ async function patchHwp(original, editedMarkdown, options) {
|
|
|
22228
22379
|
return fail(`CFB \uCEE8\uD14C\uC774\uB108 \uD30C\uC2F1 \uC2E4\uD328: ${msg(err)}`);
|
|
22229
22380
|
}
|
|
22230
22381
|
const fhEntry = CFB2.find(cfb, "/FileHeader");
|
|
22231
|
-
if (!_optionalChain([fhEntry, 'optionalAccess',
|
|
22382
|
+
if (!_optionalChain([fhEntry, 'optionalAccess', _211 => _211.content])) return fail("FileHeader \uC2A4\uD2B8\uB9BC\uC774 \uC5C6\uC2B5\uB2C8\uB2E4 \u2014 HWP 5.x \uD30C\uC77C\uC774 \uC544\uB2D9\uB2C8\uB2E4");
|
|
22232
22383
|
let flags;
|
|
22233
22384
|
try {
|
|
22234
22385
|
flags = parseFileHeader(Buffer.from(fhEntry.content)).flags;
|
|
@@ -22250,7 +22401,7 @@ async function patchHwp(original, editedMarkdown, options) {
|
|
|
22250
22401
|
const scans = [];
|
|
22251
22402
|
for (let i = 0; i < sectionPaths.length; i++) {
|
|
22252
22403
|
const entry = CFB2.find(cfb, sectionPaths[i]);
|
|
22253
|
-
if (!_optionalChain([entry, 'optionalAccess',
|
|
22404
|
+
if (!_optionalChain([entry, 'optionalAccess', _212 => _212.content])) return fail(`\uC139\uC158 \uC2A4\uD2B8\uB9BC \uC77D\uAE30 \uC2E4\uD328: ${sectionPaths[i]}`);
|
|
22254
22405
|
let stream;
|
|
22255
22406
|
try {
|
|
22256
22407
|
stream = compressed ? decompressStream(Buffer.from(entry.content)) : Buffer.from(entry.content);
|
|
@@ -22301,7 +22452,7 @@ async function patchHwp(original, editedMarkdown, options) {
|
|
|
22301
22452
|
}
|
|
22302
22453
|
}
|
|
22303
22454
|
let verification;
|
|
22304
|
-
if (_optionalChain([options, 'optionalAccess',
|
|
22455
|
+
if (_optionalChain([options, 'optionalAccess', _213 => _213.verify]) !== false) {
|
|
22305
22456
|
try {
|
|
22306
22457
|
const reparsed = parseHwp5Document(Buffer.from(data));
|
|
22307
22458
|
verification = diffUnitLists(splitMarkdownUnits(reparsed.markdown), editedUnits);
|
|
@@ -22390,7 +22541,7 @@ function tableContentScore(irTable, scanTable) {
|
|
|
22390
22541
|
for (const [key, scanCell] of scanTable.cells) {
|
|
22391
22542
|
const comma = key.indexOf(",");
|
|
22392
22543
|
const r = Number(key.slice(0, comma)), c = Number(key.slice(comma + 1));
|
|
22393
|
-
const irCell = _optionalChain([irTable, 'access',
|
|
22544
|
+
const irCell = _optionalChain([irTable, 'access', _214 => _214.cells, 'access', _215 => _215[r], 'optionalAccess', _216 => _216[c]]);
|
|
22394
22545
|
if (!irCell) continue;
|
|
22395
22546
|
const a = normForMatch(scanCell.paras.map((p) => p.rawText).join(" "));
|
|
22396
22547
|
const b = normForMatch(stripCellTokens(irCell.text));
|
|
@@ -22416,14 +22567,17 @@ function handleModified(orig, edited, ctx) {
|
|
|
22416
22567
|
if (orig.kind === "html-table") return patchHtmlCells5(block.table, scanTable, orig, edited, ctx, skip);
|
|
22417
22568
|
return patchTextChunk5(block.table, scanTable, orig, edited, ctx, skip);
|
|
22418
22569
|
}
|
|
22419
|
-
if ((block.type === "paragraph" || block.type === "heading") && orig.kind === "text"
|
|
22420
|
-
return patchParagraph(block, orig, edited, ctx, skip);
|
|
22570
|
+
if ((block.type === "paragraph" || block.type === "heading") && orig.kind === "text") {
|
|
22571
|
+
if (edited.kind === "text") return patchParagraph(block, orig, edited, ctx, skip);
|
|
22572
|
+
if (edited.kind === "gfm-table" || edited.kind === "html-table") {
|
|
22573
|
+
return skip("HWP5(.hwp) \uBC14\uC774\uB108\uB9AC\uB294 \uBB38\uB2E8\u2192\uD45C \uC778\uD50C\uB808\uC774\uC2A4 \uBCC0\uD658 \uBBF8\uC9C0\uC6D0 \u2014 generate\uB85C \uC0C8 \uBB38\uC11C\uB97C \uB9CC\uB4E4\uAC70\uB098, HWPX(.hwpx)\uB85C \uC800\uC7A5 \uD6C4 patch\uD558\uC138\uC694");
|
|
22574
|
+
}
|
|
22421
22575
|
}
|
|
22422
22576
|
return skip("\uC9C0\uC6D0\uD558\uC9C0 \uC54A\uB294 \uBE14\uB85D \uC720\uD615 \uBCC0\uACBD");
|
|
22423
22577
|
}
|
|
22424
22578
|
function patchParagraph(block, orig, edited, ctx, skip) {
|
|
22425
22579
|
const mapping = ctx.paraMap.get(orig.blockIdx);
|
|
22426
|
-
if (!_optionalChain([mapping, 'optionalAccess',
|
|
22580
|
+
if (!_optionalChain([mapping, 'optionalAccess', _217 => _217.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)");
|
|
22427
22581
|
if (block.text && block.text.includes("\n")) {
|
|
22428
22582
|
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)");
|
|
22429
22583
|
}
|
|
@@ -22602,7 +22756,7 @@ function applyCellEdit5(table, scanTable, gridR, gridC, newLines, ctx, before, a
|
|
|
22602
22756
|
};
|
|
22603
22757
|
const cell = scanTable.cells.get(`${gridR},${gridC}`);
|
|
22604
22758
|
if (!cell) return skip("\uC140 \uC88C\uD45C \uB9E4\uD551 \uC2E4\uD328 (\uBCD1\uD569 \uC601\uC5ED\uC758 \uBE48 \uCE78\uC774\uAC70\uB098 \uC88C\uD45C \uBD88\uC77C\uCE58)");
|
|
22605
|
-
const irCell = _optionalChain([table, 'access',
|
|
22759
|
+
const irCell = _optionalChain([table, 'access', _218 => _218.cells, 'access', _219 => _219[gridR], 'optionalAccess', _220 => _220[gridC]]);
|
|
22606
22760
|
const scanJoined = cell.paras.map((p) => p.rawText).filter((t) => normForMatch(t)).join("\n");
|
|
22607
22761
|
if (irCell && normForMatch(scanJoined) !== normForMatch(stripCellTokens(irCell.text))) {
|
|
22608
22762
|
if (normForMatch(irCell.text) !== "" || normForMatch(scanJoined) !== "") {
|
|
@@ -22845,7 +22999,7 @@ var HwpxSession = (_class4 = class _HwpxSession {
|
|
|
22845
22999
|
const block = st.blocks[blockIndex];
|
|
22846
23000
|
if (!block) return void 0;
|
|
22847
23001
|
if (block.type === "paragraph" || block.type === "heading") {
|
|
22848
|
-
const para = _optionalChain([st, 'access',
|
|
23002
|
+
const para = _optionalChain([st, 'access', _221 => _221.paraMap, 'access', _222 => _222.get, 'call', _223 => _223(blockIndex), 'optionalAccess', _224 => _224.para]);
|
|
22849
23003
|
if (!para) return void 0;
|
|
22850
23004
|
return { kind: "paragraph", sectionIndex: para.sectionIndex, xmlStart: para.start };
|
|
22851
23005
|
}
|
|
@@ -22870,7 +23024,7 @@ var HwpxSession = (_class4 = class _HwpxSession {
|
|
|
22870
23024
|
if (block.text && block.text.includes("\n")) {
|
|
22871
23025
|
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)" };
|
|
22872
23026
|
}
|
|
22873
|
-
if (!_optionalChain([st, 'access',
|
|
23027
|
+
if (!_optionalChain([st, 'access', _225 => _225.paraMap, 'access', _226 => _226.get, 'call', _227 => _227(blockIndex), 'optionalAccess', _228 => _228.para])) {
|
|
22874
23028
|
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)" };
|
|
22875
23029
|
}
|
|
22876
23030
|
return { capability: "text" };
|
|
@@ -22936,7 +23090,7 @@ var HwpxSession = (_class4 = class _HwpxSession {
|
|
|
22936
23090
|
continue;
|
|
22937
23091
|
}
|
|
22938
23092
|
if (block.type === "table" && block.table) {
|
|
22939
|
-
if (!_optionalChain([edit, 'access',
|
|
23093
|
+
if (!_optionalChain([edit, 'access', _229 => _229.cells, 'optionalAccess', _230 => _230.length])) {
|
|
22940
23094
|
skipped.push({ reason: "\uD45C \uBE14\uB85D\uC5D0\uB294 cells \uD3B8\uC9D1\uB9CC \uC9C0\uC6D0", before: summarize(_nullishCoalesce(block.table.caption, () => ( "(\uD45C)"))) });
|
|
22941
23095
|
continue;
|
|
22942
23096
|
}
|
|
@@ -22956,7 +23110,7 @@ var HwpxSession = (_class4 = class _HwpxSession {
|
|
|
22956
23110
|
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) });
|
|
22957
23111
|
continue;
|
|
22958
23112
|
}
|
|
22959
|
-
const irCell = _optionalChain([block, 'access',
|
|
23113
|
+
const irCell = _optionalChain([block, 'access', _231 => _231.table, 'access', _232 => _232.cells, 'access', _233 => _233[cellEdit.row], 'optionalAccess', _234 => _234[cellEdit.col]]);
|
|
22960
23114
|
if (!irCell) {
|
|
22961
23115
|
skipped.push({ reason: `\uC140 \uC88C\uD45C \uBC94\uC704 \uBC16: ${cellEdit.row},${cellEdit.col}`, after: summarize(cellEdit.text) });
|
|
22962
23116
|
continue;
|
|
@@ -23011,7 +23165,7 @@ var HwpxSession = (_class4 = class _HwpxSession {
|
|
|
23011
23165
|
}
|
|
23012
23166
|
if (replacements.size === 0) {
|
|
23013
23167
|
let changes2;
|
|
23014
|
-
if (_optionalChain([options, 'optionalAccess',
|
|
23168
|
+
if (_optionalChain([options, 'optionalAccess', _235 => _235.verify]) !== false) {
|
|
23015
23169
|
const units = splitMarkdownUnits(st.markdown);
|
|
23016
23170
|
changes2 = diffUnitLists(units, units);
|
|
23017
23171
|
}
|
|
@@ -23032,7 +23186,7 @@ var HwpxSession = (_class4 = class _HwpxSession {
|
|
|
23032
23186
|
}
|
|
23033
23187
|
this.state = newState;
|
|
23034
23188
|
let changes;
|
|
23035
|
-
if (_optionalChain([options, 'optionalAccess',
|
|
23189
|
+
if (_optionalChain([options, 'optionalAccess', _236 => _236.verify]) !== false) {
|
|
23036
23190
|
changes = diffUnitLists(splitMarkdownUnits(beforeMarkdown), splitMarkdownUnits(newState.markdown));
|
|
23037
23191
|
}
|
|
23038
23192
|
return { success: true, data: new Uint8Array(data), applied, skipped, changes };
|
|
@@ -23052,7 +23206,7 @@ var HwpxSession = (_class4 = class _HwpxSession {
|
|
|
23052
23206
|
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)");
|
|
23053
23207
|
}
|
|
23054
23208
|
const mapping = st.paraMap.get(blockIndex);
|
|
23055
|
-
if (!_optionalChain([mapping, 'optionalAccess',
|
|
23209
|
+
if (!_optionalChain([mapping, 'optionalAccess', _237 => _237.para])) {
|
|
23056
23210
|
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)");
|
|
23057
23211
|
}
|
|
23058
23212
|
let newPlain = newTextRaw.split("\n").map((l) => l.trim()).filter(Boolean).join(" ");
|
|
@@ -23072,14 +23226,14 @@ var HwpxSession = (_class4 = class _HwpxSession {
|
|
|
23072
23226
|
if (sanitizeText(newPlain) !== newPlain) {
|
|
23073
23227
|
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");
|
|
23074
23228
|
}
|
|
23075
|
-
const splices = buildParagraphSplices(mapping.para, newPlain, _optionalChain([st, 'access',
|
|
23229
|
+
const splices = buildParagraphSplices(mapping.para, newPlain, _optionalChain([st, 'access', _238 => _238.scans, 'access', _239 => _239[mapping.para.sectionIndex], 'optionalAccess', _240 => _240.xml]));
|
|
23076
23230
|
if (splices === null) return skip("\uBB38\uB2E8\uC5D0 \uD14D\uC2A4\uD2B8 \uB178\uB4DC\uB97C \uB9CC\uB4E4 \uC218 \uC5C6\uC74C");
|
|
23077
23231
|
sectionSplices[mapping.para.sectionIndex].push(...splices);
|
|
23078
23232
|
return 1;
|
|
23079
23233
|
}
|
|
23080
23234
|
}, _class4);
|
|
23081
23235
|
function cellStaticCheck(table, scanTable, r, c) {
|
|
23082
|
-
const irCell = _optionalChain([table, 'access',
|
|
23236
|
+
const irCell = _optionalChain([table, 'access', _241 => _241.cells, 'access', _242 => _242[r], 'optionalAccess', _243 => _243[c]]);
|
|
23083
23237
|
if (!irCell) return { editable: false, reason: "\uC140 \uC88C\uD45C \uBC94\uC704 \uBC16" };
|
|
23084
23238
|
const cell = scanTable.cellByAnchor.get(`${r},${c}`);
|
|
23085
23239
|
if (!cell) return { editable: false, reason: "\uBCD1\uD569 \uC601\uC5ED\uC758 \uBE48 \uCE78\uC774\uAC70\uB098 \uC88C\uD45C \uBD88\uC77C\uCE58" };
|
|
@@ -23163,11 +23317,11 @@ var md = new (0, _markdownit2.default)({
|
|
|
23163
23317
|
breaks: false
|
|
23164
23318
|
});
|
|
23165
23319
|
function renderHtml(markdown, options) {
|
|
23166
|
-
const preset = _nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
23167
|
-
const css = PRESETS[preset] + (_nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
23320
|
+
const preset = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _244 => _244.preset]), () => ( "default"));
|
|
23321
|
+
const css = PRESETS[preset] + (_nullishCoalesce(_optionalChain([options, 'optionalAccess', _245 => _245.extraCss]), () => ( "")));
|
|
23168
23322
|
const body = md.render(markdown);
|
|
23169
|
-
const watermark = _optionalChain([options, 'optionalAccess',
|
|
23170
|
-
const watermarkCss = _optionalChain([options, 'optionalAccess',
|
|
23323
|
+
const watermark = _optionalChain([options, 'optionalAccess', _246 => _246.watermark]) ? `<div class="watermark">${escapeHtml(options.watermark)}</div>` : "";
|
|
23324
|
+
const watermarkCss = _optionalChain([options, 'optionalAccess', _247 => _247.watermark]) ? `
|
|
23171
23325
|
.watermark {
|
|
23172
23326
|
position: fixed;
|
|
23173
23327
|
top: 50%; left: 50%;
|
|
@@ -23198,13 +23352,13 @@ async function htmlToPdf(html, options) {
|
|
|
23198
23352
|
try {
|
|
23199
23353
|
puppeteer = await Promise.resolve().then(() => _interopRequireWildcard(require("puppeteer-core")));
|
|
23200
23354
|
} catch (e34) {
|
|
23201
|
-
throw new (0,
|
|
23355
|
+
throw new (0, _chunk4JLD2IT7cjs.KordocError)(
|
|
23202
23356
|
"PDF \uC0DD\uC131\uC5D0 puppeteer-core\uAC00 \uD544\uC694\uD569\uB2C8\uB2E4. \uC124\uCE58: npm install puppeteer-core"
|
|
23203
23357
|
);
|
|
23204
23358
|
}
|
|
23205
23359
|
const executablePath = _nullishCoalesce(process.env.PUPPETEER_EXECUTABLE_PATH, () => ( findChromiumPath()));
|
|
23206
23360
|
if (!executablePath) {
|
|
23207
|
-
throw new (0,
|
|
23361
|
+
throw new (0, _chunk4JLD2IT7cjs.KordocError)(
|
|
23208
23362
|
"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."
|
|
23209
23363
|
);
|
|
23210
23364
|
}
|
|
@@ -23216,10 +23370,10 @@ async function htmlToPdf(html, options) {
|
|
|
23216
23370
|
try {
|
|
23217
23371
|
const page = await browser.newPage();
|
|
23218
23372
|
await page.setContent(html, { waitUntil: "networkidle0" });
|
|
23219
|
-
const margin = _optionalChain([options, 'optionalAccess',
|
|
23373
|
+
const margin = _optionalChain([options, 'optionalAccess', _248 => _248.margin]);
|
|
23220
23374
|
const pdf = await page.pdf({
|
|
23221
|
-
format: _nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
23222
|
-
landscape: _optionalChain([options, 'optionalAccess',
|
|
23375
|
+
format: _nullishCoalesce(_optionalChain([options, 'optionalAccess', _249 => _249.pageSize]), () => ( "A4")),
|
|
23376
|
+
landscape: _optionalChain([options, 'optionalAccess', _250 => _250.orientation]) === "landscape",
|
|
23223
23377
|
printBackground: true,
|
|
23224
23378
|
margin: margin ? {
|
|
23225
23379
|
top: toCss(margin.top),
|
|
@@ -23227,9 +23381,9 @@ async function htmlToPdf(html, options) {
|
|
|
23227
23381
|
bottom: toCss(margin.bottom),
|
|
23228
23382
|
left: toCss(margin.left)
|
|
23229
23383
|
} : void 0,
|
|
23230
|
-
displayHeaderFooter: !!(_optionalChain([options, 'optionalAccess',
|
|
23231
|
-
headerTemplate: _nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
23232
|
-
footerTemplate: _nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
23384
|
+
displayHeaderFooter: !!(_optionalChain([options, 'optionalAccess', _251 => _251.header]) || _optionalChain([options, 'optionalAccess', _252 => _252.footer])),
|
|
23385
|
+
headerTemplate: _nullishCoalesce(_optionalChain([options, 'optionalAccess', _253 => _253.header]), () => ( "<div></div>")),
|
|
23386
|
+
footerTemplate: _nullishCoalesce(_optionalChain([options, 'optionalAccess', _254 => _254.footer]), () => ( '<div style="font-size:8pt;width:100%;text-align:center;color:#777;"><span class="pageNumber"></span>/<span class="totalPages"></span></div>'))
|
|
23233
23387
|
});
|
|
23234
23388
|
return Buffer.from(pdf);
|
|
23235
23389
|
} finally {
|
|
@@ -23263,24 +23417,24 @@ async function markdownToPdf(markdown, options) {
|
|
|
23263
23417
|
return htmlToPdf(html, options);
|
|
23264
23418
|
}
|
|
23265
23419
|
async function blocksToPdf(blocks, options) {
|
|
23266
|
-
const markdown =
|
|
23420
|
+
const markdown = _chunk4JLD2IT7cjs.blocksToMarkdown.call(void 0, blocks);
|
|
23267
23421
|
return markdownToPdf(markdown, options);
|
|
23268
23422
|
}
|
|
23269
23423
|
|
|
23270
23424
|
// src/index.ts
|
|
23271
23425
|
async function parse(input, options) {
|
|
23272
23426
|
let buffer;
|
|
23273
|
-
const opts = typeof input === "string" && !_optionalChain([options, 'optionalAccess',
|
|
23427
|
+
const opts = typeof input === "string" && !_optionalChain([options, 'optionalAccess', _255 => _255.filePath]) ? { ...options, filePath: input } : options;
|
|
23274
23428
|
if (typeof input === "string") {
|
|
23275
23429
|
try {
|
|
23276
23430
|
const buf = await _promises.readFile.call(void 0, input);
|
|
23277
|
-
buffer =
|
|
23431
|
+
buffer = _chunk4JLD2IT7cjs.toArrayBuffer.call(void 0, buf);
|
|
23278
23432
|
} catch (err) {
|
|
23279
23433
|
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}`;
|
|
23280
23434
|
return { success: false, fileType: "unknown", error: msg2, code: "PARSE_ERROR" };
|
|
23281
23435
|
}
|
|
23282
23436
|
} else if (Buffer.isBuffer(input)) {
|
|
23283
|
-
buffer =
|
|
23437
|
+
buffer = _chunk4JLD2IT7cjs.toArrayBuffer.call(void 0, input);
|
|
23284
23438
|
} else {
|
|
23285
23439
|
buffer = input;
|
|
23286
23440
|
}
|
|
@@ -23315,21 +23469,21 @@ async function parseHwp3(buffer, options) {
|
|
|
23315
23469
|
const { markdown, blocks, metadata, outline, warnings } = parseHwp3Document(buffer, options);
|
|
23316
23470
|
return { success: true, fileType: "hwp3", markdown, blocks, metadata, outline, warnings };
|
|
23317
23471
|
} catch (err) {
|
|
23318
|
-
return { success: false, fileType: "hwp3", error: err instanceof Error ? err.message : "HWP3 \uD30C\uC2F1 \uC2E4\uD328", code:
|
|
23472
|
+
return { success: false, fileType: "hwp3", error: err instanceof Error ? err.message : "HWP3 \uD30C\uC2F1 \uC2E4\uD328", code: _chunk4JLD2IT7cjs.classifyError.call(void 0, err) };
|
|
23319
23473
|
}
|
|
23320
23474
|
}
|
|
23321
23475
|
async function parseHwpx(buffer, options) {
|
|
23322
23476
|
try {
|
|
23323
23477
|
const { markdown, blocks, metadata, outline, warnings, images } = await parseHwpxDocument(buffer, options);
|
|
23324
|
-
return { success: true, fileType: "hwpx", markdown, blocks, metadata, outline, warnings, images: _optionalChain([images, 'optionalAccess',
|
|
23478
|
+
return { success: true, fileType: "hwpx", markdown, blocks, metadata, outline, warnings, images: _optionalChain([images, 'optionalAccess', _256 => _256.length]) ? images : void 0 };
|
|
23325
23479
|
} catch (err) {
|
|
23326
|
-
return { success: false, fileType: "hwpx", error: err instanceof Error ? err.message : "HWPX \uD30C\uC2F1 \uC2E4\uD328", code:
|
|
23480
|
+
return { success: false, fileType: "hwpx", error: err instanceof Error ? err.message : "HWPX \uD30C\uC2F1 \uC2E4\uD328", code: _chunk4JLD2IT7cjs.classifyError.call(void 0, err) };
|
|
23327
23481
|
}
|
|
23328
23482
|
}
|
|
23329
23483
|
async function parseHwp(buffer, options) {
|
|
23330
23484
|
try {
|
|
23331
23485
|
const { markdown, blocks, metadata, outline, warnings, images } = parseHwp5Document(Buffer.from(buffer), options);
|
|
23332
|
-
if (isDistributionSentinel(markdown) && isComFallbackAvailable() && _optionalChain([options, 'optionalAccess',
|
|
23486
|
+
if (isDistributionSentinel(markdown) && isComFallbackAvailable() && _optionalChain([options, 'optionalAccess', _257 => _257.filePath])) {
|
|
23333
23487
|
try {
|
|
23334
23488
|
const { pages, pageCount, warnings: comWarns } = extractTextViaCom(options.filePath);
|
|
23335
23489
|
if (pages.some((p) => p && p.trim().length > 0)) {
|
|
@@ -23346,15 +23500,15 @@ async function parseHwp(buffer, options) {
|
|
|
23346
23500
|
} catch (e35) {
|
|
23347
23501
|
}
|
|
23348
23502
|
}
|
|
23349
|
-
return { success: true, fileType: "hwp", markdown, blocks, metadata, outline, warnings, images: _optionalChain([images, 'optionalAccess',
|
|
23503
|
+
return { success: true, fileType: "hwp", markdown, blocks, metadata, outline, warnings, images: _optionalChain([images, 'optionalAccess', _258 => _258.length]) ? images : void 0 };
|
|
23350
23504
|
} catch (err) {
|
|
23351
|
-
return { success: false, fileType: "hwp", error: err instanceof Error ? err.message : "HWP \uD30C\uC2F1 \uC2E4\uD328", code:
|
|
23505
|
+
return { success: false, fileType: "hwp", error: err instanceof Error ? err.message : "HWP \uD30C\uC2F1 \uC2E4\uD328", code: _chunk4JLD2IT7cjs.classifyError.call(void 0, err) };
|
|
23352
23506
|
}
|
|
23353
23507
|
}
|
|
23354
23508
|
async function parsePdf(buffer, options) {
|
|
23355
23509
|
let parsePdfDocument;
|
|
23356
23510
|
try {
|
|
23357
|
-
const mod = await Promise.resolve().then(() => _interopRequireWildcard(require("./parser-
|
|
23511
|
+
const mod = await Promise.resolve().then(() => _interopRequireWildcard(require("./parser-25ISHR7Q.cjs")));
|
|
23358
23512
|
parsePdfDocument = mod.parsePdfDocument;
|
|
23359
23513
|
} catch (e36) {
|
|
23360
23514
|
return {
|
|
@@ -23369,7 +23523,7 @@ async function parsePdf(buffer, options) {
|
|
|
23369
23523
|
return { success: true, fileType: "pdf", markdown, blocks, metadata, outline, warnings, isImageBased, pageQuality, qualitySummary };
|
|
23370
23524
|
} catch (err) {
|
|
23371
23525
|
const isImageBased = err instanceof Error && "isImageBased" in err ? true : void 0;
|
|
23372
|
-
return { success: false, fileType: "pdf", error: err instanceof Error ? err.message : "PDF \uD30C\uC2F1 \uC2E4\uD328", code:
|
|
23526
|
+
return { success: false, fileType: "pdf", error: err instanceof Error ? err.message : "PDF \uD30C\uC2F1 \uC2E4\uD328", code: _chunk4JLD2IT7cjs.classifyError.call(void 0, err), isImageBased };
|
|
23373
23527
|
}
|
|
23374
23528
|
}
|
|
23375
23529
|
async function parseXlsx(buffer, options) {
|
|
@@ -23377,7 +23531,7 @@ async function parseXlsx(buffer, options) {
|
|
|
23377
23531
|
const { markdown, blocks, metadata, warnings } = await parseXlsxDocument(buffer, options);
|
|
23378
23532
|
return { success: true, fileType: "xlsx", markdown, blocks, metadata, warnings };
|
|
23379
23533
|
} catch (err) {
|
|
23380
|
-
return { success: false, fileType: "xlsx", error: err instanceof Error ? err.message : "XLSX \uD30C\uC2F1 \uC2E4\uD328", code:
|
|
23534
|
+
return { success: false, fileType: "xlsx", error: err instanceof Error ? err.message : "XLSX \uD30C\uC2F1 \uC2E4\uD328", code: _chunk4JLD2IT7cjs.classifyError.call(void 0, err) };
|
|
23381
23535
|
}
|
|
23382
23536
|
}
|
|
23383
23537
|
async function parseXls(buffer, options) {
|
|
@@ -23385,15 +23539,15 @@ async function parseXls(buffer, options) {
|
|
|
23385
23539
|
const { markdown, blocks, metadata, warnings } = await parseXlsDocument(buffer, options);
|
|
23386
23540
|
return { success: true, fileType: "xls", markdown, blocks, metadata, warnings };
|
|
23387
23541
|
} catch (err) {
|
|
23388
|
-
return { success: false, fileType: "xls", error: err instanceof Error ? err.message : "XLS \uD30C\uC2F1 \uC2E4\uD328", code:
|
|
23542
|
+
return { success: false, fileType: "xls", error: err instanceof Error ? err.message : "XLS \uD30C\uC2F1 \uC2E4\uD328", code: _chunk4JLD2IT7cjs.classifyError.call(void 0, err) };
|
|
23389
23543
|
}
|
|
23390
23544
|
}
|
|
23391
23545
|
async function parseDocx(buffer, options) {
|
|
23392
23546
|
try {
|
|
23393
23547
|
const { markdown, blocks, metadata, outline, warnings, images } = await parseDocxDocument(buffer, options);
|
|
23394
|
-
return { success: true, fileType: "docx", markdown, blocks, metadata, outline, warnings, images: _optionalChain([images, 'optionalAccess',
|
|
23548
|
+
return { success: true, fileType: "docx", markdown, blocks, metadata, outline, warnings, images: _optionalChain([images, 'optionalAccess', _259 => _259.length]) ? images : void 0 };
|
|
23395
23549
|
} catch (err) {
|
|
23396
|
-
return { success: false, fileType: "docx", error: err instanceof Error ? err.message : "DOCX \uD30C\uC2F1 \uC2E4\uD328", code:
|
|
23550
|
+
return { success: false, fileType: "docx", error: err instanceof Error ? err.message : "DOCX \uD30C\uC2F1 \uC2E4\uD328", code: _chunk4JLD2IT7cjs.classifyError.call(void 0, err) };
|
|
23397
23551
|
}
|
|
23398
23552
|
}
|
|
23399
23553
|
async function parseHwpml(buffer, options) {
|
|
@@ -23401,16 +23555,16 @@ async function parseHwpml(buffer, options) {
|
|
|
23401
23555
|
const { markdown, blocks, metadata, outline, warnings } = parseHwpmlDocument(buffer, options);
|
|
23402
23556
|
return { success: true, fileType: "hwpml", markdown, blocks, metadata, outline, warnings };
|
|
23403
23557
|
} catch (err) {
|
|
23404
|
-
return { success: false, fileType: "hwpml", error: err instanceof Error ? err.message : "HWPML \uD30C\uC2F1 \uC2E4\uD328", code:
|
|
23558
|
+
return { success: false, fileType: "hwpml", error: err instanceof Error ? err.message : "HWPML \uD30C\uC2F1 \uC2E4\uD328", code: _chunk4JLD2IT7cjs.classifyError.call(void 0, err) };
|
|
23405
23559
|
}
|
|
23406
23560
|
}
|
|
23407
23561
|
async function fillForm(input, values, outputFormat = "markdown") {
|
|
23408
23562
|
let buffer;
|
|
23409
23563
|
if (typeof input === "string") {
|
|
23410
23564
|
const buf = await _promises.readFile.call(void 0, input);
|
|
23411
|
-
buffer =
|
|
23565
|
+
buffer = _chunk4JLD2IT7cjs.toArrayBuffer.call(void 0, buf);
|
|
23412
23566
|
} else if (Buffer.isBuffer(input)) {
|
|
23413
|
-
buffer =
|
|
23567
|
+
buffer = _chunk4JLD2IT7cjs.toArrayBuffer.call(void 0, input);
|
|
23414
23568
|
} else {
|
|
23415
23569
|
buffer = input;
|
|
23416
23570
|
}
|
|
@@ -23436,7 +23590,7 @@ async function fillForm(input, values, outputFormat = "markdown") {
|
|
|
23436
23590
|
throw new Error(`\uC11C\uC2DD \uD30C\uC2F1 \uC2E4\uD328: ${parsed.error}`);
|
|
23437
23591
|
}
|
|
23438
23592
|
const fill = fillFormFields(parsed.blocks, values);
|
|
23439
|
-
const markdown =
|
|
23593
|
+
const markdown = _chunk4JLD2IT7cjs.blocksToMarkdown.call(void 0, fill.blocks);
|
|
23440
23594
|
if (outputFormat === "hwpx") {
|
|
23441
23595
|
const hwpxBuffer = await markdownToHwpx(markdown);
|
|
23442
23596
|
return { output: hwpxBuffer, format: "hwpx", fill };
|
|
@@ -23484,5 +23638,7 @@ async function fillForm(input, values, outputFormat = "markdown") {
|
|
|
23484
23638
|
|
|
23485
23639
|
|
|
23486
23640
|
|
|
23487
|
-
|
|
23641
|
+
|
|
23642
|
+
|
|
23643
|
+
exports.HwpxSession = HwpxSession; exports.PRESET_ALIAS = PRESET_ALIAS; exports.VERSION = _chunk4JLD2IT7cjs.VERSION; exports.applySplices = applySplices; exports.blocksToMarkdown = _chunk4JLD2IT7cjs.blocksToMarkdown; exports.blocksToPdf = blocksToPdf; exports.buildParagraphSplices = buildParagraphSplices; exports.buildRangeSplices = buildRangeSplices; 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.inferFieldType = inferFieldType; exports.isHwpxFile = isHwpxFile; exports.isLabelCell = isLabelCell; exports.isOldHwpFile = isOldHwpFile; exports.isPdfFile = isPdfFile; exports.isZipFile = isZipFile; exports.markdownToHwpx = markdownToHwpx; exports.markdownToPdf = markdownToPdf; 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.parsePdf = parsePdf; exports.parseXls = parseXls; exports.parseXlsx = parseXlsx; exports.patchHwp = patchHwp; exports.patchHwpx = patchHwpx; exports.patchHwpxBlocks = patchHwpxBlocks; exports.renderHtml = renderHtml; exports.scanSectionXml = scanSectionXml;
|
|
23488
23644
|
//# sourceMappingURL=index.cjs.map
|