@embedpdf/engine-core 3.0.0-next.3 → 3.0.0-next.5

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 (55) hide show
  1. package/dist/{AbortError-CjSasIlL.js → AbortError-BsHuCO1S.js} +2 -2
  2. package/dist/{AbortError-CjSasIlL.js.map → AbortError-BsHuCO1S.js.map} +1 -1
  3. package/dist/{AbortError-ByBflvEl.cjs → AbortError-DmWeq9sx.cjs} +2 -2
  4. package/dist/{AbortError-ByBflvEl.cjs.map → AbortError-DmWeq9sx.cjs.map} +1 -1
  5. package/dist/{AnnotationListSnapshot-W0RCsyDE.d.cts → AnnotationListSnapshot-CHjkcIaL.d.cts} +345 -36
  6. package/dist/{AnnotationListSnapshot-W0RCsyDE.d.ts → AnnotationListSnapshot-CHjkcIaL.d.ts} +345 -36
  7. package/dist/{DocumentSecurityService-Df79fgpe.d.cts → DocumentSecurityService-B1uv4FaK.d.cts} +2 -2
  8. package/dist/{DocumentSecurityService-B-tULKNY.d.ts → DocumentSecurityService-CrxGktMI.d.ts} +2 -2
  9. package/dist/{Engine-B7Oe7f5i.d.ts → Engine-BE6r06QI.d.ts} +4 -4
  10. package/dist/{Engine-D9loFZc1.d.cts → Engine-BOaRwtKa.d.cts} +4 -4
  11. package/dist/{builders-BvikWRuO.cjs → builders-BsUc2A1U.cjs} +426 -223
  12. package/dist/builders-BsUc2A1U.cjs.map +1 -0
  13. package/dist/{builders-C548U47M.js → builders-CF5gKkOa.js} +382 -167
  14. package/dist/builders-CF5gKkOa.js.map +1 -0
  15. package/dist/{subtype-BvAzLCGC.js → charmap-CUukAMhR.js} +140 -2
  16. package/dist/charmap-CUukAMhR.js.map +1 -0
  17. package/dist/{subtype-qejjVr6h.cjs → charmap-D6PLtRiC.cjs} +169 -1
  18. package/dist/charmap-D6PLtRiC.cjs.map +1 -0
  19. package/dist/conformance.cjs +511 -177
  20. package/dist/conformance.cjs.map +1 -1
  21. package/dist/conformance.d.cts +99 -3
  22. package/dist/conformance.d.ts +99 -3
  23. package/dist/conformance.js +467 -136
  24. package/dist/conformance.js.map +1 -1
  25. package/dist/{fold-IaMph3CO.cjs → fold-BeT1GxLP.cjs} +235 -4
  26. package/dist/fold-BeT1GxLP.cjs.map +1 -0
  27. package/dist/{fold-CB4fAOOy.js → fold-DemV94jf.js} +162 -3
  28. package/dist/fold-DemV94jf.js.map +1 -0
  29. package/dist/index.cjs +33 -18
  30. package/dist/index.d.cts +2 -2
  31. package/dist/index.d.ts +2 -2
  32. package/dist/index.js +4 -4
  33. package/dist/runtime.cjs +38 -23
  34. package/dist/runtime.d.cts +4 -4
  35. package/dist/runtime.d.ts +4 -4
  36. package/dist/runtime.js +5 -5
  37. package/dist/{schemas-B_1VyFsm.cjs → schemas-CyWwm0Zf.cjs} +64 -30
  38. package/dist/schemas-CyWwm0Zf.cjs.map +1 -0
  39. package/dist/{schemas-9OpSSeM6.js → schemas-ES6-TkIl.js} +44 -10
  40. package/dist/schemas-ES6-TkIl.js.map +1 -0
  41. package/dist/wire.cjs +14 -1
  42. package/dist/wire.cjs.map +1 -1
  43. package/dist/wire.d.cts +19 -9
  44. package/dist/wire.d.ts +19 -9
  45. package/dist/wire.js +14 -2
  46. package/dist/wire.js.map +1 -1
  47. package/package.json +1 -1
  48. package/dist/builders-BvikWRuO.cjs.map +0 -1
  49. package/dist/builders-C548U47M.js.map +0 -1
  50. package/dist/fold-CB4fAOOy.js.map +0 -1
  51. package/dist/fold-IaMph3CO.cjs.map +0 -1
  52. package/dist/schemas-9OpSSeM6.js.map +0 -1
  53. package/dist/schemas-B_1VyFsm.cjs.map +0 -1
  54. package/dist/subtype-BvAzLCGC.js.map +0 -1
  55. package/dist/subtype-qejjVr6h.cjs.map +0 -1
