kordoc 4.14.2 → 4.14.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (151) hide show
  1. package/README.md +38 -5
  2. package/dist/{-AQKXLFIM.js → -7XBPXCXN.js} +13 -11
  3. package/dist/{chunk-FOJZNMMK.js → chunk-2LQGSDZ6.js} +1 -1
  4. package/dist/chunk-2LQGSDZ6.js.map +1 -0
  5. package/dist/chunk-4R67INKT.js +1002 -0
  6. package/dist/chunk-4R67INKT.js.map +1 -0
  7. package/dist/{chunk-ILU76UF3.js → chunk-4RJ5D7MT.js} +2 -2
  8. package/dist/chunk-4RJ5D7MT.js.map +1 -0
  9. package/dist/{chunk-EQZI77PP.cjs → chunk-5VVS2QIJ.cjs} +3 -3
  10. package/dist/{chunk-EQZI77PP.cjs.map → chunk-5VVS2QIJ.cjs.map} +1 -1
  11. package/dist/{chunk-3DUADAY2.js → chunk-A275ZQLX.js} +209 -87
  12. package/dist/chunk-A275ZQLX.js.map +1 -0
  13. package/dist/{chunk-EISO3POT.js → chunk-CVEERPMP.js} +788 -194
  14. package/dist/chunk-CVEERPMP.js.map +1 -0
  15. package/dist/{chunk-ZWD734EY.js → chunk-D6KQKMU3.js} +2 -2
  16. package/dist/{chunk-QOMNEWCQ.cjs → chunk-EBZUZC6F.cjs} +305 -31
  17. package/dist/chunk-EBZUZC6F.cjs.map +1 -0
  18. package/dist/{chunk-HR2XNERB.cjs → chunk-EMGF6EEV.cjs} +2 -2
  19. package/dist/{chunk-HR2XNERB.cjs.map → chunk-EMGF6EEV.cjs.map} +1 -1
  20. package/dist/{chunk-GDW4YP7K.js → chunk-FAZR34CA.js} +2 -2
  21. package/dist/{chunk-TNCKOL2O.js → chunk-GTINVM5K.js} +2 -2
  22. package/dist/{chunk-L7DMSMAG.cjs → chunk-HX4UUF7Y.cjs} +1 -1
  23. package/dist/chunk-HX4UUF7Y.cjs.map +1 -0
  24. package/dist/{chunk-UET462HB.js → chunk-I4NNYWIR.js} +2 -2
  25. package/dist/chunk-IH56ZISC.js +620 -0
  26. package/dist/chunk-IH56ZISC.js.map +1 -0
  27. package/dist/{chunk-EDNJLUSE.js → chunk-IHZEFW4L.js} +2 -2
  28. package/dist/chunk-IW2CB755.cjs +1002 -0
  29. package/dist/chunk-IW2CB755.cjs.map +1 -0
  30. package/dist/{chunk-ZWOFQRIB.js → chunk-JCVIOLBF.js} +3 -3
  31. package/dist/{chunk-JQEFP45L.js → chunk-L5EH2NVO.js} +2 -2
  32. package/dist/{chunk-247ANM72.cjs → chunk-NOAQRCV6.cjs} +219 -97
  33. package/dist/chunk-NOAQRCV6.cjs.map +1 -0
  34. package/dist/{chunk-7IAQ4HOK.js → chunk-NQCUAGLR.js} +1 -1
  35. package/dist/chunk-NQCUAGLR.js.map +1 -0
  36. package/dist/{chunk-NS55SM7A.js → chunk-O2PGQNYE.js} +2 -2
  37. package/dist/{chunk-QC5T6D4J.js → chunk-QGW7NMTX.js} +299 -25
  38. package/dist/chunk-QGW7NMTX.js.map +1 -0
  39. package/dist/{chunk-A7QC2ZVP.js → chunk-UVVEBI22.js} +209 -87
  40. package/dist/chunk-UVVEBI22.js.map +1 -0
  41. package/dist/chunk-VJHAUMCF.js +949 -0
  42. package/dist/chunk-VJHAUMCF.js.map +1 -0
  43. package/dist/{chunk-C7FQBSON.js → chunk-VNFJPTU4.js} +2 -2
  44. package/dist/{chunk-VQ5W4MYO.js → chunk-VYOGXNQ3.js} +298 -24
  45. package/dist/chunk-VYOGXNQ3.js.map +1 -0
  46. package/dist/{chunk-DOGPOY4B.js → chunk-WB5LW52Z.js} +2 -2
  47. package/dist/{chunk-TSFS5VKD.js → chunk-YGBZABI4.js} +332 -141
  48. package/dist/chunk-YGBZABI4.js.map +1 -0
  49. package/dist/chunks-I7TEMJXH.js +10 -0
  50. package/dist/cli.js +228 -97
  51. package/dist/cli.js.map +1 -1
  52. package/dist/{formula-PJJ6S3Z2.cjs → formula-CPO2TZGB.cjs} +9 -9
  53. package/dist/{formula-PJJ6S3Z2.cjs.map → formula-CPO2TZGB.cjs.map} +1 -1
  54. package/dist/{formula-5S7WWXGH.js → formula-NOIDZEBA.js} +4 -4
  55. package/dist/{formula-JGFTXWYT.js → formula-X44GV7TN.js} +3 -3
  56. package/dist/{image-ocr-WCAYXLOA.js → image-ocr-72RAR4WR.js} +34 -16
  57. package/dist/image-ocr-72RAR4WR.js.map +1 -0
  58. package/dist/{image-ocr-FLIL7MGN.js → image-ocr-R6W6A75P.js} +32 -14
  59. package/dist/image-ocr-R6W6A75P.js.map +1 -0
  60. package/dist/{image-ocr-ZTYAGV3W.cjs → image-ocr-SUGT64ZM.cjs} +36 -18
  61. package/dist/image-ocr-SUGT64ZM.cjs.map +1 -0
  62. package/dist/index.cjs +2416 -1184
  63. package/dist/index.cjs.map +1 -1
  64. package/dist/index.d.cts +62 -25
  65. package/dist/index.d.ts +62 -25
  66. package/dist/index.js +1853 -621
  67. package/dist/index.js.map +1 -1
  68. package/dist/mcp.js +74 -53
  69. package/dist/mcp.js.map +1 -1
  70. package/dist/{model-bundle-FSPZZ2EM.js → model-bundle-57CLEBCO.js} +5 -5
  71. package/dist/{models-CJPAQK5R.js → models-7ELIFTD7.js} +5 -5
  72. package/dist/{parser-SCUTZAIJ.js → parser-4NKAYWAX.js} +261 -241
  73. package/dist/parser-4NKAYWAX.js.map +1 -0
  74. package/dist/{parser-A4TMPJAM.js → parser-HWFQRSUQ.js} +261 -241
  75. package/dist/parser-HWFQRSUQ.js.map +1 -0
  76. package/dist/{parser-VCXE4I5A.cjs → parser-RANGXGBD.cjs} +289 -269
  77. package/dist/parser-RANGXGBD.cjs.map +1 -0
  78. package/dist/pdf-ocr-BNC34MNU.js +13 -0
  79. package/dist/pdf-ocr-QX2GB33Q.js +16 -0
  80. package/dist/pdf-ocr-VHSFACH7.cjs +14 -0
  81. package/dist/{pdf-ocr-MBZZ57LD.cjs.map → pdf-ocr-VHSFACH7.cjs.map} +1 -1
  82. package/dist/{profile-io-LBM263K7.js → profile-io-V52PL5ZO.js} +3 -3
  83. package/dist/{rasterize-46RG4ZF6.js → rasterize-ZIGLJDOG.js} +3 -3
  84. package/dist/redact-TIQEQI3M.js +18 -0
  85. package/dist/redact-doc-KXZ3TZAG.js +1216 -0
  86. package/dist/redact-doc-KXZ3TZAG.js.map +1 -0
  87. package/dist/{render-NGP5T24S.js → render-U5PE6V2E.js} +7 -7
  88. package/dist/seal-DNXJBILR.js +10 -0
  89. package/dist/{setup-AU4OCHNH.js → setup-YRDM4ODP.js} +3 -3
  90. package/dist/visual-5XWMA4EV.js +19 -0
  91. package/dist/{watch-MKPUCPXM.js → watch-5IOLBATT.js} +12 -12
  92. package/package.json +2 -2
  93. package/dist/chunk-247ANM72.cjs.map +0 -1
  94. package/dist/chunk-3DUADAY2.js.map +0 -1
  95. package/dist/chunk-422427XJ.cjs +0 -571
  96. package/dist/chunk-422427XJ.cjs.map +0 -1
  97. package/dist/chunk-7IAQ4HOK.js.map +0 -1
  98. package/dist/chunk-A7QC2ZVP.js.map +0 -1
  99. package/dist/chunk-DZIXKL7E.js +0 -145
  100. package/dist/chunk-DZIXKL7E.js.map +0 -1
  101. package/dist/chunk-EISO3POT.js.map +0 -1
  102. package/dist/chunk-EP7KOI2V.js +0 -571
  103. package/dist/chunk-EP7KOI2V.js.map +0 -1
  104. package/dist/chunk-FOJZNMMK.js.map +0 -1
  105. package/dist/chunk-ILU76UF3.js.map +0 -1
  106. package/dist/chunk-KVWV4ULP.js +0 -516
  107. package/dist/chunk-KVWV4ULP.js.map +0 -1
  108. package/dist/chunk-L7DMSMAG.cjs.map +0 -1
  109. package/dist/chunk-QC5T6D4J.js.map +0 -1
  110. package/dist/chunk-QOMNEWCQ.cjs.map +0 -1
  111. package/dist/chunk-TSFS5VKD.js.map +0 -1
  112. package/dist/chunk-VQ5W4MYO.js.map +0 -1
  113. package/dist/chunks-SX77P5CV.js +0 -10
  114. package/dist/image-ocr-FLIL7MGN.js.map +0 -1
  115. package/dist/image-ocr-WCAYXLOA.js.map +0 -1
  116. package/dist/image-ocr-ZTYAGV3W.cjs.map +0 -1
  117. package/dist/parser-A4TMPJAM.js.map +0 -1
  118. package/dist/parser-SCUTZAIJ.js.map +0 -1
  119. package/dist/parser-VCXE4I5A.cjs.map +0 -1
  120. package/dist/pdf-ocr-76SAUXMZ.js +0 -13
  121. package/dist/pdf-ocr-CPU55CVF.js +0 -16
  122. package/dist/pdf-ocr-MBZZ57LD.cjs +0 -14
  123. package/dist/redact-7ILEAUTS.js +0 -12
  124. package/dist/seal-RGUPOLXD.js +0 -10
  125. package/dist/visual-NZLYIYEM.js +0 -19
  126. /package/dist/{-AQKXLFIM.js.map → -7XBPXCXN.js.map} +0 -0
  127. /package/dist/{chunk-ZWD734EY.js.map → chunk-D6KQKMU3.js.map} +0 -0
  128. /package/dist/{chunk-GDW4YP7K.js.map → chunk-FAZR34CA.js.map} +0 -0
  129. /package/dist/{chunk-TNCKOL2O.js.map → chunk-GTINVM5K.js.map} +0 -0
  130. /package/dist/{chunk-UET462HB.js.map → chunk-I4NNYWIR.js.map} +0 -0
  131. /package/dist/{chunk-EDNJLUSE.js.map → chunk-IHZEFW4L.js.map} +0 -0
  132. /package/dist/{chunk-ZWOFQRIB.js.map → chunk-JCVIOLBF.js.map} +0 -0
  133. /package/dist/{chunk-JQEFP45L.js.map → chunk-L5EH2NVO.js.map} +0 -0
  134. /package/dist/{chunk-NS55SM7A.js.map → chunk-O2PGQNYE.js.map} +0 -0
  135. /package/dist/{chunk-C7FQBSON.js.map → chunk-VNFJPTU4.js.map} +0 -0
  136. /package/dist/{chunk-DOGPOY4B.js.map → chunk-WB5LW52Z.js.map} +0 -0
  137. /package/dist/{chunks-SX77P5CV.js.map → chunks-I7TEMJXH.js.map} +0 -0
  138. /package/dist/{formula-5S7WWXGH.js.map → formula-NOIDZEBA.js.map} +0 -0
  139. /package/dist/{formula-JGFTXWYT.js.map → formula-X44GV7TN.js.map} +0 -0
  140. /package/dist/{model-bundle-FSPZZ2EM.js.map → model-bundle-57CLEBCO.js.map} +0 -0
  141. /package/dist/{models-CJPAQK5R.js.map → models-7ELIFTD7.js.map} +0 -0
  142. /package/dist/{pdf-ocr-76SAUXMZ.js.map → pdf-ocr-BNC34MNU.js.map} +0 -0
  143. /package/dist/{pdf-ocr-CPU55CVF.js.map → pdf-ocr-QX2GB33Q.js.map} +0 -0
  144. /package/dist/{profile-io-LBM263K7.js.map → profile-io-V52PL5ZO.js.map} +0 -0
  145. /package/dist/{rasterize-46RG4ZF6.js.map → rasterize-ZIGLJDOG.js.map} +0 -0
  146. /package/dist/{redact-7ILEAUTS.js.map → redact-TIQEQI3M.js.map} +0 -0
  147. /package/dist/{render-NGP5T24S.js.map → render-U5PE6V2E.js.map} +0 -0
  148. /package/dist/{seal-RGUPOLXD.js.map → seal-DNXJBILR.js.map} +0 -0
  149. /package/dist/{setup-AU4OCHNH.js.map → setup-YRDM4ODP.js.map} +0 -0
  150. /package/dist/{visual-NZLYIYEM.js.map → visual-5XWMA4EV.js.map} +0 -0
  151. /package/dist/{watch-MKPUCPXM.js.map → watch-5IOLBATT.js.map} +0 -0
