kordoc 4.2.4 → 4.2.6
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 +4 -0
- package/dist/{-2M56QRNH.js → -UYYP67I6.js} +8 -8
- package/dist/{chunk-PQ46DC6Y.js → chunk-5E7ZMWDF.js} +2 -2
- package/dist/{chunk-BLNOGMIM.cjs → chunk-5FS4IZWY.cjs} +2 -2
- package/dist/chunk-5FS4IZWY.cjs.map +1 -0
- package/dist/{chunk-DOLK5KIS.js → chunk-64DMMXFW.js} +2 -2
- package/dist/{chunk-PMBWFYZQ.js → chunk-6KT4B4QX.js} +2 -2
- package/dist/{chunk-SCJLAOY3.cjs → chunk-6XVQSILN.cjs} +4 -4
- package/dist/chunk-6XVQSILN.cjs.map +1 -0
- package/dist/chunk-DCZVOIEO.cjs.map +1 -1
- package/dist/{chunk-WMM6XVQX.js → chunk-DSCSR6NE.js} +2 -2
- package/dist/{chunk-LWNFAIYG.js → chunk-EGQQVYKL.js} +3 -3
- package/dist/chunk-GS7T56RP.cjs.map +1 -1
- package/dist/chunk-H7OWEYH2.cjs.map +1 -1
- package/dist/{chunk-YFSYLEXO.cjs → chunk-LIG666DX.cjs} +3 -3
- package/dist/chunk-LIG666DX.cjs.map +1 -0
- package/dist/{chunk-GFTAPAJS.js → chunk-N4BFHNLA.js} +2 -2
- package/dist/{chunk-7Z3NHIRR.js → chunk-NVPCKSNL.js} +2 -2
- package/dist/{chunk-E2K4SNMD.js → chunk-O5JOHYCV.js} +2 -2
- package/dist/{chunk-H6O65EPK.js → chunk-QPPOC6OL.js} +2 -2
- package/dist/chunk-QPPOC6OL.js.map +1 -0
- package/dist/{chunk-7KRCQE3P.js → chunk-SYJ6FPPQ.js} +2 -2
- package/dist/{chunk-OBX3VSIZ.js → chunk-TZLLCYDN.js} +2 -2
- package/dist/{chunk-CAA6DVEE.js → chunk-VQ5NQBL2.js} +22 -15
- package/dist/chunk-VQ5NQBL2.js.map +1 -0
- package/dist/{chunk-ZHRYLT3N.js → chunk-YF6JUAM7.js} +3 -3
- package/dist/{chunk-I53FOXZR.js → chunk-YHAB7UP6.js} +2 -2
- package/dist/{chunk-LXUZUUUG.cjs → chunk-ZB3WT7XX.cjs} +9 -9
- package/dist/chunk-ZB3WT7XX.cjs.map +1 -0
- package/dist/chunks-G7YDTLNI.js +10 -0
- package/dist/cli.js +16 -16
- package/dist/formula-SB3NHDUM.cjs.map +1 -1
- package/dist/{image-ocr-HY42AVXC.js → image-ocr-FXLX2GM6.js} +4 -4
- package/dist/{image-ocr-WCIDB6RY.js → image-ocr-WN3UO4UY.js} +4 -4
- package/dist/{image-ocr-JWAX5EOB.cjs → image-ocr-YOUVLJIH.cjs} +9 -9
- package/dist/image-ocr-YOUVLJIH.cjs.map +1 -0
- package/dist/index.cjs +165 -158
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +18 -11
- package/dist/index.js.map +1 -1
- package/dist/mcp.js +14 -14
- package/dist/page-range-P7SDW6LR.cjs.map +1 -1
- package/dist/{parser-6RDEBLSB.cjs → parser-AUMEO4OU.cjs} +24 -24
- package/dist/parser-AUMEO4OU.cjs.map +1 -0
- package/dist/{parser-WRNS6MX2.js → parser-KIXK2IEX.js} +5 -5
- package/dist/{parser-SVZPCCRG.js → parser-KYSMRSMJ.js} +5 -5
- package/dist/pdf-ocr-2QOASWPI.js +12 -0
- package/dist/pdf-ocr-BUKZ5R4P.cjs +13 -0
- package/dist/pdf-ocr-BUKZ5R4P.cjs.map +1 -0
- package/dist/{pdf-ocr-WM3RZMZY.js → pdf-ocr-NQFV46WZ.js} +4 -4
- package/dist/{profile-io-SWGUQSCL.js → profile-io-NKUXEPI4.js} +3 -3
- package/dist/{rasterize-QA7W6QUF.js → rasterize-OT5TROD4.js} +2 -2
- package/dist/render-HQTKZ3ZE.js +10 -0
- package/dist/seal-KH6IL23B.js +10 -0
- package/dist/{watch-SFQNFU7Q.js → watch-6KMSCCM5.js} +8 -8
- package/package.json +1 -1
- package/dist/chunk-BLNOGMIM.cjs.map +0 -1
- package/dist/chunk-CAA6DVEE.js.map +0 -1
- package/dist/chunk-H6O65EPK.js.map +0 -1
- package/dist/chunk-LXUZUUUG.cjs.map +0 -1
- package/dist/chunk-SCJLAOY3.cjs.map +0 -1
- package/dist/chunk-YFSYLEXO.cjs.map +0 -1
- package/dist/chunks-GT45ALC5.js +0 -10
- package/dist/image-ocr-JWAX5EOB.cjs.map +0 -1
- package/dist/parser-6RDEBLSB.cjs.map +0 -1
- package/dist/pdf-ocr-4SGVLUNL.cjs +0 -13
- package/dist/pdf-ocr-4SGVLUNL.cjs.map +0 -1
- package/dist/pdf-ocr-7AAHJOXQ.js +0 -12
- package/dist/render-DRUIPV77.js +0 -10
- package/dist/seal-3M4ZSW66.js +0 -10
- /package/dist/{-2M56QRNH.js.map → -UYYP67I6.js.map} +0 -0
- /package/dist/{chunk-PQ46DC6Y.js.map → chunk-5E7ZMWDF.js.map} +0 -0
- /package/dist/{chunk-DOLK5KIS.js.map → chunk-64DMMXFW.js.map} +0 -0
- /package/dist/{chunk-PMBWFYZQ.js.map → chunk-6KT4B4QX.js.map} +0 -0
- /package/dist/{chunk-WMM6XVQX.js.map → chunk-DSCSR6NE.js.map} +0 -0
- /package/dist/{chunk-LWNFAIYG.js.map → chunk-EGQQVYKL.js.map} +0 -0
- /package/dist/{chunk-GFTAPAJS.js.map → chunk-N4BFHNLA.js.map} +0 -0
- /package/dist/{chunk-7Z3NHIRR.js.map → chunk-NVPCKSNL.js.map} +0 -0
- /package/dist/{chunk-E2K4SNMD.js.map → chunk-O5JOHYCV.js.map} +0 -0
- /package/dist/{chunk-7KRCQE3P.js.map → chunk-SYJ6FPPQ.js.map} +0 -0
- /package/dist/{chunk-OBX3VSIZ.js.map → chunk-TZLLCYDN.js.map} +0 -0
- /package/dist/{chunk-ZHRYLT3N.js.map → chunk-YF6JUAM7.js.map} +0 -0
- /package/dist/{chunk-I53FOXZR.js.map → chunk-YHAB7UP6.js.map} +0 -0
- /package/dist/{chunks-GT45ALC5.js.map → chunks-G7YDTLNI.js.map} +0 -0
- /package/dist/{image-ocr-HY42AVXC.js.map → image-ocr-FXLX2GM6.js.map} +0 -0
- /package/dist/{image-ocr-WCIDB6RY.js.map → image-ocr-WN3UO4UY.js.map} +0 -0
- /package/dist/{parser-WRNS6MX2.js.map → parser-KIXK2IEX.js.map} +0 -0
- /package/dist/{parser-SVZPCCRG.js.map → parser-KYSMRSMJ.js.map} +0 -0
- /package/dist/{pdf-ocr-7AAHJOXQ.js.map → pdf-ocr-2QOASWPI.js.map} +0 -0
- /package/dist/{pdf-ocr-WM3RZMZY.js.map → pdf-ocr-NQFV46WZ.js.map} +0 -0
- /package/dist/{profile-io-SWGUQSCL.js.map → profile-io-NKUXEPI4.js.map} +0 -0
- /package/dist/{rasterize-QA7W6QUF.js.map → rasterize-OT5TROD4.js.map} +0 -0
- /package/dist/{render-DRUIPV77.js.map → render-HQTKZ3ZE.js.map} +0 -0
- /package/dist/{seal-3M4ZSW66.js.map → seal-KH6IL23B.js.map} +0 -0
- /package/dist/{watch-SFQNFU7Q.js.map → watch-6KMSCCM5.js.map} +0 -0
package/dist/index.cjs
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
|
|
9
9
|
|
|
10
10
|
|
|
11
|
-
var
|
|
11
|
+
var _chunk6XVQSILNcjs = require('./chunk-6XVQSILN.cjs');
|
|
12
12
|
|
|
13
13
|
|
|
14
14
|
var _chunkDCZVOIEOcjs = require('./chunk-DCZVOIEO.cjs');
|
|
@@ -27,7 +27,7 @@ var _chunkDCZVOIEOcjs = require('./chunk-DCZVOIEO.cjs');
|
|
|
27
27
|
|
|
28
28
|
|
|
29
29
|
|
|
30
|
-
var
|
|
30
|
+
var _chunk5FS4IZWYcjs = require('./chunk-5FS4IZWY.cjs');
|
|
31
31
|
|
|
32
32
|
|
|
33
33
|
var _chunkGS7T56RPcjs = require('./chunk-GS7T56RP.cjs');
|
|
@@ -413,7 +413,7 @@ function comResultToParseResult(pages, pageCount, warnings) {
|
|
|
413
413
|
var _xmldom = require('@xmldom/xmldom');
|
|
414
414
|
var MAX_DECOMPRESS_SIZE = 256 * 1024 * 1024;
|
|
415
415
|
var MAX_ZIP_ENTRIES = 500;
|
|
416
|
-
var ZipBombError = class extends
|
|
416
|
+
var ZipBombError = class extends _chunk5FS4IZWYcjs.KordocError {
|
|
417
417
|
constructor(message) {
|
|
418
418
|
super(message);
|
|
419
419
|
this.name = "ZipBombError";
|
|
@@ -429,7 +429,7 @@ function createSectionShared() {
|
|
|
429
429
|
function createXmlParser(warnings) {
|
|
430
430
|
return new (0, _xmldom.DOMParser)({
|
|
431
431
|
onError(level, msg2) {
|
|
432
|
-
if (level === "fatalError") throw new (0,
|
|
432
|
+
if (level === "fatalError") throw new (0, _chunk5FS4IZWYcjs.KordocError)(`XML \uD30C\uC2F1 \uC2E4\uD328: ${msg2}`);
|
|
433
433
|
_optionalChain([warnings, 'optionalAccess', _3 => _3.push, 'call', _4 => _4({ code: "MALFORMED_XML", message: `XML ${level === "warning" ? "\uACBD\uACE0" : "\uC624\uB958"}: ${msg2}` })]);
|
|
434
434
|
}
|
|
435
435
|
});
|
|
@@ -506,10 +506,10 @@ async function extractHwpxStyles(zip, decompressed) {
|
|
|
506
506
|
const xml = await file.async("text");
|
|
507
507
|
if (decompressed) {
|
|
508
508
|
decompressed.total += xml.length * 2;
|
|
509
|
-
if (decompressed.total > MAX_DECOMPRESS_SIZE) throw new (0,
|
|
509
|
+
if (decompressed.total > MAX_DECOMPRESS_SIZE) throw new (0, _chunk5FS4IZWYcjs.KordocError)("ZIP \uC555\uCD95 \uD574\uC81C \uD06C\uAE30 \uCD08\uACFC (ZIP bomb \uC758\uC2EC)");
|
|
510
510
|
}
|
|
511
511
|
const parser = createXmlParser();
|
|
512
|
-
const doc = parser.parseFromString(
|
|
512
|
+
const doc = parser.parseFromString(_chunk5FS4IZWYcjs.stripDtd.call(void 0, xml), "text/xml");
|
|
513
513
|
if (!doc.documentElement) continue;
|
|
514
514
|
const domDoc = doc;
|
|
515
515
|
parseCharProperties(domDoc, result.charProperties);
|
|
@@ -696,9 +696,9 @@ function detectHwpxHeadings(blocks, styleMap) {
|
|
|
696
696
|
let level = 0;
|
|
697
697
|
if (baseFontSize > 0 && _optionalChain([block, 'access', _11 => _11.style, 'optionalAccess', _12 => _12.fontSize])) {
|
|
698
698
|
const ratio = block.style.fontSize / baseFontSize;
|
|
699
|
-
if (ratio >=
|
|
700
|
-
else if (ratio >=
|
|
701
|
-
else if (ratio >=
|
|
699
|
+
if (ratio >= _chunk5FS4IZWYcjs.HEADING_RATIO_H1) level = 1;
|
|
700
|
+
else if (ratio >= _chunk5FS4IZWYcjs.HEADING_RATIO_H2) level = 2;
|
|
701
|
+
else if (ratio >= _chunk5FS4IZWYcjs.HEADING_RATIO_H3) level = 3;
|
|
702
702
|
}
|
|
703
703
|
const compactText = text.replace(/\s+/g, "");
|
|
704
704
|
if (/^제\d+[조장절편]/.test(compactText) && text.length <= 50) {
|
|
@@ -1623,7 +1623,7 @@ function needsGaejosikAssets(gongmun) {
|
|
|
1623
1623
|
}
|
|
1624
1624
|
function assertFiniteRange(name, value, min, max) {
|
|
1625
1625
|
if (!Number.isFinite(value) || value < min || value > max) {
|
|
1626
|
-
throw new (0,
|
|
1626
|
+
throw new (0, _chunk5FS4IZWYcjs.KordocError)(`${name} must be a finite number between ${min} and ${max}`);
|
|
1627
1627
|
}
|
|
1628
1628
|
}
|
|
1629
1629
|
function validateGongmunOptions(opts) {
|
|
@@ -1638,10 +1638,10 @@ function validateGongmunOptions(opts) {
|
|
|
1638
1638
|
assertFiniteRange(`margins.${side}`, value, 0, 200);
|
|
1639
1639
|
}
|
|
1640
1640
|
if (opts.margins.left + opts.margins.right >= 210) {
|
|
1641
|
-
throw new (0,
|
|
1641
|
+
throw new (0, _chunk5FS4IZWYcjs.KordocError)("margins.left + margins.right must be less than 210");
|
|
1642
1642
|
}
|
|
1643
1643
|
if (opts.margins.top + opts.margins.bottom >= 297) {
|
|
1644
|
-
throw new (0,
|
|
1644
|
+
throw new (0, _chunk5FS4IZWYcjs.KordocError)("margins.top + margins.bottom must be less than 297");
|
|
1645
1645
|
}
|
|
1646
1646
|
}
|
|
1647
1647
|
if (opts.sizes) {
|
|
@@ -1650,7 +1650,7 @@ function validateGongmunOptions(opts) {
|
|
|
1650
1650
|
}
|
|
1651
1651
|
}
|
|
1652
1652
|
if (opts.approval && opts.approval.length > 6) {
|
|
1653
|
-
throw new (0,
|
|
1653
|
+
throw new (0, _chunk5FS4IZWYcjs.KordocError)("approval must contain at most 6 labels");
|
|
1654
1654
|
}
|
|
1655
1655
|
}
|
|
1656
1656
|
function incompatibleGongmunWarnings(opts) {
|
|
@@ -1915,7 +1915,7 @@ function resolveParaHeading(paraEl, ctx) {
|
|
|
1915
1915
|
|
|
1916
1916
|
// src/hwpx/table-build.ts
|
|
1917
1917
|
function buildTableWithCellMeta(state, keepAnchoredEmptyCols) {
|
|
1918
|
-
const table2 =
|
|
1918
|
+
const table2 = _chunk6XVQSILNcjs.buildTable.call(void 0, state.rows, { keepAnchoredEmptyCols });
|
|
1919
1919
|
if (state.caption) table2.caption = state.caption;
|
|
1920
1920
|
const anchors = [];
|
|
1921
1921
|
{
|
|
@@ -1985,9 +1985,13 @@ function completeTable(newTable, tableStack, blocks, ctx) {
|
|
|
1985
1985
|
const cell2 = parentTable.cell;
|
|
1986
1986
|
(cell2.blocks ??= []).push(block);
|
|
1987
1987
|
cell2.hasStructure = true;
|
|
1988
|
-
let flat =
|
|
1988
|
+
let flat = _chunk6XVQSILNcjs.convertTableToText.call(void 0, newTable.rows);
|
|
1989
1989
|
if (newTable.caption) flat = newTable.caption + (flat ? "\n" + flat : "");
|
|
1990
|
-
if (flat)
|
|
1990
|
+
if (flat) {
|
|
1991
|
+
const inlineJoin = newTable.inline === true && cell2.lineOpen === true;
|
|
1992
|
+
cell2.text += (cell2.text ? inlineJoin ? " " : "\n" : "") + flat;
|
|
1993
|
+
cell2.lineOpen = newTable.inline === true;
|
|
1994
|
+
}
|
|
1991
1995
|
} else {
|
|
1992
1996
|
blocks.push(block);
|
|
1993
1997
|
}
|
|
@@ -1997,7 +2001,7 @@ function completeTable(newTable, tableStack, blocks, ctx) {
|
|
|
1997
2001
|
// src/hwpx/section-walker.ts
|
|
1998
2002
|
function parseSectionXml(xml, styleMap, warnings, sectionNum, shared) {
|
|
1999
2003
|
const parser = createXmlParser(warnings);
|
|
2000
|
-
const doc = parser.parseFromString(
|
|
2004
|
+
const doc = parser.parseFromString(_chunk5FS4IZWYcjs.stripDtd.call(void 0, xml), "text/xml");
|
|
2001
2005
|
if (!doc.documentElement) return [];
|
|
2002
2006
|
const ctx = { styleMap, warnings, sectionNum, shared: _nullishCoalesce(shared, () => ( createSectionShared())) };
|
|
2003
2007
|
ctx.shared.track.deleteDepth = 0;
|
|
@@ -2103,8 +2107,8 @@ function walkSection(node, blocks, tableCtx, tableStack, ctx, depth = 0) {
|
|
|
2103
2107
|
const cs = isNaN(rawCs) ? 1 : rawCs;
|
|
2104
2108
|
const rawRs = parseInt(el.getAttribute("rowSpan") || "1", 10);
|
|
2105
2109
|
const rs = isNaN(rawRs) ? 1 : rawRs;
|
|
2106
|
-
tableCtx.cell.colSpan = clampSpan(cs,
|
|
2107
|
-
tableCtx.cell.rowSpan = clampSpan(rs,
|
|
2110
|
+
tableCtx.cell.colSpan = clampSpan(cs, _chunk6XVQSILNcjs.MAX_COLS);
|
|
2111
|
+
tableCtx.cell.rowSpan = clampSpan(rs, _chunk6XVQSILNcjs.MAX_ROWS);
|
|
2108
2112
|
}
|
|
2109
2113
|
break;
|
|
2110
2114
|
case "p": {
|
|
@@ -2118,6 +2122,7 @@ function walkSection(node, blocks, tableCtx, tableStack, ctx, depth = 0) {
|
|
|
2118
2122
|
}
|
|
2119
2123
|
if (segments) {
|
|
2120
2124
|
const cell2 = _nullishCoalesce(_optionalChain([tableCtx, 'optionalAccess', _36 => _36.cell]), () => ( null));
|
|
2125
|
+
if (cell2) cell2.lineOpen = false;
|
|
2121
2126
|
const segs = [...segments];
|
|
2122
2127
|
if (_optionalChain([ph, 'optionalAccess', _37 => _37.prefix])) {
|
|
2123
2128
|
const fi = segs.findIndex((s) => s);
|
|
@@ -2136,7 +2141,8 @@ function walkSection(node, blocks, tableCtx, tableStack, ctx, depth = 0) {
|
|
|
2136
2141
|
if (footnote) block.footnoteText = footnote;
|
|
2137
2142
|
}
|
|
2138
2143
|
if (cell2) {
|
|
2139
|
-
cell2.text += (cell2.text ? "\n" : "") + s;
|
|
2144
|
+
cell2.text += (cell2.text ? cell2.lineOpen ? " " : "\n" : "") + s;
|
|
2145
|
+
cell2.lineOpen = true;
|
|
2140
2146
|
(cell2.blocks ??= []).push(block);
|
|
2141
2147
|
} else blocks.push(block);
|
|
2142
2148
|
};
|
|
@@ -2344,7 +2350,7 @@ function flattenSubListTable(el, ctx, depth) {
|
|
|
2344
2350
|
const sink = [];
|
|
2345
2351
|
const st = { rows: [], currentRow: [], cell: null };
|
|
2346
2352
|
walkSection(el, sink, st, [], ctx, depth + 1);
|
|
2347
|
-
let flat =
|
|
2353
|
+
let flat = _chunk6XVQSILNcjs.convertTableToText.call(void 0, st.rows);
|
|
2348
2354
|
if (st.caption) flat = st.caption + (flat ? "\n" + flat : "");
|
|
2349
2355
|
return flat;
|
|
2350
2356
|
}
|
|
@@ -2388,7 +2394,7 @@ function walkParagraphChildren(node, blocks, tableCtx, tableStack, ctx, depth =
|
|
|
2388
2394
|
}
|
|
2389
2395
|
}
|
|
2390
2396
|
if (tableCtx) tableStack.push(tableCtx);
|
|
2391
|
-
const newTable = { rows: [], currentRow: [], cell: null };
|
|
2397
|
+
const newTable = { rows: [], currentRow: [], cell: null, inline: isInlineTbl(el) };
|
|
2392
2398
|
walkSection(el, blocks, newTable, tableStack, ctx, d + 1);
|
|
2393
2399
|
tableCtx = completeTable(newTable, tableStack, blocks, ctx);
|
|
2394
2400
|
} else if (localTag === "caption" && !inShape) {
|
|
@@ -2481,7 +2487,7 @@ function extractHyperlinkHref(fieldBegin) {
|
|
|
2481
2487
|
let url = (ch.textContent || "").trim();
|
|
2482
2488
|
if (!url) continue;
|
|
2483
2489
|
url = url.replace(/^https?:\/\/(?=https?:\/\/)/i, "");
|
|
2484
|
-
const safe =
|
|
2490
|
+
const safe = _chunk5FS4IZWYcjs.sanitizeHref.call(void 0, url);
|
|
2485
2491
|
if (safe) return safe;
|
|
2486
2492
|
}
|
|
2487
2493
|
return void 0;
|
|
@@ -2641,7 +2647,7 @@ function extractParagraphInfo(para2, styleMap, ctx) {
|
|
|
2641
2647
|
case "hyperlink": {
|
|
2642
2648
|
const url = child.getAttribute("url") || child.getAttribute("href") || "";
|
|
2643
2649
|
if (url) {
|
|
2644
|
-
const safe =
|
|
2650
|
+
const safe = _chunk5FS4IZWYcjs.sanitizeHref.call(void 0, url);
|
|
2645
2651
|
if (safe) href = safe;
|
|
2646
2652
|
}
|
|
2647
2653
|
walk(child, depth + 1);
|
|
@@ -2915,7 +2921,7 @@ function decompressStream(data) {
|
|
|
2915
2921
|
return _zlib.inflateRawSync.call(void 0, data, opts);
|
|
2916
2922
|
}
|
|
2917
2923
|
function parseFileHeader(data) {
|
|
2918
|
-
if (data.length < 40) throw new (0,
|
|
2924
|
+
if (data.length < 40) throw new (0, _chunk5FS4IZWYcjs.KordocError)("FileHeader\uAC00 \uB108\uBB34 \uC9E7\uC2B5\uB2C8\uB2E4 (\uCD5C\uC18C 40\uBC14\uC774\uD2B8)");
|
|
2919
2925
|
const sig = data.subarray(0, 32).toString("utf8").replace(/\0+$/, "");
|
|
2920
2926
|
return {
|
|
2921
2927
|
signature: sig,
|
|
@@ -3364,13 +3370,13 @@ async function extractImagesFromZip(zip, blocks, decompressed, warnings, sweepUn
|
|
|
3364
3370
|
}
|
|
3365
3371
|
const allCandidates = resolvedPath ? [resolvedPath, ...candidates] : candidates;
|
|
3366
3372
|
for (const path of allCandidates) {
|
|
3367
|
-
if (
|
|
3373
|
+
if (_chunk5FS4IZWYcjs.isPathTraversal.call(void 0, path)) continue;
|
|
3368
3374
|
const file = zip.file(path);
|
|
3369
3375
|
if (!file) continue;
|
|
3370
3376
|
try {
|
|
3371
3377
|
const data = await file.async("uint8array");
|
|
3372
3378
|
decompressed.total += data.length;
|
|
3373
|
-
if (decompressed.total > MAX_DECOMPRESS_SIZE) throw new (0,
|
|
3379
|
+
if (decompressed.total > MAX_DECOMPRESS_SIZE) throw new (0, _chunk5FS4IZWYcjs.KordocError)("ZIP \uC555\uCD95 \uD574\uC81C \uD06C\uAE30 \uCD08\uACFC (ZIP bomb \uC758\uC2EC)");
|
|
3374
3380
|
const ext = path.includes(".") ? path.split(".").pop() || "png" : "png";
|
|
3375
3381
|
const mimeType = imageExtToMime(ext);
|
|
3376
3382
|
imageIndex++;
|
|
@@ -3380,7 +3386,7 @@ async function extractImagesFromZip(zip, blocks, decompressed, warnings, sweepUn
|
|
|
3380
3386
|
usedPaths.add(path);
|
|
3381
3387
|
break;
|
|
3382
3388
|
} catch (err) {
|
|
3383
|
-
if (err instanceof
|
|
3389
|
+
if (err instanceof _chunk5FS4IZWYcjs.KordocError) throw err;
|
|
3384
3390
|
}
|
|
3385
3391
|
}
|
|
3386
3392
|
if (!img) _optionalChain([warnings, 'optionalAccess', _78 => _78.push, 'call', _79 => _79({ page: block.pageNumber, message: `\uC774\uBBF8\uC9C0 \uD30C\uC77C \uC5C6\uC74C: ${ref}`, code: "SKIPPED_IMAGE" })]);
|
|
@@ -3400,11 +3406,11 @@ async function extractImagesFromZip(zip, blocks, decompressed, warnings, sweepUn
|
|
|
3400
3406
|
if (sweepUnreferenced) {
|
|
3401
3407
|
const binEntries = zip.file(/(?:^|\/)BinData\//i);
|
|
3402
3408
|
for (const file of binEntries) {
|
|
3403
|
-
if (file.dir || usedPaths.has(file.name) ||
|
|
3409
|
+
if (file.dir || usedPaths.has(file.name) || _chunk5FS4IZWYcjs.isPathTraversal.call(void 0, file.name)) continue;
|
|
3404
3410
|
try {
|
|
3405
3411
|
const data = await file.async("uint8array");
|
|
3406
3412
|
decompressed.total += data.length;
|
|
3407
|
-
if (decompressed.total > MAX_DECOMPRESS_SIZE) throw new (0,
|
|
3413
|
+
if (decompressed.total > MAX_DECOMPRESS_SIZE) throw new (0, _chunk5FS4IZWYcjs.KordocError)("ZIP \uC555\uCD95 \uD574\uC81C \uD06C\uAE30 \uCD08\uACFC (ZIP bomb \uC758\uC2EC)");
|
|
3408
3414
|
const ext = file.name.includes(".") ? file.name.split(".").pop() || "" : "";
|
|
3409
3415
|
let mimeType = imageExtToMime(ext);
|
|
3410
3416
|
if (mimeType === "application/octet-stream") {
|
|
@@ -3418,7 +3424,7 @@ async function extractImagesFromZip(zip, blocks, decompressed, warnings, sweepUn
|
|
|
3418
3424
|
images.push(img);
|
|
3419
3425
|
blocks.push({ type: "image", text: filename, imageData: { data, mimeType, filename: file.name } });
|
|
3420
3426
|
} catch (err) {
|
|
3421
|
-
if (err instanceof
|
|
3427
|
+
if (err instanceof _chunk5FS4IZWYcjs.KordocError) throw err;
|
|
3422
3428
|
_optionalChain([warnings, 'optionalAccess', _80 => _80.push, 'call', _81 => _81({ message: `\uC774\uBBF8\uC9C0 \uCD94\uCD9C \uC2E4\uD328: ${file.name}`, code: "SKIPPED_IMAGE" })]);
|
|
3423
3429
|
}
|
|
3424
3430
|
}
|
|
@@ -3469,7 +3475,7 @@ function extractFromBrokenZip(buffer) {
|
|
|
3469
3475
|
}
|
|
3470
3476
|
const nameBytes = data.slice(pos + 30, pos + 30 + nameLen);
|
|
3471
3477
|
const name = new TextDecoder().decode(nameBytes);
|
|
3472
|
-
if (
|
|
3478
|
+
if (_chunk5FS4IZWYcjs.isPathTraversal.call(void 0, name)) {
|
|
3473
3479
|
pos = fileStart + compSize;
|
|
3474
3480
|
continue;
|
|
3475
3481
|
}
|
|
@@ -3487,16 +3493,16 @@ function extractFromBrokenZip(buffer) {
|
|
|
3487
3493
|
continue;
|
|
3488
3494
|
}
|
|
3489
3495
|
totalDecompressed += content.length * 2;
|
|
3490
|
-
if (totalDecompressed > MAX_DECOMPRESS_SIZE) throw new (0,
|
|
3496
|
+
if (totalDecompressed > MAX_DECOMPRESS_SIZE) throw new (0, _chunk5FS4IZWYcjs.KordocError)("\uC555\uCD95 \uD574\uC81C \uD06C\uAE30 \uCD08\uACFC");
|
|
3491
3497
|
sectionNum++;
|
|
3492
3498
|
blocks.push(...parseSectionXml(content, void 0, warnings, sectionNum, shared));
|
|
3493
3499
|
} catch (e16) {
|
|
3494
3500
|
continue;
|
|
3495
3501
|
}
|
|
3496
3502
|
}
|
|
3497
|
-
if (blocks.length === 0) throw new (0,
|
|
3503
|
+
if (blocks.length === 0) throw new (0, _chunk5FS4IZWYcjs.KordocError)("\uC190\uC0C1\uB41C HWPX\uC5D0\uC11C \uC139\uC158 \uB370\uC774\uD130\uB97C \uBCF5\uAD6C\uD560 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4");
|
|
3498
3504
|
applyPageText(blocks, shared);
|
|
3499
|
-
const markdown =
|
|
3505
|
+
const markdown = _chunk6XVQSILNcjs.blocksToMarkdown.call(void 0, blocks);
|
|
3500
3506
|
return { markdown, blocks, warnings: warnings.length > 0 ? warnings : void 0 };
|
|
3501
3507
|
}
|
|
3502
3508
|
async function readKordocLayout(zip) {
|
|
@@ -3521,18 +3527,18 @@ async function resolveSectionPaths(zip) {
|
|
|
3521
3527
|
if (paths.length > 0) return paths;
|
|
3522
3528
|
}
|
|
3523
3529
|
const sectionFiles = zip.file(/[Ss]ection\d+\.xml$/);
|
|
3524
|
-
return sectionFiles.map((f) => f.name).sort(
|
|
3530
|
+
return sectionFiles.map((f) => f.name).sort(_chunk5FS4IZWYcjs.compareSectionPaths);
|
|
3525
3531
|
}
|
|
3526
3532
|
function parseSectionPathsFromManifest(xml) {
|
|
3527
3533
|
const parser = createXmlParser();
|
|
3528
|
-
const doc = parser.parseFromString(
|
|
3534
|
+
const doc = parser.parseFromString(_chunk5FS4IZWYcjs.stripDtd.call(void 0, xml), "text/xml");
|
|
3529
3535
|
const items = doc.getElementsByTagName("opf:item");
|
|
3530
3536
|
const spine = doc.getElementsByTagName("opf:itemref");
|
|
3531
3537
|
const idToHref = /* @__PURE__ */ new Map();
|
|
3532
3538
|
for (let i = 0; i < items.length; i++) {
|
|
3533
3539
|
const item = items[i];
|
|
3534
3540
|
const id = item.getAttribute("id") || "";
|
|
3535
|
-
const href =
|
|
3541
|
+
const href = _chunk5FS4IZWYcjs.normalizeSectionHref.call(void 0, item.getAttribute("href") || "");
|
|
3536
3542
|
if (id && href) idToHref.set(id, href);
|
|
3537
3543
|
}
|
|
3538
3544
|
if (spine.length > 0) {
|
|
@@ -3543,7 +3549,7 @@ function parseSectionPathsFromManifest(xml) {
|
|
|
3543
3549
|
}
|
|
3544
3550
|
if (ordered.length > 0) return ordered;
|
|
3545
3551
|
}
|
|
3546
|
-
return Array.from(idToHref.values()).sort(
|
|
3552
|
+
return Array.from(idToHref.values()).sort(_chunk5FS4IZWYcjs.compareSectionPaths);
|
|
3547
3553
|
}
|
|
3548
3554
|
|
|
3549
3555
|
// src/hwpx/metadata.ts
|
|
@@ -3556,7 +3562,7 @@ async function extractHwpxMetadata(zip, metadata, decompressed) {
|
|
|
3556
3562
|
const xml = await file.async("text");
|
|
3557
3563
|
if (decompressed) {
|
|
3558
3564
|
decompressed.total += xml.length * 2;
|
|
3559
|
-
if (decompressed.total > MAX_DECOMPRESS_SIZE) throw new (0,
|
|
3565
|
+
if (decompressed.total > MAX_DECOMPRESS_SIZE) throw new (0, _chunk5FS4IZWYcjs.KordocError)("ZIP \uC555\uCD95 \uD574\uC81C \uD06C\uAE30 \uCD08\uACFC (ZIP bomb \uC758\uC2EC)");
|
|
3560
3566
|
}
|
|
3561
3567
|
parseDublinCoreMetadata(xml, metadata);
|
|
3562
3568
|
if (metadata.title || metadata.author) return;
|
|
@@ -3566,7 +3572,7 @@ async function extractHwpxMetadata(zip, metadata, decompressed) {
|
|
|
3566
3572
|
}
|
|
3567
3573
|
function parseDublinCoreMetadata(xml, metadata) {
|
|
3568
3574
|
const parser = createXmlParser();
|
|
3569
|
-
const doc = parser.parseFromString(
|
|
3575
|
+
const doc = parser.parseFromString(_chunk5FS4IZWYcjs.stripDtd.call(void 0, xml), "text/xml");
|
|
3570
3576
|
if (!doc.documentElement) return;
|
|
3571
3577
|
const getText = (tagNames) => {
|
|
3572
3578
|
for (const tag of tagNames) {
|
|
@@ -3591,7 +3597,7 @@ function parseDublinCoreMetadata(xml, metadata) {
|
|
|
3591
3597
|
|
|
3592
3598
|
// src/hwpx/parser.ts
|
|
3593
3599
|
async function parseHwpxDocument(buffer, options) {
|
|
3594
|
-
|
|
3600
|
+
_chunk5FS4IZWYcjs.precheckZipSize.call(void 0, buffer, MAX_DECOMPRESS_SIZE, MAX_ZIP_ENTRIES);
|
|
3595
3601
|
let zip;
|
|
3596
3602
|
try {
|
|
3597
3603
|
zip = await _jszip2.default.loadAsync(buffer);
|
|
@@ -3600,7 +3606,7 @@ async function parseHwpxDocument(buffer, options) {
|
|
|
3600
3606
|
}
|
|
3601
3607
|
const actualEntryCount = Object.keys(zip.files).length;
|
|
3602
3608
|
if (actualEntryCount > MAX_ZIP_ENTRIES) {
|
|
3603
|
-
throw new (0,
|
|
3609
|
+
throw new (0, _chunk5FS4IZWYcjs.KordocError)("ZIP \uC5D4\uD2B8\uB9AC \uC218 \uCD08\uACFC (ZIP bomb \uC758\uC2EC)");
|
|
3604
3610
|
}
|
|
3605
3611
|
const manifestFile = zip.file("META-INF/manifest.xml");
|
|
3606
3612
|
if (manifestFile) {
|
|
@@ -3612,7 +3618,7 @@ async function parseHwpxDocument(buffer, options) {
|
|
|
3612
3618
|
return comResultToParseResult(pages, pageCount, warnings2);
|
|
3613
3619
|
}
|
|
3614
3620
|
}
|
|
3615
|
-
throw new (0,
|
|
3621
|
+
throw new (0, _chunk5FS4IZWYcjs.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.");
|
|
3616
3622
|
}
|
|
3617
3623
|
}
|
|
3618
3624
|
const decompressed = { total: 0 };
|
|
@@ -3621,7 +3627,7 @@ async function parseHwpxDocument(buffer, options) {
|
|
|
3621
3627
|
const styleMap = await extractHwpxStyles(zip, decompressed);
|
|
3622
3628
|
const warnings = [];
|
|
3623
3629
|
const sectionPaths = await resolveSectionPaths(zip);
|
|
3624
|
-
if (sectionPaths.length === 0) throw new (0,
|
|
3630
|
+
if (sectionPaths.length === 0) throw new (0, _chunk5FS4IZWYcjs.KordocError)("HWPX\uC5D0\uC11C \uC139\uC158 \uD30C\uC77C\uC744 \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4");
|
|
3625
3631
|
metadata.pageCount = sectionPaths.length;
|
|
3626
3632
|
const pageFilter = _optionalChain([options, 'optionalAccess', _90 => _90.pages]) ? _chunkDCZVOIEOcjs.parsePageRange.call(void 0, options.pages, sectionPaths.length) : null;
|
|
3627
3633
|
const totalTarget = pageFilter ? pageFilter.size : sectionPaths.length;
|
|
@@ -3650,7 +3656,7 @@ async function parseHwpxDocument(buffer, options) {
|
|
|
3650
3656
|
const images = await extractImagesFromZip(zip, blocks, decompressed, warnings, !pageFilter);
|
|
3651
3657
|
detectHwpxHeadings(blocks, styleMap);
|
|
3652
3658
|
const outline = blocks.filter((b) => b.type === "heading" && b.level && b.text).map((b) => ({ level: b.level, text: b.text, pageNumber: b.pageNumber }));
|
|
3653
|
-
const markdown =
|
|
3659
|
+
const markdown = _chunk6XVQSILNcjs.blocksToMarkdown.call(void 0, blocks);
|
|
3654
3660
|
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 };
|
|
3655
3661
|
}
|
|
3656
3662
|
|
|
@@ -4829,7 +4835,7 @@ function parseHwp5Document(buffer, options) {
|
|
|
4829
4835
|
lenientCfb = parseLenientCfb(buffer);
|
|
4830
4836
|
warnings.push({ message: "\uC190\uC0C1\uB41C CFB \uCEE8\uD14C\uC774\uB108 \u2014 lenient \uBAA8\uB4DC\uB85C \uBCF5\uAD6C", code: "LENIENT_CFB_RECOVERY" });
|
|
4831
4837
|
} catch (e22) {
|
|
4832
|
-
throw new (0,
|
|
4838
|
+
throw new (0, _chunk5FS4IZWYcjs.KordocError)("CFB \uCEE8\uD14C\uC774\uB108 \uD30C\uC2F1 \uC2E4\uD328 (strict \uBC0F lenient \uBAA8\uB450)");
|
|
4833
4839
|
}
|
|
4834
4840
|
}
|
|
4835
4841
|
const findStream = (path) => {
|
|
@@ -4840,11 +4846,11 @@ function parseHwp5Document(buffer, options) {
|
|
|
4840
4846
|
return lenientCfb.findStream(path);
|
|
4841
4847
|
};
|
|
4842
4848
|
const headerData = findStream("/FileHeader");
|
|
4843
|
-
if (!headerData) throw new (0,
|
|
4849
|
+
if (!headerData) throw new (0, _chunk5FS4IZWYcjs.KordocError)("FileHeader \uC2A4\uD2B8\uB9BC \uC5C6\uC74C");
|
|
4844
4850
|
const header = parseFileHeader(headerData);
|
|
4845
|
-
if (header.signature !== "HWP Document File") throw new (0,
|
|
4846
|
-
if (header.flags & FLAG_ENCRYPTED) throw new (0,
|
|
4847
|
-
if (header.flags & FLAG_DRM) throw new (0,
|
|
4851
|
+
if (header.signature !== "HWP Document File") throw new (0, _chunk5FS4IZWYcjs.KordocError)("HWP \uC2DC\uADF8\uB2C8\uCC98 \uBD88\uC77C\uCE58");
|
|
4852
|
+
if (header.flags & FLAG_ENCRYPTED) throw new (0, _chunk5FS4IZWYcjs.KordocError)("\uC554\uD638\uD654\uB41C HWP\uB294 \uC9C0\uC6D0\uD558\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4");
|
|
4853
|
+
if (header.flags & FLAG_DRM) throw new (0, _chunk5FS4IZWYcjs.KordocError)("DRM \uBCF4\uD638\uB41C HWP\uB294 \uC9C0\uC6D0\uD558\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4");
|
|
4848
4854
|
const compressed = (header.flags & FLAG_COMPRESSED) !== 0;
|
|
4849
4855
|
const distribution = (header.flags & FLAG_DISTRIBUTION) !== 0;
|
|
4850
4856
|
const metadata = {
|
|
@@ -4853,7 +4859,7 @@ function parseHwp5Document(buffer, options) {
|
|
|
4853
4859
|
if (cfb) extractHwp5Metadata(cfb, metadata);
|
|
4854
4860
|
const docInfo = cfb ? parseDocInfoStream(cfb, compressed) : parseDocInfoFromStream(findStream("/DocInfo"), compressed);
|
|
4855
4861
|
const sections = distribution ? cfb ? findViewTextSections(cfb, compressed) : findViewTextSectionsLenient(lenientCfb, compressed) : cfb ? findSections(cfb) : findSectionsLenient(lenientCfb, compressed);
|
|
4856
|
-
if (sections.length === 0) throw new (0,
|
|
4862
|
+
if (sections.length === 0) throw new (0, _chunk5FS4IZWYcjs.KordocError)("\uC139\uC158 \uC2A4\uD2B8\uB9BC\uC744 \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4");
|
|
4857
4863
|
metadata.pageCount = sections.length;
|
|
4858
4864
|
const pageFilter = _optionalChain([options, 'optionalAccess', _95 => _95.pages]) ? _chunkDCZVOIEOcjs.parsePageRange.call(void 0, options.pages, sections.length) : null;
|
|
4859
4865
|
const totalTarget = pageFilter ? pageFilter.size : sections.length;
|
|
@@ -4868,22 +4874,22 @@ function parseHwp5Document(buffer, options) {
|
|
|
4868
4874
|
const sectionData = sections[si];
|
|
4869
4875
|
const data = !distribution && compressed ? decompressStream(Buffer.from(sectionData)) : Buffer.from(sectionData);
|
|
4870
4876
|
totalDecompressed += data.length;
|
|
4871
|
-
if (totalDecompressed > MAX_TOTAL_DECOMPRESS) throw new (0,
|
|
4877
|
+
if (totalDecompressed > MAX_TOTAL_DECOMPRESS) throw new (0, _chunk5FS4IZWYcjs.KordocError)("\uCD1D \uC555\uCD95 \uD574\uC81C \uD06C\uAE30 \uCD08\uACFC (decompression bomb \uC758\uC2EC)");
|
|
4872
4878
|
const records = readRecords(data);
|
|
4873
4879
|
const sectionBlocks = parseSection(records, docInfo, warnings, si + 1, doc);
|
|
4874
4880
|
bodyBlocks.push(...sectionBlocks);
|
|
4875
4881
|
parsedSections++;
|
|
4876
4882
|
_optionalChain([options, 'optionalAccess', _97 => _97.onProgress, 'optionalCall', _98 => _98(parsedSections, totalTarget)]);
|
|
4877
4883
|
} catch (secErr) {
|
|
4878
|
-
if (secErr instanceof
|
|
4884
|
+
if (secErr instanceof _chunk5FS4IZWYcjs.KordocError) throw secErr;
|
|
4879
4885
|
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" });
|
|
4880
4886
|
}
|
|
4881
4887
|
}
|
|
4882
4888
|
const blocks = [...doc.headerBlocks, ...bodyBlocks, ...doc.footerBlocks];
|
|
4883
4889
|
const images = cfb ? extractHwp5Images(cfb.FileIndex, blocks, warnings, !pageFilter) : extractHwp5ImagesLenient(lenientCfb, blocks, warnings, !pageFilter);
|
|
4884
|
-
let flatBlocks =
|
|
4890
|
+
let flatBlocks = _chunk6XVQSILNcjs.flattenLayoutTables.call(void 0, blocks);
|
|
4885
4891
|
if (_optionalChain([options, 'optionalAccess', _99 => _99.dedupeRunningHeaders])) {
|
|
4886
|
-
const deduped =
|
|
4892
|
+
const deduped = _chunk6XVQSILNcjs.dedupeRunningHeaders.call(void 0, flatBlocks);
|
|
4887
4893
|
const removed = flatBlocks.length - deduped.length;
|
|
4888
4894
|
if (removed > 0) warnings.push({ message: `\uBC18\uBCF5 \uB7EC\uB2DD \uD5E4\uB354 ${removed}\uAC1C \uC81C\uAC70`, code: "HIDDEN_TEXT_FILTERED" });
|
|
4889
4895
|
flatBlocks = deduped;
|
|
@@ -4892,10 +4898,10 @@ function parseHwp5Document(buffer, options) {
|
|
|
4892
4898
|
detectHwp5Headings(flatBlocks, docInfo);
|
|
4893
4899
|
}
|
|
4894
4900
|
const outline = flatBlocks.filter((b) => b.type === "heading" && b.level && b.text).map((b) => ({ level: b.level, text: b.text, pageNumber: b.pageNumber }));
|
|
4895
|
-
let markdown =
|
|
4901
|
+
let markdown = _chunk6XVQSILNcjs.blocksToMarkdown.call(void 0, flatBlocks);
|
|
4896
4902
|
if (_optionalChain([options, 'optionalAccess', _100 => _100.inlineImages]) && images.length > 0) {
|
|
4897
4903
|
try {
|
|
4898
|
-
markdown =
|
|
4904
|
+
markdown = _chunk6XVQSILNcjs.inlineImagesIntoMarkdown.call(void 0, markdown, images, { compress: true });
|
|
4899
4905
|
} catch (inlineErr) {
|
|
4900
4906
|
warnings.push({ message: `\uC774\uBBF8\uC9C0 \uC778\uB77C\uC778 \uC2E4\uD328 \u2014 \uC6D0\uBCF8 \uD30C\uC77C \uCC38\uC870\uB85C \uD3F4\uBC31: ${inlineErr instanceof Error ? inlineErr.message : "\uC54C \uC218 \uC5C6\uB294 \uC624\uB958"}`, code: "SKIPPED_IMAGE" });
|
|
4901
4907
|
}
|
|
@@ -4959,9 +4965,9 @@ function detectHwp5Headings(blocks, docInfo) {
|
|
|
4959
4965
|
let level = 0;
|
|
4960
4966
|
if (_optionalChain([block, 'access', _105 => _105.style, 'optionalAccess', _106 => _106.fontSize]) && baseFontSize > 0) {
|
|
4961
4967
|
const ratio = block.style.fontSize / baseFontSize;
|
|
4962
|
-
if (ratio >=
|
|
4963
|
-
else if (ratio >=
|
|
4964
|
-
else if (ratio >=
|
|
4968
|
+
if (ratio >= _chunk5FS4IZWYcjs.HEADING_RATIO_H1) level = 1;
|
|
4969
|
+
else if (ratio >= _chunk5FS4IZWYcjs.HEADING_RATIO_H2) level = 2;
|
|
4970
|
+
else if (ratio >= _chunk5FS4IZWYcjs.HEADING_RATIO_H3) level = 3;
|
|
4965
4971
|
}
|
|
4966
4972
|
if (/^제\d+[장절편]\s/.test(text) && text.length <= 50) {
|
|
4967
4973
|
if (level === 0) level = 2;
|
|
@@ -5046,7 +5052,7 @@ function findSectionsLenient(lcfb, compressed) {
|
|
|
5046
5052
|
if (!raw) break;
|
|
5047
5053
|
const content = compressed ? decompressStream(raw) : raw;
|
|
5048
5054
|
totalDecompressed += content.length;
|
|
5049
|
-
if (totalDecompressed > MAX_TOTAL_DECOMPRESS) throw new (0,
|
|
5055
|
+
if (totalDecompressed > MAX_TOTAL_DECOMPRESS) throw new (0, _chunk5FS4IZWYcjs.KordocError)("\uCD1D \uC555\uCD95 \uD574\uC81C \uD06C\uAE30 \uCD08\uACFC (decompression bomb \uC758\uC2EC)");
|
|
5050
5056
|
sections.push({ idx: i, content });
|
|
5051
5057
|
}
|
|
5052
5058
|
if (sections.length === 0) {
|
|
@@ -5058,7 +5064,7 @@ function findSectionsLenient(lcfb, compressed) {
|
|
|
5058
5064
|
if (raw) {
|
|
5059
5065
|
const content = compressed ? decompressStream(raw) : raw;
|
|
5060
5066
|
totalDecompressed += content.length;
|
|
5061
|
-
if (totalDecompressed > MAX_TOTAL_DECOMPRESS) throw new (0,
|
|
5067
|
+
if (totalDecompressed > MAX_TOTAL_DECOMPRESS) throw new (0, _chunk5FS4IZWYcjs.KordocError)("\uCD1D \uC555\uCD95 \uD574\uC81C \uD06C\uAE30 \uCD08\uACFC (decompression bomb \uC758\uC2EC)");
|
|
5062
5068
|
sections.push({ idx, content });
|
|
5063
5069
|
}
|
|
5064
5070
|
}
|
|
@@ -5075,7 +5081,7 @@ function findViewTextSectionsLenient(lcfb, compressed) {
|
|
|
5075
5081
|
try {
|
|
5076
5082
|
const content = decryptViewText(raw, compressed);
|
|
5077
5083
|
totalDecompressed += content.length;
|
|
5078
|
-
if (totalDecompressed > MAX_TOTAL_DECOMPRESS) throw new (0,
|
|
5084
|
+
if (totalDecompressed > MAX_TOTAL_DECOMPRESS) throw new (0, _chunk5FS4IZWYcjs.KordocError)("\uCD1D \uC555\uCD95 \uD574\uC81C \uD06C\uAE30 \uCD08\uACFC (decompression bomb \uC758\uC2EC)");
|
|
5079
5085
|
sections.push({ idx: i, content });
|
|
5080
5086
|
} catch (e27) {
|
|
5081
5087
|
break;
|
|
@@ -5178,7 +5184,7 @@ function parseParagraph(records, start, end, ctx) {
|
|
|
5178
5184
|
const ctrl = ctrls[r.ctrlIdx];
|
|
5179
5185
|
if (!_optionalChain([ctrl, 'optionalAccess', _113 => _113.href]) || r.end <= r.start) continue;
|
|
5180
5186
|
if (applied.some(([s, e]) => r.start < e && r.end > s)) continue;
|
|
5181
|
-
const href =
|
|
5187
|
+
const href = _chunk5FS4IZWYcjs.sanitizeHref.call(void 0, ctrl.href);
|
|
5182
5188
|
if (!href) continue;
|
|
5183
5189
|
const anchor = text.slice(r.start, r.end);
|
|
5184
5190
|
if (!anchor.trim()) continue;
|
|
@@ -5414,8 +5420,8 @@ function parseTableControl(ctrl, records, ctx) {
|
|
|
5414
5420
|
let tableIdx = -1;
|
|
5415
5421
|
for (let i2 = childStart; i2 < childEnd; i2++) {
|
|
5416
5422
|
if (records[i2].tagId === TAG_TABLE && records[i2].data.length >= 8) {
|
|
5417
|
-
rows = Math.min(records[i2].data.readUInt16LE(4),
|
|
5418
|
-
cols = Math.min(records[i2].data.readUInt16LE(6),
|
|
5423
|
+
rows = Math.min(records[i2].data.readUInt16LE(4), _chunk6XVQSILNcjs.MAX_ROWS);
|
|
5424
|
+
cols = Math.min(records[i2].data.readUInt16LE(6), _chunk6XVQSILNcjs.MAX_COLS);
|
|
5419
5425
|
tableIdx = i2;
|
|
5420
5426
|
break;
|
|
5421
5427
|
}
|
|
@@ -5464,7 +5470,7 @@ function parseTableControl(ctrl, records, ctx) {
|
|
|
5464
5470
|
return table3;
|
|
5465
5471
|
}
|
|
5466
5472
|
const cellRows = arrangeCells(rows, cols, cells);
|
|
5467
|
-
const table2 =
|
|
5473
|
+
const table2 = _chunk6XVQSILNcjs.buildTable.call(void 0, cellRows, { keepAnchoredEmptyCols: ctx.doc.keepTrailingEmptyCols });
|
|
5468
5474
|
if (caption && table2.rows > 0) table2.caption = caption;
|
|
5469
5475
|
return table2.rows > 0 ? table2 : null;
|
|
5470
5476
|
}
|
|
@@ -5481,8 +5487,8 @@ function parseCell(records, lhIdx, end, ctx) {
|
|
|
5481
5487
|
rowAddr = rec.data.readUInt16LE(10);
|
|
5482
5488
|
const cs = rec.data.readUInt16LE(12);
|
|
5483
5489
|
const rs = rec.data.readUInt16LE(14);
|
|
5484
|
-
if (cs > 0) colSpan = Math.min(cs,
|
|
5485
|
-
if (rs > 0) rowSpan = Math.min(rs,
|
|
5490
|
+
if (cs > 0) colSpan = Math.min(cs, _chunk6XVQSILNcjs.MAX_COLS);
|
|
5491
|
+
if (rs > 0) rowSpan = Math.min(rs, _chunk6XVQSILNcjs.MAX_ROWS);
|
|
5486
5492
|
}
|
|
5487
5493
|
const blocks = ctx.depth < MAX_NEST_DEPTH ? parseParagraphList(records, lhIdx + 1, end, { ...ctx, depth: ctx.depth + 1 }) : [];
|
|
5488
5494
|
const parts = [];
|
|
@@ -5492,7 +5498,7 @@ function parseCell(records, lhIdx, end, ctx) {
|
|
|
5492
5498
|
parts.push(``);
|
|
5493
5499
|
hasStructure = true;
|
|
5494
5500
|
} else if (b.type === "table" && b.table) {
|
|
5495
|
-
const flat =
|
|
5501
|
+
const flat = _chunk6XVQSILNcjs.convertTableToText.call(void 0, b.table.cells);
|
|
5496
5502
|
if (flat) parts.push(flat);
|
|
5497
5503
|
hasStructure = true;
|
|
5498
5504
|
} else if (b.text) {
|
|
@@ -17987,7 +17993,7 @@ function getTextContent(el) {
|
|
|
17987
17993
|
return _nullishCoalesce(_optionalChain([el, 'access', _129 => _129.textContent, 'optionalAccess', _130 => _130.trim, 'call', _131 => _131()]), () => ( ""));
|
|
17988
17994
|
}
|
|
17989
17995
|
function parseXml(text) {
|
|
17990
|
-
return new (0, _xmldom.DOMParser)().parseFromString(
|
|
17996
|
+
return new (0, _xmldom.DOMParser)().parseFromString(_chunk5FS4IZWYcjs.stripDtd.call(void 0, text), "text/xml");
|
|
17991
17997
|
}
|
|
17992
17998
|
function collectRichText(root) {
|
|
17993
17999
|
let out = "";
|
|
@@ -18222,7 +18228,7 @@ function sheetToBlocks(sheetName, grid, merges, maxRow, maxCol, sheetIndex, keep
|
|
|
18222
18228
|
cellRows.push(row);
|
|
18223
18229
|
}
|
|
18224
18230
|
if (cellRows.length > 0) {
|
|
18225
|
-
const table2 =
|
|
18231
|
+
const table2 = _chunk6XVQSILNcjs.buildTable.call(void 0, cellRows, { keepAnchoredEmptyCols });
|
|
18226
18232
|
if (table2.rows > 0) {
|
|
18227
18233
|
blocks.push({ type: "table", table: table2, pageNumber: sheetIndex + 1 });
|
|
18228
18234
|
}
|
|
@@ -18230,12 +18236,12 @@ function sheetToBlocks(sheetName, grid, merges, maxRow, maxCol, sheetIndex, keep
|
|
|
18230
18236
|
return blocks;
|
|
18231
18237
|
}
|
|
18232
18238
|
async function parseXlsxDocument(buffer, options) {
|
|
18233
|
-
|
|
18239
|
+
_chunk5FS4IZWYcjs.precheckZipSize.call(void 0, buffer, MAX_DECOMPRESS_SIZE4);
|
|
18234
18240
|
const zip = await _jszip2.default.loadAsync(buffer);
|
|
18235
18241
|
const warnings = [];
|
|
18236
18242
|
const workbookFile = zip.file("xl/workbook.xml");
|
|
18237
18243
|
if (!workbookFile) {
|
|
18238
|
-
throw new (0,
|
|
18244
|
+
throw new (0, _chunk5FS4IZWYcjs.KordocError)("\uC720\uD6A8\uD558\uC9C0 \uC54A\uC740 XLSX \uD30C\uC77C: xl/workbook.xml\uC774 \uC5C6\uC2B5\uB2C8\uB2E4");
|
|
18239
18245
|
}
|
|
18240
18246
|
let sharedStrings = [];
|
|
18241
18247
|
const ssFile = zip.file("xl/sharedStrings.xml");
|
|
@@ -18244,7 +18250,7 @@ async function parseXlsxDocument(buffer, options) {
|
|
|
18244
18250
|
}
|
|
18245
18251
|
const { sheets, date1904 } = parseWorkbook(await workbookFile.async("text"));
|
|
18246
18252
|
if (sheets.length === 0) {
|
|
18247
|
-
throw new (0,
|
|
18253
|
+
throw new (0, _chunk5FS4IZWYcjs.KordocError)("XLSX \uD30C\uC77C\uC5D0 \uC2DC\uD2B8\uAC00 \uC5C6\uC2B5\uB2C8\uB2E4");
|
|
18248
18254
|
}
|
|
18249
18255
|
let dateXfs = /* @__PURE__ */ new Map();
|
|
18250
18256
|
const stylesFile = zip.file("xl/styles.xml");
|
|
@@ -18324,7 +18330,7 @@ async function parseXlsxDocument(buffer, options) {
|
|
|
18324
18330
|
} catch (e29) {
|
|
18325
18331
|
}
|
|
18326
18332
|
}
|
|
18327
|
-
const markdown =
|
|
18333
|
+
const markdown = _chunk6XVQSILNcjs.blocksToMarkdown.call(void 0, blocks);
|
|
18328
18334
|
return { markdown, blocks, metadata, warnings: warnings.length > 0 ? warnings : void 0 };
|
|
18329
18335
|
}
|
|
18330
18336
|
|
|
@@ -18775,11 +18781,11 @@ function processGlobals(records) {
|
|
|
18775
18781
|
const xfFmtIds = [];
|
|
18776
18782
|
const firstBof = records[0];
|
|
18777
18783
|
if (!firstBof || firstBof.opcode !== OP_BOF) {
|
|
18778
|
-
throw new (0,
|
|
18784
|
+
throw new (0, _chunk5FS4IZWYcjs.KordocError)("XLS: \uCCAB \uB808\uCF54\uB4DC\uAC00 BOF\uAC00 \uC544\uB2D8");
|
|
18779
18785
|
}
|
|
18780
18786
|
const bof = decodeBof(firstBof.data);
|
|
18781
18787
|
if (!bof || bof.dt !== DT_GLOBALS) {
|
|
18782
|
-
throw new (0,
|
|
18788
|
+
throw new (0, _chunk5FS4IZWYcjs.KordocError)("XLS: Globals \uC11C\uBE0C\uC2A4\uD2B8\uB9BC BOF \uB204\uB77D");
|
|
18783
18789
|
}
|
|
18784
18790
|
let i = 1;
|
|
18785
18791
|
while (i < records.length) {
|
|
@@ -18914,7 +18920,7 @@ function sheetToBlocks2(sheetName, sheet, sheetIndex, keepAnchoredEmptyCols) {
|
|
|
18914
18920
|
cellRows.push(row);
|
|
18915
18921
|
}
|
|
18916
18922
|
if (cellRows.length > 0) {
|
|
18917
|
-
const table2 =
|
|
18923
|
+
const table2 = _chunk6XVQSILNcjs.buildTable.call(void 0, cellRows, { keepAnchoredEmptyCols });
|
|
18918
18924
|
if (table2.rows > 0) {
|
|
18919
18925
|
blocks.push({ type: "table", table: table2, pageNumber: sheetIndex + 1 });
|
|
18920
18926
|
}
|
|
@@ -18927,21 +18933,21 @@ async function parseXlsDocument(buffer, options) {
|
|
|
18927
18933
|
try {
|
|
18928
18934
|
cfb = parseLenientCfb(buf);
|
|
18929
18935
|
} catch (e) {
|
|
18930
|
-
throw new (0,
|
|
18936
|
+
throw new (0, _chunk5FS4IZWYcjs.KordocError)(
|
|
18931
18937
|
`XLS: OLE2 \uC2DC\uADF8\uB2C8\uCC98 \uAC80\uC99D \uC2E4\uD328 \u2014 ${e instanceof Error ? e.message : "\uC54C \uC218 \uC5C6\uB294 \uC624\uB958"}`
|
|
18932
18938
|
);
|
|
18933
18939
|
}
|
|
18934
18940
|
const wb = _nullishCoalesce(cfb.findStream("/Workbook"), () => ( cfb.findStream("/Book")));
|
|
18935
18941
|
if (!wb) {
|
|
18936
|
-
throw new (0,
|
|
18942
|
+
throw new (0, _chunk5FS4IZWYcjs.KordocError)("XLS: Workbook \uC2A4\uD2B8\uB9BC\uC774 \uC5C6\uC74C (BIFF5 \uB610\uB294 \uBE44\uD45C\uC900 \uD30C\uC77C)");
|
|
18937
18943
|
}
|
|
18938
18944
|
const records = readRecords2(wb);
|
|
18939
18945
|
if (records.length === 0) {
|
|
18940
|
-
throw new (0,
|
|
18946
|
+
throw new (0, _chunk5FS4IZWYcjs.KordocError)("XLS: \uC2DC\uADF8\uB2C8\uCC98 \uB808\uCF54\uB4DC\uAC00 \uC5C6\uC74C (Workbook \uC2A4\uD2B8\uB9BC \uC190\uC0C1)");
|
|
18941
18947
|
}
|
|
18942
18948
|
const firstBof = decodeBof(records[0].data);
|
|
18943
18949
|
if (firstBof && firstBof.vers !== 1536) {
|
|
18944
|
-
throw new (0,
|
|
18950
|
+
throw new (0, _chunk5FS4IZWYcjs.KordocError)(
|
|
18945
18951
|
`XLS: BIFF8(0x0600)\uB9CC \uC9C0\uC6D0 \u2014 \uBCF8 \uD30C\uC77C\uC740 0x${firstBof.vers.toString(16)}`
|
|
18946
18952
|
);
|
|
18947
18953
|
}
|
|
@@ -19009,7 +19015,7 @@ async function parseXlsDocument(buffer, options) {
|
|
|
19009
19015
|
pageCount: totalSheets
|
|
19010
19016
|
};
|
|
19011
19017
|
return {
|
|
19012
|
-
markdown:
|
|
19018
|
+
markdown: _chunk6XVQSILNcjs.blocksToMarkdown.call(void 0, allBlocks),
|
|
19013
19019
|
blocks: allBlocks,
|
|
19014
19020
|
metadata,
|
|
19015
19021
|
warnings: warnings.length > 0 ? warnings : void 0
|
|
@@ -19465,7 +19471,7 @@ function getAttr(el, localName2) {
|
|
|
19465
19471
|
return null;
|
|
19466
19472
|
}
|
|
19467
19473
|
function parseXml2(text) {
|
|
19468
|
-
return new (0, _xmldom.DOMParser)().parseFromString(
|
|
19474
|
+
return new (0, _xmldom.DOMParser)().parseFromString(_chunk5FS4IZWYcjs.stripDtd.call(void 0, text), "text/xml");
|
|
19469
19475
|
}
|
|
19470
19476
|
function parseStyles(xml) {
|
|
19471
19477
|
const doc = parseXml2(xml);
|
|
@@ -19623,7 +19629,7 @@ function fieldUrlFromInstr(instr) {
|
|
|
19623
19629
|
function makeLink(text, rawHref) {
|
|
19624
19630
|
if (!text) return "";
|
|
19625
19631
|
if (!rawHref) return text;
|
|
19626
|
-
const href =
|
|
19632
|
+
const href = _chunk5FS4IZWYcjs.sanitizeHref.call(void 0, rawHref);
|
|
19627
19633
|
return href ? `[${text}](${href})` : text;
|
|
19628
19634
|
}
|
|
19629
19635
|
function collectInline(p, footnotes, rels) {
|
|
@@ -19817,7 +19823,7 @@ ${cell2.text}` : cell2.text;
|
|
|
19817
19823
|
return { text: cell2.text, colSpan: cell2.colSpan, rowSpan, colAddr: cell2.col, rowAddr: r };
|
|
19818
19824
|
})
|
|
19819
19825
|
);
|
|
19820
|
-
const table2 =
|
|
19826
|
+
const table2 = _chunk6XVQSILNcjs.buildTable.call(void 0, cellRows, { keepAnchoredEmptyCols: keepEmptyCols });
|
|
19821
19827
|
if (table2.rows === 0 || table2.cols === 0) return null;
|
|
19822
19828
|
return { type: "table", table: table2 };
|
|
19823
19829
|
}
|
|
@@ -19919,12 +19925,12 @@ function emitParagraphImages(p, imageMap, linked, out) {
|
|
|
19919
19925
|
}
|
|
19920
19926
|
}
|
|
19921
19927
|
async function parseDocxDocument(buffer, options) {
|
|
19922
|
-
|
|
19928
|
+
_chunk5FS4IZWYcjs.precheckZipSize.call(void 0, buffer, MAX_DECOMPRESS_SIZE5);
|
|
19923
19929
|
const zip = await _jszip2.default.loadAsync(buffer);
|
|
19924
19930
|
const warnings = [];
|
|
19925
19931
|
const docFile = zip.file("word/document.xml");
|
|
19926
19932
|
if (!docFile) {
|
|
19927
|
-
throw new (0,
|
|
19933
|
+
throw new (0, _chunk5FS4IZWYcjs.KordocError)("\uC720\uD6A8\uD558\uC9C0 \uC54A\uC740 DOCX \uD30C\uC77C: word/document.xml\uC774 \uC5C6\uC2B5\uB2C8\uB2E4");
|
|
19928
19934
|
}
|
|
19929
19935
|
let rels = /* @__PURE__ */ new Map();
|
|
19930
19936
|
const relsFile = zip.file("word/_rels/document.xml.rels");
|
|
@@ -19971,7 +19977,7 @@ async function parseDocxDocument(buffer, options) {
|
|
|
19971
19977
|
const doc = parseXml2(docXml);
|
|
19972
19978
|
const body = findElements(doc, "body");
|
|
19973
19979
|
if (body.length === 0) {
|
|
19974
|
-
throw new (0,
|
|
19980
|
+
throw new (0, _chunk5FS4IZWYcjs.KordocError)("DOCX \uBCF8\uBB38(w:body)\uC744 \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4");
|
|
19975
19981
|
}
|
|
19976
19982
|
const { imageMap, images } = await buildImageMap(zip, rels, doc, warnings);
|
|
19977
19983
|
const linkedImages = /* @__PURE__ */ new Set();
|
|
@@ -20022,7 +20028,7 @@ async function parseDocxDocument(buffer, options) {
|
|
|
20022
20028
|
}
|
|
20023
20029
|
}
|
|
20024
20030
|
const outline = blocks.filter((b) => b.type === "heading").map((b) => ({ level: _nullishCoalesce(b.level, () => ( 2)), text: _nullishCoalesce(b.text, () => ( "")) }));
|
|
20025
|
-
const markdown =
|
|
20031
|
+
const markdown = _chunk6XVQSILNcjs.blocksToMarkdown.call(void 0, blocks);
|
|
20026
20032
|
return {
|
|
20027
20033
|
markdown,
|
|
20028
20034
|
blocks,
|
|
@@ -20045,7 +20051,7 @@ function parseHwpmlDocument(buffer, options) {
|
|
|
20045
20051
|
}
|
|
20046
20052
|
const text = new TextDecoder("utf-8").decode(buffer).replace(/^\uFEFF/, "");
|
|
20047
20053
|
const normalized = text.replace(/ /g, " ");
|
|
20048
|
-
const xml =
|
|
20054
|
+
const xml = _chunk5FS4IZWYcjs.stripDtd.call(void 0, normalized);
|
|
20049
20055
|
const warnings = [];
|
|
20050
20056
|
const parser = new (0, _xmldom.DOMParser)({
|
|
20051
20057
|
onError: (_level, msg2) => {
|
|
@@ -20085,7 +20091,7 @@ function parseHwpmlDocument(buffer, options) {
|
|
|
20085
20091
|
parseSection2(el, blocks, paraShapeMap, sectionIdx, warnings, _nullishCoalesce(_optionalChain([options, 'optionalAccess', _178 => _178.keepTrailingEmptyCols]), () => ( false)));
|
|
20086
20092
|
}
|
|
20087
20093
|
const outline = blocks.filter((b) => b.type === "heading" && b.text).map((b) => ({ level: _nullishCoalesce(b.level, () => ( 1)), text: b.text, pageNumber: b.pageNumber }));
|
|
20088
|
-
const markdown =
|
|
20094
|
+
const markdown = _chunk6XVQSILNcjs.blocksToMarkdown.call(void 0, blocks);
|
|
20089
20095
|
return {
|
|
20090
20096
|
markdown,
|
|
20091
20097
|
blocks,
|
|
@@ -20230,7 +20236,7 @@ function parseTable2(el, blocks, paraShapeMap, sectionNum, warnings, keep) {
|
|
|
20230
20236
|
const r = Math.min(Math.max(_nullishCoalesce(cell2.rowAddr, () => ( 0)), 0), rowCount - 1);
|
|
20231
20237
|
cellRows[r].push(cell2);
|
|
20232
20238
|
}
|
|
20233
|
-
const table2 =
|
|
20239
|
+
const table2 = _chunk6XVQSILNcjs.buildTable.call(void 0, cellRows, { keepAnchoredEmptyCols: keep });
|
|
20234
20240
|
const caption = extractShapeCaption(el);
|
|
20235
20241
|
if (caption.text && caption.before) {
|
|
20236
20242
|
blocks.push({ type: "paragraph", text: caption.text, pageNumber: sectionNum });
|
|
@@ -21612,19 +21618,19 @@ function parseCentralDirectory(buf) {
|
|
|
21612
21618
|
}
|
|
21613
21619
|
}
|
|
21614
21620
|
}
|
|
21615
|
-
if (eocdOffset < 0) throw new (0,
|
|
21621
|
+
if (eocdOffset < 0) throw new (0, _chunk5FS4IZWYcjs.KordocError)("ZIP EOCD\uB97C \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4");
|
|
21616
21622
|
const totalEntries = view.getUint16(eocdOffset + 10, true);
|
|
21617
21623
|
const cdSize = view.getUint32(eocdOffset + 12, true);
|
|
21618
21624
|
const cdOffset = view.getUint32(eocdOffset + 16, true);
|
|
21619
|
-
if (cdOffset === 4294967295 || totalEntries === 65535) throw new (0,
|
|
21625
|
+
if (cdOffset === 4294967295 || totalEntries === 65535) throw new (0, _chunk5FS4IZWYcjs.KordocError)("ZIP64\uB294 \uC9C0\uC6D0\uD558\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4");
|
|
21620
21626
|
if (eocdOffset >= 20 && view.getUint32(eocdOffset - 20, true) === ZIP64_EOCD_LOC_SIG) {
|
|
21621
|
-
throw new (0,
|
|
21627
|
+
throw new (0, _chunk5FS4IZWYcjs.KordocError)("ZIP64\uB294 \uC9C0\uC6D0\uD558\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4");
|
|
21622
21628
|
}
|
|
21623
21629
|
const decoder = new TextDecoder("utf-8");
|
|
21624
21630
|
const entries = [];
|
|
21625
21631
|
let pos = cdOffset;
|
|
21626
21632
|
for (let i = 0; i < totalEntries; i++) {
|
|
21627
|
-
if (view.getUint32(pos, true) !== CD_SIG) throw new (0,
|
|
21633
|
+
if (view.getUint32(pos, true) !== CD_SIG) throw new (0, _chunk5FS4IZWYcjs.KordocError)("ZIP Central Directory \uC190\uC0C1");
|
|
21628
21634
|
const flags = view.getUint16(pos + 8, true);
|
|
21629
21635
|
const method = view.getUint16(pos + 10, true);
|
|
21630
21636
|
const crc = view.getUint32(pos + 16, true);
|
|
@@ -21635,7 +21641,7 @@ function parseCentralDirectory(buf) {
|
|
|
21635
21641
|
const commentLen = view.getUint16(pos + 32, true);
|
|
21636
21642
|
const localOffset = view.getUint32(pos + 42, true);
|
|
21637
21643
|
if (compSize === 4294967295 || uncompSize === 4294967295 || localOffset === 4294967295) {
|
|
21638
|
-
throw new (0,
|
|
21644
|
+
throw new (0, _chunk5FS4IZWYcjs.KordocError)("ZIP64\uB294 \uC9C0\uC6D0\uD558\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4");
|
|
21639
21645
|
}
|
|
21640
21646
|
const name = decoder.decode(buf.subarray(pos + 46, pos + 46 + nameLen));
|
|
21641
21647
|
const cdEnd = pos + 46 + nameLen + extraLen + commentLen;
|
|
@@ -21664,11 +21670,11 @@ function patchZipEntries(original, replacements, additions) {
|
|
|
21664
21670
|
const { entries, cdOffset, eocdOffset } = parseCentralDirectory(original);
|
|
21665
21671
|
const view = new DataView(original.buffer, original.byteOffset, original.byteLength);
|
|
21666
21672
|
for (const name of replacements.keys()) {
|
|
21667
|
-
if (!entries.some((e) => e.name === name)) throw new (0,
|
|
21673
|
+
if (!entries.some((e) => e.name === name)) throw new (0, _chunk5FS4IZWYcjs.KordocError)(`ZIP\uC5D0 \uC5C6\uB294 \uC5D4\uD2B8\uB9AC: ${name}`);
|
|
21668
21674
|
}
|
|
21669
21675
|
if (additions) {
|
|
21670
21676
|
for (const name of additions.keys()) {
|
|
21671
|
-
if (entries.some((e) => e.name === name)) throw new (0,
|
|
21677
|
+
if (entries.some((e) => e.name === name)) throw new (0, _chunk5FS4IZWYcjs.KordocError)(`ZIP\uC5D0 \uC774\uBBF8 \uC788\uB294 \uC5D4\uD2B8\uB9AC: ${name}`);
|
|
21672
21678
|
}
|
|
21673
21679
|
}
|
|
21674
21680
|
const byLocal = [...entries].sort((a, b) => a.localOffset - b.localOffset);
|
|
@@ -21687,7 +21693,7 @@ function patchZipEntries(original, replacements, additions) {
|
|
|
21687
21693
|
offset += seg.length;
|
|
21688
21694
|
continue;
|
|
21689
21695
|
}
|
|
21690
|
-
if (view.getUint32(e.localOffset, true) !== LOCAL_SIG) throw new (0,
|
|
21696
|
+
if (view.getUint32(e.localOffset, true) !== LOCAL_SIG) throw new (0, _chunk5FS4IZWYcjs.KordocError)("ZIP \uB85C\uCEEC \uD5E4\uB354 \uC2DC\uADF8\uB2C8\uCC98 \uBD88\uC77C\uCE58");
|
|
21691
21697
|
const nameLen = view.getUint16(e.localOffset + 26, true);
|
|
21692
21698
|
const extraLen = view.getUint16(e.localOffset + 28, true);
|
|
21693
21699
|
const headerLen = 30 + nameLen + extraLen;
|
|
@@ -21695,7 +21701,7 @@ function patchZipEntries(original, replacements, additions) {
|
|
|
21695
21701
|
const hview = new DataView(header.buffer, header.byteOffset, header.byteLength);
|
|
21696
21702
|
const method = e.method;
|
|
21697
21703
|
if (method !== 0 && method !== 8) {
|
|
21698
|
-
throw new (0,
|
|
21704
|
+
throw new (0, _chunk5FS4IZWYcjs.KordocError)(`\uC9C0\uC6D0\uD558\uC9C0 \uC54A\uB294 ZIP \uC555\uCD95 \uBC29\uC2DD(method=${method}): ${e.name} \u2014 STORE(0)/DEFLATE(8)\uB9CC \uAD50\uCCB4 \uAC00\uB2A5`);
|
|
21699
21705
|
}
|
|
21700
21706
|
const compData = method === 0 ? newData : new Uint8Array(_zlib.deflateRawSync.call(void 0, newData));
|
|
21701
21707
|
const crc = crc32(newData);
|
|
@@ -21796,7 +21802,7 @@ async function fillHwpx(hwpxBuffer, values, blockedLabels) {
|
|
|
21796
21802
|
const zip = await _jszip2.default.loadAsync(hwpxBuffer);
|
|
21797
21803
|
const sectionPaths = Object.keys(zip.files).filter((name) => /[Ss]ection\d+\.xml$/i.test(name)).sort();
|
|
21798
21804
|
if (sectionPaths.length === 0) {
|
|
21799
|
-
throw new (0,
|
|
21805
|
+
throw new (0, _chunk5FS4IZWYcjs.KordocError)("HWPX\uC5D0\uC11C \uC139\uC158 \uD30C\uC77C\uC744 \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4");
|
|
21800
21806
|
}
|
|
21801
21807
|
const warnings = [];
|
|
21802
21808
|
const normalizedValues = normalizeValues(values, warnings);
|
|
@@ -22533,7 +22539,7 @@ function assertSequentialIds(rows, label, startId) {
|
|
|
22533
22539
|
const m = rows[i].match(/\bid="(\d+)"/);
|
|
22534
22540
|
const got = m ? Number(m[1]) : NaN;
|
|
22535
22541
|
if (got !== startId + i) {
|
|
22536
|
-
throw new (0,
|
|
22542
|
+
throw new (0, _chunk5FS4IZWYcjs.KordocError)(
|
|
22537
22543
|
`\uB0B4\uBD80 \uC624\uB958: ${label} id \uD30C\uD2F0\uC158 \uB4DC\uB9AC\uD504\uD2B8 \u2014 ${startId + i} \uC704\uCE58\uC5D0 id=${m ? m[1] : "?"} \uBC29\uCD9C. id \uC0C1\uC218(gen-ids)\uC640 \uC2E4\uC81C \uBC29\uCD9C \uC218\uAC00 \uC5B4\uAE0B\uB0AC\uB2E4 (GJ_CHAR_COUNT\uB958 \uCE74\uC6B4\uD2B8\xB7base \uC0B0\uC220 \uD655\uC778)`
|
|
22538
22544
|
);
|
|
22539
22545
|
}
|
|
@@ -22617,7 +22623,7 @@ function buildCharProperties(theme, gongmun, ratioVariants = [], extraCharPrXmls
|
|
|
22617
22623
|
}
|
|
22618
22624
|
const expectedBase = charVariantBase(richAssets, !!gongmun);
|
|
22619
22625
|
if (rows.length !== expectedBase) {
|
|
22620
|
-
throw new (0,
|
|
22626
|
+
throw new (0, _chunk5FS4IZWYcjs.KordocError)(
|
|
22621
22627
|
`\uB0B4\uBD80 \uC624\uB958: charPr \uAE30\uBCF8 \uBE14\uB85D \uBC29\uCD9C \uC218(${rows.length}) \u2260 charVariantBase(${expectedBase}) \u2014 gen-header \uBC29\uCD9C \uD589\uACFC gen-ids \uCE74\uC6B4\uD2B8 \uC0C1\uC218\uAC00 \uC5B4\uAE0B\uB0AC\uB2E4`
|
|
22622
22628
|
);
|
|
22623
22629
|
}
|
|
@@ -22665,11 +22671,12 @@ ${base2.join("\n")}
|
|
|
22665
22671
|
paraPr(6, { align: "LEFT", lineSpacing: ls, indent: 600, keepWord: true }),
|
|
22666
22672
|
paraPr(7, { align: "LEFT", lineSpacing: ls, indent: 600, keepWord: true })
|
|
22667
22673
|
];
|
|
22674
|
+
const listAlign = gongmun.numbering === "gaejosik" || gongmun.numbering === "report" ? "LEFT" : "JUSTIFY";
|
|
22668
22675
|
for (let d = 0; d < GONGMUN_LIST_LEVELS; d++) {
|
|
22669
22676
|
const { left, indent } = levelIndent(d, gongmun.bodyHeight, gongmun.numbering, gongmun.sizes, gongmun.bullet2, usesAsteriskThird(gongmun.preset));
|
|
22670
22677
|
const sectionGap = gongmun.numbering === "gaejosik" || gongmun.numbering === "report" ? gaejosikSpaceBefore(d, gongmun.bodyHeight) : 0;
|
|
22671
22678
|
const keepNext = (gongmun.numbering === "gaejosik" || gongmun.numbering === "report") && d === 0;
|
|
22672
|
-
base.push(paraPr(GONGMUN_LIST_BASE + d, { align:
|
|
22679
|
+
base.push(paraPr(GONGMUN_LIST_BASE + d, { align: listAlign, lineSpacing: ls, left, indent, spaceBefore: sectionGap, keepWord: true, keepWithNext: keepNext }));
|
|
22673
22680
|
}
|
|
22674
22681
|
base.push(paraPr(GONGMUN_CENTER, { align: "CENTER", lineSpacing: ls, keepWord: true }));
|
|
22675
22682
|
base.push(paraPr(GONGMUN_RIGHT, { align: "RIGHT", lineSpacing: ls, keepWord: true }));
|
|
@@ -22679,7 +22686,7 @@ ${base2.join("\n")}
|
|
|
22679
22686
|
const cham = gaejosikChamIndent(gongmun.bodyHeight, gongmun.sizes);
|
|
22680
22687
|
const toc = gaejosikTocItemIndent(gongmun.bodyHeight, gongmun.sizes);
|
|
22681
22688
|
base.push(
|
|
22682
|
-
paraPr(GJ_PARA_CHAM, { align: "
|
|
22689
|
+
paraPr(GJ_PARA_CHAM, { align: "LEFT", lineSpacing: ls, left: cham.left, indent: cham.indent, spaceBefore: gaejosikSpaceBefore(3, gongmun.bodyHeight), keepWord: true }),
|
|
22683
22690
|
paraPr(GJ_PARA_COVER, { align: "CENTER", lineSpacing: 130, keepWord: true }),
|
|
22684
22691
|
paraPr(GJ_PARA_TOC_ITEM, { align: "LEFT", lineSpacing: 160, left: toc.left, indent: toc.indent, spaceBefore: 1800, keepWord: true }),
|
|
22685
22692
|
// 장 헤더는 다음 문단과 같은 쪽에 — 쪽 하단 고아 헤더 방지 (실렌더 확인 이슈)
|
|
@@ -22691,7 +22698,7 @@ ${base2.join("\n")}
|
|
|
22691
22698
|
for (let d = 0; d < GONGMUN_LIST_LEVELS; d++) {
|
|
22692
22699
|
const { left } = levelIndent(d, gongmun.bodyHeight, gongmun.numbering, gongmun.sizes, gongmun.bullet2, usesAsteriskThird(gongmun.preset));
|
|
22693
22700
|
const sectionGap = gongmun.numbering === "gaejosik" || gongmun.numbering === "report" ? gaejosikSpaceBefore(d, gongmun.bodyHeight) : 0;
|
|
22694
|
-
base.push(paraPr(GONGMUN_LIST_PLAIN_BASE + d, { align:
|
|
22701
|
+
base.push(paraPr(GONGMUN_LIST_PLAIN_BASE + d, { align: listAlign, lineSpacing: ls, left, indent: 0, spaceBefore: sectionGap, keepWord: true }));
|
|
22695
22702
|
}
|
|
22696
22703
|
base.push(paraPr(GONGMUN_PARA_APPROVAL, { align: "CENTER", lineSpacing: 100, keepWord: true }));
|
|
22697
22704
|
for (let vi = 0; vi < listIndentVariants.length; vi++) {
|
|
@@ -22699,7 +22706,7 @@ ${base2.join("\n")}
|
|
|
22699
22706
|
const { left } = levelIndent(depth, gongmun.bodyHeight, gongmun.numbering, gongmun.sizes, gongmun.bullet2, usesAsteriskThird(gongmun.preset));
|
|
22700
22707
|
const sectionGap = gongmun.numbering === "gaejosik" || gongmun.numbering === "report" ? gaejosikSpaceBefore(depth, gongmun.bodyHeight) : 0;
|
|
22701
22708
|
const keepNext = (gongmun.numbering === "gaejosik" || gongmun.numbering === "report") && depth === 0;
|
|
22702
|
-
base.push(paraPr(GONGMUN_LIST_VARIANT_BASE + vi, { align:
|
|
22709
|
+
base.push(paraPr(GONGMUN_LIST_VARIANT_BASE + vi, { align: listAlign, lineSpacing: ls, left, indent: -widthHu, spaceBefore: sectionGap, keepWord: true, keepWithNext: keepNext }));
|
|
22703
22710
|
}
|
|
22704
22711
|
assertSequentialIds(base, "paraPr", 0);
|
|
22705
22712
|
return `<hh:paraProperties itemCnt="${base.length}">
|
|
@@ -23512,7 +23519,7 @@ function escapeGfm(text) {
|
|
|
23512
23519
|
}
|
|
23513
23520
|
var HWP_SHAPE_ALT_TEXT_RE = /^(?:모서리가 둥근 |둥근 )?(?:사각형|직사각형|정사각형|원|타원|삼각형|이등변 삼각형|직각 삼각형|선|직선|곡선|화살표|굵은 화살표|이중 화살표|오각형|육각형|팔각형|별|[4-8]점별|십자|십자형|구름|구름형|마름모|도넛|평행사변형|사다리꼴|부채꼴|호|반원|물결|번개|하트|빗금|블록 화살표|수식|표|그림|개체|그리기\s?개체|묶음\s?개체|글상자|수식\s?개체|OLE\s?개체)\s?입니다\.?$/gm;
|
|
23514
23521
|
function sanitizeText(text) {
|
|
23515
|
-
let result =
|
|
23522
|
+
let result = _chunk6XVQSILNcjs.mapPuaText.call(void 0, text).replace(/[\u{F0000}-\u{FFFFD}]/gu, "").replace(HWP_SHAPE_ALT_TEXT_RE, "").replace(/ +/g, " ").trim();
|
|
23516
23523
|
if (result.length <= 30 && result.includes(" ")) {
|
|
23517
23524
|
const tokens = result.split(" ");
|
|
23518
23525
|
const koreanSingleCharCount = tokens.filter((t) => t.length === 1 && /[가-ㄱ-ㆎ]/.test(t)).length;
|
|
@@ -23684,7 +23691,7 @@ function parseHtmlTable(raw) {
|
|
|
23684
23691
|
const cs = parseInt(_optionalChain([attrs, 'access', _285 => _285.match, 'call', _286 => _286(/colspan\s*=\s*["']?(\d+)/i), 'optionalAccess', _287 => _287[1]]) || "1", 10);
|
|
23685
23692
|
const rs = parseInt(_optionalChain([attrs, 'access', _288 => _288.match, 'call', _289 => _289(/rowspan\s*=\s*["']?(\d+)/i), 'optionalAccess', _290 => _290[1]]) || "1", 10);
|
|
23686
23693
|
cellStart = m.index + m[0].length;
|
|
23687
|
-
cellInfo = { colSpan: clampSpan(isNaN(cs) ? 1 : cs,
|
|
23694
|
+
cellInfo = { colSpan: clampSpan(isNaN(cs) ? 1 : cs, _chunk6XVQSILNcjs.MAX_COLS), rowSpan: clampSpan(isNaN(rs) ? 1 : rs, _chunk6XVQSILNcjs.MAX_ROWS) };
|
|
23688
23695
|
} else if (cellStart >= 0 && cellInfo && currentRow) {
|
|
23689
23696
|
currentRow.push({ inner: raw.slice(cellStart, m.index), colSpan: cellInfo.colSpan, rowSpan: cellInfo.rowSpan });
|
|
23690
23697
|
cellStart = -1;
|
|
@@ -24340,8 +24347,8 @@ function layoutHtmlRows(rows) {
|
|
|
24340
24347
|
let c = 0;
|
|
24341
24348
|
for (const cell2 of rows[r].cells) {
|
|
24342
24349
|
while (occupied.has(`${r},${c}`)) c++;
|
|
24343
|
-
const colSpan = clampSpan(cell2.colSpan,
|
|
24344
|
-
const rowSpan = clampSpan(cell2.rowSpan,
|
|
24350
|
+
const colSpan = clampSpan(cell2.colSpan, _chunk6XVQSILNcjs.MAX_COLS);
|
|
24351
|
+
const rowSpan = clampSpan(cell2.rowSpan, _chunk6XVQSILNcjs.MAX_ROWS);
|
|
24345
24352
|
placed.push({ r, c, colSpan, rowSpan, inner: cell2.inner, isHeader: rows[r].tag === "th" });
|
|
24346
24353
|
for (let dr = 0; dr < rowSpan; dr++) {
|
|
24347
24354
|
for (let dc = 0; dc < colSpan; dc++) occupied.add(`${r + dr},${c + dc}`);
|
|
@@ -25938,11 +25945,11 @@ function buildFloatPicXml(itemId, sizeHu, posXHu, posYHu, ids) {
|
|
|
25938
25945
|
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>`;
|
|
25939
25946
|
}
|
|
25940
25947
|
async function placeSealHwpx(hwpxBuffer, ops) {
|
|
25941
|
-
if (ops.length === 0) throw new (0,
|
|
25948
|
+
if (ops.length === 0) throw new (0, _chunk5FS4IZWYcjs.KordocError)("place_seal: \uBC30\uCE58\uD560 \uB3C4\uC7A5\uC774 \uC5C6\uC2B5\uB2C8\uB2E4");
|
|
25942
25949
|
const u8 = new Uint8Array(hwpxBuffer);
|
|
25943
25950
|
const zip = await _jszip2.default.loadAsync(hwpxBuffer);
|
|
25944
25951
|
const sectionPaths = Object.keys(zip.files).filter((name) => /[Ss]ection\d+\.xml$/i.test(name)).sort((a, b) => Number(_nullishCoalesce(_optionalChain([a, 'access', _392 => _392.match, 'call', _393 => _393(/(\d+)\.xml$/i), 'optionalAccess', _394 => _394[1]]), () => ( 0))) - Number(_nullishCoalesce(_optionalChain([b, 'access', _395 => _395.match, 'call', _396 => _396(/(\d+)\.xml$/i), 'optionalAccess', _397 => _397[1]]), () => ( 0))));
|
|
25945
|
-
if (sectionPaths.length === 0) throw new (0,
|
|
25952
|
+
if (sectionPaths.length === 0) throw new (0, _chunk5FS4IZWYcjs.KordocError)("HWPX\uC5D0\uC11C \uC139\uC158 \uD30C\uC77C\uC744 \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4");
|
|
25946
25953
|
const manifestPath = Object.keys(zip.files).find((name) => /\.hpf$/i.test(name));
|
|
25947
25954
|
const headerPath = Object.keys(zip.files).find((name) => /(^|\/)header\.xml$/i.test(name));
|
|
25948
25955
|
const styles = headerPath ? parseRenderStyles(await zip.file(headerPath).async("text")) : null;
|
|
@@ -25983,11 +25990,11 @@ async function placeSealHwpx(hwpxBuffer, ops) {
|
|
|
25983
25990
|
const manifestItems = [];
|
|
25984
25991
|
const placed = [];
|
|
25985
25992
|
for (const op of ops) {
|
|
25986
|
-
if (!op.anchor) throw new (0,
|
|
25987
|
-
if (!op.image || op.image.length === 0) throw new (0,
|
|
25993
|
+
if (!op.anchor) throw new (0, _chunk5FS4IZWYcjs.KordocError)("place_seal: anchor \uBB38\uAD6C\uAC00 \uD544\uC694\uD569\uB2C8\uB2E4");
|
|
25994
|
+
if (!op.image || op.image.length === 0) throw new (0, _chunk5FS4IZWYcjs.KordocError)("place_seal: \uB3C4\uC7A5 \uC774\uBBF8\uC9C0\uAC00 \uD544\uC694\uD569\uB2C8\uB2E4");
|
|
25988
25995
|
const ext = (_nullishCoalesce(op.ext, () => ( "png"))).toLowerCase();
|
|
25989
|
-
if (!MIME[ext]) throw new (0,
|
|
25990
|
-
if (!imageMagicMatches(op.image, ext)) throw new (0,
|
|
25996
|
+
if (!MIME[ext]) throw new (0, _chunk5FS4IZWYcjs.KordocError)(`place_seal: \uC9C0\uC6D0\uD558\uC9C0 \uC54A\uB294 \uC774\uBBF8\uC9C0 \uD655\uC7A5\uC790 .${ext} (png/jpg/bmp/gif)`);
|
|
25997
|
+
if (!imageMagicMatches(op.image, ext)) throw new (0, _chunk5FS4IZWYcjs.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)`);
|
|
25991
25998
|
const wantOcc = _nullishCoalesce(op.occurrence, () => ( 0));
|
|
25992
25999
|
let found = null;
|
|
25993
26000
|
let total = 0;
|
|
@@ -26020,7 +26027,7 @@ async function placeSealHwpx(hwpxBuffer, ops) {
|
|
|
26020
26027
|
}
|
|
26021
26028
|
}
|
|
26022
26029
|
}
|
|
26023
|
-
throw new (0,
|
|
26030
|
+
throw new (0, _chunk5FS4IZWYcjs.KordocError)(
|
|
26024
26031
|
`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)})`
|
|
26025
26032
|
);
|
|
26026
26033
|
}
|
|
@@ -26028,7 +26035,7 @@ async function placeSealHwpx(hwpxBuffer, ops) {
|
|
|
26028
26035
|
const xml = sectionXmls[si];
|
|
26029
26036
|
const run = anchorRunInfo(xml, site.para, op.anchor);
|
|
26030
26037
|
if (!run) {
|
|
26031
|
-
throw new (0,
|
|
26038
|
+
throw new (0, _chunk5FS4IZWYcjs.KordocError)(`place_seal: \uC575\uCEE4 "${op.anchor}" \uBB38\uB2E8\uC5D0\uC11C run\uC744 \uCC3E\uC9C0 \uBABB\uD588\uC2B5\uB2C8\uB2E4`);
|
|
26032
26039
|
}
|
|
26033
26040
|
const charPrHeight = _nullishCoalesce(_optionalChain([styles, 'optionalAccess', _398 => _398.charPr, 'access', _399 => _399.get, 'call', _400 => _400(run.charPr), 'optionalAccess', _401 => _401.height]), () => ( 1e3));
|
|
26034
26041
|
const fontPt = charPrHeight / 100;
|
|
@@ -26306,7 +26313,7 @@ function pick(map, keys) {
|
|
|
26306
26313
|
return out;
|
|
26307
26314
|
}
|
|
26308
26315
|
async function hwpxToProfile(input) {
|
|
26309
|
-
const buf = input instanceof ArrayBuffer ? input :
|
|
26316
|
+
const buf = input instanceof ArrayBuffer ? input : _chunk5FS4IZWYcjs.toArrayBuffer.call(void 0, input);
|
|
26310
26317
|
const zip = await _jszip2.default.loadAsync(buf);
|
|
26311
26318
|
const parser = createXmlParser();
|
|
26312
26319
|
const headerFile = _nullishCoalesce(zip.file("Contents/header.xml"), () => ( _optionalChain([zip, 'access', _423 => _423.file, 'call', _424 => _424(/[Hh]eader\.xml$/), 'optionalAccess', _425 => _425[0]])));
|
|
@@ -27225,7 +27232,7 @@ async function resolveSectionEntryNames(zip) {
|
|
|
27225
27232
|
const paths = sectionPathsFromManifest(xml).filter((p) => zip.file(p) !== null);
|
|
27226
27233
|
if (paths.length > 0) return paths;
|
|
27227
27234
|
}
|
|
27228
|
-
return Object.keys(zip.files).filter((n) => /[Ss]ection\d+\.xml$/.test(n)).sort(
|
|
27235
|
+
return Object.keys(zip.files).filter((n) => /[Ss]ection\d+\.xml$/.test(n)).sort(_chunk5FS4IZWYcjs.compareSectionPaths);
|
|
27229
27236
|
}
|
|
27230
27237
|
function sectionPathsFromManifest(xml) {
|
|
27231
27238
|
const attr = (tag, name) => {
|
|
@@ -27235,7 +27242,7 @@ function sectionPathsFromManifest(xml) {
|
|
|
27235
27242
|
const idToHref = /* @__PURE__ */ new Map();
|
|
27236
27243
|
for (const m of xml.matchAll(/<opf:item(\s(?:"[^"]*"|'[^']*'|[^>"'])*?)\/?>/g)) {
|
|
27237
27244
|
const id = attr(m[1], "id");
|
|
27238
|
-
const href =
|
|
27245
|
+
const href = _chunk5FS4IZWYcjs.normalizeSectionHref.call(void 0, attr(m[1], "href"));
|
|
27239
27246
|
if (id && href) idToHref.set(id, href);
|
|
27240
27247
|
}
|
|
27241
27248
|
const ordered = [];
|
|
@@ -27244,7 +27251,7 @@ function sectionPathsFromManifest(xml) {
|
|
|
27244
27251
|
if (href) ordered.push(href);
|
|
27245
27252
|
}
|
|
27246
27253
|
if (ordered.length > 0) return ordered;
|
|
27247
|
-
return Array.from(idToHref.values()).sort(
|
|
27254
|
+
return Array.from(idToHref.values()).sort(_chunk5FS4IZWYcjs.compareSectionPaths);
|
|
27248
27255
|
}
|
|
27249
27256
|
|
|
27250
27257
|
// src/roundtrip/patcher.ts
|
|
@@ -27355,9 +27362,9 @@ function buildOrigUnits(blocks) {
|
|
|
27355
27362
|
if (block.type === "paragraph" && block.text && /^\[별표\s*\d+/.test(sanitizeText(block.text))) {
|
|
27356
27363
|
const next = blocks[i + 1];
|
|
27357
27364
|
if (_optionalChain([next, 'optionalAccess', _458 => _458.type]) === "paragraph" && next.text && /관련\)?$/.test(next.text)) consume = 2;
|
|
27358
|
-
chunk =
|
|
27365
|
+
chunk = _chunk6XVQSILNcjs.blocksToMarkdown.call(void 0, blocks.slice(i, i + consume));
|
|
27359
27366
|
} else {
|
|
27360
|
-
chunk =
|
|
27367
|
+
chunk = _chunk6XVQSILNcjs.blocksToMarkdown.call(void 0, [block]);
|
|
27361
27368
|
}
|
|
27362
27369
|
if (chunk) {
|
|
27363
27370
|
const subUnits = splitMarkdownUnits(chunk);
|
|
@@ -28960,12 +28967,12 @@ function blocksToChunks(blocks, options) {
|
|
|
28960
28967
|
let run = null;
|
|
28961
28968
|
const flushRun = () => {
|
|
28962
28969
|
if (!run) return;
|
|
28963
|
-
push("text", run.breadcrumb,
|
|
28970
|
+
push("text", run.breadcrumb, _chunk6XVQSILNcjs.blocksToMarkdown.call(void 0, run.blocks), [run.start, run.end], run.page);
|
|
28964
28971
|
run = null;
|
|
28965
28972
|
};
|
|
28966
28973
|
for (let i = 0; i < blocks.length; i++) {
|
|
28967
28974
|
const block = blocks[i];
|
|
28968
|
-
const md2 =
|
|
28975
|
+
const md2 = _chunk6XVQSILNcjs.blocksToMarkdown.call(void 0, [block]);
|
|
28969
28976
|
if (!md2) continue;
|
|
28970
28977
|
if (block.type === "heading") {
|
|
28971
28978
|
flushRun();
|
|
@@ -29435,13 +29442,13 @@ async function htmlToPdf(html, options) {
|
|
|
29435
29442
|
try {
|
|
29436
29443
|
puppeteer = await Promise.resolve().then(() => _interopRequireWildcard(require("puppeteer-core")));
|
|
29437
29444
|
} catch (e32) {
|
|
29438
|
-
throw new (0,
|
|
29445
|
+
throw new (0, _chunk5FS4IZWYcjs.KordocError)(
|
|
29439
29446
|
"PDF \uC0DD\uC131\uC5D0 puppeteer-core\uAC00 \uD544\uC694\uD569\uB2C8\uB2E4. \uC124\uCE58: npm install puppeteer-core"
|
|
29440
29447
|
);
|
|
29441
29448
|
}
|
|
29442
29449
|
const executablePath = _nullishCoalesce(process.env.PUPPETEER_EXECUTABLE_PATH, () => ( findChromiumPath()));
|
|
29443
29450
|
if (!executablePath) {
|
|
29444
|
-
throw new (0,
|
|
29451
|
+
throw new (0, _chunk5FS4IZWYcjs.KordocError)(
|
|
29445
29452
|
"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."
|
|
29446
29453
|
);
|
|
29447
29454
|
}
|
|
@@ -29500,7 +29507,7 @@ async function markdownToPdf(markdown, options) {
|
|
|
29500
29507
|
return htmlToPdf(html, options);
|
|
29501
29508
|
}
|
|
29502
29509
|
async function blocksToPdf(blocks, options) {
|
|
29503
|
-
const markdown =
|
|
29510
|
+
const markdown = _chunk6XVQSILNcjs.blocksToMarkdown.call(void 0, blocks);
|
|
29504
29511
|
return markdownToPdf(markdown, options);
|
|
29505
29512
|
}
|
|
29506
29513
|
|
|
@@ -30394,15 +30401,15 @@ function renderSectionToPages(root, geom, ctxBase, doReflow, reflowMode) {
|
|
|
30394
30401
|
async function renderHwpxToSvg(input, options) {
|
|
30395
30402
|
const maxImg = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _555 => _555.maxImageBytes]), () => ( 40 * 1024 * 1024));
|
|
30396
30403
|
const ab = input instanceof Uint8Array ? input.buffer.slice(input.byteOffset, input.byteOffset + input.byteLength) : input;
|
|
30397
|
-
|
|
30404
|
+
_chunk5FS4IZWYcjs.precheckZipSize.call(void 0, ab, MAX_DECOMPRESS_SIZE, MAX_ZIP_ENTRIES);
|
|
30398
30405
|
let zip;
|
|
30399
30406
|
try {
|
|
30400
30407
|
zip = await _jszip2.default.loadAsync(input);
|
|
30401
30408
|
} catch (e33) {
|
|
30402
|
-
throw new (0,
|
|
30409
|
+
throw new (0, _chunk5FS4IZWYcjs.KordocError)("HWPX(ZIP) \uD615\uC2DD\uC774 \uC544\uB2D9\uB2C8\uB2E4 \u2014 \uB80C\uB354\uB294 HWPX\uB9CC \uC9C0\uC6D0");
|
|
30403
30410
|
}
|
|
30404
30411
|
const secFiles = zip.file(/Contents\/section\d+\.xml$/i).sort((a, b) => a.name.localeCompare(b.name));
|
|
30405
|
-
if (secFiles.length === 0) throw new (0,
|
|
30412
|
+
if (secFiles.length === 0) throw new (0, _chunk5FS4IZWYcjs.KordocError)("Contents/section0.xml \uC5C6\uC74C \u2014 HWPX\uAC00 \uC544\uB2C8\uAC70\uB098 \uC190\uC0C1\uB428");
|
|
30406
30413
|
const warnings = [];
|
|
30407
30414
|
const headFile = _nullishCoalesce(zip.file("Contents/header.xml"), () => ( zip.file("Contents/head.xml")));
|
|
30408
30415
|
const styles = headFile ? parseRenderStyles(await headFile.async("string")) : { charPr: /* @__PURE__ */ new Map(), paraAlign: /* @__PURE__ */ new Map(), paraGeom: /* @__PURE__ */ new Map(), borderFill: /* @__PURE__ */ new Map() };
|
|
@@ -30410,7 +30417,7 @@ async function renderHwpxToSvg(input, options) {
|
|
|
30410
30417
|
const secXmls = [];
|
|
30411
30418
|
for (const f of secFiles) {
|
|
30412
30419
|
const xml = await f.async("string");
|
|
30413
|
-
if (xml.length > MAX_DECOMPRESS_SIZE) throw new (0,
|
|
30420
|
+
if (xml.length > MAX_DECOMPRESS_SIZE) throw new (0, _chunk5FS4IZWYcjs.KordocError)("\uC139\uC158 XML\uC774 \uD5C8\uC6A9 \uD06C\uAE30\uB97C \uCD08\uACFC");
|
|
30414
30421
|
secXmls.push(xml);
|
|
30415
30422
|
}
|
|
30416
30423
|
const binmap = /* @__PURE__ */ new Map();
|
|
@@ -30483,9 +30490,9 @@ async function renderHwpxToSvg(input, options) {
|
|
|
30483
30490
|
}
|
|
30484
30491
|
if (rendered.length === 0) {
|
|
30485
30492
|
if (noCacheSkipped) {
|
|
30486
|
-
throw new (0,
|
|
30493
|
+
throw new (0, _chunk5FS4IZWYcjs.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)");
|
|
30487
30494
|
}
|
|
30488
|
-
throw new (0,
|
|
30495
|
+
throw new (0, _chunk5FS4IZWYcjs.KordocError)("\uB80C\uB354\uD560 \uAD6C\uC5ED\uC774 \uC5C6\uC2B5\uB2C8\uB2E4 \u2014 HWPX\uAC00 \uC190\uC0C1\uB418\uC5C8\uC744 \uC218 \uC788\uC2B5\uB2C8\uB2E4");
|
|
30489
30496
|
}
|
|
30490
30497
|
const GAP = 2400;
|
|
30491
30498
|
const clipDefs = [];
|
|
@@ -30521,13 +30528,13 @@ async function parse(input, options) {
|
|
|
30521
30528
|
if (typeof input === "string") {
|
|
30522
30529
|
try {
|
|
30523
30530
|
const buf = await _promises.readFile.call(void 0, input);
|
|
30524
|
-
buffer =
|
|
30531
|
+
buffer = _chunk5FS4IZWYcjs.toArrayBuffer.call(void 0, buf);
|
|
30525
30532
|
} catch (err) {
|
|
30526
30533
|
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}`;
|
|
30527
30534
|
return { success: false, fileType: "unknown", error: msg2, code: "PARSE_ERROR" };
|
|
30528
30535
|
}
|
|
30529
30536
|
} else if (Buffer.isBuffer(input)) {
|
|
30530
|
-
buffer =
|
|
30537
|
+
buffer = _chunk5FS4IZWYcjs.toArrayBuffer.call(void 0, input);
|
|
30531
30538
|
} else {
|
|
30532
30539
|
buffer = input;
|
|
30533
30540
|
}
|
|
@@ -30561,18 +30568,18 @@ async function parse(input, options) {
|
|
|
30561
30568
|
}
|
|
30562
30569
|
async function parseImage(buffer, options) {
|
|
30563
30570
|
try {
|
|
30564
|
-
const { parseImageDocument } = await Promise.resolve().then(() => _interopRequireWildcard(require("./image-ocr-
|
|
30571
|
+
const { parseImageDocument } = await Promise.resolve().then(() => _interopRequireWildcard(require("./image-ocr-YOUVLJIH.cjs")));
|
|
30565
30572
|
const { blocks, warnings } = await parseImageDocument(buffer, options);
|
|
30566
30573
|
return {
|
|
30567
30574
|
success: true,
|
|
30568
30575
|
fileType: "image",
|
|
30569
|
-
markdown:
|
|
30576
|
+
markdown: _chunk6XVQSILNcjs.blocksToMarkdown.call(void 0, blocks),
|
|
30570
30577
|
blocks,
|
|
30571
30578
|
warnings: warnings.length ? warnings : void 0,
|
|
30572
30579
|
pageCount: 1
|
|
30573
30580
|
};
|
|
30574
30581
|
} catch (err) {
|
|
30575
|
-
return { success: false, fileType: "image", error:
|
|
30582
|
+
return { success: false, fileType: "image", error: _chunk5FS4IZWYcjs.sanitizeError.call(void 0, err), code: _chunk5FS4IZWYcjs.classifyError.call(void 0, err) };
|
|
30576
30583
|
}
|
|
30577
30584
|
}
|
|
30578
30585
|
async function parseHwp3(buffer, options) {
|
|
@@ -30580,7 +30587,7 @@ async function parseHwp3(buffer, options) {
|
|
|
30580
30587
|
const { markdown, blocks, metadata, outline, warnings } = parseHwp3Document(buffer, options);
|
|
30581
30588
|
return { success: true, fileType: "hwp3", markdown, blocks, metadata, outline, warnings };
|
|
30582
30589
|
} catch (err) {
|
|
30583
|
-
return { success: false, fileType: "hwp3", error:
|
|
30590
|
+
return { success: false, fileType: "hwp3", error: _chunk5FS4IZWYcjs.sanitizeError.call(void 0, err), code: _chunk5FS4IZWYcjs.classifyError.call(void 0, err) };
|
|
30584
30591
|
}
|
|
30585
30592
|
}
|
|
30586
30593
|
async function parseHwpx(buffer, options) {
|
|
@@ -30588,7 +30595,7 @@ async function parseHwpx(buffer, options) {
|
|
|
30588
30595
|
const { markdown, blocks, metadata, outline, warnings, images } = await parseHwpxDocument(buffer, options);
|
|
30589
30596
|
return { success: true, fileType: "hwpx", markdown, blocks, metadata, outline, warnings, images: _optionalChain([images, 'optionalAccess', _562 => _562.length]) ? images : void 0 };
|
|
30590
30597
|
} catch (err) {
|
|
30591
|
-
return { success: false, fileType: "hwpx", error:
|
|
30598
|
+
return { success: false, fileType: "hwpx", error: _chunk5FS4IZWYcjs.sanitizeError.call(void 0, err), code: _chunk5FS4IZWYcjs.classifyError.call(void 0, err) };
|
|
30592
30599
|
}
|
|
30593
30600
|
}
|
|
30594
30601
|
async function parseHwp(buffer, options) {
|
|
@@ -30613,13 +30620,13 @@ async function parseHwp(buffer, options) {
|
|
|
30613
30620
|
}
|
|
30614
30621
|
return { success: true, fileType: "hwp", markdown, blocks, metadata, outline, warnings, images: _optionalChain([images, 'optionalAccess', _564 => _564.length]) ? images : void 0 };
|
|
30615
30622
|
} catch (err) {
|
|
30616
|
-
return { success: false, fileType: "hwp", error:
|
|
30623
|
+
return { success: false, fileType: "hwp", error: _chunk5FS4IZWYcjs.sanitizeError.call(void 0, err), code: _chunk5FS4IZWYcjs.classifyError.call(void 0, err) };
|
|
30617
30624
|
}
|
|
30618
30625
|
}
|
|
30619
30626
|
async function parsePdf(buffer, options) {
|
|
30620
30627
|
let parsePdfDocument;
|
|
30621
30628
|
try {
|
|
30622
|
-
const mod = await Promise.resolve().then(() => _interopRequireWildcard(require("./parser-
|
|
30629
|
+
const mod = await Promise.resolve().then(() => _interopRequireWildcard(require("./parser-AUMEO4OU.cjs")));
|
|
30623
30630
|
parsePdfDocument = mod.parsePdfDocument;
|
|
30624
30631
|
} catch (e35) {
|
|
30625
30632
|
return {
|
|
@@ -30634,7 +30641,7 @@ async function parsePdf(buffer, options) {
|
|
|
30634
30641
|
return { success: true, fileType: "pdf", markdown, blocks, metadata, outline, warnings, isImageBased, pageQuality, qualitySummary, images };
|
|
30635
30642
|
} catch (err) {
|
|
30636
30643
|
const isImageBased = err instanceof Error && "isImageBased" in err ? true : void 0;
|
|
30637
|
-
return { success: false, fileType: "pdf", error:
|
|
30644
|
+
return { success: false, fileType: "pdf", error: _chunk5FS4IZWYcjs.sanitizeError.call(void 0, err), code: _chunk5FS4IZWYcjs.classifyError.call(void 0, err), isImageBased };
|
|
30638
30645
|
}
|
|
30639
30646
|
}
|
|
30640
30647
|
async function parseXlsx(buffer, options) {
|
|
@@ -30642,7 +30649,7 @@ async function parseXlsx(buffer, options) {
|
|
|
30642
30649
|
const { markdown, blocks, metadata, warnings } = await parseXlsxDocument(buffer, options);
|
|
30643
30650
|
return { success: true, fileType: "xlsx", markdown, blocks, metadata, warnings };
|
|
30644
30651
|
} catch (err) {
|
|
30645
|
-
return { success: false, fileType: "xlsx", error:
|
|
30652
|
+
return { success: false, fileType: "xlsx", error: _chunk5FS4IZWYcjs.sanitizeError.call(void 0, err), code: _chunk5FS4IZWYcjs.classifyError.call(void 0, err) };
|
|
30646
30653
|
}
|
|
30647
30654
|
}
|
|
30648
30655
|
async function parseXls(buffer, options) {
|
|
@@ -30650,7 +30657,7 @@ async function parseXls(buffer, options) {
|
|
|
30650
30657
|
const { markdown, blocks, metadata, warnings } = await parseXlsDocument(buffer, options);
|
|
30651
30658
|
return { success: true, fileType: "xls", markdown, blocks, metadata, warnings };
|
|
30652
30659
|
} catch (err) {
|
|
30653
|
-
return { success: false, fileType: "xls", error:
|
|
30660
|
+
return { success: false, fileType: "xls", error: _chunk5FS4IZWYcjs.sanitizeError.call(void 0, err), code: _chunk5FS4IZWYcjs.classifyError.call(void 0, err) };
|
|
30654
30661
|
}
|
|
30655
30662
|
}
|
|
30656
30663
|
async function parseDocx(buffer, options) {
|
|
@@ -30658,7 +30665,7 @@ async function parseDocx(buffer, options) {
|
|
|
30658
30665
|
const { markdown, blocks, metadata, outline, warnings, images } = await parseDocxDocument(buffer, options);
|
|
30659
30666
|
return { success: true, fileType: "docx", markdown, blocks, metadata, outline, warnings, images: _optionalChain([images, 'optionalAccess', _565 => _565.length]) ? images : void 0 };
|
|
30660
30667
|
} catch (err) {
|
|
30661
|
-
return { success: false, fileType: "docx", error:
|
|
30668
|
+
return { success: false, fileType: "docx", error: _chunk5FS4IZWYcjs.sanitizeError.call(void 0, err), code: _chunk5FS4IZWYcjs.classifyError.call(void 0, err) };
|
|
30662
30669
|
}
|
|
30663
30670
|
}
|
|
30664
30671
|
async function parseHwpml(buffer, options) {
|
|
@@ -30666,16 +30673,16 @@ async function parseHwpml(buffer, options) {
|
|
|
30666
30673
|
const { markdown, blocks, metadata, outline, warnings } = parseHwpmlDocument(buffer, options);
|
|
30667
30674
|
return { success: true, fileType: "hwpml", markdown, blocks, metadata, outline, warnings };
|
|
30668
30675
|
} catch (err) {
|
|
30669
|
-
return { success: false, fileType: "hwpml", error:
|
|
30676
|
+
return { success: false, fileType: "hwpml", error: _chunk5FS4IZWYcjs.sanitizeError.call(void 0, err), code: _chunk5FS4IZWYcjs.classifyError.call(void 0, err) };
|
|
30670
30677
|
}
|
|
30671
30678
|
}
|
|
30672
30679
|
async function fillForm(input, values, outputFormat = "markdown") {
|
|
30673
30680
|
let buffer;
|
|
30674
30681
|
if (typeof input === "string") {
|
|
30675
30682
|
const buf = await _promises.readFile.call(void 0, input);
|
|
30676
|
-
buffer =
|
|
30683
|
+
buffer = _chunk5FS4IZWYcjs.toArrayBuffer.call(void 0, buf);
|
|
30677
30684
|
} else if (Buffer.isBuffer(input)) {
|
|
30678
|
-
buffer =
|
|
30685
|
+
buffer = _chunk5FS4IZWYcjs.toArrayBuffer.call(void 0, input);
|
|
30679
30686
|
} else {
|
|
30680
30687
|
buffer = input;
|
|
30681
30688
|
}
|
|
@@ -30701,7 +30708,7 @@ async function fillForm(input, values, outputFormat = "markdown") {
|
|
|
30701
30708
|
throw new Error(`\uC11C\uC2DD \uD30C\uC2F1 \uC2E4\uD328: ${parsed.error}`);
|
|
30702
30709
|
}
|
|
30703
30710
|
const fill = fillFormFields(parsed.blocks, values);
|
|
30704
|
-
const markdown =
|
|
30711
|
+
const markdown = _chunk6XVQSILNcjs.blocksToMarkdown.call(void 0, fill.blocks);
|
|
30705
30712
|
if (outputFormat === "hwpx") {
|
|
30706
30713
|
const hwpxBuffer = await markdownToHwpx(markdown);
|
|
30707
30714
|
return { output: hwpxBuffer, format: "hwpx", fill };
|
|
@@ -30775,5 +30782,5 @@ async function fillForm(input, values, outputFormat = "markdown") {
|
|
|
30775
30782
|
|
|
30776
30783
|
|
|
30777
30784
|
|
|
30778
|
-
exports.DEFAULT_REDACT_RULES = DEFAULT_REDACT_RULES; exports.HwpxSession = HwpxSession; exports.PRESET_ALIAS = PRESET_ALIAS; exports.SPACE_EM_FIXED = SPACE_EM_FIXED; exports.SPACE_EM_FONT = SPACE_EM_FONT; exports.VERSION =
|
|
30785
|
+
exports.DEFAULT_REDACT_RULES = DEFAULT_REDACT_RULES; exports.HwpxSession = HwpxSession; exports.PRESET_ALIAS = PRESET_ALIAS; exports.SPACE_EM_FIXED = SPACE_EM_FIXED; exports.SPACE_EM_FONT = SPACE_EM_FONT; exports.VERSION = _chunk5FS4IZWYcjs.VERSION; exports.ValueCursor = ValueCursor; exports.applySplices = applySplices; exports.blocksToChunks = blocksToChunks; exports.blocksToMarkdown = _chunk6XVQSILNcjs.blocksToMarkdown; exports.blocksToPdf = blocksToPdf; exports.buildParagraphSplices = buildParagraphSplices; exports.buildRangeSplices = buildRangeSplices; exports.charWidthEm1000 = charWidthEm1000; exports.compare = compare; exports.detectFormat = detectFormat; exports.detectOle2Format = detectOle2Format; exports.detectZipFormat = detectZipFormat; exports.diffBlocks = diffBlocks; exports.extractFormFields = extractFormFields; exports.extractFormSchema = extractFormSchema; exports.fillForm = fillForm; exports.fillFormFields = fillFormFields; exports.fillHwpx = fillHwpx; exports.fillWithUniqueGuard = fillWithUniqueGuard; exports.fitRatioForFewerLines = fitRatioForFewerLines; exports.formatFillValue = formatFillValue; exports.gongmunLintWarnings = gongmunLintWarnings; exports.hwpxToProfile = hwpxToProfile; exports.incompatibleGongmunWarnings = incompatibleGongmunWarnings; exports.inferFieldType = inferFieldType; exports.isHwpxFile = isHwpxFile; exports.isKnownFont = isKnownFont; exports.isLabelCell = isLabelCell; exports.isOldHwpFile = isOldHwpFile; exports.isPdfFile = isPdfFile; exports.isZipFile = isZipFile; exports.lintGongmunText = lintGongmunText; exports.markdownToHwpx = markdownToHwpx; exports.markdownToPdf = markdownToPdf; exports.measureTextWidth = measureTextWidth; exports.normalizeGongmunPreset = normalizeGongmunPreset; exports.openHwpxDocument = openHwpxDocument; exports.parse = parse; exports.parseDocx = parseDocx; exports.parseHwp = parseHwp; exports.parseHwp3 = parseHwp3; exports.parseHwpml = parseHwpml; exports.parseHwpx = parseHwpx; exports.parseImage = parseImage; exports.parsePdf = parsePdf; exports.parseXls = parseXls; exports.parseXlsx = parseXlsx; exports.patchHwp = patchHwp; exports.patchHwpx = patchHwpx; exports.patchHwpxBlocks = patchHwpxBlocks; exports.placeSealHwpx = placeSealHwpx; exports.redactMarkdown = redactMarkdown; exports.redactText = redactText; exports.renderHtml = renderHtml; exports.renderHwpxToSvg = renderHwpxToSvg; exports.scanSectionXml = scanSectionXml; exports.simulateWrap = simulateWrap; exports.simulateWrapKeepWord = simulateWrapKeepWord; exports.unknownFontWarnings = unknownFontWarnings; exports.validateHwpx = validateHwpx;
|
|
30779
30786
|
//# sourceMappingURL=index.cjs.map
|