@shuji-bonji/pdf-reader-mcp 0.11.2 → 0.13.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 (142) hide show
  1. package/CHANGELOG.md +171 -0
  2. package/README.ja.md +90 -5
  3. package/README.md +91 -5
  4. package/dist/constants.d.ts +20 -0
  5. package/dist/constants.d.ts.map +1 -1
  6. package/dist/constants.js +20 -0
  7. package/dist/constants.js.map +1 -1
  8. package/dist/errors.d.ts.map +1 -1
  9. package/dist/errors.js.map +1 -1
  10. package/dist/index.js +14 -3
  11. package/dist/index.js.map +1 -1
  12. package/dist/schemas/common.d.ts +2 -2
  13. package/dist/schemas/common.d.ts.map +1 -1
  14. package/dist/schemas/common.js +1 -2
  15. package/dist/schemas/common.js.map +1 -1
  16. package/dist/schemas/tier1.d.ts +50 -74
  17. package/dist/schemas/tier1.d.ts.map +1 -1
  18. package/dist/schemas/tier1.js +80 -2
  19. package/dist/schemas/tier1.js.map +1 -1
  20. package/dist/schemas/tier2.d.ts +18 -78
  21. package/dist/schemas/tier2.d.ts.map +1 -1
  22. package/dist/schemas/tier3.d.ts +6 -26
  23. package/dist/schemas/tier3.d.ts.map +1 -1
  24. package/dist/services/content-stream-service.d.ts +34 -1
  25. package/dist/services/content-stream-service.d.ts.map +1 -1
  26. package/dist/services/content-stream-service.js +92 -9
  27. package/dist/services/content-stream-service.js.map +1 -1
  28. package/dist/services/image-encoder.d.ts +33 -0
  29. package/dist/services/image-encoder.d.ts.map +1 -0
  30. package/dist/services/image-encoder.js +435 -0
  31. package/dist/services/image-encoder.js.map +1 -0
  32. package/dist/services/image-resampler.d.ts +36 -0
  33. package/dist/services/image-resampler.d.ts.map +1 -0
  34. package/dist/services/image-resampler.js +78 -0
  35. package/dist/services/image-resampler.js.map +1 -0
  36. package/dist/services/page-renderer.d.ts +71 -0
  37. package/dist/services/page-renderer.d.ts.map +1 -0
  38. package/dist/services/page-renderer.js +147 -0
  39. package/dist/services/page-renderer.js.map +1 -0
  40. package/dist/services/pdfjs-service.d.ts +24 -3
  41. package/dist/services/pdfjs-service.d.ts.map +1 -1
  42. package/dist/services/pdfjs-service.js +119 -24
  43. package/dist/services/pdfjs-service.js.map +1 -1
  44. package/dist/services/pdflib-service.d.ts +4 -0
  45. package/dist/services/pdflib-service.d.ts.map +1 -1
  46. package/dist/services/pdflib-service.js +6 -1
  47. package/dist/services/pdflib-service.js.map +1 -1
  48. package/dist/services/struct-tree-service.js.map +1 -1
  49. package/dist/services/struct-tree-walker.js.map +1 -1
  50. package/dist/services/text-extractability-service.d.ts +44 -0
  51. package/dist/services/text-extractability-service.d.ts.map +1 -0
  52. package/dist/services/text-extractability-service.js +302 -0
  53. package/dist/services/text-extractability-service.js.map +1 -0
  54. package/dist/tools/index.d.ts +1 -1
  55. package/dist/tools/index.d.ts.map +1 -1
  56. package/dist/tools/index.js +2 -4
  57. package/dist/tools/index.js.map +1 -1
  58. package/dist/tools/tier1/get-metadata.d.ts +1 -1
  59. package/dist/tools/tier1/get-metadata.d.ts.map +1 -1
  60. package/dist/tools/tier1/get-metadata.js +0 -3
  61. package/dist/tools/tier1/get-metadata.js.map +1 -1
  62. package/dist/tools/tier1/get-page-count.d.ts +1 -1
  63. package/dist/tools/tier1/get-page-count.d.ts.map +1 -1
  64. package/dist/tools/tier1/get-page-count.js +0 -3
  65. package/dist/tools/tier1/get-page-count.js.map +1 -1
  66. package/dist/tools/tier1/read-images.d.ts +2 -2
  67. package/dist/tools/tier1/read-images.d.ts.map +1 -1
  68. package/dist/tools/tier1/read-images.js +72 -45
  69. package/dist/tools/tier1/read-images.js.map +1 -1
  70. package/dist/tools/tier1/read-text.d.ts +1 -1
  71. package/dist/tools/tier1/read-text.d.ts.map +1 -1
  72. package/dist/tools/tier1/read-text.js +22 -10
  73. package/dist/tools/tier1/read-text.js.map +1 -1
  74. package/dist/tools/tier1/read-url.d.ts +1 -1
  75. package/dist/tools/tier1/read-url.d.ts.map +1 -1
  76. package/dist/tools/tier1/read-url.js +24 -9
  77. package/dist/tools/tier1/read-url.js.map +1 -1
  78. package/dist/tools/tier1/render-page.d.ts +6 -0
  79. package/dist/tools/tier1/render-page.d.ts.map +1 -0
  80. package/dist/tools/tier1/render-page.js +90 -0
  81. package/dist/tools/tier1/render-page.js.map +1 -0
  82. package/dist/tools/tier1/search-text.d.ts +1 -1
  83. package/dist/tools/tier1/search-text.d.ts.map +1 -1
  84. package/dist/tools/tier1/search-text.js +17 -5
  85. package/dist/tools/tier1/search-text.js.map +1 -1
  86. package/dist/tools/tier1/summarize.d.ts +1 -1
  87. package/dist/tools/tier1/summarize.d.ts.map +1 -1
  88. package/dist/tools/tier1/summarize.js +73 -5
  89. package/dist/tools/tier1/summarize.js.map +1 -1
  90. package/dist/tools/tier2/extract-structured-text.d.ts +1 -1
  91. package/dist/tools/tier2/extract-structured-text.d.ts.map +1 -1
  92. package/dist/tools/tier2/extract-structured-text.js +19 -9
  93. package/dist/tools/tier2/extract-structured-text.js.map +1 -1
  94. package/dist/tools/tier2/extract-tables.d.ts +1 -1
  95. package/dist/tools/tier2/extract-tables.d.ts.map +1 -1
  96. package/dist/tools/tier2/extract-tables.js +0 -8
  97. package/dist/tools/tier2/extract-tables.js.map +1 -1
  98. package/dist/tools/tier2/inspect-annotations.d.ts +1 -1
  99. package/dist/tools/tier2/inspect-annotations.d.ts.map +1 -1
  100. package/dist/tools/tier2/inspect-annotations.js +0 -3
  101. package/dist/tools/tier2/inspect-annotations.js.map +1 -1
  102. package/dist/tools/tier2/inspect-fonts.d.ts +1 -1
  103. package/dist/tools/tier2/inspect-fonts.d.ts.map +1 -1
  104. package/dist/tools/tier2/inspect-fonts.js +0 -3
  105. package/dist/tools/tier2/inspect-fonts.js.map +1 -1
  106. package/dist/tools/tier2/inspect-signatures.d.ts +1 -1
  107. package/dist/tools/tier2/inspect-signatures.d.ts.map +1 -1
  108. package/dist/tools/tier2/inspect-signatures.js +0 -3
  109. package/dist/tools/tier2/inspect-signatures.js.map +1 -1
  110. package/dist/tools/tier2/inspect-structure.d.ts +1 -1
  111. package/dist/tools/tier2/inspect-structure.d.ts.map +1 -1
  112. package/dist/tools/tier2/inspect-structure.js +0 -3
  113. package/dist/tools/tier2/inspect-structure.js.map +1 -1
  114. package/dist/tools/tier2/inspect-tags.d.ts +1 -1
  115. package/dist/tools/tier2/inspect-tags.d.ts.map +1 -1
  116. package/dist/tools/tier2/inspect-tags.js +0 -3
  117. package/dist/tools/tier2/inspect-tags.js.map +1 -1
  118. package/dist/tools/tier2/locate-objects.d.ts +1 -1
  119. package/dist/tools/tier2/locate-objects.d.ts.map +1 -1
  120. package/dist/tools/tier2/locate-objects.js +0 -3
  121. package/dist/tools/tier2/locate-objects.js.map +1 -1
  122. package/dist/tools/tier3/compare-structure.d.ts +1 -1
  123. package/dist/tools/tier3/compare-structure.d.ts.map +1 -1
  124. package/dist/tools/tier3/compare-structure.js +0 -3
  125. package/dist/tools/tier3/compare-structure.js.map +1 -1
  126. package/dist/tools/tier3/validate-metadata.d.ts +1 -1
  127. package/dist/tools/tier3/validate-metadata.d.ts.map +1 -1
  128. package/dist/tools/tier3/validate-metadata.js +0 -3
  129. package/dist/tools/tier3/validate-metadata.js.map +1 -1
  130. package/dist/tools/tier3/validate-tagged.d.ts +1 -1
  131. package/dist/tools/tier3/validate-tagged.d.ts.map +1 -1
  132. package/dist/tools/tier3/validate-tagged.js +0 -3
  133. package/dist/tools/tier3/validate-tagged.js.map +1 -1
  134. package/dist/types.d.ts +96 -1
  135. package/dist/types.d.ts.map +1 -1
  136. package/dist/utils/batch-processor.js.map +1 -1
  137. package/dist/utils/error-handler.d.ts.map +1 -1
  138. package/dist/utils/error-handler.js.map +1 -1
  139. package/dist/utils/formatter.d.ts.map +1 -1
  140. package/dist/utils/formatter.js +36 -1
  141. package/dist/utils/formatter.js.map +1 -1
  142. package/package.json +11 -5
