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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (135) hide show
  1. package/dist/AnnotationList-CkijRHet.d.cts +27163 -0
  2. package/dist/AnnotationList-CkijRHet.d.ts +27163 -0
  3. package/dist/Change-CKoxfTNY.js +889 -0
  4. package/dist/Change-CKoxfTNY.js.map +1 -0
  5. package/dist/Change-CjImsrN0.cjs +1020 -0
  6. package/dist/Change-CjImsrN0.cjs.map +1 -0
  7. package/dist/DocumentRenderService-BfFdFSwI.cjs +120 -0
  8. package/dist/DocumentRenderService-BfFdFSwI.cjs.map +1 -0
  9. package/dist/DocumentRenderService-DV3J9lMz.js +85 -0
  10. package/dist/DocumentRenderService-DV3J9lMz.js.map +1 -0
  11. package/dist/{DocumentSecurityService-_JRjqvoI.d.ts → DocumentSecurityService-CU1M6Q7m.d.ts} +100 -112
  12. package/dist/{DocumentSecurityService-ClTZc0zO.d.cts → DocumentSecurityService-e6vp2de8.d.cts} +100 -112
  13. package/dist/LocalDocumentHandle-D02FMm-Z.cjs +53 -0
  14. package/dist/LocalDocumentHandle-D02FMm-Z.cjs.map +1 -0
  15. package/dist/LocalDocumentHandle-DAPdaOt_.js +30 -0
  16. package/dist/LocalDocumentHandle-DAPdaOt_.js.map +1 -0
  17. package/dist/LocalEngine-DFoBm4B3.d.cts +1565 -0
  18. package/dist/LocalEngine-DPriFujS.d.ts +1565 -0
  19. package/dist/PageInsertBlankInput-CXHAM7l6.cjs +17 -0
  20. package/dist/PageInsertBlankInput-CXHAM7l6.cjs.map +1 -0
  21. package/dist/PageInsertBlankInput-DhVYVJ_S.js +12 -0
  22. package/dist/PageInsertBlankInput-DhVYVJ_S.js.map +1 -0
  23. package/dist/authority-B3BklsB4.js +2239 -0
  24. package/dist/authority-B3BklsB4.js.map +1 -0
  25. package/dist/authority-DLMNR7ff.cjs +2676 -0
  26. package/dist/authority-DLMNR7ff.cjs.map +1 -0
  27. package/dist/builders-CNj0POeY.js +161 -0
  28. package/dist/builders-CNj0POeY.js.map +1 -0
  29. package/dist/builders-Cgdp_YCn.cjs +184 -0
  30. package/dist/builders-Cgdp_YCn.cjs.map +1 -0
  31. package/dist/calibrate-7T3fnP8-.js +2404 -0
  32. package/dist/calibrate-7T3fnP8-.js.map +1 -0
  33. package/dist/calibrate-DJBXnhLE.cjs +2919 -0
  34. package/dist/calibrate-DJBXnhLE.cjs.map +1 -0
  35. package/dist/charmap-Cprti1ta.js +239 -0
  36. package/dist/charmap-Cprti1ta.js.map +1 -0
  37. package/dist/charmap-aYlefQP9.cjs +304 -0
  38. package/dist/charmap-aYlefQP9.cjs.map +1 -0
  39. package/dist/conformance.cjs +16753 -5247
  40. package/dist/conformance.cjs.map +1 -1
  41. package/dist/conformance.d.cts +928 -165
  42. package/dist/conformance.d.ts +928 -165
  43. package/dist/conformance.js +16731 -5268
  44. package/dist/conformance.js.map +1 -1
  45. package/dist/format-Bp3QFSH1.cjs +574 -0
  46. package/dist/format-Bp3QFSH1.cjs.map +1 -0
  47. package/dist/format-Dgg428Kb.js +461 -0
  48. package/dist/format-Dgg428Kb.js.map +1 -0
  49. package/dist/index.cjs +330 -103
  50. package/dist/index.d.cts +2 -2
  51. package/dist/index.d.ts +2 -2
  52. package/dist/index.js +14 -5
  53. package/dist/pageRefs-B3ur7Ckm.cjs +51 -0
  54. package/dist/pageRefs-B3ur7Ckm.cjs.map +1 -0
  55. package/dist/pageRefs-DkbuxSCV.js +40 -0
  56. package/dist/pageRefs-DkbuxSCV.js.map +1 -0
  57. package/dist/public.cjs +57 -0
  58. package/dist/public.d.cts +5 -0
  59. package/dist/public.d.ts +5 -0
  60. package/dist/public.js +9 -0
  61. package/dist/resolveAnnotationDraft-7Ke4nV7F.cjs +3646 -0
  62. package/dist/resolveAnnotationDraft-7Ke4nV7F.cjs.map +1 -0
  63. package/dist/resolveAnnotationDraft-CUpf0SMh.js +3167 -0
  64. package/dist/resolveAnnotationDraft-CUpf0SMh.js.map +1 -0
  65. package/dist/{resolver-inAVzsWt.js → resolver-CzxmD9Ck.js} +294 -144
  66. package/dist/resolver-CzxmD9Ck.js.map +1 -0
  67. package/dist/{resolver-CYVNV4hn.cjs → resolver-D2OCtE8F.cjs} +347 -143
  68. package/dist/resolver-D2OCtE8F.cjs.map +1 -0
  69. package/dist/runtime-Cl0v56mm.d.ts +2032 -0
  70. package/dist/runtime-p1WDzDo4.d.cts +2032 -0
  71. package/dist/runtime.cjs +733 -284
  72. package/dist/runtime.cjs.map +1 -1
  73. package/dist/runtime.d.cts +5 -1348
  74. package/dist/runtime.d.ts +5 -1348
  75. package/dist/runtime.js +396 -179
  76. package/dist/runtime.js.map +1 -1
  77. package/dist/schema-C-gU4vj7.cjs +3034 -0
  78. package/dist/schema-C-gU4vj7.cjs.map +1 -0
  79. package/dist/schema-DzlUNk38.js +2081 -0
  80. package/dist/schema-DzlUNk38.js.map +1 -0
  81. package/dist/schemas-Berf1swF.cjs +2481 -0
  82. package/dist/schemas-Berf1swF.cjs.map +1 -0
  83. package/dist/schemas-D6xOGjqg.js +1654 -0
  84. package/dist/schemas-D6xOGjqg.js.map +1 -0
  85. package/dist/subtype-CG4WpIRj.js +129 -0
  86. package/dist/subtype-CG4WpIRj.js.map +1 -0
  87. package/dist/subtype-aDt5TFmK.cjs +158 -0
  88. package/dist/subtype-aDt5TFmK.cjs.map +1 -0
  89. package/dist/validation.cjs +578 -0
  90. package/dist/validation.cjs.map +1 -0
  91. package/dist/validation.d.cts +174 -0
  92. package/dist/validation.d.ts +174 -0
  93. package/dist/validation.js +571 -0
  94. package/dist/validation.js.map +1 -0
  95. package/dist/value-BFS1R8ek.cjs +435 -0
  96. package/dist/value-BFS1R8ek.cjs.map +1 -0
  97. package/dist/value-Dhc8eYcx.js +340 -0
  98. package/dist/value-Dhc8eYcx.js.map +1 -0
  99. package/dist/viewport-BJW13EGZ.js +540 -0
  100. package/dist/viewport-BJW13EGZ.js.map +1 -0
  101. package/dist/viewport-DlL5Bxbg.cjs +671 -0
  102. package/dist/viewport-DlL5Bxbg.cjs.map +1 -0
  103. package/dist/wire.cjs +1056 -379
  104. package/dist/wire.cjs.map +1 -1
  105. package/dist/wire.d.cts +15069 -725
  106. package/dist/wire.d.ts +15069 -725
  107. package/dist/wire.js +825 -239
  108. package/dist/wire.js.map +1 -1
  109. package/package.json +10 -1
  110. package/dist/AbortError-Cq2igpZ6.cjs +0 -38
  111. package/dist/AbortError-Cq2igpZ6.cjs.map +0 -1
  112. package/dist/AbortError-DHqPBnYc.js +0 -27
  113. package/dist/AbortError-DHqPBnYc.js.map +0 -1
  114. package/dist/AnnotationListSnapshot-D3mFut1e.d.cts +0 -6871
  115. package/dist/AnnotationListSnapshot-D3mFut1e.d.ts +0 -6871
  116. package/dist/Engine-Bx0NOfmd.d.cts +0 -1264
  117. package/dist/Engine-DxtpCYcP.d.ts +0 -1264
  118. package/dist/PageInsertBlankInput-CqXBmFhN.cjs +0 -449
  119. package/dist/PageInsertBlankInput-CqXBmFhN.cjs.map +0 -1
  120. package/dist/PageInsertBlankInput-cHq9-i-z.js +0 -378
  121. package/dist/PageInsertBlankInput-cHq9-i-z.js.map +0 -1
  122. package/dist/builders-Bqm8yTpi.cjs +0 -3564
  123. package/dist/builders-Bqm8yTpi.cjs.map +0 -1
  124. package/dist/builders-Dqo2X-dt.js +0 -3121
  125. package/dist/builders-Dqo2X-dt.js.map +0 -1
  126. package/dist/fold-2V29cxCV.cjs +0 -447
  127. package/dist/fold-2V29cxCV.cjs.map +0 -1
  128. package/dist/fold-CdEJTBTn.js +0 -334
  129. package/dist/fold-CdEJTBTn.js.map +0 -1
  130. package/dist/resolver-CYVNV4hn.cjs.map +0 -1
  131. package/dist/resolver-inAVzsWt.js.map +0 -1
  132. package/dist/schemas-BLARNCgx.js +0 -3113
  133. package/dist/schemas-BLARNCgx.js.map +0 -1
  134. package/dist/schemas-DIqFMmrC.cjs +0 -4468
  135. package/dist/schemas-DIqFMmrC.cjs.map +0 -1
