// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
import React, { createContext, useContext } from 'react';
const ChatAdapterContext = createContext(undefined);
/**
 * @private
 */
export const ChatAdapterProvider = (props) => {
    const { adapter } = props;
    return React.createElement(ChatAdapterContext.Provider, { value: adapter }, props.children);
};
/**
 * @private
 */
export const useAdapter = () => {
    const adapter = useContext(ChatAdapterContext);
    if (!adapter) {
        throw 'Cannot find adapter please initialize before usage.';
    }
    return adapter;
};
//# sourceMappingURL=ChatAdapterProvider.js.map