@@ -5,22 +5,12 @@ import { z } from 'zod';
5
5
  /** get_page_count */
6
6
  export declare const GetPageCountSchema: z.ZodObject<{
7
7
  file_path: z.ZodString;
8
- }, "strict", z.ZodTypeAny, {
9
- file_path: string;
10
- }, {
11
- file_path: string;
12
- }>;
8
+ }, z.core.$strict>;
13
9
  /** get_metadata */
14
10
  export declare const GetMetadataSchema: z.ZodObject<{
15
11
  file_path: z.ZodString;
16
- response_format: z.ZodDefault<z.ZodNativeEnum<typeof import("../constants.js").ResponseFormat>>;
17
- }, "strict", z.ZodTypeAny, {
18
- file_path: string;
19
- response_format: import("../constants.js").ResponseFormat;
20
- }, {
21
- file_path: string;
22
- response_format?: import("../constants.js").ResponseFormat | undefined;
23
- }>;
12
+ response_format: z.ZodDefault<z.ZodEnum<typeof import("../constants.js").ResponseFormat>>;
13
+ }, z.core.$strict>;
24
14
  /**
25
15
  * `split_columns` — Issue #3: column-aware extraction for untagged
26
16
  * multi-column PDFs.
@@ -48,22 +38,10 @@ export declare const CompactWhitespaceSchema: z.ZodOptional<z.ZodBoolean>;
48
38
  export declare const ReadTextSchema: z.ZodObject<{
49
39
  file_path: z.ZodString;
50
40
  pages: z.ZodOptional<z.ZodString>;
51
- response_format: z.ZodDefault<z.ZodNativeEnum<typeof import("../constants.js").ResponseFormat>>;
41
+ response_format: z.ZodDefault<z.ZodEnum<typeof import("../constants.js").ResponseFormat>>;
52
42
  split_columns: z.ZodOptional<z.ZodNumber>;
53
43
  compact_whitespace: z.ZodOptional<z.ZodBoolean>;
54
- }, "strict", z.ZodTypeAny, {
55
- file_path: string;
56
- response_format: import("../constants.js").ResponseFormat;
57
- pages?: string | undefined;
58
- split_columns?: number | undefined;
59
- compact_whitespace?: boolean | undefined;
60
- }, {
61
- file_path: string;
62
- response_format?: import("../constants.js").ResponseFormat | undefined;
63
- pages?: string | undefined;
64
- split_columns?: number | undefined;
65
- compact_whitespace?: boolean | undefined;
66
- }>;
44
+ }, z.core.$strict>;
67
45
  /** search_text */