@@ -1,5 +1,5 @@
1
- import { An as HighlightDraft, Cc as InkList, Ec as PdfPoint, Oc as PdfRect, Tc as LinePoints, Vc as DocumentMetadata, n as AnnotationListSnapshotAllPages, t as AnnotationListPageSnapshot } from "./AnnotationListSnapshot-W0RCsyDE.cjs";
2
- import { t as Engine } from "./Engine-D9loFZc1.cjs";
1
+ import { An as HighlightDraft, Qc as PdfPoint, Yc as InkList, Zc as LinePoints, el as PdfRect, ms as CharMapAnchor, n as AnnotationListSnapshotAllPages, pl as DocumentMetadata, t as AnnotationListPageSnapshot } from "./AnnotationListSnapshot-CHjkcIaL.cjs";
2
+ import { t as Engine } from "./Engine-BOaRwtKa.cjs";
3
3
  //#region src/conformance/runMetadataConformance.d.ts
4
4
  interface ConformanceTestRunner {
5
5
  describe(name: string, fn: () => void): void;
@@ -489,6 +489,102 @@ interface PageTextConformanceOptions extends Omit<ConformanceOptions, 'fixture'>
489
489
  }
490
490
  declare function runPageTextConformance(runner: ConformanceTestRunner, opts: PageTextConformanceOptions): void;
491
491
  //#endregion
