import { Align, Align as Align$1, BarcodeOptions, BarcodeOptions as BarcodeOptions$1, BarcodeType, BarcodeType as BarcodeType$1, CashDrawerPin, CashDrawerPin as CashDrawerPin$1, CharacterSet, DeserializedCommand, DeserializedCommandName, Printer, PrinterOptions, PrinterType, QRCodeOptions, QRCodeOptions as QRCodeOptions$1, TextFont, TextFont as TextFont$1, TextSize, TextSize as TextSize$1, TextUnderline, TextUnderline as TextUnderline$1, TextWordBreak, decode, deserialize, encode } from "@react-thermal-printer/printer";
import { ComponentProps, JSX, ReactElement, ReactNode } from "react";
import { Image, ImageToRasterOptions, ImageTransform } from "@react-thermal-printer/image";
import * as react_jsx_runtime0 from "react/jsx-runtime";

//#region src/types/PrinterContext.d.ts
interface PrinterContext {
  printer: Printer;
  width: number;
  reset(): void;
}
//#endregion
//#region src/types/Printable.d.ts
interface Printable<Props = any> {
  (props: Props): JSX.Element | null;
  print: (elem: ReactElement<Props>, context: PrinterContext) => void | Promise<void>;
}
//#endregion
//#region src/components/Barcode.d.ts
interface BarcodeProps extends BarcodeOptions$1 {
  type: BarcodeType$1;
  align?: Align$1;
  content: string;
}
/**
 * @public
 * @name Barcode
 * @category components
 * @signature
 * ```tsx
 * function Barcode(props: BarcodeProps): JSX.Element;
 * ```
 *
 * @description
 * Print barcode.
 *
 * ```tsx
 * <Barcode type="UPC-A" content="111111111111" />
 * <Barcode type="CODE39" content="A000$" />
 * <Barcode align="center" type="UPC-A" content="111111111111" />
 * ```
 */
declare const Barcode: Printable<BarcodeProps>;
//#endregion
//#region src/types/HTMLProps.d.ts
type JSXElement = keyof JSX.IntrinsicElements;
type JSXElementProps<E extends JSXElement> = JSX.IntrinsicElements[E];
type ExtendHTMLProps<As extends JSXElement, Props = {}> = Props & Omit<JSXElementProps<As>, keyof Props>;
//#endregion
//#region src/components/Br.d.ts
type BrProps = ExtendHTMLProps<'br'>;
/**
 * @public
 * @name Br
 * @category components
 * @signature
 * ```tsx
 * function Br(props: BrProps): JSX.Element;
 * ```
 *
 * @description
 * Feed line.
 *
 * ```tsx
 * <Br />
 * ```
 */
declare const Br: Printable;
//#endregion
//#region src/components/Cashdraw.d.ts
interface CashdrawProps {
  /** pin to generate pulse */
  pin: CashDrawerPin$1;
}
/**
 * @public
 * @name Cashdraw
 * @category components
 * @signature
 * ```tsx
 * function Cashdraw(props: CashdrawProps): JSX.Element;
 * ```
 *
 * @description
 * Open cash drawer.
 *
 * ```tsx
 * <Cashdraw pin="2pin" />
 * <Cashdraw pin="5pin" />
 * ```
 */
declare const Cashdraw: Printable<CashdrawProps>;
//#endregion
//#region src/components/Cut.d.ts
interface CutProps {
  /**
   * cut after line feeds
   * @default 6
   */
  lineFeeds?: number;
  /**
   * partial cut
   * @default false
   */
  partial?: boolean;
}
/**
 * @public
 * @name Cut
 * @category components
 * @signature
 * ```tsx
 * function Cut(props: CutProps): JSX.Element;
 * ```
 *
 * @description
 * Cut the paper.
 *
 * Perform full/partial cutting, and feeds lines after cutting.
 *
 * ```tsx
 * <Cut />
 * <Cut lineFeeds={6} />
 * // partial cut
 * <Cut partial={true} />
 * ```
 */
