import { useEffect, useState } from 'react';
import { Viewer, DocumentGate } from '@embedpdf/react/runtime';
import type { OpenInput } from '@embedpdf/react/runtime';
import { Stage, stagePlugin, useStageState } from '@embedpdf/react/stage';
import { RenderLayer, renderPlugin } from '@embedpdf/react/render';
import {
actionsPlugin,
useActions,
useActionsUiAdapter,
type PdfNamedAction,
} from '@embedpdf/react/actions';
import { cloudEngine } from '@cloudpdf/engine';
import './run-from-code.css';
const engine = cloudEngine();
const plugins = [stagePlugin(), renderPlugin(), actionsPlugin()];
const welcome: OpenInput = { kind: 'grant', grant: 'shr_gvpJcG1ULUMon19C0D1wODSY' };
const VERBS: ReadonlyArray<[PdfNamedAction, string]> = [
['FirstPage', '⇤ First'],
['PrevPage', '‹ Previous'],
['NextPage', 'Next ›'],
['LastPage', 'Last ⇥'],
['Print', 'Print'],
];
// The viewer actions a PDF's buttons name, run from your own buttons.
function NamedActions() {
const actions = useActions();
const { currentPageIndex, pageCount } = useStageState();
const [ran, setRan] = useState