492
+ //#region src/conformance/runTextDivergenceConformance.d.ts
493
+ /**
494
+ * Index-space divergence conformance: the cases where a page's CHARACTER
495
+ * space (what geometry tiles and selection/search ranges address) and its
496
+ * extracted TEXT differ — and the `charMap` contract that bridges them.
497
+ *
498
+ * Fixtures pin EXACT values (text, charCount, anchors) verified against the
499
+ * wasm runtime, so both engines must produce byte-identical snapshots:
500
+ *
501
+ * - a non-printing character occupying a character slot with no text unit
502
+ * (`bug_1139.pdf` — every text offset shifts by one);
503
+ * - `/ActualText` replacement (`bug_384770169.pdf` — synthetic `kPiece`
504
+ * characters in lockstep with the text, identity map, real segments);
505
+ * - supplementary-plane text via a ToUnicode surrogate pair
506
+ * (`embedpdf_astral_tounicode.pdf` — two lockstep surrogate entries,
507
+ * identity map, astral content SURVIVES extraction).
508
+ *
509
+ * The search probe closes the loop: a hit's `charStart`/`charCount` must be
510
+ * CHARACTER-space (segments join geometry), and slicing the snapshot by the
511
+ * hit's range must reproduce the matched text exactly — the law that makes
512
+ * select-this-match and copy compose.
513
+ */
514
+ interface TextDivergenceConformanceFixture extends ConformanceFixture {
515
+ /** PDF indirect object number of the probed page. */
516
+ pageObjectNumber: number;
517
+ /** The EXACT extracted text (UTF-16 faithful). */
518
+ exactText: string;
519
+ /** The character-space size (may differ from `exactText.length`). */
520
+ expectedCharCount: number;
521
+ /** Expected anchors; null asserts identity (no `charMap` on the wire). */
522
+ expectedCharMap: ReadonlyArray<CharMapAnchor> | null;
523
+ /** Char-space slice expectations (half-open). */
524
+ slices?: ReadonlyArray<{
525
+ from: number;
526
+ to: number;
527
+ text: string;
528
+ }>;
529
+ /** Literal search probe with expected CHARACTER-space hit range. */
530
+ search?: {
531
+ query: string;
532
+ charStart: number;
533
+ charCount: number;
534
+ matchedText: string;
535
+ };
536
+ }
537
+ interface TextDivergenceConformanceOptions extends Omit<ConformanceOptions, 'fixture'> {
538
+ fixture: TextDivergenceConformanceFixture;
539
+ }
540
+ declare function runTextDivergenceConformance(runner: ConformanceTestRunner, opts: TextDivergenceConformanceOptions): void;
541
+ /** One divergence case, minus the per-suite bytes/id wiring. */
542
+ type TextDivergenceCase = Omit<TextDivergenceConformanceFixture, 'id' | 'bytes' | 'expected'> & {
543
+ /** Fixture file name under the fork's `testing/resources/`. */
544
+ resource: string;
545
+ };
546
+ /**
547
+ * THE pinned divergence cases — one table, consumed by both engines' suites
548
+ * so expected values cannot drift. Values verified against the wasm runtime
549
+ * (see each case). All fixtures are single-page; the page's indirect object
550
+ * number is 3 in each.
551
+ */
552
+ declare const TEXT_DIVERGENCE_CASES: Readonly<Record<string, TextDivergenceCase>>;
553
+ //#endregion
554
+ //#region src/conformance/runPageGeometryOrientationConformance.d.ts
555
+ /**
556
+ * Per-fixture expectations for the oriented-text geometry harness. One
557
+ * fixture per call, mirroring the other conformance suites; the fixture
558
+ * declares what its dominant text orientation must read back as.
559
+ */
560
+ interface PageGeometryOrientationFixture extends ConformanceFixture {
561
+ /** PDF indirect object number of the page under test. */
562
+ pageObjectNumber: number;
563
+ expectation: {
564
+ /** Every run is the upright variant; no glyph carries oriented cells. */
565
+ kind: 'upright';
566
+ } | {
567
+ /** The page loads and every glyph is degenerate (zeroed + empty flag). */
568
+ kind: 'empty-only';
569
+ } | {
570
+ kind: 'rotated';
571
+ /** Baseline angles (radians, CCW, PDF y-up) rotated runs may carry. */
572
+ rotations: number[];
573
+ ascentFlip: boolean;
574
+ /**
575
+ * Assert sheared cells: with `rotations` ≈ [0], a non-zero start-edge
576
+ * x-offset proves the parallelogram (an AABB could not express it).
577
+ */
578
+ sheared?: boolean;
579
+ /** Minimum number of rotated runs the page must produce (default 1). */
580
+ minRotatedRuns?: number;
581
+ };
582
+ }
583
+ interface PageGeometryOrientationOptions extends Omit<ConformanceOptions, 'fixture'> {
584
+ fixture: PageGeometryOrientationFixture;
585
+ }
586
+ declare function runPageGeometryOrientationConformance(runner: ConformanceTestRunner, opts: PageGeometryOrientationOptions): void;
587
+ //#endregion
492
588
  //#region src/conformance/runSearchConformance.d.ts
