@embedpdf/engine-core 3.0.0-next.11 → 3.0.0-next.12

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 (39) hide show
  1. package/dist/{AnnotationListSnapshot-C1U3XUxP.d.cts → AnnotationListSnapshot-x6tKulNV.d.cts} +153 -28
  2. package/dist/{AnnotationListSnapshot-C1U3XUxP.d.ts → AnnotationListSnapshot-x6tKulNV.d.ts} +153 -28
  3. package/dist/{DocumentSecurityService-7nL9aY75.d.ts → DocumentSecurityService-9MawYxP-.d.ts} +2 -2
  4. package/dist/{DocumentSecurityService-6rhztZlz.d.cts → DocumentSecurityService-CK0pejAK.d.cts} +2 -2
  5. package/dist/{Engine-D3868xIU.d.cts → Engine--0XF0UAK.d.cts} +56 -3
  6. package/dist/{Engine-CWnAKccD.d.ts → Engine-Ds0ytbl6.d.ts} +56 -3
  7. package/dist/{builders-Do6_4KnS.cjs → builders-8Hl1AYNU.cjs} +14 -8
  8. package/dist/builders-8Hl1AYNU.cjs.map +1 -0
  9. package/dist/{builders-Cdz34nbF.js → builders-DOjcKDWQ.js} +14 -8
  10. package/dist/builders-DOjcKDWQ.js.map +1 -0
  11. package/dist/conformance.cjs +552 -95
  12. package/dist/conformance.cjs.map +1 -1
  13. package/dist/conformance.d.cts +50 -3
  14. package/dist/conformance.d.ts +50 -3
  15. package/dist/conformance.js +550 -96
  16. package/dist/conformance.js.map +1 -1
  17. package/dist/index.cjs +1 -1
  18. package/dist/index.d.cts +2 -2
  19. package/dist/index.d.ts +2 -2
  20. package/dist/index.js +1 -1
  21. package/dist/runtime.cjs +1 -1
  22. package/dist/runtime.d.cts +66 -5
  23. package/dist/runtime.d.ts +66 -5
  24. package/dist/runtime.js +1 -1
  25. package/dist/{schemas-XGrNVMDd.js → schemas-DOyVEPk7.js} +51 -5
  26. package/dist/schemas-DOyVEPk7.js.map +1 -0
  27. package/dist/{schemas-CS5iPpX5.cjs → schemas-RChsAMWw.cjs} +92 -4
  28. package/dist/schemas-RChsAMWw.cjs.map +1 -0
  29. package/dist/wire.cjs +23 -1
  30. package/dist/wire.cjs.map +1 -1
  31. package/dist/wire.d.cts +32 -3
  32. package/dist/wire.d.ts +32 -3
  33. package/dist/wire.js +17 -2
  34. package/dist/wire.js.map +1 -1
  35. package/package.json +1 -1
  36. package/dist/builders-Cdz34nbF.js.map +0 -1
  37. package/dist/builders-Do6_4KnS.cjs.map +0 -1
  38. package/dist/schemas-CS5iPpX5.cjs.map +0 -1
  39. package/dist/schemas-XGrNVMDd.js.map +0 -1
