kordoc 3.8.3 → 3.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -19,7 +19,7 @@
19
19
 
20
20
 
21
21
 
22
- var _chunkXL6O3VAYcjs = require('./chunk-XL6O3VAY.cjs');
22
+ var _chunkVHXUD3PWcjs = require('./chunk-VHXUD3PW.cjs');
23
23
 
24
24
 
25
25
  var _chunkDCZVOIEOcjs = require('./chunk-DCZVOIEO.cjs');
@@ -405,7 +405,7 @@ function createSectionShared() {
405
405
  function createXmlParser(warnings) {
406
406
  return new (0, _xmldom.DOMParser)({
407
407
  onError(level, msg2) {
408
- if (level === "fatalError") throw new (0, _chunkXL6O3VAYcjs.KordocError)(`XML \uD30C\uC2F1 \uC2E4\uD328: ${msg2}`);
408
+ if (level === "fatalError") throw new (0, _chunkVHXUD3PWcjs.KordocError)(`XML \uD30C\uC2F1 \uC2E4\uD328: ${msg2}`);
409
409
  _optionalChain([warnings, 'optionalAccess', _3 => _3.push, 'call', _4 => _4({ code: "MALFORMED_XML", message: `XML ${level === "warn" ? "\uACBD\uACE0" : "\uC624\uB958"}: ${msg2}` })]);
410
410
  }
411
411
  });
@@ -460,10 +460,10 @@ async function extractHwpxStyles(zip, decompressed) {
460
460
  const xml = await file.async("text");
461
461
  if (decompressed) {
462
462
  decompressed.total += xml.length * 2;
463
- if (decompressed.total > MAX_DECOMPRESS_SIZE) throw new (0, _chunkXL6O3VAYcjs.KordocError)("ZIP \uC555\uCD95 \uD574\uC81C \uD06C\uAE30 \uCD08\uACFC (ZIP bomb \uC758\uC2EC)");
463
+ if (decompressed.total > MAX_DECOMPRESS_SIZE) throw new (0, _chunkVHXUD3PWcjs.KordocError)("ZIP \uC555\uCD95 \uD574\uC81C \uD06C\uAE30 \uCD08\uACFC (ZIP bomb \uC758\uC2EC)");
464
464
  }
465
465
  const parser = createXmlParser();
466
- const doc = parser.parseFromString(_chunkXL6O3VAYcjs.stripDtd.call(void 0, xml), "text/xml");
466
+ const doc = parser.parseFromString(_chunkVHXUD3PWcjs.stripDtd.call(void 0, xml), "text/xml");
467
467
  if (!doc.documentElement) continue;
468
468
  parseCharProperties(doc, result.charProperties);
469
469
  parseStyleElements(doc, result.styles);
@@ -615,9 +615,9 @@ function detectHwpxHeadings(blocks, styleMap) {
615
615
  let level = 0;
616
616
  if (baseFontSize > 0 && _optionalChain([block, 'access', _7 => _7.style, 'optionalAccess', _8 => _8.fontSize])) {
617
617
  const ratio = block.style.fontSize / baseFontSize;
618
- if (ratio >= _chunkXL6O3VAYcjs.HEADING_RATIO_H1) level = 1;
619
- else if (ratio >= _chunkXL6O3VAYcjs.HEADING_RATIO_H2) level = 2;
620
- else if (ratio >= _chunkXL6O3VAYcjs.HEADING_RATIO_H3) level = 3;
618
+ if (ratio >= _chunkVHXUD3PWcjs.HEADING_RATIO_H1) level = 1;
619
+ else if (ratio >= _chunkVHXUD3PWcjs.HEADING_RATIO_H2) level = 2;
620
+ else if (ratio >= _chunkVHXUD3PWcjs.HEADING_RATIO_H3) level = 3;
621
621
  }
622
622
  const compactText = text.replace(/\s+/g, "");
623
623
  if (/^제\d+[조장절편]/.test(compactText) && text.length <= 50) {
@@ -667,8 +667,10 @@ var CONVERT_MAP = {
667
667
  SUCC: "\\succ",
668
668
  UPLUS: "\\uplus",
669
669
  "\xB1": "\\pm",
670
+ "+-": "\\pm",
670
671
  "-+": "\\mp",
671
672
  "\xF7": "\\div",
673
+ cdot: "\\cdot",
672
674
  CIRC: "\\circ",
673
675
  BULLET: "\\bullet",
674
676
  DEG: " ^\\circ",
@@ -1057,6 +1059,10 @@ function hmlToLatex(hmlEqStr) {
1057
1059
  const t = tokens[i];
1058
1060
  if (t in CONVERT_MAP) tokens[i] = CONVERT_MAP[t];
1059
1061
  else if (t in MIDDLE_CONVERT_MAP) tokens[i] = MIDDLE_CONVERT_MAP[t];
1062
+ else {
1063
+ const quoted = /^"(.+)"$/.exec(t);
1064
+ if (quoted) tokens[i] = `\\text{${quoted[1]}}`;
1065
+ }
1060
1066
  }
1061
1067
  tokens = tokens.filter((tok) => tok.length !== 0);
1062
1068
  tokens = replaceBracket(tokens);
@@ -1153,19 +1159,19 @@ function resolveParaHeading(paraEl, ctx) {
1153
1159
  const head = numDef.heads.get(level);
1154
1160
  counters[level] = counters[level] === 0 ? _nullishCoalesce(_optionalChain([head, 'optionalAccess', _9 => _9.start]), () => ( 1)) : counters[level] + 1;
1155
1161
  for (let l = level + 1; l <= 10; l++) counters[l] = 0;
1156
- const fmtText = _optionalChain([head, 'optionalAccess', _10 => _10.text, 'optionalAccess', _11 => _11.trim, 'call', _12 => _12()]) || `^${level}.`;
1162
+ const fmtText = head ? head.text.trim() : `^${level}.`;
1157
1163
  const prefix = fmtText.replace(/\^(10|[1-9])/g, (_, d) => {
1158
1164
  const lv = parseInt(d, 10);
1159
1165
  const refHead = numDef.heads.get(lv);
1160
- const n = counters[lv] || _optionalChain([refHead, 'optionalAccess', _13 => _13.start]) || 1;
1161
- return formatHeadNumber(n, _optionalChain([refHead, 'optionalAccess', _14 => _14.numFormat]) || "DIGIT");
1166
+ const n = counters[lv] || _optionalChain([refHead, 'optionalAccess', _10 => _10.start]) || 1;
1167
+ return formatHeadNumber(n, _optionalChain([refHead, 'optionalAccess', _11 => _11.numFormat]) || "DIGIT");
1162
1168
  });
1163
- return { prefix, headingLevel };
1169
+ return { prefix: prefix || void 0, headingLevel };
1164
1170
  }
1165
1171
 
1166
1172
  // src/hwpx/table-build.ts
1167
1173
  function buildTableWithCellMeta(state) {
1168
- const table = _chunkXL6O3VAYcjs.buildTable.call(void 0, state.rows);
1174
+ const table = _chunkVHXUD3PWcjs.buildTable.call(void 0, state.rows);
1169
1175
  if (state.caption) table.caption = state.caption;
1170
1176
  const anchors = [];
1171
1177
  {
@@ -1173,7 +1179,7 @@ function buildTableWithCellMeta(state) {
1173
1179
  for (let r = 0; r < table.rows; r++) {
1174
1180
  for (let c = 0; c < table.cols; c++) {
1175
1181
  if (covered.has(`${r},${c}`)) continue;
1176
- const cell = _optionalChain([table, 'access', _15 => _15.cells, 'access', _16 => _16[r], 'optionalAccess', _17 => _17[c]]);
1182
+ const cell = _optionalChain([table, 'access', _12 => _12.cells, 'access', _13 => _13[r], 'optionalAccess', _14 => _14[c]]);
1177
1183
  if (!cell) continue;
1178
1184
  for (let dr = 0; dr < cell.rowSpan; dr++) {
1179
1185
  for (let dc = 0; dc < cell.colSpan; dc++) {
@@ -1198,7 +1204,7 @@ function buildTableWithCellMeta(state) {
1198
1204
  let target;
1199
1205
  const trimmed = src.text.trim();
1200
1206
  if (src.rowAddr !== void 0 && src.colAddr !== void 0) {
1201
- const cand = _optionalChain([table, 'access', _18 => _18.cells, 'access', _19 => _19[src.rowAddr], 'optionalAccess', _20 => _20[src.colAddr]]);
1207
+ const cand = _optionalChain([table, 'access', _15 => _15.cells, 'access', _16 => _16[src.rowAddr], 'optionalAccess', _17 => _17[src.colAddr]]);
1202
1208
  if (cand && cand.text === trimmed && !claimed.has(cand)) target = cand;
1203
1209
  }
1204
1210
  if (!target) {
@@ -1231,11 +1237,11 @@ function completeTable(newTable, tableStack, blocks, ctx) {
1231
1237
  }
1232
1238
  const ir = buildTableWithCellMeta(newTable);
1233
1239
  const block = { type: "table", table: ir, pageNumber: ctx.sectionNum };
1234
- if (_optionalChain([parentTable, 'optionalAccess', _21 => _21.cell])) {
1240
+ if (_optionalChain([parentTable, 'optionalAccess', _18 => _18.cell])) {
1235
1241
  const cell = parentTable.cell;
1236
1242
  (cell.blocks ??= []).push(block);
1237
1243
  cell.hasStructure = true;
1238
- let flat = _chunkXL6O3VAYcjs.convertTableToText.call(void 0, newTable.rows);
1244
+ let flat = _chunkVHXUD3PWcjs.convertTableToText.call(void 0, newTable.rows);
1239
1245
  if (newTable.caption) flat = newTable.caption + (flat ? "\n" + flat : "");
1240
1246
  if (flat) cell.text += (cell.text ? "\n" : "") + flat;
1241
1247
  } else {
@@ -1247,7 +1253,7 @@ function completeTable(newTable, tableStack, blocks, ctx) {
1247
1253
  // src/hwpx/section-walker.ts
1248
1254
  function parseSectionXml(xml, styleMap, warnings, sectionNum, shared) {
1249
1255
  const parser = createXmlParser(warnings);
1250
- const doc = parser.parseFromString(_chunkXL6O3VAYcjs.stripDtd.call(void 0, xml), "text/xml");
1256
+ const doc = parser.parseFromString(_chunkVHXUD3PWcjs.stripDtd.call(void 0, xml), "text/xml");
1251
1257
  if (!doc.documentElement) return [];
1252
1258
  const ctx = { styleMap, warnings, sectionNum, shared: _nullishCoalesce(shared, () => ( createSectionShared())) };
1253
1259
  ctx.shared.track.deleteDepth = 0;
@@ -1325,7 +1331,7 @@ function walkSection(node, blocks, tableCtx, tableStack, ctx, depth = 0) {
1325
1331
  }
1326
1332
  break;
1327
1333
  case "cellAddr":
1328
- if (_optionalChain([tableCtx, 'optionalAccess', _22 => _22.cell])) {
1334
+ if (_optionalChain([tableCtx, 'optionalAccess', _19 => _19.cell])) {
1329
1335
  const ca = parseInt(el.getAttribute("colAddr") || "", 10);
1330
1336
  const ra = parseInt(el.getAttribute("rowAddr") || "", 10);
1331
1337
  if (!isNaN(ca)) tableCtx.cell.colAddr = ca;
@@ -1333,13 +1339,13 @@ function walkSection(node, blocks, tableCtx, tableStack, ctx, depth = 0) {
1333
1339
  }
1334
1340
  break;
1335
1341
  case "cellSpan":
1336
- if (_optionalChain([tableCtx, 'optionalAccess', _23 => _23.cell])) {
1342
+ if (_optionalChain([tableCtx, 'optionalAccess', _20 => _20.cell])) {
1337
1343
  const rawCs = parseInt(el.getAttribute("colSpan") || "1", 10);
1338
1344
  const cs = isNaN(rawCs) ? 1 : rawCs;
1339
1345
  const rawRs = parseInt(el.getAttribute("rowSpan") || "1", 10);
1340
1346
  const rs = isNaN(rawRs) ? 1 : rawRs;
1341
- tableCtx.cell.colSpan = clampSpan(cs, _chunkXL6O3VAYcjs.MAX_COLS);
1342
- tableCtx.cell.rowSpan = clampSpan(rs, _chunkXL6O3VAYcjs.MAX_ROWS);
1347
+ tableCtx.cell.colSpan = clampSpan(cs, _chunkVHXUD3PWcjs.MAX_COLS);
1348
+ tableCtx.cell.rowSpan = clampSpan(rs, _chunkVHXUD3PWcjs.MAX_ROWS);
1343
1349
  }
1344
1350
  break;
1345
1351
  case "p": {
@@ -1348,11 +1354,11 @@ function walkSection(node, blocks, tableCtx, tableStack, ctx, depth = 0) {
1348
1354
  let headingLevel;
1349
1355
  if (text) {
1350
1356
  const ph = resolveParaHeading(el, ctx);
1351
- if (_optionalChain([ph, 'optionalAccess', _24 => _24.prefix])) text = ph.prefix + " " + text;
1352
- headingLevel = _optionalChain([ph, 'optionalAccess', _25 => _25.headingLevel]);
1357
+ if (_optionalChain([ph, 'optionalAccess', _21 => _21.prefix])) text = ph.prefix + " " + text;
1358
+ headingLevel = _optionalChain([ph, 'optionalAccess', _22 => _22.headingLevel]);
1353
1359
  }
1354
1360
  if (text) {
1355
- if (_optionalChain([tableCtx, 'optionalAccess', _26 => _26.cell])) {
1361
+ if (_optionalChain([tableCtx, 'optionalAccess', _23 => _23.cell])) {
1356
1362
  const cell = tableCtx.cell;
1357
1363
  if (footnote) text += ` (\uC8FC: ${footnote})`;
1358
1364
  cell.text += (cell.text ? "\n" : "") + text;
@@ -1375,7 +1381,7 @@ function walkSection(node, blocks, tableCtx, tableStack, ctx, depth = 0) {
1375
1381
  case "pic":
1376
1382
  case "shape":
1377
1383
  case "drawingObject": {
1378
- if (_optionalChain([tableCtx, 'optionalAccess', _27 => _27.cell])) {
1384
+ if (_optionalChain([tableCtx, 'optionalAccess', _24 => _24.cell])) {
1379
1385
  const sink = [];
1380
1386
  handleShape(el, sink, ctx);
1381
1387
  mergeBlocksIntoCell(tableCtx.cell, sink);
@@ -1484,7 +1490,7 @@ function walkParagraphChildren(node, blocks, tableCtx, tableStack, ctx, depth =
1484
1490
  walkSection(el, blocks, newTable, tableStack, ctx, d + 1);
1485
1491
  tableCtx = completeTable(newTable, tableStack, blocks, ctx);
1486
1492
  } else if (localTag === "pic" || localTag === "shape" || localTag === "drawingObject") {
1487
- if (_optionalChain([tableCtx, 'optionalAccess', _28 => _28.cell])) {
1493
+ if (_optionalChain([tableCtx, 'optionalAccess', _25 => _25.cell])) {
1488
1494
  const sink = [];
1489
1495
  handleShape(el, sink, ctx);
1490
1496
  mergeBlocksIntoCell(tableCtx.cell, sink);
@@ -1492,7 +1498,7 @@ function walkParagraphChildren(node, blocks, tableCtx, tableStack, ctx, depth =
1492
1498
  handleShape(el, blocks, ctx);
1493
1499
  }
1494
1500
  } else if (localTag === "drawText") {
1495
- if (_optionalChain([tableCtx, 'optionalAccess', _29 => _29.cell])) {
1501
+ if (_optionalChain([tableCtx, 'optionalAccess', _26 => _26.cell])) {
1496
1502
  const sink = [];
1497
1503
  extractDrawTextBlocks(el, sink, ctx);
1498
1504
  mergeBlocksIntoCell(tableCtx.cell, sink);
@@ -1536,7 +1542,7 @@ function extractDrawTextBlocks(drawTextNode, blocks, ctx) {
1536
1542
  let text = info.text.trim();
1537
1543
  if (text) {
1538
1544
  const ph = resolveParaHeading(child, ctx);
1539
- if (_optionalChain([ph, 'optionalAccess', _30 => _30.prefix])) text = ph.prefix + " " + text;
1545
+ if (_optionalChain([ph, 'optionalAccess', _27 => _27.prefix])) text = ph.prefix + " " + text;
1540
1546
  const block = { type: "paragraph", text, style: _nullishCoalesce(info.style, () => ( void 0)), pageNumber: ctx.sectionNum };
1541
1547
  if (info.href) block.href = info.href;
1542
1548
  if (info.footnote) block.footnoteText = info.footnote;
@@ -1561,13 +1567,13 @@ function extractHyperlinkHref(fieldBegin) {
1561
1567
  let url = (ch.textContent || "").trim();
1562
1568
  if (!url) continue;
1563
1569
  url = url.replace(/^https?:\/\/(?=https?:\/\/)/i, "");
1564
- const safe = _chunkXL6O3VAYcjs.sanitizeHref.call(void 0, url);
1570
+ const safe = _chunkVHXUD3PWcjs.sanitizeHref.call(void 0, url);
1565
1571
  if (safe) return safe;
1566
1572
  }
1567
1573
  return void 0;
1568
1574
  }
1569
1575
  function isInDeletedRange(ctx) {
1570
- return (_nullishCoalesce(_optionalChain([ctx, 'optionalAccess', _31 => _31.shared, 'access', _32 => _32.track, 'access', _33 => _33.deleteDepth]), () => ( 0))) > 0;
1576
+ return (_nullishCoalesce(_optionalChain([ctx, 'optionalAccess', _28 => _28.shared, 'access', _29 => _29.track, 'access', _30 => _30.deleteDepth]), () => ( 0))) > 0;
1571
1577
  }
1572
1578
  function extractParagraphInfo(para, styleMap, ctx) {
1573
1579
  let text = "";
@@ -1621,7 +1627,7 @@ function extractParagraphInfo(para, styleMap, ctx) {
1621
1627
  // 삽입분은 최종본에 포함
1622
1628
  // 숨은 설명 — 본문 혼입 차단
1623
1629
  case "hiddenComment": {
1624
- if (_optionalChain([ctx, 'optionalAccess', _34 => _34.warnings]) && extractTextFromNode(k)) {
1630
+ if (_optionalChain([ctx, 'optionalAccess', _31 => _31.warnings]) && extractTextFromNode(k)) {
1625
1631
  ctx.warnings.push({ page: ctx.sectionNum, message: "\uC228\uC740 \uC124\uBA85 \uD14D\uC2A4\uD2B8 \uC81C\uC678: hiddenComment", code: "HIDDEN_TEXT_FILTERED" });
1626
1632
  }
1627
1633
  break;
@@ -1638,7 +1644,7 @@ function extractParagraphInfo(para, styleMap, ctx) {
1638
1644
  break;
1639
1645
  // 미지원 요소 — 텍스트를 가졌으면 무음 손실 대신 경고
1640
1646
  default: {
1641
- if (_optionalChain([ctx, 'optionalAccess', _35 => _35.warnings]) && extractTextFromNode(k)) {
1647
+ if (_optionalChain([ctx, 'optionalAccess', _32 => _32.warnings]) && extractTextFromNode(k)) {
1642
1648
  ctx.warnings.push({ page: ctx.sectionNum, message: `\uBBF8\uC9C0\uC6D0 \uC81C\uC5B4 \uC694\uC18C\uC758 \uD14D\uC2A4\uD2B8 \uC190\uC2E4: ${ktag}`, code: "UNSUPPORTED_ELEMENT" });
1643
1649
  }
1644
1650
  }
@@ -1655,7 +1661,7 @@ function extractParagraphInfo(para, styleMap, ctx) {
1655
1661
  if (isInDeletedRange(ctx)) {
1656
1662
  if (t && ctx && !ctx.shared.track.warned) {
1657
1663
  ctx.shared.track.warned = true;
1658
- _optionalChain([ctx, 'access', _36 => _36.warnings, 'optionalAccess', _37 => _37.push, 'call', _38 => _38({ page: ctx.sectionNum, message: "\uBCC0\uACBD\uCD94\uC801 \uC0AD\uC81C \uD14D\uC2A4\uD2B8 \uCD9C\uB825 \uC81C\uC678", code: "HIDDEN_TEXT_FILTERED" })]);
1664
+ _optionalChain([ctx, 'access', _33 => _33.warnings, 'optionalAccess', _34 => _34.push, 'call', _35 => _35({ page: ctx.sectionNum, message: "\uBCC0\uACBD\uCD94\uC801 \uC0AD\uC81C \uD14D\uC2A4\uD2B8 \uCD9C\uB825 \uC81C\uC678", code: "HIDDEN_TEXT_FILTERED" })]);
1659
1665
  }
1660
1666
  } else {
1661
1667
  text += t;
@@ -1696,7 +1702,7 @@ function extractParagraphInfo(para, styleMap, ctx) {
1696
1702
  case "hyperlink": {
1697
1703
  const url = child.getAttribute("url") || child.getAttribute("href") || "";
1698
1704
  if (url) {
1699
- const safe = _chunkXL6O3VAYcjs.sanitizeHref.call(void 0, url);
1705
+ const safe = _chunkVHXUD3PWcjs.sanitizeHref.call(void 0, url);
1700
1706
  if (safe) href = safe;
1701
1707
  }
1702
1708
  walk(child);
@@ -1845,7 +1851,7 @@ function collectImageBlocks(blocks, out, ownerCell, depth = 0) {
1845
1851
  } else if (block.type === "table" && block.table) {
1846
1852
  for (const row of block.table.cells) {
1847
1853
  for (const cell of row) {
1848
- if (_optionalChain([cell, 'access', _39 => _39.blocks, 'optionalAccess', _40 => _40.length])) collectImageBlocks(cell.blocks, out, cell, depth + 1);
1854
+ if (_optionalChain([cell, 'access', _36 => _36.blocks, 'optionalAccess', _37 => _37.length])) collectImageBlocks(cell.blocks, out, cell, depth + 1);
1849
1855
  }
1850
1856
  }
1851
1857
  }
@@ -1882,13 +1888,13 @@ async function extractImagesFromZip(zip, blocks, decompressed, warnings) {
1882
1888
  }
1883
1889
  const allCandidates = resolvedPath ? [resolvedPath, ...candidates] : candidates;
1884
1890
  for (const path of allCandidates) {
1885
- if (_chunkXL6O3VAYcjs.isPathTraversal.call(void 0, path)) continue;
1891
+ if (_chunkVHXUD3PWcjs.isPathTraversal.call(void 0, path)) continue;
1886
1892
  const file = zip.file(path);
1887
1893
  if (!file) continue;
1888
1894
  try {
1889
1895
  const data = await file.async("uint8array");
1890
1896
  decompressed.total += data.length;
1891
- if (decompressed.total > MAX_DECOMPRESS_SIZE) throw new (0, _chunkXL6O3VAYcjs.KordocError)("ZIP \uC555\uCD95 \uD574\uC81C \uD06C\uAE30 \uCD08\uACFC (ZIP bomb \uC758\uC2EC)");
1897
+ if (decompressed.total > MAX_DECOMPRESS_SIZE) throw new (0, _chunkVHXUD3PWcjs.KordocError)("ZIP \uC555\uCD95 \uD574\uC81C \uD06C\uAE30 \uCD08\uACFC (ZIP bomb \uC758\uC2EC)");
1892
1898
  const ext = path.includes(".") ? path.split(".").pop() || "png" : "png";
1893
1899
  const mimeType = imageExtToMime(ext);
1894
1900
  imageIndex++;
@@ -1897,10 +1903,10 @@ async function extractImagesFromZip(zip, blocks, decompressed, warnings) {
1897
1903
  images.push(img);
1898
1904
  break;
1899
1905
  } catch (err) {
1900
- if (err instanceof _chunkXL6O3VAYcjs.KordocError) throw err;
1906
+ if (err instanceof _chunkVHXUD3PWcjs.KordocError) throw err;
1901
1907
  }
1902
1908
  }
1903
- if (!img) _optionalChain([warnings, 'optionalAccess', _41 => _41.push, 'call', _42 => _42({ page: block.pageNumber, message: `\uC774\uBBF8\uC9C0 \uD30C\uC77C \uC5C6\uC74C: ${ref}`, code: "SKIPPED_IMAGE" })]);
1909
+ 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" })]);
1904
1910
  resolved.set(ref, img);
1905
1911
  }
1906
1912
  if (!img) {
@@ -1959,7 +1965,7 @@ function extractFromBrokenZip(buffer) {
1959
1965
  }
1960
1966
  const nameBytes = data.slice(pos + 30, pos + 30 + nameLen);
1961
1967
  const name = new TextDecoder().decode(nameBytes);
1962
- if (_chunkXL6O3VAYcjs.isPathTraversal.call(void 0, name)) {
1968
+ if (_chunkVHXUD3PWcjs.isPathTraversal.call(void 0, name)) {
1963
1969
  pos = fileStart + compSize;
1964
1970
  continue;
1965
1971
  }
@@ -1977,16 +1983,16 @@ function extractFromBrokenZip(buffer) {
1977
1983
  continue;
1978
1984
  }
1979
1985
  totalDecompressed += content.length * 2;
1980
- if (totalDecompressed > MAX_DECOMPRESS_SIZE) throw new (0, _chunkXL6O3VAYcjs.KordocError)("\uC555\uCD95 \uD574\uC81C \uD06C\uAE30 \uCD08\uACFC");
1986
+ if (totalDecompressed > MAX_DECOMPRESS_SIZE) throw new (0, _chunkVHXUD3PWcjs.KordocError)("\uC555\uCD95 \uD574\uC81C \uD06C\uAE30 \uCD08\uACFC");
1981
1987
  sectionNum++;
1982
1988
  blocks.push(...parseSectionXml(content, void 0, warnings, sectionNum, shared));
1983
1989
  } catch (e13) {
1984
1990
  continue;
1985
1991
  }
1986
1992
  }
1987
- if (blocks.length === 0) throw new (0, _chunkXL6O3VAYcjs.KordocError)("\uC190\uC0C1\uB41C HWPX\uC5D0\uC11C \uC139\uC158 \uB370\uC774\uD130\uB97C \uBCF5\uAD6C\uD560 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4");
1993
+ if (blocks.length === 0) throw new (0, _chunkVHXUD3PWcjs.KordocError)("\uC190\uC0C1\uB41C HWPX\uC5D0\uC11C \uC139\uC158 \uB370\uC774\uD130\uB97C \uBCF5\uAD6C\uD560 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4");
1988
1994
  applyPageText(blocks, shared);
1989
- const markdown = _chunkXL6O3VAYcjs.blocksToMarkdown.call(void 0, blocks);
1995
+ const markdown = _chunkVHXUD3PWcjs.blocksToMarkdown.call(void 0, blocks);
1990
1996
  return { markdown, blocks, warnings: warnings.length > 0 ? warnings : void 0 };
1991
1997
  }
1992
1998
  async function resolveSectionPaths(zip) {
@@ -2000,18 +2006,18 @@ async function resolveSectionPaths(zip) {
2000
2006
  if (paths.length > 0) return paths;
2001
2007
  }
2002
2008
  const sectionFiles = zip.file(/[Ss]ection\d+\.xml$/);
2003
- return sectionFiles.map((f) => f.name).sort(_chunkXL6O3VAYcjs.compareSectionPaths);
2009
+ return sectionFiles.map((f) => f.name).sort(_chunkVHXUD3PWcjs.compareSectionPaths);
2004
2010
  }
2005
2011
  function parseSectionPathsFromManifest(xml) {
2006
2012
  const parser = createXmlParser();
2007
- const doc = parser.parseFromString(_chunkXL6O3VAYcjs.stripDtd.call(void 0, xml), "text/xml");
2013
+ const doc = parser.parseFromString(_chunkVHXUD3PWcjs.stripDtd.call(void 0, xml), "text/xml");
2008
2014
  const items = doc.getElementsByTagName("opf:item");
2009
2015
  const spine = doc.getElementsByTagName("opf:itemref");
2010
2016
  const idToHref = /* @__PURE__ */ new Map();
2011
2017
  for (let i = 0; i < items.length; i++) {
2012
2018
  const item = items[i];
2013
2019
  const id = item.getAttribute("id") || "";
2014
- const href = _chunkXL6O3VAYcjs.normalizeSectionHref.call(void 0, item.getAttribute("href") || "");
2020
+ const href = _chunkVHXUD3PWcjs.normalizeSectionHref.call(void 0, item.getAttribute("href") || "");
2015
2021
  if (id && href) idToHref.set(id, href);
2016
2022
  }
2017
2023
  if (spine.length > 0) {
@@ -2022,7 +2028,7 @@ function parseSectionPathsFromManifest(xml) {
2022
2028
  }
2023
2029
  if (ordered.length > 0) return ordered;
2024
2030
  }
2025
- return Array.from(idToHref.values()).sort(_chunkXL6O3VAYcjs.compareSectionPaths);
2031
+ return Array.from(idToHref.values()).sort(_chunkVHXUD3PWcjs.compareSectionPaths);
2026
2032
  }
2027
2033
 
2028
2034
  // src/hwpx/metadata.ts
@@ -2035,7 +2041,7 @@ async function extractHwpxMetadata(zip, metadata, decompressed) {
2035
2041
  const xml = await file.async("text");
2036
2042
  if (decompressed) {
2037
2043
  decompressed.total += xml.length * 2;
2038
- if (decompressed.total > MAX_DECOMPRESS_SIZE) throw new (0, _chunkXL6O3VAYcjs.KordocError)("ZIP \uC555\uCD95 \uD574\uC81C \uD06C\uAE30 \uCD08\uACFC (ZIP bomb \uC758\uC2EC)");
2044
+ if (decompressed.total > MAX_DECOMPRESS_SIZE) throw new (0, _chunkVHXUD3PWcjs.KordocError)("ZIP \uC555\uCD95 \uD574\uC81C \uD06C\uAE30 \uCD08\uACFC (ZIP bomb \uC758\uC2EC)");
2039
2045
  }
2040
2046
  parseDublinCoreMetadata(xml, metadata);
2041
2047
  if (metadata.title || metadata.author) return;
@@ -2045,13 +2051,13 @@ async function extractHwpxMetadata(zip, metadata, decompressed) {
2045
2051
  }
2046
2052
  function parseDublinCoreMetadata(xml, metadata) {
2047
2053
  const parser = createXmlParser();
2048
- const doc = parser.parseFromString(_chunkXL6O3VAYcjs.stripDtd.call(void 0, xml), "text/xml");
2054
+ const doc = parser.parseFromString(_chunkVHXUD3PWcjs.stripDtd.call(void 0, xml), "text/xml");
2049
2055
  if (!doc.documentElement) return;
2050
2056
  const getText = (tagNames) => {
2051
2057
  for (const tag of tagNames) {
2052
2058
  const els = doc.getElementsByTagName(tag);
2053
2059
  if (els.length > 0) {
2054
- const text = _optionalChain([els, 'access', _43 => _43[0], 'access', _44 => _44.textContent, 'optionalAccess', _45 => _45.trim, 'call', _46 => _46()]);
2060
+ const text = _optionalChain([els, 'access', _40 => _40[0], 'access', _41 => _41.textContent, 'optionalAccess', _42 => _42.trim, 'call', _43 => _43()]);
2055
2061
  if (text) return text;
2056
2062
  }
2057
2063
  }
@@ -2070,7 +2076,7 @@ function parseDublinCoreMetadata(xml, metadata) {
2070
2076
 
2071
2077
  // src/hwpx/parser.ts
2072
2078
  async function parseHwpxDocument(buffer, options) {
2073
- _chunkXL6O3VAYcjs.precheckZipSize.call(void 0, buffer, MAX_DECOMPRESS_SIZE, MAX_ZIP_ENTRIES);
2079
+ _chunkVHXUD3PWcjs.precheckZipSize.call(void 0, buffer, MAX_DECOMPRESS_SIZE, MAX_ZIP_ENTRIES);
2074
2080
  let zip;
2075
2081
  try {
2076
2082
  zip = await _jszip2.default.loadAsync(buffer);
@@ -2079,19 +2085,19 @@ async function parseHwpxDocument(buffer, options) {
2079
2085
  }
2080
2086
  const actualEntryCount = Object.keys(zip.files).length;
2081
2087
  if (actualEntryCount > MAX_ZIP_ENTRIES) {
2082
- throw new (0, _chunkXL6O3VAYcjs.KordocError)("ZIP \uC5D4\uD2B8\uB9AC \uC218 \uCD08\uACFC (ZIP bomb \uC758\uC2EC)");
2088
+ throw new (0, _chunkVHXUD3PWcjs.KordocError)("ZIP \uC5D4\uD2B8\uB9AC \uC218 \uCD08\uACFC (ZIP bomb \uC758\uC2EC)");
2083
2089
  }
2084
2090
  const manifestFile = zip.file("META-INF/manifest.xml");
2085
2091
  if (manifestFile) {
2086
2092
  const manifestXml = await manifestFile.async("text");
2087
2093
  if (isEncryptedHwpx(manifestXml)) {
2088
- if (isComFallbackAvailable() && _optionalChain([options, 'optionalAccess', _47 => _47.filePath])) {
2094
+ if (isComFallbackAvailable() && _optionalChain([options, 'optionalAccess', _44 => _44.filePath])) {
2089
2095
  const { pages, pageCount, warnings: warnings2 } = extractTextViaCom(options.filePath);
2090
2096
  if (pages.some((p) => p && p.trim().length > 0)) {
2091
2097
  return comResultToParseResult(pages, pageCount, warnings2);
2092
2098
  }
2093
2099
  }
2094
- throw new (0, _chunkXL6O3VAYcjs.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.");
2100
+ throw new (0, _chunkVHXUD3PWcjs.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.");
2095
2101
  }
2096
2102
  }
2097
2103
  const decompressed = { total: 0 };
@@ -2100,9 +2106,9 @@ async function parseHwpxDocument(buffer, options) {
2100
2106
  const styleMap = await extractHwpxStyles(zip, decompressed);
2101
2107
  const warnings = [];
2102
2108
  const sectionPaths = await resolveSectionPaths(zip);
2103
- if (sectionPaths.length === 0) throw new (0, _chunkXL6O3VAYcjs.KordocError)("HWPX\uC5D0\uC11C \uC139\uC158 \uD30C\uC77C\uC744 \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4");
2109
+ if (sectionPaths.length === 0) throw new (0, _chunkVHXUD3PWcjs.KordocError)("HWPX\uC5D0\uC11C \uC139\uC158 \uD30C\uC77C\uC744 \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4");
2104
2110
  metadata.pageCount = sectionPaths.length;
2105
- const pageFilter = _optionalChain([options, 'optionalAccess', _48 => _48.pages]) ? _chunkDCZVOIEOcjs.parsePageRange.call(void 0, options.pages, sectionPaths.length) : null;
2111
+ const pageFilter = _optionalChain([options, 'optionalAccess', _45 => _45.pages]) ? _chunkDCZVOIEOcjs.parsePageRange.call(void 0, options.pages, sectionPaths.length) : null;
2106
2112
  const totalTarget = pageFilter ? pageFilter.size : sectionPaths.length;
2107
2113
  const blocks = [];
2108
2114
  const shared = createSectionShared();
@@ -2114,12 +2120,12 @@ async function parseHwpxDocument(buffer, options) {
2114
2120
  try {
2115
2121
  const xml = await file.async("text");
2116
2122
  decompressed.total += xml.length * 2;
2117
- if (decompressed.total > MAX_DECOMPRESS_SIZE) throw new (0, _chunkXL6O3VAYcjs.KordocError)("ZIP \uC555\uCD95 \uD574\uC81C \uD06C\uAE30 \uCD08\uACFC (ZIP bomb \uC758\uC2EC)");
2123
+ if (decompressed.total > MAX_DECOMPRESS_SIZE) throw new (0, _chunkVHXUD3PWcjs.KordocError)("ZIP \uC555\uCD95 \uD574\uC81C \uD06C\uAE30 \uCD08\uACFC (ZIP bomb \uC758\uC2EC)");
2118
2124
  blocks.push(...parseSectionXml(xml, styleMap, warnings, si + 1, shared));
2119
2125
  parsedSections++;
2120
- _optionalChain([options, 'optionalAccess', _49 => _49.onProgress, 'optionalCall', _50 => _50(parsedSections, totalTarget)]);
2126
+ _optionalChain([options, 'optionalAccess', _46 => _46.onProgress, 'optionalCall', _47 => _47(parsedSections, totalTarget)]);
2121
2127
  } catch (secErr) {
2122
- if (secErr instanceof _chunkXL6O3VAYcjs.KordocError) throw secErr;
2128
+ if (secErr instanceof _chunkVHXUD3PWcjs.KordocError) throw secErr;
2123
2129
  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" });
2124
2130
  }
2125
2131
  }
@@ -2127,7 +2133,7 @@ async function parseHwpxDocument(buffer, options) {
2127
2133
  const images = await extractImagesFromZip(zip, blocks, decompressed, warnings);
2128
2134
  detectHwpxHeadings(blocks, styleMap);
2129
2135
  const outline = blocks.filter((b) => b.type === "heading" && b.level && b.text).map((b) => ({ level: b.level, text: b.text, pageNumber: b.pageNumber }));
2130
- const markdown = _chunkXL6O3VAYcjs.blocksToMarkdown.call(void 0, blocks);
2136
+ const markdown = _chunkVHXUD3PWcjs.blocksToMarkdown.call(void 0, blocks);
2131
2137
  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 };
2132
2138
  }
2133
2139
 
@@ -2194,7 +2200,7 @@ function decompressStream(data) {
2194
2200
  return _zlib.inflateRawSync.call(void 0, data, opts);
2195
2201
  }
2196
2202
  function parseFileHeader(data) {
2197
- if (data.length < 40) throw new (0, _chunkXL6O3VAYcjs.KordocError)("FileHeader\uAC00 \uB108\uBB34 \uC9E7\uC2B5\uB2C8\uB2E4 (\uCD5C\uC18C 40\uBC14\uC774\uD2B8)");
2203
+ if (data.length < 40) throw new (0, _chunkVHXUD3PWcjs.KordocError)("FileHeader\uAC00 \uB108\uBB34 \uC9E7\uC2B5\uB2C8\uB2E4 (\uCD5C\uC18C 40\uBC14\uC774\uD2B8)");
2198
2204
  const sig = data.subarray(0, 32).toString("utf8").replace(/\0+$/, "");
2199
2205
  return {
2200
2206
  signature: sig,
@@ -2327,7 +2333,7 @@ function appendParaText(state, data, resolveControl) {
2327
2333
  const resolveAt = (byteOffset, extended) => {
2328
2334
  const ctrlId = data.readUInt32LE(byteOffset);
2329
2335
  const idx = extended ? state.ctrlIdx : -1;
2330
- const replacement = _optionalChain([resolveControl, 'optionalCall', _51 => _51(idx, ctrlId)]);
2336
+ const replacement = _optionalChain([resolveControl, 'optionalCall', _48 => _48(idx, ctrlId)]);
2331
2337
  if (replacement) result += replacement;
2332
2338
  if (extended) state.ctrlIdx++;
2333
2339
  };
@@ -2699,7 +2705,7 @@ function extractHwp5Images(fileIndex, blocks, warnings) {
2699
2705
  const binDataMap = /* @__PURE__ */ new Map();
2700
2706
  if (fileIndex) {
2701
2707
  for (const entry of fileIndex) {
2702
- if (!_optionalChain([entry, 'optionalAccess', _52 => _52.name]) || !entry.content) continue;
2708
+ if (!_optionalChain([entry, 'optionalAccess', _49 => _49.name]) || !entry.content) continue;
2703
2709
  const match = entry.name.match(BIN_ENTRY_RE);
2704
2710
  if (!match) continue;
2705
2711
  const idx = parseInt(match[1], 16);
@@ -3728,22 +3734,22 @@ function parseHwp5Document(buffer, options) {
3728
3734
  lenientCfb = parseLenientCfb(buffer);
3729
3735
  warnings.push({ message: "\uC190\uC0C1\uB41C CFB \uCEE8\uD14C\uC774\uB108 \u2014 lenient \uBAA8\uB4DC\uB85C \uBCF5\uAD6C", code: "LENIENT_CFB_RECOVERY" });
3730
3736
  } catch (e21) {
3731
- throw new (0, _chunkXL6O3VAYcjs.KordocError)("CFB \uCEE8\uD14C\uC774\uB108 \uD30C\uC2F1 \uC2E4\uD328 (strict \uBC0F lenient \uBAA8\uB450)");
3737
+ throw new (0, _chunkVHXUD3PWcjs.KordocError)("CFB \uCEE8\uD14C\uC774\uB108 \uD30C\uC2F1 \uC2E4\uD328 (strict \uBC0F lenient \uBAA8\uB450)");
3732
3738
  }
3733
3739
  }
3734
3740
  const findStream = (path) => {
3735
3741
  if (cfb) {
3736
3742
  const entry = CFB.find(cfb, path);
3737
- return _optionalChain([entry, 'optionalAccess', _53 => _53.content]) ? Buffer.from(entry.content) : null;
3743
+ return _optionalChain([entry, 'optionalAccess', _50 => _50.content]) ? Buffer.from(entry.content) : null;
3738
3744
  }
3739
3745
  return lenientCfb.findStream(path);
3740
3746
  };
3741
3747
  const headerData = findStream("/FileHeader");
3742
- if (!headerData) throw new (0, _chunkXL6O3VAYcjs.KordocError)("FileHeader \uC2A4\uD2B8\uB9BC \uC5C6\uC74C");
3748
+ if (!headerData) throw new (0, _chunkVHXUD3PWcjs.KordocError)("FileHeader \uC2A4\uD2B8\uB9BC \uC5C6\uC74C");
3743
3749
  const header = parseFileHeader(headerData);
3744
- if (header.signature !== "HWP Document File") throw new (0, _chunkXL6O3VAYcjs.KordocError)("HWP \uC2DC\uADF8\uB2C8\uCC98 \uBD88\uC77C\uCE58");
3745
- if (header.flags & FLAG_ENCRYPTED) throw new (0, _chunkXL6O3VAYcjs.KordocError)("\uC554\uD638\uD654\uB41C HWP\uB294 \uC9C0\uC6D0\uD558\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4");
3746
- if (header.flags & FLAG_DRM) throw new (0, _chunkXL6O3VAYcjs.KordocError)("DRM \uBCF4\uD638\uB41C HWP\uB294 \uC9C0\uC6D0\uD558\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4");
3750
+ if (header.signature !== "HWP Document File") throw new (0, _chunkVHXUD3PWcjs.KordocError)("HWP \uC2DC\uADF8\uB2C8\uCC98 \uBD88\uC77C\uCE58");
3751
+ if (header.flags & FLAG_ENCRYPTED) throw new (0, _chunkVHXUD3PWcjs.KordocError)("\uC554\uD638\uD654\uB41C HWP\uB294 \uC9C0\uC6D0\uD558\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4");
3752
+ if (header.flags & FLAG_DRM) throw new (0, _chunkVHXUD3PWcjs.KordocError)("DRM \uBCF4\uD638\uB41C HWP\uB294 \uC9C0\uC6D0\uD558\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4");
3747
3753
  const compressed = (header.flags & FLAG_COMPRESSED) !== 0;
3748
3754
  const distribution = (header.flags & FLAG_DISTRIBUTION) !== 0;
3749
3755
  const metadata = {
@@ -3752,9 +3758,9 @@ function parseHwp5Document(buffer, options) {
3752
3758
  if (cfb) extractHwp5Metadata(cfb, metadata);
3753
3759
  const docInfo = cfb ? parseDocInfoStream(cfb, compressed) : parseDocInfoFromStream(findStream("/DocInfo"), compressed);
3754
3760
  const sections = distribution ? cfb ? findViewTextSections(cfb, compressed) : findViewTextSectionsLenient(lenientCfb, compressed) : cfb ? findSections(cfb) : findSectionsLenient(lenientCfb, compressed);
3755
- if (sections.length === 0) throw new (0, _chunkXL6O3VAYcjs.KordocError)("\uC139\uC158 \uC2A4\uD2B8\uB9BC\uC744 \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4");
3761
+ if (sections.length === 0) throw new (0, _chunkVHXUD3PWcjs.KordocError)("\uC139\uC158 \uC2A4\uD2B8\uB9BC\uC744 \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4");
3756
3762
  metadata.pageCount = sections.length;
3757
- const pageFilter = _optionalChain([options, 'optionalAccess', _54 => _54.pages]) ? _chunkDCZVOIEOcjs.parsePageRange.call(void 0, options.pages, sections.length) : null;
3763
+ const pageFilter = _optionalChain([options, 'optionalAccess', _51 => _51.pages]) ? _chunkDCZVOIEOcjs.parsePageRange.call(void 0, options.pages, sections.length) : null;
3758
3764
  const totalTarget = pageFilter ? pageFilter.size : sections.length;
3759
3765
  const bodyBlocks = [];
3760
3766
  const doc = createHwp5DocState();
@@ -3766,31 +3772,31 @@ function parseHwp5Document(buffer, options) {
3766
3772
  const sectionData = sections[si];
3767
3773
  const data = !distribution && compressed ? decompressStream(Buffer.from(sectionData)) : Buffer.from(sectionData);
3768
3774
  totalDecompressed += data.length;
3769
- if (totalDecompressed > MAX_TOTAL_DECOMPRESS) throw new (0, _chunkXL6O3VAYcjs.KordocError)("\uCD1D \uC555\uCD95 \uD574\uC81C \uD06C\uAE30 \uCD08\uACFC (decompression bomb \uC758\uC2EC)");
3775
+ if (totalDecompressed > MAX_TOTAL_DECOMPRESS) throw new (0, _chunkVHXUD3PWcjs.KordocError)("\uCD1D \uC555\uCD95 \uD574\uC81C \uD06C\uAE30 \uCD08\uACFC (decompression bomb \uC758\uC2EC)");
3770
3776
  const records = readRecords(data);
3771
3777
  const sectionBlocks = parseSection(records, docInfo, warnings, si + 1, doc);
3772
3778
  bodyBlocks.push(...sectionBlocks);
3773
3779
  parsedSections++;
3774
- _optionalChain([options, 'optionalAccess', _55 => _55.onProgress, 'optionalCall', _56 => _56(parsedSections, totalTarget)]);
3780
+ _optionalChain([options, 'optionalAccess', _52 => _52.onProgress, 'optionalCall', _53 => _53(parsedSections, totalTarget)]);
3775
3781
  } catch (secErr) {
3776
- if (secErr instanceof _chunkXL6O3VAYcjs.KordocError) throw secErr;
3782
+ if (secErr instanceof _chunkVHXUD3PWcjs.KordocError) throw secErr;
3777
3783
  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" });
3778
3784
  }
3779
3785
  }
3780
3786
  const blocks = [...doc.headerBlocks, ...bodyBlocks, ...doc.footerBlocks];
3781
3787
  const images = cfb ? extractHwp5Images(cfb.FileIndex, blocks, warnings) : extractHwp5ImagesLenient(lenientCfb, blocks, warnings);
3782
- const flatBlocks = _chunkXL6O3VAYcjs.flattenLayoutTables.call(void 0, blocks);
3788
+ const flatBlocks = _chunkVHXUD3PWcjs.flattenLayoutTables.call(void 0, blocks);
3783
3789
  if (docInfo) {
3784
3790
  detectHwp5Headings(flatBlocks, docInfo);
3785
3791
  }
3786
3792
  const outline = flatBlocks.filter((b) => b.type === "heading" && b.level && b.text).map((b) => ({ level: b.level, text: b.text, pageNumber: b.pageNumber }));
3787
- const markdown = _chunkXL6O3VAYcjs.blocksToMarkdown.call(void 0, flatBlocks);
3793
+ const markdown = _chunkVHXUD3PWcjs.blocksToMarkdown.call(void 0, flatBlocks);
3788
3794
  return { markdown, blocks: flatBlocks, metadata, outline: outline.length > 0 ? outline : void 0, warnings: warnings.length > 0 ? warnings : void 0, images: images.length > 0 ? images : void 0 };
3789
3795
  }
3790
3796
  function parseDocInfoStream(cfb, compressed) {
3791
3797
  try {
3792
3798
  const entry = CFB.find(cfb, "/DocInfo");
3793
- if (!_optionalChain([entry, 'optionalAccess', _57 => _57.content])) return null;
3799
+ if (!_optionalChain([entry, 'optionalAccess', _54 => _54.content])) return null;
3794
3800
  const data = compressed ? decompressStream(Buffer.from(entry.content)) : Buffer.from(entry.content);
3795
3801
  const records = readRecords(data);
3796
3802
  return parseDocInfo(records);
@@ -3811,7 +3817,7 @@ function detectHwp5Headings(blocks, docInfo) {
3811
3817
  let baseFontSize = 0;
3812
3818
  const sizeFreq = /* @__PURE__ */ new Map();
3813
3819
  for (const b of blocks) {
3814
- if (_optionalChain([b, 'access', _58 => _58.style, 'optionalAccess', _59 => _59.fontSize]) && b.text) {
3820
+ if (_optionalChain([b, 'access', _55 => _55.style, 'optionalAccess', _56 => _56.fontSize]) && b.text) {
3815
3821
  sizeFreq.set(b.style.fontSize, (sizeFreq.get(b.style.fontSize) || 0) + b.text.length);
3816
3822
  }
3817
3823
  }
@@ -3827,7 +3833,7 @@ function detectHwp5Headings(blocks, docInfo) {
3827
3833
  const name = (style.nameKo || style.name).toLowerCase();
3828
3834
  if (name.includes("\uBC14\uD0D5") || name.includes("\uBCF8\uBB38") || name === "normal" || name === "body") {
3829
3835
  const cs = docInfo.charShapes[style.charShapeId];
3830
- if (_optionalChain([cs, 'optionalAccess', _60 => _60.fontSize]) > 0) {
3836
+ if (_optionalChain([cs, 'optionalAccess', _57 => _57.fontSize]) > 0) {
3831
3837
  baseFontSize = cs.fontSize / 10;
3832
3838
  break;
3833
3839
  }
@@ -3842,11 +3848,11 @@ function detectHwp5Headings(blocks, docInfo) {
3842
3848
  if (text.length === 0 || text.length > 200) continue;
3843
3849
  if (/^\d+$/.test(text)) continue;
3844
3850
  let level = 0;
3845
- if (_optionalChain([block, 'access', _61 => _61.style, 'optionalAccess', _62 => _62.fontSize]) && baseFontSize > 0) {
3851
+ if (_optionalChain([block, 'access', _58 => _58.style, 'optionalAccess', _59 => _59.fontSize]) && baseFontSize > 0) {
3846
3852
  const ratio = block.style.fontSize / baseFontSize;
3847
- if (ratio >= _chunkXL6O3VAYcjs.HEADING_RATIO_H1) level = 1;
3848
- else if (ratio >= _chunkXL6O3VAYcjs.HEADING_RATIO_H2) level = 2;
3849
- else if (ratio >= _chunkXL6O3VAYcjs.HEADING_RATIO_H3) level = 3;
3853
+ if (ratio >= _chunkVHXUD3PWcjs.HEADING_RATIO_H1) level = 1;
3854
+ else if (ratio >= _chunkVHXUD3PWcjs.HEADING_RATIO_H2) level = 2;
3855
+ else if (ratio >= _chunkVHXUD3PWcjs.HEADING_RATIO_H3) level = 3;
3850
3856
  }
3851
3857
  if (/^제\d+[장절편]\s/.test(text) && text.length <= 50) {
3852
3858
  if (level === 0) level = 2;
@@ -3862,7 +3868,7 @@ function detectHwp5Headings(blocks, docInfo) {
3862
3868
  function extractHwp5Metadata(cfb, metadata) {
3863
3869
  try {
3864
3870
  const summaryEntry = CFB.find(cfb, "/HwpSummaryInformation") || CFB.find(cfb, "/SummaryInformation");
3865
- if (!_optionalChain([summaryEntry, 'optionalAccess', _63 => _63.content])) return;
3871
+ if (!_optionalChain([summaryEntry, 'optionalAccess', _60 => _60.content])) return;
3866
3872
  const data = Buffer.from(summaryEntry.content);
3867
3873
  if (data.length < 48) return;
3868
3874
  const numSets = data.readUInt32LE(24);
@@ -3895,7 +3901,7 @@ function findViewTextSections(cfb, compressed) {
3895
3901
  const sections = [];
3896
3902
  for (let i = 0; i < MAX_SECTIONS; i++) {
3897
3903
  const entry = CFB.find(cfb, `/ViewText/Section${i}`);
3898
- if (!_optionalChain([entry, 'optionalAccess', _64 => _64.content])) break;
3904
+ if (!_optionalChain([entry, 'optionalAccess', _61 => _61.content])) break;
3899
3905
  try {
3900
3906
  const decrypted = decryptViewText(Buffer.from(entry.content), compressed);
3901
3907
  sections.push({ idx: i, content: decrypted });
@@ -3909,13 +3915,13 @@ function findSections(cfb) {
3909
3915
  const sections = [];
3910
3916
  for (let i = 0; i < MAX_SECTIONS; i++) {
3911
3917
  const entry = CFB.find(cfb, `/BodyText/Section${i}`);
3912
- if (!_optionalChain([entry, 'optionalAccess', _65 => _65.content])) break;
3918
+ if (!_optionalChain([entry, 'optionalAccess', _62 => _62.content])) break;
3913
3919
  sections.push({ idx: i, content: Buffer.from(entry.content) });
3914
3920
  }
3915
3921
  if (sections.length === 0 && cfb.FileIndex) {
3916
3922
  for (const entry of cfb.FileIndex) {
3917
3923
  if (sections.length >= MAX_SECTIONS) break;
3918
- if (_optionalChain([entry, 'access', _66 => _66.name, 'optionalAccess', _67 => _67.startsWith, 'call', _68 => _68("Section")]) && entry.content) {
3924
+ if (_optionalChain([entry, 'access', _63 => _63.name, 'optionalAccess', _64 => _64.startsWith, 'call', _65 => _65("Section")]) && entry.content) {
3919
3925
  const idx = parseInt(entry.name.replace("Section", ""), 10) || 0;
3920
3926
  sections.push({ idx, content: Buffer.from(entry.content) });
3921
3927
  }
@@ -3931,7 +3937,7 @@ function findSectionsLenient(lcfb, compressed) {
3931
3937
  if (!raw) break;
3932
3938
  const content = compressed ? decompressStream(raw) : raw;
3933
3939
  totalDecompressed += content.length;
3934
- if (totalDecompressed > MAX_TOTAL_DECOMPRESS) throw new (0, _chunkXL6O3VAYcjs.KordocError)("\uCD1D \uC555\uCD95 \uD574\uC81C \uD06C\uAE30 \uCD08\uACFC (decompression bomb \uC758\uC2EC)");
3940
+ if (totalDecompressed > MAX_TOTAL_DECOMPRESS) throw new (0, _chunkVHXUD3PWcjs.KordocError)("\uCD1D \uC555\uCD95 \uD574\uC81C \uD06C\uAE30 \uCD08\uACFC (decompression bomb \uC758\uC2EC)");
3935
3941
  sections.push({ idx: i, content });
3936
3942
  }
3937
3943
  if (sections.length === 0) {
@@ -3943,7 +3949,7 @@ function findSectionsLenient(lcfb, compressed) {
3943
3949
  if (raw) {
3944
3950
  const content = compressed ? decompressStream(raw) : raw;
3945
3951
  totalDecompressed += content.length;
3946
- if (totalDecompressed > MAX_TOTAL_DECOMPRESS) throw new (0, _chunkXL6O3VAYcjs.KordocError)("\uCD1D \uC555\uCD95 \uD574\uC81C \uD06C\uAE30 \uCD08\uACFC (decompression bomb \uC758\uC2EC)");
3952
+ if (totalDecompressed > MAX_TOTAL_DECOMPRESS) throw new (0, _chunkVHXUD3PWcjs.KordocError)("\uCD1D \uC555\uCD95 \uD574\uC81C \uD06C\uAE30 \uCD08\uACFC (decompression bomb \uC758\uC2EC)");
3947
3953
  sections.push({ idx, content });
3948
3954
  }
3949
3955
  }
@@ -3960,7 +3966,7 @@ function findViewTextSectionsLenient(lcfb, compressed) {
3960
3966
  try {
3961
3967
  const content = decryptViewText(raw, compressed);
3962
3968
  totalDecompressed += content.length;
3963
- if (totalDecompressed > MAX_TOTAL_DECOMPRESS) throw new (0, _chunkXL6O3VAYcjs.KordocError)("\uCD1D \uC555\uCD95 \uD574\uC81C \uD06C\uAE30 \uCD08\uACFC (decompression bomb \uC758\uC2EC)");
3969
+ if (totalDecompressed > MAX_TOTAL_DECOMPRESS) throw new (0, _chunkVHXUD3PWcjs.KordocError)("\uCD1D \uC555\uCD95 \uD574\uC81C \uD06C\uAE30 \uCD08\uACFC (decompression bomb \uC758\uC2EC)");
3964
3970
  sections.push({ idx: i, content });
3965
3971
  } catch (e26) {
3966
3972
  break;
@@ -4061,9 +4067,9 @@ function parseParagraph(records, start, end, ctx) {
4061
4067
  const applied = [];
4062
4068
  for (const r of ranges) {
4063
4069
  const ctrl = ctrls[r.ctrlIdx];
4064
- if (!_optionalChain([ctrl, 'optionalAccess', _69 => _69.href]) || r.end <= r.start) continue;
4070
+ if (!_optionalChain([ctrl, 'optionalAccess', _66 => _66.href]) || r.end <= r.start) continue;
4065
4071
  if (applied.some(([s, e]) => r.start < e && r.end > s)) continue;
4066
- const href = _chunkXL6O3VAYcjs.sanitizeHref.call(void 0, ctrl.href);
4072
+ const href = _chunkVHXUD3PWcjs.sanitizeHref.call(void 0, ctrl.href);
4067
4073
  if (!href) continue;
4068
4074
  const anchor = text.slice(r.start, r.end);
4069
4075
  if (!anchor.trim()) continue;
@@ -4081,7 +4087,7 @@ function parseParagraph(records, start, end, ctx) {
4081
4087
  }
4082
4088
  if (ps.headType === 1 || ps.headType === 2) {
4083
4089
  const nid = ps.numberingId || (ps.headType === 1 ? ctx.doc.outlineNumberingId : 0);
4084
- const numbering = nid >= 1 ? _optionalChain([ctx, 'access', _70 => _70.docInfo, 'optionalAccess', _71 => _71.numberings, 'access', _72 => _72[nid - 1]]) : void 0;
4090
+ const numbering = nid >= 1 ? _optionalChain([ctx, 'access', _67 => _67.docInfo, 'optionalAccess', _68 => _68.numberings, 'access', _69 => _69[nid - 1]]) : void 0;
4085
4091
  if (numbering) {
4086
4092
  const counters = ctx.doc.numbering.advance(nid, ps.paraLevel);
4087
4093
  const fmt = numbering.levelFormats[Math.min(ps.paraLevel, 6)];
@@ -4091,7 +4097,7 @@ function parseParagraph(records, start, end, ctx) {
4091
4097
  }
4092
4098
  }
4093
4099
  } else if (ps.headType === 3) {
4094
- const bullet = ps.numberingId >= 1 ? _optionalChain([ctx, 'access', _73 => _73.docInfo, 'optionalAccess', _74 => _74.bullets, 'access', _75 => _75[ps.numberingId - 1]]) : void 0;
4100
+ const bullet = ps.numberingId >= 1 ? _optionalChain([ctx, 'access', _70 => _70.docInfo, 'optionalAccess', _71 => _71.bullets, 'access', _72 => _72[ps.numberingId - 1]]) : void 0;
4095
4101
  if (bullet && bullet.char !== "\uFFFF") headMarker = bullet.char;
4096
4102
  }
4097
4103
  }
@@ -4296,8 +4302,8 @@ function parseTableControl(ctrl, records, ctx) {
4296
4302
  let tableIdx = -1;
4297
4303
  for (let i2 = childStart; i2 < childEnd; i2++) {
4298
4304
  if (records[i2].tagId === TAG_TABLE && records[i2].data.length >= 8) {
4299
- rows = Math.min(records[i2].data.readUInt16LE(4), _chunkXL6O3VAYcjs.MAX_ROWS);
4300
- cols = Math.min(records[i2].data.readUInt16LE(6), _chunkXL6O3VAYcjs.MAX_COLS);
4305
+ rows = Math.min(records[i2].data.readUInt16LE(4), _chunkVHXUD3PWcjs.MAX_ROWS);
4306
+ cols = Math.min(records[i2].data.readUInt16LE(6), _chunkVHXUD3PWcjs.MAX_COLS);
4301
4307
  tableIdx = i2;
4302
4308
  break;
4303
4309
  }
@@ -4337,7 +4343,7 @@ function parseTableControl(ctrl, records, ctx) {
4337
4343
  const cellRows2 = arrangeCells(rows, cols, cells);
4338
4344
  const irCells = cellRows2.map((row) => row.map((c) => {
4339
4345
  const ir = { text: c.text.trim(), colSpan: c.colSpan, rowSpan: c.rowSpan };
4340
- if (_optionalChain([c, 'access', _76 => _76.blocks, 'optionalAccess', _77 => _77.length])) ir.blocks = c.blocks;
4346
+ if (_optionalChain([c, 'access', _73 => _73.blocks, 'optionalAccess', _74 => _74.length])) ir.blocks = c.blocks;
4341
4347
  if (c.isHeader) ir.isHeader = true;
4342
4348
  return ir;
4343
4349
  }));
@@ -4346,7 +4352,7 @@ function parseTableControl(ctrl, records, ctx) {
4346
4352
  return table2;
4347
4353
  }
4348
4354
  const cellRows = arrangeCells(rows, cols, cells);
4349
- const table = _chunkXL6O3VAYcjs.buildTable.call(void 0, cellRows);
4355
+ const table = _chunkVHXUD3PWcjs.buildTable.call(void 0, cellRows);
4350
4356
  if (caption && table.rows > 0) table.caption = caption;
4351
4357
  return table.rows > 0 ? table : null;
4352
4358
  }
@@ -4363,8 +4369,8 @@ function parseCell(records, lhIdx, end, ctx) {
4363
4369
  rowAddr = rec.data.readUInt16LE(10);
4364
4370
  const cs = rec.data.readUInt16LE(12);
4365
4371
  const rs = rec.data.readUInt16LE(14);
4366
- if (cs > 0) colSpan = Math.min(cs, _chunkXL6O3VAYcjs.MAX_COLS);
4367
- if (rs > 0) rowSpan = Math.min(rs, _chunkXL6O3VAYcjs.MAX_ROWS);
4372
+ if (cs > 0) colSpan = Math.min(cs, _chunkVHXUD3PWcjs.MAX_COLS);
4373
+ if (rs > 0) rowSpan = Math.min(rs, _chunkVHXUD3PWcjs.MAX_ROWS);
4368
4374
  }
4369
4375
  const blocks = ctx.depth < MAX_NEST_DEPTH ? parseParagraphList(records, lhIdx + 1, end, { ...ctx, depth: ctx.depth + 1 }) : [];
4370
4376
  const parts = [];
@@ -4374,7 +4380,7 @@ function parseCell(records, lhIdx, end, ctx) {
4374
4380
  parts.push(`![image](hwp5bin:${b.text})`);
4375
4381
  hasStructure = true;
4376
4382
  } else if (b.type === "table" && b.table) {
4377
- const flat = _chunkXL6O3VAYcjs.convertTableToText.call(void 0, b.table.cells);
4383
+ const flat = _chunkVHXUD3PWcjs.convertTableToText.call(void 0, b.table.cells);
4378
4384
  if (flat) parts.push(flat);
4379
4385
  hasStructure = true;
4380
4386
  } else if (b.text) {
@@ -4471,8 +4477,8 @@ function pictureToImageBlock(data, ctx) {
4471
4477
  if (data.length < 73) return null;
4472
4478
  const binDataId = data.readUInt16LE(71);
4473
4479
  if (binDataId === 0) return null;
4474
- const item = _optionalChain([ctx, 'access', _78 => _78.docInfo, 'optionalAccess', _79 => _79.binData, 'access', _80 => _80[binDataId - 1]]);
4475
- if (_optionalChain([item, 'optionalAccess', _81 => _81.kind]) === "link") {
4480
+ const item = _optionalChain([ctx, 'access', _75 => _75.docInfo, 'optionalAccess', _76 => _76.binData, 'access', _77 => _77[binDataId - 1]]);
4481
+ if (_optionalChain([item, 'optionalAccess', _78 => _78.kind]) === "link") {
4476
4482
  ctx.warnings.push({ page: ctx.sectionNum, message: `\uC678\uBD80 \uC5F0\uACB0 \uC774\uBBF8\uC9C0 (binDataId ${binDataId})`, code: "SKIPPED_IMAGE" });
4477
4483
  return null;
4478
4484
  }
@@ -16803,15 +16809,15 @@ function getElements(parent, tagName) {
16803
16809
  const result = [];
16804
16810
  for (let i = 0; i < nodes.length; i++) result.push(nodes[i]);
16805
16811
  if (result.length > 0) return result;
16806
- const nsNodes = _optionalChain([parent, 'access', _82 => _82.getElementsByTagNameNS, 'optionalCall', _83 => _83("*", tagName)]);
16812
+ const nsNodes = _optionalChain([parent, 'access', _79 => _79.getElementsByTagNameNS, 'optionalCall', _80 => _80("*", tagName)]);
16807
16813
  if (nsNodes) for (let i = 0; i < nsNodes.length; i++) result.push(nsNodes[i]);
16808
16814
  return result;
16809
16815
  }
16810
16816
  function getTextContent(el) {
16811
- return _nullishCoalesce(_optionalChain([el, 'access', _84 => _84.textContent, 'optionalAccess', _85 => _85.trim, 'call', _86 => _86()]), () => ( ""));
16817
+ return _nullishCoalesce(_optionalChain([el, 'access', _81 => _81.textContent, 'optionalAccess', _82 => _82.trim, 'call', _83 => _83()]), () => ( ""));
16812
16818
  }
16813
16819
  function parseXml(text) {
16814
- return new (0, _xmldom.DOMParser)().parseFromString(_chunkXL6O3VAYcjs.stripDtd.call(void 0, text), "text/xml");
16820
+ return new (0, _xmldom.DOMParser)().parseFromString(_chunkVHXUD3PWcjs.stripDtd.call(void 0, text), "text/xml");
16815
16821
  }
16816
16822
  function parseSharedStrings(xml) {
16817
16823
  const doc = parseXml(xml);
@@ -16948,14 +16954,14 @@ function sheetToBlocks(sheetName, grid, merges, maxRow, maxCol, sheetIndex) {
16948
16954
  const merge = mergeMap.get(key);
16949
16955
  row.push({
16950
16956
  text,
16951
- colSpan: _nullishCoalesce(_optionalChain([merge, 'optionalAccess', _87 => _87.colSpan]), () => ( 1)),
16952
- rowSpan: _nullishCoalesce(_optionalChain([merge, 'optionalAccess', _88 => _88.rowSpan]), () => ( 1))
16957
+ colSpan: _nullishCoalesce(_optionalChain([merge, 'optionalAccess', _84 => _84.colSpan]), () => ( 1)),
16958
+ rowSpan: _nullishCoalesce(_optionalChain([merge, 'optionalAccess', _85 => _85.rowSpan]), () => ( 1))
16953
16959
  });
16954
16960
  }
16955
16961
  cellRows.push(row);
16956
16962
  }
16957
16963
  if (cellRows.length > 0) {
16958
- const table = _chunkXL6O3VAYcjs.buildTable.call(void 0, cellRows);
16964
+ const table = _chunkVHXUD3PWcjs.buildTable.call(void 0, cellRows);
16959
16965
  if (table.rows > 0) {
16960
16966
  blocks.push({ type: "table", table, pageNumber: sheetIndex + 1 });
16961
16967
  }
@@ -16963,12 +16969,12 @@ function sheetToBlocks(sheetName, grid, merges, maxRow, maxCol, sheetIndex) {
16963
16969
  return blocks;
16964
16970
  }
16965
16971
  async function parseXlsxDocument(buffer, options) {
16966
- _chunkXL6O3VAYcjs.precheckZipSize.call(void 0, buffer, MAX_DECOMPRESS_SIZE3);
16972
+ _chunkVHXUD3PWcjs.precheckZipSize.call(void 0, buffer, MAX_DECOMPRESS_SIZE3);
16967
16973
  const zip = await _jszip2.default.loadAsync(buffer);
16968
16974
  const warnings = [];
16969
16975
  const workbookFile = zip.file("xl/workbook.xml");
16970
16976
  if (!workbookFile) {
16971
- throw new (0, _chunkXL6O3VAYcjs.KordocError)("\uC720\uD6A8\uD558\uC9C0 \uC54A\uC740 XLSX \uD30C\uC77C: xl/workbook.xml\uC774 \uC5C6\uC2B5\uB2C8\uB2E4");
16977
+ throw new (0, _chunkVHXUD3PWcjs.KordocError)("\uC720\uD6A8\uD558\uC9C0 \uC54A\uC740 XLSX \uD30C\uC77C: xl/workbook.xml\uC774 \uC5C6\uC2B5\uB2C8\uB2E4");
16972
16978
  }
16973
16979
  let sharedStrings = [];
16974
16980
  const ssFile = zip.file("xl/sharedStrings.xml");
@@ -16977,7 +16983,7 @@ async function parseXlsxDocument(buffer, options) {
16977
16983
  }
16978
16984
  const sheets = parseWorkbook(await workbookFile.async("text"));
16979
16985
  if (sheets.length === 0) {
16980
- throw new (0, _chunkXL6O3VAYcjs.KordocError)("XLSX \uD30C\uC77C\uC5D0 \uC2DC\uD2B8\uAC00 \uC5C6\uC2B5\uB2C8\uB2E4");
16986
+ throw new (0, _chunkVHXUD3PWcjs.KordocError)("XLSX \uD30C\uC77C\uC5D0 \uC2DC\uD2B8\uAC00 \uC5C6\uC2B5\uB2C8\uB2E4");
16981
16987
  }
16982
16988
  let relsMap = /* @__PURE__ */ new Map();
16983
16989
  const relsFile = zip.file("xl/_rels/workbook.xml.rels");
@@ -16985,7 +16991,7 @@ async function parseXlsxDocument(buffer, options) {
16985
16991
  relsMap = parseRels(await relsFile.async("text"));
16986
16992
  }
16987
16993
  let pageFilter = null;
16988
- if (_optionalChain([options, 'optionalAccess', _89 => _89.pages])) {
16994
+ if (_optionalChain([options, 'optionalAccess', _86 => _86.pages])) {
16989
16995
  const { parsePageRange: parsePageRange2 } = await Promise.resolve().then(() => _interopRequireWildcard(require("./page-range-P7SDW6LR.cjs")));
16990
16996
  pageFilter = parsePageRange2(options.pages, sheets.length);
16991
16997
  }
@@ -16994,7 +17000,7 @@ async function parseXlsxDocument(buffer, options) {
16994
17000
  for (let i = 0; i < processedSheets; i++) {
16995
17001
  if (pageFilter && !pageFilter.has(i + 1)) continue;
16996
17002
  const sheet = sheets[i];
16997
- _optionalChain([options, 'optionalAccess', _90 => _90.onProgress, 'optionalCall', _91 => _91(i + 1, processedSheets)]);
17003
+ _optionalChain([options, 'optionalAccess', _87 => _87.onProgress, 'optionalCall', _88 => _88(i + 1, processedSheets)]);
16998
17004
  let sheetPath = relsMap.get(sheet.rId);
16999
17005
  if (sheetPath) {
17000
17006
  if (!sheetPath.startsWith("xl/") && !sheetPath.startsWith("/")) {
@@ -17049,7 +17055,7 @@ async function parseXlsxDocument(buffer, options) {
17049
17055
  } catch (e27) {
17050
17056
  }
17051
17057
  }
17052
- const markdown = _chunkXL6O3VAYcjs.blocksToMarkdown.call(void 0, blocks);
17058
+ const markdown = _chunkVHXUD3PWcjs.blocksToMarkdown.call(void 0, blocks);
17053
17059
  return { markdown, blocks, metadata, warnings: warnings.length > 0 ? warnings : void 0 };
17054
17060
  }
17055
17061
 
@@ -17456,11 +17462,11 @@ function processGlobals(records) {
17456
17462
  let encrypted = false;
17457
17463
  const firstBof = records[0];
17458
17464
  if (!firstBof || firstBof.opcode !== OP_BOF) {
17459
- throw new (0, _chunkXL6O3VAYcjs.KordocError)("XLS: \uCCAB \uB808\uCF54\uB4DC\uAC00 BOF\uAC00 \uC544\uB2D8");
17465
+ throw new (0, _chunkVHXUD3PWcjs.KordocError)("XLS: \uCCAB \uB808\uCF54\uB4DC\uAC00 BOF\uAC00 \uC544\uB2D8");
17460
17466
  }
17461
17467
  const bof = decodeBof(firstBof.data);
17462
17468
  if (!bof || bof.dt !== DT_GLOBALS) {
17463
- throw new (0, _chunkXL6O3VAYcjs.KordocError)("XLS: Globals \uC11C\uBE0C\uC2A4\uD2B8\uB9BC BOF \uB204\uB77D");
17469
+ throw new (0, _chunkVHXUD3PWcjs.KordocError)("XLS: Globals \uC11C\uBE0C\uC2A4\uD2B8\uB9BC BOF \uB204\uB77D");
17464
17470
  }
17465
17471
  let i = 1;
17466
17472
  while (i < records.length) {
@@ -17568,14 +17574,14 @@ function sheetToBlocks2(sheetName, sheet, sheetIndex) {
17568
17574
  const merge = mergeMap.get(key);
17569
17575
  row.push({
17570
17576
  text: grid[r][c],
17571
- colSpan: _nullishCoalesce(_optionalChain([merge, 'optionalAccess', _92 => _92.colSpan]), () => ( 1)),
17572
- rowSpan: _nullishCoalesce(_optionalChain([merge, 'optionalAccess', _93 => _93.rowSpan]), () => ( 1))
17577
+ colSpan: _nullishCoalesce(_optionalChain([merge, 'optionalAccess', _89 => _89.colSpan]), () => ( 1)),
17578
+ rowSpan: _nullishCoalesce(_optionalChain([merge, 'optionalAccess', _90 => _90.rowSpan]), () => ( 1))
17573
17579
  });
17574
17580
  }
17575
17581
  cellRows.push(row);
17576
17582
  }
17577
17583
  if (cellRows.length > 0) {
17578
- const table = _chunkXL6O3VAYcjs.buildTable.call(void 0, cellRows);
17584
+ const table = _chunkVHXUD3PWcjs.buildTable.call(void 0, cellRows);
17579
17585
  if (table.rows > 0) {
17580
17586
  blocks.push({ type: "table", table, pageNumber: sheetIndex + 1 });
17581
17587
  }
@@ -17588,21 +17594,21 @@ async function parseXlsDocument(buffer, options) {
17588
17594
  try {
17589
17595
  cfb = parseLenientCfb(buf);
17590
17596
  } catch (e) {
17591
- throw new (0, _chunkXL6O3VAYcjs.KordocError)(
17597
+ throw new (0, _chunkVHXUD3PWcjs.KordocError)(
17592
17598
  `XLS: OLE2 \uC2DC\uADF8\uB2C8\uCC98 \uAC80\uC99D \uC2E4\uD328 \u2014 ${e instanceof Error ? e.message : "\uC54C \uC218 \uC5C6\uB294 \uC624\uB958"}`
17593
17599
  );
17594
17600
  }
17595
17601
  const wb = _nullishCoalesce(cfb.findStream("/Workbook"), () => ( cfb.findStream("/Book")));
17596
17602
  if (!wb) {
17597
- throw new (0, _chunkXL6O3VAYcjs.KordocError)("XLS: Workbook \uC2A4\uD2B8\uB9BC\uC774 \uC5C6\uC74C (BIFF5 \uB610\uB294 \uBE44\uD45C\uC900 \uD30C\uC77C)");
17603
+ throw new (0, _chunkVHXUD3PWcjs.KordocError)("XLS: Workbook \uC2A4\uD2B8\uB9BC\uC774 \uC5C6\uC74C (BIFF5 \uB610\uB294 \uBE44\uD45C\uC900 \uD30C\uC77C)");
17598
17604
  }
17599
17605
  const records = readRecords2(wb);
17600
17606
  if (records.length === 0) {
17601
- throw new (0, _chunkXL6O3VAYcjs.KordocError)("XLS: \uC2DC\uADF8\uB2C8\uCC98 \uB808\uCF54\uB4DC\uAC00 \uC5C6\uC74C (Workbook \uC2A4\uD2B8\uB9BC \uC190\uC0C1)");
17607
+ throw new (0, _chunkVHXUD3PWcjs.KordocError)("XLS: \uC2DC\uADF8\uB2C8\uCC98 \uB808\uCF54\uB4DC\uAC00 \uC5C6\uC74C (Workbook \uC2A4\uD2B8\uB9BC \uC190\uC0C1)");
17602
17608
  }
17603
17609
  const firstBof = decodeBof(records[0].data);
17604
17610
  if (firstBof && firstBof.vers !== 1536) {
17605
- throw new (0, _chunkXL6O3VAYcjs.KordocError)(
17611
+ throw new (0, _chunkVHXUD3PWcjs.KordocError)(
17606
17612
  `XLS: BIFF8(0x0600)\uB9CC \uC9C0\uC6D0 \u2014 \uBCF8 \uD30C\uC77C\uC740 0x${firstBof.vers.toString(16)}`
17607
17613
  );
17608
17614
  }
@@ -17623,7 +17629,7 @@ async function parseXlsDocument(buffer, options) {
17623
17629
  }
17624
17630
  const totalSheets = Math.min(globals.sheets.length, MAX_SHEETS2);
17625
17631
  let pageFilter = null;
17626
- if (_optionalChain([options, 'optionalAccess', _94 => _94.pages])) {
17632
+ if (_optionalChain([options, 'optionalAccess', _91 => _91.pages])) {
17627
17633
  const { parsePageRange: parsePageRange2 } = await Promise.resolve().then(() => _interopRequireWildcard(require("./page-range-P7SDW6LR.cjs")));
17628
17634
  pageFilter = parsePageRange2(options.pages, totalSheets);
17629
17635
  }
@@ -17632,7 +17638,7 @@ async function parseXlsDocument(buffer, options) {
17632
17638
  if (pageFilter && !pageFilter.has(i + 1)) continue;
17633
17639
  const meta = globals.sheets[i];
17634
17640
  if (meta.dt !== 0) continue;
17635
- _optionalChain([options, 'optionalAccess', _95 => _95.onProgress, 'optionalCall', _96 => _96(i + 1, totalSheets)]);
17641
+ _optionalChain([options, 'optionalAccess', _92 => _92.onProgress, 'optionalCall', _93 => _93(i + 1, totalSheets)]);
17636
17642
  const bofIdx = findSheetBofIndex(records, meta.lbPlyPos);
17637
17643
  if (bofIdx < 0) {
17638
17644
  warnings.push({
@@ -17662,7 +17668,7 @@ async function parseXlsDocument(buffer, options) {
17662
17668
  pageCount: totalSheets
17663
17669
  };
17664
17670
  return {
17665
- markdown: _chunkXL6O3VAYcjs.blocksToMarkdown.call(void 0, allBlocks),
17671
+ markdown: _chunkVHXUD3PWcjs.blocksToMarkdown.call(void 0, allBlocks),
17666
17672
  blocks: allBlocks,
17667
17673
  metadata,
17668
17674
  warnings: warnings.length > 0 ? warnings : void 0
@@ -17675,7 +17681,7 @@ async function parseXlsDocument(buffer, options) {
17675
17681
 
17676
17682
  // src/docx/equation.ts
17677
17683
  function lname(el) {
17678
- return el.localName || _optionalChain([el, 'access', _97 => _97.tagName, 'optionalAccess', _98 => _98.replace, 'call', _99 => _99(/^[^:]+:/, "")]) || "";
17684
+ return el.localName || _optionalChain([el, 'access', _94 => _94.tagName, 'optionalAccess', _95 => _95.replace, 'call', _96 => _96(/^[^:]+:/, "")]) || "";
17679
17685
  }
17680
17686
  function kids(parent, name) {
17681
17687
  const out = [];
@@ -18048,7 +18054,7 @@ function isDisplayMath(el) {
18048
18054
  // src/docx/parser.ts
18049
18055
  var MAX_DECOMPRESS_SIZE4 = 100 * 1024 * 1024;
18050
18056
  function matchesLocal(el, localName2) {
18051
- return el.localName === localName2 || (_nullishCoalesce(_optionalChain([el, 'access', _100 => _100.tagName, 'optionalAccess', _101 => _101.endsWith, 'call', _102 => _102(`:${localName2}`)]), () => ( false)));
18057
+ return el.localName === localName2 || (_nullishCoalesce(_optionalChain([el, 'access', _97 => _97.tagName, 'optionalAccess', _98 => _98.endsWith, 'call', _99 => _99(`:${localName2}`)]), () => ( false)));
18052
18058
  }
18053
18059
  function effectiveChildElements(parent) {
18054
18060
  const result = [];
@@ -18081,7 +18087,7 @@ function findElements(parent, localName2) {
18081
18087
  const child = children[i];
18082
18088
  if (child.nodeType === 1) {
18083
18089
  const el = child;
18084
- if (el.localName === localName2 || _optionalChain([el, 'access', _103 => _103.tagName, 'optionalAccess', _104 => _104.endsWith, 'call', _105 => _105(`:${localName2}`)])) {
18090
+ if (el.localName === localName2 || _optionalChain([el, 'access', _100 => _100.tagName, 'optionalAccess', _101 => _101.endsWith, 'call', _102 => _102(`:${localName2}`)])) {
18085
18091
  result.push(el);
18086
18092
  }
18087
18093
  walk(el);
@@ -18100,7 +18106,7 @@ function getAttr(el, localName2) {
18100
18106
  return null;
18101
18107
  }
18102
18108
  function parseXml2(text) {
18103
- return new (0, _xmldom.DOMParser)().parseFromString(_chunkXL6O3VAYcjs.stripDtd.call(void 0, text), "text/xml");
18109
+ return new (0, _xmldom.DOMParser)().parseFromString(_chunkVHXUD3PWcjs.stripDtd.call(void 0, text), "text/xml");
18104
18110
  }
18105
18111
  function parseStyles(xml) {
18106
18112
  const doc = parseXml2(xml);
@@ -18202,7 +18208,7 @@ function collectOmmlRoots(p) {
18202
18208
  const child = children[i];
18203
18209
  if (child.nodeType !== 1) continue;
18204
18210
  const el = child;
18205
- const tag = el.localName || _optionalChain([el, 'access', _106 => _106.tagName, 'optionalAccess', _107 => _107.replace, 'call', _108 => _108(/^[^:]+:/, "")]) || "";
18211
+ const tag = el.localName || _optionalChain([el, 'access', _103 => _103.tagName, 'optionalAccess', _104 => _104.replace, 'call', _105 => _105(/^[^:]+:/, "")]) || "";
18206
18212
  if (tag === "oMath" || tag === "oMathPara") {
18207
18213
  out.push(el);
18208
18214
  } else {
@@ -18291,7 +18297,7 @@ function parseParagraph2(p, styles, numbering, footnotes, rels) {
18291
18297
  const text = parts.join("").replace(/[ \t]{2,}/g, " ").trim();
18292
18298
  if (!text) return null;
18293
18299
  const style = styles.get(styleId);
18294
- if (_optionalChain([style, 'optionalAccess', _109 => _109.outlineLevel]) !== void 0 && style.outlineLevel >= 0 && style.outlineLevel <= 5) {
18300
+ if (_optionalChain([style, 'optionalAccess', _106 => _106.outlineLevel]) !== void 0 && style.outlineLevel >= 0 && style.outlineLevel <= 5) {
18295
18301
  return {
18296
18302
  type: "heading",
18297
18303
  text,
@@ -18300,8 +18306,8 @@ function parseParagraph2(p, styles, numbering, footnotes, rels) {
18300
18306
  }
18301
18307
  if (numId && numId !== "0") {
18302
18308
  const numDef = numbering.get(numId);
18303
- const levelInfo = _optionalChain([numDef, 'optionalAccess', _110 => _110.get, 'call', _111 => _111(ilvl)]);
18304
- const listType = _optionalChain([levelInfo, 'optionalAccess', _112 => _112.numFmt]) === "bullet" ? "unordered" : "ordered";
18309
+ const levelInfo = _optionalChain([numDef, 'optionalAccess', _107 => _107.get, 'call', _108 => _108(ilvl)]);
18310
+ const listType = _optionalChain([levelInfo, 'optionalAccess', _109 => _109.numFmt]) === "bullet" ? "unordered" : "ordered";
18305
18311
  return { type: "list", text, listType };
18306
18312
  }
18307
18313
  const block = { type: "paragraph", text };
@@ -18312,74 +18318,79 @@ function parseParagraph2(p, styles, numbering, footnotes, rels) {
18312
18318
  if (footnoteText) block.footnoteText = footnoteText;
18313
18319
  return block;
18314
18320
  }
18321
+ function collectTextboxParagraphs(node, inTxbx = false, out = [], depth = 0) {
18322
+ if (depth > 40) return out;
18323
+ for (const el of effectiveChildElements(node)) {
18324
+ if (matchesLocal(el, "Fallback")) continue;
18325
+ const nowIn = inTxbx || matchesLocal(el, "txbxContent");
18326
+ if (nowIn && matchesLocal(el, "p")) out.push(el);
18327
+ collectTextboxParagraphs(el, nowIn, out, depth + 1);
18328
+ }
18329
+ return out;
18330
+ }
18315
18331
  function parseTable(tbl, styles, numbering, footnotes, rels) {
18316
18332
  const trElements = getChildElements(tbl, "tr");
18317
18333
  if (trElements.length === 0) return null;
18318
- const rows = [];
18319
- let maxCols = 0;
18334
+ const rawRows = [];
18320
18335
  for (const tr of trElements) {
18321
- const tcElements = getChildElements(tr, "tc");
18322
18336
  const row = [];
18323
- for (const tc of tcElements) {
18337
+ let col = 0;
18338
+ for (const tc of getChildElements(tr, "tc")) {
18324
18339
  let colSpan = 1;
18325
- let rowSpan = 1;
18340
+ let vMerge = null;
18326
18341
  const tcPrEls = getChildElements(tc, "tcPr");
18327
18342
  if (tcPrEls.length > 0) {
18328
18343
  const gridSpanEls = getChildElements(tcPrEls[0], "gridSpan");
18329
18344
  if (gridSpanEls.length > 0) {
18330
- colSpan = parseInt(_nullishCoalesce(getAttr(gridSpanEls[0], "val"), () => ( "1")), 10);
18345
+ colSpan = parseInt(_nullishCoalesce(getAttr(gridSpanEls[0], "val"), () => ( "1")), 10) || 1;
18331
18346
  }
18332
18347
  const vMergeEls = getChildElements(tcPrEls[0], "vMerge");
18333
18348
  if (vMergeEls.length > 0) {
18334
- const val = getAttr(vMergeEls[0], "val");
18335
- if (val !== "restart" && val !== null) {
18336
- row.push({ text: "", colSpan, rowSpan: 0 });
18337
- continue;
18338
- }
18349
+ vMerge = getAttr(vMergeEls[0], "val") === "restart" ? "restart" : "continue";
18350
+ }
18351
+ }
18352
+ const text = vMerge === "continue" ? "" : collectCellText(tc, styles, numbering, footnotes, rels, 0).join("\n");
18353
+ row.push({ col, colSpan, vMerge, text });
18354
+ col += colSpan;
18355
+ }
18356
+ rawRows.push(row);
18357
+ }
18358
+ const cellRows = rawRows.map(
18359
+ (row, r) => row.filter((cell) => cell.vMerge !== "continue").map((cell) => {
18360
+ let rowSpan = 1;
18361
+ if (cell.vMerge === "restart") {
18362
+ for (let nr = r + 1; nr < rawRows.length; nr++) {
18363
+ if (!rawRows[nr].some((nc) => nc.col === cell.col && nc.vMerge === "continue")) break;
18364
+ rowSpan++;
18339
18365
  }
18340
18366
  }
18341
- const cellTexts = [];
18342
- const pElements = getChildElements(tc, "p");
18343
- for (const p of pElements) {
18344
- const block = parseParagraph2(p, styles, numbering, footnotes, rels);
18345
- if (_optionalChain([block, 'optionalAccess', _113 => _113.text])) cellTexts.push(block.text);
18367
+ return { text: cell.text, colSpan: cell.colSpan, rowSpan, colAddr: cell.col, rowAddr: r };
18368
+ })
18369
+ );
18370
+ const table = _chunkVHXUD3PWcjs.buildTable.call(void 0, cellRows);
18371
+ if (table.rows === 0 || table.cols === 0) return null;
18372
+ return { type: "table", table };
18373
+ }
18374
+ function collectCellText(tc, styles, numbering, footnotes, rels, depth) {
18375
+ const parts = [];
18376
+ if (depth > 20) return parts;
18377
+ for (const el of effectiveChildElements(tc)) {
18378
+ if (matchesLocal(el, "p")) {
18379
+ const block = parseParagraph2(el, styles, numbering, footnotes, rels);
18380
+ if (_optionalChain([block, 'optionalAccess', _110 => _110.text])) parts.push(block.text);
18381
+ for (const tp of collectTextboxParagraphs(el)) {
18382
+ const tb = parseParagraph2(tp, styles, numbering, footnotes, rels);
18383
+ if (_optionalChain([tb, 'optionalAccess', _111 => _111.text])) parts.push(tb.text);
18346
18384
  }
18347
- row.push({ text: cellTexts.join("\n"), colSpan, rowSpan });
18348
- }
18349
- rows.push(row);
18350
- if (row.length > maxCols) maxCols = row.length;
18351
- }
18352
- for (let c = 0; c < maxCols; c++) {
18353
- for (let r = 0; r < rows.length; r++) {
18354
- const cell = rows[r][c];
18355
- if (!cell || cell.rowSpan === 0) continue;
18356
- let span = 1;
18357
- for (let nr = r + 1; nr < rows.length; nr++) {
18358
- if (_optionalChain([rows, 'access', _114 => _114[nr], 'access', _115 => _115[c], 'optionalAccess', _116 => _116.rowSpan]) === 0) span++;
18359
- else break;
18385
+ } else if (matchesLocal(el, "tbl")) {
18386
+ for (const tr of getChildElements(el, "tr")) {
18387
+ for (const nestedTc of getChildElements(tr, "tc")) {
18388
+ parts.push(...collectCellText(nestedTc, styles, numbering, footnotes, rels, depth + 1));
18389
+ }
18360
18390
  }
18361
- cell.rowSpan = span;
18362
18391
  }
18363
18392
  }
18364
- const cleanRows = [];
18365
- for (const row of rows) {
18366
- const clean = row.filter((cell) => cell.rowSpan !== 0);
18367
- cleanRows.push(clean);
18368
- }
18369
- if (cleanRows.length === 0) return null;
18370
- let cols = 0;
18371
- for (const row of cleanRows) {
18372
- let c = 0;
18373
- for (const cell of row) c += cell.colSpan;
18374
- if (c > cols) cols = c;
18375
- }
18376
- const table = {
18377
- rows: cleanRows.length,
18378
- cols,
18379
- cells: cleanRows,
18380
- hasHeader: cleanRows.length > 1
18381
- };
18382
- return { type: "table", table };
18393
+ return parts;
18383
18394
  }
18384
18395
  async function extractImages(zip, rels, doc, warnings) {
18385
18396
  const blocks = [];
@@ -18399,7 +18410,7 @@ async function extractImages(zip, rels, doc, warnings) {
18399
18410
  try {
18400
18411
  const data = await imgFile.async("uint8array");
18401
18412
  imgIdx++;
18402
- const ext = _nullishCoalesce(_optionalChain([imgPath, 'access', _117 => _117.split, 'call', _118 => _118("."), 'access', _119 => _119.pop, 'call', _120 => _120(), 'optionalAccess', _121 => _121.toLowerCase, 'call', _122 => _122()]), () => ( "png"));
18413
+ const ext = _nullishCoalesce(_optionalChain([imgPath, 'access', _112 => _112.split, 'call', _113 => _113("."), 'access', _114 => _114.pop, 'call', _115 => _115(), 'optionalAccess', _116 => _116.toLowerCase, 'call', _117 => _117()]), () => ( "png"));
18403
18414
  const mimeMap = {
18404
18415
  png: "image/png",
18405
18416
  jpg: "image/jpeg",
@@ -18423,12 +18434,12 @@ async function extractImages(zip, rels, doc, warnings) {
18423
18434
  return { blocks, images };
18424
18435
  }
18425
18436
  async function parseDocxDocument(buffer, options) {
18426
- _chunkXL6O3VAYcjs.precheckZipSize.call(void 0, buffer, MAX_DECOMPRESS_SIZE4);
18437
+ _chunkVHXUD3PWcjs.precheckZipSize.call(void 0, buffer, MAX_DECOMPRESS_SIZE4);
18427
18438
  const zip = await _jszip2.default.loadAsync(buffer);
18428
18439
  const warnings = [];
18429
18440
  const docFile = zip.file("word/document.xml");
18430
18441
  if (!docFile) {
18431
- throw new (0, _chunkXL6O3VAYcjs.KordocError)("\uC720\uD6A8\uD558\uC9C0 \uC54A\uC740 DOCX \uD30C\uC77C: word/document.xml\uC774 \uC5C6\uC2B5\uB2C8\uB2E4");
18442
+ throw new (0, _chunkVHXUD3PWcjs.KordocError)("\uC720\uD6A8\uD558\uC9C0 \uC54A\uC740 DOCX \uD30C\uC77C: word/document.xml\uC774 \uC5C6\uC2B5\uB2C8\uB2E4");
18432
18443
  }
18433
18444
  let rels = /* @__PURE__ */ new Map();
18434
18445
  const relsFile = zip.file("word/_rels/document.xml.rels");
@@ -18475,16 +18486,20 @@ async function parseDocxDocument(buffer, options) {
18475
18486
  const doc = parseXml2(docXml);
18476
18487
  const body = findElements(doc, "body");
18477
18488
  if (body.length === 0) {
18478
- throw new (0, _chunkXL6O3VAYcjs.KordocError)("DOCX \uBCF8\uBB38(w:body)\uC744 \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4");
18489
+ throw new (0, _chunkVHXUD3PWcjs.KordocError)("DOCX \uBCF8\uBB38(w:body)\uC744 \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4");
18479
18490
  }
18480
18491
  const blocks = [];
18481
18492
  const bodyEl = body[0];
18482
18493
  const topLevel = effectiveChildElements(bodyEl);
18483
18494
  for (const el of topLevel) {
18484
- const localName2 = _nullishCoalesce(el.localName, () => ( _optionalChain([el, 'access', _123 => _123.tagName, 'optionalAccess', _124 => _124.split, 'call', _125 => _125(":"), 'access', _126 => _126.pop, 'call', _127 => _127()])));
18495
+ const localName2 = _nullishCoalesce(el.localName, () => ( _optionalChain([el, 'access', _118 => _118.tagName, 'optionalAccess', _119 => _119.split, 'call', _120 => _120(":"), 'access', _121 => _121.pop, 'call', _122 => _122()])));
18485
18496
  if (localName2 === "p") {
18486
18497
  const block = parseParagraph2(el, styles, numbering, footnotes, rels);
18487
18498
  if (block) blocks.push(block);
18499
+ for (const tp of collectTextboxParagraphs(el)) {
18500
+ const tb = parseParagraph2(tp, styles, numbering, footnotes, rels);
18501
+ if (tb) blocks.push(tb);
18502
+ }
18488
18503
  } else if (localName2 === "tbl") {
18489
18504
  const block = parseTable(el, styles, numbering, footnotes, rels);
18490
18505
  if (block) blocks.push(block);
@@ -18516,7 +18531,7 @@ async function parseDocxDocument(buffer, options) {
18516
18531
  }
18517
18532
  }
18518
18533
  const outline = blocks.filter((b) => b.type === "heading").map((b) => ({ level: _nullishCoalesce(b.level, () => ( 2)), text: _nullishCoalesce(b.text, () => ( "")) }));
18519
- const markdown = _chunkXL6O3VAYcjs.blocksToMarkdown.call(void 0, blocks);
18534
+ const markdown = _chunkVHXUD3PWcjs.blocksToMarkdown.call(void 0, blocks);
18520
18535
  return {
18521
18536
  markdown,
18522
18537
  blocks,
@@ -18539,7 +18554,7 @@ function parseHwpmlDocument(buffer, options) {
18539
18554
  }
18540
18555
  const text = new TextDecoder("utf-8").decode(buffer).replace(/^\uFEFF/, "");
18541
18556
  const normalized = text.replace(/&nbsp;/g, "&#160;");
18542
- const xml = _chunkXL6O3VAYcjs.stripDtd.call(void 0, normalized);
18557
+ const xml = _chunkVHXUD3PWcjs.stripDtd.call(void 0, normalized);
18543
18558
  const warnings = [];
18544
18559
  const parser = new (0, _xmldom.DOMParser)({
18545
18560
  onError: (_level, msg2) => {
@@ -18567,7 +18582,7 @@ function parseHwpmlDocument(buffer, options) {
18567
18582
  return { markdown: "", blocks: [], metadata, warnings };
18568
18583
  }
18569
18584
  const blocks = [];
18570
- const pageFilter = _optionalChain([options, 'optionalAccess', _128 => _128.pages]) ? _chunkDCZVOIEOcjs.parsePageRange.call(void 0, options.pages, countSections(body)) : null;
18585
+ const pageFilter = _optionalChain([options, 'optionalAccess', _123 => _123.pages]) ? _chunkDCZVOIEOcjs.parsePageRange.call(void 0, options.pages, countSections(body)) : null;
18571
18586
  let sectionIdx = 0;
18572
18587
  const children = body.childNodes;
18573
18588
  for (let i = 0; i < children.length; i++) {
@@ -18579,7 +18594,7 @@ function parseHwpmlDocument(buffer, options) {
18579
18594
  parseSection2(el, blocks, paraShapeMap, sectionIdx, warnings);
18580
18595
  }
18581
18596
  const outline = blocks.filter((b) => b.type === "heading" && b.text).map((b) => ({ level: _nullishCoalesce(b.level, () => ( 1)), text: b.text, pageNumber: b.pageNumber }));
18582
- const markdown = _chunkXL6O3VAYcjs.blocksToMarkdown.call(void 0, blocks);
18597
+ const markdown = _chunkVHXUD3PWcjs.blocksToMarkdown.call(void 0, blocks);
18583
18598
  return {
18584
18599
  markdown,
18585
18600
  blocks,
@@ -18665,7 +18680,7 @@ function parseParagraph3(el, blocks, paraShapeMap, sectionNum) {
18665
18680
  const shapeInfo = paraShapeMap.get(paraShapeId);
18666
18681
  const text = extractParagraphText(el);
18667
18682
  if (!text) return;
18668
- if (_optionalChain([shapeInfo, 'optionalAccess', _129 => _129.headingLevel]) != null) {
18683
+ if (_optionalChain([shapeInfo, 'optionalAccess', _124 => _124.headingLevel]) != null) {
18669
18684
  blocks.push({ type: "heading", text, level: shapeInfo.headingLevel, pageNumber: sectionNum });
18670
18685
  } else {
18671
18686
  blocks.push({ type: "paragraph", text, pageNumber: sectionNum });
@@ -18737,15 +18752,15 @@ function parseTable2(el, blocks, paraShapeMap, sectionNum, warnings) {
18737
18752
  const cellRows = grid.map(
18738
18753
  (row) => row.map((cell) => _nullishCoalesce(cell, () => ( { text: "", colSpan: 1, rowSpan: 1 })))
18739
18754
  );
18740
- const table = _chunkXL6O3VAYcjs.buildTable.call(void 0, cellRows);
18755
+ const table = _chunkVHXUD3PWcjs.buildTable.call(void 0, cellRows);
18741
18756
  blocks.push({ type: "table", table, pageNumber: sectionNum });
18742
18757
  }
18743
18758
  function extractCellText(cellEl) {
18744
18759
  const textParts = [];
18745
- collectCellText(cellEl, textParts, 0);
18760
+ collectCellText2(cellEl, textParts, 0);
18746
18761
  return textParts.filter(Boolean).join("\n").trim();
18747
18762
  }
18748
- function collectCellText(node, parts, depth) {
18763
+ function collectCellText2(node, parts, depth) {
18749
18764
  if (depth > 20) return;
18750
18765
  const children = node.childNodes;
18751
18766
  for (let i = 0; i < children.length; i++) {
@@ -18757,9 +18772,9 @@ function collectCellText(node, parts, depth) {
18757
18772
  if (t) parts.push(t);
18758
18773
  collectNestedTableText(el, parts, depth + 1);
18759
18774
  } else if (tag === "TABLE") {
18760
- collectCellText(el, parts, depth + 1);
18775
+ collectCellText2(el, parts, depth + 1);
18761
18776
  } else {
18762
- collectCellText(el, parts, depth + 1);
18777
+ collectCellText2(el, parts, depth + 1);
18763
18778
  }
18764
18779
  }
18765
18780
  }
@@ -18771,7 +18786,7 @@ function collectNestedTableText(node, parts, depth) {
18771
18786
  if (el.nodeType !== 1) continue;
18772
18787
  const tag = localName(el);
18773
18788
  if (tag === "TABLE") {
18774
- collectCellText(el, parts, depth + 1);
18789
+ collectCellText2(el, parts, depth + 1);
18775
18790
  continue;
18776
18791
  }
18777
18792
  if (tag === "FOOTNOTE" || tag === "ENDNOTE" || tag === "HEADER" || tag === "FOOTER") continue;
@@ -19114,8 +19129,8 @@ function extractFromTable(table) {
19114
19129
  if (table.cols >= 2) {
19115
19130
  for (let r = 0; r < table.rows; r++) {
19116
19131
  for (let c = 0; c < table.cols - 1; c++) {
19117
- const labelCell = _optionalChain([table, 'access', _130 => _130.cells, 'access', _131 => _131[r], 'optionalAccess', _132 => _132[c]]);
19118
- const valueCell = _optionalChain([table, 'access', _133 => _133.cells, 'access', _134 => _134[r], 'optionalAccess', _135 => _135[c + 1]]);
19132
+ const labelCell = _optionalChain([table, 'access', _125 => _125.cells, 'access', _126 => _126[r], 'optionalAccess', _127 => _127[c]]);
19133
+ const valueCell = _optionalChain([table, 'access', _128 => _128.cells, 'access', _129 => _129[r], 'optionalAccess', _130 => _130[c + 1]]);
19119
19134
  if (!labelCell || !valueCell) continue;
19120
19135
  if (isLabelCell(labelCell.text)) {
19121
19136
  fields.push({
@@ -19137,8 +19152,8 @@ function extractFromTable(table) {
19137
19152
  if (allLabels) {
19138
19153
  for (let r = 1; r < table.rows; r++) {
19139
19154
  for (let c = 0; c < table.cols; c++) {
19140
- const label = _nullishCoalesce(_optionalChain([headerRow, 'access', _136 => _136[c], 'optionalAccess', _137 => _137.text, 'access', _138 => _138.trim, 'call', _139 => _139()]), () => ( ""));
19141
- const value = _nullishCoalesce(_optionalChain([table, 'access', _140 => _140.cells, 'access', _141 => _141[r], 'optionalAccess', _142 => _142[c], 'optionalAccess', _143 => _143.text, 'access', _144 => _144.trim, 'call', _145 => _145()]), () => ( ""));
19155
+ const label = _nullishCoalesce(_optionalChain([headerRow, 'access', _131 => _131[c], 'optionalAccess', _132 => _132.text, 'access', _133 => _133.trim, 'call', _134 => _134()]), () => ( ""));
19156
+ const value = _nullishCoalesce(_optionalChain([table, 'access', _135 => _135.cells, 'access', _136 => _136[r], 'optionalAccess', _137 => _137[c], 'optionalAccess', _138 => _138.text, 'access', _139 => _139.trim, 'call', _140 => _140()]), () => ( ""));
19142
19157
  if (label && value) {
19143
19158
  fields.push({ label, value, row: r, col: c });
19144
19159
  }
@@ -19231,7 +19246,7 @@ function fillFormFields(blocks, values) {
19231
19246
  for (const table of allTables) {
19232
19247
  for (let r = 0; r < table.rows; r++) {
19233
19248
  for (let c = 0; c < table.cols; c++) {
19234
- const cell = _optionalChain([table, 'access', _146 => _146.cells, 'access', _147 => _147[r], 'optionalAccess', _148 => _148[c]]);
19249
+ const cell = _optionalChain([table, 'access', _141 => _141.cells, 'access', _142 => _142[r], 'optionalAccess', _143 => _143[c]]);
19235
19250
  if (!cell) continue;
19236
19251
  const result = fillInCellPatterns(cell.text, cursor, matchedLabels);
19237
19252
  if (result) {
@@ -19263,7 +19278,7 @@ function collectIRTables(blocks, depth) {
19263
19278
  out.push(block.table);
19264
19279
  for (const row of block.table.cells) {
19265
19280
  for (const cell of row) {
19266
- if (_optionalChain([cell, 'optionalAccess', _149 => _149.blocks, 'optionalAccess', _150 => _150.length])) out.push(...collectIRTables(cell.blocks, depth + 1));
19281
+ if (_optionalChain([cell, 'optionalAccess', _144 => _144.blocks, 'optionalAccess', _145 => _145.length])) out.push(...collectIRTables(cell.blocks, depth + 1));
19267
19282
  }
19268
19283
  }
19269
19284
  }
@@ -19274,7 +19289,7 @@ function coveredPositions(table) {
19274
19289
  for (let r = 0; r < table.rows; r++) {
19275
19290
  for (let c = 0; c < table.cols; c++) {
19276
19291
  if (covered.has(`${r},${c}`)) continue;
19277
- const cell = _optionalChain([table, 'access', _151 => _151.cells, 'access', _152 => _152[r], 'optionalAccess', _153 => _153[c]]);
19292
+ const cell = _optionalChain([table, 'access', _146 => _146.cells, 'access', _147 => _147[r], 'optionalAccess', _148 => _148[c]]);
19278
19293
  if (!cell) continue;
19279
19294
  for (let dr = 0; dr < cell.rowSpan; dr++) {
19280
19295
  for (let dc = 0; dc < cell.colSpan; dc++) {
@@ -19308,7 +19323,7 @@ function fillTable(table, values, filled, matchedLabels, patternFilledCells) {
19308
19323
  if (matchKey === void 0) continue;
19309
19324
  const newValue = values.consume(matchKey);
19310
19325
  if (newValue === void 0) continue;
19311
- if (_optionalChain([patternFilledCells, 'optionalAccess', _154 => _154.has, 'call', _155 => _155(valueCell)])) {
19326
+ if (_optionalChain([patternFilledCells, 'optionalAccess', _149 => _149.has, 'call', _150 => _150(valueCell)])) {
19312
19327
  valueCell.text = newValue + " " + valueCell.text;
19313
19328
  } else {
19314
19329
  valueCell.text = newValue;
@@ -19333,7 +19348,7 @@ function fillTable(table, values, filled, matchedLabels, patternFilledCells) {
19333
19348
  for (let c = 0; c < table.cols; c++) {
19334
19349
  if (covered.has(`${r},${c}`)) continue;
19335
19350
  const headerCell = headerRow[c];
19336
- const valueCell = _optionalChain([table, 'access', _156 => _156.cells, 'access', _157 => _157[r], 'optionalAccess', _158 => _158[c]]);
19351
+ const valueCell = _optionalChain([table, 'access', _151 => _151.cells, 'access', _152 => _152[r], 'optionalAccess', _153 => _153[c]]);
19337
19352
  if (!headerCell || !valueCell) continue;
19338
19353
  const headerLabel = normalizeLabel(headerCell.text);
19339
19354
  const matchKey = findMatchingKey(headerLabel, values);
@@ -19926,19 +19941,19 @@ function parseCentralDirectory(buf) {
19926
19941
  }
19927
19942
  }
19928
19943
  }
19929
- if (eocdOffset < 0) throw new (0, _chunkXL6O3VAYcjs.KordocError)("ZIP EOCD\uB97C \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4");
19944
+ if (eocdOffset < 0) throw new (0, _chunkVHXUD3PWcjs.KordocError)("ZIP EOCD\uB97C \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4");
19930
19945
  const totalEntries = view.getUint16(eocdOffset + 10, true);
19931
19946
  const cdSize = view.getUint32(eocdOffset + 12, true);
19932
19947
  const cdOffset = view.getUint32(eocdOffset + 16, true);
19933
- if (cdOffset === 4294967295 || totalEntries === 65535) throw new (0, _chunkXL6O3VAYcjs.KordocError)("ZIP64\uB294 \uC9C0\uC6D0\uD558\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4");
19948
+ if (cdOffset === 4294967295 || totalEntries === 65535) throw new (0, _chunkVHXUD3PWcjs.KordocError)("ZIP64\uB294 \uC9C0\uC6D0\uD558\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4");
19934
19949
  if (eocdOffset >= 20 && view.getUint32(eocdOffset - 20, true) === ZIP64_EOCD_LOC_SIG) {
19935
- throw new (0, _chunkXL6O3VAYcjs.KordocError)("ZIP64\uB294 \uC9C0\uC6D0\uD558\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4");
19950
+ throw new (0, _chunkVHXUD3PWcjs.KordocError)("ZIP64\uB294 \uC9C0\uC6D0\uD558\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4");
19936
19951
  }
19937
19952
  const decoder = new TextDecoder("utf-8");
19938
19953
  const entries = [];
19939
19954
  let pos = cdOffset;
19940
19955
  for (let i = 0; i < totalEntries; i++) {
19941
- if (view.getUint32(pos, true) !== CD_SIG) throw new (0, _chunkXL6O3VAYcjs.KordocError)("ZIP Central Directory \uC190\uC0C1");
19956
+ if (view.getUint32(pos, true) !== CD_SIG) throw new (0, _chunkVHXUD3PWcjs.KordocError)("ZIP Central Directory \uC190\uC0C1");
19942
19957
  const flags = view.getUint16(pos + 8, true);
19943
19958
  const method = view.getUint16(pos + 10, true);
19944
19959
  const crc = view.getUint32(pos + 16, true);
@@ -19949,7 +19964,7 @@ function parseCentralDirectory(buf) {
19949
19964
  const commentLen = view.getUint16(pos + 32, true);
19950
19965
  const localOffset = view.getUint32(pos + 42, true);
19951
19966
  if (compSize === 4294967295 || uncompSize === 4294967295 || localOffset === 4294967295) {
19952
- throw new (0, _chunkXL6O3VAYcjs.KordocError)("ZIP64\uB294 \uC9C0\uC6D0\uD558\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4");
19967
+ throw new (0, _chunkVHXUD3PWcjs.KordocError)("ZIP64\uB294 \uC9C0\uC6D0\uD558\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4");
19953
19968
  }
19954
19969
  const name = decoder.decode(buf.subarray(pos + 46, pos + 46 + nameLen));
19955
19970
  const cdEnd = pos + 46 + nameLen + extraLen + commentLen;
@@ -19978,7 +19993,7 @@ function patchZipEntries(original, replacements) {
19978
19993
  const { entries, cdOffset, eocdOffset } = parseCentralDirectory(original);
19979
19994
  const view = new DataView(original.buffer, original.byteOffset, original.byteLength);
19980
19995
  for (const name of replacements.keys()) {
19981
- if (!entries.some((e) => e.name === name)) throw new (0, _chunkXL6O3VAYcjs.KordocError)(`ZIP\uC5D0 \uC5C6\uB294 \uC5D4\uD2B8\uB9AC: ${name}`);
19996
+ if (!entries.some((e) => e.name === name)) throw new (0, _chunkVHXUD3PWcjs.KordocError)(`ZIP\uC5D0 \uC5C6\uB294 \uC5D4\uD2B8\uB9AC: ${name}`);
19982
19997
  }
19983
19998
  const byLocal = [...entries].sort((a, b) => a.localOffset - b.localOffset);
19984
19999
  const segments = [];
@@ -19996,7 +20011,7 @@ function patchZipEntries(original, replacements) {
19996
20011
  offset += seg.length;
19997
20012
  continue;
19998
20013
  }
19999
- if (view.getUint32(e.localOffset, true) !== LOCAL_SIG) throw new (0, _chunkXL6O3VAYcjs.KordocError)("ZIP \uB85C\uCEEC \uD5E4\uB354 \uC2DC\uADF8\uB2C8\uCC98 \uBD88\uC77C\uCE58");
20014
+ if (view.getUint32(e.localOffset, true) !== LOCAL_SIG) throw new (0, _chunkVHXUD3PWcjs.KordocError)("ZIP \uB85C\uCEEC \uD5E4\uB354 \uC2DC\uADF8\uB2C8\uCC98 \uBD88\uC77C\uCE58");
20000
20015
  const nameLen = view.getUint16(e.localOffset + 26, true);
20001
20016
  const extraLen = view.getUint16(e.localOffset + 28, true);
20002
20017
  const headerLen = 30 + nameLen + extraLen;
@@ -20051,7 +20066,7 @@ async function fillHwpx(hwpxBuffer, values) {
20051
20066
  const zip = await _jszip2.default.loadAsync(hwpxBuffer);
20052
20067
  const sectionPaths = Object.keys(zip.files).filter((name) => /[Ss]ection\d+\.xml$/i.test(name)).sort();
20053
20068
  if (sectionPaths.length === 0) {
20054
- throw new (0, _chunkXL6O3VAYcjs.KordocError)("HWPX\uC5D0\uC11C \uC139\uC158 \uD30C\uC77C\uC744 \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4");
20069
+ throw new (0, _chunkVHXUD3PWcjs.KordocError)("HWPX\uC5D0\uC11C \uC139\uC158 \uD30C\uC77C\uC744 \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4");
20055
20070
  }
20056
20071
  const normalizedValues = normalizeValues(values);
20057
20072
  const cursor = new ValueCursor(normalizedValues);
@@ -20210,7 +20225,7 @@ async function fillHwpx(hwpxBuffer, values) {
20210
20225
  }
20211
20226
  for (const para of [...scan.bodyParagraphs, ...scan.excludedParagraphs]) {
20212
20227
  const existing = ledger.get(para);
20213
- if (_optionalChain([existing, 'optionalAccess', _159 => _159.fullText]) !== void 0) continue;
20228
+ if (_optionalChain([existing, 'optionalAccess', _154 => _154.fullText]) !== void 0) continue;
20214
20229
  const text = matchText(para);
20215
20230
  for (const seg of scanInlineSegments(text)) {
20216
20231
  const matchKey = findMatchingKey(normalizeLabel(seg.label), cursor);
@@ -20449,8 +20464,8 @@ function charWidthEm1000(cp) {
20449
20464
  var SPACE_EM_FIXED = 500;
20450
20465
  var SPACE_EM_FONT = 300;
20451
20466
  function measureTextWidth(text, height, ratioPct, opts) {
20452
- const spaceEm = _nullishCoalesce(_optionalChain([opts, 'optionalAccess', _160 => _160.spaceEm]), () => ( SPACE_EM_FIXED));
20453
- const spacing = _nullishCoalesce(_optionalChain([opts, 'optionalAccess', _161 => _161.spacingPct]), () => ( 0));
20467
+ const spaceEm = _nullishCoalesce(_optionalChain([opts, 'optionalAccess', _155 => _155.spaceEm]), () => ( SPACE_EM_FIXED));
20468
+ const spacing = _nullishCoalesce(_optionalChain([opts, 'optionalAccess', _156 => _156.spacingPct]), () => ( 0));
20454
20469
  let em = 0;
20455
20470
  for (const ch of text) {
20456
20471
  const cp = ch.codePointAt(0);
@@ -20463,8 +20478,8 @@ var FORBID_START = /* @__PURE__ */ new Set([..."!%),.:;?]}\xA2\xB0\u2032\u2033\u
20463
20478
  var FORBID_END = /* @__PURE__ */ new Set([..."$([{\xA3\xA5\u3008\u300A\u300C\u300E\u3010\u3014$([{\u20A9"]);
20464
20479
  function simulateWrap(text, firstWidth, contWidth, height, ratioPct, mode = "keep", opts) {
20465
20480
  const EPS = 0.5;
20466
- const spaceEm = _nullishCoalesce(_optionalChain([opts, 'optionalAccess', _162 => _162.spaceEm]), () => ( SPACE_EM_FIXED));
20467
- const spacing = _nullishCoalesce(_optionalChain([opts, 'optionalAccess', _163 => _163.spacingPct]), () => ( 0));
20481
+ const spaceEm = _nullishCoalesce(_optionalChain([opts, 'optionalAccess', _157 => _157.spaceEm]), () => ( SPACE_EM_FIXED));
20482
+ const spacing = _nullishCoalesce(_optionalChain([opts, 'optionalAccess', _158 => _158.spacingPct]), () => ( 0));
20468
20483
  const k = height * ratioPct / 100 / 1e3;
20469
20484
  const cwCp = (cp) => (cp === 32 ? spaceEm : charWidthEm1000(cp)) * (1 + spacing / 100) * k;
20470
20485
  const charW = (ch) => cwCp(ch.codePointAt(0));
@@ -20690,16 +20705,16 @@ var PARA_LIST = 7;
20690
20705
  var DEFAULT_TEXT_COLOR = "#000000";
20691
20706
  function resolveTheme(theme) {
20692
20707
  return {
20693
- h1: _nullishCoalesce(_optionalChain([theme, 'optionalAccess', _164 => _164.headingColors, 'optionalAccess', _165 => _165[1]]), () => ( DEFAULT_TEXT_COLOR)),
20694
- h2: _nullishCoalesce(_optionalChain([theme, 'optionalAccess', _166 => _166.headingColors, 'optionalAccess', _167 => _167[2]]), () => ( DEFAULT_TEXT_COLOR)),
20695
- h3: _nullishCoalesce(_optionalChain([theme, 'optionalAccess', _168 => _168.headingColors, 'optionalAccess', _169 => _169[3]]), () => ( DEFAULT_TEXT_COLOR)),
20696
- h4: _nullishCoalesce(_nullishCoalesce(_optionalChain([theme, 'optionalAccess', _170 => _170.headingColors, 'optionalAccess', _171 => _171[4]]), () => ( _optionalChain([theme, 'optionalAccess', _172 => _172.headingColors, 'optionalAccess', _173 => _173[3]]))), () => ( DEFAULT_TEXT_COLOR)),
20697
- body: _nullishCoalesce(_optionalChain([theme, 'optionalAccess', _174 => _174.bodyColor]), () => ( DEFAULT_TEXT_COLOR)),
20698
- quote: _nullishCoalesce(_optionalChain([theme, 'optionalAccess', _175 => _175.quoteColor]), () => ( DEFAULT_TEXT_COLOR)),
20708
+ h1: _nullishCoalesce(_optionalChain([theme, 'optionalAccess', _159 => _159.headingColors, 'optionalAccess', _160 => _160[1]]), () => ( DEFAULT_TEXT_COLOR)),
20709
+ h2: _nullishCoalesce(_optionalChain([theme, 'optionalAccess', _161 => _161.headingColors, 'optionalAccess', _162 => _162[2]]), () => ( DEFAULT_TEXT_COLOR)),
20710
+ h3: _nullishCoalesce(_optionalChain([theme, 'optionalAccess', _163 => _163.headingColors, 'optionalAccess', _164 => _164[3]]), () => ( DEFAULT_TEXT_COLOR)),
20711
+ h4: _nullishCoalesce(_nullishCoalesce(_optionalChain([theme, 'optionalAccess', _165 => _165.headingColors, 'optionalAccess', _166 => _166[4]]), () => ( _optionalChain([theme, 'optionalAccess', _167 => _167.headingColors, 'optionalAccess', _168 => _168[3]]))), () => ( DEFAULT_TEXT_COLOR)),
20712
+ body: _nullishCoalesce(_optionalChain([theme, 'optionalAccess', _169 => _169.bodyColor]), () => ( DEFAULT_TEXT_COLOR)),
20713
+ quote: _nullishCoalesce(_optionalChain([theme, 'optionalAccess', _170 => _170.quoteColor]), () => ( DEFAULT_TEXT_COLOR)),
20699
20714
  /** quoteColor가 명시되었는지 — blockquote charPr 분기에 사용 (baseline 호환) */
20700
- hasQuoteOption: _optionalChain([theme, 'optionalAccess', _176 => _176.quoteColor]) !== void 0,
20701
- tableHeader: _nullishCoalesce(_nullishCoalesce(_optionalChain([theme, 'optionalAccess', _177 => _177.tableHeaderColor]), () => ( _optionalChain([theme, 'optionalAccess', _178 => _178.bodyColor]))), () => ( DEFAULT_TEXT_COLOR)),
20702
- tableHeaderBold: !!_optionalChain([theme, 'optionalAccess', _179 => _179.tableHeaderBold])
20715
+ hasQuoteOption: _optionalChain([theme, 'optionalAccess', _171 => _171.quoteColor]) !== void 0,
20716
+ tableHeader: _nullishCoalesce(_nullishCoalesce(_optionalChain([theme, 'optionalAccess', _172 => _172.tableHeaderColor]), () => ( _optionalChain([theme, 'optionalAccess', _173 => _173.bodyColor]))), () => ( DEFAULT_TEXT_COLOR)),
20717
+ tableHeaderBold: !!_optionalChain([theme, 'optionalAccess', _174 => _174.tableHeaderBold])
20703
20718
  };
20704
20719
  }
20705
20720
  function escapeXml(text) {
@@ -20730,12 +20745,13 @@ function charPr(id, height, bold, italic, fontId = 0, textColor = DEFAULT_TEXT_C
20730
20745
  </hh:charPr>`;
20731
20746
  }
20732
20747
  function paraPr(id, opts = {}) {
20733
- const { align = "JUSTIFY", spaceBefore = 0, spaceAfter = 0, lineSpacing = 160, indent = 0, left = 0, keepWord = false } = opts;
20748
+ const { align = "JUSTIFY", spaceBefore = 0, spaceAfter = 0, lineSpacing = 160, indent = 0, left = 0, keepWord = false, outlineLevel } = opts;
20734
20749
  const breakNonLatin = keepWord ? "KEEP_WORD" : "BREAK_WORD";
20735
20750
  const snapGrid = keepWord ? "0" : "1";
20751
+ const heading = outlineLevel !== void 0 ? `<hh:heading type="OUTLINE" idRef="0" level="${outlineLevel}"/>` : `<hh:heading type="NONE" idRef="0" level="0"/>`;
20736
20752
  return ` <hh:paraPr id="${id}" tabPrIDRef="0" condense="0" fontLineHeight="0" snapToGrid="${snapGrid}" suppressLineNumbers="0" checked="0" textDir="AUTO">
20737
20753
  <hh:align horizontal="${align}" vertical="BASELINE"/>
20738
- <hh:heading type="NONE" idRef="0" level="0"/>
20754
+ ${heading}
20739
20755
  <hh:breakSetting breakLatinWord="KEEP_WORD" breakNonLatinWord="${breakNonLatin}" widowOrphan="0" keepWithNext="0" keepLines="0" pageBreakBefore="0" lineWrap="BREAK"/>
20740
20756
  <hh:autoSpacing eAsianEng="0" eAsianNum="0"/>
20741
20757
  <hh:margin><hc:intent value="${indent}" unit="HWPUNIT"/><hc:left value="${left}" unit="HWPUNIT"/><hc:right value="0" unit="HWPUNIT"/><hc:prev value="${spaceBefore}" unit="HWPUNIT"/><hc:next value="${spaceAfter}" unit="HWPUNIT"/></hh:margin>
@@ -20763,6 +20779,16 @@ function buildPrvText(blocks) {
20763
20779
  }
20764
20780
  return lines.join("\n").slice(0, 1024);
20765
20781
  }
20782
+ function findMathDelim(s, from) {
20783
+ let i = s.indexOf("$$", from);
20784
+ while (i > 0) {
20785
+ let backslashes = 0;
20786
+ for (let j = i - 1; j >= 0 && s[j] === "\\"; j--) backslashes++;
20787
+ if (backslashes % 2 === 0) break;
20788
+ i = s.indexOf("$$", i + 1);
20789
+ }
20790
+ return i;
20791
+ }
20766
20792
  function parseMarkdownToBlocks(md2) {
20767
20793
  const lines = md2.split("\n");
20768
20794
  const blocks = [];
@@ -20773,6 +20799,45 @@ function parseMarkdownToBlocks(md2) {
20773
20799
  i++;
20774
20800
  continue;
20775
20801
  }
20802
+ const mathOpen = /^\s*\$\$/.exec(line);
20803
+ if (mathOpen) {
20804
+ const afterOpen = line.slice(mathOpen[0].length);
20805
+ const closeSame = findMathDelim(afterOpen, 0);
20806
+ if (closeSame >= 0) {
20807
+ const inner = afterOpen.slice(0, closeSame).trim();
20808
+ const trailing2 = afterOpen.slice(closeSame + 2).trim();
20809
+ if (inner) blocks.push({ type: "equation", text: inner });
20810
+ if (trailing2) blocks.push({ type: "paragraph", text: trailing2 });
20811
+ i++;
20812
+ continue;
20813
+ }
20814
+ const mathLines = [];
20815
+ if (afterOpen.trim()) mathLines.push(afterOpen);
20816
+ let closed = false;
20817
+ let trailing = "";
20818
+ let j = i + 1;
20819
+ for (; j < lines.length; j++) {
20820
+ const l = lines[j];
20821
+ if (!l.trim() || /^\s*(`{3,}|~{3,})/.test(l)) break;
20822
+ const end = findMathDelim(l, 0);
20823
+ if (end >= 0) {
20824
+ const before = l.slice(0, end);
20825
+ if (before.trim()) mathLines.push(before);
20826
+ trailing = l.slice(end + 2).trim();
20827
+ closed = true;
20828
+ j++;
20829
+ break;
20830
+ }
20831
+ mathLines.push(l);
20832
+ }
20833
+ if (closed) {
20834
+ const text = mathLines.join("\n").trim();
20835
+ if (text) blocks.push({ type: "equation", text });
20836
+ if (trailing) blocks.push({ type: "paragraph", text: trailing });
20837
+ i = j;
20838
+ continue;
20839
+ }
20840
+ }
20776
20841
  const fenceMatch = line.match(/^(`{3,}|~{3,})(.*)$/);
20777
20842
  if (fenceMatch) {
20778
20843
  const fence = fenceMatch[1];
@@ -20842,7 +20907,7 @@ function parseMarkdownToBlocks(md2) {
20842
20907
  if (listMatch) {
20843
20908
  const indent = Math.floor(listMatch[1].length / 2);
20844
20909
  const ordered = /\d/.test(listMatch[2]);
20845
- blocks.push({ type: "list_item", text: listMatch[3].trim(), ordered, indent });
20910
+ blocks.push({ type: "list_item", text: listMatch[3].trim(), ordered, indent, marker: listMatch[2] });
20846
20911
  i++;
20847
20912
  continue;
20848
20913
  }
@@ -20852,6 +20917,11 @@ function parseMarkdownToBlocks(md2) {
20852
20917
  return blocks;
20853
20918
  }
20854
20919
  function parseInlineMarkdown(text) {
20920
+ const literals = [];
20921
+ text = text.replace(/\x00/g, "").replace(/\\([\\`*_{}[\]()#+\-.!|>~])/g, (_, c) => {
20922
+ literals.push(c);
20923
+ return `\0${literals.length - 1}\0`;
20924
+ });
20855
20925
  text = text.replace(/!\[([^\]]*)\]\([^)]*\)/g, "$1");
20856
20926
  text = text.replace(/\[([^\]]*)\]\(([^)]*)\)/g, (_, t, u) => t || u);
20857
20927
  text = text.replace(/~~([^~]+)~~/g, "$1");
@@ -20881,6 +20951,13 @@ function parseInlineMarkdown(text) {
20881
20951
  if (spans.length === 0) {
20882
20952
  spans.push({ text, bold: false, italic: false, code: false });
20883
20953
  }
20954
+ for (const span of spans) {
20955
+ if (!span.text.includes("\0")) continue;
20956
+ span.text = span.text.replace(/\x00(\d+)\x00/g, (_, i) => {
20957
+ const c = _nullishCoalesce(literals[+i], () => ( ""));
20958
+ return span.code ? "\\" + c : c;
20959
+ });
20960
+ }
20884
20961
  return spans;
20885
20962
  }
20886
20963
  function spanToCharPrId(span) {
@@ -20968,10 +21045,10 @@ function buildParaProperties(gongmun) {
20968
21045
  if (!gongmun) {
20969
21046
  const base2 = [
20970
21047
  paraPr(0),
20971
- paraPr(1, { align: "LEFT", spaceBefore: 800, spaceAfter: 200, lineSpacing: 180 }),
20972
- paraPr(2, { align: "LEFT", spaceBefore: 600, spaceAfter: 150, lineSpacing: 170 }),
20973
- paraPr(3, { align: "LEFT", spaceBefore: 400, spaceAfter: 100, lineSpacing: 160 }),
20974
- paraPr(4, { align: "LEFT", spaceBefore: 300, spaceAfter: 100, lineSpacing: 160 }),
21048
+ paraPr(1, { align: "LEFT", spaceBefore: 800, spaceAfter: 200, lineSpacing: 180, outlineLevel: 0 }),
21049
+ paraPr(2, { align: "LEFT", spaceBefore: 600, spaceAfter: 150, lineSpacing: 170, outlineLevel: 1 }),
21050
+ paraPr(3, { align: "LEFT", spaceBefore: 400, spaceAfter: 100, lineSpacing: 160, outlineLevel: 2 }),
21051
+ paraPr(4, { align: "LEFT", spaceBefore: 300, spaceAfter: 100, lineSpacing: 160, outlineLevel: 3 }),
20975
21052
  paraPr(5, { align: "LEFT", lineSpacing: 130, indent: 400 }),
20976
21053
  paraPr(6, { align: "LEFT", lineSpacing: 150, indent: 600 }),
20977
21054
  paraPr(7, { align: "LEFT", lineSpacing: 160, indent: 600 })
@@ -20984,10 +21061,10 @@ ${base2.join("\n")}
20984
21061
  const titleAlign = gongmun.centerTitle ? "CENTER" : "LEFT";
20985
21062
  const base = [
20986
21063
  paraPr(0, { lineSpacing: ls, keepWord: true }),
20987
- paraPr(1, { align: titleAlign, spaceBefore: 400, spaceAfter: 400, lineSpacing: ls, keepWord: true }),
20988
- paraPr(2, { align: "LEFT", spaceBefore: 600, spaceAfter: 150, lineSpacing: ls, keepWord: true }),
20989
- paraPr(3, { align: "LEFT", spaceBefore: 400, spaceAfter: 100, lineSpacing: ls, keepWord: true }),
20990
- paraPr(4, { align: "LEFT", spaceBefore: 300, spaceAfter: 100, lineSpacing: ls, keepWord: true }),
21064
+ paraPr(1, { align: titleAlign, spaceBefore: 400, spaceAfter: 400, lineSpacing: ls, keepWord: true, outlineLevel: 0 }),
21065
+ paraPr(2, { align: "LEFT", spaceBefore: 600, spaceAfter: 150, lineSpacing: ls, keepWord: true, outlineLevel: 1 }),
21066
+ paraPr(3, { align: "LEFT", spaceBefore: 400, spaceAfter: 100, lineSpacing: ls, keepWord: true, outlineLevel: 2 }),
21067
+ paraPr(4, { align: "LEFT", spaceBefore: 300, spaceAfter: 100, lineSpacing: ls, keepWord: true, outlineLevel: 3 }),
20991
21068
  paraPr(5, { align: "LEFT", lineSpacing: 130, indent: 400, keepWord: true }),
20992
21069
  paraPr(6, { align: "LEFT", lineSpacing: ls, indent: 600, keepWord: true }),
20993
21070
  paraPr(7, { align: "LEFT", lineSpacing: ls, indent: 600, keepWord: true })
@@ -21002,8 +21079,19 @@ ${base2.join("\n")}
21002
21079
  ${base.join("\n")}
21003
21080
  </hh:paraProperties>`;
21004
21081
  }
21082
+ function buildNumberings() {
21083
+ const heads = Array.from(
21084
+ { length: 7 },
21085
+ (_, i) => ` <hh:paraHead start="1" level="${i + 1}" align="LEFT" useInstWidth="1" autoIndent="1" widthAdjust="0" textOffsetType="PERCENT" textOffset="50" numFormat="DIGIT" charPrIDRef="4294967295" checkable="0"/>`
21086
+ ).join("\n");
21087
+ return `<hh:numberings itemCnt="1">
21088
+ <hh:numbering id="1" start="0">
21089
+ ${heads}
21090
+ </hh:numbering>
21091
+ </hh:numberings>`;
21092
+ }
21005
21093
  function generateHeaderXml(theme, gongmun, ratioVariants = []) {
21006
- const bodyFace = _optionalChain([gongmun, 'optionalAccess', _180 => _180.bodyFont]) === "gothic" ? "\uB9D1\uC740 \uACE0\uB515" : "\uD568\uCD08\uB86C\uBC14\uD0D5";
21094
+ const bodyFace = _optionalChain([gongmun, 'optionalAccess', _175 => _175.bodyFont]) === "gothic" ? "\uB9D1\uC740 \uACE0\uB515" : "\uD568\uCD08\uB86C\uBC14\uD0D5";
21007
21095
  const charPropsXml = buildCharProperties(theme, gongmun, ratioVariants);
21008
21096
  const paraPropsXml = buildParaProperties(gongmun);
21009
21097
  return `<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
@@ -21079,7 +21167,7 @@ function generateHeaderXml(theme, gongmun, ratioVariants = []) {
21079
21167
  </hh:borderFills>
21080
21168
  ${charPropsXml}
21081
21169
  <hh:tabProperties itemCnt="0"/>
21082
- <hh:numberings itemCnt="0"/>
21170
+ ${buildNumberings()}
21083
21171
  <hh:bullets itemCnt="0"/>
21084
21172
  ${paraPropsXml}
21085
21173
  <hh:styles itemCnt="1">
@@ -21142,6 +21230,7 @@ function precomputeGongmunList(blocks, gongmun) {
21142
21230
  i++;
21143
21231
  continue;
21144
21232
  }
21233
+ const passThrough = (t) => t === "table" || t === "html_table" || t === "equation";
21145
21234
  const run = [];
21146
21235
  while (i < blocks.length) {
21147
21236
  const t = blocks[i].type;
@@ -21150,9 +21239,9 @@ function precomputeGongmunList(blocks, gongmun) {
21150
21239
  i++;
21151
21240
  continue;
21152
21241
  }
21153
- if (t === "table" || t === "html_table") {
21242
+ if (passThrough(t)) {
21154
21243
  let j = i + 1;
21155
- while (j < blocks.length && (blocks[j].type === "table" || blocks[j].type === "html_table")) j++;
21244
+ while (j < blocks.length && passThrough(blocks[j].type)) j++;
21156
21245
  if (j < blocks.length && blocks[j].type === "list_item") {
21157
21246
  i = j;
21158
21247
  continue;
@@ -21344,11 +21433,11 @@ function bestSimInRange(arr, from, to, target) {
21344
21433
  return best;
21345
21434
  }
21346
21435
  function escapeGfm(text) {
21347
- return text.replace(/~/g, "\\~");
21436
+ return text.replace(/([~*])/g, "\\$1");
21348
21437
  }
21349
21438
  var HWP_SHAPE_ALT_TEXT_RE = /(?:모서리가 둥근 |둥근 )?(?:사각형|직사각형|정사각형|원|타원|삼각형|이등변 삼각형|직각 삼각형|선|직선|곡선|화살표|굵은 화살표|이중 화살표|오각형|육각형|팔각형|별|[4-8]점별|십자|십자형|구름|구름형|마름모|도넛|평행사변형|사다리꼴|부채꼴|호|반원|물결|번개|하트|빗금|블록 화살표|수식|표|그림|개체|그리기\s?개체|묶음\s?개체|글상자|수식\s?개체|OLE\s?개체)\s?입니다\.?/g;
21350
21439
  function sanitizeText(text) {
21351
- let result = _chunkXL6O3VAYcjs.mapPuaText.call(void 0, text).replace(/[\u{F0000}-\u{FFFFD}]/gu, "").replace(HWP_SHAPE_ALT_TEXT_RE, "").replace(/ +/g, " ").trim();
21440
+ let result = _chunkVHXUD3PWcjs.mapPuaText.call(void 0, text).replace(/[\u{F0000}-\u{FFFFD}]/gu, "").replace(HWP_SHAPE_ALT_TEXT_RE, "").replace(/ +/g, " ").trim();
21352
21441
  if (result.length <= 30 && result.includes(" ")) {
21353
21442
  const tokens = result.split(" ");
21354
21443
  const koreanSingleCharCount = tokens.filter((t) => t.length === 1 && /[가-힯ㄱ-ㆎ]/.test(t)).length;
@@ -21362,7 +21451,7 @@ function normForMatch(text) {
21362
21451
  return sanitizeText(text).replace(/\s+/g, " ").trim();
21363
21452
  }
21364
21453
  function unescapeGfm(text) {
21365
- return text.replace(/\\~/g, "~");
21454
+ return text.replace(/\\([~*])/g, "$1");
21366
21455
  }
21367
21456
  function summarize(text) {
21368
21457
  const t = text.replace(/\s+/g, " ").trim();
@@ -21378,7 +21467,7 @@ function replicateGfmTable(table) {
21378
21467
  for (let r = 0; r < numRows; r++) {
21379
21468
  for (let c = 0; c < numCols; c++) {
21380
21469
  if (skip.has(`${r},${c}`)) continue;
21381
- const cell = _optionalChain([cells, 'access', _181 => _181[r], 'optionalAccess', _182 => _182[c]]);
21470
+ const cell = _optionalChain([cells, 'access', _176 => _176[r], 'optionalAccess', _177 => _177[c]]);
21382
21471
  if (!cell) continue;
21383
21472
  display[r][c] = {
21384
21473
  text: escapeGfm(sanitizeText(cell.text)).replace(/\|/g, "\\|").replace(/\n/g, "<br>"),
@@ -21429,10 +21518,10 @@ function parseGfmTable(lines) {
21429
21518
  return rows;
21430
21519
  }
21431
21520
  function unescapeGfmCell(text) {
21432
- return text.replace(/<br\s*\/?>/gi, "\n").replace(/\\\|/g, "|").replace(/\\~/g, "~");
21521
+ return text.replace(/<br\s*\/?>/gi, "\n").replace(/\\\|/g, "|").replace(/\\([~*])/g, "$1");
21433
21522
  }
21434
21523
  function replicateCellInnerHtml(cell) {
21435
- if (_optionalChain([cell, 'access', _183 => _183.blocks, 'optionalAccess', _184 => _184.length])) {
21524
+ if (_optionalChain([cell, 'access', _178 => _178.blocks, 'optionalAccess', _179 => _179.length])) {
21436
21525
  return cell.blocks.map((b) => {
21437
21526
  if (b.type === "table" && b.table) {
21438
21527
  const cap = b.table.caption ? sanitizeText(b.table.caption) : "";
@@ -21471,7 +21560,7 @@ function replicateHtmlTable(table) {
21471
21560
  const rowCells = [];
21472
21561
  for (let c = 0; c < numCols; c++) {
21473
21562
  if (skip.has(`${r},${c}`)) continue;
21474
- const cell = _optionalChain([cells, 'access', _185 => _185[r], 'optionalAccess', _186 => _186[c]]);
21563
+ const cell = _optionalChain([cells, 'access', _180 => _180[r], 'optionalAccess', _181 => _181[c]]);
21475
21564
  if (!cell) continue;
21476
21565
  for (let dr = 0; dr < cell.rowSpan; dr++) {
21477
21566
  for (let dc = 0; dc < cell.colSpan; dc++) {
@@ -21517,8 +21606,8 @@ function parseHtmlTable(raw) {
21517
21606
  }
21518
21607
  } else {
21519
21608
  if (!isClose) {
21520
- const cs = parseInt(_optionalChain([attrs, 'access', _187 => _187.match, 'call', _188 => _188(/colspan\s*=\s*"(\d+)"/i), 'optionalAccess', _189 => _189[1]]) || "1", 10);
21521
- const rs = parseInt(_optionalChain([attrs, 'access', _190 => _190.match, 'call', _191 => _191(/rowspan\s*=\s*"(\d+)"/i), 'optionalAccess', _192 => _192[1]]) || "1", 10);
21609
+ const cs = parseInt(_optionalChain([attrs, 'access', _182 => _182.match, 'call', _183 => _183(/colspan\s*=\s*"(\d+)"/i), 'optionalAccess', _184 => _184[1]]) || "1", 10);
21610
+ const rs = parseInt(_optionalChain([attrs, 'access', _185 => _185.match, 'call', _186 => _186(/rowspan\s*=\s*"(\d+)"/i), 'optionalAccess', _187 => _187[1]]) || "1", 10);
21522
21611
  cellStart = m.index + m[0].length;
21523
21612
  cellInfo = { colSpan: isNaN(cs) ? 1 : cs, rowSpan: isNaN(rs) ? 1 : rs };
21524
21613
  } else if (cellStart >= 0 && cellInfo && currentRow) {
@@ -21678,6 +21767,280 @@ function generateHtmlTableXml(rawHtml, theme, totalWidth = 44e3) {
21678
21767
  return `<hp:tbl id="${tblId}" zOrder="0" numberingType="TABLE" pageBreak="CELL" repeatHeader="0" rowCnt="${rowCnt}" colCnt="${colCnt}" cellSpacing="0" borderFillIDRef="2" noShading="0"><hp:sz width="${tblW}" widthRelTo="ABSOLUTE" height="${cellH * rowCnt}" heightRelTo="ABSOLUTE" protect="0"/><hp:pos treatAsChar="1" affectLSpacing="0" flowWithText="0" allowOverlap="0" holdAnchorAndSO="0" vertRelTo="PARA" horzRelTo="PARA" vertAlign="TOP" horzAlign="LEFT" vertOffset="0" horzOffset="0"/><hp:outMargin left="0" right="0" top="0" bottom="0"/><hp:inMargin left="510" right="510" top="141" bottom="141"/>` + trXmls.join("") + `</hp:tbl>`;
21679
21768
  }
21680
21769
 
21770
+ // src/hwpx/equation-generate.ts
21771
+ var MAX_EQUATION_SOURCE = 1e4;
21772
+ var MAX_GROUP_DEPTH = 64;
21773
+ var COMMAND_MAP = {
21774
+ alpha: "alpha",
21775
+ beta: "beta",
21776
+ gamma: "gamma",
21777
+ delta: "delta",
21778
+ epsilon: "epsilon",
21779
+ zeta: "zeta",
21780
+ eta: "eta",
21781
+ theta: "theta",
21782
+ iota: "iota",
21783
+ kappa: "kappa",
21784
+ lambda: "lambda",
21785
+ mu: "mu",
21786
+ nu: "nu",
21787
+ xi: "xi",
21788
+ pi: "pi",
21789
+ rho: "rho",
21790
+ sigma: "sigma",
21791
+ tau: "tau",
21792
+ upsilon: "upsilon",
21793
+ phi: "phi",
21794
+ chi: "chi",
21795
+ psi: "psi",
21796
+ omega: "omega",
21797
+ Gamma: "GAMMA",
21798
+ Delta: "DELTA",
21799
+ Theta: "THETA",
21800
+ Lambda: "LAMBDA",
21801
+ Xi: "XI",
21802
+ Pi: "PI",
21803
+ Sigma: "SIGMA",
21804
+ Upsilon: "UPSILON",
21805
+ Phi: "PHI",
21806
+ Psi: "PSI",
21807
+ Omega: "OMEGA",
21808
+ le: "LEQ",
21809
+ leq: "LEQ",
21810
+ ge: "GEQ",
21811
+ geq: "GEQ",
21812
+ ne: "!=",
21813
+ neq: "!=",
21814
+ pm: "+-",
21815
+ mp: "-+",
21816
+ times: "TIMES",
21817
+ cdot: "cdot",
21818
+ ast: "AST",
21819
+ circ: "CIRC",
21820
+ bullet: "BULLET",
21821
+ in: "IN",
21822
+ notin: "NOTIN",
21823
+ subset: "SUBSET",
21824
+ subseteq: "SUBSETEQ",
21825
+ supset: "SUPERSET",
21826
+ supseteq: "SUPSETEQ",
21827
+ cup: "CUP",
21828
+ cap: "SMALLINTER",
21829
+ emptyset: "EMPTYSET",
21830
+ forall: "FORALL",
21831
+ exists: "EXIST",
21832
+ infinity: "INF",
21833
+ infty: "INF",
21834
+ partial: "Partial",
21835
+ nabla: "NABLA",
21836
+ int: "int",
21837
+ iint: "dint",
21838
+ iiint: "tint",
21839
+ oint: "oint",
21840
+ sum: "sum",
21841
+ prod: "prod",
21842
+ lim: "lim",
21843
+ to: "->",
21844
+ rightarrow: "->",
21845
+ leftarrow: "larrow",
21846
+ leftrightarrow: "<->",
21847
+ Rightarrow: "RARROW",
21848
+ Leftarrow: "LARROW",
21849
+ Leftrightarrow: "LRARROW",
21850
+ cdots: "CDOTS",
21851
+ ldots: "LDOTS",
21852
+ vdots: "VDOTS",
21853
+ ddots: "DDOTS"
21854
+ };
21855
+ var ACCENT_COMMANDS = {
21856
+ bar: "bar",
21857
+ overline: "bar",
21858
+ vec: "vec",
21859
+ overrightarrow: "vec",
21860
+ hat: "hat",
21861
+ widehat: "hat",
21862
+ tilde: "tilde",
21863
+ widetilde: "tilde",
21864
+ dot: "dot",
21865
+ ddot: "ddot",
21866
+ underline: "under"
21867
+ };
21868
+ var RESERVED_WORDS = new Set(
21869
+ [...Object.keys(CONVERT_MAP), ...Object.keys(MIDDLE_CONVERT_MAP), "over", "root", "of"].filter((w) => /^[A-Za-z]+$/.test(w))
21870
+ );
21871
+ function skipSpaces(input, idx) {
21872
+ while (idx < input.length && /\s/.test(input[idx])) idx++;
21873
+ return idx;
21874
+ }
21875
+ function normalizeEqEdit(input) {
21876
+ return input.replace(/\s+/g, " ").trim();
21877
+ }
21878
+ function stripMathDelimiters(input) {
21879
+ let s = input.trim();
21880
+ if (s.startsWith("$$") && s.endsWith("$$")) s = s.slice(2, -2).trim();
21881
+ if (s.startsWith("\\[") && s.endsWith("\\]")) s = s.slice(2, -2).trim();
21882
+ return s;
21883
+ }
21884
+ function readBalanced(input, idx, open, close) {
21885
+ let depth = 1;
21886
+ let cursor = idx + 1;
21887
+ while (cursor < input.length) {
21888
+ const ch = input[cursor];
21889
+ if (ch === "\\") {
21890
+ cursor += 2;
21891
+ continue;
21892
+ }
21893
+ if (ch === open) depth++;
21894
+ else if (ch === close) depth--;
21895
+ if (depth === 0) {
21896
+ return { value: input.slice(idx + 1, cursor), next: cursor + 1 };
21897
+ }
21898
+ cursor++;
21899
+ }
21900
+ return { value: input.slice(idx + 1), next: input.length };
21901
+ }
21902
+ function readGroupOrToken(input, idx, depth) {
21903
+ const start = skipSpaces(input, idx);
21904
+ if (depth > MAX_GROUP_DEPTH) return { value: input.slice(start), next: input.length };
21905
+ if (input[start] === "{") {
21906
+ const group = readBalanced(input, start, "{", "}");
21907
+ return { value: convertLatexFragment(group.value, depth + 1), next: group.next };
21908
+ }
21909
+ if (input[start] === "\\") {
21910
+ const cmd = readCommand(input, start, depth + 1);
21911
+ return { value: cmd.value, next: cmd.next };
21912
+ }
21913
+ return { value: _nullishCoalesce(input[start], () => ( "")), next: Math.min(start + 1, input.length) };
21914
+ }
21915
+ function readCommandName(input, idx) {
21916
+ if (input[idx + 1] === "\\") return { value: "\\", next: idx + 2 };
21917
+ const match = /^[A-Za-z]+/.exec(input.slice(idx + 1));
21918
+ if (match) return { value: match[0], next: idx + 1 + match[0].length };
21919
+ return { value: _nullishCoalesce(input[idx + 1], () => ( "")), next: Math.min(idx + 2, input.length) };
21920
+ }
21921
+ function readCommand(input, idx, depth) {
21922
+ const name = readCommandName(input, idx);
21923
+ const command = name.value;
21924
+ if (command === "\\") return { value: "#", next: name.next };
21925
+ if (command === "frac") {
21926
+ const num = readGroupOrToken(input, name.next, depth);
21927
+ const den = readGroupOrToken(input, num.next, depth);
21928
+ return { value: `{${num.value}} over {${den.value}}`, next: den.next };
21929
+ }
21930
+ if (command === "sqrt") {
21931
+ let cursor = skipSpaces(input, name.next);
21932
+ let root = null;
21933
+ if (input[cursor] === "[") {
21934
+ const opt = readBalanced(input, cursor, "[", "]");
21935
+ root = { value: convertLatexFragment(opt.value, depth + 1), next: opt.next };
21936
+ cursor = opt.next;
21937
+ }
21938
+ const body = readGroupOrToken(input, cursor, depth);
21939
+ if (root) return { value: `root {${root.value}} of {${body.value}}`, next: body.next };
21940
+ return { value: `sqrt{${body.value}}`, next: body.next };
21941
+ }
21942
+ if (command === "begin") {
21943
+ const env = readGroupOrToken(input, name.next, depth);
21944
+ const endTag = `\\end{${env.value}}`;
21945
+ const endIdx = input.indexOf(endTag, env.next);
21946
+ if (endIdx === -1) return { value: env.value, next: env.next };
21947
+ const body = convertLatexFragment(input.slice(env.next, endIdx), depth + 1);
21948
+ if (env.value === "matrix" || env.value === "pmatrix" || env.value === "bmatrix") {
21949
+ return { value: `{${env.value}{${body}}}`, next: endIdx + endTag.length };
21950
+ }
21951
+ return { value: body, next: endIdx + endTag.length };
21952
+ }
21953
+ if (command === "left" || command === "right") {
21954
+ const kw = command === "left" ? "LEFT" : "RIGHT";
21955
+ const cursor = skipSpaces(input, name.next);
21956
+ let delimiter = _nullishCoalesce(input[cursor], () => ( ""));
21957
+ let next = delimiter ? cursor + 1 : cursor;
21958
+ if (delimiter === "\\") {
21959
+ const escaped = readCommandName(input, cursor);
21960
+ delimiter = escaped.value === "\\" ? "\\" : _nullishCoalesce(COMMAND_MAP[escaped.value], () => ( escaped.value));
21961
+ next = escaped.next;
21962
+ }
21963
+ return { value: delimiter ? `${kw} ${delimiter}` : kw, next };
21964
+ }
21965
+ if (command in ACCENT_COMMANDS) {
21966
+ const body = readGroupOrToken(input, name.next, depth);
21967
+ return { value: `${ACCENT_COMMANDS[command]}{${body.value}}`, next: body.next };
21968
+ }
21969
+ if (command === "mathrm" || command === "text") {
21970
+ const start = skipSpaces(input, name.next);
21971
+ if (input[start] === "{") {
21972
+ const group = readBalanced(input, start, "{", "}");
21973
+ return { value: `"${group.value}"`, next: group.next };
21974
+ }
21975
+ const tok = readGroupOrToken(input, start, depth);
21976
+ return { value: `"${tok.value}"`, next: tok.next };
21977
+ }
21978
+ return { value: _nullishCoalesce(COMMAND_MAP[command], () => ( command)), next: name.next };
21979
+ }
21980
+ function convertLatexFragment(input, depth) {
21981
+ if (depth > MAX_GROUP_DEPTH) return normalizeEqEdit(input);
21982
+ let out = "";
21983
+ let idx = 0;
21984
+ while (idx < input.length) {
21985
+ const ch = input[idx];
21986
+ if (ch === "\\") {
21987
+ const cmd = readCommand(input, idx, depth + 1);
21988
+ out += ` ${cmd.value} `;
21989
+ idx = cmd.next;
21990
+ continue;
21991
+ }
21992
+ if (ch === "{") {
21993
+ const group = readBalanced(input, idx, "{", "}");
21994
+ out += `{${convertLatexFragment(group.value, depth + 1)}}`;
21995
+ idx = group.next;
21996
+ continue;
21997
+ }
21998
+ if (ch === "_" || ch === "^") {
21999
+ const script = readGroupOrToken(input, idx + 1, depth);
22000
+ out += ` ${ch}{${script.value}}`;
22001
+ idx = script.next;
22002
+ continue;
22003
+ }
22004
+ if (ch === "&") {
22005
+ out += " & ";
22006
+ idx++;
22007
+ continue;
22008
+ }
22009
+ out += ch;
22010
+ idx++;
22011
+ }
22012
+ return normalizeEqEdit(out);
22013
+ }
22014
+ function quoteReservedKeywords(latex) {
22015
+ return latex.replace(/([_^])\s*\{\s*([A-Za-z]+)\s*\}/g, (match, op, word) => RESERVED_WORDS.has(word) ? `${op}{"${word}"}` : match);
22016
+ }
22017
+ function latexLikeToEqEdit(input) {
22018
+ const src = stripMathDelimiters(input);
22019
+ if (src.length > MAX_EQUATION_SOURCE) return normalizeEqEdit(src);
22020
+ return convertLatexFragment(quoteReservedKeywords(src), 0);
22021
+ }
22022
+ function estimateEquationMetrics(script) {
22023
+ const cleaned = script.replace(/[{}\\^_]/g, "").replace(/\s+/g, " ").trim();
22024
+ const width = Math.min(Math.max(cleaned.length, 5) * 700 + 2e3, 4e4);
22025
+ const rowCount = Math.max(1, (_nullishCoalesce(script.match(/#/g), () => ( []))).length + 1);
22026
+ if (/\bmatrix\b|#/.test(script)) {
22027
+ if (rowCount >= 4) return { width, height: 5500, baseline: 55 };
22028
+ if (rowCount === 3) return { width, height: 4500, baseline: 60 };
22029
+ return { width, height: 3260, baseline: 63 };
22030
+ }
22031
+ if (/\bover\b|\broot\b|\bsqrt\b/.test(script)) return { width, height: 3010, baseline: 69 };
22032
+ return { width, height: 1450, baseline: 71 };
22033
+ }
22034
+ function generateEquationXml(script, zOrder = 0) {
22035
+ const { width, height, baseline } = estimateEquationMetrics(script);
22036
+ const eqId = 2000000001 + zOrder;
22037
+ return `<hp:equation id="${eqId}" zOrder="${zOrder}" numberingType="EQUATION" textWrap="TOP_AND_BOTTOM" textFlow="BOTH_SIDES" lock="0" dropcapstyle="None" version="Equation Version 60" baseLine="${baseline}" textColor="#000000" baseUnit="1200" lineMode="CHAR" font="HYhwpEQ"><hp:sz width="${width}" widthRelTo="ABSOLUTE" height="${height}" 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="56" right="56" top="0" bottom="0"/><hp:shapeComment>\uC218\uC2DD\uC785\uB2C8\uB2E4.</hp:shapeComment><hp:script>${escapeXml(script)}</hp:script></hp:equation>`;
22038
+ }
22039
+ function generateEquationParagraph(input, zOrder = 0) {
22040
+ const script = latexLikeToEqEdit(input);
22041
+ return `<hp:p paraPrIDRef="${PARA_NORMAL}" styleIDRef="0"><hp:run charPrIDRef="${CHAR_NORMAL}">${generateEquationXml(script, zOrder)}</hp:run></hp:p>`;
22042
+ }
22043
+
21681
22044
  // src/hwpx/gen-section.ts
21682
22045
  function generateSecPr(gongmun) {
21683
22046
  const m = gongmun ? {
@@ -21688,7 +22051,7 @@ function generateSecPr(gongmun) {
21688
22051
  header: 0,
21689
22052
  footer: 0
21690
22053
  } : { top: 8504, bottom: 4252, left: 5670, right: 4252, header: 2835, footer: 2835 };
21691
- return `<hp:secPr textDirection="HORIZONTAL" spaceColumns="1134" tabStop="8000" outlineShapeIDRef="0" 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>`;
22054
+ return `<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>`;
21692
22055
  }
21693
22056
  function blocksToSectionXml(blocks, theme, gongmun, gongmunList = gongmun ? precomputeGongmunList(blocks, gongmun) : null, fit = null) {
21694
22057
  const paraXmls = [];
@@ -21725,6 +22088,15 @@ function blocksToSectionXml(blocks, theme, gongmun, gongmunList = gongmun ? prec
21725
22088
  xml = codeLines.map((line) => generateParagraph(line || " ", PARA_CODE)).join("\n ");
21726
22089
  break;
21727
22090
  }
22091
+ case "equation": {
22092
+ if (isFirst) {
22093
+ const secRun = `<hp:run charPrIDRef="0">${generateSecPr(gongmun)}<hp:t></hp:t></hp:run>`;
22094
+ paraXmls.push(`<hp:p paraPrIDRef="0" styleIDRef="0">${secRun}</hp:p>`);
22095
+ isFirst = false;
22096
+ }
22097
+ xml = generateEquationParagraph(block.text || "", blockIdx);
22098
+ break;
22099
+ }
21728
22100
  case "blockquote":
21729
22101
  xml = generateParagraph(
21730
22102
  block.text || "",
@@ -21735,8 +22107,8 @@ function blocksToSectionXml(blocks, theme, gongmun, gongmunList = gongmun ? prec
21735
22107
  case "list_item": {
21736
22108
  if (gongmun && gongmunList) {
21737
22109
  const info = gongmunList.get(blockIdx);
21738
- const depth = _nullishCoalesce(_optionalChain([info, 'optionalAccess', _193 => _193.depth]), () => ( 0));
21739
- const marker2 = _nullishCoalesce(_optionalChain([info, 'optionalAccess', _194 => _194.marker]), () => ( ""));
22110
+ const depth = _nullishCoalesce(_optionalChain([info, 'optionalAccess', _188 => _188.depth]), () => ( 0));
22111
+ const marker2 = _nullishCoalesce(_optionalChain([info, 'optionalAccess', _189 => _189.marker]), () => ( ""));
21740
22112
  const content = block.text || "";
21741
22113
  const text = marker2 ? `${marker2} ${content}` : content;
21742
22114
  const listCharPr = gongmun.numbering === "report" && depth === 0 ? CHAR_BOLD : CHAR_NORMAL;
@@ -21745,7 +22117,10 @@ function blocksToSectionXml(blocks, theme, gongmun, gongmunList = gongmun ? prec
21745
22117
  }
21746
22118
  const indent = block.indent || 0;
21747
22119
  let marker;
21748
- if (block.ordered) {
22120
+ if (block.marker) {
22121
+ marker = `${block.marker} `;
22122
+ prevWasOrdered = !!block.ordered;
22123
+ } else if (block.ordered) {
21749
22124
  orderedCounters[indent] = (orderedCounters[indent] || 0) + 1;
21750
22125
  for (const k of Object.keys(orderedCounters)) {
21751
22126
  if (+k > indent) delete orderedCounters[+k];
@@ -21813,8 +22188,8 @@ function blocksToSectionXml(blocks, theme, gongmun, gongmunList = gongmun ? prec
21813
22188
 
21814
22189
  // src/hwpx/generator.ts
21815
22190
  async function markdownToHwpx(markdown, options) {
21816
- const theme = resolveTheme(_optionalChain([options, 'optionalAccess', _195 => _195.theme]));
21817
- const gongmun = _optionalChain([options, 'optionalAccess', _196 => _196.gongmun]) ? resolveGongmun(options.gongmun) : null;
22191
+ const theme = resolveTheme(_optionalChain([options, 'optionalAccess', _190 => _190.theme]));
22192
+ const gongmun = _optionalChain([options, 'optionalAccess', _191 => _191.gongmun]) ? resolveGongmun(options.gongmun) : null;
21818
22193
  const blocks = parseMarkdownToBlocks(markdown);
21819
22194
  const gongmunList = gongmun ? precomputeGongmunList(blocks, gongmun) : null;
21820
22195
  const fit = gongmun && gongmunList ? computeGongmunFitPlan(blocks, gongmun, gongmunList) : null;
@@ -21823,7 +22198,7 @@ async function markdownToHwpx(markdown, options) {
21823
22198
  zip.file("mimetype", "application/hwp+zip", { compression: "STORE" });
21824
22199
  zip.file("META-INF/container.xml", generateContainerXml());
21825
22200
  zip.file("Contents/content.hpf", generateManifest());
21826
- zip.file("Contents/header.xml", generateHeaderXml(theme, gongmun, _nullishCoalesce(_optionalChain([fit, 'optionalAccess', _197 => _197.variants]), () => ( []))));
22201
+ zip.file("Contents/header.xml", generateHeaderXml(theme, gongmun, _nullishCoalesce(_optionalChain([fit, 'optionalAccess', _192 => _192.variants]), () => ( []))));
21827
22202
  zip.file("Contents/section0.xml", sectionXml);
21828
22203
  zip.file("Preview/PrvText.txt", buildPrvText(blocks));
21829
22204
  return await zip.generateAsync({ type: "arraybuffer" });
@@ -21971,7 +22346,7 @@ var ROW_OBJECT_RE = /<(?:[A-Za-z0-9_]+:)?(?:tbl|pic|equation|ole|container|shape
21971
22346
  var TAG_AT_RE = /<[A-Za-z0-9_:]+(?:"[^"]*"|'[^']*'|[^>"'])*>/y;
21972
22347
  function patchTableRows(input) {
21973
22348
  const { table, scanTable, ctx, skip, origKeys, editedKeys } = input;
21974
- const xml = _optionalChain([ctx, 'access', _198 => _198.scans, 'access', _199 => _199[scanTable.sectionIndex], 'optionalAccess', _200 => _200.xml]);
22349
+ const xml = _optionalChain([ctx, 'access', _193 => _193.scans, 'access', _194 => _194[scanTable.sectionIndex], 'optionalAccess', _195 => _195.xml]);
21975
22350
  if (!xml) return skip("\uC139\uC158 XML \uB9E4\uD551 \uC2E4\uD328");
21976
22351
  const numRows = table.rows;
21977
22352
  if (origKeys.length !== numRows) return skip("\uD45C \uD589 \uC88C\uD45C \uBD88\uC77C\uCE58 \u2014 \uD589 \uCD94\uAC00/\uC0AD\uC81C \uBBF8\uC9C0\uC6D0");
@@ -22138,7 +22513,7 @@ function buildRowFragment(xml, scanTable, template, cells, finalRow, hasExplicit
22138
22513
  const rr = scanTable.rowRanges[template];
22139
22514
  const wrapped = FRAG_OPEN + xml.slice(rr.start, rr.end) + FRAG_CLOSE;
22140
22515
  const scan = scanSectionXml(wrapped, 0);
22141
- const row = _optionalChain([scan, 'access', _201 => _201.tables, 'access', _202 => _202[0], 'optionalAccess', _203 => _203.rows, 'access', _204 => _204[0]]);
22516
+ const row = _optionalChain([scan, 'access', _196 => _196.tables, 'access', _197 => _197[0], 'optionalAccess', _198 => _198.rows, 'access', _199 => _199[0]]);
22142
22517
  if (!row || row.length !== cells.length) return null;
22143
22518
  const splices = allLinesegRemovalSplices(wrapped);
22144
22519
  for (let i = 0; i < cells.length; i++) {
@@ -22181,7 +22556,7 @@ function rowHeightOf(fragment) {
22181
22556
  }
22182
22557
  function tableSzHeightSplice(xml, scanTable, tblOpenLen, delta) {
22183
22558
  const from = scanTable.start + tblOpenLen;
22184
- const to = _nullishCoalesce(_optionalChain([scanTable, 'access', _205 => _205.rowRanges, 'access', _206 => _206[0], 'optionalAccess', _207 => _207.start]), () => ( from));
22559
+ const to = _nullishCoalesce(_optionalChain([scanTable, 'access', _200 => _200.rowRanges, 'access', _201 => _201[0], 'optionalAccess', _202 => _202.start]), () => ( from));
22185
22560
  const slice = xml.slice(from, to);
22186
22561
  const szM = slice.match(/<(?:[A-Za-z0-9_]+:)?sz\b(?:"[^"]*"|'[^']*'|[^>"'])*>/);
22187
22562
  if (!szM || szM.index === void 0) return null;
@@ -22370,9 +22745,9 @@ function patchHtmlTableRows(table, scanTable, replica, editedRows, ctx, skip, de
22370
22745
  });
22371
22746
  }
22372
22747
  function patchNestedTables(table, scanTable, oc, origTables, editedTables, ctx, skip, depth) {
22373
- const irCell = _optionalChain([table, 'access', _208 => _208.cells, 'access', _209 => _209[oc.gridR], 'optionalAccess', _210 => _210[oc.gridC]]);
22748
+ const irCell = _optionalChain([table, 'access', _203 => _203.cells, 'access', _204 => _204[oc.gridR], 'optionalAccess', _205 => _205[oc.gridC]]);
22374
22749
  const scanCell = scanTable.cellByAnchor.get(`${oc.gridR},${oc.gridC}`);
22375
- const nestedIRs = (_nullishCoalesce(_optionalChain([irCell, 'optionalAccess', _211 => _211.blocks]), () => ( []))).filter((b) => b.type === "table" && b.table).map((b) => b.table);
22750
+ const nestedIRs = (_nullishCoalesce(_optionalChain([irCell, 'optionalAccess', _206 => _206.blocks]), () => ( []))).filter((b) => b.type === "table" && b.table).map((b) => b.table);
22376
22751
  if (!scanCell || nestedIRs.length !== origTables.length || scanCell.tables.length !== origTables.length) {
22377
22752
  return skip("\uC911\uCCA9\uD45C \uC18C\uC2A4\uB9F5 \uB9E4\uD551 \uC2E4\uD328");
22378
22753
  }
@@ -22440,7 +22815,7 @@ function applyCellEdit(table, scanTable, gridR, gridC, newLines, ctx, before, af
22440
22815
  };
22441
22816
  const cell = scanTable.cellByAnchor.get(`${gridR},${gridC}`);
22442
22817
  if (!cell) return skip("\uC140 \uC88C\uD45C \uB9E4\uD551 \uC2E4\uD328 (\uBCD1\uD569 \uC601\uC5ED\uC758 \uBE48 \uCE78\uC774\uAC70\uB098 \uC88C\uD45C \uBD88\uC77C\uCE58)");
22443
- const irCell = _optionalChain([table, 'access', _212 => _212.cells, 'access', _213 => _213[gridR], 'optionalAccess', _214 => _214[gridC]]);
22818
+ const irCell = _optionalChain([table, 'access', _207 => _207.cells, 'access', _208 => _208[gridR], 'optionalAccess', _209 => _209[gridC]]);
22444
22819
  const scanJoined = cell.paragraphs.map((p) => p.text).filter((t) => normForMatch(t)).join("\n");
22445
22820
  if (irCell && normForMatch(scanJoined) !== normForMatch(stripCellTokens(irCell.text))) {
22446
22821
  if (normForMatch(irCell.text) !== "" || normForMatch(scanJoined) !== "") {
@@ -22463,7 +22838,7 @@ function applyCellEdit(table, scanTable, gridR, gridC, newLines, ctx, before, af
22463
22838
  if (newLines.length === 0) return 0;
22464
22839
  const target = cell.paragraphs[0];
22465
22840
  if (!target) return skip("\uBE48 \uC140\uC5D0 \uBB38\uB2E8\uC774 \uC5C6\uC5B4 \uD14D\uC2A4\uD2B8 \uC0BD\uC785 \uBD88\uAC00");
22466
- const sp = buildParagraphSplices(target, newLines.join(" "), _optionalChain([ctx, 'access', _215 => _215.scans, 'access', _216 => _216[target.sectionIndex], 'optionalAccess', _217 => _217.xml]));
22841
+ const sp = buildParagraphSplices(target, newLines.join(" "), _optionalChain([ctx, 'access', _210 => _210.scans, 'access', _211 => _211[target.sectionIndex], 'optionalAccess', _212 => _212.xml]));
22467
22842
  if (sp === null) return skip("\uC140 \uBB38\uB2E8\uC5D0 \uD14D\uC2A4\uD2B8 \uB178\uB4DC\uB97C \uB9CC\uB4E4 \uC218 \uC5C6\uC74C");
22468
22843
  splices.push(...sp);
22469
22844
  sectionIndex = target.sectionIndex;
@@ -22486,7 +22861,7 @@ function applyCellEdit(table, scanTable, gridR, gridC, newLines, ctx, before, af
22486
22861
  }
22487
22862
  for (let i = 0; i < nonEmpty.length; i++) {
22488
22863
  if (assigned[i] === nonEmpty[i].text || normForMatch(assigned[i]) === normForMatch(nonEmpty[i].text)) continue;
22489
- const sp = buildParagraphSplices(nonEmpty[i], assigned[i], _optionalChain([ctx, 'access', _218 => _218.scans, 'access', _219 => _219[nonEmpty[i].sectionIndex], 'optionalAccess', _220 => _220.xml]));
22864
+ const sp = buildParagraphSplices(nonEmpty[i], assigned[i], _optionalChain([ctx, 'access', _213 => _213.scans, 'access', _214 => _214[nonEmpty[i].sectionIndex], 'optionalAccess', _215 => _215.xml]));
22490
22865
  if (sp === null) return skip("\uC140 \uBB38\uB2E8\uC5D0 \uD14D\uC2A4\uD2B8 \uB178\uB4DC\uB97C \uB9CC\uB4E4 \uC218 \uC5C6\uC74C");
22491
22866
  splices.push(...sp);
22492
22867
  sectionIndex = nonEmpty[i].sectionIndex;
@@ -22567,7 +22942,7 @@ async function resolveSectionEntryNames(zip) {
22567
22942
  const paths = sectionPathsFromManifest(xml).filter((p) => zip.file(p) !== null);
22568
22943
  if (paths.length > 0) return paths;
22569
22944
  }
22570
- return Object.keys(zip.files).filter((n) => /[Ss]ection\d+\.xml$/.test(n)).sort(_chunkXL6O3VAYcjs.compareSectionPaths);
22945
+ return Object.keys(zip.files).filter((n) => /[Ss]ection\d+\.xml$/.test(n)).sort(_chunkVHXUD3PWcjs.compareSectionPaths);
22571
22946
  }
22572
22947
  function sectionPathsFromManifest(xml) {
22573
22948
  const attr = (tag, name) => {
@@ -22577,7 +22952,7 @@ function sectionPathsFromManifest(xml) {
22577
22952
  const idToHref = /* @__PURE__ */ new Map();
22578
22953
  for (const m of xml.matchAll(/<opf:item(\s(?:"[^"]*"|'[^']*'|[^>"'])*?)\/?>/g)) {
22579
22954
  const id = attr(m[1], "id");
22580
- const href = _chunkXL6O3VAYcjs.normalizeSectionHref.call(void 0, attr(m[1], "href"));
22955
+ const href = _chunkVHXUD3PWcjs.normalizeSectionHref.call(void 0, attr(m[1], "href"));
22581
22956
  if (id && href) idToHref.set(id, href);
22582
22957
  }
22583
22958
  const ordered = [];
@@ -22586,7 +22961,7 @@ function sectionPathsFromManifest(xml) {
22586
22961
  if (href) ordered.push(href);
22587
22962
  }
22588
22963
  if (ordered.length > 0) return ordered;
22589
- return Array.from(idToHref.values()).sort(_chunkXL6O3VAYcjs.compareSectionPaths);
22964
+ return Array.from(idToHref.values()).sort(_chunkVHXUD3PWcjs.compareSectionPaths);
22590
22965
  }
22591
22966
 
22592
22967
  // src/roundtrip/patcher.ts
@@ -22678,7 +23053,7 @@ async function patchHwpx(original, editedMarkdown, options) {
22678
23053
  }
22679
23054
  }
22680
23055
  let verification;
22681
- if (_optionalChain([options, 'optionalAccess', _221 => _221.verify]) !== false) {
23056
+ if (_optionalChain([options, 'optionalAccess', _216 => _216.verify]) !== false) {
22682
23057
  try {
22683
23058
  const reparsed = await parseHwpxDocument(u8ToArrayBuffer(data));
22684
23059
  verification = diffUnitLists(splitMarkdownUnits(reparsed.markdown), editedUnits);
@@ -22696,17 +23071,17 @@ function buildOrigUnits(blocks) {
22696
23071
  let chunk;
22697
23072
  if (block.type === "paragraph" && block.text && /^\[별표\s*\d+/.test(sanitizeText(block.text))) {
22698
23073
  const next = blocks[i + 1];
22699
- if (_optionalChain([next, 'optionalAccess', _222 => _222.type]) === "paragraph" && next.text && /관련\)?$/.test(next.text)) consume = 2;
22700
- chunk = _chunkXL6O3VAYcjs.blocksToMarkdown.call(void 0, blocks.slice(i, i + consume));
23074
+ if (_optionalChain([next, 'optionalAccess', _217 => _217.type]) === "paragraph" && next.text && /관련\)?$/.test(next.text)) consume = 2;
23075
+ chunk = _chunkVHXUD3PWcjs.blocksToMarkdown.call(void 0, blocks.slice(i, i + consume));
22701
23076
  } else {
22702
- chunk = _chunkXL6O3VAYcjs.blocksToMarkdown.call(void 0, [block]);
23077
+ chunk = _chunkVHXUD3PWcjs.blocksToMarkdown.call(void 0, [block]);
22703
23078
  }
22704
23079
  if (chunk) {
22705
23080
  const subUnits = splitMarkdownUnits(chunk);
22706
23081
  const isFragment = consume === 2 || (block.type === "paragraph" || block.type === "heading") && subUnits.length > 1;
22707
23082
  for (let s = 0; s < subUnits.length; s++) {
22708
23083
  const u = { ...subUnits[s], blockIdx: i, fragment: isFragment || void 0 };
22709
- if (block.type === "table" && _optionalChain([block, 'access', _223 => _223.table, 'optionalAccess', _224 => _224.caption]) && s === 0 && subUnits.length > 1 && u.kind === "text" && u.raw.startsWith("**")) {
23084
+ if (block.type === "table" && _optionalChain([block, 'access', _218 => _218.table, 'optionalAccess', _219 => _219.caption]) && s === 0 && subUnits.length > 1 && u.kind === "text" && u.raw.startsWith("**")) {
22710
23085
  u.role = "caption";
22711
23086
  }
22712
23087
  units.push(u);
@@ -22817,7 +23192,7 @@ function convertParagraphToTable(block, orig, edited, ctx, skip) {
22817
23192
  const ti = ctx.tableInsert;
22818
23193
  if (!ti) return skip("\uBB38\uB2E8\u2192\uD45C \uBCC0\uD658 \uBD88\uAC00 \u2014 header \uC5D4\uD2B8\uB9AC(borderFills) \uD574\uC11D \uC2E4\uD328");
22819
23194
  const mapping = ctx.paraMap.get(orig.blockIdx);
22820
- if (!_optionalChain([mapping, 'optionalAccess', _225 => _225.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");
23195
+ if (!_optionalChain([mapping, 'optionalAccess', _220 => _220.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");
22821
23196
  const para = mapping.para;
22822
23197
  if (para.kind !== "body") return skip("\uBCF8\uBB38 \uC678 \uC601\uC5ED(\uD45C \uC140/\uAE00\uC0C1\uC790) \uBB38\uB2E8\uC758 \uD45C \uBCC0\uD658\uC740 \uBBF8\uC9C0\uC6D0");
22823
23198
  const scan = ctx.scans[para.sectionIndex];
@@ -22845,7 +23220,7 @@ function convertParagraphToTable(block, orig, edited, ctx, skip) {
22845
23220
  }
22846
23221
  function patchParagraphUnit(block, orig, edited, ctx, skip) {
22847
23222
  const mapping = ctx.paraMap.get(orig.blockIdx);
22848
- if (!_optionalChain([mapping, 'optionalAccess', _226 => _226.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)");
23223
+ if (!_optionalChain([mapping, 'optionalAccess', _221 => _221.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)");
22849
23224
  if (block.text && block.text.includes("\n")) {
22850
23225
  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)");
22851
23226
  }
@@ -22876,7 +23251,7 @@ function patchParagraphUnit(block, orig, edited, ctx, skip) {
22876
23251
  if (sanitizeText(newPlain) !== newPlain) {
22877
23252
  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");
22878
23253
  }
22879
- const splices = buildParagraphSplices(mapping.para, newPlain, _optionalChain([ctx, 'access', _227 => _227.scans, 'access', _228 => _228[mapping.para.sectionIndex], 'optionalAccess', _229 => _229.xml]));
23254
+ const splices = buildParagraphSplices(mapping.para, newPlain, _optionalChain([ctx, 'access', _222 => _222.scans, 'access', _223 => _223[mapping.para.sectionIndex], 'optionalAccess', _224 => _224.xml]));
22880
23255
  if (splices === null) return skip("\uBB38\uB2E8\uC5D0 \uD14D\uC2A4\uD2B8 \uB178\uB4DC\uB97C \uB9CC\uB4E4 \uC218 \uC5C6\uC74C");
22881
23256
  ctx.sectionSplices[mapping.para.sectionIndex].push(...splices);
22882
23257
  return 1;
@@ -23062,7 +23437,7 @@ var Surgeon = (_class4 = class {
23062
23437
  /** 디렉토리 트리에서 경로 해석 (형제 = L/R 이진 트리, 자식 = child) */
23063
23438
  findEntry(path) {
23064
23439
  const parts = path.replace(/^\//, "").split("/");
23065
- let scope = _nullishCoalesce(_optionalChain([this, 'access', _230 => _230.entries, 'access', _231 => _231[0], 'optionalAccess', _232 => _232.child]), () => ( -1));
23440
+ let scope = _nullishCoalesce(_optionalChain([this, 'access', _225 => _225.entries, 'access', _226 => _226[0], 'optionalAccess', _227 => _227.child]), () => ( -1));
23066
23441
  let current;
23067
23442
  for (const part of parts) {
23068
23443
  const search = (idx) => {
@@ -23275,8 +23650,8 @@ function serializeRecords(recs, repl, inserts) {
23275
23650
  parts.push(header, data);
23276
23651
  };
23277
23652
  for (let i = 0; i < recs.length; i++) {
23278
- for (const ins of _nullishCoalesce(_optionalChain([inserts, 'optionalAccess', _233 => _233.get, 'call', _234 => _234(i)]), () => ( []))) push(ins.tagId, ins.level, ins.data);
23279
- push(recs[i].tagId, recs[i].level, _nullishCoalesce(_optionalChain([repl, 'optionalAccess', _235 => _235.get, 'call', _236 => _236(i)]), () => ( recs[i].data)));
23653
+ for (const ins of _nullishCoalesce(_optionalChain([inserts, 'optionalAccess', _228 => _228.get, 'call', _229 => _229(i)]), () => ( []))) push(ins.tagId, ins.level, ins.data);
23654
+ push(recs[i].tagId, recs[i].level, _nullishCoalesce(_optionalChain([repl, 'optionalAccess', _230 => _230.get, 'call', _231 => _231(i)]), () => ( recs[i].data)));
23280
23655
  }
23281
23656
  return Buffer.concat(parts);
23282
23657
  }
@@ -23394,7 +23769,7 @@ async function patchHwp(original, editedMarkdown, options) {
23394
23769
  return fail(`CFB \uCEE8\uD14C\uC774\uB108 \uD30C\uC2F1 \uC2E4\uD328: ${msg(err)}`);
23395
23770
  }
23396
23771
  const fhEntry = CFB2.find(cfb, "/FileHeader");
23397
- if (!_optionalChain([fhEntry, 'optionalAccess', _237 => _237.content])) return fail("FileHeader \uC2A4\uD2B8\uB9BC\uC774 \uC5C6\uC2B5\uB2C8\uB2E4 \u2014 HWP 5.x \uD30C\uC77C\uC774 \uC544\uB2D9\uB2C8\uB2E4");
23772
+ if (!_optionalChain([fhEntry, 'optionalAccess', _232 => _232.content])) return fail("FileHeader \uC2A4\uD2B8\uB9BC\uC774 \uC5C6\uC2B5\uB2C8\uB2E4 \u2014 HWP 5.x \uD30C\uC77C\uC774 \uC544\uB2D9\uB2C8\uB2E4");
23398
23773
  let flags;
23399
23774
  try {
23400
23775
  flags = parseFileHeader(Buffer.from(fhEntry.content)).flags;
@@ -23416,7 +23791,7 @@ async function patchHwp(original, editedMarkdown, options) {
23416
23791
  const scans = [];
23417
23792
  for (let i = 0; i < sectionPaths.length; i++) {
23418
23793
  const entry = CFB2.find(cfb, sectionPaths[i]);
23419
- if (!_optionalChain([entry, 'optionalAccess', _238 => _238.content])) return fail(`\uC139\uC158 \uC2A4\uD2B8\uB9BC \uC77D\uAE30 \uC2E4\uD328: ${sectionPaths[i]}`);
23794
+ if (!_optionalChain([entry, 'optionalAccess', _233 => _233.content])) return fail(`\uC139\uC158 \uC2A4\uD2B8\uB9BC \uC77D\uAE30 \uC2E4\uD328: ${sectionPaths[i]}`);
23420
23795
  let stream;
23421
23796
  try {
23422
23797
  stream = compressed ? decompressStream(Buffer.from(entry.content)) : Buffer.from(entry.content);
@@ -23467,7 +23842,7 @@ async function patchHwp(original, editedMarkdown, options) {
23467
23842
  }
23468
23843
  }
23469
23844
  let verification;
23470
- if (_optionalChain([options, 'optionalAccess', _239 => _239.verify]) !== false) {
23845
+ if (_optionalChain([options, 'optionalAccess', _234 => _234.verify]) !== false) {
23471
23846
  try {
23472
23847
  const reparsed = parseHwp5Document(Buffer.from(data));
23473
23848
  verification = diffUnitLists(splitMarkdownUnits(reparsed.markdown), editedUnits);
@@ -23556,7 +23931,7 @@ function tableContentScore(irTable, scanTable) {
23556
23931
  for (const [key, scanCell] of scanTable.cells) {
23557
23932
  const comma = key.indexOf(",");
23558
23933
  const r = Number(key.slice(0, comma)), c = Number(key.slice(comma + 1));
23559
- const irCell = _optionalChain([irTable, 'access', _240 => _240.cells, 'access', _241 => _241[r], 'optionalAccess', _242 => _242[c]]);
23934
+ const irCell = _optionalChain([irTable, 'access', _235 => _235.cells, 'access', _236 => _236[r], 'optionalAccess', _237 => _237[c]]);
23560
23935
  if (!irCell) continue;
23561
23936
  const a = normForMatch(scanCell.paras.map((p) => p.rawText).join(" "));
23562
23937
  const b = normForMatch(stripCellTokens(irCell.text));
@@ -23592,7 +23967,7 @@ function handleModified(orig, edited, ctx) {
23592
23967
  }
23593
23968
  function patchParagraph(block, orig, edited, ctx, skip) {
23594
23969
  const mapping = ctx.paraMap.get(orig.blockIdx);
23595
- if (!_optionalChain([mapping, 'optionalAccess', _243 => _243.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)");
23970
+ if (!_optionalChain([mapping, 'optionalAccess', _238 => _238.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)");
23596
23971
  if (block.text && block.text.includes("\n")) {
23597
23972
  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)");
23598
23973
  }
@@ -23768,7 +24143,7 @@ function applyCellEdit5(table, scanTable, gridR, gridC, newLines, ctx, before, a
23768
24143
  };
23769
24144
  const cell = scanTable.cells.get(`${gridR},${gridC}`);
23770
24145
  if (!cell) return skip("\uC140 \uC88C\uD45C \uB9E4\uD551 \uC2E4\uD328 (\uBCD1\uD569 \uC601\uC5ED\uC758 \uBE48 \uCE78\uC774\uAC70\uB098 \uC88C\uD45C \uBD88\uC77C\uCE58)");
23771
- const irCell = _optionalChain([table, 'access', _244 => _244.cells, 'access', _245 => _245[gridR], 'optionalAccess', _246 => _246[gridC]]);
24146
+ const irCell = _optionalChain([table, 'access', _239 => _239.cells, 'access', _240 => _240[gridR], 'optionalAccess', _241 => _241[gridC]]);
23772
24147
  const scanJoined = cell.paras.map((p) => p.rawText).filter((t) => normForMatch(t)).join("\n");
23773
24148
  if (irCell && normForMatch(scanJoined) !== normForMatch(stripCellTokens(irCell.text))) {
23774
24149
  if (normForMatch(irCell.text) !== "" || normForMatch(scanJoined) !== "") {
@@ -24043,7 +24418,7 @@ var HwpxSession = (_class5 = class _HwpxSession {
24043
24418
  const block = st.blocks[blockIndex];
24044
24419
  if (!block) return void 0;
24045
24420
  if (block.type === "paragraph" || block.type === "heading") {
24046
- const para = _optionalChain([st, 'access', _247 => _247.paraMap, 'access', _248 => _248.get, 'call', _249 => _249(blockIndex), 'optionalAccess', _250 => _250.para]);
24421
+ const para = _optionalChain([st, 'access', _242 => _242.paraMap, 'access', _243 => _243.get, 'call', _244 => _244(blockIndex), 'optionalAccess', _245 => _245.para]);
24047
24422
  if (!para) return void 0;
24048
24423
  return { kind: "paragraph", sectionIndex: para.sectionIndex, xmlStart: para.start };
24049
24424
  }
@@ -24068,7 +24443,7 @@ var HwpxSession = (_class5 = class _HwpxSession {
24068
24443
  if (block.text && block.text.includes("\n")) {
24069
24444
  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)" };
24070
24445
  }
24071
- if (!_optionalChain([st, 'access', _251 => _251.paraMap, 'access', _252 => _252.get, 'call', _253 => _253(blockIndex), 'optionalAccess', _254 => _254.para])) {
24446
+ if (!_optionalChain([st, 'access', _246 => _246.paraMap, 'access', _247 => _247.get, 'call', _248 => _248(blockIndex), 'optionalAccess', _249 => _249.para])) {
24072
24447
  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)" };
24073
24448
  }
24074
24449
  return { capability: "text" };
@@ -24134,7 +24509,7 @@ var HwpxSession = (_class5 = class _HwpxSession {
24134
24509
  continue;
24135
24510
  }
24136
24511
  if (block.type === "table" && block.table) {
24137
- if (!_optionalChain([edit, 'access', _255 => _255.cells, 'optionalAccess', _256 => _256.length])) {
24512
+ if (!_optionalChain([edit, 'access', _250 => _250.cells, 'optionalAccess', _251 => _251.length])) {
24138
24513
  skipped.push({ reason: "\uD45C \uBE14\uB85D\uC5D0\uB294 cells \uD3B8\uC9D1\uB9CC \uC9C0\uC6D0", before: summarize(_nullishCoalesce(block.table.caption, () => ( "(\uD45C)"))) });
24139
24514
  continue;
24140
24515
  }
@@ -24154,7 +24529,7 @@ var HwpxSession = (_class5 = class _HwpxSession {
24154
24529
  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) });
24155
24530
  continue;
24156
24531
  }
24157
- const irCell = _optionalChain([block, 'access', _257 => _257.table, 'access', _258 => _258.cells, 'access', _259 => _259[cellEdit.row], 'optionalAccess', _260 => _260[cellEdit.col]]);
24532
+ const irCell = _optionalChain([block, 'access', _252 => _252.table, 'access', _253 => _253.cells, 'access', _254 => _254[cellEdit.row], 'optionalAccess', _255 => _255[cellEdit.col]]);
24158
24533
  if (!irCell) {
24159
24534
  skipped.push({ reason: `\uC140 \uC88C\uD45C \uBC94\uC704 \uBC16: ${cellEdit.row},${cellEdit.col}`, after: summarize(cellEdit.text) });
24160
24535
  continue;
@@ -24210,7 +24585,7 @@ var HwpxSession = (_class5 = class _HwpxSession {
24210
24585
  }
24211
24586
  if (replacements.size === 0) {
24212
24587
  let changes2;
24213
- if (_optionalChain([options, 'optionalAccess', _261 => _261.verify]) !== false) {
24588
+ if (_optionalChain([options, 'optionalAccess', _256 => _256.verify]) !== false) {
24214
24589
  const units = splitMarkdownUnits(st.markdown);
24215
24590
  changes2 = diffUnitLists(units, units);
24216
24591
  }
@@ -24231,7 +24606,7 @@ var HwpxSession = (_class5 = class _HwpxSession {
24231
24606
  }
24232
24607
  this.state = newState;
24233
24608
  let changes;
24234
- if (_optionalChain([options, 'optionalAccess', _262 => _262.verify]) !== false) {
24609
+ if (_optionalChain([options, 'optionalAccess', _257 => _257.verify]) !== false) {
24235
24610
  changes = diffUnitLists(splitMarkdownUnits(beforeMarkdown), splitMarkdownUnits(newState.markdown));
24236
24611
  }
24237
24612
  return { success: true, data: new Uint8Array(data), applied, skipped, changes };
@@ -24251,7 +24626,7 @@ var HwpxSession = (_class5 = class _HwpxSession {
24251
24626
  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)");
24252
24627
  }
24253
24628
  const mapping = st.paraMap.get(blockIndex);
24254
- if (!_optionalChain([mapping, 'optionalAccess', _263 => _263.para])) {
24629
+ if (!_optionalChain([mapping, 'optionalAccess', _258 => _258.para])) {
24255
24630
  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)");
24256
24631
  }
24257
24632
  let newPlain = newTextRaw.split("\n").map((l) => l.trim()).filter(Boolean).join(" ");
@@ -24271,14 +24646,14 @@ var HwpxSession = (_class5 = class _HwpxSession {
24271
24646
  if (sanitizeText(newPlain) !== newPlain) {
24272
24647
  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");
24273
24648
  }
24274
- const splices = buildParagraphSplices(mapping.para, newPlain, _optionalChain([st, 'access', _264 => _264.scans, 'access', _265 => _265[mapping.para.sectionIndex], 'optionalAccess', _266 => _266.xml]));
24649
+ const splices = buildParagraphSplices(mapping.para, newPlain, _optionalChain([st, 'access', _259 => _259.scans, 'access', _260 => _260[mapping.para.sectionIndex], 'optionalAccess', _261 => _261.xml]));
24275
24650
  if (splices === null) return skip("\uBB38\uB2E8\uC5D0 \uD14D\uC2A4\uD2B8 \uB178\uB4DC\uB97C \uB9CC\uB4E4 \uC218 \uC5C6\uC74C");
24276
24651
  sectionSplices[mapping.para.sectionIndex].push(...splices);
24277
24652
  return 1;
24278
24653
  }
24279
24654
  }, _class5);
24280
24655
  function cellStaticCheck(table, scanTable, r, c) {
24281
- const irCell = _optionalChain([table, 'access', _267 => _267.cells, 'access', _268 => _268[r], 'optionalAccess', _269 => _269[c]]);
24656
+ const irCell = _optionalChain([table, 'access', _262 => _262.cells, 'access', _263 => _263[r], 'optionalAccess', _264 => _264[c]]);
24282
24657
  if (!irCell) return { editable: false, reason: "\uC140 \uC88C\uD45C \uBC94\uC704 \uBC16" };
24283
24658
  const cell = scanTable.cellByAnchor.get(`${r},${c}`);
24284
24659
  if (!cell) return { editable: false, reason: "\uBCD1\uD569 \uC601\uC5ED\uC758 \uBE48 \uCE78\uC774\uAC70\uB098 \uC88C\uD45C \uBD88\uC77C\uCE58" };
@@ -24362,11 +24737,11 @@ var md = new (0, _markdownit2.default)({
24362
24737
  breaks: false
24363
24738
  });
24364
24739
  function renderHtml(markdown, options) {
24365
- const preset = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _270 => _270.preset]), () => ( "default"));
24366
- const css = PRESETS[preset] + (_nullishCoalesce(_optionalChain([options, 'optionalAccess', _271 => _271.extraCss]), () => ( "")));
24740
+ const preset = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _265 => _265.preset]), () => ( "default"));
24741
+ const css = PRESETS[preset] + (_nullishCoalesce(_optionalChain([options, 'optionalAccess', _266 => _266.extraCss]), () => ( "")));
24367
24742
  const body = md.render(markdown);
24368
- const watermark = _optionalChain([options, 'optionalAccess', _272 => _272.watermark]) ? `<div class="watermark">${escapeHtml(options.watermark)}</div>` : "";
24369
- const watermarkCss = _optionalChain([options, 'optionalAccess', _273 => _273.watermark]) ? `
24743
+ const watermark = _optionalChain([options, 'optionalAccess', _267 => _267.watermark]) ? `<div class="watermark">${escapeHtml(options.watermark)}</div>` : "";
24744
+ const watermarkCss = _optionalChain([options, 'optionalAccess', _268 => _268.watermark]) ? `
24370
24745
  .watermark {
24371
24746
  position: fixed;
24372
24747
  top: 50%; left: 50%;
@@ -24397,13 +24772,13 @@ async function htmlToPdf(html, options) {
24397
24772
  try {
24398
24773
  puppeteer = await Promise.resolve().then(() => _interopRequireWildcard(require("puppeteer-core")));
24399
24774
  } catch (e30) {
24400
- throw new (0, _chunkXL6O3VAYcjs.KordocError)(
24775
+ throw new (0, _chunkVHXUD3PWcjs.KordocError)(
24401
24776
  "PDF \uC0DD\uC131\uC5D0 puppeteer-core\uAC00 \uD544\uC694\uD569\uB2C8\uB2E4. \uC124\uCE58: npm install puppeteer-core"
24402
24777
  );
24403
24778
  }
24404
24779
  const executablePath = _nullishCoalesce(process.env.PUPPETEER_EXECUTABLE_PATH, () => ( findChromiumPath()));
24405
24780
  if (!executablePath) {
24406
- throw new (0, _chunkXL6O3VAYcjs.KordocError)(
24781
+ throw new (0, _chunkVHXUD3PWcjs.KordocError)(
24407
24782
  "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."
24408
24783
  );
24409
24784
  }
@@ -24415,10 +24790,10 @@ async function htmlToPdf(html, options) {
24415
24790
  try {
24416
24791
  const page = await browser.newPage();
24417
24792
  await page.setContent(html, { waitUntil: "networkidle0" });
24418
- const margin = _optionalChain([options, 'optionalAccess', _274 => _274.margin]);
24793
+ const margin = _optionalChain([options, 'optionalAccess', _269 => _269.margin]);
24419
24794
  const pdf = await page.pdf({
24420
- format: _nullishCoalesce(_optionalChain([options, 'optionalAccess', _275 => _275.pageSize]), () => ( "A4")),
24421
- landscape: _optionalChain([options, 'optionalAccess', _276 => _276.orientation]) === "landscape",
24795
+ format: _nullishCoalesce(_optionalChain([options, 'optionalAccess', _270 => _270.pageSize]), () => ( "A4")),
24796
+ landscape: _optionalChain([options, 'optionalAccess', _271 => _271.orientation]) === "landscape",
24422
24797
  printBackground: true,
24423
24798
  margin: margin ? {
24424
24799
  top: toCss(margin.top),
@@ -24426,9 +24801,9 @@ async function htmlToPdf(html, options) {
24426
24801
  bottom: toCss(margin.bottom),
24427
24802
  left: toCss(margin.left)
24428
24803
  } : void 0,
24429
- displayHeaderFooter: !!(_optionalChain([options, 'optionalAccess', _277 => _277.header]) || _optionalChain([options, 'optionalAccess', _278 => _278.footer])),
24430
- headerTemplate: _nullishCoalesce(_optionalChain([options, 'optionalAccess', _279 => _279.header]), () => ( "<div></div>")),
24431
- footerTemplate: _nullishCoalesce(_optionalChain([options, 'optionalAccess', _280 => _280.footer]), () => ( '<div style="font-size:8pt;width:100%;text-align:center;color:#777;"><span class="pageNumber"></span>/<span class="totalPages"></span></div>'))
24804
+ displayHeaderFooter: !!(_optionalChain([options, 'optionalAccess', _272 => _272.header]) || _optionalChain([options, 'optionalAccess', _273 => _273.footer])),
24805
+ headerTemplate: _nullishCoalesce(_optionalChain([options, 'optionalAccess', _274 => _274.header]), () => ( "<div></div>")),
24806
+ footerTemplate: _nullishCoalesce(_optionalChain([options, 'optionalAccess', _275 => _275.footer]), () => ( '<div style="font-size:8pt;width:100%;text-align:center;color:#777;"><span class="pageNumber"></span>/<span class="totalPages"></span></div>'))
24432
24807
  });
24433
24808
  return Buffer.from(pdf);
24434
24809
  } finally {
@@ -24462,24 +24837,24 @@ async function markdownToPdf(markdown, options) {
24462
24837
  return htmlToPdf(html, options);
24463
24838
  }
24464
24839
  async function blocksToPdf(blocks, options) {
24465
- const markdown = _chunkXL6O3VAYcjs.blocksToMarkdown.call(void 0, blocks);
24840
+ const markdown = _chunkVHXUD3PWcjs.blocksToMarkdown.call(void 0, blocks);
24466
24841
  return markdownToPdf(markdown, options);
24467
24842
  }
24468
24843
 
24469
24844
  // src/index.ts
24470
24845
  async function parse(input, options) {
24471
24846
  let buffer;
24472
- const opts = typeof input === "string" && !_optionalChain([options, 'optionalAccess', _281 => _281.filePath]) ? { ...options, filePath: input } : options;
24847
+ const opts = typeof input === "string" && !_optionalChain([options, 'optionalAccess', _276 => _276.filePath]) ? { ...options, filePath: input } : options;
24473
24848
  if (typeof input === "string") {
24474
24849
  try {
24475
24850
  const buf = await _promises.readFile.call(void 0, input);
24476
- buffer = _chunkXL6O3VAYcjs.toArrayBuffer.call(void 0, buf);
24851
+ buffer = _chunkVHXUD3PWcjs.toArrayBuffer.call(void 0, buf);
24477
24852
  } catch (err) {
24478
24853
  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}`;
24479
24854
  return { success: false, fileType: "unknown", error: msg2, code: "PARSE_ERROR" };
24480
24855
  }
24481
24856
  } else if (Buffer.isBuffer(input)) {
24482
- buffer = _chunkXL6O3VAYcjs.toArrayBuffer.call(void 0, input);
24857
+ buffer = _chunkVHXUD3PWcjs.toArrayBuffer.call(void 0, input);
24483
24858
  } else {
24484
24859
  buffer = input;
24485
24860
  }
@@ -24514,21 +24889,21 @@ async function parseHwp3(buffer, options) {
24514
24889
  const { markdown, blocks, metadata, outline, warnings } = parseHwp3Document(buffer, options);
24515
24890
  return { success: true, fileType: "hwp3", markdown, blocks, metadata, outline, warnings };
24516
24891
  } catch (err) {
24517
- return { success: false, fileType: "hwp3", error: err instanceof Error ? err.message : "HWP3 \uD30C\uC2F1 \uC2E4\uD328", code: _chunkXL6O3VAYcjs.classifyError.call(void 0, err) };
24892
+ return { success: false, fileType: "hwp3", error: err instanceof Error ? err.message : "HWP3 \uD30C\uC2F1 \uC2E4\uD328", code: _chunkVHXUD3PWcjs.classifyError.call(void 0, err) };
24518
24893
  }
24519
24894
  }
24520
24895
  async function parseHwpx(buffer, options) {
24521
24896
  try {
24522
24897
  const { markdown, blocks, metadata, outline, warnings, images } = await parseHwpxDocument(buffer, options);
24523
- return { success: true, fileType: "hwpx", markdown, blocks, metadata, outline, warnings, images: _optionalChain([images, 'optionalAccess', _282 => _282.length]) ? images : void 0 };
24898
+ return { success: true, fileType: "hwpx", markdown, blocks, metadata, outline, warnings, images: _optionalChain([images, 'optionalAccess', _277 => _277.length]) ? images : void 0 };
24524
24899
  } catch (err) {
24525
- return { success: false, fileType: "hwpx", error: err instanceof Error ? err.message : "HWPX \uD30C\uC2F1 \uC2E4\uD328", code: _chunkXL6O3VAYcjs.classifyError.call(void 0, err) };
24900
+ return { success: false, fileType: "hwpx", error: err instanceof Error ? err.message : "HWPX \uD30C\uC2F1 \uC2E4\uD328", code: _chunkVHXUD3PWcjs.classifyError.call(void 0, err) };
24526
24901
  }
24527
24902
  }
24528
24903
  async function parseHwp(buffer, options) {
24529
24904
  try {
24530
24905
  const { markdown, blocks, metadata, outline, warnings, images } = parseHwp5Document(Buffer.from(buffer), options);
24531
- if (isDistributionSentinel(markdown) && isComFallbackAvailable() && _optionalChain([options, 'optionalAccess', _283 => _283.filePath])) {
24906
+ if (isDistributionSentinel(markdown) && isComFallbackAvailable() && _optionalChain([options, 'optionalAccess', _278 => _278.filePath])) {
24532
24907
  try {
24533
24908
  const { pages, pageCount, warnings: comWarns } = extractTextViaCom(options.filePath);
24534
24909
  if (pages.some((p) => p && p.trim().length > 0)) {
@@ -24545,15 +24920,15 @@ async function parseHwp(buffer, options) {
24545
24920
  } catch (e31) {
24546
24921
  }
24547
24922
  }
24548
- return { success: true, fileType: "hwp", markdown, blocks, metadata, outline, warnings, images: _optionalChain([images, 'optionalAccess', _284 => _284.length]) ? images : void 0 };
24923
+ return { success: true, fileType: "hwp", markdown, blocks, metadata, outline, warnings, images: _optionalChain([images, 'optionalAccess', _279 => _279.length]) ? images : void 0 };
24549
24924
  } catch (err) {
24550
- return { success: false, fileType: "hwp", error: err instanceof Error ? err.message : "HWP \uD30C\uC2F1 \uC2E4\uD328", code: _chunkXL6O3VAYcjs.classifyError.call(void 0, err) };
24925
+ return { success: false, fileType: "hwp", error: err instanceof Error ? err.message : "HWP \uD30C\uC2F1 \uC2E4\uD328", code: _chunkVHXUD3PWcjs.classifyError.call(void 0, err) };
24551
24926
  }
24552
24927
  }
24553
24928
  async function parsePdf(buffer, options) {
24554
24929
  let parsePdfDocument;
24555
24930
  try {
24556
- const mod = await Promise.resolve().then(() => _interopRequireWildcard(require("./parser-WWKYMRGJ.cjs")));
24931
+ const mod = await Promise.resolve().then(() => _interopRequireWildcard(require("./parser-N4G5KQBE.cjs")));
24557
24932
  parsePdfDocument = mod.parsePdfDocument;
24558
24933
  } catch (e32) {
24559
24934
  return {
@@ -24568,7 +24943,7 @@ async function parsePdf(buffer, options) {
24568
24943
  return { success: true, fileType: "pdf", markdown, blocks, metadata, outline, warnings, isImageBased, pageQuality, qualitySummary };
24569
24944
  } catch (err) {
24570
24945
  const isImageBased = err instanceof Error && "isImageBased" in err ? true : void 0;
24571
- return { success: false, fileType: "pdf", error: err instanceof Error ? err.message : "PDF \uD30C\uC2F1 \uC2E4\uD328", code: _chunkXL6O3VAYcjs.classifyError.call(void 0, err), isImageBased };
24946
+ return { success: false, fileType: "pdf", error: err instanceof Error ? err.message : "PDF \uD30C\uC2F1 \uC2E4\uD328", code: _chunkVHXUD3PWcjs.classifyError.call(void 0, err), isImageBased };
24572
24947
  }
24573
24948
  }
24574
24949
  async function parseXlsx(buffer, options) {
@@ -24576,7 +24951,7 @@ async function parseXlsx(buffer, options) {
24576
24951
  const { markdown, blocks, metadata, warnings } = await parseXlsxDocument(buffer, options);
24577
24952
  return { success: true, fileType: "xlsx", markdown, blocks, metadata, warnings };
24578
24953
  } catch (err) {
24579
- return { success: false, fileType: "xlsx", error: err instanceof Error ? err.message : "XLSX \uD30C\uC2F1 \uC2E4\uD328", code: _chunkXL6O3VAYcjs.classifyError.call(void 0, err) };
24954
+ return { success: false, fileType: "xlsx", error: err instanceof Error ? err.message : "XLSX \uD30C\uC2F1 \uC2E4\uD328", code: _chunkVHXUD3PWcjs.classifyError.call(void 0, err) };
24580
24955
  }
24581
24956
  }
24582
24957
  async function parseXls(buffer, options) {
@@ -24584,15 +24959,15 @@ async function parseXls(buffer, options) {
24584
24959
  const { markdown, blocks, metadata, warnings } = await parseXlsDocument(buffer, options);
24585
24960
  return { success: true, fileType: "xls", markdown, blocks, metadata, warnings };
24586
24961
  } catch (err) {
24587
- return { success: false, fileType: "xls", error: err instanceof Error ? err.message : "XLS \uD30C\uC2F1 \uC2E4\uD328", code: _chunkXL6O3VAYcjs.classifyError.call(void 0, err) };
24962
+ return { success: false, fileType: "xls", error: err instanceof Error ? err.message : "XLS \uD30C\uC2F1 \uC2E4\uD328", code: _chunkVHXUD3PWcjs.classifyError.call(void 0, err) };
24588
24963
  }
24589
24964
  }
24590
24965
  async function parseDocx(buffer, options) {
24591
24966
  try {
24592
24967
  const { markdown, blocks, metadata, outline, warnings, images } = await parseDocxDocument(buffer, options);
24593
- return { success: true, fileType: "docx", markdown, blocks, metadata, outline, warnings, images: _optionalChain([images, 'optionalAccess', _285 => _285.length]) ? images : void 0 };
24968
+ return { success: true, fileType: "docx", markdown, blocks, metadata, outline, warnings, images: _optionalChain([images, 'optionalAccess', _280 => _280.length]) ? images : void 0 };
24594
24969
  } catch (err) {
24595
- return { success: false, fileType: "docx", error: err instanceof Error ? err.message : "DOCX \uD30C\uC2F1 \uC2E4\uD328", code: _chunkXL6O3VAYcjs.classifyError.call(void 0, err) };
24970
+ return { success: false, fileType: "docx", error: err instanceof Error ? err.message : "DOCX \uD30C\uC2F1 \uC2E4\uD328", code: _chunkVHXUD3PWcjs.classifyError.call(void 0, err) };
24596
24971
  }
24597
24972
  }
24598
24973
  async function parseHwpml(buffer, options) {
@@ -24600,16 +24975,16 @@ async function parseHwpml(buffer, options) {
24600
24975
  const { markdown, blocks, metadata, outline, warnings } = parseHwpmlDocument(buffer, options);
24601
24976
  return { success: true, fileType: "hwpml", markdown, blocks, metadata, outline, warnings };
24602
24977
  } catch (err) {
24603
- return { success: false, fileType: "hwpml", error: err instanceof Error ? err.message : "HWPML \uD30C\uC2F1 \uC2E4\uD328", code: _chunkXL6O3VAYcjs.classifyError.call(void 0, err) };
24978
+ return { success: false, fileType: "hwpml", error: err instanceof Error ? err.message : "HWPML \uD30C\uC2F1 \uC2E4\uD328", code: _chunkVHXUD3PWcjs.classifyError.call(void 0, err) };
24604
24979
  }
24605
24980
  }
24606
24981
  async function fillForm(input, values, outputFormat = "markdown") {
24607
24982
  let buffer;
24608
24983
  if (typeof input === "string") {
24609
24984
  const buf = await _promises.readFile.call(void 0, input);
24610
- buffer = _chunkXL6O3VAYcjs.toArrayBuffer.call(void 0, buf);
24985
+ buffer = _chunkVHXUD3PWcjs.toArrayBuffer.call(void 0, buf);
24611
24986
  } else if (Buffer.isBuffer(input)) {
24612
- buffer = _chunkXL6O3VAYcjs.toArrayBuffer.call(void 0, input);
24987
+ buffer = _chunkVHXUD3PWcjs.toArrayBuffer.call(void 0, input);
24613
24988
  } else {
24614
24989
  buffer = input;
24615
24990
  }
@@ -24635,7 +25010,7 @@ async function fillForm(input, values, outputFormat = "markdown") {
24635
25010
  throw new Error(`\uC11C\uC2DD \uD30C\uC2F1 \uC2E4\uD328: ${parsed.error}`);
24636
25011
  }
24637
25012
  const fill = fillFormFields(parsed.blocks, values);
24638
- const markdown = _chunkXL6O3VAYcjs.blocksToMarkdown.call(void 0, fill.blocks);
25013
+ const markdown = _chunkVHXUD3PWcjs.blocksToMarkdown.call(void 0, fill.blocks);
24639
25014
  if (outputFormat === "hwpx") {
24640
25015
  const hwpxBuffer = await markdownToHwpx(markdown);
24641
25016
  return { output: hwpxBuffer, format: "hwpx", fill };
@@ -24693,5 +25068,5 @@ async function fillForm(input, values, outputFormat = "markdown") {
24693
25068
 
24694
25069
 
24695
25070
 
24696
- exports.HwpxSession = HwpxSession; exports.PRESET_ALIAS = PRESET_ALIAS; exports.SPACE_EM_FIXED = SPACE_EM_FIXED; exports.SPACE_EM_FONT = SPACE_EM_FONT; exports.VERSION = _chunkXL6O3VAYcjs.VERSION; exports.ValueCursor = ValueCursor; exports.applySplices = applySplices; exports.blocksToMarkdown = _chunkXL6O3VAYcjs.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.fitRatioForFewerLines = fitRatioForFewerLines; exports.inferFieldType = inferFieldType; exports.isHwpxFile = isHwpxFile; exports.isLabelCell = isLabelCell; exports.isOldHwpFile = isOldHwpFile; exports.isPdfFile = isPdfFile; exports.isZipFile = isZipFile; exports.markdownToHwpx = markdownToHwpx; exports.markdownToPdf = markdownToPdf; exports.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.renderHtml = renderHtml; exports.scanSectionXml = scanSectionXml; exports.simulateWrap = simulateWrap; exports.simulateWrapKeepWord = simulateWrapKeepWord;
25071
+ exports.HwpxSession = HwpxSession; exports.PRESET_ALIAS = PRESET_ALIAS; exports.SPACE_EM_FIXED = SPACE_EM_FIXED; exports.SPACE_EM_FONT = SPACE_EM_FONT; exports.VERSION = _chunkVHXUD3PWcjs.VERSION; exports.ValueCursor = ValueCursor; exports.applySplices = applySplices; exports.blocksToMarkdown = _chunkVHXUD3PWcjs.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.fitRatioForFewerLines = fitRatioForFewerLines; exports.inferFieldType = inferFieldType; exports.isHwpxFile = isHwpxFile; exports.isLabelCell = isLabelCell; exports.isOldHwpFile = isOldHwpFile; exports.isPdfFile = isPdfFile; exports.isZipFile = isZipFile; exports.markdownToHwpx = markdownToHwpx; exports.markdownToPdf = markdownToPdf; exports.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.renderHtml = renderHtml; exports.scanSectionXml = scanSectionXml; exports.simulateWrap = simulateWrap; exports.simulateWrapKeepWord = simulateWrapKeepWord;
24697
25072
  //# sourceMappingURL=index.cjs.map