import { Viewer, DocumentGate } from '@embedpdf/react/runtime';
import type { OpenInput } from '@embedpdf/react/runtime';
import { Stage, stagePlugin, useStage } from '@embedpdf/react/stage';
import { RenderLayer, renderPlugin } from '@embedpdf/react/render';
import { interactionPlugin } from '@embedpdf/react/interaction';
import { FormLayer, formPlugin } from '@embedpdf/react/form';
import type { FieldControl, FieldControlProps } from '@embedpdf/react/form';
import { localEngine } from '@embedpdf/engine';
import './controls.css';
const engine = localEngine();
const plugins = [stagePlugin(), renderPlugin(), interactionPlugin(), formPlugin()];
const forms = async (): Promise => {
const response = await fetch('https://www.embedpdf.com/pdfs/forms.pdf');
return { kind: 'bytes', id: 'forms', bytes: new Uint8Array(await response.arrayBuffer()) };
};
/** A checkbox as a switch. A click fills the field in, as a click on the checkbox would. */
function Switch({ widget, setValue }: FieldControlProps) {
if (widget.control !== 'toggle') return null;
return (
}>
{() => (
<>
>
)}
);
}