493
589
  /**
494
590
  * Per-fixture expectations for the search harness. Suites supply a
@@ -526,5 +622,5 @@ declare function runSearchConformance(runner: ConformanceTestRunner, opts: Searc
526
622
  declare function diffAnnotationListSnapshot(a: AnnotationListPageSnapshot, b: AnnotationListPageSnapshot): string[];
527
623
  declare function diffAnnotationListSnapshotAll(a: AnnotationListSnapshotAllPages, b: AnnotationListSnapshotAllPages): string[];
528
624
  //#endregion
529
- export { type ActionsConformanceFixtures, type ActionsConformanceOptions, type AnnotationAppearanceConformanceFixture, type AnnotationAppearanceConformanceOptions, type AnnotationConformanceOptions, type AnnotationMutationConformanceFixture, type AnnotationMutationConformanceOptions, type AnnotationReadConformanceFixture, type ConformanceExpect, type ConformanceFixture, type ConformanceOptions, type ConformanceTestRunner, type FormConformanceFixtures, type FormConformanceOptions, type PageReorderConformanceFixture, type PageReorderConformanceOptions, type PageTextConformanceFixture, type PageTextConformanceOptions, type SearchConformanceFixture, type SearchConformanceOptions, diffAnnotationListSnapshot, diffAnnotationListSnapshotAll, runActionsConformance, runAnnotationAppearanceConformance, runAnnotationMutationConformance, runAnnotationReadConformance, runAttachmentConformance, runDocumentEventsConformance, runFormConformance, runMetadataConformance, runPageDeleteConformance, runPageExtractConformance, runPageFlattenConformance, runPageInsertConformance, runPageReorderConformance, runPageRotateConformance, runPageTextConformance, runPieceInfoConformance, runRedactionApplyConformance, runSearchConformance };
625
+ export { type ActionsConformanceFixtures, type ActionsConformanceOptions, type AnnotationAppearanceConformanceFixture, type AnnotationAppearanceConformanceOptions, type AnnotationConformanceOptions, type AnnotationMutationConformanceFixture, type AnnotationMutationConformanceOptions, type AnnotationReadConformanceFixture, type ConformanceExpect, type ConformanceFixture, type ConformanceOptions, type ConformanceTestRunner, type FormConformanceFixtures, type FormConformanceOptions, type PageGeometryOrientationFixture, type PageGeometryOrientationOptions, type PageReorderConformanceFixture, type PageReorderConformanceOptions, type PageTextConformanceFixture, type PageTextConformanceOptions, type SearchConformanceFixture, type SearchConformanceOptions, TEXT_DIVERGENCE_CASES, type TextDivergenceCase, type TextDivergenceConformanceFixture, type TextDivergenceConformanceOptions, diffAnnotationListSnapshot, diffAnnotationListSnapshotAll, runActionsConformance, runAnnotationAppearanceConformance, runAnnotationMutationConformance, runAnnotationReadConformance, runAttachmentConformance, runDocumentEventsConformance, runFormConformance, runMetadataConformance, runPageDeleteConformance, runPageExtractConformance, runPageFlattenConformance, runPageGeometryOrientationConformance, runPageInsertConformance, runPageReorderConformance, runPageRotateConformance, runPageTextConformance, runPieceInfoConformance, runRedactionApplyConformance, runSearchConformance, runTextDivergenceConformance };
530
626
  //# sourceMappingURL=conformance.d.cts.map
@@ -1,5 +1,5 @@
1
- import { An as HighlightDraft, Cc as InkList, Ec as PdfPoint, Oc as PdfRect, Tc as LinePoints, Vc as DocumentMetadata, n as AnnotationListSnapshotAllPages, t as AnnotationListPageSnapshot } from "./AnnotationListSnapshot-W0RCsyDE.js";
2
- import { t as Engine } from "./Engine-B7Oe7f5i.js";
1
+ import { An as HighlightDraft, Qc as PdfPoint, Yc as InkList, Zc as LinePoints, el as PdfRect, ms as CharMapAnchor, n as AnnotationListSnapshotAllPages, pl as DocumentMetadata, t as AnnotationListPageSnapshot } from "./AnnotationListSnapshot-CHjkcIaL.js";
2
+ import { t as Engine } from "./Engine-BE6r06QI.js";
3
3
  //#region src/conformance/runMetadataConformance.d.ts
4
4
  interface ConformanceTestRunner {
5
5
  describe(name: string, fn: () => void): void;
@@ -489,6 +489,102 @@ interface PageTextConformanceOptions extends Omit<ConformanceOptions, 'fixture'>
489
489
  }
490
490
  declare function runPageTextConformance(runner: ConformanceTestRunner, opts: PageTextConformanceOptions): void;
491
491
  //#endregion
492
+ //#region src/conformance/runTextDivergenceConformance.d.ts
493
+ /**
494
+ * Index-space divergence conformance: the cases where a page's CHARACTER
495
+ * space (what geometry tiles and selection/search ranges address) and its
496
+ * extracted TEXT differ — and the `charMap` contract that bridges them.
497
+ *
498
+ * Fixtures pin EXACT values (text, charCount, anchors) verified against the
499
+ * wasm runtime, so both engines must produce byte-identical snapshots:
500
+ *
501
+ * - a non-printing character occupying a character slot with no text unit
502
+ * (`bug_1139.pdf` — every text offset shifts by one);
503
+ * - `/ActualText` replacement (`bug_384770169.pdf` — synthetic `kPiece`
504
+ * characters in lockstep with the text, identity map, real segments);
505
+ * - supplementary-plane text via a ToUnicode surrogate pair
506
+ * (`embedpdf_astral_tounicode.pdf` — two lockstep surrogate entries,
507
+ * identity map, astral content SURVIVES extraction).
508
+ *
509
+ * The search probe closes the loop: a hit's `charStart`/`charCount` must be
510
+ * CHARACTER-space (segments join geometry), and slicing the snapshot by the
511
+ * hit's range must reproduce the matched text exactly — the law that makes
512
+ * select-this-match and copy compose.
513
+ */
514
+ interface TextDivergenceConformanceFixture extends ConformanceFixture {
515
+ /** PDF indirect object number of the probed page. */
516
+ pageObjectNumber: number;
517
+ /** The EXACT extracted text (UTF-16 faithful). */
518
+ exactText: string;
519
+ /** The character-space size (may differ from `exactText.length`). */
520
+ expectedCharCount: number;
521
+ /** Expected anchors; null asserts identity (no `charMap` on the wire). */
522
+ expectedCharMap: ReadonlyArray<CharMapAnchor> | null;
523
+ /** Char-space slice expectations (half-open). */
524
+ slices?: ReadonlyArray<{
525
+ from: number;
526
+ to: number;
527
+ text: string;
528
+ }>;
529
+ /** Literal search probe with expected CHARACTER-space hit range. */
530
+ search?: {
531
+ query: string;
532
+ charStart: number;
533
+ charCount: number;
534
+ matchedText: string;
535
+ };
536
+ }
537
+ interface TextDivergenceConformanceOptions extends Omit<ConformanceOptions, 'fixture'> {
538
+ fixture: TextDivergenceConformanceFixture;
539
+ }
540
+ declare function runTextDivergenceConformance(runner: ConformanceTestRunner, opts: TextDivergenceConformanceOptions): void;
541
+ /** One divergence case, minus the per-suite bytes/id wiring. */
542
+ type TextDivergenceCase = Omit<TextDivergenceConformanceFixture, 'id' | 'bytes' | 'expected'> & {
543
+ /** Fixture file name under the fork's `testing/resources/`. */
544
+ resource: string;
545
+ };
546
+ /**
547
+ * THE pinned divergence cases — one table, consumed by both engines' suites
548
+ * so expected values cannot drift. Values verified against the wasm runtime
549
+ * (see each case). All fixtures are single-page; the page's indirect object
550
+ * number is 3 in each.
551
+ */
552
+ declare const TEXT_DIVERGENCE_CASES: Readonly<Record<string, TextDivergenceCase>>;
553
+ //#endregion
554
+ //#region src/conformance/runPageGeometryOrientationConformance.d.ts
555
+ /**
556
+ * Per-fixture expectations for the oriented-text geometry harness. One
557
+ * fixture per call, mirroring the other conformance suites; the fixture
558
+ * declares what its dominant text orientation must read back as.
559
+ */
560
+ interface PageGeometryOrientationFixture extends ConformanceFixture {
561
+ /** PDF indirect object number of the page under test. */
562
+ pageObjectNumber: number;
563
+ expectation: {
564
+ /** Every run is the upright variant; no glyph carries oriented cells. */
565
+ kind: 'upright';
566
+ } | {
567
+ /** The page loads and every glyph is degenerate (zeroed + empty flag). */
568
+ kind: 'empty-only';
569
+ } | {
570
+ kind: 'rotated';
571
+ /** Baseline angles (radians, CCW, PDF y-up) rotated runs may carry. */
572
+ rotations: number[];
573
+ ascentFlip: boolean;
574
+ /**
575
+ * Assert sheared cells: with `rotations` ≈ [0], a non-zero start-edge
576
+ * x-offset proves the parallelogram (an AABB could not express it).
577
+ */
578
+ sheared?: boolean;
579
+ /** Minimum number of rotated runs the page must produce (default 1). */
580
+ minRotatedRuns?: number;
581
+ };
582
+ }
583
+ interface PageGeometryOrientationOptions extends Omit<ConformanceOptions, 'fixture'> {
584
+ fixture: PageGeometryOrientationFixture;
585
+ }
586
+ declare function runPageGeometryOrientationConformance(runner: ConformanceTestRunner, opts: PageGeometryOrientationOptions): void;
587
+ //#endregion
492
588
  //#region src/conformance/runSearchConformance.d.ts
