@embedpdf/viewer-chrome 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 (157) hide show
  1. package/README.md +175 -132
  2. package/dist/annotation-fonts-BqoLZ4Mp.js +80 -0
  3. package/dist/annotation-fonts-BqoLZ4Mp.js.map +1 -0
  4. package/dist/annotation-fonts-Dt0IQXhz.cjs +91 -0
  5. package/dist/annotation-fonts-Dt0IQXhz.cjs.map +1 -0
  6. package/dist/annotation-style--rPIZsuP.js +879 -0
  7. package/dist/annotation-style--rPIZsuP.js.map +1 -0
  8. package/dist/annotation-style-Bzvvp8-N.cjs +879 -0
  9. package/dist/annotation-style-Bzvvp8-N.cjs.map +1 -0
  10. package/dist/ar-D9XKAmDx.js +567 -0
  11. package/dist/ar-D9XKAmDx.js.map +1 -0
  12. package/dist/ar-DnEj5vbP.cjs +567 -0
  13. package/dist/ar-DnEj5vbP.cjs.map +1 -0
  14. package/dist/chrome.cjs +378 -221
  15. package/dist/chrome.cjs.map +1 -1
  16. package/dist/chrome.d.cts +5 -34
  17. package/dist/chrome.d.ts +5 -34
  18. package/dist/chrome.js +377 -218
  19. package/dist/chrome.js.map +1 -1
  20. package/dist/commands-BmgxhJ8B.js +953 -0
  21. package/dist/commands-BmgxhJ8B.js.map +1 -0
  22. package/dist/commands-CYt4SFUX.cjs +1060 -0
  23. package/dist/commands-CYt4SFUX.cjs.map +1 -0
  24. package/dist/commands.cjs +12 -595
  25. package/dist/commands.d.cts +29 -4
  26. package/dist/commands.d.ts +29 -4
  27. package/dist/commands.js +2 -593
  28. package/dist/comments-panel-MUVgLCBI.js +514 -0
  29. package/dist/comments-panel-MUVgLCBI.js.map +1 -0
  30. package/dist/comments-panel-pEcQg4Vs.cjs +514 -0
  31. package/dist/comments-panel-pEcQg4Vs.cjs.map +1 -0
  32. package/dist/de-Bdr4aWzm.js +566 -0
  33. package/dist/de-Bdr4aWzm.js.map +1 -0
  34. package/dist/de-Dv6zvbnd.cjs +566 -0
  35. package/dist/de-Dv6zvbnd.cjs.map +1 -0
  36. package/dist/dialog-B5GBisKv.js +55 -0
  37. package/dist/dialog-B5GBisKv.js.map +1 -0
  38. package/dist/dialog-t8F13BL_.cjs +60 -0
  39. package/dist/dialog-t8F13BL_.cjs.map +1 -0
  40. package/dist/es-BP09DR9w.cjs +566 -0
  41. package/dist/es-BP09DR9w.cjs.map +1 -0
  42. package/dist/es-BSXz5tBv.js +566 -0
  43. package/dist/es-BSXz5tBv.js.map +1 -0
  44. package/dist/form-design-panel-B5MXTZ96.cjs +418 -0
  45. package/dist/form-design-panel-B5MXTZ96.cjs.map +1 -0
  46. package/dist/form-design-panel-vWWU9uB-.js +418 -0
  47. package/dist/form-design-panel-vWWU9uB-.js.map +1 -0
  48. package/dist/fr-BBQQn7tJ.cjs +566 -0
  49. package/dist/fr-BBQQn7tJ.cjs.map +1 -0
  50. package/dist/fr-Ckn3K9v1.js +566 -0
  51. package/dist/fr-Ckn3K9v1.js.map +1 -0
  52. package/dist/he-DRsG7bH7.cjs +567 -0
  53. package/dist/he-DRsG7bH7.cjs.map +1 -0
  54. package/dist/he-wdGU5PkU.js +567 -0
  55. package/dist/he-wdGU5PkU.js.map +1 -0
  56. package/dist/icons-BrK5iVL8.js +856 -0
  57. package/dist/icons-BrK5iVL8.js.map +1 -0
  58. package/dist/icons-x0Tc05bs.cjs +1010 -0
  59. package/dist/icons-x0Tc05bs.cjs.map +1 -0
  60. package/dist/index.cjs +3162 -5106
  61. package/dist/index.cjs.map +1 -1
  62. package/dist/index.d.cts +636 -143
  63. package/dist/index.d.ts +636 -143
  64. package/dist/index.js +3083 -4975
  65. package/dist/index.js.map +1 -1
  66. package/dist/it-BuP4o0xQ.cjs +566 -0
  67. package/dist/it-BuP4o0xQ.cjs.map +1 -0
  68. package/dist/it-Us-VmvIu.js +566 -0
  69. package/dist/it-Us-VmvIu.js.map +1 -0
  70. package/dist/ja-Cizj0-5O.js +566 -0
  71. package/dist/ja-Cizj0-5O.js.map +1 -0
  72. package/dist/ja-DovEd6ts.cjs +566 -0
  73. package/dist/ja-DovEd6ts.cjs.map +1 -0
  74. package/dist/ko-B-qJEol2.cjs +566 -0
  75. package/dist/ko-B-qJEol2.cjs.map +1 -0
  76. package/dist/ko-DlrXliE1.js +566 -0
  77. package/dist/ko-DlrXliE1.js.map +1 -0
  78. package/dist/labels-BiM9wp9K.cjs +21 -0
  79. package/dist/labels-BiM9wp9K.cjs.map +1 -0
  80. package/dist/labels-C6_i87Oj.js +16 -0
  81. package/dist/labels-C6_i87Oj.js.map +1 -0
  82. package/dist/link-editor-CSjqPnj1.cjs +125 -0
  83. package/dist/link-editor-CSjqPnj1.cjs.map +1 -0
  84. package/dist/link-editor-SxM1nnJU.js +125 -0
  85. package/dist/link-editor-SxM1nnJU.js.map +1 -0
  86. package/dist/measurement-Bs61XWbJ.js +325 -0
  87. package/dist/measurement-Bs61XWbJ.js.map +1 -0
  88. package/dist/measurement-CcCsHPOX.cjs +326 -0
  89. package/dist/measurement-CcCsHPOX.cjs.map +1 -0
  90. package/dist/nl-0aF7M_0h.js +566 -0
  91. package/dist/nl-0aF7M_0h.js.map +1 -0
  92. package/dist/nl-D3KZDDiJ.cjs +566 -0
  93. package/dist/nl-D3KZDDiJ.cjs.map +1 -0
  94. package/dist/pl-BW--AaCI.js +566 -0
  95. package/dist/pl-BW--AaCI.js.map +1 -0
  96. package/dist/pl-DSFhAUqx.cjs +566 -0
  97. package/dist/pl-DSFhAUqx.cjs.map +1 -0
  98. package/dist/pt-C5S-8MC5.cjs +566 -0
  99. package/dist/pt-C5S-8MC5.cjs.map +1 -0
  100. package/dist/pt-DIhpU5pT.js +566 -0
  101. package/dist/pt-DIhpU5pT.js.map +1 -0
  102. package/dist/redact-confirm-B6j36TPw.js +83 -0
  103. package/dist/redact-confirm-B6j36TPw.js.map +1 -0
  104. package/dist/redact-confirm-CX_SY2ZN.cjs +83 -0
  105. package/dist/redact-confirm-CX_SY2ZN.cjs.map +1 -0
  106. package/dist/redaction-panel-BmoIl-Ll.cjs +96 -0
  107. package/dist/redaction-panel-BmoIl-Ll.cjs.map +1 -0
  108. package/dist/redaction-panel-IJDshSJI.js +96 -0
  109. package/dist/redaction-panel-IJDshSJI.js.map +1 -0
  110. package/dist/search-panel-HfIhJm1M.js +249 -0
  111. package/dist/search-panel-HfIhJm1M.js.map +1 -0
  112. package/dist/search-panel-s9IoiOtv.cjs +249 -0
  113. package/dist/search-panel-s9IoiOtv.cjs.map +1 -0
  114. package/dist/sheet-BDsa_Sup.cjs +442 -0
  115. package/dist/sheet-BDsa_Sup.cjs.map +1 -0
  116. package/dist/sheet-R6XDgyEf.js +365 -0
  117. package/dist/sheet-R6XDgyEf.js.map +1 -0
  118. package/dist/sign-dialog-CgnR7akj.cjs +155 -0
  119. package/dist/sign-dialog-CgnR7akj.cjs.map +1 -0
  120. package/dist/sign-dialog-GDqCoQhA.js +155 -0
  121. package/dist/sign-dialog-GDqCoQhA.js.map +1 -0
  122. package/dist/signature-inspector-DyO313Qf.cjs +166 -0
  123. package/dist/signature-inspector-DyO313Qf.cjs.map +1 -0
  124. package/dist/signature-inspector-okFz8do6.js +166 -0
  125. package/dist/signature-inspector-okFz8do6.js.map +1 -0
  126. package/dist/signature-maker-BhCmYyHD.js +393 -0
  127. package/dist/signature-maker-BhCmYyHD.js.map +1 -0
  128. package/dist/signature-maker-BoYa8vgA.cjs +393 -0
  129. package/dist/signature-maker-BoYa8vgA.cjs.map +1 -0
  130. package/dist/signatures-panel-B56PC6d9.cjs +300 -0
  131. package/dist/signatures-panel-B56PC6d9.cjs.map +1 -0
  132. package/dist/signatures-panel-CgnFfhFm.js +300 -0
  133. package/dist/signatures-panel-CgnFfhFm.js.map +1 -0
  134. package/dist/stamp-store-BHvRs-Do.cjs +147 -0
  135. package/dist/stamp-store-BHvRs-Do.cjs.map +1 -0
  136. package/dist/stamp-store-WuF-L3Jj.js +112 -0
  137. package/dist/stamp-store-WuF-L3Jj.js.map +1 -0
  138. package/dist/stamps-panel-B9NYGayn.cjs +231 -0
  139. package/dist/stamps-panel-B9NYGayn.cjs.map +1 -0
  140. package/dist/stamps-panel-CDO0FPyK.js +231 -0
  141. package/dist/stamps-panel-CDO0FPyK.js.map +1 -0
  142. package/dist/toolbar-CJu2wKTU.cjs +1659 -0
  143. package/dist/toolbar-CJu2wKTU.cjs.map +1 -0
  144. package/dist/toolbar-z9od3tKl.js +1564 -0
  145. package/dist/toolbar-z9od3tKl.js.map +1 -0
  146. package/dist/zh-cn-3tmMeHqv.cjs +566 -0
  147. package/dist/zh-cn-3tmMeHqv.cjs.map +1 -0
  148. package/dist/zh-cn-CxkUUBct.js +566 -0
  149. package/dist/zh-cn-CxkUUBct.js.map +1 -0
  150. package/package.json +6 -4
  151. package/src/styles.css +153 -89
  152. package/dist/commands.cjs.map +0 -1
  153. package/dist/commands.js.map +0 -1
  154. package/dist/es-DYwzfxyt.cjs +0 -293
  155. package/dist/es-DYwzfxyt.cjs.map +0 -1
  156. package/dist/es-sN6uqBgD.js +0 -293
  157. package/dist/es-sN6uqBgD.js.map +0 -1
