import { setupI18n } from '../../../../../../node_modules/@lingui/core/dist/index.mjs';
import { compileMessage } from '../../../../../../node_modules/@lingui/message-utils/dist/compileMessage.mjs';
import { I18nProvider } from '../../../../../../node_modules/@lingui/react/dist/index.mjs';
import wn from '../../../../../../node_modules/preact/compat/dist/compat.module.mjs';
import { useMemo as F, useState as h, useEffect as p } from '../../../../../../node_modules/preact/hooks/dist/hooks.module.mjs';

const I18nProviderWrapper = ({ children, messages, overrides })=>{
    const mergedMessages = F(()=>{
        return {
            ...messages,
            ...overrides
        };
    }, [
        messages,
        overrides
    ]);
    const [i18n] = h(()=>{
        const instance = setupI18n({
            locale: 'en',
            messages: {
                en: mergedMessages
            }
        });
        // We need to support runtime compilation for developer-supplied messages;
        // the following is needed to ensure that works in production builds
        // see: https://lingui.dev/ref/core#i18n.setMessagesCompiler
        instance.setMessagesCompiler(compileMessage);
        return instance;
    });
    p(()=>{
        i18n.load({
            en: mergedMessages
        });
    }, [
        i18n,
        mergedMessages
    ]);
    return /*#__PURE__*/ wn.createElement(I18nProvider, {
        i18n: i18n
    }, children);
};

export { I18nProviderWrapper };
//# sourceMappingURL=I18nProviderWrapper.mjs.map