package/dist/runtime.js CHANGED
@@ -1,128 +1,318 @@
1
- import { $ as buildCommentThreads, A as USAGE_INCOMPLETE, B as changedKeys, C as validateSearchRegex, D as wordBefore, E as wordAt, F as assessmentOf, G as stableStringify, H as parsePdfValue, I as combine, J as appearanceImpactOf, K as decodeFieldRefKey, L as conclude, M as evaluateStep, N as restrictionsOf, O as DEFAULT_EDGE_RESOLVER_BUDGET, P as sameEffectiveValue, Q as shiftsExistingAnnotationIndices, R as primaryFinding, S as validateSearchQuery, T as matchLiteral, U as pdfValueEquals, V as dictEntries, W as refsOf, X as changesAnnotationList, Y as semanticEqual, Z as invalidatesWeakIndexRefs, _ as SEARCH_SNIPPET_CONTEXT, _t as richTextPlainText, a as PDF_BITS, at as normalizeAnnotationPatch, b as SEARCH_REGEX_MAX_LENGTH, bt as decodeSubmitFormFlags, c as searchContentEpoch, ct as resolveBinarySource, d as buildPageTextLayout, dt as knownWeakAnnotationState, et as isStateAnnotation, f as expandTextRangeToLine, ft as revisionTokensEqual, g as textSegmentsForRange, gt as richTextParagraphsFromPlainText, h as textGlyphQuad, ht as isValidPageObjectNumber, i as pdfPermissions, it as normalizeAnnotationDraft, j as restrictionsFor, k as EdgeResolver, l as searchRectsForRange, lt as NO_ANNOTATION_FLAGS, m as textGlyphAt, mt as encodeStableIdKey, n as collab, nt as classifyRelation, o as decodePdfBits, ot as normalizeAttachmentFileSource, p as expandTextRangeToWord, pt as decodeStableIdKey, q as encodeFieldRefKey, r as materializePdfPermissions, rt as refKey, s as canonicalSearchQuery, st as sniffBinaryMetadata, t as caps, tt as buildThreads, u as searchSegmentsForRange, ut as UNKNOWN_WEAK_ANNOTATION_STATE, v as buildSnippet, vt as DEFAULT_PDF_SAVE_MODE, w as foldOptionsFor, x as matchRegex, y as matchPageText, yt as createPageImageHandle, z as worstVerdict } from "./builders-Dqo2X-dt.js";
2
- import { _ as pdfRectSize, a as deserializeError, c as glyphLooseBounds, d as normalizePdfRect, f as pdfQuadBounds, g as pdfRectHeight, h as pdfRectFromOriginSize, i as EngineError, l as glyphLooseQuad, m as pdfQuadFromCorners, n as foldText, o as serializeError, p as pdfQuadCorners, r as toOriginalRange, s as _defineProperty, t as SEARCH_FOLD_VERSION, u as isRotatedGeometryRun, v as pdfRectToOriginSize, y as pdfRectWidth } from "./fold-CdEJTBTn.js";
3
- import { a as charRangeForTextOffsets, c as PDF_CODE_TO_SUBTYPE, d as subtypeFromCode, f as EngineErrorCode, i as charMapViolation, l as PDF_SUBTYPE_TO_CODE, n as boundaryTextOffset, o as sliceTextByChars, r as charBoundaryAtTextOffset, s as ANNOTATION_SUBTYPES, t as PAGE_INSERT_BLANK_MAX_COUNT, u as PdfAnnotationSubtypeCode } from "./PageInsertBlankInput-cHq9-i-z.js";
4
- import { S as protectedCapabilities, _ as levelAllows, a as expandRawScope, b as lockNameCovers, c as parseScope, d as MissingIdentity, f as PermissionDenied, g as fieldLockFor, h as deriveProtection, i as checkSetGroup, l as validateScopeArray, m as SIGNATURE_POLICY_VERSION, n as checkCapability, o as expandedCapabilities, r as checkCollab, s as filterMatches, t as checkAnyCapability, u as InvalidScope, v as levelFromPermission, x as minLevel, y as lockCovers } from "./resolver-inAVzsWt.js";
5
- import { n as isAbortError, t as AbortError } from "./AbortError-DHqPBnYc.js";
6
- //#region src/promise/AbortablePromise.ts
7
- let _Symbol$species;
8
- _Symbol$species = Symbol.species;
1
+ import { a as deletedFieldOf, c as formExportRowsOf, d as decodeSubmitFormFlags, f as fieldScriptOf, g as writesScripts, h as widgetActionsOf, i as formValuesImportFacts, l as WIDGET_ACTION_EVENTS, m as needsScriptRight, n as WIDGET_FLAG_NAMES, o as formResetFacts, p as isFieldScript, r as formImportFacts, s as fieldMatches, t as fieldValueOf, u as actionWriteOf } from "./value-Dhc8eYcx.js";
2
+ import { B as deletedWith, C as measurementPoint, Ct as pdfRectToOriginSize, D as validAreaBoundary, E as scaleOf, Et as quarterTurnOf, F as buildCommentThreads, I as isStateAnnotation, K as bundlePageMapping, L as standardStateModelOf, M as appearanceChangeOf, N as appearanceImpactOf, O as DRAWN_RECT_KINDS, P as semanticEqual, Q as ANNOTATION_FIELD_SPACES, R as buildThreads, S as measurementReadout, St as pdfRectSize, T as polygonArea, Tt as pdfRectWidth, X as resourceIdOf, Z as compareIsoDateTime, _ as assertPdfFloat, _t as pdfQuadBounds, at as sameColor, b as isDimension, bt as pdfRectHeight, c as assertRichTextAgreement, ct as richTextPlainText, d as faceForFreeTextFont, dt as pdfPointsBounds, et as ANNOTATION_FIELD_NAMES, f as familyKey, ft as pdfTurnOfDrawn, g as touchesCaption, gt as normalizePdfRect, h as resolveMeasurementDraft, ht as normalizePdfQuad, i as assertDeclaredFields, it as rgbOf, j as UNBAKED_KINDS, lt as pdfPointTurned, m as isStandardFontName, mt as isSamePdfRect, ot as DEFAULT_RICH_TEXT_BODY, p as freeTextFontForFace, pt as pdfTurnOfUpright, rt as colorOf, st as richTextParagraphsFromPlainText, tt as ANNOTATION_RESOURCE_ROLES, u as STANDARD_FACES, ut as pdfPointUnturned, v as assertWritableMeasure, vt as pdfQuarterTurnBox, w as pathLength, wt as pdfRectTurnedBounds, x as isReadout, xt as pdfRectIntersection, y as deriveMeasurementLabel, yt as pdfRectFromOriginSize, z as classifyRelation } from "./resolveAnnotationDraft-CUpf0SMh.js";
3
+ import { _ as serializeError, a as formWidget, c as STANDARD_FONTS, d as pageRefsEqual, f as toPageRef, g as deserializeError, h as EngineError, i as encodeFieldRefKey, l as decodePageKey, m as annotationKey, n as validNumberFormat, o as toFieldRef, p as isValidPageObjectNumber, r as decodeFieldRefKey, s as NO_ANNOTATION_FLAGS, t as formatMeasurement, u as encodePageKey, v as _defineProperty, y as EngineErrorCode } from "./format-Dgg428Kb.js";
4
+ import { $ as pdfAppearanceTurnOf, A as createPdfTextLayout, At as renderTargetArea, B as mapActionNode, C as resolveAnnotationPatch, Ct as pageQuadOf, D as pageGeometryOf, Dt as pageTransform, E as createTextLayout, Et as pdfRectOf, F as pdfAnnotationOf, G as mapLinkTarget, H as mapAnnotationActions, I as pdfAnnotationPatchOf, J as pageDestinationOf, K as mapPageActions, L as pageMeasureOf, M as pageAnnotationOf, Mt as renderSize, N as pageAnnotationPatchOf, O as pageSearchSliceOf, Ot as renderAreaTransform, P as pdfAnnotationDraftOf, R as pageViewportsOf, S as resolveAnnotationDraft, St as pagePointOf, T as shapeForRect, Tt as pdfQuadOf, U as mapDocumentActions, V as mapActionTree, W as mapFieldActions, X as ANNOTATION_DEFAULTS, Y as pdfDestinationOf, Z as annotationDefaultsOf, _ as pagePointUnturned, _t as isAbortError, a as squareMetres, at as DEFAULT_BUNDLE_LIMITS, b as pageTurnOfDrawn, bt as isRotatedGeometryRun, c as foldText, ct as ANNOTATION_RESOURCE_ROLE_NAMES, d as appearanceTurnOf, dt as hasAnnotationResources, et as toAttachmentRef, f as applyAnnotationPatch, ft as resolveAnnotationResources, g as pagePointTurned, gt as AbortError, h as pageGlyphLooseQuad, ht as resolveBinarySource, i as areaUnitLabel, it as bundleCodec, j as pageAnnotationDraftOf, jt as renderTransform, k as pageTextSegmentOf, kt as renderMatrix, l as toOriginalRange, lt as annotationResourceBuffers, m as pageGlyphLooseBounds, mt as sniffBinaryMetadata, n as measureFromRatio, nt as assertAnnotationBundle, o as squareOf, ot as assertWithinLimit, p as drawnPointsOf, pt as withFileFromResource, r as METRES, rt as assertAnnotationBundleManifest, s as SEARCH_FOLD_VERSION, st as manifestBytesOf, t as measureFromKnownLength, tt as AnnotationTransfer, u as annotationOfDraft, ut as assertAnnotationResources, v as pagePointsBounds, vt as glyphLooseBounds, w as resolveRectCommand, wt as pdfPointOf, x as pageTurnOfUpright, xt as pageBoxOf, y as pageQuadBounds, yt as glyphLooseQuad, z as pdfMeasureOf } from "./calibrate-7T3fnP8-.js";
5
+ import { $ as pageListOf, A as sameEffectiveValue, B as refsOf, C as searchQueryOf, D as restrictionsFor, E as USAGE_INCOMPLETE, F as worstVerdict, G as pageFormFieldOf, H as placedWidgetOf, I as changedKeys, J as pdfFormFieldDraftOf, K as pageFormSnapshotOf, L as dictEntries, M as combine, N as conclude, O as evaluateStep, P as primaryFinding, Q as pageLayoutOf, R as parsePdfValue, S as matchPageText, T as EdgeResolver, U as draftWritesScripts, V as stableStringify, W as pageFieldActionsOf, X as pageAppearancesOf, Y as pdfWidgetPlacementOf, Z as pdfRenderTargetOf, _ as opIdOf, _t as DEFAULT_MEDIA_BOX, a as annotationWriteCapability, at as concatAnnotationLists, b as SEARCH_SNIPPET_CONTEXT, c as authorizeAnnotationUpdate, ct as normalizeAttachmentFileSource, d as authorizeFieldWrite, dt as generateUuidV7, et as pageSpaceBoxesOf, f as authorizeUnprotected, ft as DEFAULT_PDF_SAVE_MODE, g as isKeptRefusal, gt as resolvePageLayers, h as changeFingerprint, ht as imageSourceOfBytes, i as annotationWriteCapabilities, it as deletedAnnotationsOf, j as assessmentOf, k as restrictionsOf, l as authorizeCapability, lt as familyOfSubtype, m as decodePdfBits, mt as createPageImageHandle, n as allowsFieldWrite, nt as annotationPatchBetween, o as authorizeAnnotationCreate, ot as closeExportSelection, p as PDF_BITS, pt as checkImageQuality, q as pageWidgetOf, r as allowsSomeFieldWrite, rt as mergeAnnotationPatch, s as authorizeAnnotationDelete, st as annotationImportFacts, t as allowsCapability, tt as visibleBoxesOf, u as authorizeFieldGroup, ut as generateUuid, v as canonicalSearchQuery, vt as pageBoxesOf, w as DEFAULT_EDGE_RESOLVER_BUDGET, x as buildSnippet, y as searchContentEpoch, yt as pageRotationOf, z as pdfValueEquals } from "./authority-B3BklsB4.js";
6
+ import { A as MissingIdentity, C as lockCovers, D as decodeAnnotKey, E as protectedCapabilities, O as encodeAnnotKey, S as levelFromPermission, T as minLevel, _ as deriveProtection, a as checkFieldAction, b as isProtectableCapability, c as expandRawScope, d as filterMatches, f as parseScope, g as SIGNATURE_POLICY_VERSION, h as PROTECTABLE_CAPABILITIES, i as checkCollab, j as PermissionDenied, k as InvalidScope, l as expandedCapabilities, n as checkAnyFieldAction, o as checkSetGroup, p as validateScopeArray, r as checkCapability, s as collabTargetOf, t as checkAnyCapability, u as fieldRightsOf, v as describeProtection, w as lockNameCovers, x as levelAllows, y as fieldLockFor } from "./resolver-CzxmD9Ck.js";
7
+ import { S as AbortablePromise, _ as OBJECT_NUMBER_CEILING, a as reorderedList, b as objectNumbersIn, c as validateSearchQuery, d as matchLiteral, f as wordAt, g as assertFormBundleManifest, h as assertFormBundle, i as reorderPart, l as validateSearchRegex, m as FormTransfer, n as anchorOf, o as SEARCH_REGEX_MAX_LENGTH, p as wordBefore, r as positionIndex, s as matchRegex, t as viewportForPoint, u as foldOptionsFor, v as OBJECT_NUMBER_ISSUE_LIMIT, x as parseObjectNumberRanges, y as formatObjectNumberRanges } from "./viewport-BJW13EGZ.js";
8
+ import { a as sliceText, d as shownAppearances, i as charRangeForTextOffsets, l as ANNOTATION_APPEARANCE_MODES, n as charBoundaryAtTextOffset, r as charMapViolation, t as boundaryTextOffset, u as appearanceModesOf } from "./charmap-Cprti1ta.js";
9
+ import { a as subtypeFromCode, i as PdfAnnotationSubtypeCode, n as PDF_CODE_TO_SUBTYPE, r as PDF_SUBTYPE_TO_CODE, t as ANNOTATION_SUBTYPES } from "./subtype-CG4WpIRj.js";
10
+ import { n as pageRefsIn, t as mapPageRefs } from "./pageRefs-DkbuxSCV.js";
11
+ import { S as deletedAttachmentOf, _ as assertChoiceDefault, a as objectNumbersReferencedBy, b as isNoOpWrite, c as defaultEntryOfDraft, d as formFieldAfter, f as formFieldOfDraft, g as widgetAfterPatch, h as fitWidgetToFamily, i as objectNumbersNamedBy, l as fieldAfterReset, m as widgetsAfterDisplay, n as isUndoChange, o as resolveChangeResources, p as topRowOf, r as itemWrote, s as formEffectOps, t as isSkippedItem, u as fieldAfterValue, v as fieldValueWriteOf, x as valueEntriesEqual, y as isAtDefault } from "./Change-CKoxfTNY.js";
12
+ import { t as PAGE_INSERT_BLANK_MAX_COUNT } from "./PageInsertBlankInput-DhVYVJ_S.js";
13
+ import { i as pdfPermissions, n as collab, r as materializePdfPermissions, t as caps } from "./builders-CNj0POeY.js";
14
+ import { n as isLocalPage, r as LOCAL_ENGINE_BRAND, t as isLocalDocument } from "./LocalDocumentHandle-DAPdaOt_.js";
15
+ import { a as snapTileScale, i as snapFullPageViewport, n as appearanceLatticeScale, o as isLocalEngine, r as snapAppearanceScale, t as CONTINUOUS_RENDER_POLICY } from "./DocumentRenderService-DV3J9lMz.js";
16
+ //#region src/events/DocumentEventStream.ts
9
17
  /**
10
- * Awaitable Promise subclass with abort and progress.
11
- *
12
- * Symbol.species returns plain Promise so chained .then/.catch/.finally
13
- * return regular promises and never try to synthesize a new
14
- * AbortablePromise (which would have no executor).
18
+ * `on(type, listener)` built on a stream's `subscribe`, so both engines
19
+ * filter the same way and a type listener counts as a subscriber (the cloud
20
+ * opens its live stream for the first one).
21
+ */
22
+ function subscribeToType(subscribe, type, listener) {
23
+ return subscribe((event) => {
24
+ if (event.type === type) listener(event);
25
+ });
26
+ }
27
+ //#endregion
28
+ //#region src/events/EventHub.ts
29
+ /**
30
+ * The in-process implementation of `DocumentEventStream`, shared by both
31
+ * engine shells (one hub per open `DocumentHandle`). The engine that
32
+ * performs a mutation publishes here at confirmation time; the cloud
33
+ * engine's remote channel will also publish here for other sessions'
34
+ * mutations — listeners never learn which transport delivered an event.
15
35
  *
16
- * Settlement contract:
17
- * - The first settlement wins. resolve/reject handed to the executor
18
- * are wrapped so that any subsequent call (whether by the executor,
19
- * by abort(), or by both racing) becomes a silent no-op.
20
- * - abort() rejects the public promise with AbortError immediately,
21
- * even if the executor never observes the AbortSignal. The executor
22
- * still receives the AbortSignal so it can stop real work
23
- * cooperatively (release a queue slot, abort fetch, post a worker
24
- * abort, etc.). Anything the executor does after that — including
25
- * a late resolve(value), a late reject(error), or a rejected inner
26
- * Promise inside AbortablePromise.run — is dropped silently.
27
- * - abort() after settlement is a no-op.
36
+ * Delivery contract:
37
+ * - synchronous fan-out in subscription order;
38
+ * - error isolation: a throwing listener is re-thrown on a microtask
39
+ * (so it surfaces to the host's unhandled-error reporting) without
40
+ * blocking other listeners or failing the mutation path;
41
+ * - `lastServerId` tracks the highest remote cursor seen, for the
42
+ * remote channel's reconnect/backfill.
28
43
  */