@@ -3,7 +3,7 @@ import {
3
3
  ensureModelsIn,
4
4
  getModelStatusIn,
5
5
  getModelsDir
6
- } from "./chunk-NS55SM7A.js";
6
+ } from "./chunk-O2PGQNYE.js";
7
7
 
8
8
  // src/ocr/models.ts
9
9
  import { join } from "path";
@@ -80,4 +80,4 @@ export {
80
80
  parseCharacterDict,
81
81
  ocrModelPath
82
82
  };
83
- //# sourceMappingURL=chunk-ZWD734EY.js.map
83
+ //# sourceMappingURL=chunk-D6KQKMU3.js.map
@@ -1,6 +1,237 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
2
2
 
3
- var _chunkHR2XNERBcjs = require('./chunk-HR2XNERB.cjs');
3
+ var _chunkEMGF6EEVcjs = require('./chunk-EMGF6EEV.cjs');
4
+
5
+ // src/shared/symbol-fonts.ts
6
+ var WINGDINGS = [
7
+ "\u{1F589}",
8
+ "\u2702",
9
+ "\u2701",
10
+ "\u{1F453}",
11
+ "\u{1F56D}",
12
+ "\u{1F56E}",
13
+ "\u{1F56F}",
14
+ "\u{1F57F}",
15
+ "\u2706",
16
+ "\u{1F582}",
17
+ "\u{1F583}",
18
+ "\u{1F4EA}",
19
+ "\u{1F4EB}",
20
+ "\u{1F4EC}",
21
+ "\u{1F4ED}",
22
+ "\u{1F4C1}",
23
+ "\u{1F4C2}",
24
+ "\u{1F4C4}",
25
+ "\u{1F5CF}",
26
+ "\u{1F5D0}",
27
+ "\u{1F5C4}",
28
+ "\u231B",
29
+ "\u{1F5AE}",
30
+ "\u{1F5B0}",
31
+ "\u{1F5B2}",
32
+ "\u{1F5B3}",
33
+ "\u{1F5B4}",
34
+ "\u{1F5AB}",
35
+ "\u{1F5AC}",
36
+ "\u2707",
37
+ "\u270D",
38
+ "\u{1F58E}",
39
+ "\u270C",
40
+ "\u{1F44C}",
41
+ "\u{1F44D}",
42
+ "\u{1F44E}",
43
+ "\u261C",
44
+ "\u261E",
45
+ "\u261D",
46
+ "\u261F",
47
+ "\u{1F590}",
48
+ "\u263A",
49
+ "\u{1F610}",
50
+ "\u2639",
51
+ "\u{1F4A3}",
52
+ "\u2620",
53
+ "\u{1F3F3}",
54
+ "\u{1F3F1}",
55
+ "\u2708",
56
+ "\u263C",
57
+ "\u{1F4A7}",
58
+ "\u2744",
59
+ "\u{1F546}",
60
+ "\u271E",
61
+ "\u{1F548}",
62
+ "\u2720",
63
+ "\u2721",
64
+ "\u262A",
65
+ "\u262F",
66
+ "\u0950",
67
+ "\u2638",
68
+ "\u2648",
69
+ "\u2649",
70
+ "\u264A",
71
+ "\u264B",
72
+ "\u264C",
73
+ "\u264D",
74
+ "\u264E",
75
+ "\u264F",
76
+ "\u2650",
77
+ "\u2651",
78
+ "\u2652",
79
+ "\u2653",
80
+ "\u{1F670}",
81
+ "\u{1F675}",
82
+ "\u25CF",
83
+ "\u25CB",
84
+ "\u25A0",
85
+ "\u25A1",
86
+ "\u25A1",
87
+ "\u2751",
88
+ "\u2752",
89
+ "\u2B27",
90
+ "\u29EB",
91
+ "\u25C6",
92
+ "\u2756",
93
+ "\u2B25",
94
+ "\u2327",
95
+ "\u2BB9",
96
+ "\u2318",
97
+ "\u{1F3F5}",
98
+ "\u{1F3F6}",
99
+ "\u{1F676}",
100
+ "\u{1F677}",
101
+ "",
102
+ "\u24EA",
103
+ "\u2460",
104
+ "\u2461",
105
+ "\u2462",
106
+ "\u2463",
107
+ "\u2464",
108
+ "\u2465",
109
+ "\u2466",
110
+ "\u2467",
111
+ "\u2468",
112
+ "\u2469",
113
+ "\u24FF",
114
+ "\u2776",
115
+ "\u2777",
116
+ "\u2778",
117
+ "\u2779",
118
+ "\u277A",
119
+ "\u277B",
120
+ "\u277C",
121
+ "\u277D",
122
+ "\u277E",
123
+ "\u277F",
124
+ "\u{1F662}",
125
+ "\u{1F660}",
126
+ "\u{1F661}",
127
+ "\u{1F663}",
128
+ "\u{1F65E}",
129
+ "\u{1F65C}",
130
+ "\u{1F65D}",
131
+ "\u{1F65F}",
132
+ "\xB7",
133
+ "\u2022",
134
+ "\u25AA",
135
+ "\u26AA",
136
+ "\u25CB",
137
+ "\u25EF",
138
+ "\u25C9",
139
+ "\u25CE",
140
+ "\u{1F53F}",
141
+ "\u25AA",
142
+ "\u25FB",
143
+ "\u{1F7C2}",
144
+ "\u2726",
145
+ "\u2605",
146
+ "\u2736",
147
+ "\u2734",
148
+ "\u2739",
149
+ "\u2735",
150
+ "\u2BD0",
151
+ "\u2316",
152
+ "\u27E1",
153
+ "\u2311",
154
+ "\u2BD1",
155
+ "\u272A",
156
+ "\u2730",
157
+ "\u{1F550}",
158
+ "\u{1F551}",
159
+ "\u{1F552}",
160
+ "\u{1F553}",
161
+ "\u{1F554}",
162
+ "\u{1F555}",
163
+ "\u{1F556}",
164
+ "\u{1F557}",
165
+ "\u{1F558}",
166
+ "\u{1F559}",
167
+ "\u{1F55A}",
168
+ "\u{1F55B}",
169
+ "\u2BB0",
170
+ "\u2BB1",
171
+ "\u2BB2",
172
+ "\u2BB3",
173
+ "\u2BB4",
174
+ "\u2BB5",
175
+ "\u2BB6",
176
+ "\u2BB7",
177
+ "\u{1F66A}",
178
+ "\u{1F66B}",
179
+ "\u{1F655}",
180
+ "\u{1F654}",
181
+ "\u{1F657}",
182
+ "\u{1F656}",
183
+ "\u{1F650}",
184
+ "\u{1F651}",
185
+ "\u{1F652}",
186
+ "\u{1F653}",
187
+ "\u232B",
188
+ "\u2326",
189
+ "\u2B98",
190
+ "\u2B9A",
191
+ "\u2B99",
192
+ "\u2B9B",
193
+ "\u2B88",
194
+ "\u2B8A",
195
+ "\u2B89",
196
+ "\u2B8B",
197
+ "\u2190",
198
+ "\u2192",
199
+ "\u2191",
200
+ "\u2193",
201
+ "\u2196",
202
+ "\u2197",
203
+ "\u2199",
204
+ "\u2198",
205
+ "\u2B05",
206
+ "\u2794",
207
+ "\u2B06",
208
+ "\u2B07",
209
+ "\u2B09",
210
+ "\u2B08",
211
+ "\u2B0B",
212
+ "\u2B0A",
213
+ "\u21E6",
214
+ "\u21E8",
215
+ "\u21E7",
216
+ "\u21E9",
217
+ "\u2B04",
218
+ "\u21F3",
219
+ "\u2B00",
220
+ "\u2B01",
221
+ "\u2B03",
222
+ "\u2B02",
223
+ "\u{1F8AC}",
224
+ "\u{1F8AD}",
225
+ "\u2717",
226
+ "\u2714",
227
+ "\u2612",
228
+ "\u2611",
229
+ ""
230
+ ];
231
+ function wingdingsChar(code) {
232
+ if (code < 33 || code > 255) return void 0;
233
+ return WINGDINGS[code - 33] || void 0;
234
+ }
4
235
 