declare const Cut: Printable<CutProps>;
//#endregion
//#region src/components/Image.d.ts
type ImageProps = ExtendHTMLProps<'img', {
  align?: Align$1;
  src: string;
  /**
   * Image transformer.
   * @example
   * // Greyscale dithering with floyd-steinberg algorithm.
   * import { transforms } from '@react-thermal-printer/image';
   *
   * <Image transforms={[transforms.floydSteinberg]} {...} />
   */
  transforms?: ImageTransform[];
  rgbToBlack?: ImageToRasterOptions['rgbToBlack'];
  /**
   * Image data reader
   * @default read data from <img /> and <canvas />
   */
  reader?: (elem: ReactElement<ImageProps>) => Promise<Image>;
}>;
/**
 * @public
 * @name Image
 * @category components
 * @signature
 * ```tsx
 * function Image(props: ImageProps): JSX.Element;
 * ```
 *
 * @description
 * Print image bitmap.
 *
 * ```tsx
 * <Image src="https://my-cdn.com/image.png" />
 * <Image align="center" src="https://my-cdn.com/image.png" />
 * <Image src="https://my-cdn.com/image.png" reader={myCustomImageReader} />
 *
 * // A custom reader for reading image binary data.
 * function myCustomImageReader(
 *   elem: ReactElement<ComponentProps<typeof Image>>
 * ): Promise<Image>;
 * ```
 *
 * By passing transform functions, image can be converted.
 *
 * The example below applies the [Floyd-Steinberg dithering](https://en.wikipedia.org/wiki/Floyd%E2%80%93Steinberg_dithering) algorithm:
 * ```tsx
 * import { transforms } from '@react-thermal-printer/image';
 *
 * <Image src="https://my-cdn.com/image.png" transforms={[transforms.floydSteinberg]} />
 * ```
 */
declare const ImageComp: Printable<ImageProps>;
//#endregion
//#region src/components/Line.d.ts
type LineProps = ExtendHTMLProps<'hr', {
  /**
   * Character to draw line
   * @default '-'
   */
  character?: string;
}>;
/**
 * @public
 * @name Line
 * @category components
 * @signature
 * ```tsx
 * function Line(props: LineProps): JSX.Element;
 * ```
 *
 * @description
 * Draw line. Prints the character as much as the `width` which from `<Printer>`.
 *
 * ```tsx
 * <Line />
 * <Line character="=" />
 * ```
 */
declare const Line: Printable<LineProps>;
//#endregion
//#region src/components/Printer.d.ts
interface PrinterProps$1 extends PrinterOptions {
  /**
   * number of characters in one line
   * @default 48
   */
  width?: number;
  /**
   * whether to put initialize command to last
   * @default true
   */
  initialize?: boolean;
  /** log esc/pos commands before render. */
  debug?: boolean;
  children: ReactNode;
}
/**
 * @public
 * @name Printer
 * @category components
 * @signature
 * ```tsx
 * function Printer(props: PrinterProps): JSX.Element;
 * ```
 *
 * @description
 * Interface of thermal printer.
 *
 * Requires `type` to determine a printer type.
 *
 * Currently, supports `epson` and `start` printers.
 *
 * ```tsx
 * <Printer type="epson">...</Printer>
 * <Printer type="epson" width={42}>...</Printer>
 * <Printer type="epson" characterSet="korea">...</Printer>
 * ```
 *
 * ### With custom encoder
 * Pass `encoder` prop to use custom encoder.
 *
 * ```tsx
 * // utf8 encoding
 * const encoder = text => new TextEncoder().encode(text);
 * const receipt = (
 *   <Printer type="epson" encoder={encoder}>
 *     ...
 *   </Printer>
 * );
 * ```
 */
declare function PrinterComp({
  type,
  width,
  characterSet,
  initialize,
  debug,
  children,
  className,
  ...props
}: ExtendHTMLProps<'div', PrinterProps$1>): react_jsx_runtime0.JSX.Element;
//#endregion
//#region src/components/QRCode.d.ts
interface QRCodeProps extends QRCodeOptions$1 {
  align?: Align$1;
  content: string;
}
/**
 * @public
 * @name QRCode
 * @category components
 * @signature
 * ```tsx
 * function QRCode(props: QRCodeProps): JSX.Element;
 * ```
 *
 * @description
 * Print qr code (2d barcode).
 *
 * ```tsx
 * <QRCode content="https://github.com/seokju-na/react-thermal-printer" />
 * <QRCode align="center" content="https://github.com/seokju-na/react-thermal-printer" />
 * ```
 */
declare const QRCode: Printable<QRCodeProps>;
//#endregion
//#region src/components/Raw.d.ts
interface RawProps {
  data: Uint8Array | number[];
}
/**
 * @public
 * @name Raw
 * @category components
 * @signature
 * ```tsx
 * function Raw(props: RawProps): JSX.Element;
 * ```
 *
 * @description
 * Print raw data.
 *
 * ```tsx
 * <Raw data={Uint8Array.from([0x00, 0x01, ...])} />
 * ```
 */
