import { useRef, useState } from 'react';
import { Viewer, DocumentGate } from '@embedpdf/react/runtime';
import type { OpenInput } from '@embedpdf/react/runtime';
import { Stage, stagePlugin } from '@embedpdf/react/stage';
import { RenderLayer, renderPlugin } from '@embedpdf/react/render';
import { SelectionLayer, selectionPlugin } from '@embedpdf/react/selection';
import {
interactionPlugin,
useInteraction,
useInteractionState,
} from '@embedpdf/react/interaction';
import {
AnnotationLayer,
annotationPlugin,
useAnnotation,
useAnnotationEvent,
useAnnotationState,
} from '@embedpdf/react/annotation';
import { cloudEngine } from '@cloudpdf/engine';
import './events.css';
const engine = cloudEngine();
const plugins = [
stagePlugin(),
renderPlugin(),
interactionPlugin(),
selectionPlugin(),
annotationPlugin(),
];
const report: OpenInput = { kind: 'grant', grant: 'shr__TWhIGdJtaKlcnVgJdg--bcm' };
interface Entry {
id: number;
text: string;
origin: string;
}
// Every change, once the engine has saved it, newest first.
function ActivityLog() {
const [entries, setEntries] = useState
{entries.length === 0 &&
);
}
const TOOLS = [
{ id: 'pointer', label: 'Select' },
{ id: 'square', label: 'Rectangle' },
{ id: 'ink', label: 'Pen' },
];
function Toolbar() {
const annotation = useAnnotation();
const interaction = useInteraction();
const { activeToolId } = useInteractionState();
const { selected } = useAnnotationState();
return (