kordoc 4.0.2 → 4.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +792 -768
- package/dist/{-XMKVL3NX.js → -QSF64HNK.js} +8 -8
- package/dist/{chunk-STMLZDKR.js → chunk-6JSZBSOD.js} +2 -2
- package/dist/chunk-6JSZBSOD.js.map +1 -0
- package/dist/{chunk-IKBIIEVJ.js → chunk-AUJICYJG.js} +3 -3
- package/dist/chunk-AUJICYJG.js.map +1 -0
- package/dist/chunk-DCZVOIEO.cjs.map +1 -1
- package/dist/chunk-GS7T56RP.cjs.map +1 -1
- package/dist/{chunk-AHWRAGXN.js → chunk-K2SETHJ6.js} +162 -75
- package/dist/chunk-K2SETHJ6.js.map +1 -0
- package/dist/{chunk-5CJGKKMZ.js → chunk-MEPHGCPQ.js} +1 -1
- package/dist/chunk-MEPHGCPQ.js.map +1 -0
- package/dist/chunk-MOL7MDBG.js +0 -0
- package/dist/{chunk-6SD4X5PT.js → chunk-MQLKSRIK.js} +3 -3
- package/dist/chunk-MQLKSRIK.js.map +1 -0
- package/dist/{chunk-WN7LZHII.cjs → chunk-OVESZY5R.cjs} +2 -2
- package/dist/chunk-OVESZY5R.cjs.map +1 -0
- package/dist/{chunk-6YIYFWO2.js → chunk-PNQDQ3SM.js} +2 -2
- package/dist/chunk-PNQDQ3SM.js.map +1 -0
- package/dist/{chunk-67RANGFQ.js → chunk-RO2GVZ3I.js} +3 -3
- package/dist/chunk-RO2GVZ3I.js.map +1 -0
- package/dist/{chunk-3IYQYBUF.js → chunk-TQYX5E32.js} +2 -2
- package/dist/chunk-TQYX5E32.js.map +1 -0
- package/dist/cli.js +14 -14
- package/dist/cli.js.map +1 -1
- package/dist/{detect-PJZMUL2Z.js → detect-RI2MQ33K.js} +2 -2
- package/dist/formula-5NKVS2LR.cjs.map +1 -1
- package/dist/formula-JCNF43NE.js +0 -0
- package/dist/index.cjs +461 -374
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +5 -4
- package/dist/index.d.ts +5 -4
- package/dist/index.js +157 -70
- package/dist/index.js.map +1 -1
- package/dist/mcp.js +17 -17
- package/dist/mcp.js.map +1 -1
- package/dist/page-range-737B4EZW.js +0 -0
- package/dist/page-range-P7SDW6LR.cjs.map +1 -1
- package/dist/{parser-3HM2VYKK.js → parser-AODAQQLQ.js} +5 -5
- package/dist/parser-AODAQQLQ.js.map +1 -0
- package/dist/{parser-6AYYGX6J.cjs → parser-FMONFTAN.cjs} +16 -16
- package/dist/parser-FMONFTAN.cjs.map +1 -0
- package/dist/{parser-2Q2YKEJG.js → parser-J7YREDNS.js} +4 -4
- package/dist/parser-J7YREDNS.js.map +1 -0
- package/dist/{provider-H4WWSPOV.js → provider-4ZJKV3DC.js} +1 -1
- package/dist/provider-4ZJKV3DC.js.map +1 -0
- package/dist/{provider-7H4CPZYS.js → provider-AKROB7WQ.js} +1 -1
- package/dist/provider-AKROB7WQ.js.map +1 -0
- package/dist/{provider-5K7O3Z2O.cjs → provider-G4C2V2PD.cjs} +1 -1
- package/dist/provider-G4C2V2PD.cjs.map +1 -0
- package/dist/render-JPP7YTV3.js +10 -0
- package/dist/seal-MDE4DXZQ.js +10 -0
- package/dist/setup-57FB3LSP.js +0 -0
- package/dist/{watch-6OHF727O.js → watch-P65Z24AL.js} +8 -8
- package/dist/watch-P65Z24AL.js.map +1 -0
- package/package.json +4 -4
- package/dist/chunk-3IYQYBUF.js.map +0 -1
- package/dist/chunk-5CJGKKMZ.js.map +0 -1
- package/dist/chunk-67RANGFQ.js.map +0 -1
- package/dist/chunk-6SD4X5PT.js.map +0 -1
- package/dist/chunk-6YIYFWO2.js.map +0 -1
- package/dist/chunk-AHWRAGXN.js.map +0 -1
- package/dist/chunk-IKBIIEVJ.js.map +0 -1
- package/dist/chunk-STMLZDKR.js.map +0 -1
- package/dist/chunk-WN7LZHII.cjs.map +0 -1
- package/dist/parser-2Q2YKEJG.js.map +0 -1
- package/dist/parser-3HM2VYKK.js.map +0 -1
- package/dist/parser-6AYYGX6J.cjs.map +0 -1
- package/dist/provider-5K7O3Z2O.cjs.map +0 -1
- package/dist/provider-7H4CPZYS.js.map +0 -1
- package/dist/provider-H4WWSPOV.js.map +0 -1
- package/dist/render-W4VCJE6N.js +0 -10
- package/dist/seal-DRPTNHOP.js +0 -10
- package/dist/watch-6OHF727O.js.map +0 -1
- /package/dist/{-XMKVL3NX.js.map → -QSF64HNK.js.map} +0 -0
- /package/dist/{detect-PJZMUL2Z.js.map → detect-RI2MQ33K.js.map} +0 -0
- /package/dist/{render-W4VCJE6N.js.map → render-JPP7YTV3.js.map} +0 -0
- /package/dist/{seal-DRPTNHOP.js.map → seal-MDE4DXZQ.js.map} +0 -0
package/dist/index.cjs
CHANGED
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
|
|
21
21
|
|
|
22
22
|
|
|
23
|
-
var
|
|
23
|
+
var _chunkOVESZY5Rcjs = require('./chunk-OVESZY5R.cjs');
|
|
24
24
|
|
|
25
25
|
|
|
26
26
|
var _chunkDCZVOIEOcjs = require('./chunk-DCZVOIEO.cjs');
|
|
@@ -406,8 +406,8 @@ function createSectionShared() {
|
|
|
406
406
|
function createXmlParser(warnings) {
|
|
407
407
|
return new (0, _xmldom.DOMParser)({
|
|
408
408
|
onError(level, msg2) {
|
|
409
|
-
if (level === "fatalError") throw new (0,
|
|
410
|
-
_optionalChain([warnings, 'optionalAccess', _3 => _3.push, 'call', _4 => _4({ code: "MALFORMED_XML", message: `XML ${level === "
|
|
409
|
+
if (level === "fatalError") throw new (0, _chunkOVESZY5Rcjs.KordocError)(`XML \uD30C\uC2F1 \uC2E4\uD328: ${msg2}`);
|
|
410
|
+
_optionalChain([warnings, 'optionalAccess', _3 => _3.push, 'call', _4 => _4({ code: "MALFORMED_XML", message: `XML ${level === "warning" ? "\uACBD\uACE0" : "\uC624\uB958"}: ${msg2}` })]);
|
|
411
411
|
}
|
|
412
412
|
});
|
|
413
413
|
}
|
|
@@ -461,14 +461,14 @@ async function extractHwpxStyles(zip, decompressed) {
|
|
|
461
461
|
const xml = await file.async("text");
|
|
462
462
|
if (decompressed) {
|
|
463
463
|
decompressed.total += xml.length * 2;
|
|
464
|
-
if (decompressed.total > MAX_DECOMPRESS_SIZE) throw new (0,
|
|
464
|
+
if (decompressed.total > MAX_DECOMPRESS_SIZE) throw new (0, _chunkOVESZY5Rcjs.KordocError)("ZIP \uC555\uCD95 \uD574\uC81C \uD06C\uAE30 \uCD08\uACFC (ZIP bomb \uC758\uC2EC)");
|
|
465
465
|
}
|
|
466
466
|
const parser = createXmlParser();
|
|
467
|
-
const doc = parser.parseFromString(
|
|
467
|
+
const doc = parser.parseFromString(_chunkOVESZY5Rcjs.stripDtd.call(void 0, xml), "text/xml");
|
|
468
468
|
if (!doc.documentElement) continue;
|
|
469
|
-
parseCharProperties(doc, result.charProperties);
|
|
470
|
-
parseStyleElements(doc, result.styles);
|
|
471
469
|
const domDoc = doc;
|
|
470
|
+
parseCharProperties(domDoc, result.charProperties);
|
|
471
|
+
parseStyleElements(domDoc, result.styles);
|
|
472
472
|
parseNumberings(domDoc, result.numberings);
|
|
473
473
|
parseBullets(domDoc, result.bullets);
|
|
474
474
|
parseParaHeadings(domDoc, result.paraHeadings);
|
|
@@ -616,9 +616,9 @@ function detectHwpxHeadings(blocks, styleMap) {
|
|
|
616
616
|
let level = 0;
|
|
617
617
|
if (baseFontSize > 0 && _optionalChain([block, 'access', _7 => _7.style, 'optionalAccess', _8 => _8.fontSize])) {
|
|
618
618
|
const ratio = block.style.fontSize / baseFontSize;
|
|
619
|
-
if (ratio >=
|
|
620
|
-
else if (ratio >=
|
|
621
|
-
else if (ratio >=
|
|
619
|
+
if (ratio >= _chunkOVESZY5Rcjs.HEADING_RATIO_H1) level = 1;
|
|
620
|
+
else if (ratio >= _chunkOVESZY5Rcjs.HEADING_RATIO_H2) level = 2;
|
|
621
|
+
else if (ratio >= _chunkOVESZY5Rcjs.HEADING_RATIO_H3) level = 3;
|
|
622
622
|
}
|
|
623
623
|
const compactText = text.replace(/\s+/g, "");
|
|
624
624
|
if (/^제\d+[조장절편]/.test(compactText) && text.length <= 50) {
|
|
@@ -1202,7 +1202,7 @@ function resolveParaHeading(paraEl, ctx) {
|
|
|
1202
1202
|
|
|
1203
1203
|
// src/hwpx/table-build.ts
|
|
1204
1204
|
function buildTableWithCellMeta(state) {
|
|
1205
|
-
const table2 =
|
|
1205
|
+
const table2 = _chunkOVESZY5Rcjs.buildTable.call(void 0, state.rows);
|
|
1206
1206
|
if (state.caption) table2.caption = state.caption;
|
|
1207
1207
|
const anchors = [];
|
|
1208
1208
|
{
|
|
@@ -1272,7 +1272,7 @@ function completeTable(newTable, tableStack, blocks, ctx) {
|
|
|
1272
1272
|
const cell2 = parentTable.cell;
|
|
1273
1273
|
(cell2.blocks ??= []).push(block);
|
|
1274
1274
|
cell2.hasStructure = true;
|
|
1275
|
-
let flat =
|
|
1275
|
+
let flat = _chunkOVESZY5Rcjs.convertTableToText.call(void 0, newTable.rows);
|
|
1276
1276
|
if (newTable.caption) flat = newTable.caption + (flat ? "\n" + flat : "");
|
|
1277
1277
|
if (flat) cell2.text += (cell2.text ? "\n" : "") + flat;
|
|
1278
1278
|
} else {
|
|
@@ -1284,7 +1284,7 @@ function completeTable(newTable, tableStack, blocks, ctx) {
|
|
|
1284
1284
|
// src/hwpx/section-walker.ts
|
|
1285
1285
|
function parseSectionXml(xml, styleMap, warnings, sectionNum, shared) {
|
|
1286
1286
|
const parser = createXmlParser(warnings);
|
|
1287
|
-
const doc = parser.parseFromString(
|
|
1287
|
+
const doc = parser.parseFromString(_chunkOVESZY5Rcjs.stripDtd.call(void 0, xml), "text/xml");
|
|
1288
1288
|
if (!doc.documentElement) return [];
|
|
1289
1289
|
const ctx = { styleMap, warnings, sectionNum, shared: _nullishCoalesce(shared, () => ( createSectionShared())) };
|
|
1290
1290
|
ctx.shared.track.deleteDepth = 0;
|
|
@@ -1336,12 +1336,17 @@ function walkSection(node, blocks, tableCtx, tableStack, ctx, depth = 0) {
|
|
|
1336
1336
|
break;
|
|
1337
1337
|
}
|
|
1338
1338
|
// 표/도표 캡션 — IRTable.caption으로 보존 (v3.0, 기존 무음 드롭 수정)
|
|
1339
|
-
case "caption":
|
|
1340
|
-
|
|
1341
|
-
|
|
1342
|
-
if (
|
|
1339
|
+
case "caption": {
|
|
1340
|
+
const capText = collectSubListText(el, ctx);
|
|
1341
|
+
if (capText) {
|
|
1342
|
+
if (tableCtx) {
|
|
1343
|
+
tableCtx.caption = (tableCtx.caption ? tableCtx.caption + "\n" : "") + capText;
|
|
1344
|
+
} else {
|
|
1345
|
+
blocks.push({ type: "paragraph", text: capText, pageNumber: ctx.sectionNum });
|
|
1346
|
+
}
|
|
1343
1347
|
}
|
|
1344
1348
|
break;
|
|
1349
|
+
}
|
|
1345
1350
|
case "tr":
|
|
1346
1351
|
if (tableCtx) {
|
|
1347
1352
|
tableCtx.currentRow = [];
|
|
@@ -1375,8 +1380,8 @@ function walkSection(node, blocks, tableCtx, tableStack, ctx, depth = 0) {
|
|
|
1375
1380
|
const cs = isNaN(rawCs) ? 1 : rawCs;
|
|
1376
1381
|
const rawRs = parseInt(el.getAttribute("rowSpan") || "1", 10);
|
|
1377
1382
|
const rs = isNaN(rawRs) ? 1 : rawRs;
|
|
1378
|
-
tableCtx.cell.colSpan = clampSpan(cs,
|
|
1379
|
-
tableCtx.cell.rowSpan = clampSpan(rs,
|
|
1383
|
+
tableCtx.cell.colSpan = clampSpan(cs, _chunkOVESZY5Rcjs.MAX_COLS);
|
|
1384
|
+
tableCtx.cell.rowSpan = clampSpan(rs, _chunkOVESZY5Rcjs.MAX_ROWS);
|
|
1380
1385
|
}
|
|
1381
1386
|
break;
|
|
1382
1387
|
case "p": {
|
|
@@ -1506,7 +1511,7 @@ function walkParagraphChildren(node, blocks, tableCtx, tableStack, ctx, depth =
|
|
|
1506
1511
|
if (depth > MAX_XML_DEPTH) return tableCtx;
|
|
1507
1512
|
const children = node.childNodes;
|
|
1508
1513
|
if (!children) return tableCtx;
|
|
1509
|
-
const walkChildren = (parent, d) => {
|
|
1514
|
+
const walkChildren = (parent, d, inShape = false) => {
|
|
1510
1515
|
if (d > MAX_XML_DEPTH) return;
|
|
1511
1516
|
const kids2 = parent.childNodes;
|
|
1512
1517
|
if (!kids2) return;
|
|
@@ -1520,8 +1525,15 @@ function walkParagraphChildren(node, blocks, tableCtx, tableStack, ctx, depth =
|
|
|
1520
1525
|
const newTable = { rows: [], currentRow: [], cell: null };
|
|
1521
1526
|
walkSection(el, blocks, newTable, tableStack, ctx, d + 1);
|
|
1522
1527
|
tableCtx = completeTable(newTable, tableStack, blocks, ctx);
|
|
1528
|
+
} else if (localTag === "caption" && !inShape) {
|
|
1529
|
+
const capText = collectSubListText(el, ctx);
|
|
1530
|
+
if (capText) {
|
|
1531
|
+
if (_optionalChain([tableCtx, 'optionalAccess', _25 => _25.cell])) mergeBlocksIntoCell(tableCtx.cell, [{ type: "paragraph", text: capText, pageNumber: ctx.sectionNum }]);
|
|
1532
|
+
else if (tableCtx) tableCtx.caption = (tableCtx.caption ? tableCtx.caption + "\n" : "") + capText;
|
|
1533
|
+
else blocks.push({ type: "paragraph", text: capText, pageNumber: ctx.sectionNum });
|
|
1534
|
+
}
|
|
1523
1535
|
} else if (localTag === "pic" || localTag === "shape" || localTag === "drawingObject") {
|
|
1524
|
-
if (_optionalChain([tableCtx, 'optionalAccess',
|
|
1536
|
+
if (_optionalChain([tableCtx, 'optionalAccess', _26 => _26.cell])) {
|
|
1525
1537
|
const sink = [];
|
|
1526
1538
|
handleShape(el, sink, ctx);
|
|
1527
1539
|
mergeBlocksIntoCell(tableCtx.cell, sink);
|
|
@@ -1529,15 +1541,17 @@ function walkParagraphChildren(node, blocks, tableCtx, tableStack, ctx, depth =
|
|
|
1529
1541
|
handleShape(el, blocks, ctx);
|
|
1530
1542
|
}
|
|
1531
1543
|
} else if (localTag === "drawText") {
|
|
1532
|
-
if (_optionalChain([tableCtx, 'optionalAccess',
|
|
1544
|
+
if (_optionalChain([tableCtx, 'optionalAccess', _27 => _27.cell])) {
|
|
1533
1545
|
const sink = [];
|
|
1534
1546
|
extractDrawTextBlocks(el, sink, ctx);
|
|
1535
1547
|
mergeBlocksIntoCell(tableCtx.cell, sink);
|
|
1536
1548
|
} else {
|
|
1537
1549
|
extractDrawTextBlocks(el, blocks, ctx);
|
|
1538
1550
|
}
|
|
1539
|
-
} else if (localTag === "r" || localTag === "run" || localTag === "ctrl"
|
|
1540
|
-
walkChildren(el, d + 1);
|
|
1551
|
+
} else if (localTag === "r" || localTag === "run" || localTag === "ctrl") {
|
|
1552
|
+
walkChildren(el, d + 1, inShape);
|
|
1553
|
+
} else if (localTag === "rect" || localTag === "ellipse" || localTag === "polygon" || localTag === "line" || localTag === "arc" || localTag === "curve" || localTag === "connectLine" || localTag === "container") {
|
|
1554
|
+
walkChildren(el, d + 1, true);
|
|
1541
1555
|
}
|
|
1542
1556
|
}
|
|
1543
1557
|
};
|
|
@@ -1573,7 +1587,7 @@ function extractDrawTextBlocks(drawTextNode, blocks, ctx) {
|
|
|
1573
1587
|
let text = info.text.trim();
|
|
1574
1588
|
if (text) {
|
|
1575
1589
|
const ph = resolveParaHeading(child, ctx);
|
|
1576
|
-
if (_optionalChain([ph, 'optionalAccess',
|
|
1590
|
+
if (_optionalChain([ph, 'optionalAccess', _28 => _28.prefix])) text = ph.prefix + " " + text;
|
|
1577
1591
|
const block = { type: "paragraph", text, style: _nullishCoalesce(info.style, () => ( void 0)), pageNumber: ctx.sectionNum };
|
|
1578
1592
|
if (info.href) block.href = info.href;
|
|
1579
1593
|
if (info.footnote) block.footnoteText = info.footnote;
|
|
@@ -1598,13 +1612,13 @@ function extractHyperlinkHref(fieldBegin) {
|
|
|
1598
1612
|
let url = (ch.textContent || "").trim();
|
|
1599
1613
|
if (!url) continue;
|
|
1600
1614
|
url = url.replace(/^https?:\/\/(?=https?:\/\/)/i, "");
|
|
1601
|
-
const safe =
|
|
1615
|
+
const safe = _chunkOVESZY5Rcjs.sanitizeHref.call(void 0, url);
|
|
1602
1616
|
if (safe) return safe;
|
|
1603
1617
|
}
|
|
1604
1618
|
return void 0;
|
|
1605
1619
|
}
|
|
1606
1620
|
function isInDeletedRange(ctx) {
|
|
1607
|
-
return (_nullishCoalesce(_optionalChain([ctx, 'optionalAccess',
|
|
1621
|
+
return (_nullishCoalesce(_optionalChain([ctx, 'optionalAccess', _29 => _29.shared, 'access', _30 => _30.track, 'access', _31 => _31.deleteDepth]), () => ( 0))) > 0;
|
|
1608
1622
|
}
|
|
1609
1623
|
function extractParagraphInfo(para2, styleMap, ctx) {
|
|
1610
1624
|
let text = "";
|
|
@@ -1658,7 +1672,7 @@ function extractParagraphInfo(para2, styleMap, ctx) {
|
|
|
1658
1672
|
// 삽입분은 최종본에 포함
|
|
1659
1673
|
// 숨은 설명 — 본문 혼입 차단
|
|
1660
1674
|
case "hiddenComment": {
|
|
1661
|
-
if (_optionalChain([ctx, 'optionalAccess',
|
|
1675
|
+
if (_optionalChain([ctx, 'optionalAccess', _32 => _32.warnings]) && extractTextFromNode(k)) {
|
|
1662
1676
|
ctx.warnings.push({ page: ctx.sectionNum, message: "\uC228\uC740 \uC124\uBA85 \uD14D\uC2A4\uD2B8 \uC81C\uC678: hiddenComment", code: "HIDDEN_TEXT_FILTERED" });
|
|
1663
1677
|
}
|
|
1664
1678
|
break;
|
|
@@ -1673,9 +1687,12 @@ function extractParagraphInfo(para2, styleMap, ctx) {
|
|
|
1673
1687
|
case "indexmark":
|
|
1674
1688
|
case "colPr":
|
|
1675
1689
|
break;
|
|
1690
|
+
// 캡션 — walkParagraphChildren의 caption 분기가 보존하므로 손실 경고 대상 아님
|
|
1691
|
+
case "caption":
|
|
1692
|
+
break;
|
|
1676
1693
|
// 미지원 요소 — 텍스트를 가졌으면 무음 손실 대신 경고
|
|
1677
1694
|
default: {
|
|
1678
|
-
if (_optionalChain([ctx, 'optionalAccess',
|
|
1695
|
+
if (_optionalChain([ctx, 'optionalAccess', _33 => _33.warnings]) && extractTextFromNode(k)) {
|
|
1679
1696
|
ctx.warnings.push({ page: ctx.sectionNum, message: `\uBBF8\uC9C0\uC6D0 \uC81C\uC5B4 \uC694\uC18C\uC758 \uD14D\uC2A4\uD2B8 \uC190\uC2E4: ${ktag}`, code: "UNSUPPORTED_ELEMENT" });
|
|
1680
1697
|
}
|
|
1681
1698
|
}
|
|
@@ -1692,7 +1709,7 @@ function extractParagraphInfo(para2, styleMap, ctx) {
|
|
|
1692
1709
|
if (isInDeletedRange(ctx)) {
|
|
1693
1710
|
if (t && ctx && !ctx.shared.track.warned) {
|
|
1694
1711
|
ctx.shared.track.warned = true;
|
|
1695
|
-
_optionalChain([ctx, 'access',
|
|
1712
|
+
_optionalChain([ctx, 'access', _34 => _34.warnings, 'optionalAccess', _35 => _35.push, 'call', _36 => _36({ page: ctx.sectionNum, message: "\uBCC0\uACBD\uCD94\uC801 \uC0AD\uC81C \uD14D\uC2A4\uD2B8 \uCD9C\uB825 \uC81C\uC678", code: "HIDDEN_TEXT_FILTERED" })]);
|
|
1696
1713
|
}
|
|
1697
1714
|
} else {
|
|
1698
1715
|
text += t;
|
|
@@ -1733,7 +1750,7 @@ function extractParagraphInfo(para2, styleMap, ctx) {
|
|
|
1733
1750
|
case "hyperlink": {
|
|
1734
1751
|
const url = child.getAttribute("url") || child.getAttribute("href") || "";
|
|
1735
1752
|
if (url) {
|
|
1736
|
-
const safe =
|
|
1753
|
+
const safe = _chunkOVESZY5Rcjs.sanitizeHref.call(void 0, url);
|
|
1737
1754
|
if (safe) href = safe;
|
|
1738
1755
|
}
|
|
1739
1756
|
walk(child);
|
|
@@ -1882,7 +1899,7 @@ function collectImageBlocks(blocks, out, ownerCell, depth = 0) {
|
|
|
1882
1899
|
} else if (block.type === "table" && block.table) {
|
|
1883
1900
|
for (const row of block.table.cells) {
|
|
1884
1901
|
for (const cell2 of row) {
|
|
1885
|
-
if (_optionalChain([cell2, 'access',
|
|
1902
|
+
if (_optionalChain([cell2, 'access', _37 => _37.blocks, 'optionalAccess', _38 => _38.length])) collectImageBlocks(cell2.blocks, out, cell2, depth + 1);
|
|
1886
1903
|
}
|
|
1887
1904
|
}
|
|
1888
1905
|
}
|
|
@@ -1919,13 +1936,13 @@ async function extractImagesFromZip(zip, blocks, decompressed, warnings) {
|
|
|
1919
1936
|
}
|
|
1920
1937
|
const allCandidates = resolvedPath ? [resolvedPath, ...candidates] : candidates;
|
|
1921
1938
|
for (const path of allCandidates) {
|
|
1922
|
-
if (
|
|
1939
|
+
if (_chunkOVESZY5Rcjs.isPathTraversal.call(void 0, path)) continue;
|
|
1923
1940
|
const file = zip.file(path);
|
|
1924
1941
|
if (!file) continue;
|
|
1925
1942
|
try {
|
|
1926
1943
|
const data = await file.async("uint8array");
|
|
1927
1944
|
decompressed.total += data.length;
|
|
1928
|
-
if (decompressed.total > MAX_DECOMPRESS_SIZE) throw new (0,
|
|
1945
|
+
if (decompressed.total > MAX_DECOMPRESS_SIZE) throw new (0, _chunkOVESZY5Rcjs.KordocError)("ZIP \uC555\uCD95 \uD574\uC81C \uD06C\uAE30 \uCD08\uACFC (ZIP bomb \uC758\uC2EC)");
|
|
1929
1946
|
const ext = path.includes(".") ? path.split(".").pop() || "png" : "png";
|
|
1930
1947
|
const mimeType = imageExtToMime(ext);
|
|
1931
1948
|
imageIndex++;
|
|
@@ -1934,10 +1951,10 @@ async function extractImagesFromZip(zip, blocks, decompressed, warnings) {
|
|
|
1934
1951
|
images.push(img);
|
|
1935
1952
|
break;
|
|
1936
1953
|
} catch (err) {
|
|
1937
|
-
if (err instanceof
|
|
1954
|
+
if (err instanceof _chunkOVESZY5Rcjs.KordocError) throw err;
|
|
1938
1955
|
}
|
|
1939
1956
|
}
|
|
1940
|
-
if (!img) _optionalChain([warnings, 'optionalAccess',
|
|
1957
|
+
if (!img) _optionalChain([warnings, 'optionalAccess', _39 => _39.push, 'call', _40 => _40({ page: block.pageNumber, message: `\uC774\uBBF8\uC9C0 \uD30C\uC77C \uC5C6\uC74C: ${ref}`, code: "SKIPPED_IMAGE" })]);
|
|
1941
1958
|
resolved.set(ref, img);
|
|
1942
1959
|
}
|
|
1943
1960
|
if (!img) {
|
|
@@ -1996,7 +2013,7 @@ function extractFromBrokenZip(buffer) {
|
|
|
1996
2013
|
}
|
|
1997
2014
|
const nameBytes = data.slice(pos + 30, pos + 30 + nameLen);
|
|
1998
2015
|
const name = new TextDecoder().decode(nameBytes);
|
|
1999
|
-
if (
|
|
2016
|
+
if (_chunkOVESZY5Rcjs.isPathTraversal.call(void 0, name)) {
|
|
2000
2017
|
pos = fileStart + compSize;
|
|
2001
2018
|
continue;
|
|
2002
2019
|
}
|
|
@@ -2014,16 +2031,16 @@ function extractFromBrokenZip(buffer) {
|
|
|
2014
2031
|
continue;
|
|
2015
2032
|
}
|
|
2016
2033
|
totalDecompressed += content.length * 2;
|
|
2017
|
-
if (totalDecompressed > MAX_DECOMPRESS_SIZE) throw new (0,
|
|
2034
|
+
if (totalDecompressed > MAX_DECOMPRESS_SIZE) throw new (0, _chunkOVESZY5Rcjs.KordocError)("\uC555\uCD95 \uD574\uC81C \uD06C\uAE30 \uCD08\uACFC");
|
|
2018
2035
|
sectionNum++;
|
|
2019
2036
|
blocks.push(...parseSectionXml(content, void 0, warnings, sectionNum, shared));
|
|
2020
2037
|
} catch (e13) {
|
|
2021
2038
|
continue;
|
|
2022
2039
|
}
|
|
2023
2040
|
}
|
|
2024
|
-
if (blocks.length === 0) throw new (0,
|
|
2041
|
+
if (blocks.length === 0) throw new (0, _chunkOVESZY5Rcjs.KordocError)("\uC190\uC0C1\uB41C HWPX\uC5D0\uC11C \uC139\uC158 \uB370\uC774\uD130\uB97C \uBCF5\uAD6C\uD560 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4");
|
|
2025
2042
|
applyPageText(blocks, shared);
|
|
2026
|
-
const markdown =
|
|
2043
|
+
const markdown = _chunkOVESZY5Rcjs.blocksToMarkdown.call(void 0, blocks);
|
|
2027
2044
|
return { markdown, blocks, warnings: warnings.length > 0 ? warnings : void 0 };
|
|
2028
2045
|
}
|
|
2029
2046
|
async function resolveSectionPaths(zip) {
|
|
@@ -2037,18 +2054,18 @@ async function resolveSectionPaths(zip) {
|
|
|
2037
2054
|
if (paths.length > 0) return paths;
|
|
2038
2055
|
}
|
|
2039
2056
|
const sectionFiles = zip.file(/[Ss]ection\d+\.xml$/);
|
|
2040
|
-
return sectionFiles.map((f) => f.name).sort(
|
|
2057
|
+
return sectionFiles.map((f) => f.name).sort(_chunkOVESZY5Rcjs.compareSectionPaths);
|
|
2041
2058
|
}
|
|
2042
2059
|
function parseSectionPathsFromManifest(xml) {
|
|
2043
2060
|
const parser = createXmlParser();
|
|
2044
|
-
const doc = parser.parseFromString(
|
|
2061
|
+
const doc = parser.parseFromString(_chunkOVESZY5Rcjs.stripDtd.call(void 0, xml), "text/xml");
|
|
2045
2062
|
const items = doc.getElementsByTagName("opf:item");
|
|
2046
2063
|
const spine = doc.getElementsByTagName("opf:itemref");
|
|
2047
2064
|
const idToHref = /* @__PURE__ */ new Map();
|
|
2048
2065
|
for (let i = 0; i < items.length; i++) {
|
|
2049
2066
|
const item = items[i];
|
|
2050
2067
|
const id = item.getAttribute("id") || "";
|
|
2051
|
-
const href =
|
|
2068
|
+
const href = _chunkOVESZY5Rcjs.normalizeSectionHref.call(void 0, item.getAttribute("href") || "");
|
|
2052
2069
|
if (id && href) idToHref.set(id, href);
|
|
2053
2070
|
}
|
|
2054
2071
|
if (spine.length > 0) {
|
|
@@ -2059,7 +2076,7 @@ function parseSectionPathsFromManifest(xml) {
|
|
|
2059
2076
|
}
|
|
2060
2077
|
if (ordered.length > 0) return ordered;
|
|
2061
2078
|
}
|
|
2062
|
-
return Array.from(idToHref.values()).sort(
|
|
2079
|
+
return Array.from(idToHref.values()).sort(_chunkOVESZY5Rcjs.compareSectionPaths);
|
|
2063
2080
|
}
|
|
2064
2081
|
|
|
2065
2082
|
// src/hwpx/metadata.ts
|
|
@@ -2072,7 +2089,7 @@ async function extractHwpxMetadata(zip, metadata, decompressed) {
|
|
|
2072
2089
|
const xml = await file.async("text");
|
|
2073
2090
|
if (decompressed) {
|
|
2074
2091
|
decompressed.total += xml.length * 2;
|
|
2075
|
-
if (decompressed.total > MAX_DECOMPRESS_SIZE) throw new (0,
|
|
2092
|
+
if (decompressed.total > MAX_DECOMPRESS_SIZE) throw new (0, _chunkOVESZY5Rcjs.KordocError)("ZIP \uC555\uCD95 \uD574\uC81C \uD06C\uAE30 \uCD08\uACFC (ZIP bomb \uC758\uC2EC)");
|
|
2076
2093
|
}
|
|
2077
2094
|
parseDublinCoreMetadata(xml, metadata);
|
|
2078
2095
|
if (metadata.title || metadata.author) return;
|
|
@@ -2082,13 +2099,13 @@ async function extractHwpxMetadata(zip, metadata, decompressed) {
|
|
|
2082
2099
|
}
|
|
2083
2100
|
function parseDublinCoreMetadata(xml, metadata) {
|
|
2084
2101
|
const parser = createXmlParser();
|
|
2085
|
-
const doc = parser.parseFromString(
|
|
2102
|
+
const doc = parser.parseFromString(_chunkOVESZY5Rcjs.stripDtd.call(void 0, xml), "text/xml");
|
|
2086
2103
|
if (!doc.documentElement) return;
|
|
2087
2104
|
const getText = (tagNames) => {
|
|
2088
2105
|
for (const tag of tagNames) {
|
|
2089
2106
|
const els = doc.getElementsByTagName(tag);
|
|
2090
2107
|
if (els.length > 0) {
|
|
2091
|
-
const text = _optionalChain([els, 'access',
|
|
2108
|
+
const text = _optionalChain([els, 'access', _41 => _41[0], 'access', _42 => _42.textContent, 'optionalAccess', _43 => _43.trim, 'call', _44 => _44()]);
|
|
2092
2109
|
if (text) return text;
|
|
2093
2110
|
}
|
|
2094
2111
|
}
|
|
@@ -2107,7 +2124,7 @@ function parseDublinCoreMetadata(xml, metadata) {
|
|
|
2107
2124
|
|
|
2108
2125
|
// src/hwpx/parser.ts
|
|
2109
2126
|
async function parseHwpxDocument(buffer, options) {
|
|
2110
|
-
|
|
2127
|
+
_chunkOVESZY5Rcjs.precheckZipSize.call(void 0, buffer, MAX_DECOMPRESS_SIZE, MAX_ZIP_ENTRIES);
|
|
2111
2128
|
let zip;
|
|
2112
2129
|
try {
|
|
2113
2130
|
zip = await _jszip2.default.loadAsync(buffer);
|
|
@@ -2116,19 +2133,19 @@ async function parseHwpxDocument(buffer, options) {
|
|
|
2116
2133
|
}
|
|
2117
2134
|
const actualEntryCount = Object.keys(zip.files).length;
|
|
2118
2135
|
if (actualEntryCount > MAX_ZIP_ENTRIES) {
|
|
2119
|
-
throw new (0,
|
|
2136
|
+
throw new (0, _chunkOVESZY5Rcjs.KordocError)("ZIP \uC5D4\uD2B8\uB9AC \uC218 \uCD08\uACFC (ZIP bomb \uC758\uC2EC)");
|
|
2120
2137
|
}
|
|
2121
2138
|
const manifestFile = zip.file("META-INF/manifest.xml");
|
|
2122
2139
|
if (manifestFile) {
|
|
2123
2140
|
const manifestXml = await manifestFile.async("text");
|
|
2124
2141
|
if (isEncryptedHwpx(manifestXml)) {
|
|
2125
|
-
if (isComFallbackAvailable() && _optionalChain([options, 'optionalAccess',
|
|
2142
|
+
if (isComFallbackAvailable() && _optionalChain([options, 'optionalAccess', _45 => _45.filePath])) {
|
|
2126
2143
|
const { pages, pageCount, warnings: warnings2 } = extractTextViaCom(options.filePath);
|
|
2127
2144
|
if (pages.some((p) => p && p.trim().length > 0)) {
|
|
2128
2145
|
return comResultToParseResult(pages, pageCount, warnings2);
|
|
2129
2146
|
}
|
|
2130
2147
|
}
|
|
2131
|
-
throw new (0,
|
|
2148
|
+
throw new (0, _chunkOVESZY5Rcjs.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.");
|
|
2132
2149
|
}
|
|
2133
2150
|
}
|
|
2134
2151
|
const decompressed = { total: 0 };
|
|
@@ -2137,9 +2154,9 @@ async function parseHwpxDocument(buffer, options) {
|
|
|
2137
2154
|
const styleMap = await extractHwpxStyles(zip, decompressed);
|
|
2138
2155
|
const warnings = [];
|
|
2139
2156
|
const sectionPaths = await resolveSectionPaths(zip);
|
|
2140
|
-
if (sectionPaths.length === 0) throw new (0,
|
|
2157
|
+
if (sectionPaths.length === 0) throw new (0, _chunkOVESZY5Rcjs.KordocError)("HWPX\uC5D0\uC11C \uC139\uC158 \uD30C\uC77C\uC744 \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4");
|
|
2141
2158
|
metadata.pageCount = sectionPaths.length;
|
|
2142
|
-
const pageFilter = _optionalChain([options, 'optionalAccess',
|
|
2159
|
+
const pageFilter = _optionalChain([options, 'optionalAccess', _46 => _46.pages]) ? _chunkDCZVOIEOcjs.parsePageRange.call(void 0, options.pages, sectionPaths.length) : null;
|
|
2143
2160
|
const totalTarget = pageFilter ? pageFilter.size : sectionPaths.length;
|
|
2144
2161
|
const blocks = [];
|
|
2145
2162
|
const shared = createSectionShared();
|
|
@@ -2151,12 +2168,12 @@ async function parseHwpxDocument(buffer, options) {
|
|
|
2151
2168
|
try {
|
|
2152
2169
|
const xml = await file.async("text");
|
|
2153
2170
|
decompressed.total += xml.length * 2;
|
|
2154
|
-
if (decompressed.total > MAX_DECOMPRESS_SIZE) throw new (0,
|
|
2171
|
+
if (decompressed.total > MAX_DECOMPRESS_SIZE) throw new (0, _chunkOVESZY5Rcjs.KordocError)("ZIP \uC555\uCD95 \uD574\uC81C \uD06C\uAE30 \uCD08\uACFC (ZIP bomb \uC758\uC2EC)");
|
|
2155
2172
|
blocks.push(...parseSectionXml(xml, styleMap, warnings, si + 1, shared));
|
|
2156
2173
|
parsedSections++;
|
|
2157
|
-
_optionalChain([options, 'optionalAccess',
|
|
2174
|
+
_optionalChain([options, 'optionalAccess', _47 => _47.onProgress, 'optionalCall', _48 => _48(parsedSections, totalTarget)]);
|
|
2158
2175
|
} catch (secErr) {
|
|
2159
|
-
if (secErr instanceof
|
|
2176
|
+
if (secErr instanceof _chunkOVESZY5Rcjs.KordocError) throw secErr;
|
|
2160
2177
|
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" });
|
|
2161
2178
|
}
|
|
2162
2179
|
}
|
|
@@ -2164,7 +2181,7 @@ async function parseHwpxDocument(buffer, options) {
|
|
|
2164
2181
|
const images = await extractImagesFromZip(zip, blocks, decompressed, warnings);
|
|
2165
2182
|
detectHwpxHeadings(blocks, styleMap);
|
|
2166
2183
|
const outline = blocks.filter((b) => b.type === "heading" && b.level && b.text).map((b) => ({ level: b.level, text: b.text, pageNumber: b.pageNumber }));
|
|
2167
|
-
const markdown =
|
|
2184
|
+
const markdown = _chunkOVESZY5Rcjs.blocksToMarkdown.call(void 0, blocks);
|
|
2168
2185
|
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 };
|
|
2169
2186
|
}
|
|
2170
2187
|
|
|
@@ -2231,7 +2248,7 @@ function decompressStream(data) {
|
|
|
2231
2248
|
return _zlib.inflateRawSync.call(void 0, data, opts);
|
|
2232
2249
|
}
|
|
2233
2250
|
function parseFileHeader(data) {
|
|
2234
|
-
if (data.length < 40) throw new (0,
|
|
2251
|
+
if (data.length < 40) throw new (0, _chunkOVESZY5Rcjs.KordocError)("FileHeader\uAC00 \uB108\uBB34 \uC9E7\uC2B5\uB2C8\uB2E4 (\uCD5C\uC18C 40\uBC14\uC774\uD2B8)");
|
|
2235
2252
|
const sig = data.subarray(0, 32).toString("utf8").replace(/\0+$/, "");
|
|
2236
2253
|
return {
|
|
2237
2254
|
signature: sig,
|
|
@@ -2364,7 +2381,7 @@ function appendParaText(state, data, resolveControl) {
|
|
|
2364
2381
|
const resolveAt = (byteOffset, extended) => {
|
|
2365
2382
|
const ctrlId = data.readUInt32LE(byteOffset);
|
|
2366
2383
|
const idx = extended ? state.ctrlIdx : -1;
|
|
2367
|
-
const replacement = _optionalChain([resolveControl, 'optionalCall',
|
|
2384
|
+
const replacement = _optionalChain([resolveControl, 'optionalCall', _49 => _49(idx, ctrlId)]);
|
|
2368
2385
|
if (replacement) result += replacement;
|
|
2369
2386
|
if (extended) state.ctrlIdx++;
|
|
2370
2387
|
};
|
|
@@ -2735,7 +2752,7 @@ function extractHwp5Images(fileIndex, blocks, warnings) {
|
|
|
2735
2752
|
const binDataMap = /* @__PURE__ */ new Map();
|
|
2736
2753
|
if (fileIndex) {
|
|
2737
2754
|
for (const entry of fileIndex) {
|
|
2738
|
-
if (!_optionalChain([entry, 'optionalAccess',
|
|
2755
|
+
if (!_optionalChain([entry, 'optionalAccess', _50 => _50.name]) || !entry.content) continue;
|
|
2739
2756
|
const match = entry.name.match(BIN_ENTRY_RE);
|
|
2740
2757
|
if (!match) continue;
|
|
2741
2758
|
const idx = parseInt(match[1], 16);
|
|
@@ -2881,7 +2898,7 @@ function escapeRegExp(s) {
|
|
|
2881
2898
|
return s.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
2882
2899
|
}
|
|
2883
2900
|
function inlineImagesIntoMarkdown(markdown, images, opts) {
|
|
2884
|
-
const compress = _optionalChain([opts, 'optionalAccess',
|
|
2901
|
+
const compress = _optionalChain([opts, 'optionalAccess', _51 => _51.compress]) !== false;
|
|
2885
2902
|
let out = markdown;
|
|
2886
2903
|
for (const img of images) {
|
|
2887
2904
|
let bytes = img.data;
|
|
@@ -3901,22 +3918,22 @@ function parseHwp5Document(buffer, options) {
|
|
|
3901
3918
|
lenientCfb = parseLenientCfb(buffer);
|
|
3902
3919
|
warnings.push({ message: "\uC190\uC0C1\uB41C CFB \uCEE8\uD14C\uC774\uB108 \u2014 lenient \uBAA8\uB4DC\uB85C \uBCF5\uAD6C", code: "LENIENT_CFB_RECOVERY" });
|
|
3903
3920
|
} catch (e21) {
|
|
3904
|
-
throw new (0,
|
|
3921
|
+
throw new (0, _chunkOVESZY5Rcjs.KordocError)("CFB \uCEE8\uD14C\uC774\uB108 \uD30C\uC2F1 \uC2E4\uD328 (strict \uBC0F lenient \uBAA8\uB450)");
|
|
3905
3922
|
}
|
|
3906
3923
|
}
|
|
3907
3924
|
const findStream = (path) => {
|
|
3908
3925
|
if (cfb) {
|
|
3909
3926
|
const entry = CFB.find(cfb, path);
|
|
3910
|
-
return _optionalChain([entry, 'optionalAccess',
|
|
3927
|
+
return _optionalChain([entry, 'optionalAccess', _52 => _52.content]) ? Buffer.from(entry.content) : null;
|
|
3911
3928
|
}
|
|
3912
3929
|
return lenientCfb.findStream(path);
|
|
3913
3930
|
};
|
|
3914
3931
|
const headerData = findStream("/FileHeader");
|
|
3915
|
-
if (!headerData) throw new (0,
|
|
3932
|
+
if (!headerData) throw new (0, _chunkOVESZY5Rcjs.KordocError)("FileHeader \uC2A4\uD2B8\uB9BC \uC5C6\uC74C");
|
|
3916
3933
|
const header = parseFileHeader(headerData);
|
|
3917
|
-
if (header.signature !== "HWP Document File") throw new (0,
|
|
3918
|
-
if (header.flags & FLAG_ENCRYPTED) throw new (0,
|
|
3919
|
-
if (header.flags & FLAG_DRM) throw new (0,
|
|
3934
|
+
if (header.signature !== "HWP Document File") throw new (0, _chunkOVESZY5Rcjs.KordocError)("HWP \uC2DC\uADF8\uB2C8\uCC98 \uBD88\uC77C\uCE58");
|
|
3935
|
+
if (header.flags & FLAG_ENCRYPTED) throw new (0, _chunkOVESZY5Rcjs.KordocError)("\uC554\uD638\uD654\uB41C HWP\uB294 \uC9C0\uC6D0\uD558\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4");
|
|
3936
|
+
if (header.flags & FLAG_DRM) throw new (0, _chunkOVESZY5Rcjs.KordocError)("DRM \uBCF4\uD638\uB41C HWP\uB294 \uC9C0\uC6D0\uD558\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4");
|
|
3920
3937
|
const compressed = (header.flags & FLAG_COMPRESSED) !== 0;
|
|
3921
3938
|
const distribution = (header.flags & FLAG_DISTRIBUTION) !== 0;
|
|
3922
3939
|
const metadata = {
|
|
@@ -3925,9 +3942,9 @@ function parseHwp5Document(buffer, options) {
|
|
|
3925
3942
|
if (cfb) extractHwp5Metadata(cfb, metadata);
|
|
3926
3943
|
const docInfo = cfb ? parseDocInfoStream(cfb, compressed) : parseDocInfoFromStream(findStream("/DocInfo"), compressed);
|
|
3927
3944
|
const sections = distribution ? cfb ? findViewTextSections(cfb, compressed) : findViewTextSectionsLenient(lenientCfb, compressed) : cfb ? findSections(cfb) : findSectionsLenient(lenientCfb, compressed);
|
|
3928
|
-
if (sections.length === 0) throw new (0,
|
|
3945
|
+
if (sections.length === 0) throw new (0, _chunkOVESZY5Rcjs.KordocError)("\uC139\uC158 \uC2A4\uD2B8\uB9BC\uC744 \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4");
|
|
3929
3946
|
metadata.pageCount = sections.length;
|
|
3930
|
-
const pageFilter = _optionalChain([options, 'optionalAccess',
|
|
3947
|
+
const pageFilter = _optionalChain([options, 'optionalAccess', _53 => _53.pages]) ? _chunkDCZVOIEOcjs.parsePageRange.call(void 0, options.pages, sections.length) : null;
|
|
3931
3948
|
const totalTarget = pageFilter ? pageFilter.size : sections.length;
|
|
3932
3949
|
const bodyBlocks = [];
|
|
3933
3950
|
const doc = createHwp5DocState();
|
|
@@ -3939,22 +3956,22 @@ function parseHwp5Document(buffer, options) {
|
|
|
3939
3956
|
const sectionData = sections[si];
|
|
3940
3957
|
const data = !distribution && compressed ? decompressStream(Buffer.from(sectionData)) : Buffer.from(sectionData);
|
|
3941
3958
|
totalDecompressed += data.length;
|
|
3942
|
-
if (totalDecompressed > MAX_TOTAL_DECOMPRESS) throw new (0,
|
|
3959
|
+
if (totalDecompressed > MAX_TOTAL_DECOMPRESS) throw new (0, _chunkOVESZY5Rcjs.KordocError)("\uCD1D \uC555\uCD95 \uD574\uC81C \uD06C\uAE30 \uCD08\uACFC (decompression bomb \uC758\uC2EC)");
|
|
3943
3960
|
const records = readRecords(data);
|
|
3944
3961
|
const sectionBlocks = parseSection(records, docInfo, warnings, si + 1, doc);
|
|
3945
3962
|
bodyBlocks.push(...sectionBlocks);
|
|
3946
3963
|
parsedSections++;
|
|
3947
|
-
_optionalChain([options, 'optionalAccess',
|
|
3964
|
+
_optionalChain([options, 'optionalAccess', _54 => _54.onProgress, 'optionalCall', _55 => _55(parsedSections, totalTarget)]);
|
|
3948
3965
|
} catch (secErr) {
|
|
3949
|
-
if (secErr instanceof
|
|
3966
|
+
if (secErr instanceof _chunkOVESZY5Rcjs.KordocError) throw secErr;
|
|
3950
3967
|
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" });
|
|
3951
3968
|
}
|
|
3952
3969
|
}
|
|
3953
3970
|
const blocks = [...doc.headerBlocks, ...bodyBlocks, ...doc.footerBlocks];
|
|
3954
3971
|
const images = cfb ? extractHwp5Images(cfb.FileIndex, blocks, warnings) : extractHwp5ImagesLenient(lenientCfb, blocks, warnings);
|
|
3955
|
-
let flatBlocks =
|
|
3956
|
-
if (_optionalChain([options, 'optionalAccess',
|
|
3957
|
-
const deduped =
|
|
3972
|
+
let flatBlocks = _chunkOVESZY5Rcjs.flattenLayoutTables.call(void 0, blocks);
|
|
3973
|
+
if (_optionalChain([options, 'optionalAccess', _56 => _56.dedupeRunningHeaders])) {
|
|
3974
|
+
const deduped = _chunkOVESZY5Rcjs.dedupeRunningHeaders.call(void 0, flatBlocks);
|
|
3958
3975
|
const removed = flatBlocks.length - deduped.length;
|
|
3959
3976
|
if (removed > 0) warnings.push({ message: `\uBC18\uBCF5 \uB7EC\uB2DD \uD5E4\uB354 ${removed}\uAC1C \uC81C\uAC70`, code: "HIDDEN_TEXT_FILTERED" });
|
|
3960
3977
|
flatBlocks = deduped;
|
|
@@ -3963,8 +3980,8 @@ function parseHwp5Document(buffer, options) {
|
|
|
3963
3980
|
detectHwp5Headings(flatBlocks, docInfo);
|
|
3964
3981
|
}
|
|
3965
3982
|
const outline = flatBlocks.filter((b) => b.type === "heading" && b.level && b.text).map((b) => ({ level: b.level, text: b.text, pageNumber: b.pageNumber }));
|
|
3966
|
-
let markdown =
|
|
3967
|
-
if (_optionalChain([options, 'optionalAccess',
|
|
3983
|
+
let markdown = _chunkOVESZY5Rcjs.blocksToMarkdown.call(void 0, flatBlocks);
|
|
3984
|
+
if (_optionalChain([options, 'optionalAccess', _57 => _57.inlineImages]) && images.length > 0) {
|
|
3968
3985
|
try {
|
|
3969
3986
|
markdown = inlineImagesIntoMarkdown(markdown, images, { compress: true });
|
|
3970
3987
|
} catch (inlineErr) {
|
|
@@ -3976,7 +3993,7 @@ function parseHwp5Document(buffer, options) {
|
|
|
3976
3993
|
function parseDocInfoStream(cfb, compressed) {
|
|
3977
3994
|
try {
|
|
3978
3995
|
const entry = CFB.find(cfb, "/DocInfo");
|
|
3979
|
-
if (!_optionalChain([entry, 'optionalAccess',
|
|
3996
|
+
if (!_optionalChain([entry, 'optionalAccess', _58 => _58.content])) return null;
|
|
3980
3997
|
const data = compressed ? decompressStream(Buffer.from(entry.content)) : Buffer.from(entry.content);
|
|
3981
3998
|
const records = readRecords(data);
|
|
3982
3999
|
return parseDocInfo(records);
|
|
@@ -3997,7 +4014,7 @@ function detectHwp5Headings(blocks, docInfo) {
|
|
|
3997
4014
|
let baseFontSize = 0;
|
|
3998
4015
|
const sizeFreq = /* @__PURE__ */ new Map();
|
|
3999
4016
|
for (const b of blocks) {
|
|
4000
|
-
if (_optionalChain([b, 'access',
|
|
4017
|
+
if (_optionalChain([b, 'access', _59 => _59.style, 'optionalAccess', _60 => _60.fontSize]) && b.text) {
|
|
4001
4018
|
sizeFreq.set(b.style.fontSize, (sizeFreq.get(b.style.fontSize) || 0) + b.text.length);
|
|
4002
4019
|
}
|
|
4003
4020
|
}
|
|
@@ -4013,7 +4030,7 @@ function detectHwp5Headings(blocks, docInfo) {
|
|
|
4013
4030
|
const name = (style.nameKo || style.name).toLowerCase();
|
|
4014
4031
|
if (name.includes("\uBC14\uD0D5") || name.includes("\uBCF8\uBB38") || name === "normal" || name === "body") {
|
|
4015
4032
|
const cs = docInfo.charShapes[style.charShapeId];
|
|
4016
|
-
if (_optionalChain([cs, 'optionalAccess',
|
|
4033
|
+
if (_optionalChain([cs, 'optionalAccess', _61 => _61.fontSize]) > 0) {
|
|
4017
4034
|
baseFontSize = cs.fontSize / 10;
|
|
4018
4035
|
break;
|
|
4019
4036
|
}
|
|
@@ -4028,11 +4045,11 @@ function detectHwp5Headings(blocks, docInfo) {
|
|
|
4028
4045
|
if (text.length === 0 || text.length > 200) continue;
|
|
4029
4046
|
if (/^\d+$/.test(text)) continue;
|
|
4030
4047
|
let level = 0;
|
|
4031
|
-
if (_optionalChain([block, 'access',
|
|
4048
|
+
if (_optionalChain([block, 'access', _62 => _62.style, 'optionalAccess', _63 => _63.fontSize]) && baseFontSize > 0) {
|
|
4032
4049
|
const ratio = block.style.fontSize / baseFontSize;
|
|
4033
|
-
if (ratio >=
|
|
4034
|
-
else if (ratio >=
|
|
4035
|
-
else if (ratio >=
|
|
4050
|
+
if (ratio >= _chunkOVESZY5Rcjs.HEADING_RATIO_H1) level = 1;
|
|
4051
|
+
else if (ratio >= _chunkOVESZY5Rcjs.HEADING_RATIO_H2) level = 2;
|
|
4052
|
+
else if (ratio >= _chunkOVESZY5Rcjs.HEADING_RATIO_H3) level = 3;
|
|
4036
4053
|
}
|
|
4037
4054
|
if (/^제\d+[장절편]\s/.test(text) && text.length <= 50) {
|
|
4038
4055
|
if (level === 0) level = 2;
|
|
@@ -4048,7 +4065,7 @@ function detectHwp5Headings(blocks, docInfo) {
|
|
|
4048
4065
|
function extractHwp5Metadata(cfb, metadata) {
|
|
4049
4066
|
try {
|
|
4050
4067
|
const summaryEntry = CFB.find(cfb, "/HwpSummaryInformation") || CFB.find(cfb, "/SummaryInformation");
|
|
4051
|
-
if (!_optionalChain([summaryEntry, 'optionalAccess',
|
|
4068
|
+
if (!_optionalChain([summaryEntry, 'optionalAccess', _64 => _64.content])) return;
|
|
4052
4069
|
const data = Buffer.from(summaryEntry.content);
|
|
4053
4070
|
if (data.length < 48) return;
|
|
4054
4071
|
const numSets = data.readUInt32LE(24);
|
|
@@ -4081,7 +4098,7 @@ function findViewTextSections(cfb, compressed) {
|
|
|
4081
4098
|
const sections = [];
|
|
4082
4099
|
for (let i = 0; i < MAX_SECTIONS; i++) {
|
|
4083
4100
|
const entry = CFB.find(cfb, `/ViewText/Section${i}`);
|
|
4084
|
-
if (!_optionalChain([entry, 'optionalAccess',
|
|
4101
|
+
if (!_optionalChain([entry, 'optionalAccess', _65 => _65.content])) break;
|
|
4085
4102
|
try {
|
|
4086
4103
|
const decrypted = decryptViewText(Buffer.from(entry.content), compressed);
|
|
4087
4104
|
sections.push({ idx: i, content: decrypted });
|
|
@@ -4095,13 +4112,13 @@ function findSections(cfb) {
|
|
|
4095
4112
|
const sections = [];
|
|
4096
4113
|
for (let i = 0; i < MAX_SECTIONS; i++) {
|
|
4097
4114
|
const entry = CFB.find(cfb, `/BodyText/Section${i}`);
|
|
4098
|
-
if (!_optionalChain([entry, 'optionalAccess',
|
|
4115
|
+
if (!_optionalChain([entry, 'optionalAccess', _66 => _66.content])) break;
|
|
4099
4116
|
sections.push({ idx: i, content: Buffer.from(entry.content) });
|
|
4100
4117
|
}
|
|
4101
4118
|
if (sections.length === 0 && cfb.FileIndex) {
|
|
4102
4119
|
for (const entry of cfb.FileIndex) {
|
|
4103
4120
|
if (sections.length >= MAX_SECTIONS) break;
|
|
4104
|
-
if (_optionalChain([entry, 'access',
|
|
4121
|
+
if (_optionalChain([entry, 'access', _67 => _67.name, 'optionalAccess', _68 => _68.startsWith, 'call', _69 => _69("Section")]) && entry.content) {
|
|
4105
4122
|
const idx = parseInt(entry.name.replace("Section", ""), 10) || 0;
|
|
4106
4123
|
sections.push({ idx, content: Buffer.from(entry.content) });
|
|
4107
4124
|
}
|
|
@@ -4117,7 +4134,7 @@ function findSectionsLenient(lcfb, compressed) {
|
|
|
4117
4134
|
if (!raw) break;
|
|
4118
4135
|
const content = compressed ? decompressStream(raw) : raw;
|
|
4119
4136
|
totalDecompressed += content.length;
|
|
4120
|
-
if (totalDecompressed > MAX_TOTAL_DECOMPRESS) throw new (0,
|
|
4137
|
+
if (totalDecompressed > MAX_TOTAL_DECOMPRESS) throw new (0, _chunkOVESZY5Rcjs.KordocError)("\uCD1D \uC555\uCD95 \uD574\uC81C \uD06C\uAE30 \uCD08\uACFC (decompression bomb \uC758\uC2EC)");
|
|
4121
4138
|
sections.push({ idx: i, content });
|
|
4122
4139
|
}
|
|
4123
4140
|
if (sections.length === 0) {
|
|
@@ -4129,7 +4146,7 @@ function findSectionsLenient(lcfb, compressed) {
|
|
|
4129
4146
|
if (raw) {
|
|
4130
4147
|
const content = compressed ? decompressStream(raw) : raw;
|
|
4131
4148
|
totalDecompressed += content.length;
|
|
4132
|
-
if (totalDecompressed > MAX_TOTAL_DECOMPRESS) throw new (0,
|
|
4149
|
+
if (totalDecompressed > MAX_TOTAL_DECOMPRESS) throw new (0, _chunkOVESZY5Rcjs.KordocError)("\uCD1D \uC555\uCD95 \uD574\uC81C \uD06C\uAE30 \uCD08\uACFC (decompression bomb \uC758\uC2EC)");
|
|
4133
4150
|
sections.push({ idx, content });
|
|
4134
4151
|
}
|
|
4135
4152
|
}
|
|
@@ -4146,7 +4163,7 @@ function findViewTextSectionsLenient(lcfb, compressed) {
|
|
|
4146
4163
|
try {
|
|
4147
4164
|
const content = decryptViewText(raw, compressed);
|
|
4148
4165
|
totalDecompressed += content.length;
|
|
4149
|
-
if (totalDecompressed > MAX_TOTAL_DECOMPRESS) throw new (0,
|
|
4166
|
+
if (totalDecompressed > MAX_TOTAL_DECOMPRESS) throw new (0, _chunkOVESZY5Rcjs.KordocError)("\uCD1D \uC555\uCD95 \uD574\uC81C \uD06C\uAE30 \uCD08\uACFC (decompression bomb \uC758\uC2EC)");
|
|
4150
4167
|
sections.push({ idx: i, content });
|
|
4151
4168
|
} catch (e26) {
|
|
4152
4169
|
break;
|
|
@@ -4247,9 +4264,9 @@ function parseParagraph(records, start, end, ctx) {
|
|
|
4247
4264
|
const applied = [];
|
|
4248
4265
|
for (const r of ranges) {
|
|
4249
4266
|
const ctrl = ctrls[r.ctrlIdx];
|
|
4250
|
-
if (!_optionalChain([ctrl, 'optionalAccess',
|
|
4267
|
+
if (!_optionalChain([ctrl, 'optionalAccess', _70 => _70.href]) || r.end <= r.start) continue;
|
|
4251
4268
|
if (applied.some(([s, e]) => r.start < e && r.end > s)) continue;
|
|
4252
|
-
const href =
|
|
4269
|
+
const href = _chunkOVESZY5Rcjs.sanitizeHref.call(void 0, ctrl.href);
|
|
4253
4270
|
if (!href) continue;
|
|
4254
4271
|
const anchor = text.slice(r.start, r.end);
|
|
4255
4272
|
if (!anchor.trim()) continue;
|
|
@@ -4267,7 +4284,7 @@ function parseParagraph(records, start, end, ctx) {
|
|
|
4267
4284
|
}
|
|
4268
4285
|
if (ps.headType === 1 || ps.headType === 2) {
|
|
4269
4286
|
const nid = ps.numberingId || (ps.headType === 1 ? ctx.doc.outlineNumberingId : 0);
|
|
4270
|
-
const numbering = nid >= 1 ? _optionalChain([ctx, 'access',
|
|
4287
|
+
const numbering = nid >= 1 ? _optionalChain([ctx, 'access', _71 => _71.docInfo, 'optionalAccess', _72 => _72.numberings, 'access', _73 => _73[nid - 1]]) : void 0;
|
|
4271
4288
|
if (numbering) {
|
|
4272
4289
|
const counters = ctx.doc.numbering.advance(nid, ps.paraLevel);
|
|
4273
4290
|
const fmt = numbering.levelFormats[Math.min(ps.paraLevel, 6)];
|
|
@@ -4277,7 +4294,7 @@ function parseParagraph(records, start, end, ctx) {
|
|
|
4277
4294
|
}
|
|
4278
4295
|
}
|
|
4279
4296
|
} else if (ps.headType === 3) {
|
|
4280
|
-
const bullet = ps.numberingId >= 1 ? _optionalChain([ctx, 'access',
|
|
4297
|
+
const bullet = ps.numberingId >= 1 ? _optionalChain([ctx, 'access', _74 => _74.docInfo, 'optionalAccess', _75 => _75.bullets, 'access', _76 => _76[ps.numberingId - 1]]) : void 0;
|
|
4281
4298
|
if (bullet && bullet.char !== "\uFFFF") headMarker = bullet.char;
|
|
4282
4299
|
}
|
|
4283
4300
|
}
|
|
@@ -4482,8 +4499,8 @@ function parseTableControl(ctrl, records, ctx) {
|
|
|
4482
4499
|
let tableIdx = -1;
|
|
4483
4500
|
for (let i2 = childStart; i2 < childEnd; i2++) {
|
|
4484
4501
|
if (records[i2].tagId === TAG_TABLE && records[i2].data.length >= 8) {
|
|
4485
|
-
rows = Math.min(records[i2].data.readUInt16LE(4),
|
|
4486
|
-
cols = Math.min(records[i2].data.readUInt16LE(6),
|
|
4502
|
+
rows = Math.min(records[i2].data.readUInt16LE(4), _chunkOVESZY5Rcjs.MAX_ROWS);
|
|
4503
|
+
cols = Math.min(records[i2].data.readUInt16LE(6), _chunkOVESZY5Rcjs.MAX_COLS);
|
|
4487
4504
|
tableIdx = i2;
|
|
4488
4505
|
break;
|
|
4489
4506
|
}
|
|
@@ -4523,7 +4540,7 @@ function parseTableControl(ctrl, records, ctx) {
|
|
|
4523
4540
|
const cellRows2 = arrangeCells(rows, cols, cells);
|
|
4524
4541
|
const irCells = cellRows2.map((row) => row.map((c) => {
|
|
4525
4542
|
const ir = { text: c.text.trim(), colSpan: c.colSpan, rowSpan: c.rowSpan };
|
|
4526
|
-
if (_optionalChain([c, 'access',
|
|
4543
|
+
if (_optionalChain([c, 'access', _77 => _77.blocks, 'optionalAccess', _78 => _78.length])) ir.blocks = c.blocks;
|
|
4527
4544
|
if (c.isHeader) ir.isHeader = true;
|
|
4528
4545
|
return ir;
|
|
4529
4546
|
}));
|
|
@@ -4532,7 +4549,7 @@ function parseTableControl(ctrl, records, ctx) {
|
|
|
4532
4549
|
return table3;
|
|
4533
4550
|
}
|
|
4534
4551
|
const cellRows = arrangeCells(rows, cols, cells);
|
|
4535
|
-
const table2 =
|
|
4552
|
+
const table2 = _chunkOVESZY5Rcjs.buildTable.call(void 0, cellRows);
|
|
4536
4553
|
if (caption && table2.rows > 0) table2.caption = caption;
|
|
4537
4554
|
return table2.rows > 0 ? table2 : null;
|
|
4538
4555
|
}
|
|
@@ -4549,8 +4566,8 @@ function parseCell(records, lhIdx, end, ctx) {
|
|
|
4549
4566
|
rowAddr = rec.data.readUInt16LE(10);
|
|
4550
4567
|
const cs = rec.data.readUInt16LE(12);
|
|
4551
4568
|
const rs = rec.data.readUInt16LE(14);
|
|
4552
|
-
if (cs > 0) colSpan = Math.min(cs,
|
|
4553
|
-
if (rs > 0) rowSpan = Math.min(rs,
|
|
4569
|
+
if (cs > 0) colSpan = Math.min(cs, _chunkOVESZY5Rcjs.MAX_COLS);
|
|
4570
|
+
if (rs > 0) rowSpan = Math.min(rs, _chunkOVESZY5Rcjs.MAX_ROWS);
|
|
4554
4571
|
}
|
|
4555
4572
|
const blocks = ctx.depth < MAX_NEST_DEPTH ? parseParagraphList(records, lhIdx + 1, end, { ...ctx, depth: ctx.depth + 1 }) : [];
|
|
4556
4573
|
const parts = [];
|
|
@@ -4560,7 +4577,7 @@ function parseCell(records, lhIdx, end, ctx) {
|
|
|
4560
4577
|
parts.push(``);
|
|
4561
4578
|
hasStructure = true;
|
|
4562
4579
|
} else if (b.type === "table" && b.table) {
|
|
4563
|
-
const flat =
|
|
4580
|
+
const flat = _chunkOVESZY5Rcjs.convertTableToText.call(void 0, b.table.cells);
|
|
4564
4581
|
if (flat) parts.push(flat);
|
|
4565
4582
|
hasStructure = true;
|
|
4566
4583
|
} else if (b.text) {
|
|
@@ -4657,8 +4674,8 @@ function pictureToImageBlock(data, ctx) {
|
|
|
4657
4674
|
if (data.length < 73) return null;
|
|
4658
4675
|
const binDataId = data.readUInt16LE(71);
|
|
4659
4676
|
if (binDataId === 0) return null;
|
|
4660
|
-
const item = _optionalChain([ctx, 'access',
|
|
4661
|
-
if (_optionalChain([item, 'optionalAccess',
|
|
4677
|
+
const item = _optionalChain([ctx, 'access', _79 => _79.docInfo, 'optionalAccess', _80 => _80.binData, 'access', _81 => _81[binDataId - 1]]);
|
|
4678
|
+
if (_optionalChain([item, 'optionalAccess', _82 => _82.kind]) === "link") {
|
|
4662
4679
|
ctx.warnings.push({ page: ctx.sectionNum, message: `\uC678\uBD80 \uC5F0\uACB0 \uC774\uBBF8\uC9C0 (binDataId ${binDataId})`, code: "SKIPPED_IMAGE" });
|
|
4663
4680
|
return null;
|
|
4664
4681
|
}
|
|
@@ -16989,15 +17006,15 @@ function getElements(parent, tagName) {
|
|
|
16989
17006
|
const result = [];
|
|
16990
17007
|
for (let i = 0; i < nodes.length; i++) result.push(nodes[i]);
|
|
16991
17008
|
if (result.length > 0) return result;
|
|
16992
|
-
const nsNodes = _optionalChain([parent, 'access',
|
|
17009
|
+
const nsNodes = _optionalChain([parent, 'access', _83 => _83.getElementsByTagNameNS, 'optionalCall', _84 => _84("*", tagName)]);
|
|
16993
17010
|
if (nsNodes) for (let i = 0; i < nsNodes.length; i++) result.push(nsNodes[i]);
|
|
16994
17011
|
return result;
|
|
16995
17012
|
}
|
|
16996
17013
|
function getTextContent(el) {
|
|
16997
|
-
return _nullishCoalesce(_optionalChain([el, 'access',
|
|
17014
|
+
return _nullishCoalesce(_optionalChain([el, 'access', _85 => _85.textContent, 'optionalAccess', _86 => _86.trim, 'call', _87 => _87()]), () => ( ""));
|
|
16998
17015
|
}
|
|
16999
17016
|
function parseXml(text) {
|
|
17000
|
-
return new (0, _xmldom.DOMParser)().parseFromString(
|
|
17017
|
+
return new (0, _xmldom.DOMParser)().parseFromString(_chunkOVESZY5Rcjs.stripDtd.call(void 0, text), "text/xml");
|
|
17001
17018
|
}
|
|
17002
17019
|
function parseSharedStrings(xml) {
|
|
17003
17020
|
const doc = parseXml(xml);
|
|
@@ -17134,14 +17151,14 @@ function sheetToBlocks(sheetName, grid, merges, maxRow, maxCol, sheetIndex) {
|
|
|
17134
17151
|
const merge = mergeMap.get(key);
|
|
17135
17152
|
row.push({
|
|
17136
17153
|
text,
|
|
17137
|
-
colSpan: _nullishCoalesce(_optionalChain([merge, 'optionalAccess',
|
|
17138
|
-
rowSpan: _nullishCoalesce(_optionalChain([merge, 'optionalAccess',
|
|
17154
|
+
colSpan: _nullishCoalesce(_optionalChain([merge, 'optionalAccess', _88 => _88.colSpan]), () => ( 1)),
|
|
17155
|
+
rowSpan: _nullishCoalesce(_optionalChain([merge, 'optionalAccess', _89 => _89.rowSpan]), () => ( 1))
|
|
17139
17156
|
});
|
|
17140
17157
|
}
|
|
17141
17158
|
cellRows.push(row);
|
|
17142
17159
|
}
|
|
17143
17160
|
if (cellRows.length > 0) {
|
|
17144
|
-
const table2 =
|
|
17161
|
+
const table2 = _chunkOVESZY5Rcjs.buildTable.call(void 0, cellRows);
|
|
17145
17162
|
if (table2.rows > 0) {
|
|
17146
17163
|
blocks.push({ type: "table", table: table2, pageNumber: sheetIndex + 1 });
|
|
17147
17164
|
}
|
|
@@ -17149,12 +17166,12 @@ function sheetToBlocks(sheetName, grid, merges, maxRow, maxCol, sheetIndex) {
|
|
|
17149
17166
|
return blocks;
|
|
17150
17167
|
}
|
|
17151
17168
|
async function parseXlsxDocument(buffer, options) {
|
|
17152
|
-
|
|
17169
|
+
_chunkOVESZY5Rcjs.precheckZipSize.call(void 0, buffer, MAX_DECOMPRESS_SIZE3);
|
|
17153
17170
|
const zip = await _jszip2.default.loadAsync(buffer);
|
|
17154
17171
|
const warnings = [];
|
|
17155
17172
|
const workbookFile = zip.file("xl/workbook.xml");
|
|
17156
17173
|
if (!workbookFile) {
|
|
17157
|
-
throw new (0,
|
|
17174
|
+
throw new (0, _chunkOVESZY5Rcjs.KordocError)("\uC720\uD6A8\uD558\uC9C0 \uC54A\uC740 XLSX \uD30C\uC77C: xl/workbook.xml\uC774 \uC5C6\uC2B5\uB2C8\uB2E4");
|
|
17158
17175
|
}
|
|
17159
17176
|
let sharedStrings = [];
|
|
17160
17177
|
const ssFile = zip.file("xl/sharedStrings.xml");
|
|
@@ -17163,7 +17180,7 @@ async function parseXlsxDocument(buffer, options) {
|
|
|
17163
17180
|
}
|
|
17164
17181
|
const sheets = parseWorkbook(await workbookFile.async("text"));
|
|
17165
17182
|
if (sheets.length === 0) {
|
|
17166
|
-
throw new (0,
|
|
17183
|
+
throw new (0, _chunkOVESZY5Rcjs.KordocError)("XLSX \uD30C\uC77C\uC5D0 \uC2DC\uD2B8\uAC00 \uC5C6\uC2B5\uB2C8\uB2E4");
|
|
17167
17184
|
}
|
|
17168
17185
|
let relsMap = /* @__PURE__ */ new Map();
|
|
17169
17186
|
const relsFile = zip.file("xl/_rels/workbook.xml.rels");
|
|
@@ -17171,7 +17188,7 @@ async function parseXlsxDocument(buffer, options) {
|
|
|
17171
17188
|
relsMap = parseRels(await relsFile.async("text"));
|
|
17172
17189
|
}
|
|
17173
17190
|
let pageFilter = null;
|
|
17174
|
-
if (_optionalChain([options, 'optionalAccess',
|
|
17191
|
+
if (_optionalChain([options, 'optionalAccess', _90 => _90.pages])) {
|
|
17175
17192
|
const { parsePageRange: parsePageRange2 } = await Promise.resolve().then(() => _interopRequireWildcard(require("./page-range-P7SDW6LR.cjs")));
|
|
17176
17193
|
pageFilter = parsePageRange2(options.pages, sheets.length);
|
|
17177
17194
|
}
|
|
@@ -17180,7 +17197,7 @@ async function parseXlsxDocument(buffer, options) {
|
|
|
17180
17197
|
for (let i = 0; i < processedSheets; i++) {
|
|
17181
17198
|
if (pageFilter && !pageFilter.has(i + 1)) continue;
|
|
17182
17199
|
const sheet = sheets[i];
|
|
17183
|
-
_optionalChain([options, 'optionalAccess',
|
|
17200
|
+
_optionalChain([options, 'optionalAccess', _91 => _91.onProgress, 'optionalCall', _92 => _92(i + 1, processedSheets)]);
|
|
17184
17201
|
let sheetPath = relsMap.get(sheet.rId);
|
|
17185
17202
|
if (sheetPath) {
|
|
17186
17203
|
if (!sheetPath.startsWith("xl/") && !sheetPath.startsWith("/")) {
|
|
@@ -17235,7 +17252,7 @@ async function parseXlsxDocument(buffer, options) {
|
|
|
17235
17252
|
} catch (e27) {
|
|
17236
17253
|
}
|
|
17237
17254
|
}
|
|
17238
|
-
const markdown =
|
|
17255
|
+
const markdown = _chunkOVESZY5Rcjs.blocksToMarkdown.call(void 0, blocks);
|
|
17239
17256
|
return { markdown, blocks, metadata, warnings: warnings.length > 0 ? warnings : void 0 };
|
|
17240
17257
|
}
|
|
17241
17258
|
|
|
@@ -17642,11 +17659,11 @@ function processGlobals(records) {
|
|
|
17642
17659
|
let encrypted = false;
|
|
17643
17660
|
const firstBof = records[0];
|
|
17644
17661
|
if (!firstBof || firstBof.opcode !== OP_BOF) {
|
|
17645
|
-
throw new (0,
|
|
17662
|
+
throw new (0, _chunkOVESZY5Rcjs.KordocError)("XLS: \uCCAB \uB808\uCF54\uB4DC\uAC00 BOF\uAC00 \uC544\uB2D8");
|
|
17646
17663
|
}
|
|
17647
17664
|
const bof = decodeBof(firstBof.data);
|
|
17648
17665
|
if (!bof || bof.dt !== DT_GLOBALS) {
|
|
17649
|
-
throw new (0,
|
|
17666
|
+
throw new (0, _chunkOVESZY5Rcjs.KordocError)("XLS: Globals \uC11C\uBE0C\uC2A4\uD2B8\uB9BC BOF \uB204\uB77D");
|
|
17650
17667
|
}
|
|
17651
17668
|
let i = 1;
|
|
17652
17669
|
while (i < records.length) {
|
|
@@ -17754,14 +17771,14 @@ function sheetToBlocks2(sheetName, sheet, sheetIndex) {
|
|
|
17754
17771
|
const merge = mergeMap.get(key);
|
|
17755
17772
|
row.push({
|
|
17756
17773
|
text: grid[r][c],
|
|
17757
|
-
colSpan: _nullishCoalesce(_optionalChain([merge, 'optionalAccess',
|
|
17758
|
-
rowSpan: _nullishCoalesce(_optionalChain([merge, 'optionalAccess',
|
|
17774
|
+
colSpan: _nullishCoalesce(_optionalChain([merge, 'optionalAccess', _93 => _93.colSpan]), () => ( 1)),
|
|
17775
|
+
rowSpan: _nullishCoalesce(_optionalChain([merge, 'optionalAccess', _94 => _94.rowSpan]), () => ( 1))
|
|
17759
17776
|
});
|
|
17760
17777
|
}
|
|
17761
17778
|
cellRows.push(row);
|
|
17762
17779
|
}
|
|
17763
17780
|
if (cellRows.length > 0) {
|
|
17764
|
-
const table2 =
|
|
17781
|
+
const table2 = _chunkOVESZY5Rcjs.buildTable.call(void 0, cellRows);
|
|
17765
17782
|
if (table2.rows > 0) {
|
|
17766
17783
|
blocks.push({ type: "table", table: table2, pageNumber: sheetIndex + 1 });
|
|
17767
17784
|
}
|
|
@@ -17774,21 +17791,21 @@ async function parseXlsDocument(buffer, options) {
|
|
|
17774
17791
|
try {
|
|
17775
17792
|
cfb = parseLenientCfb(buf);
|
|
17776
17793
|
} catch (e) {
|
|
17777
|
-
throw new (0,
|
|
17794
|
+
throw new (0, _chunkOVESZY5Rcjs.KordocError)(
|
|
17778
17795
|
`XLS: OLE2 \uC2DC\uADF8\uB2C8\uCC98 \uAC80\uC99D \uC2E4\uD328 \u2014 ${e instanceof Error ? e.message : "\uC54C \uC218 \uC5C6\uB294 \uC624\uB958"}`
|
|
17779
17796
|
);
|
|
17780
17797
|
}
|
|
17781
17798
|
const wb = _nullishCoalesce(cfb.findStream("/Workbook"), () => ( cfb.findStream("/Book")));
|
|
17782
17799
|
if (!wb) {
|
|
17783
|
-
throw new (0,
|
|
17800
|
+
throw new (0, _chunkOVESZY5Rcjs.KordocError)("XLS: Workbook \uC2A4\uD2B8\uB9BC\uC774 \uC5C6\uC74C (BIFF5 \uB610\uB294 \uBE44\uD45C\uC900 \uD30C\uC77C)");
|
|
17784
17801
|
}
|
|
17785
17802
|
const records = readRecords2(wb);
|
|
17786
17803
|
if (records.length === 0) {
|
|
17787
|
-
throw new (0,
|
|
17804
|
+
throw new (0, _chunkOVESZY5Rcjs.KordocError)("XLS: \uC2DC\uADF8\uB2C8\uCC98 \uB808\uCF54\uB4DC\uAC00 \uC5C6\uC74C (Workbook \uC2A4\uD2B8\uB9BC \uC190\uC0C1)");
|
|
17788
17805
|
}
|
|
17789
17806
|
const firstBof = decodeBof(records[0].data);
|
|
17790
17807
|
if (firstBof && firstBof.vers !== 1536) {
|
|
17791
|
-
throw new (0,
|
|
17808
|
+
throw new (0, _chunkOVESZY5Rcjs.KordocError)(
|
|
17792
17809
|
`XLS: BIFF8(0x0600)\uB9CC \uC9C0\uC6D0 \u2014 \uBCF8 \uD30C\uC77C\uC740 0x${firstBof.vers.toString(16)}`
|
|
17793
17810
|
);
|
|
17794
17811
|
}
|
|
@@ -17809,7 +17826,7 @@ async function parseXlsDocument(buffer, options) {
|
|
|
17809
17826
|
}
|
|
17810
17827
|
const totalSheets = Math.min(globals.sheets.length, MAX_SHEETS2);
|
|
17811
17828
|
let pageFilter = null;
|
|
17812
|
-
if (_optionalChain([options, 'optionalAccess',
|
|
17829
|
+
if (_optionalChain([options, 'optionalAccess', _95 => _95.pages])) {
|
|
17813
17830
|
const { parsePageRange: parsePageRange2 } = await Promise.resolve().then(() => _interopRequireWildcard(require("./page-range-P7SDW6LR.cjs")));
|
|
17814
17831
|
pageFilter = parsePageRange2(options.pages, totalSheets);
|
|
17815
17832
|
}
|
|
@@ -17818,7 +17835,7 @@ async function parseXlsDocument(buffer, options) {
|
|
|
17818
17835
|
if (pageFilter && !pageFilter.has(i + 1)) continue;
|
|
17819
17836
|
const meta = globals.sheets[i];
|
|
17820
17837
|
if (meta.dt !== 0) continue;
|
|
17821
|
-
_optionalChain([options, 'optionalAccess',
|
|
17838
|
+
_optionalChain([options, 'optionalAccess', _96 => _96.onProgress, 'optionalCall', _97 => _97(i + 1, totalSheets)]);
|
|
17822
17839
|
const bofIdx = findSheetBofIndex(records, meta.lbPlyPos);
|
|
17823
17840
|
if (bofIdx < 0) {
|
|
17824
17841
|
warnings.push({
|
|
@@ -17848,7 +17865,7 @@ async function parseXlsDocument(buffer, options) {
|
|
|
17848
17865
|
pageCount: totalSheets
|
|
17849
17866
|
};
|
|
17850
17867
|
return {
|
|
17851
|
-
markdown:
|
|
17868
|
+
markdown: _chunkOVESZY5Rcjs.blocksToMarkdown.call(void 0, allBlocks),
|
|
17852
17869
|
blocks: allBlocks,
|
|
17853
17870
|
metadata,
|
|
17854
17871
|
warnings: warnings.length > 0 ? warnings : void 0
|
|
@@ -17861,7 +17878,7 @@ async function parseXlsDocument(buffer, options) {
|
|
|
17861
17878
|
|
|
17862
17879
|
// src/docx/equation.ts
|
|
17863
17880
|
function lname(el) {
|
|
17864
|
-
return el.localName || _optionalChain([el, 'access',
|
|
17881
|
+
return el.localName || _optionalChain([el, 'access', _98 => _98.tagName, 'optionalAccess', _99 => _99.replace, 'call', _100 => _100(/^[^:]+:/, "")]) || "";
|
|
17865
17882
|
}
|
|
17866
17883
|
function kids(parent, name) {
|
|
17867
17884
|
const out = [];
|
|
@@ -18234,7 +18251,7 @@ function isDisplayMath(el) {
|
|
|
18234
18251
|
// src/docx/parser.ts
|
|
18235
18252
|
var MAX_DECOMPRESS_SIZE4 = 100 * 1024 * 1024;
|
|
18236
18253
|
function matchesLocal(el, localName2) {
|
|
18237
|
-
return el.localName === localName2 || (_nullishCoalesce(_optionalChain([el, 'access',
|
|
18254
|
+
return el.localName === localName2 || (_nullishCoalesce(_optionalChain([el, 'access', _101 => _101.tagName, 'optionalAccess', _102 => _102.endsWith, 'call', _103 => _103(`:${localName2}`)]), () => ( false)));
|
|
18238
18255
|
}
|
|
18239
18256
|
function effectiveChildElements(parent) {
|
|
18240
18257
|
const result = [];
|
|
@@ -18267,7 +18284,7 @@ function findElements(parent, localName2) {
|
|
|
18267
18284
|
const child = children[i];
|
|
18268
18285
|
if (child.nodeType === 1) {
|
|
18269
18286
|
const el = child;
|
|
18270
|
-
if (el.localName === localName2 || _optionalChain([el, 'access',
|
|
18287
|
+
if (el.localName === localName2 || _optionalChain([el, 'access', _104 => _104.tagName, 'optionalAccess', _105 => _105.endsWith, 'call', _106 => _106(`:${localName2}`)])) {
|
|
18271
18288
|
result.push(el);
|
|
18272
18289
|
}
|
|
18273
18290
|
walk(el);
|
|
@@ -18286,7 +18303,7 @@ function getAttr(el, localName2) {
|
|
|
18286
18303
|
return null;
|
|
18287
18304
|
}
|
|
18288
18305
|
function parseXml2(text) {
|
|
18289
|
-
return new (0, _xmldom.DOMParser)().parseFromString(
|
|
18306
|
+
return new (0, _xmldom.DOMParser)().parseFromString(_chunkOVESZY5Rcjs.stripDtd.call(void 0, text), "text/xml");
|
|
18290
18307
|
}
|
|
18291
18308
|
function parseStyles(xml) {
|
|
18292
18309
|
const doc = parseXml2(xml);
|
|
@@ -18388,7 +18405,7 @@ function collectOmmlRoots(p) {
|
|
|
18388
18405
|
const child = children[i];
|
|
18389
18406
|
if (child.nodeType !== 1) continue;
|
|
18390
18407
|
const el = child;
|
|
18391
|
-
const tag = el.localName || _optionalChain([el, 'access',
|
|
18408
|
+
const tag = el.localName || _optionalChain([el, 'access', _107 => _107.tagName, 'optionalAccess', _108 => _108.replace, 'call', _109 => _109(/^[^:]+:/, "")]) || "";
|
|
18392
18409
|
if (tag === "oMath" || tag === "oMathPara") {
|
|
18393
18410
|
out.push(el);
|
|
18394
18411
|
} else if (tag === "txbxContent" || tag === "Fallback") {
|
|
@@ -18478,7 +18495,7 @@ function parseParagraph2(p, styles, numbering, footnotes, rels) {
|
|
|
18478
18495
|
const text = parts.join("").replace(/[ \t]{2,}/g, " ").trim();
|
|
18479
18496
|
if (!text) return null;
|
|
18480
18497
|
const style = styles.get(styleId);
|
|
18481
|
-
if (_optionalChain([style, 'optionalAccess',
|
|
18498
|
+
if (_optionalChain([style, 'optionalAccess', _110 => _110.outlineLevel]) !== void 0 && style.outlineLevel >= 0 && style.outlineLevel <= 5) {
|
|
18482
18499
|
return {
|
|
18483
18500
|
type: "heading",
|
|
18484
18501
|
text,
|
|
@@ -18487,8 +18504,8 @@ function parseParagraph2(p, styles, numbering, footnotes, rels) {
|
|
|
18487
18504
|
}
|
|
18488
18505
|
if (numId && numId !== "0") {
|
|
18489
18506
|
const numDef = numbering.get(numId);
|
|
18490
|
-
const levelInfo = _optionalChain([numDef, 'optionalAccess',
|
|
18491
|
-
const listType = _optionalChain([levelInfo, 'optionalAccess',
|
|
18507
|
+
const levelInfo = _optionalChain([numDef, 'optionalAccess', _111 => _111.get, 'call', _112 => _112(ilvl)]);
|
|
18508
|
+
const listType = _optionalChain([levelInfo, 'optionalAccess', _113 => _113.numFmt]) === "bullet" ? "unordered" : "ordered";
|
|
18492
18509
|
return { type: "list", text, listType };
|
|
18493
18510
|
}
|
|
18494
18511
|
const block = { type: "paragraph", text };
|
|
@@ -18571,7 +18588,7 @@ ${cell2.text}` : cell2.text;
|
|
|
18571
18588
|
return { text: cell2.text, colSpan: cell2.colSpan, rowSpan, colAddr: cell2.col, rowAddr: r };
|
|
18572
18589
|
})
|
|
18573
18590
|
);
|
|
18574
|
-
const table2 =
|
|
18591
|
+
const table2 = _chunkOVESZY5Rcjs.buildTable.call(void 0, cellRows);
|
|
18575
18592
|
if (table2.rows === 0 || table2.cols === 0) return null;
|
|
18576
18593
|
return { type: "table", table: table2 };
|
|
18577
18594
|
}
|
|
@@ -18581,10 +18598,10 @@ function collectCellText(tc2, styles, numbering, footnotes, rels, depth) {
|
|
|
18581
18598
|
for (const el of effectiveChildElements(tc2)) {
|
|
18582
18599
|
if (matchesLocal(el, "p")) {
|
|
18583
18600
|
const block = parseParagraph2(el, styles, numbering, footnotes, rels);
|
|
18584
|
-
if (_optionalChain([block, 'optionalAccess',
|
|
18601
|
+
if (_optionalChain([block, 'optionalAccess', _114 => _114.text])) parts.push(block.text);
|
|
18585
18602
|
for (const tp of collectTextboxParagraphs(el)) {
|
|
18586
18603
|
const tb = parseParagraph2(tp, styles, numbering, footnotes, rels);
|
|
18587
|
-
if (_optionalChain([tb, 'optionalAccess',
|
|
18604
|
+
if (_optionalChain([tb, 'optionalAccess', _115 => _115.text])) parts.push(tb.text);
|
|
18588
18605
|
}
|
|
18589
18606
|
} else if (matchesLocal(el, "tbl")) {
|
|
18590
18607
|
for (const tr of getChildElements(el, "tr")) {
|
|
@@ -18614,7 +18631,7 @@ async function extractImages(zip, rels, doc, warnings) {
|
|
|
18614
18631
|
try {
|
|
18615
18632
|
const data = await imgFile.async("uint8array");
|
|
18616
18633
|
imgIdx++;
|
|
18617
|
-
const ext = _nullishCoalesce(_optionalChain([imgPath, 'access',
|
|
18634
|
+
const ext = _nullishCoalesce(_optionalChain([imgPath, 'access', _116 => _116.split, 'call', _117 => _117("."), 'access', _118 => _118.pop, 'call', _119 => _119(), 'optionalAccess', _120 => _120.toLowerCase, 'call', _121 => _121()]), () => ( "png"));
|
|
18618
18635
|
const mimeMap = {
|
|
18619
18636
|
png: "image/png",
|
|
18620
18637
|
jpg: "image/jpeg",
|
|
@@ -18638,12 +18655,12 @@ async function extractImages(zip, rels, doc, warnings) {
|
|
|
18638
18655
|
return { blocks, images };
|
|
18639
18656
|
}
|
|
18640
18657
|
async function parseDocxDocument(buffer, options) {
|
|
18641
|
-
|
|
18658
|
+
_chunkOVESZY5Rcjs.precheckZipSize.call(void 0, buffer, MAX_DECOMPRESS_SIZE4);
|
|
18642
18659
|
const zip = await _jszip2.default.loadAsync(buffer);
|
|
18643
18660
|
const warnings = [];
|
|
18644
18661
|
const docFile = zip.file("word/document.xml");
|
|
18645
18662
|
if (!docFile) {
|
|
18646
|
-
throw new (0,
|
|
18663
|
+
throw new (0, _chunkOVESZY5Rcjs.KordocError)("\uC720\uD6A8\uD558\uC9C0 \uC54A\uC740 DOCX \uD30C\uC77C: word/document.xml\uC774 \uC5C6\uC2B5\uB2C8\uB2E4");
|
|
18647
18664
|
}
|
|
18648
18665
|
let rels = /* @__PURE__ */ new Map();
|
|
18649
18666
|
const relsFile = zip.file("word/_rels/document.xml.rels");
|
|
@@ -18690,13 +18707,13 @@ async function parseDocxDocument(buffer, options) {
|
|
|
18690
18707
|
const doc = parseXml2(docXml);
|
|
18691
18708
|
const body = findElements(doc, "body");
|
|
18692
18709
|
if (body.length === 0) {
|
|
18693
|
-
throw new (0,
|
|
18710
|
+
throw new (0, _chunkOVESZY5Rcjs.KordocError)("DOCX \uBCF8\uBB38(w:body)\uC744 \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4");
|
|
18694
18711
|
}
|
|
18695
18712
|
const blocks = [];
|
|
18696
18713
|
const bodyEl = body[0];
|
|
18697
18714
|
const topLevel = effectiveChildElements(bodyEl);
|
|
18698
18715
|
for (const el of topLevel) {
|
|
18699
|
-
const localName2 = _nullishCoalesce(el.localName, () => ( _optionalChain([el, 'access',
|
|
18716
|
+
const localName2 = _nullishCoalesce(el.localName, () => ( _optionalChain([el, 'access', _122 => _122.tagName, 'optionalAccess', _123 => _123.split, 'call', _124 => _124(":"), 'access', _125 => _125.pop, 'call', _126 => _126()])));
|
|
18700
18717
|
if (localName2 === "p") {
|
|
18701
18718
|
const block = parseParagraph2(el, styles, numbering, footnotes, rels);
|
|
18702
18719
|
if (block) blocks.push(block);
|
|
@@ -18735,7 +18752,7 @@ async function parseDocxDocument(buffer, options) {
|
|
|
18735
18752
|
}
|
|
18736
18753
|
}
|
|
18737
18754
|
const outline = blocks.filter((b) => b.type === "heading").map((b) => ({ level: _nullishCoalesce(b.level, () => ( 2)), text: _nullishCoalesce(b.text, () => ( "")) }));
|
|
18738
|
-
const markdown =
|
|
18755
|
+
const markdown = _chunkOVESZY5Rcjs.blocksToMarkdown.call(void 0, blocks);
|
|
18739
18756
|
return {
|
|
18740
18757
|
markdown,
|
|
18741
18758
|
blocks,
|
|
@@ -18758,7 +18775,7 @@ function parseHwpmlDocument(buffer, options) {
|
|
|
18758
18775
|
}
|
|
18759
18776
|
const text = new TextDecoder("utf-8").decode(buffer).replace(/^\uFEFF/, "");
|
|
18760
18777
|
const normalized = text.replace(/ /g, " ");
|
|
18761
|
-
const xml =
|
|
18778
|
+
const xml = _chunkOVESZY5Rcjs.stripDtd.call(void 0, normalized);
|
|
18762
18779
|
const warnings = [];
|
|
18763
18780
|
const parser = new (0, _xmldom.DOMParser)({
|
|
18764
18781
|
onError: (_level, msg2) => {
|
|
@@ -18786,7 +18803,7 @@ function parseHwpmlDocument(buffer, options) {
|
|
|
18786
18803
|
return { markdown: "", blocks: [], metadata, warnings };
|
|
18787
18804
|
}
|
|
18788
18805
|
const blocks = [];
|
|
18789
|
-
const pageFilter = _optionalChain([options, 'optionalAccess',
|
|
18806
|
+
const pageFilter = _optionalChain([options, 'optionalAccess', _127 => _127.pages]) ? _chunkDCZVOIEOcjs.parsePageRange.call(void 0, options.pages, countSections(body)) : null;
|
|
18790
18807
|
let sectionIdx = 0;
|
|
18791
18808
|
const children = body.childNodes;
|
|
18792
18809
|
for (let i = 0; i < children.length; i++) {
|
|
@@ -18798,7 +18815,7 @@ function parseHwpmlDocument(buffer, options) {
|
|
|
18798
18815
|
parseSection2(el, blocks, paraShapeMap, sectionIdx, warnings);
|
|
18799
18816
|
}
|
|
18800
18817
|
const outline = blocks.filter((b) => b.type === "heading" && b.text).map((b) => ({ level: _nullishCoalesce(b.level, () => ( 1)), text: b.text, pageNumber: b.pageNumber }));
|
|
18801
|
-
const markdown =
|
|
18818
|
+
const markdown = _chunkOVESZY5Rcjs.blocksToMarkdown.call(void 0, blocks);
|
|
18802
18819
|
return {
|
|
18803
18820
|
markdown,
|
|
18804
18821
|
blocks,
|
|
@@ -18884,7 +18901,7 @@ function parseParagraph3(el, blocks, paraShapeMap, sectionNum) {
|
|
|
18884
18901
|
const shapeInfo = paraShapeMap.get(paraShapeId);
|
|
18885
18902
|
const text = extractParagraphText(el);
|
|
18886
18903
|
if (!text) return;
|
|
18887
|
-
if (_optionalChain([shapeInfo, 'optionalAccess',
|
|
18904
|
+
if (_optionalChain([shapeInfo, 'optionalAccess', _128 => _128.headingLevel]) != null) {
|
|
18888
18905
|
blocks.push({ type: "heading", text, level: shapeInfo.headingLevel, pageNumber: sectionNum });
|
|
18889
18906
|
} else {
|
|
18890
18907
|
blocks.push({ type: "paragraph", text, pageNumber: sectionNum });
|
|
@@ -18956,7 +18973,7 @@ function parseTable2(el, blocks, paraShapeMap, sectionNum, warnings) {
|
|
|
18956
18973
|
const cellRows = grid.map(
|
|
18957
18974
|
(row) => row.map((cell2) => _nullishCoalesce(cell2, () => ( { text: "", colSpan: 1, rowSpan: 1 })))
|
|
18958
18975
|
);
|
|
18959
|
-
const table2 =
|
|
18976
|
+
const table2 = _chunkOVESZY5Rcjs.buildTable.call(void 0, cellRows);
|
|
18960
18977
|
const caption = extractShapeCaption(el);
|
|
18961
18978
|
if (caption.text && caption.before) {
|
|
18962
18979
|
blocks.push({ type: "paragraph", text: caption.text, pageNumber: sectionNum });
|
|
@@ -19216,7 +19233,7 @@ function fillInCellPatterns(cellText, values, matchedLabels, blockedLabels) {
|
|
|
19216
19233
|
(match, prefix, suffix) => {
|
|
19217
19234
|
const label = prefix + suffix;
|
|
19218
19235
|
const normalizedLabel = normalizeLabel(label);
|
|
19219
|
-
if (_optionalChain([blockedLabels, 'optionalAccess',
|
|
19236
|
+
if (_optionalChain([blockedLabels, 'optionalAccess', _129 => _129.has, 'call', _130 => _130(normalizedLabel)])) return match;
|
|
19220
19237
|
const matchKey = values.available(normalizedLabel) ? normalizedLabel : values.available(normalizeLabel(prefix)) ? normalizeLabel(prefix) : void 0;
|
|
19221
19238
|
if (matchKey === void 0) return match;
|
|
19222
19239
|
const newValue = values.consume(matchKey);
|
|
@@ -19466,8 +19483,8 @@ function extractFromTable(table2) {
|
|
|
19466
19483
|
if (table2.cols >= 2) {
|
|
19467
19484
|
for (let r = 0; r < table2.rows; r++) {
|
|
19468
19485
|
for (let c = 0; c < table2.cols - 1; c++) {
|
|
19469
|
-
const labelCell = _optionalChain([table2, 'access',
|
|
19470
|
-
const valueCell = _optionalChain([table2, 'access',
|
|
19486
|
+
const labelCell = _optionalChain([table2, 'access', _131 => _131.cells, 'access', _132 => _132[r], 'optionalAccess', _133 => _133[c]]);
|
|
19487
|
+
const valueCell = _optionalChain([table2, 'access', _134 => _134.cells, 'access', _135 => _135[r], 'optionalAccess', _136 => _136[c + 1]]);
|
|
19471
19488
|
if (!labelCell || !valueCell) continue;
|
|
19472
19489
|
if (isLabelCell(labelCell.text)) {
|
|
19473
19490
|
fields.push({
|
|
@@ -19489,8 +19506,8 @@ function extractFromTable(table2) {
|
|
|
19489
19506
|
if (allLabels) {
|
|
19490
19507
|
for (let r = 1; r < table2.rows; r++) {
|
|
19491
19508
|
for (let c = 0; c < table2.cols; c++) {
|
|
19492
|
-
const label = _nullishCoalesce(_optionalChain([headerRow, 'access',
|
|
19493
|
-
const value = _nullishCoalesce(_optionalChain([table2, 'access',
|
|
19509
|
+
const label = _nullishCoalesce(_optionalChain([headerRow, 'access', _137 => _137[c], 'optionalAccess', _138 => _138.text, 'access', _139 => _139.trim, 'call', _140 => _140()]), () => ( ""));
|
|
19510
|
+
const value = _nullishCoalesce(_optionalChain([table2, 'access', _141 => _141.cells, 'access', _142 => _142[r], 'optionalAccess', _143 => _143[c], 'optionalAccess', _144 => _144.text, 'access', _145 => _145.trim, 'call', _146 => _146()]), () => ( ""));
|
|
19494
19511
|
if (label && value) {
|
|
19495
19512
|
fields.push({ label, value, row: r, col: c });
|
|
19496
19513
|
}
|
|
@@ -19583,7 +19600,7 @@ function fillFormFields(blocks, values, blockedLabels) {
|
|
|
19583
19600
|
for (const table2 of allTables) {
|
|
19584
19601
|
for (let r = 0; r < table2.rows; r++) {
|
|
19585
19602
|
for (let c = 0; c < table2.cols; c++) {
|
|
19586
|
-
const cell2 = _optionalChain([table2, 'access',
|
|
19603
|
+
const cell2 = _optionalChain([table2, 'access', _147 => _147.cells, 'access', _148 => _148[r], 'optionalAccess', _149 => _149[c]]);
|
|
19587
19604
|
if (!cell2) continue;
|
|
19588
19605
|
const result = fillInCellPatterns(cell2.text, cursor, matchedLabels, blockedLabels);
|
|
19589
19606
|
if (result) {
|
|
@@ -19615,7 +19632,7 @@ function collectIRTables(blocks, depth) {
|
|
|
19615
19632
|
out.push(block.table);
|
|
19616
19633
|
for (const row of block.table.cells) {
|
|
19617
19634
|
for (const cell2 of row) {
|
|
19618
|
-
if (_optionalChain([cell2, 'optionalAccess',
|
|
19635
|
+
if (_optionalChain([cell2, 'optionalAccess', _150 => _150.blocks, 'optionalAccess', _151 => _151.length])) out.push(...collectIRTables(cell2.blocks, depth + 1));
|
|
19619
19636
|
}
|
|
19620
19637
|
}
|
|
19621
19638
|
}
|
|
@@ -19626,7 +19643,7 @@ function coveredPositions(table2) {
|
|
|
19626
19643
|
for (let r = 0; r < table2.rows; r++) {
|
|
19627
19644
|
for (let c = 0; c < table2.cols; c++) {
|
|
19628
19645
|
if (covered.has(`${r},${c}`)) continue;
|
|
19629
|
-
const cell2 = _optionalChain([table2, 'access',
|
|
19646
|
+
const cell2 = _optionalChain([table2, 'access', _152 => _152.cells, 'access', _153 => _153[r], 'optionalAccess', _154 => _154[c]]);
|
|
19630
19647
|
if (!cell2) continue;
|
|
19631
19648
|
for (let dr = 0; dr < cell2.rowSpan; dr++) {
|
|
19632
19649
|
for (let dc = 0; dc < cell2.colSpan; dc++) {
|
|
@@ -19656,12 +19673,12 @@ function fillTable(table2, values, filled, matchedLabels, patternFilledCells, bl
|
|
|
19656
19673
|
if (isKeywordLabel(valueCell.text)) continue;
|
|
19657
19674
|
const normalizedCellLabel = normalizeLabel(labelCell.text);
|
|
19658
19675
|
if (!normalizedCellLabel) continue;
|
|
19659
|
-
if (_optionalChain([blockedLabels, 'optionalAccess',
|
|
19676
|
+
if (_optionalChain([blockedLabels, 'optionalAccess', _155 => _155.has, 'call', _156 => _156(normalizedCellLabel)])) continue;
|
|
19660
19677
|
const matchKey = findMatchingKey(normalizedCellLabel, values);
|
|
19661
19678
|
if (matchKey === void 0) continue;
|
|
19662
19679
|
const newValue = values.consume(matchKey);
|
|
19663
19680
|
if (newValue === void 0) continue;
|
|
19664
|
-
if (_optionalChain([patternFilledCells, 'optionalAccess',
|
|
19681
|
+
if (_optionalChain([patternFilledCells, 'optionalAccess', _157 => _157.has, 'call', _158 => _158(valueCell)])) {
|
|
19665
19682
|
valueCell.text = newValue + " " + valueCell.text;
|
|
19666
19683
|
} else {
|
|
19667
19684
|
valueCell.text = newValue;
|
|
@@ -19687,10 +19704,10 @@ function fillTable(table2, values, filled, matchedLabels, patternFilledCells, bl
|
|
|
19687
19704
|
for (let c = 0; c < table2.cols; c++) {
|
|
19688
19705
|
if (covered.has(`${r},${c}`)) continue;
|
|
19689
19706
|
const headerCell = headerRow[c];
|
|
19690
|
-
const valueCell = _optionalChain([table2, 'access',
|
|
19707
|
+
const valueCell = _optionalChain([table2, 'access', _159 => _159.cells, 'access', _160 => _160[r], 'optionalAccess', _161 => _161[c]]);
|
|
19691
19708
|
if (!headerCell || !valueCell) continue;
|
|
19692
19709
|
const headerLabel = normalizeLabel(headerCell.text);
|
|
19693
|
-
if (_optionalChain([blockedLabels, 'optionalAccess',
|
|
19710
|
+
if (_optionalChain([blockedLabels, 'optionalAccess', _162 => _162.has, 'call', _163 => _163(headerLabel)])) continue;
|
|
19694
19711
|
const matchKey = findMatchingKey(headerLabel, values);
|
|
19695
19712
|
if (matchKey === void 0) continue;
|
|
19696
19713
|
if (!values.isArray(matchKey) && matchedLabels.has(matchKey)) continue;
|
|
@@ -19716,7 +19733,7 @@ function fillInlineFields(text, values, filled, matchedLabels, blockedLabels) {
|
|
|
19716
19733
|
let pos = 0;
|
|
19717
19734
|
for (const seg of segments) {
|
|
19718
19735
|
const nlabel = normalizeLabel(seg.label);
|
|
19719
|
-
if (_optionalChain([blockedLabels, 'optionalAccess',
|
|
19736
|
+
if (_optionalChain([blockedLabels, 'optionalAccess', _164 => _164.has, 'call', _165 => _165(nlabel)])) continue;
|
|
19720
19737
|
const matchKey = findMatchingKey(nlabel, values);
|
|
19721
19738
|
if (matchKey === void 0) continue;
|
|
19722
19739
|
const newValue = values.consume(matchKey);
|
|
@@ -20284,19 +20301,19 @@ function parseCentralDirectory(buf) {
|
|
|
20284
20301
|
}
|
|
20285
20302
|
}
|
|
20286
20303
|
}
|
|
20287
|
-
if (eocdOffset < 0) throw new (0,
|
|
20304
|
+
if (eocdOffset < 0) throw new (0, _chunkOVESZY5Rcjs.KordocError)("ZIP EOCD\uB97C \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4");
|
|
20288
20305
|
const totalEntries = view.getUint16(eocdOffset + 10, true);
|
|
20289
20306
|
const cdSize = view.getUint32(eocdOffset + 12, true);
|
|
20290
20307
|
const cdOffset = view.getUint32(eocdOffset + 16, true);
|
|
20291
|
-
if (cdOffset === 4294967295 || totalEntries === 65535) throw new (0,
|
|
20308
|
+
if (cdOffset === 4294967295 || totalEntries === 65535) throw new (0, _chunkOVESZY5Rcjs.KordocError)("ZIP64\uB294 \uC9C0\uC6D0\uD558\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4");
|
|
20292
20309
|
if (eocdOffset >= 20 && view.getUint32(eocdOffset - 20, true) === ZIP64_EOCD_LOC_SIG) {
|
|
20293
|
-
throw new (0,
|
|
20310
|
+
throw new (0, _chunkOVESZY5Rcjs.KordocError)("ZIP64\uB294 \uC9C0\uC6D0\uD558\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4");
|
|
20294
20311
|
}
|
|
20295
20312
|
const decoder = new TextDecoder("utf-8");
|
|
20296
20313
|
const entries = [];
|
|
20297
20314
|
let pos = cdOffset;
|
|
20298
20315
|
for (let i = 0; i < totalEntries; i++) {
|
|
20299
|
-
if (view.getUint32(pos, true) !== CD_SIG) throw new (0,
|
|
20316
|
+
if (view.getUint32(pos, true) !== CD_SIG) throw new (0, _chunkOVESZY5Rcjs.KordocError)("ZIP Central Directory \uC190\uC0C1");
|
|
20300
20317
|
const flags = view.getUint16(pos + 8, true);
|
|
20301
20318
|
const method = view.getUint16(pos + 10, true);
|
|
20302
20319
|
const crc = view.getUint32(pos + 16, true);
|
|
@@ -20307,7 +20324,7 @@ function parseCentralDirectory(buf) {
|
|
|
20307
20324
|
const commentLen = view.getUint16(pos + 32, true);
|
|
20308
20325
|
const localOffset = view.getUint32(pos + 42, true);
|
|
20309
20326
|
if (compSize === 4294967295 || uncompSize === 4294967295 || localOffset === 4294967295) {
|
|
20310
|
-
throw new (0,
|
|
20327
|
+
throw new (0, _chunkOVESZY5Rcjs.KordocError)("ZIP64\uB294 \uC9C0\uC6D0\uD558\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4");
|
|
20311
20328
|
}
|
|
20312
20329
|
const name = decoder.decode(buf.subarray(pos + 46, pos + 46 + nameLen));
|
|
20313
20330
|
const cdEnd = pos + 46 + nameLen + extraLen + commentLen;
|
|
@@ -20336,11 +20353,11 @@ function patchZipEntries(original, replacements, additions) {
|
|
|
20336
20353
|
const { entries, cdOffset, eocdOffset } = parseCentralDirectory(original);
|
|
20337
20354
|
const view = new DataView(original.buffer, original.byteOffset, original.byteLength);
|
|
20338
20355
|
for (const name of replacements.keys()) {
|
|
20339
|
-
if (!entries.some((e) => e.name === name)) throw new (0,
|
|
20356
|
+
if (!entries.some((e) => e.name === name)) throw new (0, _chunkOVESZY5Rcjs.KordocError)(`ZIP\uC5D0 \uC5C6\uB294 \uC5D4\uD2B8\uB9AC: ${name}`);
|
|
20340
20357
|
}
|
|
20341
20358
|
if (additions) {
|
|
20342
20359
|
for (const name of additions.keys()) {
|
|
20343
|
-
if (entries.some((e) => e.name === name)) throw new (0,
|
|
20360
|
+
if (entries.some((e) => e.name === name)) throw new (0, _chunkOVESZY5Rcjs.KordocError)(`ZIP\uC5D0 \uC774\uBBF8 \uC788\uB294 \uC5D4\uD2B8\uB9AC: ${name}`);
|
|
20344
20361
|
}
|
|
20345
20362
|
}
|
|
20346
20363
|
const byLocal = [...entries].sort((a, b) => a.localOffset - b.localOffset);
|
|
@@ -20359,7 +20376,7 @@ function patchZipEntries(original, replacements, additions) {
|
|
|
20359
20376
|
offset += seg.length;
|
|
20360
20377
|
continue;
|
|
20361
20378
|
}
|
|
20362
|
-
if (view.getUint32(e.localOffset, true) !== LOCAL_SIG) throw new (0,
|
|
20379
|
+
if (view.getUint32(e.localOffset, true) !== LOCAL_SIG) throw new (0, _chunkOVESZY5Rcjs.KordocError)("ZIP \uB85C\uCEEC \uD5E4\uB354 \uC2DC\uADF8\uB2C8\uCC98 \uBD88\uC77C\uCE58");
|
|
20363
20380
|
const nameLen = view.getUint16(e.localOffset + 26, true);
|
|
20364
20381
|
const extraLen = view.getUint16(e.localOffset + 28, true);
|
|
20365
20382
|
const headerLen = 30 + nameLen + extraLen;
|
|
@@ -20465,7 +20482,7 @@ async function fillHwpx(hwpxBuffer, values, blockedLabels) {
|
|
|
20465
20482
|
const zip = await _jszip2.default.loadAsync(hwpxBuffer);
|
|
20466
20483
|
const sectionPaths = Object.keys(zip.files).filter((name) => /[Ss]ection\d+\.xml$/i.test(name)).sort();
|
|
20467
20484
|
if (sectionPaths.length === 0) {
|
|
20468
|
-
throw new (0,
|
|
20485
|
+
throw new (0, _chunkOVESZY5Rcjs.KordocError)("HWPX\uC5D0\uC11C \uC139\uC158 \uD30C\uC77C\uC744 \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4");
|
|
20469
20486
|
}
|
|
20470
20487
|
const normalizedValues = normalizeValues(values);
|
|
20471
20488
|
const cursor = new ValueCursor(normalizedValues);
|
|
@@ -20538,7 +20555,7 @@ async function fillHwpx(hwpxBuffer, values, blockedLabels) {
|
|
|
20538
20555
|
if (isKeywordLabel(cellLabelText(valueCell))) continue;
|
|
20539
20556
|
const normalizedCellLabel = normalizeLabel(labelText);
|
|
20540
20557
|
if (!normalizedCellLabel) continue;
|
|
20541
|
-
if (_optionalChain([blockedLabels, 'optionalAccess',
|
|
20558
|
+
if (_optionalChain([blockedLabels, 'optionalAccess', _166 => _166.has, 'call', _167 => _167(normalizedCellLabel)])) continue;
|
|
20542
20559
|
const matchKey = findMatchingKey(normalizedCellLabel, cursor);
|
|
20543
20560
|
if (matchKey === void 0) continue;
|
|
20544
20561
|
if (patternApplied.has(valueCell)) {
|
|
@@ -20596,7 +20613,7 @@ async function fillHwpx(hwpxBuffer, values, blockedLabels) {
|
|
|
20596
20613
|
const dataCells = table2.rows[rowIdx];
|
|
20597
20614
|
for (let colIdx = 0; colIdx < Math.min(headerCells.length, dataCells.length); colIdx++) {
|
|
20598
20615
|
const headerLabel = normalizeLabel(cellLabelText(headerCells[colIdx]));
|
|
20599
|
-
if (_optionalChain([blockedLabels, 'optionalAccess',
|
|
20616
|
+
if (_optionalChain([blockedLabels, 'optionalAccess', _168 => _168.has, 'call', _169 => _169(headerLabel)])) continue;
|
|
20600
20617
|
const matchKey = findMatchingKey(headerLabel, cursor);
|
|
20601
20618
|
if (matchKey === void 0) continue;
|
|
20602
20619
|
if (!cursor.isArray(matchKey) && matchedLabels.has(matchKey)) continue;
|
|
@@ -20629,11 +20646,11 @@ async function fillHwpx(hwpxBuffer, values, blockedLabels) {
|
|
|
20629
20646
|
}
|
|
20630
20647
|
for (const para2 of [...scan.bodyParagraphs, ...scan.excludedParagraphs]) {
|
|
20631
20648
|
const existing = ledger.get(para2);
|
|
20632
|
-
if (_optionalChain([existing, 'optionalAccess',
|
|
20649
|
+
if (_optionalChain([existing, 'optionalAccess', _170 => _170.fullText]) !== void 0) continue;
|
|
20633
20650
|
const text = matchText(para2);
|
|
20634
20651
|
for (const seg of scanInlineSegments(text)) {
|
|
20635
20652
|
const nlabel = normalizeLabel(seg.label);
|
|
20636
|
-
if (_optionalChain([blockedLabels, 'optionalAccess',
|
|
20653
|
+
if (_optionalChain([blockedLabels, 'optionalAccess', _171 => _171.has, 'call', _172 => _172(nlabel)])) continue;
|
|
20637
20654
|
const matchKey = findMatchingKey(nlabel, cursor);
|
|
20638
20655
|
if (matchKey === void 0) continue;
|
|
20639
20656
|
const newValue = cursor.consume(matchKey);
|
|
@@ -20871,8 +20888,8 @@ function charWidthEm1000(cp) {
|
|
|
20871
20888
|
var SPACE_EM_FIXED = 500;
|
|
20872
20889
|
var SPACE_EM_FONT = 300;
|
|
20873
20890
|
function measureTextWidth(text, height, ratioPct, opts) {
|
|
20874
|
-
const spaceEm = _nullishCoalesce(_optionalChain([opts, 'optionalAccess',
|
|
20875
|
-
const spacing = _nullishCoalesce(_optionalChain([opts, 'optionalAccess',
|
|
20891
|
+
const spaceEm = _nullishCoalesce(_optionalChain([opts, 'optionalAccess', _173 => _173.spaceEm]), () => ( SPACE_EM_FIXED));
|
|
20892
|
+
const spacing = _nullishCoalesce(_optionalChain([opts, 'optionalAccess', _174 => _174.spacingPct]), () => ( 0));
|
|
20876
20893
|
let em = 0;
|
|
20877
20894
|
for (const ch of text) {
|
|
20878
20895
|
const cp = ch.codePointAt(0);
|
|
@@ -20885,8 +20902,8 @@ var FORBID_START = /* @__PURE__ */ new Set([..."!%),.:;?]}\xA2\xB0\u2032\u2033\u
|
|
|
20885
20902
|
var FORBID_END = /* @__PURE__ */ new Set([..."$([{\xA3\xA5\u3008\u300A\u300C\u300E\u3010\u3014$([{\u20A9"]);
|
|
20886
20903
|
function simulateWrap(text, firstWidth, contWidth, height, ratioPct, mode = "keep", opts) {
|
|
20887
20904
|
const EPS = 0.5;
|
|
20888
|
-
const spaceEm = _nullishCoalesce(_optionalChain([opts, 'optionalAccess',
|
|
20889
|
-
const spacing = _nullishCoalesce(_optionalChain([opts, 'optionalAccess',
|
|
20905
|
+
const spaceEm = _nullishCoalesce(_optionalChain([opts, 'optionalAccess', _175 => _175.spaceEm]), () => ( SPACE_EM_FIXED));
|
|
20906
|
+
const spacing = _nullishCoalesce(_optionalChain([opts, 'optionalAccess', _176 => _176.spacingPct]), () => ( 0));
|
|
20890
20907
|
const k = height * ratioPct / 100 / 1e3;
|
|
20891
20908
|
const cwCp = (cp) => (cp === 32 ? spaceEm : charWidthEm1000(cp)) * (1 + spacing / 100) * k;
|
|
20892
20909
|
const charW2 = (ch) => cwCp(ch.codePointAt(0));
|
|
@@ -21067,9 +21084,11 @@ var OFFICIAL_MARGINS = { top: 20, bottom: 15, left: 20, right: 15 };
|
|
|
21067
21084
|
var GAEJOSIK_MARGINS = { top: 15, bottom: 15, left: 20, right: 20 };
|
|
21068
21085
|
var GAEJOSIK_HEADER_FOOTER = 4251;
|
|
21069
21086
|
var PRESET_DEFAULTS = {
|
|
21070
|
-
|
|
21087
|
+
// 서울시 실결재 104건 중 12pt 64건(13pt 30, 15pt 5) — 지배값을 기본으로 사용.
|
|
21088
|
+
official: { bodyPt: 12, lineSpacing: 160, numbering: "standard" },
|
|
21071
21089
|
report: { bodyPt: 15, lineSpacing: 160, numbering: "report" },
|
|
21072
|
-
|
|
21090
|
+
// 실측 추진계획안: □ → ㅇ → * 계층.
|
|
21091
|
+
plan: { bodyPt: 15, lineSpacing: 160, numbering: "report" },
|
|
21073
21092
|
notice: { bodyPt: 15, lineSpacing: 160, numbering: "standard" },
|
|
21074
21093
|
minutes: { bodyPt: 14, lineSpacing: 130, numbering: "standard" },
|
|
21075
21094
|
gaejosik: { bodyPt: 15, lineSpacing: 160, numbering: "gaejosik" },
|
|
@@ -21108,7 +21127,46 @@ function normalizeGongmunPreset(preset) {
|
|
|
21108
21127
|
function usesReportFonts(preset) {
|
|
21109
21128
|
return preset === "gaejosik" || preset === "report" || preset === "plan";
|
|
21110
21129
|
}
|
|
21130
|
+
function usesAsteriskThird(preset) {
|
|
21131
|
+
return preset === "plan" || preset === "press";
|
|
21132
|
+
}
|
|
21133
|
+
function needsGaejosikAssets(gongmun) {
|
|
21134
|
+
return usesReportFonts(gongmun.preset) || gongmun.cover !== null || gongmun.toc;
|
|
21135
|
+
}
|
|
21136
|
+
function assertFiniteRange(name, value, min, max) {
|
|
21137
|
+
if (!Number.isFinite(value) || value < min || value > max) {
|
|
21138
|
+
throw new (0, _chunkOVESZY5Rcjs.KordocError)(`${name} must be a finite number between ${min} and ${max}`);
|
|
21139
|
+
}
|
|
21140
|
+
}
|
|
21141
|
+
function validateGongmunOptions(opts) {
|
|
21142
|
+
if (opts.bodyPt !== void 0) assertFiniteRange("bodyPt", opts.bodyPt, 6, 40);
|
|
21143
|
+
if (opts.lineSpacing !== void 0) assertFiniteRange("lineSpacing", opts.lineSpacing, 50, 300);
|
|
21144
|
+
if (typeof opts.autoFit === "object" && opts.autoFit.minRatio !== void 0) {
|
|
21145
|
+
assertFiniteRange("autoFit.minRatio", opts.autoFit.minRatio, 50, 99);
|
|
21146
|
+
}
|
|
21147
|
+
if (opts.margins) {
|
|
21148
|
+
for (const side of ["top", "bottom", "left", "right"]) {
|
|
21149
|
+
const value = opts.margins[side];
|
|
21150
|
+
assertFiniteRange(`margins.${side}`, value, 0, 200);
|
|
21151
|
+
}
|
|
21152
|
+
if (opts.margins.left + opts.margins.right >= 210) {
|
|
21153
|
+
throw new (0, _chunkOVESZY5Rcjs.KordocError)("margins.left + margins.right must be less than 210");
|
|
21154
|
+
}
|
|
21155
|
+
if (opts.margins.top + opts.margins.bottom >= 297) {
|
|
21156
|
+
throw new (0, _chunkOVESZY5Rcjs.KordocError)("margins.top + margins.bottom must be less than 297");
|
|
21157
|
+
}
|
|
21158
|
+
}
|
|
21159
|
+
if (opts.sizes) {
|
|
21160
|
+
for (const [key, value] of Object.entries(opts.sizes)) {
|
|
21161
|
+
if (value !== void 0) assertFiniteRange(`sizes.${key}`, value, 6, 60);
|
|
21162
|
+
}
|
|
21163
|
+
}
|
|
21164
|
+
if (opts.approval && opts.approval.length > 6) {
|
|
21165
|
+
throw new (0, _chunkOVESZY5Rcjs.KordocError)("approval must contain at most 6 labels");
|
|
21166
|
+
}
|
|
21167
|
+
}
|
|
21111
21168
|
function resolveGongmun(opts) {
|
|
21169
|
+
validateGongmunOptions(opts);
|
|
21112
21170
|
const preset = normalizeGongmunPreset(opts.preset);
|
|
21113
21171
|
const d = PRESET_DEFAULTS[preset];
|
|
21114
21172
|
const bodyPt = _nullishCoalesce(opts.bodyPt, () => ( d.bodyPt));
|
|
@@ -21126,8 +21184,10 @@ function resolveGongmun(opts) {
|
|
|
21126
21184
|
margins: _nullishCoalesce(opts.margins, () => ( (reportFamily ? GAEJOSIK_MARGINS : OFFICIAL_MARGINS))),
|
|
21127
21185
|
centerTitle: _nullishCoalesce(opts.centerTitle, () => ( true)),
|
|
21128
21186
|
autoFitMinRatio,
|
|
21129
|
-
|
|
21130
|
-
|
|
21187
|
+
// 보도자료는 머리박스가 1페이지 최상단을 차지하는 서식이라 표지·목차와 양립 불가 —
|
|
21188
|
+
// 켜면 머리박스가 표지에 얹히고 25pt 제목·부제가 유실된다 (docHead 프리셋 게이팅과 동일 관례)
|
|
21189
|
+
cover: coverOn && preset !== "press" ? { date: _nullishCoalesce(coverOpts.date, () => ( null)), org: _nullishCoalesce(coverOpts.org, () => ( "")) } : null,
|
|
21190
|
+
toc: preset !== "press" && (_nullishCoalesce(opts.toc, () => ( gaejosik))),
|
|
21131
21191
|
fonts: _nullishCoalesce(opts.fonts, () => ( {})),
|
|
21132
21192
|
sizes: _nullishCoalesce(opts.sizes, () => ( {})),
|
|
21133
21193
|
// 쪽번호 — 보고서 계열 관행(실측: 2_보고서 양식·추진계획·공고문 전부 하단 중앙)
|
|
@@ -21143,12 +21203,12 @@ function resolveGongmun(opts) {
|
|
|
21143
21203
|
// h2 말머리 — 실측: 보고서 양식 □ 대항목(QA-2), 공고문 아라비아("1. 사업개요", 바이오헬스 실측)
|
|
21144
21204
|
h2Marker: _nullishCoalesce(opts.h2Marker, () => ( (preset === "report" || preset === "plan" ? "box" : preset === "notice" ? "number" : "none"))),
|
|
21145
21205
|
// 2단계 부호 — 실결재 기안문·공고문 ㅇ 지배(60건 중 ㅇ134:○5), 보고서 양식 계열 ○
|
|
21146
|
-
bullet2: _nullishCoalesce(opts.bullet2, () => ( (preset === "notice" || preset === "press" ? "\u3147" : "\u25CB"))),
|
|
21206
|
+
bullet2: _nullishCoalesce(opts.bullet2, () => ( (preset === "plan" || preset === "notice" || preset === "press" ? "\u3147" : "\u25CB"))),
|
|
21147
21207
|
// 단일 형제 부호 생략 — 규정이지만 부호 없는 계단이 실무 눈에 어색 (실무자 QA)
|
|
21148
21208
|
suppressSingle: _nullishCoalesce(opts.suppressSingle, () => ( false)),
|
|
21149
21209
|
docHead: preset === "official" && opts.docHead ? opts.docHead : null,
|
|
21150
21210
|
docFoot: preset === "official" && opts.docFoot ? opts.docFoot : null,
|
|
21151
|
-
reportInfo: _optionalChain([opts, 'access',
|
|
21211
|
+
reportInfo: _optionalChain([opts, 'access', _177 => _177.reportInfo, 'optionalAccess', _178 => _178.trim, 'call', _179 => _179()]) || null,
|
|
21152
21212
|
noticeHead: preset === "notice" && opts.noticeHead ? opts.noticeHead : null,
|
|
21153
21213
|
// 보도자료 머리박스는 프리셋 자체가 요구 — 옵션 미지정이어도 빈 객체
|
|
21154
21214
|
press: preset === "press" ? _nullishCoalesce(opts.press, () => ( {})) : null
|
|
@@ -21169,7 +21229,7 @@ function circledHangul(n) {
|
|
|
21169
21229
|
return String.fromCodePoint(12910 + n % 14);
|
|
21170
21230
|
}
|
|
21171
21231
|
var REPORT_BULLETS = ["\u25A1", "\u25CB", "-", "\u318D"];
|
|
21172
|
-
var
|
|
21232
|
+
var ASTERISK_BULLETS = ["\u25A1", "\u25CB", "*", "\u318D"];
|
|
21173
21233
|
function standardMarker(depth, n) {
|
|
21174
21234
|
switch (depth) {
|
|
21175
21235
|
case 0:
|
|
@@ -21192,19 +21252,19 @@ function standardMarker(depth, n) {
|
|
|
21192
21252
|
return circledHangul(n);
|
|
21193
21253
|
}
|
|
21194
21254
|
}
|
|
21195
|
-
function reportMarker(depth, bullet2 = "\u25CB",
|
|
21196
|
-
const bullets =
|
|
21255
|
+
function reportMarker(depth, bullet2 = "\u25CB", asteriskThird = false) {
|
|
21256
|
+
const bullets = asteriskThird ? ASTERISK_BULLETS : REPORT_BULLETS;
|
|
21197
21257
|
const m = bullets[Math.min(depth, bullets.length - 1)];
|
|
21198
|
-
return depth === 1
|
|
21258
|
+
return depth === 1 ? bullet2 : m;
|
|
21199
21259
|
}
|
|
21200
21260
|
function markerWidth(marker, bodyHeight) {
|
|
21201
21261
|
let em = SPACE_EM_FIXED;
|
|
21202
21262
|
for (const c of marker) em += charWidthEm1000(c.codePointAt(0));
|
|
21203
21263
|
return Math.round(em / 1e3 * bodyHeight);
|
|
21204
21264
|
}
|
|
21205
|
-
function levelIndent(depth, bodyHeight, numbering, sizes = {}, bullet2 = "\u25CB",
|
|
21265
|
+
function levelIndent(depth, bodyHeight, numbering, sizes = {}, bullet2 = "\u25CB", asteriskThird = false) {
|
|
21206
21266
|
if (numbering === "gaejosik") return gaejosikLevelIndent(depth, bodyHeight, sizes, bullet2);
|
|
21207
|
-
const marker = numbering === "report" ? reportMarker(depth, bullet2,
|
|
21267
|
+
const marker = numbering === "report" ? reportMarker(depth, bullet2, asteriskThird) : standardMarker(depth, 0);
|
|
21208
21268
|
return { left: Math.round(depth * bodyHeight), indent: -markerWidth(marker, bodyHeight) };
|
|
21209
21269
|
}
|
|
21210
21270
|
function computeSuppression(depths) {
|
|
@@ -21221,10 +21281,10 @@ function computeSuppression(depths) {
|
|
|
21221
21281
|
return keys.map((k) => (_nullishCoalesce(counts.get(k), () => ( 0))) <= 1);
|
|
21222
21282
|
}
|
|
21223
21283
|
var GongmunNumberer = (_class3 = class {
|
|
21224
|
-
constructor(numbering, bullet2 = "\u25CB",
|
|
21284
|
+
constructor(numbering, bullet2 = "\u25CB", asteriskThird = false) {;_class3.prototype.__init5.call(this);
|
|
21225
21285
|
this.numbering = numbering;
|
|
21226
21286
|
this.bullet2 = bullet2;
|
|
21227
|
-
this.
|
|
21287
|
+
this.asteriskThird = asteriskThird;
|
|
21228
21288
|
}
|
|
21229
21289
|
__init5() {this.counts = []}
|
|
21230
21290
|
/** depth 항목 하나에 대한 마커. suppress=true면 빈 문자열(부호 없음) */
|
|
@@ -21234,7 +21294,7 @@ var GongmunNumberer = (_class3 = class {
|
|
|
21234
21294
|
this.counts[depth] = n + 1;
|
|
21235
21295
|
if (suppress) return "";
|
|
21236
21296
|
if (this.numbering === "gaejosik") return gaejosikMarker(depth, this.bullet2);
|
|
21237
|
-
return this.numbering === "report" ? reportMarker(depth, this.bullet2, this.
|
|
21297
|
+
return this.numbering === "report" ? reportMarker(depth, this.bullet2, this.asteriskThird) : standardMarker(depth, n);
|
|
21238
21298
|
}
|
|
21239
21299
|
reset() {
|
|
21240
21300
|
this.counts = [];
|
|
@@ -21274,16 +21334,16 @@ var PARA_LIST = 7;
|
|
|
21274
21334
|
var DEFAULT_TEXT_COLOR = "#000000";
|
|
21275
21335
|
function resolveTheme(theme) {
|
|
21276
21336
|
return {
|
|
21277
|
-
h1: _nullishCoalesce(_optionalChain([theme, 'optionalAccess',
|
|
21278
|
-
h2: _nullishCoalesce(_optionalChain([theme, 'optionalAccess',
|
|
21279
|
-
h3: _nullishCoalesce(_optionalChain([theme, 'optionalAccess',
|
|
21280
|
-
h4: _nullishCoalesce(_nullishCoalesce(_optionalChain([theme, 'optionalAccess',
|
|
21281
|
-
body: _nullishCoalesce(_optionalChain([theme, 'optionalAccess',
|
|
21282
|
-
quote: _nullishCoalesce(_optionalChain([theme, 'optionalAccess',
|
|
21337
|
+
h1: _nullishCoalesce(_optionalChain([theme, 'optionalAccess', _180 => _180.headingColors, 'optionalAccess', _181 => _181[1]]), () => ( DEFAULT_TEXT_COLOR)),
|
|
21338
|
+
h2: _nullishCoalesce(_optionalChain([theme, 'optionalAccess', _182 => _182.headingColors, 'optionalAccess', _183 => _183[2]]), () => ( DEFAULT_TEXT_COLOR)),
|
|
21339
|
+
h3: _nullishCoalesce(_optionalChain([theme, 'optionalAccess', _184 => _184.headingColors, 'optionalAccess', _185 => _185[3]]), () => ( DEFAULT_TEXT_COLOR)),
|
|
21340
|
+
h4: _nullishCoalesce(_nullishCoalesce(_optionalChain([theme, 'optionalAccess', _186 => _186.headingColors, 'optionalAccess', _187 => _187[4]]), () => ( _optionalChain([theme, 'optionalAccess', _188 => _188.headingColors, 'optionalAccess', _189 => _189[3]]))), () => ( DEFAULT_TEXT_COLOR)),
|
|
21341
|
+
body: _nullishCoalesce(_optionalChain([theme, 'optionalAccess', _190 => _190.bodyColor]), () => ( DEFAULT_TEXT_COLOR)),
|
|
21342
|
+
quote: _nullishCoalesce(_optionalChain([theme, 'optionalAccess', _191 => _191.quoteColor]), () => ( DEFAULT_TEXT_COLOR)),
|
|
21283
21343
|
/** quoteColor가 명시되었는지 — blockquote charPr 분기에 사용 (baseline 호환) */
|
|
21284
|
-
hasQuoteOption: _optionalChain([theme, 'optionalAccess',
|
|
21285
|
-
tableHeader: _nullishCoalesce(_nullishCoalesce(_optionalChain([theme, 'optionalAccess',
|
|
21286
|
-
tableHeaderBold: !!_optionalChain([theme, 'optionalAccess',
|
|
21344
|
+
hasQuoteOption: _optionalChain([theme, 'optionalAccess', _192 => _192.quoteColor]) !== void 0,
|
|
21345
|
+
tableHeader: _nullishCoalesce(_nullishCoalesce(_optionalChain([theme, 'optionalAccess', _193 => _193.tableHeaderColor]), () => ( _optionalChain([theme, 'optionalAccess', _194 => _194.bodyColor]))), () => ( DEFAULT_TEXT_COLOR)),
|
|
21346
|
+
tableHeaderBold: !!_optionalChain([theme, 'optionalAccess', _195 => _195.tableHeaderBold])
|
|
21287
21347
|
};
|
|
21288
21348
|
}
|
|
21289
21349
|
function escapeXml(text) {
|
|
@@ -21350,13 +21410,16 @@ var GJ_CHAR_TABLE = 22;
|
|
|
21350
21410
|
var GJ_CHAR_TABLE_BOLD = 23;
|
|
21351
21411
|
var GJ_CHAR_BAR = 24;
|
|
21352
21412
|
var GJ_CHAR_BODY_TITLE = 25;
|
|
21353
|
-
var
|
|
21413
|
+
var GJ_CHAR_TITLE_BAR = 26;
|
|
21414
|
+
var GJ_CHAR_APPROVAL = 27;
|
|
21415
|
+
var GJ_CHAR_COUNT = 17;
|
|
21354
21416
|
var GJ_PARA_CHAM = 20;
|
|
21355
21417
|
var GJ_PARA_COVER = 21;
|
|
21356
21418
|
var GJ_PARA_TOC_ITEM = 22;
|
|
21357
21419
|
var GJ_PARA_CHAPTER = 23;
|
|
21358
21420
|
var GJ_PARA_BAR = 24;
|
|
21359
21421
|
var GONGMUN_LIST_PLAIN_BASE = 25;
|
|
21422
|
+
var GONGMUN_PARA_APPROVAL = GONGMUN_LIST_PLAIN_BASE + GONGMUN_LIST_LEVELS;
|
|
21360
21423
|
var GJ_BF_CHAPTER_NUM = 3;
|
|
21361
21424
|
var GJ_BF_CHAPTER_GAP = 4;
|
|
21362
21425
|
var GJ_BF_CHAPTER_TITLE = 5;
|
|
@@ -21364,8 +21427,8 @@ var GJ_BF_BAR_DARK = 6;
|
|
|
21364
21427
|
var GJ_BF_BAR_LIGHT = 7;
|
|
21365
21428
|
var GJ_BF_TOC_BOX = 8;
|
|
21366
21429
|
var GJ_BF_TOC_STRIPE = 9;
|
|
21367
|
-
function gongmunTableHeaderBf(
|
|
21368
|
-
return
|
|
21430
|
+
function gongmunTableHeaderBf(richAssets) {
|
|
21431
|
+
return richAssets ? 10 : 3;
|
|
21369
21432
|
}
|
|
21370
21433
|
function borderFillEntry(id, b, fill) {
|
|
21371
21434
|
const side = (name, v) => v ? ` <hh:${name} type="${_nullishCoalesce(v[2], () => ( "SOLID"))}" width="${v[0]}" color="${v[1]}"/>` : ` <hh:${name} type="NONE" width="0.1 mm" color="#000000"/>`;
|
|
@@ -21398,10 +21461,12 @@ function pageHidingCtrl(hideHeader = false) {
|
|
|
21398
21461
|
var GONGMUN_TBL_CHAR = 11;
|
|
21399
21462
|
var GONGMUN_TBL_CHAR_BOLD = 12;
|
|
21400
21463
|
var GONGMUN_TBL_PT = 1200;
|
|
21464
|
+
var GONGMUN_TITLE_BAR_CHAR = 13;
|
|
21465
|
+
var GONGMUN_APPROVAL_CHAR = 14;
|
|
21401
21466
|
var CHAR_VARIANT_BASE = 11;
|
|
21402
|
-
function charVariantBase(
|
|
21467
|
+
function charVariantBase(richAssets, isGongmun = true) {
|
|
21403
21468
|
if (!isGongmun) return CHAR_VARIANT_BASE;
|
|
21404
|
-
return
|
|
21469
|
+
return richAssets ? 11 + GJ_CHAR_COUNT : 11 + 4;
|
|
21405
21470
|
}
|
|
21406
21471
|
var GONGMUN_BODY_RATIO = 95;
|
|
21407
21472
|
|
|
@@ -21650,6 +21715,7 @@ function generateManifest(chartParts = []) {
|
|
|
21650
21715
|
}
|
|
21651
21716
|
function buildCharProperties(theme, gongmun, ratioVariants = [], extraCharPrXmls = []) {
|
|
21652
21717
|
const measured = !!gongmun && usesReportFonts(gongmun.preset);
|
|
21718
|
+
const richAssets = !!gongmun && needsGaejosikAssets(gongmun);
|
|
21653
21719
|
let body = 1e3, code = 900, h1 = 1800, h2 = 1400, h3 = 1200, h4 = 1100;
|
|
21654
21720
|
if (gongmun) {
|
|
21655
21721
|
body = gongmun.bodyHeight;
|
|
@@ -21657,9 +21723,9 @@ function buildCharProperties(theme, gongmun, ratioVariants = [], extraCharPrXmls
|
|
|
21657
21723
|
h1 = gongmun.preset === "report" || gongmun.preset === "plan" ? 2e3 : 1700;
|
|
21658
21724
|
h2 = 1600;
|
|
21659
21725
|
h3 = body;
|
|
21660
|
-
h4 = Math.max(body - 100, 1300);
|
|
21726
|
+
h4 = Math.min(h3, Math.max(body - 100, 1300));
|
|
21661
21727
|
}
|
|
21662
|
-
const bodyFont =
|
|
21728
|
+
const bodyFont = richAssets ? 4 : 0;
|
|
21663
21729
|
const hFont = measured ? 3 : 1;
|
|
21664
21730
|
const hBold = !measured;
|
|
21665
21731
|
const bodyRatio = gongmun ? GONGMUN_BODY_RATIO : 100;
|
|
@@ -21676,13 +21742,15 @@ function buildCharProperties(theme, gongmun, ratioVariants = [], extraCharPrXmls
|
|
|
21676
21742
|
charPr(CHAR_TABLE_HEADER, body, theme.tableHeaderBold, false, bodyFont, theme.tableHeader),
|
|
21677
21743
|
charPr(CHAR_QUOTE, body, false, true, bodyFont, theme.quote)
|
|
21678
21744
|
];
|
|
21679
|
-
if (gongmun && !
|
|
21745
|
+
if (gongmun && !richAssets) {
|
|
21680
21746
|
rows.push(
|
|
21681
21747
|
charPr(11, GONGMUN_TBL_PT, false, false, bodyFont, theme.body),
|
|
21682
|
-
charPr(12, GONGMUN_TBL_PT, true, false, bodyFont, theme.body)
|
|
21748
|
+
charPr(12, GONGMUN_TBL_PT, true, false, bodyFont, theme.body),
|
|
21749
|
+
charPr(GONGMUN_TITLE_BAR_CHAR, 100, false, false, bodyFont, theme.body),
|
|
21750
|
+
charPr(GONGMUN_APPROVAL_CHAR, 1e3, false, false, bodyFont, theme.body)
|
|
21683
21751
|
);
|
|
21684
21752
|
}
|
|
21685
|
-
if (
|
|
21753
|
+
if (richAssets) {
|
|
21686
21754
|
const sz = gaejosikSizes(body, gongmun.sizes);
|
|
21687
21755
|
rows.push(
|
|
21688
21756
|
charPr(11, sz.dae, false, false, 3),
|
|
@@ -21713,8 +21781,12 @@ function buildCharProperties(theme, gongmun, ratioVariants = [], extraCharPrXmls
|
|
|
21713
21781
|
// 표 셀 bold
|
|
21714
21782
|
charPr(24, sz.bar, false, false, 4),
|
|
21715
21783
|
// 표지 바 셀 빈 문단(6pt)
|
|
21716
|
-
charPr(25, sz.bodyTitle, false, false, 3)
|
|
21784
|
+
charPr(25, sz.bodyTitle, false, false, 3),
|
|
21717
21785
|
// 본문 제목박스(HY헤드라인M 22pt, 실측 GT3 표④)
|
|
21786
|
+
charPr(GJ_CHAR_TITLE_BAR, 100, false, false, 4),
|
|
21787
|
+
// 1페이지형 제목박스 바(1pt)
|
|
21788
|
+
charPr(GJ_CHAR_APPROVAL, 1e3, false, false, 7)
|
|
21789
|
+
// 결재란 라벨(맑은 고딕 10pt)
|
|
21718
21790
|
);
|
|
21719
21791
|
}
|
|
21720
21792
|
for (const r of ratioVariants) {
|
|
@@ -21760,7 +21832,7 @@ ${base2.join("\n")}
|
|
|
21760
21832
|
paraPr(7, { align: "LEFT", lineSpacing: ls, indent: 600, keepWord: true })
|
|
21761
21833
|
];
|
|
21762
21834
|
for (let d = 0; d < GONGMUN_LIST_LEVELS; d++) {
|
|
21763
|
-
const { left, indent } = levelIndent(d, gongmun.bodyHeight, gongmun.numbering, gongmun.sizes, gongmun.bullet2, gongmun.preset
|
|
21835
|
+
const { left, indent } = levelIndent(d, gongmun.bodyHeight, gongmun.numbering, gongmun.sizes, gongmun.bullet2, usesAsteriskThird(gongmun.preset));
|
|
21764
21836
|
const sectionGap = gongmun.numbering === "gaejosik" || gongmun.numbering === "report" ? gaejosikSpaceBefore(d, gongmun.bodyHeight) : 0;
|
|
21765
21837
|
const keepNext = (gongmun.numbering === "gaejosik" || gongmun.numbering === "report") && d === 0;
|
|
21766
21838
|
base.push(paraPr(GONGMUN_LIST_BASE + d, { align: "JUSTIFY", lineSpacing: ls, left, indent, spaceBefore: sectionGap, keepWord: true, keepWithNext: keepNext }));
|
|
@@ -21783,10 +21855,11 @@ ${base2.join("\n")}
|
|
|
21783
21855
|
);
|
|
21784
21856
|
}
|
|
21785
21857
|
for (let d = 0; d < GONGMUN_LIST_LEVELS; d++) {
|
|
21786
|
-
const { left } = levelIndent(d, gongmun.bodyHeight, gongmun.numbering, gongmun.sizes, gongmun.bullet2, gongmun.preset
|
|
21858
|
+
const { left } = levelIndent(d, gongmun.bodyHeight, gongmun.numbering, gongmun.sizes, gongmun.bullet2, usesAsteriskThird(gongmun.preset));
|
|
21787
21859
|
const sectionGap = gongmun.numbering === "gaejosik" || gongmun.numbering === "report" ? gaejosikSpaceBefore(d, gongmun.bodyHeight) : 0;
|
|
21788
21860
|
base.push(paraPr(GONGMUN_LIST_PLAIN_BASE + d, { align: "JUSTIFY", lineSpacing: ls, left, indent: 0, spaceBefore: sectionGap, keepWord: true }));
|
|
21789
21861
|
}
|
|
21862
|
+
base.push(paraPr(GONGMUN_PARA_APPROVAL, { align: "CENTER", lineSpacing: 100, keepWord: true }));
|
|
21790
21863
|
return `<hh:paraProperties itemCnt="${base.length}">
|
|
21791
21864
|
${base.join("\n")}
|
|
21792
21865
|
</hh:paraProperties>`;
|
|
@@ -21803,14 +21876,14 @@ ${heads}
|
|
|
21803
21876
|
</hh:numberings>`;
|
|
21804
21877
|
}
|
|
21805
21878
|
function fontEntry(id, face, weight = 6) {
|
|
21806
|
-
return ` <hh:font id="${id}" face="${face}" type="TTF" isEmbedded="0">
|
|
21879
|
+
return ` <hh:font id="${id}" face="${escapeXml(face)}" type="TTF" isEmbedded="0">
|
|
21807
21880
|
<hh:typeInfo familyType="FCAT_GOTHIC" weight="${weight}" proportion="4" contrast="0" strokeVariation="1" armStyle="1" letterform="1" midline="1" xHeight="1"/>
|
|
21808
21881
|
</hh:font>`;
|
|
21809
21882
|
}
|
|
21810
21883
|
function buildFontFaces(gongmun, bodyFace) {
|
|
21811
|
-
if (gongmun &&
|
|
21884
|
+
if (gongmun && needsGaejosikAssets(gongmun)) {
|
|
21812
21885
|
const ov = gongmun.fonts;
|
|
21813
|
-
const bodyDefault = gongmun.preset !== "gaejosik" && gongmun.bodyFont === "gothic" ? "\uB9D1\uC740 \uACE0\uB515" : "\uD734\uBA3C\uBA85\uC870";
|
|
21886
|
+
const bodyDefault = usesReportFonts(gongmun.preset) ? gongmun.preset !== "gaejosik" && gongmun.bodyFont === "gothic" ? "\uB9D1\uC740 \uACE0\uB515" : "\uD734\uBA3C\uBA85\uC870" : bodyFace;
|
|
21814
21887
|
const faces = [
|
|
21815
21888
|
"\uD568\uCD08\uB86C\uBC14\uD0D5",
|
|
21816
21889
|
"\uD568\uCD08\uB86C\uB3CB\uC6C0",
|
|
@@ -21869,7 +21942,7 @@ function buildBorderFills(gongmun, extra = []) {
|
|
|
21869
21942
|
borderFillEntry(1, {}),
|
|
21870
21943
|
borderFillEntry(2, { l: thin, r: thin, t: thin, b: thin })
|
|
21871
21944
|
];
|
|
21872
|
-
if (
|
|
21945
|
+
if (gongmun && needsGaejosikAssets(gongmun)) {
|
|
21873
21946
|
const c = GAEJOSIK_COLORS;
|
|
21874
21947
|
const edge = ["0.12 mm", c.border];
|
|
21875
21948
|
const grayLine = ["0.1 mm", c.titleLine];
|
|
@@ -22166,7 +22239,7 @@ function computeGongmunFitPlan(blocks, gongmun, gongmunList) {
|
|
|
22166
22239
|
if (gongmun.numbering === "gaejosik" && (depth === 0 || (block.text || "").trimStart().startsWith("\u203B"))) continue;
|
|
22167
22240
|
const content = plainRenderText(block.text || "");
|
|
22168
22241
|
text = marker ? `${marker} ${content}` : content;
|
|
22169
|
-
const li = levelIndent(depth, gongmun.bodyHeight, gongmun.numbering, gongmun.sizes, gongmun.bullet2, gongmun.preset
|
|
22242
|
+
const li = levelIndent(depth, gongmun.bodyHeight, gongmun.numbering, gongmun.sizes, gongmun.bullet2, usesAsteriskThird(gongmun.preset));
|
|
22170
22243
|
const left = li.left;
|
|
22171
22244
|
const indent = marker ? li.indent : 0;
|
|
22172
22245
|
firstW = pageW - left - Math.max(indent, 0);
|
|
@@ -22224,7 +22297,7 @@ function precomputeGongmunList(blocks, gongmun) {
|
|
|
22224
22297
|
}
|
|
22225
22298
|
const depths = run.map((bi) => Math.min(Math.max((blocks[bi].indent || 0) + depthOffset, 0), GONGMUN_LIST_LEVELS - 1));
|
|
22226
22299
|
const suppress = gongmun.suppressSingle && gongmun.numbering === "standard" ? computeSuppression(depths) : depths.map(() => false);
|
|
22227
|
-
const numberer = new GongmunNumberer(gongmun.numbering, gongmun.bullet2, gongmun.preset
|
|
22300
|
+
const numberer = new GongmunNumberer(gongmun.numbering, gongmun.bullet2, usesAsteriskThird(gongmun.preset));
|
|
22228
22301
|
run.forEach((bi, k) => {
|
|
22229
22302
|
const marker = numberer.next(depths[k], suppress[k]);
|
|
22230
22303
|
result.set(bi, { marker, depth: depths[k] });
|
|
@@ -22503,7 +22576,7 @@ function escapeGfm(text) {
|
|
|
22503
22576
|
}
|
|
22504
22577
|
var HWP_SHAPE_ALT_TEXT_RE = /(?:모서리가 둥근 |둥근 )?(?:사각형|직사각형|정사각형|원|타원|삼각형|이등변 삼각형|직각 삼각형|선|직선|곡선|화살표|굵은 화살표|이중 화살표|오각형|육각형|팔각형|별|[4-8]점별|십자|십자형|구름|구름형|마름모|도넛|평행사변형|사다리꼴|부채꼴|호|반원|물결|번개|하트|빗금|블록 화살표|수식|표|그림|개체|그리기\s?개체|묶음\s?개체|글상자|수식\s?개체|OLE\s?개체)\s?입니다\.?/g;
|
|
22505
22578
|
function sanitizeText(text) {
|
|
22506
|
-
let result =
|
|
22579
|
+
let result = _chunkOVESZY5Rcjs.mapPuaText.call(void 0, text).replace(/[\u{F0000}-\u{FFFFD}]/gu, "").replace(HWP_SHAPE_ALT_TEXT_RE, "").replace(/ +/g, " ").trim();
|
|
22507
22580
|
if (result.length <= 30 && result.includes(" ")) {
|
|
22508
22581
|
const tokens = result.split(" ");
|
|
22509
22582
|
const koreanSingleCharCount = tokens.filter((t) => t.length === 1 && /[가-ㄱ-ㆎ]/.test(t)).length;
|
|
@@ -23113,6 +23186,7 @@ function generateHtmlTableXml(rawHtml, theme, totalWidth = 44e3, style = null, r
|
|
|
23113
23186
|
const reg = _nullishCoalesce(_optionalChain([style, 'optionalAccess', _238 => _238.bfRegistry]), () => ( null));
|
|
23114
23187
|
let htmlHeaderRows = 0;
|
|
23115
23188
|
while (htmlHeaderRows < rows.length && rows[htmlHeaderRows].tag === "th") htmlHeaderRows++;
|
|
23189
|
+
const tableRowHeights = Array(rowCnt).fill(cellH);
|
|
23116
23190
|
const tcXmls = placed.map((cell2, i) => {
|
|
23117
23191
|
const k = `${cell2.r},${cell2.c}`;
|
|
23118
23192
|
const isHeader = cell2.isHeader;
|
|
@@ -23140,6 +23214,10 @@ function generateHtmlTableXml(rawHtml, theme, totalWidth = 44e3, style = null, r
|
|
|
23140
23214
|
}
|
|
23141
23215
|
const contentH = Math.max(cellH * cell2.rowSpan, Math.max(lines.length, 1) * (style ? Math.round(measureH * 1.6) : 800) + nestedH);
|
|
23142
23216
|
const cellHeight = Math.max(_nullishCoalesce(_optionalChain([prof, 'optionalAccess', _242 => _242.cellH, 'access', _243 => _243.get, 'call', _244 => _244(k)]), () => ( 0)), contentH);
|
|
23217
|
+
const perRow = Math.ceil(cellHeight / cell2.rowSpan);
|
|
23218
|
+
for (let r = cell2.r; r < Math.min(cell2.r + cell2.rowSpan, rowCnt); r++) {
|
|
23219
|
+
tableRowHeights[r] = Math.max(tableRowHeights[r], perRow);
|
|
23220
|
+
}
|
|
23143
23221
|
const bf = _nullishCoalesce(_optionalChain([prof, 'optionalAccess', _245 => _245.cellBf, 'access', _246 => _246.get, 'call', _247 => _247(k)]), () => ( (reg ? reg.get(dataCellSpec({
|
|
23144
23222
|
row: cell2.r,
|
|
23145
23223
|
rowEnd: cell2.r + cell2.rowSpan - 1,
|
|
@@ -23157,7 +23235,8 @@ function generateHtmlTableXml(rawHtml, theme, totalWidth = 44e3, style = null, r
|
|
|
23157
23235
|
const rowTcs = tcXmls.filter((_, i) => placed[i].r === r);
|
|
23158
23236
|
trXmls.push(`<hp:tr>${rowTcs.join("")}</hp:tr>`);
|
|
23159
23237
|
}
|
|
23160
|
-
|
|
23238
|
+
const tableH = tableRowHeights.reduce((sum, height) => sum + height, 0);
|
|
23239
|
+
return `<hp:tbl id="${tblId}" zOrder="0" numberingType="TABLE" pageBreak="CELL" repeatHeader="${style ? 1 : 0}" rowCnt="${rowCnt}" colCnt="${colCnt}" cellSpacing="0" borderFillIDRef="2" noShading="0"><hp:sz width="${tblW}" widthRelTo="ABSOLUTE" height="${tableH}" 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"/>` + trXmls.join("") + `</hp:tbl>`;
|
|
23161
23240
|
}
|
|
23162
23241
|
|
|
23163
23242
|
// src/hwpx/gen-gongmun-extra.ts
|
|
@@ -23172,9 +23251,9 @@ function para(text, paraPrId, charPrId) {
|
|
|
23172
23251
|
return `<hp:p paraPrIDRef="${paraPrId}" styleIDRef="0"><hp:run charPrIDRef="${charPrId}"><hp:t>${escapeXml(text)}</hp:t></hp:run></hp:p>`;
|
|
23173
23252
|
}
|
|
23174
23253
|
var APPROVAL_COL_W = 7085;
|
|
23175
|
-
var APPROVAL_LABEL_H =
|
|
23254
|
+
var APPROVAL_LABEL_H = 1300;
|
|
23176
23255
|
var APPROVAL_SIGN_H = 4200;
|
|
23177
|
-
function buildApprovalTable(labels,
|
|
23256
|
+
function buildApprovalTable(labels, reg, approvalCharPr) {
|
|
23178
23257
|
const n = labels.length;
|
|
23179
23258
|
const w = APPROVAL_COL_W * n;
|
|
23180
23259
|
const bfAt = (row, col) => reg.get({
|
|
@@ -23184,10 +23263,10 @@ function buildApprovalTable(labels, gongmun, reg) {
|
|
|
23184
23263
|
r: col === n - 1 ? "thick" : "thin"
|
|
23185
23264
|
});
|
|
23186
23265
|
const labelRow = labels.map(
|
|
23187
|
-
(label, c) => tc({ bf: bfAt(0, c), row: 0, col: c, w: APPROVAL_COL_W, h: APPROVAL_LABEL_H, paras: para(label,
|
|
23266
|
+
(label, c) => tc({ bf: bfAt(0, c), row: 0, col: c, w: APPROVAL_COL_W, h: APPROVAL_LABEL_H, paras: para(label, GONGMUN_PARA_APPROVAL, approvalCharPr) })
|
|
23188
23267
|
).join("");
|
|
23189
23268
|
const signRow = labels.map(
|
|
23190
|
-
(_, c) => tc({ bf: bfAt(1, c), row: 1, col: c, w: APPROVAL_COL_W, h: APPROVAL_SIGN_H, paras: para("",
|
|
23269
|
+
(_, c) => tc({ bf: bfAt(1, c), row: 1, col: c, w: APPROVAL_COL_W, h: APPROVAL_SIGN_H, paras: para("", GONGMUN_PARA_APPROVAL, approvalCharPr) })
|
|
23191
23270
|
).join("");
|
|
23192
23271
|
const table2 = tbl([labelRow, signRow], w, APPROVAL_LABEL_H + APPROVAL_SIGN_H, n);
|
|
23193
23272
|
return `<hp:p paraPrIDRef="${GONGMUN_RIGHT}" styleIDRef="0"><hp:run charPrIDRef="${CHAR_NORMAL}">${table2}</hp:run></hp:p>`;
|
|
@@ -23199,13 +23278,13 @@ function buildEndMark() {
|
|
|
23199
23278
|
return para(" \uB05D.", PARA_NORMAL, CHAR_NORMAL);
|
|
23200
23279
|
}
|
|
23201
23280
|
var TITLE_BOX = { barH: 382, titleH: 2850, color: "#0080C0", gradient: ["#0080C0", "#3CBFFF"] };
|
|
23202
|
-
function buildTitleBox(title, titleCharPr, bodyWidth, reg) {
|
|
23281
|
+
function buildTitleBox(title, titleCharPr, barCharPr, bodyWidth, reg) {
|
|
23203
23282
|
const w = bodyWidth - 280;
|
|
23204
23283
|
const outer = { t: "thin", b: "thin", l: "thin", r: "thin" };
|
|
23205
23284
|
const barTop = reg.get({ ...outer, fill: TITLE_BOX.color });
|
|
23206
23285
|
const barBottom = reg.get({ ...outer, fill: { gradient: TITLE_BOX.gradient } });
|
|
23207
23286
|
const mid = reg.get(outer);
|
|
23208
|
-
const barPara =
|
|
23287
|
+
const barPara = para("", GJ_PARA_BAR, barCharPr);
|
|
23209
23288
|
const rows = [
|
|
23210
23289
|
tc({ bf: barTop, row: 0, col: 0, w, h: TITLE_BOX.barH, paras: barPara }),
|
|
23211
23290
|
tc({ bf: mid, row: 1, col: 0, w, h: TITLE_BOX.titleH, paras: para(title, GONGMUN_TBL_CENTER, titleCharPr) }),
|
|
@@ -23222,8 +23301,8 @@ function docframeIds(base) {
|
|
|
23222
23301
|
function docframeActive(g) {
|
|
23223
23302
|
return !!(g.docHead || g.docFoot || g.reportInfo || g.noticeHead || g.press);
|
|
23224
23303
|
}
|
|
23225
|
-
function docframeCharPrXmls(base,
|
|
23226
|
-
const body =
|
|
23304
|
+
function docframeCharPrXmls(base, richAssets) {
|
|
23305
|
+
const body = richAssets ? 4 : 0;
|
|
23227
23306
|
const ids = docframeIds(base);
|
|
23228
23307
|
return [
|
|
23229
23308
|
charPr(ids.org, 1800, true, false, body),
|
|
@@ -23630,15 +23709,16 @@ function blocksToSectionXml(blocks, theme, gongmun, gongmunList = gongmun ? prec
|
|
|
23630
23709
|
let prevWasOrdered = false;
|
|
23631
23710
|
const gaejosik = _optionalChain([gongmun, 'optionalAccess', _251 => _251.preset]) === "gaejosik";
|
|
23632
23711
|
const measured = !!gongmun && usesReportFonts(gongmun.preset);
|
|
23633
|
-
const
|
|
23712
|
+
const richAssets = !!gongmun && needsGaejosikAssets(gongmun);
|
|
23713
|
+
const vBase = charVariantBase(richAssets, !!gongmun);
|
|
23634
23714
|
const tableStyle = gongmun ? {
|
|
23635
23715
|
totalWidth: mmToHwpunit(210 - gongmun.margins.left - gongmun.margins.right),
|
|
23636
23716
|
// 표 셀 크기 — 실측: 실측 프리셋 맑은 고딕 12pt(22·23), 비실측도 12pt(11·12,
|
|
23637
23717
|
// 실결재 지배값 — 본문 크기 셀은 열폭 부족으로 서술 열 세로 신장, v4.0.2 QA)
|
|
23638
|
-
charPr:
|
|
23639
|
-
boldCharPr:
|
|
23640
|
-
charHeight:
|
|
23641
|
-
headerBf: gongmunTableHeaderBf(
|
|
23718
|
+
charPr: richAssets ? GJ_CHAR_TABLE : GONGMUN_TBL_CHAR,
|
|
23719
|
+
boldCharPr: richAssets ? GJ_CHAR_TABLE_BOLD : GONGMUN_TBL_CHAR_BOLD,
|
|
23720
|
+
charHeight: richAssets ? gaejosikSizes(gongmun.bodyHeight, gongmun.sizes).table : GONGMUN_TBL_PT,
|
|
23721
|
+
headerBf: gongmunTableHeaderBf(richAssets),
|
|
23642
23722
|
centerParaPr: GONGMUN_CENTER,
|
|
23643
23723
|
tblCenterParaPr: GONGMUN_TBL_CENTER,
|
|
23644
23724
|
tblLeftParaPr: GONGMUN_TBL_LEFT,
|
|
@@ -23659,7 +23739,7 @@ function blocksToSectionXml(blocks, theme, gongmun, gongmunList = gongmun ? prec
|
|
|
23659
23739
|
preamble.push(buildReportInfo(gongmun, dfIds));
|
|
23660
23740
|
}
|
|
23661
23741
|
if (_optionalChain([gongmun, 'optionalAccess', _253 => _253.approval]) && bfReg) {
|
|
23662
|
-
preamble.push(buildApprovalTable(gongmun.approval,
|
|
23742
|
+
preamble.push(buildApprovalTable(gongmun.approval, bfReg, richAssets ? GJ_CHAR_APPROVAL : GONGMUN_APPROVAL_CHAR));
|
|
23663
23743
|
}
|
|
23664
23744
|
if (_optionalChain([gongmun, 'optionalAccess', _254 => _254.docHead]) && dfIds) {
|
|
23665
23745
|
preamble.push(...buildDocHead(gongmun, dfIds));
|
|
@@ -23670,7 +23750,7 @@ function blocksToSectionXml(blocks, theme, gongmun, gongmunList = gongmun ? prec
|
|
|
23670
23750
|
if (_optionalChain([gongmun, 'optionalAccess', _256 => _256.press]) && dfIds && bfReg && tableStyle) {
|
|
23671
23751
|
preamble.push(...buildPressHead(gongmun, dfIds, tableStyle.totalWidth, bfReg));
|
|
23672
23752
|
}
|
|
23673
|
-
if (
|
|
23753
|
+
if (gongmun && (gongmun.cover || gongmun.toc)) {
|
|
23674
23754
|
const h1Idx = blocks.findIndex((b) => b.type === "heading" && (_nullishCoalesce(b.level, () => ( 1))) === 1);
|
|
23675
23755
|
const chapters = blocks.filter((b) => b.type === "heading" && b.level === 2).map((b) => stripChapterNumber(b.text || ""));
|
|
23676
23756
|
let coverTitle = "";
|
|
@@ -23692,9 +23772,10 @@ function blocksToSectionXml(blocks, theme, gongmun, gongmunList = gongmun ? prec
|
|
|
23692
23772
|
if (gongmun.bodyTitleBox && coverTitle && hasFrontPages) {
|
|
23693
23773
|
preamble.push(buildGaejosikBodyTitle(coverTitle, gongmun).replace(/^<hp:p /, `<hp:p pageBreak="1" `));
|
|
23694
23774
|
}
|
|
23695
|
-
}
|
|
23775
|
+
}
|
|
23776
|
+
if (gongmun && !gaejosik && coverH1Idx < 0 && bfReg && (gongmun.preset === "report" || gongmun.preset === "plan" || gongmun.preset === "notice")) {
|
|
23696
23777
|
titleBoxH1Idx = blocks.findIndex((b) => b.type === "heading" && (_nullishCoalesce(b.level, () => ( 1))) === 1);
|
|
23697
|
-
} else if (_optionalChain([gongmun, 'optionalAccess', _257 => _257.press]) && dfIds) {
|
|
23778
|
+
} else if (_optionalChain([gongmun, 'optionalAccess', _257 => _257.press]) && coverH1Idx < 0 && dfIds) {
|
|
23698
23779
|
pressH1Idx = blocks.findIndex((b) => b.type === "heading" && (_nullishCoalesce(b.level, () => ( 1))) === 1);
|
|
23699
23780
|
}
|
|
23700
23781
|
if (preamble.length > 0) {
|
|
@@ -23715,6 +23796,7 @@ function blocksToSectionXml(blocks, theme, gongmun, gongmunList = gongmun ? prec
|
|
|
23715
23796
|
}
|
|
23716
23797
|
switch (block.type) {
|
|
23717
23798
|
case "heading": {
|
|
23799
|
+
if (gongmun && blockIdx === coverH1Idx) break;
|
|
23718
23800
|
if (gongmun && blockIdx === pressH1Idx && dfIds) {
|
|
23719
23801
|
const parts = [generateParagraph((block.text || "").trim(), GONGMUN_CENTER, dfIds.pressTitle)];
|
|
23720
23802
|
for (const s of _nullishCoalesce(_optionalChain([gongmun, 'access', _258 => _258.press, 'optionalAccess', _259 => _259.sub]), () => ( []))) {
|
|
@@ -23724,12 +23806,17 @@ function blocksToSectionXml(blocks, theme, gongmun, gongmunList = gongmun ? prec
|
|
|
23724
23806
|
break;
|
|
23725
23807
|
}
|
|
23726
23808
|
if (gongmun && blockIdx === titleBoxH1Idx && tableStyle && bfReg) {
|
|
23727
|
-
xml = buildTitleBox(
|
|
23809
|
+
xml = buildTitleBox(
|
|
23810
|
+
(block.text || "").trim(),
|
|
23811
|
+
measured ? GJ_CHAR_BODY_TITLE : CHAR_H1,
|
|
23812
|
+
richAssets ? GJ_CHAR_TITLE_BAR : GONGMUN_TITLE_BAR_CHAR,
|
|
23813
|
+
tableStyle.totalWidth,
|
|
23814
|
+
bfReg
|
|
23815
|
+
);
|
|
23728
23816
|
break;
|
|
23729
23817
|
}
|
|
23730
23818
|
if (gaejosik) {
|
|
23731
23819
|
const lvl = block.level || 1;
|
|
23732
|
-
if (blockIdx === coverH1Idx) break;
|
|
23733
23820
|
if (lvl <= 2) {
|
|
23734
23821
|
chapterNo++;
|
|
23735
23822
|
xml = buildGaejosikChapter(chapterNo, stripChapterNumber(block.text || ""), gongmun);
|
|
@@ -23944,16 +24031,16 @@ function blocksToSectionXml(blocks, theme, gongmun, gongmunList = gongmun ? prec
|
|
|
23944
24031
|
async function markdownToHwpx(markdown, options) {
|
|
23945
24032
|
const theme = resolveTheme(_optionalChain([options, 'optionalAccess', _271 => _271.theme]));
|
|
23946
24033
|
const gongmun = _optionalChain([options, 'optionalAccess', _272 => _272.gongmun]) ? resolveGongmun(options.gongmun) : null;
|
|
23947
|
-
const gaejosik = _optionalChain([gongmun, 'optionalAccess', _273 => _273.preset]) === "gaejosik";
|
|
23948
24034
|
const measured = !!gongmun && usesReportFonts(gongmun.preset);
|
|
24035
|
+
const richAssets = !!gongmun && needsGaejosikAssets(gongmun);
|
|
23949
24036
|
const blocks = parseMarkdownToBlocks(markdown);
|
|
23950
24037
|
const gongmunList = gongmun ? precomputeGongmunList(blocks, gongmun) : null;
|
|
23951
24038
|
const fit = gongmun && gongmunList ? computeGongmunFitPlan(blocks, gongmun, gongmunList) : null;
|
|
23952
|
-
const staticBfEnd = gongmun ?
|
|
23953
|
-
const remap = _optionalChain([options, 'optionalAccess',
|
|
23954
|
-
const bfReg = gongmun ? new TableBfRegistry(staticBfEnd + (_nullishCoalesce(_optionalChain([remap, 'optionalAccess',
|
|
24039
|
+
const staticBfEnd = gongmun ? richAssets ? 11 : 4 : 3;
|
|
24040
|
+
const remap = _optionalChain([options, 'optionalAccess', _273 => _273.profile]) ? buildProfileRemap(options.profile, charVariantBase(richAssets, !!gongmun) + (_nullishCoalesce(_optionalChain([fit, 'optionalAccess', _274 => _274.variants, 'optionalAccess', _275 => _275.length]), () => ( 0))) * 4, staticBfEnd) : null;
|
|
24041
|
+
const bfReg = gongmun ? new TableBfRegistry(staticBfEnd + (_nullishCoalesce(_optionalChain([remap, 'optionalAccess', _276 => _276.borderFillXmls, 'access', _277 => _277.length]), () => ( 0)))) : null;
|
|
23955
24042
|
const dfActive = !!gongmun && docframeActive(gongmun);
|
|
23956
|
-
const dfBase = charVariantBase(
|
|
24043
|
+
const dfBase = charVariantBase(richAssets, !!gongmun) + (_nullishCoalesce(_optionalChain([fit, 'optionalAccess', _278 => _278.variants, 'optionalAccess', _279 => _279.length]), () => ( 0))) * 4 + (_nullishCoalesce(_optionalChain([remap, 'optionalAccess', _280 => _280.charPrXmls, 'access', _281 => _281.length]), () => ( 0)));
|
|
23957
24044
|
const dfIds = dfActive ? docframeIds(dfBase) : null;
|
|
23958
24045
|
const chartParts = [];
|
|
23959
24046
|
const sectionXml = blocksToSectionXml(blocks, theme, gongmun, gongmunList, fit, chartParts, bfReg, remap, dfIds);
|
|
@@ -23963,7 +24050,7 @@ async function markdownToHwpx(markdown, options) {
|
|
|
23963
24050
|
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)`);
|
|
23964
24051
|
}
|
|
23965
24052
|
}
|
|
23966
|
-
const extraBorderFills = [..._nullishCoalesce(_optionalChain([remap, 'optionalAccess',
|
|
24053
|
+
const extraBorderFills = [..._nullishCoalesce(_optionalChain([remap, 'optionalAccess', _282 => _282.borderFillXmls]), () => ( [])), ..._nullishCoalesce(_optionalChain([bfReg, 'optionalAccess', _283 => _283.emit, 'call', _284 => _284()]), () => ( []))];
|
|
23967
24054
|
const zip = new (0, _jszip2.default)();
|
|
23968
24055
|
zip.file("mimetype", "application/hwp+zip", { compression: "STORE" });
|
|
23969
24056
|
zip.file("META-INF/container.xml", generateContainerXml());
|
|
@@ -23971,9 +24058,9 @@ async function markdownToHwpx(markdown, options) {
|
|
|
23971
24058
|
zip.file("Contents/header.xml", generateHeaderXml(
|
|
23972
24059
|
theme,
|
|
23973
24060
|
gongmun,
|
|
23974
|
-
_nullishCoalesce(_optionalChain([fit, 'optionalAccess',
|
|
24061
|
+
_nullishCoalesce(_optionalChain([fit, 'optionalAccess', _285 => _285.variants]), () => ( [])),
|
|
23975
24062
|
extraBorderFills,
|
|
23976
|
-
[..._nullishCoalesce(_optionalChain([remap, 'optionalAccess',
|
|
24063
|
+
[..._nullishCoalesce(_optionalChain([remap, 'optionalAccess', _286 => _286.charPrXmls]), () => ( [])), ...dfActive ? docframeCharPrXmls(dfBase, richAssets) : []]
|
|
23977
24064
|
));
|
|
23978
24065
|
zip.file("Contents/section0.xml", sectionXml);
|
|
23979
24066
|
for (const part of chartParts) zip.file(part.name, part.xml);
|
|
@@ -24268,7 +24355,7 @@ function parseRenderStyles(headXml) {
|
|
|
24268
24355
|
const underlineEl = findChildByLocalName(el, "underline");
|
|
24269
24356
|
const textColor = el.getAttribute("textColor");
|
|
24270
24357
|
const fontRef = findChildByLocalName(el, "fontRef");
|
|
24271
|
-
const fontId = _nullishCoalesce(_optionalChain([fontRef, 'optionalAccess',
|
|
24358
|
+
const fontId = _nullishCoalesce(_optionalChain([fontRef, 'optionalAccess', _287 => _287.getAttribute, 'call', _288 => _288("hangul")]), () => ( _optionalChain([fontRef, 'optionalAccess', _289 => _289.getAttribute, 'call', _290 => _290("latin")])));
|
|
24272
24359
|
const face = fontId != null ? hangulFonts.get(fontId) : void 0;
|
|
24273
24360
|
styles.charPr.set(id, {
|
|
24274
24361
|
height: Number(el.getAttribute("height")) || 1e3,
|
|
@@ -24276,8 +24363,8 @@ function parseRenderStyles(headXml) {
|
|
|
24276
24363
|
italic: findChildByLocalName(el, "italic") != null,
|
|
24277
24364
|
underline: underlineEl != null && (_nullishCoalesce(underlineEl.getAttribute("type"), () => ( "NONE"))) !== "NONE",
|
|
24278
24365
|
color: textColor && textColor !== "#000000" && textColor.toLowerCase() !== "none" ? textColor : void 0,
|
|
24279
|
-
ratio: Number(_optionalChain([ratioEl, 'optionalAccess',
|
|
24280
|
-
spacing: Number(_optionalChain([spacingEl, 'optionalAccess',
|
|
24366
|
+
ratio: Number(_optionalChain([ratioEl, 'optionalAccess', _291 => _291.getAttribute, 'call', _292 => _292("hangul")])) || 100,
|
|
24367
|
+
spacing: Number(_optionalChain([spacingEl, 'optionalAccess', _293 => _293.getAttribute, 'call', _294 => _294("hangul")])) || 0,
|
|
24281
24368
|
fontFamily: face ? hwpFaceToCssStack(face) : void 0
|
|
24282
24369
|
});
|
|
24283
24370
|
}
|
|
@@ -24285,7 +24372,7 @@ function parseRenderStyles(headXml) {
|
|
|
24285
24372
|
const id = el.getAttribute("id");
|
|
24286
24373
|
if (id != null) {
|
|
24287
24374
|
const align = findChildByLocalName(el, "align");
|
|
24288
|
-
styles.paraAlign.set(id, _optionalChain([align, 'optionalAccess',
|
|
24375
|
+
styles.paraAlign.set(id, _optionalChain([align, 'optionalAccess', _295 => _295.getAttribute, 'call', _296 => _296("horizontal")]) || "JUSTIFY");
|
|
24289
24376
|
styles.paraGeom.set(id, parseParaGeom(el));
|
|
24290
24377
|
}
|
|
24291
24378
|
} else if (tag === "borderFill") {
|
|
@@ -24299,7 +24386,7 @@ function parseRenderStyles(headXml) {
|
|
|
24299
24386
|
};
|
|
24300
24387
|
const fillBrush = findChildByLocalName(el, "fillBrush");
|
|
24301
24388
|
const winBrush = fillBrush ? findChildByLocalName(fillBrush, "winBrush") : null;
|
|
24302
|
-
const face = _optionalChain([winBrush, 'optionalAccess',
|
|
24389
|
+
const face = _optionalChain([winBrush, 'optionalAccess', _297 => _297.getAttribute, 'call', _298 => _298("faceColor")]);
|
|
24303
24390
|
if (face && face.toLowerCase() !== "none") bf.fill = face;
|
|
24304
24391
|
styles.borderFill.set(id, bf);
|
|
24305
24392
|
}
|
|
@@ -24371,7 +24458,7 @@ function collectSites(scan) {
|
|
|
24371
24458
|
}
|
|
24372
24459
|
function attrOf(openTag, name) {
|
|
24373
24460
|
const m = openTag.match(new RegExp(`\\b${name}="([^"]*)"`));
|
|
24374
|
-
return _optionalChain([m, 'optionalAccess',
|
|
24461
|
+
return _optionalChain([m, 'optionalAccess', _299 => _299[1]]);
|
|
24375
24462
|
}
|
|
24376
24463
|
function paraOpenTag(xml, para2) {
|
|
24377
24464
|
const end = xml.indexOf(">", para2.start);
|
|
@@ -24386,7 +24473,7 @@ function anchorRunInfo(xml, para2, anchor) {
|
|
|
24386
24473
|
if (!tr) return null;
|
|
24387
24474
|
const before = xml.slice(Math.max(0, para2.start), tr.contentStart);
|
|
24388
24475
|
const runOpen = [...before.matchAll(/<([A-Za-z0-9]+):run\b[^>]*>/g)].pop();
|
|
24389
|
-
const prefix = _nullishCoalesce(_nullishCoalesce(_optionalChain([runOpen, 'optionalAccess',
|
|
24476
|
+
const prefix = _nullishCoalesce(_nullishCoalesce(_optionalChain([runOpen, 'optionalAccess', _300 => _300[1]]), () => ( tr.prefix)), () => ( "hp"));
|
|
24390
24477
|
const charPr2 = runOpen && attrOf(runOpen[0], "charPrIDRef") || "0";
|
|
24391
24478
|
const close = xml.indexOf(`</${prefix}:run>`, tr.contentEnd);
|
|
24392
24479
|
if (close === -1) return null;
|
|
@@ -24413,7 +24500,7 @@ function cellContentWidthMm(xml, cell2) {
|
|
|
24413
24500
|
if (width === null) return null;
|
|
24414
24501
|
let content = width;
|
|
24415
24502
|
const win = cellAddrWindow(xml, cell2);
|
|
24416
|
-
const mg = _optionalChain([win, 'optionalAccess',
|
|
24503
|
+
const mg = _optionalChain([win, 'optionalAccess', _301 => _301.match, 'call', _302 => _302(/<[A-Za-z0-9]+:cellMargin\b[^>]*>/)]);
|
|
24417
24504
|
if (mg) {
|
|
24418
24505
|
content -= Number(_nullishCoalesce(attrOf(mg[0], "left"), () => ( 0))) + Number(_nullishCoalesce(attrOf(mg[0], "right"), () => ( 0)));
|
|
24419
24506
|
}
|
|
@@ -24447,11 +24534,11 @@ function buildFloatPicXml(itemId, sizeHu, posXHu, posYHu, ids) {
|
|
|
24447
24534
|
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>`;
|
|
24448
24535
|
}
|
|
24449
24536
|
async function placeSealHwpx(hwpxBuffer, ops) {
|
|
24450
|
-
if (ops.length === 0) throw new (0,
|
|
24537
|
+
if (ops.length === 0) throw new (0, _chunkOVESZY5Rcjs.KordocError)("place_seal: \uBC30\uCE58\uD560 \uB3C4\uC7A5\uC774 \uC5C6\uC2B5\uB2C8\uB2E4");
|
|
24451
24538
|
const u8 = new Uint8Array(hwpxBuffer);
|
|
24452
24539
|
const zip = await _jszip2.default.loadAsync(hwpxBuffer);
|
|
24453
|
-
const sectionPaths = Object.keys(zip.files).filter((name) => /[Ss]ection\d+\.xml$/i.test(name)).sort((a, b) => Number(_nullishCoalesce(_optionalChain([a, 'access',
|
|
24454
|
-
if (sectionPaths.length === 0) throw new (0,
|
|
24540
|
+
const sectionPaths = Object.keys(zip.files).filter((name) => /[Ss]ection\d+\.xml$/i.test(name)).sort((a, b) => Number(_nullishCoalesce(_optionalChain([a, 'access', _303 => _303.match, 'call', _304 => _304(/(\d+)\.xml$/i), 'optionalAccess', _305 => _305[1]]), () => ( 0))) - Number(_nullishCoalesce(_optionalChain([b, 'access', _306 => _306.match, 'call', _307 => _307(/(\d+)\.xml$/i), 'optionalAccess', _308 => _308[1]]), () => ( 0))));
|
|
24541
|
+
if (sectionPaths.length === 0) throw new (0, _chunkOVESZY5Rcjs.KordocError)("HWPX\uC5D0\uC11C \uC139\uC158 \uD30C\uC77C\uC744 \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4");
|
|
24455
24542
|
const manifestPath = Object.keys(zip.files).find((name) => /\.hpf$/i.test(name));
|
|
24456
24543
|
const headerPath = Object.keys(zip.files).find((name) => /(^|\/)header\.xml$/i.test(name));
|
|
24457
24544
|
const styles = headerPath ? parseRenderStyles(await zip.file(headerPath).async("text")) : null;
|
|
@@ -24492,11 +24579,11 @@ async function placeSealHwpx(hwpxBuffer, ops) {
|
|
|
24492
24579
|
const manifestItems = [];
|
|
24493
24580
|
const placed = [];
|
|
24494
24581
|
for (const op of ops) {
|
|
24495
|
-
if (!op.anchor) throw new (0,
|
|
24496
|
-
if (!op.image || op.image.length === 0) throw new (0,
|
|
24582
|
+
if (!op.anchor) throw new (0, _chunkOVESZY5Rcjs.KordocError)("place_seal: anchor \uBB38\uAD6C\uAC00 \uD544\uC694\uD569\uB2C8\uB2E4");
|
|
24583
|
+
if (!op.image || op.image.length === 0) throw new (0, _chunkOVESZY5Rcjs.KordocError)("place_seal: \uB3C4\uC7A5 \uC774\uBBF8\uC9C0\uAC00 \uD544\uC694\uD569\uB2C8\uB2E4");
|
|
24497
24584
|
const ext = (_nullishCoalesce(op.ext, () => ( "png"))).toLowerCase();
|
|
24498
|
-
if (!MIME[ext]) throw new (0,
|
|
24499
|
-
if (!imageMagicMatches(op.image, ext)) throw new (0,
|
|
24585
|
+
if (!MIME[ext]) throw new (0, _chunkOVESZY5Rcjs.KordocError)(`place_seal: \uC9C0\uC6D0\uD558\uC9C0 \uC54A\uB294 \uC774\uBBF8\uC9C0 \uD655\uC7A5\uC790 .${ext} (png/jpg/bmp/gif)`);
|
|
24586
|
+
if (!imageMagicMatches(op.image, ext)) throw new (0, _chunkOVESZY5Rcjs.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)`);
|
|
24500
24587
|
const wantOcc = _nullishCoalesce(op.occurrence, () => ( 0));
|
|
24501
24588
|
let found = null;
|
|
24502
24589
|
let total = 0;
|
|
@@ -24529,7 +24616,7 @@ async function placeSealHwpx(hwpxBuffer, ops) {
|
|
|
24529
24616
|
}
|
|
24530
24617
|
}
|
|
24531
24618
|
}
|
|
24532
|
-
throw new (0,
|
|
24619
|
+
throw new (0, _chunkOVESZY5Rcjs.KordocError)(
|
|
24533
24620
|
`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)})`
|
|
24534
24621
|
);
|
|
24535
24622
|
}
|
|
@@ -24537,9 +24624,9 @@ async function placeSealHwpx(hwpxBuffer, ops) {
|
|
|
24537
24624
|
const xml = sectionXmls[si];
|
|
24538
24625
|
const run = anchorRunInfo(xml, site.para, op.anchor);
|
|
24539
24626
|
if (!run) {
|
|
24540
|
-
throw new (0,
|
|
24627
|
+
throw new (0, _chunkOVESZY5Rcjs.KordocError)(`place_seal: \uC575\uCEE4 "${op.anchor}" \uBB38\uB2E8\uC5D0\uC11C run\uC744 \uCC3E\uC9C0 \uBABB\uD588\uC2B5\uB2C8\uB2E4`);
|
|
24541
24628
|
}
|
|
24542
|
-
const charPrHeight = _nullishCoalesce(_optionalChain([styles, 'optionalAccess',
|
|
24629
|
+
const charPrHeight = _nullishCoalesce(_optionalChain([styles, 'optionalAccess', _309 => _309.charPr, 'access', _310 => _310.get, 'call', _311 => _311(run.charPr), 'optionalAccess', _312 => _312.height]), () => ( 1e3));
|
|
24543
24630
|
const fontPt = charPrHeight / 100;
|
|
24544
24631
|
const emMm = fontPt * 25.4 / 72;
|
|
24545
24632
|
const lineHMm = emMm;
|
|
@@ -24548,7 +24635,7 @@ async function placeSealHwpx(hwpxBuffer, ops) {
|
|
|
24548
24635
|
const sizeMm = op.sizeMm != null && Number.isFinite(op.sizeMm) && op.sizeMm > 0 ? op.sizeMm : Math.max(7, Math.min(18, lineHMm * 1.6));
|
|
24549
24636
|
const availMm = _nullishCoalesce((site.cell ? cellContentWidthMm(xml, site.cell) : null), () => ( bodyColumnWidthMm(xml)));
|
|
24550
24637
|
const paraPrId = _nullishCoalesce(attrOf(paraOpenTag(xml, site.para), "paraPrIDRef"), () => ( "0"));
|
|
24551
|
-
const align = _optionalChain([styles, 'optionalAccess',
|
|
24638
|
+
const align = _optionalChain([styles, 'optionalAccess', _313 => _313.paraAlign, 'access', _314 => _314.get, 'call', _315 => _315(paraPrId)]);
|
|
24552
24639
|
let alignShiftMm = 0;
|
|
24553
24640
|
if (align === "CENTER" || align === "RIGHT") {
|
|
24554
24641
|
const paraWMm = measureMm(site.para.text, emMm);
|
|
@@ -24644,7 +24731,7 @@ function parseBorderFills(headerDoc) {
|
|
|
24644
24731
|
};
|
|
24645
24732
|
const fillBrush = findChildByLocalName(bf, "fillBrush");
|
|
24646
24733
|
const winBrush = fillBrush ? findChildByLocalName(fillBrush, "winBrush") : null;
|
|
24647
|
-
const face = _optionalChain([winBrush, 'optionalAccess',
|
|
24734
|
+
const face = _optionalChain([winBrush, 'optionalAccess', _316 => _316.getAttribute, 'call', _317 => _317("faceColor")]);
|
|
24648
24735
|
if (face && face !== "none") def.fill = { faceColor: face };
|
|
24649
24736
|
map.set(id, def);
|
|
24650
24737
|
}
|
|
@@ -24664,7 +24751,7 @@ function parseCharPrs(headerDoc) {
|
|
|
24664
24751
|
if (cp.getAttribute("italic") === "1") def.italic = true;
|
|
24665
24752
|
if (findChildByLocalName(cp, "underline")) def.underline = true;
|
|
24666
24753
|
const fontRef = findChildByLocalName(cp, "fontRef");
|
|
24667
|
-
const hangul = _optionalChain([fontRef, 'optionalAccess',
|
|
24754
|
+
const hangul = _optionalChain([fontRef, 'optionalAccess', _318 => _318.getAttribute, 'call', _319 => _319("hangul")]);
|
|
24668
24755
|
if (hangul) def.fontRef_hangul = hangul;
|
|
24669
24756
|
map.set(id, def);
|
|
24670
24757
|
}
|
|
@@ -24688,7 +24775,7 @@ function parseTable3(tbl2, tableIndex, borderFills, charPrs) {
|
|
|
24688
24775
|
const rows = _nullishCoalesce(num(tbl2.getAttribute("rowCnt")), () => ( 0));
|
|
24689
24776
|
const cols = _nullishCoalesce(num(tbl2.getAttribute("colCnt")), () => ( 0));
|
|
24690
24777
|
const sz = findChildByLocalName(tbl2, "sz");
|
|
24691
|
-
const width = _optionalChain([sz, 'optionalAccess',
|
|
24778
|
+
const width = _optionalChain([sz, 'optionalAccess', _320 => _320.getAttribute, 'call', _321 => _321("width")]) || void 0;
|
|
24692
24779
|
const cells = [];
|
|
24693
24780
|
const usedBf = /* @__PURE__ */ new Set();
|
|
24694
24781
|
const usedCp = /* @__PURE__ */ new Set();
|
|
@@ -24699,16 +24786,16 @@ function parseTable3(tbl2, tableIndex, borderFills, charPrs) {
|
|
|
24699
24786
|
const addr = findChildByLocalName(tc2, "cellAddr");
|
|
24700
24787
|
const span = findChildByLocalName(tc2, "cellSpan");
|
|
24701
24788
|
const csz = findChildByLocalName(tc2, "cellSz");
|
|
24702
|
-
const row = _nullishCoalesce(num(_optionalChain([addr, 'optionalAccess',
|
|
24703
|
-
const col = _nullishCoalesce(num(_optionalChain([addr, 'optionalAccess',
|
|
24789
|
+
const row = _nullishCoalesce(num(_optionalChain([addr, 'optionalAccess', _322 => _322.getAttribute, 'call', _323 => _323("rowAddr")])), () => ( 0));
|
|
24790
|
+
const col = _nullishCoalesce(num(_optionalChain([addr, 'optionalAccess', _324 => _324.getAttribute, 'call', _325 => _325("colAddr")])), () => ( 0));
|
|
24704
24791
|
if (row === 0 && col === 0 && !anchorText) anchorText = directCellText(tc2);
|
|
24705
|
-
const colSpan = _nullishCoalesce(num(_optionalChain([span, 'optionalAccess',
|
|
24706
|
-
const rowSpan = _nullishCoalesce(num(_optionalChain([span, 'optionalAccess',
|
|
24792
|
+
const colSpan = _nullishCoalesce(num(_optionalChain([span, 'optionalAccess', _326 => _326.getAttribute, 'call', _327 => _327("colSpan")])), () => ( 1));
|
|
24793
|
+
const rowSpan = _nullishCoalesce(num(_optionalChain([span, 'optionalAccess', _328 => _328.getAttribute, 'call', _329 => _329("rowSpan")])), () => ( 1));
|
|
24707
24794
|
const bfId = tc2.getAttribute("borderFillIDRef") || void 0;
|
|
24708
24795
|
const cpId = firstRunCharPr(tc2);
|
|
24709
24796
|
const cell2 = { row, col, rowSpan, colSpan };
|
|
24710
|
-
const w = _optionalChain([csz, 'optionalAccess',
|
|
24711
|
-
const hh = _optionalChain([csz, 'optionalAccess',
|
|
24797
|
+
const w = _optionalChain([csz, 'optionalAccess', _330 => _330.getAttribute, 'call', _331 => _331("width")]);
|
|
24798
|
+
const hh = _optionalChain([csz, 'optionalAccess', _332 => _332.getAttribute, 'call', _333 => _333("height")]);
|
|
24712
24799
|
if (w) cell2.width_hwpunit = w;
|
|
24713
24800
|
if (hh) cell2.height_hwpunit = hh;
|
|
24714
24801
|
if (bfId) {
|
|
@@ -24781,16 +24868,16 @@ function pick(map, keys) {
|
|
|
24781
24868
|
return out;
|
|
24782
24869
|
}
|
|
24783
24870
|
async function hwpxToProfile(input) {
|
|
24784
|
-
const buf = input instanceof ArrayBuffer ? input :
|
|
24871
|
+
const buf = input instanceof ArrayBuffer ? input : _chunkOVESZY5Rcjs.toArrayBuffer.call(void 0, input);
|
|
24785
24872
|
const zip = await _jszip2.default.loadAsync(buf);
|
|
24786
24873
|
const parser = createXmlParser();
|
|
24787
|
-
const headerFile = _nullishCoalesce(zip.file("Contents/header.xml"), () => ( _optionalChain([zip, 'access',
|
|
24874
|
+
const headerFile = _nullishCoalesce(zip.file("Contents/header.xml"), () => ( _optionalChain([zip, 'access', _334 => _334.file, 'call', _335 => _335(/[Hh]eader\.xml$/), 'optionalAccess', _336 => _336[0]])));
|
|
24788
24875
|
let headerXml = "<root/>";
|
|
24789
24876
|
if (headerFile) headerXml = await headerFile.async("text");
|
|
24790
24877
|
const headerDoc = parser.parseFromString(headerXml, "text/xml");
|
|
24791
24878
|
const borderFills = parseBorderFills(headerDoc);
|
|
24792
24879
|
const charPrs = parseCharPrs(headerDoc);
|
|
24793
|
-
const sectionFiles = zip.file(/[Ss]ection\d+\.xml$/).sort((a, b) => (_nullishCoalesce(num(_nullishCoalesce(_optionalChain([a, 'access',
|
|
24880
|
+
const sectionFiles = zip.file(/[Ss]ection\d+\.xml$/).sort((a, b) => (_nullishCoalesce(num(_nullishCoalesce(_optionalChain([a, 'access', _337 => _337.name, 'access', _338 => _338.match, 'call', _339 => _339(/(\d+)\.xml$/), 'optionalAccess', _340 => _340[1]]), () => ( null))), () => ( 0))) - (_nullishCoalesce(num(_nullishCoalesce(_optionalChain([b, 'access', _341 => _341.name, 'access', _342 => _342.match, 'call', _343 => _343(/(\d+)\.xml$/), 'optionalAccess', _344 => _344[1]]), () => ( null))), () => ( 0))));
|
|
24794
24881
|
const tables = [];
|
|
24795
24882
|
let tableIndex = 0;
|
|
24796
24883
|
for (const f of sectionFiles) {
|
|
@@ -25101,7 +25188,7 @@ var ROW_OBJECT_RE = /<(?:[A-Za-z0-9_]+:)?(?:tbl|pic|equation|ole|container|shape
|
|
|
25101
25188
|
var TAG_AT_RE = /<[A-Za-z0-9_:]+(?:"[^"]*"|'[^']*'|[^>"'])*>/y;
|
|
25102
25189
|
function patchTableRows(input) {
|
|
25103
25190
|
const { table: table2, scanTable, ctx, skip, origKeys, editedKeys } = input;
|
|
25104
|
-
const xml = _optionalChain([ctx, 'access',
|
|
25191
|
+
const xml = _optionalChain([ctx, 'access', _345 => _345.scans, 'access', _346 => _346[scanTable.sectionIndex], 'optionalAccess', _347 => _347.xml]);
|
|
25105
25192
|
if (!xml) return skip("\uC139\uC158 XML \uB9E4\uD551 \uC2E4\uD328");
|
|
25106
25193
|
const numRows = table2.rows;
|
|
25107
25194
|
if (origKeys.length !== numRows) return skip("\uD45C \uD589 \uC88C\uD45C \uBD88\uC77C\uCE58 \u2014 \uD589 \uCD94\uAC00/\uC0AD\uC81C \uBBF8\uC9C0\uC6D0");
|
|
@@ -25268,7 +25355,7 @@ function buildRowFragment(xml, scanTable, template, cells, finalRow, hasExplicit
|
|
|
25268
25355
|
const rr = scanTable.rowRanges[template];
|
|
25269
25356
|
const wrapped = FRAG_OPEN + xml.slice(rr.start, rr.end) + FRAG_CLOSE;
|
|
25270
25357
|
const scan = scanSectionXml(wrapped, 0);
|
|
25271
|
-
const row = _optionalChain([scan, 'access',
|
|
25358
|
+
const row = _optionalChain([scan, 'access', _348 => _348.tables, 'access', _349 => _349[0], 'optionalAccess', _350 => _350.rows, 'access', _351 => _351[0]]);
|
|
25272
25359
|
if (!row || row.length !== cells.length) return null;
|
|
25273
25360
|
const splices = allLinesegRemovalSplices(wrapped);
|
|
25274
25361
|
for (let i = 0; i < cells.length; i++) {
|
|
@@ -25311,7 +25398,7 @@ function rowHeightOf(fragment) {
|
|
|
25311
25398
|
}
|
|
25312
25399
|
function tableSzHeightSplice(xml, scanTable, tblOpenLen, delta) {
|
|
25313
25400
|
const from = scanTable.start + tblOpenLen;
|
|
25314
|
-
const to = _nullishCoalesce(_optionalChain([scanTable, 'access',
|
|
25401
|
+
const to = _nullishCoalesce(_optionalChain([scanTable, 'access', _352 => _352.rowRanges, 'access', _353 => _353[0], 'optionalAccess', _354 => _354.start]), () => ( from));
|
|
25315
25402
|
const slice = xml.slice(from, to);
|
|
25316
25403
|
const szM = slice.match(/<(?:[A-Za-z0-9_]+:)?sz\b(?:"[^"]*"|'[^']*'|[^>"'])*>/);
|
|
25317
25404
|
if (!szM || szM.index === void 0) return null;
|
|
@@ -25500,9 +25587,9 @@ function patchHtmlTableRows(table2, scanTable, replica, editedRows, ctx, skip, d
|
|
|
25500
25587
|
});
|
|
25501
25588
|
}
|
|
25502
25589
|
function patchNestedTables(table2, scanTable, oc, origTables, editedTables, ctx, skip, depth) {
|
|
25503
|
-
const irCell = _optionalChain([table2, 'access',
|
|
25590
|
+
const irCell = _optionalChain([table2, 'access', _355 => _355.cells, 'access', _356 => _356[oc.gridR], 'optionalAccess', _357 => _357[oc.gridC]]);
|
|
25504
25591
|
const scanCell = scanTable.cellByAnchor.get(`${oc.gridR},${oc.gridC}`);
|
|
25505
|
-
const nestedIRs = (_nullishCoalesce(_optionalChain([irCell, 'optionalAccess',
|
|
25592
|
+
const nestedIRs = (_nullishCoalesce(_optionalChain([irCell, 'optionalAccess', _358 => _358.blocks]), () => ( []))).filter((b) => b.type === "table" && b.table).map((b) => b.table);
|
|
25506
25593
|
if (!scanCell || nestedIRs.length !== origTables.length || scanCell.tables.length !== origTables.length) {
|
|
25507
25594
|
return skip("\uC911\uCCA9\uD45C \uC18C\uC2A4\uB9F5 \uB9E4\uD551 \uC2E4\uD328");
|
|
25508
25595
|
}
|
|
@@ -25570,7 +25657,7 @@ function applyCellEdit(table2, scanTable, gridR, gridC, newLines, ctx, before, a
|
|
|
25570
25657
|
};
|
|
25571
25658
|
const cell2 = scanTable.cellByAnchor.get(`${gridR},${gridC}`);
|
|
25572
25659
|
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)");
|
|
25573
|
-
const irCell = _optionalChain([table2, 'access',
|
|
25660
|
+
const irCell = _optionalChain([table2, 'access', _359 => _359.cells, 'access', _360 => _360[gridR], 'optionalAccess', _361 => _361[gridC]]);
|
|
25574
25661
|
const scanJoined = cell2.paragraphs.map((p) => p.text).filter((t) => normForMatch(t)).join("\n");
|
|
25575
25662
|
if (irCell && normForMatch(scanJoined) !== normForMatch(stripCellTokens(irCell.text))) {
|
|
25576
25663
|
if (normForMatch(irCell.text) !== "" || normForMatch(scanJoined) !== "") {
|
|
@@ -25593,7 +25680,7 @@ function applyCellEdit(table2, scanTable, gridR, gridC, newLines, ctx, before, a
|
|
|
25593
25680
|
if (newLines.length === 0) return 0;
|
|
25594
25681
|
const target = cell2.paragraphs[0];
|
|
25595
25682
|
if (!target) return skip("\uBE48 \uC140\uC5D0 \uBB38\uB2E8\uC774 \uC5C6\uC5B4 \uD14D\uC2A4\uD2B8 \uC0BD\uC785 \uBD88\uAC00");
|
|
25596
|
-
const sp = buildParagraphSplices(target, newLines.join(" "), _optionalChain([ctx, 'access',
|
|
25683
|
+
const sp = buildParagraphSplices(target, newLines.join(" "), _optionalChain([ctx, 'access', _362 => _362.scans, 'access', _363 => _363[target.sectionIndex], 'optionalAccess', _364 => _364.xml]));
|
|
25597
25684
|
if (sp === null) return skip("\uC140 \uBB38\uB2E8\uC5D0 \uD14D\uC2A4\uD2B8 \uB178\uB4DC\uB97C \uB9CC\uB4E4 \uC218 \uC5C6\uC74C");
|
|
25598
25685
|
splices.push(...sp);
|
|
25599
25686
|
sectionIndex = target.sectionIndex;
|
|
@@ -25616,7 +25703,7 @@ function applyCellEdit(table2, scanTable, gridR, gridC, newLines, ctx, before, a
|
|
|
25616
25703
|
}
|
|
25617
25704
|
for (let i = 0; i < nonEmpty.length; i++) {
|
|
25618
25705
|
if (assigned[i] === nonEmpty[i].text || normForMatch(assigned[i]) === normForMatch(nonEmpty[i].text)) continue;
|
|
25619
|
-
const sp = buildParagraphSplices(nonEmpty[i], assigned[i], _optionalChain([ctx, 'access',
|
|
25706
|
+
const sp = buildParagraphSplices(nonEmpty[i], assigned[i], _optionalChain([ctx, 'access', _365 => _365.scans, 'access', _366 => _366[nonEmpty[i].sectionIndex], 'optionalAccess', _367 => _367.xml]));
|
|
25620
25707
|
if (sp === null) return skip("\uC140 \uBB38\uB2E8\uC5D0 \uD14D\uC2A4\uD2B8 \uB178\uB4DC\uB97C \uB9CC\uB4E4 \uC218 \uC5C6\uC74C");
|
|
25621
25708
|
splices.push(...sp);
|
|
25622
25709
|
sectionIndex = nonEmpty[i].sectionIndex;
|
|
@@ -25697,7 +25784,7 @@ async function resolveSectionEntryNames(zip) {
|
|
|
25697
25784
|
const paths = sectionPathsFromManifest(xml).filter((p) => zip.file(p) !== null);
|
|
25698
25785
|
if (paths.length > 0) return paths;
|
|
25699
25786
|
}
|
|
25700
|
-
return Object.keys(zip.files).filter((n) => /[Ss]ection\d+\.xml$/.test(n)).sort(
|
|
25787
|
+
return Object.keys(zip.files).filter((n) => /[Ss]ection\d+\.xml$/.test(n)).sort(_chunkOVESZY5Rcjs.compareSectionPaths);
|
|
25701
25788
|
}
|
|
25702
25789
|
function sectionPathsFromManifest(xml) {
|
|
25703
25790
|
const attr = (tag, name) => {
|
|
@@ -25707,7 +25794,7 @@ function sectionPathsFromManifest(xml) {
|
|
|
25707
25794
|
const idToHref = /* @__PURE__ */ new Map();
|
|
25708
25795
|
for (const m of xml.matchAll(/<opf:item(\s(?:"[^"]*"|'[^']*'|[^>"'])*?)\/?>/g)) {
|
|
25709
25796
|
const id = attr(m[1], "id");
|
|
25710
|
-
const href =
|
|
25797
|
+
const href = _chunkOVESZY5Rcjs.normalizeSectionHref.call(void 0, attr(m[1], "href"));
|
|
25711
25798
|
if (id && href) idToHref.set(id, href);
|
|
25712
25799
|
}
|
|
25713
25800
|
const ordered = [];
|
|
@@ -25716,7 +25803,7 @@ function sectionPathsFromManifest(xml) {
|
|
|
25716
25803
|
if (href) ordered.push(href);
|
|
25717
25804
|
}
|
|
25718
25805
|
if (ordered.length > 0) return ordered;
|
|
25719
|
-
return Array.from(idToHref.values()).sort(
|
|
25806
|
+
return Array.from(idToHref.values()).sort(_chunkOVESZY5Rcjs.compareSectionPaths);
|
|
25720
25807
|
}
|
|
25721
25808
|
|
|
25722
25809
|
// src/roundtrip/patcher.ts
|
|
@@ -25808,7 +25895,7 @@ async function patchHwpx(original, editedMarkdown, options) {
|
|
|
25808
25895
|
}
|
|
25809
25896
|
}
|
|
25810
25897
|
let verification;
|
|
25811
|
-
if (_optionalChain([options, 'optionalAccess',
|
|
25898
|
+
if (_optionalChain([options, 'optionalAccess', _368 => _368.verify]) !== false) {
|
|
25812
25899
|
try {
|
|
25813
25900
|
const reparsed = await parseHwpxDocument(u8ToArrayBuffer(data));
|
|
25814
25901
|
verification = diffUnitLists(splitMarkdownUnits(reparsed.markdown), editedUnits);
|
|
@@ -25826,17 +25913,17 @@ function buildOrigUnits(blocks) {
|
|
|
25826
25913
|
let chunk2;
|
|
25827
25914
|
if (block.type === "paragraph" && block.text && /^\[별표\s*\d+/.test(sanitizeText(block.text))) {
|
|
25828
25915
|
const next = blocks[i + 1];
|
|
25829
|
-
if (_optionalChain([next, 'optionalAccess',
|
|
25830
|
-
chunk2 =
|
|
25916
|
+
if (_optionalChain([next, 'optionalAccess', _369 => _369.type]) === "paragraph" && next.text && /관련\)?$/.test(next.text)) consume = 2;
|
|
25917
|
+
chunk2 = _chunkOVESZY5Rcjs.blocksToMarkdown.call(void 0, blocks.slice(i, i + consume));
|
|
25831
25918
|
} else {
|
|
25832
|
-
chunk2 =
|
|
25919
|
+
chunk2 = _chunkOVESZY5Rcjs.blocksToMarkdown.call(void 0, [block]);
|
|
25833
25920
|
}
|
|
25834
25921
|
if (chunk2) {
|
|
25835
25922
|
const subUnits = splitMarkdownUnits(chunk2);
|
|
25836
25923
|
const isFragment = consume === 2 || (block.type === "paragraph" || block.type === "heading") && subUnits.length > 1;
|
|
25837
25924
|
for (let s = 0; s < subUnits.length; s++) {
|
|
25838
25925
|
const u = { ...subUnits[s], blockIdx: i, fragment: isFragment || void 0 };
|
|
25839
|
-
if (block.type === "table" && _optionalChain([block, 'access',
|
|
25926
|
+
if (block.type === "table" && _optionalChain([block, 'access', _370 => _370.table, 'optionalAccess', _371 => _371.caption]) && s === 0 && subUnits.length > 1 && u.kind === "text" && u.raw.startsWith("**")) {
|
|
25840
25927
|
u.role = "caption";
|
|
25841
25928
|
}
|
|
25842
25929
|
units.push(u);
|
|
@@ -25947,7 +26034,7 @@ function convertParagraphToTable(block, orig, edited, ctx, skip) {
|
|
|
25947
26034
|
const ti = ctx.tableInsert;
|
|
25948
26035
|
if (!ti) return skip("\uBB38\uB2E8\u2192\uD45C \uBCC0\uD658 \uBD88\uAC00 \u2014 header \uC5D4\uD2B8\uB9AC(borderFills) \uD574\uC11D \uC2E4\uD328");
|
|
25949
26036
|
const mapping = ctx.paraMap.get(orig.blockIdx);
|
|
25950
|
-
if (!_optionalChain([mapping, 'optionalAccess',
|
|
26037
|
+
if (!_optionalChain([mapping, 'optionalAccess', _372 => _372.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");
|
|
25951
26038
|
const para2 = mapping.para;
|
|
25952
26039
|
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");
|
|
25953
26040
|
const scan = ctx.scans[para2.sectionIndex];
|
|
@@ -25975,7 +26062,7 @@ function convertParagraphToTable(block, orig, edited, ctx, skip) {
|
|
|
25975
26062
|
}
|
|
25976
26063
|
function patchParagraphUnit(block, orig, edited, ctx, skip) {
|
|
25977
26064
|
const mapping = ctx.paraMap.get(orig.blockIdx);
|
|
25978
|
-
if (!_optionalChain([mapping, 'optionalAccess',
|
|
26065
|
+
if (!_optionalChain([mapping, 'optionalAccess', _373 => _373.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)");
|
|
25979
26066
|
if (block.text && block.text.includes("\n")) {
|
|
25980
26067
|
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)");
|
|
25981
26068
|
}
|
|
@@ -26006,7 +26093,7 @@ function patchParagraphUnit(block, orig, edited, ctx, skip) {
|
|
|
26006
26093
|
if (sanitizeText(newPlain) !== newPlain) {
|
|
26007
26094
|
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");
|
|
26008
26095
|
}
|
|
26009
|
-
const splices = buildParagraphSplices(mapping.para, newPlain, _optionalChain([ctx, 'access',
|
|
26096
|
+
const splices = buildParagraphSplices(mapping.para, newPlain, _optionalChain([ctx, 'access', _374 => _374.scans, 'access', _375 => _375[mapping.para.sectionIndex], 'optionalAccess', _376 => _376.xml]));
|
|
26010
26097
|
if (splices === null) return skip("\uBB38\uB2E8\uC5D0 \uD14D\uC2A4\uD2B8 \uB178\uB4DC\uB97C \uB9CC\uB4E4 \uC218 \uC5C6\uC74C");
|
|
26011
26098
|
ctx.sectionSplices[mapping.para.sectionIndex].push(...splices);
|
|
26012
26099
|
return 1;
|
|
@@ -26192,7 +26279,7 @@ var Surgeon = (_class5 = class {
|
|
|
26192
26279
|
/** 디렉토리 트리에서 경로 해석 (형제 = L/R 이진 트리, 자식 = child) */
|
|
26193
26280
|
findEntry(path) {
|
|
26194
26281
|
const parts = path.replace(/^\//, "").split("/");
|
|
26195
|
-
let scope = _nullishCoalesce(_optionalChain([this, 'access',
|
|
26282
|
+
let scope = _nullishCoalesce(_optionalChain([this, 'access', _377 => _377.entries, 'access', _378 => _378[0], 'optionalAccess', _379 => _379.child]), () => ( -1));
|
|
26196
26283
|
let current;
|
|
26197
26284
|
for (const part of parts) {
|
|
26198
26285
|
const search = (idx) => {
|
|
@@ -26405,8 +26492,8 @@ function serializeRecords(recs, repl, inserts) {
|
|
|
26405
26492
|
parts.push(header, data);
|
|
26406
26493
|
};
|
|
26407
26494
|
for (let i = 0; i < recs.length; i++) {
|
|
26408
|
-
for (const ins of _nullishCoalesce(_optionalChain([inserts, 'optionalAccess',
|
|
26409
|
-
push(recs[i].tagId, recs[i].level, _nullishCoalesce(_optionalChain([repl, 'optionalAccess',
|
|
26495
|
+
for (const ins of _nullishCoalesce(_optionalChain([inserts, 'optionalAccess', _380 => _380.get, 'call', _381 => _381(i)]), () => ( []))) push(ins.tagId, ins.level, ins.data);
|
|
26496
|
+
push(recs[i].tagId, recs[i].level, _nullishCoalesce(_optionalChain([repl, 'optionalAccess', _382 => _382.get, 'call', _383 => _383(i)]), () => ( recs[i].data)));
|
|
26410
26497
|
}
|
|
26411
26498
|
return Buffer.concat(parts);
|
|
26412
26499
|
}
|
|
@@ -26524,7 +26611,7 @@ async function patchHwp(original, editedMarkdown, options) {
|
|
|
26524
26611
|
return fail(`CFB \uCEE8\uD14C\uC774\uB108 \uD30C\uC2F1 \uC2E4\uD328: ${msg(err)}`);
|
|
26525
26612
|
}
|
|
26526
26613
|
const fhEntry = CFB2.find(cfb, "/FileHeader");
|
|
26527
|
-
if (!_optionalChain([fhEntry, 'optionalAccess',
|
|
26614
|
+
if (!_optionalChain([fhEntry, 'optionalAccess', _384 => _384.content])) return fail("FileHeader \uC2A4\uD2B8\uB9BC\uC774 \uC5C6\uC2B5\uB2C8\uB2E4 \u2014 HWP 5.x \uD30C\uC77C\uC774 \uC544\uB2D9\uB2C8\uB2E4");
|
|
26528
26615
|
let flags;
|
|
26529
26616
|
try {
|
|
26530
26617
|
flags = parseFileHeader(Buffer.from(fhEntry.content)).flags;
|
|
@@ -26546,7 +26633,7 @@ async function patchHwp(original, editedMarkdown, options) {
|
|
|
26546
26633
|
const scans = [];
|
|
26547
26634
|
for (let i = 0; i < sectionPaths.length; i++) {
|
|
26548
26635
|
const entry = CFB2.find(cfb, sectionPaths[i]);
|
|
26549
|
-
if (!_optionalChain([entry, 'optionalAccess',
|
|
26636
|
+
if (!_optionalChain([entry, 'optionalAccess', _385 => _385.content])) return fail(`\uC139\uC158 \uC2A4\uD2B8\uB9BC \uC77D\uAE30 \uC2E4\uD328: ${sectionPaths[i]}`);
|
|
26550
26637
|
let stream;
|
|
26551
26638
|
try {
|
|
26552
26639
|
stream = compressed ? decompressStream(Buffer.from(entry.content)) : Buffer.from(entry.content);
|
|
@@ -26597,7 +26684,7 @@ async function patchHwp(original, editedMarkdown, options) {
|
|
|
26597
26684
|
}
|
|
26598
26685
|
}
|
|
26599
26686
|
let verification;
|
|
26600
|
-
if (_optionalChain([options, 'optionalAccess',
|
|
26687
|
+
if (_optionalChain([options, 'optionalAccess', _386 => _386.verify]) !== false) {
|
|
26601
26688
|
try {
|
|
26602
26689
|
const reparsed = parseHwp5Document(Buffer.from(data));
|
|
26603
26690
|
const normBr = (u) => ({ ...u, raw: u.raw.replace(/<br\s*\/?\s*>/gi, "\n") });
|
|
@@ -26687,7 +26774,7 @@ function tableContentScore(irTable, scanTable) {
|
|
|
26687
26774
|
for (const [key, scanCell] of scanTable.cells) {
|
|
26688
26775
|
const comma = key.indexOf(",");
|
|
26689
26776
|
const r = Number(key.slice(0, comma)), c = Number(key.slice(comma + 1));
|
|
26690
|
-
const irCell = _optionalChain([irTable, 'access',
|
|
26777
|
+
const irCell = _optionalChain([irTable, 'access', _387 => _387.cells, 'access', _388 => _388[r], 'optionalAccess', _389 => _389[c]]);
|
|
26691
26778
|
if (!irCell) continue;
|
|
26692
26779
|
const a = normForMatch(scanCell.paras.map((p) => p.rawText).join(" "));
|
|
26693
26780
|
const b = normForMatch(stripCellTokens(irCell.text));
|
|
@@ -26723,7 +26810,7 @@ function handleModified(orig, edited, ctx) {
|
|
|
26723
26810
|
}
|
|
26724
26811
|
function patchParagraph(block, orig, edited, ctx, skip) {
|
|
26725
26812
|
const mapping = ctx.paraMap.get(orig.blockIdx);
|
|
26726
|
-
if (!_optionalChain([mapping, 'optionalAccess',
|
|
26813
|
+
if (!_optionalChain([mapping, 'optionalAccess', _390 => _390.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)");
|
|
26727
26814
|
const restoreBr = (s) => s.replace(/(?:\s*<br\s*\/?\s*>\s*)+/gi, "\n");
|
|
26728
26815
|
let newPlain = restoreBr(textUnitToPlain(edited.raw, block));
|
|
26729
26816
|
if (block.text && block.text.includes("\n") && !newPlain.includes("\n")) {
|
|
@@ -26922,7 +27009,7 @@ function applyCellEdit5(table2, scanTable, gridR, gridC, newLines, ctx, before,
|
|
|
26922
27009
|
};
|
|
26923
27010
|
const cell2 = scanTable.cells.get(`${gridR},${gridC}`);
|
|
26924
27011
|
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)");
|
|
26925
|
-
const irCell = _optionalChain([table2, 'access',
|
|
27012
|
+
const irCell = _optionalChain([table2, 'access', _391 => _391.cells, 'access', _392 => _392[gridR], 'optionalAccess', _393 => _393[gridC]]);
|
|
26926
27013
|
const scanJoined = cell2.paras.map((p) => p.rawText).filter((t) => normForMatch(t)).join("\n");
|
|
26927
27014
|
if (irCell && normForMatch(scanJoined) !== normForMatch(stripCellTokens(irCell.text))) {
|
|
26928
27015
|
if (normForMatch(irCell.text) !== "" || normForMatch(scanJoined) !== "") {
|
|
@@ -27314,7 +27401,7 @@ var HwpxSession = (_class6 = class _HwpxSession {
|
|
|
27314
27401
|
const block = st.blocks[blockIndex];
|
|
27315
27402
|
if (!block) return void 0;
|
|
27316
27403
|
if (block.type === "paragraph" || block.type === "heading") {
|
|
27317
|
-
const para2 = _optionalChain([st, 'access',
|
|
27404
|
+
const para2 = _optionalChain([st, 'access', _394 => _394.paraMap, 'access', _395 => _395.get, 'call', _396 => _396(blockIndex), 'optionalAccess', _397 => _397.para]);
|
|
27318
27405
|
if (!para2) return void 0;
|
|
27319
27406
|
return { kind: "paragraph", sectionIndex: para2.sectionIndex, xmlStart: para2.start };
|
|
27320
27407
|
}
|
|
@@ -27339,7 +27426,7 @@ var HwpxSession = (_class6 = class _HwpxSession {
|
|
|
27339
27426
|
if (block.text && block.text.includes("\n")) {
|
|
27340
27427
|
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)" };
|
|
27341
27428
|
}
|
|
27342
|
-
if (!_optionalChain([st, 'access',
|
|
27429
|
+
if (!_optionalChain([st, 'access', _398 => _398.paraMap, 'access', _399 => _399.get, 'call', _400 => _400(blockIndex), 'optionalAccess', _401 => _401.para])) {
|
|
27343
27430
|
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)" };
|
|
27344
27431
|
}
|
|
27345
27432
|
return { capability: "text" };
|
|
@@ -27405,7 +27492,7 @@ var HwpxSession = (_class6 = class _HwpxSession {
|
|
|
27405
27492
|
continue;
|
|
27406
27493
|
}
|
|
27407
27494
|
if (block.type === "table" && block.table) {
|
|
27408
|
-
if (!_optionalChain([edit, 'access',
|
|
27495
|
+
if (!_optionalChain([edit, 'access', _402 => _402.cells, 'optionalAccess', _403 => _403.length])) {
|
|
27409
27496
|
skipped.push({ reason: "\uD45C \uBE14\uB85D\uC5D0\uB294 cells \uD3B8\uC9D1\uB9CC \uC9C0\uC6D0", before: summarize(_nullishCoalesce(block.table.caption, () => ( "(\uD45C)"))) });
|
|
27410
27497
|
continue;
|
|
27411
27498
|
}
|
|
@@ -27425,7 +27512,7 @@ var HwpxSession = (_class6 = class _HwpxSession {
|
|
|
27425
27512
|
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) });
|
|
27426
27513
|
continue;
|
|
27427
27514
|
}
|
|
27428
|
-
const irCell = _optionalChain([block, 'access',
|
|
27515
|
+
const irCell = _optionalChain([block, 'access', _404 => _404.table, 'access', _405 => _405.cells, 'access', _406 => _406[cellEdit.row], 'optionalAccess', _407 => _407[cellEdit.col]]);
|
|
27429
27516
|
if (!irCell) {
|
|
27430
27517
|
skipped.push({ reason: `\uC140 \uC88C\uD45C \uBC94\uC704 \uBC16: ${cellEdit.row},${cellEdit.col}`, after: summarize(cellEdit.text) });
|
|
27431
27518
|
continue;
|
|
@@ -27481,7 +27568,7 @@ var HwpxSession = (_class6 = class _HwpxSession {
|
|
|
27481
27568
|
}
|
|
27482
27569
|
if (replacements.size === 0) {
|
|
27483
27570
|
let changes2;
|
|
27484
|
-
if (_optionalChain([options, 'optionalAccess',
|
|
27571
|
+
if (_optionalChain([options, 'optionalAccess', _408 => _408.verify]) !== false) {
|
|
27485
27572
|
const units = splitMarkdownUnits(st.markdown);
|
|
27486
27573
|
changes2 = diffUnitLists(units, units);
|
|
27487
27574
|
}
|
|
@@ -27502,7 +27589,7 @@ var HwpxSession = (_class6 = class _HwpxSession {
|
|
|
27502
27589
|
}
|
|
27503
27590
|
this.state = newState;
|
|
27504
27591
|
let changes;
|
|
27505
|
-
if (_optionalChain([options, 'optionalAccess',
|
|
27592
|
+
if (_optionalChain([options, 'optionalAccess', _409 => _409.verify]) !== false) {
|
|
27506
27593
|
changes = diffUnitLists(splitMarkdownUnits(beforeMarkdown), splitMarkdownUnits(newState.markdown));
|
|
27507
27594
|
}
|
|
27508
27595
|
return { success: true, data: new Uint8Array(data), applied, skipped, changes };
|
|
@@ -27522,7 +27609,7 @@ var HwpxSession = (_class6 = class _HwpxSession {
|
|
|
27522
27609
|
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)");
|
|
27523
27610
|
}
|
|
27524
27611
|
const mapping = st.paraMap.get(blockIndex);
|
|
27525
|
-
if (!_optionalChain([mapping, 'optionalAccess',
|
|
27612
|
+
if (!_optionalChain([mapping, 'optionalAccess', _410 => _410.para])) {
|
|
27526
27613
|
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)");
|
|
27527
27614
|
}
|
|
27528
27615
|
let newPlain = newTextRaw.split("\n").map((l) => l.trim()).filter(Boolean).join(" ");
|
|
@@ -27542,14 +27629,14 @@ var HwpxSession = (_class6 = class _HwpxSession {
|
|
|
27542
27629
|
if (sanitizeText(newPlain) !== newPlain) {
|
|
27543
27630
|
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");
|
|
27544
27631
|
}
|
|
27545
|
-
const splices = buildParagraphSplices(mapping.para, newPlain, _optionalChain([st, 'access',
|
|
27632
|
+
const splices = buildParagraphSplices(mapping.para, newPlain, _optionalChain([st, 'access', _411 => _411.scans, 'access', _412 => _412[mapping.para.sectionIndex], 'optionalAccess', _413 => _413.xml]));
|
|
27546
27633
|
if (splices === null) return skip("\uBB38\uB2E8\uC5D0 \uD14D\uC2A4\uD2B8 \uB178\uB4DC\uB97C \uB9CC\uB4E4 \uC218 \uC5C6\uC74C");
|
|
27547
27634
|
sectionSplices[mapping.para.sectionIndex].push(...splices);
|
|
27548
27635
|
return 1;
|
|
27549
27636
|
}
|
|
27550
27637
|
}, _class6);
|
|
27551
27638
|
function cellStaticCheck(table2, scanTable, r, c) {
|
|
27552
|
-
const irCell = _optionalChain([table2, 'access',
|
|
27639
|
+
const irCell = _optionalChain([table2, 'access', _414 => _414.cells, 'access', _415 => _415[r], 'optionalAccess', _416 => _416[c]]);
|
|
27553
27640
|
if (!irCell) return { editable: false, reason: "\uC140 \uC88C\uD45C \uBC94\uC704 \uBC16" };
|
|
27554
27641
|
const cell2 = scanTable.cellByAnchor.get(`${r},${c}`);
|
|
27555
27642
|
if (!cell2) return { editable: false, reason: "\uBCD1\uD569 \uC601\uC5ED\uC758 \uBE48 \uCE78\uC774\uAC70\uB098 \uC88C\uD45C \uBD88\uC77C\uCE58" };
|
|
@@ -27633,11 +27720,11 @@ var md = new (0, _markdownit2.default)({
|
|
|
27633
27720
|
breaks: false
|
|
27634
27721
|
});
|
|
27635
27722
|
function renderHtml(markdown, options) {
|
|
27636
|
-
const preset = _nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
27637
|
-
const css = PRESETS[preset] + (_nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
27723
|
+
const preset = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _417 => _417.preset]), () => ( "default"));
|
|
27724
|
+
const css = PRESETS[preset] + (_nullishCoalesce(_optionalChain([options, 'optionalAccess', _418 => _418.extraCss]), () => ( "")));
|
|
27638
27725
|
const body = md.render(markdown);
|
|
27639
|
-
const watermark = _optionalChain([options, 'optionalAccess',
|
|
27640
|
-
const watermarkCss = _optionalChain([options, 'optionalAccess',
|
|
27726
|
+
const watermark = _optionalChain([options, 'optionalAccess', _419 => _419.watermark]) ? `<div class="watermark">${escapeHtml(options.watermark)}</div>` : "";
|
|
27727
|
+
const watermarkCss = _optionalChain([options, 'optionalAccess', _420 => _420.watermark]) ? `
|
|
27641
27728
|
.watermark {
|
|
27642
27729
|
position: fixed;
|
|
27643
27730
|
top: 50%; left: 50%;
|
|
@@ -27668,13 +27755,13 @@ async function htmlToPdf(html, options) {
|
|
|
27668
27755
|
try {
|
|
27669
27756
|
puppeteer = await Promise.resolve().then(() => _interopRequireWildcard(require("puppeteer-core")));
|
|
27670
27757
|
} catch (e30) {
|
|
27671
|
-
throw new (0,
|
|
27758
|
+
throw new (0, _chunkOVESZY5Rcjs.KordocError)(
|
|
27672
27759
|
"PDF \uC0DD\uC131\uC5D0 puppeteer-core\uAC00 \uD544\uC694\uD569\uB2C8\uB2E4. \uC124\uCE58: npm install puppeteer-core"
|
|
27673
27760
|
);
|
|
27674
27761
|
}
|
|
27675
27762
|
const executablePath = _nullishCoalesce(process.env.PUPPETEER_EXECUTABLE_PATH, () => ( findChromiumPath()));
|
|
27676
27763
|
if (!executablePath) {
|
|
27677
|
-
throw new (0,
|
|
27764
|
+
throw new (0, _chunkOVESZY5Rcjs.KordocError)(
|
|
27678
27765
|
"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."
|
|
27679
27766
|
);
|
|
27680
27767
|
}
|
|
@@ -27686,10 +27773,10 @@ async function htmlToPdf(html, options) {
|
|
|
27686
27773
|
try {
|
|
27687
27774
|
const page = await browser.newPage();
|
|
27688
27775
|
await page.setContent(html, { waitUntil: "networkidle0" });
|
|
27689
|
-
const margin = _optionalChain([options, 'optionalAccess',
|
|
27776
|
+
const margin = _optionalChain([options, 'optionalAccess', _421 => _421.margin]);
|
|
27690
27777
|
const pdf = await page.pdf({
|
|
27691
|
-
format: _nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
27692
|
-
landscape: _optionalChain([options, 'optionalAccess',
|
|
27778
|
+
format: _nullishCoalesce(_optionalChain([options, 'optionalAccess', _422 => _422.pageSize]), () => ( "A4")),
|
|
27779
|
+
landscape: _optionalChain([options, 'optionalAccess', _423 => _423.orientation]) === "landscape",
|
|
27693
27780
|
printBackground: true,
|
|
27694
27781
|
margin: margin ? {
|
|
27695
27782
|
top: toCss(margin.top),
|
|
@@ -27697,9 +27784,9 @@ async function htmlToPdf(html, options) {
|
|
|
27697
27784
|
bottom: toCss(margin.bottom),
|
|
27698
27785
|
left: toCss(margin.left)
|
|
27699
27786
|
} : void 0,
|
|
27700
|
-
displayHeaderFooter: !!(_optionalChain([options, 'optionalAccess',
|
|
27701
|
-
headerTemplate: _nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
27702
|
-
footerTemplate: _nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
27787
|
+
displayHeaderFooter: !!(_optionalChain([options, 'optionalAccess', _424 => _424.header]) || _optionalChain([options, 'optionalAccess', _425 => _425.footer])),
|
|
27788
|
+
headerTemplate: _nullishCoalesce(_optionalChain([options, 'optionalAccess', _426 => _426.header]), () => ( "<div></div>")),
|
|
27789
|
+
footerTemplate: _nullishCoalesce(_optionalChain([options, 'optionalAccess', _427 => _427.footer]), () => ( '<div style="font-size:8pt;width:100%;text-align:center;color:#777;"><span class="pageNumber"></span>/<span class="totalPages"></span></div>'))
|
|
27703
27790
|
});
|
|
27704
27791
|
return Buffer.from(pdf);
|
|
27705
27792
|
} finally {
|
|
@@ -27733,7 +27820,7 @@ async function markdownToPdf(markdown, options) {
|
|
|
27733
27820
|
return htmlToPdf(html, options);
|
|
27734
27821
|
}
|
|
27735
27822
|
async function blocksToPdf(blocks, options) {
|
|
27736
|
-
const markdown =
|
|
27823
|
+
const markdown = _chunkOVESZY5Rcjs.blocksToMarkdown.call(void 0, blocks);
|
|
27737
27824
|
return markdownToPdf(markdown, options);
|
|
27738
27825
|
}
|
|
27739
27826
|
|
|
@@ -27944,7 +28031,7 @@ function reflowBlockFlow(container, doc, styles, areaW, mode, counter, bodyH) {
|
|
|
27944
28031
|
if (ln(p) !== "p") continue;
|
|
27945
28032
|
reflowTablesIn(p, doc, styles, mode, counter);
|
|
27946
28033
|
const g = styles.paraGeom.get(_nullishCoalesce(p.getAttribute("paraPrIDRef"), () => ( "")));
|
|
27947
|
-
const startV = cursorV + prevSpaceAfter + (_nullishCoalesce(_optionalChain([g, 'optionalAccess',
|
|
28034
|
+
const startV = cursorV + prevSpaceAfter + (_nullishCoalesce(_optionalChain([g, 'optionalAccess', _428 => _428.spaceBefore]), () => ( 0)));
|
|
27948
28035
|
const res = reflowPara(p, doc, styles, areaW, startV, mode);
|
|
27949
28036
|
if (res) {
|
|
27950
28037
|
const paraH = res.paraBottom - startV;
|
|
@@ -28053,7 +28140,7 @@ function buildPara(p) {
|
|
|
28053
28140
|
el: ch,
|
|
28054
28141
|
tag: cn,
|
|
28055
28142
|
index: chars.length,
|
|
28056
|
-
inline: _optionalChain([pos, 'optionalAccess',
|
|
28143
|
+
inline: _optionalChain([pos, 'optionalAccess', _429 => _429.getAttribute, 'call', _430 => _430("treatAsChar")]) === "1",
|
|
28057
28144
|
width: w,
|
|
28058
28145
|
height: h
|
|
28059
28146
|
});
|
|
@@ -28305,15 +28392,15 @@ function drawShape(o, x, y, ctx, depth) {
|
|
|
28305
28392
|
const sx = ow > 0 ? w / ow : 1;
|
|
28306
28393
|
const sy = oh > 0 ? h / oh : 1;
|
|
28307
28394
|
const lineShape = findChildByLocalName(el, "lineShape");
|
|
28308
|
-
const lstyle = _nullishCoalesce(_optionalChain([lineShape, 'optionalAccess',
|
|
28309
|
-
const strokeCol = _optionalChain([lineShape, 'optionalAccess',
|
|
28395
|
+
const lstyle = _nullishCoalesce(_optionalChain([lineShape, 'optionalAccess', _431 => _431.getAttribute, 'call', _432 => _432("style")]), () => ( "SOLID"));
|
|
28396
|
+
const strokeCol = _optionalChain([lineShape, 'optionalAccess', _433 => _433.getAttribute, 'call', _434 => _434("color")]) || "#000000";
|
|
28310
28397
|
const hasStroke = lstyle !== "NONE";
|
|
28311
28398
|
const strokeW = hasStroke ? shapeStrokePt(lineShape ? num3(lineShape, "width") : 33) : 0;
|
|
28312
28399
|
const dash = /DASH|DOT/.test(lstyle) ? ` stroke-dasharray="${lstyle.includes("DOT") ? "1,1.5" : "3,1.5"}"` : "";
|
|
28313
28400
|
const strokeAttr = hasStroke ? ` stroke="${escapeXml3(strokeCol)}" stroke-width="${strokeW.toFixed(2)}"${dash}` : "";
|
|
28314
28401
|
const fillBrush = findChildByLocalName(el, "fillBrush");
|
|
28315
28402
|
const winBrush = fillBrush ? findChildByLocalName(fillBrush, "winBrush") : null;
|
|
28316
|
-
const face = _optionalChain([winBrush, 'optionalAccess',
|
|
28403
|
+
const face = _optionalChain([winBrush, 'optionalAccess', _435 => _435.getAttribute, 'call', _436 => _436("faceColor")]);
|
|
28317
28404
|
const fill = face && face.toLowerCase() !== "none" ? face : "none";
|
|
28318
28405
|
const fillAttr = ` fill="${fill === "none" ? "none" : escapeXml3(fill)}"`;
|
|
28319
28406
|
if (o.tag === "rect") {
|
|
@@ -28345,7 +28432,7 @@ function cellContentExtent(cell2) {
|
|
|
28345
28432
|
if (ln2(p) !== "p") continue;
|
|
28346
28433
|
const m = buildPara(p);
|
|
28347
28434
|
for (const s of m.segs) ext = Math.max(ext, s.vertpos + s.textheight);
|
|
28348
|
-
const baseV = _nullishCoalesce(_optionalChain([m, 'access',
|
|
28435
|
+
const baseV = _nullishCoalesce(_optionalChain([m, 'access', _437 => _437.segs, 'access', _438 => _438[0], 'optionalAccess', _439 => _439.vertpos]), () => ( 0));
|
|
28349
28436
|
for (const o of m.objs) {
|
|
28350
28437
|
if (o.inline) {
|
|
28351
28438
|
const h = o.tag === "tbl" ? Math.max(o.height, measureTableHeight(o.el)) : o.height;
|
|
@@ -28353,7 +28440,7 @@ function cellContentExtent(cell2) {
|
|
|
28353
28440
|
continue;
|
|
28354
28441
|
}
|
|
28355
28442
|
const pos = findChildByLocalName(o.el, "pos");
|
|
28356
|
-
if ((_nullishCoalesce(_optionalChain([pos, 'optionalAccess',
|
|
28443
|
+
if ((_nullishCoalesce(_optionalChain([pos, 'optionalAccess', _440 => _440.getAttribute, 'call', _441 => _441("vertRelTo")]), () => ( "PARA"))) !== "PARA") continue;
|
|
28357
28444
|
const om = findChildByLocalName(o.el, "outMargin");
|
|
28358
28445
|
const pushed = baseV - (num3(om, "top") + o.height + num3(om, "bottom"));
|
|
28359
28446
|
const anchor = pushed >= -100 ? pushed : baseV;
|
|
@@ -28439,7 +28526,7 @@ function drawTable(tbl2, tx, ty, ctx, depth) {
|
|
|
28439
28526
|
}));
|
|
28440
28527
|
for (const g of geom) {
|
|
28441
28528
|
const bf = g.c.bfId != null ? ctx.styles.borderFill.get(g.c.bfId) : void 0;
|
|
28442
|
-
if (_optionalChain([bf, 'optionalAccess',
|
|
28529
|
+
if (_optionalChain([bf, 'optionalAccess', _442 => _442.fill])) emit(ctx, `<rect x="${pt(g.x)}" y="${pt(g.y)}" width="${pt(g.w)}" height="${pt(g.h)}" fill="${escapeXml3(bf.fill)}"/>`);
|
|
28443
28530
|
}
|
|
28444
28531
|
for (const g of geom) {
|
|
28445
28532
|
const { c } = g;
|
|
@@ -28477,7 +28564,7 @@ function drawPic(pic, x, y, ctx) {
|
|
|
28477
28564
|
const sz = findChildByLocalName(pic, "sz");
|
|
28478
28565
|
const w = num3(sz, "width", 5669), h = num3(sz, "height", 5669);
|
|
28479
28566
|
const img = findFirst(pic, "img");
|
|
28480
|
-
const ref = _optionalChain([img, 'optionalAccess',
|
|
28567
|
+
const ref = _optionalChain([img, 'optionalAccess', _443 => _443.getAttribute, 'call', _444 => _444("binaryItemIDRef")]);
|
|
28481
28568
|
const loaded = ref != null ? ctx.images.get(ref) : void 0;
|
|
28482
28569
|
if (!loaded) {
|
|
28483
28570
|
emit(ctx, `<rect x="${pt(x)}" y="${pt(y)}" width="${pt(w)}" height="${pt(h)}" fill="#eee" stroke="#c00" stroke-width="0.5"/>`);
|
|
@@ -28516,7 +28603,7 @@ function readSectionGeom(root) {
|
|
|
28516
28603
|
const pagePr = findFirst(root, "pagePr");
|
|
28517
28604
|
const margin = pagePr ? findChildByLocalName(pagePr, "margin") : null;
|
|
28518
28605
|
let PW = num3(pagePr, "width", 59528), PH = num3(pagePr, "height", 84188);
|
|
28519
|
-
if (_optionalChain([pagePr, 'optionalAccess',
|
|
28606
|
+
if (_optionalChain([pagePr, 'optionalAccess', _445 => _445.getAttribute, 'call', _446 => _446("landscape")]) === "NARROWLY" && PW < PH) {
|
|
28520
28607
|
const t = PW;
|
|
28521
28608
|
PW = PH;
|
|
28522
28609
|
PH = t;
|
|
@@ -28574,17 +28661,17 @@ function renderSectionToPages(root, geom, ctxBase, hasCache, reflowMode) {
|
|
|
28574
28661
|
return { pages: ctx.pages, pageH };
|
|
28575
28662
|
}
|
|
28576
28663
|
async function renderHwpxToSvg(input, options) {
|
|
28577
|
-
const maxImg = _nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
28664
|
+
const maxImg = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _447 => _447.maxImageBytes]), () => ( 40 * 1024 * 1024));
|
|
28578
28665
|
const ab = input instanceof Uint8Array ? input.buffer.slice(input.byteOffset, input.byteOffset + input.byteLength) : input;
|
|
28579
|
-
|
|
28666
|
+
_chunkOVESZY5Rcjs.precheckZipSize.call(void 0, ab, MAX_DECOMPRESS_SIZE, MAX_ZIP_ENTRIES);
|
|
28580
28667
|
let zip;
|
|
28581
28668
|
try {
|
|
28582
28669
|
zip = await _jszip2.default.loadAsync(input);
|
|
28583
28670
|
} catch (e31) {
|
|
28584
|
-
throw new (0,
|
|
28671
|
+
throw new (0, _chunkOVESZY5Rcjs.KordocError)("HWPX(ZIP) \uD615\uC2DD\uC774 \uC544\uB2D9\uB2C8\uB2E4 \u2014 \uB80C\uB354\uB294 HWPX\uB9CC \uC9C0\uC6D0");
|
|
28585
28672
|
}
|
|
28586
28673
|
const secFiles = zip.file(/Contents\/section\d+\.xml$/i).sort((a, b) => a.name.localeCompare(b.name));
|
|
28587
|
-
if (secFiles.length === 0) throw new (0,
|
|
28674
|
+
if (secFiles.length === 0) throw new (0, _chunkOVESZY5Rcjs.KordocError)("Contents/section0.xml \uC5C6\uC74C \u2014 HWPX\uAC00 \uC544\uB2C8\uAC70\uB098 \uC190\uC0C1\uB428");
|
|
28588
28675
|
const warnings = [];
|
|
28589
28676
|
const headFile = _nullishCoalesce(zip.file("Contents/header.xml"), () => ( zip.file("Contents/head.xml")));
|
|
28590
28677
|
const styles = headFile ? parseRenderStyles(await headFile.async("string")) : { charPr: /* @__PURE__ */ new Map(), paraAlign: /* @__PURE__ */ new Map(), paraGeom: /* @__PURE__ */ new Map(), borderFill: /* @__PURE__ */ new Map() };
|
|
@@ -28592,7 +28679,7 @@ async function renderHwpxToSvg(input, options) {
|
|
|
28592
28679
|
const secXmls = [];
|
|
28593
28680
|
for (const f of secFiles) {
|
|
28594
28681
|
const xml = await f.async("string");
|
|
28595
|
-
if (xml.length > MAX_DECOMPRESS_SIZE) throw new (0,
|
|
28682
|
+
if (xml.length > MAX_DECOMPRESS_SIZE) throw new (0, _chunkOVESZY5Rcjs.KordocError)("\uC139\uC158 XML\uC774 \uD5C8\uC6A9 \uD06C\uAE30\uB97C \uCD08\uACFC");
|
|
28596
28683
|
secXmls.push(xml);
|
|
28597
28684
|
}
|
|
28598
28685
|
const binmap = /* @__PURE__ */ new Map();
|
|
@@ -28616,7 +28703,7 @@ async function renderHwpxToSvg(input, options) {
|
|
|
28616
28703
|
let href = binmap.get(ref);
|
|
28617
28704
|
if (!href) {
|
|
28618
28705
|
const cand = zip.file(new RegExp(`BinData/.*${ref.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")}`, "i"))[0];
|
|
28619
|
-
href = _optionalChain([cand, 'optionalAccess',
|
|
28706
|
+
href = _optionalChain([cand, 'optionalAccess', _448 => _448.name]);
|
|
28620
28707
|
}
|
|
28621
28708
|
if (!href) continue;
|
|
28622
28709
|
const f = _nullishCoalesce(zip.file(href), () => ( zip.file("Contents/" + href)));
|
|
@@ -28637,7 +28724,7 @@ async function renderHwpxToSvg(input, options) {
|
|
|
28637
28724
|
styles,
|
|
28638
28725
|
images,
|
|
28639
28726
|
defs: [],
|
|
28640
|
-
highlights: (_nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
28727
|
+
highlights: (_nullishCoalesce(_optionalChain([options, 'optionalAccess', _449 => _449.highlights]), () => ( []))).map((s) => s.trim().toLowerCase()).filter((s) => s.length > 0),
|
|
28641
28728
|
warnings,
|
|
28642
28729
|
warned: /* @__PURE__ */ new Set(),
|
|
28643
28730
|
stats: { texts: 0, images: 0, tables: 0 }
|
|
@@ -28647,7 +28734,7 @@ async function renderHwpxToSvg(input, options) {
|
|
|
28647
28734
|
for (let si = 0; si < secXmls.length; si++) {
|
|
28648
28735
|
const secXml = secXmls[si];
|
|
28649
28736
|
const hasCache = /<(?:[A-Za-z][\w.-]*:)?linesegarray[\s/>]/.test(secXml);
|
|
28650
|
-
if (!hasCache && !_optionalChain([options, 'optionalAccess',
|
|
28737
|
+
if (!hasCache && !_optionalChain([options, 'optionalAccess', _450 => _450.reflow])) {
|
|
28651
28738
|
noCacheSkipped = true;
|
|
28652
28739
|
warnings.push(`\uAD6C\uC5ED ${si}: \uC870\uD310 \uCE90\uC2DC \uC5C6\uC74C \u2014 reflow \uC635\uC158 \uD544\uC694, \uC0DD\uB7B5`);
|
|
28653
28740
|
continue;
|
|
@@ -28659,14 +28746,14 @@ async function renderHwpxToSvg(input, options) {
|
|
|
28659
28746
|
continue;
|
|
28660
28747
|
}
|
|
28661
28748
|
const geom = readSectionGeom(root);
|
|
28662
|
-
const { pages, pageH } = renderSectionToPages(root, geom, ctxBase, hasCache, _nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
28749
|
+
const { pages, pageH } = renderSectionToPages(root, geom, ctxBase, hasCache, _nullishCoalesce(_optionalChain([options, 'optionalAccess', _451 => _451.reflowMode]), () => ( "keep")));
|
|
28663
28750
|
rendered.push({ pages, PW: geom.PW, pageH, clipId: `pgclip${si}` });
|
|
28664
28751
|
}
|
|
28665
28752
|
if (rendered.length === 0) {
|
|
28666
28753
|
if (noCacheSkipped) {
|
|
28667
|
-
throw new (0,
|
|
28754
|
+
throw new (0, _chunkOVESZY5Rcjs.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)");
|
|
28668
28755
|
}
|
|
28669
|
-
throw new (0,
|
|
28756
|
+
throw new (0, _chunkOVESZY5Rcjs.KordocError)("\uB80C\uB354\uD560 \uAD6C\uC5ED\uC774 \uC5C6\uC2B5\uB2C8\uB2E4 \u2014 HWPX\uAC00 \uC190\uC0C1\uB418\uC5C8\uC744 \uC218 \uC788\uC2B5\uB2C8\uB2E4");
|
|
28670
28757
|
}
|
|
28671
28758
|
const GAP = 2400;
|
|
28672
28759
|
const clipDefs = [];
|
|
@@ -28698,17 +28785,17 @@ ${groups.join("\n")}
|
|
|
28698
28785
|
// src/index.ts
|
|
28699
28786
|
async function parse(input, options) {
|
|
28700
28787
|
let buffer;
|
|
28701
|
-
const opts = typeof input === "string" && !_optionalChain([options, 'optionalAccess',
|
|
28788
|
+
const opts = typeof input === "string" && !_optionalChain([options, 'optionalAccess', _452 => _452.filePath]) ? { ...options, filePath: input } : options;
|
|
28702
28789
|
if (typeof input === "string") {
|
|
28703
28790
|
try {
|
|
28704
28791
|
const buf = await _promises.readFile.call(void 0, input);
|
|
28705
|
-
buffer =
|
|
28792
|
+
buffer = _chunkOVESZY5Rcjs.toArrayBuffer.call(void 0, buf);
|
|
28706
28793
|
} catch (err) {
|
|
28707
28794
|
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}`;
|
|
28708
28795
|
return { success: false, fileType: "unknown", error: msg2, code: "PARSE_ERROR" };
|
|
28709
28796
|
}
|
|
28710
28797
|
} else if (Buffer.isBuffer(input)) {
|
|
28711
|
-
buffer =
|
|
28798
|
+
buffer = _chunkOVESZY5Rcjs.toArrayBuffer.call(void 0, input);
|
|
28712
28799
|
} else {
|
|
28713
28800
|
buffer = input;
|
|
28714
28801
|
}
|
|
@@ -28743,21 +28830,21 @@ async function parseHwp3(buffer, options) {
|
|
|
28743
28830
|
const { markdown, blocks, metadata, outline, warnings } = parseHwp3Document(buffer, options);
|
|
28744
28831
|
return { success: true, fileType: "hwp3", markdown, blocks, metadata, outline, warnings };
|
|
28745
28832
|
} catch (err) {
|
|
28746
|
-
return { success: false, fileType: "hwp3", error: err instanceof Error ? err.message : "HWP3 \uD30C\uC2F1 \uC2E4\uD328", code:
|
|
28833
|
+
return { success: false, fileType: "hwp3", error: err instanceof Error ? err.message : "HWP3 \uD30C\uC2F1 \uC2E4\uD328", code: _chunkOVESZY5Rcjs.classifyError.call(void 0, err) };
|
|
28747
28834
|
}
|
|
28748
28835
|
}
|
|
28749
28836
|
async function parseHwpx(buffer, options) {
|
|
28750
28837
|
try {
|
|
28751
28838
|
const { markdown, blocks, metadata, outline, warnings, images } = await parseHwpxDocument(buffer, options);
|
|
28752
|
-
return { success: true, fileType: "hwpx", markdown, blocks, metadata, outline, warnings, images: _optionalChain([images, 'optionalAccess',
|
|
28839
|
+
return { success: true, fileType: "hwpx", markdown, blocks, metadata, outline, warnings, images: _optionalChain([images, 'optionalAccess', _453 => _453.length]) ? images : void 0 };
|
|
28753
28840
|
} catch (err) {
|
|
28754
|
-
return { success: false, fileType: "hwpx", error: err instanceof Error ? err.message : "HWPX \uD30C\uC2F1 \uC2E4\uD328", code:
|
|
28841
|
+
return { success: false, fileType: "hwpx", error: err instanceof Error ? err.message : "HWPX \uD30C\uC2F1 \uC2E4\uD328", code: _chunkOVESZY5Rcjs.classifyError.call(void 0, err) };
|
|
28755
28842
|
}
|
|
28756
28843
|
}
|
|
28757
28844
|
async function parseHwp(buffer, options) {
|
|
28758
28845
|
try {
|
|
28759
28846
|
const { markdown, blocks, metadata, outline, warnings, images } = parseHwp5Document(Buffer.from(buffer), options);
|
|
28760
|
-
if (isDistributionSentinel(markdown) && isComFallbackAvailable() && _optionalChain([options, 'optionalAccess',
|
|
28847
|
+
if (isDistributionSentinel(markdown) && isComFallbackAvailable() && _optionalChain([options, 'optionalAccess', _454 => _454.filePath])) {
|
|
28761
28848
|
try {
|
|
28762
28849
|
const { pages, pageCount, warnings: comWarns } = extractTextViaCom(options.filePath);
|
|
28763
28850
|
if (pages.some((p) => p && p.trim().length > 0)) {
|
|
@@ -28774,15 +28861,15 @@ async function parseHwp(buffer, options) {
|
|
|
28774
28861
|
} catch (e32) {
|
|
28775
28862
|
}
|
|
28776
28863
|
}
|
|
28777
|
-
return { success: true, fileType: "hwp", markdown, blocks, metadata, outline, warnings, images: _optionalChain([images, 'optionalAccess',
|
|
28864
|
+
return { success: true, fileType: "hwp", markdown, blocks, metadata, outline, warnings, images: _optionalChain([images, 'optionalAccess', _455 => _455.length]) ? images : void 0 };
|
|
28778
28865
|
} catch (err) {
|
|
28779
|
-
return { success: false, fileType: "hwp", error: err instanceof Error ? err.message : "HWP \uD30C\uC2F1 \uC2E4\uD328", code:
|
|
28866
|
+
return { success: false, fileType: "hwp", error: err instanceof Error ? err.message : "HWP \uD30C\uC2F1 \uC2E4\uD328", code: _chunkOVESZY5Rcjs.classifyError.call(void 0, err) };
|
|
28780
28867
|
}
|
|
28781
28868
|
}
|
|
28782
28869
|
async function parsePdf(buffer, options) {
|
|
28783
28870
|
let parsePdfDocument;
|
|
28784
28871
|
try {
|
|
28785
|
-
const mod = await Promise.resolve().then(() => _interopRequireWildcard(require("./parser-
|
|
28872
|
+
const mod = await Promise.resolve().then(() => _interopRequireWildcard(require("./parser-FMONFTAN.cjs")));
|
|
28786
28873
|
parsePdfDocument = mod.parsePdfDocument;
|
|
28787
28874
|
} catch (e33) {
|
|
28788
28875
|
return {
|
|
@@ -28797,7 +28884,7 @@ async function parsePdf(buffer, options) {
|
|
|
28797
28884
|
return { success: true, fileType: "pdf", markdown, blocks, metadata, outline, warnings, isImageBased, pageQuality, qualitySummary };
|
|
28798
28885
|
} catch (err) {
|
|
28799
28886
|
const isImageBased = err instanceof Error && "isImageBased" in err ? true : void 0;
|
|
28800
|
-
return { success: false, fileType: "pdf", error: err instanceof Error ? err.message : "PDF \uD30C\uC2F1 \uC2E4\uD328", code:
|
|
28887
|
+
return { success: false, fileType: "pdf", error: err instanceof Error ? err.message : "PDF \uD30C\uC2F1 \uC2E4\uD328", code: _chunkOVESZY5Rcjs.classifyError.call(void 0, err), isImageBased };
|
|
28801
28888
|
}
|
|
28802
28889
|
}
|
|
28803
28890
|
async function parseXlsx(buffer, options) {
|
|
@@ -28805,7 +28892,7 @@ async function parseXlsx(buffer, options) {
|
|
|
28805
28892
|
const { markdown, blocks, metadata, warnings } = await parseXlsxDocument(buffer, options);
|
|
28806
28893
|
return { success: true, fileType: "xlsx", markdown, blocks, metadata, warnings };
|
|
28807
28894
|
} catch (err) {
|
|
28808
|
-
return { success: false, fileType: "xlsx", error: err instanceof Error ? err.message : "XLSX \uD30C\uC2F1 \uC2E4\uD328", code:
|
|
28895
|
+
return { success: false, fileType: "xlsx", error: err instanceof Error ? err.message : "XLSX \uD30C\uC2F1 \uC2E4\uD328", code: _chunkOVESZY5Rcjs.classifyError.call(void 0, err) };
|
|
28809
28896
|
}
|
|
28810
28897
|
}
|
|
28811
28898
|
async function parseXls(buffer, options) {
|
|
@@ -28813,15 +28900,15 @@ async function parseXls(buffer, options) {
|
|
|
28813
28900
|
const { markdown, blocks, metadata, warnings } = await parseXlsDocument(buffer, options);
|
|
28814
28901
|
return { success: true, fileType: "xls", markdown, blocks, metadata, warnings };
|
|
28815
28902
|
} catch (err) {
|
|
28816
|
-
return { success: false, fileType: "xls", error: err instanceof Error ? err.message : "XLS \uD30C\uC2F1 \uC2E4\uD328", code:
|
|
28903
|
+
return { success: false, fileType: "xls", error: err instanceof Error ? err.message : "XLS \uD30C\uC2F1 \uC2E4\uD328", code: _chunkOVESZY5Rcjs.classifyError.call(void 0, err) };
|
|
28817
28904
|
}
|
|
28818
28905
|
}
|
|
28819
28906
|
async function parseDocx(buffer, options) {
|
|
28820
28907
|
try {
|
|
28821
28908
|
const { markdown, blocks, metadata, outline, warnings, images } = await parseDocxDocument(buffer, options);
|
|
28822
|
-
return { success: true, fileType: "docx", markdown, blocks, metadata, outline, warnings, images: _optionalChain([images, 'optionalAccess',
|
|
28909
|
+
return { success: true, fileType: "docx", markdown, blocks, metadata, outline, warnings, images: _optionalChain([images, 'optionalAccess', _456 => _456.length]) ? images : void 0 };
|
|
28823
28910
|
} catch (err) {
|
|
28824
|
-
return { success: false, fileType: "docx", error: err instanceof Error ? err.message : "DOCX \uD30C\uC2F1 \uC2E4\uD328", code:
|
|
28911
|
+
return { success: false, fileType: "docx", error: err instanceof Error ? err.message : "DOCX \uD30C\uC2F1 \uC2E4\uD328", code: _chunkOVESZY5Rcjs.classifyError.call(void 0, err) };
|
|
28825
28912
|
}
|
|
28826
28913
|
}
|
|
28827
28914
|
async function parseHwpml(buffer, options) {
|
|
@@ -28829,16 +28916,16 @@ async function parseHwpml(buffer, options) {
|
|
|
28829
28916
|
const { markdown, blocks, metadata, outline, warnings } = parseHwpmlDocument(buffer, options);
|
|
28830
28917
|
return { success: true, fileType: "hwpml", markdown, blocks, metadata, outline, warnings };
|
|
28831
28918
|
} catch (err) {
|
|
28832
|
-
return { success: false, fileType: "hwpml", error: err instanceof Error ? err.message : "HWPML \uD30C\uC2F1 \uC2E4\uD328", code:
|
|
28919
|
+
return { success: false, fileType: "hwpml", error: err instanceof Error ? err.message : "HWPML \uD30C\uC2F1 \uC2E4\uD328", code: _chunkOVESZY5Rcjs.classifyError.call(void 0, err) };
|
|
28833
28920
|
}
|
|
28834
28921
|
}
|
|
28835
28922
|
async function fillForm(input, values, outputFormat = "markdown") {
|
|
28836
28923
|
let buffer;
|
|
28837
28924
|
if (typeof input === "string") {
|
|
28838
28925
|
const buf = await _promises.readFile.call(void 0, input);
|
|
28839
|
-
buffer =
|
|
28926
|
+
buffer = _chunkOVESZY5Rcjs.toArrayBuffer.call(void 0, buf);
|
|
28840
28927
|
} else if (Buffer.isBuffer(input)) {
|
|
28841
|
-
buffer =
|
|
28928
|
+
buffer = _chunkOVESZY5Rcjs.toArrayBuffer.call(void 0, input);
|
|
28842
28929
|
} else {
|
|
28843
28930
|
buffer = input;
|
|
28844
28931
|
}
|
|
@@ -28864,7 +28951,7 @@ async function fillForm(input, values, outputFormat = "markdown") {
|
|
|
28864
28951
|
throw new Error(`\uC11C\uC2DD \uD30C\uC2F1 \uC2E4\uD328: ${parsed.error}`);
|
|
28865
28952
|
}
|
|
28866
28953
|
const fill = fillFormFields(parsed.blocks, values);
|
|
28867
|
-
const markdown =
|
|
28954
|
+
const markdown = _chunkOVESZY5Rcjs.blocksToMarkdown.call(void 0, fill.blocks);
|
|
28868
28955
|
if (outputFormat === "hwpx") {
|
|
28869
28956
|
const hwpxBuffer = await markdownToHwpx(markdown);
|
|
28870
28957
|
return { output: hwpxBuffer, format: "hwpx", fill };
|
|
@@ -28932,5 +29019,5 @@ async function fillForm(input, values, outputFormat = "markdown") {
|
|
|
28932
29019
|
|
|
28933
29020
|
|
|
28934
29021
|
|
|
28935
|
-
exports.HwpxSession = HwpxSession; exports.PRESET_ALIAS = PRESET_ALIAS; exports.SPACE_EM_FIXED = SPACE_EM_FIXED; exports.SPACE_EM_FONT = SPACE_EM_FONT; exports.VERSION =
|
|
29022
|
+
exports.HwpxSession = HwpxSession; exports.PRESET_ALIAS = PRESET_ALIAS; exports.SPACE_EM_FIXED = SPACE_EM_FIXED; exports.SPACE_EM_FONT = SPACE_EM_FONT; exports.VERSION = _chunkOVESZY5Rcjs.VERSION; exports.ValueCursor = ValueCursor; exports.applySplices = applySplices; exports.blocksToMarkdown = _chunkOVESZY5Rcjs.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.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.parsePdf = parsePdf; exports.parseXls = parseXls; exports.parseXlsx = parseXlsx; exports.patchHwp = patchHwp; exports.patchHwpx = patchHwpx; exports.patchHwpxBlocks = patchHwpxBlocks; exports.placeSealHwpx = placeSealHwpx; exports.renderHtml = renderHtml; exports.renderHwpxToSvg = renderHwpxToSvg; exports.scanSectionXml = scanSectionXml; exports.simulateWrap = simulateWrap; exports.simulateWrapKeepWord = simulateWrapKeepWord; exports.unknownFontWarnings = unknownFontWarnings; exports.validateHwpx = validateHwpx;
|
|
28936
29023
|
//# sourceMappingURL=index.cjs.map
|