kordoc 4.24.19 → 4.24.21

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (121) hide show
  1. package/README.md +5 -5
  2. package/dist/{-IFNBZFGR.js → -IS4RXPEZ.js} +11 -11
  3. package/dist/{chunk-2IFSM7ZE.js → chunk-3RVASM4C.js} +4 -4
  4. package/dist/{chunk-MHBJAY2T.js → chunk-4OF7DHIT.js} +4 -4
  5. package/dist/{chunk-IXCXFGYB.js → chunk-B3POEH7X.js} +2 -2
  6. package/dist/{chunk-XQJNL7TD.cjs → chunk-B5M676H3.cjs} +6 -6
  7. package/dist/{chunk-XQJNL7TD.cjs.map → chunk-B5M676H3.cjs.map} +1 -1
  8. package/dist/{chunk-XGUX3JDV.js → chunk-BMXWY36E.js} +4 -4
  9. package/dist/{chunk-DIDPIFGO.js → chunk-BNEKESI4.js} +2 -2
  10. package/dist/{chunk-UTDQAY35.js → chunk-BTBFKDPH.js} +2 -2
  11. package/dist/{chunk-OJL4V7WL.cjs → chunk-BUFGW3UJ.cjs} +25 -25
  12. package/dist/{chunk-OJL4V7WL.cjs.map → chunk-BUFGW3UJ.cjs.map} +1 -1
  13. package/dist/{chunk-Q6XWPGGB.js → chunk-BV2YG7M6.js} +2 -2
  14. package/dist/{chunk-MRFBERH2.js → chunk-CPVXUEKF.js} +2 -2
  15. package/dist/{chunk-UNTBPUY5.js → chunk-E6G4B457.js} +2 -2
  16. package/dist/{chunk-EEJKU5SD.js → chunk-F4GZFIUJ.js} +2 -2
  17. package/dist/{chunk-752MQ7LI.js → chunk-F6OHQLN7.js} +3 -3
  18. package/dist/{chunk-QQAANXHZ.js → chunk-IZN5BTCW.js} +2 -2
  19. package/dist/{chunk-RPHURU2B.cjs → chunk-L556KKBU.cjs} +79 -79
  20. package/dist/{chunk-RPHURU2B.cjs.map → chunk-L556KKBU.cjs.map} +1 -1
  21. package/dist/{chunk-TATLMLLJ.js → chunk-MGCIQ43Y.js} +3 -3
  22. package/dist/{chunk-MP6CLG5T.js → chunk-MMZUWRH6.js} +11 -11
  23. package/dist/{chunk-DCEXKPBH.js → chunk-MYDHNNPA.js} +92 -27
  24. package/dist/chunk-MYDHNNPA.js.map +1 -0
  25. package/dist/{chunk-WUU63RFU.js → chunk-N45RCYBL.js} +3 -3
  26. package/dist/{chunk-DTNNWOBN.js → chunk-NE75RO62.js} +2 -2
  27. package/dist/{chunk-OI4LVKFX.js → chunk-NRCG3ASU.js} +2 -2
  28. package/dist/{chunk-B4X2Q5MK.js → chunk-O5ZCJEZ4.js} +2 -2
  29. package/dist/{chunk-U4QSRBEV.cjs → chunk-OMGCVZ4W.cjs} +2 -2
  30. package/dist/{chunk-U4QSRBEV.cjs.map → chunk-OMGCVZ4W.cjs.map} +1 -1
  31. package/dist/{chunk-JQJYIYMJ.js → chunk-PDOWSDNM.js} +2 -2
  32. package/dist/{chunk-RQCGVE3R.js → chunk-UNYH6MTO.js} +2 -2
  33. package/dist/{chunk-4OWHKA6D.cjs → chunk-V7S36XCU.cjs} +3 -3
  34. package/dist/{chunk-4OWHKA6D.cjs.map → chunk-V7S36XCU.cjs.map} +1 -1
  35. package/dist/{chunk-X6GHZRPS.js → chunk-WQC4XWVT.js} +2 -2
  36. package/dist/{chunk-7RVG2IVX.cjs → chunk-WVZSTMCZ.cjs} +3 -3
  37. package/dist/{chunk-7RVG2IVX.cjs.map → chunk-WVZSTMCZ.cjs.map} +1 -1
  38. package/dist/{chunk-S4EPR2Q4.js → chunk-Z6ONQ63K.js} +2 -2
  39. package/dist/chunks-FYCQOIWO.js +10 -0
  40. package/dist/cli.js +30 -30
  41. package/dist/{formula-IYTV7SBF.js → formula-DHBBWQLC.js} +3 -3
  42. package/dist/{formula-WSK7DHQS.cjs → formula-G3FQTUOY.cjs} +9 -9
  43. package/dist/{formula-WSK7DHQS.cjs.map → formula-G3FQTUOY.cjs.map} +1 -1
  44. package/dist/{formula-WSFS7D7Z.js → formula-I4EA7ULD.js} +4 -4
  45. package/dist/{image-ocr-Y75JNXPZ.js → image-ocr-5YWVBRY6.js} +6 -6
  46. package/dist/{image-ocr-AVMUMNAV.js → image-ocr-QUVBGNWD.js} +9 -9
  47. package/dist/{image-ocr-LWWF4HEE.cjs → image-ocr-THUO6YRG.cjs} +17 -17
  48. package/dist/{image-ocr-LWWF4HEE.cjs.map → image-ocr-THUO6YRG.cjs.map} +1 -1
  49. package/dist/index.cjs +510 -445
  50. package/dist/index.cjs.map +1 -1
  51. package/dist/index.js +92 -27
  52. package/dist/index.js.map +1 -1
  53. package/dist/mcp.js +23 -23
  54. package/dist/{model-bundle-JOACGE6A.js → model-bundle-6RG5PO3R.js} +5 -5
  55. package/dist/{models-RTSOF7XB.js → models-CGYIGN6D.js} +5 -5
  56. package/dist/{parse-worker-v2-GHCIS7RI.js → parse-worker-v2-F5NXYBU6.js} +12 -12
  57. package/dist/{parser-4NF5BGSC.js → parser-G5QTRKII.js} +9 -9
  58. package/dist/{parser-GJWAT5YG.cjs → parser-GJ4PKW7I.cjs} +159 -159
  59. package/dist/{parser-GJWAT5YG.cjs.map → parser-GJ4PKW7I.cjs.map} +1 -1
  60. package/dist/{parser-E7VENFW7.js → parser-I2C5DUXC.js} +12 -12
  61. package/dist/pdf-ocr-LJKCUXTE.cjs +35 -0
  62. package/dist/{pdf-ocr-J74A2ZQW.cjs.map → pdf-ocr-LJKCUXTE.cjs.map} +1 -1
  63. package/dist/{pdf-ocr-CJSC4DLZ.js → pdf-ocr-TNW6YOPX.js} +6 -6
  64. package/dist/{pdf-ocr-K4MHY4KP.js → pdf-ocr-U3I74Q4O.js} +9 -9
  65. package/dist/{profile-io-LA4LFEFV.js → profile-io-5YZCFK7B.js} +3 -3
  66. package/dist/{rasterize-PZ6VCPOZ.js → rasterize-7VRHPOQX.js} +3 -3
  67. package/dist/{redact-doc-HHDDIIV7.js → redact-doc-VK6VGBK3.js} +11 -11
  68. package/dist/{render-QIWXWLYC.js → render-Y7J6DPRL.js} +7 -7
  69. package/dist/seal-4QIZ3ZNI.js +10 -0
  70. package/dist/{setup-Y6EZH34Z.js → setup-4XTUDU4X.js} +3 -3
  71. package/dist/visual-VEMQJ52W.js +21 -0
  72. package/dist/{watch-LBRW6NAG.js → watch-SPZRLTKG.js} +12 -12
  73. package/package.json +1 -1
  74. package/dist/chunk-DCEXKPBH.js.map +0 -1
  75. package/dist/chunks-7ACTVPJJ.js +0 -10
  76. package/dist/pdf-ocr-J74A2ZQW.cjs +0 -35
  77. package/dist/seal-SBA3CFCC.js +0 -10
  78. package/dist/visual-PN3PUVDG.js +0 -21
  79. /package/dist/{-IFNBZFGR.js.map → -IS4RXPEZ.js.map} +0 -0
  80. /package/dist/{chunk-2IFSM7ZE.js.map → chunk-3RVASM4C.js.map} +0 -0
  81. /package/dist/{chunk-MHBJAY2T.js.map → chunk-4OF7DHIT.js.map} +0 -0
  82. /package/dist/{chunk-IXCXFGYB.js.map → chunk-B3POEH7X.js.map} +0 -0
  83. /package/dist/{chunk-XGUX3JDV.js.map → chunk-BMXWY36E.js.map} +0 -0
  84. /package/dist/{chunk-DIDPIFGO.js.map → chunk-BNEKESI4.js.map} +0 -0
  85. /package/dist/{chunk-UTDQAY35.js.map → chunk-BTBFKDPH.js.map} +0 -0
  86. /package/dist/{chunk-Q6XWPGGB.js.map → chunk-BV2YG7M6.js.map} +0 -0
  87. /package/dist/{chunk-MRFBERH2.js.map → chunk-CPVXUEKF.js.map} +0 -0
  88. /package/dist/{chunk-UNTBPUY5.js.map → chunk-E6G4B457.js.map} +0 -0
  89. /package/dist/{chunk-EEJKU5SD.js.map → chunk-F4GZFIUJ.js.map} +0 -0
  90. /package/dist/{chunk-752MQ7LI.js.map → chunk-F6OHQLN7.js.map} +0 -0
  91. /package/dist/{chunk-QQAANXHZ.js.map → chunk-IZN5BTCW.js.map} +0 -0
  92. /package/dist/{chunk-TATLMLLJ.js.map → chunk-MGCIQ43Y.js.map} +0 -0
  93. /package/dist/{chunk-MP6CLG5T.js.map → chunk-MMZUWRH6.js.map} +0 -0
  94. /package/dist/{chunk-WUU63RFU.js.map → chunk-N45RCYBL.js.map} +0 -0
  95. /package/dist/{chunk-DTNNWOBN.js.map → chunk-NE75RO62.js.map} +0 -0
  96. /package/dist/{chunk-OI4LVKFX.js.map → chunk-NRCG3ASU.js.map} +0 -0
  97. /package/dist/{chunk-B4X2Q5MK.js.map → chunk-O5ZCJEZ4.js.map} +0 -0
  98. /package/dist/{chunk-JQJYIYMJ.js.map → chunk-PDOWSDNM.js.map} +0 -0
  99. /package/dist/{chunk-RQCGVE3R.js.map → chunk-UNYH6MTO.js.map} +0 -0
  100. /package/dist/{chunk-X6GHZRPS.js.map → chunk-WQC4XWVT.js.map} +0 -0
  101. /package/dist/{chunk-S4EPR2Q4.js.map → chunk-Z6ONQ63K.js.map} +0 -0
  102. /package/dist/{chunks-7ACTVPJJ.js.map → chunks-FYCQOIWO.js.map} +0 -0
  103. /package/dist/{formula-IYTV7SBF.js.map → formula-DHBBWQLC.js.map} +0 -0
  104. /package/dist/{formula-WSFS7D7Z.js.map → formula-I4EA7ULD.js.map} +0 -0
  105. /package/dist/{image-ocr-Y75JNXPZ.js.map → image-ocr-5YWVBRY6.js.map} +0 -0
  106. /package/dist/{image-ocr-AVMUMNAV.js.map → image-ocr-QUVBGNWD.js.map} +0 -0
  107. /package/dist/{model-bundle-JOACGE6A.js.map → model-bundle-6RG5PO3R.js.map} +0 -0
  108. /package/dist/{models-RTSOF7XB.js.map → models-CGYIGN6D.js.map} +0 -0
  109. /package/dist/{parse-worker-v2-GHCIS7RI.js.map → parse-worker-v2-F5NXYBU6.js.map} +0 -0
  110. /package/dist/{parser-4NF5BGSC.js.map → parser-G5QTRKII.js.map} +0 -0
  111. /package/dist/{parser-E7VENFW7.js.map → parser-I2C5DUXC.js.map} +0 -0
  112. /package/dist/{pdf-ocr-CJSC4DLZ.js.map → pdf-ocr-TNW6YOPX.js.map} +0 -0
  113. /package/dist/{pdf-ocr-K4MHY4KP.js.map → pdf-ocr-U3I74Q4O.js.map} +0 -0
  114. /package/dist/{profile-io-LA4LFEFV.js.map → profile-io-5YZCFK7B.js.map} +0 -0
  115. /package/dist/{rasterize-PZ6VCPOZ.js.map → rasterize-7VRHPOQX.js.map} +0 -0
  116. /package/dist/{redact-doc-HHDDIIV7.js.map → redact-doc-VK6VGBK3.js.map} +0 -0
  117. /package/dist/{render-QIWXWLYC.js.map → render-Y7J6DPRL.js.map} +0 -0
  118. /package/dist/{seal-SBA3CFCC.js.map → seal-4QIZ3ZNI.js.map} +0 -0
  119. /package/dist/{setup-Y6EZH34Z.js.map → setup-4XTUDU4X.js.map} +0 -0
  120. /package/dist/{visual-PN3PUVDG.js.map → visual-VEMQJ52W.js.map} +0 -0
  121. /package/dist/{watch-LBRW6NAG.js.map → watch-SPZRLTKG.js.map} +0 -0
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  KordocError
4
- } from "./chunk-X6GHZRPS.js";
4
+ } from "./chunk-WQC4XWVT.js";
5
5
 