68
46
  export declare const SearchTextSchema: z.ZodObject<{
69
47
  file_path: z.ZodString;
@@ -71,64 +49,61 @@ export declare const SearchTextSchema: z.ZodObject<{
71
49
  pages: z.ZodOptional<z.ZodString>;
72
50
  context_chars: z.ZodDefault<z.ZodNumber>;
73
51
  max_results: z.ZodDefault<z.ZodNumber>;
74
- response_format: z.ZodDefault<z.ZodNativeEnum<typeof import("../constants.js").ResponseFormat>>;
75
- }, "strict", z.ZodTypeAny, {
76
- file_path: string;
77
- response_format: import("../constants.js").ResponseFormat;
78
- query: string;
79
- context_chars: number;
80
- max_results: number;
81
- pages?: string | undefined;
82
- }, {
83
- file_path: string;
84
- query: string;
85
- response_format?: import("../constants.js").ResponseFormat | undefined;
86
- pages?: string | undefined;
87
- context_chars?: number | undefined;
88
- max_results?: number | undefined;
89
- }>;
90
- /** read_images */
52
+ response_format: z.ZodDefault<z.ZodEnum<typeof import("../constants.js").ResponseFormat>>;
53
+ }, z.core.$strict>;
54
+ /**
55
+ * `read_images` — Issue #22: the response is now real image files, and its size
56
+ * is bounded.
57
+ *
58
+ * `format` defaults to PNG because PNG is lossless: an image extracted for
59
+ * inspection should not have JPEG artefacts added on the way out. `quality`
60
+ * exists for the case where the caller would rather have a smaller response,
61
+ * and is ignored for PNG rather than silently doing nothing surprising.
62
+ */
91
63
  export declare const ReadImagesSchema: z.ZodObject<{
92
64
  file_path: z.ZodString;
93
65
  pages: z.ZodOptional<z.ZodString>;
94
- }, "strict", z.ZodTypeAny, {
95
- file_path: string;
96
- pages?: string | undefined;
97
- }, {
98
- file_path: string;
99
- pages?: string | undefined;
100
- }>;
66
+ format: z.ZodOptional<z.ZodEnum<{
67
+ jpeg: "jpeg";
68
+ png: "png";
69
+ }>>;
70
+ quality: z.ZodOptional<z.ZodNumber>;
71
+ max_width: z.ZodOptional<z.ZodNumber>;
72
+ max_height: z.ZodOptional<z.ZodNumber>;
73
+ }, z.core.$strict>;
101
74
  /** read_url */
102
75
  export declare const ReadUrlSchema: z.ZodObject<{
103
- url: z.ZodString;
76
+ url: z.ZodURL;
104
77
  pages: z.ZodOptional<z.ZodString>;
105
- response_format: z.ZodDefault<z.ZodNativeEnum<typeof import("../constants.js").ResponseFormat>>;
78
+ response_format: z.ZodDefault<z.ZodEnum<typeof import("../constants.js").ResponseFormat>>;
106
79
  split_columns: z.ZodOptional<z.ZodNumber>;
107
80
  compact_whitespace: z.ZodOptional<z.ZodBoolean>;
108
- }, "strict", z.ZodTypeAny, {
109
- url: string;
110
- response_format: import("../constants.js").ResponseFormat;
111
- pages?: string | undefined;
112
- split_columns?: number | undefined;
113
- compact_whitespace?: boolean | undefined;
114
- }, {
115
- url: string;
116
- response_format?: import("../constants.js").ResponseFormat | undefined;
117
- pages?: string | undefined;
118
- split_columns?: number | undefined;
119
- compact_whitespace?: boolean | undefined;
120
- }>;
81
+ }, z.core.$strict>;
121
82
  /** summarize */
122
83
  export declare const SummarizeSchema: z.ZodObject<{
123
84
  file_path: z.ZodString;
124
- response_format: z.ZodDefault<z.ZodNativeEnum<typeof import("../constants.js").ResponseFormat>>;
125
- }, "strict", z.ZodTypeAny, {
126
- file_path: string;
127
- response_format: import("../constants.js").ResponseFormat;
128
- }, {
129
- file_path: string;
130
- response_format?: import("../constants.js").ResponseFormat | undefined;
131
- }>;
85
+ response_format: z.ZodDefault<z.ZodEnum<typeof import("../constants.js").ResponseFormat>>;
86
+ }, z.core.$strict>;
87
+ /**
88
+ * `render_page` — Issue #23: rasterise pages for documents whose text cannot
89
+ * be read as text.
90
+ *
91
+ * `pages` is REQUIRED, unlike every other tool here. Rendering is the most
92
+ * expensive thing this server does, and "all pages" of a 500-page scan is
93
+ * never what a caller means; making the range explicit keeps the cost a
94
+ * decision instead of a default.
95
+ */
96
+ export declare const RenderPageSchema: z.ZodObject<{
97
+ file_path: z.ZodString;
98
+ pages: z.ZodString;
99
+ dpi: z.ZodOptional<z.ZodNumber>;
100
+ max_width: z.ZodOptional<z.ZodNumber>;
101
+ format: z.ZodOptional<z.ZodEnum<{
102
+ jpeg: "jpeg";
103
+ png: "png";
104
+ }>>;
105
+ quality: z.ZodOptional<z.ZodNumber>;
106
+ }, z.core.$strict>;
132
107
  export type GetPageCountInput = z.infer<typeof GetPageCountSchema>;
