import { Destructor, Key, Optional, UnknownRecord, xy } from '@synnaxlabs/x';
import { DragEvent, DragEventHandler, MutableRefObject, PropsWithChildren } from 'react';
import { z } from 'zod';
import { state } from '../state';
export declare const itemZ: z.ZodObject<{
    key: z.ZodUnion<[z.ZodString, z.ZodNumber]>;
    type: z.ZodString;
    elementID: z.ZodOptional<z.ZodString>;
    data: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
}, "strip", z.ZodTypeAny, {
    type: string;
    key: string | number;
    data?: Record<string, unknown> | undefined;
    elementID?: string | undefined;
}, {
    type: string;
    key: string | number;
    data?: Record<string, unknown> | undefined;
    elementID?: string | undefined;
}>;
export interface Item {
    key: Key;
    type: string;
    elementID?: string;
    data?: UnknownRecord;
}
export declare const draggingStateZ: z.ZodObject<{
    source: z.ZodObject<{
        key: z.ZodUnion<[z.ZodString, z.ZodNumber]>;
        type: z.ZodString;
        elementID: z.ZodOptional<z.ZodString>;
        data: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
    }, "strip", z.ZodTypeAny, {
        type: string;
        key: string | number;
        data?: Record<string, unknown> | undefined;
        elementID?: string | undefined;
    }, {
        type: string;
        key: string | number;
        data?: Record<string, unknown> | undefined;
        elementID?: string | undefined;
    }>;
    items: z.ZodArray<z.ZodObject<{
        key: z.ZodUnion<[z.ZodString, z.ZodNumber]>;
        type: z.ZodString;
        elementID: z.ZodOptional<z.ZodString>;
        data: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
    }, "strip", z.ZodTypeAny, {
        type: string;
        key: string | number;
        data?: Record<string, unknown> | undefined;
        elementID?: string | undefined;
    }, {
        type: string;
        key: string | number;
        data?: Record<string, unknown> | undefined;
        elementID?: string | undefined;
    }>, "many">;
}, "strip", z.ZodTypeAny, {
    source: {
        type: string;
        key: string | number;
        data?: Record<string, unknown> | undefined;
        elementID?: string | undefined;
    };
    items: {
        type: string;
        key: string | number;
        data?: Record<string, unknown> | undefined;
        elementID?: string | undefined;
    }[];
}, {
    source: {
        type: string;
        key: string | number;
        data?: Record<string, unknown> | undefined;
        elementID?: string | undefined;
    };
    items: {
        type: string;
        key: string | number;
        data?: Record<string, unknown> | undefined;
        elementID?: string | undefined;
    }[];
}>;
export interface DraggingState {
    source: Item;
    items: Item[];
}
export declare const ZERO_ITEM: Item;
export declare const ZERO_DRAGGING_STATE: DraggingState;
interface DropProps {
    target: Item;
    dropped: Item[];
}
export declare const FILE_TYPE = "file";
export declare const FILE: Item;
export declare const isFileDrag: (event: DragEvent, dragging: DraggingState) => boolean;
type DragEndInterceptor = (state: DraggingState, cursor: xy.XY) => DropProps | null;
export interface ContextValue {
    state: DraggingState;
    start: (source: Item, items: Item[], onSuccessfulDrop?: (props: OnSuccessfulDropProps) => void) => void;
    end: (cursor: xy.XY) => void;
    drop: (props: DropProps) => void;
    bind: (interceptor: DragEndInterceptor) => Destructor;
}
export interface ProviderProps extends PropsWithChildren {
    useState?: state.PureUse<DraggingState>;
    onDropOutside?: (props: OnDropProps) => Item[];
}
export declare const useContext: () => ContextValue | null;
export declare const Provider: ({ children, useState, onDropOutside, }: ProviderProps) => JSX.Element;
export declare const useDraggingRef: () => MutableRefObject<DraggingState>;
export declare const useDraggingState: () => DraggingState;
export interface OnSuccessfulDropProps {
    target: Item;
    hauled: Item[];
    dropped: Item[];
}
export interface UseDragProps extends Optional<Item, "key"> {
}
export interface UseDragReturn {
    startDrag: (items: Item[], onSuccessfulDrop?: (props: OnSuccessfulDropProps) => void) => void;
    onDragEnd: (e: DragEvent) => void;
}
export declare const useDrag: ({ type, key }: UseDragProps) => UseDragReturn;
export type CanDrop = (state: DraggingState) => boolean;
export interface OnDropProps extends DraggingState {
    event?: DragEvent;
}
export type OnDragOverProps = OnDropProps;
export interface UseDropProps extends Optional<Item, "key"> {
    canDrop: CanDrop;
    onDrop: (props: OnDropProps) => Item[];
    onDragOver?: (props: OnDragOverProps) => void;
}
export interface UseDropReturn {
    onDragOver: DragEventHandler;
    onDrop: DragEventHandler;
}
export declare const useDrop: ({ type, key, canDrop, onDrop, onDragOver, }: UseDropProps) => UseDropReturn;
export interface UseDragAndDropProps extends Omit<UseDragProps, "source">, Omit<UseDropProps, "target">, Optional<Item, "key"> {
}
export interface UseDragAndDropReturn extends UseDragReturn, UseDropReturn {
}
export declare const useDragAndDrop: ({ type, key, ...props }: UseDragAndDropProps) => UseDragAndDropReturn;
export declare const canDropOfType: (type: string) => CanDrop;
export declare const filterByType: (type: string, entities: Item[]) => Item[];
export interface UseDropOutsideProps extends Omit<UseDropProps, "onDrop"> {
    onDrop: (props: OnDropProps, cursor: xy.XY) => Item[];
}
export declare const useDropOutside: ({ type, key, ...rest }: UseDropOutsideProps) => void;
export {};
//# sourceMappingURL=Haul.d.ts.map