@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.
- package/dist/AnnotationList-CkijRHet.d.cts +27163 -0
- package/dist/AnnotationList-CkijRHet.d.ts +27163 -0
- package/dist/Change-CKoxfTNY.js +889 -0
- package/dist/Change-CKoxfTNY.js.map +1 -0
- package/dist/Change-CjImsrN0.cjs +1020 -0
- package/dist/Change-CjImsrN0.cjs.map +1 -0
- package/dist/DocumentRenderService-BfFdFSwI.cjs +120 -0
- package/dist/DocumentRenderService-BfFdFSwI.cjs.map +1 -0
- package/dist/DocumentRenderService-DV3J9lMz.js +85 -0
- package/dist/DocumentRenderService-DV3J9lMz.js.map +1 -0
- package/dist/{DocumentSecurityService-Ca6EK3-3.d.ts → DocumentSecurityService-CU1M6Q7m.d.ts} +100 -112
- package/dist/{DocumentSecurityService-CIx1MT0T.d.cts → DocumentSecurityService-e6vp2de8.d.cts} +100 -112
- package/dist/LocalDocumentHandle-D02FMm-Z.cjs +53 -0
- package/dist/LocalDocumentHandle-D02FMm-Z.cjs.map +1 -0
- package/dist/LocalDocumentHandle-DAPdaOt_.js +30 -0
- package/dist/LocalDocumentHandle-DAPdaOt_.js.map +1 -0
- package/dist/LocalEngine-DFoBm4B3.d.cts +1565 -0
- package/dist/LocalEngine-DPriFujS.d.ts +1565 -0
- package/dist/PageInsertBlankInput-CXHAM7l6.cjs +17 -0
- package/dist/PageInsertBlankInput-CXHAM7l6.cjs.map +1 -0
- package/dist/PageInsertBlankInput-DhVYVJ_S.js +12 -0
- package/dist/PageInsertBlankInput-DhVYVJ_S.js.map +1 -0
- package/dist/authority-B3BklsB4.js +2239 -0
- package/dist/authority-B3BklsB4.js.map +1 -0
- package/dist/{viewport-BWeNHZmb.cjs → authority-DLMNR7ff.cjs} +820 -1647
- package/dist/authority-DLMNR7ff.cjs.map +1 -0
- package/dist/builders-CNj0POeY.js +161 -0
- package/dist/builders-CNj0POeY.js.map +1 -0
- package/dist/builders-Cgdp_YCn.cjs +184 -0
- package/dist/builders-Cgdp_YCn.cjs.map +1 -0
- package/dist/calibrate-7T3fnP8-.js +2404 -0
- package/dist/calibrate-7T3fnP8-.js.map +1 -0
- package/dist/calibrate-DJBXnhLE.cjs +2919 -0
- package/dist/calibrate-DJBXnhLE.cjs.map +1 -0
- package/dist/charmap-Cprti1ta.js +239 -0
- package/dist/charmap-Cprti1ta.js.map +1 -0
- package/dist/charmap-aYlefQP9.cjs +304 -0
- package/dist/charmap-aYlefQP9.cjs.map +1 -0
- package/dist/conformance.cjs +16466 -5247
- package/dist/conformance.cjs.map +1 -1
- package/dist/conformance.d.cts +924 -165
- package/dist/conformance.d.ts +924 -165
- package/dist/conformance.js +16429 -5252
- package/dist/conformance.js.map +1 -1
- package/dist/format-Bp3QFSH1.cjs +574 -0
- package/dist/format-Bp3QFSH1.cjs.map +1 -0
- package/dist/format-Dgg428Kb.js +461 -0
- package/dist/format-Dgg428Kb.js.map +1 -0
- package/dist/index.cjs +323 -116
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +14 -5
- package/dist/pageRefs-B3ur7Ckm.cjs +51 -0
- package/dist/pageRefs-B3ur7Ckm.cjs.map +1 -0
- package/dist/pageRefs-DkbuxSCV.js +40 -0
- package/dist/pageRefs-DkbuxSCV.js.map +1 -0
- package/dist/public.cjs +57 -0
- package/dist/public.d.cts +5 -0
- package/dist/public.d.ts +5 -0
- package/dist/public.js +9 -0
- package/dist/resolveAnnotationDraft-7Ke4nV7F.cjs +3646 -0
- package/dist/resolveAnnotationDraft-7Ke4nV7F.cjs.map +1 -0
- package/dist/resolveAnnotationDraft-CUpf0SMh.js +3167 -0
- package/dist/resolveAnnotationDraft-CUpf0SMh.js.map +1 -0
- package/dist/{resolver-inAVzsWt.js → resolver-CzxmD9Ck.js} +294 -144
- package/dist/resolver-CzxmD9Ck.js.map +1 -0
- package/dist/{resolver-CYVNV4hn.cjs → resolver-D2OCtE8F.cjs} +347 -143
- package/dist/resolver-D2OCtE8F.cjs.map +1 -0
- package/dist/runtime-Cl0v56mm.d.ts +2032 -0
- package/dist/runtime-p1WDzDo4.d.cts +2032 -0
- package/dist/runtime.cjs +726 -297
- package/dist/runtime.cjs.map +1 -1
- package/dist/runtime.d.cts +5 -1372
- package/dist/runtime.d.ts +5 -1372
- package/dist/runtime.js +396 -179
- package/dist/runtime.js.map +1 -1
- package/dist/schema-C-gU4vj7.cjs +3034 -0
- package/dist/schema-C-gU4vj7.cjs.map +1 -0
- package/dist/schema-DzlUNk38.js +2081 -0
- package/dist/schema-DzlUNk38.js.map +1 -0
- package/dist/schemas-Berf1swF.cjs +2481 -0
- package/dist/schemas-Berf1swF.cjs.map +1 -0
- package/dist/schemas-D6xOGjqg.js +1654 -0
- package/dist/schemas-D6xOGjqg.js.map +1 -0
- package/dist/subtype-CG4WpIRj.js +129 -0
- package/dist/subtype-CG4WpIRj.js.map +1 -0
- package/dist/subtype-aDt5TFmK.cjs +158 -0
- package/dist/subtype-aDt5TFmK.cjs.map +1 -0
- package/dist/validation.cjs +578 -0
- package/dist/validation.cjs.map +1 -0
- package/dist/validation.d.cts +174 -0
- package/dist/validation.d.ts +174 -0
- package/dist/validation.js +571 -0
- package/dist/validation.js.map +1 -0
- package/dist/value-BFS1R8ek.cjs +435 -0
- package/dist/value-BFS1R8ek.cjs.map +1 -0
- package/dist/value-Dhc8eYcx.js +340 -0
- package/dist/value-Dhc8eYcx.js.map +1 -0
- package/dist/viewport-BJW13EGZ.js +540 -0
- package/dist/viewport-BJW13EGZ.js.map +1 -0
- package/dist/viewport-DlL5Bxbg.cjs +671 -0
- package/dist/viewport-DlL5Bxbg.cjs.map +1 -0
- package/dist/wire.cjs +1051 -397
- package/dist/wire.cjs.map +1 -1
- package/dist/wire.d.cts +12403 -790
- package/dist/wire.d.ts +12403 -790
- package/dist/wire.js +821 -242
- package/dist/wire.js.map +1 -1
- package/package.json +10 -1
- package/dist/AbortError-DwuHPK_I.js +0 -27
- package/dist/AbortError-DwuHPK_I.js.map +0 -1
- package/dist/AbortError-P0RU0Mgg.cjs +0 -38
- package/dist/AbortError-P0RU0Mgg.cjs.map +0 -1
- package/dist/AnnotationListSnapshot-D9R5n2Kf.d.cts +0 -7101
- package/dist/AnnotationListSnapshot-D9R5n2Kf.d.ts +0 -7101
- package/dist/Engine-EWWHhEIi.d.ts +0 -1277
- package/dist/Engine-FNaAEjfb.d.cts +0 -1277
- package/dist/derive-BbsDk_Kz.cjs +0 -880
- package/dist/derive-BbsDk_Kz.cjs.map +0 -1
- package/dist/derive-DAFJolWu.js +0 -647
- package/dist/derive-DAFJolWu.js.map +0 -1
- package/dist/format-Bbphf4zR.js +0 -435
- package/dist/format-Bbphf4zR.js.map +0 -1
- package/dist/format-D_epWlob.cjs +0 -518
- package/dist/format-D_epWlob.cjs.map +0 -1
- package/dist/resolver-CYVNV4hn.cjs.map +0 -1
- package/dist/resolver-inAVzsWt.js.map +0 -1
- package/dist/schemas-CFQGvWiu.js +0 -3243
- package/dist/schemas-CFQGvWiu.js.map +0 -1
- package/dist/schemas-D0g6tKa9.cjs +0 -4694
- package/dist/schemas-D0g6tKa9.cjs.map +0 -1
- package/dist/viewport-BWeNHZmb.cjs.map +0 -1
- package/dist/viewport-CvMcadfQ.js +0 -3072
- package/dist/viewport-CvMcadfQ.js.map +0 -1
package/dist/conformance.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"conformance.cjs","names":["openFixture","AbortError","EngineError","EngineErrorCode","measureFromKnownLength","measurementReadout","refKey","EngineErrorCode","AbortError","openFixture","AnnotationListSnapshotAllPagesSchema","AnnotationListPageSnapshotSchema","AnnotationDTOSchema","AbortError","EngineError","EngineErrorCode","open","DocumentActionsSnapshotSchema","DEFAULT_QUAD","openFixture","AnnotationCreateResultSchema","AnnotationUpdateResultSchema","EngineError","EngineErrorCode","AnnotationDeleteResultSchema","AbortError","AnnotationMoveResultSchema","EngineErrorCode","openFixture","AbortError","openFixture","PageListSnapshotSchema","PageMoveResultSchema","EngineError","EngineErrorCode","AbortError","QUAD","openFixture","PageRotateResultSchema","EngineError","EngineErrorCode","AbortError","QUAD","openFixture","PageDeleteResultSchema","EngineError","EngineErrorCode","AbortError","openFixture","EngineErrorCode","EngineError","AbortError","square","openFixture","AnnotationFlattenResultSchema","EngineErrorCode","EngineError","PDF_MAGIC","openFixture","EngineErrorCode","openFixture","PageFlattenResultSchema","EngineErrorCode","openFixture","RedactionApplyResultSchema","EngineErrorCode","openFixture","EngineError","EngineErrorCode","AbortError","EngineError","openFixture","EngineError","EngineErrorCode","openFixture","EngineError","EngineErrorCode","openFixture","openFixture","openFixture","PageTextSnapshotSchema","EngineError","EngineErrorCode","AbortError","openFixture","PageTextSnapshotSchema","sliceTextByChars","openFixture","PageGeometrySnapshotSchema","isRotatedGeometryRun","pdfQuadBounds","SearchSliceSchema","foldText","EngineError","EngineErrorCode","AbortError","EngineError","EngineErrorCode"],"sources":["../src/conformance/runMetadataConformance.ts","../src/conformance/runMeasurementConformance.ts","../src/conformance/runAnnotationReadConformance.ts","../src/conformance/runActionsConformance.ts","../src/conformance/runAnnotationMutationConformance.ts","../src/conformance/runFormConformance.ts","../src/conformance/runAnnotationAppearanceConformance.ts","../src/conformance/runPageReorderConformance.ts","../src/conformance/runPageRotateConformance.ts","../src/conformance/runPageDeleteConformance.ts","../src/conformance/runNamedPagesConformance.ts","../src/conformance/runAnnotationFlattenConformance.ts","../src/conformance/runAnnotationAppearanceExportConformance.ts","../src/conformance/runPageFlattenConformance.ts","../src/conformance/runRedactionApplyConformance.ts","../src/conformance/runPageExtractConformance.ts","../src/conformance/runAttachmentConformance.ts","../src/conformance/runPageInsertConformance.ts","../src/conformance/runPageInsertBlankConformance.ts","../src/conformance/runPieceInfoConformance.ts","../src/conformance/runDocumentEventsConformance.ts","../src/conformance/runPageTextConformance.ts","../src/conformance/runTextDivergenceConformance.ts","../src/conformance/runPageGeometryOrientationConformance.ts","../src/conformance/runSearchConformance.ts","../src/conformance/diffAnnotationListSnapshot.ts","../src/conformance/runSignatureConformance.ts"],"sourcesContent":["import type { DocumentMetadata } from '../dto/DocumentMetadata';\nimport type { Engine } from '../engine/Engine';\nimport { EngineError } from '../errors/EngineError';\nimport { EngineErrorCode } from '../errors/EngineErrorCode';\nimport { AbortError } from '../promise/AbortError';\n\nexport interface ConformanceTestRunner {\n describe(name: string, fn: () => void): void;\n test(name: string, fn: () => void | Promise<void>): void;\n beforeAll(fn: () => void | Promise<void>): void;\n afterAll(fn: () => void | Promise<void>): void;\n expect: ConformanceExpect;\n}\n\nexport interface ConformanceExpect {\n (actual: unknown): {\n toBe(expected: unknown): void;\n toBeNull(): void;\n toEqual(expected: unknown): void;\n toHaveLength(expected: number): void;\n toMatch(re: RegExp): void;\n toMatchObject(shape: Record<string, unknown>): void;\n toContain(expected: unknown): void;\n toBeInstanceOf(ctor: Function): void;\n toBeTruthy(): void;\n rejects: {\n toBeInstanceOf(ctor: Function): Promise<void>;\n toMatchObject(shape: Record<string, unknown>): Promise<void>;\n };\n resolves: {\n toMatchObject(shape: Record<string, unknown>): Promise<void>;\n toEqual(expected: unknown): Promise<void>;\n };\n };\n}\n\nexport interface ConformanceFixture {\n /** Stable id used for the local engine; cloud uses its own id. */\n id: string;\n /** Bytes for the local engine. */\n bytes: () => Uint8Array | Promise<Uint8Array>;\n /** Override the cloud-side id. Defaults to `id`. */\n cloudId?: string;\n /** The expected document metadata. Used for parity assertions. */\n expected: Partial<DocumentMetadata>;\n}\n\nexport interface ConformanceOptions {\n label: string;\n /** Build a fresh engine for this suite. Suite tears it down at the end. */\n makeEngine: () => Promise<Engine> | Engine;\n /** Sample fixture for the happy-path metadata read. */\n fixture: ConformanceFixture;\n /** Engine 'kind' for opening: 'bytes' for local, 'id' for cloud. */\n openKind: 'bytes' | 'id';\n}\n\n/**\n * The conformance harness is transport-agnostic. It takes the test runner as\n * a parameter so engine-core has no dependency on vitest/jest/node:test.\n */\nexport function runMetadataConformance(\n runner: ConformanceTestRunner,\n opts: ConformanceOptions,\n): void {\n const { describe, test, beforeAll, afterAll, expect } = runner;\n\n describe(`metadata conformance: ${opts.label}`, () => {\n let engine: Engine;\n\n beforeAll(async () => {\n engine = await opts.makeEngine();\n });\n\n afterAll(async () => {\n if (engine) await engine.destroy();\n });\n\n test('reads metadata from sample fixture', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const meta = await doc.metadata.read();\n expect(meta).toMatchObject(opts.fixture.expected);\n expect(meta.trapped).toMatch(/^(true|false|unknown)$/);\n } finally {\n await doc.close();\n }\n });\n\n test('abort() before completion rejects with AbortError', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const p = doc.metadata.read();\n p.abort('test');\n await expect(p).rejects.toBeInstanceOf(AbortError);\n } finally {\n await doc.close();\n }\n });\n\n test('aborting one read does not affect a concurrent one', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const a = doc.metadata.read();\n const b = doc.metadata.read();\n a.abort('test');\n await expect(a).rejects.toBeInstanceOf(AbortError);\n await expect(b).resolves.toMatchObject(opts.fixture.expected);\n } finally {\n await doc.close();\n }\n });\n\n test('metadata after close throws DocNotOpen', async () => {\n const doc = await openFixture(engine, opts);\n await doc.close();\n let caught: unknown;\n try {\n await doc.metadata.read();\n } catch (err) {\n caught = err;\n }\n expect(caught).toBeTruthy();\n expect(EngineError.is(caught, EngineErrorCode.DocNotOpen)).toBe(true);\n });\n\n test('update() sets standard + custom fields and a subsequent read observes them', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const result = await doc.metadata.update({\n title: 'Conformance Title',\n subject: 'Conformance Subject',\n custom: { ConformanceKey: 'conformance-value' },\n });\n // The result carries the re-read metadata; cloud also carries cache\n // pins (local is null) — both expose the post-write values here.\n expect(result.metadata.title).toBe('Conformance Title');\n expect(result.metadata.subject).toBe('Conformance Subject');\n expect(result.metadata.custom.ConformanceKey).toBe('conformance-value');\n\n // A fresh read goes through the versioned leaf (cloud) / re-read\n // (local) and must observe the same write.\n const after = await doc.metadata.read();\n expect(after.title).toBe('Conformance Title');\n expect(after.subject).toBe('Conformance Subject');\n expect(after.custom.ConformanceKey).toBe('conformance-value');\n } finally {\n await doc.close();\n }\n });\n\n test('update() clears a field with null', async () => {\n const doc = await openFixture(engine, opts);\n try {\n await doc.metadata.update({ title: 'To Be Cleared' });\n const set = await doc.metadata.read();\n expect(set.title).toBe('To Be Cleared');\n\n await doc.metadata.update({ title: null });\n const cleared = await doc.metadata.read();\n expect(cleared.title).toBe(null);\n } finally {\n await doc.close();\n }\n });\n\n test('update() after close throws DocNotOpen', async () => {\n const doc = await openFixture(engine, opts);\n await doc.close();\n let caught: unknown;\n try {\n await doc.metadata.update({ title: 'nope' });\n } catch (err) {\n caught = err;\n }\n expect(caught).toBeTruthy();\n expect(EngineError.is(caught, EngineErrorCode.DocNotOpen)).toBe(true);\n });\n });\n}\n\nasync function openFixture(engine: Engine, opts: ConformanceOptions) {\n if (opts.openKind === 'bytes') {\n const bytes = await opts.fixture.bytes();\n return engine.open({ kind: 'bytes', id: opts.fixture.id, bytes });\n }\n return engine.open({ kind: 'id', id: opts.fixture.cloudId ?? opts.fixture.id });\n}\n","import type { ConformanceOptions, ConformanceTestRunner } from './runMetadataConformance';\nimport type { Engine } from '../engine/Engine';\nimport type { DocumentEvent } from '../events/DocumentEvent';\nimport type { AnnotationDraft } from '../shared';\nimport { refKey } from '../annotation/relationships';\nimport { EngineErrorCode } from '../errors/EngineErrorCode';\nimport { AbortError } from '../promise/AbortError';\nimport { measureFromKnownLength, measurementReadout } from '../measure';\n\n/** Shared numerical, persistence and calibration contract for local and HTTP engines. */\nexport function runMeasurementConformance(\n runner: ConformanceTestRunner,\n opts: ConformanceOptions,\n): void {\n const { describe, test, beforeAll, afterAll, expect } = runner;\n describe(`measurement conformance: ${opts.label}`, () => {\n let engine: Engine;\n beforeAll(async () => {\n engine = await opts.makeEngine();\n });\n afterAll(async () => {\n await engine?.destroy();\n });\n const open = async () =>\n opts.openKind === 'bytes'\n ? engine.open({ kind: 'bytes', id: opts.fixture.id, bytes: await opts.fixture.bytes() })\n : engine.open({ kind: 'id', id: opts.fixture.cloudId ?? opts.fixture.id });\n const scale = measureFromKnownLength(100, { value: 3, unit: 'm' });\n const rect = { left: 0, bottom: 0, right: 100, top: 100 };\n const vertices = [\n { x: 0, y: 0 },\n { x: 100, y: 0 },\n { x: 100, y: 100 },\n ];\n\n test('geometry derives contents while caption patches retain placement', async () => {\n const doc = await open();\n try {\n const page = doc.page((await doc.pages.list()).pages[0].pageObjectNumber);\n const created = (\n await page.annotations.create({\n subtype: 'line',\n intent: 'LineDimension',\n rect,\n measure: scale,\n linePoints: { start: vertices[0], end: vertices[1] },\n caption: { enabled: true, offset: { along: 10, perpendicular: 20 } },\n })\n ).created;\n const inert = await page.annotations.update(created.ref, {\n subtype: 'line',\n contents: '999 m',\n });\n expect(inert.updated.contents).toBe('3 m');\n expect(inert.appearance).toEqual({ action: 'preserved', changed: false });\n const changed = await page.annotations.update(created.ref, {\n subtype: 'line',\n linePoints: { start: vertices[0], end: { x: 200, y: 0 } },\n });\n expect(changed.updated.contents).toBe('6 m');\n expect(changed.appearance.changed).toBe(true);\n const hidden = await page.annotations.update(created.ref, {\n subtype: 'line',\n caption: { enabled: false },\n });\n expect(hidden.updated).toMatchObject({\n contents: '6 m',\n caption: { enabled: false, offset: { along: 10, perpendicular: 20 } },\n });\n expect(hidden.appearance.changed).toBe(true);\n const reset = await page.annotations.update(created.ref, {\n subtype: 'line',\n caption: { enabled: true, offset: null },\n measure: null,\n });\n expect(reset.updated.contents).toBe('6 m');\n expect(\n reset.updated.subtype === 'line' && reset.updated.caption?.offset === undefined,\n ).toBe(true);\n expect(measurementReadout(reset.updated)).toEqual({ unavailable: 'no-measure' });\n } finally {\n await doc.close();\n }\n });\n\n test('all three kinds derive labels, save, reopen and retain captions', async () => {\n let doc = await open();\n try {\n const pon = (await doc.pages.list()).pages[0].pageObjectNumber;\n const drafts: AnnotationDraft[] = [\n {\n subtype: 'line',\n rect,\n intent: 'LineDimension',\n // Both coordinates and /C cross float32 rounding boundaries.\n measure: measureFromKnownLength(1, { value: 1.00000001, unit: 'm' }),\n contents: 'wrong',\n linePoints: { start: vertices[0], end: { x: 3.4450000001, y: 0 } },\n caption: { enabled: true, offset: { along: 10, perpendicular: 20 } },\n },\n {\n subtype: 'polyline',\n rect,\n intent: 'PolyLineDimension',\n measure: scale,\n contents: 'wrong',\n vertices,\n caption: { enabled: true, center: { x: 0, y: 0 } },\n },\n {\n subtype: 'polygon',\n rect,\n intent: 'PolygonDimension',\n measure: scale,\n contents: 'wrong',\n vertices,\n caption: { enabled: true, center: { x: 50, y: 30 } },\n },\n ];\n const saved = [];\n for (const draft of drafts) {\n const preview = measurementReadout(draft);\n const a = (await doc.page(pon).annotations.create(draft)).created;\n expect(a.contents).toBe('label' in preview ? preview.label : undefined);\n saved.push(a);\n }\n const bytes = opts.openKind === 'bytes' ? await doc.download() : undefined;\n await doc.close();\n doc = bytes\n ? await engine.open({ kind: 'bytes', id: `${opts.fixture.id}-saved`, bytes })\n : await open();\n const page = doc.page((await doc.pages.list()).pages[0].pageObjectNumber);\n const list = (await page.annotations.list()).annotations;\n for (const before of saved) {\n const a = list.find((a) => refKey(a.ref) === refKey(before.ref))!;\n expect(a.contents).toBe(before.contents);\n if (a.subtype !== 'line' && a.subtype !== 'polygon' && a.subtype !== 'polyline')\n throw new Error('Missing dimension');\n expect(a.caption).toEqual('caption' in before ? before.caption : undefined);\n const result = await page.annotations.update(a.ref, {\n subtype: a.subtype,\n color: { r: 0, g: 0, b: 255 },\n });\n expect(result.updated.contents).toBe(before.contents);\n }\n } finally {\n await doc.close();\n }\n });\n\n test('calibration updates only viewports and emits one event per write', async () => {\n const doc = await open();\n try {\n const pon = (await doc.pages.list()).pages[0].pageObjectNumber;\n const page = doc.page(pon);\n if (!page.measure) throw new Error('Measurement service is required');\n const foreign = (await page.measure.viewports()).filter((v) => !v.owned);\n const annotations = (await page.annotations.list()).annotations;\n const events: DocumentEvent[] = [];\n const off = doc.events.subscribe((event) => events.push(event));\n try {\n await page.measure.setScale(scale);\n expect((await page.measure.viewports()).filter((v) => v.owned)).toHaveLength(1);\n expect((await page.annotations.list()).annotations).toEqual(annotations);\n await page.measure.setScale(null);\n expect(await page.measure.viewports()).toEqual(foreign);\n const changes = events.filter((e) => e.type === 'page.viewportsChanged');\n expect(changes).toHaveLength(2);\n for (const event of changes)\n expect(event).toMatchObject({ pageObjectNumber: pon, meta: { affectedPages: [] } });\n } finally {\n off();\n }\n } finally {\n await doc.close();\n }\n });\n\n test('invalid and immediately aborted calibration leaves the previous scale intact', async () => {\n const doc = await open();\n try {\n const page = doc.page((await doc.pages.list()).pages[0].pageObjectNumber);\n await page.measure!.setScale(scale);\n const before = await page.measure!.viewports();\n await expect(\n page.measure!.setScale({ ...scale, x: [{ unit: 'm', conversion: 0 }] }),\n ).rejects.toMatchObject({ code: EngineErrorCode.InvalidArg });\n const pending = page.measure!.setScale(null);\n pending.abort('conformance');\n await expect(pending).rejects.toBeInstanceOf(AbortError);\n expect(await page.measure!.viewports()).toEqual(before);\n } finally {\n await doc.close();\n }\n });\n });\n}\n","import type {\n ConformanceTestRunner,\n ConformanceFixture,\n ConformanceOptions,\n} from './runMetadataConformance';\nimport type { AnnotationListPageSnapshot } from '../annotation/AnnotationListSnapshot';\nimport { AnnotationDTOSchema } from '../annotation/kinds';\nimport type { AnnotationDTO } from '../annotation/kinds';\nimport type { Engine } from '../engine/Engine';\nimport { EngineError } from '../errors/EngineError';\nimport { EngineErrorCode } from '../errors/EngineErrorCode';\nimport { AbortError } from '../promise/AbortError';\nimport {\n AnnotationListPageSnapshotSchema,\n AnnotationListSnapshotAllPagesSchema,\n} from '../wire/schemas';\n\n/**\n * Expected per-fixture annotation knowledge. The harness asserts against\n * these without locking the exact wire content, so different fixtures can\n * be added by suites without rewriting the harness.\n */\nexport interface AnnotationReadConformanceFixture extends ConformanceFixture {\n /** PDF object number of the page used by the annotation tests. */\n pageObjectNumber: number;\n /** The total annotation count expected on that page (across all subtypes). */\n expectedAnnotationCount: number;\n /** At least this many `'highlight'` annotations on the page. */\n minHighlightCount: number;\n /** At least this many `'unsupported'` annotations on the page. */\n minUnsupportedCount: number;\n /** At least this many `'circle'` annotations on the page. Defaults to 0. */\n minCircleCount?: number;\n /** At least this many `'square'` annotations on the page. Defaults to 0. */\n minSquareCount?: number;\n /** At least this many `'polygon'` annotations on the page. Defaults to 0. */\n minPolygonCount?: number;\n /** At least this many `'polyline'` annotations on the page. Defaults to 0. */\n minPolylineCount?: number;\n /** At least this many `'line'` annotations on the page. Defaults to 0. */\n minLineCount?: number;\n /** At least this many `'ink'` annotations on the page. Defaults to 0. */\n minInkCount?: number;\n /** At least this many `'free-text'` annotations on the page. Defaults to 0. */\n minFreeTextCount?: number;\n /** At least this many `'caret'` annotations on the page. Defaults to 0. */\n minCaretCount?: number;\n /**\n * `true` if the fixture has at least one weak annotation (no /NM, direct\n * object). Drives the weak-ref + revision tests.\n */\n expectsWeakAnnotation: boolean;\n}\n\nexport interface AnnotationConformanceOptions extends Omit<ConformanceOptions, 'fixture'> {\n fixture: AnnotationReadConformanceFixture;\n}\n\nexport function runAnnotationReadConformance(\n runner: ConformanceTestRunner,\n opts: AnnotationConformanceOptions,\n): void {\n const { describe, test, beforeAll, afterAll, expect } = runner;\n\n describe(`annotation read conformance: ${opts.label}`, () => {\n let engine: Engine;\n\n beforeAll(async () => {\n engine = await opts.makeEngine();\n });\n\n afterAll(async () => {\n if (engine) await engine.destroy();\n });\n\n test('listRawAll returns one entry per page with valid PageState', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const snap = await doc.annotations.listRawAll();\n expect(AnnotationListSnapshotAllPagesSchema.safeParse(snap).success).toBe(true);\n expect(snap.pages.length >= 1).toBe(true);\n // Cloud stamps its reconciliation cursor; local omits it. When\n // present it must be a nonnegative integer.\n if (snap.auditHead !== undefined) {\n expect(Number.isInteger(snap.auditHead) && snap.auditHead >= 0).toBe(true);\n }\n const target = snap.pages.find(\n (p) => p.pageState.pageObjectNumber === opts.fixture.pageObjectNumber,\n );\n expect(target !== undefined).toBe(true);\n expect(target!.annotations.length).toBe(opts.fixture.expectedAnnotationCount);\n } finally {\n await doc.close();\n }\n });\n\n test('listRaw on the test page returns the expected counts and DTO shape', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const snap = await doc.annotations.listRaw(opts.fixture.pageObjectNumber);\n expect(AnnotationListPageSnapshotSchema.safeParse(snap).success).toBe(true);\n expect(snap.annotations.length).toBe(opts.fixture.expectedAnnotationCount);\n const highlights = snap.annotations.filter((a) => a.subtype === 'highlight');\n expect(highlights.length >= opts.fixture.minHighlightCount).toBe(true);\n const unsupported = snap.annotations.filter((a) => a.subtype === 'unsupported');\n expect(unsupported.length >= opts.fixture.minUnsupportedCount).toBe(true);\n const circles = snap.annotations.filter((a) => a.subtype === 'circle');\n expect(circles.length >= (opts.fixture.minCircleCount ?? 0)).toBe(true);\n const squares = snap.annotations.filter((a) => a.subtype === 'square');\n expect(squares.length >= (opts.fixture.minSquareCount ?? 0)).toBe(true);\n const polygons = snap.annotations.filter((a) => a.subtype === 'polygon');\n expect(polygons.length >= (opts.fixture.minPolygonCount ?? 0)).toBe(true);\n const polylines = snap.annotations.filter((a) => a.subtype === 'polyline');\n expect(polylines.length >= (opts.fixture.minPolylineCount ?? 0)).toBe(true);\n const lines = snap.annotations.filter((a) => a.subtype === 'line');\n expect(lines.length >= (opts.fixture.minLineCount ?? 0)).toBe(true);\n const inks = snap.annotations.filter((a) => a.subtype === 'ink');\n expect(inks.length >= (opts.fixture.minInkCount ?? 0)).toBe(true);\n const freeTexts = snap.annotations.filter((a) => a.subtype === 'free-text');\n expect(freeTexts.length >= (opts.fixture.minFreeTextCount ?? 0)).toBe(true);\n const carets = snap.annotations.filter((a) => a.subtype === 'caret');\n expect(carets.length >= (opts.fixture.minCaretCount ?? 0)).toBe(true);\n } finally {\n await doc.close();\n }\n });\n\n test('shape/vertex/line annotations expose their family fields', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const snap = await doc.annotations.listRaw(opts.fixture.pageObjectNumber);\n for (const a of snap.annotations) {\n // Ink carries the geometry styling (/C, /CA, /BS) but NOT /IC, plus\n // its /InkList (a non-empty array of point paths).\n if (a.subtype === 'ink') {\n expect(a.color !== undefined && a.color !== null).toBe(true);\n expect(typeof a.strokeWidth).toBe('number');\n expect(typeof a.borderStyle).toBe('string');\n expect(typeof a.opacity).toBe('number');\n expect('interiorColor' in a).toBe(false);\n expect(Array.isArray(a.inkList)).toBe(true);\n expect(a.inkList.length >= 1).toBe(true);\n expect(Array.isArray(a.inkList[0])).toBe(true);\n expect(a.inkList[0]!.length >= 1).toBe(true);\n continue;\n }\n // Free text: text fields (/DA) + nullable /C background + intent.\n if (a.subtype === 'free-text') {\n expect(typeof a.fontFamily).toBe('string');\n expect(typeof a.fontSize).toBe('number');\n expect(typeof a.textAlign).toBe('string');\n expect(a.color !== undefined && a.color !== null).toBe(true);\n expect('interiorColor' in a).toBe(true);\n expect(a.intent === 'free-text' || a.intent === 'free-text-callout').toBe(true);\n if (a.intent === 'free-text-callout' && a.calloutLine) {\n expect(a.calloutLine.length === 2 || a.calloutLine.length === 3).toBe(true);\n }\n continue;\n }\n // Caret: color-only style (/C, /CA) + optional /RD, no border/quads.\n if (a.subtype === 'caret') {\n expect(a.color !== undefined && a.color !== null).toBe(true);\n expect(typeof a.opacity).toBe('number');\n expect('strokeWidth' in a).toBe(false);\n expect('quadPoints' in a).toBe(false);\n continue;\n }\n // Every stroke/fill family member shares this styling surface.\n const isFilledStyle =\n a.subtype === 'circle' ||\n a.subtype === 'square' ||\n a.subtype === 'polygon' ||\n a.subtype === 'polyline' ||\n a.subtype === 'line';\n if (!isFilledStyle) continue;\n // interiorColor is Color | null; color (/C) is always present.\n expect(a.color !== undefined && a.color !== null).toBe(true);\n expect(typeof a.strokeWidth).toBe('number');\n expect(typeof a.borderStyle).toBe('string');\n expect(typeof a.opacity).toBe('number');\n expect('interiorColor' in a).toBe(true);\n\n if (a.subtype === 'polygon' || a.subtype === 'polyline') {\n expect(Array.isArray(a.vertices)).toBe(true);\n expect(a.vertices.length >= 2).toBe(true);\n }\n if (a.subtype === 'polyline') {\n expect(typeof a.lineEndings.start).toBe('string');\n expect(typeof a.lineEndings.end).toBe('string');\n }\n if (a.subtype === 'line') {\n expect(typeof a.linePoints.start.x).toBe('number');\n expect(typeof a.linePoints.end.y).toBe('number');\n expect(typeof a.lineEndings.start).toBe('string');\n expect(typeof a.lineEndings.end).toBe('string');\n }\n }\n } finally {\n await doc.close();\n }\n });\n\n test('full page list dispatches per-subtype and matches raw counts', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const page = doc.page(opts.fixture.pageObjectNumber);\n const full = await page.annotations.list();\n expect(AnnotationListPageSnapshotSchema.safeParse(full).success).toBe(true);\n expect(full.annotations.length).toBe(opts.fixture.expectedAnnotationCount);\n } finally {\n await doc.close();\n }\n });\n\n test('every annotation DTO satisfies AnnotationDTOSchema (discriminated union)', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const snap = await doc.annotations.listRaw(opts.fixture.pageObjectNumber);\n for (const a of snap.annotations) {\n const result = AnnotationDTOSchema.safeParse(a);\n expect(result.success).toBe(true);\n }\n } finally {\n await doc.close();\n }\n });\n\n test('AnnotationDTOSchema rejects an annotation with a foreign subtype', () => {\n const bogus: unknown = {\n subtype: 'pretend-not-real',\n ref: { kind: 'objectNumber', pageObjectNumber: 1, annotObjectNumber: 1 },\n pageObjectNumber: 1,\n index: 0,\n identityQuality: 'durable',\n nm: null,\n flags: emptyFlags(),\n rect: { left: 0, top: 0, right: 0, bottom: 0 },\n contents: null,\n author: null,\n created: null,\n modified: null,\n };\n const result = AnnotationDTOSchema.safeParse(bogus);\n expect(result.success).toBe(false);\n });\n\n if (opts.fixture.expectsWeakAnnotation) {\n test('weak annotations carry identityQuality: weak and ref.kind: index', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const snap = await doc.annotations.listRaw(opts.fixture.pageObjectNumber);\n const weak = snap.annotations.find((a) => a.identityQuality === 'weak');\n expect(weak !== undefined).toBe(true);\n expect(weak!.ref.kind).toBe('index');\n } finally {\n await doc.close();\n }\n });\n\n test('a stale revision token throws InvalidReference', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const page = doc.page(opts.fixture.pageObjectNumber);\n const snap = await page.annotations.list();\n const weak = snap.annotations.find((a) => a.identityQuality === 'weak');\n expect(weak !== undefined).toBe(true);\n const staleRevision = {\n ...snap.pageState.revision,\n generation: snap.pageState.revision.generation + 999,\n };\n // create() will fail in this slice with NotImplemented; the\n // path we exercise here is reading-back via a fabricated\n // index-ref. We can't hit it via a public read API today, so\n // this test is a placeholder until mutations land. It still\n // proves the schema accepts a stale revision shape.\n expect(staleRevision.generation > snap.pageState.revision.generation).toBe(true);\n } finally {\n await doc.close();\n }\n });\n }\n\n test('abort() on listRaw rejects with AbortError', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const p = doc.annotations.listRaw(opts.fixture.pageObjectNumber);\n p.abort('test');\n await expect(p).rejects.toBeInstanceOf(AbortError);\n } finally {\n await doc.close();\n }\n });\n\n test('listRaw on an unknown pageObjectNumber throws NotFound', async () => {\n const doc = await openFixture(engine, opts);\n try {\n let caught: unknown;\n try {\n await doc.annotations.listRaw(999_999_999);\n } catch (err) {\n caught = err;\n }\n expect(caught).toBeTruthy();\n expect(EngineError.is(caught, EngineErrorCode.NotFound)).toBe(true);\n } finally {\n await doc.close();\n }\n });\n });\n}\n\nasync function openFixture(engine: Engine, opts: AnnotationConformanceOptions) {\n if (opts.openKind === 'bytes') {\n const bytes = await opts.fixture.bytes();\n return engine.open({ kind: 'bytes', id: opts.fixture.id, bytes });\n }\n return engine.open({ kind: 'id', id: opts.fixture.cloudId ?? opts.fixture.id });\n}\n\nfunction emptyFlags() {\n return {\n invisible: false,\n hidden: false,\n print: false,\n noZoom: false,\n noRotate: false,\n noView: false,\n readOnly: false,\n locked: false,\n toggleNoView: false,\n lockedContents: false,\n };\n}\n\n// Re-export for convenience: tests can hand a literal snapshot.\nexport type { AnnotationListPageSnapshot, AnnotationDTO };\n","import type { DocumentHandle } from '../engine/DocumentHandle';\nimport type { Engine } from '../engine/Engine';\nimport type { PdfActionNode } from '../dto/PdfAction';\nimport { DocumentActionsSnapshotSchema } from '../dto/PdfAction.schema';\nimport type { ConformanceFixture, ConformanceTestRunner } from './runMetadataConformance';\n\n/** The script payload rides only the javascript/rendition arms. */\nfunction scriptOf(node: PdfActionNode | null | undefined): string {\n if (!node) return '';\n if (node.type === 'javascript') return node.script;\n if (node.type === 'rendition') return node.script ?? '';\n return '';\n}\n\nexport interface ActionsConformanceFixtures {\n document: ConformanceFixture;\n page: ConformanceFixture;\n annotation: ConformanceFixture;\n field: ConformanceFixture;\n /** `action_payloads.pdf` — every executable payload shape on one page of\n * /NM-keyed links. REQUIRED on both flavours: payload parity is a gate. */\n payloads: ConformanceFixture;\n /** `open_action_dest.pdf` — a destination-form catalog `/OpenAction`. */\n openDestination: ConformanceFixture;\n /** A page whose only annotation is a Link with a `/S /JavaScript` action.\n * Optional: the javascript-link classification test skips without it. */\n javascriptLink?: ConformanceFixture;\n}\n\nexport interface ActionsConformanceOptions {\n label: string;\n makeEngine: () => Promise<Engine> | Engine;\n fixtures: ActionsConformanceFixtures;\n openKind: 'bytes' | 'id';\n}\n\n/** Action extraction parity. These tests assert data only; no script executes. */\nexport function runActionsConformance(\n runner: ConformanceTestRunner,\n opts: ActionsConformanceOptions,\n): void {\n const { describe, test, beforeAll, afterAll, expect } = runner;\n let engine: Engine;\n\n describe(`actions conformance: ${opts.label}`, () => {\n beforeAll(async () => {\n engine = await opts.makeEngine();\n });\n\n afterAll(async () => {\n if (engine) await engine.destroy();\n });\n\n test('reads catalog additional actions and preserves /CO identity', async () => {\n const doc = await open(engine, opts, opts.fixtures.document);\n try {\n expect(Boolean(doc.actions)).toBe(true);\n const snapshot = await doc.actions!.read();\n expect(DocumentActionsSnapshotSchema.safeParse(snapshot).success).toBe(true);\n expect(snapshot.openAction).toBeNull();\n expect(snapshot.willSave?.root?.type).toBe('javascript');\n expect(scriptOf(snapshot.willSave?.root)).toMatch(/Will Save/);\n expect(scriptOf(snapshot.didSave?.root)).toMatch(/Did Save/);\n expect(scriptOf(snapshot.willPrint?.root)).toMatch(/Will Print/);\n expect(scriptOf(snapshot.didPrint?.root)).toMatch(/Did Print/);\n\n const form = await doc.forms.list();\n expect(form.calculationOrder).toEqual([{ kind: 'objectNumber', fieldObjectNumber: 9 }]);\n } finally {\n await doc.close();\n }\n });\n\n test('attaches page /AA to PageLayout', async () => {\n const doc = await open(engine, opts, opts.fixtures.page);\n try {\n const pages = await doc.pages.list();\n expect(pages.pages[0].actions?.open?.root?.type).toBe('goto-embedded');\n expect(pages.pages[0].actions?.close).toBe(undefined);\n expect(pages.pages[1].actions?.open?.root?.type).toBe('goto-embedded');\n expect(pages.pages[1].actions?.close?.root?.type).toBe('goto-embedded');\n } finally {\n await doc.close();\n }\n });\n\n test('attaches activation actions to AnnotationBase, including links', async () => {\n const doc = await open(engine, opts, opts.fixtures.annotation);\n try {\n const firstPage = (await doc.pages.list()).pages[0];\n const snapshot = await doc.page(firstPage.pageObjectNumber).annotations.list();\n const button = snapshot.annotations.find(\n (annotation) =>\n annotation.ref.kind === 'objectNumber' && annotation.ref.annotObjectNumber === 7,\n );\n const link = snapshot.annotations.find(\n (annotation) =>\n annotation.ref.kind === 'objectNumber' && annotation.ref.annotObjectNumber === 8,\n );\n expect(button?.actions?.activate?.root?.type).toBe('uri');\n // A link carries BOTH planes: the base-level scripting action model\n // (chain shape, for the orchestrator) and its own normalized target\n // (payload, for navigation). They must agree on the action type.\n expect(link?.subtype).toBe('link');\n expect(link?.actions?.activate?.root?.type).toBe('uri');\n if (link?.subtype === 'link') {\n expect(link.target?.kind).toBe('uri');\n }\n } finally {\n await doc.close();\n }\n });\n\n test('classifies a /S /JavaScript link target, script staying on base.actions', async () => {\n const fixture = opts.fixtures.javascriptLink;\n if (!fixture) return; // fixture not provided for this engine flavour\n const doc = await open(engine, opts, fixture);\n try {\n const firstPage = (await doc.pages.list()).pages[0];\n const snapshot = await doc.page(firstPage.pageObjectNumber).annotations.list();\n const link = snapshot.annotations.find((annotation) => annotation.subtype === 'link');\n expect(link?.subtype).toBe('link');\n if (link?.subtype === 'link') {\n // The navigation vocabulary classifies (FPDFAction_GetType alone\n // cannot — it has no JavaScript code)…\n expect(link.target).toEqual({ kind: 'javascript' });\n }\n // …while the script text lives ONLY on the scripting plane's model.\n expect(link?.actions?.activate?.root?.type).toBe('javascript');\n expect(scriptOf(link?.actions?.activate?.root)).toMatch(/app\\.alert/);\n } finally {\n await doc.close();\n }\n });\n\n test('keeps field actions separate from merged widget events', async () => {\n const doc = await open(engine, opts, opts.fixtures.field);\n try {\n const form = await doc.forms.list();\n expect(form.fields).toHaveLength(1);\n expect(form.fields[0].actions?.format?.root?.type).toBe('javascript');\n expect(scriptOf(form.fields[0].actions?.format?.root)).toMatch(/AFDate_FormatEx/);\n const page = (await doc.pages.list()).pages[0];\n const widget = (await doc.page(page.pageObjectNumber).annotations.list()).annotations[0];\n expect(widget.actions).toBe(undefined);\n } finally {\n await doc.close();\n }\n });\n\n test('carries interpreter payloads on every executable node', async () => {\n const doc = await open(engine, opts, opts.fixtures.payloads);\n try {\n const page = (await doc.pages.list()).pages[0];\n const snapshot = await doc.page(page.pageObjectNumber).annotations.list();\n const pon = page.pageObjectNumber;\n const rootOf = (nm: string) => {\n const annotation = snapshot.annotations.find((candidate) => candidate.nm === nm);\n expect(Boolean(annotation)).toBe(true);\n return annotation?.actions?.activate?.root ?? null;\n };\n const targetOf = (nm: string) => {\n const annotation = snapshot.annotations.find((candidate) => candidate.nm === nm);\n return annotation?.subtype === 'link' ? annotation.target : null;\n };\n\n expect(rootOf('goto-fitr')).toMatchObject({\n type: 'goto',\n destination: { kind: 'fitR', pageObjectNumber: pon, left: 10, bottom: 20, right: 300, top: 400 },\n });\n // Dual planes agree by construction: the target IS the tree's projection.\n expect(targetOf('goto-fitr')).toMatchObject({ kind: 'goto', destination: { kind: 'fitR' } });\n\n expect(rootOf('uri-map')).toMatchObject({\n type: 'uri',\n uri: 'https://example.test/map',\n isMap: true,\n });\n expect(rootOf('named-next')).toMatchObject({ type: 'named', name: 'NextPage' });\n\n const mixed = rootOf('hide-mixed');\n expect(mixed).toMatchObject({ type: 'hide', hide: false });\n const mixedTargets = mixed?.type === 'hide' ? mixed.targets : [];\n expect(mixedTargets).toHaveLength(2);\n expect(mixedTargets[0]).toEqual({ kind: 'name', name: 'note1' });\n expect(\n mixedTargets[1]?.kind === 'objectNumber' && mixedTargets[1].objectNumber > 0,\n ).toBe(true);\n expect(rootOf('hide-scalar')).toMatchObject({\n type: 'hide',\n targets: [{ kind: 'name', name: 'fieldB' }],\n hide: true,\n });\n\n // ResetForm's three states survive the wire distinctly.\n expect(rootOf('reset-include')).toMatchObject({\n type: 'reset-form',\n fields: [{ kind: 'name', name: 'calc1' }],\n exclude: true,\n });\n expect(rootOf('reset-absent')).toMatchObject({ type: 'reset-form', fields: null, exclude: true });\n expect(rootOf('reset-empty')).toMatchObject({ type: 'reset-form', fields: [], exclude: false });\n\n // SubmitForm's ATOMIC payload (Phase 4). /UF beats /F in a\n // conforming << /FS /URL >> spec; a bare-string /F is the\n // producer-compat extension; bit 9 dominates format with GetMethod\n // kept alive (ISO 32000-2 Table 240).\n expect(rootOf('submit-urlspec')).toMatchObject({\n type: 'submit-form',\n payload: {\n url: 'https://uf.example.test/submit',\n fields: [{ kind: 'name', name: 'parent' }],\n flags: { raw: 0, exclude: false, format: 'fdf', method: 'post' },\n },\n });\n expect(rootOf('submit-compat-xfdf')).toMatchObject({\n type: 'submit-form',\n payload: {\n url: 'https://example.test/xfdf',\n fields: [\n { kind: 'name', name: 'noexport' },\n { kind: 'name', name: 'plain' },\n ],\n flags: {\n raw: 35,\n exclude: true,\n includeNoValueFields: true,\n format: 'xfdf',\n method: 'post',\n },\n charSet: 'utf-8',\n },\n });\n expect(rootOf('submit-pdf-get')).toMatchObject({\n type: 'submit-form',\n payload: {\n url: 'https://example.test/pdf',\n fields: null,\n flags: { raw: 264, format: 'pdf', method: 'get' },\n },\n });\n\n expect(rootOf('launch-app')).toMatchObject({ type: 'launch', filePath: 'app.exe' });\n expect(rootOf('gotor-file')).toMatchObject({ type: 'goto-remote', filePath: 'other.pdf' });\n\n // A mixed /Next chain carries every payload in PDF order.\n const chain = rootOf('chain-js-goto-hide');\n expect(chain).toMatchObject({ type: 'javascript', script: \"app.alert('chain');\" });\n expect(chain?.next[0]).toMatchObject({\n type: 'goto',\n destination: { kind: 'xyz', pageObjectNumber: pon, left: 5, top: 10, zoom: 1.25 },\n });\n expect(chain?.next[0]?.next[0]).toMatchObject({\n type: 'hide',\n targets: [{ kind: 'name', name: 'note1' }],\n hide: true,\n });\n } finally {\n await doc.close();\n }\n });\n\n test('degrades unreadable payloads to unknown with payload-dropped', async () => {\n const doc = await open(engine, opts, opts.fixtures.payloads);\n try {\n const page = (await doc.pages.list()).pages[0];\n const snapshot = await doc.page(page.pageObjectNumber).annotations.list();\n for (const [nm, subtype] of [\n ['goto-malformed', 'GoTo'],\n ['hide-partial', 'Hide'], // a partial target list must never half-execute\n // The atomic-payload law: a submit whose REQUIRED /F is not a URL\n // (or is absent) degrades WHOLE — never a half payload.\n ['submit-not-url', 'SubmitForm'],\n ['submit-no-f', 'SubmitForm'],\n ] as const) {\n const annotation = snapshot.annotations.find((candidate) => candidate.nm === nm);\n const tree = annotation?.actions?.activate;\n expect(tree?.root).toMatchObject({ type: 'unknown', subtype });\n expect(tree?.warnings ?? []).toContain('payload-dropped');\n // /A precedence, pinned: a broken action is a dead link — never a\n // silent /Dest fallback.\n if (annotation?.subtype === 'link') {\n expect(annotation.target).toEqual({ kind: 'unsupported' });\n }\n }\n } finally {\n await doc.close();\n }\n });\n\n test('reads a destination-form /OpenAction as openDestination', async () => {\n const doc = await open(engine, opts, opts.fixtures.openDestination);\n try {\n expect(Boolean(doc.actions)).toBe(true);\n const snapshot = await doc.actions!.read();\n expect(DocumentActionsSnapshotSchema.safeParse(snapshot).success).toBe(true);\n expect(snapshot.openAction).toBeNull();\n const pon = (await doc.pages.list()).pages[0].pageObjectNumber;\n expect(snapshot.openDestination).toEqual({\n kind: 'xyz',\n pageObjectNumber: pon,\n left: 10,\n top: 700,\n zoom: 1.5,\n });\n } finally {\n await doc.close();\n }\n });\n });\n}\n\nasync function open(\n engine: Engine,\n opts: ActionsConformanceOptions,\n fixture: ConformanceFixture,\n): Promise<DocumentHandle> {\n if (opts.openKind === 'bytes') {\n return engine.open({ kind: 'bytes', id: fixture.id, bytes: await fixture.bytes() });\n }\n return engine.open({ kind: 'id', id: fixture.cloudId ?? fixture.id });\n}\n","import type {\n ConformanceTestRunner,\n ConformanceFixture,\n ConformanceOptions,\n} from './runMetadataConformance';\nimport type {\n AnnotationDraft,\n AnnotationPatch,\n CaretDraft,\n CircleDraft,\n FreeTextDraft,\n HighlightDraft,\n InkDraft,\n LineDraft,\n LinkDraft,\n PolygonDraft,\n PolylineDraft,\n RedactDraft,\n SquareDraft,\n StrikeoutDraft,\n TextDraft,\n TextPatch,\n} from '../annotation/kinds';\nimport type { WeakAnnotationEditSession } from '../engine/DocumentAnnotationsService';\nimport type { DocumentHandle } from '../engine/DocumentHandle';\nimport type { Engine } from '../engine/Engine';\nimport { EngineError } from '../errors/EngineError';\nimport { EngineErrorCode } from '../errors/EngineErrorCode';\nimport type { InkList, LinePoints, PdfPoint, PdfRect } from '../geometry/primitives';\nimport type { AnnotationRef } from '../identity/AnnotationRef';\nimport { AbortError } from '../promise/AbortError';\nimport {\n AnnotationCreateResultSchema,\n AnnotationDeleteResultSchema,\n AnnotationMoveResultSchema,\n AnnotationUpdateResultSchema,\n} from '../wire/schemas';\n\n/**\n * Per-fixture knowledge the mutation harness needs. The shared fixture\n * fields (id, bytes, etc.) come from `ConformanceFixture`; the bits below\n * pin the test page. The harness asserts behaviour, not exact wire\n * content, so the same fixture can run against both local (WASM) and\n * cloud (native via @cloudpdf/server) engines.\n */\nexport interface AnnotationMutationConformanceFixture extends ConformanceFixture {\n /** PDF object number of the page used by the mutation tests. */\n pageObjectNumber: number;\n /** Page already has at least one weak annotation (no /NM, direct object). */\n expectsWeakAnnotation: boolean;\n /**\n * QuadPoints to use for the create() smoke test. Coordinates are in\n * PDF user space; pick a small rectangle that fits anywhere on the\n * fixture page so we don't flake on different page sizes.\n */\n createQuad?: HighlightDraft['quadPoints'];\n /**\n * `/Rect` to use for the shape (circle/square) create tests. PDF user\n * space; pick a small box that fits anywhere on the fixture page.\n */\n createShapeRect?: PdfRect;\n /**\n * `/Vertices` to use for the polygon/polyline create tests. PDF user\n * space; must fit inside `createShapeRect` (the rect the engine bakes\n * the appearance into). Defaults to a small triangle.\n */\n createVertices?: PdfPoint[];\n /**\n * `/L` endpoints to use for the line create test. PDF user space; must\n * fit inside `createShapeRect`. Defaults to the rect's diagonal.\n */\n createLinePoints?: LinePoints;\n /**\n * `/InkList` strokes to use for the ink create test. PDF user space; must\n * fit inside `createShapeRect`. Defaults to a single short stroke.\n */\n createInkList?: InkList;\n}\n\nexport interface AnnotationMutationConformanceOptions extends Omit<ConformanceOptions, 'fixture'> {\n fixture: AnnotationMutationConformanceFixture;\n /**\n * `true` for engines that expose the raw RGBA appearance rasters\n * (`renderAppearances`). When set, the shape-create test additionally\n * asserts that creating a shape produces a baked `/AP` the appearance\n * reader can rasterize. The cloud engine ships encoded images instead\n * and leaves this `false`.\n */\n supportsAppearanceRasters?: boolean;\n}\n\nconst DEFAULT_QUAD: HighlightDraft['quadPoints'] = [\n {\n p1: { x: 50, y: 100 },\n p2: { x: 150, y: 100 },\n p3: { x: 50, y: 80 },\n p4: { x: 150, y: 80 },\n },\n];\n\nconst DEFAULT_SHAPE_RECT: PdfRect = { left: 60, bottom: 60, right: 160, top: 140 };\n\n/** A small triangle inside DEFAULT_SHAPE_RECT (valid for polygon: >=3). */\nconst DEFAULT_VERTICES: PdfPoint[] = [\n { x: 70, y: 70 },\n { x: 150, y: 70 },\n { x: 110, y: 130 },\n];\n\n/** A line along the diagonal of DEFAULT_SHAPE_RECT. */\nconst DEFAULT_LINE_POINTS: LinePoints = {\n start: { x: 70, y: 70 },\n end: { x: 150, y: 130 },\n};\n\n/**\n * A knee-jointed callout leader inside DEFAULT_SHAPE_RECT: the called-out\n * point, a knee, then the point touching the text box.\n */\nconst DEFAULT_CALLOUT_LINE: [PdfPoint, PdfPoint, PdfPoint] = [\n { x: 65, y: 65 },\n { x: 90, y: 90 },\n { x: 110, y: 100 },\n];\n\n/** A single freehand stroke inside DEFAULT_SHAPE_RECT (valid for ink). */\nconst DEFAULT_INK_STROKES: InkList = [\n [\n { x: 70, y: 70 },\n { x: 100, y: 120 },\n { x: 130, y: 80 },\n { x: 150, y: 130 },\n ],\n];\n\n/**\n * Mutation conformance suite. Mirrors the read suite: tests are written\n * once and run against any engine that satisfies the public API\n * surface. Both local (worker host + WASM) and cloud (HTTP +\n * @cloudpdf/server) implementations must pass identically.\n *\n * The locked rules being verified here:\n * - `create` is append-only: PDFium drops the new annotation at\n * `index = previousCount`, so no existing index shifts. Treated\n * as non-invalidating — revisions do NOT bump and weak refs\n * captured before the create remain valid.\n * - `update` is non-structural; revisions do NOT bump.\n * - Opportunistic /NM stamp upgrades a weak annotation's ref to\n * `kind: 'nm'` on update; an already-durable annotation's /NM is\n * NEVER touched.\n * - `delete` and `move` are the only index-shifting ops. They bump\n * the per-page revision and, on a page that had weak refs before\n * the mutation, surface `shouldRefetch: 'weakRefsInvalidated'`.\n * - Abort propagates as `AbortError` even before the worker\n * responds.\n */\nexport function runAnnotationMutationConformance(\n runner: ConformanceTestRunner,\n opts: AnnotationMutationConformanceOptions,\n): void {\n const { describe, test, beforeAll, afterAll, expect } = runner;\n const fix = opts.fixture;\n const quad = fix.createQuad ?? DEFAULT_QUAD;\n const shapeRect = fix.createShapeRect ?? DEFAULT_SHAPE_RECT;\n const vertices = fix.createVertices ?? DEFAULT_VERTICES;\n const linePoints = fix.createLinePoints ?? DEFAULT_LINE_POINTS;\n const inkStrokes = fix.createInkList ?? DEFAULT_INK_STROKES;\n\n describe(`annotation mutation conformance: ${opts.label}`, () => {\n let engine: Engine;\n\n beforeAll(async () => {\n engine = await opts.makeEngine();\n });\n\n afterAll(async () => {\n if (engine) await engine.destroy();\n });\n\n test('create appends without shifting indices and leaves weak refs valid', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const page = doc.page(fix.pageObjectNumber);\n const before = await page.annotations.list();\n const beforeCount = before.annotations.length;\n\n const draft: HighlightDraft = {\n subtype: 'highlight',\n contents: 'mutation conformance: created',\n color: { r: 200, g: 100, b: 50 },\n opacity: 0.5,\n quadPoints: quad,\n };\n const result = await page.annotations.create(draft);\n expect(AnnotationCreateResultSchema.safeParse(result).success).toBe(true);\n expect(result.meta.affectedPages.length).toBe(1);\n expect(result.meta.affectedPages[0].pageObjectNumber).toBe(fix.pageObjectNumber);\n expect('cacheDelta' in result.meta).toBe(true);\n\n // Always durable (engine uses the EPDFPage_CreateAnnot fork helper).\n expect(result.created.identityQuality).toBe('durable');\n expect(result.created.subtype).toBe('highlight');\n expect(result.created.ref.kind).toBe('objectNumber');\n\n // Locked rule: create is append-only, so the page revision does\n // NOT bump and no weak refs become stale — regardless of whether\n // the page had pre-existing weak annotations.\n expect(result.meta.affectedPages[0].revision.generation).toBe(\n before.pageState.revision.generation,\n );\n expect(result.meta.shouldRefetch).toBe(null);\n expect(result.meta.weakRefsInvalidated).toBe(false);\n expect(result.meta.changed.length).toBe(1);\n\n // The annotation is actually on the page now, at the END of the\n // /Annots array. This is the invariant that justifies the\n // non-invalidating impact: every prior index is preserved.\n const after = await page.annotations.list();\n expect(after.annotations.length).toBe(beforeCount + 1);\n expect(result.created.index).toBe(beforeCount);\n } finally {\n await doc.close();\n }\n });\n\n test('create + update honor annotation flags (set on create, merge on patch)', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const page = doc.page(fix.pageObjectNumber);\n\n // Create with a single flag set; the others must default to false.\n const draft: HighlightDraft = {\n subtype: 'highlight',\n contents: 'mutation conformance: flags',\n color: { r: 10, g: 20, b: 30 },\n opacity: 1,\n quadPoints: quad,\n flags: { print: true },\n };\n const created = await page.annotations.create(draft);\n expect(created.created.flags.print).toBe(true);\n expect(created.created.flags.hidden).toBe(false);\n\n // Patch a different flag: it must merge, leaving `print` intact.\n const hidden = await page.annotations.update(created.created.ref, {\n subtype: 'highlight',\n flags: { hidden: true },\n });\n expect(hidden.updated.flags.hidden).toBe(true);\n expect(hidden.updated.flags.print).toBe(true);\n\n // Clearing one flag leaves the rest untouched.\n const cleared = await page.annotations.update(created.created.ref, {\n subtype: 'highlight',\n flags: { print: false },\n });\n expect(cleared.updated.flags.print).toBe(false);\n expect(cleared.updated.flags.hidden).toBe(true);\n } finally {\n await doc.close();\n }\n });\n\n test('create shape annotations (circle + square) round-trip shape fields', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const page = doc.page(fix.pageObjectNumber);\n\n const circleDraft: CircleDraft = {\n subtype: 'circle',\n contents: 'mutation conformance: circle',\n rect: shapeRect,\n interiorColor: { r: 255, g: 0, b: 0 },\n color: { r: 0, g: 0, b: 255 },\n strokeWidth: 3,\n borderStyle: 'solid',\n opacity: 0.6,\n };\n const circle = await page.annotations.create(circleDraft);\n expect(AnnotationCreateResultSchema.safeParse(circle).success).toBe(true);\n expect(circle.created.subtype).toBe('circle');\n expect(circle.created.identityQuality).toBe('durable');\n expect(circle.created.ref.kind).toBe('objectNumber');\n if (circle.created.subtype === 'circle') {\n expect(circle.created.interiorColor).toMatchObject({ r: 255, g: 0, b: 0 });\n expect(circle.created.color).toMatchObject({ r: 0, g: 0, b: 255 });\n expect(circle.created.strokeWidth).toBe(3);\n expect(circle.created.borderStyle).toBe('solid');\n // /CA stored as f32 — compare at 2dp to absorb float drift.\n expect(Math.round(circle.created.opacity * 100) / 100).toBe(0.6);\n // /Rect round-trips. The chosen bounds are small integers that\n // are exactly representable in f32, so an exact compare is safe.\n expect(circle.created.rect.left).toBe(shapeRect.left);\n expect(circle.created.rect.right).toBe(shapeRect.right);\n expect(circle.created.rect.bottom).toBe(shapeRect.bottom);\n expect(circle.created.rect.top).toBe(shapeRect.top);\n }\n\n const squareDraft: SquareDraft = {\n subtype: 'square',\n contents: 'mutation conformance: square',\n rect: shapeRect,\n interiorColor: null,\n color: { r: 0, g: 128, b: 0 },\n strokeWidth: 2,\n borderStyle: 'dashed',\n dashArray: [3, 2],\n opacity: 1,\n };\n const square = await page.annotations.create(squareDraft);\n expect(AnnotationCreateResultSchema.safeParse(square).success).toBe(true);\n expect(square.created.subtype).toBe('square');\n if (square.created.subtype === 'square') {\n // interiorColor omitted/null => no fill.\n expect(square.created.interiorColor).toBe(null);\n expect(square.created.color).toMatchObject({ r: 0, g: 128, b: 0 });\n expect(square.created.borderStyle).toBe('dashed');\n expect(square.created.dashArray).toEqual([3, 2]);\n }\n\n const after = await page.annotations.list();\n const subtypes = after.annotations.map((a) => a.subtype);\n expect(subtypes.includes('circle')).toBe(true);\n expect(subtypes.includes('square')).toBe(true);\n } finally {\n await doc.close();\n }\n });\n\n test('cloudy border (/BE) + rect differences (/RD) are tri-state', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const page = doc.page(fix.pageObjectNumber);\n\n // A plain shape reads BOTH optional entries as explicit null — absence\n // is stated, so a read DTO compares structurally against a clearing\n // patch. The draft ALSO states them as null (exactly what the plugin's\n // total projection emits for a fresh solid shape): a draft writer must\n // skip null, never dereference it — the stale-worker regression where\n // solid creates vanished while cloudy ones survived.\n const plainDraft: SquareDraft = {\n subtype: 'square',\n contents: 'mutation conformance: cloudy tri-state',\n rect: shapeRect,\n color: { r: 0, g: 128, b: 0 },\n strokeWidth: 2,\n borderStyle: 'solid',\n opacity: 1,\n cloudyIntensity: null,\n rectDifferences: null,\n };\n const plain = await page.annotations.create(plainDraft);\n expect(plain.created.subtype).toBe('square');\n if (plain.created.subtype === 'square') {\n expect(plain.created.cloudyIntensity).toBe(null);\n expect(plain.created.rectDifferences).toBe(null);\n }\n\n // A value sets /BE + /RD…\n const rd = { left: 5, top: 5, right: 5, bottom: 5 };\n const cloudy = await page.annotations.update(plain.created.ref, {\n subtype: 'square',\n cloudyIntensity: 2,\n rectDifferences: rd,\n });\n expect(cloudy.updated.subtype).toBe('square');\n if (cloudy.updated.subtype === 'square') {\n expect(cloudy.updated.cloudyIntensity).toBe(2);\n expect(cloudy.updated.rectDifferences).toMatchObject(rd);\n }\n\n // …and null removes them: the cloudy -> solid transition leaves no\n // stale /RD behind (the Adobe \"phantom padding\" regression).\n const solid = await page.annotations.update(plain.created.ref, {\n subtype: 'square',\n cloudyIntensity: null,\n rectDifferences: null,\n });\n expect(solid.updated.subtype).toBe('square');\n if (solid.updated.subtype === 'square') {\n expect(solid.updated.cloudyIntensity).toBe(null);\n expect(solid.updated.rectDifferences).toBe(null);\n }\n\n // Polygon carries /BE too (but never /RD, per ISO 32000) — same tri-state,\n // including the draft path.\n const polyDraft: PolygonDraft = {\n subtype: 'polygon',\n contents: 'mutation conformance: polygon cloudy tri-state',\n rect: shapeRect,\n vertices,\n color: { r: 0, g: 0, b: 255 },\n strokeWidth: 2,\n borderStyle: 'solid',\n opacity: 1,\n cloudyIntensity: 1,\n };\n const poly = await page.annotations.create(polyDraft);\n expect(poly.created.subtype).toBe('polygon');\n if (poly.created.subtype === 'polygon') {\n expect(poly.created.cloudyIntensity).toBe(1);\n }\n const polySolid = await page.annotations.update(poly.created.ref, {\n subtype: 'polygon',\n cloudyIntensity: null,\n });\n expect(polySolid.updated.subtype).toBe('polygon');\n if (polySolid.updated.subtype === 'polygon') {\n expect(polySolid.updated.cloudyIntensity).toBe(null);\n }\n } finally {\n await doc.close();\n }\n });\n\n test('update echoes the appearance verdict: moves preserve /AP, restyles re-bake', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const page = doc.page(fix.pageObjectNumber);\n const draft: SquareDraft = {\n subtype: 'square',\n contents: 'mutation conformance: appearance echo',\n rect: shapeRect,\n color: { r: 200, g: 0, b: 0 },\n strokeWidth: 2,\n borderStyle: 'solid',\n opacity: 1,\n };\n const created = await page.annotations.create(draft);\n\n // A full-projection patch whose only real change is a same-size /Rect\n // move: the engine value-diffs away the unchanged style keys, verifies\n // the rigid translation, and preserves the baked /AP — the raster\n // invalidation signal stays off.\n const moved = await page.annotations.update(created.created.ref, {\n subtype: 'square',\n rect: {\n left: shapeRect.left + 12,\n bottom: shapeRect.bottom - 8,\n right: shapeRect.right + 12,\n top: shapeRect.top - 8,\n },\n color: { r: 200, g: 0, b: 0 },\n strokeWidth: 2,\n opacity: 1,\n });\n expect(moved.appearance).toEqual({ action: 'preserved', changed: false });\n\n // Metadata-only patches never touch /AP.\n const flagged = await page.annotations.update(created.created.ref, {\n subtype: 'square',\n flags: { print: true },\n });\n expect(flagged.appearance).toEqual({ action: 'preserved', changed: false });\n\n // A real style edit re-bakes and says so.\n const restyled = await page.annotations.update(created.created.ref, {\n subtype: 'square',\n interiorColor: { r: 255, g: 214, b: 0 },\n });\n expect(restyled.appearance).toEqual({ action: 'regenerated', changed: true });\n\n // A resize is not a translation — it re-bakes too.\n const resized = await page.annotations.update(created.created.ref, {\n subtype: 'square',\n rect: {\n left: shapeRect.left,\n bottom: shapeRect.bottom,\n right: shapeRect.right + 40,\n top: shapeRect.top,\n },\n });\n expect(resized.appearance).toEqual({ action: 'regenerated', changed: true });\n } finally {\n await doc.close();\n }\n });\n\n test('a partial /DA patch preserves the unpatched font members', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const page = doc.page(fix.pageObjectNumber);\n const draft: FreeTextDraft = {\n subtype: 'free-text',\n intent: 'free-text',\n contents: 'DA read-modify-write',\n rect: shapeRect,\n fontFamily: 'times-roman',\n fontSize: 14,\n textAlign: 'left',\n color: { r: 200, g: 0, b: 0 },\n };\n const created = await page.annotations.create(draft);\n // `/DA` packs font+size+colour into one string; the writer must\n // read-modify-write, so a partial patch cannot reset the others (the\n // old constant fallbacks turned a size-only patch into 12pt black).\n expect(created.created.subtype).toBe('free-text');\n if (created.created.subtype === 'free-text') {\n expect(created.created.fontFamily).toBe('times-roman');\n }\n const sized = await page.annotations.update(created.created.ref, {\n subtype: 'free-text',\n fontSize: 18,\n });\n expect(sized.updated.subtype).toBe('free-text');\n if (sized.updated.subtype === 'free-text') {\n expect(sized.updated.fontFamily).toBe('times-roman');\n expect(sized.updated.fontSize).toBe(18);\n expect(sized.updated.color).toMatchObject({ r: 200, g: 0, b: 0 });\n }\n const recolored = await page.annotations.update(created.created.ref, {\n subtype: 'free-text',\n color: { r: 0, g: 0, b: 200 },\n });\n if (recolored.updated.subtype === 'free-text') {\n expect(recolored.updated.fontFamily).toBe('times-roman');\n expect(recolored.updated.fontSize).toBe(18);\n expect(recolored.updated.color).toMatchObject({ r: 0, g: 0, b: 200 });\n }\n } finally {\n await doc.close();\n }\n });\n\n test('box transform is tri-state: rect-only moves keep rotation, null flattens', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const page = doc.page(fix.pageObjectNumber);\n const draft: SquareDraft = {\n subtype: 'square',\n contents: 'transform tri-state',\n rect: shapeRect,\n color: { r: 0, g: 0, b: 255 },\n strokeWidth: 2,\n borderStyle: 'solid',\n opacity: 1,\n // A 90° rotation whose AABB equals the box (square) — valid pair.\n rotation: 90,\n unrotatedRect: shapeRect,\n };\n const created = await page.annotations.create(draft);\n expect(created.created.subtype).toBe('square');\n if (created.created.subtype === 'square') {\n expect(created.created.rotation).toBe(90);\n }\n\n // The whole group riding one delta is a verified translation: the\n // rotation survives AND the baked /AP is preserved.\n const d = { x: 15, y: -10 };\n const shift = (r: typeof shapeRect) => ({\n left: r.left + d.x,\n bottom: r.bottom + d.y,\n right: r.right + d.x,\n top: r.top + d.y,\n });\n const trioMoved = await page.annotations.update(created.created.ref, {\n subtype: 'square',\n rect: shift(shapeRect),\n rotation: 90,\n unrotatedRect: shift(shapeRect),\n });\n expect(trioMoved.appearance).toEqual({ action: 'preserved', changed: false });\n if (trioMoved.updated.subtype === 'square') {\n expect(trioMoved.updated.rotation).toBe(90);\n }\n\n // A rect-only move PRESERVES the omitted rotation (tri-state law: a\n // patch touches what it states) — the old writer cleared it.\n const rectOnly = await page.annotations.update(created.created.ref, {\n subtype: 'square',\n rect: shapeRect,\n });\n if (rectOnly.updated.subtype === 'square') {\n expect(rectOnly.updated.rotation).toBe(90);\n }\n\n // Explicit null flattens — the ONLY way to remove the rotation.\n const flattened = await page.annotations.update(created.created.ref, {\n subtype: 'square',\n rotation: null,\n unrotatedRect: null,\n });\n if (flattened.updated.subtype === 'square') {\n expect(flattened.updated.rotation).toBe(undefined);\n expect(flattened.updated.unrotatedRect).toBe(undefined);\n }\n } finally {\n await doc.close();\n }\n });\n\n test('create vertex + line annotations (polygon/polyline/line) round-trip geometry', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const page = doc.page(fix.pageObjectNumber);\n\n const polygonDraft: PolygonDraft = {\n subtype: 'polygon',\n contents: 'mutation conformance: polygon',\n rect: shapeRect,\n vertices,\n interiorColor: { r: 255, g: 200, b: 0 },\n color: { r: 0, g: 0, b: 255 },\n strokeWidth: 2,\n borderStyle: 'solid',\n opacity: 0.8,\n };\n const polygon = await page.annotations.create(polygonDraft);\n expect(AnnotationCreateResultSchema.safeParse(polygon).success).toBe(true);\n expect(polygon.created.subtype).toBe('polygon');\n if (polygon.created.subtype === 'polygon') {\n expect(polygon.created.vertices.length).toBe(vertices.length);\n expect(polygon.created.color).toMatchObject({ r: 0, g: 0, b: 255 });\n expect(polygon.created.interiorColor).toMatchObject({ r: 255, g: 200, b: 0 });\n }\n\n const polylineDraft: PolylineDraft = {\n subtype: 'polyline',\n contents: 'mutation conformance: polyline',\n rect: shapeRect,\n vertices,\n interiorColor: null,\n color: { r: 200, g: 0, b: 0 },\n strokeWidth: 2,\n borderStyle: 'solid',\n opacity: 1,\n lineEndings: { start: 'open-arrow', end: 'closed-arrow' },\n };\n const polyline = await page.annotations.create(polylineDraft);\n expect(AnnotationCreateResultSchema.safeParse(polyline).success).toBe(true);\n expect(polyline.created.subtype).toBe('polyline');\n if (polyline.created.subtype === 'polyline') {\n expect(polyline.created.vertices.length).toBe(vertices.length);\n expect(polyline.created.lineEndings.start).toBe('open-arrow');\n expect(polyline.created.lineEndings.end).toBe('closed-arrow');\n }\n\n const lineDraft: LineDraft = {\n subtype: 'line',\n contents: 'mutation conformance: line',\n rect: shapeRect,\n linePoints,\n interiorColor: null,\n color: { r: 0, g: 128, b: 128 },\n strokeWidth: 2,\n borderStyle: 'solid',\n opacity: 1,\n lineEndings: { start: 'none', end: 'open-arrow' },\n };\n const line = await page.annotations.create(lineDraft);\n expect(AnnotationCreateResultSchema.safeParse(line).success).toBe(true);\n expect(line.created.subtype).toBe('line');\n if (line.created.subtype === 'line') {\n // /L stored as f32 — compare rounded to absorb float drift.\n expect(Math.round(line.created.linePoints.start.x)).toBe(Math.round(linePoints.start.x));\n expect(Math.round(line.created.linePoints.end.y)).toBe(Math.round(linePoints.end.y));\n expect(line.created.lineEndings.end).toBe('open-arrow');\n }\n\n const inkDraft: InkDraft = {\n subtype: 'ink',\n contents: 'mutation conformance: ink',\n rect: shapeRect,\n inkList: inkStrokes,\n color: { r: 29, g: 78, b: 216 },\n strokeWidth: 3,\n borderStyle: 'solid',\n opacity: 1,\n };\n const ink = await page.annotations.create(inkDraft);\n expect(AnnotationCreateResultSchema.safeParse(ink).success).toBe(true);\n expect(ink.created.subtype).toBe('ink');\n if (ink.created.subtype === 'ink') {\n expect(ink.created.inkList.length).toBe(inkStrokes.length);\n expect(ink.created.inkList[0]!.length).toBe(inkStrokes[0]!.length);\n expect(ink.created.color).toMatchObject({ r: 29, g: 78, b: 216 });\n expect(ink.created.intent).toBe(null);\n expect(ink.created.blendMode).toBe('normal');\n // Ink has a stroke but no /IC.\n expect('interiorColor' in ink.created).toBe(false);\n }\n\n const after = await page.annotations.list();\n const subtypes = after.annotations.map((a) => a.subtype);\n expect(subtypes.includes('polygon')).toBe(true);\n expect(subtypes.includes('polyline')).toBe(true);\n expect(subtypes.includes('line')).toBe(true);\n expect(subtypes.includes('ink')).toBe(true);\n } finally {\n await doc.close();\n }\n });\n\n test('create free-text + callout round-trip text/colour/intent fields', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const page = doc.page(fix.pageObjectNumber);\n\n // Plain free text, no fontColor override => text follows `color`.\n const freeTextDraft: FreeTextDraft = {\n subtype: 'free-text',\n intent: 'free-text',\n contents: 'mutation conformance: free text',\n rect: shapeRect,\n fontFamily: 'helvetica',\n fontSize: 14,\n textAlign: 'center',\n color: { r: 20, g: 40, b: 60 },\n interiorColor: { r: 250, g: 250, b: 210 },\n opacity: 1,\n strokeWidth: 1,\n borderStyle: 'solid',\n };\n const freeText = await page.annotations.create(freeTextDraft);\n expect(AnnotationCreateResultSchema.safeParse(freeText).success).toBe(true);\n expect(freeText.created.subtype).toBe('free-text');\n if (freeText.created.subtype === 'free-text') {\n expect(freeText.created.intent).toBe('free-text');\n expect(freeText.created.fontFamily).toBe('helvetica');\n expect(freeText.created.fontSize).toBe(14);\n expect(freeText.created.textAlign).toBe('center');\n expect(freeText.created.color).toMatchObject({ r: 20, g: 40, b: 60 });\n expect(freeText.created.interiorColor).toMatchObject({ r: 250, g: 250, b: 210 });\n // No override sent => text follows `color`, so fontColor is omitted.\n expect(freeText.created.fontColor === undefined).toBe(true);\n }\n\n // Callout: intent + /CL leader + /LE ending, explicit fontColor\n // override, transparent (null) background.\n const calloutDraft: FreeTextDraft = {\n subtype: 'free-text',\n intent: 'free-text-callout',\n contents: 'mutation conformance: callout',\n rect: shapeRect,\n fontFamily: 'times-roman',\n fontSize: 12,\n textAlign: 'left',\n color: { r: 0, g: 0, b: 0 },\n fontColor: { r: 200, g: 0, b: 0 },\n interiorColor: null,\n opacity: 1,\n strokeWidth: 1,\n borderStyle: 'solid',\n calloutLine: DEFAULT_CALLOUT_LINE,\n lineEnding: 'open-arrow',\n };\n const callout = await page.annotations.create(calloutDraft);\n expect(AnnotationCreateResultSchema.safeParse(callout).success).toBe(true);\n expect(callout.created.subtype).toBe('free-text');\n if (callout.created.subtype === 'free-text') {\n expect(callout.created.intent).toBe('free-text-callout');\n expect(callout.created.interiorColor).toBe(null);\n // fontColor differs from color => surfaced as an override.\n expect(callout.created.fontColor).toMatchObject({ r: 200, g: 0, b: 0 });\n expect(callout.created.color).toMatchObject({ r: 0, g: 0, b: 0 });\n expect(callout.created.calloutLine?.length).toBe(DEFAULT_CALLOUT_LINE.length);\n expect(callout.created.lineEnding).toBe('open-arrow');\n }\n\n const after = await page.annotations.list();\n const freeTexts = after.annotations.filter((a) => a.subtype === 'free-text');\n expect(freeTexts.length >= 2).toBe(true);\n } finally {\n await doc.close();\n }\n });\n\n test('update a free-text patches alignment + colours and is non-structural', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const page = doc.page(fix.pageObjectNumber);\n const created = await page.annotations.create({\n subtype: 'free-text',\n intent: 'free-text',\n contents: 'free-text-update-base',\n rect: shapeRect,\n fontFamily: 'helvetica',\n fontSize: 12,\n textAlign: 'left',\n color: { r: 0, g: 0, b: 0 },\n interiorColor: null,\n opacity: 1,\n strokeWidth: 1,\n borderStyle: 'solid',\n } satisfies FreeTextDraft);\n const before = await page.annotations.list();\n\n const result = await page.annotations.update(created.created.ref, {\n subtype: 'free-text',\n textAlign: 'right',\n fontFamily: 'helvetica',\n fontSize: 18,\n color: { r: 0, g: 80, b: 160 },\n interiorColor: { r: 240, g: 240, b: 240 },\n });\n expect(AnnotationUpdateResultSchema.safeParse(result).success).toBe(true);\n expect(result.updated.subtype).toBe('free-text');\n if (result.updated.subtype === 'free-text') {\n expect(result.updated.textAlign).toBe('right');\n expect(result.updated.fontSize).toBe(18);\n expect(result.updated.color).toMatchObject({ r: 0, g: 80, b: 160 });\n expect(result.updated.interiorColor).toMatchObject({ r: 240, g: 240, b: 240 });\n }\n // Update never bumps the revision.\n expect(result.meta.affectedPages[0].revision.generation).toBe(\n before.pageState.revision.generation,\n );\n expect(result.meta.weakRefsInvalidated).toBe(false);\n } finally {\n await doc.close();\n }\n });\n\n // ── rich text (/RC + /DS): the same document model on every engine ──\n // `richText` is a body (family/weight/italic/size/colour/decoration/\n // align/dir) plus paragraphs of runs whose `style` overrides it. Every\n // FreeText reads it back; a draft or patch may write it. The rules under\n // test are the engine's patch table, so the cloud (HTTP -> server ->\n // native runtime) and the local WASM engine must agree row for row.\n\n test('rich text: a plain draft reads back body-style paragraphs and a body from its font', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const page = doc.page(fix.pageObjectNumber);\n const created = await page.annotations.create({\n subtype: 'free-text',\n intent: 'free-text',\n contents: 'Plain\\rtext',\n rect: shapeRect,\n fontFamily: 'helvetica-bold',\n fontSize: 18,\n textAlign: 'center',\n color: { r: 0, g: 0, b: 0 },\n } satisfies FreeTextDraft);\n expect(created.created.subtype).toBe('free-text');\n if (created.created.subtype === 'free-text') {\n const rich = created.created.richText;\n expect(created.created.fontFamily).toBe('helvetica-bold');\n expect(rich.body.family).toBe('Helvetica');\n expect(rich.body.weight).toBe(700);\n expect(rich.body.italic).toBe(false);\n expect(rich.body.size).toBe(18);\n expect(rich.body.align).toBe('center');\n // One paragraph per line break, one unstyled run each; a paragraph\n // names alignment only where it differs from the body.\n expect(rich.paragraphs).toEqual([\n { runs: [{ text: 'Plain' }] },\n { runs: [{ text: 'text' }] },\n ]);\n }\n } finally {\n await doc.close();\n }\n });\n\n test('rich text: a draft with runs round-trips the body, the runs and the plain projection', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const page = doc.page(fix.pageObjectNumber);\n const created = await page.annotations.create({\n subtype: 'free-text',\n intent: 'free-text',\n rect: shapeRect,\n fontFamily: 'helvetica',\n fontSize: 12,\n textAlign: 'left',\n color: { r: 0, g: 0, b: 255 },\n richText: {\n body: { family: 'Helvetica', size: 18, color: '#102030' },\n paragraphs: [\n {\n runs: [\n { text: 'Hello ' },\n { text: 'bold', style: { weight: 700 } },\n { text: ' red', style: { color: '#FF0000' } },\n ],\n },\n { align: 'center', runs: [{ text: 'H' }, { text: '2', style: { script: 'sub' } }] },\n ],\n },\n } satisfies FreeTextDraft);\n expect(AnnotationCreateResultSchema.safeParse(created).success).toBe(true);\n expect(created.created.subtype).toBe('free-text');\n if (created.created.subtype === 'free-text') {\n const dto = created.created;\n // `contents` is the projection: paragraphs joined by \\r, runs concatenated.\n expect(dto.contents).toBe('Hello bold red\\rH2');\n // The body became the /DA font and size; the /DA colour stayed the draft's.\n expect(dto.fontFamily).toBe('helvetica');\n expect(dto.fontSize).toBe(18);\n expect(dto.color).toMatchObject({ r: 0, g: 0, b: 255 });\n expect(dto.richText.body.color).toBe('#102030');\n expect(dto.richText.paragraphs[0]!.runs).toEqual([\n { text: 'Hello ' },\n { text: 'bold', style: { weight: 700 } },\n { text: ' red', style: { color: '#FF0000' } },\n ]);\n expect(dto.richText.paragraphs[1]!.align).toBe('center');\n expect(dto.richText.paragraphs[1]!.runs[1]).toEqual({\n text: '2',\n style: { script: 'sub' },\n });\n }\n // The list read agrees with the create echo.\n const listed = (await page.annotations.list()).annotations.find(\n (a) => a.index === created.created.index,\n );\n expect(listed?.subtype).toBe('free-text');\n if (listed?.subtype === 'free-text') {\n expect(listed.richText.paragraphs[0]!.runs[1]).toEqual({\n text: 'bold',\n style: { weight: 700 },\n });\n }\n } finally {\n await doc.close();\n }\n });\n\n test('rich text: paragraphs-only patch keeps the body; contents-only rewrites body-style paragraphs', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const page = doc.page(fix.pageObjectNumber);\n const created = await page.annotations.create({\n subtype: 'free-text',\n intent: 'free-text',\n rect: shapeRect,\n fontFamily: 'helvetica',\n fontSize: 14,\n textAlign: 'center',\n color: { r: 0, g: 0, b: 0 },\n richText: {\n body: { family: 'Helvetica', size: 14 },\n paragraphs: [{ runs: [{ text: 'a' }, { text: 'b', style: { weight: 700 } }] }],\n },\n } satisfies FreeTextDraft);\n const ref = created.created.ref;\n // The editor's commit: paragraphs only, no body — the body (and its\n // alignment) stays what the annotation had.\n const restyled = await page.annotations.update(ref, {\n subtype: 'free-text',\n richText: {\n paragraphs: [{ runs: [{ text: 'ab', style: { italic: true } }, { text: 'c' }] }],\n },\n });\n expect(AnnotationUpdateResultSchema.safeParse(restyled).success).toBe(true);\n expect(restyled.updated.subtype).toBe('free-text');\n if (restyled.updated.subtype === 'free-text') {\n expect(restyled.updated.contents).toBe('abc');\n expect(restyled.updated.richText.body.size).toBe(14);\n expect(restyled.updated.richText.body.align).toBe('center');\n expect(restyled.updated.textAlign).toBe('center');\n expect(restyled.updated.richText.paragraphs[0]!.runs[0]).toEqual({\n text: 'ab',\n style: { italic: true },\n });\n }\n // A plain-text client's rewrite: body-style paragraphs, one per line\n // break — run formatting is gone by design.\n const rewritten = await page.annotations.update(ref, {\n subtype: 'free-text',\n contents: 'one\\rtwo',\n });\n expect(rewritten.updated.subtype).toBe('free-text');\n if (rewritten.updated.subtype === 'free-text') {\n expect(rewritten.updated.contents).toBe('one\\rtwo');\n expect(rewritten.updated.richText.paragraphs).toEqual([\n { runs: [{ text: 'one' }] },\n { runs: [{ text: 'two' }] },\n ]);\n expect(rewritten.updated.richText.body.size).toBe(14);\n }\n expect(rewritten.meta.weakRefsInvalidated).toBe(false);\n } finally {\n await doc.close();\n }\n });\n\n test('rich text: fontSize / fontColor / fontFamily move the body while runs keep their deltas', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const page = doc.page(fix.pageObjectNumber);\n const created = await page.annotations.create({\n subtype: 'free-text',\n intent: 'free-text',\n rect: shapeRect,\n fontFamily: 'helvetica',\n fontSize: 14,\n textAlign: 'left',\n color: { r: 0, g: 0, b: 0 },\n richText: {\n body: { family: 'Helvetica', size: 14 },\n paragraphs: [{ runs: [{ text: 'a' }, { text: 'b', style: { size: 30 } }] }],\n },\n } satisfies FreeTextDraft);\n const updated = await page.annotations.update(created.created.ref, {\n subtype: 'free-text',\n fontSize: 20,\n fontColor: { r: 255, g: 0, b: 0 },\n fontFamily: 'times-bold',\n });\n expect(updated.updated.subtype).toBe('free-text');\n if (updated.updated.subtype === 'free-text') {\n const dto = updated.updated;\n expect(dto.fontSize).toBe(20);\n expect(dto.fontFamily).toBe('times-bold');\n expect(dto.richText.body.size).toBe(20);\n expect(dto.richText.body.color).toBe('#FF0000');\n expect(dto.richText.body.family).toBe('Times');\n expect(dto.richText.body.weight).toBe(700);\n // The run's own size is a delta over the body: it survives the move.\n expect(dto.richText.paragraphs[0]!.runs[1]).toEqual({ text: 'b', style: { size: 30 } });\n }\n } finally {\n await doc.close();\n }\n });\n\n test('rich text: contents and richText that disagree reject with InvalidArg; agreeing writes the runs', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const page = doc.page(fix.pageObjectNumber);\n const created = await page.annotations.create({\n subtype: 'free-text',\n intent: 'free-text',\n contents: 'x',\n rect: shapeRect,\n fontFamily: 'helvetica',\n fontSize: 14,\n textAlign: 'left',\n color: { r: 0, g: 0, b: 0 },\n } satisfies FreeTextDraft);\n const ref = created.created.ref;\n let caught: unknown;\n try {\n await page.annotations.update(ref, {\n subtype: 'free-text',\n contents: 'stale',\n richText: { paragraphs: [{ runs: [{ text: 'fresh' }] }] },\n });\n } catch (err) {\n caught = err;\n }\n expect(EngineError.is(caught, EngineErrorCode.InvalidArg)).toBe(true);\n // The refused write left the annotation untouched.\n const after = (await page.annotations.list()).annotations.find(\n (a) => a.index === created.created.index,\n );\n expect(after?.contents).toBe('x');\n const agreed = await page.annotations.update(ref, {\n subtype: 'free-text',\n contents: 'fresh',\n richText: {\n paragraphs: [{ runs: [{ text: 'fr' }, { text: 'esh', style: { weight: 700 } }] }],\n },\n });\n expect(agreed.updated.subtype).toBe('free-text');\n if (agreed.updated.subtype === 'free-text') {\n expect(agreed.updated.contents).toBe('fresh');\n expect(agreed.updated.richText.paragraphs[0]!.runs[1]).toEqual({\n text: 'esh',\n style: { weight: 700 },\n });\n }\n } finally {\n await doc.close();\n }\n });\n\n test('create redact (area + text) round-trips label + colour fields', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const page = doc.page(fix.pageObjectNumber);\n\n // Area redaction (no quads: /Rect is the removal region) with a\n // fully-styled label.\n const areaDraft: RedactDraft = {\n subtype: 'redact',\n contents: 'mutation conformance: area redact',\n rect: shapeRect,\n color: { r: 228, g: 66, b: 52 },\n opacity: 1,\n interiorColor: { r: 0, g: 0, b: 0 },\n overlayText: 'CONFIDENTIAL',\n repeat: true,\n fontFamily: 'helvetica',\n fontSize: 10,\n fontColor: { r: 255, g: 255, b: 255 },\n textAlign: 'center',\n };\n const area = await page.annotations.create(areaDraft);\n expect(AnnotationCreateResultSchema.safeParse(area).success).toBe(true);\n expect(area.created.subtype).toBe('redact');\n if (area.created.subtype === 'redact') {\n expect(area.created.quadPoints.length).toBe(0);\n expect(area.created.color).toMatchObject({ r: 228, g: 66, b: 52 });\n expect(area.created.interiorColor).toMatchObject({ r: 0, g: 0, b: 0 });\n expect(area.created.overlayText).toBe('CONFIDENTIAL');\n expect(area.created.repeat).toBe(true);\n expect(area.created.fontFamily).toBe('helvetica');\n expect(area.created.fontSize).toBe(10);\n expect(area.created.fontColor).toMatchObject({ r: 255, g: 255, b: 255 });\n expect(area.created.textAlign).toBe('center');\n }\n\n // Text redaction (quads) without a label: everything falls back to\n // the ISO defaults — transparent fill, no overlay text, no repeat.\n const textDraft: RedactDraft = {\n subtype: 'redact',\n contents: 'mutation conformance: text redact',\n rect: shapeRect,\n quadPoints: quad,\n };\n const text = await page.annotations.create(textDraft);\n expect(AnnotationCreateResultSchema.safeParse(text).success).toBe(true);\n expect(text.created.subtype).toBe('redact');\n if (text.created.subtype === 'redact') {\n expect(text.created.quadPoints.length).toBe(quad.length);\n expect(text.created.interiorColor).toBe(null);\n expect(text.created.overlayText).toBe(null);\n expect(text.created.repeat).toBe(false);\n // Default marking outline is the red redaction convention.\n expect(text.created.color).toMatchObject({ r: 255, g: 0, b: 0 });\n }\n } finally {\n await doc.close();\n }\n });\n\n test('update a redact patches the label and clears it, non-structurally', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const page = doc.page(fix.pageObjectNumber);\n const created = await page.annotations.create({\n subtype: 'redact',\n contents: 'redact-update-base',\n rect: shapeRect,\n interiorColor: { r: 0, g: 0, b: 0 },\n overlayText: 'DRAFT',\n fontFamily: 'helvetica',\n fontSize: 8,\n fontColor: { r: 255, g: 255, b: 255 },\n } satisfies RedactDraft);\n const before = await page.annotations.list();\n\n // Restyle the label. fontSize 0 is meaningful for a redaction label\n // (auto-fit) and must round-trip verbatim, unlike free text.\n const restyled = await page.annotations.update(created.created.ref, {\n subtype: 'redact',\n overlayText: 'REDACTED',\n repeat: true,\n fontFamily: 'helvetica',\n fontSize: 0,\n fontColor: { r: 255, g: 240, b: 240 },\n textAlign: 'right',\n interiorColor: { r: 10, g: 10, b: 10 },\n });\n expect(AnnotationUpdateResultSchema.safeParse(restyled).success).toBe(true);\n expect(restyled.updated.subtype).toBe('redact');\n if (restyled.updated.subtype === 'redact') {\n expect(restyled.updated.overlayText).toBe('REDACTED');\n expect(restyled.updated.repeat).toBe(true);\n expect(restyled.updated.fontSize).toBe(0);\n expect(restyled.updated.fontColor).toMatchObject({ r: 255, g: 240, b: 240 });\n expect(restyled.updated.textAlign).toBe('right');\n expect(restyled.updated.interiorColor).toMatchObject({ r: 10, g: 10, b: 10 });\n }\n\n // Clear the label and the fill: null wipes /OverlayText and /IC.\n const cleared = await page.annotations.update(created.created.ref, {\n subtype: 'redact',\n overlayText: null,\n repeat: false,\n interiorColor: null,\n });\n expect(cleared.updated.subtype).toBe('redact');\n if (cleared.updated.subtype === 'redact') {\n expect(cleared.updated.overlayText).toBe(null);\n expect(cleared.updated.repeat).toBe(false);\n expect(cleared.updated.interiorColor).toBe(null);\n }\n\n // Updates never bump the revision.\n expect(cleared.meta.affectedPages[0].revision.generation).toBe(\n before.pageState.revision.generation,\n );\n expect(cleared.meta.weakRefsInvalidated).toBe(false);\n } finally {\n await doc.close();\n }\n });\n\n test('create + update a caret round-trips color/opacity/rect differences', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const page = doc.page(fix.pageObjectNumber);\n\n const caretDraft: CaretDraft = {\n subtype: 'caret',\n intent: 'replace',\n contents: 'mutation conformance: caret',\n rect: shapeRect,\n color: { r: 0, g: 128, b: 255 },\n opacity: 0.7,\n rectDifferences: { left: 2, top: 2, right: 2, bottom: 2 },\n };\n const caret = await page.annotations.create(caretDraft);\n expect(AnnotationCreateResultSchema.safeParse(caret).success).toBe(true);\n expect(caret.created.subtype).toBe('caret');\n expect(caret.created.identityQuality).toBe('durable');\n expect(caret.created.ref.kind).toBe('objectNumber');\n if (caret.created.subtype === 'caret') {\n expect(caret.created.intent).toBe('replace');\n expect(caret.created.color).toMatchObject({ r: 0, g: 128, b: 255 });\n expect(Math.round(caret.created.opacity * 100) / 100).toBe(0.7);\n // Caret carries no border or quads.\n expect('strokeWidth' in caret.created).toBe(false);\n expect('quadPoints' in caret.created).toBe(false);\n expect(caret.created.rectDifferences).toMatchObject({\n left: 2,\n top: 2,\n right: 2,\n bottom: 2,\n });\n }\n\n const before = await page.annotations.list();\n const result = await page.annotations.update(caret.created.ref, {\n subtype: 'caret',\n color: { r: 255, g: 0, b: 0 },\n rectDifferences: { left: 4, top: 4, right: 4, bottom: 4 },\n });\n expect(AnnotationUpdateResultSchema.safeParse(result).success).toBe(true);\n expect(result.updated.subtype).toBe('caret');\n if (result.updated.subtype === 'caret') {\n expect(result.updated.color).toMatchObject({ r: 255, g: 0, b: 0 });\n }\n // Update never bumps the revision.\n expect(result.meta.affectedPages[0].revision.generation).toBe(\n before.pageState.revision.generation,\n );\n expect(result.meta.weakRefsInvalidated).toBe(false);\n\n // Tri-state: `null` removes /RD entirely (a read then states the absence).\n const rdCleared = await page.annotations.update(caret.created.ref, {\n subtype: 'caret',\n rectDifferences: null,\n });\n expect(rdCleared.updated.subtype).toBe('caret');\n if (rdCleared.updated.subtype === 'caret') {\n expect(rdCleared.updated.rectDifferences).toBe(null);\n }\n\n const after = await page.annotations.list();\n expect(after.annotations.some((a) => a.subtype === 'caret')).toBe(true);\n } finally {\n await doc.close();\n }\n });\n\n test('update an ink annotation patches strokes + color and is non-structural', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const page = doc.page(fix.pageObjectNumber);\n const created = await page.annotations.create({\n subtype: 'ink',\n contents: 'ink-update-base',\n rect: shapeRect,\n inkList: inkStrokes,\n color: { r: 0, g: 0, b: 0 },\n strokeWidth: 2,\n borderStyle: 'solid',\n opacity: 1,\n } satisfies InkDraft);\n const before = await page.annotations.list();\n\n const newStrokes: InkList = [\n ...inkStrokes,\n [\n { x: 80, y: 90 },\n { x: 120, y: 110 },\n ],\n ];\n const result = await page.annotations.update(created.created.ref, {\n subtype: 'ink',\n inkList: newStrokes,\n color: { r: 220, g: 20, b: 60 },\n });\n expect(AnnotationUpdateResultSchema.safeParse(result).success).toBe(true);\n expect(result.updated.subtype).toBe('ink');\n if (result.updated.subtype === 'ink') {\n expect(result.updated.inkList.length).toBe(newStrokes.length);\n expect(result.updated.color).toMatchObject({ r: 220, g: 20, b: 60 });\n }\n // Update never bumps the revision.\n expect(result.meta.affectedPages[0].revision.generation).toBe(\n before.pageState.revision.generation,\n );\n expect(result.meta.weakRefsInvalidated).toBe(false);\n } finally {\n await doc.close();\n }\n });\n\n test('ink highlight intent + blend round-trip and unrelated patches preserve blend', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const page = doc.page(fix.pageObjectNumber);\n const created = await page.annotations.create({\n subtype: 'ink',\n intent: 'ink-highlight',\n blendMode: 'multiply',\n rect: shapeRect,\n inkList: inkStrokes,\n color: { r: 255, g: 205, b: 69 },\n strokeWidth: 14,\n borderStyle: 'solid',\n opacity: 1,\n } satisfies InkDraft);\n expect(created.created.subtype).toBe('ink');\n if (created.created.subtype !== 'ink') return;\n expect(created.created.intent).toBe('ink-highlight');\n expect(created.created.blendMode).toBe('multiply');\n\n const recolored = await page.annotations.update(created.created.ref, {\n subtype: 'ink',\n color: { r: 250, g: 190, b: 40 },\n });\n expect(recolored.updated.subtype).toBe('ink');\n expect(recolored.updated.blendMode).toBe('multiply');\n\n const screened = await page.annotations.update(created.created.ref, {\n subtype: 'ink',\n blendMode: 'screen',\n });\n expect(screened.updated.subtype).toBe('ink');\n expect(screened.updated.blendMode).toBe('screen');\n } finally {\n await doc.close();\n }\n });\n\n test('update a polyline patches vertices + line endings and is non-structural', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const page = doc.page(fix.pageObjectNumber);\n const created = await page.annotations.create({\n subtype: 'polyline',\n contents: 'polyline-update-base',\n rect: shapeRect,\n vertices,\n interiorColor: null,\n color: { r: 0, g: 0, b: 0 },\n strokeWidth: 1,\n borderStyle: 'solid',\n opacity: 1,\n lineEndings: { start: 'none', end: 'none' },\n } satisfies PolylineDraft);\n const before = await page.annotations.list();\n\n const newVertices: PdfPoint[] = [\n ...vertices,\n { x: vertices[0]!.x + 5, y: vertices[0]!.y + 5 },\n ];\n const result = await page.annotations.update(created.created.ref, {\n subtype: 'polyline',\n vertices: newVertices,\n lineEndings: { start: 'circle', end: 'diamond' },\n });\n expect(AnnotationUpdateResultSchema.safeParse(result).success).toBe(true);\n expect(result.updated.subtype).toBe('polyline');\n if (result.updated.subtype === 'polyline') {\n expect(result.updated.vertices.length).toBe(newVertices.length);\n expect(result.updated.lineEndings.start).toBe('circle');\n expect(result.updated.lineEndings.end).toBe('diamond');\n }\n // Update never bumps the revision.\n expect(result.meta.affectedPages[0].revision.generation).toBe(\n before.pageState.revision.generation,\n );\n expect(result.meta.weakRefsInvalidated).toBe(false);\n } finally {\n await doc.close();\n }\n });\n\n test('update a shape annotation patches color and is non-structural', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const page = doc.page(fix.pageObjectNumber);\n const created = await page.annotations.create({\n subtype: 'circle',\n contents: 'shape-update-base',\n rect: shapeRect,\n interiorColor: { r: 10, g: 20, b: 30 },\n color: { r: 0, g: 0, b: 0 },\n strokeWidth: 1,\n borderStyle: 'solid',\n opacity: 1,\n } satisfies CircleDraft);\n const before = await page.annotations.list();\n\n const result = await page.annotations.update(created.created.ref, {\n subtype: 'circle',\n interiorColor: { r: 200, g: 100, b: 50 },\n strokeWidth: 4,\n });\n expect(AnnotationUpdateResultSchema.safeParse(result).success).toBe(true);\n expect(result.updated.subtype).toBe('circle');\n if (result.updated.subtype === 'circle') {\n expect(result.updated.interiorColor).toMatchObject({ r: 200, g: 100, b: 50 });\n expect(result.updated.strokeWidth).toBe(4);\n // Unpatched fields are preserved.\n expect(result.updated.borderStyle).toBe('solid');\n }\n // Update never bumps the revision.\n expect(result.meta.affectedPages[0].revision.generation).toBe(\n before.pageState.revision.generation,\n );\n expect(result.meta.weakRefsInvalidated).toBe(false);\n } finally {\n await doc.close();\n }\n });\n\n if (opts.supportsAppearanceRasters) {\n test('creating a shape bakes an /AP appearance the reader can rasterize', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const page = doc.page(fix.pageObjectNumber);\n const created = await page.annotations.create({\n subtype: 'circle',\n contents: 'appearance-gen',\n rect: shapeRect,\n interiorColor: { r: 255, g: 0, b: 0 },\n color: { r: 0, g: 0, b: 0 },\n strokeWidth: 2,\n borderStyle: 'solid',\n opacity: 1,\n } satisfies CircleDraft);\n\n const appearances = await page.annotations.renderAppearances({ scale: 1 });\n const match = appearances.appearances.find(\n (a) =>\n a.ref.kind === 'objectNumber' &&\n created.created.ref.kind === 'objectNumber' &&\n a.ref.annotObjectNumber === created.created.ref.annotObjectNumber,\n );\n // The freshly created shape must carry a baked /AP (generated by\n // the mutator), so the appearance reader emits a non-empty raster.\n expect(match !== undefined).toBe(true);\n expect((match?.raster.width ?? 0) > 0).toBeTruthy();\n expect((match?.raster.height ?? 0) > 0).toBeTruthy();\n } finally {\n await doc.close();\n }\n });\n }\n\n test('update on a durable annotation is non-structural and never touches /NM', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const page = doc.page(fix.pageObjectNumber);\n const before = await page.annotations.list();\n\n const target = before.annotations.find((a) => a.identityQuality === 'durable');\n // Skip the assertion gracefully if the fixture has no durable annot\n // up front; the test fixture used in our suites does (the existing\n // highlights have /NM).\n if (!target) return;\n\n const ref: AnnotationRef = target.ref;\n const newContents = `mutation conformance: updated@${Date.now()}`;\n const patch = subtypeAwarePatch(target.subtype, newContents);\n if (!patch) return;\n\n const result = await page.annotations.update(ref, patch);\n expect(AnnotationUpdateResultSchema.safeParse(result).success).toBe(true);\n expect(result.meta.affectedPages.length).toBe(1);\n expect(result.meta.affectedPages[0].pageObjectNumber).toBe(fix.pageObjectNumber);\n expect('cacheDelta' in result.meta).toBe(true);\n\n // Same identity, /NM untouched.\n expect(result.updated.ref.kind).toBe(target.ref.kind);\n expect(result.updated.nm).toBe(target.nm);\n\n // Update never bumps the revision.\n expect(result.meta.affectedPages[0].revision.generation).toBe(\n before.pageState.revision.generation,\n );\n expect(result.meta.shouldRefetch).toBe(null);\n expect(result.meta.weakRefsInvalidated).toBe(false);\n\n // Round-trip the new contents.\n expect(result.updated.contents).toBe(newContents);\n } finally {\n await doc.close();\n }\n });\n\n if (fix.expectsWeakAnnotation) {\n test('update on a weak annotation stamps a UUID v4 /NM and upgrades the ref', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const page = doc.page(fix.pageObjectNumber);\n const before = await page.annotations.list();\n\n const weak = before.annotations.find((a) => a.identityQuality === 'weak');\n expect(weak !== undefined).toBe(true);\n if (!weak) return;\n expect(weak.ref.kind).toBe('index');\n\n const newContents = `weak-upgrade@${Date.now()}`;\n const patch = subtypeAwarePatch(weak.subtype, newContents);\n if (!patch) return;\n\n const result = await page.annotations.update(weak.ref, patch);\n expect(AnnotationUpdateResultSchema.safeParse(result).success).toBe(true);\n expect(result.meta.affectedPages.length).toBe(1);\n expect(result.meta.affectedPages[0].pageObjectNumber).toBe(fix.pageObjectNumber);\n expect('cacheDelta' in result.meta).toBe(true);\n\n // The ref is upgraded to durable. Either nm (engine-stamped) or\n // objectNumber (if the annotation surprisingly had one) is fine.\n expect(\n result.updated.ref.kind === 'nm' || result.updated.ref.kind === 'objectNumber',\n ).toBe(true);\n expect(result.updated.identityQuality).toBe('durable');\n if (result.updated.ref.kind === 'nm') {\n expect(result.updated.nm !== null).toBe(true);\n expect(typeof result.updated.nm).toBe('string');\n // Engine stamps RFC 4122 v4 UUIDs: 8-4-4-4-12 hex with\n // version 4 and variant 10xx. Match loosely.\n expect(\n /^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/.test(\n result.updated.nm!,\n ),\n ).toBe(true);\n }\n\n // Still non-structural.\n expect(result.meta.affectedPages[0].revision.generation).toBe(\n before.pageState.revision.generation,\n );\n expect(result.meta.shouldRefetch).toBe(null);\n } finally {\n await doc.close();\n }\n });\n }\n\n test('delete by objectNumber removes the annotation and reports a stable id', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const page = doc.page(fix.pageObjectNumber);\n // Create one we own so we don't disturb the fixture's other tests.\n const draft: HighlightDraft = {\n subtype: 'highlight',\n contents: 'mutation conformance: to-delete',\n quadPoints: quad,\n };\n const created = await page.annotations.create(draft);\n const before = await page.annotations.list();\n\n const weakSession = await beginWeakEditIfRequired(doc, fix.pageObjectNumber, fix);\n const result = await page.annotations.delete(created.created.ref);\n try {\n expect(AnnotationDeleteResultSchema.safeParse(result).success).toBe(true);\n expect(result.meta.affectedPages.length).toBe(1);\n expect(result.meta.affectedPages[0].pageObjectNumber).toBe(fix.pageObjectNumber);\n expect('cacheDelta' in result.meta).toBe(true);\n\n // Stable id is reported (we created it; it's durable).\n expect(result.deleted !== null).toBe(true);\n expect(result.deleted?.kind).toBe('objectNumber');\n\n // Structural: revision bumped.\n expect(result.meta.affectedPages[0].revision.generation).toBe(\n before.pageState.revision.generation + 1,\n );\n\n // The annotation is gone.\n const after = await page.annotations.list();\n expect(after.annotations.length).toBe(before.annotations.length - 1);\n } finally {\n await weakSession?.release();\n }\n } finally {\n await doc.close();\n }\n });\n\n if (fix.expectsWeakAnnotation) {\n test('delete by index of a weak annotation reports deleted: null and refetch reason', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const page = doc.page(fix.pageObjectNumber);\n const before = await page.annotations.list();\n const weak = before.annotations.find((a) => a.identityQuality === 'weak');\n if (!weak) return;\n expect(weak.ref.kind).toBe('index');\n\n const weakSession = await beginWeakEditIfRequired(doc, fix.pageObjectNumber, fix);\n const result = await page.annotations.delete(weak.ref);\n try {\n // The weak annotation MAY have had /NM in some shapes (very\n // legacy PDFs), but the locked semantics say a true weak\n // delete returns null. We assert \"either null or a stable id\"\n // since the fixture controls which side this lands on.\n expect(\n result.deleted === null ||\n result.deleted.kind === 'objectNumber' ||\n result.deleted.kind === 'nm',\n ).toBe(true);\n expect(result.meta.affectedPages.length).toBe(1);\n expect(result.meta.affectedPages[0].pageObjectNumber).toBe(fix.pageObjectNumber);\n expect('cacheDelta' in result.meta).toBe(true);\n\n // The page had weak refs before, structural mutation,\n // therefore: shouldRefetch is set.\n expect(result.meta.shouldRefetch?.reason).toBe('weakRefsInvalidated');\n expect(result.meta.weakRefsInvalidated).toBe(true);\n } finally {\n await weakSession?.release();\n }\n } finally {\n await doc.close();\n }\n });\n }\n\n test('abort on create rejects with AbortError', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const page = doc.page(fix.pageObjectNumber);\n const draft: HighlightDraft = {\n subtype: 'highlight',\n contents: 'will be aborted',\n quadPoints: quad,\n };\n const p = page.annotations.create(draft);\n p.abort('test');\n await expect(p).rejects.toBeInstanceOf(AbortError);\n } finally {\n await doc.close();\n }\n });\n\n test('update with a stale index revision throws InvalidReference', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const page = doc.page(fix.pageObjectNumber);\n const before = await page.annotations.list();\n const weak = before.annotations.find((a) => a.identityQuality === 'weak');\n if (!weak || weak.ref.kind !== 'index') return;\n\n // Force the revision out of date by minting an *index-shifting*\n // mutation, then trying to update against the stale ref. We\n // deliberately use a throwaway create+delete pair (delete is\n // the rev-bumping op now — create is append-only and does NOT\n // bump revisions, so it can't be used here).\n const throwaway = await page.annotations.create({\n subtype: 'highlight',\n contents: 'rev-bump-throwaway',\n quadPoints: quad,\n });\n const weakSession = await beginWeakEditIfRequired(doc, fix.pageObjectNumber, fix);\n await page.annotations.delete(throwaway.created.ref);\n await weakSession?.release();\n\n const patch = subtypeAwarePatch(weak.subtype, 'should-fail');\n if (!patch) return;\n let caught: unknown;\n try {\n await page.annotations.update(weak.ref, patch);\n } catch (err) {\n caught = err;\n }\n expect(EngineError.is(caught, EngineErrorCode.InvalidReference)).toBe(true);\n } finally {\n await doc.close();\n }\n });\n\n // ─────────────────────────────────────────────────────────────────\n // move() — batch contiguous-block reorder. Locked invariants:\n // - `move([ref], toIndex)` is the single-annotation case; same\n // primitive as multi-move.\n // - One revision bump per batch, regardless of `refs.length`.\n // - Caller-supplied order is preserved at the destination.\n // - Weak refs in the batch are upgraded to durable /NM BEFORE the\n // move; the moved DTOs come out durable and `meta.changed` lists\n // stable ids.\n // - Stale revision, out-of-range, duplicate, and abort all reject.\n // ─────────────────────────────────────────────────────────────────\n\n test('move single durable annotation reorders within the page (single-as-batch)', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const page = doc.page(fix.pageObjectNumber);\n\n // Seed two durable annotations we can predict ordering for.\n const aDraft: HighlightDraft = {\n subtype: 'highlight',\n contents: 'move-a',\n quadPoints: quad,\n };\n const bDraft: HighlightDraft = {\n subtype: 'highlight',\n contents: 'move-b',\n quadPoints: quad,\n };\n const a = await page.annotations.create(aDraft);\n const b = await page.annotations.create(bDraft);\n const list = await page.annotations.list();\n const beforeRev = list.pageState.revision.generation;\n\n // Find current indices of a and b.\n const aIdx = list.annotations.findIndex(\n (x) =>\n x.ref.kind === 'objectNumber' &&\n a.created.ref.kind === 'objectNumber' &&\n x.ref.annotObjectNumber === a.created.ref.annotObjectNumber,\n );\n const bIdx = list.annotations.findIndex(\n (x) =>\n x.ref.kind === 'objectNumber' &&\n b.created.ref.kind === 'objectNumber' &&\n x.ref.annotObjectNumber === b.created.ref.annotObjectNumber,\n );\n expect(aIdx >= 0 && bIdx >= 0).toBe(true);\n expect(aIdx < bIdx).toBe(true);\n\n // Move A to B's slot. Post-removal index space: A was removed,\n // so B's position becomes bIdx - 1. Targeting bIdx puts A AFTER\n // B's original position. Use `bIdx` as toIndex => A lands right\n // after B in the new order.\n const weakSession = await beginWeakEditIfRequired(doc, fix.pageObjectNumber, fix);\n const result = await page.annotations.move([a.created.ref], bIdx);\n try {\n expect(AnnotationMoveResultSchema.safeParse(result).success).toBe(true);\n expect(result.meta.affectedPages.length).toBe(1);\n expect(result.meta.affectedPages[0].pageObjectNumber).toBe(fix.pageObjectNumber);\n expect('cacheDelta' in result.meta).toBe(true);\n expect(result.moved.length).toBe(1);\n\n // Single revision bump per batch.\n expect(result.meta.affectedPages[0].revision.generation).toBe(beforeRev + 1);\n\n // The moved DTO sits at toIndex.\n if (result.moved[0].ref.kind === 'objectNumber') {\n const movedObjNum = result.moved[0].ref.annotObjectNumber;\n if (a.created.ref.kind === 'objectNumber') {\n expect(movedObjNum).toBe(a.created.ref.annotObjectNumber);\n }\n }\n\n // Verify the page now has A at its new position.\n const after = await page.annotations.list();\n expect(after.annotations.length).toBe(list.annotations.length);\n } finally {\n await weakSession?.release();\n }\n } finally {\n await doc.close();\n }\n });\n\n test('move multi-block preserves caller-supplied order at the destination', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const page = doc.page(fix.pageObjectNumber);\n\n // Seed three durable annotations.\n const ids = await Promise.all(\n ['multi-1', 'multi-2', 'multi-3'].map((label) =>\n page.annotations.create({\n subtype: 'highlight',\n contents: label,\n quadPoints: quad,\n }),\n ),\n );\n\n const list = await page.annotations.list();\n const beforeRev = list.pageState.revision.generation;\n\n // Move the three to position 0 in caller order [3, 1, 2].\n const callerOrder = [ids[2].created.ref, ids[0].created.ref, ids[1].created.ref];\n const weakSession = await beginWeakEditIfRequired(doc, fix.pageObjectNumber, fix);\n const result = await page.annotations.move(callerOrder, 0);\n try {\n // One revision bump even though three annotations moved.\n expect(result.meta.affectedPages[0].revision.generation).toBe(beforeRev + 1);\n expect(result.moved.length).toBe(3);\n expect(result.meta.changed.length).toBe(3);\n\n // Caller-supplied order preserved at the destination. Indices\n // 0, 1, 2 of the page now hold the moved DTOs in that order.\n const expectedOrder = [ids[2].created.ref, ids[0].created.ref, ids[1].created.ref].map(\n (r) => (r.kind === 'objectNumber' ? r.annotObjectNumber : null),\n );\n\n const movedObjNums = result.moved.map((d) =>\n d.ref.kind === 'objectNumber' ? d.ref.annotObjectNumber : null,\n );\n for (let i = 0; i < expectedOrder.length; i++) {\n expect(movedObjNums[i]).toBe(expectedOrder[i]);\n }\n } finally {\n await weakSession?.release();\n }\n } finally {\n await doc.close();\n }\n });\n\n if (fix.expectsWeakAnnotation) {\n test('move on a weak annotation upgrades it to durable /NM (one rev bump for batch)', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const page = doc.page(fix.pageObjectNumber);\n const before = await page.annotations.list();\n const weak = before.annotations.find((a) => a.identityQuality === 'weak');\n if (!weak || weak.ref.kind !== 'index') return;\n const beforeRev = before.pageState.revision.generation;\n\n // Move the weak annotation to position 0 (or somewhere\n // non-trivial). The engine must stamp a fresh /NM BEFORE the\n // move so the result is durable.\n const target = weak.ref.index === 0 ? 1 : 0;\n const weakSession = await beginWeakEditIfRequired(doc, fix.pageObjectNumber, fix);\n const result = await page.annotations.move([weak.ref], target);\n try {\n expect(result.meta.affectedPages[0].revision.generation).toBe(beforeRev + 1);\n expect(result.moved.length).toBe(1);\n expect(result.moved[0].identityQuality).toBe('durable');\n expect(\n result.moved[0].ref.kind === 'nm' || result.moved[0].ref.kind === 'objectNumber',\n ).toBe(true);\n\n // meta.changed is a stable id, never a weak ref.\n expect(result.meta.changed.length).toBe(1);\n expect(\n result.meta.changed[0].kind === 'nm' ||\n result.meta.changed[0].kind === 'objectNumber',\n ).toBe(true);\n } finally {\n await weakSession?.release();\n }\n } finally {\n await doc.close();\n }\n });\n }\n\n test('move with a stale index revision rejects (locked rev-token guard)', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const page = doc.page(fix.pageObjectNumber);\n const a = await page.annotations.create({\n subtype: 'highlight',\n contents: 'stale-a',\n quadPoints: quad,\n });\n const list = await page.annotations.list();\n const aIdx = list.annotations.findIndex(\n (x) =>\n x.ref.kind === 'objectNumber' &&\n a.created.ref.kind === 'objectNumber' &&\n x.ref.annotObjectNumber === a.created.ref.annotObjectNumber,\n );\n if (aIdx < 0) return;\n\n const staleIndexRef: AnnotationRef = {\n kind: 'index',\n pageObjectNumber: fix.pageObjectNumber,\n index: aIdx,\n revision: list.pageState.revision,\n };\n\n // Bump the revision by an unrelated index-shifting mutation.\n // create is append-only and no longer bumps revisions, so we\n // use a throwaway create+delete pair (the delete does the bump).\n const throwaway = await page.annotations.create({\n subtype: 'highlight',\n contents: 'bump-throwaway',\n quadPoints: quad,\n });\n const weakSession = await beginWeakEditIfRequired(doc, fix.pageObjectNumber, fix);\n await page.annotations.delete(throwaway.created.ref);\n\n let caught: unknown;\n try {\n await page.annotations.move([staleIndexRef], 0);\n } catch (err) {\n caught = err;\n } finally {\n await weakSession?.release();\n }\n expect(EngineError.is(caught, EngineErrorCode.InvalidReference)).toBe(true);\n } finally {\n await doc.close();\n }\n });\n\n test('move with out-of-range toIndex rejects with InvalidArg', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const page = doc.page(fix.pageObjectNumber);\n const a = await page.annotations.create({\n subtype: 'highlight',\n contents: 'oor-a',\n quadPoints: quad,\n });\n const list = await page.annotations.list();\n const farTooBig = list.annotations.length + 100;\n const weakSession = await beginWeakEditIfRequired(doc, fix.pageObjectNumber, fix);\n let caught: unknown;\n try {\n await page.annotations.move([a.created.ref], farTooBig);\n } catch (err) {\n caught = err;\n } finally {\n await weakSession?.release();\n }\n expect(EngineError.is(caught, EngineErrorCode.InvalidArg)).toBe(true);\n } finally {\n await doc.close();\n }\n });\n\n test('move with duplicate refs rejects with InvalidArg', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const page = doc.page(fix.pageObjectNumber);\n const a = await page.annotations.create({\n subtype: 'highlight',\n contents: 'dup-a',\n quadPoints: quad,\n });\n const weakSession = await beginWeakEditIfRequired(doc, fix.pageObjectNumber, fix);\n let caught: unknown;\n try {\n await page.annotations.move([a.created.ref, a.created.ref], 0);\n } catch (err) {\n caught = err;\n } finally {\n await weakSession?.release();\n }\n expect(EngineError.is(caught, EngineErrorCode.InvalidArg)).toBe(true);\n } finally {\n await doc.close();\n }\n });\n\n test('abort on move rejects with AbortError', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const page = doc.page(fix.pageObjectNumber);\n const a = await page.annotations.create({\n subtype: 'highlight',\n contents: 'abort-a',\n quadPoints: quad,\n });\n const weakSession = await beginWeakEditIfRequired(doc, fix.pageObjectNumber, fix);\n const p = page.annotations.move([a.created.ref], 0);\n p.abort('test');\n try {\n await expect(p).rejects.toBeInstanceOf(AbortError);\n } finally {\n await weakSession?.release();\n }\n } finally {\n await doc.close();\n }\n });\n\n test('a page move does NOT bump per-page RevisionTokens (weak refs survive reorder)', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const list = await doc.pages.list();\n if (list.pages.length < 1) return;\n\n // Revision is annotation liveness, keyed by `pageObjectNumber`. A\n // page move is structural-geometry-only: no page's /Annots array is\n // touched, so no `RevisionToken` bumps and index-kind refs captured\n // before the reorder stay valid. We observe the host page's\n // revision via `annotations.list().pageState` (the move result no\n // longer carries liveness — it returns geometry).\n const page = doc.page(fix.pageObjectNumber);\n const beforeGen = (await page.annotations.list()).pageState.revision.generation;\n\n // Pull some page to the front (prefer one that is NOT the host so\n // we exercise the cross-page case; fall back to the host itself for\n // single-page fixtures).\n const mover =\n list.pages.find((pg) => pg.pageObjectNumber !== fix.pageObjectNumber)?.pageObjectNumber ??\n fix.pageObjectNumber;\n await doc.pages.move([mover], 0);\n\n const afterGen = (await page.annotations.list()).pageState.revision.generation;\n expect(afterGen).toBe(beforeGen);\n } finally {\n await doc.close();\n }\n });\n\n // ─────────────────────────────────────────────────────────────────\n // /IRT + /RT relationships (reply vs group). Locked rules:\n // - A draft `inReplyTo` writes /IRT; /RT defaults to 'reply' when\n // `replyType` is omitted (ISO 32000 §12.5.6.2 default).\n // - The DTO surfaces `inReplyTo` (parent ref) + `replyType`; a\n // top-level annotation reports both as null.\n // - Linking reports the (possibly strengthened) parent id in\n // `meta.changed` and is non-structural (no rev bump / refetch).\n // - A cross-page parent is rejected with InvalidArg.\n // ─────────────────────────────────────────────────────────────────\n\n test('create a reply links /IRT and defaults /RT to \"reply\", reporting the parent', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const page = doc.page(fix.pageObjectNumber);\n const parent = await page.annotations.create({\n subtype: 'highlight',\n contents: 'reply parent',\n quadPoints: quad,\n } satisfies HighlightDraft);\n // A freshly created top-level annotation has no relationship.\n expect(parent.created.inReplyTo).toBe(null);\n expect(parent.created.replyType).toBe(null);\n\n const reply = await page.annotations.create({\n subtype: 'highlight',\n contents: 'a reply',\n quadPoints: quad,\n inReplyTo: parent.created.ref,\n } satisfies HighlightDraft);\n expect(AnnotationCreateResultSchema.safeParse(reply).success).toBe(true);\n // /RT absent in the draft normalizes to 'reply'.\n expect(reply.created.replyType).toBe('reply');\n expect(reply.created.inReplyTo === null).toBe(false);\n if (\n reply.created.inReplyTo?.kind === 'objectNumber' &&\n parent.created.ref.kind === 'objectNumber'\n ) {\n expect(reply.created.inReplyTo.annotObjectNumber).toBe(\n parent.created.ref.annotObjectNumber,\n );\n expect(reply.created.inReplyTo.pageObjectNumber).toBe(fix.pageObjectNumber);\n }\n // The parent (already durable) is reported alongside the new reply.\n expect(reply.meta.changed.length).toBe(2);\n // Linking is non-structural: no rev bump, no refetch.\n expect(reply.meta.shouldRefetch).toBe(null);\n expect(reply.meta.weakRefsInvalidated).toBe(false);\n\n // The relationship survives a fresh read.\n const after = await page.annotations.list();\n const readReply = after.annotations.find(\n (a) =>\n a.ref.kind === 'objectNumber' &&\n reply.created.ref.kind === 'objectNumber' &&\n a.ref.annotObjectNumber === reply.created.ref.annotObjectNumber,\n );\n expect(readReply?.replyType).toBe('reply');\n expect(readReply?.inReplyTo == null).toBe(false);\n } finally {\n await doc.close();\n }\n });\n\n test('create a grouped subordinate writes /RT /Group', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const page = doc.page(fix.pageObjectNumber);\n const primary = await page.annotations.create({\n subtype: 'highlight',\n contents: 'group primary',\n quadPoints: quad,\n } satisfies HighlightDraft);\n\n const caret = await page.annotations.create({\n subtype: 'caret',\n contents: '',\n rect: shapeRect,\n color: { r: 0, g: 0, b: 0 },\n opacity: 1,\n inReplyTo: primary.created.ref,\n replyType: 'group',\n } satisfies CaretDraft);\n expect(AnnotationCreateResultSchema.safeParse(caret).success).toBe(true);\n expect(caret.created.replyType).toBe('group');\n expect(caret.created.inReplyTo === null).toBe(false);\n\n const after = await page.annotations.list();\n const readCaret = after.annotations.find(\n (a) =>\n a.ref.kind === 'objectNumber' &&\n caret.created.ref.kind === 'objectNumber' &&\n a.ref.annotObjectNumber === caret.created.ref.annotObjectNumber,\n );\n expect(readCaret?.replyType).toBe('group');\n } finally {\n await doc.close();\n }\n });\n\n // ─────────────────────────────────────────────────────────────────\n // Link annotations. Locked rules:\n // - `/Dest` and `/A GoTo` both read as the normalized `goto` arm;\n // destinations carry page OBJECT NUMBERS on the wire (never\n // indices) and raw PDF user-space coordinates.\n // - `target: null` creates a dead link (create-then-edit flow).\n // - A patch RETARGETS by replacing `/A`; the reader gives `/A`\n // precedence so a retarget wins over any stray direct `/Dest`.\n // - Grouped links (v2 \"attached links\") are plain /IRT + /RT\n // /Group — nothing link-specific in the relationship plane.\n // ─────────────────────────────────────────────────────────────────\n\n test('create link annotations round-trip uri, goto/xyz, goto/fitH, and dead targets', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const page = doc.page(fix.pageObjectNumber);\n\n const uri = await page.annotations.create({\n subtype: 'link',\n rect: shapeRect,\n target: { kind: 'uri', uri: 'https://www.embedpdf.com/' },\n } satisfies LinkDraft);\n expect(AnnotationCreateResultSchema.safeParse(uri).success).toBe(true);\n expect(uri.created.subtype).toBe('link');\n if (uri.created.subtype === 'link') {\n expect(uri.created.target).toEqual({ kind: 'uri', uri: 'https://www.embedpdf.com/' });\n }\n\n // /XYZ with a null zoom axis: null means \"retain current\".\n const xyz = await page.annotations.create({\n subtype: 'link',\n rect: shapeRect,\n target: {\n kind: 'goto',\n destination: {\n kind: 'xyz',\n pageObjectNumber: fix.pageObjectNumber,\n left: 30,\n top: 500,\n zoom: null,\n },\n },\n } satisfies LinkDraft);\n expect(xyz.created.subtype).toBe('link');\n if (xyz.created.subtype === 'link') {\n expect(xyz.created.target?.kind).toBe('goto');\n if (xyz.created.target?.kind === 'goto') {\n const dest = xyz.created.target.destination;\n expect(dest.kind).toBe('xyz');\n if (dest.kind === 'xyz') {\n expect(dest.pageObjectNumber).toBe(fix.pageObjectNumber);\n expect(dest.left).toBe(30);\n expect(dest.top).toBe(500);\n expect(dest.zoom).toBe(null);\n }\n }\n }\n\n const fitH = await page.annotations.create({\n subtype: 'link',\n rect: shapeRect,\n target: {\n kind: 'goto',\n destination: { kind: 'fitH', pageObjectNumber: fix.pageObjectNumber, top: 420 },\n },\n } satisfies LinkDraft);\n expect(fitH.created.subtype).toBe('link');\n if (fitH.created.subtype === 'link' && fitH.created.target?.kind === 'goto') {\n expect(fitH.created.target.destination).toEqual({\n kind: 'fitH',\n pageObjectNumber: fix.pageObjectNumber,\n top: 420,\n });\n }\n\n // Dead link: legal to author, reported as-is.\n const dead = await page.annotations.create({\n subtype: 'link',\n rect: shapeRect,\n target: null,\n } satisfies LinkDraft);\n expect(dead.created.subtype).toBe('link');\n if (dead.created.subtype === 'link') expect(dead.created.target).toBe(null);\n\n // All four survive a fresh page read as link DTOs.\n const after = await page.annotations.list();\n const links = after.annotations.filter((a) => a.subtype === 'link');\n expect(links.length >= 4).toBe(true);\n } finally {\n await doc.close();\n }\n });\n\n test('a link patch retargets in both directions (uri→goto, goto→uri) and moves the rect', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const page = doc.page(fix.pageObjectNumber);\n const created = await page.annotations.create({\n subtype: 'link',\n rect: shapeRect,\n target: { kind: 'uri', uri: 'https://old.example/' },\n } satisfies LinkDraft);\n\n const toGoto = await page.annotations.update(created.created.ref, {\n subtype: 'link',\n target: {\n kind: 'goto',\n destination: { kind: 'fit', pageObjectNumber: fix.pageObjectNumber },\n },\n });\n expect(AnnotationUpdateResultSchema.safeParse(toGoto).success).toBe(true);\n if (toGoto.updated.subtype === 'link') {\n expect(toGoto.updated.target).toEqual({\n kind: 'goto',\n destination: { kind: 'fit', pageObjectNumber: fix.pageObjectNumber },\n });\n }\n\n const movedRect = {\n left: shapeRect.left + 5,\n bottom: shapeRect.bottom + 5,\n right: shapeRect.right + 5,\n top: shapeRect.top + 5,\n };\n const toUri = await page.annotations.update(created.created.ref, {\n subtype: 'link',\n rect: movedRect,\n target: { kind: 'uri', uri: 'https://new.example/' },\n });\n if (toUri.updated.subtype === 'link') {\n expect(toUri.updated.target).toEqual({ kind: 'uri', uri: 'https://new.example/' });\n expect(Math.round(toUri.updated.rect.left)).toBe(Math.round(movedRect.left));\n }\n } finally {\n await doc.close();\n }\n });\n\n test('a link patch clears the target with null — a dead link on re-read', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const page = doc.page(fix.pageObjectNumber);\n const created = await page.annotations.create({\n subtype: 'link',\n rect: shapeRect,\n target: {\n kind: 'goto',\n destination: { kind: 'fit', pageObjectNumber: fix.pageObjectNumber },\n },\n } satisfies LinkDraft);\n\n const cleared = await page.annotations.update(created.created.ref, {\n subtype: 'link',\n target: null,\n });\n expect(AnnotationUpdateResultSchema.safeParse(cleared).success).toBe(true);\n if (cleared.updated.subtype === 'link') expect(cleared.updated.target).toBe(null);\n\n // Truly dead — a fresh page read agrees (both /A and /Dest gone).\n const after = await page.annotations.list();\n const readBack = after.annotations.find(\n (a) =>\n a.ref.kind === 'objectNumber' &&\n created.created.ref.kind === 'objectNumber' &&\n a.ref.annotObjectNumber === created.created.ref.annotObjectNumber,\n );\n expect(readBack?.subtype).toBe('link');\n if (readBack?.subtype === 'link') expect(readBack.target).toBe(null);\n\n // And a cleared link can be re-targeted afterwards.\n const revived = await page.annotations.update(created.created.ref, {\n subtype: 'link',\n target: { kind: 'uri', uri: 'https://revived.example/' },\n });\n if (revived.updated.subtype === 'link') {\n expect(revived.updated.target).toEqual({\n kind: 'uri',\n uri: 'https://revived.example/',\n });\n }\n } finally {\n await doc.close();\n }\n });\n\n test('a link grouped to a highlight round-trips /IRT + /RT /Group with its target', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const page = doc.page(fix.pageObjectNumber);\n const parent = await page.annotations.create({\n subtype: 'highlight',\n contents: 'linked text',\n quadPoints: quad,\n } satisfies HighlightDraft);\n\n const link = await page.annotations.create({\n subtype: 'link',\n rect: shapeRect,\n target: { kind: 'uri', uri: 'https://www.embedpdf.com/docs' },\n inReplyTo: parent.created.ref,\n replyType: 'group',\n } satisfies LinkDraft);\n expect(AnnotationCreateResultSchema.safeParse(link).success).toBe(true);\n expect(link.created.replyType).toBe('group');\n expect(link.created.inReplyTo === null).toBe(false);\n if (\n link.created.inReplyTo?.kind === 'objectNumber' &&\n parent.created.ref.kind === 'objectNumber'\n ) {\n expect(link.created.inReplyTo.annotObjectNumber).toBe(\n parent.created.ref.annotObjectNumber,\n );\n }\n\n // Both the relationship AND the target survive a fresh read.\n const after = await page.annotations.list();\n const readLink = after.annotations.find(\n (a) =>\n a.ref.kind === 'objectNumber' &&\n link.created.ref.kind === 'objectNumber' &&\n a.ref.annotObjectNumber === link.created.ref.annotObjectNumber,\n );\n expect(readLink?.subtype).toBe('link');\n expect(readLink?.replyType).toBe('group');\n if (readLink?.subtype === 'link') {\n expect(readLink.target).toEqual({ kind: 'uri', uri: 'https://www.embedpdf.com/docs' });\n }\n } finally {\n await doc.close();\n }\n });\n\n test('replace-text round-trips /IT and groups StrikeOut under its Caret', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const page = doc.page(fix.pageObjectNumber);\n const caret = await page.annotations.create({\n subtype: 'caret',\n intent: 'replace',\n contents: 'replacement text',\n rect: shapeRect,\n color: { r: 228, g: 66, b: 52 },\n opacity: 1,\n rectDifferences: { left: 0.5, top: 0.5, right: 0.5, bottom: 0.5 },\n } satisfies CaretDraft);\n const strikeout = await page.annotations.create({\n subtype: 'strikeout',\n intent: 'strikeout-text-edit',\n quadPoints: quad,\n color: { r: 228, g: 66, b: 52 },\n opacity: 1,\n inReplyTo: caret.created.ref,\n replyType: 'group',\n } satisfies StrikeoutDraft);\n\n expect(caret.created.subtype).toBe('caret');\n if (caret.created.subtype === 'caret') expect(caret.created.intent).toBe('replace');\n expect(strikeout.created.subtype).toBe('strikeout');\n if (strikeout.created.subtype === 'strikeout') {\n expect(strikeout.created.intent).toBe('strikeout-text-edit');\n }\n expect(strikeout.created.replyType).toBe('group');\n expect(strikeout.created.inReplyTo).toEqual(caret.created.ref);\n\n const after = await page.annotations.list();\n const readCaret = after.annotations.find(\n (a) =>\n a.ref.kind === 'objectNumber' &&\n caret.created.ref.kind === 'objectNumber' &&\n a.ref.annotObjectNumber === caret.created.ref.annotObjectNumber,\n );\n const readStrikeout = after.annotations.find(\n (a) =>\n a.ref.kind === 'objectNumber' &&\n strikeout.created.ref.kind === 'objectNumber' &&\n a.ref.annotObjectNumber === strikeout.created.ref.annotObjectNumber,\n );\n expect(readCaret?.subtype === 'caret' && readCaret.intent).toBe('replace');\n expect(readStrikeout?.subtype === 'strikeout' && readStrikeout.intent).toBe(\n 'strikeout-text-edit',\n );\n expect(readStrikeout?.replyType).toBe('group');\n expect(readStrikeout?.inReplyTo).toEqual(caret.created.ref);\n } finally {\n await doc.close();\n }\n });\n\n test('patch inReplyTo: null clears /IRT and /RT (back to top-level)', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const page = doc.page(fix.pageObjectNumber);\n const parent = await page.annotations.create({\n subtype: 'highlight',\n contents: 'clear parent',\n quadPoints: quad,\n } satisfies HighlightDraft);\n const reply = await page.annotations.create({\n subtype: 'highlight',\n contents: 'clearable reply',\n quadPoints: quad,\n inReplyTo: parent.created.ref,\n } satisfies HighlightDraft);\n expect(reply.created.replyType).toBe('reply');\n\n const cleared = await page.annotations.update(reply.created.ref, {\n subtype: 'highlight',\n inReplyTo: null,\n });\n expect(AnnotationUpdateResultSchema.safeParse(cleared).success).toBe(true);\n expect(cleared.updated.inReplyTo).toBe(null);\n expect(cleared.updated.replyType).toBe(null);\n } finally {\n await doc.close();\n }\n });\n\n test('create with a cross-page /IRT parent throws InvalidArg', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const page = doc.page(fix.pageObjectNumber);\n const parent = await page.annotations.create({\n subtype: 'highlight',\n contents: 'cross-page parent',\n quadPoints: quad,\n } satisfies HighlightDraft);\n if (parent.created.ref.kind !== 'objectNumber') return;\n\n // Same annotation object number, but a deliberately different page:\n // the engine must reject before resolving anything (ISO requires\n // reply and parent on the same page).\n const crossPageRef: AnnotationRef = {\n kind: 'objectNumber',\n pageObjectNumber: fix.pageObjectNumber + 2,\n annotObjectNumber: parent.created.ref.annotObjectNumber,\n };\n let caught: unknown;\n try {\n await page.annotations.create({\n subtype: 'highlight',\n contents: 'bad cross-page reply',\n quadPoints: quad,\n inReplyTo: crossPageRef,\n } satisfies HighlightDraft);\n } catch (err) {\n caught = err;\n }\n expect(EngineError.is(caught, EngineErrorCode.InvalidArg)).toBe(true);\n } finally {\n await doc.close();\n }\n });\n\n // ─────────────────────────────────────────────────────────────────\n // /State + /StateModel (review status, ISO 32000 §12.5.6.3) and\n // /Subj. Locked rules:\n // - A status change is a NEW text annotation replying to its target\n // via /IRT; the target annotation itself is never modified.\n // - Faithful reads: `state` / `stateModel` / `subject` are null iff\n // the PDF entry is absent — a null after a null-clear patch proves\n // TRUE key removal (EPDFAnnot_RemoveKey), not an empty-string\n // write.\n // - Known review/marked values are wire-normalized to lowercase;\n // custom Acrobat state models round-trip verbatim.\n // - A draft `state` without `stateModel` is rejected with InvalidArg\n // (ISO Table 175: StateModel is required when State is present).\n // - State entries are appearance-inert: they never repaint anything.\n // ─────────────────────────────────────────────────────────────────\n\n test('a review-status reply round-trips /State + /StateModel + /Subj', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const page = doc.page(fix.pageObjectNumber);\n const target = await page.annotations.create({\n subtype: 'highlight',\n contents: 'status target',\n subject: 'Pricing question',\n quadPoints: quad,\n } satisfies HighlightDraft);\n expect(target.created.subject).toBe('Pricing question');\n\n const status = await page.annotations.create({\n subtype: 'text',\n rect: shapeRect,\n inReplyTo: target.created.ref,\n state: 'accepted',\n stateModel: 'review',\n } satisfies TextDraft);\n expect(AnnotationCreateResultSchema.safeParse(status).success).toBe(true);\n expect(status.created.subtype).toBe('text');\n if (status.created.subtype !== 'text') return;\n expect(status.created.state).toBe('accepted');\n expect(status.created.stateModel).toBe('review');\n // A state annotation is a reply like any other.\n expect(status.created.replyType).toBe('reply');\n\n // The entries survive a fresh read.\n const after = await page.annotations.list();\n const read = after.annotations.find(\n (a) =>\n a.ref.kind === 'objectNumber' &&\n status.created.ref.kind === 'objectNumber' &&\n a.ref.annotObjectNumber === status.created.ref.annotObjectNumber,\n );\n expect(read?.subtype).toBe('text');\n if (read?.subtype === 'text') {\n expect(read.state).toBe('accepted');\n expect(read.stateModel).toBe('review');\n }\n } finally {\n await doc.close();\n }\n });\n\n test('a draft /State without /StateModel is rejected with InvalidArg', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const page = doc.page(fix.pageObjectNumber);\n let caught: unknown;\n try {\n await page.annotations.create({\n subtype: 'text',\n rect: shapeRect,\n state: 'accepted',\n } satisfies TextDraft);\n } catch (err) {\n caught = err;\n }\n expect(EngineError.is(caught, EngineErrorCode.InvalidArg)).toBe(true);\n } finally {\n await doc.close();\n }\n });\n\n test('null-clear patches truly remove /State, /StateModel, /Subj and /Contents', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const page = doc.page(fix.pageObjectNumber);\n const note = await page.annotations.create({\n subtype: 'text',\n rect: shapeRect,\n contents: 'work in progress',\n subject: 'Draft',\n state: 'none',\n stateModel: 'review',\n } satisfies TextDraft);\n\n // Cycle the state alone — the model already on the annotation\n // stays; state entries never touch the appearance.\n const cycled = await page.annotations.update(note.created.ref, {\n subtype: 'text',\n state: 'rejected',\n } satisfies TextPatch);\n expect(cycled.appearance.changed).toBe(false);\n expect(cycled.updated.subtype).toBe('text');\n if (cycled.updated.subtype === 'text') {\n expect(cycled.updated.state).toBe('rejected');\n expect(cycled.updated.stateModel).toBe('review');\n }\n\n const cleared = await page.annotations.update(note.created.ref, {\n subtype: 'text',\n contents: null,\n subject: null,\n state: null,\n stateModel: null,\n } satisfies TextPatch);\n expect(cleared.appearance.changed).toBe(false);\n expect(cleared.updated.contents).toBe(null);\n expect(cleared.updated.subject).toBe(null);\n if (cleared.updated.subtype === 'text') {\n expect(cleared.updated.state).toBe(null);\n expect(cleared.updated.stateModel).toBe(null);\n }\n\n // Faithful read: null distinguishes absent from ''. Null here\n // proves the entries were REMOVED, not overwritten with an empty\n // string.\n const after = await page.annotations.list();\n const read = after.annotations.find(\n (a) =>\n a.ref.kind === 'objectNumber' &&\n note.created.ref.kind === 'objectNumber' &&\n a.ref.annotObjectNumber === note.created.ref.annotObjectNumber,\n );\n expect(read?.contents).toBe(null);\n expect(read?.subject).toBe(null);\n if (read?.subtype === 'text') {\n expect(read.state).toBe(null);\n expect(read.stateModel).toBe(null);\n }\n } finally {\n await doc.close();\n }\n });\n\n test('custom state models round-trip verbatim', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const page = doc.page(fix.pageObjectNumber);\n const custom = await page.annotations.create({\n subtype: 'text',\n rect: shapeRect,\n state: 'in-progress',\n stateModel: 'X-ReviewWorkflow',\n } satisfies TextDraft);\n expect(custom.created.subtype).toBe('text');\n if (custom.created.subtype !== 'text') return;\n expect(custom.created.state).toBe('in-progress');\n expect(custom.created.stateModel).toBe('X-ReviewWorkflow');\n\n const after = await page.annotations.list();\n const read = after.annotations.find(\n (a) =>\n a.ref.kind === 'objectNumber' &&\n custom.created.ref.kind === 'objectNumber' &&\n a.ref.annotObjectNumber === custom.created.ref.annotObjectNumber,\n );\n if (read?.subtype === 'text') {\n expect(read.state).toBe('in-progress');\n expect(read.stateModel).toBe('X-ReviewWorkflow');\n }\n } finally {\n await doc.close();\n }\n });\n });\n}\n\nasync function beginWeakEditIfRequired(\n doc: DocumentHandle,\n pageObjectNumber: number,\n fix: AnnotationMutationConformanceFixture,\n): Promise<WeakAnnotationEditSession | null> {\n if (doc.capabilities.weakAnnotationEditSessions !== 'required' || !fix.expectsWeakAnnotation) {\n return null;\n }\n return doc.annotations.beginWeakEdit([pageObjectNumber]);\n}\n\nasync function openFixture(\n engine: Engine,\n opts: AnnotationMutationConformanceOptions,\n): Promise<DocumentHandle> {\n if (opts.openKind === 'bytes') {\n const bytes = await opts.fixture.bytes();\n return engine.open({ kind: 'bytes', id: opts.fixture.id, bytes });\n }\n return engine.open({ kind: 'id', id: opts.fixture.cloudId ?? opts.fixture.id });\n}\n\n/**\n * Build a valid `AnnotationPatch` for the supplied subtype that mutates\n * a single field we can read back. Returns `null` for subtypes the\n * harness can't synthesise a patch for (e.g. unsupported); caller\n * gracefully skips.\n */\nfunction subtypeAwarePatch(subtype: string, newContents: string): AnnotationPatch | null {\n switch (subtype) {\n case 'highlight':\n case 'underline':\n case 'squiggly':\n case 'strikeout':\n case 'circle':\n case 'square':\n case 'polygon':\n case 'polyline':\n case 'line':\n case 'ink':\n case 'free-text':\n case 'caret':\n return {\n subtype: subtype as AnnotationPatch['subtype'],\n contents: newContents,\n } as AnnotationPatch;\n default:\n return null;\n }\n}\n","import type {\n ConformanceFixture,\n ConformanceOptions,\n ConformanceTestRunner,\n} from './runMetadataConformance';\nimport type { DocumentHandle } from '../engine/DocumentHandle';\nimport type { Engine } from '../engine/Engine';\nimport { EngineErrorCode } from '../errors/EngineErrorCode';\nimport type { DocumentEvent } from '../events/DocumentEvent';\nimport type { FormFieldDTO } from '../forms/field';\nimport {\n FormImportResultSchema,\n FormRepairResultSchema,\n FormSetValueResultSchema,\n} from '../wire/schemas';\nimport { FormSnapshotSchema } from '../forms/schema';\n\n/**\n * The three fixtures the forms suite needs. Shapes (names, object numbers,\n * values) match the pdf-runtime fork's test resources:\n *\n * - `toggleFields` — toggle_fields.pdf: text field `maxlen_text`\n * (/MaxLen 5, value \"abc\"), radio `ntto_radio` (NoToggleToOff, /DV x,\n * widgets x/y), radio `unison_radio` (RadiosInUnison), checkbox\n * `opt_check` (/Opt \"Alpha\", on-state \"On\"), hierarchical text field\n * `billing.name`.\n * - `orphanWidgets` — orphan_widgets.pdf: `linked_text` in /AcroForm\n * /Fields plus RECOVERED `orphan_check` and `orphan_radio`.\n * - `choiceFields` — listbox_form.pdf: `Listbox_MultiSelect` (options\n * Apple..), `Listbox_SingleSelect`.\n */\nexport interface FormConformanceFixtures {\n /** toggle_fields.pdf; `pageObjectNumber` = its single page (object 3). */\n toggleFields: ConformanceFixture & { pageObjectNumber: number };\n orphanWidgets: ConformanceFixture;\n choiceFields: ConformanceFixture;\n /**\n * A second, independent copy of `toggleFields` used as the XFDF import\n * target. Required for `openKind: 'id'` (cloud) — id-opened documents are\n * server-side state, so the suite cannot mint a copy by re-opening the\n * same bytes under a suffixed id the way the bytes transport does.\n */\n importTarget?: ConformanceFixture;\n}\n\nexport interface FormConformanceOptions extends Omit<ConformanceOptions, 'fixture'> {\n fixtures: FormConformanceFixtures;\n}\n\nexport function runFormConformance(\n runner: ConformanceTestRunner,\n opts: FormConformanceOptions,\n): void {\n const { describe, test, beforeAll, afterAll, expect } = runner;\n\n describe(`forms conformance: ${opts.label}`, () => {\n let engine: Engine;\n\n beforeAll(async () => {\n engine = await opts.makeEngine();\n });\n\n afterAll(async () => {\n await engine.destroy();\n });\n\n async function open(fixture: ConformanceFixture, idSuffix = ''): Promise<DocumentHandle> {\n if (opts.openKind === 'bytes') {\n const bytes = await fixture.bytes();\n return engine.open({ kind: 'bytes', id: fixture.id + idSuffix, bytes });\n }\n return engine.open({ kind: 'id', id: fixture.cloudId ?? fixture.id });\n }\n\n function fieldByName(fields: FormFieldDTO[], name: string): FormFieldDTO {\n const field = fields.find((f) => f.name === name);\n expect(Boolean(field)).toBe(true);\n return field!;\n }\n\n test('lists the reconciled field tree with per-family DTOs', async () => {\n const doc = await open(opts.fixtures.toggleFields);\n try {\n const snapshot = await doc.forms.list();\n // Wire parity: the snapshot must survive its own schema.\n FormSnapshotSchema.parse(snapshot);\n expect(snapshot.formKind).toBe('acroform');\n\n const text = fieldByName(snapshot.fields, 'maxlen_text');\n if (text.family !== 'text') throw new Error('expected text family');\n expect(text.value).toBe('abc');\n expect(text.valueEntry).toEqual({ kind: 'scalar', value: 'abc' });\n expect(text.defaultValueEntry).toEqual({ kind: 'none' });\n expect(text.maxLength).toBe(5);\n expect(text.widgets.length).toBe(1);\n\n const radio = fieldByName(snapshot.fields, 'ntto_radio');\n if (radio.family !== 'radio') throw new Error('expected radio family');\n expect(radio.noToggleToOff).toBe(true);\n expect(radio.value).toBe('x');\n expect(radio.valueEntry).toEqual({ kind: 'scalar', value: 'x' });\n expect(radio.defaultValueEntry).toEqual({ kind: 'scalar', value: 'x' });\n expect(radio.widgets.map((w) => w.onState)).toEqual(['x', 'y']);\n expect(radio.widgets.map((w) => w.checked)).toEqual([true, false]);\n\n const unison = fieldByName(snapshot.fields, 'unison_radio');\n if (unison.family !== 'radio') throw new Error('expected radio family');\n expect(unison.radiosInUnison).toBe(true);\n\n const check = fieldByName(snapshot.fields, 'opt_check');\n if (check.family !== 'checkbox') throw new Error('expected checkbox family');\n expect(check.checked).toBe(false);\n expect(check.exportValue).toBe('Alpha');\n\n // Hierarchical fields surface under their fully qualified name.\n const nested = fieldByName(snapshot.fields, 'billing.name');\n expect(nested.family).toBe('text');\n expect(snapshot.calculationOrder).toEqual([]);\n } finally {\n await doc.close();\n }\n });\n\n test('writes text values and truncates to /MaxLen', async () => {\n const doc = await open(opts.fixtures.toggleFields);\n try {\n const result = await doc.forms.setValue(\n { kind: 'fqn', name: 'maxlen_text' },\n { type: 'text', value: 'abcde' },\n );\n FormSetValueResultSchema.parse(result);\n expect(result.field.family).toBe('text');\n if (result.field.family === 'text') expect(result.field.value).toBe('abcde');\n expect(result.changedWidgets.length).toBe(1);\n\n const truncated = await doc.forms.setValue(\n { kind: 'fqn', name: 'maxlen_text' },\n { type: 'text', value: 'abcdef' },\n );\n if (truncated.field.family !== 'text') throw new Error('expected text family');\n expect(truncated.field.value).toBe('abcde');\n expect(truncated.changedWidgets).toHaveLength(0);\n\n // Re-read through the (invalidated) snapshot: the write is visible.\n const after = await doc.forms.get({ kind: 'fqn', name: 'maxlen_text' });\n if (after.family === 'text') expect(after.value).toBe('abcde');\n } finally {\n await doc.close();\n }\n });\n\n test('toggles radio groups and honors NoToggleToOff', async () => {\n const doc = await open(opts.fixtures.toggleFields);\n try {\n const radioRef = { kind: 'fqn', name: 'ntto_radio' } as const;\n const result = await doc.forms.setValue(radioRef, { type: 'toggle', state: 'y' });\n if (result.field.family !== 'radio') throw new Error('expected radio family');\n expect(result.field.value).toBe('y');\n expect(result.field.widgets.map((w) => w.checked)).toEqual([false, true]);\n expect(result.changedWidgets.length).toBe(2); // x -> Off, y -> on\n\n // Clearing a NoToggleToOff group is a validation error.\n await expect(\n doc.forms.setValue(radioRef, { type: 'toggle', state: null }),\n ).rejects.toMatchObject({ code: EngineErrorCode.InvalidArg });\n\n // Checkbox with /Opt: checking reads back the export value.\n const check = await doc.forms.setValue(\n { kind: 'fqn', name: 'opt_check' },\n { type: 'toggle', state: 'On' },\n );\n if (check.field.family !== 'checkbox') throw new Error('expected checkbox family');\n expect(check.field.checked).toBe(true);\n } finally {\n await doc.close();\n }\n });\n\n test('rejects family/value mismatches without touching the field', async () => {\n const doc = await open(opts.fixtures.toggleFields);\n try {\n // Compare against the CURRENT value, not the fixture seed: on\n // transports with durable server state (cloud), earlier tests'\n // legitimate writes persist. The invariant under test is that a\n // rejected write changes NOTHING.\n const before = await doc.forms.get({ kind: 'fqn', name: 'maxlen_text' });\n if (before.family !== 'text') throw new Error('expected text family');\n await expect(\n doc.forms.setValue({ kind: 'fqn', name: 'maxlen_text' }, { type: 'toggle', state: 'On' }),\n ).rejects.toMatchObject({ code: EngineErrorCode.InvalidArg });\n const field = await doc.forms.get({ kind: 'fqn', name: 'maxlen_text' });\n if (field.family === 'text') expect(field.value).toBe(before.value);\n } finally {\n await doc.close();\n }\n });\n\n test('applies ordered script effects once and produces zero churn for a no-op batch', async () => {\n const doc = await open(opts.fixtures.toggleFields);\n if (!doc.forms.applyEffects) {\n await doc.close();\n return;\n }\n try {\n const events: DocumentEvent[] = [];\n const unsubscribe = doc.events.subscribe((event) => {\n if (event.type === 'form.effectsApplied') events.push(event);\n });\n const result = await doc.forms.applyEffects([\n {\n kind: 'setValue',\n ref: { kind: 'fqn', name: 'maxlen_text' },\n value: { type: 'text', value: 'abcdef' },\n },\n {\n kind: 'setValue',\n ref: { kind: 'fqn', name: 'missing.effect.field' },\n value: { type: 'text', value: 'ignored' },\n },\n {\n kind: 'setValue',\n ref: { kind: 'fqn', name: 'maxlen_text' },\n value: { type: 'text', value: 'abcde' },\n },\n ]);\n expect(result.results.map((entry) => entry.status)).toEqual([\n 'applied',\n 'rejected',\n 'unchanged',\n ]);\n expect(result.meta === null).toBe(false);\n expect(events).toHaveLength(1);\n const appliedText = result.results[0]?.fields[0];\n if (appliedText?.family !== 'text') throw new Error('expected text family');\n expect(appliedText.value).toBe('abcde');\n\n const noOp = await doc.forms.applyEffects([\n {\n kind: 'setValue',\n ref: { kind: 'fqn', name: 'maxlen_text' },\n value: { type: 'text', value: 'abcde' },\n },\n ]);\n expect(noOp.results.map((entry) => entry.status)).toEqual(['unchanged']);\n expect(noOp.meta).toBeNull();\n expect(events).toHaveLength(1);\n unsubscribe();\n } finally {\n await doc.close();\n }\n });\n\n test('selects multi-select list box options by export value', async () => {\n const doc = await open(opts.fixtures.choiceFields);\n try {\n const multiRef = { kind: 'fqn', name: 'Listbox_MultiSelect' } as const;\n const result = await doc.forms.setValue(multiRef, {\n type: 'choice',\n values: ['Cherry', 'Apple'],\n });\n if (result.field.family !== 'listbox') throw new Error('expected listbox family');\n // Option order, not input order.\n expect(result.field.selectedValues).toEqual(['Apple', 'Cherry']);\n expect(result.field.valueEntry.kind).toBe('array');\n\n // Multiple values on a single-select list box is a validation error.\n await expect(\n doc.forms.setValue(\n { kind: 'fqn', name: 'Listbox_SingleSelect' },\n { type: 'choice', values: ['foo', 'bar'] },\n ),\n ).rejects.toMatchObject({ code: EngineErrorCode.InvalidArg });\n } finally {\n await doc.close();\n }\n });\n\n test('reset restores /DV or clears the value', async () => {\n const doc = await open(opts.fixtures.toggleFields);\n try {\n // ntto_radio carries /DV x.\n await doc.forms.setValue(\n { kind: 'fqn', name: 'ntto_radio' },\n { type: 'toggle', state: 'y' },\n );\n const radio = await doc.forms.reset({ kind: 'fqn', name: 'ntto_radio' });\n if (radio.field.family === 'radio') expect(radio.field.value).toBe('x');\n\n // maxlen_text has no /DV: reset clears.\n await doc.forms.setValue(\n { kind: 'fqn', name: 'maxlen_text' },\n { type: 'text', value: 'zzz' },\n );\n const text = await doc.forms.reset({ kind: 'fqn', name: 'maxlen_text' });\n if (text.field.family === 'text') expect(text.field.value).toBe('');\n } finally {\n await doc.close();\n }\n });\n\n test('round-trips form data across documents via XFDF and FDF', async () => {\n const first = await open(opts.fixtures.toggleFields);\n let second: DocumentHandle | null = null;\n try {\n // A second, independent copy of the same fixture (a dedicated\n // fixture when the transport needs server-side state, else the same\n // bytes under a suffixed id so the two sessions coexist).\n second = opts.fixtures.importTarget\n ? await open(opts.fixtures.importTarget)\n : await open(opts.fixtures.toggleFields, '-import-target');\n const tricky = 'a<b>&\"c\" \\'d\\'';\n await first.forms.setValue(\n { kind: 'fqn', name: 'billing.name' },\n { type: 'text', value: tricky },\n );\n\n const xfdf = await first.forms.exportData('xfdf');\n expect(xfdf.format).toBe('xfdf');\n expect(xfdf.bytes.length > 0).toBe(true);\n\n const imported = await second!.forms.importData(xfdf.bytes);\n FormImportResultSchema.parse(imported);\n expect(imported.fieldsSkipped).toBe(0);\n expect(imported.fieldsApplied > 0).toBe(true);\n const nested = imported.snapshot.fields.find((f) => f.name === 'billing.name');\n if (nested?.family === 'text') expect(nested.value).toBe(tricky);\n\n const fdf = await first.forms.exportData('fdf');\n expect(fdf.format).toBe('fdf');\n const head = String.fromCharCode(...fdf.bytes.slice(0, 5));\n expect(head).toBe('%FDF-');\n } finally {\n await first.close();\n if (second) await second.close();\n }\n });\n\n test('rejects garbage import payloads', async () => {\n const doc = await open(opts.fixtures.toggleFields);\n try {\n await expect(\n doc.forms.importData(new TextEncoder().encode('not a form payload')),\n ).rejects.toMatchObject({ code: EngineErrorCode.InvalidArg });\n } finally {\n await doc.close();\n }\n });\n\n test('emits form events on mutations', async () => {\n const doc = await open(opts.fixtures.toggleFields);\n try {\n const events: DocumentEvent[] = [];\n const unsubscribe = doc.events.subscribe((event) => {\n if (event.type.startsWith('form.')) events.push(event);\n });\n await doc.forms.setValue(\n { kind: 'fqn', name: 'maxlen_text' },\n { type: 'text', value: 'ok' },\n );\n unsubscribe();\n expect(events.length).toBe(1);\n expect(events[0]!.type).toBe('form.valueChanged');\n } finally {\n await doc.close();\n }\n });\n\n test('repair makes recovered fields durable and is idempotent', async () => {\n const doc = await open(opts.fixtures.orphanWidgets);\n try {\n const before = await doc.forms.list();\n expect(before.fields.length).toBe(3);\n expect(before.fields.filter((f) => f.origin === 'recovered').length).toBe(2);\n\n const repair = await doc.forms.repair();\n FormRepairResultSchema.parse(repair);\n expect(repair.fieldsLinked).toBe(2);\n expect(repair.acroformCreated).toBe(false);\n expect(repair.fieldsUnrepairable).toBe(0);\n\n const after = await doc.forms.list();\n expect(after.fields.every((f) => f.origin === 'acroform')).toBe(true);\n\n const again = await doc.forms.repair();\n expect(again.fieldsLinked).toBe(0);\n expect(again.widgetsLinked).toBe(0);\n } finally {\n await doc.close();\n }\n });\n\n test('widgets live the full annotation-plane loop', async () => {\n const doc = await open(opts.fixtures.toggleFields);\n const pon = opts.fixtures.toggleFields.pageObjectNumber;\n try {\n // 1. Born as an annotation: inert, styled with the house vocabulary.\n const page = doc.page(pon);\n const created = await page.annotations.create({\n subtype: 'widget',\n rect: { left: 20, bottom: 20, right: 200, top: 44 },\n interiorColor: { r: 246, g: 248, b: 250 },\n color: { r: 31, g: 111, b: 235 },\n strokeWidth: 1,\n fontSize: 10,\n });\n if (created.created.subtype !== 'widget') throw new Error('expected widget DTO');\n expect(created.created.fieldObjectNumber).toBe(0); // inert\n expect(created.created.interiorColor).toEqual({ r: 246, g: 248, b: 250 });\n const widgetRef = created.created.ref;\n if (widgetRef.kind !== 'objectNumber') throw new Error('expected durable ref');\n\n // 2. Adopted by a field -> the DTO joins to the field plane.\n const field = await doc.forms.createField({ family: 'text', name: 'loop_field' });\n await doc.forms.attachWidget(field.field.ref, {\n annotObjectNumber: widgetRef.annotObjectNumber,\n pageObjectNumber: pon,\n });\n const { annotations } = await page.annotations.list();\n const widgetDto = annotations.find(\n (a) =>\n a.ref.kind === 'objectNumber' &&\n a.ref.annotObjectNumber === widgetRef.annotObjectNumber,\n );\n if (widgetDto?.subtype !== 'widget') throw new Error('expected widget DTO');\n expect(widgetDto.fieldObjectNumber).toBe(field.field.fieldObjectNumber);\n\n // 3. Restyled/moved through the SAME annotation path as every kind.\n const patched = await page.annotations.update(widgetRef, {\n subtype: 'widget',\n interiorColor: { r: 255, g: 247, b: 219 },\n });\n if (patched.updated.subtype !== 'widget') throw new Error('expected widget DTO');\n expect(patched.updated.interiorColor).toEqual({ r: 255, g: 247, b: 219 });\n\n // 4. Deleting an ATTACHED widget is refused - the field-tree owns it.\n await expect(page.annotations.delete(widgetRef)).rejects.toMatchObject({\n code: EngineErrorCode.InvalidArg,\n });\n\n // 5. Detach -> inert again -> ordinary annotation delete succeeds.\n await doc.forms.detachWidget(field.field.ref, {\n annotObjectNumber: widgetRef.annotObjectNumber,\n pageObjectNumber: pon,\n });\n await page.annotations.delete(widgetRef);\n\n // The field survives, unplaced.\n const after = await doc.forms.get(field.field.ref);\n expect(after.widgets.length).toBe(0);\n } finally {\n await doc.close();\n }\n });\n\n test('createField composes styled widgets atomically', async () => {\n const doc = await open(opts.fixtures.toggleFields);\n const pon = opts.fixtures.toggleFields.pageObjectNumber;\n try {\n const created = await doc.forms.createField({\n family: 'radio',\n name: 'authored_radio',\n noToggleToOff: true,\n widgets: [\n {\n pageObjectNumber: pon,\n rect: { left: 20, bottom: 60, right: 40, top: 80 },\n onState: 'yes',\n appearance: { color: { r: 0, g: 0, b: 0 }, strokeWidth: 1 },\n },\n {\n pageObjectNumber: pon,\n rect: { left: 60, bottom: 60, right: 80, top: 80 },\n onState: 'no',\n },\n ],\n });\n if (created.field.family !== 'radio') throw new Error('expected radio');\n expect(created.field.noToggleToOff).toBe(true);\n expect(created.field.widgets.map((w) => w.onState)).toEqual(['yes', 'no']);\n\n // The newborn group fills through the normal value path.\n const filled = await doc.forms.setValue(created.field.ref, {\n type: 'toggle',\n state: 'yes',\n });\n if (filled.field.family !== 'radio') throw new Error('expected radio');\n expect(filled.field.value).toBe('yes');\n\n // updateField: rename + conflict validation.\n await doc.forms.updateField(created.field.ref, {\n family: 'radio',\n name: 'renamed_radio',\n });\n await expect(\n doc.forms.updateField(created.field.ref, { family: 'radio', name: 'unison_radio' }),\n ).rejects.toMatchObject({ code: EngineErrorCode.InvalidArg });\n\n // deleteField cascades: field gone AND its widgets gone.\n const before = await doc.page(pon).annotations.list();\n const removed = await doc.forms.deleteField(created.field.ref);\n expect(removed.removedWidgets.length).toBe(2);\n const after = await doc.page(pon).annotations.list();\n expect(after.annotations.length).toBe(before.annotations.length - 2);\n await expect(doc.forms.get({ kind: 'fqn', name: 'renamed_radio' })).rejects.toMatchObject({\n code: EngineErrorCode.NotFound,\n });\n } finally {\n await doc.close();\n }\n });\n\n test('unknown refs fail with NotFound', async () => {\n const doc = await open(opts.fixtures.toggleFields);\n try {\n await expect(doc.forms.get({ kind: 'fqn', name: 'no.such.field' })).rejects.toMatchObject({\n code: EngineErrorCode.NotFound,\n });\n } finally {\n await doc.close();\n }\n });\n });\n}\n","import type {\n ConformanceTestRunner,\n ConformanceFixture,\n ConformanceOptions,\n} from './runMetadataConformance';\nimport type { AnnotationAppearanceMode } from '../dto/AnnotationRender';\nimport type { DocumentHandle } from '../engine/DocumentHandle';\nimport type { Engine } from '../engine/Engine';\nimport type { AnnotationRef } from '../identity/AnnotationRef';\nimport { AbortError } from '../promise/AbortError';\nimport type { PageState } from '../revision/PageState';\n\n/**\n * Per-fixture knowledge for the annotation appearance conformance suite. The\n * harness asserts thresholds (not exact wire content) so the same suite runs\n * unchanged against the local and cloud engines and proves they emit the same\n * set of appearances — including weak (index-only) annotations.\n */\nexport interface AnnotationAppearanceConformanceFixture extends ConformanceFixture {\n /** PDF object number of the page whose appearances are rendered. */\n pageObjectNumber: number;\n /** At least this many `/AP` appearances are expected on that page. */\n minAppearanceCount: number;\n /**\n * `true` when the page has at least one weak (index-only) annotation that\n * carries an appearance stream. The whole point of this suite: that weak\n * appearance must still be emitted (it used to be dropped on the wire).\n */\n expectsWeakAppearance: boolean;\n}\n\nexport interface AnnotationAppearanceConformanceOptions extends Omit<\n ConformanceOptions,\n 'fixture'\n> {\n fixture: AnnotationAppearanceConformanceFixture;\n /**\n * `true` for engines that expose the raw RGBA rasters (`renderAppearances`).\n * The local engine's encoder needs a browser Canvas, so under node it can\n * only be exercised via the raw rasters; the cloud engine ships encoded\n * images (`renderAppearanceImages`) and leaves this `false`.\n */\n supportsRawRasters?: boolean;\n}\n\nconst PNG_SIGNATURE = [0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a];\n\ninterface NormalizedAppearance {\n ref: AnnotationRef;\n mode: AnnotationAppearanceMode;\n width: number;\n height: number;\n /** Raw RGBA bytes (raw-raster engines) or `null`. */\n raster: { data: ArrayBuffer; width: number; height: number; stride: number } | null;\n /** Encoded image bytes (image engines) or `null`. */\n encoded: Uint8Array | null;\n}\n\nexport function runAnnotationAppearanceConformance(\n runner: ConformanceTestRunner,\n opts: AnnotationAppearanceConformanceOptions,\n): void {\n const { describe, test, beforeAll, afterAll, expect } = runner;\n const useRaw = opts.supportsRawRasters === true;\n\n describe(`annotation appearance conformance: ${opts.label}`, () => {\n let engine: Engine;\n\n beforeAll(async () => {\n engine = await opts.makeEngine();\n });\n\n afterAll(async () => {\n if (engine) await engine.destroy();\n });\n\n test('renders the expected set of appearances with valid output', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const { pageState, appearances } = await collect(doc, opts, useRaw);\n\n expect(pageState.pageObjectNumber).toBe(opts.fixture.pageObjectNumber);\n expect(appearances.length >= opts.fixture.minAppearanceCount).toBe(true);\n\n for (const appearance of appearances) {\n // Identity is the ref (durable or weak) — never a stableId.\n expect(['objectNumber', 'nm', 'index'].includes(appearance.ref.kind)).toBe(true);\n expect(['normal', 'rollover', 'down'].includes(appearance.mode)).toBe(true);\n expect(appearance.width > 0 && appearance.height > 0).toBe(true);\n\n if (appearance.encoded) {\n // Encoded engines must ship real PNG bytes, not an empty part.\n expect(appearance.encoded.length > PNG_SIGNATURE.length).toBe(true);\n expect(PNG_SIGNATURE.every((b, i) => appearance.encoded![i] === b)).toBe(true);\n }\n }\n } finally {\n await doc.close();\n }\n });\n\n if (opts.fixture.expectsWeakAppearance) {\n test('weak (index-only) annotations are emitted, not dropped', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const { appearances } = await collect(doc, opts, useRaw);\n const weak = appearances.find((a) => a.ref.kind === 'index');\n expect(weak !== undefined).toBe(true);\n } finally {\n await doc.close();\n }\n });\n }\n\n if (useRaw) {\n test('rendered appearances are not blank (non-zero alpha)', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const { appearances } = await collect(doc, opts, useRaw);\n // Guards the blank-render regression: at least one appearance must\n // have a visible (non-transparent) pixel. Scanning the RGBA alpha\n // byte is decoder-free and unambiguous.\n const anyVisible = appearances.some((a) => a.raster !== null && hasOpaquePixel(a.raster));\n expect(anyVisible).toBe(true);\n } finally {\n await doc.close();\n }\n });\n }\n\n test('abort() rejects with AbortError', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const page = doc.page(opts.fixture.pageObjectNumber);\n const p = useRaw\n ? page.annotations.renderAppearances({ scale: 1 })\n : page.annotations.renderAppearanceImages({ format: 'png', scale: 1 });\n p.abort('test');\n await expect(p).rejects.toBeInstanceOf(AbortError);\n } finally {\n await doc.close();\n }\n });\n });\n}\n\nasync function collect(\n doc: DocumentHandle,\n opts: AnnotationAppearanceConformanceOptions,\n useRaw: boolean,\n): Promise<{ pageState: PageState; appearances: NormalizedAppearance[] }> {\n const page = doc.page(opts.fixture.pageObjectNumber);\n if (useRaw) {\n const result = await page.annotations.renderAppearances({ scale: 1 });\n return {\n pageState: result.pageState,\n appearances: result.appearances.map((a) => ({\n ref: a.ref,\n mode: a.mode,\n width: a.raster.width,\n height: a.raster.height,\n raster: a.raster,\n encoded: null,\n })),\n };\n }\n const result = await page.annotations.renderAppearanceImages({ format: 'png', scale: 1 });\n return {\n pageState: result.pageState,\n appearances: result.appearances.map((a) => ({\n ref: a.ref,\n mode: a.mode,\n width: a.image.width ?? 0,\n height: a.image.height ?? 0,\n raster: null,\n encoded: a.image.source.kind === 'bytes' ? a.image.source.bytes : new Uint8Array(),\n })),\n };\n}\n\nfunction hasOpaquePixel(raster: {\n data: ArrayBuffer;\n width: number;\n height: number;\n stride: number;\n}): boolean {\n const bytes = new Uint8Array(raster.data);\n for (let y = 0; y < raster.height; y++) {\n const row = y * raster.stride;\n for (let x = 0; x < raster.width; x++) {\n if (bytes[row + x * 4 + 3] !== 0) return true;\n }\n }\n return false;\n}\n\nasync function openFixture(engine: Engine, opts: AnnotationAppearanceConformanceOptions) {\n if (opts.openKind === 'bytes') {\n const bytes = await opts.fixture.bytes();\n return engine.open({ kind: 'bytes', id: opts.fixture.id, bytes });\n }\n return engine.open({ kind: 'id', id: opts.fixture.cloudId ?? opts.fixture.id });\n}\n","import type {\n ConformanceTestRunner,\n ConformanceFixture,\n ConformanceOptions,\n} from './runMetadataConformance';\nimport type { AnnotationPatch, HighlightDraft } from '../annotation/kinds';\nimport type { DocumentHandle } from '../engine/DocumentHandle';\nimport type { Engine } from '../engine/Engine';\nimport { EngineError } from '../errors/EngineError';\nimport { EngineErrorCode } from '../errors/EngineErrorCode';\nimport type { AnnotationRef } from '../identity/AnnotationRef';\nimport { AbortError } from '../promise/AbortError';\nimport { PageListSnapshotSchema, PageMoveResultSchema } from '../wire/schemas';\n\n/**\n * Per-fixture knowledge for the page-reorder suite. The test pages must\n * be addressable by indirect `pageObjectNumber` (every page in our\n * fixtures is). The fixture is expected to have at least 3 pages so the\n * harness can exercise reorder permutations meaningfully.\n */\nexport interface PageReorderConformanceFixture extends ConformanceFixture {\n /** Stable, durable PONs of (at least) three distinct pages. Order\n * here is the *intended caller-visible* order, not the on-disk\n * order; the suite reads `pages.list()` first and works in document\n * order. */\n ponsForReorderTest?: number[];\n /**\n * Page used for the weak-ref-survival assertion. Defaults to the\n * first PON in `ponsForReorderTest`. The fixture page must already\n * have at least one weak annotation (no /NM, direct object) so the\n * harness can capture an `index`-kind ref before the page move and\n * re-use it after.\n */\n weakRefHostPon?: number;\n /** Quad to use for the `create()` step that produces a stable ref\n * the suite uses. */\n createQuad?: HighlightDraft['quadPoints'];\n}\n\nexport interface PageReorderConformanceOptions extends Omit<ConformanceOptions, 'fixture'> {\n fixture: PageReorderConformanceFixture;\n}\n\nconst DEFAULT_QUAD: HighlightDraft['quadPoints'] = [\n {\n p1: { x: 50, y: 100 },\n p2: { x: 150, y: 100 },\n p3: { x: 50, y: 80 },\n p4: { x: 150, y: 80 },\n },\n];\n\n/**\n * Page reorder conformance suite. Verifies the architectural invariants\n * locked with the user, do NOT loosen these without re-reading\n * `PageMoveResult` and `DocumentPagesMutator`:\n *\n * 1. `pages.list()` returns every page in display order, addressed\n * by indirect `pageObjectNumber`.\n * 2. `pages.move()` returns the full new order + geometry via\n * `result.layout` (the same shape `pages.list()` returns). There is\n * no document-level revision; the wire never asks the caller for one.\n * 3. Index-based annotation refs survive a page reorder. This is the\n * whole reason per-page revisions stay put across a move: a user\n * shuffling pages mid-edit must not lose a pending highlight. (The\n * \"move never bumps a RevisionToken\" invariant is asserted directly\n * in the annotation mutation suite, where revision liveness lives.)\n * 4. Invalid inputs (duplicate PONs, unknown PONs, out-of-range\n * `destIndex`) reject with `InvalidArg`.\n * 5. Abort propagates as `AbortError`.\n *\n * Both local (worker host + WASM) and cloud (HTTP + @cloudpdf/server)\n * implementations must pass identically.\n */\nexport function runPageReorderConformance(\n runner: ConformanceTestRunner,\n opts: PageReorderConformanceOptions,\n): void {\n const { describe, test, beforeAll, afterAll, expect } = runner;\n const fix = opts.fixture;\n const quad = fix.createQuad ?? DEFAULT_QUAD;\n\n describe(`page reorder conformance: ${opts.label}`, () => {\n let engine: Engine;\n\n beforeAll(async () => {\n engine = await opts.makeEngine();\n });\n\n afterAll(async () => {\n if (engine) await engine.destroy();\n });\n\n test('pages.list() returns every page in display order, durable PONs only', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const list = await doc.pages.list();\n expect(PageListSnapshotSchema.safeParse(list).success).toBe(true);\n expect(list.pages.length >= 1).toBe(true);\n\n for (let i = 0; i < list.pages.length; i++) {\n // Strictly contiguous, 0..N-1.\n expect(list.pages[i].index).toBe(i);\n // Pages are durable by construction; PON > 0.\n expect(list.pages[i].pageObjectNumber > 0).toBe(true);\n }\n\n // PONs are unique across the document.\n const seen = new Set<number>();\n for (const p of list.pages) {\n expect(seen.has(p.pageObjectNumber)).toBe(false);\n seen.add(p.pageObjectNumber);\n }\n } finally {\n await doc.close();\n }\n });\n\n test('pages.move() reorders pages and returns the full post-move order', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const before = await doc.pages.list();\n if (before.pages.length < 3) return;\n const pons = pickReorderPons(\n before.pages.map((p) => p.pageObjectNumber),\n fix,\n );\n if (!pons) return;\n\n // Move the LAST of the three to the FRONT.\n const target = pons[pons.length - 1];\n const result = await doc.pages.move([target], 0);\n expect(PageMoveResultSchema.safeParse(result).success).toBe(true);\n\n // The result carries the new geometry: same count, contiguous\n // indices, moved page leads.\n const after = result.layout;\n expect(after.pages.length).toBe(before.pages.length);\n expect(after.pages[0].pageObjectNumber).toBe(target);\n for (let i = 0; i < after.pages.length; i++) {\n expect(after.pages[i].index).toBe(i);\n }\n\n // Set of PONs is preserved (no page lost or fabricated).\n const beforePons = new Set(before.pages.map((p) => p.pageObjectNumber));\n const afterPons = new Set(after.pages.map((p) => p.pageObjectNumber));\n expect(beforePons.size).toBe(afterPons.size);\n for (const pon of beforePons) expect(afterPons.has(pon)).toBe(true);\n\n // A subsequent `pages.list()` agrees with the returned layout\n // (the move result is not a one-off view).\n const relisted = await doc.pages.list();\n expect(relisted.pages.map((p) => p.pageObjectNumber)).toEqual(\n after.pages.map((p) => p.pageObjectNumber),\n );\n } finally {\n await doc.close();\n }\n });\n\n test('weak index-based annotation refs survive a page reorder', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const list = await doc.pages.list();\n if (list.pages.length < 2) return;\n\n // Pick a host page and create a fresh annotation we can address\n // by index after the move. The created annotation is durable\n // (so we use its index ref via FPDFPage_GetAnnot, which yields\n // a working index-style ref bound to the current revision).\n const hostPon = fix.weakRefHostPon ?? list.pages[0].pageObjectNumber;\n const hostPage = doc.page(hostPon);\n const beforePageList = await hostPage.annotations.list();\n\n const draft: HighlightDraft = {\n subtype: 'highlight',\n contents: 'page-reorder survives this',\n quadPoints: quad,\n };\n const created = await hostPage.annotations.create(draft);\n\n // Capture the *post-create* page state. Neither create\n // (append-only, non-invalidating) nor pages.move bumps the\n // host page's revision, so the revision we capture here is\n // the same one a fresh `list()` would return after the move.\n // We bind the index ref to that revision and use it as a\n // weak ref across the page reorder.\n const afterCreate = await hostPage.annotations.list();\n const targetIndex = afterCreate.annotations.findIndex(\n (a) =>\n a.ref.kind === 'objectNumber' &&\n created.created.ref.kind === 'objectNumber' &&\n a.ref.annotObjectNumber === created.created.ref.annotObjectNumber,\n );\n expect(targetIndex >= 0).toBe(true);\n\n const indexRef: AnnotationRef = {\n kind: 'index',\n pageObjectNumber: hostPon,\n index: targetIndex,\n revision: afterCreate.pageState.revision,\n };\n\n // Move some OTHER page (not the host page) to the front. The\n // host page's revision must stay put.\n const otherPon = list.pages.find((p) => p.pageObjectNumber !== hostPon)?.pageObjectNumber;\n if (otherPon === undefined) return;\n await doc.pages.move([otherPon], 0);\n\n // Use the captured weak-style ref to update the annotation.\n // This is the locked invariant: per-page RevisionToken survives\n // a page reorder, so an index ref captured before the move\n // remains valid after.\n const patch: AnnotationPatch = {\n subtype: 'highlight',\n contents: 'still alive',\n };\n const update = await hostPage.annotations.update(indexRef, patch);\n expect(update.updated.contents).toBe('still alive');\n\n // Also: the annotation index inside the host page is unchanged\n // (the host page's /Annots array was never touched).\n const afterMove = await hostPage.annotations.list();\n expect(afterMove.annotations.length).toBe(beforePageList.annotations.length + 1);\n } finally {\n await doc.close();\n }\n });\n\n test('pages.move() rejects duplicate PONs with InvalidArg', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const list = await doc.pages.list();\n if (list.pages.length < 1) return;\n const target = list.pages[0].pageObjectNumber;\n let caught: unknown;\n try {\n await doc.pages.move([target, target], 0);\n } catch (err) {\n caught = err;\n }\n expect(EngineError.is(caught, EngineErrorCode.InvalidArg)).toBe(true);\n } finally {\n await doc.close();\n }\n });\n\n test('pages.move() rejects out-of-range destIndex with InvalidArg', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const list = await doc.pages.list();\n if (list.pages.length < 1) return;\n const target = list.pages[0].pageObjectNumber;\n let caught: unknown;\n try {\n // Post-removal count is `pages.length - 1`; destIndex one past that\n // is out of range.\n await doc.pages.move([target], list.pages.length);\n } catch (err) {\n caught = err;\n }\n expect(EngineError.is(caught, EngineErrorCode.InvalidArg)).toBe(true);\n } finally {\n await doc.close();\n }\n });\n\n test('pages.move() rejects unknown PON with NotFound or InvalidArg', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const list = await doc.pages.list();\n // Pick a PON that is guaranteed to not exist.\n let bogus = 0;\n for (const p of list.pages) bogus = Math.max(bogus, p.pageObjectNumber);\n bogus += 9999;\n\n let caught: unknown;\n try {\n await doc.pages.move([bogus], 0);\n } catch (err) {\n caught = err;\n }\n expect(\n EngineError.is(caught, EngineErrorCode.NotFound) ||\n EngineError.is(caught, EngineErrorCode.InvalidArg),\n ).toBe(true);\n } finally {\n await doc.close();\n }\n });\n\n test('abort on pages.move() rejects with AbortError', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const list = await doc.pages.list();\n if (list.pages.length < 1) return;\n const target = list.pages[0].pageObjectNumber;\n const p = doc.pages.move([target], 0);\n p.abort('test');\n await expect(p).rejects.toBeInstanceOf(AbortError);\n } finally {\n await doc.close();\n }\n });\n });\n}\n\nasync function openFixture(\n engine: Engine,\n opts: PageReorderConformanceOptions,\n): Promise<DocumentHandle> {\n if (opts.openKind === 'bytes') {\n const bytes = await opts.fixture.bytes();\n return engine.open({ kind: 'bytes', id: opts.fixture.id, bytes });\n }\n return engine.open({ kind: 'id', id: opts.fixture.cloudId ?? opts.fixture.id });\n}\n\n/**\n * Choose three PONs to exercise reorder operations against. Prefers\n * the fixture-supplied ones, falls back to \"first three in document\n * order\" otherwise.\n */\nfunction pickReorderPons(\n documentPons: number[],\n fix: PageReorderConformanceFixture,\n): number[] | null {\n if (fix.ponsForReorderTest && fix.ponsForReorderTest.length >= 3) {\n return fix.ponsForReorderTest.slice(0, 3);\n }\n if (documentPons.length < 3) return null;\n return documentPons.slice(0, 3);\n}\n","import type { ConformanceTestRunner, ConformanceOptions } from './runMetadataConformance';\nimport type { AnnotationPatch, HighlightDraft } from '../annotation/kinds';\nimport type { DocumentHandle } from '../engine/DocumentHandle';\nimport type { Engine } from '../engine/Engine';\nimport { EngineError } from '../errors/EngineError';\nimport { EngineErrorCode } from '../errors/EngineErrorCode';\nimport type { AnnotationRef } from '../identity/AnnotationRef';\nimport { AbortError } from '../promise/AbortError';\nimport { PageRotateResultSchema } from '../wire/schemas';\n\nconst QUAD: HighlightDraft['quadPoints'] = [\n {\n p1: { x: 50, y: 100 },\n p2: { x: 150, y: 100 },\n p3: { x: 50, y: 80 },\n p4: { x: 150, y: 80 },\n },\n];\n\n/**\n * Page rotate conformance suite. Verifies the architectural invariants —\n * do NOT loosen these without re-reading `PageRotateResult`:\n *\n * 1. Rotation is ABSOLUTE and idempotent: `rotate(pons, 90)` twice is\n * `rotate(pons, 90)` once. The wire never speaks \"turn by\".\n * 2. Rotation is presentation metadata over NORMALIZED content: the\n * layout's `width`/`height` stay un-rotated, order and identity are\n * untouched, and per-page `RevisionToken`s survive (an index-based\n * annotation ref captured before the rotate works after it).\n * 3. The result returns the full new `layout`; a subsequent `list()`\n * agrees with it.\n * 4. Invalid inputs (bad rotation value, duplicate PONs, unknown PONs)\n * reject with `InvalidArg` / `NotFound`.\n * 5. Abort propagates as `AbortError`.\n *\n * Both local (worker host + WASM) and cloud (HTTP + @cloudpdf/server)\n * implementations must pass identically.\n */\nexport function runPageRotateConformance(\n runner: ConformanceTestRunner,\n opts: ConformanceOptions,\n): void {\n const { describe, test, beforeAll, afterAll, expect } = runner;\n\n describe(`page rotate conformance: ${opts.label}`, () => {\n let engine: Engine;\n\n beforeAll(async () => {\n engine = await opts.makeEngine();\n });\n\n afterAll(async () => {\n if (engine) await engine.destroy();\n });\n\n test('pages.rotate() sets the absolute rotation and returns the full layout', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const before = await doc.pages.list();\n const target = before.pages[0];\n\n const result = await doc.pages.rotate([target.pageObjectNumber], 90);\n expect(PageRotateResultSchema.safeParse(result).success).toBe(true);\n\n const after = result.layout;\n const rotated = after.pages.find((p) => p.pageObjectNumber === target.pageObjectNumber);\n expect(rotated?.rotation).toBe(90);\n\n // Presentation metadata only: un-rotated dims, order, and the PON\n // set are all untouched.\n expect(rotated?.size.width).toBe(target.size.width);\n expect(rotated?.size.height).toBe(target.size.height);\n expect(after.pages.map((p) => p.pageObjectNumber)).toEqual(\n before.pages.map((p) => p.pageObjectNumber),\n );\n\n // A subsequent list() agrees (the result is not a one-off view).\n const relisted = await doc.pages.list();\n expect(\n relisted.pages.find((p) => p.pageObjectNumber === target.pageObjectNumber)?.rotation,\n ).toBe(90);\n } finally {\n await doc.close();\n }\n });\n\n test('absolute rotation is idempotent: setting the same value twice is a no-op', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const list = await doc.pages.list();\n const pon = list.pages[0].pageObjectNumber;\n const first = await doc.pages.rotate([pon], 180);\n const second = await doc.pages.rotate([pon], 180);\n expect(second.layout.pages.map((p) => [p.pageObjectNumber, p.rotation])).toEqual(\n first.layout.pages.map((p) => [p.pageObjectNumber, p.rotation]),\n );\n } finally {\n await doc.close();\n }\n });\n\n test('one rotation applies to EVERY listed page (the multi-select gesture)', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const list = await doc.pages.list();\n if (list.pages.length < 2) return;\n const pons = list.pages.slice(0, 2).map((p) => p.pageObjectNumber);\n const result = await doc.pages.rotate(pons, 270);\n for (const pon of pons) {\n expect(result.layout.pages.find((p) => p.pageObjectNumber === pon)?.rotation).toBe(270);\n }\n } finally {\n await doc.close();\n }\n });\n\n test('weak index-based annotation refs survive a rotate (no revision bump)', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const list = await doc.pages.list();\n const hostPon = list.pages[0].pageObjectNumber;\n const hostPage = doc.page(hostPon);\n\n const draft: HighlightDraft = {\n subtype: 'highlight',\n contents: 'rotate survives this',\n quadPoints: QUAD,\n };\n const created = await hostPage.annotations.create(draft);\n const afterCreate = await hostPage.annotations.list();\n const targetIndex = afterCreate.annotations.findIndex(\n (a) =>\n a.ref.kind === 'objectNumber' &&\n created.created.ref.kind === 'objectNumber' &&\n a.ref.annotObjectNumber === created.created.ref.annotObjectNumber,\n );\n expect(targetIndex >= 0).toBe(true);\n\n const indexRef: AnnotationRef = {\n kind: 'index',\n pageObjectNumber: hostPon,\n index: targetIndex,\n revision: afterCreate.pageState.revision,\n };\n\n // Rotate the HOST page itself — the strongest version of the\n // invariant: even the rotated page's revision stays put.\n await doc.pages.rotate([hostPon], 90);\n\n const patch: AnnotationPatch = { subtype: 'highlight', contents: 'still alive' };\n const update = await hostPage.annotations.update(indexRef, patch);\n expect(update.updated.contents).toBe('still alive');\n } finally {\n await doc.close();\n }\n });\n\n test('pages.rotate() rejects an invalid rotation value with InvalidArg', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const list = await doc.pages.list();\n const pon = list.pages[0].pageObjectNumber;\n let caught: unknown;\n try {\n // 45 is not a legal /Rotate value; the type forbids it, the wire\n // must too.\n await doc.pages.rotate([pon], 45 as never);\n } catch (err) {\n caught = err;\n }\n expect(EngineError.is(caught, EngineErrorCode.InvalidArg)).toBe(true);\n } finally {\n await doc.close();\n }\n });\n\n test('pages.rotate() rejects duplicate PONs with InvalidArg', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const list = await doc.pages.list();\n const pon = list.pages[0].pageObjectNumber;\n let caught: unknown;\n try {\n await doc.pages.rotate([pon, pon], 90);\n } catch (err) {\n caught = err;\n }\n expect(EngineError.is(caught, EngineErrorCode.InvalidArg)).toBe(true);\n } finally {\n await doc.close();\n }\n });\n\n test('pages.rotate() rejects unknown PON with NotFound or InvalidArg', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const list = await doc.pages.list();\n let bogus = 0;\n for (const p of list.pages) bogus = Math.max(bogus, p.pageObjectNumber);\n bogus += 9999;\n\n let caught: unknown;\n try {\n await doc.pages.rotate([bogus], 90);\n } catch (err) {\n caught = err;\n }\n expect(\n EngineError.is(caught, EngineErrorCode.NotFound) ||\n EngineError.is(caught, EngineErrorCode.InvalidArg),\n ).toBe(true);\n } finally {\n await doc.close();\n }\n });\n\n test('abort on pages.rotate() rejects with AbortError', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const list = await doc.pages.list();\n const pon = list.pages[0].pageObjectNumber;\n const p = doc.pages.rotate([pon], 90);\n p.abort('test');\n await expect(p).rejects.toBeInstanceOf(AbortError);\n } finally {\n await doc.close();\n }\n });\n });\n}\n\nasync function openFixture(engine: Engine, opts: ConformanceOptions): Promise<DocumentHandle> {\n if (opts.openKind === 'bytes') {\n const bytes = await opts.fixture.bytes();\n return engine.open({ kind: 'bytes', id: opts.fixture.id, bytes });\n }\n return engine.open({ kind: 'id', id: opts.fixture.cloudId ?? opts.fixture.id });\n}\n","import type { ConformanceTestRunner, ConformanceOptions } from './runMetadataConformance';\nimport type { AnnotationPatch, HighlightDraft } from '../annotation/kinds';\nimport type { DocumentHandle } from '../engine/DocumentHandle';\nimport type { Engine } from '../engine/Engine';\nimport { EngineError } from '../errors/EngineError';\nimport { EngineErrorCode } from '../errors/EngineErrorCode';\nimport type { AnnotationRef } from '../identity/AnnotationRef';\nimport { AbortError } from '../promise/AbortError';\nimport { PageDeleteResultSchema } from '../wire/schemas';\n\nconst QUAD: HighlightDraft['quadPoints'] = [\n {\n p1: { x: 50, y: 100 },\n p2: { x: 150, y: 100 },\n p3: { x: 50, y: 80 },\n p4: { x: 150, y: 80 },\n },\n];\n\n/**\n * Page delete conformance suite. Verifies the architectural invariants —\n * do NOT loosen these without re-reading `PageDeleteResult`:\n *\n * 1. `pages.delete()` removes exactly the listed pages and returns the\n * full surviving layout; a subsequent `list()` agrees.\n * 2. Deleted PONs are RETIRED: addressing a deleted page afterwards is a\n * clean `NotFound` (an API-level error, never native-memory danger).\n * 3. SURVIVING pages keep identity and `RevisionToken`s — an index-based\n * annotation ref on an unrelated page survives a neighbour's deletion.\n * 4. Deleting every page is rejected (`InvalidArg`) — a document keeps at\n * least one page.\n * 5. Duplicate / unknown PONs reject with `InvalidArg` / `NotFound`;\n * abort propagates as `AbortError`.\n *\n * Both local (worker host + WASM) and cloud (HTTP + @cloudpdf/server)\n * implementations must pass identically.\n */\nexport function runPageDeleteConformance(\n runner: ConformanceTestRunner,\n opts: ConformanceOptions,\n): void {\n const { describe, test, beforeAll, afterAll, expect } = runner;\n\n describe(`page delete conformance: ${opts.label}`, () => {\n let engine: Engine;\n\n beforeAll(async () => {\n engine = await opts.makeEngine();\n });\n\n afterAll(async () => {\n if (engine) await engine.destroy();\n });\n\n test('pages.delete() removes the page and returns the surviving layout', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const before = await doc.pages.list();\n if (before.pages.length < 2) return;\n const victim = before.pages[1].pageObjectNumber;\n\n const result = await doc.pages.delete([victim]);\n expect(PageDeleteResultSchema.safeParse(result).success).toBe(true);\n\n const after = result.layout;\n expect(after.pages.length).toBe(before.pages.length - 1);\n expect(after.pageCount).toBe(before.pageCount - 1);\n expect(after.pages.some((p) => p.pageObjectNumber === victim)).toBe(false);\n\n // Survivors keep their relative order, contiguous 0..N-1 indices.\n const expectedOrder = before.pages\n .map((p) => p.pageObjectNumber)\n .filter((pon) => pon !== victim);\n expect(after.pages.map((p) => p.pageObjectNumber)).toEqual(expectedOrder);\n for (let i = 0; i < after.pages.length; i++) {\n expect(after.pages[i].index).toBe(i);\n }\n\n // A subsequent list() agrees (the result is not a one-off view).\n const relisted = await doc.pages.list();\n expect(relisted.pages.map((p) => p.pageObjectNumber)).toEqual(expectedOrder);\n } finally {\n await doc.close();\n }\n });\n\n test('addressing a deleted page afterwards is a clean NotFound', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const before = await doc.pages.list();\n if (before.pages.length < 2) return;\n const victim = before.pages[1].pageObjectNumber;\n await doc.pages.delete([victim]);\n\n let caught: unknown;\n try {\n await doc.page(victim).annotations.list();\n } catch (err) {\n caught = err;\n }\n expect(EngineError.is(caught, EngineErrorCode.NotFound)).toBe(true);\n } finally {\n await doc.close();\n }\n });\n\n test('surviving pages keep their weak index-based annotation refs', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const list = await doc.pages.list();\n if (list.pages.length < 2) return;\n\n const hostPon = list.pages[0].pageObjectNumber;\n const victimPon = list.pages[1].pageObjectNumber;\n const hostPage = doc.page(hostPon);\n\n const draft: HighlightDraft = {\n subtype: 'highlight',\n contents: 'neighbour deletion survives this',\n quadPoints: QUAD,\n };\n const created = await hostPage.annotations.create(draft);\n const afterCreate = await hostPage.annotations.list();\n const targetIndex = afterCreate.annotations.findIndex(\n (a) =>\n a.ref.kind === 'objectNumber' &&\n created.created.ref.kind === 'objectNumber' &&\n a.ref.annotObjectNumber === created.created.ref.annotObjectNumber,\n );\n expect(targetIndex >= 0).toBe(true);\n\n const indexRef: AnnotationRef = {\n kind: 'index',\n pageObjectNumber: hostPon,\n index: targetIndex,\n revision: afterCreate.pageState.revision,\n };\n\n await doc.pages.delete([victimPon]);\n\n const patch: AnnotationPatch = { subtype: 'highlight', contents: 'still alive' };\n const update = await hostPage.annotations.update(indexRef, patch);\n expect(update.updated.contents).toBe('still alive');\n } finally {\n await doc.close();\n }\n });\n\n test('deleting EVERY page is rejected with InvalidArg', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const list = await doc.pages.list();\n let caught: unknown;\n try {\n await doc.pages.delete(list.pages.map((p) => p.pageObjectNumber));\n } catch (err) {\n caught = err;\n }\n expect(EngineError.is(caught, EngineErrorCode.InvalidArg)).toBe(true);\n } finally {\n await doc.close();\n }\n });\n\n test('pages.delete() rejects duplicate PONs with InvalidArg', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const list = await doc.pages.list();\n const pon = list.pages[0].pageObjectNumber;\n let caught: unknown;\n try {\n await doc.pages.delete([pon, pon]);\n } catch (err) {\n caught = err;\n }\n expect(EngineError.is(caught, EngineErrorCode.InvalidArg)).toBe(true);\n } finally {\n await doc.close();\n }\n });\n\n test('pages.delete() rejects unknown PON with NotFound or InvalidArg', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const list = await doc.pages.list();\n let bogus = 0;\n for (const p of list.pages) bogus = Math.max(bogus, p.pageObjectNumber);\n bogus += 9999;\n\n let caught: unknown;\n try {\n await doc.pages.delete([bogus]);\n } catch (err) {\n caught = err;\n }\n expect(\n EngineError.is(caught, EngineErrorCode.NotFound) ||\n EngineError.is(caught, EngineErrorCode.InvalidArg),\n ).toBe(true);\n } finally {\n await doc.close();\n }\n });\n\n test('abort on pages.delete() rejects with AbortError', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const list = await doc.pages.list();\n if (list.pages.length < 2) return;\n const pon = list.pages[1].pageObjectNumber;\n const p = doc.pages.delete([pon]);\n p.abort('test');\n await expect(p).rejects.toBeInstanceOf(AbortError);\n } finally {\n await doc.close();\n }\n });\n });\n}\n\nasync function openFixture(engine: Engine, opts: ConformanceOptions): Promise<DocumentHandle> {\n if (opts.openKind === 'bytes') {\n const bytes = await opts.fixture.bytes();\n return engine.open({ kind: 'bytes', id: opts.fixture.id, bytes });\n }\n return engine.open({ kind: 'id', id: opts.fixture.cloudId ?? opts.fixture.id });\n}\n","import type { ConformanceTestRunner, ConformanceOptions } from './runMetadataConformance';\nimport type { DocumentHandle } from '../engine/DocumentHandle';\nimport type { Engine } from '../engine/Engine';\nimport { EngineError } from '../errors/EngineError';\nimport { EngineErrorCode } from '../errors/EngineErrorCode';\nimport { AbortError } from '../promise/AbortError';\nimport { PageListSnapshotSchema, PageNameResultSchema } from '../wire/schemas';\n\n/**\n * Named-pages conformance: the catalog's `/Names /Pages` registry as LAYOUT\n * data. Locks the invariants both engines must share — do not loosen\n * without re-reading `NamedPageEntry` and `PageNameResult`:\n *\n * 1. `pages.list().namedPages` is present (possibly empty) and every\n * registration resolves to a page in `pages`, a template, or is\n * reported dangling — never silently dropped.\n * 2. `pages.setName()` creates or replaces by decoded key (idempotent),\n * `replace` renames in one job, and the result IS the new layout.\n * 3. `pages.removeName()` drops the registration and nothing else.\n * 4. Deleting a page removes every registration pointing at it — inside\n * the delete, with no plugin in the loop.\n * 5. Non-ASCII keys round-trip unchanged (Acrobat writes UTF-16 + BOM).\n *\n * Skips cleanly when the engine does not implement the optional members.\n */\nexport function runNamedPagesConformance(\n runner: ConformanceTestRunner,\n opts: ConformanceOptions,\n): void {\n const { describe, test, beforeAll, afterAll, expect } = runner;\n\n describe(`named pages conformance: ${opts.label}`, () => {\n let engine: Engine;\n\n beforeAll(async () => {\n engine = await opts.makeEngine();\n });\n\n afterAll(async () => {\n if (engine) await engine.destroy();\n });\n\n test('pages.list() carries namedPages and every entry resolves', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const layout = await doc.pages.list();\n PageListSnapshotSchema.parse(layout);\n expect(Array.isArray(layout.namedPages)).toBe(true);\n const pons = new Set(layout.pages.map((page) => page.pageObjectNumber));\n for (const entry of layout.namedPages ?? []) {\n expect(entry.name.length > 0).toBe(true);\n if (entry.target.kind === 'page') {\n expect(pons.has(entry.target.pageObjectNumber)).toBe(true);\n }\n }\n } finally {\n await doc.close();\n }\n });\n\n test('pages.setName() registers, replaces by key, and renames via `replace`', async () => {\n const doc = await openFixture(engine, opts);\n try {\n if (!doc.pages.setName) return;\n const before = await doc.pages.list();\n const [first, second] = before.pages;\n const baseline = (before.namedPages ?? []).length;\n\n // Create.\n const created = await doc.pages.setName({\n name: 'Approved=Goedgekeurd',\n pageObjectNumber: first.pageObjectNumber,\n });\n PageNameResultSchema.parse(created);\n expect(created.layout.pages.length).toBe(before.pages.length);\n expect(find(created, 'Approved=Goedgekeurd')).toEqual({\n kind: 'page',\n pageObjectNumber: first.pageObjectNumber,\n });\n expect((created.layout.namedPages ?? []).length).toBe(baseline + 1);\n if (created.cache) {\n expect(created.cache.docVersion > created.cache.previousDocVersion).toBe(true);\n expect(created.cache.layoutVersion > 0).toBe(true);\n }\n\n // The result IS the new layout.\n const listed = await doc.pages.list();\n expect(listed.namedPages).toEqual(created.layout.namedPages);\n\n // Replace by key: still one entry, now pointing at the second page.\n const replaced = await doc.pages.setName({\n name: 'Approved=Goedgekeurd',\n pageObjectNumber: second.pageObjectNumber,\n });\n expect(find(replaced, 'Approved=Goedgekeurd')).toEqual({\n kind: 'page',\n pageObjectNumber: second.pageObjectNumber,\n });\n expect((replaced.layout.namedPages ?? []).length).toBe(baseline + 1);\n\n // Rename in one job.\n const renamed = await doc.pages.setName({\n name: 'Approved=Approved',\n pageObjectNumber: second.pageObjectNumber,\n replace: 'Approved=Goedgekeurd',\n });\n expect(find(renamed, 'Approved=Goedgekeurd')).toBe(undefined);\n expect(find(renamed, 'Approved=Approved')).toEqual({\n kind: 'page',\n pageObjectNumber: second.pageObjectNumber,\n });\n expect((renamed.layout.namedPages ?? []).length).toBe(baseline + 1);\n } finally {\n await doc.close();\n }\n });\n\n test('non-ASCII keys round-trip through set → list', async () => {\n const doc = await openFixture(engine, opts);\n try {\n if (!doc.pages.setName) return;\n const before = await doc.pages.list();\n const key = 'Stämpel=Stämpel 日本';\n const result = await doc.pages.setName({\n name: key,\n pageObjectNumber: before.pages[0].pageObjectNumber,\n });\n expect(find(result, key)).toEqual({\n kind: 'page',\n pageObjectNumber: before.pages[0].pageObjectNumber,\n });\n const listed = await doc.pages.list();\n expect((listed.namedPages ?? []).some((entry) => entry.name === key)).toBe(true);\n } finally {\n await doc.close();\n }\n });\n\n test('pages.removeName() drops the registration and keeps the page', async () => {\n const doc = await openFixture(engine, opts);\n try {\n if (!doc.pages.setName || !doc.pages.removeName) return;\n const before = await doc.pages.list();\n await doc.pages.setName({\n name: 'Draft=Concept',\n pageObjectNumber: before.pages[0].pageObjectNumber,\n });\n const removed = await doc.pages.removeName({ name: 'Draft=Concept' });\n PageNameResultSchema.parse(removed);\n expect(find(removed, 'Draft=Concept')).toBe(undefined);\n expect(removed.layout.pages.length).toBe(before.pages.length);\n\n await expect(doc.pages.removeName({ name: 'Draft=Concept' })).rejects.toMatchObject({\n code: EngineErrorCode.NotFound,\n });\n } finally {\n await doc.close();\n }\n });\n\n test('pages.setName() rejects an empty name and an unknown page', async () => {\n const doc = await openFixture(engine, opts);\n try {\n if (!doc.pages.setName) return;\n const before = await doc.pages.list();\n await expect(\n doc.pages.setName({ name: '', pageObjectNumber: before.pages[0].pageObjectNumber }),\n ).rejects.toMatchObject({ code: EngineErrorCode.InvalidArg });\n let unknownPage: unknown = null;\n try {\n await doc.pages.setName({ name: 'Ghost=Ghost', pageObjectNumber: 987654321 });\n } catch (error) {\n unknownPage = error;\n }\n expect(\n EngineError.is(unknownPage, EngineErrorCode.NotFound) ||\n EngineError.is(unknownPage, EngineErrorCode.InvalidArg),\n ).toBe(true);\n } finally {\n await doc.close();\n }\n });\n\n test('deleting a page removes every registration pointing at it', async () => {\n const doc = await openFixture(engine, opts);\n try {\n if (!doc.pages.setName) return;\n const before = await doc.pages.list();\n if (before.pages.length < 2) return;\n const victim = before.pages[1].pageObjectNumber;\n const survivor = before.pages[0].pageObjectNumber;\n await doc.pages.setName({ name: 'Victim=One', pageObjectNumber: victim });\n await doc.pages.setName({ name: 'Victim=Two', pageObjectNumber: victim });\n await doc.pages.setName({ name: 'Survivor', pageObjectNumber: survivor });\n\n const deleted = await doc.pages.delete([victim]);\n const names = (deleted.layout.namedPages ?? []).map((entry) => entry.name);\n expect(names.includes('Victim=One')).toBe(false);\n expect(names.includes('Victim=Two')).toBe(false);\n expect(names).toContain('Survivor');\n // Nothing dangling was left behind by the delete.\n expect(\n (deleted.layout.namedPages ?? []).some((entry) => entry.target.kind === 'dangling'),\n ).toBe(false);\n } finally {\n await doc.close();\n }\n });\n\n test('abort on pages.setName() rejects with AbortError', async () => {\n const doc = await openFixture(engine, opts);\n try {\n if (!doc.pages.setName) return;\n const before = await doc.pages.list();\n const promise = doc.pages.setName({\n name: 'Aborted=Aborted',\n pageObjectNumber: before.pages[0].pageObjectNumber,\n });\n promise.abort();\n await expect(promise).rejects.toBeInstanceOf(AbortError);\n } finally {\n await doc.close();\n }\n });\n });\n}\n\nfunction find(\n result: { layout: { namedPages?: { name: string; target: unknown }[] } },\n name: string,\n) {\n return (result.layout.namedPages ?? []).find((entry) => entry.name === name)?.target;\n}\n\nasync function openFixture(engine: Engine, opts: ConformanceOptions): Promise<DocumentHandle> {\n if (opts.openKind === 'bytes') {\n const bytes = await opts.fixture.bytes();\n return engine.open({ kind: 'bytes', id: opts.fixture.id, bytes });\n }\n return engine.open({ kind: 'id', id: opts.fixture.cloudId ?? opts.fixture.id });\n}\n","import type { ConformanceTestRunner, ConformanceOptions } from './runMetadataConformance';\nimport type { SquareDraft } from '../annotation/kinds';\nimport type { DocumentHandle } from '../engine/DocumentHandle';\nimport type { Engine } from '../engine/Engine';\nimport { EngineError } from '../errors/EngineError';\nimport { EngineErrorCode } from '../errors/EngineErrorCode';\nimport type { DocumentEvent } from '../events/DocumentEvent';\nimport type { AnnotationRef } from '../identity/AnnotationRef';\nimport { AnnotationFlattenResultSchema } from '../wire/schemas';\n\nconst square = (left: number, bottom: number): SquareDraft => ({\n subtype: 'square',\n rect: { left, bottom, right: left + 40, top: bottom + 40 },\n color: { r: 20, g: 40, b: 220 },\n strokeWidth: 2,\n});\n\n/**\n * Selective annotation flatten: `page(pon).annotations.flatten(refs)` is\n * `pages.flatten` for a chosen set. Locks, on every engine:\n * 1. only the given refs are painted and removed; the rest of the page's\n * annotations are untouched;\n * 2. per-ref status (`applied` / `skipped`), one `annotations.flattened`\n * event, a `meta` with that page's new pins, layout unchanged;\n * 3. a hidden ref is `skipped`; a ref on another page rejects `InvalidArg`\n * with nothing mutated.\n * Skips cleanly when the engine does not implement the optional member.\n */\nexport function runAnnotationFlattenConformance(\n runner: ConformanceTestRunner,\n opts: ConformanceOptions,\n): void {\n const { describe, test, beforeAll, afterAll, expect } = runner;\n\n describe(`annotation flatten conformance: ${opts.label}`, () => {\n let engine: Engine;\n\n beforeAll(async () => {\n engine = await opts.makeEngine();\n });\n\n afterAll(async () => {\n if (engine) await engine.destroy();\n });\n\n test('flattens exactly the given refs and reports per-ref status', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const layoutBefore = await doc.pages.list();\n const pon = layoutBefore.pages[0].pageObjectNumber;\n const page = doc.page(pon);\n if (!page.annotations.flatten) return;\n\n const a = (await page.annotations.create(square(20, 20))).created.ref;\n const b = (await page.annotations.create(square(80, 20))).created.ref;\n const c = (await page.annotations.create(square(140, 20))).created.ref;\n // Hide `c` — ineligible for display flatten, so it must be skipped.\n await page.annotations.update(c, { subtype: 'square', flags: { hidden: true } });\n const before = await page.annotations.list();\n\n const events: DocumentEvent[] = [];\n const unsubscribe = doc.events.subscribe((event) => {\n if (event.type === 'annotations.flattened') events.push(event);\n });\n const result = await page.annotations.flatten([a, c], 'display');\n unsubscribe();\n\n expect(AnnotationFlattenResultSchema.safeParse(result).success).toBe(true);\n expect(result.pageObjectNumber).toBe(pon);\n expect(result.usage).toBe('display');\n expect(result.results.map((item) => item.status)).toEqual(['applied', 'skipped']);\n expect(result.meta === null).toBe(false);\n expect(events).toHaveLength(1);\n\n // Layout untouched; `a` gone, `b` and `c` still there.\n expect(await doc.pages.list()).toEqual(layoutBefore);\n const after = await page.annotations.list();\n expect(after.annotations.length).toBe(before.annotations.length - 1);\n expect(after.annotations.some((dto) => sameRef(dto.ref, b))).toBe(true);\n expect(after.annotations.some((dto) => sameRef(dto.ref, c))).toBe(true);\n expect(after.annotations.some((dto) => sameRef(dto.ref, a))).toBe(false);\n expect(after.pageState.revision.generation > before.pageState.revision.generation).toBe(\n true,\n );\n } finally {\n await doc.close();\n }\n });\n\n test('a ref on another page rejects InvalidArg and mutates nothing', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const layout = await doc.pages.list();\n if (layout.pages.length < 2) return;\n const page0 = doc.page(layout.pages[0].pageObjectNumber);\n const page1 = doc.page(layout.pages[1].pageObjectNumber);\n if (!page0.annotations.flatten) return;\n const own = (await page0.annotations.create(square(20, 100))).created.ref;\n const foreign = (await page1.annotations.create(square(20, 100))).created.ref;\n const countBefore = (await page0.annotations.list()).annotations.length;\n\n await expect(page0.annotations.flatten([own, foreign])).rejects.toMatchObject({\n code: EngineErrorCode.InvalidArg,\n });\n expect((await page0.annotations.list()).annotations.length).toBe(countBefore);\n } finally {\n await doc.close();\n }\n });\n\n test('an empty ref list rejects InvalidArg; an unknown ref rejects', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const pon = (await doc.pages.list()).pages[0].pageObjectNumber;\n const page = doc.page(pon);\n if (!page.annotations.flatten) return;\n await expect(page.annotations.flatten([])).rejects.toMatchObject({\n code: EngineErrorCode.InvalidArg,\n });\n let unknown: unknown = null;\n try {\n await page.annotations.flatten([\n { kind: 'objectNumber', pageObjectNumber: pon, annotObjectNumber: 987654321 },\n ]);\n } catch (error) {\n unknown = error;\n }\n expect(\n EngineError.is(unknown, EngineErrorCode.NotFound) ||\n EngineError.is(unknown, EngineErrorCode.InvalidArg) ||\n EngineError.is(unknown, EngineErrorCode.InvalidReference),\n ).toBe(true);\n } finally {\n await doc.close();\n }\n });\n });\n}\n\nfunction sameRef(left: AnnotationRef, right: AnnotationRef): boolean {\n if (left.kind === 'objectNumber' && right.kind === 'objectNumber') {\n return left.annotObjectNumber === right.annotObjectNumber;\n }\n return JSON.stringify(left) === JSON.stringify(right);\n}\n\nasync function openFixture(engine: Engine, opts: ConformanceOptions): Promise<DocumentHandle> {\n if (opts.openKind === 'bytes') {\n return engine.open({ kind: 'bytes', id: opts.fixture.id, bytes: await opts.fixture.bytes() });\n }\n return engine.open({ kind: 'id', id: opts.fixture.cloudId ?? opts.fixture.id });\n}\n","import type { ConformanceTestRunner, ConformanceOptions } from './runMetadataConformance';\nimport type { SquareDraft } from '../annotation/kinds';\nimport type { DocumentHandle } from '../engine/DocumentHandle';\nimport type { Engine } from '../engine/Engine';\nimport { EngineErrorCode } from '../errors/EngineErrorCode';\n\nconst PDF_MAGIC = [0x25, 0x50, 0x44, 0x46]; // %PDF\n\nconst square = (left: number, bottom: number, size = 40): SquareDraft => ({\n subtype: 'square',\n rect: { left, bottom, right: left + size, top: bottom + size },\n color: { r: 220, g: 20, b: 20 },\n strokeWidth: 2,\n});\n\n/**\n * `page(pon).annotations.exportAppearance(refs)`: the chosen annotations'\n * appearances as ONE single-page PDF sized to their union /Rect. Locks:\n * 1. bytes are a PDF; the source page is untouched (no mutation, no\n * revision bump);\n * 2. re-opened (local engines), the page is exactly the union size and the\n * requested count of annotations is gone — they are content now;\n * 3. a ref on another page rejects `InvalidArg`; an empty list rejects.\n * Skips cleanly when the engine does not implement the optional member.\n */\nexport function runAnnotationAppearanceExportConformance(\n runner: ConformanceTestRunner,\n opts: ConformanceOptions,\n): void {\n const { describe, test, beforeAll, afterAll, expect } = runner;\n\n describe(`annotation appearance export conformance: ${opts.label}`, () => {\n let engine: Engine;\n\n beforeAll(async () => {\n engine = await opts.makeEngine();\n });\n\n afterAll(async () => {\n if (engine) await engine.destroy();\n });\n\n test('returns a single-page PDF sized to the union rect; source untouched', async () => {\n const doc = await openFixture(engine, opts);\n let exported: DocumentHandle | null = null;\n try {\n const pon = (await doc.pages.list()).pages[0].pageObjectNumber;\n const page = doc.page(pon);\n if (!page.annotations.exportAppearance) return;\n const a = (await page.annotations.create(square(20, 20))).created.ref;\n const b = (await page.annotations.create(square(100, 60, 30))).created.ref;\n const before = await page.annotations.list();\n\n const bytes = await page.annotations.exportAppearance([a, b]);\n expect(bytes.length > 4).toBe(true);\n expect([...bytes.subarray(0, 4)]).toEqual(PDF_MAGIC);\n\n const after = await page.annotations.list();\n expect(after.annotations.length).toBe(before.annotations.length);\n expect(after.pageState.revision.generation).toBe(before.pageState.revision.generation);\n\n if (opts.openKind !== 'bytes') return;\n exported = await engine.open({ kind: 'bytes', id: `${opts.fixture.id}-appearance`, bytes });\n const layout = await exported.pages.list();\n expect(layout.pageCount).toBe(1);\n // Union of [20..60]×[20..60] and [100..130]×[60..90] → 110 × 70.\n expect(Math.round(layout.pages[0].size.width)).toBe(110);\n expect(Math.round(layout.pages[0].size.height)).toBe(70);\n const exportedPage = exported.page(layout.pages[0].pageObjectNumber);\n expect((await exportedPage.annotations.list()).annotations).toHaveLength(0);\n } finally {\n if (exported) await exported.close();\n await doc.close();\n }\n });\n\n test('a ref on another page and an empty list reject InvalidArg', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const layout = await doc.pages.list();\n const page0 = doc.page(layout.pages[0].pageObjectNumber);\n if (!page0.annotations.exportAppearance) return;\n await expect(page0.annotations.exportAppearance([])).rejects.toMatchObject({\n code: EngineErrorCode.InvalidArg,\n });\n if (layout.pages.length < 2) return;\n const page1 = doc.page(layout.pages[1].pageObjectNumber);\n const own = (await page0.annotations.create(square(20, 100))).created.ref;\n const foreign = (await page1.annotations.create(square(20, 100))).created.ref;\n await expect(page0.annotations.exportAppearance([own, foreign])).rejects.toMatchObject({\n code: EngineErrorCode.InvalidArg,\n });\n } finally {\n await doc.close();\n }\n });\n });\n}\n\nasync function openFixture(engine: Engine, opts: ConformanceOptions): Promise<DocumentHandle> {\n if (opts.openKind === 'bytes') {\n return engine.open({ kind: 'bytes', id: opts.fixture.id, bytes: await opts.fixture.bytes() });\n }\n return engine.open({ kind: 'id', id: opts.fixture.cloudId ?? opts.fixture.id });\n}\n","import type { DocumentEvent } from '../events/DocumentEvent';\nimport type { DocumentHandle } from '../engine/DocumentHandle';\nimport type { Engine } from '../engine/Engine';\nimport { EngineErrorCode } from '../errors/EngineErrorCode';\nimport { PageFlattenResultSchema } from '../wire/schemas';\nimport type { ConformanceOptions, ConformanceTestRunner } from './runMetadataConformance';\n\n/** Transport-neutral coverage for the content + annotation flatten rail. */\nexport function runPageFlattenConformance(\n runner: ConformanceTestRunner,\n opts: ConformanceOptions,\n): void {\n const { describe, test, beforeAll, afterAll, expect } = runner;\n\n describe(`page flatten conformance: ${opts.label}`, () => {\n let engine: Engine;\n\n beforeAll(async () => {\n engine = await opts.makeEngine();\n });\n\n afterAll(async () => {\n if (engine) await engine.destroy();\n });\n\n test('flattens eligible appearances once without changing layout', async () => {\n const doc = await openFixture(engine, opts);\n try {\n if (!doc.pages.flatten) return;\n const layoutBefore = await doc.pages.list();\n const pageObjectNumber = layoutBefore.pages[0].pageObjectNumber;\n const annotationsBefore = await doc.page(pageObjectNumber).annotations.list();\n const events: DocumentEvent[] = [];\n const unsubscribe = doc.events.subscribe((event) => {\n if (event.type === 'pages.flattened') events.push(event);\n });\n\n const result = await doc.pages.flatten([pageObjectNumber], 'display');\n expect(PageFlattenResultSchema.safeParse(result).success).toBe(true);\n expect(result.pageObjectNumbers).toEqual([pageObjectNumber]);\n expect(result.usage).toBe('display');\n expect(result.results.map((item) => item.status)).toEqual(['applied']);\n expect(result.meta === null).toBe(false);\n expect(events).toHaveLength(1);\n\n const layoutAfter = await doc.pages.list();\n expect(layoutAfter).toEqual(layoutBefore);\n const annotationsAfter = await doc.page(pageObjectNumber).annotations.list();\n expect(annotationsAfter.annotations.length < annotationsBefore.annotations.length).toBe(\n true,\n );\n expect(\n annotationsAfter.pageState.revision.generation >\n annotationsBefore.pageState.revision.generation,\n ).toBe(true);\n\n const noOp = await doc.pages.flatten([pageObjectNumber], 'display');\n expect(noOp.results.map((item) => item.status)).toEqual(['unchanged']);\n expect(noOp.meta).toBeNull();\n expect(events).toHaveLength(1);\n unsubscribe();\n\n await expect(doc.pages.flatten([pageObjectNumber, pageObjectNumber])).rejects.toMatchObject(\n {\n code: EngineErrorCode.InvalidArg,\n },\n );\n } finally {\n await doc.close();\n }\n });\n });\n}\n\nasync function openFixture(engine: Engine, opts: ConformanceOptions): Promise<DocumentHandle> {\n if (opts.openKind === 'bytes') {\n return engine.open({ kind: 'bytes', id: opts.fixture.id, bytes: await opts.fixture.bytes() });\n }\n return engine.open({ kind: 'id', id: opts.fixture.cloudId ?? opts.fixture.id });\n}\n","import type { HighlightDraft, RedactDraft } from '../annotation/kinds';\nimport type { DocumentEvent } from '../events/DocumentEvent';\nimport type { DocumentHandle } from '../engine/DocumentHandle';\nimport type { Engine } from '../engine/Engine';\nimport { EngineErrorCode } from '../errors/EngineErrorCode';\nimport { RedactionApplyResultSchema } from '../wire/schemas';\nimport type { ConformanceOptions, ConformanceTestRunner } from './runMetadataConformance';\n\n/**\n * Transport-neutral coverage for the destructive redaction-apply rail.\n * Runs against a fixture page with NO pre-existing annotations so the\n * collateral counts are exact. Content-removal fidelity itself is pinned by\n * the native embeddertests; this suite pins the transport contract: scopes,\n * statuses, counts, revision bumps, events, and preflight rejection.\n */\nexport function runRedactionApplyConformance(\n runner: ConformanceTestRunner,\n opts: ConformanceOptions,\n): void {\n const { describe, test, beforeAll, afterAll, expect } = runner;\n\n // Geometry: the highlight sits fully inside the redact rect, so applying\n // the redaction removes it as collateral (positive-area intersection).\n const REDACT_RECT = { left: 50, bottom: 50, right: 170, top: 150 };\n const COLLATERAL_QUAD: HighlightDraft['quadPoints'] = [\n {\n p1: { x: 70, y: 120 },\n p2: { x: 150, y: 120 },\n p3: { x: 70, y: 80 },\n p4: { x: 150, y: 80 },\n },\n ];\n\n describe(`redaction apply conformance: ${opts.label}`, () => {\n let engine: Engine;\n\n beforeAll(async () => {\n engine = await opts.makeEngine();\n });\n\n afterAll(async () => {\n if (engine) await engine.destroy();\n });\n\n test('annotations scope applies the marked redaction and counts collateral', async () => {\n const doc = await openFixture(engine, opts);\n try {\n if (!doc.redaction) return;\n const layoutBefore = await doc.pages.list();\n const pageObjectNumber = layoutBefore.pages[0].pageObjectNumber;\n const page = doc.page(pageObjectNumber);\n\n const collateral = await page.annotations.create({\n subtype: 'highlight',\n quadPoints: COLLATERAL_QUAD,\n } satisfies HighlightDraft);\n expect(collateral.created.subtype).toBe('highlight');\n\n const marked = await page.annotations.create({\n subtype: 'redact',\n rect: REDACT_RECT,\n interiorColor: { r: 0, g: 0, b: 0 },\n overlayText: 'REDACTED',\n fontColor: { r: 255, g: 255, b: 255 },\n } satisfies RedactDraft);\n expect(marked.created.subtype).toBe('redact');\n\n const before = await page.annotations.list();\n const events: DocumentEvent[] = [];\n const unsubscribe = doc.events.subscribe((event) => {\n if (event.type === 'redaction.applied') events.push(event);\n });\n\n const result = await doc.redaction.apply({\n kind: 'annotations',\n refs: [marked.created.ref],\n });\n expect(RedactionApplyResultSchema.safeParse(result).success).toBe(true);\n expect(result.results).toHaveLength(1);\n expect(result.results[0].pageObjectNumber).toBe(pageObjectNumber);\n expect(result.results[0].status).toBe('applied');\n // Exactly the highlight counts: the consumed REDACT never does.\n expect(result.results[0].removedAnnotationCount).toBe(1);\n expect(result.removedAnnotationCount).toBe(1);\n expect(result.meta === null).toBe(false);\n expect(events).toHaveLength(1);\n unsubscribe();\n\n // Both the redaction and its collateral are gone; layout is not a\n // casualty; the page revision advanced (weak refs invalidated).\n const after = await page.annotations.list();\n expect(after.annotations.length).toBe(before.annotations.length - 2);\n expect(after.pageState.revision.generation > before.pageState.revision.generation).toBe(\n true,\n );\n expect(await doc.pages.list()).toEqual(layoutBefore);\n } finally {\n await doc.close();\n }\n });\n\n test('pages scope applies everything once and validates its input', async () => {\n const doc = await openFixture(engine, opts);\n try {\n if (!doc.redaction) return;\n const layout = await doc.pages.list();\n const pageObjectNumber = layout.pages[0].pageObjectNumber;\n const page = doc.page(pageObjectNumber);\n\n await page.annotations.create({\n subtype: 'redact',\n rect: REDACT_RECT,\n interiorColor: { r: 0, g: 0, b: 0 },\n } satisfies RedactDraft);\n\n const events: DocumentEvent[] = [];\n const unsubscribe = doc.events.subscribe((event) => {\n if (event.type === 'redaction.applied') events.push(event);\n });\n\n const applied = await doc.redaction.apply({\n kind: 'pages',\n pageObjectNumbers: [pageObjectNumber],\n });\n expect(applied.results.map((item) => item.status)).toEqual(['applied']);\n expect(applied.removedAnnotationCount).toBe(0);\n expect(events).toHaveLength(1);\n\n // A page with no redactions left is unchanged: no artifact, no event.\n const noOp = await doc.redaction.apply({\n kind: 'pages',\n pageObjectNumbers: [pageObjectNumber],\n });\n expect(noOp.results.map((item) => item.status)).toEqual(['unchanged']);\n expect(noOp.meta).toBeNull();\n expect(events).toHaveLength(1);\n unsubscribe();\n\n await expect(\n doc.redaction.apply({\n kind: 'pages',\n pageObjectNumbers: [pageObjectNumber, pageObjectNumber],\n }),\n ).rejects.toMatchObject({ code: EngineErrorCode.InvalidArg });\n\n // Preflight rejects a ref that is not a REDACT annotation before\n // anything is written.\n const notRedact = await page.annotations.create({\n subtype: 'highlight',\n quadPoints: COLLATERAL_QUAD,\n } satisfies HighlightDraft);\n await expect(\n doc.redaction.apply({ kind: 'annotations', refs: [notRedact.created.ref] }),\n ).rejects.toMatchObject({ code: EngineErrorCode.InvalidArg });\n } finally {\n await doc.close();\n }\n });\n });\n}\n\nasync function openFixture(engine: Engine, opts: ConformanceOptions): Promise<DocumentHandle> {\n if (opts.openKind === 'bytes') {\n return engine.open({ kind: 'bytes', id: opts.fixture.id, bytes: await opts.fixture.bytes() });\n }\n return engine.open({ kind: 'id', id: opts.fixture.cloudId ?? opts.fixture.id });\n}\n","import type { ConformanceTestRunner, ConformanceOptions } from './runMetadataConformance';\nimport type { DocumentHandle } from '../engine/DocumentHandle';\nimport type { Engine } from '../engine/Engine';\nimport { EngineError } from '../errors/EngineError';\nimport { EngineErrorCode } from '../errors/EngineErrorCode';\nimport { AbortError } from '../promise/AbortError';\n\n/** `%PDF` — every extracted document must lead with the PDF header. */\nconst PDF_MAGIC = [0x25, 0x50, 0x44, 0x46];\n\n/**\n * Page extract conformance suite. `pages.extract?` is OPTIONAL on the\n * contract (the `downloadLayer?` pattern) — the suite runs only when the\n * implementation provides it, so a cloud engine that has not shipped the\n * server endpoint yet skips cleanly instead of failing.\n *\n * Invariants:\n * 1. `pages.extract([pon])` returns standalone PDF bytes (magic header).\n * 2. The SOURCE document is untouched: identical layout before/after,\n * and page revisions do not bump (extract is a read).\n * 3. Caller order is preserved and page geometry survives the copy\n * (asserted by re-opening the extracted bytes — bytes-open engines\n * only, since a cloud engine cannot re-open loose bytes).\n * 4. Empty / duplicate PONs reject `InvalidArg`; unknown PONs reject\n * `NotFound` (or `InvalidArg`); abort propagates as `AbortError`.\n */\nexport function runPageExtractConformance(\n runner: ConformanceTestRunner,\n opts: ConformanceOptions,\n): void {\n const { describe, test, beforeAll, afterAll, expect } = runner;\n\n describe(`page extract conformance: ${opts.label}`, () => {\n let engine: Engine;\n\n beforeAll(async () => {\n engine = await opts.makeEngine();\n });\n\n afterAll(async () => {\n if (engine) await engine.destroy();\n });\n\n test('pages.extract() returns standalone PDF bytes and leaves the source untouched', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const before = await doc.pages.list();\n const target = before.pages[before.pages.length - 1];\n\n const bytes = await doc.pages.extract([target.pageObjectNumber]);\n expect(bytes.length > PDF_MAGIC.length).toBe(true);\n expect(Array.from(bytes.slice(0, PDF_MAGIC.length))).toEqual(PDF_MAGIC);\n\n // Extract is a READ: the source layout is exactly what it was.\n const after = await doc.pages.list();\n expect(after.pages.map((p) => p.pageObjectNumber)).toEqual(\n before.pages.map((p) => p.pageObjectNumber),\n );\n expect(after.pageCount).toBe(before.pageCount);\n } finally {\n await doc.close();\n }\n });\n\n test('extracted bytes re-open as a document with the requested pages, in caller order', async () => {\n if (opts.openKind !== 'bytes') return;\n const doc = await openFixture(engine, opts);\n let extracted: DocumentHandle | null = null;\n try {\n const list = await doc.pages.list();\n if (list.pages.length < 2) return;\n // Reversed order on purpose: output order is CALLER order.\n const p0 = list.pages[0];\n const p1 = list.pages[1];\n const bytes = await doc.pages.extract([p1.pageObjectNumber, p0.pageObjectNumber]);\n\n extracted = await engine.open({ kind: 'bytes', id: `${opts.fixture.id}-extracted`, bytes });\n const out = await extracted.pages.list();\n expect(out.pageCount).toBe(2);\n expect(out.pages[0].size).toEqual(p1.size);\n expect(out.pages[1].size).toEqual(p0.size);\n } finally {\n if (extracted) await extracted.close();\n await doc.close();\n }\n });\n\n test('pages.extract() rejects empty input with InvalidArg', async () => {\n const doc = await openFixture(engine, opts);\n try {\n let caught: unknown;\n try {\n await doc.pages.extract([]);\n } catch (err) {\n caught = err;\n }\n expect(EngineError.is(caught, EngineErrorCode.InvalidArg)).toBe(true);\n } finally {\n await doc.close();\n }\n });\n\n test('pages.extract() rejects duplicate PONs with InvalidArg', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const list = await doc.pages.list();\n const pon = list.pages[0].pageObjectNumber;\n let caught: unknown;\n try {\n await doc.pages.extract([pon, pon]);\n } catch (err) {\n caught = err;\n }\n expect(EngineError.is(caught, EngineErrorCode.InvalidArg)).toBe(true);\n } finally {\n await doc.close();\n }\n });\n\n test('pages.extract() rejects unknown PON with NotFound or InvalidArg', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const list = await doc.pages.list();\n let bogus = 0;\n for (const p of list.pages) bogus = Math.max(bogus, p.pageObjectNumber);\n bogus += 9999;\n\n let caught: unknown;\n try {\n await doc.pages.extract([bogus]);\n } catch (err) {\n caught = err;\n }\n expect(\n EngineError.is(caught, EngineErrorCode.NotFound) ||\n EngineError.is(caught, EngineErrorCode.InvalidArg),\n ).toBe(true);\n } finally {\n await doc.close();\n }\n });\n\n test('abort on pages.extract() rejects with AbortError', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const list = await doc.pages.list();\n const p = doc.pages.extract([list.pages[0].pageObjectNumber]);\n p.abort('test');\n await expect(p).rejects.toBeInstanceOf(AbortError);\n } finally {\n await doc.close();\n }\n });\n });\n}\n\nasync function openFixture(engine: Engine, opts: ConformanceOptions): Promise<DocumentHandle> {\n if (opts.openKind === 'bytes') {\n const bytes = await opts.fixture.bytes();\n return engine.open({ kind: 'bytes', id: opts.fixture.id, bytes });\n }\n return engine.open({ kind: 'id', id: opts.fixture.cloudId ?? opts.fixture.id });\n}\n","import type { ConformanceTestRunner, ConformanceOptions } from './runMetadataConformance';\nimport type { FileAttachmentAnnotationDTO, TextAnnotationDTO } from '../annotation/kinds';\nimport type { DocumentHandle } from '../engine/DocumentHandle';\nimport type { Engine } from '../engine/Engine';\nimport { EngineError } from '../errors/EngineError';\nimport type { PageObjectNumber } from '../identity/PageObjectNumber';\n\n/**\n * Attachment conformance suite. Fixture requirement: a document whose\n * `/EmbeddedFiles` name tree contains AT LEAST ONE embedded file.\n *\n * Both attachment surfaces are OPTIONAL on the contract (the\n * `downloadLayer?` pattern), probed independently and skipped cleanly:\n * - `doc.attachments?` — document-level EmbeddedFiles (list/download)\n * - `page.annotations.downloadFile?` — annotation-level file bytes\n *\n * Invariants:\n * 1. `list()` reflects the name tree: positional indices, non-empty\n * names, and repeated calls agree (a read).\n * 2. `download(index)` round-trips the listed metadata and returns\n * exactly `size` decoded bytes when the fixture declares one.\n * 3. Unknown indices reject with an `EngineError`.\n * 4. A created file-attachment annotation round-trips its file:\n * metadata inline on the DTO (never bytes), bytes byte-identical\n * through `downloadFile(ref)`.\n * 5. A created text (sticky-note) annotation round-trips icon + color.\n */\nexport function runAttachmentConformance(\n runner: ConformanceTestRunner,\n opts: ConformanceOptions,\n): void {\n const { describe, test, beforeAll, afterAll, expect } = runner;\n\n describe(`attachment conformance: ${opts.label}`, () => {\n let engine: Engine;\n let docSupported = false;\n let annotSupported = false;\n let firstPon: PageObjectNumber;\n\n beforeAll(async () => {\n engine = await opts.makeEngine();\n const probe = await openFixture(engine, opts);\n docSupported = probe.attachments !== undefined;\n const pages = await probe.pages.list();\n firstPon = pages.pages[0].pageObjectNumber;\n annotSupported = probe.page(firstPon).annotations.downloadFile !== undefined;\n await probe.close();\n });\n\n afterAll(async () => {\n if (engine) await engine.destroy();\n });\n\n test('attachments.list() reflects the /EmbeddedFiles name tree and is a stable read', async () => {\n if (!docSupported) return;\n const doc = await openFixture(engine, opts);\n try {\n const items = await doc.attachments!.list();\n expect(items.length > 0).toBe(true);\n items.forEach((item, position) => {\n expect(item.index).toBe(position);\n expect(item.key.length > 0).toBe(true);\n expect(item.name.length > 0).toBe(true);\n });\n // Keys are unique by construction — they are the durable refs.\n expect(new Set(items.map((i) => i.key)).size).toBe(items.length);\n // A read: calling again observes the identical snapshot.\n expect(await doc.attachments!.list()).toEqual(items);\n } finally {\n await doc.close();\n }\n });\n\n test('attachments.download() round-trips the listed metadata and decoded size', async () => {\n if (!docSupported) return;\n const doc = await openFixture(engine, opts);\n try {\n const items = await doc.attachments!.list();\n for (const item of items) {\n const content = await doc.attachments!.download({ kind: 'key', key: item.key });\n expect(content.name).toBe(item.name);\n if (item.mimeType !== undefined) {\n expect(content.mimeType).toBe(item.mimeType);\n }\n if (item.size !== undefined) {\n expect(content.bytes.length).toBe(item.size);\n }\n }\n } finally {\n await doc.close();\n }\n });\n\n test('attachments.download() rejects an unknown key', async () => {\n if (!docSupported) return;\n const doc = await openFixture(engine, opts);\n try {\n await expect(\n doc.attachments!.download({ kind: 'key', key: 'conformance-no-such-key.bin' }),\n ).rejects.toBeInstanceOf(EngineError);\n } finally {\n await doc.close();\n }\n });\n\n test('create() and delete() round-trip the name tree; keys survive index shifts', async () => {\n if (!docSupported) return;\n const doc = await openFixture(engine, opts);\n if (doc.attachments!.create === undefined || doc.attachments!.delete === undefined) {\n await doc.close();\n return;\n }\n try {\n const before = await doc.attachments!.list();\n const data = new Uint8Array(512);\n for (let i = 0; i < data.length; i++) data[i] = (i * 7 + 3) & 0xff;\n\n // \"0-…\" sorts before the fixture's entries, shifting their indices —\n // the sharpest difference from append-only annotation creates.\n const { created } = await doc.attachments!.create!({\n data,\n name: '0-conformance.bin',\n mimeType: 'application/octet-stream',\n description: 'added by conformance',\n });\n expect(created.key).toBe('0-conformance.bin');\n expect(created.name).toBe('0-conformance.bin');\n expect(created.mimeType).toBe('application/octet-stream');\n expect(created.description).toBe('added by conformance');\n expect(created.size).toBe(data.length);\n\n const after = await doc.attachments!.list();\n expect(after.length).toBe(before.length + 1);\n // Pre-existing keys still resolve even though their indices shifted.\n for (const item of before) {\n const match = after.find((i) => i.key === item.key);\n expect(match !== undefined).toBe(true);\n }\n\n // Duplicate keys reject — keys are the identity.\n await expect(\n doc.attachments!.create!({ data, name: '0-conformance.bin' }),\n ).rejects.toBeInstanceOf(EngineError);\n\n // The created file round-trips byte-identically.\n const content = await doc.attachments!.download({ kind: 'key', key: created.key });\n expect(content.bytes.length).toBe(data.length);\n expect(content.bytes.every((byte, i) => byte === data[i])).toBe(true);\n\n // Delete by key; the key stops resolving and the rest are intact.\n const { deleted } = await doc.attachments!.delete!({ kind: 'key', key: created.key });\n expect(deleted).toEqual({ kind: 'key', key: created.key });\n const final = await doc.attachments!.list();\n expect(final.map((i) => i.key)).toEqual(before.map((i) => i.key));\n await expect(\n doc.attachments!.delete!({ kind: 'key', key: created.key }),\n ).rejects.toBeInstanceOf(EngineError);\n } finally {\n await doc.close();\n }\n });\n\n test('a created file-attachment annotation round-trips its file through downloadFile()', async () => {\n if (!annotSupported) return;\n const doc = await openFixture(engine, opts);\n try {\n const annotations = doc.page(firstPon).annotations;\n const data = new Uint8Array(2048);\n for (let i = 0; i < data.length; i++) data[i] = (i * 31 + 7) & 0xff;\n\n const { created } = await annotations.create({\n subtype: 'file-attachment',\n rect: { left: 40, bottom: 40, right: 60, top: 60 },\n file: {\n data,\n name: 'conformance.bin',\n mimeType: 'application/octet-stream',\n description: 'attachment conformance payload',\n },\n icon: 'paperclip',\n color: { r: 220, g: 38, b: 38 },\n contents: 'conformance attachment',\n });\n\n // Metadata rides the DTO; bytes never do.\n const dto = created as FileAttachmentAnnotationDTO;\n expect(dto.subtype).toBe('file-attachment');\n expect(dto.icon).toBe('paperclip');\n expect(dto.color).toEqual({ r: 220, g: 38, b: 38 });\n expect(dto.file.name).toBe('conformance.bin');\n expect(dto.file.mimeType).toBe('application/octet-stream');\n expect(dto.file.description).toBe('attachment conformance payload');\n expect(dto.file.size).toBe(data.length);\n\n // Bytes come back byte-identical through the explicit download.\n const content = await annotations.downloadFile!(dto.ref);\n expect(content.name).toBe('conformance.bin');\n expect(content.bytes.length).toBe(data.length);\n expect(Array.from(content.bytes.slice(0, 16))).toEqual(Array.from(data.slice(0, 16)));\n expect(content.bytes.every((byte, i) => byte === data[i])).toBe(true);\n } finally {\n await doc.close();\n }\n });\n\n test('a created text annotation round-trips icon, color, and contents', async () => {\n if (!annotSupported) return;\n const doc = await openFixture(engine, opts);\n try {\n const annotations = doc.page(firstPon).annotations;\n const { created } = await annotations.create({\n subtype: 'text',\n rect: { left: 100, bottom: 100, right: 120, top: 120 },\n icon: 'comment',\n color: { r: 250, g: 204, b: 21 },\n contents: 'conformance note',\n });\n const dto = created as TextAnnotationDTO;\n expect(dto.subtype).toBe('text');\n expect(dto.icon).toBe('comment');\n expect(dto.color).toEqual({ r: 250, g: 204, b: 21 });\n expect(dto.contents).toBe('conformance note');\n\n // Icon is patchable; the file half of an attachment is not, and\n // the same presentation-only patch path applies to notes.\n const { updated } = await annotations.update(dto.ref, {\n subtype: 'text',\n icon: 'help',\n });\n expect((updated as TextAnnotationDTO).icon).toBe('help');\n } finally {\n await doc.close();\n }\n });\n });\n\n async function openFixture(engine: Engine, options: ConformanceOptions): Promise<DocumentHandle> {\n if (options.openKind === 'bytes') {\n return engine.open({\n kind: 'bytes',\n id: options.fixture.id,\n bytes: await options.fixture.bytes(),\n });\n }\n return engine.open({ kind: 'id', id: options.fixture.cloudId ?? options.fixture.id });\n }\n}\n","import type { ConformanceTestRunner, ConformanceOptions } from './runMetadataConformance';\nimport type { DocumentHandle } from '../engine/DocumentHandle';\nimport type { Engine } from '../engine/Engine';\nimport { EngineError } from '../errors/EngineError';\nimport { EngineErrorCode } from '../errors/EngineErrorCode';\n\n/**\n * Page insert conformance. `pages.insert` is a REQUIRED member — this suite\n * runs unconditionally on every engine, so an implementation that loses the\n * verb fails loudly instead of being skipped past.\n *\n * Invariants:\n * 1. Every page of the source bytes is COPIED in at `destIndex` (omitted →\n * append), in source order; the result lists the fresh PONs in\n * insertion order and they agree with the returned layout.\n * 2. Pre-existing pages keep their identity: same PONs before and after,\n * in the expected positions (an insert never invalidates neighbours).\n * 3. The mutation persists through save → re-open (bytes engines only).\n * 4. Empty bytes / malformed bytes / out-of-range destIndex reject with\n * InvalidArg / MalformedPdf, leaving the document untouched.\n */\nexport function runPageInsertConformance(\n runner: ConformanceTestRunner,\n opts: ConformanceOptions,\n): void {\n const { describe, test, beforeAll, afterAll, expect } = runner;\n\n describe(`page insert conformance: ${opts.label}`, () => {\n let engine: Engine;\n\n beforeAll(async () => {\n engine = await opts.makeEngine();\n });\n\n afterAll(async () => {\n if (engine) await engine.destroy();\n });\n\n test('appends every source page with fresh PONs; existing pages keep identity', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const before = await doc.pages.list();\n const beforePons = before.pages.map((p) => p.pageObjectNumber);\n // Self-source: extract the first page, insert it back (append).\n const single = await doc.pages.extract([beforePons[0]]);\n\n const result = await doc.pages.insert(single);\n expect(result.insertedPageObjectNumbers.length).toBe(1);\n expect(result.layout.pageCount).toBe(before.pageCount + 1);\n // Existing pages: same identity, same leading positions.\n expect(\n result.layout.pages.slice(0, before.pageCount).map((p) => p.pageObjectNumber),\n ).toEqual(beforePons);\n // The appended copy is a FRESH object number at the tail.\n const newPon = result.insertedPageObjectNumbers[0];\n expect(beforePons.includes(newPon)).toBe(false);\n expect(result.layout.pages[before.pageCount].pageObjectNumber).toBe(newPon);\n // The copy inherits the source page's geometry.\n expect(result.layout.pages[before.pageCount].size).toEqual(before.pages[0].size);\n } finally {\n await doc.close();\n }\n });\n\n test('destIndex places the block mid-document, in source order', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const before = await doc.pages.list();\n if (before.pages.length < 2) return;\n const beforePons = before.pages.map((p) => p.pageObjectNumber);\n const two = await doc.pages.extract([beforePons[0], beforePons[1]]);\n\n const result = await doc.pages.insert(two, 1);\n expect(result.insertedPageObjectNumbers.length).toBe(2);\n const pons = result.layout.pages.map((p) => p.pageObjectNumber);\n expect(pons[0]).toBe(beforePons[0]);\n expect(pons.slice(1, 3)).toEqual(result.insertedPageObjectNumbers);\n expect(pons.slice(3)).toEqual(beforePons.slice(1));\n } finally {\n await doc.close();\n }\n });\n\n test('the inserted pages persist through save → re-open', async () => {\n if (opts.openKind !== 'bytes') return;\n const doc = await openFixture(engine, opts);\n let reopened: DocumentHandle | null = null;\n try {\n const before = await doc.pages.list();\n const single = await doc.pages.extract([before.pages[0].pageObjectNumber]);\n await doc.pages.insert(single);\n const bytes = await doc.download();\n\n reopened = await engine.open({\n kind: 'bytes',\n id: `${opts.fixture.id}-insert-reopen`,\n bytes,\n });\n const after = await reopened.pages.list();\n expect(after.pageCount).toBe(before.pageCount + 1);\n } finally {\n if (reopened) await reopened.close();\n await doc.close();\n }\n });\n\n test('empty bytes reject with InvalidArg; garbage rejects with MalformedPdf', async () => {\n const doc = await openFixture(engine, opts);\n try {\n let caught: unknown;\n try {\n await doc.pages.insert(new Uint8Array(0));\n } catch (err) {\n caught = err;\n }\n expect(EngineError.is(caught, EngineErrorCode.InvalidArg)).toBe(true);\n\n caught = undefined;\n try {\n await doc.pages.insert(new TextEncoder().encode('not a pdf at all'));\n } catch (err) {\n caught = err;\n }\n expect(EngineError.is(caught, EngineErrorCode.MalformedPdf)).toBe(true);\n\n // Untouched after both rejections.\n const list = await doc.pages.list();\n expect(list.pageCount > 0).toBe(true);\n } finally {\n await doc.close();\n }\n });\n\n test('out-of-range destIndex rejects with InvalidArg', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const before = await doc.pages.list();\n const single = await doc.pages.extract([before.pages[0].pageObjectNumber]);\n let caught: unknown;\n try {\n await doc.pages.insert(single, before.pageCount + 1);\n } catch (err) {\n caught = err;\n }\n expect(EngineError.is(caught, EngineErrorCode.InvalidArg)).toBe(true);\n } finally {\n await doc.close();\n }\n });\n });\n}\n\nasync function openFixture(engine: Engine, opts: ConformanceOptions): Promise<DocumentHandle> {\n if (opts.openKind === 'bytes') {\n const bytes = await opts.fixture.bytes();\n return engine.open({ kind: 'bytes', id: opts.fixture.id, bytes });\n }\n return engine.open({ kind: 'id', id: opts.fixture.cloudId ?? opts.fixture.id });\n}\n","import type { ConformanceTestRunner, ConformanceOptions } from './runMetadataConformance';\nimport type { DocumentHandle } from '../engine/DocumentHandle';\nimport type { Engine } from '../engine/Engine';\nimport { EngineError } from '../errors/EngineError';\nimport { EngineErrorCode } from '../errors/EngineErrorCode';\nimport { PAGE_INSERT_BLANK_MAX_COUNT } from '../mutation/PageInsertBlankInput';\n\n/** An on-purpose non-default size so the assertions can't pass by accident. */\nconst SIZE = { width: 396, height: 612 };\n\n/**\n * Blank-page insert conformance. `pages.insertBlank` is a REQUIRED member —\n * the suite runs unconditionally on every engine (no fixture bytes are\n * needed at all, which is the point of the verb), so an implementation that\n * loses the verb fails loudly instead of being skipped past.\n *\n * Invariants:\n * 1. `count` blank pages of exactly `size` appear at `destIndex` (omitted\n * → append), rotation 0; the result lists their fresh PONs in insertion\n * order and they agree with the returned layout.\n * 2. Pre-existing pages keep their identity: same PONs before and after,\n * in the expected positions (an insert never invalidates neighbours).\n * 3. The mutation persists through save → re-open (bytes engines only).\n * 4. Non-positive size / count outside [1, PAGE_INSERT_BLANK_MAX_COUNT] /\n * out-of-range destIndex reject with InvalidArg, leaving the document\n * untouched.\n */\nexport function runPageInsertBlankConformance(\n runner: ConformanceTestRunner,\n opts: ConformanceOptions,\n): void {\n const { describe, test, beforeAll, afterAll, expect } = runner;\n\n describe(`page insert-blank conformance: ${opts.label}`, () => {\n let engine: Engine;\n\n beforeAll(async () => {\n engine = await opts.makeEngine();\n });\n\n afterAll(async () => {\n if (engine) await engine.destroy();\n });\n\n test('appends one blank page of the requested size with a fresh PON', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const before = await doc.pages.list();\n const beforePons = before.pages.map((p) => p.pageObjectNumber);\n\n const result = await doc.pages.insertBlank({ size: SIZE });\n expect(result.insertedPageObjectNumbers.length).toBe(1);\n expect(result.layout.pageCount).toBe(before.pageCount + 1);\n // Existing pages: same identity, same leading positions.\n expect(\n result.layout.pages.slice(0, before.pageCount).map((p) => p.pageObjectNumber),\n ).toEqual(beforePons);\n // The appended page is a FRESH object number at the tail.\n const newPon = result.insertedPageObjectNumbers[0];\n expect(beforePons.includes(newPon)).toBe(false);\n const appended = result.layout.pages[before.pageCount];\n expect(appended.pageObjectNumber).toBe(newPon);\n expect(appended.size).toEqual(SIZE);\n expect(appended.rotation).toBe(0);\n } finally {\n await doc.close();\n }\n });\n\n test('destIndex + count places the blank block mid-document', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const before = await doc.pages.list();\n if (before.pages.length < 2) return;\n const beforePons = before.pages.map((p) => p.pageObjectNumber);\n\n const result = await doc.pages.insertBlank({ size: SIZE, count: 2 }, 1);\n expect(result.insertedPageObjectNumbers.length).toBe(2);\n expect(result.insertedPageObjectNumbers[0] === result.insertedPageObjectNumbers[1]).toBe(\n false,\n );\n const pons = result.layout.pages.map((p) => p.pageObjectNumber);\n expect(pons[0]).toBe(beforePons[0]);\n expect(pons.slice(1, 3)).toEqual(result.insertedPageObjectNumbers);\n expect(pons.slice(3)).toEqual(beforePons.slice(1));\n expect(result.layout.pages[1].size).toEqual(SIZE);\n expect(result.layout.pages[2].size).toEqual(SIZE);\n } finally {\n await doc.close();\n }\n });\n\n test('the blank pages persist through save → re-open', async () => {\n if (opts.openKind !== 'bytes') return;\n const doc = await openFixture(engine, opts);\n let reopened: DocumentHandle | null = null;\n try {\n const before = await doc.pages.list();\n await doc.pages.insertBlank({ size: SIZE });\n const bytes = await doc.download();\n\n reopened = await engine.open({\n kind: 'bytes',\n id: `${opts.fixture.id}-insert-blank-reopen`,\n bytes,\n });\n const after = await reopened.pages.list();\n expect(after.pageCount).toBe(before.pageCount + 1);\n const tail = after.pages[after.pageCount - 1];\n expect(Math.round(tail.size.width)).toBe(SIZE.width);\n expect(Math.round(tail.size.height)).toBe(SIZE.height);\n } finally {\n if (reopened) await reopened.close();\n await doc.close();\n }\n });\n\n test('non-positive size, bad count, and out-of-range destIndex reject with InvalidArg', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const before = await doc.pages.list();\n const rejects: Array<() => Promise<unknown>> = [\n () => doc.pages.insertBlank({ size: { width: 0, height: 612 } }),\n () => doc.pages.insertBlank({ size: { width: 396, height: -10 } }),\n () => doc.pages.insertBlank({ size: SIZE, count: 0 }),\n () => doc.pages.insertBlank({ size: SIZE, count: PAGE_INSERT_BLANK_MAX_COUNT + 1 }),\n () => doc.pages.insertBlank({ size: SIZE }, before.pageCount + 1),\n ];\n for (const attempt of rejects) {\n let caught: unknown;\n try {\n await attempt();\n } catch (err) {\n caught = err;\n }\n expect(EngineError.is(caught, EngineErrorCode.InvalidArg)).toBe(true);\n }\n\n // Untouched after every rejection.\n const list = await doc.pages.list();\n expect(list.pageCount).toBe(before.pageCount);\n expect(list.pages.map((p) => p.pageObjectNumber)).toEqual(\n before.pages.map((p) => p.pageObjectNumber),\n );\n } finally {\n await doc.close();\n }\n });\n });\n}\n\nasync function openFixture(engine: Engine, opts: ConformanceOptions): Promise<DocumentHandle> {\n if (opts.openKind === 'bytes') {\n const bytes = await opts.fixture.bytes();\n return engine.open({ kind: 'bytes', id: opts.fixture.id, bytes });\n }\n return engine.open({ kind: 'id', id: opts.fixture.cloudId ?? opts.fixture.id });\n}\n","import type { ConformanceTestRunner, ConformanceOptions } from './runMetadataConformance';\nimport type { DocumentHandle } from '../engine/DocumentHandle';\nimport type { Engine } from '../engine/Engine';\n\nconst APP = 'EMBD_ConformanceTest';\nconst SIBLING_APP = 'EMBD_ConformanceSibling';\n\n/**\n * `/PieceInfo` conformance (doc + page level). The service is OPTIONAL on\n * the contract (`downloadLayer?` pattern) — the suite runs only where the\n * implementation provides it, so an engine that has not shipped it yet\n * skips cleanly.\n *\n * Invariants:\n * 1. The full value vocabulary round-trips at both levels: string,\n * number, boolean, name, string-array — read back with the same tags.\n * 2. Writes PERSIST: download() → re-open → identical read (bytes-open\n * engines only, since cloud cannot re-open loose bytes).\n * 3. `null` deletes a key; sibling keys and sibling applications\n * survive both key deletes and whole-entry clears.\n * 4. An absent application reads as `null`; `applications()` enumerates\n * what is present; every write refreshes `lastModified`.\n */\nexport function runPieceInfoConformance(\n runner: ConformanceTestRunner,\n opts: ConformanceOptions,\n): void {\n const { describe, test, beforeAll, afterAll, expect } = runner;\n\n describe(`pieceInfo conformance: ${opts.label}`, () => {\n let engine: Engine;\n let supported = false;\n\n beforeAll(async () => {\n engine = await opts.makeEngine();\n const probe = await openFixture(engine, opts);\n supported = probe.pieceInfo !== undefined;\n await probe.close();\n });\n\n afterAll(async () => {\n if (engine) await engine.destroy();\n });\n\n test('doc-level: the full value vocabulary round-trips with tags intact', async () => {\n if (!supported) return;\n const doc = await openFixture(engine, opts);\n try {\n await doc.pieceInfo!.update(APP, {\n name: 'Standard Stamps',\n schema: 1,\n shared: true,\n kind: { name: 'StampLibrary' },\n tags: ['legal', 'finance'],\n });\n const snap = await doc.pieceInfo!.read(APP);\n expect(snap).toBeTruthy();\n expect(snap!.entries).toEqual({\n name: { type: 'string', value: 'Standard Stamps' },\n schema: { type: 'number', value: 1 },\n shared: { type: 'boolean', value: true },\n kind: { type: 'name', value: 'StampLibrary' },\n tags: { type: 'string-array', value: ['legal', 'finance'] },\n });\n expect(typeof snap!.lastModified).toBe('string');\n } finally {\n await doc.close();\n }\n });\n\n test('page-level: the stamp schema round-trips on a page', async () => {\n if (!supported) return;\n const doc = await openFixture(engine, opts);\n try {\n const list = await doc.pages.list();\n const page = doc.page(list.pages[0].pageObjectNumber);\n await page.pieceInfo!.update(APP, { name: 'Witness', subject: 'Getuige' });\n const snap = await page.pieceInfo!.read(APP);\n expect(snap!.entries).toEqual({\n name: { type: 'string', value: 'Witness' },\n subject: { type: 'string', value: 'Getuige' },\n });\n // The doc-level holder is a DIFFERENT dictionary: untouched.\n expect(await doc.pieceInfo!.read(APP)).toBe(null);\n } finally {\n await doc.close();\n }\n });\n\n test('writes persist through save → re-open', async () => {\n if (!supported || opts.openKind !== 'bytes') return;\n const doc = await openFixture(engine, opts);\n let reopened: DocumentHandle | null = null;\n try {\n const list = await doc.pages.list();\n const pon = list.pages[0].pageObjectNumber;\n await doc.pieceInfo!.update(APP, { name: 'Standard Stamps' });\n await doc.page(pon).pieceInfo!.update(APP, { name: 'Witness', subject: 'Getuige' });\n const bytes = await doc.download();\n\n reopened = await engine.open({ kind: 'bytes', id: `${opts.fixture.id}-pi-reopen`, bytes });\n const relist = await reopened.pages.list();\n const docSnap = await reopened.pieceInfo!.read(APP);\n expect(docSnap!.entries.name).toEqual({ type: 'string', value: 'Standard Stamps' });\n const pageSnap = await reopened.page(relist.pages[0].pageObjectNumber).pieceInfo!.read(APP);\n expect(pageSnap!.entries.subject).toEqual({ type: 'string', value: 'Getuige' });\n } finally {\n if (reopened) await reopened.close();\n await doc.close();\n }\n });\n\n test('null deletes a key; clear removes an entry; siblings survive', async () => {\n if (!supported) return;\n const doc = await openFixture(engine, opts);\n try {\n await doc.pieceInfo!.update(APP, { name: 'A', keep: 'B' });\n await doc.pieceInfo!.update(SIBLING_APP, { other: 'C' });\n\n await doc.pieceInfo!.update(APP, { name: null });\n const afterDelete = await doc.pieceInfo!.read(APP);\n expect(Object.keys(afterDelete!.entries)).toEqual(['keep']);\n\n const apps = await doc.pieceInfo!.applications();\n expect(apps.includes(APP)).toBe(true);\n expect(apps.includes(SIBLING_APP)).toBe(true);\n\n await doc.pieceInfo!.clear(APP);\n expect(await doc.pieceInfo!.read(APP)).toBe(null);\n // The sibling application is untouched by the clear.\n const sibling = await doc.pieceInfo!.read(SIBLING_APP);\n expect(sibling!.entries.other).toEqual({ type: 'string', value: 'C' });\n } finally {\n await doc.close();\n }\n });\n\n test('an application that was never written reads as null', async () => {\n if (!supported) return;\n const doc = await openFixture(engine, opts);\n try {\n expect(await doc.pieceInfo!.read('EMBD_NeverWritten')).toBe(null);\n const list = await doc.pages.list();\n expect(\n await doc.page(list.pages[0].pageObjectNumber).pieceInfo!.read('EMBD_NeverWritten'),\n ).toBe(null);\n } finally {\n await doc.close();\n }\n });\n });\n}\n\nasync function openFixture(engine: Engine, opts: ConformanceOptions): Promise<DocumentHandle> {\n if (opts.openKind === 'bytes') {\n const bytes = await opts.fixture.bytes();\n return engine.open({ kind: 'bytes', id: opts.fixture.id, bytes });\n }\n return engine.open({ kind: 'id', id: opts.fixture.cloudId ?? opts.fixture.id });\n}\n","import type { ConformanceTestRunner, ConformanceOptions } from './runMetadataConformance';\nimport type { HighlightDraft } from '../annotation/kinds';\nimport type { DocumentHandle } from '../engine/DocumentHandle';\nimport type { Engine } from '../engine/Engine';\nimport type { DocumentEvent } from '../events/DocumentEvent';\n\nconst QUAD: HighlightDraft['quadPoints'] = [\n {\n p1: { x: 50, y: 100 },\n p2: { x: 150, y: 100 },\n p3: { x: 50, y: 80 },\n p4: { x: 150, y: 80 },\n },\n];\n\n/**\n * Document event stream conformance suite. Verifies the invariants the\n * collaboration design rests on — do NOT loosen these without re-reading\n * `DocumentEvent`:\n *\n * 1. EXACTLY ONCE: every confirmed mutation produces exactly one event,\n * in mutation order, regardless of engine (local worker or cloud HTTP).\n * 2. GROUND TRUTH: a failed mutation publishes nothing; events fire only\n * after confirmation.\n * 3. RESULTS RIDE VERBATIM: each event embeds the result the caller\n * received, deep-equal field for field.\n * 4. PROVENANCE: own mutations are `origin.kind: 'local'` with a stable\n * per-engine-instance `sessionId`.\n * 5. Unsubscribe stops delivery.\n *\n * Both local (worker host + WASM) and cloud (HTTP + @cloudpdf/server)\n * implementations must pass identically.\n */\nexport function runDocumentEventsConformance(\n runner: ConformanceTestRunner,\n opts: ConformanceOptions,\n): void {\n const { describe, test, beforeAll, afterAll, expect } = runner;\n\n describe(`document events conformance: ${opts.label}`, () => {\n let engine: Engine;\n\n beforeAll(async () => {\n engine = await opts.makeEngine();\n });\n\n afterAll(async () => {\n if (engine) await engine.destroy();\n });\n\n test('every confirmed mutation publishes exactly one event, results verbatim', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const events: DocumentEvent[] = [];\n doc.events.subscribe((event) => events.push(event));\n\n const list = await doc.pages.list();\n if (list.pages.length < 3) return;\n const pon = list.pages[0].pageObjectNumber;\n const page = doc.page(pon);\n\n const draft: HighlightDraft = {\n subtype: 'highlight',\n contents: 'events conformance',\n quadPoints: QUAD,\n };\n const created = await page.annotations.create(draft);\n const updated = await page.annotations.update(created.created.ref, {\n subtype: 'highlight',\n contents: 'updated',\n });\n const rotated = await doc.pages.rotate([pon], 90);\n const victim = list.pages[2].pageObjectNumber;\n const deleted = await doc.pages.delete([victim]);\n const meta = await doc.metadata.update({ title: 'events conformance' });\n\n expect(events.map((event) => event.type)).toEqual([\n 'annotation.created',\n 'annotation.updated',\n 'pages.rotated',\n 'pages.deleted',\n 'metadata.updated',\n ]);\n\n // The embedded results are the returned results, field for field.\n const [evCreated, evUpdated, evRotated, evDeleted, evMeta] = events;\n if (evCreated.type === 'annotation.created') {\n expect(evCreated.pageObjectNumber).toBe(pon);\n expect(evCreated.created).toEqual(created.created);\n expect(evCreated.meta).toEqual(created.meta);\n }\n if (evUpdated.type === 'annotation.updated') {\n expect(evUpdated.updated).toEqual(updated.updated);\n }\n if (evRotated.type === 'pages.rotated') {\n expect(evRotated.pageObjectNumbers).toEqual([pon]);\n expect(evRotated.rotation).toBe(90);\n expect(evRotated.layout).toEqual(rotated.layout);\n expect(evRotated.cache).toEqual(rotated.cache);\n }\n if (evDeleted.type === 'pages.deleted') {\n expect(evDeleted.pageObjectNumbers).toEqual([victim]);\n expect(evDeleted.layout).toEqual(deleted.layout);\n }\n if (evMeta.type === 'metadata.updated') {\n expect(evMeta.metadata).toEqual(meta.metadata);\n }\n\n // Provenance: own mutations, one engine instance. Every event in\n // this suite is a mutation event — transport notices\n // (`stream.desynced`) never fire from local mutations, so a\n // missing origin here is a real failure, asserted explicitly.\n const first = events[0];\n expect(first !== undefined && 'origin' in first).toBe(true);\n if (first === undefined || !('origin' in first)) return;\n for (const event of events) {\n expect('origin' in event).toBe(true);\n if (!('origin' in event)) continue;\n expect(event.origin.kind).toBe('local');\n expect(typeof event.origin.sessionId).toBe('string');\n expect(event.origin.sessionId.length > 0).toBe(true);\n expect(event.origin.sessionId).toBe(first.origin.sessionId);\n expect(typeof event.origin.ts).toBe('number');\n }\n } finally {\n await doc.close();\n }\n });\n\n test('pages.inserted rides verbatim', async () => {\n const doc = await openFixture(engine, opts);\n try {\n // insertBlank needs no source bytes, so it is the fixture-free way\n // to exercise the event.\n const events: DocumentEvent[] = [];\n doc.events.subscribe((event) => events.push(event));\n\n const inserted = await doc.pages.insertBlank({ size: { width: 396, height: 612 } }, 0);\n\n expect(events.map((event) => event.type)).toEqual(['pages.inserted']);\n const [evInserted] = events;\n if (evInserted.type === 'pages.inserted') {\n expect(evInserted.insertedPageObjectNumbers).toEqual(\n inserted.insertedPageObjectNumbers,\n );\n expect(evInserted.layout).toEqual(inserted.layout);\n expect(evInserted.cache).toEqual(inserted.cache);\n expect(evInserted.destIndex).toBe(0);\n expect(evInserted.origin.kind).toBe('local');\n }\n } finally {\n await doc.close();\n }\n });\n\n test('a FAILED mutation publishes nothing (events are ground truth)', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const events: DocumentEvent[] = [];\n doc.events.subscribe((event) => events.push(event));\n const list = await doc.pages.list();\n let caught: unknown;\n try {\n // Deleting every page is rejected — see PageDeleteInput.\n await doc.pages.delete(list.pages.map((p) => p.pageObjectNumber));\n } catch (err) {\n caught = err;\n }\n expect(caught !== undefined).toBe(true);\n expect(events.length).toBe(0);\n } finally {\n await doc.close();\n }\n });\n\n test('unsubscribe stops delivery', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const events: DocumentEvent[] = [];\n const unsubscribe = doc.events.subscribe((event) => events.push(event));\n unsubscribe();\n const list = await doc.pages.list();\n await doc.pages.rotate([list.pages[0].pageObjectNumber], 180);\n expect(events.length).toBe(0);\n } finally {\n await doc.close();\n }\n });\n });\n}\n\nasync function openFixture(engine: Engine, opts: ConformanceOptions): Promise<DocumentHandle> {\n if (opts.openKind === 'bytes') {\n const bytes = await opts.fixture.bytes();\n return engine.open({ kind: 'bytes', id: opts.fixture.id, bytes });\n }\n return engine.open({ kind: 'id', id: opts.fixture.cloudId ?? opts.fixture.id });\n}\n","import type {\n ConformanceTestRunner,\n ConformanceFixture,\n ConformanceOptions,\n} from './runMetadataConformance';\nimport type { PageTextSnapshot } from '../dto/PageTextSnapshot';\nimport type { Engine } from '../engine/Engine';\nimport { EngineError } from '../errors/EngineError';\nimport { EngineErrorCode } from '../errors/EngineErrorCode';\nimport { AbortError } from '../promise/AbortError';\nimport { PageTextSnapshotSchema } from '../wire/schemas';\n\n/**\n * Per-fixture expectations for the text-extraction harness. Concrete\n * suites supply the page identity + a substring the harness asserts\n * exists in the extracted text. The harness deliberately avoids\n * locking the exact string so different fixtures (or PDFium upgrades\n * that change whitespace handling) don't require harness edits.\n */\nexport interface PageTextConformanceFixture extends ConformanceFixture {\n /** PDF indirect object number of the page used by the text tests. */\n pageObjectNumber: number;\n /**\n * Substring guaranteed to appear in the extracted text. The harness\n * uses `.includes(needle)`; suites should pick something distinctive\n * but not whitespace-sensitive.\n */\n expectedSubstring: string;\n /** Minimum char count the harness expects (sanity floor). */\n minCharCount: number;\n}\n\nexport interface PageTextConformanceOptions extends Omit<ConformanceOptions, 'fixture'> {\n fixture: PageTextConformanceFixture;\n}\n\nexport function runPageTextConformance(\n runner: ConformanceTestRunner,\n opts: PageTextConformanceOptions,\n): void {\n const { describe, test, beforeAll, afterAll, expect } = runner;\n\n describe(`page text conformance: ${opts.label}`, () => {\n let engine: Engine;\n\n beforeAll(async () => {\n engine = await opts.makeEngine();\n });\n\n afterAll(async () => {\n if (engine) await engine.destroy();\n });\n\n test('read() returns a PageTextSnapshot with non-empty text', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const page = doc.page(opts.fixture.pageObjectNumber);\n const snap = await page.text.read();\n expect(PageTextSnapshotSchema.safeParse(snap).success).toBe(true);\n expect(snap.charCount >= opts.fixture.minCharCount).toBe(true);\n expect(snap.text.length > 0).toBe(true);\n } finally {\n await doc.close();\n }\n });\n\n test('extracted text contains the expected substring', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const page = doc.page(opts.fixture.pageObjectNumber);\n const snap = await page.text.read();\n expect(snap.text.includes(opts.fixture.expectedSubstring)).toBe(true);\n } finally {\n await doc.close();\n }\n });\n\n test('read() on an unknown pageObjectNumber throws NotFound', async () => {\n const doc = await openFixture(engine, opts);\n try {\n let caught: unknown;\n try {\n const ghost = doc.page(999_999_999);\n await ghost.text.read();\n } catch (err) {\n caught = err;\n }\n expect(caught).toBeTruthy();\n expect(EngineError.is(caught, EngineErrorCode.NotFound)).toBe(true);\n } finally {\n await doc.close();\n }\n });\n\n test('abort() on read rejects with AbortError', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const page = doc.page(opts.fixture.pageObjectNumber);\n const p = page.text.read();\n p.abort('test');\n await expect(p).rejects.toBeInstanceOf(AbortError);\n } finally {\n await doc.close();\n }\n });\n\n test('read after close throws DocNotOpen', async () => {\n const doc = await openFixture(engine, opts);\n const page = doc.page(opts.fixture.pageObjectNumber);\n await doc.close();\n let caught: unknown;\n try {\n await page.text.read();\n } catch (err) {\n caught = err;\n }\n expect(caught).toBeTruthy();\n expect(EngineError.is(caught, EngineErrorCode.DocNotOpen)).toBe(true);\n });\n });\n}\n\nasync function openFixture(engine: Engine, opts: PageTextConformanceOptions) {\n if (opts.openKind === 'bytes') {\n const bytes = await opts.fixture.bytes();\n return engine.open({ kind: 'bytes', id: opts.fixture.id, bytes });\n }\n return engine.open({ kind: 'id', id: opts.fixture.cloudId ?? opts.fixture.id });\n}\n\nexport type { PageTextSnapshot };\n","import type {\n ConformanceTestRunner,\n ConformanceFixture,\n ConformanceOptions,\n} from './runMetadataConformance';\nimport type { CharMapAnchor } from '../text/charmap';\nimport { sliceTextByChars } from '../text/charmap';\nimport type { Engine } from '../engine/Engine';\nimport { PageTextSnapshotSchema } from '../wire/schemas';\n\n/**\n * Index-space divergence conformance: the cases where a page's CHARACTER\n * space (what geometry tiles and selection/search ranges address) and its\n * extracted TEXT differ — and the `charMap` contract that bridges them.\n *\n * Fixtures pin EXACT values (text, charCount, anchors) verified against the\n * wasm runtime, so both engines must produce byte-identical snapshots:\n *\n * - a non-printing character occupying a character slot with no text unit\n * (`bug_1139.pdf` — every text offset shifts by one);\n * - `/ActualText` replacement (`bug_384770169.pdf` — synthetic `kPiece`\n * characters in lockstep with the text, identity map, real segments);\n * - supplementary-plane text via a ToUnicode surrogate pair\n * (`embedpdf_astral_tounicode.pdf` — two lockstep surrogate entries,\n * identity map, astral content SURVIVES extraction).\n *\n * The search probe closes the loop: a hit's `charStart`/`charCount` must be\n * CHARACTER-space (segments join geometry), and slicing the snapshot by the\n * hit's range must reproduce the matched text exactly — the law that makes\n * select-this-match and copy compose.\n */\nexport interface TextDivergenceConformanceFixture extends ConformanceFixture {\n /** PDF indirect object number of the probed page. */\n pageObjectNumber: number;\n /** The EXACT extracted text (UTF-16 faithful). */\n exactText: string;\n /** The character-space size (may differ from `exactText.length`). */\n expectedCharCount: number;\n /** Expected anchors; null asserts identity (no `charMap` on the wire). */\n expectedCharMap: ReadonlyArray<CharMapAnchor> | null;\n /** Char-space slice expectations (half-open). */\n slices?: ReadonlyArray<{ from: number; to: number; text: string }>;\n /** Literal search probe with expected CHARACTER-space hit range. */\n search?: { query: string; charStart: number; charCount: number; matchedText: string };\n}\n\nexport interface TextDivergenceConformanceOptions extends Omit<ConformanceOptions, 'fixture'> {\n fixture: TextDivergenceConformanceFixture;\n}\n\nexport function runTextDivergenceConformance(\n runner: ConformanceTestRunner,\n opts: TextDivergenceConformanceOptions,\n): void {\n const { describe, test, beforeAll, afterAll, expect } = runner;\n const fixture = opts.fixture;\n\n describe(`text divergence conformance: ${opts.label} [${fixture.id}]`, () => {\n let engine: Engine;\n\n beforeAll(async () => {\n engine = await opts.makeEngine();\n });\n\n afterAll(async () => {\n if (engine) await engine.destroy();\n });\n\n test('snapshot is schema-valid with the exact text, charCount, and charMap', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const snap = await doc.page(fixture.pageObjectNumber).text.read();\n // Schema-parse enforces every charMap invariant (the {0,2} step\n // rule, tail === text.length, identity ⇔ absent).\n expect(PageTextSnapshotSchema.safeParse(snap).success).toBe(true);\n expect(snap.text).toBe(fixture.exactText);\n expect(snap.charCount).toBe(fixture.expectedCharCount);\n const anchors = snap.charMap ?? null;\n if (fixture.expectedCharMap === null) {\n expect(anchors === null || anchors.length === 0).toBe(true);\n } else {\n expect(anchors === null ? null : anchors.map((a) => [a[0], a[1]])).toEqual(\n fixture.expectedCharMap.map((a) => [a[0], a[1]]),\n );\n }\n } finally {\n await doc.close();\n }\n });\n\n test('char-space slicing round-trips through the map', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const snap = await doc.page(fixture.pageObjectNumber).text.read();\n expect(sliceTextByChars(snap, 0, snap.charCount)).toBe(snap.text);\n for (const s of fixture.slices ?? []) {\n expect(sliceTextByChars(snap, s.from, s.to)).toBe(s.text);\n }\n } finally {\n await doc.close();\n }\n });\n\n if (fixture.search) {\n const probe = fixture.search;\n test('search hits address character space and join the text by slicing', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const slice = await doc.search.query({ query: { text: probe.query }, mode: 'rects' });\n const hit = slice.matches.find(\n (m) => m.pageObjectNumber === fixture.pageObjectNumber,\n );\n expect(hit === undefined).toBe(false);\n expect(hit!.charStart).toBe(probe.charStart);\n expect(hit!.charCount).toBe(probe.charCount);\n // Geometry join: character-space segmentation produced real quads.\n expect(hit!.segments.length > 0).toBe(true);\n // The composition law: slicing the snapshot by the hit's range\n // reproduces the matched text (zero-width chars excluded).\n const snap = await doc.page(fixture.pageObjectNumber).text.read();\n expect(sliceTextByChars(snap, hit!.charStart, hit!.charStart + hit!.charCount)).toBe(\n probe.matchedText,\n );\n } finally {\n await doc.close();\n }\n });\n }\n });\n}\n\nasync function openFixture(engine: Engine, opts: TextDivergenceConformanceOptions) {\n if (opts.openKind === 'bytes') {\n const bytes = await opts.fixture.bytes();\n return engine.open({ kind: 'bytes', id: opts.fixture.id, bytes });\n }\n return engine.open({ kind: 'id', id: opts.fixture.cloudId ?? opts.fixture.id });\n}\n\n/** One divergence case, minus the per-suite bytes/id wiring. */\nexport type TextDivergenceCase = Omit<TextDivergenceConformanceFixture, 'id' | 'bytes' | 'expected'> & {\n /** Fixture file name under the fork's `testing/resources/`. */\n resource: string;\n};\n\n/**\n * THE pinned divergence cases — one table, consumed by both engines' suites\n * so expected values cannot drift. Values verified against the wasm runtime\n * (see each case). All fixtures are single-page; the page's indirect object\n * number is 3 in each.\n */\nexport const TEXT_DIVERGENCE_CASES: Readonly<Record<string, TextDivergenceCase>> = {\n /** Leading NON-PRINTING character: 31 character slots, 30 text units —\n * every text offset shifts by one, encoded by the single anchor [1, 0].\n * The searchex embeddertest for this fixture pins the same +1 shift. */\n bug1139: {\n resource: 'bug_1139.pdf',\n pageObjectNumber: 3,\n exactText: 'Hello, world!\\r\\nGoodbye, world!',\n expectedCharCount: 31,\n expectedCharMap: [[1, 0]],\n slices: [\n { from: 0, to: 1, text: '' }, // the non-printing char alone projects to nothing\n { from: 1, to: 7, text: 'Hello,' },\n { from: 16, to: 23, text: 'Goodbye' },\n ],\n search: { query: 'Goodbye', charStart: 16, charCount: 7, matchedText: 'Goodbye' },\n },\n /** `/ActualText` replacement: the span's real glyphs are REPLACED by one\n * synthetic kPiece character per ActualText character, lockstep with the\n * text (identity map), with synthesized evenly-divided boxes — so search\n * segments exist and extraction yields the ActualText, not the glyphs. */\n actualText: {\n resource: 'bug_384770169.pdf',\n pageObjectNumber: 3,\n exactText: 'What is my favorite food?',\n expectedCharCount: 25,\n expectedCharMap: null,\n slices: [{ from: 11, to: 19, text: 'favorite' }],\n search: { query: 'favorite', charStart: 11, charCount: 8, matchedText: 'favorite' },\n },\n /** Supplementary-plane text via a ToUnicode surrogate pair: PDFium stores\n * one character-list entry PER SURROGATE HALF in lockstep with the text\n * (identity map, no divergence in this representation) — and the emoji\n * SURVIVES extraction end to end. The combined-astral representation\n * (font-cmap path, one entry per code point → a [+2] anchor) is covered\n * by the charmap unit tests and the reader's divergent walk. */\n astralToUnicode: {\n resource: 'embedpdf_astral_tounicode.pdf',\n pageObjectNumber: 3,\n exactText: '😀B!',\n expectedCharCount: 4,\n expectedCharMap: null,\n slices: [\n { from: 0, to: 2, text: '😀' },\n { from: 2, to: 3, text: 'B' },\n ],\n search: { query: 'B!', charStart: 2, charCount: 2, matchedText: 'B!' },\n },\n};\n","import type {\n ConformanceTestRunner,\n ConformanceFixture,\n ConformanceOptions,\n} from './runMetadataConformance';\nimport {\n isRotatedGeometryRun,\n type PageGeometrySnapshot,\n type RotatedGeometryRun,\n} from '../dto/PageGeometrySnapshot';\nimport { pdfQuadBounds } from '../geometry/convert';\nimport type { Engine } from '../engine/Engine';\nimport { PageGeometrySnapshotSchema } from '../wire/schemas';\n\nconst FLAG_EMPTY = 2;\n/** Absolute tolerance for coordinate assertions (PDF points). */\nconst COORD_TOLERANCE = 1e-3;\n/** Tolerance for baseline-angle assertions (radians). */\nconst ANGLE_TOLERANCE = 1e-3;\n\n/**\n * Per-fixture expectations for the oriented-text geometry harness. One\n * fixture per call, mirroring the other conformance suites; the fixture\n * declares what its dominant text orientation must read back as.\n */\nexport interface PageGeometryOrientationFixture extends ConformanceFixture {\n /** PDF indirect object number of the page under test. */\n pageObjectNumber: number;\n expectation:\n | {\n /** Every run is the upright variant; no glyph carries oriented cells. */\n kind: 'upright';\n }\n | {\n /** The page loads and every glyph is degenerate (zeroed + empty flag). */\n kind: 'empty-only';\n }\n | {\n kind: 'rotated';\n /** Baseline angles (radians, CCW, PDF y-up) rotated runs may carry. */\n rotations: number[];\n ascentFlip: boolean;\n /**\n * Assert sheared cells: with `rotations` ≈ [0], a non-zero start-edge\n * x-offset proves the parallelogram (an AABB could not express it).\n */\n sheared?: boolean;\n /** Minimum number of rotated runs the page must produce (default 1). */\n minRotatedRuns?: number;\n };\n}\n\nexport interface PageGeometryOrientationOptions extends Omit<ConformanceOptions, 'fixture'> {\n fixture: PageGeometryOrientationFixture;\n}\n\nexport function runPageGeometryOrientationConformance(\n runner: ConformanceTestRunner,\n opts: PageGeometryOrientationOptions,\n): void {\n const { describe, test, beforeAll, afterAll, expect } = runner;\n\n describe(`page geometry orientation conformance: ${opts.label} [${opts.fixture.id}]`, () => {\n let engine: Engine;\n\n beforeAll(async () => {\n engine = await opts.makeEngine();\n });\n\n afterAll(async () => {\n if (engine) await engine.destroy();\n });\n\n const readSnapshot = async (): Promise<{\n snapshot: PageGeometrySnapshot;\n close: () => Promise<void>;\n }> => {\n const doc = await openFixture(engine, opts);\n const snapshot = await doc.page(opts.fixture.pageObjectNumber).geometry.read();\n return { snapshot, close: () => doc.close() };\n };\n\n test('snapshot round-trips the wire schema', async () => {\n const { snapshot, close } = await readSnapshot();\n try {\n const parsed = PageGeometrySnapshotSchema.safeParse(snapshot);\n expect(parsed.success).toBe(true);\n if (parsed.success) {\n // Strip-mode parsing must not lose anything the reader emitted —\n // a rotated run silently coerced to upright would fail this.\n expect(parsed.data).toEqual(snapshot);\n }\n } finally {\n await close();\n }\n });\n\n test('run charStart indices tile the page glyph sequence', async () => {\n const { snapshot, close } = await readSnapshot();\n try {\n let next = 0;\n for (const run of snapshot.runs) {\n expect(run.charStart).toBe(next);\n next += run.glyphs.length;\n }\n } finally {\n await close();\n }\n });\n\n test('runs match the fixture orientation expectation', async () => {\n const { snapshot, close } = await readSnapshot();\n try {\n const expectation = opts.fixture.expectation;\n if (expectation.kind === 'upright') {\n for (const run of snapshot.runs) {\n expect(isRotatedGeometryRun(run)).toBe(false);\n if (isRotatedGeometryRun(run)) continue;\n for (const glyph of run.glyphs) {\n expect('looseQuad' in glyph).toBe(false);\n if (glyph.flags & FLAG_EMPTY) {\n // Degenerate glyphs keep the legacy zeroed-box convention.\n expect(glyph.looseBox).toEqual({ left: 0, bottom: 0, right: 0, top: 0 });\n }\n }\n }\n return;\n }\n\n if (expectation.kind === 'empty-only') {\n for (const run of snapshot.runs) {\n expect(isRotatedGeometryRun(run)).toBe(false);\n if (isRotatedGeometryRun(run)) continue;\n for (const glyph of run.glyphs) {\n expect(glyph.flags & FLAG_EMPTY).toBe(FLAG_EMPTY);\n expect(glyph.looseBox).toEqual({ left: 0, bottom: 0, right: 0, top: 0 });\n }\n }\n return;\n }\n\n const rotatedRuns = snapshot.runs.filter(isRotatedGeometryRun);\n expect(rotatedRuns.length >= (expectation.minRotatedRuns ?? 1)).toBe(true);\n\n for (const run of rotatedRuns) {\n expect(\n expectation.rotations.some((angle) =>\n angleClose(run.rotation, angle, ANGLE_TOLERANCE),\n ),\n ).toBe(true);\n expect(run.ascentFlip).toBe(expectation.ascentFlip);\n assertRotatedRunGeometry(run);\n }\n\n if (expectation.sheared) {\n const shearedGlyphs = rotatedRuns\n .flatMap((run) => run.glyphs)\n .filter(\n (glyph) =>\n (glyph.flags & FLAG_EMPTY) === 0 &&\n Math.abs(glyph.looseQuad.p3.x - glyph.looseQuad.p1.x) > 1,\n );\n expect(shearedGlyphs.length > 0).toBe(true);\n }\n } finally {\n await close();\n }\n });\n\n function assertRotatedRunGeometry(run: RotatedGeometryRun): void {\n for (const glyph of run.glyphs) {\n if (glyph.flags & FLAG_EMPTY) {\n expect(glyph.looseQuad).toEqual({\n p1: { x: 0, y: 0 },\n p2: { x: 0, y: 0 },\n p3: { x: 0, y: 0 },\n p4: { x: 0, y: 0 },\n });\n continue;\n }\n const q = glyph.looseQuad;\n // The cell is a parallelogram: both baseline-direction edges match,\n // and both side edges match (slots: p1 US, p2 UE, p3 LS, p4 LE).\n expect(Math.abs(q.p2.x - q.p1.x - (q.p4.x - q.p3.x)) <= COORD_TOLERANCE).toBe(true);\n expect(Math.abs(q.p2.y - q.p1.y - (q.p4.y - q.p3.y)) <= COORD_TOLERANCE).toBe(true);\n // Contained in the run's page-space AABB.\n const bounds = pdfQuadBounds(q);\n expect(bounds.left >= run.rect.left - COORD_TOLERANCE).toBe(true);\n expect(bounds.right <= run.rect.right + COORD_TOLERANCE).toBe(true);\n expect(bounds.bottom >= run.rect.bottom - COORD_TOLERANCE).toBe(true);\n expect(bounds.top <= run.rect.top + COORD_TOLERANCE).toBe(true);\n }\n }\n });\n}\n\nfunction angleClose(a: number, b: number, tolerance: number): boolean {\n const delta = a - b;\n return Math.abs(Math.atan2(Math.sin(delta), Math.cos(delta))) <= tolerance;\n}\n\nasync function openFixture(engine: Engine, opts: PageGeometryOrientationOptions) {\n if (opts.openKind === 'bytes') {\n const bytes = await opts.fixture.bytes();\n return engine.open({ kind: 'bytes', id: opts.fixture.id, bytes });\n }\n return engine.open({ kind: 'id', id: opts.fixture.cloudId ?? opts.fixture.id });\n}\n","import type {\n ConformanceTestRunner,\n ConformanceFixture,\n ConformanceOptions,\n} from './runMetadataConformance';\nimport type { Engine } from '../engine/Engine';\nimport { EngineError } from '../errors/EngineError';\nimport { EngineErrorCode } from '../errors/EngineErrorCode';\nimport { AbortError } from '../promise/AbortError';\nimport { foldText } from '../search/fold';\nimport type { SearchMatch, SearchSlice } from '../search/types';\nimport { SearchSliceSchema } from '../wire/schemas';\n\n/**\n * Per-fixture expectations for the search harness. Suites supply a\n * literal known to be on a specific page, one known to be nowhere, and a\n * regex with a predictable hit — the harness asserts behavior (offsets,\n * rects, snippets, cursor mechanics, dialect rejection), never exact\n * match counts, so PDFium text-extraction tweaks don't require edits.\n */\nexport interface SearchConformanceFixture extends ConformanceFixture {\n /** Literal present in the document at least once. */\n presentLiteral: string;\n /** A page (pon) guaranteed to carry a `presentLiteral` match. */\n presentPageObjectNumber: number;\n /** Literal guaranteed to match nowhere. */\n absentLiteral: string;\n /** Dialect-valid regex with at least one match in the document. */\n presentRegex: string;\n}\n\nexport interface SearchConformanceOptions extends Omit<ConformanceOptions, 'fixture'> {\n fixture: SearchConformanceFixture;\n}\n\nexport function runSearchConformance(\n runner: ConformanceTestRunner,\n opts: SearchConformanceOptions,\n): void {\n const { describe, test, beforeAll, afterAll, expect } = runner;\n const fixture = opts.fixture;\n\n /** Drive the cursor loop to exhaustion; assert each slice parses. */\n async function collectAll(\n doc: Awaited<ReturnType<Engine['open']>>,\n request: Parameters<typeof doc.search.query>[0],\n ): Promise<{ matches: SearchMatch[]; slices: SearchSlice[] }> {\n const matches: SearchMatch[] = [];\n const slices: SearchSlice[] = [];\n let cursor: string | undefined;\n for (;;) {\n const slice = await doc.search.query({ ...request, cursor });\n expect(SearchSliceSchema.safeParse(slice).success).toBe(true);\n matches.push(...slice.matches);\n slices.push(slice);\n if (slice.nextCursor === null) return { matches, slices };\n cursor = slice.nextCursor;\n }\n }\n\n describe(`search conformance: ${opts.label}`, () => {\n let engine: Engine;\n\n beforeAll(async () => {\n engine = await opts.makeEngine();\n });\n\n afterAll(async () => {\n if (engine) await engine.destroy();\n });\n\n test('finds the present literal with sane matches', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const { matches } = await collectAll(doc, {\n query: { text: fixture.presentLiteral },\n });\n expect(matches.length > 0).toBe(true);\n expect(matches.some((m) => m.pageObjectNumber === fixture.presentPageObjectNumber)).toBe(\n true,\n );\n for (const m of matches) {\n expect(m.charCount > 0).toBe(true);\n expect(m.segments.length > 0).toBe(true);\n for (const s of m.segments) {\n expect(s.rect.right > s.rect.left).toBe(true);\n expect(s.rect.top > s.rect.bottom).toBe(true);\n // The pair is one constructor's output — enforce it stayed that way.\n const xs = [s.quad.p1.x, s.quad.p2.x, s.quad.p3.x, s.quad.p4.x];\n const ys = [s.quad.p1.y, s.quad.p2.y, s.quad.p3.y, s.quad.p4.y];\n expect(Math.abs(s.rect.left - Math.min(...xs)) < 1e-3).toBe(true);\n expect(Math.abs(s.rect.right - Math.max(...xs)) < 1e-3).toBe(true);\n expect(Math.abs(s.rect.bottom - Math.min(...ys)) < 1e-3).toBe(true);\n expect(Math.abs(s.rect.top - Math.max(...ys)) < 1e-3).toBe(true);\n expect(s.advance === 1 || s.advance === -1).toBe(true);\n }\n }\n } finally {\n await doc.close();\n }\n });\n\n test('matching is case-insensitive by default', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const lower = await collectAll(doc, {\n query: { text: fixture.presentLiteral.toLowerCase() },\n });\n const upper = await collectAll(doc, {\n query: { text: fixture.presentLiteral.toUpperCase() },\n });\n expect(lower.matches.length).toBe(upper.matches.length);\n expect(lower.matches.length > 0).toBe(true);\n } finally {\n await doc.close();\n }\n });\n\n test(\"'full' snippets reproduce the matched text; 'rects' carries none\", async () => {\n const doc = await openFixture(engine, opts);\n try {\n const full = await collectAll(doc, {\n query: { text: fixture.presentLiteral },\n mode: 'full',\n });\n for (const m of full.matches) {\n expect(!!m.snippet).toBe(true);\n const s = m.snippet!;\n const hit = s.text.slice(s.matchStart, s.matchStart + s.matchLength);\n // Fold both sides: the snippet keeps the page's original case\n // and (1:1-flattened) whitespace.\n expect(foldText(hit).folded).toBe(foldText(fixture.presentLiteral).folded);\n }\n const rects = await collectAll(doc, {\n query: { text: fixture.presentLiteral },\n mode: 'rects',\n });\n expect(rects.matches.length).toBe(full.matches.length);\n for (const m of rects.matches) expect(m.snippet === undefined).toBe(true);\n } finally {\n await doc.close();\n }\n });\n\n test('the absent literal exhausts with zero matches', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const { matches, slices } = await collectAll(doc, {\n query: { text: fixture.absentLiteral },\n });\n expect(matches.length).toBe(0);\n const last = slices[slices.length - 1];\n expect(last.nextCursor).toBe(null);\n expect(last.totalPages > 0).toBe(true);\n } finally {\n await doc.close();\n }\n });\n\n test('a one-page budget walks the whole document via the cursor', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const whole = await collectAll(doc, {\n query: { text: fixture.presentLiteral },\n });\n const sliced = await collectAll(doc, {\n query: { text: fixture.presentLiteral },\n budget: { maxPages: 1 },\n });\n expect(sliced.matches.length).toBe(whole.matches.length);\n const last = sliced.slices[sliced.slices.length - 1];\n expect(last.scannedPages).toBe(last.totalPages);\n expect(sliced.slices.length).toBe(last.totalPages);\n } finally {\n await doc.close();\n }\n });\n\n test('startPage rotates the scan order (viewport-first)', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const slice = await doc.search.query({\n query: { text: fixture.presentLiteral },\n startPage: fixture.presentPageObjectNumber,\n budget: { maxPages: 1 },\n });\n expect(slice.matches.length > 0).toBe(true);\n expect(slice.matches[0].pageObjectNumber).toBe(fixture.presentPageObjectNumber);\n } finally {\n await doc.close();\n }\n });\n\n test('a cursor replayed against a different query is rejected', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const first = await doc.search.query({\n query: { text: fixture.presentLiteral },\n budget: { maxPages: 1 },\n });\n expect(first.nextCursor !== null).toBe(true);\n let caught: unknown;\n try {\n await doc.search.query({\n query: { text: fixture.absentLiteral },\n cursor: first.nextCursor!,\n });\n } catch (err) {\n caught = err;\n }\n expect(EngineError.is(caught, EngineErrorCode.InvalidArg)).toBe(true);\n } finally {\n await doc.close();\n }\n });\n\n test('a malformed cursor is rejected', async () => {\n const doc = await openFixture(engine, opts);\n try {\n let caught: unknown;\n try {\n await doc.search.query({\n query: { text: fixture.presentLiteral },\n cursor: 'not a cursor',\n });\n } catch (err) {\n caught = err;\n }\n expect(EngineError.is(caught, EngineErrorCode.InvalidArg)).toBe(true);\n } finally {\n await doc.close();\n }\n });\n\n test('regex queries match with offsets and rects', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const { matches } = await collectAll(doc, {\n query: { text: fixture.presentRegex, regex: true },\n });\n expect(matches.length > 0).toBe(true);\n for (const m of matches) {\n expect(m.charCount > 0).toBe(true);\n expect(m.segments.length > 0).toBe(true);\n }\n } finally {\n await doc.close();\n }\n });\n\n test('regex flags are restrictions: matchCase and wholeWord return subsets', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const all = await collectAll(doc, {\n query: { text: fixture.presentRegex, regex: true },\n });\n const key = (m: SearchMatch) => `${m.pageObjectNumber}:${m.charStart}:${m.charCount}`;\n const allKeys = new Set(all.matches.map(key));\n // Each flag can only REMOVE matches, never invent them — true for\n // any fixture pattern, so the suite needs no per-fixture counts.\n for (const flags of [{ matchCase: true }, { wholeWord: true }]) {\n const restricted = await collectAll(doc, {\n query: { text: fixture.presentRegex, regex: true, ...flags },\n });\n expect(restricted.matches.length <= all.matches.length).toBe(true);\n for (const m of restricted.matches) expect(allKeys.has(key(m))).toBe(true);\n }\n } finally {\n await doc.close();\n }\n });\n\n test('ignoreWhitespace keeps every default hit and finds the space-free needle', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const key = (m: SearchMatch) => `${m.pageObjectNumber}:${m.charStart}:${m.charCount}`;\n const plain = await collectAll(doc, { query: { text: fixture.presentLiteral } });\n // Dropping whitespace can only ADD matches over the collapsing default\n // fold — every default hit survives, at the same place.\n const relaxed = await collectAll(doc, {\n query: { text: fixture.presentLiteral, ignoreWhitespace: true },\n });\n const relaxedKeys = new Set(relaxed.matches.map(key));\n for (const m of plain.matches) expect(relaxedKeys.has(key(m))).toBe(true);\n // ...and the needle no longer needs the page's spaces.\n const squashed = await collectAll(doc, {\n query: { text: fixture.presentLiteral.replace(/\\s+/g, ''), ignoreWhitespace: true },\n });\n expect(squashed.matches.map(key)).toEqual(relaxed.matches.map(key));\n } finally {\n await doc.close();\n }\n });\n\n test('regex + matchDiacritics / ignoreWhitespace are rejected with InvalidArg', async () => {\n const doc = await openFixture(engine, opts);\n try {\n for (const flags of [{ matchDiacritics: true }, { ignoreWhitespace: true }]) {\n let caught: unknown;\n try {\n await doc.search.query({\n query: { text: fixture.presentRegex, regex: true, ...flags },\n });\n } catch (err) {\n caught = err;\n }\n expect(EngineError.is(caught, EngineErrorCode.InvalidArg)).toBe(true);\n }\n } finally {\n await doc.close();\n }\n });\n\n test('dialect violations are rejected with InvalidArg', async () => {\n const doc = await openFixture(engine, opts);\n try {\n for (const pattern of ['(a)\\\\1', '(?=x)y', '(']) {\n let caught: unknown;\n try {\n await doc.search.query({ query: { text: pattern, regex: true } });\n } catch (err) {\n caught = err;\n }\n expect(EngineError.is(caught, EngineErrorCode.InvalidArg)).toBe(true);\n }\n } finally {\n await doc.close();\n }\n });\n\n test('an empty needle returns an exhausted, empty slice', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const slice = await doc.search.query({ query: { text: ' ' } });\n expect(slice.matches.length).toBe(0);\n expect(slice.nextCursor).toBe(null);\n } finally {\n await doc.close();\n }\n });\n\n test('abort() on query rejects with AbortError', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const p = doc.search.query({ query: { text: fixture.presentLiteral } });\n p.abort('test');\n await expect(p).rejects.toBeInstanceOf(AbortError);\n } finally {\n await doc.close();\n }\n });\n\n test('query after close throws DocNotOpen', async () => {\n const doc = await openFixture(engine, opts);\n await doc.close();\n let caught: unknown;\n try {\n await doc.search.query({ query: { text: fixture.presentLiteral } });\n } catch (err) {\n caught = err;\n }\n expect(EngineError.is(caught, EngineErrorCode.DocNotOpen)).toBe(true);\n });\n });\n}\n\nasync function openFixture(engine: Engine, opts: SearchConformanceOptions) {\n if (opts.openKind === 'bytes') {\n const bytes = await opts.fixture.bytes();\n return engine.open({ kind: 'bytes', id: opts.fixture.id, bytes });\n }\n return engine.open({ kind: 'id', id: opts.fixture.cloudId ?? opts.fixture.id });\n}\n","import type {\n AnnotationListPageSnapshot,\n AnnotationListSnapshotAllPages,\n} from '../annotation/AnnotationListSnapshot';\nimport type { AnnotationDTO } from '../annotation/kinds';\n\n/**\n * Returns a list of human-readable difference strings between two\n * snapshots. Empty array means parity. Used by `engine-node.ts` to assert\n * that local and cloud emit identical annotations for the same fixture.\n *\n * `RevisionToken.docSessionId` is intentionally NOT compared — sessions\n * are disjoint. We do compare `pageObjectNumber` and `generation` (which\n * should be 0 for fresh reads on both sides). Page order is no longer part\n * of `PageState`; it lives in `PageLayout.index` (see `pages.list()`).\n * `auditHead` is likewise not compared: it is a cloud-only reconciliation\n * cursor, absent on local snapshots by design.\n */\nexport function diffAnnotationListSnapshot(\n a: AnnotationListPageSnapshot,\n b: AnnotationListPageSnapshot,\n): string[] {\n const errs: string[] = [];\n\n if (a.pageState.pageObjectNumber !== b.pageState.pageObjectNumber) {\n errs.push(\n `pageState.pageObjectNumber mismatch: ${a.pageState.pageObjectNumber} vs ${b.pageState.pageObjectNumber}`,\n );\n }\n if (\n JSON.stringify(a.pageState.weakAnnotationState) !==\n JSON.stringify(b.pageState.weakAnnotationState)\n ) {\n errs.push(\n `pageState.weakAnnotationState mismatch: ${JSON.stringify(\n a.pageState.weakAnnotationState,\n )} vs ${JSON.stringify(b.pageState.weakAnnotationState)}`,\n );\n }\n if (a.pageState.revision.generation !== b.pageState.revision.generation) {\n errs.push(\n `pageState.revision.generation mismatch: ${a.pageState.revision.generation} vs ${b.pageState.revision.generation}`,\n );\n }\n if (a.annotations.length !== b.annotations.length) {\n errs.push(`annotations.length mismatch: ${a.annotations.length} vs ${b.annotations.length}`);\n }\n\n const n = Math.min(a.annotations.length, b.annotations.length);\n for (let i = 0; i < n; i++) {\n const aa = a.annotations[i]!;\n const bb = b.annotations[i]!;\n diffAnnotation(i, aa, bb, errs);\n }\n\n return errs;\n}\n\nexport function diffAnnotationListSnapshotAll(\n a: AnnotationListSnapshotAllPages,\n b: AnnotationListSnapshotAllPages,\n): string[] {\n const errs: string[] = [];\n if (a.pages.length !== b.pages.length) {\n errs.push(`pages.length mismatch: ${a.pages.length} vs ${b.pages.length}`);\n }\n const n = Math.min(a.pages.length, b.pages.length);\n for (let i = 0; i < n; i++) {\n const pageErrs = diffAnnotationListSnapshot(a.pages[i]!, b.pages[i]!);\n for (const e of pageErrs) {\n errs.push(`page[${i}]: ${e}`);\n }\n }\n return errs;\n}\n\nfunction diffAnnotation(i: number, a: AnnotationDTO, b: AnnotationDTO, errs: string[]): void {\n if (a.subtype !== b.subtype) {\n errs.push(`annotations[${i}].subtype mismatch: ${a.subtype} vs ${b.subtype}`);\n return;\n }\n if (a.identityQuality !== b.identityQuality) {\n errs.push(\n `annotations[${i}].identityQuality mismatch: ${a.identityQuality} vs ${b.identityQuality}`,\n );\n }\n if (a.ref.kind !== b.ref.kind) {\n errs.push(`annotations[${i}].ref.kind mismatch: ${a.ref.kind} vs ${b.ref.kind}`);\n }\n if (a.ref.kind === 'objectNumber' && b.ref.kind === 'objectNumber') {\n if (a.ref.annotObjectNumber !== b.ref.annotObjectNumber) {\n errs.push(\n `annotations[${i}].ref.annotObjectNumber mismatch: ${a.ref.annotObjectNumber} vs ${b.ref.annotObjectNumber}`,\n );\n }\n }\n if (a.nm !== b.nm) {\n errs.push(`annotations[${i}].nm mismatch: ${a.nm} vs ${b.nm}`);\n }\n}\n","import type { ConformanceFixture, ConformanceTestRunner } from './runMetadataConformance';\nimport type { DocumentHandle } from '../engine/DocumentHandle';\nimport type { Engine } from '../engine/Engine';\nimport { EngineError } from '../errors/EngineError';\nimport { EngineErrorCode } from '../errors/EngineErrorCode';\n\nexport interface SignatureConformanceFixtures {\n /** A form with no signature fields at all. */\n unsignedForm: ConformanceFixture;\n /**\n * Three revisions: the original, an approval signature sealing revision\n * 1, and a form fill plus a second approval signature sealing revision\n * 2. Both signatures have whole-revision coverage; `textField` is the\n * filled text field.\n */\n twoApprovals: ConformanceFixture & { fieldNames: [string, string]; textField: string };\n /** Two revisions: a certification signature with permission 2 sealing revision 1. */\n certified: ConformanceFixture & { fieldName: string };\n /** Two revisions: one approval signature whose FieldMDP includes `lockedField`. */\n fieldMdp: ConformanceFixture & { fieldName: string; lockedField: string };\n /** Three chained revisions, two signatures whose ranges are well-formed but seal no revision. */\n partialChain: ConformanceFixture;\n /** One unsigned signature field (with a widget) and one text field, nothing signed. */\n unsignedSigField: ConformanceFixture & { fieldName: string; textField: string };\n /** Any single-page PDF, used as signature artwork. */\n artwork: ConformanceFixture;\n}\n\nexport interface SignatureConformanceOptions {\n label: string;\n makeEngine: () => Promise<Engine> | Engine;\n /**\n * An engine constructed with `signedDocumentPolicy: 'permit'`; the\n * suite proves the protection it lifts. Omit where the engine has no\n * such option.\n */\n makePermitEngine?: () => Promise<Engine> | Engine;\n /** `layerBytes` opens each fixture as an immutable base with a fresh layer on top. */\n openKind: 'bytes' | 'layerBytes' | 'id';\n fixtures: SignatureConformanceFixtures;\n}\n\n/**\n * Digital signatures, read side. The service is OPTIONAL on the contract\n * (`downloadLayer?` pattern) — the suite runs only where the engine\n * provides it.\n *\n * Invariants:\n * 1. Byte facts describe the LOADED bytes: a revision is a byte prefix,\n * a whole-revision signature seals exactly one, the digest over its\n * `/ByteRange` is what the file's bytes hash to, and an unsaved edit\n * changes none of it.\n * 2. Protection is derived from the signatures in the file and applied\n * as document-derived capabilities: a certification with permission 2\n * takes page assembly and annotation writes away, a FieldMDP freezes\n * the fields it names, a rewrite save is refused. Under\n * `signedDocumentPolicy: 'permit'` none of that applies and the\n * analysis is unchanged.\n * 3. The same answers come from a plain session and from a layer\n * session over the same bytes.\n */\nexport function runSignatureConformance(\n runner: ConformanceTestRunner,\n opts: SignatureConformanceOptions,\n): void {\n const { describe, test, beforeAll, afterAll, expect } = runner;\n\n describe(`signatures conformance: ${opts.label}`, () => {\n let engine: Engine;\n let permitEngine: Engine | null = null;\n let supported = false;\n\n beforeAll(async () => {\n engine = await opts.makeEngine();\n const probe = await open(engine, opts, opts.fixtures.unsignedForm);\n supported = probe.signatures !== undefined;\n await probe.close();\n if (supported && opts.makePermitEngine) permitEngine = await opts.makePermitEngine();\n });\n\n afterAll(async () => {\n if (permitEngine) await permitEngine.destroy();\n if (engine) await engine.destroy();\n });\n\n test('an unsigned form has no signatures and no protection; version() hashes the loaded bytes', async () => {\n if (!supported) return;\n const bytes = await opts.fixtures.unsignedForm.bytes();\n const doc = await open(engine, opts, opts.fixtures.unsignedForm);\n try {\n const snapshot = await doc.signatures!.list();\n expect(snapshot.chainValid).toBe(true);\n expect(snapshot.signatures).toEqual([]);\n expect(snapshot.revisions.length >= 1).toBe(true);\n expect(snapshot.protection.judged).toBeNull();\n expect(snapshot.protection.enforced).toBeNull();\n expect(snapshot.protection.certification).toBeNull();\n expect(snapshot.protection.fieldLocks).toEqual([]);\n expect(doc.security.allows('doc.pages.assemble')).toBe(true);\n if (doc.version) {\n const version = await doc.version();\n expect(version.byteLength).toBe(bytes.byteLength);\n expect(version.sha256).toBe(await sha256Hex(bytes));\n }\n let caught: unknown;\n try {\n await doc.signatures!.contents({ kind: 'fqn', name: 'no-such-field' });\n } catch (err) {\n caught = err;\n }\n expect(EngineError.is(caught, EngineErrorCode.NotFound)).toBe(true);\n } finally {\n await doc.close();\n }\n });\n\n test('two approval signatures: revisions, coverage, digests, contents, revision bytes', async () => {\n if (!supported) return;\n const fixture = opts.fixtures.twoApprovals;\n const bytes = await fixture.bytes();\n const doc = await open(engine, opts, fixture);\n try {\n const snapshot = await doc.signatures!.list();\n expect(snapshot.chainValid).toBe(true);\n expect(snapshot.revisions).toHaveLength(3);\n expect(snapshot.signatures).toHaveLength(2);\n expect(snapshot.revisions[2].end).toBe(bytes.byteLength);\n for (const [i, sig] of snapshot.signatures.entries()) {\n expect(sig.index).toBe(i);\n expect(sig.signed).toBe(true);\n expect(sig.kind).toBe('signature');\n expect(sig.field.kind).toBe('objectNumber');\n expect(sig.fieldName).toBe(fixture.fieldNames[i]);\n expect(sig.coverage).toBe('whole-revision');\n expect(sig.revisionIndex).toBe(i + 1);\n expect(snapshot.revisions[i + 1].signatureIndex).toBe(i);\n expect(sig.subFilter).toBe('ETSI.CAdES.detached');\n expect(typeof sig.signer.claimedTime).toBe('string');\n expect(sig.docMdp).toBeNull();\n expect(sig.catalogCertification).toBe(false);\n expect(sig.contentsSize > 0).toBe(true);\n expect(sig.byteRange![0]).toBe(0);\n expect(sig.byteRange![2] + sig.byteRange![3]).toBe(snapshot.revisions[i + 1].end);\n }\n // Approval signatures without a certification: nothing declared, judged at the baseline.\n expect(snapshot.protection.judged).toBe('annotate');\n expect(snapshot.protection.enforced).toBeNull();\n expect(snapshot.protection.certification).toBeNull();\n expect(snapshot.protection.fieldLocks).toEqual([]);\n\n // The DER object, exactly as long as its TLV declares.\n const first = snapshot.signatures[0];\n const contents = await doc.signatures!.contents(first.field);\n expect(contents.byteLength).toBe(first.contentsSize);\n expect(contents[0]).toBe(0x30);\n\n // The digest is what the file's own bytes hash to over the range.\n const [a, b, c, d] = first.byteRange!;\n const sealed = await doc.signatures!.revisionBytes(1);\n expect(sealed.byteLength).toBe(snapshot.revisions[1].end);\n expect(bytesEqual(sealed, bytes.subarray(0, sealed.byteLength))).toBe(true);\n const signedBytes = concat(sealed.subarray(a, a + b), sealed.subarray(c, c + d));\n const digest = await doc.signatures!.digest(first.field, 'sha256');\n expect(digest.byteLength).toBe(32);\n expect(toHex(digest)).toBe(await sha256Hex(signedBytes));\n // Any algorithm, same protocol.\n expect((await doc.signatures!.digest(first.field, 'sha512')).byteLength).toBe(64);\n // fqn refs resolve too.\n const byName = await doc.signatures!.digest(\n { kind: 'fqn', name: first.fieldName },\n 'sha256',\n );\n expect(toHex(byName)).toBe(toHex(digest));\n\n // An unsaved edit is not a revision: the byte facts do not move.\n const fields = await doc.forms.list();\n const text = fields.fields.find((f) => f.name === fixture.textField)!;\n expect(text).toBeTruthy();\n await doc.forms.setValue(\n { kind: 'objectNumber', fieldObjectNumber: text.fieldObjectNumber },\n {\n type: 'text',\n value: 'unsaved',\n },\n );\n const again = await doc.signatures!.list();\n expect(again.revisions).toEqual(snapshot.revisions);\n expect(again.signatures.map((s) => [s.coverage, s.revisionIndex, s.byteRange])).toEqual(\n snapshot.signatures.map((s) => [s.coverage, s.revisionIndex, s.byteRange]),\n );\n expect(toHex(await doc.signatures!.digest(first.field, 'sha256'))).toBe(toHex(digest));\n if (doc.version) {\n expect((await doc.version()).sha256).toBe(await sha256Hex(bytes));\n }\n } finally {\n await doc.close();\n }\n });\n\n test('a certification takes structural capabilities away; permit lifts it', async () => {\n if (!supported) return;\n const fixture = opts.fixtures.certified;\n const doc = await open(engine, opts, fixture);\n try {\n const snapshot = await doc.signatures!.list();\n const signed = snapshot.signatures.filter((s) => s.signed);\n expect(signed).toHaveLength(1);\n const sig = signed[0];\n expect(sig.fieldName).toBe(fixture.fieldName);\n expect(sig.coverage).toBe('whole-revision');\n expect(sig.docMdp).toBe(2);\n expect(sig.catalogCertification).toBe(true);\n expect(snapshot.protection.judged).toBe('fill');\n expect(snapshot.protection.enforced).toBe('fill');\n expect(snapshot.protection.certification).toEqual({\n signatureIndex: sig.index,\n permission: 2,\n });\n\n expect(doc.security.allows('doc.forms.read')).toBe(true);\n expect(doc.security.allows('doc.forms.fill')).toBe(true);\n expect(doc.security.allows('doc.annotate.modify')).toBe(false);\n expect(doc.security.allows('doc.pages.assemble')).toBe(false);\n expect(doc.security.allows('doc.redact')).toBe(false);\n\n const list = await doc.pages.list();\n let caught: unknown;\n try {\n await doc.pages.delete([list.pages[0].pageObjectNumber]);\n } catch (err) {\n caught = err;\n }\n expect(EngineError.is(caught, EngineErrorCode.ProtectedDocument)).toBe(true);\n\n caught = undefined;\n try {\n await doc.download({ mode: 'rewrite' });\n } catch (err) {\n caught = err;\n }\n expect(EngineError.is(caught, EngineErrorCode.ProtectedDocument)).toBe(true);\n // An incremental save keeps the signature; the read side agrees.\n const saved = await doc.download();\n expect(saved.byteLength >= snapshot.revisions[1].end).toBe(true);\n } finally {\n await doc.close();\n }\n\n if (!permitEngine) return;\n const permitted = await open(permitEngine, opts, fixture);\n try {\n // Analysis is policy-independent; enforcement is not.\n const snapshot = await permitted.signatures!.list();\n expect(snapshot.protection.judged).toBe('fill');\n expect(snapshot.protection.enforced).toBe('fill');\n expect(permitted.security.allows('doc.pages.assemble')).toBe(true);\n const rewritten = await permitted.download({ mode: 'rewrite' });\n expect(rewritten.byteLength > 0).toBe(true);\n } finally {\n await permitted.close();\n }\n });\n\n test('a FieldMDP freezes the fields it names; permit lifts it', async () => {\n if (!supported) return;\n const fixture = opts.fixtures.fieldMdp;\n const doc = await open(engine, opts, fixture);\n const lockedRef = { kind: 'fqn', name: fixture.lockedField } as const;\n try {\n const snapshot = await doc.signatures!.list();\n const sig = snapshot.signatures[0];\n expect(sig.fieldName).toBe(fixture.fieldName);\n expect(sig.fieldMdp).toEqual({ action: 'include', fields: [fixture.lockedField] });\n expect(snapshot.protection.judged).toBe('annotate');\n expect(snapshot.protection.enforced).toBeNull();\n // The FieldMDP, and the /Lock the authoring engine mirrors it with\n // when it wrote the field — both name the same fields.\n expect(snapshot.protection.fieldLocks[0]).toEqual({\n signatureIndex: 0,\n source: 'fieldmdp',\n spec: { action: 'include', fields: [fixture.lockedField] },\n });\n for (const lock of snapshot.protection.fieldLocks) {\n expect(lock.signatureIndex).toBe(0);\n expect(lock.spec).toEqual({ action: 'include', fields: [fixture.lockedField] });\n }\n // Filling in general is still allowed; THIS field is not.\n expect(doc.security.allows('doc.forms.fill')).toBe(true);\n let caught: unknown;\n try {\n await doc.forms.setValue(lockedRef, { type: 'text', value: 'changed' });\n } catch (err) {\n caught = err;\n }\n expect(EngineError.is(caught, EngineErrorCode.ProtectedDocument)).toBe(true);\n const field = await doc.forms.get(lockedRef);\n expect(field.family).toBe('text');\n expect((field as { value?: string }).value === 'changed').toBe(false);\n } finally {\n await doc.close();\n }\n\n if (!permitEngine) return;\n const permitted = await open(permitEngine, opts, fixture);\n try {\n const result = await permitted.forms.setValue(lockedRef, {\n type: 'text',\n value: 'changed',\n });\n expect(result.field.name).toBe(fixture.lockedField);\n } finally {\n await permitted.close();\n }\n });\n\n test('well-formed ranges that seal no revision are partial, with no revision index', async () => {\n if (!supported) return;\n const doc = await open(engine, opts, opts.fixtures.partialChain);\n try {\n const snapshot = await doc.signatures!.list();\n expect(snapshot.chainValid).toBe(true);\n expect(snapshot.revisions).toHaveLength(3);\n expect(snapshot.signatures).toHaveLength(2);\n for (const sig of snapshot.signatures) {\n expect(sig.signed).toBe(true);\n expect(sig.coverage).toBe('partial');\n expect(sig.revisionIndex).toBeNull();\n expect(sig.contentsSize).toBe(13);\n expect((await doc.signatures!.contents(sig.field)).byteLength).toBe(13);\n expect((await doc.signatures!.digest(sig.field, 'sha256')).byteLength).toBe(32);\n }\n expect(snapshot.revisions.every((r) => r.signatureIndex === null)).toBe(true);\n // Signed, so judged at the approval baseline — even a partial one is a signature.\n expect(snapshot.protection.judged).toBe('annotate');\n expect(snapshot.protection.enforced).toBeNull();\n let caught: unknown;\n try {\n await doc.signatures!.revisionBytes(3);\n } catch (err) {\n caught = err;\n }\n expect(EngineError.is(caught, EngineErrorCode.NotFound)).toBe(true);\n } finally {\n await doc.close();\n }\n });\n\n if (opts.openKind !== 'id') {\n runSigningTests(\n runner,\n opts,\n () => engine,\n () => supported,\n );\n runAnalysisTests(\n runner,\n opts,\n () => engine,\n () => permitEngine,\n () => supported,\n );\n }\n });\n}\n\nfunction runAnalysisTests(\n runner: ConformanceTestRunner,\n opts: SignatureConformanceOptions,\n engineOf: () => Engine,\n permitEngineOf: () => Engine | null,\n supported: () => boolean,\n): void {\n const { test, expect } = runner;\n\n test('analyze: a form fill and a second signature after an approval are permitted', async () => {\n if (!supported()) return;\n const doc = await open(engineOf(), opts, opts.fixtures.twoApprovals);\n try {\n const analysis = await doc.signatures!.analyze({ since: { signatureIndex: 0 } });\n expect(analysis.mode).toBe('authoritative');\n expect(analysis.basis.source).toBe('persisted');\n expect(analysis.since).toEqual({ revisionIndex: 1, signatureIndex: 0 });\n expect(analysis.until.revisionIndex).toBe(2);\n expect(analysis.steps).toHaveLength(1);\n const [step] = analysis.steps;\n expect(step.levelInForce).toBe('annotate');\n expect(step.verdict).toBe('permitted');\n expect(step.changes.length > 0).toBe(true);\n const rules = new Set(\n step.findings.filter((f) => f.verdict === 'permitted').map((f) => f.rule),\n );\n expect(rules.has('form-fill')).toBe(true);\n expect(rules.has('signature-added')).toBe(true);\n expect(step.findings.filter((f) => f.verdict === 'forbidden')).toEqual([]);\n expect(analysis.verdict).toBe('permitted');\n // The last signature has nothing after it.\n const latest = await doc.signatures!.analyze({ since: { signatureIndex: 1 } });\n expect(latest.steps).toHaveLength(0);\n expect(latest.verdict).toBe('unchanged');\n // History only: from the original revision up to the first signature.\n const historic = await doc.signatures!.analyze({\n since: { revisionIndex: 0 },\n until: { revisionIndex: 1 },\n });\n expect(historic.steps).toHaveLength(1);\n expect(historic.verdict).toBe('permitted');\n } finally {\n await doc.close();\n }\n });\n\n test('analyze: the working copy is one more revision; a partial signature cannot anchor', async () => {\n if (!supported()) return;\n const fx = opts.fixtures.unsignedSigField;\n const doc = await open(engineOf(), opts, fx);\n try {\n const prepared = await doc.signatures!.prepare({\n field: { kind: 'fqn', name: fx.fieldName },\n certify: { permission: 2 },\n });\n await doc.signatures!.complete({\n signingId: prepared.signingId,\n cms: FAKE_CMS,\n expectedVersion: prepared.expectedVersion,\n });\n const clean = await doc.signatures!.analyze({\n since: { signatureIndex: 0 },\n until: 'working-copy',\n });\n expect(clean.steps).toHaveLength(0);\n expect(clean.verdict).toBe('unchanged');\n await doc.forms.setValue(\n { kind: 'fqn', name: fx.textField },\n { type: 'text', value: 'draft' },\n );\n const persisted = await doc.signatures!.analyze({ since: { signatureIndex: 0 } });\n expect(persisted.steps).toHaveLength(0);\n const working = await doc.signatures!.analyze({\n since: { signatureIndex: 0 },\n until: 'working-copy',\n });\n expect(working.basis.source).toBe('working-copy');\n expect(working.steps).toHaveLength(1);\n expect(working.steps[0].levelInForce).toBe('fill');\n expect(working.verdict).toBe('permitted');\n expect(\n working.steps[0].findings.some((f) => f.rule === 'form-fill' && f.verdict === 'permitted'),\n ).toBe(true);\n } finally {\n await doc.close();\n }\n const partial = await open(engineOf(), opts, opts.fixtures.partialChain);\n try {\n expect(\n await caughtCode(() => partial.signatures!.analyze({ since: { signatureIndex: 0 } })),\n ).toBe(EngineErrorCode.InvalidArg);\n // A revision-anchored analysis over two later revisions: the net\n // state is judged in summary mode; `full` also carries every step.\n const byRevision = await partial.signatures!.analyze({ since: { revisionIndex: 0 } });\n expect(byRevision.later.revisionCount).toBe(2);\n expect(byRevision.steps).toHaveLength(0);\n const inFull = await partial.signatures!.analyze({ since: { revisionIndex: 0 }, detail: 'full' });\n expect(inFull.steps).toHaveLength(2);\n expect(inFull.current.verdict).toBe(byRevision.current.verdict);\n } finally {\n await partial.close();\n }\n });\n\n test('analyze: a page edit under a certification and a locked field edit are forbidden', async () => {\n if (!supported()) return;\n const permit = permitEngineOf();\n if (!permit) return;\n // Page deletion after a certification (permission 2): unexplained by every rule.\n const certified = await open(permit, opts, opts.fixtures.certified);\n let reopened: DocumentHandle | null = null;\n try {\n // A one-page fixture cannot lose its only page; a rotation is a page\n // dictionary change no signature permits either.\n const list = await certified.pages.list();\n await certified.pages.rotate([list.pages[0].pageObjectNumber], 90);\n const working = await certified.signatures!.analyze({\n since: { signatureIndex: 0 },\n until: 'working-copy',\n });\n expect(working.verdict).toBe('forbidden');\n const bytes = await certified.download();\n reopened = await reopen(permit, opts, `${opts.fixtures.certified.id}-tampered`, bytes);\n const analysis = await reopened.signatures!.analyze({ since: { signatureIndex: 0 } });\n expect(analysis.verdict).toBe('forbidden');\n expect(analysis.steps[0].findings.some((f) => f.verdict === 'forbidden')).toBe(true);\n } finally {\n if (reopened) await reopened.close();\n await certified.close();\n }\n // Editing a FieldMDP-locked field: the lock rule, whatever the level.\n const locked = await open(permit, opts, opts.fixtures.fieldMdp);\n try {\n await locked.forms.setValue(\n { kind: 'fqn', name: opts.fixtures.fieldMdp.lockedField },\n { type: 'text', value: 'tampered' },\n );\n const working = await locked.signatures!.analyze({\n since: { signatureIndex: 0 },\n until: 'working-copy',\n });\n expect(working.verdict).toBe('forbidden');\n expect(working.steps[0].findings.some((f) => f.rule === 'field-lock')).toBe(true);\n } finally {\n await locked.close();\n }\n });\n}\n\n/** A minimal DER SEQUENCE standing in for a CMS: the engine's job ends at the bytes. */\nconst FAKE_CMS = new Uint8Array([0x30, 0x06, 0x02, 0x01, 0x01, 0x02, 0x01, 0x02]);\n\nasync function caughtCode(run: () => Promise<unknown>): Promise<string | null> {\n try {\n await run();\n return null;\n } catch (err) {\n return err instanceof EngineError ? err.code : 'not-an-engine-error';\n }\n}\n\nfunction runSigningTests(\n runner: ConformanceTestRunner,\n opts: SignatureConformanceOptions,\n engineOf: () => Engine,\n supported: () => boolean,\n): void {\n const { test, expect } = runner;\n const fx = () => opts.fixtures.unsignedSigField;\n const sigRef = () => ({ kind: 'fqn', name: fx().fieldName }) as const;\n const textRef = () => ({ kind: 'fqn', name: fx().textField }) as const;\n\n test('sign: prepare seals a candidate, complete installs it, download returns it verbatim', async () => {\n if (!supported()) return;\n const engine = engineOf();\n const doc = await open(engine, opts, fx());\n const events: string[] = [];\n const unsubscribe = doc.events.subscribe((event) => events.push(event.type));\n let reopened: DocumentHandle | null = null;\n try {\n const v0 = await doc.version!();\n const before = await doc.signatures!.list();\n expect(before.revisions).toHaveLength(1);\n expect(before.signatures).toHaveLength(1);\n expect(before.signatures[0].signed).toBe(false);\n expect(before.protection.judged).toBeNull();\n\n const prepared = await doc.signatures!.prepare({\n field: sigRef(),\n subFilter: 'ETSI.CAdES.detached',\n digest: 'sha256',\n contentsSize: 1024,\n attribution: { reason: 'conformance' },\n });\n expect(prepared.digest.byteLength).toBe(32);\n expect(prepared.algorithm).toBe('sha256');\n expect(prepared.subFilter).toBe('ETSI.CAdES.detached');\n expect(prepared.contentsSize).toBe(1024);\n expect(prepared.byteRange[0]).toBe(0);\n expect(prepared.byteRange[2] > prepared.byteRange[1]).toBe(true);\n expect(prepared.expectedVersion.baseSha256).toBe(v0.sha256);\n\n // The fence: nothing mutates while a candidate is parked.\n expect(await caughtCode(() => doc.signatures!.prepare({ field: sigRef() }))).toBe(\n EngineErrorCode.SigningPending,\n );\n expect(\n await caughtCode(() => doc.forms.setValue(textRef(), { type: 'text', value: 'x' })),\n ).toBe(EngineErrorCode.SigningPending);\n // The live document is untouched.\n const during = await doc.signatures!.list();\n expect(during.signatures[0].signed).toBe(false);\n expect((await doc.version!()).sha256).toBe(v0.sha256);\n\n // A stale expectedVersion cannot complete.\n expect(\n await caughtCode(() =>\n doc.signatures!.complete({\n signingId: prepared.signingId,\n cms: FAKE_CMS,\n expectedVersion: {\n baseSha256: prepared.expectedVersion.baseSha256,\n editsVersion: prepared.expectedVersion.editsVersion + 1,\n },\n }),\n ),\n ).toBe(EngineErrorCode.SigningVersionMismatch);\n\n const result = await doc.signatures!.complete({\n signingId: prepared.signingId,\n cms: FAKE_CMS,\n expectedVersion: prepared.expectedVersion,\n });\n expect(result.status).toBe('completed');\n expect(result.signature.signed).toBe(true);\n expect(result.signature.fieldName).toBe(fx().fieldName);\n expect(result.signature.coverage).toBe('whole-revision');\n expect(result.signature.revisionIndex).toBe(1);\n expect(result.signature.subFilter).toBe('ETSI.CAdES.detached');\n expect(result.signature.signer.reason).toBe('conformance');\n expect(result.signature.contentsSize).toBe(FAKE_CMS.byteLength);\n expect(result.previous).toEqual(prepared.expectedVersion);\n expect(result.version.sha256 === v0.sha256).toBe(false);\n expect(result.protection.judged).toBe('annotate');\n expect(result.protection.enforced).toBeNull();\n expect(result.meta.affectedPages.length >= 1).toBe(true);\n\n // The session is on the new version, and every byte fact follows.\n expect(await doc.version!()).toEqual(result.version);\n const after = await doc.signatures!.list();\n expect(after.revisions).toHaveLength(2);\n expect(after.signatures[0].signed).toBe(true);\n expect(after.signatures[0].revisionIndex).toBe(1);\n expect(after.revisions[1].signatureIndex).toBe(0);\n expect(toHex(await doc.signatures!.digest(sigRef(), 'sha256'))).toBe(toHex(prepared.digest));\n expect(bytesEqual(await doc.signatures!.contents(sigRef()), FAKE_CMS)).toBe(true);\n\n // download() is the sealed file, byte for byte: nothing is re-saved.\n const bytes = await doc.download();\n expect(bytes.byteLength).toBe(result.version.byteLength);\n expect(await sha256Hex(bytes)).toBe(result.version.sha256);\n reopened = await reopen(engine, opts, `${fx().id}-signed`, bytes);\n const fresh = await reopened.signatures!.list();\n expect(fresh.revisions).toHaveLength(2);\n expect(fresh.signatures[0].coverage).toBe('whole-revision');\n expect(toHex(await reopened.signatures!.digest(sigRef(), 'sha256'))).toBe(\n toHex(prepared.digest),\n );\n\n // Idempotent replay, then the fence is gone.\n const replay = await doc.signatures!.complete({\n signingId: prepared.signingId,\n cms: FAKE_CMS,\n expectedVersion: prepared.expectedVersion,\n });\n expect(replay.status).toBe('already-completed');\n expect(replay.version).toEqual(result.version);\n expect((await doc.signatures!.abort(prepared.signingId)).status).toBe('already-completed');\n expect((await doc.signatures!.abort('never-prepared')).status).toBe('unknown');\n await doc.forms.setValue(textRef(), { type: 'text', value: 'after' });\n // Signing the same field again is refused: it is signed.\n expect(await caughtCode(() => doc.signatures!.prepare({ field: sigRef() }))).toBe(\n EngineErrorCode.SignatureRefused,\n );\n\n expect(events.filter((t) => t === 'signature.prepared')).toHaveLength(1);\n expect(events.filter((t) => t === 'signature.completed')).toHaveLength(1);\n expect(events.filter((t) => t === 'document.versioned')).toHaveLength(1);\n } finally {\n unsubscribe();\n if (reopened) await reopened.close();\n await doc.close();\n }\n });\n\n test(\"sign: unsaved edits are sealed in the signature's own revision (layer session)\", async () => {\n if (!supported()) return;\n const doc = await open(engineOf(), opts, fx());\n try {\n await doc.forms.setValue(textRef(), { type: 'text', value: 'unsaved' });\n const prepared = await doc.signatures!.prepare({ field: sigRef() });\n const result = await doc.signatures!.complete({\n signingId: prepared.signingId,\n cms: FAKE_CMS,\n expectedVersion: prepared.expectedVersion,\n });\n // The candidate is a layer over the session's own base fed the artifact a\n // save would write: edits and signature land in ONE revision, as Acrobat\n // saves a fill-and-sign. (A plain session freezes the edits first: two.)\n expect(result.signature.revisionIndex).toBe(1);\n const after = await doc.signatures!.list();\n expect(after.revisions).toHaveLength(2);\n const text = await doc.forms.get(textRef());\n expect((text as { value?: string }).value).toBe('unsaved');\n const bytes = await doc.download();\n expect(await sha256Hex(bytes)).toBe(result.version.sha256);\n } finally {\n await doc.close();\n }\n });\n\n test('sign: a certification protects the document from the moment it completes', async () => {\n if (!supported()) return;\n const doc = await open(engineOf(), opts, fx());\n try {\n expect(doc.security.allows('doc.pages.assemble')).toBe(true);\n const prepared = await doc.signatures!.prepare({\n field: sigRef(),\n certify: { permission: 2 },\n subFilter: 'adbe.pkcs7.detached',\n });\n const result = await doc.signatures!.complete({\n signingId: prepared.signingId,\n cms: FAKE_CMS,\n expectedVersion: prepared.expectedVersion,\n });\n expect(result.signature.docMdp).toBe(2);\n expect(result.signature.catalogCertification).toBe(true);\n expect(result.protection.judged).toBe('fill');\n expect(result.protection.enforced).toBe('fill');\n expect(result.protection.certification).toEqual({\n signatureIndex: result.signature.index,\n permission: 2,\n });\n expect(doc.security.allows('doc.pages.assemble')).toBe(false);\n expect(doc.security.allows('doc.forms.fill')).toBe(true);\n const list = await doc.pages.list();\n expect(await caughtCode(() => doc.pages.delete([list.pages[0].pageObjectNumber]))).toBe(\n EngineErrorCode.ProtectedDocument,\n );\n expect(await caughtCode(() => doc.download({ mode: 'rewrite' }))).toBe(\n EngineErrorCode.ProtectedDocument,\n );\n // Filling is still permitted (P = 2), and the certification survives it.\n await doc.forms.setValue(textRef(), { type: 'text', value: 'filled' });\n const after = await doc.signatures!.list();\n expect(after.signatures[0].coverage).toBe('whole-revision');\n } finally {\n await doc.close();\n }\n });\n\n test('sign: a lock freezes the named fields and is mirrored on the field', async () => {\n if (!supported()) return;\n const doc = await open(engineOf(), opts, fx());\n try {\n const prepared = await doc.signatures!.prepare({\n field: sigRef(),\n lock: { action: 'include', fields: [fx().textField] },\n });\n const result = await doc.signatures!.complete({\n signingId: prepared.signingId,\n cms: FAKE_CMS,\n expectedVersion: prepared.expectedVersion,\n });\n expect(result.signature.fieldMdp).toEqual({ action: 'include', fields: [fx().textField] });\n expect(result.signature.lock).toEqual({ action: 'include', fields: [fx().textField] });\n expect(result.protection.fieldLocks.length >= 1).toBe(true);\n expect(\n await caughtCode(() => doc.forms.setValue(textRef(), { type: 'text', value: 'nope' })),\n ).toBe(EngineErrorCode.ProtectedDocument);\n } finally {\n await doc.close();\n }\n });\n\n test('sign: abort discards the candidate and lifts the fence', async () => {\n if (!supported()) return;\n const doc = await open(engineOf(), opts, fx());\n try {\n const v0 = await doc.version!();\n const prepared = await doc.signatures!.prepare({ field: sigRef() });\n expect((await doc.signatures!.abort(prepared.signingId)).status).toBe('aborted');\n expect((await doc.signatures!.list()).signatures[0].signed).toBe(false);\n expect((await doc.version!()).sha256).toBe(v0.sha256);\n await doc.forms.setValue(textRef(), { type: 'text', value: 'free again' });\n expect(\n await caughtCode(() =>\n doc.signatures!.complete({\n signingId: prepared.signingId,\n cms: FAKE_CMS,\n expectedVersion: prepared.expectedVersion,\n }),\n ),\n ).toBe(EngineErrorCode.NotFound);\n } finally {\n await doc.close();\n }\n });\n\n test('sign: artwork from a PDF page lands on the widget', async () => {\n if (!supported()) return;\n const doc = await open(engineOf(), opts, fx());\n try {\n const artwork = await opts.fixtures.artwork.bytes();\n const prepared = await doc.signatures!.prepare({\n field: sigRef(),\n appearance: { pdf: artwork, pageIndex: 0 },\n });\n const result = await doc.signatures!.complete({\n signingId: prepared.signingId,\n cms: FAKE_CMS,\n expectedVersion: prepared.expectedVersion,\n });\n expect(result.signature.coverage).toBe('whole-revision');\n expect(result.signature.widget).toBeTruthy();\n const page = doc.page(result.signature.widget!.pageObjectNumber);\n const annots = await page.annotations.list();\n const widget = annots.annotations.find(\n (a) =>\n a.ref.kind === 'objectNumber' &&\n a.ref.annotObjectNumber === result.signature.widget!.annotObjectNumber,\n );\n expect(widget).toBeTruthy();\n } finally {\n await doc.close();\n }\n });\n\n if (opts.openKind === 'layerBytes') {\n test('sign: a layer session keeps its kind, with an empty layer over the new base', async () => {\n if (!supported()) return;\n const doc = await open(engineOf(), opts, fx());\n try {\n const prepared = await doc.signatures!.prepare({ field: sigRef() });\n const result = await doc.signatures!.complete({\n signingId: prepared.signingId,\n cms: FAKE_CMS,\n expectedVersion: prepared.expectedVersion,\n });\n const layer = await doc.downloadLayer!();\n expect(layer.byteLength > 0).toBe(true);\n expect(await sha256Hex(await doc.download())).toBe(result.version.sha256);\n } finally {\n await doc.close();\n }\n });\n }\n}\n\nasync function reopen(\n engine: Engine,\n opts: SignatureConformanceOptions,\n id: string,\n bytes: Uint8Array,\n): Promise<DocumentHandle> {\n if (opts.openKind === 'layerBytes') {\n return engine.open({ kind: 'layerBytes', id, baseBytes: bytes });\n }\n return engine.open({ kind: 'bytes', id, bytes });\n}\n\nasync function open(\n engine: Engine,\n opts: SignatureConformanceOptions,\n fixture: ConformanceFixture,\n): Promise<DocumentHandle> {\n if (opts.openKind === 'bytes') {\n return engine.open({ kind: 'bytes', id: fixture.id, bytes: await fixture.bytes() });\n }\n if (opts.openKind === 'layerBytes') {\n return engine.open({\n kind: 'layerBytes',\n id: `${fixture.id}-layer`,\n baseBytes: await fixture.bytes(),\n });\n }\n return engine.open({ kind: 'id', id: fixture.cloudId ?? fixture.id });\n}\n\nfunction concat(a: Uint8Array, b: Uint8Array): Uint8Array {\n const out = new Uint8Array(a.byteLength + b.byteLength);\n out.set(a, 0);\n out.set(b, a.byteLength);\n return out;\n}\n\nfunction bytesEqual(a: Uint8Array, b: Uint8Array): boolean {\n if (a.byteLength !== b.byteLength) return false;\n for (let i = 0; i < a.byteLength; i++) if (a[i] !== b[i]) return false;\n return true;\n}\n\nfunction toHex(bytes: Uint8Array): string {\n let out = '';\n for (const b of bytes) out += b.toString(16).padStart(2, '0');\n return out;\n}\n\nasync function sha256Hex(bytes: Uint8Array): Promise<string> {\n const copy = new Uint8Array(bytes.byteLength);\n copy.set(bytes);\n const digest = await globalThis.crypto.subtle.digest('SHA-256', copy);\n return toHex(new Uint8Array(digest));\n}\n"],"mappings":";;;;;;;;;;AA6DA,SAAgB,uBACd,QACA,MACM;CACN,MAAM,EAAE,UAAU,MAAM,WAAW,UAAU,WAAW;CAExD,SAAS,yBAAyB,KAAK,eAAe;EACpD,IAAI;EAEJ,UAAU,YAAY;GACpB,SAAS,MAAM,KAAK,WAAW;EACjC,CAAC;EAED,SAAS,YAAY;GACnB,IAAI,QAAQ,MAAM,OAAO,QAAQ;EACnC,CAAC;EAED,KAAK,sCAAsC,YAAY;GACrD,MAAM,MAAM,MAAMA,eAAY,QAAQ,IAAI;GAC1C,IAAI;IACF,MAAM,OAAO,MAAM,IAAI,SAAS,KAAK;IACrC,OAAO,IAAI,CAAC,CAAC,cAAc,KAAK,QAAQ,QAAQ;IAChD,OAAO,KAAK,OAAO,CAAC,CAAC,QAAQ,wBAAwB;GACvD,UAAU;IACR,MAAM,IAAI,MAAM;GAClB;EACF,CAAC;EAED,KAAK,qDAAqD,YAAY;GACpE,MAAM,MAAM,MAAMA,eAAY,QAAQ,IAAI;GAC1C,IAAI;IACF,MAAM,IAAI,IAAI,SAAS,KAAK;IAC5B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M,IAAI,WAAW,MAAM,CAAC;AACrC"}
|
|
1
|
+
{"version":3,"file":"conformance.cjs","names":["openFixture","AbortError","EngineError","EngineErrorCode","measureFromKnownLength","measurementReadout","toPageRef","annotationKey","EngineErrorCode","AbortError","openFixture","AnnotationListSchema","toPageRef","AnnotationSchema","annotationKey","EngineError","EngineErrorCode","AbortError","open","DocumentActionsSnapshotSchema","toPageRef","isLocalPage","annotationKey","openFixture","toPageRef","AnnotationCreateResultSchema","annotationKey","pagePointsBounds","pageTurnOfUpright","pagePointTurned","drawnPointsOf","EngineErrorCode","AnnotationUpdateResultSchema","EngineError","AbortError","AnnotationReorderResultSchema","EngineError","EngineErrorCode","ALICE","BOB","SQUARE","firstPage","annotationKey","PDF_MAGIC","pageSize","EngineErrorCode","toPageRef","toPageRef","annotationKey","assertAnnotationBundle","AnnotationTransfer","EngineErrorCode","toPageRef","annotationKey","comparable","EngineErrorCode","encodePageKey","resourceIdOf","toPageRef","annotationKey","pdfRectTurnedBounds","drawnPointsOf","pageRefsIn","encodePageKey","toPageRef","declarationOf","openFixture","annotationKey","EngineErrorCode","EngineErrorCode","formEffectOps","toFieldRef","toPageRef","annotationKey","openFixture","toPageRef","isLocalPage","AbortError","openFixture","PageListSnapshotSchema","toPageRef","PageReorderResultSchema","annotationKey","EngineError","EngineErrorCode","AbortError","openFixture","PageRotateResultSchema","toPageRef","annotationKey","EngineError","EngineErrorCode","AbortError","annotationKey","pageBoxOf","EngineErrorCode","pdfRectTurnedBounds","decode","isDark","pixel","annotationKey","pageTransform","EngineErrorCode","decode","toPageRef","BLUE","toPageRef","annotationKey","EngineErrorCode","BOX","EngineErrorCode","openFixture","toPageRef","PageDeleteResultSchema","EngineError","EngineErrorCode","annotationKey","AbortError","openFixture","toPageRef","EngineErrorCode","EngineError","AbortError","square","openFixture","toPageRef","AnnotationFlattenResultSchema","sameRef","EngineErrorCode","EngineError","PDF_MAGIC","openFixture","toPageRef","EngineErrorCode","openFixture","toPageRef","PageFlattenResultSchema","EngineErrorCode","openFixture","toPageRef","RedactionApplyResultSchema","EngineErrorCode","openFixture","EngineError","EngineErrorCode","toPageRef","AbortError","toPageRef","AttachmentListSchema","toAttachmentRef","EngineError","EngineErrorCode","AttachmentCreateResultSchema","deletedAttachmentOf","UNKNOWN_PAGE","openFixture","toPageRef","EngineError","EngineErrorCode","openFixture","EngineError","EngineErrorCode","toPageRef","box","toPageRef","annotationKey","EngineErrorCode","PAGE","toPageRef","NAME","CALCULATE","box","isSkippedItem","EngineErrorCode","PAGE","toPageRef","WIDGET","NAME","box","EngineError","annotationKey","EngineErrorCode","EVERYTHING","NAME","PAGE","toPageRef","WIDGET","script","EngineError","EngineErrorCode","FILL","DESIGN","ALICE","BOB","WIDGET","FIRST","toPageRef","encodeFieldRefKey","EngineErrorCode","EngineError","field","toPageRef","annotationKey","EngineError","EngineErrorCode","PAGE","annotationKey","toPageRef","openFixture","toPageRef","QUAD","openFixture","toPageRef","openFixture","toPageRef","PageTextSnapshotSchema","EngineError","EngineErrorCode","AbortError","openFixture","toPageRef","PageTextSnapshotSchema","openFixture","toPageRef","PageGeometrySnapshotSchema","isRotatedGeometryRun","pageQuadBounds","SearchSliceSchema","foldText","toPageRef","EngineError","EngineErrorCode","AbortError","annotationKey","isLocalDocument","EngineError","EngineErrorCode","measureFromRatio","CASES","DRAWN_RECT_KINDS","differences","toPageRef","applyAnnotationPatch","annotationOfDraft","toPageRef","fieldAfterValue","fieldAfterReset","widgetsAfterDisplay","formFieldAfter","widgetAfterPatch","formFieldOfDraft","toPageRef","EngineError","EngineErrorCode"],"sources":["../src/conformance/fixtureScope.ts","../src/conformance/runMetadataConformance.ts","../src/conformance/runMeasurementConformance.ts","../src/conformance/runAnnotationReadConformance.ts","../src/conformance/runActionsConformance.ts","../src/conformance/appearanceRasters.ts","../src/conformance/creatables.ts","../src/conformance/runAnnotationMutationConformance.ts","../src/conformance/refusals.ts","../src/conformance/runAnnotationAttributionConformance.ts","../src/conformance/pdfOf.ts","../src/conformance/stampFixtures.ts","../src/conformance/runAnnotationResourceConformance.ts","../src/conformance/runAnnotationExportConformance.ts","../src/conformance/names.ts","../src/conformance/runAnnotationImportConformance.ts","../src/conformance/runAnnotationTransferConformance.ts","../src/conformance/runDateConformance.ts","../src/conformance/annotationReadDrift.ts","../src/conformance/runAnnotationDeclarationConformance.ts","../src/conformance/runFormConformance.ts","../src/conformance/runAnnotationAppearanceConformance.ts","../src/conformance/runPageReorderConformance.ts","../src/conformance/runPageRotateConformance.ts","../src/conformance/runAnnotationRotationConformance.ts","../src/conformance/runPageRenderConformance.ts","../src/conformance/pageSpaceFixtures.ts","../src/conformance/runPageSpaceConformance.ts","../src/conformance/runColorConformance.ts","../src/conformance/runAppearanceStatesConformance.ts","../src/conformance/runDrawingDetailsConformance.ts","../src/conformance/runPageDeleteConformance.ts","../src/conformance/runNamedPagesConformance.ts","../src/conformance/runAnnotationFlattenConformance.ts","../src/conformance/runAnnotationAppearanceExportConformance.ts","../src/conformance/runPageFlattenConformance.ts","../src/conformance/runRedactionApplyConformance.ts","../src/conformance/runPageExtractConformance.ts","../src/conformance/runAttachmentConformance.ts","../src/conformance/runPageInsertConformance.ts","../src/conformance/runPageInsertBlankConformance.ts","../src/conformance/runObjectNumberConformance.ts","../src/conformance/runChangeConformance.ts","../src/conformance/runPermissionConformance.ts","../src/conformance/runFormScriptConformance.ts","../src/conformance/runFormAttributionConformance.ts","../src/conformance/runFormTransferConformance.ts","../src/conformance/runWidgetRotationConformance.ts","../src/conformance/runWidgetFindingConformance.ts","../src/conformance/runPieceInfoConformance.ts","../src/conformance/runDocumentEventsConformance.ts","../src/conformance/runPageTextConformance.ts","../src/conformance/runTextDivergenceConformance.ts","../src/conformance/runPageGeometryOrientationConformance.ts","../src/conformance/runSearchConformance.ts","../src/conformance/diffAnnotationList.ts","../src/conformance/runSignatureConformance.ts","../src/conformance/runAnnotationPredictionConformance.ts","../src/conformance/runFormPredictionConformance.ts","../src/conformance/runFieldGroupsConformance.ts"],"sourcesContent":["/**\n * How a conformance suite opens its fixtures on a local engine: with every permission. A suite\n * checks the engine's mechanics, as the cloud's suites do with a full token, and a fixture's own\n * restrictions (a protected PDF's flags) would otherwise decide it. A suite about permissions\n * passes its own scope.\n */\nexport const EVERY_PERMISSION = { scope: ['*'] } as const;\n","import type { DocumentMetadata } from '../dto/DocumentMetadata';\nimport type { Engine } from '../engine/Engine';\nimport { EngineError } from '../errors/EngineError';\nimport { EngineErrorCode } from '../errors/EngineErrorCode';\nimport { AbortError } from '../promise/AbortError';\nimport { EVERY_PERMISSION } from './fixtureScope';\n\nexport interface ConformanceTestRunner {\n describe(name: string, fn: () => void): void;\n test(name: string, fn: () => void | Promise<void>): void;\n beforeAll(fn: () => void | Promise<void>): void;\n afterAll(fn: () => void | Promise<void>): void;\n expect: ConformanceExpect;\n}\n\nexport interface ConformanceExpect {\n (actual: unknown): {\n toBe(expected: unknown): void;\n toBeNull(): void;\n toEqual(expected: unknown): void;\n toHaveLength(expected: number): void;\n toMatch(re: RegExp): void;\n toMatchObject(shape: Record<string, unknown>): void;\n toContain(expected: unknown): void;\n toBeInstanceOf(ctor: Function): void;\n toBeTruthy(): void;\n rejects: {\n toBeInstanceOf(ctor: Function): Promise<void>;\n toMatchObject(shape: Record<string, unknown>): Promise<void>;\n };\n resolves: {\n toMatchObject(shape: Record<string, unknown>): Promise<void>;\n toEqual(expected: unknown): Promise<void>;\n };\n };\n}\n\nexport interface ConformanceFixture {\n /** Stable id used for the local engine; cloud uses its own id. */\n id: string;\n /** Bytes for the local engine. */\n bytes: () => Uint8Array | Promise<Uint8Array>;\n /** Override the cloud-side id. Defaults to `id`. */\n cloudId?: string;\n /** The expected document metadata. Used for parity assertions. */\n expected: Partial<DocumentMetadata>;\n}\n\nexport interface ConformanceOptions {\n label: string;\n /** Build a fresh engine for this suite. Suite tears it down at the end. */\n makeEngine: () => Promise<Engine> | Engine;\n /** Sample fixture for the happy-path metadata read. */\n fixture: ConformanceFixture;\n /** Engine 'kind' for opening: 'bytes' for local, 'id' for cloud. */\n openKind: 'bytes' | 'id';\n}\n\n/**\n * The conformance harness is transport-agnostic. It takes the test runner as\n * a parameter so engine-core has no dependency on vitest/jest/node:test.\n */\nexport function runMetadataConformance(\n runner: ConformanceTestRunner,\n opts: ConformanceOptions,\n): void {\n const { describe, test, beforeAll, afterAll, expect } = runner;\n\n describe(`metadata conformance: ${opts.label}`, () => {\n let engine: Engine;\n\n beforeAll(async () => {\n engine = await opts.makeEngine();\n });\n\n afterAll(async () => {\n if (engine) await engine.destroy();\n });\n\n test('reads metadata from sample fixture', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const meta = await doc.metadata.get();\n expect(meta).toMatchObject(opts.fixture.expected);\n expect(meta.trapped).toMatch(/^(true|false|unknown)$/);\n } finally {\n await doc.close();\n }\n });\n\n test('abort() before completion rejects with AbortError', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const p = doc.metadata.get();\n p.abort('test');\n await expect(p).rejects.toBeInstanceOf(AbortError);\n } finally {\n await doc.close();\n }\n });\n\n test('aborting one read does not affect a concurrent one', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const a = doc.metadata.get();\n const b = doc.metadata.get();\n a.abort('test');\n await expect(a).rejects.toBeInstanceOf(AbortError);\n await expect(b).resolves.toMatchObject(opts.fixture.expected);\n } finally {\n await doc.close();\n }\n });\n\n test('metadata after close throws DocNotOpen', async () => {\n const doc = await openFixture(engine, opts);\n await doc.close();\n let caught: unknown;\n try {\n await doc.metadata.get();\n } catch (err) {\n caught = err;\n }\n expect(caught).toBeTruthy();\n expect(EngineError.is(caught, EngineErrorCode.DocNotOpen)).toBe(true);\n });\n\n test('update() sets standard fields, custom.update() sets custom keys, each read sees its own', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const result = await doc.metadata.update({\n title: 'Conformance Title',\n subject: 'Conformance Subject',\n });\n // The result carries the re-read metadata; cloud also carries cache\n // pins (local is null) — both expose the post-write values here.\n expect(result.metadata.title).toBe('Conformance Title');\n expect(result.metadata.subject).toBe('Conformance Subject');\n expect('custom' in result.metadata).toBe(false);\n\n const customResult = await doc.metadata.custom.update({\n ConformanceKey: 'conformance-value',\n });\n expect(customResult.custom['ConformanceKey']).toBe('conformance-value');\n\n // A fresh read goes through the versioned leaf (cloud) / re-read\n // (local) and must observe the same writes.\n const after = await doc.metadata.get();\n expect(after.title).toBe('Conformance Title');\n expect(after.subject).toBe('Conformance Subject');\n const afterCustom = await doc.metadata.custom.get();\n expect(afterCustom['ConformanceKey']).toBe('conformance-value');\n } finally {\n await doc.close();\n }\n });\n\n test('custom.update(): a key left out stays, null removes, standard fields are untouched', async () => {\n const doc = await openFixture(engine, opts);\n try {\n await doc.metadata.update({ title: 'Kept Title' });\n await doc.metadata.custom.update({ KeepMe: 'a', DropMe: 'b' });\n const { custom } = await doc.metadata.custom.update({ DropMe: null, AddMe: 'c' });\n expect(custom['KeepMe']).toBe('a');\n expect('DropMe' in custom).toBe(false);\n expect(custom['AddMe']).toBe('c');\n expect((await doc.metadata.custom.get())['KeepMe']).toBe('a');\n expect((await doc.metadata.get()).title).toBe('Kept Title');\n } finally {\n await doc.close();\n }\n });\n\n test(\"'' is a value, and custom.update() refuses a key it can't write\", async () => {\n const doc = await openFixture(engine, opts);\n try {\n await doc.metadata.update({ title: '' });\n await doc.metadata.custom.update({ EmptyKey: '' });\n expect((await doc.metadata.get()).title).toBe('');\n expect((await doc.metadata.custom.get())['EmptyKey']).toBe('');\n\n for (const key of ['Title', 'Bad\\u0001Key', '']) {\n let caught: unknown;\n try {\n await doc.metadata.custom.update({ NotWritten: 'x', [key]: 'x' });\n } catch (err) {\n caught = err;\n }\n expect(EngineError.is(caught, EngineErrorCode.InvalidArg)).toBe(true);\n expect((caught as EngineError).details?.['field']).toBe(key);\n }\n // Refused whole: the valid key in the same patch wasn't written.\n expect('NotWritten' in (await doc.metadata.custom.get())).toBe(false);\n } finally {\n await doc.close();\n }\n });\n\n test('update() clears a field with null', async () => {\n const doc = await openFixture(engine, opts);\n try {\n await doc.metadata.update({ title: 'To Be Cleared' });\n const set = await doc.metadata.get();\n expect(set.title).toBe('To Be Cleared');\n\n await doc.metadata.update({ title: null });\n const cleared = await doc.metadata.get();\n expect(cleared.title).toBe(null);\n } finally {\n await doc.close();\n }\n });\n\n test('update() after close throws DocNotOpen', async () => {\n const doc = await openFixture(engine, opts);\n await doc.close();\n let caught: unknown;\n try {\n await doc.metadata.update({ title: 'nope' });\n } catch (err) {\n caught = err;\n }\n expect(caught).toBeTruthy();\n expect(EngineError.is(caught, EngineErrorCode.DocNotOpen)).toBe(true);\n });\n\n test('custom reads and writes after close throw DocNotOpen', async () => {\n const doc = await openFixture(engine, opts);\n await doc.close();\n for (const call of [() => doc.metadata.custom.get(), () => doc.metadata.custom.update({})]) {\n let caught: unknown;\n try {\n await call();\n } catch (err) {\n caught = err;\n }\n expect(EngineError.is(caught, EngineErrorCode.DocNotOpen)).toBe(true);\n }\n });\n });\n}\n\nasync function openFixture(engine: Engine, opts: ConformanceOptions) {\n if (opts.openKind === 'bytes') {\n const bytes = await opts.fixture.bytes();\n return engine.open({ kind: 'bytes', id: opts.fixture.id, bytes }, EVERY_PERMISSION);\n }\n return engine.open({ kind: 'id', id: opts.fixture.cloudId ?? opts.fixture.id });\n}\n","import type { ConformanceOptions, ConformanceTestRunner } from './runMetadataConformance';\nimport type { Engine } from '../engine/Engine';\nimport type { DocumentEvent } from '../events/DocumentEvent';\nimport type { AnnotationDraft } from '../shared';\nimport { annotationKey } from '../identity/annotationKey';\nimport { EngineErrorCode } from '../errors/EngineErrorCode';\nimport { toPageRef } from '../identity/PageRef';\nimport { AbortError } from '../promise/AbortError';\nimport { measureFromKnownLength, measurementReadout } from '../measure';\nimport { EVERY_PERMISSION } from './fixtureScope';\n\n/** Shared numerical, persistence and calibration contract for local and HTTP engines. */\nexport function runMeasurementConformance(\n runner: ConformanceTestRunner,\n opts: ConformanceOptions,\n): void {\n const { describe, test, beforeAll, afterAll, expect } = runner;\n describe(`measurement conformance: ${opts.label}`, () => {\n let engine: Engine;\n beforeAll(async () => {\n engine = await opts.makeEngine();\n });\n afterAll(async () => {\n await engine?.destroy();\n });\n const open = async () =>\n opts.openKind === 'bytes'\n ? engine.open(\n { kind: 'bytes', id: opts.fixture.id, bytes: await opts.fixture.bytes() },\n EVERY_PERMISSION,\n )\n : engine.open({ kind: 'id', id: opts.fixture.cloudId ?? opts.fixture.id });\n const scale = measureFromKnownLength(100, { value: 3, unit: 'm' });\n const vertices = [\n { x: 0, y: 0 },\n { x: 100, y: 0 },\n { x: 100, y: 100 },\n ];\n\n test('geometry derives contents while caption patches retain placement', async () => {\n const doc = await open();\n try {\n const page = doc.page((await doc.pages.list()).pages[0].ref);\n const created = (\n await page.annotations.create({\n subtype: 'line',\n intent: 'line-dimension',\n measure: scale,\n linePoints: { start: vertices[0], end: vertices[1] },\n captionEnabled: true,\n captionOffset: { along: 10, perpendicular: 20 },\n })\n ).annotation;\n const inert = await page.annotations.update(created.ref, {\n subtype: 'line',\n contents: '999 m',\n });\n expect(inert.annotation.contents).toBe('3.00 m');\n expect(inert.appearance).toEqual({ action: 'preserved', changed: false });\n const changed = await page.annotations.update(created.ref, {\n subtype: 'line',\n linePoints: { start: vertices[0], end: { x: 200, y: 0 } },\n });\n expect(changed.annotation.contents).toBe('6.00 m');\n expect(changed.appearance.changed).toBe(true);\n const hidden = await page.annotations.update(created.ref, {\n subtype: 'line',\n captionEnabled: false,\n });\n expect(hidden.annotation).toMatchObject({\n contents: '6.00 m',\n captionEnabled: false,\n captionOffset: { along: 10, perpendicular: 20 },\n });\n expect(hidden.appearance.changed).toBe(true);\n const reset = await page.annotations.update(created.ref, {\n subtype: 'line',\n captionEnabled: true,\n captionOffset: null,\n measure: null,\n });\n expect(reset.annotation.contents).toBe('6.00 m');\n expect(reset.annotation.subtype === 'line' && reset.annotation.captionOffset === null).toBe(\n true,\n );\n expect(measurementReadout(reset.annotation)).toEqual({ unavailable: 'no-measure' });\n } finally {\n await doc.close();\n }\n });\n\n test('all three kinds derive labels, save, reopen and retain captions', async () => {\n let doc = await open();\n try {\n const pageObjectNumber = (await doc.pages.list()).pages[0].ref.objectNumber;\n const drafts: AnnotationDraft[] = [\n {\n subtype: 'line',\n intent: 'line-dimension',\n // Both coordinates and /C cross float32 rounding boundaries.\n measure: measureFromKnownLength(1, { value: 1.00000001, unit: 'm' }),\n contents: 'wrong',\n linePoints: { start: vertices[0], end: { x: 3.4450000001, y: 0 } },\n captionEnabled: true,\n captionOffset: { along: 10, perpendicular: 20 },\n },\n {\n subtype: 'polyline',\n intent: 'polyline-dimension',\n measure: scale,\n contents: 'wrong',\n vertices,\n captionEnabled: true,\n captionCenter: { x: 0, y: 0 },\n },\n {\n subtype: 'polygon',\n intent: 'polygon-dimension',\n measure: scale,\n contents: 'wrong',\n vertices,\n captionEnabled: true,\n captionCenter: { x: 50, y: 30 },\n },\n ];\n const saved = [];\n for (const draft of drafts) {\n const preview = measurementReadout(draft);\n const a = (await doc.page(toPageRef(pageObjectNumber)).annotations.create(draft))\n .annotation;\n expect(a.contents).toBe('label' in preview ? preview.label : undefined);\n saved.push(a);\n }\n const bytes = opts.openKind === 'bytes' ? await doc.download() : undefined;\n await doc.close();\n doc = bytes\n ? await engine.open(\n { kind: 'bytes', id: `${opts.fixture.id}-saved`, bytes },\n EVERY_PERMISSION,\n )\n : await open();\n const page = doc.page((await doc.pages.list()).pages[0].ref);\n const list = (await page.annotations.list()).annotations;\n for (const before of saved) {\n const a = list.find((a) => annotationKey(a.ref) === annotationKey(before.ref))!;\n expect(a.contents).toBe(before.contents);\n if (a.subtype !== 'line' && a.subtype !== 'polygon' && a.subtype !== 'polyline')\n throw new Error('Missing dimension');\n expect(captionOf(a)).toEqual(captionOf(before));\n const result = await page.annotations.update(a.ref, {\n subtype: a.subtype,\n color: '#0000ff',\n });\n expect(result.annotation.contents).toBe(before.contents);\n }\n } finally {\n await doc.close();\n }\n });\n\n test('calibration updates only viewports and emits one event per write', async () => {\n const doc = await open();\n try {\n const pageObjectNumber = (await doc.pages.list()).pages[0].ref.objectNumber;\n const page = doc.page(toPageRef(pageObjectNumber));\n if (!page.measure) throw new Error('Measurement service is required');\n const listed = (await page.measure.listViewports()).viewports;\n // A read never leaves a field out: no name or measure reads `null`.\n for (const viewport of listed) {\n expect('name' in viewport && 'measure' in viewport).toBe(true);\n }\n const foreign = listed.filter((v) => !v.owned);\n const annotations = (await page.annotations.list()).annotations;\n const events: DocumentEvent[] = [];\n const off = doc.events.subscribe((event) => events.push(event));\n try {\n const set = await page.measure.setScale(scale);\n expect(set.page).toEqual(page.ref);\n expect(\n (await page.measure.listViewports()).viewports.filter((v) => v.owned),\n ).toHaveLength(1);\n expect((await page.annotations.list()).annotations).toEqual(annotations);\n await page.measure.setScale(null);\n expect((await page.measure.listViewports()).viewports).toEqual(foreign);\n const changes = events.filter((e) => e.type === 'pages.scaleSet');\n expect(changes).toHaveLength(2);\n for (const event of changes)\n expect(event).toMatchObject({\n page: toPageRef(pageObjectNumber),\n meta: { affectedPages: [] },\n });\n } finally {\n off();\n }\n } finally {\n await doc.close();\n }\n });\n\n test('invalid and immediately aborted calibration leaves the previous scale intact', async () => {\n const doc = await open();\n try {\n const page = doc.page((await doc.pages.list()).pages[0].ref);\n await page.measure!.setScale(scale);\n const before = await page.measure!.listViewports();\n await expect(\n page.measure!.setScale({ ...scale, x: [{ unit: 'm', conversion: 0 }] }),\n ).rejects.toMatchObject({ code: EngineErrorCode.InvalidArg });\n const pending = page.measure!.setScale(null);\n pending.abort('conformance');\n await expect(pending).rejects.toBeInstanceOf(AbortError);\n expect(await page.measure!.listViewports()).toEqual(before);\n } finally {\n await doc.close();\n }\n });\n });\n}\n\nconst CAPTION_FIELDS = ['captionEnabled', 'captionPosition', 'captionOffset', 'captionCenter'];\n\n/** The caption fields a dimension annotation reads, for comparing two reads. */\nfunction captionOf(annotation: object): Record<string, unknown> {\n return Object.fromEntries(\n Object.entries(annotation).filter(([name]) => CAPTION_FIELDS.includes(name)),\n );\n}\n","import type {\n ConformanceTestRunner,\n ConformanceFixture,\n ConformanceOptions,\n} from './runMetadataConformance';\nimport type { AnnotationList } from '../annotation/AnnotationList';\nimport { AnnotationSchema } from '../annotation/kinds';\nimport type { Annotation } from '../annotation/kinds';\nimport type { Engine } from '../engine/Engine';\nimport { EngineError } from '../errors/EngineError';\nimport { EngineErrorCode } from '../errors/EngineErrorCode';\nimport { annotationKey } from '../identity/annotationKey';\nimport { toPageRef } from '../identity/PageRef';\nimport { AbortError } from '../promise/AbortError';\nimport { AnnotationListSchema } from '../wire/schemas';\nimport { EVERY_PERMISSION } from './fixtureScope';\n\n/**\n * Expected per-fixture annotation knowledge. The harness asserts against\n * these without locking the exact wire content, so different fixtures can\n * be added by suites without rewriting the harness.\n */\nexport interface AnnotationReadConformanceFixture extends ConformanceFixture {\n /** PDF object number of the page used by the annotation tests. */\n pageObjectNumber: number;\n /** The total annotation count expected on that page (across all subtypes). */\n expectedAnnotationCount: number;\n /** At least this many `'highlight'` annotations on the page. */\n minHighlightCount: number;\n /** At least this many `'unsupported'` annotations on the page. */\n minUnsupportedCount: number;\n /** At least this many `'circle'` annotations on the page. Defaults to 0. */\n minCircleCount?: number;\n /** At least this many `'square'` annotations on the page. Defaults to 0. */\n minSquareCount?: number;\n /** At least this many `'polygon'` annotations on the page. Defaults to 0. */\n minPolygonCount?: number;\n /** At least this many `'polyline'` annotations on the page. Defaults to 0. */\n minPolylineCount?: number;\n /** At least this many `'line'` annotations on the page. Defaults to 0. */\n minLineCount?: number;\n /** At least this many `'ink'` annotations on the page. Defaults to 0. */\n minInkCount?: number;\n /** At least this many `'free-text'` annotations on the page. Defaults to 0. */\n minFreeTextCount?: number;\n /** At least this many `'caret'` annotations on the page. Defaults to 0. */\n minCaretCount?: number;\n /**\n * `true` if the fixture page has at least one annotation born inline (a\n * dictionary in `/Annots`, no object number). Drives the `baseIndex` tests.\n */\n expectsInlineAnnotation: boolean;\n}\n\nexport interface AnnotationConformanceOptions extends Omit<ConformanceOptions, 'fixture'> {\n fixture: AnnotationReadConformanceFixture;\n}\n\nexport function runAnnotationReadConformance(\n runner: ConformanceTestRunner,\n opts: AnnotationConformanceOptions,\n): void {\n const { describe, test, beforeAll, afterAll, expect } = runner;\n\n describe(`annotation read conformance: ${opts.label}`, () => {\n let engine: Engine;\n\n beforeAll(async () => {\n engine = await opts.makeEngine();\n });\n\n afterAll(async () => {\n if (engine) await engine.destroy();\n });\n\n test('list() returns every page, and each annotation names its page', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const list = await doc.annotations.list();\n expect(AnnotationListSchema.safeParse(list).success).toBe(true);\n expect(list.pages.length >= 1).toBe(true);\n // Cloud stamps its reconciliation cursor; local omits it. When\n // present it must be a nonnegative integer.\n if (list.auditHead !== undefined) {\n expect(Number.isInteger(list.auditHead) && list.auditHead >= 0).toBe(true);\n }\n const target = list.pages.find((p) => p.objectNumber === opts.fixture.pageObjectNumber);\n expect(target !== undefined).toBe(true);\n const onTarget = list.annotations.filter(\n (a) => a.page.objectNumber === opts.fixture.pageObjectNumber,\n );\n expect(onTarget.length).toBe(opts.fixture.expectedAnnotationCount);\n } finally {\n await doc.close();\n }\n });\n\n test('list({ pages }) on the test page returns the expected counts and DTO shape', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const snap = await doc.annotations.list({\n pages: [toPageRef(opts.fixture.pageObjectNumber)],\n });\n expect(AnnotationListSchema.safeParse(snap).success).toBe(true);\n expect(snap.pages.map((p) => p.objectNumber)).toEqual([opts.fixture.pageObjectNumber]);\n expect(snap.annotations.length).toBe(opts.fixture.expectedAnnotationCount);\n const highlights = snap.annotations.filter((a) => a.subtype === 'highlight');\n expect(highlights.length >= opts.fixture.minHighlightCount).toBe(true);\n const unsupported = snap.annotations.filter((a) => a.subtype === 'unsupported');\n expect(unsupported.length >= opts.fixture.minUnsupportedCount).toBe(true);\n const circles = snap.annotations.filter((a) => a.subtype === 'circle');\n expect(circles.length >= (opts.fixture.minCircleCount ?? 0)).toBe(true);\n const squares = snap.annotations.filter((a) => a.subtype === 'square');\n expect(squares.length >= (opts.fixture.minSquareCount ?? 0)).toBe(true);\n const polygons = snap.annotations.filter((a) => a.subtype === 'polygon');\n expect(polygons.length >= (opts.fixture.minPolygonCount ?? 0)).toBe(true);\n const polylines = snap.annotations.filter((a) => a.subtype === 'polyline');\n expect(polylines.length >= (opts.fixture.minPolylineCount ?? 0)).toBe(true);\n const lines = snap.annotations.filter((a) => a.subtype === 'line');\n expect(lines.length >= (opts.fixture.minLineCount ?? 0)).toBe(true);\n const inks = snap.annotations.filter((a) => a.subtype === 'ink');\n expect(inks.length >= (opts.fixture.minInkCount ?? 0)).toBe(true);\n const freeTexts = snap.annotations.filter((a) => a.subtype === 'free-text');\n expect(freeTexts.length >= (opts.fixture.minFreeTextCount ?? 0)).toBe(true);\n const carets = snap.annotations.filter((a) => a.subtype === 'caret');\n expect(carets.length >= (opts.fixture.minCaretCount ?? 0)).toBe(true);\n } finally {\n await doc.close();\n }\n });\n\n test('shape/vertex/line annotations expose their family fields', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const snap = await doc.annotations.list({\n pages: [toPageRef(opts.fixture.pageObjectNumber)],\n });\n for (const a of snap.annotations) {\n // Ink carries the geometry styling (/C, /CA, /BS) but not /IC, plus\n // its /InkList (a non-empty array of point paths).\n if (a.subtype === 'ink') {\n expect(a.color !== undefined && a.color !== null).toBe(true);\n expect(typeof a.strokeWidth).toBe('number');\n expect(typeof a.borderStyle).toBe('string');\n expect(typeof a.opacity).toBe('number');\n expect('interiorColor' in a).toBe(false);\n expect(Array.isArray(a.inkList)).toBe(true);\n expect(a.inkList.length >= 1).toBe(true);\n expect(Array.isArray(a.inkList[0])).toBe(true);\n expect(a.inkList[0]!.length >= 1).toBe(true);\n continue;\n }\n // Free text: text fields (/DA) + nullable /C background + intent.\n if (a.subtype === 'free-text') {\n expect(typeof a.fontFamily).toBe('string');\n expect(typeof a.fontSize).toBe('number');\n expect(typeof a.textAlign).toBe('string');\n expect(a.color !== undefined && a.color !== null).toBe(true);\n expect('interiorColor' in a).toBe(true);\n expect(a.intent === 'free-text' || a.intent === 'free-text-callout').toBe(true);\n if (a.intent === 'free-text-callout' && a.calloutLine) {\n expect(a.calloutLine.length === 2 || a.calloutLine.length === 3).toBe(true);\n }\n continue;\n }\n // Caret: color-only style (/C, /CA) + optional /RD, no border/quads.\n if (a.subtype === 'caret') {\n expect(a.color !== undefined && a.color !== null).toBe(true);\n expect(typeof a.opacity).toBe('number');\n expect('strokeWidth' in a).toBe(false);\n expect('quadPoints' in a).toBe(false);\n continue;\n }\n // Every stroke/fill family member shares this styling surface.\n const isFilledStyle =\n a.subtype === 'circle' ||\n a.subtype === 'square' ||\n a.subtype === 'polygon' ||\n a.subtype === 'polyline' ||\n a.subtype === 'line';\n if (!isFilledStyle) continue;\n // interiorColor is Color | null; color (/C) is always present.\n expect(a.color !== undefined && a.color !== null).toBe(true);\n expect(typeof a.strokeWidth).toBe('number');\n expect(typeof a.borderStyle).toBe('string');\n expect(typeof a.opacity).toBe('number');\n expect('interiorColor' in a).toBe(true);\n\n if (a.subtype === 'polygon' || a.subtype === 'polyline') {\n expect(Array.isArray(a.vertices)).toBe(true);\n expect(a.vertices.length >= 2).toBe(true);\n }\n if (a.subtype === 'polyline') {\n expect(typeof a.lineEndings.start).toBe('string');\n expect(typeof a.lineEndings.end).toBe('string');\n }\n if (a.subtype === 'line') {\n expect(typeof a.linePoints.start.x).toBe('number');\n expect(typeof a.linePoints.end.y).toBe('number');\n expect(typeof a.lineEndings.start).toBe('string');\n expect(typeof a.lineEndings.end).toBe('string');\n }\n }\n } finally {\n await doc.close();\n }\n });\n\n test('page.annotations.list() is the document list of that page', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const ref = toPageRef(opts.fixture.pageObjectNumber);\n const onPage = await doc.page(ref).annotations.list();\n expect(AnnotationListSchema.safeParse(onPage).success).toBe(true);\n expect(onPage.annotations.length).toBe(opts.fixture.expectedAnnotationCount);\n expect(onPage).toEqual(await doc.annotations.list({ pages: [ref] }));\n } finally {\n await doc.close();\n }\n });\n\n test('every annotation DTO satisfies AnnotationSchema (discriminated union)', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const snap = await doc.annotations.list({\n pages: [toPageRef(opts.fixture.pageObjectNumber)],\n });\n for (const a of snap.annotations) {\n const result = AnnotationSchema.safeParse(a);\n expect(result.success).toBe(true);\n }\n } finally {\n await doc.close();\n }\n });\n\n test('AnnotationSchema rejects an annotation with a foreign subtype', () => {\n const bogus: unknown = {\n subtype: 'pretend-not-real',\n ref: {\n kind: 'objectNumber',\n page: { kind: 'objectNumber', objectNumber: 1 },\n objectNumber: 1,\n },\n pageObjectNumber: 1,\n nm: null,\n flags: emptyFlags(),\n rect: { left: 0, top: 0, right: 0, bottom: 0 },\n contents: null,\n author: null,\n createdAt: null,\n modifiedAt: null,\n };\n const result = AnnotationSchema.safeParse(bogus);\n expect(result.success).toBe(false);\n });\n\n if (opts.fixture.expectsInlineAnnotation) {\n test('an annotation born inline is named by its baseIndex: its position in the file', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const page = doc.page(toPageRef(opts.fixture.pageObjectNumber));\n const { annotations } = await page.annotations.list();\n const inline = annotations.find((a) => a.ref.kind === 'baseIndex');\n expect(inline !== undefined).toBe(true);\n // The name resolves: a read by it finds the same annotation.\n const again = await page.annotations.list();\n expect(\n again.annotations.find((a) => annotationKey(a.ref) === annotationKey(inline!.ref)),\n ).toEqual(inline);\n } finally {\n await doc.close();\n }\n });\n\n test('a baseIndex that names no inline annotation is NotFound', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const page = doc.page(toPageRef(opts.fixture.pageObjectNumber));\n const { annotations } = await page.annotations.list();\n const missing = await page.annotations\n .update(\n {\n kind: 'baseIndex',\n page: toPageRef(opts.fixture.pageObjectNumber),\n baseIndex: annotations.length + 10,\n },\n { contents: 'nobody' },\n )\n .then(\n () => null,\n (error: unknown) => error,\n );\n expect(EngineError.is(missing, EngineErrorCode.NotFound)).toBe(true);\n } finally {\n await doc.close();\n }\n });\n }\n\n test('abort() on listRaw rejects with AbortError', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const p = doc.annotations.list({ pages: [toPageRef(opts.fixture.pageObjectNumber)] });\n p.abort('test');\n await expect(p).rejects.toBeInstanceOf(AbortError);\n } finally {\n await doc.close();\n }\n });\n\n test('listRaw on an unknown pageObjectNumber throws NotFound', async () => {\n const doc = await openFixture(engine, opts);\n try {\n let caught: unknown;\n try {\n await doc.annotations.list({ pages: [toPageRef(999_999_999)] });\n } catch (err) {\n caught = err;\n }\n expect(caught).toBeTruthy();\n expect(EngineError.is(caught, EngineErrorCode.NotFound)).toBe(true);\n } finally {\n await doc.close();\n }\n });\n });\n}\n\nasync function openFixture(engine: Engine, opts: AnnotationConformanceOptions) {\n if (opts.openKind === 'bytes') {\n const bytes = await opts.fixture.bytes();\n return engine.open({ kind: 'bytes', id: opts.fixture.id, bytes }, EVERY_PERMISSION);\n }\n return engine.open({ kind: 'id', id: opts.fixture.cloudId ?? opts.fixture.id });\n}\n\nfunction emptyFlags() {\n return {\n invisible: false,\n hidden: false,\n print: false,\n noZoom: false,\n noRotate: false,\n noView: false,\n readOnly: false,\n locked: false,\n toggleNoView: false,\n lockedContents: false,\n };\n}\n\n// Re-export for convenience: tests can hand a literal snapshot.\nexport type { AnnotationList, Annotation };\n","import type { DocumentHandle } from '../engine/DocumentHandle';\nimport type { Engine } from '../engine/Engine';\nimport type { PdfActionNode } from '../dto/PdfAction';\nimport { DocumentActionsSnapshotSchema } from '../dto/PdfAction.schema';\nimport { toPageRef } from '../identity/PageRef';\nimport type { ConformanceFixture, ConformanceTestRunner } from './runMetadataConformance';\nimport { EVERY_PERMISSION } from './fixtureScope';\n\n/** The script payload rides only the javascript/rendition arms. */\nfunction scriptOf<Destination>(node: PdfActionNode<Destination> | null | undefined): string {\n if (!node) return '';\n if (node.type === 'javascript') return node.script;\n if (node.type === 'rendition') return node.script ?? '';\n return '';\n}\n\nexport interface ActionsConformanceFixtures {\n document: ConformanceFixture;\n page: ConformanceFixture;\n annotation: ConformanceFixture;\n field: ConformanceFixture;\n /** `action_payloads.pdf` — every executable payload shape on one page of\n * /NM-keyed links. Required on both flavours: payload parity is a gate. */\n payloads: ConformanceFixture;\n /** `open_action_dest.pdf` — a destination-form catalog `/OpenAction`. */\n openDestination: ConformanceFixture;\n /** A page whose only annotation is a Link with a `/S /JavaScript` action.\n * Optional: the javascript-link classification test skips without it. */\n javascriptLink?: ConformanceFixture;\n}\n\nexport interface ActionsConformanceOptions {\n label: string;\n makeEngine: () => Promise<Engine> | Engine;\n fixtures: ActionsConformanceFixtures;\n openKind: 'bytes' | 'id';\n}\n\n/** Action extraction parity. These tests assert data only; no script executes. */\nexport function runActionsConformance(\n runner: ConformanceTestRunner,\n opts: ActionsConformanceOptions,\n): void {\n const { describe, test, beforeAll, afterAll, expect } = runner;\n let engine: Engine;\n\n describe(`actions conformance: ${opts.label}`, () => {\n beforeAll(async () => {\n engine = await opts.makeEngine();\n });\n\n afterAll(async () => {\n if (engine) await engine.destroy();\n });\n\n test('reads catalog additional actions and preserves /CO identity', async () => {\n const doc = await open(engine, opts, opts.fixtures.document);\n try {\n expect(Boolean(doc.actions)).toBe(true);\n const snapshot = await doc.actions!.get();\n expect(DocumentActionsSnapshotSchema.safeParse(snapshot).success).toBe(true);\n expect(snapshot.openAction).toBeNull();\n expect(snapshot.willSave?.root?.type).toBe('javascript');\n expect(scriptOf(snapshot.willSave?.root)).toMatch(/Will Save/);\n expect(scriptOf(snapshot.didSave?.root)).toMatch(/Did Save/);\n expect(scriptOf(snapshot.willPrint?.root)).toMatch(/Will Print/);\n expect(scriptOf(snapshot.didPrint?.root)).toMatch(/Did Print/);\n\n const form = await doc.forms.list();\n expect(form.calculationOrder).toEqual([{ kind: 'objectNumber', objectNumber: 9 }]);\n } finally {\n await doc.close();\n }\n });\n\n test('attaches page /AA to PageLayout', async () => {\n const doc = await open(engine, opts, opts.fixtures.page);\n try {\n const pages = await doc.pages.list();\n expect(pages.pages[0].actions?.open?.root?.type).toBe('goto-embedded');\n expect(pages.pages[0].actions?.close).toBe(undefined);\n expect(pages.pages[1].actions?.open?.root?.type).toBe('goto-embedded');\n expect(pages.pages[1].actions?.close?.root?.type).toBe('goto-embedded');\n } finally {\n await doc.close();\n }\n });\n\n test('attaches activation actions to AnnotationBase, including links', async () => {\n const doc = await open(engine, opts, opts.fixtures.annotation);\n try {\n const firstPage = (await doc.pages.list()).pages[0];\n const snapshot = await doc.page(firstPage.ref).annotations.list();\n // The button is a widget: its row comes with the form.\n const button = (await doc.forms.list()).widgets.find(\n (widget) => widget.ref.kind === 'objectNumber' && widget.ref.objectNumber === 7,\n );\n const link = snapshot.annotations.find(\n (annotation) =>\n annotation.ref.kind === 'objectNumber' && annotation.ref.objectNumber === 8,\n );\n expect(button?.actions?.activate?.root?.type).toBe('uri');\n // A link carries both planes: the base-level scripting action model\n // (chain shape, for the orchestrator) and its own normalized target\n // (payload, for navigation). They must agree on the action type.\n expect(link?.subtype).toBe('link');\n expect(link?.actions?.activate?.root?.type).toBe('uri');\n if (link?.subtype === 'link') {\n expect(link.target?.kind).toBe('uri');\n }\n } finally {\n await doc.close();\n }\n });\n\n test('classifies a /S /JavaScript link target, script staying on base.actions', async () => {\n const fixture = opts.fixtures.javascriptLink;\n if (!fixture) return; // fixture not provided for this engine flavour\n const doc = await open(engine, opts, fixture);\n try {\n const firstPage = (await doc.pages.list()).pages[0];\n const snapshot = await doc.page(firstPage.ref).annotations.list();\n const link = snapshot.annotations.find((annotation) => annotation.subtype === 'link');\n expect(link?.subtype).toBe('link');\n if (link?.subtype === 'link') {\n // The navigation vocabulary classifies (FPDFAction_GetType alone\n // cannot — it has no JavaScript code)…\n expect(link.target).toEqual({ kind: 'javascript' });\n }\n // …while the script text lives only on the scripting plane's model.\n expect(link?.actions?.activate?.root?.type).toBe('javascript');\n expect(scriptOf(link?.actions?.activate?.root)).toMatch(/app\\.alert/);\n } finally {\n await doc.close();\n }\n });\n\n test('keeps field actions separate from merged widget events', async () => {\n const doc = await open(engine, opts, opts.fixtures.field);\n try {\n const form = await doc.forms.list();\n expect(form.fields).toHaveLength(1);\n expect(form.fields[0].actions?.format?.root?.type).toBe('javascript');\n expect(scriptOf(form.fields[0].actions?.format?.root)).toMatch(/AFDate_FormatEx/);\n expect(form.widgets).toHaveLength(1);\n expect(form.widgets[0]!.actions).toBe(null);\n } finally {\n await doc.close();\n }\n });\n\n test('carries interpreter payloads on every executable node', async () => {\n const doc = await open(engine, opts, opts.fixtures.payloads);\n try {\n const page = (await doc.pages.list()).pages[0];\n const snapshot = await doc.page(page.ref).annotations.list();\n const pageObjectNumber = page.ref.objectNumber;\n const rootOf = (nm: string) => {\n const annotation = snapshot.annotations.find((candidate) => candidate.nm === nm);\n expect(Boolean(annotation)).toBe(true);\n return annotation?.actions?.activate?.root ?? null;\n };\n const targetOf = (nm: string) => {\n const annotation = snapshot.annotations.find((candidate) => candidate.nm === nm);\n return annotation?.subtype === 'link' ? annotation.target : null;\n };\n\n // The file's /FitR 10 20 300 400, from the page's top-left.\n const visible = page.pdfCropBox;\n expect(rootOf('goto-fitr')).toMatchObject({\n type: 'goto',\n destination: {\n kind: 'fitR',\n page: toPageRef(pageObjectNumber),\n x: 10 - visible.left,\n y: visible.top - 400,\n width: 290,\n height: 380,\n },\n });\n // Dual planes agree by construction: the target is the tree's projection.\n expect(targetOf('goto-fitr')).toMatchObject({\n kind: 'goto',\n destination: { kind: 'fitR' },\n });\n\n expect(rootOf('uri-map')).toMatchObject({\n type: 'uri',\n uri: 'https://example.test/map',\n isMap: true,\n });\n expect(rootOf('named-next')).toMatchObject({ type: 'named', name: 'NextPage' });\n\n const mixed = rootOf('hide-mixed');\n expect(mixed).toMatchObject({ type: 'hide', hide: false });\n const mixedTargets = mixed?.type === 'hide' ? mixed.targets : [];\n expect(mixedTargets).toHaveLength(2);\n expect(mixedTargets[0]).toEqual({ kind: 'name', name: 'note1' });\n expect(mixedTargets[1]?.kind === 'objectNumber' && mixedTargets[1].objectNumber > 0).toBe(\n true,\n );\n expect(rootOf('hide-scalar')).toMatchObject({\n type: 'hide',\n targets: [{ kind: 'name', name: 'fieldB' }],\n hide: true,\n });\n\n // ResetForm's three states survive the wire distinctly.\n expect(rootOf('reset-include')).toMatchObject({\n type: 'reset-form',\n fields: [{ kind: 'name', name: 'calc1' }],\n exclude: true,\n });\n expect(rootOf('reset-absent')).toMatchObject({\n type: 'reset-form',\n fields: null,\n exclude: true,\n });\n expect(rootOf('reset-empty')).toMatchObject({\n type: 'reset-form',\n fields: [],\n exclude: false,\n });\n\n // SubmitForm's atomic payload. /UF beats /F in a\n // conforming << /FS /URL >> spec; a bare-string /F is the\n // producer-compat extension; bit 9 dominates format with GetMethod\n // kept alive (ISO 32000-2 Table 240).\n expect(rootOf('submit-urlspec')).toMatchObject({\n type: 'submit-form',\n payload: {\n url: 'https://uf.example.test/submit',\n fields: [{ kind: 'name', name: 'parent' }],\n flags: { raw: 0, exclude: false, format: 'fdf', method: 'post' },\n },\n });\n expect(rootOf('submit-compat-xfdf')).toMatchObject({\n type: 'submit-form',\n payload: {\n url: 'https://example.test/xfdf',\n fields: [\n { kind: 'name', name: 'noexport' },\n { kind: 'name', name: 'plain' },\n ],\n flags: {\n raw: 35,\n exclude: true,\n includeNoValueFields: true,\n format: 'xfdf',\n method: 'post',\n },\n charSet: 'utf-8',\n },\n });\n expect(rootOf('submit-pdf-get')).toMatchObject({\n type: 'submit-form',\n payload: {\n url: 'https://example.test/pdf',\n fields: null,\n flags: { raw: 264, format: 'pdf', method: 'get' },\n },\n });\n\n expect(rootOf('launch-app')).toMatchObject({ type: 'launch', filePath: 'app.exe' });\n expect(rootOf('gotor-file')).toMatchObject({ type: 'goto-remote', filePath: 'other.pdf' });\n\n // A mixed /Next chain carries every payload in PDF order.\n const chain = rootOf('chain-js-goto-hide');\n expect(chain).toMatchObject({ type: 'javascript', script: \"app.alert('chain');\" });\n // The file's /XYZ 5 10 1.25, from the page's top-left.\n expect(chain?.next[0]).toMatchObject({\n type: 'goto',\n destination: {\n kind: 'xyz',\n page: toPageRef(pageObjectNumber),\n x: 5 - visible.left,\n y: visible.top - 10,\n zoom: 1.25,\n },\n });\n expect(chain?.next[0]?.next[0]).toMatchObject({\n type: 'hide',\n targets: [{ kind: 'name', name: 'note1' }],\n hide: true,\n });\n } finally {\n await doc.close();\n }\n });\n\n test('degrades unreadable payloads to unknown with payload-dropped', async () => {\n const doc = await open(engine, opts, opts.fixtures.payloads);\n try {\n const page = (await doc.pages.list()).pages[0];\n const snapshot = await doc.page(page.ref).annotations.list();\n for (const [nm, subtype] of [\n ['goto-malformed', 'GoTo'],\n ['hide-partial', 'Hide'], // a partial target list must never half-execute\n // The atomic-payload law: a submit whose required /F is not a URL\n // (or is absent) degrades whole — never a half payload.\n ['submit-not-url', 'SubmitForm'],\n ['submit-no-f', 'SubmitForm'],\n ] as const) {\n const annotation = snapshot.annotations.find((candidate) => candidate.nm === nm);\n const tree = annotation?.actions?.activate;\n expect(tree?.root).toMatchObject({ type: 'unknown', subtype });\n expect(tree?.warnings ?? []).toContain('payload-dropped');\n // /A precedence, pinned: a broken action is a dead link — never a\n // silent /Dest fallback.\n if (annotation?.subtype === 'link') {\n expect(annotation.target).toEqual({ kind: 'unsupported' });\n }\n }\n } finally {\n await doc.close();\n }\n });\n\n test('reads a destination-form /OpenAction as openDestination', async () => {\n const doc = await open(engine, opts, opts.fixtures.openDestination);\n try {\n expect(Boolean(doc.actions)).toBe(true);\n const snapshot = await doc.actions!.get();\n expect(DocumentActionsSnapshotSchema.safeParse(snapshot).success).toBe(true);\n expect(snapshot.openAction).toBeNull();\n const pageObjectNumber = (await doc.pages.list()).pages[0].ref.objectNumber;\n // The file's [/XYZ 10 700 1.5] on a letter page, from the page's top-left.\n expect(snapshot.openDestination).toEqual({\n kind: 'xyz',\n page: toPageRef(pageObjectNumber),\n x: 10,\n y: 92,\n zoom: 1.5,\n });\n } finally {\n await doc.close();\n }\n });\n });\n}\n\nasync function open(\n engine: Engine,\n opts: ActionsConformanceOptions,\n fixture: ConformanceFixture,\n): Promise<DocumentHandle> {\n if (opts.openKind === 'bytes') {\n return engine.open(\n { kind: 'bytes', id: fixture.id, bytes: await fixture.bytes() },\n EVERY_PERMISSION,\n );\n }\n return engine.open({ kind: 'id', id: fixture.cloudId ?? fixture.id });\n}\n","import { isLocalPage } from '../engine/LocalPageHandle';\nimport type { PageHandle } from '../engine/PageHandle';\nimport { annotationKey } from '../identity/annotationKey';\nimport type { AnnotationRef } from '../identity/AnnotationRef';\n\n/**\n * Annotation appearances as pixels, for the suites that compare how an\n * annotation draws: the raw rasters where the engine returns them (local),\n * else its PNG images decoded (cloud).\n */\n\nexport interface Raster {\n width: number;\n height: number;\n /** RGBA, 4 bytes a pixel, no row padding. */\n rgba: Uint8Array;\n}\n\n/** Every normal appearance on a page, by annotation key, rendered at scale 1 in one call. */\nexport async function appearanceRasters(page: PageHandle): Promise<Map<string, Raster>> {\n const rasters = new Map<string, Raster>();\n if (isLocalPage(page)) {\n const { appearances } = await page.annotations.renderAppearancesRaw({\n viewport: { kind: 'scale', scale: 1 },\n });\n for (const { ref, mode, raster } of appearances) {\n if (mode !== 'normal') continue;\n const bytes = new Uint8Array(raster.data);\n const rgba = new Uint8Array(raster.width * raster.height * 4);\n for (let y = 0; y < raster.height; y++) {\n rgba.set(\n bytes.subarray(y * raster.stride, y * raster.stride + raster.width * 4),\n y * raster.width * 4,\n );\n }\n rasters.set(annotationKey(ref), { width: raster.width, height: raster.height, rgba });\n }\n return rasters;\n }\n const { appearances } = await page.annotations.renderAppearances({\n format: 'png',\n viewport: { kind: 'scale', scale: 1 },\n });\n for (const { ref, mode, image } of appearances) {\n if (mode !== 'normal' || image.source.kind !== 'bytes') continue;\n rasters.set(annotationKey(ref), await decodePng(image.source.bytes));\n }\n return rasters;\n}\n\nexport async function appearanceRaster(page: PageHandle, ref: AnnotationRef): Promise<Raster> {\n const key = annotationKey(ref);\n if (isLocalPage(page)) {\n const { appearances } = await page.annotations.renderAppearancesRaw({\n viewport: { kind: 'scale', scale: 1 },\n });\n const found = appearances.find((a) => annotationKey(a.ref) === key && a.mode === 'normal');\n if (!found) throw new Error(`no appearance rendered for ${key}`);\n const { raster } = found;\n const bytes = new Uint8Array(raster.data);\n const rgba = new Uint8Array(raster.width * raster.height * 4);\n for (let y = 0; y < raster.height; y++) {\n rgba.set(\n bytes.subarray(y * raster.stride, y * raster.stride + raster.width * 4),\n y * raster.width * 4,\n );\n }\n return { width: raster.width, height: raster.height, rgba };\n }\n const { appearances } = await page.annotations.renderAppearances({\n format: 'png',\n viewport: { kind: 'scale', scale: 1 },\n });\n const found = appearances.find((a) => annotationKey(a.ref) === key && a.mode === 'normal');\n if (!found || found.image.source.kind !== 'bytes') {\n throw new Error(`no appearance image rendered for ${key}`);\n }\n return decodePng(found.image.source.bytes);\n}\n\nexport function maxAlpha(raster: Raster): number {\n let max = 0;\n for (let i = 3; i < raster.rgba.length; i += 4) max = Math.max(max, raster.rgba[i]!);\n return max;\n}\n\nexport function maxDifference(a: Raster, b: Raster): number {\n let max = 0;\n for (let i = 0; i < a.rgba.length; i++) max = Math.max(max, Math.abs(a.rgba[i]! - b.rgba[i]!));\n return max;\n}\n\n/**\n * The largest difference between a pixel of one raster and the closest\n * pixel of the other within `radius` pixels, both ways: an edge that moved\n * by a fraction of a pixel counts as the same, a changed area does not.\n * Pixels compare as drawn, color times alpha, so the color of a pixel that\n * isn't drawn at all doesn't count.\n */\nexport function maxShiftedDifference(a: Raster, b: Raster, radius = 1): number {\n const oneWay = (from: Raster, to: Raster) => {\n let max = 0;\n for (let y = 0; y < from.height; y++) {\n for (let x = 0; x < from.width; x++) {\n let best = 255;\n for (let dy = -radius; dy <= radius && best > 0; dy++) {\n for (let dx = -radius; dx <= radius && best > 0; dx++) {\n const ny = y + dy;\n const nx = x + dx;\n if (ny < 0 || nx < 0 || ny >= to.height || nx >= to.width) continue;\n let difference = 0;\n const a = (y * from.width + x) * 4;\n const b = (ny * to.width + nx) * 4;\n for (let c = 0; c < 4; c++) {\n const delta = Math.abs(drawn(from.rgba, a, c) - drawn(to.rgba, b, c));\n if (delta > difference) difference = delta;\n }\n if (difference < best) best = difference;\n }\n }\n if (best > max) max = best;\n }\n }\n return max;\n };\n return Math.max(oneWay(a, b), oneWay(b, a));\n}\n\n/** Channel `channel` of the pixel at `at` as drawn: color times alpha, or the alpha. */\nfunction drawn(rgba: Uint8Array, at: number, channel: number): number {\n const alpha = rgba[at + 3]!;\n return channel === 3 ? alpha : Math.round((rgba[at + channel]! * alpha) / 255);\n}\n\n/** An 8-bit, non-interlaced RGB or RGBA PNG as RGBA. Enough for the engines' own encoders. */\nexport async function decodePng(png: Uint8Array): Promise<Raster> {\n const view = new DataView(png.buffer, png.byteOffset, png.byteLength);\n let offset = 8;\n let width = 0;\n let height = 0;\n let channels = 4;\n const data: Uint8Array[] = [];\n while (offset < png.length) {\n const length = view.getUint32(offset);\n const type = String.fromCharCode(...png.subarray(offset + 4, offset + 8));\n const body = png.subarray(offset + 8, offset + 8 + length);\n if (type === 'IHDR') {\n width = view.getUint32(offset + 8);\n height = view.getUint32(offset + 12);\n if (body[8] !== 8 || body[12] !== 0) throw new Error('only 8-bit non-interlaced PNGs');\n channels = body[9] === 6 ? 4 : body[9] === 2 ? 3 : 0;\n if (!channels) throw new Error(`unsupported PNG color type ${body[9]}`);\n } else if (type === 'IDAT') {\n data.push(body);\n }\n offset += 12 + length;\n }\n const compressed = new Blob(data as BlobPart[]);\n const inflated = new Uint8Array(\n await new Response(\n compressed.stream().pipeThrough(new DecompressionStream('deflate')),\n ).arrayBuffer(),\n );\n const stride = width * channels;\n const pixels = new Uint8Array(height * stride);\n for (let y = 0; y < height; y++) {\n const filter = inflated[y * (stride + 1)]!;\n const line = inflated.subarray(y * (stride + 1) + 1, (y + 1) * (stride + 1));\n for (let x = 0; x < stride; x++) {\n const left = x >= channels ? pixels[y * stride + x - channels]! : 0;\n const up = y > 0 ? pixels[(y - 1) * stride + x]! : 0;\n const upLeft = y > 0 && x >= channels ? pixels[(y - 1) * stride + x - channels]! : 0;\n const predictor =\n filter === 1\n ? left\n : filter === 2\n ? up\n : filter === 3\n ? (left + up) >> 1\n : filter === 4\n ? paeth(left, up, upLeft)\n : 0;\n pixels[y * stride + x] = (line[x]! + predictor) & 0xff;\n }\n }\n if (channels === 4) return { width, height, rgba: pixels };\n const rgba = new Uint8Array(width * height * 4);\n for (let i = 0, j = 0; i < pixels.length; i += 3, j += 4) {\n rgba.set(pixels.subarray(i, i + 3), j);\n rgba[j + 3] = 255;\n }\n return { width, height, rgba };\n}\n\nfunction paeth(a: number, b: number, c: number): number {\n const p = a + b - c;\n const pa = Math.abs(p - a);\n const pb = Math.abs(p - b);\n const pc = Math.abs(p - c);\n return pa <= pb && pa <= pc ? a : pb <= pc ? b : c;\n}\n","import type { AnnotationDraft } from '../annotation/kinds';\nimport type { AnnotationResources } from '../annotation/resources';\nimport type { PageBox } from '../geometry/pageSpace';\n\n/** A 1×1 PNG, the smallest source a stamp accepts. */\nexport const PNG_1X1 = Uint8Array.from(\n atob(\n 'iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mNkYPhfDwAChwGA60e6kgAAAABJRU5ErkJggg==',\n ),\n (character) => character.charCodeAt(0),\n);\n\n/** A create's two arguments. */\nexport interface Creatable {\n data: AnnotationDraft;\n resources?: AnnotationResources;\n}\n\n/** A note's or a file's icon at its usual 20 × 20, by its top-left corner. */\nexport function iconRect(x: number, y: number): PageBox {\n return { x, y, width: 20, height: 20 };\n}\n\n/** One create for every kind the engine can create, inside a box near the page's top-left. */\nexport function creatables(): Creatable[] {\n const rect: PageBox = { x: 40, y: 40, width: 100, height: 60 };\n const quad = {\n upperLeft: { x: 40, y: 40 },\n upperRight: { x: 140, y: 40 },\n lowerLeft: { x: 40, y: 60 },\n lowerRight: { x: 140, y: 60 },\n };\n const vertices = [\n { x: 50, y: 90 },\n { x: 130, y: 90 },\n { x: 90, y: 50 },\n ];\n const drafts: AnnotationDraft[] = [\n { subtype: 'highlight', quadPoints: [quad] },\n { subtype: 'underline', quadPoints: [quad] },\n { subtype: 'squiggly', quadPoints: [quad] },\n { subtype: 'strikeout', quadPoints: [quad] },\n { subtype: 'square', box: rect },\n // Rotation and a shape caption live in /EMBD_Metadata, which a plain annotation lacks.\n { subtype: 'square', box: { x: 60, y: 50, width: 60, height: 40 }, rotation: 30 },\n // Bumps and a callout's line reach past the box: `rect` holds them.\n { subtype: 'square', box: { x: 60, y: 50, width: 60, height: 40 }, cloudyIntensity: 1 },\n { subtype: 'circle', box: rect },\n { subtype: 'polygon', rect, vertices },\n { subtype: 'polygon', rect, vertices, captionEnabled: true, captionCenter: { x: 90, y: 80 } },\n { subtype: 'polyline', rect, vertices },\n { subtype: 'line', rect, linePoints: { start: { x: 50, y: 90 }, end: { x: 130, y: 50 } } },\n { subtype: 'ink', rect, inkList: [vertices] },\n {\n subtype: 'free-text',\n box: rect,\n intent: 'free-text',\n fontFamily: 'helvetica',\n fontSize: 12,\n textAlign: 'left',\n contents: 'Declaration conformance',\n },\n {\n subtype: 'free-text',\n box: { x: 80, y: 40, width: 60, height: 40 },\n intent: 'free-text-callout',\n fontFamily: 'helvetica',\n fontSize: 12,\n textAlign: 'left',\n contents: 'A callout',\n calloutLine: [\n { x: 45, y: 95 },\n { x: 60, y: 70 },\n { x: 80, y: 60 },\n ],\n lineEnding: 'open-arrow',\n },\n { subtype: 'caret', box: rect },\n { subtype: 'text', rect: iconRect(rect.x, rect.y) },\n { subtype: 'link', rect, target: { kind: 'uri', uri: 'https://example.com' } },\n { subtype: 'redact', rect, quadPoints: [quad] },\n ];\n return [\n ...drafts.map((data) => ({ data })),\n { data: { subtype: 'stamp', box: rect }, resources: { appearance: PNG_1X1 } },\n {\n data: {\n subtype: 'file-attachment',\n rect: iconRect(rect.x, rect.y),\n file: { name: 'note.txt', mimeType: 'text/plain', description: 'A note' },\n },\n resources: { file: new TextEncoder().encode('attached') },\n },\n ];\n}\n","import { appearanceRaster } from './appearanceRasters';\nimport { iconRect } from './creatables';\nimport type {\n ConformanceTestRunner,\n ConformanceFixture,\n ConformanceOptions,\n} from './runMetadataConformance';\nimport { drawnPointsOf } from '../pageSpace/helpers';\nimport type {\n AnnotationDraft,\n AnnotationPatch,\n CaretDraft,\n CircleDraft,\n FreeTextDraft,\n HighlightDraft,\n InkDraft,\n LineDraft,\n LinkDraft,\n PolygonDraft,\n PolylineDraft,\n RedactDraft,\n SquareDraft,\n StrikeoutDraft,\n TextDraft,\n TextPatch,\n} from '../annotation/kinds';\nimport type { DocumentHandle } from '../engine/DocumentHandle';\nimport type { Engine } from '../engine/Engine';\nimport { EngineError } from '../errors/EngineError';\nimport { EngineErrorCode } from '../errors/EngineErrorCode';\nimport type { PageBox, PagePoint } from '../geometry/pageSpace';\nimport { pagePointsBounds, pagePointTurned, pageTurnOfUpright } from '../pageSpace/helpers';\nimport { annotationKey } from '../identity/annotationKey';\nimport type { AnnotationRef } from '../identity/AnnotationRef';\nimport { toPageRef } from '../identity/PageRef';\nimport { AbortError } from '../promise/AbortError';\nimport {\n AnnotationCreateResultSchema,\n AnnotationReorderResultSchema,\n AnnotationUpdateResultSchema,\n} from '../wire/schemas';\nimport { EVERY_PERMISSION } from './fixtureScope';\n\n/**\n * Per-fixture knowledge the mutation harness needs. The shared fixture\n * fields (id, bytes, etc.) come from `ConformanceFixture`; the bits below\n * pin the test page. The harness asserts behaviour, not exact wire\n * content, so the same fixture can run against both local (WASM) and\n * cloud (native via @cloudpdf/server) engines.\n */\nexport interface AnnotationMutationConformanceFixture extends ConformanceFixture {\n /** PDF object number of the page used by the mutation tests. */\n pageObjectNumber: number;\n /** The page has at least one annotation born inline (a dictionary in `/Annots`, no object number). */\n expectsInlineAnnotation: boolean;\n /**\n * QuadPoints to use for the create() smoke test, in page space; pick a\n * small rectangle that fits anywhere on the fixture page so we don't\n * flake on different page sizes.\n */\n createQuad?: HighlightDraft['quadPoints'];\n /**\n * The box to use for the shape (circle/square) create tests, in page\n * space; pick a small box that fits anywhere on the fixture page.\n */\n createShapeRect?: PageBox;\n /**\n * `/Vertices` to use for the polygon/polyline create tests, in page\n * space; must fit inside `createShapeRect`. Defaults to a small triangle.\n */\n createVertices?: PagePoint[];\n /**\n * `/L` endpoints to use for the line create test, in page space; must fit\n * inside `createShapeRect`. Defaults to the rect's diagonal.\n */\n createLinePoints?: LineDraft['linePoints'];\n /**\n * `/InkList` strokes to use for the ink create test, in page space; must\n * fit inside `createShapeRect`. Defaults to a single short stroke.\n */\n createInkList?: InkDraft['inkList'];\n}\n\nexport interface AnnotationMutationConformanceOptions extends Omit<ConformanceOptions, 'fixture'> {\n fixture: AnnotationMutationConformanceFixture;\n}\n\n/** Its top corners first, as a text selection's quads are. */\nconst DEFAULT_QUAD: HighlightDraft['quadPoints'] = [\n {\n upperLeft: { x: 50, y: 100 },\n upperRight: { x: 150, y: 100 },\n lowerLeft: { x: 50, y: 120 },\n lowerRight: { x: 150, y: 120 },\n },\n];\n\nconst DEFAULT_SHAPE_RECT: PageBox = { x: 60, y: 60, width: 100, height: 80 };\n\n/** A small triangle inside DEFAULT_SHAPE_RECT (valid for polygon: >=3). */\nconst DEFAULT_VERTICES: PagePoint[] = [\n { x: 70, y: 130 },\n { x: 150, y: 130 },\n { x: 110, y: 70 },\n];\n\n/** A line along the diagonal of DEFAULT_SHAPE_RECT. */\nconst DEFAULT_LINE_POINTS: LineDraft['linePoints'] = {\n start: { x: 70, y: 130 },\n end: { x: 150, y: 70 },\n};\n\n/**\n * A knee-jointed callout leader inside DEFAULT_SHAPE_RECT: the called-out\n * point, a knee, then the point touching the text box.\n */\nconst DEFAULT_CALLOUT_LINE: [PagePoint, PagePoint, PagePoint] = [\n { x: 65, y: 135 },\n { x: 90, y: 110 },\n { x: 110, y: 100 },\n];\n\n/** A single freehand stroke inside DEFAULT_SHAPE_RECT (valid for ink). */\n/** Equal to 3 decimals: points and rects are stored as f32. */\nconst near = (a: number, b: number): boolean => Math.abs(a - b) < 5e-4;\n\nconst DEFAULT_INK_STROKES: InkDraft['inkList'] = [\n [\n { x: 70, y: 130 },\n { x: 100, y: 80 },\n { x: 130, y: 120 },\n { x: 150, y: 70 },\n ],\n];\n\n/**\n * Mutation conformance suite. Mirrors the read suite: tests are written\n * once and run against any engine that satisfies the public API\n * surface. Both local (worker host + WASM) and cloud (HTTP +\n * @cloudpdf/server) implementations must pass identically.\n *\n * The locked rules being verified here:\n * - `create` is append-only: the new annotation paints on top of the\n * page's others, and none of them moves.\n * - Every annotation keeps its name through every write: an object\n * number, or the `baseIndex` of one born inline in the file. No write\n * stamps an /NM to name one.\n * - Abort propagates as `AbortError` even before the worker\n * responds.\n */\nexport function runAnnotationMutationConformance(\n runner: ConformanceTestRunner,\n opts: AnnotationMutationConformanceOptions,\n): void {\n const { describe, test, beforeAll, afterAll, expect } = runner;\n const fix = opts.fixture;\n const quad = fix.createQuad ?? DEFAULT_QUAD;\n const shapeRect = fix.createShapeRect ?? DEFAULT_SHAPE_RECT;\n const vertices = fix.createVertices ?? DEFAULT_VERTICES;\n const linePoints = fix.createLinePoints ?? DEFAULT_LINE_POINTS;\n const inkStrokes = fix.createInkList ?? DEFAULT_INK_STROKES;\n\n describe(`annotation mutation conformance: ${opts.label}`, () => {\n let engine: Engine;\n\n beforeAll(async () => {\n engine = await opts.makeEngine();\n });\n\n afterAll(async () => {\n if (engine) await engine.destroy();\n });\n\n test('create appends on top without moving the others', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const page = doc.page(toPageRef(fix.pageObjectNumber));\n const before = await page.annotations.list();\n const beforeCount = before.annotations.length;\n\n const draft: HighlightDraft = {\n subtype: 'highlight',\n contents: 'mutation conformance: created',\n color: '#c86432',\n opacity: 0.5,\n quadPoints: quad,\n };\n const result = await page.annotations.create(draft);\n expect(AnnotationCreateResultSchema.safeParse(result).success).toBe(true);\n expect(result.meta.affectedPages.length).toBe(1);\n expect(result.meta.affectedPages[0].objectNumber).toBe(fix.pageObjectNumber);\n expect('cacheDelta' in result.meta).toBe(true);\n\n // Born as an object (the engine creates it with EPDFPage_CreateAnnotRaw).\n expect(result.annotation.subtype).toBe('highlight');\n expect(result.annotation.ref.kind).toBe('objectNumber');\n\n expect(result.meta.changed.length).toBe(1);\n\n // The annotation is actually on the page now, on top of the others.\n const after = await page.annotations.list();\n expect(after.annotations.length).toBe(beforeCount + 1);\n expect(annotationKey(after.annotations.at(-1)!.ref)).toBe(\n annotationKey(result.annotation.ref),\n );\n } finally {\n await doc.close();\n }\n });\n\n test('create and update write each annotation flag as its own field', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const page = doc.page(toPageRef(fix.pageObjectNumber));\n\n // Create with a single flag set; the others must default to false.\n const draft: HighlightDraft = {\n subtype: 'highlight',\n contents: 'mutation conformance: flags',\n color: '#0a141e',\n opacity: 1,\n quadPoints: quad,\n print: true,\n };\n const created = await page.annotations.create(draft);\n expect(created.annotation.print).toBe(true);\n expect(created.annotation.hidden).toBe(false);\n\n // Setting another flag leaves `print` as it is.\n const hidden = await page.annotations.update(created.annotation.ref, { hidden: true });\n expect(hidden.annotation.hidden).toBe(true);\n expect(hidden.annotation.print).toBe(true);\n\n // Clearing one flag leaves the rest untouched.\n const cleared = await page.annotations.update(created.annotation.ref, { print: false });\n expect(cleared.annotation.print).toBe(false);\n expect(cleared.annotation.hidden).toBe(true);\n } finally {\n await doc.close();\n }\n });\n\n test('create shape annotations (circle + square) round-trip shape fields', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const page = doc.page(toPageRef(fix.pageObjectNumber));\n\n const circleDraft: CircleDraft = {\n subtype: 'circle',\n contents: 'mutation conformance: circle',\n box: shapeRect,\n interiorColor: '#ff0000',\n color: '#0000ff',\n strokeWidth: 3,\n borderStyle: 'solid',\n opacity: 0.6,\n };\n const circle = await page.annotations.create(circleDraft);\n expect(AnnotationCreateResultSchema.safeParse(circle).success).toBe(true);\n expect(circle.annotation.subtype).toBe('circle');\n expect(circle.annotation.ref.kind).toBe('objectNumber');\n if (circle.annotation.subtype === 'circle') {\n expect(circle.annotation.interiorColor).toBe('#ff0000');\n expect(circle.annotation.color).toBe('#0000ff');\n expect(circle.annotation.strokeWidth).toBe(3);\n expect(circle.annotation.borderStyle).toBe('solid');\n // /CA stored as f32 — compare at 2dp to absorb float drift.\n expect(Math.round(circle.annotation.opacity * 100) / 100).toBe(0.6);\n // The border is drawn inside the box, so `rect` is the box. The\n // chosen bounds are small integers that are exactly representable\n // in f32, so an exact compare is safe.\n expect(circle.annotation.box).toEqual(shapeRect);\n expect(circle.annotation.rect).toEqual(shapeRect);\n }\n\n const squareDraft: SquareDraft = {\n subtype: 'square',\n contents: 'mutation conformance: square',\n box: shapeRect,\n interiorColor: null,\n color: '#008000',\n strokeWidth: 2,\n borderStyle: 'dashed',\n dashArray: [3, 2],\n opacity: 1,\n };\n const square = await page.annotations.create(squareDraft);\n expect(AnnotationCreateResultSchema.safeParse(square).success).toBe(true);\n expect(square.annotation.subtype).toBe('square');\n if (square.annotation.subtype === 'square') {\n // interiorColor omitted/null => no fill.\n expect(square.annotation.interiorColor).toBe(null);\n expect(square.annotation.color).toBe('#008000');\n expect(square.annotation.borderStyle).toBe('dashed');\n expect(square.annotation.dashArray).toEqual([3, 2]);\n }\n\n const after = await page.annotations.list();\n const subtypes = after.annotations.map((a) => a.subtype);\n expect(subtypes.includes('circle')).toBe(true);\n expect(subtypes.includes('square')).toBe(true);\n } finally {\n await doc.close();\n }\n });\n\n test('a cloudy border reaches past the box, and rect takes it in', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const page = doc.page(toPageRef(fix.pageObjectNumber));\n\n // A plain shape reads `cloudyIntensity` as explicit null — absence is\n // stated, so a read DTO compares structurally against a clearing\n // patch. The draft also states it as null (exactly what the plugin's\n // total projection emits for a fresh solid shape): a draft writer must\n // skip null, never dereference it — the stale-worker regression where\n // solid creates vanished while cloudy ones survived.\n const plainDraft: SquareDraft = {\n subtype: 'square',\n contents: 'mutation conformance: cloudy border',\n box: shapeRect,\n color: '#008000',\n strokeWidth: 2,\n borderStyle: 'solid',\n opacity: 1,\n cloudyIntensity: null,\n };\n const plain = await page.annotations.create(plainDraft);\n expect(plain.annotation.subtype).toBe('square');\n if (plain.annotation.subtype === 'square') {\n expect(plain.annotation.cloudyIntensity).toBe(null);\n expect(plain.annotation.rect).toEqual(shapeRect);\n }\n\n // The bumps reach out past the box on every side: the box stays, and\n // `rect` takes them in.\n const cloudy = await page.annotations.update(plain.annotation.ref, {\n subtype: 'square',\n cloudyIntensity: 2,\n });\n expect(cloudy.annotation.subtype).toBe('square');\n if (cloudy.annotation.subtype === 'square') {\n expect(cloudy.annotation.cloudyIntensity).toBe(2);\n const { box, rect } = cloudy.annotation;\n for (const edge of ['x', 'y', 'width', 'height'] as const) {\n expect(Math.abs(box[edge] - shapeRect[edge]) < 1e-3).toBe(true);\n }\n expect(rect.x < box.x - 1 && rect.y < box.y - 1).toBe(true);\n expect(rect.x + rect.width > box.x + box.width + 1).toBe(true);\n expect(rect.y + rect.height > box.y + box.height + 1).toBe(true);\n }\n\n // A solid border gives the room back: no stale bump room is left\n // behind (the Adobe \"phantom padding\" regression).\n const solid = await page.annotations.update(plain.annotation.ref, {\n subtype: 'square',\n cloudyIntensity: null,\n });\n expect(solid.annotation.subtype).toBe('square');\n if (solid.annotation.subtype === 'square') {\n expect(solid.annotation.cloudyIntensity).toBe(null);\n expect(solid.annotation.rect).toEqual(shapeRect);\n }\n\n // Polygon carries /BE too (but never /RD, per ISO 32000) — same tri-state,\n // including the draft path.\n const polyDraft: PolygonDraft = {\n subtype: 'polygon',\n contents: 'mutation conformance: polygon cloudy tri-state',\n vertices,\n color: '#0000ff',\n strokeWidth: 2,\n borderStyle: 'solid',\n opacity: 1,\n cloudyIntensity: 1,\n };\n const poly = await page.annotations.create(polyDraft);\n expect(poly.annotation.subtype).toBe('polygon');\n if (poly.annotation.subtype === 'polygon') {\n expect(poly.annotation.cloudyIntensity).toBe(1);\n }\n const polySolid = await page.annotations.update(poly.annotation.ref, {\n subtype: 'polygon',\n cloudyIntensity: null,\n });\n expect(polySolid.annotation.subtype).toBe('polygon');\n if (polySolid.annotation.subtype === 'polygon') {\n expect(polySolid.annotation.cloudyIntensity).toBe(null);\n }\n } finally {\n await doc.close();\n }\n });\n\n test('update echoes the appearance verdict: moves preserve /AP, restyles re-bake', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const page = doc.page(toPageRef(fix.pageObjectNumber));\n const draft: SquareDraft = {\n subtype: 'square',\n contents: 'mutation conformance: appearance echo',\n box: shapeRect,\n color: '#c80000',\n strokeWidth: 2,\n borderStyle: 'solid',\n opacity: 1,\n };\n const created = await page.annotations.create(draft);\n\n // A full-projection patch whose only real change is a same-size /Rect\n // move: the engine value-diffs away the unchanged style keys, verifies\n // the rigid translation, and preserves the baked /AP — the raster\n // invalidation signal stays off.\n const moved = await page.annotations.update(created.annotation.ref, {\n subtype: 'square',\n box: { ...shapeRect, x: shapeRect.x + 12, y: shapeRect.y + 8 },\n color: '#c80000',\n strokeWidth: 2,\n opacity: 1,\n });\n expect(moved.appearance).toEqual({ action: 'preserved', changed: false });\n\n // Metadata-only patches never touch /AP.\n const flagged = await page.annotations.update(created.annotation.ref, {\n subtype: 'square',\n print: true,\n });\n expect(flagged.appearance).toEqual({ action: 'preserved', changed: false });\n\n // A real style edit re-bakes and says so.\n const restyled = await page.annotations.update(created.annotation.ref, {\n subtype: 'square',\n interiorColor: '#ffd600',\n });\n expect(restyled.appearance).toEqual({ action: 'regenerated', changed: true });\n\n // A resize is not a translation — it re-bakes too.\n const resized = await page.annotations.update(created.annotation.ref, {\n subtype: 'square',\n box: { ...shapeRect, width: shapeRect.width + 40 },\n });\n expect(resized.appearance).toEqual({ action: 'regenerated', changed: true });\n } finally {\n await doc.close();\n }\n });\n\n test('a partial /DA patch preserves the unpatched font members', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const page = doc.page(toPageRef(fix.pageObjectNumber));\n const draft: FreeTextDraft = {\n subtype: 'free-text',\n intent: 'free-text',\n contents: 'DA read-modify-write',\n box: shapeRect,\n fontFamily: 'times-roman',\n fontSize: 14,\n textAlign: 'left',\n color: '#c80000',\n };\n const created = await page.annotations.create(draft);\n // `/DA` packs font+size+colour into one string; the writer must\n // read-modify-write, so a partial patch cannot reset the others (the\n // old constant fallbacks turned a size-only patch into 12pt black).\n expect(created.annotation.subtype).toBe('free-text');\n if (created.annotation.subtype === 'free-text') {\n expect(created.annotation.fontFamily).toBe('times-roman');\n }\n const sized = await page.annotations.update(created.annotation.ref, {\n subtype: 'free-text',\n fontSize: 18,\n });\n expect(sized.annotation.subtype).toBe('free-text');\n if (sized.annotation.subtype === 'free-text') {\n expect(sized.annotation.fontFamily).toBe('times-roman');\n expect(sized.annotation.fontSize).toBe(18);\n expect(sized.annotation.color).toBe('#c80000');\n }\n const recolored = await page.annotations.update(created.annotation.ref, {\n subtype: 'free-text',\n color: '#0000c8',\n });\n if (recolored.annotation.subtype === 'free-text') {\n expect(recolored.annotation.fontFamily).toBe('times-roman');\n expect(recolored.annotation.fontSize).toBe(18);\n expect(recolored.annotation.color).toBe('#0000c8');\n }\n } finally {\n await doc.close();\n }\n });\n\n test('a turn stays until changed: a box move keeps it, null straightens', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const page = doc.page(toPageRef(fix.pageObjectNumber));\n const draft: SquareDraft = {\n subtype: 'square',\n contents: 'transform tri-state',\n box: shapeRect,\n color: '#0000ff',\n strokeWidth: 2,\n borderStyle: 'solid',\n opacity: 1,\n rotation: 90,\n };\n const created = await page.annotations.create(draft);\n expect(created.annotation.subtype).toBe('square');\n if (created.annotation.subtype === 'square') {\n expect(created.annotation.rotation).toBe(90);\n }\n // The engine sets `rect` to the upright box around the turned box: a\n // quarter turn swaps its sides about the same middle.\n const turnedRect = created.annotation.rect;\n expect(turnedRect.width).toBe(shapeRect.height);\n expect(turnedRect.height).toBe(shapeRect.width);\n\n // The box and its turn riding one delta is a verified translation: the\n // rotation survives and the baked /AP is preserved.\n const d = { x: 15, y: -10 };\n const shift = (r: PageBox): PageBox => ({ ...r, x: r.x + d.x, y: r.y + d.y });\n const moved = await page.annotations.update(created.annotation.ref, {\n subtype: 'square',\n box: shift(shapeRect),\n rotation: 90,\n });\n expect(moved.appearance).toEqual({ action: 'preserved', changed: false });\n expect(moved.annotation.rect).toEqual(shift(turnedRect));\n if (moved.annotation.subtype === 'square') {\n expect(moved.annotation.rotation).toBe(90);\n }\n\n // A box-only move keeps the omitted rotation (tri-state law: a patch\n // touches what it states).\n const boxOnly = await page.annotations.update(created.annotation.ref, {\n subtype: 'square',\n box: shapeRect,\n });\n if (boxOnly.annotation.subtype === 'square') {\n expect(boxOnly.annotation.rotation).toBe(90);\n }\n\n // Explicit null straightens the box where it is.\n const straightened = await page.annotations.update(created.annotation.ref, {\n subtype: 'square',\n rotation: null,\n });\n if (straightened.annotation.subtype === 'square') {\n expect(straightened.annotation.rotation).toBe(null);\n expect(straightened.annotation.box).toEqual(shapeRect);\n expect(straightened.annotation.rect).toEqual(shapeRect);\n }\n } finally {\n await doc.close();\n }\n });\n\n test('a line, polyline, polygon or ink: rect is what the engine draws', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const page = doc.page(toPageRef(fix.pageObjectNumber));\n const contains = (outer: PageBox, inner: PageBox) =>\n outer.x <= inner.x + 1e-3 &&\n outer.y <= inner.y + 1e-3 &&\n outer.x + outer.width >= inner.x + inner.width - 1e-3 &&\n outer.y + outer.height >= inner.y + inner.height - 1e-3;\n const area = (r: PageBox) => r.width * r.height;\n const grown = (r: PageBox, by: number): PageBox => ({\n x: r.x - by,\n y: r.y - by,\n width: r.width + 2 * by,\n height: r.height + 2 * by,\n });\n\n // No rect is sent: the engine measures the stroke and the arrowheads.\n const line = (lineEndings: LineDraft['lineEndings']) =>\n page.annotations.create({\n subtype: 'line',\n linePoints,\n color: '#000000',\n strokeWidth: 2,\n lineEndings,\n } satisfies LineDraft);\n const plain = (await line({ start: 'none', end: 'none' })).annotation;\n const arrowed = (await line({ start: 'closed-arrow', end: 'closed-arrow' })).annotation;\n const ends = pagePointsBounds([linePoints.start, linePoints.end]);\n expect(contains(plain.rect, grown(ends, 0.5))).toBe(true);\n expect(contains(arrowed.rect, plain.rect)).toBe(true);\n expect(area(arrowed.rect) > area(plain.rect)).toBe(true);\n\n // A wider pen widens the rect, a narrower one narrows it again.\n const ink = (strokeWidth: number) =>\n page.annotations.create({\n subtype: 'ink',\n inkList: inkStrokes,\n color: '#1d4ed8',\n strokeWidth,\n } satisfies InkDraft);\n const thin = (await ink(1)).annotation;\n const wide = (await ink(6)).annotation;\n const drawn = pagePointsBounds(inkStrokes.flat());\n expect(contains(thin.rect, grown(drawn, 0.5))).toBe(true);\n expect(contains(wide.rect, grown(drawn, 3))).toBe(true);\n expect(wide.rect.width > thin.rect.width + 4.9).toBe(true);\n const narrowed = await page.annotations.update(wide.ref, {\n subtype: 'ink',\n strokeWidth: 1,\n });\n expect(near(narrowed.annotation.rect.x, thin.rect.x)).toBe(true);\n expect(near(narrowed.annotation.rect.width, thin.rect.width)).toBe(true);\n } finally {\n await doc.close();\n }\n });\n\n test('points are upright: rotation turns them about the middle of their box', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const page = doc.page(toPageRef(fix.pageObjectNumber));\n const expectPoints = (actual: readonly PagePoint[], expected: readonly PagePoint[]) => {\n expect(actual.length).toBe(expected.length);\n actual.forEach((point, i) => {\n expect(near(point.x, expected[i]!.x)).toBe(true);\n expect(near(point.y, expected[i]!.y)).toBe(true);\n });\n };\n const created = await page.annotations.create({\n subtype: 'polygon',\n vertices,\n color: '#0000ff',\n strokeWidth: 2,\n rotation: 90,\n } satisfies PolygonDraft);\n const polygon = created.annotation;\n if (polygon.subtype !== 'polygon') throw new Error('expected a polygon');\n // A read gives the points as sent, and the turn.\n expect(polygon.rotation).toBe(90);\n expectPoints(polygon.vertices, vertices);\n // The page shows them turned about the middle of their box, and rect is\n // around what it shows.\n const turn = pageTurnOfUpright(vertices, 90);\n const drawn = vertices.map((point) => pagePointTurned(point, turn));\n expectPoints(drawnPointsOf(polygon)![0]!, drawn);\n const drawnBounds = pagePointsBounds(drawn);\n expect(polygon.rect.x <= drawnBounds.x).toBe(true);\n expect(polygon.rect.y <= drawnBounds.y).toBe(true);\n expect(polygon.rect.x + polygon.rect.width >= drawnBounds.x + drawnBounds.width).toBe(true);\n expect(polygon.rect.y + polygon.rect.height >= drawnBounds.y + drawnBounds.height).toBe(\n true,\n );\n\n // Moving the points keeps the turn and the drawing: rect moves with them.\n const d = { x: 15, y: -10 };\n const moved = await page.annotations.update(polygon.ref, {\n subtype: 'polygon',\n vertices: vertices.map((point) => ({ x: point.x + d.x, y: point.y + d.y })),\n });\n expect(moved.appearance).toEqual({ action: 'preserved', changed: false });\n if (moved.annotation.subtype !== 'polygon') throw new Error('expected a polygon');\n expect(moved.annotation.rotation).toBe(90);\n expect(near(moved.annotation.rect.x, polygon.rect.x + d.x)).toBe(true);\n expect(near(moved.annotation.rect.y, polygon.rect.y + d.y)).toBe(true);\n\n // A new turn keeps the points upright and draws them again.\n const turned = await page.annotations.update(polygon.ref, {\n subtype: 'polygon',\n vertices,\n rotation: 45,\n });\n expect(turned.appearance.action === 'preserved').toBe(false);\n if (turned.annotation.subtype !== 'polygon') throw new Error('expected a polygon');\n expect(turned.annotation.rotation).toBe(45);\n expectPoints(turned.annotation.vertices, vertices);\n\n // Null straightens the points where they are.\n const straightened = await page.annotations.update(polygon.ref, {\n subtype: 'polygon',\n rotation: null,\n });\n if (straightened.annotation.subtype !== 'polygon') throw new Error('expected a polygon');\n expect(straightened.annotation.rotation).toBe(null);\n expectPoints(straightened.annotation.vertices, vertices);\n expectPoints(drawnPointsOf(straightened.annotation)![0]!, vertices);\n } finally {\n await doc.close();\n }\n });\n\n test(\"a note's icon fills its rect, and moves and grows with it\", async () => {\n const doc = await openFixture(engine, opts);\n try {\n const page = doc.page(toPageRef(fix.pageObjectNumber));\n const rect = iconRect(shapeRect.x, shapeRect.y);\n const created = await page.annotations.create({\n subtype: 'text',\n rect,\n icon: 'comment',\n } satisfies TextDraft);\n const note = created.annotation;\n if (note.subtype !== 'text') throw new Error('expected a note');\n expect(note.rect).toEqual(rect);\n\n // A move keeps the drawing: the icon only moves.\n const to = iconRect(rect.x + 30, rect.y + 15);\n const moved = await page.annotations.update(note.ref, { subtype: 'text', rect: to });\n expect(moved.annotation.rect).toEqual(to);\n expect(moved.appearance.changed).toBe(false);\n\n // A bigger rect is a bigger icon, drawn again.\n const bigger = { ...to, width: 50, height: 50 };\n const grown = await page.annotations.update(note.ref, { subtype: 'text', rect: bigger });\n expect(grown.annotation.rect).toEqual(bigger);\n expect(grown.appearance.changed).toBe(true);\n } finally {\n await doc.close();\n }\n });\n\n test(\"a new rect puts a drawing there, as a script's annot.rect does in Acrobat\", async () => {\n const doc = await openFixture(engine, opts);\n try {\n const page = doc.page(toPageRef(fix.pageObjectNumber));\n const offset = (r: PageBox, dx: number, dy: number): PageBox => ({\n ...r,\n x: r.x + dx,\n y: r.y + dy,\n });\n const expectPoint = (actual: PagePoint, expected: PagePoint) => {\n expect(near(actual.x, expected.x) && near(actual.y, expected.y)).toBe(true);\n };\n const expectRect = (actual: PageBox, expected: PageBox) => {\n expectPoint(actual, expected);\n expectPoint(\n { x: actual.width, y: actual.height },\n { x: expected.width, y: expected.height },\n );\n };\n const refused = { code: EngineErrorCode.InvalidArg, details: { field: 'rect' } };\n\n const created = (\n await page.annotations.create({\n subtype: 'line',\n linePoints,\n color: '#000000',\n } satisfies LineDraft)\n ).annotation;\n if (created.subtype !== 'line') throw new Error('expected a line');\n\n // Moved 40 right and 20 down: the points move by the offset, and the rect with them.\n const movedTo = offset(created.rect, 40, 20);\n const moved = await page.annotations.update(created.ref, {\n subtype: 'line',\n rect: movedTo,\n });\n if (moved.annotation.subtype !== 'line') throw new Error('expected a line');\n expectRect(moved.annotation.rect, movedTo);\n expectPoint(moved.annotation.linePoints.start, {\n x: linePoints.start.x + 40,\n y: linePoints.start.y + 20,\n });\n expectPoint(moved.annotation.linePoints.end, {\n x: linePoints.end.x + 40,\n y: linePoints.end.y + 20,\n });\n expect(moved.appearance.changed).toBe(false);\n\n // Stretched 60 wider and 30 taller, right and down: each axis on its\n // own, from the rect it had onto the new one.\n const from = moved.annotation.rect;\n const to = { ...from, width: from.width + 60, height: from.height + 30 };\n const onto = (point: PagePoint): PagePoint => ({\n x: to.x + ((point.x - from.x) * to.width) / from.width,\n y: to.y + ((point.y - from.y) * to.height) / from.height,\n });\n const stretched = await page.annotations.update(created.ref, { subtype: 'line', rect: to });\n if (stretched.annotation.subtype !== 'line') throw new Error('expected a line');\n expectPoint(stretched.annotation.linePoints.start, onto(moved.annotation.linePoints.start));\n expectPoint(stretched.annotation.linePoints.end, onto(moved.annotation.linePoints.end));\n expect(stretched.appearance.changed).toBe(true);\n\n // The rect it read, sent back, changes nothing.\n const back = await page.annotations.update(created.ref, {\n subtype: 'line',\n rect: stretched.annotation.rect,\n contents: 'sent back',\n });\n if (back.annotation.subtype !== 'line') throw new Error('expected a line');\n expect(back.annotation.rect).toEqual(stretched.annotation.rect);\n expect(back.annotation.linePoints).toEqual(stretched.annotation.linePoints);\n expect(back.annotation.contents).toBe('sent back');\n\n // A new rect with new points: which of the two to follow would be a guess.\n const rect = back.annotation.rect;\n await expect(\n page.annotations.update(created.ref, {\n subtype: 'line',\n rect: offset(rect, 5, 5),\n linePoints: { start: linePoints.start, end: { x: 90, y: 90 } },\n }),\n ).rejects.toMatchObject(refused);\n // A rect with no width.\n await expect(\n page.annotations.update(created.ref, {\n subtype: 'line',\n rect: { ...rect, width: 0 },\n }),\n ).rejects.toMatchObject(refused);\n\n // Text markup: the quads move, and the rect with them.\n const highlight = (\n await page.annotations.create({\n subtype: 'highlight',\n quadPoints: quad,\n color: '#ffff00',\n } satisfies HighlightDraft)\n ).annotation;\n const highlightTo = offset(highlight.rect, 10, 15);\n const movedHighlight = await page.annotations.update(highlight.ref, {\n subtype: 'highlight',\n rect: highlightTo,\n });\n if (movedHighlight.annotation.subtype !== 'highlight')\n throw new Error('expected a highlight');\n expectRect(movedHighlight.annotation.rect, highlightTo);\n expectPoint(movedHighlight.annotation.quadPoints[0]!.upperLeft, {\n x: quad[0]!.upperLeft.x + 10,\n y: quad[0]!.upperLeft.y + 15,\n });\n\n // A turned drawing only moves.\n const turned = (\n await page.annotations.create({\n subtype: 'square',\n box: shapeRect,\n rotation: 30,\n color: '#0000ff',\n } satisfies SquareDraft)\n ).annotation;\n if (turned.subtype !== 'square') throw new Error('expected a square');\n const turnedTo = offset(turned.rect, 25, 5);\n const movedTurned = await page.annotations.update(turned.ref, {\n subtype: 'square',\n rect: turnedTo,\n });\n if (movedTurned.annotation.subtype !== 'square') throw new Error('expected a square');\n expectRect(movedTurned.annotation.box, offset(shapeRect, 25, 5));\n expect(movedTurned.annotation.rotation).toBe(30);\n await expect(\n page.annotations.update(turned.ref, {\n subtype: 'square',\n rect: { ...turnedTo, width: turnedTo.width + 20 },\n }),\n ).rejects.toMatchObject(refused);\n } finally {\n await doc.close();\n }\n });\n\n test('create vertex + line annotations (polygon/polyline/line) round-trip geometry', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const page = doc.page(toPageRef(fix.pageObjectNumber));\n\n const polygonDraft: PolygonDraft = {\n subtype: 'polygon',\n contents: 'mutation conformance: polygon',\n vertices,\n interiorColor: '#ffc800',\n color: '#0000ff',\n strokeWidth: 2,\n borderStyle: 'solid',\n opacity: 0.8,\n };\n const polygon = await page.annotations.create(polygonDraft);\n expect(AnnotationCreateResultSchema.safeParse(polygon).success).toBe(true);\n expect(polygon.annotation.subtype).toBe('polygon');\n if (polygon.annotation.subtype === 'polygon') {\n expect(polygon.annotation.vertices.length).toBe(vertices.length);\n expect(polygon.annotation.color).toBe('#0000ff');\n expect(polygon.annotation.interiorColor).toBe('#ffc800');\n }\n\n const polylineDraft: PolylineDraft = {\n subtype: 'polyline',\n contents: 'mutation conformance: polyline',\n vertices,\n interiorColor: null,\n color: '#c80000',\n strokeWidth: 2,\n borderStyle: 'solid',\n opacity: 1,\n lineEndings: { start: 'open-arrow', end: 'closed-arrow' },\n };\n const polyline = await page.annotations.create(polylineDraft);\n expect(AnnotationCreateResultSchema.safeParse(polyline).success).toBe(true);\n expect(polyline.annotation.subtype).toBe('polyline');\n if (polyline.annotation.subtype === 'polyline') {\n expect(polyline.annotation.vertices.length).toBe(vertices.length);\n expect(polyline.annotation.lineEndings.start).toBe('open-arrow');\n expect(polyline.annotation.lineEndings.end).toBe('closed-arrow');\n }\n\n const lineDraft: LineDraft = {\n subtype: 'line',\n contents: 'mutation conformance: line',\n linePoints,\n interiorColor: null,\n color: '#008080',\n strokeWidth: 2,\n borderStyle: 'solid',\n opacity: 1,\n lineEndings: { start: 'none', end: 'open-arrow' },\n };\n const line = await page.annotations.create(lineDraft);\n expect(AnnotationCreateResultSchema.safeParse(line).success).toBe(true);\n expect(line.annotation.subtype).toBe('line');\n if (line.annotation.subtype === 'line') {\n // /L stored as f32 — compare rounded to absorb float drift.\n expect(Math.round(line.annotation.linePoints.start.x)).toBe(\n Math.round(linePoints.start.x),\n );\n expect(Math.round(line.annotation.linePoints.end.y)).toBe(Math.round(linePoints.end.y));\n expect(line.annotation.lineEndings.end).toBe('open-arrow');\n }\n\n const inkDraft: InkDraft = {\n subtype: 'ink',\n contents: 'mutation conformance: ink',\n inkList: inkStrokes,\n color: '#1d4ed8',\n strokeWidth: 3,\n borderStyle: 'solid',\n opacity: 1,\n };\n const ink = await page.annotations.create(inkDraft);\n expect(AnnotationCreateResultSchema.safeParse(ink).success).toBe(true);\n expect(ink.annotation.subtype).toBe('ink');\n if (ink.annotation.subtype === 'ink') {\n expect(ink.annotation.inkList.length).toBe(inkStrokes.length);\n expect(ink.annotation.inkList[0]!.length).toBe(inkStrokes[0]!.length);\n expect(ink.annotation.color).toBe('#1d4ed8');\n expect(ink.annotation.intent).toBe(null);\n expect(ink.annotation.blendMode).toBe('normal');\n // Ink has a stroke but no /IC.\n expect('interiorColor' in ink.annotation).toBe(false);\n }\n\n const after = await page.annotations.list();\n const subtypes = after.annotations.map((a) => a.subtype);\n expect(subtypes.includes('polygon')).toBe(true);\n expect(subtypes.includes('polyline')).toBe(true);\n expect(subtypes.includes('line')).toBe(true);\n expect(subtypes.includes('ink')).toBe(true);\n } finally {\n await doc.close();\n }\n });\n\n test('create free-text + callout round-trip text/colour/intent fields', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const page = doc.page(toPageRef(fix.pageObjectNumber));\n\n // Plain free text: `color` is the border; the text is black unless\n // `fontColor` says otherwise.\n const freeTextDraft: FreeTextDraft = {\n subtype: 'free-text',\n intent: 'free-text',\n contents: 'mutation conformance: free text',\n box: shapeRect,\n fontFamily: 'helvetica',\n fontSize: 14,\n textAlign: 'center',\n color: '#14283c',\n interiorColor: '#fafad2',\n opacity: 1,\n strokeWidth: 1,\n borderStyle: 'solid',\n };\n const freeText = await page.annotations.create(freeTextDraft);\n expect(AnnotationCreateResultSchema.safeParse(freeText).success).toBe(true);\n expect(freeText.annotation.subtype).toBe('free-text');\n if (freeText.annotation.subtype === 'free-text') {\n expect(freeText.annotation.intent).toBe('free-text');\n expect(freeText.annotation.fontFamily).toBe('helvetica');\n expect(freeText.annotation.fontSize).toBe(14);\n expect(freeText.annotation.textAlign).toBe('center');\n expect(freeText.annotation.color).toBe('#14283c');\n expect(freeText.annotation.interiorColor).toBe('#fafad2');\n expect(freeText.annotation.fontColor).toBe('#000000');\n }\n\n // Callout: intent + /CL leader + /LE ending, its own text color,\n // transparent (null) background.\n const calloutDraft: FreeTextDraft = {\n subtype: 'free-text',\n intent: 'free-text-callout',\n contents: 'mutation conformance: callout',\n box: shapeRect,\n fontFamily: 'times-roman',\n fontSize: 12,\n textAlign: 'left',\n color: '#000000',\n fontColor: '#c80000',\n interiorColor: null,\n opacity: 1,\n strokeWidth: 1,\n borderStyle: 'solid',\n calloutLine: DEFAULT_CALLOUT_LINE,\n lineEnding: 'open-arrow',\n };\n const callout = await page.annotations.create(calloutDraft);\n expect(AnnotationCreateResultSchema.safeParse(callout).success).toBe(true);\n expect(callout.annotation.subtype).toBe('free-text');\n if (callout.annotation.subtype === 'free-text') {\n expect(callout.annotation.intent).toBe('free-text-callout');\n expect(callout.annotation.interiorColor).toBe(null);\n expect(callout.annotation.fontColor).toBe('#c80000');\n expect(callout.annotation.color).toBe('#000000');\n expect(callout.annotation.calloutLine?.length).toBe(DEFAULT_CALLOUT_LINE.length);\n expect(callout.annotation.lineEnding).toBe('open-arrow');\n // The box is the text box; `rect` holds it, the line and its arrow.\n expect(callout.annotation.box).toEqual(shapeRect);\n const { rect } = callout.annotation;\n for (const point of DEFAULT_CALLOUT_LINE) {\n expect(point.x >= rect.x && point.x <= rect.x + rect.width).toBe(true);\n expect(point.y >= rect.y && point.y <= rect.y + rect.height).toBe(true);\n }\n }\n\n const after = await page.annotations.list();\n const freeTexts = after.annotations.filter((a) => a.subtype === 'free-text');\n expect(freeTexts.length >= 2).toBe(true);\n } finally {\n await doc.close();\n }\n });\n\n test('update a free-text patches alignment + colours and is non-structural', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const page = doc.page(toPageRef(fix.pageObjectNumber));\n const created = await page.annotations.create({\n subtype: 'free-text',\n intent: 'free-text',\n contents: 'free-text-update-base',\n box: shapeRect,\n fontFamily: 'helvetica',\n fontSize: 12,\n textAlign: 'left',\n color: '#000000',\n interiorColor: null,\n opacity: 1,\n strokeWidth: 1,\n borderStyle: 'solid',\n } satisfies FreeTextDraft);\n const before = await page.annotations.list();\n\n const result = await page.annotations.update(created.annotation.ref, {\n subtype: 'free-text',\n textAlign: 'right',\n fontFamily: 'helvetica',\n fontSize: 18,\n color: '#0050a0',\n interiorColor: '#f0f0f0',\n });\n expect(AnnotationUpdateResultSchema.safeParse(result).success).toBe(true);\n expect(result.annotation.subtype).toBe('free-text');\n if (result.annotation.subtype === 'free-text') {\n expect(result.annotation.textAlign).toBe('right');\n expect(result.annotation.fontSize).toBe(18);\n expect(result.annotation.color).toBe('#0050a0');\n expect(result.annotation.interiorColor).toBe('#f0f0f0');\n }\n } finally {\n await doc.close();\n }\n });\n\n // ── rich text (/RC + /DS): the same document model on every engine ──\n // `richText` is a body (family/weight/italic/size/colour/decoration/\n // align/dir) plus paragraphs of runs whose `style` overrides it. Every\n // FreeText reads it back; a draft or patch may write it. The rules under\n // test are the engine's patch table, so the cloud (HTTP -> server ->\n // native runtime) and the local WASM engine must agree row for row.\n\n test('rich text: a plain draft reads back body-style paragraphs and a body from its font', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const page = doc.page(toPageRef(fix.pageObjectNumber));\n const created = await page.annotations.create({\n subtype: 'free-text',\n intent: 'free-text',\n contents: 'Plain\\rtext',\n box: shapeRect,\n fontFamily: 'helvetica-bold',\n fontSize: 18,\n textAlign: 'center',\n color: '#000000',\n } satisfies FreeTextDraft);\n expect(created.annotation.subtype).toBe('free-text');\n if (created.annotation.subtype === 'free-text') {\n const rich = created.annotation.richText;\n expect(created.annotation.fontFamily).toBe('helvetica-bold');\n expect(rich.body.family).toBe('Helvetica');\n expect(rich.body.weight).toBe(700);\n expect(rich.body.italic).toBe(false);\n expect(rich.body.size).toBe(18);\n expect(rich.body.align).toBe('center');\n // One paragraph per line break, one unstyled run each; a paragraph\n // names alignment only where it differs from the body.\n expect(rich.paragraphs).toEqual([\n { runs: [{ text: 'Plain' }] },\n { runs: [{ text: 'text' }] },\n ]);\n }\n } finally {\n await doc.close();\n }\n });\n\n test('rich text: a draft with runs round-trips the body, the runs and the plain projection', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const page = doc.page(toPageRef(fix.pageObjectNumber));\n const created = await page.annotations.create({\n subtype: 'free-text',\n intent: 'free-text',\n box: shapeRect,\n color: '#0000ff',\n // The body carries the size; a `fontSize` beside it would win.\n richText: {\n body: { family: 'Helvetica', size: 18, color: '#102030' },\n paragraphs: [\n {\n runs: [\n { text: 'Hello ' },\n { text: 'bold', style: { weight: 700 } },\n { text: ' red', style: { color: '#FF0000' } },\n ],\n },\n { align: 'center', runs: [{ text: 'H' }, { text: '2', style: { script: 'sub' } }] },\n ],\n },\n } satisfies FreeTextDraft);\n expect(AnnotationCreateResultSchema.safeParse(created).success).toBe(true);\n expect(created.annotation.subtype).toBe('free-text');\n if (created.annotation.subtype === 'free-text') {\n const dto = created.annotation;\n // `contents` is the projection: paragraphs joined by \\r, runs concatenated.\n expect(dto.contents).toBe('Hello bold red\\rH2');\n // The body became the /DA font and size; the /DA colour, the border's,\n // stayed the draft's, and the text is the body's color.\n expect(dto.fontFamily).toBe('helvetica');\n expect(dto.fontSize).toBe(18);\n expect(dto.color).toBe('#0000ff');\n expect(dto.fontColor).toBe('#102030');\n expect(dto.richText.body.color).toBe('#102030');\n expect(dto.richText.paragraphs[0]!.runs).toEqual([\n { text: 'Hello ' },\n { text: 'bold', style: { weight: 700 } },\n { text: ' red', style: { color: '#ff0000' } },\n ]);\n expect(dto.richText.paragraphs[1]!.align).toBe('center');\n expect(dto.richText.paragraphs[1]!.runs[1]).toEqual({\n text: '2',\n style: { script: 'sub' },\n });\n }\n // The list read agrees with the create echo.\n const listed = (await page.annotations.list()).annotations.find(\n (a) => annotationKey(a.ref) === annotationKey(created.annotation.ref),\n );\n expect(listed?.subtype).toBe('free-text');\n if (listed?.subtype === 'free-text') {\n expect(listed.richText.paragraphs[0]!.runs[1]).toEqual({\n text: 'bold',\n style: { weight: 700 },\n });\n }\n } finally {\n await doc.close();\n }\n });\n\n test('rich text: paragraphs-only patch keeps the body; contents-only rewrites body-style paragraphs', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const page = doc.page(toPageRef(fix.pageObjectNumber));\n const created = await page.annotations.create({\n subtype: 'free-text',\n intent: 'free-text',\n box: shapeRect,\n fontFamily: 'helvetica',\n fontSize: 14,\n textAlign: 'center',\n color: '#000000',\n richText: {\n body: { family: 'Helvetica', size: 14 },\n paragraphs: [{ runs: [{ text: 'a' }, { text: 'b', style: { weight: 700 } }] }],\n },\n } satisfies FreeTextDraft);\n const ref = created.annotation.ref;\n // The editor's commit: paragraphs only, no body — the body (and its\n // alignment) stays what the annotation had.\n const restyled = await page.annotations.update(ref, {\n subtype: 'free-text',\n richText: {\n paragraphs: [{ runs: [{ text: 'ab', style: { italic: true } }, { text: 'c' }] }],\n },\n });\n expect(AnnotationUpdateResultSchema.safeParse(restyled).success).toBe(true);\n expect(restyled.annotation.subtype).toBe('free-text');\n if (restyled.annotation.subtype === 'free-text') {\n expect(restyled.annotation.contents).toBe('abc');\n expect(restyled.annotation.richText.body.size).toBe(14);\n expect(restyled.annotation.richText.body.align).toBe('center');\n expect(restyled.annotation.textAlign).toBe('center');\n expect(restyled.annotation.richText.paragraphs[0]!.runs[0]).toEqual({\n text: 'ab',\n style: { italic: true },\n });\n }\n // A plain-text client's rewrite: body-style paragraphs, one per line\n // break — run formatting is gone by design.\n const rewritten = await page.annotations.update(ref, {\n subtype: 'free-text',\n contents: 'one\\rtwo',\n });\n expect(rewritten.annotation.subtype).toBe('free-text');\n if (rewritten.annotation.subtype === 'free-text') {\n expect(rewritten.annotation.contents).toBe('one\\rtwo');\n expect(rewritten.annotation.richText.paragraphs).toEqual([\n { runs: [{ text: 'one' }] },\n { runs: [{ text: 'two' }] },\n ]);\n expect(rewritten.annotation.richText.body.size).toBe(14);\n }\n } finally {\n await doc.close();\n }\n });\n\n test('rich text: fontSize / fontColor / fontFamily move the body while runs keep their deltas', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const page = doc.page(toPageRef(fix.pageObjectNumber));\n const created = await page.annotations.create({\n subtype: 'free-text',\n intent: 'free-text',\n box: shapeRect,\n fontFamily: 'helvetica',\n fontSize: 14,\n textAlign: 'left',\n color: '#000000',\n richText: {\n body: { family: 'Helvetica', size: 14 },\n paragraphs: [{ runs: [{ text: 'a' }, { text: 'b', style: { size: 30 } }] }],\n },\n } satisfies FreeTextDraft);\n const updated = await page.annotations.update(created.annotation.ref, {\n subtype: 'free-text',\n fontSize: 20,\n fontColor: '#ff0000',\n fontFamily: 'times-bold',\n });\n expect(updated.annotation.subtype).toBe('free-text');\n if (updated.annotation.subtype === 'free-text') {\n const dto = updated.annotation;\n expect(dto.fontSize).toBe(20);\n expect(dto.fontFamily).toBe('times-bold');\n expect(dto.richText.body.size).toBe(20);\n expect(dto.richText.body.color).toBe('#ff0000');\n expect(dto.richText.body.family).toBe('Times');\n expect(dto.richText.body.weight).toBe(700);\n // The run's own size is a delta over the body: it survives the move.\n expect(dto.richText.paragraphs[0]!.runs[1]).toEqual({ text: 'b', style: { size: 30 } });\n }\n } finally {\n await doc.close();\n }\n });\n\n test('rich text: contents and richText that disagree reject with InvalidArg; agreeing writes the runs', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const page = doc.page(toPageRef(fix.pageObjectNumber));\n const created = await page.annotations.create({\n subtype: 'free-text',\n intent: 'free-text',\n contents: 'x',\n box: shapeRect,\n fontFamily: 'helvetica',\n fontSize: 14,\n textAlign: 'left',\n color: '#000000',\n } satisfies FreeTextDraft);\n const ref = created.annotation.ref;\n let caught: unknown;\n try {\n await page.annotations.update(ref, {\n subtype: 'free-text',\n contents: 'stale',\n richText: { paragraphs: [{ runs: [{ text: 'fresh' }] }] },\n });\n } catch (err) {\n caught = err;\n }\n expect(EngineError.is(caught, EngineErrorCode.InvalidArg)).toBe(true);\n // The refused write left the annotation untouched.\n const after = (await page.annotations.list()).annotations.find(\n (a) => annotationKey(a.ref) === annotationKey(created.annotation.ref),\n );\n expect(after?.contents).toBe('x');\n const agreed = await page.annotations.update(ref, {\n subtype: 'free-text',\n contents: 'fresh',\n richText: {\n paragraphs: [{ runs: [{ text: 'fr' }, { text: 'esh', style: { weight: 700 } }] }],\n },\n });\n expect(agreed.annotation.subtype).toBe('free-text');\n if (agreed.annotation.subtype === 'free-text') {\n expect(agreed.annotation.contents).toBe('fresh');\n expect(agreed.annotation.richText.paragraphs[0]!.runs[1]).toEqual({\n text: 'esh',\n style: { weight: 700 },\n });\n }\n } finally {\n await doc.close();\n }\n });\n\n test('create redact (area + text) round-trips label + colour fields', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const page = doc.page(toPageRef(fix.pageObjectNumber));\n\n // Area redaction (no quads: /Rect is the removal region) with a\n // fully-styled label.\n const areaDraft: RedactDraft = {\n subtype: 'redact',\n contents: 'mutation conformance: area redact',\n rect: shapeRect,\n color: '#e44234',\n opacity: 1,\n interiorColor: '#000000',\n overlayText: 'CONFIDENTIAL',\n repeat: true,\n fontFamily: 'helvetica',\n fontSize: 10,\n fontColor: '#ffffff',\n textAlign: 'center',\n };\n const area = await page.annotations.create(areaDraft);\n expect(AnnotationCreateResultSchema.safeParse(area).success).toBe(true);\n expect(area.annotation.subtype).toBe('redact');\n if (area.annotation.subtype === 'redact') {\n expect(area.annotation.quadPoints.length).toBe(0);\n expect(area.annotation.color).toBe('#e44234');\n expect(area.annotation.interiorColor).toBe('#000000');\n expect(area.annotation.overlayText).toBe('CONFIDENTIAL');\n expect(area.annotation.repeat).toBe(true);\n expect(area.annotation.fontFamily).toBe('helvetica');\n expect(area.annotation.fontSize).toBe(10);\n expect(area.annotation.fontColor).toBe('#ffffff');\n expect(area.annotation.textAlign).toBe('center');\n }\n\n // Text redaction (quads) without a label: everything falls back to\n // the ISO defaults — transparent fill, no overlay text, no repeat.\n const textDraft: RedactDraft = {\n subtype: 'redact',\n contents: 'mutation conformance: text redact',\n rect: shapeRect,\n quadPoints: quad,\n };\n const text = await page.annotations.create(textDraft);\n expect(AnnotationCreateResultSchema.safeParse(text).success).toBe(true);\n expect(text.annotation.subtype).toBe('redact');\n if (text.annotation.subtype === 'redact') {\n expect(text.annotation.quadPoints.length).toBe(quad.length);\n expect(text.annotation.interiorColor).toBe(null);\n expect(text.annotation.overlayText).toBe(null);\n expect(text.annotation.repeat).toBe(false);\n // Default marking outline is the red redaction convention.\n expect(text.annotation.color).toBe('#ff0000');\n }\n } finally {\n await doc.close();\n }\n });\n\n test('update a redact patches the label and clears it, non-structurally', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const page = doc.page(toPageRef(fix.pageObjectNumber));\n const created = await page.annotations.create({\n subtype: 'redact',\n contents: 'redact-update-base',\n rect: shapeRect,\n interiorColor: '#000000',\n overlayText: 'DRAFT',\n fontFamily: 'helvetica',\n fontSize: 8,\n fontColor: '#ffffff',\n } satisfies RedactDraft);\n const before = await page.annotations.list();\n\n // Restyle the label. fontSize 0 is meaningful for a redaction label\n // (auto-fit) and must round-trip verbatim, unlike free text.\n const restyled = await page.annotations.update(created.annotation.ref, {\n subtype: 'redact',\n overlayText: 'REDACTED',\n repeat: true,\n fontFamily: 'helvetica',\n fontSize: 0,\n fontColor: '#fff0f0',\n textAlign: 'right',\n interiorColor: '#0a0a0a',\n });\n expect(AnnotationUpdateResultSchema.safeParse(restyled).success).toBe(true);\n expect(restyled.annotation.subtype).toBe('redact');\n if (restyled.annotation.subtype === 'redact') {\n expect(restyled.annotation.overlayText).toBe('REDACTED');\n expect(restyled.annotation.repeat).toBe(true);\n expect(restyled.annotation.fontSize).toBe(0);\n expect(restyled.annotation.fontColor).toBe('#fff0f0');\n expect(restyled.annotation.textAlign).toBe('right');\n expect(restyled.annotation.interiorColor).toBe('#0a0a0a');\n }\n\n // Clear the label and the fill: null wipes /OverlayText and /IC.\n const cleared = await page.annotations.update(created.annotation.ref, {\n subtype: 'redact',\n overlayText: null,\n repeat: false,\n interiorColor: null,\n });\n expect(cleared.annotation.subtype).toBe('redact');\n if (cleared.annotation.subtype === 'redact') {\n expect(cleared.annotation.overlayText).toBe(null);\n expect(cleared.annotation.repeat).toBe(false);\n expect(cleared.annotation.interiorColor).toBe(null);\n }\n } finally {\n await doc.close();\n }\n });\n\n test('create + update a caret round-trips color/opacity and its box', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const page = doc.page(toPageRef(fix.pageObjectNumber));\n\n const caretDraft: CaretDraft = {\n subtype: 'caret',\n intent: 'replace',\n contents: 'mutation conformance: caret',\n box: shapeRect,\n color: '#0080ff',\n opacity: 0.7,\n };\n const caret = await page.annotations.create(caretDraft);\n expect(AnnotationCreateResultSchema.safeParse(caret).success).toBe(true);\n expect(caret.annotation.subtype).toBe('caret');\n expect(caret.annotation.ref.kind).toBe('objectNumber');\n if (caret.annotation.subtype === 'caret') {\n expect(caret.annotation.intent).toBe('replace');\n expect(caret.annotation.color).toBe('#0080ff');\n expect(Math.round(caret.annotation.opacity * 100) / 100).toBe(0.7);\n // Caret carries no border or quads.\n expect('strokeWidth' in caret.annotation).toBe(false);\n expect('quadPoints' in caret.annotation).toBe(false);\n // The symbol fills its box; `rect` holds its outline too.\n expect(caret.annotation.box).toEqual(shapeRect);\n const { rect } = caret.annotation;\n expect(rect.x <= shapeRect.x && rect.y <= shapeRect.y).toBe(true);\n expect(rect.x + rect.width >= shapeRect.x + shapeRect.width).toBe(true);\n expect(rect.y + rect.height >= shapeRect.y + shapeRect.height).toBe(true);\n }\n\n const before = await page.annotations.list();\n const result = await page.annotations.update(caret.annotation.ref, {\n subtype: 'caret',\n color: '#ff0000',\n });\n expect(AnnotationUpdateResultSchema.safeParse(result).success).toBe(true);\n expect(result.annotation.subtype).toBe('caret');\n if (result.annotation.subtype === 'caret') {\n expect(result.annotation.color).toBe('#ff0000');\n expect(result.annotation.box).toEqual(shapeRect);\n }\n\n const after = await page.annotations.list();\n expect(after.annotations.some((a) => a.subtype === 'caret')).toBe(true);\n } finally {\n await doc.close();\n }\n });\n\n test('update an ink annotation patches strokes + color and is non-structural', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const page = doc.page(toPageRef(fix.pageObjectNumber));\n const created = await page.annotations.create({\n subtype: 'ink',\n contents: 'ink-update-base',\n inkList: inkStrokes,\n color: '#000000',\n strokeWidth: 2,\n borderStyle: 'solid',\n opacity: 1,\n } satisfies InkDraft);\n const before = await page.annotations.list();\n\n const newStrokes: InkDraft['inkList'] = [\n ...inkStrokes,\n [\n { x: 80, y: 90 },\n { x: 120, y: 110 },\n ],\n ];\n const result = await page.annotations.update(created.annotation.ref, {\n subtype: 'ink',\n inkList: newStrokes,\n color: '#dc143c',\n });\n expect(AnnotationUpdateResultSchema.safeParse(result).success).toBe(true);\n expect(result.annotation.subtype).toBe('ink');\n if (result.annotation.subtype === 'ink') {\n expect(result.annotation.inkList.length).toBe(newStrokes.length);\n expect(result.annotation.color).toBe('#dc143c');\n }\n } finally {\n await doc.close();\n }\n });\n\n test('ink highlight intent + blend round-trip and unrelated patches preserve blend', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const page = doc.page(toPageRef(fix.pageObjectNumber));\n const created = await page.annotations.create({\n subtype: 'ink',\n intent: 'ink-highlight',\n blendMode: 'multiply',\n inkList: inkStrokes,\n color: '#ffcd45',\n strokeWidth: 14,\n borderStyle: 'solid',\n opacity: 1,\n } satisfies InkDraft);\n expect(created.annotation.subtype).toBe('ink');\n if (created.annotation.subtype !== 'ink') return;\n expect(created.annotation.intent).toBe('ink-highlight');\n expect(created.annotation.blendMode).toBe('multiply');\n\n const recolored = await page.annotations.update(created.annotation.ref, {\n subtype: 'ink',\n color: '#fabe28',\n });\n expect(recolored.annotation.subtype).toBe('ink');\n expect(recolored.annotation.blendMode).toBe('multiply');\n\n const screened = await page.annotations.update(created.annotation.ref, {\n subtype: 'ink',\n blendMode: 'screen',\n });\n expect(screened.annotation.subtype).toBe('ink');\n expect(screened.annotation.blendMode).toBe('screen');\n } finally {\n await doc.close();\n }\n });\n\n test('update a polyline patches vertices + line endings and is non-structural', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const page = doc.page(toPageRef(fix.pageObjectNumber));\n const created = await page.annotations.create({\n subtype: 'polyline',\n contents: 'polyline-update-base',\n vertices,\n interiorColor: null,\n color: '#000000',\n strokeWidth: 1,\n borderStyle: 'solid',\n opacity: 1,\n lineEndings: { start: 'none', end: 'none' },\n } satisfies PolylineDraft);\n const before = await page.annotations.list();\n\n const newVertices: PagePoint[] = [\n ...vertices,\n { x: vertices[0]!.x + 5, y: vertices[0]!.y + 5 },\n ];\n const result = await page.annotations.update(created.annotation.ref, {\n subtype: 'polyline',\n vertices: newVertices,\n lineEndings: { start: 'circle', end: 'diamond' },\n });\n expect(AnnotationUpdateResultSchema.safeParse(result).success).toBe(true);\n expect(result.annotation.subtype).toBe('polyline');\n if (result.annotation.subtype === 'polyline') {\n expect(result.annotation.vertices.length).toBe(newVertices.length);\n expect(result.annotation.lineEndings.start).toBe('circle');\n expect(result.annotation.lineEndings.end).toBe('diamond');\n }\n } finally {\n await doc.close();\n }\n });\n\n test('update a shape annotation patches color and is non-structural', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const page = doc.page(toPageRef(fix.pageObjectNumber));\n const created = await page.annotations.create({\n subtype: 'circle',\n contents: 'shape-update-base',\n box: shapeRect,\n interiorColor: '#0a141e',\n color: '#000000',\n strokeWidth: 1,\n borderStyle: 'solid',\n opacity: 1,\n } satisfies CircleDraft);\n const before = await page.annotations.list();\n\n const result = await page.annotations.update(created.annotation.ref, {\n subtype: 'circle',\n interiorColor: '#c86432',\n strokeWidth: 4,\n });\n expect(AnnotationUpdateResultSchema.safeParse(result).success).toBe(true);\n expect(result.annotation.subtype).toBe('circle');\n if (result.annotation.subtype === 'circle') {\n expect(result.annotation.interiorColor).toBe('#c86432');\n expect(result.annotation.strokeWidth).toBe(4);\n // Unpatched fields are preserved.\n expect(result.annotation.borderStyle).toBe('solid');\n }\n } finally {\n await doc.close();\n }\n });\n\n test('creating a shape bakes an /AP appearance the reader can rasterize', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const page = doc.page(toPageRef(fix.pageObjectNumber));\n const created = await page.annotations.create({\n subtype: 'circle',\n contents: 'appearance-gen',\n box: shapeRect,\n interiorColor: '#ff0000',\n color: '#000000',\n strokeWidth: 2,\n borderStyle: 'solid',\n opacity: 1,\n } satisfies CircleDraft);\n\n // The freshly created shape must carry a baked /AP (generated by\n // the mutator), so the appearance reader draws a non-empty raster.\n const raster = await appearanceRaster(page, created.annotation.ref);\n expect(raster.width > 0).toBeTruthy();\n expect(raster.height > 0).toBeTruthy();\n } finally {\n await doc.close();\n }\n });\n\n test(\"update keeps the annotation's name and never touches /NM\", async () => {\n const doc = await openFixture(engine, opts);\n try {\n const page = doc.page(toPageRef(fix.pageObjectNumber));\n const before = await page.annotations.list();\n\n const target = before.annotations.find((a) => a.ref.kind === 'objectNumber');\n // Skip gracefully if the fixture page has no annotation born as an\n // object; the fixture used in our suites has some.\n if (!target) return;\n\n const newContents = `mutation conformance: updated@${Date.now()}`;\n const patch = subtypeAwarePatch(target.subtype, newContents);\n if (!patch) return;\n\n const result = await page.annotations.update(target.ref, patch);\n expect(AnnotationUpdateResultSchema.safeParse(result).success).toBe(true);\n expect(result.meta.affectedPages).toEqual([toPageRef(fix.pageObjectNumber)]);\n expect('cacheDelta' in result.meta).toBe(true);\n\n // Same name, /NM untouched.\n expect(annotationKey(result.annotation.ref)).toBe(annotationKey(target.ref));\n expect(result.annotation.nm).toBe(target.nm);\n expect(result.annotation.contents).toBe(newContents);\n } finally {\n await doc.close();\n }\n });\n\n if (fix.expectsInlineAnnotation) {\n test('update of an annotation born inline keeps its baseIndex name and writes no /NM', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const page = doc.page(toPageRef(fix.pageObjectNumber));\n const before = await page.annotations.list();\n const inline = before.annotations.find((a) => a.ref.kind === 'baseIndex');\n expect(inline !== undefined).toBe(true);\n if (!inline) return;\n\n const newContents = `inline-update@${Date.now()}`;\n const patch = subtypeAwarePatch(inline.subtype, newContents);\n if (!patch) return;\n\n const result = await page.annotations.update(inline.ref, patch);\n expect(AnnotationUpdateResultSchema.safeParse(result).success).toBe(true);\n expect(annotationKey(result.annotation.ref)).toBe(annotationKey(inline.ref));\n expect(result.annotation.nm).toBe(inline.nm);\n expect(result.meta.changed).toEqual([inline.ref]);\n\n // A later read finds it under the same name, changed.\n const after = await page.annotations.list();\n const read = after.annotations.find(\n (a) => annotationKey(a.ref) === annotationKey(inline.ref),\n );\n expect(read?.contents).toBe(newContents);\n } finally {\n await doc.close();\n }\n });\n }\n\n // Runs before the inline delete below: an engine whose documents persist\n // between tests (cloud) loses the fixture's one inline annotation to it.\n if (fix.expectsInlineAnnotation) {\n test('reorder of an annotation born inline keeps its baseIndex name', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const page = doc.page(toPageRef(fix.pageObjectNumber));\n const before = await page.annotations.list();\n const inline = before.annotations.find((a) => a.ref.kind === 'baseIndex');\n expect(inline !== undefined).toBe(true);\n if (!inline) return;\n\n const atBottom = annotationKey(before.annotations[0]!.ref) === annotationKey(inline.ref);\n const result = await page.annotations.reorder([inline.ref], atBottom ? 'end' : 'start');\n const at = atBottom ? result.order.length - 1 : 0;\n expect(annotationKey(result.order[at]!)).toBe(annotationKey(inline.ref));\n expect(result.meta.changed).toEqual([inline.ref]);\n const after = (await page.annotations.list()).annotations[at]!;\n expect(annotationKey(after.ref)).toBe(annotationKey(inline.ref));\n expect(after.nm).toBe(inline.nm);\n } finally {\n await doc.close();\n }\n });\n }\n\n test('delete by objectNumber removes the annotation and reports a stable id', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const page = doc.page(toPageRef(fix.pageObjectNumber));\n // Create one we own so we don't disturb the fixture's other tests.\n const draft: HighlightDraft = {\n subtype: 'highlight',\n contents: 'mutation conformance: to-delete',\n quadPoints: quad,\n };\n const created = await page.annotations.create(draft);\n const before = await page.annotations.list();\n\n const deletions: AnnotationRef[][] = [];\n const stop = doc.events.subscribe((event) => {\n if (event.type === 'annotations.deleted') deletions.push(event.deleted);\n });\n const result = await page.annotations.delete(created.annotation.ref);\n stop();\n // Nothing exists after a delete: the result is its meta only, and\n // the event names what went, for listeners that didn't delete it.\n expect(Object.keys(result)).toEqual(['meta']);\n expect(deletions).toEqual([[created.annotation.ref]]);\n expect(result.meta.affectedPages).toEqual([toPageRef(fix.pageObjectNumber)]);\n expect('cacheDelta' in result.meta).toBe(true);\n expect(result.meta.changed).toEqual([created.annotation.ref]);\n\n // The annotation is gone.\n const after = await page.annotations.list();\n expect(after.annotations.length).toBe(before.annotations.length - 1);\n } finally {\n await doc.close();\n }\n });\n\n if (fix.expectsInlineAnnotation) {\n test('delete of an annotation born inline reports its baseIndex name; the others keep theirs', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const page = doc.page(toPageRef(fix.pageObjectNumber));\n const before = await page.annotations.list();\n const inline = before.annotations.find((a) => a.ref.kind === 'baseIndex');\n expect(inline !== undefined).toBe(true);\n if (!inline) return;\n\n const result = await page.annotations.delete(inline.ref);\n expect(result.meta.changed[0]).toEqual(inline.ref);\n expect(result.meta.affectedPages).toEqual([toPageRef(fix.pageObjectNumber)]);\n\n // What went with it (popups, replies) goes; everything else keeps\n // its name.\n const gone = new Set(result.meta.changed.map(annotationKey));\n const after = await page.annotations.list();\n expect(after.annotations.map((a) => annotationKey(a.ref))).toEqual(\n before.annotations.map((a) => annotationKey(a.ref)).filter((key) => !gone.has(key)),\n );\n\n // The name is never reused: it now names nothing.\n const patch = subtypeAwarePatch(inline.subtype, 'gone');\n if (!patch) return;\n const again = await page.annotations.update(inline.ref, patch).then(\n () => null,\n (error: unknown) => error,\n );\n expect(EngineError.is(again, EngineErrorCode.NotFound)).toBe(true);\n } finally {\n await doc.close();\n }\n });\n }\n\n test('abort on create rejects with AbortError', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const page = doc.page(toPageRef(fix.pageObjectNumber));\n const draft: HighlightDraft = {\n subtype: 'highlight',\n contents: 'will be aborted',\n quadPoints: quad,\n };\n const p = page.annotations.create(draft);\n p.abort('test');\n await expect(p).rejects.toBeInstanceOf(AbortError);\n } finally {\n await doc.close();\n }\n });\n\n // ─────────────────────────────────────────────────────────────────\n // reorder() — the stacking order. Locked invariants:\n // - The annotations go together, in the order given, next to a\n // neighbour or at 'start' (bottom) / 'end' (top).\n // - The answer is the page's whole new order; `meta.changed` lists\n // the moved annotations, which keep their names.\n // - A row named twice or a neighbour that moves is InvalidArg; a\n // neighbour that isn't on the page is NotFound; abort rejects.\n // ─────────────────────────────────────────────────────────────────\n\n test('reorder puts annotations right after or before their neighbour', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const page = doc.page(toPageRef(fix.pageObjectNumber));\n const seeded: AnnotationRef[] = [];\n for (const label of ['order-a', 'order-b', 'order-c']) {\n const created = await page.annotations.create({\n subtype: 'highlight',\n contents: label,\n quadPoints: quad,\n });\n seeded.push(created.annotation.ref);\n }\n const [a, b, c] = seeded as [AnnotationRef, AnnotationRef, AnnotationRef];\n const listed = async () =>\n (await page.annotations.list()).annotations.map((x) => annotationKey(x.ref));\n const before = await listed();\n const others = before.filter((key) => !seeded.map(annotationKey).includes(key));\n\n const result = await page.annotations.reorder([a], { after: c });\n expect(AnnotationReorderResultSchema.safeParse(result).success).toBe(true);\n expect(result.meta.affectedPages).toEqual([toPageRef(fix.pageObjectNumber)]);\n expect('cacheDelta' in result.meta).toBe(true);\n expect(result.meta.changed.map(annotationKey)).toEqual([annotationKey(a)]);\n const afterC = [...others, annotationKey(b), annotationKey(c), annotationKey(a)];\n expect(result.order.map(annotationKey)).toEqual(afterC);\n expect(await listed()).toEqual(afterC);\n\n const backBeforeB = await page.annotations.reorder([a], { before: b });\n expect(backBeforeB.order.map(annotationKey)).toEqual(before);\n expect(await listed()).toEqual(before);\n } finally {\n await doc.close();\n }\n });\n\n test('reorder keeps the order given and goes to the bottom or the top', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const page = doc.page(toPageRef(fix.pageObjectNumber));\n const ids = await Promise.all(\n ['multi-1', 'multi-2', 'multi-3'].map((label) =>\n page.annotations.create({\n subtype: 'highlight',\n contents: label,\n quadPoints: quad,\n }),\n ),\n );\n\n // The three go to the bottom in the order [3, 1, 2].\n const given = [ids[2].annotation.ref, ids[0].annotation.ref, ids[1].annotation.ref];\n const bottom = await page.annotations.reorder(given, 'start');\n expect(bottom.meta.changed.map(annotationKey)).toEqual(given.map(annotationKey));\n expect(bottom.order.slice(0, 3).map(annotationKey)).toEqual(given.map(annotationKey));\n\n const top = await page.annotations.reorder([ids[2].annotation.ref], 'end');\n expect(annotationKey(top.order.at(-1)!)).toBe(annotationKey(ids[2].annotation.ref));\n expect(top.order).toHaveLength(bottom.order.length);\n } finally {\n await doc.close();\n }\n });\n\n test('reorder refuses a neighbour that moves (InvalidArg) or is not on the page (NotFound)', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const page = doc.page(toPageRef(fix.pageObjectNumber));\n const a = await page.annotations.create({\n subtype: 'highlight',\n contents: 'anchor-a',\n quadPoints: quad,\n });\n const before = (await page.annotations.list()).annotations.map((x) => annotationKey(x.ref));\n const refused = async (attempt: () => Promise<unknown>) => {\n try {\n await attempt();\n } catch (err) {\n return err;\n }\n return undefined;\n };\n const self = await refused(() =>\n page.annotations.reorder([a.annotation.ref], { after: a.annotation.ref }),\n );\n expect(EngineError.is(self, EngineErrorCode.InvalidArg)).toBe(true);\n const gone: AnnotationRef = {\n kind: 'objectNumber',\n page: toPageRef(fix.pageObjectNumber),\n objectNumber: 999_999,\n };\n const missing = await refused(() =>\n page.annotations.reorder([a.annotation.ref], { before: gone }),\n );\n expect(EngineError.is(missing, EngineErrorCode.NotFound)).toBe(true);\n const missingRow = await refused(() => page.annotations.reorder([gone], 'start'));\n expect(EngineError.is(missingRow, EngineErrorCode.NotFound)).toBe(true);\n expect(\n (await page.annotations.list()).annotations.map((x) => annotationKey(x.ref)),\n ).toEqual(before);\n } finally {\n await doc.close();\n }\n });\n\n test('reorder with duplicate refs rejects with InvalidArg', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const page = doc.page(toPageRef(fix.pageObjectNumber));\n const a = await page.annotations.create({\n subtype: 'highlight',\n contents: 'dup-a',\n quadPoints: quad,\n });\n let caught: unknown;\n try {\n await page.annotations.reorder([a.annotation.ref, a.annotation.ref], 'start');\n } catch (err) {\n caught = err;\n }\n expect(EngineError.is(caught, EngineErrorCode.InvalidArg)).toBe(true);\n } finally {\n await doc.close();\n }\n });\n\n test('abort on reorder rejects with AbortError', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const page = doc.page(toPageRef(fix.pageObjectNumber));\n const a = await page.annotations.create({\n subtype: 'highlight',\n contents: 'abort-a',\n quadPoints: quad,\n });\n const p = page.annotations.reorder([a.annotation.ref], 'start');\n p.abort('test');\n await expect(p).rejects.toBeInstanceOf(AbortError);\n } finally {\n await doc.close();\n }\n });\n\n // ─────────────────────────────────────────────────────────────────\n // /IRT + /RT relationships (reply vs group). Locked rules:\n // - A draft `reply` writes /IRT; /RT defaults to 'reply' when\n // `reply.type` is left out (ISO 32000 §12.5.6.2 default).\n // - The DTO surfaces `reply` ({ to, type }); a top-level annotation\n // reports `reply: null`.\n // - Linking writes only the reply: `meta.changed` names the reply,\n // and the parent keeps its name.\n // - A cross-page parent is rejected with InvalidArg.\n // ─────────────────────────────────────────────────────────────────\n\n test('create a reply links /IRT and defaults /RT to \"reply\"', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const page = doc.page(toPageRef(fix.pageObjectNumber));\n const parent = await page.annotations.create({\n subtype: 'highlight',\n contents: 'reply parent',\n quadPoints: quad,\n } satisfies HighlightDraft);\n // A freshly created top-level annotation has no relationship.\n expect(parent.annotation.reply).toBe(null);\n\n const reply = await page.annotations.create({\n subtype: 'highlight',\n contents: 'a reply',\n quadPoints: quad,\n reply: { to: parent.annotation.ref },\n } satisfies HighlightDraft);\n expect(AnnotationCreateResultSchema.safeParse(reply).success).toBe(true);\n // /RT absent in the draft normalizes to 'reply'.\n expect(reply.annotation.reply?.type).toBe('reply');\n expect(reply.annotation.reply?.to !== undefined).toBe(true);\n if (\n reply.annotation.reply?.to.kind === 'objectNumber' &&\n parent.annotation.ref.kind === 'objectNumber'\n ) {\n expect(reply.annotation.reply!.to.objectNumber).toBe(parent.annotation.ref.objectNumber);\n expect(reply.annotation.reply!.to.page.objectNumber).toBe(fix.pageObjectNumber);\n }\n // Only the reply was written.\n expect(reply.meta.changed).toEqual([reply.annotation.ref]);\n\n // The relationship survives a fresh read.\n const after = await page.annotations.list();\n const readReply = after.annotations.find(\n (a) =>\n a.ref.kind === 'objectNumber' &&\n reply.annotation.ref.kind === 'objectNumber' &&\n a.ref.objectNumber === reply.annotation.ref.objectNumber,\n );\n expect(readReply?.reply?.type).toBe('reply');\n expect(readReply?.reply?.to !== undefined).toBe(true);\n } finally {\n await doc.close();\n }\n });\n\n test('create a grouped subordinate writes /RT /Group', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const page = doc.page(toPageRef(fix.pageObjectNumber));\n const primary = await page.annotations.create({\n subtype: 'highlight',\n contents: 'group primary',\n quadPoints: quad,\n } satisfies HighlightDraft);\n\n const caret = await page.annotations.create({\n subtype: 'caret',\n contents: '',\n box: shapeRect,\n color: '#000000',\n opacity: 1,\n reply: { to: primary.annotation.ref, type: 'group' },\n } satisfies CaretDraft);\n expect(AnnotationCreateResultSchema.safeParse(caret).success).toBe(true);\n expect(caret.annotation.reply?.type).toBe('group');\n expect(caret.annotation.reply?.to !== undefined).toBe(true);\n\n const after = await page.annotations.list();\n const readCaret = after.annotations.find(\n (a) =>\n a.ref.kind === 'objectNumber' &&\n caret.annotation.ref.kind === 'objectNumber' &&\n a.ref.objectNumber === caret.annotation.ref.objectNumber,\n );\n expect(readCaret?.reply?.type).toBe('group');\n } finally {\n await doc.close();\n }\n });\n\n // ─────────────────────────────────────────────────────────────────\n // Link annotations. Locked rules:\n // - `/Dest` and `/A GoTo` both read as the normalized `goto` arm;\n // destinations carry page object numbers on the wire (never\n // indices) and raw PDF user-space coordinates.\n // - `target: null` creates a dead link (create-then-edit flow).\n // - A patch retargets by replacing `/A`; the reader gives `/A`\n // precedence so a retarget wins over any stray direct `/Dest`.\n // - Grouped links (\"attached links\") are plain /IRT + /RT\n // /Group — nothing link-specific in the relationship plane.\n // ─────────────────────────────────────────────────────────────────\n\n test('create link annotations round-trip uri, goto/xyz, goto/fitH, and dead targets', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const page = doc.page(toPageRef(fix.pageObjectNumber));\n\n const uri = await page.annotations.create({\n subtype: 'link',\n rect: shapeRect,\n target: { kind: 'uri', uri: 'https://www.embedpdf.com/' },\n } satisfies LinkDraft);\n expect(AnnotationCreateResultSchema.safeParse(uri).success).toBe(true);\n expect(uri.annotation.subtype).toBe('link');\n if (uri.annotation.subtype === 'link') {\n expect(uri.annotation.target).toEqual({ kind: 'uri', uri: 'https://www.embedpdf.com/' });\n }\n\n // /XYZ with a null zoom axis: null means \"retain current\".\n const xyz = await page.annotations.create({\n subtype: 'link',\n rect: shapeRect,\n target: {\n kind: 'goto',\n destination: {\n kind: 'xyz',\n page: toPageRef(fix.pageObjectNumber),\n x: 30,\n y: 300,\n zoom: null,\n },\n },\n } satisfies LinkDraft);\n expect(xyz.annotation.subtype).toBe('link');\n if (xyz.annotation.subtype === 'link') {\n expect(xyz.annotation.target?.kind).toBe('goto');\n if (xyz.annotation.target?.kind === 'goto') {\n const dest = xyz.annotation.target.destination;\n expect(dest.kind).toBe('xyz');\n if (dest.kind === 'xyz') {\n expect(dest.page.objectNumber).toBe(fix.pageObjectNumber);\n expect(dest.x).toBe(30);\n expect(dest.y).toBe(300);\n expect(dest.zoom).toBe(null);\n }\n }\n }\n\n const fitH = await page.annotations.create({\n subtype: 'link',\n rect: shapeRect,\n target: {\n kind: 'goto',\n destination: { kind: 'fitH', page: toPageRef(fix.pageObjectNumber), y: 420 },\n },\n } satisfies LinkDraft);\n expect(fitH.annotation.subtype).toBe('link');\n if (fitH.annotation.subtype === 'link' && fitH.annotation.target?.kind === 'goto') {\n expect(fitH.annotation.target.destination).toEqual({\n kind: 'fitH',\n page: toPageRef(fix.pageObjectNumber),\n y: 420,\n });\n }\n\n // Dead link: legal to author, reported as-is.\n const dead = await page.annotations.create({\n subtype: 'link',\n rect: shapeRect,\n target: null,\n } satisfies LinkDraft);\n expect(dead.annotation.subtype).toBe('link');\n if (dead.annotation.subtype === 'link') expect(dead.annotation.target).toBe(null);\n\n // All four survive a fresh page read as link DTOs.\n const after = await page.annotations.list();\n const links = after.annotations.filter((a) => a.subtype === 'link');\n expect(links.length >= 4).toBe(true);\n } finally {\n await doc.close();\n }\n });\n\n test('a link patch retargets in both directions (uri→goto, goto→uri) and moves the rect', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const page = doc.page(toPageRef(fix.pageObjectNumber));\n const created = await page.annotations.create({\n subtype: 'link',\n rect: shapeRect,\n target: { kind: 'uri', uri: 'https://old.example/' },\n } satisfies LinkDraft);\n\n const toGoto = await page.annotations.update(created.annotation.ref, {\n subtype: 'link',\n target: {\n kind: 'goto',\n destination: { kind: 'fit', page: toPageRef(fix.pageObjectNumber) },\n },\n });\n expect(AnnotationUpdateResultSchema.safeParse(toGoto).success).toBe(true);\n if (toGoto.annotation.subtype === 'link') {\n expect(toGoto.annotation.target).toEqual({\n kind: 'goto',\n destination: { kind: 'fit', page: toPageRef(fix.pageObjectNumber) },\n });\n }\n\n const movedRect = { ...shapeRect, x: shapeRect.x + 5, y: shapeRect.y + 5 };\n const toUri = await page.annotations.update(created.annotation.ref, {\n subtype: 'link',\n rect: movedRect,\n target: { kind: 'uri', uri: 'https://new.example/' },\n });\n if (toUri.annotation.subtype === 'link') {\n expect(toUri.annotation.target).toEqual({ kind: 'uri', uri: 'https://new.example/' });\n expect(Math.round(toUri.annotation.rect.x)).toBe(Math.round(movedRect.x));\n }\n } finally {\n await doc.close();\n }\n });\n\n test('a link patch clears the target with null — a dead link on re-read', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const page = doc.page(toPageRef(fix.pageObjectNumber));\n const created = await page.annotations.create({\n subtype: 'link',\n rect: shapeRect,\n target: {\n kind: 'goto',\n destination: { kind: 'fit', page: toPageRef(fix.pageObjectNumber) },\n },\n } satisfies LinkDraft);\n\n const cleared = await page.annotations.update(created.annotation.ref, {\n subtype: 'link',\n target: null,\n });\n expect(AnnotationUpdateResultSchema.safeParse(cleared).success).toBe(true);\n if (cleared.annotation.subtype === 'link') expect(cleared.annotation.target).toBe(null);\n\n // Truly dead — a fresh page read agrees (both /A and /Dest gone).\n const after = await page.annotations.list();\n const readBack = after.annotations.find(\n (a) =>\n a.ref.kind === 'objectNumber' &&\n created.annotation.ref.kind === 'objectNumber' &&\n a.ref.objectNumber === created.annotation.ref.objectNumber,\n );\n expect(readBack?.subtype).toBe('link');\n if (readBack?.subtype === 'link') expect(readBack.target).toBe(null);\n\n // And a cleared link can be re-targeted afterwards.\n const revived = await page.annotations.update(created.annotation.ref, {\n subtype: 'link',\n target: { kind: 'uri', uri: 'https://revived.example/' },\n });\n if (revived.annotation.subtype === 'link') {\n expect(revived.annotation.target).toEqual({\n kind: 'uri',\n uri: 'https://revived.example/',\n });\n }\n } finally {\n await doc.close();\n }\n });\n\n test('a link grouped to a highlight round-trips /IRT + /RT /Group with its target', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const page = doc.page(toPageRef(fix.pageObjectNumber));\n const parent = await page.annotations.create({\n subtype: 'highlight',\n contents: 'linked text',\n quadPoints: quad,\n } satisfies HighlightDraft);\n\n const link = await page.annotations.create({\n subtype: 'link',\n rect: shapeRect,\n target: { kind: 'uri', uri: 'https://www.embedpdf.com/docs' },\n reply: { to: parent.annotation.ref, type: 'group' },\n } satisfies LinkDraft);\n expect(AnnotationCreateResultSchema.safeParse(link).success).toBe(true);\n expect(link.annotation.reply?.type).toBe('group');\n expect(link.annotation.reply?.to !== undefined).toBe(true);\n if (\n link.annotation.reply?.to.kind === 'objectNumber' &&\n parent.annotation.ref.kind === 'objectNumber'\n ) {\n expect(link.annotation.reply!.to.objectNumber).toBe(parent.annotation.ref.objectNumber);\n }\n\n // Both the relationship and the target survive a fresh read.\n const after = await page.annotations.list();\n const readLink = after.annotations.find(\n (a) =>\n a.ref.kind === 'objectNumber' &&\n link.annotation.ref.kind === 'objectNumber' &&\n a.ref.objectNumber === link.annotation.ref.objectNumber,\n );\n expect(readLink?.subtype).toBe('link');\n expect(readLink?.reply?.type).toBe('group');\n if (readLink?.subtype === 'link') {\n expect(readLink.target).toEqual({ kind: 'uri', uri: 'https://www.embedpdf.com/docs' });\n }\n } finally {\n await doc.close();\n }\n });\n\n test('replace-text round-trips /IT and groups StrikeOut under its Caret', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const page = doc.page(toPageRef(fix.pageObjectNumber));\n const caret = await page.annotations.create({\n subtype: 'caret',\n intent: 'replace',\n contents: 'replacement text',\n box: shapeRect,\n color: '#e44234',\n opacity: 1,\n } satisfies CaretDraft);\n const strikeout = await page.annotations.create({\n subtype: 'strikeout',\n intent: 'strikeout-text-edit',\n quadPoints: quad,\n color: '#e44234',\n opacity: 1,\n reply: { to: caret.annotation.ref, type: 'group' },\n } satisfies StrikeoutDraft);\n\n expect(caret.annotation.subtype).toBe('caret');\n if (caret.annotation.subtype === 'caret') expect(caret.annotation.intent).toBe('replace');\n expect(strikeout.annotation.subtype).toBe('strikeout');\n if (strikeout.annotation.subtype === 'strikeout') {\n expect(strikeout.annotation.intent).toBe('strikeout-text-edit');\n }\n expect(strikeout.annotation.reply?.type).toBe('group');\n expect(strikeout.annotation.reply?.to).toEqual(caret.annotation.ref);\n\n const after = await page.annotations.list();\n const readCaret = after.annotations.find(\n (a) =>\n a.ref.kind === 'objectNumber' &&\n caret.annotation.ref.kind === 'objectNumber' &&\n a.ref.objectNumber === caret.annotation.ref.objectNumber,\n );\n const readStrikeout = after.annotations.find(\n (a) =>\n a.ref.kind === 'objectNumber' &&\n strikeout.annotation.ref.kind === 'objectNumber' &&\n a.ref.objectNumber === strikeout.annotation.ref.objectNumber,\n );\n expect(readCaret?.subtype === 'caret' && readCaret.intent).toBe('replace');\n expect(readStrikeout?.subtype === 'strikeout' && readStrikeout.intent).toBe(\n 'strikeout-text-edit',\n );\n expect(readStrikeout?.reply?.type).toBe('group');\n expect(readStrikeout?.reply?.to).toEqual(caret.annotation.ref);\n } finally {\n await doc.close();\n }\n });\n\n test('patch reply: null clears /IRT and /RT (back to top-level)', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const page = doc.page(toPageRef(fix.pageObjectNumber));\n const parent = await page.annotations.create({\n subtype: 'highlight',\n contents: 'clear parent',\n quadPoints: quad,\n } satisfies HighlightDraft);\n const reply = await page.annotations.create({\n subtype: 'highlight',\n contents: 'clearable reply',\n quadPoints: quad,\n reply: { to: parent.annotation.ref },\n } satisfies HighlightDraft);\n expect(reply.annotation.reply?.type).toBe('reply');\n\n const cleared = await page.annotations.update(reply.annotation.ref, {\n subtype: 'highlight',\n reply: null,\n });\n expect(AnnotationUpdateResultSchema.safeParse(cleared).success).toBe(true);\n expect(cleared.annotation.reply).toBe(null);\n } finally {\n await doc.close();\n }\n });\n\n test('create with a cross-page /IRT parent throws InvalidArg', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const page = doc.page(toPageRef(fix.pageObjectNumber));\n const parent = await page.annotations.create({\n subtype: 'highlight',\n contents: 'cross-page parent',\n quadPoints: quad,\n } satisfies HighlightDraft);\n if (parent.annotation.ref.kind !== 'objectNumber') return;\n\n // Same annotation object number, but a deliberately different page:\n // the engine must reject before resolving anything (ISO requires\n // reply and parent on the same page).\n const crossPageRef: AnnotationRef = {\n kind: 'objectNumber',\n page: toPageRef(fix.pageObjectNumber + 2),\n objectNumber: parent.annotation.ref.objectNumber,\n };\n let caught: unknown;\n try {\n await page.annotations.create({\n subtype: 'highlight',\n contents: 'bad cross-page reply',\n quadPoints: quad,\n reply: { to: crossPageRef },\n } satisfies HighlightDraft);\n } catch (err) {\n caught = err;\n }\n expect(EngineError.is(caught, EngineErrorCode.InvalidArg)).toBe(true);\n } finally {\n await doc.close();\n }\n });\n\n test('create refuses an nm already used on the page, naming the field', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const page = doc.page(toPageRef(fix.pageObjectNumber));\n const draft = { subtype: 'highlight', quadPoints: quad, nm: 'taken' } as const;\n await page.annotations.create(draft satisfies HighlightDraft);\n await expect(page.annotations.create(draft)).rejects.toMatchObject({\n code: EngineErrorCode.InvalidArg,\n details: { field: 'nm' },\n });\n // A name is unique per page (ISO 32000-2 §12.5.2): another page may use it.\n const { pages } = await doc.pages.list();\n const other = pages.find((entry) => entry.ref.objectNumber !== fix.pageObjectNumber);\n if (!other) return;\n const elsewhere = await doc.page(other.ref).annotations.create(draft);\n expect(elsewhere.annotation.nm).toBe('taken');\n } finally {\n await doc.close();\n }\n });\n\n // ─────────────────────────────────────────────────────────────────\n // /State + /StateModel (review status, ISO 32000 §12.5.6.3) and\n // /Subj. Locked rules:\n // - A status change is a new text annotation replying to its target\n // via /IRT; the target annotation itself is never modified.\n // - Faithful reads: `state` / `stateModel` / `subject` are null iff\n // the PDF entry is absent — a null after a null-clear patch proves\n // true key removal (EPDFAnnot_RemoveKey), not an empty-string\n // write.\n // - Known review/marked values are wire-normalized to lowercase;\n // custom Acrobat state models round-trip verbatim.\n // - A draft `state` without `stateModel` is rejected with InvalidArg\n // (ISO Table 175: StateModel is required when State is present).\n // - State entries are appearance-inert: they never repaint anything.\n // ─────────────────────────────────────────────────────────────────\n\n test('a review-status reply round-trips /State + /StateModel + /Subj', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const page = doc.page(toPageRef(fix.pageObjectNumber));\n const target = await page.annotations.create({\n subtype: 'highlight',\n contents: 'status target',\n subject: 'Pricing question',\n quadPoints: quad,\n } satisfies HighlightDraft);\n expect(target.annotation.subject).toBe('Pricing question');\n\n const status = await page.annotations.create({\n subtype: 'text',\n rect: iconRect(shapeRect.x, shapeRect.y),\n reply: { to: target.annotation.ref },\n state: 'accepted',\n stateModel: 'review',\n } satisfies TextDraft);\n expect(AnnotationCreateResultSchema.safeParse(status).success).toBe(true);\n expect(status.annotation.subtype).toBe('text');\n if (status.annotation.subtype !== 'text') return;\n expect(status.annotation.state).toBe('accepted');\n expect(status.annotation.stateModel).toBe('review');\n // A state annotation is a reply like any other.\n expect(status.annotation.reply?.type).toBe('reply');\n\n // The entries survive a fresh read.\n const after = await page.annotations.list();\n const read = after.annotations.find(\n (a) =>\n a.ref.kind === 'objectNumber' &&\n status.annotation.ref.kind === 'objectNumber' &&\n a.ref.objectNumber === status.annotation.ref.objectNumber,\n );\n expect(read?.subtype).toBe('text');\n if (read?.subtype === 'text') {\n expect(read.state).toBe('accepted');\n expect(read.stateModel).toBe('review');\n }\n } finally {\n await doc.close();\n }\n });\n\n test('a draft /State without /StateModel takes its standard model, or is refused', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const page = doc.page(toPageRef(fix.pageObjectNumber));\n const { annotation } = await page.annotations.create({\n subtype: 'text',\n rect: iconRect(shapeRect.x, shapeRect.y),\n state: 'accepted',\n } satisfies TextDraft);\n expect(annotation.subtype === 'text' && annotation.stateModel).toBe('review');\n let caught: unknown;\n try {\n await page.annotations.create({\n subtype: 'text',\n rect: iconRect(shapeRect.x, shapeRect.y),\n state: 'escalated',\n } satisfies TextDraft);\n } catch (err) {\n caught = err;\n }\n expect(EngineError.is(caught, EngineErrorCode.InvalidArg)).toBe(true);\n } finally {\n await doc.close();\n }\n });\n\n test('null-clear patches truly remove /State, /StateModel, /Subj and /Contents', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const page = doc.page(toPageRef(fix.pageObjectNumber));\n const note = await page.annotations.create({\n subtype: 'text',\n rect: iconRect(shapeRect.x, shapeRect.y),\n contents: 'work in progress',\n subject: 'Draft',\n state: 'none',\n stateModel: 'review',\n } satisfies TextDraft);\n\n // Cycle the state alone — the model already on the annotation\n // stays; state entries never touch the appearance.\n const cycled = await page.annotations.update(note.annotation.ref, {\n subtype: 'text',\n state: 'rejected',\n } satisfies TextPatch);\n expect(cycled.appearance.changed).toBe(false);\n expect(cycled.annotation.subtype).toBe('text');\n if (cycled.annotation.subtype === 'text') {\n expect(cycled.annotation.state).toBe('rejected');\n expect(cycled.annotation.stateModel).toBe('review');\n }\n\n const cleared = await page.annotations.update(note.annotation.ref, {\n subtype: 'text',\n contents: null,\n subject: null,\n state: null,\n stateModel: null,\n } satisfies TextPatch);\n expect(cleared.appearance.changed).toBe(false);\n expect(cleared.annotation.contents).toBe(null);\n expect(cleared.annotation.subject).toBe(null);\n if (cleared.annotation.subtype === 'text') {\n expect(cleared.annotation.state).toBe(null);\n expect(cleared.annotation.stateModel).toBe(null);\n }\n\n // Faithful read: null distinguishes absent from ''. Null here\n // proves the entries were removed, not overwritten with an empty\n // string.\n const after = await page.annotations.list();\n const read = after.annotations.find(\n (a) =>\n a.ref.kind === 'objectNumber' &&\n note.annotation.ref.kind === 'objectNumber' &&\n a.ref.objectNumber === note.annotation.ref.objectNumber,\n );\n expect(read?.contents).toBe(null);\n expect(read?.subject).toBe(null);\n if (read?.subtype === 'text') {\n expect(read.state).toBe(null);\n expect(read.stateModel).toBe(null);\n }\n } finally {\n await doc.close();\n }\n });\n\n test('custom state models round-trip verbatim', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const page = doc.page(toPageRef(fix.pageObjectNumber));\n const custom = await page.annotations.create({\n subtype: 'text',\n rect: iconRect(shapeRect.x, shapeRect.y),\n state: 'in-progress',\n stateModel: 'X-ReviewWorkflow',\n } satisfies TextDraft);\n expect(custom.annotation.subtype).toBe('text');\n if (custom.annotation.subtype !== 'text') return;\n expect(custom.annotation.state).toBe('in-progress');\n expect(custom.annotation.stateModel).toBe('X-ReviewWorkflow');\n\n const after = await page.annotations.list();\n const read = after.annotations.find(\n (a) =>\n a.ref.kind === 'objectNumber' &&\n custom.annotation.ref.kind === 'objectNumber' &&\n a.ref.objectNumber === custom.annotation.ref.objectNumber,\n );\n if (read?.subtype === 'text') {\n expect(read.state).toBe('in-progress');\n expect(read.stateModel).toBe('X-ReviewWorkflow');\n }\n } finally {\n await doc.close();\n }\n });\n });\n}\n\nasync function openFixture(\n engine: Engine,\n opts: AnnotationMutationConformanceOptions,\n): Promise<DocumentHandle> {\n if (opts.openKind === 'bytes') {\n const bytes = await opts.fixture.bytes();\n return engine.open({ kind: 'bytes', id: opts.fixture.id, bytes }, EVERY_PERMISSION);\n }\n return engine.open({ kind: 'id', id: opts.fixture.cloudId ?? opts.fixture.id });\n}\n\n/**\n * Build a valid `AnnotationPatch` for the supplied subtype that mutates\n * a single field we can read back. Returns `null` for subtypes the\n * harness can't synthesise a patch for (e.g. unsupported); caller\n * gracefully skips.\n */\nfunction subtypeAwarePatch(subtype: string, newContents: string): AnnotationPatch | null {\n switch (subtype) {\n case 'highlight':\n case 'underline':\n case 'squiggly':\n case 'strikeout':\n case 'circle':\n case 'square':\n case 'polygon':\n case 'polyline':\n case 'line':\n case 'ink':\n case 'free-text':\n case 'caret':\n return {\n subtype: subtype as AnnotationPatch['subtype'],\n contents: newContents,\n } as AnnotationPatch;\n default:\n return null;\n }\n}\n","import { EngineError } from '../errors/EngineError';\nimport { EngineErrorCode } from '../errors/EngineErrorCode';\n\n/** A refusal is the same on both engines: `Forbidden`, naming the permission it needed. */\nexport function isPermissionRefusal(error: unknown): boolean {\n return (\n EngineError.is(error, EngineErrorCode.Forbidden) &&\n typeof error.details?.['required'] === 'string'\n );\n}\n","import { iconRect } from './creatables';\nimport type { ConformanceTestRunner } from './runMetadataConformance';\nimport type { Annotation, AnnotationDraft } from '../annotation/kinds';\nimport type { Identity } from '../auth/scope';\nimport type { DocumentHandle } from '../engine/DocumentHandle';\nimport type { Engine } from '../engine/Engine';\nimport type { PageHandle } from '../engine/PageHandle';\nimport { EngineError } from '../errors/EngineError';\nimport type { AnnotationRef } from '../identity/AnnotationRef';\nimport { annotationKey } from '../identity/annotationKey';\nimport { isPermissionRefusal } from './refusals';\n\n/** Who a session is and what it may do: open-time options locally, token claims on the cloud. */\nexport interface AttributionSession {\n readonly scope: ReadonlyArray<string>;\n readonly identity: Identity;\n}\n\nexport interface AnnotationAttributionConformanceOptions {\n label: string;\n /** Build a fresh engine for this suite. The suite tears it down at the end. */\n makeEngine: () => Promise<Engine> | Engine;\n /**\n * Open the authoring document, a document with annotations another tool\n * wrote, as `session`. With `from`, the new session continues that open\n * session's document and sees what it wrote (locally its downloaded bytes,\n * on the cloud the same layer); the suite closes `from` afterwards.\n */\n openAs: (\n engine: Engine,\n session: AttributionSession,\n from?: DocumentHandle,\n ) => Promise<DocumentHandle>;\n}\n\nconst SCOPE = ['doc.open', 'doc.render', 'doc.download', 'doc.annotate.modify'] as const;\n\nconst ALICE: Identity = {\n userId: 'alice',\n displayName: 'Alice Author',\n email: 'alice@example.com',\n title: 'Counsel',\n organization: 'Example Inc.',\n organizationalUnit: 'Legal',\n groupId: 'legal',\n};\nconst BOB: Identity = { userId: 'bob', displayName: 'Bob Builder', groupId: 'ops' };\n/** A host's sync job, restoring annotations from its own store. */\nconst IMPORTER: Identity = { userId: 'sync-job', displayName: 'Sync Job', groupId: 'ops' };\n/** What an export needs besides: reading the annotations. */\nconst READ = [...SCOPE, 'doc.annotate.read'] as const;\n\n/** Attribution a caller has no business supplying on create or update. */\nconst FORGED = {\n author: 'Mallory',\n userId: 'mallory',\n createdBy: 'mallory',\n modifiedBy: 'mallory',\n createdAt: '2001-01-01T00:00:00.000Z',\n modifiedAt: '2001-01-01T00:00:00.000Z',\n importedBy: 'mallory',\n};\n\nconst SQUARE: AnnotationDraft = {\n subtype: 'square',\n box: { x: 40, y: 40, width: 100, height: 60 },\n};\n\n/**\n * Attribution on both engines with the same identities:\n * `create` stamps it from the session and ignores what the data says,\n * `update` stamps only `modifiedAt` and `modifiedBy`, and a `groupId` other than\n * the session's own passes the set-group check or is refused. The session's\n * whole identity reaches `doc.security.identity`; only the name and the ids\n * reach the annotation.\n */\nexport function runAnnotationAttributionConformance(\n runner: ConformanceTestRunner,\n opts: AnnotationAttributionConformanceOptions,\n): void {\n const { describe, test, beforeAll, afterAll, expect } = runner;\n\n describe(`annotation attribution conformance: ${opts.label}`, () => {\n let engine: Engine;\n\n beforeAll(async () => {\n engine = await opts.makeEngine();\n });\n\n afterAll(async () => {\n if (engine) await engine.destroy();\n });\n\n /** Open the document as `session`, hand its first page to `run`, and close it. */\n const asSession = async <T>(\n session: AttributionSession,\n run: (page: PageHandle, doc: DocumentHandle) => Promise<T>,\n ): Promise<T> => {\n const doc = await opts.openAs(engine, session);\n try {\n return await run(await firstPage(doc), doc);\n } finally {\n await doc.close();\n }\n };\n\n /** A refusal from the permission check, whichever engine enforced it. */\n const expectRefused = async (write: () => Promise<unknown>, required: string) => {\n const error = await write().then(\n () => null,\n (caught: unknown) => caught,\n );\n expect(isPermissionRefusal(error)).toBe(true);\n expect(String((error as Error).message)).toContain(required);\n };\n\n test('the session identity is the one it was opened with', async () => {\n await asSession({ scope: SCOPE, identity: ALICE }, async (_page, doc) => {\n expect(doc.security.identity).toEqual(ALICE);\n });\n });\n\n test('create stamps attribution from the session and ignores the data', async () => {\n await asSession({ scope: SCOPE, identity: ALICE }, async (page) => {\n const before = Date.now();\n const { annotation: created } = await page.annotations.create({\n ...SQUARE,\n ...FORGED,\n } as AnnotationDraft);\n const after = Date.now();\n const read = await readBack(page, created.ref);\n expect(attributionOf(read)).toEqual({\n author: 'Alice Author',\n userId: 'alice',\n createdBy: 'alice',\n modifiedBy: 'alice',\n groupId: 'legal',\n importedBy: null,\n });\n expect(read.createdAt).toBe(read.modifiedAt);\n expectNow(read.createdAt, before, after);\n // The rest of the identity stays with the session.\n const text = JSON.stringify(read);\n for (const kept of [\n ALICE.email,\n ALICE.title,\n ALICE.organization,\n ALICE.organizationalUnit,\n ]) {\n expect(text.includes(kept!)).toBe(false);\n }\n });\n });\n\n test(\"update stamps modifiedAt and modifiedBy, and keeps the creator's attribution\", async () => {\n const alice = await opts.openAs(engine, { scope: SCOPE, identity: ALICE });\n let original: Annotation;\n try {\n const page = await firstPage(alice);\n ({ annotation: original } = await page.annotations.create({\n ...SQUARE,\n nm: 'attribution-conformance-update',\n } as AnnotationDraft));\n } catch (error) {\n await alice.close();\n throw error;\n }\n const bob = await opts.openAs(engine, { scope: SCOPE, identity: BOB }, alice);\n await alice.close();\n try {\n const page = await firstPage(bob);\n const current = await findByNm(page, 'attribution-conformance-update');\n await page.annotations.update(current.ref, { contents: 'Checked', ...FORGED });\n const read = await readBack(page, current.ref);\n expect(attributionOf(read)).toEqual({\n author: 'Alice Author',\n userId: 'alice',\n createdBy: 'alice',\n modifiedBy: 'bob',\n groupId: 'legal',\n importedBy: null,\n });\n expect(read.createdAt).toBe(original.createdAt);\n expect(Date.parse(read.modifiedAt!) >= Date.parse(original.modifiedAt!)).toBe(true);\n } finally {\n await bob.close();\n }\n });\n\n test(\"update of another tool's annotation stamps only modifiedAt and modifiedBy\", async () => {\n await asSession({ scope: SCOPE, identity: BOB }, async (page) => {\n const foreign = (await page.annotations.list()).annotations.find(\n (annotation) =>\n annotation.subtype !== 'popup' &&\n annotation.author !== null &&\n annotation.userId === null,\n );\n expect(foreign !== undefined).toBe(true);\n const before = Date.now();\n await page.annotations.update(foreign!.ref, { contents: 'Checked', ...FORGED });\n const after = Date.now();\n const read = await readBack(page, foreign!.ref);\n expect(attributionOf(read)).toEqual({\n author: foreign!.author,\n userId: null,\n createdBy: null,\n modifiedBy: 'bob',\n groupId: foreign!.groupId,\n importedBy: null,\n });\n expect(read.createdAt).toBe(foreign!.createdAt);\n expectNow(read.modifiedAt, before, after);\n });\n });\n\n test(\"create lands in the session's group unless it may set another\", async () => {\n await asSession({ scope: SCOPE, identity: ALICE }, async (page) => {\n const own = await page.annotations.create({\n ...SQUARE,\n groupId: 'legal',\n } as AnnotationDraft);\n expect(own.annotation.groupId).toBe('legal');\n await expectRefused(\n () => page.annotations.create({ ...SQUARE, groupId: 'finance' } as AnnotationDraft),\n 'set-group',\n );\n });\n const granted: AttributionSession = {\n scope: [...SCOPE, 'annotations:set-group:group=finance'],\n identity: ALICE,\n };\n await asSession(granted, async (page) => {\n const { annotation: created } = await page.annotations.create({\n ...SQUARE,\n groupId: 'finance',\n } as AnnotationDraft);\n expect(attributionOf(await readBack(page, created.ref))).toMatchObject({\n groupId: 'finance',\n userId: 'alice',\n });\n });\n });\n\n test('update reassigns a group only with authority for it', async () => {\n await asSession({ scope: SCOPE, identity: ALICE }, async (page) => {\n const { annotation: created } = await page.annotations.create(SQUARE);\n await expectRefused(\n () => page.annotations.update(created.ref, { groupId: 'finance' }),\n 'set-group',\n );\n expect((await readBack(page, created.ref)).groupId).toBe('legal');\n });\n const granted: AttributionSession = {\n scope: [...SCOPE, 'annotations:set-group:group=finance'],\n identity: ALICE,\n };\n await asSession(granted, async (page) => {\n const { annotation: created } = await page.annotations.create(SQUARE);\n await page.annotations.update(created.ref, { groupId: 'finance' });\n expect((await readBack(page, created.ref)).groupId).toBe('finance');\n });\n });\n\n test('a restoring import keeps the attribution a bundle has, and records who imported it', async () => {\n // Alice writes, Bob edits one of hers: the bundle carries both, and the\n // annotations another tool wrote.\n const alice = await opts.openAs(engine, { scope: READ, identity: ALICE });\n const page = await firstPage(alice);\n const rect = { x: 300, y: 300, width: 30, height: 30 };\n const { annotation: square } = await page.annotations.create(SQUARE);\n const { annotation: note } = await page.annotations.create({\n subtype: 'text',\n rect: iconRect(rect.x, rect.y),\n });\n await page.annotations.create({\n subtype: 'text',\n rect: iconRect(rect.x, rect.y),\n reply: { to: note.ref },\n });\n await page.annotations.create(\n {\n subtype: 'file-attachment',\n rect: iconRect(rect.x, rect.y),\n file: { name: 'minutes.txt' },\n },\n { resources: { file: new TextEncoder().encode('minutes') } },\n );\n const bob = await opts.openAs(engine, { scope: READ, identity: BOB }, alice);\n await alice.close();\n await (await firstPage(bob)).annotations.update(square.ref, { contents: 'Checked' });\n // Without names, so the copies land beside the originals.\n const exported = await bob.annotations.export();\n const bundle = {\n ...exported,\n items: exported.items.map((item) => ({ ...item, data: { ...item.data, nm: null } })),\n } as typeof exported;\n\n const importer = await opts.openAs(\n engine,\n { scope: [...READ, 'doc.annotate.import'], identity: IMPORTER },\n bob,\n );\n await bob.close();\n try {\n // Another tool's annotations carry an author but no EmbedPDF identity.\n expect(bundle.items.some(({ data }) => data.author !== null && data.userId === null)).toBe(\n true,\n );\n // 'restore' is the default.\n const result = await importer.annotations.import(bundle);\n expect(result.annotations).toHaveLength(bundle.items.length);\n result.annotations.forEach((created, index) => {\n const source = bundle.items[index]!.data;\n expect(attributionOf(created)).toEqual({\n ...attributionOf(source),\n importedBy: 'sync-job',\n });\n expect([created.createdAt, created.modifiedAt]).toEqual([\n source.createdAt,\n source.modifiedAt,\n ]);\n if (created.subtype === 'file-attachment' && source.subtype === 'file-attachment') {\n expect(created.file?.createdAt).toBe(source.file?.createdAt);\n }\n });\n const edited =\n result.annotations[\n bundle.items.findIndex(\n (item) => annotationKey(item.data.ref) === annotationKey(square.ref),\n )\n ]!;\n expect(attributionOf(edited)).toMatchObject({ userId: 'alice', modifiedBy: 'bob' });\n } finally {\n await importer.close();\n }\n });\n\n test('a restoring import needs doc.annotate.import; one that stamps does not', async () => {\n await asSession({ scope: READ, identity: ALICE }, async (page, doc) => {\n const { annotation: created } = await page.annotations.create(SQUARE);\n const bundle = await doc.annotations.export({ refs: [created.ref] });\n await expectRefused(() => doc.annotations.import(bundle), 'doc.annotate.import');\n const stamped = await doc.annotations.import(bundle, { attribution: 'stamp' });\n expect(attributionOf(stamped.annotations[0]!)).toMatchObject({\n userId: 'alice',\n importedBy: null,\n });\n });\n });\n\n test('a user who may create their own annotations may paste them', async () => {\n // No doc.annotate.modify: creating is all this user may do.\n const createOnly = [\n 'doc.open',\n 'doc.render',\n 'doc.download',\n 'doc.annotate.read',\n 'annotations:create:self',\n ];\n await asSession({ scope: createOnly, identity: BOB }, async (page, doc) => {\n const { annotation: created } = await page.annotations.create(SQUARE);\n const bundle = await doc.annotations.export({ refs: [created.ref] });\n const stamped = await doc.annotations.import(bundle, { attribution: 'stamp' });\n expect(attributionOf(stamped.annotations[0]!)).toMatchObject({ userId: 'bob' });\n // Restoring writes someone's attribution: that takes more.\n await expectRefused(() => doc.annotations.import(bundle), 'doc.annotate.modify');\n });\n });\n\n test('doc.annotate.import is granted only by a scope that names it', async () => {\n await asSession({ scope: SCOPE, identity: ALICE }, async (_page, doc) => {\n expect(doc.security.allows('doc.annotate.import')).toBe(false);\n });\n await asSession(\n { scope: [...SCOPE, 'doc.annotate.import'], identity: ALICE },\n async (_page, doc) => {\n expect(doc.security.allows('doc.annotate.import')).toBe(true);\n },\n );\n });\n\n test(\"a note with someone else's reply is deleted whole or not at all\", async () => {\n const rect = { x: 200, y: 40, width: 20, height: 20 };\n const alice = await opts.openAs(engine, { scope: SCOPE, identity: ALICE });\n let note: Annotation;\n try {\n ({ annotation: note } = await (\n await firstPage(alice)\n ).annotations.create({\n subtype: 'text',\n rect: iconRect(rect.x, rect.y),\n nm: 'attribution-conformance-thread',\n }));\n } catch (error) {\n await alice.close();\n throw error;\n }\n const bob = await opts.openAs(engine, { scope: SCOPE, identity: BOB }, alice);\n await alice.close();\n let reply: Annotation;\n try {\n const page = await firstPage(bob);\n const current = await findByNm(page, 'attribution-conformance-thread');\n ({ annotation: reply } = await page.annotations.create({\n subtype: 'text',\n rect: iconRect(rect.x, rect.y),\n contents: 'Seen',\n reply: { to: current.ref },\n }));\n } catch (error) {\n await bob.close();\n throw error;\n }\n // Alice may delete only her own: the note goes with Bob's reply, so\n // nothing goes, and the refusal names the reply.\n const own = [\n 'doc.open',\n 'doc.render',\n 'doc.download',\n 'doc.annotate.modify',\n 'annotations:delete:self',\n ];\n const aliceAgain = await opts.openAs(engine, { scope: own, identity: ALICE }, bob);\n await bob.close();\n try {\n const page = await firstPage(aliceAgain);\n const current = await findByNm(page, 'attribution-conformance-thread');\n const error = await page.annotations.delete(current.ref).then(\n () => null,\n (caught: unknown) => caught,\n );\n expect(isPermissionRefusal(error)).toBe(true);\n const refs = (error as EngineError).details?.['refs'] as AnnotationRef[];\n expect(refs.map(annotationKey)).toEqual([annotationKey(reply.ref)]);\n expect((await readBack(page, current.ref)).nm).toBe(note.nm);\n expect((await readBack(page, reply.ref)).contents).toBe('Seen');\n } finally {\n await aliceAgain.close();\n }\n });\n });\n}\n\nasync function firstPage(doc: DocumentHandle): Promise<PageHandle> {\n const first = (await doc.annotations.list()).pages[0];\n if (!first) throw new Error('the authoring document has no pages');\n return doc.page(first);\n}\n\nasync function readBack(page: PageHandle, ref: AnnotationRef): Promise<Annotation> {\n const found = (await page.annotations.list()).annotations.find(\n (annotation) => annotationKey(annotation.ref) === annotationKey(ref),\n );\n if (!found) throw new Error(`annotation ${annotationKey(ref)} is gone`);\n return found;\n}\n\nasync function findByNm(page: PageHandle, nm: string): Promise<Annotation> {\n const found = (await page.annotations.list()).annotations.find(\n (annotation) => annotation.nm === nm,\n );\n if (!found) throw new Error(`no annotation named ${nm}`);\n return found;\n}\n\nfunction attributionOf(read: Annotation) {\n return {\n author: read.author,\n userId: read.userId,\n createdBy: read.createdBy,\n modifiedBy: read.modifiedBy,\n groupId: read.groupId,\n importedBy: read.importedBy,\n };\n}\n\n/** A PDF date keeps whole seconds, so \"now\" is the window around the write, widened to seconds. */\nfunction expectNow(value: string | null, before: number, after: number): void {\n const at = value === null ? NaN : Date.parse(value);\n if (!(at >= Math.floor(before / 1000) * 1000 && at <= Math.ceil(after / 1000) * 1000)) {\n throw new Error(\n `expected a date between ${new Date(before).toISOString()} and ${new Date(after).toISOString()}, got ${value}`,\n );\n }\n}\n","/** A PDF file of `objects`, numbered from 1, with its cross-reference table. */\nexport function pdfOf(objects: readonly string[]): Uint8Array {\n let text = '%PDF-1.7\\n';\n const offsets: number[] = [];\n objects.forEach((object, index) => {\n offsets.push(text.length);\n text += `${index + 1} 0 obj\\n${object}\\nendobj\\n`;\n });\n const start = text.length;\n text += `xref\\n0 ${objects.length + 1}\\n0000000000 65535 f \\n`;\n for (const offset of offsets) text += `${String(offset).padStart(10, '0')} 00000 n \\n`;\n text += `trailer\\n<< /Size ${objects.length + 1} /Root 1 0 R >>\\nstartxref\\n${start}\\n%%EOF\\n`;\n return new TextEncoder().encode(text);\n}\n","/**\n * Stamp artwork both engines' suites draw with: two small drawings whose\n * bands show a crop or a wrong fit.\n */\n\nimport { pdfOf } from './pdfOf';\n\n/** A 30 × 10 PNG: red, green and blue bands, so a crop or a wrong fit shows. */\nexport const BANDS_PNG = Uint8Array.from(\n atob(\n 'iVBORw0KGgoAAAANSUhEUgAAAB4AAAAKCAIAAAAsFXl4AAAAGklEQVR42mP4z8CABzFQIj1q9KjRo0aTIg0AQXcq5OunV0AAAAAASUVORK5CYII=',\n ),\n (c) => c.charCodeAt(0),\n);\n\nexport function sameBytes(a: Uint8Array, b: Uint8Array): boolean {\n return a.length === b.length && a.every((byte, i) => byte === b[i]);\n}\n\nexport const BANDS_PDF_CONTENT = '1 0 0 rg 0 0 120 100 re f 0 0 1 rg 120 0 80 100 re f';\n\n/** A one-page PDF, 200 × 100: a red band and a blue band, so a wrong fit or crop shows. */\nexport const BANDS_PDF = pdfOf([\n '<< /Type /Catalog /Pages 2 0 R >>',\n '<< /Type /Pages /Kids [3 0 R] /Count 1 >>',\n '<< /Type /Page /Parent 2 0 R /MediaBox [0 0 200 100] /Contents 4 0 R /Resources << >> >>',\n `<< /Length ${BANDS_PDF_CONTENT.length} >>\\nstream\\n${BANDS_PDF_CONTENT}\\nendstream`,\n]);\n\n/** Two empty pages: not a stamp's drawing, which is one page. */\nexport const TWO_PAGE_PDF = pdfOf([\n '<< /Type /Catalog /Pages 2 0 R >>',\n '<< /Type /Pages /Kids [3 0 R 4 0 R] /Count 2 >>',\n '<< /Type /Page /Parent 2 0 R /MediaBox [0 0 200 100] /Resources << >> >>',\n '<< /Type /Page /Parent 2 0 R /MediaBox [0 0 200 100] /Resources << >> >>',\n]);\n","import { appearanceRaster, maxAlpha, maxDifference, type Raster } from './appearanceRasters';\nimport type { ConformanceTestRunner } from './runMetadataConformance';\nimport { BANDS_PDF, BANDS_PDF_CONTENT, BANDS_PNG, sameBytes } from './stampFixtures';\nimport type { AnnotationDraft, Annotation } from '../annotation/kinds';\nimport type { DocumentHandle } from '../engine/DocumentHandle';\nimport type { Engine } from '../engine/Engine';\nimport type { PageHandle } from '../engine/PageHandle';\nimport { EngineErrorCode } from '../errors/EngineErrorCode';\nimport type { PageBox } from '../geometry/pageSpace';\nimport type { AnnotationRef } from '../identity/AnnotationRef';\nimport { toPageRef, type PageRef } from '../identity/PageRef';\n\n/**\n * The documents the suite opens, each a fresh copy:\n *\n * - `authoring`: any document; stamps are created on its first page.\n * - `acrobat-stamps`: `stamp-opacity-acrobat.pdf`\n * (`packages/engine/main/test/fixtures`): two stamps Acrobat saved at about\n * 30% opacity, each appearance `/R0 gs /MWFOForm Do` with /R0 repeating the\n * stamp's /CA.\n * - `acrobat-rewrapped`: `stamp-rewrapped-acrobat.pdf`, stamps as EmbedPDF\n * writes them after other tools edited them: `rewrapped-a`, turned 30\n * degrees and set to 60% in Acrobat, under Acrobat's layer and four forms\n * that only draw our wrapper; `rewrapped-b`, set to 100% in Acrobat, under\n * one such form; `rewrapped-c`, our 35% layer with /CA dropped, 300 x 120.\n * Each draws a 200 x 100 drawing, opaque where it paints.\n * - `acrobat-roundtrip-60`, `acrobat-roundtrip-100`:\n * `stamp-roundtrip-acrobat-{60,100}.pdf`, an \"Approved\" stamp made in the\n * viewer, turned and set to 40%, then set to 60% and to 100% in Acrobat\n * 26.2. Acrobat moves the form around our wrapper by 0.0008 pt, its box a\n * fraction off the origin in its own arithmetic.\n */\nexport type AnnotationResourceFixture =\n | 'authoring'\n | 'acrobat-stamps'\n | 'acrobat-rewrapped'\n | 'acrobat-roundtrip-60'\n | 'acrobat-roundtrip-100';\n\nexport interface AnnotationResourceConformanceOptions {\n label: string;\n /** Build a fresh engine for this suite. The suite tears it down at the end. */\n makeEngine: () => Promise<Engine> | Engine;\n /** Open a fresh copy of a fixture, with `doc.download` among its scopes. */\n open: (engine: Engine, fixture: AnnotationResourceFixture) => Promise<DocumentHandle>;\n /** Open a fresh copy of a fixture with `scope` only: the import's rights tests run with it. */\n openScoped?: (\n engine: Engine,\n fixture: AnnotationResourceFixture,\n scope: readonly string[],\n ) => Promise<DocumentHandle>;\n}\n\n/**\n * Resources beside an annotation's data, on both engines: `downloadResource`\n * returns what `create(data, resources)` needs to make the same annotation\n * again. A stamp's appearance is its drawing without the fit, rotation and\n * opacity its data describes; a stamp another tool made is drawn as shown,\n * in its own box, without a layer that only repeats its /CA. Stamps with\n * the same artwork place one drawing. The opacity is painted once:\n * in a copy, after a resize, and after a change.\n */\nexport function runAnnotationResourceConformance(\n runner: ConformanceTestRunner,\n opts: AnnotationResourceConformanceOptions,\n): void {\n const { describe, test, beforeAll, afterAll, expect } = runner;\n\n describe(`annotation resource conformance: ${opts.label}`, () => {\n let engine: Engine;\n\n beforeAll(async () => {\n engine = await opts.makeEngine();\n });\n\n afterAll(async () => {\n if (engine) await engine.destroy();\n });\n\n const onPage = async (\n fixture: AnnotationResourceFixture,\n run: (page: PageHandle, doc: DocumentHandle) => Promise<void>,\n ): Promise<void> => {\n const doc = await opts.open(engine, fixture);\n try {\n await run(doc.page(await firstPage(doc)), doc);\n } finally {\n await doc.close();\n }\n };\n\n const rasterOf = (page: PageHandle, ref: AnnotationRef) => appearanceRaster(page, ref);\n\n const expectSameDrawing = (actual: Raster, expected: Raster) => {\n expect([actual.width, actual.height]).toEqual([expected.width, expected.height]);\n expect(maxDifference(actual, expected) <= 3).toBe(true);\n };\n\n test(\"a stamp's appearance and its data make the same stamp\", async () => {\n await onPage('authoring', async (page) => {\n const rect: PageBox = { x: 100, y: 100, width: 160, height: 80 };\n const { annotation: created } = await page.annotations.create(\n {\n subtype: 'stamp',\n box: rect,\n rotation: 30,\n fit: 'cover',\n opacity: 0.5,\n name: 'Approved',\n },\n { resources: { appearance: BANDS_PDF } },\n );\n const appearance = await page.annotations.downloadResource(created.ref, 'appearance');\n expect([...appearance.subarray(0, 4)]).toEqual(PDF_MAGIC);\n\n const data = copyOnItsPage(created);\n const copy = (await page.annotations.create(data, { resources: { appearance } }))\n .annotation;\n expect(dataOf(copy)).toEqual(dataOf(created));\n expectSameDrawing(await rasterOf(page, copy.ref), await rasterOf(page, created.ref));\n });\n });\n\n const acrobatStamps = async (page: PageHandle) => {\n const { annotations } = await page.annotations.list();\n const stamps = annotations.filter((annotation) => annotation.subtype === 'stamp');\n expect(stamps.length).toBe(2);\n return stamps;\n };\n\n /** Painted once: both artworks have opaque pixels, so the most opaque is the opacity. */\n const expectPaintedOnce = (raster: Raster, opacity: number) => {\n expect(Math.abs(maxAlpha(raster) - opacity * 255) <= 3).toBe(true);\n };\n\n test('a copy of a stamp another tool made is drawn as the page shows it', async () => {\n await onPage('acrobat-stamps', async (page) => {\n for (const stamp of await acrobatStamps(page)) {\n // Acrobat's 30%, in the 1/255 steps opacity is stored in.\n expect(stamp.opacity! > 0.25 && stamp.opacity! < 0.35).toBe(true);\n const appearance = await page.annotations.downloadResource(stamp.ref, 'appearance');\n const data = copyOnItsPage(stamp);\n const copy = (await page.annotations.create(data, { resources: { appearance } }))\n .annotation;\n // The popup is another annotation; a copy is made without one.\n expect(dataOf(copy)).toEqual({ ...dataOf(stamp), popup: null });\n const drawn = await rasterOf(page, copy.ref);\n expectPaintedOnce(drawn, stamp.opacity!);\n expectSameDrawing(drawn, await rasterOf(page, stamp.ref));\n }\n });\n });\n\n test('a stamp another tool made keeps its opacity through a resize', async () => {\n await onPage('acrobat-stamps', async (page) => {\n for (const stamp of await acrobatStamps(page)) {\n const { x, y, width, height } = stamp.box;\n const { annotation: updated } = await page.annotations.update(stamp.ref, {\n box: { x, y, width: width * 2, height: height * 2 },\n });\n expectPaintedOnce(await rasterOf(page, updated.ref), stamp.opacity!);\n }\n });\n });\n\n test('a new opacity on a stamp another tool made replaces its own', async () => {\n await onPage('acrobat-stamps', async (page) => {\n for (const stamp of await acrobatStamps(page)) {\n for (const opacity of [1, 0.5]) {\n const { annotation: updated } = await page.annotations.update(stamp.ref, { opacity });\n // Stored as given, not as an 8-bit alpha.\n expect(updated.subtype === 'stamp' && updated.opacity).toBe(opacity);\n expectPaintedOnce(await rasterOf(page, updated.ref), opacity);\n }\n }\n });\n });\n\n test('a turned stamp renders unturned as its unturned twin', async () => {\n await onPage('authoring', async (page) => {\n const box: PageBox = { x: 100, y: 100, width: 160, height: 80 };\n const common = { subtype: 'stamp', fit: 'cover', opacity: 0.5 } as const;\n const turned = (\n await page.annotations.create(\n { ...common, box, rotation: 30 },\n { resources: { appearance: BANDS_PDF } },\n )\n ).annotation;\n const flat = (\n await page.annotations.create(\n { ...common, box },\n { resources: { appearance: BANDS_PDF } },\n )\n ).annotation;\n expectSameDrawing(await rasterOf(page, turned.ref), await rasterOf(page, flat.ref));\n });\n });\n\n /** The fixture's stamps by name: `a`, `b`, `c` for `rewrapped-a` and so on. */\n const rewrappedStamp = async (page: PageHandle, name: 'a' | 'b' | 'c') => {\n const { annotations } = await page.annotations.list();\n const stamp = annotations.find(\n (annotation): annotation is Extract<Annotation, { subtype: 'stamp' }> =>\n annotation.subtype === 'stamp' && annotation.nm === `rewrapped-${name}`,\n );\n if (!stamp) throw new Error(`no stamp rewrapped-${name}`);\n return stamp;\n };\n\n test('a stamp we made is ours again after Acrobat wrapped it', async () => {\n await onPage('acrobat-rewrapped', async (page) => {\n const turned = await rewrappedStamp(page, 'a');\n const opaque = await rewrappedStamp(page, 'b');\n // The file stores /Rotation 30, counterclockwise: 330 degrees clockwise.\n expect(turned).toMatchObject({ rotation: 330, fit: 'contain' });\n expect(Math.abs(turned.opacity! - 0.6) < 0.005).toBe(true);\n expect(opaque.opacity).toBe(1);\n for (const stamp of [turned, opaque]) {\n expectPaintedOnce(await rasterOf(page, stamp.ref), stamp.opacity!);\n // Our drawing in its own box, not the appearance Acrobat put around it.\n const drawing = await page.annotations.downloadResource(stamp.ref, 'appearance');\n expect(pageSize(drawing)).toEqual([200, 100]);\n }\n });\n });\n\n test('a resize of a turned stamp Acrobat wrapped turns it once', async () => {\n await onPage('acrobat-rewrapped', async (page) => {\n const turned = await rewrappedStamp(page, 'a');\n const drawing = await page.annotations.downloadResource(turned.ref, 'appearance');\n const { box } = turned;\n const { annotation: updated } = await page.annotations.update(turned.ref, {\n box: { ...box, width: box.width + 60 },\n rotation: turned.rotation,\n });\n expect(\n pageSize(await page.annotations.downloadResource(updated.ref, 'appearance')),\n ).toEqual([200, 100]);\n // The same data and drawing made afresh: one turn, one fit, one opacity.\n const data = copyOnItsPage(updated);\n const twin = (await page.annotations.create(data, { resources: { appearance: drawing } }))\n .annotation;\n expectSameDrawing(await rasterOf(page, updated.ref), await rasterOf(page, twin.ref));\n expectPaintedOnce(await rasterOf(page, updated.ref), turned.opacity!);\n });\n });\n\n test('a new opacity on a stamp Acrobat wrapped replaces the old one', async () => {\n await onPage('acrobat-rewrapped', async (page) => {\n for (const name of ['a', 'b'] as const) {\n const stamp = await rewrappedStamp(page, name);\n for (const opacity of [1, 0.5, 0.3]) {\n const { annotation: updated } = await page.annotations.update(stamp.ref, { opacity });\n expectPaintedOnce(await rasterOf(page, updated.ref), opacity);\n }\n }\n });\n });\n\n for (const fixture of ['acrobat-roundtrip-60', 'acrobat-roundtrip-100'] as const) {\n test(`a turned stamp from here, edited in Acrobat, turns once (${fixture})`, async () => {\n await onPage(fixture, async (page) => {\n const { annotations } = await page.annotations.list();\n const stamp = annotations.find(\n (annotation): annotation is Extract<Annotation, { subtype: 'stamp' }> =>\n annotation.subtype === 'stamp',\n )!;\n expect(stamp.rotation !== null).toBe(true);\n expect(\n Math.abs(stamp.opacity - (fixture === 'acrobat-roundtrip-60' ? 0.6 : 1)) < 0.01,\n ).toBe(true);\n // Unturned as its twin made afresh from its data and drawing.\n const drawing = await page.annotations.downloadResource(stamp.ref, 'appearance');\n const twin = (\n await page.annotations.create(copyOnItsPage(stamp), {\n resources: {\n appearance: drawing,\n },\n })\n ).annotation;\n expectSameDrawing(await rasterOf(page, stamp.ref), await rasterOf(page, twin.ref));\n\n // And after a resize here.\n const { box } = stamp;\n const { annotation: updated } = await page.annotations.update(stamp.ref, {\n box: { ...box, width: box.width + 40 },\n rotation: stamp.rotation,\n });\n const resized = (\n await page.annotations.create(copyOnItsPage(updated), {\n resources: {\n appearance: drawing,\n },\n })\n ).annotation;\n expectSameDrawing(await rasterOf(page, updated.ref), await rasterOf(page, resized.ref));\n });\n });\n }\n\n test('an opacity the data does not describe is part of the drawing', async () => {\n await onPage('acrobat-rewrapped', async (page) => {\n const stamp = await rewrappedStamp(page, 'c');\n expect(stamp.opacity).toBe(1);\n const shown = await rasterOf(page, stamp.ref);\n expectPaintedOnce(shown, 0.35);\n // The drawing in its own box, which is /Rect's size here, the 35% included.\n const appearance = await page.annotations.downloadResource(stamp.ref, 'appearance');\n expect(pageSize(appearance)).toEqual([300, 120]);\n const data = copyOnItsPage(stamp);\n const copy = (await page.annotations.create(data, { resources: { appearance } }))\n .annotation;\n expectSameDrawing(await rasterOf(page, copy.ref), shown);\n });\n });\n\n /** Export, make a copy from the export, export the copy: `rounds` times. */\n const exportCycles = async (page: PageHandle, stamp: Annotation, rounds: number) => {\n const drawings = [await page.annotations.downloadResource(stamp.ref, 'appearance')];\n const data = copyOnItsPage(stamp);\n for (let round = 0; round < rounds; round++) {\n const appearance = drawings[drawings.length - 1]!;\n const copy = (await page.annotations.create(data, { resources: { appearance } }))\n .annotation;\n drawings.push(await page.annotations.downloadResource(copy.ref, 'appearance'));\n }\n return drawings;\n };\n\n test('a drawing exported again after an import is the same bytes', async () => {\n await onPage('authoring', async (page) => {\n const vector = (\n await page.annotations.create(\n {\n subtype: 'stamp',\n box: { x: 20, y: 20, width: 200, height: 100 },\n fit: 'contain',\n },\n { resources: { appearance: BANDS_PDF } },\n )\n ).annotation;\n const image = (\n await page.annotations.create(\n {\n subtype: 'stamp',\n box: { x: 20, y: 140, width: 100, height: 100 },\n fit: 'cover',\n },\n { resources: { appearance: BANDS_PNG } },\n )\n ).annotation;\n for (const stamp of [vector, image]) {\n const [first, ...again] = await exportCycles(page, stamp, 3);\n for (const drawing of again) expect(sameBytes(drawing, first!)).toBe(true);\n }\n });\n await onPage('acrobat-stamps', async (page) => {\n for (const stamp of await acrobatStamps(page)) {\n const [first, ...again] = await exportCycles(page, stamp, 2);\n for (const drawing of again) expect(sameBytes(drawing, first!)).toBe(true);\n }\n });\n });\n\n test('an image is the same drawing in any box', async () => {\n await onPage('authoring', async (page) => {\n const square = (\n await page.annotations.create(\n {\n subtype: 'stamp',\n box: { x: 20, y: 20, width: 100, height: 100 },\n fit: 'contain',\n },\n { resources: { appearance: BANDS_PNG } },\n )\n ).annotation;\n const wide = (\n await page.annotations.create(\n {\n subtype: 'stamp',\n box: { x: 20, y: 140, width: 300, height: 100 },\n fit: 'cover',\n },\n { resources: { appearance: BANDS_PNG } },\n )\n ).annotation;\n const a = await page.annotations.downloadResource(square.ref, 'appearance');\n const b = await page.annotations.downloadResource(wide.ref, 'appearance');\n expect(sameBytes(a, b)).toBe(true);\n // The image at its own size: a pixel is a point.\n expect(pageSize(a)).toEqual([30, 10]);\n });\n });\n\n test('a cover stamp set to contain shows the whole image', async () => {\n await onPage('authoring', async (page) => {\n const stamp = (\n await page.annotations.create(\n {\n subtype: 'stamp',\n box: { x: 20, y: 20, width: 100, height: 100 },\n fit: 'cover',\n },\n { resources: { appearance: BANDS_PNG } },\n )\n ).annotation;\n const { annotation: updated } = await page.annotations.update(stamp.ref, {\n fit: 'contain',\n });\n const raster = await rasterOf(page, updated.ref);\n const y = Math.floor(raster.height / 2);\n const colour = (fx: number) => {\n const i = (y * raster.width + Math.floor(raster.width * fx)) * 4;\n return [raster.rgba[i], raster.rgba[i + 1], raster.rgba[i + 2]];\n };\n // Red, green and blue bands, letterboxed: not only the green the cover showed.\n expect(colour(0.15)).toEqual([255, 0, 0]);\n expect(colour(0.5)).toEqual([0, 255, 0]);\n expect(colour(0.85)).toEqual([0, 0, 255]);\n });\n });\n\n test('an exported drawing is the drawing and nothing else', async () => {\n await onPage('authoring', async (page) => {\n const stamp = (\n await page.annotations.create(\n {\n subtype: 'stamp',\n box: { x: 20, y: 20, width: 200, height: 100 },\n opacity: 0.5,\n },\n { resources: { appearance: BANDS_PDF } },\n )\n ).annotation;\n const text = new TextDecoder('latin1').decode(\n await page.annotations.downloadResource(stamp.ref, 'appearance'),\n );\n // No /Info with a creation date, nothing of how our wrapper placed it.\n expect(text.includes('/Info')).toBe(false);\n expect(text.includes('CreationDate')).toBe(false);\n expect(text.includes('EPDFOrigContentRect')).toBe(false);\n expect(text.includes('EPDFWRAP')).toBe(false);\n });\n });\n\n test('stamps with the same artwork place one drawing', async () => {\n await onPage('authoring', async (page, doc) => {\n for (let i = 0; i < 10; i++) {\n const x = 20 + 50 * i;\n await page.annotations.create(\n { subtype: 'stamp', box: { x, y: 20, width: 40, height: 20 } },\n { resources: { appearance: BANDS_PNG } },\n );\n await page.annotations.create(\n { subtype: 'stamp', box: { x, y: 60, width: 40, height: 20 } },\n { resources: { appearance: BANDS_PDF } },\n );\n }\n const saved = await rewrite(doc);\n expect(images(saved)).toBe(1);\n expect(occurrences(saved, BANDS_PDF_CONTENT)).toBe(1);\n });\n });\n\n test('an image and the drawing exported from it are one drawing', async () => {\n await onPage('authoring', async (page, doc) => {\n const stamp = (\n await page.annotations.create(\n { subtype: 'stamp', box: { x: 20, y: 20, width: 100, height: 100 } },\n { resources: { appearance: BANDS_PNG } },\n )\n ).annotation;\n const appearance = await page.annotations.downloadResource(stamp.ref, 'appearance');\n await page.annotations.create(\n { subtype: 'stamp', box: { x: 200, y: 20, width: 60, height: 20 } },\n { resources: { appearance } },\n );\n expect(images(await rewrite(doc))).toBe(1);\n });\n });\n\n test('new artwork for one stamp leaves a stamp sharing the old alone', async () => {\n await onPage('authoring', async (page, doc) => {\n const place = async (x: number) =>\n (\n await page.annotations.create(\n {\n subtype: 'stamp',\n box: { x, y: 20, width: 100, height: 100 },\n opacity: 0.5,\n },\n { resources: { appearance: BANDS_PNG } },\n )\n ).annotation;\n const changed = await place(20);\n const kept = await place(200);\n const before = await page.annotations.downloadResource(kept.ref, 'appearance');\n const shown = await rasterOf(page, kept.ref);\n\n await page.annotations.update(changed.ref, {}, { resources: { appearance: BANDS_PDF } });\n expect(\n sameBytes(await page.annotations.downloadResource(kept.ref, 'appearance'), before),\n ).toBe(true);\n expectSameDrawing(await rasterOf(page, kept.ref), shown);\n const saved = await rewrite(doc);\n expect(images(saved)).toBe(1);\n expect(occurrences(saved, BANDS_PDF_CONTENT)).toBe(1);\n });\n });\n\n test('a role the kind does not take is refused', async () => {\n await onPage('authoring', async (page) => {\n const rect: PageBox = { x: 300, y: 300, width: 60, height: 40 };\n const refused = { code: EngineErrorCode.InvalidArg };\n const square = (await page.annotations.create({ subtype: 'square', box: rect })).annotation;\n await expect(\n page.annotations.downloadResource(square.ref, 'appearance'),\n ).rejects.toMatchObject(refused);\n const stamp = (\n await page.annotations.create(\n { subtype: 'stamp', box: rect },\n { resources: { appearance: BANDS_PDF } },\n )\n ).annotation;\n await expect(page.annotations.downloadResource(stamp.ref, 'file')).rejects.toMatchObject(\n refused,\n );\n });\n });\n });\n}\n\nconst PDF_MAGIC = [0x25, 0x50, 0x44, 0x46]; // %PDF\n\n/**\n * The data of a copy on the annotation's own page: a name is unique on its\n * page (ISO 32000-2 §12.5.2), so the copy leaves it out and the engine gives\n * it a fresh one.\n */\nfunction copyOnItsPage(dto: Annotation): AnnotationDraft {\n return { ...(JSON.parse(JSON.stringify(dto)) as AnnotationDraft), nm: null };\n}\n\n/**\n * A read without what a copy doesn't take from its data: where it is, its\n * name, and the attribution, which the engine writes for whoever makes the\n * copy.\n */\nfunction dataOf(dto: Annotation): Record<string, unknown> {\n const {\n ref: _ref,\n nm: _nm,\n author: _author,\n createdAt: _createdAt,\n modifiedAt: _modifiedAt,\n userId: _userId,\n createdBy: _createdBy,\n modifiedBy: _modifiedBy,\n ...data\n } = dto;\n return data;\n}\n\n/** A full rewrite of `doc`, only what the document still uses: its streams. */\nasync function rewrite(doc: DocumentHandle): Promise<SavedStream[]> {\n return savedStreams(await doc.download({ mode: 'rewrite' }));\n}\n\ninterface SavedStream {\n dict: string;\n /** The content, inflated when the stream is Flate-compressed. */\n content: string;\n}\n\nasync function savedStreams(saved: Uint8Array): Promise<SavedStream[]> {\n const latin1 = new TextDecoder('latin1');\n const text = latin1.decode(saved);\n const streams: SavedStream[] = [];\n for (const object of text.matchAll(/\\d+ 0 obj([\\s\\S]*?)endobj/g)) {\n const body = object[1]!;\n const keyword = /stream\\r?\\n/.exec(body);\n const length = /\\/Length (\\d+)/.exec(body);\n if (!keyword || !length) continue;\n const dict = body.slice(0, keyword.index);\n const start = object.index! + object[0].indexOf(body) + keyword.index + keyword[0].length;\n const data = saved.subarray(start, start + Number(length[1]));\n const content = dict.includes('/FlateDecode')\n ? new Uint8Array(\n await new Response(\n new Blob([new Uint8Array(data)])\n .stream()\n .pipeThrough(new DecompressionStream('deflate')),\n ).arrayBuffer(),\n )\n : data;\n streams.push({ dict, content: latin1.decode(content) });\n }\n return streams;\n}\n\n/** How many images a saved file holds. */\nfunction images(streams: SavedStream[]): number {\n return streams.filter((stream) => /\\/Subtype\\s*\\/Image\\b/.test(stream.dict)).length;\n}\n\n/** How many streams of a saved file have exactly `content`. */\nfunction occurrences(streams: SavedStream[], content: string): number {\n return streams.filter((stream) => stream.content === content).length;\n}\n\n/** The width and height of a one-page PDF's page. */\nfunction pageSize(pdf: Uint8Array): [number, number] | null {\n const text = new TextDecoder('latin1').decode(pdf);\n const box = /\\/MediaBox\\s*\\[\\s*([-\\d.]+)\\s+([-\\d.]+)\\s+([-\\d.]+)\\s+([-\\d.]+)\\s*\\]/.exec(text);\n return box ? [Number(box[3]) - Number(box[1]), Number(box[4]) - Number(box[2])] : null;\n}\n\nasync function firstPage(doc: DocumentHandle): Promise<PageRef> {\n const { pages } = await doc.pages.list();\n if (!pages[0]) throw new Error('the document has no pages');\n return toPageRef(pages[0].ref.objectNumber);\n}\n","import { iconRect } from './creatables';\nimport type {\n AnnotationResourceConformanceOptions,\n AnnotationResourceFixture,\n} from './runAnnotationResourceConformance';\nimport type { ConformanceTestRunner } from './runMetadataConformance';\nimport { BANDS_PDF, BANDS_PNG, sameBytes } from './stampFixtures';\nimport type { Annotation } from '../annotation/kinds';\nimport type { DocumentHandle } from '../engine/DocumentHandle';\nimport type { Engine } from '../engine/Engine';\nimport type { PageHandle } from '../engine/PageHandle';\nimport { EngineErrorCode } from '../errors/EngineErrorCode';\nimport type { PageBox } from '../geometry/pageSpace';\nimport { annotationKey } from '../identity/annotationKey';\nimport type { AnnotationRef } from '../identity/AnnotationRef';\nimport { toPageRef, type PageRef } from '../identity/PageRef';\nimport { assertAnnotationBundle, type AnnotationBundle } from '../transfer/AnnotationBundle';\nimport { AnnotationTransfer } from '../transfer/AnnotationTransfer';\n\n/**\n * `doc.annotations.export` on both engines: the annotations as a raw read\n * returns them, each resource once under its hash, the same bytes\n * `downloadResource` returns, and a selection with what it points at and, by\n * default, its threads.\n */\nexport function runAnnotationExportConformance(\n runner: ConformanceTestRunner,\n opts: AnnotationResourceConformanceOptions,\n): void {\n const { describe, test, beforeAll, afterAll, expect } = runner;\n\n describe(`annotation export conformance: ${opts.label}`, () => {\n let engine: Engine;\n\n beforeAll(async () => {\n engine = await opts.makeEngine();\n });\n\n afterAll(async () => {\n if (engine) await engine.destroy();\n });\n\n const onPage = async (\n fixture: AnnotationResourceFixture,\n run: (page: PageHandle, doc: DocumentHandle, pageRef: PageRef) => Promise<void>,\n ): Promise<void> => {\n const doc = await opts.open(engine, fixture);\n try {\n const { pages } = await doc.pages.list();\n const pageRef = toPageRef(pages[0]!.ref.objectNumber);\n await run(doc.page(pageRef), doc, pageRef);\n } finally {\n await doc.close();\n }\n };\n\n const keysOf = (bundle: AnnotationBundle) =>\n bundle.items.map((item) => annotationKey(item.data.ref));\n\n test('exports the annotations as a read returns them, and each resource once', async () => {\n await onPage('authoring', async (page, doc, pageRef) => {\n const box = (x: number): PageBox => ({ x, y: 20, width: 60, height: 30 });\n const first = await page.annotations.create(\n { subtype: 'stamp', box: box(20) },\n { resources: { appearance: BANDS_PDF } },\n );\n const second = await page.annotations.create(\n { subtype: 'stamp', box: box(100), opacity: 0.5 },\n { resources: { appearance: BANDS_PDF } },\n );\n const image = await page.annotations.create(\n { subtype: 'stamp', box: box(180) },\n { resources: { appearance: BANDS_PNG } },\n );\n const file = await page.annotations.create(\n {\n subtype: 'file-attachment',\n rect: iconRect(box(260).x, box(260).y),\n file: { name: 'note.txt' },\n },\n { resources: { file: new TextEncoder().encode('attached') } },\n );\n\n const bundle = await doc.annotations.export();\n await assertAnnotationBundle(bundle);\n const read = await doc.annotations.list({ pages: [pageRef] });\n expect(bundle.items.map((item) => item.data)).toEqual(read.annotations);\n\n const { pages } = await doc.pages.list();\n expect(bundle.pages).toEqual([{ page: pageRef, position: 0, size: pages[0]!.size }]);\n\n const idOf = (ref: AnnotationRef, role: 'appearance' | 'file') =>\n bundle.items.find((item) => annotationKey(item.data.ref) === annotationKey(ref))!\n .resources[role]!;\n // One drawing, one resource, however many stamps place it.\n expect(idOf(first.annotation.ref, 'appearance')).toBe(\n idOf(second.annotation.ref, 'appearance'),\n );\n expect(Object.keys(bundle.resources)).toHaveLength(3);\n for (const [ref, role] of [\n [first.annotation.ref, 'appearance'],\n [image.annotation.ref, 'appearance'],\n [file.annotation.ref, 'file'],\n ] as const) {\n const bytes = await page.annotations.downloadResource(ref, role);\n expect(sameBytes(bundle.resources[idOf(ref, role)]!, bytes)).toBe(true);\n }\n\n expect(await AnnotationTransfer.parse(AnnotationTransfer.stringify(bundle))).toEqual(\n bundle,\n );\n });\n });\n\n test('exports a stamp another tool made as downloadResource returns it', async () => {\n await onPage('acrobat-stamps', async (page, doc) => {\n const bundle = await doc.annotations.export();\n await assertAnnotationBundle(bundle);\n const stamps = bundle.items.filter((item) => item.data.subtype === 'stamp');\n expect(stamps).toHaveLength(2);\n for (const stamp of stamps) {\n const bytes = await page.annotations.downloadResource(stamp.data.ref, 'appearance');\n expect(sameBytes(bundle.resources[stamp.resources.appearance!]!, bytes)).toBe(true);\n }\n });\n });\n\n // Every engine exports these fixtures to exactly this file, so a bundle\n // is the same whichever engine made it. A change to what a read returns,\n // or to the canonical drawing, changes these on purpose: update them here.\n test('exports a document to the same file on every engine', async () => {\n const expected = {\n 'acrobat-stamps': '8e7b1ade219fe9c78e355e8c282a46e9b8131f76a2c98b70331d909830fff9b6',\n 'acrobat-rewrapped': '4cead3c1918229234fad1651b082aa0b09b49325d6e462177eae30f049939b11',\n } as const;\n for (const [fixture, hash] of Object.entries(expected)) {\n await onPage(fixture as AnnotationResourceFixture, async (_page, doc) => {\n const text = AnnotationTransfer.stringify(await doc.annotations.export());\n const digest = new Uint8Array(\n await crypto.subtle.digest('SHA-256', new TextEncoder().encode(text)),\n );\n let hex = '';\n for (const byte of digest) hex += byte.toString(16).padStart(2, '0');\n expect(hex).toBe(hash);\n });\n }\n });\n\n test('takes a comment with its thread, or only what it points at', async () => {\n await onPage('authoring', async (page, doc) => {\n const rect: PageBox = { x: 300, y: 300, width: 20, height: 20 };\n const create = async (draft: Parameters<PageHandle['annotations']['create']>[0]) =>\n (await page.annotations.create(draft)).annotation as Annotation;\n const note = await create({\n subtype: 'text',\n rect: iconRect(rect.x, rect.y),\n contents: 'Check this',\n });\n const popup = await create({ subtype: 'popup', rect, parent: note.ref });\n const reply = await create({\n subtype: 'text',\n rect: iconRect(rect.x, rect.y),\n reply: { to: note.ref },\n });\n const answer = await create({\n subtype: 'text',\n rect: iconRect(rect.x, rect.y),\n reply: { to: reply.ref },\n });\n await create({ subtype: 'square', box: rect });\n\n const keys = (refs: Annotation[]) =>\n refs.map((annotation) => annotationKey(annotation.ref));\n expect(keysOf(await doc.annotations.export({ refs: [note.ref] }))).toEqual(\n keys([note, popup, reply, answer]),\n );\n expect(\n keysOf(await doc.annotations.export({ refs: [note.ref], include: 'references' })),\n ).toEqual(keys([note, popup]));\n expect(\n keysOf(await doc.annotations.export({ refs: [answer.ref], include: 'references' })),\n ).toEqual(keys([note, popup, reply, answer]));\n });\n });\n\n test('exports the document as it is now, after an edit and after a page move', async () => {\n await onPage('authoring', async (page, doc, first) => {\n const rect: PageBox = { x: 20, y: 20, width: 60, height: 30 };\n await page.annotations.create({ subtype: 'square', box: rect });\n const before = await doc.annotations.export();\n expect(before.items).toHaveLength(1);\n\n // A new annotation is in the next export.\n await page.annotations.create({ subtype: 'circle', box: rect });\n expect((await doc.annotations.export()).items).toHaveLength(2);\n\n // A page move changes where the pages are, and nothing about the\n // annotations: the export gives the new position.\n await doc.pages.insertBlank({ size: { width: 200, height: 200 } }, 'start');\n expect((await doc.annotations.export()).pages.map((entry) => entry.position)).toEqual([1]);\n await doc.pages.reorder([first], 'start');\n const moved = await doc.annotations.export();\n expect(moved.pages).toEqual([{ ...before.pages[0]!, position: 0 }]);\n });\n });\n\n test('takes a selection larger than a URL holds', async () => {\n await onPage('authoring', async (page, doc) => {\n // An export URL carries a few hundred refs: make more, as one import.\n const { annotation: seed } = await page.annotations.create({\n subtype: 'square',\n box: { x: 10, y: 10, width: 30, height: 30 },\n });\n const one = await doc.annotations.export({ refs: [seed.ref] });\n const many = await doc.annotations.import(\n { ...one, items: Array.from({ length: 300 }, () => one.items[0]!) },\n { attribution: 'stamp' },\n );\n const refs = many.annotations.map((annotation) => annotation.ref);\n const bundle = await doc.annotations.export({ refs });\n expect(bundle.items.map((item) => annotationKey(item.data.ref)).sort()).toEqual(\n refs.map(annotationKey).sort(),\n );\n });\n });\n\n test('refuses a page or an annotation the document does not have', async () => {\n await onPage('authoring', async (_page, doc, pageRef) => {\n const missing = { code: EngineErrorCode.NotFound };\n await expect(doc.annotations.export({ pages: [toPageRef(999_999)] })).rejects.toMatchObject(\n missing,\n );\n await expect(\n doc.annotations.export({\n refs: [{ kind: 'objectNumber', page: pageRef, objectNumber: 999_999 }],\n }),\n ).rejects.toMatchObject(missing);\n });\n });\n });\n}\n","/** A name the engine mints for an annotation whose data has none: an RFC 9562 v7 UUID. */\nexport const UUID_V7 = /^[0-9a-f]{8}-[0-9a-f]{4}-7[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/;\n","import { creatables, iconRect, PNG_1X1 } from './creatables';\nimport { UUID_V7 } from './names';\nimport type {\n AnnotationResourceConformanceOptions,\n AnnotationResourceFixture,\n} from './runAnnotationResourceConformance';\nimport { isPermissionRefusal } from './refusals';\nimport type { ConformanceTestRunner } from './runMetadataConformance';\nimport { BANDS_PDF } from './stampFixtures';\nimport type { Annotation } from '../annotation/kinds';\nimport type { DocumentHandle } from '../engine/DocumentHandle';\nimport type { Change } from '../mutation/Change';\nimport type { Engine } from '../engine/Engine';\nimport type { PageHandle } from '../engine/PageHandle';\nimport { EngineErrorCode } from '../errors/EngineErrorCode';\nimport type { DocumentEvent } from '../events/DocumentEvent';\nimport type { PageBox } from '../geometry/pageSpace';\nimport { annotationKey } from '../identity/annotationKey';\nimport type { AnnotationRef } from '../identity/AnnotationRef';\nimport { encodePageKey, toPageRef, type PageRef } from '../identity/PageRef';\nimport type { AnnotationBundle } from '../transfer/AnnotationBundle';\nimport { resourceIdOf } from '../transfer/bundle';\nimport type { AnnotationImportResult } from '../transfer/annotationImport';\n\n/**\n * `doc.annotations.import` on both engines, in `stamp` mode: a bundle comes\n * back as the export had it, one fact per annotation as one transaction,\n * what can't be carried left out and reported, pages mapped, and a refusal\n * before anything is written. An import is a change: undone and redone with\n * `doc.apply({ undoOf })`, answered again on a retry, and a restoring\n * import's undo takes the import's rights.\n */\nexport function runAnnotationImportConformance(\n runner: ConformanceTestRunner,\n opts: AnnotationResourceConformanceOptions,\n): void {\n const { describe, test, beforeAll, afterAll, expect } = runner;\n\n describe(`annotation import conformance: ${opts.label}`, () => {\n let engine: Engine;\n\n beforeAll(async () => {\n engine = await opts.makeEngine();\n });\n\n afterAll(async () => {\n if (engine) await engine.destroy();\n });\n\n /** Two fresh copies of a fixture: where a bundle comes from, and where it goes. */\n const twoCopies = async (\n fixture: AnnotationResourceFixture,\n run: (source: DocumentHandle, target: DocumentHandle, page: PageRef) => Promise<void>,\n ): Promise<void> => {\n const source = await opts.open(engine, fixture);\n const target = await opts.open(engine, fixture);\n try {\n const { pages } = await source.pages.list();\n await run(source, target, toPageRef(pages[0]!.ref.objectNumber));\n } finally {\n await source.close();\n await target.close();\n }\n };\n\n const box = (x: number): PageBox => ({ x, y: 300, width: 40, height: 30 });\n const create = async (\n page: PageHandle,\n draft: Parameters<PageHandle['annotations']['create']>[0],\n resources?: Parameters<PageHandle['annotations']['create']>[1],\n ) => (await page.annotations.create(draft, resources)).annotation as Annotation;\n\n test('imports every kind a create makes, as the export has it', async () => {\n await twoCopies('authoring', async (source, target, pageRef) => {\n const page = source.page(pageRef);\n for (const { data, resources } of creatables()) await create(page, data, { resources });\n await create(\n page,\n { subtype: 'stamp', box: box(20) },\n { resources: { appearance: BANDS_PDF } },\n );\n await create(\n page,\n { subtype: 'stamp', box: box(80), opacity: 0.5 },\n { resources: { appearance: BANDS_PDF } },\n );\n const note = await create(page, {\n subtype: 'text',\n rect: iconRect(box(140).x, box(140).y),\n contents: 'Check',\n });\n await create(page, { subtype: 'popup', rect: box(200), parent: note.ref, open: true });\n await create(page, {\n subtype: 'text',\n rect: iconRect(box(140).x, box(140).y),\n reply: { to: note.ref },\n });\n await create(page, {\n subtype: 'link',\n rect: box(260),\n target: { kind: 'goto', destination: { kind: 'fit', page: pageRef } },\n });\n\n const bundle = await source.annotations.export();\n const result = await target.annotations.import(bundle, { attribution: 'stamp' });\n expect(result.dropped).toEqual([]);\n expect(result.annotations).toHaveLength(bundle.items.length);\n expect(result.refMap.map((pair) => annotationKey(pair.from))).toEqual(\n bundle.items.map((item) => annotationKey(item.data.ref)),\n );\n\n // Copies, so each has a fresh name.\n const names = new Set(bundle.items.map((item) => item.data.nm));\n for (const annotation of result.annotations) {\n expect(annotation.nm).toMatch(UUID_V7);\n expect(names.has(annotation.nm)).toBe(false);\n }\n // Exported again, the target gives the same file, apart from the new\n // refs and names and the attribution the import stamped: the same\n // data, and each drawing and file under the same id.\n const again = await target.annotations.export();\n expect(comparable(again, result)).toEqual(comparable(bundle));\n expect(Object.keys(again.resources).sort()).toEqual(Object.keys(bundle.resources).sort());\n expect(result.annotations).toEqual(again.items.map((item) => item.data));\n });\n });\n\n test('emits one annotations.created per annotation, as one transaction', async () => {\n await twoCopies('authoring', async (source, target, pageRef) => {\n const page = source.page(pageRef);\n await create(page, { subtype: 'square', box: box(20) });\n await create(page, { subtype: 'circle', box: box(80) });\n const bundle = await source.annotations.export();\n\n const events: DocumentEvent[] = [];\n target.events.subscribe((event) => events.push(event));\n const result = await target.annotations.import(bundle, {\n attribution: 'stamp',\n opId: 'import-1',\n });\n const created = events.filter((event) => event.type === 'annotations.created');\n expect(created).toHaveLength(2);\n created.forEach((event, index) => {\n if (event.type !== 'annotations.created') return;\n expect(event.annotation).toEqual(result.annotations[index]);\n expect(event.page).toEqual(pageRef);\n expect(event.origin.tx).toEqual({ id: 'import-1', index, count: 2 });\n });\n });\n });\n\n test('a restore leaves out a name the page has, and what points at it, then names on a repeat', async () => {\n await twoCopies('authoring', async (source, target, pageRef) => {\n const page = source.page(pageRef);\n const taken = await create(page, {\n subtype: 'text',\n rect: iconRect(box(20).x, box(20).y),\n nm: 'taken',\n });\n const reply = await create(page, {\n subtype: 'text',\n rect: iconRect(box(20).x, box(20).y),\n reply: { to: taken.ref },\n });\n const free = await create(page, { subtype: 'square', box: box(80), nm: 'free' });\n // Named by the engine, as every create is.\n const circle = await create(page, { subtype: 'circle', box: box(140) });\n await create(target.page(pageRef), { subtype: 'square', box: box(200), nm: 'taken' });\n const bundle = await source.annotations.export();\n\n const first = await target.annotations.import(bundle, { attribution: 'restore' });\n expect(first.dropped).toEqual([\n { ref: taken.ref, reason: 'name-conflict' },\n { ref: reply.ref, reason: 'parent-dropped' },\n ]);\n expect(first.refMap.map((pair) => annotationKey(pair.from))).toEqual(\n [free, circle].map((annotation) => annotationKey(annotation.ref)),\n );\n expect(first.annotations.map((annotation) => annotation.nm)).toEqual(['free', circle.nm]);\n\n // Every name is recognized again.\n const second = await target.annotations.import(bundle, { attribution: 'restore' });\n expect(second.dropped.map((drop) => drop.reason)).toEqual([\n 'name-conflict',\n 'parent-dropped',\n 'name-conflict',\n 'name-conflict',\n ]);\n expect(second.annotations).toEqual([]);\n });\n });\n\n test('a stamp makes copies: each gets a fresh name, so a name the page has is no conflict', async () => {\n await twoCopies('authoring', async (source, target, pageRef) => {\n const page = source.page(pageRef);\n const taken = await create(page, {\n subtype: 'text',\n rect: iconRect(box(20).x, box(20).y),\n nm: 'taken',\n });\n await create(page, {\n subtype: 'text',\n rect: iconRect(box(20).x, box(20).y),\n reply: { to: taken.ref },\n });\n await create(target.page(pageRef), { subtype: 'square', box: box(200), nm: 'taken' });\n const bundle = await source.annotations.export();\n\n for (let copy = 0; copy < 2; copy++) {\n const result = await target.annotations.import(bundle, { attribution: 'stamp' });\n expect(result.dropped).toEqual([]);\n const [note, reply] = result.annotations;\n expect(note!.nm).toMatch(UUID_V7);\n expect(reply!.nm).toMatch(UUID_V7);\n expect(note!.nm === 'taken').toBe(false);\n expect(reply!.reply?.to).toEqual(note!.ref);\n }\n });\n });\n\n test('puts each page where the options say', async () => {\n await twoCopies('authoring', async (source, target, pageRef) => {\n await create(source.page(pageRef), { subtype: 'square', box: box(20) });\n const bundle = await source.annotations.export();\n await target.pages.insertBlank({ size: { width: 300, height: 300 } }, 'start');\n const { pages } = await target.pages.list();\n const blank = toPageRef(pages[0]!.ref.objectNumber);\n\n const pageOf = (result: AnnotationImportResult) => result.annotations[0]!.ref.page;\n const same = await target.annotations.import(bundle, { attribution: 'stamp' });\n expect(pageOf(same)).toEqual(pageRef);\n const byPosition = await target.annotations.import(bundle, {\n attribution: 'stamp',\n pages: 'by-position',\n });\n expect(pageOf(byPosition)).toEqual(blank);\n const listed = await target.annotations.import(bundle, {\n attribution: 'stamp',\n pages: [{ from: pageRef, to: blank }],\n });\n expect(pageOf(listed)).toEqual(blank);\n expect((await target.annotations.list({ pages: [blank] })).annotations).toHaveLength(2);\n });\n });\n\n test('refuses before writing anything: an unmapped page, a tampered or oversized resource', async () => {\n await twoCopies('authoring', async (source, target, pageRef) => {\n const page = source.page(pageRef);\n const stamp = await create(\n page,\n { subtype: 'stamp', box: box(20) },\n { resources: { appearance: PNG_1X1 } },\n );\n await source.pages.insertBlank({ size: { width: 300, height: 300 } }, { after: pageRef });\n const { pages } = await source.pages.list();\n const second = toPageRef(pages[1]!.ref.objectNumber);\n await create(source.page(second), { subtype: 'square', box: box(20) });\n const bundle = await source.annotations.export();\n\n const events: DocumentEvent[] = [];\n target.events.subscribe((event) => events.push(event));\n const refused = (\n candidate: AnnotationBundle,\n options: Parameters<DocumentHandle['annotations']['import']>[1],\n ) => target.annotations.import(candidate, { attribution: 'stamp', ...options });\n\n // The second page is not in the target.\n await expect(refused(bundle, {})).rejects.toMatchObject({\n code: EngineErrorCode.InvalidArg,\n details: { pages: [encodePageKey(second)] },\n });\n\n const stampOnly = (bytes: Uint8Array, id: `sha256-${string}`): AnnotationBundle => ({\n ...bundle,\n pages: bundle.pages.slice(0, 1),\n items: [{ data: stamp, resources: { appearance: id } }],\n resources: { [id]: bytes },\n });\n const tampered = stampOnly(PNG_1X1, await resourceIdOf(BANDS_PDF));\n await expect(refused(tampered, {})).rejects.toMatchObject({\n code: EngineErrorCode.InvalidArg,\n });\n\n // A PNG whose header says 10 000 × 10 000: refused from the header.\n const huge = PNG_1X1.slice();\n new DataView(huge.buffer).setUint32(16, 10_000);\n new DataView(huge.buffer).setUint32(20, 10_000);\n await expect(refused(stampOnly(huge, await resourceIdOf(huge)), {})).rejects.toMatchObject({\n code: EngineErrorCode.PayloadTooLarge,\n details: { limit: 'imagePixels' },\n });\n\n expect((await target.annotations.list({ pages: [pageRef] })).annotations).toEqual([]);\n expect(events).toEqual([]);\n });\n });\n\n /** The page's annotations as the target reads them. */\n const listed = async (doc: DocumentHandle, pageRef: PageRef) =>\n (await doc.annotations.list({ pages: [pageRef] })).annotations as Annotation[];\n const keysOf = (annotations: readonly { ref: AnnotationRef }[]) =>\n annotations.map((annotation) => annotationKey(annotation.ref)).sort();\n\n /** A thread (a note, its popup, a reply), a square and a stamp, exported. */\n const threadBundle = async (source: DocumentHandle, pageRef: PageRef) => {\n const page = source.page(pageRef);\n const note = await create(page, {\n subtype: 'text',\n rect: iconRect(box(20).x, box(20).y),\n contents: 'Check',\n });\n await create(page, { subtype: 'popup', rect: box(80), parent: note.ref });\n await create(page, {\n subtype: 'text',\n rect: iconRect(box(20).x, box(20).y),\n reply: { to: note.ref },\n });\n await create(page, { subtype: 'square', box: box(140) });\n await create(\n page,\n { subtype: 'stamp', box: box(200) },\n { resources: { appearance: PNG_1X1 } },\n );\n return source.annotations.export();\n };\n\n for (const attribution of ['stamp', 'restore'] as const) {\n test(`an import (${attribution}) is undone and redone: the same refs and attribution`, async () => {\n await twoCopies('authoring', async (source, target, pageRef) => {\n const bundle = await threadBundle(source, pageRef);\n const before = keysOf(await listed(target, pageRef));\n const imported = await target.annotations.import(bundle, { attribution });\n expect(imported.meta.undoable).toBe(true);\n expect(imported.annotations).toHaveLength(5);\n\n // The thread goes as one, the square and the stamp each alone.\n const undo = await target.apply({ undoOf: imported.meta.opId });\n expect(undo.items.map((item) => item.type)).toEqual([\n 'annotations.delete',\n 'annotations.delete',\n 'annotations.delete',\n ]);\n expect(keysOf(await listed(target, pageRef))).toEqual(before);\n\n // The undo's undo brings back the same annotations, as the import wrote them.\n await target.apply({ undoOf: undo.meta.opId });\n const back = await listed(target, pageRef);\n const byKey = new Map(\n back.map((annotation) => [annotationKey(annotation.ref), annotation]),\n );\n for (const annotation of imported.annotations) {\n const again = byKey.get(annotationKey(annotation.ref));\n expect(again).toMatchObject({\n nm: annotation.nm,\n userId: annotation.userId,\n createdBy: annotation.createdBy,\n author: annotation.author,\n rect: annotation.rect,\n });\n }\n });\n });\n }\n\n test('an imported annotation changed since stays; the rest of the import goes', async () => {\n await twoCopies('authoring', async (source, target, pageRef) => {\n const page = source.page(pageRef);\n await create(page, { subtype: 'square', box: box(20) });\n await create(page, { subtype: 'circle', box: box(80) });\n const bundle = await source.annotations.export();\n const imported = await target.annotations.import(bundle, { attribution: 'stamp' });\n const [square, circle] = imported.annotations;\n await target.page(pageRef).annotations.update(square!.ref, { color: '#00aa00' });\n\n const undo = await target.apply({ undoOf: imported.meta.opId });\n expect(undo.items.map((item) => item.type).sort()).toEqual([\n 'annotations.delete',\n 'skipped',\n ]);\n const left = keysOf(await listed(target, pageRef));\n expect(left.includes(annotationKey(square!.ref))).toBe(true);\n expect(left.includes(annotationKey(circle!.ref))).toBe(false);\n });\n });\n\n test('a retry under the same opId answers again and writes nothing more', async () => {\n await twoCopies('authoring', async (source, target, pageRef) => {\n await create(source.page(pageRef), { subtype: 'square', box: box(20) });\n const bundle = await source.annotations.export();\n const first = await target.annotations.import(bundle, {\n attribution: 'stamp',\n opId: 'import-retry',\n });\n const again = await target.annotations.import(bundle, {\n attribution: 'stamp',\n opId: 'import-retry',\n });\n expect(keysOf(again.annotations)).toEqual(keysOf(first.annotations));\n const squares = (await listed(target, pageRef)).filter((a) => a.subtype === 'square');\n expect(squares).toHaveLength(1);\n });\n });\n\n test(\"doc.apply takes no import: restoring attribution stays the import verb's\", async () => {\n await twoCopies('authoring', async (source, target) => {\n const bundle = await source.annotations.export();\n // No op of `doc.apply` is an import: a caller can only force one in.\n const change = { ops: [{ type: 'annotations.import', bundle, attribution: 'restore' }] };\n await expect(target.apply(change as unknown as Change)).rejects.toMatchObject({\n code: EngineErrorCode.InvalidArg,\n });\n });\n });\n\n test('a final write ends undo for an import before it', async () => {\n await twoCopies('authoring', async (source, target, pageRef) => {\n await create(source.page(pageRef), { subtype: 'square', box: box(20) });\n const bundle = await source.annotations.export();\n const imported = await target.annotations.import(bundle, { attribution: 'stamp' });\n await target.page(pageRef).annotations.flatten([imported.annotations[0]!.ref]);\n await expect(target.apply({ undoOf: imported.meta.opId })).rejects.toMatchObject({\n code: EngineErrorCode.UndoUnavailable,\n });\n });\n });\n\n test(\"undoing a restoring import takes the import's rights, not the per-annotation ones\", async () => {\n if (!opts.openScoped) return;\n // May delete only its own annotations, and may import.\n const scope = [\n 'doc.open',\n 'doc.render',\n 'doc.download',\n 'doc.annotate.modify',\n 'doc.annotate.import',\n 'annotations:delete:self',\n ];\n const source = await opts.open(engine, 'authoring');\n const target = await opts.openScoped(engine, 'authoring', scope);\n try {\n const { pages } = await source.pages.list();\n const pageRef = toPageRef(pages[0]!.ref.objectNumber);\n await create(source.page(pageRef), { subtype: 'square', box: box(20) });\n const bundle = await source.annotations.export();\n const imported = await target.annotations.import(bundle, { attribution: 'restore' });\n const [square] = imported.annotations;\n\n // The square isn't the session's own: a delete is refused.\n const refused = await target\n .page(pageRef)\n .annotations.delete(square!.ref)\n .then(\n () => null,\n (error: unknown) => error,\n );\n expect(isPermissionRefusal(refused)).toBe(true);\n\n // The import's undo and its redo take what the import took.\n const undo = await target.apply({ undoOf: imported.meta.opId });\n const key = annotationKey(square!.ref);\n expect(keysOf(await listed(target, pageRef)).includes(key)).toBe(false);\n await target.apply({ undoOf: undo.meta.opId });\n expect(keysOf(await listed(target, pageRef)).includes(key)).toBe(true);\n } finally {\n await source.close();\n await target.close();\n }\n });\n });\n}\n\n/**\n * A bundle as two engines or two documents can agree on it: each ref as the\n * source had it (`result.refMap` maps the target's back), and without the\n * attribution an import stamps, the attached file's dates included.\n */\nfunction comparable(bundle: AnnotationBundle, result?: AnnotationImportResult) {\n const back = new Map(\n (result?.refMap ?? []).map((pair) => [annotationKey(pair.to), pair.from] as const),\n );\n const source = (ref: AnnotationRef | null | undefined) =>\n ref ? (back.get(annotationKey(ref)) ?? ref) : ref;\n return bundle.items.map(({ data, resources }) => {\n const {\n author: _author,\n createdAt: _createdAt,\n modifiedAt: _modifiedAt,\n userId: _userId,\n createdBy: _createdBy,\n modifiedBy: _modifiedBy,\n nm: _nm,\n ...rest\n } = data as Annotation & Record<string, unknown>;\n const fields = rest as Record<string, unknown>;\n // An attached file is dated when it is written, as the stamp dates the annotation.\n if (data.subtype === 'file-attachment' && data.file) {\n const { createdAt: _fileCreatedAt, modifiedAt: _fileModifiedAt, ...file } = data.file;\n fields.file = file;\n }\n return {\n data: {\n ...fields,\n ref: source(data.ref),\n popup: source(data.popup),\n ...(data.reply ? { reply: { ...data.reply, to: source(data.reply.to) } } : {}),\n ...(data.subtype === 'popup' ? { parent: source(data.parent) } : {}),\n },\n resources,\n };\n });\n}\n","import { appearanceRasters, maxShiftedDifference } from './appearanceRasters';\nimport { creatables, iconRect } from './creatables';\nimport { UUID_V7 } from './names';\nimport type { ConformanceTestRunner } from './runMetadataConformance';\nimport { BANDS_PDF, sameBytes } from './stampFixtures';\nimport { drawnPointsOf } from '../pageSpace/helpers';\nimport type { Annotation } from '../annotation/kinds';\nimport type { DocumentHandle } from '../engine/DocumentHandle';\nimport type { Engine } from '../engine/Engine';\nimport type { PageHandle } from '../engine/PageHandle';\nimport { pdfRectTurnedBounds } from '../geometry/convert';\nimport type { PageBox } from '../geometry/pageSpace';\nimport type { PdfRect } from '../geometry/primitives';\nimport { annotationKey } from '../identity/annotationKey';\nimport type { AnnotationRef } from '../identity/AnnotationRef';\nimport { encodePageKey, toPageRef, type PageRef } from '../identity/PageRef';\nimport type { AnnotationBundle } from '../transfer/AnnotationBundle';\nimport type { AnnotationImportDrop, AnnotationImportResult } from '../transfer/annotationImport';\nimport { pageRefsIn } from '../transfer/pageRefs';\n\nexport interface AnnotationTransferConformanceOptions {\n label: string;\n /** Build a fresh engine for this suite. The suite tears it down at the end. */\n makeEngine: () => Promise<Engine> | Engine;\n /**\n * The documents to round-trip. `'authoring'` is a document without\n * annotations, which the suite fills with one annotation of every kind a\n * create makes, two stamps sharing a drawing, a named comment with its\n * popup and a reply, and a link.\n */\n fixtures: readonly string[];\n /** Open a fresh copy of a fixture, with every scope, `doc.annotate.import` included. */\n open: (engine: Engine, fixture: string) => Promise<DocumentHandle>;\n}\n\ntype Attribution = 'restore' | 'stamp';\n\n/**\n * What `stamp` writes afresh, and so leaves out of a comparison: the\n * attribution, and the name, which a copy gets new.\n */\nconst STAMPED = ['author', 'createdAt', 'modifiedAt', 'userId', 'createdBy', 'modifiedBy', 'nm'];\n\n/**\n * Check annotation transfer over every fixture on both engines. The source\n * bundle is imported into a copy without annotations, then exported again:\n *\n * - The normalized exports agree after unsupported fields are dropped, and\n * every resource has the same bytes under the same id. A copy is drawn from\n * its data, as Acrobat's FDF and XFDF carry it: only a stamp carries its\n * drawing. So where the data is points, the box is the frame of our\n * drawing, which holds the points, and an icon's box is our icon at the\n * same anchor;\n * - Restored attribution is the source's, while stamped attribution is\n * the session's;\n * - Every page keeps the source bundle's annotation order;\n * - Replies, popups, their parents and link destinations point at the copies;\n * - A stamp draws as its source, and in our own file every kind does,\n * an edge moved by a fraction of a pixel aside (Acrobat moves a stamp's\n * form by a fraction of a point, which the drawing leaves out);\n * - A second import names nothing twice and adds no drawing already present.\n * Export golden files and forced-failure tests cover the remaining cases.\n */\nexport function runAnnotationTransferConformance(\n runner: ConformanceTestRunner,\n opts: AnnotationTransferConformanceOptions,\n): void {\n const { describe, test, beforeAll, afterAll, expect } = runner;\n\n describe(`annotation transfer conformance: ${opts.label}`, () => {\n let engine: Engine;\n\n beforeAll(async () => {\n engine = await opts.makeEngine();\n });\n\n afterAll(async () => {\n if (engine) await engine.destroy();\n });\n\n /** Open the source document and export its annotations. */\n const exported = async (fixture: string) => {\n const doc = await opts.open(engine, fixture);\n if (fixture === 'authoring') await fill(doc);\n return { doc, bundle: await doc.annotations.export() };\n };\n\n /**\n * A fresh copy of the fixture, its annotations deleted, apart from\n * form fields' widgets, which belong to their fields. The keys of those it\n * kept are returned, so an export of the copy can leave them out.\n */\n const bare = async (fixture: string) => {\n const doc = await opts.open(engine, fixture);\n const kept = new Set<string>();\n const pages = (await doc.pages.list()).pages.map((entry) =>\n toPageRef(entry.ref.objectNumber),\n );\n for (const pageRef of pages) {\n for (;;) {\n const { annotations } = await doc.annotations.list({ pages: [pageRef] });\n const last = [...annotations].reverse().find((annotation) => !isFieldWidget(annotation));\n if (!last) break;\n await doc.page(pageRef).annotations.delete(last.ref);\n }\n const { annotations } = await doc.annotations.list({ pages: [pageRef] });\n for (const annotation of annotations) kept.add(annotationKey(annotation.ref));\n }\n return { doc, kept };\n };\n\n const roundTrip = async (\n fixture: string,\n attribution: Attribution,\n check: (run: {\n source: DocumentHandle;\n bundle: AnnotationBundle;\n copy: DocumentHandle;\n result: AnnotationImportResult;\n again: AnnotationBundle;\n /** The widgets the copy kept: its export leaves them out. */\n kept: ReadonlySet<string>;\n }) => Promise<void>,\n ) => {\n const { doc: source, bundle } = await exported(fixture);\n const { doc: copy, kept } = await bare(fixture);\n try {\n const result = await copy.annotations.import(bundle, { attribution });\n const again = without(await copy.annotations.export(), kept);\n await check({ source, bundle, copy, result, again, kept });\n } finally {\n await source.close();\n await copy.close();\n }\n };\n\n /** The frame of each copy whose data is points holds those points. */\n const expectFramesHoldGeometry = (bundle: AnnotationBundle) => {\n const epsilon = 0.01;\n for (const { data } of bundle.items) {\n if (!FRAMED.has(data.subtype)) continue;\n const { rect } = data;\n const outside = geometryOf(data).filter(\n ({ x, y }) =>\n x < rect.x - epsilon ||\n x > rect.x + rect.width + epsilon ||\n y < rect.y - epsilon ||\n y > rect.y + rect.height + epsilon,\n );\n expect({ key: annotationKey(data.ref), outside }).toEqual({\n key: annotationKey(data.ref),\n outside: [],\n });\n }\n };\n\n /** Each turned box's `rect` is the upright box around its own box, turned. */\n const expectTurnedRects = (bundle: AnnotationBundle) => {\n for (const { data } of bundle.items) {\n const turn = turnOf(data);\n if (!turn) continue;\n // Bounds of a box turned about its middle are the same either way y points.\n const expected = pdfRectTurnedBounds(edgesOf(turn.box), turn.rotation);\n const actual = edgesOf(data.rect);\n const far = (['left', 'bottom', 'right', 'top'] as const).filter(\n (edge) => Math.abs(actual[edge] - expected[edge]) > 0.01,\n );\n expect({ key: annotationKey(data.ref), far }).toEqual({\n key: annotationKey(data.ref),\n far: [],\n });\n }\n };\n\n const expectSameResources = (actual: AnnotationBundle, expected: AnnotationBundle) => {\n expect(Object.keys(actual.resources).sort()).toEqual(Object.keys(expected.resources).sort());\n for (const [id, bytes] of Object.entries(expected.resources)) {\n expect(sameBytes(actual.resources[id as keyof typeof actual.resources]!, bytes)).toBe(true);\n }\n };\n\n for (const fixture of opts.fixtures) {\n describe(fixture, () => {\n test('R1–R4: a restoring import exports as its source, as far as the import took it', async () => {\n await roundTrip(fixture, 'restore', async ({ bundle, result, again }) => {\n const taken = asTaken(bundle, result.dropped);\n expect(normalized(again, 'restore')).toEqual(normalized(taken, 'restore'));\n expectFramesHoldGeometry(again);\n expectTurnedRects(again);\n expectSameResources(again, taken);\n });\n });\n\n test('R1–R2: a stamping import does too, apart from the attribution and names it stamps', async () => {\n await roundTrip(fixture, 'stamp', async ({ bundle, result, again }) => {\n const taken = asTaken(bundle, result.dropped);\n for (const annotation of result.annotations) expect(annotation.nm).toMatch(UUID_V7);\n expect(normalized(again, 'stamp')).toEqual(normalized(taken, 'stamp'));\n expectFramesHoldGeometry(again);\n expectTurnedRects(again);\n expectSameResources(again, taken);\n });\n });\n\n test('R5: a stamp draws as its source, and in our own file every kind does', async () => {\n await roundTrip(fixture, 'restore', async ({ source, bundle, copy, result }) => {\n const copyOf = new Map(\n result.refMap.map(({ from, to }) => [annotationKey(from), to] as const),\n );\n for (const entry of bundle.pages) {\n const drawn = await appearanceRasters(source.page(entry.page));\n const copies = await appearanceRasters(copy.page(entry.page));\n for (const { data } of bundle.items) {\n if (data.ref.page.objectNumber !== entry.page.objectNumber) continue;\n if (fixture !== 'authoring' && data.subtype !== 'stamp') continue;\n const to = copyOf.get(annotationKey(data.ref));\n const original = drawn.get(annotationKey(data.ref));\n if (!to || !original) continue;\n const copied = copies.get(annotationKey(to));\n // The key rides along, so a failure names the annotation.\n const key = annotationKey(data.ref);\n expect({\n key,\n size: copied && [copied.width, copied.height],\n same: !!copied && maxShiftedDifference(copied, original) <= 3,\n }).toEqual({ key, size: [original.width, original.height], same: true });\n }\n }\n });\n });\n\n test('R7–R8: a second import names nothing twice and adds no drawing', async () => {\n await roundTrip(fixture, 'restore', async ({ bundle, copy, result, again, kept }) => {\n const taken = asTaken(bundle, result.dropped);\n const second = await copy.annotations.import(bundle);\n const conflicts = new Set(\n second.dropped\n .filter((drop) => drop.reason === 'name-conflict')\n .map((drop) => annotationKey(drop.ref)),\n );\n for (const { data } of taken.items) {\n if (data.nm) expect(conflicts.has(annotationKey(data.ref))).toBe(true);\n }\n expect(second.annotations.every((created) => created.nm === null)).toBe(true);\n const third = without(await copy.annotations.export(), kept);\n expect(Object.keys(third.resources).sort()).toEqual(\n Object.keys(again.resources).sort(),\n );\n });\n });\n });\n }\n });\n}\n\n/** Kinds whose data is points: the box is the frame of what is drawn. */\nconst FRAMED: ReadonlySet<string> = new Set([\n 'line',\n 'polyline',\n 'polygon',\n 'ink',\n 'highlight',\n 'underline',\n 'squiggly',\n 'strikeout',\n]);\n\n/** The points an annotation's data places on the page: its line, vertices, strokes or quads. */\nfunction geometryOf(data: Annotation): Array<{ x: number; y: number }> {\n // A turned line's, polygon's or ink's points are upright: the drawing turns them.\n const drawn = drawnPointsOf(data);\n if (drawn) return drawn.flat();\n const points: Array<{ x: number; y: number }> = [];\n const visit = (value: unknown) => {\n if (Array.isArray(value)) return value.forEach(visit);\n if (typeof value !== 'object' || value === null) return;\n const { x, y } = value as { x?: unknown; y?: unknown };\n if (typeof x === 'number' && typeof y === 'number') points.push({ x, y });\n else Object.values(value).forEach(visit);\n };\n const fields = data as unknown as Record<string, unknown>;\n for (const name of ['linePoints', 'vertices', 'inkList', 'quadPoints']) visit(fields[name]);\n return points;\n}\n\n/** A form field's widget: it stays with its field. */\nfunction isFieldWidget(annotation: Annotation): boolean {\n return annotation.subtype === 'widget' && annotation.field !== null;\n}\n\n/** A bundle without the items `keys` name, and without what only they named. */\nfunction without(bundle: AnnotationBundle, keys: ReadonlySet<string>): AnnotationBundle {\n const items = bundle.items.filter(({ data }) => !keys.has(annotationKey(data.ref)));\n return pruned({ ...bundle, items });\n}\n\n/** A bundle without the resources and pages no item names. */\nfunction pruned(bundle: AnnotationBundle): AnnotationBundle {\n const named = new Set(bundle.items.flatMap((item) => Object.values(item.resources)));\n const onPages = new Set(\n bundle.items.flatMap(({ data }) => [data.ref.page, ...pageRefsIn(data)].map(encodePageKey)),\n );\n return {\n ...bundle,\n pages: bundle.pages.filter((entry) => onPages.has(encodePageKey(entry.page))),\n resources: Object.fromEntries(\n Object.entries(bundle.resources).filter(([id]) => named.has(id as `sha256-${string}`)),\n ) as AnnotationBundle['resources'],\n };\n}\n\n/**\n * The bundle as the import took it. The items left\n * out go, a field left out reads `null`, and the resources and pages no item\n * still names go too.\n */\nfunction asTaken(bundle: AnnotationBundle, dropped: readonly AnnotationImportDrop[]) {\n const left = new Set(\n dropped.filter((drop) => !drop.field).map((drop) => annotationKey(drop.ref)),\n );\n const fields = new Map<string, string[]>();\n for (const { ref, field } of dropped) {\n if (field) fields.set(annotationKey(ref), [...(fields.get(annotationKey(ref)) ?? []), field]);\n }\n const items = bundle.items\n .filter(({ data }) => !left.has(annotationKey(data.ref)))\n .map((item) => {\n const cleared = fields.get(annotationKey(item.data.ref));\n if (!cleared) return item;\n const data = { ...item.data } as Record<string, unknown>;\n for (const field of cleared) data[field] = null;\n return { ...item, data: data as unknown as Annotation };\n });\n return pruned({ ...bundle, items });\n}\n\n/**\n * What two documents can agree on after import. Refs to\n * annotations become positions in the bundle, pages their position in the\n * source document; `importedBy` and `hasAppearance` (how the source stored it: an import draws its copies from\n * data) and a file's size and checksum (the bytes', which are compared by\n * their id) go, and in `stamp` mode the attribution it stamps.\n * A link's `activate` action is its `target`, compared there: a `/Dest`\n * and the `/A` a copy writes for it read the same target.\n */\n/** A box kind's turn: degrees clockwise about the middle of its own box. */\n/** A page box by its edges, for math that doesn't care which way y points. */\nconst edgesOf = (box: PageBox): PdfRect => ({\n left: box.x,\n bottom: box.y,\n right: box.x + box.width,\n top: box.y + box.height,\n});\n\nfunction turnOf(data: Annotation): { rotation: number; box: PageBox } | null {\n const { rotation, box } = data as { rotation?: number | null; box?: PageBox };\n return rotation && box ? { rotation, box } : null;\n}\n\nfunction normalized(bundle: AnnotationBundle, attribution: Attribution) {\n const position = new Map<string, number>();\n bundle.items.forEach(({ data }, at) => {\n const key = annotationKey(data.ref);\n if (!position.has(key)) position.set(key, at);\n });\n const at = (ref: AnnotationRef | null | undefined) =>\n ref ? (position.get(annotationKey(ref)) ?? null) : null;\n const pagePosition = new Map(\n bundle.pages.map((entry) => [encodePageKey(entry.page), entry.position]),\n );\n // A page ref sits under a `page` key (a field ref has the same shape).\n const pages = (value: unknown, key?: string): unknown => {\n if (typeof value !== 'object' || value === null) return value;\n if (Array.isArray(value)) return value.map((child) => pages(child));\n const record = value as Record<string, unknown>;\n if (key === 'page' && record.kind === 'objectNumber') {\n return { position: pagePosition.get(encodePageKey(record as unknown as PageRef)) };\n }\n return Object.fromEntries(\n Object.entries(record).map(([name, child]) => [name, pages(child, name)]),\n );\n };\n return {\n pages: bundle.pages.map(({ position, size }) => ({ position, size })),\n items: bundle.items.map(({ data, resources }) => {\n const {\n ref,\n importedBy: _importedBy,\n hasAppearance: _hasAppearance,\n popup,\n reply,\n ...rest\n } = data;\n const fields: Record<string, unknown> = {\n ...rest,\n ref: at(ref),\n popup: at(popup),\n reply: reply ? { ...reply, to: at(reply.to) } : reply,\n };\n if (data.subtype === 'popup') fields.parent = at(data.parent);\n // A copy is drawn from its data: where the data is points, the\n // box is the frame of what we draw, checked to contain the points\n // (`expectFramesHoldGeometry`); a note's or a file's icon fills its\n // `rect`, which is compared as data.\n if (FRAMED.has(data.subtype)) delete fields.rect;\n // A turned box's `rect` is the upright box around it, which the engine\n // works out (`expectTurnedRects`), not the number another app rounded.\n if (turnOf(data)) delete fields.rect;\n if (data.subtype === 'link' && data.actions) {\n const { activate: _activate, ...triggers } = data.actions;\n fields.actions = Object.keys(triggers).length > 0 ? triggers : null;\n }\n if (attribution === 'stamp') for (const field of STAMPED) delete fields[field];\n if (data.subtype === 'file-attachment' && data.file) {\n // A file's dates are facts about the file: they travel in either mode.\n const { size: _size, checksum: _checksum, ...file } = data.file;\n fields.file = file;\n }\n return { data: pages(fields), resources };\n }),\n };\n}\n\n/** Fill our own file: every kind a create makes, stamps sharing a drawing, a thread, a link. */\nasync function fill(doc: DocumentHandle): Promise<void> {\n const { pages } = await doc.pages.list();\n const pageRef = toPageRef(pages[0]!.ref.objectNumber);\n const page = doc.page(pageRef);\n const create = async (\n draft: Parameters<PageHandle['annotations']['create']>[0],\n resources?: Parameters<PageHandle['annotations']['create']>[1],\n ) => (await page.annotations.create(draft, resources)).annotation as Annotation;\n for (const { data, resources } of creatables()) await create(data, { resources });\n const box = (x: number): PageBox => ({ x, y: 300, width: 40, height: 30 });\n await create(\n { subtype: 'stamp', box: box(20), nm: 'approved' },\n { resources: { appearance: BANDS_PDF } },\n );\n await create(\n { subtype: 'stamp', box: box(80), opacity: 0.5 },\n { resources: { appearance: BANDS_PDF } },\n );\n const note = await create({\n subtype: 'text',\n rect: iconRect(box(140).x, box(140).y),\n nm: 'note',\n contents: 'Check',\n });\n await create({ subtype: 'popup', rect: box(200), parent: note.ref, open: true });\n await create({\n subtype: 'text',\n rect: iconRect(box(140).x, box(140).y),\n reply: { to: note.ref },\n });\n await create({\n subtype: 'link',\n rect: box(260),\n target: { kind: 'goto', destination: { kind: 'fit', page: pageRef } },\n });\n}\n","import type { ConformanceTestRunner } from './runMetadataConformance';\nimport type { Annotation } from '../annotation/kinds';\nimport type { DocumentHandle } from '../engine/DocumentHandle';\nimport type { Engine } from '../engine/Engine';\nimport { toPageRef } from '../identity/PageRef';\n\nexport interface DateConformanceOptions {\n label: string;\n /** Build a fresh engine for this suite. The suite tears it down at the end. */\n makeEngine: () => Promise<Engine> | Engine;\n /**\n * Open a fresh copy of `dates.pdf` (`packages/engine/main/test/fixtures`):\n * one page (object 3) whose squares carry known `/CreationDate` and `/M`\n * values, a file attachment annotation and an embedded file whose\n * `/Params` carry dates, and an Info dictionary with dates.\n */\n open: (engine: Engine) => Promise<DocumentHandle>;\n}\n\n/**\n * Dates on both engines: a PDF date reads as ISO 8601 with the offset it was\n * written with, a read written back is the same moment in the same zone, a\n * write takes the string or a `Date`, and a date that isn't one reads `null`.\n */\nexport function runDateConformance(\n runner: ConformanceTestRunner,\n opts: DateConformanceOptions,\n): void {\n const { describe, test, beforeAll, afterAll, expect } = runner;\n\n describe(`date conformance: ${opts.label}`, () => {\n let engine: Engine;\n\n beforeAll(async () => {\n engine = await opts.makeEngine();\n });\n\n afterAll(async () => {\n if (engine) await engine.destroy();\n });\n\n const withDocument = async (run: (doc: DocumentHandle) => Promise<void>) => {\n const doc = await opts.open(engine);\n try {\n await run(doc);\n } finally {\n await doc.close();\n }\n };\n\n const annotationsOf = async (doc: DocumentHandle) => {\n const { annotations } = await doc.page(toPageRef(3)).annotations.list();\n const byName = (nm: string): Annotation => {\n const found = annotations.find((annotation) => annotation.nm === nm);\n if (!found) throw new Error(`no annotation named ${nm}`);\n return found;\n };\n return byName;\n };\n\n test('an annotation reads its dates with the offset they were written with', async () => {\n await withDocument(async (doc) => {\n const byName = await annotationsOf(doc);\n expect(byName('dates-offset')).toMatchObject({\n createdAt: '2017-07-12T21:44:38-07:00',\n modifiedAt: '2017-07-13T09:15:00+05:30',\n });\n // No offset in the PDF, so none in the read; `Z` stays UTC.\n expect(byName('dates-local')).toMatchObject({\n createdAt: '2017-07-12T21:44:38',\n modifiedAt: '2017-07-12T21:44:38Z',\n });\n // Text that isn't a date reads null; a date with only a year takes the spec's defaults.\n expect(byName('dates-odd')).toMatchObject({\n createdAt: null,\n modifiedAt: '2017-01-01T00:00:00',\n });\n });\n });\n\n test('a read goes back into an update through JSON, and keeps its creation date', async () => {\n await withDocument(async (doc) => {\n const page = doc.page(toPageRef(3));\n const read = (await annotationsOf(doc))('dates-offset');\n const before = Date.now();\n const { annotation: updated } = await page.annotations.update(\n read.ref,\n JSON.parse(JSON.stringify(read)),\n );\n expect(updated.createdAt).toBe('2017-07-12T21:44:38-07:00');\n // The engine stamps the update itself, in UTC.\n expect(updated.modifiedAt).toMatch(/Z$/);\n expect(Date.parse(updated.modifiedAt!) >= Math.floor(before / 1000) * 1000).toBe(true);\n });\n });\n\n test('document metadata keeps offsets, and a write takes the string or a Date', async () => {\n await withDocument(async (doc) => {\n const read = await doc.metadata.get();\n expect(read.createdAt).toBe('2017-07-12T21:44:38-07:00');\n expect(read.modifiedAt).toBe('2019-02-03T04:05:06+09:00');\n\n await doc.metadata.update({ createdAt: '2020-01-02T03:04:05+05:30' });\n expect((await doc.metadata.get()).createdAt).toBe('2020-01-02T03:04:05+05:30');\n\n // A `Date` is an instant: written in UTC, whole seconds.\n await doc.metadata.update({ modifiedAt: new Date('2021-06-07T10:09:10.500+02:00') });\n expect((await doc.metadata.get()).modifiedAt).toBe('2021-06-07T08:09:10Z');\n\n // A read sent back through JSON writes the same dates.\n const current = await doc.metadata.get();\n const { createdAt, modifiedAt } = JSON.parse(JSON.stringify(current)) as typeof current;\n await doc.metadata.update({ createdAt, modifiedAt });\n expect(await doc.metadata.get()).toMatchObject({ createdAt, modifiedAt });\n\n await doc.metadata.update({ createdAt: null });\n expect((await doc.metadata.get()).createdAt).toBe(null);\n });\n });\n\n test('an attached file reads the dates of its /Params', async () => {\n await withDocument(async (doc) => {\n const file = (await annotationsOf(doc))('dates-file') as Annotation & {\n file: { createdAt?: string; modifiedAt?: string } | null;\n };\n expect(file.file).toMatchObject({\n createdAt: '2017-07-12T21:44:38-07:00',\n modifiedAt: '2018-01-01T12:00:00+01:00',\n });\n const [embedded] = (await doc.attachments.list()).attachments;\n expect(embedded).toMatchObject({\n name: 'a.txt',\n createdAt: '2017-07-12T21:44:38-07:00',\n modifiedAt: '2018-01-01T12:00:00+01:00',\n });\n });\n });\n });\n}\n","import { declarationOf } from '../annotation/kinds/declarations';\n\n/**\n * Compares annotation reads with their kind declarations. Each difference is\n * one line, `<field>: <problem> (<kinds>)`:\n *\n * - `missing`: the declaration has the field, the read doesn't;\n * - `invalid`: the read has a value the declaration doesn't accept;\n * - `undeclared`: the read has a field the declaration doesn't know.\n *\n * `<kinds>` is `every kind` when the difference holds for every kind read,\n * otherwise the affected subtypes. Lines are sorted, so two engines reading\n * the same documents produce the same list.\n */\nexport function annotationReadDriftOf(reads: readonly unknown[]): string[] {\n const kindsRead = new Set<string>();\n const kindsByProblem = new Map<string, Set<string>>();\n const note = (problem: string, subtype: string) => {\n const kinds = kindsByProblem.get(problem) ?? new Set<string>();\n kinds.add(subtype);\n kindsByProblem.set(problem, kinds);\n };\n\n for (const read of reads) {\n const record = read as Record<string, unknown>;\n const subtype = String(record.subtype);\n kindsRead.add(subtype);\n if (subtype === 'unsupported' && record.rawSubtypeName === 'Popup') {\n note('subtype: popup reads as unsupported', subtype);\n }\n const declaration = declarationOf(subtype);\n if (!declaration) {\n note('subtype: no declaration', subtype);\n continue;\n }\n for (const name of Object.keys(declaration.fields)) {\n if (!(name in record) || record[name] === undefined) {\n note(`${name}: missing`, subtype);\n continue;\n }\n // Reads are page space: each field as the page-space read schema has it.\n const schema = declaration.shapes.read[name]!;\n if (!schema.safeParse(record[name]).success) note(`${name}: invalid`, subtype);\n }\n for (const name of Object.keys(record)) {\n if (name !== 'subtype' && !(name in declaration.fields)) note(`${name}: undeclared`, subtype);\n }\n }\n\n return [...kindsByProblem]\n .map(([problem, kinds]) =>\n kinds.size === kindsRead.size\n ? `${problem} (every kind)`\n : `${problem} (${[...kinds].sort().join(', ')})`,\n )\n .sort();\n}\n","import { annotationReadDriftOf } from './annotationReadDrift';\nimport { creatables, iconRect, PNG_1X1 } from './creatables';\nimport type { ConformanceTestRunner } from './runMetadataConformance';\nimport { TWO_PAGE_PDF } from './stampFixtures';\nimport type { Annotation } from '../annotation/kinds';\nimport type { DocumentHandle } from '../engine/DocumentHandle';\nimport type { PageHandle } from '../engine/PageHandle';\nimport { EngineErrorCode } from '../errors/EngineErrorCode';\nimport type { AnnotationRef } from '../identity/AnnotationRef';\nimport { annotationKey } from '../identity/annotationKey';\nimport type { Engine } from '../engine/Engine';\nimport type { PageBox } from '../geometry/pageSpace';\nimport { EVERY_PERMISSION } from './fixtureScope';\n\nexport interface AnnotationDeclarationFixture {\n /** Stable id used for the local engine; cloud uses its own id. */\n id: string;\n /** Bytes for the local engine. */\n bytes: () => Uint8Array | Promise<Uint8Array>;\n /** Override the cloud-side id. Defaults to `id`. */\n cloudId?: string;\n}\n\nexport interface AnnotationDeclarationConformanceOptions {\n label: string;\n /** Build a fresh engine for this suite. The suite tears it down at the end. */\n makeEngine: () => Promise<Engine> | Engine;\n /** Engine 'kind' for opening: 'bytes' for local, 'id' for cloud. */\n openKind: 'bytes' | 'id';\n /**\n * A document without inline annotations. One annotation of every kind the\n * engine can create is added to its first page, then read back.\n */\n authoring: AnnotationDeclarationFixture;\n /** Documents whose annotations are read as they are. */\n documents: readonly AnnotationDeclarationFixture[];\n /** A document with a link whose target a write can't make (a script, a viewer command). */\n readOnlyLink: AnnotationDeclarationFixture;\n}\n\n/**\n * Every annotation both engines read, from real documents and freshly created\n * ones, is checked against its kind declaration.\n */\nexport function runAnnotationDeclarationConformance(\n runner: ConformanceTestRunner,\n opts: AnnotationDeclarationConformanceOptions,\n): void {\n const { describe, test, beforeAll, afterAll, expect } = runner;\n\n describe(`annotation declaration conformance: ${opts.label}`, () => {\n let engine: Engine;\n\n beforeAll(async () => {\n engine = await opts.makeEngine();\n });\n\n afterAll(async () => {\n if (engine) await engine.destroy();\n });\n\n test('every read matches its kind declaration', async () => {\n const reads: unknown[] = [];\n for (const fixture of opts.documents) {\n const doc = await openFixture(engine, opts, fixture);\n try {\n reads.push(...(await doc.annotations.list()).annotations);\n } finally {\n await doc.close();\n }\n }\n\n const doc = await openFixture(engine, opts, opts.authoring);\n try {\n const first = (await doc.annotations.list()).pages[0];\n expect(first !== undefined).toBe(true);\n const page = first!;\n for (const { data, resources } of creatables()) {\n const { annotation: created } = await doc\n .page(page)\n .annotations.create(data, { resources });\n reads.push(created);\n }\n reads.push(...(await doc.annotations.list({ pages: [page] })).annotations);\n } finally {\n await doc.close();\n }\n\n expect(annotationReadDriftOf(reads)).toEqual([]);\n });\n\n /** Open the authoring document and hand its first page to `run`. */\n const onAuthoringPage = async (\n run: (page: PageHandle, doc: DocumentHandle) => Promise<void>,\n ): Promise<void> => {\n const doc = await openFixture(engine, opts, opts.authoring);\n try {\n const first = (await doc.annotations.list()).pages[0]!;\n await run(doc.page(first), doc);\n } finally {\n await doc.close();\n }\n };\n\n test('shared fields follow the write rules on every kind', async () => {\n await onAuthoringPage(async (page) => {\n for (const { data, resources } of creatables()) {\n const { annotation: created } = await page.annotations.create(data, { resources });\n const read = async () =>\n (await page.annotations.list()).annotations.find(\n (annotation) => annotationKey(annotation.ref) === annotationKey(created.ref),\n ) as unknown as Record<string, unknown>;\n const text: [string, string, string][] = [['subject', 'Pricing', 'Terms']];\n // A free text box and a redaction paint their contents, so clearing them is not tested here.\n if (data.subtype !== 'free-text' && data.subtype !== 'redact') {\n text.push(['contents', 'First note', 'Second note']);\n }\n for (const [field, first, second] of text) {\n await page.annotations.update(created.ref, { [field]: first });\n expect((await read())[field]).toBe(first);\n await page.annotations.update(created.ref, {});\n expect((await read())[field]).toBe(first);\n await page.annotations.update(created.ref, { [field]: second });\n expect((await read())[field]).toBe(second);\n await page.annotations.update(created.ref, { [field]: null });\n expect((await read())[field]).toBe(null);\n }\n // Each flag is its own field: setting one leaves the others as they are.\n await page.annotations.update(created.ref, { hidden: true });\n await page.annotations.update(created.ref, { print: true });\n expect(await read()).toMatchObject({ hidden: true, print: true, locked: false });\n await page.annotations.update(created.ref, { hidden: false });\n expect(await read()).toMatchObject({ hidden: false, print: true });\n }\n });\n });\n\n test('a read sent back as an update changes nothing', async () => {\n await onAuthoringPage(async (page) => {\n for (const { data, resources } of creatables()) {\n const { annotation: created } = await page.annotations.create(data, { resources });\n const result = await page.annotations.update(created.ref, created as never);\n expect(result.appearance.changed).toBe(false);\n const { modifiedAt: _before, ...expected } = created;\n const { modifiedAt: _after, ...updated } = result.annotation;\n expect(updated).toEqual(expected);\n }\n });\n });\n\n test(\"a box kind's rect is worked out, and another one puts the box there\", async () => {\n await onAuthoringPage(async (page) => {\n const box: PageBox = { x: 300, y: 300, width: 60, height: 40 };\n // A create takes the box; a rect sent with it is the engine's to work out.\n const { annotation: created } = await page.annotations.create({\n subtype: 'square',\n box,\n rect: { x: 0, y: 0, width: 1, height: 1 },\n } as never);\n expect(created.rect).toEqual(box);\n // An update may send back the rect it read, with a new box or without.\n const moved = { ...box, x: box.x + 20 };\n const { annotation: updated } = await page.annotations.update(created.ref, {\n rect: created.rect,\n box: moved,\n });\n expect(updated.rect).toEqual(moved);\n // Another rect puts the box there: a square's rect is its box.\n const wider = { ...moved, width: moved.width + 10 };\n const { annotation: placed } = await page.annotations.update(created.ref, { rect: wider });\n expect(placed.subtype === 'square' && placed.box).toEqual(wider);\n // Another rect with another box is refused, naming the field.\n await expect(\n page.annotations.update(created.ref, { rect: moved, box: box }),\n ).rejects.toMatchObject({ code: EngineErrorCode.InvalidArg, details: { field: 'rect' } });\n });\n });\n\n test('an update takes its subtype from the annotation it targets', async () => {\n await onAuthoringPage(async (page) => {\n const { annotation: created } = await page.annotations.create(creatables()[0]!.data);\n const result = await page.annotations.update(created.ref, { contents: 'No subtype' });\n expect(result.annotation.contents).toBe('No subtype');\n await expect(\n page.annotations.update(created.ref, { subtype: 'square', contents: 'x' } as never),\n ).rejects.toMatchObject({ code: EngineErrorCode.InvalidArg });\n });\n });\n\n test('a field the kind does not declare is refused, and so is a new name', async () => {\n await onAuthoringPage(async (page) => {\n const square = creatables().find(({ data }) => data.subtype === 'square')!.data;\n await expect(\n page.annotations.create({ ...square, colour: '#000000' } as never),\n ).rejects.toMatchObject({ code: EngineErrorCode.InvalidArg });\n const { annotation: created } = await page.annotations.create({\n ...square,\n nm: 'declared-square',\n });\n await expect(\n page.annotations.update(created.ref, { quadPoints: [] } as never),\n ).rejects.toMatchObject({ code: EngineErrorCode.InvalidArg });\n const same = await page.annotations.update(created.ref, { nm: 'declared-square' });\n expect(same.annotation.nm).toBe('declared-square');\n await expect(\n page.annotations.update(created.ref, { nm: 'renamed-square' }),\n ).rejects.toMatchObject({ code: EngineErrorCode.InvalidArg });\n });\n });\n\n test('a popup links to its parent in both directions', async () => {\n await onAuthoringPage(async (page) => {\n const rect: PageBox = { x: 200, y: 200, width: 60, height: 40 };\n const note = (\n await page.annotations.create({ subtype: 'text', rect: iconRect(rect.x, rect.y) })\n ).annotation;\n const popup = (await page.annotations.create({ subtype: 'popup', rect, parent: note.ref }))\n .annotation;\n const find = async (ref: AnnotationRef) =>\n (await page.annotations.list()).annotations.find(\n (annotation) => annotationKey(annotation.ref) === annotationKey(ref),\n )!;\n expect(popup.subtype === 'popup' && popup.parent !== null).toBe(true);\n expect(annotationKey((await find(note.ref)).popup!)).toBe(annotationKey(popup.ref));\n // A popup shows an annotation: it can't be created or left without one.\n await expect(\n page.annotations.create({ subtype: 'popup', rect } as never),\n ).rejects.toMatchObject({ code: EngineErrorCode.InvalidArg, details: { field: 'parent' } });\n await expect(\n page.annotations.update(popup.ref, { parent: null } as never),\n ).rejects.toMatchObject({ code: EngineErrorCode.InvalidArg });\n // Deleting it on its own leaves the note, which stops naming it.\n await page.annotations.delete(popup.ref);\n expect((await find(note.ref)).popup).toBe(null);\n });\n });\n\n test(\"a popup's open state is read and written\", async () => {\n await onAuthoringPage(async (page) => {\n const rect: PageBox = { x: 200, y: 260, width: 60, height: 40 };\n const note = (\n await page.annotations.create({ subtype: 'text', rect: iconRect(rect.x, rect.y) })\n ).annotation;\n // A PDF that says nothing about /Open shows the window closed.\n const closed = (await page.annotations.create({ subtype: 'popup', rect, parent: note.ref }))\n .annotation;\n expect(closed.subtype === 'popup' && closed.open).toBe(false);\n const opened = await page.annotations.update(closed.ref, { open: true });\n expect(opened.annotation.subtype === 'popup' && opened.annotation.open).toBe(true);\n // An annotation has one popup: another note gets the next.\n const other = (\n await page.annotations.create({ subtype: 'text', rect: iconRect(rect.x, rect.y + 60) })\n ).annotation;\n const created = (\n await page.annotations.create({ subtype: 'popup', rect, parent: other.ref, open: true })\n ).annotation;\n expect(created.subtype === 'popup' && created.open).toBe(true);\n });\n });\n\n test('values are checked, not only names, with the field named', async () => {\n await onAuthoringPage(async (page) => {\n const rect: PageBox = { x: 300, y: 520, width: 60, height: 40 };\n const refused = (field: string) => ({\n code: EngineErrorCode.InvalidArg,\n details: { field },\n });\n await expect(\n page.annotations.create({ subtype: 'square', box: rect, color: 'red' }),\n ).rejects.toMatchObject(refused('color'));\n await expect(\n page.annotations.create({ subtype: 'square', box: rect, opacity: 1.5 }),\n ).rejects.toMatchObject(refused('opacity'));\n await expect(\n page.annotations.create({ subtype: 'square', box: rect, cloudyIntensity: 0 }),\n ).rejects.toMatchObject(refused('cloudyIntensity'));\n await expect(\n page.annotations.create({\n subtype: 'text',\n rect: iconRect(rect.x, rect.y),\n icon: 'dragon',\n } as never),\n ).rejects.toMatchObject(refused('icon'));\n await expect(\n page.annotations.create({\n subtype: 'free-text',\n box: rect,\n contents: 'x',\n verticalAlign: 'center',\n } as never),\n ).rejects.toMatchObject(refused('verticalAlign'));\n await expect(\n page.annotations.create({\n subtype: 'link',\n rect,\n target: { kind: 'javascript' },\n } as never),\n ).rejects.toMatchObject({ code: EngineErrorCode.InvalidArg });\n await expect(\n page.annotations.create(\n {\n subtype: 'file-attachment',\n rect: iconRect(rect.x, rect.y),\n file: { name: '' },\n },\n { resources: { file: new Uint8Array([1]) } },\n ),\n ).rejects.toMatchObject(refused('file.name'));\n const { annotation } = await page.annotations.create({ subtype: 'square', box: rect });\n await expect(\n page.annotations.update(annotation.ref, { opacity: -1 }),\n ).rejects.toMatchObject(refused('opacity'));\n // A refused value changes nothing.\n const after = (await page.annotations.list()).annotations.find(\n (read) => annotationKey(read.ref) === annotationKey(annotation.ref),\n );\n expect(after?.subtype === 'square' && after.opacity).toBe(1);\n });\n });\n\n test('opacity reads back as written', async () => {\n await onAuthoringPage(async (page) => {\n const rect: PageBox = { x: 300, y: 580, width: 60, height: 40 };\n const { annotation } = await page.annotations.create({\n subtype: 'square',\n box: rect,\n opacity: 0.5,\n });\n expect(annotation.subtype === 'square' && annotation.opacity).toBe(0.5);\n // Not only values a float holds exactly.\n const { annotation: updated } = await page.annotations.update(annotation.ref, {\n opacity: 0.3,\n });\n expect(updated.subtype === 'square' && updated.opacity).toBe(0.3);\n const { annotation: stamp } = await page.annotations.create(\n { subtype: 'stamp', box: rect, opacity: 0.75 },\n { resources: { appearance: PNG_1X1 } },\n );\n expect(stamp.subtype === 'stamp' && stamp.opacity).toBe(0.75);\n });\n });\n\n test('a new quad list replaces the old one, shorter or longer', async () => {\n await onAuthoringPage(async (page) => {\n const quad = (y: number) => ({\n upperLeft: { x: 40, y },\n upperRight: { x: 140, y },\n lowerLeft: { x: 40, y: y + 10 },\n lowerRight: { x: 140, y: y + 10 },\n });\n for (const subtype of ['highlight', 'redact'] as const) {\n const { annotation } = await page.annotations.create({\n subtype,\n quadPoints: [quad(600), quad(620)],\n } as never);\n const { annotation: fewer } = await page.annotations.update(annotation.ref, {\n quadPoints: [quad(640)],\n });\n const quads = (fewer as { quadPoints: unknown[] }).quadPoints;\n expect(quads.length).toBe(1);\n expect(fewer.rect).toMatchObject({ y: 640, height: 10 });\n }\n const { annotation } = await page.annotations.create({\n subtype: 'highlight',\n quadPoints: [quad(600)],\n });\n await expect(\n page.annotations.update(annotation.ref, { quadPoints: [] }),\n ).rejects.toMatchObject({\n code: EngineErrorCode.InvalidArg,\n details: { field: 'quadPoints' },\n });\n });\n });\n\n test(\"a redaction's box comes from its quads, and a mark needs one or the other\", async () => {\n await onAuthoringPage(async (page) => {\n const { annotation } = await page.annotations.create({\n subtype: 'redact',\n quadPoints: [\n {\n upperLeft: { x: 50, y: 520 },\n upperRight: { x: 150, y: 520 },\n lowerLeft: { x: 50, y: 500 },\n lowerRight: { x: 150, y: 500 },\n },\n ],\n });\n expect(annotation.rect).toMatchObject({ x: 50, y: 500, width: 100, height: 20 });\n await expect(page.annotations.create({ subtype: 'redact' } as never)).rejects.toMatchObject(\n {\n code: EngineErrorCode.InvalidArg,\n details: { field: 'rect' },\n },\n );\n });\n });\n\n test('a review state brings its model; a custom state needs one', async () => {\n await onAuthoringPage(async (page) => {\n const rect: PageBox = { x: 420, y: 520, width: 20, height: 20 };\n const { annotation } = await page.annotations.create({\n subtype: 'text',\n rect: iconRect(rect.x, rect.y),\n state: 'accepted',\n });\n expect(annotation.subtype === 'text' && annotation.stateModel).toBe('review');\n const { annotation: marked } = await page.annotations.update(annotation.ref, {\n state: 'marked',\n });\n expect(marked.subtype === 'text' && marked.stateModel).toBe('marked');\n await expect(\n page.annotations.create({\n subtype: 'text',\n rect: iconRect(rect.x, rect.y),\n state: 'escalated',\n }),\n ).rejects.toMatchObject({\n code: EngineErrorCode.InvalidArg,\n details: { field: 'stateModel' },\n });\n const { annotation: custom } = await page.annotations.create({\n subtype: 'text',\n rect: iconRect(rect.x, rect.y),\n state: 'escalated',\n stateModel: 'triage',\n });\n const { annotation: moved } = await page.annotations.update(custom.ref, {\n state: 'closed',\n });\n expect(moved.subtype === 'text' && moved.stateModel).toBe('triage');\n });\n });\n\n test('a line without a caption flag reads captionEnabled: null', async () => {\n await onAuthoringPage(async (page) => {\n const { annotation } = await page.annotations.create({\n subtype: 'line',\n linePoints: { start: { x: 40, y: 480 }, end: { x: 140, y: 480 } },\n } as never);\n expect(annotation.subtype === 'line' && annotation.captionEnabled).toBe(null);\n const { annotation: flagged } = await page.annotations.update(annotation.ref, {\n captionEnabled: true,\n });\n expect(flagged.subtype === 'line' && flagged.captionEnabled).toBe(true);\n const { annotation: cleared } = await page.annotations.update(annotation.ref, {\n captionEnabled: null,\n });\n expect(cleared.subtype === 'line' && cleared.captionEnabled).toBe(null);\n });\n });\n\n test('a stamp takes a one-page PDF', async () => {\n await onAuthoringPage(async (page) => {\n const rect: PageBox = { x: 420, y: 460, width: 60, height: 40 };\n await expect(\n page.annotations.create(\n { subtype: 'stamp', box: rect },\n { resources: { appearance: TWO_PAGE_PDF } },\n ),\n ).rejects.toMatchObject({ code: EngineErrorCode.InvalidArg });\n });\n });\n\n test('an annotation born inline exports by its baseIndex name', async () => {\n for (const fixture of opts.documents) {\n const doc = await openFixture(engine, opts, fixture);\n try {\n const inline = (await doc.annotations.list()).annotations.find(\n (annotation) => annotation.ref.kind === 'baseIndex',\n );\n if (!inline) continue;\n const bundle = await doc.annotations.export({ refs: [inline.ref] });\n expect(bundle.items.map((item) => item.data.subtype)).toEqual([inline.subtype]);\n return;\n } finally {\n await doc.close();\n }\n }\n throw new Error('no fixture document has an annotation born inline');\n });\n\n test('a link read back can be sent back; its read-only target is kept', async () => {\n const doc = await openFixture(engine, opts, opts.readOnlyLink);\n try {\n const link = (await doc.annotations.list()).annotations.find(\n (annotation) =>\n annotation.subtype === 'link' &&\n annotation.target !== null &&\n annotation.target.kind !== 'goto' &&\n annotation.target.kind !== 'uri',\n ) as Extract<Annotation, { subtype: 'link' }> | undefined;\n expect(link !== undefined).toBe(true);\n const page = doc.page(link!.ref.page);\n const sentBack = await page.annotations.update(link!.ref, {\n ...link!,\n contents: 'Sent back',\n } as never);\n expect(sentBack.annotation.subtype === 'link' && sentBack.annotation.target).toEqual(\n link!.target,\n );\n await expect(\n // Another app's own verb is read, not written (the four page verbs are).\n page.annotations.update(link!.ref, {\n target: { kind: 'named', name: 'GoBack' },\n } as never),\n ).rejects.toMatchObject({ code: EngineErrorCode.InvalidArg, details: { field: 'target' } });\n } finally {\n await doc.close();\n }\n });\n\n test('deleting a note deletes its thread and popups, in one change', async () => {\n await onAuthoringPage(async (page, doc) => {\n const rect: PageBox = { x: 460, y: 300, width: 20, height: 20 };\n const find = async (ref: AnnotationRef) =>\n (await page.annotations.list()).annotations.find(\n (annotation) => annotationKey(annotation.ref) === annotationKey(ref),\n );\n const create = async (data: object) =>\n (await page.annotations.create(data as never)).annotation;\n const note = await create({\n subtype: 'text',\n rect: iconRect(rect.x, rect.y),\n contents: 'Note',\n });\n const notePopup = await create({ subtype: 'popup', rect, parent: note.ref });\n const reply = await create({\n subtype: 'text',\n rect: iconRect(rect.x, rect.y),\n contents: 'Reply',\n reply: { to: note.ref },\n });\n const replyPopup = await create({ subtype: 'popup', rect, parent: reply.ref });\n const nested = await create({\n subtype: 'text',\n rect: iconRect(rect.x, rect.y),\n contents: 'Nested',\n reply: { to: reply.ref },\n });\n const status = await create({\n subtype: 'text',\n rect: iconRect(rect.x, rect.y),\n state: 'accepted',\n reply: { to: note.ref },\n });\n const bystander = await create({\n subtype: 'text',\n rect: iconRect(rect.x, rect.y),\n contents: 'Unrelated',\n });\n\n // A reply takes the replies under it, and its popup; the note stays.\n const replyDelete = await page.annotations.delete(reply.ref);\n expect(replyDelete.meta.changed.length).toBe(3);\n expect(await find(reply.ref)).toBe(undefined);\n expect(await find(nested.ref)).toBe(undefined);\n expect(await find(replyPopup.ref)).toBe(undefined);\n expect((await find(note.ref)) !== undefined).toBe(true);\n\n const deleted: unknown[][] = [];\n const stop = doc.events.on('annotations.deleted', (event) => {\n deleted.push(event.deleted);\n });\n try {\n const { meta } = await page.annotations.delete(note.ref);\n expect(meta.changed.length).toBe(3);\n expect(meta.changed[0]).toMatchObject({ kind: 'objectNumber' });\n expect(deleted).toEqual([meta.changed]);\n } finally {\n stop();\n }\n for (const gone of [note, notePopup, status]) expect(await find(gone.ref)).toBe(undefined);\n expect((await find(bystander.ref)) !== undefined).toBe(true);\n });\n });\n\n test('a resource belongs to the kinds that take it', async () => {\n await onAuthoringPage(async (page) => {\n const rect: PageBox = { x: 300, y: 300, width: 60, height: 40 };\n const refused = { code: EngineErrorCode.InvalidArg };\n await expect(\n page.annotations.create({ subtype: 'stamp', box: rect }),\n ).rejects.toMatchObject(refused);\n await expect(\n page.annotations.create({\n subtype: 'file-attachment',\n rect: iconRect(rect.x, rect.y),\n file: { name: 'a.txt' },\n }),\n ).rejects.toMatchObject(refused);\n await expect(\n page.annotations.create(\n { subtype: 'square', box: rect },\n { resources: { appearance: PNG_1X1 } },\n ),\n ).rejects.toMatchObject(refused);\n await expect(\n page.annotations.create(\n { subtype: 'stamp', box: rect },\n { resources: { appearance: new TextEncoder().encode('not an image') } },\n ),\n ).rejects.toMatchObject(refused);\n const { annotation: created } = await page.annotations.create(\n { subtype: 'stamp', box: rect },\n { resources: { appearance: PNG_1X1 } },\n );\n await expect(\n page.annotations.update(created.ref, {}, { resources: { file: new Uint8Array([1]) } }),\n ).rejects.toMatchObject(refused);\n });\n });\n\n test(\"a new appearance replaces a stamp's drawing and keeps its data\", async () => {\n await onAuthoringPage(async (page) => {\n const rect: PageBox = { x: 300, y: 400, width: 60, height: 40 };\n const { annotation: created } = await page.annotations.create(\n { subtype: 'stamp', box: rect, name: 'Approved' },\n { resources: { appearance: PNG_1X1 } },\n );\n const result = await page.annotations.update(\n created.ref,\n {},\n { resources: { appearance: PNG_1X1 } },\n );\n expect(result.appearance.changed).toBe(true);\n const { modifiedAt: _before, ...expected } = created;\n const { modifiedAt: _after, ...updated } = result.annotation;\n expect(updated).toEqual(expected);\n });\n });\n\n test(\"a stamp's fit is recorded, and a new box is filled the same way\", async () => {\n await onAuthoringPage(async (page) => {\n const rect: PageBox = { x: 300, y: 460, width: 60, height: 40 };\n const fitOf = (dto: { subtype: string }) => (dto as { fit?: unknown }).fit;\n const plain = await page.annotations.create(\n { subtype: 'stamp', box: rect },\n { resources: { appearance: PNG_1X1 } },\n );\n expect(fitOf(plain.annotation)).toBe('contain');\n const { annotation: created } = await page.annotations.create(\n { subtype: 'stamp', box: rect, fit: 'cover' },\n { resources: { appearance: PNG_1X1 } },\n );\n expect(fitOf(created)).toBe('cover');\n const moved = await page.annotations.update(created.ref, {\n box: { ...rect, width: rect.width + 40 },\n });\n expect(fitOf(moved.annotation)).toBe('cover');\n const refit = await page.annotations.update(created.ref, { fit: 'fill' });\n expect(fitOf(refit.annotation)).toBe('fill');\n expect(refit.appearance.changed).toBe(true);\n const forgotten = await page.annotations.update(created.ref, { fit: null });\n expect(fitOf(forgotten.annotation)).toBe(null);\n });\n });\n\n test('an attached file is renamed by its data and replaced by its resource', async () => {\n await onAuthoringPage(async (page) => {\n const attachment = creatables().find(({ data }) => data.subtype === 'file-attachment')!;\n const { annotation: created } = await page.annotations.create(attachment.data, {\n resources: attachment.resources,\n });\n const fileOf = (dto: { subtype: string }) =>\n (dto as { file?: { name: string; size?: number; checksum?: string } | null }).file;\n const original = fileOf(created)!;\n\n // The value replaces all of the metadata: leaving the description out removes it.\n const renamed = await page.annotations.update(created.ref, {\n file: { ...original, name: 'renamed.txt', description: null },\n });\n expect(renamed.appearance.changed).toBe(false);\n expect(fileOf(renamed.annotation)).toEqual({\n name: 'renamed.txt',\n mimeType: 'text/plain',\n description: null,\n size: original.size,\n checksum: original.checksum,\n createdAt: (original as { createdAt?: string }).createdAt,\n modifiedAt: (original as { modifiedAt?: string }).modifiedAt,\n });\n\n const bytes = new TextEncoder().encode('replaced bytes');\n const replaced = await page.annotations.update(\n created.ref,\n {},\n { resources: { file: bytes } },\n );\n expect(fileOf(replaced.annotation)).toMatchObject({\n name: 'renamed.txt',\n mimeType: 'text/plain',\n size: bytes.byteLength,\n });\n const read = await page.annotations.downloadResource(created.ref, 'file');\n expect(new TextDecoder().decode(read)).toBe('replaced bytes');\n });\n });\n });\n}\n\nasync function openFixture(\n engine: Engine,\n opts: AnnotationDeclarationConformanceOptions,\n fixture: AnnotationDeclarationFixture,\n): Promise<DocumentHandle> {\n if (opts.openKind === 'bytes') {\n return engine.open(\n { kind: 'bytes', id: fixture.id, bytes: await fixture.bytes() },\n EVERY_PERMISSION,\n );\n }\n return engine.open({ kind: 'id', id: fixture.cloudId ?? fixture.id });\n}\n","import type {\n ConformanceFixture,\n ConformanceOptions,\n ConformanceTestRunner,\n} from './runMetadataConformance';\nimport type { DocumentHandle } from '../engine/DocumentHandle';\nimport type { Engine } from '../engine/Engine';\nimport { EngineErrorCode } from '../errors/EngineErrorCode';\nimport type { DocumentEvent } from '../events/DocumentEvent';\nimport { formEffectOps } from '../forms/effects';\nimport type { FormFieldDTO } from '../forms/field';\nimport type { AnnotationRef } from '../identity/AnnotationRef';\nimport { annotationKey } from '../identity/annotationKey';\nimport { toFieldRef } from '../identity/FormFieldRef';\nimport { toPageRef } from '../identity/PageRef';\nimport {\n FormRepairResultSchema,\n FormResetResultSchema,\n FormSetValueResultSchema,\n FormWidgetLinkResultSchema,\n FormWidgetsReorderResultSchema,\n} from '../wire/schemas';\nimport { FormSnapshotSchema } from '../forms/schema';\nimport { EVERY_PERMISSION } from './fixtureScope';\n\n/**\n * The three fixtures the forms suite needs. Shapes (names, object numbers,\n * values) match the pdf-runtime fork's test resources:\n *\n * - `toggleFields` — toggle_fields.pdf: text field `maxlen_text`\n * (/MaxLen 5, value \"abc\"), radio `ntto_radio` (NoToggleToOff, /DV x,\n * widgets x/y), radio `unison_radio` (RadiosInUnison), checkbox\n * `opt_check` (/Opt \"Alpha\", on-state \"On\"), hierarchical text field\n * `billing.name`.\n * - `orphanWidgets` — orphan_widgets.pdf: `linked_text` in /AcroForm\n * /Fields plus recovered `orphan_check` and `orphan_radio`.\n * - `choiceFields` — listbox_form.pdf: `Listbox_MultiSelect` (options\n * Apple..), `Listbox_SingleSelect`.\n */\nexport interface FormConformanceFixtures {\n /** toggle_fields.pdf; `pageObjectNumber` = its single page (object 3). */\n toggleFields: ConformanceFixture & { pageObjectNumber: number };\n orphanWidgets: ConformanceFixture;\n choiceFields: ConformanceFixture;\n /**\n * A second, independent copy of `toggleFields` used as the XFDF import\n * target. Required for `openKind: 'id'` (cloud) — id-opened documents are\n * server-side state, so the suite cannot mint a copy by re-opening the\n * same bytes under a suffixed id the way the bytes transport does.\n */\n importTarget?: ConformanceFixture;\n /**\n * Another independent copy of `toggleFields`, whose merged field/widgets\n * the delete test removes. Required for `openKind: 'id'` (cloud): the\n * deletes are durable server state the other tests must not see.\n */\n deleteTarget?: ConformanceFixture;\n}\n\nexport interface FormConformanceOptions extends Omit<ConformanceOptions, 'fixture'> {\n fixtures: FormConformanceFixtures;\n}\n\nexport function runFormConformance(\n runner: ConformanceTestRunner,\n opts: FormConformanceOptions,\n): void {\n const { describe, test, beforeAll, afterAll, expect } = runner;\n\n describe(`forms conformance: ${opts.label}`, () => {\n let engine: Engine;\n\n beforeAll(async () => {\n engine = await opts.makeEngine();\n });\n\n afterAll(async () => {\n await engine.destroy();\n });\n\n async function open(fixture: ConformanceFixture, idSuffix = ''): Promise<DocumentHandle> {\n if (opts.openKind === 'bytes') {\n const bytes = await fixture.bytes();\n return engine.open({ kind: 'bytes', id: fixture.id + idSuffix, bytes }, EVERY_PERMISSION);\n }\n return engine.open({ kind: 'id', id: fixture.cloudId ?? fixture.id });\n }\n\n function fieldByName(fields: FormFieldDTO[], name: string): FormFieldDTO {\n const field = fields.find((f) => f.name === name);\n expect(Boolean(field)).toBe(true);\n return field!;\n }\n\n test('lists the reconciled field tree with per-family DTOs', async () => {\n const doc = await open(opts.fixtures.toggleFields);\n try {\n const snapshot = await doc.forms.list();\n // Wire parity: the snapshot must survive its own schema.\n FormSnapshotSchema.parse(snapshot);\n expect(snapshot.formKind).toBe('acroform');\n\n const text = fieldByName(snapshot.fields, 'maxlen_text');\n if (text.family !== 'text') throw new Error('expected text family');\n expect(text.value).toBe('abc');\n expect(text.valueEntry).toEqual({ kind: 'scalar', value: 'abc' });\n expect(text.defaultValueEntry).toEqual({ kind: 'none' });\n expect(text.maxLength).toBe(5);\n expect(text.widgets.length).toBe(1);\n\n const radio = fieldByName(snapshot.fields, 'ntto_radio');\n if (radio.family !== 'radio') throw new Error('expected radio family');\n expect(radio.noToggleToOff).toBe(true);\n expect(radio.value).toBe('x');\n expect(radio.valueEntry).toEqual({ kind: 'scalar', value: 'x' });\n expect(radio.defaultValueEntry).toEqual({ kind: 'scalar', value: 'x' });\n expect(radio.widgets.map((w) => w.onState)).toEqual(['x', 'y']);\n expect(radio.widgets.map((w) => w.checked)).toEqual([true, false]);\n\n const unison = fieldByName(snapshot.fields, 'unison_radio');\n if (unison.family !== 'radio') throw new Error('expected radio family');\n expect(unison.radiosInUnison).toBe(true);\n\n const check = fieldByName(snapshot.fields, 'opt_check');\n if (check.family !== 'checkbox') throw new Error('expected checkbox family');\n expect(check.checked).toBe(false);\n expect(check.exportValue).toBe('Alpha');\n\n // Hierarchical fields surface under their fully qualified name.\n const nested = fieldByName(snapshot.fields, 'billing.name');\n expect(nested.family).toBe('text');\n expect(snapshot.calculationOrder).toEqual([]);\n } finally {\n await doc.close();\n }\n });\n\n test('writes text values and truncates to /MaxLen', async () => {\n const doc = await open(opts.fixtures.toggleFields);\n try {\n const result = await doc.forms.setValue(\n { kind: 'fqn', name: 'maxlen_text' },\n { value: 'abcde' },\n );\n FormSetValueResultSchema.parse(result);\n expect(result.field.family).toBe('text');\n if (result.field.family === 'text') expect(result.field.value).toBe('abcde');\n expect(result.meta.changedWidgets.length).toBe(1);\n // The meta names the field and the page its repainted widget is on.\n expect(result.meta.changedFields).toEqual([result.field.ref]);\n expect(result.meta.affectedPages).toEqual([result.meta.changedWidgets[0]!.page]);\n\n const truncated = await doc.forms.setValue(\n { kind: 'fqn', name: 'maxlen_text' },\n { value: 'abcdef' },\n );\n if (truncated.field.family !== 'text') throw new Error('expected text family');\n expect(truncated.field.value).toBe('abcde');\n expect(truncated.meta.changedWidgets).toHaveLength(0);\n\n // Re-read through the (invalidated) snapshot: the write is visible.\n const after = await doc.forms.get({ kind: 'fqn', name: 'maxlen_text' });\n if (after.family === 'text') expect(after.value).toBe('abcde');\n } finally {\n await doc.close();\n }\n });\n\n test('toggles radio groups and honors NoToggleToOff', async () => {\n const doc = await open(opts.fixtures.toggleFields);\n try {\n const radioRef = { kind: 'fqn', name: 'ntto_radio' } as const;\n const result = await doc.forms.setValue(radioRef, { value: 'y' });\n if (result.field.family !== 'radio') throw new Error('expected radio family');\n expect(result.field.value).toBe('y');\n expect(result.field.widgets.map((w) => w.checked)).toEqual([false, true]);\n expect(result.meta.changedWidgets.length).toBe(2); // x -> Off, y -> on\n\n // Clearing a NoToggleToOff group is a validation error.\n await expect(doc.forms.setValue(radioRef, { value: null })).rejects.toMatchObject({\n code: EngineErrorCode.InvalidArg,\n });\n // A value no button exports is refused.\n await expect(doc.forms.setValue(radioRef, { value: 'z' })).rejects.toMatchObject({\n code: EngineErrorCode.InvalidArg,\n });\n\n // Checkbox with /Opt: written and read by its export value, not its on-state name.\n const optCheck = { kind: 'fqn', name: 'opt_check' } as const;\n await expect(doc.forms.setValue(optCheck, { value: 'On' })).rejects.toMatchObject({\n code: EngineErrorCode.InvalidArg,\n });\n const byValue = await doc.forms.setValue(optCheck, { value: 'Alpha' });\n if (byValue.field.family !== 'checkbox') throw new Error('expected checkbox family');\n expect(byValue.field.checked).toBe(true);\n const cleared = await doc.forms.setValue(optCheck, { checked: false });\n if (cleared.field.family !== 'checkbox') throw new Error('expected checkbox family');\n expect(cleared.field.checked).toBe(false);\n const check = await doc.forms.setValue(optCheck, { checked: true });\n if (check.field.family !== 'checkbox') throw new Error('expected checkbox family');\n expect(check.field.checked).toBe(true);\n expect(check.field.exportValue).toBe('Alpha');\n } finally {\n await doc.close();\n }\n });\n\n test('rejects family/value mismatches without touching the field', async () => {\n const doc = await open(opts.fixtures.toggleFields);\n try {\n // Compare against the current value, not the fixture seed: on\n // transports with durable server state (cloud), earlier tests'\n // legitimate writes persist. The invariant under test is that a\n // rejected write changes nothing.\n const before = await doc.forms.get({ kind: 'fqn', name: 'maxlen_text' });\n if (before.family !== 'text') throw new Error('expected text family');\n await expect(\n doc.forms.setValue({ kind: 'fqn', name: 'maxlen_text' }, { checked: true }),\n ).rejects.toMatchObject({ code: EngineErrorCode.InvalidArg });\n const field = await doc.forms.get({ kind: 'fqn', name: 'maxlen_text' });\n if (field.family === 'text') expect(field.value).toBe(before.value);\n } finally {\n await doc.close();\n }\n });\n\n test(\"a script run's effects are one change: all of it, or none of it\", async () => {\n const doc = await open(opts.fixtures.toggleFields);\n try {\n const events: Extract<DocumentEvent, { type: 'forms.valueSet' }>[] = [];\n const unsubscribe = doc.events.subscribe((event) => {\n if (event.type === 'forms.valueSet') events.push(event);\n });\n const text = { kind: 'fqn', name: 'maxlen_text' } as const;\n const before = await doc.forms.get(text);\n // One effect names a field the form doesn't have: nothing is written.\n const refusal = await doc\n .apply({\n ops: formEffectOps([\n { kind: 'setValue', ref: text, value: { value: 'abcdef' } },\n {\n kind: 'setValue',\n ref: { kind: 'fqn', name: 'missing.effect.field' },\n value: { value: 'ignored' },\n },\n ]),\n })\n .then(\n () => null,\n (error: unknown) => error,\n );\n expect(refusal === null).toBe(false);\n const untouched = await doc.forms.get(text);\n if (untouched.family === 'text' && before.family === 'text') {\n expect(untouched.value).toBe(before.value);\n }\n expect(events).toHaveLength(0);\n\n // Every effect in order, as one change: the last value wins, cut to the length.\n const result = await doc.apply({\n ops: formEffectOps([\n { kind: 'setValue', ref: text, value: { value: 'abcdef' } },\n { kind: 'setValue', ref: text, value: { value: 'xyz' } },\n ]),\n });\n expect(result.items.map((item) => item.type)).toEqual(['forms.setValue', 'forms.setValue']);\n const after = await doc.forms.get(text);\n if (after.family !== 'text') throw new Error('expected text family');\n expect(after.value).toBe('xyz');\n // One burst: the change's events share its opId.\n expect(new Set(events.map((event) => event.origin.tx?.id))).toEqual(\n new Set([result.meta.opId]),\n );\n unsubscribe();\n } finally {\n await doc.close();\n }\n });\n\n test('a value, reset or display that changes nothing has nothing to undo', async () => {\n const doc = await open(opts.fixtures.toggleFields);\n try {\n const text = { kind: 'fqn', name: 'maxlen_text' } as const;\n const fill = {\n ops: formEffectOps([{ kind: 'setValue', ref: text, value: { value: 'abc' } }]),\n };\n const hide = { ops: formEffectOps([{ kind: 'setDisplay', ref: text, display: 'hidden' }]) };\n const reset = { ops: formEffectOps([{ kind: 'reset', refs: [text] }]) };\n await doc.forms.setValue(text, { value: 'xyz' });\n\n expect((await doc.apply(fill)).meta.undoable).toBe(true);\n expect((await doc.apply(hide)).meta.undoable).toBe(true);\n expect((await doc.apply(reset)).meta.undoable).toBe(true);\n // The value it holds, already hidden, already at its default: the\n // same change again writes nothing.\n await doc.forms.setValue(text, { value: 'abc' });\n expect((await doc.apply(fill)).meta.undoable).toBe(false);\n expect((await doc.apply(hide)).meta.undoable).toBe(false);\n await doc.apply(reset);\n expect((await doc.apply(reset)).meta.undoable).toBe(false);\n } finally {\n await doc.close();\n }\n });\n\n test('selects multi-select list box options by export value', async () => {\n const doc = await open(opts.fixtures.choiceFields);\n try {\n const multiRef = { kind: 'fqn', name: 'Listbox_MultiSelect' } as const;\n const result = await doc.forms.setValue(multiRef, { selectedValues: ['Cherry', 'Apple'] });\n if (result.field.family !== 'listbox') throw new Error('expected listbox family');\n // Option order, not input order.\n expect(result.field.selectedValues).toEqual(['Apple', 'Cherry']);\n expect(result.field.valueEntry.kind).toBe('array');\n\n // Multiple values on a single-select list box is a validation error.\n await expect(\n doc.forms.setValue(\n { kind: 'fqn', name: 'Listbox_SingleSelect' },\n { selectedValues: ['foo', 'bar'] },\n ),\n ).rejects.toMatchObject({ code: EngineErrorCode.InvalidArg });\n } finally {\n await doc.close();\n }\n });\n\n test('reset restores /DV or clears the value, and reports only the fields it changed', async () => {\n const doc = await open(opts.fixtures.toggleFields);\n try {\n const radioRef = toFieldRef('ntto_radio');\n const textRef = toFieldRef('maxlen_text');\n // ntto_radio carries /DV x.\n await doc.forms.setValue(radioRef, { value: 'y' });\n const radio = await doc.forms.reset(radioRef);\n FormResetResultSchema.parse(radio);\n expect(radio.fields.map((field) => field.name)).toEqual(['ntto_radio']);\n const [restored] = radio.fields;\n if (restored?.family === 'radio') expect(restored.value).toBe('x');\n expect(radio.meta.changedFields).toEqual([restored!.ref]);\n\n // maxlen_text has no /DV: reset clears. The radio is already at its\n // default, so it is left out of the result.\n await doc.forms.setValue(textRef, { value: 'zzz' });\n const events: DocumentEvent[] = [];\n const unsubscribe = doc.events.subscribe((event) => {\n if (event.type.startsWith('forms.')) events.push(event);\n });\n const both = await doc.forms.reset([radioRef, textRef]);\n unsubscribe();\n expect(both.fields.map((field) => field.name)).toEqual(['maxlen_text']);\n const [text] = both.fields;\n if (text?.family === 'text') expect(text.value).toBe('');\n expect(events.map((event) => event.type)).toEqual(['forms.valueSet']);\n\n // Nothing left to restore: no fields, no widgets.\n const again = await doc.forms.reset([radioRef, textRef]);\n expect(again.fields).toEqual([]);\n expect(again.meta.changedWidgets).toEqual([]);\n\n // An unknown field is refused.\n await expect(doc.forms.reset(toFieldRef('no.such.field'))).rejects.toMatchObject({\n code: EngineErrorCode.NotFound,\n });\n } finally {\n await doc.close();\n }\n });\n\n test('reset without refs resets the whole form as one change', async () => {\n const doc = await open(opts.fixtures.toggleFields);\n try {\n await doc.forms.setValue(toFieldRef('ntto_radio'), { value: 'y' });\n await doc.forms.setValue(toFieldRef('billing.name'), { value: 'Ada' });\n const events: Extract<DocumentEvent, { type: 'forms.valueSet' }>[] = [];\n const unsubscribe = doc.events.subscribe((event) => {\n if (event.type === 'forms.valueSet') events.push(event);\n });\n const result = await doc.forms.reset();\n unsubscribe();\n const names = result.fields.map((field) => field.name);\n expect(names).toContain('ntto_radio');\n expect(names).toContain('billing.name');\n // One event per changed field, all in one transaction.\n expect(events.length).toBe(result.fields.length);\n const txIds = new Set(events.map((event) => event.origin.tx?.id));\n expect(txIds.size).toBe(1);\n expect(events.map((event) => event.origin.tx?.index)).toEqual(events.map((_, i) => i));\n expect(events.every((event) => event.origin.tx?.count === events.length)).toBe(true);\n const after = await doc.forms.list();\n const radio = after.fields.find((field) => field.name === 'ntto_radio');\n if (radio?.family === 'radio') expect(radio.value).toBe('x');\n } finally {\n await doc.close();\n }\n });\n\n test('emits form events on mutations', async () => {\n const doc = await open(opts.fixtures.toggleFields);\n try {\n const events: DocumentEvent[] = [];\n const unsubscribe = doc.events.subscribe((event) => {\n if (event.type.startsWith('forms.')) events.push(event);\n });\n await doc.forms.setValue({ kind: 'fqn', name: 'maxlen_text' }, { value: 'ok' });\n unsubscribe();\n expect(events.length).toBe(1);\n expect(events[0]!.type).toBe('forms.valueSet');\n } finally {\n await doc.close();\n }\n });\n\n test('repair makes recovered fields durable and is idempotent', async () => {\n const doc = await open(opts.fixtures.orphanWidgets);\n try {\n const before = await doc.forms.list();\n expect(before.fields.length).toBe(3);\n expect(before.fields.filter((f) => f.origin === 'recovered').length).toBe(2);\n\n const repair = await doc.forms.repair();\n FormRepairResultSchema.parse(repair);\n expect(repair.fieldsLinked).toBe(2);\n expect(repair.acroformCreated).toBe(false);\n expect(repair.fieldsUnrepairable).toBe(0);\n\n const after = await doc.forms.list();\n expect(after.fields.every((f) => f.origin === 'acroform')).toBe(true);\n\n const again = await doc.forms.repair();\n expect(again.fieldsLinked).toBe(0);\n expect(again.widgetsLinked).toBe(0);\n } finally {\n await doc.close();\n }\n });\n\n test('widgets live the full form loop', async () => {\n const doc = await open(opts.fixtures.toggleFields);\n const pageRef = toPageRef(opts.fixtures.toggleFields.pageObjectNumber);\n const page = doc.page(pageRef);\n try {\n // 1. A field gets a widget where its placement says, styled with the house vocabulary.\n const field = await doc.forms.create({ family: 'text', name: 'loop_field' });\n expect(field.field.widgets).toEqual([]);\n const rect = { x: 20, y: 20, width: 180, height: 24 };\n const added = await doc.forms.addWidget(field.field.ref, {\n page: pageRef,\n rect,\n interiorColor: '#f6f8fa',\n color: '#1f6feb',\n strokeWidth: 1,\n fontSize: 10,\n });\n FormWidgetLinkResultSchema.parse(added);\n expect(added.widgets.map((widget) => widget.rect)).toEqual([rect]);\n expect(added.meta.changedWidgets.length).toBe(1);\n const widgetRef = added.field.widgets[0]?.ref;\n if (widgetRef?.kind !== 'objectNumber') throw new Error('expected durable ref');\n\n // 2. The form holds its row, joined to its field; the annotations never do.\n const widgetRow = (await doc.forms.list()).widgets.find(\n (w) => annotationKey(w.ref) === annotationKey(widgetRef),\n );\n if (!widgetRow) throw new Error('expected a widget row');\n expect(widgetRow.field).toEqual(field.field.ref);\n expect(widgetRow.fieldFamily).toBe('text');\n expect(widgetRow.rect).toEqual(rect);\n expect(widgetRow.interiorColor).toEqual('#f6f8fa');\n expect(\n (await page.annotations.list()).annotations.some((a) => a.subtype === 'widget'),\n ).toBe(false);\n\n // 3. Restyled and moved through the form, never the annotation path.\n const patched = await doc.forms.updateWidget(widgetRef, {\n interiorColor: '#fff7db',\n rect: { ...rect, y: 40 },\n });\n expect(patched.widget.interiorColor).toEqual('#fff7db');\n expect(patched.widget.rect).toEqual({ ...rect, y: 40 });\n await expect(\n page.annotations.update(widgetRef, { subtype: 'widget', interiorColor: '#ffffff' }),\n ).rejects.toMatchObject({ code: EngineErrorCode.InvalidArg });\n await expect(page.annotations.delete(widgetRef)).rejects.toMatchObject({\n code: EngineErrorCode.InvalidArg,\n });\n\n // 4. Removed from its field, it stays on its page as a row in no field.\n const removed = await doc.forms.removeWidget(field.field.ref, widgetRef);\n expect(removed.widgets.map((w) => w.field)).toEqual([null]);\n const inert = (await doc.forms.list()).widgets.find(\n (w) => annotationKey(w.ref) === annotationKey(widgetRef),\n );\n expect(inert?.field).toBeNull();\n\n // The field survives, unplaced.\n const after = await doc.forms.get(field.field.ref);\n expect(after.widgets.length).toBe(0);\n } finally {\n await doc.close();\n }\n });\n\n test('deleteWidget takes a widget off its page, and out of its field', async () => {\n const doc = await open(opts.fixtures.toggleFields);\n const pageRef = toPageRef(opts.fixtures.toggleFields.pageObjectNumber);\n const page = doc.page(pageRef);\n const events: DocumentEvent[] = [];\n const stop = doc.events.subscribe((event) => events.push(event));\n try {\n const created = await doc.forms.create({\n family: 'text',\n name: 'delete_me',\n widgets: [\n { page: pageRef, rect: { x: 20, y: 300, width: 120, height: 20 } },\n { page: pageRef, rect: { x: 20, y: 330, width: 120, height: 20 } },\n ],\n });\n const [first, second] = created.field.widgets.map((w) => w.ref!) as [\n AnnotationRef,\n AnnotationRef,\n ];\n const onPage = async (ref: AnnotationRef) =>\n (await doc.forms.list()).widgets.some((w) => annotationKey(w.ref) === annotationKey(ref));\n\n // A widget in a field: it leaves the page and the field; the field keeps the other.\n const deleted = await doc.forms.deleteWidget(first);\n expect(annotationKey(deleted.widget)).toBe(annotationKey(first));\n expect(deleted.page).toEqual(pageRef);\n expect(deleted.field?.widgets.map((w) => w.ref && annotationKey(w.ref))).toEqual([\n annotationKey(second),\n ]);\n expect(await onPage(first)).toBe(false);\n expect(events.some((event) => event.type === 'forms.widgetDeleted')).toBe(true);\n\n // A widget in no field goes too.\n await doc.forms.removeWidget(created.field.ref, second);\n const inert = await doc.forms.deleteWidget(second);\n expect(inert.field).toBeNull();\n expect(await onPage(second)).toBe(false);\n expect((await doc.forms.get(created.field.ref)).widgets).toEqual([]);\n\n // A merged field/widget is the field: delete the field instead.\n const merged = await doc.forms.get(toFieldRef('opt_check'));\n const mergedRefusal = await doc.forms.deleteWidget(merged.widgets[0]!.ref!).then(\n () => null,\n (error: unknown) => error as { code?: unknown; message?: unknown },\n );\n expect(mergedRefusal).toMatchObject({ code: EngineErrorCode.InvalidArg });\n expect(String(mergedRefusal?.message)).toMatch(/doc\\.forms\\.delete/);\n\n // An annotation isn't a widget.\n const square = (\n await page.annotations.create({\n subtype: 'square',\n box: { x: 300, y: 300, width: 40, height: 40 },\n })\n ).annotation.ref;\n const notWidget = await doc.forms.deleteWidget(square).then(\n () => null,\n (error: unknown) => error as { code?: unknown; message?: unknown },\n );\n expect(notWidget).toMatchObject({ code: EngineErrorCode.InvalidArg });\n expect(String(notWidget?.message)).toMatch(/annotations\\.delete/);\n } finally {\n stop();\n await doc.close();\n }\n });\n\n test('widgets and annotations each keep their own stacking order', async () => {\n const doc = await open(opts.fixtures.toggleFields);\n const pageRef = toPageRef(opts.fixtures.toggleFields.pageObjectNumber);\n const page = doc.page(pageRef);\n const events: DocumentEvent[] = [];\n const stop = doc.events.subscribe((event) => events.push(event));\n try {\n const widgetOrder = async () =>\n (await doc.forms.list()).widgets\n .filter((w) => w.page.objectNumber === pageRef.objectNumber)\n .map((w) => w.ref);\n const annotationOrder = async () =>\n (await page.annotations.list()).annotations.map((a) => a.ref);\n const keys = (refs: readonly AnnotationRef[]) => refs.map(annotationKey);\n const square = (\n await page.annotations.create({\n subtype: 'square',\n box: { x: 300, y: 300, width: 40, height: 40 },\n })\n ).annotation.ref;\n const widgets = await widgetOrder();\n const annotations = await annotationOrder();\n expect(widgets.length >= 2).toBe(true);\n const [bottom, next] = widgets as [AnnotationRef, AnnotationRef];\n\n // A widget to the top of the widgets: the annotations don't move.\n const toTop = await doc.forms.reorderWidgets([bottom], 'end');\n FormWidgetsReorderResultSchema.parse(toTop);\n expect(toTop.page).toEqual(pageRef);\n expect(keys(toTop.order)).toEqual(keys([...widgets.slice(1), bottom]));\n expect(toTop.meta.changedWidgets.map((w) => w.ref && annotationKey(w.ref))).toEqual(\n keys([bottom]),\n );\n expect(keys(await widgetOrder())).toEqual(keys(toTop.order));\n expect(keys(await annotationOrder())).toEqual(keys(annotations));\n const reordered = events.find((event) => event.type === 'forms.widgetsReordered');\n expect(reordered?.type === 'forms.widgetsReordered' && keys(reordered.order)).toEqual(\n keys(toTop.order),\n );\n\n // And back under its neighbour.\n const back = await doc.forms.reorderWidgets([bottom], { before: next });\n expect(keys(back.order)).toEqual(keys(widgets));\n\n // An annotation to the bottom of the annotations: the widgets don't move.\n const toBottom = await page.annotations.reorder([square], 'start');\n expect(keys(toBottom.order)).toEqual(\n keys([square, ...annotations.filter((a) => annotationKey(a) !== annotationKey(square))]),\n );\n expect(keys(await widgetOrder())).toEqual(keys(widgets));\n\n // Each verb orders its own family only, as rows and as neighbours.\n const refusal = (attempt: Promise<unknown>) =>\n attempt.then(\n () => null,\n (error: unknown) => error as { code?: unknown; message?: unknown },\n );\n const widgetAsAnnotation = await refusal(page.annotations.reorder([bottom], 'start'));\n expect(widgetAsAnnotation).toMatchObject({ code: EngineErrorCode.InvalidArg });\n expect(String(widgetAsAnnotation?.message)).toMatch(/doc\\.forms\\.reorderWidgets/);\n await expect(page.annotations.reorder([square], { after: bottom })).rejects.toMatchObject({\n code: EngineErrorCode.InvalidArg,\n });\n const annotationAsWidget = await refusal(doc.forms.reorderWidgets([square], 'end'));\n expect(annotationAsWidget).toMatchObject({ code: EngineErrorCode.InvalidArg });\n expect(String(annotationAsWidget?.message)).toMatch(/annotations\\.reorder/);\n await expect(doc.forms.reorderWidgets([bottom], { before: square })).rejects.toMatchObject({\n code: EngineErrorCode.InvalidArg,\n });\n expect(keys(await widgetOrder())).toEqual(keys(widgets));\n } finally {\n stop();\n await doc.close();\n }\n });\n\n test('createField composes styled widgets atomically', async () => {\n const doc = await open(opts.fixtures.toggleFields);\n const pageObjectNumber = opts.fixtures.toggleFields.pageObjectNumber;\n try {\n const created = await doc.forms.create({\n family: 'radio',\n name: 'authored_radio',\n noToggleToOff: true,\n widgets: [\n {\n page: toPageRef(pageObjectNumber),\n rect: { x: 20, y: 60, width: 20, height: 20 },\n exportValue: 'yes',\n color: '#000000',\n strokeWidth: 1,\n },\n {\n page: toPageRef(pageObjectNumber),\n rect: { x: 60, y: 60, width: 20, height: 20 },\n exportValue: 'no',\n },\n ],\n });\n if (created.field.family !== 'radio') throw new Error('expected radio');\n expect(created.field.noToggleToOff).toBe(true);\n expect(created.field.widgets.map((w) => w.exportValue)).toEqual(['yes', 'no']);\n // Each widget lands where it was placed, measured from the page's top-left,\n // and the form reads back the same rects the create answered.\n const rects = [\n { x: 20, y: 60, width: 20, height: 20 },\n { x: 60, y: 60, width: 20, height: 20 },\n ];\n expect(created.widgets.map((w) => w.rect)).toEqual(rects);\n const placed = (await doc.forms.list()).widgets;\n const rowOf = (ref: AnnotationRef | null) =>\n placed.find((w) => ref && annotationKey(w.ref) === annotationKey(ref));\n expect(created.field.widgets.map((w) => rowOf(w.ref)?.rect)).toEqual(rects);\n expect(rowOf(created.field.widgets[0]!.ref)?.color).toEqual('#000000');\n\n // A second button joins the group where its placement says.\n const third = await doc.forms.addWidget(created.field.ref, {\n page: toPageRef(pageObjectNumber),\n rect: { x: 100, y: 60, width: 20, height: 20 },\n exportValue: 'maybe',\n });\n if (third.field.family !== 'radio') throw new Error('expected radio');\n expect(third.field.widgets.map((w) => w.exportValue)).toEqual(['yes', 'no', 'maybe']);\n // A button needs an export value; a refused add creates nothing.\n const countBefore = (await doc.forms.list()).widgets.length;\n await expect(\n doc.forms.addWidget(created.field.ref, {\n page: toPageRef(pageObjectNumber),\n rect: { x: 140, y: 60, width: 20, height: 20 },\n }),\n ).rejects.toMatchObject({ code: EngineErrorCode.InvalidArg });\n const countAfter = (await doc.forms.list()).widgets.length;\n expect(countAfter).toBe(countBefore);\n expect((await doc.forms.get(created.field.ref)).widgets.length).toBe(3);\n\n // The newborn group fills through the normal value path.\n const filled = await doc.forms.setValue(created.field.ref, { value: 'yes' });\n if (filled.field.family !== 'radio') throw new Error('expected radio');\n expect(filled.field.value).toBe('yes');\n\n // update: no family needed (the ref says it); rename + conflict validation.\n await doc.forms.update(created.field.ref, { name: 'renamed_radio' });\n await expect(\n doc.forms.update(created.field.ref, { name: 'unison_radio' }),\n ).rejects.toMatchObject({ code: EngineErrorCode.InvalidArg });\n // A member another family has, or a family that isn't the field's, is refused.\n await expect(\n doc.forms.update(created.field.ref, { multiline: true }),\n ).rejects.toMatchObject({ code: EngineErrorCode.InvalidArg });\n await expect(\n doc.forms.update(created.field.ref, { family: 'text', name: 'x' }),\n ).rejects.toMatchObject({ code: EngineErrorCode.InvalidArg });\n\n // delete cascades: field gone and its widgets gone; meta names both.\n const before = (await doc.forms.list()).widgets;\n const removed = await doc.forms.delete(created.field.ref);\n expect(Object.keys(removed)).toEqual(['meta']);\n expect(removed.meta.changedFields).toEqual([created.field.ref]);\n expect(removed.meta.changedWidgets.length).toBe(3);\n const after = (await doc.forms.list()).widgets;\n expect(after.length).toBe(before.length - 3);\n await expect(doc.forms.get({ kind: 'fqn', name: 'renamed_radio' })).rejects.toMatchObject({\n code: EngineErrorCode.NotFound,\n });\n } finally {\n await doc.close();\n }\n });\n\n test(\"a widget's colour change keeps its font and size\", async () => {\n const doc = await open(opts.fixtures.toggleFields);\n const page = toPageRef(opts.fixtures.toggleFields.pageObjectNumber);\n try {\n const { field } = await doc.forms.create({\n family: 'text',\n name: 'styled',\n widgets: [\n {\n page,\n rect: { x: 20, y: 160, width: 160, height: 24 },\n fontFamily: 'courier',\n fontSize: 9,\n },\n ],\n });\n const widget = field.widgets[0]!.ref!;\n const { widget: recoloured } = await doc.forms.updateWidget(widget, {\n fontColor: '#cc0000',\n });\n expect(recoloured).toMatchObject({\n fontFamily: 'courier',\n fontSize: 9,\n fontColor: '#cc0000',\n });\n // A new size keeps the font and the colour.\n const { widget: resized } = await doc.forms.updateWidget(widget, { fontSize: 11 });\n expect(resized).toMatchObject({\n fontFamily: 'courier',\n fontSize: 11,\n fontColor: '#cc0000',\n });\n // A standard font that isn't the widget's changes it.\n const { widget: refonted } = await doc.forms.updateWidget(widget, {\n fontFamily: 'times-roman',\n });\n expect(refonted).toMatchObject({\n fontFamily: 'times-roman',\n fontSize: 11,\n fontColor: '#cc0000',\n });\n } finally {\n await doc.close();\n }\n });\n\n test('a push button has a caption and an action, and holds no value', async () => {\n const doc = await open(opts.fixtures.toggleFields);\n const page = toPageRef(opts.fixtures.toggleFields.pageObjectNumber);\n try {\n const { field } = await doc.forms.create({\n family: 'pushbutton',\n name: 'clear',\n widgets: [\n {\n page,\n rect: { x: 20, y: 120, width: 120, height: 28 },\n caption: 'Clear form',\n interiorColor: '#f6f8fa',\n actions: { activate: { type: 'reset-form', fields: null, exclude: false } },\n },\n ],\n });\n expect(field.family).toBe('pushbutton');\n const widget = field.widgets[0]!.ref!;\n const rowOf = async (ref: AnnotationRef) =>\n (await doc.forms.list()).widgets.find(\n (w) => annotationKey(w.ref) === annotationKey(ref),\n )!;\n let row = await rowOf(widget);\n expect(row).toMatchObject({\n fieldFamily: 'pushbutton',\n caption: 'Clear form',\n interiorColor: '#f6f8fa',\n hasAppearance: true,\n });\n expect(row.actions?.activate?.root?.type).toBe('reset-form');\n\n // A push button holds no value: the value writes refuse it.\n await expect(doc.forms.setValue(field.ref, { value: 'x' })).rejects.toMatchObject({\n code: EngineErrorCode.InvalidArg,\n });\n // Its field takes the settings every field has, and no family's own.\n await doc.forms.update(field.ref, { alternateName: 'Clears every field' });\n await expect(doc.forms.update(field.ref, { multiline: true })).rejects.toMatchObject({\n code: EngineErrorCode.InvalidArg,\n });\n\n // Its drawing is the engine's to keep: a move, new actions or the row\n // sent back keep it; a new caption draws it again.\n const moved = await doc.forms.updateWidget(widget, {\n rect: { x: 30, y: 130, width: 120, height: 28 },\n });\n const restyled = await doc.forms.updateWidget(widget, {\n actions: { focus: { type: 'reset-form', fields: null, exclude: false } },\n });\n const sentBack = await doc.forms.updateWidget(widget, { ...(await rowOf(widget)) });\n expect([moved, restyled, sentBack].map((result) => result.appearance.action)).toEqual([\n 'preserved',\n 'preserved',\n 'preserved',\n ]);\n\n // The caption changes with the widget, and undo puts it back.\n const renamed = await doc.forms.updateWidget(widget, { caption: 'Start over' });\n expect(renamed.appearance.action).toBe('regenerated');\n expect((await rowOf(widget)).caption).toBe('Start over');\n await doc.apply({ undoOf: renamed.meta.opId });\n expect((await rowOf(widget)).caption).toBe('Clear form');\n await doc.forms.updateWidget(widget, { caption: null });\n row = await rowOf(widget);\n expect([row.caption, row.hasAppearance]).toEqual([null, true]);\n\n // Another widget has no caption: its row reads none, sent back it is\n // kept, and a caption is refused, on its placement too.\n const checkbox = (await doc.forms.list()).widgets.find(\n (w) => w.fieldFamily === 'checkbox',\n )!;\n expect(checkbox.caption).toBeNull();\n await doc.forms.updateWidget(checkbox.ref, { ...checkbox });\n await expect(\n doc.forms.updateWidget(checkbox.ref, { caption: 'Yes' }),\n ).rejects.toMatchObject({ code: EngineErrorCode.InvalidArg });\n await expect(\n doc.forms.create({\n family: 'text',\n name: 'captioned',\n widgets: [{ page, rect: { x: 20, y: 160, width: 120, height: 20 }, caption: 'x' }],\n }),\n ).rejects.toMatchObject({ code: EngineErrorCode.InvalidArg });\n } finally {\n await doc.close();\n }\n });\n\n test('create is one change: a rejected draft creates nothing', async () => {\n const doc = await open(opts.fixtures.toggleFields);\n const page = toPageRef(opts.fixtures.toggleFields.pageObjectNumber);\n const names = async () => (await doc.forms.list()).fields.map((field) => field.name);\n const widgetCount = async () =>\n (await doc.forms.list()).widgets.filter((w) => w.page.objectNumber === page.objectNumber)\n .length;\n try {\n const namesBefore = await names();\n const widgetsBefore = await widgetCount();\n const placed = { page, rect: { x: 20, y: 100, width: 100, height: 20 } };\n\n // Checked before anything is written.\n await expect(\n doc.forms.create({\n family: 'text',\n name: 'rejected_text',\n maxLength: -5,\n widgets: [placed],\n }),\n ).rejects.toMatchObject({ code: EngineErrorCode.InvalidArg });\n await expect(\n doc.forms.create({\n family: 'text',\n name: 'rejected_text',\n widgets: [{ ...placed, page: toPageRef(999_999) }],\n }),\n ).rejects.toMatchObject({ code: EngineErrorCode.NotFound });\n // Refused after the field exists: the whole create is undone.\n await expect(\n doc.forms.create({\n family: 'combobox',\n name: 'rejected_choice',\n options: [{ label: 'A', value: 'a' }],\n defaultValue: 'not-an-option',\n widgets: [placed],\n }),\n ).rejects.toMatchObject({ code: EngineErrorCode.InvalidArg });\n\n expect(await names()).toEqual(namesBefore);\n expect(await widgetCount()).toBe(widgetsBefore);\n\n // The names are still free.\n const created = await doc.forms.create({\n family: 'text',\n name: 'rejected_text',\n widgets: [placed],\n });\n expect(created.field.name).toBe('rejected_text');\n await doc.forms.delete(created.field.ref);\n } finally {\n await doc.close();\n }\n });\n\n test('flags, list box defaults and signature fields are written like any other member', async () => {\n const doc = await open(opts.fixtures.toggleFields);\n const page = toPageRef(opts.fixtures.toggleFields.pageObjectNumber);\n try {\n const list = await doc.forms.create({\n family: 'listbox',\n name: 'defaults_list',\n multiSelect: true,\n options: [\n { label: 'A', value: 'a' },\n { label: 'B', value: 'b' },\n { label: 'C', value: 'c' },\n ],\n defaultValue: ['a', 'c'],\n required: true,\n widgets: [{ page, rect: { x: 20, y: 140, width: 100, height: 60 } }],\n });\n if (list.field.family !== 'listbox') throw new Error('expected listbox');\n expect(list.field.defaultValue).toEqual(['a', 'c']);\n expect(list.field).toMatchObject({ readOnly: false, required: true, noExport: false });\n\n // A default must be option values.\n await expect(\n doc.forms.update(list.field.ref, { defaultValue: ['z'] }),\n ).rejects.toMatchObject({ code: EngineErrorCode.InvalidArg });\n\n // Reset selects the default.\n await doc.forms.update(list.field.ref, { defaultValue: ['b'] });\n await doc.forms.setValue(list.field.ref, { selectedValues: ['a'] });\n const reset = await doc.forms.reset(list.field.ref);\n const [restored] = reset.fields;\n if (restored?.family !== 'listbox') throw new Error('expected listbox');\n expect(restored.selectedValues).toEqual(['b']);\n\n // A flag left out keeps its value.\n await doc.forms.update(list.field.ref, { readOnly: true });\n expect(await doc.forms.get(list.field.ref)).toMatchObject({\n readOnly: true,\n required: true,\n });\n await doc.forms.update(list.field.ref, { required: false });\n expect(await doc.forms.get(list.field.ref)).toMatchObject({\n readOnly: true,\n required: false,\n });\n // Flags are members of their own, not one object.\n await expect(\n doc.forms.update(list.field.ref, { flags: { required: true } } as never),\n ).rejects.toMatchObject({ code: EngineErrorCode.InvalidArg });\n\n // A signature field takes the settings every field shares.\n const signature = await doc.forms.create({\n family: 'signature',\n name: 'sign_here',\n widgets: [{ page, rect: { x: 20, y: 220, width: 150, height: 40 } }],\n });\n await doc.forms.update(signature.field.ref, {\n name: 'signed_here',\n alternateName: 'Sign here',\n required: true,\n });\n const renamed = await doc.forms.get(signature.field.ref);\n expect(renamed.family).toBe('signature');\n expect(renamed.name).toBe('signed_here');\n expect(renamed.alternateName).toBe('Sign here');\n expect(renamed.required).toBe(true);\n await expect(\n doc.forms.update(signature.field.ref, { multiline: true }),\n ).rejects.toMatchObject({ code: EngineErrorCode.InvalidArg });\n\n await doc.forms.delete(list.field.ref);\n await doc.forms.delete(signature.field.ref);\n } finally {\n await doc.close();\n }\n });\n\n test('delete removes a merged field/widget from the tree and its page in one mutation', async () => {\n // maxlen_text, opt_check and billing.name are each one dictionary that\n // is both the field and its only widget: maxlen_text is listed in\n // /AcroForm /Fields, billing.name in its parent's /Kids.\n const doc = opts.fixtures.deleteTarget\n ? await open(opts.fixtures.deleteTarget)\n : await open(opts.fixtures.toggleFields, '-delete-target');\n const placed = async () =>\n (await doc.forms.list()).widgets.flatMap((w) =>\n w.ref.kind === 'objectNumber' ? [w.ref.objectNumber] : [],\n );\n try {\n const events: DocumentEvent[] = [];\n const unsubscribe = doc.events.subscribe((event) => events.push(event));\n for (const name of ['maxlen_text', 'billing.name']) {\n const field = await doc.forms.get(toFieldRef(name));\n if (field.ref.kind !== 'objectNumber') throw new Error('expected an object-number ref');\n const merged = field.ref.objectNumber;\n expect(field.widgets.map((w) => w.objectNumber)).toEqual([merged]);\n expect(await placed()).toContain(merged);\n\n const removed = await doc.forms.delete(field.ref);\n expect(removed.meta.changedFields).toEqual([field.ref]);\n expect(removed.meta.changedWidgets.map((w) => w.objectNumber)).toEqual([merged]);\n expect((await placed()).includes(merged)).toBe(false);\n await expect(doc.forms.get(toFieldRef(name))).rejects.toMatchObject({\n code: EngineErrorCode.NotFound,\n });\n }\n unsubscribe();\n expect(events.map((event) => event.type)).toEqual(['forms.deleted', 'forms.deleted']);\n\n const names = (await doc.forms.list()).fields.map((f) => f.name);\n expect(names.includes('maxlen_text') || names.includes('billing.name')).toBe(false);\n expect(names).toContain('opt_check');\n } finally {\n await doc.close();\n }\n });\n\n test('a merged field/widget cannot be removed from its field or deleted as an annotation', async () => {\n const doc = await open(opts.fixtures.toggleFields);\n const page = doc.page(toPageRef(opts.fixtures.toggleFields.pageObjectNumber));\n try {\n const field = await doc.forms.get(toFieldRef('opt_check'));\n const widgetRef = field.widgets[0]?.ref;\n if (field.ref.kind !== 'objectNumber' || widgetRef?.kind !== 'objectNumber') {\n throw new Error('expected object-number refs');\n }\n expect(widgetRef.objectNumber).toBe(field.ref.objectNumber);\n\n // Removing the field's own dictionary from itself is refused.\n const detach = await doc.forms.removeWidget(field.ref, widgetRef).then(\n () => null,\n (error: unknown) => error as { code?: unknown; message?: unknown },\n );\n expect(detach).toMatchObject({ code: EngineErrorCode.InvalidArg });\n expect(String(detach?.message)).toMatch(/merged field\\/widget/);\n\n // The annotation plane refuses too, and names the only verb that works.\n const remove = await page.annotations.delete(widgetRef).then(\n () => null,\n (error: unknown) => error as { code?: unknown; message?: unknown },\n );\n expect(remove).toMatchObject({ code: EngineErrorCode.InvalidArg });\n expect(String(remove?.message)).toMatch(/doc\\.forms\\.delete/);\n expect(String(remove?.message).includes('removeWidget')).toBe(false);\n\n // Both refusals left the field and its placement untouched.\n const after = await doc.forms.get(field.ref);\n expect(after.widgets.map((w) => w.objectNumber)).toEqual([widgetRef.objectNumber]);\n const { widgets } = await doc.forms.list();\n expect(\n widgets.some(\n (w) => w.ref.kind === 'objectNumber' && w.ref.objectNumber === widgetRef.objectNumber,\n ),\n ).toBe(true);\n } finally {\n await doc.close();\n }\n });\n\n test('unknown refs fail with NotFound', async () => {\n const doc = await open(opts.fixtures.toggleFields);\n try {\n await expect(doc.forms.get({ kind: 'fqn', name: 'no.such.field' })).rejects.toMatchObject({\n code: EngineErrorCode.NotFound,\n });\n } finally {\n await doc.close();\n }\n });\n });\n}\n","import type {\n ConformanceTestRunner,\n ConformanceFixture,\n ConformanceOptions,\n} from './runMetadataConformance';\nimport type { AnnotationAppearanceMode } from '../dto/AnnotationRender';\nimport { appearanceRasters } from './appearanceRasters';\nimport type { DocumentHandle } from '../engine/DocumentHandle';\nimport type { Engine } from '../engine/Engine';\nimport { isLocalPage } from '../engine/LocalPageHandle';\nimport type { AnnotationRef } from '../identity/AnnotationRef';\nimport { toPageRef, type PageRef } from '../identity/PageRef';\nimport { AbortError } from '../promise/AbortError';\nimport { EVERY_PERMISSION } from './fixtureScope';\n\n/**\n * Per-fixture knowledge for the annotation appearance conformance suite. The\n * harness asserts thresholds (not exact wire content) so the same suite runs\n * unchanged against the local and cloud engines and proves they emit the same\n * set of appearances, including those of annotations born inline in the file.\n */\nexport interface AnnotationAppearanceConformanceFixture extends ConformanceFixture {\n /** PDF object number of the page whose appearances are rendered. */\n pageObjectNumber: number;\n /** At least this many `/AP` appearances are expected on that page. */\n minAppearanceCount: number;\n /**\n * `true` when the page has at least one annotation born inline in the\n * file (named by `baseIndex`) that carries an appearance stream: it must\n * be emitted too, under that name.\n */\n expectsInlineAppearance: boolean;\n}\n\nexport interface AnnotationAppearanceConformanceOptions extends Omit<\n ConformanceOptions,\n 'fixture'\n> {\n fixture: AnnotationAppearanceConformanceFixture;\n}\n\nconst PNG_SIGNATURE = [0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a];\n\ninterface NormalizedAppearance {\n ref: AnnotationRef;\n mode: AnnotationAppearanceMode;\n width: number;\n height: number;\n /** Raw RGBA bytes (raw-raster engines) or `null`. */\n raster: { data: ArrayBuffer; width: number; height: number; stride: number } | null;\n /** Encoded image bytes (image engines) or `null`. */\n encoded: Uint8Array | null;\n}\n\nexport function runAnnotationAppearanceConformance(\n runner: ConformanceTestRunner,\n opts: AnnotationAppearanceConformanceOptions,\n): void {\n const { describe, test, beforeAll, afterAll, expect } = runner;\n\n describe(`annotation appearance conformance: ${opts.label}`, () => {\n let engine: Engine;\n\n beforeAll(async () => {\n engine = await opts.makeEngine();\n });\n\n afterAll(async () => {\n if (engine) await engine.destroy();\n });\n\n test('renders the expected set of appearances with valid output', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const { page, appearances } = await collect(doc, opts);\n\n expect(page.objectNumber).toBe(opts.fixture.pageObjectNumber);\n expect(appearances.length >= opts.fixture.minAppearanceCount).toBe(true);\n\n for (const appearance of appearances) {\n // Identity is the ref — never a stableId.\n expect(['objectNumber', 'baseIndex'].includes(appearance.ref.kind)).toBe(true);\n expect(['normal', 'rollover', 'down'].includes(appearance.mode)).toBe(true);\n expect(appearance.width > 0 && appearance.height > 0).toBe(true);\n\n if (appearance.encoded) {\n // Encoded engines must ship real PNG bytes, not an empty part.\n expect(appearance.encoded.length > PNG_SIGNATURE.length).toBe(true);\n expect(PNG_SIGNATURE.every((b, i) => appearance.encoded![i] === b)).toBe(true);\n }\n }\n } finally {\n await doc.close();\n }\n });\n\n if (opts.fixture.expectsInlineAppearance) {\n test('annotations born inline are emitted under their baseIndex name', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const { appearances } = await collect(doc, opts);\n const inline = appearances.find((a) => a.ref.kind === 'baseIndex');\n expect(inline !== undefined).toBe(true);\n } finally {\n await doc.close();\n }\n });\n }\n\n test('rendered appearances are not blank (non-zero alpha)', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const page = doc.page(toPageRef(opts.fixture.pageObjectNumber));\n // Guards the blank-render regression: at least one appearance must\n // have a visible (non-transparent) pixel, as the engine gives it\n // (raw locally, a decoded image on the cloud).\n const rasters = await appearanceRasters(page);\n const anyVisible = [...rasters.values()].some(({ rgba }) =>\n rgba.some((byte, index) => index % 4 === 3 && byte !== 0),\n );\n expect(anyVisible).toBe(true);\n } finally {\n await doc.close();\n }\n });\n\n test('abort() rejects with AbortError', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const page = doc.page(toPageRef(opts.fixture.pageObjectNumber));\n const p = isLocalPage(page)\n ? page.annotations.renderAppearancesRaw({ viewport: { kind: 'scale', scale: 1 } })\n : page.annotations.renderAppearances({\n format: 'png',\n viewport: { kind: 'scale', scale: 1 },\n });\n p.abort('test');\n await expect(p).rejects.toBeInstanceOf(AbortError);\n } finally {\n await doc.close();\n }\n });\n });\n}\n\n/**\n * The page's appearances as the engine gives them: raw rasters locally (its\n * encoder needs a browser canvas, which Node lacks), encoded images on the\n * cloud.\n */\nasync function collect(\n doc: DocumentHandle,\n opts: AnnotationAppearanceConformanceOptions,\n): Promise<{ page: PageRef; appearances: NormalizedAppearance[] }> {\n const page = doc.page(toPageRef(opts.fixture.pageObjectNumber));\n if (isLocalPage(page)) {\n const result = await page.annotations.renderAppearancesRaw({\n viewport: { kind: 'scale', scale: 1 },\n });\n return {\n page: result.page,\n appearances: result.appearances.map((a) => ({\n ref: a.ref,\n mode: a.mode,\n width: a.raster.width,\n height: a.raster.height,\n raster: a.raster,\n encoded: null,\n })),\n };\n }\n const result = await page.annotations.renderAppearances({\n format: 'png',\n viewport: { kind: 'scale', scale: 1 },\n });\n return {\n page: result.page,\n appearances: result.appearances.map((a) => ({\n ref: a.ref,\n mode: a.mode,\n width: a.image.width ?? 0,\n height: a.image.height ?? 0,\n raster: null,\n encoded: a.image.source.kind === 'bytes' ? a.image.source.bytes : new Uint8Array(),\n })),\n };\n}\n\nasync function openFixture(engine: Engine, opts: AnnotationAppearanceConformanceOptions) {\n if (opts.openKind === 'bytes') {\n const bytes = await opts.fixture.bytes();\n return engine.open({ kind: 'bytes', id: opts.fixture.id, bytes }, EVERY_PERMISSION);\n }\n return engine.open({ kind: 'id', id: opts.fixture.cloudId ?? opts.fixture.id });\n}\n","import type {\n ConformanceTestRunner,\n ConformanceFixture,\n ConformanceOptions,\n} from './runMetadataConformance';\nimport type { DocumentHandle } from '../engine/DocumentHandle';\nimport type { Engine } from '../engine/Engine';\nimport { EngineError } from '../errors/EngineError';\nimport { EngineErrorCode } from '../errors/EngineErrorCode';\nimport { annotationKey } from '../identity/annotationKey';\nimport { toPageRef } from '../identity/PageRef';\nimport { AbortError } from '../promise/AbortError';\nimport { PageListSnapshotSchema, PageReorderResultSchema } from '../wire/schemas';\nimport { EVERY_PERMISSION } from './fixtureScope';\n\n/**\n * Per-fixture knowledge for the page-reorder suite. The test pages must\n * be addressable by indirect `pageObjectNumber` (every page in our\n * fixtures is). The fixture is expected to have at least 3 pages so the\n * harness can exercise reorder permutations meaningfully.\n */\nexport interface PageReorderConformanceFixture extends ConformanceFixture {\n /** Stable, durable page object numbers of (at least) three distinct pages. Order\n * here is the *intended caller-visible* order, not the on-disk\n * order; the suite reads `pages.list()` first and works in document\n * order. */\n pageObjectNumbersForReorderTest?: number[];\n}\n\nexport interface PageReorderConformanceOptions extends Omit<ConformanceOptions, 'fixture'> {\n fixture: PageReorderConformanceFixture;\n}\n\n/**\n * Page reorder conformance suite. Verifies the architectural invariants\n * locked with the user, do not loosen these without re-reading\n * `PageReorderResult` and `DocumentPagesMutator`:\n *\n * 1. `pages.list()` returns every page in display order, addressed\n * by indirect `pageObjectNumber`.\n * 2. `pages.reorder()` puts the pages next to a neighbour (or at the start\n * or end) and returns the full new order + geometry via\n * `result.layout` (the same shape `pages.list()` returns). There is\n * no document-level revision; the wire never asks the caller for one.\n * 3. Annotation names survive a page reorder: a user shuffling pages\n * mid-edit must not lose a pending highlight, so a `baseIndex` ref\n * captured before the reorder works after it.\n * 4. A page named twice, or a neighbour that is one of the moved pages,\n * rejects with `InvalidArg`; an unknown page or neighbour with\n * `NotFound`.\n * 5. Abort propagates as `AbortError`.\n *\n * Both local (worker host + WASM) and cloud (HTTP + @cloudpdf/server)\n * implementations must pass identically.\n */\nexport function runPageReorderConformance(\n runner: ConformanceTestRunner,\n opts: PageReorderConformanceOptions,\n): void {\n const { describe, test, beforeAll, afterAll, expect } = runner;\n const fix = opts.fixture;\n\n describe(`page reorder conformance: ${opts.label}`, () => {\n let engine: Engine;\n\n beforeAll(async () => {\n engine = await opts.makeEngine();\n });\n\n afterAll(async () => {\n if (engine) await engine.destroy();\n });\n\n test('pages.list() returns every page in display order, durable PONs only', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const list = await doc.pages.list();\n expect(PageListSnapshotSchema.safeParse(list).success).toBe(true);\n expect(list.pages.length >= 1).toBe(true);\n\n for (let i = 0; i < list.pages.length; i++) {\n // Strictly contiguous, 0..N-1.\n expect(list.pages[i].index).toBe(i);\n // Pages are durable by construction; page object number > 0.\n expect(list.pages[i].ref.objectNumber > 0).toBe(true);\n }\n\n // page object numbers are unique across the document.\n const seen = new Set<number>();\n for (const p of list.pages) {\n expect(seen.has(p.ref.objectNumber)).toBe(false);\n seen.add(p.ref.objectNumber);\n }\n } finally {\n await doc.close();\n }\n });\n\n test('pages.reorder() moves pages to a position and returns the full new order', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const before = await doc.pages.list();\n if (before.pages.length < 3) return;\n const pageObjectNumbers = pickReorderPageObjectNumbers(\n before.pages.map((p) => p.ref.objectNumber),\n fix,\n );\n if (!pageObjectNumbers) return;\n\n // Move the last of the three to the front.\n const target = pageObjectNumbers[pageObjectNumbers.length - 1];\n const result = await doc.pages.reorder([toPageRef(target)], 'start');\n expect(PageReorderResultSchema.safeParse(result).success).toBe(true);\n expect(result.pages.map((p) => p.objectNumber)).toEqual([target]);\n\n // The result carries the new geometry: same count, contiguous\n // indices, moved page leads.\n const after = result.layout;\n expect(after.pages.length).toBe(before.pages.length);\n expect(after.pages[0].ref.objectNumber).toBe(target);\n for (let i = 0; i < after.pages.length; i++) {\n expect(after.pages[i].index).toBe(i);\n }\n\n // Set of page object numbers is preserved (no page lost or fabricated).\n const beforePageObjectNumbers = new Set(before.pages.map((p) => p.ref.objectNumber));\n const afterPageObjectNumbers = new Set(after.pages.map((p) => p.ref.objectNumber));\n expect(beforePageObjectNumbers.size).toBe(afterPageObjectNumbers.size);\n for (const pageObjectNumber of beforePageObjectNumbers)\n expect(afterPageObjectNumbers.has(pageObjectNumber)).toBe(true);\n\n // A subsequent `pages.list()` agrees with the returned layout\n // (the reorder result is not a one-off view).\n const relisted = await doc.pages.list();\n expect(relisted.pages.map((p) => p.ref.objectNumber)).toEqual(\n after.pages.map((p) => p.ref.objectNumber),\n );\n } finally {\n await doc.close();\n }\n });\n\n test('an annotation born inline keeps its baseIndex name across a page reorder', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const list = await doc.pages.list();\n const inline = (await doc.annotations.list()).annotations.find(\n (a) => a.ref.kind === 'baseIndex',\n );\n const other = list.pages.find((p) => p.ref.objectNumber !== inline?.page.objectNumber);\n if (!inline || !other) return;\n\n await doc.pages.reorder([other.ref], 'start');\n\n const update = await doc.page(inline.page).annotations.update(inline.ref, {\n contents: 'still alive',\n });\n expect(update.annotation.contents).toBe('still alive');\n expect(annotationKey(update.annotation.ref)).toBe(annotationKey(inline.ref));\n } finally {\n await doc.close();\n }\n });\n\n test('pages.reorder() puts the pages right before or after their neighbour, in the order given', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const before = await doc.pages.list();\n if (before.pages.length < 3) return;\n const [first, second, third] = before.pages.map((p) => p.ref);\n const order = async () => (await doc.pages.list()).pages.map((p) => p.ref.objectNumber);\n const rest = before.pages.slice(3).map((p) => p.ref.objectNumber);\n\n await doc.pages.reorder([third!, first!], { after: second! });\n expect(await order()).toEqual([\n second!.objectNumber,\n third!.objectNumber,\n first!.objectNumber,\n ...rest,\n ]);\n\n await doc.pages.reorder([first!], { before: second! });\n expect(await order()).toEqual([\n first!.objectNumber,\n second!.objectNumber,\n third!.objectNumber,\n ...rest,\n ]);\n\n const last = before.pages[before.pages.length - 1]!.ref;\n await doc.pages.reorder([first!], 'end');\n expect((await order()).at(-1)).toBe(first!.objectNumber);\n await doc.pages.reorder([first!], { before: second! });\n expect((await order()).at(-1)).toBe(last.objectNumber);\n } finally {\n await doc.close();\n }\n });\n\n test('pages.reorder() rejects duplicate PONs with InvalidArg', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const list = await doc.pages.list();\n if (list.pages.length < 1) return;\n const target = list.pages[0].ref;\n let caught: unknown;\n try {\n await doc.pages.reorder([target, target], 'start');\n } catch (err) {\n caught = err;\n }\n expect(EngineError.is(caught, EngineErrorCode.InvalidArg)).toBe(true);\n } finally {\n await doc.close();\n }\n });\n\n test('pages.reorder() rejects a neighbour that is one of the moved pages with InvalidArg', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const list = await doc.pages.list();\n if (list.pages.length < 2) return;\n const [first, second] = list.pages.map((p) => p.ref);\n let caught: unknown;\n try {\n await doc.pages.reorder([first!, second!], { after: second! });\n } catch (err) {\n caught = err;\n }\n expect(EngineError.is(caught, EngineErrorCode.InvalidArg)).toBe(true);\n } finally {\n await doc.close();\n }\n });\n\n test('pages.reorder() rejects an unknown page or neighbour with NotFound', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const list = await doc.pages.list();\n // Pick a page object number that is guaranteed to not exist.\n let bogus = 0;\n for (const p of list.pages) bogus = Math.max(bogus, p.ref.objectNumber);\n bogus += 9999;\n\n const refused = async (attempt: () => Promise<unknown>) => {\n try {\n await attempt();\n } catch (err) {\n return err;\n }\n return undefined;\n };\n const unknownPage = await refused(() => doc.pages.reorder([toPageRef(bogus)], 'start'));\n expect(EngineError.is(unknownPage, EngineErrorCode.NotFound)).toBe(true);\n const unknownNeighbour = await refused(() =>\n doc.pages.reorder([list.pages[0]!.ref], { after: toPageRef(bogus) }),\n );\n expect(EngineError.is(unknownNeighbour, EngineErrorCode.NotFound)).toBe(true);\n expect((await doc.pages.list()).pages.map((p) => p.ref.objectNumber)).toEqual(\n list.pages.map((p) => p.ref.objectNumber),\n );\n } finally {\n await doc.close();\n }\n });\n\n test('abort on pages.reorder() rejects with AbortError', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const list = await doc.pages.list();\n if (list.pages.length < 1) return;\n const target = list.pages[0].ref;\n const p = doc.pages.reorder([target], 'start');\n p.abort('test');\n await expect(p).rejects.toBeInstanceOf(AbortError);\n } finally {\n await doc.close();\n }\n });\n });\n}\n\nasync function openFixture(\n engine: Engine,\n opts: PageReorderConformanceOptions,\n): Promise<DocumentHandle> {\n if (opts.openKind === 'bytes') {\n const bytes = await opts.fixture.bytes();\n return engine.open({ kind: 'bytes', id: opts.fixture.id, bytes }, EVERY_PERMISSION);\n }\n return engine.open({ kind: 'id', id: opts.fixture.cloudId ?? opts.fixture.id });\n}\n\n/**\n * Choose three page object numbers to exercise reorder operations against. Prefers\n * the fixture-supplied ones, falls back to \"first three in document\n * order\" otherwise.\n */\nfunction pickReorderPageObjectNumbers(\n documentPageObjectNumbers: number[],\n fix: PageReorderConformanceFixture,\n): number[] | null {\n if (fix.pageObjectNumbersForReorderTest && fix.pageObjectNumbersForReorderTest.length >= 3) {\n return fix.pageObjectNumbersForReorderTest.slice(0, 3);\n }\n if (documentPageObjectNumbers.length < 3) return null;\n return documentPageObjectNumbers.slice(0, 3);\n}\n","import type { ConformanceTestRunner, ConformanceOptions } from './runMetadataConformance';\nimport type { DocumentHandle } from '../engine/DocumentHandle';\nimport type { Engine } from '../engine/Engine';\nimport { EngineError } from '../errors/EngineError';\nimport { EngineErrorCode } from '../errors/EngineErrorCode';\nimport { annotationKey } from '../identity/annotationKey';\nimport { toPageRef } from '../identity/PageRef';\nimport { AbortError } from '../promise/AbortError';\nimport { PageRotateResultSchema } from '../wire/schemas';\nimport { EVERY_PERMISSION } from './fixtureScope';\n\n/**\n * Page rotate conformance suite. Verifies the architectural invariants —\n * do not loosen these without re-reading `PageRotateResult`:\n *\n * 1. Rotation is absolute and idempotent: `rotate(pons, 90)` twice is\n * `rotate(pons, 90)` once. The wire never speaks \"turn by\".\n * 2. Rotation is presentation metadata over normalized content: the\n * layout's `width`/`height` stay un-rotated, order and identity are\n * untouched, and annotation names survive (a `baseIndex` ref captured\n * before the rotate works after it).\n * 3. The result returns the full new `layout`; a subsequent `list()`\n * agrees with it.\n * 4. Invalid inputs (bad rotation value, duplicate page object numbers, unknown page object numbers)\n * reject with `InvalidArg` / `NotFound`.\n * 5. Abort propagates as `AbortError`.\n *\n * Both local (worker host + WASM) and cloud (HTTP + @cloudpdf/server)\n * implementations must pass identically.\n */\nexport function runPageRotateConformance(\n runner: ConformanceTestRunner,\n opts: ConformanceOptions,\n): void {\n const { describe, test, beforeAll, afterAll, expect } = runner;\n\n describe(`page rotate conformance: ${opts.label}`, () => {\n let engine: Engine;\n\n beforeAll(async () => {\n engine = await opts.makeEngine();\n });\n\n afterAll(async () => {\n if (engine) await engine.destroy();\n });\n\n test('pages.rotate() sets the absolute rotation and returns the full layout', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const before = await doc.pages.list();\n const target = before.pages[0];\n\n const result = await doc.pages.rotate([target.ref], 90);\n expect(PageRotateResultSchema.safeParse(result).success).toBe(true);\n\n const after = result.layout;\n const rotated = after.pages.find((p) => p.ref.objectNumber === target.ref.objectNumber);\n expect(rotated?.rotation).toBe(90);\n\n // Presentation metadata only: un-rotated dims, order, and the page object number\n // set are all untouched.\n expect(rotated?.size.width).toBe(target.size.width);\n expect(rotated?.size.height).toBe(target.size.height);\n expect(after.pages.map((p) => p.ref.objectNumber)).toEqual(\n before.pages.map((p) => p.ref.objectNumber),\n );\n\n // A subsequent list() agrees (the result is not a one-off view).\n const relisted = await doc.pages.list();\n expect(\n relisted.pages.find((p) => p.ref.objectNumber === target.ref.objectNumber)?.rotation,\n ).toBe(90);\n } finally {\n await doc.close();\n }\n });\n\n test('absolute rotation is idempotent: setting the same value twice is a no-op', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const list = await doc.pages.list();\n const pageObjectNumber = list.pages[0].ref.objectNumber;\n const first = await doc.pages.rotate([toPageRef(pageObjectNumber)], 180);\n const second = await doc.pages.rotate([toPageRef(pageObjectNumber)], 180);\n expect(second.layout.pages.map((p) => [p.ref.objectNumber, p.rotation])).toEqual(\n first.layout.pages.map((p) => [p.ref.objectNumber, p.rotation]),\n );\n } finally {\n await doc.close();\n }\n });\n\n test('one rotation applies to EVERY listed page (the multi-select gesture)', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const list = await doc.pages.list();\n if (list.pages.length < 2) return;\n const pageObjectNumbers = list.pages.slice(0, 2).map((p) => p.ref.objectNumber);\n const result = await doc.pages.rotate(pageObjectNumbers.map(toPageRef), 270);\n for (const pageObjectNumber of pageObjectNumbers) {\n expect(\n result.layout.pages.find((p) => p.ref.objectNumber === pageObjectNumber)?.rotation,\n ).toBe(270);\n }\n } finally {\n await doc.close();\n }\n });\n\n test('an annotation born inline keeps its baseIndex name when its page is rotated', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const inline = (await doc.annotations.list()).annotations.find(\n (a) => a.ref.kind === 'baseIndex',\n );\n if (!inline) return;\n\n await doc.pages.rotate([inline.page], 90);\n\n const update = await doc.page(inline.page).annotations.update(inline.ref, {\n contents: 'still alive',\n });\n expect(update.annotation.contents).toBe('still alive');\n expect(annotationKey(update.annotation.ref)).toBe(annotationKey(inline.ref));\n } finally {\n await doc.close();\n }\n });\n\n test('pages.rotate() rejects an invalid rotation value with InvalidArg', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const list = await doc.pages.list();\n const pageObjectNumber = list.pages[0].ref.objectNumber;\n let caught: unknown;\n try {\n // 45 is not a legal /Rotate value; the type forbids it, the wire\n // must too.\n await doc.pages.rotate([toPageRef(pageObjectNumber)], 45 as never);\n } catch (err) {\n caught = err;\n }\n expect(EngineError.is(caught, EngineErrorCode.InvalidArg)).toBe(true);\n } finally {\n await doc.close();\n }\n });\n\n test('pages.rotate() rejects duplicate PONs with InvalidArg', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const list = await doc.pages.list();\n const pageObjectNumber = list.pages[0].ref.objectNumber;\n let caught: unknown;\n try {\n await doc.pages.rotate([toPageRef(pageObjectNumber), toPageRef(pageObjectNumber)], 90);\n } catch (err) {\n caught = err;\n }\n expect(EngineError.is(caught, EngineErrorCode.InvalidArg)).toBe(true);\n } finally {\n await doc.close();\n }\n });\n\n test('pages.rotate() rejects unknown PON with NotFound or InvalidArg', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const list = await doc.pages.list();\n let bogus = 0;\n for (const p of list.pages) bogus = Math.max(bogus, p.ref.objectNumber);\n bogus += 9999;\n\n let caught: unknown;\n try {\n await doc.pages.rotate([toPageRef(bogus)], 90);\n } catch (err) {\n caught = err;\n }\n expect(\n EngineError.is(caught, EngineErrorCode.NotFound) ||\n EngineError.is(caught, EngineErrorCode.InvalidArg),\n ).toBe(true);\n } finally {\n await doc.close();\n }\n });\n\n test('abort on pages.rotate() rejects with AbortError', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const list = await doc.pages.list();\n const pageObjectNumber = list.pages[0].ref.objectNumber;\n const p = doc.pages.rotate([toPageRef(pageObjectNumber)], 90);\n p.abort('test');\n await expect(p).rejects.toBeInstanceOf(AbortError);\n } finally {\n await doc.close();\n }\n });\n });\n}\n\nasync function openFixture(engine: Engine, opts: ConformanceOptions): Promise<DocumentHandle> {\n if (opts.openKind === 'bytes') {\n const bytes = await opts.fixture.bytes();\n return engine.open({ kind: 'bytes', id: opts.fixture.id, bytes }, EVERY_PERMISSION);\n }\n return engine.open({ kind: 'id', id: opts.fixture.cloudId ?? opts.fixture.id });\n}\n","import { decodePng, type Raster } from './appearanceRasters';\nimport type { ConformanceTestRunner } from './runMetadataConformance';\nimport type { Annotation } from '../annotation/kinds';\nimport type { DocumentHandle } from '../engine/DocumentHandle';\nimport type { Engine } from '../engine/Engine';\nimport type { PageHandle } from '../engine/PageHandle';\nimport type { PageLayout } from '../dto/PageLayout';\nimport { pdfRectTurnedBounds } from '../geometry/convert';\nimport { pageBoxOf, type PageBox } from '../geometry/pageSpace';\nimport { EngineErrorCode } from '../errors/EngineErrorCode';\nimport { annotationKey } from '../identity/annotationKey';\n\nexport type AnnotationRotationFixture =\n /** A one-page document without annotations. */\n | 'authoring'\n /** A stamp Acrobat turned 36° clockwise: `/Rotate -36`, the turn in its appearance. */\n | 'acrobat-stamp-rotated'\n /** A text box Acrobat added on a turned page (`/Rotate 90`), and one upright. */\n | 'acrobat-freetext-rotated';\n\nexport interface AnnotationRotationConformanceOptions {\n label: string;\n /** Build a fresh engine for this suite. The suite tears it down at the end. */\n makeEngine: () => Promise<Engine> | Engine;\n /** Open a fresh copy of a fixture. */\n open: (engine: Engine, fixture: AnnotationRotationFixture) => Promise<DocumentHandle>;\n}\n\ntype Stamp = Extract<Annotation, { subtype: 'stamp' }>;\ntype FreeText = Extract<Annotation, { subtype: 'free-text' }>;\n\n/**\n * An annotation's `rotation` is degrees clockwise, as every rotation in the\n * API, on both engines. What's drawn decides it: a turn another app made\n * (Acrobat's `/Rotate` stamps and quarter-turned text boxes) reads as ours\n * does, with the `box` the drawing turns, and a write keeps it. A turned\n * box's `rect` is the upright box around all it draws, which the engine\n * works out.\n */\nexport function runAnnotationRotationConformance(\n runner: ConformanceTestRunner,\n opts: AnnotationRotationConformanceOptions,\n): void {\n const { describe, test, beforeAll, afterAll, expect } = runner;\n\n describe(`annotation rotation conformance: ${opts.label}`, () => {\n let engine: Engine;\n\n beforeAll(async () => {\n engine = await opts.makeEngine();\n });\n\n afterAll(async () => {\n if (engine) await engine.destroy();\n });\n\n const onPage = async (\n fixture: AnnotationRotationFixture,\n run: (page: PageHandle, layout: PageLayout) => Promise<void>,\n ): Promise<void> => {\n const doc = await opts.open(engine, fixture);\n try {\n const { pages } = await doc.pages.list();\n await run(doc.page(pages[0]!.ref), pages[0]!);\n } finally {\n await doc.close();\n }\n };\n\n const expectRect = (actual: PageBox | null, expected: PageBox, tolerance: number) => {\n expect(actual !== null).toBe(true);\n for (const edge of ['x', 'y', 'width', 'height'] as const) {\n expect(Math.abs(actual![edge] - expected[edge]) <= tolerance).toBe(true);\n }\n };\n\n const stampOf = async (page: PageHandle): Promise<Stamp> => {\n const { annotations } = await page.annotations.list();\n const stamp = annotations.find((a): a is Stamp => a.subtype === 'stamp');\n if (!stamp) throw new Error('no stamp');\n return stamp;\n };\n\n const textBoxOf = async (page: PageHandle, contents: string): Promise<FreeText> => {\n const { annotations } = await page.annotations.list();\n const box = annotations.find(\n (a): a is FreeText => a.subtype === 'free-text' && a.contents === contents,\n );\n if (!box) throw new Error(`no text box ${JSON.stringify(contents)}`);\n return box;\n };\n\n const appearanceOf = async (page: PageHandle, ref: Annotation['ref']): Promise<Raster> => {\n const { appearances } = await page.annotations.renderAppearances({ format: 'png' });\n const found = appearances.find(\n (a) => a.mode === 'normal' && annotationKey(a.ref) === annotationKey(ref),\n );\n if (!found) throw new Error('no appearance');\n const { url, revoke } = await found.image.objectUrl();\n try {\n return await decodePng(new Uint8Array(await (await fetch(url)).arrayBuffer()));\n } finally {\n revoke();\n }\n };\n\n test('a stamp Acrobat turned reads its turn and its own box', async () => {\n await onPage('acrobat-stamp-rotated', async (page, layout) => {\n const stamp = await stampOf(page);\n expect(stamp.rotation).toBe(36);\n // Acrobat stores no box: it's the drawing's own, stretched onto /Rect.\n // The numbers are the file's, as Acrobat reports them.\n expectRect(\n stamp.box,\n pageBoxOf(\n { left: 155.784, bottom: 508.966, right: 466.366, top: 618.542 },\n layout.pdfCropBox,\n ),\n 0.02,\n );\n expectRect(\n stamp.rect,\n pageBoxOf(\n { left: 153.238, bottom: 428.152, right: 468.912, top: 699.356 },\n layout.pdfCropBox,\n ),\n 0.01,\n );\n });\n });\n\n test('a text box Acrobat turned a quarter reads its turn', async () => {\n await onPage('acrobat-freetext-rotated', async (page, layout) => {\n const turned = await textBoxOf(page, 'test 123');\n // /Rotate 90 is counterclockwise: the text reads from the bottom up.\n expect(turned.rotation).toBe(270);\n expectRect(\n turned.box,\n pageBoxOf(\n { left: 233.423, bottom: 309.413, right: 341.423, top: 341.423 },\n layout.pdfCropBox,\n ),\n 0.01,\n );\n const upright = await textBoxOf(page, 'test\\rtest 123');\n expect(upright.rotation).toBeNull();\n expectRect(upright.box, upright.rect, 0);\n });\n });\n\n test('a change to a text box Acrobat turned keeps it turned', async () => {\n await onPage('acrobat-freetext-rotated', async (page) => {\n const turned = await textBoxOf(page, 'test 123');\n const { annotation } = await page.annotations.update(turned.ref, {\n subtype: 'free-text',\n color: '#c8e6ff',\n });\n const updated = annotation as FreeText;\n expect(updated.rotation).toBe(270);\n expectRect(updated.box, turned.box, 0.01);\n expectRect(updated.rect, turned.rect, 0.01);\n // Turned back, the text box is wide: its text still runs along it.\n const raster = await appearanceOf(page, updated.ref);\n expect(raster.width > 2 * raster.height).toBe(true);\n });\n });\n\n test('moving a stamp Acrobat turned turns it once', async () => {\n await onPage('acrobat-stamp-rotated', async (page) => {\n const stamp = await stampOf(page);\n const moved = { ...stamp.box, x: stamp.box.x + 40 };\n const { annotation } = await page.annotations.update(stamp.ref, {\n subtype: 'stamp',\n box: moved,\n rotation: stamp.rotation,\n });\n const updated = annotation as Stamp;\n expect(updated.rotation).toBe(36);\n expectRect(updated.box, moved, 0.02);\n expectRect(updated.rect, { ...stamp.rect, x: stamp.rect.x + 40 }, 0.02);\n // Its drawing is upright under the turn: the wide stamp, not its turn.\n const drawing = await page.annotations.downloadResource(updated.ref, 'appearance');\n const [width, height] = pageSize(drawing);\n expect(Math.abs(width / height - 906.89 / 319.96) < 0.01).toBe(true);\n });\n });\n\n test(\"a turned box's rect is the upright box around it\", async () => {\n await onPage('authoring', async (page) => {\n const { annotation } = await page.annotations.create({\n subtype: 'square',\n box: { x: 100, y: 100, width: 200, height: 200 },\n rotation: 30,\n });\n // 200 × 200 turned 30° is 273.2 across, about the same middle.\n expectRect(\n annotation.rect,\n { x: 63.397, y: 63.397, width: 273.206, height: 273.206 },\n 0.01,\n );\n expect((annotation as { rotation: number | null }).rotation).toBe(30);\n });\n });\n\n test('a create gives a quarter turn by where it stands: its rect, the box worked out', async () => {\n await onPage('authoring', async (page) => {\n const rect = { x: 100, y: 100, width: 40, height: 160 };\n const { annotation: square } = await page.annotations.create({\n subtype: 'square',\n rect,\n rotation: 90,\n });\n expectRect(square.rect, rect, 0.01);\n expect((square as { rotation: number | null }).rotation).toBe(90);\n // The box is the rect with its sides swapped, about the same middle.\n expectRect(\n (square as { box: PageBox }).box,\n { x: 40, y: 160, width: 160, height: 40 },\n 0.01,\n );\n\n const { annotation: text } = await page.annotations.create({\n subtype: 'free-text',\n rect: { x: 300, y: 100, width: 30, height: 200 },\n rotation: 270,\n contents: 'Up the page',\n });\n expectRect(text.rect, { x: 300, y: 100, width: 30, height: 200 }, 0.01);\n expectRect((text as FreeText).box, { x: 215, y: 185, width: 200, height: 30 }, 0.01);\n });\n });\n\n test('a rect places a box at a quarter turn only, and a create gives one or the other', async () => {\n await onPage('authoring', async (page) => {\n const refusal = (draft: Record<string, unknown>) =>\n page.annotations.create({ subtype: 'square', ...draft } as never).then(\n () => null,\n (error: unknown) => error as { code?: string; details?: Record<string, unknown> },\n );\n const tilted = await refusal({\n rect: { x: 10, y: 10, width: 40, height: 40 },\n rotation: 20,\n });\n expect(tilted).toMatchObject({\n code: EngineErrorCode.InvalidArg,\n details: { field: 'rect' },\n });\n const neither = await refusal({ rotation: 90 });\n expect(neither).toMatchObject({\n code: EngineErrorCode.InvalidArg,\n details: { field: 'box' },\n });\n const { annotations } = await page.annotations.list();\n expect(annotations).toHaveLength(0);\n });\n });\n\n test('a rect resizes a box at a quarter turn along its own sides', async () => {\n await onPage('authoring', async (page) => {\n const { annotation } = await page.annotations.create({\n subtype: 'square',\n box: { x: 100, y: 100, width: 160, height: 40 },\n rotation: 90,\n });\n const rect = { x: 120, y: 40, width: 60, height: 200 };\n const { annotation: resized } = await page.annotations.update(annotation.ref, { rect });\n expectRect(resized.rect, rect, 0.01);\n expect((resized as { rotation: number | null }).rotation).toBe(90);\n expectRect(\n (resized as { box: PageBox }).box,\n { x: 50, y: 110, width: 200, height: 60 },\n 0.01,\n );\n });\n });\n\n test('a turned drawing that reaches past its box is drawn as the page shows it', async () => {\n await onPage('authoring', async (page) => {\n const box = { x: 200, y: 400, width: 100, height: 60 };\n const { annotation: plain } = await page.annotations.create({\n subtype: 'square',\n box,\n rotation: 30,\n });\n const { annotation: cloudy } = await page.annotations.create({\n subtype: 'square',\n box: { ...box, y: 200 },\n rotation: 30,\n cloudyIntensity: 1,\n strokeWidth: 2,\n });\n // The bumps reach past the turned box: `rect` takes them in.\n const turned = turnedBounds(box, 30);\n expectRect(plain.rect, turned, 0.01);\n expect(cloudy.rect.width > turned.width + 2).toBe(true);\n // Inside its turned box, a drawing renders upright over its box, for\n // the consumer to turn. Past it, it renders as the page shows it.\n const { appearances } = await page.annotations.renderAppearances();\n const rectOf = (ref: Annotation['ref']) =>\n appearances.find(\n (a) => a.mode === 'normal' && annotationKey(a.ref) === annotationKey(ref),\n )!.rect;\n expectRect(rectOf(plain.ref), (plain as { box: PageBox }).box, 0.01);\n expectRect(rectOf(cloudy.ref), cloudy.rect, 0.01);\n });\n });\n\n test('rotation turns clockwise, as the page shows it', async () => {\n await onPage('authoring', async (page) => {\n const box = { x: 200, y: 300, width: 100, height: 100 };\n await page.annotations.create({\n subtype: 'square',\n box,\n rotation: 30,\n color: '#0000ff',\n interiorColor: '#0000ff',\n });\n // A square turned clockwise has its highest corner left of its middle.\n const area = { x: 150, y: 250, width: 200, height: 200 };\n const image = await page.render.image({\n format: 'png',\n target: { kind: 'rect', rect: area },\n });\n const { url, revoke } = await image.objectUrl();\n let raster: Raster;\n try {\n raster = await decodePng(new Uint8Array(await (await fetch(url)).arrayBuffer()));\n } finally {\n revoke();\n }\n const top = highestInk(raster);\n expect(top !== null).toBe(true);\n expect(top! < raster.width / 2).toBe(true);\n });\n });\n });\n}\n\n/**\n * The upright box around `box` turned about its middle: the same whichever\n * way y points, so the file-space helper serves.\n */\nfunction turnedBounds(box: PageBox, degrees: number): PageBox {\n const turned = pdfRectTurnedBounds(\n { left: box.x, bottom: box.y, right: box.x + box.width, top: box.y + box.height },\n degrees,\n );\n return {\n x: turned.left,\n y: turned.bottom,\n width: turned.right - turned.left,\n height: turned.top - turned.bottom,\n };\n}\n\n/** The x of the first pixel, from the top, that isn't white; `null` when none is. */\nfunction highestInk(raster: Raster): number | null {\n for (let y = 0; y < raster.height; y++) {\n for (let x = 0; x < raster.width; x++) {\n const at = (y * raster.width + x) * 4;\n const [r, g, b] = [raster.rgba[at]!, raster.rgba[at + 1]!, raster.rgba[at + 2]!];\n if (r < 128 && g < 128 && b > 128) return x;\n }\n }\n return null;\n}\n\nfunction pageSize(pdf: Uint8Array): [number, number] {\n const text = new TextDecoder('latin1').decode(pdf);\n const box = /\\/MediaBox\\s*\\[\\s*([-\\d.]+)\\s+([-\\d.]+)\\s+([-\\d.]+)\\s+([-\\d.]+)\\s*\\]/.exec(text);\n if (!box) throw new Error('no /MediaBox');\n return [Number(box[3]) - Number(box[1]), Number(box[4]) - Number(box[2])];\n}\n","import { decodePng, type Raster } from './appearanceRasters';\nimport { pdfOf } from './pdfOf';\nimport type { ConformanceTestRunner } from './runMetadataConformance';\nimport type { PageLayout } from '../dto/PageLayout';\nimport type { PageImageHandle, PageImageOptions } from '../dto/PageRender';\nimport type { DocumentHandle } from '../engine/DocumentHandle';\nimport type { Engine } from '../engine/Engine';\nimport type { PageHandle } from '../engine/PageHandle';\nimport { EngineErrorCode } from '../errors/EngineErrorCode';\nimport { pageTransform } from '../geometry/pageTransform';\nimport { annotationKey } from '../identity/annotationKey';\n\nconst SQUARE_CONTENT = '0 g 200 300 100 100 re f';\n\n/**\n * A 600 × 800 page cropped to [100 200 500 600], so its visible area does\n * not start at 0,0, with a black square at 200..300 × 300..400 in file\n * coordinates (the coordinates annotation rects use).\n */\nexport const CROP_OFFSET_PDF = pdfOf([\n '<< /Type /Catalog /Pages 2 0 R >>',\n '<< /Type /Pages /Kids [3 0 R] /Count 1 >>',\n '<< /Type /Page /Parent 2 0 R /MediaBox [0 0 600 800] /CropBox [100 200 500 600] /Contents 4 0 R /Resources << >> >>',\n `<< /Length ${SQUARE_CONTENT.length} >>\\nstream\\n${SQUARE_CONTENT}\\nendstream`,\n]);\n\n/** The square in page space: from the crop box's top-left (100, 600), y down. */\nconst SQUARE_ON_PAGE = { x: 100, y: 200, width: 100, height: 100 };\n\nexport interface PageRenderConformanceOptions {\n label: string;\n /** Build a fresh engine for this suite. The suite tears it down at the end. */\n makeEngine: () => Promise<Engine> | Engine;\n /** Open a fresh copy of {@link CROP_OFFSET_PDF}. */\n open: (engine: Engine) => Promise<DocumentHandle>;\n}\n\n/**\n * Page images on both engines: an image reports the size of its pixels and\n * where they are on the page (its transform, the one `pageTransform` gives\n * without rendering), a target rect is in page space like every other place\n * (so a page whose crop box doesn't start at 0,0 renders the area asked\n * for), `blob()` is the image's bytes, and quality goes from 0 to 1.\n */\nexport function runPageRenderConformance(\n runner: ConformanceTestRunner,\n opts: PageRenderConformanceOptions,\n): void {\n const { describe, test, beforeAll, afterAll, expect } = runner;\n\n describe(`page render conformance: ${opts.label}`, () => {\n let engine: Engine;\n let doc: DocumentHandle;\n let page: PageHandle;\n let layout: PageLayout;\n\n beforeAll(async () => {\n engine = await opts.makeEngine();\n doc = await opts.open(engine);\n const { pages } = await doc.pages.list();\n layout = pages[0]!;\n page = doc.page(layout.ref);\n });\n\n afterAll(async () => {\n if (doc) await doc.close();\n if (engine) await engine.destroy();\n });\n\n test('the layout reports where the page sits in PDF space', async () => {\n const { pages } = await doc.pages.list();\n expect(pages[0]!.size).toEqual({ width: 400, height: 400 });\n expect(pages[0]!.pdfCropBox).toEqual({ left: 100, bottom: 200, right: 500, top: 600 });\n expect(pages[0]!.boxes.crop).toEqual({ x: 0, y: 0, width: 400, height: 400 });\n });\n\n test('an image reports the size of its pixels', async () => {\n const cases: Array<{ options: PageImageOptions; size: [number, number] }> = [\n { options: {}, size: [400, 400] },\n { options: { viewport: { kind: 'scale', scale: 0.25 } }, size: [100, 100] },\n { options: { viewport: { kind: 'width', width: 123 } }, size: [123, 123] },\n {\n options: {\n target: { kind: 'rect', rect: { x: 100, y: 250, width: 100, height: 50 } },\n rotation: 90,\n },\n size: [50, 100],\n },\n {\n options: {\n target: { kind: 'rect', rect: { x: 100, y: 250, width: 100, height: 50 } },\n viewport: { kind: 'width', width: 30 },\n },\n size: [30, 15],\n },\n ];\n for (const { options, size } of cases) {\n const image = await page.render.image({ format: 'png', ...options });\n const raster = await decode(image);\n expect([image.width, image.height]).toEqual(size);\n expect([raster.width, raster.height]).toEqual(size);\n }\n });\n\n test('a page image starts at the crop box', async () => {\n const raster = await decode(\n await page.render.image({ format: 'png', viewport: { kind: 'scale', scale: 0.5 } }),\n );\n // The square is 100..200 from the crop box's left and 200..300 from its top.\n expect(isDark(pixel(raster, 75, 125))).toBe(true);\n expect(isDark(pixel(raster, 25, 25))).toBe(false);\n });\n\n test(\"a target rect is in page space, from the crop box's top-left\", async () => {\n const square = await decode(\n await page.render.image({\n format: 'png',\n target: { kind: 'rect', rect: SQUARE_ON_PAGE },\n viewport: { kind: 'scale', scale: 0.1 },\n }),\n );\n expect([square.width, square.height]).toEqual([10, 10]);\n expect(everyPixel(square, isDark)).toBe(true);\n\n const beside = await decode(\n await page.render.image({\n format: 'png',\n target: { kind: 'rect', rect: { x: 200, y: 200, width: 100, height: 100 } },\n viewport: { kind: 'scale', scale: 0.1 },\n }),\n );\n expect(everyPixel(beside, (rgba) => !isDark(rgba))).toBe(true);\n });\n\n test('an appearance on a cropped page renders its own area', async () => {\n const { annotation } = await page.annotations.create({\n subtype: 'square',\n box: SQUARE_ON_PAGE,\n color: '#ff0000',\n interiorColor: '#ff0000',\n });\n try {\n const { appearances } = await page.annotations.renderAppearances({ format: 'png' });\n const found = appearances.find(\n (a) => a.mode === 'normal' && annotationKey(a.ref) === annotationKey(annotation.ref),\n );\n expect(found !== undefined).toBe(true);\n // Placed in page space: the square, give or take its border.\n const { x, y, width, height } = found!.rect;\n expect(Math.abs(x - SQUARE_ON_PAGE.x) <= 2 && Math.abs(y - SQUARE_ON_PAGE.y) <= 2).toBe(\n true,\n );\n expect(Math.abs(width - 100) <= 4 && Math.abs(height - 100) <= 4).toBe(true);\n const raster = await decode(found!.image);\n const [r, g, b, a] = pixel(raster, raster.width >> 1, raster.height >> 1);\n expect(r > 200 && g < 60 && b < 60 && a > 200).toBe(true);\n } finally {\n await page.annotations.delete(annotation.ref);\n }\n });\n\n test(\"an image's transform is pageTransform's, and puts the page where its pixels are\", async () => {\n const cases: PageImageOptions[] = [\n { viewport: { kind: 'scale', scale: 0.5 } },\n { viewport: { kind: 'scale', scale: 0.5 }, rotation: 90 },\n { viewport: { kind: 'width', width: 150 }, rotation: 180 },\n { viewport: { kind: 'width', width: 150 }, rotation: 270 },\n {\n target: { kind: 'rect', rect: { x: 50, y: 150, width: 200, height: 160 } },\n viewport: { kind: 'width', width: 100 },\n rotation: 90,\n },\n ];\n for (const options of cases) {\n const image = await page.render.image({ format: 'png', ...options });\n const { transform } = image;\n expect([transform.width, transform.height]).toEqual([image.width, image.height]);\n const expected = pageTransform(layout, options);\n expect([expected.width, expected.height]).toEqual([image.width, image.height]);\n expect(transform.matrix.every((n, i) => Math.abs(n - expected.matrix[i]!) < 1e-9)).toBe(\n true,\n );\n\n // The square's middle is dark in the pixels the transform names; a\n // spot away from it is not.\n const raster = await decode(image);\n const inside = transform.pageToPixels({ x: 150, y: 250 });\n expect(isDark(pixel(raster, Math.floor(inside.x), Math.floor(inside.y)))).toBe(true);\n const outside = transform.pageToPixels({ x: 70, y: 250 });\n expect(isDark(pixel(raster, Math.floor(outside.x), Math.floor(outside.y)))).toBe(false);\n const back = transform.pixelsToPage(inside);\n expect(Math.abs(back.x - 150) < 1e-9 && Math.abs(back.y - 250) < 1e-9).toBe(true);\n }\n });\n\n test('blob() is the image, the same bytes its object URL serves', async () => {\n const image = await page.render.image({\n format: 'png',\n viewport: { kind: 'scale', scale: 0.25 },\n });\n const blob = await image.blob();\n expect(blob.type).toBe(image.contentType);\n const bytes = new Uint8Array(await blob.arrayBuffer());\n const decoded = await decodePng(bytes);\n expect([decoded.width, decoded.height]).toEqual([image.width, image.height]);\n\n const { url, revoke } = await image.objectUrl();\n try {\n const served = new Uint8Array(await (await fetch(url)).arrayBuffer());\n expect(served.length === bytes.length && served.every((b, i) => b === bytes[i])).toBe(true);\n } finally {\n revoke();\n }\n });\n\n test('quality goes from 0 to 1', async () => {\n for (const quality of [0, 0.5, 1]) {\n const image = await page.render.image({\n format: 'png',\n quality,\n viewport: { kind: 'scale', scale: 0.1 },\n });\n expect([image.width, image.height]).toEqual([40, 40]);\n }\n for (const quality of [-0.1, 1.5, 80]) {\n await expect(\n page.render.image({ format: 'png', quality, viewport: { kind: 'scale', scale: 0.1 } }),\n ).rejects.toMatchObject({ code: EngineErrorCode.InvalidArg });\n }\n });\n });\n}\n\n/** The image's pixels, read the way an app would on either engine: through `blob()`. */\nasync function decode(image: PageImageHandle): Promise<Raster> {\n return decodePng(new Uint8Array(await (await image.blob()).arrayBuffer()));\n}\n\nfunction pixel(raster: Raster, x: number, y: number): [number, number, number, number] {\n const at = (y * raster.width + x) * 4;\n const { rgba } = raster;\n return [rgba[at]!, rgba[at + 1]!, rgba[at + 2]!, rgba[at + 3]!];\n}\n\nfunction isDark([r, g, b]: readonly number[]): boolean {\n return r! < 60 && g! < 60 && b! < 60;\n}\n\nfunction everyPixel(raster: Raster, check: (rgba: readonly number[]) => boolean): boolean {\n for (let y = 0; y < raster.height; y++) {\n for (let x = 0; x < raster.width; x++) {\n if (!check(pixel(raster, x, y))) return false;\n }\n }\n return true;\n}\n","import { pdfOf } from './pdfOf';\nimport type { PageTabOrder } from '../dto/PageLayout';\nimport type { PdfRect, PdfRotation } from '../geometry/primitives';\n\n/**\n * Small PDFs whose page boxes are odd in every way ISO 32000 allows, and in\n * the ways broken files are odd, each with its answer written out by hand:\n * the visible page box, the five boxes, the turn and the unit size. The\n * answers come from the standard, never from our code, so a check against\n * them is a check of our code:\n * - ISO 32000-1 Table 30 and §7.7.3.4: which boxes a page inherits;\n * - ISO 32000-1 §7.9.5: a box's corners in any order;\n * - ISO 32000-1 §14.11.2: the defaults, and every box inside the media box.\n * For broken files the standard has no answer; those carry our rule and say\n * so.\n *\n * Each page draws black squares (`marks`) and words at known places in file\n * coordinates, so a render shows where the page's corner really is.\n */\n\n/** A word drawn in Helvetica, its baseline starting at `x, y` (file coordinates). */\nexport interface PageSpaceWord {\n text: string;\n x: number;\n y: number;\n size: number;\n}\n\n/** A destination: a spot on a page of the same file, as the file writes it, with its answer. */\nexport interface PageSpaceGoTo {\n /** The index of the page it goes to. */\n toPage: number;\n /** The destination array after the page reference, as the file writes it. */\n view: string;\n /**\n * The destination measured from the top-left of the target page's visible\n * box (x from its left edge, y from its top edge); `null` keeps the current\n * value.\n */\n expected: {\n kind: 'xyz' | 'fitH' | 'fitV' | 'fitR';\n x?: number | null;\n y?: number | null;\n width?: number;\n height?: number;\n };\n}\n\n/** A link on a page to a spot on another page of the same file. */\nexport interface PageSpaceLink extends PageSpaceGoTo {\n /** Where the link sits, in file coordinates. */\n rect: PdfRect;\n}\n\nexport interface PageSpaceBoxes {\n media: PdfRect;\n crop: PdfRect;\n bleed: PdfRect;\n trim: PdfRect;\n art: PdfRect;\n}\n\nexport interface PageSpaceFixturePage {\n /** The page dictionary's own entries: boxes, `/Rotate`, `/UserUnit`. */\n entries: string;\n marks: PdfRect[];\n words: PageSpaceWord[];\n links?: PageSpaceLink[];\n /** The page's open action (`/AA /O`): a go-to. */\n openAction?: PageSpaceGoTo;\n expected: {\n /** The visible page box: what the page shows, in file coordinates. */\n visible: PdfRect;\n /** The five boxes as ISO defines them: defaults applied, reduced to the media box. */\n boxes: PageSpaceBoxes;\n rotation: PdfRotation;\n userUnit: number;\n /** The order its annotations take focus in (`/Tabs`); none when the page sets none. */\n tabOrder?: PageTabOrder;\n };\n}\n\nexport interface PageSpaceFixture {\n name: string;\n /** The rule the fixture checks. */\n about: string;\n /**\n * `iso`: the answers are the standard's. `recovery`: the file is broken and\n * the answers are our rule, which is what Acrobat shows.\n */\n source: 'iso' | 'recovery';\n /** Entries of the page tree node, inherited by pages that don't set them. */\n treeEntries?: string;\n /** The catalog's `/OpenAction` as a destination: where the document opens. */\n openDestination?: PageSpaceGoTo;\n /** A text field on the first page whose calculate script goes on (`/Next`) to a destination. */\n fieldAction?: PageSpaceGoTo;\n pages: PageSpaceFixturePage[];\n bytes: Uint8Array;\n}\n\nconst rect = (left: number, bottom: number, right: number, top: number): PdfRect => ({\n left,\n bottom,\n right,\n top,\n});\n\n/** Every box the same: a page with only a media box, or crop defaults all round. */\nconst sameBoxes = (media: PdfRect, crop: PdfRect = media): PageSpaceBoxes => ({\n media,\n crop,\n bleed: crop,\n trim: crop,\n art: crop,\n});\n\ninterface FixtureSpec {\n name: string;\n about: string;\n source: PageSpaceFixture['source'];\n treeEntries?: string;\n openDestination?: PageSpaceGoTo;\n fieldAction?: PageSpaceGoTo;\n pages: PageSpaceFixturePage[];\n}\n\nfunction contentOf(page: PageSpaceFixturePage): string {\n const marks = page.marks.map(\n (m) => `0 g ${m.left} ${m.bottom} ${m.right - m.left} ${m.top - m.bottom} re f`,\n );\n const words = page.words.map((w) => `BT /F1 ${w.size} Tf 0 g ${w.x} ${w.y} Td (${w.text}) Tj ET`);\n return [...marks, ...words].join('\\n');\n}\n\n/**\n * Objects: 1 catalog, 2 page tree, 3 font, then a page and its content per\n * page, then the link annotations, then the text field.\n */\nfunction build(spec: FixtureSpec): PageSpaceFixture {\n const pageNumber = (index: number) => 4 + index * 2;\n const links = spec.pages.flatMap((page, index) =>\n (page.links ?? []).map((link) => ({ link, from: index })),\n );\n const firstLink = 4 + spec.pages.length * 2;\n const destination = (goTo: PageSpaceGoTo) => `[${pageNumber(goTo.toPage)} 0 R ${goTo.view}]`;\n const openAction = spec.openDestination\n ? ` /OpenAction ${destination(spec.openDestination)}`\n : '';\n const field = firstLink + links.length;\n const acroForm = spec.fieldAction ? ` /AcroForm << /Fields [${field} 0 R] >>` : '';\n const objects: string[] = [\n `<< /Type /Catalog /Pages 2 0 R${openAction}${acroForm} >>`,\n `<< /Type /Pages /Kids [${spec.pages.map((_, i) => `${pageNumber(i)} 0 R`).join(' ')}] /Count ${spec.pages.length} ${spec.treeEntries ?? ''} >>`,\n '<< /Type /Font /Subtype /Type1 /BaseFont /Helvetica /Encoding /WinAnsiEncoding >>',\n ];\n spec.pages.forEach((page, index) => {\n const own = links\n .map((entry, i) => ({ ...entry, number: firstLink + i }))\n .filter((entry) => entry.from === index)\n .map((entry) => `${entry.number} 0 R`);\n if (spec.fieldAction && index === 0) own.push(`${field} 0 R`);\n const annots = own.length ? ` /Annots [${own.join(' ')}]` : '';\n const actions = page.openAction\n ? ` /AA << /O << /S /GoTo /D ${destination(page.openAction)} >> >>`\n : '';\n const content = contentOf(page);\n objects.push(\n `<< /Type /Page /Parent 2 0 R ${page.entries} /Resources << /Font << /F1 3 0 R >> >> /Contents ${pageNumber(index) + 1} 0 R${annots}${actions} >>`,\n `<< /Length ${content.length} >>\\nstream\\n${content}\\nendstream`,\n );\n });\n for (const { link } of links) {\n const r = link.rect;\n objects.push(\n `<< /Type /Annot /Subtype /Link /Rect [${r.left} ${r.bottom} ${r.right} ${r.top}] /Border [0 0 0] /Dest ${destination(link)} >>`,\n );\n }\n if (spec.fieldAction) {\n const { left, bottom } = spec.pages[0]!.expected.visible;\n const goTo = `<< /S /GoTo /D ${destination(spec.fieldAction)} >>`;\n objects.push(\n `<< /Type /Annot /Subtype /Widget /FT /Tx /T (total) /P ${pageNumber(0)} 0 R /Rect [${left + 40} ${bottom + 120} ${left + 140} ${bottom + 140}] /AA << /C << /S /JavaScript /JS (event.value = 1;) /Next ${goTo} >> >> >>`,\n );\n }\n return { ...spec, bytes: pdfOf(objects) };\n}\n\nconst LETTER = rect(0, 0, 612, 792);\n\n/** What a box that shares nothing with the media box becomes. */\nconst EMPTY: PdfRect = { left: 0, right: 0, bottom: 0, top: 0 };\n\n/** A page on `media` (cropped to `crop`) with a mark and a word placed inside `visible`. */\nfunction markedPage(\n entries: string,\n visible: PdfRect,\n expected: Omit<PageSpaceFixturePage['expected'], 'visible'>,\n extra: Partial<Pick<PageSpaceFixturePage, 'links' | 'openAction'>> = {},\n): PageSpaceFixturePage {\n const { left, top, right, bottom } = visible;\n return {\n entries,\n // One mark near the top-left corner, one near the bottom-right: a page\n // measured from the wrong corner puts at least one of them wrong.\n marks: [\n rect(left + 40, top - 90, left + 90, top - 40),\n rect(right - 90, bottom + 40, right - 40, bottom + 90),\n ],\n words: [{ text: 'Corner', x: left + 40, y: top - 160, size: 24 }],\n ...extra,\n expected: { visible, ...expected },\n };\n}\n\nexport const PAGE_SPACE_FIXTURES: readonly PageSpaceFixture[] = [\n build({\n name: 'letter',\n about: 'the control: a media box at 0,0 and nothing else',\n source: 'iso',\n pages: [\n markedPage('/MediaBox [0 0 612 792]', LETTER, {\n boxes: sameBoxes(LETTER),\n rotation: 0,\n userUnit: 1,\n }),\n ],\n }),\n build({\n name: 'tab-order',\n about: 'a page that says the order its annotations take focus in (/Tabs), as it writes it',\n source: 'iso',\n pages: [\n markedPage('/MediaBox [0 0 612 792] /Tabs /S', LETTER, {\n boxes: sameBoxes(LETTER),\n rotation: 0,\n userUnit: 1,\n tabOrder: 'structure',\n }),\n ],\n }),\n build({\n name: 'negative-origin',\n about: 'a media box around 0,0, so its corner is at negative numbers',\n source: 'iso',\n pages: [\n markedPage('/MediaBox [-306 -396 306 396]', rect(-306, -396, 306, 396), {\n boxes: sameBoxes(rect(-306, -396, 306, 396)),\n rotation: 0,\n userUnit: 1,\n }),\n ],\n }),\n build({\n name: 'cad-origin',\n about: 'a large drawing centred on 0,0, as CAD programs export (v2 issue #625)',\n source: 'iso',\n pages: [\n markedPage('/MediaBox [-1685 -1192 1685 1192]', rect(-1685, -1192, 1685, 1192), {\n boxes: sameBoxes(rect(-1685, -1192, 1685, 1192)),\n rotation: 0,\n userUnit: 1,\n }),\n ],\n }),\n build({\n name: 'crop-inside',\n about: 'a crop box inside the media box, away from its corner',\n source: 'iso',\n pages: [\n markedPage('/MediaBox [0 0 612 792] /CropBox [50 60 562 732]', rect(50, 60, 562, 732), {\n boxes: sameBoxes(LETTER, rect(50, 60, 562, 732)),\n rotation: 0,\n userUnit: 1,\n }),\n ],\n }),\n build({\n name: 'crop-past-media',\n about: 'a crop box reaching past the media box is reduced to their intersection (§14.11.2)',\n source: 'iso',\n pages: [\n markedPage('/MediaBox [0 0 612 792] /CropBox [300 400 900 1000]', rect(300, 400, 612, 792), {\n boxes: sameBoxes(LETTER, rect(300, 400, 612, 792)),\n rotation: 0,\n userUnit: 1,\n }),\n ],\n }),\n build({\n name: 'flipped-corners',\n about: 'boxes given by their other corners are normalized (§7.9.5)',\n source: 'iso',\n pages: [\n markedPage('/MediaBox [612 792 0 0] /CropBox [562 732 50 60]', rect(50, 60, 562, 732), {\n boxes: sameBoxes(LETTER, rect(50, 60, 562, 732)),\n rotation: 0,\n userUnit: 1,\n }),\n ],\n }),\n build({\n name: 'inherited',\n about:\n 'media box, crop box and /Rotate are inherited from the page tree; bleed, trim and art boxes are not (Table 30)',\n source: 'iso',\n treeEntries:\n '/MediaBox [0 0 500 700] /CropBox [20 30 480 680] /Rotate 90 /BleedBox [0 0 500 700] /TrimBox [10 10 490 690]',\n pages: [\n markedPage('', rect(20, 30, 480, 680), {\n boxes: sameBoxes(rect(0, 0, 500, 700), rect(20, 30, 480, 680)),\n rotation: 90,\n userUnit: 1,\n }),\n markedPage('/MediaBox [0 0 300 400] /Rotate 0', rect(20, 30, 300, 400), {\n boxes: sameBoxes(rect(0, 0, 300, 400), rect(20, 30, 300, 400)),\n rotation: 0,\n userUnit: 1,\n }),\n ],\n }),\n build({\n name: 'page-boxes',\n about:\n 'bleed, trim and art boxes: a missing one defaults to the crop box, one past the media box is reduced to it (§14.11.2)',\n source: 'iso',\n pages: [\n markedPage(\n '/MediaBox [0 0 612 792] /CropBox [36 36 576 756] /BleedBox [30 30 582 762] /TrimBox [-10 -10 700 900]',\n rect(36, 36, 576, 756),\n {\n boxes: {\n media: LETTER,\n crop: rect(36, 36, 576, 756),\n bleed: rect(30, 30, 582, 762),\n trim: LETTER,\n art: rect(36, 36, 576, 756),\n },\n rotation: 0,\n userUnit: 1,\n },\n ),\n ],\n }),\n build({\n name: 'turned',\n about:\n \"a page's /Rotate never moves its positions; negative and full-turn values are the same turn (Table 30)\",\n source: 'iso',\n pages: ([90, 180, 270, -90, 450] as const).map((turn) =>\n markedPage(\n `/MediaBox [0 0 612 792] /CropBox [50 60 562 732] /Rotate ${turn}`,\n rect(50, 60, 562, 732),\n {\n boxes: sameBoxes(LETTER, rect(50, 60, 562, 732)),\n rotation: (((turn % 360) + 360) % 360) as PdfRotation,\n userUnit: 1,\n },\n ),\n ),\n }),\n build({\n name: 'user-unit',\n about: '/UserUnit changes the size of a unit, not the numbers',\n source: 'iso',\n pages: [\n markedPage('/MediaBox [0 0 306 396] /UserUnit 2', rect(0, 0, 306, 396), {\n boxes: sameBoxes(rect(0, 0, 306, 396)),\n rotation: 0,\n userUnit: 2,\n }),\n ],\n }),\n build({\n name: 'destinations',\n about: \"a destination is measured from its target page's visible box, not the link's page\",\n source: 'iso',\n openDestination: {\n toPage: 1,\n view: '/FitR -200 -100 100 300',\n expected: { kind: 'fitR', x: 100, y: 90, width: 300, height: 400 },\n },\n fieldAction: { toPage: 1, view: '/FitH 350', expected: { kind: 'fitH', y: 40 } },\n pages: [\n markedPage(\n '/MediaBox [0 0 612 792]',\n LETTER,\n { boxes: sameBoxes(LETTER), rotation: 0, userUnit: 1 },\n {\n openAction: {\n toPage: 1,\n view: '/XYZ -250 350 0',\n expected: { kind: 'xyz', x: 50, y: 40 },\n },\n links: [\n {\n rect: rect(400, 700, 500, 740),\n toPage: 1,\n view: '/XYZ -250 350 0',\n expected: { kind: 'xyz', x: 50, y: 40 },\n },\n {\n rect: rect(400, 640, 500, 680),\n toPage: 1,\n view: '/XYZ null null 0',\n expected: { kind: 'xyz', x: null, y: null },\n },\n {\n rect: rect(400, 580, 500, 620),\n toPage: 1,\n view: '/FitR -200 -100 100 300',\n expected: { kind: 'fitR', x: 100, y: 90, width: 300, height: 400 },\n },\n ],\n },\n ),\n markedPage(\n '/MediaBox [-306 -396 306 396] /CropBox [-300 -390 300 390]',\n rect(-300, -390, 300, 390),\n {\n boxes: sameBoxes(rect(-306, -396, 306, 396), rect(-300, -390, 300, 390)),\n rotation: 0,\n userUnit: 1,\n },\n {\n openAction: { toPage: 0, view: '/FitV 30', expected: { kind: 'fitV', x: 30 } },\n links: [\n {\n rect: rect(100, 300, 200, 340),\n toPage: 0,\n view: '/FitH 700',\n expected: { kind: 'fitH', y: 92 },\n },\n {\n rect: rect(100, 240, 200, 280),\n toPage: 0,\n view: '/FitV 30',\n expected: { kind: 'fitV', x: 30 },\n },\n ],\n },\n ),\n ],\n }),\n build({\n name: 'no-media-box',\n about: 'a page without a media box (required, so the file is broken): US Letter',\n source: 'recovery',\n pages: [markedPage('', LETTER, { boxes: sameBoxes(LETTER), rotation: 0, userUnit: 1 })],\n }),\n build({\n name: 'empty-media-box',\n about: 'a media box with no area (broken): US Letter',\n source: 'recovery',\n pages: [\n markedPage('/MediaBox [0 0 0 0]', LETTER, {\n boxes: sameBoxes(LETTER),\n rotation: 0,\n userUnit: 1,\n }),\n ],\n }),\n build({\n name: 'short-crop-box',\n about: 'a crop box of three numbers (broken) counts as missing',\n source: 'recovery',\n pages: [\n markedPage('/MediaBox [0 0 612 792] /CropBox [50 60 562]', LETTER, {\n boxes: sameBoxes(LETTER),\n rotation: 0,\n userUnit: 1,\n }),\n ],\n }),\n build({\n name: 'bad-user-unit',\n about: 'a /UserUnit of zero or below (broken) counts as 1',\n source: 'recovery',\n pages: [\n markedPage('/MediaBox [0 0 612 792] /UserUnit 0', LETTER, {\n boxes: sameBoxes(LETTER),\n rotation: 0,\n userUnit: 1,\n }),\n markedPage('/MediaBox [0 0 612 792] /UserUnit -2', LETTER, {\n boxes: sameBoxes(LETTER),\n rotation: 0,\n userUnit: 1,\n }),\n ],\n }),\n build({\n name: 'crop-outside-media',\n about: 'a crop box entirely outside the media box (broken): an empty page, as Acrobat shows it',\n source: 'recovery',\n pages: [\n markedPage('/MediaBox [0 0 612 792] /CropBox [700 800 900 1000]', EMPTY, {\n boxes: sameBoxes(LETTER, EMPTY),\n rotation: 0,\n userUnit: 1,\n }),\n ],\n }),\n build({\n name: 'odd-rotate',\n // Acrobat draws the content upright too, but on a sheet with width and height swapped; we keep\n // the page as the file stores it.\n about:\n '/Rotate that is not a multiple of 90 (broken): no turn, the content upright as in Acrobat',\n source: 'recovery',\n pages: ([45, 135] as const).map((turn) =>\n markedPage(`/MediaBox [0 0 612 792] /Rotate ${turn}`, LETTER, {\n boxes: sameBoxes(LETTER),\n rotation: 0,\n userUnit: 1,\n }),\n ),\n }),\n];\n","import { decodePng, type Raster } from './appearanceRasters';\nimport type { PageSpaceFixture, PageSpaceFixturePage } from './pageSpaceFixtures';\nimport { PAGE_SPACE_FIXTURES } from './pageSpaceFixtures';\nimport type { ConformanceTestRunner } from './runMetadataConformance';\nimport type { Annotation } from '../annotation/kinds';\nimport type { PageLayout } from '../dto/PageLayout';\nimport type { PageImageHandle, PageImageOptions } from '../dto/PageRender';\nimport type { PageDestination } from '../dto/PdfDestination';\nimport type { DocumentHandle } from '../engine/DocumentHandle';\nimport type { Engine } from '../engine/Engine';\nimport type { PdfRect } from '../geometry/primitives';\nimport type { PageRef } from '../identity/PageRef';\n\nexport interface PageSpaceConformanceOptions {\n label: string;\n /** Build a fresh engine for this suite. The suite tears it down at the end. */\n makeEngine: () => Promise<Engine> | Engine;\n /** Open a fresh copy of `fixture`. */\n open: (engine: Engine, fixture: PageSpaceFixture) => Promise<DocumentHandle>;\n /** Only these fixtures (by name); all when left out. */\n only?: readonly string[];\n}\n\n/** A box measured from the top-left of the visible page: x right, y down. */\ninterface PageBox {\n x: number;\n y: number;\n width: number;\n height: number;\n}\n\n/**\n * Where things really are on a page, checked against what the renderer\n * draws. An unturned render starts at the top-left of the visible page, so a\n * position measured from there, times the scale, is a pixel. The fixtures\n * write their answers out by hand from ISO 32000; this suite converts the\n * engine's values with those answers, never with engine code, so it checks\n * the engine's boxes, the renderer and every position the API returns.\n */\nexport function runPageSpaceConformance(\n runner: ConformanceTestRunner,\n opts: PageSpaceConformanceOptions,\n): void {\n const { describe, test, beforeAll, afterAll, expect } = runner;\n const fixtures = PAGE_SPACE_FIXTURES.filter(\n (fixture) => !opts.only || opts.only.includes(fixture.name),\n );\n\n describe(`page space conformance: ${opts.label}`, () => {\n let engine: Engine;\n\n beforeAll(async () => {\n engine = await opts.makeEngine();\n });\n\n afterAll(async () => {\n if (engine) await engine.destroy();\n });\n\n for (const fixture of fixtures) {\n describe(`${fixture.name}: ${fixture.about}`, () => {\n let doc: DocumentHandle;\n let layouts: PageLayout[];\n\n beforeAll(async () => {\n doc = await opts.open(engine, fixture);\n layouts = (await doc.pages.list()).pages;\n });\n\n afterAll(async () => {\n if (doc) await doc.close();\n });\n\n const eachPage = async (\n check: (page: PageSpaceFixturePage, layout: PageLayout) => Promise<void>,\n ) => {\n expect(layouts.length).toBe(fixture.pages.length);\n for (const [index, page] of fixture.pages.entries()) {\n await check(page, layouts[index]!);\n }\n };\n // A page whose visible box has no area shows nothing to look at.\n const eachShownPage = (\n check: (page: PageSpaceFixturePage, layout: PageLayout) => Promise<void>,\n ) =>\n eachPage((page, layout) =>\n hasArea(page.expected.visible) ? check(page, layout) : Promise.resolve(),\n );\n\n test('the page size is the visible page box', async () => {\n await eachPage(async (page, layout) => {\n const visible = page.expected.visible;\n expect(layout.size).toEqual({\n width: visible.right - visible.left,\n height: visible.top - visible.bottom,\n });\n });\n });\n\n test('the boxes are as ISO defines them, measured from the visible page', async () => {\n await eachPage(async (page, layout) => {\n const { boxes, visible } = page.expected;\n expect(layout.pdfCropBox).toEqual(visible);\n expect(layout.boxes).toEqual({\n media: toPage(boxes.media, visible),\n crop: toPage(boxes.crop, visible),\n bleed: toPage(boxes.bleed, visible),\n trim: toPage(boxes.trim, visible),\n art: toPage(boxes.art, visible),\n });\n expect(layout.boxes.crop).toEqual({\n x: 0,\n y: 0,\n width: width(visible),\n height: height(visible),\n });\n });\n });\n\n test('the turn and the unit size', async () => {\n await eachPage(async (page, layout) => {\n expect(layout.rotation).toBe(page.expected.rotation);\n expect(layout.userUnit).toBe(page.expected.userUnit);\n });\n });\n\n test('the tab order', async () => {\n await eachPage(async (page, layout) => {\n expect(layout.tabOrder).toBe(page.expected.tabOrder ?? null);\n });\n });\n\n test(\"a render starts at the visible page box's top-left\", async () => {\n await eachShownPage(async (page, layout) => {\n const visible = page.expected.visible;\n const scale = scaleFor(visible);\n const raster = await render(doc, layout.ref, { viewport: { kind: 'scale', scale } });\n expect(Math.abs(raster.width - width(visible) * scale) <= 1).toBe(true);\n expect(Math.abs(raster.height - height(visible) * scale) <= 1).toBe(true);\n for (const mark of page.marks) {\n expect(darkAt(raster, middleOf(toPage(mark, visible)), scale)).toBe(true);\n }\n // The corner itself is empty: the first mark starts 40 units in.\n expect(darkAt(raster, { x: 20, y: 20 }, scale)).toBe(false);\n });\n });\n\n test('text is found where it is drawn', async () => {\n const slice = await doc.search.query({ text: 'Corner' });\n await eachShownPage(async (page, layout) => {\n const visible = page.expected.visible;\n const word = page.words[0]!;\n const match = slice.matches.find((m) => samePage(m.page, layout.ref));\n expect(match !== undefined).toBe(true);\n const box = match!.segments[0]!.rect;\n expect(Math.abs(box.x - (word.x - visible.left)) <= 3).toBe(true);\n expect(box.y < visible.top - word.y && box.y + box.height > visible.top - word.y).toBe(\n true,\n );\n const scale = scaleFor(visible);\n const raster = await render(doc, layout.ref, { viewport: { kind: 'scale', scale } });\n expect(darkInside(raster, box, scale) > 0).toBe(true);\n });\n });\n\n test('a created annotation is drawn where it was put', async () => {\n await eachShownPage(async (page, layout) => {\n const visible = page.expected.visible;\n const spot: PageBox = {\n x: width(visible) / 2 - 20,\n y: height(visible) / 2 - 20,\n width: 40,\n height: 40,\n };\n const handle = doc.page(layout.ref);\n const { annotation } = await handle.annotations.create({\n subtype: 'square',\n box: spot,\n color: '#000000',\n interiorColor: '#000000',\n });\n try {\n const read = annotation.rect;\n expect(read.x <= spot.x && read.x + read.width >= spot.x + spot.width).toBe(true);\n expect(read.y <= spot.y && read.y + read.height >= spot.y + spot.height).toBe(true);\n const scale = scaleFor(visible);\n const raster = await render(doc, layout.ref, {\n viewport: { kind: 'scale', scale },\n includeAnnotations: true,\n });\n expect(darkAt(raster, middleOf(spot), scale)).toBe(true);\n } finally {\n await handle.annotations.delete(annotation.ref);\n }\n });\n });\n\n // Widget rows are read like every annotation (checked against the\n // pixels above), so reading back the rect that was asked shows where\n // it went: in the create's answer and in the form.\n test(\"a form field's widget is placed where it was put\", async () => {\n await eachShownPage(async (page, layout) => {\n const visible = page.expected.visible;\n const spot: PageBox = {\n x: width(visible) / 2 - 30,\n y: height(visible) / 2 - 10,\n width: 60,\n height: 20,\n };\n const { field, widgets } = await doc.forms.create({\n family: 'text',\n name: `placed_${layout.ref.objectNumber}`,\n widgets: [{ page: layout.ref, rect: spot }],\n });\n try {\n const widget = field.widgets[0]!;\n expect(widgets.map((w) => w.rect)).toEqual([spot]);\n const read = (await doc.forms.list()).widgets.find(\n (w) => w.ref.kind === 'objectNumber' && w.ref.objectNumber === widget.objectNumber,\n );\n expect(read?.rect).toEqual(spot);\n } finally {\n await doc.forms.delete(field.ref);\n }\n });\n });\n\n test('a region render shows its own area', async () => {\n await eachShownPage(async (page, layout) => {\n const raster = await render(doc, layout.ref, {\n target: { kind: 'rect', rect: toPage(page.marks[0]!, page.expected.visible) },\n viewport: { kind: 'scale', scale: 0.1 },\n });\n expect(raster.width > 0 && raster.height > 0).toBe(true);\n expect(everyPixelDark(raster)).toBe(true);\n });\n });\n\n if (fixture.pages.some((page) => page.links?.length)) {\n test(\"a destination is measured from its target page's visible box\", async () => {\n await eachPage(async (page, layout) => {\n if (!page.links?.length) return;\n const { annotations } = await doc.page(layout.ref).annotations.list();\n const links = annotations.filter(\n (a): a is Extract<Annotation, { subtype: 'link' }> => a.subtype === 'link',\n );\n for (const link of page.links) {\n const read = links.find((a) =>\n sameBox(a.rect, toPage(link.rect, page.expected.visible)),\n );\n expect(read !== undefined).toBe(true);\n const target = read!.target;\n expect(target?.kind).toBe('goto');\n if (target?.kind !== 'goto') continue;\n const destination = target.destination;\n expect(samePage(destination.page, layouts[link.toPage]!.ref)).toBe(true);\n expect(placeOf(destination)).toEqual(link.expected);\n }\n });\n });\n }\n\n if (fixture.pages.some((page) => page.openAction)) {\n test(\"a page's open action is measured from its target page's visible box\", async () => {\n await eachPage(async (page, layout) => {\n if (!page.openAction) return;\n const root = layout.actions?.open?.root;\n expect(root?.type).toBe('goto');\n if (root?.type !== 'goto') return;\n const target = layouts[page.openAction.toPage]!.ref;\n expect(samePage(root.destination.page, target)).toBe(true);\n expect(placeOf(root.destination)).toEqual(page.openAction.expected);\n });\n });\n }\n\n if (fixture.fieldAction) {\n const { toPage, expected } = fixture.fieldAction;\n test(\"a field's actions are measured from their target page's visible box\", async () => {\n const { fields } = await doc.forms.list();\n const script = fields.find((field) => field.name === 'total')?.actions?.calculate?.root;\n expect(script?.type).toBe('javascript');\n const goTo = script?.next[0];\n expect(goTo?.type).toBe('goto');\n if (goTo?.type !== 'goto') return;\n expect(samePage(goTo.destination.page, layouts[toPage]!.ref)).toBe(true);\n expect(placeOf(goTo.destination)).toEqual(expected);\n });\n }\n\n if (fixture.openDestination) {\n const { toPage, expected } = fixture.openDestination;\n test(\"the document's open destination is measured from its page's visible box\", async () => {\n const { openDestination } = await doc.actions.get();\n expect(openDestination != null).toBe(true);\n expect(samePage(openDestination!.page, layouts[toPage]!.ref)).toBe(true);\n expect(placeOf(openDestination!)).toEqual(expected);\n });\n }\n\n test('a redaction removes what is inside it, and only that', async () => {\n const page = fixture.pages[0]!;\n const layout = layouts[0]!;\n const visible = page.expected.visible;\n if (!hasArea(visible)) return;\n const slice = await doc.search.query({ text: 'Corner' });\n const match = slice.matches.find((m) => samePage(m.page, layout.ref));\n expect(match !== undefined).toBe(true);\n const found = match!.segments[0]!.rect;\n const handle = doc.page(layout.ref);\n const { annotation } = await handle.annotations.create({\n subtype: 'redact',\n rect: {\n x: found.x - 2,\n y: found.y - 2,\n width: found.width + 4,\n height: found.height + 4,\n },\n });\n await doc.redaction.apply({ annotations: [annotation.ref] });\n\n const after = await doc.search.query({ text: 'Corner' });\n expect(after.matches.some((m) => samePage(m.page, layout.ref))).toBe(false);\n const scale = scaleFor(visible);\n const raster = await render(doc, layout.ref, { viewport: { kind: 'scale', scale } });\n expect(darkInside(raster, found, scale)).toBe(0);\n for (const mark of page.marks) {\n expect(darkAt(raster, middleOf(toPage(mark, visible)), scale)).toBe(true);\n }\n });\n });\n }\n });\n}\n\n// ── positions, converted the way the fixtures define them ──\n\nconst width = (r: PdfRect) => r.right - r.left;\nconst height = (r: PdfRect) => r.top - r.bottom;\nconst hasArea = (r: PdfRect) => width(r) > 0 && height(r) > 0;\n\nfunction toPage(r: PdfRect, visible: PdfRect): PageBox {\n return { x: r.left - visible.left, y: visible.top - r.top, width: width(r), height: height(r) };\n}\n\nconst middleOf = (box: PageBox) => ({ x: box.x + box.width / 2, y: box.y + box.height / 2 });\n\n/** A page-space destination's kind and place, without its page and zoom. */\nfunction placeOf(destination: PageDestination) {\n switch (destination.kind) {\n case 'xyz':\n return { kind: 'xyz', x: destination.x ?? null, y: destination.y ?? null };\n case 'fitH':\n return { kind: 'fitH', y: destination.y ?? null };\n case 'fitV':\n return { kind: 'fitV', x: destination.x ?? null };\n case 'fitR': {\n const { x, y, width, height } = destination;\n return { kind: 'fitR', x, y, width, height };\n }\n default:\n return { kind: destination.kind };\n }\n}\n\nconst sameBox = (a: PageBox, b: PageBox) =>\n Math.abs(a.x - b.x) < 0.01 &&\n Math.abs(a.y - b.y) < 0.01 &&\n Math.abs(a.width - b.width) < 0.01 &&\n Math.abs(a.height - b.height) < 0.01;\n\nconst samePage = (a: PageRef, b: PageRef) => a.objectNumber === b.objectNumber;\n\n// ── pixels ──\n\n/** Half size, or less for a large page: at most 2000 pixels on the long side, so 24 pt words stay dark. */\nconst scaleFor = (visible: PdfRect) =>\n Math.min(0.5, 2000 / Math.max(width(visible), height(visible)));\n\nasync function render(\n doc: DocumentHandle,\n ref: PageRef,\n options: PageImageOptions,\n): Promise<Raster> {\n return decode(await doc.page(ref).render.image({ format: 'png', ...options }));\n}\n\n/** The image's pixels, fetched the way an app would: through its object URL. */\nasync function decode(image: PageImageHandle): Promise<Raster> {\n const { url, revoke } = await image.objectUrl();\n try {\n return await decodePng(new Uint8Array(await (await fetch(url)).arrayBuffer()));\n } finally {\n revoke();\n }\n}\n\nfunction isDark(raster: Raster, px: number, py: number): boolean {\n if (px < 0 || py < 0 || px >= raster.width || py >= raster.height) return false;\n const at = (py * raster.width + px) * 4;\n const { rgba } = raster;\n return rgba[at]! < 80 && rgba[at + 1]! < 80 && rgba[at + 2]! < 80 && rgba[at + 3]! > 128;\n}\n\nfunction darkAt(raster: Raster, point: { x: number; y: number }, scale: number): boolean {\n return isDark(raster, Math.floor(point.x * scale), Math.floor(point.y * scale));\n}\n\nfunction darkInside(raster: Raster, box: PageBox, scale: number): number {\n let count = 0;\n const x0 = Math.ceil(box.x * scale);\n const x1 = Math.floor((box.x + box.width) * scale);\n const y0 = Math.ceil(box.y * scale);\n const y1 = Math.floor((box.y + box.height) * scale);\n for (let y = y0; y < y1; y++) {\n for (let x = x0; x < x1; x++) if (isDark(raster, x, y)) count++;\n }\n return count;\n}\n\nfunction everyPixelDark(raster: Raster): boolean {\n for (let y = 0; y < raster.height; y++) {\n for (let x = 0; x < raster.width; x++) if (!isDark(raster, x, y)) return false;\n }\n return true;\n}\n","import type { ConformanceTestRunner } from './runMetadataConformance';\nimport { pdfOf } from './pdfOf';\nimport type { DocumentHandle } from '../engine/DocumentHandle';\nimport type { Engine } from '../engine/Engine';\nimport { toPageRef } from '../identity/PageRef';\n\n/**\n * One page with a square whose border color the file stores as gray\n * (`/C [0.5]`) and whose fill it stores as CMYK (`/IC [0 0 0 1]`).\n */\nexport const COLOR_FIXTURE_PDF = pdfOf([\n '<< /Type /Catalog /Pages 2 0 R >>',\n '<< /Type /Pages /Kids [3 0 R] /Count 1 >>',\n '<< /Type /Page /Parent 2 0 R /MediaBox [0 0 200 200] /Annots [4 0 R] >>',\n '<< /Type /Annot /Subtype /Square /Rect [20 20 120 120] /F 4 /C [0.5] /IC [0 0 0 1] /NM (colored) >>',\n]);\n\nexport interface ColorConformanceOptions {\n label: string;\n makeEngine: () => Promise<Engine> | Engine;\n /** Open {@link COLOR_FIXTURE_PDF}, fresh for each call. */\n open: (engine: Engine) => Promise<DocumentHandle>;\n}\n\n/** The numbers of the last `/Key [ … ]` array in a PDF file's text. */\nfunction lastArray(text: string, key: string): number[] | null {\n const matches = [...text.matchAll(new RegExp(`/${key}\\\\s*\\\\[([^\\\\]]*)\\\\]`, 'g'))];\n const last = matches[matches.length - 1];\n return last ? last[1]!.trim().split(/\\s+/).map(Number) : null;\n}\n\n/**\n * Colors are `'#rrggbb'`: lowercase when the engine gives one, either case\n * when it takes one. A gray or CMYK color reads as its sRGB equivalent and,\n * sent back unchanged, stays as the file stores it.\n */\nexport function runColorConformance(\n runner: ConformanceTestRunner,\n opts: ColorConformanceOptions,\n): void {\n const { describe, test, beforeAll, afterAll, expect } = runner;\n\n describe(`color conformance: ${opts.label}`, () => {\n let engine: Engine;\n\n beforeAll(async () => {\n engine = await opts.makeEngine();\n });\n\n afterAll(async () => {\n if (engine) await engine.destroy();\n });\n\n const squareOf = async (doc: DocumentHandle) => {\n const { pages } = await doc.pages.list();\n const page = doc.page(toPageRef(pages[0]!.ref.objectNumber));\n const { annotations } = await page.annotations.list();\n const square = annotations.find((a) => a.nm === 'colored');\n if (!square || square.subtype !== 'square') throw new Error('no square in the fixture');\n return { page, square };\n };\n\n test('a gray or CMYK color reads as its sRGB value, lowercase', async () => {\n const doc = await opts.open(engine);\n try {\n const { square } = await squareOf(doc);\n expect(square.color).toMatch(/^#([0-9a-f]{2})\\1\\1$/);\n expect(square.interiorColor).toBe('#000000');\n } finally {\n await doc.close();\n }\n });\n\n test('a color sent back unchanged stays as the file stores it', async () => {\n const doc = await opts.open(engine);\n try {\n const { page, square } = await squareOf(doc);\n // The whole read sent back, the colors in the other case, with one change.\n await page.annotations.update(square.ref, {\n ...square,\n color: square.color.toUpperCase(),\n interiorColor: square.interiorColor?.toUpperCase() ?? null,\n contents: 'kept',\n });\n const text = new TextDecoder('latin1').decode(await doc.download());\n expect(lastArray(text, 'C')).toEqual([0.5]);\n expect(lastArray(text, 'IC')).toEqual([0, 0, 0, 1]);\n const { square: after } = await squareOf(doc);\n expect(after.contents).toBe('kept');\n expect(after.color).toBe(square.color);\n } finally {\n await doc.close();\n }\n });\n\n test('a new color is written as given, in either case, and reads back lowercase', async () => {\n const doc = await opts.open(engine);\n try {\n const { page, square } = await squareOf(doc);\n const { annotation } = await page.annotations.update(square.ref, { color: '#1A2B3C' });\n expect(annotation.subtype === 'square' && annotation.color).toBe('#1a2b3c');\n const text = new TextDecoder('latin1').decode(await doc.download());\n expect(lastArray(text, 'C')).toHaveLength(3);\n } finally {\n await doc.close();\n }\n });\n });\n}\n","import { decodePng, type Raster } from './appearanceRasters';\nimport { pdfOf } from './pdfOf';\nimport type { ConformanceTestRunner } from './runMetadataConformance';\nimport type { AnnotationAppearanceImage, AnnotationAppearanceMode } from '../dto/AnnotationRender';\nimport type { PageImageHandle } from '../dto/PageRender';\nimport type { DocumentHandle } from '../engine/DocumentHandle';\nimport type { Engine } from '../engine/Engine';\nimport type { PageHandle } from '../engine/PageHandle';\nimport { EngineErrorCode } from '../errors/EngineErrorCode';\nimport { annotationKey } from '../identity/annotationKey';\nimport { toPageRef } from '../identity/PageRef';\n\n/** A form XObject that fills its 40 × 40 box with one colour. */\nconst filled = (color: string) => {\n const content = `${color} 0 0 40 40 re f`;\n return `<< /Type /XObject /Subtype /Form /BBox [0 0 40 40] /Length ${content.length} >>\\nstream\\n${content}\\nendstream`;\n};\n\n/**\n * One 200 × 200 page with a check box that is off and stores every mode:\n * normal Yes red and Off green, down Yes blue and Off yellow, rollover Yes\n * black. Beside it, a square whose normal appearance is one stream (cyan).\n * Each appearance fills its box, so a picture's middle names its state.\n */\nexport const APPEARANCE_STATES_FIXTURE_PDF = pdfOf([\n '<< /Type /Catalog /Pages 2 0 R /AcroForm << /Fields [4 0 R] >> >>',\n '<< /Type /Pages /Kids [3 0 R] /Count 1 >>',\n '<< /Type /Page /Parent 2 0 R /MediaBox [0 0 200 200] /Annots [4 0 R 10 0 R] >>',\n '<< /Type /Annot /Subtype /Widget /FT /Btn /T (states) /V /Off /AS /Off /F 4 /Rect [20 20 60 60] ' +\n '/AP << /N << /Yes 5 0 R /Off 6 0 R >> /D << /Yes 7 0 R /Off 8 0 R >> /R << /Yes 9 0 R >> >> >>',\n filled('1 0 0 rg'),\n filled('0 1 0 rg'),\n filled('0 0 1 rg'),\n filled('1 1 0 rg'),\n filled('0 g'),\n '<< /Type /Annot /Subtype /Square /Rect [100 20 140 60] /F 4 /AP << /N 11 0 R >> >>',\n filled('0 1 1 rg'),\n]);\n\nconst RED = [255, 0, 0];\nconst GREEN = [0, 255, 0];\nconst BLUE = [0, 0, 255];\nconst YELLOW = [255, 255, 0];\nconst BLACK = [0, 0, 0];\nconst CYAN = [0, 255, 255];\nconst WHITE = [255, 255, 255];\n\nexport interface AppearanceStatesConformanceOptions {\n label: string;\n makeEngine: () => Promise<Engine> | Engine;\n /** Open {@link APPEARANCE_STATES_FIXTURE_PDF}, fresh for each call. */\n open: (engine: Engine) => Promise<DocumentHandle>;\n}\n\n/**\n * Appearance states and modes, and form fields in page renders, the same on\n * every engine. A page's appearance batch holds every appearance an\n * annotation stores: each mode it has, and every state of each mode, each\n * image labelled with both, whatever `/AS` says. The annotation's\n * `appearanceState` says which state it shows. Each family has its own\n * batch: `page.annotations` the square's, `page.forms` the check box's, and\n * neither holds the other's. A page picture draws what its two options ask\n * for, the annotations and the form fields, each without the other.\n */\nexport function runAppearanceStatesConformance(\n runner: ConformanceTestRunner,\n opts: AppearanceStatesConformanceOptions,\n): void {\n const { describe, test, beforeAll, afterAll, expect } = runner;\n\n describe(`appearance states conformance: ${opts.label}`, () => {\n let engine: Engine;\n let doc: DocumentHandle;\n let page: PageHandle;\n\n beforeAll(async () => {\n engine = await opts.makeEngine();\n doc = await opts.open(engine);\n const { pages } = await doc.pages.list();\n page = doc.page(toPageRef(pages[0]!.ref.objectNumber));\n });\n\n afterAll(async () => {\n if (doc) await doc.close();\n if (engine) await engine.destroy();\n });\n\n const annotations = async () => {\n const { annotations: listed } = await page.annotations.list();\n const { widgets } = await doc.forms.list();\n const box = widgets.find((widget) => widget.page.objectNumber === page.ref.objectNumber);\n const square = listed.find((annotation) => annotation.subtype === 'square');\n if (!box || !square) throw new Error('the fixture has a check box and a square');\n expect(listed.some((annotation) => annotation.subtype === 'widget')).toBe(false);\n return { box, square };\n };\n\n /** `mode:state` of each picture of each annotation, by annotation key. */\n const labelsOf = (appearances: readonly AnnotationAppearanceImage[]) => {\n const labels = new Map<string, string[]>();\n for (const { ref, mode, state } of appearances) {\n const key = annotationKey(ref);\n labels.set(key, [...(labels.get(key) ?? []), `${mode}:${state ?? '-'}`].sort());\n }\n return labels;\n };\n\n /** Both families' pictures, each from its own batch. */\n const render = async (modes?: AnnotationAppearanceMode[]) => {\n const options = {\n format: 'png' as const,\n viewport: { kind: 'scale' as const, scale: 1 },\n ...(modes ? { modes } : {}),\n };\n const [annotationImages, widgetImages] = await Promise.all([\n page.annotations.renderAppearances(options),\n page.forms.renderAppearances(options),\n ]);\n return { appearances: [...annotationImages.appearances, ...widgetImages.appearances] };\n };\n\n test(\"each family's batch holds only its own pictures\", async () => {\n const { box, square } = await annotations();\n const options = { format: 'png' as const, viewport: { kind: 'scale' as const, scale: 1 } };\n const keys = async (batch: Promise<{ appearances: readonly AnnotationAppearanceImage[] }>) =>\n new Set((await batch).appearances.map((appearance) => annotationKey(appearance.ref)));\n expect(await keys(page.annotations.renderAppearances(options))).toEqual(\n new Set([annotationKey(square.ref)]),\n );\n expect(await keys(page.forms.renderAppearances(options))).toEqual(\n new Set([annotationKey(box.ref)]),\n );\n });\n\n test('every mode and state an annotation stores comes back, labelled', async () => {\n const { box, square } = await annotations();\n const labels = labelsOf((await render()).appearances);\n expect(labels.get(annotationKey(box.ref))).toEqual([\n 'down:Off',\n 'down:Yes',\n 'normal:Off',\n 'normal:Yes',\n 'rollover:Yes',\n ]);\n expect(labels.get(annotationKey(square.ref))).toEqual(['normal:-']);\n });\n\n test('each picture draws its own state, whatever the check box shows', async () => {\n const { box } = await annotations();\n const expected: Record<string, number[]> = {\n 'normal:Yes': RED,\n 'normal:Off': GREEN,\n 'down:Yes': BLUE,\n 'down:Off': YELLOW,\n 'rollover:Yes': BLACK,\n };\n const pictures = (await render()).appearances.filter(\n (appearance) => annotationKey(appearance.ref) === annotationKey(box.ref),\n );\n for (const picture of pictures) {\n const raster = await decode(picture.image);\n const middle = pixel(raster, raster.width >> 1, raster.height >> 1).slice(0, 3);\n expect([`${picture.mode}:${picture.state}`, middle]).toEqual([\n `${picture.mode}:${picture.state}`,\n expected[`${picture.mode}:${picture.state}`],\n ]);\n }\n });\n\n test('appearanceState names the state an annotation shows', async () => {\n const { box, square } = await annotations();\n expect(box.appearanceState).toBe('Off');\n expect(square.appearanceState).toBeNull();\n });\n\n test('modes asks for some modes only; every mode is the same as none', async () => {\n const { box, square } = await annotations();\n const normal = labelsOf((await render(['normal'])).appearances);\n expect(normal.get(annotationKey(box.ref))).toEqual(['normal:Off', 'normal:Yes']);\n expect(normal.get(annotationKey(square.ref))).toEqual(['normal:-']);\n const every = labelsOf((await render(['down', 'normal', 'rollover'])).appearances);\n expect(every).toEqual(labelsOf((await render()).appearances));\n });\n\n test('an empty modes list is refused', async () => {\n const options = { format: 'png' as const, modes: [] };\n await expect(page.annotations.renderAppearances(options)).rejects.toMatchObject({\n code: EngineErrorCode.InvalidArg,\n });\n await expect(page.forms.renderAppearances(options)).rejects.toMatchObject({\n code: EngineErrorCode.InvalidArg,\n });\n });\n\n test('a page picture draws its annotations and its form fields, each without the other', async () => {\n const middleOf = async (options: {\n includeAnnotations?: boolean;\n includeFormFields?: boolean;\n }) => {\n const raster = await decode(\n await page.render.image({\n format: 'png',\n viewport: { kind: 'scale', scale: 1 },\n ...options,\n }),\n );\n // The check box spans 20..60 and the square 100..140, both 140..180 from the top.\n return {\n box: pixel(raster, 40, 160).slice(0, 3),\n square: pixel(raster, 120, 160).slice(0, 3),\n };\n };\n // Left out: everything the caller may read (here, everything).\n expect(await middleOf({})).toEqual({ box: GREEN, square: CYAN });\n expect(await middleOf({ includeAnnotations: true, includeFormFields: true })).toEqual({\n box: GREEN,\n square: CYAN,\n });\n expect(await middleOf({ includeFormFields: false })).toEqual({ box: WHITE, square: CYAN });\n expect(await middleOf({ includeAnnotations: false, includeFormFields: true })).toEqual({\n box: GREEN,\n square: WHITE,\n });\n // Annotations off turns the fields off too, unless they're asked for.\n expect(await middleOf({ includeAnnotations: false })).toEqual({ box: WHITE, square: WHITE });\n });\n });\n}\n\n/** The image's pixels, read the way an app would on either engine: through `blob()`. */\nasync function decode(image: PageImageHandle): Promise<Raster> {\n return decodePng(new Uint8Array(await (await image.blob()).arrayBuffer()));\n}\n\nfunction pixel(raster: Raster, x: number, y: number): number[] {\n const at = (y * raster.width + x) * 4;\n return [...raster.rgba.subarray(at, at + 4)];\n}\n","import type { ConformanceTestRunner } from './runMetadataConformance';\nimport { iconRect } from './creatables';\nimport { pdfOf } from './pdfOf';\nimport type { Annotation } from '../annotation/kinds';\nimport type { DocumentHandle } from '../engine/DocumentHandle';\nimport type { Engine } from '../engine/Engine';\nimport { EngineErrorCode } from '../errors/EngineErrorCode';\nimport type { PageBox } from '../geometry/pageSpace';\n\n/**\n * One 300 × 300 page with what other apps write and the engine only reads:\n * a typewriter box (`/IT /FreeTextTypeWriter`) and a square with a beveled\n * border.\n */\nexport const DRAWING_FIXTURE_PDF = pdfOf([\n '<< /Type /Catalog /Pages 2 0 R >>',\n '<< /Type /Pages /Kids [3 0 R] /Count 1 >>',\n '<< /Type /Page /Parent 2 0 R /MediaBox [0 0 300 300] /Annots [4 0 R 5 0 R] >>',\n '<< /Type /Annot /Subtype /FreeText /IT /FreeTextTypeWriter /Rect [20 240 180 270] /DA (0 0 1 rg /Helv 12 Tf) /Contents (typed) /NM (typewriter) /F 4 >>',\n '<< /Type /Annot /Subtype /Square /Rect [20 20 120 120] /BS << /S /B /W 2 >> /C [1 0 0] /NM (beveled) /F 4 >>',\n]);\n\n/** The fixtures the suite opens: its own, and Acrobat's text boxes (`freetext-rotated-acrobat.pdf`). */\nexport type DrawingDetailsFixture = 'drawing' | 'acrobat-freetext';\n\nexport interface DrawingDetailsConformanceOptions {\n label: string;\n makeEngine: () => Promise<Engine> | Engine;\n /** A fresh copy of `fixture` for each call: the tests write to their documents. */\n open: (engine: Engine, fixture: DrawingDetailsFixture) => Promise<DocumentHandle>;\n}\n\n/** The text box Acrobat drew with an orange border and black text. */\nconst ACROBAT_TEXT_BOX = '6fa6542a-9d84-6143-a7ef-6336cd8816f4';\n\nconst BOX: PageBox = { x: 40, y: 40, width: 160, height: 60 };\n\n/**\n * How annotations draw and what a write takes: free text colors and\n * defaults, dashes, the points a shape needs, printing, a note's `open` and\n * its popup, and links.\n */\nexport function runDrawingDetailsConformance(\n runner: ConformanceTestRunner,\n opts: DrawingDetailsConformanceOptions,\n): void {\n const { describe, test, beforeAll, afterAll, expect } = runner;\n\n describe(`drawing details conformance: ${opts.label}`, () => {\n let engine: Engine;\n\n beforeAll(async () => {\n engine = await opts.makeEngine();\n });\n\n afterAll(async () => {\n if (engine) await engine.destroy();\n });\n\n const firstPage = async (doc: DocumentHandle) => {\n const { pages } = await doc.pages.list();\n return { page: doc.page(pages[0]!.ref), pageRef: pages[0]!.ref };\n };\n\n const byNm = async (doc: DocumentHandle, nm: string): Promise<Annotation> => {\n const { page } = await firstPage(doc);\n const found = (await page.annotations.list()).annotations.find((a) => a.nm === nm);\n if (!found) throw new Error(`no annotation '${nm}' in the fixture`);\n return found;\n };\n\n const invalid = { code: EngineErrorCode.InvalidArg };\n\n test(\"Acrobat's text box: the text is its rich text's color, the border its /DA color\", async () => {\n const doc = await opts.open(engine, 'acrobat-freetext');\n try {\n const { page } = await firstPage(doc);\n const box = await byNm(doc, ACROBAT_TEXT_BOX);\n if (box.subtype !== 'free-text') throw new Error('expected a free text');\n expect(box.fontColor).toBe('#000000');\n expect(box.color).toBe('#ff6200');\n expect(box.intent).toBe('free-text');\n expect(box.verticalAlign).toBe('top');\n\n // The border changes; the text keeps its color.\n const bordered = await page.annotations.update(box.ref, { color: '#0000ff' });\n if (bordered.annotation.subtype !== 'free-text') throw new Error('expected a free text');\n expect(bordered.annotation.color).toBe('#0000ff');\n expect(bordered.annotation.fontColor).toBe('#000000');\n\n // The text changes; the rest of its style stays.\n const colored = await page.annotations.update(box.ref, { fontColor: '#00aa00' });\n if (colored.annotation.subtype !== 'free-text') throw new Error('expected a free text');\n expect(colored.annotation.fontColor).toBe('#00aa00');\n expect(colored.annotation.color).toBe('#0000ff');\n expect(colored.annotation.richText.body.family).toBe(box.richText.body.family);\n expect(colored.annotation.fontSize).toBe(box.fontSize);\n } finally {\n await doc.close();\n }\n });\n\n test('a free text create takes defaults, and prints', async () => {\n const doc = await opts.open(engine, 'drawing');\n try {\n const { page } = await firstPage(doc);\n const { annotation } = await page.annotations.create({\n subtype: 'free-text',\n box: BOX,\n contents: 'Defaults',\n });\n if (annotation.subtype !== 'free-text') throw new Error('expected a free text');\n expect(annotation).toMatchObject({\n intent: 'free-text',\n fontFamily: 'helvetica',\n fontSize: 12,\n textAlign: 'left',\n verticalAlign: 'top',\n fontColor: '#000000',\n color: '#000000',\n print: true,\n });\n } finally {\n await doc.close();\n }\n });\n\n test('a callout line makes a callout; another box refuses one', async () => {\n const doc = await opts.open(engine, 'drawing');\n try {\n const { page } = await firstPage(doc);\n const calloutLine: [{ x: number; y: number }, { x: number; y: number }] = [\n { x: 20, y: 150 },\n { x: 40, y: 100 },\n ];\n const callout = await page.annotations.create({\n subtype: 'free-text',\n box: BOX,\n contents: 'Look',\n calloutLine,\n });\n if (callout.annotation.subtype !== 'free-text') throw new Error('expected a free text');\n expect(callout.annotation.intent).toBe('free-text-callout');\n\n await expect(\n page.annotations.create({\n subtype: 'free-text',\n box: BOX,\n intent: 'free-text',\n calloutLine,\n }),\n ).rejects.toMatchObject(invalid);\n\n const plain = await page.annotations.create({ subtype: 'free-text', box: BOX });\n await expect(\n page.annotations.update(plain.annotation.ref, { calloutLine }),\n ).rejects.toMatchObject(invalid);\n const became = await page.annotations.update(plain.annotation.ref, {\n intent: 'free-text-callout',\n calloutLine,\n });\n if (became.annotation.subtype !== 'free-text') throw new Error('expected a free text');\n expect(became.annotation.intent).toBe('free-text-callout');\n } finally {\n await doc.close();\n }\n });\n\n test('the text style given by itself wins over the rich body; a partial body merges over the current one', async () => {\n const doc = await opts.open(engine, 'drawing');\n try {\n const { page } = await firstPage(doc);\n const created = await page.annotations.create({\n subtype: 'free-text',\n box: BOX,\n fontColor: '#ff0000',\n richText: {\n body: { color: '#0000ff', size: 20 },\n paragraphs: [{ runs: [{ text: 'styled' }] }],\n },\n });\n if (created.annotation.subtype !== 'free-text') throw new Error('expected a free text');\n expect(created.annotation.fontColor).toBe('#ff0000');\n expect(created.annotation.fontSize).toBe(20);\n\n const italic = await page.annotations.update(created.annotation.ref, {\n richText: { body: { italic: true }, paragraphs: [{ runs: [{ text: 'restyled' }] }] },\n });\n if (italic.annotation.subtype !== 'free-text') throw new Error('expected a free text');\n expect(italic.annotation.richText.body.italic).toBe(true);\n expect(italic.annotation.fontSize).toBe(20);\n expect(italic.annotation.fontColor).toBe('#ff0000');\n } finally {\n await doc.close();\n }\n });\n\n test('free text justifies, sits in its box, and takes a cloudy border', async () => {\n const doc = await opts.open(engine, 'drawing');\n try {\n const { page } = await firstPage(doc);\n const created = await page.annotations.create({\n subtype: 'free-text',\n box: { ...BOX, height: 120 },\n contents: 'A line long enough to wrap onto a second line in its box',\n textAlign: 'justify',\n verticalAlign: 'middle',\n cloudyIntensity: 1,\n });\n if (created.annotation.subtype !== 'free-text') throw new Error('expected a free text');\n expect(created.annotation.textAlign).toBe('justify');\n expect(created.annotation.verticalAlign).toBe('middle');\n expect(created.annotation.cloudyIntensity).toBe(1);\n\n const moved = await page.annotations.update(created.annotation.ref, {\n verticalAlign: 'bottom',\n cloudyIntensity: null,\n });\n if (moved.annotation.subtype !== 'free-text') throw new Error('expected a free text');\n expect(moved.annotation.verticalAlign).toBe('bottom');\n expect(moved.annotation.cloudyIntensity).toBe(null);\n } finally {\n await doc.close();\n }\n });\n\n test(\"another app's typewriter box is read and kept, not created\", async () => {\n const doc = await opts.open(engine, 'drawing');\n try {\n const { page } = await firstPage(doc);\n const typewriter = await byNm(doc, 'typewriter');\n if (typewriter.subtype !== 'free-text') throw new Error('expected a free text');\n expect(typewriter.intent).toBe('free-text-typewriter');\n\n const retyped = await page.annotations.update(typewriter.ref, {\n intent: typewriter.intent,\n contents: 'retyped',\n });\n if (retyped.annotation.subtype !== 'free-text') throw new Error('expected a free text');\n expect(retyped.annotation.intent).toBe('free-text-typewriter');\n\n await expect(\n page.annotations.create({\n subtype: 'free-text',\n box: BOX,\n intent: 'free-text-typewriter',\n } as never),\n ).rejects.toMatchObject(invalid);\n } finally {\n await doc.close();\n }\n });\n\n test('borders: only a widget writes beveled or inset; a pattern alone keeps a border solid', async () => {\n const doc = await opts.open(engine, 'drawing');\n try {\n const { page } = await firstPage(doc);\n await expect(\n page.annotations.create({ subtype: 'square', box: BOX, borderStyle: 'beveled' } as never),\n ).rejects.toMatchObject(invalid);\n\n // Another app's beveled border is read and, sent back, kept.\n const beveled = await byNm(doc, 'beveled');\n if (beveled.subtype !== 'square') throw new Error('expected a square');\n expect(beveled.borderStyle).toBe('beveled');\n const kept = await page.annotations.update(beveled.ref, {\n borderStyle: beveled.borderStyle,\n contents: 'kept',\n });\n if (kept.annotation.subtype !== 'square') throw new Error('expected a square');\n expect(kept.annotation.borderStyle).toBe('beveled');\n await expect(\n page.annotations.update(beveled.ref, { borderStyle: 'inset' } as never),\n ).rejects.toMatchObject(invalid);\n\n const patterned = await page.annotations.create({\n subtype: 'square',\n box: BOX,\n borderStyle: 'solid',\n dashArray: [2, 2],\n });\n if (patterned.annotation.subtype !== 'square') throw new Error('expected a square');\n expect(patterned.annotation.borderStyle).toBe('solid');\n expect(patterned.annotation.dashArray).toEqual([2, 2]);\n\n const dashed = await page.annotations.create({\n subtype: 'square',\n box: BOX,\n borderStyle: 'dashed',\n });\n if (dashed.annotation.subtype !== 'square') throw new Error('expected a square');\n expect(dashed.annotation.borderStyle).toBe('dashed');\n expect(dashed.annotation.dashArray).toBe(null);\n } finally {\n await doc.close();\n }\n });\n\n test('too few points to draw is InvalidArg', async () => {\n const doc = await opts.open(engine, 'drawing');\n try {\n const { page } = await firstPage(doc);\n const point = { x: 50, y: 50 };\n const other = { x: 90, y: 90 };\n for (const draft of [\n { subtype: 'polyline', vertices: [point] },\n { subtype: 'polygon', vertices: [point, other] },\n { subtype: 'ink', inkList: [] },\n { subtype: 'ink', inkList: [[point, other], []] },\n { subtype: 'ink', inkList: [[point, other]], strokeWidth: 0 },\n ]) {\n await expect(page.annotations.create(draft as never)).rejects.toMatchObject(invalid);\n }\n } finally {\n await doc.close();\n }\n });\n\n test('a new annotation prints, a popup does not', async () => {\n const doc = await opts.open(engine, 'drawing');\n try {\n const { page } = await firstPage(doc);\n const square = await page.annotations.create({ subtype: 'square', box: BOX });\n expect(square.annotation.print).toBe(true);\n const unprinted = await page.annotations.create({\n subtype: 'square',\n box: BOX,\n print: false,\n });\n expect(unprinted.annotation.print).toBe(false);\n const popup = await page.annotations.create({\n subtype: 'popup',\n parent: square.annotation.ref,\n rect: { x: 210, y: 40, width: 80, height: 60 },\n });\n expect(popup.annotation.print).toBe(false);\n } finally {\n await doc.close();\n }\n });\n\n test('a note and its popup share one open; a second popup is refused', async () => {\n const doc = await opts.open(engine, 'drawing');\n try {\n const { page } = await firstPage(doc);\n const note = await page.annotations.create({\n subtype: 'text',\n rect: iconRect(40, 40),\n open: true,\n });\n if (note.annotation.subtype !== 'text') throw new Error('expected a note');\n expect(note.annotation.open).toBe(true);\n\n // A popup made without `open` takes the note's.\n const popup = await page.annotations.create({\n subtype: 'popup',\n parent: note.annotation.ref,\n rect: { x: 70, y: 40, width: 120, height: 80 },\n });\n if (popup.annotation.subtype !== 'popup') throw new Error('expected a popup');\n expect(popup.annotation.open).toBe(true);\n\n const readBoth = async () => {\n const { annotations } = await page.annotations.list();\n const find = (ref: Annotation['ref']) =>\n annotations.find((a) => JSON.stringify(a.ref) === JSON.stringify(ref));\n return { note: find(note.annotation.ref), popup: find(popup.annotation.ref) };\n };\n\n // Writing one writes the other, and the result names both.\n const closed = await page.annotations.update(note.annotation.ref, { open: false });\n expect(closed.meta.changed).toHaveLength(2);\n let both = await readBoth();\n expect(both.note?.subtype === 'text' && both.note.open).toBe(false);\n expect(both.popup?.subtype === 'popup' && both.popup.open).toBe(false);\n\n await page.annotations.update(popup.annotation.ref, { open: true });\n both = await readBoth();\n expect(both.note?.subtype === 'text' && both.note.open).toBe(true);\n\n await expect(\n page.annotations.create({\n subtype: 'popup',\n parent: note.annotation.ref,\n rect: { x: 70, y: 140, width: 120, height: 80 },\n }),\n ).rejects.toMatchObject(invalid);\n } finally {\n await doc.close();\n }\n });\n\n test('links: page verbs are written, a missing fit coordinate stays missing, no border', async () => {\n const doc = await opts.open(engine, 'drawing');\n try {\n const { page, pageRef } = await firstPage(doc);\n const next = await page.annotations.create({\n subtype: 'link',\n rect: BOX,\n target: { kind: 'named', name: 'NextPage' },\n });\n if (next.annotation.subtype !== 'link') throw new Error('expected a link');\n expect(next.annotation.target).toEqual({ kind: 'named', name: 'NextPage' });\n\n const fit = await page.annotations.create({\n subtype: 'link',\n rect: { ...BOX, y: 120 },\n target: { kind: 'goto', destination: { kind: 'fitH', page: pageRef, y: null } },\n });\n if (fit.annotation.subtype !== 'link') throw new Error('expected a link');\n expect(fit.annotation.target).toEqual({\n kind: 'goto',\n destination: { kind: 'fitH', page: pageRef, y: null },\n });\n\n const text = new TextDecoder('latin1').decode(await doc.download());\n expect(text).toMatch(/\\/Border\\s*\\[\\s*0\\s+0\\s+0\\s*\\]/);\n expect(/\\/FitH\\s+0\\s*\\]/.test(text)).toBe(false);\n } finally {\n await doc.close();\n }\n });\n });\n}\n","import type { ConformanceTestRunner, ConformanceOptions } from './runMetadataConformance';\nimport type { DocumentHandle } from '../engine/DocumentHandle';\nimport type { Engine } from '../engine/Engine';\nimport { EngineError } from '../errors/EngineError';\nimport { EngineErrorCode } from '../errors/EngineErrorCode';\nimport { annotationKey } from '../identity/annotationKey';\nimport { toPageRef } from '../identity/PageRef';\nimport { AbortError } from '../promise/AbortError';\nimport { PageDeleteResultSchema } from '../wire/schemas';\nimport { EVERY_PERMISSION } from './fixtureScope';\n\n/**\n * Page delete conformance suite. Verifies the architectural invariants —\n * do not loosen these without re-reading `PageDeleteResult`:\n *\n * 1. `pages.delete()` removes exactly the listed pages and returns the\n * full surviving layout; a subsequent `list()` agrees.\n * 2. Deleted page object numbers are retired: addressing a deleted page afterwards is a\n * clean `NotFound` (an API-level error, never native-memory danger).\n * 3. Surviving pages keep identity, and their annotations keep their\n * names — a `baseIndex` ref survives a neighbour's deletion.\n * 4. Deleting every page is rejected (`InvalidArg`) — a document keeps at\n * least one page.\n * 5. Duplicate / unknown page object numbers reject with `InvalidArg` / `NotFound`;\n * abort propagates as `AbortError`.\n *\n * Both local (worker host + WASM) and cloud (HTTP + @cloudpdf/server)\n * implementations must pass identically.\n */\nexport function runPageDeleteConformance(\n runner: ConformanceTestRunner,\n opts: ConformanceOptions,\n): void {\n const { describe, test, beforeAll, afterAll, expect } = runner;\n\n describe(`page delete conformance: ${opts.label}`, () => {\n let engine: Engine;\n\n beforeAll(async () => {\n engine = await opts.makeEngine();\n });\n\n afterAll(async () => {\n if (engine) await engine.destroy();\n });\n\n test('pages.delete() removes the page and returns the surviving layout', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const before = await doc.pages.list();\n if (before.pages.length < 2) return;\n const victim = before.pages[1].ref.objectNumber;\n\n const result = await doc.pages.delete([toPageRef(victim)]);\n expect(PageDeleteResultSchema.safeParse(result).success).toBe(true);\n\n const after = result.layout;\n expect(after.pages.length).toBe(before.pages.length - 1);\n expect(after.pageCount).toBe(before.pageCount - 1);\n expect(after.pages.some((p) => p.ref.objectNumber === victim)).toBe(false);\n\n // Survivors keep their relative order, contiguous 0..N-1 indices.\n const expectedOrder = before.pages\n .map((p) => p.ref.objectNumber)\n .filter((pageObjectNumber) => pageObjectNumber !== victim);\n expect(after.pages.map((p) => p.ref.objectNumber)).toEqual(expectedOrder);\n for (let i = 0; i < after.pages.length; i++) {\n expect(after.pages[i].index).toBe(i);\n }\n\n // A subsequent list() agrees (the result is not a one-off view).\n const relisted = await doc.pages.list();\n expect(relisted.pages.map((p) => p.ref.objectNumber)).toEqual(expectedOrder);\n } finally {\n await doc.close();\n }\n });\n\n test('addressing a deleted page afterwards is a clean NotFound', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const before = await doc.pages.list();\n if (before.pages.length < 2) return;\n const victim = before.pages[1].ref.objectNumber;\n await doc.pages.delete([toPageRef(victim)]);\n\n let caught: unknown;\n try {\n await doc.page(toPageRef(victim)).annotations.list();\n } catch (err) {\n caught = err;\n }\n expect(EngineError.is(caught, EngineErrorCode.NotFound)).toBe(true);\n } finally {\n await doc.close();\n }\n });\n\n test('an annotation born inline keeps its baseIndex name when another page is deleted', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const list = await doc.pages.list();\n const inline = (await doc.annotations.list()).annotations.find(\n (a) => a.ref.kind === 'baseIndex',\n );\n const victim = list.pages.find((p) => p.ref.objectNumber !== inline?.page.objectNumber);\n if (!inline || !victim) return;\n\n await doc.pages.delete([victim.ref]);\n\n const update = await doc.page(inline.page).annotations.update(inline.ref, {\n contents: 'still alive',\n });\n expect(update.annotation.contents).toBe('still alive');\n expect(annotationKey(update.annotation.ref)).toBe(annotationKey(inline.ref));\n } finally {\n await doc.close();\n }\n });\n\n test('deleting EVERY page is rejected with InvalidArg', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const list = await doc.pages.list();\n let caught: unknown;\n try {\n await doc.pages.delete(list.pages.map((p) => p.ref));\n } catch (err) {\n caught = err;\n }\n expect(EngineError.is(caught, EngineErrorCode.InvalidArg)).toBe(true);\n } finally {\n await doc.close();\n }\n });\n\n test('pages.delete() rejects duplicate PONs with InvalidArg', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const list = await doc.pages.list();\n const pageObjectNumber = list.pages[0].ref.objectNumber;\n let caught: unknown;\n try {\n await doc.pages.delete([toPageRef(pageObjectNumber), toPageRef(pageObjectNumber)]);\n } catch (err) {\n caught = err;\n }\n expect(EngineError.is(caught, EngineErrorCode.InvalidArg)).toBe(true);\n } finally {\n await doc.close();\n }\n });\n\n test('pages.delete() rejects unknown PON with NotFound or InvalidArg', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const list = await doc.pages.list();\n let bogus = 0;\n for (const p of list.pages) bogus = Math.max(bogus, p.ref.objectNumber);\n bogus += 9999;\n\n let caught: unknown;\n try {\n await doc.pages.delete([toPageRef(bogus)]);\n } catch (err) {\n caught = err;\n }\n expect(\n EngineError.is(caught, EngineErrorCode.NotFound) ||\n EngineError.is(caught, EngineErrorCode.InvalidArg),\n ).toBe(true);\n } finally {\n await doc.close();\n }\n });\n\n test('abort on pages.delete() rejects with AbortError', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const list = await doc.pages.list();\n if (list.pages.length < 2) return;\n const pageObjectNumber = list.pages[1].ref.objectNumber;\n const p = doc.pages.delete([toPageRef(pageObjectNumber)]);\n p.abort('test');\n await expect(p).rejects.toBeInstanceOf(AbortError);\n } finally {\n await doc.close();\n }\n });\n });\n}\n\nasync function openFixture(engine: Engine, opts: ConformanceOptions): Promise<DocumentHandle> {\n if (opts.openKind === 'bytes') {\n const bytes = await opts.fixture.bytes();\n return engine.open({ kind: 'bytes', id: opts.fixture.id, bytes }, EVERY_PERMISSION);\n }\n return engine.open({ kind: 'id', id: opts.fixture.cloudId ?? opts.fixture.id });\n}\n","import type { ConformanceTestRunner, ConformanceOptions } from './runMetadataConformance';\nimport type { DocumentHandle } from '../engine/DocumentHandle';\nimport type { Engine } from '../engine/Engine';\nimport { EngineError } from '../errors/EngineError';\nimport { EngineErrorCode } from '../errors/EngineErrorCode';\nimport { toPageRef } from '../identity/PageRef';\nimport { AbortError } from '../promise/AbortError';\nimport { PageListSnapshotSchema, PageNameResultSchema } from '../wire/schemas';\nimport { EVERY_PERMISSION } from './fixtureScope';\n\n/**\n * Named-pages conformance: the catalog's `/Names /Pages` registry as layout\n * data. Locks the invariants both engines must share — do not loosen\n * without re-reading `NamedPageEntry` and `PageNameResult`:\n *\n * 1. `pages.list().namedPages` is present (possibly empty) and every\n * registration resolves to a page in `pages`, a template, or is\n * reported dangling — never silently dropped.\n * 2. `pages.setName()` creates or replaces by decoded key (idempotent),\n * `replace` renames in one job, and the result is the new layout.\n * 3. `pages.removeName()` drops the registration and nothing else.\n * 4. Deleting a page removes every registration pointing at it — inside\n * the delete, with no plugin in the loop.\n * 5. Non-ASCII keys round-trip unchanged (Acrobat writes UTF-16 + BOM).\n *\n * Skips cleanly when the engine does not implement the optional members.\n */\nexport function runNamedPagesConformance(\n runner: ConformanceTestRunner,\n opts: ConformanceOptions,\n): void {\n const { describe, test, beforeAll, afterAll, expect } = runner;\n\n describe(`named pages conformance: ${opts.label}`, () => {\n let engine: Engine;\n\n beforeAll(async () => {\n engine = await opts.makeEngine();\n });\n\n afterAll(async () => {\n if (engine) await engine.destroy();\n });\n\n test('pages.list() carries namedPages and every entry resolves', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const layout = await doc.pages.list();\n PageListSnapshotSchema.parse(layout);\n expect(Array.isArray(layout.namedPages)).toBe(true);\n const pageObjectNumbers = new Set(layout.pages.map((page) => page.ref.objectNumber));\n for (const entry of layout.namedPages) {\n expect(entry.name.length > 0).toBe(true);\n if (entry.target.kind === 'page') {\n expect(pageObjectNumbers.has(entry.target.page.objectNumber)).toBe(true);\n }\n }\n } finally {\n await doc.close();\n }\n });\n\n test('pages.setName() registers, replaces by key, and renames via `replace`', async () => {\n const doc = await openFixture(engine, opts);\n try {\n if (!doc.pages.setName) return;\n const before = await doc.pages.list();\n const [first, second] = before.pages;\n const baseline = before.namedPages.length;\n\n // Create.\n const created = await doc.pages.setName({\n name: 'Approved=Goedgekeurd',\n page: first.ref,\n });\n PageNameResultSchema.parse(created);\n expect(created.layout.pages.length).toBe(before.pages.length);\n expect(find(created, 'Approved=Goedgekeurd')).toEqual({\n kind: 'page',\n page: toPageRef(first.ref.objectNumber),\n });\n expect(created.layout.namedPages.length).toBe(baseline + 1);\n const delta = created.meta.cacheDelta;\n if (delta) {\n expect(delta.docVersion > delta.previousDocVersion).toBe(true);\n expect((delta.layoutVersion ?? 0) > 0).toBe(true);\n }\n\n // The result is the new layout.\n const listed = await doc.pages.list();\n expect(listed.namedPages).toEqual(created.layout.namedPages);\n\n // Replace by key: still one entry, now pointing at the second page.\n const replaced = await doc.pages.setName({\n name: 'Approved=Goedgekeurd',\n page: second.ref,\n });\n expect(find(replaced, 'Approved=Goedgekeurd')).toEqual({\n kind: 'page',\n page: toPageRef(second.ref.objectNumber),\n });\n expect(replaced.layout.namedPages.length).toBe(baseline + 1);\n\n // Rename in one job.\n const renamed = await doc.pages.setName({\n name: 'Approved=Approved',\n page: second.ref,\n replace: 'Approved=Goedgekeurd',\n });\n expect(find(renamed, 'Approved=Goedgekeurd')).toBe(undefined);\n expect(find(renamed, 'Approved=Approved')).toEqual({\n kind: 'page',\n page: toPageRef(second.ref.objectNumber),\n });\n expect(renamed.layout.namedPages.length).toBe(baseline + 1);\n } finally {\n await doc.close();\n }\n });\n\n test('non-ASCII keys round-trip through set → list', async () => {\n const doc = await openFixture(engine, opts);\n try {\n if (!doc.pages.setName) return;\n const before = await doc.pages.list();\n const key = 'Stämpel=Stämpel 日本';\n const result = await doc.pages.setName({\n name: key,\n page: before.pages[0].ref,\n });\n expect(find(result, key)).toEqual({\n kind: 'page',\n page: toPageRef(before.pages[0].ref.objectNumber),\n });\n const listed = await doc.pages.list();\n expect(listed.namedPages.some((entry) => entry.name === key)).toBe(true);\n } finally {\n await doc.close();\n }\n });\n\n test('pages.removeName() drops the registration and keeps the page', async () => {\n const doc = await openFixture(engine, opts);\n try {\n if (!doc.pages.setName || !doc.pages.removeName) return;\n const before = await doc.pages.list();\n await doc.pages.setName({\n name: 'Draft=Concept',\n page: before.pages[0].ref,\n });\n const removed = await doc.pages.removeName({ name: 'Draft=Concept' });\n PageNameResultSchema.parse(removed);\n expect(find(removed, 'Draft=Concept')).toBe(undefined);\n expect(removed.layout.pages.length).toBe(before.pages.length);\n\n await expect(doc.pages.removeName({ name: 'Draft=Concept' })).rejects.toMatchObject({\n code: EngineErrorCode.NotFound,\n });\n } finally {\n await doc.close();\n }\n });\n\n test('pages.setName() rejects an empty name and an unknown page', async () => {\n const doc = await openFixture(engine, opts);\n try {\n if (!doc.pages.setName) return;\n const before = await doc.pages.list();\n await expect(\n doc.pages.setName({ name: '', page: before.pages[0].ref }),\n ).rejects.toMatchObject({ code: EngineErrorCode.InvalidArg });\n let unknownPage: unknown = null;\n try {\n await doc.pages.setName({ name: 'Ghost=Ghost', page: toPageRef(987654321) });\n } catch (error) {\n unknownPage = error;\n }\n expect(\n EngineError.is(unknownPage, EngineErrorCode.NotFound) ||\n EngineError.is(unknownPage, EngineErrorCode.InvalidArg),\n ).toBe(true);\n } finally {\n await doc.close();\n }\n });\n\n test('deleting a page removes every registration pointing at it', async () => {\n const doc = await openFixture(engine, opts);\n try {\n if (!doc.pages.setName) return;\n const before = await doc.pages.list();\n if (before.pages.length < 2) return;\n const victim = before.pages[1].ref;\n const survivor = before.pages[0].ref;\n await doc.pages.setName({ name: 'Victim=One', page: victim });\n await doc.pages.setName({ name: 'Victim=Two', page: victim });\n await doc.pages.setName({ name: 'Survivor', page: survivor });\n\n const deleted = await doc.pages.delete([victim]);\n const names = deleted.layout.namedPages.map((entry) => entry.name);\n expect(names.includes('Victim=One')).toBe(false);\n expect(names.includes('Victim=Two')).toBe(false);\n expect(names).toContain('Survivor');\n // Nothing dangling was left behind by the delete.\n expect(deleted.layout.namedPages.some((entry) => entry.target.kind === 'dangling')).toBe(\n false,\n );\n } finally {\n await doc.close();\n }\n });\n\n test('abort on pages.setName() rejects with AbortError', async () => {\n const doc = await openFixture(engine, opts);\n try {\n if (!doc.pages.setName) return;\n const before = await doc.pages.list();\n const promise = doc.pages.setName({\n name: 'Aborted=Aborted',\n page: before.pages[0].ref,\n });\n promise.abort();\n await expect(promise).rejects.toBeInstanceOf(AbortError);\n } finally {\n await doc.close();\n }\n });\n });\n}\n\nfunction find(\n result: { layout: { namedPages: { name: string; target: unknown }[] } },\n name: string,\n) {\n return result.layout.namedPages.find((entry) => entry.name === name)?.target;\n}\n\nasync function openFixture(engine: Engine, opts: ConformanceOptions): Promise<DocumentHandle> {\n if (opts.openKind === 'bytes') {\n const bytes = await opts.fixture.bytes();\n return engine.open({ kind: 'bytes', id: opts.fixture.id, bytes }, EVERY_PERMISSION);\n }\n return engine.open({ kind: 'id', id: opts.fixture.cloudId ?? opts.fixture.id });\n}\n","import type { ConformanceTestRunner, ConformanceOptions } from './runMetadataConformance';\nimport type { SquareDraft } from '../annotation/kinds';\nimport type { DocumentHandle } from '../engine/DocumentHandle';\nimport type { Engine } from '../engine/Engine';\nimport { EngineError } from '../errors/EngineError';\nimport { EngineErrorCode } from '../errors/EngineErrorCode';\nimport type { DocumentEvent } from '../events/DocumentEvent';\nimport type { AnnotationRef } from '../identity/AnnotationRef';\nimport { toPageRef } from '../identity/PageRef';\nimport { AnnotationFlattenResultSchema } from '../wire/schemas';\nimport { EVERY_PERMISSION } from './fixtureScope';\n\nconst square = (x: number, y: number): SquareDraft => ({\n subtype: 'square',\n box: { x, y, width: 40, height: 40 },\n color: '#1428dc',\n strokeWidth: 2,\n});\n\n/**\n * Selective annotation flatten: `page(pon).annotations.flatten(refs)` is\n * `pages.flatten` for a chosen set. Locks, on every engine:\n * 1. only the given refs are painted and removed; the rest of the page's\n * annotations are untouched;\n * 2. per-ref status (`applied` / `skipped`), one `annotations.flattened`\n * event, a `meta` with that page's new pins, layout unchanged;\n * 3. a hidden ref is `skipped`; a ref on another page rejects `InvalidArg`\n * with nothing mutated.\n * Skips cleanly when the engine does not implement the optional member.\n */\nexport function runAnnotationFlattenConformance(\n runner: ConformanceTestRunner,\n opts: ConformanceOptions,\n): void {\n const { describe, test, beforeAll, afterAll, expect } = runner;\n\n describe(`annotation flatten conformance: ${opts.label}`, () => {\n let engine: Engine;\n\n beforeAll(async () => {\n engine = await opts.makeEngine();\n });\n\n afterAll(async () => {\n if (engine) await engine.destroy();\n });\n\n test('flattens exactly the given refs and reports per-ref status', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const layoutBefore = await doc.pages.list();\n const pageObjectNumber = layoutBefore.pages[0].ref.objectNumber;\n const page = doc.page(toPageRef(pageObjectNumber));\n if (!page.annotations.flatten) return;\n\n const a = (await page.annotations.create(square(20, 20))).annotation.ref;\n const b = (await page.annotations.create(square(80, 20))).annotation.ref;\n const c = (await page.annotations.create(square(140, 20))).annotation.ref;\n // Hide `c` — ineligible for display flatten, so it must be skipped.\n await page.annotations.update(c, { subtype: 'square', hidden: true });\n const before = await page.annotations.list();\n\n const events: DocumentEvent[] = [];\n const unsubscribe = doc.events.subscribe((event) => {\n if (event.type === 'annotations.flattened') events.push(event);\n });\n const result = await page.annotations.flatten([a, c], { usage: 'display' });\n unsubscribe();\n\n expect(AnnotationFlattenResultSchema.safeParse(result).success).toBe(true);\n expect(result.page.objectNumber).toBe(pageObjectNumber);\n expect(result.usage).toBe('display');\n expect(result.results.map((item) => item.status)).toEqual(['applied', 'unchanged']);\n expect(result.meta.affectedPages).toEqual([page.ref]);\n expect(events).toHaveLength(1);\n\n // Layout untouched; `a` gone, `b` and `c` still there.\n expect(await doc.pages.list()).toEqual(layoutBefore);\n const after = await page.annotations.list();\n expect(after.annotations.length).toBe(before.annotations.length - 1);\n expect(after.annotations.some((dto) => sameRef(dto.ref, b))).toBe(true);\n expect(after.annotations.some((dto) => sameRef(dto.ref, c))).toBe(true);\n expect(after.annotations.some((dto) => sameRef(dto.ref, a))).toBe(false);\n } finally {\n await doc.close();\n }\n });\n\n test('a ref on another page rejects InvalidArg and mutates nothing', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const layout = await doc.pages.list();\n if (layout.pages.length < 2) return;\n const page0 = doc.page(layout.pages[0].ref);\n const page1 = doc.page(layout.pages[1].ref);\n if (!page0.annotations.flatten) return;\n const own = (await page0.annotations.create(square(20, 100))).annotation.ref;\n const foreign = (await page1.annotations.create(square(20, 100))).annotation.ref;\n const countBefore = (await page0.annotations.list()).annotations.length;\n\n await expect(page0.annotations.flatten([own, foreign])).rejects.toMatchObject({\n code: EngineErrorCode.InvalidArg,\n });\n expect((await page0.annotations.list()).annotations.length).toBe(countBefore);\n } finally {\n await doc.close();\n }\n });\n\n test('an empty ref list rejects InvalidArg; an unknown ref rejects NotFound', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const pageObjectNumber = (await doc.pages.list()).pages[0].ref.objectNumber;\n const page = doc.page(toPageRef(pageObjectNumber));\n if (!page.annotations.flatten) return;\n await expect(page.annotations.flatten([])).rejects.toMatchObject({\n code: EngineErrorCode.InvalidArg,\n });\n let unknown: unknown = null;\n try {\n await page.annotations.flatten([\n {\n kind: 'objectNumber',\n page: toPageRef(pageObjectNumber),\n objectNumber: 987654321,\n },\n ]);\n } catch (error) {\n unknown = error;\n }\n expect(EngineError.is(unknown, EngineErrorCode.NotFound)).toBe(true);\n } finally {\n await doc.close();\n }\n });\n });\n}\n\nfunction sameRef(left: AnnotationRef, right: AnnotationRef): boolean {\n if (left.kind === 'objectNumber' && right.kind === 'objectNumber') {\n return left.objectNumber === right.objectNumber;\n }\n return JSON.stringify(left) === JSON.stringify(right);\n}\n\nasync function openFixture(engine: Engine, opts: ConformanceOptions): Promise<DocumentHandle> {\n if (opts.openKind === 'bytes') {\n return engine.open(\n { kind: 'bytes', id: opts.fixture.id, bytes: await opts.fixture.bytes() },\n EVERY_PERMISSION,\n );\n }\n return engine.open({ kind: 'id', id: opts.fixture.cloudId ?? opts.fixture.id });\n}\n","import type { ConformanceTestRunner, ConformanceOptions } from './runMetadataConformance';\nimport type { SquareDraft } from '../annotation/kinds';\nimport type { DocumentHandle } from '../engine/DocumentHandle';\nimport type { Engine } from '../engine/Engine';\nimport { EngineErrorCode } from '../errors/EngineErrorCode';\nimport { toPageRef } from '../identity/PageRef';\nimport { EVERY_PERMISSION } from './fixtureScope';\n\nconst PDF_MAGIC = [0x25, 0x50, 0x44, 0x46]; // %PDF\n\nconst square = (x: number, y: number, size = 40): SquareDraft => ({\n subtype: 'square',\n box: { x, y, width: size, height: size },\n color: '#dc1414',\n strokeWidth: 2,\n});\n\n/**\n * `page(pon).annotations.exportAppearance(refs)`: the chosen annotations'\n * appearances as one single-page PDF sized to their union /Rect. Locks:\n * 1. bytes are a PDF; the source page is untouched (no mutation, no\n * revision bump);\n * 2. re-opened (local engines), the page is exactly the union size and the\n * requested count of annotations is gone — they are content now;\n * 3. a ref on another page rejects `InvalidArg`; an empty list rejects.\n * Skips cleanly when the engine does not implement the optional member.\n */\nexport function runAnnotationAppearanceExportConformance(\n runner: ConformanceTestRunner,\n opts: ConformanceOptions,\n): void {\n const { describe, test, beforeAll, afterAll, expect } = runner;\n\n describe(`annotation appearance export conformance: ${opts.label}`, () => {\n let engine: Engine;\n\n beforeAll(async () => {\n engine = await opts.makeEngine();\n });\n\n afterAll(async () => {\n if (engine) await engine.destroy();\n });\n\n test('returns a single-page PDF sized to the union rect; source untouched', async () => {\n const doc = await openFixture(engine, opts);\n let exported: DocumentHandle | null = null;\n try {\n const pageObjectNumber = (await doc.pages.list()).pages[0].ref.objectNumber;\n const page = doc.page(toPageRef(pageObjectNumber));\n if (!page.annotations.exportAppearance) return;\n const a = (await page.annotations.create(square(20, 20))).annotation.ref;\n const b = (await page.annotations.create(square(100, 60, 30))).annotation.ref;\n const before = await page.annotations.list();\n\n const bytes = await page.annotations.exportAppearance([a, b]);\n expect(bytes.length > 4).toBe(true);\n expect([...bytes.subarray(0, 4)]).toEqual(PDF_MAGIC);\n\n const after = await page.annotations.list();\n expect(after.annotations).toEqual(before.annotations);\n\n if (opts.openKind !== 'bytes') return;\n exported = await engine.open(\n { kind: 'bytes', id: `${opts.fixture.id}-appearance`, bytes },\n EVERY_PERMISSION,\n );\n const layout = await exported.pages.list();\n expect(layout.pageCount).toBe(1);\n // Union of [20..60]×[20..60] and [100..130]×[60..90] → 110 × 70.\n expect(Math.round(layout.pages[0].size.width)).toBe(110);\n expect(Math.round(layout.pages[0].size.height)).toBe(70);\n const exportedPage = exported.page(layout.pages[0].ref);\n expect((await exportedPage.annotations.list()).annotations).toHaveLength(0);\n } finally {\n if (exported) await exported.close();\n await doc.close();\n }\n });\n\n test('a ref on another page and an empty list reject InvalidArg', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const layout = await doc.pages.list();\n const page0 = doc.page(layout.pages[0].ref);\n if (!page0.annotations.exportAppearance) return;\n await expect(page0.annotations.exportAppearance([])).rejects.toMatchObject({\n code: EngineErrorCode.InvalidArg,\n });\n if (layout.pages.length < 2) return;\n const page1 = doc.page(layout.pages[1].ref);\n const own = (await page0.annotations.create(square(20, 100))).annotation.ref;\n const foreign = (await page1.annotations.create(square(20, 100))).annotation.ref;\n await expect(page0.annotations.exportAppearance([own, foreign])).rejects.toMatchObject({\n code: EngineErrorCode.InvalidArg,\n });\n } finally {\n await doc.close();\n }\n });\n });\n}\n\nasync function openFixture(engine: Engine, opts: ConformanceOptions): Promise<DocumentHandle> {\n if (opts.openKind === 'bytes') {\n return engine.open(\n { kind: 'bytes', id: opts.fixture.id, bytes: await opts.fixture.bytes() },\n EVERY_PERMISSION,\n );\n }\n return engine.open({ kind: 'id', id: opts.fixture.cloudId ?? opts.fixture.id });\n}\n","import type { DocumentEvent } from '../events/DocumentEvent';\nimport type { DocumentHandle } from '../engine/DocumentHandle';\nimport type { Engine } from '../engine/Engine';\nimport { EngineErrorCode } from '../errors/EngineErrorCode';\nimport { toPageRef } from '../identity/PageRef';\nimport { PageFlattenResultSchema } from '../wire/schemas';\nimport type { ConformanceOptions, ConformanceTestRunner } from './runMetadataConformance';\nimport { EVERY_PERMISSION } from './fixtureScope';\n\n/** Transport-neutral coverage for the content + annotation flatten rail. */\nexport function runPageFlattenConformance(\n runner: ConformanceTestRunner,\n opts: ConformanceOptions,\n): void {\n const { describe, test, beforeAll, afterAll, expect } = runner;\n\n describe(`page flatten conformance: ${opts.label}`, () => {\n let engine: Engine;\n\n beforeAll(async () => {\n engine = await opts.makeEngine();\n });\n\n afterAll(async () => {\n if (engine) await engine.destroy();\n });\n\n test('flattens eligible appearances once without changing layout', async () => {\n const doc = await openFixture(engine, opts);\n try {\n if (!doc.pages.flatten) return;\n const layoutBefore = await doc.pages.list();\n const pageObjectNumber = layoutBefore.pages[0].ref.objectNumber;\n const annotationsBefore = await doc.page(toPageRef(pageObjectNumber)).annotations.list();\n const events: DocumentEvent[] = [];\n const unsubscribe = doc.events.subscribe((event) => {\n if (event.type === 'pages.flattened') events.push(event);\n });\n\n const result = await doc.pages.flatten([toPageRef(pageObjectNumber)], { usage: 'display' });\n expect(PageFlattenResultSchema.safeParse(result).success).toBe(true);\n expect(result.pages).toEqual([toPageRef(pageObjectNumber)]);\n expect(result.usage).toBe('display');\n expect(result.results.map((item) => item.status)).toEqual(['applied']);\n expect(result.meta.affectedPages).toEqual([toPageRef(pageObjectNumber)]);\n expect(events).toHaveLength(1);\n\n const layoutAfter = await doc.pages.list();\n expect(layoutAfter).toEqual(layoutBefore);\n const annotationsAfter = await doc.page(toPageRef(pageObjectNumber)).annotations.list();\n expect(annotationsAfter.annotations.length < annotationsBefore.annotations.length).toBe(\n true,\n );\n\n const noOp = await doc.pages.flatten([toPageRef(pageObjectNumber)], { usage: 'display' });\n expect(noOp.results.map((item) => item.status)).toEqual(['unchanged']);\n expect(noOp.meta).toMatchObject({ affectedPages: [], cacheDelta: null, undoable: false });\n expect(events).toHaveLength(1);\n unsubscribe();\n\n await expect(\n doc.pages.flatten([toPageRef(pageObjectNumber), toPageRef(pageObjectNumber)]),\n ).rejects.toMatchObject({\n code: EngineErrorCode.InvalidArg,\n });\n } finally {\n await doc.close();\n }\n });\n });\n}\n\nasync function openFixture(engine: Engine, opts: ConformanceOptions): Promise<DocumentHandle> {\n if (opts.openKind === 'bytes') {\n return engine.open(\n { kind: 'bytes', id: opts.fixture.id, bytes: await opts.fixture.bytes() },\n EVERY_PERMISSION,\n );\n }\n return engine.open({ kind: 'id', id: opts.fixture.cloudId ?? opts.fixture.id });\n}\n","import type { HighlightDraft, RedactDraft } from '../annotation/kinds';\nimport type { DocumentEvent } from '../events/DocumentEvent';\nimport type { DocumentHandle } from '../engine/DocumentHandle';\nimport type { Engine } from '../engine/Engine';\nimport { EngineErrorCode } from '../errors/EngineErrorCode';\nimport { toPageRef } from '../identity/PageRef';\nimport { RedactionApplyResultSchema } from '../wire/schemas';\nimport { pdfOf } from './pdfOf';\nimport type { ConformanceOptions, ConformanceTestRunner } from './runMetadataConformance';\nimport { EVERY_PERMISSION } from './fixtureScope';\n\n/**\n * One 300-point page with neither /Contents nor /Resources, as some\n * generators write a blank page.\n */\nexport const BARE_PAGE_FIXTURE_PDF = pdfOf([\n '<< /Type /Catalog /Pages 2 0 R >>',\n '<< /Type /Pages /Kids [3 0 R] /Count 1 >>',\n '<< /Type /Page /Parent 2 0 R /MediaBox [0 0 300 300] >>',\n]);\n\nexport interface RedactionApplyConformanceOptions extends ConformanceOptions {\n /** Open {@link BARE_PAGE_FIXTURE_PDF}, fresh for each call, with write access. */\n openBarePage: (engine: Engine) => Promise<DocumentHandle>;\n}\n\n/**\n * Transport-neutral coverage for the destructive redaction-apply rail.\n * Runs against a fixture page with no pre-existing annotations so the\n * collateral counts are exact. Content-removal fidelity itself is pinned by\n * the native embeddertests; this suite pins the transport contract: scopes,\n * statuses, counts, affected pages, events, and preflight rejection.\n */\nexport function runRedactionApplyConformance(\n runner: ConformanceTestRunner,\n opts: RedactionApplyConformanceOptions,\n): void {\n const { describe, test, beforeAll, afterAll, expect } = runner;\n\n // Geometry: the highlight sits fully inside the redact rect, so applying\n // the redaction removes it as collateral (positive-area intersection).\n const REDACT_RECT = { x: 50, y: 50, width: 120, height: 100 };\n /** A highlight inside the redacted area. */\n const COLLATERAL_QUAD: HighlightDraft['quadPoints'] = [\n {\n upperLeft: { x: 70, y: 80 },\n upperRight: { x: 150, y: 80 },\n lowerLeft: { x: 70, y: 120 },\n lowerRight: { x: 150, y: 120 },\n },\n ];\n\n describe(`redaction apply conformance: ${opts.label}`, () => {\n let engine: Engine;\n\n beforeAll(async () => {\n engine = await opts.makeEngine();\n });\n\n afterAll(async () => {\n if (engine) await engine.destroy();\n });\n\n test('annotations scope applies the marked redaction and counts collateral', async () => {\n const doc = await openFixture(engine, opts);\n try {\n if (!doc.redaction) return;\n const layoutBefore = await doc.pages.list();\n const pageObjectNumber = layoutBefore.pages[0].ref.objectNumber;\n const page = doc.page(toPageRef(pageObjectNumber));\n\n const collateral = await page.annotations.create({\n subtype: 'highlight',\n quadPoints: COLLATERAL_QUAD,\n } satisfies HighlightDraft);\n expect(collateral.annotation.subtype).toBe('highlight');\n\n const marked = await page.annotations.create({\n subtype: 'redact',\n rect: REDACT_RECT,\n interiorColor: '#000000',\n overlayText: 'REDACTED',\n fontColor: '#ffffff',\n } satisfies RedactDraft);\n expect(marked.annotation.subtype).toBe('redact');\n // The mark's own popup, away from the region: it goes with the mark.\n await page.annotations.create({\n subtype: 'popup',\n rect: { x: 300, y: 300, width: 100, height: 60 },\n parent: marked.annotation.ref,\n });\n\n const before = await page.annotations.list();\n const events: DocumentEvent[] = [];\n const unsubscribe = doc.events.subscribe((event) => {\n if (event.type === 'redaction.applied') events.push(event);\n });\n\n const result = await doc.redaction.apply({ annotations: [marked.annotation.ref] });\n expect(RedactionApplyResultSchema.safeParse(result).success).toBe(true);\n expect(result.results).toHaveLength(1);\n expect(result.results[0].page.objectNumber).toBe(pageObjectNumber);\n expect(result.results[0].status).toBe('applied');\n // The highlight and the mark's popup count: the consumed redact never does.\n expect(result.results[0].removedAnnotationCount).toBe(2);\n expect(result.removedAnnotationCount).toBe(2);\n expect(result.meta.affectedPages).toEqual([page.ref]);\n expect(events).toHaveLength(1);\n unsubscribe();\n\n // The redaction, its popup and its collateral are gone; layout is\n // not a casualty.\n const after = await page.annotations.list();\n expect(after.annotations.length).toBe(before.annotations.length - 3);\n expect(await doc.pages.list()).toEqual(layoutBefore);\n // The label is part of the page now.\n expect((await page.text.get()).text).toContain('REDACTED');\n } finally {\n await doc.close();\n }\n });\n\n test('annotations scope applies several marks of a page together and leaves its others', async () => {\n const doc = await openFixture(engine, opts);\n try {\n if (!doc.redaction) return;\n const pageObjectNumber = (await doc.pages.list()).pages[0].ref.objectNumber;\n const page = doc.page(toPageRef(pageObjectNumber));\n const mark = (x: number) =>\n page.annotations.create({\n subtype: 'redact',\n rect: { x, y: 20, width: 40, height: 30 },\n interiorColor: '#000000',\n } satisfies RedactDraft);\n const first = await mark(10);\n const kept = await mark(70);\n const last = await mark(130);\n // Under the first mark: collateral of the apply.\n await page.annotations.create({\n subtype: 'highlight',\n quadPoints: [\n {\n upperLeft: { x: 15, y: 25 },\n upperRight: { x: 45, y: 25 },\n lowerLeft: { x: 15, y: 45 },\n lowerRight: { x: 45, y: 45 },\n },\n ],\n } satisfies HighlightDraft);\n\n const result = await doc.redaction.apply({\n annotations: [last.annotation.ref, first.annotation.ref],\n });\n expect(result.results).toHaveLength(1);\n expect(result.results[0].status).toBe('applied');\n expect(result.results[0].removedAnnotationCount).toBe(1);\n const left = (await page.annotations.list()).annotations;\n expect(left.map((annotation) => annotation.subtype)).toEqual(['redact']);\n expect(left[0].ref).toEqual(kept.annotation.ref);\n } finally {\n await doc.close();\n }\n });\n\n test('a label fitted to its region (fontSize 0) is burned in', async () => {\n const doc = await openFixture(engine, opts);\n try {\n if (!doc.redaction) return;\n const layout = await doc.pages.list();\n const page = doc.page(toPageRef(layout.pages[0].ref.objectNumber));\n // Marked first and labelled after, as a redaction UI does.\n const marked = await page.annotations.create({\n subtype: 'redact',\n rect: REDACT_RECT,\n interiorColor: '#000000',\n } satisfies RedactDraft);\n await page.annotations.update(marked.annotation.ref, {\n subtype: 'redact',\n overlayText: 'CLASSIFIED',\n fontSize: 0,\n fontColor: '#ffffff',\n });\n\n await doc.redaction.apply({ annotations: [marked.annotation.ref] });\n expect((await page.text.get()).text).toContain('CLASSIFIED');\n } finally {\n await doc.close();\n }\n });\n\n test('pages scope applies everything once and validates its input', async () => {\n const doc = await openFixture(engine, opts);\n try {\n if (!doc.redaction) return;\n const layout = await doc.pages.list();\n const pageObjectNumber = layout.pages[0].ref.objectNumber;\n const page = doc.page(toPageRef(pageObjectNumber));\n\n await page.annotations.create({\n subtype: 'redact',\n rect: REDACT_RECT,\n interiorColor: '#000000',\n } satisfies RedactDraft);\n\n const events: DocumentEvent[] = [];\n const unsubscribe = doc.events.subscribe((event) => {\n if (event.type === 'redaction.applied') events.push(event);\n });\n\n const applied = await doc.redaction.apply({ pages: [toPageRef(pageObjectNumber)] });\n expect(applied.results.map((item) => item.status)).toEqual(['applied']);\n expect(applied.removedAnnotationCount).toBe(0);\n expect(events).toHaveLength(1);\n\n // A page with no redactions left is unchanged: no artifact, no event.\n const noOp = await doc.redaction.apply({ pages: [toPageRef(pageObjectNumber)] });\n expect(noOp.results.map((item) => item.status)).toEqual(['unchanged']);\n expect(noOp.meta).toMatchObject({ affectedPages: [], cacheDelta: null, undoable: false });\n expect(events).toHaveLength(1);\n unsubscribe();\n\n await expect(\n doc.redaction.apply({\n pages: [toPageRef(pageObjectNumber), toPageRef(pageObjectNumber)],\n }),\n ).rejects.toMatchObject({ code: EngineErrorCode.InvalidArg });\n\n // Preflight rejects a ref that is not a redact annotation before\n // anything is written.\n const notRedact = await page.annotations.create({\n subtype: 'highlight',\n quadPoints: COLLATERAL_QUAD,\n } satisfies HighlightDraft);\n await expect(\n doc.redaction.apply({ annotations: [notRedact.annotation.ref] }),\n ).rejects.toMatchObject({ code: EngineErrorCode.InvalidArg });\n } finally {\n await doc.close();\n }\n });\n\n test('applies on a page without /Contents or /Resources', async () => {\n const doc = await opts.openBarePage(engine);\n try {\n if (!doc.redaction) return;\n const layout = await doc.pages.list();\n const page = doc.page(toPageRef(layout.pages[0].ref.objectNumber));\n await page.annotations.create({\n subtype: 'redact',\n rect: REDACT_RECT,\n interiorColor: '#000000',\n overlayText: 'REDACTED',\n fontColor: '#ffffff',\n } satisfies RedactDraft);\n\n // The overlay becomes the page's first content, its form named in\n // /Resources the page gets on the way.\n const applied = await doc.redaction.apply({ pages: [page.ref] });\n expect(applied.results.map((item) => item.status)).toEqual(['applied']);\n expect(applied.meta.affectedPages).toEqual([page.ref]);\n expect((await page.annotations.list()).annotations).toHaveLength(0);\n expect((await page.text.get()).text).toContain('REDACTED');\n } finally {\n await doc.close();\n }\n });\n });\n}\n\nasync function openFixture(engine: Engine, opts: ConformanceOptions): Promise<DocumentHandle> {\n if (opts.openKind === 'bytes') {\n return engine.open(\n { kind: 'bytes', id: opts.fixture.id, bytes: await opts.fixture.bytes() },\n EVERY_PERMISSION,\n );\n }\n return engine.open({ kind: 'id', id: opts.fixture.cloudId ?? opts.fixture.id });\n}\n","import type { ConformanceTestRunner, ConformanceOptions } from './runMetadataConformance';\nimport type { DocumentHandle } from '../engine/DocumentHandle';\nimport type { Engine } from '../engine/Engine';\nimport { EngineError } from '../errors/EngineError';\nimport { EngineErrorCode } from '../errors/EngineErrorCode';\nimport { toPageRef } from '../identity/PageRef';\nimport { AbortError } from '../promise/AbortError';\nimport { EVERY_PERMISSION } from './fixtureScope';\n\n/** `%PDF` — every extracted document must lead with the PDF header. */\nconst PDF_MAGIC = [0x25, 0x50, 0x44, 0x46];\n\n/**\n * Page extract conformance suite. `pages.extract?` is optional on the\n * contract (the `downloadLayer?` pattern) — the suite runs only when the\n * implementation provides it, so a cloud engine that has not shipped the\n * server endpoint yet skips cleanly instead of failing.\n *\n * Invariants:\n * 1. `pages.extract([pon])` returns standalone PDF bytes (magic header).\n * 2. The source document is untouched: identical layout before/after,\n * and page revisions do not bump (extract is a read).\n * 3. Caller order is preserved and page geometry survives the copy\n * (asserted by re-opening the extracted bytes — bytes-open engines\n * only, since a cloud engine cannot re-open loose bytes).\n * 4. Empty / duplicate page object numbers reject `InvalidArg`; unknown page object numbers reject\n * `NotFound` (or `InvalidArg`); abort propagates as `AbortError`.\n */\nexport function runPageExtractConformance(\n runner: ConformanceTestRunner,\n opts: ConformanceOptions,\n): void {\n const { describe, test, beforeAll, afterAll, expect } = runner;\n\n describe(`page extract conformance: ${opts.label}`, () => {\n let engine: Engine;\n\n beforeAll(async () => {\n engine = await opts.makeEngine();\n });\n\n afterAll(async () => {\n if (engine) await engine.destroy();\n });\n\n test('pages.extract() returns standalone PDF bytes and leaves the source untouched', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const before = await doc.pages.list();\n const target = before.pages[before.pages.length - 1];\n\n const bytes = await doc.pages.extract([target.ref]);\n expect(bytes.length > PDF_MAGIC.length).toBe(true);\n expect(Array.from(bytes.slice(0, PDF_MAGIC.length))).toEqual(PDF_MAGIC);\n\n // Extract is a read: the source layout is exactly what it was.\n const after = await doc.pages.list();\n expect(after.pages.map((p) => p.ref.objectNumber)).toEqual(\n before.pages.map((p) => p.ref.objectNumber),\n );\n expect(after.pageCount).toBe(before.pageCount);\n } finally {\n await doc.close();\n }\n });\n\n test('extracted bytes re-open as a document with the requested pages, in caller order', async () => {\n if (opts.openKind !== 'bytes') return;\n const doc = await openFixture(engine, opts);\n let extracted: DocumentHandle | null = null;\n try {\n const list = await doc.pages.list();\n if (list.pages.length < 2) return;\n // Reversed order on purpose: output order is caller order.\n const p0 = list.pages[0];\n const p1 = list.pages[1];\n const bytes = await doc.pages.extract([p1.ref, p0.ref]);\n\n extracted = await engine.open(\n { kind: 'bytes', id: `${opts.fixture.id}-extracted`, bytes },\n EVERY_PERMISSION,\n );\n const out = await extracted.pages.list();\n expect(out.pageCount).toBe(2);\n expect(out.pages[0].size).toEqual(p1.size);\n expect(out.pages[1].size).toEqual(p0.size);\n } finally {\n if (extracted) await extracted.close();\n await doc.close();\n }\n });\n\n test('pages.extract() rejects empty input with InvalidArg', async () => {\n const doc = await openFixture(engine, opts);\n try {\n let caught: unknown;\n try {\n await doc.pages.extract([]);\n } catch (err) {\n caught = err;\n }\n expect(EngineError.is(caught, EngineErrorCode.InvalidArg)).toBe(true);\n } finally {\n await doc.close();\n }\n });\n\n test('pages.extract() rejects duplicate PONs with InvalidArg', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const list = await doc.pages.list();\n const pageObjectNumber = list.pages[0].ref.objectNumber;\n let caught: unknown;\n try {\n await doc.pages.extract([toPageRef(pageObjectNumber), toPageRef(pageObjectNumber)]);\n } catch (err) {\n caught = err;\n }\n expect(EngineError.is(caught, EngineErrorCode.InvalidArg)).toBe(true);\n } finally {\n await doc.close();\n }\n });\n\n test('pages.extract() rejects unknown PON with NotFound or InvalidArg', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const list = await doc.pages.list();\n let bogus = 0;\n for (const p of list.pages) bogus = Math.max(bogus, p.ref.objectNumber);\n bogus += 9999;\n\n let caught: unknown;\n try {\n await doc.pages.extract([toPageRef(bogus)]);\n } catch (err) {\n caught = err;\n }\n expect(\n EngineError.is(caught, EngineErrorCode.NotFound) ||\n EngineError.is(caught, EngineErrorCode.InvalidArg),\n ).toBe(true);\n } finally {\n await doc.close();\n }\n });\n\n test('abort on pages.extract() rejects with AbortError', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const list = await doc.pages.list();\n const p = doc.pages.extract([list.pages[0].ref]);\n p.abort('test');\n await expect(p).rejects.toBeInstanceOf(AbortError);\n } finally {\n await doc.close();\n }\n });\n });\n}\n\nasync function openFixture(engine: Engine, opts: ConformanceOptions): Promise<DocumentHandle> {\n if (opts.openKind === 'bytes') {\n const bytes = await opts.fixture.bytes();\n return engine.open({ kind: 'bytes', id: opts.fixture.id, bytes }, EVERY_PERMISSION);\n }\n return engine.open({ kind: 'id', id: opts.fixture.cloudId ?? opts.fixture.id });\n}\n","import { iconRect } from './creatables';\nimport type { ConformanceTestRunner, ConformanceOptions } from './runMetadataConformance';\nimport type { FileAttachmentAnnotation, TextAnnotation } from '../annotation/kinds';\nimport type { DocumentHandle } from '../engine/DocumentHandle';\nimport type { Engine } from '../engine/Engine';\nimport { toAttachmentRef } from '../dto/Attachment';\nimport { EngineError } from '../errors/EngineError';\nimport { EngineErrorCode } from '../errors/EngineErrorCode';\nimport { deletedAttachmentOf } from '../mutation/AttachmentMutationResults';\nimport { AttachmentCreateResultSchema, AttachmentListSchema } from '../wire/schemas';\nimport type { PageObjectNumber } from '../identity/PageObjectNumber';\nimport { toPageRef } from '../identity/PageRef';\nimport { EVERY_PERMISSION } from './fixtureScope';\n\n/**\n * Attachment conformance suite. Fixture requirement: a document whose\n * `/EmbeddedFiles` name tree contains at least one embedded file.\n *\n * Both attachment surfaces are optional on the contract (the\n * `downloadLayer?` pattern), probed independently and skipped cleanly:\n * - `doc.attachments?` — document-level EmbeddedFiles (list/download)\n * - `page.annotations.downloadResource(ref, 'file')` — annotation-level file bytes\n *\n * Invariants:\n * 1. `list()` reflects the name tree: positional indices, non-empty\n * names, and repeated calls agree (a read).\n * 2. `download(index)` round-trips the listed metadata and returns\n * exactly `size` decoded bytes when the fixture declares one.\n * 3. Unknown indices reject with an `EngineError`.\n * 4. A created file-attachment annotation round-trips its file:\n * metadata inline on the DTO (never bytes), bytes byte-identical\n * as its `file` resource.\n * 5. A created text (sticky-note) annotation round-trips icon + color.\n */\nexport function runAttachmentConformance(\n runner: ConformanceTestRunner,\n opts: ConformanceOptions,\n): void {\n const { describe, test, beforeAll, afterAll, expect } = runner;\n\n describe(`attachment conformance: ${opts.label}`, () => {\n let engine: Engine;\n let docSupported = false;\n let annotSupported = false;\n let firstPageObjectNumber: PageObjectNumber;\n\n beforeAll(async () => {\n engine = await opts.makeEngine();\n const probe = await openFixture(engine, opts);\n docSupported = probe.attachments !== undefined;\n const pages = await probe.pages.list();\n firstPageObjectNumber = pages.pages[0].ref.objectNumber;\n annotSupported =\n probe.page(toPageRef(firstPageObjectNumber)).annotations.downloadResource !== undefined;\n await probe.close();\n });\n\n afterAll(async () => {\n if (engine) await engine.destroy();\n });\n\n test('attachments.list() reflects the /EmbeddedFiles name tree and is a stable read', async () => {\n if (!docSupported) return;\n const doc = await openFixture(engine, opts);\n try {\n const list = await doc.attachments.list();\n expect(AttachmentListSchema.safeParse(list).success).toBe(true);\n const items = list.attachments;\n expect(items.length > 0).toBe(true);\n items.forEach((item, position) => {\n expect(item.index).toBe(position);\n expect(item.ref.key.length > 0).toBe(true);\n expect(item.name.length > 0).toBe(true);\n });\n // Keys are unique by construction — they are the durable refs.\n expect(new Set(items.map((i) => i.ref.key)).size).toBe(items.length);\n // A read: calling again observes the identical snapshot.\n expect(await doc.attachments.list()).toEqual(list);\n } finally {\n await doc.close();\n }\n });\n\n test('attachments.download() round-trips the listed metadata and decoded size', async () => {\n if (!docSupported) return;\n const doc = await openFixture(engine, opts);\n try {\n const { attachments } = await doc.attachments.list();\n for (const item of attachments) {\n const content = await doc.attachments.download(item.ref);\n expect(content.name).toBe(item.name);\n if (item.mimeType !== null) {\n expect(content.mimeType).toBe(item.mimeType);\n }\n if (item.size !== null) {\n expect(content.bytes.length).toBe(item.size);\n }\n }\n } finally {\n await doc.close();\n }\n });\n\n test('attachments.download() rejects an unknown key', async () => {\n if (!docSupported) return;\n const doc = await openFixture(engine, opts);\n try {\n await expect(\n doc.attachments.download(toAttachmentRef('conformance-no-such-key.bin')),\n ).rejects.toBeInstanceOf(EngineError);\n } finally {\n await doc.close();\n }\n });\n\n test('a File brings its name and type, and a file without a type has none', async () => {\n if (!docSupported) return;\n const doc = await openFixture(engine, opts);\n try {\n const picked = new File([new Uint8Array([1, 2, 3])], '0-picked.csv', { type: 'text/csv' });\n const { attachment: fromFile } = await doc.attachments.create({ data: picked });\n expect(fromFile.name).toBe('0-picked.csv');\n expect(fromFile.mimeType).toBe('text/csv');\n\n // Bytes with no type: the engine doesn't guess one.\n const { attachment: untyped } = await doc.attachments.create({\n data: new Uint8Array([4, 5, 6]),\n name: '0-untyped.bin',\n });\n expect(untyped.mimeType).toBe(null);\n expect((await doc.attachments.download(untyped.ref)).mimeType).toBe(null);\n expect((await doc.attachments.download(fromFile.ref)).mimeType).toBe('text/csv');\n\n // Bare bytes need a name.\n await expect(doc.attachments.create({ data: new Uint8Array([7]) })).rejects.toMatchObject({\n code: EngineErrorCode.InvalidArg,\n });\n } finally {\n await doc.close();\n }\n });\n\n test('create() and delete() round-trip the name tree; keys survive index shifts', async () => {\n if (!docSupported) return;\n const doc = await openFixture(engine, opts);\n try {\n const { attachments: before } = await doc.attachments.list();\n const data = new Uint8Array(512);\n for (let i = 0; i < data.length; i++) data[i] = (i * 7 + 3) & 0xff;\n\n // \"0-…\" sorts before the fixture's entries, shifting their indices —\n // the sharpest difference from append-only annotation creates.\n const createdResult = await doc.attachments.create({\n data: data.buffer,\n name: '0-conformance.bin',\n mimeType: 'application/octet-stream',\n description: 'added by conformance',\n });\n expect(AttachmentCreateResultSchema.safeParse(createdResult).success).toBe(true);\n const created = createdResult.attachment;\n expect(created.ref).toEqual(toAttachmentRef('0-conformance.bin'));\n expect(createdResult.meta.changed).toEqual([created.ref]);\n expect(created.name).toBe('0-conformance.bin');\n expect(created.mimeType).toBe('application/octet-stream');\n expect(created.description).toBe('added by conformance');\n expect(created.size).toBe(data.length);\n\n const { attachments: after } = await doc.attachments.list();\n expect(after.length).toBe(before.length + 1);\n // Pre-existing keys still resolve even though their indices shifted.\n for (const item of before) {\n const match = after.find((i) => i.ref.key === item.ref.key);\n expect(match !== undefined).toBe(true);\n }\n\n // Duplicate keys reject — keys are the identity.\n await expect(\n doc.attachments.create({ data, name: '0-conformance.bin' }),\n ).rejects.toBeInstanceOf(EngineError);\n\n // The created file round-trips byte-identically.\n const content = await doc.attachments.download(created.ref);\n expect(content.bytes.length).toBe(data.length);\n expect(content.bytes.every((byte, i) => byte === data[i])).toBe(true);\n\n // Delete by ref; the ref stops resolving and the rest are intact.\n const removed = await doc.attachments.delete(created.ref);\n expect(Object.keys(removed)).toEqual(['meta']);\n expect(deletedAttachmentOf(removed)).toEqual(created.ref);\n const { attachments: final } = await doc.attachments.list();\n expect(final.map((i) => i.ref)).toEqual(before.map((i) => i.ref));\n await expect(doc.attachments.delete(created.ref)).rejects.toBeInstanceOf(EngineError);\n } finally {\n await doc.close();\n }\n });\n\n test('a file-attachment annotation takes a File as it is, and never guesses a type', async () => {\n if (!annotSupported) return;\n const doc = await openFixture(engine, opts);\n try {\n const annotations = doc.page(toPageRef(firstPageObjectNumber)).annotations;\n const rect = { x: 80, y: 40, width: 20, height: 20 };\n const picked = new File([new Uint8Array([1, 2, 3])], 'figures.csv', { type: 'text/csv' });\n const { annotation: fromFile } = await annotations.create(\n { subtype: 'file-attachment', rect: iconRect(rect.x, rect.y) },\n { resources: { file: picked } },\n );\n const file = (fromFile as FileAttachmentAnnotation).file!;\n expect(file.name).toBe('figures.csv');\n expect(file.mimeType).toBe('text/csv');\n\n const { annotation: untyped } = await annotations.create(\n {\n subtype: 'file-attachment',\n rect: iconRect(rect.x, rect.y),\n file: { name: 'raw.bin' },\n },\n { resources: { file: new Uint8Array([4, 5]) } },\n );\n expect((untyped as FileAttachmentAnnotation).file!.mimeType).toBe(null);\n\n // Bare bytes need a name.\n await expect(\n annotations.create(\n { subtype: 'file-attachment', rect: iconRect(rect.x, rect.y) },\n { resources: { file: new Uint8Array([6]) } },\n ),\n ).rejects.toMatchObject({\n code: EngineErrorCode.InvalidArg,\n details: { field: 'file.name' },\n });\n } finally {\n await doc.close();\n }\n });\n\n test('a created file-attachment annotation round-trips its file as its file resource', async () => {\n if (!annotSupported) return;\n const doc = await openFixture(engine, opts);\n try {\n const annotations = doc.page(toPageRef(firstPageObjectNumber)).annotations;\n const data = new Uint8Array(2048);\n for (let i = 0; i < data.length; i++) data[i] = (i * 31 + 7) & 0xff;\n\n const { annotation: created } = await annotations.create(\n {\n subtype: 'file-attachment',\n rect: iconRect(40, 60),\n file: {\n name: 'conformance.bin',\n mimeType: 'application/octet-stream',\n description: 'attachment conformance payload',\n },\n icon: 'paperclip',\n color: '#dc2626',\n contents: 'conformance attachment',\n },\n { resources: { file: data } },\n );\n\n // Metadata rides the DTO; bytes never do.\n const dto = created as FileAttachmentAnnotation;\n expect(dto.subtype).toBe('file-attachment');\n expect(dto.icon).toBe('paperclip');\n expect(dto.color).toEqual('#dc2626');\n const file = dto.file!;\n expect(file.name).toBe('conformance.bin');\n expect(file.mimeType).toBe('application/octet-stream');\n expect(file.description).toBe('attachment conformance payload');\n expect(file.size).toBe(data.length);\n\n // Bytes come back byte-identical as the `file` resource.\n const bytes = await annotations.downloadResource(dto.ref, 'file');\n expect(bytes.length).toBe(data.length);\n expect(Array.from(bytes.slice(0, 16))).toEqual(Array.from(data.slice(0, 16)));\n expect(bytes.every((byte, i) => byte === data[i])).toBe(true);\n\n // A read goes back in: into a create (its name cleared, as a copy on\n // the same page needs), with the bytes it downloaded, and into an\n // update that sends its file back unchanged.\n const { annotation: copy } = await annotations.create(\n { ...dto, nm: null },\n { resources: { file: bytes } },\n );\n expect((copy as FileAttachmentAnnotation).file).toMatchObject({\n name: 'conformance.bin',\n mimeType: 'application/octet-stream',\n description: 'attachment conformance payload',\n size: data.length,\n });\n const { annotation: updated } = await annotations.update(dto.ref, {\n ...dto,\n contents: 'changed',\n });\n expect((updated as FileAttachmentAnnotation).file?.name).toBe('conformance.bin');\n expect(updated.contents).toBe('changed');\n } finally {\n await doc.close();\n }\n });\n\n test('a created text annotation round-trips icon, color, and contents', async () => {\n if (!annotSupported) return;\n const doc = await openFixture(engine, opts);\n try {\n const annotations = doc.page(toPageRef(firstPageObjectNumber)).annotations;\n const { annotation: created } = await annotations.create({\n subtype: 'text',\n rect: iconRect(100, 120),\n icon: 'comment',\n color: '#facc15',\n contents: 'conformance note',\n });\n const dto = created as TextAnnotation;\n expect(dto.subtype).toBe('text');\n expect(dto.icon).toBe('comment');\n expect(dto.color).toEqual('#facc15');\n expect(dto.contents).toBe('conformance note');\n\n // Icon is patchable; the file half of an attachment is not, and\n // the same presentation-only patch path applies to notes.\n const { annotation: updated } = await annotations.update(dto.ref, {\n subtype: 'text',\n icon: 'help',\n });\n expect((updated as TextAnnotation).icon).toBe('help');\n } finally {\n await doc.close();\n }\n });\n });\n\n async function openFixture(engine: Engine, options: ConformanceOptions): Promise<DocumentHandle> {\n if (options.openKind === 'bytes') {\n return engine.open(\n {\n kind: 'bytes',\n id: options.fixture.id,\n bytes: await options.fixture.bytes(),\n },\n EVERY_PERMISSION,\n );\n }\n return engine.open({ kind: 'id', id: options.fixture.cloudId ?? options.fixture.id });\n }\n}\n","import type { ConformanceTestRunner, ConformanceOptions } from './runMetadataConformance';\nimport type { DocumentHandle } from '../engine/DocumentHandle';\nimport type { Engine } from '../engine/Engine';\nimport { EngineError } from '../errors/EngineError';\nimport { EngineErrorCode } from '../errors/EngineErrorCode';\nimport { toPageRef } from '../identity/PageRef';\nimport { EVERY_PERMISSION } from './fixtureScope';\n\n/**\n * Page insert conformance. `pages.insert` is a required member — this suite\n * runs unconditionally on every engine, so an implementation that loses the\n * verb fails loudly instead of being skipped past.\n *\n * Invariants:\n * 1. Every page of the source bytes is copied in at `toIndex` (omitted →\n * append), in source order; the result lists the fresh page object numbers in\n * insertion order and they agree with the returned layout.\n * 2. Pre-existing pages keep their identity: same page object numbers before and after,\n * in the expected positions (an insert never invalidates neighbours).\n * 3. The mutation persists through save → re-open (bytes engines only).\n * 4. Empty bytes / malformed bytes / out-of-range toIndex reject with\n * InvalidArg / MalformedPdf, leaving the document untouched.\n */\n/** No fixture has a page object this high. */\nconst UNKNOWN_PAGE = 999_999;\n\nexport function runPageInsertConformance(\n runner: ConformanceTestRunner,\n opts: ConformanceOptions,\n): void {\n const { describe, test, beforeAll, afterAll, expect } = runner;\n\n describe(`page insert conformance: ${opts.label}`, () => {\n let engine: Engine;\n\n beforeAll(async () => {\n engine = await opts.makeEngine();\n });\n\n afterAll(async () => {\n if (engine) await engine.destroy();\n });\n\n test('appends every source page with fresh PONs; existing pages keep identity', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const before = await doc.pages.list();\n const beforePageObjectNumbers = before.pages.map((p) => p.ref.objectNumber);\n // Self-source: extract the first page, insert it back (append).\n const single = await doc.pages.extract([toPageRef(beforePageObjectNumbers[0])]);\n\n const result = await doc.pages.insert(single);\n expect(result.insertedPages.length).toBe(1);\n expect(result.layout.pageCount).toBe(before.pageCount + 1);\n // Existing pages: same identity, same leading positions.\n expect(\n result.layout.pages.slice(0, before.pageCount).map((p) => p.ref.objectNumber),\n ).toEqual(beforePageObjectNumbers);\n // The appended copy is a fresh object number at the tail.\n const newPageObjectNumber = result.insertedPages[0].objectNumber;\n expect(beforePageObjectNumbers.includes(newPageObjectNumber)).toBe(false);\n expect(result.layout.pages[before.pageCount].ref.objectNumber).toBe(newPageObjectNumber);\n // The copy inherits the source page's geometry.\n expect(result.layout.pages[before.pageCount].size).toEqual(before.pages[0].size);\n } finally {\n await doc.close();\n }\n });\n\n test('a position places the block after its neighbour, in source order', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const before = await doc.pages.list();\n if (before.pages.length < 2) return;\n const beforePageObjectNumbers = before.pages.map((p) => p.ref.objectNumber);\n const two = await doc.pages.extract([\n toPageRef(beforePageObjectNumbers[0]),\n toPageRef(beforePageObjectNumbers[1]),\n ]);\n\n const result = await doc.pages.insert(two, { after: before.pages[0].ref });\n expect(result.insertedPages.length).toBe(2);\n const pageObjectNumbers = result.layout.pages.map((p) => p.ref.objectNumber);\n expect(pageObjectNumbers[0]).toBe(beforePageObjectNumbers[0]);\n expect(pageObjectNumbers.slice(1, 3)).toEqual(\n result.insertedPages.map((p) => p.objectNumber),\n );\n expect(pageObjectNumbers.slice(3)).toEqual(beforePageObjectNumbers.slice(1));\n } finally {\n await doc.close();\n }\n });\n\n test('the inserted pages persist through save → re-open', async () => {\n if (opts.openKind !== 'bytes') return;\n const doc = await openFixture(engine, opts);\n let reopened: DocumentHandle | null = null;\n try {\n const before = await doc.pages.list();\n const single = await doc.pages.extract([before.pages[0].ref]);\n await doc.pages.insert(single);\n const bytes = await doc.download();\n\n reopened = await engine.open(\n {\n kind: 'bytes',\n id: `${opts.fixture.id}-insert-reopen`,\n bytes,\n },\n EVERY_PERMISSION,\n );\n const after = await reopened.pages.list();\n expect(after.pageCount).toBe(before.pageCount + 1);\n } finally {\n if (reopened) await reopened.close();\n await doc.close();\n }\n });\n\n test('empty bytes reject with InvalidArg; garbage rejects with MalformedPdf', async () => {\n const doc = await openFixture(engine, opts);\n try {\n let caught: unknown;\n try {\n await doc.pages.insert(new Uint8Array(0));\n } catch (err) {\n caught = err;\n }\n expect(EngineError.is(caught, EngineErrorCode.InvalidArg)).toBe(true);\n\n caught = undefined;\n try {\n await doc.pages.insert(new TextEncoder().encode('not a pdf at all'));\n } catch (err) {\n caught = err;\n }\n expect(EngineError.is(caught, EngineErrorCode.MalformedPdf)).toBe(true);\n\n // Untouched after both rejections.\n const list = await doc.pages.list();\n expect(list.pageCount > 0).toBe(true);\n } finally {\n await doc.close();\n }\n });\n\n test('a neighbour that is not a page of the document rejects with NotFound', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const before = await doc.pages.list();\n const single = await doc.pages.extract([before.pages[0].ref]);\n let caught: unknown;\n try {\n await doc.pages.insert(single, { before: toPageRef(UNKNOWN_PAGE) });\n } catch (err) {\n caught = err;\n }\n expect(EngineError.is(caught, EngineErrorCode.NotFound)).toBe(true);\n expect((await doc.pages.list()).pageCount).toBe(before.pageCount);\n } finally {\n await doc.close();\n }\n });\n });\n}\n\nasync function openFixture(engine: Engine, opts: ConformanceOptions): Promise<DocumentHandle> {\n if (opts.openKind === 'bytes') {\n const bytes = await opts.fixture.bytes();\n return engine.open({ kind: 'bytes', id: opts.fixture.id, bytes }, EVERY_PERMISSION);\n }\n return engine.open({ kind: 'id', id: opts.fixture.cloudId ?? opts.fixture.id });\n}\n","import type { ConformanceTestRunner, ConformanceOptions } from './runMetadataConformance';\nimport type { DocumentHandle } from '../engine/DocumentHandle';\nimport type { Engine } from '../engine/Engine';\nimport { EngineError } from '../errors/EngineError';\nimport { EngineErrorCode } from '../errors/EngineErrorCode';\nimport { toPageRef } from '../identity/PageRef';\nimport { PAGE_INSERT_BLANK_MAX_COUNT } from '../mutation/PageInsertBlankInput';\nimport { EVERY_PERMISSION } from './fixtureScope';\n\n/** An on-purpose non-default size so the assertions can't pass by accident. */\nconst SIZE = { width: 396, height: 612 };\n/** No fixture has a page object this high. */\nconst UNKNOWN_PAGE = 999_999;\n\n/**\n * Blank-page insert conformance. `pages.insertBlank` is a required member —\n * the suite runs unconditionally on every engine (no fixture bytes are\n * needed at all, which is the point of the verb), so an implementation that\n * loses the verb fails loudly instead of being skipped past.\n *\n * Invariants:\n * 1. `count` blank pages of exactly `size` appear at `toIndex` (omitted\n * → append), rotation 0; the result lists their fresh page object numbers in insertion\n * order and they agree with the returned layout.\n * 2. Pre-existing pages keep their identity: same page object numbers before and after,\n * in the expected positions (an insert never invalidates neighbours).\n * 3. The mutation persists through save → re-open (bytes engines only).\n * 4. Non-positive size / count outside [1, PAGE_INSERT_BLANK_MAX_COUNT] /\n * out-of-range toIndex reject with InvalidArg, leaving the document\n * untouched.\n */\nexport function runPageInsertBlankConformance(\n runner: ConformanceTestRunner,\n opts: ConformanceOptions,\n): void {\n const { describe, test, beforeAll, afterAll, expect } = runner;\n\n describe(`page insert-blank conformance: ${opts.label}`, () => {\n let engine: Engine;\n\n beforeAll(async () => {\n engine = await opts.makeEngine();\n });\n\n afterAll(async () => {\n if (engine) await engine.destroy();\n });\n\n test('appends one blank page of the requested size with a fresh PON', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const before = await doc.pages.list();\n const beforePageObjectNumbers = before.pages.map((p) => p.ref.objectNumber);\n\n const result = await doc.pages.insertBlank({ size: SIZE });\n expect(result.insertedPages.length).toBe(1);\n expect(result.layout.pageCount).toBe(before.pageCount + 1);\n // Existing pages: same identity, same leading positions.\n expect(\n result.layout.pages.slice(0, before.pageCount).map((p) => p.ref.objectNumber),\n ).toEqual(beforePageObjectNumbers);\n // The appended page is a fresh object number at the tail.\n const newPageObjectNumber = result.insertedPages[0].objectNumber;\n expect(beforePageObjectNumbers.includes(newPageObjectNumber)).toBe(false);\n const appended = result.layout.pages[before.pageCount];\n expect(appended.ref.objectNumber).toBe(newPageObjectNumber);\n expect(appended.size).toEqual(SIZE);\n expect(appended.rotation).toBe(0);\n } finally {\n await doc.close();\n }\n });\n\n test('a position + count places the blank block after its neighbour', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const before = await doc.pages.list();\n if (before.pages.length < 2) return;\n const beforePageObjectNumbers = before.pages.map((p) => p.ref.objectNumber);\n\n const result = await doc.pages.insertBlank(\n { size: SIZE, count: 2 },\n { after: before.pages[0].ref },\n );\n expect(result.insertedPages.length).toBe(2);\n expect(result.insertedPages[0].objectNumber === result.insertedPages[1].objectNumber).toBe(\n false,\n );\n const pageObjectNumbers = result.layout.pages.map((p) => p.ref.objectNumber);\n expect(pageObjectNumbers[0]).toBe(beforePageObjectNumbers[0]);\n expect(pageObjectNumbers.slice(1, 3)).toEqual(\n result.insertedPages.map((p) => p.objectNumber),\n );\n expect(pageObjectNumbers.slice(3)).toEqual(beforePageObjectNumbers.slice(1));\n expect(result.layout.pages[1].size).toEqual(SIZE);\n expect(result.layout.pages[2].size).toEqual(SIZE);\n } finally {\n await doc.close();\n }\n });\n\n test('the blank pages persist through save → re-open', async () => {\n if (opts.openKind !== 'bytes') return;\n const doc = await openFixture(engine, opts);\n let reopened: DocumentHandle | null = null;\n try {\n const before = await doc.pages.list();\n await doc.pages.insertBlank({ size: SIZE });\n const bytes = await doc.download();\n\n reopened = await engine.open(\n {\n kind: 'bytes',\n id: `${opts.fixture.id}-insert-blank-reopen`,\n bytes,\n },\n EVERY_PERMISSION,\n );\n const after = await reopened.pages.list();\n expect(after.pageCount).toBe(before.pageCount + 1);\n const tail = after.pages[after.pageCount - 1];\n expect(Math.round(tail.size.width)).toBe(SIZE.width);\n expect(Math.round(tail.size.height)).toBe(SIZE.height);\n } finally {\n if (reopened) await reopened.close();\n await doc.close();\n }\n });\n\n test('non-positive size and bad count reject with InvalidArg; an unknown neighbour with NotFound', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const before = await doc.pages.list();\n const rejects: Array<() => Promise<unknown>> = [\n () => doc.pages.insertBlank({ size: { width: 0, height: 612 } }),\n () => doc.pages.insertBlank({ size: { width: 396, height: -10 } }),\n () => doc.pages.insertBlank({ size: SIZE, count: 0 }),\n () => doc.pages.insertBlank({ size: SIZE, count: PAGE_INSERT_BLANK_MAX_COUNT + 1 }),\n ];\n for (const attempt of rejects) {\n let caught: unknown;\n try {\n await attempt();\n } catch (err) {\n caught = err;\n }\n expect(EngineError.is(caught, EngineErrorCode.InvalidArg)).toBe(true);\n }\n let caught: unknown;\n try {\n await doc.pages.insertBlank({ size: SIZE }, { after: toPageRef(UNKNOWN_PAGE) });\n } catch (err) {\n caught = err;\n }\n expect(EngineError.is(caught, EngineErrorCode.NotFound)).toBe(true);\n\n // Untouched after every rejection.\n const list = await doc.pages.list();\n expect(list.pageCount).toBe(before.pageCount);\n expect(list.pages.map((p) => p.ref.objectNumber)).toEqual(\n before.pages.map((p) => p.ref.objectNumber),\n );\n } finally {\n await doc.close();\n }\n });\n });\n}\n\nasync function openFixture(engine: Engine, opts: ConformanceOptions): Promise<DocumentHandle> {\n if (opts.openKind === 'bytes') {\n const bytes = await opts.fixture.bytes();\n return engine.open({ kind: 'bytes', id: opts.fixture.id, bytes }, EVERY_PERMISSION);\n }\n return engine.open({ kind: 'id', id: opts.fixture.cloudId ?? opts.fixture.id });\n}\n","import { UUID_V7 } from './names';\nimport { pdfOf } from './pdfOf';\nimport type { ConformanceTestRunner } from './runMetadataConformance';\nimport type { DocumentHandle } from '../engine/DocumentHandle';\nimport type { Engine } from '../engine/Engine';\nimport { EngineErrorCode } from '../errors/EngineErrorCode';\nimport type { DocumentEvent } from '../events/DocumentEvent';\nimport type { PageBox } from '../geometry/pageSpace';\nimport { annotationKey } from '../identity/annotationKey';\nimport type { AnnotationRef } from '../identity/AnnotationRef';\nimport { toPageRef, type PageRef } from '../identity/PageRef';\n\n/**\n * Two pages and a form. The first page holds a merged text field and widget\n * (object 5, `merged`), the second nothing.\n */\nexport const OBJECT_NUMBER_FIXTURE_PDF = pdfOf([\n '<< /Type /Catalog /Pages 2 0 R /AcroForm << /Fields [5 0 R] /DA (/Helv 0 Tf 0 g) ' +\n '/DR << /Font << /Helv << /Type /Font /Subtype /Type1 /BaseFont /Helvetica >> >> >> >> >>',\n '<< /Type /Pages /Kids [3 0 R 4 0 R] /Count 2 >>',\n '<< /Type /Page /Parent 2 0 R /MediaBox [0 0 300 300] /Annots [5 0 R] >>',\n '<< /Type /Page /Parent 2 0 R /MediaBox [0 0 300 300] >>',\n '<< /Type /Annot /Subtype /Widget /FT /Tx /T (merged) /Rect [10 10 110 30] /P 3 0 R >>',\n]);\n\nconst MERGED_FIELD = 5;\n\nexport interface ObjectNumberConformanceOptions {\n label: string;\n makeEngine: () => Promise<Engine> | Engine;\n /** Open {@link OBJECT_NUMBER_FIXTURE_PDF}, fresh for each call, with write access. */\n open: (engine: Engine) => Promise<DocumentHandle>;\n}\n\nconst box = (x: number): PageBox => ({ x, y: 120, width: 40, height: 30 });\n\n/**\n * Names at birth, and the order and ids of writes:\n *\n * - A create that names an object number from the document's pool makes its\n * object at exactly that number, so its ref is known before the engine\n * answers; what the engine makes for itself lands elsewhere.\n * - A number the session doesn't hold is refused `not-held`; one a call uses\n * twice is `taken`. A refused call changes nothing.\n * - Writes made without waiting apply in the order they were made: a page\n * named at birth takes an annotation at once.\n * - Every event of a write carries its `opId` as `origin.tx`.\n */\nexport function runObjectNumberConformance(\n runner: ConformanceTestRunner,\n opts: ObjectNumberConformanceOptions,\n): void {\n const { describe, test, beforeAll, afterAll, expect } = runner;\n\n describe(`object number conformance: ${opts.label}`, () => {\n let engine: Engine;\n\n beforeAll(async () => {\n engine = await opts.makeEngine();\n });\n\n afterAll(async () => {\n if (engine) await engine.destroy();\n });\n\n const withDocument = async (\n body: (doc: DocumentHandle, pages: readonly PageRef[]) => Promise<void>,\n ) => {\n const doc = await opts.open(engine);\n try {\n const { pages } = await doc.pages.list();\n await body(\n doc,\n pages.map((page) => toPageRef(page.ref.objectNumber)),\n );\n } finally {\n await doc.close();\n }\n };\n\n const take = async (doc: DocumentHandle, count: number): Promise<number[]> => {\n await doc.objectNumbers.reserve(count);\n return Array.from({ length: count }, () => doc.objectNumbers.take()!);\n };\n\n const refAt = (page: PageRef, objectNumber: number): AnnotationRef => ({\n kind: 'objectNumber',\n page,\n objectNumber,\n });\n\n test('the pool hands out numbers, each once', async () => {\n await withDocument(async (doc) => {\n await doc.objectNumbers.reserve(100);\n expect(doc.objectNumbers.held >= 100).toBe(true);\n const numbers = Array.from({ length: 100 }, () => doc.objectNumbers.take());\n expect(numbers.every((number) => Number.isInteger(number) && number! > 0)).toBe(true);\n expect(new Set(numbers).size).toBe(100);\n });\n });\n\n test('a create at a number lands at it; one without a number lands elsewhere', async () => {\n await withDocument(async (doc, [page]) => {\n const [first, second] = await take(doc, 2);\n const square = await doc\n .page(page!)\n .annotations.create({ subtype: 'square', box: box(20) }, { objectNumber: first });\n expect(square.annotation.ref).toEqual(refAt(page!, first!));\n const free = await doc.page(page!).annotations.create({ subtype: 'circle', box: box(80) });\n const freeNumber =\n free.annotation.ref.kind === 'objectNumber' ? free.annotation.ref.objectNumber : null;\n expect([first, second].includes(freeNumber!)).toBe(false);\n const circle = await doc\n .page(page!)\n .annotations.create({ subtype: 'circle', box: box(140) }, { objectNumber: second });\n expect(circle.annotation.ref).toEqual(refAt(page!, second!));\n const { annotations } = await doc.page(page!).annotations.list();\n const listed = annotations.map((annotation) => annotationKey(annotation.ref));\n for (const number of [first, second]) {\n expect(listed).toContain(annotationKey(refAt(page!, number!)));\n }\n });\n });\n\n test('a number the session does not hold is not-held; one a call uses twice is taken', async () => {\n await withDocument(async (doc, [page]) => {\n const [used, twice] = await take(doc, 2);\n await doc\n .page(page!)\n .annotations.create({ subtype: 'square', box: box(20) }, { objectNumber: used });\n const before = await doc.pages.list();\n\n // Spent by the create above.\n await expect(\n doc\n .page(page!)\n .annotations.create({ subtype: 'square', box: box(80) }, { objectNumber: used }),\n ).rejects.toMatchObject({\n code: EngineErrorCode.ObjectNumberUnavailable,\n details: { objectNumber: used, reason: 'not-held' },\n });\n // Never handed out.\n await expect(\n doc\n .page(page!)\n .annotations.create({ subtype: 'square', box: box(80) }, { objectNumber: 7_999_999 }),\n ).rejects.toMatchObject({\n code: EngineErrorCode.ObjectNumberUnavailable,\n details: { objectNumber: 7_999_999, reason: 'not-held' },\n });\n await expect(\n doc.pages.insertBlank({ size: { width: 200, height: 200 }, count: 2 }, undefined, {\n objectNumbers: [twice!, twice!],\n }),\n ).rejects.toMatchObject({\n code: EngineErrorCode.ObjectNumberUnavailable,\n details: { objectNumber: twice, reason: 'taken' },\n });\n\n expect(await doc.pages.list()).toEqual(before);\n // Refused calls spent nothing: the number still makes a page.\n const inserted = await doc.pages.insertBlank(\n { size: { width: 200, height: 200 } },\n undefined,\n { objectNumbers: [twice!] },\n );\n expect(inserted.insertedPages).toEqual([toPageRef(twice!)]);\n });\n });\n\n test('a page named at birth takes an annotation at once, in call order', async () => {\n await withDocument(async (doc) => {\n const [pageNumber, annotationNumber] = await take(doc, 2);\n const page = toPageRef(pageNumber!);\n const inserting = doc.pages.insertBlank({ size: { width: 200, height: 200 } }, undefined, {\n objectNumbers: [pageNumber!],\n });\n // Not waiting for the page: the create comes after it.\n const creating = doc\n .page(page)\n .annotations.create(\n { subtype: 'square', box: box(20) },\n { objectNumber: annotationNumber },\n );\n const [inserted, created] = await Promise.all([inserting, creating]);\n expect(inserted.insertedPages).toEqual([page]);\n expect(created.annotation.ref).toEqual(refAt(page, annotationNumber!));\n expect(created.annotation.nm).toMatch(UUID_V7);\n });\n });\n\n test('writes made without waiting apply in the order they were made', async () => {\n await withDocument(async (doc, [page]) => {\n const [number] = await take(doc, 1);\n const ref = refAt(page!, number!);\n const events: string[] = [];\n doc.events.subscribe((event) => events.push(event.type));\n const annotations = doc.page(page!).annotations;\n const writes = [\n annotations.create({ subtype: 'square', box: box(20) }, { objectNumber: number }),\n annotations.update(ref, { contents: 'first' }),\n annotations.update(ref, { contents: 'second' }),\n ];\n await Promise.all(writes);\n expect(events).toEqual([\n 'annotations.created',\n 'annotations.updated',\n 'annotations.updated',\n ]);\n const { annotations: now } = await annotations.list();\n expect(\n now.find(\n (annotation) =>\n annotation.ref.kind === 'objectNumber' && annotation.ref.objectNumber === number,\n )?.contents,\n ).toBe('second');\n });\n });\n\n test('a field and its widgets at numbers; a merged field splits to a number', async () => {\n await withDocument(async (doc, [first, second]) => {\n const [field, left, right, widget, split] = await take(doc, 5);\n const created = await doc.forms.create(\n {\n family: 'text',\n name: 'billing.name',\n widgets: [\n { page: second!, rect: box(20) },\n { page: second!, rect: box(80) },\n ],\n },\n { objectNumber: field, widgetObjectNumbers: [left!, right!] },\n );\n expect(created.field.ref).toEqual({ kind: 'objectNumber', objectNumber: field });\n expect(created.field.widgets.map((w) => w.objectNumber)).toEqual([left, right]);\n // Widgets are annotation rows of the form: named like any other annotation.\n for (const number of [left, right]) {\n const read = created.widgets.find(\n (w) => w.ref.kind === 'objectNumber' && w.ref.objectNumber === number,\n );\n expect(read?.nm).toMatch(UUID_V7);\n expect(read?.page).toEqual(second);\n }\n\n const added = await doc.forms.addWidget(\n { kind: 'objectNumber', objectNumber: MERGED_FIELD },\n { page: first!, rect: box(140) },\n { objectNumber: widget, splitObjectNumber: split },\n );\n expect(added.field.ref).toEqual({ kind: 'objectNumber', objectNumber: MERGED_FIELD });\n expect(added.field.widgets.map((w) => w.objectNumber).sort((a, b) => a - b)).toEqual(\n [split!, widget!].sort((a, b) => a - b),\n );\n });\n });\n\n test(\"every event of a write carries the write's opId\", async () => {\n await withDocument(async (doc, [page]) => {\n const events: DocumentEvent[] = [];\n doc.events.subscribe((event) => events.push(event));\n const created = await doc\n .page(page!)\n .annotations.create({ subtype: 'square', box: box(20) }, { opId: 'op-create' });\n await doc.page(page!).annotations.update(created.annotation.ref, { contents: 'x' });\n await doc.pages.insertBlank({ size: { width: 200, height: 200 } }, undefined, {\n opId: 'op-insert',\n });\n const [create, update, insert] = events.map((event) =>\n event.type === 'stream.desynced' ? null : event.origin.tx,\n );\n expect(events).toHaveLength(3);\n expect(create).toEqual({ id: 'op-create', index: 0, count: 1 });\n // Without an opId, the engine names the write.\n expect(update).toMatchObject({ index: 0, count: 1 });\n expect(typeof update!.id === 'string' && update!.id.length > 0).toBe(true);\n expect(insert).toEqual({ id: 'op-insert', index: 0, count: 1 });\n });\n });\n\n test('an opId no header could carry is refused, and nothing is written', async () => {\n await withDocument(async (doc, [page]) => {\n const before = await doc.page(page!).annotations.list();\n for (const opId of ['', 'has space', 'é', 'x'.repeat(256)]) {\n await expect(\n doc.page(page!).annotations.create({ subtype: 'square', box: box(20) }, { opId }),\n ).rejects.toMatchObject({\n code: EngineErrorCode.InvalidArg,\n details: { field: 'opId' },\n });\n }\n expect(await doc.page(page!).annotations.list()).toEqual(before);\n });\n });\n });\n}\n","import { pdfOf } from './pdfOf';\nimport type { ConformanceTestRunner } from './runMetadataConformance';\nimport type { DocumentHandle } from '../engine/DocumentHandle';\nimport type { Engine } from '../engine/Engine';\nimport { EngineErrorCode } from '../errors/EngineErrorCode';\nimport type { DocumentEvent } from '../events/DocumentEvent';\nimport type { PageBox } from '../geometry/pageSpace';\nimport type { AnnotationRef } from '../identity/AnnotationRef';\nimport type { FormFieldRef } from '../identity/FormFieldRef';\nimport { toPageRef } from '../identity/PageRef';\nimport {\n isSkippedItem,\n type ChangeItem,\n type ChangeItemType,\n type ChangeOp,\n type ChangeResult,\n type SkippedChangeItem,\n} from '../mutation/Change';\n\n/**\n * Two pages and a form. The first page holds, from the file: a blue square\n * by Ann (object 5); Ann's note (6) with its popup (7) and Bea's reply to it\n * (8); and a merged text field and widget `name` with the value `Ann` (9).\n * The second page is empty. Both share an empty content stream (10).\n */\nexport const CHANGE_FIXTURE_PDF = pdfOf([\n '<< /Type /Catalog /Pages 2 0 R /AcroForm << /Fields [9 0 R] /DA (/Helv 0 Tf 0 g) ' +\n '/DR << /Font << /Helv << /Type /Font /Subtype /Type1 /BaseFont /Helvetica >> >> >> >> >>',\n '<< /Type /Pages /Kids [3 0 R 4 0 R] /Count 2 >>',\n '<< /Type /Page /Parent 2 0 R /MediaBox [0 0 300 300] /Contents 10 0 R /Resources << >> ' +\n '/Annots [5 0 R 6 0 R 7 0 R 8 0 R 9 0 R] >>',\n '<< /Type /Page /Parent 2 0 R /MediaBox [0 0 300 300] /Contents 10 0 R /Resources << >> >>',\n '<< /Type /Annot /Subtype /Square /Rect [20 200 80 260] /C [0 0 1] /T (Ann) /P 3 0 R >>',\n '<< /Type /Annot /Subtype /Text /Rect [120 220 140 240] /Contents (Note) /T (Ann) ' +\n '/Popup 7 0 R /P 3 0 R >>',\n '<< /Type /Annot /Subtype /Popup /Rect [150 180 250 240] /Parent 6 0 R /P 3 0 R >>',\n '<< /Type /Annot /Subtype /Text /Rect [120 220 140 240] /Contents (Reply) /T (Bea) ' +\n '/IRT 6 0 R /P 3 0 R >>',\n '<< /Type /Annot /Subtype /Widget /FT /Tx /T (name) /V (Ann) /Rect [20 20 180 44] /P 3 0 R >>',\n '<< /Length 0 >>\\nstream\\n\\nendstream',\n]);\n\n/** A one-page PDF to draw into a signature field. */\nconst SIGNATURE_ARTWORK_PDF = pdfOf([\n '<< /Type /Catalog /Pages 2 0 R >>',\n '<< /Type /Pages /Kids [3 0 R] /Count 1 >>',\n '<< /Type /Page /Parent 2 0 R /MediaBox [0 0 120 40] /Contents 4 0 R >>',\n '<< /Length 20 >>\\nstream\\n0 0 1 rg 0 0 120 40 re f\\nendstream',\n]);\n\nconst PAGE = toPageRef(3);\nconst EMPTY_PAGE = toPageRef(4);\nconst at = (objectNumber: number, page = PAGE): AnnotationRef => ({\n kind: 'objectNumber',\n page,\n objectNumber,\n});\nconst FILE_SQUARE = at(5);\nconst FILE_NOTE = at(6);\nconst FILE_POPUP = at(7);\nconst FILE_REPLY = at(8);\nconst FILE_WIDGET = at(9);\nconst NAME: FormFieldRef = { kind: 'fqn', name: 'name' };\n\nconst BLUE = '#0000ff';\n/** A calculate script: a field with one is in the form's calculation order. */\nconst CALCULATE = { type: 'javascript', script: 'event.value = 1;' } as const;\nconst box = (x: number, y = 120): PageBox => ({ x, y, width: 40, height: 30 });\n\nexport interface ChangeConformanceOptions {\n label: string;\n makeEngine: () => Promise<Engine> | Engine;\n /** Open {@link CHANGE_FIXTURE_PDF}, fresh for each call, with write access. */\n open: (engine: Engine) => Promise<DocumentHandle>;\n /**\n * Open the document `doc` is on as another user, with write access. A local\n * session has one user, so without it the test of who may undo is skipped.\n */\n openAsAnotherUser?: (engine: Engine, doc: DocumentHandle) => Promise<DocumentHandle>;\n}\n\n/** Object numbers the round trips may name, taken from the document's pool. */\ntype Numbers = readonly number[];\n\n/**\n * One op type's round trip: the state `setup` builds (nothing without it),\n * then a change of `ops`, its undo, and the undo's undo.\n */\ninterface RoundTrip {\n readonly setup?: (numbers: Numbers) => ChangeOp[];\n readonly ops: (numbers: Numbers) => ChangeOp[];\n}\n\n/**\n * A round trip for every op type. Keyed by the type, so a new op without one\n * doesn't compile: every op must have an exact reverse.\n */\nconst ROUND_TRIPS: { readonly [T in ChangeOp['type']]: RoundTrip } = {\n 'annotations.create': {\n ops: ([square]) => [\n {\n type: 'annotations.create',\n page: EMPTY_PAGE,\n data: { subtype: 'square', box: box(20), color: '#e11d48' },\n objectNumber: square,\n },\n ],\n },\n 'annotations.update': {\n ops: () => [{ type: 'annotations.update', ref: FILE_SQUARE, patch: { color: '#e11d48' } }],\n },\n 'annotations.delete': {\n // The note goes with its popup and its reply.\n ops: () => [{ type: 'annotations.delete', ref: FILE_NOTE }],\n },\n 'annotations.reorder': {\n ops: () => [\n {\n type: 'annotations.reorder',\n page: PAGE,\n refs: [FILE_SQUARE],\n position: { after: FILE_REPLY },\n },\n ],\n },\n 'forms.setValue': {\n ops: () => [{ type: 'forms.setValue', field: NAME, value: { value: 'Bea' } }],\n },\n 'forms.setDisplay': {\n ops: () => [{ type: 'forms.setDisplay', field: NAME, display: 'hidden' }],\n },\n 'forms.setAppearanceText': {\n ops: () => [{ type: 'forms.setAppearanceText', field: NAME, text: 'ANN' }],\n },\n 'forms.reset': {\n ops: () => [{ type: 'forms.reset', fields: [NAME] }],\n },\n 'forms.create': {\n ops: () => [\n {\n type: 'forms.create',\n draft: {\n family: 'text',\n name: 'email',\n // A calculate script also puts it in the calculation order.\n actions: { calculate: CALCULATE },\n widgets: [{ page: EMPTY_PAGE, rect: { x: 20, y: 20, width: 140, height: 24 } }],\n },\n },\n ],\n },\n 'forms.update': {\n ops: () => [\n {\n type: 'forms.update',\n field: NAME,\n patch: {\n required: true,\n name: 'fullName',\n actions: { format: { type: 'javascript', script: 'event.value = \"x\";' } },\n },\n },\n ],\n },\n 'forms.delete': {\n ops: () => [{ type: 'forms.delete', field: NAME }],\n },\n 'forms.addWidget': {\n // The field is merged with its widget, so the new widget splits it.\n ops: () => [\n {\n type: 'forms.addWidget',\n field: NAME,\n placement: { page: EMPTY_PAGE, rect: { x: 20, y: 60, width: 160, height: 24 } },\n },\n ],\n },\n 'forms.removeWidget': {\n setup: ([widget]) => [\n {\n type: 'forms.addWidget',\n field: NAME,\n placement: { page: EMPTY_PAGE, rect: { x: 20, y: 60, width: 160, height: 24 } },\n objectNumber: widget,\n },\n ],\n ops: ([widget]) => [\n { type: 'forms.removeWidget', field: NAME, widget: at(widget!, EMPTY_PAGE) },\n ],\n },\n 'forms.deleteWidget': {\n // One of a field's two widgets goes; the undo brings it back into the field.\n setup: ([field, left, right]) => [\n {\n type: 'forms.create',\n draft: {\n family: 'text',\n name: 'email',\n widgets: [\n { page: PAGE, rect: { x: 20, y: 60, width: 140, height: 24 } },\n { page: PAGE, rect: { x: 20, y: 100, width: 140, height: 24 } },\n ],\n },\n objectNumber: field,\n widgetObjectNumbers: [left!, right!],\n },\n ],\n ops: ([, , right]) => [{ type: 'forms.deleteWidget', widget: at(right!) }],\n },\n 'forms.reorderCalculations': {\n // Two calculated fields: the file's goes after the new one.\n setup: ([field]) => [\n { type: 'forms.update', field: NAME, patch: { actions: { calculate: CALCULATE } } },\n {\n type: 'forms.create',\n draft: { family: 'text', name: 'total', actions: { calculate: CALCULATE } },\n objectNumber: field,\n },\n ],\n ops: ([field]) => [\n {\n type: 'forms.reorderCalculations',\n fields: [NAME],\n position: { after: { kind: 'objectNumber', objectNumber: field! } },\n },\n ],\n },\n 'forms.reorderWidgets': {\n // The file's widget goes on top of two new ones.\n setup: ([field, left, right]) => [\n {\n type: 'forms.create',\n draft: {\n family: 'text',\n name: 'email',\n widgets: [\n { page: PAGE, rect: { x: 20, y: 60, width: 140, height: 24 } },\n { page: PAGE, rect: { x: 20, y: 100, width: 140, height: 24 } },\n ],\n },\n objectNumber: field,\n widgetObjectNumbers: [left!, right!],\n },\n ],\n ops: ([, , right]) => [\n {\n type: 'forms.reorderWidgets',\n page: PAGE,\n widgets: [FILE_WIDGET],\n position: { after: at(right!) },\n },\n ],\n },\n 'forms.updateWidget': {\n ops: () => [\n {\n type: 'forms.updateWidget',\n widget: FILE_WIDGET,\n patch: { rect: { x: 20, y: 250, width: 200, height: 30 }, color: '#e11d48' },\n },\n ],\n },\n 'forms.setSignatureAppearance': {\n setup: () => [\n {\n type: 'forms.create',\n draft: {\n family: 'signature',\n name: 'signature',\n widgets: [{ page: EMPTY_PAGE, rect: { x: 20, y: 100, width: 120, height: 40 } }],\n },\n },\n ],\n ops: () => [\n {\n type: 'forms.setSignatureAppearance',\n field: { kind: 'fqn', name: 'signature' },\n appearance: { pdf: SIGNATURE_ARTWORK_PDF },\n },\n ],\n },\n 'metadata.update': {\n ops: () => [{ type: 'metadata.update', patch: { title: 'Changed', subject: 'Undo' } }],\n },\n 'metadata.updateCustom': {\n ops: () => [{ type: 'metadata.updateCustom', patch: { project: 'apply' } }],\n },\n};\n\n/**\n * `doc.apply`, one user action as one change:\n *\n * - The ops apply in order, all or none, as one write: one `opId`, one burst\n * of events sharing it. Later ops name what earlier ones create, by the\n * numbers the creates were given.\n * - `{ undoOf }` reverses a change as the engine recorded it, op by op in\n * reverse order, where the document still shows what the change set; what\n * it leaves alone is reported as `skipped`. Every op type round-trips:\n * undo gives exactly the state before, the undo's undo the state after.\n * - A deleted annotation comes back as the same objects, with the layer's\n * edits, its popup and its replies.\n * - `expect` refuses a change whose assumption doesn't hold.\n * - Every answer is kept under its `opId`, refusals included: asking again\n * answers the same, and a different change under it is refused.\n * - A redaction apply ends undo for the changes before it.\n */\nexport function runChangeConformance(\n runner: ConformanceTestRunner,\n opts: ChangeConformanceOptions,\n): void {\n const { describe, test, beforeAll, afterAll, expect } = runner;\n\n describe(`change conformance: ${opts.label}`, () => {\n let engine: Engine;\n\n beforeAll(async () => {\n engine = await opts.makeEngine();\n });\n\n afterAll(async () => {\n if (engine) await engine.destroy();\n });\n\n const withDocument = async (body: (doc: DocumentHandle) => Promise<void>) => {\n const doc = await opts.open(engine);\n try {\n await body(doc);\n } finally {\n await doc.close();\n }\n };\n\n const take = async (doc: DocumentHandle, count: number): Promise<number[]> => {\n await doc.objectNumbers.reserve(count);\n return Array.from({ length: count }, () => doc.objectNumbers.take()!);\n };\n\n /** Everything a change can write, as the document reads it. */\n const factsOf = async (doc: DocumentHandle) => {\n const [onPage, onEmptyPage, form, metadata, custom] = await Promise.all([\n doc.page(PAGE).annotations.list(),\n doc.page(EMPTY_PAGE).annotations.list(),\n doc.forms.list(),\n doc.metadata.get(),\n doc.metadata.custom.get(),\n ]);\n return {\n annotations: [onPage.annotations, onEmptyPage.annotations],\n fields: form.fields,\n widgets: form.widgets,\n calculationOrder: form.calculationOrder,\n metadata: { title: metadata.title, subject: metadata.subject },\n custom,\n };\n };\n\n const same = (a: unknown, b: unknown) => JSON.stringify(a) === JSON.stringify(b);\n\n const colorOf = async (doc: DocumentHandle, ref: AnnotationRef) => {\n const { annotations } = await doc.page(PAGE).annotations.list();\n const found = annotations.find(\n (annotation) =>\n annotation.ref.kind === 'objectNumber' &&\n ref.kind === 'objectNumber' &&\n annotation.ref.objectNumber === ref.objectNumber,\n );\n return found && 'color' in found ? found.color : undefined;\n };\n\n const recordEvents = (doc: DocumentHandle) => {\n const events: DocumentEvent[] = [];\n const stop = doc.events.subscribe((event) => events.push(event));\n return { events, stop };\n };\n\n const txOf = (event: DocumentEvent) => ('origin' in event ? event.origin.tx : undefined);\n\n /** The item of `type` a result holds, applied or left alone. */\n const itemOfType = <T extends ChangeItemType>(\n result: ChangeResult,\n type: T,\n ): Extract<ChangeItem, { type: T }> | SkippedChangeItem => {\n const item = result.items.find((candidate) =>\n isSkippedItem(candidate) ? candidate.op === type : candidate.type === type,\n );\n if (!item) throw new Error(`no ${type} item`);\n return item as Extract<ChangeItem, { type: T }> | SkippedChangeItem;\n };\n\n /** The applied item of `type` a result holds. */\n const appliedOfType = <T extends ChangeItemType>(\n result: ChangeResult,\n type: T,\n ): Extract<ChangeItem, { type: T }> => {\n const item = itemOfType(result, type);\n if (isSkippedItem(item)) throw new Error(`${type} was left alone`);\n return item as Extract<ChangeItem, { type: T }>;\n };\n\n for (const [type, trip] of Object.entries(ROUND_TRIPS) as [ChangeOp['type'], RoundTrip][]) {\n test(`${type}: undo gives the state before, the undo's undo the state after`, async () => {\n await withDocument(async (doc) => {\n const numbers = await take(doc, 4);\n if (trip.setup) await doc.apply({ ops: trip.setup(numbers) });\n const before = await factsOf(doc);\n\n const applied = await doc.apply({ ops: trip.ops(numbers) });\n expect(applied.meta.undoable).toBe(true);\n expect(applied.items.map((item) => item.type)).toEqual([type]);\n const after = await factsOf(doc);\n expect(same(after, before)).toBe(false);\n\n const undo = await doc.apply({ undoOf: applied.meta.opId });\n expect(undo.meta.undoable).toBe(true);\n expect(undo.items.some((item) => isSkippedItem(item) || 'skipped' in item)).toBe(false);\n expect(await factsOf(doc)).toEqual(before);\n\n await doc.apply({ undoOf: undo.meta.opId });\n expect(await factsOf(doc)).toEqual(after);\n });\n });\n }\n\n test('ops apply in order as one write; a later op names an earlier create', async () => {\n await withDocument(async (doc) => {\n const [square] = await take(doc, 1);\n const recorded = recordEvents(doc);\n const result = await doc.apply(\n {\n ops: [\n {\n type: 'annotations.create',\n page: EMPTY_PAGE,\n data: { subtype: 'square', box: box(20) },\n objectNumber: square,\n },\n {\n type: 'annotations.update',\n ref: at(square!, EMPTY_PAGE),\n patch: { color: '#e11d48' },\n },\n { type: 'forms.setValue', field: NAME, value: { value: 'Bea' } },\n ],\n },\n { opId: 'change-conformance-order' },\n );\n recorded.stop();\n\n expect(result.meta.opId).toBe('change-conformance-order');\n expect(result.meta.undoable).toBe(true);\n expect(result.items.map((item) => item.type)).toEqual([\n 'annotations.create',\n 'annotations.update',\n 'forms.setValue',\n ]);\n const update = appliedOfType(result, 'annotations.update');\n expect(update.annotation.ref).toEqual(at(square!, EMPTY_PAGE));\n expect('color' in update.annotation && update.annotation.color).toBe('#e11d48');\n\n // One burst: each op's events in op order, all carrying the change's opId.\n expect(recorded.events.map((event) => event.type)).toEqual([\n 'annotations.created',\n 'annotations.updated',\n 'forms.valueSet',\n ]);\n expect(recorded.events.map(txOf)).toEqual([\n { id: 'change-conformance-order', index: 0, count: 3 },\n { id: 'change-conformance-order', index: 1, count: 3 },\n { id: 'change-conformance-order', index: 2, count: 3 },\n ]);\n });\n });\n\n test('a reply can answer a note created earlier in the same change', async () => {\n await withDocument(async (doc) => {\n const [note, reply] = await take(doc, 2);\n const result = await doc.apply({\n ops: [\n {\n type: 'annotations.create',\n page: EMPTY_PAGE,\n data: { subtype: 'text', rect: box(20), contents: 'Question' },\n objectNumber: note,\n },\n {\n type: 'annotations.create',\n page: EMPTY_PAGE,\n data: {\n subtype: 'text',\n rect: box(20),\n contents: 'Answer',\n reply: { to: at(note!, EMPTY_PAGE) },\n },\n objectNumber: reply,\n },\n ],\n });\n const created = result.items.filter((item) => item.type === 'annotations.create');\n const answer = created[1];\n if (!answer || isSkippedItem(answer) || answer.type !== 'annotations.create') {\n throw new Error('expected a create');\n }\n expect(answer.annotation.reply?.to).toEqual(at(note!, EMPTY_PAGE));\n });\n });\n\n test('a failing op leaves nothing: no write, no events', async () => {\n await withDocument(async (doc) => {\n const [square] = await take(doc, 1);\n const before = await factsOf(doc);\n const recorded = recordEvents(doc);\n await expect(\n doc.apply({\n ops: [\n {\n type: 'annotations.create',\n page: PAGE,\n data: { subtype: 'square', box: box(20) },\n objectNumber: square,\n },\n { type: 'annotations.update', ref: at(4000), patch: { color: '#e11d48' } },\n ],\n }),\n ).rejects.toMatchObject({ code: EngineErrorCode.NotFound });\n recorded.stop();\n expect(recorded.events).toHaveLength(0);\n expect(await factsOf(doc)).toEqual(before);\n });\n });\n\n test('an empty change writes nothing and is not undoable', async () => {\n await withDocument(async (doc) => {\n const recorded = recordEvents(doc);\n const result = await doc.apply({ ops: [] });\n recorded.stop();\n expect(result.items).toEqual([]);\n expect(result.meta.undoable).toBe(false);\n expect(recorded.events).toHaveLength(0);\n });\n });\n\n test('two writes to one field undo in reverse order, back to the first value', async () => {\n await withDocument(async (doc) => {\n const [square] = await take(doc, 1);\n const before = await factsOf(doc);\n const result = await doc.apply({\n ops: [\n { type: 'annotations.update', ref: FILE_SQUARE, patch: { color: '#00ff00' } },\n { type: 'annotations.update', ref: FILE_SQUARE, patch: { color: '#ffff00' } },\n {\n type: 'annotations.create',\n page: PAGE,\n data: { subtype: 'square', box: box(140) },\n objectNumber: square,\n },\n { type: 'annotations.update', ref: at(square!), patch: { color: '#e11d48' } },\n ],\n });\n await doc.apply({ undoOf: result.meta.opId });\n // The square's create is undone after its update, so the guarded\n // delete sees it as it was created.\n expect(await factsOf(doc)).toEqual(before);\n });\n });\n\n test(\"undo leaves a colleague's later change alone and reports it\", async () => {\n await withDocument(async (doc) => {\n const mine = await doc.apply({\n ops: [\n {\n type: 'annotations.update',\n ref: FILE_SQUARE,\n patch: { color: '#e11d48', contents: 'Mine' },\n },\n ],\n });\n await doc.apply({\n ops: [{ type: 'annotations.update', ref: FILE_SQUARE, patch: { color: '#00ff00' } }],\n });\n const undo = await doc.apply({ undoOf: mine.meta.opId });\n const update = appliedOfType(undo, 'annotations.update');\n expect(update.skipped).toEqual(['color']);\n expect(await colorOf(doc, FILE_SQUARE)).toBe('#00ff00');\n const { annotations } = await doc.page(PAGE).annotations.list();\n const square = annotations.find(\n (annotation) =>\n annotation.ref.kind === 'objectNumber' && annotation.ref.objectNumber === 5,\n )!;\n expect(square.contents).toBe(null);\n });\n });\n\n test('undo goes by value: a field set back to what the change set is undone', async () => {\n await withDocument(async (doc) => {\n const mine = await doc.apply({\n ops: [{ type: 'annotations.update', ref: FILE_SQUARE, patch: { color: '#e11d48' } }],\n });\n await doc.apply({\n ops: [{ type: 'annotations.update', ref: FILE_SQUARE, patch: { color: BLUE } }],\n });\n await doc.apply({\n ops: [{ type: 'annotations.update', ref: FILE_SQUARE, patch: { color: '#e11d48' } }],\n });\n const undo = await doc.apply({ undoOf: mine.meta.opId });\n expect(appliedOfType(undo, 'annotations.update').skipped).toBe(undefined);\n expect(await colorOf(doc, FILE_SQUARE)).toBe(BLUE);\n });\n });\n\n test(\"undo of a field's properties puts back each one still holding what it set\", async () => {\n await withDocument(async (doc) => {\n const mine = await doc.apply({\n ops: [{ type: 'forms.update', field: NAME, patch: { required: true, noExport: true } }],\n });\n // A colleague fills the field in, which writes its dictionary, and\n // changes one of the same properties.\n await doc.apply({\n ops: [{ type: 'forms.setValue', field: NAME, value: { value: 'Bea' } }],\n });\n await doc.apply({\n ops: [{ type: 'forms.update', field: NAME, patch: { noExport: false } }],\n });\n\n const undo = await doc.apply({ undoOf: mine.meta.opId });\n expect(appliedOfType(undo, 'forms.update').skipped).toEqual(['noExport']);\n const undone = await doc.forms.get(NAME);\n expect(undone.required).toBe(false);\n expect(undone.noExport).toBe(false);\n expect(undone.family === 'text' && undone.value).toBe('Bea');\n\n // The undo's undo makes it required again, and leaves the rest.\n await doc.apply({ undoOf: undo.meta.opId });\n const redone = await doc.forms.get(NAME);\n expect(redone.required).toBe(true);\n expect(redone.noExport).toBe(false);\n expect(redone.family === 'text' && redone.value).toBe('Bea');\n });\n });\n\n test('expect refuses the whole change with ChangeConflict', async () => {\n await withDocument(async (doc) => {\n const before = await factsOf(doc);\n await expect(\n doc.apply({\n ops: [\n { type: 'forms.setValue', field: NAME, value: { value: 'Bea' } },\n {\n type: 'annotations.update',\n ref: FILE_SQUARE,\n patch: { color: '#e11d48' },\n expect: { color: '#ff0000' },\n },\n ],\n }),\n ).rejects.toMatchObject({\n code: EngineErrorCode.ChangeConflict,\n details: { opIndex: 1, fields: ['color'] },\n });\n expect(await factsOf(doc)).toEqual(before);\n });\n });\n\n test('the undo of a create is skipped when someone replied to it', async () => {\n await withDocument(async (doc) => {\n const [note, reply] = await take(doc, 2);\n const mine = await doc.apply({\n ops: [\n {\n type: 'annotations.create',\n page: EMPTY_PAGE,\n data: { subtype: 'text', rect: box(20), contents: 'Question' },\n objectNumber: note,\n },\n ],\n });\n await doc.apply({\n ops: [\n {\n type: 'annotations.create',\n page: EMPTY_PAGE,\n data: {\n subtype: 'text',\n rect: box(20),\n contents: 'Answer',\n reply: { to: at(note!, EMPTY_PAGE) },\n },\n objectNumber: reply,\n },\n ],\n });\n const undo = await doc.apply({ undoOf: mine.meta.opId });\n expect(isSkippedItem(itemOfType(undo, 'annotations.delete'))).toBe(true);\n const { annotations } = await doc.page(EMPTY_PAGE).annotations.list();\n expect(annotations).toHaveLength(2);\n });\n });\n\n test('a restore brings back the same objects with their owner, popup and reply', async () => {\n await withDocument(async (doc) => {\n const deleted = await doc.apply({ ops: [{ type: 'annotations.delete', ref: FILE_NOTE }] });\n const recorded = recordEvents(doc);\n const undo = await doc.apply({ undoOf: deleted.meta.opId });\n recorded.stop();\n\n const restore = appliedOfType(undo, 'annotations.restore');\n expect(restore.annotations.map((annotation) => annotation.ref)).toEqual([\n FILE_NOTE,\n FILE_POPUP,\n FILE_REPLY,\n ]);\n const [note, , reply] = restore.annotations;\n expect(note!.author).toBe('Ann');\n expect(note!.popup).toEqual(FILE_POPUP);\n expect(reply!.author).toBe('Bea');\n expect(reply!.reply?.to).toEqual(FILE_NOTE);\n // Back in their places in the stacking order, between the square and the widget.\n const { annotations } = await doc.page(PAGE).annotations.list();\n expect(annotations.map((annotation) => annotation.ref)).toEqual([\n FILE_SQUARE,\n FILE_NOTE,\n FILE_POPUP,\n FILE_REPLY,\n ]);\n\n expect(recorded.events.map((event) => event.type)).toEqual(['annotations.restored']);\n expect(txOf(recorded.events[0]!)).toEqual({ id: undo.meta.opId, index: 0, count: 1 });\n });\n });\n\n test('an edited annotation from the file comes back with its edits', async () => {\n await withDocument(async (doc) => {\n await doc.apply({\n ops: [{ type: 'annotations.update', ref: FILE_SQUARE, patch: { color: '#e11d48' } }],\n });\n const deleted = await doc.apply({\n ops: [{ type: 'annotations.delete', ref: FILE_SQUARE }],\n });\n await doc.apply({ undoOf: deleted.meta.opId });\n expect(await colorOf(doc, FILE_SQUARE)).toBe('#e11d48');\n });\n });\n\n test('undoing a change twice is harmless', async () => {\n await withDocument(async (doc) => {\n const before = await factsOf(doc);\n const mine = await doc.apply({\n ops: [{ type: 'forms.setValue', field: NAME, value: { value: 'Bea' } }],\n });\n await doc.apply({ undoOf: mine.meta.opId });\n const again = await doc.apply({ undoOf: mine.meta.opId });\n expect(again.items.every(isSkippedItem)).toBe(true);\n expect(await factsOf(doc)).toEqual(before);\n });\n });\n\n test('only the user who made a change may undo it', async () => {\n if (!opts.openAsAnotherUser) return;\n await withDocument(async (doc) => {\n const mine = await doc.apply({\n ops: [{ type: 'annotations.update', ref: FILE_SQUARE, patch: { color: '#e11d48' } }],\n });\n const other = await opts.openAsAnotherUser!(engine, doc);\n try {\n await expect(other.apply({ undoOf: mine.meta.opId })).rejects.toMatchObject({\n code: EngineErrorCode.Forbidden,\n });\n } finally {\n await other.close();\n }\n expect(await colorOf(doc, FILE_SQUARE)).toBe('#e11d48');\n });\n });\n\n test('a redaction apply ends undo for the changes before it', async () => {\n await withDocument(async (doc) => {\n const before = await doc.apply({\n ops: [{ type: 'annotations.update', ref: FILE_SQUARE, patch: { color: '#e11d48' } }],\n });\n await doc.page(EMPTY_PAGE).annotations.create({ subtype: 'redact', rect: box(20) });\n const redaction = await doc.redaction.apply({ pages: [EMPTY_PAGE] });\n expect(redaction.meta.undoable).toBe(false);\n\n await expect(doc.apply({ undoOf: before.meta.opId })).rejects.toMatchObject({\n code: EngineErrorCode.UndoUnavailable,\n details: { reason: 'final-change' },\n });\n // Plain edits stay possible, and undoable.\n const after = await doc.apply({\n ops: [{ type: 'annotations.update', ref: FILE_SQUARE, patch: { color: BLUE } }],\n });\n expect(after.meta.undoable).toBe(true);\n });\n });\n\n test('a refused change asked again answers its refusal, even when it would now apply', async () => {\n await withDocument(async (doc) => {\n const refused = {\n ops: [\n {\n type: 'annotations.update',\n ref: FILE_SQUARE,\n patch: { color: '#00ff00' },\n expect: { color: '#e11d48' },\n },\n ],\n } satisfies { ops: ChangeOp[] };\n const options = { opId: 'change-conformance-refused' };\n await expect(doc.apply(refused, options)).rejects.toMatchObject({\n code: EngineErrorCode.ChangeConflict,\n });\n await doc.apply({\n ops: [{ type: 'annotations.update', ref: FILE_SQUARE, patch: { color: '#e11d48' } }],\n });\n await expect(doc.apply(refused, options)).rejects.toMatchObject({\n code: EngineErrorCode.ChangeConflict,\n });\n expect(await colorOf(doc, FILE_SQUARE)).toBe('#e11d48');\n });\n });\n\n test('asking again answers the first result and publishes nothing new', async () => {\n await withDocument(async (doc) => {\n const change = {\n ops: [{ type: 'forms.setValue', field: NAME, value: { value: 'Bea' } }],\n } satisfies { ops: ChangeOp[] };\n const options = { opId: 'change-conformance-retry' };\n const recorded = recordEvents(doc);\n const first = await doc.apply(change, options);\n const second = await doc.apply(change, options);\n recorded.stop();\n expect(second).toEqual(first);\n expect(recorded.events).toHaveLength(1);\n });\n });\n\n test('a different change under a used opId is IdempotencyKeyReused', async () => {\n await withDocument(async (doc) => {\n const options = { opId: 'change-conformance-reused' };\n await doc.apply(\n { ops: [{ type: 'forms.setValue', field: NAME, value: { value: 'Bea' } }] },\n options,\n );\n await expect(\n doc.apply(\n { ops: [{ type: 'forms.setValue', field: NAME, value: { value: 'Cy' } }] },\n options,\n ),\n ).rejects.toMatchObject({ code: EngineErrorCode.IdempotencyKeyReused });\n });\n });\n\n test('a single verb is a one-op change: its opId undoes it', async () => {\n await withDocument(async (doc) => {\n const before = await factsOf(doc);\n const updated = await doc.page(PAGE).annotations.update(FILE_SQUARE, { color: '#e11d48' });\n expect(updated.meta.undoable).toBe(true);\n await doc.apply({ undoOf: updated.meta.opId });\n expect(await factsOf(doc)).toEqual(before);\n });\n });\n });\n}\n","import { CHANGE_FIXTURE_PDF } from './runChangeConformance';\nimport type { ConformanceTestRunner } from './runMetadataConformance';\nimport type { DocumentHandle } from '../engine/DocumentHandle';\nimport type { Engine } from '../engine/Engine';\nimport { EngineError } from '../errors/EngineError';\nimport { EngineErrorCode } from '../errors/EngineErrorCode';\nimport type { DocumentEvent } from '../events/DocumentEvent';\nimport type { AnnotationRef } from '../identity/AnnotationRef';\nimport { annotationKey } from '../identity/annotationKey';\nimport type { FormFieldRef } from '../identity/FormFieldRef';\nimport { toPageRef } from '../identity/PageRef';\n\n/**\n * The two read families, through three tokens: one that may do everything,\n * one that may only fill the form, one that may only comment. Each token\n * reads, sees and writes its own family, and is refused the other one, on\n * every surface: the lists, the appearance images, the page pictures, the\n * writes, and (on an engine where sessions share a document) the events of\n * another session's writes. A widget is the form's: the annotation verbs\n * refuse one as the wrong family (`InvalidArg`), whatever the token.\n *\n * It runs on {@link CHANGE_FIXTURE_PDF}: a square (5), a note (6) with its\n * popup (7) and a reply (8), and the text field `name`, merged with its\n * widget (9), all on the first page.\n */\n\nexport const PERMISSION_TOKENS = {\n everything: ['*'],\n fill: ['doc.open', 'doc.render', 'doc.forms.fill'],\n comment: ['doc.open', 'doc.render', 'doc.annotate.modify'],\n} as const satisfies Record<string, readonly string[]>;\n\nexport type PermissionToken = keyof typeof PERMISSION_TOKENS;\n\nexport interface PermissionConformanceOptions {\n label: string;\n makeEngine: () => Promise<Engine> | Engine;\n /** Open a fresh copy of {@link CHANGE_FIXTURE_PDF} with `scope`. */\n open: (engine: Engine, scope: readonly string[]) => Promise<DocumentHandle>;\n /**\n * Open the document `doc` is on again, on `engine`, with `scope`: another\n * user's session. Every open is its own session, even on the same engine.\n * A local document is its own open's alone, so without it the events test\n * is skipped.\n */\n openSameDocument?: (\n engine: Engine,\n doc: DocumentHandle,\n scope: readonly string[],\n ) => Promise<DocumentHandle>;\n}\n\nconst PAGE = toPageRef(3);\nconst SQUARE: AnnotationRef = { kind: 'objectNumber', page: PAGE, objectNumber: 5 };\nconst WIDGET: AnnotationRef = { kind: 'objectNumber', page: PAGE, objectNumber: 9 };\nconst NAME: FormFieldRef = { kind: 'fqn', name: 'name' };\nconst box = (x: number) => ({ x, y: 120, width: 40, height: 30 });\n\nexport function runPermissionConformance(\n runner: ConformanceTestRunner,\n opts: PermissionConformanceOptions,\n): void {\n const { describe, test, beforeAll, afterAll, expect } = runner;\n\n describe(`permission conformance: ${opts.label}`, () => {\n let engine: Engine;\n\n beforeAll(async () => {\n engine = await opts.makeEngine();\n });\n\n afterAll(async () => {\n if (engine) await engine.destroy();\n });\n\n const as = async (token: PermissionToken, body: (doc: DocumentHandle) => Promise<void>) => {\n const doc = await opts.open(engine, PERMISSION_TOKENS[token]);\n try {\n await body(doc);\n } finally {\n await doc.close();\n }\n };\n\n const refusal = (attempt: Promise<unknown>): Promise<unknown> =>\n attempt.then(\n () => null,\n (error: unknown) => error,\n );\n\n /** The error's code, or what came back instead: a refusal reads as its code. */\n const outcome = (error: unknown) =>\n EngineError.is(error) ? error.code : error === null ? 'resolved' : String(error);\n\n const expectRefused = (error: unknown, code: EngineErrorCode) => {\n expect(outcome(error)).toBe(code);\n };\n\n const keys = (refs: readonly AnnotationRef[]) => refs.map(annotationKey);\n\n test('lists: each token reads its own family and is refused the other', async () => {\n await as('everything', async (doc) => {\n const { annotations } = await doc.page(PAGE).annotations.list();\n expect(keys(annotations.map((a) => a.ref))).toEqual(\n keys([SQUARE, ...[6, 7, 8].map((n) => ({ ...SQUARE, objectNumber: n }))]),\n );\n const form = await doc.forms.list();\n expect(form.fields.map((field) => field.name)).toEqual(['name']);\n expect(keys(form.widgets.map((row) => row.ref))).toEqual(keys([WIDGET]));\n });\n await as('fill', async (doc) => {\n const form = await doc.forms.list();\n expect(keys(form.widgets.map((row) => row.ref))).toEqual(keys([WIDGET]));\n expectRefused(await refusal(doc.page(PAGE).annotations.list()), EngineErrorCode.Forbidden);\n expectRefused(await refusal(doc.annotations.list()), EngineErrorCode.Forbidden);\n });\n await as('comment', async (doc) => {\n const { annotations } = await doc.page(PAGE).annotations.list();\n expect(annotations).toHaveLength(4);\n expect(annotations.some((a) => a.subtype === 'widget')).toBe(false);\n expectRefused(await refusal(doc.forms.list()), EngineErrorCode.Forbidden);\n });\n });\n\n test('appearance images: each family takes its own read', async () => {\n await as('everything', async (doc) => {\n const page = doc.page(PAGE);\n const forms = await page.forms.renderAppearances();\n expect(new Set(keys(forms.appearances.map((a) => a.ref)))).toEqual(new Set(keys([WIDGET])));\n const annotations = await page.annotations.renderAppearances();\n expect(\n keys(annotations.appearances.map((a) => a.ref)).includes(annotationKey(WIDGET)),\n ).toBe(false);\n });\n await as('fill', async (doc) => {\n const page = doc.page(PAGE);\n const forms = await page.forms.renderAppearances();\n expect(new Set(keys(forms.appearances.map((a) => a.ref)))).toEqual(new Set(keys([WIDGET])));\n expectRefused(\n await refusal(page.annotations.renderAppearances()),\n EngineErrorCode.Forbidden,\n );\n });\n await as('comment', async (doc) => {\n const page = doc.page(PAGE);\n const annotations = await page.annotations.renderAppearances();\n expect(\n keys(annotations.appearances.map((a) => a.ref)).includes(annotationKey(WIDGET)),\n ).toBe(false);\n expectRefused(await refusal(page.forms.renderAppearances()), EngineErrorCode.Forbidden);\n });\n });\n\n test('pictures: a left-out layer never asks for more than the token may read', async () => {\n await as('fill', async (doc) => {\n const page = doc.page(PAGE);\n await page.render.image();\n expectRefused(\n await refusal(page.render.image({ includeAnnotations: true })),\n EngineErrorCode.Forbidden,\n );\n });\n await as('comment', async (doc) => {\n const page = doc.page(PAGE);\n await page.render.image();\n await page.render.image({ includeAnnotations: true });\n expectRefused(\n await refusal(page.render.image({ includeFormFields: true })),\n EngineErrorCode.Forbidden,\n );\n });\n });\n\n test('writes: each token writes its own family; the annotation verbs refuse a widget', async () => {\n await as('fill', async (doc) => {\n const filled = await doc.forms.setValue(NAME, { value: 'Bea' });\n expect(keys(filled.widgets.map((row) => row.ref))).toEqual(keys([WIDGET]));\n expect('annotations' in filled).toBe(false);\n expectRefused(\n await refusal(doc.page(PAGE).annotations.create({ subtype: 'square', box: box(20) })),\n EngineErrorCode.Forbidden,\n );\n expectRefused(\n await refusal(doc.forms.updateWidget(WIDGET, { interiorColor: '#ffd500' })),\n EngineErrorCode.Forbidden,\n );\n expectRefused(\n await refusal(doc.forms.create({ family: 'text', name: 'extra' })),\n EngineErrorCode.Forbidden,\n );\n });\n\n await as('comment', async (doc) => {\n await doc.page(PAGE).annotations.create({ subtype: 'square', box: box(20) });\n expectRefused(\n await refusal(doc.forms.setValue(NAME, { value: 'Bea' })),\n EngineErrorCode.Forbidden,\n );\n expectRefused(\n await refusal(doc.forms.updateWidget(WIDGET, { interiorColor: '#ffd500' })),\n EngineErrorCode.Forbidden,\n );\n });\n\n // A widget is the form's: the annotation verbs refuse one as the wrong\n // family, before any right is looked at, whatever the token.\n for (const token of ['everything', 'comment', 'fill'] as const) {\n await as(token, async (doc) => {\n const page = doc.page(PAGE);\n expectRefused(\n await refusal(\n page.annotations.update(WIDGET, { subtype: 'widget', interiorColor: '#fff' }),\n ),\n EngineErrorCode.InvalidArg,\n );\n expectRefused(await refusal(page.annotations.delete(WIDGET)), EngineErrorCode.InvalidArg);\n expectRefused(\n await refusal(page.annotations.reorder([WIDGET], 'start')),\n EngineErrorCode.InvalidArg,\n );\n });\n }\n });\n\n if (opts.openSameDocument) {\n const openSameDocument = opts.openSameDocument;\n test(\"events: a token hears its own family of another session's writes, never the other\", async () => {\n const writer = await opts.open(engine, PERMISSION_TOKENS.everything);\n const filler = await openSameDocument(engine, writer, PERMISSION_TOKENS.fill);\n const commenter = await openSameDocument(engine, writer, PERMISSION_TOKENS.comment);\n try {\n const heardByFiller: DocumentEvent[] = [];\n const heardByCommenter: DocumentEvent[] = [];\n filler.events.subscribe((event) => heardByFiller.push(event));\n commenter.events.subscribe((event) => heardByCommenter.push(event));\n // Give the lazy streams a beat to connect before the writes.\n await new Promise((resolve) => setTimeout(resolve, 300));\n\n await writer.page(PAGE).annotations.create({ subtype: 'square', box: box(80) });\n await writer.forms.setValue(NAME, { value: 'Bea' });\n\n const deadline = Date.now() + 10_000;\n const heard = (events: DocumentEvent[], type: DocumentEvent['type']) =>\n events.some((event) => event.type === type);\n while (\n !(\n heard(heardByFiller, 'forms.valueSet') &&\n heard(heardByCommenter, 'annotations.created')\n )\n ) {\n if (Date.now() > deadline) throw new Error('timed out waiting for the remote events');\n await new Promise((resolve) => setTimeout(resolve, 25));\n }\n // A beat more, so a stray event of the other family would have arrived.\n await new Promise((resolve) => setTimeout(resolve, 300));\n const types = (events: DocumentEvent[]) => events.map((event) => event.type);\n expect(types(heardByFiller).some((type) => type.startsWith('annotations.'))).toBe(false);\n expect(types(heardByCommenter).some((type) => type.startsWith('forms.'))).toBe(false);\n } finally {\n await commenter.close();\n await filler.close();\n await writer.close();\n }\n });\n }\n });\n}\n","import { CHANGE_FIXTURE_PDF } from './runChangeConformance';\nimport type { ConformanceTestRunner } from './runMetadataConformance';\nimport type { FieldScriptWrite, PdfActionWrite } from '../dto/PdfAction';\nimport type { DocumentHandle } from '../engine/DocumentHandle';\nimport type { Engine } from '../engine/Engine';\nimport { EngineError } from '../errors/EngineError';\nimport { EngineErrorCode } from '../errors/EngineErrorCode';\nimport type { DocumentEvent } from '../events/DocumentEvent';\nimport type { FormFieldDTO } from '../forms/field';\nimport type { AnnotationRef } from '../identity/AnnotationRef';\nimport type { FormFieldRef } from '../identity/FormFieldRef';\nimport { toPageRef } from '../identity/PageRef';\n\n/**\n * A field's scripts, written through `create` and `update`, and the form's\n * calculation order, which follows the calculate scripts and moves by\n * neighbour; a widget's actions, written through its placement and\n * `updateWidget`. Undo puts them back. A field event takes JavaScript only;\n * writing a script, a submit or a link takes `doc.forms.script`, while the\n * actions that only change the view (go to, reset, show and hide) need\n * `doc.forms.modify` alone.\n *\n * It runs on {@link CHANGE_FIXTURE_PDF}: the text field `name`, merged with\n * its widget (9) on the first page, and no calculation order.\n */\n\nexport interface FormScriptConformanceOptions {\n label: string;\n makeEngine: () => Promise<Engine> | Engine;\n /** Open a fresh copy of {@link CHANGE_FIXTURE_PDF} with `scope`. */\n open: (engine: Engine, scope: readonly string[]) => Promise<DocumentHandle>;\n}\n\nconst EVERYTHING = ['*'] as const;\nconst DESIGN_ONLY = ['doc.open', 'doc.render', 'doc.forms.modify'] as const;\n\nconst NAME: FormFieldRef = { kind: 'fqn', name: 'name' };\nconst PAGE = toPageRef(3);\nconst WIDGET: AnnotationRef = { kind: 'objectNumber', page: PAGE, objectNumber: 9 };\nconst RESET: PdfActionWrite = { type: 'reset-form', fields: null, exclude: false };\nconst script = (source: string): FieldScriptWrite => ({ type: 'javascript', script: source });\nconst CALCULATE = script('event.value = 1;');\n\nexport function runFormScriptConformance(\n runner: ConformanceTestRunner,\n opts: FormScriptConformanceOptions,\n): void {\n const { describe, test, beforeAll, afterAll, expect } = runner;\n\n describe(`form script conformance: ${opts.label}`, () => {\n let engine: Engine;\n\n beforeAll(async () => {\n engine = await opts.makeEngine();\n });\n\n afterAll(async () => {\n if (engine) await engine.destroy();\n });\n\n const withDoc = async (\n body: (doc: DocumentHandle) => Promise<void>,\n scope: readonly string[] = EVERYTHING,\n ) => {\n const doc = await opts.open(engine, scope);\n try {\n await body(doc);\n } finally {\n await doc.close();\n }\n };\n\n const fieldOf = async (doc: DocumentHandle, name: string): Promise<FormFieldDTO> => {\n const field = (await doc.forms.list()).fields.find((f) => f.name === name);\n if (!field) throw new Error(`no field '${name}'`);\n return field;\n };\n\n /** The script an event runs, or null. */\n const scriptOf = (\n field: FormFieldDTO,\n event: 'keystroke' | 'format' | 'validate' | 'calculate',\n ) => {\n const root = field.actions?.[event]?.root;\n return root?.type === 'javascript' ? root.script : null;\n };\n\n /** The calculation order, by field name. */\n const orderOf = async (doc: DocumentHandle): Promise<string[]> => {\n const { fields, calculationOrder } = await doc.forms.list();\n return calculationOrder.map((ref) => {\n const field = ref && fields.find((f) => JSON.stringify(f.ref) === JSON.stringify(ref));\n return field ? field.name : '?';\n });\n };\n\n const createCalculated = async (doc: DocumentHandle, name: string) =>\n doc.forms.create({ family: 'text', name, actions: { calculate: CALCULATE } });\n\n const outcome = (attempt: Promise<unknown>) =>\n attempt.then(\n () => 'resolved',\n (error: unknown) => (EngineError.is(error) ? error.code : String(error)),\n );\n\n test(\"create writes a field's scripts; a calculate script puts it in the order\", async () => {\n await withDoc(async (doc) => {\n const created = await doc.forms.create({\n family: 'text',\n name: 'total',\n readOnly: true,\n actions: {\n calculate: CALCULATE,\n format: {\n ...script('AFNumber_Format(2, 0, 0, 0, \"\", true);'),\n next: [script('x = 1;')],\n },\n },\n });\n expect(scriptOf(created.field, 'calculate')).toBe('event.value = 1;');\n expect(created.calculationOrder?.map((ref) => ref.kind)).toEqual(['objectNumber']);\n\n const total = await fieldOf(doc, 'total');\n expect(scriptOf(total, 'format')).toBe('AFNumber_Format(2, 0, 0, 0, \"\", true);');\n expect(total.actions?.format?.root?.next.map((n) => n.type)).toEqual(['javascript']);\n expect(scriptOf(total, 'keystroke')).toBe(null);\n expect(await orderOf(doc)).toEqual(['total']);\n });\n });\n\n test('update sets, replaces and removes scripts; an event left out keeps its own', async () => {\n await withDoc(async (doc) => {\n await doc.forms.update(NAME, { actions: { format: script('a();') } });\n await doc.forms.update(NAME, {\n actions: { format: script('b();'), validate: script('c();') },\n });\n let name = await fieldOf(doc, 'name');\n expect([scriptOf(name, 'format'), scriptOf(name, 'validate')]).toEqual(['b();', 'c();']);\n\n await doc.forms.update(NAME, { actions: { format: null } });\n name = await fieldOf(doc, 'name');\n expect([scriptOf(name, 'format'), scriptOf(name, 'validate')]).toEqual([null, 'c();']);\n // No calculate script, no place in the order.\n expect(await orderOf(doc)).toEqual([]);\n });\n });\n\n test('the order follows the calculate scripts: added at the end, gone with the script or the field', async () => {\n await withDoc(async (doc) => {\n await createCalculated(doc, 'a');\n await createCalculated(doc, 'b');\n const updated = await doc.forms.update(NAME, { actions: { calculate: CALCULATE } });\n expect(updated.calculationOrder?.length).toBe(3);\n expect(await orderOf(doc)).toEqual(['a', 'b', 'name']);\n\n await doc.forms.update(NAME, { actions: { calculate: null } });\n expect(await orderOf(doc)).toEqual(['a', 'b']);\n const deleted = await doc.forms.delete({ kind: 'fqn', name: 'a' });\n expect(deleted.calculationOrder?.length).toBe(1);\n expect(await orderOf(doc)).toEqual(['b']);\n });\n });\n\n test('reorderCalculations moves fields by neighbour and publishes the whole order', async () => {\n await withDoc(async (doc) => {\n const a = (await createCalculated(doc, 'a')).field.ref;\n await createCalculated(doc, 'b');\n const c = (await createCalculated(doc, 'c')).field.ref;\n const heard: DocumentEvent[] = [];\n const unsubscribe = doc.events.subscribe((event) => heard.push(event));\n try {\n const moved = await doc.forms.reorderCalculations([c], { before: a });\n expect(moved.calculationOrder.length).toBe(3);\n expect(await orderOf(doc)).toEqual(['c', 'a', 'b']);\n expect(heard.some((event) => event.type === 'forms.calculationsReordered')).toBe(true);\n\n await doc.forms.reorderCalculations([a], 'end');\n expect(await orderOf(doc)).toEqual(['c', 'b', 'a']);\n } finally {\n unsubscribe();\n }\n // A field not in the order, and a neighbour among the moved, are refused.\n expect(await outcome(doc.forms.reorderCalculations([NAME], 'start'))).toBe(\n EngineErrorCode.NotFound,\n );\n expect(await outcome(doc.forms.reorderCalculations([a], { after: a }))).toBe(\n EngineErrorCode.InvalidArg,\n );\n });\n });\n\n test('undo puts the scripts and the order back; redo does them again', async () => {\n await withDoc(async (doc) => {\n await createCalculated(doc, 'a');\n const b = (await createCalculated(doc, 'b')).field.ref;\n\n const scripted = await doc.forms.update(NAME, {\n actions: { calculate: CALCULATE, format: script('f();') },\n });\n expect(await orderOf(doc)).toEqual(['a', 'b', 'name']);\n const undo = await doc.apply({ undoOf: scripted.meta.opId });\n let name = await fieldOf(doc, 'name');\n expect([scriptOf(name, 'calculate'), scriptOf(name, 'format')]).toEqual([null, null]);\n expect(await orderOf(doc)).toEqual(['a', 'b']);\n await doc.apply({ undoOf: undo.meta.opId });\n name = await fieldOf(doc, 'name');\n expect(scriptOf(name, 'format')).toBe('f();');\n expect(await orderOf(doc)).toEqual(['a', 'b', 'name']);\n\n const moved = await doc.forms.reorderCalculations([NAME], { before: b });\n expect(await orderOf(doc)).toEqual(['a', 'name', 'b']);\n await doc.apply({ undoOf: moved.meta.opId });\n expect(await orderOf(doc)).toEqual(['a', 'b', 'name']);\n\n const deleted = await doc.forms.delete({ kind: 'fqn', name: 'a' });\n expect(await orderOf(doc)).toEqual(['b', 'name']);\n await doc.apply({ undoOf: deleted.meta.opId });\n expect(await orderOf(doc)).toEqual(['a', 'b', 'name']);\n });\n });\n\n test('a field event takes JavaScript only', async () => {\n await withDoc(async (doc) => {\n const notAScript = {\n type: 'uri',\n uri: 'https://example.com',\n } as unknown as FieldScriptWrite;\n expect(await outcome(doc.forms.update(NAME, { actions: { format: notAScript } }))).toBe(\n EngineErrorCode.InvalidArg,\n );\n expect(scriptOf(await fieldOf(doc, 'name'), 'format')).toBe(null);\n });\n });\n\n /** The widget row of `ref`, as the form reads it. */\n const rowOf = async (doc: DocumentHandle, ref: AnnotationRef) => {\n const row = (await doc.forms.list()).widgets.find(\n (w) => JSON.stringify(w.ref) === JSON.stringify(ref),\n );\n if (!row) throw new Error('no widget row');\n return row;\n };\n const actionType = (row: { actions: unknown }, event: string) =>\n ((row.actions as Record<string, { root?: { type?: string } }> | null)?.[event]?.root?.type ??\n null) as string | null;\n\n test(\"a widget's actions are written with its placement and read back from its row\", async () => {\n await withDoc(async (doc) => {\n const { field } = await doc.forms.create({\n family: 'text',\n name: 'clearing',\n widgets: [\n {\n page: PAGE,\n rect: { x: 20, y: 200, width: 120, height: 24 },\n actions: { activate: RESET, focus: script('focused();') },\n },\n ],\n });\n const [first] = field.widgets;\n const row = await rowOf(doc, first!.ref!);\n expect(actionType(row, 'activate')).toBe('reset-form');\n expect(actionType(row, 'focus')).toBe('javascript');\n\n const added = await doc.forms.addWidget(field.ref, {\n page: PAGE,\n rect: { x: 20, y: 240, width: 120, height: 24 },\n actions: { blur: script('blurred();') },\n });\n const second = added.field.widgets.find((w) => w.objectNumber !== first!.objectNumber)!;\n expect(actionType(await rowOf(doc, second.ref!), 'blur')).toBe('javascript');\n });\n });\n\n test('updateWidget sets, replaces and removes actions; a read sent back keeps them', async () => {\n await withDoc(async (doc) => {\n await doc.forms.update(NAME, { actions: { calculate: CALCULATE } });\n await doc.forms.updateWidget(WIDGET, {\n actions: {\n activate: {\n type: 'goto',\n destination: { kind: 'xyz', page: PAGE, x: 10, y: 20, zoom: null },\n },\n mouseUp: script('up();'),\n },\n });\n let row = await rowOf(doc, WIDGET);\n expect(actionType(row, 'activate')).toBe('goto');\n const goto = row.actions?.activate?.root;\n expect(goto?.type === 'goto' && goto.destination.kind === 'xyz' && goto.destination.x).toBe(\n 10,\n );\n // The field's own script, on the same merged dictionary, is untouched.\n expect(scriptOf(await fieldOf(doc, 'name'), 'calculate')).toBe('event.value = 1;');\n\n // A read's actions sent back unchanged are kept.\n await doc.forms.updateWidget(WIDGET, { actions: row.actions, interiorColor: '#eeeeee' });\n row = await rowOf(doc, WIDGET);\n expect(actionType(row, 'mouseUp')).toBe('javascript');\n\n await doc.forms.updateWidget(WIDGET, { actions: { activate: RESET, mouseUp: null } });\n row = await rowOf(doc, WIDGET);\n expect([actionType(row, 'activate'), actionType(row, 'mouseUp')]).toEqual([\n 'reset-form',\n null,\n ]);\n });\n });\n\n test(\"undo puts a widget's actions back\", async () => {\n await withDoc(async (doc) => {\n await doc.forms.updateWidget(WIDGET, { actions: { activate: RESET } });\n const changed = await doc.forms.updateWidget(WIDGET, {\n actions: { activate: script('a();'), focus: script('f();') },\n });\n await doc.apply({ undoOf: changed.meta.opId });\n const row = await rowOf(doc, WIDGET);\n expect([actionType(row, 'activate'), actionType(row, 'focus')]).toEqual([\n 'reset-form',\n null,\n ]);\n });\n });\n\n test('a widget action that only changes the view needs doc.forms.modify alone', async () => {\n await withDoc(async (doc) => {\n await doc.forms.updateWidget(WIDGET, { actions: { activate: RESET } });\n const scripted = [\n script('x();'),\n { type: 'uri', uri: 'https://example.com' } as PdfActionWrite,\n { type: 'submit-form', url: 'https://example.com/in', fields: null } as PdfActionWrite,\n { ...RESET, next: [script('then();')] } as PdfActionWrite,\n ];\n for (const action of scripted) {\n expect(\n await outcome(doc.forms.updateWidget(WIDGET, { actions: { activate: action } })),\n ).toBe(EngineErrorCode.Forbidden);\n }\n expect(\n await outcome(\n doc.forms.create({\n family: 'text',\n name: 'y',\n widgets: [\n {\n page: PAGE,\n rect: { x: 20, y: 300, width: 80, height: 20 },\n actions: { activate: script('y();') },\n },\n ],\n }),\n ),\n ).toBe(EngineErrorCode.Forbidden);\n expect(\n await outcome(\n doc.forms.addWidget(NAME, {\n page: PAGE,\n rect: { x: 20, y: 340, width: 80, height: 20 },\n actions: { blur: script('b();') },\n }),\n ),\n ).toBe(EngineErrorCode.Forbidden);\n expect(\n await outcome(\n doc.apply({\n ops: [\n {\n type: 'forms.updateWidget',\n widget: WIDGET,\n patch: { actions: { focus: script('f();') } },\n },\n ],\n }),\n ),\n ).toBe(EngineErrorCode.Forbidden);\n }, DESIGN_ONLY);\n });\n\n test('writing a script takes doc.forms.script; removing one does not', async () => {\n await withDoc(async (doc) => {\n await doc.forms.update(NAME, { actions: { format: script('f();') } });\n });\n await withDoc(async (doc) => {\n expect(doc.security.allows('doc.forms.script')).toBe(false);\n const refused = [\n await outcome(doc.forms.update(NAME, { actions: { format: script('f();') } })),\n await outcome(\n doc.forms.create({ family: 'text', name: 'x', actions: { calculate: CALCULATE } }),\n ),\n await outcome(\n doc.apply({\n ops: [\n {\n type: 'forms.update',\n field: NAME,\n patch: { actions: { validate: script('v();') } },\n },\n ],\n }),\n ),\n ];\n expect(refused.every((code) => code === EngineErrorCode.Forbidden)).toBe(true);\n // A field without scripts, and a removal, need only doc.forms.modify.\n await doc.forms.create({ family: 'text', name: 'plain' });\n await doc.forms.update(NAME, { actions: { format: null } });\n }, DESIGN_ONLY);\n });\n });\n}\n","import { CHANGE_FIXTURE_PDF } from './runChangeConformance';\nimport type { AttributionSession } from './runAnnotationAttributionConformance';\nimport type { ConformanceTestRunner } from './runMetadataConformance';\nimport type { Identity } from '../auth/scope';\nimport type { DocumentHandle } from '../engine/DocumentHandle';\nimport type { Engine } from '../engine/Engine';\nimport type { FormFieldDTO } from '../forms/field';\nimport type { FormFieldRef } from '../identity/FormFieldRef';\n\n/**\n * Who made a field and who filled it in, on both engines with the same\n * identities. The engine stamps it from the session: `create` names the\n * creator, a write that changes a value names its filler (a script's value\n * counts as filled by the user whose fill ran it), a reset and an anonymous\n * fill name nobody, and an undo puts the previous filler back. A widget row\n * reports no attribution: the field holds it.\n *\n * It runs on {@link CHANGE_FIXTURE_PDF}: the text field `name`, merged with\n * its widget (9), holding `Ann`.\n */\n\nexport interface FormAttributionConformanceOptions {\n label: string;\n /** Build a fresh engine for this suite. The suite tears it down at the end. */\n makeEngine: () => Promise<Engine> | Engine;\n /**\n * Open a fresh copy of {@link CHANGE_FIXTURE_PDF} as `session`. With\n * `from`, the new session continues that open session's document and sees\n * what it wrote (locally its downloaded bytes, on the cloud the same\n * layer); the suite closes `from` afterwards.\n */\n openAs: (\n engine: Engine,\n session: AttributionSession,\n from?: DocumentHandle,\n ) => Promise<DocumentHandle>;\n}\n\n// `doc.download` lets a session continue another's document (locally, its bytes).\nconst FILL = ['doc.open', 'doc.render', 'doc.download', 'doc.forms.fill'] as const;\nconst DESIGN = ['doc.open', 'doc.render', 'doc.download', 'doc.forms.modify'] as const;\n\nconst ALICE: Identity = { userId: 'alice', displayName: 'Alice Author', groupId: 'legal' };\nconst BOB: Identity = { userId: 'bob', displayName: 'Bob Builder' };\nconst ANONYMOUS: Identity = {};\n\nconst NAME: FormFieldRef = { kind: 'fqn', name: 'name' };\nconst WIDGET = 9;\n\nexport function runFormAttributionConformance(\n runner: ConformanceTestRunner,\n opts: FormAttributionConformanceOptions,\n): void {\n const { describe, test, beforeAll, afterAll, expect } = runner;\n\n describe(`form attribution conformance: ${opts.label}`, () => {\n let engine: Engine;\n\n beforeAll(async () => {\n engine = await opts.makeEngine();\n });\n\n afterAll(async () => {\n if (engine) await engine.destroy();\n });\n\n const open = (identity: Identity, scope: readonly string[] = FILL, from?: DocumentHandle) =>\n opts.openAs(engine, { scope, identity }, from);\n\n /** Continue `from`'s document as `identity`, closing `from`. */\n const continueAs = async (from: DocumentHandle, identity: Identity) => {\n const next = await open(identity, FILL, from);\n await from.close();\n return next;\n };\n\n const fieldOf = async (doc: DocumentHandle, name: string): Promise<FormFieldDTO> => {\n const { fields } = await doc.forms.list();\n const field = fields.find((f) => f.name === name);\n if (!field) throw new Error(`no field '${name}'`);\n return field;\n };\n\n /** A date stamped between `before` and now: the engine stamps whole seconds. */\n const expectStampedSince = (value: string | null, before: number) => {\n expect(value !== null).toBe(true);\n const at = Date.parse(value!);\n expect(at >= Math.floor(before / 1000) * 1000 && at <= Date.now()).toBe(true);\n };\n\n test('create names who created the field, and when', async () => {\n const doc = await open(ALICE, DESIGN);\n try {\n const before = Date.now();\n const { field } = await doc.forms.create({ family: 'text', name: 'extra' });\n expect(field.createdBy).toBe('alice');\n expectStampedSince(field.createdAt, before);\n expect(field.filledBy).toBe(null);\n expect(field.importedBy).toBe(null);\n expect((await fieldOf(doc, 'extra')).createdBy).toBe('alice');\n // A file's own field names nobody.\n expect((await fieldOf(doc, 'name')).createdBy).toBe(null);\n } finally {\n await doc.close();\n }\n });\n\n test('a fill names who filled the value in; one that changes nothing names nobody new', async () => {\n let doc = await open(ALICE);\n const before = Date.now();\n const { field } = await doc.forms.setValue(NAME, { value: 'Cleo' });\n expect(field.filledBy).toBe('alice');\n expect(field.filledByName).toBe('Alice Author');\n expectStampedSince(field.filledAt, before);\n\n doc = await continueAs(doc, BOB);\n try {\n const same = await doc.forms.setValue(NAME, { value: 'Cleo' });\n expect(same.field.filledBy).toBe('alice');\n const changed = await doc.forms.setValue(NAME, { value: 'Bea' });\n expect(changed.field.filledBy).toBe('bob');\n expect(changed.field.filledByName).toBe('Bob Builder');\n expect((await fieldOf(doc, 'name')).filledBy).toBe('bob');\n } finally {\n await doc.close();\n }\n });\n\n test('a reset, and an anonymous fill, name nobody', async () => {\n let doc = await open(ALICE);\n await doc.forms.setValue(NAME, { value: 'Cleo' });\n const reset = await doc.forms.reset(NAME);\n const cleared = reset.fields.find((field) => field.name === 'name')!;\n expect([cleared.filledBy, cleared.filledByName, cleared.filledAt]).toEqual([\n null,\n null,\n null,\n ]);\n\n await doc.forms.setValue(NAME, { value: 'Cleo' });\n doc = await continueAs(doc, ANONYMOUS);\n try {\n const { field } = await doc.forms.setValue(NAME, { value: 'Someone' });\n expect([field.filledBy, field.filledByName, field.filledAt]).toEqual([null, null, null]);\n } finally {\n await doc.close();\n }\n });\n\n test(\"a script's value counts as filled in by the user whose fill ran it\", async () => {\n const doc = await open(ALICE);\n try {\n // A script's results go in the change of the fill that ran it.\n await doc.apply({\n ops: [{ type: 'forms.setValue', field: NAME, value: { value: 'Calculated' } }],\n });\n expect((await fieldOf(doc, 'name')).filledBy).toBe('alice');\n } finally {\n await doc.close();\n }\n });\n\n test('undoing a fill puts the previous filler back', async () => {\n let doc = await open(ALICE);\n await doc.forms.setValue(NAME, { value: 'Cleo' });\n doc = await continueAs(doc, BOB);\n try {\n const filled = await doc.forms.setValue(NAME, { value: 'Bea' });\n expect(filled.field.filledBy).toBe('bob');\n await doc.apply({ undoOf: filled.meta.opId });\n const field = await fieldOf(doc, 'name');\n expect(field.filledBy).toBe('alice');\n expect(field.filledByName).toBe('Alice Author');\n } finally {\n await doc.close();\n }\n });\n\n test('a widget row reports no attribution: the field holds it', async () => {\n const doc = await open(ALICE);\n try {\n await doc.forms.setValue(NAME, { value: 'Cleo' });\n const { widgets } = await doc.forms.list();\n const row = widgets.find(\n (w) => w.ref.kind === 'objectNumber' && w.ref.objectNumber === WIDGET,\n );\n expect(row !== undefined).toBe(true);\n expect([row!.createdBy, row!.userId, row!.groupId, row!.importedBy]).toEqual([\n null,\n null,\n null,\n null,\n ]);\n } finally {\n await doc.close();\n }\n });\n });\n}\n","import type { AttributionSession } from './runAnnotationAttributionConformance';\nimport { isPermissionRefusal } from './refusals';\nimport type { ConformanceTestRunner } from './runMetadataConformance';\nimport { pdfOf } from './pdfOf';\nimport type { Identity } from '../auth/scope';\nimport type { FieldScriptWrite } from '../dto/PdfAction';\nimport type { DocumentHandle } from '../engine/DocumentHandle';\nimport type { Engine } from '../engine/Engine';\nimport { EngineError } from '../errors/EngineError';\nimport { EngineErrorCode } from '../errors/EngineErrorCode';\nimport type { DocumentEvent } from '../events/DocumentEvent';\nimport type { FormFieldDTO } from '../forms/field';\nimport type { PageBox } from '../geometry/pageSpace';\nimport { encodeFieldRefKey, type FormFieldRef } from '../identity/FormFieldRef';\nimport { toPageRef } from '../identity/PageRef';\nimport type { Change } from '../mutation/Change';\nimport type { FormBundle } from '../transfer/FormBundle';\n\n/**\n * `doc.forms.export`, `doc.forms.import` and `doc.forms.importValues` on\n * both engines. A design import copies whole fields, with their widgets,\n * values, scripts, actions and calculation order, so the copy exports as\n * its source, apart from refs, object numbers and the attribution its mode\n * writes. A values import fills fields of the same name and reports what it\n * leaves out. Both are one change each: undone and redone with\n * `doc.apply({ undoOf })`, answered again on a retry, refused before\n * anything is written.\n *\n * It runs on {@link TWO_PAGES_PDF}: two empty pages (3 and 4) and no form.\n */\n\nexport interface FormTransferConformanceOptions {\n label: string;\n /** Build a fresh engine for this suite. The suite tears it down at the end. */\n makeEngine: () => Promise<Engine> | Engine;\n /** Open a fresh document of `bytes` as `session`. */\n openAs: (\n engine: Engine,\n session: AttributionSession,\n bytes: Uint8Array,\n ) => Promise<DocumentHandle>;\n}\n\n/** Two empty 300 × 300 pages (3 and 4), and no form. */\nexport const TWO_PAGES_PDF = pdfOf([\n '<< /Type /Catalog /Pages 2 0 R >>',\n '<< /Type /Pages /Kids [3 0 R 4 0 R] /Count 2 >>',\n '<< /Type /Page /Parent 2 0 R /MediaBox [0 0 300 300] /Contents 5 0 R /Resources << >> >>',\n '<< /Type /Page /Parent 2 0 R /MediaBox [0 0 300 300] /Contents 5 0 R /Resources << >> >>',\n '<< /Length 0 >>\\nstream\\n\\nendstream',\n]);\n\n/** One empty 300 × 300 page (3), and no form. */\nconst ONE_PAGE_PDF = pdfOf([\n '<< /Type /Catalog /Pages 2 0 R >>',\n '<< /Type /Pages /Kids [3 0 R] /Count 1 >>',\n '<< /Type /Page /Parent 2 0 R /MediaBox [0 0 300 300] /Contents 4 0 R /Resources << >> >>',\n '<< /Length 0 >>\\nstream\\n\\nendstream',\n]);\n\nconst BASE = ['doc.open', 'doc.render', 'doc.download', 'doc.forms.read'] as const;\nconst EVERYTHING = [\n ...BASE,\n 'doc.forms.fill',\n 'doc.forms.modify',\n 'doc.forms.script',\n 'doc.forms.import',\n] as const;\n/** A design import without `doc.forms.script`, stamped. */\nconst DESIGN = [...BASE, 'doc.forms.fill', 'doc.forms.modify'] as const;\n/** A values import, stamped. */\nconst FILL = [...BASE, 'doc.forms.fill'] as const;\n\nconst ALICE: Identity = { userId: 'alice', displayName: 'Alice Author' };\nconst BOB: Identity = { userId: 'bob', displayName: 'Bob Builder' };\n\nconst FIRST = toPageRef(3);\nconst SECOND = toPageRef(4);\nconst fqn = (name: string): FormFieldRef => ({ kind: 'fqn', name });\nconst script = (source: string): FieldScriptWrite => ({ type: 'javascript', script: source });\nconst wide = (y: number): PageBox => ({ x: 20, y, width: 160, height: 24 });\nconst small = (x: number, y: number): PageBox => ({ x, y, width: 16, height: 16 });\n\n/** The field names, in the source's form order. */\nconst SOURCE_FIELDS = [\n 'customer.name',\n 'agree',\n 'plan',\n 'country',\n 'tags',\n 'go',\n 'sign',\n 'subtotal',\n 'total',\n];\n\n/** What a copy gets afresh, and so leaves out of a comparison. */\nconst IDENTITY_KEYS = new Set(['ref', 'objectNumber', 'nm', 'field']);\n/** What the import's mode writes, checked on its own. */\nconst ATTRIBUTION_KEYS = new Set([\n 'createdBy',\n 'createdAt',\n 'filledBy',\n 'filledByName',\n 'filledAt',\n 'importedBy',\n]);\n\nexport function runFormTransferConformance(\n runner: ConformanceTestRunner,\n opts: FormTransferConformanceOptions,\n): void {\n const { describe, test, beforeAll, afterAll, expect } = runner;\n\n describe(`form transfer conformance: ${opts.label}`, () => {\n let engine: Engine;\n\n beforeAll(async () => {\n engine = await opts.makeEngine();\n });\n\n afterAll(async () => {\n if (engine) await engine.destroy();\n });\n\n const open = (\n identity: Identity,\n scope: readonly string[] = EVERYTHING,\n bytes: Uint8Array = TWO_PAGES_PDF,\n ) => opts.openAs(engine, { scope, identity }, bytes.slice());\n\n /** Run `body` with the documents it opens, closing them after. */\n const using = async (\n body: (opened: (doc: Promise<DocumentHandle>) => Promise<DocumentHandle>) => Promise<void>,\n ) => {\n const docs: DocumentHandle[] = [];\n try {\n await body(async (doc) => {\n const handle = await doc;\n docs.push(handle);\n return handle;\n });\n } finally {\n for (const doc of docs) await doc.close();\n }\n };\n\n /**\n * Alice's form, a field of every family on both pages: values, a\n * script, a link, a radio group across the pages, and two calculated\n * fields, the second calculated first.\n */\n const build = async (doc: DocumentHandle) => {\n const { forms } = doc;\n await forms.create({\n family: 'text',\n name: 'customer.name',\n maxLength: 40,\n actions: { validate: script('validated();') },\n widgets: [{ page: FIRST, rect: wide(240) }],\n });\n await forms.setValue(fqn('customer.name'), { value: 'Ada' });\n await forms.create({\n family: 'checkbox',\n name: 'agree',\n widgets: [{ page: FIRST, rect: small(20, 200), exportValue: 'Yes' }],\n });\n await forms.setValue(fqn('agree'), { checked: true });\n await forms.create({\n family: 'radio',\n name: 'plan',\n widgets: [\n { page: FIRST, rect: small(20, 160), exportValue: 'basic' },\n { page: SECOND, rect: small(20, 160), exportValue: 'pro' },\n ],\n });\n await forms.setValue(fqn('plan'), { value: 'pro' });\n await forms.create({\n family: 'combobox',\n name: 'country',\n options: [\n { label: 'Netherlands', value: 'NL' },\n { label: 'Belgium', value: 'BE' },\n ],\n widgets: [{ page: SECOND, rect: wide(240) }],\n });\n await forms.setValue(fqn('country'), { value: 'BE' });\n await forms.create({\n family: 'listbox',\n name: 'tags',\n multiSelect: true,\n options: [\n { label: 'A', value: 'a' },\n { label: 'B', value: 'b' },\n { label: 'C', value: 'c' },\n ],\n widgets: [{ page: SECOND, rect: { x: 20, y: 120, width: 80, height: 60 } }],\n });\n await forms.setValue(fqn('tags'), { selectedValues: ['a', 'c'] });\n await forms.create({\n family: 'pushbutton',\n name: 'go',\n widgets: [\n {\n page: SECOND,\n rect: { x: 200, y: 240, width: 60, height: 24 },\n caption: 'Go',\n actions: { activate: { type: 'uri', uri: 'https://example.com' } },\n },\n ],\n });\n await forms.create({\n family: 'signature',\n name: 'sign',\n widgets: [{ page: SECOND, rect: { x: 200, y: 20, width: 80, height: 40 } }],\n });\n await forms.create({\n family: 'text',\n name: 'subtotal',\n actions: { calculate: script('event.value = 1;') },\n widgets: [{ page: FIRST, rect: wide(100) }],\n });\n await forms.create({\n family: 'text',\n name: 'total',\n actions: { calculate: script('event.value = 2;') },\n widgets: [{ page: FIRST, rect: wide(60) }],\n });\n await forms.reorderCalculations([fqn('total')], 'start');\n };\n\n /** Alice's form, exported. */\n const sourceBundle = async (\n opened: (doc: Promise<DocumentHandle>) => Promise<DocumentHandle>,\n ) => {\n const source = await opened(open(ALICE));\n await build(source);\n return source.forms.export();\n };\n\n const fieldOf = async (doc: DocumentHandle, name: string): Promise<FormFieldDTO> => {\n const field = (await doc.forms.list()).fields.find((f) => f.name === name);\n if (!field) throw new Error(`no field '${name}'`);\n return field;\n };\n\n const namesOf = async (doc: DocumentHandle) =>\n (await doc.forms.list()).fields.map((field) => field.name);\n\n /** The calculation order, by field name. */\n const orderOf = async (doc: DocumentHandle): Promise<string[]> => {\n const { fields, calculationOrder } = await doc.forms.list();\n return calculationOrder.map((ref) => {\n const field =\n ref && fields.find((f) => encodeFieldRefKey(f.ref) === encodeFieldRefKey(ref));\n return field ? field.name : '?';\n });\n };\n\n const refusalOf = (attempt: Promise<unknown>) =>\n attempt.then(\n () => null,\n (error: unknown) => error,\n );\n\n test('a design import copies every field: the copy exports as its source', async () => {\n await using(async (opened) => {\n const bundle = await sourceBundle(opened);\n expect(bundle.fields.map(({ data }) => data.name)).toEqual(SOURCE_FIELDS);\n\n const target = await opened(open(ALICE));\n const result = await target.forms.import(bundle);\n expect(result.dropped).toEqual([]);\n expect(result.meta.undoable).toBe(true);\n expect(result.fields.map((field) => field.name)).toEqual(SOURCE_FIELDS);\n expect(result.refMap.map(({ from }) => from)).toEqual(\n bundle.fields.map(({ data }) => data.ref),\n );\n expect(result.refMap.map(({ to }) => to)).toEqual(result.fields.map((field) => field.ref));\n expect(comparable(await target.forms.export())).toEqual(comparable(bundle));\n expect(await orderOf(target)).toEqual(['total', 'subtotal']);\n });\n });\n\n test('an export takes whole fields: by name, or every field with a widget on a page', async () => {\n await using(async (opened) => {\n const source = await opened(open(ALICE));\n await build(source);\n const named = await source.forms.export({ fields: [fqn('plan'), fqn('agree')] });\n // In the form's order, each with every widget it has, wherever it is.\n expect(named.fields.map(({ data }) => data.name)).toEqual(['agree', 'plan']);\n expect(named.widgets).toHaveLength(3);\n expect(named.pages.map(({ page }) => page)).toEqual([FIRST, SECOND]);\n\n const onSecond = await source.forms.export({ pages: [SECOND] });\n expect(onSecond.fields.map(({ data }) => data.name)).toEqual([\n 'plan',\n 'country',\n 'tags',\n 'go',\n 'sign',\n ]);\n await expect(source.forms.export({ fields: [fqn('nothing')] })).rejects.toMatchObject({\n code: EngineErrorCode.NotFound,\n });\n });\n });\n\n test(\"restore writes the source's attribution and the importer; stamp makes the fields the session's\", async () => {\n await using(async (opened) => {\n const bundle = await sourceBundle(opened);\n\n const restored = await opened(open(BOB));\n await restored.forms.import(bundle);\n const copied = await fieldOf(restored, 'customer.name');\n expect(copied).toMatchObject({\n createdBy: 'alice',\n filledBy: 'alice',\n filledByName: 'Alice Author',\n importedBy: 'bob',\n });\n const source = bundle.fields.find(({ data }) => data.name === 'customer.name')!.data;\n expect(copied.createdAt).toBe(source.createdAt);\n expect(copied.filledAt).toBe(source.filledAt);\n expect(await fieldOf(restored, 'go')).toMatchObject({ createdBy: 'alice', filledBy: null });\n\n const stamped = await opened(open(BOB));\n await stamped.forms.import(bundle, { attribution: 'stamp' });\n expect(await fieldOf(stamped, 'customer.name')).toMatchObject({\n createdBy: 'bob',\n filledBy: 'bob',\n filledByName: 'Bob Builder',\n importedBy: null,\n });\n });\n });\n\n test('restoring needs doc.forms.import; stamping needs only what a create needs', async () => {\n await using(async (opened) => {\n const bundle = await sourceBundle(opened);\n const target = await opened(open(BOB, [...DESIGN, 'doc.forms.script']));\n expect(isPermissionRefusal(await refusalOf(target.forms.import(bundle)))).toBe(true);\n expect(isPermissionRefusal(await refusalOf(target.forms.importValues(bundle)))).toBe(true);\n expect(await namesOf(target)).toEqual([]);\n\n const stamped = await target.forms.import(bundle, { attribution: 'stamp' });\n expect(stamped.fields).toHaveLength(SOURCE_FIELDS.length);\n\n const filler = await opened(open(BOB, FILL));\n expect(\n isPermissionRefusal(\n await refusalOf(filler.forms.import(bundle, { attribution: 'stamp' })),\n ),\n ).toBe(true);\n });\n });\n\n test('without doc.forms.script, scripts, submits and links are left out; the rest is copied', async () => {\n await using(async (opened) => {\n const bundle = await sourceBundle(opened);\n const target = await opened(open(BOB, DESIGN));\n const result = await target.forms.import(bundle, { attribution: 'stamp' });\n expect(result.fields.map((field) => field.name)).toEqual(SOURCE_FIELDS);\n const left = result.dropped.map(({ ref, widget, field, reason }) => ({\n name: bundle.fields.find(\n ({ data }) => encodeFieldRefKey(data.ref) === encodeFieldRefKey(ref!),\n )?.data.name,\n widget: widget !== undefined,\n field,\n reason,\n }));\n expect(left).toEqual([\n {\n name: 'customer.name',\n widget: false,\n field: 'actions.validate',\n reason: 'script-not-allowed',\n },\n { name: 'go', widget: true, field: 'actions.activate', reason: 'script-not-allowed' },\n {\n name: 'subtotal',\n widget: false,\n field: 'actions.calculate',\n reason: 'script-not-allowed',\n },\n {\n name: 'total',\n widget: false,\n field: 'actions.calculate',\n reason: 'script-not-allowed',\n },\n ]);\n expect((await fieldOf(target, 'customer.name')).actions?.validate ?? null).toBeNull();\n // Without their calculate scripts, the copies have no place in the order.\n expect(await orderOf(target)).toEqual([]);\n });\n });\n\n test('pages map: as they are by default, or as a list says; a page that maps nowhere refuses', async () => {\n await using(async (opened) => {\n const bundle = await sourceBundle(opened);\n const swapped = await opened(open(ALICE));\n const result = await swapped.forms.import(bundle, {\n pages: [\n { from: FIRST, to: SECOND },\n { from: SECOND, to: FIRST },\n ],\n });\n const plan = result.fields.find((field) => field.name === 'plan')!;\n expect(plan.widgets.map((widget) => widget.page)).toEqual([SECOND, FIRST]);\n\n const short = await opened(open(ALICE, EVERYTHING, ONE_PAGE_PDF));\n const events: DocumentEvent[] = [];\n short.events.subscribe((event) => events.push(event));\n await expect(short.forms.import(bundle)).rejects.toMatchObject({\n code: EngineErrorCode.InvalidArg,\n });\n expect(await namesOf(short)).toEqual([]);\n expect(events).toEqual([]);\n });\n });\n\n test('a field whose name is taken is left out, and so is one that would be its parent or child', async () => {\n await using(async (opened) => {\n const bundle = await sourceBundle(opened);\n const target = await opened(open(ALICE));\n await target.forms.create({ family: 'text', name: 'agree' });\n await target.forms.create({ family: 'text', name: 'customer' });\n await target.forms.create({ family: 'text', name: 'go.now' });\n const result = await target.forms.import(bundle);\n const conflicts = result.dropped\n .filter(({ reason }) => reason === 'name-conflict')\n .map(({ ref }) => encodeFieldRefKey(ref!));\n const names = new Map(\n bundle.fields.map(({ data }) => [encodeFieldRefKey(data.ref), data.name]),\n );\n expect(conflicts.map((key) => names.get(key))).toEqual(['customer.name', 'agree', 'go']);\n expect(result.fields.map((field) => field.name)).toEqual(\n SOURCE_FIELDS.filter((name) => !['customer.name', 'agree', 'go'].includes(name)),\n );\n });\n });\n\n test(\"the calculation order of the copies follows the form's own, as the bundle has it\", async () => {\n await using(async (opened) => {\n const bundle = await sourceBundle(opened);\n const target = await opened(open(ALICE));\n await target.forms.create({\n family: 'text',\n name: 'own',\n actions: { calculate: script('event.value = 0;') },\n });\n const result = await target.forms.import(bundle);\n expect(await orderOf(target)).toEqual(['own', 'total', 'subtotal']);\n expect(result.calculationOrder).toHaveLength(3);\n });\n });\n\n test('a signature never travels: a signature field is copied unsigned', async () => {\n await using(async (opened) => {\n const bundle = await sourceBundle(opened);\n const sign = bundle.fields.find(({ data }) => data.name === 'sign')!.data;\n expect(sign.valueEntry).toEqual({ kind: 'none' });\n // A field the form doesn't export goes without its value or its filler.\n const source = await opened(open(ALICE));\n await build(source);\n await source.forms.update(fqn('customer.name'), { noExport: true });\n const [name] = (await source.forms.export({ fields: [fqn('customer.name')] })).fields;\n expect(name!.data).toMatchObject({\n value: '',\n valueEntry: { kind: 'none' },\n filledBy: null,\n filledAt: null,\n });\n });\n });\n\n test('a values import fills the fields of the same name, and reports what it leaves out', async () => {\n await using(async (opened) => {\n const bundle = await sourceBundle(opened);\n const target = await opened(open(BOB));\n await target.forms.import(bundle, { attribution: 'stamp', values: false });\n expect((await fieldOf(target, 'customer.name')).valueEntry).toEqual({ kind: 'none' });\n\n const rows = bundle.fields.map(({ data }) => data);\n const row = (name: string) => rows.find((data) => data.name === name)!;\n const values: FormBundle = {\n ...bundle,\n fields: [\n { data: row('customer.name') },\n // No field of that name.\n { data: { ...row('agree'), name: 'missing' } },\n // A text value for the checkbox.\n { data: { ...row('customer.name'), name: 'agree' } },\n // An option the dropdown doesn't have.\n {\n data: { ...row('country'), value: 'FR', valueEntry: { kind: 'scalar', value: 'FR' } },\n },\n { data: row('tags') },\n ] as FormBundle['fields'],\n };\n const result = await target.forms.importValues(values, { attribution: 'restore' });\n expect(result.fields.map((field) => field.name)).toEqual(['customer.name', 'tags']);\n expect(result.dropped.map(({ reason }) => reason)).toEqual([\n 'no-field',\n 'wrong-family',\n 'value-not-allowed',\n ]);\n expect(await fieldOf(target, 'customer.name')).toMatchObject({\n value: 'Ada',\n filledBy: 'alice',\n importedBy: 'bob',\n });\n expect(await fieldOf(target, 'tags')).toMatchObject({ selectedValues: ['a', 'c'] });\n expect(await fieldOf(target, 'country')).toMatchObject({ value: '' });\n });\n });\n\n test('a design import is undone and redone: fields, widgets and calculation order back exactly', async () => {\n await using(async (opened) => {\n const bundle = await sourceBundle(opened);\n const target = await opened(open(ALICE));\n await target.forms.create({\n family: 'text',\n name: 'own',\n actions: { calculate: script('event.value = 0;') },\n });\n const before = await target.forms.list();\n const imported = await target.forms.import(bundle);\n const after = await target.forms.list();\n\n const undo = await target.apply({ undoOf: imported.meta.opId });\n expect(undo.items.map((item) => item.type)).toEqual(\n SOURCE_FIELDS.map(() => 'forms.delete'),\n );\n expect(await target.forms.list()).toEqual(before);\n\n await target.apply({ undoOf: undo.meta.opId });\n const redone = await target.forms.list();\n expect(redone.fields).toEqual(after.fields);\n expect(redone.calculationOrder).toEqual(after.calculationOrder);\n expect(await orderOf(target)).toEqual(['own', 'total', 'subtotal']);\n });\n });\n\n test('a values import is undone and redone: values and who filled them back', async () => {\n await using(async (opened) => {\n const bundle = await sourceBundle(opened);\n const target = await opened(open(BOB));\n await target.forms.import(bundle, { attribution: 'stamp', values: false });\n await target.forms.setValue(fqn('customer.name'), { value: 'Bob' });\n\n const filled = await target.forms.importValues(bundle);\n expect(filled.meta.undoable).toBe(true);\n expect(await fieldOf(target, 'customer.name')).toMatchObject({\n value: 'Ada',\n filledBy: 'alice',\n });\n\n const undo = await target.apply({ undoOf: filled.meta.opId });\n expect(await fieldOf(target, 'customer.name')).toMatchObject({\n value: 'Bob',\n filledBy: 'bob',\n });\n expect((await fieldOf(target, 'agree')).valueEntry).toEqual({ kind: 'none' });\n\n await target.apply({ undoOf: undo.meta.opId });\n expect(await fieldOf(target, 'customer.name')).toMatchObject({\n value: 'Ada',\n filledBy: 'alice',\n importedBy: 'bob',\n });\n expect(await fieldOf(target, 'agree')).toMatchObject({ checked: true });\n });\n });\n\n test('an imported field changed since is left alone by the undo; the rest goes', async () => {\n await using(async (opened) => {\n const bundle = await sourceBundle(opened);\n const target = await opened(open(ALICE));\n const imported = await target.forms.import(bundle);\n await target.forms.update(fqn('country'), { required: true });\n\n const undo = await target.apply({ undoOf: imported.meta.opId });\n expect(undo.items.filter((item) => item.type === 'skipped')).toHaveLength(1);\n expect(await namesOf(target)).toEqual(['country']);\n });\n });\n\n test('a retry under the same opId answers again and writes nothing more', async () => {\n await using(async (opened) => {\n const bundle = await sourceBundle(opened);\n const target = await opened(open(ALICE));\n const first = await target.forms.import(bundle, { opId: 'form-import-retry' });\n const again = await target.forms.import(bundle, { opId: 'form-import-retry' });\n expect(again.refMap).toEqual(first.refMap);\n expect(await namesOf(target)).toEqual(SOURCE_FIELDS);\n\n const values = await target.forms.importValues(bundle, { opId: 'form-values-retry' });\n const valuesAgain = await target.forms.importValues(bundle, { opId: 'form-values-retry' });\n expect(valuesAgain.fields).toEqual(values.fields);\n });\n });\n\n test('each import is one transaction: one event per field, sharing its opId', async () => {\n await using(async (opened) => {\n const bundle = await sourceBundle(opened);\n const target = await opened(open(ALICE));\n const events: DocumentEvent[] = [];\n target.events.subscribe((event) => events.push(event));\n\n const imported = await target.forms.import(bundle, { opId: 'form-import-1' });\n const created = events.filter((event) => event.type === 'forms.created');\n expect(created).toHaveLength(SOURCE_FIELDS.length);\n created.forEach((event, index) => {\n if (event.type !== 'forms.created') return;\n expect(event.field).toEqual(imported.fields[index]);\n expect(event.origin.tx).toEqual({\n id: 'form-import-1',\n index,\n count: SOURCE_FIELDS.length,\n });\n });\n\n events.length = 0;\n await target.forms.setValue(fqn('customer.name'), { value: 'Changed' });\n await target.forms.setValue(fqn('agree'), { checked: false });\n events.length = 0;\n const filled = await target.forms.importValues(bundle, { opId: 'form-values-1' });\n const set = events.filter((event) => event.type === 'forms.valueSet');\n expect(set.map((event) => event.type === 'forms.valueSet' && event.field.name)).toEqual(\n filled.fields.map((field) => field.name),\n );\n expect(filled.fields.map((field) => field.name)).toEqual(['customer.name', 'agree']);\n });\n });\n\n test('refuses before writing: a malformed bundle, and doc.apply takes no import', async () => {\n await using(async (opened) => {\n const bundle = await sourceBundle(opened);\n const target = await opened(open(ALICE));\n const broken = { ...bundle, format: 'embedpdf/annotations' } as unknown as FormBundle;\n await expect(target.forms.import(broken)).rejects.toMatchObject({\n code: EngineErrorCode.InvalidArg,\n });\n const strayWidget = { ...bundle, fields: bundle.fields.slice(1) };\n const result = await target.forms.import(strayWidget, { attribution: 'stamp' });\n expect(result.dropped.filter(({ reason }) => reason === 'no-field')).toHaveLength(1);\n\n const change = { ops: [{ type: 'forms.import', bundle, attribution: 'restore' }] };\n const refused = await refusalOf(target.apply(change as unknown as Change));\n expect(EngineError.is(refused, EngineErrorCode.InvalidArg)).toBe(true);\n });\n });\n });\n}\n\n/**\n * A bundle as two documents can agree on it: without what a copy gets\n * afresh (refs, object numbers, names) or what the import's mode writes\n * (attribution), and the calculation order by field name. Page refs stay:\n * both documents are {@link TWO_PAGES_PDF}.\n */\nfunction comparable(bundle: FormBundle) {\n const nameOf = new Map(bundle.fields.map(({ data }) => [encodeFieldRefKey(data.ref), data.name]));\n const strip = (value: unknown, key?: string): unknown => {\n if (key === 'page') return value;\n if (Array.isArray(value)) return value.map((item) => strip(item));\n if (value === null || typeof value !== 'object') return value;\n return Object.fromEntries(\n Object.entries(value)\n .filter(([inner]) => !IDENTITY_KEYS.has(inner) && !ATTRIBUTION_KEYS.has(inner))\n .map(([inner, nested]) => [inner, strip(nested, inner)]),\n );\n };\n return {\n pages: bundle.pages,\n fields: bundle.fields.map(({ data }) => strip(data)),\n widgets: bundle.widgets.map(({ data }) => strip(data)),\n calculationOrder: bundle.calculationOrder.map((ref) => nameOf.get(encodeFieldRefKey(ref))),\n };\n}\n","import { pdfOf } from './pdfOf';\nimport type { ConformanceTestRunner } from './runMetadataConformance';\nimport { TWO_PAGES_PDF } from './runFormTransferConformance';\nimport type { WidgetAnnotation } from '../annotation/kinds/widget';\nimport type { DocumentHandle } from '../engine/DocumentHandle';\nimport type { Engine } from '../engine/Engine';\nimport { EngineError } from '../errors/EngineError';\nimport { EngineErrorCode } from '../errors/EngineErrorCode';\nimport type { PageBox } from '../geometry/pageSpace';\nimport { annotationKey } from '../identity/annotationKey';\nimport { toPageRef } from '../identity/PageRef';\n\n/**\n * A widget turns as a box kind does: `box` is the frame its contents are\n * laid out in, `rotation` a quarter turn, clockwise (`/MK /R`, which the\n * file holds counterclockwise), and `rect` where it stands on the page, the\n * box turned. On both engines: Acrobat's turned fields read so, a placement\n * turns a new field, an update turns, moves and resizes one, undo puts it\n * back, and a form bundle carries the turn.\n *\n * It runs on {@link TURNED_FIELDS_PDF}.\n */\n\nexport interface WidgetRotationConformanceOptions {\n label: string;\n /** Build a fresh engine for this suite. The suite tears it down at the end. */\n makeEngine: () => Promise<Engine> | Engine;\n /** Open a fresh document of `bytes` with every scope. */\n open: (engine: Engine, bytes: Uint8Array) => Promise<DocumentHandle>;\n}\n\nconst field = (name: string, rect: string, mk: string, page = 3) =>\n `<< /Type /Annot /Subtype /Widget /FT /Tx /T (${name}) /V (${name}) /Rect [${rect}] ` +\n `${mk} /P ${page} 0 R >>`;\n\n/**\n * Two 300 × 300 pages: the first upright (3), the second shown turned 90°\n * (`/Rotate 90`, page 4). Text fields with `/MK /R` as Acrobat writes it,\n * counterclockwise: `upright` (none), `r90` (90, the text runs up the page),\n * `r180`, `r270`, `odd` (45, which no viewer draws turned), `negative`\n * (-90, the same turn as 270), and `on-turned` on the turned page (90: an\n * upright field there, as Acrobat adds one).\n */\nexport const TURNED_FIELDS_PDF = pdfOf([\n '<< /Type /Catalog /Pages 2 0 R /AcroForm << /Fields [6 0 R 7 0 R 8 0 R 9 0 R 10 0 R ' +\n '11 0 R 12 0 R] /DA (/Helv 10 Tf 0 g) /DR << /Font << /Helv << /Type /Font /Subtype /Type1 ' +\n '/BaseFont /Helvetica >> >> >> >> >>',\n '<< /Type /Pages /Kids [3 0 R 4 0 R] /Count 2 >>',\n '<< /Type /Page /Parent 2 0 R /MediaBox [0 0 300 300] /Contents 5 0 R /Resources << >> ' +\n '/Annots [6 0 R 7 0 R 8 0 R 9 0 R 10 0 R 11 0 R] >>',\n '<< /Type /Page /Parent 2 0 R /MediaBox [0 0 300 300] /Rotate 90 /Contents 5 0 R ' +\n '/Resources << >> /Annots [12 0 R] >>',\n '<< /Length 0 >>\\nstream\\n\\nendstream',\n field('upright', '20 260 180 284', ''),\n field('r90', '20 20 44 180', '/MK << /R 90 >>'),\n field('r180', '60 220 220 244', '/MK << /R 180 >>'),\n field('r270', '250 20 274 180', '/MK << /R 270 >>'),\n field('odd', '60 180 220 204', '/MK << /R 45 >>'),\n field('negative', '200 20 224 180', '/MK << /R -90 >>'),\n field('on-turned', '20 20 44 180', '/MK << /R 90 >>', 4),\n]);\n\nconst FIRST = toPageRef(3);\n\n/** `box` with its sides swapped about its middle: where it stands turned a quarter. */\nconst swapped = (box: PageBox): PageBox => ({\n x: box.x + (box.width - box.height) / 2,\n y: box.y + (box.height - box.width) / 2,\n width: box.height,\n height: box.width,\n});\n\nexport function runWidgetRotationConformance(\n runner: ConformanceTestRunner,\n opts: WidgetRotationConformanceOptions,\n): void {\n const { describe, test, beforeAll, afterAll, expect } = runner;\n\n describe(`widget rotation conformance: ${opts.label}`, () => {\n let engine: Engine;\n\n beforeAll(async () => {\n engine = await opts.makeEngine();\n });\n\n afterAll(async () => {\n if (engine) await engine.destroy();\n });\n\n const withDoc = async (\n body: (doc: DocumentHandle) => Promise<void>,\n bytes: Uint8Array = TURNED_FIELDS_PDF,\n ) => {\n const doc = await opts.open(engine, bytes.slice());\n try {\n await body(doc);\n } finally {\n await doc.close();\n }\n };\n\n /** The row of the first widget of field `name`. */\n const rowOf = async (doc: DocumentHandle, name: string): Promise<WidgetAnnotation> => {\n const { fields, widgets } = await doc.forms.list();\n const field = fields.find((f) => f.name === name);\n const ref = field?.widgets[0]?.ref;\n const row = ref && widgets.find((w) => annotationKey(w.ref) === annotationKey(ref));\n if (!row) throw new Error(`no widget of '${name}'`);\n return row;\n };\n\n const expectBox = (actual: PageBox, expected: PageBox) => {\n for (const edge of ['x', 'y', 'width', 'height'] as const) {\n expect(Math.abs(actual[edge] - expected[edge]) < 0.01).toBe(true);\n }\n };\n\n const refusalOf = (attempt: Promise<unknown>) =>\n attempt.then(\n () => null,\n (error: unknown) => error,\n );\n\n test('/MK /R reads as the clockwise turn, with the box it turns; rect is where it stands', async () => {\n await withDoc(async (doc) => {\n const turns: Record<string, number | null> = {};\n for (const name of ['upright', 'r90', 'r180', 'r270', 'odd', 'negative', 'on-turned']) {\n turns[name] = (await rowOf(doc, name)).rotation;\n }\n expect(turns).toEqual({\n upright: null,\n r90: 270,\n r180: 180,\n r270: 90,\n odd: null,\n negative: 90,\n 'on-turned': 270,\n });\n const r90 = await rowOf(doc, 'r90');\n // /Rect [20 20 44 180] on a 300-high page: 24 wide, 160 tall, from the top-left.\n expectBox(r90.rect, { x: 20, y: 120, width: 24, height: 160 });\n expectBox(r90.box, swapped(r90.rect));\n const r180 = await rowOf(doc, 'r180');\n expectBox(r180.box, r180.rect);\n });\n });\n\n test('a turned field fills and saves with its turn', async () => {\n let bytes: Uint8Array | null = null;\n await withDoc(async (doc) => {\n const name = (await doc.forms.list()).fields.find((f) => f.name === 'r90')!;\n await doc.forms.setValue(name.ref, { value: 'Turned' });\n bytes = await doc.download();\n });\n await withDoc(async (doc) => {\n const row = await rowOf(doc, 'r90');\n expect(row.rotation).toBe(270);\n expectBox(row.rect, { x: 20, y: 120, width: 24, height: 160 });\n const field = (await doc.forms.list()).fields.find((f) => f.name === 'r90')!;\n expect(field).toMatchObject({ value: 'Turned' });\n }, bytes!);\n });\n\n test(\"a placement's rotation turns a new field's contents inside its rect\", async () => {\n await withDoc(async (doc) => {\n const rect = { x: 100, y: 40, width: 24, height: 160 };\n const { field } = await doc.forms.create({\n family: 'text',\n name: 'side',\n widgets: [{ page: FIRST, rect, rotation: 270 }],\n });\n const row = await rowOf(doc, field.name);\n expect(row.rotation).toBe(270);\n expectBox(row.rect, rect);\n expectBox(row.box, swapped(rect));\n\n const refused = await refusalOf(\n doc.forms.create({\n family: 'text',\n name: 'tilted',\n widgets: [{ page: FIRST, rect, rotation: 45 as never }],\n }),\n );\n expect(EngineError.is(refused, EngineErrorCode.InvalidArg)).toBe(true);\n });\n });\n\n test('a placement gives where the widget stands or its frame: the same widget either way', async () => {\n await withDoc(async (doc) => {\n const rect = { x: 150, y: 40, width: 24, height: 160 };\n const { field } = await doc.forms.create({\n family: 'text',\n name: 'by-box',\n widgets: [{ page: FIRST, box: swapped(rect), rotation: 270 }],\n });\n const row = await rowOf(doc, field.name);\n expect(row.rotation).toBe(270);\n expectBox(row.rect, rect);\n expectBox(row.box, swapped(rect));\n\n const neither = await refusalOf(\n doc.forms.create({ family: 'text', name: 'nowhere', widgets: [{ page: FIRST }] }),\n );\n expect(EngineError.is(neither, EngineErrorCode.InvalidArg)).toBe(true);\n });\n });\n\n test('a turn turns the widget about its middle; a new box with it keeps the widget in place', async () => {\n await withDoc(async (doc) => {\n const before = await rowOf(doc, 'upright');\n const turned = await doc.forms.updateWidget(before.ref, { rotation: 90 });\n expect(turned.widget.rotation).toBe(90);\n expectBox(turned.widget.box, before.box);\n expectBox(turned.widget.rect, swapped(before.rect));\n\n // Acrobat's Orientation: the text turns, the footprint stays.\n const oriented = await doc.forms.updateWidget(before.ref, {\n rotation: 270,\n box: swapped(before.rect),\n });\n expect(oriented.widget.rotation).toBe(270);\n expectBox(oriented.widget.rect, before.rect);\n\n const straight = await doc.forms.updateWidget(before.ref, { rotation: null });\n expect(straight.widget.rotation).toBe(null);\n });\n });\n\n test('rect moves and resizes a quarter-turned widget; its turn stays', async () => {\n await withDoc(async (doc) => {\n const row = await rowOf(doc, 'r90');\n const rect = { x: 30, y: 60, width: 40, height: 200 };\n const { widget } = await doc.forms.updateWidget(row.ref, { rect });\n expect(widget.rotation).toBe(270);\n expectBox(widget.rect, rect);\n expectBox(widget.box, swapped(rect));\n });\n });\n\n test(\"a widget's turn is a quarter turn: another is refused\", async () => {\n await withDoc(async (doc) => {\n const row = await rowOf(doc, 'upright');\n const refused = await refusalOf(doc.forms.updateWidget(row.ref, { rotation: 45 as never }));\n expect(EngineError.is(refused, EngineErrorCode.InvalidArg)).toBe(true);\n expect((await rowOf(doc, 'upright')).rotation).toBe(null);\n });\n });\n\n test('undo puts a turn back, and redo turns it again', async () => {\n await withDoc(async (doc) => {\n const row = await rowOf(doc, 'r180');\n const turned = await doc.forms.updateWidget(row.ref, { rotation: 90 });\n const undo = await doc.apply({ undoOf: turned.meta.opId });\n const back = await rowOf(doc, 'r180');\n expect(back.rotation).toBe(180);\n expectBox(back.rect, row.rect);\n await doc.apply({ undoOf: undo.meta.opId });\n expect((await rowOf(doc, 'r180')).rotation).toBe(90);\n });\n });\n\n test('a form bundle carries the turn', async () => {\n let bundle: Awaited<ReturnType<DocumentHandle['forms']['export']>> | null = null;\n await withDoc(async (doc) => {\n bundle = await doc.forms.export({ pages: [FIRST] });\n });\n await withDoc(async (copy) => {\n await copy.forms.import(bundle!, { attribution: 'stamp' });\n for (const name of ['upright', 'r90', 'r180', 'r270']) {\n const first = bundle!.fields.find((f) => f.data.name === name)!.data.widgets[0]!;\n const source = bundle!.widgets.find(\n ({ data }) => annotationKey(data.ref) === annotationKey(first.ref!),\n )!.data;\n const row = await rowOf(copy, name);\n expect({ name, rotation: row.rotation }).toEqual({ name, rotation: source.rotation });\n expectBox(row.rect, source.rect);\n }\n }, TWO_PAGES_PDF);\n });\n });\n}\n","import { pdfOf } from './pdfOf';\nimport type { ConformanceTestRunner } from './runMetadataConformance';\nimport type { DocumentHandle } from '../engine/DocumentHandle';\nimport type { Engine } from '../engine/Engine';\nimport { annotationKey } from '../identity/annotationKey';\nimport { toPageRef, type PageRef } from '../identity/PageRef';\n\n/**\n * Where the form finds a widget, in files that store it the awkward ways real\n * PDFs do. A page's `/Annots` decides where a widget is shown; the field tree\n * and a widget's `/P` don't. The subtype decides the family: a widget is the\n * form's, listed with `field: null` when no field claims it.\n *\n * Every case gives the same answer in the form read (`forms.list()`), the\n * annotation read (which never holds a widget) and the pictures (each\n * family's appearances).\n */\n\nconst FONT_RESOURCES =\n '/DR << /Font << /Helv << /Type /Font /Subtype /Type1 /BaseFont /Helvetica >> >> >>';\nconst PAGE = '/Type /Page /Parent 2 0 R /MediaBox [0 0 300 300] /Resources << >>';\nconst WIDGET = '/Type /Annot /Subtype /Widget /Rect [20 20 120 40]';\nconst LOOK =\n '<< /Type /XObject /Subtype /Form /BBox [0 0 100 20] /Length 26 >>\\nstream\\n0 0 1 rg 0 0 100 20 re f\\nendstream';\n\nexport interface WidgetFindingCase {\n /** What the file does. */\n readonly does: string;\n readonly pdf: Uint8Array;\n /** The page whose `/Annots` holds the widget, or `null` when no page shows it. */\n readonly page: number | null;\n /** The name of the field the form reads the widget into, or `null` for a widget in no field. */\n readonly field: string | null;\n}\n\n/** The cases, by name. Object 3 is the first page in each. */\nexport const WIDGET_FINDING_CASES = {\n 'annots-only': {\n does: \"a merged field/widget in a page's /Annots that the field tree doesn't list\",\n pdf: pdfOf([\n `<< /Type /Catalog /Pages 2 0 R /AcroForm << /Fields [] /DA (/Helv 0 Tf 0 g) ${FONT_RESOURCES} >> >>`,\n '<< /Type /Pages /Kids [3 0 R] /Count 1 >>',\n `<< ${PAGE} /Annots [4 0 R] >>`,\n `<< ${WIDGET} /FT /Tx /T (orphan) /V (hi) /P 3 0 R /AP << /N 5 0 R >> >>`,\n LOOK,\n ]),\n page: 3,\n field: 'orphan',\n },\n inline: {\n does: \"a widget written straight into a page's /Annots, as no object of its own\",\n pdf: pdfOf([\n `<< /Type /Catalog /Pages 2 0 R /AcroForm << /Fields [] /DA (/Helv 0 Tf 0 g) ${FONT_RESOURCES} >> >>`,\n '<< /Type /Pages /Kids [3 0 R] /Count 1 >>',\n `<< ${PAGE} /Annots [<< ${WIDGET} /FT /Tx /T (inline) /AP << /N 4 0 R >> >>] >>`,\n LOOK,\n ]),\n page: 3,\n field: null,\n },\n 'no-acroform': {\n does: 'a field widget in a file that has no /AcroForm at all',\n pdf: pdfOf([\n '<< /Type /Catalog /Pages 2 0 R >>',\n '<< /Type /Pages /Kids [3 0 R] /Count 1 >>',\n `<< ${PAGE} /Annots [4 0 R] >>`,\n `<< ${WIDGET} /FT /Tx /T (lonely) /P 3 0 R /AP << /N 5 0 R >> >>`,\n LOOK,\n ]),\n page: 3,\n field: 'lonely',\n },\n 'stale-p': {\n does: \"a widget in the second page's /Annots whose /P names the first page\",\n pdf: pdfOf([\n `<< /Type /Catalog /Pages 2 0 R /AcroForm << /Fields [5 0 R] /DA (/Helv 0 Tf 0 g) ${FONT_RESOURCES} >> >>`,\n '<< /Type /Pages /Kids [3 0 R 4 0 R] /Count 2 >>',\n `<< ${PAGE} >>`,\n `<< ${PAGE} /Annots [5 0 R] >>`,\n `<< ${WIDGET} /FT /Tx /T (moved) /P 3 0 R /AP << /N 6 0 R >> >>`,\n LOOK,\n ]),\n page: 4,\n field: 'moved',\n },\n 'deleted-page': {\n does: 'a field whose widget was on a page the document no longer has',\n pdf: pdfOf([\n `<< /Type /Catalog /Pages 2 0 R /AcroForm << /Fields [4 0 R] /DA (/Helv 0 Tf 0 g) ${FONT_RESOURCES} >> >>`,\n '<< /Type /Pages /Kids [3 0 R] /Count 1 >>',\n `<< ${PAGE} >>`,\n '<< /FT /Tx /T (gone) /Kids [5 0 R] >>',\n `<< ${WIDGET} /Parent 4 0 R /P 6 0 R /AP << /N 7 0 R >> >>`,\n `<< ${PAGE} /Annots [5 0 R] >>`,\n LOOK,\n ]),\n page: null,\n field: 'gone',\n },\n 'no-field-type': {\n does: 'a widget with no field type anywhere on its /Parent chain',\n pdf: pdfOf([\n `<< /Type /Catalog /Pages 2 0 R /AcroForm << /Fields [] /DA (/Helv 0 Tf 0 g) ${FONT_RESOURCES} >> >>`,\n '<< /Type /Pages /Kids [3 0 R] /Count 1 >>',\n `<< ${PAGE} /Annots [4 0 R] >>`,\n `<< ${WIDGET} /P 3 0 R /AP << /N 5 0 R >> >>`,\n LOOK,\n ]),\n page: 3,\n field: null,\n },\n} as const satisfies Record<string, WidgetFindingCase>;\n\nexport type WidgetFindingCaseName = keyof typeof WIDGET_FINDING_CASES;\n\nexport interface WidgetFindingConformanceOptions {\n label: string;\n makeEngine: () => Promise<Engine> | Engine;\n /** Open `pdf` with every right, as a document of its own. */\n open: (engine: Engine, pdf: Uint8Array, name: WidgetFindingCaseName) => Promise<DocumentHandle>;\n}\n\nexport function runWidgetFindingConformance(\n runner: ConformanceTestRunner,\n opts: WidgetFindingConformanceOptions,\n): void {\n const { describe, test, beforeAll, afterAll, expect } = runner;\n\n describe(`widget finding conformance: ${opts.label}`, () => {\n let engine: Engine;\n\n beforeAll(async () => {\n engine = await opts.makeEngine();\n });\n\n afterAll(async () => {\n if (engine) await engine.destroy();\n });\n\n for (const [name, found] of Object.entries(WIDGET_FINDING_CASES) as [\n WidgetFindingCaseName,\n WidgetFindingCase,\n ][]) {\n test(`${name}: ${found.does}`, async () => {\n const doc = await opts.open(engine, found.pdf.slice(), name);\n try {\n const { pages } = await doc.pages.list();\n const form = await doc.forms.list();\n const rows = form.widgets;\n\n // The form read: one row, on the page whose /Annots holds it.\n if (found.page === null) {\n expect(rows).toEqual([]);\n } else {\n expect(rows.map((row) => row.page.objectNumber)).toEqual([found.page]);\n }\n const field =\n found.field === null ? undefined : form.fields.find((f) => f.name === found.field);\n if (found.field !== null) {\n expect(field?.name).toBe(found.field);\n expect(field?.widgets.map((w) => w.page?.objectNumber ?? null)).toEqual([found.page]);\n }\n for (const row of rows) {\n expect(row.field === null).toBe(found.field === null);\n }\n\n // The annotation read never holds a widget, on any page.\n for (const { ref } of pages) {\n const { annotations } = await doc.page(ref).annotations.list();\n expect(annotations.some((annotation) => annotation.subtype === 'widget')).toBe(false);\n }\n\n // The pictures: the widget's appearance is the form's, on its page, and only there.\n const shown = (page: PageRef) => doc.page(page).forms.renderAppearances();\n for (const { ref } of pages) {\n const forms = (await shown(ref)).appearances.map((a) => annotationKey(a.ref));\n const annotations = (await doc.page(ref).annotations.renderAppearances()).appearances;\n expect(annotations).toEqual([]);\n const here = ref.objectNumber === found.page;\n expect(forms).toEqual(here ? rows.map((row) => annotationKey(row.ref)) : []);\n }\n if (found.page !== null) {\n expect(pages.some((page) => page.ref.objectNumber === found.page)).toBe(true);\n expect(toPageRef(found.page)).toEqual(rows[0]!.page);\n }\n } finally {\n await doc.close();\n }\n });\n }\n });\n}\n","import type { ConformanceFixture, ConformanceTestRunner } from './runMetadataConformance';\nimport type { LocalDocumentHandle } from '../engine/LocalDocumentHandle';\nimport type { LocalEngine } from '../engine/LocalEngine';\nimport { toPageRef } from '../identity/PageRef';\nimport { EVERY_PERMISSION } from './fixtureScope';\n\nconst APP = 'EMBD_ConformanceTest';\nconst SIBLING_APP = 'EMBD_ConformanceSibling';\n\nexport interface PieceInfoConformanceOptions {\n label: string;\n /** Build a fresh local engine for this suite. The suite tears it down at the end. */\n makeEngine: () => Promise<LocalEngine> | LocalEngine;\n fixture: ConformanceFixture;\n}\n\n/**\n * `/PieceInfo` conformance (doc + page level), on the local engine: the\n * only one with `/PieceInfo`.\n *\n * Invariants:\n * 1. The full value vocabulary round-trips at both levels: string,\n * number, boolean, name, string-array — read back with the same tags.\n * 2. Writes persist: download() → re-open → identical read.\n * 3. `null` deletes a key; sibling keys and sibling applications\n * survive both key deletes and whole-entry clears.\n * 4. An absent application reads as `null`; `applications()` enumerates\n * what is present; every write refreshes `modifiedAt`.\n */\nexport function runPieceInfoConformance(\n runner: ConformanceTestRunner,\n opts: PieceInfoConformanceOptions,\n): void {\n const { describe, test, beforeAll, afterAll, expect } = runner;\n\n describe(`pieceInfo conformance: ${opts.label}`, () => {\n let engine: LocalEngine;\n\n beforeAll(async () => {\n engine = await opts.makeEngine();\n });\n\n afterAll(async () => {\n if (engine) await engine.destroy();\n });\n\n test('doc-level: the full value vocabulary round-trips with tags intact', async () => {\n const doc = await openFixture(engine, opts);\n try {\n await doc.pieceInfo.update(APP, {\n name: 'Standard Stamps',\n schema: 1,\n shared: true,\n kind: { name: 'StampLibrary' },\n tags: ['legal', 'finance'],\n });\n const snap = await doc.pieceInfo.get(APP);\n expect(snap).toBeTruthy();\n expect(snap!.entries).toEqual({\n name: { type: 'string', value: 'Standard Stamps' },\n schema: { type: 'number', value: 1 },\n shared: { type: 'boolean', value: true },\n kind: { type: 'name', value: 'StampLibrary' },\n tags: { type: 'string-array', value: ['legal', 'finance'] },\n });\n expect(typeof snap!.modifiedAt).toBe('string');\n } finally {\n await doc.close();\n }\n });\n\n test('page-level: the stamp schema round-trips on a page', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const list = await doc.pages.list();\n const page = doc.page(list.pages[0].ref);\n await page.pieceInfo.update(APP, { name: 'Witness', subject: 'Getuige' });\n const snap = await page.pieceInfo.get(APP);\n expect(snap!.entries).toEqual({\n name: { type: 'string', value: 'Witness' },\n subject: { type: 'string', value: 'Getuige' },\n });\n // The doc-level holder is a different dictionary: untouched.\n expect(await doc.pieceInfo.get(APP)).toBe(null);\n } finally {\n await doc.close();\n }\n });\n\n test('writes persist through save → re-open', async () => {\n const doc = await openFixture(engine, opts);\n let reopened: LocalDocumentHandle | null = null;\n try {\n const list = await doc.pages.list();\n const pageObjectNumber = list.pages[0].ref.objectNumber;\n await doc.pieceInfo.update(APP, { name: 'Standard Stamps' });\n await doc\n .page(toPageRef(pageObjectNumber))\n .pieceInfo.update(APP, { name: 'Witness', subject: 'Getuige' });\n const bytes = await doc.download();\n\n reopened = await engine.open(\n { kind: 'bytes', id: `${opts.fixture.id}-pi-reopen`, bytes },\n EVERY_PERMISSION,\n );\n const relist = await reopened.pages.list();\n const docSnap = await reopened.pieceInfo.get(APP);\n expect(docSnap!.entries.name).toEqual({ type: 'string', value: 'Standard Stamps' });\n const pageSnap = await reopened.page(relist.pages[0].ref).pieceInfo.get(APP);\n expect(pageSnap!.entries.subject).toEqual({ type: 'string', value: 'Getuige' });\n } finally {\n if (reopened) await reopened.close();\n await doc.close();\n }\n });\n\n test('null deletes a key; clear removes an entry; siblings survive', async () => {\n const doc = await openFixture(engine, opts);\n try {\n await doc.pieceInfo.update(APP, { name: 'A', keep: 'B' });\n await doc.pieceInfo.update(SIBLING_APP, { other: 'C' });\n\n await doc.pieceInfo.update(APP, { name: null });\n const afterDelete = await doc.pieceInfo.get(APP);\n expect(Object.keys(afterDelete!.entries)).toEqual(['keep']);\n\n const apps = await doc.pieceInfo.list();\n expect(apps.includes(APP)).toBe(true);\n expect(apps.includes(SIBLING_APP)).toBe(true);\n\n await doc.pieceInfo.delete(APP);\n expect(await doc.pieceInfo.get(APP)).toBe(null);\n // The sibling application is untouched by the clear.\n const sibling = await doc.pieceInfo.get(SIBLING_APP);\n expect(sibling!.entries.other).toEqual({ type: 'string', value: 'C' });\n } finally {\n await doc.close();\n }\n });\n\n test('an application that was never written reads as null', async () => {\n const doc = await openFixture(engine, opts);\n try {\n expect(await doc.pieceInfo.get('EMBD_NeverWritten')).toBe(null);\n const list = await doc.pages.list();\n expect(await doc.page(list.pages[0].ref).pieceInfo.get('EMBD_NeverWritten')).toBe(null);\n } finally {\n await doc.close();\n }\n });\n });\n}\n\nasync function openFixture(\n engine: LocalEngine,\n opts: PieceInfoConformanceOptions,\n): Promise<LocalDocumentHandle> {\n const bytes = await opts.fixture.bytes();\n return engine.open({ kind: 'bytes', id: opts.fixture.id, bytes }, EVERY_PERMISSION);\n}\n","import type { ConformanceTestRunner, ConformanceOptions } from './runMetadataConformance';\nimport type { HighlightDraft } from '../annotation/kinds';\nimport type { DocumentHandle } from '../engine/DocumentHandle';\nimport type { Engine } from '../engine/Engine';\nimport type { DocumentEvent } from '../events/DocumentEvent';\nimport { toPageRef } from '../identity/PageRef';\nimport { EVERY_PERMISSION } from './fixtureScope';\n\nconst QUAD: HighlightDraft['quadPoints'] = [\n {\n upperLeft: { x: 50, y: 100 },\n upperRight: { x: 150, y: 100 },\n lowerLeft: { x: 50, y: 80 },\n lowerRight: { x: 150, y: 80 },\n },\n];\n\n/**\n * Document event stream conformance suite. Verifies the invariants the\n * collaboration design rests on — do not loosen these without re-reading\n * `DocumentEvent`:\n *\n * 1. Exactly once: every confirmed mutation produces exactly one event,\n * in mutation order, regardless of engine (local worker or cloud HTTP).\n * 2. Ground truth: a failed mutation publishes nothing; events fire only\n * after confirmation.\n * 3. Results ride verbatim: each event embeds the result the caller\n * received, deep-equal field for field.\n * 4. Provenance: own mutations are `origin.kind: 'local'` with the\n * handle's one `sessionId`.\n * 5. Unsubscribe stops delivery; `on(type)` hears only its type.\n * 6. Published before settlement: the event for a session's own mutation\n * reaches subscribers before the mutation's promise settles, so a\n * caller that awaits the mutation already sees state derived from it.\n *\n * Both local (worker host + WASM) and cloud (HTTP + @cloudpdf/server)\n * implementations must pass identically.\n */\nexport function runDocumentEventsConformance(\n runner: ConformanceTestRunner,\n opts: ConformanceOptions,\n): void {\n const { describe, test, beforeAll, afterAll, expect } = runner;\n\n describe(`document events conformance: ${opts.label}`, () => {\n let engine: Engine;\n\n beforeAll(async () => {\n engine = await opts.makeEngine();\n });\n\n afterAll(async () => {\n if (engine) await engine.destroy();\n });\n\n test('every confirmed mutation publishes exactly one event, results verbatim', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const events: DocumentEvent[] = [];\n doc.events.subscribe((event) => events.push(event));\n\n const list = await doc.pages.list();\n if (list.pages.length < 3) return;\n const pageObjectNumber = list.pages[0].ref.objectNumber;\n const page = doc.page(toPageRef(pageObjectNumber));\n\n const draft: HighlightDraft = {\n subtype: 'highlight',\n contents: 'events conformance',\n quadPoints: QUAD,\n };\n const created = await page.annotations.create(draft);\n const updated = await page.annotations.update(created.annotation.ref, {\n subtype: 'highlight',\n contents: 'updated',\n });\n const rotated = await doc.pages.rotate([toPageRef(pageObjectNumber)], 90);\n const victim = list.pages[2].ref.objectNumber;\n const deleted = await doc.pages.delete([toPageRef(victim)]);\n const meta = await doc.metadata.update({ title: 'events conformance' });\n const custom = await doc.metadata.custom.update({ EventsConformance: 'yes' });\n\n expect(events.map((event) => event.type)).toEqual([\n 'annotations.created',\n 'annotations.updated',\n 'pages.rotated',\n 'pages.deleted',\n 'metadata.updated',\n 'metadata.customUpdated',\n ]);\n\n // The embedded results are the returned results, field for field.\n const [evCreated, evUpdated, evRotated, evDeleted, evMeta, evCustom] = events;\n if (evCreated.type === 'annotations.created') {\n expect(evCreated.page).toEqual(toPageRef(pageObjectNumber));\n expect(evCreated.annotation).toEqual(created.annotation);\n expect(evCreated.meta).toEqual(created.meta);\n }\n if (evUpdated.type === 'annotations.updated') {\n expect(evUpdated.annotation).toEqual(updated.annotation);\n }\n if (evRotated.type === 'pages.rotated') {\n expect(evRotated.pages).toEqual([toPageRef(pageObjectNumber)]);\n expect(evRotated.rotation).toBe(90);\n expect(evRotated.layout).toEqual(rotated.layout);\n expect(evRotated.meta).toEqual(rotated.meta);\n }\n if (evDeleted.type === 'pages.deleted') {\n expect(evDeleted.pages).toEqual([toPageRef(victim)]);\n expect(evDeleted.layout).toEqual(deleted.layout);\n }\n if (evMeta.type === 'metadata.updated') {\n expect(evMeta.metadata).toEqual(meta.metadata);\n }\n if (evCustom.type === 'metadata.customUpdated') {\n expect(evCustom.custom).toEqual(custom.custom);\n expect(evCustom.meta).toEqual(custom.meta);\n }\n\n // Provenance: own mutations, one handle. Every event in\n // this suite is a mutation event — transport notices\n // (`stream.desynced`) never fire from local mutations, so a\n // missing origin here is a real failure, asserted explicitly.\n const first = events[0];\n expect(first !== undefined && 'origin' in first).toBe(true);\n if (first === undefined || !('origin' in first)) return;\n for (const event of events) {\n expect('origin' in event).toBe(true);\n if (!('origin' in event)) continue;\n expect(event.origin.kind).toBe('local');\n expect(typeof event.origin.sessionId).toBe('string');\n expect(event.origin.sessionId.length > 0).toBe(true);\n expect(event.origin.sessionId).toBe(first.origin.sessionId);\n expect(typeof event.origin.ts).toBe('number');\n }\n } finally {\n await doc.close();\n }\n });\n\n test('pages.inserted rides verbatim', async () => {\n const doc = await openFixture(engine, opts);\n try {\n // insertBlank needs no source bytes, so it is the fixture-free way\n // to exercise the event.\n const events: DocumentEvent[] = [];\n doc.events.subscribe((event) => events.push(event));\n\n const inserted = await doc.pages.insertBlank(\n { size: { width: 396, height: 612 } },\n 'start',\n );\n\n expect(events.map((event) => event.type)).toEqual(['pages.inserted']);\n const [evInserted] = events;\n if (evInserted.type === 'pages.inserted') {\n expect(evInserted.insertedPages).toEqual(inserted.insertedPages);\n expect(evInserted.layout).toEqual(inserted.layout);\n expect(evInserted.meta).toEqual(inserted.meta);\n expect(evInserted.origin.kind).toBe('local');\n }\n } finally {\n await doc.close();\n }\n });\n\n test('a FAILED mutation publishes nothing (events are ground truth)', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const events: DocumentEvent[] = [];\n doc.events.subscribe((event) => events.push(event));\n const list = await doc.pages.list();\n let caught: unknown;\n try {\n // Deleting every page is rejected — see PageDeleteInput.\n await doc.pages.delete(list.pages.map((p) => p.ref));\n } catch (err) {\n caught = err;\n }\n expect(caught !== undefined).toBe(true);\n expect(events.length).toBe(0);\n } finally {\n await doc.close();\n }\n });\n\n test('own mutations are published before their promise settles', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const events: DocumentEvent[] = [];\n doc.events.subscribe((event) => events.push(event));\n const seenAtSettlement: number[] = [];\n await doc.metadata\n .update({ title: 'published before settlement' })\n .then(() => seenAtSettlement.push(events.length));\n const list = await doc.pages.list();\n await doc\n .page(list.pages[0].ref)\n .annotations.create({ subtype: 'highlight', contents: 'ordering', quadPoints: QUAD })\n .then(() => seenAtSettlement.push(events.length));\n expect(seenAtSettlement).toEqual([1, 2]);\n } finally {\n await doc.close();\n }\n });\n\n test('on(type) hears only that type, typed by it; its unsubscriber stops it', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const rotated: number[] = [];\n const stop = doc.events.on('pages.rotated', (event) => rotated.push(event.rotation));\n const list = await doc.pages.list();\n await doc.metadata.update({ title: 'on(type)' });\n await doc.pages.rotate([list.pages[0].ref], 90);\n expect(rotated).toEqual([90]);\n stop();\n await doc.pages.rotate([list.pages[0].ref], 180);\n expect(rotated).toEqual([90]);\n } finally {\n await doc.close();\n }\n });\n\n test('unsubscribe stops delivery', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const events: DocumentEvent[] = [];\n const unsubscribe = doc.events.subscribe((event) => events.push(event));\n unsubscribe();\n const list = await doc.pages.list();\n await doc.pages.rotate([list.pages[0].ref], 180);\n expect(events.length).toBe(0);\n } finally {\n await doc.close();\n }\n });\n });\n}\n\nasync function openFixture(engine: Engine, opts: ConformanceOptions): Promise<DocumentHandle> {\n if (opts.openKind === 'bytes') {\n const bytes = await opts.fixture.bytes();\n return engine.open({ kind: 'bytes', id: opts.fixture.id, bytes }, EVERY_PERMISSION);\n }\n return engine.open({ kind: 'id', id: opts.fixture.cloudId ?? opts.fixture.id });\n}\n","import type {\n ConformanceTestRunner,\n ConformanceFixture,\n ConformanceOptions,\n} from './runMetadataConformance';\nimport type { PageTextSnapshot } from '../dto/PageTextSnapshot';\nimport type { Engine } from '../engine/Engine';\nimport { EngineError } from '../errors/EngineError';\nimport { EngineErrorCode } from '../errors/EngineErrorCode';\nimport { toPageRef } from '../identity/PageRef';\nimport { AbortError } from '../promise/AbortError';\nimport { PageTextSnapshotSchema } from '../wire/schemas';\nimport { EVERY_PERMISSION } from './fixtureScope';\n\n/**\n * Per-fixture expectations for the text-extraction harness. Concrete\n * suites supply the page identity + a substring the harness asserts\n * exists in the extracted text. The harness deliberately avoids\n * locking the exact string so different fixtures (or PDFium upgrades\n * that change whitespace handling) don't require harness edits.\n */\nexport interface PageTextConformanceFixture extends ConformanceFixture {\n /** PDF indirect object number of the page used by the text tests. */\n pageObjectNumber: number;\n /**\n * Substring guaranteed to appear in the extracted text. The harness\n * uses `.includes(needle)`; suites should pick something distinctive\n * but not whitespace-sensitive.\n */\n expectedSubstring: string;\n /** Minimum char count the harness expects (sanity floor). */\n minCharCount: number;\n}\n\nexport interface PageTextConformanceOptions extends Omit<ConformanceOptions, 'fixture'> {\n fixture: PageTextConformanceFixture;\n}\n\nexport function runPageTextConformance(\n runner: ConformanceTestRunner,\n opts: PageTextConformanceOptions,\n): void {\n const { describe, test, beforeAll, afterAll, expect } = runner;\n\n describe(`page text conformance: ${opts.label}`, () => {\n let engine: Engine;\n\n beforeAll(async () => {\n engine = await opts.makeEngine();\n });\n\n afterAll(async () => {\n if (engine) await engine.destroy();\n });\n\n test('read() returns a PageTextSnapshot with non-empty text', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const page = doc.page(toPageRef(opts.fixture.pageObjectNumber));\n const snap = await page.text.get();\n expect(PageTextSnapshotSchema.safeParse(snap).success).toBe(true);\n expect(snap.charCount >= opts.fixture.minCharCount).toBe(true);\n expect(snap.text.length > 0).toBe(true);\n } finally {\n await doc.close();\n }\n });\n\n test('extracted text contains the expected substring', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const page = doc.page(toPageRef(opts.fixture.pageObjectNumber));\n const snap = await page.text.get();\n expect(snap.text.includes(opts.fixture.expectedSubstring)).toBe(true);\n } finally {\n await doc.close();\n }\n });\n\n test('read() on an unknown pageObjectNumber throws NotFound', async () => {\n const doc = await openFixture(engine, opts);\n try {\n let caught: unknown;\n try {\n const ghost = doc.page(toPageRef(999_999_999));\n await ghost.text.get();\n } catch (err) {\n caught = err;\n }\n expect(caught).toBeTruthy();\n expect(EngineError.is(caught, EngineErrorCode.NotFound)).toBe(true);\n } finally {\n await doc.close();\n }\n });\n\n test('abort() on read rejects with AbortError', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const page = doc.page(toPageRef(opts.fixture.pageObjectNumber));\n const p = page.text.get();\n p.abort('test');\n await expect(p).rejects.toBeInstanceOf(AbortError);\n } finally {\n await doc.close();\n }\n });\n\n test('read after close throws DocNotOpen', async () => {\n const doc = await openFixture(engine, opts);\n const page = doc.page(toPageRef(opts.fixture.pageObjectNumber));\n await doc.close();\n let caught: unknown;\n try {\n await page.text.get();\n } catch (err) {\n caught = err;\n }\n expect(caught).toBeTruthy();\n expect(EngineError.is(caught, EngineErrorCode.DocNotOpen)).toBe(true);\n });\n });\n}\n\nasync function openFixture(engine: Engine, opts: PageTextConformanceOptions) {\n if (opts.openKind === 'bytes') {\n const bytes = await opts.fixture.bytes();\n return engine.open({ kind: 'bytes', id: opts.fixture.id, bytes }, EVERY_PERMISSION);\n }\n return engine.open({ kind: 'id', id: opts.fixture.cloudId ?? opts.fixture.id });\n}\n\nexport type { PageTextSnapshot };\n","import type {\n ConformanceTestRunner,\n ConformanceFixture,\n ConformanceOptions,\n} from './runMetadataConformance';\nimport type { CharMapAnchor } from '../text/charmap';\nimport type { Engine } from '../engine/Engine';\nimport { toPageRef } from '../identity/PageRef';\nimport { PageTextSnapshotSchema } from '../wire/schemas';\nimport { EVERY_PERMISSION } from './fixtureScope';\n\n/**\n * Index-space divergence conformance: the cases where a page's character\n * space (what geometry tiles and selection/search ranges address) and its\n * extracted text differ — and the `charMap` contract that bridges them.\n *\n * Fixtures pin exact values (text, charCount, anchors) verified against the\n * wasm runtime, so both engines must produce byte-identical snapshots:\n *\n * - a non-printing character occupying a character slot with no text unit\n * (`bug_1139.pdf` — every text offset shifts by one);\n * - `/ActualText` replacement (`bug_384770169.pdf` — synthetic `kPiece`\n * characters in lockstep with the text, identity map, real segments);\n * - supplementary-plane text via a ToUnicode surrogate pair\n * (`embedpdf_astral_tounicode.pdf` — two lockstep surrogate entries,\n * identity map, astral content survives extraction).\n *\n * The search probe closes the loop: a hit's `start`/`count` must be\n * character-space (segments join geometry), and slicing the snapshot by the\n * hit's range must reproduce the matched text exactly — the law that makes\n * select-this-match and copy compose.\n */\nexport interface TextDivergenceConformanceFixture extends ConformanceFixture {\n /** PDF indirect object number of the probed page. */\n pageObjectNumber: number;\n /** The exact extracted text (UTF-16 faithful). */\n exactText: string;\n /** The character-space size (may differ from `exactText.length`). */\n expectedCharCount: number;\n /** Expected anchors; null asserts identity (no `charMap` on the wire). */\n expectedCharMap: ReadonlyArray<CharMapAnchor> | null;\n /** Char-space slice expectations (half-open). */\n slices?: ReadonlyArray<{ start: number; count: number; text: string }>;\n /** Literal search probe with expected character-space hit range. */\n search?: { query: string; start: number; count: number; matchedText: string };\n}\n\nexport interface TextDivergenceConformanceOptions extends Omit<ConformanceOptions, 'fixture'> {\n fixture: TextDivergenceConformanceFixture;\n}\n\nexport function runTextDivergenceConformance(\n runner: ConformanceTestRunner,\n opts: TextDivergenceConformanceOptions,\n): void {\n const { describe, test, beforeAll, afterAll, expect } = runner;\n const fixture = opts.fixture;\n\n describe(`text divergence conformance: ${opts.label} [${fixture.id}]`, () => {\n let engine: Engine;\n\n beforeAll(async () => {\n engine = await opts.makeEngine();\n });\n\n afterAll(async () => {\n if (engine) await engine.destroy();\n });\n\n test('snapshot is schema-valid with the exact text, charCount, and charMap', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const snap = await doc.page(toPageRef(fixture.pageObjectNumber)).text.get();\n // Schema-parse enforces every charMap invariant (the {0,2} step\n // rule, tail === text.length, identity ⇔ absent).\n expect(PageTextSnapshotSchema.safeParse(snap).success).toBe(true);\n expect(snap.text).toBe(fixture.exactText);\n expect(snap.charCount).toBe(fixture.expectedCharCount);\n const anchors = snap.charMap ?? null;\n if (fixture.expectedCharMap === null) {\n expect(anchors === null || anchors.length === 0).toBe(true);\n } else {\n expect(anchors === null ? null : anchors.map((a) => [a[0], a[1]])).toEqual(\n fixture.expectedCharMap.map((a) => [a[0], a[1]]),\n );\n }\n } finally {\n await doc.close();\n }\n });\n\n test('char-space slicing round-trips through the map', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const page = doc.page(toPageRef(fixture.pageObjectNumber));\n const snap = await page.text.get();\n expect(await page.text.slice({ start: 0, count: snap.charCount })).toBe(snap.text);\n for (const s of fixture.slices ?? []) {\n expect(await page.text.slice(s)).toBe(s.text);\n }\n } finally {\n await doc.close();\n }\n });\n\n if (fixture.search) {\n const probe = fixture.search;\n test('search hits address character space and join the text by slicing', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const slice = await doc.search.query({ text: probe.query });\n const hit = slice.matches.find((m) => m.page.objectNumber === fixture.pageObjectNumber);\n expect(hit === undefined).toBe(false);\n expect(hit!.start).toBe(probe.start);\n expect(hit!.count).toBe(probe.count);\n // Geometry join: character-space segmentation produced real quads.\n expect(hit!.segments.length > 0).toBe(true);\n // The composition law: slicing the page by the hit's range\n // reproduces the matched text (zero-width chars excluded).\n expect(await doc.page(hit!.page).text.slice(hit!)).toBe(probe.matchedText);\n } finally {\n await doc.close();\n }\n });\n }\n });\n}\n\nasync function openFixture(engine: Engine, opts: TextDivergenceConformanceOptions) {\n if (opts.openKind === 'bytes') {\n const bytes = await opts.fixture.bytes();\n return engine.open({ kind: 'bytes', id: opts.fixture.id, bytes }, EVERY_PERMISSION);\n }\n return engine.open({ kind: 'id', id: opts.fixture.cloudId ?? opts.fixture.id });\n}\n\n/** One divergence case, minus the per-suite bytes/id wiring. */\nexport type TextDivergenceCase = Omit<\n TextDivergenceConformanceFixture,\n 'id' | 'bytes' | 'expected'\n> & {\n /** Fixture file name under the fork's `testing/resources/`. */\n resource: string;\n};\n\n/**\n * The pinned divergence cases — one table, consumed by both engines' suites\n * so expected values cannot drift. Values verified against the wasm runtime\n * (see each case). All fixtures are single-page; the page's indirect object\n * number is 3 in each.\n */\nexport const TEXT_DIVERGENCE_CASES: Readonly<Record<string, TextDivergenceCase>> = {\n /** Leading non-printing character: 31 character slots, 30 text units —\n * every text offset shifts by one, encoded by the single anchor [1, 0].\n * The searchex embeddertest for this fixture pins the same +1 shift. */\n bug1139: {\n resource: 'bug_1139.pdf',\n pageObjectNumber: 3,\n exactText: 'Hello, world!\\r\\nGoodbye, world!',\n expectedCharCount: 31,\n expectedCharMap: [[1, 0]],\n slices: [\n { start: 0, count: 1, text: '' }, // the non-printing char alone projects to nothing\n { start: 1, count: 6, text: 'Hello,' },\n { start: 16, count: 7, text: 'Goodbye' },\n ],\n search: { query: 'Goodbye', start: 16, count: 7, matchedText: 'Goodbye' },\n },\n /** `/ActualText` replacement: the span's real glyphs are replaced by one\n * synthetic kPiece character per ActualText character, lockstep with the\n * text (identity map), with synthesized evenly-divided boxes — so search\n * segments exist and extraction yields the ActualText, not the glyphs. */\n actualText: {\n resource: 'bug_384770169.pdf',\n pageObjectNumber: 3,\n exactText: 'What is my favorite food?',\n expectedCharCount: 25,\n expectedCharMap: null,\n slices: [{ start: 11, count: 8, text: 'favorite' }],\n search: { query: 'favorite', start: 11, count: 8, matchedText: 'favorite' },\n },\n /** Supplementary-plane text via a ToUnicode surrogate pair: PDFium stores\n * one character-list entry per surrogate half in lockstep with the text\n * (identity map, no divergence in this representation) — and the emoji\n * survives extraction end to end. The combined-astral representation\n * (font-cmap path, one entry per code point → a [+2] anchor) is covered\n * by the charmap unit tests and the reader's divergent walk. */\n astralToUnicode: {\n resource: 'embedpdf_astral_tounicode.pdf',\n pageObjectNumber: 3,\n exactText: '😀B!',\n expectedCharCount: 4,\n expectedCharMap: null,\n slices: [\n { start: 0, count: 2, text: '😀' },\n { start: 2, count: 1, text: 'B' },\n ],\n search: { query: 'B!', start: 2, count: 2, matchedText: 'B!' },\n },\n};\n","import type {\n ConformanceTestRunner,\n ConformanceFixture,\n ConformanceOptions,\n} from './runMetadataConformance';\nimport {\n isRotatedGeometryRun,\n type PageGeometrySnapshot,\n type RotatedGeometryRun,\n} from '../dto/PageGeometrySnapshot';\nimport type { Engine } from '../engine/Engine';\nimport { toPageRef } from '../identity/PageRef';\nimport { pageQuadBounds } from '../pageSpace/helpers';\nimport { PageGeometrySnapshotSchema } from '../wire/schemas';\nimport { EVERY_PERMISSION } from './fixtureScope';\n\n/** Absolute tolerance for coordinate assertions (points). */\nconst COORD_TOLERANCE = 1e-3;\n/** Tolerance for baseline-angle assertions (radians). */\n/** Degrees. */\nconst ROTATION_TOLERANCE = 0.06;\n\n/**\n * Per-fixture expectations for the oriented-text geometry harness. One\n * fixture per call, mirroring the other conformance suites; the fixture\n * declares what its dominant text orientation must read back as.\n */\nexport interface PageGeometryOrientationFixture extends ConformanceFixture {\n /** PDF indirect object number of the page under test. */\n pageObjectNumber: number;\n expectation:\n | {\n /** Every run is the upright variant; no glyph carries oriented cells. */\n kind: 'upright';\n }\n | {\n /** The page loads and every glyph is degenerate (zeroed + empty flag). */\n kind: 'empty-only';\n }\n | {\n kind: 'rotated';\n /** Turns (degrees clockwise) rotated runs may carry. */\n rotations: number[];\n ascentFlip: boolean;\n /**\n * Assert sheared cells: with `rotations` ≈ [0], a non-zero start-edge\n * x-offset proves the parallelogram (an AABB could not express it).\n */\n sheared?: boolean;\n /** Minimum number of rotated runs the page must produce (default 1). */\n minRotatedRuns?: number;\n };\n}\n\nexport interface PageGeometryOrientationOptions extends Omit<ConformanceOptions, 'fixture'> {\n fixture: PageGeometryOrientationFixture;\n}\n\nexport function runPageGeometryOrientationConformance(\n runner: ConformanceTestRunner,\n opts: PageGeometryOrientationOptions,\n): void {\n const { describe, test, beforeAll, afterAll, expect } = runner;\n\n describe(`page geometry orientation conformance: ${opts.label} [${opts.fixture.id}]`, () => {\n let engine: Engine;\n\n beforeAll(async () => {\n engine = await opts.makeEngine();\n });\n\n afterAll(async () => {\n if (engine) await engine.destroy();\n });\n\n const readSnapshot = async (): Promise<{\n snapshot: PageGeometrySnapshot;\n close: () => Promise<void>;\n }> => {\n const doc = await openFixture(engine, opts);\n const layout = await doc.page(toPageRef(opts.fixture.pageObjectNumber)).text.layout();\n return { snapshot: { runs: [...layout.runs] }, close: () => doc.close() };\n };\n\n test('snapshot round-trips the wire schema', async () => {\n const { snapshot, close } = await readSnapshot();\n try {\n const parsed = PageGeometrySnapshotSchema.safeParse(snapshot);\n expect(parsed.success).toBe(true);\n if (parsed.success) {\n // Strip-mode parsing must not lose anything the reader emitted —\n // a rotated run silently coerced to upright would fail this.\n expect(parsed.data).toEqual(snapshot);\n }\n } finally {\n await close();\n }\n });\n\n test('run starts tile the page character sequence', async () => {\n const { snapshot, close } = await readSnapshot();\n try {\n let next = 0;\n for (const run of snapshot.runs) {\n expect(run.start).toBe(next);\n next += run.glyphs.length;\n }\n } finally {\n await close();\n }\n });\n\n test('runs match the fixture orientation expectation', async () => {\n const { snapshot, close } = await readSnapshot();\n try {\n const expectation = opts.fixture.expectation;\n if (expectation.kind === 'upright') {\n for (const run of snapshot.runs) {\n expect(isRotatedGeometryRun(run)).toBe(false);\n if (isRotatedGeometryRun(run)) continue;\n for (const glyph of run.glyphs) {\n expect('width' in glyph.loose).toBe(true); // a box, not a quad\n if (glyph.empty) {\n // Degenerate glyphs keep the zeroed-box convention.\n expect(glyph.loose).toEqual({ x: 0, y: 0, width: 0, height: 0 });\n }\n }\n }\n return;\n }\n\n if (expectation.kind === 'empty-only') {\n for (const run of snapshot.runs) {\n expect(isRotatedGeometryRun(run)).toBe(false);\n if (isRotatedGeometryRun(run)) continue;\n for (const glyph of run.glyphs) {\n expect(glyph.empty).toBe(true);\n expect(glyph.loose).toEqual({ x: 0, y: 0, width: 0, height: 0 });\n }\n }\n return;\n }\n\n const rotatedRuns = snapshot.runs.filter(isRotatedGeometryRun);\n expect(rotatedRuns.length >= (expectation.minRotatedRuns ?? 1)).toBe(true);\n\n for (const run of rotatedRuns) {\n expect(\n expectation.rotations.some((rotation) =>\n rotationClose(run.rotation, rotation, ROTATION_TOLERANCE),\n ),\n ).toBe(true);\n expect(run.ascentFlip).toBe(expectation.ascentFlip);\n assertRotatedRunGeometry(run);\n }\n\n if (expectation.sheared) {\n const shearedGlyphs = rotatedRuns\n .flatMap((run) => run.glyphs)\n .filter(\n (glyph) =>\n !glyph.empty && Math.abs(glyph.loose.lowerLeft.x - glyph.loose.upperLeft.x) > 1,\n );\n expect(shearedGlyphs.length > 0).toBe(true);\n }\n } finally {\n await close();\n }\n });\n\n function assertRotatedRunGeometry(run: RotatedGeometryRun): void {\n for (const glyph of run.glyphs) {\n if (glyph.empty) {\n expect(glyph.loose).toEqual({\n upperLeft: { x: 0, y: 0 },\n upperRight: { x: 0, y: 0 },\n lowerLeft: { x: 0, y: 0 },\n lowerRight: { x: 0, y: 0 },\n });\n continue;\n }\n const q = glyph.loose;\n // The cell is a parallelogram: the upper edge runs like the lower one.\n expect(\n Math.abs(q.upperRight.x - q.upperLeft.x - (q.lowerRight.x - q.lowerLeft.x)) <=\n COORD_TOLERANCE,\n ).toBe(true);\n expect(\n Math.abs(q.upperRight.y - q.upperLeft.y - (q.lowerRight.y - q.lowerLeft.y)) <=\n COORD_TOLERANCE,\n ).toBe(true);\n // Contained in the run's page-space AABB.\n const bounds = pageQuadBounds(q);\n const { rect } = run;\n expect(bounds.x >= rect.x - COORD_TOLERANCE).toBe(true);\n expect(bounds.x + bounds.width <= rect.x + rect.width + COORD_TOLERANCE).toBe(true);\n expect(bounds.y >= rect.y - COORD_TOLERANCE).toBe(true);\n expect(bounds.y + bounds.height <= rect.y + rect.height + COORD_TOLERANCE).toBe(true);\n }\n }\n });\n}\n\nfunction rotationClose(a: number, b: number, tolerance: number): boolean {\n const delta = ((((a - b) % 360) + 540) % 360) - 180;\n return Math.abs(delta) <= tolerance;\n}\n\nasync function openFixture(engine: Engine, opts: PageGeometryOrientationOptions) {\n if (opts.openKind === 'bytes') {\n const bytes = await opts.fixture.bytes();\n return engine.open({ kind: 'bytes', id: opts.fixture.id, bytes }, EVERY_PERMISSION);\n }\n return engine.open({ kind: 'id', id: opts.fixture.cloudId ?? opts.fixture.id });\n}\n","import type {\n ConformanceTestRunner,\n ConformanceFixture,\n ConformanceOptions,\n} from './runMetadataConformance';\nimport type { Engine } from '../engine/Engine';\nimport { EngineError } from '../errors/EngineError';\nimport { EngineErrorCode } from '../errors/EngineErrorCode';\nimport { toPageRef } from '../identity/PageRef';\nimport { AbortError } from '../promise/AbortError';\nimport { foldText } from '../search/fold';\nimport type { SearchMatch, SearchSlice } from '../search/types';\nimport { SearchSliceSchema } from '../wire/schemas';\nimport { EVERY_PERMISSION } from './fixtureScope';\n\n/**\n * Per-fixture expectations for the search harness. Suites supply a\n * literal known to be on a specific page, one known to be nowhere, and a\n * regex with a predictable hit — the harness asserts behavior (offsets,\n * rects, snippets, cursor mechanics, dialect rejection), never exact\n * match counts, so PDFium text-extraction tweaks don't require edits.\n */\nexport interface SearchConformanceFixture extends ConformanceFixture {\n /** Literal present in the document at least once. */\n presentLiteral: string;\n /** A page (pon) guaranteed to carry a `presentLiteral` match. */\n presentPageObjectNumber: number;\n /** Literal guaranteed to match nowhere. */\n absentLiteral: string;\n /** Dialect-valid regex with at least one match in the document. */\n presentRegex: string;\n}\n\nexport interface SearchConformanceOptions extends Omit<ConformanceOptions, 'fixture'> {\n fixture: SearchConformanceFixture;\n}\n\nexport function runSearchConformance(\n runner: ConformanceTestRunner,\n opts: SearchConformanceOptions,\n): void {\n const { describe, test, beforeAll, afterAll, expect } = runner;\n const fixture = opts.fixture;\n\n /** Drive the cursor loop to exhaustion; assert each slice parses. */\n async function collectAll(\n doc: Awaited<ReturnType<Engine['open']>>,\n request: Parameters<typeof doc.search.query>[0],\n ): Promise<{ matches: SearchMatch[]; slices: SearchSlice[] }> {\n const matches: SearchMatch[] = [];\n const slices: SearchSlice[] = [];\n let cursor: string | undefined;\n for (;;) {\n const slice = await doc.search.query({ ...request, cursor });\n expect(SearchSliceSchema.safeParse(slice).success).toBe(true);\n matches.push(...slice.matches);\n slices.push(slice);\n if (slice.nextCursor === null) return { matches, slices };\n cursor = slice.nextCursor;\n }\n }\n\n describe(`search conformance: ${opts.label}`, () => {\n let engine: Engine;\n\n beforeAll(async () => {\n engine = await opts.makeEngine();\n });\n\n afterAll(async () => {\n if (engine) await engine.destroy();\n });\n\n test('finds the present literal with sane matches', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const { matches } = await collectAll(doc, {\n text: fixture.presentLiteral,\n });\n expect(matches.length > 0).toBe(true);\n expect(matches.some((m) => m.page.objectNumber === fixture.presentPageObjectNumber)).toBe(\n true,\n );\n for (const m of matches) {\n expect(m.count > 0).toBe(true);\n expect(m.segments.length > 0).toBe(true);\n for (const s of m.segments) {\n expect(s.rect.width > 0).toBe(true);\n expect(s.rect.height > 0).toBe(true);\n // The pair is one constructor's output — enforce it stayed that way.\n const xs = [\n s.quad.upperLeft.x,\n s.quad.upperRight.x,\n s.quad.lowerLeft.x,\n s.quad.lowerRight.x,\n ];\n const ys = [\n s.quad.upperLeft.y,\n s.quad.upperRight.y,\n s.quad.lowerLeft.y,\n s.quad.lowerRight.y,\n ];\n expect(Math.abs(s.rect.x - Math.min(...xs)) < 1e-3).toBe(true);\n expect(Math.abs(s.rect.x + s.rect.width - Math.max(...xs)) < 1e-3).toBe(true);\n expect(Math.abs(s.rect.y - Math.min(...ys)) < 1e-3).toBe(true);\n expect(Math.abs(s.rect.y + s.rect.height - Math.max(...ys)) < 1e-3).toBe(true);\n expect(s.advance === 1 || s.advance === -1).toBe(true);\n }\n }\n } finally {\n await doc.close();\n }\n });\n\n test('matching is case-insensitive by default', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const lower = await collectAll(doc, {\n text: fixture.presentLiteral.toLowerCase(),\n });\n const upper = await collectAll(doc, {\n text: fixture.presentLiteral.toUpperCase(),\n });\n expect(lower.matches.length).toBe(upper.matches.length);\n expect(lower.matches.length > 0).toBe(true);\n } finally {\n await doc.close();\n }\n });\n\n test('snippets carry the matched text; without them a match has none', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const withSnippets = await collectAll(doc, {\n text: fixture.presentLiteral,\n snippets: true,\n });\n for (const m of withSnippets.matches) {\n expect(!!m.snippet).toBe(true);\n const s = m.snippet!;\n const hit = s.match;\n // Fold both sides: the snippet keeps the page's original case\n // and (flattened) whitespace.\n expect(foldText(hit).folded).toBe(foldText(fixture.presentLiteral).folded);\n }\n const plain = await collectAll(doc, {\n text: fixture.presentLiteral,\n });\n expect(plain.matches.length).toBe(withSnippets.matches.length);\n for (const m of plain.matches) expect(m.snippet === undefined).toBe(true);\n } finally {\n await doc.close();\n }\n });\n\n test('the absent literal exhausts with zero matches', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const { matches, slices } = await collectAll(doc, {\n text: fixture.absentLiteral,\n });\n expect(matches.length).toBe(0);\n const last = slices[slices.length - 1];\n expect(last.nextCursor).toBe(null);\n expect(last.pageCount > 0).toBe(true);\n } finally {\n await doc.close();\n }\n });\n\n test('a one-page limit walks the whole document via the cursor', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const whole = await collectAll(doc, {\n text: fixture.presentLiteral,\n });\n const sliced = await collectAll(doc, {\n text: fixture.presentLiteral,\n limit: { pages: 1 },\n });\n expect(sliced.matches.length).toBe(whole.matches.length);\n const last = sliced.slices[sliced.slices.length - 1];\n expect(last.pagesSearched).toBe(last.pageCount);\n expect(sliced.slices.length).toBe(last.pageCount);\n } finally {\n await doc.close();\n }\n });\n\n test('from rotates the scan order (viewport-first)', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const slice = await doc.search.query({\n text: fixture.presentLiteral,\n from: toPageRef(fixture.presentPageObjectNumber),\n limit: { pages: 1 },\n });\n expect(slice.matches.length > 0).toBe(true);\n expect(slice.matches[0].page.objectNumber).toBe(fixture.presentPageObjectNumber);\n } finally {\n await doc.close();\n }\n });\n\n test('a cursor replayed against a different query is rejected', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const first = await doc.search.query({\n text: fixture.presentLiteral,\n limit: { pages: 1 },\n });\n expect(first.nextCursor !== null).toBe(true);\n let caught: unknown;\n try {\n await doc.search.query({\n text: fixture.absentLiteral,\n cursor: first.nextCursor!,\n });\n } catch (err) {\n caught = err;\n }\n expect(EngineError.is(caught, EngineErrorCode.InvalidArg)).toBe(true);\n } finally {\n await doc.close();\n }\n });\n\n test('a malformed cursor is rejected', async () => {\n const doc = await openFixture(engine, opts);\n try {\n let caught: unknown;\n try {\n await doc.search.query({\n text: fixture.presentLiteral,\n cursor: 'not a cursor',\n });\n } catch (err) {\n caught = err;\n }\n expect(EngineError.is(caught, EngineErrorCode.InvalidArg)).toBe(true);\n } finally {\n await doc.close();\n }\n });\n\n test('regex queries match with offsets and rects', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const { matches } = await collectAll(doc, {\n text: fixture.presentRegex,\n regex: true,\n });\n expect(matches.length > 0).toBe(true);\n for (const m of matches) {\n expect(m.count > 0).toBe(true);\n expect(m.segments.length > 0).toBe(true);\n }\n } finally {\n await doc.close();\n }\n });\n\n test('regex flags are restrictions: matchCase and wholeWord return subsets', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const all = await collectAll(doc, {\n text: fixture.presentRegex,\n regex: true,\n });\n const key = (m: SearchMatch) => `${m.page.objectNumber}:${m.start}:${m.count}`;\n const allKeys = new Set(all.matches.map(key));\n // Each flag can only remove matches, never invent them — true for\n // any fixture pattern, so the suite needs no per-fixture counts.\n for (const flags of [{ matchCase: true }, { wholeWord: true }]) {\n const restricted = await collectAll(doc, {\n text: fixture.presentRegex,\n regex: true,\n ...flags,\n });\n expect(restricted.matches.length <= all.matches.length).toBe(true);\n for (const m of restricted.matches) expect(allKeys.has(key(m))).toBe(true);\n }\n } finally {\n await doc.close();\n }\n });\n\n test('ignoreWhitespace keeps every default hit and finds the space-free needle', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const key = (m: SearchMatch) => `${m.page.objectNumber}:${m.start}:${m.count}`;\n const plain = await collectAll(doc, { text: fixture.presentLiteral });\n // Dropping whitespace can only add matches over the collapsing default\n // fold — every default hit survives, at the same place.\n const relaxed = await collectAll(doc, {\n text: fixture.presentLiteral,\n ignoreWhitespace: true,\n });\n const relaxedKeys = new Set(relaxed.matches.map(key));\n for (const m of plain.matches) expect(relaxedKeys.has(key(m))).toBe(true);\n // ...and the needle no longer needs the page's spaces.\n const squashed = await collectAll(doc, {\n text: fixture.presentLiteral.replace(/\\s+/g, ''),\n ignoreWhitespace: true,\n });\n expect(squashed.matches.map(key)).toEqual(relaxed.matches.map(key));\n } finally {\n await doc.close();\n }\n });\n\n test('regex + matchDiacritics / ignoreWhitespace are rejected with InvalidArg', async () => {\n const doc = await openFixture(engine, opts);\n try {\n for (const flags of [{ matchDiacritics: true }, { ignoreWhitespace: true }]) {\n let caught: unknown;\n try {\n await doc.search.query({\n text: fixture.presentRegex,\n regex: true,\n ...flags,\n });\n } catch (err) {\n caught = err;\n }\n expect(EngineError.is(caught, EngineErrorCode.InvalidArg)).toBe(true);\n }\n } finally {\n await doc.close();\n }\n });\n\n test('dialect violations are rejected with InvalidArg', async () => {\n const doc = await openFixture(engine, opts);\n try {\n for (const pattern of ['(a)\\\\1', '(?=x)y', '(']) {\n let caught: unknown;\n try {\n await doc.search.query({ text: pattern, regex: true });\n } catch (err) {\n caught = err;\n }\n expect(EngineError.is(caught, EngineErrorCode.InvalidArg)).toBe(true);\n }\n } finally {\n await doc.close();\n }\n });\n\n test('an empty needle returns an exhausted, empty slice', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const slice = await doc.search.query({ text: ' ' });\n expect(slice.matches.length).toBe(0);\n expect(slice.nextCursor).toBe(null);\n } finally {\n await doc.close();\n }\n });\n\n test('abort() on query rejects with AbortError', async () => {\n const doc = await openFixture(engine, opts);\n try {\n const p = doc.search.query({ text: fixture.presentLiteral });\n p.abort('test');\n await expect(p).rejects.toBeInstanceOf(AbortError);\n } finally {\n await doc.close();\n }\n });\n\n test('query after close throws DocNotOpen', async () => {\n const doc = await openFixture(engine, opts);\n await doc.close();\n let caught: unknown;\n try {\n await doc.search.query({ text: fixture.presentLiteral });\n } catch (err) {\n caught = err;\n }\n expect(EngineError.is(caught, EngineErrorCode.DocNotOpen)).toBe(true);\n });\n });\n}\n\nasync function openFixture(engine: Engine, opts: SearchConformanceOptions) {\n if (opts.openKind === 'bytes') {\n const bytes = await opts.fixture.bytes();\n return engine.open({ kind: 'bytes', id: opts.fixture.id, bytes }, EVERY_PERMISSION);\n }\n return engine.open({ kind: 'id', id: opts.fixture.cloudId ?? opts.fixture.id });\n}\n","import type { AnnotationList } from '../annotation/AnnotationList';\nimport { annotationKey } from '../identity/annotationKey';\nimport type { PageRef } from '../identity/PageRef';\nimport type { Annotation } from '../annotation/kinds';\n\n/**\n * Returns a list of human-readable difference strings between two\n * `annotations.list()` results, page by page. Empty array means parity.\n * Used by `engine-node.ts` to assert that local and cloud emit identical\n * annotations for the same fixture: the same pages, and on each the same\n * annotations under the same names. `auditHead` is not compared: it is a\n * cloud-only reconciliation cursor, absent on local lists by design.\n */\nexport function diffAnnotationList(a: AnnotationList, b: AnnotationList): string[] {\n const errs: string[] = [];\n if (a.pages.length !== b.pages.length) {\n errs.push(`pages.length mismatch: ${a.pages.length} vs ${b.pages.length}`);\n }\n const onPage = (list: AnnotationList, page: PageRef) =>\n list.annotations.filter((annotation) => annotation.page.objectNumber === page.objectNumber);\n const n = Math.min(a.pages.length, b.pages.length);\n for (let i = 0; i < n; i++) {\n const pageA = a.pages[i]!;\n const pageB = b.pages[i]!;\n for (const e of diffPage(pageA, onPage(a, pageA), pageB, onPage(b, pageB))) {\n errs.push(`page[${i}]: ${e}`);\n }\n }\n return errs;\n}\n\nfunction diffPage(pageA: PageRef, a: Annotation[], pageB: PageRef, b: Annotation[]): string[] {\n const errs: string[] = [];\n if (pageA.objectNumber !== pageB.objectNumber) {\n errs.push(`page.objectNumber mismatch: ${pageA.objectNumber} vs ${pageB.objectNumber}`);\n }\n if (a.length !== b.length) {\n errs.push(`annotations.length mismatch: ${a.length} vs ${b.length}`);\n }\n const n = Math.min(a.length, b.length);\n for (let i = 0; i < n; i++) diffAnnotation(i, a[i]!, b[i]!, errs);\n return errs;\n}\n\nfunction diffAnnotation(i: number, a: Annotation, b: Annotation, errs: string[]): void {\n if (a.subtype !== b.subtype) {\n errs.push(`annotations[${i}].subtype mismatch: ${a.subtype} vs ${b.subtype}`);\n return;\n }\n if (annotationKey(a.ref) !== annotationKey(b.ref)) {\n errs.push(`annotations[${i}].ref mismatch: ${annotationKey(a.ref)} vs ${annotationKey(b.ref)}`);\n }\n if (a.nm !== b.nm) {\n errs.push(`annotations[${i}].nm mismatch: ${a.nm} vs ${b.nm}`);\n }\n}\n","import type { ConformanceFixture, ConformanceTestRunner } from './runMetadataConformance';\nimport type { FormFieldDTO } from '../forms/field';\nimport type { DocumentHandle } from '../engine/DocumentHandle';\nimport type { Engine } from '../engine/Engine';\nimport { isLocalDocument, type LocalDocumentHandle } from '../engine/LocalDocumentHandle';\nimport { EngineError } from '../errors/EngineError';\nimport { EngineErrorCode } from '../errors/EngineErrorCode';\nimport { EVERY_PERMISSION } from './fixtureScope';\n\nexport interface SignatureConformanceFixtures {\n /** A form with no signature fields at all. */\n unsignedForm: ConformanceFixture;\n /**\n * Three revisions: the original, an approval signature sealing revision\n * 1, and a form fill plus a second approval signature sealing revision\n * 2. Both signatures have whole-revision coverage; `textField` is the\n * filled text field.\n */\n twoApprovals: ConformanceFixture & { fieldNames: [string, string]; textField: string };\n /** Two revisions: a certification signature with permission 2 sealing revision 1. */\n certified: ConformanceFixture & { fieldName: string };\n /** Two revisions: one approval signature whose FieldMDP includes `lockedField`. */\n fieldMdp: ConformanceFixture & { fieldName: string; lockedField: string };\n /** Three chained revisions, two signatures whose ranges are well-formed but seal no revision. */\n partialChain: ConformanceFixture;\n /** One unsigned signature field (with a widget) and one text field, nothing signed. */\n unsignedSigField: ConformanceFixture & { fieldName: string; textField: string };\n /** Any single-page PDF, used as signature artwork. */\n artwork: ConformanceFixture;\n}\n\nexport interface SignatureConformanceOptions {\n label: string;\n makeEngine: () => Promise<Engine> | Engine;\n /**\n * An engine constructed with `signedDocumentPolicy: 'permit'`; the\n * suite proves the protection it lifts. Omit where the engine has no\n * such option.\n */\n makePermitEngine?: () => Promise<Engine> | Engine;\n /** `layerBytes` opens each fixture as an immutable base with a fresh layer on top. */\n openKind: 'bytes' | 'layerBytes' | 'id';\n fixtures: SignatureConformanceFixtures;\n}\n\n/**\n * Digital signatures, read side. The service is optional on the contract\n * (`downloadLayer?` pattern) — the suite runs only where the engine\n * provides it.\n *\n * Invariants:\n * 1. Byte facts describe the loaded bytes: a revision is a byte prefix,\n * a whole-revision signature seals exactly one, the digest over its\n * `/ByteRange` is what the file's bytes hash to, and an unsaved edit\n * changes none of it.\n * 2. Protection is derived from the signatures in the file and applied\n * as document-derived capabilities: a certification with permission 2\n * takes page assembly and annotation writes away, a FieldMDP freezes\n * the fields it names, a rewrite save is refused. Under\n * `signedDocumentPolicy: 'permit'` none of that applies and the\n * analysis is unchanged.\n * 3. The same answers come from a plain session and from a layer\n * session over the same bytes.\n */\nexport function runSignatureConformance(\n runner: ConformanceTestRunner,\n opts: SignatureConformanceOptions,\n): void {\n const { describe, test, beforeAll, afterAll, expect } = runner;\n\n describe(`signatures conformance: ${opts.label}`, () => {\n let engine: Engine;\n let permitEngine: Engine | null = null;\n let supported = false;\n\n beforeAll(async () => {\n engine = await opts.makeEngine();\n const probe = await open(engine, opts, opts.fixtures.unsignedForm);\n supported = probe.signatures !== undefined;\n await probe.close();\n if (supported && opts.makePermitEngine) permitEngine = await opts.makePermitEngine();\n });\n\n afterAll(async () => {\n if (permitEngine) await permitEngine.destroy();\n if (engine) await engine.destroy();\n });\n\n test('an unsigned form has no signatures and no protection; version() hashes the loaded bytes', async () => {\n if (!supported) return;\n const bytes = await opts.fixtures.unsignedForm.bytes();\n const doc = await open(engine, opts, opts.fixtures.unsignedForm);\n try {\n const snapshot = await doc.signatures.list();\n expect(snapshot.chainValid).toBe(true);\n expect(snapshot.signatures).toEqual([]);\n expect(snapshot.revisions.length >= 1).toBe(true);\n expect(snapshot.protection.judged).toBeNull();\n expect(snapshot.protection.enforced).toBeNull();\n expect(snapshot.protection.certification).toBeNull();\n expect(snapshot.protection.fieldLocks).toEqual([]);\n expect(doc.security.allows('doc.pages.assemble')).toBe(true);\n if (isLocalDocument(doc)) {\n const version = await doc.version();\n expect(version.byteLength).toBe(bytes.byteLength);\n expect(version.sha256).toBe(await sha256Hex(bytes));\n }\n let caught: unknown;\n try {\n await doc.signatures.getContents({ kind: 'fqn', name: 'no-such-field' });\n } catch (err) {\n caught = err;\n }\n expect(EngineError.is(caught, EngineErrorCode.NotFound)).toBe(true);\n } finally {\n await doc.close();\n }\n });\n\n test('two approval signatures: revisions, coverage, digests, contents, revision bytes', async () => {\n if (!supported) return;\n const fixture = opts.fixtures.twoApprovals;\n const bytes = await fixture.bytes();\n const doc = await open(engine, opts, fixture);\n try {\n const snapshot = await doc.signatures.list();\n expect(snapshot.chainValid).toBe(true);\n expect(snapshot.revisions).toHaveLength(3);\n expect(snapshot.signatures).toHaveLength(2);\n expect(snapshot.revisions[2].end).toBe(bytes.byteLength);\n for (const [i, sig] of snapshot.signatures.entries()) {\n expect(sig.index).toBe(i);\n expect(sig.signed).toBe(true);\n expect(sig.kind).toBe('signature');\n expect(sig.field.kind).toBe('objectNumber');\n expect(sig.fieldName).toBe(fixture.fieldNames[i]);\n expect(sig.coverage).toBe('whole-revision');\n expect(sig.revisionIndex).toBe(i + 1);\n expect(snapshot.revisions[i + 1].signatureIndex).toBe(i);\n expect(sig.subFilter).toBe('ETSI.CAdES.detached');\n expect(typeof sig.signer.signedAt).toBe('string');\n expect(sig.docMdp).toBeNull();\n expect(sig.catalogCertification).toBe(false);\n expect(sig.contentsSize > 0).toBe(true);\n expect(sig.byteRange![0]).toBe(0);\n expect(sig.byteRange![2] + sig.byteRange![3]).toBe(snapshot.revisions[i + 1].end);\n }\n // Approval signatures without a certification: nothing declared, judged at the baseline.\n expect(snapshot.protection.judged).toBe('annotate');\n expect(snapshot.protection.enforced).toBeNull();\n expect(snapshot.protection.certification).toBeNull();\n expect(snapshot.protection.fieldLocks).toEqual([]);\n\n // The DER object, exactly as long as its TLV declares.\n const first = snapshot.signatures[0];\n const contents = await doc.signatures.getContents(first.field);\n expect(contents.byteLength).toBe(first.contentsSize);\n expect(contents[0]).toBe(0x30);\n\n // The digest is what the file's own bytes hash to over the range.\n const [a, b, c, d] = first.byteRange!;\n const sealed = await doc.signatures.downloadRevision(1);\n expect(sealed.byteLength).toBe(snapshot.revisions[1].end);\n expect(bytesEqual(sealed, bytes.subarray(0, sealed.byteLength))).toBe(true);\n const signedBytes = concat(sealed.subarray(a, a + b), sealed.subarray(c, c + d));\n const digest = await doc.signatures.getDigest(first.field, 'sha256');\n expect(digest.byteLength).toBe(32);\n expect(toHex(digest)).toBe(await sha256Hex(signedBytes));\n // Any algorithm, same protocol.\n expect((await doc.signatures.getDigest(first.field, 'sha512')).byteLength).toBe(64);\n // fqn refs resolve too.\n const byName = await doc.signatures.getDigest(\n { kind: 'fqn', name: first.fieldName },\n 'sha256',\n );\n expect(toHex(byName)).toBe(toHex(digest));\n\n // An unsaved edit is not a revision: the byte facts do not move.\n const fields = await doc.forms.list();\n const text = fields.fields.find((f) => f.name === fixture.textField)!;\n expect(text).toBeTruthy();\n await doc.forms.setValue(text.ref, {\n value: 'unsaved',\n });\n const again = await doc.signatures.list();\n expect(again.revisions).toEqual(snapshot.revisions);\n expect(again.signatures.map((s) => [s.coverage, s.revisionIndex, s.byteRange])).toEqual(\n snapshot.signatures.map((s) => [s.coverage, s.revisionIndex, s.byteRange]),\n );\n expect(toHex(await doc.signatures.getDigest(first.field, 'sha256'))).toBe(toHex(digest));\n if (isLocalDocument(doc)) {\n expect((await doc.version()).sha256).toBe(await sha256Hex(bytes));\n }\n } finally {\n await doc.close();\n }\n });\n\n test('a certification takes structural capabilities away; permit lifts it', async () => {\n if (!supported) return;\n const fixture = opts.fixtures.certified;\n const doc = await open(engine, opts, fixture);\n try {\n const snapshot = await doc.signatures.list();\n const signed = snapshot.signatures.filter((s) => s.signed);\n expect(signed).toHaveLength(1);\n const sig = signed[0];\n expect(sig.fieldName).toBe(fixture.fieldName);\n expect(sig.coverage).toBe('whole-revision');\n expect(sig.docMdp).toBe(2);\n expect(sig.catalogCertification).toBe(true);\n expect(snapshot.protection.judged).toBe('fill');\n expect(snapshot.protection.enforced).toBe('fill');\n expect(snapshot.protection.certification).toEqual({\n signatureIndex: sig.index,\n permission: 2,\n });\n\n expect(doc.security.allows('doc.forms.read')).toBe(true);\n expect(doc.security.allows('doc.forms.fill')).toBe(true);\n expect(doc.security.allows('doc.annotate.modify')).toBe(false);\n expect(doc.security.allows('doc.pages.assemble')).toBe(false);\n expect(doc.security.allows('doc.redact')).toBe(false);\n\n const list = await doc.pages.list();\n let caught: unknown;\n try {\n await doc.pages.delete([list.pages[0].ref]);\n } catch (err) {\n caught = err;\n }\n expect(EngineError.is(caught, EngineErrorCode.ProtectedDocument)).toBe(true);\n\n caught = undefined;\n try {\n await doc.download({ mode: 'rewrite' });\n } catch (err) {\n caught = err;\n }\n expect(EngineError.is(caught, EngineErrorCode.ProtectedDocument)).toBe(true);\n // An incremental save keeps the signature; the read side agrees.\n const saved = await doc.download();\n expect(saved.byteLength >= snapshot.revisions[1].end).toBe(true);\n } finally {\n await doc.close();\n }\n\n if (!permitEngine) return;\n const permitted = await open(permitEngine, opts, fixture);\n try {\n // Analysis is policy-independent; enforcement is not.\n const snapshot = await permitted.signatures.list();\n expect(snapshot.protection.judged).toBe('fill');\n expect(snapshot.protection.enforced).toBe('fill');\n expect(permitted.security.allows('doc.pages.assemble')).toBe(true);\n const rewritten = await permitted.download({ mode: 'rewrite' });\n expect(rewritten.byteLength > 0).toBe(true);\n } finally {\n await permitted.close();\n }\n });\n\n test('a FieldMDP freezes the fields it names; permit lifts it', async () => {\n if (!supported) return;\n const fixture = opts.fixtures.fieldMdp;\n const doc = await open(engine, opts, fixture);\n const lockedRef = { kind: 'fqn', name: fixture.lockedField } as const;\n try {\n const snapshot = await doc.signatures.list();\n const sig = snapshot.signatures[0];\n expect(sig.fieldName).toBe(fixture.fieldName);\n expect(sig.fieldMdp).toEqual({ action: 'include', fields: [fixture.lockedField] });\n expect(snapshot.protection.judged).toBe('annotate');\n expect(snapshot.protection.enforced).toBeNull();\n // The FieldMDP, and the /Lock the authoring engine mirrors it with\n // when it wrote the field — both name the same fields.\n expect(snapshot.protection.fieldLocks[0]).toEqual({\n signatureIndex: 0,\n source: 'fieldmdp',\n spec: { action: 'include', fields: [fixture.lockedField] },\n });\n for (const lock of snapshot.protection.fieldLocks) {\n expect(lock.signatureIndex).toBe(0);\n expect(lock.spec).toEqual({ action: 'include', fields: [fixture.lockedField] });\n }\n // Filling in general is still allowed; this field is not.\n expect(doc.security.allows('doc.forms.fill')).toBe(true);\n let caught: unknown;\n try {\n await doc.forms.setValue(lockedRef, { value: 'changed' });\n } catch (err) {\n caught = err;\n }\n expect(EngineError.is(caught, EngineErrorCode.ProtectedDocument)).toBe(true);\n // A script's results can't reach it either: the change is refused.\n let scripted: unknown;\n try {\n await doc.apply({\n ops: [{ type: 'forms.setValue', field: lockedRef, value: { value: 'changed' } }],\n });\n } catch (err) {\n scripted = err;\n }\n expect(EngineError.is(scripted, EngineErrorCode.ProtectedDocument)).toBe(true);\n // A values import leaves it out, and says so.\n const bundle = await doc.forms.export({ fields: [lockedRef] });\n const [row] = bundle.fields;\n const changed = {\n ...bundle,\n fields: [\n {\n data: {\n ...row!.data,\n valueEntry: { kind: 'scalar', value: 'changed' },\n value: 'changed',\n } as FormFieldDTO,\n },\n ],\n };\n const imported = await doc.forms.importValues(changed, { attribution: 'stamp' });\n expect(imported.dropped).toEqual([{ ref: row!.data.ref, reason: 'locked' }]);\n expect(imported.fields).toEqual([]);\n const field = await doc.forms.get(lockedRef);\n expect(field.family).toBe('text');\n expect((field as { value?: string }).value === 'changed').toBe(false);\n } finally {\n await doc.close();\n }\n\n if (!permitEngine) return;\n const permitted = await open(permitEngine, opts, fixture);\n try {\n const result = await permitted.forms.setValue(lockedRef, {\n value: 'changed',\n });\n expect(result.field.name).toBe(fixture.lockedField);\n } finally {\n await permitted.close();\n }\n });\n\n test('well-formed ranges that seal no revision are partial, with no revision index', async () => {\n if (!supported) return;\n const doc = await open(engine, opts, opts.fixtures.partialChain);\n try {\n const snapshot = await doc.signatures.list();\n expect(snapshot.chainValid).toBe(true);\n expect(snapshot.revisions).toHaveLength(3);\n expect(snapshot.signatures).toHaveLength(2);\n for (const sig of snapshot.signatures) {\n expect(sig.signed).toBe(true);\n expect(sig.coverage).toBe('partial');\n expect(sig.revisionIndex).toBeNull();\n expect(sig.contentsSize).toBe(13);\n expect((await doc.signatures.getContents(sig.field)).byteLength).toBe(13);\n expect((await doc.signatures.getDigest(sig.field, 'sha256')).byteLength).toBe(32);\n }\n expect(snapshot.revisions.every((r) => r.signatureIndex === null)).toBe(true);\n // Signed, so judged at the approval baseline — even a partial one is a signature.\n expect(snapshot.protection.judged).toBe('annotate');\n expect(snapshot.protection.enforced).toBeNull();\n let caught: unknown;\n try {\n await doc.signatures.downloadRevision(3);\n } catch (err) {\n caught = err;\n }\n expect(EngineError.is(caught, EngineErrorCode.NotFound)).toBe(true);\n } finally {\n await doc.close();\n }\n });\n\n if (opts.openKind !== 'id') {\n runSigningTests(\n runner,\n opts,\n () => engine,\n () => supported,\n );\n runAnalysisTests(\n runner,\n opts,\n () => engine,\n () => permitEngine,\n () => supported,\n );\n }\n });\n}\n\nfunction runAnalysisTests(\n runner: ConformanceTestRunner,\n opts: SignatureConformanceOptions,\n engineOf: () => Engine,\n permitEngineOf: () => Engine | null,\n supported: () => boolean,\n): void {\n const { test, expect } = runner;\n\n test('analyze: a form fill and a second signature after an approval are permitted', async () => {\n if (!supported()) return;\n const doc = await open(engineOf(), opts, opts.fixtures.twoApprovals);\n try {\n const analysis = await doc.signatures.analyze({ since: { signatureIndex: 0 } });\n expect(analysis.mode).toBe('authoritative');\n expect(analysis.basis.source).toBe('persisted');\n expect(analysis.since).toEqual({ revisionIndex: 1, signatureIndex: 0 });\n expect(analysis.until.revisionIndex).toBe(2);\n expect(analysis.steps).toHaveLength(1);\n const [step] = analysis.steps;\n expect(step.levelInForce).toBe('annotate');\n expect(step.verdict).toBe('permitted');\n expect(step.changes.length > 0).toBe(true);\n const rules = new Set(\n step.findings.filter((f) => f.verdict === 'permitted').map((f) => f.rule),\n );\n expect(rules.has('form-fill')).toBe(true);\n expect(rules.has('signature-added')).toBe(true);\n expect(step.findings.filter((f) => f.verdict === 'forbidden')).toEqual([]);\n expect(analysis.verdict).toBe('permitted');\n // The last signature has nothing after it.\n const latest = await doc.signatures.analyze({ since: { signatureIndex: 1 } });\n expect(latest.steps).toHaveLength(0);\n expect(latest.verdict).toBe('unchanged');\n // History only: from the original revision up to the first signature.\n const historic = await doc.signatures.analyze({\n since: { revisionIndex: 0 },\n until: { revisionIndex: 1 },\n });\n expect(historic.steps).toHaveLength(1);\n expect(historic.verdict).toBe('permitted');\n } finally {\n await doc.close();\n }\n });\n\n test('analyze: the working copy is one more revision; a partial signature cannot anchor', async () => {\n if (!supported()) return;\n const fx = opts.fixtures.unsignedSigField;\n const doc = await open(engineOf(), opts, fx);\n try {\n const prepared = await doc.signatures.prepare({\n field: { kind: 'fqn', name: fx.fieldName },\n certify: { permission: 2 },\n });\n await doc.signatures.complete({\n signingId: prepared.signingId,\n cms: FAKE_CMS,\n expectedVersion: prepared.expectedVersion,\n });\n const clean = await doc.signatures.analyze({\n since: { signatureIndex: 0 },\n until: 'working-copy',\n });\n expect(clean.steps).toHaveLength(0);\n expect(clean.verdict).toBe('unchanged');\n await doc.forms.setValue({ kind: 'fqn', name: fx.textField }, { value: 'draft' });\n const persisted = await doc.signatures.analyze({ since: { signatureIndex: 0 } });\n expect(persisted.steps).toHaveLength(0);\n const working = await doc.signatures.analyze({\n since: { signatureIndex: 0 },\n until: 'working-copy',\n });\n expect(working.basis.source).toBe('working-copy');\n expect(working.steps).toHaveLength(1);\n expect(working.steps[0].levelInForce).toBe('fill');\n expect(working.verdict).toBe('permitted');\n expect(\n working.steps[0].findings.some((f) => f.rule === 'form-fill' && f.verdict === 'permitted'),\n ).toBe(true);\n } finally {\n await doc.close();\n }\n const partial = await open(engineOf(), opts, opts.fixtures.partialChain);\n try {\n expect(\n await caughtCode(() => partial.signatures.analyze({ since: { signatureIndex: 0 } })),\n ).toBe(EngineErrorCode.InvalidArg);\n // A revision-anchored analysis over two later revisions: the net\n // state is judged in summary mode; `full` also carries every step.\n const byRevision = await partial.signatures.analyze({ since: { revisionIndex: 0 } });\n expect(byRevision.later.revisionCount).toBe(2);\n expect(byRevision.steps).toHaveLength(0);\n const inFull = await partial.signatures.analyze({\n since: { revisionIndex: 0 },\n detail: 'full',\n });\n expect(inFull.steps).toHaveLength(2);\n expect(inFull.current.verdict).toBe(byRevision.current.verdict);\n } finally {\n await partial.close();\n }\n });\n\n test('analyze: a page edit under a certification and a locked field edit are forbidden', async () => {\n if (!supported()) return;\n const permit = permitEngineOf();\n if (!permit) return;\n // Page deletion after a certification (permission 2): unexplained by every rule.\n const certified = await open(permit, opts, opts.fixtures.certified);\n let reopened: DocumentHandle | null = null;\n try {\n // A one-page fixture cannot lose its only page; a rotation is a page\n // dictionary change no signature permits either.\n const list = await certified.pages.list();\n await certified.pages.rotate([list.pages[0].ref], 90);\n const working = await certified.signatures.analyze({\n since: { signatureIndex: 0 },\n until: 'working-copy',\n });\n expect(working.verdict).toBe('forbidden');\n const bytes = await certified.download();\n reopened = await reopen(permit, opts, `${opts.fixtures.certified.id}-tampered`, bytes);\n const analysis = await reopened.signatures.analyze({ since: { signatureIndex: 0 } });\n expect(analysis.verdict).toBe('forbidden');\n expect(analysis.steps[0].findings.some((f) => f.verdict === 'forbidden')).toBe(true);\n } finally {\n if (reopened) await reopened.close();\n await certified.close();\n }\n // Editing a FieldMDP-locked field: the lock rule, whatever the level.\n const locked = await open(permit, opts, opts.fixtures.fieldMdp);\n try {\n await locked.forms.setValue(\n { kind: 'fqn', name: opts.fixtures.fieldMdp.lockedField },\n { value: 'tampered' },\n );\n const working = await locked.signatures.analyze({\n since: { signatureIndex: 0 },\n until: 'working-copy',\n });\n expect(working.verdict).toBe('forbidden');\n expect(working.steps[0].findings.some((f) => f.rule === 'field-lock')).toBe(true);\n } finally {\n await locked.close();\n }\n });\n}\n\n/** A minimal DER sequence standing in for a CMS: the engine's job ends at the bytes. */\nconst FAKE_CMS = new Uint8Array([0x30, 0x06, 0x02, 0x01, 0x01, 0x02, 0x01, 0x02]);\n\nasync function caughtCode(run: () => Promise<unknown>): Promise<string | null> {\n try {\n await run();\n return null;\n } catch (err) {\n return err instanceof EngineError ? err.code : 'not-an-engine-error';\n }\n}\n\nfunction runSigningTests(\n runner: ConformanceTestRunner,\n opts: SignatureConformanceOptions,\n engineOf: () => Engine,\n supported: () => boolean,\n): void {\n const { test, expect } = runner;\n const fx = () => opts.fixtures.unsignedSigField;\n const sigRef = () => ({ kind: 'fqn', name: fx().fieldName }) as const;\n const textRef = () => ({ kind: 'fqn', name: fx().textField }) as const;\n\n test('sign: prepare seals a candidate, complete installs it, download returns it verbatim', async () => {\n if (!supported()) return;\n const engine = engineOf();\n const doc = await openLocal(engine, opts, fx());\n const events: string[] = [];\n const unsubscribe = doc.events.subscribe((event) => events.push(event.type));\n let reopened: DocumentHandle | null = null;\n try {\n const v0 = await doc.version();\n const before = await doc.signatures.list();\n expect(before.revisions).toHaveLength(1);\n expect(before.signatures).toHaveLength(1);\n expect(before.signatures[0].signed).toBe(false);\n expect(before.protection.judged).toBeNull();\n\n const prepared = await doc.signatures.prepare({\n field: sigRef(),\n subFilter: 'ETSI.CAdES.detached',\n digest: 'sha256',\n contentsSize: 1024,\n signer: { reason: 'conformance' },\n });\n expect(prepared.digest.byteLength).toBe(32);\n expect(prepared.algorithm).toBe('sha256');\n expect(prepared.subFilter).toBe('ETSI.CAdES.detached');\n expect(prepared.contentsSize).toBe(1024);\n expect(prepared.byteRange[0]).toBe(0);\n expect(prepared.byteRange[2] > prepared.byteRange[1]).toBe(true);\n expect(prepared.expectedVersion.baseSha256).toBe(v0.sha256);\n\n // The fence: nothing mutates while a candidate is parked.\n expect(await caughtCode(() => doc.signatures.prepare({ field: sigRef() }))).toBe(\n EngineErrorCode.SigningPending,\n );\n expect(await caughtCode(() => doc.forms.setValue(textRef(), { value: 'x' }))).toBe(\n EngineErrorCode.SigningPending,\n );\n // The live document is untouched.\n const during = await doc.signatures.list();\n expect(during.signatures[0].signed).toBe(false);\n expect((await doc.version()).sha256).toBe(v0.sha256);\n\n // A stale expectedVersion cannot complete.\n expect(\n await caughtCode(() =>\n doc.signatures.complete({\n signingId: prepared.signingId,\n cms: FAKE_CMS,\n expectedVersion: {\n baseSha256: prepared.expectedVersion.baseSha256,\n editsVersion: prepared.expectedVersion.editsVersion + 1,\n },\n }),\n ),\n ).toBe(EngineErrorCode.SigningVersionMismatch);\n\n const result = await doc.signatures.complete({\n signingId: prepared.signingId,\n cms: FAKE_CMS,\n expectedVersion: prepared.expectedVersion,\n });\n expect(result.status).toBe('completed');\n expect(result.signature.signed).toBe(true);\n expect(result.signature.fieldName).toBe(fx().fieldName);\n expect(result.signature.coverage).toBe('whole-revision');\n expect(result.signature.revisionIndex).toBe(1);\n expect(result.signature.subFilter).toBe('ETSI.CAdES.detached');\n expect(result.signature.signer.reason).toBe('conformance');\n expect(result.signature.contentsSize).toBe(FAKE_CMS.byteLength);\n expect(result.previous).toEqual(prepared.expectedVersion);\n expect(result.version.sha256 === v0.sha256).toBe(false);\n expect(result.protection.judged).toBe('annotate');\n expect(result.protection.enforced).toBeNull();\n expect(result.meta.affectedPages.length >= 1).toBe(true);\n\n // The session is on the new version, and every byte fact follows.\n expect(await doc.version()).toEqual(result.version);\n const after = await doc.signatures.list();\n expect(after.revisions).toHaveLength(2);\n expect(after.signatures[0].signed).toBe(true);\n expect(after.signatures[0].revisionIndex).toBe(1);\n expect(after.revisions[1].signatureIndex).toBe(0);\n expect(toHex(await doc.signatures.getDigest(sigRef(), 'sha256'))).toBe(\n toHex(prepared.digest),\n );\n expect(bytesEqual(await doc.signatures.getContents(sigRef()), FAKE_CMS)).toBe(true);\n\n // download() is the sealed file, byte for byte: nothing is re-saved.\n const bytes = await doc.download();\n expect(bytes.byteLength).toBe(result.version.byteLength);\n expect(await sha256Hex(bytes)).toBe(result.version.sha256);\n reopened = await reopen(engine, opts, `${fx().id}-signed`, bytes);\n const fresh = await reopened.signatures.list();\n expect(fresh.revisions).toHaveLength(2);\n expect(fresh.signatures[0].coverage).toBe('whole-revision');\n expect(toHex(await reopened.signatures.getDigest(sigRef(), 'sha256'))).toBe(\n toHex(prepared.digest),\n );\n\n // Idempotent replay, then the fence is gone.\n const replay = await doc.signatures.complete({\n signingId: prepared.signingId,\n cms: FAKE_CMS,\n expectedVersion: prepared.expectedVersion,\n });\n expect(replay.status).toBe('already-completed');\n expect(replay.version).toEqual(result.version);\n expect((await doc.signatures.cancel(prepared.signingId)).status).toBe('already-completed');\n expect((await doc.signatures.cancel('never-prepared')).status).toBe('unknown');\n await doc.forms.setValue(textRef(), { value: 'after' });\n // Signing the same field again is refused: it is signed.\n expect(await caughtCode(() => doc.signatures.prepare({ field: sigRef() }))).toBe(\n EngineErrorCode.SignatureRefused,\n );\n\n expect(events.filter((t) => t === 'signatures.prepared')).toHaveLength(1);\n expect(events.filter((t) => t === 'signatures.completed')).toHaveLength(1);\n expect(events.filter((t) => t === 'document.versioned')).toHaveLength(1);\n } finally {\n unsubscribe();\n if (reopened) await reopened.close();\n await doc.close();\n }\n });\n\n test(\"sign: unsaved edits are sealed in the signature's own revision (layer session)\", async () => {\n if (!supported()) return;\n const doc = await openLocal(engineOf(), opts, fx());\n try {\n await doc.forms.setValue(textRef(), { value: 'unsaved' });\n const prepared = await doc.signatures.prepare({ field: sigRef() });\n const result = await doc.signatures.complete({\n signingId: prepared.signingId,\n cms: FAKE_CMS,\n expectedVersion: prepared.expectedVersion,\n });\n // The candidate is a layer over the session's own base fed the artifact a\n // save would write: edits and signature land in one revision, as Acrobat\n // saves a fill-and-sign. (A plain session freezes the edits first: two.)\n expect(result.signature.revisionIndex).toBe(1);\n const after = await doc.signatures.list();\n expect(after.revisions).toHaveLength(2);\n const text = await doc.forms.get(textRef());\n expect((text as { value?: string }).value).toBe('unsaved');\n const bytes = await doc.download();\n expect(await sha256Hex(bytes)).toBe(result.version.sha256);\n } finally {\n await doc.close();\n }\n });\n\n test('sign: a certification protects the document from the moment it completes', async () => {\n if (!supported()) return;\n const doc = await openLocal(engineOf(), opts, fx());\n try {\n expect(doc.security.allows('doc.pages.assemble')).toBe(true);\n const prepared = await doc.signatures.prepare({\n field: sigRef(),\n certify: { permission: 2 },\n subFilter: 'adbe.pkcs7.detached',\n });\n const result = await doc.signatures.complete({\n signingId: prepared.signingId,\n cms: FAKE_CMS,\n expectedVersion: prepared.expectedVersion,\n });\n expect(result.signature.docMdp).toBe(2);\n expect(result.signature.catalogCertification).toBe(true);\n expect(result.protection.judged).toBe('fill');\n expect(result.protection.enforced).toBe('fill');\n expect(result.protection.certification).toEqual({\n signatureIndex: result.signature.index,\n permission: 2,\n });\n expect(doc.security.allows('doc.pages.assemble')).toBe(false);\n expect(doc.security.allows('doc.forms.fill')).toBe(true);\n const list = await doc.pages.list();\n expect(await caughtCode(() => doc.pages.delete([list.pages[0].ref]))).toBe(\n EngineErrorCode.ProtectedDocument,\n );\n expect(await caughtCode(() => doc.download({ mode: 'rewrite' }))).toBe(\n EngineErrorCode.ProtectedDocument,\n );\n // Filling is still permitted (P = 2), and the certification survives it.\n await doc.forms.setValue(textRef(), { value: 'filled' });\n const after = await doc.signatures.list();\n expect(after.signatures[0].coverage).toBe('whole-revision');\n } finally {\n await doc.close();\n }\n });\n\n test('sign: a lock freezes the named fields and is mirrored on the field', async () => {\n if (!supported()) return;\n const doc = await openLocal(engineOf(), opts, fx());\n try {\n const prepared = await doc.signatures.prepare({\n field: sigRef(),\n lock: { action: 'include', fields: [fx().textField] },\n });\n const result = await doc.signatures.complete({\n signingId: prepared.signingId,\n cms: FAKE_CMS,\n expectedVersion: prepared.expectedVersion,\n });\n expect(result.signature.fieldMdp).toEqual({ action: 'include', fields: [fx().textField] });\n expect(result.signature.lock).toEqual({ action: 'include', fields: [fx().textField] });\n expect(result.protection.fieldLocks.length >= 1).toBe(true);\n expect(await caughtCode(() => doc.forms.setValue(textRef(), { value: 'nope' }))).toBe(\n EngineErrorCode.ProtectedDocument,\n );\n } finally {\n await doc.close();\n }\n });\n\n test('sign: cancel discards the candidate and lifts the fence', async () => {\n if (!supported()) return;\n const doc = await openLocal(engineOf(), opts, fx());\n try {\n const v0 = await doc.version();\n const prepared = await doc.signatures.prepare({ field: sigRef() });\n expect((await doc.signatures.cancel(prepared.signingId)).status).toBe('cancelled');\n expect((await doc.signatures.list()).signatures[0].signed).toBe(false);\n expect((await doc.version()).sha256).toBe(v0.sha256);\n await doc.forms.setValue(textRef(), { value: 'free again' });\n expect(\n await caughtCode(() =>\n doc.signatures.complete({\n signingId: prepared.signingId,\n cms: FAKE_CMS,\n expectedVersion: prepared.expectedVersion,\n }),\n ),\n ).toBe(EngineErrorCode.NotFound);\n } finally {\n await doc.close();\n }\n });\n\n test('sign: artwork from a PDF page lands on the widget', async () => {\n if (!supported()) return;\n const doc = await openLocal(engineOf(), opts, fx());\n try {\n const artwork = await opts.fixtures.artwork.bytes();\n const prepared = await doc.signatures.prepare({\n field: sigRef(),\n appearance: { pdf: artwork },\n });\n const result = await doc.signatures.complete({\n signingId: prepared.signingId,\n cms: FAKE_CMS,\n expectedVersion: prepared.expectedVersion,\n });\n expect(result.signature.coverage).toBe('whole-revision');\n expect(result.signature.widget).toBeTruthy();\n // Where it shows is the widget's row in the form.\n const widget = (await doc.forms.list()).widgets.find(\n (w) =>\n w.ref.kind === 'objectNumber' &&\n w.ref.objectNumber === result.signature.widget!.objectNumber,\n );\n expect(widget?.page).toEqual(result.signature.widget!.page);\n } finally {\n await doc.close();\n }\n });\n\n if (opts.openKind === 'layerBytes') {\n test('sign: a layer session keeps its kind, with an empty layer over the new base', async () => {\n if (!supported()) return;\n const doc = await openLocal(engineOf(), opts, fx());\n try {\n const prepared = await doc.signatures.prepare({ field: sigRef() });\n const result = await doc.signatures.complete({\n signingId: prepared.signingId,\n cms: FAKE_CMS,\n expectedVersion: prepared.expectedVersion,\n });\n const layer = await doc.downloadLayer();\n expect(layer.byteLength > 0).toBe(true);\n expect(await sha256Hex(await doc.download())).toBe(result.version.sha256);\n } finally {\n await doc.close();\n }\n });\n }\n}\n\nasync function reopen(\n engine: Engine,\n opts: SignatureConformanceOptions,\n id: string,\n bytes: Uint8Array,\n): Promise<DocumentHandle> {\n if (opts.openKind === 'layerBytes') {\n return engine.open({ kind: 'layerBytes', id, baseBytes: bytes });\n }\n return engine.open({ kind: 'bytes', id, bytes }, EVERY_PERMISSION);\n}\n\n/** A document the signing tests open: they run on the local engine, which has `version()` and layers. */\nasync function openLocal(\n engine: Engine,\n opts: SignatureConformanceOptions,\n fixture: ConformanceFixture,\n): Promise<LocalDocumentHandle> {\n const doc = await open(engine, opts, fixture);\n if (!isLocalDocument(doc)) throw new Error('the signing tests run on the local engine');\n return doc;\n}\n\nasync function open(\n engine: Engine,\n opts: SignatureConformanceOptions,\n fixture: ConformanceFixture,\n): Promise<DocumentHandle> {\n if (opts.openKind === 'bytes') {\n return engine.open(\n { kind: 'bytes', id: fixture.id, bytes: await fixture.bytes() },\n EVERY_PERMISSION,\n );\n }\n if (opts.openKind === 'layerBytes') {\n return engine.open({\n kind: 'layerBytes',\n id: `${fixture.id}-layer`,\n baseBytes: await fixture.bytes(),\n });\n }\n return engine.open({ kind: 'id', id: fixture.cloudId ?? fixture.id });\n}\n\nfunction concat(a: Uint8Array, b: Uint8Array): Uint8Array {\n const out = new Uint8Array(a.byteLength + b.byteLength);\n out.set(a, 0);\n out.set(b, a.byteLength);\n return out;\n}\n\nfunction bytesEqual(a: Uint8Array, b: Uint8Array): boolean {\n if (a.byteLength !== b.byteLength) return false;\n for (let i = 0; i < a.byteLength; i++) if (a[i] !== b[i]) return false;\n return true;\n}\n\nfunction toHex(bytes: Uint8Array): string {\n let out = '';\n for (const b of bytes) out += b.toString(16).padStart(2, '0');\n return out;\n}\n\nasync function sha256Hex(bytes: Uint8Array): Promise<string> {\n const copy = new Uint8Array(bytes.byteLength);\n copy.set(bytes);\n const digest = await globalThis.crypto.subtle.digest('SHA-256', copy);\n return toHex(new Uint8Array(digest));\n}\n","import { iconRect, PNG_1X1 } from './creatables';\nimport { UUID_V7 } from './names';\nimport { pdfOf } from './pdfOf';\nimport type { ConformanceTestRunner } from './runMetadataConformance';\nimport type { AnnotationDraft, Annotation, AnnotationPatch } from '../annotation/kinds';\nimport type { WidgetPatch } from '../annotation/kinds/widget';\nimport type { AnnotationResources } from '../annotation/resources';\nimport { DRAWN_RECT_KINDS } from '../annotation/shapeForRect';\nimport type { DocumentHandle } from '../engine/DocumentHandle';\nimport type { PageHandle } from '../engine/PageHandle';\nimport type { Engine } from '../engine/Engine';\nimport type { PageBox } from '../geometry/pageSpace';\nimport { toPageRef } from '../identity/PageRef';\nimport { measureFromRatio } from '../measure/calibrate';\nimport { annotationOfDraft, applyAnnotationPatch } from '../pageSpace/helpers';\n\n/** One blank US Letter page. */\nexport const PREDICTION_FIXTURE_PDF = pdfOf([\n '<< /Type /Catalog /Pages 2 0 R >>',\n '<< /Type /Pages /Kids [3 0 R] /Count 1 >>',\n '<< /Type /Page /Parent 2 0 R /MediaBox [0 0 612 792] >>',\n]);\n\nexport interface AnnotationPredictionConformanceOptions {\n label: string;\n makeEngine: () => Promise<Engine> | Engine;\n /** Open {@link PREDICTION_FIXTURE_PDF}. Called once; every case adds its own annotation. */\n open: (engine: Engine) => Promise<DocumentHandle>;\n}\n\n/** An update whose outcome is predicted: a fresh annotation, then one patch. */\ninterface PredictionCase {\n name: string;\n draft: AnnotationDraft;\n resources?: AnnotationResources;\n /** The patch, or a patch made from the created annotation. */\n patch: AnnotationPatch | ((created: Annotation) => AnnotationPatch);\n updateResources?: AnnotationResources;\n}\n\nconst BOX: PageBox = { x: 72, y: 72, width: 120, height: 80 };\n\nconst MEASURE = measureFromRatio(1, 100, 'cm');\n\nconst FREE_TEXT: AnnotationDraft = {\n subtype: 'free-text',\n box: BOX,\n intent: 'free-text',\n fontFamily: 'helvetica',\n fontSize: 12,\n textAlign: 'left',\n contents: 'Hello there',\n};\n\nconst CALLOUT: AnnotationDraft = {\n subtype: 'free-text',\n box: { x: 220, y: 600, width: 120, height: 60 },\n intent: 'free-text-callout',\n fontFamily: 'helvetica',\n fontSize: 12,\n textAlign: 'left',\n contents: 'Look here',\n calloutLine: [\n { x: 80, y: 700 },\n { x: 150, y: 640 },\n { x: 220, y: 630 },\n ],\n lineEnding: 'open-arrow',\n};\n\nconst TRIANGLE = [\n { x: 100, y: 300 },\n { x: 220, y: 300 },\n { x: 160, y: 200 },\n];\n\nconst CASES: PredictionCase[] = [\n {\n name: 'square: a new color',\n draft: { subtype: 'square', box: BOX },\n patch: { color: '#1a2b3c' },\n },\n {\n name: 'square: moved by its box',\n draft: { subtype: 'square', box: BOX },\n patch: { box: { ...BOX, x: BOX.x + 30 } },\n },\n { name: 'square: turned', draft: { subtype: 'square', box: BOX }, patch: { rotation: 30 } },\n {\n name: 'square: straightened',\n draft: { subtype: 'square', box: BOX, rotation: 30 },\n patch: { rotation: null },\n },\n {\n name: 'square: moved by its rect',\n draft: { subtype: 'square', box: BOX },\n patch: (created) => ({ rect: { ...created.rect, x: created.rect.x + 40 } }),\n },\n {\n name: 'square: the whole read sent back with one change',\n draft: { subtype: 'square', box: BOX, interiorColor: '#ff0000' },\n patch: (created) => ({ ...created, contents: 'kept' }) as AnnotationPatch,\n },\n {\n name: 'line: new points',\n draft: { subtype: 'line', linePoints: { start: { x: 80, y: 400 }, end: { x: 300, y: 450 } } },\n patch: { linePoints: { start: { x: 90, y: 410 }, end: { x: 310, y: 470 } } },\n },\n {\n name: 'line: new endings',\n draft: { subtype: 'line', linePoints: { start: { x: 80, y: 400 }, end: { x: 300, y: 450 } } },\n patch: { lineEndings: { start: 'none', end: 'closed-arrow' } },\n },\n {\n name: 'distance: new points relabel it',\n draft: {\n subtype: 'line',\n linePoints: { start: { x: 80, y: 500 }, end: { x: 280, y: 500 } },\n intent: 'line-dimension',\n measure: MEASURE,\n captionEnabled: true,\n },\n patch: { linePoints: { start: { x: 80, y: 500 }, end: { x: 380, y: 500 } } },\n },\n {\n name: 'distance: a new scale relabels it',\n draft: {\n subtype: 'line',\n linePoints: { start: { x: 80, y: 520 }, end: { x: 280, y: 520 } },\n intent: 'line-dimension',\n measure: MEASURE,\n },\n patch: { measure: measureFromRatio(1, 50, 'mm') },\n },\n {\n name: 'area: moved whole, its caption follows',\n draft: {\n subtype: 'polygon',\n vertices: TRIANGLE,\n intent: 'polygon-dimension',\n measure: MEASURE,\n captionEnabled: true,\n captionCenter: { x: 160, y: 270 },\n },\n patch: { vertices: TRIANGLE.map((point) => ({ x: point.x + 20, y: point.y + 10 })) },\n },\n {\n name: 'area: one vertex moved relabels it',\n draft: {\n subtype: 'polygon',\n vertices: TRIANGLE,\n intent: 'polygon-dimension',\n measure: MEASURE,\n },\n patch: { vertices: [TRIANGLE[0]!, TRIANGLE[1]!, { x: 160, y: 150 }] },\n },\n {\n name: 'ink: turned',\n draft: {\n subtype: 'ink',\n inkList: [\n [\n { x: 300, y: 100 },\n { x: 350, y: 140 },\n { x: 400, y: 110 },\n ],\n ],\n },\n patch: { rotation: 45 },\n },\n { name: 'free text: new contents', draft: FREE_TEXT, patch: { contents: 'Goodbye' } },\n {\n name: 'free text: new contents over two lines',\n draft: FREE_TEXT,\n patch: { contents: 'First line\\nSecond line' },\n },\n { name: 'free text: a new font size', draft: FREE_TEXT, patch: { fontSize: 18 } },\n { name: 'free text: a new font', draft: FREE_TEXT, patch: { fontFamily: 'times-bold' } },\n {\n name: 'free text: new contents and a new size together',\n draft: FREE_TEXT,\n patch: { contents: 'Bigger', fontSize: 20 },\n },\n { name: 'free text: a new color', draft: FREE_TEXT, patch: { color: '#0000ff' } },\n {\n name: \"free text: a new text color leaves the border's\",\n draft: { ...FREE_TEXT, color: '#0000ff' } as AnnotationDraft,\n patch: { fontColor: '#ff0000' },\n },\n {\n name: 'free text: a partial rich body merges over the current one',\n draft: FREE_TEXT,\n patch: {\n richText: {\n body: { size: 20, align: 'center' },\n paragraphs: [{ runs: [{ text: 'Bigger' }] }],\n },\n },\n },\n { name: 'free text: a new alignment', draft: FREE_TEXT, patch: { textAlign: 'center' } },\n {\n name: 'free text: new rich text',\n draft: FREE_TEXT,\n patch: {\n richText: {\n paragraphs: [{ runs: [{ text: 'Rich ' }, { text: 'text', style: { weight: 700 } }] }],\n },\n },\n },\n {\n name: 'callout: moved by its box, its line stays attached',\n draft: CALLOUT,\n patch: { box: { x: 260, y: 600, width: 120, height: 60 } },\n },\n {\n name: 'callout: turned, its line meets the turned box',\n draft: CALLOUT,\n patch: { rotation: 30 },\n },\n {\n name: 'callout: a line given with the box is kept as given',\n draft: CALLOUT,\n patch: {\n box: { x: 260, y: 600, width: 120, height: 60 },\n calloutLine: [\n { x: 80, y: 700 },\n { x: 150, y: 640 },\n { x: 262, y: 610 },\n ],\n },\n },\n {\n name: 'note: a standard review state',\n draft: { subtype: 'text', rect: iconRect(400, 72) },\n patch: { state: 'accepted' },\n },\n {\n name: 'link: a new target',\n draft: { subtype: 'link', rect: BOX, target: { kind: 'uri', uri: 'https://example.com' } },\n patch: { target: { kind: 'uri', uri: 'https://embedpdf.com' } },\n },\n {\n name: 'link: its target cleared',\n draft: { subtype: 'link', rect: BOX, target: { kind: 'uri', uri: 'https://example.com' } },\n patch: { target: null },\n },\n {\n name: 'link: moved by its rect',\n draft: { subtype: 'link', rect: BOX, target: { kind: 'uri', uri: 'https://example.com' } },\n patch: { rect: { ...BOX, y: BOX.y + 50 } },\n },\n {\n name: 'redaction: a new label',\n draft: { subtype: 'redact', rect: BOX },\n patch: { overlayText: 'CONFIDENTIAL', repeat: true },\n },\n {\n name: 'redaction: a new label size keeps the label color and font',\n draft: { subtype: 'redact', rect: BOX, fontColor: '#ff0000', fontFamily: 'courier' },\n patch: { fontSize: 20 },\n },\n {\n name: 'stamp: a new drawing and nothing else',\n draft: { subtype: 'stamp', box: BOX },\n resources: { appearance: PNG_1X1 },\n patch: {},\n updateResources: { appearance: PNG_1X1 },\n },\n {\n name: 'file attachment: a new description',\n draft: {\n subtype: 'file-attachment',\n rect: iconRect(450, 72),\n file: { name: 'note.txt', mimeType: 'text/plain', description: 'A note' },\n },\n resources: { file: new TextEncoder().encode('attached') },\n patch: { file: { name: 'note.txt', description: 'Another note' } },\n },\n];\n\n/**\n * A widget's update, predicted the same way: widgets are the form's, so the\n * widget is placed by a field create and changed by `forms.updateWidget`.\n */\nconst WIDGET_CASES: { name: string; patch: WidgetPatch }[] = [\n { name: 'hidden and locked', patch: { hidden: true, locked: true } },\n {\n name: 'moved and restyled',\n patch: { rect: { ...BOX, x: 300 }, color: '#1f6feb', strokeWidth: 2 },\n },\n];\n\n/** A create whose outcome is predicted with `annotationOfDraft`. */\ninterface CreateCase {\n name: string;\n draft: AnnotationDraft;\n resources?: AnnotationResources;\n}\n\nconst QUAD = {\n upperLeft: { x: 72, y: 300 },\n upperRight: { x: 192, y: 300 },\n lowerLeft: { x: 72, y: 320 },\n lowerRight: { x: 192, y: 320 },\n};\n\nconst STAMP_BYTES = { appearance: PNG_1X1 };\nconst FILE_BYTES = { file: new TextEncoder().encode('attached') };\n\nconst CREATE_CASES: CreateCase[] = [\n // Each kind with only what it requires: the rest is its defaults.\n { name: 'square, as little as it takes', draft: { subtype: 'square', box: BOX } },\n { name: 'circle, as little as it takes', draft: { subtype: 'circle', box: BOX } },\n {\n name: 'line, as little as it takes',\n draft: { subtype: 'line', linePoints: { start: { x: 80, y: 400 }, end: { x: 300, y: 450 } } },\n },\n { name: 'polygon, as little as it takes', draft: { subtype: 'polygon', vertices: TRIANGLE } },\n { name: 'polyline, as little as it takes', draft: { subtype: 'polyline', vertices: TRIANGLE } },\n { name: 'ink, as little as it takes', draft: { subtype: 'ink', inkList: [TRIANGLE] } },\n { name: 'highlight, as little as it takes', draft: { subtype: 'highlight', quadPoints: [QUAD] } },\n { name: 'underline, as little as it takes', draft: { subtype: 'underline', quadPoints: [QUAD] } },\n { name: 'squiggly, as little as it takes', draft: { subtype: 'squiggly', quadPoints: [QUAD] } },\n { name: 'strikeout, as little as it takes', draft: { subtype: 'strikeout', quadPoints: [QUAD] } },\n { name: 'caret, as little as it takes', draft: { subtype: 'caret', box: BOX } },\n { name: 'free text, as little as it takes', draft: { subtype: 'free-text', box: BOX } },\n { name: 'note, as little as it takes', draft: { subtype: 'text', rect: iconRect(400, 72) } },\n { name: 'link, as little as it takes', draft: { subtype: 'link', rect: BOX, target: null } },\n { name: 'redaction, as little as it takes', draft: { subtype: 'redact', rect: BOX } },\n {\n name: 'stamp, as little as it takes',\n draft: { subtype: 'stamp', box: BOX },\n resources: STAMP_BYTES,\n },\n {\n name: 'file attachment, as little as it takes',\n draft: { subtype: 'file-attachment', rect: iconRect(450, 72), file: { name: 'a.txt' } },\n resources: FILE_BYTES,\n },\n // What a draft states, and what follows from it.\n {\n name: 'square, styled',\n draft: {\n subtype: 'square',\n box: BOX,\n color: '#1a2b3c',\n interiorColor: '#ffeecc',\n opacity: 0.5,\n strokeWidth: 3,\n borderStyle: 'dashed',\n dashArray: [4, 2],\n rotation: 30,\n contents: 'A square',\n print: true,\n },\n },\n {\n name: 'free text in a bold face, colored, centered',\n draft: {\n ...FREE_TEXT,\n fontFamily: 'times-bold',\n fontSize: 20,\n color: '#0000ff',\n fontColor: '#ff0000',\n textAlign: 'center',\n } as AnnotationDraft,\n },\n {\n name: 'free text over two lines',\n draft: { ...FREE_TEXT, contents: 'First line\\nSecond line' },\n },\n {\n name: 'free text from rich text',\n draft: {\n ...FREE_TEXT,\n contents: undefined,\n richText: {\n paragraphs: [{ runs: [{ text: 'Rich ' }, { text: 'text', style: { weight: 700 } }] }],\n },\n },\n },\n { name: 'a callout', draft: CALLOUT },\n { name: 'a callout without an intent', draft: { ...CALLOUT, intent: undefined } },\n {\n name: 'a distance',\n draft: {\n subtype: 'line',\n linePoints: { start: { x: 80, y: 500 }, end: { x: 280, y: 500 } },\n intent: 'line-dimension',\n measure: MEASURE,\n captionEnabled: true,\n },\n },\n {\n name: 'an area with its caption placed',\n draft: {\n subtype: 'polygon',\n vertices: TRIANGLE,\n intent: 'polygon-dimension',\n measure: MEASURE,\n captionEnabled: true,\n captionCenter: { x: 160, y: 270 },\n },\n },\n {\n name: 'a note with a review state',\n draft: { subtype: 'text', rect: iconRect(400, 72), state: 'accepted', icon: 'comment' },\n },\n {\n name: 'a link to a page',\n draft: {\n subtype: 'link',\n rect: BOX,\n target: { kind: 'uri', uri: 'https://embedpdf.com' },\n },\n },\n {\n name: 'a redaction with a label, over text',\n draft: {\n subtype: 'redact',\n quadPoints: [QUAD],\n overlayText: 'CONFIDENTIAL',\n repeat: true,\n fontColor: '#ffffff',\n interiorColor: '#000000',\n },\n },\n {\n name: 'a named stamp',\n draft: { subtype: 'stamp', box: BOX, name: 'Approved', opacity: 0.5, fit: 'fill' },\n resources: STAMP_BYTES,\n },\n {\n name: 'a file with its type and description',\n draft: {\n subtype: 'file-attachment',\n rect: iconRect(450, 72),\n file: { name: 'note.txt', mimeType: 'text/plain', description: 'A note' },\n icon: 'tag',\n },\n resources: FILE_BYTES,\n },\n];\n\n/**\n * Fields a prediction leaves as they were: the engine works them out from its\n * drawing, or stamps them on every write.\n */\nfunction unpredicted(annotation: Annotation): Set<string> {\n const names = new Set(['modifiedAt', 'modifiedBy']);\n if (DRAWN_RECT_KINDS.has(annotation.subtype)) names.add('rect');\n // A widget without its own font reads the form's default appearance, which\n // is the document's, not the draft's.\n if (annotation.subtype === 'widget') for (const name of WIDGET_FONT) names.add(name);\n return names;\n}\n\nconst WIDGET_FONT = ['fontFamily', 'fontSize', 'fontColor'];\n\n/** Values equal within the file's precision: numbers to a thousandth of a point. */\nfunction sameValue(left: unknown, right: unknown): boolean {\n if (typeof left === 'number' && typeof right === 'number') return Math.abs(left - right) <= 1e-3;\n if (left === null || right === null || typeof left !== 'object' || typeof right !== 'object')\n return left === right;\n if (Array.isArray(left) !== Array.isArray(right)) return false;\n const keys = new Set([...Object.keys(left), ...Object.keys(right)]);\n return [...keys].every((key) =>\n sameValue((left as Record<string, unknown>)[key], (right as Record<string, unknown>)[key]),\n );\n}\n\n/** A file's metadata without what its bytes say (size, checksum, dates). */\nconst metadataOf = (file: unknown) =>\n file && typeof file === 'object'\n ? {\n name: (file as { name: unknown }).name,\n mimeType: (file as { mimeType: unknown }).mimeType,\n description: (file as { description: unknown }).description,\n }\n : file;\n\n/** The fields where the engine's answer differs from the prediction. */\nfunction differences(predicted: Annotation, actual: Annotation) {\n if (predicted.subtype === 'file-attachment' && actual.subtype === 'file-attachment') {\n return fieldDifferences(\n { ...predicted, file: metadataOf(predicted.file) } as Annotation,\n { ...actual, file: metadataOf(actual.file) } as Annotation,\n );\n }\n return fieldDifferences(predicted, actual);\n}\n\nfunction fieldDifferences(predicted: Annotation, actual: Annotation) {\n const skip = unpredicted(actual);\n const names = new Set([...Object.keys(predicted), ...Object.keys(actual)]);\n return [...names]\n .filter((name) => !skip.has(name))\n .filter(\n (name) =>\n !sameValue(\n (predicted as unknown as Record<string, unknown>)[name],\n (actual as unknown as Record<string, unknown>)[name],\n ),\n )\n .map((name) => ({\n field: name,\n predicted: (predicted as unknown as Record<string, unknown>)[name],\n actual: (actual as unknown as Record<string, unknown>)[name],\n }));\n}\n\n/**\n * What a write does, predicted: `applyAnnotationPatch(read, patch)` equals the\n * annotation the engine reads back after `update(ref, patch)`, and\n * `annotationOfDraft(draft, context)` the one it reads back after\n * `create(draft)`, on every field but the ones the engine works out from its\n * drawing or stamps on each write.\n * A viewer shows a pending change this way, so the prediction is what the\n * user sees until the engine answers.\n */\nexport function runAnnotationPredictionConformance(\n runner: ConformanceTestRunner,\n opts: AnnotationPredictionConformanceOptions,\n): void {\n const { describe, test, beforeAll, afterAll, expect } = runner;\n\n describe(`annotation prediction conformance: ${opts.label}`, () => {\n let engine: Engine;\n let doc: DocumentHandle;\n let page: PageHandle;\n\n beforeAll(async () => {\n engine = await opts.makeEngine();\n doc = await opts.open(engine);\n const { pages } = await doc.pages.list();\n page = doc.page(toPageRef(pages[0]!.ref.objectNumber));\n });\n\n afterAll(async () => {\n if (doc) await doc.close();\n if (engine) await engine.destroy();\n });\n\n for (const scenario of CASES) {\n test(scenario.name, async () => {\n const { annotation: created } = await page.annotations.create(scenario.draft, {\n resources: scenario.resources,\n });\n const patch =\n typeof scenario.patch === 'function' ? scenario.patch(created) : scenario.patch;\n const predicted = applyAnnotationPatch(created, patch);\n const { annotation: actual } = await page.annotations.update(created.ref, patch, {\n resources: scenario.updateResources,\n });\n expect(differences(predicted, actual)).toEqual([]);\n });\n }\n\n for (const [at, scenario] of WIDGET_CASES.entries()) {\n test(`widget: ${scenario.name}`, async () => {\n const { widgets } = await doc.forms.create({\n family: 'text',\n name: `predicted_${at}`,\n widgets: [{ page: page.ref, rect: BOX }],\n });\n const created = widgets[0]!;\n const predicted = applyAnnotationPatch(created, { subtype: 'widget', ...scenario.patch });\n const { widget: actual } = await doc.forms.updateWidget(created.ref, scenario.patch);\n expect(differences(predicted, actual)).toEqual([]);\n });\n }\n\n for (const scenario of CREATE_CASES) {\n test(`create: ${scenario.name}`, async () => {\n const { annotation: actual } = await page.annotations.create(scenario.draft, {\n resources: scenario.resources,\n });\n // A create without a name gets a fresh UUIDv7 one.\n if (!scenario.draft.nm) expect(actual.nm).toMatch(UUID_V7);\n // What the draft can't say: the ref, place, name and author the\n // engine gives, and the drawing's box, which the engine works out.\n const predicted = annotationOfDraft(scenario.draft, {\n ref: actual.ref,\n ...(actual.nm !== null ? { nm: actual.nm } : {}),\n attribution: {\n ...(actual.author !== null ? { author: actual.author } : {}),\n ...(actual.userId !== null ? { userId: actual.userId } : {}),\n ...(actual.createdBy !== null ? { createdBy: actual.createdBy } : {}),\n ...(actual.modifiedBy !== null ? { modifiedBy: actual.modifiedBy } : {}),\n ...(actual.createdAt !== null ? { createdAt: actual.createdAt } : {}),\n ...(actual.modifiedAt !== null ? { modifiedAt: actual.modifiedAt } : {}),\n },\n ...(DRAWN_RECT_KINDS.has(actual.subtype) ? { rect: actual.rect } : {}),\n });\n expect(differences(predicted, actual)).toEqual([]);\n });\n }\n });\n}\n","import type { ConformanceTestRunner } from './runMetadataConformance';\nimport type { WidgetAnnotation, WidgetPatch } from '../annotation/kinds/widget';\nimport type { DocumentHandle } from '../engine/DocumentHandle';\nimport type { Engine } from '../engine/Engine';\nimport type { FormFieldDraft } from '../forms/draft';\nimport type { FormFieldDisplay } from '../forms/effects';\nimport type { FormFieldDTO } from '../forms/field';\nimport type { FormFieldPatch } from '../forms/patch';\nimport {\n fieldAfterReset,\n fieldAfterValue,\n formFieldAfter,\n formFieldOfDraft,\n widgetsAfterDisplay,\n type FieldWithWidgets,\n} from '../forms/predict';\nimport type { FormFieldValue } from '../forms/value';\nimport { widgetAfterPatch } from '../forms/widgets';\nimport type { PageBox } from '../geometry/pageSpace';\nimport type { AnnotationRef } from '../identity/AnnotationRef';\nimport type { FormFieldRef } from '../identity/FormFieldRef';\nimport type { PageRef } from '../identity/PageRef';\nimport { toPageRef } from '../identity/PageRef';\n\nexport interface FormPredictionConformanceOptions {\n label: string;\n makeEngine: () => Promise<Engine> | Engine;\n /** Open `PREDICTION_FIXTURE_PDF` (one blank page). Called once; every case adds its own field. */\n open: (engine: Engine) => Promise<DocumentHandle>;\n}\n\n/** The op a case predicts, then runs. */\ntype FormOp =\n | { readonly type: 'setValue'; readonly value: FormFieldValue }\n | { readonly type: 'reset' }\n | { readonly type: 'display'; readonly display: FormFieldDisplay }\n | { readonly type: 'update'; readonly patch: FormFieldPatch }\n | { readonly type: 'updateWidget'; readonly patch: WidgetPatch };\n\n/** A field, a state it is put in first, and the op predicted from there. */\ninterface PredictionCase {\n readonly name: string;\n readonly draft: (page: PageRef, name: string) => FormFieldDraft;\n /** Writes that put the field in the state the case starts from. */\n readonly before?: readonly FormOp[];\n readonly op: FormOp;\n}\n\nconst box = (x: number, y = 600, width = 120, height = 24): PageBox => ({ x, y, width, height });\n\nconst text =\n (extra: Partial<Extract<FormFieldDraft, { family: 'text' }>> = {}) =>\n (page: PageRef, name: string): FormFieldDraft => ({\n family: 'text',\n name,\n widgets: [{ page, rect: box(72) }],\n ...extra,\n });\n\nconst checkbox =\n (exportValues: readonly (string | undefined)[]) =>\n (page: PageRef, name: string): FormFieldDraft => ({\n family: 'checkbox',\n name,\n widgets: exportValues.map((exportValue, at) => ({\n page,\n rect: box(72 + at * 40, 600, 18, 18),\n ...(exportValue !== undefined ? { exportValue } : {}),\n })),\n });\n\nconst radio =\n (\n exportValues: readonly string[],\n extra: { radiosInUnison?: boolean; noToggleToOff?: boolean } = {},\n ) =>\n (page: PageRef, name: string): FormFieldDraft => ({\n family: 'radio',\n name,\n ...extra,\n widgets: exportValues.map((exportValue, at) => ({\n page,\n rect: box(72 + at * 40, 600, 18, 18),\n exportValue,\n })),\n });\n\nconst OPTIONS = [\n { label: 'Apple', value: 'a' },\n { label: 'Banana', value: 'b' },\n { label: 'Cherry', value: 'c' },\n];\n\nconst combo =\n (extra: Partial<Extract<FormFieldDraft, { family: 'combobox' }>> = {}) =>\n (page: PageRef, name: string): FormFieldDraft => ({\n family: 'combobox',\n name,\n options: OPTIONS,\n widgets: [{ page, rect: box(72) }],\n ...extra,\n });\n\nconst list =\n (extra: Partial<Extract<FormFieldDraft, { family: 'listbox' }>> = {}) =>\n (page: PageRef, name: string): FormFieldDraft => ({\n family: 'listbox',\n name,\n options: OPTIONS,\n widgets: [{ page, rect: box(72, 560, 120, 60) }],\n ...extra,\n });\n\nconst CREATES: readonly { name: string; draft: (page: PageRef, name: string) => FormFieldDraft }[] =\n [\n { name: 'text, as little as it takes', draft: text() },\n {\n name: 'text, every setting',\n draft: text({\n defaultValue: 'Hi',\n maxLength: 8,\n multiline: true,\n comb: false,\n password: false,\n readOnly: true,\n required: true,\n noExport: true,\n alternateName: 'Your name',\n mappingName: 'name',\n groupId: 'buyer',\n }),\n },\n { name: 'text in a comb', draft: text({ maxLength: 6, comb: true }) },\n {\n name: 'text, turned a quarter',\n draft: (page, name) => ({\n family: 'text',\n name,\n widgets: [{ page, box: box(72, 500, 120, 24), rotation: 90 }],\n }),\n },\n {\n name: 'text, styled',\n draft: (page, name) => ({\n family: 'text',\n name,\n widgets: [\n {\n page,\n rect: box(72),\n color: '#ff0000',\n interiorColor: '#eeeeee',\n strokeWidth: 2,\n },\n ],\n }),\n },\n { name: 'checkbox', draft: checkbox([undefined]) },\n {\n name: 'checkbox with a diamond, dashed',\n draft: (page, name) => ({\n family: 'checkbox',\n name,\n widgets: [\n {\n page,\n rect: box(72, 600, 18, 18),\n checkStyle: 'diamond',\n borderStyle: 'dashed',\n dashArray: [1, 1],\n },\n ],\n }),\n },\n { name: 'checkbox, two widgets with their own export value', draft: checkbox(['On', 'On']) },\n {\n name: 'radio group',\n draft: radio(['x', 'y'], { radiosInUnison: true, noToggleToOff: true }),\n },\n { name: 'combo box with a default', draft: combo({ defaultValue: 'b', edit: true }) },\n {\n name: 'list box with a default out of order',\n draft: list({ multiSelect: true, defaultValue: ['c', 'a'] }),\n },\n {\n name: 'signature field',\n draft: (page, name) => ({\n family: 'signature',\n name,\n widgets: [{ page, rect: box(72, 500, 160, 48) }],\n }),\n },\n {\n name: 'push button with a caption',\n draft: (page, name) => ({\n family: 'pushbutton',\n name,\n widgets: [{ page, rect: box(72), caption: 'Go' }],\n }),\n },\n ];\n\nconst value = (written: FormFieldValue): FormOp => ({ type: 'setValue', value: written });\n\nconst CASES: readonly PredictionCase[] = [\n // ── values ──\n { name: 'text: a value', draft: text(), op: value({ value: 'Hello' }) },\n {\n name: 'text: cut to its length',\n draft: text({ maxLength: 5 }),\n op: value({ value: 'Hello there' }),\n },\n {\n name: 'text: the same value again',\n draft: text(),\n before: [value({ value: 'Same' })],\n op: value({ value: 'Same' }),\n },\n {\n name: 'text: emptied',\n draft: text(),\n before: [value({ value: 'Gone' })],\n op: value({ value: null }),\n },\n { name: 'checkbox: checked', draft: checkbox([undefined]), op: value({ checked: true }) },\n {\n name: 'checkbox: unchecked',\n draft: checkbox([undefined]),\n before: [value({ checked: true })],\n op: value({ checked: false }),\n },\n {\n name: 'checkbox: two widgets check together',\n draft: checkbox(['On', 'On']),\n op: value({ checked: true }),\n },\n { name: 'checkbox: by its export value', draft: checkbox(['On']), op: value({ value: 'On' }) },\n { name: 'radio: a choice', draft: radio(['x', 'y']), op: value({ value: 'y' }) },\n {\n name: 'radio: another choice',\n draft: radio(['x', 'y']),\n before: [value({ value: 'x' })],\n op: value({ value: 'y' }),\n },\n {\n name: 'radio: cleared',\n draft: radio(['x', 'y']),\n before: [value({ value: 'x' })],\n op: value({ value: null }),\n },\n {\n name: 'radio: the same value twice, one checks',\n draft: radio(['x', 'x']),\n op: value({ value: 'x' }),\n },\n {\n name: 'radio: in unison, both check',\n draft: radio(['x', 'x'], { radiosInUnison: true }),\n op: value({ value: 'x' }),\n },\n { name: 'combo box: an option', draft: combo(), op: value({ value: 'b' }) },\n { name: 'combo box: free text', draft: combo({ edit: true }), op: value({ value: 'Durian' }) },\n {\n name: 'combo box: cleared',\n draft: combo(),\n before: [value({ value: 'b' })],\n op: value({ value: null }),\n },\n {\n name: 'list box: several, in option order',\n draft: list({ multiSelect: true }),\n op: value({ selectedValues: ['c', 'a'] }),\n },\n { name: 'list box: one', draft: list(), op: value({ selectedValues: ['b'] }) },\n {\n name: 'list box: cleared',\n draft: list(),\n before: [value({ selectedValues: ['b'] })],\n op: value({ selectedValues: [] }),\n },\n // ── reset ──\n {\n name: 'reset: text to its default',\n draft: text({ defaultValue: 'Start' }),\n before: [value({ value: 'Changed' })],\n op: { type: 'reset' },\n },\n {\n name: 'reset: text without a default',\n draft: text(),\n before: [value({ value: 'Changed' })],\n op: { type: 'reset' },\n },\n {\n name: 'reset: checkbox',\n draft: checkbox([undefined]),\n before: [value({ checked: true })],\n op: { type: 'reset' },\n },\n {\n name: 'reset: radio',\n draft: radio(['x', 'y']),\n before: [value({ value: 'y' })],\n op: { type: 'reset' },\n },\n {\n name: 'reset: combo box to its default',\n draft: combo({ defaultValue: 'c' }),\n before: [value({ value: 'a' })],\n op: { type: 'reset' },\n },\n {\n name: 'reset: list box to its default',\n draft: list({ multiSelect: true, defaultValue: ['a', 'c'] }),\n before: [value({ selectedValues: ['b'] })],\n op: { type: 'reset' },\n },\n {\n name: 'reset: list box without a default',\n draft: list(),\n before: [value({ selectedValues: ['b'] })],\n op: { type: 'reset' },\n },\n // ── display ──\n { name: 'display: hidden', draft: text(), op: { type: 'display', display: 'hidden' } },\n { name: 'display: not printed', draft: text(), op: { type: 'display', display: 'noPrint' } },\n {\n name: 'display: printed, not shown',\n draft: text(),\n op: { type: 'display', display: 'noView' },\n },\n {\n name: 'display: shown again',\n draft: text(),\n before: [{ type: 'display', display: 'hidden' }],\n op: { type: 'display', display: 'visible' },\n },\n // ── settings ──\n { name: 'update: renamed', draft: text(), op: { type: 'update', patch: { name: 'renamed' } } },\n {\n name: 'update: flags',\n draft: text(),\n op: { type: 'update', patch: { required: true, readOnly: true, multiline: true } },\n },\n {\n name: 'update: a length limit',\n draft: text(),\n op: { type: 'update', patch: { maxLength: 4 } },\n },\n {\n name: 'update: the length limit cleared',\n draft: text({ maxLength: 4 }),\n op: { type: 'update', patch: { maxLength: null } },\n },\n {\n name: 'update: a text default',\n draft: text(),\n op: { type: 'update', patch: { defaultValue: 'Default' } },\n },\n {\n name: 'update: the text default cleared',\n draft: text({ defaultValue: 'Default' }),\n op: { type: 'update', patch: { defaultValue: null } },\n },\n {\n name: 'update: tooltip and mapping name',\n draft: text(),\n op: { type: 'update', patch: { alternateName: 'Tip', mappingName: 'map' } },\n },\n {\n name: 'update: tooltip cleared',\n draft: text({ alternateName: 'Tip' }),\n op: { type: 'update', patch: { alternateName: null } },\n },\n {\n name: 'update: another group',\n draft: text({ groupId: 'buyer' }),\n op: { type: 'update', patch: { groupId: 'seller' } },\n },\n {\n name: 'update: radios in unison',\n draft: radio(['x', 'y']),\n op: { type: 'update', patch: { radiosInUnison: true } },\n },\n {\n name: 'update: new options keep the selection',\n draft: combo(),\n before: [value({ value: 'b' })],\n op: {\n type: 'update',\n patch: {\n options: [\n { label: 'B', value: 'b' },\n { label: 'D', value: 'd' },\n ],\n },\n },\n },\n {\n name: 'update: new options drop the selection',\n draft: list({ multiSelect: true, defaultValue: ['a'] }),\n before: [value({ selectedValues: ['a', 'c'] })],\n op: {\n type: 'update',\n patch: {\n options: [\n { label: 'C', value: 'c' },\n { label: 'D', value: 'd' },\n ],\n },\n },\n },\n {\n name: 'update: an editable dropdown keeps its free text',\n draft: combo({ edit: true }),\n before: [value({ value: 'Durian' })],\n op: { type: 'update', patch: { options: [{ label: 'D', value: 'd' }] } },\n },\n {\n name: 'update: a list default',\n draft: list({ multiSelect: true }),\n op: { type: 'update', patch: { defaultValue: ['c', 'b'] } },\n },\n // ── widgets ──\n {\n name: 'widget: an underline border',\n draft: text(),\n op: { type: 'updateWidget', patch: { borderStyle: 'underline' } },\n },\n {\n name: 'widget: dashed, with a pattern',\n draft: text(),\n op: { type: 'updateWidget', patch: { borderStyle: 'dashed', dashArray: [2, 1] } },\n },\n {\n name: 'widget: a new border style keeps the width',\n draft: text(),\n before: [{ type: 'updateWidget', patch: { borderStyle: 'solid', strokeWidth: 3 } }],\n op: { type: 'updateWidget', patch: { borderStyle: 'dashed' } },\n },\n {\n name: 'widget: a new width keeps the border style',\n draft: text(),\n before: [{ type: 'updateWidget', patch: { borderStyle: 'dashed' } }],\n op: { type: 'updateWidget', patch: { strokeWidth: 3 } },\n },\n {\n name: 'widget: a checkbox with a cross',\n draft: checkbox([undefined]),\n op: { type: 'updateWidget', patch: { checkStyle: 'cross' } },\n },\n {\n name: \"widget: a radio button's square\",\n draft: radio(['x', 'y']),\n op: { type: 'updateWidget', patch: { checkStyle: 'square' } },\n },\n {\n name: \"widget: back to the family's own symbol\",\n draft: checkbox([undefined]),\n before: [{ type: 'updateWidget', patch: { checkStyle: 'star' } }],\n op: { type: 'updateWidget', patch: { checkStyle: null } },\n },\n {\n name: 'widget: moved',\n draft: text(),\n op: { type: 'updateWidget', patch: { box: box(200, 300) } },\n },\n {\n name: 'widget: resized',\n draft: text(),\n op: { type: 'updateWidget', patch: { box: box(72, 600, 200, 40) } },\n },\n {\n name: 'widget: a quarter turn stands it on its side',\n draft: text(),\n op: { type: 'updateWidget', patch: { rotation: 90 } },\n },\n {\n name: 'widget: moved while turned',\n draft: text(),\n before: [{ type: 'updateWidget', patch: { rotation: 270 } }],\n op: { type: 'updateWidget', patch: { box: box(150, 400) } },\n },\n];\n\n/** A write the engine refuses: the prediction refuses it too, with the same code. */\nconst REFUSALS: readonly PredictionCase[] = [\n { name: 'a text field takes no checked', draft: text(), op: value({ checked: true }) },\n { name: 'a value no option has', draft: combo(), op: value({ value: 'zzz' }) },\n {\n name: 'two values for a single list',\n draft: list(),\n op: value({ selectedValues: ['a', 'b'] }),\n },\n {\n name: 'repeated values',\n draft: list({ multiSelect: true }),\n op: value({ selectedValues: ['a', 'a'] }),\n },\n { name: 'an export value no button has', draft: radio(['x', 'y']), op: value({ value: 'z' }) },\n {\n name: 'clearing a radio group that must keep a choice',\n draft: radio(['x', 'y'], { noToggleToOff: true }),\n before: [value({ value: 'x' })],\n op: value({ value: null }),\n },\n {\n name: 'a text widget takes no check style',\n draft: text(),\n op: { type: 'updateWidget', patch: { checkStyle: 'cross' } },\n },\n {\n name: 'a signature field holds no value',\n draft: (page, name) => ({ family: 'signature', name, widgets: [{ page, rect: box(72) }] }),\n op: value({ value: 'x' }),\n },\n];\n\n/**\n * What a form op leaves, predicted (`forms/predict.ts`): each op of every\n * family run against a fresh field, and the field and its widgets' rows the\n * engine reads back compared with the prediction, field by field. What the\n * engine stamps on a write (dates, who filled it in), its fonts from the\n * document's default appearance and the names it mints are left out.\n */\nexport function runFormPredictionConformance(\n runner: ConformanceTestRunner,\n opts: FormPredictionConformanceOptions,\n): void {\n const { describe, test, beforeAll, afterAll, expect } = runner;\n\n describe(`form prediction conformance: ${opts.label}`, () => {\n let engine: Engine;\n let doc: DocumentHandle;\n let page: PageRef;\n let named = 0;\n\n beforeAll(async () => {\n engine = await opts.makeEngine();\n doc = await opts.open(engine);\n const { pages } = await doc.pages.list();\n page = toPageRef(pages[0]!.ref.objectNumber);\n });\n\n afterAll(async () => {\n if (doc) await doc.close();\n if (engine) await engine.destroy();\n });\n\n /** The field `ref` names and its widgets' rows, as a read gives them now. */\n const read = async (ref: FormFieldRef): Promise<FieldWithWidgets> => {\n const snapshot = await doc.forms.list();\n const field = snapshot.fields.find((candidate) => sameRef(candidate.ref, ref));\n if (!field) throw new Error(`no field ${JSON.stringify(ref)}`);\n return { field, widgets: rowsOf(field, snapshot.widgets) };\n };\n\n const run = async (ref: FormFieldRef, op: FormOp): Promise<void> => {\n switch (op.type) {\n case 'setValue':\n await doc.forms.setValue(ref, op.value);\n return;\n case 'reset':\n await doc.forms.reset([ref]);\n return;\n case 'display':\n await doc.apply({ ops: [{ type: 'forms.setDisplay', field: ref, display: op.display }] });\n return;\n case 'update':\n await doc.forms.update(ref, op.patch);\n return;\n case 'updateWidget': {\n const widget = (await read(ref)).widgets[0]!;\n await doc.forms.updateWidget(widget.ref, op.patch);\n return;\n }\n }\n };\n\n const predict = (current: FieldWithWidgets, op: FormOp): FieldWithWidgets => {\n switch (op.type) {\n case 'setValue':\n return fieldAfterValue(current, op.value);\n case 'reset':\n return fieldAfterReset(current);\n case 'display':\n return { ...current, widgets: widgetsAfterDisplay(current.widgets, op.display) };\n case 'update':\n return formFieldAfter(current, op.patch);\n case 'updateWidget':\n return {\n ...current,\n widgets: current.widgets.map((row, at) =>\n at === 0 ? widgetAfterPatch(row, op.patch) : row,\n ),\n };\n }\n };\n\n for (const scenario of CREATES) {\n test(`create: ${scenario.name}`, async () => {\n const draft = scenario.draft(page, `created_${named++}`);\n const { field: created } = await doc.forms.create(draft);\n const actual = await read(created.ref);\n // What the draft can't say: the numbers, names and attribution the engine gives.\n const predicted = formFieldOfDraft(draft, {\n objectNumber: created.ref.kind === 'objectNumber' ? created.ref.objectNumber : 0,\n widgets: actual.widgets.map((row) => row.ref as AnnotationRef),\n widgetNames: actual.widgets.map((row) => row.nm ?? ''),\n groupId: actual.field.groupId,\n createdBy: actual.field.createdBy,\n createdAt: actual.field.createdAt,\n });\n expect(differences(predicted, actual)).toEqual([]);\n });\n }\n\n for (const scenario of REFUSALS) {\n test(`refused: ${scenario.name}`, async () => {\n const { field: created } = await doc.forms.create(scenario.draft(page, `field_${named++}`));\n for (const op of scenario.before ?? []) await run(created.ref, op);\n const current = await read(created.ref);\n const predicted = codeOf(() => predict(current, scenario.op));\n const actual = await run(created.ref, scenario.op).then(\n () => 'applied',\n (error: unknown) => (error as { code?: string }).code ?? 'unknown',\n );\n expect(predicted).toBe(actual);\n expect(actual === 'applied').toBe(false);\n });\n }\n\n for (const scenario of CASES) {\n test(scenario.name, async () => {\n const { field: created } = await doc.forms.create(scenario.draft(page, `field_${named++}`));\n for (const op of scenario.before ?? []) await run(created.ref, op);\n const current = await read(created.ref);\n const predicted = predict(current, scenario.op);\n await run(created.ref, scenario.op);\n const actual = await read(created.ref);\n expect(differences(predicted, actual)).toEqual([]);\n });\n }\n });\n}\n\n/** The code `run` refuses with, or `'applied'`. */\nfunction codeOf(run: () => unknown): string {\n try {\n run();\n return 'applied';\n } catch (error) {\n return (error as { code?: string }).code ?? 'unknown';\n }\n}\n\nconst sameRef = (left: FormFieldRef, right: FormFieldRef): boolean =>\n left.kind === 'objectNumber' && right.kind === 'objectNumber'\n ? left.objectNumber === right.objectNumber\n : left.kind === 'fqn' && right.kind === 'fqn' && left.name === right.name;\n\n/** The rows of a field's widgets, in the field's widget order. */\nfunction rowsOf(field: FormFieldDTO, rows: readonly WidgetAnnotation[]): WidgetAnnotation[] {\n return field.widgets.flatMap((widget) => {\n const row = rows.find(\n (candidate) =>\n candidate.ref.kind === 'objectNumber' && candidate.ref.objectNumber === widget.objectNumber,\n );\n return row ? [row] : [];\n });\n}\n\n/**\n * What a prediction leaves as it was: what the engine stamps on every write\n * (dates, who filled a field in), the fonts a widget reads from the\n * document's default appearance, and the name the engine mints.\n */\nconst UNPREDICTED = new Set([\n 'modifiedAt',\n 'modifiedBy',\n 'filledBy',\n 'filledByName',\n 'filledAt',\n 'fontFamily',\n 'fontSize',\n 'fontColor',\n]);\n\n/** Where the prediction and the read differ, by path; numbers within a thousandth of a point. */\nfunction differences(\n predicted: FieldWithWidgets,\n actual: FieldWithWidgets,\n): { path: string; predicted: unknown; actual: unknown }[] {\n const found: { path: string; predicted: unknown; actual: unknown }[] = [];\n const walk = (left: unknown, right: unknown, path: string): void => {\n if (typeof left === 'number' && typeof right === 'number') {\n if (Math.abs(left - right) > 1e-3) found.push({ path, predicted: left, actual: right });\n return;\n }\n if (left === null || right === null || typeof left !== 'object' || typeof right !== 'object') {\n if (left !== right) found.push({ path, predicted: left, actual: right });\n return;\n }\n if (Array.isArray(left) !== Array.isArray(right)) {\n found.push({ path, predicted: left, actual: right });\n return;\n }\n const keys = new Set([...Object.keys(left), ...Object.keys(right)]);\n for (const key of keys) {\n if (UNPREDICTED.has(key)) continue;\n walk(\n (left as Record<string, unknown>)[key],\n (right as Record<string, unknown>)[key],\n `${path}.${key}`,\n );\n }\n };\n walk(predicted, actual, '');\n return found;\n}\n","import { pdfOf } from './pdfOf';\nimport type { ConformanceTestRunner } from './runMetadataConformance';\nimport type { Identity } from '../auth/scope/types';\nimport type { DocumentHandle } from '../engine/DocumentHandle';\nimport type { Engine } from '../engine/Engine';\nimport { EngineError } from '../errors/EngineError';\nimport { EngineErrorCode } from '../errors/EngineErrorCode';\nimport type { FormFieldRef } from '../identity/FormFieldRef';\nimport { toPageRef } from '../identity/PageRef';\n\n/**\n * Field groups: who fills in and signs which fields. On a buyer and seller\n * contract, the same on every engine:\n * - each signer fills in and signs only their own group's fields;\n * - a field a script calculates moves with a fill of the signer's own;\n * - a designer puts fields in their own group, or one they may set;\n * - a values import leaves out the fields the token may not fill;\n * - signing a grouped signature field locks the rest of its group.\n *\n * It runs on {@link FIELD_GROUPS_PDF}.\n */\n\n/**\n * One page with a buyer's and a seller's fields, each field's group in its\n * `/EMBD_Metadata /GroupID`: `buyer_name` and `buyer_price` (buyer),\n * `seller_name` (seller), `total` (no group; a calculate script, in the\n * calculation order), and the signature fields `buyer_sig` (buyer) and\n * `seller_sig` (seller).\n */\nexport const FIELD_GROUPS_PDF = (() => {\n const group = (name: string) => `/EMBD_Metadata << /SchemaVersion 1 /GroupID (${name}) >>`;\n const text = (name: string, rect: string, extra: string) =>\n `<< /Type /Annot /Subtype /Widget /FT /Tx /T (${name}) /Rect [${rect}] /F 4 /P 3 0 R ${extra} >>`;\n const signature = (name: string, rect: string, extra: string) =>\n `<< /Type /Annot /Subtype /Widget /FT /Sig /T (${name}) /Rect [${rect}] /F 4 /P 3 0 R ${extra} >>`;\n return pdfOf([\n '<< /Type /Catalog /Pages 2 0 R /AcroForm << /Fields [4 0 R 5 0 R 6 0 R 7 0 R 8 0 R 9 0 R] ' +\n '/CO [7 0 R] /DA (/Helv 10 Tf 0 g) /DR << /Font << /Helv << /Type /Font /Subtype /Type1 ' +\n '/BaseFont /Helvetica >> >> >> >> >>',\n '<< /Type /Pages /Kids [3 0 R] /Count 1 >>',\n '<< /Type /Page /Parent 2 0 R /MediaBox [0 0 400 400] /Contents 10 0 R /Resources << >> ' +\n '/Annots [4 0 R 5 0 R 6 0 R 7 0 R 8 0 R 9 0 R] >>',\n text('buyer_name', '20 340 180 360', group('buyer')),\n text('buyer_price', '20 300 180 320', group('buyer')),\n text('seller_name', '200 340 380 360', group('seller')),\n text('total', '20 260 180 280', '/AA << /C << /S /JavaScript /JS (event.value = 1;) >> >>'),\n signature('buyer_sig', '20 100 180 150', group('buyer')),\n signature('seller_sig', '200 100 380 150', group('seller')),\n '<< /Length 0 >>\\nstream\\n\\nendstream',\n ]);\n})();\n\n/** The tokens of the contract's parties. */\nexport const FIELD_GROUP_TOKENS = {\n /** The buyer: fills in and signs the buyer's fields. */\n buyer: {\n scope: ['doc.open', 'doc.render', 'fields:fill:group=buyer', 'fields:sign:group=buyer'],\n identity: { userId: 'alice', displayName: 'Alice' },\n },\n /** The seller, as a share link would grant it: everything on the seller's fields. */\n seller: { scope: ['doc.open', 'doc.render', 'fields:*:group=seller'], identity: {} },\n /** The designer: her fields go in legal; she may put fields in the buyer's group too. */\n designer: {\n scope: ['doc.open', 'doc.render', 'doc.forms.modify', 'fields:set-group:group=buyer'],\n identity: { userId: 'lisa', groupId: 'legal' },\n },\n everything: { scope: ['*'], identity: {} },\n} as const satisfies Record<string, { scope: readonly string[]; identity: Identity }>;\n\nexport type FieldGroupToken = keyof typeof FIELD_GROUP_TOKENS;\n\nexport interface FieldGroupsConformanceOptions {\n label: string;\n makeEngine: () => Promise<Engine> | Engine;\n /** Open a fresh copy of `bytes` (default {@link FIELD_GROUPS_PDF}) with `scope`, acting for `identity`. */\n open: (\n engine: Engine,\n scope: readonly string[],\n identity: Identity,\n bytes?: Uint8Array,\n ) => Promise<DocumentHandle>;\n /**\n * Whether a signing completes on this engine with a placeholder CMS, so\n * the lock it installs can be read back. Default `true`.\n */\n completesSignings?: boolean;\n}\n\nconst PAGE = toPageRef(3);\nconst field = (name: string): FormFieldRef => ({ kind: 'fqn', name });\n/** A DER `SEQUENCE`: what a completion takes as a CMS, without judging it. */\nconst PLACEHOLDER_CMS = new Uint8Array([0x30, 0x06, 0x02, 0x01, 0x01, 0x02, 0x01, 0x02]);\n\nexport function runFieldGroupsConformance(\n runner: ConformanceTestRunner,\n opts: FieldGroupsConformanceOptions,\n): void {\n const { describe, test, beforeAll, afterAll, expect } = runner;\n\n describe(`field groups conformance: ${opts.label}`, () => {\n let engine: Engine;\n\n beforeAll(async () => {\n engine = await opts.makeEngine();\n });\n\n afterAll(async () => {\n if (engine) await engine.destroy();\n });\n\n const as = async (\n token: FieldGroupToken,\n body: (doc: DocumentHandle) => Promise<void>,\n bytes?: Uint8Array,\n ) => {\n const { scope, identity } = FIELD_GROUP_TOKENS[token];\n const doc = await opts.open(engine, scope, identity, bytes);\n try {\n await body(doc);\n } finally {\n await doc.close();\n }\n };\n\n const refusal = (attempt: Promise<unknown>): Promise<unknown> =>\n attempt.then(\n () => null,\n (error: unknown) => error,\n );\n\n const codeOf = (error: unknown) =>\n EngineError.is(error) ? error.code : error === null ? 'resolved' : String(error);\n\n const valueOf = async (doc: DocumentHandle, name: string) =>\n (\n (await doc.forms.list()).fields.find((f) => f.name === name) as\n | { value?: string }\n | undefined\n )?.value;\n\n test('each token lists the groups it may fill in, sign and assign', async () => {\n const rights: Record<string, unknown> = {};\n for (const token of Object.keys(FIELD_GROUP_TOKENS) as FieldGroupToken[]) {\n await as(token, async (doc) => {\n rights[token] = doc.security.fieldRights();\n // The lists answer as `allowsField` does, group by group.\n const listed = doc.security.fieldRights();\n for (const groupId of ['buyer', 'seller', 'legal', null]) {\n for (const action of ['fill', 'sign'] as const) {\n const right = listed[action];\n const inList = right.all || (groupId !== null && right.groups.includes(groupId));\n expect(inList).toBe(doc.security.allowsField(action, { groupId }));\n }\n }\n for (const groupId of ['buyer', 'seller', 'legal']) {\n const right = listed.setGroup;\n const inList = right.all || right.groups.includes(groupId);\n expect(inList).toBe(doc.security.allowsField('set-group', { groupId }));\n }\n });\n }\n expect(rights).toEqual({\n buyer: {\n fill: { all: false, groups: ['buyer'] },\n sign: { all: false, groups: ['buyer'] },\n setGroup: { all: false, groups: [] },\n },\n seller: {\n fill: { all: false, groups: ['seller'] },\n sign: { all: false, groups: ['seller'] },\n setGroup: { all: false, groups: ['seller'] },\n },\n // Designing the form includes filling it in.\n designer: {\n fill: { all: true },\n sign: { all: false, groups: [] },\n setGroup: { all: false, groups: ['buyer', 'legal'] },\n },\n everything: { fill: { all: true }, sign: { all: true }, setGroup: { all: true } },\n });\n });\n\n test(\"a field's group reads from its /EMBD_Metadata; its widget has none\", async () => {\n await as('everything', async (doc) => {\n const { fields, widgets } = await doc.forms.list();\n const groups = Object.fromEntries(fields.map((f) => [f.name, f.groupId]));\n expect(groups).toEqual({\n buyer_name: 'buyer',\n buyer_price: 'buyer',\n seller_name: 'seller',\n total: null,\n buyer_sig: 'buyer',\n seller_sig: 'seller',\n });\n expect(widgets.every((w) => w.groupId === null)).toBe(true);\n });\n });\n\n test('each signer fills in only their own fields', async () => {\n await as('buyer', async (doc) => {\n await doc.forms.setValue(field('buyer_name'), { value: 'Alice' });\n expect(await valueOf(doc, 'buyer_name')).toBe('Alice');\n const refused = await refusal(doc.forms.setValue(field('seller_name'), { value: 'x' }));\n expect(codeOf(refused)).toBe(EngineErrorCode.Forbidden);\n expect((refused as EngineError).details).toMatchObject({\n required: 'fields:fill:group=seller',\n });\n // A field in no group is an unrestricted filler's.\n expect(codeOf(await refusal(doc.forms.setValue(field('total'), { value: '9' })))).toBe(\n EngineErrorCode.Forbidden,\n );\n expect(doc.security.allowsField('fill', { groupId: 'buyer' })).toBe(true);\n expect(doc.security.allowsField('fill', { groupId: 'seller' })).toBe(false);\n });\n await as('seller', async (doc) => {\n await doc.forms.setValue(field('seller_name'), { value: 'Bob' });\n expect(codeOf(await refusal(doc.forms.setValue(field('buyer_name'), { value: 'x' })))).toBe(\n EngineErrorCode.Forbidden,\n );\n });\n });\n\n test(\"a calculated field moves with a fill of the signer's own, never alone\", async () => {\n await as('buyer', async (doc) => {\n await doc.apply({\n ops: [\n { type: 'forms.setValue', field: field('buyer_price'), value: { value: '1200' } },\n { type: 'forms.setValue', field: field('total'), value: { value: '1452' } },\n ],\n });\n expect(await valueOf(doc, 'total')).toBe('1452');\n const alone = await refusal(\n doc.apply({\n ops: [{ type: 'forms.setValue', field: field('total'), value: { value: '1' } }],\n }),\n );\n expect(codeOf(alone)).toBe(EngineErrorCode.Forbidden);\n // The other side's field never rides along.\n const across = await refusal(\n doc.apply({\n ops: [\n { type: 'forms.setValue', field: field('buyer_price'), value: { value: '1' } },\n { type: 'forms.setValue', field: field('seller_name'), value: { value: 'x' } },\n ],\n }),\n );\n expect(codeOf(across)).toBe(EngineErrorCode.Forbidden);\n expect(await valueOf(doc, 'buyer_price')).toBe('1200');\n });\n });\n\n test('a reset puts back only fields the signer may fill', async () => {\n await as('buyer', async (doc) => {\n await doc.forms.setValue(field('buyer_name'), { value: 'Alice' });\n await doc.forms.reset([field('buyer_name')]);\n expect(await valueOf(doc, 'buyer_name')).toBe('');\n expect(codeOf(await refusal(doc.forms.reset()))).toBe(EngineErrorCode.Forbidden);\n });\n });\n\n test('each signer signs only their own signature field', async () => {\n await as('buyer', async (doc) => {\n const refused = await refusal(doc.signatures.prepare({ field: field('seller_sig') }));\n expect(codeOf(refused)).toBe(EngineErrorCode.Forbidden);\n const prepared = await doc.signatures.prepare({ field: field('buyer_sig') });\n await doc.signatures.cancel(prepared.signingId);\n expect(doc.security.allowsField('sign', { groupId: 'buyer' })).toBe(true);\n expect(doc.security.allowsField('sign', { groupId: 'seller' })).toBe(false);\n });\n });\n\n test('signing a grouped field locks the rest of its group, for everyone', async () => {\n if (opts.completesSignings === false) return;\n // The lock follows the field's group, whoever signs: here a token that\n // may do everything, which the lock then refuses too.\n await as('everything', async (doc) => {\n await doc.forms.setValue(field('buyer_name'), { value: 'Alice' });\n const prepared = await doc.signatures.prepare({ field: field('buyer_sig') });\n await doc.signatures.complete({\n signingId: prepared.signingId,\n cms: PLACEHOLDER_CMS,\n expectedVersion: prepared.expectedVersion,\n });\n const locked = await refusal(doc.forms.setValue(field('buyer_name'), { value: 'x' }));\n expect(codeOf(locked)).toBe(EngineErrorCode.ProtectedDocument);\n // The other group's fields, and its signature field, stay open.\n await doc.forms.setValue(field('seller_name'), { value: 'Bob' });\n const next = await doc.signatures.prepare({ field: field('seller_sig') });\n await doc.signatures.cancel(next.signingId);\n });\n });\n\n test('a designer puts fields in her own group, or one she may set', async () => {\n await as('designer', async (doc) => {\n const own = await doc.forms.create({\n family: 'text',\n name: 'clause',\n widgets: [{ page: PAGE, rect: { x: 20, y: 200, width: 100, height: 20 } }],\n });\n expect(own.field.groupId).toBe('legal');\n const buyers = await doc.forms.create({\n family: 'text',\n name: 'buyer_address',\n groupId: 'buyer',\n widgets: [{ page: PAGE, rect: { x: 140, y: 200, width: 100, height: 20 } }],\n });\n expect(buyers.field.groupId).toBe('buyer');\n const refused = await refusal(\n doc.forms.create({\n family: 'text',\n name: 'seller_address',\n groupId: 'seller',\n widgets: [{ page: PAGE, rect: { x: 260, y: 200, width: 100, height: 20 } }],\n }),\n );\n expect(codeOf(refused)).toBe(EngineErrorCode.Forbidden);\n expect((refused as EngineError).details).toMatchObject({\n required: 'fields:set-group:group=seller',\n });\n const moved = await doc.forms.update(own.field.ref, { groupId: 'buyer' });\n expect(moved.field.groupId).toBe('buyer');\n expect(codeOf(await refusal(doc.forms.update(own.field.ref, { groupId: 'seller' })))).toBe(\n EngineErrorCode.Forbidden,\n );\n expect(doc.security.allowsField('set-group', { groupId: 'buyer' })).toBe(true);\n expect(doc.security.allowsField('set-group', { groupId: 'seller' })).toBe(false);\n });\n });\n\n test('a copied form keeps the groups the importer may set; a restore keeps every one', async () => {\n let buyers: Awaited<ReturnType<DocumentHandle['forms']['export']>> | null = null;\n let everyone: Awaited<ReturnType<DocumentHandle['forms']['export']>> | null = null;\n await as('everything', async (doc) => {\n buyers = await doc.forms.export({ fields: [field('buyer_name')] });\n everyone = await doc.forms.export();\n });\n const blank = await (async () => {\n let bytes: Uint8Array | null = null;\n await as('everything', async (doc) => {\n for (const { ref } of (await doc.forms.list()).fields) await doc.forms.delete(ref);\n bytes = await doc.download();\n });\n return bytes!;\n })();\n await as(\n 'designer',\n async (doc) => {\n const copied = await doc.forms.import(buyers!, { attribution: 'stamp' });\n expect(copied.fields.map((f) => [f.name, f.groupId])).toEqual([['buyer_name', 'buyer']]);\n const refused = await refusal(doc.forms.import(everyone!, { attribution: 'stamp' }));\n expect(codeOf(refused)).toBe(EngineErrorCode.Forbidden);\n },\n blank,\n );\n await as(\n 'everything',\n async (doc) => {\n const restored = await doc.forms.import(everyone!, { attribution: 'restore' });\n expect(Object.fromEntries(restored.fields.map((f) => [f.name, f.groupId]))).toMatchObject(\n {\n buyer_name: 'buyer',\n seller_name: 'seller',\n total: null,\n },\n );\n },\n blank,\n );\n });\n\n test('a values import leaves out the fields the signer may not fill', async () => {\n let bundle: Awaited<ReturnType<DocumentHandle['forms']['export']>> | null = null;\n await as('everything', async (doc) => {\n await doc.forms.setValue(field('buyer_name'), { value: 'Alice' });\n await doc.forms.setValue(field('seller_name'), { value: 'Bob' });\n bundle = await doc.forms.export();\n });\n await as('buyer', async (doc) => {\n const result = await doc.forms.importValues(bundle!, { attribution: 'stamp' });\n expect(result.fields.map((f) => f.name)).toEqual(['buyer_name']);\n expect(result.dropped.some((drop) => drop.reason === 'fill-not-allowed')).toBe(true);\n expect(await valueOf(doc, 'seller_name')).toBe('');\n });\n });\n });\n}\n"],"mappings":";;;;;;;;;;;;;;;;;AAMA,MAAa,mBAAmB,EAAE,OAAO,CAAC,GAAG,EAAE;;;;;;;ACwD/C,SAAgB,uBACd,QACA,MACM;CACN,MAAM,EAAE,UAAU,MAAM,WAAW,UAAU,WAAW;CAExD,SAAS,yBAAyB,KAAK,eAAe;EACpD,IAAI;EAEJ,UAAU,YAAY;GACpB,SAAS,MAAM,KAAK,WAAW;EACjC,CAAC;EAED,SAAS,YAAY;GACnB,IAAI,QAAQ,MAAM,OAAO,QAAQ;EACnC,CAAC;EAED,KAAK,sCAAsC,YAAY;GACrD,MAAM,MAAM,MAAMA,eAAY,QAAQ,IAAI;GAC1C,IAAI;IACF,MAAM,OAAO,MAAM,IAAI,SAAS,IAAI;IACpC,OAAO,IAAI,CAAC,CAAC,cAAc,KAAK,QAAQ,QAAQ;IAChD,OAAO,KAAK,OAAO,CAAC,CAAC,QAAQ,wBAAwB;GACvD,UAAU;IACR,MAAM,IAAI,MAAM;GAClB;EACF,CAAC;EAED,KAAK,qDAAqD,YAAY;GACpE,MAAM,MAAM,MAAMA,eAAY,QAAQ,IAAI;GAC1C,IAAI;IACF,MAAM,IAAI,IAAI,SAAS,IAAI;IAC3B,EAAE,MAAM,MAAM;IACd,MAAM,OAAO,CAAC,CAAC,CAAC,QAAQ,eAAeC,kBAAAA,UAAU;GACnD,UAAU;IACR,MAAM,IAAI,MAAM;GAClB;EACF,CAAC;EAED,KAAK,sDAAsD,YAAY;GACrE,MAAM,MAAM,MAAMD,eAAY,QAAQ,IAAI;GAC1C,IAAI;IACF,MAAM,IAAI,IAAI,SAAS,IAAI;IAC3B,MAAM,IAAI,IAAI,SAAS,IAAI;IAC3B,EAAE,MAAM,MAAM;IACd,MA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