133
108
  export type GetMetadataInput = z.infer<typeof GetMetadataSchema>;
134
109
  export type ReadTextInput = z.infer<typeof ReadTextSchema>;
@@ -136,4 +111,5 @@ export type SearchTextInput = z.infer<typeof SearchTextSchema>;
136
111
  export type ReadImagesInput = z.infer<typeof ReadImagesSchema>;
137
112
  export type ReadUrlInput = z.infer<typeof ReadUrlSchema>;
138
113
  export type SummarizeInput = z.infer<typeof SummarizeSchema>;
114
+ export type RenderPageInput = z.infer<typeof RenderPageSchema>;
139
115
  //# sourceMappingURL=tier1.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"tier1.d.ts","sourceRoot":"","sources":["../../src/schemas/tier1.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB,qBAAqB;AACrB,eAAO,MAAM,kBAAkB;;;;;;EAIpB,CAAC;AAEZ,mBAAmB;AACnB,eAAO,MAAM,iBAAiB;;;;;;;;;EAKnB,CAAC;AAEZ;;;;;;;;;GASG;AACH,eAAO,MAAM,kBAAkB,4BAW5B,CAAC;AAEJ;;;;;;;;;;GAUG;AACH,eAAO,MAAM,uBAAuB,6BAOjC,CAAC;AAEJ,gBAAgB;AAChB,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;;EAQhB,CAAC;AAEZ,kBAAkB;AAClB,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;EAyBlB,CAAC;AAEZ,kBAAkB;AAClB,eAAO,MAAM,gBAAgB;;;;;;;;;EAKlB,CAAC;AAEZ,eAAe;AACf,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;EAQf,CAAC;AAEZ,gBAAgB;AAChB,eAAO,MAAM,eAAe;;;;;;;;;EAKjB,CAAC;AAGZ,MAAM,MAAM,iBAAiB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kB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AAgB;;;;;;;;;;kBAiClB,CAAC;AAGZ,MAAM,MAAM,iBAAiB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kBAAkB,CAAC,CAAC;AACnE,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,iBAAiB,CAAC,CAAC;AACjE,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,cAAc,CAAC,CAAC;AAC3D,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC,CAAC;AAC/D,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC,CAAC;AAC/D,MAAM,MAAM,YAAY,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,aAAa,CAAC,CAAC;AACzD,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,eAAe,CAAC,CAAC;AAC7D,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC,CAAC"}
@@ -2,7 +2,7 @@
2
2
  * Zod schemas for Tier 1 tools.
3
3
  */
4
4
  import { z } from 'zod';
5
- import { DEFAULT_SEARCH_CONTEXT, MAX_SEARCH_RESULTS } from '../constants.js';
5
+ import { DEFAULT_IMAGE_QUALITY, DEFAULT_SEARCH_CONTEXT, MAX_SEARCH_RESULTS } from '../constants.js';
6
6
  import { FilePathSchema, PagesSchema, ResponseFormatSchema, UrlSchema } from './common.js';
7
7
  /** get_page_count */
8
8
  export const GetPageCountSchema = z
@@ -91,11 +91,46 @@ export const SearchTextSchema = z
91
91
  response_format: ResponseFormatSchema,
92
92
  })
93
93
  .strict();
94
- /** read_images */
94
+ /**
95
+ * `read_images` — Issue #22: the response is now real image files, and its size
96
+ * is bounded.
97
+ *
98
+ * `format` defaults to PNG because PNG is lossless: an image extracted for
99
+ * inspection should not have JPEG artefacts added on the way out. `quality`
100
+ * exists for the case where the caller would rather have a smaller response,
101
+ * and is ignored for PNG rather than silently doing nothing surprising.
102
+ */
95
103
  export const ReadImagesSchema = z
96
104
  .object({
97
105
  file_path: FilePathSchema,
98
106
  pages: PagesSchema,
107
+ format: z
108
+ .enum(['png', 'jpeg'])
109
+ .optional()
110
+ .describe('Encoding of the returned images. png (default) is lossless; jpeg is smaller and ' +
111
+ 'drops alpha (composited over white).'),
112
+ quality: z
113
+ .number()
114
+ .int()
115
+ .min(1)
116
+ .max(100)
117
+ .optional()
118
+ .describe(`JPEG quality 1-100 (default ${DEFAULT_IMAGE_QUALITY}). Ignored when format is png.`),
119
+ max_width: z
120
+ .number()
121
+ .int()
122
+ .min(1)
123
+ .max(10_000)
124
+ .optional()
125
+ .describe('Downscale images wider than this, averaging over the source pixels. Images are ' +
126
+ 'never enlarged. Omit to return each image at its own size.'),
127
+ max_height: z
128
+ .number()
129
+ .int()
130
+ .min(1)
131
+ .max(10_000)
132
+ .optional()
133
+ .describe('Downscale images taller than this. Never enlarges.'),
99
134
  })
100
135
  .strict();
101
136
  /** read_url */
@@ -115,4 +150,47 @@ export const SummarizeSchema = z
115
150
  response_format: ResponseFormatSchema,
116
151
  })
117
152
  .strict();
