kordoc 4.22.4 → 4.22.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +8 -7
- package/dist/{-HAK3YFWW.js → -WFRWBH7T.js} +11 -11
- package/dist/{chunk-F3AWNFMO.js → chunk-2L3Q7REU.js} +3 -3
- package/dist/{chunk-CWBH66IQ.js → chunk-35ZHXEJA.js} +3 -3
- package/dist/{chunk-Q6SVCBMK.js → chunk-3BR7VKWL.js} +2 -2
- package/dist/{chunk-G2325K2F.js → chunk-3G3TLZDK.js} +2 -2
- package/dist/{chunk-36DK6AOX.js → chunk-3YEL7P4L.js} +2 -2
- package/dist/{chunk-S45M7IQH.cjs → chunk-4SUB43EJ.cjs} +24 -24
- package/dist/{chunk-S45M7IQH.cjs.map → chunk-4SUB43EJ.cjs.map} +1 -1
- package/dist/{chunk-5ARHF54C.js → chunk-4TWN7PWJ.js} +2 -2
- package/dist/{chunk-WCTC3LSV.js → chunk-52HIK4C2.js} +4 -3
- package/dist/chunk-52HIK4C2.js.map +1 -0
- package/dist/{chunk-3TUJ34V7.js → chunk-63N6CEJE.js} +2 -2
- package/dist/{chunk-DEFT7Z3B.js → chunk-6MCC2XNB.js} +2 -2
- package/dist/{chunk-C5J5LDWM.js → chunk-6MQKNB6K.js} +4 -3
- package/dist/chunk-6MQKNB6K.js.map +1 -0
- package/dist/{chunk-MJSHXESK.cjs → chunk-AS25R4EU.cjs} +2 -2
- package/dist/{chunk-MJSHXESK.cjs.map → chunk-AS25R4EU.cjs.map} +1 -1
- package/dist/{chunk-AYV5VRHL.js → chunk-C3REGEQO.js} +2 -2
- package/dist/{chunk-4X7AR4EH.cjs → chunk-C6B5GWN7.cjs} +24 -23
- package/dist/chunk-C6B5GWN7.cjs.map +1 -0
- package/dist/{chunk-A3SKXHAN.js → chunk-CO7O3ZT6.js} +2 -2
- package/dist/{chunk-WNW77CAY.js → chunk-CRSTBATY.js} +2 -2
- package/dist/{chunk-MYTMZSQO.js → chunk-CW67DAAH.js} +2 -2
- package/dist/{chunk-RPSILMQY.js → chunk-DN55FTJP.js} +2 -2
- package/dist/{chunk-HN3QMHTT.js → chunk-HLPMC7L4.js} +5 -4
- package/dist/chunk-HLPMC7L4.js.map +1 -0
- package/dist/{chunk-LVVSMYG4.js → chunk-LE4VHWIT.js} +4 -4
- package/dist/{chunk-VXQWAPC6.cjs → chunk-N6KXGIIN.cjs} +3 -3
- package/dist/{chunk-VXQWAPC6.cjs.map → chunk-N6KXGIIN.cjs.map} +1 -1
- package/dist/{chunk-G4KNI7EO.js → chunk-PSORL4PA.js} +11 -11
- package/dist/{chunk-FAFSBCU2.js → chunk-RYKDIUHT.js} +4 -4
- package/dist/{chunk-SSL3TKJY.js → chunk-SETAYS6P.js} +2 -2
- package/dist/{chunk-Q65HT2BL.js → chunk-T7OZ7X6A.js} +2 -2
- package/dist/{chunk-UJVVL6BI.js → chunk-TOUJCO2P.js} +2 -2
- package/dist/{chunk-EVL6HZQL.js → chunk-U3GUZQ54.js} +1286 -1279
- package/dist/chunk-U3GUZQ54.js.map +1 -0
- package/dist/{chunk-EYQLJ57Y.cjs → chunk-UCK6WGHY.cjs} +3 -3
- package/dist/{chunk-EYQLJ57Y.cjs.map → chunk-UCK6WGHY.cjs.map} +1 -1
- package/dist/{chunk-K2NWHLCD.cjs → chunk-YG4GFQB7.cjs} +6 -6
- package/dist/{chunk-K2NWHLCD.cjs.map → chunk-YG4GFQB7.cjs.map} +1 -1
- package/dist/chunks-NXABWR6G.js +10 -0
- package/dist/cli.js +30 -30
- package/dist/{formula-PWAUR5PF.js → formula-FSVHUQ6Y.js} +4 -4
- package/dist/{formula-KSTY73DQ.js → formula-L625ULJP.js} +3 -3
- package/dist/{formula-JGFYGFYX.cjs → formula-QZGTF3DZ.cjs} +9 -9
- package/dist/{formula-JGFYGFYX.cjs.map → formula-QZGTF3DZ.cjs.map} +1 -1
- package/dist/{image-ocr-UULNAC5Y.cjs → image-ocr-AELVAU75.cjs} +17 -17
- package/dist/{image-ocr-UULNAC5Y.cjs.map → image-ocr-AELVAU75.cjs.map} +1 -1
- package/dist/{image-ocr-RASJHOAK.js → image-ocr-KE3RUS3R.js} +6 -6
- package/dist/{image-ocr-RPBPO3VT.js → image-ocr-QTZNBP5V.js} +9 -9
- package/dist/index.cjs +790 -782
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +249 -241
- package/dist/index.js.map +1 -1
- package/dist/mcp.js +22 -22
- package/dist/{model-bundle-ZPQ4IFT7.js → model-bundle-F6TU6ZAV.js} +5 -5
- package/dist/{models-YJQ5VHOR.js → models-ZHNNVH2W.js} +5 -5
- package/dist/{parse-worker-v2-7PNZYASF.js → parse-worker-v2-KQRG3NQO.js} +12 -12
- package/dist/{parser-ER3VLB37.js → parser-RVMH4PUB.js} +133 -20
- package/dist/parser-RVMH4PUB.js.map +1 -0
- package/dist/{parser-DR6ZHYEB.js → parser-WBKVRDPV.js} +129 -16
- package/dist/parser-WBKVRDPV.js.map +1 -0
- package/dist/{parser-ZFXVZZKQ.cjs → parser-WNDH2X6N.cjs} +397 -284
- package/dist/parser-WNDH2X6N.cjs.map +1 -0
- package/dist/pdf-ocr-IOUZTPPH.cjs +31 -0
- package/dist/{pdf-ocr-QWTGWYQT.cjs.map → pdf-ocr-IOUZTPPH.cjs.map} +1 -1
- package/dist/{pdf-ocr-BYT7XVID.js → pdf-ocr-X5XLGL5J.js} +6 -6
- package/dist/{pdf-ocr-DRQN5BXA.js → pdf-ocr-ZP2CUWSO.js} +9 -9
- package/dist/{profile-io-3QYTSPNH.js → profile-io-B4VSI4LW.js} +3 -3
- package/dist/{rasterize-LPLWCBXV.js → rasterize-Y7NVUVXU.js} +3 -3
- package/dist/{redact-doc-HDA6ZG3N.js → redact-doc-GIBTFWCO.js} +11 -11
- package/dist/{render-MYZGD3SB.js → render-JVCGYRRO.js} +7 -7
- package/dist/seal-WNX2ZJTK.js +10 -0
- package/dist/{setup-EF5TQVAI.js → setup-7L7EQPMG.js} +3 -3
- package/dist/visual-VPWPXIHN.js +21 -0
- package/dist/{watch-PM5PRSFW.js → watch-VYMFGX72.js} +12 -12
- package/package.json +1 -1
- package/dist/chunk-4X7AR4EH.cjs.map +0 -1
- package/dist/chunk-C5J5LDWM.js.map +0 -1
- package/dist/chunk-EVL6HZQL.js.map +0 -1
- package/dist/chunk-HN3QMHTT.js.map +0 -1
- package/dist/chunk-WCTC3LSV.js.map +0 -1
- package/dist/chunks-3N7OFSA4.js +0 -10
- package/dist/parser-DR6ZHYEB.js.map +0 -1
- package/dist/parser-ER3VLB37.js.map +0 -1
- package/dist/parser-ZFXVZZKQ.cjs.map +0 -1
- package/dist/pdf-ocr-QWTGWYQT.cjs +0 -31
- package/dist/seal-XA5V6A6V.js +0 -10
- package/dist/visual-DB7NJOID.js +0 -21
- /package/dist/{-HAK3YFWW.js.map → -WFRWBH7T.js.map} +0 -0
- /package/dist/{chunk-F3AWNFMO.js.map → chunk-2L3Q7REU.js.map} +0 -0
- /package/dist/{chunk-CWBH66IQ.js.map → chunk-35ZHXEJA.js.map} +0 -0
- /package/dist/{chunk-Q6SVCBMK.js.map → chunk-3BR7VKWL.js.map} +0 -0
- /package/dist/{chunk-G2325K2F.js.map → chunk-3G3TLZDK.js.map} +0 -0
- /package/dist/{chunk-36DK6AOX.js.map → chunk-3YEL7P4L.js.map} +0 -0
- /package/dist/{chunk-5ARHF54C.js.map → chunk-4TWN7PWJ.js.map} +0 -0
- /package/dist/{chunk-3TUJ34V7.js.map → chunk-63N6CEJE.js.map} +0 -0
- /package/dist/{chunk-DEFT7Z3B.js.map → chunk-6MCC2XNB.js.map} +0 -0
- /package/dist/{chunk-AYV5VRHL.js.map → chunk-C3REGEQO.js.map} +0 -0
- /package/dist/{chunk-A3SKXHAN.js.map → chunk-CO7O3ZT6.js.map} +0 -0
- /package/dist/{chunk-WNW77CAY.js.map → chunk-CRSTBATY.js.map} +0 -0
- /package/dist/{chunk-MYTMZSQO.js.map → chunk-CW67DAAH.js.map} +0 -0
- /package/dist/{chunk-RPSILMQY.js.map → chunk-DN55FTJP.js.map} +0 -0
- /package/dist/{chunk-LVVSMYG4.js.map → chunk-LE4VHWIT.js.map} +0 -0
- /package/dist/{chunk-G4KNI7EO.js.map → chunk-PSORL4PA.js.map} +0 -0
- /package/dist/{chunk-FAFSBCU2.js.map → chunk-RYKDIUHT.js.map} +0 -0
- /package/dist/{chunk-SSL3TKJY.js.map → chunk-SETAYS6P.js.map} +0 -0
- /package/dist/{chunk-Q65HT2BL.js.map → chunk-T7OZ7X6A.js.map} +0 -0
- /package/dist/{chunk-UJVVL6BI.js.map → chunk-TOUJCO2P.js.map} +0 -0
- /package/dist/{chunks-3N7OFSA4.js.map → chunks-NXABWR6G.js.map} +0 -0
- /package/dist/{formula-PWAUR5PF.js.map → formula-FSVHUQ6Y.js.map} +0 -0
- /package/dist/{formula-KSTY73DQ.js.map → formula-L625ULJP.js.map} +0 -0
- /package/dist/{image-ocr-RASJHOAK.js.map → image-ocr-KE3RUS3R.js.map} +0 -0
- /package/dist/{image-ocr-RPBPO3VT.js.map → image-ocr-QTZNBP5V.js.map} +0 -0
- /package/dist/{model-bundle-ZPQ4IFT7.js.map → model-bundle-F6TU6ZAV.js.map} +0 -0
- /package/dist/{models-YJQ5VHOR.js.map → models-ZHNNVH2W.js.map} +0 -0
- /package/dist/{parse-worker-v2-7PNZYASF.js.map → parse-worker-v2-KQRG3NQO.js.map} +0 -0
- /package/dist/{pdf-ocr-BYT7XVID.js.map → pdf-ocr-X5XLGL5J.js.map} +0 -0
- /package/dist/{pdf-ocr-DRQN5BXA.js.map → pdf-ocr-ZP2CUWSO.js.map} +0 -0
- /package/dist/{profile-io-3QYTSPNH.js.map → profile-io-B4VSI4LW.js.map} +0 -0
- /package/dist/{rasterize-LPLWCBXV.js.map → rasterize-Y7NVUVXU.js.map} +0 -0
- /package/dist/{redact-doc-HDA6ZG3N.js.map → redact-doc-GIBTFWCO.js.map} +0 -0
- /package/dist/{render-MYZGD3SB.js.map → render-JVCGYRRO.js.map} +0 -0
- /package/dist/{seal-XA5V6A6V.js.map → seal-WNX2ZJTK.js.map} +0 -0
- /package/dist/{setup-EF5TQVAI.js.map → setup-7L7EQPMG.js.map} +0 -0
- /package/dist/{visual-DB7NJOID.js.map → visual-VPWPXIHN.js.map} +0 -0
- /package/dist/{watch-PM5PRSFW.js.map → watch-VYMFGX72.js.map} +0 -0
package/dist/index.js
CHANGED
|
@@ -2,7 +2,7 @@ import {
|
|
|
2
2
|
blocksToPages,
|
|
3
3
|
bmpToPng,
|
|
4
4
|
inlineImagesIntoMarkdown
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-CRSTBATY.js";
|
|
6
6
|
import {
|
|
7
7
|
parsePageRange
|
|
8
8
|
} from "./chunk-V4BH5SRQ.js";
|
|
@@ -37,7 +37,7 @@ import {
|
|
|
37
37
|
validateOcrOptions,
|
|
38
38
|
visibleText,
|
|
39
39
|
wrapScript
|
|
40
|
-
} from "./chunk-
|
|
40
|
+
} from "./chunk-TOUJCO2P.js";
|
|
41
41
|
import {
|
|
42
42
|
KordocError,
|
|
43
43
|
OPTIONAL_DEP_INSTALL_HINT,
|
|
@@ -55,7 +55,7 @@ import {
|
|
|
55
55
|
toArrayBuffer,
|
|
56
56
|
unescapeHtml,
|
|
57
57
|
unzipLimitBytes
|
|
58
|
-
} from "./chunk-
|
|
58
|
+
} from "./chunk-T7OZ7X6A.js";
|
|
59
59
|
|
|
60
60
|
// src/plain-markdown.ts
|
|
61
61
|
function toPlainMarkdown(md2) {
|
|
@@ -24642,7 +24642,7 @@ var MIN_SIDE = 24;
|
|
|
24642
24642
|
async function ocrEmbeddedImages(blocks, options, warnings) {
|
|
24643
24643
|
const ocr = options?.ocr;
|
|
24644
24644
|
if (ocr !== true && ocr !== "force" && typeof ocr !== "function") return false;
|
|
24645
|
-
const { parseImageDocument } = await import("./image-ocr-
|
|
24645
|
+
const { parseImageDocument } = await import("./image-ocr-KE3RUS3R.js");
|
|
24646
24646
|
let inserted = false, unreadable = 0;
|
|
24647
24647
|
let failed = null;
|
|
24648
24648
|
const walk = async (list, depth) => {
|
|
@@ -35143,14 +35143,14 @@ function fontHasGlyph(face, cp) {
|
|
|
35143
35143
|
if (!hasFontMetrics(face)) return false;
|
|
35144
35144
|
return cp >= 32 && cp <= 126 || FONTS[face.trim()].ex[cp] !== void 0;
|
|
35145
35145
|
}
|
|
35146
|
-
var HANCOM_FALLBACK_W = { 8228: 173, 8231: 173, 8211: 430, 8680: 1e3, 8728: 500, 8227: 465, 12295: 1e3 };
|
|
35146
|
+
var HANCOM_FALLBACK_W = { 8228: 173, 8231: 173, 8211: 430, 8680: 1e3, 8728: 500, 8227: 465, 12295: 1e3, 61607: 937 / 2048 * 1e3, 61599: 937 / 2048 * 1e3, 61550: 1529 / 2048 * 1e3 };
|
|
35147
35147
|
function isHanja(cp) {
|
|
35148
35148
|
return cp >= 19968 && cp <= 40959 || cp >= 13312 && cp <= 19903 || cp >= 63744 && cp <= 64255;
|
|
35149
35149
|
}
|
|
35150
|
-
function fontWidthFn(face) {
|
|
35150
|
+
function fontWidthFn(face, fallback = true) {
|
|
35151
35151
|
if (!hasFontMetrics(face)) return null;
|
|
35152
35152
|
const m = FONTS[face.trim()];
|
|
35153
|
-
return (cp) => cp >= 32 && cp <= 126 ? m.ascii[cp - 32] : m.ex[cp] ?? (HANCOM_FALLBACK_W[cp] ?? (isHalfwidthForm(cp) ? 500 : m.han !== void 0 && isHanja(cp) ? m.han : m.cjk));
|
|
35153
|
+
return (cp) => cp >= 32 && cp <= 126 ? m.ascii[cp - 32] : m.ex[cp] ?? ((fallback ? HANCOM_FALLBACK_W[cp] : void 0) ?? (isHalfwidthForm(cp) ? 500 : m.han !== void 0 && isHanja(cp) ? m.han : m.cjk));
|
|
35154
35154
|
}
|
|
35155
35155
|
function isHalfwidthForm(cp) {
|
|
35156
35156
|
return cp >= 65377 && cp <= 65500 || cp >= 65512 && cp <= 65518;
|
|
@@ -35374,20 +35374,20 @@ function fixedPitchWidthEm1000(cp) {
|
|
|
35374
35374
|
return cp < 128 || isHalfwidthForm(cp) ? 500 : 1e3;
|
|
35375
35375
|
}
|
|
35376
35376
|
var PUA_FULL = /* @__PURE__ */ new Set([983729, 983730, 983731, 983732, 983733, 983734, 983803]);
|
|
35377
|
-
function widthFnOf(faceClass) {
|
|
35378
|
-
const base = baseWidthFnOf(faceClass);
|
|
35377
|
+
function widthFnOf(faceClass, fallback = true) {
|
|
35378
|
+
const base = baseWidthFnOf(faceClass, fallback);
|
|
35379
35379
|
const hcr = faceClass === "hcr" || faceClass === "font:\uD568\uCD08\uB86C\uB3CB\uC6C0" || faceClass === "font:\uD568\uCD08\uB86C\uBC14\uD0D5";
|
|
35380
35380
|
const f = (cp) => cp >= 983040 ? PUA_FULL.has(cp) ? 1e3 : 500 : cp === 61600 ? base(32) : !hcr && cp >= 10102 && cp <= 10131 ? 1e3 : base(cp);
|
|
35381
|
-
if (faceClass === "fixedPitch" || faceClass === "cjk") return (cp) => isZeroWidthCp(cp) ? 0 : HANCOM_FALLBACK_W[cp] ?? f(cp);
|
|
35381
|
+
if (fallback && (faceClass === "fixedPitch" || faceClass === "cjk")) return (cp) => isZeroWidthCp(cp) ? 0 : HANCOM_FALLBACK_W[cp] ?? f(cp);
|
|
35382
35382
|
return (cp) => isZeroWidthCp(cp) ? 0 : f(cp);
|
|
35383
35383
|
}
|
|
35384
|
-
function baseWidthFnOf(faceClass) {
|
|
35384
|
+
function baseWidthFnOf(faceClass, fallback = true) {
|
|
35385
35385
|
if (faceClass === "fixedPitch") return fixedPitchWidthEm1000;
|
|
35386
35386
|
if (faceClass === "gothic") return (cp) => isHalfwidthForm(cp) ? 500 : gothicWidthEm1000(cp);
|
|
35387
35387
|
if (faceClass === "cjk") return cjkWidthEm1000;
|
|
35388
35388
|
if (faceClass?.startsWith("font:")) {
|
|
35389
35389
|
const face = faceClass.slice(5);
|
|
35390
|
-
return fontWidthFn(face) ?? gothicWidthEm1000;
|
|
35390
|
+
return fontWidthFn(face, fallback) ?? gothicWidthEm1000;
|
|
35391
35391
|
}
|
|
35392
35392
|
return charWidthEm1000;
|
|
35393
35393
|
}
|
|
@@ -35410,7 +35410,7 @@ function mulDiv(a, b, c) {
|
|
|
35410
35410
|
const e = a * b;
|
|
35411
35411
|
return Math.trunc(e < 0 ? (e - c / 2) / c : (e + c / 2) / c);
|
|
35412
35412
|
}
|
|
35413
|
-
function hancomCharWidth(ch, height, ratioPct, spacingPct, faceClass, emAdd = 0) {
|
|
35413
|
+
function hancomCharWidth(ch, height, ratioPct, spacingPct, faceClass, emAdd = 0, fallback = true) {
|
|
35414
35414
|
const cp = ch.codePointAt(0);
|
|
35415
35415
|
let w;
|
|
35416
35416
|
if (cp === 8197) {
|
|
@@ -35419,7 +35419,7 @@ function hancomCharWidth(ch, height, ratioPct, spacingPct, faceClass, emAdd = 0)
|
|
|
35419
35419
|
} else if (isSpaceCp(cp)) {
|
|
35420
35420
|
const s = Math.trunc(height / 8);
|
|
35421
35421
|
w = 4 * (ratioPct === 100 ? s : mulDiv(s, ratioPct, 100));
|
|
35422
|
-
} else return hancomEmWidth(widthFnOf(faceClass)(cp) + emAdd, height, ratioPct, spacingPct);
|
|
35422
|
+
} else return hancomEmWidth(widthFnOf(faceClass, fallback)(cp) + emAdd, height, ratioPct, spacingPct);
|
|
35423
35423
|
if (spacingPct) w += 4 * mulDiv(Math.trunc(w / 4), spacingPct, 100);
|
|
35424
35424
|
return w;
|
|
35425
35425
|
}
|
|
@@ -42687,7 +42687,8 @@ function parseRenderStyles(headXml, opts) {
|
|
|
42687
42687
|
...cpr != null && cpr !== "4294967295" ? { charPrId: cpr } : {},
|
|
42688
42688
|
offset: Number(head?.getAttribute("textOffset")) || 0,
|
|
42689
42689
|
offsetPct: (head?.getAttribute("textOffsetType") ?? "PERCENT") === "PERCENT",
|
|
42690
|
-
autoIndent: head?.getAttribute("autoIndent") !== "0"
|
|
42690
|
+
autoIndent: head?.getAttribute("autoIndent") !== "0",
|
|
42691
|
+
...head?.hasAttribute("useInstWidth") ? { useInstWidth: head.getAttribute("useInstWidth") !== "0" } : {}
|
|
42691
42692
|
});
|
|
42692
42693
|
}
|
|
42693
42694
|
} else if (tag === "numbering") {
|
|
@@ -50010,7 +50011,8 @@ function pushTextSlots(t, chars, prId, depth, del = { deleted: 0 }) {
|
|
|
50010
50011
|
} else if (tag === "tab") {
|
|
50011
50012
|
if (del.deleted) pushFillers(chars, 8, prId);
|
|
50012
50013
|
else {
|
|
50013
|
-
|
|
50014
|
+
const width = num2(el, "width", -1);
|
|
50015
|
+
chars.push({ ch: "", prId, tab: true, ...width >= 0 ? { tabW: width } : {}, ...el.getAttribute("type") === "2" ? { tabRight: true } : {} });
|
|
50014
50016
|
pushFillers(chars, 7, prId);
|
|
50015
50017
|
}
|
|
50016
50018
|
} else if (tag === "titleMark") {
|
|
@@ -50149,10 +50151,13 @@ function captionExtra(el) {
|
|
|
50149
50151
|
return c && (c.side === "TOP" || c.side === "BOTTOM") ? c.h + c.gap : 0;
|
|
50150
50152
|
}
|
|
50151
50153
|
var DEFAULT_TAB_HU = 4e3;
|
|
50152
|
-
function
|
|
50154
|
+
function paraHeadAdvance(head, offsetHeight, width) {
|
|
50155
|
+
return width + (head.offsetPct ? Math.trunc(offsetHeight * head.offset / 100) : head.offset);
|
|
50156
|
+
}
|
|
50157
|
+
function tabAdvance(x, firstLine, geom, saved) {
|
|
50153
50158
|
const hang = geom && geom.marginIntent < 0 ? -geom.marginIntent : 0;
|
|
50154
50159
|
if (firstLine && geom?.autoTabLeft && hang > 0 && x < hang - 0.5) return hang - x;
|
|
50155
|
-
if (saved
|
|
50160
|
+
if (saved != null && saved >= 0) return saved;
|
|
50156
50161
|
return (Math.floor(x / DEFAULT_TAB_HU) + 1) * DEFAULT_TAB_HU - x;
|
|
50157
50162
|
}
|
|
50158
50163
|
function cellColumns(sub) {
|
|
@@ -50458,10 +50463,8 @@ function cellRowRemainder(cells, row, avail, from, record, bases, carries, style
|
|
|
50458
50463
|
const end = Math.max(...lines.map((l) => l[1]));
|
|
50459
50464
|
const k = lines.findIndex((l) => c.marginT + l[1] > avail - c.marginB);
|
|
50460
50465
|
if (k < 0) {
|
|
50461
|
-
|
|
50462
|
-
|
|
50463
|
-
rem = Math.max(rem, c.marginT + carry + c.marginB);
|
|
50464
|
-
}
|
|
50466
|
+
placed = true;
|
|
50467
|
+
if (carry > 0) rem = Math.max(rem, c.marginT + carry + c.marginB);
|
|
50465
50468
|
cuts.push([c.el, base + end + 1, base]);
|
|
50466
50469
|
continue;
|
|
50467
50470
|
}
|
|
@@ -50799,12 +50802,12 @@ var LINESEG_FLAGS = "393216";
|
|
|
50799
50802
|
var BASELINE_RATIO = 0.85;
|
|
50800
50803
|
var FONT_LINE_METRICS = [
|
|
50801
50804
|
[/^맑은 고딕/, 2230 / 2048, 496 / 2048, true],
|
|
50802
|
-
[/^(바탕|돋움|굴림|궁서)(체)
|
|
50805
|
+
[/^(바탕|돋움|굴림|궁서)(체)?$|^한컴바탕$|^HY/, 1758 / 2048, 290 / 2048],
|
|
50803
50806
|
[/^휴먼명조$/, 0.859, 0.195],
|
|
50804
50807
|
[/^KoPub(World)?(돋움|바탕)체 Light$/, 0.85, 0.25]
|
|
50805
50808
|
];
|
|
50806
|
-
function fontLineMetrics(face) {
|
|
50807
|
-
if (!face) return void 0;
|
|
50809
|
+
function fontLineMetrics(face, hft) {
|
|
50810
|
+
if (!face || hft && face.trim() === "\uD55C\uCEF4\uBC14\uD0D5") return void 0;
|
|
50808
50811
|
for (const [re, a, d, up] of FONT_LINE_METRICS) if (re.test(face.trim())) return [a, d, up];
|
|
50809
50812
|
return void 0;
|
|
50810
50813
|
}
|
|
@@ -50844,7 +50847,7 @@ function hancomLangOf(cp) {
|
|
|
50844
50847
|
if (cp >= 57344 && cp < 63744 || cp >= 983040) return "hangul";
|
|
50845
50848
|
return "symbol";
|
|
50846
50849
|
}
|
|
50847
|
-
function glyphWidth(ch, st) {
|
|
50850
|
+
function glyphWidth(ch, st, fallback = true) {
|
|
50848
50851
|
const cp = ch.codePointAt(0);
|
|
50849
50852
|
const space = cp === 32 || cp === 160;
|
|
50850
50853
|
const lang = space ? "hangul" : hancomLangOf(cp);
|
|
@@ -50870,8 +50873,8 @@ function glyphWidth(ch, st) {
|
|
|
50870
50873
|
const b0 = hancomEmWidth(oldEm + bAdd, h, ratio, 0), w0 = spacing ? hancomEmWidth(oldEm + bAdd, h, ratio, spacing) : b0;
|
|
50871
50874
|
return { w: w0, sp: w0 - b0 };
|
|
50872
50875
|
}
|
|
50873
|
-
const base = hancomCharWidth(ch, h, ratio, 0, fc, bAdd);
|
|
50874
|
-
const w = spacing ? hancomCharWidth(ch, h, ratio, spacing, fc, bAdd) : base;
|
|
50876
|
+
const base = hancomCharWidth(ch, h, ratio, 0, fc, bAdd, fallback);
|
|
50877
|
+
const w = spacing ? hancomCharWidth(ch, h, ratio, spacing, fc, bAdd, fallback) : base;
|
|
50875
50878
|
return { w, sp: w - base };
|
|
50876
50879
|
}
|
|
50877
50880
|
function pitchFor(height, geom) {
|
|
@@ -51000,12 +51003,10 @@ function reflowPara(p, doc, styles, areaW, startV, mode, zones = [], nums = /* @
|
|
|
51000
51003
|
const avail = Math.max(1440, Math.floor(areaW / 4) * 4 - marginL - geom.marginRight);
|
|
51001
51004
|
const firstWidth = avail;
|
|
51002
51005
|
const bu = geom.bullet ?? (numText && geom.number ? { ch: numText, ...geom.number } : void 0);
|
|
51006
|
+
const bst = (bu?.charPrId != null ? styles.charPr.get(bu.charPrId) : void 0) ?? domChar;
|
|
51003
51007
|
let headW = 0;
|
|
51004
|
-
if (bu)
|
|
51005
|
-
|
|
51006
|
-
for (const ch of bu.ch) headW += glyphWidth(ch, bst).w;
|
|
51007
|
-
}
|
|
51008
|
-
const bulletW = bu ? headW + (bu.offsetPct ? Math.trunc(height * bu.offset / 100) : bu.offset) : 0;
|
|
51008
|
+
if (bu) for (const ch of bu.ch) headW += glyphWidth(ch, bst, bu.useInstWidth !== false).w;
|
|
51009
|
+
const bulletW = bu ? paraHeadAdvance(bu, height, headW) : 0;
|
|
51009
51010
|
const contBullet = bu?.autoIndent ? bulletW : 0;
|
|
51010
51011
|
const squeeze = p.parentNode?.getAttribute?.("lineWrap") === "SQUEEZE" || !!geom.squeeze;
|
|
51011
51012
|
const NO_WRAP = 1e9;
|
|
@@ -51243,7 +51244,8 @@ function reflowPara(p, doc, styles, areaW, startV, mode, zones = [], nums = /* @
|
|
|
51243
51244
|
const st = c.prId != null ? styles.charPr.get(c.prId) : void 0;
|
|
51244
51245
|
if (!st) continue;
|
|
51245
51246
|
const cp = c.ch.codePointAt(0);
|
|
51246
|
-
const
|
|
51247
|
+
const font = c.ch !== " " && st.latin && isLatinCp(cp) ? st.latin : st;
|
|
51248
|
+
const fm = fontLineMetrics(font.face, font.hft);
|
|
51247
51249
|
any = true;
|
|
51248
51250
|
h = Math.max(h, fm ? Math.round(st.height * fm[0]) + (fm[2] ? Math.round : Math.trunc)(st.height * fm[1]) : st.height);
|
|
51249
51251
|
b = Math.max(b, fm ? Math.round(st.height * fm[0]) : Math.round(st.height * BASELINE_RATIO));
|
|
@@ -51277,7 +51279,9 @@ function reflowPara(p, doc, styles, areaW, startV, mode, zones = [], nums = /* @
|
|
|
51277
51279
|
}
|
|
51278
51280
|
}
|
|
51279
51281
|
const vertpos = v;
|
|
51280
|
-
const
|
|
51282
|
+
const nextStart = textposOf[li + 1], nextChar = m.chars[nextStart];
|
|
51283
|
+
const boundaryH = !m.objs.length && !geom.fontLineHeight && nextChar?.ch.trim() && m.runs.some((r) => r.at === nextStart && r.prId === nextChar.prId) ? heightOf(nextChar.prId) : 0;
|
|
51284
|
+
const occupiedH = Math.max(lineH, collisionHeights[li] ?? 0, boundaryH);
|
|
51281
51285
|
v += lineH + spacing;
|
|
51282
51286
|
const isFirst = li === 0;
|
|
51283
51287
|
const seg = doc.createElement("hp:lineseg");
|
|
@@ -51763,205 +51767,6 @@ function flowEndNotes(root, bodyH) {
|
|
|
51763
51767
|
});
|
|
51764
51768
|
}
|
|
51765
51769
|
|
|
51766
|
-
// src/render/equation-text.ts
|
|
51767
|
-
var SYMBOLS = {
|
|
51768
|
-
alpha: "\u03B1",
|
|
51769
|
-
beta: "\u03B2",
|
|
51770
|
-
gamma: "\u03B3",
|
|
51771
|
-
delta: "\u03B4",
|
|
51772
|
-
epsilon: "\u03B5",
|
|
51773
|
-
varepsilon: "\u03B5",
|
|
51774
|
-
zeta: "\u03B6",
|
|
51775
|
-
eta: "\u03B7",
|
|
51776
|
-
theta: "\u03B8",
|
|
51777
|
-
vartheta: "\u03D1",
|
|
51778
|
-
iota: "\u03B9",
|
|
51779
|
-
kappa: "\u03BA",
|
|
51780
|
-
lambda: "\u03BB",
|
|
51781
|
-
mu: "\u03BC",
|
|
51782
|
-
nu: "\u03BD",
|
|
51783
|
-
xi: "\u03BE",
|
|
51784
|
-
pi: "\u03C0",
|
|
51785
|
-
rho: "\u03C1",
|
|
51786
|
-
sigma: "\u03C3",
|
|
51787
|
-
tau: "\u03C4",
|
|
51788
|
-
upsilon: "\u03C5",
|
|
51789
|
-
phi: "\u03C6",
|
|
51790
|
-
varphi: "\u03C6",
|
|
51791
|
-
chi: "\u03C7",
|
|
51792
|
-
psi: "\u03C8",
|
|
51793
|
-
omega: "\u03C9",
|
|
51794
|
-
Gamma: "\u0393",
|
|
51795
|
-
Delta: "\u0394",
|
|
51796
|
-
Theta: "\u0398",
|
|
51797
|
-
Lambda: "\u039B",
|
|
51798
|
-
Xi: "\u039E",
|
|
51799
|
-
Pi: "\u03A0",
|
|
51800
|
-
Sigma: "\u03A3",
|
|
51801
|
-
Phi: "\u03A6",
|
|
51802
|
-
Psi: "\u03A8",
|
|
51803
|
-
Omega: "\u03A9",
|
|
51804
|
-
times: "\xD7",
|
|
51805
|
-
cdot: "\xB7",
|
|
51806
|
-
div: "\xF7",
|
|
51807
|
-
pm: "\xB1",
|
|
51808
|
-
mp: "\u2213",
|
|
51809
|
-
le: "\u2264",
|
|
51810
|
-
leq: "\u2264",
|
|
51811
|
-
ge: "\u2265",
|
|
51812
|
-
geq: "\u2265",
|
|
51813
|
-
ne: "\u2260",
|
|
51814
|
-
neq: "\u2260",
|
|
51815
|
-
approx: "\u2248",
|
|
51816
|
-
equiv: "\u2261",
|
|
51817
|
-
sim: "\u223C",
|
|
51818
|
-
infty: "\u221E",
|
|
51819
|
-
rightarrow: "\u2192",
|
|
51820
|
-
leftarrow: "\u2190",
|
|
51821
|
-
Rightarrow: "\u21D2",
|
|
51822
|
-
Leftarrow: "\u21D0",
|
|
51823
|
-
leftrightarrow: "\u2194",
|
|
51824
|
-
Leftrightarrow: "\u21D4",
|
|
51825
|
-
to: "\u2192",
|
|
51826
|
-
angle: "\u2220",
|
|
51827
|
-
triangle: "\u25B3",
|
|
51828
|
-
perp: "\u22A5",
|
|
51829
|
-
parallel: "\u2225",
|
|
51830
|
-
circ: "\u2218",
|
|
51831
|
-
degree: "\xB0",
|
|
51832
|
-
sum: "\u03A3",
|
|
51833
|
-
prod: "\u03A0",
|
|
51834
|
-
int: "\u222B",
|
|
51835
|
-
oint: "\u222E",
|
|
51836
|
-
partial: "\u2202",
|
|
51837
|
-
nabla: "\u2207",
|
|
51838
|
-
in: "\u2208",
|
|
51839
|
-
notin: "\u2209",
|
|
51840
|
-
subset: "\u2282",
|
|
51841
|
-
supset: "\u2283",
|
|
51842
|
-
subseteq: "\u2286",
|
|
51843
|
-
supseteq: "\u2287",
|
|
51844
|
-
cup: "\u222A",
|
|
51845
|
-
cap: "\u2229",
|
|
51846
|
-
emptyset: "\u2205",
|
|
51847
|
-
forall: "\u2200",
|
|
51848
|
-
exists: "\u2203",
|
|
51849
|
-
therefore: "\u2234",
|
|
51850
|
-
because: "\u2235",
|
|
51851
|
-
prime: "\u2032",
|
|
51852
|
-
cdots: "\u22EF",
|
|
51853
|
-
ldots: "\u2026",
|
|
51854
|
-
dots: "\u2026",
|
|
51855
|
-
vdots: "\u22EE",
|
|
51856
|
-
lim: "lim",
|
|
51857
|
-
log: "log",
|
|
51858
|
-
ln: "ln",
|
|
51859
|
-
sin: "sin",
|
|
51860
|
-
cos: "cos",
|
|
51861
|
-
tan: "tan",
|
|
51862
|
-
sec: "sec",
|
|
51863
|
-
csc: "csc",
|
|
51864
|
-
cot: "cot",
|
|
51865
|
-
exp: "exp",
|
|
51866
|
-
max: "max",
|
|
51867
|
-
min: "min",
|
|
51868
|
-
quad: " ",
|
|
51869
|
-
qquad: " ",
|
|
51870
|
-
",": " ",
|
|
51871
|
-
";": " ",
|
|
51872
|
-
"!": "",
|
|
51873
|
-
"{": "{",
|
|
51874
|
-
"}": "}",
|
|
51875
|
-
"|": "\u2016",
|
|
51876
|
-
backslash: "\\",
|
|
51877
|
-
lbrace: "{",
|
|
51878
|
-
rbrace: "}",
|
|
51879
|
-
langle: "\u27E8",
|
|
51880
|
-
rangle: "\u27E9"
|
|
51881
|
-
};
|
|
51882
|
-
var SUP = { "0": "\u2070", "1": "\xB9", "2": "\xB2", "3": "\xB3", "4": "\u2074", "5": "\u2075", "6": "\u2076", "7": "\u2077", "8": "\u2078", "9": "\u2079", "+": "\u207A", "-": "\u207B", "=": "\u207C", "(": "\u207D", ")": "\u207E", n: "\u207F", i: "\u2071", x: "\u02E3", "\u2032": "\u2032" };
|
|
51883
|
-
var SUB = { "0": "\u2080", "1": "\u2081", "2": "\u2082", "3": "\u2083", "4": "\u2084", "5": "\u2085", "6": "\u2086", "7": "\u2087", "8": "\u2088", "9": "\u2089", "+": "\u208A", "-": "\u208B", "=": "\u208C", "(": "\u208D", ")": "\u208E" };
|
|
51884
|
-
function latexToPlain(latex) {
|
|
51885
|
-
let i = 0;
|
|
51886
|
-
const s = latex;
|
|
51887
|
-
const skipWs = () => {
|
|
51888
|
-
while (i < s.length && s[i] === " ") i++;
|
|
51889
|
-
};
|
|
51890
|
-
const arg = () => {
|
|
51891
|
-
skipWs();
|
|
51892
|
-
if (s[i] === "{") {
|
|
51893
|
-
i++;
|
|
51894
|
-
const v = seq("}");
|
|
51895
|
-
i++;
|
|
51896
|
-
return v;
|
|
51897
|
-
}
|
|
51898
|
-
return atom();
|
|
51899
|
-
};
|
|
51900
|
-
const wrap = (v) => v.length > 1 && !/^[\w.′]+$|^\(.*\)$/u.test(v) ? `(${v})` : v;
|
|
51901
|
-
const script = (v, map, mark) => {
|
|
51902
|
-
const t = v.trim();
|
|
51903
|
-
return [...t].every((c) => map[c]) ? [...t].map((c) => map[c]).join("") : `${mark}${wrap(t)}`;
|
|
51904
|
-
};
|
|
51905
|
-
const atom = () => {
|
|
51906
|
-
const c = s[i];
|
|
51907
|
-
if (c === void 0) return "";
|
|
51908
|
-
if (c === "\\") {
|
|
51909
|
-
i++;
|
|
51910
|
-
let name = "";
|
|
51911
|
-
if (/[A-Za-z]/.test(s[i] ?? "")) while (/[A-Za-z]/.test(s[i] ?? "")) name += s[i++];
|
|
51912
|
-
else name = s[i++] ?? "";
|
|
51913
|
-
if (name === "frac") {
|
|
51914
|
-
const a = arg(), b = arg();
|
|
51915
|
-
return `${wrap(a.trim())}/${wrap(b.trim())}`;
|
|
51916
|
-
}
|
|
51917
|
-
if (name === "sqrt") {
|
|
51918
|
-
skipWs();
|
|
51919
|
-
let root = "";
|
|
51920
|
-
if (s[i] === "[") {
|
|
51921
|
-
i++;
|
|
51922
|
-
root = seq("]");
|
|
51923
|
-
i++;
|
|
51924
|
-
}
|
|
51925
|
-
const a = arg();
|
|
51926
|
-
return `${root ? script(root, SUP, "") : ""}\u221A${wrap(a.trim())}`;
|
|
51927
|
-
}
|
|
51928
|
-
if (name === "left" || name === "right" || name === "big" || name === "Big" || name === "bigg" || name === "Bigg") {
|
|
51929
|
-
skipWs();
|
|
51930
|
-
const d = s[i] === "\\" ? atom() : s[i++] ?? "";
|
|
51931
|
-
return d === "." ? "" : d;
|
|
51932
|
-
}
|
|
51933
|
-
if (name === "overline" || name === "bar" || name === "hat" || name === "vec" || name === "dot" || name === "tilde") {
|
|
51934
|
-
const a = arg().trim(), mark = { overline: "\u0305", bar: "\u0304", hat: "\u0302", vec: "\u20D7", dot: "\u0307", tilde: "\u0303" }[name];
|
|
51935
|
-
return [...a].map((ch) => ch + mark).join("");
|
|
51936
|
-
}
|
|
51937
|
-
if (name === "mathrm" || name === "text" || name === "rm" || name === "mathbf" || name === "it" || name === "mathit" || name === "operatorname") return name === "rm" || name === "it" ? "" : arg();
|
|
51938
|
-
return SYMBOLS[name] ?? name;
|
|
51939
|
-
}
|
|
51940
|
-
i++;
|
|
51941
|
-
if (c === "{") {
|
|
51942
|
-
const v = seq("}");
|
|
51943
|
-
i++;
|
|
51944
|
-
return v;
|
|
51945
|
-
}
|
|
51946
|
-
if (c === "^") return script(arg(), SUP, "^");
|
|
51947
|
-
if (c === "_") return script(arg(), SUB, "_");
|
|
51948
|
-
if (c === "~" || c === "`") return " ";
|
|
51949
|
-
return c;
|
|
51950
|
-
};
|
|
51951
|
-
const seq = (end) => {
|
|
51952
|
-
let out = "";
|
|
51953
|
-
while (i < s.length && s[i] !== end) {
|
|
51954
|
-
if (s[i] === " ") {
|
|
51955
|
-
i++;
|
|
51956
|
-
continue;
|
|
51957
|
-
}
|
|
51958
|
-
out += atom();
|
|
51959
|
-
}
|
|
51960
|
-
return out;
|
|
51961
|
-
};
|
|
51962
|
-
return seq("\0").replace(/\s+/g, " ").trim();
|
|
51963
|
-
}
|
|
51964
|
-
|
|
51965
51770
|
// src/render/scene.ts
|
|
51966
51771
|
function regionId(type, seq) {
|
|
51967
51772
|
return `${type}-${String(seq).padStart(6, "0")}`;
|
|
@@ -52536,6 +52341,205 @@ function shapeGeometry(o, boxX, boxY, defs, images, warn, local = false) {
|
|
|
52536
52341
|
return { ...geometry, svg };
|
|
52537
52342
|
}
|
|
52538
52343
|
|
|
52344
|
+
// src/render/equation-text.ts
|
|
52345
|
+
var SYMBOLS = {
|
|
52346
|
+
alpha: "\u03B1",
|
|
52347
|
+
beta: "\u03B2",
|
|
52348
|
+
gamma: "\u03B3",
|
|
52349
|
+
delta: "\u03B4",
|
|
52350
|
+
epsilon: "\u03B5",
|
|
52351
|
+
varepsilon: "\u03B5",
|
|
52352
|
+
zeta: "\u03B6",
|
|
52353
|
+
eta: "\u03B7",
|
|
52354
|
+
theta: "\u03B8",
|
|
52355
|
+
vartheta: "\u03D1",
|
|
52356
|
+
iota: "\u03B9",
|
|
52357
|
+
kappa: "\u03BA",
|
|
52358
|
+
lambda: "\u03BB",
|
|
52359
|
+
mu: "\u03BC",
|
|
52360
|
+
nu: "\u03BD",
|
|
52361
|
+
xi: "\u03BE",
|
|
52362
|
+
pi: "\u03C0",
|
|
52363
|
+
rho: "\u03C1",
|
|
52364
|
+
sigma: "\u03C3",
|
|
52365
|
+
tau: "\u03C4",
|
|
52366
|
+
upsilon: "\u03C5",
|
|
52367
|
+
phi: "\u03C6",
|
|
52368
|
+
varphi: "\u03C6",
|
|
52369
|
+
chi: "\u03C7",
|
|
52370
|
+
psi: "\u03C8",
|
|
52371
|
+
omega: "\u03C9",
|
|
52372
|
+
Gamma: "\u0393",
|
|
52373
|
+
Delta: "\u0394",
|
|
52374
|
+
Theta: "\u0398",
|
|
52375
|
+
Lambda: "\u039B",
|
|
52376
|
+
Xi: "\u039E",
|
|
52377
|
+
Pi: "\u03A0",
|
|
52378
|
+
Sigma: "\u03A3",
|
|
52379
|
+
Phi: "\u03A6",
|
|
52380
|
+
Psi: "\u03A8",
|
|
52381
|
+
Omega: "\u03A9",
|
|
52382
|
+
times: "\xD7",
|
|
52383
|
+
cdot: "\xB7",
|
|
52384
|
+
div: "\xF7",
|
|
52385
|
+
pm: "\xB1",
|
|
52386
|
+
mp: "\u2213",
|
|
52387
|
+
le: "\u2264",
|
|
52388
|
+
leq: "\u2264",
|
|
52389
|
+
ge: "\u2265",
|
|
52390
|
+
geq: "\u2265",
|
|
52391
|
+
ne: "\u2260",
|
|
52392
|
+
neq: "\u2260",
|
|
52393
|
+
approx: "\u2248",
|
|
52394
|
+
equiv: "\u2261",
|
|
52395
|
+
sim: "\u223C",
|
|
52396
|
+
infty: "\u221E",
|
|
52397
|
+
rightarrow: "\u2192",
|
|
52398
|
+
leftarrow: "\u2190",
|
|
52399
|
+
Rightarrow: "\u21D2",
|
|
52400
|
+
Leftarrow: "\u21D0",
|
|
52401
|
+
leftrightarrow: "\u2194",
|
|
52402
|
+
Leftrightarrow: "\u21D4",
|
|
52403
|
+
to: "\u2192",
|
|
52404
|
+
angle: "\u2220",
|
|
52405
|
+
triangle: "\u25B3",
|
|
52406
|
+
perp: "\u22A5",
|
|
52407
|
+
parallel: "\u2225",
|
|
52408
|
+
circ: "\u2218",
|
|
52409
|
+
degree: "\xB0",
|
|
52410
|
+
sum: "\u03A3",
|
|
52411
|
+
prod: "\u03A0",
|
|
52412
|
+
int: "\u222B",
|
|
52413
|
+
oint: "\u222E",
|
|
52414
|
+
partial: "\u2202",
|
|
52415
|
+
nabla: "\u2207",
|
|
52416
|
+
in: "\u2208",
|
|
52417
|
+
notin: "\u2209",
|
|
52418
|
+
subset: "\u2282",
|
|
52419
|
+
supset: "\u2283",
|
|
52420
|
+
subseteq: "\u2286",
|
|
52421
|
+
supseteq: "\u2287",
|
|
52422
|
+
cup: "\u222A",
|
|
52423
|
+
cap: "\u2229",
|
|
52424
|
+
emptyset: "\u2205",
|
|
52425
|
+
forall: "\u2200",
|
|
52426
|
+
exists: "\u2203",
|
|
52427
|
+
therefore: "\u2234",
|
|
52428
|
+
because: "\u2235",
|
|
52429
|
+
prime: "\u2032",
|
|
52430
|
+
cdots: "\u22EF",
|
|
52431
|
+
ldots: "\u2026",
|
|
52432
|
+
dots: "\u2026",
|
|
52433
|
+
vdots: "\u22EE",
|
|
52434
|
+
lim: "lim",
|
|
52435
|
+
log: "log",
|
|
52436
|
+
ln: "ln",
|
|
52437
|
+
sin: "sin",
|
|
52438
|
+
cos: "cos",
|
|
52439
|
+
tan: "tan",
|
|
52440
|
+
sec: "sec",
|
|
52441
|
+
csc: "csc",
|
|
52442
|
+
cot: "cot",
|
|
52443
|
+
exp: "exp",
|
|
52444
|
+
max: "max",
|
|
52445
|
+
min: "min",
|
|
52446
|
+
quad: " ",
|
|
52447
|
+
qquad: " ",
|
|
52448
|
+
",": " ",
|
|
52449
|
+
";": " ",
|
|
52450
|
+
"!": "",
|
|
52451
|
+
"{": "{",
|
|
52452
|
+
"}": "}",
|
|
52453
|
+
"|": "\u2016",
|
|
52454
|
+
backslash: "\\",
|
|
52455
|
+
lbrace: "{",
|
|
52456
|
+
rbrace: "}",
|
|
52457
|
+
langle: "\u27E8",
|
|
52458
|
+
rangle: "\u27E9"
|
|
52459
|
+
};
|
|
52460
|
+
var SUP = { "0": "\u2070", "1": "\xB9", "2": "\xB2", "3": "\xB3", "4": "\u2074", "5": "\u2075", "6": "\u2076", "7": "\u2077", "8": "\u2078", "9": "\u2079", "+": "\u207A", "-": "\u207B", "=": "\u207C", "(": "\u207D", ")": "\u207E", n: "\u207F", i: "\u2071", x: "\u02E3", "\u2032": "\u2032" };
|
|
52461
|
+
var SUB = { "0": "\u2080", "1": "\u2081", "2": "\u2082", "3": "\u2083", "4": "\u2084", "5": "\u2085", "6": "\u2086", "7": "\u2087", "8": "\u2088", "9": "\u2089", "+": "\u208A", "-": "\u208B", "=": "\u208C", "(": "\u208D", ")": "\u208E" };
|
|
52462
|
+
function latexToPlain(latex) {
|
|
52463
|
+
let i = 0;
|
|
52464
|
+
const s = latex;
|
|
52465
|
+
const skipWs = () => {
|
|
52466
|
+
while (i < s.length && s[i] === " ") i++;
|
|
52467
|
+
};
|
|
52468
|
+
const arg = () => {
|
|
52469
|
+
skipWs();
|
|
52470
|
+
if (s[i] === "{") {
|
|
52471
|
+
i++;
|
|
52472
|
+
const v = seq("}");
|
|
52473
|
+
i++;
|
|
52474
|
+
return v;
|
|
52475
|
+
}
|
|
52476
|
+
return atom();
|
|
52477
|
+
};
|
|
52478
|
+
const wrap = (v) => v.length > 1 && !/^[\w.′]+$|^\(.*\)$/u.test(v) ? `(${v})` : v;
|
|
52479
|
+
const script = (v, map, mark) => {
|
|
52480
|
+
const t = v.trim();
|
|
52481
|
+
return [...t].every((c) => map[c]) ? [...t].map((c) => map[c]).join("") : `${mark}${wrap(t)}`;
|
|
52482
|
+
};
|
|
52483
|
+
const atom = () => {
|
|
52484
|
+
const c = s[i];
|
|
52485
|
+
if (c === void 0) return "";
|
|
52486
|
+
if (c === "\\") {
|
|
52487
|
+
i++;
|
|
52488
|
+
let name = "";
|
|
52489
|
+
if (/[A-Za-z]/.test(s[i] ?? "")) while (/[A-Za-z]/.test(s[i] ?? "")) name += s[i++];
|
|
52490
|
+
else name = s[i++] ?? "";
|
|
52491
|
+
if (name === "frac") {
|
|
52492
|
+
const a = arg(), b = arg();
|
|
52493
|
+
return `${wrap(a.trim())}/${wrap(b.trim())}`;
|
|
52494
|
+
}
|
|
52495
|
+
if (name === "sqrt") {
|
|
52496
|
+
skipWs();
|
|
52497
|
+
let root = "";
|
|
52498
|
+
if (s[i] === "[") {
|
|
52499
|
+
i++;
|
|
52500
|
+
root = seq("]");
|
|
52501
|
+
i++;
|
|
52502
|
+
}
|
|
52503
|
+
const a = arg();
|
|
52504
|
+
return `${root ? script(root, SUP, "") : ""}\u221A${wrap(a.trim())}`;
|
|
52505
|
+
}
|
|
52506
|
+
if (name === "left" || name === "right" || name === "big" || name === "Big" || name === "bigg" || name === "Bigg") {
|
|
52507
|
+
skipWs();
|
|
52508
|
+
const d = s[i] === "\\" ? atom() : s[i++] ?? "";
|
|
52509
|
+
return d === "." ? "" : d;
|
|
52510
|
+
}
|
|
52511
|
+
if (name === "overline" || name === "bar" || name === "hat" || name === "vec" || name === "dot" || name === "tilde") {
|
|
52512
|
+
const a = arg().trim(), mark = { overline: "\u0305", bar: "\u0304", hat: "\u0302", vec: "\u20D7", dot: "\u0307", tilde: "\u0303" }[name];
|
|
52513
|
+
return [...a].map((ch) => ch + mark).join("");
|
|
52514
|
+
}
|
|
52515
|
+
if (name === "mathrm" || name === "text" || name === "rm" || name === "mathbf" || name === "it" || name === "mathit" || name === "operatorname") return name === "rm" || name === "it" ? "" : arg();
|
|
52516
|
+
return SYMBOLS[name] ?? name;
|
|
52517
|
+
}
|
|
52518
|
+
i++;
|
|
52519
|
+
if (c === "{") {
|
|
52520
|
+
const v = seq("}");
|
|
52521
|
+
i++;
|
|
52522
|
+
return v;
|
|
52523
|
+
}
|
|
52524
|
+
if (c === "^") return script(arg(), SUP, "^");
|
|
52525
|
+
if (c === "_") return script(arg(), SUB, "_");
|
|
52526
|
+
if (c === "~" || c === "`") return " ";
|
|
52527
|
+
return c;
|
|
52528
|
+
};
|
|
52529
|
+
const seq = (end) => {
|
|
52530
|
+
let out = "";
|
|
52531
|
+
while (i < s.length && s[i] !== end) {
|
|
52532
|
+
if (s[i] === " ") {
|
|
52533
|
+
i++;
|
|
52534
|
+
continue;
|
|
52535
|
+
}
|
|
52536
|
+
out += atom();
|
|
52537
|
+
}
|
|
52538
|
+
return out;
|
|
52539
|
+
};
|
|
52540
|
+
return seq("\0").replace(/\s+/g, " ").trim();
|
|
52541
|
+
}
|
|
52542
|
+
|
|
52539
52543
|
// src/render/object-anchor.ts
|
|
52540
52544
|
function anchorObject(o, ox, oy, baseV, areaW, ctx, anchorLineV, stayLine = false, paraStartV, laterLineH) {
|
|
52541
52545
|
const { PW, PH, ML, MT, BODY_W, BODY_H } = ctx.geom;
|
|
@@ -52579,7 +52583,7 @@ function anchorObject(o, ox, oy, baseV, areaW, ctx, anchorLineV, stayLine = fals
|
|
|
52579
52583
|
return { x, y };
|
|
52580
52584
|
}
|
|
52581
52585
|
|
|
52582
|
-
// src/render/svg-
|
|
52586
|
+
// src/render/svg-content.ts
|
|
52583
52587
|
function escapeXml7(s) {
|
|
52584
52588
|
return s.replace(/[\x00-\x08\x0B\x0C\x0E-\x1F]/g, "").replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """);
|
|
52585
52589
|
}
|
|
@@ -52629,7 +52633,8 @@ function planLines(m, styles, numText = "") {
|
|
|
52629
52633
|
const bu = geom?.bullet ?? (numText && geom?.number ? { ch: numText, ...geom.number } : void 0);
|
|
52630
52634
|
const firstPr = m.chars.find((c) => c.ch !== "")?.prId ?? null;
|
|
52631
52635
|
const bst = (bu?.charPrId != null ? styles.charPr.get(bu.charPrId) : firstPr != null ? styles.charPr.get(firstPr) : void 0) ?? DEFAULT_CHAR;
|
|
52632
|
-
const
|
|
52636
|
+
const headW = bu?.useInstWidth === false ? [...bu.ch].reduce((w, ch) => w + glyphWidth(ch, bst, false).w, 0) : bu ? measureTextWidth(bu.ch, bst.height, bst.ratio, { spacingPct: bst.spacing, faceClass: faceClassOf(bst.face) }) : 0;
|
|
52637
|
+
const bulletW = bu ? paraHeadAdvance(bu, bst.height, headW) : 0;
|
|
52633
52638
|
const plans = [];
|
|
52634
52639
|
for (let i = 0; i < m.segs.length; i++) {
|
|
52635
52640
|
const seg = m.segs[i];
|
|
@@ -52964,8 +52969,8 @@ function drawObject(o, x, y, baseV, areaW, ctx, depth) {
|
|
|
52964
52969
|
x = ox;
|
|
52965
52970
|
y = oy;
|
|
52966
52971
|
}
|
|
52967
|
-
if (o.tag === "tbl")
|
|
52968
|
-
else if (o.tag === "pic")
|
|
52972
|
+
if (o.tag === "tbl") ctx.draw.table(o.el, x, y, ctx, depth + 1);
|
|
52973
|
+
else if (o.tag === "pic") ctx.draw.pic(o.el, x, y, ctx);
|
|
52969
52974
|
else if (o.tag === "container") {
|
|
52970
52975
|
if (drawGroupByMatrix(o, x, y, baseV, areaW, ctx, depth)) return;
|
|
52971
52976
|
for (const ch of elements(o.el)) {
|
|
@@ -53021,7 +53026,7 @@ function drawGroupByMatrix(o, x, y, baseV, areaW, ctx, depth) {
|
|
|
53021
53026
|
ctx.regionRotations.push(m);
|
|
53022
53027
|
emit(ctx, `<g transform="matrix(${m.slice(0, 4).map((v) => Math.round(v * 1e6) / 1e6).join(" ")} ${pt2(m[4])} ${pt2(m[5])})">`);
|
|
53023
53028
|
const sub = { el: leaf, tag, index: 0, inline: true, width: w, height: h, omL: 0, omR: 0 };
|
|
53024
|
-
if (tag === "pic")
|
|
53029
|
+
if (tag === "pic") ctx.draw.picFrame(leaf, 0, 0, w, h, "", ctx);
|
|
53025
53030
|
else if (SHAPE_TAGS.has(tag)) drawShape(sub, 0, 0, ctx, depth + 1, [Math.hypot(m[0], m[1]) || 1, Math.hypot(m[2], m[3]) || 1]);
|
|
53026
53031
|
else drawObject(sub, 0, 0, baseV, areaW, ctx, depth + 1);
|
|
53027
53032
|
emit(ctx, "</g>");
|
|
@@ -53069,6 +53074,8 @@ function drawShape(o, x, y, ctx, depth, groupScale) {
|
|
|
53069
53074
|
ctx.parentStack.pop();
|
|
53070
53075
|
emit(ctx, "</g>");
|
|
53071
53076
|
}
|
|
53077
|
+
|
|
53078
|
+
// src/render/svg-render.ts
|
|
53072
53079
|
function edgeLine(x1, y1, x2, y2, e) {
|
|
53073
53080
|
const dash = /DASH|DOT/.test(e.type) ? ` stroke-dasharray="${e.type.includes("DOT") ? "1,1.5" : "3,1.5"}"` : "";
|
|
53074
53081
|
return `<line x1="${pt2(x1)}" y1="${pt2(y1)}" x2="${pt2(x2)}" y2="${pt2(y2)}" stroke="${escapeXml7(e.color)}" stroke-width="${e.widthPt.toFixed(2)}"${dash}/>`;
|
|
@@ -53683,6 +53690,7 @@ function drawPageNumbers(root, paraPages, ctx) {
|
|
|
53683
53690
|
}
|
|
53684
53691
|
function renderSectionRoots(sections, input) {
|
|
53685
53692
|
const ctxBase = {
|
|
53693
|
+
draw: { table: drawTable, pic: drawPic, picFrame: drawPicFrame },
|
|
53686
53694
|
styles: input.styles,
|
|
53687
53695
|
images: input.images,
|
|
53688
53696
|
defs: [],
|
|
@@ -54841,7 +54849,7 @@ function scriptsOff(r, off) {
|
|
|
54841
54849
|
}
|
|
54842
54850
|
async function parseImage(buffer, options) {
|
|
54843
54851
|
try {
|
|
54844
|
-
const { parseImageDocument } = await import("./image-ocr-
|
|
54852
|
+
const { parseImageDocument } = await import("./image-ocr-KE3RUS3R.js");
|
|
54845
54853
|
const { blocks, warnings, lines } = await parseImageDocument(buffer, options);
|
|
54846
54854
|
stripScriptTags({ blocks });
|
|
54847
54855
|
return {
|
|
@@ -54905,7 +54913,7 @@ async function parseHwp(buffer, options) {
|
|
|
54905
54913
|
async function parsePdf(buffer, options) {
|
|
54906
54914
|
let parsePdfDocument;
|
|
54907
54915
|
try {
|
|
54908
|
-
const mod = await import("./parser-
|
|
54916
|
+
const mod = await import("./parser-WBKVRDPV.js");
|
|
54909
54917
|
parsePdfDocument = mod.parsePdfDocument;
|
|
54910
54918
|
} catch {
|
|
54911
54919
|
return {
|