@embedpdf/engine-core 3.0.0-next.13 → 3.0.0-next.15

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 (135) hide show
  1. package/dist/AnnotationList-CkijRHet.d.cts +27163 -0
  2. package/dist/AnnotationList-CkijRHet.d.ts +27163 -0
  3. package/dist/Change-CKoxfTNY.js +889 -0
  4. package/dist/Change-CKoxfTNY.js.map +1 -0
  5. package/dist/Change-CjImsrN0.cjs +1020 -0
  6. package/dist/Change-CjImsrN0.cjs.map +1 -0
  7. package/dist/DocumentRenderService-BfFdFSwI.cjs +120 -0
  8. package/dist/DocumentRenderService-BfFdFSwI.cjs.map +1 -0
  9. package/dist/DocumentRenderService-DV3J9lMz.js +85 -0
  10. package/dist/DocumentRenderService-DV3J9lMz.js.map +1 -0
  11. package/dist/{DocumentSecurityService-_JRjqvoI.d.ts → DocumentSecurityService-CU1M6Q7m.d.ts} +100 -112
  12. package/dist/{DocumentSecurityService-ClTZc0zO.d.cts → DocumentSecurityService-e6vp2de8.d.cts} +100 -112
  13. package/dist/LocalDocumentHandle-D02FMm-Z.cjs +53 -0
  14. package/dist/LocalDocumentHandle-D02FMm-Z.cjs.map +1 -0
  15. package/dist/LocalDocumentHandle-DAPdaOt_.js +30 -0
  16. package/dist/LocalDocumentHandle-DAPdaOt_.js.map +1 -0
  17. package/dist/LocalEngine-DFoBm4B3.d.cts +1565 -0
  18. package/dist/LocalEngine-DPriFujS.d.ts +1565 -0
  19. package/dist/PageInsertBlankInput-CXHAM7l6.cjs +17 -0
  20. package/dist/PageInsertBlankInput-CXHAM7l6.cjs.map +1 -0
  21. package/dist/PageInsertBlankInput-DhVYVJ_S.js +12 -0
  22. package/dist/PageInsertBlankInput-DhVYVJ_S.js.map +1 -0
  23. package/dist/authority-B3BklsB4.js +2239 -0
  24. package/dist/authority-B3BklsB4.js.map +1 -0
  25. package/dist/authority-DLMNR7ff.cjs +2676 -0
  26. package/dist/authority-DLMNR7ff.cjs.map +1 -0
  27. package/dist/builders-CNj0POeY.js +161 -0
  28. package/dist/builders-CNj0POeY.js.map +1 -0
  29. package/dist/builders-Cgdp_YCn.cjs +184 -0
  30. package/dist/builders-Cgdp_YCn.cjs.map +1 -0
  31. package/dist/calibrate-7T3fnP8-.js +2404 -0
  32. package/dist/calibrate-7T3fnP8-.js.map +1 -0
  33. package/dist/calibrate-DJBXnhLE.cjs +2919 -0
  34. package/dist/calibrate-DJBXnhLE.cjs.map +1 -0
  35. package/dist/charmap-Cprti1ta.js +239 -0
  36. package/dist/charmap-Cprti1ta.js.map +1 -0
  37. package/dist/charmap-aYlefQP9.cjs +304 -0
  38. package/dist/charmap-aYlefQP9.cjs.map +1 -0
  39. package/dist/conformance.cjs +16753 -5247
  40. package/dist/conformance.cjs.map +1 -1
  41. package/dist/conformance.d.cts +928 -165
  42. package/dist/conformance.d.ts +928 -165
  43. package/dist/conformance.js +16731 -5268
  44. package/dist/conformance.js.map +1 -1
  45. package/dist/format-Bp3QFSH1.cjs +574 -0
  46. package/dist/format-Bp3QFSH1.cjs.map +1 -0
  47. package/dist/format-Dgg428Kb.js +461 -0
  48. package/dist/format-Dgg428Kb.js.map +1 -0
  49. package/dist/index.cjs +330 -103
  50. package/dist/index.d.cts +2 -2
  51. package/dist/index.d.ts +2 -2
  52. package/dist/index.js +14 -5
  53. package/dist/pageRefs-B3ur7Ckm.cjs +51 -0
  54. package/dist/pageRefs-B3ur7Ckm.cjs.map +1 -0
  55. package/dist/pageRefs-DkbuxSCV.js +40 -0
  56. package/dist/pageRefs-DkbuxSCV.js.map +1 -0
  57. package/dist/public.cjs +57 -0
  58. package/dist/public.d.cts +5 -0
  59. package/dist/public.d.ts +5 -0
  60. package/dist/public.js +9 -0
  61. package/dist/resolveAnnotationDraft-7Ke4nV7F.cjs +3646 -0
  62. package/dist/resolveAnnotationDraft-7Ke4nV7F.cjs.map +1 -0
  63. package/dist/resolveAnnotationDraft-CUpf0SMh.js +3167 -0
  64. package/dist/resolveAnnotationDraft-CUpf0SMh.js.map +1 -0
  65. package/dist/{resolver-inAVzsWt.js → resolver-CzxmD9Ck.js} +294 -144
  66. package/dist/resolver-CzxmD9Ck.js.map +1 -0
  67. package/dist/{resolver-CYVNV4hn.cjs → resolver-D2OCtE8F.cjs} +347 -143
  68. package/dist/resolver-D2OCtE8F.cjs.map +1 -0
  69. package/dist/runtime-Cl0v56mm.d.ts +2032 -0
  70. package/dist/runtime-p1WDzDo4.d.cts +2032 -0
  71. package/dist/runtime.cjs +733 -284
  72. package/dist/runtime.cjs.map +1 -1
  73. package/dist/runtime.d.cts +5 -1348
  74. package/dist/runtime.d.ts +5 -1348
  75. package/dist/runtime.js +396 -179
  76. package/dist/runtime.js.map +1 -1
  77. package/dist/schema-C-gU4vj7.cjs +3034 -0
  78. package/dist/schema-C-gU4vj7.cjs.map +1 -0
  79. package/dist/schema-DzlUNk38.js +2081 -0
  80. package/dist/schema-DzlUNk38.js.map +1 -0
  81. package/dist/schemas-Berf1swF.cjs +2481 -0
  82. package/dist/schemas-Berf1swF.cjs.map +1 -0
  83. package/dist/schemas-D6xOGjqg.js +1654 -0
  84. package/dist/schemas-D6xOGjqg.js.map +1 -0
  85. package/dist/subtype-CG4WpIRj.js +129 -0
  86. package/dist/subtype-CG4WpIRj.js.map +1 -0
  87. package/dist/subtype-aDt5TFmK.cjs +158 -0
  88. package/dist/subtype-aDt5TFmK.cjs.map +1 -0
  89. package/dist/validation.cjs +578 -0
  90. package/dist/validation.cjs.map +1 -0
  91. package/dist/validation.d.cts +174 -0
  92. package/dist/validation.d.ts +174 -0
  93. package/dist/validation.js +571 -0
  94. package/dist/validation.js.map +1 -0
  95. package/dist/value-BFS1R8ek.cjs +435 -0
  96. package/dist/value-BFS1R8ek.cjs.map +1 -0
  97. package/dist/value-Dhc8eYcx.js +340 -0
  98. package/dist/value-Dhc8eYcx.js.map +1 -0
  99. package/dist/viewport-BJW13EGZ.js +540 -0
  100. package/dist/viewport-BJW13EGZ.js.map +1 -0
  101. package/dist/viewport-DlL5Bxbg.cjs +671 -0
  102. package/dist/viewport-DlL5Bxbg.cjs.map +1 -0
  103. package/dist/wire.cjs +1056 -379
  104. package/dist/wire.cjs.map +1 -1
  105. package/dist/wire.d.cts +15069 -725
  106. package/dist/wire.d.ts +15069 -725
  107. package/dist/wire.js +825 -239
  108. package/dist/wire.js.map +1 -1
  109. package/package.json +10 -1
  110. package/dist/AbortError-Cq2igpZ6.cjs +0 -38
  111. package/dist/AbortError-Cq2igpZ6.cjs.map +0 -1
  112. package/dist/AbortError-DHqPBnYc.js +0 -27
  113. package/dist/AbortError-DHqPBnYc.js.map +0 -1
  114. package/dist/AnnotationListSnapshot-D3mFut1e.d.cts +0 -6871
  115. package/dist/AnnotationListSnapshot-D3mFut1e.d.ts +0 -6871
  116. package/dist/Engine-Bx0NOfmd.d.cts +0 -1264
  117. package/dist/Engine-DxtpCYcP.d.ts +0 -1264
  118. package/dist/PageInsertBlankInput-CqXBmFhN.cjs +0 -449
  119. package/dist/PageInsertBlankInput-CqXBmFhN.cjs.map +0 -1
  120. package/dist/PageInsertBlankInput-cHq9-i-z.js +0 -378
  121. package/dist/PageInsertBlankInput-cHq9-i-z.js.map +0 -1
  122. package/dist/builders-Bqm8yTpi.cjs +0 -3564
  123. package/dist/builders-Bqm8yTpi.cjs.map +0 -1
  124. package/dist/builders-Dqo2X-dt.js +0 -3121
  125. package/dist/builders-Dqo2X-dt.js.map +0 -1
  126. package/dist/fold-2V29cxCV.cjs +0 -447
  127. package/dist/fold-2V29cxCV.cjs.map +0 -1
  128. package/dist/fold-CdEJTBTn.js +0 -334
  129. package/dist/fold-CdEJTBTn.js.map +0 -1
  130. package/dist/resolver-CYVNV4hn.cjs.map +0 -1
  131. package/dist/resolver-inAVzsWt.js.map +0 -1
  132. package/dist/schemas-BLARNCgx.js +0 -3113
  133. package/dist/schemas-BLARNCgx.js.map +0 -1
  134. package/dist/schemas-DIqFMmrC.cjs +0 -4468
  135. package/dist/schemas-DIqFMmrC.cjs.map +0 -1