6
6
  // src/shared/offline.ts
7
7
  import { realpathSync } from "fs";
@@ -49,4 +49,4 @@ export {
49
49
  getAccessRoot,
50
50
  assertWithinRoot
51
51
  };
52
- //# sourceMappingURL=chunk-Q6XWPGGB.js.map
52
+ //# sourceMappingURL=chunk-BV2YG7M6.js.map
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  blocksToMarkdown
3
- } from "./chunk-JQJYIYMJ.js";
3
+ } from "./chunk-PDOWSDNM.js";
4
4
 
5
5
  // src/image/transcode.ts
6
6
  import { deflateSync } from "zlib";
@@ -168,4 +168,4 @@ export {
168
168
  inlineImagesIntoMarkdown,
169
169
  blocksToPages
170
170
  };
171
- //# sourceMappingURL=chunk-MRFBERH2.js.map
171
+ //# sourceMappingURL=chunk-CPVXUEKF.js.map
@@ -3,7 +3,7 @@ import {
3
3
  ensureModelsIn,
4
4
  getModelStatusIn,
5
5
  getModelsDir
6
- } from "./chunk-B4X2Q5MK.js";
6
+ } from "./chunk-O5ZCJEZ4.js";
7
7
 
8
8
  // src/ocr/models.ts
9
9
  import { join } from "path";
@@ -171,4 +171,4 @@ export {
171
171
  parseCharacterDict,
172
172
  ocrModelPath
173
173
  };
174
- //# sourceMappingURL=chunk-UNTBPUY5.js.map
174
+ //# sourceMappingURL=chunk-E6G4B457.js.map
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  visibleText
4
- } from "./chunk-IXCXFGYB.js";
4
+ } from "./chunk-B3POEH7X.js";
5
5
 
6
6
  // src/script-tags.ts
7
7
  var LITERAL_TAG = /<(?=\/?(?:u|sup|sub)>)/g;
@@ -336,4 +336,4 @@ export {
336
336
  HEADING_RATIO_H2,
337
337
  HEADING_RATIO_H3
338
338
  };
339
- //# sourceMappingURL=chunk-EEJKU5SD.js.map
339
+ //# sourceMappingURL=chunk-F4GZFIUJ.js.map
@@ -6,11 +6,11 @@ import {
6
6
  HEADING_RATIO_H3,
7
7
  tidyScriptTags,
8
8
  toTex
9
- } from "./chunk-EEJKU5SD.js";
9
+ } from "./chunk-F4GZFIUJ.js";
10
10
  import {
11
11
  safeMax,
12
12
  safeMin
13
- } from "./chunk-X6GHZRPS.js";
13
+ } from "./chunk-WQC4XWVT.js";
14
14
 
15
15
  // src/ocr/line-split.ts
16
16
  function grayCrop(rgba, pageW, box) {
@@ -10361,4 +10361,4 @@ export {
10361
10361
  UNRULED_REGION_TABLES,
10362
10362
  mergeOcrImageRegions
10363
10363
  };
10364
- //# sourceMappingURL=chunk-752MQ7LI.js.map
10364
+ //# sourceMappingURL=chunk-F6OHQLN7.js.map
@@ -2,7 +2,7 @@
2
2
  import {
3
3
  KordocError,
4
4
  unzipLimitBytes
5
- } from "./chunk-X6GHZRPS.js";
5
+ } from "./chunk-WQC4XWVT.js";
6
6
 
7
7
  // src/hwpx/parser-shared.ts
8
8
  import { DOMParser } from "@xmldom/xmldom";
@@ -495,4 +495,4 @@ export {
495
495
  hwpFaceToCssStack,
496
496
  parseRenderStyles
497
497
  };
498
- //# sourceMappingURL=chunk-QQAANXHZ.js.map
498
+ //# sourceMappingURL=chunk-IZN5BTCW.js.map
@@ -36,14 +36,14 @@ var _chunkTK3FDAEEcjs = require('./chunk-TK3FDAEE.cjs');
36
36
 
37
37
 
38
38
 
39
- var _chunkOJL4V7WLcjs = require('./chunk-OJL4V7WL.cjs');
39
+ var _chunkBUFGW3UJcjs = require('./chunk-BUFGW3UJ.cjs');
40
40
 
41
41
 
42
- var _chunkXQJNL7TDcjs = require('./chunk-XQJNL7TD.cjs');
42
+ var _chunkB5M676H3cjs = require('./chunk-B5M676H3.cjs');
43
43
 
44
44
 
45
45
 
