hwpx2f 0.0.0-stage → 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (73) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +124 -2
  3. package/THIRD_PARTY_NOTICES.md +75 -0
  4. package/dist/cli.js +76 -0
  5. package/dist/index.d.ts +11 -0
  6. package/dist/index.js +32 -0
  7. package/dist/lib/chunk-36PRCVPO.js +131 -0
  8. package/dist/lib/chunk-45BAITEX.js +9749 -0
  9. package/dist/lib/chunk-4NRZ6MWV.js +133 -0
  10. package/dist/lib/chunk-6CFXTS7A.js +11971 -0
  11. package/dist/lib/chunk-6CPCDYOD.js +104 -0
  12. package/dist/lib/chunk-B6MTS4XP.js +313 -0
  13. package/dist/lib/chunk-BX24E7EG.js +1427 -0
  14. package/dist/lib/chunk-C64I2SU4.js +82 -0
  15. package/dist/lib/chunk-CEKQASS3.js +258 -0
  16. package/dist/lib/chunk-CMWTKXM2.js +204 -0
  17. package/dist/lib/chunk-E6KSYRHG.js +2189 -0
  18. package/dist/lib/chunk-IZDWVMTV.js +28786 -0
  19. package/dist/lib/chunk-JK6YR5NT.js +4276 -0
  20. package/dist/lib/chunk-O6FSHPNE.js +111 -0
  21. package/dist/lib/chunk-OYXOOP2U.js +199 -0
  22. package/dist/lib/chunk-PM4KBWF4.js +49 -0
  23. package/dist/lib/chunk-R5F3GHLO.js +290 -0
  24. package/dist/lib/chunk-R76DWHJR.js +1596 -0
  25. package/dist/lib/chunk-RFS3RTSR.js +6876 -0
  26. package/dist/lib/chunk-RYJRNK5Z.js +47 -0
  27. package/dist/lib/chunk-UOXPGSFH.js +43 -0
  28. package/dist/lib/chunk-UZH4UBMX.js +44 -0
  29. package/dist/lib/chunk-VZTE4GKI.js +52 -0
  30. package/dist/lib/chunk-WEOKEO6L.js +35291 -0
  31. package/dist/lib/detect-4XZNNYZA-O7IPA4XQ.js +32 -0
  32. package/dist/lib/dist-HVSOXNCJ.js +263 -0
  33. package/dist/lib/formula-LC62GV4D-K3VFC5GV.js +1173 -0
  34. package/dist/lib/generator-KYTTL4OS-TRAQ66QE.js +14 -0
  35. package/dist/lib/hancom-EM62ZVDM-WZKVI7XB.js +91 -0
  36. package/dist/lib/image-ocr-ZUZQXLYS-U66LBMRA.js +293 -0
  37. package/dist/lib/page-images-VCIFZAXK-KJLWQDRH.js +95 -0
  38. package/dist/lib/page-range-7R3JU6SQ-MDDQRZVK.js +10 -0
  39. package/dist/lib/parser-JQNH5QMM-HFFI4HYK.js +4310 -0
  40. package/dist/lib/pdf-ocr-C3MBR6J2-J3UGJKWT.js +46 -0
  41. package/dist/lib/to-hwpx-JUT2SOTT-MOPPK6OW.js +17 -0
  42. package/dist/notices/core-util-is/LICENSE +19 -0
  43. package/dist/notices/entities/LICENSE +11 -0
  44. package/dist/notices/immediate/LICENSE.txt +20 -0
  45. package/dist/notices/inherits/LICENSE +16 -0
  46. package/dist/notices/jszip/LICENSE.markdown +651 -0
  47. package/dist/notices/kordoc/LICENSE +21 -0
  48. package/dist/notices/kordoc/NOTICE +376 -0
  49. package/dist/notices/kordoc/THIRD_PARTY/apache-2.0.LICENSE +201 -0
  50. package/dist/notices/kordoc/THIRD_PARTY/claw-hwp.LICENSE +21 -0
  51. package/dist/notices/kordoc/THIRD_PARTY/hayro-pdf.txt +361 -0
  52. package/dist/notices/kordoc/THIRD_PARTY/hml-equation-parser.LICENSE +201 -0
  53. package/dist/notices/kordoc/THIRD_PARTY/hml-equation-parser.txt +35 -0
  54. package/dist/notices/kordoc/THIRD_PARTY/korean-report-hwpx.LICENSE +21 -0
  55. package/dist/notices/kordoc/THIRD_PARTY/memchr.LICENSE +21 -0
  56. package/dist/notices/kordoc/THIRD_PARTY/opendataloader-pdf.txt +32 -0
  57. package/dist/notices/kordoc/THIRD_PARTY/pix2text.txt +17 -0
  58. package/dist/notices/kordoc/THIRD_PARTY/quick-xml.LICENSE +23 -0
  59. package/dist/notices/kordoc/THIRD_PARTY/rhwp-forms.txt +35 -0
  60. package/dist/notices/lie/license.md +7 -0
  61. package/dist/notices/linkify-it/LICENSE +22 -0
  62. package/dist/notices/markdown-it/LICENSE +22 -0
  63. package/dist/notices/mdurl/LICENSE +45 -0
  64. package/dist/notices/pako/LICENSE +21 -0
  65. package/dist/notices/process-nextick-args/license.md +19 -0
  66. package/dist/notices/punycode.js/LICENSE-MIT.txt +20 -0
  67. package/dist/notices/readable-stream/LICENSE +47 -0
  68. package/dist/notices/safe-buffer/LICENSE +21 -0
  69. package/dist/notices/setimmediate/LICENSE.txt +20 -0
  70. package/dist/notices/string_decoder/LICENSE +48 -0
  71. package/dist/notices/uc.micro/LICENSE.txt +20 -0
  72. package/dist/notices/util-deprecate/LICENSE +24 -0
  73. package/package.json +66 -4
