kordoc 4.0.0 → 4.0.2

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.
Files changed (44) hide show
  1. package/dist/{-URVKBXYK.js → -XMKVL3NX.js} +11 -7
  2. package/dist/{chunk-IA5UZZKV.js → chunk-3IYQYBUF.js} +2 -2
  3. package/dist/{chunk-THZVBYHE.js → chunk-67RANGFQ.js} +3 -3
  4. package/dist/{chunk-JUJEKFUF.js → chunk-6SD4X5PT.js} +3 -3
  5. package/dist/{chunk-7ETIIYGI.js → chunk-6YIYFWO2.js} +2 -2
  6. package/dist/{chunk-PGWAF755.js → chunk-AHWRAGXN.js} +477 -89
  7. package/dist/chunk-AHWRAGXN.js.map +1 -0
  8. package/dist/{chunk-DVUNWK6W.js → chunk-IKBIIEVJ.js} +2 -2
  9. package/dist/{chunk-ZKG6SBHV.js → chunk-STMLZDKR.js} +2 -2
  10. package/dist/{chunk-EBSCV3JC.cjs → chunk-WN7LZHII.cjs} +2 -2
  11. package/dist/{chunk-EBSCV3JC.cjs.map → chunk-WN7LZHII.cjs.map} +1 -1
  12. package/dist/cli.js +72 -14
  13. package/dist/cli.js.map +1 -1
  14. package/dist/index.cjs +730 -342
  15. package/dist/index.cjs.map +1 -1
  16. package/dist/index.d.cts +93 -6
  17. package/dist/index.d.ts +93 -6
  18. package/dist/index.js +472 -84
  19. package/dist/index.js.map +1 -1
  20. package/dist/mcp.js +60 -14
  21. package/dist/mcp.js.map +1 -1
  22. package/dist/{parser-NXHY37WH.js → parser-2Q2YKEJG.js} +2 -2
  23. package/dist/{parser-LHUO6UUA.js → parser-3HM2VYKK.js} +3 -3
  24. package/dist/{parser-6TV6JKHF.cjs → parser-6AYYGX6J.cjs} +14 -14
  25. package/dist/{parser-6TV6JKHF.cjs.map → parser-6AYYGX6J.cjs.map} +1 -1
  26. package/dist/render-W4VCJE6N.js +10 -0
  27. package/dist/seal-DRPTNHOP.js +10 -0
  28. package/dist/{watch-PNXTAWDR.js → watch-6OHF727O.js} +7 -7
  29. package/package.json +1 -1
  30. package/dist/chunk-PGWAF755.js.map +0 -1
  31. package/dist/render-T5O6QHBJ.js +0 -10
  32. package/dist/seal-7KNR5WFH.js +0 -10
  33. /package/dist/{-URVKBXYK.js.map → -XMKVL3NX.js.map} +0 -0
  34. /package/dist/{chunk-IA5UZZKV.js.map → chunk-3IYQYBUF.js.map} +0 -0
  35. /package/dist/{chunk-THZVBYHE.js.map → chunk-67RANGFQ.js.map} +0 -0
  36. /package/dist/{chunk-JUJEKFUF.js.map → chunk-6SD4X5PT.js.map} +0 -0
  37. /package/dist/{chunk-7ETIIYGI.js.map → chunk-6YIYFWO2.js.map} +0 -0
  38. /package/dist/{chunk-DVUNWK6W.js.map → chunk-IKBIIEVJ.js.map} +0 -0
  39. /package/dist/{chunk-ZKG6SBHV.js.map → chunk-STMLZDKR.js.map} +0 -0
  40. /package/dist/{parser-NXHY37WH.js.map → parser-2Q2YKEJG.js.map} +0 -0
  41. /package/dist/{parser-LHUO6UUA.js.map → parser-3HM2VYKK.js.map} +0 -0
  42. /package/dist/{render-T5O6QHBJ.js.map → render-W4VCJE6N.js.map} +0 -0
  43. /package/dist/{seal-7KNR5WFH.js.map → seal-DRPTNHOP.js.map} +0 -0
  44. /package/dist/{watch-PNXTAWDR.js.map → watch-6OHF727O.js.map} +0 -0
package/dist/index.cjs CHANGED
@@ -20,7 +20,7 @@
20
20
 
21
21
 
22
22
 
23
- var _chunkEBSCV3JCcjs = require('./chunk-EBSCV3JC.cjs');
23
+ var _chunkWN7LZHIIcjs = require('./chunk-WN7LZHII.cjs');
24
24
 
25
25
 
26
26
  var _chunkDCZVOIEOcjs = require('./chunk-DCZVOIEO.cjs');
@@ -406,7 +406,7 @@ 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, _chunkEBSCV3JCcjs.KordocError)(`XML \uD30C\uC2F1 \uC2E4\uD328: ${msg2}`);
409
+ if (level === "fatalError") throw new (0, _chunkWN7LZHIIcjs.KordocError)(`XML \uD30C\uC2F1 \uC2E4\uD328: ${msg2}`);
410
410
  _optionalChain([warnings, 'optionalAccess', _3 => _3.push, 'call', _4 => _4({ code: "MALFORMED_XML", message: `XML ${level === "warn" ? "\uACBD\uACE0" : "\uC624\uB958"}: ${msg2}` })]);
411
411
  }
412
412
  });