@@ -0,0 +1 @@
1
+ {"version":3,"file":"commands-CYt4SFUX.cjs","names":["ShellToken","InteractionToken","DocumentsToken","InteractionToken","StageToken","AnnotationToken","SelectionToken","FormToken","StampToken","CommandsToken","ShellToken","MeasurementToken","ZoomMode","DocumentsToken","ActionsToken","SignatureToken","RedactionToken","I18nToken","LinkToken","HistoryToken"],"sources":["../src/config/modes.ts","../src/config/open-files.ts","../src/config/commands.ts"],"sourcesContent":["/**\n * The modes a layout brings. A mode is an exclusive shell surface tagged\n * `'mode'` (`mode:<mode>`); the bars with that `mode` show while it is open.\n * The built-in modes have commands of their own (config/commands.ts); a bar\n * with a new mode gets one here, titled by the bar's title.\n */\nimport type { LayoutData } from '@embedpdf/core-ui';\nimport { barsInMode, modeCommandOf, modesOf } from '@embedpdf/core-ui';\nimport type { CommandDef } from '@embedpdf/react/commands';\nimport { InteractionToken } from '@embedpdf/react/interaction';\nimport { ShellToken, type ShellCapability } from '@embedpdf/react/shell';\n\n/** The exclusivity tag every mode surface opens with. */\nexport const MODE_TAG = 'mode';\n\n/** The open mode's surface (`mode:<mode>`), or `null` while viewing. */\nexport function openModeSurfaceOf(shell: ShellCapability): string | null {\n return shell.listOpenSurfaces().find((surface) => surface.exclusive === MODE_TAG)?.id ?? null;\n}\n\n/** A mode, and the title of its first bar that has one. */\nexport interface ModeSpec {\n readonly mode: string;\n readonly title?: string;\n readonly titleKey?: string;\n}\n\n/** The layout's modes, in bar order, each titled by its first bar with a title. */\nexport function modeSpecsOf(data: LayoutData): ModeSpec[] {\n return modesOf(data).map((mode) => {\n const titled = barsInMode(data, mode)\n .map((barId) => data.bars![barId]!)\n .find((bar) => bar.title !== undefined || bar.titleKey !== undefined);\n return { mode, title: titled?.title, titleKey: titled?.titleKey };\n });\n}\n\n/** Whether two lists of modes are the same, title for title. */\nexport const sameModeSpecs = (left: readonly ModeSpec[], right: readonly ModeSpec[]): boolean =>\n left.length === right.length &&\n left.every(\n (spec, i) =>\n spec.mode === right[i]!.mode &&\n spec.title === right[i]!.title &&\n spec.titleKey === right[i]!.titleKey,\n );\n\n/**\n * A command for each mode that has none yet (`isTaken` says which ids do): it opens the mode,\n * or closes it when it is open, and shows the default pointer. Without a title, its tab reads\n * the mode's own name.\n */\nexport function modeCommandsFor(\n specs: readonly ModeSpec[],\n isTaken: (id: string) => boolean,\n): CommandDef[] {\n return specs\n .filter((spec) => !isTaken(modeCommandOf(spec.mode)))\n .map((spec) => {\n const id = modeCommandOf(spec.mode);\n return {\n id,\n label: spec.title ?? (spec.titleKey === undefined ? spec.mode : undefined),\n labelKey: spec.titleKey,\n run: (commandContext) => {\n const shell = commandContext.tryGet(ShellToken);\n shell?.toggle(id, { exclusive: MODE_TAG });\n commandContext.tryGet(InteractionToken)?.activateTool('pointer');\n },\n active: (commandContext) => commandContext.tryGet(ShellToken)?.isOpen(id) ?? false,\n };\n });\n}\n","/**\n * Opening a file from the user's computer: the `document:open` command, behind the document\n * menu's Open row and a PDF dropped on the viewer (`ui/drop-to-open.tsx`). It's there only while\n * the engine opens files (`documents.canOpenFiles()`), so a viewer on the cloud engine never\n * offers it, and turning off `documents.open` turns off both ways.\n */\nimport type { CommandDef } from '@embedpdf/react/commands';\nimport { DocumentsToken, type DocumentsCapability, type OpenInput } from '@embedpdf/react/runtime';\nimport { pickFile } from '@embedpdf/web';\n\nexport const OPEN_COMMAND_ID = 'document:open';\n\nconst PDF_TYPE = 'application/pdf';\n\n/** What `document:open` takes to open the files it's given, a drop's, instead of asking for one. */\nexport interface OpenFilesArgs {\n readonly files: readonly File[];\n}\n\n/** Whether a file is a PDF, by its type or, where the system gives it none, its name. */\nexport const isPdfFile = (file: File): boolean =>\n file.type === PDF_TYPE || /\\.pdf$/i.test(file.name);\n\n/**\n * Whether a drag may bring a PDF: it carries files, and one of them is a PDF or of a type the\n * browser doesn't know. Text, links and anything dragged inside the page carry no files; where\n * the browser doesn't list the files while dragging, they may be PDFs.\n */\nexport function mayCarryPdf(transfer: DataTransfer | null): boolean {\n if (!transfer || !Array.from(transfer.types).includes('Files')) return false;\n const files = Array.from(transfer.items ?? []).filter((item) => item.kind === 'file');\n return files.length === 0 || files.some((item) => item.type === PDF_TYPE || item.type === '');\n}\n\nconst givenFilesOf = (args: unknown): readonly File[] | null => {\n const files = (args as Partial<OpenFilesArgs> | undefined)?.files;\n return Array.isArray(files) ? files : null;\n};\n\n/** The file the user picks in the file dialog, as a list: empty when they close it. */\nconst pickedFiles = (): Promise<readonly File[]> =>\n pickFile({ accept: `.pdf,${PDF_TYPE}` }).then((file) => (file ? [file] : []));\n\n/**\n * Open each file as a new tab, the first one shown. Its tab is there at once, named like a `src`\n * file's (its name without `.pdf`), while the file is read; one that can't be opened says why\n * in its tab.\n */\nfunction openFiles(documents: DocumentsCapability, files: readonly File[]): void {\n documents.openAll(\n files.map((file) => ({\n name: file.name.replace(/\\.pdf$/i, '') || file.name,\n source: async (): Promise<OpenInput> => ({\n kind: 'bytes',\n bytes: new Uint8Array(await file.arrayBuffer()),\n }),\n })),\n );\n}\n\nexport const openFileCommand: CommandDef = {\n id: OPEN_COMMAND_ID,\n labelKey: 'commands.open',\n icon: 'fileImport',\n // The key reaches the viewer only while focus is inside it: elsewhere it's the page's own.\n shortcut: 'Mod+O',\n categories: ['documents.open'],\n // Where the engine opens only the documents a server holds, there is no Open, and its key\n // keeps the browser's own meaning.\n visible: (commandContext) => commandContext.tryGet(DocumentsToken)?.canOpenFiles() ?? false,\n run: async (commandContext) => {\n const documents = commandContext.tryGet(DocumentsToken);\n if (!documents) return;\n // The dialog opens before anything is awaited: a browser opens it only inside the click or\n // key that asked for it.\n const files = givenFilesOf(commandContext.args) ?? (await pickedFiles());\n openFiles(documents, files);\n },\n};\n","/**\n * The command vocabulary — the semantic layer. Every command is a pure value:\n * label key, icon, shortcut, derivations, and a `run` (or a declarative\n * surface target). Commands reach plugins through a typed\n * `commandContext.tryGet(Token)`, never by string id and cast.\n *\n * Each command names its most specific feature in `categories` (the tree in\n * `../features.ts`), so `disable` and `readOnly` turn it off, and whether the\n * session may run it in `allowed`, from the owning plugin's `can*` check\n * (docs/conventions/permissions.md), so a user who may not doesn't see it.\n * `enabled` is only for what can't run right now.\n *\n * Wiring:\n * zoom/pan/pointer/spread/scroll/rotate → real Stage / Interaction / PageEdit\n * modes → shell exclusive surfaces ('mode')\n * panels → the layout's `panel:<id>` (panels.ts)\n * menus / modals → declarative shell targets\n * annotate + shape tools → real interaction tools\n * form tools → real form plugin palette (draw-to-place)\n * insert tools → real stamp and signature panels +\n * image/attachment click-then-pick\n * history undo/redo → real History\n */\nimport { panelCommandOf } from '@embedpdf/core-ui';\nimport type { AnnotationToolInput } from '@embedpdf/react/annotation';\nimport { CommandsToken, type CommandDef, type IconAccent } from '@embedpdf/react/commands';\nimport { FormToken } from '@embedpdf/react/form';\nimport { HistoryToken } from '@embedpdf/react/history';\nimport { DocumentsToken } from '@embedpdf/react/runtime';\nimport { StageToken, ZoomMode } from '@embedpdf/react/stage';\nimport type { SpreadMode } from '@embedpdf/react/stage';\nimport { InteractionToken } from '@embedpdf/react/interaction';\nimport { ShellToken } from '@embedpdf/react/shell';\nimport { AnnotationToken } from '@embedpdf/react/annotation';\nimport { copySelection, SelectionToken, type TextRange } from '@embedpdf/react/selection';\nimport { ActionsToken } from '@embedpdf/react/actions';\nimport { LinkToken, type PdfLinkTarget } from '@embedpdf/react/link';\nimport { MeasurementToken } from '@embedpdf/react/measurement';\nimport { RedactionToken } from '@embedpdf/react/redaction';\nimport { StampToken } from '@embedpdf/react/stamp';\nimport { SignatureToken } from '@embedpdf/react/signature';\nimport { I18nToken } from '@embedpdf/react/i18n';\n\nimport type { Feature } from '../features';\nimport { openModeSurfaceOf } from './modes';\nimport { openFileCommand } from './open-files';\n\n// ── helpers ────────────────────────────────────────────────────────────────\ntype Ctx = Parameters<NonNullable<CommandDef['run']>>[0];\n\n/** The dialog the Go to Page command opens without a page to go to (ui/go-to-page.tsx). */\nexport const GO_TO_PAGE_DIALOG = 'go-to-page';\n/** The keyboard shortcuts sheet, which `?` opens (ui/shortcuts-sheet.tsx). */\nexport const SHORTCUTS_DIALOG = 'shortcuts';\n/** The confirmation before marked areas are removed for good (ui/redact-confirm.tsx). */\nexport const REDACT_CONFIRM_DIALOG = 'redact-confirm';\n/** The form designer's sidebar (ui/form-design-panel.tsx), which `form:design` opens. */\nexport const FORM_DESIGN_PANEL = 'form-design';\n/** Form design's resting tool, the form plugin's: widgets select, move and resize there. */\nexport const FORM_DESIGN_TOOL = 'form-edit';\n/** The form plugin's field tools, each placing a field (the Form bar's `tool:*` buttons). */\nconst FORM_FIELD_TOOLS: readonly string[] = [\n 'form-text',\n 'form-checkbox',\n 'form-radio',\n 'form-combobox',\n 'form-listbox',\n 'form-button',\n 'form-signature',\n];\n\n/**\n * Whether a tool designs a form: design's resting tool, or a field tool. Neither fills, so the\n * form lends its widgets to be selected, moved and resized.\n */\nexport const isFormDesignTool = (tool: string | null | undefined): boolean =>\n tool === FORM_DESIGN_TOOL || (tool != null && FORM_FIELD_TOOLS.includes(tool));\n\n/** Whether a form is being designed: the active tool designs it. */\nexport const isDesigningForm = (commandContext: Pick<Ctx, 'tryGet'>): boolean =>\n isFormDesignTool(commandContext.tryGet(InteractionToken)?.getActiveToolId());\n\n/** Where selection-made stamps go: the user's own library, persisted. */\nconst CUSTOM_LIBRARY_ID = 'embedpdf-custom';\n\nconst stage = (commandContext: Ctx) => commandContext.tryGet(StageToken);\nconst interaction = (commandContext: Ctx) => commandContext.tryGet(InteractionToken);\nconst anno = (commandContext: Ctx) => commandContext.tryGet(AnnotationToken);\nconst textSelection = (commandContext: Ctx) => commandContext.tryGet(SelectionToken);\n\n/**\n * Whether the session may run a command, as the plugin that owns its verb says, and the\n * sentence for when it may not (docs/conventions/permissions.md). Without the plugin there is\n * nothing to ask, and the command's own `enabled` or `visible` says it can't run.\n */\ntype Check = Pick<CommandDef, 'allowed' | 'notAllowedKey'>;\n\n/** Drawing an annotation of any kind: `annotation.canCreate()`. */\nconst CREATES_ANNOTATIONS: Check = {\n allowed: (commandContext) => anno(commandContext)?.canCreate() ?? true,\n notAllowedKey: 'commands.notAllowed.annotations-create',\n};\n/** Placing and changing form fields: `form.canDesign()`. */\nconst DESIGNS_FORMS: Check = {\n allowed: (commandContext) => commandContext.tryGet(FormToken)?.canDesign() ?? true,\n notAllowedKey: 'commands.notAllowed.doc-forms-modify',\n};\n/** Placing a stamp or a signature mark: `stamp.canPlace()`. */\nconst PLACES_STAMPS: Check = {\n allowed: (commandContext) =>\n commandContext.tryGet(StampToken)?.canPlace(commandContext.documentId ?? undefined) ?? true,\n notAllowedKey: 'commands.notAllowed.annotations-create',\n};\nconst sameTextRange = (left: TextRange | null, right: TextRange | null): boolean =>\n left === right ||\n (!!left &&\n !!right &&\n left.start.page.objectNumber === right.start.page.objectNumber &&\n left.start.index === right.start.index &&\n left.end.page.objectNumber === right.end.page.objectNumber &&\n left.end.index === right.end.index);\n\n/**\n * What a command needs to open and close the layout's panel `id`: it runs the panel's own\n * `panel:<id>` command (config/panels.ts), so it opens only what that one may, shows only while\n * the layout has the panel and `visible` says so, and is active while the panel is open.\n */\nconst togglesPanel = (id: string, visible?: (commandContext: Ctx) => boolean) => ({\n run: (commandContext: Ctx) =>\n commandContext.tryGet(CommandsToken)?.execute(panelCommandOf(id), {\n documentId: commandContext.documentId ?? undefined,\n }),\n active: (commandContext: Ctx) => commandContext.tryGet(ShellToken)?.isOpen(id) ?? false,\n visible: (commandContext: Ctx) =>\n (commandContext.tryGet(CommandsToken)?.hasCommand(panelCommandOf(id)) ?? false) &&\n (visible?.(commandContext) ?? true),\n});\n\n/** A measuring tool can run on the current page: it has a scale (`measurement.canMeasure`). */\nconst canMeasureNow = (commandContext: Ctx): boolean => {\n const page = stage(commandContext)?.getCurrentPage();\n return page != null && (commandContext.tryGet(MeasurementToken)?.canMeasure(page) ?? false);\n};\n\n// ── annotation-selection predicates (drive the floating strip's contents) ────\nconst hasAnnotationSelection = (commandContext: Ctx) =>\n (anno(commandContext)?.selection.list().length ?? 0) > 0;\n/** Whether people may change every selected annotation by hand (no turned-off feature froze it). */\nconst selectionEditable = (commandContext: Ctx): boolean => {\n const annotation = anno(commandContext);\n return (annotation?.selection.list() ?? []).every(({ ref }) => annotation!.isEditable(ref));\n};\n/** Strip items gate per subtype (comment hidden on links/widgets) through\n * one derivation over the selected DTOs, not per-command lookups. */\nconst selectionSubtypes = (commandContext: Ctx) =>\n new Set((anno(commandContext)?.selection.list() ?? []).map((annotation) => annotation.subtype));\n/**\n * The selection's `link` value: a target, `null` (linkable but none set), or\n * `undefined` when the selection cannot carry a link at all (widgets, mixed\n * link states) — the schema decides, never a subtype blocklist.\n */\n/** The selection's link target, as the annotation holds it (destinations in the file's coordinates). */\nconst selectionLink = (commandContext: Ctx): PdfLinkTarget | null | undefined => {\n const props = anno(commandContext)?.selection.getProperties();\n if (\n !props ||\n !props.properties.some((property) => property.key === 'link') ||\n props.mixed.includes('link')\n )\n return undefined;\n return (props.values.link ?? null) as PdfLinkTarget | null;\n};\n\n// ── tool icon accents: This viewer's design decision ─────────────────────────\n// A tool declares which drawing default each colored part of its glyph previews.\n// This is intentionally explicit at the command definition: property-panel order\n// does not determine icon meaning, and another viewer may make a different choice.\ntype ColorKey = 'color' | 'interiorColor' | 'fontColor';\nexport interface ToolAccentDefinition {\n primary: ColorKey;\n secondary?: ColorKey;\n}\n\n/**\n * toolId → the same icon + accent definition its toolbar button uses, recorded\n * as a side effect of the `tool()` command definitions below — one source of\n * truth, so the tool cursor (ui/tool-cursor.tsx) and the button can never\n * drift apart.\n */\nexport const TOOL_ICONS: Record<string, { icon: string; accent?: ToolAccentDefinition }> = {};\n\n// The `stamp` tool has no toolbar button of its own: it is armed by the stamps\n// panel (picking a library asset), never activated directly — so its cursor\n// skin is recorded here rather than as a side effect of a `tool()` definition.\nTOOL_ICONS['stamp'] = { icon: 'rubberStamp' };\n\nconst toolAccent = (\n commandContext: Ctx,\n toolId: string,\n accent: ToolAccentDefinition | undefined,\n): IconAccent | null => {\n if (!accent) return null;\n const anno = commandContext.tryGet(AnnotationToken);\n if (!anno) return null;\n const defaults = anno.tools.getDefaults(toolId);\n const colorOf = (key: ColorKey) => (defaults[key] as string | null | undefined) ?? undefined;\n return {\n primary: colorOf(accent.primary),\n secondary: accent.secondary ? colorOf(accent.secondary) : undefined,\n };\n};\n\n/** toolId → the feature its command belongs to, for the tools of yours that extend it. */\nconst TOOL_FEATURES: Record<string, Feature> = {};\n\n/** What a tool command belongs to and needs, and how its icon previews the tool. */\ninterface ToolOptions {\n /** Its feature, so `disable` and `readOnly` turn it off. */\n readonly feature: Feature;\n /**\n * Whether the session may use it: an authoring tool is gone without it, so a\n * button never offers a paint the owning plugin's gesture gate refuses.\n */\n readonly check?: Check;\n readonly accent?: ToolAccentDefinition;\n}\n\n/** A tool command without its label: activates a real interaction tool; active = it's the tool.\n * The icon previews the tool's current defaults — keyed by the same toolId\n * as run/active, so the accent can't drift to another tool's colors. */\nconst toolCommand = (\n id: string,\n toolId: string,\n icon: string | undefined,\n { feature, check, accent }: ToolOptions,\n): Omit<CommandDef, 'labelKey'> => {\n if (icon) TOOL_ICONS[toolId] = { icon, ...(accent ? { accent } : {}) };\n TOOL_FEATURES[toolId] = feature;\n return {\n id,\n ...(icon ? { icon } : {}),\n categories: [feature],\n ...check,\n run: (commandContext) => interaction(commandContext)?.activateTool(toolId),\n active: (commandContext) => interaction(commandContext)?.getActiveToolId() === toolId,\n enabled: (commandContext) => interaction(commandContext) != null,\n iconAccent: (commandContext) => toolAccent(commandContext, toolId, accent),\n };\n};\n\nconst tool = (\n id: string,\n toolId: string,\n labelKey: string,\n icon: string,\n options: ToolOptions,\n): CommandDef => ({ ...toolCommand(id, toolId, icon, options), labelKey });\n\n/**\n * Selected text made into a highlight, an underline or a strikeout, with the colors of the\n * tool that makes the same: shown only while there's a selection.\n */\nconst markupSelection = (\n id: string,\n toolId: string,\n labelKey: string,\n icon: string,\n feature: Feature,\n): CommandDef => ({\n id,\n labelKey,\n icon,\n categories: [feature],\n ...CREATES_ANNOTATIONS,\n visible: (commandContext) => textSelection(commandContext)?.hasSelection() ?? false,\n run: (commandContext) => anno(commandContext)?.createFromSelection(toolId),\n iconAccent: (commandContext) => toolAccent(commandContext, toolId, { primary: 'color' }),\n});\n\n/** The page number `page:go-to` was given (`args: { page }`, counted from 1), or `null`. */\nconst pageArgOf = (args: unknown): number | null => {\n const page = (args as { page?: unknown } | undefined)?.page;\n return typeof page === 'number' && Number.isFinite(page) ? Math.round(page) : null;\n};\n\n/** A fixed zoom level (fraction), e.g. 1 = 100%. */\nconst zoomLevel = (id: string, level: number, label: string): CommandDef => ({\n id,\n labelKey: label,\n run: (commandContext) => stage(commandContext)?.zoomTo({ level }),\n enabled: (commandContext) => stage(commandContext) != null,\n});\n\nconst spread = (id: string, mode: SpreadMode, labelKey: string, icon: string): CommandDef => ({\n id,\n labelKey,\n icon,\n run: (commandContext) => stage(commandContext)?.updateSettings({ spread: mode }),\n active: (commandContext) => stage(commandContext)?.getSettings().spread === mode,\n enabled: (commandContext) => stage(commandContext) != null,\n});\n\nexport const defaultCommands: CommandDef[] = [\n // ── zoom ───────────────────────────────────────────────────────────────\n {\n id: 'zoom:in',\n labelKey: 'commands.zoom.in',\n icon: 'zoomIn',\n shortcut: ['Mod+=', 'Mod+NumpadAdd'],\n run: (commandContext) => stage(commandContext)?.zoomIn(),\n enabled: (commandContext) => stage(commandContext) != null,\n },\n {\n id: 'zoom:out',\n labelKey: 'commands.zoom.out',\n icon: 'zoomOut',\n shortcut: ['Mod+-', 'Mod+NumpadSubtract'],\n run: (commandContext) => stage(commandContext)?.zoomOut(),\n enabled: (commandContext) => stage(commandContext) != null,\n },\n {\n id: 'zoom:fit-page',\n labelKey: 'commands.zoom.fitPage',\n icon: 'fitToPage',\n shortcut: 'Mod+0',\n run: (commandContext) => stage(commandContext)?.fitPage(),\n active: (commandContext) => stage(commandContext)?.getZoomMode() === ZoomMode.FitPage,\n enabled: (commandContext) => stage(commandContext) != null,\n },\n {\n id: 'zoom:fit-width',\n labelKey: 'commands.zoom.fitWidth',\n icon: 'fitToWidth',\n shortcut: 'Mod+1',\n run: (commandContext) => stage(commandContext)?.fitWidth(),\n active: (commandContext) => stage(commandContext)?.getZoomMode() === ZoomMode.FitWidth,\n enabled: (commandContext) => stage(commandContext) != null,\n },\n {\n id: 'zoom:automatic',\n labelKey: 'commands.zoom.automatic',\n run: (commandContext) => stage(commandContext)?.fitAutomatic(),\n active: (commandContext) => stage(commandContext)?.getZoomMode() === ZoomMode.Automatic,\n enabled: (commandContext) => stage(commandContext) != null,\n },\n zoomLevel('zoom:50', 0.5, 'commands.zoom.p50'),\n zoomLevel('zoom:100', 1, 'commands.zoom.p100'),\n zoomLevel('zoom:150', 1.5, 'commands.zoom.p150'),\n zoomLevel('zoom:200', 2, 'commands.zoom.p200'),\n zoomLevel('zoom:400', 4, 'commands.zoom.p400'),\n {\n id: 'menu:zoom',\n labelKey: 'commands.zoom.menu',\n icon: 'zoomIn',\n menu: 'zoom',\n },\n\n // ── pages ──────────────────────────────────────────────────────────────\n {\n id: 'page:next',\n labelKey: 'commands.page.next',\n icon: 'chevronRight',\n shortcut: 'ArrowRight',\n run: (commandContext) => stage(commandContext)?.nextPage(),\n enabled: (commandContext) => stage(commandContext)?.canGoNext() ?? false,\n },\n {\n id: 'page:previous',\n labelKey: 'commands.page.previous',\n icon: 'chevronLeft',\n shortcut: 'ArrowLeft',\n run: (commandContext) => stage(commandContext)?.previousPage(),\n enabled: (commandContext) => stage(commandContext)?.canGoPrevious() ?? false,\n },\n {\n id: 'page:first',\n labelKey: 'commands.page.first',\n shortcut: 'Home',\n run: (commandContext) => stage(commandContext)?.goToFirstPage(),\n enabled: (commandContext) => stage(commandContext)?.canGoPrevious() ?? false,\n },\n {\n id: 'page:last',\n labelKey: 'commands.page.last',\n shortcut: 'End',\n run: (commandContext) => stage(commandContext)?.goToLastPage(),\n enabled: (commandContext) => stage(commandContext)?.canGoNext() ?? false,\n },\n {\n // `execute('page:go-to', { args: { page: 3 } })` goes to page 3 (people count from 1; past\n // either end is that end); without a page it asks for one in a dialog.\n id: 'page:go-to',\n labelKey: 'commands.page.goTo',\n run: (commandContext) => {\n const view = stage(commandContext);\n if (!view) return;\n const page = pageArgOf(commandContext.args);\n if (page === null) {\n commandContext.tryGet(ShellToken)?.open(GO_TO_PAGE_DIALOG, { exclusive: 'modal' });\n return;\n }\n view.goToPage(Math.min(Math.max(page, 1), view.getPageCount()) - 1);\n },\n enabled: (commandContext) => (stage(commandContext)?.getPageCount() ?? 0) > 0,\n },\n\n // ── tools ──────────────────────────────────────────────────────────────\n {\n id: 'tool:pan',\n labelKey: 'commands.pan',\n icon: 'hand',\n run: (commandContext) => interaction(commandContext)?.activateTool('pan'),\n active: (commandContext) => interaction(commandContext)?.getActiveToolId() === 'pan',\n enabled: (commandContext) => interaction(commandContext) != null,\n },\n {\n id: 'tool:pointer',\n labelKey: 'commands.pointer',\n icon: 'pointer',\n run: (commandContext) => interaction(commandContext)?.activateTool('pointer'),\n active: (commandContext) => interaction(commandContext)?.getActiveToolId() === 'pointer',\n enabled: (commandContext) => interaction(commandContext) != null,\n },\n\n // The panels' `panel:<id>` commands come from the layout's panels (config/panels.ts).\n\n // ── menus (declarative) ─────────────────────────────────────────────────\n {\n id: 'menu:document',\n labelKey: 'commands.menu',\n icon: 'menu',\n menu: 'document',\n },\n {\n id: 'menu:view',\n labelKey: 'commands.viewControls',\n icon: 'viewSettings',\n menu: 'view',\n },\n\n // ── document actions ────────────────────────────────────────────────────\n openFileCommand,\n {\n id: 'document:download',\n labelKey: 'commands.download',\n icon: 'download',\n shortcut: 'Mod+S',\n categories: ['documents.download'],\n allowed: (commandContext) => commandContext.tryGet(DocumentsToken)?.canDownload() ?? true,\n notAllowedKey: 'commands.notAllowed.doc-download',\n run: (commandContext) => {\n const id = commandContext.documentId ?? undefined;\n const documents = commandContext.tryGet(DocumentsToken);\n if (!documents) return;\n // The download runs the document's save actions itself (WillSave → read → DidSave)\n // when the actions plugin is installed, so the WillSave changes are in the bytes.\n documents\n .download(id)\n .then((bytes) => {\n const blob = new Blob([bytes as BlobPart], { type: 'application/pdf' });\n const url = URL.createObjectURL(blob);\n const anchor = document.createElement('a');\n anchor.href = url;\n anchor.download = 'document.pdf';\n anchor.click();\n URL.revokeObjectURL(url);\n })\n .catch((error) => console.warn('[snippet-react] download failed', error));\n },\n enabled: (commandContext) => commandContext.documentId != null,\n },\n {\n id: 'document:print',\n labelKey: 'commands.print',\n icon: 'print',\n shortcut: 'Mod+P',\n categories: ['documents.print'],\n allowed: (commandContext) => commandContext.tryGet(DocumentsToken)?.canPrint() ?? true,\n notAllowedKey: 'commands.notAllowed.doc-print',\n // WP → window.print() → DP through the one serialized verb op (the\n // latch suppresses any nested script print); documentless chrome (or\n // no actions plugin) keeps today's direct dialog.\n run: (commandContext) => {\n const actions =\n commandContext.documentId != null ? commandContext.tryGet(ActionsToken) : null;\n if (actions) void actions.runDocumentVerb('print', () => window.print());\n else window.print();\n },\n },\n {\n id: 'view:fullscreen',\n labelKey: 'commands.fullscreen',\n icon: 'externalLink',\n run: () => {\n if (document.fullscreenElement) document.exitFullscreen();\n else document.documentElement.requestFullscreen().catch(() => {});\n },\n active: () => Boolean(document.fullscreenElement),\n },\n\n // ── page settings (spread / scroll / rotate) ────────────────────────────\n spread('view:single-page', 'none', 'commands.spread.none', 'singlePage'),\n spread('view:two-pages', 'odd', 'commands.spread.odd', 'doublePage'),\n spread('view:cover-page', 'even', 'commands.spread.even', 'book2'),\n {\n id: 'view:scroll-vertical',\n labelKey: 'commands.scroll.vertical',\n icon: 'vertical',\n run: (commandContext) => stage(commandContext)?.updateSettings({ layout: 'vertical' }),\n active: (commandContext) => stage(commandContext)?.getSettings().layout === 'vertical',\n enabled: (commandContext) => stage(commandContext) != null,\n },\n {\n id: 'view:scroll-horizontal',\n labelKey: 'commands.scroll.horizontal',\n icon: 'horizontal',\n run: (commandContext) => stage(commandContext)?.updateSettings({ layout: 'horizontal' }),\n active: (commandContext) => stage(commandContext)?.getSettings().layout === 'horizontal',\n enabled: (commandContext) => stage(commandContext) != null,\n },\n // View rotation (Adobe's \"Rotate View\"): rotates how every page displays in\n // the main stage lens — non-persistent, nothing written to the PDF. The\n // permanent per-page rotation (PageEditToken.rotateBy) belongs in a\n // page-organize surface, not behind the view-settings buttons.\n {\n id: 'view:rotate-clockwise',\n labelKey: 'commands.rotate.clockwise',\n icon: 'rotateClockwise',\n run: (commandContext) => stage(commandContext)?.rotateViewBy(90),\n enabled: (commandContext) => stage(commandContext) != null,\n },\n {\n id: 'view:rotate-counterclockwise',\n labelKey: 'commands.rotate.counterclockwise',\n icon: 'rotateCounterClockwise',\n run: (commandContext) => stage(commandContext)?.rotateViewBy(-90),\n enabled: (commandContext) => stage(commandContext) != null,\n },\n\n // ── modes (shell exclusive surfaces, tag 'mode') ────────────────────────\n {\n id: 'mode:view',\n labelKey: 'commands.mode.view',\n // View = no mode bar. Close the open mode, a built-in one or one a layout's\n // bar brought, and drop to pointer.\n run: (commandContext) => {\n const shell = commandContext.tryGet(ShellToken);\n const open = shell ? openModeSurfaceOf(shell) : null;\n if (open) shell?.close(open);\n interaction(commandContext)?.activateTool('pointer');\n },\n active: (commandContext) => {\n const shell = commandContext.tryGet(ShellToken);\n return shell ? openModeSurfaceOf(shell) === null : true;\n },\n },\n modeCommand('mode:annotate', 'commands.mode.annotate', { feature: 'annotations' }),\n modeCommand('mode:shapes', 'commands.mode.shapes', { feature: 'shapes' }),\n // Stamps, images, attachments and signatures: no one feature holds them all.\n modeCommand('mode:insert', 'commands.mode.insert'),\n // Form mode opens for filling and looking; `form:design` switches design on.\n modeCommand('mode:form', 'commands.mode.form', { feature: 'forms.building' }),\n modeCommand('mode:redact', 'commands.mode.redact', { feature: 'redaction' }),\n modeCommand('mode:measure', 'commands.mode.measure', { feature: 'measurement' }),\n\n // ── annotate tools (real interaction tools) ─────────────────────────────\n tool('tool:highlight', 'highlight', 'commands.annotate.highlight', 'highlight', {\n feature: 'annotations.highlight',\n check: CREATES_ANNOTATIONS,\n accent: { primary: 'color' },\n }),\n tool('tool:strikeout', 'strikeout', 'commands.annotate.strikeout', 'strikethrough', {\n feature: 'annotations.markup',\n check: CREATES_ANNOTATIONS,\n accent: { primary: 'color' },\n }),\n tool('tool:underline', 'underline', 'commands.annotate.underline', 'underline', {\n feature: 'annotations.markup',\n check: CREATES_ANNOTATIONS,\n accent: { primary: 'color' },\n }),\n tool('tool:squiggly', 'squiggly', 'commands.annotate.squiggly', 'squiggly', {\n feature: 'annotations.markup',\n check: CREATES_ANNOTATIONS,\n accent: { primary: 'color' },\n }),\n tool('tool:ink', 'ink', 'commands.annotate.ink', 'pencilMarker', {\n feature: 'annotations.drawing',\n check: CREATES_ANNOTATIONS,\n accent: { primary: 'color' },\n }),\n tool('tool:ink-highlight', 'ink-highlight', 'commands.annotate.inkHighlight', 'inkHighlighter', {\n feature: 'annotations.drawing',\n check: CREATES_ANNOTATIONS,\n accent: { primary: 'color' },\n }),\n tool('tool:free-text', 'free-text', 'commands.annotate.text', 'freeText', {\n feature: 'annotations.text',\n check: CREATES_ANNOTATIONS,\n accent: { primary: 'fontColor' },\n }),\n tool('tool:insert-text', 'insert-text', 'commands.annotate.insertText', 'insertText', {\n feature: 'annotations.text',\n check: CREATES_ANNOTATIONS,\n accent: { primary: 'color' },\n }),\n tool('tool:replace-text', 'replace-text', 'commands.annotate.replaceText', 'replaceText', {\n feature: 'annotations.text',\n check: CREATES_ANNOTATIONS,\n accent: { primary: 'color' },\n }),\n tool('tool:callout', 'free-text-callout', 'commands.annotate.callout', 'callout', {\n feature: 'annotations.text',\n check: CREATES_ANNOTATIONS,\n accent: { primary: 'color', secondary: 'interiorColor' },\n }),\n // Sticky note (\"comment\") — click-to-place; the icon renders from the\n // engine-baked /AP in the tool's current color.\n tool('tool:note', 'note', 'commands.annotate.note', 'message', {\n feature: 'annotations.notes',\n check: CREATES_ANNOTATIONS,\n }),\n // Link — drag an invisible hit rectangle, then set the target in the style\n // panel's Link control (create-then-edit). While active, existing links\n // become editable rects instead of navigating.\n tool('tool:link', 'link', 'commands.annotate.link', 'link', {\n feature: 'annotations.links',\n check: CREATES_ANNOTATIONS,\n }),\n\n // ── shape tools (real interaction tools) ────────────────────────────────\n tool('tool:square', 'square', 'commands.shapes.rectangle', 'square', {\n feature: 'shapes',\n check: CREATES_ANNOTATIONS,\n accent: { primary: 'color', secondary: 'interiorColor' },\n }),\n tool('tool:circle', 'circle', 'commands.shapes.circle', 'circle', {\n feature: 'shapes',\n check: CREATES_ANNOTATIONS,\n accent: { primary: 'color', secondary: 'interiorColor' },\n }),\n tool('tool:line', 'line', 'commands.shapes.line', 'line', {\n feature: 'shapes',\n check: CREATES_ANNOTATIONS,\n accent: { primary: 'color' },\n }),\n // The arrow tool is a `line` preset (a line with an arrowhead) — registered by\n // the annotationPlugin `tools` config in viewer.tsx, activated like any other tool.\n tool('tool:arrow', 'arrow', 'commands.shapes.arrow', 'lineArrow', {\n feature: 'shapes',\n check: CREATES_ANNOTATIONS,\n accent: { primary: 'color' },\n }),\n tool('tool:polygon', 'polygon', 'commands.shapes.polygon', 'polygon', {\n feature: 'shapes',\n check: CREATES_ANNOTATIONS,\n accent: { primary: 'color', secondary: 'interiorColor' },\n }),\n tool('tool:polyline', 'polyline', 'commands.shapes.polyline', 'zigzag', {\n feature: 'shapes',\n check: CREATES_ANNOTATIONS,\n accent: { primary: 'color' },\n }),\n\n // ── insert tools (stamp/image/attachment real; signature inert) ─────────\n // Stamps open a library, they are not a file dialog: the panel lists the\n // reusable named assets the stamp plugin holds, and picking one arms the\n // annotation plugin's stamp tool with that asset's bytes (stamps-panel.tsx).\n // Arbitrary image bytes are `tool:image` below — a different gesture,\n // so a different button.\n {\n id: 'tool:stamp',\n labelKey: 'commands.insert.stamp',\n icon: 'rubberStamp',\n categories: ['stamps'],\n // Nothing the picker could place without it, as for every insert tool.\n ...PLACES_STAMPS,\n // No stamp plugin → no library to show.\n ...togglesPanel('stamps', (commandContext) => commandContext.tryGet(StampToken) != null),\n },\n // File attachment — click the spot, pick the file (the attachment provider).\n tool('tool:attachment', 'attachment', 'commands.insert.attachment', 'paperclip', {\n feature: 'attachments.adding',\n check: CREATES_ANNOTATIONS,\n }),\n // Signatures open the people panel (libraries of kind 'signatures'): pick a\n // mark → with a target field it signs (or fills) it, else it arms — a click\n // on a signature field signs, anywhere else drops a stamp (Preview).\n {\n id: 'tool:signature',\n labelKey: 'commands.insert.signature',\n icon: 'signature',\n categories: ['signatures.signing'],\n // A mark off a field is a stamp; one on a field is the field's value.\n ...PLACES_STAMPS,\n ...togglesPanel(\n 'signatures',\n (commandContext) =>\n commandContext.tryGet(StampToken) != null && commandContext.tryGet(SignatureToken) != null,\n ),\n },\n // Image — the click-then-pick placement: click the spot, the file dialog\n // opens (narrowed to rasters), the picture lands where you clicked. The\n // tool itself is a `stamp` preset registered in viewer.tsx.\n tool('tool:image', 'image', 'commands.insert.image', 'photo', {\n feature: 'stamps',\n check: CREATES_ANNOTATIONS,\n }),\n\n // ── form design ─────────────────────────────────────────────────────────\n // The switch: on, the design tool and the design sidebar (fields select, move and resize);\n // off, the pointer, where they fill again. A field tool turns design on by itself, and\n // leaving Form mode ends it (its sidebar shows only in Form mode).\n {\n id: 'form:design',\n labelKey: 'commands.form.design',\n icon: 'formDesign',\n categories: ['forms.building'],\n ...DESIGNS_FORMS,\n run: (commandContext) => {\n const tools = interaction(commandContext);\n const shell = commandContext.tryGet(ShellToken);\n if (!tools) return;\n if (isDesigningForm(commandContext)) {\n tools.activateTool('pointer');\n shell?.close(FORM_DESIGN_PANEL);\n return;\n }\n if (shell && !shell.isOpen('mode:form')) shell.open('mode:form', { exclusive: 'mode' });\n tools.activateTool(FORM_DESIGN_TOOL);\n shell?.open(FORM_DESIGN_PANEL);\n },\n active: isDesigningForm,\n enabled: (commandContext) => interaction(commandContext) != null,\n },\n\n // ── form tools (the form plugin's draw-to-place palette) ────────────────\n tool('tool:text-field', 'form-text', 'commands.form.textfield', 'formTextfield', {\n feature: 'forms.building',\n check: DESIGNS_FORMS,\n }),\n tool('tool:checkbox', 'form-checkbox', 'commands.form.checkbox', 'formCheckbox', {\n feature: 'forms.building',\n check: DESIGNS_FORMS,\n }),\n tool('tool:radio', 'form-radio', 'commands.form.radio', 'formRadio', {\n feature: 'forms.building',\n check: DESIGNS_FORMS,\n }),\n tool('tool:combo-box', 'form-combobox', 'commands.form.select', 'formSelect', {\n feature: 'forms.building',\n check: DESIGNS_FORMS,\n }),\n tool('tool:list-box', 'form-listbox', 'commands.form.listbox', 'formListbox', {\n feature: 'forms.building',\n check: DESIGNS_FORMS,\n }),\n tool('tool:button', 'form-button', 'commands.form.button', 'formButton', {\n feature: 'forms.building',\n check: DESIGNS_FORMS,\n }),\n tool('tool:signature-field', 'form-signature', 'commands.form.signature', 'signature', {\n feature: 'forms.building',\n check: DESIGNS_FORMS,\n }),\n\n // ── redaction (the toolbar arms the tool; the panel owns the destructive\n // verbs — Apply All / Clear live in the redaction sidebar) ─────────────────\n // Marks are annotations, so marking is `redaction.canMark()`.\n tool('tool:redact', 'redact', 'commands.redact.mark', 'redactArea', {\n feature: 'redaction',\n check: {\n allowed: (commandContext) => commandContext.tryGet(RedactionToken)?.canMark() ?? true,\n notAllowedKey: 'commands.notAllowed.annotations-create',\n },\n }),\n {\n id: 'redaction:apply',\n labelKey: 'commands.redact.applyAll',\n icon: 'redact',\n categories: ['redaction'],\n allowed: (commandContext) => commandContext.tryGet(RedactionToken)?.canApply() ?? true,\n // It can't be undone, so it asks first: the confirmation applies.\n modal: REDACT_CONFIRM_DIALOG,\n enabled: (commandContext) => {\n const redaction = commandContext.tryGet(RedactionToken);\n return !!redaction && redaction.getPendingCount() > 0 && !redaction.isApplying();\n },\n },\n\n // ── measurement: the tools need a calibrated page right now (`canMeasure`) ──\n {\n ...tool('tool:distance', 'distance', 'measurement.distance', 'distance', {\n feature: 'measurement',\n check: CREATES_ANNOTATIONS,\n accent: { primary: 'color' },\n }),\n enabled: canMeasureNow,\n },\n {\n ...tool('tool:perimeter', 'perimeter', 'measurement.perimeter', 'perimeter', {\n feature: 'measurement',\n check: CREATES_ANNOTATIONS,\n accent: { primary: 'color' },\n }),\n enabled: canMeasureNow,\n },\n {\n ...tool('tool:area', 'area', 'measurement.area', 'area', {\n feature: 'measurement',\n check: CREATES_ANNOTATIONS,\n accent: { primary: 'color' },\n }),\n enabled: canMeasureNow,\n },\n {\n id: 'measurement:calibrate',\n labelKey: 'measurement.calibrate',\n icon: 'calibrate',\n categories: ['measurement'],\n // Setting a page's scale changes the document.\n allowed: (commandContext) => commandContext.tryGet(MeasurementToken)?.canCalibrate() ?? true,\n notAllowedKey: 'commands.notAllowed.doc-annotate-modify',\n enabled: (commandContext) => commandContext.tryGet(MeasurementToken) != null,\n active: (commandContext) => interaction(commandContext)?.getActiveToolId() === 'calibrate',\n run: (commandContext) => commandContext.tryGet(MeasurementToken)?.startCalibration(),\n },\n\n // ── annotation selection (the floating strip's verbs) ──────────────────\n {\n id: 'annotation:cancel-creation',\n labelKey: 'commands.annotate.cancelCreation',\n // No feature: it only ends a drawing in progress. A command that's turned\n // off keeps its keys, and Escape belongs to whatever else is open.\n shortcut: 'Escape',\n enabled: (commandContext) => anno(commandContext)?.draft.get() != null,\n run: (commandContext) => anno(commandContext)?.draft.cancel(),\n },\n {\n id: 'annotation:delete',\n labelKey: 'commands.annotate.delete',\n icon: 'trash',\n // Backspace is the Delete key of a Mac keyboard.\n shortcut: ['Delete', 'Backspace'],\n categories: ['annotations'],\n // One change for the whole selection: a form widget lent to the annotation\n // plugin is deleted as the form says (its field, when every widget of it goes).\n run: (commandContext) => void anno(commandContext)?.selection.delete(),\n visible: hasAnnotationSelection,\n // Mirrors the engine's own authorization, which is per annotation (whose\n // it is), not the scope's: locked/unauthorized annotations keep the button\n // visible but disabled (the engine still enforces), and so do the ones a\n // turned-off feature froze (`isEditable`).\n enabled: (commandContext) => {\n const annotation = anno(commandContext);\n const selected = annotation?.selection.list() ?? [];\n return (\n selected.length > 0 &&\n selected.every(({ ref }) => annotation!.canDelete(ref) && annotation!.isEditable(ref))\n );\n },\n },\n {\n id: 'annotation:comment',\n labelKey: 'commands.comment',\n icon: 'comment',\n categories: ['comments'],\n // The comments panel, which shows the selected annotation's thread.\n ...togglesPanel(\n 'comments',\n (commandContext) =>\n hasAnnotationSelection(commandContext) && !selectionSubtypes(commandContext).has('widget'),\n ),\n },\n {\n id: 'annotation:style',\n labelKey: 'commands.style',\n icon: 'palette',\n categories: ['annotations'],\n // The kind table decides: no declared editable props → no style button.\n ...togglesPanel(\n 'style',\n (commandContext) =>\n (anno(commandContext)?.selection.getProperties().properties.length ?? 0) > 0,\n ),\n },\n {\n // The selection becomes a reusable stamp: the engine flattens the\n // selected appearances into one page (vector, positions kept) and the\n // stamp plugin files it under the user's own library — persisted like\n // any library, exportable as a PDF Acrobat reads.\n id: 'annotation:stamp-from-selection',\n labelKey: 'commands.annotate.stampFromSelection',\n icon: 'rubberStampPlus',\n categories: ['stamps'],\n // The stamp carries the annotations' appearances out of the document.\n allowed: (commandContext) =>\n commandContext\n .tryGet(StampToken)\n ?.canCreateFromAnnotations(commandContext.documentId ?? undefined) ?? true,\n notAllowedKey: 'commands.notAllowed.doc-download',\n run: (commandContext) => {\n const annotation = anno(commandContext);\n const stamp = commandContext.tryGet(StampToken);\n const documentId = commandContext.documentId;\n if (!annotation || !stamp || documentId == null) return;\n const dtos = annotation.selection.list();\n const page = dtos[0]?.ref.page;\n if (page === undefined) return;\n const i18n = commandContext.tryGet(I18nToken);\n const label = i18n?.t('demo.stampsCustomLabel') ?? 'Custom stamp';\n const libraryName = i18n?.t('demo.stampsCustomLibrary') ?? 'My stamps';\n const libraryId = CUSTOM_LIBRARY_ID;\n const ensureLibrary = stamp.getLibrary(libraryId)\n ? Promise.resolve(libraryId)\n : stamp\n .createLibrary(libraryName, { id: libraryId, categories: ['custom'] })\n .then(({ library }) => library.id);\n ensureLibrary\n .then((id) =>\n stamp.createAssetFromAnnotations(\n page,\n dtos.map((annotation) => annotation.ref),\n { libraryId: id, label: `${label} ${stamp.listAssets({ libraryId: id }).length + 1}` },\n { documentId },\n ),\n )\n // Open the stamps panel on the custom library, through its own command;\n // the panel reads its surface's props for its picker.\n .then(async () => {\n const shell = commandContext.tryGet(ShellToken);\n if (!shell) return;\n if (!shell.isOpen('stamps')) {\n await commandContext\n .tryGet(CommandsToken)\n ?.execute(panelCommandOf('stamps'), { documentId });\n }\n shell.updateSurfaceProps('stamps', { libraryId });\n })\n .catch((error) => console.warn('[embedpdf] stamp from selection failed', error));\n },\n // One page, no widgets (a form field is not artwork), no pending\n // redaction marks, and a library to put it in. The engine refuses hidden\n // or appearance-less annotations itself — all-or-nothing, never a stamp\n // missing a part.\n visible: (commandContext) =>\n commandContext.tryGet(StampToken) != null &&\n hasAnnotationSelection(commandContext) &&\n !selectionSubtypes(commandContext).has('widget') &&\n !selectionSubtypes(commandContext).has('redact') &&\n new Set(\n (anno(commandContext)?.selection.list() ?? []).map(\n (annotation) => annotation.ref.page.objectNumber,\n ),\n ).size === 1,\n },\n {\n id: 'annotation:group',\n labelKey: 'commands.annotate.group',\n icon: 'group',\n categories: ['annotations'],\n run: (commandContext) => void anno(commandContext)?.selection.group(),\n visible: (commandContext) =>\n (anno(commandContext)?.selection.canGroup() ?? false) && selectionEditable(commandContext),\n },\n {\n id: 'annotation:ungroup',\n labelKey: 'commands.annotate.ungroup',\n icon: 'ungroup',\n categories: ['annotations'],\n run: (commandContext) => void anno(commandContext)?.selection.ungroup(),\n visible: (commandContext) =>\n (anno(commandContext)?.selection.canUngroup() ?? false) && selectionEditable(commandContext),\n },\n\n // ── text selection (the selection strip's verbs) ────────────────────────\n {\n id: 'selection:copy',\n labelKey: 'commands.selection.copy',\n icon: 'copy',\n categories: ['text.copy'],\n // A deployment denying doc.text.copy shows no Copy at all — and with zero\n // visible commands the strip renders nothing, so there is never an empty\n // bubble. Ctrl/Cmd+C is the clipboard wiring's, which says it isn't allowed.\n allowed: (commandContext) => textSelection(commandContext)?.canCopy() ?? true,\n notAllowedKey: 'commands.notAllowed.doc-text-copy',\n visible: (commandContext) => textSelection(commandContext)?.hasSelection() ?? false,\n // Async Clipboard write inside the click's activation window; instant\n // when <SelectionClipboard>'s commit prefetch already fetched the text.\n // A successful copy consumes the selection, which also dismisses its strip.\n run: (commandContext) => {\n const selection = textSelection(commandContext);\n if (!selection) return;\n const copiedRange = selection.getRange();\n void copySelection(selection).then(\n (text) => {\n // Clipboard writes can outlive the click. Never let an older copy\n // completion clear a newer selection the user made in the meantime.\n if (text !== '' && sameTextRange(selection.getRange(), copiedRange)) selection.clear();\n },\n () => {}, // Copy failed: preserve the selection so the user can retry.\n );\n },\n },\n\n markupSelection(\n 'selection:highlight',\n 'highlight',\n 'commands.annotate.highlight',\n 'highlight',\n 'annotations.highlight',\n ),\n markupSelection(\n 'selection:underline',\n 'underline',\n 'commands.annotate.underline',\n 'underline',\n 'annotations.markup',\n ),\n markupSelection(\n 'selection:strikeout',\n 'strikeout',\n 'commands.annotate.strikeout',\n 'strikethrough',\n 'annotations.markup',\n ),\n\n // ── link strip items: Link / Go to link / Remove link ────────────────────\n {\n // Make the selection a link: opens the anchored popover (a link is a\n // verb on the selection, not a style), whose editor sets\n // the target through `selection.updateLink(target)`; the plugin's\n // reconciler materializes the attached child annotations.\n id: 'annotation:link',\n labelKey: 'commands.annotate.link',\n icon: 'link',\n categories: ['annotations.links'],\n run: (commandContext) => commandContext.tryGet(ShellToken)?.toggle('link-editor'),\n active: (commandContext) => commandContext.tryGet(ShellToken)?.isOpen('link-editor') ?? false,\n visible: (commandContext) => selectionLink(commandContext) === null,\n },\n {\n id: 'annotation:goto-link',\n labelKey: 'commands.annotate.gotoLink',\n icon: 'externalLink',\n // No feature: following a link is reading the document.\n run: (commandContext) => {\n const target = selectionLink(commandContext);\n // Following a link opens a website too, through the link layer's opener.\n if (target) commandContext.tryGet(LinkToken)?.activate(target);\n },\n visible: (commandContext) => selectionLink(commandContext) != null,\n },\n {\n id: 'annotation:remove-link',\n labelKey: 'commands.annotate.removeLink',\n icon: 'linkOff',\n categories: ['annotations.links'],\n run: (commandContext) => anno(commandContext)?.selection.updateLink(null),\n visible: (commandContext) => selectionLink(commandContext) != null,\n },\n\n // ── the keyboard ────────────────────────────────────────────────────────\n {\n // No feature: it only says which keys do what.\n id: 'help:shortcuts',\n labelKey: 'commands.shortcuts',\n shortcut: '?',\n modal: SHORTCUTS_DIALOG,\n enabled: (commandContext) => commandContext.tryGet(ShellToken) != null,\n },\n\n // ── history ──────────────────────────────────────────────────────────────\n // Focus in a text field keeps its own undo: shortcuts skip text fields.\n {\n id: 'history:undo',\n labelKey: 'commands.undo',\n icon: 'arrowBackUp',\n shortcut: 'Mod+z',\n run: (commandContext) => commandContext.tryGet(HistoryToken)?.undo(),\n enabled: (commandContext) => commandContext.tryGet(HistoryToken)?.canUndo() ?? false,\n },\n {\n id: 'history:redo',\n labelKey: 'commands.redo',\n icon: 'arrowForwardUp',\n shortcut: ['Shift+Mod+z', 'Mod+y'],\n run: (commandContext) => commandContext.tryGet(HistoryToken)?.redo(),\n enabled: (commandContext) => commandContext.tryGet(HistoryToken)?.canRedo() ?? false,\n },\n];\n\n// ── mode helpers ─────────────────────────────────────────────────────────────\n// Modes are exclusive shell surfaces tagged 'mode'; the secondary band renders\n// whichever one is open. Kept below the array to keep the list readable.\nexport const MODE_SURFACES = [\n 'mode:annotate',\n 'mode:shapes',\n 'mode:insert',\n 'mode:form',\n 'mode:redact',\n 'mode:measure',\n] as const;\n\nfunction modeCommand(\n id: (typeof MODE_SURFACES)[number],\n labelKey: string,\n { feature }: { feature?: Feature } = {},\n): CommandDef {\n return {\n id,\n labelKey,\n // The tab goes with its feature; a tab of several features stays.\n ...(feature ? { categories: [feature] } : {}),\n // A mode tab is a shell surface and a tool policy: every tab (and closing\n // one) drops back to the default pointer, where widgets are fill controls;\n // form design is `form:design`'s switch inside the Form tab.\n run: (commandContext) => {\n const shell = commandContext.tryGet(ShellToken);\n shell?.toggle(id, { exclusive: 'mode' });\n interaction(commandContext)?.activateTool('pointer');\n },\n active: (commandContext) => commandContext.tryGet(ShellToken)?.isOpen(id) ?? false,\n };\n}\n\n// ── your own tools ───────────────────────────────────────────────────────────\n\n/**\n * A `tool:<id>` command for each tool of yours (`plugins.annotation.tools`) that no command has\n * (`isTaken` says which ids do): labelled by its `meta.label`, else its id; drawn with its\n * `meta.icon`, else the icon of the tool it extends; in that tool's feature, else `annotations`.\n */\nexport function toolCommandsFor(\n tools: readonly AnnotationToolInput[],\n isTaken: (id: string) => boolean,\n): CommandDef[] {\n return tools.flatMap((input): CommandDef[] => {\n const id = `tool:${input.id}`;\n if (isTaken(id)) return [];\n const base = input.extends;\n const meta = input.meta ?? {};\n const icon = typeof meta.icon === 'string' ? meta.icon : base && TOOL_ICONS[base]?.icon;\n const command = toolCommand(id, input.id, icon || undefined, {\n feature: (base && TOOL_FEATURES[base]) || 'annotations',\n check: CREATES_ANNOTATIONS,\n ...(base && TOOL_ICONS[base]?.accent ? { accent: TOOL_ICONS[base].accent } : {}),\n });\n return [{ ...command, label: typeof meta.label === 'string' ? meta.label : input.id }];\n });\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAaA,MAAa,WAAW;;AAGxB,SAAgB,kBAAkB,OAAuC;CACvE,OAAO,MAAM,iBAAiB,CAAC,CAAC,MAAM,YAAY,QAAQ,cAAA,MAAsB,CAAC,EAAE,MAAM;AAC3F;;AAUA,SAAgB,YAAY,MAA8B;CACxD,QAAA,GAAA,kBAAA,QAAA,CAAe,IAAI,CAAC,CAAC,KAAK,SAAS;EACjC,MAAM,UAAA,GAAA,kBAAA,WAAA,CAAoB,MAAM,IAAI,CAAC,CAClC,KAAK,UAAU,KAAK,KAAM,MAAO,CAAC,CAClC,MAAM,QAAQ,IAAI,UAAU,KAAA,KAAa,IAAI,aAAa,KAAA,CAAS;EACtE,OAAO;GAAE;GAAM,OAAO,QAAQ;GAAO,UAAU,QAAQ;EAAS;CAClE,CAAC;AACH;;AAGA,MAAa,iBAAiB,MAA2B,UACvD,KAAK,WAAW,MAAM,UACtB,KAAK,OACF,MAAM,MACL,KAAK,SAAS,MAAM,EAAE,CAAE,QACxB,KAAK,UAAU,MAAM,EAAE,CAAE,SACzB,KAAK,aAAa,MAAM,EAAE,CAAE,QAChC;;;;;;AAOF,SAAgB,gBACd,OACA,SACc;CACd,OAAO,MACJ,QAAQ,SAAS,CAAC,SAAA,GAAA,kBAAA,cAAA,CAAsB,KAAK,IAAI,CAAC,CAAC,CAAC,CACpD,KAAK,SAAS;EACb,MAAM,MAAA,GAAA,kBAAA,cAAA,CAAmB,KAAK,IAAI;EAClC,OAAO;GACL;GACA,OAAO,KAAK,UAAU,KAAK,aAAa,KAAA,IAAY,KAAK,OAAO,KAAA;GAChE,UAAU,KAAK;GACf,MAAM,mBAAmB;IA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