@@ -1,5 +1,5 @@
1
- import { $i as AnnotationUpdateResult, $r as FormEffectsResult, Dr as SearchRequest, Fa as AttachmentDeleteResult, Fn as RedactionApplyScope, Fo as FontKey, Gn as PageDeleteResult, Gr as FormFieldUpdateResult, Ho as AnnotationAppearanceImagesResult, Hr as FormDataExport, Ic as AnnotationRef, Io as FontSpec, Jr as FormSetValueResult, Js as MetadataPatch, Ki as FormFieldRef, Kr as FormImportResult, Mn as MetadataUpdateResult, Ni as FormFieldDTO, Or as SearchSlice, Pa as AttachmentCreateResult, Pn as RedactionApplyResult, Po as FontHandle, Qi as AnnotationMoveResult, Ro as PdfSaveMode, Ts as PageTextSnapshot, Un as PageInsertBlankSpec, Ur as FormFieldCreateResult, Vn as PageFlattenUsage, Vo as AnnotationAppearanceImageOptions, Wn as PageInsertResult, Wr as FormFieldDeleteResult, Ws as PageListSnapshot, Xi as AnnotationCreateResult, Xn as PageMoveResult, Xr as FormEffect, Yo as AnnotationAppearancesResult, Yr as FormWidgetLinkResult, Ys as OpenInput, Za as AttachmentContent, Zi as AnnotationDeleteResult, _i as FormFieldDraft, ai as FormSubmissionRequest, ci as FormFieldValue, di as FormFieldPatch, ds as PageRenderOptions, eo as AttachmentFileSource, fl as PdfRotation, hl as DocumentActionsSnapshot, jl as DocumentMetadata, kl as PageObjectNumber, l as AnnotationPatch, ms as PageRenderViewport, n as AnnotationListSnapshotAllPages, nc as OpenOptions, no as EmbeddedFileRef, o as AnnotationDraft, qi as FormWidgetRef, qn as PageRotateResult, qo as AnnotationAppearanceRenderOptions, qr as FormRepairResult, ri as FormSubmissionReceipt, rs as PageImageOptions, si as FormDataFormat, ss as PageRaster, t as AnnotationListPageSnapshot, to as EmbeddedFileItem, ts as PageImageHandle, vs as PageGeometrySnapshot, wi as FormSnapshot, zn as PageFlattenResult } from "./AnnotationListSnapshot-C1U3XUxP.cjs";
2
- import { g as AbortablePromise, s as DocumentSecurityService } from "./DocumentSecurityService-6rhztZlz.cjs";
1
+ import { $i as FormFieldRef, $n as PageNameResult, $r as FormImportResult, Bi as FormFieldDTO, Bl as DocumentMetadata, Bn as PageDeleteResult, Fn as RedactionApplyScope, Fr as SearchSlice, Gc as AnnotationRef, Go as PdfSaveMode, Ha as AttachmentDeleteResult, Hn as PageRotateResult, Ho as FontKey, Jo as AnnotationAppearanceImageOptions, Mn as MetadataUpdateResult, Ms as PageTextSnapshot, Pn as RedactionApplyResult, Pr as SearchRequest, Qn as PageFlattenUsage, Qr as FormFieldUpdateResult, Rl as PageObjectNumber, Rn as PageInsertBlankSpec, Ts as PageGeometrySnapshot, Uo as FontSpec, Va as AttachmentCreateResult, Vo as FontHandle, Xn as PageFlattenResult, Xr as FormFieldCreateResult, Yo as AnnotationAppearanceImagesResult, Yr as FormDataExport, Zr as FormFieldDeleteResult, Zs as PageListSnapshot, aa as AnnotationMoveResult, co as EmbeddedFileItem, cs as PageImageHandle, dc as OpenOptions, ea as FormWidgetRef, ei as FormRepairResult, er as PageNameInput, es as AnnotationAppearanceRenderOptions, fi as FormSubmissionRequest, hi as FormFieldValue, ia as AnnotationDeleteResult, ic as OpenInput, io as AttachmentContent, ji as FormSnapshot, l as AnnotationPatch, lo as EmbeddedFileRef, mi as FormDataFormat, ms as PageRaster, n as AnnotationListSnapshotAllPages, ni as FormWidgetLinkResult, ns as AnnotationAppearancesResult, o as AnnotationDraft, oa as AnnotationUpdateResult, oi as FormEffectsResult, qn as AnnotationFlattenResult, ra as AnnotationCreateResult, rc as MetadataPatch, ri as FormEffect, rr as PageMoveResult, so as AttachmentFileSource, t as AnnotationListPageSnapshot, ti as FormSetValueResult, tr as PageRemoveNameInput, ui as FormSubmissionReceipt, us as PageImageOptions, vi as FormFieldPatch, vs as PageRenderOptions, wi as FormFieldDraft, wl as DocumentActionsSnapshot, xl as PdfRotation, xs as PageRenderViewport, zn as PageInsertResult } from "./AnnotationListSnapshot-x6tKulNV.cjs";
2
+ import { g as AbortablePromise, s as DocumentSecurityService } from "./DocumentSecurityService-CK0pejAK.cjs";
3
3
  //#region src/engine/DocumentActionsService.d.ts
