/**
 * using different packages in different environments, include node and browser
 */
declare function resolve(...args: string[]): string;
declare function basename(p: string, ext?: string): string;
declare function extname(p: string): string;
declare function dirname(p: string): string;
declare function isAbsolutePosix(p: string): boolean;
declare function joinPosix(...paths: string[]): string;
declare const _default: {
    resolve: typeof resolve;
    basename: typeof basename;
    extname: typeof extname;
    dirname: typeof dirname;
    isAbsolutePosix: typeof isAbsolutePosix;
    joinPosix: typeof joinPosix;
};

/**
 * The code comes from https://github.com/Leonidas-from-XIV/node-xml2js/blob/master/src/parser.coffee
 */

interface ParserOptions {
    strict?: boolean;
    xmlns?: boolean;
    normalizeTags?: boolean;
    attrkey?: string;
    tagNameProcessors?: Function[];
    chunkSize?: number;
    explicitArray?: boolean;
    attrValueProcessors?: Function[];
    attrNameProcessors?: Function[];
    trim?: boolean;
    normalize?: boolean;
    mergeAttrs?: boolean;
    explicitCharkey?: boolean;
    emptyTag?: any;
    validator?: Function;
    explicitChildren?: boolean;
    preserveChildrenOrder?: boolean;
    charsAsChildren?: boolean;
    includeWhiteChars?: boolean;
    childkey?: string;
    explicitRoot?: boolean;
    [key: string]: any;
}

declare function parsexml(str: string | Uint8Array, optionsParserOptions?: ParserOptions): Promise<any>;
declare function camelCase(str: string): string;

interface FileInfo {
  fileName: string
}

interface SpineItem {
  id: string
}
type Spine = SpineItem[]

interface TocItem {
  label: string
  href: string
  id?: string
  children?: TocItem[]
}
type Toc = TocItem[]

interface CssPart {
  id: string
  href: string
}

interface ProcessedChapter {
  css: CssPart[]
  html: string
}

interface ResolvedHref {
  id: string
  selector: string
}

type Metadata = Record<string, any>

type InputFile = string | File | Uint8Array

interface EBookParser {
  getSpine: () => Spine
  loadChapter: (id: string) => Promise<ProcessedChapter | undefined> | ProcessedChapter | undefined
  getToc: () => Toc
  getMetadata: () => Metadata
  getFileInfo: () => FileInfo
  getCoverImage?: () => string
  resolveHref: (href: string) => ResolvedHref | undefined
  destroy: () => void
}

export { type CssPart, type EBookParser, type FileInfo, type InputFile, type Metadata, type ProcessedChapter, type ResolvedHref, type Spine, type SpineItem, type Toc, type TocItem, camelCase, parsexml, _default as path };