493
589
  /**
494
590
  * Per-fixture expectations for the search harness. Suites supply a
@@ -526,5 +622,5 @@ declare function runSearchConformance(runner: ConformanceTestRunner, opts: Searc
526
622
  declare function diffAnnotationListSnapshot(a: AnnotationListPageSnapshot, b: AnnotationListPageSnapshot): string[];
527
623
  declare function diffAnnotationListSnapshotAll(a: AnnotationListSnapshotAllPages, b: AnnotationListSnapshotAllPages): string[];
528
624
  //#endregion
529
- export { type ActionsConformanceFixtures, type ActionsConformanceOptions, type AnnotationAppearanceConformanceFixture, type AnnotationAppearanceConformanceOptions, type AnnotationConformanceOptions, type AnnotationMutationConformanceFixture, type AnnotationMutationConformanceOptions, type AnnotationReadConformanceFixture, type ConformanceExpect, type ConformanceFixture, type ConformanceOptions, type ConformanceTestRunner, type FormConformanceFixtures, type FormConformanceOptions, type PageReorderConformanceFixture, type PageReorderConformanceOptions, type PageTextConformanceFixture, type PageTextConformanceOptions, type SearchConformanceFixture, type SearchConformanceOptions, diffAnnotationListSnapshot, diffAnnotationListSnapshotAll, runActionsConformance, runAnnotationAppearanceConformance, runAnnotationMutationConformance, runAnnotationReadConformance, runAttachmentConformance, runDocumentEventsConformance, runFormConformance, runMetadataConformance, runPageDeleteConformance, runPageExtractConformance, runPageFlattenConformance, runPageInsertConformance, runPageReorderConformance, runPageRotateConformance, runPageTextConformance, runPieceInfoConformance, runRedactionApplyConformance, runSearchConformance };
625
+ export { type ActionsConformanceFixtures, type ActionsConformanceOptions, type AnnotationAppearanceConformanceFixture, type AnnotationAppearanceConformanceOptions, type AnnotationConformanceOptions, type AnnotationMutationConformanceFixture, type AnnotationMutationConformanceOptions, type AnnotationReadConformanceFixture, type ConformanceExpect, type ConformanceFixture, type ConformanceOptions, type ConformanceTestRunner, type FormConformanceFixtures, type FormConformanceOptions, type PageGeometryOrientationFixture, type PageGeometryOrientationOptions, type PageReorderConformanceFixture, type PageReorderConformanceOptions, type PageTextConformanceFixture, type PageTextConformanceOptions, type SearchConformanceFixture, type SearchConformanceOptions, TEXT_DIVERGENCE_CASES, type TextDivergenceCase, type TextDivergenceConformanceFixture, type TextDivergenceConformanceOptions, diffAnnotationListSnapshot, diffAnnotationListSnapshotAll, runActionsConformance, runAnnotationAppearanceConformance, runAnnotationMutationConformance, runAnnotationReadConformance, runAttachmentConformance, runDocumentEventsConformance, runFormConformance, runMetadataConformance, runPageDeleteConformance, runPageExtractConformance, runPageFlattenConformance, runPageGeometryOrientationConformance, runPageInsertConformance, runPageReorderConformance, runPageRotateConformance, runPageTextConformance, runPieceInfoConformance, runRedactionApplyConformance, runSearchConformance, runTextDivergenceConformance };
530
626
  //# sourceMappingURL=conformance.d.ts.map