@embedpdf/engine-core 3.0.0-next.14 → 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 (134) 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-Ca6EK3-3.d.ts → DocumentSecurityService-CU1M6Q7m.d.ts} +100 -112
  12. package/dist/{DocumentSecurityService-CIx1MT0T.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/{viewport-BWeNHZmb.cjs → authority-DLMNR7ff.cjs} +820 -1647
  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 +16466 -5247
  40. package/dist/conformance.cjs.map +1 -1
  41. package/dist/conformance.d.cts +924 -165
  42. package/dist/conformance.d.ts +924 -165
  43. package/dist/conformance.js +16429 -5252
  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 +323 -116
  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 +726 -297
  72. package/dist/runtime.cjs.map +1 -1
  73. package/dist/runtime.d.cts +5 -1372
  74. package/dist/runtime.d.ts +5 -1372
  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 +1051 -397
  104. package/dist/wire.cjs.map +1 -1
  105. package/dist/wire.d.cts +12403 -790
  106. package/dist/wire.d.ts +12403 -790
  107. package/dist/wire.js +821 -242
  108. package/dist/wire.js.map +1 -1
  109. package/package.json +10 -1
  110. package/dist/AbortError-DwuHPK_I.js +0 -27
  111. package/dist/AbortError-DwuHPK_I.js.map +0 -1
  112. package/dist/AbortError-P0RU0Mgg.cjs +0 -38
  113. package/dist/AbortError-P0RU0Mgg.cjs.map +0 -1
  114. package/dist/AnnotationListSnapshot-D9R5n2Kf.d.cts +0 -7101
  115. package/dist/AnnotationListSnapshot-D9R5n2Kf.d.ts +0 -7101
  116. package/dist/Engine-EWWHhEIi.d.ts +0 -1277
  117. package/dist/Engine-FNaAEjfb.d.cts +0 -1277
  118. package/dist/derive-BbsDk_Kz.cjs +0 -880
  119. package/dist/derive-BbsDk_Kz.cjs.map +0 -1
  120. package/dist/derive-DAFJolWu.js +0 -647
  121. package/dist/derive-DAFJolWu.js.map +0 -1
  122. package/dist/format-Bbphf4zR.js +0 -435
  123. package/dist/format-Bbphf4zR.js.map +0 -1
  124. package/dist/format-D_epWlob.cjs +0 -518
  125. package/dist/format-D_epWlob.cjs.map +0 -1
  126. package/dist/resolver-CYVNV4hn.cjs.map +0 -1
  127. package/dist/resolver-inAVzsWt.js.map +0 -1
  128. package/dist/schemas-CFQGvWiu.js +0 -3243
  129. package/dist/schemas-CFQGvWiu.js.map +0 -1
  130. package/dist/schemas-D0g6tKa9.cjs +0 -4694
  131. package/dist/schemas-D0g6tKa9.cjs.map +0 -1
  132. package/dist/viewport-BWeNHZmb.cjs.map +0 -1
  133. package/dist/viewport-CvMcadfQ.js +0 -3072
  134. package/dist/viewport-CvMcadfQ.js.map +0 -1
@@ -0,0 +1,3034 @@
1
+ const require_format = require("./format-Bp3QFSH1.cjs");
2
+ const require_subtype = require("./subtype-aDt5TFmK.cjs");
3
+ let zod = require("zod");
4
+ //#region src/identity/PageRef.schema.ts
5
+ /** Wire form of `PageRef` — see the type. */
6
+ const PageRefSchema = zod.z.object({
7
+ kind: zod.z.literal("objectNumber"),
8
+ objectNumber: zod.z.number().int().positive()
9
+ });
10
+ //#endregion
11
+ //#region src/geometry/schemas.ts
12
+ /**
13
+ * Zod schemas for engine PDF-document geometry. Exported from `wire.ts` only
14
+ * (never from `shared.ts`/`runtime`) so the zod-free runtime stays zod-free.
15
+ */
16
+ const PdfPointSchema = zod.z.object({
17
+ x: zod.z.number(),
18
+ y: zod.z.number()
19
+ });
20
+ const LinePointsSchema = zod.z.object({
21
+ start: PdfPointSchema,
22
+ end: PdfPointSchema
23
+ });
24
+ /** `/CL` callout leader line — two points (straight) or three (knee-jointed). */
25
+ const CalloutLineSchema = zod.z.union([zod.z.tuple([PdfPointSchema, PdfPointSchema]), zod.z.tuple([
26
+ PdfPointSchema,
27
+ PdfPointSchema,
28
+ PdfPointSchema
29
+ ])]);
30
+ /** `/InkList` — an array of strokes, each an array of points. */
31
+ const InkListSchema = zod.z.array(zod.z.array(PdfPointSchema));
32
+ /** A rect's edges are finite, as `isFinitePdfRect` checks them on the page. */
33
+ const PdfRectSchema = zod.z.object({
34
+ left: zod.z.number().finite(),
35
+ bottom: zod.z.number().finite(),
36
+ right: zod.z.number().finite(),
37
+ top: zod.z.number().finite()
38
+ });
39
+ const PdfSizeSchema = zod.z.object({
40
+ width: zod.z.number().nonnegative(),
41
+ height: zod.z.number().nonnegative()
42
+ });
43
+ const PdfQuadSchema = zod.z.object({
44
+ upperLeft: PdfPointSchema,
45
+ upperRight: PdfPointSchema,
46
+ lowerLeft: PdfPointSchema,
47
+ lowerRight: PdfPointSchema
48
+ });
49
+ const PdfRotationSchema = zod.z.union([
50
+ zod.z.literal(0),
51
+ zod.z.literal(90),
52
+ zod.z.literal(180),
53
+ zod.z.literal(270)
54
+ ]);
55
+ const PagePointSchema = zod.z.object({
56
+ x: zod.z.number(),
57
+ y: zod.z.number()
58
+ });
59
+ /** A box is finite, as a rect is (`PdfRectSchema`). */
60
+ const PageBoxSchema = zod.z.object({
61
+ x: zod.z.number().finite(),
62
+ y: zod.z.number().finite(),
63
+ width: zod.z.number().finite().nonnegative(),
64
+ height: zod.z.number().finite().nonnegative()
65
+ });
66
+ const PageQuadSchema = zod.z.object({
67
+ upperLeft: PagePointSchema,
68
+ upperRight: PagePointSchema,
69
+ lowerLeft: PagePointSchema,
70
+ lowerRight: PagePointSchema
71
+ });
72
+ //#endregion
73
+ //#region src/annotation/base.schema.ts
74
+ /** @deprecated Use `PdfPointSchema` from `../geometry/schemas`. */
75
+ const PointSchema = PdfPointSchema;
76
+ /** @deprecated Use `PdfRectSchema` from `../geometry/schemas`. */
77
+ const RectSchema = PdfRectSchema;
78
+ const ColorSchema = zod.z.string().regex(/^#[0-9a-fA-F]{6}$/, "expected a color as '#rrggbb'");
79
+ const AnnotationBorderStyleSchema = zod.z.enum([
80
+ "solid",
81
+ "dashed",
82
+ "beveled",
83
+ "inset"
84
+ ]);
85
+ const WidgetBorderStyleSchema = zod.z.enum([
86
+ "solid",
87
+ "dashed",
88
+ "beveled",
89
+ "inset",
90
+ "underline"
91
+ ]);
92
+ const WidgetCheckStyleSchema = zod.z.enum([
93
+ "check",
94
+ "cross",
95
+ "star",
96
+ "circle",
97
+ "square",
98
+ "diamond"
99
+ ]);
100
+ /** What a write takes for a border that isn't a widget's. */
101
+ const DrawnBorderStyleSchema = zod.z.enum(["solid", "dashed"]);
102
+ const LineEndingSchema = zod.z.enum([
103
+ "none",
104
+ "square",
105
+ "circle",
106
+ "diamond",
107
+ "open-arrow",
108
+ "closed-arrow",
109
+ "butt",
110
+ "r-open-arrow",
111
+ "r-closed-arrow",
112
+ "slash"
113
+ ]);
114
+ const LineEndingsSchema = zod.z.object({
115
+ start: LineEndingSchema,
116
+ end: LineEndingSchema
117
+ });
118
+ const StandardFontSchema = zod.z.enum(require_format.STANDARD_FONTS);
119
+ const TextAlignmentSchema = zod.z.enum([
120
+ "left",
121
+ "center",
122
+ "right"
123
+ ]);
124
+ const FreeTextIntentSchema = zod.z.enum([
125
+ "free-text",
126
+ "free-text-callout",
127
+ "free-text-typewriter"
128
+ ]);
129
+ /** The intents a write makes: a typewriter is only sent back as read. */
130
+ const FreeTextIntentWriteSchema = zod.z.enum(["free-text", "free-text-callout"]);
131
+ const VerticalAlignmentSchema = zod.z.enum([
132
+ "top",
133
+ "middle",
134
+ "bottom"
135
+ ]);
136
+ const CaretIntentSchema = zod.z.literal("replace");
137
+ const StrikeoutIntentSchema = zod.z.literal("strikeout-text-edit");
138
+ const InkIntentSchema = zod.z.literal("ink-highlight");
139
+ const BlendModeSchema = zod.z.enum([
140
+ "normal",
141
+ "multiply",
142
+ "screen",
143
+ "overlay",
144
+ "darken",
145
+ "lighten",
146
+ "color-dodge",
147
+ "color-burn",
148
+ "hard-light",
149
+ "soft-light",
150
+ "difference",
151
+ "exclusion",
152
+ "hue",
153
+ "saturation",
154
+ "color",
155
+ "luminosity"
156
+ ]);
157
+ const AnnotationRefSchema = zod.z.discriminatedUnion("kind", [zod.z.object({
158
+ kind: zod.z.literal("objectNumber"),
159
+ page: PageRefSchema,
160
+ objectNumber: zod.z.number().int().positive()
161
+ }), zod.z.object({
162
+ kind: zod.z.literal("baseIndex"),
163
+ page: PageRefSchema,
164
+ baseIndex: zod.z.number().int().nonnegative()
165
+ })]);
166
+ //#endregion
167
+ //#region src/dto/PdfDestination.schema.ts
168
+ const page = PageRefSchema;
169
+ /** Spec-nullable axis value: absent and `null` both mean "retain current". */
170
+ const axis = zod.z.number().nullable().optional();
171
+ /**
172
+ * Runtime schema for {@link PdfDestination}. Lives beside its DTO in `dto/`
173
+ * so every destination-shaped surface (link targets, action-node payloads,
174
+ * the document `openDestination`) shares one schema without an import cycle
175
+ * through the annotation tree.
176
+ */
177
+ const PdfDestinationSchema = zod.z.discriminatedUnion("kind", [
178
+ zod.z.object({
179
+ kind: zod.z.literal("xyz"),
180
+ page,
181
+ left: axis,
182
+ top: axis,
183
+ zoom: axis
184
+ }),
185
+ zod.z.object({
186
+ kind: zod.z.literal("fit"),
187
+ page
188
+ }),
189
+ zod.z.object({
190
+ kind: zod.z.literal("fitH"),
191
+ page,
192
+ top: axis
193
+ }),
194
+ zod.z.object({
195
+ kind: zod.z.literal("fitV"),
196
+ page,
197
+ left: axis
198
+ }),
199
+ zod.z.object({
200
+ kind: zod.z.literal("fitR"),
201
+ page,
202
+ left: zod.z.number(),
203
+ bottom: zod.z.number(),
204
+ right: zod.z.number(),
205
+ top: zod.z.number()
206
+ }),
207
+ zod.z.object({
208
+ kind: zod.z.literal("fitB"),
209
+ page
210
+ }),
211
+ zod.z.object({
212
+ kind: zod.z.literal("fitBH"),
213
+ page,
214
+ top: axis
215
+ }),
216
+ zod.z.object({
217
+ kind: zod.z.literal("fitBV"),
218
+ page,
219
+ left: axis
220
+ })
221
+ ]);
222
+ /** A destination in page space: measured from the top-left of its page's visible box. */
223
+ const PageDestinationSchema = zod.z.discriminatedUnion("kind", [
224
+ zod.z.object({
225
+ kind: zod.z.literal("xyz"),
226
+ page,
227
+ x: axis,
228
+ y: axis,
229
+ zoom: axis
230
+ }),
231
+ zod.z.object({
232
+ kind: zod.z.literal("fit"),
233
+ page
234
+ }),
235
+ zod.z.object({
236
+ kind: zod.z.literal("fitH"),
237
+ page,
238
+ y: axis
239
+ }),
240
+ zod.z.object({
241
+ kind: zod.z.literal("fitV"),
242
+ page,
243
+ x: axis
244
+ }),
245
+ zod.z.object({
246
+ kind: zod.z.literal("fitR"),
247
+ page,
248
+ x: zod.z.number(),
249
+ y: zod.z.number(),
250
+ width: zod.z.number().nonnegative(),
251
+ height: zod.z.number().nonnegative()
252
+ }),
253
+ zod.z.object({
254
+ kind: zod.z.literal("fitB"),
255
+ page
256
+ }),
257
+ zod.z.object({
258
+ kind: zod.z.literal("fitBH"),
259
+ page,
260
+ y: axis
261
+ }),
262
+ zod.z.object({
263
+ kind: zod.z.literal("fitBV"),
264
+ page,
265
+ x: axis
266
+ })
267
+ ]);
268
+ //#endregion
269
+ //#region src/annotation/kinds/link/values.ts
270
+ /** A link target's two schemas, a read and a write, for destinations of one kind. */
271
+ function linkTargetSchemasFor(destination) {
272
+ const goto = zod.z.object({
273
+ kind: zod.z.literal("goto"),
274
+ destination
275
+ });
276
+ const uri = zod.z.object({
277
+ kind: zod.z.literal("uri"),
278
+ uri: zod.z.string()
279
+ });
280
+ const read = zod.z.discriminatedUnion("kind", [
281
+ goto,
282
+ uri,
283
+ zod.z.object({
284
+ kind: zod.z.literal("goto-remote"),
285
+ file: zod.z.string()
286
+ }),
287
+ zod.z.object({
288
+ kind: zod.z.literal("launch"),
289
+ path: zod.z.string()
290
+ }),
291
+ zod.z.object({ kind: zod.z.literal("javascript") }),
292
+ zod.z.object({
293
+ kind: zod.z.literal("named"),
294
+ name: zod.z.string()
295
+ }),
296
+ zod.z.object({ kind: zod.z.literal("unsupported") })
297
+ ]);
298
+ /** Drafts and patches author `goto`, `uri` and the standard named verbs; see {@link PdfLinkTargetWritable}. */
299
+ const named = zod.z.object({
300
+ kind: zod.z.literal("named"),
301
+ name: zod.z.enum([
302
+ "NextPage",
303
+ "PrevPage",
304
+ "FirstPage",
305
+ "LastPage"
306
+ ])
307
+ });
308
+ return {
309
+ read,
310
+ write: zod.z.discriminatedUnion("kind", [
311
+ goto,
312
+ uri,
313
+ named
314
+ ])
315
+ };
316
+ }
317
+ const PAGE_SPACE$1 = linkTargetSchemasFor(PageDestinationSchema);
318
+ const FILE_SPACE = linkTargetSchemasFor(PdfDestinationSchema);
319
+ /** A link's target: a destination in page space. */
320
+ const PdfLinkTargetSchema = PAGE_SPACE$1.read;
321
+ /** What a create or an update may set as a link's target. */
322
+ const PdfLinkTargetWritableSchema = PAGE_SPACE$1.write;
323
+ /** A link's target as the engine reads the file: a destination in the file's coordinates. */
324
+ const FileLinkTargetSchema = FILE_SPACE.read;
325
+ const FileLinkTargetWritableSchema = FILE_SPACE.write;
326
+ //#endregion
327
+ //#region src/dto/PdfAction.schema.ts
328
+ const PdfActionTargetRefSchema = zod.z.discriminatedUnion("kind", [zod.z.object({
329
+ kind: zod.z.literal("name"),
330
+ name: zod.z.string()
331
+ }), zod.z.object({
332
+ kind: zod.z.literal("objectNumber"),
333
+ objectNumber: zod.z.number().int().positive()
334
+ })]);
335
+ const SubmitFormFlagsSchema = zod.z.object({
336
+ raw: zod.z.number().int().nonnegative(),
337
+ exclude: zod.z.boolean(),
338
+ includeNoValueFields: zod.z.boolean(),
339
+ format: zod.z.enum([
340
+ "fdf",
341
+ "html",
342
+ "xfdf",
343
+ "pdf"
344
+ ]),
345
+ method: zod.z.enum(["post", "get"]),
346
+ submitCoordinates: zod.z.boolean(),
347
+ includeAppendSaves: zod.z.boolean(),
348
+ includeAnnotations: zod.z.boolean(),
349
+ canonicalFormat: zod.z.boolean(),
350
+ exclNonUserAnnots: zod.z.boolean(),
351
+ exclFKey: zod.z.boolean(),
352
+ embedForm: zod.z.boolean()
353
+ });
354
+ /**
355
+ * The action schemas for one kind of destination: in the file's coordinates
356
+ * or in page space. Everything but a `goto`'s destination is the same.
357
+ */
358
+ function actionSchemasFor(destination) {
359
+ /** Fields every node arm repeats — zod 3's discriminatedUnion needs plain
360
+ * object options, so the recursion (`next`) lives inline per arm and the
361
+ * whole union sits behind one `z.lazy`. */
362
+ const nodeCommon = {
363
+ subtype: zod.z.string(),
364
+ next: zod.z.array(zod.z.lazy(() => node))
365
+ };
366
+ const arm = (type, shape = {}) => zod.z.object({
367
+ type: zod.z.literal(type),
368
+ ...nodeCommon,
369
+ ...shape
370
+ });
371
+ const arms = [
372
+ arm("javascript", { script: zod.z.string() }),
373
+ arm("goto", { destination }),
374
+ arm("uri", {
375
+ uri: zod.z.string(),
376
+ isMap: zod.z.boolean()
377
+ }),
378
+ arm("named", { name: zod.z.string() }),
379
+ arm("hide", {
380
+ targets: zod.z.array(PdfActionTargetRefSchema),
381
+ hide: zod.z.boolean()
382
+ }),
383
+ arm("reset-form", {
384
+ fields: zod.z.array(PdfActionTargetRefSchema).nullable(),
385
+ exclude: zod.z.boolean()
386
+ }),
387
+ arm("goto-remote", { filePath: zod.z.string() }),
388
+ arm("goto-embedded", { filePath: zod.z.string() }),
389
+ arm("launch", { filePath: zod.z.string() }),
390
+ arm("rendition", { script: zod.z.string().optional() }),
391
+ arm("submit-form", { payload: zod.z.object({
392
+ url: zod.z.string(),
393
+ fields: zod.z.array(PdfActionTargetRefSchema).nullable(),
394
+ flags: SubmitFormFlagsSchema,
395
+ charSet: zod.z.string().optional()
396
+ }).optional() }),
397
+ arm("thread"),
398
+ arm("sound"),
399
+ arm("movie"),
400
+ arm("import-data"),
401
+ arm("set-ocg-state"),
402
+ arm("transition"),
403
+ arm("goto-3d-view"),
404
+ arm("unknown")
405
+ ];
406
+ const node = zod.z.lazy(() => zod.z.discriminatedUnion("type", [...arms]));
407
+ const tree = zod.z.object({
408
+ root: node.nullable(),
409
+ incomplete: zod.z.boolean(),
410
+ warningFlags: zod.z.number().int().nonnegative(),
411
+ warnings: zod.z.array(zod.z.enum([
412
+ "cycle-dropped",
413
+ "malformed-next",
414
+ "incomplete",
415
+ "payload-dropped"
416
+ ]))
417
+ });
418
+ return {
419
+ arms,
420
+ node,
421
+ tree,
422
+ fieldActions: zod.z.object({
423
+ keystroke: tree.optional(),
424
+ format: tree.optional(),
425
+ validate: tree.optional(),
426
+ calculate: tree.optional()
427
+ }),
428
+ pageActions: zod.z.object({
429
+ open: tree.optional(),
430
+ close: tree.optional()
431
+ }),
432
+ annotationActions: zod.z.object({
433
+ activate: tree.optional(),
434
+ cursorEnter: tree.optional(),
435
+ cursorExit: tree.optional(),
436
+ mouseDown: tree.optional(),
437
+ mouseUp: tree.optional(),
438
+ focus: tree.optional(),
439
+ blur: tree.optional(),
440
+ pageOpen: tree.optional(),
441
+ pageClose: tree.optional(),
442
+ pageVisible: tree.optional(),
443
+ pageInvisible: tree.optional()
444
+ }),
445
+ documentActions: zod.z.object({
446
+ nameTreeScripts: zod.z.array(zod.z.object({
447
+ name: zod.z.string(),
448
+ action: tree
449
+ })),
450
+ openAction: tree.nullable(),
451
+ openDestination: destination.nullable().default(null),
452
+ willClose: tree.optional(),
453
+ willSave: tree.optional(),
454
+ didSave: tree.optional(),
455
+ willPrint: tree.optional(),
456
+ didPrint: tree.optional()
457
+ }).superRefine((snapshot, context) => {
458
+ if (snapshot.openAction !== null && (snapshot.openDestination ?? null) !== null) context.addIssue({
459
+ code: zod.z.ZodIssueCode.custom,
460
+ message: "openAction and openDestination are mutually exclusive",
461
+ path: ["openDestination"]
462
+ });
463
+ })
464
+ };
465
+ }
466
+ const PAGE_SPACE = actionSchemasFor(PageDestinationSchema);
467
+ const PDF_SPACE = actionSchemasFor(PdfDestinationSchema);
468
+ /**
469
+ * The write schemas for one kind of destination: an action a write makes,
470
+ * and a widget's actions patch.
471
+ */
472
+ function actionWriteSchemasFor(destination) {
473
+ const next = () => ({ next: zod.z.array(zod.z.lazy(() => node)).optional() });
474
+ const arms = [
475
+ zod.z.object({
476
+ type: zod.z.literal("javascript"),
477
+ script: zod.z.string(),
478
+ ...next()
479
+ }),
480
+ zod.z.object({
481
+ type: zod.z.literal("goto"),
482
+ destination,
483
+ ...next()
484
+ }),
485
+ zod.z.object({
486
+ type: zod.z.literal("uri"),
487
+ uri: zod.z.string().min(1),
488
+ ...next()
489
+ }),
490
+ zod.z.object({
491
+ type: zod.z.literal("named"),
492
+ name: zod.z.string().min(1),
493
+ ...next()
494
+ }),
495
+ zod.z.object({
496
+ type: zod.z.literal("hide"),
497
+ targets: zod.z.array(PdfActionTargetRefSchema).min(1),
498
+ hide: zod.z.boolean(),
499
+ ...next()
500
+ }),
501
+ zod.z.object({
502
+ type: zod.z.literal("reset-form"),
503
+ fields: zod.z.array(PdfActionTargetRefSchema).nullable(),
504
+ exclude: zod.z.boolean(),
505
+ ...next()
506
+ }),
507
+ zod.z.object({
508
+ type: zod.z.literal("submit-form"),
509
+ url: zod.z.string().min(1),
510
+ fields: zod.z.array(PdfActionTargetRefSchema).nullable(),
511
+ flags: zod.z.number().int().nonnegative().optional(),
512
+ ...next()
513
+ })
514
+ ];
515
+ const node = zod.z.lazy(() => zod.z.discriminatedUnion("type", [...arms]));
516
+ const event = () => node.nullable().optional();
517
+ return {
518
+ node,
519
+ widgetActions: zod.z.object({
520
+ activate: event(),
521
+ cursorEnter: event(),
522
+ cursorExit: event(),
523
+ mouseDown: event(),
524
+ mouseUp: event(),
525
+ focus: event(),
526
+ blur: event(),
527
+ pageOpen: event(),
528
+ pageClose: event(),
529
+ pageVisible: event(),
530
+ pageInvisible: event()
531
+ }).strict()
532
+ };
533
+ }
534
+ const PAGE_SPACE_WRITES = actionWriteSchemasFor(PageDestinationSchema);
535
+ const PDF_SPACE_WRITES = actionWriteSchemasFor(PdfDestinationSchema);
536
+ /** An action a write makes, its destinations in page space. */
537
+ const PdfActionWriteSchema = PAGE_SPACE_WRITES.node;
538
+ /** A widget's actions to write, by event, their destinations in page space. */
539
+ const WidgetActionsPatchSchema = PAGE_SPACE_WRITES.widgetActions;
540
+ /** A widget's actions to write, as the engine writes the file: destinations in its coordinates. */
541
+ const FileWidgetActionsPatchSchema = PDF_SPACE_WRITES.widgetActions;
542
+ const PdfActionNodeSchema = PAGE_SPACE.node;
543
+ /** The `/S` vocabulary, derived from the union arms so it cannot drift. */
544
+ const PdfActionTypeSchema = zod.z.enum(PAGE_SPACE.arms.map((option) => option.shape.type.value));
545
+ const PdfActionTreeSchema = PAGE_SPACE.tree;
546
+ const PdfFieldActionsSchema = PAGE_SPACE.fieldActions;
547
+ const PdfPageActionsSchema = PAGE_SPACE.pageActions;
548
+ const DocumentActionsSnapshotSchema = PAGE_SPACE.documentActions;
549
+ /** An annotation's actions (`/A`, `/AA`), their destinations in page space. */
550
+ const PdfAnnotationActionsSchema = PAGE_SPACE.annotationActions;
551
+ /** An annotation's actions as the engine reads the file: destinations in the file's coordinates. */
552
+ const FileAnnotationActionsSchema = PDF_SPACE.annotationActions;
553
+ /**
554
+ * A field event's script: JavaScript all through. Any other action type is
555
+ * refused here, at the boundary.
556
+ */
557
+ const FieldScriptWriteSchema = zod.z.lazy(() => zod.z.object({
558
+ type: zod.z.literal("javascript"),
559
+ script: zod.z.string(),
560
+ next: zod.z.array(FieldScriptWriteSchema).optional()
561
+ }));
562
+ /** A field's scripts to write, by event: a script sets one, `null` removes it. */
563
+ const FieldActionsPatchSchema = zod.z.object({
564
+ keystroke: FieldScriptWriteSchema.nullable().optional(),
565
+ format: FieldScriptWriteSchema.nullable().optional(),
566
+ validate: FieldScriptWriteSchema.nullable().optional(),
567
+ calculate: FieldScriptWriteSchema.nullable().optional()
568
+ });
569
+ /**
570
+ * Stable public component names for generators that project the action wire
571
+ * model into OpenAPI or another schema format. Keep reusable boundaries here;
572
+ * individual action arms remain owned by `PdfActionNodeSchema`.
573
+ */
574
+ const PdfActionWireComponents = {
575
+ PdfActionTargetRef: PdfActionTargetRefSchema,
576
+ PageDestination: PageDestinationSchema,
577
+ PdfActionNode: PdfActionNodeSchema,
578
+ PdfActionTree: PdfActionTreeSchema,
579
+ PdfFieldActions: PdfFieldActionsSchema,
580
+ PdfPageActions: PdfPageActionsSchema,
581
+ PdfAnnotationActions: PdfAnnotationActionsSchema,
582
+ DocumentActionsSnapshot: DocumentActionsSnapshotSchema,
583
+ FieldScriptWrite: FieldScriptWriteSchema,
584
+ FieldActionsPatch: FieldActionsPatchSchema,
585
+ PdfActionWrite: PdfActionWriteSchema,
586
+ WidgetActionsPatch: WidgetActionsPatchSchema
587
+ };
588
+ //#endregion
589
+ //#region src/annotation/declaration.ts
590
+ function createField(read, write, traits) {
591
+ const next = (changed) => createField(read, write, {
592
+ ...traits,
593
+ ...changed
594
+ });
595
+ return {
596
+ read,
597
+ write,
598
+ traits,
599
+ nullable: () => next({
600
+ readNullable: true,
601
+ writeNullable: true
602
+ }),
603
+ nullableOnRead: () => next({ readNullable: true }),
604
+ optional: () => next({ required: false }),
605
+ createOnly: () => next({ createOnly: true }),
606
+ readBack: () => next({ readBack: true }),
607
+ space: (space) => next({ space }),
608
+ writes: (schema) => createField(read, schema, traits)
609
+ };
610
+ }
611
+ const ownedBy = (owner, required) => ({
612
+ owner,
613
+ readNullable: false,
614
+ writeNullable: false,
615
+ required,
616
+ createOnly: false,
617
+ readBack: false,
618
+ space: "none"
619
+ });
620
+ /** Field builders for {@link defineKind}. */
621
+ const field = {
622
+ /** Written by the caller. Required on create until marked `optional()`. */
623
+ data: (schema) => createField(schema, schema, ownedBy("data", true)),
624
+ /** Stamped by the engine from the session's identity. */
625
+ attribution: (schema) => createField(schema, schema, ownedBy("attribution", false)),
626
+ /** Written only by the engine. */
627
+ engine: (schema) => createField(schema, schema, ownedBy("engine", false)),
628
+ /** Read from the PDF and kept in place, but not writable. */
629
+ preserved: (schema) => createField(schema, schema, ownedBy("preserved", false))
630
+ };
631
+ /**
632
+ * The page-space schema of a field that holds a box or destinations, whose
633
+ * shape differs from the file's: a box is `{ x, y, width, height }`, and a
634
+ * destination is measured from its page's top-left. Every other place has
635
+ * the same shape in both spaces.
636
+ */
637
+ const PAGE_SPACE_SCHEMAS = {
638
+ box: {
639
+ read: PageBoxSchema,
640
+ write: PageBoxSchema
641
+ },
642
+ linkTarget: {
643
+ read: PdfLinkTargetSchema,
644
+ write: PdfLinkTargetWritableSchema
645
+ },
646
+ actions: {
647
+ read: PdfAnnotationActionsSchema,
648
+ write: WidgetActionsPatchSchema
649
+ }
650
+ };
651
+ /** The zod shapes of a kind's fields, each field's schemas given by `schemasOf`. */
652
+ function shapesOf(subtype, fields, schemasOf) {
653
+ const read = { subtype: zod.z.literal(subtype) };
654
+ const create = { subtype: zod.z.literal(subtype) };
655
+ const update = { subtype: zod.z.literal(subtype).optional() };
656
+ const readBackWrites = {};
657
+ for (const [name, spec] of Object.entries(fields)) {
658
+ const { owner, readNullable, writeNullable, required, readBack } = spec.traits;
659
+ const schemas = schemasOf(spec);
660
+ read[name] = readNullable ? schemas.read.nullable() : schemas.read;
661
+ if (owner === "data") {
662
+ const write = writeNullable ? schemas.write.nullable() : schemas.write;
663
+ create[name] = required ? write : write.optional();
664
+ const readBackUpdate = schemas.read === schemas.write ? readNullable || writeNullable ? schemas.write.nullable() : schemas.write : zod.z.union([write, read[name]]);
665
+ update[name] = (readBack ? readBackUpdate : write).optional();
666
+ if (readBack) readBackWrites[name] = write;
667
+ } else {
668
+ create[name] = readBack ? read[name].optional() : zod.z.unknown().optional();
669
+ update[name] = readBack ? read[name].optional() : zod.z.unknown().optional();
670
+ if (readBack) readBackWrites[name] = null;
671
+ }
672
+ }
673
+ return {
674
+ read,
675
+ create,
676
+ update,
677
+ readBackWrites
678
+ };
679
+ }
680
+ /**
681
+ * Declares an annotation kind from its fields and the resources it takes
682
+ * beside its data. Fields are declared as the file holds them; the page-space
683
+ * schemas follow from what each field holds (`space`).
684
+ */
685
+ function defineKind(subtype, fields, resources = {}) {
686
+ const file = shapesOf(subtype, fields, (spec) => spec);
687
+ const page = shapesOf(subtype, fields, (spec) => PAGE_SPACE_SCHEMAS[spec.traits.space] ?? spec);
688
+ return {
689
+ subtype,
690
+ fields,
691
+ resources,
692
+ readSchema: zod.z.object(page.read),
693
+ createSchema: zod.z.object(page.create).strict(),
694
+ updateSchema: zod.z.object(page.update).strict(),
695
+ fileSchemas: {
696
+ read: zod.z.object(file.read),
697
+ create: zod.z.object(file.create).strict(),
698
+ update: zod.z.object(file.update).strict()
699
+ },
700
+ readBackWrites: file.readBackWrites,
701
+ shapes: {
702
+ read: page.read,
703
+ create: page.create,
704
+ update: page.update
705
+ }
706
+ };
707
+ }
708
+ //#endregion
709
+ //#region src/dto/IsoDateTime.schema.ts
710
+ /** ISO 8601 with an offset (`Z` or `±HH:mm`) or without one. */
711
+ const IsoDateTimeSchema = zod.z.string().datetime({
712
+ offset: true,
713
+ local: true
714
+ });
715
+ /**
716
+ * A moment in a write. JSON carries the string; a `Date` only ever arrives
717
+ * in-process (the local engine), and becomes that string on the wire.
718
+ */
719
+ const DateInputSchema = zod.z.union([IsoDateTimeSchema, zod.z.date()]);
720
+ //#endregion
721
+ //#region src/dto/Measure.schema.ts
722
+ const float = zod.z.number().finite().refine((n) => Number.isFinite(Math.fround(n)), "Outside PDF float range");
723
+ const point = zod.z.object({
724
+ x: float,
725
+ y: float
726
+ }).strict();
727
+ const positive = float.refine((n) => Math.fround(n) > 0, "Must be positive in PDF float precision");
728
+ const PdfNumberFormatSchema = zod.z.object({
729
+ unit: zod.z.string(),
730
+ conversion: float.optional(),
731
+ fraction: zod.z.enum([
732
+ "decimal",
733
+ "fraction",
734
+ "round",
735
+ "truncate"
736
+ ]).optional(),
737
+ precision: zod.z.number().int().optional(),
738
+ fixed: zod.z.boolean().optional(),
739
+ thousands: zod.z.string().optional(),
740
+ decimal: zod.z.string().optional(),
741
+ prefixSpacing: zod.z.string().optional(),
742
+ suffixSpacing: zod.z.string().optional(),
743
+ labelPosition: zod.z.enum(["suffix", "prefix"]).optional()
744
+ });
745
+ const PdfMeasureSchema = zod.z.object({
746
+ subtype: zod.z.literal("rectilinear"),
747
+ ratio: zod.z.string().optional(),
748
+ x: zod.z.array(PdfNumberFormatSchema),
749
+ y: zod.z.array(PdfNumberFormatSchema).optional(),
750
+ distance: zod.z.array(PdfNumberFormatSchema),
751
+ area: zod.z.array(PdfNumberFormatSchema),
752
+ angle: zod.z.array(PdfNumberFormatSchema).optional(),
753
+ slope: zod.z.array(PdfNumberFormatSchema).optional(),
754
+ origin: point.optional(),
755
+ cyx: float.optional()
756
+ });
757
+ const writableFormat = PdfNumberFormatSchema.extend({
758
+ conversion: positive,
759
+ precision: zod.z.number().int().min(1).max(2147483647).optional()
760
+ }).refine(require_format.validNumberFormat, "Invalid number format precision");
761
+ const PdfMeasureWriteSchema = PdfMeasureSchema.extend({
762
+ x: zod.z.array(writableFormat),
763
+ y: zod.z.array(writableFormat).optional(),
764
+ distance: zod.z.array(writableFormat),
765
+ area: zod.z.array(writableFormat),
766
+ angle: zod.z.array(writableFormat).optional(),
767
+ slope: zod.z.array(writableFormat).optional(),
768
+ cyx: positive.optional()
769
+ });
770
+ const geoMeasure = zod.z.object({ subtype: zod.z.literal("geospatial") });
771
+ const unknownMeasure = zod.z.object({ subtype: zod.z.literal("unknown") });
772
+ const PdfForeignMeasureSchema = zod.z.union([geoMeasure, unknownMeasure]);
773
+ const PageScaleInputSchema = zod.z.object({ measure: PdfMeasureWriteSchema.nullable() });
774
+ const PdfMeasurementSchema = zod.z.discriminatedUnion("subtype", [
775
+ PdfMeasureSchema,
776
+ geoMeasure,
777
+ unknownMeasure
778
+ ]);
779
+ const PageMeasurementViewportSchema = zod.z.object({
780
+ bbox: PageBoxSchema,
781
+ name: zod.z.string().nullable(),
782
+ measure: PdfMeasurementSchema.nullable(),
783
+ owned: zod.z.boolean()
784
+ });
785
+ /** See `PageMeasurementViewportList`. */
786
+ const PageMeasurementViewportListSchema = zod.z.object({ viewports: zod.z.array(PageMeasurementViewportSchema) });
787
+ const LineIntentSchema = zod.z.enum(["line-arrow", "line-dimension"]);
788
+ const PolygonIntentSchema = zod.z.enum(["polygon-cloud", "polygon-dimension"]);
789
+ const PolylineIntentSchema = zod.z.literal("polyline-dimension");
790
+ const offset = zod.z.object({
791
+ along: float,
792
+ perpendicular: float
793
+ }).strict();
794
+ const LineDimensionCaptionSchema = zod.z.object({
795
+ enabled: zod.z.boolean(),
796
+ position: zod.z.enum(["inline", "top"]).optional(),
797
+ offset: offset.optional()
798
+ }).strict();
799
+ const ShapeDimensionCaptionSchema = zod.z.object({
800
+ enabled: zod.z.boolean(),
801
+ center: point.optional()
802
+ }).strict();
803
+ const LineCaptionPatchSchema = zod.z.object({
804
+ enabled: zod.z.boolean().optional(),
805
+ position: zod.z.enum(["inline", "top"]).nullable().optional(),
806
+ offset: offset.nullable().optional()
807
+ }).strict();
808
+ const ShapeCaptionPatchSchema = zod.z.object({
809
+ enabled: zod.z.boolean().optional(),
810
+ center: point.nullable().optional()
811
+ }).strict();
812
+ const LineLeaderSchema = zod.z.object({
813
+ length: float,
814
+ extension: float.refine((n) => n >= 0).optional(),
815
+ offset: float.refine((n) => n >= 0).optional()
816
+ }).strict();
817
+ //#endregion
818
+ //#region src/annotation/kinds/shared-fields.ts
819
+ /** `/IRT` and `/RT`: the annotation this one replies to, and how it relates to it. */
820
+ const AnnotationReplySchema = zod.z.object({
821
+ to: AnnotationRefSchema,
822
+ type: zod.z.enum(["reply", "group"])
823
+ });
824
+ /** A write may leave out `type`: an absent `/RT` means `'reply'` (ISO 32000-2 §12.5.6.2). */
825
+ const AnnotationReplyWriteSchema = zod.z.object({
826
+ to: AnnotationRefSchema,
827
+ type: zod.z.enum(["reply", "group"]).optional()
828
+ });
829
+ /** A standard font name or a registered font key; the writer resolves which. */
830
+ const FontNameSchema = zod.z.string().min(1);
831
+ /** One `/F` bit (ISO 32000-2 §12.5.3); every bit defaults to off. */
832
+ const flag = () => field.data(zod.z.boolean()).optional();
833
+ /** Fields every annotation kind has. */
834
+ const annotationBaseFields = {
835
+ ref: field.engine(AnnotationRefSchema),
836
+ page: field.engine(PageRefSchema),
837
+ /**
838
+ * Whether the file holds its appearance (`/AP /N`). Without one, every
839
+ * viewer draws the annotation from its fields: the engine in memory, never
840
+ * written.
841
+ */
842
+ hasAppearance: field.engine(zod.z.boolean()),
843
+ /**
844
+ * `/AS`: which state of its appearance the annotation shows, when the
845
+ * appearance has states (a check box's `Off` and its on state); `null`
846
+ * when it names none. The appearance images are labelled with the same
847
+ * names, so this picks the one to show.
848
+ */
849
+ appearanceState: field.engine(zod.z.string()).nullable(),
850
+ nm: field.data(zod.z.string()).nullable().optional().createOnly(),
851
+ rect: field.data(PdfRectSchema).space("box"),
852
+ contents: field.data(zod.z.string()).nullable().optional(),
853
+ subject: field.data(zod.z.string()).nullable().optional(),
854
+ blendMode: field.data(BlendModeSchema).optional(),
855
+ invisible: flag(),
856
+ hidden: flag(),
857
+ print: flag(),
858
+ noZoom: flag(),
859
+ noRotate: flag(),
860
+ noView: flag(),
861
+ readOnly: flag(),
862
+ locked: flag(),
863
+ toggleNoView: flag(),
864
+ lockedContents: flag(),
865
+ reply: field.data(AnnotationReplySchema).writes(AnnotationReplyWriteSchema).nullable().optional(),
866
+ /** `/Popup`, kept in sync by the engine from the popup's `parent`. */
867
+ popup: field.engine(AnnotationRefSchema).nullable(),
868
+ /** `/EMBD_Metadata/GroupID`: the group that owns the annotation. */
869
+ groupId: field.data(zod.z.string().min(1)).nullable().optional(),
870
+ author: field.attribution(zod.z.string()).nullable(),
871
+ /** `/CreationDate`. */
872
+ createdAt: field.attribution(IsoDateTimeSchema).writes(DateInputSchema).nullable(),
873
+ /** `/M`. */
874
+ modifiedAt: field.attribution(IsoDateTimeSchema).writes(DateInputSchema).nullable(),
875
+ userId: field.attribution(zod.z.string()).nullable(),
876
+ createdBy: field.attribution(zod.z.string()).nullable(),
877
+ /** `/EMBD_Metadata/UpdatedBy`. */
878
+ modifiedBy: field.attribution(zod.z.string()).nullable(),
879
+ /** The session that restored this annotation's attribution in an import. */
880
+ importedBy: field.engine(zod.z.string()).nullable(),
881
+ /** `/A` and `/AA`. */
882
+ actions: field.preserved(FileAnnotationActionsSchema).nullable().space("actions")
883
+ };
884
+ const colorStyleFields = {
885
+ color: field.data(ColorSchema).optional(),
886
+ opacity: field.data(zod.z.number().min(0).max(1)).optional()
887
+ };
888
+ const geometryStyleFields = {
889
+ ...colorStyleFields,
890
+ strokeWidth: field.data(zod.z.number().nonnegative()).optional(),
891
+ /** `beveled` and `inset` are read from other apps' files and kept; only widgets draw them. */
892
+ borderStyle: field.data(AnnotationBorderStyleSchema).writes(DrawnBorderStyleSchema).readBack().optional(),
893
+ dashArray: field.data(zod.z.array(zod.z.number().nonnegative())).nullable().optional()
894
+ };
895
+ const filledStyleFields = {
896
+ ...geometryStyleFields,
897
+ interiorColor: field.data(ColorSchema).nullable().optional()
898
+ };
899
+ /**
900
+ * `rect` where another field gives the shape (a box, points, quads): where
901
+ * the annotation sits on the page, the upright box around all it draws. The
902
+ * engine works it out from the shape, so a create's `rect` is worked out
903
+ * again. An update's `rect` other than the one read puts the shape there
904
+ * (`shapeForRect`); the rect read, sent back, changes nothing.
905
+ */
906
+ const drawnRectFields = { rect: field.engine(PdfRectSchema).readBack().space("box") };
907
+ /**
908
+ * The turn of a kind drawn from points (line, polyline, polygon, ink): the
909
+ * points are upright, and the turn takes them about the middle of their box,
910
+ * as a square turns about its box.
911
+ */
912
+ const pointsTurnFields = {
913
+ /** Degrees clockwise, about the middle of the points' box. */
914
+ rotation: field.data(zod.z.number()).nullable().optional() };
915
+ /**
916
+ * A kind drawn about a box that can turn: square, circle, free text, stamp
917
+ * and caret. The caller gives the box and the turn; `rect` takes in the
918
+ * turned box and what the drawing adds around it (a cloudy border's bumps, a
919
+ * callout's line and arrow).
920
+ *
921
+ * A create gives `box`, or `rect` with a quarter turn: where the turned box
922
+ * stands on the page, which pins the box down (`pdfQuarterTurnBox`). At any
923
+ * other angle many boxes share one rect, so a create by `rect` is refused.
924
+ */
925
+ const boxFields = {
926
+ ...drawnRectFields,
927
+ /** The shape's own box, before any turn: a callout's text box. */
928
+ box: field.data(PdfRectSchema).space("box").optional(),
929
+ /** Degrees clockwise, about the middle of `box`. */
930
+ rotation: field.data(zod.z.number()).nullable().optional()
931
+ };
932
+ /**
933
+ * A widget's frame and its turn: the box its contents are laid out in, and
934
+ * a quarter turn (`/MK /R`, which the file holds counterclockwise), so every
935
+ * viewer can lay an upright editor over it. `rect` is where the widget
936
+ * stands on the page, the box turned. A create gives `box` or `rect`, as a
937
+ * box kind's does.
938
+ */
939
+ const widgetBoxFields = {
940
+ ...drawnRectFields,
941
+ /** The box the contents are laid out in, before the turn: `rect` with its sides swapped under 90 and 270. */
942
+ box: field.data(PdfRectSchema).space("box").optional(),
943
+ /** Degrees clockwise, a quarter turn, about the middle of `box`; `null` upright. */
944
+ rotation: field.data(PdfRotationSchema).nullable().optional()
945
+ };
946
+ const textMarkupFields = {
947
+ ...annotationBaseFields,
948
+ ...colorStyleFields,
949
+ /** The box around the quads. */
950
+ ...drawnRectFields,
951
+ quadPoints: field.data(zod.z.array(PdfQuadSchema).min(1)).space("quads")
952
+ };
953
+ const shapeFields = {
954
+ ...annotationBaseFields,
955
+ ...filledStyleFields,
956
+ ...boxFields,
957
+ cloudyIntensity: field.data(zod.z.number().positive()).nullable().optional()
958
+ };
959
+ const vertexFields = {
960
+ ...annotationBaseFields,
961
+ ...filledStyleFields,
962
+ ...drawnRectFields,
963
+ vertices: field.data(zod.z.array(PdfPointSchema)).space("points"),
964
+ ...pointsTurnFields
965
+ };
966
+ /**
967
+ * `/Measure`. A write takes a rectilinear scale, or sends back the marker a read
968
+ * returned for a scale the engine can't model.
969
+ */
970
+ const measureField = field.data(PdfMeasurementSchema).writes(zod.z.union([PdfMeasureWriteSchema, PdfForeignMeasureSchema])).nullable().optional().space("measure");
971
+ /** Our caption on a polygon or polyline measurement; `null` when the shape has no caption flag. */
972
+ const shapeCaptionFields = {
973
+ captionEnabled: field.data(zod.z.boolean()).nullable().optional(),
974
+ /** `null` places the caption automatically. */
975
+ captionCenter: field.data(PdfPointSchema).nullable().optional().space("point")
976
+ };
977
+ //#endregion
978
+ //#region src/annotation/kinds/caret/declaration.ts
979
+ const CaretDeclaration = defineKind("caret", {
980
+ ...annotationBaseFields,
981
+ ...colorStyleFields,
982
+ ...boxFields,
983
+ intent: field.data(CaretIntentSchema).nullable().optional()
984
+ });
985
+ //#endregion
986
+ //#region src/annotation/kinds/caret/index.ts
987
+ const CaretDTOSchema = CaretDeclaration.readSchema;
988
+ const CaretDraftSchema = CaretDeclaration.createSchema;
989
+ const CaretPatchSchema = CaretDeclaration.updateSchema;
990
+ const CaretKind = {
991
+ subtype: "caret",
992
+ pdfSubtypeCode: require_subtype.PdfAnnotationSubtypeCode.CARET,
993
+ dtoSchema: CaretDTOSchema,
994
+ draftSchema: CaretDraftSchema,
995
+ patchSchema: CaretPatchSchema,
996
+ readBackWrites: CaretDeclaration.readBackWrites
997
+ };
998
+ //#endregion
999
+ //#region src/annotation/kinds/circle/declaration.ts
1000
+ const CircleDeclaration = defineKind("circle", shapeFields);
1001
+ //#endregion
1002
+ //#region src/annotation/kinds/circle/index.ts
1003
+ const CircleDTOSchema = CircleDeclaration.readSchema;
1004
+ const CircleDraftSchema = CircleDeclaration.createSchema;
1005
+ const CirclePatchSchema = CircleDeclaration.updateSchema;
1006
+ const CircleKind = {
1007
+ subtype: "circle",
1008
+ pdfSubtypeCode: require_subtype.PdfAnnotationSubtypeCode.CIRCLE,
1009
+ dtoSchema: CircleDTOSchema,
1010
+ draftSchema: CircleDraftSchema,
1011
+ patchSchema: CirclePatchSchema,
1012
+ readBackWrites: CircleDeclaration.readBackWrites
1013
+ };
1014
+ //#endregion
1015
+ //#region src/wire/resourceKeys.ts
1016
+ /**
1017
+ * A multipart message carries each file as a part `resource:<key>`, and its
1018
+ * JSON names the file by role: `resources: { <role>: <key> }`, on the
1019
+ * object the files belong to. These are those objects, one per set of roles.
1020
+ */
1021
+ /** A file's key: the `<key>` of its `resource:<key>` part. */
1022
+ const ResourceKeySchema = zod.z.string().min(1);
1023
+ /** An annotation write's files: its drawing and its attached file. */
1024
+ const AnnotationResourceKeysSchema = zod.z.object({
1025
+ appearance: ResourceKeySchema.optional(),
1026
+ file: ResourceKeySchema.optional()
1027
+ }).strict();
1028
+ /** A drawn appearance: a signature's mark, as a one-page PDF or an image. */
1029
+ const AppearanceResourceKeysSchema = zod.z.object({ appearance: ResourceKeySchema }).strict();
1030
+ /** An attachment's file. */
1031
+ const FileResourceKeysSchema = zod.z.object({ file: ResourceKeySchema }).strict();
1032
+ /** The PDF whose pages an insert copies in. */
1033
+ const SourceResourceKeysSchema = zod.z.object({ source: ResourceKeySchema }).strict();
1034
+ /** An answer's picture. */
1035
+ const ImageResourceKeysSchema = zod.z.object({ image: ResourceKeySchema }).strict();
1036
+ //#endregion
1037
+ //#region src/dto/Attachment.schema.ts
1038
+ /**
1039
+ * Wire schemas for the attachment vocabulary (see `Attachment.ts`). The
1040
+ * write-side `AttachmentFileSource` carries bytes and never appears on the
1041
+ * wire; `WireAttachmentFile` is its form there.
1042
+ */
1043
+ const WireAttachmentFileSchema = zod.z.object({
1044
+ resources: FileResourceKeysSchema,
1045
+ name: zod.z.string().min(1),
1046
+ mimeType: zod.z.string().optional(),
1047
+ description: zod.z.string().optional()
1048
+ });
1049
+ const AttachmentFileInfoSchema = zod.z.object({
1050
+ name: zod.z.string(),
1051
+ mimeType: zod.z.string().nullable(),
1052
+ description: zod.z.string().nullable(),
1053
+ size: zod.z.number().int().nonnegative().nullable(),
1054
+ checksum: zod.z.string().nullable(),
1055
+ createdAt: IsoDateTimeSchema.nullable(),
1056
+ modifiedAt: IsoDateTimeSchema.nullable()
1057
+ });
1058
+ const AttachmentRefSchema = zod.z.object({
1059
+ kind: zod.z.literal("key"),
1060
+ key: zod.z.string().min(1)
1061
+ });
1062
+ const AttachmentSchema = zod.z.object({
1063
+ ref: zod.z.object({
1064
+ kind: zod.z.literal("key"),
1065
+ key: zod.z.string()
1066
+ }),
1067
+ name: zod.z.string(),
1068
+ mimeType: zod.z.string().nullable(),
1069
+ description: zod.z.string().nullable(),
1070
+ size: zod.z.number().int().nonnegative().nullable(),
1071
+ checksum: zod.z.string().nullable(),
1072
+ createdAt: IsoDateTimeSchema.nullable(),
1073
+ modifiedAt: IsoDateTimeSchema.nullable(),
1074
+ index: zod.z.number().int().nonnegative()
1075
+ });
1076
+ //#endregion
1077
+ //#region src/annotation/kinds/file-attachment/values.ts
1078
+ const FileAttachmentIconSchema = zod.z.enum([
1079
+ "push-pin",
1080
+ "paperclip",
1081
+ "graph",
1082
+ "tag"
1083
+ ]);
1084
+ //#endregion
1085
+ //#region src/annotation/kinds/file-attachment/declaration.ts
1086
+ /**
1087
+ * The file's metadata; its bytes travel as the `file` resource. What a read
1088
+ * adds (size, checksum, creation date) comes from the bytes and is ignored.
1089
+ * A create may leave it out when the resource is a `File`, which brings its
1090
+ * name and type.
1091
+ */
1092
+ const AttachmentFileWriteSchema = zod.z.object({
1093
+ name: zod.z.string().min(1),
1094
+ mimeType: zod.z.string().nullable().optional(),
1095
+ description: zod.z.string().nullable().optional()
1096
+ });
1097
+ /** A file on the page: its icon fills `rect`, 20×20 at the usual size. */
1098
+ const FileAttachmentDeclaration = defineKind("file-attachment", {
1099
+ ...annotationBaseFields,
1100
+ ...colorStyleFields,
1101
+ icon: field.data(FileAttachmentIconSchema).optional(),
1102
+ /**
1103
+ * `null` when the file specification has no embedded file. A write takes
1104
+ * what a read returns, so a read can be copied: on a create `null` is the
1105
+ * same as leaving it out, and an update that sends back the `null` a read
1106
+ * returned changes nothing (a file can't be removed).
1107
+ */
1108
+ file: field.data(AttachmentFileInfoSchema).writes(AttachmentFileWriteSchema).nullable().optional()
1109
+ }, { file: "required" });
1110
+ //#endregion
1111
+ //#region src/annotation/kinds/file-attachment/index.ts
1112
+ const FileAttachmentDTOSchema = FileAttachmentDeclaration.readSchema;
1113
+ const FileAttachmentDraftSchema = FileAttachmentDeclaration.createSchema;
1114
+ const FileAttachmentPatchSchema = FileAttachmentDeclaration.updateSchema;
1115
+ const FileAttachmentKind = {
1116
+ subtype: "file-attachment",
1117
+ pdfSubtypeCode: require_subtype.PdfAnnotationSubtypeCode.FILEATTACHMENT,
1118
+ dtoSchema: FileAttachmentDTOSchema,
1119
+ draftSchema: FileAttachmentDraftSchema,
1120
+ patchSchema: FileAttachmentPatchSchema,
1121
+ readBackWrites: FileAttachmentDeclaration.readBackWrites
1122
+ };
1123
+ //#endregion
1124
+ //#region src/annotation/kinds/free-text/values.ts
1125
+ /** How a paragraph's lines line up: a free text's `textAlign` too. */
1126
+ const RichTextAlignSchema = zod.z.enum([
1127
+ "left",
1128
+ "center",
1129
+ "right",
1130
+ "justify"
1131
+ ]);
1132
+ const RichTextRunStyleShape = {
1133
+ family: zod.z.string().min(1),
1134
+ weight: zod.z.number().int().min(100).max(900),
1135
+ italic: zod.z.boolean(),
1136
+ size: zod.z.number().nonnegative(),
1137
+ color: ColorSchema,
1138
+ decoration: zod.z.array(zod.z.enum([
1139
+ "underline",
1140
+ "line-through",
1141
+ "word"
1142
+ ])),
1143
+ script: zod.z.enum([
1144
+ "normal",
1145
+ "sub",
1146
+ "super"
1147
+ ]),
1148
+ letterSpacing: zod.z.number(),
1149
+ horizontalScale: zod.z.number().positive(),
1150
+ unknown: zod.z.string().optional()
1151
+ };
1152
+ const RichTextParagraphPropsShape = {
1153
+ align: RichTextAlignSchema,
1154
+ dir: zod.z.enum(["ltr", "rtl"]),
1155
+ lineHeight: zod.z.number().positive().optional(),
1156
+ margins: zod.z.object({
1157
+ top: zod.z.number(),
1158
+ bottom: zod.z.number(),
1159
+ left: zod.z.number(),
1160
+ right: zod.z.number()
1161
+ }).optional(),
1162
+ textIndent: zod.z.number().optional(),
1163
+ unknown: zod.z.string().optional()
1164
+ };
1165
+ const RichTextRunStyleDeltaSchema = zod.z.object(RichTextRunStyleShape).partial();
1166
+ const RichTextParagraphSchema = zod.z.object({
1167
+ ...RichTextParagraphPropsShape,
1168
+ runs: zod.z.array(zod.z.object({
1169
+ text: zod.z.string(),
1170
+ style: RichTextRunStyleDeltaSchema.optional()
1171
+ }))
1172
+ }).partial({
1173
+ align: true,
1174
+ dir: true
1175
+ });
1176
+ const RichTextDocumentSchema = zod.z.object({
1177
+ body: zod.z.object({
1178
+ ...RichTextRunStyleShape,
1179
+ ...RichTextParagraphPropsShape
1180
+ }),
1181
+ paragraphs: zod.z.array(RichTextParagraphSchema)
1182
+ });
1183
+ const RichTextDocumentInputSchema = zod.z.object({
1184
+ body: zod.z.object({
1185
+ ...RichTextRunStyleShape,
1186
+ ...RichTextParagraphPropsShape
1187
+ }).partial().optional(),
1188
+ paragraphs: zod.z.array(RichTextParagraphSchema)
1189
+ });
1190
+ //#endregion
1191
+ //#region src/annotation/kinds/free-text/declaration.ts
1192
+ const FreeTextDeclaration = defineKind("free-text", {
1193
+ ...annotationBaseFields,
1194
+ ...boxFields,
1195
+ /**
1196
+ * A create without it is a callout when it has a `calloutLine`, else a
1197
+ * plain box. A typewriter another app made is kept as it is.
1198
+ */
1199
+ intent: field.data(FreeTextIntentSchema).writes(FreeTextIntentWriteSchema).readBack().optional(),
1200
+ /** The text's font: the rich text body's. Helvetica when a create leaves it out. */
1201
+ fontFamily: field.data(FontNameSchema).optional(),
1202
+ /** The body's size in points: 12 when a create leaves it out. */
1203
+ fontSize: field.data(zod.z.number().positive()).optional(),
1204
+ /** The body's alignment: left when a create leaves it out. */
1205
+ textAlign: field.data(RichTextAlignSchema).optional(),
1206
+ /** Where the lines sit in the box: top when a create leaves it out. */
1207
+ verticalAlign: field.data(VerticalAlignmentSchema).optional(),
1208
+ richText: field.data(RichTextDocumentSchema).writes(RichTextDocumentInputSchema).optional().space("length"),
1209
+ /** The border's color, and a callout line's. */
1210
+ color: field.data(ColorSchema).optional(),
1211
+ /** The text's color: the rich text body's. Black when a create leaves it out. */
1212
+ fontColor: field.data(ColorSchema).optional(),
1213
+ interiorColor: field.data(ColorSchema).nullable().optional(),
1214
+ opacity: field.data(zod.z.number().min(0).max(1)).optional(),
1215
+ strokeWidth: field.data(zod.z.number().nonnegative()).optional(),
1216
+ borderStyle: field.data(AnnotationBorderStyleSchema).writes(DrawnBorderStyleSchema).readBack().optional(),
1217
+ dashArray: field.data(zod.z.array(zod.z.number().nonnegative())).nullable().optional(),
1218
+ cloudyIntensity: field.data(zod.z.number().positive()).nullable().optional(),
1219
+ calloutLine: field.data(CalloutLineSchema).nullable().optional().space("calloutLine"),
1220
+ lineEnding: field.data(LineEndingSchema).nullable().optional()
1221
+ });
1222
+ //#endregion
1223
+ //#region src/annotation/kinds/free-text/index.ts
1224
+ const FreeTextDTOSchema = FreeTextDeclaration.readSchema;
1225
+ const FreeTextDraftSchema = FreeTextDeclaration.createSchema;
1226
+ const FreeTextPatchSchema = FreeTextDeclaration.updateSchema;
1227
+ const FreeTextKind = {
1228
+ subtype: "free-text",
1229
+ pdfSubtypeCode: require_subtype.PdfAnnotationSubtypeCode.FREETEXT,
1230
+ dtoSchema: FreeTextDTOSchema,
1231
+ draftSchema: FreeTextDraftSchema,
1232
+ patchSchema: FreeTextPatchSchema,
1233
+ readBackWrites: FreeTextDeclaration.readBackWrites
1234
+ };
1235
+ //#endregion
1236
+ //#region src/annotation/kinds/highlight/declaration.ts
1237
+ const HighlightDeclaration = defineKind("highlight", textMarkupFields);
1238
+ //#endregion
1239
+ //#region src/annotation/kinds/highlight/index.ts
1240
+ const HighlightDTOSchema = HighlightDeclaration.readSchema;
1241
+ const HighlightDraftSchema = HighlightDeclaration.createSchema;
1242
+ const HighlightPatchSchema = HighlightDeclaration.updateSchema;
1243
+ const HighlightKind = {
1244
+ subtype: "highlight",
1245
+ pdfSubtypeCode: require_subtype.PdfAnnotationSubtypeCode.HIGHLIGHT,
1246
+ dtoSchema: HighlightDTOSchema,
1247
+ draftSchema: HighlightDraftSchema,
1248
+ patchSchema: HighlightPatchSchema,
1249
+ readBackWrites: HighlightDeclaration.readBackWrites
1250
+ };
1251
+ //#endregion
1252
+ //#region src/annotation/kinds/ink/declaration.ts
1253
+ const InkDeclaration = defineKind("ink", {
1254
+ ...annotationBaseFields,
1255
+ ...geometryStyleFields,
1256
+ /** More than 0 on a write: ink has no fill, so a line of 0 draws nothing. */
1257
+ strokeWidth: field.data(zod.z.number().nonnegative()).writes(zod.z.number().positive()).readBack().optional(),
1258
+ ...drawnRectFields,
1259
+ /** At least one stroke on a write, and no stroke without points. */
1260
+ inkList: field.data(InkListSchema).writes(zod.z.array(zod.z.array(PdfPointSchema).min(1)).min(1)).readBack().space("strokes"),
1261
+ intent: field.data(InkIntentSchema).nullable().optional(),
1262
+ ...pointsTurnFields
1263
+ });
1264
+ //#endregion
1265
+ //#region src/annotation/kinds/ink/index.ts
1266
+ const InkDTOSchema = InkDeclaration.readSchema;
1267
+ const InkDraftSchema = InkDeclaration.createSchema;
1268
+ const InkPatchSchema = InkDeclaration.updateSchema;
1269
+ const InkKind = {
1270
+ subtype: "ink",
1271
+ pdfSubtypeCode: require_subtype.PdfAnnotationSubtypeCode.INK,
1272
+ dtoSchema: InkDTOSchema,
1273
+ draftSchema: InkDraftSchema,
1274
+ patchSchema: InkPatchSchema,
1275
+ readBackWrites: InkDeclaration.readBackWrites
1276
+ };
1277
+ //#endregion
1278
+ //#region src/annotation/kinds/line/declaration.ts
1279
+ const LineDeclaration = defineKind("line", {
1280
+ ...annotationBaseFields,
1281
+ ...filledStyleFields,
1282
+ ...drawnRectFields,
1283
+ linePoints: field.data(LinePointsSchema).space("linePoints"),
1284
+ lineEndings: field.data(LineEndingsSchema).optional(),
1285
+ ...pointsTurnFields,
1286
+ intent: field.data(LineIntentSchema).nullable().optional(),
1287
+ measure: measureField,
1288
+ /** `/Cap`: paint `/Contents` on the line. */
1289
+ captionEnabled: field.data(zod.z.boolean()).nullable().optional(),
1290
+ /** `/CP`. */
1291
+ captionPosition: field.data(zod.z.enum(["inline", "top"])).optional(),
1292
+ /** `/CO`, along the line and its normal; `null` is the normal position. */
1293
+ captionOffset: field.data(zod.z.object({
1294
+ along: zod.z.number(),
1295
+ perpendicular: zod.z.number()
1296
+ })).nullable().optional(),
1297
+ /** `/LL`, `/LLE` and `/LLO`. */
1298
+ leader: field.data(LineLeaderSchema).nullable().optional()
1299
+ });
1300
+ //#endregion
1301
+ //#region src/annotation/kinds/line/index.ts
1302
+ const LineDTOSchema = LineDeclaration.readSchema;
1303
+ const LineDraftSchema = LineDeclaration.createSchema;
1304
+ const LinePatchSchema = LineDeclaration.updateSchema;
1305
+ const LineKind = {
1306
+ subtype: "line",
1307
+ pdfSubtypeCode: require_subtype.PdfAnnotationSubtypeCode.LINE,
1308
+ dtoSchema: LineDTOSchema,
1309
+ draftSchema: LineDraftSchema,
1310
+ patchSchema: LinePatchSchema,
1311
+ readBackWrites: LineDeclaration.readBackWrites
1312
+ };
1313
+ //#endregion
1314
+ //#region src/annotation/kinds/link/declaration.ts
1315
+ const LinkDeclaration = defineKind("link", {
1316
+ ...annotationBaseFields,
1317
+ target: field.data(FileLinkTargetSchema).writes(FileLinkTargetWritableSchema).nullable().readBack().space("linkTarget")
1318
+ });
1319
+ //#endregion
1320
+ //#region src/annotation/kinds/link/index.ts
1321
+ const LinkDTOSchema = LinkDeclaration.readSchema;
1322
+ const LinkDraftSchema = LinkDeclaration.createSchema;
1323
+ const LinkPatchSchema = LinkDeclaration.updateSchema;
1324
+ const LinkKind = {
1325
+ subtype: "link",
1326
+ pdfSubtypeCode: require_subtype.PdfAnnotationSubtypeCode.LINK,
1327
+ dtoSchema: LinkDTOSchema,
1328
+ draftSchema: LinkDraftSchema,
1329
+ patchSchema: LinkPatchSchema,
1330
+ readBackWrites: LinkDeclaration.readBackWrites
1331
+ };
1332
+ //#endregion
1333
+ //#region src/annotation/kinds/polygon/declaration.ts
1334
+ const PolygonDeclaration = defineKind("polygon", {
1335
+ ...vertexFields,
1336
+ /** At least three points on a write; fewer enclose nothing. */
1337
+ vertices: field.data(zod.z.array(PdfPointSchema)).writes(zod.z.array(PdfPointSchema).min(3)).readBack().space("points"),
1338
+ ...shapeCaptionFields,
1339
+ intent: field.data(PolygonIntentSchema).nullable().optional(),
1340
+ measure: measureField,
1341
+ cloudyIntensity: field.data(zod.z.number().positive()).nullable().optional()
1342
+ });
1343
+ //#endregion
1344
+ //#region src/annotation/kinds/polygon/index.ts
1345
+ const PolygonDTOSchema = PolygonDeclaration.readSchema;
1346
+ const PolygonDraftSchema = PolygonDeclaration.createSchema;
1347
+ const PolygonPatchSchema = PolygonDeclaration.updateSchema;
1348
+ const PolygonKind = {
1349
+ subtype: "polygon",
1350
+ pdfSubtypeCode: require_subtype.PdfAnnotationSubtypeCode.POLYGON,
1351
+ dtoSchema: PolygonDTOSchema,
1352
+ draftSchema: PolygonDraftSchema,
1353
+ patchSchema: PolygonPatchSchema,
1354
+ readBackWrites: PolygonDeclaration.readBackWrites
1355
+ };
1356
+ //#endregion
1357
+ //#region src/annotation/kinds/polyline/declaration.ts
1358
+ const PolylineDeclaration = defineKind("polyline", {
1359
+ ...vertexFields,
1360
+ /** At least two points on a write; fewer draw nothing. */
1361
+ vertices: field.data(zod.z.array(PdfPointSchema)).writes(zod.z.array(PdfPointSchema).min(2)).readBack().space("points"),
1362
+ ...shapeCaptionFields,
1363
+ intent: field.data(PolylineIntentSchema).nullable().optional(),
1364
+ measure: measureField,
1365
+ lineEndings: field.data(LineEndingsSchema).optional()
1366
+ });
1367
+ //#endregion
1368
+ //#region src/annotation/kinds/polyline/index.ts
1369
+ const PolylineDTOSchema = PolylineDeclaration.readSchema;
1370
+ const PolylineDraftSchema = PolylineDeclaration.createSchema;
1371
+ const PolylinePatchSchema = PolylineDeclaration.updateSchema;
1372
+ const PolylineKind = {
1373
+ subtype: "polyline",
1374
+ pdfSubtypeCode: require_subtype.PdfAnnotationSubtypeCode.POLYLINE,
1375
+ dtoSchema: PolylineDTOSchema,
1376
+ draftSchema: PolylineDraftSchema,
1377
+ patchSchema: PolylinePatchSchema,
1378
+ readBackWrites: PolylineDeclaration.readBackWrites
1379
+ };
1380
+ //#endregion
1381
+ //#region src/annotation/kinds/popup/declaration.ts
1382
+ /** The window that shows its parent annotation's text. */
1383
+ const PopupDeclaration = defineKind("popup", {
1384
+ ...annotationBaseFields,
1385
+ /**
1386
+ * `/Parent`: the annotation this popup shows. Required on create; `null`
1387
+ * on a read of a popup whose PDF names none, which an update may send
1388
+ * back unchanged.
1389
+ */
1390
+ parent: field.data(AnnotationRefSchema).nullableOnRead().readBack(),
1391
+ /** `/Open`: whether the window is shown open. `false` when the PDF doesn't say. */
1392
+ open: field.data(zod.z.boolean()).optional()
1393
+ });
1394
+ //#endregion
1395
+ //#region src/annotation/kinds/popup/index.ts
1396
+ const PopupDTOSchema = PopupDeclaration.readSchema;
1397
+ const PopupDraftSchema = PopupDeclaration.createSchema;
1398
+ const PopupPatchSchema = PopupDeclaration.updateSchema;
1399
+ const PopupKind = {
1400
+ subtype: "popup",
1401
+ pdfSubtypeCode: require_subtype.PdfAnnotationSubtypeCode.POPUP,
1402
+ dtoSchema: PopupDTOSchema,
1403
+ draftSchema: PopupDraftSchema,
1404
+ patchSchema: PopupPatchSchema,
1405
+ readBackWrites: PopupDeclaration.readBackWrites
1406
+ };
1407
+ //#endregion
1408
+ //#region src/annotation/kinds/redact/declaration.ts
1409
+ const RedactDeclaration = defineKind("redact", {
1410
+ ...annotationBaseFields,
1411
+ ...colorStyleFields,
1412
+ /** Worked out from the quads when a create gives quads and no `rect`. */
1413
+ rect: field.data(PdfRectSchema).optional().space("box"),
1414
+ quadPoints: field.data(zod.z.array(PdfQuadSchema)).optional().space("quads"),
1415
+ interiorColor: field.data(ColorSchema).nullable().optional(),
1416
+ overlayText: field.data(zod.z.string()).nullable().optional(),
1417
+ repeat: field.data(zod.z.boolean()).optional(),
1418
+ /** A standard font or a registered key, as on free text. */
1419
+ fontFamily: field.data(FontNameSchema).optional(),
1420
+ /** `0` fits the label to the region. */
1421
+ fontSize: field.data(zod.z.number().nonnegative()).optional(),
1422
+ fontColor: field.data(ColorSchema).optional(),
1423
+ textAlign: field.data(TextAlignmentSchema).optional()
1424
+ });
1425
+ //#endregion
1426
+ //#region src/annotation/kinds/redact/index.ts
1427
+ const RedactDTOSchema = RedactDeclaration.readSchema;
1428
+ const RedactDraftSchema = RedactDeclaration.createSchema;
1429
+ const RedactPatchSchema = RedactDeclaration.updateSchema;
1430
+ const RedactKind = {
1431
+ subtype: "redact",
1432
+ pdfSubtypeCode: require_subtype.PdfAnnotationSubtypeCode.REDACT,
1433
+ dtoSchema: RedactDTOSchema,
1434
+ draftSchema: RedactDraftSchema,
1435
+ patchSchema: RedactPatchSchema,
1436
+ readBackWrites: RedactDeclaration.readBackWrites
1437
+ };
1438
+ //#endregion
1439
+ //#region src/annotation/kinds/square/declaration.ts
1440
+ const SquareDeclaration = defineKind("square", shapeFields);
1441
+ //#endregion
1442
+ //#region src/annotation/kinds/square/index.ts
1443
+ const SquareDTOSchema = SquareDeclaration.readSchema;
1444
+ const SquareDraftSchema = SquareDeclaration.createSchema;
1445
+ const SquarePatchSchema = SquareDeclaration.updateSchema;
1446
+ const SquareKind = {
1447
+ subtype: "square",
1448
+ pdfSubtypeCode: require_subtype.PdfAnnotationSubtypeCode.SQUARE,
1449
+ dtoSchema: SquareDTOSchema,
1450
+ draftSchema: SquareDraftSchema,
1451
+ patchSchema: SquarePatchSchema,
1452
+ readBackWrites: SquareDeclaration.readBackWrites
1453
+ };
1454
+ //#endregion
1455
+ //#region src/annotation/kinds/squiggly/declaration.ts
1456
+ const SquigglyDeclaration = defineKind("squiggly", textMarkupFields);
1457
+ //#endregion
1458
+ //#region src/annotation/kinds/squiggly/index.ts
1459
+ const SquigglyDTOSchema = SquigglyDeclaration.readSchema;
1460
+ const SquigglyDraftSchema = SquigglyDeclaration.createSchema;
1461
+ const SquigglyPatchSchema = SquigglyDeclaration.updateSchema;
1462
+ const SquigglyKind = {
1463
+ subtype: "squiggly",
1464
+ pdfSubtypeCode: require_subtype.PdfAnnotationSubtypeCode.SQUIGGLY,
1465
+ dtoSchema: SquigglyDTOSchema,
1466
+ draftSchema: SquigglyDraftSchema,
1467
+ patchSchema: SquigglyPatchSchema,
1468
+ readBackWrites: SquigglyDeclaration.readBackWrites
1469
+ };
1470
+ //#endregion
1471
+ //#region src/annotation/kinds/stamp/values.ts
1472
+ const StampFitSchema = zod.z.enum([
1473
+ "contain",
1474
+ "cover",
1475
+ "fill"
1476
+ ]);
1477
+ //#endregion
1478
+ //#region src/annotation/kinds/stamp/declaration.ts
1479
+ const StampDeclaration = defineKind("stamp", {
1480
+ ...annotationBaseFields,
1481
+ ...boxFields,
1482
+ /** `/Name`: the stamp's label, such as `Approved`. */
1483
+ name: field.data(zod.z.string()).nullable().optional(),
1484
+ /**
1485
+ * How the drawing is scaled into the box, and re-fit when the box changes
1486
+ * (`/EMBD_Metadata/AppearanceFit`). `null` when the PDF doesn't record it,
1487
+ * as for a stamp another tool made; the engine then fits with `'fill'`,
1488
+ * the way a PDF places any appearance in its `/Rect`. A create without it
1489
+ * fits with `'contain'` and records that.
1490
+ */
1491
+ fit: field.data(StampFitSchema).nullable().optional(),
1492
+ /** `/CA`, painted once over the whole drawing. */
1493
+ opacity: field.data(zod.z.number().min(0).max(1)).optional()
1494
+ }, { appearance: "required" });
1495
+ //#endregion
1496
+ //#region src/annotation/kinds/stamp/index.ts
1497
+ const StampDTOSchema = StampDeclaration.readSchema;
1498
+ const StampDraftSchema = StampDeclaration.createSchema;
1499
+ const StampPatchSchema = StampDeclaration.updateSchema;
1500
+ const StampKind = {
1501
+ subtype: "stamp",
1502
+ pdfSubtypeCode: require_subtype.PdfAnnotationSubtypeCode.STAMP,
1503
+ dtoSchema: StampDTOSchema,
1504
+ draftSchema: StampDraftSchema,
1505
+ patchSchema: StampPatchSchema,
1506
+ readBackWrites: StampDeclaration.readBackWrites
1507
+ };
1508
+ //#endregion
1509
+ //#region src/annotation/kinds/strikeout/declaration.ts
1510
+ const StrikeoutDeclaration = defineKind("strikeout", {
1511
+ ...textMarkupFields,
1512
+ intent: field.data(StrikeoutIntentSchema).nullable().optional()
1513
+ });
1514
+ //#endregion
1515
+ //#region src/annotation/kinds/strikeout/index.ts
1516
+ const StrikeoutDTOSchema = StrikeoutDeclaration.readSchema;
1517
+ const StrikeoutDraftSchema = StrikeoutDeclaration.createSchema;
1518
+ const StrikeoutPatchSchema = StrikeoutDeclaration.updateSchema;
1519
+ const StrikeoutKind = {
1520
+ subtype: "strikeout",
1521
+ pdfSubtypeCode: require_subtype.PdfAnnotationSubtypeCode.STRIKEOUT,
1522
+ dtoSchema: StrikeoutDTOSchema,
1523
+ draftSchema: StrikeoutDraftSchema,
1524
+ patchSchema: StrikeoutPatchSchema,
1525
+ readBackWrites: StrikeoutDeclaration.readBackWrites
1526
+ };
1527
+ //#endregion
1528
+ //#region src/annotation/kinds/text/values.ts
1529
+ const NoteIconSchema = zod.z.enum([
1530
+ "comment",
1531
+ "key",
1532
+ "note",
1533
+ "help",
1534
+ "new-paragraph",
1535
+ "paragraph",
1536
+ "insert"
1537
+ ]);
1538
+ //#endregion
1539
+ //#region src/annotation/kinds/text/declaration.ts
1540
+ /** A note: its icon fills `rect`, 20×20 at the usual size. */
1541
+ const TextDeclaration = defineKind("text", {
1542
+ ...annotationBaseFields,
1543
+ ...colorStyleFields,
1544
+ icon: field.data(NoteIconSchema).optional(),
1545
+ /**
1546
+ * `/Open`: whether the note's window shows open. Kept equal to its
1547
+ * popup's `open`: a write sets both. `false` when the PDF doesn't say.
1548
+ */
1549
+ open: field.data(zod.z.boolean()).optional(),
1550
+ /** `/State`: standard states in lowercase, custom ones as written. */
1551
+ state: field.data(zod.z.string().min(1)).nullable().optional(),
1552
+ stateModel: field.data(zod.z.string().min(1)).nullable().optional()
1553
+ });
1554
+ //#endregion
1555
+ //#region src/annotation/kinds/text/index.ts
1556
+ const TextDTOSchema = TextDeclaration.readSchema;
1557
+ const TextDraftSchema = TextDeclaration.createSchema;
1558
+ const TextPatchSchema = TextDeclaration.updateSchema;
1559
+ const TextKind = {
1560
+ subtype: "text",
1561
+ pdfSubtypeCode: require_subtype.PdfAnnotationSubtypeCode.TEXT,
1562
+ dtoSchema: TextDTOSchema,
1563
+ draftSchema: TextDraftSchema,
1564
+ patchSchema: TextPatchSchema,
1565
+ readBackWrites: TextDeclaration.readBackWrites
1566
+ };
1567
+ //#endregion
1568
+ //#region src/annotation/kinds/underline/declaration.ts
1569
+ const UnderlineDeclaration = defineKind("underline", textMarkupFields);
1570
+ //#endregion
1571
+ //#region src/annotation/kinds/underline/index.ts
1572
+ const UnderlineDTOSchema = UnderlineDeclaration.readSchema;
1573
+ const UnderlineDraftSchema = UnderlineDeclaration.createSchema;
1574
+ const UnderlinePatchSchema = UnderlineDeclaration.updateSchema;
1575
+ const UnderlineKind = {
1576
+ subtype: "underline",
1577
+ pdfSubtypeCode: require_subtype.PdfAnnotationSubtypeCode.UNDERLINE,
1578
+ dtoSchema: UnderlineDTOSchema,
1579
+ draftSchema: UnderlineDraftSchema,
1580
+ patchSchema: UnderlinePatchSchema,
1581
+ readBackWrites: UnderlineDeclaration.readBackWrites
1582
+ };
1583
+ //#endregion
1584
+ //#region src/annotation/kinds/unsupported/declaration.ts
1585
+ /** An annotation of a type the engine doesn't model: only the shared fields are read. */
1586
+ const UnsupportedDeclaration = defineKind("unsupported", {
1587
+ ...annotationBaseFields,
1588
+ rawSubtypeCode: field.engine(zod.z.number().int()),
1589
+ rawSubtypeName: field.engine(zod.z.string()).nullable()
1590
+ });
1591
+ //#endregion
1592
+ //#region src/annotation/kinds/unsupported/index.ts
1593
+ const UnsupportedDTOSchema = UnsupportedDeclaration.readSchema;
1594
+ const UnsupportedDraftSchema = zod.z.never();
1595
+ const UnsupportedPatchSchema = zod.z.never();
1596
+ const UnsupportedKind = {
1597
+ subtype: "unsupported",
1598
+ pdfSubtypeCode: require_subtype.PdfAnnotationSubtypeCode.UNKNOWN,
1599
+ dtoSchema: UnsupportedDTOSchema,
1600
+ draftSchema: UnsupportedDraftSchema,
1601
+ patchSchema: UnsupportedPatchSchema,
1602
+ readBackWrites: UnsupportedDeclaration.readBackWrites
1603
+ };
1604
+ //#endregion
1605
+ //#region src/identity/FormFieldRef.schema.ts
1606
+ /** Wire form of `FormFieldRef` — see the type. */
1607
+ const FormFieldRefSchema = zod.z.discriminatedUnion("kind", [zod.z.object({
1608
+ kind: zod.z.literal("objectNumber"),
1609
+ objectNumber: zod.z.number().int().positive()
1610
+ }), zod.z.object({
1611
+ kind: zod.z.literal("fqn"),
1612
+ name: zod.z.string().min(1)
1613
+ })]);
1614
+ //#endregion
1615
+ //#region src/annotation/kinds/widget/declaration.ts
1616
+ const WidgetDeclaration = defineKind("widget", {
1617
+ ...annotationBaseFields,
1618
+ ...widgetBoxFields,
1619
+ color: field.data(ColorSchema).nullable().optional(),
1620
+ interiorColor: field.data(ColorSchema).nullable().optional(),
1621
+ strokeWidth: field.data(zod.z.number().nonnegative()).optional(),
1622
+ borderStyle: field.data(WidgetBorderStyleSchema).optional(),
1623
+ /** The border's dash pattern (`/BS /D`), for a dashed border; `null` for the default (3 on, 3 off). */
1624
+ dashArray: field.data(zod.z.array(zod.z.number().nonnegative())).nullable().optional(),
1625
+ /**
1626
+ * The font `/DA` names, as a free text names its font: a standard font's
1627
+ * name, a registered font's key, or the family of a font the document has.
1628
+ * `null` when `/DA` names none. A write takes a standard name or a key.
1629
+ */
1630
+ fontFamily: field.data(FontNameSchema).nullable().optional(),
1631
+ fontSize: field.data(zod.z.number().nonnegative()).nullable().optional(),
1632
+ fontColor: field.data(ColorSchema).nullable().optional(),
1633
+ textAlign: field.data(TextAlignmentSchema).optional(),
1634
+ /**
1635
+ * A push button's caption (`/MK /CA`), drawn centred on the button.
1636
+ * `null` for every other widget, whose `/MK /CA` is no caption (a
1637
+ * checkbox's is its symbol); a caption written to one is refused.
1638
+ */
1639
+ caption: field.data(zod.z.string()).nullable().optional(),
1640
+ /**
1641
+ * The symbol a checkbox's or radio button's widget shows while it's on
1642
+ * (`/MK /CA`); `null` shows its family's own, a checkbox's check and a
1643
+ * radio button's circle. Always `null` for other widgets, and one written
1644
+ * to another widget is refused.
1645
+ */
1646
+ checkStyle: field.data(WidgetCheckStyleSchema).nullable().optional(),
1647
+ /**
1648
+ * `/A` and `/AA`: what the widget does when clicked, entered, focused and
1649
+ * so on. A write sets an event's action, `null` removes it, an event left
1650
+ * out keeps what it has; `null` for the whole removes them all. The
1651
+ * actions a read returns, sent back unchanged, are kept.
1652
+ */
1653
+ actions: field.data(FileAnnotationActionsSchema).writes(FileWidgetActionsPatchSchema).readBack().nullable().optional().space("actions"),
1654
+ /** The field the widget belongs to, or `null` when it's in none. */
1655
+ field: field.engine(FormFieldRefSchema).nullable(),
1656
+ /** Its field's family, so a widget reads as what it is without the form. */
1657
+ fieldFamily: field.engine(zod.z.enum([
1658
+ "text",
1659
+ "checkbox",
1660
+ "radio",
1661
+ "combobox",
1662
+ "listbox",
1663
+ "pushbutton",
1664
+ "signature",
1665
+ "unknown"
1666
+ ]))
1667
+ });
1668
+ //#endregion
1669
+ //#region src/annotation/kinds/widget/index.ts
1670
+ const WidgetDTOSchema = WidgetDeclaration.readSchema;
1671
+ const WidgetDraftSchema = WidgetDeclaration.createSchema;
1672
+ const WidgetPatchSchema = WidgetDeclaration.updateSchema;
1673
+ const WidgetKind = {
1674
+ subtype: "widget",
1675
+ pdfSubtypeCode: require_subtype.PdfAnnotationSubtypeCode.WIDGET,
1676
+ dtoSchema: WidgetDTOSchema,
1677
+ draftSchema: WidgetDraftSchema,
1678
+ patchSchema: WidgetPatchSchema,
1679
+ readBackWrites: WidgetDeclaration.readBackWrites
1680
+ };
1681
+ //#endregion
1682
+ //#region src/annotation/kinds/declarations.ts
1683
+ /** Every annotation kind's declaration, in the engine's catalog order. */
1684
+ const ANNOTATION_DECLARATIONS = [
1685
+ HighlightDeclaration,
1686
+ UnderlineDeclaration,
1687
+ SquigglyDeclaration,
1688
+ StrikeoutDeclaration,
1689
+ CircleDeclaration,
1690
+ SquareDeclaration,
1691
+ PolygonDeclaration,
1692
+ PolylineDeclaration,
1693
+ LineDeclaration,
1694
+ LinkDeclaration,
1695
+ InkDeclaration,
1696
+ FreeTextDeclaration,
1697
+ CaretDeclaration,
1698
+ TextDeclaration,
1699
+ StampDeclaration,
1700
+ FileAttachmentDeclaration,
1701
+ WidgetDeclaration,
1702
+ RedactDeclaration,
1703
+ PopupDeclaration,
1704
+ UnsupportedDeclaration
1705
+ ];
1706
+ /** Looks up a kind's declaration by its `subtype`. */
1707
+ function declarationOf(subtype) {
1708
+ return ANNOTATION_DECLARATIONS.find((declaration) => declaration.subtype === subtype) ?? null;
1709
+ }
1710
+ /** The style fields' schemas, as a widget annotation's update takes them. */
1711
+ const WIDGET_STYLE_SHAPE = Object.fromEntries([
1712
+ "color",
1713
+ "interiorColor",
1714
+ "strokeWidth",
1715
+ "borderStyle",
1716
+ "dashArray",
1717
+ "fontFamily",
1718
+ "fontSize",
1719
+ "fontColor",
1720
+ "textAlign",
1721
+ "caption",
1722
+ "checkStyle"
1723
+ ].map((name) => [name, WidgetDeclaration.shapes.update[name]]));
1724
+ const WidgetAppearanceSchema = zod.z.object(WIDGET_STYLE_SHAPE).strict();
1725
+ //#endregion
1726
+ //#region src/annotation/kinds/index.ts
1727
+ /**
1728
+ * The closed-world catalog of currently-implemented annotation kinds.
1729
+ *
1730
+ * Adding a new subtype is one folder under `kinds/<name>/` with its
1731
+ * `declaration.ts` and `index.ts`, and one entry in this tuple and in
1732
+ * `declarations.ts`. The discriminated unions and zod discriminator below regenerate
1733
+ * automatically; no other file in the package needs to change.
1734
+ *
1735
+ * Every subtype the engine has not yet wired up rides on
1736
+ * `UnsupportedKind`. The wire format is stable: when a per-subtype reader
1737
+ * lands later, the engine starts emitting the dedicated DTO instead of
1738
+ * `unsupported`, and existing clients widen their handling without a
1739
+ * version bump.
1740
+ */
1741
+ const ANNOTATION_KINDS = [
1742
+ HighlightKind,
1743
+ UnderlineKind,
1744
+ SquigglyKind,
1745
+ StrikeoutKind,
1746
+ CircleKind,
1747
+ SquareKind,
1748
+ PolygonKind,
1749
+ PolylineKind,
1750
+ LineKind,
1751
+ LinkKind,
1752
+ InkKind,
1753
+ FreeTextKind,
1754
+ CaretKind,
1755
+ TextKind,
1756
+ StampKind,
1757
+ FileAttachmentKind,
1758
+ WidgetKind,
1759
+ RedactKind,
1760
+ PopupKind,
1761
+ UnsupportedKind
1762
+ ];
1763
+ /**
1764
+ * Lookup helper for the engine's reader catalog and identity resolver.
1765
+ * O(1) by `subtype` literal at runtime.
1766
+ */
1767
+ const KIND_BY_SUBTYPE = Object.freeze(Object.fromEntries(ANNOTATION_KINDS.map((kind) => [kind.subtype, kind])));
1768
+ /**
1769
+ * Runtime zod schema for the discriminated union. The cast unwinds the
1770
+ * generic schema map into the specific tuple form `discriminatedUnion`
1771
+ * needs. Servers and cloud clients use this to validate every annotation
1772
+ * payload on the wire.
1773
+ */
1774
+ const AnnotationSchema = zod.z.discriminatedUnion("subtype", [
1775
+ HighlightKind.dtoSchema,
1776
+ UnderlineKind.dtoSchema,
1777
+ SquigglyKind.dtoSchema,
1778
+ StrikeoutKind.dtoSchema,
1779
+ CircleKind.dtoSchema,
1780
+ SquareKind.dtoSchema,
1781
+ PolygonKind.dtoSchema,
1782
+ PolylineKind.dtoSchema,
1783
+ LineKind.dtoSchema,
1784
+ LinkKind.dtoSchema,
1785
+ InkKind.dtoSchema,
1786
+ FreeTextKind.dtoSchema,
1787
+ CaretKind.dtoSchema,
1788
+ TextKind.dtoSchema,
1789
+ StampKind.dtoSchema,
1790
+ FileAttachmentKind.dtoSchema,
1791
+ WidgetKind.dtoSchema,
1792
+ RedactKind.dtoSchema,
1793
+ PopupKind.dtoSchema,
1794
+ UnsupportedKind.dtoSchema
1795
+ ]);
1796
+ /** Validates a create's data against its kind. */
1797
+ const AnnotationDraftSchema = zod.z.discriminatedUnion("subtype", [
1798
+ HighlightKind.draftSchema,
1799
+ UnderlineKind.draftSchema,
1800
+ SquigglyKind.draftSchema,
1801
+ StrikeoutKind.draftSchema,
1802
+ CircleKind.draftSchema,
1803
+ SquareKind.draftSchema,
1804
+ PolygonKind.draftSchema,
1805
+ PolylineKind.draftSchema,
1806
+ LineKind.draftSchema,
1807
+ LinkKind.draftSchema,
1808
+ InkKind.draftSchema,
1809
+ FreeTextKind.draftSchema,
1810
+ CaretKind.draftSchema,
1811
+ TextKind.draftSchema,
1812
+ StampKind.draftSchema,
1813
+ FileAttachmentKind.draftSchema,
1814
+ WidgetKind.draftSchema,
1815
+ RedactKind.draftSchema,
1816
+ PopupKind.draftSchema
1817
+ ]);
1818
+ /**
1819
+ * Validates a patch against every kind. A
1820
+ * patch may leave out its `subtype`, so this only checks that the patch fits
1821
+ * some kind; {@link annotationPatchSchemaOf} checks it against its target.
1822
+ */
1823
+ const AnnotationPatchSchema = zod.z.union(ANNOTATION_KINDS.filter((kind) => kind.subtype !== "unsupported").map((kind) => kind.patchSchema));
1824
+ /** The patch schema of one kind: how an update of an annotation of that kind is checked. */
1825
+ function annotationPatchSchemaOf(subtype) {
1826
+ return KIND_BY_SUBTYPE[subtype].patchSchema;
1827
+ }
1828
+ /**
1829
+ * A create's data in the file's coordinates, checked against its kind: the
1830
+ * engine's own check, after the worker converted the data from page space.
1831
+ */
1832
+ const FileAnnotationDraftSchema = zod.z.discriminatedUnion("subtype", ANNOTATION_DECLARATIONS.filter((declaration) => declaration.subtype !== "unsupported").map((declaration) => declaration.fileSchemas.create));
1833
+ /** An update's data in the file's coordinates, checked against the kind it changes. */
1834
+ function fileAnnotationPatchSchemaOf(subtype) {
1835
+ return declarationOf(subtype).fileSchemas.update;
1836
+ }
1837
+ //#endregion
1838
+ //#region src/forms/schema.ts
1839
+ const FormWidgetShape = {
1840
+ ref: AnnotationRefSchema.nullable(),
1841
+ objectNumber: zod.z.number().int().nonnegative(),
1842
+ page: PageRefSchema.nullable()
1843
+ };
1844
+ const FormWidgetSchema = zod.z.object(FormWidgetShape);
1845
+ const FormFieldWidgetSchema = FormWidgetSchema;
1846
+ const ToggleFieldWidgetSchema = zod.z.object({
1847
+ ...FormWidgetShape,
1848
+ onState: zod.z.string(),
1849
+ exportValue: zod.z.string(),
1850
+ checked: zod.z.boolean()
1851
+ });
1852
+ const FormFieldOptionSchema = zod.z.object({
1853
+ label: zod.z.string(),
1854
+ value: zod.z.string(),
1855
+ selected: zod.z.boolean()
1856
+ });
1857
+ const FormValueEntrySchema = zod.z.discriminatedUnion("kind", [
1858
+ zod.z.object({ kind: zod.z.literal("none") }),
1859
+ zod.z.object({
1860
+ kind: zod.z.literal("scalar"),
1861
+ value: zod.z.string()
1862
+ }),
1863
+ zod.z.object({
1864
+ kind: zod.z.literal("array"),
1865
+ values: zod.z.array(zod.z.string())
1866
+ }),
1867
+ zod.z.object({ kind: zod.z.literal("unsupported") })
1868
+ ]);
1869
+ const FormFieldBaseShape = {
1870
+ ref: FormFieldRefSchema,
1871
+ name: zod.z.string(),
1872
+ origin: zod.z.enum(["acroform", "recovered"]),
1873
+ readOnly: zod.z.boolean(),
1874
+ required: zod.z.boolean(),
1875
+ noExport: zod.z.boolean(),
1876
+ alternateName: zod.z.string().nullable(),
1877
+ mappingName: zod.z.string().nullable(),
1878
+ valueEntry: FormValueEntrySchema,
1879
+ defaultValueEntry: FormValueEntrySchema,
1880
+ actions: PdfFieldActionsSchema.optional(),
1881
+ groupId: zod.z.string().nullable(),
1882
+ createdBy: zod.z.string().nullable(),
1883
+ createdAt: IsoDateTimeSchema.nullable(),
1884
+ filledBy: zod.z.string().nullable(),
1885
+ filledByName: zod.z.string().nullable(),
1886
+ filledAt: IsoDateTimeSchema.nullable(),
1887
+ importedBy: zod.z.string().nullable(),
1888
+ widgets: zod.z.array(FormFieldWidgetSchema)
1889
+ };
1890
+ const FormFieldDTOSchema = zod.z.discriminatedUnion("family", [
1891
+ zod.z.object({
1892
+ ...FormFieldBaseShape,
1893
+ family: zod.z.literal("text"),
1894
+ value: zod.z.string(),
1895
+ defaultValue: zod.z.string(),
1896
+ maxLength: zod.z.number().int().positive().nullable(),
1897
+ multiline: zod.z.boolean(),
1898
+ password: zod.z.boolean(),
1899
+ comb: zod.z.boolean()
1900
+ }),
1901
+ zod.z.object({
1902
+ ...FormFieldBaseShape,
1903
+ family: zod.z.literal("checkbox"),
1904
+ checked: zod.z.boolean(),
1905
+ exportValue: zod.z.string(),
1906
+ widgets: zod.z.array(ToggleFieldWidgetSchema)
1907
+ }),
1908
+ zod.z.object({
1909
+ ...FormFieldBaseShape,
1910
+ family: zod.z.literal("radio"),
1911
+ value: zod.z.string(),
1912
+ radiosInUnison: zod.z.boolean(),
1913
+ noToggleToOff: zod.z.boolean(),
1914
+ widgets: zod.z.array(ToggleFieldWidgetSchema)
1915
+ }),
1916
+ zod.z.object({
1917
+ ...FormFieldBaseShape,
1918
+ family: zod.z.literal("combobox"),
1919
+ value: zod.z.string(),
1920
+ defaultValue: zod.z.string(),
1921
+ edit: zod.z.boolean(),
1922
+ options: zod.z.array(FormFieldOptionSchema)
1923
+ }),
1924
+ zod.z.object({
1925
+ ...FormFieldBaseShape,
1926
+ family: zod.z.literal("listbox"),
1927
+ selectedValues: zod.z.array(zod.z.string()),
1928
+ defaultValue: zod.z.array(zod.z.string()),
1929
+ multiSelect: zod.z.boolean(),
1930
+ options: zod.z.array(FormFieldOptionSchema),
1931
+ topIndex: zod.z.number().int().nonnegative()
1932
+ }),
1933
+ zod.z.object({
1934
+ ...FormFieldBaseShape,
1935
+ family: zod.z.literal("pushbutton")
1936
+ }),
1937
+ zod.z.object({
1938
+ ...FormFieldBaseShape,
1939
+ family: zod.z.literal("signature")
1940
+ }),
1941
+ zod.z.object({
1942
+ ...FormFieldBaseShape,
1943
+ family: zod.z.literal("unknown"),
1944
+ rawValue: zod.z.string()
1945
+ })
1946
+ ]);
1947
+ const FormKindSchema = zod.z.enum([
1948
+ "none",
1949
+ "acroform",
1950
+ "xfa"
1951
+ ]);
1952
+ const FormSnapshotSchema = zod.z.object({
1953
+ formKind: FormKindSchema,
1954
+ needsAppearances: zod.z.boolean(),
1955
+ fields: zod.z.array(FormFieldDTOSchema),
1956
+ widgets: zod.z.array(WidgetDTOSchema),
1957
+ calculationOrder: zod.z.array(FormFieldRefSchema.nullable())
1958
+ });
1959
+ /**
1960
+ * `{ value }`, `{ checked }` or `{ selectedValues }`: one object with exactly
1961
+ * one of the three, so the wire has no untagged union (the API reference
1962
+ * labels variants by a discriminating literal, and a value has none to add).
1963
+ */
1964
+ const FormFieldValueSchema = zod.z.object({
1965
+ value: zod.z.string().nullable().optional(),
1966
+ checked: zod.z.boolean().optional(),
1967
+ selectedValues: zod.z.array(zod.z.string()).optional()
1968
+ }).strict().refine((value) => [
1969
+ value.value,
1970
+ value.checked,
1971
+ value.selectedValues
1972
+ ].filter((set) => set !== void 0).length === 1, { message: "exactly one of value, checked or selectedValues" });
1973
+ const WidgetPlacementSchema = zod.z.object({
1974
+ page: PageRefSchema,
1975
+ rect: PageBoxSchema.optional(),
1976
+ box: PageBoxSchema.optional(),
1977
+ rotation: PdfRotationSchema.optional(),
1978
+ exportValue: zod.z.string().min(1).optional(),
1979
+ actions: WidgetActionsPatchSchema.optional(),
1980
+ ...WIDGET_STYLE_SHAPE
1981
+ }).strict();
1982
+ const FormFieldOptionInputSchema = zod.z.object({
1983
+ label: zod.z.string(),
1984
+ value: zod.z.string()
1985
+ });
1986
+ const FormFieldDraftBaseShape = {
1987
+ name: zod.z.string().min(1),
1988
+ readOnly: zod.z.boolean().optional(),
1989
+ required: zod.z.boolean().optional(),
1990
+ noExport: zod.z.boolean().optional(),
1991
+ alternateName: zod.z.string().optional(),
1992
+ mappingName: zod.z.string().optional(),
1993
+ groupId: zod.z.string().min(1).max(256).optional(),
1994
+ actions: FieldActionsPatchSchema.optional(),
1995
+ widgets: zod.z.array(WidgetPlacementSchema).optional()
1996
+ };
1997
+ /** A draft that names a member its family doesn't have is refused, not trimmed. */
1998
+ const FormFieldDraftSchema = zod.z.discriminatedUnion("family", [
1999
+ zod.z.object({
2000
+ ...FormFieldDraftBaseShape,
2001
+ family: zod.z.literal("text"),
2002
+ defaultValue: zod.z.string().optional(),
2003
+ maxLength: zod.z.number().int().positive().optional(),
2004
+ multiline: zod.z.boolean().optional(),
2005
+ password: zod.z.boolean().optional(),
2006
+ comb: zod.z.boolean().optional()
2007
+ }).strict(),
2008
+ zod.z.object({
2009
+ ...FormFieldDraftBaseShape,
2010
+ family: zod.z.literal("checkbox")
2011
+ }).strict(),
2012
+ zod.z.object({
2013
+ ...FormFieldDraftBaseShape,
2014
+ family: zod.z.literal("radio"),
2015
+ radiosInUnison: zod.z.boolean().optional(),
2016
+ noToggleToOff: zod.z.boolean().optional()
2017
+ }).strict(),
2018
+ zod.z.object({
2019
+ ...FormFieldDraftBaseShape,
2020
+ family: zod.z.literal("combobox"),
2021
+ edit: zod.z.boolean().optional(),
2022
+ options: zod.z.array(FormFieldOptionInputSchema).optional(),
2023
+ defaultValue: zod.z.string().optional()
2024
+ }).strict(),
2025
+ zod.z.object({
2026
+ ...FormFieldDraftBaseShape,
2027
+ family: zod.z.literal("listbox"),
2028
+ multiSelect: zod.z.boolean().optional(),
2029
+ options: zod.z.array(FormFieldOptionInputSchema).optional(),
2030
+ defaultValue: zod.z.array(zod.z.string()).optional()
2031
+ }).strict(),
2032
+ zod.z.object({
2033
+ ...FormFieldDraftBaseShape,
2034
+ family: zod.z.literal("pushbutton")
2035
+ }).strict(),
2036
+ zod.z.object({
2037
+ ...FormFieldDraftBaseShape,
2038
+ family: zod.z.literal("signature")
2039
+ }).strict()
2040
+ ]);
2041
+ const FormFieldPatchBaseShape = {
2042
+ name: zod.z.string().min(1).optional(),
2043
+ readOnly: zod.z.boolean().optional(),
2044
+ required: zod.z.boolean().optional(),
2045
+ noExport: zod.z.boolean().optional(),
2046
+ alternateName: zod.z.string().nullable().optional(),
2047
+ mappingName: zod.z.string().nullable().optional(),
2048
+ groupId: zod.z.string().min(1).max(256).optional(),
2049
+ actions: FieldActionsPatchSchema.optional()
2050
+ };
2051
+ /**
2052
+ * One object on the wire: the family is optional (the engine knows it from
2053
+ * the ref), so there is no discriminator, and the engine refuses members
2054
+ * the field's family doesn't have.
2055
+ */
2056
+ const FormFieldPatchSchema = zod.z.object({
2057
+ ...FormFieldPatchBaseShape,
2058
+ family: zod.z.enum([
2059
+ "text",
2060
+ "checkbox",
2061
+ "radio",
2062
+ "combobox",
2063
+ "listbox",
2064
+ "pushbutton",
2065
+ "signature"
2066
+ ]).optional(),
2067
+ defaultValue: zod.z.union([zod.z.string(), zod.z.array(zod.z.string())]).nullable().optional(),
2068
+ maxLength: zod.z.number().int().positive().nullable().optional(),
2069
+ multiline: zod.z.boolean().optional(),
2070
+ password: zod.z.boolean().optional(),
2071
+ comb: zod.z.boolean().optional(),
2072
+ radiosInUnison: zod.z.boolean().optional(),
2073
+ noToggleToOff: zod.z.boolean().optional(),
2074
+ edit: zod.z.boolean().optional(),
2075
+ multiSelect: zod.z.boolean().optional(),
2076
+ options: zod.z.array(FormFieldOptionInputSchema).optional()
2077
+ }).strict();
2078
+ //#endregion
2079
+ Object.defineProperty(exports, "ANNOTATION_KINDS", {
2080
+ enumerable: true,
2081
+ get: function() {
2082
+ return ANNOTATION_KINDS;
2083
+ }
2084
+ });
2085
+ Object.defineProperty(exports, "AnnotationBorderStyleSchema", {
2086
+ enumerable: true,
2087
+ get: function() {
2088
+ return AnnotationBorderStyleSchema;
2089
+ }
2090
+ });
2091
+ Object.defineProperty(exports, "AnnotationDraftSchema", {
2092
+ enumerable: true,
2093
+ get: function() {
2094
+ return AnnotationDraftSchema;
2095
+ }
2096
+ });
2097
+ Object.defineProperty(exports, "AnnotationPatchSchema", {
2098
+ enumerable: true,
2099
+ get: function() {
2100
+ return AnnotationPatchSchema;
2101
+ }
2102
+ });
2103
+ Object.defineProperty(exports, "AnnotationRefSchema", {
2104
+ enumerable: true,
2105
+ get: function() {
2106
+ return AnnotationRefSchema;
2107
+ }
2108
+ });
2109
+ Object.defineProperty(exports, "AnnotationResourceKeysSchema", {
2110
+ enumerable: true,
2111
+ get: function() {
2112
+ return AnnotationResourceKeysSchema;
2113
+ }
2114
+ });
2115
+ Object.defineProperty(exports, "AnnotationSchema", {
2116
+ enumerable: true,
2117
+ get: function() {
2118
+ return AnnotationSchema;
2119
+ }
2120
+ });
2121
+ Object.defineProperty(exports, "AppearanceResourceKeysSchema", {
2122
+ enumerable: true,
2123
+ get: function() {
2124
+ return AppearanceResourceKeysSchema;
2125
+ }
2126
+ });
2127
+ Object.defineProperty(exports, "AttachmentFileInfoSchema", {
2128
+ enumerable: true,
2129
+ get: function() {
2130
+ return AttachmentFileInfoSchema;
2131
+ }
2132
+ });
2133
+ Object.defineProperty(exports, "AttachmentRefSchema", {
2134
+ enumerable: true,
2135
+ get: function() {
2136
+ return AttachmentRefSchema;
2137
+ }
2138
+ });
2139
+ Object.defineProperty(exports, "AttachmentSchema", {
2140
+ enumerable: true,
2141
+ get: function() {
2142
+ return AttachmentSchema;
2143
+ }
2144
+ });
2145
+ Object.defineProperty(exports, "BlendModeSchema", {
2146
+ enumerable: true,
2147
+ get: function() {
2148
+ return BlendModeSchema;
2149
+ }
2150
+ });
2151
+ Object.defineProperty(exports, "CalloutLineSchema", {
2152
+ enumerable: true,
2153
+ get: function() {
2154
+ return CalloutLineSchema;
2155
+ }
2156
+ });
2157
+ Object.defineProperty(exports, "CaretDTOSchema", {
2158
+ enumerable: true,
2159
+ get: function() {
2160
+ return CaretDTOSchema;
2161
+ }
2162
+ });
2163
+ Object.defineProperty(exports, "CaretDraftSchema", {
2164
+ enumerable: true,
2165
+ get: function() {
2166
+ return CaretDraftSchema;
2167
+ }
2168
+ });
2169
+ Object.defineProperty(exports, "CaretIntentSchema", {
2170
+ enumerable: true,
2171
+ get: function() {
2172
+ return CaretIntentSchema;
2173
+ }
2174
+ });
2175
+ Object.defineProperty(exports, "CaretPatchSchema", {
2176
+ enumerable: true,
2177
+ get: function() {
2178
+ return CaretPatchSchema;
2179
+ }
2180
+ });
2181
+ Object.defineProperty(exports, "CircleDTOSchema", {
2182
+ enumerable: true,
2183
+ get: function() {
2184
+ return CircleDTOSchema;
2185
+ }
2186
+ });
2187
+ Object.defineProperty(exports, "CircleDraftSchema", {
2188
+ enumerable: true,
2189
+ get: function() {
2190
+ return CircleDraftSchema;
2191
+ }
2192
+ });
2193
+ Object.defineProperty(exports, "CirclePatchSchema", {
2194
+ enumerable: true,
2195
+ get: function() {
2196
+ return CirclePatchSchema;
2197
+ }
2198
+ });
2199
+ Object.defineProperty(exports, "ColorSchema", {
2200
+ enumerable: true,
2201
+ get: function() {
2202
+ return ColorSchema;
2203
+ }
2204
+ });
2205
+ Object.defineProperty(exports, "DateInputSchema", {
2206
+ enumerable: true,
2207
+ get: function() {
2208
+ return DateInputSchema;
2209
+ }
2210
+ });
2211
+ Object.defineProperty(exports, "DocumentActionsSnapshotSchema", {
2212
+ enumerable: true,
2213
+ get: function() {
2214
+ return DocumentActionsSnapshotSchema;
2215
+ }
2216
+ });
2217
+ Object.defineProperty(exports, "DrawnBorderStyleSchema", {
2218
+ enumerable: true,
2219
+ get: function() {
2220
+ return DrawnBorderStyleSchema;
2221
+ }
2222
+ });
2223
+ Object.defineProperty(exports, "FieldActionsPatchSchema", {
2224
+ enumerable: true,
2225
+ get: function() {
2226
+ return FieldActionsPatchSchema;
2227
+ }
2228
+ });
2229
+ Object.defineProperty(exports, "FieldScriptWriteSchema", {
2230
+ enumerable: true,
2231
+ get: function() {
2232
+ return FieldScriptWriteSchema;
2233
+ }
2234
+ });
2235
+ Object.defineProperty(exports, "FileAnnotationDraftSchema", {
2236
+ enumerable: true,
2237
+ get: function() {
2238
+ return FileAnnotationDraftSchema;
2239
+ }
2240
+ });
2241
+ Object.defineProperty(exports, "FileAttachmentDTOSchema", {
2242
+ enumerable: true,
2243
+ get: function() {
2244
+ return FileAttachmentDTOSchema;
2245
+ }
2246
+ });
2247
+ Object.defineProperty(exports, "FileAttachmentDraftSchema", {
2248
+ enumerable: true,
2249
+ get: function() {
2250
+ return FileAttachmentDraftSchema;
2251
+ }
2252
+ });
2253
+ Object.defineProperty(exports, "FileAttachmentIconSchema", {
2254
+ enumerable: true,
2255
+ get: function() {
2256
+ return FileAttachmentIconSchema;
2257
+ }
2258
+ });
2259
+ Object.defineProperty(exports, "FileAttachmentPatchSchema", {
2260
+ enumerable: true,
2261
+ get: function() {
2262
+ return FileAttachmentPatchSchema;
2263
+ }
2264
+ });
2265
+ Object.defineProperty(exports, "FileResourceKeysSchema", {
2266
+ enumerable: true,
2267
+ get: function() {
2268
+ return FileResourceKeysSchema;
2269
+ }
2270
+ });
2271
+ Object.defineProperty(exports, "FileWidgetActionsPatchSchema", {
2272
+ enumerable: true,
2273
+ get: function() {
2274
+ return FileWidgetActionsPatchSchema;
2275
+ }
2276
+ });
2277
+ Object.defineProperty(exports, "FormFieldDTOSchema", {
2278
+ enumerable: true,
2279
+ get: function() {
2280
+ return FormFieldDTOSchema;
2281
+ }
2282
+ });
2283
+ Object.defineProperty(exports, "FormFieldDraftSchema", {
2284
+ enumerable: true,
2285
+ get: function() {
2286
+ return FormFieldDraftSchema;
2287
+ }
2288
+ });
2289
+ Object.defineProperty(exports, "FormFieldOptionInputSchema", {
2290
+ enumerable: true,
2291
+ get: function() {
2292
+ return FormFieldOptionInputSchema;
2293
+ }
2294
+ });
2295
+ Object.defineProperty(exports, "FormFieldOptionSchema", {
2296
+ enumerable: true,
2297
+ get: function() {
2298
+ return FormFieldOptionSchema;
2299
+ }
2300
+ });
2301
+ Object.defineProperty(exports, "FormFieldPatchSchema", {
2302
+ enumerable: true,
2303
+ get: function() {
2304
+ return FormFieldPatchSchema;
2305
+ }
2306
+ });
2307
+ Object.defineProperty(exports, "FormFieldRefSchema", {
2308
+ enumerable: true,
2309
+ get: function() {
2310
+ return FormFieldRefSchema;
2311
+ }
2312
+ });
2313
+ Object.defineProperty(exports, "FormFieldValueSchema", {
2314
+ enumerable: true,
2315
+ get: function() {
2316
+ return FormFieldValueSchema;
2317
+ }
2318
+ });
2319
+ Object.defineProperty(exports, "FormFieldWidgetSchema", {
2320
+ enumerable: true,
2321
+ get: function() {
2322
+ return FormFieldWidgetSchema;
2323
+ }
2324
+ });
2325
+ Object.defineProperty(exports, "FormKindSchema", {
2326
+ enumerable: true,
2327
+ get: function() {
2328
+ return FormKindSchema;
2329
+ }
2330
+ });
2331
+ Object.defineProperty(exports, "FormSnapshotSchema", {
2332
+ enumerable: true,
2333
+ get: function() {
2334
+ return FormSnapshotSchema;
2335
+ }
2336
+ });
2337
+ Object.defineProperty(exports, "FormValueEntrySchema", {
2338
+ enumerable: true,
2339
+ get: function() {
2340
+ return FormValueEntrySchema;
2341
+ }
2342
+ });
2343
+ Object.defineProperty(exports, "FormWidgetSchema", {
2344
+ enumerable: true,
2345
+ get: function() {
2346
+ return FormWidgetSchema;
2347
+ }
2348
+ });
2349
+ Object.defineProperty(exports, "FreeTextDTOSchema", {
2350
+ enumerable: true,
2351
+ get: function() {
2352
+ return FreeTextDTOSchema;
2353
+ }
2354
+ });
2355
+ Object.defineProperty(exports, "FreeTextDraftSchema", {
2356
+ enumerable: true,
2357
+ get: function() {
2358
+ return FreeTextDraftSchema;
2359
+ }
2360
+ });
2361
+ Object.defineProperty(exports, "FreeTextIntentSchema", {
2362
+ enumerable: true,
2363
+ get: function() {
2364
+ return FreeTextIntentSchema;
2365
+ }
2366
+ });
2367
+ Object.defineProperty(exports, "FreeTextIntentWriteSchema", {
2368
+ enumerable: true,
2369
+ get: function() {
2370
+ return FreeTextIntentWriteSchema;
2371
+ }
2372
+ });
2373
+ Object.defineProperty(exports, "FreeTextPatchSchema", {
2374
+ enumerable: true,
2375
+ get: function() {
2376
+ return FreeTextPatchSchema;
2377
+ }
2378
+ });
2379
+ Object.defineProperty(exports, "HighlightDTOSchema", {
2380
+ enumerable: true,
2381
+ get: function() {
2382
+ return HighlightDTOSchema;
2383
+ }
2384
+ });
2385
+ Object.defineProperty(exports, "HighlightDraftSchema", {
2386
+ enumerable: true,
2387
+ get: function() {
2388
+ return HighlightDraftSchema;
2389
+ }
2390
+ });
2391
+ Object.defineProperty(exports, "HighlightPatchSchema", {
2392
+ enumerable: true,
2393
+ get: function() {
2394
+ return HighlightPatchSchema;
2395
+ }
2396
+ });
2397
+ Object.defineProperty(exports, "ImageResourceKeysSchema", {
2398
+ enumerable: true,
2399
+ get: function() {
2400
+ return ImageResourceKeysSchema;
2401
+ }
2402
+ });
2403
+ Object.defineProperty(exports, "InkDTOSchema", {
2404
+ enumerable: true,
2405
+ get: function() {
2406
+ return InkDTOSchema;
2407
+ }
2408
+ });
2409
+ Object.defineProperty(exports, "InkDraftSchema", {
2410
+ enumerable: true,
2411
+ get: function() {
2412
+ return InkDraftSchema;
2413
+ }
2414
+ });
2415
+ Object.defineProperty(exports, "InkIntentSchema", {
2416
+ enumerable: true,
2417
+ get: function() {
2418
+ return InkIntentSchema;
2419
+ }
2420
+ });
2421
+ Object.defineProperty(exports, "InkListSchema", {
2422
+ enumerable: true,
2423
+ get: function() {
2424
+ return InkListSchema;
2425
+ }
2426
+ });
2427
+ Object.defineProperty(exports, "InkPatchSchema", {
2428
+ enumerable: true,
2429
+ get: function() {
2430
+ return InkPatchSchema;
2431
+ }
2432
+ });
2433
+ Object.defineProperty(exports, "IsoDateTimeSchema", {
2434
+ enumerable: true,
2435
+ get: function() {
2436
+ return IsoDateTimeSchema;
2437
+ }
2438
+ });
2439
+ Object.defineProperty(exports, "KIND_BY_SUBTYPE", {
2440
+ enumerable: true,
2441
+ get: function() {
2442
+ return KIND_BY_SUBTYPE;
2443
+ }
2444
+ });
2445
+ Object.defineProperty(exports, "LineCaptionPatchSchema", {
2446
+ enumerable: true,
2447
+ get: function() {
2448
+ return LineCaptionPatchSchema;
2449
+ }
2450
+ });
2451
+ Object.defineProperty(exports, "LineDTOSchema", {
2452
+ enumerable: true,
2453
+ get: function() {
2454
+ return LineDTOSchema;
2455
+ }
2456
+ });
2457
+ Object.defineProperty(exports, "LineDimensionCaptionSchema", {
2458
+ enumerable: true,
2459
+ get: function() {
2460
+ return LineDimensionCaptionSchema;
2461
+ }
2462
+ });
2463
+ Object.defineProperty(exports, "LineDraftSchema", {
2464
+ enumerable: true,
2465
+ get: function() {
2466
+ return LineDraftSchema;
2467
+ }
2468
+ });
2469
+ Object.defineProperty(exports, "LineEndingSchema", {
2470
+ enumerable: true,
2471
+ get: function() {
2472
+ return LineEndingSchema;
2473
+ }
2474
+ });
2475
+ Object.defineProperty(exports, "LineEndingsSchema", {
2476
+ enumerable: true,
2477
+ get: function() {
2478
+ return LineEndingsSchema;
2479
+ }
2480
+ });
2481
+ Object.defineProperty(exports, "LineIntentSchema", {
2482
+ enumerable: true,
2483
+ get: function() {
2484
+ return LineIntentSchema;
2485
+ }
2486
+ });
2487
+ Object.defineProperty(exports, "LineLeaderSchema", {
2488
+ enumerable: true,
2489
+ get: function() {
2490
+ return LineLeaderSchema;
2491
+ }
2492
+ });
2493
+ Object.defineProperty(exports, "LinePatchSchema", {
2494
+ enumerable: true,
2495
+ get: function() {
2496
+ return LinePatchSchema;
2497
+ }
2498
+ });
2499
+ Object.defineProperty(exports, "LinePointsSchema", {
2500
+ enumerable: true,
2501
+ get: function() {
2502
+ return LinePointsSchema;
2503
+ }
2504
+ });
2505
+ Object.defineProperty(exports, "LinkDTOSchema", {
2506
+ enumerable: true,
2507
+ get: function() {
2508
+ return LinkDTOSchema;
2509
+ }
2510
+ });
2511
+ Object.defineProperty(exports, "LinkDraftSchema", {
2512
+ enumerable: true,
2513
+ get: function() {
2514
+ return LinkDraftSchema;
2515
+ }
2516
+ });
2517
+ Object.defineProperty(exports, "LinkPatchSchema", {
2518
+ enumerable: true,
2519
+ get: function() {
2520
+ return LinkPatchSchema;
2521
+ }
2522
+ });
2523
+ Object.defineProperty(exports, "NoteIconSchema", {
2524
+ enumerable: true,
2525
+ get: function() {
2526
+ return NoteIconSchema;
2527
+ }
2528
+ });
2529
+ Object.defineProperty(exports, "PageBoxSchema", {
2530
+ enumerable: true,
2531
+ get: function() {
2532
+ return PageBoxSchema;
2533
+ }
2534
+ });
2535
+ Object.defineProperty(exports, "PageMeasurementViewportListSchema", {
2536
+ enumerable: true,
2537
+ get: function() {
2538
+ return PageMeasurementViewportListSchema;
2539
+ }
2540
+ });
2541
+ Object.defineProperty(exports, "PageMeasurementViewportSchema", {
2542
+ enumerable: true,
2543
+ get: function() {
2544
+ return PageMeasurementViewportSchema;
2545
+ }
2546
+ });
2547
+ Object.defineProperty(exports, "PagePointSchema", {
2548
+ enumerable: true,
2549
+ get: function() {
2550
+ return PagePointSchema;
2551
+ }
2552
+ });
2553
+ Object.defineProperty(exports, "PageQuadSchema", {
2554
+ enumerable: true,
2555
+ get: function() {
2556
+ return PageQuadSchema;
2557
+ }
2558
+ });
2559
+ Object.defineProperty(exports, "PageRefSchema", {
2560
+ enumerable: true,
2561
+ get: function() {
2562
+ return PageRefSchema;
2563
+ }
2564
+ });
2565
+ Object.defineProperty(exports, "PageScaleInputSchema", {
2566
+ enumerable: true,
2567
+ get: function() {
2568
+ return PageScaleInputSchema;
2569
+ }
2570
+ });
2571
+ Object.defineProperty(exports, "PdfActionNodeSchema", {
2572
+ enumerable: true,
2573
+ get: function() {
2574
+ return PdfActionNodeSchema;
2575
+ }
2576
+ });
2577
+ Object.defineProperty(exports, "PdfActionTargetRefSchema", {
2578
+ enumerable: true,
2579
+ get: function() {
2580
+ return PdfActionTargetRefSchema;
2581
+ }
2582
+ });
2583
+ Object.defineProperty(exports, "PdfActionTreeSchema", {
2584
+ enumerable: true,
2585
+ get: function() {
2586
+ return PdfActionTreeSchema;
2587
+ }
2588
+ });
2589
+ Object.defineProperty(exports, "PdfActionTypeSchema", {
2590
+ enumerable: true,
2591
+ get: function() {
2592
+ return PdfActionTypeSchema;
2593
+ }
2594
+ });
2595
+ Object.defineProperty(exports, "PdfActionWireComponents", {
2596
+ enumerable: true,
2597
+ get: function() {
2598
+ return PdfActionWireComponents;
2599
+ }
2600
+ });
2601
+ Object.defineProperty(exports, "PdfActionWriteSchema", {
2602
+ enumerable: true,
2603
+ get: function() {
2604
+ return PdfActionWriteSchema;
2605
+ }
2606
+ });
2607
+ Object.defineProperty(exports, "PdfAnnotationActionsSchema", {
2608
+ enumerable: true,
2609
+ get: function() {
2610
+ return PdfAnnotationActionsSchema;
2611
+ }
2612
+ });
2613
+ Object.defineProperty(exports, "PdfDestinationSchema", {
2614
+ enumerable: true,
2615
+ get: function() {
2616
+ return PdfDestinationSchema;
2617
+ }
2618
+ });
2619
+ Object.defineProperty(exports, "PdfFieldActionsSchema", {
2620
+ enumerable: true,
2621
+ get: function() {
2622
+ return PdfFieldActionsSchema;
2623
+ }
2624
+ });
2625
+ Object.defineProperty(exports, "PdfForeignMeasureSchema", {
2626
+ enumerable: true,
2627
+ get: function() {
2628
+ return PdfForeignMeasureSchema;
2629
+ }
2630
+ });
2631
+ Object.defineProperty(exports, "PdfLinkTargetSchema", {
2632
+ enumerable: true,
2633
+ get: function() {
2634
+ return PdfLinkTargetSchema;
2635
+ }
2636
+ });
2637
+ Object.defineProperty(exports, "PdfLinkTargetWritableSchema", {
2638
+ enumerable: true,
2639
+ get: function() {
2640
+ return PdfLinkTargetWritableSchema;
2641
+ }
2642
+ });
2643
+ Object.defineProperty(exports, "PdfMeasureSchema", {
2644
+ enumerable: true,
2645
+ get: function() {
2646
+ return PdfMeasureSchema;
2647
+ }
2648
+ });
2649
+ Object.defineProperty(exports, "PdfMeasureWriteSchema", {
2650
+ enumerable: true,
2651
+ get: function() {
2652
+ return PdfMeasureWriteSchema;
2653
+ }
2654
+ });
2655
+ Object.defineProperty(exports, "PdfMeasurementSchema", {
2656
+ enumerable: true,
2657
+ get: function() {
2658
+ return PdfMeasurementSchema;
2659
+ }
2660
+ });
2661
+ Object.defineProperty(exports, "PdfNumberFormatSchema", {
2662
+ enumerable: true,
2663
+ get: function() {
2664
+ return PdfNumberFormatSchema;
2665
+ }
2666
+ });
2667
+ Object.defineProperty(exports, "PdfPageActionsSchema", {
2668
+ enumerable: true,
2669
+ get: function() {
2670
+ return PdfPageActionsSchema;
2671
+ }
2672
+ });
2673
+ Object.defineProperty(exports, "PdfPointSchema", {
2674
+ enumerable: true,
2675
+ get: function() {
2676
+ return PdfPointSchema;
2677
+ }
2678
+ });
2679
+ Object.defineProperty(exports, "PdfQuadSchema", {
2680
+ enumerable: true,
2681
+ get: function() {
2682
+ return PdfQuadSchema;
2683
+ }
2684
+ });
2685
+ Object.defineProperty(exports, "PdfRectSchema", {
2686
+ enumerable: true,
2687
+ get: function() {
2688
+ return PdfRectSchema;
2689
+ }
2690
+ });
2691
+ Object.defineProperty(exports, "PdfRotationSchema", {
2692
+ enumerable: true,
2693
+ get: function() {
2694
+ return PdfRotationSchema;
2695
+ }
2696
+ });
2697
+ Object.defineProperty(exports, "PdfSizeSchema", {
2698
+ enumerable: true,
2699
+ get: function() {
2700
+ return PdfSizeSchema;
2701
+ }
2702
+ });
2703
+ Object.defineProperty(exports, "PointSchema", {
2704
+ enumerable: true,
2705
+ get: function() {
2706
+ return PointSchema;
2707
+ }
2708
+ });
2709
+ Object.defineProperty(exports, "PolygonDTOSchema", {
2710
+ enumerable: true,
2711
+ get: function() {
2712
+ return PolygonDTOSchema;
2713
+ }
2714
+ });
2715
+ Object.defineProperty(exports, "PolygonDraftSchema", {
2716
+ enumerable: true,
2717
+ get: function() {
2718
+ return PolygonDraftSchema;
2719
+ }
2720
+ });
2721
+ Object.defineProperty(exports, "PolygonIntentSchema", {
2722
+ enumerable: true,
2723
+ get: function() {
2724
+ return PolygonIntentSchema;
2725
+ }
2726
+ });
2727
+ Object.defineProperty(exports, "PolygonPatchSchema", {
2728
+ enumerable: true,
2729
+ get: function() {
2730
+ return PolygonPatchSchema;
2731
+ }
2732
+ });
2733
+ Object.defineProperty(exports, "PolylineDTOSchema", {
2734
+ enumerable: true,
2735
+ get: function() {
2736
+ return PolylineDTOSchema;
2737
+ }
2738
+ });
2739
+ Object.defineProperty(exports, "PolylineDraftSchema", {
2740
+ enumerable: true,
2741
+ get: function() {
2742
+ return PolylineDraftSchema;
2743
+ }
2744
+ });
2745
+ Object.defineProperty(exports, "PolylineIntentSchema", {
2746
+ enumerable: true,
2747
+ get: function() {
2748
+ return PolylineIntentSchema;
2749
+ }
2750
+ });
2751
+ Object.defineProperty(exports, "PolylinePatchSchema", {
2752
+ enumerable: true,
2753
+ get: function() {
2754
+ return PolylinePatchSchema;
2755
+ }
2756
+ });
2757
+ Object.defineProperty(exports, "PopupDTOSchema", {
2758
+ enumerable: true,
2759
+ get: function() {
2760
+ return PopupDTOSchema;
2761
+ }
2762
+ });
2763
+ Object.defineProperty(exports, "PopupDraftSchema", {
2764
+ enumerable: true,
2765
+ get: function() {
2766
+ return PopupDraftSchema;
2767
+ }
2768
+ });
2769
+ Object.defineProperty(exports, "PopupPatchSchema", {
2770
+ enumerable: true,
2771
+ get: function() {
2772
+ return PopupPatchSchema;
2773
+ }
2774
+ });
2775
+ Object.defineProperty(exports, "RectSchema", {
2776
+ enumerable: true,
2777
+ get: function() {
2778
+ return RectSchema;
2779
+ }
2780
+ });
2781
+ Object.defineProperty(exports, "ResourceKeySchema", {
2782
+ enumerable: true,
2783
+ get: function() {
2784
+ return ResourceKeySchema;
2785
+ }
2786
+ });
2787
+ Object.defineProperty(exports, "ShapeCaptionPatchSchema", {
2788
+ enumerable: true,
2789
+ get: function() {
2790
+ return ShapeCaptionPatchSchema;
2791
+ }
2792
+ });
2793
+ Object.defineProperty(exports, "ShapeDimensionCaptionSchema", {
2794
+ enumerable: true,
2795
+ get: function() {
2796
+ return ShapeDimensionCaptionSchema;
2797
+ }
2798
+ });
2799
+ Object.defineProperty(exports, "SourceResourceKeysSchema", {
2800
+ enumerable: true,
2801
+ get: function() {
2802
+ return SourceResourceKeysSchema;
2803
+ }
2804
+ });
2805
+ Object.defineProperty(exports, "SquareDTOSchema", {
2806
+ enumerable: true,
2807
+ get: function() {
2808
+ return SquareDTOSchema;
2809
+ }
2810
+ });
2811
+ Object.defineProperty(exports, "SquareDraftSchema", {
2812
+ enumerable: true,
2813
+ get: function() {
2814
+ return SquareDraftSchema;
2815
+ }
2816
+ });
2817
+ Object.defineProperty(exports, "SquarePatchSchema", {
2818
+ enumerable: true,
2819
+ get: function() {
2820
+ return SquarePatchSchema;
2821
+ }
2822
+ });
2823
+ Object.defineProperty(exports, "SquigglyDTOSchema", {
2824
+ enumerable: true,
2825
+ get: function() {
2826
+ return SquigglyDTOSchema;
2827
+ }
2828
+ });
2829
+ Object.defineProperty(exports, "SquigglyDraftSchema", {
2830
+ enumerable: true,
2831
+ get: function() {
2832
+ return SquigglyDraftSchema;
2833
+ }
2834
+ });
2835
+ Object.defineProperty(exports, "SquigglyPatchSchema", {
2836
+ enumerable: true,
2837
+ get: function() {
2838
+ return SquigglyPatchSchema;
2839
+ }
2840
+ });
2841
+ Object.defineProperty(exports, "StampDTOSchema", {
2842
+ enumerable: true,
2843
+ get: function() {
2844
+ return StampDTOSchema;
2845
+ }
2846
+ });
2847
+ Object.defineProperty(exports, "StampDraftSchema", {
2848
+ enumerable: true,
2849
+ get: function() {
2850
+ return StampDraftSchema;
2851
+ }
2852
+ });
2853
+ Object.defineProperty(exports, "StampFitSchema", {
2854
+ enumerable: true,
2855
+ get: function() {
2856
+ return StampFitSchema;
2857
+ }
2858
+ });
2859
+ Object.defineProperty(exports, "StampPatchSchema", {
2860
+ enumerable: true,
2861
+ get: function() {
2862
+ return StampPatchSchema;
2863
+ }
2864
+ });
2865
+ Object.defineProperty(exports, "StandardFontSchema", {
2866
+ enumerable: true,
2867
+ get: function() {
2868
+ return StandardFontSchema;
2869
+ }
2870
+ });
2871
+ Object.defineProperty(exports, "StrikeoutDTOSchema", {
2872
+ enumerable: true,
2873
+ get: function() {
2874
+ return StrikeoutDTOSchema;
2875
+ }
2876
+ });
2877
+ Object.defineProperty(exports, "StrikeoutDraftSchema", {
2878
+ enumerable: true,
2879
+ get: function() {
2880
+ return StrikeoutDraftSchema;
2881
+ }
2882
+ });
2883
+ Object.defineProperty(exports, "StrikeoutIntentSchema", {
2884
+ enumerable: true,
2885
+ get: function() {
2886
+ return StrikeoutIntentSchema;
2887
+ }
2888
+ });
2889
+ Object.defineProperty(exports, "StrikeoutPatchSchema", {
2890
+ enumerable: true,
2891
+ get: function() {
2892
+ return StrikeoutPatchSchema;
2893
+ }
2894
+ });
2895
+ Object.defineProperty(exports, "TextAlignmentSchema", {
2896
+ enumerable: true,
2897
+ get: function() {
2898
+ return TextAlignmentSchema;
2899
+ }
2900
+ });
2901
+ Object.defineProperty(exports, "TextDTOSchema", {
2902
+ enumerable: true,
2903
+ get: function() {
2904
+ return TextDTOSchema;
2905
+ }
2906
+ });
2907
+ Object.defineProperty(exports, "TextDraftSchema", {
2908
+ enumerable: true,
2909
+ get: function() {
2910
+ return TextDraftSchema;
2911
+ }
2912
+ });
2913
+ Object.defineProperty(exports, "TextPatchSchema", {
2914
+ enumerable: true,
2915
+ get: function() {
2916
+ return TextPatchSchema;
2917
+ }
2918
+ });
2919
+ Object.defineProperty(exports, "ToggleFieldWidgetSchema", {
2920
+ enumerable: true,
2921
+ get: function() {
2922
+ return ToggleFieldWidgetSchema;
2923
+ }
2924
+ });
2925
+ Object.defineProperty(exports, "UnderlineDTOSchema", {
2926
+ enumerable: true,
2927
+ get: function() {
2928
+ return UnderlineDTOSchema;
2929
+ }
2930
+ });
2931
+ Object.defineProperty(exports, "UnderlineDraftSchema", {
2932
+ enumerable: true,
2933
+ get: function() {
2934
+ return UnderlineDraftSchema;
2935
+ }
2936
+ });
2937
+ Object.defineProperty(exports, "UnderlinePatchSchema", {
2938
+ enumerable: true,
2939
+ get: function() {
2940
+ return UnderlinePatchSchema;
2941
+ }
2942
+ });
2943
+ Object.defineProperty(exports, "UnsupportedDTOSchema", {
2944
+ enumerable: true,
2945
+ get: function() {
2946
+ return UnsupportedDTOSchema;
2947
+ }
2948
+ });
2949
+ Object.defineProperty(exports, "UnsupportedDraftSchema", {
2950
+ enumerable: true,
2951
+ get: function() {
2952
+ return UnsupportedDraftSchema;
2953
+ }
2954
+ });
2955
+ Object.defineProperty(exports, "UnsupportedPatchSchema", {
2956
+ enumerable: true,
2957
+ get: function() {
2958
+ return UnsupportedPatchSchema;
2959
+ }
2960
+ });
2961
+ Object.defineProperty(exports, "VerticalAlignmentSchema", {
2962
+ enumerable: true,
2963
+ get: function() {
2964
+ return VerticalAlignmentSchema;
2965
+ }
2966
+ });
2967
+ Object.defineProperty(exports, "WidgetActionsPatchSchema", {
2968
+ enumerable: true,
2969
+ get: function() {
2970
+ return WidgetActionsPatchSchema;
2971
+ }
2972
+ });
2973
+ Object.defineProperty(exports, "WidgetAppearanceSchema", {
2974
+ enumerable: true,
2975
+ get: function() {
2976
+ return WidgetAppearanceSchema;
2977
+ }
2978
+ });
2979
+ Object.defineProperty(exports, "WidgetBorderStyleSchema", {
2980
+ enumerable: true,
2981
+ get: function() {
2982
+ return WidgetBorderStyleSchema;
2983
+ }
2984
+ });
2985
+ Object.defineProperty(exports, "WidgetCheckStyleSchema", {
2986
+ enumerable: true,
2987
+ get: function() {
2988
+ return WidgetCheckStyleSchema;
2989
+ }
2990
+ });
2991
+ Object.defineProperty(exports, "WidgetDTOSchema", {
2992
+ enumerable: true,
2993
+ get: function() {
2994
+ return WidgetDTOSchema;
2995
+ }
2996
+ });
2997
+ Object.defineProperty(exports, "WidgetPatchSchema", {
2998
+ enumerable: true,
2999
+ get: function() {
3000
+ return WidgetPatchSchema;
3001
+ }
3002
+ });
3003
+ Object.defineProperty(exports, "WidgetPlacementSchema", {
3004
+ enumerable: true,
3005
+ get: function() {
3006
+ return WidgetPlacementSchema;
3007
+ }
3008
+ });
3009
+ Object.defineProperty(exports, "WireAttachmentFileSchema", {
3010
+ enumerable: true,
3011
+ get: function() {
3012
+ return WireAttachmentFileSchema;
3013
+ }
3014
+ });
3015
+ Object.defineProperty(exports, "annotationPatchSchemaOf", {
3016
+ enumerable: true,
3017
+ get: function() {
3018
+ return annotationPatchSchemaOf;
3019
+ }
3020
+ });
3021
+ Object.defineProperty(exports, "declarationOf", {
3022
+ enumerable: true,
3023
+ get: function() {
3024
+ return declarationOf;
3025
+ }
3026
+ });
3027
+ Object.defineProperty(exports, "fileAnnotationPatchSchemaOf", {
3028
+ enumerable: true,
3029
+ get: function() {
3030
+ return fileAnnotationPatchSchemaOf;
3031
+ }
3032
+ });
3033
+
3034
+ //# sourceMappingURL=schema-C-gU4vj7.cjs.map