@@ -0,0 +1,47 @@
1
+ import { createRequire as __hwpx2fRequire } from 'node:module'; const require = __hwpx2fRequire(import.meta.url);
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
9
+ get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
10
+ }) : x)(function(x) {
11
+ if (typeof require !== "undefined") return require.apply(this, arguments);
12
+ throw Error('Dynamic require of "' + x + '" is not supported');
13
+ });
14
+ var __commonJS = (cb, mod) => function __require2() {
15
+ try {
16
+ return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
17
+ } catch (e) {
18
+ throw mod = 0, e;
19
+ }
20
+ };
21
+ var __export = (target, all) => {
22
+ for (var name in all)
23
+ __defProp(target, name, { get: all[name], enumerable: true });
24
+ };
25
+ var __copyProps = (to, from, except, desc) => {
26
+ if (from && typeof from === "object" || typeof from === "function") {
27
+ for (let key of __getOwnPropNames(from))
28
+ if (!__hasOwnProp.call(to, key) && key !== except)
29
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
30
+ }
31
+ return to;
32
+ };
33
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
34
+ // If the importer is in node compatibility mode or this is not an ESM
35
+ // file that has been converted to a CommonJS file using a Babel-
36
+ // compatible transform (i.e. "__esModule" has not been set), then set
37
+ // "default" to the CommonJS "module.exports" for node compatibility.
38
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
39
+ mod
40
+ ));
41
+
42
+ export {
43
+ __require,
44
+ __commonJS,
45
+ __export,
46
+ __toESM
47
+ };
@@ -0,0 +1,43 @@
1
+ import { createRequire as __hwpx2fRequire } from 'node:module'; const require = __hwpx2fRequire(import.meta.url);
2
+
3
+ // node_modules/kordoc/dist/chunk-NOOMBGOA.js
4
+ function disableOrtTelemetry() {
5
+ if (typeof process !== "undefined" && process.env) process.env.ORT_DISABLE_TELEMETRY = "1";
6
+ }
7
+ var AUTO_GPU_EPS = {
8
+ win32: ["dml", "webgpu"],
9
+ darwin: ["webgpu"],
10
+ // CoreML 은 입력 크기가 매번 달라 OCR 모델에서 CPU 보다 느리다
11
+ "linux-x64": ["cuda", "webgpu"],
12
+ "linux-arm64": ["cuda"]
13
+ };
14
+ function ortProviderCandidates(raw = typeof process !== "undefined" ? process.env?.KORDOC_ORT_PROVIDERS : void 0, platform = typeof process !== "undefined" ? process.platform : "", arch = typeof process !== "undefined" ? process.arch : "") {
15
+ const list = (raw ?? "").split(",").map((s) => s.trim().toLowerCase()).filter(Boolean);
16
+ if (list.length === 1 && list[0] === "auto") {
17
+ const gpus = AUTO_GPU_EPS[platform] ?? AUTO_GPU_EPS[`${platform}-${arch}`] ?? [];
18
+ return [...gpus.map((ep) => [ep, "cpu"]), ["cpu"]];
19
+ }
20
+ return [list.length > 0 ? list : ["cpu"]];
21
+ }
22
+ function ortProvidersSetting() {
23
+ const raw = typeof process !== "undefined" ? process.env?.KORDOC_ORT_PROVIDERS?.trim() : void 0;
24
+ return raw ? raw : null;
25
+ }
26
+ async function createOrtSession(create, opts) {
27
+ const candidates = ortProviderCandidates();
28
+ for (let i = 0; ; i++) {
29
+ const eps = candidates[i];
30
+ const dml = eps.includes("dml") ? { enableMemPattern: false, executionMode: "sequential" } : {};
31
+ try {
32
+ return await create({ ...opts, ...dml, executionProviders: eps });
33
+ } catch (e) {
34
+ if (i >= candidates.length - 1) throw e;
35
+ }
36
+ }
37
+ }
38
+
39
+ export {
40
+ disableOrtTelemetry,
41
+ ortProvidersSetting,
42
+ createOrtSession
43
+ };
@@ -0,0 +1,44 @@
1
+ import { createRequire as __hwpx2fRequire } from 'node:module'; const require = __hwpx2fRequire(import.meta.url);
2
+
3
+ // node_modules/kordoc/dist/chunk-YVFNHYJK.js
4
+ function flushHeifCache(sharp) {
5
+ const c = sharp.cache();
6
+ sharp.cache(false);
7
+ sharp.cache({ memory: c.memory.max, files: c.files.max, items: c.items.max });
8
+ }
9
+ var loading;
10
+ function loadSharp() {
11
+ return loading ??= (async () => {
12
+ try {
13
+ const mod = await import("sharp");
14
+ return typeof mod === "function" ? mod : mod.default ?? mod;
15
+ } catch {
16
+ return null;
17
+ }
18
+ })();
19
+ }
20
+ var toBuffer = (b) => Buffer.from(b.buffer, b.byteOffset, b.byteLength);
21
+ var WEBP_OPTIONS = { lossless: true, exact: true, effort: 1, quality: 1 };
22
+ function encoder(sharp) {
23
+ return async (rgba, width, height) => {
24
+ const out = await sharp(toBuffer(rgba), { raw: { width, height, channels: 4 } }).webp(WEBP_OPTIONS).toBuffer();
25
+ return new Uint8Array(out.buffer, out.byteOffset, out.byteLength);
26
+ };
27
+ }
28
+ async function loadWebpEncoder() {
29
+ const sharp = await loadSharp();
30
+ return sharp && encoder(sharp);
31
+ }
32
+ var WEBP_UNAVAILABLE = {
33
+ code: "PARTIAL_PARSE",
34
+ message: "WebP \uB85C \uB0B4\uB824\uBA74 optional dependency 'sharp' \uAC00 \uD544\uC694\uD569\uB2C8\uB2E4 \u2014 PDF \uADF8\uB9BC\uC740 PNG, \uB2E4\uB978 \uD615\uC2DD\uC740 \uC6D0\uBCF8 \uADF8\uB9BC \uADF8\uB300\uB85C \uB0C8\uC2B5\uB2C8\uB2E4. `npm install sharp` \uD6C4 \uB2E4\uC2DC \uC2E4\uD589\uD558\uC138\uC694"
35
+ };
36
+
37
+ export {
38
+ flushHeifCache,
39
+ loadSharp,
40
+ toBuffer,
41
+ WEBP_OPTIONS,
42
+ loadWebpEncoder,
43
+ WEBP_UNAVAILABLE
44
+ };
@@ -0,0 +1,52 @@
1
+ import { createRequire as __hwpx2fRequire } from 'node:module'; const require = __hwpx2fRequire(import.meta.url);
2
+
3
+ // node_modules/kordoc/dist/chunk-Y56TLZ42.js
4
+ function parsePageRange(spec, maxPages) {
5
+ const result = /* @__PURE__ */ new Set();
6
+ if (maxPages <= 0) return result;
7
+ if (Array.isArray(spec)) {
8
+ for (const n of spec) {
9
+ const page = Math.round(n);
10
+ if (page >= 1 && page <= maxPages) result.add(page);
11
+ }
12
+ return result;
13
+ }
14
+ if (typeof spec !== "string" || spec.trim() === "") return result;
15
+ const parts = spec.split(",");
16
+ for (const part of parts) {
17
+ const trimmed = part.trim();
18
+ if (!trimmed) continue;
19
+ const rangeMatch = trimmed.match(/^(\d+)\s*-\s*(\d+)$/);
20
+ if (rangeMatch) {
21
+ const start = Math.max(1, parseInt(rangeMatch[1], 10));
22
+ const end = Math.min(maxPages, parseInt(rangeMatch[2], 10));
23
+ for (let i = start; i <= end; i++) result.add(i);
24
+ } else {
25
+ const page = parseInt(trimmed, 10);
26
+ if (!isNaN(page) && page >= 1 && page <= maxPages) result.add(page);
27
+ }
28
+ }
29
+ return result;
30
+ }
31
+ function hasRequestedPagesAfter(spec, maxParsed, total) {
32
+ if (total <= 0 || total <= maxParsed) return false;
33
+ const beyond = (page) => page >= 1 && page <= total && page > maxParsed;
34
+ if (Array.isArray(spec)) return spec.some((n) => beyond(Math.round(n)));
35
+ if (typeof spec !== "string" || spec.trim() === "") return false;
36
+ for (const part of spec.split(",")) {
37
+ const trimmed = part.trim();
38
+ if (!trimmed) continue;
39
+ const rangeMatch = trimmed.match(/^(\d+)\s*-\s*(\d+)$/);
40
+ if (rangeMatch) {
41
+ const start = Math.max(1, parseInt(rangeMatch[1], 10), Math.floor(maxParsed) + 1);
42
+ const end = Math.min(total, parseInt(rangeMatch[2], 10));
43
+ if (start <= end) return true;
44
+ } else if (beyond(parseInt(trimmed, 10))) return true;
45
+ }
46
+ return false;
47
+ }
48
+
49
+ export {
50
+ parsePageRange,
51
+ hasRequestedPagesAfter
52
+ };