5
236
  // src/shared/pua.ts
6
237
  var BMP_SYMBOL_MAP = {
@@ -188,7 +419,7 @@ var BOXED_NUMBER_START = 983729;
188
419
  var BOXED_NUMBER_END = 983748;
189
420
  function mapPuaChar(code) {
190
421
  if (code >= 61472 && code <= 61695) {
191
- return BMP_SYMBOL_MAP[code - 61440];
422
+ return _nullishCoalesce(BMP_SYMBOL_MAP[code - 61440], () => ( wingdingsChar(code - 61440)));
192
423
  }
193
424
  if (code >= BOXED_NUMBER_START && code <= BOXED_NUMBER_END) {
194
425
  return String.fromCodePoint(9312 + (code - BOXED_NUMBER_START));
@@ -264,32 +495,54 @@ function buildTable(rows, options) {
264
495
  }
265
496
  function buildTableDirect(rows, numRows, options) {
266
497
  let maxCols = 0;
498
+ const rowCap = Math.min(MAX_ROWS, numRows + rows.reduce((n, r) => n + r.length, 0) + 1);
267
499
  for (const row of rows) {
268
500
  for (const cell of row) {
269
501
  const end = (_nullishCoalesce(cell.colAddr, () => ( 0))) + cell.colSpan;
270
502
  if (end > maxCols) maxCols = end;
503
+ if (cell.rowAddr !== void 0 && cell.rowAddr >= numRows) numRows = Math.min(cell.rowAddr + 1, rowCap);
271
504
  }
272
505
  }
273
506
  if (maxCols > MAX_COLS) maxCols = MAX_COLS;
274
- if (maxCols === 0) return { rows: 0, cols: 0, cells: [], hasHeader: false };
507
+ if (maxCols === 0 || numRows === 0) return { rows: 0, cols: 0, cells: [], hasHeader: false };
275
508
  const grid = Array.from(
276
509
  { length: numRows },
277
510
  () => Array.from({ length: maxCols }, () => ({ text: "", colSpan: 1, rowSpan: 1 }))
278
511
  );
512
+ const owner = Array.from({ length: numRows }, () => new Array(maxCols));
279
513
  const anchorCols = /* @__PURE__ */ new Set();
280
- for (const row of rows) {
281
- for (const cell of row) {
282
- const r = _nullishCoalesce(cell.rowAddr, () => ( 0));
283
- const c = _nullishCoalesce(cell.colAddr, () => ( 0));
284
- if (r >= numRows || c >= maxCols || r < 0 || c < 0) continue;
514
+ for (let ri = 0; ri < rows.length; ri++) {
515
+ for (const cell of rows[ri]) {
516
+ const text = _optionalChain([options, 'optionalAccess', _3 => _3.keepEmptyParagraphs]) ? cell.text : cell.text.trim();
517
+ const r = Math.min(_nullishCoalesce(cell.rowAddr, () => ( ri)), numRows - 1);
518
+ let c = _nullishCoalesce(cell.colAddr, () => ( 0));
519
+ if (r < 0 || c < 0) continue;
520
+ if (cell.colAddr === void 0) while (c < maxCols - 1 && owner[r][c]) c++;
521
+ if (c >= maxCols) c = maxCols - 1;
522
+ const own = owner[r][c];
523
+ if (own) {
524
+ if (text.trim()) own.text = own.text ? `${own.text}
525
+ ${text}` : text;
526
+ continue;
527
+ }
528
+ let colSpan = Math.max(1, Math.min(cell.colSpan, maxCols - c));
529
+ for (let dc = 1; dc < colSpan; dc++) if (owner[r][c + dc]) {
530
+ colSpan = dc;
531
+ break;
532
+ }
533
+ let rowSpan = Math.max(1, Math.min(cell.rowSpan, numRows - r));
534
+ for (let dr = 1; dr < rowSpan; dr++) {
535
+ if (owner[r + dr].slice(c, c + colSpan).some(Boolean)) {
536
+ rowSpan = dr;
537
+ break;
538
+ }
539
+ }
540
+ const ir = { text, colSpan, rowSpan };
285
541
  anchorCols.add(c);
286
- grid[r][c] = { text: _optionalChain([options, 'optionalAccess', _3 => _3.keepEmptyParagraphs]) ? cell.text : cell.text.trim(), colSpan: cell.colSpan, rowSpan: cell.rowSpan };
287
- for (let dr = 0; dr < cell.rowSpan; dr++) {
288
- for (let dc = 0; dc < cell.colSpan; dc++) {
289
- if (dr === 0 && dc === 0) continue;
290
- if (r + dr < numRows && c + dc < maxCols) {
291
- grid[r + dr][c + dc] = { text: "", colSpan: 1, rowSpan: 1 };
292
- }
542
+ for (let dr = 0; dr < rowSpan; dr++) {
543
+ for (let dc = 0; dc < colSpan; dc++) {
544
+ owner[r + dr][c + dc] = ir;
545
+ grid[r + dr][c + dc] = dr === 0 && dc === 0 ? ir : { text: "", colSpan: 1, rowSpan: 1 };
293
546
  }
294
547
  }
295
548
  }
@@ -306,6 +559,11 @@ function trimAndReturn(grid, numRows, maxCols, anchorCols, options) {
306
559
  }
307
560
  if (effectiveCols < maxCols && effectiveCols > 0) {
308
561
  const trimmed = grid.map((row) => row.slice(0, effectiveCols));
562
+ for (const row of trimmed) {
563
+ for (let c = 0; c < row.length; c++) {
564
+ if (c + row[c].colSpan > effectiveCols) row[c].colSpan = effectiveCols - c;
565
+ }
566
+ }
309
567
  return { rows: numRows, cols: effectiveCols, cells: trimmed, hasHeader: numRows > 1 };
310
568
  }
311
569
  return { rows: numRows, cols: maxCols, cells: grid, hasHeader: numRows > 1 };
@@ -318,13 +576,16 @@ function convertTableToText(rows) {
318
576
  function escapeGfm(text) {
319
577
  const NUL = String.fromCharCode(0);
320
578
  const spans = [];
321
- const masked = text.replace(/!\[[^\]]*\]\([^)\n]*\)|\]\((?:https?:|mailto:|tel:|#)[^)\n]*\)|\$\$[^$]*\$\$|\$[^$\n]*\$/gi, (m) => {
579
+ const masked = text.replace(/!\[[^\]]*\]\([^)\n]*\)|\]\((?:https?:|mailto:|tel:|#)[^)\n]*\)|(?<!\\)\$\$(?:\\[\s\S]|[^\\$])*\$\$|(?<!\\)\$(?:\\[^\n]|[^\\$\n])*\$/gi, (m) => {
322
580
  spans.push(m);
323
581
  return NUL + (spans.length - 1) + NUL;
324
582
  });
325
- const escaped = masked.replace(/([~*_`])/g, "\\$1");
583
+ const escaped = masked.replace(/\\(?=[!-#%-\/:-@\[-\x60{}~])/g, "\\\\").replace(/([~*_`])/g, "\\$1").replace(/(?<!\\)\|/g, "\\|").replace(/^([ \t]*)(?=#{1,6}(?:[ \t]|$))/gm, "$1\\").replace(/<(?!\/?u>)(?=[A-Za-z/!?])/g, "\\<");
326
584
  return escaped.replace(new RegExp(NUL + "(\\d+)" + NUL, "g"), (_, n) => spans[Number(n)]);
327
585
  }
586
+ function escapeLiteralDollar(text) {
587
+ return text.includes("$") ? text.replace(/\$/g, "\\$") : text;
588
+ }
328
589
  var HWP_SHAPE_ALT_TEXT_RE = /^(?:모서리가 둥근 |둥근 )?(?:사각형|직사각형|정사각형|원|타원|삼각형|이등변 삼각형|직각 삼각형|선|직선|곡선|화살표|굵은 화살표|이중 화살표|오각형|육각형|팔각형|별|[4-8]점별|십자|십자형|구름|구름형|마름모|도넛|평행사변형|사다리꼴|부채꼴|호|반원|물결|번개|하트|빗금|블록 화살표|수식|표|그림|개체|그리기\s?개체|묶음\s?개체|글상자|수식\s?개체|OLE\s?개체)\s?입니다\.?$/gm;
329
590
  function sanitizePua(text) {
330
591
  return mapPuaText(text).replace(/[\u{F0000}-\u{FFFFD}]/gu, "");
@@ -423,6 +684,7 @@ function dedupeRunningHeaders(blocks) {
423
684
  function spansToMarkdown(spans) {
424
685
  let out = "";
425
686
  for (const s of spans) {
687
+ if (s.placeholder) continue;
426
688
  const text = sanitizePua(_nullishCoalesce(s.text, () => ( "")));
427
689
  if (!text) continue;
428
690
  let marker = s.code ? "`" : s.bold && s.italic ? "***" : s.bold ? "**" : s.italic ? "*" : "";
@@ -455,7 +717,8 @@ function blocksToMarkdown(blocks) {
455
717
  if (block.type === "heading" && block.text) {
456
718
  const prefix = "#".repeat(Math.min(block.level || 2, 6));
457
719
  const headingText = sanitizeText(block.text);
458
- if (headingText) lines.push("", `${prefix} ${escapeGfm(headingText)}`, "");
720
+ const note = block.footnoteText ? ` (\uC8FC: ${block.footnoteText})` : "";
721
+ if (headingText) lines.push("", `${prefix} ${escapeGfm(headingText + note)}`, "");
459
722
  continue;
460
723
  }
461
724
  if (block.type === "image" && block.text) {
@@ -501,7 +764,7 @@ function blocksToMarkdown(blocks) {
501
764
  if (_optionalChain([block, 'access', _26 => _26.spans, 'optionalAccess', _27 => _27.length])) {
502
765
  let rendered = spansToMarkdown(block.spans);
503
766
  if (block.href) {
504
- const href = _chunkHR2XNERBcjs.sanitizeHref.call(void 0, block.href);
767
+ const href = _chunkEMGF6EEVcjs.sanitizeHref.call(void 0, block.href);
505
768
  if (href) rendered = `[${rendered}](${href})`;
506
769
  }
507
770
  if (block.footnoteText) rendered += ` (\uC8FC: ${block.footnoteText})`;
@@ -509,7 +772,7 @@ function blocksToMarkdown(blocks) {
509
772
  continue;
510
773
  }
511
774
  if (block.href) {
512
- const href = _chunkHR2XNERBcjs.sanitizeHref.call(void 0, block.href);
775
+ const href = _chunkEMGF6EEVcjs.sanitizeHref.call(void 0, block.href);
513
776
  if (href) text = `[${text}](${href})`;
514
777
  }
515
778
  if (block.footnoteText) {
@@ -549,16 +812,22 @@ function hasStructuredCellContent(table) {
549
812
  }
550
813
  return false;
551
814
  }
815
+ function noteSuffix(b) {
816
+ return b.footnoteText && b.text ? ` (\uC8FC: ${b.footnoteText})` : "";
817
+ }
818
+ function visibleText(b) {
819
+ return _optionalChain([b, 'access', _31 => _31.spans, 'optionalAccess', _32 => _32.some, 'call', _33 => _33((s) => s.placeholder)]) ? b.spans.filter((s) => !s.placeholder).map((s) => s.text).join("") : _nullishCoalesce(b.text, () => ( ""));
820
+ }
552
821
  function cellInnerHtml(cell) {
553
- if (_optionalChain([cell, 'access', _31 => _31.blocks, 'optionalAccess', _32 => _32.length])) {
822
+ if (_optionalChain([cell, 'access', _34 => _34.blocks, 'optionalAccess', _35 => _35.length])) {
554
823
  return cell.blocks.map((b) => {
555
824
  if (b.type === "table" && b.table) {
556
825
  const cap = b.table.caption ? sanitizeText(b.table.caption) : "";
557
826
  return (cap ? cap + "<br>" : "") + tableToHtml(b.table);
558
827
  }
559
828
  if (b.type === "image" && b.text) return `<img src="${b.text}" alt="image">`;
560
- const t = sanitizeText(_nullishCoalesce(b.text, () => ( "")));
561
- return t ? t.replace(/\n/g, "<br>") : "";
829
+ const t = sanitizeText(visibleText(b));
830
+ return t ? (t + noteSuffix(b)).replace(/\n/g, "<br>") : "";
562
831
  }).filter(Boolean).join("<br>");
563
832
  }
564
833
  return sanitizeText(cell.text).replace(/\n/g, "<br>");
@@ -583,7 +852,7 @@ function tableToHtml(table) {
583
852
  const rowHtml = [];
584
853
  for (let c = 0; c < numCols; c++) {
585
854
  if (skip.has(`${r},${c}`)) continue;
586
- const cell = _optionalChain([cells, 'access', _33 => _33[r], 'optionalAccess', _34 => _34[c]]);
855
+ const cell = _optionalChain([cells, 'access', _36 => _36[r], 'optionalAccess', _37 => _37[c]]);
587
856
  if (!cell) continue;
588
857
  for (let dr = 0; dr < cell.rowSpan; dr++) {
589
858
  for (let dc = 0; dc < cell.colSpan; dc++) {
@@ -598,7 +867,7 @@ function tableToHtml(table) {
598
867
  const attrStr = attrs.length ? " " + attrs.join(" ") : "";
599
868
  rowHtml.push(`<${tag}${attrStr}>${text}</${tag}>`);
600
869
  }
601
- if (rowHtml.length) lines.push(`<tr>${rowHtml.join("")}</tr>`);
870
+ lines.push(`<tr>${rowHtml.join("")}</tr>`);
602
871
  }
603
872
  lines.push("</table>");
604
873
  return lines.join("\n");
@@ -606,7 +875,8 @@ function tableToHtml(table) {
606
875
  function tableToMarkdown(table) {
607
876
  if (table.rows === 0 || table.cols === 0) return "";
608
877
  const { cells, rows: numRows, cols: numCols } = table;
609
- if ((hasMergedCells(table) || hasStructuredCellContent(table)) && !tableContainsInlineMath(table)) {
878
+ if (hasStructuredCellContent(table)) return tableToHtml(table);
879
+ if (hasMergedCells(table) && !tableContainsInlineMath(table)) {
610
880
  return tableToHtml(table);
611
881
  }
612
882
  if (numRows === 1 && numCols === 1) {
@@ -628,9 +898,9 @@ function tableToMarkdown(table) {
628
898
  for (let r = 0; r < numRows; r++) {
629
899
  for (let c = 0; c < numCols; c++) {
630
900
  if (skip.has(`${r},${c}`)) continue;
631
- const cell = _optionalChain([cells, 'access', _35 => _35[r], 'optionalAccess', _36 => _36[c]]);
901
+ const cell = _optionalChain([cells, 'access', _38 => _38[r], 'optionalAccess', _39 => _39[c]]);
632
902
  if (!cell) continue;
633
- display[r][c] = (_optionalChain([cell, 'access', _37 => _37.blocks, 'optionalAccess', _38 => _38.some, 'call', _39 => _39((b) => b.spans || b.type === "image" && b.text)]) ? cell.blocks.map((b) => b.type === "image" && b.text ? `![image](${b.text})` : b.spans ? spansToMarkdown(b.spans) : escapeGfm(sanitizeText(_nullishCoalesce(b.text, () => ( ""))))).filter(Boolean).join("<br>") : escapeGfm(sanitizeText(cell.text)).replace(/\n/g, "<br>")).replace(/\|/g, "\\|");
903
+ display[r][c] = (_optionalChain([cell, 'access', _40 => _40.blocks, 'optionalAccess', _41 => _41.some, 'call', _42 => _42((b) => b.spans || b.type === "image" && b.text)]) ? cell.blocks.map((b) => b.type === "image" && b.text ? `![image](${b.text})` : b.spans ? spansToMarkdown(b.spans) + escapeGfm(noteSuffix(b)) : escapeGfm(sanitizeText(_nullishCoalesce(b.text, () => ( ""))) + noteSuffix(b))).filter(Boolean).join("<br>") : escapeGfm(sanitizeText(cell.text)).replace(/\n/g, "<br>")).replace(/(?<!\\)\|/g, "\\|");
634
904
  for (let dr = 0; dr < cell.rowSpan; dr++) {
635
905
  for (let dc = 0; dc < cell.colSpan; dc++) {
636
906
  if (dr === 0 && dc === 0) continue;
@@ -791,7 +1061,7 @@ function encodePng(width, height, rgba) {
791
1061
  return out;
792
1062
  }
793
1063
  function inlineImagesIntoMarkdown(markdown, images, opts) {
794
- const compress = _optionalChain([opts, 'optionalAccess', _40 => _40.compress]) !== false;
1064
+ const compress = _optionalChain([opts, 'optionalAccess', _43 => _43.compress]) !== false;
795
1065
  const uris = /* @__PURE__ */ new Map();
796
1066
  for (const img of images) {
797
1067
  let bytes = img.data;
@@ -829,5 +1099,9 @@ function inlineImagesIntoMarkdown(markdown, images, opts) {
829
1099
 
830
1100
 
831
1101
 
832
- exports.mapPuaText = mapPuaText; exports.MAX_COLS = MAX_COLS; exports.MAX_ROWS = MAX_ROWS; exports.buildTable = buildTable; exports.convertTableToText = convertTableToText; exports.flattenLayoutTables = flattenLayoutTables; exports.dedupeRunningHeaders = dedupeRunningHeaders; exports.blocksToMarkdown = blocksToMarkdown; exports.hasStructuredCellContent = hasStructuredCellContent; exports.encodePng = encodePng; exports.inlineImagesIntoMarkdown = inlineImagesIntoMarkdown;
833
- //# sourceMappingURL=chunk-QOMNEWCQ.cjs.map
1102
+
1103
+
1104
+
1105
+
1106
+ exports.WINGDINGS = WINGDINGS; exports.mapPuaText = mapPuaText; exports.MAX_COLS = MAX_COLS; exports.MAX_ROWS = MAX_ROWS; exports.buildTable = buildTable; exports.convertTableToText = convertTableToText; exports.escapeGfm = escapeGfm; exports.escapeLiteralDollar = escapeLiteralDollar; exports.flattenLayoutTables = flattenLayoutTables; exports.dedupeRunningHeaders = dedupeRunningHeaders; exports.blocksToMarkdown = blocksToMarkdown; exports.hasStructuredCellContent = hasStructuredCellContent; exports.noteSuffix = noteSuffix; exports.encodePng = encodePng; exports.inlineImagesIntoMarkdown = inlineImagesIntoMarkdown;
1107
+ //# sourceMappingURL=chunk-EBZUZC6F.cjs.map