//#region src/api.d.ts
interface ApiConfig {
  readonly API_URL: string;
  readonly timeout: number;
  readonly request?: Readonly<RequestInit>;
}
type FetchResponseError<C extends string, E = unknown> = {
  readonly ok: false;
  readonly error_code: C;
  readonly error: E;
};
type FetchResponseData<T, E> = Readonly<{
  ok: true;
  data: T;
  response: Response;
} | {
  ok: false;
  error_code: "NOT_OK";
  data: E;
  response: Response;
}> | FetchResponseError<"SYNTAX_ERROR", SyntaxError> | FetchResponseError<"TIMEOUT", DOMException> | FetchResponseError<"UNKNOWN_ERROR">;
type FetchResponse<T, E = unknown> = Promise<FetchResponseData<T, E>>;
//#endregion
//#region src/types/data.d.ts
interface ElementType {
  readonly id: string;
  readonly emoji: string;
}
type RecipeType = readonly [ElementType, ElementType];
interface UseType {
  readonly pair: ElementType;
  readonly result: ElementType;
}
interface StepType {
  readonly a: ElementType;
  readonly b: ElementType;
  readonly result: ElementType;
}
type LineageType = readonly StepType[];
type ShareStepType = readonly [ElementType, ElementType, ElementType];
type ShareLineageType = readonly ShareStepType[];
interface ItemDataType {
  readonly id: number;
  readonly text: string;
  readonly emoji: string;
  readonly use_count: number;
  readonly recipe_count: number;
  readonly depth: number;
}
interface RecipesDataType {
  readonly total: number;
  readonly recipes: RecipeType[];
}
interface UsesDataType {
  readonly total: number;
  readonly uses: UseType[];
}
interface LineageDataType {
  readonly steps: LineageType;
  readonly missing: Record<string, "loop" | (string & {})>;
}
type CustomLineageDataType = LineageDataType;
//#endregion
//#region src/types/errors.d.ts
type InfinibrowserError<Code extends number, Message extends string> = {
  readonly code: Code;
  readonly message: Message;
};
type UnknownElementError = InfinibrowserError<404, "Unknown element">;
type InvalidElementIdError = InfinibrowserError<400, "Invalid element ID">;
type NotSoFastError = InfinibrowserError<429, "Not so fast!">;
type InternalServerError = InfinibrowserError<500, "Internal Server Error">;
//#endregion
//#region src/client.d.ts
declare const API_URL = "https://infinibrowser.wiki/api";
type ItemResponseData = FetchResponseData<ItemDataType, UnknownElementError>;
type RecipesResponseData = FetchResponseData<RecipesDataType, UnknownElementError>;
type UsesResponseData = FetchResponseData<UsesDataType, UnknownElementError>;
type LineageResponseError = UnknownElementError | NotSoFastError | InternalServerError;
type LineageResponseData = FetchResponseData<LineageDataType, LineageResponseError>;
declare class Infinibrowser {
  #private;
  readonly $config: ApiConfig;
  constructor(config?: Partial<ApiConfig>);
  getItem(id: string): Promise<ItemResponseData>;
  getRecipes(id: string, {
    offset
  }?: {
    offset?: number;
  }): Promise<RecipesResponseData>;
  getUses(id: string, {
    offset
  }?: {
    offset?: number;
  }): Promise<UsesResponseData>;
  getLineage(id: string): Promise<LineageResponseData>;
  getCustomLineage(id: string): FetchResponse<CustomLineageDataType, InvalidElementIdError>;
  optimizeLineage(id: string): FetchResponse<{
    readonly id: string;
    readonly before: number;
    readonly after: number;
  }>;
  shareLineage(steps: ShareLineageType): FetchResponse<{
    readonly id: string;
  }>;
}
declare const ib: Infinibrowser;
//#endregion
export { API_URL, type ApiConfig, type CustomLineageDataType, type ElementType, type FetchResponse, type FetchResponseData, type FetchResponseError, Infinibrowser, type InfinibrowserError, type InternalServerError, type InvalidElementIdError, type ItemDataType, type ItemResponseData, type LineageDataType, type LineageResponseData, type LineageResponseError, type LineageType, type NotSoFastError, type RecipeType, type RecipesDataType, type RecipesResponseData, type ShareLineageType, type ShareStepType, type StepType, type UnknownElementError, type UseType, type UsesDataType, type UsesResponseData, ib };