'use client';
import { jsxDEV as _jsxDEV } from "react/jsx-dev-runtime";
import React, { useState } from 'react';
const Context = /*#__PURE__*/ React.createContext(null);
export const UploadHandlersProvider = ({ children })=>{
    const [uploadHandlers, setUploadHandlers] = useState(()=>new Map());
    const getUploadHandler = ({ collectionSlug })=>{
        return uploadHandlers.get(collectionSlug);
    };
    const setUploadHandler = ({ collectionSlug, handler })=>{
        setUploadHandlers((uploadHandlers)=>{
            const clone = new Map(uploadHandlers);
            clone.set(collectionSlug, handler);
            return clone;
        });
    };
    return /*#__PURE__*/ _jsxDEV(Context, {
        value: {
            getUploadHandler,
            setUploadHandler
        },
        children: children
    }, void 0, false, {
        fileName: "src/providers/UploadHandlers/index.tsx",
        lineNumber: 41,
        columnNumber: 10
    }, this);
};
export const useUploadHandlers = ()=>{
    const context = React.use(Context);
    if (context === null) {
        throw new Error('useUploadHandlers must be used within UploadHandlersProvider');
    }
    return context;
};

//# sourceMappingURL=index.js.map