@@ -1,3113 +0,0 @@
1
- import { f as EngineErrorCode, i as charMapViolation, u as PdfAnnotationSubtypeCode } from "./PageInsertBlankInput-cHq9-i-z.js";
2
- import { z } from "zod";
3
- //#region src/geometry/schemas.ts
4
- /**
5
- * Zod schemas for engine PDF-document geometry. Exported from `wire.ts` ONLY
6
- * (never from `shared.ts`/`runtime`) so the zod-free runtime stays zod-free.
7
- */
8
- const PdfPointSchema = z.object({
9
- x: z.number(),
10
- y: z.number()
11
- });
12
- const LinePointsSchema = z.object({
13
- start: PdfPointSchema,
14
- end: PdfPointSchema
15
- });
16
- /** `/CL` callout leader line — two points (straight) or three (knee-jointed). */
17
- const CalloutLineSchema = z.union([z.tuple([PdfPointSchema, PdfPointSchema]), z.tuple([
18
- PdfPointSchema,
19
- PdfPointSchema,
20
- PdfPointSchema
21
- ])]);
22
- /** `/InkList` — an array of strokes, each an array of points. */
23
- const InkListSchema = z.array(z.array(PdfPointSchema));
24
- const PdfRectSchema = z.object({
25
- left: z.number(),
26
- bottom: z.number(),
27
- right: z.number(),
28
- top: z.number()
29
- });
30
- const PdfSizeSchema = z.object({
31
- width: z.number().nonnegative(),
32
- height: z.number().nonnegative()
33
- });
34
- const PdfQuadSchema = z.object({
35
- p1: PdfPointSchema,
36
- p2: PdfPointSchema,
37
- p3: PdfPointSchema,
38
- p4: PdfPointSchema
39
- });
40
- const PdfRotationSchema = z.union([
41
- z.literal(0),
42
- z.literal(90),
43
- z.literal(180),
44
- z.literal(270)
45
- ]);
46
- //#endregion
47
- //#region src/dto/PdfDestination.schema.ts
48
- const pageObjectNumber = z.number().int().positive();
49
- /** Spec-nullable axis value: absent and `null` both mean "retain current". */
50
- const axis = z.number().nullable().optional();
51
- /**
52
- * Runtime schema for {@link PdfDestination}. Lives beside its DTO in `dto/`
53
- * so every destination-shaped surface (link targets, action-node payloads,
54
- * the document `openDestination`) shares one schema without an import cycle
55
- * through the annotation tree.
56
- */
57
- const PdfDestinationSchema = z.discriminatedUnion("kind", [
58
- z.object({
59
- kind: z.literal("xyz"),
60
- pageObjectNumber,
61
- left: axis,
62
- top: axis,
63
- zoom: axis
64
- }),
65
- z.object({
66
- kind: z.literal("fit"),
67
- pageObjectNumber
68
- }),
69
- z.object({
70
- kind: z.literal("fitH"),
71
- pageObjectNumber,
72
- top: axis
73
- }),
74
- z.object({
75
- kind: z.literal("fitV"),
76
- pageObjectNumber,
77
- left: axis
78
- }),
79
- z.object({
80
- kind: z.literal("fitR"),
81
- pageObjectNumber,
82
- left: z.number(),
83
- bottom: z.number(),
84
- right: z.number(),
85
- top: z.number()
86
- }),
87
- z.object({
88
- kind: z.literal("fitB"),
89
- pageObjectNumber
90
- }),
91
- z.object({
92
- kind: z.literal("fitBH"),
93
- pageObjectNumber,
94
- top: axis
95
- }),
96
- z.object({
97
- kind: z.literal("fitBV"),
98
- pageObjectNumber,
99
- left: axis
100
- })
101
- ]);
102
- //#endregion
103
- //#region src/dto/PdfAction.schema.ts
104
- const PdfActionTargetRefSchema = z.discriminatedUnion("kind", [z.object({
105
- kind: z.literal("name"),
106
- name: z.string()
107
- }), z.object({
108
- kind: z.literal("objectNumber"),
109
- objectNumber: z.number().int().positive()
110
- })]);
111
- /** Fields every node arm repeats — zod 3's discriminatedUnion needs plain
112
- * object options, so the recursion (`next`) lives inline per arm and the
113
- * whole union sits behind one `z.lazy`. */
114
- const nodeCommon = {
115
- subtype: z.string(),
116
- next: z.array(z.lazy(() => PdfActionNodeSchema))
117
- };
118
- const arm = (type, shape = {}) => z.object({
119
- type: z.literal(type),
120
- ...nodeCommon,
121
- ...shape
122
- });
123
- const SubmitFormFlagsSchema = z.object({
124
- raw: z.number().int().nonnegative(),
125
- exclude: z.boolean(),
126
- includeNoValueFields: z.boolean(),
127
- format: z.enum([
128
- "fdf",
129
- "html",
130
- "xfdf",
131
- "pdf"
132
- ]),
133
- method: z.enum(["post", "get"]),
134
- submitCoordinates: z.boolean(),
135
- includeAppendSaves: z.boolean(),
136
- includeAnnotations: z.boolean(),
137
- canonicalFormat: z.boolean(),
138
- exclNonUserAnnots: z.boolean(),
139
- exclFKey: z.boolean(),
140
- embedForm: z.boolean()
141
- });
142
- const PDF_ACTION_NODE_ARMS = [
143
- arm("javascript", { script: z.string() }),
144
- arm("goto", { destination: PdfDestinationSchema }),
145
- arm("uri", {
146
- uri: z.string(),
147
- isMap: z.boolean()
148
- }),
149
- arm("named", { name: z.string() }),
150
- arm("hide", {
151
- targets: z.array(PdfActionTargetRefSchema),
152
- hide: z.boolean()
153
- }),
154
- arm("reset-form", {
155
- fields: z.array(PdfActionTargetRefSchema).nullable(),
156
- exclude: z.boolean()
157
- }),
158
- arm("goto-remote", { filePath: z.string() }),
159
- arm("goto-embedded", { filePath: z.string() }),
160
- arm("launch", { filePath: z.string() }),
161
- arm("rendition", { script: z.string().optional() }),
162
- arm("submit-form", { payload: z.object({
163
- url: z.string(),
164
- fields: z.array(PdfActionTargetRefSchema).nullable(),
165
- flags: SubmitFormFlagsSchema,
166
- charSet: z.string().optional()
167
- }).optional() }),
168
- arm("thread"),
169
- arm("sound"),
170
- arm("movie"),
171
- arm("import-data"),
172
- arm("set-ocg-state"),
173
- arm("transition"),
174
- arm("goto-3d-view"),
175
- arm("unknown")
176
- ];
177
- const PdfActionNodeSchema = z.lazy(() => z.discriminatedUnion("type", [...PDF_ACTION_NODE_ARMS]));
178
- /** The `/S` vocabulary, derived from the union arms so it cannot drift. */
179
- const PdfActionTypeSchema = z.enum(PDF_ACTION_NODE_ARMS.map((option) => option.shape.type.value));
180
- const PdfActionTreeSchema = z.object({
181
- root: PdfActionNodeSchema.nullable(),
182
- incomplete: z.boolean(),
183
- warningFlags: z.number().int().nonnegative(),
184
- warnings: z.array(z.enum([
185
- "cycle-dropped",
186
- "malformed-next",
187
- "incomplete",
188
- "payload-dropped"
189
- ]))
190
- });
191
- const PdfFieldActionsSchema = z.object({
192
- keystroke: PdfActionTreeSchema.optional(),
193
- format: PdfActionTreeSchema.optional(),
194
- validate: PdfActionTreeSchema.optional(),
195
- calculate: PdfActionTreeSchema.optional()
196
- });
197
- const PdfPageActionsSchema = z.object({
198
- open: PdfActionTreeSchema.optional(),
199
- close: PdfActionTreeSchema.optional()
200
- });
201
- const PdfAnnotationActionsSchema = z.object({
202
- activate: PdfActionTreeSchema.optional(),
203
- cursorEnter: PdfActionTreeSchema.optional(),
204
- cursorExit: PdfActionTreeSchema.optional(),
205
- mouseDown: PdfActionTreeSchema.optional(),
206
- mouseUp: PdfActionTreeSchema.optional(),
207
- focus: PdfActionTreeSchema.optional(),
208
- blur: PdfActionTreeSchema.optional(),
209
- pageOpen: PdfActionTreeSchema.optional(),
210
- pageClose: PdfActionTreeSchema.optional(),
211
- pageVisible: PdfActionTreeSchema.optional(),
212
- pageInvisible: PdfActionTreeSchema.optional()
213
- });
214
- const DocumentActionsSnapshotSchema = z.object({
215
- nameTreeScripts: z.array(z.object({
216
- name: z.string(),
217
- action: PdfActionTreeSchema
218
- })),
219
- openAction: PdfActionTreeSchema.nullable(),
220
- openDestination: PdfDestinationSchema.nullable().default(null),
221
- willClose: PdfActionTreeSchema.optional(),
222
- willSave: PdfActionTreeSchema.optional(),
223
- didSave: PdfActionTreeSchema.optional(),
224
- willPrint: PdfActionTreeSchema.optional(),
225
- didPrint: PdfActionTreeSchema.optional()
226
- }).superRefine((snapshot, context) => {
227
- if (snapshot.openAction !== null && (snapshot.openDestination ?? null) !== null) context.addIssue({
228
- code: z.ZodIssueCode.custom,
229
- message: "openAction and openDestination are mutually exclusive",
230
- path: ["openDestination"]
231
- });
232
- });
233
- /**
234
- * Stable public component names for generators that project the action wire
235
- * model into OpenAPI or another schema format. Keep reusable boundaries here;
236
- * individual action arms remain owned by `PdfActionNodeSchema`.
237
- */
238
- const PdfActionWireComponents = {
239
- PdfActionTargetRef: PdfActionTargetRefSchema,
240
- PdfDestination: PdfDestinationSchema,
241
- PdfActionNode: PdfActionNodeSchema,
242
- PdfActionTree: PdfActionTreeSchema,
243
- PdfFieldActions: PdfFieldActionsSchema,
244
- PdfPageActions: PdfPageActionsSchema,
245
- PdfAnnotationActions: PdfAnnotationActionsSchema,
246
- DocumentActionsSnapshot: DocumentActionsSnapshotSchema
247
- };
248
- //#endregion
249
- //#region src/annotation/base.schema.ts
250
- /** @deprecated Use `PdfPointSchema` from `../geometry/schemas`. */
251
- const PointSchema = PdfPointSchema;
252
- /** @deprecated Use `PdfRectSchema` from `../geometry/schemas`. */
253
- const RectSchema = PdfRectSchema;
254
- const ColorSchema = z.object({
255
- r: z.number().int().min(0).max(255),
256
- g: z.number().int().min(0).max(255),
257
- b: z.number().int().min(0).max(255)
258
- });
259
- const AnnotationBorderStyleSchema = z.enum([
260
- "solid",
261
- "dashed",
262
- "beveled",
263
- "inset"
264
- ]);
265
- const PdfRectDifferencesSchema = z.object({
266
- left: z.number().nonnegative(),
267
- top: z.number().nonnegative(),
268
- right: z.number().nonnegative(),
269
- bottom: z.number().nonnegative()
270
- });
271
- const LineEndingSchema = z.enum([
272
- "none",
273
- "square",
274
- "circle",
275
- "diamond",
276
- "open-arrow",
277
- "closed-arrow",
278
- "butt",
279
- "r-open-arrow",
280
- "r-closed-arrow",
281
- "slash"
282
- ]);
283
- const LineEndingsSchema = z.object({
284
- start: LineEndingSchema,
285
- end: LineEndingSchema
286
- });
287
- const StandardFontSchema = z.enum([
288
- "courier",
289
- "courier-bold",
290
- "courier-bold-oblique",
291
- "courier-oblique",
292
- "helvetica",
293
- "helvetica-bold",
294
- "helvetica-bold-oblique",
295
- "helvetica-oblique",
296
- "times-roman",
297
- "times-bold",
298
- "times-bold-italic",
299
- "times-italic",
300
- "symbol",
301
- "zapf-dingbats"
302
- ]);
303
- const TextAlignmentSchema = z.enum([
304
- "left",
305
- "center",
306
- "right"
307
- ]);
308
- const FreeTextIntentSchema = z.enum(["free-text", "free-text-callout"]);
309
- const CaretIntentSchema = z.literal("replace");
310
- const StrikeoutIntentSchema = z.literal("strikeout-text-edit");
311
- const InkIntentSchema = z.literal("ink-highlight");
312
- const BlendModeSchema = z.enum([
313
- "normal",
314
- "multiply",
315
- "screen",
316
- "overlay",
317
- "darken",
318
- "lighten",
319
- "color-dodge",
320
- "color-burn",
321
- "hard-light",
322
- "soft-light",
323
- "difference",
324
- "exclusion",
325
- "hue",
326
- "saturation",
327
- "color",
328
- "luminosity"
329
- ]);
330
- const AnnotationFlagsSchema = z.object({
331
- invisible: z.boolean(),
332
- hidden: z.boolean(),
333
- print: z.boolean(),
334
- noZoom: z.boolean(),
335
- noRotate: z.boolean(),
336
- noView: z.boolean(),
337
- readOnly: z.boolean(),
338
- locked: z.boolean(),
339
- toggleNoView: z.boolean(),
340
- lockedContents: z.boolean()
341
- });
342
- /**
343
- * Partial flag set authorable on a Draft or Patch — every key optional so
344
- * callers set only the bits they care about. The engine merges these onto
345
- * the annotation's current `/F` bitset.
346
- */
347
- const AnnotationFlagsPartialSchema = z.object({
348
- invisible: z.boolean(),
349
- hidden: z.boolean(),
350
- print: z.boolean(),
351
- noZoom: z.boolean(),
352
- noRotate: z.boolean(),
353
- noView: z.boolean(),
354
- readOnly: z.boolean(),
355
- locked: z.boolean(),
356
- toggleNoView: z.boolean(),
357
- lockedContents: z.boolean()
358
- }).partial();
359
- const AnnotationStableIdSchema = z.discriminatedUnion("kind", [z.object({
360
- kind: z.literal("objectNumber"),
361
- value: z.number().int().nonnegative()
362
- }), z.object({
363
- kind: z.literal("nm"),
364
- value: z.string()
365
- })]);
366
- const RevisionTokenSchema = z.object({
367
- docSessionId: z.string(),
368
- pageObjectNumber: z.number().int().positive(),
369
- generation: z.number().int().nonnegative()
370
- });
371
- const AnnotationRefSchema = z.discriminatedUnion("kind", [
372
- z.object({
373
- kind: z.literal("objectNumber"),
374
- pageObjectNumber: z.number().int().positive(),
375
- annotObjectNumber: z.number().int().positive()
376
- }),
377
- z.object({
378
- kind: z.literal("nm"),
379
- pageObjectNumber: z.number().int().positive(),
380
- nm: z.string()
381
- }),
382
- z.object({
383
- kind: z.literal("index"),
384
- pageObjectNumber: z.number().int().positive(),
385
- index: z.number().int().nonnegative(),
386
- revision: RevisionTokenSchema
387
- })
388
- ]);
389
- /**
390
- * Shared object literal for every per-subtype DTO schema. Each kind's
391
- * `dto.schema.ts` extends this with its own `subtype` literal and
392
- * subtype-specific fields. Note that we do NOT include `subtype` here —
393
- * each kind sets its own literal so `z.discriminatedUnion('subtype', ...)`
394
- * works at the catalog level.
395
- */
396
- const AnnotationBaseShape = {
397
- ref: AnnotationRefSchema,
398
- pageObjectNumber: z.number().int().positive(),
399
- index: z.number().int().nonnegative(),
400
- identityQuality: z.enum(["durable", "weak"]),
401
- nm: z.string().nullable(),
402
- flags: AnnotationFlagsSchema,
403
- rect: PdfRectSchema,
404
- contents: z.string().nullable(),
405
- subject: z.string().nullable(),
406
- author: z.string().nullable(),
407
- created: z.string().datetime().nullable(),
408
- modified: z.string().datetime().nullable(),
409
- blendMode: BlendModeSchema,
410
- inReplyTo: AnnotationRefSchema.nullable(),
411
- replyType: z.enum(["reply", "group"]).nullable(),
412
- userId: z.string().optional(),
413
- groupId: z.string().optional(),
414
- createdBy: z.string().optional(),
415
- updatedBy: z.string().optional(),
416
- actions: PdfAnnotationActionsSchema.optional()
417
- };
418
- /**
419
- * Annotation-wide fields shared by every Draft. Per-kind draft schemas
420
- * spread this alongside their family-specific shape.
421
- *
422
- * Authorial identity (/T, /EMBD_Metadata UserID/GroupID) is set by the
423
- * server from the caller's JWT identity — see the AnnotationDraftBase
424
- * docstring.
425
- */
426
- const AnnotationDraftBaseShape = {
427
- contents: z.string().nullable().optional(),
428
- subject: z.string().nullable().optional(),
429
- blendMode: BlendModeSchema.optional(),
430
- nm: z.string().optional(),
431
- flags: AnnotationFlagsPartialSchema.optional(),
432
- inReplyTo: AnnotationRefSchema.optional(),
433
- replyType: z.enum(["reply", "group"]).optional()
434
- };
435
- /**
436
- * Annotation-wide fields shared by every Patch. `nm` is monotonic per
437
- * annotation; clients target an existing annotation via AnnotationRef
438
- * instead of renaming.
439
- *
440
- * `groupId` is the only identity-shaped field on a patch — it
441
- * represents organizational ownership, and reassignment runs through
442
- * `checkSetGroup`. See AnnotationPatchBase for the full immutability
443
- * rules.
444
- */
445
- const AnnotationPatchBaseShape = {
446
- contents: z.string().nullable().optional(),
447
- subject: z.string().nullable().optional(),
448
- blendMode: BlendModeSchema.optional(),
449
- groupId: z.string().min(1).optional(),
450
- flags: AnnotationFlagsPartialSchema.optional(),
451
- inReplyTo: AnnotationRefSchema.nullable().optional(),
452
- replyType: z.enum(["reply", "group"]).optional()
453
- };
454
- //#endregion
455
- //#region src/annotation/kinds/style.shared.ts
456
- const ColorStyleDTOShape = {
457
- color: ColorSchema,
458
- opacity: z.number().min(0).max(1)
459
- };
460
- const ColorStyleDraftShape = {
461
- color: ColorSchema.optional(),
462
- opacity: z.number().min(0).max(1).optional()
463
- };
464
- const ColorStylePatchShape = ColorStyleDraftShape;
465
- const GeometryStyleDTOShape = {
466
- ...ColorStyleDTOShape,
467
- strokeWidth: z.number().nonnegative(),
468
- borderStyle: AnnotationBorderStyleSchema,
469
- dashArray: z.array(z.number().nonnegative()).optional()
470
- };
471
- const GeometryStyleDraftShape = {
472
- ...ColorStyleDraftShape,
473
- strokeWidth: z.number().nonnegative().optional(),
474
- borderStyle: AnnotationBorderStyleSchema.optional(),
475
- dashArray: z.array(z.number().nonnegative()).optional()
476
- };
477
- const GeometryStylePatchShape = GeometryStyleDraftShape;
478
- const FilledStyleDTOShape = {
479
- ...GeometryStyleDTOShape,
480
- interiorColor: ColorSchema.nullable()
481
- };
482
- const FilledStyleDraftShape = {
483
- ...GeometryStyleDraftShape,
484
- interiorColor: ColorSchema.nullable().optional()
485
- };
486
- const FilledStylePatchShape = FilledStyleDraftShape;
487
- //#endregion
488
- //#region src/annotation/kinds/caret/schema.ts
489
- const CaretDTOSchema = z.object({
490
- ...AnnotationBaseShape,
491
- ...ColorStyleDTOShape,
492
- intent: CaretIntentSchema.nullable(),
493
- rectDifferences: PdfRectDifferencesSchema.nullable(),
494
- rotation: z.number().optional(),
495
- unrotatedRect: PdfRectSchema.optional(),
496
- subtype: z.literal("caret")
497
- });
498
- const CaretDraftSchema = z.object({
499
- ...ColorStyleDraftShape,
500
- ...AnnotationDraftBaseShape,
501
- intent: CaretIntentSchema.optional(),
502
- rect: PdfRectSchema,
503
- rectDifferences: PdfRectDifferencesSchema.nullable().optional(),
504
- rotation: z.number().nullable().optional(),
505
- unrotatedRect: PdfRectSchema.nullable().optional(),
506
- subtype: z.literal("caret")
507
- });
508
- const CaretPatchSchema = z.object({
509
- ...ColorStylePatchShape,
510
- ...AnnotationPatchBaseShape,
511
- intent: CaretIntentSchema.optional(),
512
- rect: PdfRectSchema.optional(),
513
- rectDifferences: PdfRectDifferencesSchema.nullable().optional(),
514
- rotation: z.number().nullable().optional(),
515
- unrotatedRect: PdfRectSchema.nullable().optional(),
516
- subtype: z.literal("caret")
517
- });
518
- //#endregion
519
- //#region src/annotation/kinds/caret/index.ts
520
- const CaretKind = {
521
- subtype: "caret",
522
- pdfSubtypeCode: PdfAnnotationSubtypeCode.CARET,
523
- dtoSchema: CaretDTOSchema,
524
- draftSchema: CaretDraftSchema,
525
- patchSchema: CaretPatchSchema
526
- };
527
- //#endregion
528
- //#region src/annotation/kinds/shape.shared.ts
529
- const ShapeDTOShape = {
530
- ...AnnotationBaseShape,
531
- ...FilledStyleDTOShape,
532
- cloudyIntensity: z.number().positive().nullable(),
533
- rectDifferences: PdfRectDifferencesSchema.nullable(),
534
- rotation: z.number().optional(),
535
- unrotatedRect: PdfRectSchema.optional()
536
- };
537
- const ShapeDraftShape = {
538
- ...FilledStyleDraftShape,
539
- rect: PdfRectSchema,
540
- cloudyIntensity: z.number().positive().nullable().optional(),
541
- rectDifferences: PdfRectDifferencesSchema.nullable().optional(),
542
- rotation: z.number().nullable().optional(),
543
- unrotatedRect: PdfRectSchema.nullable().optional()
544
- };
545
- const ShapePatchShape = {
546
- ...FilledStylePatchShape,
547
- rect: PdfRectSchema.optional(),
548
- cloudyIntensity: z.number().positive().nullable().optional(),
549
- rectDifferences: PdfRectDifferencesSchema.nullable().optional(),
550
- rotation: z.number().nullable().optional(),
551
- unrotatedRect: PdfRectSchema.nullable().optional()
552
- };
553
- //#endregion
554
- //#region src/annotation/kinds/circle/schema.ts
555
- const CircleDTOSchema = z.object({
556
- ...ShapeDTOShape,
557
- subtype: z.literal("circle")
558
- });
559
- const CircleDraftSchema = z.object({
560
- ...ShapeDraftShape,
561
- ...AnnotationDraftBaseShape,
562
- subtype: z.literal("circle")
563
- });
564
- const CirclePatchSchema = z.object({
565
- ...ShapePatchShape,
566
- ...AnnotationPatchBaseShape,
567
- subtype: z.literal("circle")
568
- });
569
- //#endregion
570
- //#region src/annotation/kinds/circle/index.ts
571
- const CircleKind = {
572
- subtype: "circle",
573
- pdfSubtypeCode: PdfAnnotationSubtypeCode.CIRCLE,
574
- dtoSchema: CircleDTOSchema,
575
- draftSchema: CircleDraftSchema,
576
- patchSchema: CirclePatchSchema
577
- };
578
- //#endregion
579
- //#region src/dto/Attachment.schema.ts
580
- /**
581
- * Wire schemas for the attachment read vocabulary (see `Attachment.ts`).
582
- * The write-side `AttachmentFileSource` carries inline bytes and never
583
- * appears on the wire — its post-normalization form is the kind-owned
584
- * `WireAttachmentFile` (see `annotation/kinds/file-attachment/schema.ts`).
585
- */
586
- const AttachmentFileInfoSchema = z.object({
587
- name: z.string(),
588
- mimeType: z.string().optional(),
589
- description: z.string().optional(),
590
- size: z.number().int().nonnegative().optional(),
591
- checksum: z.string().optional(),
592
- creationDate: z.string().optional()
593
- });
594
- const EmbeddedFileRefSchema = z.object({
595
- kind: z.literal("key"),
596
- key: z.string().min(1)
597
- });
598
- const EmbeddedFileItemSchema = z.object({
599
- key: z.string(),
600
- name: z.string(),
601
- mimeType: z.string().optional(),
602
- description: z.string().optional(),
603
- size: z.number().int().nonnegative().optional(),
604
- checksum: z.string().optional(),
605
- creationDate: z.string().optional(),
606
- index: z.number().int().nonnegative()
607
- });
608
- //#endregion
609
- //#region src/annotation/kinds/file-attachment/schema.ts
610
- const FileAttachmentIconSchema = z.enum([
611
- "push-pin",
612
- "paperclip",
613
- "graph",
614
- "tag"
615
- ]);
616
- /** Post-normalization form of the attached file: metadata + resource ref. */
617
- const WireAttachmentFileSchema = z.object({
618
- resource: z.string().min(1),
619
- name: z.string().min(1),
620
- mimeType: z.string().optional(),
621
- description: z.string().optional()
622
- });
623
- const FileAttachmentDTOSchema = z.object({
624
- ...AnnotationBaseShape,
625
- ...ColorStyleDTOShape,
626
- icon: FileAttachmentIconSchema,
627
- file: AttachmentFileInfoSchema,
628
- subtype: z.literal("file-attachment")
629
- });
630
- const FileAttachmentWireDraftSchema = z.object({
631
- ...ColorStyleDraftShape,
632
- ...AnnotationDraftBaseShape,
633
- rect: PdfRectSchema,
634
- file: WireAttachmentFileSchema,
635
- icon: FileAttachmentIconSchema.optional(),
636
- subtype: z.literal("file-attachment")
637
- });
638
- const FileAttachmentPatchSchema = z.object({
639
- ...ColorStylePatchShape,
640
- ...AnnotationPatchBaseShape,
641
- rect: PdfRectSchema.optional(),
642
- icon: FileAttachmentIconSchema.optional(),
643
- subtype: z.literal("file-attachment")
644
- });
645
- //#endregion
646
- //#region src/annotation/kinds/file-attachment/index.ts
647
- /**
648
- * WIRE-typed like `StampKind`: the draft schema validates the
649
- * post-normalization form (`file` as metadata + resource ref). The
650
- * authoring `FileAttachmentDraft` (inline bytes) is swapped into the
651
- * public `AnnotationDraft` union in `kinds/index.ts`. The patch carries
652
- * no binary (`file` is create-only), so its authoring and wire forms are
653
- * the same type.
654
- */
655
- const FileAttachmentKind = {
656
- subtype: "file-attachment",
657
- pdfSubtypeCode: PdfAnnotationSubtypeCode.FILEATTACHMENT,
658
- dtoSchema: FileAttachmentDTOSchema,
659
- draftSchema: FileAttachmentWireDraftSchema,
660
- patchSchema: FileAttachmentPatchSchema
661
- };
662
- //#endregion
663
- //#region src/annotation/kinds/free-text/schema.ts
664
- /** Authoring `fontFamily`: a standard font name OR a registered font `key`.
665
- * Any non-empty string is accepted; the writer resolves which it is (and a
666
- * key that was never registered fails loud there). The read-back DTO keeps the
667
- * narrower {@link StandardFontSchema}. */
668
- const FreeTextFontSchema = z.string().min(1);
669
- const HexColorSchema = z.string().regex(/^#[0-9a-fA-F]{6}$/);
670
- const RichTextRunStyleShape = {
671
- family: z.string().min(1),
672
- weight: z.number().int().min(100).max(900),
673
- italic: z.boolean(),
674
- size: z.number().nonnegative(),
675
- color: HexColorSchema,
676
- decoration: z.array(z.enum([
677
- "underline",
678
- "line-through",
679
- "word"
680
- ])),
681
- script: z.enum([
682
- "normal",
683
- "sub",
684
- "super"
685
- ]),
686
- letterSpacing: z.number(),
687
- horizontalScale: z.number().positive(),
688
- unknown: z.string().optional()
689
- };
690
- const RichTextParagraphPropsShape = {
691
- align: z.enum([
692
- "left",
693
- "center",
694
- "right",
695
- "justify"
696
- ]),
697
- dir: z.enum(["ltr", "rtl"]),
698
- lineHeight: z.number().positive().optional(),
699
- margins: z.object({
700
- top: z.number(),
701
- bottom: z.number(),
702
- left: z.number(),
703
- right: z.number()
704
- }).optional(),
705
- textIndent: z.number().optional(),
706
- unknown: z.string().optional()
707
- };
708
- const RichTextRunStyleDeltaSchema = z.object(RichTextRunStyleShape).partial();
709
- const RichTextParagraphSchema = z.object({
710
- ...RichTextParagraphPropsShape,
711
- runs: z.array(z.object({
712
- text: z.string(),
713
- style: RichTextRunStyleDeltaSchema.optional()
714
- }))
715
- }).partial({
716
- align: true,
717
- dir: true
718
- });
719
- const RichTextDocumentSchema = z.object({
720
- body: z.object({
721
- ...RichTextRunStyleShape,
722
- ...RichTextParagraphPropsShape
723
- }),
724
- paragraphs: z.array(RichTextParagraphSchema)
725
- });
726
- const RichTextDocumentInputSchema = z.object({
727
- body: z.object({
728
- ...RichTextRunStyleShape,
729
- ...RichTextParagraphPropsShape
730
- }).partial().optional(),
731
- paragraphs: z.array(RichTextParagraphSchema)
732
- });
733
- const FreeTextDTOSchema = z.object({
734
- ...AnnotationBaseShape,
735
- intent: FreeTextIntentSchema,
736
- fontFamily: FreeTextFontSchema,
737
- fontSize: z.number().positive(),
738
- textAlign: TextAlignmentSchema,
739
- richText: RichTextDocumentSchema,
740
- color: ColorSchema,
741
- fontColor: ColorSchema.optional(),
742
- interiorColor: ColorSchema.nullable(),
743
- opacity: z.number().min(0).max(1),
744
- strokeWidth: z.number().nonnegative(),
745
- borderStyle: AnnotationBorderStyleSchema,
746
- dashArray: z.array(z.number().nonnegative()).optional(),
747
- rectDifferences: PdfRectDifferencesSchema.nullable(),
748
- calloutLine: CalloutLineSchema.optional(),
749
- lineEnding: LineEndingSchema.optional(),
750
- rotation: z.number().optional(),
751
- unrotatedRect: PdfRectSchema.optional(),
752
- subtype: z.literal("free-text")
753
- });
754
- const FreeTextDraftSchema = z.object({
755
- ...AnnotationDraftBaseShape,
756
- intent: FreeTextIntentSchema,
757
- fontFamily: FreeTextFontSchema,
758
- fontSize: z.number().positive(),
759
- textAlign: TextAlignmentSchema,
760
- richText: RichTextDocumentInputSchema.optional(),
761
- rect: PdfRectSchema,
762
- color: ColorSchema.optional(),
763
- fontColor: ColorSchema.optional(),
764
- interiorColor: ColorSchema.nullable().optional(),
765
- opacity: z.number().min(0).max(1).optional(),
766
- strokeWidth: z.number().nonnegative().optional(),
767
- borderStyle: AnnotationBorderStyleSchema.optional(),
768
- dashArray: z.array(z.number().nonnegative()).optional(),
769
- rectDifferences: PdfRectDifferencesSchema.nullable().optional(),
770
- calloutLine: CalloutLineSchema.optional(),
771
- lineEnding: LineEndingSchema.optional(),
772
- rotation: z.number().nullable().optional(),
773
- unrotatedRect: PdfRectSchema.nullable().optional(),
774
- subtype: z.literal("free-text")
775
- });
776
- const FreeTextPatchSchema = z.object({
777
- ...AnnotationPatchBaseShape,
778
- intent: FreeTextIntentSchema.optional(),
779
- fontFamily: FreeTextFontSchema.optional(),
780
- fontSize: z.number().positive().optional(),
781
- textAlign: TextAlignmentSchema.optional(),
782
- richText: RichTextDocumentInputSchema.optional(),
783
- rect: PdfRectSchema.optional(),
784
- color: ColorSchema.optional(),
785
- fontColor: ColorSchema.optional(),
786
- interiorColor: ColorSchema.nullable().optional(),
787
- opacity: z.number().min(0).max(1).optional(),
788
- strokeWidth: z.number().nonnegative().optional(),
789
- borderStyle: AnnotationBorderStyleSchema.optional(),
790
- dashArray: z.array(z.number().nonnegative()).optional(),
791
- rectDifferences: PdfRectDifferencesSchema.nullable().optional(),
792
- calloutLine: CalloutLineSchema.optional(),
793
- lineEnding: LineEndingSchema.optional(),
794
- rotation: z.number().nullable().optional(),
795
- unrotatedRect: PdfRectSchema.nullable().optional(),
796
- subtype: z.literal("free-text")
797
- });
798
- //#endregion
799
- //#region src/annotation/kinds/free-text/index.ts
800
- const FreeTextKind = {
801
- subtype: "free-text",
802
- pdfSubtypeCode: PdfAnnotationSubtypeCode.FREETEXT,
803
- dtoSchema: FreeTextDTOSchema,
804
- draftSchema: FreeTextDraftSchema,
805
- patchSchema: FreeTextPatchSchema
806
- };
807
- //#endregion
808
- //#region src/annotation/kinds/text-markup.shared.ts
809
- const TextMarkupDTOShape = {
810
- ...AnnotationBaseShape,
811
- ...ColorStyleDTOShape,
812
- quadPoints: z.array(PdfQuadSchema)
813
- };
814
- const TextMarkupDraftShape = {
815
- ...ColorStyleDraftShape,
816
- quadPoints: z.array(PdfQuadSchema)
817
- };
818
- const TextMarkupPatchShape = {
819
- ...ColorStylePatchShape,
820
- quadPoints: z.array(PdfQuadSchema).optional()
821
- };
822
- //#endregion
823
- //#region src/annotation/kinds/highlight/schema.ts
824
- const HighlightDTOSchema = z.object({
825
- ...TextMarkupDTOShape,
826
- subtype: z.literal("highlight")
827
- });
828
- const HighlightDraftSchema = z.object({
829
- ...TextMarkupDraftShape,
830
- ...AnnotationDraftBaseShape,
831
- subtype: z.literal("highlight")
832
- });
833
- const HighlightPatchSchema = z.object({
834
- ...TextMarkupPatchShape,
835
- ...AnnotationPatchBaseShape,
836
- subtype: z.literal("highlight")
837
- });
838
- //#endregion
839
- //#region src/annotation/kinds/highlight/index.ts
840
- const HighlightKind = {
841
- subtype: "highlight",
842
- pdfSubtypeCode: PdfAnnotationSubtypeCode.HIGHLIGHT,
843
- dtoSchema: HighlightDTOSchema,
844
- draftSchema: HighlightDraftSchema,
845
- patchSchema: HighlightPatchSchema
846
- };
847
- //#endregion
848
- //#region src/annotation/kinds/ink/schema.ts
849
- const InkDTOSchema = z.object({
850
- ...AnnotationBaseShape,
851
- ...GeometryStyleDTOShape,
852
- intent: InkIntentSchema.nullable(),
853
- inkList: InkListSchema,
854
- rotation: z.number().optional(),
855
- subtype: z.literal("ink")
856
- });
857
- const InkDraftSchema = z.object({
858
- ...GeometryStyleDraftShape,
859
- ...AnnotationDraftBaseShape,
860
- intent: InkIntentSchema.optional(),
861
- inkList: InkListSchema,
862
- rect: PdfRectSchema,
863
- rotation: z.number().nullable().optional(),
864
- subtype: z.literal("ink")
865
- });
866
- const InkPatchSchema = z.object({
867
- ...GeometryStylePatchShape,
868
- ...AnnotationPatchBaseShape,
869
- intent: InkIntentSchema.optional(),
870
- inkList: InkListSchema.optional(),
871
- rect: PdfRectSchema.optional(),
872
- rotation: z.number().nullable().optional(),
873
- subtype: z.literal("ink")
874
- });
875
- //#endregion
876
- //#region src/annotation/kinds/ink/index.ts
877
- const InkKind = {
878
- subtype: "ink",
879
- pdfSubtypeCode: PdfAnnotationSubtypeCode.INK,
880
- dtoSchema: InkDTOSchema,
881
- draftSchema: InkDraftSchema,
882
- patchSchema: InkPatchSchema
883
- };
884
- //#endregion
885
- //#region src/annotation/kinds/line/schema.ts
886
- const LineDTOSchema = z.object({
887
- ...AnnotationBaseShape,
888
- ...FilledStyleDTOShape,
889
- linePoints: LinePointsSchema,
890
- lineEndings: LineEndingsSchema,
891
- rotation: z.number().optional(),
892
- subtype: z.literal("line")
893
- });
894
- const LineDraftSchema = z.object({
895
- ...FilledStyleDraftShape,
896
- ...AnnotationDraftBaseShape,
897
- linePoints: LinePointsSchema,
898
- rect: PdfRectSchema,
899
- lineEndings: LineEndingsSchema.optional(),
900
- rotation: z.number().nullable().optional(),
901
- subtype: z.literal("line")
902
- });
903
- const LinePatchSchema = z.object({
904
- ...FilledStylePatchShape,
905
- ...AnnotationPatchBaseShape,
906
- linePoints: LinePointsSchema.optional(),
907
- rect: PdfRectSchema.optional(),
908
- lineEndings: LineEndingsSchema.optional(),
909
- rotation: z.number().nullable().optional(),
910
- subtype: z.literal("line")
911
- });
912
- //#endregion
913
- //#region src/annotation/kinds/line/index.ts
914
- const LineKind = {
915
- subtype: "line",
916
- pdfSubtypeCode: PdfAnnotationSubtypeCode.LINE,
917
- dtoSchema: LineDTOSchema,
918
- draftSchema: LineDraftSchema,
919
- patchSchema: LinePatchSchema
920
- };
921
- //#endregion
922
- //#region src/annotation/kinds/link/schema.ts
923
- const GotoTargetSchema = z.object({
924
- kind: z.literal("goto"),
925
- destination: PdfDestinationSchema
926
- });
927
- const UriTargetSchema = z.object({
928
- kind: z.literal("uri"),
929
- uri: z.string()
930
- });
931
- const PdfLinkTargetSchema = z.discriminatedUnion("kind", [
932
- GotoTargetSchema,
933
- UriTargetSchema,
934
- z.object({
935
- kind: z.literal("goto-remote"),
936
- file: z.string()
937
- }),
938
- z.object({
939
- kind: z.literal("launch"),
940
- path: z.string()
941
- }),
942
- z.object({ kind: z.literal("javascript") }),
943
- z.object({
944
- kind: z.literal("named"),
945
- name: z.string()
946
- }),
947
- z.object({ kind: z.literal("unsupported") })
948
- ]);
949
- /** Drafts/patches only author `goto`/`uri` — see {@link PdfLinkTargetWritable}. */
950
- const PdfLinkTargetWritableSchema = z.discriminatedUnion("kind", [GotoTargetSchema, UriTargetSchema]);
951
- const LinkDTOSchema = z.object({
952
- ...AnnotationBaseShape,
953
- subtype: z.literal("link"),
954
- target: PdfLinkTargetSchema.nullable()
955
- });
956
- const LinkDraftSchema = z.object({
957
- ...AnnotationDraftBaseShape,
958
- subtype: z.literal("link"),
959
- rect: PdfRectSchema,
960
- target: PdfLinkTargetWritableSchema.nullable()
961
- });
962
- const LinkPatchSchema = z.object({
963
- ...AnnotationPatchBaseShape,
964
- subtype: z.literal("link"),
965
- rect: PdfRectSchema.optional(),
966
- target: PdfLinkTargetWritableSchema.nullable().optional()
967
- });
968
- //#endregion
969
- //#region src/annotation/kinds/link/index.ts
970
- const LinkKind = {
971
- subtype: "link",
972
- pdfSubtypeCode: PdfAnnotationSubtypeCode.LINK,
973
- dtoSchema: LinkDTOSchema,
974
- draftSchema: LinkDraftSchema,
975
- patchSchema: LinkPatchSchema
976
- };
977
- //#endregion
978
- //#region src/annotation/kinds/vertex.shared.ts
979
- const VertexDTOShape = {
980
- ...AnnotationBaseShape,
981
- ...FilledStyleDTOShape,
982
- vertices: z.array(PdfPointSchema),
983
- rotation: z.number().optional()
984
- };
985
- const VertexDraftShape = {
986
- ...FilledStyleDraftShape,
987
- vertices: z.array(PdfPointSchema),
988
- rect: PdfRectSchema,
989
- rotation: z.number().nullable().optional()
990
- };
991
- const VertexPatchShape = {
992
- ...FilledStylePatchShape,
993
- vertices: z.array(PdfPointSchema).optional(),
994
- rect: PdfRectSchema.optional(),
995
- rotation: z.number().nullable().optional()
996
- };
997
- //#endregion
998
- //#region src/annotation/kinds/polygon/schema.ts
999
- const PolygonDTOSchema = z.object({
1000
- ...VertexDTOShape,
1001
- vertices: z.array(PdfPointSchema).min(3),
1002
- cloudyIntensity: z.number().positive().nullable(),
1003
- subtype: z.literal("polygon")
1004
- });
1005
- const PolygonDraftSchema = z.object({
1006
- ...VertexDraftShape,
1007
- ...AnnotationDraftBaseShape,
1008
- vertices: z.array(PdfPointSchema).min(3),
1009
- cloudyIntensity: z.number().positive().nullable().optional(),
1010
- subtype: z.literal("polygon")
1011
- });
1012
- const PolygonPatchSchema = z.object({
1013
- ...VertexPatchShape,
1014
- ...AnnotationPatchBaseShape,
1015
- vertices: z.array(PdfPointSchema).min(3).optional(),
1016
- cloudyIntensity: z.number().positive().nullable().optional(),
1017
- subtype: z.literal("polygon")
1018
- });
1019
- //#endregion
1020
- //#region src/annotation/kinds/polygon/index.ts
1021
- const PolygonKind = {
1022
- subtype: "polygon",
1023
- pdfSubtypeCode: PdfAnnotationSubtypeCode.POLYGON,
1024
- dtoSchema: PolygonDTOSchema,
1025
- draftSchema: PolygonDraftSchema,
1026
- patchSchema: PolygonPatchSchema
1027
- };
1028
- //#endregion
1029
- //#region src/annotation/kinds/polyline/schema.ts
1030
- const PolylineDTOSchema = z.object({
1031
- ...VertexDTOShape,
1032
- vertices: z.array(PdfPointSchema).min(2),
1033
- lineEndings: LineEndingsSchema,
1034
- subtype: z.literal("polyline")
1035
- });
1036
- const PolylineDraftSchema = z.object({
1037
- ...VertexDraftShape,
1038
- ...AnnotationDraftBaseShape,
1039
- vertices: z.array(PdfPointSchema).min(2),
1040
- lineEndings: LineEndingsSchema.optional(),
1041
- subtype: z.literal("polyline")
1042
- });
1043
- const PolylinePatchSchema = z.object({
1044
- ...VertexPatchShape,
1045
- ...AnnotationPatchBaseShape,
1046
- vertices: z.array(PdfPointSchema).min(2).optional(),
1047
- lineEndings: LineEndingsSchema.optional(),
1048
- subtype: z.literal("polyline")
1049
- });
1050
- //#endregion
1051
- //#region src/annotation/kinds/polyline/index.ts
1052
- const PolylineKind = {
1053
- subtype: "polyline",
1054
- pdfSubtypeCode: PdfAnnotationSubtypeCode.POLYLINE,
1055
- dtoSchema: PolylineDTOSchema,
1056
- draftSchema: PolylineDraftSchema,
1057
- patchSchema: PolylinePatchSchema
1058
- };
1059
- //#endregion
1060
- //#region src/annotation/kinds/redact/schema.ts
1061
- /** Authoring `fontFamily`: a standard font name OR a registered font `key`.
1062
- * Any non-empty string is accepted; the writer resolves which it is (and a
1063
- * key that was never registered fails loud there). The read-back DTO keeps
1064
- * the narrower {@link StandardFontSchema}. */
1065
- const RedactFontSchema = z.string().min(1);
1066
- /** `/DA` size — unlike free text, `0` is meaningful for a redaction label:
1067
- * auto-fit to the region. */
1068
- const RedactFontSizeSchema = z.number().nonnegative();
1069
- const RedactDTOSchema = z.object({
1070
- ...AnnotationBaseShape,
1071
- quadPoints: z.array(PdfQuadSchema),
1072
- color: ColorSchema,
1073
- opacity: z.number().min(0).max(1),
1074
- interiorColor: ColorSchema.nullable(),
1075
- overlayText: z.string().nullable(),
1076
- repeat: z.boolean(),
1077
- fontFamily: StandardFontSchema,
1078
- fontSize: RedactFontSizeSchema,
1079
- fontColor: ColorSchema,
1080
- textAlign: TextAlignmentSchema,
1081
- subtype: z.literal("redact")
1082
- });
1083
- const RedactDraftSchema = z.object({
1084
- ...AnnotationDraftBaseShape,
1085
- rect: PdfRectSchema,
1086
- quadPoints: z.array(PdfQuadSchema).optional(),
1087
- color: ColorSchema.optional(),
1088
- opacity: z.number().min(0).max(1).optional(),
1089
- interiorColor: ColorSchema.nullable().optional(),
1090
- overlayText: z.string().optional(),
1091
- repeat: z.boolean().optional(),
1092
- fontFamily: RedactFontSchema.optional(),
1093
- fontSize: RedactFontSizeSchema.optional(),
1094
- fontColor: ColorSchema.optional(),
1095
- textAlign: TextAlignmentSchema.optional(),
1096
- subtype: z.literal("redact")
1097
- });
1098
- const RedactPatchSchema = z.object({
1099
- ...AnnotationPatchBaseShape,
1100
- rect: PdfRectSchema.optional(),
1101
- quadPoints: z.array(PdfQuadSchema).optional(),
1102
- color: ColorSchema.optional(),
1103
- opacity: z.number().min(0).max(1).optional(),
1104
- interiorColor: ColorSchema.nullable().optional(),
1105
- overlayText: z.string().nullable().optional(),
1106
- repeat: z.boolean().optional(),
1107
- fontFamily: RedactFontSchema.optional(),
1108
- fontSize: RedactFontSizeSchema.optional(),
1109
- fontColor: ColorSchema.optional(),
1110
- textAlign: TextAlignmentSchema.optional(),
1111
- subtype: z.literal("redact")
1112
- });
1113
- //#endregion
1114
- //#region src/annotation/kinds/redact/index.ts
1115
- const RedactKind = {
1116
- subtype: "redact",
1117
- pdfSubtypeCode: PdfAnnotationSubtypeCode.REDACT,
1118
- dtoSchema: RedactDTOSchema,
1119
- draftSchema: RedactDraftSchema,
1120
- patchSchema: RedactPatchSchema
1121
- };
1122
- //#endregion
1123
- //#region src/annotation/kinds/square/schema.ts
1124
- const SquareDTOSchema = z.object({
1125
- ...ShapeDTOShape,
1126
- subtype: z.literal("square")
1127
- });
1128
- const SquareDraftSchema = z.object({
1129
- ...ShapeDraftShape,
1130
- ...AnnotationDraftBaseShape,
1131
- subtype: z.literal("square")
1132
- });
1133
- const SquarePatchSchema = z.object({
1134
- ...ShapePatchShape,
1135
- ...AnnotationPatchBaseShape,
1136
- subtype: z.literal("square")
1137
- });
1138
- //#endregion
1139
- //#region src/annotation/kinds/square/index.ts
1140
- const SquareKind = {
1141
- subtype: "square",
1142
- pdfSubtypeCode: PdfAnnotationSubtypeCode.SQUARE,
1143
- dtoSchema: SquareDTOSchema,
1144
- draftSchema: SquareDraftSchema,
1145
- patchSchema: SquarePatchSchema
1146
- };
1147
- //#endregion
1148
- //#region src/annotation/kinds/squiggly/schema.ts
1149
- const SquigglyDTOSchema = z.object({
1150
- ...TextMarkupDTOShape,
1151
- subtype: z.literal("squiggly")
1152
- });
1153
- const SquigglyDraftSchema = z.object({
1154
- ...TextMarkupDraftShape,
1155
- ...AnnotationDraftBaseShape,
1156
- subtype: z.literal("squiggly")
1157
- });
1158
- const SquigglyPatchSchema = z.object({
1159
- ...TextMarkupPatchShape,
1160
- ...AnnotationPatchBaseShape,
1161
- subtype: z.literal("squiggly")
1162
- });
1163
- //#endregion
1164
- //#region src/annotation/kinds/squiggly/index.ts
1165
- const SquigglyKind = {
1166
- subtype: "squiggly",
1167
- pdfSubtypeCode: PdfAnnotationSubtypeCode.SQUIGGLY,
1168
- dtoSchema: SquigglyDTOSchema,
1169
- draftSchema: SquigglyDraftSchema,
1170
- patchSchema: SquigglyPatchSchema
1171
- };
1172
- //#endregion
1173
- //#region src/annotation/kinds/stamp/schema.ts
1174
- /**
1175
- * Schemas validate the WIRE forms. The authoring types (`StampDraft`,
1176
- * `StampPatch`) carry inline `BinarySource` bytes and are normalized to
1177
- * these shapes before validation — see `annotation/normalize.ts`.
1178
- */
1179
- const ResourceRefSchema = z.object({ resource: z.string().min(1) });
1180
- const StampFitSchema = z.enum([
1181
- "contain",
1182
- "cover",
1183
- "fill"
1184
- ]);
1185
- const StampDTOSchema = z.object({
1186
- ...AnnotationBaseShape,
1187
- name: z.string().nullable(),
1188
- rotation: z.number().optional(),
1189
- unrotatedRect: PdfRectSchema.optional(),
1190
- subtype: z.literal("stamp")
1191
- });
1192
- const StampWireDraftSchema = z.object({
1193
- ...AnnotationDraftBaseShape,
1194
- rect: PdfRectSchema,
1195
- source: ResourceRefSchema,
1196
- name: z.string().min(1).optional(),
1197
- fit: StampFitSchema.optional(),
1198
- rotation: z.number().nullable().optional(),
1199
- unrotatedRect: PdfRectSchema.nullable().optional(),
1200
- subtype: z.literal("stamp")
1201
- });
1202
- const StampWirePatchSchema = z.object({
1203
- ...AnnotationPatchBaseShape,
1204
- rect: PdfRectSchema.optional(),
1205
- source: ResourceRefSchema.optional(),
1206
- name: z.string().min(1).nullable().optional(),
1207
- fit: StampFitSchema.optional(),
1208
- rotation: z.number().nullable().optional(),
1209
- unrotatedRect: PdfRectSchema.nullable().optional(),
1210
- subtype: z.literal("stamp")
1211
- });
1212
- //#endregion
1213
- //#region src/annotation/kinds/stamp/index.ts
1214
- /**
1215
- * The kind module is WIRE-typed (schemas validate the post-normalization
1216
- * form). The authoring types with inline bytes (`StampDraft`, `StampPatch`)
1217
- * are swapped into the public `AnnotationDraft`/`AnnotationPatch` unions in
1218
- * `kinds/index.ts`; `annotation/normalize.ts` bridges the two.
1219
- */
1220
- const StampKind = {
1221
- subtype: "stamp",
1222
- pdfSubtypeCode: PdfAnnotationSubtypeCode.STAMP,
1223
- dtoSchema: StampDTOSchema,
1224
- draftSchema: StampWireDraftSchema,
1225
- patchSchema: StampWirePatchSchema
1226
- };
1227
- //#endregion
1228
- //#region src/annotation/kinds/strikeout/schema.ts
1229
- const StrikeoutDTOSchema = z.object({
1230
- ...TextMarkupDTOShape,
1231
- intent: StrikeoutIntentSchema.nullable(),
1232
- subtype: z.literal("strikeout")
1233
- });
1234
- const StrikeoutDraftSchema = z.object({
1235
- ...TextMarkupDraftShape,
1236
- ...AnnotationDraftBaseShape,
1237
- intent: StrikeoutIntentSchema.optional(),
1238
- subtype: z.literal("strikeout")
1239
- });
1240
- const StrikeoutPatchSchema = z.object({
1241
- ...TextMarkupPatchShape,
1242
- ...AnnotationPatchBaseShape,
1243
- intent: StrikeoutIntentSchema.optional(),
1244
- subtype: z.literal("strikeout")
1245
- });
1246
- //#endregion
1247
- //#region src/annotation/kinds/strikeout/index.ts
1248
- const StrikeoutKind = {
1249
- subtype: "strikeout",
1250
- pdfSubtypeCode: PdfAnnotationSubtypeCode.STRIKEOUT,
1251
- dtoSchema: StrikeoutDTOSchema,
1252
- draftSchema: StrikeoutDraftSchema,
1253
- patchSchema: StrikeoutPatchSchema
1254
- };
1255
- //#endregion
1256
- //#region src/annotation/kinds/text/schema.ts
1257
- const NoteIconSchema = z.enum([
1258
- "comment",
1259
- "key",
1260
- "note",
1261
- "help",
1262
- "new-paragraph",
1263
- "paragraph",
1264
- "insert"
1265
- ]);
1266
- const TextDTOSchema = z.object({
1267
- ...AnnotationBaseShape,
1268
- ...ColorStyleDTOShape,
1269
- icon: NoteIconSchema,
1270
- state: z.string().nullable(),
1271
- stateModel: z.string().nullable(),
1272
- subtype: z.literal("text")
1273
- });
1274
- const TextDraftSchema = z.object({
1275
- ...ColorStyleDraftShape,
1276
- ...AnnotationDraftBaseShape,
1277
- rect: PdfRectSchema,
1278
- icon: NoteIconSchema.optional(),
1279
- state: z.string().min(1).optional(),
1280
- stateModel: z.string().min(1).optional(),
1281
- subtype: z.literal("text")
1282
- });
1283
- const TextPatchSchema = z.object({
1284
- ...ColorStylePatchShape,
1285
- ...AnnotationPatchBaseShape,
1286
- rect: PdfRectSchema.optional(),
1287
- icon: NoteIconSchema.optional(),
1288
- state: z.string().min(1).nullable().optional(),
1289
- stateModel: z.string().min(1).nullable().optional(),
1290
- subtype: z.literal("text")
1291
- });
1292
- //#endregion
1293
- //#region src/annotation/kinds/text/index.ts
1294
- const TextKind = {
1295
- subtype: "text",
1296
- pdfSubtypeCode: PdfAnnotationSubtypeCode.TEXT,
1297
- dtoSchema: TextDTOSchema,
1298
- draftSchema: TextDraftSchema,
1299
- patchSchema: TextPatchSchema
1300
- };
1301
- //#endregion
1302
- //#region src/annotation/kinds/underline/schema.ts
1303
- const UnderlineDTOSchema = z.object({
1304
- ...TextMarkupDTOShape,
1305
- subtype: z.literal("underline")
1306
- });
1307
- const UnderlineDraftSchema = z.object({
1308
- ...TextMarkupDraftShape,
1309
- ...AnnotationDraftBaseShape,
1310
- subtype: z.literal("underline")
1311
- });
1312
- const UnderlinePatchSchema = z.object({
1313
- ...TextMarkupPatchShape,
1314
- ...AnnotationPatchBaseShape,
1315
- subtype: z.literal("underline")
1316
- });
1317
- //#endregion
1318
- //#region src/annotation/kinds/underline/index.ts
1319
- const UnderlineKind = {
1320
- subtype: "underline",
1321
- pdfSubtypeCode: PdfAnnotationSubtypeCode.UNDERLINE,
1322
- dtoSchema: UnderlineDTOSchema,
1323
- draftSchema: UnderlineDraftSchema,
1324
- patchSchema: UnderlinePatchSchema
1325
- };
1326
- //#endregion
1327
- //#region src/annotation/kinds/unsupported/schema.ts
1328
- const UnsupportedDTOSchema = z.object({
1329
- ...AnnotationBaseShape,
1330
- subtype: z.literal("unsupported"),
1331
- rawSubtypeCode: z.number().int(),
1332
- rawSubtypeName: z.string().nullable()
1333
- });
1334
- const UnsupportedDraftSchema = z.never();
1335
- const UnsupportedPatchSchema = z.never();
1336
- //#endregion
1337
- //#region src/annotation/kinds/unsupported/index.ts
1338
- const UnsupportedKind = {
1339
- subtype: "unsupported",
1340
- pdfSubtypeCode: PdfAnnotationSubtypeCode.UNKNOWN,
1341
- dtoSchema: UnsupportedDTOSchema,
1342
- draftSchema: UnsupportedDraftSchema,
1343
- patchSchema: UnsupportedPatchSchema
1344
- };
1345
- //#endregion
1346
- //#region src/annotation/kinds/widget.shared.ts
1347
- const WidgetStyleDTOShape = {
1348
- color: ColorSchema.nullable(),
1349
- interiorColor: ColorSchema.nullable(),
1350
- strokeWidth: z.number().nonnegative(),
1351
- borderStyle: AnnotationBorderStyleSchema,
1352
- fontFamily: StandardFontSchema.optional(),
1353
- fontSize: z.number().nonnegative().optional(),
1354
- fontColor: ColorSchema.optional(),
1355
- textAlign: TextAlignmentSchema
1356
- };
1357
- const WidgetStyleDraftShape = {
1358
- color: ColorSchema.nullable().optional(),
1359
- interiorColor: ColorSchema.nullable().optional(),
1360
- strokeWidth: z.number().nonnegative().optional(),
1361
- borderStyle: AnnotationBorderStyleSchema.optional(),
1362
- fontFamily: StandardFontSchema.optional(),
1363
- fontSize: z.number().nonnegative().optional(),
1364
- fontColor: ColorSchema.optional(),
1365
- textAlign: TextAlignmentSchema.optional()
1366
- };
1367
- const WidgetStylePatchShape = WidgetStyleDraftShape;
1368
- const WidgetAppearanceSchema = z.object(WidgetStyleDraftShape);
1369
- //#endregion
1370
- //#region src/annotation/kinds/widget/schema.ts
1371
- const WidgetDTOSchema = z.object({
1372
- ...AnnotationBaseShape,
1373
- ...WidgetStyleDTOShape,
1374
- subtype: z.literal("widget"),
1375
- fieldObjectNumber: z.number().int().nonnegative(),
1376
- fieldFamily: z.enum([
1377
- "text",
1378
- "checkbox",
1379
- "radio",
1380
- "combobox",
1381
- "listbox",
1382
- "pushbutton",
1383
- "signature",
1384
- "unknown"
1385
- ])
1386
- });
1387
- const WidgetDraftSchema = z.object({
1388
- ...AnnotationDraftBaseShape,
1389
- ...WidgetStyleDraftShape,
1390
- subtype: z.literal("widget"),
1391
- rect: PdfRectSchema
1392
- });
1393
- const WidgetPatchSchema = z.object({
1394
- ...AnnotationPatchBaseShape,
1395
- ...WidgetStylePatchShape,
1396
- subtype: z.literal("widget"),
1397
- rect: PdfRectSchema.optional()
1398
- });
1399
- //#endregion
1400
- //#region src/annotation/kinds/widget/index.ts
1401
- const WidgetKind = {
1402
- subtype: "widget",
1403
- pdfSubtypeCode: PdfAnnotationSubtypeCode.WIDGET,
1404
- dtoSchema: WidgetDTOSchema,
1405
- draftSchema: WidgetDraftSchema,
1406
- patchSchema: WidgetPatchSchema
1407
- };
1408
- //#endregion
1409
- //#region src/annotation/kinds/index.ts
1410
- /**
1411
- * The closed-world catalog of currently-implemented annotation kinds.
1412
- *
1413
- * Adding a new subtype is one folder under `kinds/<name>/` exporting the
1414
- * five files (dto, draft, patch, schema, index) and one entry in this
1415
- * tuple. The discriminated unions and zod discriminator below regenerate
1416
- * automatically; no other file in the package needs to change.
1417
- *
1418
- * Every subtype the engine has not yet wired up rides on
1419
- * `UnsupportedKind`. The wire format is stable: when a per-subtype reader
1420
- * lands later, the engine starts emitting the dedicated DTO instead of
1421
- * `unsupported`, and existing clients widen their handling without a
1422
- * version bump.
1423
- */
1424
- const ANNOTATION_KINDS = [
1425
- HighlightKind,
1426
- UnderlineKind,
1427
- SquigglyKind,
1428
- StrikeoutKind,
1429
- CircleKind,
1430
- SquareKind,
1431
- PolygonKind,
1432
- PolylineKind,
1433
- LineKind,
1434
- LinkKind,
1435
- InkKind,
1436
- FreeTextKind,
1437
- CaretKind,
1438
- TextKind,
1439
- StampKind,
1440
- FileAttachmentKind,
1441
- WidgetKind,
1442
- RedactKind,
1443
- UnsupportedKind
1444
- ];
1445
- /**
1446
- * Lookup helper for the engine's reader catalog and identity resolver.
1447
- * O(1) by `subtype` literal at runtime.
1448
- */
1449
- const KIND_BY_SUBTYPE = Object.freeze(Object.fromEntries(ANNOTATION_KINDS.map((kind) => [kind.subtype, kind])));
1450
- /**
1451
- * Runtime zod schema for the discriminated union. The cast unwinds the
1452
- * generic schema map into the specific tuple form `discriminatedUnion`
1453
- * needs. Servers and cloud clients use this to validate every annotation
1454
- * payload on the wire.
1455
- */
1456
- const AnnotationDTOSchema = z.discriminatedUnion("subtype", [
1457
- HighlightKind.dtoSchema,
1458
- UnderlineKind.dtoSchema,
1459
- SquigglyKind.dtoSchema,
1460
- StrikeoutKind.dtoSchema,
1461
- CircleKind.dtoSchema,
1462
- SquareKind.dtoSchema,
1463
- PolygonKind.dtoSchema,
1464
- PolylineKind.dtoSchema,
1465
- LineKind.dtoSchema,
1466
- LinkKind.dtoSchema,
1467
- InkKind.dtoSchema,
1468
- FreeTextKind.dtoSchema,
1469
- CaretKind.dtoSchema,
1470
- TextKind.dtoSchema,
1471
- StampKind.dtoSchema,
1472
- FileAttachmentKind.dtoSchema,
1473
- WidgetKind.dtoSchema,
1474
- RedactKind.dtoSchema,
1475
- UnsupportedKind.dtoSchema
1476
- ]);
1477
- /**
1478
- * Validates the WIRE draft form (post-normalization) — binary-carrying
1479
- * kinds appear here with `{ resource }` refs, never inline bytes.
1480
- */
1481
- const AnnotationDraftSchema = z.discriminatedUnion("subtype", [
1482
- HighlightKind.draftSchema,
1483
- UnderlineKind.draftSchema,
1484
- SquigglyKind.draftSchema,
1485
- StrikeoutKind.draftSchema,
1486
- CircleKind.draftSchema,
1487
- SquareKind.draftSchema,
1488
- PolygonKind.draftSchema,
1489
- PolylineKind.draftSchema,
1490
- LineKind.draftSchema,
1491
- LinkKind.draftSchema,
1492
- InkKind.draftSchema,
1493
- FreeTextKind.draftSchema,
1494
- CaretKind.draftSchema,
1495
- TextKind.draftSchema,
1496
- StampKind.draftSchema,
1497
- FileAttachmentKind.draftSchema,
1498
- WidgetKind.draftSchema,
1499
- RedactKind.draftSchema
1500
- ]);
1501
- /** Validates the WIRE patch form (post-normalization). */
1502
- const AnnotationPatchSchema = z.discriminatedUnion("subtype", [
1503
- HighlightKind.patchSchema,
1504
- UnderlineKind.patchSchema,
1505
- SquigglyKind.patchSchema,
1506
- StrikeoutKind.patchSchema,
1507
- CircleKind.patchSchema,
1508
- SquareKind.patchSchema,
1509
- PolygonKind.patchSchema,
1510
- PolylineKind.patchSchema,
1511
- LineKind.patchSchema,
1512
- LinkKind.patchSchema,
1513
- InkKind.patchSchema,
1514
- FreeTextKind.patchSchema,
1515
- CaretKind.patchSchema,
1516
- TextKind.patchSchema,
1517
- StampKind.patchSchema,
1518
- FileAttachmentKind.patchSchema,
1519
- WidgetKind.patchSchema,
1520
- RedactKind.patchSchema
1521
- ]);
1522
- //#endregion
1523
- //#region src/forms/schema.ts
1524
- const FormFieldRefSchema = z.discriminatedUnion("kind", [z.object({
1525
- kind: z.literal("objectNumber"),
1526
- fieldObjectNumber: z.number().int().positive()
1527
- }), z.object({
1528
- kind: z.literal("fqn"),
1529
- name: z.string().min(1)
1530
- })]);
1531
- const FormWidgetRefShape = {
1532
- annotObjectNumber: z.number().int().nonnegative(),
1533
- pageObjectNumber: z.number().int().nonnegative()
1534
- };
1535
- const FormWidgetRefSchema = z.object(FormWidgetRefShape);
1536
- const FormFieldFlagsSchema = z.object({
1537
- readOnly: z.boolean(),
1538
- required: z.boolean(),
1539
- noExport: z.boolean(),
1540
- raw: z.number().int().nonnegative()
1541
- });
1542
- const ToggleFieldWidgetSchema = z.object({
1543
- ...FormWidgetRefShape,
1544
- onState: z.string(),
1545
- exportValue: z.string(),
1546
- checked: z.boolean()
1547
- });
1548
- const FormFieldOptionSchema = z.object({
1549
- label: z.string(),
1550
- value: z.string(),
1551
- selected: z.boolean()
1552
- });
1553
- const FormValueEntrySchema = z.discriminatedUnion("kind", [
1554
- z.object({ kind: z.literal("none") }),
1555
- z.object({
1556
- kind: z.literal("scalar"),
1557
- value: z.string()
1558
- }),
1559
- z.object({
1560
- kind: z.literal("array"),
1561
- values: z.array(z.string())
1562
- }),
1563
- z.object({ kind: z.literal("unsupported") })
1564
- ]);
1565
- const FormFieldBaseShape = {
1566
- ref: FormFieldRefSchema,
1567
- fieldObjectNumber: z.number().int().nonnegative(),
1568
- name: z.string(),
1569
- origin: z.enum(["acroform", "recovered"]),
1570
- flags: FormFieldFlagsSchema,
1571
- alternateName: z.string().nullable(),
1572
- mappingName: z.string().nullable(),
1573
- valueEntry: FormValueEntrySchema,
1574
- defaultValueEntry: FormValueEntrySchema,
1575
- actions: PdfFieldActionsSchema.optional(),
1576
- widgets: z.array(FormWidgetRefSchema)
1577
- };
1578
- const FormFieldDTOSchema = z.discriminatedUnion("family", [
1579
- z.object({
1580
- ...FormFieldBaseShape,
1581
- family: z.literal("text"),
1582
- value: z.string(),
1583
- defaultValue: z.string(),
1584
- maxLength: z.number().int().positive().nullable(),
1585
- multiline: z.boolean(),
1586
- password: z.boolean(),
1587
- comb: z.boolean()
1588
- }),
1589
- z.object({
1590
- ...FormFieldBaseShape,
1591
- family: z.literal("checkbox"),
1592
- checked: z.boolean(),
1593
- exportValue: z.string(),
1594
- widgets: z.array(ToggleFieldWidgetSchema)
1595
- }),
1596
- z.object({
1597
- ...FormFieldBaseShape,
1598
- family: z.literal("radio"),
1599
- value: z.string(),
1600
- radiosInUnison: z.boolean(),
1601
- noToggleToOff: z.boolean(),
1602
- widgets: z.array(ToggleFieldWidgetSchema)
1603
- }),
1604
- z.object({
1605
- ...FormFieldBaseShape,
1606
- family: z.literal("combobox"),
1607
- value: z.string(),
1608
- defaultValue: z.string(),
1609
- edit: z.boolean(),
1610
- options: z.array(FormFieldOptionSchema)
1611
- }),
1612
- z.object({
1613
- ...FormFieldBaseShape,
1614
- family: z.literal("listbox"),
1615
- selectedValues: z.array(z.string()),
1616
- multiSelect: z.boolean(),
1617
- options: z.array(FormFieldOptionSchema)
1618
- }),
1619
- z.object({
1620
- ...FormFieldBaseShape,
1621
- family: z.literal("pushbutton")
1622
- }),
1623
- z.object({
1624
- ...FormFieldBaseShape,
1625
- family: z.literal("signature")
1626
- }),
1627
- z.object({
1628
- ...FormFieldBaseShape,
1629
- family: z.literal("unknown"),
1630
- rawValue: z.string()
1631
- })
1632
- ]);
1633
- const FormKindSchema = z.enum([
1634
- "none",
1635
- "acroform",
1636
- "xfa"
1637
- ]);
1638
- const FormSnapshotSchema = z.object({
1639
- formKind: FormKindSchema,
1640
- needsAppearances: z.boolean(),
1641
- fields: z.array(FormFieldDTOSchema),
1642
- calculationOrder: z.array(FormFieldRefSchema.nullable())
1643
- });
1644
- const FormFieldValueSchema = z.discriminatedUnion("type", [
1645
- z.object({
1646
- type: z.literal("text"),
1647
- value: z.string()
1648
- }),
1649
- z.object({
1650
- type: z.literal("toggle"),
1651
- state: z.string().nullable()
1652
- }),
1653
- z.object({
1654
- type: z.literal("choice"),
1655
- values: z.array(z.string())
1656
- })
1657
- ]);
1658
- const FormDataFormatSchema = z.enum(["fdf", "xfdf"]);
1659
- const WidgetPlacementSchema = z.object({
1660
- pageObjectNumber: z.number().int().positive(),
1661
- rect: PdfRectSchema,
1662
- onState: z.string().min(1).optional(),
1663
- appearance: WidgetAppearanceSchema.optional()
1664
- });
1665
- const FormFieldOptionInputSchema = z.object({
1666
- label: z.string(),
1667
- value: z.string()
1668
- });
1669
- const FormFieldDraftBaseShape = {
1670
- name: z.string().min(1),
1671
- readOnly: z.boolean().optional(),
1672
- required: z.boolean().optional(),
1673
- noExport: z.boolean().optional(),
1674
- alternateName: z.string().optional(),
1675
- mappingName: z.string().optional()
1676
- };
1677
- const FormFieldDraftSchema = z.discriminatedUnion("family", [
1678
- z.object({
1679
- ...FormFieldDraftBaseShape,
1680
- family: z.literal("text"),
1681
- defaultValue: z.string().optional(),
1682
- maxLength: z.number().int().positive().optional(),
1683
- multiline: z.boolean().optional(),
1684
- password: z.boolean().optional(),
1685
- comb: z.boolean().optional(),
1686
- widget: WidgetPlacementSchema.optional()
1687
- }),
1688
- z.object({
1689
- ...FormFieldDraftBaseShape,
1690
- family: z.literal("checkbox"),
1691
- widget: WidgetPlacementSchema.optional()
1692
- }),
1693
- z.object({
1694
- ...FormFieldDraftBaseShape,
1695
- family: z.literal("radio"),
1696
- radiosInUnison: z.boolean().optional(),
1697
- noToggleToOff: z.boolean().optional(),
1698
- widgets: z.array(WidgetPlacementSchema).optional()
1699
- }),
1700
- z.object({
1701
- ...FormFieldDraftBaseShape,
1702
- family: z.literal("combobox"),
1703
- edit: z.boolean().optional(),
1704
- options: z.array(FormFieldOptionInputSchema).optional(),
1705
- defaultValue: z.string().optional(),
1706
- widget: WidgetPlacementSchema.optional()
1707
- }),
1708
- z.object({
1709
- ...FormFieldDraftBaseShape,
1710
- family: z.literal("listbox"),
1711
- multiSelect: z.boolean().optional(),
1712
- options: z.array(FormFieldOptionInputSchema).optional(),
1713
- widget: WidgetPlacementSchema.optional()
1714
- }),
1715
- z.object({
1716
- ...FormFieldDraftBaseShape,
1717
- family: z.literal("signature"),
1718
- widget: WidgetPlacementSchema.optional()
1719
- })
1720
- ]);
1721
- const FormFieldPatchBaseShape = {
1722
- name: z.string().min(1).optional(),
1723
- readOnly: z.boolean().optional(),
1724
- required: z.boolean().optional(),
1725
- noExport: z.boolean().optional(),
1726
- alternateName: z.string().nullable().optional(),
1727
- mappingName: z.string().nullable().optional()
1728
- };
1729
- const FormFieldPatchSchema = z.discriminatedUnion("family", [
1730
- z.object({
1731
- ...FormFieldPatchBaseShape,
1732
- family: z.literal("text"),
1733
- defaultValue: z.string().nullable().optional(),
1734
- maxLength: z.number().int().positive().nullable().optional(),
1735
- multiline: z.boolean().optional(),
1736
- password: z.boolean().optional(),
1737
- comb: z.boolean().optional()
1738
- }),
1739
- z.object({
1740
- ...FormFieldPatchBaseShape,
1741
- family: z.literal("checkbox")
1742
- }),
1743
- z.object({
1744
- ...FormFieldPatchBaseShape,
1745
- family: z.literal("radio"),
1746
- radiosInUnison: z.boolean().optional(),
1747
- noToggleToOff: z.boolean().optional()
1748
- }),
1749
- z.object({
1750
- ...FormFieldPatchBaseShape,
1751
- family: z.literal("combobox"),
1752
- edit: z.boolean().optional(),
1753
- defaultValue: z.string().nullable().optional(),
1754
- options: z.array(FormFieldOptionInputSchema).optional()
1755
- }),
1756
- z.object({
1757
- ...FormFieldPatchBaseShape,
1758
- family: z.literal("listbox"),
1759
- multiSelect: z.boolean().optional(),
1760
- options: z.array(FormFieldOptionInputSchema).optional()
1761
- })
1762
- ]);
1763
- //#endregion
1764
- //#region src/wire/schemas.ts
1765
- const DocumentMetadataSchema = z.object({
1766
- title: z.string().nullable(),
1767
- author: z.string().nullable(),
1768
- subject: z.string().nullable(),
1769
- keywords: z.string().nullable(),
1770
- producer: z.string().nullable(),
1771
- creator: z.string().nullable(),
1772
- created: z.string().datetime().nullable(),
1773
- modified: z.string().datetime().nullable(),
1774
- trapped: z.enum([
1775
- "true",
1776
- "false",
1777
- "unknown"
1778
- ]),
1779
- custom: z.record(z.string(), z.string())
1780
- });
1781
- /**
1782
- * Three-state metadata patch. Mirrors annotation patch semantics:
1783
- * `undefined` leaves a field, `null` clears it, a value sets it. `custom`
1784
- * is a per-key three-state map (string set / null clear / absent leave).
1785
- */
1786
- const MetadataPatchSchema = z.object({
1787
- title: z.string().nullable().optional(),
1788
- author: z.string().nullable().optional(),
1789
- subject: z.string().nullable().optional(),
1790
- keywords: z.string().nullable().optional(),
1791
- producer: z.string().nullable().optional(),
1792
- creator: z.string().nullable().optional(),
1793
- created: z.string().datetime().nullable().optional(),
1794
- modified: z.string().datetime().nullable().optional(),
1795
- trapped: z.enum([
1796
- "true",
1797
- "false",
1798
- "unknown"
1799
- ]).optional(),
1800
- custom: z.record(z.string(), z.string().nullable()).optional()
1801
- }).strict();
1802
- const OpenDocumentResponseSchema = z.object({ id: z.string() });
1803
- /**
1804
- * Wire shape of `GET /v1/docs/:docId/head`. Mirrors the server-side
1805
- * `DocumentHead` interface; the schema is the source of truth so
1806
- * older SDKs talking to newer servers degrade gracefully (extra
1807
- * fields are accepted and ignored).
1808
- *
1809
- * `docVersion` is the single monotonic integer per doc; it bumps on
1810
- * ANY mutation that could change the manifest's content (page list,
1811
- * per-page content, per-page annotations, per-page weak-flag), which
1812
- * makes `/manifest@docVersion=N` fully content-addressed and cache-friendly.
1813
- * Phase 4 hard-codes it to `1`; Phase 5's mutation handler is what
1814
- * actually bumps it.
1815
- */
1816
- const DocumentHeadSchema = z.object({
1817
- id: z.string(),
1818
- baseSha: z.string(),
1819
- storageSizeBytes: z.number().int().nonnegative(),
1820
- docVersion: z.number().int().positive(),
1821
- state: z.enum([
1822
- "pending",
1823
- "ready",
1824
- "failed",
1825
- "deleting"
1826
- ]),
1827
- encryption: z.object({
1828
- state: z.enum([
1829
- "unknown",
1830
- "none",
1831
- "encrypted",
1832
- "unsupported"
1833
- ]),
1834
- requiresPassword: z.boolean().nullable()
1835
- }),
1836
- permissions: z.object({
1837
- known: z.boolean(),
1838
- bits: z.number().int().nonnegative().nullable(),
1839
- allAllowed: z.boolean().nullable(),
1840
- openedAs: z.enum([
1841
- "none",
1842
- "user",
1843
- "owner"
1844
- ]).nullable(),
1845
- securityHandlerRevision: z.number().int().nullable(),
1846
- canUpgradeToOwner: z.boolean()
1847
- }),
1848
- access: z.object({
1849
- required: z.boolean(),
1850
- reasons: z.array(z.enum([
1851
- "password",
1852
- "cdn",
1853
- "permissions-unknown"
1854
- ])),
1855
- endpoint: z.string().optional()
1856
- })
1857
- });
1858
- const AccessRequestSchema = z.object({
1859
- /** Deprecated: identity now rides the PATH
1860
- * (`/v1/docs/:docId/layers/:layerName/access`). Kept optional for the
1861
- * legacy `/v1/access` alias, which requires `docId` in the body. */
1862
- docId: z.string().min(1).optional(),
1863
- layerName: z.string().min(1).optional(),
1864
- password: z.string().optional(),
1865
- passwordGrant: z.string().optional(),
1866
- mode: z.enum(["any", "owner"]).optional()
1867
- });
1868
- /**
1869
- * Typed boolean view of the PDF user-access permission word. Names
1870
- * mirror the `PdfBits` shape in @embedpdf/engine-core/auth/scope; ISO
1871
- * bit numbers (3, 4, 5, 6, 9, 10, 11, 12).
1872
- */
1873
- const PdfBitsObjectSchema = z.object({
1874
- bit3: z.boolean(),
1875
- bit4: z.boolean(),
1876
- bit5: z.boolean(),
1877
- bit6: z.boolean(),
1878
- bit9: z.boolean(),
1879
- bit10: z.boolean(),
1880
- bit11: z.boolean(),
1881
- bit12: z.boolean()
1882
- });
1883
- /**
1884
- * Capability-shaped advisory for the client UI. Mirrors
1885
- * `PdfPermissionAdvisory` in @embedpdf/engine-core/runtime; one
1886
- * boolean per UI badge.
1887
- */
1888
- const PdfPermissionAdvisoryObjectSchema = z.object({
1889
- canPrint: z.boolean(),
1890
- canPrintHigh: z.boolean(),
1891
- canCopy: z.boolean(),
1892
- canAnnotate: z.boolean(),
1893
- canFillForms: z.boolean(),
1894
- canModifyForms: z.boolean(),
1895
- canModifyPages: z.boolean(),
1896
- canAssemble: z.boolean()
1897
- });
1898
- const PdfPermissionInfoSchema = z.object({
1899
- known: z.boolean(),
1900
- allAllowed: z.boolean().nullable(),
1901
- bits: z.number().int().nonnegative().nullable(),
1902
- openedAs: z.enum([
1903
- "none",
1904
- "user",
1905
- "owner"
1906
- ]).nullable(),
1907
- securityHandlerRevision: z.number().int().nullable(),
1908
- flags: PdfBitsObjectSchema.optional(),
1909
- advisory: PdfPermissionAdvisoryObjectSchema.optional()
1910
- }).nullable();
1911
- const DocumentSecurityStateSchema = z.object({
1912
- encryption: z.object({
1913
- state: z.enum([
1914
- "unknown",
1915
- "none",
1916
- "encrypted",
1917
- "unsupported"
1918
- ]),
1919
- requiresPassword: z.boolean().nullable()
1920
- }),
1921
- permissions: z.object({
1922
- known: z.boolean(),
1923
- bits: z.number().int().nonnegative().nullable(),
1924
- allAllowed: z.boolean().nullable(),
1925
- openedAs: z.enum([
1926
- "none",
1927
- "user",
1928
- "owner"
1929
- ]).nullable(),
1930
- securityHandlerRevision: z.number().int().nullable(),
1931
- canUpgradeToOwner: z.boolean()
1932
- }),
1933
- access: z.object({
1934
- required: z.boolean(),
1935
- reasons: z.array(z.enum([
1936
- "password",
1937
- "cdn",
1938
- "permissions-unknown"
1939
- ])),
1940
- endpoint: z.string().optional()
1941
- })
1942
- });
1943
- const AccessResponseSchema = z.object({
1944
- security: DocumentSecurityStateSchema,
1945
- cdn: z.object({
1946
- adapter: z.enum([
1947
- "none",
1948
- "cloudfront",
1949
- "cloud-cdn",
1950
- "bunny",
1951
- "azure-fd",
1952
- "custom-hmac"
1953
- ]),
1954
- expiresAt: z.number().int().positive(),
1955
- cache: z.object({
1956
- scope: z.enum(["browser-private", "edge-shared"]),
1957
- immutableVersionedReads: z.boolean()
1958
- }),
1959
- baseUrlOverrides: z.record(z.string(), z.string()).nullable(),
1960
- authHeader: z.object({
1961
- name: z.string(),
1962
- value: z.string()
1963
- }).nullable(),
1964
- signedQueryParams: z.record(z.string(), z.string()).nullable(),
1965
- signedCookies: z.array(z.object({
1966
- name: z.string(),
1967
- value: z.string(),
1968
- domain: z.string().optional(),
1969
- path: z.string().optional(),
1970
- expires: z.number().int().optional()
1971
- })).nullable(),
1972
- signedPathPolicies: z.array(z.object({
1973
- pathPrefix: z.string(),
1974
- queryParams: z.record(z.string(), z.string())
1975
- })).nullable()
1976
- }),
1977
- passwordGrant: z.string().nullable(),
1978
- pdfPermissions: PdfPermissionInfoSchema,
1979
- scope: z.array(z.string()),
1980
- /**
1981
- * Concrete capability set granted to this caller after expanding
1982
- * `pdf.permissions` and applying resolver implication rules. Client
1983
- * UI should drive feature visibility off this, not off raw `scope`.
1984
- * Always present in /access responses (server populates from
1985
- * `expandRawScope`). Sorted alphabetically for stable change
1986
- * detection.
1987
- */
1988
- effectiveScope: z.array(z.string()),
1989
- identity: z.object({
1990
- user_id: z.string().optional(),
1991
- group_id: z.string().optional(),
1992
- groups: z.array(z.string()).optional(),
1993
- display_name: z.string().optional()
1994
- }),
1995
- originPasswordPolicy: z.object({ mode: z.enum([
1996
- "not-needed",
1997
- "client-retry",
1998
- "server-session"
1999
- ]) }),
2000
- expiresAt: z.number().int().positive(),
2001
- /**
2002
- * The deployment's render lattice — the canonical parameter points the
2003
- * server treats as durable, CDN-shared artifacts. Lives HERE and never in
2004
- * the manifest: manifests are version-pinned immutable objects; the
2005
- * lattice is mutable deployment policy. The SDK exposes it (and a pure
2006
- * `snap` helper) but NEVER conforms requests implicitly — the same render
2007
- * call must not return different pixels on local vs cloud. When
2008
- * `enforced` is true the server rejects off-lattice render tokens with
2009
- * 400; when false, off-lattice renders are computed but not persisted.
2010
- * Absent on older servers → treat as unenforced/unknown.
2011
- */
2012
- renderPolicy: z.object({
2013
- /**
2014
- * Full-page renders quantize on `viewport.width` — the bounded
2015
- * quantity is OUTPUT PIXELS, never zoom (PDF page space is
2016
- * effectively unbounded, so a scale lattice bounds artifact count
2017
- * but not size).
2018
- */
2019
- fullPage: z.object({ widths: z.array(z.number().int().positive()) }),
2020
- /**
2021
- * RESERVED for deep-zoom tile support: scale-based pyramid ×
2022
- * fixed tile size, constant per-job cost. Absent until the tiling
2023
- * plugin ships.
2024
- */
2025
- tiles: z.object({
2026
- tileSizes: z.array(z.number().int().positive()),
2027
- scales: z.array(z.number().positive())
2028
- }).optional(),
2029
- /**
2030
- * Annotation-appearance lattice — SCALE-based (appearances are sized
2031
- * by `rect × scale` and must track the page's effective render scale
2032
- * for crisp composites).
2033
- */
2034
- appearances: z.object({ scales: z.array(z.number().positive()) }).optional(),
2035
- /** Worker-side output budget for degenerate page geometry. */
2036
- maxRenderPixels: z.number().int().positive().optional(),
2037
- formats: z.array(z.enum(["webp", "png"])),
2038
- background: z.enum(["white"]),
2039
- enforced: z.boolean()
2040
- }).optional()
2041
- });
2042
- const PdfSaveModeSchema = z.enum(["incremental", "rewrite"]);
2043
- const engineErrorCodeValues = Object.values(EngineErrorCode);
2044
- const EngineErrorPayloadSchema = z.object({
2045
- name: z.literal("EngineError"),
2046
- code: z.enum(engineErrorCodeValues),
2047
- message: z.string(),
2048
- details: z.record(z.string(), z.unknown()).optional()
2049
- });
2050
- const WeakAnnotationStateSchema = z.discriminatedUnion("kind", [z.object({ kind: z.literal("unknown") }), z.object({
2051
- kind: z.literal("known"),
2052
- hasAnyWeakAnnotations: z.boolean()
2053
- })]);
2054
- const PageStateSchema = z.object({
2055
- pageObjectNumber: z.number().int().positive(),
2056
- revision: RevisionTokenSchema,
2057
- weakAnnotationState: WeakAnnotationStateSchema
2058
- });
2059
- const CachePinsSchema = z.object({
2060
- contentVersion: z.number().int().positive(),
2061
- annotationVersion: z.number().int().positive()
2062
- });
2063
- /**
2064
- * Plane scopes are DERIVED from the version counters at every emission
2065
- * point (layer manifests, mutation cache envelopes, SSE rows), never stored.
2066
- * Additive/optional both ways: old clients ignore it, old servers omit it
2067
- * (consumers treat absence as all-'layer' — never wrong, only unshared).
2068
- */
2069
- const LayerScopeValueSchema = z.enum(["base", "layer"]);
2070
- const LayerScopesSchema = z.object({
2071
- content: LayerScopeValueSchema,
2072
- annotations: LayerScopeValueSchema,
2073
- layout: LayerScopeValueSchema,
2074
- attachments: LayerScopeValueSchema,
2075
- metadata: LayerScopeValueSchema,
2076
- actions: LayerScopeValueSchema
2077
- });
2078
- /**
2079
- * Per-page envelope inside `DocumentManifest`. Carries the full
2080
- * `PageState` plus the cache-busting integers the SDK embeds in
2081
- * leaf URLs (`/pages/:pon/text@contentVersion=N`, `/pages/:pon/annotations@annotationVersion=N`).
2082
- *
2083
- * `contentVersion` bumps when the page's content stream changes
2084
- * (text, page reorder doesn't, the pon is durable). `annotationVersion`
2085
- * bumps when /Annots gains/loses entries or when a tracked annotation
2086
- * mutates. `hasWeakAnnotations` is hoisted from `PageState` so the
2087
- * SDK can decide whether to display a "stale-on-reorder" badge
2088
- * without re-fetching the page.
2089
- *
2090
- * Phase 4 hard-codes all three to (1, 1, false); Phase 5's
2091
- * `layer_pages` table drives the real values.
2092
- */
2093
- const ManifestPageSchema = z.object({
2094
- state: PageStateSchema,
2095
- cache: CachePinsSchema
2096
- }).superRefine((page, ctx) => {
2097
- if (page.state.weakAnnotationState.kind !== "known") ctx.addIssue({
2098
- code: z.ZodIssueCode.custom,
2099
- path: ["state", "weakAnnotationState"],
2100
- message: "manifest pages must have a known weak annotation state"
2101
- });
2102
- });
2103
- /**
2104
- * Wire shape of `GET /v1/docs/:docId/manifest@docVersion=N`. Content-addressed
2105
- * by `docVersion`; safe to cache with `Cache-Control: public,
2106
- * max-age=31536000, immutable`.
2107
- */
2108
- const DocumentManifestSchema = z.object({
2109
- docVersion: z.number().int().positive(),
2110
- layoutVersion: z.number().int().positive(),
2111
- metadataVersion: z.number().int().positive(),
2112
- actionsVersion: z.number().int().positive().default(1),
2113
- attachmentsVersion: z.number().int().positive().default(1),
2114
- annotationsVersion: z.number().int().positive().default(1),
2115
- auditHead: z.number().int().nonnegative(),
2116
- baseSha: z.string(),
2117
- layerVersion: z.number().int().nonnegative().default(0),
2118
- working: z.boolean().default(false),
2119
- baseByteLength: z.number().int().nonnegative().default(0),
2120
- scopes: LayerScopesSchema.optional(),
2121
- pages: z.array(ManifestPageSchema)
2122
- });
2123
- const AnnotationListPageSnapshotSchema = z.object({
2124
- pageState: PageStateSchema,
2125
- annotations: z.array(AnnotationDTOSchema)
2126
- });
2127
- const AnnotationListSnapshotAllPagesSchema = z.object({
2128
- pages: z.array(AnnotationListPageSnapshotSchema),
2129
- auditHead: z.number().int().nonnegative().optional()
2130
- });
2131
- /**
2132
- * Wire shape of `GET …/text/pages/:pon/data@<contentVersion>` and the
2133
- * `pages.text` worker result: the UTF-16-faithful extraction, the CHARACTER
2134
- * space size (`charCount` — the space geometry runs tile; NOT `text.length`),
2135
- * and the optional character→text anchor map. Malformed maps are rejected
2136
- * here with the shared `charMapViolation` invariants — absent/empty map
2137
- * REQUIRES `charCount === text.length` (identity).
2138
- */
2139
- const PageTextSnapshotSchema = z.object({
2140
- text: z.string(),
2141
- charCount: z.number().int().nonnegative(),
2142
- charMap: z.array(z.tuple([z.number().int().nonnegative(), z.number().int().nonnegative()])).optional()
2143
- }).superRefine((snapshot, ctx) => {
2144
- const violation = charMapViolation(snapshot.charCount, snapshot.text.length, snapshot.charMap);
2145
- if (violation !== null) ctx.addIssue({
2146
- code: z.ZodIssueCode.custom,
2147
- path: ["charMap"],
2148
- message: violation
2149
- });
2150
- });
2151
- const PageGeometryGlyphSchema = z.object({
2152
- looseBox: PdfRectSchema,
2153
- flags: z.number().int().nonnegative(),
2154
- tightBox: PdfRectSchema.optional()
2155
- });
2156
- const RotatedGeometryGlyphSchema = z.object({
2157
- looseQuad: PdfQuadSchema,
2158
- flags: z.number().int().nonnegative(),
2159
- tightQuad: PdfQuadSchema.optional()
2160
- });
2161
- const UprightGeometryRunSchema = z.object({
2162
- rect: PdfRectSchema,
2163
- charStart: z.number().int().nonnegative(),
2164
- glyphs: z.array(PageGeometryGlyphSchema),
2165
- fontSize: z.number().optional()
2166
- });
2167
- const RotatedGeometryRunSchema = z.object({
2168
- rect: PdfRectSchema,
2169
- charStart: z.number().int().nonnegative(),
2170
- glyphs: z.array(RotatedGeometryGlyphSchema),
2171
- rotation: z.number(),
2172
- ascentFlip: z.boolean(),
2173
- fontSize: z.number().optional()
2174
- });
2175
- const PageGeometryRunSchema = z.union([RotatedGeometryRunSchema, UprightGeometryRunSchema]);
2176
- const PageGeometrySnapshotSchema = z.object({ runs: z.array(PageGeometryRunSchema) });
2177
- /**
2178
- * Search wire shapes: the request body of the layer search route and the
2179
- * `search.query` worker/route result. The server re-validates the query
2180
- * semantics (`validateSearchQuery`: regex dialect + flag combos) after
2181
- * parse — the schema only checks structure.
2182
- */
2183
- const SearchQuerySchema = z.object({
2184
- text: z.string(),
2185
- regex: z.boolean().optional(),
2186
- matchCase: z.boolean().optional(),
2187
- wholeWord: z.boolean().optional(),
2188
- matchDiacritics: z.boolean().optional()
2189
- });
2190
- const SearchModeSchema = z.enum(["rects", "full"]);
2191
- const SearchRequestSchema = z.object({
2192
- query: SearchQuerySchema,
2193
- mode: SearchModeSchema.optional(),
2194
- cursor: z.string().optional(),
2195
- startPage: z.number().int().positive().optional(),
2196
- skip: z.number().int().nonnegative().optional(),
2197
- budget: z.object({
2198
- maxMatches: z.number().int().positive().optional(),
2199
- maxPages: z.number().int().positive().optional()
2200
- }).optional()
2201
- });
2202
- const SearchSnippetSchema = z.object({
2203
- text: z.string(),
2204
- matchStart: z.number().int().nonnegative(),
2205
- matchLength: z.number().int().positive()
2206
- });
2207
- const PdfTextSegmentSchema = z.object({
2208
- quad: PdfQuadSchema,
2209
- rect: PdfRectSchema,
2210
- advance: z.union([z.literal(1), z.literal(-1)])
2211
- });
2212
- const SearchMatchSchema = z.object({
2213
- pageObjectNumber: z.number().int().positive(),
2214
- charStart: z.number().int().nonnegative(),
2215
- charCount: z.number().int().positive(),
2216
- segments: z.array(PdfTextSegmentSchema),
2217
- snippet: SearchSnippetSchema.optional()
2218
- });
2219
- const SearchSliceSchema = z.object({
2220
- matches: z.array(SearchMatchSchema),
2221
- nextCursor: z.string().nullable(),
2222
- scannedPages: z.number().int().nonnegative(),
2223
- totalPages: z.number().int().nonnegative()
2224
- });
2225
- const PageNetworkRenderFormatSchema = z.enum(["png", "webp"]);
2226
- /**
2227
- * Wire schema for the cloud render endpoints, applied to the **nested**
2228
- * shape produced by `unflatten(...)` of the parsed token or query string.
2229
- *
2230
- * Adding a new render option is one change here (a new field plus any
2231
- * cross-field rule in `superRefine`) plus one entry in
2232
- * `RenderTokenSchema.fields`. The token codec, flatten/unflatten helpers,
2233
- * route handlers, and SDK URL builder are all generic and pick the new
2234
- * field up automatically.
2235
- *
2236
- * Coercion: token fields and query strings both arrive as strings, so every
2237
- * scalar uses `z.coerce.*`. Discriminated unions on `viewport.kind` and
2238
- * `target.kind` enforce viewport / rect coherence by construction — no
2239
- * superRefine for "fields must appear together" rules.
2240
- */
2241
- const RenderViewportSchema = z.discriminatedUnion("kind", [z.object({
2242
- kind: z.literal("width"),
2243
- width: z.coerce.number().positive().finite()
2244
- }).strict(), z.object({
2245
- kind: z.literal("scale"),
2246
- scale: z.coerce.number().positive().finite().optional()
2247
- }).strict()]);
2248
- const RenderTargetSchema = z.discriminatedUnion("kind", [z.object({ kind: z.literal("page") }).strict(), z.object({
2249
- kind: z.literal("rect"),
2250
- rect: z.object({
2251
- left: z.coerce.number().finite(),
2252
- bottom: z.coerce.number().finite(),
2253
- right: z.coerce.number().finite(),
2254
- top: z.coerce.number().finite()
2255
- }).strict()
2256
- }).strict()]);
2257
- const RenderRotationSchema = z.preprocess((raw) => raw === void 0 ? void 0 : Number(raw), z.number().refine((n) => n === 0 || n === 90 || n === 180 || n === 270, { message: "render rotation must be 0, 90, 180, or 270" }));
2258
- const RenderBackgroundSchema = z.enum(["white", "transparent"]);
2259
- const RenderQualitySchema = z.coerce.number().int().min(1).max(100);
2260
- /**
2261
- * Token/path rule: annotatedness is PATH-expressed —
2262
- * the render FAMILY the route belongs to — never token/query-expressed.
2263
- * Each family therefore gets its own query schema, built from one shared
2264
- * base:
2265
- *
2266
- * - the annotation-free family (`…/render/pages/`) has NO
2267
- * `annotationVersion` field at all — `.strict()` rejects it as an
2268
- * unrecognized key, so the illegal combination is unrepresentable;
2269
- * - the annotated family (`…/render/annotated/pages/`) REQUIRES
2270
- * `annotationVersion` on versioned requests — its artifact depends on
2271
- * the `annotations` plane, so the pin must be in the cache key.
2272
- *
2273
- * Both transforms stamp `includeAnnotations` onto the parsed SDK options
2274
- * from the family, so downstream consumers (worker options, classify) are
2275
- * family-blind.
2276
- */
2277
- function buildPageRenderQuerySchema(annotated) {
2278
- return z.object({
2279
- contentVersion: z.coerce.number().int().positive().optional(),
2280
- ...annotated ? { annotationVersion: z.coerce.number().int().positive().optional() } : {},
2281
- format: PageNetworkRenderFormatSchema.optional(),
2282
- viewport: RenderViewportSchema.optional(),
2283
- target: RenderTargetSchema.optional(),
2284
- rotation: RenderRotationSchema.optional(),
2285
- background: RenderBackgroundSchema.optional(),
2286
- quality: RenderQualitySchema.optional()
2287
- }).strict().superRefine((v, ctx) => {
2288
- const pins = v;
2289
- if (pins.contentVersion !== void 0 && v.format === void 0) ctx.addIssue({
2290
- code: z.ZodIssueCode.custom,
2291
- path: ["format"],
2292
- message: "versioned render requires format"
2293
- });
2294
- if (annotated && pins.annotationVersion !== void 0 && pins.contentVersion === void 0) ctx.addIssue({
2295
- code: z.ZodIssueCode.custom,
2296
- path: ["annotationVersion"],
2297
- message: "annotationVersion requires contentVersion"
2298
- });
2299
- if (annotated && pins.contentVersion !== void 0 && pins.annotationVersion === void 0) ctx.addIssue({
2300
- code: z.ZodIssueCode.custom,
2301
- path: ["annotationVersion"],
2302
- message: "versioned annotated render requires annotationVersion"
2303
- });
2304
- }).transform((v) => {
2305
- const pins = v;
2306
- return {
2307
- options: {
2308
- ...v.target ? { target: v.target } : {},
2309
- ...v.viewport ? { viewport: v.viewport } : {},
2310
- ...v.rotation !== void 0 ? { rotation: v.rotation } : {},
2311
- ...v.background !== void 0 ? { background: v.background } : {},
2312
- ...v.quality !== void 0 ? { quality: v.quality } : {},
2313
- ...v.format !== void 0 ? { format: v.format } : {},
2314
- includeAnnotations: annotated
2315
- },
2316
- ...pins.contentVersion !== void 0 ? { contentVersion: pins.contentVersion } : {},
2317
- ...pins.annotationVersion !== void 0 ? { annotationVersion: pins.annotationVersion } : {}
2318
- };
2319
- });
2320
- }
2321
- /** Query/token schema for the annotation-free render family (`page-render`). */
2322
- const PageRenderQuerySchema = buildPageRenderQuerySchema(false);
2323
- /** Query/token schema for the annotated render family (`page-render-annotated`). */
2324
- const PageRenderAnnotatedQuerySchema = buildPageRenderQuerySchema(true);
2325
- /**
2326
- * Query/token schema for the batch annotation-appearance render endpoint.
2327
- * Mirrors `PageRenderQuerySchema` but without page target/viewport/background
2328
- * or `includeAnnotations` (appearances are always annotation-derived), and
2329
- * keyed by `annotationVersion` only — appearance bitmaps do not depend on
2330
- * page base content, so `contentVersion` is not part of the cache key. The
2331
- * endpoint renders the Normal appearance only.
2332
- */
2333
- const AnnotationAppearancesQuerySchema = z.object({
2334
- annotationVersion: z.coerce.number().int().positive().optional(),
2335
- format: PageNetworkRenderFormatSchema.optional(),
2336
- rotation: RenderRotationSchema.optional(),
2337
- scale: z.coerce.number().positive().finite().optional(),
2338
- quality: RenderQualitySchema.optional()
2339
- }).strict().superRefine((v, ctx) => {
2340
- if (v.annotationVersion !== void 0 && v.format === void 0) ctx.addIssue({
2341
- code: z.ZodIssueCode.custom,
2342
- path: ["format"],
2343
- message: "versioned appearance render requires format"
2344
- });
2345
- }).transform((v) => {
2346
- return {
2347
- options: {
2348
- ...v.rotation !== void 0 ? { rotation: v.rotation } : {},
2349
- ...v.scale !== void 0 ? { scale: v.scale } : {},
2350
- ...v.quality !== void 0 ? { quality: v.quality } : {},
2351
- ...v.format !== void 0 ? { format: v.format } : {}
2352
- },
2353
- ...v.annotationVersion !== void 0 ? { annotationVersion: v.annotationVersion } : {}
2354
- };
2355
- });
2356
- /**
2357
- * The JSON manifest part of the appearance `multipart/form-data` response.
2358
- * Wire-stable; the cloud client validates the parsed `manifest` part against
2359
- * this before reconstructing image handles from the binary parts.
2360
- */
2361
- const AnnotationAppearanceManifestSchema = z.object({
2362
- pageState: PageStateSchema,
2363
- appearances: z.array(z.object({
2364
- part: z.string().min(1),
2365
- ref: AnnotationRefSchema,
2366
- mode: z.enum([
2367
- "normal",
2368
- "rollover",
2369
- "down"
2370
- ]),
2371
- rect: PdfRectSchema,
2372
- width: z.number().int().positive(),
2373
- height: z.number().int().positive(),
2374
- format: PageNetworkRenderFormatSchema,
2375
- contentType: z.string().min(1)
2376
- }))
2377
- });
2378
- /**
2379
- * Reasons a mutation tells the client its old snapshot is stale. Wire-stable;
2380
- * extend with care (forward-compat clients accept only known values).
2381
- */
2382
- const RefetchReasonSchema = z.enum([
2383
- "weakRefsInvalidated",
2384
- "externalChange",
2385
- "pageRebuilt"
2386
- ]);
2387
- const CacheDeltaSchema = z.object({
2388
- previousDocVersion: z.number().int().positive(),
2389
- docVersion: z.number().int().positive(),
2390
- annotationsVersion: z.number().int().positive().optional(),
2391
- layerVersion: z.number().int().nonnegative().optional(),
2392
- working: z.boolean().optional(),
2393
- pages: z.array(z.object({
2394
- pageObjectNumber: z.number().int().positive(),
2395
- cache: CachePinsSchema
2396
- }))
2397
- });
2398
- const MutationMetaSchema = z.object({
2399
- affectedPages: z.array(PageStateSchema),
2400
- cacheDelta: CacheDeltaSchema.nullable()
2401
- });
2402
- /**
2403
- * Per-page side-effect envelope every annotation mutation returns. Mirrors
2404
- * `AnnotationListMutationMeta`. The `shouldRefetch` field is `null` when the
2405
- * client's existing index-based references remain valid; non-null only when
2406
- * the engine knows for sure the snapshot is stale.
2407
- */
2408
- const AnnotationListMutationMetaSchema = z.object({
2409
- affectedPages: z.array(PageStateSchema),
2410
- cacheDelta: CacheDeltaSchema.nullable(),
2411
- changed: z.array(AnnotationStableIdSchema),
2412
- weakRefsInvalidated: z.boolean(),
2413
- shouldRefetch: z.object({ reason: RefetchReasonSchema }).nullable()
2414
- });
2415
- const AnnotationCreateResultSchema = z.object({
2416
- created: AnnotationDTOSchema,
2417
- meta: AnnotationListMutationMetaSchema
2418
- });
2419
- /** The engine's `/AP` verdict riding every update result (see engine-core
2420
- * `annotation/appearance.ts`). `changed` drives client raster invalidation. */
2421
- const AppearanceOutcomeSchema = z.object({
2422
- action: z.enum([
2423
- "preserved",
2424
- "regenerated",
2425
- "generation-unavailable"
2426
- ]),
2427
- changed: z.boolean()
2428
- });
2429
- const AnnotationUpdateResultSchema = z.object({
2430
- updated: AnnotationDTOSchema,
2431
- appearance: AppearanceOutcomeSchema,
2432
- meta: AnnotationListMutationMetaSchema
2433
- });
2434
- /**
2435
- * `deleted` is nullable: a weak annotation (no /NM, no indirect object
2436
- * number) has no durable id to report after removal. Cloud server and local
2437
- * worker both emit `null` in that case so callers don't have to special-case
2438
- * a sentinel.
2439
- */
2440
- const AnnotationDeleteResultSchema = z.object({
2441
- deleted: AnnotationStableIdSchema.nullable(),
2442
- meta: AnnotationListMutationMetaSchema
2443
- });
2444
- /**
2445
- * Batch annotation move (contiguous-block, symmetric with `pages.move`).
2446
- * `moved` is in caller order; each `moved[i]` lives at index `toIndex + i`
2447
- * after the move. ONE structural envelope per batch.
2448
- */
2449
- const AnnotationMoveResultSchema = z.object({
2450
- moved: z.array(AnnotationDTOSchema),
2451
- meta: AnnotationListMutationMetaSchema
2452
- });
2453
- const FormSetValueResultSchema = z.object({
2454
- field: FormFieldDTOSchema,
2455
- changedWidgets: z.array(FormWidgetRefSchema),
2456
- meta: MutationMetaSchema
2457
- });
2458
- const FormEffectSchema = z.discriminatedUnion("kind", [
2459
- z.object({
2460
- kind: z.literal("setValue"),
2461
- ref: FormFieldRefSchema,
2462
- value: FormFieldValueSchema
2463
- }),
2464
- z.object({
2465
- kind: z.literal("setDisplay"),
2466
- ref: FormFieldRefSchema,
2467
- display: z.enum([
2468
- "visible",
2469
- "hidden",
2470
- "noPrint",
2471
- "noView"
2472
- ])
2473
- }),
2474
- z.object({
2475
- kind: z.literal("setAppearanceText"),
2476
- ref: FormFieldRefSchema,
2477
- text: z.string()
2478
- }),
2479
- z.object({
2480
- kind: z.literal("reset"),
2481
- refs: z.array(FormFieldRefSchema)
2482
- })
2483
- ]);
2484
- const FormEffectsResultSchema = z.object({
2485
- results: z.array(z.object({
2486
- index: z.number().int().nonnegative(),
2487
- status: z.enum([
2488
- "applied",
2489
- "unchanged",
2490
- "rejected",
2491
- "failed",
2492
- "skipped"
2493
- ]),
2494
- fields: z.array(FormFieldDTOSchema),
2495
- changedWidgets: z.array(FormWidgetRefSchema),
2496
- error: EngineErrorPayloadSchema.optional()
2497
- })),
2498
- changedWidgets: z.array(FormWidgetRefSchema),
2499
- meta: MutationMetaSchema.nullable()
2500
- });
2501
- const FormImportResultSchema = z.object({
2502
- fieldsTotal: z.number().int().nonnegative(),
2503
- fieldsApplied: z.number().int().nonnegative(),
2504
- fieldsSkipped: z.number().int().nonnegative(),
2505
- widgetsChanged: z.number().int().nonnegative(),
2506
- snapshot: FormSnapshotSchema,
2507
- meta: MutationMetaSchema
2508
- });
2509
- const FormFieldCreateResultSchema = z.object({
2510
- field: FormFieldDTOSchema,
2511
- meta: MutationMetaSchema
2512
- });
2513
- const FormFieldUpdateResultSchema = z.object({
2514
- field: FormFieldDTOSchema,
2515
- meta: MutationMetaSchema
2516
- });
2517
- const FormFieldDeleteResultSchema = z.object({
2518
- deletedFieldObjectNumber: z.number().int().positive(),
2519
- removedWidgets: z.array(FormWidgetRefSchema),
2520
- meta: MutationMetaSchema
2521
- });
2522
- const FormWidgetLinkResultSchema = z.object({
2523
- field: FormFieldDTOSchema,
2524
- meta: MutationMetaSchema
2525
- });
2526
- const FormRepairResultSchema = z.object({
2527
- acroformCreated: z.boolean(),
2528
- fieldsLinked: z.number().int().nonnegative(),
2529
- widgetsLinked: z.number().int().nonnegative(),
2530
- fieldsUnrepairable: z.number().int().nonnegative(),
2531
- appearancesBaked: z.number().int().nonnegative(),
2532
- needAppearancesCleared: z.boolean(),
2533
- meta: MutationMetaSchema
2534
- });
2535
- const PageBoxesSchema = z.object({
2536
- media: PdfRectSchema,
2537
- crop: PdfRectSchema,
2538
- bleed: PdfRectSchema.optional(),
2539
- trim: PdfRectSchema.optional(),
2540
- art: PdfRectSchema.optional()
2541
- });
2542
- /**
2543
- * Pure geometry for one page (`pages.list()` element). No annotation
2544
- * liveness — that lives on annotation reads and the manifest.
2545
- */
2546
- const PageLayoutSchema = z.object({
2547
- index: z.number().int().nonnegative(),
2548
- pageObjectNumber: z.number().int().positive(),
2549
- label: z.string().nullable(),
2550
- size: PdfSizeSchema,
2551
- rotation: PdfRotationSchema,
2552
- userUnit: z.number().positive(),
2553
- boxes: PageBoxesSchema,
2554
- actions: PdfPageActionsSchema.optional()
2555
- });
2556
- const PageFlattenResultSchema = z.object({
2557
- pageObjectNumbers: z.array(z.number().int().positive()),
2558
- usage: z.enum(["display", "print"]),
2559
- results: z.array(z.object({
2560
- pageObjectNumber: z.number().int().positive(),
2561
- status: z.enum([
2562
- "applied",
2563
- "unchanged",
2564
- "failed",
2565
- "skipped"
2566
- ]),
2567
- error: EngineErrorPayloadSchema.optional()
2568
- })),
2569
- meta: MutationMetaSchema.nullable()
2570
- });
2571
- /** See `AnnotationFlattenResult`. */
2572
- const AnnotationFlattenResultSchema = z.object({
2573
- pageObjectNumber: z.number().int().positive(),
2574
- usage: z.enum(["display", "print"]),
2575
- results: z.array(z.object({
2576
- ref: AnnotationRefSchema,
2577
- status: z.enum(["applied", "skipped"])
2578
- })),
2579
- meta: MutationMetaSchema.nullable()
2580
- });
2581
- /** `annotations.flatten` input — see `AnnotationFlattenInput`. */
2582
- const AnnotationFlattenInputSchema = z.object({
2583
- refs: z.array(AnnotationRefSchema).min(1),
2584
- usage: z.enum(["display", "print"])
2585
- });
2586
- /** `annotations.exportAppearance` input — see `AnnotationAppearanceExportInput`. */
2587
- const AnnotationAppearanceExportInputSchema = z.object({ refs: z.array(AnnotationRefSchema).min(1) });
2588
- const PageFlattenInputSchema = z.object({
2589
- pageObjectNumbers: z.array(z.number().int().positive()),
2590
- usage: z.enum(["display", "print"])
2591
- });
2592
- const RedactionApplyScopeSchema = z.discriminatedUnion("kind", [z.object({
2593
- kind: z.literal("pages"),
2594
- pageObjectNumbers: z.array(z.number().int().positive())
2595
- }), z.object({
2596
- kind: z.literal("annotations"),
2597
- refs: z.array(AnnotationRefSchema)
2598
- })]);
2599
- const RedactionApplyResultSchema = z.object({
2600
- scope: RedactionApplyScopeSchema,
2601
- results: z.array(z.object({
2602
- pageObjectNumber: z.number().int().positive(),
2603
- status: z.enum([
2604
- "applied",
2605
- "unchanged",
2606
- "failed",
2607
- "skipped"
2608
- ]),
2609
- removedAnnotationCount: z.number().int().nonnegative(),
2610
- error: EngineErrorPayloadSchema.optional()
2611
- })),
2612
- removedAnnotationCount: z.number().int().nonnegative(),
2613
- meta: MutationMetaSchema.nullable()
2614
- });
2615
- /**
2616
- * Snapshot of every page in display order. Pages are addressed by
2617
- * `pageObjectNumber` everywhere except the per-element `index`, which is
2618
- * display order and intentionally not an identity. Carries geometry only.
2619
- */
2620
- /** See `NamedPageEntry`: decoded key + what it resolves to. */
2621
- const NamedPageEntrySchema = z.object({
2622
- name: z.string(),
2623
- target: z.discriminatedUnion("kind", [
2624
- z.object({
2625
- kind: z.literal("page"),
2626
- pageObjectNumber: z.number().int().positive()
2627
- }),
2628
- z.object({
2629
- kind: z.literal("template"),
2630
- objectNumber: z.number().int().positive()
2631
- }),
2632
- z.object({ kind: z.literal("dangling") })
2633
- ])
2634
- });
2635
- const PageListSnapshotSchema = z.object({
2636
- pageCount: z.number().int().nonnegative(),
2637
- pages: z.array(PageLayoutSchema),
2638
- namedPages: z.array(NamedPageEntrySchema).optional()
2639
- });
2640
- /** `pages.setName` input — see `PageNameInput`. */
2641
- const PageNameInputSchema = z.object({
2642
- name: z.string().min(1),
2643
- pageObjectNumber: z.number().int().positive(),
2644
- replace: z.string().min(1).optional()
2645
- });
2646
- /** `pages.removeName` input — see `PageRemoveNameInput`. */
2647
- const PageRemoveNameInputSchema = z.object({ name: z.string().min(1) });
2648
- /**
2649
- * Page reorder input. Pages are always addressed by `pageObjectNumber`;
2650
- * `destIndex` is the insertion point in the post-removal index space.
2651
- */
2652
- const PageMoveInputSchema = z.object({
2653
- pageObjectNumbers: z.array(z.number().int().positive()),
2654
- destIndex: z.number().int().nonnegative()
2655
- });
2656
- /**
2657
- * Coherence pins shared by every page-STRUCTURE result (move/rotate/delete) —
2658
- * see `PageStructureCache`. Nullable at each use site (local engines).
2659
- */
2660
- const PageStructureCacheSchema = z.object({
2661
- previousDocVersion: z.number().int().nonnegative(),
2662
- docVersion: z.number().int().positive(),
2663
- layoutVersion: z.number().int().positive()
2664
- });
2665
- /**
2666
- * Page reorder result. No revision is bumped (no doc-level revision exists,
2667
- * and per-page revisions intentionally survive a page reorder). The full
2668
- * post-move order is returned so callers can swap their snapshot directly.
2669
- */
2670
- const PageMoveResultSchema = z.object({
2671
- layout: PageListSnapshotSchema,
2672
- cache: PageStructureCacheSchema.nullable()
2673
- });
2674
- /** Named-page mutation result — layout-shaped, see `PageNameResult`. */
2675
- const PageNameResultSchema = z.object({
2676
- layout: PageListSnapshotSchema,
2677
- cache: PageStructureCacheSchema.nullable()
2678
- });
2679
- /**
2680
- * Page rotate input. ABSOLUTE rotation (idempotent — see `PageRotateInput`),
2681
- * one value applied to every listed page.
2682
- */
2683
- const PageRotateInputSchema = z.object({
2684
- pageObjectNumbers: z.array(z.number().int().positive()),
2685
- rotation: PdfRotationSchema
2686
- });
2687
- /**
2688
- * Page rotate result. Rotation is presentation metadata over normalized
2689
- * content: nothing per-page invalidates; the new `layout` carries the
2690
- * rotation values (see `PageRotateResult`).
2691
- */
2692
- const PageRotateResultSchema = z.object({
2693
- layout: PageListSnapshotSchema,
2694
- cache: PageStructureCacheSchema.nullable()
2695
- });
2696
- /** Page delete input. Deleting every page is rejected server/worker-side. */
2697
- const PageDeleteInputSchema = z.object({ pageObjectNumbers: z.array(z.number().int().positive()) });
2698
- /**
2699
- * Page delete result. Deleted PONs are retired (never recycled); surviving
2700
- * pages keep identity + revisions (see `PageDeleteResult`).
2701
- */
2702
- const PageDeleteResultSchema = z.object({
2703
- layout: PageListSnapshotSchema,
2704
- cache: PageStructureCacheSchema.nullable()
2705
- });
2706
- /**
2707
- * Page insert (bytes) input — the JSON `body` part of the multipart
2708
- * mutation envelope; the PDF itself rides the `resource:source` part.
2709
- * `destIndex` omitted → append.
2710
- */
2711
- const PageInsertInputSchema = z.object({ destIndex: z.number().int().nonnegative().optional() });
2712
- /**
2713
- * Blank-page insert input — plain JSON, pages.insert minus the bytes.
2714
- * `size` is in PDF points (un-rotated); `count` shares the contract cap
2715
- * with the worker so a request the schema accepts cannot then fail the
2716
- * worker's own guard.
2717
- */
2718
- const PageInsertBlankInputSchema = z.object({
2719
- size: z.object({
2720
- width: z.number().positive().finite(),
2721
- height: z.number().positive().finite()
2722
- }),
2723
- count: z.number().int().min(1).max(100).optional(),
2724
- destIndex: z.number().int().nonnegative().optional()
2725
- });
2726
- /** Page extract input: the pages to export, in the order they should appear. */
2727
- const PageExtractInputSchema = z.object({ pageObjectNumbers: z.array(z.number().int().positive()).min(1) });
2728
- /**
2729
- * Page insert result — shared by bytes-insert and blank-insert: the fresh
2730
- * PONs in insertion order plus the full new layout (see `PageInsertResult`).
2731
- */
2732
- const PageInsertResultSchema = z.object({
2733
- insertedPageObjectNumbers: z.array(z.number().int().positive()),
2734
- layout: PageListSnapshotSchema,
2735
- cache: PageStructureCacheSchema.nullable()
2736
- });
2737
- /**
2738
- * Metadata write result. The Info dict is rewritten in place, so the
2739
- * result returns the re-read `metadata` plus cloud coherence pins. No
2740
- * `layoutVersion` is touched — a metadata edit bumps only `docVersion`
2741
- * and `metadataVersion`. `cache` is `null` for local engines.
2742
- */
2743
- const AttachmentsCacheSchema = z.object({
2744
- previousDocVersion: z.number().int().nonnegative(),
2745
- docVersion: z.number().int().positive(),
2746
- attachmentsVersion: z.number().int().positive()
2747
- });
2748
- const AttachmentCreateResultSchema = z.object({
2749
- created: EmbeddedFileItemSchema,
2750
- cache: AttachmentsCacheSchema.nullable()
2751
- });
2752
- const AttachmentDeleteResultSchema = z.object({
2753
- deleted: EmbeddedFileRefSchema,
2754
- cache: AttachmentsCacheSchema.nullable()
2755
- });
2756
- const MetadataUpdateResultSchema = z.object({
2757
- metadata: DocumentMetadataSchema,
2758
- cache: z.object({
2759
- previousDocVersion: z.number().int().nonnegative(),
2760
- docVersion: z.number().int().positive(),
2761
- metadataVersion: z.number().int().positive()
2762
- }).nullable()
2763
- });
2764
- const WeakAnnotationSessionResponseSchema = z.object({
2765
- sessionId: z.string().min(1),
2766
- expiresAt: z.number().int().positive(),
2767
- heartbeatIntervalMs: z.number().int().positive(),
2768
- pageObjectNumbers: z.array(z.number().int().positive())
2769
- });
2770
- const WeakAnnotationSessionPagesRequestSchema = z.object({ pageObjectNumbers: z.array(z.number().int().positive()).transform((pages) => [...new Set(pages)]) });
2771
- const BASE64_ALPHABET = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
2772
- /** Standard base64 (padded). Dependency-free: no Buffer, runs in browsers too. */
2773
- function toBase64(bytes) {
2774
- let out = "";
2775
- for (let i = 0; i < bytes.length; i += 3) {
2776
- const b0 = bytes[i];
2777
- const b1 = bytes[i + 1];
2778
- const b2 = bytes[i + 2];
2779
- out += BASE64_ALPHABET[b0 >> 2];
2780
- out += BASE64_ALPHABET[(b0 & 3) << 4 | (b1 ?? 0) >> 4];
2781
- out += b1 === void 0 ? "=" : BASE64_ALPHABET[(b1 & 15) << 2 | (b2 ?? 0) >> 6];
2782
- out += b2 === void 0 ? "=" : BASE64_ALPHABET[b2 & 63];
2783
- }
2784
- return out;
2785
- }
2786
- function fromBase64(encoded) {
2787
- let end = encoded.length;
2788
- while (end > 0 && encoded[end - 1] === "=") end -= 1;
2789
- const clean = encoded.slice(0, end);
2790
- if (clean.length % 4 === 1 || /[^A-Za-z0-9+/]/.test(clean)) throw new Error("malformed base64");
2791
- const bytes = [];
2792
- let buffer = 0;
2793
- let bits = 0;
2794
- for (const ch of clean) {
2795
- buffer = buffer << 6 | BASE64_ALPHABET.indexOf(ch);
2796
- bits += 6;
2797
- if (bits >= 8) {
2798
- bits -= 8;
2799
- bytes.push(buffer >> bits & 255);
2800
- }
2801
- }
2802
- return Uint8Array.from(bytes);
2803
- }
2804
- const Base64Schema = z.string().regex(/^[A-Za-z0-9+/]*={0,2}$/, "base64");
2805
- const DocumentVersionRefSchema = z.object({
2806
- baseSha256: z.string().regex(/^[0-9a-f]{64}$/),
2807
- editsVersion: z.number().int().nonnegative()
2808
- });
2809
- const ByteRangeSchema = z.tuple([
2810
- z.number().int().nonnegative(),
2811
- z.number().int().nonnegative(),
2812
- z.number().int().nonnegative(),
2813
- z.number().int().nonnegative()
2814
- ]);
2815
- /** `SignaturePrepared` with the digest as base64. */
2816
- const SignaturePreparedWireSchema = z.object({
2817
- signingId: z.string().min(1),
2818
- digest: Base64Schema,
2819
- algorithm: z.enum([
2820
- "sha256",
2821
- "sha384",
2822
- "sha512"
2823
- ]),
2824
- byteRange: ByteRangeSchema,
2825
- contentsSize: z.number().int().positive(),
2826
- subFilter: z.string(),
2827
- expectedVersion: DocumentVersionRefSchema,
2828
- expiresAt: z.string().nullable()
2829
- });
2830
- function encodePrepared(prepared) {
2831
- return {
2832
- ...prepared,
2833
- digest: toBase64(prepared.digest)
2834
- };
2835
- }
2836
- function decodePrepared(wire) {
2837
- return {
2838
- ...wire,
2839
- digest: fromBase64(wire.digest),
2840
- subFilter: wire.subFilter
2841
- };
2842
- }
2843
- /** The JSON body of a completion: the CMS as base64 beside the fence. */
2844
- const SignatureCompleteBodySchema = z.object({
2845
- cms: Base64Schema.refine((v) => v.length > 0, "cms is required"),
2846
- expectedVersion: DocumentVersionRefSchema
2847
- });
2848
- const DocMdpPermissionSchema = z.union([
2849
- z.literal(1),
2850
- z.literal(2),
2851
- z.literal(3)
2852
- ]);
2853
- const ModificationLevelSchema = z.enum([
2854
- "none",
2855
- "lta",
2856
- "fill",
2857
- "annotate"
2858
- ]);
2859
- const DigestAlgorithmSchema = z.enum([
2860
- "sha1",
2861
- "sha256",
2862
- "sha384",
2863
- "sha512"
2864
- ]);
2865
- const FieldLockSpecSchema = z.object({
2866
- action: z.enum([
2867
- "all",
2868
- "include",
2869
- "exclude"
2870
- ]),
2871
- fields: z.array(z.string()),
2872
- permission: DocMdpPermissionSchema.optional()
2873
- });
2874
- const SignatureSeedValueSchema = z.object({
2875
- requiredFlags: z.number().int(),
2876
- presentFlags: z.number().int(),
2877
- version: z.number().int().nullable(),
2878
- mdp: z.union([
2879
- z.literal(0),
2880
- z.literal(1),
2881
- z.literal(2),
2882
- z.literal(3)
2883
- ]).nullable(),
2884
- filter: z.string().nullable(),
2885
- subFilters: z.array(z.string()),
2886
- digestMethods: z.array(z.string()),
2887
- reasons: z.array(z.string()),
2888
- unsupportedRequired: z.boolean()
2889
- });
2890
- const SignatureDTOSchema = z.object({
2891
- index: z.number().int().nonnegative(),
2892
- field: FormFieldRefSchema,
2893
- fieldName: z.string(),
2894
- widget: FormWidgetRefSchema.nullable(),
2895
- signed: z.boolean(),
2896
- kind: z.enum(["signature", "timestamp"]),
2897
- filter: z.string().nullable(),
2898
- subFilter: z.string().nullable(),
2899
- byteRange: ByteRangeSchema.nullable(),
2900
- contentsSize: z.number().int().nonnegative(),
2901
- coverage: z.enum([
2902
- "whole-revision",
2903
- "partial",
2904
- "malformed"
2905
- ]).nullable(),
2906
- revisionIndex: z.number().int().nonnegative().nullable(),
2907
- signer: z.object({
2908
- name: z.string().nullable(),
2909
- reason: z.string().nullable(),
2910
- location: z.string().nullable(),
2911
- contactInfo: z.string().nullable(),
2912
- claimedTime: z.string().nullable()
2913
- }),
2914
- docMdp: DocMdpPermissionSchema.nullable(),
2915
- catalogCertification: z.boolean(),
2916
- fieldMdp: FieldLockSpecSchema.nullable(),
2917
- lock: FieldLockSpecSchema.nullable(),
2918
- seedValue: SignatureSeedValueSchema.nullable()
2919
- });
2920
- const DocumentProtectionSchema = z.object({
2921
- enforced: ModificationLevelSchema.nullable(),
2922
- judged: ModificationLevelSchema.nullable(),
2923
- certification: z.object({
2924
- signatureIndex: z.number().int().nonnegative(),
2925
- permission: DocMdpPermissionSchema
2926
- }).nullable(),
2927
- fieldLocks: z.array(z.object({
2928
- signatureIndex: z.number().int().nonnegative(),
2929
- source: z.enum(["fieldmdp", "lock"]),
2930
- spec: FieldLockSpecSchema
2931
- })),
2932
- policyVersion: z.number().int()
2933
- });
2934
- const PdfRevisionSchema = z.object({
2935
- index: z.number().int().nonnegative(),
2936
- end: z.number().int().nonnegative(),
2937
- xrefOffset: z.number().int().nonnegative(),
2938
- signatureIndex: z.number().int().nonnegative().nullable()
2939
- });
2940
- const SignatureSnapshotSchema = z.object({
2941
- chainValid: z.boolean(),
2942
- revisions: z.array(PdfRevisionSchema),
2943
- signatures: z.array(SignatureDTOSchema),
2944
- protection: DocumentProtectionSchema
2945
- });
2946
- const BaseVersionInfoSchema = z.object({
2947
- sha256: z.string().regex(/^[0-9a-f]{64}$/),
2948
- byteLength: z.number().int().nonnegative()
2949
- });
2950
- const SignatureCompleteResultSchema = z.object({
2951
- status: z.enum(["completed", "already-completed"]),
2952
- signature: SignatureDTOSchema,
2953
- version: BaseVersionInfoSchema,
2954
- previous: DocumentVersionRefSchema,
2955
- protection: DocumentProtectionSchema,
2956
- meta: MutationMetaSchema
2957
- });
2958
- const SignatureAbortResultSchema = z.object({ status: z.enum([
2959
- "aborted",
2960
- "already-completed",
2961
- "unknown"
2962
- ]) });
2963
- const ChangeFindingSchema = z.object({
2964
- rule: z.string(),
2965
- verdict: z.enum([
2966
- "permitted",
2967
- "forbidden",
2968
- "incomplete"
2969
- ]),
2970
- objectNumber: z.number().int().nonnegative(),
2971
- edge: z.string().optional(),
2972
- detail: z.string().optional()
2973
- });
2974
- const AnalysisDetailSchema = z.enum(["summary", "full"]);
2975
- /** The analysis: one verdict (`current`) with its findings, the restrictions it was judged under, and facts about the revisions in between. */
2976
- const ChangeAnalysisSchema = z.object({
2977
- mode: z.enum(["authoritative", "exploratory"]),
2978
- policyVersion: z.number().int(),
2979
- basis: z.object({
2980
- version: BaseVersionInfoSchema,
2981
- editsVersion: z.number().int().nonnegative(),
2982
- source: z.enum(["persisted", "working-copy"])
2983
- }),
2984
- since: z.object({
2985
- revisionIndex: z.number().int().nonnegative(),
2986
- signatureIndex: z.number().int().nonnegative().nullable()
2987
- }),
2988
- until: z.object({ revisionIndex: z.number().int().nonnegative() }),
2989
- restrictions: z.array(z.object({
2990
- signatureIndex: z.number().int().nonnegative(),
2991
- revisionIndex: z.number().int().nonnegative(),
2992
- source: z.enum([
2993
- "docmdp",
2994
- "fieldmdp",
2995
- "lock"
2996
- ]),
2997
- own: z.boolean(),
2998
- permission: z.union([
2999
- z.literal(1),
3000
- z.literal(2),
3001
- z.literal(3)
3002
- ]).optional(),
3003
- fields: z.unknown().optional()
3004
- })),
3005
- current: z.object({
3006
- verdict: z.enum([
3007
- "unchanged",
3008
- "permitted",
3009
- "forbidden",
3010
- "indeterminate"
3011
- ]),
3012
- complete: z.boolean(),
3013
- primary: ChangeFindingSchema.optional(),
3014
- findings: z.array(ChangeFindingSchema),
3015
- method: z.enum(["net-state", "net-state+replay"])
3016
- }),
3017
- later: z.object({
3018
- revisionCount: z.number().int().nonnegative(),
3019
- undoneObjectNumbers: z.array(z.number().int().nonnegative())
3020
- }),
3021
- /** Equals `current.verdict`. */
3022
- verdict: z.enum([
3023
- "unchanged",
3024
- "permitted",
3025
- "forbidden",
3026
- "indeterminate"
3027
- ]),
3028
- /** The step DTOs are large and evolving; carried verbatim. */
3029
- steps: z.array(z.unknown())
3030
- });
3031
- const SignatureAttributionSchema = z.object({
3032
- name: z.string().optional(),
3033
- reason: z.string().optional(),
3034
- location: z.string().optional(),
3035
- contactInfo: z.string().optional()
3036
- });
3037
- /** The JSON part of a visual signature fill (multipart envelope): which resource part holds the PDF, and its page. */
3038
- const SignatureAppearanceBodySchema = z.object({
3039
- resource: z.string().min(1),
3040
- pageIndex: z.number().int().nonnegative().optional()
3041
- });
3042
- /**
3043
- * The JSON part of a prepare (multipart envelope): `SignaturePrepareInput`
3044
- * with the appearance artwork referenced by its resource part instead of
3045
- * inline bytes.
3046
- */
3047
- const SignaturePrepareBodySchema = z.object({
3048
- field: FormFieldRefSchema,
3049
- kind: z.enum(["signature", "timestamp"]).optional(),
3050
- subFilter: z.enum(["adbe.pkcs7.detached", "ETSI.CAdES.detached"]).optional(),
3051
- digest: z.enum([
3052
- "sha256",
3053
- "sha384",
3054
- "sha512"
3055
- ]).optional(),
3056
- contentsSize: z.number().int().positive().optional(),
3057
- attribution: SignatureAttributionSchema.optional(),
3058
- /** @deprecated the pre-rename spelling of `attribution`; servers read either. */
3059
- signer: SignatureAttributionSchema.optional(),
3060
- signingTime: z.string().optional(),
3061
- certify: z.object({ permission: DocMdpPermissionSchema }).optional(),
3062
- lock: FieldLockSpecSchema.optional(),
3063
- appearance: z.object({
3064
- resource: z.string().min(1),
3065
- pageIndex: z.number().int().nonnegative().optional()
3066
- }).optional()
3067
- });
3068
- const optionalIndex = z.coerce.number().int().nonnegative().optional();
3069
- /** Layer analysis query (the current form): exactly one `since.*`; the working copy is the end. */
3070
- const LayerAnalysisQuerySchema = z.object({
3071
- "since.signature": optionalIndex,
3072
- "since.revision": optionalIndex,
3073
- level: ModificationLevelSchema.optional(),
3074
- detail: AnalysisDetailSchema.optional()
3075
- }).refine((q) => q["since.signature"] === void 0 !== (q["since.revision"] === void 0), { message: "exactly one of since.signature / since.revision is required" });
3076
- /** Version analysis query: as the layer's, plus `until` (a revision index; default the last). */
3077
- const VersionAnalysisQuerySchema = z.object({
3078
- "since.signature": optionalIndex,
3079
- "since.revision": optionalIndex,
3080
- until: optionalIndex,
3081
- level: ModificationLevelSchema.optional(),
3082
- detail: AnalysisDetailSchema.optional(),
3083
- /** The judging policy version the caller expects — a cache key, not an input (version responses are immutable). */
3084
- policy: optionalIndex
3085
- }).refine((q) => q["since.signature"] === void 0 !== (q["since.revision"] === void 0), { message: "exactly one of since.signature / since.revision is required" });
3086
- function analyzeInputFromQuery(query, until) {
3087
- return {
3088
- since: query["since.signature"] !== void 0 ? { signatureIndex: query["since.signature"] } : { revisionIndex: query["since.revision"] ?? 0 },
3089
- ...until !== void 0 ? { until } : {},
3090
- ...query.level !== void 0 ? { exploratoryLevel: query.level } : {},
3091
- ...query.detail !== void 0 ? { detail: query.detail } : {}
3092
- };
3093
- }
3094
- /** One row of the document's version catalog. */
3095
- const DocumentVersionSchema = z.object({
3096
- sha256: z.string().regex(/^[0-9a-f]{64}$/),
3097
- byteLength: z.number().int().nonnegative(),
3098
- number: z.number().int().positive(),
3099
- parentSha256: z.string().nullable(),
3100
- producer: z.enum(["upload", "signature"]),
3101
- signingId: z.string().nullable(),
3102
- createdAt: z.number().int()
3103
- });
3104
- const DocumentVersionsSchema = z.object({
3105
- /** `documents.base_sha`: the version every layer is over, or behind. */
3106
- head: z.string().regex(/^[0-9a-f]{64}$/),
3107
- /** Oldest first. */
3108
- versions: z.array(DocumentVersionSchema)
3109
- });
3110
- //#endregion
3111
- export { PageBoxesSchema as $, LineDTOSchema as $n, PdfAnnotationActionsSchema as $r, FormFieldDTOSchema as $t, DocumentVersionRefSchema as A, StrikeoutDraftSchema as An, AnnotationPatchBaseShape as Ar, SearchModeSchema as At, FormImportResultSchema as B, SquareDraftSchema as Bn, PdfRectDifferencesSchema as Br, SignaturePrepareBodySchema as Bt, ChangeAnalysisSchema as C, UnderlineDraftSchema as Cn, CaretDraftSchema as Cr, PageTextSnapshotSchema as Ct, DocumentMetadataSchema as D, TextDraftSchema as Dn, AnnotationDraftBaseShape as Dr, RedactionApplyScopeSchema as Dt, DocumentManifestSchema as E, TextDTOSchema as En, AnnotationBorderStyleSchema as Er, RedactionApplyResultSchema as Et, FormEffectSchema as F, StampWirePatchSchema as Fn, ColorSchema as Fr, SignatureAbortResultSchema as Ft, LayerScopesSchema as G, PolygonDTOSchema as Gn, StrikeoutIntentSchema as Gr, WeakAnnotationSessionPagesRequestSchema as Gt, FormSetValueResultSchema as H, PolylineDTOSchema as Hn, RectSchema as Hr, SignatureSeedValueSchema as Ht, FormEffectsResultSchema as I, SquigglyDTOSchema as In, FreeTextIntentSchema as Ir, SignatureAppearanceBodySchema as It, MetadataUpdateResultSchema as J, LinkDTOSchema as Jn, PdfActionNodeSchema as Jr, decodePrepared as Jt, ManifestPageSchema as K, PolygonDraftSchema as Kn, TextAlignmentSchema as Kr, WeakAnnotationSessionResponseSchema as Kt, FormFieldCreateResultSchema as L, SquigglyDraftSchema as Ln, InkIntentSchema as Lr, SignatureCompleteBodySchema as Lt, DocumentVersionsSchema as M, ResourceRefSchema as Mn, AnnotationStableIdSchema as Mr, SearchRequestSchema as Mt, EngineErrorPayloadSchema as N, StampDTOSchema as Nn, BlendModeSchema as Nr, SearchSliceSchema as Nt, DocumentProtectionSchema as O, TextPatchSchema as On, AnnotationFlagsPartialSchema as Or, RefetchReasonSchema as Ot, FieldLockSpecSchema as P, StampWireDraftSchema as Pn, CaretIntentSchema as Pr, SearchSnippetSchema as Pt, OpenDocumentResponseSchema as Q, PdfLinkTargetWritableSchema as Qn, PdfActionWireComponents as Qr, FormDataFormatSchema as Qt, FormFieldDeleteResultSchema as R, SquigglyPatchSchema as Rn, LineEndingSchema as Rr, SignatureCompleteResultSchema as Rt, CachePinsSchema as S, UnderlineDTOSchema as Sn, CaretDTOSchema as Sr, PageStructureCacheSchema as St, DocumentHeadSchema as T, NoteIconSchema as Tn, AnnotationBaseShape as Tr, PdfSaveModeSchema as Tt, FormWidgetLinkResultSchema as U, PolylineDraftSchema as Un, RevisionTokenSchema as Ur, SignatureSnapshotSchema as Ut, FormRepairResultSchema as V, SquarePatchSchema as Vn, PointSchema as Vr, SignaturePreparedWireSchema as Vt, LayerAnalysisQuerySchema as W, PolylinePatchSchema as Wn, StandardFontSchema as Wr, VersionAnalysisQuerySchema as Wt, MutationMetaSchema as X, LinkPatchSchema as Xn, PdfActionTreeSchema as Xr, fromBase64 as Xt, ModificationLevelSchema as Y, LinkDraftSchema as Yn, PdfActionTargetRefSchema as Yr, encodePrepared as Yt, NamedPageEntrySchema as Z, PdfLinkTargetSchema as Zn, PdfActionTypeSchema as Zr, toBase64 as Zt, AttachmentDeleteResultSchema as _, KIND_BY_SUBTYPE as _n, EmbeddedFileItemSchema as _r, PageRenderAnnotatedQuerySchema as _t, AnnotationAppearancesQuerySchema as a, LinePointsSchema as ai, FormFieldRefSchema as an, HighlightDTOSchema as ar, PageGeometrySnapshotSchema as at, ByteRangeSchema as b, UnsupportedDraftSchema as bn, CircleDraftSchema as br, PageRotateResultSchema as bt, AnnotationFlattenInputSchema as c, PdfRectSchema as ci, FormSnapshotSchema as cn, FreeTextDTOSchema as cr, PageInsertResultSchema as ct, AnnotationListPageSnapshotSchema as d, ToggleFieldWidgetSchema as dn, FileAttachmentDTOSchema as dr, PageMoveInputSchema as dt, PdfFieldActionsSchema as ei, FormFieldDraftSchema as en, LineDraftSchema as er, PageDeleteInputSchema as et, AnnotationListSnapshotAllPagesSchema as f, WidgetPlacementSchema as fn, FileAttachmentIconSchema as fr, PageMoveResultSchema as ft, AttachmentCreateResultSchema as g, AnnotationPatchSchema as gn, AttachmentFileInfoSchema as gr, PageRemoveNameInputSchema as gt, AppearanceOutcomeSchema as h, AnnotationDraftSchema as hn, WireAttachmentFileSchema as hr, PageNetworkRenderFormatSchema as ht, AnnotationAppearanceManifestSchema as i, InkListSchema as ii, FormFieldPatchSchema as in, InkPatchSchema as ir, PageFlattenResultSchema as it, DocumentVersionSchema as j, StrikeoutPatchSchema as jn, AnnotationRefSchema as jr, SearchQuerySchema as jt, DocumentSecurityStateSchema as k, StrikeoutDTOSchema as kn, AnnotationFlagsSchema as kr, SearchMatchSchema as kt, AnnotationFlattenResultSchema as l, PdfRotationSchema as li, FormValueEntrySchema as ln, FreeTextDraftSchema as lr, PageLayoutSchema as lt, AnnotationUpdateResultSchema as m, AnnotationDTOSchema as mn, FileAttachmentWireDraftSchema as mr, PageNameResultSchema as mt, AccessResponseSchema as n, PdfDestinationSchema as ni, FormFieldOptionInputSchema as nn, InkDTOSchema as nr, PageExtractInputSchema as nt, AnnotationCreateResultSchema as o, PdfPointSchema as oi, FormFieldValueSchema as on, HighlightDraftSchema as or, PageInsertBlankInputSchema as ot, AnnotationMoveResultSchema as p, ANNOTATION_KINDS as pn, FileAttachmentPatchSchema as pr, PageNameInputSchema as pt, MetadataPatchSchema as q, PolygonPatchSchema as qn, DocumentActionsSnapshotSchema as qr, analyzeInputFromQuery as qt, AnnotationAppearanceExportInputSchema as r, CalloutLineSchema as ri, FormFieldOptionSchema as rn, InkDraftSchema as rr, PageFlattenInputSchema as rt, AnnotationDeleteResultSchema as s, PdfQuadSchema as si, FormKindSchema as sn, HighlightPatchSchema as sr, PageInsertInputSchema as st, AccessRequestSchema as t, PdfPageActionsSchema as ti, FormFieldFlagsSchema as tn, LinePatchSchema as tr, PageDeleteResultSchema as tt, AnnotationListMutationMetaSchema as u, PdfSizeSchema as ui, FormWidgetRefSchema as un, FreeTextPatchSchema as ur, PageListSnapshotSchema as ut, AttachmentsCacheSchema as v, WidgetAppearanceSchema as vn, EmbeddedFileRefSchema as vr, PageRenderQuerySchema as vt, DigestAlgorithmSchema as w, UnderlinePatchSchema as wn, CaretPatchSchema as wr, PdfRevisionSchema as wt, CacheDeltaSchema as x, UnsupportedPatchSchema as xn, CirclePatchSchema as xr, PageStateSchema as xt, BaseVersionInfoSchema as y, UnsupportedDTOSchema as yn, CircleDTOSchema as yr, PageRotateInputSchema as yt, FormFieldUpdateResultSchema as z, SquareDTOSchema as zn, LineEndingsSchema as zr, SignatureDTOSchema as zt };
3112
-
3113
- //# sourceMappingURL=schemas-BLARNCgx.js.map