@@ -461,10 +461,10 @@ 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, _chunkEBSCV3JCcjs.KordocError)("ZIP \uC555\uCD95 \uD574\uC81C \uD06C\uAE30 \uCD08\uACFC (ZIP bomb \uC758\uC2EC)");
464
+ if (decompressed.total > MAX_DECOMPRESS_SIZE) throw new (0, _chunkWN7LZHIIcjs.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(_chunkEBSCV3JCcjs.stripDtd.call(void 0, xml), "text/xml");
467
+ const doc = parser.parseFromString(_chunkWN7LZHIIcjs.stripDtd.call(void 0, xml), "text/xml");
468
468
  if (!doc.documentElement) continue;
469
469
  parseCharProperties(doc, result.charProperties);
470
470
  parseStyleElements(doc, result.styles);
@@ -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 >= _chunkEBSCV3JCcjs.HEADING_RATIO_H1) level = 1;
620
- else if (ratio >= _chunkEBSCV3JCcjs.HEADING_RATIO_H2) level = 2;
621
- else if (ratio >= _chunkEBSCV3JCcjs.HEADING_RATIO_H3) level = 3;
619
+ if (ratio >= _chunkWN7LZHIIcjs.HEADING_RATIO_H1) level = 1;
620
+ else if (ratio >= _chunkWN7LZHIIcjs.HEADING_RATIO_H2) level = 2;
621
+ else if (ratio >= _chunkWN7LZHIIcjs.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 = _chunkEBSCV3JCcjs.buildTable.call(void 0, state.rows);
1205
+ const table2 = _chunkWN7LZHIIcjs.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 = _chunkEBSCV3JCcjs.convertTableToText.call(void 0, newTable.rows);
1275
+ let flat = _chunkWN7LZHIIcjs.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(_chunkEBSCV3JCcjs.stripDtd.call(void 0, xml), "text/xml");
1287
+ const doc = parser.parseFromString(_chunkWN7LZHIIcjs.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;
@@ -1375,8 +1375,8 @@ function walkSection(node, blocks, tableCtx, tableStack, ctx, depth = 0) {
1375
1375
  const cs = isNaN(rawCs) ? 1 : rawCs;
1376
1376
  const rawRs = parseInt(el.getAttribute("rowSpan") || "1", 10);
1377
1377
  const rs = isNaN(rawRs) ? 1 : rawRs;
1378
- tableCtx.cell.colSpan = clampSpan(cs, _chunkEBSCV3JCcjs.MAX_COLS);
1379
- tableCtx.cell.rowSpan = clampSpan(rs, _chunkEBSCV3JCcjs.MAX_ROWS);
1378
+ tableCtx.cell.colSpan = clampSpan(cs, _chunkWN7LZHIIcjs.MAX_COLS);
1379
+ tableCtx.cell.rowSpan = clampSpan(rs, _chunkWN7LZHIIcjs.MAX_ROWS);
1380
1380
  }
1381
1381
  break;
1382
1382
  case "p": {
@@ -1598,7 +1598,7 @@ function extractHyperlinkHref(fieldBegin) {
1598
1598
  let url = (ch.textContent || "").trim();
1599
1599
  if (!url) continue;
1600
1600
  url = url.replace(/^https?:\/\/(?=https?:\/\/)/i, "");
1601
- const safe = _chunkEBSCV3JCcjs.sanitizeHref.call(void 0, url);
1601
+ const safe = _chunkWN7LZHIIcjs.sanitizeHref.call(void 0, url);
1602
1602
  if (safe) return safe;
1603
1603
  }
1604
1604
  return void 0;
@@ -1733,7 +1733,7 @@ function extractParagraphInfo(para2, styleMap, ctx) {
1733
1733
  case "hyperlink": {
1734
1734
  const url = child.getAttribute("url") || child.getAttribute("href") || "";
1735
1735
  if (url) {
1736
- const safe = _chunkEBSCV3JCcjs.sanitizeHref.call(void 0, url);
1736
+ const safe = _chunkWN7LZHIIcjs.sanitizeHref.call(void 0, url);
1737
1737
  if (safe) href = safe;
1738
1738
  }
1739
1739
  walk(child);
@@ -1919,13 +1919,13 @@ async function extractImagesFromZip(zip, blocks, decompressed, warnings) {
1919
1919
  }
1920
1920
  const allCandidates = resolvedPath ? [resolvedPath, ...candidates] : candidates;
1921
1921
  for (const path of allCandidates) {
1922
- if (_chunkEBSCV3JCcjs.isPathTraversal.call(void 0, path)) continue;
1922
+ if (_chunkWN7LZHIIcjs.isPathTraversal.call(void 0, path)) continue;
1923
1923
  const file = zip.file(path);
1924
1924
  if (!file) continue;
1925
1925
  try {
1926
1926
  const data = await file.async("uint8array");
1927
1927
  decompressed.total += data.length;
1928
- if (decompressed.total > MAX_DECOMPRESS_SIZE) throw new (0, _chunkEBSCV3JCcjs.KordocError)("ZIP \uC555\uCD95 \uD574\uC81C \uD06C\uAE30 \uCD08\uACFC (ZIP bomb \uC758\uC2EC)");
1928
+ if (decompressed.total > MAX_DECOMPRESS_SIZE) throw new (0, _chunkWN7LZHIIcjs.KordocError)("ZIP \uC555\uCD95 \uD574\uC81C \uD06C\uAE30 \uCD08\uACFC (ZIP bomb \uC758\uC2EC)");
1929
1929
  const ext = path.includes(".") ? path.split(".").pop() || "png" : "png";
1930
1930
  const mimeType = imageExtToMime(ext);
1931
1931
  imageIndex++;
@@ -1934,7 +1934,7 @@ async function extractImagesFromZip(zip, blocks, decompressed, warnings) {
1934
1934
  images.push(img);
1935
1935
  break;
1936
1936
  } catch (err) {
1937
- if (err instanceof _chunkEBSCV3JCcjs.KordocError) throw err;
1937
+ if (err instanceof _chunkWN7LZHIIcjs.KordocError) throw err;
1938
1938
  }
1939
1939
  }
1940
1940
  if (!img) _optionalChain([warnings, 'optionalAccess', _38 => _38.push, 'call', _39 => _39({ page: block.pageNumber, message: `\uC774\uBBF8\uC9C0 \uD30C\uC77C \uC5C6\uC74C: ${ref}`, code: "SKIPPED_IMAGE" })]);
@@ -1996,7 +1996,7 @@ function extractFromBrokenZip(buffer) {
1996
1996
  }
1997
1997
  const nameBytes = data.slice(pos + 30, pos + 30 + nameLen);
1998
1998
  const name = new TextDecoder().decode(nameBytes);
1999
- if (_chunkEBSCV3JCcjs.isPathTraversal.call(void 0, name)) {
1999
+ if (_chunkWN7LZHIIcjs.isPathTraversal.call(void 0, name)) {
2000
2000
  pos = fileStart + compSize;
2001
2001
  continue;
2002
2002
  }
@@ -2014,16 +2014,16 @@ function extractFromBrokenZip(buffer) {
2014
2014
  continue;
2015
2015
  }
2016
2016
  totalDecompressed += content.length * 2;
2017
- if (totalDecompressed > MAX_DECOMPRESS_SIZE) throw new (0, _chunkEBSCV3JCcjs.KordocError)("\uC555\uCD95 \uD574\uC81C \uD06C\uAE30 \uCD08\uACFC");
2017
+ if (totalDecompressed > MAX_DECOMPRESS_SIZE) throw new (0, _chunkWN7LZHIIcjs.KordocError)("\uC555\uCD95 \uD574\uC81C \uD06C\uAE30 \uCD08\uACFC");
2018
2018
  sectionNum++;
2019
2019
  blocks.push(...parseSectionXml(content, void 0, warnings, sectionNum, shared));
2020
2020
  } catch (e13) {
2021
2021
  continue;
2022
2022
  }
2023
2023
  }
2024
- if (blocks.length === 0) throw new (0, _chunkEBSCV3JCcjs.KordocError)("\uC190\uC0C1\uB41C HWPX\uC5D0\uC11C \uC139\uC158 \uB370\uC774\uD130\uB97C \uBCF5\uAD6C\uD560 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4");
2024
+ if (blocks.length === 0) throw new (0, _chunkWN7LZHIIcjs.KordocError)("\uC190\uC0C1\uB41C HWPX\uC5D0\uC11C \uC139\uC158 \uB370\uC774\uD130\uB97C \uBCF5\uAD6C\uD560 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4");
2025
2025
  applyPageText(blocks, shared);
2026
- const markdown = _chunkEBSCV3JCcjs.blocksToMarkdown.call(void 0, blocks);
2026
+ const markdown = _chunkWN7LZHIIcjs.blocksToMarkdown.call(void 0, blocks);
2027
2027
  return { markdown, blocks, warnings: warnings.length > 0 ? warnings : void 0 };
2028
2028
  }
2029
2029
  async function resolveSectionPaths(zip) {
@@ -2037,18 +2037,18 @@ async function resolveSectionPaths(zip) {
2037
2037
  if (paths.length > 0) return paths;
2038
2038
  }
2039
2039
  const sectionFiles = zip.file(/[Ss]ection\d+\.xml$/);
2040
- return sectionFiles.map((f) => f.name).sort(_chunkEBSCV3JCcjs.compareSectionPaths);
2040
+ return sectionFiles.map((f) => f.name).sort(_chunkWN7LZHIIcjs.compareSectionPaths);
2041
2041
  }
2042
2042
  function parseSectionPathsFromManifest(xml) {
2043
2043
  const parser = createXmlParser();
2044
- const doc = parser.parseFromString(_chunkEBSCV3JCcjs.stripDtd.call(void 0, xml), "text/xml");
2044
+ const doc = parser.parseFromString(_chunkWN7LZHIIcjs.stripDtd.call(void 0, xml), "text/xml");
2045
2045
  const items = doc.getElementsByTagName("opf:item");
2046
2046
  const spine = doc.getElementsByTagName("opf:itemref");
2047
2047
  const idToHref = /* @__PURE__ */ new Map();
2048
2048
  for (let i = 0; i < items.length; i++) {
2049
2049
  const item = items[i];
2050
2050
  const id = item.getAttribute("id") || "";
2051
- const href = _chunkEBSCV3JCcjs.normalizeSectionHref.call(void 0, item.getAttribute("href") || "");
2051
+ const href = _chunkWN7LZHIIcjs.normalizeSectionHref.call(void 0, item.getAttribute("href") || "");
2052
2052
  if (id && href) idToHref.set(id, href);
2053
2053
  }
2054
2054
  if (spine.length > 0) {
@@ -2059,7 +2059,7 @@ function parseSectionPathsFromManifest(xml) {
2059
2059
  }
2060
2060
  if (ordered.length > 0) return ordered;
2061
2061
  }
2062
- return Array.from(idToHref.values()).sort(_chunkEBSCV3JCcjs.compareSectionPaths);
2062
+ return Array.from(idToHref.values()).sort(_chunkWN7LZHIIcjs.compareSectionPaths);
2063
2063
  }
2064
2064
 
2065
2065
  // src/hwpx/metadata.ts
@@ -2072,7 +2072,7 @@ async function extractHwpxMetadata(zip, metadata, decompressed) {
2072
2072
  const xml = await file.async("text");
2073
2073
  if (decompressed) {
2074
2074
  decompressed.total += xml.length * 2;
2075
- if (decompressed.total > MAX_DECOMPRESS_SIZE) throw new (0, _chunkEBSCV3JCcjs.KordocError)("ZIP \uC555\uCD95 \uD574\uC81C \uD06C\uAE30 \uCD08\uACFC (ZIP bomb \uC758\uC2EC)");
2075
+ if (decompressed.total > MAX_DECOMPRESS_SIZE) throw new (0, _chunkWN7LZHIIcjs.KordocError)("ZIP \uC555\uCD95 \uD574\uC81C \uD06C\uAE30 \uCD08\uACFC (ZIP bomb \uC758\uC2EC)");
2076
2076
  }
2077
2077
  parseDublinCoreMetadata(xml, metadata);
2078
2078
  if (metadata.title || metadata.author) return;
@@ -2082,7 +2082,7 @@ async function extractHwpxMetadata(zip, metadata, decompressed) {
2082
2082
  }
2083
2083
  function parseDublinCoreMetadata(xml, metadata) {
2084
2084
  const parser = createXmlParser();
2085
- const doc = parser.parseFromString(_chunkEBSCV3JCcjs.stripDtd.call(void 0, xml), "text/xml");
2085
+ const doc = parser.parseFromString(_chunkWN7LZHIIcjs.stripDtd.call(void 0, xml), "text/xml");
2086
2086
  if (!doc.documentElement) return;
2087
2087
  const getText = (tagNames) => {
2088
2088
  for (const tag of tagNames) {
@@ -2107,7 +2107,7 @@ function parseDublinCoreMetadata(xml, metadata) {
2107
2107
 
2108
2108
  // src/hwpx/parser.ts
2109
2109
  async function parseHwpxDocument(buffer, options) {
2110
- _chunkEBSCV3JCcjs.precheckZipSize.call(void 0, buffer, MAX_DECOMPRESS_SIZE, MAX_ZIP_ENTRIES);
2110
+ _chunkWN7LZHIIcjs.precheckZipSize.call(void 0, buffer, MAX_DECOMPRESS_SIZE, MAX_ZIP_ENTRIES);
2111
2111
  let zip;
2112
2112
  try {
2113
2113
  zip = await _jszip2.default.loadAsync(buffer);
@@ -2116,7 +2116,7 @@ async function parseHwpxDocument(buffer, options) {
2116
2116
  }
2117
2117
  const actualEntryCount = Object.keys(zip.files).length;
2118
2118
  if (actualEntryCount > MAX_ZIP_ENTRIES) {
2119
- throw new (0, _chunkEBSCV3JCcjs.KordocError)("ZIP \uC5D4\uD2B8\uB9AC \uC218 \uCD08\uACFC (ZIP bomb \uC758\uC2EC)");
2119
+ throw new (0, _chunkWN7LZHIIcjs.KordocError)("ZIP \uC5D4\uD2B8\uB9AC \uC218 \uCD08\uACFC (ZIP bomb \uC758\uC2EC)");
2120
2120
  }
2121
2121
  const manifestFile = zip.file("META-INF/manifest.xml");
2122
2122
  if (manifestFile) {
@@ -2128,7 +2128,7 @@ async function parseHwpxDocument(buffer, options) {
2128
2128
  return comResultToParseResult(pages, pageCount, warnings2);
2129
2129
  }
2130
2130
  }
2131
- throw new (0, _chunkEBSCV3JCcjs.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.");
2131
+ throw new (0, _chunkWN7LZHIIcjs.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
2132
  }
2133
2133
  }
2134
2134
  const decompressed = { total: 0 };
@@ -2137,7 +2137,7 @@ async function parseHwpxDocument(buffer, options) {
2137
2137
  const styleMap = await extractHwpxStyles(zip, decompressed);
2138
2138
  const warnings = [];
2139
2139
  const sectionPaths = await resolveSectionPaths(zip);
2140
- if (sectionPaths.length === 0) throw new (0, _chunkEBSCV3JCcjs.KordocError)("HWPX\uC5D0\uC11C \uC139\uC158 \uD30C\uC77C\uC744 \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4");
2140
+ if (sectionPaths.length === 0) throw new (0, _chunkWN7LZHIIcjs.KordocError)("HWPX\uC5D0\uC11C \uC139\uC158 \uD30C\uC77C\uC744 \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4");
2141
2141
  metadata.pageCount = sectionPaths.length;
2142
2142
  const pageFilter = _optionalChain([options, 'optionalAccess', _45 => _45.pages]) ? _chunkDCZVOIEOcjs.parsePageRange.call(void 0, options.pages, sectionPaths.length) : null;
2143
2143
  const totalTarget = pageFilter ? pageFilter.size : sectionPaths.length;
@@ -2151,12 +2151,12 @@ async function parseHwpxDocument(buffer, options) {
2151
2151
  try {
2152
2152
  const xml = await file.async("text");
2153
2153
  decompressed.total += xml.length * 2;
2154
- if (decompressed.total > MAX_DECOMPRESS_SIZE) throw new (0, _chunkEBSCV3JCcjs.KordocError)("ZIP \uC555\uCD95 \uD574\uC81C \uD06C\uAE30 \uCD08\uACFC (ZIP bomb \uC758\uC2EC)");
2154
+ if (decompressed.total > MAX_DECOMPRESS_SIZE) throw new (0, _chunkWN7LZHIIcjs.KordocError)("ZIP \uC555\uCD95 \uD574\uC81C \uD06C\uAE30 \uCD08\uACFC (ZIP bomb \uC758\uC2EC)");
2155
2155
  blocks.push(...parseSectionXml(xml, styleMap, warnings, si + 1, shared));
2156
2156
  parsedSections++;
2157
2157
  _optionalChain([options, 'optionalAccess', _46 => _46.onProgress, 'optionalCall', _47 => _47(parsedSections, totalTarget)]);
2158
2158
  } catch (secErr) {
2159
- if (secErr instanceof _chunkEBSCV3JCcjs.KordocError) throw secErr;
2159
+ if (secErr instanceof _chunkWN7LZHIIcjs.KordocError) throw secErr;
2160
2160
  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
2161
  }
2162
2162
  }
@@ -2164,7 +2164,7 @@ async function parseHwpxDocument(buffer, options) {
2164
2164
  const images = await extractImagesFromZip(zip, blocks, decompressed, warnings);
2165
2165
  detectHwpxHeadings(blocks, styleMap);
2166
2166
  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 = _chunkEBSCV3JCcjs.blocksToMarkdown.call(void 0, blocks);
2167
+ const markdown = _chunkWN7LZHIIcjs.blocksToMarkdown.call(void 0, blocks);
2168
2168
  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
2169
  }
2170
2170
 
@@ -2231,7 +2231,7 @@ function decompressStream(data) {
2231
2231
  return _zlib.inflateRawSync.call(void 0, data, opts);
2232
2232
  }
2233
2233
  function parseFileHeader(data) {
2234
- if (data.length < 40) throw new (0, _chunkEBSCV3JCcjs.KordocError)("FileHeader\uAC00 \uB108\uBB34 \uC9E7\uC2B5\uB2C8\uB2E4 (\uCD5C\uC18C 40\uBC14\uC774\uD2B8)");
2234
+ if (data.length < 40) throw new (0, _chunkWN7LZHIIcjs.KordocError)("FileHeader\uAC00 \uB108\uBB34 \uC9E7\uC2B5\uB2C8\uB2E4 (\uCD5C\uC18C 40\uBC14\uC774\uD2B8)");
2235
2235
  const sig = data.subarray(0, 32).toString("utf8").replace(/\0+$/, "");
2236
2236
  return {
2237
2237
  signature: sig,
@@ -3901,7 +3901,7 @@ function parseHwp5Document(buffer, options) {
3901
3901
  lenientCfb = parseLenientCfb(buffer);
3902
3902
  warnings.push({ message: "\uC190\uC0C1\uB41C CFB \uCEE8\uD14C\uC774\uB108 \u2014 lenient \uBAA8\uB4DC\uB85C \uBCF5\uAD6C", code: "LENIENT_CFB_RECOVERY" });
3903
3903
  } catch (e21) {
3904
- throw new (0, _chunkEBSCV3JCcjs.KordocError)("CFB \uCEE8\uD14C\uC774\uB108 \uD30C\uC2F1 \uC2E4\uD328 (strict \uBC0F lenient \uBAA8\uB450)");
3904
+ throw new (0, _chunkWN7LZHIIcjs.KordocError)("CFB \uCEE8\uD14C\uC774\uB108 \uD30C\uC2F1 \uC2E4\uD328 (strict \uBC0F lenient \uBAA8\uB450)");
3905
3905
  }
3906
3906
  }
3907
3907
  const findStream = (path) => {
@@ -3912,11 +3912,11 @@ function parseHwp5Document(buffer, options) {
3912
3912
  return lenientCfb.findStream(path);
3913
3913
  };
3914
3914
  const headerData = findStream("/FileHeader");
3915
- if (!headerData) throw new (0, _chunkEBSCV3JCcjs.KordocError)("FileHeader \uC2A4\uD2B8\uB9BC \uC5C6\uC74C");
3915
+ if (!headerData) throw new (0, _chunkWN7LZHIIcjs.KordocError)("FileHeader \uC2A4\uD2B8\uB9BC \uC5C6\uC74C");
3916
3916
  const header = parseFileHeader(headerData);
3917
- if (header.signature !== "HWP Document File") throw new (0, _chunkEBSCV3JCcjs.KordocError)("HWP \uC2DC\uADF8\uB2C8\uCC98 \uBD88\uC77C\uCE58");
3918
- if (header.flags & FLAG_ENCRYPTED) throw new (0, _chunkEBSCV3JCcjs.KordocError)("\uC554\uD638\uD654\uB41C HWP\uB294 \uC9C0\uC6D0\uD558\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4");
3919
- if (header.flags & FLAG_DRM) throw new (0, _chunkEBSCV3JCcjs.KordocError)("DRM \uBCF4\uD638\uB41C HWP\uB294 \uC9C0\uC6D0\uD558\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4");
3917
+ if (header.signature !== "HWP Document File") throw new (0, _chunkWN7LZHIIcjs.KordocError)("HWP \uC2DC\uADF8\uB2C8\uCC98 \uBD88\uC77C\uCE58");
3918
+ if (header.flags & FLAG_ENCRYPTED) throw new (0, _chunkWN7LZHIIcjs.KordocError)("\uC554\uD638\uD654\uB41C HWP\uB294 \uC9C0\uC6D0\uD558\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4");
3919
+ if (header.flags & FLAG_DRM) throw new (0, _chunkWN7LZHIIcjs.KordocError)("DRM \uBCF4\uD638\uB41C HWP\uB294 \uC9C0\uC6D0\uD558\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4");
3920
3920
  const compressed = (header.flags & FLAG_COMPRESSED) !== 0;
3921
3921
  const distribution = (header.flags & FLAG_DISTRIBUTION) !== 0;
3922
3922
  const metadata = {
@@ -3925,7 +3925,7 @@ function parseHwp5Document(buffer, options) {
3925
3925
  if (cfb) extractHwp5Metadata(cfb, metadata);
3926
3926
  const docInfo = cfb ? parseDocInfoStream(cfb, compressed) : parseDocInfoFromStream(findStream("/DocInfo"), compressed);
3927
3927
  const sections = distribution ? cfb ? findViewTextSections(cfb, compressed) : findViewTextSectionsLenient(lenientCfb, compressed) : cfb ? findSections(cfb) : findSectionsLenient(lenientCfb, compressed);
3928
- if (sections.length === 0) throw new (0, _chunkEBSCV3JCcjs.KordocError)("\uC139\uC158 \uC2A4\uD2B8\uB9BC\uC744 \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4");
3928
+ if (sections.length === 0) throw new (0, _chunkWN7LZHIIcjs.KordocError)("\uC139\uC158 \uC2A4\uD2B8\uB9BC\uC744 \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4");
3929
3929
  metadata.pageCount = sections.length;
3930
3930
  const pageFilter = _optionalChain([options, 'optionalAccess', _52 => _52.pages]) ? _chunkDCZVOIEOcjs.parsePageRange.call(void 0, options.pages, sections.length) : null;
3931
3931
  const totalTarget = pageFilter ? pageFilter.size : sections.length;
@@ -3939,22 +3939,22 @@ function parseHwp5Document(buffer, options) {
3939
3939
  const sectionData = sections[si];
3940
3940
  const data = !distribution && compressed ? decompressStream(Buffer.from(sectionData)) : Buffer.from(sectionData);
3941
3941
  totalDecompressed += data.length;
3942
- if (totalDecompressed > MAX_TOTAL_DECOMPRESS) throw new (0, _chunkEBSCV3JCcjs.KordocError)("\uCD1D \uC555\uCD95 \uD574\uC81C \uD06C\uAE30 \uCD08\uACFC (decompression bomb \uC758\uC2EC)");
3942
+ if (totalDecompressed > MAX_TOTAL_DECOMPRESS) throw new (0, _chunkWN7LZHIIcjs.KordocError)("\uCD1D \uC555\uCD95 \uD574\uC81C \uD06C\uAE30 \uCD08\uACFC (decompression bomb \uC758\uC2EC)");
3943
3943
  const records = readRecords(data);
3944
3944
  const sectionBlocks = parseSection(records, docInfo, warnings, si + 1, doc);
3945
3945
  bodyBlocks.push(...sectionBlocks);
3946
3946
  parsedSections++;
3947
3947
  _optionalChain([options, 'optionalAccess', _53 => _53.onProgress, 'optionalCall', _54 => _54(parsedSections, totalTarget)]);
3948
3948
  } catch (secErr) {
3949
- if (secErr instanceof _chunkEBSCV3JCcjs.KordocError) throw secErr;
3949
+ if (secErr instanceof _chunkWN7LZHIIcjs.KordocError) throw secErr;
3950
3950
  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
3951
  }
3952
3952
  }
3953
3953
  const blocks = [...doc.headerBlocks, ...bodyBlocks, ...doc.footerBlocks];
3954
3954
  const images = cfb ? extractHwp5Images(cfb.FileIndex, blocks, warnings) : extractHwp5ImagesLenient(lenientCfb, blocks, warnings);
3955
- let flatBlocks = _chunkEBSCV3JCcjs.flattenLayoutTables.call(void 0, blocks);
3955
+ let flatBlocks = _chunkWN7LZHIIcjs.flattenLayoutTables.call(void 0, blocks);
3956
3956
  if (_optionalChain([options, 'optionalAccess', _55 => _55.dedupeRunningHeaders])) {
3957
- const deduped = _chunkEBSCV3JCcjs.dedupeRunningHeaders.call(void 0, flatBlocks);
3957
+ const deduped = _chunkWN7LZHIIcjs.dedupeRunningHeaders.call(void 0, flatBlocks);
3958
3958
  const removed = flatBlocks.length - deduped.length;
3959
3959
  if (removed > 0) warnings.push({ message: `\uBC18\uBCF5 \uB7EC\uB2DD \uD5E4\uB354 ${removed}\uAC1C \uC81C\uAC70`, code: "HIDDEN_TEXT_FILTERED" });
3960
3960
  flatBlocks = deduped;
@@ -3963,7 +3963,7 @@ function parseHwp5Document(buffer, options) {
3963
3963
  detectHwp5Headings(flatBlocks, docInfo);
3964
3964
  }
3965
3965
  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 = _chunkEBSCV3JCcjs.blocksToMarkdown.call(void 0, flatBlocks);
3966
+ let markdown = _chunkWN7LZHIIcjs.blocksToMarkdown.call(void 0, flatBlocks);
3967
3967
  if (_optionalChain([options, 'optionalAccess', _56 => _56.inlineImages]) && images.length > 0) {
3968
3968
  try {
3969
3969
  markdown = inlineImagesIntoMarkdown(markdown, images, { compress: true });
@@ -4030,9 +4030,9 @@ function detectHwp5Headings(blocks, docInfo) {
4030
4030
  let level = 0;
4031
4031
  if (_optionalChain([block, 'access', _61 => _61.style, 'optionalAccess', _62 => _62.fontSize]) && baseFontSize > 0) {
4032
4032
  const ratio = block.style.fontSize / baseFontSize;
4033
- if (ratio >= _chunkEBSCV3JCcjs.HEADING_RATIO_H1) level = 1;
4034
- else if (ratio >= _chunkEBSCV3JCcjs.HEADING_RATIO_H2) level = 2;
4035
- else if (ratio >= _chunkEBSCV3JCcjs.HEADING_RATIO_H3) level = 3;
4033
+ if (ratio >= _chunkWN7LZHIIcjs.HEADING_RATIO_H1) level = 1;
4034
+ else if (ratio >= _chunkWN7LZHIIcjs.HEADING_RATIO_H2) level = 2;
4035
+ else if (ratio >= _chunkWN7LZHIIcjs.HEADING_RATIO_H3) level = 3;
4036
4036
  }
4037
4037
  if (/^제\d+[장절편]\s/.test(text) && text.length <= 50) {
4038
4038
  if (level === 0) level = 2;
@@ -4117,7 +4117,7 @@ function findSectionsLenient(lcfb, compressed) {
4117
4117
  if (!raw) break;
4118
4118
  const content = compressed ? decompressStream(raw) : raw;
4119
4119
  totalDecompressed += content.length;
4120
- if (totalDecompressed > MAX_TOTAL_DECOMPRESS) throw new (0, _chunkEBSCV3JCcjs.KordocError)("\uCD1D \uC555\uCD95 \uD574\uC81C \uD06C\uAE30 \uCD08\uACFC (decompression bomb \uC758\uC2EC)");
4120
+ if (totalDecompressed > MAX_TOTAL_DECOMPRESS) throw new (0, _chunkWN7LZHIIcjs.KordocError)("\uCD1D \uC555\uCD95 \uD574\uC81C \uD06C\uAE30 \uCD08\uACFC (decompression bomb \uC758\uC2EC)");
4121
4121
  sections.push({ idx: i, content });
4122
4122
  }
4123
4123
  if (sections.length === 0) {
@@ -4129,7 +4129,7 @@ function findSectionsLenient(lcfb, compressed) {
4129
4129
  if (raw) {
4130
4130
  const content = compressed ? decompressStream(raw) : raw;
4131
4131
  totalDecompressed += content.length;
4132
- if (totalDecompressed > MAX_TOTAL_DECOMPRESS) throw new (0, _chunkEBSCV3JCcjs.KordocError)("\uCD1D \uC555\uCD95 \uD574\uC81C \uD06C\uAE30 \uCD08\uACFC (decompression bomb \uC758\uC2EC)");
4132
+ if (totalDecompressed > MAX_TOTAL_DECOMPRESS) throw new (0, _chunkWN7LZHIIcjs.KordocError)("\uCD1D \uC555\uCD95 \uD574\uC81C \uD06C\uAE30 \uCD08\uACFC (decompression bomb \uC758\uC2EC)");
4133
4133
  sections.push({ idx, content });
4134
4134
  }
4135
4135
  }
@@ -4146,7 +4146,7 @@ function findViewTextSectionsLenient(lcfb, compressed) {
4146
4146
  try {
4147
4147
  const content = decryptViewText(raw, compressed);
4148
4148
  totalDecompressed += content.length;
4149
- if (totalDecompressed > MAX_TOTAL_DECOMPRESS) throw new (0, _chunkEBSCV3JCcjs.KordocError)("\uCD1D \uC555\uCD95 \uD574\uC81C \uD06C\uAE30 \uCD08\uACFC (decompression bomb \uC758\uC2EC)");
4149
+ if (totalDecompressed > MAX_TOTAL_DECOMPRESS) throw new (0, _chunkWN7LZHIIcjs.KordocError)("\uCD1D \uC555\uCD95 \uD574\uC81C \uD06C\uAE30 \uCD08\uACFC (decompression bomb \uC758\uC2EC)");
4150
4150
  sections.push({ idx: i, content });
4151
4151
  } catch (e26) {
4152
4152
  break;
@@ -4249,7 +4249,7 @@ function parseParagraph(records, start, end, ctx) {
4249
4249
  const ctrl = ctrls[r.ctrlIdx];
4250
4250
  if (!_optionalChain([ctrl, 'optionalAccess', _69 => _69.href]) || r.end <= r.start) continue;
4251
4251
  if (applied.some(([s, e]) => r.start < e && r.end > s)) continue;
4252
- const href = _chunkEBSCV3JCcjs.sanitizeHref.call(void 0, ctrl.href);
4252
+ const href = _chunkWN7LZHIIcjs.sanitizeHref.call(void 0, ctrl.href);
4253
4253
  if (!href) continue;
4254
4254
  const anchor = text.slice(r.start, r.end);
4255
4255
  if (!anchor.trim()) continue;
@@ -4482,8 +4482,8 @@ function parseTableControl(ctrl, records, ctx) {
4482
4482
  let tableIdx = -1;
4483
4483
  for (let i2 = childStart; i2 < childEnd; i2++) {
4484
4484
  if (records[i2].tagId === TAG_TABLE && records[i2].data.length >= 8) {
4485
- rows = Math.min(records[i2].data.readUInt16LE(4), _chunkEBSCV3JCcjs.MAX_ROWS);
4486
- cols = Math.min(records[i2].data.readUInt16LE(6), _chunkEBSCV3JCcjs.MAX_COLS);
4485
+ rows = Math.min(records[i2].data.readUInt16LE(4), _chunkWN7LZHIIcjs.MAX_ROWS);
4486
+ cols = Math.min(records[i2].data.readUInt16LE(6), _chunkWN7LZHIIcjs.MAX_COLS);
4487
4487
  tableIdx = i2;
4488
4488
  break;
4489
4489
  }
@@ -4532,7 +4532,7 @@ function parseTableControl(ctrl, records, ctx) {
4532
4532
  return table3;
4533
4533
  }
4534
4534
  const cellRows = arrangeCells(rows, cols, cells);
4535
- const table2 = _chunkEBSCV3JCcjs.buildTable.call(void 0, cellRows);
4535
+ const table2 = _chunkWN7LZHIIcjs.buildTable.call(void 0, cellRows);
4536
4536
  if (caption && table2.rows > 0) table2.caption = caption;
4537
4537
  return table2.rows > 0 ? table2 : null;
4538
4538
  }
@@ -4549,8 +4549,8 @@ function parseCell(records, lhIdx, end, ctx) {
4549
4549
  rowAddr = rec.data.readUInt16LE(10);
4550
4550
  const cs = rec.data.readUInt16LE(12);
4551
4551
  const rs = rec.data.readUInt16LE(14);
4552
- if (cs > 0) colSpan = Math.min(cs, _chunkEBSCV3JCcjs.MAX_COLS);
4553
- if (rs > 0) rowSpan = Math.min(rs, _chunkEBSCV3JCcjs.MAX_ROWS);
4552
+ if (cs > 0) colSpan = Math.min(cs, _chunkWN7LZHIIcjs.MAX_COLS);
4553
+ if (rs > 0) rowSpan = Math.min(rs, _chunkWN7LZHIIcjs.MAX_ROWS);
4554
4554
  }
4555
4555
  const blocks = ctx.depth < MAX_NEST_DEPTH ? parseParagraphList(records, lhIdx + 1, end, { ...ctx, depth: ctx.depth + 1 }) : [];
4556
4556
  const parts = [];
@@ -4560,7 +4560,7 @@ function parseCell(records, lhIdx, end, ctx) {
4560
4560
  parts.push(`![image](hwp5bin:${b.text})`);
4561
4561
  hasStructure = true;
4562
4562
  } else if (b.type === "table" && b.table) {
4563
- const flat = _chunkEBSCV3JCcjs.convertTableToText.call(void 0, b.table.cells);
4563
+ const flat = _chunkWN7LZHIIcjs.convertTableToText.call(void 0, b.table.cells);
4564
4564
  if (flat) parts.push(flat);
4565
4565
  hasStructure = true;
4566
4566
  } else if (b.text) {
@@ -16997,7 +16997,7 @@ function getTextContent(el) {
16997
16997
  return _nullishCoalesce(_optionalChain([el, 'access', _84 => _84.textContent, 'optionalAccess', _85 => _85.trim, 'call', _86 => _86()]), () => ( ""));
16998
16998
  }
16999
16999
  function parseXml(text) {
17000
- return new (0, _xmldom.DOMParser)().parseFromString(_chunkEBSCV3JCcjs.stripDtd.call(void 0, text), "text/xml");
17000
+ return new (0, _xmldom.DOMParser)().parseFromString(_chunkWN7LZHIIcjs.stripDtd.call(void 0, text), "text/xml");
17001
17001
  }
17002
17002
  function parseSharedStrings(xml) {
17003
17003
  const doc = parseXml(xml);
@@ -17141,7 +17141,7 @@ function sheetToBlocks(sheetName, grid, merges, maxRow, maxCol, sheetIndex) {
17141
17141
  cellRows.push(row);
17142
17142
  }
17143
17143
  if (cellRows.length > 0) {
17144
- const table2 = _chunkEBSCV3JCcjs.buildTable.call(void 0, cellRows);
17144
+ const table2 = _chunkWN7LZHIIcjs.buildTable.call(void 0, cellRows);
17145
17145
  if (table2.rows > 0) {
17146
17146
  blocks.push({ type: "table", table: table2, pageNumber: sheetIndex + 1 });
17147
17147
  }
@@ -17149,12 +17149,12 @@ function sheetToBlocks(sheetName, grid, merges, maxRow, maxCol, sheetIndex) {
17149
17149
  return blocks;
17150
17150
  }
17151
17151
  async function parseXlsxDocument(buffer, options) {
17152
- _chunkEBSCV3JCcjs.precheckZipSize.call(void 0, buffer, MAX_DECOMPRESS_SIZE3);
17152
+ _chunkWN7LZHIIcjs.precheckZipSize.call(void 0, buffer, MAX_DECOMPRESS_SIZE3);
17153
17153
  const zip = await _jszip2.default.loadAsync(buffer);
17154
17154
  const warnings = [];
17155
17155
  const workbookFile = zip.file("xl/workbook.xml");
17156
17156
  if (!workbookFile) {
17157
- throw new (0, _chunkEBSCV3JCcjs.KordocError)("\uC720\uD6A8\uD558\uC9C0 \uC54A\uC740 XLSX \uD30C\uC77C: xl/workbook.xml\uC774 \uC5C6\uC2B5\uB2C8\uB2E4");
17157
+ throw new (0, _chunkWN7LZHIIcjs.KordocError)("\uC720\uD6A8\uD558\uC9C0 \uC54A\uC740 XLSX \uD30C\uC77C: xl/workbook.xml\uC774 \uC5C6\uC2B5\uB2C8\uB2E4");
17158
17158
  }
17159
17159
  let sharedStrings = [];
17160
17160
  const ssFile = zip.file("xl/sharedStrings.xml");
@@ -17163,7 +17163,7 @@ async function parseXlsxDocument(buffer, options) {
17163
17163
  }
17164
17164
  const sheets = parseWorkbook(await workbookFile.async("text"));
17165
17165
  if (sheets.length === 0) {
17166
- throw new (0, _chunkEBSCV3JCcjs.KordocError)("XLSX \uD30C\uC77C\uC5D0 \uC2DC\uD2B8\uAC00 \uC5C6\uC2B5\uB2C8\uB2E4");
17166
+ throw new (0, _chunkWN7LZHIIcjs.KordocError)("XLSX \uD30C\uC77C\uC5D0 \uC2DC\uD2B8\uAC00 \uC5C6\uC2B5\uB2C8\uB2E4");
17167
17167
  }
17168
17168
  let relsMap = /* @__PURE__ */ new Map();
17169
17169
  const relsFile = zip.file("xl/_rels/workbook.xml.rels");
@@ -17235,7 +17235,7 @@ async function parseXlsxDocument(buffer, options) {
17235
17235
  } catch (e27) {
17236
17236
  }
17237
17237
  }
17238
- const markdown = _chunkEBSCV3JCcjs.blocksToMarkdown.call(void 0, blocks);
17238
+ const markdown = _chunkWN7LZHIIcjs.blocksToMarkdown.call(void 0, blocks);
17239
17239
  return { markdown, blocks, metadata, warnings: warnings.length > 0 ? warnings : void 0 };
17240
17240
  }
17241
17241
 
@@ -17642,11 +17642,11 @@ function processGlobals(records) {
17642
17642
  let encrypted = false;
17643
17643
  const firstBof = records[0];
17644
17644
  if (!firstBof || firstBof.opcode !== OP_BOF) {
17645
- throw new (0, _chunkEBSCV3JCcjs.KordocError)("XLS: \uCCAB \uB808\uCF54\uB4DC\uAC00 BOF\uAC00 \uC544\uB2D8");
17645
+ throw new (0, _chunkWN7LZHIIcjs.KordocError)("XLS: \uCCAB \uB808\uCF54\uB4DC\uAC00 BOF\uAC00 \uC544\uB2D8");
17646
17646
  }
17647
17647
  const bof = decodeBof(firstBof.data);
17648
17648
  if (!bof || bof.dt !== DT_GLOBALS) {
17649
- throw new (0, _chunkEBSCV3JCcjs.KordocError)("XLS: Globals \uC11C\uBE0C\uC2A4\uD2B8\uB9BC BOF \uB204\uB77D");
17649
+ throw new (0, _chunkWN7LZHIIcjs.KordocError)("XLS: Globals \uC11C\uBE0C\uC2A4\uD2B8\uB9BC BOF \uB204\uB77D");
17650
17650
  }
17651
17651
  let i = 1;
17652
17652
  while (i < records.length) {
@@ -17761,7 +17761,7 @@ function sheetToBlocks2(sheetName, sheet, sheetIndex) {
17761
17761
  cellRows.push(row);
17762
17762
  }
17763
17763
  if (cellRows.length > 0) {
17764
- const table2 = _chunkEBSCV3JCcjs.buildTable.call(void 0, cellRows);
17764
+ const table2 = _chunkWN7LZHIIcjs.buildTable.call(void 0, cellRows);
17765
17765
  if (table2.rows > 0) {
17766
17766
  blocks.push({ type: "table", table: table2, pageNumber: sheetIndex + 1 });
17767
17767
  }
@@ -17774,21 +17774,21 @@ async function parseXlsDocument(buffer, options) {
17774
17774
  try {
17775
17775
  cfb = parseLenientCfb(buf);
17776
17776
  } catch (e) {
17777
- throw new (0, _chunkEBSCV3JCcjs.KordocError)(
17777
+ throw new (0, _chunkWN7LZHIIcjs.KordocError)(
17778
17778
  `XLS: OLE2 \uC2DC\uADF8\uB2C8\uCC98 \uAC80\uC99D \uC2E4\uD328 \u2014 ${e instanceof Error ? e.message : "\uC54C \uC218 \uC5C6\uB294 \uC624\uB958"}`
17779
17779
  );
17780
17780
  }
17781
17781
  const wb = _nullishCoalesce(cfb.findStream("/Workbook"), () => ( cfb.findStream("/Book")));
17782
17782
  if (!wb) {
17783
- throw new (0, _chunkEBSCV3JCcjs.KordocError)("XLS: Workbook \uC2A4\uD2B8\uB9BC\uC774 \uC5C6\uC74C (BIFF5 \uB610\uB294 \uBE44\uD45C\uC900 \uD30C\uC77C)");
17783
+ throw new (0, _chunkWN7LZHIIcjs.KordocError)("XLS: Workbook \uC2A4\uD2B8\uB9BC\uC774 \uC5C6\uC74C (BIFF5 \uB610\uB294 \uBE44\uD45C\uC900 \uD30C\uC77C)");
17784
17784
  }
17785
17785
  const records = readRecords2(wb);
17786
17786
  if (records.length === 0) {
17787
- throw new (0, _chunkEBSCV3JCcjs.KordocError)("XLS: \uC2DC\uADF8\uB2C8\uCC98 \uB808\uCF54\uB4DC\uAC00 \uC5C6\uC74C (Workbook \uC2A4\uD2B8\uB9BC \uC190\uC0C1)");
17787
+ throw new (0, _chunkWN7LZHIIcjs.KordocError)("XLS: \uC2DC\uADF8\uB2C8\uCC98 \uB808\uCF54\uB4DC\uAC00 \uC5C6\uC74C (Workbook \uC2A4\uD2B8\uB9BC \uC190\uC0C1)");
17788
17788
  }
17789
17789
  const firstBof = decodeBof(records[0].data);
17790
17790
  if (firstBof && firstBof.vers !== 1536) {
17791
- throw new (0, _chunkEBSCV3JCcjs.KordocError)(
17791
+ throw new (0, _chunkWN7LZHIIcjs.KordocError)(
17792
17792
  `XLS: BIFF8(0x0600)\uB9CC \uC9C0\uC6D0 \u2014 \uBCF8 \uD30C\uC77C\uC740 0x${firstBof.vers.toString(16)}`
17793
17793
  );
17794
17794
  }
@@ -17848,7 +17848,7 @@ async function parseXlsDocument(buffer, options) {
17848
17848
  pageCount: totalSheets
17849
17849
  };
17850
17850
  return {
17851
- markdown: _chunkEBSCV3JCcjs.blocksToMarkdown.call(void 0, allBlocks),
17851
+ markdown: _chunkWN7LZHIIcjs.blocksToMarkdown.call(void 0, allBlocks),
17852
17852
  blocks: allBlocks,
17853
17853
  metadata,
17854
17854
  warnings: warnings.length > 0 ? warnings : void 0
@@ -18286,7 +18286,7 @@ function getAttr(el, localName2) {
18286
18286
  return null;
18287
18287
  }
18288
18288
  function parseXml2(text) {
18289
- return new (0, _xmldom.DOMParser)().parseFromString(_chunkEBSCV3JCcjs.stripDtd.call(void 0, text), "text/xml");
18289
+ return new (0, _xmldom.DOMParser)().parseFromString(_chunkWN7LZHIIcjs.stripDtd.call(void 0, text), "text/xml");
18290
18290
  }
18291
18291
  function parseStyles(xml) {
18292
18292
  const doc = parseXml2(xml);
@@ -18571,7 +18571,7 @@ ${cell2.text}` : cell2.text;
18571
18571
  return { text: cell2.text, colSpan: cell2.colSpan, rowSpan, colAddr: cell2.col, rowAddr: r };
18572
18572
  })
18573
18573
  );
18574
- const table2 = _chunkEBSCV3JCcjs.buildTable.call(void 0, cellRows);
18574
+ const table2 = _chunkWN7LZHIIcjs.buildTable.call(void 0, cellRows);
18575
18575
  if (table2.rows === 0 || table2.cols === 0) return null;
18576
18576
  return { type: "table", table: table2 };
18577
18577
  }
@@ -18638,12 +18638,12 @@ async function extractImages(zip, rels, doc, warnings) {
18638
18638
  return { blocks, images };
18639
18639
  }
18640
18640
  async function parseDocxDocument(buffer, options) {
18641
- _chunkEBSCV3JCcjs.precheckZipSize.call(void 0, buffer, MAX_DECOMPRESS_SIZE4);
18641
+ _chunkWN7LZHIIcjs.precheckZipSize.call(void 0, buffer, MAX_DECOMPRESS_SIZE4);
18642
18642
  const zip = await _jszip2.default.loadAsync(buffer);
18643
18643
  const warnings = [];
18644
18644
  const docFile = zip.file("word/document.xml");
18645
18645
  if (!docFile) {
18646
- throw new (0, _chunkEBSCV3JCcjs.KordocError)("\uC720\uD6A8\uD558\uC9C0 \uC54A\uC740 DOCX \uD30C\uC77C: word/document.xml\uC774 \uC5C6\uC2B5\uB2C8\uB2E4");
18646
+ throw new (0, _chunkWN7LZHIIcjs.KordocError)("\uC720\uD6A8\uD558\uC9C0 \uC54A\uC740 DOCX \uD30C\uC77C: word/document.xml\uC774 \uC5C6\uC2B5\uB2C8\uB2E4");
18647
18647
  }
18648
18648
  let rels = /* @__PURE__ */ new Map();
18649
18649
  const relsFile = zip.file("word/_rels/document.xml.rels");
@@ -18690,7 +18690,7 @@ async function parseDocxDocument(buffer, options) {
18690
18690
  const doc = parseXml2(docXml);
18691
18691
  const body = findElements(doc, "body");
18692
18692
  if (body.length === 0) {
18693
- throw new (0, _chunkEBSCV3JCcjs.KordocError)("DOCX \uBCF8\uBB38(w:body)\uC744 \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4");
18693
+ throw new (0, _chunkWN7LZHIIcjs.KordocError)("DOCX \uBCF8\uBB38(w:body)\uC744 \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4");
18694
18694
  }
18695
18695
  const blocks = [];
18696
18696
  const bodyEl = body[0];
@@ -18735,7 +18735,7 @@ async function parseDocxDocument(buffer, options) {
18735
18735
  }
18736
18736
  }
18737
18737
  const outline = blocks.filter((b) => b.type === "heading").map((b) => ({ level: _nullishCoalesce(b.level, () => ( 2)), text: _nullishCoalesce(b.text, () => ( "")) }));
18738
- const markdown = _chunkEBSCV3JCcjs.blocksToMarkdown.call(void 0, blocks);
18738
+ const markdown = _chunkWN7LZHIIcjs.blocksToMarkdown.call(void 0, blocks);
18739
18739
  return {
18740
18740
  markdown,
18741
18741
  blocks,
@@ -18758,7 +18758,7 @@ function parseHwpmlDocument(buffer, options) {
18758
18758
  }
18759
18759
  const text = new TextDecoder("utf-8").decode(buffer).replace(/^\uFEFF/, "");
18760
18760
  const normalized = text.replace(/&nbsp;/g, "&#160;");
18761
- const xml = _chunkEBSCV3JCcjs.stripDtd.call(void 0, normalized);
18761
+ const xml = _chunkWN7LZHIIcjs.stripDtd.call(void 0, normalized);
18762
18762
  const warnings = [];
18763
18763
  const parser = new (0, _xmldom.DOMParser)({
18764
18764
  onError: (_level, msg2) => {
@@ -18798,7 +18798,7 @@ function parseHwpmlDocument(buffer, options) {
18798
18798
  parseSection2(el, blocks, paraShapeMap, sectionIdx, warnings);
18799
18799
  }
18800
18800
  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 = _chunkEBSCV3JCcjs.blocksToMarkdown.call(void 0, blocks);
18801
+ const markdown = _chunkWN7LZHIIcjs.blocksToMarkdown.call(void 0, blocks);
18802
18802
  return {
18803
18803
  markdown,
18804
18804
  blocks,
@@ -18956,7 +18956,7 @@ function parseTable2(el, blocks, paraShapeMap, sectionNum, warnings) {
18956
18956
  const cellRows = grid.map(
18957
18957
  (row) => row.map((cell2) => _nullishCoalesce(cell2, () => ( { text: "", colSpan: 1, rowSpan: 1 })))
18958
18958
  );
18959
- const table2 = _chunkEBSCV3JCcjs.buildTable.call(void 0, cellRows);
18959
+ const table2 = _chunkWN7LZHIIcjs.buildTable.call(void 0, cellRows);
18960
18960
  const caption = extractShapeCaption(el);
18961
18961
  if (caption.text && caption.before) {
18962
18962
  blocks.push({ type: "paragraph", text: caption.text, pageNumber: sectionNum });
@@ -20284,19 +20284,19 @@ function parseCentralDirectory(buf) {
20284
20284
  }
20285
20285
  }
20286
20286
  }
20287
- if (eocdOffset < 0) throw new (0, _chunkEBSCV3JCcjs.KordocError)("ZIP EOCD\uB97C \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4");
20287
+ if (eocdOffset < 0) throw new (0, _chunkWN7LZHIIcjs.KordocError)("ZIP EOCD\uB97C \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4");
20288
20288
  const totalEntries = view.getUint16(eocdOffset + 10, true);
20289
20289
  const cdSize = view.getUint32(eocdOffset + 12, true);
20290
20290
  const cdOffset = view.getUint32(eocdOffset + 16, true);
20291
- if (cdOffset === 4294967295 || totalEntries === 65535) throw new (0, _chunkEBSCV3JCcjs.KordocError)("ZIP64\uB294 \uC9C0\uC6D0\uD558\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4");
20291
+ if (cdOffset === 4294967295 || totalEntries === 65535) throw new (0, _chunkWN7LZHIIcjs.KordocError)("ZIP64\uB294 \uC9C0\uC6D0\uD558\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4");
20292
20292
  if (eocdOffset >= 20 && view.getUint32(eocdOffset - 20, true) === ZIP64_EOCD_LOC_SIG) {
20293
- throw new (0, _chunkEBSCV3JCcjs.KordocError)("ZIP64\uB294 \uC9C0\uC6D0\uD558\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4");
20293
+ throw new (0, _chunkWN7LZHIIcjs.KordocError)("ZIP64\uB294 \uC9C0\uC6D0\uD558\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4");
20294
20294
  }
20295
20295
  const decoder = new TextDecoder("utf-8");
20296
20296
  const entries = [];
20297
20297
  let pos = cdOffset;
20298
20298
  for (let i = 0; i < totalEntries; i++) {
20299
- if (view.getUint32(pos, true) !== CD_SIG) throw new (0, _chunkEBSCV3JCcjs.KordocError)("ZIP Central Directory \uC190\uC0C1");
20299
+ if (view.getUint32(pos, true) !== CD_SIG) throw new (0, _chunkWN7LZHIIcjs.KordocError)("ZIP Central Directory \uC190\uC0C1");
20300
20300
  const flags = view.getUint16(pos + 8, true);
20301
20301
  const method = view.getUint16(pos + 10, true);
20302
20302
  const crc = view.getUint32(pos + 16, true);
@@ -20307,7 +20307,7 @@ function parseCentralDirectory(buf) {
20307
20307
  const commentLen = view.getUint16(pos + 32, true);
20308
20308
  const localOffset = view.getUint32(pos + 42, true);
20309
20309
  if (compSize === 4294967295 || uncompSize === 4294967295 || localOffset === 4294967295) {
20310
- throw new (0, _chunkEBSCV3JCcjs.KordocError)("ZIP64\uB294 \uC9C0\uC6D0\uD558\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4");
20310
+ throw new (0, _chunkWN7LZHIIcjs.KordocError)("ZIP64\uB294 \uC9C0\uC6D0\uD558\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4");
20311
20311
  }
20312
20312
  const name = decoder.decode(buf.subarray(pos + 46, pos + 46 + nameLen));
20313
20313
  const cdEnd = pos + 46 + nameLen + extraLen + commentLen;
@@ -20336,11 +20336,11 @@ function patchZipEntries(original, replacements, additions) {
20336
20336
  const { entries, cdOffset, eocdOffset } = parseCentralDirectory(original);
20337
20337
  const view = new DataView(original.buffer, original.byteOffset, original.byteLength);
20338
20338
  for (const name of replacements.keys()) {
20339
- if (!entries.some((e) => e.name === name)) throw new (0, _chunkEBSCV3JCcjs.KordocError)(`ZIP\uC5D0 \uC5C6\uB294 \uC5D4\uD2B8\uB9AC: ${name}`);
20339
+ if (!entries.some((e) => e.name === name)) throw new (0, _chunkWN7LZHIIcjs.KordocError)(`ZIP\uC5D0 \uC5C6\uB294 \uC5D4\uD2B8\uB9AC: ${name}`);
20340
20340
  }
20341
20341
  if (additions) {
20342
20342
  for (const name of additions.keys()) {
20343
- if (entries.some((e) => e.name === name)) throw new (0, _chunkEBSCV3JCcjs.KordocError)(`ZIP\uC5D0 \uC774\uBBF8 \uC788\uB294 \uC5D4\uD2B8\uB9AC: ${name}`);
20343
+ if (entries.some((e) => e.name === name)) throw new (0, _chunkWN7LZHIIcjs.KordocError)(`ZIP\uC5D0 \uC774\uBBF8 \uC788\uB294 \uC5D4\uD2B8\uB9AC: ${name}`);
20344
20344
  }
20345
20345
  }
20346
20346
  const byLocal = [...entries].sort((a, b) => a.localOffset - b.localOffset);
@@ -20359,7 +20359,7 @@ function patchZipEntries(original, replacements, additions) {
20359
20359
  offset += seg.length;
20360
20360
  continue;
20361
20361
  }
20362
- if (view.getUint32(e.localOffset, true) !== LOCAL_SIG) throw new (0, _chunkEBSCV3JCcjs.KordocError)("ZIP \uB85C\uCEEC \uD5E4\uB354 \uC2DC\uADF8\uB2C8\uCC98 \uBD88\uC77C\uCE58");
20362
+ if (view.getUint32(e.localOffset, true) !== LOCAL_SIG) throw new (0, _chunkWN7LZHIIcjs.KordocError)("ZIP \uB85C\uCEEC \uD5E4\uB354 \uC2DC\uADF8\uB2C8\uCC98 \uBD88\uC77C\uCE58");
20363
20363
  const nameLen = view.getUint16(e.localOffset + 26, true);
20364
20364
  const extraLen = view.getUint16(e.localOffset + 28, true);
20365
20365
  const headerLen = 30 + nameLen + extraLen;
@@ -20465,7 +20465,7 @@ async function fillHwpx(hwpxBuffer, values, blockedLabels) {
20465
20465
  const zip = await _jszip2.default.loadAsync(hwpxBuffer);
20466
20466
  const sectionPaths = Object.keys(zip.files).filter((name) => /[Ss]ection\d+\.xml$/i.test(name)).sort();
20467
20467
  if (sectionPaths.length === 0) {
20468
- throw new (0, _chunkEBSCV3JCcjs.KordocError)("HWPX\uC5D0\uC11C \uC139\uC158 \uD30C\uC77C\uC744 \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4");
20468
+ throw new (0, _chunkWN7LZHIIcjs.KordocError)("HWPX\uC5D0\uC11C \uC139\uC158 \uD30C\uC77C\uC744 \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4");
20469
20469
  }
20470
20470
  const normalizedValues = normalizeValues(values);
20471
20471
  const cursor = new ValueCursor(normalizedValues);
@@ -20953,8 +20953,9 @@ function fitRatioForFewerLines(text, firstWidth, contWidth, height, baseRatio, m
20953
20953
  }
20954
20954
 
20955
20955
  // src/hwpx/gaejosik.ts
20956
- var GAEJOSIK_BULLETS = ["\u25A1", "\u25CB", "\u2015", "\u318D"];
20957
- function gaejosikMarker(depth) {
20956
+ var GAEJOSIK_BULLETS = ["\u25A1", "\u25CB", "-", "\u318D"];
20957
+ function gaejosikMarker(depth, bullet2 = "\u25CB") {
20958
+ if (depth === 1) return bullet2;
20958
20959
  return GAEJOSIK_BULLETS[Math.min(depth, GAEJOSIK_BULLETS.length - 1)];
20959
20960
  }
20960
20961
  function gaejosikSizes(bodyHeight, ov = {}) {
@@ -20990,11 +20991,11 @@ function gaejosikSpaceBefore(depth, bodyHeight) {
20990
20991
  const ui = [3e3, 2e3, 1200, 600][Math.min(depth, 3)];
20991
20992
  return Math.round(ui * s);
20992
20993
  }
20993
- function gaejosikLevelIndent(depth, bodyHeight, sizes = {}) {
20994
+ function gaejosikLevelIndent(depth, bodyHeight, sizes = {}, bullet2 = "\u25CB") {
20994
20995
  const lefts = [0, 1, 1.5, 2];
20995
20996
  const left = depth <= 3 ? Math.round(lefts[depth] * bodyHeight) : Math.round((2 + (depth - 3) * 0.5) * bodyHeight);
20996
20997
  const h = depth === 0 ? gaejosikSizes(bodyHeight, sizes).dae : bodyHeight;
20997
- return { left, indent: -markerWidth(gaejosikMarker(depth), h) };
20998
+ return { left, indent: -markerWidth(gaejosikMarker(depth, bullet2), h) };
20998
20999
  }
20999
21000
  function gaejosikChamIndent(bodyHeight, sizes = {}) {
21000
21001
  const cham = gaejosikSizes(bodyHeight, sizes).cham;
@@ -21062,7 +21063,7 @@ function bodyTitleGeom(bodyHeight, ov = {}) {
21062
21063
  }
21063
21064
 
21064
21065
  // src/hwpx/gongmun.ts
21065
- var OFFICIAL_MARGINS = { top: 20, bottom: 10, left: 20, right: 20 };
21066
+ var OFFICIAL_MARGINS = { top: 20, bottom: 15, left: 20, right: 15 };
21066
21067
  var GAEJOSIK_MARGINS = { top: 15, bottom: 15, left: 20, right: 20 };
21067
21068
  var GAEJOSIK_HEADER_FOOTER = 4251;
21068
21069
  var PRESET_DEFAULTS = {
@@ -21071,7 +21072,9 @@ var PRESET_DEFAULTS = {
21071
21072
  plan: { bodyPt: 15, lineSpacing: 160, numbering: "standard" },
21072
21073
  notice: { bodyPt: 15, lineSpacing: 160, numbering: "standard" },
21073
21074
  minutes: { bodyPt: 14, lineSpacing: 130, numbering: "standard" },
21074
- gaejosik: { bodyPt: 15, lineSpacing: 160, numbering: "gaejosik" }
21075
+ gaejosik: { bodyPt: 15, lineSpacing: 160, numbering: "gaejosik" },
21076
+ // 보도자료 — 실측(국토부 실물): 본문 바탕 14pt 160%, □→ㅇ→*(각주) 부호
21077
+ press: { bodyPt: 14, lineSpacing: 160, numbering: "report" }
21075
21078
  };
21076
21079
  var PRESET_ALIAS = {
21077
21080
  official: "official",
@@ -21094,12 +21097,17 @@ var PRESET_ALIAS = {
21094
21097
  \uAC1C\uC870\uC2DD: "gaejosik",
21095
21098
  \uAC1C\uC870\uC2DD\uBCF4\uACE0\uC11C: "gaejosik",
21096
21099
  \uC815\uBD80\uBCF4\uACE0\uC11C: "gaejosik",
21097
- \uC815\uBD80\uD45C\uC900\uAC1C\uC870\uC2DD\uBCF4\uACE0\uC11C: "gaejosik"
21100
+ \uC815\uBD80\uD45C\uC900\uAC1C\uC870\uC2DD\uBCF4\uACE0\uC11C: "gaejosik",
21101
+ press: "press",
21102
+ \uBCF4\uB3C4\uC790\uB8CC: "press"
21098
21103
  };
21099
21104
  function normalizeGongmunPreset(preset) {
21100
21105
  if (!preset) return "official";
21101
21106
  return _nullishCoalesce(PRESET_ALIAS[preset.trim()], () => ( "official"));
21102
21107
  }
21108
+ function usesReportFonts(preset) {
21109
+ return preset === "gaejosik" || preset === "report" || preset === "plan";
21110
+ }
21103
21111
  function resolveGongmun(opts) {
21104
21112
  const preset = normalizeGongmunPreset(opts.preset);
21105
21113
  const d = PRESET_DEFAULTS[preset];
@@ -21108,13 +21116,14 @@ function resolveGongmun(opts) {
21108
21116
  const coverOn = opts.cover !== void 0 ? opts.cover !== false : preset === "gaejosik";
21109
21117
  const coverOpts = typeof opts.cover === "object" ? opts.cover : {};
21110
21118
  const gaejosik = preset === "gaejosik";
21119
+ const reportFamily = gaejosik || preset === "report" || preset === "plan" || preset === "notice" || preset === "press";
21111
21120
  return {
21112
21121
  preset,
21113
21122
  bodyFont: _nullishCoalesce(opts.bodyFont, () => ( "myeongjo")),
21114
21123
  bodyHeight: Math.round(bodyPt * 100),
21115
21124
  lineSpacing: _nullishCoalesce(opts.lineSpacing, () => ( d.lineSpacing)),
21116
21125
  numbering: _nullishCoalesce(opts.numbering, () => ( d.numbering)),
21117
- margins: _nullishCoalesce(opts.margins, () => ( (gaejosik ? GAEJOSIK_MARGINS : OFFICIAL_MARGINS))),
21126
+ margins: _nullishCoalesce(opts.margins, () => ( (reportFamily ? GAEJOSIK_MARGINS : OFFICIAL_MARGINS))),
21118
21127
  centerTitle: _nullishCoalesce(opts.centerTitle, () => ( true)),
21119
21128
  autoFitMinRatio,
21120
21129
  cover: coverOn ? { date: _nullishCoalesce(coverOpts.date, () => ( null)), org: _nullishCoalesce(coverOpts.org, () => ( "")) } : null,
@@ -21123,12 +21132,26 @@ function resolveGongmun(opts) {
21123
21132
  sizes: _nullishCoalesce(opts.sizes, () => ( {})),
21124
21133
  // 쪽번호 — 보고서 계열 관행(실측: 2_보고서 양식·추진계획·공고문 전부 하단 중앙)
21125
21134
  pageNumbers: _nullishCoalesce(opts.pageNumbers, () => ( (gaejosik || preset === "report" || preset === "plan"))),
21126
- headerFooter: gaejosik ? GAEJOSIK_HEADER_FOOTER : 0,
21135
+ // 머리말·꼬리말 실측: 보고서 계열 15mm(GT3·t2·춘천·브라더), 공고·보도 10mm,
21136
+ // 기안문 0(실결재 41/60건 h0/f0)
21137
+ headerFooter: usesReportFonts(preset) ? GAEJOSIK_HEADER_FOOTER : preset === "notice" || preset === "press" ? 2835 : 0,
21127
21138
  // "끝." — 기안문 규정(본문 끝 2타+"끝."). 그 외는 opt-in
21128
21139
  endMark: _nullishCoalesce(opts.endMark, () => ( preset === "official")),
21129
21140
  approval: opts.approval && opts.approval.length > 0 ? opts.approval : null,
21130
21141
  // 본문 제목박스 — 실측(GT3·GT12): 목차 뒤 본문 시작에 제목 반복. 표지 켜진 개조식 기본
21131
- bodyTitleBox: _nullishCoalesce(opts.bodyTitleBox, () => ( (gaejosik && coverOn)))
21142
+ bodyTitleBox: _nullishCoalesce(opts.bodyTitleBox, () => ( (gaejosik && coverOn))),
21143
+ // h2 말머리 — 실측: 보고서 양식 □ 대항목(QA-2), 공고문 아라비아("1. 사업개요", 바이오헬스 실측)
21144
+ h2Marker: _nullishCoalesce(opts.h2Marker, () => ( (preset === "report" || preset === "plan" ? "box" : preset === "notice" ? "number" : "none"))),
21145
+ // 2단계 부호 — 실결재 기안문·공고문 ㅇ 지배(60건 중 ㅇ134:○5), 보고서 양식 계열 ○
21146
+ bullet2: _nullishCoalesce(opts.bullet2, () => ( (preset === "notice" || preset === "press" ? "\u3147" : "\u25CB"))),
21147
+ // 단일 형제 부호 생략 — 규정이지만 부호 없는 계단이 실무 눈에 어색 (실무자 QA)
21148
+ suppressSingle: _nullishCoalesce(opts.suppressSingle, () => ( false)),
21149
+ docHead: preset === "official" && opts.docHead ? opts.docHead : null,
21150
+ docFoot: preset === "official" && opts.docFoot ? opts.docFoot : null,
21151
+ reportInfo: _optionalChain([opts, 'access', _176 => _176.reportInfo, 'optionalAccess', _177 => _177.trim, 'call', _178 => _178()]) || null,
21152
+ noticeHead: preset === "notice" && opts.noticeHead ? opts.noticeHead : null,
21153
+ // 보도자료 머리박스는 프리셋 자체가 요구 — 옵션 미지정이어도 빈 객체
21154
+ press: preset === "press" ? _nullishCoalesce(opts.press, () => ( {})) : null
21132
21155
  };
21133
21156
  }
21134
21157
  var HANGUL_INITIALS = [0, 2, 3, 5, 6, 7, 9, 11, 12, 14, 15, 16, 17, 18];
@@ -21146,6 +21169,7 @@ function circledHangul(n) {
21146
21169
  return String.fromCodePoint(12910 + n % 14);
21147
21170
  }
21148
21171
  var REPORT_BULLETS = ["\u25A1", "\u25CB", "-", "\u318D"];
21172
+ var PRESS_BULLETS = ["\u25A1", "\u3147", "*", "\u318D"];
21149
21173
  function standardMarker(depth, n) {
21150
21174
  switch (depth) {
21151
21175
  case 0:
@@ -21168,17 +21192,19 @@ function standardMarker(depth, n) {
21168
21192
  return circledHangul(n);
21169
21193
  }
21170
21194
  }
21171
- function reportMarker(depth) {
21172
- return REPORT_BULLETS[Math.min(depth, REPORT_BULLETS.length - 1)];
21195
+ function reportMarker(depth, bullet2 = "\u25CB", press = false) {
21196
+ const bullets = press ? PRESS_BULLETS : REPORT_BULLETS;
21197
+ const m = bullets[Math.min(depth, bullets.length - 1)];
21198
+ return depth === 1 && !press ? bullet2 : m;
21173
21199
  }
21174
21200
  function markerWidth(marker, bodyHeight) {
21175
21201
  let em = SPACE_EM_FIXED;
21176
21202
  for (const c of marker) em += charWidthEm1000(c.codePointAt(0));
21177
21203
  return Math.round(em / 1e3 * bodyHeight);
21178
21204
  }
21179
- function levelIndent(depth, bodyHeight, numbering, sizes = {}) {
21180
- if (numbering === "gaejosik") return gaejosikLevelIndent(depth, bodyHeight, sizes);
21181
- const marker = numbering === "report" ? reportMarker(depth) : standardMarker(depth, 0);
21205
+ function levelIndent(depth, bodyHeight, numbering, sizes = {}, bullet2 = "\u25CB", press = false) {
21206
+ if (numbering === "gaejosik") return gaejosikLevelIndent(depth, bodyHeight, sizes, bullet2);
21207
+ const marker = numbering === "report" ? reportMarker(depth, bullet2, press) : standardMarker(depth, 0);
21182
21208
  return { left: Math.round(depth * bodyHeight), indent: -markerWidth(marker, bodyHeight) };
21183
21209
  }
21184
21210
  function computeSuppression(depths) {
@@ -21195,8 +21221,10 @@ function computeSuppression(depths) {
21195
21221
  return keys.map((k) => (_nullishCoalesce(counts.get(k), () => ( 0))) <= 1);
21196
21222
  }
21197
21223
  var GongmunNumberer = (_class3 = class {
21198
- constructor(numbering) {;_class3.prototype.__init5.call(this);
21224
+ constructor(numbering, bullet2 = "\u25CB", press = false) {;_class3.prototype.__init5.call(this);
21199
21225
  this.numbering = numbering;
21226
+ this.bullet2 = bullet2;
21227
+ this.press = press;
21200
21228
  }
21201
21229
  __init5() {this.counts = []}
21202
21230
  /** depth 항목 하나에 대한 마커. suppress=true면 빈 문자열(부호 없음) */
@@ -21205,8 +21233,8 @@ var GongmunNumberer = (_class3 = class {
21205
21233
  const n = _nullishCoalesce(this.counts[depth], () => ( 0));
21206
21234
  this.counts[depth] = n + 1;
21207
21235
  if (suppress) return "";
21208
- if (this.numbering === "gaejosik") return gaejosikMarker(depth);
21209
- return this.numbering === "report" ? reportMarker(depth) : standardMarker(depth, n);
21236
+ if (this.numbering === "gaejosik") return gaejosikMarker(depth, this.bullet2);
21237
+ return this.numbering === "report" ? reportMarker(depth, this.bullet2, this.press) : standardMarker(depth, n);
21210
21238
  }
21211
21239
  reset() {
21212
21240
  this.counts = [];
@@ -21246,16 +21274,16 @@ var PARA_LIST = 7;
21246
21274
  var DEFAULT_TEXT_COLOR = "#000000";
21247
21275
  function resolveTheme(theme) {
21248
21276
  return {
21249
- h1: _nullishCoalesce(_optionalChain([theme, 'optionalAccess', _176 => _176.headingColors, 'optionalAccess', _177 => _177[1]]), () => ( DEFAULT_TEXT_COLOR)),
21250
- h2: _nullishCoalesce(_optionalChain([theme, 'optionalAccess', _178 => _178.headingColors, 'optionalAccess', _179 => _179[2]]), () => ( DEFAULT_TEXT_COLOR)),
21251
- h3: _nullishCoalesce(_optionalChain([theme, 'optionalAccess', _180 => _180.headingColors, 'optionalAccess', _181 => _181[3]]), () => ( DEFAULT_TEXT_COLOR)),
21252
- h4: _nullishCoalesce(_nullishCoalesce(_optionalChain([theme, 'optionalAccess', _182 => _182.headingColors, 'optionalAccess', _183 => _183[4]]), () => ( _optionalChain([theme, 'optionalAccess', _184 => _184.headingColors, 'optionalAccess', _185 => _185[3]]))), () => ( DEFAULT_TEXT_COLOR)),
21253
- body: _nullishCoalesce(_optionalChain([theme, 'optionalAccess', _186 => _186.bodyColor]), () => ( DEFAULT_TEXT_COLOR)),
21254
- quote: _nullishCoalesce(_optionalChain([theme, 'optionalAccess', _187 => _187.quoteColor]), () => ( DEFAULT_TEXT_COLOR)),
21277
+ h1: _nullishCoalesce(_optionalChain([theme, 'optionalAccess', _179 => _179.headingColors, 'optionalAccess', _180 => _180[1]]), () => ( DEFAULT_TEXT_COLOR)),
21278
+ h2: _nullishCoalesce(_optionalChain([theme, 'optionalAccess', _181 => _181.headingColors, 'optionalAccess', _182 => _182[2]]), () => ( DEFAULT_TEXT_COLOR)),
21279
+ h3: _nullishCoalesce(_optionalChain([theme, 'optionalAccess', _183 => _183.headingColors, 'optionalAccess', _184 => _184[3]]), () => ( DEFAULT_TEXT_COLOR)),
21280
+ h4: _nullishCoalesce(_nullishCoalesce(_optionalChain([theme, 'optionalAccess', _185 => _185.headingColors, 'optionalAccess', _186 => _186[4]]), () => ( _optionalChain([theme, 'optionalAccess', _187 => _187.headingColors, 'optionalAccess', _188 => _188[3]]))), () => ( DEFAULT_TEXT_COLOR)),
21281
+ body: _nullishCoalesce(_optionalChain([theme, 'optionalAccess', _189 => _189.bodyColor]), () => ( DEFAULT_TEXT_COLOR)),
21282
+ quote: _nullishCoalesce(_optionalChain([theme, 'optionalAccess', _190 => _190.quoteColor]), () => ( DEFAULT_TEXT_COLOR)),
21255
21283
  /** quoteColor가 명시되었는지 — blockquote charPr 분기에 사용 (baseline 호환) */
21256
- hasQuoteOption: _optionalChain([theme, 'optionalAccess', _188 => _188.quoteColor]) !== void 0,
21257
- tableHeader: _nullishCoalesce(_nullishCoalesce(_optionalChain([theme, 'optionalAccess', _189 => _189.tableHeaderColor]), () => ( _optionalChain([theme, 'optionalAccess', _190 => _190.bodyColor]))), () => ( DEFAULT_TEXT_COLOR)),
21258
- tableHeaderBold: !!_optionalChain([theme, 'optionalAccess', _191 => _191.tableHeaderBold])
21284
+ hasQuoteOption: _optionalChain([theme, 'optionalAccess', _191 => _191.quoteColor]) !== void 0,
21285
+ tableHeader: _nullishCoalesce(_nullishCoalesce(_optionalChain([theme, 'optionalAccess', _192 => _192.tableHeaderColor]), () => ( _optionalChain([theme, 'optionalAccess', _193 => _193.bodyColor]))), () => ( DEFAULT_TEXT_COLOR)),
21286
+ tableHeaderBold: !!_optionalChain([theme, 'optionalAccess', _194 => _194.tableHeaderBold])
21259
21287
  };
21260
21288
  }
21261
21289
  function escapeXml(text) {
@@ -21273,10 +21301,10 @@ function headingCharPrId(level) {
21273
21301
  if (level === 3) return CHAR_H3;
21274
21302
  return CHAR_H4;
21275
21303
  }
21276
- function charPr(id, height, bold, italic, fontId = 0, textColor = DEFAULT_TEXT_COLOR, ratioPct = 100, keepFontOnBold = false) {
21304
+ function charPr(id, height, bold, italic, fontId = 0, textColor = DEFAULT_TEXT_COLOR, ratioPct = 100) {
21277
21305
  const boldAttr = bold ? ` bold="1"` : "";
21278
21306
  const italicAttr = italic ? ` italic="1"` : "";
21279
- const effFont = bold && !keepFontOnBold ? 2 : fontId;
21307
+ const effFont = fontId;
21280
21308
  const boldEl = bold ? `<hh:bold/>` : "";
21281
21309
  return ` <hh:charPr id="${id}" height="${height}" textColor="${textColor}" shadeColor="none" useFontSpace="0" useKerning="0" symMark="NONE" borderFillIDRef="1"${boldAttr}${italicAttr}>
21282
21310
  <hh:fontRef hangul="${effFont}" latin="${effFont}" hanja="${effFont}" japanese="${effFont}" other="${effFont}" symbol="${effFont}" user="${effFont}"/>
@@ -21328,6 +21356,7 @@ var GJ_PARA_COVER = 21;
21328
21356
  var GJ_PARA_TOC_ITEM = 22;
21329
21357
  var GJ_PARA_CHAPTER = 23;
21330
21358
  var GJ_PARA_BAR = 24;
21359
+ var GONGMUN_LIST_PLAIN_BASE = 25;
21331
21360
  var GJ_BF_CHAPTER_NUM = 3;
21332
21361
  var GJ_BF_CHAPTER_GAP = 4;
21333
21362
  var GJ_BF_CHAPTER_TITLE = 5;
@@ -21366,9 +21395,13 @@ function newPageNumCtrl(num4 = 1) {
21366
21395
  function pageHidingCtrl(hideHeader = false) {
21367
21396
  return `<hp:ctrl><hp:pageHiding hideHeader="${hideHeader ? 1 : 0}" hideFooter="0" hideMasterPage="0" hideBorder="0" hideFill="0" hidePageNum="1"/></hp:ctrl>`;
21368
21397
  }
21398
+ var GONGMUN_TBL_CHAR = 11;
21399
+ var GONGMUN_TBL_CHAR_BOLD = 12;
21400
+ var GONGMUN_TBL_PT = 1200;
21369
21401
  var CHAR_VARIANT_BASE = 11;
21370
- function charVariantBase(gaejosik) {
21371
- return gaejosik ? CHAR_VARIANT_BASE + GJ_CHAR_COUNT : CHAR_VARIANT_BASE;
21402
+ function charVariantBase(measured, isGongmun = true) {
21403
+ if (!isGongmun) return CHAR_VARIANT_BASE;
21404
+ return measured ? 11 + GJ_CHAR_COUNT : 11 + 2;
21372
21405
  }
21373
21406
  var GONGMUN_BODY_RATIO = 95;
21374
21407
 
@@ -21616,7 +21649,7 @@ function generateManifest(chartParts = []) {
21616
21649
  </opf:package>`;
21617
21650
  }
21618
21651
  function buildCharProperties(theme, gongmun, ratioVariants = [], extraCharPrXmls = []) {
21619
- const gaejosik = _optionalChain([gongmun, 'optionalAccess', _192 => _192.preset]) === "gaejosik";
21652
+ const measured = !!gongmun && usesReportFonts(gongmun.preset);
21620
21653
  let body = 1e3, code = 900, h1 = 1800, h2 = 1400, h3 = 1200, h4 = 1100;
21621
21654
  if (gongmun) {
21622
21655
  body = gongmun.bodyHeight;
@@ -21626,7 +21659,9 @@ function buildCharProperties(theme, gongmun, ratioVariants = [], extraCharPrXmls
21626
21659
  h3 = body;
21627
21660
  h4 = Math.max(body - 100, 1300);
21628
21661
  }
21629
- const bodyFont = gaejosik ? 4 : 0;
21662
+ const bodyFont = measured ? 4 : 0;
21663
+ const hFont = measured ? 3 : 1;
21664
+ const hBold = !measured;
21630
21665
  const bodyRatio = gongmun ? GONGMUN_BODY_RATIO : 100;
21631
21666
  const rows = [
21632
21667
  charPr(0, body, false, false, bodyFont, theme.body, bodyRatio),
@@ -21634,25 +21669,31 @@ function buildCharProperties(theme, gongmun, ratioVariants = [], extraCharPrXmls
21634
21669
  charPr(2, body, false, true, bodyFont, theme.body, bodyRatio),
21635
21670
  charPr(3, body, true, true, bodyFont, theme.body, bodyRatio),
21636
21671
  charPr(4, code, false, false, 1),
21637
- charPr(5, h1, true, false, 1, theme.h1),
21638
- charPr(6, h2, true, false, 1, theme.h2),
21639
- charPr(7, h3, true, false, 1, theme.h3),
21640
- charPr(8, h4, true, false, 1, theme.h4),
21672
+ charPr(5, h1, hBold, false, hFont, theme.h1),
21673
+ charPr(6, h2, hBold, false, hFont, theme.h2),
21674
+ charPr(7, h3, hBold, false, hFont, theme.h3),
21675
+ charPr(8, h4, hBold, false, hFont, theme.h4),
21641
21676
  charPr(CHAR_TABLE_HEADER, body, theme.tableHeaderBold, false, bodyFont, theme.tableHeader),
21642
21677
  charPr(CHAR_QUOTE, body, false, true, bodyFont, theme.quote)
21643
21678
  ];
21644
- if (gaejosik) {
21679
+ if (gongmun && !measured) {
21680
+ rows.push(
21681
+ charPr(11, GONGMUN_TBL_PT, false, false, bodyFont, theme.body),
21682
+ charPr(12, GONGMUN_TBL_PT, true, false, bodyFont, theme.body)
21683
+ );
21684
+ }
21685
+ if (measured) {
21645
21686
  const sz = gaejosikSizes(body, gongmun.sizes);
21646
21687
  rows.push(
21647
21688
  charPr(11, sz.dae, false, false, 3),
21648
21689
  // □ HY헤드라인M
21649
- charPr(12, sz.dae, true, false, 3, "#000000", 100, true),
21690
+ charPr(12, sz.dae, true, false, 3),
21650
21691
  // □ bold
21651
21692
  charPr(13, sz.cham, false, false, 5),
21652
21693
  // ※ 한양중고딕
21653
- charPr(14, sz.cham, true, false, 5, "#000000", 100, true),
21694
+ charPr(14, sz.cham, true, false, 5),
21654
21695
  // ※ bold
21655
- charPr(15, sz.chapter, true, false, 4, "#FFFFFF", 100, true),
21696
+ charPr(15, sz.chapter, true, false, 4, "#FFFFFF"),
21656
21697
  // 장 로마숫자(흰)
21657
21698
  charPr(16, sz.chapter, false, false, 3),
21658
21699
  // 장 제목
@@ -21660,15 +21701,15 @@ function buildCharProperties(theme, gongmun, ratioVariants = [], extraCharPrXmls
21660
21701
  // 표지 제목
21661
21702
  charPr(18, sz.coverSub, false, false, 3),
21662
21703
  // 표지 날짜·기관명
21663
- charPr(19, sz.tocLabel, true, false, 3, "#000000", 100, true),
21704
+ charPr(19, sz.tocLabel, true, false, 3),
21664
21705
  // 목 차
21665
- charPr(20, sz.tocRoman, true, false, 6, "#000000", 100, true),
21706
+ charPr(20, sz.tocRoman, true, false, 6),
21666
21707
  // 목차 로마숫자(한양신명조)
21667
21708
  charPr(21, sz.tocItem, false, false, 3),
21668
21709
  // 목차 항목
21669
21710
  charPr(22, sz.table, false, false, 7),
21670
21711
  // 표 셀(맑은 고딕 12pt)
21671
- charPr(23, sz.table, true, false, 7, "#000000", 100, true),
21712
+ charPr(23, sz.table, true, false, 7),
21672
21713
  // 표 셀 bold
21673
21714
  charPr(24, sz.bar, false, false, 4),
21674
21715
  // 표지 바 셀 빈 문단(6pt)
@@ -21707,10 +21748,11 @@ ${base2.join("\n")}
21707
21748
  }
21708
21749
  const ls = gongmun.lineSpacing;
21709
21750
  const titleAlign = gongmun.centerTitle ? "CENTER" : "LEFT";
21751
+ const h2Geom = gongmun.h2Marker !== "none" ? { spaceBefore: Math.round(gongmun.bodyHeight * 2), spaceAfter: 0, indent: -markerWidth(gongmun.h2Marker === "box" ? "\u25A1" : "1.", 1600) } : { spaceBefore: 600, spaceAfter: 150 };
21710
21752
  const base = [
21711
21753
  paraPr(0, { lineSpacing: ls, keepWord: true }),
21712
21754
  paraPr(1, { align: titleAlign, spaceBefore: 400, spaceAfter: 400, lineSpacing: ls, keepWord: true }),
21713
- paraPr(2, { align: "LEFT", spaceBefore: 600, spaceAfter: 150, lineSpacing: ls, keepWord: true }),
21755
+ paraPr(2, { align: "LEFT", ...h2Geom, lineSpacing: ls, keepWord: true }),
21714
21756
  paraPr(3, { align: "LEFT", spaceBefore: 400, spaceAfter: 100, lineSpacing: ls, keepWord: true }),
21715
21757
  paraPr(4, { align: "LEFT", spaceBefore: 300, spaceAfter: 100, lineSpacing: ls, keepWord: true }),
21716
21758
  paraPr(5, { align: "LEFT", lineSpacing: 130, indent: 400, keepWord: true }),
@@ -21718,16 +21760,16 @@ ${base2.join("\n")}
21718
21760
  paraPr(7, { align: "LEFT", lineSpacing: ls, indent: 600, keepWord: true })
21719
21761
  ];
21720
21762
  for (let d = 0; d < GONGMUN_LIST_LEVELS; d++) {
21721
- const { left, indent } = levelIndent(d, gongmun.bodyHeight, gongmun.numbering, gongmun.sizes);
21722
- const sectionGap = gongmun.numbering === "gaejosik" ? gaejosikSpaceBefore(d, gongmun.bodyHeight) : gongmun.numbering === "report" && d === 0 ? Math.round(gongmun.bodyHeight * 0.5) : 0;
21723
- const keepNext = gongmun.numbering === "gaejosik" && d === 0;
21763
+ const { left, indent } = levelIndent(d, gongmun.bodyHeight, gongmun.numbering, gongmun.sizes, gongmun.bullet2, gongmun.preset === "press");
21764
+ const sectionGap = gongmun.numbering === "gaejosik" || gongmun.numbering === "report" ? gaejosikSpaceBefore(d, gongmun.bodyHeight) : 0;
21765
+ const keepNext = (gongmun.numbering === "gaejosik" || gongmun.numbering === "report") && d === 0;
21724
21766
  base.push(paraPr(GONGMUN_LIST_BASE + d, { align: "JUSTIFY", lineSpacing: ls, left, indent, spaceBefore: sectionGap, keepWord: true, keepWithNext: keepNext }));
21725
21767
  }
21726
21768
  base.push(paraPr(GONGMUN_CENTER, { align: "CENTER", lineSpacing: ls, keepWord: true }));
21727
21769
  base.push(paraPr(GONGMUN_RIGHT, { align: "RIGHT", lineSpacing: ls, keepWord: true }));
21728
21770
  base.push(paraPr(GONGMUN_TBL_CENTER, { align: "CENTER", lineSpacing: 130, keepWord: true }));
21729
21771
  base.push(paraPr(GONGMUN_TBL_LEFT, { align: "LEFT", lineSpacing: 130, keepWord: true }));
21730
- if (gongmun.preset === "gaejosik") {
21772
+ {
21731
21773
  const cham = gaejosikChamIndent(gongmun.bodyHeight, gongmun.sizes);
21732
21774
  const toc = gaejosikTocItemIndent(gongmun.bodyHeight, gongmun.sizes);
21733
21775
  base.push(
@@ -21740,6 +21782,11 @@ ${base2.join("\n")}
21740
21782
  paraPr(GJ_PARA_BAR, { align: "CENTER", lineSpacing: 70, keepWord: true })
21741
21783
  );
21742
21784
  }
21785
+ for (let d = 0; d < GONGMUN_LIST_LEVELS; d++) {
21786
+ const { left } = levelIndent(d, gongmun.bodyHeight, gongmun.numbering, gongmun.sizes, gongmun.bullet2, gongmun.preset === "press");
21787
+ const sectionGap = gongmun.numbering === "gaejosik" || gongmun.numbering === "report" ? gaejosikSpaceBefore(d, gongmun.bodyHeight) : 0;
21788
+ base.push(paraPr(GONGMUN_LIST_PLAIN_BASE + d, { align: "JUSTIFY", lineSpacing: ls, left, indent: 0, spaceBefore: sectionGap, keepWord: true }));
21789
+ }
21743
21790
  return `<hh:paraProperties itemCnt="${base.length}">
21744
21791
  ${base.join("\n")}
21745
21792
  </hh:paraProperties>`;
@@ -21761,14 +21808,15 @@ function fontEntry(id, face, weight = 6) {
21761
21808
  </hh:font>`;
21762
21809
  }
21763
21810
  function buildFontFaces(gongmun, bodyFace) {
21764
- if (_optionalChain([gongmun, 'optionalAccess', _193 => _193.preset]) === "gaejosik") {
21811
+ if (gongmun && usesReportFonts(gongmun.preset)) {
21765
21812
  const ov = gongmun.fonts;
21813
+ const bodyDefault = gongmun.preset !== "gaejosik" && gongmun.bodyFont === "gothic" ? "\uB9D1\uC740 \uACE0\uB515" : "\uD734\uBA3C\uBA85\uC870";
21766
21814
  const faces = [
21767
21815
  "\uD568\uCD08\uB86C\uBC14\uD0D5",
21768
21816
  "\uD568\uCD08\uB86C\uB3CB\uC6C0",
21769
21817
  "HY\uACAC\uACE0\uB515",
21770
21818
  _nullishCoalesce(ov.heading, () => ( "HY\uD5E4\uB4DC\uB77C\uC778M")),
21771
- _nullishCoalesce(ov.body, () => ( "\uD734\uBA3C\uBA85\uC870")),
21819
+ _nullishCoalesce(ov.body, () => ( bodyDefault)),
21772
21820
  _nullishCoalesce(ov.ref, () => ( "\uD55C\uC591\uC911\uACE0\uB515")),
21773
21821
  "\uD55C\uC591\uC2E0\uBA85\uC870",
21774
21822
  _nullishCoalesce(ov.table, () => ( "\uB9D1\uC740 \uACE0\uB515"))
@@ -21821,7 +21869,7 @@ function buildBorderFills(gongmun, extra = []) {
21821
21869
  borderFillEntry(1, {}),
21822
21870
  borderFillEntry(2, { l: thin, r: thin, t: thin, b: thin })
21823
21871
  ];
21824
- if (_optionalChain([gongmun, 'optionalAccess', _194 => _194.preset]) === "gaejosik") {
21872
+ if (_optionalChain([gongmun, 'optionalAccess', _195 => _195.preset]) === "gaejosik") {
21825
21873
  const c = GAEJOSIK_COLORS;
21826
21874
  const edge = ["0.12 mm", c.border];
21827
21875
  const grayLine = ["0.1 mm", c.titleLine];
@@ -21865,7 +21913,7 @@ function buildStyles(gongmun) {
21865
21913
  </hh:styles>`;
21866
21914
  }
21867
21915
  function generateHeaderXml(theme, gongmun, ratioVariants = [], extraBorderFills = [], extraCharPrXmls = []) {
21868
- const bodyFace = _nullishCoalesce(_optionalChain([gongmun, 'optionalAccess', _195 => _195.fonts, 'access', _196 => _196.body]), () => ( (_optionalChain([gongmun, 'optionalAccess', _197 => _197.bodyFont]) === "gothic" ? "\uB9D1\uC740 \uACE0\uB515" : "\uD568\uCD08\uB86C\uBC14\uD0D5")));
21916
+ const bodyFace = _nullishCoalesce(_optionalChain([gongmun, 'optionalAccess', _196 => _196.fonts, 'access', _197 => _197.body]), () => ( (_optionalChain([gongmun, 'optionalAccess', _198 => _198.bodyFont]) === "gothic" ? "\uB9D1\uC740 \uACE0\uB515" : "\uD568\uCD08\uB86C\uBC14\uD0D5")));
21869
21917
  const charPropsXml = buildCharProperties(theme, gongmun, ratioVariants, extraCharPrXmls);
21870
21918
  const paraPropsXml = buildParaProperties(gongmun);
21871
21919
  return `<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
@@ -21995,8 +22043,8 @@ function parseChartFence(text) {
21995
22043
  const spec = chartSpec(type);
21996
22044
  let finalSeries = spec.pie ? [series[0]] : series;
21997
22045
  finalSeries = finalSeries.map((s) => ({ ...s }));
21998
- const ptLen = Math.max(_nullishCoalesce(_optionalChain([cat, 'optionalAccess', _198 => _198.length]), () => ( 0)), ...finalSeries.map((s) => s.values.length));
21999
- const catFinal = Array.from({ length: ptLen }, (_, i) => _nullishCoalesce(_optionalChain([cat, 'optionalAccess', _199 => _199[i]]), () => ( `\uD56D\uBAA9 ${i + 1}`)));
22046
+ const ptLen = Math.max(_nullishCoalesce(_optionalChain([cat, 'optionalAccess', _199 => _199.length]), () => ( 0)), ...finalSeries.map((s) => s.values.length));
22047
+ const catFinal = Array.from({ length: ptLen }, (_, i) => _nullishCoalesce(_optionalChain([cat, 'optionalAccess', _200 => _200[i]]), () => ( `\uD56D\uBAA9 ${i + 1}`)));
22000
22048
  if (!spec.scatter) {
22001
22049
  finalSeries = finalSeries.map((s) => ({ ...s, values: catFinal.map((_, i) => _nullishCoalesce(s.values[i], () => ( 0))) }));
22002
22050
  }
@@ -22038,7 +22086,7 @@ function serSpPr(color, stroke) {
22038
22086
  return stroke ? `<c:spPr><a:ln w="28575" cap="flat" cmpd="sng" algn="ctr">${f}<a:prstDash val="solid"/><a:round/></a:ln></c:spPr>` : `<c:spPr>${f}</c:spPr>`;
22039
22087
  }
22040
22088
  function dPtXml(pointColors, pie) {
22041
- if (!_optionalChain([pointColors, 'optionalAccess', _200 => _200.length])) return "";
22089
+ if (!_optionalChain([pointColors, 'optionalAccess', _201 => _201.length])) return "";
22042
22090
  return pointColors.map((col, i) => {
22043
22091
  const f = chartColorFill(col);
22044
22092
  if (!f) return "";
@@ -22118,7 +22166,9 @@ function computeGongmunFitPlan(blocks, gongmun, gongmunList) {
22118
22166
  if (gongmun.numbering === "gaejosik" && (depth === 0 || (block.text || "").trimStart().startsWith("\u203B"))) continue;
22119
22167
  const content = plainRenderText(block.text || "");
22120
22168
  text = marker ? `${marker} ${content}` : content;
22121
- const { left, indent } = levelIndent(depth, gongmun.bodyHeight, gongmun.numbering);
22169
+ const li = levelIndent(depth, gongmun.bodyHeight, gongmun.numbering, gongmun.sizes, gongmun.bullet2, gongmun.preset === "press");
22170
+ const left = li.left;
22171
+ const indent = marker ? li.indent : 0;
22122
22172
  firstW = pageW - left - Math.max(indent, 0);
22123
22173
  contW = pageW - left - Math.max(-indent, 0);
22124
22174
  } else if (block.type === "paragraph") {
@@ -22146,7 +22196,7 @@ function variantMapper(fit, blockIdx, base = CHAR_VARIANT_BASE) {
22146
22196
  }
22147
22197
  function precomputeGongmunList(blocks, gongmun) {
22148
22198
  const result = /* @__PURE__ */ new Map();
22149
- const depthOffset = gongmun.numbering === "gaejosik" && blocks.some((b) => b.type === "heading" && b.level === 3) ? 1 : 0;
22199
+ const depthOffset = gongmun.numbering === "gaejosik" && blocks.some((b) => b.type === "heading" && b.level === 3) || gongmun.numbering === "standard" && gongmun.h2Marker === "number" && blocks.some((b) => b.type === "heading" && b.level === 2) ? 1 : 0;
22150
22200
  let i = 0;
22151
22201
  while (i < blocks.length) {
22152
22202
  if (blocks[i].type !== "list_item") {
@@ -22173,8 +22223,8 @@ function precomputeGongmunList(blocks, gongmun) {
22173
22223
  break;
22174
22224
  }
22175
22225
  const depths = run.map((bi) => Math.min(Math.max((blocks[bi].indent || 0) + depthOffset, 0), GONGMUN_LIST_LEVELS - 1));
22176
- const suppress = gongmun.numbering === "standard" ? computeSuppression(depths) : depths.map(() => false);
22177
- const numberer = new GongmunNumberer(gongmun.numbering);
22226
+ const suppress = gongmun.suppressSingle && gongmun.numbering === "standard" ? computeSuppression(depths) : depths.map(() => false);
22227
+ const numberer = new GongmunNumberer(gongmun.numbering, gongmun.bullet2, gongmun.preset === "press");
22178
22228
  run.forEach((bi, k) => {
22179
22229
  const marker = numberer.next(depths[k], suppress[k]);
22180
22230
  result.set(bi, { marker, depth: depths[k] });
@@ -22204,7 +22254,8 @@ function cell(opts) {
22204
22254
  return `<hp:tc name="" header="0" hasMargin="0" protect="0" editable="1" dirty="0" borderFillIDRef="${opts.bf}"><hp:subList id="" textDirection="HORIZONTAL" lineWrap="BREAK" vertAlign="${_nullishCoalesce(opts.vertAlign, () => ( "CENTER"))}" linkListIDRef="0" linkListNextIDRef="0" textWidth="0" textHeight="0" hasTextRef="0" hasNumRef="0">${paras}</hp:subList><hp:cellAddr colAddr="${opts.col}" rowAddr="${_nullishCoalesce(opts.row, () => ( 0))}"/><hp:cellSpan colSpan="${_nullishCoalesce(opts.colSpan, () => ( 1))}" rowSpan="1"/><hp:cellSz width="${opts.w}" height="${opts.h}"/><hp:cellMargin left="141" right="141" top="141" bottom="141"/></hp:tc>`;
22205
22255
  }
22206
22256
  function table(rows, w, h, cols, tblBf = 1) {
22207
- return `<hp:tbl id="${++gjTableId}" zOrder="0" numberingType="TABLE" textWrap="TOP_AND_BOTTOM" textFlow="BOTH_SIDES" lock="0" dropcapstyle="None" pageBreak="CELL" repeatHeader="0" rowCnt="${rows.length}" colCnt="${cols}" cellSpacing="0" borderFillIDRef="${tblBf}" noAdjust="1"><hp:sz width="${w}" widthRelTo="ABSOLUTE" height="${h}" heightRelTo="ABSOLUTE" protect="0"/><hp:pos treatAsChar="1" affectLSpacing="0" flowWithText="1" allowOverlap="0" holdAnchorAndSO="0" vertRelTo="PARA" horzRelTo="PARA" vertAlign="TOP" horzAlign="LEFT" vertOffset="0" horzOffset="0"/><hp:outMargin left="283" right="283" top="283" bottom="283"/><hp:inMargin left="141" right="141" top="141" bottom="141"/>` + rows.map((r) => `<hp:tr>${r}</hp:tr>`).join("") + `</hp:tbl>`;
22257
+ const outLR = w + 566 > 48e3 ? 0 : 283;
22258
+ return `<hp:tbl id="${++gjTableId}" zOrder="0" numberingType="TABLE" textWrap="TOP_AND_BOTTOM" textFlow="BOTH_SIDES" lock="0" dropcapstyle="None" pageBreak="CELL" repeatHeader="0" rowCnt="${rows.length}" colCnt="${cols}" cellSpacing="0" borderFillIDRef="${tblBf}" noAdjust="1"><hp:sz width="${w}" widthRelTo="ABSOLUTE" height="${h}" heightRelTo="ABSOLUTE" protect="0"/><hp:pos treatAsChar="1" affectLSpacing="0" flowWithText="1" allowOverlap="0" holdAnchorAndSO="0" vertRelTo="PARA" horzRelTo="PARA" vertAlign="TOP" horzAlign="LEFT" vertOffset="0" horzOffset="0"/><hp:outMargin left="${outLR}" right="${outLR}" top="283" bottom="283"/><hp:inMargin left="141" right="141" top="141" bottom="141"/>` + rows.map((r) => `<hp:tr>${r}</hp:tr>`).join("") + `</hp:tbl>`;
22208
22259
  }
22209
22260
  function buildGaejosikCover(title, gongmun) {
22210
22261
  const g = coverGeom(gongmun.bodyHeight, gongmun.sizes);
@@ -22218,8 +22269,8 @@ function buildGaejosikCover(title, gongmun) {
22218
22269
  const botRow = cell({ bf: GJ_BF_BAR_DARK, col: 0, row: 2, w: g.botDarkW, h: g.botBarH, paras: barEmpty }) + cell({ bf: GJ_BF_BAR_LIGHT, col: 1, colSpan: 2, row: 2, w: g.botLightW, h: g.botBarH, paras: barEmpty });
22219
22270
  const tbl2 = table([topRow, titleRow, botRow], g.totalW, g.barH + g.titleH + g.botBarH, 3);
22220
22271
  const host = `<hp:p paraPrIDRef="${PARA_NORMAL}" styleIDRef="0"><hp:run charPrIDRef="${CHAR_NORMAL}">${tbl2}</hp:run></hp:p>`;
22221
- const date = _nullishCoalesce(_optionalChain([gongmun, 'access', _201 => _201.cover, 'optionalAccess', _202 => _202.date]), () => ( formatGaejosikDate(/* @__PURE__ */ new Date())));
22222
- const org = _nullishCoalesce(_optionalChain([gongmun, 'access', _203 => _203.cover, 'optionalAccess', _204 => _204.org]), () => ( ""));
22272
+ const date = _nullishCoalesce(_optionalChain([gongmun, 'access', _202 => _202.cover, 'optionalAccess', _203 => _203.date]), () => ( formatGaejosikDate(/* @__PURE__ */ new Date())));
22273
+ const org = _nullishCoalesce(_optionalChain([gongmun, 'access', _204 => _204.cover, 'optionalAccess', _205 => _205.org]), () => ( ""));
22223
22274
  const sub = (t) => `<hp:p paraPrIDRef="${GJ_PARA_COVER}" styleIDRef="0"><hp:run charPrIDRef="${GJ_CHAR_COVER_SUB}"><hp:t>${escapeXml(t)}</hp:t></hp:run></hp:p>`;
22224
22275
  const subEmpty = emptyPara(GJ_PARA_COVER, false, GJ_CHAR_COVER_SUB);
22225
22276
  return [
@@ -22452,7 +22503,7 @@ function escapeGfm(text) {
22452
22503
  }
22453
22504
  var HWP_SHAPE_ALT_TEXT_RE = /(?:모서리가 둥근 |둥근 )?(?:사각형|직사각형|정사각형|원|타원|삼각형|이등변 삼각형|직각 삼각형|선|직선|곡선|화살표|굵은 화살표|이중 화살표|오각형|육각형|팔각형|별|[4-8]점별|십자|십자형|구름|구름형|마름모|도넛|평행사변형|사다리꼴|부채꼴|호|반원|물결|번개|하트|빗금|블록 화살표|수식|표|그림|개체|그리기\s?개체|묶음\s?개체|글상자|수식\s?개체|OLE\s?개체)\s?입니다\.?/g;
22454
22505
  function sanitizeText(text) {
22455
- let result = _chunkEBSCV3JCcjs.mapPuaText.call(void 0, text).replace(/[\u{F0000}-\u{FFFFD}]/gu, "").replace(HWP_SHAPE_ALT_TEXT_RE, "").replace(/ +/g, " ").trim();
22506
+ let result = _chunkWN7LZHIIcjs.mapPuaText.call(void 0, text).replace(/[\u{F0000}-\u{FFFFD}]/gu, "").replace(HWP_SHAPE_ALT_TEXT_RE, "").replace(/ +/g, " ").trim();
22456
22507
  if (result.length <= 30 && result.includes(" ")) {
22457
22508
  const tokens = result.split(" ");
22458
22509
  const koreanSingleCharCount = tokens.filter((t) => t.length === 1 && /[가-힯ㄱ-ㆎ]/.test(t)).length;
@@ -22482,7 +22533,7 @@ function replicateGfmTable(table2) {
22482
22533
  for (let r = 0; r < numRows; r++) {
22483
22534
  for (let c = 0; c < numCols; c++) {
22484
22535
  if (skip.has(`${r},${c}`)) continue;
22485
- const cell2 = _optionalChain([cells, 'access', _205 => _205[r], 'optionalAccess', _206 => _206[c]]);
22536
+ const cell2 = _optionalChain([cells, 'access', _206 => _206[r], 'optionalAccess', _207 => _207[c]]);
22486
22537
  if (!cell2) continue;
22487
22538
  display[r][c] = {
22488
22539
  text: escapeGfm(sanitizeText(cell2.text)).replace(/\|/g, "\\|").replace(/\n/g, "<br>"),
@@ -22536,7 +22587,7 @@ function unescapeGfmCell(text) {
22536
22587
  return text.replace(/<br\s*\/?>/gi, "\n").replace(/\\\|/g, "|").replace(/\\([~*])/g, "$1");
22537
22588
  }
22538
22589
  function replicateCellInnerHtml(cell2) {
22539
- if (_optionalChain([cell2, 'access', _207 => _207.blocks, 'optionalAccess', _208 => _208.length])) {
22590
+ if (_optionalChain([cell2, 'access', _208 => _208.blocks, 'optionalAccess', _209 => _209.length])) {
22540
22591
  return cell2.blocks.map((b) => {
22541
22592
  if (b.type === "table" && b.table) {
22542
22593
  const cap = b.table.caption ? sanitizeText(b.table.caption) : "";
@@ -22575,7 +22626,7 @@ function replicateHtmlTable(table2) {
22575
22626
  const rowCells = [];
22576
22627
  for (let c = 0; c < numCols; c++) {
22577
22628
  if (skip.has(`${r},${c}`)) continue;
22578
- const cell2 = _optionalChain([cells, 'access', _209 => _209[r], 'optionalAccess', _210 => _210[c]]);
22629
+ const cell2 = _optionalChain([cells, 'access', _210 => _210[r], 'optionalAccess', _211 => _211[c]]);
22579
22630
  if (!cell2) continue;
22580
22631
  for (let dr = 0; dr < cell2.rowSpan; dr++) {
22581
22632
  for (let dc = 0; dc < cell2.colSpan; dc++) {
@@ -22621,8 +22672,8 @@ function parseHtmlTable(raw) {
22621
22672
  }
22622
22673
  } else {
22623
22674
  if (!isClose) {
22624
- const cs = parseInt(_optionalChain([attrs, 'access', _211 => _211.match, 'call', _212 => _212(/colspan\s*=\s*"(\d+)"/i), 'optionalAccess', _213 => _213[1]]) || "1", 10);
22625
- const rs = parseInt(_optionalChain([attrs, 'access', _214 => _214.match, 'call', _215 => _215(/rowspan\s*=\s*"(\d+)"/i), 'optionalAccess', _216 => _216[1]]) || "1", 10);
22675
+ const cs = parseInt(_optionalChain([attrs, 'access', _212 => _212.match, 'call', _213 => _213(/colspan\s*=\s*"(\d+)"/i), 'optionalAccess', _214 => _214[1]]) || "1", 10);
22676
+ const rs = parseInt(_optionalChain([attrs, 'access', _215 => _215.match, 'call', _216 => _216(/rowspan\s*=\s*"(\d+)"/i), 'optionalAccess', _217 => _217[1]]) || "1", 10);
22626
22677
  cellStart = m.index + m[0].length;
22627
22678
  cellInfo = { colSpan: isNaN(cs) ? 1 : cs, rowSpan: isNaN(rs) ? 1 : rs };
22628
22679
  } else if (cellStart >= 0 && cellInfo && currentRow) {
@@ -22767,7 +22818,7 @@ function edgeXml(tag, d) {
22767
22818
  return d ? `<hh:${tag} type="${d.type}" width="${d.width}" color="${d.color}"/>` : `<hh:${tag} type="NONE" width="0.1 mm" color="#000000"/>`;
22768
22819
  }
22769
22820
  function borderFillDefToXml(id, def) {
22770
- const fill = _optionalChain([def, 'access', _217 => _217.fill, 'optionalAccess', _218 => _218.faceColor]) ? `<hh:fillBrush><hh:winBrush faceColor="${def.fill.faceColor}" hatchColor="#000000" alpha="0"/></hh:fillBrush>` : "";
22821
+ const fill = _optionalChain([def, 'access', _218 => _218.fill, 'optionalAccess', _219 => _219.faceColor]) ? `<hh:fillBrush><hh:winBrush faceColor="${def.fill.faceColor}" hatchColor="#000000" alpha="0"/></hh:fillBrush>` : "";
22771
22822
  return ` <hh:borderFill id="${id}" threeD="0" shadow="0" centerLine="NONE" breakCellSeparateLine="0">
22772
22823
  <hh:slash type="NONE" Crooked="0" isCounter="0"/>
22773
22824
  <hh:backSlash type="NONE" Crooked="0" isCounter="0"/>
@@ -22867,7 +22918,7 @@ function profileColWidths(tp, colCnt) {
22867
22918
  if (tp.width) return Array(colCnt).fill(Math.floor(tp.width / colCnt));
22868
22919
  return null;
22869
22920
  }
22870
- var CELL_PAD = 582;
22921
+ var CELL_PAD = 1200;
22871
22922
  function cellContentWidth(text, charHeight) {
22872
22923
  let max = 0;
22873
22924
  for (const seg of text.replace(/\*\*|__|`/g, "").split(/<br\s*\/?>/i)) {
@@ -22876,35 +22927,51 @@ function cellContentWidth(text, charHeight) {
22876
22927
  }
22877
22928
  return max;
22878
22929
  }
22879
- function computeColWidths(colMax, totalWidth) {
22930
+ function cellMinWordWidth(text, charHeight) {
22931
+ let max = 0;
22932
+ for (const seg of text.replace(/\*\*|__|`/g, "").split(/<br\s*\/?>/i)) {
22933
+ for (const word of seg.trim().split(/\s+/)) {
22934
+ const w = measureTextWidth(word, charHeight, 100);
22935
+ if (w > max) max = w;
22936
+ }
22937
+ }
22938
+ return max;
22939
+ }
22940
+ function computeColWidths(colMax, totalWidth, colMinWord = []) {
22880
22941
  const colCnt = colMax.length;
22881
22942
  const minW = Math.min(Math.max(2e3, Math.round(totalWidth * 0.06)), Math.floor(totalWidth / colCnt));
22882
22943
  const cap = Math.round(totalWidth * 0.8);
22883
22944
  const raw = colMax.map((w) => Math.min(Math.max(w + CELL_PAD, minW), cap));
22945
+ const floor = raw.map((r, i) => Math.min(Math.max(minW, (_nullishCoalesce(colMinWord[i], () => ( 0))) + CELL_PAD), r, cap));
22884
22946
  const widths = Array(colCnt).fill(0);
22885
22947
  const free = new Set(raw.map((_, i) => i));
22886
22948
  let budget = totalWidth;
22887
- const evenShare = Math.floor(totalWidth / colCnt);
22888
- for (let i = 0; i < colCnt; i++) {
22889
- const fixed = Math.min(Math.round(raw[i] * 1.12), evenShare);
22890
- if (raw[i] <= evenShare && free.size > 1) {
22891
- widths[i] = fixed;
22892
- free.delete(i);
22893
- budget -= fixed;
22894
- }
22895
- }
22896
- if (free.size === 0) {
22949
+ let sumFloorFree = floor.reduce((a, b) => a + b, 0);
22950
+ for (const i of [...raw.keys()].sort((a, b) => raw[a] - raw[b])) {
22951
+ if (free.size <= 1) break;
22952
+ const fixed = Math.round(raw[i] * 1.12);
22953
+ if (budget - fixed < sumFloorFree - floor[i]) break;
22954
+ widths[i] = fixed;
22955
+ free.delete(i);
22956
+ budget -= fixed;
22957
+ sumFloorFree -= floor[i];
22958
+ }
22959
+ const sumFreeRaw = [...free].reduce((a, i) => a + raw[i], 0);
22960
+ if (budget > sumFreeRaw * 1.6) {
22897
22961
  const sumRaw = raw.reduce((a, b) => a + b, 0);
22898
- for (let i = 0; i < colCnt; i++) widths[i] += Math.floor(raw[i] / sumRaw * (totalWidth - sumRaw));
22962
+ for (let i = 0; i < colCnt; i++) widths[i] = raw[i] + Math.floor(raw[i] / sumRaw * (totalWidth - sumRaw));
22963
+ free.clear();
22899
22964
  } else {
22900
22965
  for (; ; ) {
22901
22966
  const sum2 = [...free].reduce((a, i) => a + raw[i], 0);
22902
- const short = [...free].filter((i) => raw[i] / sum2 * budget < minW);
22967
+ const short = [...free].filter((i) => raw[i] / sum2 * budget < floor[i]);
22903
22968
  if (short.length === 0) break;
22969
+ const shortSum = short.reduce((a, i) => a + floor[i], 0);
22970
+ const scale = Math.min(1, (budget - (free.size - short.length) * minW) / shortSum);
22904
22971
  for (const i of short) {
22905
- widths[i] = minW;
22972
+ widths[i] = Math.max(minW, Math.floor(floor[i] * scale));
22906
22973
  free.delete(i);
22907
- budget -= minW;
22974
+ budget -= widths[i];
22908
22975
  }
22909
22976
  if (free.size === 0) break;
22910
22977
  }
@@ -22931,18 +22998,21 @@ function estimateRowHeight(cells, widths, charHeight) {
22931
22998
  function generateTable(rows, theme, style = null, remap = null, seq = 0) {
22932
22999
  const rowCnt = rows.length;
22933
23000
  const colCnt = Math.max(...rows.map((r) => r.length), 1);
22934
- const reg = _nullishCoalesce(_optionalChain([style, 'optionalAccess', _219 => _219.bfRegistry]), () => ( null));
23001
+ const reg = _nullishCoalesce(_optionalChain([style, 'optionalAccess', _220 => _220.bfRegistry]), () => ( null));
22935
23002
  const totalW = style ? reg ? style.totalWidth - DATA_TABLE_INSET : style.totalWidth : 44e3;
22936
- const measureH = _nullishCoalesce(_optionalChain([style, 'optionalAccess', _220 => _220.charHeight]), () => ( 1e3));
22937
- const prof = takeProfile(remap, rowCnt, colCnt, anchorOfMarkdownCell(_nullishCoalesce(_optionalChain([rows, 'access', _221 => _221[0], 'optionalAccess', _222 => _222[0]]), () => ( ""))), seq);
23003
+ const measureH = _nullishCoalesce(_optionalChain([style, 'optionalAccess', _221 => _221.charHeight]), () => ( 1e3));
23004
+ const prof = takeProfile(remap, rowCnt, colCnt, anchorOfMarkdownCell(_nullishCoalesce(_optionalChain([rows, 'access', _222 => _222[0], 'optionalAccess', _223 => _223[0]]), () => ( ""))), seq);
22938
23005
  const colMax = Array(colCnt).fill(0);
22939
23006
  const colMaxBody = Array(colCnt).fill(0);
23007
+ const colMinWord = Array(colCnt).fill(0);
22940
23008
  rows.forEach((row, r) => row.forEach((cell2, c) => {
22941
23009
  const w = cellContentWidth(cell2, measureH);
22942
23010
  if (w > colMax[c]) colMax[c] = w;
22943
23011
  if (r > 0 && w > colMaxBody[c]) colMaxBody[c] = w;
23012
+ const mw = cellMinWordWidth(cell2, measureH);
23013
+ if (mw > colMinWord[c]) colMinWord[c] = mw;
22944
23014
  }));
22945
- const colWidths = _nullishCoalesce(profileColWidths(prof, colCnt), () => ( computeColWidths(colMax, totalW)));
23015
+ const colWidths = _nullishCoalesce(profileColWidths(prof, colCnt), () => ( computeColWidths(colMax, totalW, colMinWord)));
22946
23016
  const colCentered = colWidths.map((w, c) => colMaxBody[c] + CELL_PAD <= w);
22947
23017
  const labelCol0 = !!reg && colCnt === 2 && colCentered[0] && rows.every((r) => (_nullishCoalesce(r[0], () => ( ""))).replace(/\*\*|__|`/g, "").length <= 12);
22948
23018
  const tblId = nextTableId();
@@ -22959,14 +23029,14 @@ function generateTable(rows, theme, style = null, remap = null, seq = 0) {
22959
23029
  const k = `${rowIdx},${colIdx}`;
22960
23030
  const isLabelCell2 = labelCol0 && colIdx === 0;
22961
23031
  const defaultCharPr = style ? reg && (isHeaderRow || isLabelCell2) ? style.boldCharPr : style.charPr : isHeaderRow ? headerCharPr : baseCharPr;
22962
- const cellCharPr = _nullishCoalesce(_optionalChain([prof, 'optionalAccess', _223 => _223.cellChar, 'access', _224 => _224.get, 'call', _225 => _225(k)]), () => ( defaultCharPr));
23032
+ const cellCharPr = _nullishCoalesce(_optionalChain([prof, 'optionalAccess', _224 => _224.cellChar, 'access', _225 => _225.get, 'call', _226 => _226(k)]), () => ( defaultCharPr));
22963
23033
  const centered = isHeaderRow || colCentered[colIdx];
22964
23034
  const paraPrId = style ? centered ? _nullishCoalesce(style.tblCenterParaPr, () => ( style.centerParaPr)) : reg ? _nullishCoalesce(style.tblLeftParaPr, () => ( PARA_NORMAL)) : PARA_NORMAL : PARA_NORMAL;
22965
23035
  const p = cell2.split(/<br\s*\/?>/i).map((seg) => {
22966
- const runs = generateRuns(seg, cellCharPr, _optionalChain([prof, 'optionalAccess', _226 => _226.cellChar, 'access', _227 => _227.has, 'call', _228 => _228(k)]) ? void 0 : mapId);
23036
+ const runs = generateRuns(seg, cellCharPr, _optionalChain([prof, 'optionalAccess', _227 => _227.cellChar, 'access', _228 => _228.has, 'call', _229 => _229(k)]) ? void 0 : mapId);
22967
23037
  return `<hp:p paraPrIDRef="${paraPrId}" styleIDRef="0">${runs || `<hp:run charPrIDRef="${cellCharPr}"><hp:t></hp:t></hp:run>`}</hp:p>`;
22968
23038
  }).join("");
22969
- const bf = _nullishCoalesce(_optionalChain([prof, 'optionalAccess', _229 => _229.cellBf, 'access', _230 => _230.get, 'call', _231 => _231(k)]), () => ( (reg ? reg.get(dataCellSpec({
23039
+ const bf = _nullishCoalesce(_optionalChain([prof, 'optionalAccess', _230 => _230.cellBf, 'access', _231 => _231.get, 'call', _232 => _232(k)]), () => ( (reg ? reg.get(dataCellSpec({
22970
23040
  row: rowIdx,
22971
23041
  rowEnd: rowIdx,
22972
23042
  col: colIdx,
@@ -22976,7 +23046,7 @@ function generateTable(rows, theme, style = null, remap = null, seq = 0) {
22976
23046
  headerRows: 1,
22977
23047
  fill: isHeaderRow ? _nullishCoalesce(style.headerFill, () => ( "#E6E6E6")) : isLabelCell2 ? _nullishCoalesce(style.labelFill, () => ( "#E7E7E7")) : void 0
22978
23048
  })) : style && isHeaderRow ? style.headerBf : 2)));
22979
- const h = _nullishCoalesce(_optionalChain([prof, 'optionalAccess', _232 => _232.cellH, 'access', _233 => _233.get, 'call', _234 => _234(k)]), () => ( cellH));
23049
+ const h = _nullishCoalesce(_optionalChain([prof, 'optionalAccess', _233 => _233.cellH, 'access', _234 => _234.get, 'call', _235 => _235(k)]), () => ( cellH));
22980
23050
  return `<hp:tc name="" header="${isHeaderRow ? 1 : 0}" hasMargin="0" protect="0" editable="1" dirty="0" borderFillIDRef="${bf}"><hp:subList id="" textDirection="HORIZONTAL" lineWrap="BREAK" vertAlign="${style ? "CENTER" : "TOP"}" linkListIDRef="0" linkListNextIDRef="0" textWidth="0" textHeight="0" hasTextRef="0" hasNumRef="0">${p}</hp:subList><hp:cellAddr colAddr="${colIdx}" rowAddr="${rowIdx}"/><hp:cellSpan colSpan="1" rowSpan="1"/><hp:cellSz width="${colWidths[colIdx]}" height="${h}"/><hp:cellMargin left="141" right="141" top="141" bottom="141"/></hp:tc>`;
22981
23051
  }).join("");
22982
23052
  return `<hp:tr>${tdElements}</hp:tr>`;
@@ -22985,7 +23055,7 @@ function generateTable(rows, theme, style = null, remap = null, seq = 0) {
22985
23055
  const tblH = rowHeights.reduce((a, b) => a + b, 0);
22986
23056
  const tblInner = `<hp:sz width="${tblW}" widthRelTo="ABSOLUTE" height="${tblH}" heightRelTo="ABSOLUTE" protect="0"/><hp:pos treatAsChar="1" affectLSpacing="0" flowWithText="0" allowOverlap="0" holdAnchorAndSO="0" vertRelTo="PARA" horzRelTo="PARA" vertAlign="TOP" horzAlign="LEFT" vertOffset="0" horzOffset="0"/><hp:outMargin left="0" right="0" top="0" bottom="0"/><hp:inMargin left="510" right="510" top="141" bottom="141"/>` + trElements;
22987
23057
  const tbl2 = `<hp:tbl id="${tblId}" zOrder="0" numberingType="TABLE" pageBreak="CELL" repeatHeader="${style ? 1 : 0}" rowCnt="${rowCnt}" colCnt="${colCnt}" cellSpacing="0" borderFillIDRef="2" noShading="0">${tblInner}</hp:tbl>`;
22988
- const hostPr = reg && _optionalChain([style, 'optionalAccess', _235 => _235.rightParaPr]) !== void 0 ? style.rightParaPr : 0;
23058
+ const hostPr = reg && _optionalChain([style, 'optionalAccess', _236 => _236.rightParaPr]) !== void 0 ? style.rightParaPr : 0;
22989
23059
  return `<hp:p paraPrIDRef="${hostPr}" styleIDRef="0"><hp:run charPrIDRef="0">${tbl2}</hp:run></hp:p>`;
22990
23060
  }
22991
23061
  function layoutHtmlRows(rows) {
@@ -23016,28 +23086,31 @@ function generateHtmlTableXml(rawHtml, theme, totalWidth = 44e3, style = null, r
23016
23086
  if (!rows || rows.length === 0) return null;
23017
23087
  const { placed, rowCnt, colCnt } = layoutHtmlRows(rows);
23018
23088
  if (rowCnt === 0 || colCnt === 0) return null;
23019
- const measureH = _nullishCoalesce(_optionalChain([style, 'optionalAccess', _236 => _236.charHeight]), () => ( 1e3));
23089
+ const measureH = _nullishCoalesce(_optionalChain([style, 'optionalAccess', _237 => _237.charHeight]), () => ( 1e3));
23020
23090
  const first = _nullishCoalesce(placed.find((p) => p.r === 0 && p.c === 0), () => ( placed[0]));
23021
23091
  const prof = takeProfile(remap, rowCnt, colCnt, first ? anchorOfHtmlCell(first.inner) : "", seq);
23022
23092
  const colMax = Array(colCnt).fill(0);
23023
23093
  const colMaxBody = Array(colCnt).fill(0);
23094
+ const colMinWord = Array(colCnt).fill(0);
23024
23095
  const cellLines = placed.map((cell2) => htmlCellInnerToLines(cell2.inner).lines);
23025
23096
  placed.forEach((cell2, i) => {
23026
23097
  const w = Math.max(...cellLines[i].map((l) => measureTextWidth(unescapeHtml(l).trim(), measureH, 100)), 0) / cell2.colSpan;
23098
+ const mw = cell2.colSpan === 1 ? Math.max(...cellLines[i].map((l) => cellMinWordWidth(unescapeHtml(l), measureH)), 0) : 0;
23027
23099
  for (let dc = 0; dc < cell2.colSpan; dc++) {
23028
23100
  const c = cell2.c + dc;
23029
23101
  if (w > colMax[c]) colMax[c] = w;
23030
23102
  if (!cell2.isHeader && w > colMaxBody[c]) colMaxBody[c] = w;
23103
+ if (dc === 0 && mw > colMinWord[c]) colMinWord[c] = mw;
23031
23104
  }
23032
23105
  });
23033
- const colWidths = _nullishCoalesce(profileColWidths(prof, colCnt), () => ( computeColWidths(colMax, totalWidth)));
23106
+ const colWidths = _nullishCoalesce(profileColWidths(prof, colCnt), () => ( computeColWidths(colMax, totalWidth, colMinWord)));
23034
23107
  const colCentered = colWidths.map((w, c) => colMaxBody[c] + CELL_PAD <= w);
23035
23108
  const cellH = style ? Math.round(measureH * 1.6) + 282 : 1500;
23036
23109
  const tblW = colWidths.reduce((a, b) => a + b, 0);
23037
23110
  const tblId = nextTableId();
23038
23111
  const useHeaderStyle = !style && (theme.tableHeader !== theme.body || theme.tableHeaderBold);
23039
23112
  const spanW = (cell2) => colWidths.slice(cell2.c, cell2.c + cell2.colSpan).reduce((a, b) => a + b, 0);
23040
- const reg = _nullishCoalesce(_optionalChain([style, 'optionalAccess', _237 => _237.bfRegistry]), () => ( null));
23113
+ const reg = _nullishCoalesce(_optionalChain([style, 'optionalAccess', _238 => _238.bfRegistry]), () => ( null));
23041
23114
  let htmlHeaderRows = 0;
23042
23115
  while (htmlHeaderRows < rows.length && rows[htmlHeaderRows].tag === "th") htmlHeaderRows++;
23043
23116
  const tcXmls = placed.map((cell2, i) => {
@@ -23046,7 +23119,7 @@ function generateHtmlTableXml(rawHtml, theme, totalWidth = 44e3, style = null, r
23046
23119
  const baseCharPr = style ? style.charPr : CHAR_NORMAL;
23047
23120
  const headerCharPr = isHeader && useHeaderStyle ? CHAR_TABLE_HEADER : baseCharPr;
23048
23121
  const defaultCharPr = style && reg && isHeader ? style.boldCharPr : isHeader ? headerCharPr : baseCharPr;
23049
- const charPrId = _nullishCoalesce(_optionalChain([prof, 'optionalAccess', _238 => _238.cellChar, 'access', _239 => _239.get, 'call', _240 => _240(k)]), () => ( defaultCharPr));
23122
+ const charPrId = _nullishCoalesce(_optionalChain([prof, 'optionalAccess', _239 => _239.cellChar, 'access', _240 => _240.get, 'call', _241 => _241(k)]), () => ( defaultCharPr));
23050
23123
  const centered = isHeader || colCentered[cell2.c];
23051
23124
  const paraPrId = style ? centered ? reg ? _nullishCoalesce(style.tblCenterParaPr, () => ( style.centerParaPr)) : style.centerParaPr : reg ? _nullishCoalesce(style.tblLeftParaPr, () => ( PARA_NORMAL)) : PARA_NORMAL : PARA_NORMAL;
23052
23125
  const lines = cellLines[i];
@@ -23066,8 +23139,8 @@ function generateHtmlTableXml(rawHtml, theme, totalWidth = 44e3, style = null, r
23066
23139
  paras.push(`<hp:p paraPrIDRef="${paraPrId}" styleIDRef="0"><hp:run charPrIDRef="${charPrId}"><hp:t></hp:t></hp:run></hp:p>`);
23067
23140
  }
23068
23141
  const contentH = Math.max(cellH * cell2.rowSpan, Math.max(lines.length, 1) * (style ? Math.round(measureH * 1.6) : 800) + nestedH);
23069
- const cellHeight = Math.max(_nullishCoalesce(_optionalChain([prof, 'optionalAccess', _241 => _241.cellH, 'access', _242 => _242.get, 'call', _243 => _243(k)]), () => ( 0)), contentH);
23070
- const bf = _nullishCoalesce(_optionalChain([prof, 'optionalAccess', _244 => _244.cellBf, 'access', _245 => _245.get, 'call', _246 => _246(k)]), () => ( (reg ? reg.get(dataCellSpec({
23142
+ const cellHeight = Math.max(_nullishCoalesce(_optionalChain([prof, 'optionalAccess', _242 => _242.cellH, 'access', _243 => _243.get, 'call', _244 => _244(k)]), () => ( 0)), contentH);
23143
+ const bf = _nullishCoalesce(_optionalChain([prof, 'optionalAccess', _245 => _245.cellBf, 'access', _246 => _246.get, 'call', _247 => _247(k)]), () => ( (reg ? reg.get(dataCellSpec({
23071
23144
  row: cell2.r,
23072
23145
  rowEnd: cell2.r + cell2.rowSpan - 1,
23073
23146
  col: cell2.c,
@@ -23142,6 +23215,118 @@ function buildTitleBox(title, titleCharPr, bodyWidth, reg) {
23142
23215
  return `<hp:p paraPrIDRef="${PARA_NORMAL}" styleIDRef="0"><hp:run charPrIDRef="${CHAR_NORMAL}">${table2}</hp:run></hp:p>`;
23143
23216
  }
23144
23217
 
23218
+ // src/hwpx/gen-docframe.ts
23219
+ function docframeIds(base) {
23220
+ return { org: base, sender: base + 1, foot: base + 2, small: base + 3, pressLabel: base + 4, pressHead: base + 5, pressTitle: base + 6, pressSub: base + 7, pressContact: base + 8 };
23221
+ }
23222
+ function docframeActive(g) {
23223
+ return !!(g.docHead || g.docFoot || g.reportInfo || g.noticeHead || g.press);
23224
+ }
23225
+ function docframeCharPrXmls(base, measured) {
23226
+ const body = measured ? 4 : 0;
23227
+ const ids = docframeIds(base);
23228
+ return [
23229
+ charPr(ids.org, 1800, true, false, body),
23230
+ charPr(ids.sender, 2200, true, false, body),
23231
+ charPr(ids.foot, 900, false, false, body),
23232
+ charPr(ids.small, 1200, false, false, body),
23233
+ charPr(ids.pressLabel, 2e3, true, false, body),
23234
+ charPr(ids.pressHead, 1e3, true, false, body),
23235
+ charPr(ids.pressTitle, 2500, true, false, body),
23236
+ charPr(ids.pressSub, 1500, true, false, body),
23237
+ charPr(ids.pressContact, 1e3, false, false, body)
23238
+ ];
23239
+ }
23240
+ function labeled(label, value, paraPrId) {
23241
+ return `<hp:p paraPrIDRef="${paraPrId}" styleIDRef="0"><hp:run charPrIDRef="${CHAR_BOLD}"><hp:t>${escapeXml(label)}</hp:t></hp:run><hp:run charPrIDRef="${CHAR_NORMAL}"><hp:t>${escapeXml(value)}</hp:t></hp:run></hp:p>`;
23242
+ }
23243
+ function blank() {
23244
+ return `<hp:p paraPrIDRef="${PARA_NORMAL}" styleIDRef="0"><hp:run charPrIDRef="${CHAR_NORMAL}"><hp:t></hp:t></hp:run></hp:p>`;
23245
+ }
23246
+ function buildDocHead(g, ids) {
23247
+ const h = g.docHead;
23248
+ const out = [];
23249
+ if (h.org) {
23250
+ out.push(para(h.org, GONGMUN_CENTER, ids.org), blank());
23251
+ }
23252
+ if (h.to !== void 0) out.push(labeled("\uC218\uC2E0 ", h.to, PARA_NORMAL));
23253
+ out.push(para(h.via ? `(\uACBD\uC720) ${h.via}` : "(\uACBD\uC720)", PARA_NORMAL, CHAR_NORMAL));
23254
+ if (h.title !== void 0) out.push(labeled("\uC81C\uBAA9 ", h.title, PARA_NORMAL));
23255
+ out.push(blank());
23256
+ return out;
23257
+ }
23258
+ var FOOT_SEP = "\u2500".repeat(46);
23259
+ function buildDocFoot(g, ids) {
23260
+ const f = g.docFoot;
23261
+ const out = [blank()];
23262
+ if (f.sender) {
23263
+ out.push(para(f.sender, GONGMUN_CENTER, ids.sender), blank());
23264
+ }
23265
+ const foot = (text) => para(text, GONGMUN_TBL_LEFT, ids.foot);
23266
+ out.push(foot(FOOT_SEP));
23267
+ if (f.drafter || f.reviewer || f.approver)
23268
+ out.push(foot(`\uAE30\uC548\uC790 ${_nullishCoalesce(f.drafter, () => ( ""))} \uAC80\uD1A0\uC790 ${_nullishCoalesce(f.reviewer, () => ( ""))} \uACB0\uC7AC\uAD8C\uC790 ${_nullishCoalesce(f.approver, () => ( ""))}`));
23269
+ if (f.cooperator) out.push(foot(`\uD611\uC870\uC790 ${f.cooperator}`));
23270
+ if (f.docNum || f.receive) out.push(foot(`\uC2DC\uD589 ${_nullishCoalesce(f.docNum, () => ( ""))} \uC811\uC218 ${_nullishCoalesce(f.receive, () => ( ""))}`));
23271
+ if (f.address || f.site) out.push(foot(`${_nullishCoalesce(f.address, () => ( ""))} / ${_nullishCoalesce(f.site, () => ( ""))}`));
23272
+ if (f.phone || f.fax || f.email || f.disclosure)
23273
+ out.push(foot(`\uC804\uD654 ${_nullishCoalesce(f.phone, () => ( ""))} \uC804\uC1A1 ${_nullishCoalesce(f.fax, () => ( ""))} / ${_nullishCoalesce(f.email, () => ( ""))} / ${_nullishCoalesce(f.disclosure, () => ( ""))}`));
23274
+ return out;
23275
+ }
23276
+ function buildReportInfo(g, ids) {
23277
+ return para(g.reportInfo, GONGMUN_RIGHT, ids.small);
23278
+ }
23279
+ function buildNoticeHead(g) {
23280
+ const n = g.noticeHead;
23281
+ return n.no ? [para(n.no, PARA_NORMAL, CHAR_BOLD), blank()] : [];
23282
+ }
23283
+ function buildNoticeFoot(g) {
23284
+ const n = g.noticeHead;
23285
+ const out = [];
23286
+ if (n.date) out.push(blank(), para(n.date, GONGMUN_RIGHT, CHAR_NORMAL));
23287
+ if (n.sender) out.push(blank(), para(n.sender, GONGMUN_RIGHT, CHAR_BOLD));
23288
+ return out;
23289
+ }
23290
+ var PRESS_LABEL_H = 3200;
23291
+ var PRESS_HEAD_H = 900;
23292
+ function buildPressHead(g, ids, bodyWidth, reg) {
23293
+ const p = g.press;
23294
+ const w = bodyWidth - 280;
23295
+ const thick = { t: "thick", b: "thick", l: "thick", r: "thick" };
23296
+ const rows = [tc({ bf: reg.get({ ...thick, b: "thin" }), row: 0, col: 0, w, h: PRESS_LABEL_H, paras: para("\uBCF4\uB3C4\uC790\uB8CC", GONGMUN_TBL_CENTER, ids.pressLabel) })];
23297
+ const headLine = [
23298
+ p.release ? `\uBCF4\uB3C4\uC2DC\uC810 : ${p.release}` : "",
23299
+ p.distribute ? `\uBC30\uD3EC : ${p.distribute}` : ""
23300
+ ].filter(Boolean).join(" / ");
23301
+ if (headLine) rows.push(tc({ bf: reg.get({ ...thick, t: "thin" }), row: 1, col: 0, w, h: PRESS_HEAD_H, paras: para(headLine, GONGMUN_TBL_CENTER, ids.pressHead) }));
23302
+ const table2 = tbl(rows, w, PRESS_LABEL_H + (headLine ? PRESS_HEAD_H : 0), 1);
23303
+ return [`<hp:p paraPrIDRef="${PARA_NORMAL}" styleIDRef="0"><hp:run charPrIDRef="${CHAR_NORMAL}">${table2}</hp:run></hp:p>`, blank()];
23304
+ }
23305
+ function buildPressContact(g, ids, bodyWidth, reg) {
23306
+ const c = _optionalChain([g, 'access', _248 => _248.press, 'optionalAccess', _249 => _249.contact]);
23307
+ if (!c || !c.dept && !c.manager && !c.phone) return [];
23308
+ const w = bodyWidth - 280;
23309
+ const cells = [["\uB2F4\uB2F9 \uBD80\uC11C", _nullishCoalesce(c.dept, () => ( ""))], ["\uB2F4\uB2F9\uC790", _nullishCoalesce(c.manager, () => ( ""))], ["\uC5F0\uB77D\uCC98", _nullishCoalesce(c.phone, () => ( ""))]];
23310
+ const labelW = Math.round(w * 0.14);
23311
+ const valueW = Math.round(w / 3) - labelW;
23312
+ let col = 0;
23313
+ const row = cells.flatMap(([label, value], i) => {
23314
+ const bf = (first) => reg.get({
23315
+ t: "thick",
23316
+ b: "thick",
23317
+ l: first && i === 0 ? "thick" : "thin",
23318
+ r: !first && i === cells.length - 1 ? "thick" : "thin",
23319
+ fill: first ? "#E6E6E6" : void 0
23320
+ });
23321
+ return [
23322
+ tc({ bf: bf(true), row: 0, col: col++, w: labelW, h: 1100, paras: para(label, GONGMUN_TBL_CENTER, ids.pressHead) }),
23323
+ tc({ bf: bf(false), row: 0, col: col++, w: valueW, h: 1100, paras: para(value, GONGMUN_TBL_CENTER, ids.pressContact) })
23324
+ ];
23325
+ });
23326
+ const table2 = tbl([row.join("")], w, 1100, cells.length * 2);
23327
+ return [blank(), `<hp:p paraPrIDRef="${PARA_NORMAL}" styleIDRef="0"><hp:run charPrIDRef="${CHAR_NORMAL}">${table2}</hp:run></hp:p>`];
23328
+ }
23329
+
23145
23330
  // src/hwpx/equation-generate.ts
23146
23331
  var MAX_EQUATION_SOURCE = 1e4;
23147
23332
  var MAX_GROUP_DEPTH = 64;
@@ -23434,21 +23619,25 @@ function generateSecPr(gongmun) {
23434
23619
  m.footer = gongmun.headerFooter;
23435
23620
  }
23436
23621
  const secPr = `<hp:secPr textDirection="HORIZONTAL" spaceColumns="1134" tabStop="8000" outlineShapeIDRef="1" memoShapeIDRef="0" textVerticalWidthHead="0" masterPageCnt="0"><hp:grid lineGrid="0" charGrid="0" wonggojiFormat="0"/><hp:startNum pageStartsOn="BOTH" page="0" pic="0" tbl="0" equation="0"/><hp:visibility hideFirstHeader="0" hideFirstFooter="0" hideFirstMasterPage="0" border="SHOW_ALL" fill="SHOW_ALL" hideFirstPageNum="0" hideFirstEmptyLine="0" showLineNumber="0"/><hp:pagePr landscape="WIDELY" width="59528" height="84188" gutterType="LEFT_ONLY"><hp:margin header="${m.header}" footer="${m.footer}" gutter="0" left="${m.left}" right="${m.right}" top="${m.top}" bottom="${m.bottom}"/></hp:pagePr><hp:footNotePr><hp:autoNumFormat type="DIGIT" userChar="" prefixChar="" suffixChar=")" supscript="0"/><hp:noteLine length="-1" type="SOLID" width="0.12 mm" color="#000000"/><hp:noteSpacing betweenNotes="283" belowLine="567" aboveLine="850"/><hp:numbering type="CONTINUOUS" newNum="1"/><hp:placement place="EACH_COLUMN" beneathText="0"/></hp:footNotePr><hp:endNotePr><hp:autoNumFormat type="DIGIT" userChar="" prefixChar="" suffixChar=")" supscript="0"/><hp:noteLine length="14692344" type="SOLID" width="0.12 mm" color="#000000"/><hp:noteSpacing betweenNotes="0" belowLine="567" aboveLine="850"/><hp:numbering type="CONTINUOUS" newNum="1"/><hp:placement place="END_OF_DOCUMENT" beneathText="0"/></hp:endNotePr></hp:secPr>`;
23437
- return _optionalChain([gongmun, 'optionalAccess', _247 => _247.pageNumbers]) ? secPr + pageNumCtrl() : secPr;
23622
+ const colPr = `<hp:ctrl><hp:colPr id="" type="NEWSPAPER" layout="LEFT" colCount="1" sameSz="1" sameGap="0"/></hp:ctrl>`;
23623
+ return secPr + colPr + (_optionalChain([gongmun, 'optionalAccess', _250 => _250.pageNumbers]) ? pageNumCtrl() : "");
23438
23624
  }
23439
- function blocksToSectionXml(blocks, theme, gongmun, gongmunList = gongmun ? precomputeGongmunList(blocks, gongmun) : null, fit = null, chartParts = null, bfReg = null, remap = null) {
23625
+ function blocksToSectionXml(blocks, theme, gongmun, gongmunList = gongmun ? precomputeGongmunList(blocks, gongmun) : null, fit = null, chartParts = null, bfReg = null, remap = null, dfIds = null) {
23440
23626
  const paraXmls = [];
23441
23627
  let isFirst = true;
23442
23628
  let tableSeq = 0;
23443
23629
  const orderedCounters = {};
23444
23630
  let prevWasOrdered = false;
23445
- const gaejosik = _optionalChain([gongmun, 'optionalAccess', _248 => _248.preset]) === "gaejosik";
23446
- const vBase = charVariantBase(gaejosik);
23631
+ const gaejosik = _optionalChain([gongmun, 'optionalAccess', _251 => _251.preset]) === "gaejosik";
23632
+ const measured = !!gongmun && usesReportFonts(gongmun.preset);
23633
+ const vBase = charVariantBase(measured, !!gongmun);
23447
23634
  const tableStyle = gongmun ? {
23448
23635
  totalWidth: mmToHwpunit(210 - gongmun.margins.left - gongmun.margins.right),
23449
- charPr: gaejosik ? GJ_CHAR_TABLE : CHAR_NORMAL,
23450
- boldCharPr: gaejosik ? GJ_CHAR_TABLE_BOLD : CHAR_BOLD,
23451
- charHeight: gaejosik ? gaejosikSizes(gongmun.bodyHeight, gongmun.sizes).table : gongmun.bodyHeight,
23636
+ // 크기 실측: 실측 프리셋 맑은 고딕 12pt(22·23), 비실측도 12pt(11·12,
23637
+ // 실결재 지배값 본문 크기 셀은 열폭 부족으로 서술 열 세로 신장, v4.0.2 QA)
23638
+ charPr: measured ? GJ_CHAR_TABLE : GONGMUN_TBL_CHAR,
23639
+ boldCharPr: measured ? GJ_CHAR_TABLE_BOLD : GONGMUN_TBL_CHAR_BOLD,
23640
+ charHeight: measured ? gaejosikSizes(gongmun.bodyHeight, gongmun.sizes).table : GONGMUN_TBL_PT,
23452
23641
  headerBf: gongmunTableHeaderBf(gaejosik),
23453
23642
  centerParaPr: GONGMUN_CENTER,
23454
23643
  tblCenterParaPr: GONGMUN_TBL_CENTER,
@@ -23458,15 +23647,29 @@ function blocksToSectionXml(blocks, theme, gongmun, gongmunList = gongmun ? prec
23458
23647
  } : null;
23459
23648
  const chamMap = (id) => id === CHAR_BOLD ? GJ_CHAR_CHAM_BOLD : id;
23460
23649
  let chapterNo = 0;
23650
+ let h2Seq = 0;
23461
23651
  let coverH1Idx = -1;
23462
23652
  let pendingPageBreak = false;
23463
23653
  let pendingNewNum = false;
23464
23654
  let titleBoxH1Idx = -1;
23655
+ let pressH1Idx = -1;
23465
23656
  let hasFrontPages = false;
23466
23657
  const preamble = [];
23467
- if (_optionalChain([gongmun, 'optionalAccess', _249 => _249.approval]) && bfReg) {
23658
+ if (_optionalChain([gongmun, 'optionalAccess', _252 => _252.reportInfo]) && dfIds) {
23659
+ preamble.push(buildReportInfo(gongmun, dfIds));
23660
+ }
23661
+ if (_optionalChain([gongmun, 'optionalAccess', _253 => _253.approval]) && bfReg) {
23468
23662
  preamble.push(buildApprovalTable(gongmun.approval, gongmun, bfReg));
23469
23663
  }
23664
+ if (_optionalChain([gongmun, 'optionalAccess', _254 => _254.docHead]) && dfIds) {
23665
+ preamble.push(...buildDocHead(gongmun, dfIds));
23666
+ }
23667
+ if (_optionalChain([gongmun, 'optionalAccess', _255 => _255.noticeHead]) && dfIds) {
23668
+ preamble.push(...buildNoticeHead(gongmun));
23669
+ }
23670
+ if (_optionalChain([gongmun, 'optionalAccess', _256 => _256.press]) && dfIds && bfReg && tableStyle) {
23671
+ preamble.push(...buildPressHead(gongmun, dfIds, tableStyle.totalWidth, bfReg));
23672
+ }
23470
23673
  if (gaejosik && gongmun) {
23471
23674
  const h1Idx = blocks.findIndex((b) => b.type === "heading" && (_nullishCoalesce(b.level, () => ( 1))) === 1);
23472
23675
  const chapters = blocks.filter((b) => b.type === "heading" && b.level === 2).map((b) => stripChapterNumber(b.text || ""));
@@ -23491,6 +23694,8 @@ function blocksToSectionXml(blocks, theme, gongmun, gongmunList = gongmun ? prec
23491
23694
  }
23492
23695
  } else if (gongmun && !gaejosik && bfReg && (gongmun.preset === "report" || gongmun.preset === "plan" || gongmun.preset === "notice")) {
23493
23696
  titleBoxH1Idx = blocks.findIndex((b) => b.type === "heading" && (_nullishCoalesce(b.level, () => ( 1))) === 1);
23697
+ } else if (_optionalChain([gongmun, 'optionalAccess', _257 => _257.press]) && dfIds) {
23698
+ pressH1Idx = blocks.findIndex((b) => b.type === "heading" && (_nullishCoalesce(b.level, () => ( 1))) === 1);
23494
23699
  }
23495
23700
  if (preamble.length > 0) {
23496
23701
  preamble[0] = preamble[0].replace(` pageBreak="1"`, "").replace(/<hp:run charPrIDRef="(\d+)">/, `<hp:run charPrIDRef="$1">${generateSecPr(gongmun)}`);
@@ -23510,8 +23715,16 @@ function blocksToSectionXml(blocks, theme, gongmun, gongmunList = gongmun ? prec
23510
23715
  }
23511
23716
  switch (block.type) {
23512
23717
  case "heading": {
23718
+ if (gongmun && blockIdx === pressH1Idx && dfIds) {
23719
+ const parts = [generateParagraph((block.text || "").trim(), GONGMUN_CENTER, dfIds.pressTitle)];
23720
+ for (const s of _nullishCoalesce(_optionalChain([gongmun, 'access', _258 => _258.press, 'optionalAccess', _259 => _259.sub]), () => ( []))) {
23721
+ parts.push(generateParagraph(`- ${s} -`, GONGMUN_CENTER, dfIds.pressSub));
23722
+ }
23723
+ xml = parts.join("\n ");
23724
+ break;
23725
+ }
23513
23726
  if (gongmun && blockIdx === titleBoxH1Idx && tableStyle && bfReg) {
23514
- xml = buildTitleBox((block.text || "").trim(), CHAR_H1, tableStyle.totalWidth, bfReg);
23727
+ xml = buildTitleBox((block.text || "").trim(), measured ? GJ_CHAR_BODY_TITLE : CHAR_H1, tableStyle.totalWidth, bfReg);
23515
23728
  break;
23516
23729
  }
23517
23730
  if (gaejosik) {
@@ -23528,18 +23741,24 @@ function blocksToSectionXml(blocks, theme, gongmun, gongmunList = gongmun ? prec
23528
23741
  (id) => id === CHAR_BOLD ? GJ_CHAR_DAE_BOLD : id
23529
23742
  );
23530
23743
  } else {
23531
- xml = generateParagraph(`\u25CB ${block.text || ""}`, GONGMUN_LIST_BASE + 1, CHAR_NORMAL);
23744
+ xml = generateParagraph(`${gongmun.bullet2} ${block.text || ""}`, GONGMUN_LIST_BASE + 1, CHAR_NORMAL);
23532
23745
  }
23533
23746
  break;
23534
23747
  }
23535
23748
  const pId = headingParaPrId(block.level || 1);
23536
23749
  const cId = headingCharPrId(block.level || 1);
23537
23750
  const styleId = gongmun ? Math.min(block.level || 1, 4) : 0;
23538
- xml = generateParagraph(block.text || "", pId, cId, void 0, styleId);
23751
+ let hText = block.text || "";
23752
+ if (gongmun && (block.level || 1) === 2 && gongmun.h2Marker !== "none") {
23753
+ const title = stripChapterNumber(hText);
23754
+ hText = gongmun.h2Marker === "box" ? `\u25A1 ${title}` : `${++h2Seq}. ${title}`;
23755
+ }
23756
+ xml = generateParagraph(hText, pId, cId, void 0, styleId);
23539
23757
  break;
23540
23758
  }
23541
23759
  case "paragraph": {
23542
- if (gaejosik && (block.text || "").trimStart().startsWith("\u203B")) {
23760
+ const pTrim = (block.text || "").trimStart();
23761
+ if (measured && (pTrim.startsWith("\u203B") || /^\*\s/.test(pTrim))) {
23543
23762
  xml = generateParagraph((block.text || "").trim(), GJ_PARA_CHAM, GJ_CHAR_CHAM, chamMap);
23544
23763
  break;
23545
23764
  }
@@ -23584,7 +23803,7 @@ function blocksToSectionXml(blocks, theme, gongmun, gongmunList = gongmun ? prec
23584
23803
  break;
23585
23804
  }
23586
23805
  case "blockquote": {
23587
- if (gaejosik) {
23806
+ if (measured) {
23588
23807
  const t = (block.text || "").trim();
23589
23808
  if (t) xml = generateParagraph(t.startsWith("\u203B") ? t : `\u203B ${t}`, GJ_PARA_CHAM, GJ_CHAR_CHAM, chamMap);
23590
23809
  break;
@@ -23599,21 +23818,33 @@ function blocksToSectionXml(blocks, theme, gongmun, gongmunList = gongmun ? prec
23599
23818
  case "list_item": {
23600
23819
  if (gongmun && gongmunList) {
23601
23820
  const info = gongmunList.get(blockIdx);
23602
- const depth = _nullishCoalesce(_optionalChain([info, 'optionalAccess', _250 => _250.depth]), () => ( 0));
23603
- const marker2 = _nullishCoalesce(_optionalChain([info, 'optionalAccess', _251 => _251.marker]), () => ( ""));
23821
+ const depth = _nullishCoalesce(_optionalChain([info, 'optionalAccess', _260 => _260.depth]), () => ( 0));
23822
+ const marker2 = _nullishCoalesce(_optionalChain([info, 'optionalAccess', _261 => _261.marker]), () => ( ""));
23604
23823
  const content = block.text || "";
23605
- if (gaejosik && content.trimStart().startsWith("\u203B")) {
23824
+ if (measured && content.trimStart().startsWith("\u203B")) {
23606
23825
  xml = generateParagraph(content.trim(), GJ_PARA_CHAM, GJ_CHAR_CHAM, chamMap);
23607
23826
  break;
23608
23827
  }
23828
+ if (measured && block.marker === "*") {
23829
+ xml = generateParagraph(`* ${content.trim()}`, GJ_PARA_CHAM, GJ_CHAR_CHAM, chamMap);
23830
+ break;
23831
+ }
23609
23832
  const text = marker2 ? `${marker2} ${content}` : content;
23833
+ const listParaPr = marker2 ? GONGMUN_LIST_BASE + depth : GONGMUN_LIST_PLAIN_BASE + depth;
23610
23834
  let listCharPr = gongmun.numbering === "report" && depth === 0 ? CHAR_BOLD : CHAR_NORMAL;
23611
23835
  let mapId = fit ? variantMapper(fit, blockIdx, vBase) : void 0;
23612
- if (gaejosik && depth === 0) {
23836
+ if (measured && depth === 0 && gongmun.numbering !== "standard") {
23613
23837
  listCharPr = GJ_CHAR_DAE;
23614
23838
  mapId = (id) => id === CHAR_BOLD ? GJ_CHAR_DAE_BOLD : id;
23615
23839
  }
23616
- xml = generateParagraph(text, GONGMUN_LIST_BASE + depth, listCharPr, mapId);
23840
+ if (gongmun.preset === "press") {
23841
+ if (depth === 0) listCharPr = CHAR_NORMAL;
23842
+ if (depth >= 2 && dfIds) {
23843
+ listCharPr = dfIds.small;
23844
+ mapId = void 0;
23845
+ }
23846
+ }
23847
+ xml = generateParagraph(text, listParaPr, listCharPr, mapId);
23617
23848
  break;
23618
23849
  }
23619
23850
  const indent = block.indent || 0;
@@ -23687,10 +23918,19 @@ function blocksToSectionXml(blocks, theme, gongmun, gongmunList = gongmun ? prec
23687
23918
  }
23688
23919
  paraXmls.push(xml);
23689
23920
  }
23690
- if (_optionalChain([gongmun, 'optionalAccess', _252 => _252.endMark]) && paraXmls.length > 0) {
23691
- const lastText = _nullishCoalesce(_optionalChain([[...blocks], 'access', _253 => _253.reverse, 'call', _254 => _254(), 'access', _255 => _255.find, 'call', _256 => _256((b) => (b.type === "paragraph" || b.type === "list_item") && (b.text || "").trim()), 'optionalAccess', _257 => _257.text]), () => ( ""));
23921
+ if (_optionalChain([gongmun, 'optionalAccess', _262 => _262.noticeHead]) && dfIds) {
23922
+ paraXmls.push(...buildNoticeFoot(gongmun));
23923
+ }
23924
+ if (_optionalChain([gongmun, 'optionalAccess', _263 => _263.endMark]) && paraXmls.length > 0) {
23925
+ const lastText = _nullishCoalesce(_optionalChain([[...blocks], 'access', _264 => _264.reverse, 'call', _265 => _265(), 'access', _266 => _266.find, 'call', _267 => _267((b) => (b.type === "paragraph" || b.type === "list_item") && (b.text || "").trim()), 'optionalAccess', _268 => _268.text]), () => ( ""));
23692
23926
  if (!hasEndMark(lastText)) paraXmls.push(buildEndMark());
23693
23927
  }
23928
+ if (_optionalChain([gongmun, 'optionalAccess', _269 => _269.docFoot]) && dfIds) {
23929
+ paraXmls.push(...buildDocFoot(gongmun, dfIds));
23930
+ }
23931
+ if (_optionalChain([gongmun, 'optionalAccess', _270 => _270.press]) && dfIds && bfReg && tableStyle) {
23932
+ paraXmls.push(...buildPressContact(gongmun, dfIds, tableStyle.totalWidth, bfReg));
23933
+ }
23694
23934
  if (paraXmls.length === 0) {
23695
23935
  paraXmls.push(`<hp:p paraPrIDRef="0" styleIDRef="0"><hp:run charPrIDRef="0">${generateSecPr(gongmun)}<hp:t></hp:t></hp:run></hp:p>`);
23696
23936
  }
@@ -23702,29 +23942,39 @@ function blocksToSectionXml(blocks, theme, gongmun, gongmunList = gongmun ? prec
23702
23942
 
23703
23943
  // src/hwpx/generator.ts
23704
23944
  async function markdownToHwpx(markdown, options) {
23705
- const theme = resolveTheme(_optionalChain([options, 'optionalAccess', _258 => _258.theme]));
23706
- const gongmun = _optionalChain([options, 'optionalAccess', _259 => _259.gongmun]) ? resolveGongmun(options.gongmun) : null;
23707
- const gaejosik = _optionalChain([gongmun, 'optionalAccess', _260 => _260.preset]) === "gaejosik";
23945
+ const theme = resolveTheme(_optionalChain([options, 'optionalAccess', _271 => _271.theme]));
23946
+ const gongmun = _optionalChain([options, 'optionalAccess', _272 => _272.gongmun]) ? resolveGongmun(options.gongmun) : null;
23947
+ const gaejosik = _optionalChain([gongmun, 'optionalAccess', _273 => _273.preset]) === "gaejosik";
23948
+ const measured = !!gongmun && usesReportFonts(gongmun.preset);
23708
23949
  const blocks = parseMarkdownToBlocks(markdown);
23709
23950
  const gongmunList = gongmun ? precomputeGongmunList(blocks, gongmun) : null;
23710
23951
  const fit = gongmun && gongmunList ? computeGongmunFitPlan(blocks, gongmun, gongmunList) : null;
23711
23952
  const staticBfEnd = gongmun ? gaejosik ? 11 : 4 : 3;
23712
- const remap = _optionalChain([options, 'optionalAccess', _261 => _261.profile]) ? buildProfileRemap(options.profile, charVariantBase(gaejosik) + (_nullishCoalesce(_optionalChain([fit, 'optionalAccess', _262 => _262.variants, 'optionalAccess', _263 => _263.length]), () => ( 0))) * 4, staticBfEnd) : null;
23713
- const bfReg = gongmun ? new TableBfRegistry(staticBfEnd + (_nullishCoalesce(_optionalChain([remap, 'optionalAccess', _264 => _264.borderFillXmls, 'access', _265 => _265.length]), () => ( 0)))) : null;
23953
+ const remap = _optionalChain([options, 'optionalAccess', _274 => _274.profile]) ? buildProfileRemap(options.profile, charVariantBase(measured, !!gongmun) + (_nullishCoalesce(_optionalChain([fit, 'optionalAccess', _275 => _275.variants, 'optionalAccess', _276 => _276.length]), () => ( 0))) * 4, staticBfEnd) : null;
23954
+ const bfReg = gongmun ? new TableBfRegistry(staticBfEnd + (_nullishCoalesce(_optionalChain([remap, 'optionalAccess', _277 => _277.borderFillXmls, 'access', _278 => _278.length]), () => ( 0)))) : null;
23955
+ const dfActive = !!gongmun && docframeActive(gongmun);
23956
+ const dfBase = charVariantBase(measured, !!gongmun) + (_nullishCoalesce(_optionalChain([fit, 'optionalAccess', _279 => _279.variants, 'optionalAccess', _280 => _280.length]), () => ( 0))) * 4 + (_nullishCoalesce(_optionalChain([remap, 'optionalAccess', _281 => _281.charPrXmls, 'access', _282 => _282.length]), () => ( 0)));
23957
+ const dfIds = dfActive ? docframeIds(dfBase) : null;
23714
23958
  const chartParts = [];
23715
- const sectionXml = blocksToSectionXml(blocks, theme, gongmun, gongmunList, fit, chartParts, bfReg, remap);
23959
+ const sectionXml = blocksToSectionXml(blocks, theme, gongmun, gongmunList, fit, chartParts, bfReg, remap, dfIds);
23716
23960
  if (remap && remap.tables.length > 0) {
23717
23961
  const unused = remap.tables.filter((t) => !t.used).length;
23718
23962
  if (unused === remap.tables.length) {
23719
23963
  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)`);
23720
23964
  }
23721
23965
  }
23722
- const extraBorderFills = [..._nullishCoalesce(_optionalChain([remap, 'optionalAccess', _266 => _266.borderFillXmls]), () => ( [])), ..._nullishCoalesce(_optionalChain([bfReg, 'optionalAccess', _267 => _267.emit, 'call', _268 => _268()]), () => ( []))];
23966
+ const extraBorderFills = [..._nullishCoalesce(_optionalChain([remap, 'optionalAccess', _283 => _283.borderFillXmls]), () => ( [])), ..._nullishCoalesce(_optionalChain([bfReg, 'optionalAccess', _284 => _284.emit, 'call', _285 => _285()]), () => ( []))];
23723
23967
  const zip = new (0, _jszip2.default)();
23724
23968
  zip.file("mimetype", "application/hwp+zip", { compression: "STORE" });
23725
23969
  zip.file("META-INF/container.xml", generateContainerXml());
23726
23970
  zip.file("Contents/content.hpf", generateManifest(chartParts));
23727
- zip.file("Contents/header.xml", generateHeaderXml(theme, gongmun, _nullishCoalesce(_optionalChain([fit, 'optionalAccess', _269 => _269.variants]), () => ( [])), extraBorderFills, _nullishCoalesce(_optionalChain([remap, 'optionalAccess', _270 => _270.charPrXmls]), () => ( []))));
23971
+ zip.file("Contents/header.xml", generateHeaderXml(
23972
+ theme,
23973
+ gongmun,
23974
+ _nullishCoalesce(_optionalChain([fit, 'optionalAccess', _286 => _286.variants]), () => ( [])),
23975
+ extraBorderFills,
23976
+ [..._nullishCoalesce(_optionalChain([remap, 'optionalAccess', _287 => _287.charPrXmls]), () => ( [])), ...dfActive ? docframeCharPrXmls(dfBase, measured) : []]
23977
+ ));
23728
23978
  zip.file("Contents/section0.xml", sectionXml);
23729
23979
  for (const part of chartParts) zip.file(part.name, part.xml);
23730
23980
  zip.file("Preview/PrvText.txt", buildPrvText(blocks));
@@ -24018,7 +24268,7 @@ function parseRenderStyles(headXml) {
24018
24268
  const underlineEl = findChildByLocalName(el, "underline");
24019
24269
  const textColor = el.getAttribute("textColor");
24020
24270
  const fontRef = findChildByLocalName(el, "fontRef");
24021
- const fontId = _nullishCoalesce(_optionalChain([fontRef, 'optionalAccess', _271 => _271.getAttribute, 'call', _272 => _272("hangul")]), () => ( _optionalChain([fontRef, 'optionalAccess', _273 => _273.getAttribute, 'call', _274 => _274("latin")])));
24271
+ const fontId = _nullishCoalesce(_optionalChain([fontRef, 'optionalAccess', _288 => _288.getAttribute, 'call', _289 => _289("hangul")]), () => ( _optionalChain([fontRef, 'optionalAccess', _290 => _290.getAttribute, 'call', _291 => _291("latin")])));
24022
24272
  const face = fontId != null ? hangulFonts.get(fontId) : void 0;
24023
24273
  styles.charPr.set(id, {
24024
24274
  height: Number(el.getAttribute("height")) || 1e3,
@@ -24026,8 +24276,8 @@ function parseRenderStyles(headXml) {
24026
24276
  italic: findChildByLocalName(el, "italic") != null,
24027
24277
  underline: underlineEl != null && (_nullishCoalesce(underlineEl.getAttribute("type"), () => ( "NONE"))) !== "NONE",
24028
24278
  color: textColor && textColor !== "#000000" && textColor.toLowerCase() !== "none" ? textColor : void 0,
24029
- ratio: Number(_optionalChain([ratioEl, 'optionalAccess', _275 => _275.getAttribute, 'call', _276 => _276("hangul")])) || 100,
24030
- spacing: Number(_optionalChain([spacingEl, 'optionalAccess', _277 => _277.getAttribute, 'call', _278 => _278("hangul")])) || 0,
24279
+ ratio: Number(_optionalChain([ratioEl, 'optionalAccess', _292 => _292.getAttribute, 'call', _293 => _293("hangul")])) || 100,
24280
+ spacing: Number(_optionalChain([spacingEl, 'optionalAccess', _294 => _294.getAttribute, 'call', _295 => _295("hangul")])) || 0,
24031
24281
  fontFamily: face ? hwpFaceToCssStack(face) : void 0
24032
24282
  });
24033
24283
  }
@@ -24035,7 +24285,7 @@ function parseRenderStyles(headXml) {
24035
24285
  const id = el.getAttribute("id");
24036
24286
  if (id != null) {
24037
24287
  const align = findChildByLocalName(el, "align");
24038
- styles.paraAlign.set(id, _optionalChain([align, 'optionalAccess', _279 => _279.getAttribute, 'call', _280 => _280("horizontal")]) || "JUSTIFY");
24288
+ styles.paraAlign.set(id, _optionalChain([align, 'optionalAccess', _296 => _296.getAttribute, 'call', _297 => _297("horizontal")]) || "JUSTIFY");
24039
24289
  styles.paraGeom.set(id, parseParaGeom(el));
24040
24290
  }
24041
24291
  } else if (tag === "borderFill") {
@@ -24049,7 +24299,7 @@ function parseRenderStyles(headXml) {
24049
24299
  };
24050
24300
  const fillBrush = findChildByLocalName(el, "fillBrush");
24051
24301
  const winBrush = fillBrush ? findChildByLocalName(fillBrush, "winBrush") : null;
24052
- const face = _optionalChain([winBrush, 'optionalAccess', _281 => _281.getAttribute, 'call', _282 => _282("faceColor")]);
24302
+ const face = _optionalChain([winBrush, 'optionalAccess', _298 => _298.getAttribute, 'call', _299 => _299("faceColor")]);
24053
24303
  if (face && face.toLowerCase() !== "none") bf.fill = face;
24054
24304
  styles.borderFill.set(id, bf);
24055
24305
  }
@@ -24121,7 +24371,7 @@ function collectSites(scan) {
24121
24371
  }
24122
24372
  function attrOf(openTag, name) {
24123
24373
  const m = openTag.match(new RegExp(`\\b${name}="([^"]*)"`));
24124
- return _optionalChain([m, 'optionalAccess', _283 => _283[1]]);
24374
+ return _optionalChain([m, 'optionalAccess', _300 => _300[1]]);
24125
24375
  }
24126
24376
  function paraOpenTag(xml, para2) {
24127
24377
  const end = xml.indexOf(">", para2.start);
@@ -24136,7 +24386,7 @@ function anchorRunInfo(xml, para2, anchor) {
24136
24386
  if (!tr) return null;
24137
24387
  const before = xml.slice(Math.max(0, para2.start), tr.contentStart);
24138
24388
  const runOpen = [...before.matchAll(/<([A-Za-z0-9]+):run\b[^>]*>/g)].pop();
24139
- const prefix = _nullishCoalesce(_nullishCoalesce(_optionalChain([runOpen, 'optionalAccess', _284 => _284[1]]), () => ( tr.prefix)), () => ( "hp"));
24389
+ const prefix = _nullishCoalesce(_nullishCoalesce(_optionalChain([runOpen, 'optionalAccess', _301 => _301[1]]), () => ( tr.prefix)), () => ( "hp"));
24140
24390
  const charPr2 = runOpen && attrOf(runOpen[0], "charPrIDRef") || "0";
24141
24391
  const close = xml.indexOf(`</${prefix}:run>`, tr.contentEnd);
24142
24392
  if (close === -1) return null;
@@ -24163,7 +24413,7 @@ function cellContentWidthMm(xml, cell2) {
24163
24413
  if (width === null) return null;
24164
24414
  let content = width;
24165
24415
  const win = cellAddrWindow(xml, cell2);
24166
- const mg = _optionalChain([win, 'optionalAccess', _285 => _285.match, 'call', _286 => _286(/<[A-Za-z0-9]+:cellMargin\b[^>]*>/)]);
24416
+ const mg = _optionalChain([win, 'optionalAccess', _302 => _302.match, 'call', _303 => _303(/<[A-Za-z0-9]+:cellMargin\b[^>]*>/)]);
24167
24417
  if (mg) {
24168
24418
  content -= Number(_nullishCoalesce(attrOf(mg[0], "left"), () => ( 0))) + Number(_nullishCoalesce(attrOf(mg[0], "right"), () => ( 0)));
24169
24419
  }
@@ -24197,11 +24447,11 @@ function buildFloatPicXml(itemId, sizeHu, posXHu, posYHu, ids) {
24197
24447
  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>`;
24198
24448
  }
24199
24449
  async function placeSealHwpx(hwpxBuffer, ops) {
24200
- if (ops.length === 0) throw new (0, _chunkEBSCV3JCcjs.KordocError)("place_seal: \uBC30\uCE58\uD560 \uB3C4\uC7A5\uC774 \uC5C6\uC2B5\uB2C8\uB2E4");
24450
+ if (ops.length === 0) throw new (0, _chunkWN7LZHIIcjs.KordocError)("place_seal: \uBC30\uCE58\uD560 \uB3C4\uC7A5\uC774 \uC5C6\uC2B5\uB2C8\uB2E4");
24201
24451
  const u8 = new Uint8Array(hwpxBuffer);
24202
24452
  const zip = await _jszip2.default.loadAsync(hwpxBuffer);
24203
- const sectionPaths = Object.keys(zip.files).filter((name) => /[Ss]ection\d+\.xml$/i.test(name)).sort((a, b) => Number(_nullishCoalesce(_optionalChain([a, 'access', _287 => _287.match, 'call', _288 => _288(/(\d+)\.xml$/i), 'optionalAccess', _289 => _289[1]]), () => ( 0))) - Number(_nullishCoalesce(_optionalChain([b, 'access', _290 => _290.match, 'call', _291 => _291(/(\d+)\.xml$/i), 'optionalAccess', _292 => _292[1]]), () => ( 0))));
24204
- if (sectionPaths.length === 0) throw new (0, _chunkEBSCV3JCcjs.KordocError)("HWPX\uC5D0\uC11C \uC139\uC158 \uD30C\uC77C\uC744 \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4");
24453
+ const sectionPaths = Object.keys(zip.files).filter((name) => /[Ss]ection\d+\.xml$/i.test(name)).sort((a, b) => Number(_nullishCoalesce(_optionalChain([a, 'access', _304 => _304.match, 'call', _305 => _305(/(\d+)\.xml$/i), 'optionalAccess', _306 => _306[1]]), () => ( 0))) - Number(_nullishCoalesce(_optionalChain([b, 'access', _307 => _307.match, 'call', _308 => _308(/(\d+)\.xml$/i), 'optionalAccess', _309 => _309[1]]), () => ( 0))));
24454
+ if (sectionPaths.length === 0) throw new (0, _chunkWN7LZHIIcjs.KordocError)("HWPX\uC5D0\uC11C \uC139\uC158 \uD30C\uC77C\uC744 \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4");
24205
24455
  const manifestPath = Object.keys(zip.files).find((name) => /\.hpf$/i.test(name));
24206
24456
  const headerPath = Object.keys(zip.files).find((name) => /(^|\/)header\.xml$/i.test(name));
24207
24457
  const styles = headerPath ? parseRenderStyles(await zip.file(headerPath).async("text")) : null;
@@ -24242,11 +24492,11 @@ async function placeSealHwpx(hwpxBuffer, ops) {
24242
24492
  const manifestItems = [];
24243
24493
  const placed = [];
24244
24494
  for (const op of ops) {
24245
- if (!op.anchor) throw new (0, _chunkEBSCV3JCcjs.KordocError)("place_seal: anchor \uBB38\uAD6C\uAC00 \uD544\uC694\uD569\uB2C8\uB2E4");
24246
- if (!op.image || op.image.length === 0) throw new (0, _chunkEBSCV3JCcjs.KordocError)("place_seal: \uB3C4\uC7A5 \uC774\uBBF8\uC9C0\uAC00 \uD544\uC694\uD569\uB2C8\uB2E4");
24495
+ if (!op.anchor) throw new (0, _chunkWN7LZHIIcjs.KordocError)("place_seal: anchor \uBB38\uAD6C\uAC00 \uD544\uC694\uD569\uB2C8\uB2E4");
24496
+ if (!op.image || op.image.length === 0) throw new (0, _chunkWN7LZHIIcjs.KordocError)("place_seal: \uB3C4\uC7A5 \uC774\uBBF8\uC9C0\uAC00 \uD544\uC694\uD569\uB2C8\uB2E4");
24247
24497
  const ext = (_nullishCoalesce(op.ext, () => ( "png"))).toLowerCase();
24248
- if (!MIME[ext]) throw new (0, _chunkEBSCV3JCcjs.KordocError)(`place_seal: \uC9C0\uC6D0\uD558\uC9C0 \uC54A\uB294 \uC774\uBBF8\uC9C0 \uD655\uC7A5\uC790 .${ext} (png/jpg/bmp/gif)`);
24249
- if (!imageMagicMatches(op.image, ext)) throw new (0, _chunkEBSCV3JCcjs.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)`);
24498
+ if (!MIME[ext]) throw new (0, _chunkWN7LZHIIcjs.KordocError)(`place_seal: \uC9C0\uC6D0\uD558\uC9C0 \uC54A\uB294 \uC774\uBBF8\uC9C0 \uD655\uC7A5\uC790 .${ext} (png/jpg/bmp/gif)`);
24499
+ if (!imageMagicMatches(op.image, ext)) throw new (0, _chunkWN7LZHIIcjs.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)`);
24250
24500
  const wantOcc = _nullishCoalesce(op.occurrence, () => ( 0));
24251
24501
  let found = null;
24252
24502
  let total = 0;
@@ -24279,7 +24529,7 @@ async function placeSealHwpx(hwpxBuffer, ops) {
24279
24529
  }
24280
24530
  }
24281
24531
  }
24282
- throw new (0, _chunkEBSCV3JCcjs.KordocError)(
24532
+ throw new (0, _chunkWN7LZHIIcjs.KordocError)(
24283
24533
  `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)})`
24284
24534
  );
24285
24535
  }
@@ -24287,9 +24537,9 @@ async function placeSealHwpx(hwpxBuffer, ops) {
24287
24537
  const xml = sectionXmls[si];
24288
24538
  const run = anchorRunInfo(xml, site.para, op.anchor);
24289
24539
  if (!run) {
24290
- throw new (0, _chunkEBSCV3JCcjs.KordocError)(`place_seal: \uC575\uCEE4 "${op.anchor}" \uBB38\uB2E8\uC5D0\uC11C run\uC744 \uCC3E\uC9C0 \uBABB\uD588\uC2B5\uB2C8\uB2E4`);
24540
+ throw new (0, _chunkWN7LZHIIcjs.KordocError)(`place_seal: \uC575\uCEE4 "${op.anchor}" \uBB38\uB2E8\uC5D0\uC11C run\uC744 \uCC3E\uC9C0 \uBABB\uD588\uC2B5\uB2C8\uB2E4`);
24291
24541
  }
24292
- const charPrHeight = _nullishCoalesce(_optionalChain([styles, 'optionalAccess', _293 => _293.charPr, 'access', _294 => _294.get, 'call', _295 => _295(run.charPr), 'optionalAccess', _296 => _296.height]), () => ( 1e3));
24542
+ const charPrHeight = _nullishCoalesce(_optionalChain([styles, 'optionalAccess', _310 => _310.charPr, 'access', _311 => _311.get, 'call', _312 => _312(run.charPr), 'optionalAccess', _313 => _313.height]), () => ( 1e3));
24293
24543
  const fontPt = charPrHeight / 100;
24294
24544
  const emMm = fontPt * 25.4 / 72;
24295
24545
  const lineHMm = emMm;
@@ -24298,7 +24548,7 @@ async function placeSealHwpx(hwpxBuffer, ops) {
24298
24548
  const sizeMm = op.sizeMm != null && Number.isFinite(op.sizeMm) && op.sizeMm > 0 ? op.sizeMm : Math.max(7, Math.min(18, lineHMm * 1.6));
24299
24549
  const availMm = _nullishCoalesce((site.cell ? cellContentWidthMm(xml, site.cell) : null), () => ( bodyColumnWidthMm(xml)));
24300
24550
  const paraPrId = _nullishCoalesce(attrOf(paraOpenTag(xml, site.para), "paraPrIDRef"), () => ( "0"));
24301
- const align = _optionalChain([styles, 'optionalAccess', _297 => _297.paraAlign, 'access', _298 => _298.get, 'call', _299 => _299(paraPrId)]);
24551
+ const align = _optionalChain([styles, 'optionalAccess', _314 => _314.paraAlign, 'access', _315 => _315.get, 'call', _316 => _316(paraPrId)]);
24302
24552
  let alignShiftMm = 0;
24303
24553
  if (align === "CENTER" || align === "RIGHT") {
24304
24554
  const paraWMm = measureMm(site.para.text, emMm);
@@ -24394,7 +24644,7 @@ function parseBorderFills(headerDoc) {
24394
24644
  };
24395
24645
  const fillBrush = findChildByLocalName(bf, "fillBrush");
24396
24646
  const winBrush = fillBrush ? findChildByLocalName(fillBrush, "winBrush") : null;
24397
- const face = _optionalChain([winBrush, 'optionalAccess', _300 => _300.getAttribute, 'call', _301 => _301("faceColor")]);
24647
+ const face = _optionalChain([winBrush, 'optionalAccess', _317 => _317.getAttribute, 'call', _318 => _318("faceColor")]);
24398
24648
  if (face && face !== "none") def.fill = { faceColor: face };
24399
24649
  map.set(id, def);
24400
24650
  }
@@ -24414,7 +24664,7 @@ function parseCharPrs(headerDoc) {
24414
24664
  if (cp.getAttribute("italic") === "1") def.italic = true;
24415
24665
  if (findChildByLocalName(cp, "underline")) def.underline = true;
24416
24666
  const fontRef = findChildByLocalName(cp, "fontRef");
24417
- const hangul = _optionalChain([fontRef, 'optionalAccess', _302 => _302.getAttribute, 'call', _303 => _303("hangul")]);
24667
+ const hangul = _optionalChain([fontRef, 'optionalAccess', _319 => _319.getAttribute, 'call', _320 => _320("hangul")]);
24418
24668
  if (hangul) def.fontRef_hangul = hangul;
24419
24669
  map.set(id, def);
24420
24670
  }
@@ -24438,7 +24688,7 @@ function parseTable3(tbl2, tableIndex, borderFills, charPrs) {
24438
24688
  const rows = _nullishCoalesce(num(tbl2.getAttribute("rowCnt")), () => ( 0));
24439
24689
  const cols = _nullishCoalesce(num(tbl2.getAttribute("colCnt")), () => ( 0));
24440
24690
  const sz = findChildByLocalName(tbl2, "sz");
24441
- const width = _optionalChain([sz, 'optionalAccess', _304 => _304.getAttribute, 'call', _305 => _305("width")]) || void 0;
24691
+ const width = _optionalChain([sz, 'optionalAccess', _321 => _321.getAttribute, 'call', _322 => _322("width")]) || void 0;
24442
24692
  const cells = [];
24443
24693
  const usedBf = /* @__PURE__ */ new Set();
24444
24694
  const usedCp = /* @__PURE__ */ new Set();
@@ -24449,16 +24699,16 @@ function parseTable3(tbl2, tableIndex, borderFills, charPrs) {
24449
24699
  const addr = findChildByLocalName(tc2, "cellAddr");
24450
24700
  const span = findChildByLocalName(tc2, "cellSpan");
24451
24701
  const csz = findChildByLocalName(tc2, "cellSz");
24452
- const row = _nullishCoalesce(num(_optionalChain([addr, 'optionalAccess', _306 => _306.getAttribute, 'call', _307 => _307("rowAddr")])), () => ( 0));
24453
- const col = _nullishCoalesce(num(_optionalChain([addr, 'optionalAccess', _308 => _308.getAttribute, 'call', _309 => _309("colAddr")])), () => ( 0));
24702
+ const row = _nullishCoalesce(num(_optionalChain([addr, 'optionalAccess', _323 => _323.getAttribute, 'call', _324 => _324("rowAddr")])), () => ( 0));
24703
+ const col = _nullishCoalesce(num(_optionalChain([addr, 'optionalAccess', _325 => _325.getAttribute, 'call', _326 => _326("colAddr")])), () => ( 0));
24454
24704
  if (row === 0 && col === 0 && !anchorText) anchorText = directCellText(tc2);
24455
- const colSpan = _nullishCoalesce(num(_optionalChain([span, 'optionalAccess', _310 => _310.getAttribute, 'call', _311 => _311("colSpan")])), () => ( 1));
24456
- const rowSpan = _nullishCoalesce(num(_optionalChain([span, 'optionalAccess', _312 => _312.getAttribute, 'call', _313 => _313("rowSpan")])), () => ( 1));
24705
+ const colSpan = _nullishCoalesce(num(_optionalChain([span, 'optionalAccess', _327 => _327.getAttribute, 'call', _328 => _328("colSpan")])), () => ( 1));
24706
+ const rowSpan = _nullishCoalesce(num(_optionalChain([span, 'optionalAccess', _329 => _329.getAttribute, 'call', _330 => _330("rowSpan")])), () => ( 1));
24457
24707
  const bfId = tc2.getAttribute("borderFillIDRef") || void 0;
24458
24708
  const cpId = firstRunCharPr(tc2);
24459
24709
  const cell2 = { row, col, rowSpan, colSpan };
24460
- const w = _optionalChain([csz, 'optionalAccess', _314 => _314.getAttribute, 'call', _315 => _315("width")]);
24461
- const hh = _optionalChain([csz, 'optionalAccess', _316 => _316.getAttribute, 'call', _317 => _317("height")]);
24710
+ const w = _optionalChain([csz, 'optionalAccess', _331 => _331.getAttribute, 'call', _332 => _332("width")]);
24711
+ const hh = _optionalChain([csz, 'optionalAccess', _333 => _333.getAttribute, 'call', _334 => _334("height")]);
24462
24712
  if (w) cell2.width_hwpunit = w;
24463
24713
  if (hh) cell2.height_hwpunit = hh;
24464
24714
  if (bfId) {
@@ -24531,16 +24781,16 @@ function pick(map, keys) {
24531
24781
  return out;
24532
24782
  }
24533
24783
  async function hwpxToProfile(input) {
24534
- const buf = input instanceof ArrayBuffer ? input : _chunkEBSCV3JCcjs.toArrayBuffer.call(void 0, input);
24784
+ const buf = input instanceof ArrayBuffer ? input : _chunkWN7LZHIIcjs.toArrayBuffer.call(void 0, input);
24535
24785
  const zip = await _jszip2.default.loadAsync(buf);
24536
24786
  const parser = createXmlParser();
24537
- const headerFile = _nullishCoalesce(zip.file("Contents/header.xml"), () => ( _optionalChain([zip, 'access', _318 => _318.file, 'call', _319 => _319(/[Hh]eader\.xml$/), 'optionalAccess', _320 => _320[0]])));
24787
+ const headerFile = _nullishCoalesce(zip.file("Contents/header.xml"), () => ( _optionalChain([zip, 'access', _335 => _335.file, 'call', _336 => _336(/[Hh]eader\.xml$/), 'optionalAccess', _337 => _337[0]])));
24538
24788
  let headerXml = "<root/>";
24539
24789
  if (headerFile) headerXml = await headerFile.async("text");
24540
24790
  const headerDoc = parser.parseFromString(headerXml, "text/xml");
24541
24791
  const borderFills = parseBorderFills(headerDoc);
24542
24792
  const charPrs = parseCharPrs(headerDoc);
24543
- const sectionFiles = zip.file(/[Ss]ection\d+\.xml$/).sort((a, b) => (_nullishCoalesce(num(_nullishCoalesce(_optionalChain([a, 'access', _321 => _321.name, 'access', _322 => _322.match, 'call', _323 => _323(/(\d+)\.xml$/), 'optionalAccess', _324 => _324[1]]), () => ( null))), () => ( 0))) - (_nullishCoalesce(num(_nullishCoalesce(_optionalChain([b, 'access', _325 => _325.name, 'access', _326 => _326.match, 'call', _327 => _327(/(\d+)\.xml$/), 'optionalAccess', _328 => _328[1]]), () => ( null))), () => ( 0))));
24793
+ const sectionFiles = zip.file(/[Ss]ection\d+\.xml$/).sort((a, b) => (_nullishCoalesce(num(_nullishCoalesce(_optionalChain([a, 'access', _338 => _338.name, 'access', _339 => _339.match, 'call', _340 => _340(/(\d+)\.xml$/), 'optionalAccess', _341 => _341[1]]), () => ( null))), () => ( 0))) - (_nullishCoalesce(num(_nullishCoalesce(_optionalChain([b, 'access', _342 => _342.name, 'access', _343 => _343.match, 'call', _344 => _344(/(\d+)\.xml$/), 'optionalAccess', _345 => _345[1]]), () => ( null))), () => ( 0))));
24544
24794
  const tables = [];
24545
24795
  let tableIndex = 0;
24546
24796
  for (const f of sectionFiles) {
@@ -24707,6 +24957,142 @@ function unknownFontWarnings(fonts) {
24707
24957
  return warnings;
24708
24958
  }
24709
24959
 
24960
+ // src/hwpx/gongmun-lint.ts
24961
+ var RULES = [
24962
+ // 날짜 ─ 온점 뒤 한 칸, 0 패딩 금지, 연도 4자리, 끝 마침표
24963
+ {
24964
+ code: "DATE_NO_SPACE",
24965
+ severity: "error",
24966
+ pattern: /\b\d{4}\.\d{1,2}\.\d{1,2}\.?/g,
24967
+ message: "\uB0A0\uC9DC \uC628\uC810 \uB4A4\uC5D0 \uD55C \uCE78\uC529 \uB744\uC6CC\uC57C \uD568",
24968
+ suggest: "\uC608) 2025. 1. 6."
24969
+ },
24970
+ {
24971
+ code: "DATE_ZERO_PAD",
24972
+ severity: "error",
24973
+ pattern: /\b\d{4}\.\s*0\d\.|\.\s*0\d\./g,
24974
+ message: "\uC6D4\xB7\uC77C \uC55E\uC758 '0'\uC740 \uD45C\uAE30\uD558\uC9C0 \uC54A\uC74C",
24975
+ suggest: "\uC608) 2025. 1. 6. (2025. 01. 06. \u2715)"
24976
+ },
24977
+ {
24978
+ code: "DATE_2DIGIT_YR",
24979
+ severity: "error",
24980
+ pattern: /(?<!\d)['’]\d{2}\.\s*\d/g,
24981
+ message: "\uC5F0\uB3C4\uB294 \uB124 \uC790\uB9AC\uB85C \uD45C\uAE30('24 \u2715)",
24982
+ suggest: "\uC608) 2025. 1. 6."
24983
+ },
24984
+ {
24985
+ code: "DATE_NO_END_DOT",
24986
+ severity: "warning",
24987
+ pattern: /\b\d{4}\.\s\d{1,2}\.\s\d{1,2}(?!\s*[.\d(])/g,
24988
+ message: "\uB0A0\uC9DC\uC758 '\uC77C' \uB2E4\uC74C\uC5D0 \uB9C8\uCE68\uD45C(.)\uB97C \uCC0D\uC5B4\uC57C \uD568",
24989
+ suggest: "\uC608) 2025. 1. 6."
24990
+ },
24991
+ // 시간 ─ 24시각제, 쌍점 붙여쓰기
24992
+ {
24993
+ code: "TIME_AMPM",
24994
+ severity: "error",
24995
+ pattern: /(오전|오후|아침|밤|낮)\s*\d{1,2}\s*시/g,
24996
+ message: "24\uC2DC\uAC01\uC81C \uC22B\uC790\uB85C \uD45C\uAE30(\uC624\uC804/\uC624\uD6C4 \uC0AC\uC6A9 \uC548 \uD568)",
24997
+ suggest: "\uC608) 09:00, 15:30"
24998
+ },
24999
+ {
25000
+ code: "TIME_24H",
25001
+ severity: "warning",
25002
+ pattern: /(?<!\d)24\s*시(?!각)/g,
25003
+ message: "'24\uC2DC'\uBCF4\uB2E4 \uC775\uC77C 00:00 \uB610\uB294 '18:00\uAE4C\uC9C0' \uAD8C\uC7A5",
25004
+ suggest: "\uC608) 18:00"
25005
+ },
25006
+ {
25007
+ code: "TIME_COLON_SP",
25008
+ severity: "error",
25009
+ pattern: /\b\d{1,2}\s+:\s*\d{2}\b|\b\d{1,2}:\s+\d{2}\b/g,
25010
+ message: "\uC2DC\uC640 \uBD84 \uC0AC\uC774 \uC30D\uC810\uC740 \uC591\uCABD\uC744 \uBD99\uC5EC \uC500",
25011
+ suggest: "\uC608) 13:20"
25012
+ },
25013
+ // 금액 ─ '천원' 금지, 금+숫자 붙여쓰기
25014
+ {
25015
+ code: "MONEY_CHEONWON",
25016
+ severity: "error",
25017
+ pattern: /\d+\s*천\s*원/g,
25018
+ message: "\uAE08\uC561\uC740 '\uCC9C\uC6D0'\uC73C\uB85C \uC904\uC774\uC9C0 \uC54A\uACE0 \uC544\uB77C\uBE44\uC544 \uC22B\uC790\uB85C",
25019
+ suggest: "\uC608) 345,000\uC6D0"
25020
+ },
25021
+ {
25022
+ code: "MONEY_GEUM_SP",
25023
+ severity: "warning",
25024
+ pattern: /금\s+\d/g,
25025
+ message: "'\uAE08'\uACFC \uC22B\uC790 \uC0AC\uC774\uB294 \uBD99\uC5EC \uC4F0\uB294 \uAC83\uC774 \uC6D0\uCE59",
25026
+ suggest: "\uC608) \uAE08113,560\uC6D0"
25027
+ },
25028
+ // 붙임 ─ 쌍점 금지(2타 띄움)
25029
+ {
25030
+ code: "BUNIM_COLON",
25031
+ severity: "error",
25032
+ pattern: /붙\s*임\s*:/g,
25033
+ message: "'\uBD99\uC784' \uB2E4\uC74C\uC5D0 \uC30D\uC810(:)\uC744 \uBD99\uC774\uC9C0 \uC54A\uC74C(2\uD0C0 \uB744\uC6C0)",
25034
+ suggest: "\uC608) \uBD99\uC784 \uACC4\uD68D\uC11C 1\uBD80."
25035
+ },
25036
+ // 표기 ─ 물결표+까지 중복, 한글 먼저, 쌍점 띄어쓰기
25037
+ {
25038
+ code: "KKAJI_DUP",
25039
+ severity: "error",
25040
+ pattern: /[∼~~][^\n]{0,20}?까지/g,
25041
+ message: "\uBB3C\uACB0\uD45C(\u223C)\uC640 '\uAE4C\uC9C0'\uB97C \uD568\uAED8 \uC4F0\uC9C0 \uC54A\uC74C",
25042
+ suggest: "\uC608) 2. 20.\u223C2. 24."
25043
+ },
25044
+ {
25045
+ code: "FOREIGN_FIRST",
25046
+ severity: "warning",
25047
+ pattern: /\b[A-Z]{2,5}\s*\([가-힣]/g,
25048
+ message: "\uD55C\uAE00\uC744 \uBA3C\uC800 \uC4F0\uACE0 \uAD04\uD638 \uC548\uC5D0 \uC678\uAD6D\uC5B4\uB97C \uBCD1\uAE30",
25049
+ suggest: "\uC608) \uC5C5\uBB34 \uD611\uC57D(MOU)"
25050
+ },
25051
+ // 쌍점 — URL(https:// 등)·시각(13:20)은 제외
25052
+ {
25053
+ code: "COLON_SPACE",
25054
+ severity: "warning",
25055
+ pattern: /\S\s+:\S|\S:(?!\/\/)[^\s\d]/g,
25056
+ message: "\uC30D\uC810\uC740 \uC55E\uB9D0\uC5D0 \uBD99\uC774\uACE0 \uB4A4\uB294 \uD55C \uCE78 \uB744\uC6C0",
25057
+ suggest: "\uC608) \uC6D0\uC7A5: \uAE40\uAC11\uB3D9"
25058
+ }
25059
+ ];
25060
+ function lintGongmunText(text) {
25061
+ const findings = [];
25062
+ let inFence = false;
25063
+ const lines = text.split(/\r?\n/);
25064
+ for (let i = 0; i < lines.length; i++) {
25065
+ const line = lines[i];
25066
+ if (/^\s*(```|~~~)/.test(line)) {
25067
+ inFence = !inFence;
25068
+ continue;
25069
+ }
25070
+ if (inFence) continue;
25071
+ for (const r of RULES) {
25072
+ r.pattern.lastIndex = 0;
25073
+ for (const m of line.matchAll(r.pattern)) {
25074
+ findings.push({
25075
+ line: i + 1,
25076
+ match: m[0].trim(),
25077
+ rule: r.code,
25078
+ severity: r.severity,
25079
+ message: r.message,
25080
+ suggest: r.suggest
25081
+ });
25082
+ }
25083
+ }
25084
+ }
25085
+ return findings;
25086
+ }
25087
+ function gongmunLintWarnings(text, limit = 10) {
25088
+ const findings = lintGongmunText(text);
25089
+ const shown = findings.slice(0, limit).map(
25090
+ (f) => `\uD45C\uAE30\uBC95 [${f.rule}] L${f.line} "${f.match}" \u2014 ${f.message}${f.suggest ? ` (${f.suggest})` : ""}`
25091
+ );
25092
+ if (findings.length > limit) shown.push(`\uD45C\uAE30\uBC95 \uACBD\uACE0 ${findings.length - limit}\uAC74 \uB354 \uC788\uC74C \u2014 kordoc lint\uB85C \uC804\uCCB4 \uD655\uC778`);
25093
+ return shown;
25094
+ }
25095
+
24710
25096
  // src/roundtrip/patcher.ts
24711
25097
 
24712
25098
 
@@ -24715,7 +25101,7 @@ var ROW_OBJECT_RE = /<(?:[A-Za-z0-9_]+:)?(?:tbl|pic|equation|ole|container|shape
24715
25101
  var TAG_AT_RE = /<[A-Za-z0-9_:]+(?:"[^"]*"|'[^']*'|[^>"'])*>/y;
24716
25102
  function patchTableRows(input) {
24717
25103
  const { table: table2, scanTable, ctx, skip, origKeys, editedKeys } = input;
24718
- const xml = _optionalChain([ctx, 'access', _329 => _329.scans, 'access', _330 => _330[scanTable.sectionIndex], 'optionalAccess', _331 => _331.xml]);
25104
+ const xml = _optionalChain([ctx, 'access', _346 => _346.scans, 'access', _347 => _347[scanTable.sectionIndex], 'optionalAccess', _348 => _348.xml]);
24719
25105
  if (!xml) return skip("\uC139\uC158 XML \uB9E4\uD551 \uC2E4\uD328");
24720
25106
  const numRows = table2.rows;
24721
25107
  if (origKeys.length !== numRows) return skip("\uD45C \uD589 \uC88C\uD45C \uBD88\uC77C\uCE58 \u2014 \uD589 \uCD94\uAC00/\uC0AD\uC81C \uBBF8\uC9C0\uC6D0");
@@ -24882,7 +25268,7 @@ function buildRowFragment(xml, scanTable, template, cells, finalRow, hasExplicit
24882
25268
  const rr = scanTable.rowRanges[template];
24883
25269
  const wrapped = FRAG_OPEN + xml.slice(rr.start, rr.end) + FRAG_CLOSE;
24884
25270
  const scan = scanSectionXml(wrapped, 0);
24885
- const row = _optionalChain([scan, 'access', _332 => _332.tables, 'access', _333 => _333[0], 'optionalAccess', _334 => _334.rows, 'access', _335 => _335[0]]);
25271
+ const row = _optionalChain([scan, 'access', _349 => _349.tables, 'access', _350 => _350[0], 'optionalAccess', _351 => _351.rows, 'access', _352 => _352[0]]);
24886
25272
  if (!row || row.length !== cells.length) return null;
24887
25273
  const splices = allLinesegRemovalSplices(wrapped);
24888
25274
  for (let i = 0; i < cells.length; i++) {
@@ -24925,7 +25311,7 @@ function rowHeightOf(fragment) {
24925
25311
  }
24926
25312
  function tableSzHeightSplice(xml, scanTable, tblOpenLen, delta) {
24927
25313
  const from = scanTable.start + tblOpenLen;
24928
- const to = _nullishCoalesce(_optionalChain([scanTable, 'access', _336 => _336.rowRanges, 'access', _337 => _337[0], 'optionalAccess', _338 => _338.start]), () => ( from));
25314
+ const to = _nullishCoalesce(_optionalChain([scanTable, 'access', _353 => _353.rowRanges, 'access', _354 => _354[0], 'optionalAccess', _355 => _355.start]), () => ( from));
24929
25315
  const slice = xml.slice(from, to);
24930
25316
  const szM = slice.match(/<(?:[A-Za-z0-9_]+:)?sz\b(?:"[^"]*"|'[^']*'|[^>"'])*>/);
24931
25317
  if (!szM || szM.index === void 0) return null;
@@ -25114,9 +25500,9 @@ function patchHtmlTableRows(table2, scanTable, replica, editedRows, ctx, skip, d
25114
25500
  });
25115
25501
  }
25116
25502
  function patchNestedTables(table2, scanTable, oc, origTables, editedTables, ctx, skip, depth) {
25117
- const irCell = _optionalChain([table2, 'access', _339 => _339.cells, 'access', _340 => _340[oc.gridR], 'optionalAccess', _341 => _341[oc.gridC]]);
25503
+ const irCell = _optionalChain([table2, 'access', _356 => _356.cells, 'access', _357 => _357[oc.gridR], 'optionalAccess', _358 => _358[oc.gridC]]);
25118
25504
  const scanCell = scanTable.cellByAnchor.get(`${oc.gridR},${oc.gridC}`);
25119
- const nestedIRs = (_nullishCoalesce(_optionalChain([irCell, 'optionalAccess', _342 => _342.blocks]), () => ( []))).filter((b) => b.type === "table" && b.table).map((b) => b.table);
25505
+ const nestedIRs = (_nullishCoalesce(_optionalChain([irCell, 'optionalAccess', _359 => _359.blocks]), () => ( []))).filter((b) => b.type === "table" && b.table).map((b) => b.table);
25120
25506
  if (!scanCell || nestedIRs.length !== origTables.length || scanCell.tables.length !== origTables.length) {
25121
25507
  return skip("\uC911\uCCA9\uD45C \uC18C\uC2A4\uB9F5 \uB9E4\uD551 \uC2E4\uD328");
25122
25508
  }
@@ -25184,7 +25570,7 @@ function applyCellEdit(table2, scanTable, gridR, gridC, newLines, ctx, before, a
25184
25570
  };
25185
25571
  const cell2 = scanTable.cellByAnchor.get(`${gridR},${gridC}`);
25186
25572
  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)");
25187
- const irCell = _optionalChain([table2, 'access', _343 => _343.cells, 'access', _344 => _344[gridR], 'optionalAccess', _345 => _345[gridC]]);
25573
+ const irCell = _optionalChain([table2, 'access', _360 => _360.cells, 'access', _361 => _361[gridR], 'optionalAccess', _362 => _362[gridC]]);
25188
25574
  const scanJoined = cell2.paragraphs.map((p) => p.text).filter((t) => normForMatch(t)).join("\n");
25189
25575
  if (irCell && normForMatch(scanJoined) !== normForMatch(stripCellTokens(irCell.text))) {
25190
25576
  if (normForMatch(irCell.text) !== "" || normForMatch(scanJoined) !== "") {
@@ -25207,7 +25593,7 @@ function applyCellEdit(table2, scanTable, gridR, gridC, newLines, ctx, before, a
25207
25593
  if (newLines.length === 0) return 0;
25208
25594
  const target = cell2.paragraphs[0];
25209
25595
  if (!target) return skip("\uBE48 \uC140\uC5D0 \uBB38\uB2E8\uC774 \uC5C6\uC5B4 \uD14D\uC2A4\uD2B8 \uC0BD\uC785 \uBD88\uAC00");
25210
- const sp = buildParagraphSplices(target, newLines.join(" "), _optionalChain([ctx, 'access', _346 => _346.scans, 'access', _347 => _347[target.sectionIndex], 'optionalAccess', _348 => _348.xml]));
25596
+ const sp = buildParagraphSplices(target, newLines.join(" "), _optionalChain([ctx, 'access', _363 => _363.scans, 'access', _364 => _364[target.sectionIndex], 'optionalAccess', _365 => _365.xml]));
25211
25597
  if (sp === null) return skip("\uC140 \uBB38\uB2E8\uC5D0 \uD14D\uC2A4\uD2B8 \uB178\uB4DC\uB97C \uB9CC\uB4E4 \uC218 \uC5C6\uC74C");
25212
25598
  splices.push(...sp);
25213
25599
  sectionIndex = target.sectionIndex;
@@ -25230,7 +25616,7 @@ function applyCellEdit(table2, scanTable, gridR, gridC, newLines, ctx, before, a
25230
25616
  }
25231
25617
  for (let i = 0; i < nonEmpty.length; i++) {
25232
25618
  if (assigned[i] === nonEmpty[i].text || normForMatch(assigned[i]) === normForMatch(nonEmpty[i].text)) continue;
25233
- const sp = buildParagraphSplices(nonEmpty[i], assigned[i], _optionalChain([ctx, 'access', _349 => _349.scans, 'access', _350 => _350[nonEmpty[i].sectionIndex], 'optionalAccess', _351 => _351.xml]));
25619
+ const sp = buildParagraphSplices(nonEmpty[i], assigned[i], _optionalChain([ctx, 'access', _366 => _366.scans, 'access', _367 => _367[nonEmpty[i].sectionIndex], 'optionalAccess', _368 => _368.xml]));
25234
25620
  if (sp === null) return skip("\uC140 \uBB38\uB2E8\uC5D0 \uD14D\uC2A4\uD2B8 \uB178\uB4DC\uB97C \uB9CC\uB4E4 \uC218 \uC5C6\uC74C");
25235
25621
  splices.push(...sp);
25236
25622
  sectionIndex = nonEmpty[i].sectionIndex;
@@ -25311,7 +25697,7 @@ async function resolveSectionEntryNames(zip) {
25311
25697
  const paths = sectionPathsFromManifest(xml).filter((p) => zip.file(p) !== null);
25312
25698
  if (paths.length > 0) return paths;
25313
25699
  }
25314
- return Object.keys(zip.files).filter((n) => /[Ss]ection\d+\.xml$/.test(n)).sort(_chunkEBSCV3JCcjs.compareSectionPaths);
25700
+ return Object.keys(zip.files).filter((n) => /[Ss]ection\d+\.xml$/.test(n)).sort(_chunkWN7LZHIIcjs.compareSectionPaths);
25315
25701
  }
25316
25702
  function sectionPathsFromManifest(xml) {
25317
25703
  const attr = (tag, name) => {
@@ -25321,7 +25707,7 @@ function sectionPathsFromManifest(xml) {
25321
25707
  const idToHref = /* @__PURE__ */ new Map();
25322
25708
  for (const m of xml.matchAll(/<opf:item(\s(?:"[^"]*"|'[^']*'|[^>"'])*?)\/?>/g)) {
25323
25709
  const id = attr(m[1], "id");
25324
- const href = _chunkEBSCV3JCcjs.normalizeSectionHref.call(void 0, attr(m[1], "href"));
25710
+ const href = _chunkWN7LZHIIcjs.normalizeSectionHref.call(void 0, attr(m[1], "href"));
25325
25711
  if (id && href) idToHref.set(id, href);
25326
25712
  }
25327
25713
  const ordered = [];
@@ -25330,7 +25716,7 @@ function sectionPathsFromManifest(xml) {
25330
25716
  if (href) ordered.push(href);
25331
25717
  }
25332
25718
  if (ordered.length > 0) return ordered;
25333
- return Array.from(idToHref.values()).sort(_chunkEBSCV3JCcjs.compareSectionPaths);
25719
+ return Array.from(idToHref.values()).sort(_chunkWN7LZHIIcjs.compareSectionPaths);
25334
25720
  }
25335
25721
 
25336
25722
  // src/roundtrip/patcher.ts
@@ -25422,7 +25808,7 @@ async function patchHwpx(original, editedMarkdown, options) {
25422
25808
  }
25423
25809
  }
25424
25810
  let verification;
25425
- if (_optionalChain([options, 'optionalAccess', _352 => _352.verify]) !== false) {
25811
+ if (_optionalChain([options, 'optionalAccess', _369 => _369.verify]) !== false) {
25426
25812
  try {
25427
25813
  const reparsed = await parseHwpxDocument(u8ToArrayBuffer(data));
25428
25814
  verification = diffUnitLists(splitMarkdownUnits(reparsed.markdown), editedUnits);
@@ -25440,17 +25826,17 @@ function buildOrigUnits(blocks) {
25440
25826
  let chunk2;
25441
25827
  if (block.type === "paragraph" && block.text && /^\[별표\s*\d+/.test(sanitizeText(block.text))) {
25442
25828
  const next = blocks[i + 1];
25443
- if (_optionalChain([next, 'optionalAccess', _353 => _353.type]) === "paragraph" && next.text && /관련\)?$/.test(next.text)) consume = 2;
25444
- chunk2 = _chunkEBSCV3JCcjs.blocksToMarkdown.call(void 0, blocks.slice(i, i + consume));
25829
+ if (_optionalChain([next, 'optionalAccess', _370 => _370.type]) === "paragraph" && next.text && /관련\)?$/.test(next.text)) consume = 2;
25830
+ chunk2 = _chunkWN7LZHIIcjs.blocksToMarkdown.call(void 0, blocks.slice(i, i + consume));
25445
25831
  } else {
25446
- chunk2 = _chunkEBSCV3JCcjs.blocksToMarkdown.call(void 0, [block]);
25832
+ chunk2 = _chunkWN7LZHIIcjs.blocksToMarkdown.call(void 0, [block]);
25447
25833
  }
25448
25834
  if (chunk2) {
25449
25835
  const subUnits = splitMarkdownUnits(chunk2);
25450
25836
  const isFragment = consume === 2 || (block.type === "paragraph" || block.type === "heading") && subUnits.length > 1;
25451
25837
  for (let s = 0; s < subUnits.length; s++) {
25452
25838
  const u = { ...subUnits[s], blockIdx: i, fragment: isFragment || void 0 };
25453
- if (block.type === "table" && _optionalChain([block, 'access', _354 => _354.table, 'optionalAccess', _355 => _355.caption]) && s === 0 && subUnits.length > 1 && u.kind === "text" && u.raw.startsWith("**")) {
25839
+ if (block.type === "table" && _optionalChain([block, 'access', _371 => _371.table, 'optionalAccess', _372 => _372.caption]) && s === 0 && subUnits.length > 1 && u.kind === "text" && u.raw.startsWith("**")) {
25454
25840
  u.role = "caption";
25455
25841
  }
25456
25842
  units.push(u);
@@ -25561,7 +25947,7 @@ function convertParagraphToTable(block, orig, edited, ctx, skip) {
25561
25947
  const ti = ctx.tableInsert;
25562
25948
  if (!ti) return skip("\uBB38\uB2E8\u2192\uD45C \uBCC0\uD658 \uBD88\uAC00 \u2014 header \uC5D4\uD2B8\uB9AC(borderFills) \uD574\uC11D \uC2E4\uD328");
25563
25949
  const mapping = ctx.paraMap.get(orig.blockIdx);
25564
- if (!_optionalChain([mapping, 'optionalAccess', _356 => _356.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");
25950
+ 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) \u2014 \uD45C \uBCC0\uD658 \uBD88\uAC00");
25565
25951
  const para2 = mapping.para;
25566
25952
  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");
25567
25953
  const scan = ctx.scans[para2.sectionIndex];
@@ -25589,7 +25975,7 @@ function convertParagraphToTable(block, orig, edited, ctx, skip) {
25589
25975
  }
25590
25976
  function patchParagraphUnit(block, orig, edited, ctx, skip) {
25591
25977
  const mapping = ctx.paraMap.get(orig.blockIdx);
25592
- if (!_optionalChain([mapping, 'optionalAccess', _357 => _357.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)");
25978
+ if (!_optionalChain([mapping, 'optionalAccess', _374 => _374.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)");
25593
25979
  if (block.text && block.text.includes("\n")) {
25594
25980
  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)");
25595
25981
  }
@@ -25620,7 +26006,7 @@ function patchParagraphUnit(block, orig, edited, ctx, skip) {
25620
26006
  if (sanitizeText(newPlain) !== newPlain) {
25621
26007
  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");
25622
26008
  }
25623
- const splices = buildParagraphSplices(mapping.para, newPlain, _optionalChain([ctx, 'access', _358 => _358.scans, 'access', _359 => _359[mapping.para.sectionIndex], 'optionalAccess', _360 => _360.xml]));
26009
+ const splices = buildParagraphSplices(mapping.para, newPlain, _optionalChain([ctx, 'access', _375 => _375.scans, 'access', _376 => _376[mapping.para.sectionIndex], 'optionalAccess', _377 => _377.xml]));
25624
26010
  if (splices === null) return skip("\uBB38\uB2E8\uC5D0 \uD14D\uC2A4\uD2B8 \uB178\uB4DC\uB97C \uB9CC\uB4E4 \uC218 \uC5C6\uC74C");
25625
26011
  ctx.sectionSplices[mapping.para.sectionIndex].push(...splices);
25626
26012
  return 1;
@@ -25806,7 +26192,7 @@ var Surgeon = (_class5 = class {
25806
26192
  /** 디렉토리 트리에서 경로 해석 (형제 = L/R 이진 트리, 자식 = child) */
25807
26193
  findEntry(path) {
25808
26194
  const parts = path.replace(/^\//, "").split("/");
25809
- let scope = _nullishCoalesce(_optionalChain([this, 'access', _361 => _361.entries, 'access', _362 => _362[0], 'optionalAccess', _363 => _363.child]), () => ( -1));
26195
+ let scope = _nullishCoalesce(_optionalChain([this, 'access', _378 => _378.entries, 'access', _379 => _379[0], 'optionalAccess', _380 => _380.child]), () => ( -1));
25810
26196
  let current;
25811
26197
  for (const part of parts) {
25812
26198
  const search = (idx) => {
@@ -26019,8 +26405,8 @@ function serializeRecords(recs, repl, inserts) {
26019
26405
  parts.push(header, data);
26020
26406
  };
26021
26407
  for (let i = 0; i < recs.length; i++) {
26022
- for (const ins of _nullishCoalesce(_optionalChain([inserts, 'optionalAccess', _364 => _364.get, 'call', _365 => _365(i)]), () => ( []))) push(ins.tagId, ins.level, ins.data);
26023
- push(recs[i].tagId, recs[i].level, _nullishCoalesce(_optionalChain([repl, 'optionalAccess', _366 => _366.get, 'call', _367 => _367(i)]), () => ( recs[i].data)));
26408
+ for (const ins of _nullishCoalesce(_optionalChain([inserts, 'optionalAccess', _381 => _381.get, 'call', _382 => _382(i)]), () => ( []))) push(ins.tagId, ins.level, ins.data);
26409
+ push(recs[i].tagId, recs[i].level, _nullishCoalesce(_optionalChain([repl, 'optionalAccess', _383 => _383.get, 'call', _384 => _384(i)]), () => ( recs[i].data)));
26024
26410
  }
26025
26411
  return Buffer.concat(parts);
26026
26412
  }
@@ -26138,7 +26524,7 @@ async function patchHwp(original, editedMarkdown, options) {
26138
26524
  return fail(`CFB \uCEE8\uD14C\uC774\uB108 \uD30C\uC2F1 \uC2E4\uD328: ${msg(err)}`);
26139
26525
  }
26140
26526
  const fhEntry = CFB2.find(cfb, "/FileHeader");
26141
- if (!_optionalChain([fhEntry, 'optionalAccess', _368 => _368.content])) return fail("FileHeader \uC2A4\uD2B8\uB9BC\uC774 \uC5C6\uC2B5\uB2C8\uB2E4 \u2014 HWP 5.x \uD30C\uC77C\uC774 \uC544\uB2D9\uB2C8\uB2E4");
26527
+ if (!_optionalChain([fhEntry, 'optionalAccess', _385 => _385.content])) return fail("FileHeader \uC2A4\uD2B8\uB9BC\uC774 \uC5C6\uC2B5\uB2C8\uB2E4 \u2014 HWP 5.x \uD30C\uC77C\uC774 \uC544\uB2D9\uB2C8\uB2E4");
26142
26528
  let flags;
26143
26529
  try {
26144
26530
  flags = parseFileHeader(Buffer.from(fhEntry.content)).flags;
@@ -26160,7 +26546,7 @@ async function patchHwp(original, editedMarkdown, options) {
26160
26546
  const scans = [];
26161
26547
  for (let i = 0; i < sectionPaths.length; i++) {
26162
26548
  const entry = CFB2.find(cfb, sectionPaths[i]);
26163
- if (!_optionalChain([entry, 'optionalAccess', _369 => _369.content])) return fail(`\uC139\uC158 \uC2A4\uD2B8\uB9BC \uC77D\uAE30 \uC2E4\uD328: ${sectionPaths[i]}`);
26549
+ if (!_optionalChain([entry, 'optionalAccess', _386 => _386.content])) return fail(`\uC139\uC158 \uC2A4\uD2B8\uB9BC \uC77D\uAE30 \uC2E4\uD328: ${sectionPaths[i]}`);
26164
26550
  let stream;
26165
26551
  try {
26166
26552
  stream = compressed ? decompressStream(Buffer.from(entry.content)) : Buffer.from(entry.content);
@@ -26211,7 +26597,7 @@ async function patchHwp(original, editedMarkdown, options) {
26211
26597
  }
26212
26598
  }
26213
26599
  let verification;
26214
- if (_optionalChain([options, 'optionalAccess', _370 => _370.verify]) !== false) {
26600
+ if (_optionalChain([options, 'optionalAccess', _387 => _387.verify]) !== false) {
26215
26601
  try {
26216
26602
  const reparsed = parseHwp5Document(Buffer.from(data));
26217
26603
  const normBr = (u) => ({ ...u, raw: u.raw.replace(/<br\s*\/?\s*>/gi, "\n") });
@@ -26301,7 +26687,7 @@ function tableContentScore(irTable, scanTable) {
26301
26687
  for (const [key, scanCell] of scanTable.cells) {
26302
26688
  const comma = key.indexOf(",");
26303
26689
  const r = Number(key.slice(0, comma)), c = Number(key.slice(comma + 1));
26304
- const irCell = _optionalChain([irTable, 'access', _371 => _371.cells, 'access', _372 => _372[r], 'optionalAccess', _373 => _373[c]]);
26690
+ const irCell = _optionalChain([irTable, 'access', _388 => _388.cells, 'access', _389 => _389[r], 'optionalAccess', _390 => _390[c]]);
26305
26691
  if (!irCell) continue;
26306
26692
  const a = normForMatch(scanCell.paras.map((p) => p.rawText).join(" "));
26307
26693
  const b = normForMatch(stripCellTokens(irCell.text));
@@ -26337,7 +26723,7 @@ function handleModified(orig, edited, ctx) {
26337
26723
  }
26338
26724
  function patchParagraph(block, orig, edited, ctx, skip) {
26339
26725
  const mapping = ctx.paraMap.get(orig.blockIdx);
26340
- if (!_optionalChain([mapping, 'optionalAccess', _374 => _374.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)");
26726
+ if (!_optionalChain([mapping, 'optionalAccess', _391 => _391.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)");
26341
26727
  const restoreBr = (s) => s.replace(/(?:\s*<br\s*\/?\s*>\s*)+/gi, "\n");
26342
26728
  let newPlain = restoreBr(textUnitToPlain(edited.raw, block));
26343
26729
  if (block.text && block.text.includes("\n") && !newPlain.includes("\n")) {
@@ -26536,7 +26922,7 @@ function applyCellEdit5(table2, scanTable, gridR, gridC, newLines, ctx, before,
26536
26922
  };
26537
26923
  const cell2 = scanTable.cells.get(`${gridR},${gridC}`);
26538
26924
  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)");
26539
- const irCell = _optionalChain([table2, 'access', _375 => _375.cells, 'access', _376 => _376[gridR], 'optionalAccess', _377 => _377[gridC]]);
26925
+ const irCell = _optionalChain([table2, 'access', _392 => _392.cells, 'access', _393 => _393[gridR], 'optionalAccess', _394 => _394[gridC]]);
26540
26926
  const scanJoined = cell2.paras.map((p) => p.rawText).filter((t) => normForMatch(t)).join("\n");
26541
26927
  if (irCell && normForMatch(scanJoined) !== normForMatch(stripCellTokens(irCell.text))) {
26542
26928
  if (normForMatch(irCell.text) !== "" || normForMatch(scanJoined) !== "") {
@@ -26928,7 +27314,7 @@ var HwpxSession = (_class6 = class _HwpxSession {
26928
27314
  const block = st.blocks[blockIndex];
26929
27315
  if (!block) return void 0;
26930
27316
  if (block.type === "paragraph" || block.type === "heading") {
26931
- const para2 = _optionalChain([st, 'access', _378 => _378.paraMap, 'access', _379 => _379.get, 'call', _380 => _380(blockIndex), 'optionalAccess', _381 => _381.para]);
27317
+ const para2 = _optionalChain([st, 'access', _395 => _395.paraMap, 'access', _396 => _396.get, 'call', _397 => _397(blockIndex), 'optionalAccess', _398 => _398.para]);
26932
27318
  if (!para2) return void 0;
26933
27319
  return { kind: "paragraph", sectionIndex: para2.sectionIndex, xmlStart: para2.start };
26934
27320
  }
@@ -26953,7 +27339,7 @@ var HwpxSession = (_class6 = class _HwpxSession {
26953
27339
  if (block.text && block.text.includes("\n")) {
26954
27340
  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)" };
26955
27341
  }
26956
- if (!_optionalChain([st, 'access', _382 => _382.paraMap, 'access', _383 => _383.get, 'call', _384 => _384(blockIndex), 'optionalAccess', _385 => _385.para])) {
27342
+ if (!_optionalChain([st, 'access', _399 => _399.paraMap, 'access', _400 => _400.get, 'call', _401 => _401(blockIndex), 'optionalAccess', _402 => _402.para])) {
26957
27343
  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)" };
26958
27344
  }
26959
27345
  return { capability: "text" };
@@ -27019,7 +27405,7 @@ var HwpxSession = (_class6 = class _HwpxSession {
27019
27405
  continue;
27020
27406
  }
27021
27407
  if (block.type === "table" && block.table) {
27022
- if (!_optionalChain([edit, 'access', _386 => _386.cells, 'optionalAccess', _387 => _387.length])) {
27408
+ if (!_optionalChain([edit, 'access', _403 => _403.cells, 'optionalAccess', _404 => _404.length])) {
27023
27409
  skipped.push({ reason: "\uD45C \uBE14\uB85D\uC5D0\uB294 cells \uD3B8\uC9D1\uB9CC \uC9C0\uC6D0", before: summarize(_nullishCoalesce(block.table.caption, () => ( "(\uD45C)"))) });
27024
27410
  continue;
27025
27411
  }
@@ -27039,7 +27425,7 @@ var HwpxSession = (_class6 = class _HwpxSession {
27039
27425
  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) });
27040
27426
  continue;
27041
27427
  }
27042
- const irCell = _optionalChain([block, 'access', _388 => _388.table, 'access', _389 => _389.cells, 'access', _390 => _390[cellEdit.row], 'optionalAccess', _391 => _391[cellEdit.col]]);
27428
+ const irCell = _optionalChain([block, 'access', _405 => _405.table, 'access', _406 => _406.cells, 'access', _407 => _407[cellEdit.row], 'optionalAccess', _408 => _408[cellEdit.col]]);
27043
27429
  if (!irCell) {
27044
27430
  skipped.push({ reason: `\uC140 \uC88C\uD45C \uBC94\uC704 \uBC16: ${cellEdit.row},${cellEdit.col}`, after: summarize(cellEdit.text) });
27045
27431
  continue;
@@ -27095,7 +27481,7 @@ var HwpxSession = (_class6 = class _HwpxSession {
27095
27481
  }
27096
27482
  if (replacements.size === 0) {
27097
27483
  let changes2;
27098
- if (_optionalChain([options, 'optionalAccess', _392 => _392.verify]) !== false) {
27484
+ if (_optionalChain([options, 'optionalAccess', _409 => _409.verify]) !== false) {
27099
27485
  const units = splitMarkdownUnits(st.markdown);
27100
27486
  changes2 = diffUnitLists(units, units);
27101
27487
  }
@@ -27116,7 +27502,7 @@ var HwpxSession = (_class6 = class _HwpxSession {
27116
27502
  }
27117
27503
  this.state = newState;
27118
27504
  let changes;
27119
- if (_optionalChain([options, 'optionalAccess', _393 => _393.verify]) !== false) {
27505
+ if (_optionalChain([options, 'optionalAccess', _410 => _410.verify]) !== false) {
27120
27506
  changes = diffUnitLists(splitMarkdownUnits(beforeMarkdown), splitMarkdownUnits(newState.markdown));
27121
27507
  }
27122
27508
  return { success: true, data: new Uint8Array(data), applied, skipped, changes };
@@ -27136,7 +27522,7 @@ var HwpxSession = (_class6 = class _HwpxSession {
27136
27522
  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)");
27137
27523
  }
27138
27524
  const mapping = st.paraMap.get(blockIndex);
27139
- if (!_optionalChain([mapping, 'optionalAccess', _394 => _394.para])) {
27525
+ if (!_optionalChain([mapping, 'optionalAccess', _411 => _411.para])) {
27140
27526
  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)");
27141
27527
  }
27142
27528
  let newPlain = newTextRaw.split("\n").map((l) => l.trim()).filter(Boolean).join(" ");
@@ -27156,14 +27542,14 @@ var HwpxSession = (_class6 = class _HwpxSession {
27156
27542
  if (sanitizeText(newPlain) !== newPlain) {
27157
27543
  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");
27158
27544
  }
27159
- const splices = buildParagraphSplices(mapping.para, newPlain, _optionalChain([st, 'access', _395 => _395.scans, 'access', _396 => _396[mapping.para.sectionIndex], 'optionalAccess', _397 => _397.xml]));
27545
+ const splices = buildParagraphSplices(mapping.para, newPlain, _optionalChain([st, 'access', _412 => _412.scans, 'access', _413 => _413[mapping.para.sectionIndex], 'optionalAccess', _414 => _414.xml]));
27160
27546
  if (splices === null) return skip("\uBB38\uB2E8\uC5D0 \uD14D\uC2A4\uD2B8 \uB178\uB4DC\uB97C \uB9CC\uB4E4 \uC218 \uC5C6\uC74C");
27161
27547
  sectionSplices[mapping.para.sectionIndex].push(...splices);
27162
27548
  return 1;
27163
27549
  }
27164
27550
  }, _class6);
27165
27551
  function cellStaticCheck(table2, scanTable, r, c) {
27166
- const irCell = _optionalChain([table2, 'access', _398 => _398.cells, 'access', _399 => _399[r], 'optionalAccess', _400 => _400[c]]);
27552
+ const irCell = _optionalChain([table2, 'access', _415 => _415.cells, 'access', _416 => _416[r], 'optionalAccess', _417 => _417[c]]);
27167
27553
  if (!irCell) return { editable: false, reason: "\uC140 \uC88C\uD45C \uBC94\uC704 \uBC16" };
27168
27554
  const cell2 = scanTable.cellByAnchor.get(`${r},${c}`);
27169
27555
  if (!cell2) return { editable: false, reason: "\uBCD1\uD569 \uC601\uC5ED\uC758 \uBE48 \uCE78\uC774\uAC70\uB098 \uC88C\uD45C \uBD88\uC77C\uCE58" };
@@ -27247,11 +27633,11 @@ var md = new (0, _markdownit2.default)({
27247
27633
  breaks: false
27248
27634
  });
27249
27635
  function renderHtml(markdown, options) {
27250
- const preset = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _401 => _401.preset]), () => ( "default"));
27251
- const css = PRESETS[preset] + (_nullishCoalesce(_optionalChain([options, 'optionalAccess', _402 => _402.extraCss]), () => ( "")));
27636
+ const preset = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _418 => _418.preset]), () => ( "default"));
27637
+ const css = PRESETS[preset] + (_nullishCoalesce(_optionalChain([options, 'optionalAccess', _419 => _419.extraCss]), () => ( "")));
27252
27638
  const body = md.render(markdown);
27253
- const watermark = _optionalChain([options, 'optionalAccess', _403 => _403.watermark]) ? `<div class="watermark">${escapeHtml(options.watermark)}</div>` : "";
27254
- const watermarkCss = _optionalChain([options, 'optionalAccess', _404 => _404.watermark]) ? `
27639
+ const watermark = _optionalChain([options, 'optionalAccess', _420 => _420.watermark]) ? `<div class="watermark">${escapeHtml(options.watermark)}</div>` : "";
27640
+ const watermarkCss = _optionalChain([options, 'optionalAccess', _421 => _421.watermark]) ? `
27255
27641
  .watermark {
27256
27642
  position: fixed;
27257
27643
  top: 50%; left: 50%;
@@ -27282,13 +27668,13 @@ async function htmlToPdf(html, options) {
27282
27668
  try {
27283
27669
  puppeteer = await Promise.resolve().then(() => _interopRequireWildcard(require("puppeteer-core")));
27284
27670
  } catch (e30) {
27285
- throw new (0, _chunkEBSCV3JCcjs.KordocError)(
27671
+ throw new (0, _chunkWN7LZHIIcjs.KordocError)(
27286
27672
  "PDF \uC0DD\uC131\uC5D0 puppeteer-core\uAC00 \uD544\uC694\uD569\uB2C8\uB2E4. \uC124\uCE58: npm install puppeteer-core"
27287
27673
  );
27288
27674
  }
27289
27675
  const executablePath = _nullishCoalesce(process.env.PUPPETEER_EXECUTABLE_PATH, () => ( findChromiumPath()));
27290
27676
  if (!executablePath) {
27291
- throw new (0, _chunkEBSCV3JCcjs.KordocError)(
27677
+ throw new (0, _chunkWN7LZHIIcjs.KordocError)(
27292
27678
  "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."
27293
27679
  );
27294
27680
  }
@@ -27300,10 +27686,10 @@ async function htmlToPdf(html, options) {
27300
27686
  try {
27301
27687
  const page = await browser.newPage();
27302
27688
  await page.setContent(html, { waitUntil: "networkidle0" });
27303
- const margin = _optionalChain([options, 'optionalAccess', _405 => _405.margin]);
27689
+ const margin = _optionalChain([options, 'optionalAccess', _422 => _422.margin]);
27304
27690
  const pdf = await page.pdf({
27305
- format: _nullishCoalesce(_optionalChain([options, 'optionalAccess', _406 => _406.pageSize]), () => ( "A4")),
27306
- landscape: _optionalChain([options, 'optionalAccess', _407 => _407.orientation]) === "landscape",
27691
+ format: _nullishCoalesce(_optionalChain([options, 'optionalAccess', _423 => _423.pageSize]), () => ( "A4")),
27692
+ landscape: _optionalChain([options, 'optionalAccess', _424 => _424.orientation]) === "landscape",
27307
27693
  printBackground: true,
27308
27694
  margin: margin ? {
27309
27695
  top: toCss(margin.top),
@@ -27311,9 +27697,9 @@ async function htmlToPdf(html, options) {
27311
27697
  bottom: toCss(margin.bottom),
27312
27698
  left: toCss(margin.left)
27313
27699
  } : void 0,
27314
- displayHeaderFooter: !!(_optionalChain([options, 'optionalAccess', _408 => _408.header]) || _optionalChain([options, 'optionalAccess', _409 => _409.footer])),
27315
- headerTemplate: _nullishCoalesce(_optionalChain([options, 'optionalAccess', _410 => _410.header]), () => ( "<div></div>")),
27316
- footerTemplate: _nullishCoalesce(_optionalChain([options, 'optionalAccess', _411 => _411.footer]), () => ( '<div style="font-size:8pt;width:100%;text-align:center;color:#777;"><span class="pageNumber"></span>/<span class="totalPages"></span></div>'))
27700
+ displayHeaderFooter: !!(_optionalChain([options, 'optionalAccess', _425 => _425.header]) || _optionalChain([options, 'optionalAccess', _426 => _426.footer])),
27701
+ headerTemplate: _nullishCoalesce(_optionalChain([options, 'optionalAccess', _427 => _427.header]), () => ( "<div></div>")),
27702
+ footerTemplate: _nullishCoalesce(_optionalChain([options, 'optionalAccess', _428 => _428.footer]), () => ( '<div style="font-size:8pt;width:100%;text-align:center;color:#777;"><span class="pageNumber"></span>/<span class="totalPages"></span></div>'))
27317
27703
  });
27318
27704
  return Buffer.from(pdf);
27319
27705
  } finally {
@@ -27347,7 +27733,7 @@ async function markdownToPdf(markdown, options) {
27347
27733
  return htmlToPdf(html, options);
27348
27734
  }
27349
27735
  async function blocksToPdf(blocks, options) {
27350
- const markdown = _chunkEBSCV3JCcjs.blocksToMarkdown.call(void 0, blocks);
27736
+ const markdown = _chunkWN7LZHIIcjs.blocksToMarkdown.call(void 0, blocks);
27351
27737
  return markdownToPdf(markdown, options);
27352
27738
  }
27353
27739
 
@@ -27558,7 +27944,7 @@ function reflowBlockFlow(container, doc, styles, areaW, mode, counter, bodyH) {
27558
27944
  if (ln(p) !== "p") continue;
27559
27945
  reflowTablesIn(p, doc, styles, mode, counter);
27560
27946
  const g = styles.paraGeom.get(_nullishCoalesce(p.getAttribute("paraPrIDRef"), () => ( "")));
27561
- const startV = cursorV + prevSpaceAfter + (_nullishCoalesce(_optionalChain([g, 'optionalAccess', _412 => _412.spaceBefore]), () => ( 0)));
27947
+ const startV = cursorV + prevSpaceAfter + (_nullishCoalesce(_optionalChain([g, 'optionalAccess', _429 => _429.spaceBefore]), () => ( 0)));
27562
27948
  const res = reflowPara(p, doc, styles, areaW, startV, mode);
27563
27949
  if (res) {
27564
27950
  const paraH = res.paraBottom - startV;
@@ -27667,7 +28053,7 @@ function buildPara(p) {
27667
28053
  el: ch,
27668
28054
  tag: cn,
27669
28055
  index: chars.length,
27670
- inline: _optionalChain([pos, 'optionalAccess', _413 => _413.getAttribute, 'call', _414 => _414("treatAsChar")]) === "1",
28056
+ inline: _optionalChain([pos, 'optionalAccess', _430 => _430.getAttribute, 'call', _431 => _431("treatAsChar")]) === "1",
27671
28057
  width: w,
27672
28058
  height: h
27673
28059
  });
@@ -27919,15 +28305,15 @@ function drawShape(o, x, y, ctx, depth) {
27919
28305
  const sx = ow > 0 ? w / ow : 1;
27920
28306
  const sy = oh > 0 ? h / oh : 1;
27921
28307
  const lineShape = findChildByLocalName(el, "lineShape");
27922
- const lstyle = _nullishCoalesce(_optionalChain([lineShape, 'optionalAccess', _415 => _415.getAttribute, 'call', _416 => _416("style")]), () => ( "SOLID"));
27923
- const strokeCol = _optionalChain([lineShape, 'optionalAccess', _417 => _417.getAttribute, 'call', _418 => _418("color")]) || "#000000";
28308
+ const lstyle = _nullishCoalesce(_optionalChain([lineShape, 'optionalAccess', _432 => _432.getAttribute, 'call', _433 => _433("style")]), () => ( "SOLID"));
28309
+ const strokeCol = _optionalChain([lineShape, 'optionalAccess', _434 => _434.getAttribute, 'call', _435 => _435("color")]) || "#000000";
27924
28310
  const hasStroke = lstyle !== "NONE";
27925
28311
  const strokeW = hasStroke ? shapeStrokePt(lineShape ? num3(lineShape, "width") : 33) : 0;
27926
28312
  const dash = /DASH|DOT/.test(lstyle) ? ` stroke-dasharray="${lstyle.includes("DOT") ? "1,1.5" : "3,1.5"}"` : "";
27927
28313
  const strokeAttr = hasStroke ? ` stroke="${escapeXml3(strokeCol)}" stroke-width="${strokeW.toFixed(2)}"${dash}` : "";
27928
28314
  const fillBrush = findChildByLocalName(el, "fillBrush");
27929
28315
  const winBrush = fillBrush ? findChildByLocalName(fillBrush, "winBrush") : null;
27930
- const face = _optionalChain([winBrush, 'optionalAccess', _419 => _419.getAttribute, 'call', _420 => _420("faceColor")]);
28316
+ const face = _optionalChain([winBrush, 'optionalAccess', _436 => _436.getAttribute, 'call', _437 => _437("faceColor")]);
27931
28317
  const fill = face && face.toLowerCase() !== "none" ? face : "none";
27932
28318
  const fillAttr = ` fill="${fill === "none" ? "none" : escapeXml3(fill)}"`;
27933
28319
  if (o.tag === "rect") {
@@ -27959,7 +28345,7 @@ function cellContentExtent(cell2) {
27959
28345
  if (ln2(p) !== "p") continue;
27960
28346
  const m = buildPara(p);
27961
28347
  for (const s of m.segs) ext = Math.max(ext, s.vertpos + s.textheight);
27962
- const baseV = _nullishCoalesce(_optionalChain([m, 'access', _421 => _421.segs, 'access', _422 => _422[0], 'optionalAccess', _423 => _423.vertpos]), () => ( 0));
28348
+ const baseV = _nullishCoalesce(_optionalChain([m, 'access', _438 => _438.segs, 'access', _439 => _439[0], 'optionalAccess', _440 => _440.vertpos]), () => ( 0));
27963
28349
  for (const o of m.objs) {
27964
28350
  if (o.inline) {
27965
28351
  const h = o.tag === "tbl" ? Math.max(o.height, measureTableHeight(o.el)) : o.height;
@@ -27967,7 +28353,7 @@ function cellContentExtent(cell2) {
27967
28353
  continue;
27968
28354
  }
27969
28355
  const pos = findChildByLocalName(o.el, "pos");
27970
- if ((_nullishCoalesce(_optionalChain([pos, 'optionalAccess', _424 => _424.getAttribute, 'call', _425 => _425("vertRelTo")]), () => ( "PARA"))) !== "PARA") continue;
28356
+ if ((_nullishCoalesce(_optionalChain([pos, 'optionalAccess', _441 => _441.getAttribute, 'call', _442 => _442("vertRelTo")]), () => ( "PARA"))) !== "PARA") continue;
27971
28357
  const om = findChildByLocalName(o.el, "outMargin");
27972
28358
  const pushed = baseV - (num3(om, "top") + o.height + num3(om, "bottom"));
27973
28359
  const anchor = pushed >= -100 ? pushed : baseV;
@@ -28053,7 +28439,7 @@ function drawTable(tbl2, tx, ty, ctx, depth) {
28053
28439
  }));
28054
28440
  for (const g of geom) {
28055
28441
  const bf = g.c.bfId != null ? ctx.styles.borderFill.get(g.c.bfId) : void 0;
28056
- if (_optionalChain([bf, 'optionalAccess', _426 => _426.fill])) emit(ctx, `<rect x="${pt(g.x)}" y="${pt(g.y)}" width="${pt(g.w)}" height="${pt(g.h)}" fill="${escapeXml3(bf.fill)}"/>`);
28442
+ if (_optionalChain([bf, 'optionalAccess', _443 => _443.fill])) emit(ctx, `<rect x="${pt(g.x)}" y="${pt(g.y)}" width="${pt(g.w)}" height="${pt(g.h)}" fill="${escapeXml3(bf.fill)}"/>`);
28057
28443
  }
28058
28444
  for (const g of geom) {
28059
28445
  const { c } = g;
@@ -28091,7 +28477,7 @@ function drawPic(pic, x, y, ctx) {
28091
28477
  const sz = findChildByLocalName(pic, "sz");
28092
28478
  const w = num3(sz, "width", 5669), h = num3(sz, "height", 5669);
28093
28479
  const img = findFirst(pic, "img");
28094
- const ref = _optionalChain([img, 'optionalAccess', _427 => _427.getAttribute, 'call', _428 => _428("binaryItemIDRef")]);
28480
+ const ref = _optionalChain([img, 'optionalAccess', _444 => _444.getAttribute, 'call', _445 => _445("binaryItemIDRef")]);
28095
28481
  const loaded = ref != null ? ctx.images.get(ref) : void 0;
28096
28482
  if (!loaded) {
28097
28483
  emit(ctx, `<rect x="${pt(x)}" y="${pt(y)}" width="${pt(w)}" height="${pt(h)}" fill="#eee" stroke="#c00" stroke-width="0.5"/>`);
@@ -28130,7 +28516,7 @@ function readSectionGeom(root) {
28130
28516
  const pagePr = findFirst(root, "pagePr");
28131
28517
  const margin = pagePr ? findChildByLocalName(pagePr, "margin") : null;
28132
28518
  let PW = num3(pagePr, "width", 59528), PH = num3(pagePr, "height", 84188);
28133
- if (_optionalChain([pagePr, 'optionalAccess', _429 => _429.getAttribute, 'call', _430 => _430("landscape")]) === "NARROWLY" && PW < PH) {
28519
+ if (_optionalChain([pagePr, 'optionalAccess', _446 => _446.getAttribute, 'call', _447 => _447("landscape")]) === "NARROWLY" && PW < PH) {
28134
28520
  const t = PW;
28135
28521
  PW = PH;
28136
28522
  PH = t;
@@ -28188,17 +28574,17 @@ function renderSectionToPages(root, geom, ctxBase, hasCache, reflowMode) {
28188
28574
  return { pages: ctx.pages, pageH };
28189
28575
  }
28190
28576
  async function renderHwpxToSvg(input, options) {
28191
- const maxImg = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _431 => _431.maxImageBytes]), () => ( 40 * 1024 * 1024));
28577
+ const maxImg = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _448 => _448.maxImageBytes]), () => ( 40 * 1024 * 1024));
28192
28578
  const ab = input instanceof Uint8Array ? input.buffer.slice(input.byteOffset, input.byteOffset + input.byteLength) : input;
28193
- _chunkEBSCV3JCcjs.precheckZipSize.call(void 0, ab, MAX_DECOMPRESS_SIZE, MAX_ZIP_ENTRIES);
28579
+ _chunkWN7LZHIIcjs.precheckZipSize.call(void 0, ab, MAX_DECOMPRESS_SIZE, MAX_ZIP_ENTRIES);
28194
28580
  let zip;
28195
28581
  try {
28196
28582
  zip = await _jszip2.default.loadAsync(input);
28197
28583
  } catch (e31) {
28198
- throw new (0, _chunkEBSCV3JCcjs.KordocError)("HWPX(ZIP) \uD615\uC2DD\uC774 \uC544\uB2D9\uB2C8\uB2E4 \u2014 \uB80C\uB354\uB294 HWPX\uB9CC \uC9C0\uC6D0");
28584
+ throw new (0, _chunkWN7LZHIIcjs.KordocError)("HWPX(ZIP) \uD615\uC2DD\uC774 \uC544\uB2D9\uB2C8\uB2E4 \u2014 \uB80C\uB354\uB294 HWPX\uB9CC \uC9C0\uC6D0");
28199
28585
  }
28200
28586
  const secFiles = zip.file(/Contents\/section\d+\.xml$/i).sort((a, b) => a.name.localeCompare(b.name));
28201
- if (secFiles.length === 0) throw new (0, _chunkEBSCV3JCcjs.KordocError)("Contents/section0.xml \uC5C6\uC74C \u2014 HWPX\uAC00 \uC544\uB2C8\uAC70\uB098 \uC190\uC0C1\uB428");
28587
+ if (secFiles.length === 0) throw new (0, _chunkWN7LZHIIcjs.KordocError)("Contents/section0.xml \uC5C6\uC74C \u2014 HWPX\uAC00 \uC544\uB2C8\uAC70\uB098 \uC190\uC0C1\uB428");
28202
28588
  const warnings = [];
28203
28589
  const headFile = _nullishCoalesce(zip.file("Contents/header.xml"), () => ( zip.file("Contents/head.xml")));
28204
28590
  const styles = headFile ? parseRenderStyles(await headFile.async("string")) : { charPr: /* @__PURE__ */ new Map(), paraAlign: /* @__PURE__ */ new Map(), paraGeom: /* @__PURE__ */ new Map(), borderFill: /* @__PURE__ */ new Map() };
@@ -28206,7 +28592,7 @@ async function renderHwpxToSvg(input, options) {
28206
28592
  const secXmls = [];
28207
28593
  for (const f of secFiles) {
28208
28594
  const xml = await f.async("string");
28209
- if (xml.length > MAX_DECOMPRESS_SIZE) throw new (0, _chunkEBSCV3JCcjs.KordocError)("\uC139\uC158 XML\uC774 \uD5C8\uC6A9 \uD06C\uAE30\uB97C \uCD08\uACFC");
28595
+ if (xml.length > MAX_DECOMPRESS_SIZE) throw new (0, _chunkWN7LZHIIcjs.KordocError)("\uC139\uC158 XML\uC774 \uD5C8\uC6A9 \uD06C\uAE30\uB97C \uCD08\uACFC");
28210
28596
  secXmls.push(xml);
28211
28597
  }
28212
28598
  const binmap = /* @__PURE__ */ new Map();
@@ -28230,7 +28616,7 @@ async function renderHwpxToSvg(input, options) {
28230
28616
  let href = binmap.get(ref);
28231
28617
  if (!href) {
28232
28618
  const cand = zip.file(new RegExp(`BinData/.*${ref.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")}`, "i"))[0];
28233
- href = _optionalChain([cand, 'optionalAccess', _432 => _432.name]);
28619
+ href = _optionalChain([cand, 'optionalAccess', _449 => _449.name]);
28234
28620
  }
28235
28621
  if (!href) continue;
28236
28622
  const f = _nullishCoalesce(zip.file(href), () => ( zip.file("Contents/" + href)));
@@ -28251,7 +28637,7 @@ async function renderHwpxToSvg(input, options) {
28251
28637
  styles,
28252
28638
  images,
28253
28639
  defs: [],
28254
- highlights: (_nullishCoalesce(_optionalChain([options, 'optionalAccess', _433 => _433.highlights]), () => ( []))).map((s) => s.trim().toLowerCase()).filter((s) => s.length > 0),
28640
+ highlights: (_nullishCoalesce(_optionalChain([options, 'optionalAccess', _450 => _450.highlights]), () => ( []))).map((s) => s.trim().toLowerCase()).filter((s) => s.length > 0),
28255
28641
  warnings,
28256
28642
  warned: /* @__PURE__ */ new Set(),
28257
28643
  stats: { texts: 0, images: 0, tables: 0 }
@@ -28261,7 +28647,7 @@ async function renderHwpxToSvg(input, options) {
28261
28647
  for (let si = 0; si < secXmls.length; si++) {
28262
28648
  const secXml = secXmls[si];
28263
28649
  const hasCache = /<(?:[A-Za-z][\w.-]*:)?linesegarray[\s/>]/.test(secXml);
28264
- if (!hasCache && !_optionalChain([options, 'optionalAccess', _434 => _434.reflow])) {
28650
+ if (!hasCache && !_optionalChain([options, 'optionalAccess', _451 => _451.reflow])) {
28265
28651
  noCacheSkipped = true;
28266
28652
  warnings.push(`\uAD6C\uC5ED ${si}: \uC870\uD310 \uCE90\uC2DC \uC5C6\uC74C \u2014 reflow \uC635\uC158 \uD544\uC694, \uC0DD\uB7B5`);
28267
28653
  continue;
@@ -28273,14 +28659,14 @@ async function renderHwpxToSvg(input, options) {
28273
28659
  continue;
28274
28660
  }
28275
28661
  const geom = readSectionGeom(root);
28276
- const { pages, pageH } = renderSectionToPages(root, geom, ctxBase, hasCache, _nullishCoalesce(_optionalChain([options, 'optionalAccess', _435 => _435.reflowMode]), () => ( "keep")));
28662
+ const { pages, pageH } = renderSectionToPages(root, geom, ctxBase, hasCache, _nullishCoalesce(_optionalChain([options, 'optionalAccess', _452 => _452.reflowMode]), () => ( "keep")));
28277
28663
  rendered.push({ pages, PW: geom.PW, pageH, clipId: `pgclip${si}` });
28278
28664
  }
28279
28665
  if (rendered.length === 0) {
28280
28666
  if (noCacheSkipped) {
28281
- throw new (0, _chunkEBSCV3JCcjs.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)");
28667
+ throw new (0, _chunkWN7LZHIIcjs.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)");
28282
28668
  }
28283
- throw new (0, _chunkEBSCV3JCcjs.KordocError)("\uB80C\uB354\uD560 \uAD6C\uC5ED\uC774 \uC5C6\uC2B5\uB2C8\uB2E4 \u2014 HWPX\uAC00 \uC190\uC0C1\uB418\uC5C8\uC744 \uC218 \uC788\uC2B5\uB2C8\uB2E4");
28669
+ throw new (0, _chunkWN7LZHIIcjs.KordocError)("\uB80C\uB354\uD560 \uAD6C\uC5ED\uC774 \uC5C6\uC2B5\uB2C8\uB2E4 \u2014 HWPX\uAC00 \uC190\uC0C1\uB418\uC5C8\uC744 \uC218 \uC788\uC2B5\uB2C8\uB2E4");
28284
28670
  }
28285
28671
  const GAP = 2400;
28286
28672
  const clipDefs = [];
@@ -28312,17 +28698,17 @@ ${groups.join("\n")}
28312
28698
  // src/index.ts
28313
28699
  async function parse(input, options) {
28314
28700
  let buffer;
28315
- const opts = typeof input === "string" && !_optionalChain([options, 'optionalAccess', _436 => _436.filePath]) ? { ...options, filePath: input } : options;
28701
+ const opts = typeof input === "string" && !_optionalChain([options, 'optionalAccess', _453 => _453.filePath]) ? { ...options, filePath: input } : options;
28316
28702
  if (typeof input === "string") {
28317
28703
  try {
28318
28704
  const buf = await _promises.readFile.call(void 0, input);
28319
- buffer = _chunkEBSCV3JCcjs.toArrayBuffer.call(void 0, buf);
28705
+ buffer = _chunkWN7LZHIIcjs.toArrayBuffer.call(void 0, buf);
28320
28706
  } catch (err) {
28321
28707
  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}`;
28322
28708
  return { success: false, fileType: "unknown", error: msg2, code: "PARSE_ERROR" };
28323
28709
  }
28324
28710
  } else if (Buffer.isBuffer(input)) {
28325
- buffer = _chunkEBSCV3JCcjs.toArrayBuffer.call(void 0, input);
28711
+ buffer = _chunkWN7LZHIIcjs.toArrayBuffer.call(void 0, input);
28326
28712
  } else {
28327
28713
  buffer = input;
28328
28714
  }
@@ -28357,21 +28743,21 @@ async function parseHwp3(buffer, options) {
28357
28743
  const { markdown, blocks, metadata, outline, warnings } = parseHwp3Document(buffer, options);
28358
28744
  return { success: true, fileType: "hwp3", markdown, blocks, metadata, outline, warnings };
28359
28745
  } catch (err) {
28360
- return { success: false, fileType: "hwp3", error: err instanceof Error ? err.message : "HWP3 \uD30C\uC2F1 \uC2E4\uD328", code: _chunkEBSCV3JCcjs.classifyError.call(void 0, err) };
28746
+ return { success: false, fileType: "hwp3", error: err instanceof Error ? err.message : "HWP3 \uD30C\uC2F1 \uC2E4\uD328", code: _chunkWN7LZHIIcjs.classifyError.call(void 0, err) };
28361
28747
  }
28362
28748
  }
28363
28749
  async function parseHwpx(buffer, options) {
28364
28750
  try {
28365
28751
  const { markdown, blocks, metadata, outline, warnings, images } = await parseHwpxDocument(buffer, options);
28366
- return { success: true, fileType: "hwpx", markdown, blocks, metadata, outline, warnings, images: _optionalChain([images, 'optionalAccess', _437 => _437.length]) ? images : void 0 };
28752
+ return { success: true, fileType: "hwpx", markdown, blocks, metadata, outline, warnings, images: _optionalChain([images, 'optionalAccess', _454 => _454.length]) ? images : void 0 };
28367
28753
  } catch (err) {
28368
- return { success: false, fileType: "hwpx", error: err instanceof Error ? err.message : "HWPX \uD30C\uC2F1 \uC2E4\uD328", code: _chunkEBSCV3JCcjs.classifyError.call(void 0, err) };
28754
+ return { success: false, fileType: "hwpx", error: err instanceof Error ? err.message : "HWPX \uD30C\uC2F1 \uC2E4\uD328", code: _chunkWN7LZHIIcjs.classifyError.call(void 0, err) };
28369
28755
  }
28370
28756
  }
28371
28757
  async function parseHwp(buffer, options) {
28372
28758
  try {
28373
28759
  const { markdown, blocks, metadata, outline, warnings, images } = parseHwp5Document(Buffer.from(buffer), options);
28374
- if (isDistributionSentinel(markdown) && isComFallbackAvailable() && _optionalChain([options, 'optionalAccess', _438 => _438.filePath])) {
28760
+ if (isDistributionSentinel(markdown) && isComFallbackAvailable() && _optionalChain([options, 'optionalAccess', _455 => _455.filePath])) {
28375
28761
  try {
28376
28762
  const { pages, pageCount, warnings: comWarns } = extractTextViaCom(options.filePath);
28377
28763
  if (pages.some((p) => p && p.trim().length > 0)) {
@@ -28388,15 +28774,15 @@ async function parseHwp(buffer, options) {
28388
28774
  } catch (e32) {
28389
28775
  }
28390
28776
  }
28391
- return { success: true, fileType: "hwp", markdown, blocks, metadata, outline, warnings, images: _optionalChain([images, 'optionalAccess', _439 => _439.length]) ? images : void 0 };
28777
+ return { success: true, fileType: "hwp", markdown, blocks, metadata, outline, warnings, images: _optionalChain([images, 'optionalAccess', _456 => _456.length]) ? images : void 0 };
28392
28778
  } catch (err) {
28393
- return { success: false, fileType: "hwp", error: err instanceof Error ? err.message : "HWP \uD30C\uC2F1 \uC2E4\uD328", code: _chunkEBSCV3JCcjs.classifyError.call(void 0, err) };
28779
+ return { success: false, fileType: "hwp", error: err instanceof Error ? err.message : "HWP \uD30C\uC2F1 \uC2E4\uD328", code: _chunkWN7LZHIIcjs.classifyError.call(void 0, err) };
28394
28780
  }
28395
28781
  }
28396
28782
  async function parsePdf(buffer, options) {
28397
28783
  let parsePdfDocument;
28398
28784
  try {
28399
- const mod = await Promise.resolve().then(() => _interopRequireWildcard(require("./parser-6TV6JKHF.cjs")));
28785
+ const mod = await Promise.resolve().then(() => _interopRequireWildcard(require("./parser-6AYYGX6J.cjs")));
28400
28786
  parsePdfDocument = mod.parsePdfDocument;
28401
28787
  } catch (e33) {
28402
28788
  return {
@@ -28411,7 +28797,7 @@ async function parsePdf(buffer, options) {
28411
28797
  return { success: true, fileType: "pdf", markdown, blocks, metadata, outline, warnings, isImageBased, pageQuality, qualitySummary };
28412
28798
  } catch (err) {
28413
28799
  const isImageBased = err instanceof Error && "isImageBased" in err ? true : void 0;
28414
- return { success: false, fileType: "pdf", error: err instanceof Error ? err.message : "PDF \uD30C\uC2F1 \uC2E4\uD328", code: _chunkEBSCV3JCcjs.classifyError.call(void 0, err), isImageBased };
28800
+ return { success: false, fileType: "pdf", error: err instanceof Error ? err.message : "PDF \uD30C\uC2F1 \uC2E4\uD328", code: _chunkWN7LZHIIcjs.classifyError.call(void 0, err), isImageBased };
28415
28801
  }
28416
28802
  }
28417
28803
  async function parseXlsx(buffer, options) {
@@ -28419,7 +28805,7 @@ async function parseXlsx(buffer, options) {
28419
28805
  const { markdown, blocks, metadata, warnings } = await parseXlsxDocument(buffer, options);
28420
28806
  return { success: true, fileType: "xlsx", markdown, blocks, metadata, warnings };
28421
28807
  } catch (err) {
28422
- return { success: false, fileType: "xlsx", error: err instanceof Error ? err.message : "XLSX \uD30C\uC2F1 \uC2E4\uD328", code: _chunkEBSCV3JCcjs.classifyError.call(void 0, err) };
28808
+ return { success: false, fileType: "xlsx", error: err instanceof Error ? err.message : "XLSX \uD30C\uC2F1 \uC2E4\uD328", code: _chunkWN7LZHIIcjs.classifyError.call(void 0, err) };
28423
28809
  }
28424
28810
  }
28425
28811
  async function parseXls(buffer, options) {
@@ -28427,15 +28813,15 @@ async function parseXls(buffer, options) {
28427
28813
  const { markdown, blocks, metadata, warnings } = await parseXlsDocument(buffer, options);
28428
28814
  return { success: true, fileType: "xls", markdown, blocks, metadata, warnings };
28429
28815
  } catch (err) {
28430
- return { success: false, fileType: "xls", error: err instanceof Error ? err.message : "XLS \uD30C\uC2F1 \uC2E4\uD328", code: _chunkEBSCV3JCcjs.classifyError.call(void 0, err) };
28816
+ return { success: false, fileType: "xls", error: err instanceof Error ? err.message : "XLS \uD30C\uC2F1 \uC2E4\uD328", code: _chunkWN7LZHIIcjs.classifyError.call(void 0, err) };
28431
28817
  }
28432
28818
  }
28433
28819
  async function parseDocx(buffer, options) {
28434
28820
  try {
28435
28821
  const { markdown, blocks, metadata, outline, warnings, images } = await parseDocxDocument(buffer, options);
28436
- return { success: true, fileType: "docx", markdown, blocks, metadata, outline, warnings, images: _optionalChain([images, 'optionalAccess', _440 => _440.length]) ? images : void 0 };
28822
+ return { success: true, fileType: "docx", markdown, blocks, metadata, outline, warnings, images: _optionalChain([images, 'optionalAccess', _457 => _457.length]) ? images : void 0 };
28437
28823
  } catch (err) {
28438
- return { success: false, fileType: "docx", error: err instanceof Error ? err.message : "DOCX \uD30C\uC2F1 \uC2E4\uD328", code: _chunkEBSCV3JCcjs.classifyError.call(void 0, err) };
28824
+ return { success: false, fileType: "docx", error: err instanceof Error ? err.message : "DOCX \uD30C\uC2F1 \uC2E4\uD328", code: _chunkWN7LZHIIcjs.classifyError.call(void 0, err) };
28439
28825
  }
28440
28826
  }
28441
28827
  async function parseHwpml(buffer, options) {
@@ -28443,16 +28829,16 @@ async function parseHwpml(buffer, options) {
28443
28829
  const { markdown, blocks, metadata, outline, warnings } = parseHwpmlDocument(buffer, options);
28444
28830
  return { success: true, fileType: "hwpml", markdown, blocks, metadata, outline, warnings };
28445
28831
  } catch (err) {
28446
- return { success: false, fileType: "hwpml", error: err instanceof Error ? err.message : "HWPML \uD30C\uC2F1 \uC2E4\uD328", code: _chunkEBSCV3JCcjs.classifyError.call(void 0, err) };
28832
+ return { success: false, fileType: "hwpml", error: err instanceof Error ? err.message : "HWPML \uD30C\uC2F1 \uC2E4\uD328", code: _chunkWN7LZHIIcjs.classifyError.call(void 0, err) };
28447
28833
  }
28448
28834
  }
28449
28835
  async function fillForm(input, values, outputFormat = "markdown") {
28450
28836
  let buffer;
28451
28837
  if (typeof input === "string") {
28452
28838
  const buf = await _promises.readFile.call(void 0, input);
28453
- buffer = _chunkEBSCV3JCcjs.toArrayBuffer.call(void 0, buf);
28839
+ buffer = _chunkWN7LZHIIcjs.toArrayBuffer.call(void 0, buf);
28454
28840
  } else if (Buffer.isBuffer(input)) {
28455
- buffer = _chunkEBSCV3JCcjs.toArrayBuffer.call(void 0, input);
28841
+ buffer = _chunkWN7LZHIIcjs.toArrayBuffer.call(void 0, input);
28456
28842
  } else {
28457
28843
  buffer = input;
28458
28844
  }
@@ -28478,7 +28864,7 @@ async function fillForm(input, values, outputFormat = "markdown") {
28478
28864
  throw new Error(`\uC11C\uC2DD \uD30C\uC2F1 \uC2E4\uD328: ${parsed.error}`);
28479
28865
  }
28480
28866
  const fill = fillFormFields(parsed.blocks, values);
28481
- const markdown = _chunkEBSCV3JCcjs.blocksToMarkdown.call(void 0, fill.blocks);
28867
+ const markdown = _chunkWN7LZHIIcjs.blocksToMarkdown.call(void 0, fill.blocks);
28482
28868
  if (outputFormat === "hwpx") {
28483
28869
  const hwpxBuffer = await markdownToHwpx(markdown);
28484
28870
  return { output: hwpxBuffer, format: "hwpx", fill };
@@ -28544,5 +28930,7 @@ async function fillForm(input, values, outputFormat = "markdown") {
28544
28930
 
28545
28931
 
28546
28932
 
28547
- exports.HwpxSession = HwpxSession; exports.PRESET_ALIAS = PRESET_ALIAS; exports.SPACE_EM_FIXED = SPACE_EM_FIXED; exports.SPACE_EM_FONT = SPACE_EM_FONT; exports.VERSION = _chunkEBSCV3JCcjs.VERSION; exports.ValueCursor = ValueCursor; exports.applySplices = applySplices; exports.blocksToMarkdown = _chunkEBSCV3JCcjs.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.hwpxToProfile = hwpxToProfile; exports.inferFieldType = inferFieldType; exports.isHwpxFile = isHwpxFile; exports.isKnownFont = isKnownFont; exports.isLabelCell = isLabelCell; exports.isOldHwpFile = isOldHwpFile; exports.isPdfFile = isPdfFile; exports.isZipFile = isZipFile; 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;
28933
+
28934
+
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 = _chunkWN7LZHIIcjs.VERSION; exports.ValueCursor = ValueCursor; exports.applySplices = applySplices; exports.blocksToMarkdown = _chunkWN7LZHIIcjs.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;
28548
28936
  //# sourceMappingURL=index.cjs.map