153
+ /**
154
+ * `render_page` — Issue #23: rasterise pages for documents whose text cannot
155
+ * be read as text.
156
+ *
157
+ * `pages` is REQUIRED, unlike every other tool here. Rendering is the most
158
+ * expensive thing this server does, and "all pages" of a 500-page scan is
159
+ * never what a caller means; making the range explicit keeps the cost a
160
+ * decision instead of a default.
161
+ */
162
+ export const RenderPageSchema = z
163
+ .object({
164
+ file_path: FilePathSchema,
165
+ pages: z
166
+ .string()
167
+ .min(1, 'Page range is required — e.g. "1-3", "5", "1,3,5-7"')
168
+ .describe('Page range to render. Required: rendering all pages is never implicit.'),
169
+ dpi: z
170
+ .number()
171
+ .int()
172
+ .min(36)
173
+ .max(600)
174
+ .optional()
175
+ .describe('Rasterisation density (default 150). PDF points are 1/72 inch.'),
176
+ max_width: z
177
+ .number()
178
+ .int()
179
+ .min(1)
180
+ .max(10_000)
181
+ .optional()
182
+ .describe('Cap on the rendered width in pixels; wins over dpi when smaller.'),
183
+ format: z
184
+ .enum(['png', 'jpeg'])
185
+ .optional()
186
+ .describe('png (default, lossless) or jpeg (smaller — usually right for scans).'),
187
+ quality: z
188
+ .number()
189
+ .int()
190
+ .min(1)
191
+ .max(100)
192
+ .optional()
193
+ .describe(`JPEG quality 1-100 (default ${DEFAULT_IMAGE_QUALITY}). Ignored for png.`),
194
+ })
195
+ .strict();
118
196
  //# sourceMappingURL=tier1.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"tier1.js","sourceRoot":"","sources":["../../src/schemas/tier1.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,sBAAsB,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAC7E,OAAO,EAAE,cAAc,EAAE,WAAW,EAAE,oBAAoB,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAE3F,qBAAqB;AACrB,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC;KAChC,MAAM,CAAC;IACN,SAAS,EAAE,cAAc;CAC1B,CAAC;KACD,MAAM,EAAE,CAAC;AAEZ,mBAAmB;AACnB,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC;KAC/B,MAAM,CAAC;IACN,SAAS,EAAE,cAAc;IACzB,eAAe,EAAE,oBAAoB;CACtC,CAAC;KACD,MAAM,EAAE,CAAC;AAEZ;;;;;;;;;GASG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC;KAChC,MAAM,EAAE;KACR,GAAG,EAAE;KACL,GAAG,CAAC,CAAC,CAAC;KACN,GAAG,CAAC,CAAC,CAAC;KACN,QAAQ,EAAE;KACV,QAAQ,CACP,gFAAgF;IAC9E,0EAA0E;IAC1E,iFAAiF;IACjF,mDAAmD,CACtD,CAAC;AAEJ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AM,CAAC,MAAM,gBAAgB,GAAG,CAAC;KAC9B,MAAM,CAAC;IACN,SAAS,EAAE,cAAc;IACzB,KAAK,EAAE,CAAC;SACL,MAAM,EAAE;SACR,GAAG,CAAC,CAAC,EAAE,qDAAqD,CAAC;SAC7D,QAAQ,CAAC,wEAAwE,CAAC;IACrF,GAAG,EAAE,CAAC;SACH,MAAM,EAAE;SACR,GAAG,EAAE;SACL,GAAG,CAAC,EAAE,CAAC;SACP,GAAG,CAAC,GAAG,CAAC;SACR,QAAQ,EAAE;SACV,QAAQ,CAAC,gEAAgE,CAAC;IAC7E,SAAS,EAAE,CAAC;SACT,MAAM,EAAE;SACR,GAAG,EAAE;SACL,GAAG,CAAC,CAAC,CAAC;SACN,GAAG,CAAC,MAAM,CAAC;SACX,QAAQ,EAAE;SACV,QAAQ,CAAC,kEAAkE,CAAC;IAC/E,MAAM,EAAE,CAAC;SACN,IAAI,CAAC,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;SACrB,QAAQ,EAAE;SACV,QAAQ,CAAC,sEAAsE,CAAC;IACnF,OAAO,EAAE,CAAC;SACP,MAAM,EAAE;SACR,GAAG,EAAE;SACL,GAAG,CAAC,CAAC,CAAC;SACN,GAAG,CAAC,GAAG,CAAC;SACR,QAAQ,EAAE;SACV,QAAQ,CAAC,+BAA+B,qBAAqB,qBAAqB,CAAC;CACvF,CAAC;KACD,MAAM,EAAE,CAAC"}
@@ -5,109 +5,49 @@ import { z } from 'zod';
5
5
  /** inspect_structure */
6
6
  export declare const InspectStructureSchema: z.ZodObject<{
7
7
  file_path: z.ZodString;
8
- response_format: z.ZodDefault<z.ZodNativeEnum<typeof import("../constants.js").ResponseFormat>>;
9
- }, "strict", z.ZodTypeAny, {
10
- file_path: string;
11
- response_format: import("../constants.js").ResponseFormat;
12
- }, {
13
- file_path: string;
14
- response_format?: import("../constants.js").ResponseFormat | undefined;
15
- }>;
8
+ response_format: z.ZodDefault<z.ZodEnum<typeof import("../constants.js").ResponseFormat>>;
9
+ }, z.core.$strict>;
16
10
  /** inspect_tags */
17
11
  export declare const InspectTagsSchema: z.ZodObject<{
18
12
  file_path: z.ZodString;
19
- response_format: z.ZodDefault<z.ZodNativeEnum<typeof import("../constants.js").ResponseFormat>>;
20
- }, "strict", z.ZodTypeAny, {
21
- file_path: string;
22
- response_format: import("../constants.js").ResponseFormat;
23
- }, {
24
- file_path: string;
25
- response_format?: import("../constants.js").ResponseFormat | undefined;
26
- }>;
13
+ response_format: z.ZodDefault<z.ZodEnum<typeof import("../constants.js").ResponseFormat>>;
14
+ }, z.core.$strict>;
27
15
  /** inspect_fonts */