46
- var _chunkU4QSRBEVcjs = require('./chunk-U4QSRBEV.cjs');
46
+ var _chunkOMGCVZ4Wcjs = require('./chunk-OMGCVZ4W.cjs');
47
47
 
48
48
  // src/ocr/ruling-lines.ts
49
49
  var INK_LUMA_MAX = 205;
@@ -390,8 +390,8 @@ var INKLESS_DELTA = 32;
390
390
  function restoreGlyphs(rgba, pageW, box, text, steps, stepPx, note = {}) {
391
391
  const chars = [...text];
392
392
  if (chars.length !== steps.length) return text;
393
- const gray = _chunkOJL4V7WLcjs.grayCrop.call(void 0, rgba, pageW, box);
394
- const c = { chars, cx: (i) => (steps[i] + 0.5) * stepPx, gray, w: box.w, h: box.h, ink: _chunkOJL4V7WLcjs.inkStats.call(void 0, gray) };
393
+ const gray = _chunkBUFGW3UJcjs.grayCrop.call(void 0, rgba, pageW, box);
394
+ const c = { chars, cx: (i) => (steps[i] + 0.5) * stepPx, gray, w: box.w, h: box.h, ink: _chunkBUFGW3UJcjs.inkStats.call(void 0, gray) };
395
395
  if (/[[\]]/.test(text)) brackets(c);
396
396
  if (text.includes("'")) cornerQuotes(c);
397
397
  if (/['"]/.test(text)) quotes(c);
@@ -409,7 +409,7 @@ function restoreGlyphs(rgba, pageW, box, text, steps, stepPx, note = {}) {
409
409
  function trimInklessEnds(rgba, pageW, box, text, steps, stepPx) {
410
410
  const chars = [...text], { w, h } = box;
411
411
  if (chars.length !== steps.length || steps.some((s) => (s + 0.5) * stepPx > w + stepPx)) return { text, steps };
412
- const gray = _chunkOJL4V7WLcjs.grayCrop.call(void 0, rgba, pageW, box);
412
+ const gray = _chunkBUFGW3UJcjs.grayCrop.call(void 0, rgba, pageW, box);
413
413
  const hist = new Uint32Array(256);
414
414
  for (const v of gray) hist[v]++;
415
415
  let bg = 0;
@@ -440,8 +440,8 @@ function cornerCommas({ chars, cx, gray, w, h, ink }) {
440
440
  continue;
441
441
  }
442
442
  if (open > 0) {
443
- const f = _chunkOJL4V7WLcjs.bracketFeatures.call(void 0, gray, w, h, ink, cx(i));
444
- if (f && _chunkOJL4V7WLcjs.bracketShape.call(void 0, f, true) === "\u300D") {
443
+ const f = _chunkBUFGW3UJcjs.bracketFeatures.call(void 0, gray, w, h, ink, cx(i));
444
+ if (f && _chunkBUFGW3UJcjs.bracketShape.call(void 0, f, true) === "\u300D") {
445
445
  chars[i] = "\u300D";
446
446
  open--;
447
447
  }
@@ -451,12 +451,12 @@ function cornerCommas({ chars, cx, gray, w, h, ink }) {
451
451
  function cornerQuotes({ chars, cx, gray, w, h, ink }) {
452
452
  for (let i = 0; i < chars.length; i++) {
453
453
  if (chars[i] !== "'" || !/^[가-힣]/.test(_nullishCoalesce(chars[i + 1], () => ( "")))) continue;
454
- const f = _chunkOJL4V7WLcjs.bracketFeatures.call(void 0, gray, w, h, ink, cx(i));
455
- if (!f || f.ch < f.charH * 0.45 || _chunkOJL4V7WLcjs.bracketShape.call(void 0, f, false) !== "\u300C") continue;
454
+ const f = _chunkBUFGW3UJcjs.bracketFeatures.call(void 0, gray, w, h, ink, cx(i));
455
+ if (!f || f.ch < f.charH * 0.45 || _chunkBUFGW3UJcjs.bracketShape.call(void 0, f, false) !== "\u300C") continue;
456
456
  const rest = chars.slice(i + 1), end = rest.findIndex((c) => c === "'" || c === "\u300D" || c === ",");
457
457
  const pair = end >= 0 && rest[end] !== "'" && (rest[end] === "\u300D" || (() => {
458
- const g = _chunkOJL4V7WLcjs.bracketFeatures.call(void 0, gray, w, h, ink, cx(i + 1 + end));
459
- return !!g && _chunkOJL4V7WLcjs.bracketShape.call(void 0, g, true) === "\u300D";
458
+ const g = _chunkBUFGW3UJcjs.bracketFeatures.call(void 0, gray, w, h, ink, cx(i + 1 + end));
459
+ return !!g && _chunkBUFGW3UJcjs.bracketShape.call(void 0, g, true) === "\u300D";
460
460
  })());
461
461
  if (pair) chars[i] = "\u300C";
462
462
  }
@@ -464,8 +464,8 @@ function cornerQuotes({ chars, cx, gray, w, h, ink }) {
464
464
  function brackets({ chars, cx, gray, w, h, ink }) {
465
465
  const shape = chars.map((c, i) => {
466
466
  if (c !== "[" && c !== "]") return null;
467
- const f = _chunkOJL4V7WLcjs.bracketFeatures.call(void 0, gray, w, h, ink, cx(i));
468
- return f && _chunkOJL4V7WLcjs.bracketShape.call(void 0, f, c === "]");
467
+ const f = _chunkBUFGW3UJcjs.bracketFeatures.call(void 0, gray, w, h, ink, cx(i));
468
+ return f && _chunkBUFGW3UJcjs.bracketShape.call(void 0, f, c === "]");
469
469
  });
470
470
  for (let i = 0; i < chars.length; i++) {
471
471
  if (chars[i] !== "[") continue;
@@ -497,7 +497,7 @@ function quotes({ chars, cx, gray, w, h, ink }) {
497
497
  continue;
498
498
  }
499
499
  if (!year(i) && !single[kind]) continue;
500
- const r = _chunkOJL4V7WLcjs.quoteHead.call(void 0, gray, w, h, ink, cx(i));
500
+ const r = _chunkBUFGW3UJcjs.quoteHead.call(void 0, gray, w, h, ink, cx(i));
501
501
  if (r !== null && r >= 0.47) {
502
502
  chars[i] = kind === "'" ? "\u2018" : "\u201C";
503
503
  open[kind] = true;
@@ -508,7 +508,7 @@ function dashes({ chars, cx, gray, w, h, ink }) {
508
508
  const head = chars.findIndex((c) => c.trim()), letters = chars.some((c) => /[가-힣A-Za-z]/.test(c));
509
509
  for (let i = 0; i < chars.length; i++) {
510
510
  if (!/^[-\u2013\u2014]$/.test(chars[i])) continue;
511
- const r = _chunkOJL4V7WLcjs.dashRatio.call(void 0, gray, w, h, ink, cx(i));
511
+ const r = _chunkBUFGW3UJcjs.dashRatio.call(void 0, gray, w, h, ink, cx(i));
512
512
  if (r === null) continue;
513
513
  if (r < 0.65) chars[i] = "-";
514
514
  else if (r > 0.75 && i === head && letters) chars[i] = "\u2014";
@@ -517,7 +517,7 @@ function dashes({ chars, cx, gray, w, h, ink }) {
517
517
  function circled({ chars, cx, gray, w, h, ink }) {
518
518
  const at = chars.flatMap((c, i) => /^[1-9]$/.test(c) && !/\d/.test(_nullishCoalesce(chars[i - 1], () => ( ""))) && !/\d/.test(_nullishCoalesce(chars[i + 1], () => ( ""))) ? [i] : []);
519
519
  if (!at.length) return;
520
- const hit = _chunkOJL4V7WLcjs.circledAt.call(void 0, gray, w, h, ink, at.map(cx));
520
+ const hit = _chunkBUFGW3UJcjs.circledAt.call(void 0, gray, w, h, ink, at.map(cx));
521
521
  at.forEach((i, k) => {
522
522
  if (hit[k]) chars[i] = String.fromCharCode(9311 + Number(chars[i]));
523
523
  });
@@ -527,16 +527,16 @@ function stars({ chars, cx, gray, w, h, ink }) {
527
527
  if (chars[i] !== "*" || chars[i - 1] === "*") continue;
528
528
  let e = i;
529
529
  while (chars[e + 1] === "*") e++;
530
- const n = _chunkOJL4V7WLcjs.starRun.call(void 0, gray, w, h, ink, cx(i));
530
+ const n = _chunkBUFGW3UJcjs.starRun.call(void 0, gray, w, h, ink, cx(i));
531
531
  if (n > e - i + 1 && n <= 4) chars[e] += "*".repeat(n - (e - i + 1));
532
532
  i = e;
533
533
  }
534
534
  }
535
535
  function discs({ chars, cx, gray, w, h, ink }) {
536
- for (let i = 0; i < chars.length; i++) if (/^[\u00b7\u2022]$/.test(chars[i]) && _chunkOJL4V7WLcjs.discAt.call(void 0, gray, w, h, ink, cx(i))) chars[i] = "\u25CF";
536
+ for (let i = 0; i < chars.length; i++) if (/^[\u00b7\u2022]$/.test(chars[i]) && _chunkBUFGW3UJcjs.discAt.call(void 0, gray, w, h, ink, cx(i))) chars[i] = "\u25CF";
537
537
  }
538
538
  function gaps({ chars, cx, gray, w, h, ink }) {
539
- const { glyphs, bandH } = _chunkOJL4V7WLcjs.gapGlyphs.call(void 0, gray, w, h, ink);
539
+ const { glyphs, bandH } = _chunkBUFGW3UJcjs.gapGlyphs.call(void 0, gray, w, h, ink);
540
540
  if (!glyphs.length) return;
541
541
  const live = chars.map((c, i) => i).filter((i) => chars[i].trim());
542
542
  if (!live.length) return;
@@ -607,18 +607,18 @@ function ring({ chars, cx, gray, w, h, ink }) {
607
607
  const rest = chars.slice(k + 1).join("").trimStart();
608
608
  const live = chars.map((c, i) => i).filter((i) => chars[i].trim());
609
609
  if (live.length <= 3 && live.every((i) => /^[Oo]$/.test(chars[i]))) {
610
- if (_optionalChain([_chunkOJL4V7WLcjs.leadingBullet.call(void 0, gray, w, h, ink, cx(live[0])), 'optionalAccess', _5 => _5.mark]) === "\u25CE") return false;
611
- if (!live.every((i) => _chunkOJL4V7WLcjs.ringBullet.call(void 0, gray, w, h, ink, cx(i)) === "\u25CB")) return false;
610
+ if (_optionalChain([_chunkBUFGW3UJcjs.leadingBullet.call(void 0, gray, w, h, ink, cx(live[0])), 'optionalAccess', _5 => _5.mark]) === "\u25CE") return false;
611
+ if (!live.every((i) => _chunkBUFGW3UJcjs.ringBullet.call(void 0, gray, w, h, ink, cx(i)) === "\u25CB")) return false;
612
612
  for (const i of live) chars[i] = "\u25CB";
613
613
  return true;
614
614
  }
615
615
  if (/^[A-Z]{2,}/.test(rest) && /^[Oo0]$/.test(chars[k])) {
616
- if (_chunkOJL4V7WLcjs.ringBullet.call(void 0, gray, w, h, ink, cx(k)) !== "\u25CB") return false;
616
+ if (_chunkBUFGW3UJcjs.ringBullet.call(void 0, gray, w, h, ink, cx(k)) !== "\u25CB") return false;
617
617
  chars[k] = chars[k + 1] === " " ? "\u25CB" : "\u25CB ";
618
618
  return true;
619
619
  }
620
620
  if (!/^[(\[「【<]?\d*[가-힣]/.test(rest)) return false;
621
- const r = _chunkOJL4V7WLcjs.ringBullet.call(void 0, gray, w, h, ink, cx(k));
621
+ const r = _chunkBUFGW3UJcjs.ringBullet.call(void 0, gray, w, h, ink, cx(k));
622
622
  if (/^[Cc]$/.test(chars[k]) && r !== "\u25CB") return false;
623
623
  if (r) chars[k] = r;
624
624
  return r !== null;
@@ -635,7 +635,7 @@ function parallels({ chars, cx, gray, w, h, ink }) {
635
635
  let p = s - 1, q = e + 1;
636
636
  while (p >= 0 && !chars[p].trim()) p--;
637
637
  while (q < chars.length && !chars[q].trim()) q++;
638
- if (_chunkOJL4V7WLcjs.slantedPair.call(void 0, gray, w, h, ink, p >= 0 ? cx(p) : -Infinity, q < chars.length ? cx(q) : Infinity)) {
638
+ if (_chunkBUFGW3UJcjs.slantedPair.call(void 0, gray, w, h, ink, p >= 0 ? cx(p) : -Infinity, q < chars.length ? cx(q) : Infinity)) {
639
639
  chars[s] = "\u2225";
640
640
  for (let k = s + 1; k <= e; k++) chars[k] = "";
641
641
  }
@@ -647,7 +647,7 @@ function roman({ chars, cx, gray, w, h, ink }) {
647
647
  const ROMAN = /^[IⅠ-Ⅲ]$/, LATIN = /[A-Za-z]$/;
648
648
  for (let i = 0; i < chars.length; i++) {
649
649
  if (chars[i] !== "1" || /[\dA-Za-z]$/.test(_nullishCoalesce(chars[i - 1], () => ( ""))) || /^[\dA-Za-z,]/.test(_nullishCoalesce(chars[i + 1], () => ( "")))) continue;
650
- if (_chunkOJL4V7WLcjs.serifOne.call(void 0, gray, w, h, ink, cx(i))) chars[i] = "\u2160";
650
+ if (_chunkBUFGW3UJcjs.serifOne.call(void 0, gray, w, h, ink, cx(i))) chars[i] = "\u2160";
651
651
  }
652
652
  for (let i = 0; i < chars.length; i++) {
653
653
  const hangul = /^[파피]$/.test(chars[i]);
@@ -657,13 +657,13 @@ function roman({ chars, cx, gray, w, h, ink }) {
657
657
  while (q < chars.length && !chars[q].trim()) q++;
658
658
  const glued = hangul ? chars[p] === "(" && chars[q] === "-" : /[가-힣]$/.test(_nullishCoalesce(chars[i - 1], () => ( ""))) || (_nullishCoalesce(chars[i + 1], () => ( ""))) === "." || chars[p] === "-" && chars[q] === "-";
659
659
  if (!glued) continue;
660
- const n = _chunkOJL4V7WLcjs.romanStems.call(void 0, gray, w, h, ink, p >= 0 ? cx(p) : -Infinity, q < chars.length ? cx(q) : Infinity, /[가-힣]$/.test(_nullishCoalesce(chars[p], () => ( ""))));
660
+ const n = _chunkBUFGW3UJcjs.romanStems.call(void 0, gray, w, h, ink, p >= 0 ? cx(p) : -Infinity, q < chars.length ? cx(q) : Infinity, /[가-힣]$/.test(_nullishCoalesce(chars[p], () => ( ""))));
661
661
  if (n) chars[i] = String.fromCharCode(8543 + n);
662
662
  }
663
663
  const inRoman = (i) => ROMAN.test(chars[i]) || chars[i] === "1" && (ROMAN.test(_nullishCoalesce(chars[i - 1], () => ( ""))) || ROMAN.test(_nullishCoalesce(chars[i + 1], () => ( ""))));
664
664
  const k = chars.findIndex((c) => c.trim());
665
665
  if (chars[k] === "." && chars.slice(k + 1).some((c) => /[가-힣A-Za-z0-9]/.test(c))) {
666
- const n = _chunkOJL4V7WLcjs.romanStems.call(void 0, gray, w, h, ink, -Infinity, cx(k));
666
+ const n = _chunkBUFGW3UJcjs.romanStems.call(void 0, gray, w, h, ink, -Infinity, cx(k));
667
667
  if (n) chars[k] = String.fromCharCode(8543 + n) + chars[k];
668
668
  }
669
669
  for (let s = 0; s < chars.length; ) {
@@ -681,7 +681,7 @@ function roman({ chars, cx, gray, w, h, ink }) {
681
681
  let p = s - 1, q = e;
682
682
  while (p >= 0 && !chars[p].trim()) p--;
683
683
  while (q < chars.length && !chars[q].trim()) q++;
684
- const n = _chunkOJL4V7WLcjs.romanStems.call(void 0, gray, w, h, ink, p >= 0 ? cx(p) : -Infinity, q < chars.length ? cx(q) : Infinity, /[가-힣]$/.test(_nullishCoalesce(chars[p], () => ( ""))));
684
+ const n = _chunkBUFGW3UJcjs.romanStems.call(void 0, gray, w, h, ink, p >= 0 ? cx(p) : -Infinity, q < chars.length ? cx(q) : Infinity, /[가-힣]$/.test(_nullishCoalesce(chars[p], () => ( ""))));
685
685
  const canon = n ? [["\u2160", "I"], ["\u2161", "II"], ["\u2162", "III"]][n - 1] : null;
686
686
  if (canon && !canon.includes(tok)) {
687
687
  chars[s] = canon[0];
@@ -1056,8 +1056,8 @@ function joinGapLeaders(rgba, width, items) {
1056
1056
  if (g1 - g0 < h * 3) continue;
1057
1057
  const pad = Math.round(h * 0.25), y = Math.max(0, Math.min(left.y, num.y) - pad), x = Math.max(0, Math.round(g0 - h));
1058
1058
  const box = { x, y, w: Math.min(width, Math.round(g1 + h)) - x, h: Math.min(Math.floor(rgba.length / 4 / width), Math.max(left.y + left.h, num.y + num.h) + pad) - y };
1059
- const gray = _chunkOJL4V7WLcjs.grayCrop.call(void 0, rgba, width, box);
1060
- const runs = _chunkOJL4V7WLcjs.leaderRuns.call(void 0, gray, box.w, box.h, _chunkOJL4V7WLcjs.inkStats.call(void 0, gray), LEADER_MIN_DOTS);
1059
+ const gray = _chunkBUFGW3UJcjs.grayCrop.call(void 0, rgba, width, box);
1060
+ const runs = _chunkBUFGW3UJcjs.leaderRuns.call(void 0, gray, box.w, box.h, _chunkBUFGW3UJcjs.inkStats.call(void 0, gray), LEADER_MIN_DOTS);
1061
1061
  const cover = runs.reduce((k, [a, b]) => k + Math.max(0, Math.min(b, g1 - box.x) - Math.max(a, g0 - box.x)), 0);
1062
1062
  if (cover < (g1 - g0) * 0.6) continue;
1063
1063
  for (const o of items) if (junk(o) && sameLine(o, num) && o.x >= g0 - 2 && o.x + o.w <= g1 + 2) gone.add(o);
@@ -1324,7 +1324,7 @@ var OcrEngine = class _OcrEngine {
1324
1324
  this.ort = parts.ort;
1325
1325
  this.sharp = parts.sharp;
1326
1326
  }
1327
- static async create(models = _chunkOJL4V7WLcjs.DEFAULT_OCR_MODELS) {
1327
+ static async create(models = _chunkBUFGW3UJcjs.DEFAULT_OCR_MODELS) {
1328
1328
  _chunkTK3FDAEEcjs.disableOrtTelemetry.call(void 0, );
1329
1329
  const [ortMod, sharpModRaw] = await Promise.all([
1330
1330
  tryImport("onnxruntime-node", () => Promise.resolve().then(() => _interopRequireWildcard(require("onnxruntime-node")))),
@@ -1344,16 +1344,16 @@ var OcrEngine = class _OcrEngine {
1344
1344
  const local = (s) => "spec" in s ? Promise.resolve(null) : verifiedBytes(s);
1345
1345
  const [detBytes, recBytes, dictBytes] = await Promise.all([local(models.det), local(models.rec), local(models.dict)]);
1346
1346
  const session = (s, bytes) => bytes ? ortMod.InferenceSession.create(bytes, sessionOpts).catch(() => {
1347
- throw new (0, _chunkU4QSRBEVcjs.KordocError)(`OCR \uBAA8\uB378\uC744 \uC5F4\uC9C0 \uBABB\uD588\uC2B5\uB2C8\uB2E4: ${_path.basename.call(void 0, _chunkOJL4V7WLcjs.ocrSourcePath.call(void 0, s))} \u2014 ONNX \uBAA8\uB378\uC774 \uC544\uB2C8\uAC70\uB098 \uC190\uC0C1\uB410\uC2B5\uB2C8\uB2E4`);
1348
- }) : ortMod.InferenceSession.create(_chunkOJL4V7WLcjs.ocrSourcePath.call(void 0, s), sessionOpts);
1347
+ throw new (0, _chunkOMGCVZ4Wcjs.KordocError)(`OCR \uBAA8\uB378\uC744 \uC5F4\uC9C0 \uBABB\uD588\uC2B5\uB2C8\uB2E4: ${_path.basename.call(void 0, _chunkBUFGW3UJcjs.ocrSourcePath.call(void 0, s))} \u2014 ONNX \uBAA8\uB378\uC774 \uC544\uB2C8\uAC70\uB098 \uC190\uC0C1\uB410\uC2B5\uB2C8\uB2E4`);
1348
+ }) : ortMod.InferenceSession.create(_chunkBUFGW3UJcjs.ocrSourcePath.call(void 0, s), sessionOpts);
1349
1349
  const [det, rec, dictYml] = await Promise.all([
1350
1350
  session(models.det, detBytes),
1351
1351
  session(models.rec, recBytes),
1352
- dictBytes ? new TextDecoder().decode(dictBytes) : _promises.readFile.call(void 0, _chunkOJL4V7WLcjs.ocrSourcePath.call(void 0, models.dict), "utf-8")
1352
+ dictBytes ? new TextDecoder().decode(dictBytes) : _promises.readFile.call(void 0, _chunkBUFGW3UJcjs.ocrSourcePath.call(void 0, models.dict), "utf-8")
1353
1353
  ]);
1354
- const dict = _chunkOJL4V7WLcjs.parseCharacterDict.call(void 0, dictYml);
1354
+ const dict = _chunkBUFGW3UJcjs.parseCharacterDict.call(void 0, dictYml);
1355
1355
  if (dict.length === 0) {
1356
- throw "spec" in models.dict ? new Error("OCR \uC0AC\uC804 \uD30C\uC2F1 \uC2E4\uD328 \u2014 \uBAA8\uB378 \uCE90\uC2DC\uB97C \uC0AD\uC81C \uD6C4 \uC7AC\uB2E4\uC6B4\uB85C\uB4DC\uD558\uC138\uC694") : new (0, _chunkU4QSRBEVcjs.KordocError)(`OCR \uC0AC\uC804 \uD30C\uC2F1 \uC2E4\uD328 \u2014 ${_path.basename.call(void 0, models.dict.file.path)} \uC5D0 PostProcess.character_dict \uBAA9\uB85D\uC774 \uC5C6\uC2B5\uB2C8\uB2E4`);
1356
+ throw "spec" in models.dict ? new Error("OCR \uC0AC\uC804 \uD30C\uC2F1 \uC2E4\uD328 \u2014 \uBAA8\uB378 \uCE90\uC2DC\uB97C \uC0AD\uC81C \uD6C4 \uC7AC\uB2E4\uC6B4\uB85C\uB4DC\uD558\uC138\uC694") : new (0, _chunkOMGCVZ4Wcjs.KordocError)(`OCR \uC0AC\uC804 \uD30C\uC2F1 \uC2E4\uD328 \u2014 ${_path.basename.call(void 0, models.dict.file.path)} \uC5D0 PostProcess.character_dict \uBAA9\uB85D\uC774 \uC5C6\uC2B5\uB2C8\uB2E4`);
1357
1357
  }
1358
1358
  return new _OcrEngine({ det, rec, dict, ort: ortMod, sharp: sharpMod });
1359
1359
  }
@@ -1385,10 +1385,10 @@ var OcrEngine = class _OcrEngine {
1385
1385
  if (it.x - x < it.h * 0.8) return;
1386
1386
  if (items.some((o) => o !== it && o.x < it.x && o.x + o.w > x && o.y < it.y + it.h && o.y + o.h > it.y)) return;
1387
1387
  const box = { x, y: it.y, w: it.x + it.w - x, h: it.h };
1388
- const g = _chunkOJL4V7WLcjs.grayCrop.call(void 0, rgba, width, box);
1389
- const b = _chunkOJL4V7WLcjs.leadingBullet.call(void 0, g, box.w, box.h, _chunkOJL4V7WLcjs.inkStats.call(void 0, g), it.x - x, 1.05);
1388
+ const g = _chunkBUFGW3UJcjs.grayCrop.call(void 0, rgba, width, box);
1389
+ const b = _chunkBUFGW3UJcjs.leadingBullet.call(void 0, g, box.w, box.h, _chunkBUFGW3UJcjs.inkStats.call(void 0, g), it.x - x, 1.05);
1390
1390
  if (_optionalChain([b, 'optionalAccess', _30 => _30.mark]) !== "\u25A1" || b.covers) return;
1391
- const ink = _chunkOJL4V7WLcjs.inkStats.call(void 0, g), on = (v) => ink.darkInk ? v <= ink.threshold : v > ink.threshold;
1391
+ const ink = _chunkBUFGW3UJcjs.inkStats.call(void 0, g), on = (v) => ink.darkInk ? v <= ink.threshold : v > ink.threshold;
1392
1392
  let left = 0;
1393
1393
  while (left < it.x - x && !Array.from({ length: box.h }, (_, y) => g[y * box.w + left]).some(on)) left++;
1394
1394
  it.text = "\u25A1 " + it.text;
@@ -1405,12 +1405,12 @@ var OcrEngine = class _OcrEngine {
1405
1405
  const joins = [];
1406
1406
  let group = 0;
1407
1407
  for (const b of boxes) {
1408
- const gray = _chunkOJL4V7WLcjs.grayCrop.call(void 0, rgba, width, b);
1409
- const ink = _chunkOJL4V7WLcjs.inkStats.call(void 0, gray);
1408
+ const gray = _chunkBUFGW3UJcjs.grayCrop.call(void 0, rgba, width, b);
1409
+ const ink = _chunkBUFGW3UJcjs.inkStats.call(void 0, gray);
1410
1410
  if (tuning.minInkContrast > 0 && ink.contrast < tuning.minInkContrast) continue;
1411
1411
  if (tuning.minInkContrast > 0 && ink.inkRatio < MIN_INK_RATIO) continue;
1412
1412
  if (tuning.splitTall && b.h >= b.w * TALL_RATIO) {
1413
- const bands = _chunkOJL4V7WLcjs.splitRowBands.call(void 0, gray, b.w, b.h, ink, 0.45);
1413
+ const bands = _chunkBUFGW3UJcjs.splitRowBands.call(void 0, gray, b.w, b.h, ink, 0.45);
1414
1414
  if (bands.length >= 2) {
1415
1415
  for (const sub of bandBoxes(b, bands, height)) jobs.push({ box: sub, rot: 0, group: group++ });
1416
1416
  continue;
@@ -1421,9 +1421,9 @@ var OcrEngine = class _OcrEngine {
1421
1421
  continue;
1422
1422
  }
1423
1423
  }
1424
- const trim = tuning.trimEdges ? _chunkOJL4V7WLcjs.edgeTrim.call(void 0, gray, b.w, b.h, ink) : null;
1424
+ const trim = tuning.trimEdges ? _chunkBUFGW3UJcjs.edgeTrim.call(void 0, gray, b.w, b.h, ink) : null;
1425
1425
  const keep = trim ? { ...trim, bg: median(gray) } : void 0;
1426
- const leaders = tuning.splitLeaders ? _chunkOJL4V7WLcjs.leaderRuns.call(void 0, gray, b.w, b.h, ink, LEADER_MIN_DOTS) : [];
1426
+ const leaders = tuning.splitLeaders ? _chunkBUFGW3UJcjs.leaderRuns.call(void 0, gray, b.w, b.h, ink, LEADER_MIN_DOTS) : [];
1427
1427
  if (leaders.length) {
1428
1428
  const join = joins.length;
1429
1429
  joins.push({ box: b, parts: [], trailDots: false });
@@ -1432,7 +1432,7 @@ var OcrEngine = class _OcrEngine {
1432
1432
  const bare = { x: b.x + x0, y: b.y, w: a - x0, h: b.h };
1433
1433
  const end = c > a ? Math.min(c, a + Math.round(b.h * LEADER_CONTEXT)) : a;
1434
1434
  x0 = c;
1435
- if (bare.w >= DET_MIN_SIZE && _chunkOJL4V7WLcjs.inkStats.call(void 0, _chunkOJL4V7WLcjs.grayCrop.call(void 0, rgba, width, bare)).contrast >= Math.max(1, tuning.minInkContrast)) {
1435
+ if (bare.w >= DET_MIN_SIZE && _chunkBUFGW3UJcjs.inkStats.call(void 0, _chunkBUFGW3UJcjs.grayCrop.call(void 0, rgba, width, bare)).contrast >= Math.max(1, tuning.minInkContrast)) {
1436
1436
  jobs.push({ box: { ...bare, w: end - (bare.x - b.x) }, rot: 0, group: group++, join, dotsBefore: dots, trimDots: end > a });
1437
1437
  dots = false;
1438
1438
  }
@@ -1470,15 +1470,15 @@ var OcrEngine = class _OcrEngine {
1470
1470
  let text = tuning.postprocess ? restoreSymbols(raw.trim(), note.ringLead) : raw;
1471
1471
  if (!text.trim()) continue;
1472
1472
  if (tuning.postprocess && job.rot === 0 && text !== "/" && /^[(:;/)]+$/.test(text) && text.includes("/")) {
1473
- const g = _chunkOJL4V7WLcjs.grayCrop.call(void 0, rgba, width, job.box);
1474
- if (_chunkOJL4V7WLcjs.tallInkCount.call(void 0, g, job.box.w, job.box.h, _chunkOJL4V7WLcjs.inkStats.call(void 0, g)) === 1) text = "/";
1473
+ const g = _chunkBUFGW3UJcjs.grayCrop.call(void 0, rgba, width, job.box);
1474
+ if (_chunkBUFGW3UJcjs.tallInkCount.call(void 0, g, job.box.w, job.box.h, _chunkBUFGW3UJcjs.inkStats.call(void 0, g)) === 1) text = "/";
1475
1475
  }
1476
1476
  let ringByShape = false;
1477
1477
  if (tuning.postprocess && job.rot === 0 && !/^[◎●▪□■▣❐❏○ㅇ◆◇◈]/.test(text)) {
1478
1478
  const chars = [...read], k = chars.findIndex((c) => c.trim());
1479
1479
  if (k >= 0 && steps.length === chars.length) {
1480
- const g = _chunkOJL4V7WLcjs.grayCrop.call(void 0, rgba, width, job.box);
1481
- const b = _chunkOJL4V7WLcjs.leadingBullet.call(void 0, g, job.box.w, job.box.h, _chunkOJL4V7WLcjs.inkStats.call(void 0, g), (steps[k] + 0.5) * stepPx);
1480
+ const g = _chunkBUFGW3UJcjs.grayCrop.call(void 0, rgba, width, job.box);
1481
+ const b = _chunkBUFGW3UJcjs.leadingBullet.call(void 0, g, job.box.w, job.box.h, _chunkBUFGW3UJcjs.inkStats.call(void 0, g), (steps[k] + 0.5) * stepPx);
1482
1482
  const body = (_nullishCoalesce(text.match(/[가-힣]/g), () => ( []))).length >= 4;
1483
1483
  const miss = /^[Oo0•·ㆍ∙‧○]/.test(text);
1484
1484
  if (_optionalChain([b, 'optionalAccess', _31 => _31.mark]) === "\u25CE" && b.covers && /^[Oo0○©]/.test(text)) {
@@ -1493,17 +1493,17 @@ var OcrEngine = class _OcrEngine {
1493
1493
  } else if (_optionalChain([b, 'optionalAccess', _38 => _38.mark]) === "\u2750" || _optionalChain([b, 'optionalAccess', _39 => _39.mark]) === "\u274F") {
1494
1494
  if (b.covers ? /^[ㅁ口]/.test(text) : body) text = b.covers ? b.mark + text.slice(1) : b.mark + " " + text;
1495
1495
  } else if (b && b.mark !== "\u25CE" && body) text = b.covers ? miss ? b.mark + " " + text.slice(1).trimStart() : text : b.mark + " " + text;
1496
- else if (!b && body && /^[가-힣]/.test(chars[k]) && _chunkOJL4V7WLcjs.leadingRing.call(void 0, g, job.box.w, job.box.h, _chunkOJL4V7WLcjs.inkStats.call(void 0, g), (steps[k] + 0.5) * stepPx)) text = "\u25CB " + text;
1496
+ else if (!b && body && /^[가-힣]/.test(chars[k]) && _chunkBUFGW3UJcjs.leadingRing.call(void 0, g, job.box.w, job.box.h, _chunkBUFGW3UJcjs.inkStats.call(void 0, g), (steps[k] + 0.5) * stepPx)) text = "\u25CB " + text;
1497
1497
  }
1498
1498
  }
1499
1499
  if (tuning.postprocess && /^\d/.test(text) && job.rot === 0) {
1500
- const g = _chunkOJL4V7WLcjs.grayCrop.call(void 0, rgba, width, job.box);
1501
- const tri = _chunkOJL4V7WLcjs.leadingTriangle.call(void 0, g, job.box.w, job.box.h, _chunkOJL4V7WLcjs.inkStats.call(void 0, g));
1500
+ const g = _chunkBUFGW3UJcjs.grayCrop.call(void 0, rgba, width, job.box);
1501
+ const tri = _chunkBUFGW3UJcjs.leadingTriangle.call(void 0, g, job.box.w, job.box.h, _chunkBUFGW3UJcjs.inkStats.call(void 0, g));
1502
1502
  if (tri) text = tri + text;
1503
1503
  }
1504
1504
  if (tuning.postprocess && text === "\u2192" && job.rot === 0 && job.join === void 0) {
1505
- const g = _chunkOJL4V7WLcjs.grayCrop.call(void 0, rgba, width, job.box);
1506
- text = _nullishCoalesce(_chunkOJL4V7WLcjs.arrowGlyph.call(void 0, g, job.box.w, job.box.h, _chunkOJL4V7WLcjs.inkStats.call(void 0, g)), () => ( text));
1505
+ const g = _chunkBUFGW3UJcjs.grayCrop.call(void 0, rgba, width, job.box);
1506
+ text = _nullishCoalesce(_chunkBUFGW3UJcjs.arrowGlyph.call(void 0, g, job.box.w, job.box.h, _chunkBUFGW3UJcjs.inkStats.call(void 0, g)), () => ( text));
1507
1507
  }
1508
1508
  if (job.footer) {
1509
1509
  if (!/^[-\u2013\u2014]?\s*(?:\d{1,4}|[ivxIVXⅰ-ⅹⅠ-Ⅹ]{1,4})\s*[-\u2013\u2014]?$/.test(text.trim())) continue;
@@ -1524,14 +1524,14 @@ var OcrEngine = class _OcrEngine {
1524
1524
  continue;
1525
1525
  }
1526
1526
  const item = { text, ...this.itemBox(rgba, width, job.box, tuning), confidence };
1527
- if (job.rot === 0) _chunkOJL4V7WLcjs.rememberOcrTextGaps.call(void 0, item, _chunkOJL4V7WLcjs.findOcrTextGaps.call(void 0, rgba, width, job.box, read, text, steps, stepPx));
1527
+ if (job.rot === 0) _chunkBUFGW3UJcjs.rememberOcrTextGaps.call(void 0, item, _chunkBUFGW3UJcjs.findOcrTextGaps.call(void 0, rgba, width, job.box, read, text, steps, stepPx));
1528
1528
  items.push(item);
1529
1529
  }
1530
1530
  if (retry.length) {
1531
1531
  const subs = [];
1532
1532
  for (const b of retry) {
1533
- const gray = _chunkOJL4V7WLcjs.grayCrop.call(void 0, rgba, width, b);
1534
- const cut = midBlankRow(gray, b.w, b.h, _chunkOJL4V7WLcjs.inkStats.call(void 0, gray));
1533
+ const gray = _chunkBUFGW3UJcjs.grayCrop.call(void 0, rgba, width, b);
1534
+ const cut = midBlankRow(gray, b.w, b.h, _chunkBUFGW3UJcjs.inkStats.call(void 0, gray));
1535
1535
  if (cut && b.w >= 3 * Math.max(cut[0], b.h - cut[1])) subs.push({ ...b, h: cut[0] }, { ...b, y: b.y + cut[1], h: b.h - cut[1] });
1536
1536
  }
1537
1537
  const overlap = (a, o) => Math.max(0, Math.min(a.x + a.w, o.x + o.w) - Math.max(a.x, o.x)) * Math.max(0, Math.min(a.y + a.h, o.y + o.h) - Math.max(a.y, o.y));
@@ -1594,8 +1594,8 @@ var OcrEngine = class _OcrEngine {
1594
1594
  /** 결과 좌표 — det 박스 그대로 또는 박스 안 잉크 외곽 (tightBoxes) */
1595
1595
  itemBox(rgba, width, b, tuning) {
1596
1596
  if (!tuning.tightBoxes) return b;
1597
- const gray = _chunkOJL4V7WLcjs.grayCrop.call(void 0, rgba, width, b);
1598
- const t = _chunkOJL4V7WLcjs.inkBounds.call(void 0, gray, b.w, b.h, _chunkOJL4V7WLcjs.inkStats.call(void 0, gray));
1597
+ const gray = _chunkBUFGW3UJcjs.grayCrop.call(void 0, rgba, width, b);
1598
+ const t = _chunkBUFGW3UJcjs.inkBounds.call(void 0, gray, b.w, b.h, _chunkBUFGW3UJcjs.inkStats.call(void 0, gray));
1599
1599
  return { x: b.x + t.x0, y: b.y + t.y0, w: t.x1 - t.x0, h: t.y1 - t.y0 };
1600
1600
  }
1601
1601
  // ─── det ─────────────────────────────────────────────
@@ -1668,7 +1668,7 @@ var OcrEngine = class _OcrEngine {
1668
1668
  const out = await this.rec.run({ [this.rec.inputNames[0]]: tensor });
1669
1669
  const logits = out[this.rec.outputNames[0]];
1670
1670
  const [, T, C] = logits.dims;
1671
- if (C !== this.dict.length + 2) throw new (0, _chunkU4QSRBEVcjs.KordocError)(`OCR rec \uCD9C\uB825 \uD074\uB798\uC2A4 ${C}\uAC1C\uAC00 \uC0AC\uC804 ${this.dict.length}\uC790 + 2 \uC640 \uB2E4\uB985\uB2C8\uB2E4 \u2014 \uBAA8\uB378\uC5D0 \uB9DE\uB294 \uC0AC\uC804(ocrRecDict)\uC744 \uC9C0\uC815\uD558\uC138\uC694`);
1671
+ if (C !== this.dict.length + 2) throw new (0, _chunkOMGCVZ4Wcjs.KordocError)(`OCR rec \uCD9C\uB825 \uD074\uB798\uC2A4 ${C}\uAC1C\uAC00 \uC0AC\uC804 ${this.dict.length}\uC790 + 2 \uC640 \uB2E4\uB985\uB2C8\uB2E4 \u2014 \uBAA8\uB378\uC5D0 \uB9DE\uB294 \uC0AC\uC804(ocrRecDict)\uC744 \uC9C0\uC815\uD558\uC138\uC694`);
1672
1672
  const data = logits.data;
1673
1673
  idx.forEach((ci, k) => {
1674
1674
  const r = ctcDecode(data.subarray(k * T * C, (k + 1) * T * C), T, C, this.dict);
@@ -1678,9 +1678,9 @@ var OcrEngine = class _OcrEngine {
1678
1678
  const chars = r ? [...r.text] : [];
1679
1679
  if (r && job.rot === 0 && chars.length === r.steps.length && r.steps.some((t) => t > last) && !r.text.includes("(cid:")) {
1680
1680
  const tallCh = (c) => !/[\s.,:;\u00b7\u2026'"\u2018-\u201d`\-_~]/.test(c);
1681
- const g = _chunkOJL4V7WLcjs.grayCrop.call(void 0, rgba, pageW, job.box);
1681
+ const g = _chunkBUFGW3UJcjs.grayCrop.call(void 0, rgba, pageW, job.box);
1682
1682
  const inside = chars.filter((c, i) => r.steps[i] <= last && tallCh(c)).length;
1683
- let budget = inside <= 2 ? _chunkOJL4V7WLcjs.tallInkCount.call(void 0, g, job.box.w, job.box.h, _chunkOJL4V7WLcjs.inkStats.call(void 0, g)) - inside : Infinity;
1683
+ let budget = inside <= 2 ? _chunkBUFGW3UJcjs.tallInkCount.call(void 0, g, job.box.w, job.box.h, _chunkBUFGW3UJcjs.inkStats.call(void 0, g)) - inside : Infinity;
1684
1684
  const keep = chars.map((c, i) => r.steps[i] <= last || !tallCh(c) || budget-- > 0);
1685
1685
  if (!keep.every(Boolean)) kept = { ...r, text: chars.filter((_, i) => keep[i]).join(""), steps: r.steps.filter((_, i) => keep[i]) };
1686
1686
  }
@@ -1791,13 +1791,13 @@ async function tryImport(name, loader) {
1791
1791
  return await loader();
1792
1792
  } catch (e) {
1793
1793
  throw new Error(
1794
- `\uB0B4\uC7A5 OCR \uC744 \uC0AC\uC6A9\uD558\uB824\uBA74 optional dependency '${name}' \uC774 \uD544\uC694\uD569\uB2C8\uB2E4. \`npm install ${name}\` \uD6C4 \uB2E4\uC2DC \uC2E4\uD589\uD558\uC138\uC694.${_chunkU4QSRBEVcjs.OPTIONAL_DEP_INSTALL_HINT} \uC6D0\uC778: ${e.message}`
1794
+ `\uB0B4\uC7A5 OCR \uC744 \uC0AC\uC6A9\uD558\uB824\uBA74 optional dependency '${name}' \uC774 \uD544\uC694\uD569\uB2C8\uB2E4. \`npm install ${name}\` \uD6C4 \uB2E4\uC2DC \uC2E4\uD589\uD558\uC138\uC694.${_chunkOMGCVZ4Wcjs.OPTIONAL_DEP_INSTALL_HINT} \uC6D0\uC778: ${e.message}`
1795
1795
  );
1796
1796
  }
1797
1797
  }
1798
1798
  async function verifiedBytes(s) {
1799
1799
  const name = _path.basename.call(void 0, s.file.path);
1800
- const fail = (why2) => new (0, _chunkU4QSRBEVcjs.KordocError)(`OCR \uBAA8\uB378 \uD30C\uC77C\uC744 \uC77D\uC9C0 \uBABB\uD588\uC2B5\uB2C8\uB2E4: ${name} (${why2})`);
1800
+ const fail = (why2) => new (0, _chunkOMGCVZ4Wcjs.KordocError)(`OCR \uBAA8\uB378 \uD30C\uC77C\uC744 \uC77D\uC9C0 \uBABB\uD588\uC2B5\uB2C8\uB2E4: ${name} (${why2})`);
1801
1801
  const why = (e) => {
1802
1802
  const code = e.code;
1803
1803
  return code === "ENOENT" ? "\uD30C\uC77C\uC774 \uC5C6\uC74C" : code === "EACCES" || code === "EPERM" ? "\uAD8C\uD55C \uC5C6\uC74C" : "\uC77D\uAE30 \uC2E4\uD328";
@@ -1818,13 +1818,13 @@ async function verifiedBytes(s) {
1818
1818
  }
1819
1819
  const actual = _crypto.createHash.call(void 0, "sha256").update(bytes).digest("hex");
1820
1820
  if (actual !== s.file.sha256) {
1821
- throw new (0, _chunkU4QSRBEVcjs.KordocError)(`OCR \uBAA8\uB378 SHA256 mismatch: ${_path.basename.call(void 0, s.file.path)} \u2014 expected ${s.file.sha256}, got ${actual} (\uB85C\uB4DC \uAC70\uBD80)`);
1821
+ throw new (0, _chunkOMGCVZ4Wcjs.KordocError)(`OCR \uBAA8\uB378 SHA256 mismatch: ${_path.basename.call(void 0, s.file.path)} \u2014 expected ${s.file.sha256}, got ${actual} (\uB85C\uB4DC \uAC70\uBD80)`);
1822
1822
  }
1823
1823
  return bytes;
1824
1824
  }
1825
1825
  var engines = /* @__PURE__ */ new Map();
1826
- function getOcrEngine(models = _chunkOJL4V7WLcjs.DEFAULT_OCR_MODELS) {
1827
- const key = _chunkOJL4V7WLcjs.ocrSelectionKey.call(void 0, models);
1826
+ function getOcrEngine(models = _chunkBUFGW3UJcjs.DEFAULT_OCR_MODELS) {
1827
+ const key = _chunkBUFGW3UJcjs.ocrSelectionKey.call(void 0, models);
1828
1828
  let p = engines.get(key);
1829
1829
  if (!p) {
1830
1830
  p = OcrEngine.create(models).catch((err) => {
@@ -1927,13 +1927,13 @@ function rotateRgba(rgba, width, height, deg) {
1927
1927
  var OCR_RENDER_SCALE = 3;
1928
1928
  var MAX_OCR_PIXELS = 24e6;
1929
1929
  var PAGE_TIMEOUT_MS = 12e4;
1930
- var DEFAULT_BUILTIN_OCR = Object.freeze({ models: _chunkOJL4V7WLcjs.DEFAULT_OCR_MODELS, tuning: DEFAULT_OCR_TUNING });
1930
+ var DEFAULT_BUILTIN_OCR = Object.freeze({ models: _chunkBUFGW3UJcjs.DEFAULT_OCR_MODELS, tuning: DEFAULT_OCR_TUNING });
1931
1931
  function builtinOcrConfig(o) {
1932
1932
  if (!o || o.ocrDet === void 0 && o.ocrDetLongSide === void 0 && o.ocrRec === void 0 && o.ocrRecDict === void 0 && !o.ocrLines) return DEFAULT_BUILTIN_OCR;
1933
- const bad = _chunkXQJNL7TDcjs.validateOcrOptions.call(void 0, o);
1934
- if (bad) throw new (0, _chunkU4QSRBEVcjs.KordocError)(bad);
1933
+ const bad = _chunkB5M676H3cjs.validateOcrOptions.call(void 0, o);
1934
+ if (bad) throw new (0, _chunkOMGCVZ4Wcjs.KordocError)(bad);
1935
1935
  return {
1936
- models: _chunkOJL4V7WLcjs.resolveOcrModels.call(void 0, o),
1936
+ models: _chunkBUFGW3UJcjs.resolveOcrModels.call(void 0, o),
1937
1937
  tuning: o.ocrDetLongSide === void 0 ? DEFAULT_OCR_TUNING : { ...DEFAULT_OCR_TUNING, detLongSide: o.ocrDetLongSide },
1938
1938
  lines: o.ocrLines === "all" ? "all" : o.ocrLines ? "kept" : void 0
1939
1939
  };
@@ -1967,7 +1967,7 @@ async function runPdfOcr(buffer, targets, mode, warnings, onProgress, detectTabl
1967
1967
  "@hyzyla/pdfium",
1968
1968
  () => Promise.resolve().then(() => _interopRequireWildcard(require("@hyzyla/pdfium")))
1969
1969
  );
1970
- if (mode === "builtin") await _chunkOJL4V7WLcjs.ensureOcrModelsFor.call(void 0, config.models, reportModelDownload);
1970
+ if (mode === "builtin") await _chunkBUFGW3UJcjs.ensureOcrModelsFor.call(void 0, config.models, reportModelDownload);
1971
1971
  const engine = mode === "builtin" ? await getOcrEngine(config.models) : null;
1972
1972
  const pdfium = await pdfiumMod.PDFiumLibrary.init();
1973
1973
  const doc = await pdfium.loadDocument(new Uint8Array(buffer));
@@ -2059,7 +2059,7 @@ async function ocrOnePage(page, pageNo, mode, engine, warnings, detectTables, ve
2059
2059
  const x1 = r.x1 * scale - 2, x2 = r.x2 * scale + 2, y1 = (pdfH - r.y2) * scale - 2, y2 = (pdfH - r.y1) * scale + 2;
2060
2060
  const columnRules = _nullishCoalesce(_optionalChain([ruling, 'optionalAccess', _63 => _63.verticals, 'access', _64 => _64.filter, 'call', _65 => _65((s) => Math.min(s.x1, s.x2) >= x1 && Math.max(s.x1, s.x2) <= x2 && Math.min(s.y1, s.y2) >= y1 && Math.max(s.y1, s.y2) <= y2), 'access', _66 => _66.length]), () => ( 0));
2061
2061
  if (columnRules < 2) {
2062
- for (const b of blocks) if (b.type === "table") _chunkOJL4V7WLcjs.UNRULED_REGION_TABLES.add(b);
2062
+ for (const b of blocks) if (b.type === "table") _chunkBUFGW3UJcjs.UNRULED_REGION_TABLES.add(b);
2063
2063
  }
2064
2064
  return blocks;
2065
2065
  });
@@ -2118,7 +2118,7 @@ async function closerReads(rgba, rw, rh, pdfH, hi, regions, engine, tuning = REG
2118
2118
  const items = await engine.recognizePage(crop, cw, ch, void 0, tuning);
2119
2119
  out.push(items.map((it) => {
2120
2120
  const placed = { ...it, x: (it.x + x0) / 2, y: (it.y + y0) / 2, w: it.w / 2, h: it.h / 2 };
2121
- _chunkOJL4V7WLcjs.copyOcrTextGaps.call(void 0, it, placed, 0.5, x0 / 2);
2121
+ _chunkBUFGW3UJcjs.copyOcrTextGaps.call(void 0, it, placed, 0.5, x0 / 2);
2122
2122
  return placed;
2123
2123
  }));
2124
2124
  }
@@ -2198,17 +2198,17 @@ function ocrItemsToBlocks(items, pageNumber, pdfW, pdfH, scale, extraLines, dete
2198
2198
  isHidden: false,
2199
2199
  ...xs[i].space ? { hasSpaceBefore: true } : {}
2200
2200
  };
2201
- _chunkOJL4V7WLcjs.copyOcrTextGaps.call(void 0, it, normalized, 1 / scale);
2201
+ _chunkBUFGW3UJcjs.copyOcrTextGaps.call(void 0, it, normalized, 1 / scale);
2202
2202
  return normalized;
2203
2203
  });
2204
- return _chunkOJL4V7WLcjs.extractPageBlocksWithLines.call(void 0, norm, pageNumber, opList, pdfW, pdfH, extraLines, detectTables);
2204
+ return _chunkBUFGW3UJcjs.extractPageBlocksWithLines.call(void 0, norm, pageNumber, opList, pdfW, pdfH, extraLines, detectTables);
2205
2205
  }
2206
2206
  async function tryImport2(name, loader) {
2207
2207
  try {
2208
2208
  return await loader();
2209
2209
  } catch (e) {
2210
2210
  throw new Error(
2211
- `OCR \uC744 \uC0AC\uC6A9\uD558\uB824\uBA74 optional dependency '${name}' \uC774 \uD544\uC694\uD569\uB2C8\uB2E4. \`npm install ${name}\` \uD6C4 \uB2E4\uC2DC \uC2E4\uD589\uD558\uC138\uC694.${_chunkU4QSRBEVcjs.OPTIONAL_DEP_INSTALL_HINT} \uC6D0\uC778: ${e.message}`
2211
+ `OCR \uC744 \uC0AC\uC6A9\uD558\uB824\uBA74 optional dependency '${name}' \uC774 \uD544\uC694\uD569\uB2C8\uB2E4. \`npm install ${name}\` \uD6C4 \uB2E4\uC2DC \uC2E4\uD589\uD558\uC138\uC694.${_chunkOMGCVZ4Wcjs.OPTIONAL_DEP_INSTALL_HINT} \uC6D0\uC778: ${e.message}`
2212
2212
  );
2213
2213
  }
2214
2214
  }
@@ -2256,4 +2256,4 @@ function bgraToRgba(bgra) {
2256
2256
 
2257
2257
 
2258
2258
  exports.getOcrEngine = getOcrEngine; exports.detectRulingLines = detectRulingLines; exports.rulingToPdfLines = rulingToPdfLines; exports.deskewPage = deskewPage; exports.MAX_OCR_PIXELS = MAX_OCR_PIXELS; exports.DEFAULT_BUILTIN_OCR = DEFAULT_BUILTIN_OCR; exports.builtinOcrConfig = builtinOcrConfig; exports.reportModelDownload = reportModelDownload; exports.toOcrLine = toOcrLine; exports.pageLines = pageLines; exports.cellEdgeVerticals = cellEdgeVerticals; exports.cellEdgeHorizontals = cellEdgeHorizontals; exports.runPdfOcr = runPdfOcr; exports.ocrOnePage = ocrOnePage; exports.groupOcrLines = groupOcrLines; exports.ocrItemsToBlocks = ocrItemsToBlocks;
2259
- //# sourceMappingURL=chunk-RPHURU2B.cjs.map
2259
+ //# sourceMappingURL=chunk-L556KKBU.cjs.map