29
- var AbortablePromise = class AbortablePromise extends Promise {
30
- static get [_Symbol$species]() {
31
- return Promise;
32
- }
33
- constructor(executor) {
34
- const ctrl = new AbortController();
35
- const progressCbs = /* @__PURE__ */ new Set();
36
- const state = { settled: false };
37
- let capturedReject;
38
- super((resolve, reject) => {
39
- capturedReject = reject;
40
- const wrappedResolve = (value) => {
41
- if (state.settled) return;
42
- state.settled = true;
43
- resolve(value);
44
- };
45
- const wrappedReject = (reason) => {
46
- if (state.settled) return;
47
- state.settled = true;
48
- reject(reason);
49
- };
50
- const progress = (p) => {
51
- if (state.settled) return;
52
- for (const cb of progressCbs) try {
53
- cb(p);
54
- } catch {}
55
- };
56
- executor(wrappedResolve, wrappedReject, progress, ctrl.signal);
44
+ var EventHub = class {
45
+ constructor(onListenerError = (err) => {
46
+ queueMicrotask(() => {
47
+ throw err;
57
48
  });
58
- _defineProperty(this, "signal", void 0);
59
- _defineProperty(this, "_ctrl", void 0);
60
- _defineProperty(this, "_progressCbs", void 0);
61
- _defineProperty(this, "_state", void 0);
62
- _defineProperty(this, "_internalReject", void 0);
63
- this._ctrl = ctrl;
64
- this.signal = ctrl.signal;
65
- this._progressCbs = progressCbs;
66
- this._state = state;
67
- this._internalReject = capturedReject;
68
- }
69
- /**
70
- * Abort the underlying operation.
71
- *
72
- * - If the promise has already settled, this is a no-op.
73
- * - Otherwise the public promise rejects synchronously with an
74
- * AbortError (wrapping the supplied reason if it is not already an
75
- * AbortError) and the AbortSignal fires for any cooperative
76
- * cancellation the executor wired up.
77
- */
78
- abort(reason) {
79
- if (this._state.settled) return;
80
- if (this._ctrl.signal.aborted) return;
81
- const err = reason instanceof AbortError ? reason : new AbortError(reason);
82
- this._state.settled = true;
83
- this._ctrl.abort(err);
84
- this._internalReject(err);
49
+ }) {
50
+ this.onListenerError = onListenerError;
51
+ _defineProperty(this, "listeners", /* @__PURE__ */ new Set());
52
+ _defineProperty(this, "serverId", null);
85
53
  }
86
- /**
87
- * Subscribe to progress events. Returns an unsubscribe function.
88
- */
89
- onProgress(cb) {
90
- this._progressCbs.add(cb);
54
+ subscribe(listener) {
55
+ this.listeners.add(listener);
91
56
  return () => {
92
- this._progressCbs.delete(cb);
57
+ this.listeners.delete(listener);
93
58
  };
94
59
  }
95
- /**
96
- * Wrap a value in an already-resolved AbortablePromise. Mirrors Promise.resolve.
97
- */
98
- static resolveValue(value) {
99
- return new AbortablePromise((resolve) => resolve(value));
60
+ on(type, listener) {
61
+ return subscribeToType((all) => this.subscribe(all), type, listener);
62
+ }
63
+ publish(event) {
64
+ if ("origin" in event) {
65
+ const { serverId } = event.origin;
66
+ if (serverId !== null) this.serverId = this.serverId === null ? serverId : Math.max(this.serverId, serverId);
67
+ }
68
+ for (const listener of [...this.listeners]) try {
69
+ listener(event);
70
+ } catch (err) {
71
+ this.onListenerError(err);
72
+ }
73
+ }
74
+ lastServerId() {
75
+ return this.serverId;
76
+ }
77
+ /** Drop every listener (handle close). Idempotent. */
78
+ clear() {
79
+ this.listeners.clear();
80
+ }
81
+ };
82
+ /**
83
+ * Stamps provenance onto events a mutation path produces. One per open
84
+ * handle: the engine shell constructs it with the instance's `sessionId`
85
+ * (and, on cloud, the authenticated `sub` when known) and hands it to the
86
+ * mutation services — they publish results, never build origins.
87
+ */
88
+ var SessionEventPublisher = class {
89
+ constructor(hub, sessionId, sub = null) {
90
+ this.hub = hub;
91
+ this.sessionId = sessionId;
92
+ this.sub = sub;
100
93
  }
101
94
  /**
102
- * Wrap a thrown reason in an already-rejected AbortablePromise.
95
+ * Publish what one write of this session just committed: one
96
+ * event per fact, in order, all carrying the write's `opId` as
97
+ * `origin.tx`.
103
98
  */
104
- static rejectReason(reason) {
105
- return new AbortablePromise((_resolve, reject) => reject(reason));
99
+ publishWrite(opId, ...events) {
100
+ this.publishChange(opId, events);
106
101
  }
107
102
  /**
108
- * Run an async function as an AbortablePromise so callers get .abort() and .signal.
109
- * The async function receives the AbortSignal (and a progress emitter) so it can
110
- * cooperate with the abort.
111
- *
112
- * If abort() fires while the inner async function is still running, the
113
- * public promise rejects with AbortError immediately. The inner async
114
- * function's eventual settlement (resolve or reject) is funneled through
115
- * the wrapped settlers and silently dropped — including a late rejection
116
- * from the underlying work, which prevents an UnhandledRejection because
117
- * the .then(resolve, reject) below "handles" it via the no-op.
103
+ * Publish what one change committed: its events as {@link publishWrite}
104
+ * does, and for an undo, the `opId` of the change it undid.
118
105
  */
119
- static run(fn) {
120
- return new AbortablePromise((resolve, reject, progress, signal) => {
121
- fn(signal, progress).then(resolve, reject);
106
+ publishChange(opId, events, undoOf) {
107
+ const ts = Date.now();
108
+ events.forEach((event, index) => {
109
+ this.hub.publish({
110
+ ...event,
111
+ origin: {
112
+ kind: "local",
113
+ sessionId: this.sessionId,
114
+ sub: this.sub,
115
+ ts,
116
+ serverId: null,
117
+ tx: {
118
+ id: opId,
119
+ index,
120
+ count: events.length
121
+ },
122
+ ...undoOf !== void 0 ? { undoOf } : {}
123
+ }
124
+ });
122
125
  });
123
126
  }
124
127
  };
125
128
  //#endregion
129
+ //#region src/events/changeEvents.ts
130
+ /**
131
+ * The events a change publishes: each op's events as its single verb
132
+ * publishes them, in op order. An op an undo left alone entirely publishes
133
+ * nothing. The publisher stamps them all with the change's `opId`.
134
+ */
135
+ function changeEvents(result) {
136
+ return result.items.flatMap(itemEvents);
137
+ }
138
+ function itemEvents(item) {
139
+ if (isSkippedItem(item)) return [];
140
+ switch (item.type) {
141
+ case "annotations.create": {
142
+ const { type: _type, ...result } = item;
143
+ return [{
144
+ type: "annotations.created",
145
+ ...result
146
+ }];
147
+ }
148
+ case "annotations.update": {
149
+ const { type: _type, skipped: _skipped, ...result } = item;
150
+ return [{
151
+ type: "annotations.updated",
152
+ ...result
153
+ }];
154
+ }
155
+ case "annotations.delete": {
156
+ const { type: _type, ...result } = item;
157
+ return [{
158
+ type: "annotations.deleted",
159
+ deleted: deletedAnnotationsOf(result),
160
+ ...result
161
+ }];
162
+ }
163
+ case "annotations.reorder": {
164
+ const { type: _type, ...result } = item;
165
+ return [{
166
+ type: "annotations.reordered",
167
+ ...result
168
+ }];
169
+ }
170
+ case "annotations.restore": {
171
+ const { type: _type, ...result } = item;
172
+ return [{
173
+ type: "annotations.restored",
174
+ ...result
175
+ }];
176
+ }
177
+ case "annotations.import": {
178
+ const { type: _type, ...result } = item;
179
+ return annotationImportFacts(result).map((fact) => ({
180
+ type: "annotations.created",
181
+ ...fact
182
+ }));
183
+ }
184
+ case "forms.import": {
185
+ const { type: _type, ...result } = item;
186
+ return formImportFacts(result).map((fact) => ({
187
+ type: "forms.created",
188
+ ...fact
189
+ }));
190
+ }
191
+ case "forms.importValues": {
192
+ const { type: _type, ...result } = item;
193
+ return formValuesImportFacts(result).map((fact) => ({
194
+ type: "forms.valueSet",
195
+ ...fact
196
+ }));
197
+ }
198
+ case "forms.setValue": {
199
+ const { type: _type, ...result } = item;
200
+ return [{
201
+ type: "forms.valueSet",
202
+ ...result
203
+ }];
204
+ }
205
+ case "forms.reset": {
206
+ const { type: _type, skipped: _skipped, ...result } = item;
207
+ return formResetFacts(result).map((fact) => ({
208
+ type: "forms.valueSet",
209
+ ...fact
210
+ }));
211
+ }
212
+ case "forms.setDisplay":
213
+ case "forms.setAppearanceText":
214
+ case "forms.setSignatureAppearance": {
215
+ const { type: _type, ...result } = item;
216
+ return [{
217
+ type: "forms.updated",
218
+ ...result
219
+ }];
220
+ }
221
+ case "forms.update": {
222
+ const { type: _type, skipped: _skipped, ...result } = item;
223
+ return [{
224
+ type: "forms.updated",
225
+ ...result
226
+ }];
227
+ }
228
+ case "forms.create": {
229
+ const { type: _type, ...result } = item;
230
+ return [{
231
+ type: "forms.created",
232
+ ...result
233
+ }];
234
+ }
235
+ case "forms.delete": {
236
+ const { type: _type, ...result } = item;
237
+ return [{
238
+ type: "forms.deleted",
239
+ deleted: deletedFieldOf(result),
240
+ ...result
241
+ }];
242
+ }
243
+ case "forms.restore": {
244
+ const { type: _type, ...result } = item;
245
+ return [{
246
+ type: "forms.restored",
247
+ ...result
248
+ }];
249
+ }
250
+ case "forms.addWidget": {
251
+ const { type: _type, ...result } = item;
252
+ return [{
253
+ type: "forms.widgetAdded",
254
+ ...result
255
+ }];
256
+ }
257
+ case "forms.removeWidget": {
258
+ const { type: _type, ...result } = item;
259
+ return [{
260
+ type: "forms.widgetRemoved",
261
+ ...result
262
+ }];
263
+ }
264
+ case "forms.deleteWidget": {
265
+ const { type: _type, ...result } = item;
266
+ return [{
267
+ type: "forms.widgetDeleted",
268
+ ...result
269
+ }];
270
+ }
271
+ case "forms.restoreWidget": {
272
+ const { type: _type, ...result } = item;
273
+ return [{
274
+ type: "forms.widgetRestored",
275
+ ...result
276
+ }];
277
+ }
278
+ case "forms.reorderWidgets": {
279
+ const { type: _type, ...result } = item;
280
+ return [{
281
+ type: "forms.widgetsReordered",
282
+ ...result
283
+ }];
284
+ }
285
+ case "forms.reorderCalculations": {
286
+ const { type: _type, ...result } = item;
287
+ return [{
288
+ type: "forms.calculationsReordered",
289
+ ...result
290
+ }];
291
+ }
292
+ case "forms.updateWidget": {
293
+ const { type: _type, skipped: _skipped, ...result } = item;
294
+ return [{
295
+ type: "forms.widgetUpdated",
296
+ ...result
297
+ }];
298
+ }
299
+ case "metadata.update": {
300
+ const { type: _type, skipped: _skipped, ...result } = item;
301
+ return [{
302
+ type: "metadata.updated",
303
+ ...result
304
+ }];
305
+ }
306
+ case "metadata.updateCustom": {
307
+ const { type: _type, skipped: _skipped, ...result } = item;
308
+ return [{
309
+ type: "metadata.customUpdated",
310
+ ...result
311
+ }];
312
+ }
313
+ }
314
+ }
315
+ //#endregion
126
316
  //#region src/engine/document-security-state.ts
127
317
  function securityStateFromHead(head) {
128
318
  return {
@@ -168,20 +358,20 @@ function permissionInfoWithAdvisory(info, pdfBits) {
168
358
  }
169
359
  /**
170
360
  * Translate a {@link PdfBits} view into the capability-shaped
171
- * {@link PdfPermissionAdvisory}. The rules here MUST mirror the bit
172
- * combinations the scope resolver uses for `pdf.permissions`
173
- * expansion — `doc.print.high` requires bit 12 AND bit 3, etc.
361
+ * {@link PdfPermissionAdvisory}: what `pdf.permissions` grants on a file
362
+ * with these bits.
174
363
  */
175
364
  function advisoryFromPdfBits(b) {
365
+ const granted = new Set(materializePdfPermissions(b));
176
366
  return {
177
- canPrint: b.bit3,
178
- canPrintHigh: b.bit12 && b.bit3,
179
- canCopy: b.bit5,
180
- canAnnotate: b.bit6,
181
- canFillForms: b.bit6 || b.bit9,
182
- canModifyForms: b.bit6 && b.bit4,
183
- canModifyPages: b.bit4,
184
- canAssemble: b.bit11
367
+ canPrint: granted.has("doc.print"),
368
+ canPrintHigh: granted.has("doc.print.high"),
369
+ canCopy: granted.has("doc.text.copy"),
370
+ canAnnotate: granted.has("doc.annotate.modify"),
371
+ canFillForms: granted.has("doc.forms.fill"),
372
+ canModifyForms: granted.has("doc.forms.modify"),
373
+ canModifyPages: granted.has("doc.pages.modify"),
374
+ canAssemble: granted.has("doc.pages.assemble")
185
375
  };
186
376
  }
187
377
  function securityStateFromProbe(info, opts = {}) {
@@ -211,68 +401,95 @@ function securityStateFromProbe(info, opts = {}) {
211
401
  };
212
402
  }
213
403
  //#endregion
214
- //#region src/engine/DocumentRenderService.ts
215
- const CONTINUOUS_RENDER_POLICY = { kind: "continuous" };
404
+ //#region src/scheduling/place.ts
405
+ const PLACE_ORDER = {
406
+ elsewhere: 0,
407
+ near: 1,
408
+ visible: 2
409
+ };
410
+ /** More device pixels than any screen shows, so pixels never outweigh the rest of a rank. */
411
+ const PIXEL_SPAN = 2 ** 40;
412
+ const ELSEWHERE = {
413
+ place: "elsewhere",
414
+ pixels: 0
415
+ };
416
+ const ON_SCREEN = {
417
+ place: "visible",
418
+ pixels: 0
419
+ };
420
+ /** Whether `a` is the better place: on screen before near before elsewhere, then more pixels. */
421
+ function placedBefore(a, b) {
422
+ const order = PLACE_ORDER[a.place] - PLACE_ORDER[b.place];
423
+ return order !== 0 ? order > 0 : a.pixels > b.pixels;
424
+ }
216
425
  /**
217
- * Conform a FULL-PAGE viewport to a render policy — the ONE snap
218
- * implementation, shared by every engine and plugin. Pure and explicit
219
- * by design:
220
- *
221
- * - `continuous` → identity (local/cloud plugin code stays byte-identical).
222
- * - `lattice` → returns a `width`-kind viewport at the smallest ladder
223
- * width ≥ the requested detail (snap UP: always crisp, CSS downscales
224
- * for free), capped at the largest width — detail beyond the cap is the
225
- * tile pyramid's job, by design.
226
- * - `scale`-kind requests convert through the page's width in PDF user
227
- * units — pass `opts.pageWidth` (the caller has it from the layout);
228
- * omitting it for a scale viewport under a lattice policy is a
229
- * programmer error and throws `InvalidArg`.
426
+ * A job's place in one view: its page's role there, except that a part of a
427
+ * visible page that's off screen (a tile of the ring around what shows) is
428
+ * `near`.
230
429
  */
231
- function snapFullPageViewport(policy, viewport, opts) {
232
- if (policy.kind === "continuous") return viewport;
233
- if (policy.fullPage.widths.length === 0) throw new EngineError(EngineErrorCode.InvalidArg, "render policy has an empty width ladder");
234
- const widths = [...policy.fullPage.widths].sort((a, b) => a - b);
235
- let requested;
236
- if (viewport.kind === "width") requested = viewport.width;
237
- else {
238
- const pageWidth = opts?.pageWidth;
239
- if (pageWidth === void 0 || pageWidth <= 0) throw new EngineError(EngineErrorCode.InvalidArg, "snapping a scale viewport to a width lattice requires opts.pageWidth");
240
- requested = (viewport.scale ?? 1) * pageWidth;
241
- }
430
+ function placeIn(entry, job) {
431
+ if (!entry) return ELSEWHERE;
432
+ if (entry.role === "near") return {
433
+ place: "near",
434
+ pixels: 0
435
+ };
436
+ if (job.region && entry.visible && !overlaps(job.region, entry.visible)) return {
437
+ place: "near",
438
+ pixels: 0
439
+ };
242
440
  return {
243
- kind: "width",
244
- width: widths.find((width) => width >= requested) ?? widths[widths.length - 1]
441
+ place: "visible",
442
+ pixels: entry.pixels
245
443
  };
246
444
  }
247
445
  /**
248
- * Conform an annotation-appearance scale to the policy's appearance
249
- * lattice. Same discipline as {@link snapFullPageViewport}: identity on
250
- * continuous (and when the policy carries no appearance block), snap UP,
251
- * cap at the largest point. Callers derive `scale` from the page's
252
- * effective render scale (`snappedWidth / pageWidth`, × devicePixelRatio
253
- * as needed) so composites stay crisp against the page raster.
446
+ * A job's place among a document's views: in the view it serves, or, when it
447
+ * serves none (or one that said nothing), the best place its page has in any
448
+ * view. A job about the whole document serves what's shown, so it counts as
449
+ * on screen. While no view says anything, every job is on screen alike, and
450
+ * jobs run in the order they were asked.
451
+ */
452
+ function placeFor(job, views) {
453
+ if (views.size === 0 || !job.page) return ON_SCREEN;
454
+ const objectNumber = job.page.objectNumber;
455
+ const served = job.view === void 0 ? void 0 : views.get(job.view);
456
+ if (served) return placeIn(served.get(objectNumber), job);
457
+ let best = ELSEWHERE;
458
+ for (const pages of views.values()) {
459
+ const placed = placeIn(pages.get(objectNumber), job);
460
+ if (placedBefore(placed, best)) best = placed;
461
+ }
462
+ return best;
463
+ }
464
+ /**
465
+ * How soon a job runs among those that may run: higher first. It compares, in
466
+ * turn:
467
+ * 1. background last: a `low` call is about nothing the views show;
468
+ * 2. where its page is: on screen, then just off it, then elsewhere;
469
+ * 3. its priority: `high` (the picture of the page itself) before `auto`;
470
+ * 4. a whole page before a part of one: a tile is only of use once its page
471
+ * is there;
472
+ * 5. the device pixels its page shows.
473
+ * Equal ranks run in the order they were asked, so a caller sequences its own work.
254
474
  */
255
- function snapAppearanceScale(policy, scale) {
256
- if (policy.kind === "continuous" || policy.appearances === void 0) return scale;
257
- if (policy.appearances.scales.length === 0) throw new EngineError(EngineErrorCode.InvalidArg, "render policy has an empty appearance-scale lattice");
258
- const scales = [...policy.appearances.scales].sort((a, b) => a - b);
259
- return scales.find((s) => s >= scale) ?? scales[scales.length - 1];
475
+ function rank(job, placed) {
476
+ let level = job.priority === "low" ? 0 : 1;
477
+ level = level * 3 + PLACE_ORDER[placed.place];
478
+ level = level * 2 + (job.priority === "high" ? 1 : 0);
479
+ level = level * 2 + (job.region ? 0 : 1);
480
+ return level * PIXEL_SPAN + Math.min(PIXEL_SPAN - 1, Math.round(placed.pixels));
260
481
  }
261
482
  /**
262
- * Conform a tile-pyramid scale to the policy's tile lattice — the third
263
- * member of the `snap<PolicyBlock><Quantity>` family. Identity on
264
- * continuous and while the deployment doesn't advertise a `tiles` block
265
- * (the block is reserved until the deep-zoom vertical ships server-side;
266
- * the tiling client uses its own default pyramid then — see
267
- * plugin-render). Snap UP, cap at the largest scale: per-tile cost is
268
- * constant by construction (`tileSize²` pixels regardless of level), so
269
- * the cap bounds artifact COUNT, not memory.
483
+ * Whether rank `a` beats rank `b` on more than pixels (any of the first four
484
+ * steps of {@link rank}). A running job gives way only to a job that clearly
485
+ * outranks it, so two pages on screen never stop each other's work, and jobs
486
+ * don't flip back and forth while the camera moves.
270
487
  */
271
- function snapTileScale(policy, scale) {
272
- if (policy.kind === "continuous" || policy.tiles === void 0) return scale;
273
- if (policy.tiles.scales.length === 0) throw new EngineError(EngineErrorCode.InvalidArg, "render policy has an empty tile-scale lattice");
274
- const scales = [...policy.tiles.scales].sort((a, b) => a - b);
275
- return scales.find((s) => s >= scale) ?? scales[scales.length - 1];
488
+ function clearlyOutranks(a, b) {
489
+ return Math.floor(a / PIXEL_SPAN) > Math.floor(b / PIXEL_SPAN);
490
+ }
491
+ function overlaps(a, b) {
492
+ return a.x < b.x + b.width && b.x < a.x + a.width && a.y < b.y + b.height && b.y < a.y + a.height;
276
493
  }
277
494
  //#endregion
278
495
  //#region src/engine/passwordPrompt.ts
@@ -280,7 +497,7 @@ function snapTileScale(policy, scale) {
280
497
  * Derive the high-level password prompt from the raw security state.
281
498
  *
282
499
  * The function is pure and total — every `DocumentSecurityState`
283
- * maps to exactly one `PasswordPrompt`. Use this as the SINGLE source
500
+ * maps to exactly one `PasswordPrompt`. Use this as the single source
284
501
  * of truth wherever the SDK exposes a "do you need a password?" flag:
285
502
  * both `LocalDocumentSecurityService` and `CloudDocumentSecurityService`
286
503
  * call it, so the contract can never drift.
@@ -310,15 +527,17 @@ function snapTileScale(policy, scale) {
310
527
  *
311
528
  * 6. fallthrough → { state: 'none' } open and nothing more available
312
529
  */
313
- function passwordPromptFromState(state) {
530
+ function passwordPromptFromState(state, incorrect = false) {
314
531
  if (state.encryption.state === "none") return { state: "none" };
315
532
  if (!state.permissions.known) return {
316
533
  state: "required",
317
- hint: null
534
+ hint: null,
535
+ incorrect
318
536
  };
319
537
  if (state.encryption.requiresPassword && state.permissions.openedAs === "none") return {
320
538
  state: "required",
321
- hint: "user"
539
+ hint: "user",
540
+ incorrect
322
541
  };
323
542
  if (state.permissions.openedAs === "owner") return { state: "none" };
324
543
  if (state.permissions.canUpgradeToOwner) return {
@@ -340,10 +559,8 @@ const EMPTY_TRANSFER = Object.freeze([]);
340
559
  *
341
560
  * The `transfer` argument is optional; omitting it (or passing `[]`)
342
561
  * is the explicit, type-checked way to say "I declare this message
343
- * carries no transferables." That's structurally identical to the
344
- * shape the v2 walker generated for non-binary messages, but here
345
- * the declaration is at construction time, in the producer's own
346
- * code, where the knowledge actually lives.
562
+ * carries no transferables." The declaration is made at construction
563
+ * time, in the producer's own code, where the knowledge actually lives.
347
564
  *
348
565
  * wirePack({ kind: 'metadata.read', jobId, docId })
349
566
  * wirePack({ kind: 'open.fatMem', jobId, docId, bytes }, [bytes])
@@ -356,6 +573,6 @@ function wirePack(payload, transfer = EMPTY_TRANSFER) {
356
573
  };
357
574
  }
358
575
  //#endregion
359
- export { ANNOTATION_SUBTYPES, AbortError, AbortablePromise, CONTINUOUS_RENDER_POLICY, DEFAULT_EDGE_RESOLVER_BUDGET, DEFAULT_PDF_SAVE_MODE, EMPTY_TRANSFER, EdgeResolver, EngineError, EngineErrorCode, InvalidScope, MissingIdentity, NO_ANNOTATION_FLAGS, PAGE_INSERT_BLANK_MAX_COUNT, PDF_BITS, PDF_CODE_TO_SUBTYPE, PDF_SUBTYPE_TO_CODE, PdfAnnotationSubtypeCode, PermissionDenied, SEARCH_FOLD_VERSION, SEARCH_REGEX_MAX_LENGTH, SEARCH_SNIPPET_CONTEXT, SIGNATURE_POLICY_VERSION, UNKNOWN_WEAK_ANNOTATION_STATE, USAGE_INCOMPLETE, advisoryFromPdfBits, appearanceImpactOf, assessmentOf, boundaryTextOffset, buildCommentThreads, buildPageTextLayout, buildSnippet, buildThreads, canonicalSearchQuery, caps, changedKeys, changesAnnotationList, charBoundaryAtTextOffset, charMapViolation, charRangeForTextOffsets, checkAnyCapability, checkCapability, checkCollab, checkSetGroup, classifyRelation, collab, combine, conclude, createPageImageHandle, decodeFieldRefKey, decodePdfBits, decodeStableIdKey, decodeSubmitFormFlags, deriveProtection, deserializeError, dictEntries, encodeFieldRefKey, encodeStableIdKey, evaluateStep, expandRawScope, expandTextRangeToLine, expandTextRangeToWord, expandedCapabilities, fieldLockFor, filterMatches, foldOptionsFor, foldText, glyphLooseBounds, glyphLooseQuad, invalidatesWeakIndexRefs, isAbortError, isRotatedGeometryRun, isStateAnnotation, isValidPageObjectNumber, knownWeakAnnotationState, levelAllows, levelFromPermission, lockCovers, lockNameCovers, matchLiteral, matchPageText, matchRegex, materializePdfPermissions, minLevel, normalizeAnnotationDraft, normalizeAnnotationPatch, normalizeAttachmentFileSource, normalizePdfRect, parsePdfValue, parseScope, passwordPromptFromState, pdfPermissions, pdfQuadBounds, pdfQuadCorners, pdfQuadFromCorners, pdfRectFromOriginSize, pdfRectHeight, pdfRectSize, pdfRectToOriginSize, pdfRectWidth, pdfValueEquals, permissionInfoFromProbe, permissionInfoWithAdvisory, primaryFinding, protectedCapabilities, refKey, refsOf, resolveBinarySource, restrictionsFor, restrictionsOf, revisionTokensEqual, richTextParagraphsFromPlainText, richTextPlainText, sameEffectiveValue, searchContentEpoch, searchRectsForRange, searchSegmentsForRange, securityStateFromHead, securityStateFromProbe, semanticEqual, serializeError, shiftsExistingAnnotationIndices, sliceTextByChars, snapAppearanceScale, snapFullPageViewport, snapTileScale, sniffBinaryMetadata, stableStringify, subtypeFromCode, textGlyphAt, textGlyphQuad, textSegmentsForRange, toOriginalRange, validateScopeArray, validateSearchQuery, validateSearchRegex, wirePack, wordAt, wordBefore, worstVerdict };
576
+ export { ANNOTATION_APPEARANCE_MODES, ANNOTATION_DEFAULTS, ANNOTATION_FIELD_NAMES, ANNOTATION_FIELD_SPACES, ANNOTATION_RESOURCE_ROLES, ANNOTATION_RESOURCE_ROLE_NAMES, ANNOTATION_SUBTYPES, AbortError, AbortablePromise, AnnotationTransfer, CONTINUOUS_RENDER_POLICY, DEFAULT_BUNDLE_LIMITS, DEFAULT_EDGE_RESOLVER_BUDGET, DEFAULT_MEDIA_BOX, DEFAULT_PDF_SAVE_MODE, DEFAULT_RICH_TEXT_BODY, DRAWN_RECT_KINDS, EMPTY_TRANSFER, EdgeResolver, EngineError, EngineErrorCode, EventHub, FormTransfer, InvalidScope, LOCAL_ENGINE_BRAND, METRES, MissingIdentity, NO_ANNOTATION_FLAGS, OBJECT_NUMBER_CEILING, OBJECT_NUMBER_ISSUE_LIMIT, PAGE_INSERT_BLANK_MAX_COUNT, PDF_BITS, PDF_CODE_TO_SUBTYPE, PDF_SUBTYPE_TO_CODE, PROTECTABLE_CAPABILITIES, PdfAnnotationSubtypeCode, PermissionDenied, SEARCH_FOLD_VERSION, SEARCH_REGEX_MAX_LENGTH, SEARCH_SNIPPET_CONTEXT, SIGNATURE_POLICY_VERSION, STANDARD_FACES, STANDARD_FONTS, SessionEventPublisher, UNBAKED_KINDS, USAGE_INCOMPLETE, WIDGET_ACTION_EVENTS, WIDGET_FLAG_NAMES, actionWriteOf, advisoryFromPdfBits, allowsCapability, allowsFieldWrite, allowsSomeFieldWrite, anchorOf, annotationDefaultsOf, annotationImportFacts, annotationKey, annotationOfDraft, annotationPatchBetween, annotationResourceBuffers, annotationWriteCapabilities, annotationWriteCapability, appearanceChangeOf, appearanceImpactOf, appearanceLatticeScale, appearanceModesOf, appearanceTurnOf, applyAnnotationPatch, areaUnitLabel, assertAnnotationBundle, assertAnnotationBundleManifest, assertAnnotationResources, assertChoiceDefault, assertDeclaredFields, assertFormBundle, assertFormBundleManifest, assertPdfFloat, assertRichTextAgreement, assertWithinLimit, assertWritableMeasure, assessmentOf, authorizeAnnotationCreate, authorizeAnnotationDelete, authorizeAnnotationUpdate, authorizeCapability, authorizeFieldGroup, authorizeFieldWrite, authorizeUnprotected, boundaryTextOffset, buildCommentThreads, buildSnippet, buildThreads, bundleCodec, bundlePageMapping, canonicalSearchQuery, caps, changeEvents, changeFingerprint, changedKeys, charBoundaryAtTextOffset, charMapViolation, charRangeForTextOffsets, checkAnyCapability, checkAnyFieldAction, checkCapability, checkCollab, checkFieldAction, checkImageQuality, checkSetGroup, classifyRelation, clearlyOutranks, closeExportSelection, collab, collabTargetOf, colorOf, combine, compareIsoDateTime, concatAnnotationLists, conclude, createPageImageHandle, createPdfTextLayout, createTextLayout, decodeAnnotKey, decodeFieldRefKey, decodePageKey, decodePdfBits, decodeSubmitFormFlags, defaultEntryOfDraft, deletedAnnotationsOf, deletedAttachmentOf, deletedFieldOf, deletedWith, deriveMeasurementLabel, deriveProtection, describeProtection, deserializeError, dictEntries, draftWritesScripts, drawnPointsOf, encodeAnnotKey, encodeFieldRefKey, encodePageKey, evaluateStep, expandRawScope, expandedCapabilities, faceForFreeTextFont, familyKey, familyOfSubtype, fieldAfterReset, fieldAfterValue, fieldLockFor, fieldMatches, fieldRightsOf, fieldScriptOf, fieldValueOf, fieldValueWriteOf, filterMatches, fitWidgetToFamily, foldOptionsFor, foldText, formEffectOps, formExportRowsOf, formFieldAfter, formFieldOfDraft, formImportFacts, formResetFacts, formValuesImportFacts, formWidget, formatMeasurement, formatObjectNumberRanges, freeTextFontForFace, generateUuid, generateUuidV7, glyphLooseBounds, glyphLooseQuad, hasAnnotationResources, imageSourceOfBytes, isAbortError, isAtDefault, isDimension, isFieldScript, isKeptRefusal, isLocalDocument, isLocalEngine, isLocalPage, isNoOpWrite, isProtectableCapability, isReadout, isRotatedGeometryRun, isSamePdfRect, isSkippedItem, isStandardFontName, isStateAnnotation, isUndoChange, isValidPageObjectNumber, itemWrote, levelAllows, levelFromPermission, lockCovers, lockNameCovers, manifestBytesOf, mapActionNode, mapActionTree, mapAnnotationActions, mapDocumentActions, mapFieldActions, mapLinkTarget, mapPageActions, mapPageRefs, matchLiteral, matchPageText, matchRegex, materializePdfPermissions, measureFromKnownLength, measureFromRatio, measurementPoint, measurementReadout, mergeAnnotationPatch, minLevel, needsScriptRight, normalizeAttachmentFileSource, normalizePdfQuad, normalizePdfRect, objectNumbersIn, objectNumbersNamedBy, objectNumbersReferencedBy, opIdOf, pageAnnotationDraftOf, pageAnnotationOf, pageAnnotationPatchOf, pageAppearancesOf, pageBoxOf, pageBoxesOf, pageDestinationOf, pageFieldActionsOf, pageFormFieldOf, pageFormSnapshotOf, pageGeometryOf, pageGlyphLooseBounds, pageGlyphLooseQuad, pageLayoutOf, pageListOf, pageMeasureOf, pagePointOf, pagePointTurned, pagePointUnturned, pagePointsBounds, pageQuadBounds, pageQuadOf, pageRefsEqual, pageRefsIn, pageRotationOf, pageSearchSliceOf, pageSpaceBoxesOf, pageTextSegmentOf, pageTransform, pageTurnOfDrawn, pageTurnOfUpright, pageViewportsOf, pageWidgetOf, parseObjectNumberRanges, parsePdfValue, parseScope, passwordPromptFromState, pathLength, pdfAnnotationDraftOf, pdfAnnotationOf, pdfAnnotationPatchOf, pdfAppearanceTurnOf, pdfDestinationOf, pdfFormFieldDraftOf, pdfMeasureOf, pdfPermissions, pdfPointOf, pdfPointTurned, pdfPointUnturned, pdfPointsBounds, pdfQuadBounds, pdfQuadOf, pdfQuarterTurnBox, pdfRectFromOriginSize, pdfRectHeight, pdfRectIntersection, pdfRectOf, pdfRectSize, pdfRectToOriginSize, pdfRectTurnedBounds, pdfRectWidth, pdfRenderTargetOf, pdfTurnOfDrawn, pdfTurnOfUpright, pdfValueEquals, pdfWidgetPlacementOf, permissionInfoFromProbe, permissionInfoWithAdvisory, placeFor, placeIn, placedBefore, placedWidgetOf, polygonArea, positionIndex, primaryFinding, protectedCapabilities, quarterTurnOf, rank, refsOf, renderAreaTransform, renderMatrix, renderSize, renderTargetArea, renderTransform, reorderPart, reorderedList, resolveAnnotationDraft, resolveAnnotationPatch, resolveAnnotationResources, resolveBinarySource, resolveChangeResources, resolveMeasurementDraft, resolvePageLayers, resolveRectCommand, resourceIdOf, restrictionsFor, restrictionsOf, rgbOf, richTextParagraphsFromPlainText, richTextPlainText, sameColor, sameEffectiveValue, scaleOf, searchContentEpoch, searchQueryOf, securityStateFromHead, securityStateFromProbe, semanticEqual, serializeError, shapeForRect, shownAppearances, sliceText, snapAppearanceScale, snapFullPageViewport, snapTileScale, sniffBinaryMetadata, squareMetres, squareOf, stableStringify, standardStateModelOf, subscribeToType, subtypeFromCode, toAttachmentRef, toFieldRef, toOriginalRange, toPageRef, topRowOf, touchesCaption, validAreaBoundary, validNumberFormat, validateScopeArray, validateSearchQuery, validateSearchRegex, valueEntriesEqual, viewportForPoint, visibleBoxesOf, widgetActionsOf, widgetAfterPatch, widgetsAfterDisplay, wirePack, withFileFromResource, wordAt, wordBefore, worstVerdict, writesScripts };
360
577
 
361
578
  //# sourceMappingURL=runtime.js.map