28
16
  export declare const InspectFontsSchema: z.ZodObject<{
29
17
  file_path: z.ZodString;
30
- response_format: z.ZodDefault<z.ZodNativeEnum<typeof import("../constants.js").ResponseFormat>>;
31
- }, "strict", z.ZodTypeAny, {
32
- file_path: string;
33
- response_format: import("../constants.js").ResponseFormat;
34
- }, {
35
- file_path: string;
36
- response_format?: import("../constants.js").ResponseFormat | undefined;
37
- }>;
18
+ response_format: z.ZodDefault<z.ZodEnum<typeof import("../constants.js").ResponseFormat>>;
19
+ }, z.core.$strict>;
38
20
  /** inspect_annotations */
39
21
  export declare const InspectAnnotationsSchema: z.ZodObject<{
40
22
  file_path: z.ZodString;
41
23
  pages: z.ZodOptional<z.ZodString>;
42
- response_format: z.ZodDefault<z.ZodNativeEnum<typeof import("../constants.js").ResponseFormat>>;
43
- }, "strict", z.ZodTypeAny, {
44
- file_path: string;
45
- response_format: import("../constants.js").ResponseFormat;
46
- pages?: string | undefined;
47
- }, {
48
- file_path: string;
49
- response_format?: import("../constants.js").ResponseFormat | undefined;
50
- pages?: string | undefined;
51
- }>;
24
+ response_format: z.ZodDefault<z.ZodEnum<typeof import("../constants.js").ResponseFormat>>;
25
+ }, z.core.$strict>;
52
26
  /** locate_objects */
53
27
  export declare const LocateObjectsSchema: z.ZodObject<{
54
28
  file_path: z.ZodString;
55
- object_numbers: z.ZodArray<z.ZodNumber, "many">;
56
- response_format: z.ZodDefault<z.ZodNativeEnum<typeof import("../constants.js").ResponseFormat>>;
57
- }, "strict", z.ZodTypeAny, {
58
- file_path: string;
59
- response_format: import("../constants.js").ResponseFormat;
60
- object_numbers: number[];
61
- }, {
62
- file_path: string;
63
- object_numbers: number[];
64
- response_format?: import("../constants.js").ResponseFormat | undefined;
65
- }>;
29
+ object_numbers: z.ZodArray<z.ZodNumber>;
30
+ response_format: z.ZodDefault<z.ZodEnum<typeof import("../constants.js").ResponseFormat>>;
31
+ }, z.core.$strict>;
66
32
  /** extract_structured_text */
67
33
  export declare const ExtractStructuredTextSchema: z.ZodObject<{
68
34
  file_path: z.ZodString;
69
35
  pages: z.ZodOptional<z.ZodString>;
70
- roles: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
36
+ roles: z.ZodOptional<z.ZodArray<z.ZodString>>;
71
37
  include_bbox: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
72
- response_format: z.ZodDefault<z.ZodNativeEnum<typeof import("../constants.js").ResponseFormat>>;
73
- }, "strict", z.ZodTypeAny, {
74
- file_path: string;
75
- response_format: import("../constants.js").ResponseFormat;
76
- include_bbox: boolean;
77
- pages?: string | undefined;
78
- roles?: string[] | undefined;
79
- }, {
80
- file_path: string;
81
- response_format?: import("../constants.js").ResponseFormat | undefined;
82
- pages?: string | undefined;
83
- roles?: string[] | undefined;
84
- include_bbox?: boolean | undefined;
85
- }>;
38
+ response_format: z.ZodDefault<z.ZodEnum<typeof import("../constants.js").ResponseFormat>>;
39
+ }, z.core.$strict>;
86
40
  /** inspect_signatures */
87
41
  export declare const InspectSignaturesSchema: z.ZodObject<{
88
42
  file_path: z.ZodString;
89
- response_format: z.ZodDefault<z.ZodNativeEnum<typeof import("../constants.js").ResponseFormat>>;
90
- }, "strict", z.ZodTypeAny, {
91
- file_path: string;
92
- response_format: import("../constants.js").ResponseFormat;
93
- }, {
94
- file_path: string;
95
- response_format?: import("../constants.js").ResponseFormat | undefined;
96
- }>;
43
+ response_format: z.ZodDefault<z.ZodEnum<typeof import("../constants.js").ResponseFormat>>;
44
+ }, z.core.$strict>;
97
45
  /** extract_tables — Tagged PDF Table → Markdown */
98
46
  export declare const ExtractTablesSchema: z.ZodObject<{
99
47
  file_path: z.ZodString;
100
48
  pages: z.ZodOptional<z.ZodString>;
101
- response_format: z.ZodDefault<z.ZodNativeEnum<typeof import("../constants.js").ResponseFormat>>;
102
- }, "strict", z.ZodTypeAny, {
103
- file_path: string;
104
- response_format: import("../constants.js").ResponseFormat;
105
- pages?: string | undefined;
106
- }, {
107
- file_path: string;
108
- response_format?: import("../constants.js").ResponseFormat | undefined;
109
- pages?: string | undefined;
110
- }>;
49
+ response_format: z.ZodDefault<z.ZodEnum<typeof import("../constants.js").ResponseFormat>>;
50
+ }, z.core.$strict>;
111
51
  export type InspectStructureInput = z.infer<typeof InspectStructureSchema>;
112
52
  export type InspectTagsInput = z.infer<typeof InspectTagsSchema>;
113
53
  export type InspectFontsInput = z.infer<typeof InspectFontsSchema>;