declare const Raw: Printable<RawProps>;
//#endregion
//#region src/components/Text.d.ts
type TextProps = ExtendHTMLProps<'div', {
  align?: Align$1;
  bold?: boolean;
  font?: TextFont$1;
  underline?: TextUnderline$1;
  invert?: boolean;
  size?: {
    width: TextSize$1;
    height: TextSize$1;
  };
  wordBreak?: 'break-all' | 'break-word';
  /** if true, don't feed line after print text */
  inline?: boolean;
  children?: ReactNode;
}>;
/**
 * @public
 * @name Text
 * @category components
 * @signature
 * ```tsx
 * function Text(props: TextProps): JSX.Element;
 * ```
 *
 * @description
 * Display text, and change text size or style to make it bold, underline, etc.
 *
 * `<Text>` component also allows `<div>` element props.
 *
 * **Note**: `<Text>` allows only string nodes.
 *
 * ```tsx
 * <Text>text</Text>
 * <Text>fragment is {'allowed'}</Text>
 * <Text align="center">center text</Text>
 * <Text align="right">right text</Text>
 * <Text bold={true}>bold text</Text>
 * <Text underline="1dot-thick">underline text</Text>
 * <Text invert={true}>invert text</Text>
 * <Text size={{ width: 2, height: 2 }}>big size text</Text>
 * ```
 */
declare const Text: Printable<TextProps>;
//#endregion
//#region src/components/Row.d.ts
type RowProps = ExtendHTMLProps<'div', {
  left: string | ReactElement<ComponentProps<typeof Text>>;
  center?: string | ReactElement<ComponentProps<typeof Text>>;
  right: string | ReactElement<ComponentProps<typeof Text>>;
  /**
   * gap between left and right
   * @default 0
   */
  gap?: number;
  children?: never;
}>;
/**
 * @public
 * @name Row
 * @category components
 * @signature
 * ```tsx
 * function Row(props: RowProps): JSX.Element;
 * ```
 *
 * @description
 * Display `<Text>` on the left, center and right sides.
 *
 * ```tsx
 * <Row left="left" right="right" />
 * <Row left="left" right="right" gap={2} />
 * <Row left="left" center="center" right="right" />
 * <Row
 *   left={<Text>left</Text>}
 *   right="right"
 * />
 * <Row
 *   left={<Text>left</Text>}
 *   right="very very long text will be multi line placed."
 * />
 * ```
 */
declare const Row: Printable<RowProps>;
//#endregion
//#region src/render.d.ts
type PrinterProps = ComponentProps<typeof PrinterComp>;
interface RenderOptions {
  resetPrinter?: (printer: Printer) => void;
}
/**
 * @public
 * @name render
 * @category functions
 * @signature
 * ```typescript
 * function render(elem: ReactElement<PrinterProps>, options?: RenderOptions): Promise<Uint8Array>;
 * ```
 *
 * @description
 * Render the React element as printable binary data.
 *
 * @param {ReactElement<PrinterProps>} elem - The React element to render.
 * @param {RenderOptions} [options] - Optional rendering options.
 * @returns {Promise<Uint8Array>} The printable binary data.
 *
 * @example
 * ```tsx
 * import { Printer, Text, render } from 'react-thermal-printer';
 *
 * const receipt = (
 *   <Printer type="epson">
 *     <Text>$5.00</Text>
 *   </Printer>
 * );
 * const data = await render(receipt);
 *
 * // Prints receipt data via serial port.
 * const port = await navigator.serial.requestPort();
 * await port.open({ baudRate: 9600 });
 * const writer = port.writable.getWriter();
 * await writer.write(data);
 * writer.releaseLock();
 * ```
 */
declare function render(elem: ReactElement<PrinterProps>, options?: RenderOptions): Promise<Uint8Array>;
//#endregion
//#region src/utils/textLength.d.ts
declare function textLength(text: string, {
  size
}?: {
  size?: TextSize$1;
}): number;
//#endregion
//#region src/utils/wrapText.d.ts
/** wrap text to multiple lines */
declare function wrapText(text: string, options: {
  size?: TextSize$1;
  width: number;
  wordBreak?: TextWordBreak;
}): string[];
//#endregion
export { type Align, Barcode, type BarcodeOptions, BarcodeProps, type BarcodeType, Br, BrProps, type CashDrawerPin, Cashdraw, CashdrawProps, type CharacterSet, Cut, CutProps, type DeserializedCommand, type DeserializedCommandName, ImageComp as Image, Line, LineProps, PrinterComp as Printer, type PrinterType, QRCode, type QRCodeOptions, QRCodeProps, Raw, RawProps, RenderOptions, Row, RowProps, Text, type TextFont, TextProps, type TextSize, type TextUnderline, decode, deserialize, encode, render, textLength, wrapText };