4
4
  /** Lazy, catalog-owned PDF action read. This API extracts; it never executes. */
5
5
  interface DocumentActionsService {
@@ -262,6 +262,25 @@ interface DocumentPagesService {
262
262
  * recycled; surviving pages keep their identity and revisions.
263
263
  */
264
264
  delete(pageObjectNumbers: PageObjectNumber[]): AbortablePromise<PageDeleteResult>;
265
+ /**
266
+ * Register `name` → page in the catalog's `/Names /Pages` tree (create,
267
+ * or replace what an existing key points at); with `replace`, drop that
268
+ * other key in the same job (rename). Named pages are LAYOUT — read them
269
+ * back from `list().namedPages` — so this is a page-structure mutation:
270
+ * `docVersion` + `layoutVersion` advance, per-page pins do not. Gated like
271
+ * `move` (`doc.pages.assemble`). Optional while transports ship;
272
+ * feature-detect with `pages.setName !== undefined`.
273
+ *
274
+ * Rejects with `InvalidArg` for an empty name and `NotFound` for a page
275
+ * that is not in the page tree (hidden templates included).
276
+ */
277
+ setName?(input: PageNameInput): AbortablePromise<PageNameResult>;
278
+ /**
279
+ * Remove one `/Names /Pages` registration; the page itself is untouched.
280
+ * `NotFound` when no registration has that decoded key. Page DELETION
281
+ * removes registrations by itself — callers never need to pair the two.
282
+ */
283
+ removeName?(input: PageRemoveNameInput): AbortablePromise<PageNameResult>;
265
284
  /**
266
285
  * Paint eligible annotation appearances into page content and remove only
267
286
  * those annotations that were painted. This changes content and annotation
@@ -539,6 +558,30 @@ interface PageAnnotationsService {
539
558
  * space, in `[0, count - refs.length]`.
540
559
  */
541
560
  move(refs: AnnotationRef[], toIndex: number): AbortablePromise<AnnotationMoveResult>;
561
+ /**
562
+ * Flatten the given annotations of THIS page into its content —
563
+ * `pages.flatten` for a chosen set. Painted annotations are removed from
564
+ * the page; ones that are ineligible (hidden for `usage`, Popups, no
565
+ * usable appearance) stay and report `skipped`, so a caller can say
566
+ * "2 of 3 flattened". A content + annotation MUTATION of this page: its
567
+ * content and annotation pins advance, layout does not; a
568
+ * `annotations.flattened` event is published when anything was applied.
569
+ * Gated like `pages.flatten` (`doc.pages.modify` + `doc.annotate.modify`).
570
+ * `InvalidArg` for a ref on another page; `NotFound` for an unknown ref.
571
+ * Optional while transports ship — feature-detect.
572
+ */
573
+ flatten?(refs: AnnotationRef[], usage?: PageFlattenUsage): AbortablePromise<AnnotationFlattenResult>;
574
+ /**
575
+ * Flatten the normal appearances of the given annotations of this page
576
+ * into a NEW single-page PDF sized to their union `/Rect` — vector,
577
+ * positions preserved, exactly as this page shows them. The same plan as
578
+ * `flatten` aimed at a fresh page; the source document is untouched. A
579
+ * derived READ that egresses content, so it is gated by `doc.download`
580
+ * like `pages.extract`. All-or-nothing: `InvalidArg` when any ref is not
581
+ * on this page, hidden, or has no appearance (a stamp silently missing a
582
+ * part would be worse than an error). Optional — feature-detect.
583
+ */
584
+ exportAppearance?(refs: AnnotationRef[]): AbortablePromise<Uint8Array>;
542
585
  }
543
586
  //#endregion
544
587
  //#region src/engine/PageGeometryService.d.ts
@@ -745,6 +788,9 @@ type DocumentEvent = ({
745
788
  pageObjectNumber: PageObjectNumber;
746
789
  origin: EventOrigin;
747
790
  } & AnnotationMoveResult) | ({
791
+ type: 'annotations.flattened';
792
+ origin: EventOrigin;
793
+ } & AnnotationFlattenResult) | ({
748
794
  type: 'pages.moved';
749
795
  /** Locally: the moved block. Remotely the audit row only records the
750
796
  * outcome, so this is the full new order — consumers should read
@@ -769,6 +815,13 @@ type DocumentEvent = ({
769
815
  destIndex?: number;
770
816
  origin: EventOrigin;
771
817
  } & PageInsertResult) | ({
818
+ type: 'pages.named';
819
+ /** The decoded key that was registered, renamed, or removed. */
820
+ name: string;
821
+ /** The page it now points at; `null` when the registration was removed. */
822
+ pageObjectNumber: PageObjectNumber | null;
823
+ origin: EventOrigin;
824
+ } & PageNameResult) | ({
772
825
  type: 'attachment.created';
773
826
  origin: EventOrigin;
774
827
  } & AttachmentCreateResult) | ({
@@ -1053,4 +1106,4 @@ interface Engine {
1053
1106
  type EngineFactory = () => Engine;
1054
1107
  //#endregion
1055
1108
  export { DocumentPagesService as A, CONTINUOUS_RENDER_POLICY as C, snapFullPageViewport as D, snapAppearanceScale as E, WeakAnnotationEditSession as F, DocumentActionsService as I, FormRepairOptions as M, DocumentAttachmentsService as N, snapTileScale as O, DocumentAnnotationsService as P, DocumentSearchService as S, EngineRenderPolicy as T, PageTextService as _, DocumentHandle as a, PageAnnotationsService as b, DocumentEventInit as c, PageHandle as d, PieceInfoService as f, PieceInfoSnapshot as g, PieceInfoPatchValue as h, DocumentCapabilities as i, DocumentFormsService as j, DocumentRedactionService as k, DocumentEventType as l, PieceInfoPatch as m, EngineFactory as n, DocumentEventStream as o, PieceInfoEntry as p, FontService as r, DocumentEvent as s, Engine as t, EventOrigin as u, PageRenderService as v, DocumentRenderService as w, MetadataService as x, PageGeometryService as y };
1056
- //# sourceMappingURL=Engine-D3868xIU.d.cts.map
1109
+ //# sourceMappingURL=Engine--0XF0UAK.d.cts.map
@@ -1,5 +1,5 @@
1
- import { $i as AnnotationUpdateResult, $r as FormEffectsResult, Dr as SearchRequest, Fa as AttachmentDeleteResult, Fn as RedactionApplyScope, Fo as FontKey, Gn as PageDeleteResult, Gr as FormFieldUpdateResult, Ho as AnnotationAppearanceImagesResult, Hr as FormDataExport, Ic as AnnotationRef, Io as FontSpec, Jr as FormSetValueResult, Js as MetadataPatch, Ki as FormFieldRef, Kr as FormImportResult, Mn as MetadataUpdateResult, Ni as FormFieldDTO, Or as SearchSlice, Pa as AttachmentCreateResult, Pn as RedactionApplyResult, Po as FontHandle, Qi as AnnotationMoveResult, Ro as PdfSaveMode, Ts as PageTextSnapshot, Un as PageInsertBlankSpec, Ur as FormFieldCreateResult, Vn as PageFlattenUsage, Vo as AnnotationAppearanceImageOptions, Wn as PageInsertResult, Wr as FormFieldDeleteResult, Ws as PageListSnapshot, Xi as AnnotationCreateResult, Xn as PageMoveResult, Xr as FormEffect, Yo as AnnotationAppearancesResult, Yr as FormWidgetLinkResult, Ys as OpenInput, Za as AttachmentContent, Zi as AnnotationDeleteResult, _i as FormFieldDraft, ai as FormSubmissionRequest, ci as FormFieldValue, di as FormFieldPatch, ds as PageRenderOptions, eo as AttachmentFileSource, fl as PdfRotation, hl as DocumentActionsSnapshot, jl as DocumentMetadata, kl as PageObjectNumber, l as AnnotationPatch, ms as PageRenderViewport, n as AnnotationListSnapshotAllPages, nc as OpenOptions, no as EmbeddedFileRef, o as AnnotationDraft, qi as FormWidgetRef, qn as PageRotateResult, qo as AnnotationAppearanceRenderOptions, qr as FormRepairResult, ri as FormSubmissionReceipt, rs as PageImageOptions, si as FormDataFormat, ss as PageRaster, t as AnnotationListPageSnapshot, to as EmbeddedFileItem, ts as PageImageHandle, vs as PageGeometrySnapshot, wi as FormSnapshot, zn as PageFlattenResult } from "./AnnotationListSnapshot-C1U3XUxP.js";
2
- import { g as AbortablePromise, s as DocumentSecurityService } from "./DocumentSecurityService-7nL9aY75.js";
1
+ import { $i as FormFieldRef, $n as PageNameResult, $r as FormImportResult, Bi as FormFieldDTO, Bl as DocumentMetadata, Bn as PageDeleteResult, Fn as RedactionApplyScope, Fr as SearchSlice, Gc as AnnotationRef, Go as PdfSaveMode, Ha as AttachmentDeleteResult, Hn as PageRotateResult, Ho as FontKey, Jo as AnnotationAppearanceImageOptions, Mn as MetadataUpdateResult, Ms as PageTextSnapshot, Pn as RedactionApplyResult, Pr as SearchRequest, Qn as PageFlattenUsage, Qr as FormFieldUpdateResult, Rl as PageObjectNumber, Rn as PageInsertBlankSpec, Ts as PageGeometrySnapshot, Uo as FontSpec, Va as AttachmentCreateResult, Vo as FontHandle, Xn as PageFlattenResult, Xr as FormFieldCreateResult, Yo as AnnotationAppearanceImagesResult, Yr as FormDataExport, Zr as FormFieldDeleteResult, Zs as PageListSnapshot, aa as AnnotationMoveResult, co as EmbeddedFileItem, cs as PageImageHandle, dc as OpenOptions, ea as FormWidgetRef, ei as FormRepairResult, er as PageNameInput, es as AnnotationAppearanceRenderOptions, fi as FormSubmissionRequest, hi as FormFieldValue, ia as AnnotationDeleteResult, ic as OpenInput, io as AttachmentContent, ji as FormSnapshot, l as AnnotationPatch, lo as EmbeddedFileRef, mi as FormDataFormat, ms as PageRaster, n as AnnotationListSnapshotAllPages, ni as FormWidgetLinkResult, ns as AnnotationAppearancesResult, o as AnnotationDraft, oa as AnnotationUpdateResult, oi as FormEffectsResult, qn as AnnotationFlattenResult, ra as AnnotationCreateResult, rc as MetadataPatch, ri as FormEffect, rr as PageMoveResult, so as AttachmentFileSource, t as AnnotationListPageSnapshot, ti as FormSetValueResult, tr as PageRemoveNameInput, ui as FormSubmissionReceipt, us as PageImageOptions, vi as FormFieldPatch, vs as PageRenderOptions, wi as FormFieldDraft, wl as DocumentActionsSnapshot, xl as PdfRotation, xs as PageRenderViewport, zn as PageInsertResult } from "./AnnotationListSnapshot-x6tKulNV.js";
2
+ import { g as AbortablePromise, s as DocumentSecurityService } from "./DocumentSecurityService-9MawYxP-.js";
3
3
  //#region src/engine/DocumentActionsService.d.ts
4
4
  /** Lazy, catalog-owned PDF action read. This API extracts; it never executes. */
5
5
  interface DocumentActionsService {
@@ -262,6 +262,25 @@ interface DocumentPagesService {
262
262
  * recycled; surviving pages keep their identity and revisions.
263
263
  */
264
264
  delete(pageObjectNumbers: PageObjectNumber[]): AbortablePromise<PageDeleteResult>;
265
+ /**
266
+ * Register `name` → page in the catalog's `/Names /Pages` tree (create,
267
+ * or replace what an existing key points at); with `replace`, drop that
268
+ * other key in the same job (rename). Named pages are LAYOUT — read them
269
+ * back from `list().namedPages` — so this is a page-structure mutation:
270
+ * `docVersion` + `layoutVersion` advance, per-page pins do not. Gated like
271
+ * `move` (`doc.pages.assemble`). Optional while transports ship;
272
+ * feature-detect with `pages.setName !== undefined`.
273
+ *
274
+ * Rejects with `InvalidArg` for an empty name and `NotFound` for a page
275
+ * that is not in the page tree (hidden templates included).
276
+ */
277
+ setName?(input: PageNameInput): AbortablePromise<PageNameResult>;
278
+ /**
279
+ * Remove one `/Names /Pages` registration; the page itself is untouched.
280
+ * `NotFound` when no registration has that decoded key. Page DELETION
281
+ * removes registrations by itself — callers never need to pair the two.
282
+ */
283
+ removeName?(input: PageRemoveNameInput): AbortablePromise<PageNameResult>;
265
284
  /**
266
285
  * Paint eligible annotation appearances into page content and remove only
267
286
  * those annotations that were painted. This changes content and annotation
@@ -539,6 +558,30 @@ interface PageAnnotationsService {
539
558
  * space, in `[0, count - refs.length]`.
540
559
  */
541
560
  move(refs: AnnotationRef[], toIndex: number): AbortablePromise<AnnotationMoveResult>;
561
+ /**
562
+ * Flatten the given annotations of THIS page into its content —
563
+ * `pages.flatten` for a chosen set. Painted annotations are removed from
564
+ * the page; ones that are ineligible (hidden for `usage`, Popups, no
565
+ * usable appearance) stay and report `skipped`, so a caller can say
566
+ * "2 of 3 flattened". A content + annotation MUTATION of this page: its
567
+ * content and annotation pins advance, layout does not; a
568
+ * `annotations.flattened` event is published when anything was applied.
569
+ * Gated like `pages.flatten` (`doc.pages.modify` + `doc.annotate.modify`).
570
+ * `InvalidArg` for a ref on another page; `NotFound` for an unknown ref.
571
+ * Optional while transports ship — feature-detect.
572
+ */
573
+ flatten?(refs: AnnotationRef[], usage?: PageFlattenUsage): AbortablePromise<AnnotationFlattenResult>;
574
+ /**
575
+ * Flatten the normal appearances of the given annotations of this page
576
+ * into a NEW single-page PDF sized to their union `/Rect` — vector,
577
+ * positions preserved, exactly as this page shows them. The same plan as
578
+ * `flatten` aimed at a fresh page; the source document is untouched. A
579
+ * derived READ that egresses content, so it is gated by `doc.download`
580
+ * like `pages.extract`. All-or-nothing: `InvalidArg` when any ref is not
581
+ * on this page, hidden, or has no appearance (a stamp silently missing a
582
+ * part would be worse than an error). Optional — feature-detect.
583
+ */
584
+ exportAppearance?(refs: AnnotationRef[]): AbortablePromise<Uint8Array>;
542
585
  }
543
586
  //#endregion
544
587
  //#region src/engine/PageGeometryService.d.ts
@@ -745,6 +788,9 @@ type DocumentEvent = ({
745
788
  pageObjectNumber: PageObjectNumber;
746
789
  origin: EventOrigin;
747
790
  } & AnnotationMoveResult) | ({
791
+ type: 'annotations.flattened';
792
+ origin: EventOrigin;
793
+ } & AnnotationFlattenResult) | ({
748
794
  type: 'pages.moved';
749
795
  /** Locally: the moved block. Remotely the audit row only records the
750
796
  * outcome, so this is the full new order — consumers should read
@@ -769,6 +815,13 @@ type DocumentEvent = ({
769
815
  destIndex?: number;
770
816
  origin: EventOrigin;
771
817
  } & PageInsertResult) | ({
818
+ type: 'pages.named';
819
+ /** The decoded key that was registered, renamed, or removed. */
820
+ name: string;
821
+ /** The page it now points at; `null` when the registration was removed. */
822
+ pageObjectNumber: PageObjectNumber | null;
823
+ origin: EventOrigin;
824
+ } & PageNameResult) | ({
772
825
  type: 'attachment.created';
773
826
  origin: EventOrigin;
774
827
  } & AttachmentCreateResult) | ({
@@ -1053,4 +1106,4 @@ interface Engine {
1053
1106
  type EngineFactory = () => Engine;
1054
1107
  //#endregion
1055
1108
  export { DocumentPagesService as A, CONTINUOUS_RENDER_POLICY as C, snapFullPageViewport as D, snapAppearanceScale as E, WeakAnnotationEditSession as F, DocumentActionsService as I, FormRepairOptions as M, DocumentAttachmentsService as N, snapTileScale as O, DocumentAnnotationsService as P, DocumentSearchService as S, EngineRenderPolicy as T, PageTextService as _, DocumentHandle as a, PageAnnotationsService as b, DocumentEventInit as c, PageHandle as d, PieceInfoService as f, PieceInfoSnapshot as g, PieceInfoPatchValue as h, DocumentCapabilities as i, DocumentFormsService as j, DocumentRedactionService as k, DocumentEventType as l, PieceInfoPatch as m, EngineFactory as n, DocumentEventStream as o, PieceInfoEntry as p, FontService as r, DocumentEvent as s, Engine as t, EventOrigin as u, PageRenderService as v, DocumentRenderService as w, MetadataService as x, PageGeometryService as y };
1056
- //# sourceMappingURL=Engine-CWnAKccD.d.ts.map
1109
+ //# sourceMappingURL=Engine-Ds0ytbl6.d.ts.map
@@ -139,19 +139,25 @@ function isBlob(value) {
139
139
  return typeof Blob !== "undefined" && value instanceof Blob;
140
140
  }
141
141
  /**
142
- * Detach a Uint8Array view into a standalone ArrayBuffer without copying
143
- * when the view already spans its whole buffer.
142
+ * Copy a Uint8Array view into a fresh, exactly-sized ArrayBuffer the call
143
+ * owns. Always copies — even when the view spans its whole buffer — because
144
+ * the result may be transferred to a worker (detaching it), and the view is
145
+ * the caller's. Returning `view.buffer` here would let one transfer zero
146
+ * the caller's bytes (a stamp library's Uint8Array became single-use).
147
+ * Callers wanting a zero-copy hand-off need an explicit "give" form, as
148
+ * `pages.insert` has for bare ArrayBuffers; `BinarySource` has none.
144
149
  */
145
- function toStandaloneArrayBuffer(view) {
146
- if (view.byteOffset === 0 && view.buffer instanceof ArrayBuffer && view.byteLength === view.buffer.byteLength) return view.buffer;
147
- return view.slice().buffer;
150
+ function toOwnedArrayBuffer(view) {
151
+ const copy = new ArrayBuffer(view.byteLength);
152
+ new Uint8Array(copy).set(view);
153
+ return copy;
148
154
  }
149
155
  /**
150
156
  * Resolve any accepted `BinarySource` form into a `WireResource`.
151
157
  * Async because Blob bytes can only be read asynchronously.
152
158
  */
153
159
  async function resolveBinarySource(source) {
154
- if (source instanceof Uint8Array) return { bytes: toStandaloneArrayBuffer(source) };
160
+ if (source instanceof Uint8Array) return { bytes: toOwnedArrayBuffer(source) };
155
161
  if (isBlob(source)) {
156
162
  const blobName = blobFileName(source);
157
163
  return {
@@ -162,7 +168,7 @@ async function resolveBinarySource(source) {
162
168
  }
163
169
  const { data, mimeType, name } = source;
164
170
  const inner = data instanceof Uint8Array ? {
165
- bytes: toStandaloneArrayBuffer(data),
171
+ bytes: toOwnedArrayBuffer(data),
166
172
  mimeType: void 0,
167
173
  name: void 0
168
174
  } : {
@@ -2089,4 +2095,4 @@ Object.defineProperty(exports, "wordBefore", {
2089
2095
  }
2090
2096
  });
2091
2097
 
2092
- //# sourceMappingURL=builders-Do6_4KnS.cjs.map
2098
+ //# sourceMappingURL=builders-8Hl1AYNU.cjs.map