@@ -1 +1 @@
1
- {"version":3,"file":"tier2.d.ts","sourceRoot":"","sources":["../../src/schemas/tier2.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,wBAAwB;AACxB,eAAO,MAAM,sBAAsB;;;;;;;;;EAKxB,CAAC;AAEZ,mBAAmB;AACnB,eAAO,MAAM,iBAAiB;;;;;;;;;EAKnB,CAAC;AAEZ,oBAAoB;AACpB,eAAO,MAAM,kBAAkB;;;;;;;;;EAKpB,CAAC;AAEZ,0BAA0B;AAC1B,eAAO,MAAM,wBAAwB;;;;;;;;;;;;EAM1B,CAAC;AAEZ,qBAAqB;AACrB,eAAO,MAAM,mBAAmB;;;;;;;;;;;;EAarB,CAAC;AAEZ,8BAA8B;AAC9B,eAAO,MAAM,2BAA2B;;;;;;;;;;;;;;;;;;EA2B7B,CAAC;AAEZ,yBAAyB;AACzB,eAAO,MAAM,uBAAuB;;;;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A2B;;;;;;kBA2B7B,CAAC;AAEZ,yBAAyB;AACzB,eAAO,MAAM,uBAAuB;;;kBAKzB,CAAC;AAEZ,mDAAmD;AACnD,eAAO,MAAM,mBAAmB;;;;kBAMrB,CAAC;AAGZ,MAAM,MAAM,qBAAqB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,sBAAsB,CAAC,CAAC;AAC3E,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,iBAAiB,CAAC,CAAC;AACjE,MAAM,MAAM,iBAAiB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kBAAkB,CAAC,CAAC;AACnE,MAAM,MAAM,uBAAuB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,wBAAwB,CAAC,CAAC;AAC/E,MAAM,MAAM,sBAAsB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,uBAAuB,CAAC,CAAC;AAC7E,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,mBAAmB,CAAC,CAAC;AACrE,MAAM,MAAM,0BAA0B,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,2BAA2B,CAAC,CAAC;AACrF,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,mBAAmB,CAAC,CAAC"}
@@ -5,39 +5,19 @@ import { z } from 'zod';
5
5
  /** validate_tagged */
6
6
  export declare const ValidateTaggedSchema: z.ZodObject<{
7
7
  file_path: z.ZodString;
8
- response_format: z.ZodDefault<z.ZodNativeEnum<typeof import("../constants.js").ResponseFormat>>;
9
- }, "strict", z.ZodTypeAny, {
10
- file_path: string;
11
- response_format: import("../constants.js").ResponseFormat;
12
- }, {
13
- file_path: string;
14
- response_format?: import("../constants.js").ResponseFormat | undefined;
15
- }>;
8
+ response_format: z.ZodDefault<z.ZodEnum<typeof import("../constants.js").ResponseFormat>>;
9
+ }, z.core.$strict>;
16
10
  /** validate_metadata */
17
11
  export declare const ValidateMetadataSchema: z.ZodObject<{
18
12
  file_path: z.ZodString;
19
- response_format: z.ZodDefault<z.ZodNativeEnum<typeof import("../constants.js").ResponseFormat>>;
20
- }, "strict", z.ZodTypeAny, {
21
- file_path: string;
22
- response_format: import("../constants.js").ResponseFormat;
23
- }, {
24
- file_path: string;
25
- response_format?: import("../constants.js").ResponseFormat | undefined;
26
- }>;
13
+ response_format: z.ZodDefault<z.ZodEnum<typeof import("../constants.js").ResponseFormat>>;
14
+ }, z.core.$strict>;
27
15
  /** compare_structure */
28
16
  export declare const CompareStructureSchema: z.ZodObject<{
29
17
  file_path_1: z.ZodString;
30
18
  file_path_2: z.ZodString;
31
- response_format: z.ZodDefault<z.ZodNativeEnum<typeof import("../constants.js").ResponseFormat>>;
32
- }, "strict", z.ZodTypeAny, {
33
- response_format: import("../constants.js").ResponseFormat;
34
- file_path_1: string;
35
- file_path_2: string;
36
- }, {
37
- file_path_1: string;
38
- file_path_2: string;
39
- response_format?: import("../constants.js").ResponseFormat | undefined;
40
- }>;
19
+ response_format: z.ZodDefault<z.ZodEnum<typeof import("../constants.js").ResponseFormat>>;
20
+ }, z.core.$strict>;
41
21
  export type ValidateTaggedInput = z.infer<typeof ValidateTaggedSchema>;
42
22
  export type ValidateMetadataInput = z.infer<typeof ValidateMetadataSchema>;
43
23
  export type CompareStructureInput = z.infer<typeof CompareStructureSchema>;
