kordoc 4.25.4 → 4.25.6
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/NOTICE +27 -0
- package/README.md +4 -4
- package/dist/{chunk-E6GI46SG.js → chunk-24J4EDVI.js} +2 -2
- package/dist/{chunk-ZG6RALGH.js → chunk-2RBIZALD.js} +8 -8
- package/dist/{chunk-FDGWDXAD.js → chunk-2VNL3FDS.js} +2 -2
- package/dist/{chunk-RZOEJ5TZ.js → chunk-3URB7DI4.js} +2 -2
- package/dist/{chunk-T7CUC2NM.js → chunk-3Y76RPK3.js} +6 -6
- package/dist/{chunk-LQ3FFPJ6.js → chunk-6L3VEOCI.js} +5 -5
- package/dist/{chunk-UAUB6Y5Z.js → chunk-6ZUQ6D3B.js} +6 -6
- package/dist/{chunk-HR2KFPXI.js → chunk-767ACEVN.js} +10 -4
- package/dist/{chunk-HR2KFPXI.js.map → chunk-767ACEVN.js.map} +2 -2
- package/dist/{chunk-M2V4WP7W.js → chunk-D2WQC6ME.js} +314 -22
- package/dist/chunk-D2WQC6ME.js.map +7 -0
- package/dist/{chunk-4XD2IEF7.js → chunk-D6MGUFRQ.js} +10 -10
- package/dist/{chunk-JKWHGHNW.js → chunk-DTUCE7H2.js} +2 -2
- package/dist/{chunk-RVUX6HWM.js → chunk-EDCNR6QZ.js} +2 -2
- package/dist/{chunk-V2TGRTXA.js → chunk-HMTLJJEC.js} +2 -2
- package/dist/{chunk-JNRXFGHU.js → chunk-I7MD3WQR.js} +2 -2
- package/dist/{chunk-35WXNRU4.js → chunk-IKQMEXGU.js} +4 -4
- package/dist/{chunk-MGVESXR2.js → chunk-ILUYLDIW.js} +4 -4
- package/dist/{chunk-PVZRQRIE.js → chunk-IOADEIUV.js} +3 -3
- package/dist/{chunk-MQCNWXMU.js → chunk-K4YTD6RG.js} +55 -7
- package/dist/{chunk-MQCNWXMU.js.map → chunk-K4YTD6RG.js.map} +2 -2
- package/dist/{chunk-A5DP2XNA.js → chunk-O4XRI7EC.js} +6 -6
- package/dist/{chunk-CO2A2WC5.js → chunk-QQVTLNLV.js} +2 -2
- package/dist/{chunk-FLHUJYGP.js → chunk-S4NQTGXD.js} +2 -2
- package/dist/{chunk-XS7MBWUH.js → chunk-TH7SIDYM.js} +2 -2
- package/dist/{chunk-KLWTVM6B.js → chunk-VDF7ZVNW.js} +2 -2
- package/dist/{chunk-FVDYN3E7.js → chunk-VHZYGCS4.js} +3 -3
- package/dist/{chunk-TWAXYEO2.js → chunk-VLOQQJ2D.js} +2 -2
- package/dist/{chunk-SEX4BBAX.js → chunk-XI47ZEQB.js} +2 -2
- package/dist/{chunk-ERNLA4BH.js → chunk-ZEJCW4XP.js} +2 -2
- package/dist/chunks-GPCDFBSF.js +10 -0
- package/dist/cli.js +52 -39
- package/dist/cli.js.map +2 -2
- package/dist/{formula-TAHOTZCD.js → formula-R6LXXMAS.js} +4 -4
- package/dist/{generator-UNGTBZVD.js → generator-ERKQ7LUN.js} +7 -7
- package/dist/{hancom-Q3SEMBRZ.js → hancom-VQUG46NV.js} +2 -2
- package/dist/{image-ocr-E3KNVXGP.js → image-ocr-MWQ6UDGP.js} +11 -11
- package/dist/index.cjs +473 -36
- package/dist/index.cjs.map +4 -4
- package/dist/index.d.cts +83 -2
- package/dist/index.d.ts +83 -2
- package/dist/index.js +27 -20
- package/dist/mcp.js +39 -36
- package/dist/mcp.js.map +2 -2
- package/dist/memo-7UFH4MNW.js +15 -0
- package/dist/{model-bundle-SNYPWRM5.js → model-bundle-3F33HOS2.js} +5 -5
- package/dist/{models-EMLB76WT.js → models-PD6EQIHL.js} +5 -5
- package/dist/{page-images-HZ2DRJGX.js → page-images-MZECTCSJ.js} +2 -2
- package/dist/{parse-worker-v2-XQPQK5RR.js → parse-worker-v2-ZXURNYJZ.js} +25 -22
- package/dist/{parse-worker-v2-XQPQK5RR.js.map → parse-worker-v2-ZXURNYJZ.js.map} +1 -1
- package/dist/{parser-MAPRIHZS.js → parser-WAJNO5VU.js} +108 -18
- package/dist/parser-WAJNO5VU.js.map +7 -0
- package/dist/{pdf-ocr-GB3Z5UHQ.js → pdf-ocr-GTVOOQNV.js} +9 -9
- package/dist/{profile-io-EVGG3THS.js → profile-io-UQSLXMWG.js} +3 -3
- package/dist/{rasterize-7PQL2TCQ.js → rasterize-3QDKNJC3.js} +3 -3
- package/dist/{redact-XWZQ7XUF.js → redact-M5UJUA23.js} +2 -2
- package/dist/{redact-doc-364J2TKR.js → redact-doc-IBLP55CI.js} +41 -24
- package/dist/{redact-doc-364J2TKR.js.map → redact-doc-IBLP55CI.js.map} +2 -2
- package/dist/{render-AZ5YXHUA.js → render-EPOTL6LB.js} +10 -10
- package/dist/{rewrite-fallback-VTXOOSUU.js → rewrite-fallback-5GPUDXDK.js} +12 -12
- package/dist/seal-7YV46Q77.js +14 -0
- package/dist/{setup-6NQLZAV2.js → setup-CTWIURYW.js} +3 -3
- package/dist/{to-hwpx-ULUHUGBZ.js → to-hwpx-OJNCWBXT.js} +7 -7
- package/dist/visual-U7X4QE2V.js +42 -0
- package/dist/{watch-5FI3NIL2.js → watch-NXUTGUPA.js} +24 -22
- package/dist/{watch-5FI3NIL2.js.map → watch-NXUTGUPA.js.map} +1 -1
- package/package.json +1 -1
- package/dist/chunk-M2V4WP7W.js.map +0 -7
- package/dist/chunks-WSSD23QG.js +0 -10
- package/dist/memo-BK5AJ3GY.js +0 -15
- package/dist/parser-MAPRIHZS.js.map +0 -7
- package/dist/seal-A3HZQLN5.js +0 -14
- package/dist/visual-VXECTX4R.js +0 -39
- /package/dist/{chunk-E6GI46SG.js.map → chunk-24J4EDVI.js.map} +0 -0
- /package/dist/{chunk-ZG6RALGH.js.map → chunk-2RBIZALD.js.map} +0 -0
- /package/dist/{chunk-FDGWDXAD.js.map → chunk-2VNL3FDS.js.map} +0 -0
- /package/dist/{chunk-RZOEJ5TZ.js.map → chunk-3URB7DI4.js.map} +0 -0
- /package/dist/{chunk-T7CUC2NM.js.map → chunk-3Y76RPK3.js.map} +0 -0
- /package/dist/{chunk-LQ3FFPJ6.js.map → chunk-6L3VEOCI.js.map} +0 -0
- /package/dist/{chunk-UAUB6Y5Z.js.map → chunk-6ZUQ6D3B.js.map} +0 -0
- /package/dist/{chunk-4XD2IEF7.js.map → chunk-D6MGUFRQ.js.map} +0 -0
- /package/dist/{chunk-JKWHGHNW.js.map → chunk-DTUCE7H2.js.map} +0 -0
- /package/dist/{chunk-RVUX6HWM.js.map → chunk-EDCNR6QZ.js.map} +0 -0
- /package/dist/{chunk-V2TGRTXA.js.map → chunk-HMTLJJEC.js.map} +0 -0
- /package/dist/{chunk-JNRXFGHU.js.map → chunk-I7MD3WQR.js.map} +0 -0
- /package/dist/{chunk-35WXNRU4.js.map → chunk-IKQMEXGU.js.map} +0 -0
- /package/dist/{chunk-MGVESXR2.js.map → chunk-ILUYLDIW.js.map} +0 -0
- /package/dist/{chunk-PVZRQRIE.js.map → chunk-IOADEIUV.js.map} +0 -0
- /package/dist/{chunk-A5DP2XNA.js.map → chunk-O4XRI7EC.js.map} +0 -0
- /package/dist/{chunk-CO2A2WC5.js.map → chunk-QQVTLNLV.js.map} +0 -0
- /package/dist/{chunk-FLHUJYGP.js.map → chunk-S4NQTGXD.js.map} +0 -0
- /package/dist/{chunk-XS7MBWUH.js.map → chunk-TH7SIDYM.js.map} +0 -0
- /package/dist/{chunk-KLWTVM6B.js.map → chunk-VDF7ZVNW.js.map} +0 -0
- /package/dist/{chunk-FVDYN3E7.js.map → chunk-VHZYGCS4.js.map} +0 -0
- /package/dist/{chunk-TWAXYEO2.js.map → chunk-VLOQQJ2D.js.map} +0 -0
- /package/dist/{chunk-SEX4BBAX.js.map → chunk-XI47ZEQB.js.map} +0 -0
- /package/dist/{chunk-ERNLA4BH.js.map → chunk-ZEJCW4XP.js.map} +0 -0
- /package/dist/{chunks-WSSD23QG.js.map → chunks-GPCDFBSF.js.map} +0 -0
- /package/dist/{formula-TAHOTZCD.js.map → formula-R6LXXMAS.js.map} +0 -0
- /package/dist/{generator-UNGTBZVD.js.map → generator-ERKQ7LUN.js.map} +0 -0
- /package/dist/{hancom-Q3SEMBRZ.js.map → hancom-VQUG46NV.js.map} +0 -0
- /package/dist/{image-ocr-E3KNVXGP.js.map → image-ocr-MWQ6UDGP.js.map} +0 -0
- /package/dist/{memo-BK5AJ3GY.js.map → memo-7UFH4MNW.js.map} +0 -0
- /package/dist/{model-bundle-SNYPWRM5.js.map → model-bundle-3F33HOS2.js.map} +0 -0
- /package/dist/{models-EMLB76WT.js.map → models-PD6EQIHL.js.map} +0 -0
- /package/dist/{page-images-HZ2DRJGX.js.map → page-images-MZECTCSJ.js.map} +0 -0
- /package/dist/{pdf-ocr-GB3Z5UHQ.js.map → pdf-ocr-GTVOOQNV.js.map} +0 -0
- /package/dist/{profile-io-EVGG3THS.js.map → profile-io-UQSLXMWG.js.map} +0 -0
- /package/dist/{rasterize-7PQL2TCQ.js.map → rasterize-3QDKNJC3.js.map} +0 -0
- /package/dist/{redact-XWZQ7XUF.js.map → redact-M5UJUA23.js.map} +0 -0
- /package/dist/{render-AZ5YXHUA.js.map → render-EPOTL6LB.js.map} +0 -0
- /package/dist/{rewrite-fallback-VTXOOSUU.js.map → rewrite-fallback-5GPUDXDK.js.map} +0 -0
- /package/dist/{seal-A3HZQLN5.js.map → seal-7YV46Q77.js.map} +0 -0
- /package/dist/{setup-6NQLZAV2.js.map → setup-CTWIURYW.js.map} +0 -0
- /package/dist/{to-hwpx-ULUHUGBZ.js.map → to-hwpx-OJNCWBXT.js.map} +0 -0
- /package/dist/{visual-VXECTX4R.js.map → visual-U7X4QE2V.js.map} +0 -0
package/dist/index.d.cts
CHANGED
|
@@ -2450,6 +2450,80 @@ interface ValidateResult {
|
|
|
2450
2450
|
/** HWPX 버퍼의 컨테이너 구조를 검증한다. 문제가 없으면 ok=true. */
|
|
2451
2451
|
declare function validateHwpx(buffer: ArrayBuffer | Uint8Array): Promise<ValidateResult>;
|
|
2452
2452
|
|
|
2453
|
+
/**
|
|
2454
|
+
* 수식 OCR 모델 자동 다운로드 + SHA-256 검증
|
|
2455
|
+
*
|
|
2456
|
+
* 캐시 위치: `~/.cache/kordoc/models/pix2text/`
|
|
2457
|
+
* 총 ~155MB (MFD 44MB + MFR encoder 87MB + MFR decoder 30MB + tokenizer 40KB)
|
|
2458
|
+
*
|
|
2459
|
+
* HF URL + SHA 는 Docufinder archive/rust-formula-ocr-wip 에서 검증 완료됨.
|
|
2460
|
+
* 모델 버전 갱신 시 URL + SHA 를 함께 갱신해야 한다.
|
|
2461
|
+
*/
|
|
2462
|
+
interface ModelSpec {
|
|
2463
|
+
name: string;
|
|
2464
|
+
filename: string;
|
|
2465
|
+
url: string;
|
|
2466
|
+
sha256: string;
|
|
2467
|
+
sizeMb: number;
|
|
2468
|
+
/** 폐쇄망 차단 안내 — 없으면 models --export/--import 안내 */
|
|
2469
|
+
offlineHint?: string;
|
|
2470
|
+
}
|
|
2471
|
+
interface DownloadProgress {
|
|
2472
|
+
spec: ModelSpec;
|
|
2473
|
+
/** 현재까지 다운로드한 바이트 */
|
|
2474
|
+
downloaded: number;
|
|
2475
|
+
/** 전체 바이트 (알 수 있으면) */
|
|
2476
|
+
total: number | null;
|
|
2477
|
+
/** "download" | "verify" | "done" | "skip" */
|
|
2478
|
+
phase: "download" | "verify" | "done" | "skip" | "error";
|
|
2479
|
+
message?: string;
|
|
2480
|
+
}
|
|
2481
|
+
type ProgressHandler = (p: DownloadProgress) => void;
|
|
2482
|
+
|
|
2483
|
+
/**
|
|
2484
|
+
* redact 인명·주소 학습 모델 (opt-in) — Hugging Face `schift-io/schift-ko-pii-ax-v1`(skt/A.X-Encoder-base 를 미세조정한
|
|
2485
|
+
* BIOES 태거)을 onnxruntime-node 로 돌려 인명·주소 스팬을 찾는다.
|
|
2486
|
+
*
|
|
2487
|
+
* 사전·문맥 룰(redact-name-address.ts)은 정밀도를 위해 문맥 없는 맨 이름을 일부러 놓친다. 모델은 그런 이름, 가린 이름
|
|
2488
|
+
* (홍○동·김영*), 띄어 쓴 이름(정 하 늘), 지번만 있는 표 칸까지 문장 전체를 보고 잡는 대신 문서 한 건에 수백 ms 가 든다.
|
|
2489
|
+
* 찾은 스팬은 redactText·redactMarkdown 의 `modelSpans` 로 넘기면 룰 엔진이 name·address 자리(RULE_PRIORITY)에서 사전
|
|
2490
|
+
* 룰보다 먼저 차지하고, 같은 서식 보존 마스킹(성·시·군·구는 남김)을 입힌다. 번호형 룰이 먼저 잡은 곳과 겹치면 버린다.
|
|
2491
|
+
*
|
|
2492
|
+
* 모델 파일: 리비전 고정 + SHA-256 대조, 캐시 `~/.cache/kordoc/models/schift-pii/` (KORDOC_MODEL_CACHE 로 바꿈)
|
|
2493
|
+
* - int8 (기본, 151MB) — 관보 홀드아웃 F1 .946 · q4 (4-bit, 81MB) — .940, 주소 재현율이 조금 낮다
|
|
2494
|
+
* 라이선스: 모델은 Schift License v2.0 (Apache 2.0 + 직전 회계연도 매출 1천만 달러 초과 법인의 영리 사용 제한, 연구·평가·
|
|
2495
|
+
* 비영리는 항상 허용). 저장소·npm 패키지에 넣지 않고, 사용자가 켤 때만 받는다.
|
|
2496
|
+
*
|
|
2497
|
+
* 추론: 512토큰 창(겹침 64). 스팬은 완결된 BIOES 열(B…E, S)만, 점수는 그 토큰들의 최소 확률, 파일별 보정 임계값(보정셋
|
|
2498
|
+
* 정밀도 0.95 기준 — 모델 저장소 pii_config.json) 이상만 남긴다. 토크나이저는 tokenizer.json 을 읽는 WordPiece 구현
|
|
2499
|
+
* (NFC·BertPreTokenizer·## 접두) — 오프셋이 필요해 @huggingface/tokenizers 대신 여기서 센다.
|
|
2500
|
+
*/
|
|
2501
|
+
|
|
2502
|
+
type PiiModelVariant = "int8" | "q4";
|
|
2503
|
+
/** 모델이 찾은 스팬 — index·length 는 detect() 에 넘긴 문자열 기준 UTF-16 단위 */
|
|
2504
|
+
interface ModelSpan {
|
|
2505
|
+
rule: "name" | "address";
|
|
2506
|
+
index: number;
|
|
2507
|
+
length: number;
|
|
2508
|
+
/** 스팬 토큰들의 최소 확률 */
|
|
2509
|
+
score: number;
|
|
2510
|
+
}
|
|
2511
|
+
interface PiiModel {
|
|
2512
|
+
readonly variant: PiiModelVariant | "custom";
|
|
2513
|
+
detect(text: string): Promise<ModelSpan[]>;
|
|
2514
|
+
release(): Promise<void>;
|
|
2515
|
+
}
|
|
2516
|
+
interface PiiModelOptions {
|
|
2517
|
+
/** 기본 int8 */
|
|
2518
|
+
variant?: PiiModelVariant;
|
|
2519
|
+
/** onnxruntime intraOp 스레드 수 (기본: onnxruntime 기본값) */
|
|
2520
|
+
threads?: number;
|
|
2521
|
+
onProgress?: ProgressHandler;
|
|
2522
|
+
}
|
|
2523
|
+
declare function getPiiModelsDir(): string;
|
|
2524
|
+
/** 모델 파일을 받고(이미 있으면 SHA 만 대조) 세션을 연다 */
|
|
2525
|
+
declare function loadPiiModel(options?: PiiModelOptions): Promise<PiiModel>;
|
|
2526
|
+
|
|
2453
2527
|
/**
|
|
2454
2528
|
* 한국 공문서 PII(개인정보) 탐지·마스킹 순수 로직.
|
|
2455
2529
|
*
|
|
@@ -2472,6 +2546,7 @@ declare function validateHwpx(buffer: ArrayBuffer | Uint8Array): Promise<Validat
|
|
|
2472
2546
|
*
|
|
2473
2547
|
* 룰별 근거·오탐 실측은 bench/redact-bench.mjs (합성 정답 셋 + 실코퍼스) 참조.
|
|
2474
2548
|
*/
|
|
2549
|
+
|
|
2475
2550
|
type RedactRule = "rrn" | "phone" | "email" | "card" | "account" | "passport" | "driver" | "brn" | "crn" | "ip" | "name" | "address";
|
|
2476
2551
|
interface RedactHit {
|
|
2477
2552
|
rule: RedactRule;
|
|
@@ -2491,6 +2566,12 @@ interface RedactOptions {
|
|
|
2491
2566
|
rules?: readonly RedactRule[];
|
|
2492
2567
|
/** 마스크 문자 — 1글자(UTF-16 1단위). 영숫자·공백·제어문자·마크다운/XML 특수문자(|\<>&"')는 금지. 기본 "●" */
|
|
2493
2568
|
maskChar?: string;
|
|
2569
|
+
/**
|
|
2570
|
+
* 학습 모델이 찾은 인명·주소 스팬 (redact-model.ts `loadPiiModel().detect(같은 문자열)` — UTF-16 오프셋).
|
|
2571
|
+
* 해당 룰(name·address)이 켜져 있을 때만 쓴다. RULE_PRIORITY 의 그 룰 자리에서 사전 룰보다 먼저 차지하고, 번호형 룰이
|
|
2572
|
+
* 이미 잡은 곳과 겹치면 버린다. 사전 룰은 남은 곳에서 그대로 돈다(합집합)
|
|
2573
|
+
*/
|
|
2574
|
+
modelSpans?: readonly ModelSpan[];
|
|
2494
2575
|
}
|
|
2495
2576
|
/**
|
|
2496
2577
|
* 기본 적용 룰. 실코퍼스 2,303문서 오탐 실측 근거(bench/redact-bench.mjs --corpus):
|
|
@@ -3142,5 +3223,5 @@ interface FillFormOutput {
|
|
|
3142
3223
|
*/
|
|
3143
3224
|
declare function fillForm(input: string | ArrayBuffer | Buffer, values: Record<string, FillInput>, outputFormat?: FillOutputFormat): Promise<FillFormOutput>;
|
|
3144
3225
|
|
|
3145
|
-
export { AGENCY_COMMON_NAME, BUILTIN_TEMPLATES, DEFAULT_REDACT_RULES, HwpxSession, PRESET_ALIAS, SPACE_EM_FIXED, SPACE_EM_FONT, VERSION, ValueCursor, addMemoHwpx, agencyNames, agencyStyle, applyMeasuredLayout, applySplices, blocksToChunks, blocksToMarkdown, blocksToPages, blocksToPdf, buildAgencyPack, buildParagraphSplices, buildRangeSplices, charWidthEm1000, chooseTableRepresentation, classifyTable, classifyTableTree, collectTableBlocks, compare, convertToHwpx, detectFormat, detectOle2Format, detectZipFormat, diffBlocks, extractClickHereFields, extractFormFields, extractFormSchema, extractRenderedRegions, extractTables, fillForm, fillFormFields, fillHwpx, fillWithUniqueGuard, fitRatioForFewerLines, flattenLayoutTables, formatFillValue, formatGateFinding, gongmunGate, gongmunLintWarnings, hasStructuredCellContent, hwpToHwpx, hwpxToHwp, hwpxToProfile, incompatibleGongmunWarnings, inferFieldType, isHwpxFile, isKnownFont, isLabelCell, isOldHwpFile, isPdfFile, isZipFile, lintBlocks, lintBudgetText, lintGongmunText, lintLogicText, lintMuncheText, lintSlopText, loadAgencyPack, logicLintWarnings, markdownToHwpx, markdownToPdf, measurePdfLayout, measureTextWidth, muncheLintWarnings, normalizeGongmunPreset, openHwpxDocument, packRoleWarnings, packSummary, packTemplate, parse, parseDocx, parseHwp, parseHwp3, parseHwpml, parseHwpx, parseImage, parsePdf, parsePptx, parseXls, parseXlsx, patchHwp, patchHwpx, patchHwpxBlocks, placeSealHwpx, placeTotalRow, readBuiltinTemplate, readBuiltinTemplateSample, redactMarkdown, redactText, renderDocument, renderDocumentToScene, renderHtml, renderHwp5Pages, renderHwpxToSvg, renderSceneToHtml, resolveBuiltinTemplate, resolvePackKind, runLintSuite, scanSectionXml, simulateWrap, simulateWrapKeepWord, slopLintWarnings, unknownFontWarnings, usesGaejosikMunche, usesLogicStructure, validateHwpx };
|
|
3146
|
-
export type { AddMemoResult, AgencyFont, AgencyPack, AgencyPressStyle, AgencyReportStyle, AgencyStyle, BlockCapability, BlockCapabilityInfo, BlockDiff, BlockEdit, BlockFinding, BlockSourceRef, BorderDef, BorderFillDef, BoundingBox, BuiltinTemplate, CellCapability, CellContext, CellDiff, CellProfile, CharPrDef, ChunkOptions, ClassifyContext, ClickHereField, ConvertToHwpxResult, DiffChangeType, DiffResult, DocChunk, DocumentMetadata, DocumentQualitySummary, ErrorCode, ExtractRegionOptions, ExtractTableVisualOptions, ExtractedImage, ExtractedTable, ExtractedTableCrop, FileType, FillFormOutput, FillInput, FillOutputFormat, FillResult, FillValue, FormField, FormFieldSchema, FormFieldType, FormResult, FormSchemaResult, FormatProfile, GongmunFont, GongmunGateAxis, GongmunGateFinding, GongmunGateResult, GongmunLintFinding, GongmunNumbering, GongmunOptions, GongmunPreset, GongmunPresetInput, HwpToHwpxOptions, HwpxFillResult, HwpxTheme, HwpxToHwpOptions, IRBlock, IRBlockType, IRCell, IRTable, ImageData, InlineStyle, LintBlock, LintBlocksResult, LintSuiteOptions, LintSuiteResult, MarkdownOptions, MarkdownToHwpxOptions, MeasureOptions, MeasuredLayoutResult, MemoNote, MemoOp, MemoPlacement, MuncheLineKind, MuncheLintFinding, OcrLine, OcrLineCandidate, OcrModelFile, OcrPageLines, OcrProvider, OutlineItem, PackKindInfo, PackManifest, PackSample, PageBBox, PageImage, PageMargin, PageMarkdown, PageOptions, PageQuality, ParseFailure, ParseOptions, ParseResult, ParseSuccess, ParseWarning, PatchOptions, PatchResult, PatchSkip, PdfLayoutLevel, PdfLayoutSpec, PlaceSealResult, PrintOptions, PrintPreset, RedactHit, RedactOptions, RedactRule, RedactTextResult, RegionAsset, RenderAsset, RenderDocumentOptions, RenderDocumentResult, RenderFormat, RenderObjectType, RenderRegion, RenderScene, RenderSourceFormat, RenderSvgOptions, RenderSvgResult, ScanCell, ScanParaKind, ScanParagraph, ScanTable, ScenePage, SceneRenderOptions, SceneRenderResult, SealOp, SealPlacement, SectionScan, SpliceEdit, TRange, TableProfile, TableRepresentation, TableVisualPolicy, TotalRowPosition, ValidateIssue, ValidateResult, WarningCode, WatchOptions, WrapMode, WrapResult };
|
|
3226
|
+
export { AGENCY_COMMON_NAME, BUILTIN_TEMPLATES, DEFAULT_REDACT_RULES, HwpxSession, PRESET_ALIAS, SPACE_EM_FIXED, SPACE_EM_FONT, VERSION, ValueCursor, addMemoHwpx, agencyNames, agencyStyle, applyMeasuredLayout, applySplices, blocksToChunks, blocksToMarkdown, blocksToPages, blocksToPdf, buildAgencyPack, buildParagraphSplices, buildRangeSplices, charWidthEm1000, chooseTableRepresentation, classifyTable, classifyTableTree, collectTableBlocks, compare, convertToHwpx, detectFormat, detectOle2Format, detectZipFormat, diffBlocks, extractClickHereFields, extractFormFields, extractFormSchema, extractRenderedRegions, extractTables, fillForm, fillFormFields, fillHwpx, fillWithUniqueGuard, fitRatioForFewerLines, flattenLayoutTables, formatFillValue, formatGateFinding, getPiiModelsDir, gongmunGate, gongmunLintWarnings, hasStructuredCellContent, hwpToHwpx, hwpxToHwp, hwpxToProfile, incompatibleGongmunWarnings, inferFieldType, isHwpxFile, isKnownFont, isLabelCell, isOldHwpFile, isPdfFile, isZipFile, lintBlocks, lintBudgetText, lintGongmunText, lintLogicText, lintMuncheText, lintSlopText, loadAgencyPack, loadPiiModel, logicLintWarnings, markdownToHwpx, markdownToPdf, measurePdfLayout, measureTextWidth, muncheLintWarnings, normalizeGongmunPreset, openHwpxDocument, packRoleWarnings, packSummary, packTemplate, parse, parseDocx, parseHwp, parseHwp3, parseHwpml, parseHwpx, parseImage, parsePdf, parsePptx, parseXls, parseXlsx, patchHwp, patchHwpx, patchHwpxBlocks, placeSealHwpx, placeTotalRow, readBuiltinTemplate, readBuiltinTemplateSample, redactMarkdown, redactText, renderDocument, renderDocumentToScene, renderHtml, renderHwp5Pages, renderHwpxToSvg, renderSceneToHtml, resolveBuiltinTemplate, resolvePackKind, runLintSuite, scanSectionXml, simulateWrap, simulateWrapKeepWord, slopLintWarnings, unknownFontWarnings, usesGaejosikMunche, usesLogicStructure, validateHwpx };
|
|
3227
|
+
export type { AddMemoResult, AgencyFont, AgencyPack, AgencyPressStyle, AgencyReportStyle, AgencyStyle, BlockCapability, BlockCapabilityInfo, BlockDiff, BlockEdit, BlockFinding, BlockSourceRef, BorderDef, BorderFillDef, BoundingBox, BuiltinTemplate, CellCapability, CellContext, CellDiff, CellProfile, CharPrDef, ChunkOptions, ClassifyContext, ClickHereField, ConvertToHwpxResult, DiffChangeType, DiffResult, DocChunk, DocumentMetadata, DocumentQualitySummary, ErrorCode, ExtractRegionOptions, ExtractTableVisualOptions, ExtractedImage, ExtractedTable, ExtractedTableCrop, FileType, FillFormOutput, FillInput, FillOutputFormat, FillResult, FillValue, FormField, FormFieldSchema, FormFieldType, FormResult, FormSchemaResult, FormatProfile, GongmunFont, GongmunGateAxis, GongmunGateFinding, GongmunGateResult, GongmunLintFinding, GongmunNumbering, GongmunOptions, GongmunPreset, GongmunPresetInput, HwpToHwpxOptions, HwpxFillResult, HwpxTheme, HwpxToHwpOptions, IRBlock, IRBlockType, IRCell, IRTable, ImageData, InlineStyle, LintBlock, LintBlocksResult, LintSuiteOptions, LintSuiteResult, MarkdownOptions, MarkdownToHwpxOptions, MeasureOptions, MeasuredLayoutResult, MemoNote, MemoOp, MemoPlacement, ModelSpan, MuncheLineKind, MuncheLintFinding, OcrLine, OcrLineCandidate, OcrModelFile, OcrPageLines, OcrProvider, OutlineItem, PackKindInfo, PackManifest, PackSample, PageBBox, PageImage, PageMargin, PageMarkdown, PageOptions, PageQuality, ParseFailure, ParseOptions, ParseResult, ParseSuccess, ParseWarning, PatchOptions, PatchResult, PatchSkip, PdfLayoutLevel, PdfLayoutSpec, PiiModel, PiiModelOptions, PiiModelVariant, PlaceSealResult, PrintOptions, PrintPreset, RedactHit, RedactOptions, RedactRule, RedactTextResult, RegionAsset, RenderAsset, RenderDocumentOptions, RenderDocumentResult, RenderFormat, RenderObjectType, RenderRegion, RenderScene, RenderSourceFormat, RenderSvgOptions, RenderSvgResult, ScanCell, ScanParaKind, ScanParagraph, ScanTable, ScenePage, SceneRenderOptions, SceneRenderResult, SealOp, SealPlacement, SectionScan, SpliceEdit, TRange, TableProfile, TableRepresentation, TableVisualPolicy, TotalRowPosition, ValidateIssue, ValidateResult, WarningCode, WatchOptions, WrapMode, WrapResult };
|
package/dist/index.d.ts
CHANGED
|
@@ -2450,6 +2450,80 @@ interface ValidateResult {
|
|
|
2450
2450
|
/** HWPX 버퍼의 컨테이너 구조를 검증한다. 문제가 없으면 ok=true. */
|
|
2451
2451
|
declare function validateHwpx(buffer: ArrayBuffer | Uint8Array): Promise<ValidateResult>;
|
|
2452
2452
|
|
|
2453
|
+
/**
|
|
2454
|
+
* 수식 OCR 모델 자동 다운로드 + SHA-256 검증
|
|
2455
|
+
*
|
|
2456
|
+
* 캐시 위치: `~/.cache/kordoc/models/pix2text/`
|
|
2457
|
+
* 총 ~155MB (MFD 44MB + MFR encoder 87MB + MFR decoder 30MB + tokenizer 40KB)
|
|
2458
|
+
*
|
|
2459
|
+
* HF URL + SHA 는 Docufinder archive/rust-formula-ocr-wip 에서 검증 완료됨.
|
|
2460
|
+
* 모델 버전 갱신 시 URL + SHA 를 함께 갱신해야 한다.
|
|
2461
|
+
*/
|
|
2462
|
+
interface ModelSpec {
|
|
2463
|
+
name: string;
|
|
2464
|
+
filename: string;
|
|
2465
|
+
url: string;
|
|
2466
|
+
sha256: string;
|
|
2467
|
+
sizeMb: number;
|
|
2468
|
+
/** 폐쇄망 차단 안내 — 없으면 models --export/--import 안내 */
|
|
2469
|
+
offlineHint?: string;
|
|
2470
|
+
}
|
|
2471
|
+
interface DownloadProgress {
|
|
2472
|
+
spec: ModelSpec;
|
|
2473
|
+
/** 현재까지 다운로드한 바이트 */
|
|
2474
|
+
downloaded: number;
|
|
2475
|
+
/** 전체 바이트 (알 수 있으면) */
|
|
2476
|
+
total: number | null;
|
|
2477
|
+
/** "download" | "verify" | "done" | "skip" */
|
|
2478
|
+
phase: "download" | "verify" | "done" | "skip" | "error";
|
|
2479
|
+
message?: string;
|
|
2480
|
+
}
|
|
2481
|
+
type ProgressHandler = (p: DownloadProgress) => void;
|
|
2482
|
+
|
|
2483
|
+
/**
|
|
2484
|
+
* redact 인명·주소 학습 모델 (opt-in) — Hugging Face `schift-io/schift-ko-pii-ax-v1`(skt/A.X-Encoder-base 를 미세조정한
|
|
2485
|
+
* BIOES 태거)을 onnxruntime-node 로 돌려 인명·주소 스팬을 찾는다.
|
|
2486
|
+
*
|
|
2487
|
+
* 사전·문맥 룰(redact-name-address.ts)은 정밀도를 위해 문맥 없는 맨 이름을 일부러 놓친다. 모델은 그런 이름, 가린 이름
|
|
2488
|
+
* (홍○동·김영*), 띄어 쓴 이름(정 하 늘), 지번만 있는 표 칸까지 문장 전체를 보고 잡는 대신 문서 한 건에 수백 ms 가 든다.
|
|
2489
|
+
* 찾은 스팬은 redactText·redactMarkdown 의 `modelSpans` 로 넘기면 룰 엔진이 name·address 자리(RULE_PRIORITY)에서 사전
|
|
2490
|
+
* 룰보다 먼저 차지하고, 같은 서식 보존 마스킹(성·시·군·구는 남김)을 입힌다. 번호형 룰이 먼저 잡은 곳과 겹치면 버린다.
|
|
2491
|
+
*
|
|
2492
|
+
* 모델 파일: 리비전 고정 + SHA-256 대조, 캐시 `~/.cache/kordoc/models/schift-pii/` (KORDOC_MODEL_CACHE 로 바꿈)
|
|
2493
|
+
* - int8 (기본, 151MB) — 관보 홀드아웃 F1 .946 · q4 (4-bit, 81MB) — .940, 주소 재현율이 조금 낮다
|
|
2494
|
+
* 라이선스: 모델은 Schift License v2.0 (Apache 2.0 + 직전 회계연도 매출 1천만 달러 초과 법인의 영리 사용 제한, 연구·평가·
|
|
2495
|
+
* 비영리는 항상 허용). 저장소·npm 패키지에 넣지 않고, 사용자가 켤 때만 받는다.
|
|
2496
|
+
*
|
|
2497
|
+
* 추론: 512토큰 창(겹침 64). 스팬은 완결된 BIOES 열(B…E, S)만, 점수는 그 토큰들의 최소 확률, 파일별 보정 임계값(보정셋
|
|
2498
|
+
* 정밀도 0.95 기준 — 모델 저장소 pii_config.json) 이상만 남긴다. 토크나이저는 tokenizer.json 을 읽는 WordPiece 구현
|
|
2499
|
+
* (NFC·BertPreTokenizer·## 접두) — 오프셋이 필요해 @huggingface/tokenizers 대신 여기서 센다.
|
|
2500
|
+
*/
|
|
2501
|
+
|
|
2502
|
+
type PiiModelVariant = "int8" | "q4";
|
|
2503
|
+
/** 모델이 찾은 스팬 — index·length 는 detect() 에 넘긴 문자열 기준 UTF-16 단위 */
|
|
2504
|
+
interface ModelSpan {
|
|
2505
|
+
rule: "name" | "address";
|
|
2506
|
+
index: number;
|
|
2507
|
+
length: number;
|
|
2508
|
+
/** 스팬 토큰들의 최소 확률 */
|
|
2509
|
+
score: number;
|
|
2510
|
+
}
|
|
2511
|
+
interface PiiModel {
|
|
2512
|
+
readonly variant: PiiModelVariant | "custom";
|
|
2513
|
+
detect(text: string): Promise<ModelSpan[]>;
|
|
2514
|
+
release(): Promise<void>;
|
|
2515
|
+
}
|
|
2516
|
+
interface PiiModelOptions {
|
|
2517
|
+
/** 기본 int8 */
|
|
2518
|
+
variant?: PiiModelVariant;
|
|
2519
|
+
/** onnxruntime intraOp 스레드 수 (기본: onnxruntime 기본값) */
|
|
2520
|
+
threads?: number;
|
|
2521
|
+
onProgress?: ProgressHandler;
|
|
2522
|
+
}
|
|
2523
|
+
declare function getPiiModelsDir(): string;
|
|
2524
|
+
/** 모델 파일을 받고(이미 있으면 SHA 만 대조) 세션을 연다 */
|
|
2525
|
+
declare function loadPiiModel(options?: PiiModelOptions): Promise<PiiModel>;
|
|
2526
|
+
|
|
2453
2527
|
/**
|
|
2454
2528
|
* 한국 공문서 PII(개인정보) 탐지·마스킹 순수 로직.
|
|
2455
2529
|
*
|
|
@@ -2472,6 +2546,7 @@ declare function validateHwpx(buffer: ArrayBuffer | Uint8Array): Promise<Validat
|
|
|
2472
2546
|
*
|
|
2473
2547
|
* 룰별 근거·오탐 실측은 bench/redact-bench.mjs (합성 정답 셋 + 실코퍼스) 참조.
|
|
2474
2548
|
*/
|
|
2549
|
+
|
|
2475
2550
|
type RedactRule = "rrn" | "phone" | "email" | "card" | "account" | "passport" | "driver" | "brn" | "crn" | "ip" | "name" | "address";
|
|
2476
2551
|
interface RedactHit {
|
|
2477
2552
|
rule: RedactRule;
|
|
@@ -2491,6 +2566,12 @@ interface RedactOptions {
|
|
|
2491
2566
|
rules?: readonly RedactRule[];
|
|
2492
2567
|
/** 마스크 문자 — 1글자(UTF-16 1단위). 영숫자·공백·제어문자·마크다운/XML 특수문자(|\<>&"')는 금지. 기본 "●" */
|
|
2493
2568
|
maskChar?: string;
|
|
2569
|
+
/**
|
|
2570
|
+
* 학습 모델이 찾은 인명·주소 스팬 (redact-model.ts `loadPiiModel().detect(같은 문자열)` — UTF-16 오프셋).
|
|
2571
|
+
* 해당 룰(name·address)이 켜져 있을 때만 쓴다. RULE_PRIORITY 의 그 룰 자리에서 사전 룰보다 먼저 차지하고, 번호형 룰이
|
|
2572
|
+
* 이미 잡은 곳과 겹치면 버린다. 사전 룰은 남은 곳에서 그대로 돈다(합집합)
|
|
2573
|
+
*/
|
|
2574
|
+
modelSpans?: readonly ModelSpan[];
|
|
2494
2575
|
}
|
|
2495
2576
|
/**
|
|
2496
2577
|
* 기본 적용 룰. 실코퍼스 2,303문서 오탐 실측 근거(bench/redact-bench.mjs --corpus):
|
|
@@ -3142,5 +3223,5 @@ interface FillFormOutput {
|
|
|
3142
3223
|
*/
|
|
3143
3224
|
declare function fillForm(input: string | ArrayBuffer | Buffer, values: Record<string, FillInput>, outputFormat?: FillOutputFormat): Promise<FillFormOutput>;
|
|
3144
3225
|
|
|
3145
|
-
export { AGENCY_COMMON_NAME, BUILTIN_TEMPLATES, DEFAULT_REDACT_RULES, HwpxSession, PRESET_ALIAS, SPACE_EM_FIXED, SPACE_EM_FONT, VERSION, ValueCursor, addMemoHwpx, agencyNames, agencyStyle, applyMeasuredLayout, applySplices, blocksToChunks, blocksToMarkdown, blocksToPages, blocksToPdf, buildAgencyPack, buildParagraphSplices, buildRangeSplices, charWidthEm1000, chooseTableRepresentation, classifyTable, classifyTableTree, collectTableBlocks, compare, convertToHwpx, detectFormat, detectOle2Format, detectZipFormat, diffBlocks, extractClickHereFields, extractFormFields, extractFormSchema, extractRenderedRegions, extractTables, fillForm, fillFormFields, fillHwpx, fillWithUniqueGuard, fitRatioForFewerLines, flattenLayoutTables, formatFillValue, formatGateFinding, gongmunGate, gongmunLintWarnings, hasStructuredCellContent, hwpToHwpx, hwpxToHwp, hwpxToProfile, incompatibleGongmunWarnings, inferFieldType, isHwpxFile, isKnownFont, isLabelCell, isOldHwpFile, isPdfFile, isZipFile, lintBlocks, lintBudgetText, lintGongmunText, lintLogicText, lintMuncheText, lintSlopText, loadAgencyPack, logicLintWarnings, markdownToHwpx, markdownToPdf, measurePdfLayout, measureTextWidth, muncheLintWarnings, normalizeGongmunPreset, openHwpxDocument, packRoleWarnings, packSummary, packTemplate, parse, parseDocx, parseHwp, parseHwp3, parseHwpml, parseHwpx, parseImage, parsePdf, parsePptx, parseXls, parseXlsx, patchHwp, patchHwpx, patchHwpxBlocks, placeSealHwpx, placeTotalRow, readBuiltinTemplate, readBuiltinTemplateSample, redactMarkdown, redactText, renderDocument, renderDocumentToScene, renderHtml, renderHwp5Pages, renderHwpxToSvg, renderSceneToHtml, resolveBuiltinTemplate, resolvePackKind, runLintSuite, scanSectionXml, simulateWrap, simulateWrapKeepWord, slopLintWarnings, unknownFontWarnings, usesGaejosikMunche, usesLogicStructure, validateHwpx };
|
|
3146
|
-
export type { AddMemoResult, AgencyFont, AgencyPack, AgencyPressStyle, AgencyReportStyle, AgencyStyle, BlockCapability, BlockCapabilityInfo, BlockDiff, BlockEdit, BlockFinding, BlockSourceRef, BorderDef, BorderFillDef, BoundingBox, BuiltinTemplate, CellCapability, CellContext, CellDiff, CellProfile, CharPrDef, ChunkOptions, ClassifyContext, ClickHereField, ConvertToHwpxResult, DiffChangeType, DiffResult, DocChunk, DocumentMetadata, DocumentQualitySummary, ErrorCode, ExtractRegionOptions, ExtractTableVisualOptions, ExtractedImage, ExtractedTable, ExtractedTableCrop, FileType, FillFormOutput, FillInput, FillOutputFormat, FillResult, FillValue, FormField, FormFieldSchema, FormFieldType, FormResult, FormSchemaResult, FormatProfile, GongmunFont, GongmunGateAxis, GongmunGateFinding, GongmunGateResult, GongmunLintFinding, GongmunNumbering, GongmunOptions, GongmunPreset, GongmunPresetInput, HwpToHwpxOptions, HwpxFillResult, HwpxTheme, HwpxToHwpOptions, IRBlock, IRBlockType, IRCell, IRTable, ImageData, InlineStyle, LintBlock, LintBlocksResult, LintSuiteOptions, LintSuiteResult, MarkdownOptions, MarkdownToHwpxOptions, MeasureOptions, MeasuredLayoutResult, MemoNote, MemoOp, MemoPlacement, MuncheLineKind, MuncheLintFinding, OcrLine, OcrLineCandidate, OcrModelFile, OcrPageLines, OcrProvider, OutlineItem, PackKindInfo, PackManifest, PackSample, PageBBox, PageImage, PageMargin, PageMarkdown, PageOptions, PageQuality, ParseFailure, ParseOptions, ParseResult, ParseSuccess, ParseWarning, PatchOptions, PatchResult, PatchSkip, PdfLayoutLevel, PdfLayoutSpec, PlaceSealResult, PrintOptions, PrintPreset, RedactHit, RedactOptions, RedactRule, RedactTextResult, RegionAsset, RenderAsset, RenderDocumentOptions, RenderDocumentResult, RenderFormat, RenderObjectType, RenderRegion, RenderScene, RenderSourceFormat, RenderSvgOptions, RenderSvgResult, ScanCell, ScanParaKind, ScanParagraph, ScanTable, ScenePage, SceneRenderOptions, SceneRenderResult, SealOp, SealPlacement, SectionScan, SpliceEdit, TRange, TableProfile, TableRepresentation, TableVisualPolicy, TotalRowPosition, ValidateIssue, ValidateResult, WarningCode, WatchOptions, WrapMode, WrapResult };
|
|
3226
|
+
export { AGENCY_COMMON_NAME, BUILTIN_TEMPLATES, DEFAULT_REDACT_RULES, HwpxSession, PRESET_ALIAS, SPACE_EM_FIXED, SPACE_EM_FONT, VERSION, ValueCursor, addMemoHwpx, agencyNames, agencyStyle, applyMeasuredLayout, applySplices, blocksToChunks, blocksToMarkdown, blocksToPages, blocksToPdf, buildAgencyPack, buildParagraphSplices, buildRangeSplices, charWidthEm1000, chooseTableRepresentation, classifyTable, classifyTableTree, collectTableBlocks, compare, convertToHwpx, detectFormat, detectOle2Format, detectZipFormat, diffBlocks, extractClickHereFields, extractFormFields, extractFormSchema, extractRenderedRegions, extractTables, fillForm, fillFormFields, fillHwpx, fillWithUniqueGuard, fitRatioForFewerLines, flattenLayoutTables, formatFillValue, formatGateFinding, getPiiModelsDir, gongmunGate, gongmunLintWarnings, hasStructuredCellContent, hwpToHwpx, hwpxToHwp, hwpxToProfile, incompatibleGongmunWarnings, inferFieldType, isHwpxFile, isKnownFont, isLabelCell, isOldHwpFile, isPdfFile, isZipFile, lintBlocks, lintBudgetText, lintGongmunText, lintLogicText, lintMuncheText, lintSlopText, loadAgencyPack, loadPiiModel, logicLintWarnings, markdownToHwpx, markdownToPdf, measurePdfLayout, measureTextWidth, muncheLintWarnings, normalizeGongmunPreset, openHwpxDocument, packRoleWarnings, packSummary, packTemplate, parse, parseDocx, parseHwp, parseHwp3, parseHwpml, parseHwpx, parseImage, parsePdf, parsePptx, parseXls, parseXlsx, patchHwp, patchHwpx, patchHwpxBlocks, placeSealHwpx, placeTotalRow, readBuiltinTemplate, readBuiltinTemplateSample, redactMarkdown, redactText, renderDocument, renderDocumentToScene, renderHtml, renderHwp5Pages, renderHwpxToSvg, renderSceneToHtml, resolveBuiltinTemplate, resolvePackKind, runLintSuite, scanSectionXml, simulateWrap, simulateWrapKeepWord, slopLintWarnings, unknownFontWarnings, usesGaejosikMunche, usesLogicStructure, validateHwpx };
|
|
3227
|
+
export type { AddMemoResult, AgencyFont, AgencyPack, AgencyPressStyle, AgencyReportStyle, AgencyStyle, BlockCapability, BlockCapabilityInfo, BlockDiff, BlockEdit, BlockFinding, BlockSourceRef, BorderDef, BorderFillDef, BoundingBox, BuiltinTemplate, CellCapability, CellContext, CellDiff, CellProfile, CharPrDef, ChunkOptions, ClassifyContext, ClickHereField, ConvertToHwpxResult, DiffChangeType, DiffResult, DocChunk, DocumentMetadata, DocumentQualitySummary, ErrorCode, ExtractRegionOptions, ExtractTableVisualOptions, ExtractedImage, ExtractedTable, ExtractedTableCrop, FileType, FillFormOutput, FillInput, FillOutputFormat, FillResult, FillValue, FormField, FormFieldSchema, FormFieldType, FormResult, FormSchemaResult, FormatProfile, GongmunFont, GongmunGateAxis, GongmunGateFinding, GongmunGateResult, GongmunLintFinding, GongmunNumbering, GongmunOptions, GongmunPreset, GongmunPresetInput, HwpToHwpxOptions, HwpxFillResult, HwpxTheme, HwpxToHwpOptions, IRBlock, IRBlockType, IRCell, IRTable, ImageData, InlineStyle, LintBlock, LintBlocksResult, LintSuiteOptions, LintSuiteResult, MarkdownOptions, MarkdownToHwpxOptions, MeasureOptions, MeasuredLayoutResult, MemoNote, MemoOp, MemoPlacement, ModelSpan, MuncheLineKind, MuncheLintFinding, OcrLine, OcrLineCandidate, OcrModelFile, OcrPageLines, OcrProvider, OutlineItem, PackKindInfo, PackManifest, PackSample, PageBBox, PageImage, PageMargin, PageMarkdown, PageOptions, PageQuality, ParseFailure, ParseOptions, ParseResult, ParseSuccess, ParseWarning, PatchOptions, PatchResult, PatchSkip, PdfLayoutLevel, PdfLayoutSpec, PiiModel, PiiModelOptions, PiiModelVariant, PlaceSealResult, PrintOptions, PrintPreset, RedactHit, RedactOptions, RedactRule, RedactTextResult, RegionAsset, RenderAsset, RenderDocumentOptions, RenderDocumentResult, RenderFormat, RenderObjectType, RenderRegion, RenderScene, RenderSourceFormat, RenderSvgOptions, RenderSvgResult, ScanCell, ScanParaKind, ScanParagraph, ScanTable, ScenePage, SceneRenderOptions, SceneRenderResult, SealOp, SealPlacement, SectionScan, SpliceEdit, TRange, TableProfile, TableRepresentation, TableVisualPolicy, TotalRowPosition, ValidateIssue, ValidateResult, WarningCode, WatchOptions, WrapMode, WrapResult };
|
package/dist/index.js
CHANGED
|
@@ -14,6 +14,7 @@ import {
|
|
|
14
14
|
fillFormFields,
|
|
15
15
|
fillHwpx,
|
|
16
16
|
formatGateFinding,
|
|
17
|
+
getPiiModelsDir,
|
|
17
18
|
gongmunGate,
|
|
18
19
|
gongmunLintWarnings,
|
|
19
20
|
hwpxToHwp,
|
|
@@ -26,6 +27,7 @@ import {
|
|
|
26
27
|
lintMuncheText,
|
|
27
28
|
lintSlopText,
|
|
28
29
|
loadAgencyPack,
|
|
30
|
+
loadPiiModel,
|
|
29
31
|
logicLintWarnings,
|
|
30
32
|
measurePdfLayout,
|
|
31
33
|
muncheLintWarnings,
|
|
@@ -55,7 +57,7 @@ import {
|
|
|
55
57
|
usesGaejosikMunche,
|
|
56
58
|
usesLogicStructure,
|
|
57
59
|
validateHwpx
|
|
58
|
-
} from "./chunk-
|
|
60
|
+
} from "./chunk-D2WQC6ME.js";
|
|
59
61
|
import {
|
|
60
62
|
blocksToPdf,
|
|
61
63
|
extractRenderedRegions,
|
|
@@ -65,17 +67,17 @@ import {
|
|
|
65
67
|
renderHtml,
|
|
66
68
|
renderHwp5Pages,
|
|
67
69
|
renderSceneToHtml
|
|
68
|
-
} from "./chunk-
|
|
69
|
-
import "./chunk-
|
|
70
|
+
} from "./chunk-2RBIZALD.js";
|
|
71
|
+
import "./chunk-TH7SIDYM.js";
|
|
70
72
|
import {
|
|
71
73
|
blocksToPages
|
|
72
|
-
} from "./chunk-
|
|
74
|
+
} from "./chunk-DTUCE7H2.js";
|
|
73
75
|
import {
|
|
74
76
|
extractClickHereFields,
|
|
75
77
|
patchHwp,
|
|
76
78
|
patchHwpx
|
|
77
|
-
} from "./chunk-
|
|
78
|
-
import "./chunk-
|
|
79
|
+
} from "./chunk-D6MGUFRQ.js";
|
|
80
|
+
import "./chunk-HMTLJJEC.js";
|
|
79
81
|
import "./chunk-3UIIEZBT.js";
|
|
80
82
|
import {
|
|
81
83
|
AGENCY_COMMON_NAME,
|
|
@@ -86,7 +88,7 @@ import {
|
|
|
86
88
|
markdownToHwpx,
|
|
87
89
|
normalizeGongmunPreset,
|
|
88
90
|
placeTotalRow
|
|
89
|
-
} from "./chunk-
|
|
91
|
+
} from "./chunk-3Y76RPK3.js";
|
|
90
92
|
import {
|
|
91
93
|
SPACE_EM_FIXED,
|
|
92
94
|
SPACE_EM_FONT,
|
|
@@ -96,14 +98,14 @@ import {
|
|
|
96
98
|
renderHwpxToSvg,
|
|
97
99
|
simulateWrap,
|
|
98
100
|
simulateWrapKeepWord
|
|
99
|
-
} from "./chunk-
|
|
101
|
+
} from "./chunk-VHZYGCS4.js";
|
|
100
102
|
import {
|
|
101
103
|
addMemoHwpx
|
|
102
|
-
} from "./chunk-
|
|
104
|
+
} from "./chunk-6ZUQ6D3B.js";
|
|
103
105
|
import {
|
|
104
106
|
placeSealHwpx
|
|
105
|
-
} from "./chunk-
|
|
106
|
-
import "./chunk-
|
|
107
|
+
} from "./chunk-IKQMEXGU.js";
|
|
108
|
+
import "./chunk-S4NQTGXD.js";
|
|
107
109
|
import {
|
|
108
110
|
ValueCursor,
|
|
109
111
|
applySplices,
|
|
@@ -117,25 +119,25 @@ import {
|
|
|
117
119
|
isLabelCell,
|
|
118
120
|
scanSectionXml
|
|
119
121
|
} from "./chunk-OP4EPPXU.js";
|
|
120
|
-
import "./chunk-
|
|
122
|
+
import "./chunk-QQVTLNLV.js";
|
|
121
123
|
import "./chunk-HVXDD6QZ.js";
|
|
122
124
|
import {
|
|
123
125
|
convertToHwpx,
|
|
124
126
|
hwpToHwpx
|
|
125
|
-
} from "./chunk-
|
|
126
|
-
import "./chunk-
|
|
127
|
+
} from "./chunk-O4XRI7EC.js";
|
|
128
|
+
import "./chunk-6L3VEOCI.js";
|
|
127
129
|
import "./chunk-T3CW5OXA.js";
|
|
128
130
|
import "./chunk-CG6DUPWU.js";
|
|
129
|
-
import "./chunk-
|
|
131
|
+
import "./chunk-XI47ZEQB.js";
|
|
130
132
|
import "./chunk-63UKHBUV.js";
|
|
131
133
|
import {
|
|
132
134
|
DEFAULT_REDACT_RULES,
|
|
133
135
|
redactMarkdown,
|
|
134
136
|
redactText
|
|
135
|
-
} from "./chunk-
|
|
137
|
+
} from "./chunk-K4YTD6RG.js";
|
|
136
138
|
import {
|
|
137
139
|
blocksToChunks
|
|
138
|
-
} from "./chunk-
|
|
140
|
+
} from "./chunk-VDF7ZVNW.js";
|
|
139
141
|
import "./chunk-W5CMIZUB.js";
|
|
140
142
|
import {
|
|
141
143
|
detectFormat,
|
|
@@ -150,16 +152,19 @@ import "./chunk-O5YMQ22P.js";
|
|
|
150
152
|
import "./chunk-ZVBVGSXC.js";
|
|
151
153
|
import "./chunk-M3E5NYSN.js";
|
|
152
154
|
import "./chunk-G5XEBGZD.js";
|
|
153
|
-
import "./chunk-
|
|
155
|
+
import "./chunk-I7MD3WQR.js";
|
|
154
156
|
import {
|
|
155
157
|
blocksToMarkdown,
|
|
156
158
|
flattenLayoutTables,
|
|
157
159
|
hasStructuredCellContent
|
|
158
|
-
} from "./chunk-
|
|
160
|
+
} from "./chunk-24J4EDVI.js";
|
|
159
161
|
import "./chunk-RJCXOE4N.js";
|
|
162
|
+
import "./chunk-AY66PEUP.js";
|
|
163
|
+
import "./chunk-2VNL3FDS.js";
|
|
164
|
+
import "./chunk-EDCNR6QZ.js";
|
|
160
165
|
import {
|
|
161
166
|
VERSION
|
|
162
|
-
} from "./chunk-
|
|
167
|
+
} from "./chunk-3URB7DI4.js";
|
|
163
168
|
export {
|
|
164
169
|
AGENCY_COMMON_NAME,
|
|
165
170
|
BUILTIN_TEMPLATES,
|
|
@@ -206,6 +211,7 @@ export {
|
|
|
206
211
|
flattenLayoutTables,
|
|
207
212
|
formatFillValue,
|
|
208
213
|
formatGateFinding,
|
|
214
|
+
getPiiModelsDir,
|
|
209
215
|
gongmunGate,
|
|
210
216
|
gongmunLintWarnings,
|
|
211
217
|
hasStructuredCellContent,
|
|
@@ -227,6 +233,7 @@ export {
|
|
|
227
233
|
lintMuncheText,
|
|
228
234
|
lintSlopText,
|
|
229
235
|
loadAgencyPack,
|
|
236
|
+
loadPiiModel,
|
|
230
237
|
logicLintWarnings,
|
|
231
238
|
markdownToHwpx,
|
|
232
239
|
markdownToPdf,
|
package/dist/mcp.js
CHANGED
|
@@ -51,16 +51,16 @@ import {
|
|
|
51
51
|
unknownFontWarnings,
|
|
52
52
|
usesGaejosikMunche,
|
|
53
53
|
usesLogicStructure
|
|
54
|
-
} from "./chunk-
|
|
55
|
-
import "./chunk-
|
|
56
|
-
import "./chunk-
|
|
57
|
-
import "./chunk-
|
|
54
|
+
} from "./chunk-D2WQC6ME.js";
|
|
55
|
+
import "./chunk-2RBIZALD.js";
|
|
56
|
+
import "./chunk-TH7SIDYM.js";
|
|
57
|
+
import "./chunk-DTUCE7H2.js";
|
|
58
58
|
import {
|
|
59
59
|
extractHwpxMetadataOnly,
|
|
60
60
|
patchHwp,
|
|
61
61
|
patchHwpx
|
|
62
|
-
} from "./chunk-
|
|
63
|
-
import "./chunk-
|
|
62
|
+
} from "./chunk-D6MGUFRQ.js";
|
|
63
|
+
import "./chunk-HMTLJJEC.js";
|
|
64
64
|
import "./chunk-3UIIEZBT.js";
|
|
65
65
|
import {
|
|
66
66
|
AGENCY_COMMON_NAME,
|
|
@@ -68,29 +68,29 @@ import {
|
|
|
68
68
|
agencyNames,
|
|
69
69
|
incompatibleGongmunWarnings,
|
|
70
70
|
markdownToHwpx
|
|
71
|
-
} from "./chunk-
|
|
72
|
-
import "./chunk-
|
|
73
|
-
import "./chunk-
|
|
74
|
-
import "./chunk-
|
|
75
|
-
import "./chunk-
|
|
71
|
+
} from "./chunk-3Y76RPK3.js";
|
|
72
|
+
import "./chunk-VHZYGCS4.js";
|
|
73
|
+
import "./chunk-6ZUQ6D3B.js";
|
|
74
|
+
import "./chunk-IKQMEXGU.js";
|
|
75
|
+
import "./chunk-S4NQTGXD.js";
|
|
76
76
|
import {
|
|
77
77
|
extractFormFields,
|
|
78
78
|
fillWithUniqueGuard
|
|
79
79
|
} from "./chunk-OP4EPPXU.js";
|
|
80
|
-
import "./chunk-
|
|
80
|
+
import "./chunk-QQVTLNLV.js";
|
|
81
81
|
import "./chunk-HVXDD6QZ.js";
|
|
82
82
|
import {
|
|
83
83
|
hwpToHwpx
|
|
84
|
-
} from "./chunk-
|
|
84
|
+
} from "./chunk-O4XRI7EC.js";
|
|
85
85
|
import {
|
|
86
86
|
extractHwp5MetadataOnly
|
|
87
|
-
} from "./chunk-
|
|
87
|
+
} from "./chunk-6L3VEOCI.js";
|
|
88
88
|
import "./chunk-T3CW5OXA.js";
|
|
89
89
|
import "./chunk-CG6DUPWU.js";
|
|
90
|
-
import "./chunk-
|
|
90
|
+
import "./chunk-XI47ZEQB.js";
|
|
91
91
|
import "./chunk-63UKHBUV.js";
|
|
92
|
-
import "./chunk-
|
|
93
|
-
import "./chunk-
|
|
92
|
+
import "./chunk-K4YTD6RG.js";
|
|
93
|
+
import "./chunk-VDF7ZVNW.js";
|
|
94
94
|
import "./chunk-W5CMIZUB.js";
|
|
95
95
|
import {
|
|
96
96
|
detectFormat,
|
|
@@ -101,16 +101,18 @@ import "./chunk-O5YMQ22P.js";
|
|
|
101
101
|
import "./chunk-ZVBVGSXC.js";
|
|
102
102
|
import "./chunk-M3E5NYSN.js";
|
|
103
103
|
import "./chunk-G5XEBGZD.js";
|
|
104
|
-
import "./chunk-
|
|
104
|
+
import "./chunk-I7MD3WQR.js";
|
|
105
105
|
import {
|
|
106
106
|
blocksToMarkdown
|
|
107
|
-
} from "./chunk-
|
|
107
|
+
} from "./chunk-24J4EDVI.js";
|
|
108
108
|
import "./chunk-RJCXOE4N.js";
|
|
109
|
+
import "./chunk-AY66PEUP.js";
|
|
110
|
+
import "./chunk-2VNL3FDS.js";
|
|
109
111
|
import {
|
|
110
112
|
assertWithinRoot,
|
|
111
113
|
getAccessRoot,
|
|
112
114
|
isOfflineMode
|
|
113
|
-
} from "./chunk-
|
|
115
|
+
} from "./chunk-EDCNR6QZ.js";
|
|
114
116
|
import {
|
|
115
117
|
KordocError,
|
|
116
118
|
VERSION,
|
|
@@ -118,7 +120,7 @@ import {
|
|
|
118
120
|
routeConsoleToStderr,
|
|
119
121
|
sanitizeError,
|
|
120
122
|
toArrayBuffer
|
|
121
|
-
} from "./chunk-
|
|
123
|
+
} from "./chunk-3URB7DI4.js";
|
|
122
124
|
|
|
123
125
|
// src/mcp.ts
|
|
124
126
|
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
@@ -449,7 +451,7 @@ ${markdown}`);
|
|
|
449
451
|
break;
|
|
450
452
|
case "pdf":
|
|
451
453
|
try {
|
|
452
|
-
const { extractPdfMetadataOnly } = await import("./parser-
|
|
454
|
+
const { extractPdfMetadataOnly } = await import("./parser-WAJNO5VU.js");
|
|
453
455
|
metadata = await extractPdfMetadataOnly(buffer);
|
|
454
456
|
} catch {
|
|
455
457
|
metadata = void 0;
|
|
@@ -626,7 +628,7 @@ ${tableMarkdown}` }]
|
|
|
626
628
|
if (!parsed.success) {
|
|
627
629
|
return { content: [{ type: "text", text: `\uD30C\uC2F1 \uC2E4\uD328: ${parsed.error}` }], isError: true };
|
|
628
630
|
}
|
|
629
|
-
const { blocksToChunks } = await import("./chunks-
|
|
631
|
+
const { blocksToChunks } = await import("./chunks-GPCDFBSF.js");
|
|
630
632
|
const chunks = blocksToChunks(parsed.blocks, { granularity, includeTableCells: include_table_cells });
|
|
631
633
|
return { content: [{ type: "text", text: capResponseText(JSON.stringify(chunks, null, 2)) }] };
|
|
632
634
|
} catch (err) {
|
|
@@ -906,7 +908,7 @@ ${previewMd}` }]
|
|
|
906
908
|
}
|
|
907
909
|
const image = new Uint8Array(await readFile2(imgResolved));
|
|
908
910
|
const ext = extname2(imgResolved).slice(1).toLowerCase();
|
|
909
|
-
const { placeSealHwpx } = await import("./seal-
|
|
911
|
+
const { placeSealHwpx } = await import("./seal-7YV46Q77.js");
|
|
910
912
|
const result = await placeSealHwpx(buffer, [{
|
|
911
913
|
anchor,
|
|
912
914
|
occurrence,
|
|
@@ -962,7 +964,7 @@ ${previewMd}` }]
|
|
|
962
964
|
if (format !== "hwpx") {
|
|
963
965
|
return { content: [{ type: "text", text: `add_memo \uB294 HWPX\xB7HWP 5.x \uD30C\uC77C\uB9CC \uC9C0\uC6D0\uD569\uB2C8\uB2E4 (\uAC10\uC9C0\uB41C \uD3EC\uB9F7: ${format}).` }], isError: true };
|
|
964
966
|
}
|
|
965
|
-
const { addMemoHwpx } = await import("./memo-
|
|
967
|
+
const { addMemoHwpx } = await import("./memo-7UFH4MNW.js");
|
|
966
968
|
const result = await addMemoHwpx(buffer, [{ anchor, text, author, occurrence }]);
|
|
967
969
|
await mkdir(dirname2(outPath), { recursive: true });
|
|
968
970
|
await writeOutputFile(outPath, Buffer.from(result.buffer));
|
|
@@ -1004,7 +1006,7 @@ ${previewMd}` }]
|
|
|
1004
1006
|
}
|
|
1005
1007
|
const original = new Uint8Array(buffer);
|
|
1006
1008
|
const result = isHwpx ? await patchHwpx(original, edited_markdown, structure === false ? { structure: false } : void 0) : await patchHwp(original, edited_markdown);
|
|
1007
|
-
const { needsRewrite, rewriteEdited, rewritePath } = await import("./rewrite-fallback-
|
|
1009
|
+
const { needsRewrite, rewriteEdited, rewritePath } = await import("./rewrite-fallback-5GPUDXDK.js");
|
|
1008
1010
|
const rewrite = needsRewrite(result) ? await rewriteEdited(original, isHwpx, edited_markdown, result.success) : null;
|
|
1009
1011
|
const rwOut = rewrite ? safeOutputPath(rewritePath(out), /* @__PURE__ */ new Set([".hwpx"])) : void 0;
|
|
1010
1012
|
if (rewrite && rwOut) {
|
|
@@ -1052,9 +1054,10 @@ ${rewriteLine}` }] };
|
|
|
1052
1054
|
rules: z2.array(z2.enum(["rrn", "phone", "email", "card", "account", "brn", "passport", "driver", "crn", "ip", "name", "address"])).optional().describe("\uC801\uC6A9 \uB8F0 (\uAE30\uBCF8: rrn\xB7phone\xB7email\xB7card\xB7account\xB7brn\xB7passport\xB7driver \u2014 crn(\uBC95\uC778\uB4F1\uB85D\uBC88\uD638)\xB7ip\xB7name(\uC778\uBA85, \uBB38\uB9E5 \uAC8C\uC774\uD2B8)\xB7address(\uC8FC\uC18C)\uB294 opt-in)"),
|
|
1053
1055
|
mask_char: z2.string().min(1).max(1).optional().describe("\uB9C8\uC2A4\uD06C \uBB38\uC790 1\uAE00\uC790 (\uAE30\uBCF8: \u25CF)"),
|
|
1054
1056
|
output_path: z2.string().min(1).optional().describe("\uCD9C\uB825 \uACBD\uB85C (HWPX/HWP\uB294 \uAC19\uC740 \uD655\uC7A5\uC790, \uADF8 \uC678\uB294 .md) \u2014 dry_run\uC774 \uC544\uB2C8\uBA74 \uD544\uC218"),
|
|
1055
|
-
dry_run: z2.boolean().default(false).describe("\uD0D0\uC9C0 \uB9AC\uD3EC\uD2B8\uB9CC \uBC18\uD658, \uD30C\uC77C \uBBF8\uC0DD\uC131")
|
|
1057
|
+
dry_run: z2.boolean().default(false).describe("\uD0D0\uC9C0 \uB9AC\uD3EC\uD2B8\uB9CC \uBC18\uD658, \uD30C\uC77C \uBBF8\uC0DD\uC131"),
|
|
1058
|
+
use_model: z2.boolean().default(false).describe("\uC778\uBA85\xB7\uC8FC\uC18C\uB97C \uD559\uC2B5 \uBAA8\uB378(schift-ko-pii-ax-v1, int8)\uB85C\uB3C4 \uD0D0\uC9C0 \u2014 name\xB7address \uB8F0\uC744 \uD568\uAED8 \uCF2C. \uCC98\uC74C \uD55C \uBC88 151MB\uB97C \uBC1B\uACE0 onnxruntime-node \uAC00 \uD544\uC694. \uB9E8 \uC774\uB984\xB7\uAC00\uB9B0 \uC774\uB984(\uD64D\u25CB\uB3D9)\xB7\uB744\uC5B4 \uC4F4 \uC774\uB984\uAE4C\uC9C0 \uC7A1\uB294\uB2E4")
|
|
1056
1059
|
},
|
|
1057
|
-
async ({ file_path, rules, mask_char, output_path, dry_run }) => {
|
|
1060
|
+
async ({ file_path, rules, mask_char, output_path, dry_run, use_model }) => {
|
|
1058
1061
|
try {
|
|
1059
1062
|
const { buffer, resolved } = await readValidatedFile(file_path);
|
|
1060
1063
|
let format = detectFormat(buffer);
|
|
@@ -1073,8 +1076,8 @@ ${rewriteLine}` }] };
|
|
|
1073
1076
|
if (outPath && await isSameFile(outPath, resolved)) {
|
|
1074
1077
|
return { content: [{ type: "text", text: "output_path\uAC00 \uC785\uB825 \uD30C\uC77C\uACFC \uAC19\uC2B5\uB2C8\uB2E4 \u2014 \uC6D0\uBCF8\uC744 \uB36E\uC5B4\uC4F0\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4. \uB2E4\uB978 \uACBD\uB85C\uB97C \uC9C0\uC815\uD558\uC138\uC694." }], isError: true };
|
|
1075
1078
|
}
|
|
1076
|
-
const { redactDocument } = await import("./redact-doc-
|
|
1077
|
-
const r = await redactDocument(buffer, { rules, maskChar: mask_char, filePath: file_path, dryRun: dry_run });
|
|
1079
|
+
const { redactDocument } = await import("./redact-doc-IBLP55CI.js");
|
|
1080
|
+
const r = await redactDocument(buffer, { rules, maskChar: mask_char, filePath: file_path, dryRun: dry_run, model: use_model });
|
|
1078
1081
|
const MAX_LINES = 50;
|
|
1079
1082
|
const listed = r.fileHits.length > 0 ? r.fileHits.map((h) => ` - [${h.rule}] ${h.masked} (${h.where} @ ${h.part})`) : r.markdownHits.map((h) => ` - [${h.rule}] ${h.masked}`);
|
|
1080
1083
|
const byRule = /* @__PURE__ */ new Map();
|
|
@@ -1148,7 +1151,7 @@ function registerRenderTools(server2) {
|
|
|
1148
1151
|
const { buffer, resolved } = await readValidatedFile(file_path, MAX_FILE_SIZE, /* @__PURE__ */ new Set([".hwpx", ".hwp"]));
|
|
1149
1152
|
const isHwp5 = resolved.toLowerCase().endsWith(".hwp");
|
|
1150
1153
|
if (!isHwp5 && !pages && (format === "png" || format === "svg")) {
|
|
1151
|
-
const { renderHwpxToSvg } = await import("./render-
|
|
1154
|
+
const { renderHwpxToSvg } = await import("./render-EPOTL6LB.js");
|
|
1152
1155
|
const result = await renderHwpxToSvg(buffer, { highlights, reflow: true, reflowMode: reflow_mode, password });
|
|
1153
1156
|
const summary2 = [
|
|
1154
1157
|
`\uB80C\uB354 \uC644\uB8CC: ${result.pageCount}\uD398\uC774\uC9C0, ${Math.round(result.width)}x${Math.round(result.height)}pt (\uD14D\uC2A4\uD2B8 ${result.stats.texts}\xB7\uC774\uBBF8\uC9C0 ${result.stats.images}\xB7\uD45C ${result.stats.tables})`,
|
|
@@ -1160,7 +1163,7 @@ function registerRenderTools(server2) {
|
|
|
1160
1163
|
summary2.push(`\uC800\uC7A5: ${outPath}`);
|
|
1161
1164
|
return { content: [{ type: "text", text: summary2.join("\n") }] };
|
|
1162
1165
|
}
|
|
1163
|
-
const { rasterizeSvg } = await import("./rasterize-
|
|
1166
|
+
const { rasterizeSvg } = await import("./rasterize-3QDKNJC3.js");
|
|
1164
1167
|
const raster = await rasterizeSvg(result.svg, result.width, result.height, max_width_px ? { maxWidthPx: max_width_px } : void 0);
|
|
1165
1168
|
if (outPath) {
|
|
1166
1169
|
await mkdir2(dirname3(outPath), { recursive: true });
|
|
@@ -1175,7 +1178,7 @@ function registerRenderTools(server2) {
|
|
|
1175
1178
|
]
|
|
1176
1179
|
};
|
|
1177
1180
|
}
|
|
1178
|
-
const { renderDocument } = await import("./render-
|
|
1181
|
+
const { renderDocument } = await import("./render-EPOTL6LB.js");
|
|
1179
1182
|
const { scene, assets } = await renderDocument(buffer, { format, pages, highlights, reflow: true, reflowMode: reflow_mode, maxWidthPx: max_width_px, password });
|
|
1180
1183
|
const summary = [
|
|
1181
1184
|
`\uB80C\uB354 \uC644\uB8CC: \uBB38\uC11C ${scene.pages.length}\uD398\uC774\uC9C0 \uC911 ${assets.filter((a) => a.page !== void 0).length || 1}\uAC74 (\uD14D\uC2A4\uD2B8 ${scene.stats.texts}\xB7\uC774\uBBF8\uC9C0 ${scene.stats.images}\xB7\uD45C ${scene.stats.tables}\xB7\uB3C4\uD615 ${scene.stats.shapes})`,
|
|
@@ -1225,7 +1228,7 @@ function registerRenderTools(server2) {
|
|
|
1225
1228
|
try {
|
|
1226
1229
|
const { buffer } = await readValidatedFile(file_path, MAX_FILE_SIZE, /* @__PURE__ */ new Set([".hwpx", ".hwp"]));
|
|
1227
1230
|
const dir = safeOutputPath(join2(output_dir, "regions.json"), /* @__PURE__ */ new Set([".json"])).replace(/[\\/]regions\.json$/, "");
|
|
1228
|
-
const { extractRenderedRegions } = await import("./render-
|
|
1231
|
+
const { extractRenderedRegions } = await import("./render-EPOTL6LB.js");
|
|
1229
1232
|
const regions = await extractRenderedRegions(buffer, { types: target, format, pages, paddingPt: padding_pt, reflow: true });
|
|
1230
1233
|
await mkdir2(dir, { recursive: true });
|
|
1231
1234
|
const ext = format === "jpeg" ? "jpg" : "png";
|
|
@@ -1261,7 +1264,7 @@ function registerRenderTools(server2) {
|
|
|
1261
1264
|
}
|
|
1262
1265
|
const { buffer } = await readValidatedFile(file_path, MAX_FILE_SIZE, /* @__PURE__ */ new Set([".hwpx", ".hwp"]));
|
|
1263
1266
|
const dir = output_dir ? safeOutputPath(join2(output_dir, "tables.json"), /* @__PURE__ */ new Set([".json"])).replace(/[\\/]tables\.json$/, "") : void 0;
|
|
1264
|
-
const { extractTables } = await import("./visual-
|
|
1267
|
+
const { extractTables } = await import("./visual-U7X4QE2V.js");
|
|
1265
1268
|
const tables = await extractTables(buffer, { policy: visual, format, paddingPt: padding_pt });
|
|
1266
1269
|
if (dir) await mkdir2(dir, { recursive: true });
|
|
1267
1270
|
const ext = format === "jpeg" ? "jpg" : "png";
|
|
@@ -1485,7 +1488,7 @@ ${g.blocking.map((f) => `- ${formatGateFinding(f)}`).join("\n")}` }],
|
|
|
1485
1488
|
}
|
|
1486
1489
|
let profile;
|
|
1487
1490
|
if (profile_path) {
|
|
1488
|
-
const { parseFormatProfileJson } = await import("./profile-io-
|
|
1491
|
+
const { parseFormatProfileJson } = await import("./profile-io-UQSLXMWG.js");
|
|
1489
1492
|
profile = parseFormatProfileJson(await readFile3(safePath(profile_path, PROFILE_EXTENSIONS), "utf-8"));
|
|
1490
1493
|
}
|
|
1491
1494
|
const out = safeOutputPath(output_path, /* @__PURE__ */ new Set([".hwpx", ".hwp"]));
|