@@ -1 +1 @@
1
- {"version":3,"file":"tier3.d.ts","sourceRoot":"","sources":["../../src/schemas/tier3.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,sBAAsB;AACtB,eAAO,MAAM,oBAAoB;;;;;;;;;EAKtB,CAAC;AAEZ,wBAAwB;AACxB,eAAO,MAAM,sBAAsB;;;;;;;;;EAKxB,CAAC;AAEZ,wBAAwB;AACxB,eAAO,MAAM,sBAAsB;;;;;;;;;;;;EAMxB,CAAC;AAGZ,MAAM,MAAM,mBAAmB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC;AACvE,MAAM,MAAM,qBAAqB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,sBAAsB,CAAC,CAAC;AAC3E,MAAM,MAAM,qBAAqB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,sBAAsB,CAAC,CAAC"}
1
+ {"version":3,"file":"tier3.d.ts","sourceRoot":"","sources":["../../src/schemas/tier3.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,sBAAsB;AACtB,eAAO,MAAM,oBAAoB;;;kBAKtB,CAAC;AAEZ,wBAAwB;AACxB,eAAO,MAAM,sBAAsB;;;kBAKxB,CAAC;AAEZ,wBAAwB;AACxB,eAAO,MAAM,sBAAsB;;;;kBAMxB,CAAC;AAGZ,MAAM,MAAM,mBAAmB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC;AACvE,MAAM,MAAM,qBAAqB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,sBAAsB,CAAC,CAAC;AAC3E,MAAM,MAAM,qBAAqB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,sBAAsB,CAAC,CAAC"}
@@ -32,7 +32,7 @@
32
32
  * form's own `/Resources` and falling back to the parent's — exactly what
33
33
  * pdfjs's `case OPS.paintXObject` does.
34
34
  */
35
- import { type PDFDocument } from 'pdf-lib';
35
+ import { PDFDict, type PDFDocument } from 'pdf-lib';
36
36
  /**
37
37
  * One `BMC` / `BDC` / `EMC` operator, in content-stream order.
38
38
  *
@@ -46,6 +46,28 @@ export interface MarkedContentEvent {
46
46
  /** `/ActualText` from the property list, already decoded to a JS string. */
47
47
  actualText?: string;
48
48
  }
49
+ /**
50
+ * What a text-showing operator referenced, collected alongside the
51
+ * marked-content walk (#21).
52
+ *
53
+ * ISO 32000-2 §9.10.1 makes the question "can this page's characters be
54
+ * converted to Unicode?" answerable from the file: it depends on the operators
55
+ * that show text and on the fonts those operators had selected. Both live in the
56
+ * content stream, so they are gathered by the same scan rather than by a second
57
+ * one that could disagree with it.
58
+ *
59
+ * `usedFonts` is keyed by the `Tf` resource name and holds the font dictionary
60
+ * that name resolved to in the resource dictionary then in effect — `null` when
61
+ * the name resolves to nothing, which is itself an observation (the text was
62
+ * shown with a font the file does not describe).
63
+ */
64
+ export interface TextOperatorTally {
65
+ /** `Tj` / `TJ` / `'` / `"` occurrences. */
66
+ textShowingOperators: number;
67
+ /** `Do` on an Image XObject, plus `BI` inline images. */
68
+ imageOperators: number;
69
+ usedFonts: Map<string, PDFDict | null>;
70
+ }
49
71
  /**
50
72
  * Decode a PDF *text string* (§7.9.2.2) from its raw bytes.
51
73
  *
@@ -67,4 +89,15 @@ export declare function decodeTextString(bytes: Uint8Array): string;
67
89
  * @param pageIndex 0-based page index.
68
90
  */
69
91
  export declare function scanPageMarkedContent(doc: PDFDocument, pageIndex: number): MarkedContentEvent[] | null;
92
+ /**
93
+ * The same scan, with the text-showing tally #21 needs kept as well.
94
+ *
95
+ * Returns `null` for the same reasons `scanPageMarkedContent` does — an
96
+ * encrypted document, a missing or undecodable content stream. A `null` here is
97
+ * "not observed", never "no text": the difference is the whole point of #21.
98
+ */
99
+ export declare function scanPageTextOperators(doc: PDFDocument, pageIndex: number): {
100
+ tally: TextOperatorTally;
101
+ actualTextEntries: number;
102
+ } | null;
70
103
  //# sourceMappingURL=content-stream-service.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"content-stream-service.d.ts","sourceRoot":"","sources":["../../src/services/content-stream-service.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AAEH,OAAO,EAIL,KAAK,WAAW,EAUjB,MAAM,SAAS,CAAC;AAEjB;;;;;GAKG;AACH,MAAM,WAAW,kBAAkB;IACjC,IAAI,EAAE,OAAO,GAAG,KAAK,CAAC;IACtB,uEAAuE;IACvE,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,4EAA4E;IAC5E,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAwDD;;;;;;GAMG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,UAAU,GAAG,MAAM,CAQ1D;AAqXD;;;;;;;;;;;GAWG;AACH,wBAAgB,qBAAqB,CACnC,GAAG,EAAE,WAAW,EAChB,SAAS,EAAE,MAAM,GAChB,kBAAkB,EAAE,GAAG,IAAI,CA0C7B"}
1
+ {"version":3,"file":"content-stream-service.d.ts","sourceRoot":"","sources":["../../src/services/content-stream-service.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AAEH,OAAO,EAGL,OAAO,EACP,KAAK,WAAW,EAUjB,MAAM,SAAS,CAAC;AAEjB;;;;;GAKG;AACH,MAAM,WAAW,kBAAkB;IACjC,IAAI,EAAE,OAAO,GAAG,KAAK,CAAC;IACtB,uEAAuE;IACvE,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,4EAA4E;IAC5E,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED;;;;;;;;;;;;;;GAcG;AACH,MAAM,WAAW,iBAAiB;IAChC,2CAA2C;IAC3C,oBAAoB,EAAE,MAAM,CAAC;IAC7B,yDAAyD;IACzD,cAAc,EAAE,MAAM,CAAC;IACvB,SAAS,EAAE,GAAG,CAAC,MAAM,EAAE,OAAO,GAAG,IAAI,CAAC,CAAC;CACxC;AA6DD;;;;;;GAMG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,UAAU,GAAG,MAAM,CAQ1D;AA2aD;;;;;;;;;;;GAWG;AACH,wBAAgB,qBAAqB,CACnC,GAAG,EAAE,WAAW,EAChB,SAAS,EAAE,MAAM,GAChB,kBAAkB,EAAE,GAAG,IAAI,CAE7B;AAED;;;;;;GAMG;AACH,wBAAgB,qBAAqB,CACnC,GAAG,EAAE,WAAW,EAChB,SAAS,EAAE,MAAM,GAChB;IAAE,KAAK,EAAE,iBAAiB,CAAC;IAAC,iBAAiB,EAAE,MAAM,CAAA;CAAE,GAAG,IAAI,CAOhE"}