// WARNING: Please don't edit this file. It was generated by Python/WinRT v3.1.0

#include "py.Windows.UI.Xaml.Hosting.h"

namespace py::cpp::Windows::UI::Xaml::Hosting
{
    // ----- DesignerAppExitedEventArgs class --------------------

    static PyObject* _new_DesignerAppExitedEventArgs(PyTypeObject* /*unused*/, PyObject* /*unused*/, PyObject* /*unused*/) noexcept
    {
        static_assert(py::py_type<winrt::Windows::UI::Xaml::Hosting::DesignerAppExitedEventArgs>::type_name);
        py::set_invalid_activation_error(py::py_type<winrt::Windows::UI::Xaml::Hosting::DesignerAppExitedEventArgs>::type_name);
        return nullptr;
    }

    static void _dealloc_DesignerAppExitedEventArgs(py::wrapper::Windows::UI::Xaml::Hosting::DesignerAppExitedEventArgs* self) noexcept
    {
        auto tp = Py_TYPE(self);
        std::destroy_at(&self->obj);
        tp->tp_free(self);
        Py_DECREF(tp);
    }

    static PyObject* DesignerAppExitedEventArgs_get_ExitCode(py::wrapper::Windows::UI::Xaml::Hosting::DesignerAppExitedEventArgs* self, void* /*unused*/) noexcept
    {
        try
        {
            static std::optional<bool> is_property_present{};

            if (!is_property_present.has_value())
            {
                is_property_present = winrt::Windows::Foundation::Metadata::ApiInformation::IsPropertyPresent(L"Windows.UI.Xaml.Hosting.DesignerAppExitedEventArgs", L"ExitCode");
            }

            if (!is_property_present.value())
            {
                PyErr_SetString(PyExc_AttributeError, "property is not available in this version of Windows");
                return nullptr;
            }

            return py::convert([&]()
            {
                auto _gil = release_gil();
                return self->obj.ExitCode();
            }());
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static PyObject* _assign_array_DesignerAppExitedEventArgs(PyObject* /*unused*/, PyObject* arg) noexcept
    {
        auto array = std::make_unique<py::ComArray<winrt::Windows::UI::Xaml::Hosting::DesignerAppExitedEventArgs>>();
        if (!py::cpp::_winrt::Array_Assign(arg, std::move(array)))
        {
            return nullptr;
        }
        Py_RETURN_NONE;
    }

    static PyObject* _from_DesignerAppExitedEventArgs(PyObject* /*unused*/, PyObject* arg) noexcept
    {
        try
        {
            auto return_value = py::convert_to<winrt::Windows::Foundation::IInspectable>(arg);
            return py::convert(return_value.as<winrt::Windows::UI::Xaml::Hosting::DesignerAppExitedEventArgs>());
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static PyMethodDef _methods_DesignerAppExitedEventArgs[] = {
        { "_assign_array_", _assign_array_DesignerAppExitedEventArgs, METH_O | METH_STATIC, nullptr },
        { "_from", reinterpret_cast<PyCFunction>(_from_DesignerAppExitedEventArgs), METH_O | METH_STATIC, nullptr },
        { }};

    static PyGetSetDef _getset_DesignerAppExitedEventArgs[] = {
        { "exit_code", reinterpret_cast<getter>(DesignerAppExitedEventArgs_get_ExitCode), nullptr, nullptr, nullptr },
        { }};

    static PyType_Slot _type_slots_DesignerAppExitedEventArgs[] = {
        { Py_tp_new, reinterpret_cast<void*>(_new_DesignerAppExitedEventArgs) },
        { Py_tp_dealloc, reinterpret_cast<void*>(_dealloc_DesignerAppExitedEventArgs) },
        { Py_tp_methods, reinterpret_cast<void*>(_methods_DesignerAppExitedEventArgs) },
        { Py_tp_getset, reinterpret_cast<void*>(_getset_DesignerAppExitedEventArgs) },
        { }};

    static PyType_Spec type_spec_DesignerAppExitedEventArgs = {
        "winrt._winrt_windows_ui_xaml_hosting.DesignerAppExitedEventArgs",
        sizeof(py::wrapper::Windows::UI::Xaml::Hosting::DesignerAppExitedEventArgs),
        0,
        Py_TPFLAGS_DEFAULT,
        _type_slots_DesignerAppExitedEventArgs};

    // ----- DesignerAppManager class --------------------

    static PyObject* _new_DesignerAppManager(PyTypeObject* type, PyObject* args, PyObject* kwds) noexcept
    {
        if (kwds)
        {
            py::set_invalid_kwd_args_error();
            return nullptr;
        }

        auto arg_count = PyTuple_GET_SIZE(args);
        if (arg_count == 1)
        {
            try
            {
                auto param0 = py::convert_to<winrt::hstring>(args, 0);

                winrt::Windows::UI::Xaml::Hosting::DesignerAppManager instance{param0};
                return py::wrap(instance, type);
            }
            catch (...)
            {
                py::to_PyErr();
                return nullptr;
            }
        }
        else
        {
            py::set_invalid_arg_count_error(arg_count);
            return nullptr;
        }
    }

    static void _dealloc_DesignerAppManager(py::wrapper::Windows::UI::Xaml::Hosting::DesignerAppManager* self) noexcept
    {
        auto tp = Py_TYPE(self);
        std::destroy_at(&self->obj);
        tp->tp_free(self);
        Py_DECREF(tp);
    }

    static PyObject* DesignerAppManager_Close(py::wrapper::Windows::UI::Xaml::Hosting::DesignerAppManager* self, PyObject* args) noexcept
    {
        auto arg_count = PyTuple_GET_SIZE(args);

        if (arg_count == 0)
        {
            try
            {
                static std::optional<bool> is_overload_present{};

                if (!is_overload_present.has_value())
                {
                    is_overload_present = winrt::Windows::Foundation::Metadata::ApiInformation::IsMethodPresent(L"Windows.UI.Xaml.Hosting.DesignerAppManager", L"Close", 0);
                }

                if (!is_overload_present.value())
                {
                    py::set_arg_count_version_error(0);
                    return nullptr;
                }

                {
                    auto _gil = release_gil();
                    self->obj.Close();
                }

                Py_RETURN_NONE;
            }
            catch (...)
            {
                py::to_PyErr();
                return nullptr;
            }
        }
        else
        {
            py::set_invalid_arg_count_error(arg_count);
            return nullptr;
        }
    }

    static PyObject* DesignerAppManager_CreateNewViewAsync(py::wrapper::Windows::UI::Xaml::Hosting::DesignerAppManager* self, PyObject* args) noexcept
    {
        auto arg_count = PyTuple_GET_SIZE(args);

        if (arg_count == 2)
        {
            try
            {
                static std::optional<bool> is_overload_present{};

                if (!is_overload_present.has_value())
                {
                    is_overload_present = winrt::Windows::Foundation::Metadata::ApiInformation::IsMethodPresent(L"Windows.UI.Xaml.Hosting.DesignerAppManager", L"CreateNewViewAsync", 2);
                }

                if (!is_overload_present.value())
                {
                    py::set_arg_count_version_error(2);
                    return nullptr;
                }

                auto param0 = py::convert_to<winrt::Windows::UI::Xaml::Hosting::DesignerAppViewState>(args, 0);
                auto param1 = py::convert_to<winrt::Windows::Foundation::Size>(args, 1);

                return py::convert([&]()
                {
                    auto _gil = release_gil();
                    return self->obj.CreateNewViewAsync(param0, param1);
                }());
            }
            catch (...)
            {
                py::to_PyErr();
                return nullptr;
            }
        }
        else
        {
            py::set_invalid_arg_count_error(arg_count);
            return nullptr;
        }
    }

    static PyObject* DesignerAppManager_LoadObjectIntoAppAsync(py::wrapper::Windows::UI::Xaml::Hosting::DesignerAppManager* self, PyObject* args) noexcept
    {
        auto arg_count = PyTuple_GET_SIZE(args);

        if (arg_count == 3)
        {
            try
            {
                static std::optional<bool> is_overload_present{};

                if (!is_overload_present.has_value())
                {
                    is_overload_present = winrt::Windows::Foundation::Metadata::ApiInformation::IsMethodPresent(L"Windows.UI.Xaml.Hosting.DesignerAppManager", L"LoadObjectIntoAppAsync", 3);
                }

                if (!is_overload_present.value())
                {
                    py::set_arg_count_version_error(3);
                    return nullptr;
                }

                auto param0 = py::convert_to<winrt::hstring>(args, 0);
                auto param1 = py::convert_to<winrt::guid>(args, 1);
                auto param2 = py::convert_to<winrt::hstring>(args, 2);

                return py::convert([&]()
                {
                    auto _gil = release_gil();
                    return self->obj.LoadObjectIntoAppAsync(param0, param1, param2);
                }());
            }
            catch (...)
            {
                py::to_PyErr();
                return nullptr;
            }
        }
        else
        {
            py::set_invalid_arg_count_error(arg_count);
            return nullptr;
        }
    }

    static PyObject* DesignerAppManager_get_AppUserModelId(py::wrapper::Windows::UI::Xaml::Hosting::DesignerAppManager* self, void* /*unused*/) noexcept
    {
        try
        {
            static std::optional<bool> is_property_present{};

            if (!is_property_present.has_value())
            {
                is_property_present = winrt::Windows::Foundation::Metadata::ApiInformation::IsPropertyPresent(L"Windows.UI.Xaml.Hosting.DesignerAppManager", L"AppUserModelId");
            }

            if (!is_property_present.value())
            {
                PyErr_SetString(PyExc_AttributeError, "property is not available in this version of Windows");
                return nullptr;
            }

            return py::convert([&]()
            {
                auto _gil = release_gil();
                return self->obj.AppUserModelId();
            }());
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static PyObject* DesignerAppManager_add_DesignerAppExited(py::wrapper::Windows::UI::Xaml::Hosting::DesignerAppManager* self, PyObject* arg) noexcept
    {
        try
        {
            static std::optional<bool> is_event_present{};

            if (!is_event_present.has_value())
            {
                is_event_present = winrt::Windows::Foundation::Metadata::ApiInformation::IsEventPresent(L"Windows.UI.Xaml.Hosting.DesignerAppManager", L"DesignerAppExited");
            }

            if (!is_event_present.value())
            {
                PyErr_SetString(PyExc_AttributeError, "event is not available in this version of Windows");
                return nullptr;
            }

            auto param0 = py::convert_to<winrt::Windows::Foundation::TypedEventHandler<winrt::Windows::UI::Xaml::Hosting::DesignerAppManager, winrt::Windows::UI::Xaml::Hosting::DesignerAppExitedEventArgs>>(arg);

            return py::convert([&]()
            {
                auto _gil = release_gil();
                return self->obj.DesignerAppExited(param0);
            }());
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static PyObject* DesignerAppManager_remove_DesignerAppExited(py::wrapper::Windows::UI::Xaml::Hosting::DesignerAppManager* self, PyObject* arg) noexcept
    {
        try
        {
            static std::optional<bool> is_event_present{};

            if (!is_event_present.has_value())
            {
                is_event_present = winrt::Windows::Foundation::Metadata::ApiInformation::IsEventPresent(L"Windows.UI.Xaml.Hosting.DesignerAppManager", L"DesignerAppExited");
            }

            if (!is_event_present.value())
            {
                PyErr_SetString(PyExc_AttributeError, "event is not available in this version of Windows");
                return nullptr;
            }

            auto param0 = py::convert_to<winrt::event_token>(arg);

            {
                auto _gil = release_gil();
                self->obj.DesignerAppExited(param0);
            }

            Py_RETURN_NONE;
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static PyObject* _assign_array_DesignerAppManager(PyObject* /*unused*/, PyObject* arg) noexcept
    {
        auto array = std::make_unique<py::ComArray<winrt::Windows::UI::Xaml::Hosting::DesignerAppManager>>();
        if (!py::cpp::_winrt::Array_Assign(arg, std::move(array)))
        {
            return nullptr;
        }
        Py_RETURN_NONE;
    }

    static PyObject* _from_DesignerAppManager(PyObject* /*unused*/, PyObject* arg) noexcept
    {
        try
        {
            auto return_value = py::convert_to<winrt::Windows::Foundation::IInspectable>(arg);
            return py::convert(return_value.as<winrt::Windows::UI::Xaml::Hosting::DesignerAppManager>());
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static PyObject* _enter_DesignerAppManager(py::wrapper::Windows::UI::Xaml::Hosting::DesignerAppManager* self, PyObject* /*unused*/) noexcept
    {
        return Py_NewRef(self);
    }

    static PyObject* _exit_DesignerAppManager(py::wrapper::Windows::UI::Xaml::Hosting::DesignerAppManager* self, PyObject* /*unused*/) noexcept
    {
        try
        {
            {
                auto _gil = py::release_gil();
                self->obj.Close();
            }

            Py_RETURN_FALSE;
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static PyMethodDef _methods_DesignerAppManager[] = {
        { "close", reinterpret_cast<PyCFunction>(DesignerAppManager_Close), METH_VARARGS, nullptr },
        { "create_new_view_async", reinterpret_cast<PyCFunction>(DesignerAppManager_CreateNewViewAsync), METH_VARARGS, nullptr },
        { "load_object_into_app_async", reinterpret_cast<PyCFunction>(DesignerAppManager_LoadObjectIntoAppAsync), METH_VARARGS, nullptr },
        { "add_designer_app_exited", reinterpret_cast<PyCFunction>(DesignerAppManager_add_DesignerAppExited), METH_O, nullptr },
        { "remove_designer_app_exited", reinterpret_cast<PyCFunction>(DesignerAppManager_remove_DesignerAppExited), METH_O, nullptr },
        { "_assign_array_", _assign_array_DesignerAppManager, METH_O | METH_STATIC, nullptr },
        { "_from", reinterpret_cast<PyCFunction>(_from_DesignerAppManager), METH_O | METH_STATIC, nullptr },
        { "__enter__", reinterpret_cast<PyCFunction>(_enter_DesignerAppManager), METH_NOARGS, nullptr },
        { "__exit__", reinterpret_cast<PyCFunction>(_exit_DesignerAppManager), METH_VARARGS, nullptr },
        { }};

    static PyGetSetDef _getset_DesignerAppManager[] = {
        { "app_user_model_id", reinterpret_cast<getter>(DesignerAppManager_get_AppUserModelId), nullptr, nullptr, nullptr },
        { }};

    static PyType_Slot _type_slots_DesignerAppManager[] = {
        { Py_tp_new, reinterpret_cast<void*>(_new_DesignerAppManager) },
        { Py_tp_dealloc, reinterpret_cast<void*>(_dealloc_DesignerAppManager) },
        { Py_tp_methods, reinterpret_cast<void*>(_methods_DesignerAppManager) },
        { Py_tp_getset, reinterpret_cast<void*>(_getset_DesignerAppManager) },
        { }};

    static PyType_Spec type_spec_DesignerAppManager = {
        "winrt._winrt_windows_ui_xaml_hosting.DesignerAppManager",
        sizeof(py::wrapper::Windows::UI::Xaml::Hosting::DesignerAppManager),
        0,
        Py_TPFLAGS_DEFAULT,
        _type_slots_DesignerAppManager};

    // ----- DesignerAppView class --------------------

    static PyObject* _new_DesignerAppView(PyTypeObject* /*unused*/, PyObject* /*unused*/, PyObject* /*unused*/) noexcept
    {
        static_assert(py::py_type<winrt::Windows::UI::Xaml::Hosting::DesignerAppView>::type_name);
        py::set_invalid_activation_error(py::py_type<winrt::Windows::UI::Xaml::Hosting::DesignerAppView>::type_name);
        return nullptr;
    }

    static void _dealloc_DesignerAppView(py::wrapper::Windows::UI::Xaml::Hosting::DesignerAppView* self) noexcept
    {
        auto tp = Py_TYPE(self);
        std::destroy_at(&self->obj);
        tp->tp_free(self);
        Py_DECREF(tp);
    }

    static PyObject* DesignerAppView_Close(py::wrapper::Windows::UI::Xaml::Hosting::DesignerAppView* self, PyObject* args) noexcept
    {
        auto arg_count = PyTuple_GET_SIZE(args);

        if (arg_count == 0)
        {
            try
            {
                static std::optional<bool> is_overload_present{};

                if (!is_overload_present.has_value())
                {
                    is_overload_present = winrt::Windows::Foundation::Metadata::ApiInformation::IsMethodPresent(L"Windows.UI.Xaml.Hosting.DesignerAppView", L"Close", 0);
                }

                if (!is_overload_present.value())
                {
                    py::set_arg_count_version_error(0);
                    return nullptr;
                }

                {
                    auto _gil = release_gil();
                    self->obj.Close();
                }

                Py_RETURN_NONE;
            }
            catch (...)
            {
                py::to_PyErr();
                return nullptr;
            }
        }
        else
        {
            py::set_invalid_arg_count_error(arg_count);
            return nullptr;
        }
    }

    static PyObject* DesignerAppView_UpdateViewAsync(py::wrapper::Windows::UI::Xaml::Hosting::DesignerAppView* self, PyObject* args) noexcept
    {
        auto arg_count = PyTuple_GET_SIZE(args);

        if (arg_count == 2)
        {
            try
            {
                static std::optional<bool> is_overload_present{};

                if (!is_overload_present.has_value())
                {
                    is_overload_present = winrt::Windows::Foundation::Metadata::ApiInformation::IsMethodPresent(L"Windows.UI.Xaml.Hosting.DesignerAppView", L"UpdateViewAsync", 2);
                }

                if (!is_overload_present.value())
                {
                    py::set_arg_count_version_error(2);
                    return nullptr;
                }

                auto param0 = py::convert_to<winrt::Windows::UI::Xaml::Hosting::DesignerAppViewState>(args, 0);
                auto param1 = py::convert_to<winrt::Windows::Foundation::Size>(args, 1);

                return py::convert([&]()
                {
                    auto _gil = release_gil();
                    return self->obj.UpdateViewAsync(param0, param1);
                }());
            }
            catch (...)
            {
                py::to_PyErr();
                return nullptr;
            }
        }
        else
        {
            py::set_invalid_arg_count_error(arg_count);
            return nullptr;
        }
    }

    static PyObject* DesignerAppView_get_AppUserModelId(py::wrapper::Windows::UI::Xaml::Hosting::DesignerAppView* self, void* /*unused*/) noexcept
    {
        try
        {
            static std::optional<bool> is_property_present{};

            if (!is_property_present.has_value())
            {
                is_property_present = winrt::Windows::Foundation::Metadata::ApiInformation::IsPropertyPresent(L"Windows.UI.Xaml.Hosting.DesignerAppView", L"AppUserModelId");
            }

            if (!is_property_present.value())
            {
                PyErr_SetString(PyExc_AttributeError, "property is not available in this version of Windows");
                return nullptr;
            }

            return py::convert([&]()
            {
                auto _gil = release_gil();
                return self->obj.AppUserModelId();
            }());
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static PyObject* DesignerAppView_get_ApplicationViewId(py::wrapper::Windows::UI::Xaml::Hosting::DesignerAppView* self, void* /*unused*/) noexcept
    {
        try
        {
            static std::optional<bool> is_property_present{};

            if (!is_property_present.has_value())
            {
                is_property_present = winrt::Windows::Foundation::Metadata::ApiInformation::IsPropertyPresent(L"Windows.UI.Xaml.Hosting.DesignerAppView", L"ApplicationViewId");
            }

            if (!is_property_present.value())
            {
                PyErr_SetString(PyExc_AttributeError, "property is not available in this version of Windows");
                return nullptr;
            }

            return py::convert([&]()
            {
                auto _gil = release_gil();
                return self->obj.ApplicationViewId();
            }());
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static PyObject* DesignerAppView_get_ViewSize(py::wrapper::Windows::UI::Xaml::Hosting::DesignerAppView* self, void* /*unused*/) noexcept
    {
        try
        {
            static std::optional<bool> is_property_present{};

            if (!is_property_present.has_value())
            {
                is_property_present = winrt::Windows::Foundation::Metadata::ApiInformation::IsPropertyPresent(L"Windows.UI.Xaml.Hosting.DesignerAppView", L"ViewSize");
            }

            if (!is_property_present.value())
            {
                PyErr_SetString(PyExc_AttributeError, "property is not available in this version of Windows");
                return nullptr;
            }

            return py::convert([&]()
            {
                auto _gil = release_gil();
                return self->obj.ViewSize();
            }());
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static PyObject* DesignerAppView_get_ViewState(py::wrapper::Windows::UI::Xaml::Hosting::DesignerAppView* self, void* /*unused*/) noexcept
    {
        try
        {
            static std::optional<bool> is_property_present{};

            if (!is_property_present.has_value())
            {
                is_property_present = winrt::Windows::Foundation::Metadata::ApiInformation::IsPropertyPresent(L"Windows.UI.Xaml.Hosting.DesignerAppView", L"ViewState");
            }

            if (!is_property_present.value())
            {
                PyErr_SetString(PyExc_AttributeError, "property is not available in this version of Windows");
                return nullptr;
            }

            return py::convert([&]()
            {
                auto _gil = release_gil();
                return self->obj.ViewState();
            }());
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static PyObject* _assign_array_DesignerAppView(PyObject* /*unused*/, PyObject* arg) noexcept
    {
        auto array = std::make_unique<py::ComArray<winrt::Windows::UI::Xaml::Hosting::DesignerAppView>>();
        if (!py::cpp::_winrt::Array_Assign(arg, std::move(array)))
        {
            return nullptr;
        }
        Py_RETURN_NONE;
    }

    static PyObject* _from_DesignerAppView(PyObject* /*unused*/, PyObject* arg) noexcept
    {
        try
        {
            auto return_value = py::convert_to<winrt::Windows::Foundation::IInspectable>(arg);
            return py::convert(return_value.as<winrt::Windows::UI::Xaml::Hosting::DesignerAppView>());
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static PyObject* _enter_DesignerAppView(py::wrapper::Windows::UI::Xaml::Hosting::DesignerAppView* self, PyObject* /*unused*/) noexcept
    {
        return Py_NewRef(self);
    }

    static PyObject* _exit_DesignerAppView(py::wrapper::Windows::UI::Xaml::Hosting::DesignerAppView* self, PyObject* /*unused*/) noexcept
    {
        try
        {
            {
                auto _gil = py::release_gil();
                self->obj.Close();
            }

            Py_RETURN_FALSE;
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static PyMethodDef _methods_DesignerAppView[] = {
        { "close", reinterpret_cast<PyCFunction>(DesignerAppView_Close), METH_VARARGS, nullptr },
        { "update_view_async", reinterpret_cast<PyCFunction>(DesignerAppView_UpdateViewAsync), METH_VARARGS, nullptr },
        { "_assign_array_", _assign_array_DesignerAppView, METH_O | METH_STATIC, nullptr },
        { "_from", reinterpret_cast<PyCFunction>(_from_DesignerAppView), METH_O | METH_STATIC, nullptr },
        { "__enter__", reinterpret_cast<PyCFunction>(_enter_DesignerAppView), METH_NOARGS, nullptr },
        { "__exit__", reinterpret_cast<PyCFunction>(_exit_DesignerAppView), METH_VARARGS, nullptr },
        { }};

    static PyGetSetDef _getset_DesignerAppView[] = {
        { "app_user_model_id", reinterpret_cast<getter>(DesignerAppView_get_AppUserModelId), nullptr, nullptr, nullptr },
        { "application_view_id", reinterpret_cast<getter>(DesignerAppView_get_ApplicationViewId), nullptr, nullptr, nullptr },
        { "view_size", reinterpret_cast<getter>(DesignerAppView_get_ViewSize), nullptr, nullptr, nullptr },
        { "view_state", reinterpret_cast<getter>(DesignerAppView_get_ViewState), nullptr, nullptr, nullptr },
        { }};

    static PyType_Slot _type_slots_DesignerAppView[] = {
        { Py_tp_new, reinterpret_cast<void*>(_new_DesignerAppView) },
        { Py_tp_dealloc, reinterpret_cast<void*>(_dealloc_DesignerAppView) },
        { Py_tp_methods, reinterpret_cast<void*>(_methods_DesignerAppView) },
        { Py_tp_getset, reinterpret_cast<void*>(_getset_DesignerAppView) },
        { }};

    static PyType_Spec type_spec_DesignerAppView = {
        "winrt._winrt_windows_ui_xaml_hosting.DesignerAppView",
        sizeof(py::wrapper::Windows::UI::Xaml::Hosting::DesignerAppView),
        0,
        Py_TPFLAGS_DEFAULT,
        _type_slots_DesignerAppView};

    // ----- DesktopWindowXamlSource class --------------------

    struct PyWinrtDesktopWindowXamlSource;
    using BasePyWinrtDesktopWindowXamlSource = winrt::Windows::UI::Xaml::Hosting::DesktopWindowXamlSourceT<PyWinrtDesktopWindowXamlSource, py::IPywinrtObject>;

    struct PyWinrtDesktopWindowXamlSource : py::py_obj_ref, BasePyWinrtDesktopWindowXamlSource
    {
        PyWinrtDesktopWindowXamlSource(PyObject* py_obj) : py::py_obj_ref(py_obj), BasePyWinrtDesktopWindowXamlSource() {}

        int32_t __stdcall GetPyObject(PyObject*& obj) override
        {
            obj = py::py_obj_ref::get_py_obj();
            return 0;
        }

        int32_t __stdcall GetComposableInner(winrt::Windows::Foundation::IInspectable& inner) override
        {
            inner = m_inner;
            return winrt::impl::error_ok;
        }

        static void toggle_reference(PyWinrtDesktopWindowXamlSource* instance, bool is_last_reference)
        {
            py::py_obj_ref::toggle_reference(instance, is_last_reference);
        }

        int32_t query_interface_tearoff(winrt::guid const& id, void** result) const noexcept override
        {
            return py::py_obj_ref::query_interface_tearoff(id, result);
        }

        std::vector<winrt::guid> get_iids_tearoff() const noexcept override
        {
            return py::py_obj_ref::get_iids_tearoff();
        }
    };

    static PyObject* _new_DesktopWindowXamlSource(PyTypeObject* type, PyObject* args, PyObject* kwds) noexcept
    {
        if (kwds)
        {
            py::set_invalid_kwd_args_error();
            return nullptr;
        }

        auto arg_count = PyTuple_GET_SIZE(args);

        auto self_type = get_python_type_for<winrt::Windows::UI::Xaml::Hosting::DesktopWindowXamlSource>();
        if (!self_type)
        {
            return nullptr;
        }

        if (arg_count == 0)
        {
            try
            {
                if (type != self_type)
                {
                    py::pyobj_handle self{type->tp_alloc(type, 0)};
                    if (!self)
                    {
                        return nullptr;
                    }

                    std::construct_at(&reinterpret_cast<py::winrt_wrapper<winrt::Windows::Foundation::IInspectable>*>(self.get())->obj, nullptr);

                    auto obj_impl = winrt::make_self<PyWinrtDesktopWindowXamlSource>(self.get());

                    auto obj = py::make_py_obj<PyWinrtDesktopWindowXamlSource>(obj_impl, type, self.get());
                    if (!obj)
                    {
                        return nullptr;
                    }

                    reinterpret_cast<py::winrt_wrapper<winrt::Windows::Foundation::IInspectable>*>(self.get())->obj = std::move(obj);

                    return self.detach();
                }

                winrt::Windows::UI::Xaml::Hosting::DesktopWindowXamlSource instance{};
                return py::wrap(instance, type);
            }
            catch (...)
            {
                py::to_PyErr();
                return nullptr;
            }
        }
        else
        {
            py::set_invalid_arg_count_error(arg_count);
            return nullptr;
        }
    }

    static void _dealloc_DesktopWindowXamlSource(py::winrt_wrapper<winrt::Windows::Foundation::IInspectable>* self) noexcept
    {
        auto tp = Py_TYPE(self);
        std::destroy_at(&self->obj);
        tp->tp_free(self);
        Py_DECREF(tp);
    }

    static PyObject* DesktopWindowXamlSource_Close(py::winrt_wrapper<winrt::Windows::Foundation::IInspectable>* self, PyObject* args) noexcept
    {
        auto arg_count = PyTuple_GET_SIZE(args);

        if (arg_count == 0)
        {
            try
            {
                static std::optional<bool> is_overload_present{};

                if (!is_overload_present.has_value())
                {
                    is_overload_present = winrt::Windows::Foundation::Metadata::ApiInformation::IsMethodPresent(L"Windows.UI.Xaml.Hosting.DesktopWindowXamlSource", L"Close", 0);
                }

                if (!is_overload_present.value())
                {
                    py::set_arg_count_version_error(0);
                    return nullptr;
                }

                {
                    auto _gil = release_gil();
                    self->obj.try_as<winrt::Windows::UI::Xaml::Hosting::DesktopWindowXamlSource>().Close();
                }

                Py_RETURN_NONE;
            }
            catch (...)
            {
                py::to_PyErr();
                return nullptr;
            }
        }
        else
        {
            py::set_invalid_arg_count_error(arg_count);
            return nullptr;
        }
    }

    static PyObject* DesktopWindowXamlSource_NavigateFocus(py::winrt_wrapper<winrt::Windows::Foundation::IInspectable>* self, PyObject* args) noexcept
    {
        auto arg_count = PyTuple_GET_SIZE(args);

        if (arg_count == 1)
        {
            try
            {
                static std::optional<bool> is_overload_present{};

                if (!is_overload_present.has_value())
                {
                    is_overload_present = winrt::Windows::Foundation::Metadata::ApiInformation::IsMethodPresent(L"Windows.UI.Xaml.Hosting.DesktopWindowXamlSource", L"NavigateFocus", 1);
                }

                if (!is_overload_present.value())
                {
                    py::set_arg_count_version_error(1);
                    return nullptr;
                }

                auto param0 = py::convert_to<winrt::Windows::UI::Xaml::Hosting::XamlSourceFocusNavigationRequest>(args, 0);

                return py::convert([&]()
                {
                    auto _gil = release_gil();
                    return self->obj.try_as<winrt::Windows::UI::Xaml::Hosting::DesktopWindowXamlSource>().NavigateFocus(param0);
                }());
            }
            catch (...)
            {
                py::to_PyErr();
                return nullptr;
            }
        }
        else
        {
            py::set_invalid_arg_count_error(arg_count);
            return nullptr;
        }
    }

    static PyObject* DesktopWindowXamlSource_get_Content(py::winrt_wrapper<winrt::Windows::Foundation::IInspectable>* self, void* /*unused*/) noexcept
    {
        try
        {
            static std::optional<bool> is_property_present{};

            if (!is_property_present.has_value())
            {
                is_property_present = winrt::Windows::Foundation::Metadata::ApiInformation::IsPropertyPresent(L"Windows.UI.Xaml.Hosting.DesktopWindowXamlSource", L"Content");
            }

            if (!is_property_present.value())
            {
                PyErr_SetString(PyExc_AttributeError, "property is not available in this version of Windows");
                return nullptr;
            }

            return py::convert([&]()
            {
                auto _gil = release_gil();
                return self->obj.try_as<winrt::Windows::UI::Xaml::Hosting::DesktopWindowXamlSource>().Content();
            }());
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static int DesktopWindowXamlSource_put_Content(py::winrt_wrapper<winrt::Windows::Foundation::IInspectable>* self, PyObject* arg, void* /*unused*/) noexcept
    {
        if (!arg)
        {
            PyErr_SetString(PyExc_AttributeError, "can't delete attribute");
            return -1;
        }

        try
        {
            static std::optional<bool> is_property_present{};

            if (!is_property_present.has_value())
            {
                is_property_present = winrt::Windows::Foundation::Metadata::ApiInformation::IsPropertyPresent(L"Windows.UI.Xaml.Hosting.DesktopWindowXamlSource", L"Content");
            }

            if (!is_property_present.value())
            {
                PyErr_SetString(PyExc_AttributeError, "property is not available in this version of Windows");
                return -1;
            }

            auto param0 = py::convert_to<winrt::Windows::UI::Xaml::UIElement>(arg);

            {
                auto _gil = release_gil();
                self->obj.try_as<winrt::Windows::UI::Xaml::Hosting::DesktopWindowXamlSource>().Content(param0);
            }

            return 0;
        }
        catch (...)
        {
            py::to_PyErr();
            return -1;
        }
    }

    static PyObject* DesktopWindowXamlSource_get_HasFocus(py::winrt_wrapper<winrt::Windows::Foundation::IInspectable>* self, void* /*unused*/) noexcept
    {
        try
        {
            static std::optional<bool> is_property_present{};

            if (!is_property_present.has_value())
            {
                is_property_present = winrt::Windows::Foundation::Metadata::ApiInformation::IsPropertyPresent(L"Windows.UI.Xaml.Hosting.DesktopWindowXamlSource", L"HasFocus");
            }

            if (!is_property_present.value())
            {
                PyErr_SetString(PyExc_AttributeError, "property is not available in this version of Windows");
                return nullptr;
            }

            return py::convert([&]()
            {
                auto _gil = release_gil();
                return self->obj.try_as<winrt::Windows::UI::Xaml::Hosting::DesktopWindowXamlSource>().HasFocus();
            }());
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static PyObject* DesktopWindowXamlSource_add_GotFocus(py::winrt_wrapper<winrt::Windows::Foundation::IInspectable>* self, PyObject* arg) noexcept
    {
        try
        {
            static std::optional<bool> is_event_present{};

            if (!is_event_present.has_value())
            {
                is_event_present = winrt::Windows::Foundation::Metadata::ApiInformation::IsEventPresent(L"Windows.UI.Xaml.Hosting.DesktopWindowXamlSource", L"GotFocus");
            }

            if (!is_event_present.value())
            {
                PyErr_SetString(PyExc_AttributeError, "event is not available in this version of Windows");
                return nullptr;
            }

            auto param0 = py::convert_to<winrt::Windows::Foundation::TypedEventHandler<winrt::Windows::UI::Xaml::Hosting::DesktopWindowXamlSource, winrt::Windows::UI::Xaml::Hosting::DesktopWindowXamlSourceGotFocusEventArgs>>(arg);

            return py::convert([&]()
            {
                auto _gil = release_gil();
                return self->obj.try_as<winrt::Windows::UI::Xaml::Hosting::DesktopWindowXamlSource>().GotFocus(param0);
            }());
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static PyObject* DesktopWindowXamlSource_remove_GotFocus(py::winrt_wrapper<winrt::Windows::Foundation::IInspectable>* self, PyObject* arg) noexcept
    {
        try
        {
            static std::optional<bool> is_event_present{};

            if (!is_event_present.has_value())
            {
                is_event_present = winrt::Windows::Foundation::Metadata::ApiInformation::IsEventPresent(L"Windows.UI.Xaml.Hosting.DesktopWindowXamlSource", L"GotFocus");
            }

            if (!is_event_present.value())
            {
                PyErr_SetString(PyExc_AttributeError, "event is not available in this version of Windows");
                return nullptr;
            }

            auto param0 = py::convert_to<winrt::event_token>(arg);

            {
                auto _gil = release_gil();
                self->obj.try_as<winrt::Windows::UI::Xaml::Hosting::DesktopWindowXamlSource>().GotFocus(param0);
            }

            Py_RETURN_NONE;
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static PyObject* DesktopWindowXamlSource_add_TakeFocusRequested(py::winrt_wrapper<winrt::Windows::Foundation::IInspectable>* self, PyObject* arg) noexcept
    {
        try
        {
            static std::optional<bool> is_event_present{};

            if (!is_event_present.has_value())
            {
                is_event_present = winrt::Windows::Foundation::Metadata::ApiInformation::IsEventPresent(L"Windows.UI.Xaml.Hosting.DesktopWindowXamlSource", L"TakeFocusRequested");
            }

            if (!is_event_present.value())
            {
                PyErr_SetString(PyExc_AttributeError, "event is not available in this version of Windows");
                return nullptr;
            }

            auto param0 = py::convert_to<winrt::Windows::Foundation::TypedEventHandler<winrt::Windows::UI::Xaml::Hosting::DesktopWindowXamlSource, winrt::Windows::UI::Xaml::Hosting::DesktopWindowXamlSourceTakeFocusRequestedEventArgs>>(arg);

            return py::convert([&]()
            {
                auto _gil = release_gil();
                return self->obj.try_as<winrt::Windows::UI::Xaml::Hosting::DesktopWindowXamlSource>().TakeFocusRequested(param0);
            }());
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static PyObject* DesktopWindowXamlSource_remove_TakeFocusRequested(py::winrt_wrapper<winrt::Windows::Foundation::IInspectable>* self, PyObject* arg) noexcept
    {
        try
        {
            static std::optional<bool> is_event_present{};

            if (!is_event_present.has_value())
            {
                is_event_present = winrt::Windows::Foundation::Metadata::ApiInformation::IsEventPresent(L"Windows.UI.Xaml.Hosting.DesktopWindowXamlSource", L"TakeFocusRequested");
            }

            if (!is_event_present.value())
            {
                PyErr_SetString(PyExc_AttributeError, "event is not available in this version of Windows");
                return nullptr;
            }

            auto param0 = py::convert_to<winrt::event_token>(arg);

            {
                auto _gil = release_gil();
                self->obj.try_as<winrt::Windows::UI::Xaml::Hosting::DesktopWindowXamlSource>().TakeFocusRequested(param0);
            }

            Py_RETURN_NONE;
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static PyObject* _assign_array_DesktopWindowXamlSource(PyObject* /*unused*/, PyObject* arg) noexcept
    {
        auto array = std::make_unique<py::ComArray<winrt::Windows::UI::Xaml::Hosting::DesktopWindowXamlSource>>();
        if (!py::cpp::_winrt::Array_Assign(arg, std::move(array)))
        {
            return nullptr;
        }
        Py_RETURN_NONE;
    }

    static PyObject* _from_DesktopWindowXamlSource(PyObject* /*unused*/, PyObject* arg) noexcept
    {
        try
        {
            auto return_value = py::convert_to<winrt::Windows::Foundation::IInspectable>(arg);
            return py::convert(return_value.as<winrt::Windows::UI::Xaml::Hosting::DesktopWindowXamlSource>());
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static PyObject* _enter_DesktopWindowXamlSource(py::winrt_wrapper<winrt::Windows::Foundation::IInspectable>* self, PyObject* /*unused*/) noexcept
    {
        return Py_NewRef(self);
    }

    static PyObject* _exit_DesktopWindowXamlSource(py::winrt_wrapper<winrt::Windows::Foundation::IInspectable>* self, PyObject* /*unused*/) noexcept
    {
        try
        {
            {
                auto _gil = py::release_gil();
                self->obj.try_as<winrt::Windows::UI::Xaml::Hosting::DesktopWindowXamlSource>().Close();
            }

            Py_RETURN_FALSE;
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static PyMethodDef _methods_DesktopWindowXamlSource[] = {
        { "close", reinterpret_cast<PyCFunction>(DesktopWindowXamlSource_Close), METH_VARARGS, nullptr },
        { "navigate_focus", reinterpret_cast<PyCFunction>(DesktopWindowXamlSource_NavigateFocus), METH_VARARGS, nullptr },
        { "add_got_focus", reinterpret_cast<PyCFunction>(DesktopWindowXamlSource_add_GotFocus), METH_O, nullptr },
        { "remove_got_focus", reinterpret_cast<PyCFunction>(DesktopWindowXamlSource_remove_GotFocus), METH_O, nullptr },
        { "add_take_focus_requested", reinterpret_cast<PyCFunction>(DesktopWindowXamlSource_add_TakeFocusRequested), METH_O, nullptr },
        { "remove_take_focus_requested", reinterpret_cast<PyCFunction>(DesktopWindowXamlSource_remove_TakeFocusRequested), METH_O, nullptr },
        { "_assign_array_", _assign_array_DesktopWindowXamlSource, METH_O | METH_STATIC, nullptr },
        { "_from", reinterpret_cast<PyCFunction>(_from_DesktopWindowXamlSource), METH_O | METH_STATIC, nullptr },
        { "__enter__", reinterpret_cast<PyCFunction>(_enter_DesktopWindowXamlSource), METH_NOARGS, nullptr },
        { "__exit__", reinterpret_cast<PyCFunction>(_exit_DesktopWindowXamlSource), METH_VARARGS, nullptr },
        { }};

    static PyGetSetDef _getset_DesktopWindowXamlSource[] = {
        { "content", reinterpret_cast<getter>(DesktopWindowXamlSource_get_Content), reinterpret_cast<setter>(DesktopWindowXamlSource_put_Content), nullptr, nullptr },
        { "has_focus", reinterpret_cast<getter>(DesktopWindowXamlSource_get_HasFocus), nullptr, nullptr, nullptr },
        { }};

    static PyType_Slot _type_slots_DesktopWindowXamlSource[] = {
        { Py_tp_new, reinterpret_cast<void*>(_new_DesktopWindowXamlSource) },
        { Py_tp_dealloc, reinterpret_cast<void*>(_dealloc_DesktopWindowXamlSource) },
        { Py_tp_methods, reinterpret_cast<void*>(_methods_DesktopWindowXamlSource) },
        { Py_tp_getset, reinterpret_cast<void*>(_getset_DesktopWindowXamlSource) },
        { }};

    static PyType_Spec type_spec_DesktopWindowXamlSource = {
        "winrt._winrt_windows_ui_xaml_hosting.DesktopWindowXamlSource",
        sizeof(py::winrt_wrapper<winrt::Windows::Foundation::IInspectable>),
        0,
        Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
        _type_slots_DesktopWindowXamlSource};

    static PyGetSetDef getset_DesktopWindowXamlSource_Static[] = {
        { }};

    static PyMethodDef methods_DesktopWindowXamlSource_Static[] = {
        { }};

    static PyType_Slot type_slots_DesktopWindowXamlSource_Static[] = 
    {
        { Py_tp_base, reinterpret_cast<void*>(&PyType_Type) },
        { Py_tp_getset, reinterpret_cast<void*>(getset_DesktopWindowXamlSource_Static) },
        { Py_tp_methods, reinterpret_cast<void*>(methods_DesktopWindowXamlSource_Static) },
        { }
    };

    static PyType_Spec type_spec_DesktopWindowXamlSource_Static = {
        "winrt._winrt_windows_ui_xaml_hosting.DesktopWindowXamlSource_Static",
        static_cast<int>(PyType_Type.tp_basicsize),
        static_cast<int>(PyType_Type.tp_itemsize),
        Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
        type_slots_DesktopWindowXamlSource_Static};

    // ----- DesktopWindowXamlSourceGotFocusEventArgs class --------------------

    static PyObject* _new_DesktopWindowXamlSourceGotFocusEventArgs(PyTypeObject* /*unused*/, PyObject* /*unused*/, PyObject* /*unused*/) noexcept
    {
        static_assert(py::py_type<winrt::Windows::UI::Xaml::Hosting::DesktopWindowXamlSourceGotFocusEventArgs>::type_name);
        py::set_invalid_activation_error(py::py_type<winrt::Windows::UI::Xaml::Hosting::DesktopWindowXamlSourceGotFocusEventArgs>::type_name);
        return nullptr;
    }

    static void _dealloc_DesktopWindowXamlSourceGotFocusEventArgs(py::wrapper::Windows::UI::Xaml::Hosting::DesktopWindowXamlSourceGotFocusEventArgs* self) noexcept
    {
        auto tp = Py_TYPE(self);
        std::destroy_at(&self->obj);
        tp->tp_free(self);
        Py_DECREF(tp);
    }

    static PyObject* DesktopWindowXamlSourceGotFocusEventArgs_get_Request(py::wrapper::Windows::UI::Xaml::Hosting::DesktopWindowXamlSourceGotFocusEventArgs* self, void* /*unused*/) noexcept
    {
        try
        {
            static std::optional<bool> is_property_present{};

            if (!is_property_present.has_value())
            {
                is_property_present = winrt::Windows::Foundation::Metadata::ApiInformation::IsPropertyPresent(L"Windows.UI.Xaml.Hosting.DesktopWindowXamlSourceGotFocusEventArgs", L"Request");
            }

            if (!is_property_present.value())
            {
                PyErr_SetString(PyExc_AttributeError, "property is not available in this version of Windows");
                return nullptr;
            }

            return py::convert([&]()
            {
                auto _gil = release_gil();
                return self->obj.Request();
            }());
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static PyObject* _assign_array_DesktopWindowXamlSourceGotFocusEventArgs(PyObject* /*unused*/, PyObject* arg) noexcept
    {
        auto array = std::make_unique<py::ComArray<winrt::Windows::UI::Xaml::Hosting::DesktopWindowXamlSourceGotFocusEventArgs>>();
        if (!py::cpp::_winrt::Array_Assign(arg, std::move(array)))
        {
            return nullptr;
        }
        Py_RETURN_NONE;
    }

    static PyObject* _from_DesktopWindowXamlSourceGotFocusEventArgs(PyObject* /*unused*/, PyObject* arg) noexcept
    {
        try
        {
            auto return_value = py::convert_to<winrt::Windows::Foundation::IInspectable>(arg);
            return py::convert(return_value.as<winrt::Windows::UI::Xaml::Hosting::DesktopWindowXamlSourceGotFocusEventArgs>());
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static PyMethodDef _methods_DesktopWindowXamlSourceGotFocusEventArgs[] = {
        { "_assign_array_", _assign_array_DesktopWindowXamlSourceGotFocusEventArgs, METH_O | METH_STATIC, nullptr },
        { "_from", reinterpret_cast<PyCFunction>(_from_DesktopWindowXamlSourceGotFocusEventArgs), METH_O | METH_STATIC, nullptr },
        { }};

    static PyGetSetDef _getset_DesktopWindowXamlSourceGotFocusEventArgs[] = {
        { "request", reinterpret_cast<getter>(DesktopWindowXamlSourceGotFocusEventArgs_get_Request), nullptr, nullptr, nullptr },
        { }};

    static PyType_Slot _type_slots_DesktopWindowXamlSourceGotFocusEventArgs[] = {
        { Py_tp_new, reinterpret_cast<void*>(_new_DesktopWindowXamlSourceGotFocusEventArgs) },
        { Py_tp_dealloc, reinterpret_cast<void*>(_dealloc_DesktopWindowXamlSourceGotFocusEventArgs) },
        { Py_tp_methods, reinterpret_cast<void*>(_methods_DesktopWindowXamlSourceGotFocusEventArgs) },
        { Py_tp_getset, reinterpret_cast<void*>(_getset_DesktopWindowXamlSourceGotFocusEventArgs) },
        { }};

    static PyType_Spec type_spec_DesktopWindowXamlSourceGotFocusEventArgs = {
        "winrt._winrt_windows_ui_xaml_hosting.DesktopWindowXamlSourceGotFocusEventArgs",
        sizeof(py::wrapper::Windows::UI::Xaml::Hosting::DesktopWindowXamlSourceGotFocusEventArgs),
        0,
        Py_TPFLAGS_DEFAULT,
        _type_slots_DesktopWindowXamlSourceGotFocusEventArgs};

    // ----- DesktopWindowXamlSourceTakeFocusRequestedEventArgs class --------------------

    static PyObject* _new_DesktopWindowXamlSourceTakeFocusRequestedEventArgs(PyTypeObject* /*unused*/, PyObject* /*unused*/, PyObject* /*unused*/) noexcept
    {
        static_assert(py::py_type<winrt::Windows::UI::Xaml::Hosting::DesktopWindowXamlSourceTakeFocusRequestedEventArgs>::type_name);
        py::set_invalid_activation_error(py::py_type<winrt::Windows::UI::Xaml::Hosting::DesktopWindowXamlSourceTakeFocusRequestedEventArgs>::type_name);
        return nullptr;
    }

    static void _dealloc_DesktopWindowXamlSourceTakeFocusRequestedEventArgs(py::wrapper::Windows::UI::Xaml::Hosting::DesktopWindowXamlSourceTakeFocusRequestedEventArgs* self) noexcept
    {
        auto tp = Py_TYPE(self);
        std::destroy_at(&self->obj);
        tp->tp_free(self);
        Py_DECREF(tp);
    }

    static PyObject* DesktopWindowXamlSourceTakeFocusRequestedEventArgs_get_Request(py::wrapper::Windows::UI::Xaml::Hosting::DesktopWindowXamlSourceTakeFocusRequestedEventArgs* self, void* /*unused*/) noexcept
    {
        try
        {
            static std::optional<bool> is_property_present{};

            if (!is_property_present.has_value())
            {
                is_property_present = winrt::Windows::Foundation::Metadata::ApiInformation::IsPropertyPresent(L"Windows.UI.Xaml.Hosting.DesktopWindowXamlSourceTakeFocusRequestedEventArgs", L"Request");
            }

            if (!is_property_present.value())
            {
                PyErr_SetString(PyExc_AttributeError, "property is not available in this version of Windows");
                return nullptr;
            }

            return py::convert([&]()
            {
                auto _gil = release_gil();
                return self->obj.Request();
            }());
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static PyObject* _assign_array_DesktopWindowXamlSourceTakeFocusRequestedEventArgs(PyObject* /*unused*/, PyObject* arg) noexcept
    {
        auto array = std::make_unique<py::ComArray<winrt::Windows::UI::Xaml::Hosting::DesktopWindowXamlSourceTakeFocusRequestedEventArgs>>();
        if (!py::cpp::_winrt::Array_Assign(arg, std::move(array)))
        {
            return nullptr;
        }
        Py_RETURN_NONE;
    }

    static PyObject* _from_DesktopWindowXamlSourceTakeFocusRequestedEventArgs(PyObject* /*unused*/, PyObject* arg) noexcept
    {
        try
        {
            auto return_value = py::convert_to<winrt::Windows::Foundation::IInspectable>(arg);
            return py::convert(return_value.as<winrt::Windows::UI::Xaml::Hosting::DesktopWindowXamlSourceTakeFocusRequestedEventArgs>());
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static PyMethodDef _methods_DesktopWindowXamlSourceTakeFocusRequestedEventArgs[] = {
        { "_assign_array_", _assign_array_DesktopWindowXamlSourceTakeFocusRequestedEventArgs, METH_O | METH_STATIC, nullptr },
        { "_from", reinterpret_cast<PyCFunction>(_from_DesktopWindowXamlSourceTakeFocusRequestedEventArgs), METH_O | METH_STATIC, nullptr },
        { }};

    static PyGetSetDef _getset_DesktopWindowXamlSourceTakeFocusRequestedEventArgs[] = {
        { "request", reinterpret_cast<getter>(DesktopWindowXamlSourceTakeFocusRequestedEventArgs_get_Request), nullptr, nullptr, nullptr },
        { }};

    static PyType_Slot _type_slots_DesktopWindowXamlSourceTakeFocusRequestedEventArgs[] = {
        { Py_tp_new, reinterpret_cast<void*>(_new_DesktopWindowXamlSourceTakeFocusRequestedEventArgs) },
        { Py_tp_dealloc, reinterpret_cast<void*>(_dealloc_DesktopWindowXamlSourceTakeFocusRequestedEventArgs) },
        { Py_tp_methods, reinterpret_cast<void*>(_methods_DesktopWindowXamlSourceTakeFocusRequestedEventArgs) },
        { Py_tp_getset, reinterpret_cast<void*>(_getset_DesktopWindowXamlSourceTakeFocusRequestedEventArgs) },
        { }};

    static PyType_Spec type_spec_DesktopWindowXamlSourceTakeFocusRequestedEventArgs = {
        "winrt._winrt_windows_ui_xaml_hosting.DesktopWindowXamlSourceTakeFocusRequestedEventArgs",
        sizeof(py::wrapper::Windows::UI::Xaml::Hosting::DesktopWindowXamlSourceTakeFocusRequestedEventArgs),
        0,
        Py_TPFLAGS_DEFAULT,
        _type_slots_DesktopWindowXamlSourceTakeFocusRequestedEventArgs};

    // ----- ElementCompositionPreview class --------------------

    static PyObject* _new_ElementCompositionPreview(PyTypeObject* /*unused*/, PyObject* /*unused*/, PyObject* /*unused*/) noexcept
    {
        static_assert(py::py_type<winrt::Windows::UI::Xaml::Hosting::ElementCompositionPreview>::type_name);
        py::set_invalid_activation_error(py::py_type<winrt::Windows::UI::Xaml::Hosting::ElementCompositionPreview>::type_name);
        return nullptr;
    }

    static void _dealloc_ElementCompositionPreview(py::wrapper::Windows::UI::Xaml::Hosting::ElementCompositionPreview* self) noexcept
    {
        auto tp = Py_TYPE(self);
        std::destroy_at(&self->obj);
        tp->tp_free(self);
        Py_DECREF(tp);
    }

    static PyObject* ElementCompositionPreview_GetAppWindowContent(PyObject* /*unused*/, PyObject* args) noexcept
    {
        auto arg_count = PyTuple_GET_SIZE(args);

        if (arg_count == 1)
        {
            try
            {
                static std::optional<bool> is_overload_present{};

                if (!is_overload_present.has_value())
                {
                    is_overload_present = winrt::Windows::Foundation::Metadata::ApiInformation::IsMethodPresent(L"Windows.UI.Xaml.Hosting.ElementCompositionPreview", L"GetAppWindowContent", 1);
                }

                if (!is_overload_present.value())
                {
                    py::set_arg_count_version_error(1);
                    return nullptr;
                }

                auto param0 = py::convert_to<winrt::Windows::UI::WindowManagement::AppWindow>(args, 0);

                return py::convert([&]()
                {
                    auto _gil = release_gil();
                    return winrt::Windows::UI::Xaml::Hosting::ElementCompositionPreview::GetAppWindowContent(param0);
                }());
            }
            catch (...)
            {
                py::to_PyErr();
                return nullptr;
            }
        }
        else
        {
            py::set_invalid_arg_count_error(arg_count);
            return nullptr;
        }
    }

    static PyObject* ElementCompositionPreview_GetElementChildVisual(PyObject* /*unused*/, PyObject* args) noexcept
    {
        auto arg_count = PyTuple_GET_SIZE(args);

        if (arg_count == 1)
        {
            try
            {
                static std::optional<bool> is_overload_present{};

                if (!is_overload_present.has_value())
                {
                    is_overload_present = winrt::Windows::Foundation::Metadata::ApiInformation::IsMethodPresent(L"Windows.UI.Xaml.Hosting.ElementCompositionPreview", L"GetElementChildVisual", 1);
                }

                if (!is_overload_present.value())
                {
                    py::set_arg_count_version_error(1);
                    return nullptr;
                }

                auto param0 = py::convert_to<winrt::Windows::UI::Xaml::UIElement>(args, 0);

                return py::convert([&]()
                {
                    auto _gil = release_gil();
                    return winrt::Windows::UI::Xaml::Hosting::ElementCompositionPreview::GetElementChildVisual(param0);
                }());
            }
            catch (...)
            {
                py::to_PyErr();
                return nullptr;
            }
        }
        else
        {
            py::set_invalid_arg_count_error(arg_count);
            return nullptr;
        }
    }

    static PyObject* ElementCompositionPreview_GetElementVisual(PyObject* /*unused*/, PyObject* args) noexcept
    {
        auto arg_count = PyTuple_GET_SIZE(args);

        if (arg_count == 1)
        {
            try
            {
                static std::optional<bool> is_overload_present{};

                if (!is_overload_present.has_value())
                {
                    is_overload_present = winrt::Windows::Foundation::Metadata::ApiInformation::IsMethodPresent(L"Windows.UI.Xaml.Hosting.ElementCompositionPreview", L"GetElementVisual", 1);
                }

                if (!is_overload_present.value())
                {
                    py::set_arg_count_version_error(1);
                    return nullptr;
                }

                auto param0 = py::convert_to<winrt::Windows::UI::Xaml::UIElement>(args, 0);

                return py::convert([&]()
                {
                    auto _gil = release_gil();
                    return winrt::Windows::UI::Xaml::Hosting::ElementCompositionPreview::GetElementVisual(param0);
                }());
            }
            catch (...)
            {
                py::to_PyErr();
                return nullptr;
            }
        }
        else
        {
            py::set_invalid_arg_count_error(arg_count);
            return nullptr;
        }
    }

    static PyObject* ElementCompositionPreview_GetPointerPositionPropertySet(PyObject* /*unused*/, PyObject* args) noexcept
    {
        auto arg_count = PyTuple_GET_SIZE(args);

        if (arg_count == 1)
        {
            try
            {
                static std::optional<bool> is_overload_present{};

                if (!is_overload_present.has_value())
                {
                    is_overload_present = winrt::Windows::Foundation::Metadata::ApiInformation::IsMethodPresent(L"Windows.UI.Xaml.Hosting.ElementCompositionPreview", L"GetPointerPositionPropertySet", 1);
                }

                if (!is_overload_present.value())
                {
                    py::set_arg_count_version_error(1);
                    return nullptr;
                }

                auto param0 = py::convert_to<winrt::Windows::UI::Xaml::UIElement>(args, 0);

                return py::convert([&]()
                {
                    auto _gil = release_gil();
                    return winrt::Windows::UI::Xaml::Hosting::ElementCompositionPreview::GetPointerPositionPropertySet(param0);
                }());
            }
            catch (...)
            {
                py::to_PyErr();
                return nullptr;
            }
        }
        else
        {
            py::set_invalid_arg_count_error(arg_count);
            return nullptr;
        }
    }

    static PyObject* ElementCompositionPreview_GetScrollViewerManipulationPropertySet(PyObject* /*unused*/, PyObject* args) noexcept
    {
        auto arg_count = PyTuple_GET_SIZE(args);

        if (arg_count == 1)
        {
            try
            {
                static std::optional<bool> is_overload_present{};

                if (!is_overload_present.has_value())
                {
                    is_overload_present = winrt::Windows::Foundation::Metadata::ApiInformation::IsMethodPresent(L"Windows.UI.Xaml.Hosting.ElementCompositionPreview", L"GetScrollViewerManipulationPropertySet", 1);
                }

                if (!is_overload_present.value())
                {
                    py::set_arg_count_version_error(1);
                    return nullptr;
                }

                auto param0 = py::convert_to<winrt::Windows::UI::Xaml::Controls::ScrollViewer>(args, 0);

                return py::convert([&]()
                {
                    auto _gil = release_gil();
                    return winrt::Windows::UI::Xaml::Hosting::ElementCompositionPreview::GetScrollViewerManipulationPropertySet(param0);
                }());
            }
            catch (...)
            {
                py::to_PyErr();
                return nullptr;
            }
        }
        else
        {
            py::set_invalid_arg_count_error(arg_count);
            return nullptr;
        }
    }

    static PyObject* ElementCompositionPreview_SetAppWindowContent(PyObject* /*unused*/, PyObject* args) noexcept
    {
        auto arg_count = PyTuple_GET_SIZE(args);

        if (arg_count == 2)
        {
            try
            {
                static std::optional<bool> is_overload_present{};

                if (!is_overload_present.has_value())
                {
                    is_overload_present = winrt::Windows::Foundation::Metadata::ApiInformation::IsMethodPresent(L"Windows.UI.Xaml.Hosting.ElementCompositionPreview", L"SetAppWindowContent", 2);
                }

                if (!is_overload_present.value())
                {
                    py::set_arg_count_version_error(2);
                    return nullptr;
                }

                auto param0 = py::convert_to<winrt::Windows::UI::WindowManagement::AppWindow>(args, 0);
                auto param1 = py::convert_to<winrt::Windows::UI::Xaml::UIElement>(args, 1);

                {
                    auto _gil = release_gil();
                    winrt::Windows::UI::Xaml::Hosting::ElementCompositionPreview::SetAppWindowContent(param0, param1);
                }

                Py_RETURN_NONE;
            }
            catch (...)
            {
                py::to_PyErr();
                return nullptr;
            }
        }
        else
        {
            py::set_invalid_arg_count_error(arg_count);
            return nullptr;
        }
    }

    static PyObject* ElementCompositionPreview_SetElementChildVisual(PyObject* /*unused*/, PyObject* args) noexcept
    {
        auto arg_count = PyTuple_GET_SIZE(args);

        if (arg_count == 2)
        {
            try
            {
                static std::optional<bool> is_overload_present{};

                if (!is_overload_present.has_value())
                {
                    is_overload_present = winrt::Windows::Foundation::Metadata::ApiInformation::IsMethodPresent(L"Windows.UI.Xaml.Hosting.ElementCompositionPreview", L"SetElementChildVisual", 2);
                }

                if (!is_overload_present.value())
                {
                    py::set_arg_count_version_error(2);
                    return nullptr;
                }

                auto param0 = py::convert_to<winrt::Windows::UI::Xaml::UIElement>(args, 0);
                auto param1 = py::convert_to<winrt::Windows::UI::Composition::Visual>(args, 1);

                {
                    auto _gil = release_gil();
                    winrt::Windows::UI::Xaml::Hosting::ElementCompositionPreview::SetElementChildVisual(param0, param1);
                }

                Py_RETURN_NONE;
            }
            catch (...)
            {
                py::to_PyErr();
                return nullptr;
            }
        }
        else
        {
            py::set_invalid_arg_count_error(arg_count);
            return nullptr;
        }
    }

    static PyObject* ElementCompositionPreview_SetImplicitHideAnimation(PyObject* /*unused*/, PyObject* args) noexcept
    {
        auto arg_count = PyTuple_GET_SIZE(args);

        if (arg_count == 2)
        {
            try
            {
                static std::optional<bool> is_overload_present{};

                if (!is_overload_present.has_value())
                {
                    is_overload_present = winrt::Windows::Foundation::Metadata::ApiInformation::IsMethodPresent(L"Windows.UI.Xaml.Hosting.ElementCompositionPreview", L"SetImplicitHideAnimation", 2);
                }

                if (!is_overload_present.value())
                {
                    py::set_arg_count_version_error(2);
                    return nullptr;
                }

                auto param0 = py::convert_to<winrt::Windows::UI::Xaml::UIElement>(args, 0);
                auto param1 = py::convert_to<winrt::Windows::UI::Composition::ICompositionAnimationBase>(args, 1);

                {
                    auto _gil = release_gil();
                    winrt::Windows::UI::Xaml::Hosting::ElementCompositionPreview::SetImplicitHideAnimation(param0, param1);
                }

                Py_RETURN_NONE;
            }
            catch (...)
            {
                py::to_PyErr();
                return nullptr;
            }
        }
        else
        {
            py::set_invalid_arg_count_error(arg_count);
            return nullptr;
        }
    }

    static PyObject* ElementCompositionPreview_SetImplicitShowAnimation(PyObject* /*unused*/, PyObject* args) noexcept
    {
        auto arg_count = PyTuple_GET_SIZE(args);

        if (arg_count == 2)
        {
            try
            {
                static std::optional<bool> is_overload_present{};

                if (!is_overload_present.has_value())
                {
                    is_overload_present = winrt::Windows::Foundation::Metadata::ApiInformation::IsMethodPresent(L"Windows.UI.Xaml.Hosting.ElementCompositionPreview", L"SetImplicitShowAnimation", 2);
                }

                if (!is_overload_present.value())
                {
                    py::set_arg_count_version_error(2);
                    return nullptr;
                }

                auto param0 = py::convert_to<winrt::Windows::UI::Xaml::UIElement>(args, 0);
                auto param1 = py::convert_to<winrt::Windows::UI::Composition::ICompositionAnimationBase>(args, 1);

                {
                    auto _gil = release_gil();
                    winrt::Windows::UI::Xaml::Hosting::ElementCompositionPreview::SetImplicitShowAnimation(param0, param1);
                }

                Py_RETURN_NONE;
            }
            catch (...)
            {
                py::to_PyErr();
                return nullptr;
            }
        }
        else
        {
            py::set_invalid_arg_count_error(arg_count);
            return nullptr;
        }
    }

    static PyObject* ElementCompositionPreview_SetIsTranslationEnabled(PyObject* /*unused*/, PyObject* args) noexcept
    {
        auto arg_count = PyTuple_GET_SIZE(args);

        if (arg_count == 2)
        {
            try
            {
                static std::optional<bool> is_overload_present{};

                if (!is_overload_present.has_value())
                {
                    is_overload_present = winrt::Windows::Foundation::Metadata::ApiInformation::IsMethodPresent(L"Windows.UI.Xaml.Hosting.ElementCompositionPreview", L"SetIsTranslationEnabled", 2);
                }

                if (!is_overload_present.value())
                {
                    py::set_arg_count_version_error(2);
                    return nullptr;
                }

                auto param0 = py::convert_to<winrt::Windows::UI::Xaml::UIElement>(args, 0);
                auto param1 = py::convert_to<bool>(args, 1);

                {
                    auto _gil = release_gil();
                    winrt::Windows::UI::Xaml::Hosting::ElementCompositionPreview::SetIsTranslationEnabled(param0, param1);
                }

                Py_RETURN_NONE;
            }
            catch (...)
            {
                py::to_PyErr();
                return nullptr;
            }
        }
        else
        {
            py::set_invalid_arg_count_error(arg_count);
            return nullptr;
        }
    }

    static PyObject* _assign_array_ElementCompositionPreview(PyObject* /*unused*/, PyObject* arg) noexcept
    {
        auto array = std::make_unique<py::ComArray<winrt::Windows::UI::Xaml::Hosting::ElementCompositionPreview>>();
        if (!py::cpp::_winrt::Array_Assign(arg, std::move(array)))
        {
            return nullptr;
        }
        Py_RETURN_NONE;
    }

    static PyObject* _from_ElementCompositionPreview(PyObject* /*unused*/, PyObject* arg) noexcept
    {
        try
        {
            auto return_value = py::convert_to<winrt::Windows::Foundation::IInspectable>(arg);
            return py::convert(return_value.as<winrt::Windows::UI::Xaml::Hosting::ElementCompositionPreview>());
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static PyMethodDef _methods_ElementCompositionPreview[] = {
        { "_assign_array_", _assign_array_ElementCompositionPreview, METH_O | METH_STATIC, nullptr },
        { "_from", reinterpret_cast<PyCFunction>(_from_ElementCompositionPreview), METH_O | METH_STATIC, nullptr },
        { }};

    static PyGetSetDef _getset_ElementCompositionPreview[] = {
        { }};

    static PyType_Slot _type_slots_ElementCompositionPreview[] = {
        { Py_tp_new, reinterpret_cast<void*>(_new_ElementCompositionPreview) },
        { Py_tp_dealloc, reinterpret_cast<void*>(_dealloc_ElementCompositionPreview) },
        { Py_tp_methods, reinterpret_cast<void*>(_methods_ElementCompositionPreview) },
        { Py_tp_getset, reinterpret_cast<void*>(_getset_ElementCompositionPreview) },
        { }};

    static PyType_Spec type_spec_ElementCompositionPreview = {
        "winrt._winrt_windows_ui_xaml_hosting.ElementCompositionPreview",
        sizeof(py::wrapper::Windows::UI::Xaml::Hosting::ElementCompositionPreview),
        0,
        Py_TPFLAGS_DEFAULT,
        _type_slots_ElementCompositionPreview};

    static PyGetSetDef getset_ElementCompositionPreview_Static[] = {
        { }};

    static PyMethodDef methods_ElementCompositionPreview_Static[] = {
        { "get_app_window_content", reinterpret_cast<PyCFunction>(ElementCompositionPreview_GetAppWindowContent), METH_VARARGS, nullptr },
        { "get_element_child_visual", reinterpret_cast<PyCFunction>(ElementCompositionPreview_GetElementChildVisual), METH_VARARGS, nullptr },
        { "get_element_visual", reinterpret_cast<PyCFunction>(ElementCompositionPreview_GetElementVisual), METH_VARARGS, nullptr },
        { "get_pointer_position_property_set", reinterpret_cast<PyCFunction>(ElementCompositionPreview_GetPointerPositionPropertySet), METH_VARARGS, nullptr },
        { "get_scroll_viewer_manipulation_property_set", reinterpret_cast<PyCFunction>(ElementCompositionPreview_GetScrollViewerManipulationPropertySet), METH_VARARGS, nullptr },
        { "set_app_window_content", reinterpret_cast<PyCFunction>(ElementCompositionPreview_SetAppWindowContent), METH_VARARGS, nullptr },
        { "set_element_child_visual", reinterpret_cast<PyCFunction>(ElementCompositionPreview_SetElementChildVisual), METH_VARARGS, nullptr },
        { "set_implicit_hide_animation", reinterpret_cast<PyCFunction>(ElementCompositionPreview_SetImplicitHideAnimation), METH_VARARGS, nullptr },
        { "set_implicit_show_animation", reinterpret_cast<PyCFunction>(ElementCompositionPreview_SetImplicitShowAnimation), METH_VARARGS, nullptr },
        { "set_is_translation_enabled", reinterpret_cast<PyCFunction>(ElementCompositionPreview_SetIsTranslationEnabled), METH_VARARGS, nullptr },
        { }};

    static PyType_Slot type_slots_ElementCompositionPreview_Static[] = 
    {
        { Py_tp_base, reinterpret_cast<void*>(&PyType_Type) },
        { Py_tp_getset, reinterpret_cast<void*>(getset_ElementCompositionPreview_Static) },
        { Py_tp_methods, reinterpret_cast<void*>(methods_ElementCompositionPreview_Static) },
        { }
    };

    static PyType_Spec type_spec_ElementCompositionPreview_Static = {
        "winrt._winrt_windows_ui_xaml_hosting.ElementCompositionPreview_Static",
        static_cast<int>(PyType_Type.tp_basicsize),
        static_cast<int>(PyType_Type.tp_itemsize),
        Py_TPFLAGS_DEFAULT,
        type_slots_ElementCompositionPreview_Static};

    // ----- WindowsXamlManager class --------------------

    static PyObject* _new_WindowsXamlManager(PyTypeObject* /*unused*/, PyObject* /*unused*/, PyObject* /*unused*/) noexcept
    {
        static_assert(py::py_type<winrt::Windows::UI::Xaml::Hosting::WindowsXamlManager>::type_name);
        py::set_invalid_activation_error(py::py_type<winrt::Windows::UI::Xaml::Hosting::WindowsXamlManager>::type_name);
        return nullptr;
    }

    static void _dealloc_WindowsXamlManager(py::wrapper::Windows::UI::Xaml::Hosting::WindowsXamlManager* self) noexcept
    {
        auto tp = Py_TYPE(self);
        std::destroy_at(&self->obj);
        tp->tp_free(self);
        Py_DECREF(tp);
    }

    static PyObject* WindowsXamlManager_Close(py::wrapper::Windows::UI::Xaml::Hosting::WindowsXamlManager* self, PyObject* args) noexcept
    {
        auto arg_count = PyTuple_GET_SIZE(args);

        if (arg_count == 0)
        {
            try
            {
                static std::optional<bool> is_overload_present{};

                if (!is_overload_present.has_value())
                {
                    is_overload_present = winrt::Windows::Foundation::Metadata::ApiInformation::IsMethodPresent(L"Windows.UI.Xaml.Hosting.WindowsXamlManager", L"Close", 0);
                }

                if (!is_overload_present.value())
                {
                    py::set_arg_count_version_error(0);
                    return nullptr;
                }

                {
                    auto _gil = release_gil();
                    self->obj.Close();
                }

                Py_RETURN_NONE;
            }
            catch (...)
            {
                py::to_PyErr();
                return nullptr;
            }
        }
        else
        {
            py::set_invalid_arg_count_error(arg_count);
            return nullptr;
        }
    }

    static PyObject* WindowsXamlManager_InitializeForCurrentThread(PyObject* /*unused*/, PyObject* args) noexcept
    {
        auto arg_count = PyTuple_GET_SIZE(args);

        if (arg_count == 0)
        {
            try
            {
                static std::optional<bool> is_overload_present{};

                if (!is_overload_present.has_value())
                {
                    is_overload_present = winrt::Windows::Foundation::Metadata::ApiInformation::IsMethodPresent(L"Windows.UI.Xaml.Hosting.WindowsXamlManager", L"InitializeForCurrentThread", 0);
                }

                if (!is_overload_present.value())
                {
                    py::set_arg_count_version_error(0);
                    return nullptr;
                }

                return py::convert([&]()
                {
                    auto _gil = release_gil();
                    return winrt::Windows::UI::Xaml::Hosting::WindowsXamlManager::InitializeForCurrentThread();
                }());
            }
            catch (...)
            {
                py::to_PyErr();
                return nullptr;
            }
        }
        else
        {
            py::set_invalid_arg_count_error(arg_count);
            return nullptr;
        }
    }

    static PyObject* _assign_array_WindowsXamlManager(PyObject* /*unused*/, PyObject* arg) noexcept
    {
        auto array = std::make_unique<py::ComArray<winrt::Windows::UI::Xaml::Hosting::WindowsXamlManager>>();
        if (!py::cpp::_winrt::Array_Assign(arg, std::move(array)))
        {
            return nullptr;
        }
        Py_RETURN_NONE;
    }

    static PyObject* _from_WindowsXamlManager(PyObject* /*unused*/, PyObject* arg) noexcept
    {
        try
        {
            auto return_value = py::convert_to<winrt::Windows::Foundation::IInspectable>(arg);
            return py::convert(return_value.as<winrt::Windows::UI::Xaml::Hosting::WindowsXamlManager>());
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static PyObject* _enter_WindowsXamlManager(py::wrapper::Windows::UI::Xaml::Hosting::WindowsXamlManager* self, PyObject* /*unused*/) noexcept
    {
        return Py_NewRef(self);
    }

    static PyObject* _exit_WindowsXamlManager(py::wrapper::Windows::UI::Xaml::Hosting::WindowsXamlManager* self, PyObject* /*unused*/) noexcept
    {
        try
        {
            {
                auto _gil = py::release_gil();
                self->obj.Close();
            }

            Py_RETURN_FALSE;
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static PyMethodDef _methods_WindowsXamlManager[] = {
        { "close", reinterpret_cast<PyCFunction>(WindowsXamlManager_Close), METH_VARARGS, nullptr },
        { "_assign_array_", _assign_array_WindowsXamlManager, METH_O | METH_STATIC, nullptr },
        { "_from", reinterpret_cast<PyCFunction>(_from_WindowsXamlManager), METH_O | METH_STATIC, nullptr },
        { "__enter__", reinterpret_cast<PyCFunction>(_enter_WindowsXamlManager), METH_NOARGS, nullptr },
        { "__exit__", reinterpret_cast<PyCFunction>(_exit_WindowsXamlManager), METH_VARARGS, nullptr },
        { }};

    static PyGetSetDef _getset_WindowsXamlManager[] = {
        { }};

    static PyType_Slot _type_slots_WindowsXamlManager[] = {
        { Py_tp_new, reinterpret_cast<void*>(_new_WindowsXamlManager) },
        { Py_tp_dealloc, reinterpret_cast<void*>(_dealloc_WindowsXamlManager) },
        { Py_tp_methods, reinterpret_cast<void*>(_methods_WindowsXamlManager) },
        { Py_tp_getset, reinterpret_cast<void*>(_getset_WindowsXamlManager) },
        { }};

    static PyType_Spec type_spec_WindowsXamlManager = {
        "winrt._winrt_windows_ui_xaml_hosting.WindowsXamlManager",
        sizeof(py::wrapper::Windows::UI::Xaml::Hosting::WindowsXamlManager),
        0,
        Py_TPFLAGS_DEFAULT,
        _type_slots_WindowsXamlManager};

    static PyGetSetDef getset_WindowsXamlManager_Static[] = {
        { }};

    static PyMethodDef methods_WindowsXamlManager_Static[] = {
        { "initialize_for_current_thread", reinterpret_cast<PyCFunction>(WindowsXamlManager_InitializeForCurrentThread), METH_VARARGS, nullptr },
        { }};

    static PyType_Slot type_slots_WindowsXamlManager_Static[] = 
    {
        { Py_tp_base, reinterpret_cast<void*>(&PyType_Type) },
        { Py_tp_getset, reinterpret_cast<void*>(getset_WindowsXamlManager_Static) },
        { Py_tp_methods, reinterpret_cast<void*>(methods_WindowsXamlManager_Static) },
        { }
    };

    static PyType_Spec type_spec_WindowsXamlManager_Static = {
        "winrt._winrt_windows_ui_xaml_hosting.WindowsXamlManager_Static",
        static_cast<int>(PyType_Type.tp_basicsize),
        static_cast<int>(PyType_Type.tp_itemsize),
        Py_TPFLAGS_DEFAULT,
        type_slots_WindowsXamlManager_Static};

    // ----- XamlSourceFocusNavigationRequest class --------------------

    static PyObject* _new_XamlSourceFocusNavigationRequest(PyTypeObject* type, PyObject* args, PyObject* kwds) noexcept
    {
        if (kwds)
        {
            py::set_invalid_kwd_args_error();
            return nullptr;
        }

        auto arg_count = PyTuple_GET_SIZE(args);
        if (arg_count == 1)
        {
            try
            {
                auto param0 = py::convert_to<winrt::Windows::UI::Xaml::Hosting::XamlSourceFocusNavigationReason>(args, 0);

                winrt::Windows::UI::Xaml::Hosting::XamlSourceFocusNavigationRequest instance{param0};
                return py::wrap(instance, type);
            }
            catch (...)
            {
                py::to_PyErr();
                return nullptr;
            }
        }
        else if (arg_count == 2)
        {
            try
            {
                auto param0 = py::convert_to<winrt::Windows::UI::Xaml::Hosting::XamlSourceFocusNavigationReason>(args, 0);
                auto param1 = py::convert_to<winrt::Windows::Foundation::Rect>(args, 1);

                winrt::Windows::UI::Xaml::Hosting::XamlSourceFocusNavigationRequest instance{param0, param1};
                return py::wrap(instance, type);
            }
            catch (...)
            {
                py::to_PyErr();
                return nullptr;
            }
        }
        else if (arg_count == 3)
        {
            try
            {
                auto param0 = py::convert_to<winrt::Windows::UI::Xaml::Hosting::XamlSourceFocusNavigationReason>(args, 0);
                auto param1 = py::convert_to<winrt::Windows::Foundation::Rect>(args, 1);
                auto param2 = py::convert_to<winrt::guid>(args, 2);

                winrt::Windows::UI::Xaml::Hosting::XamlSourceFocusNavigationRequest instance{param0, param1, param2};
                return py::wrap(instance, type);
            }
            catch (...)
            {
                py::to_PyErr();
                return nullptr;
            }
        }
        else
        {
            py::set_invalid_arg_count_error(arg_count);
            return nullptr;
        }
    }

    static void _dealloc_XamlSourceFocusNavigationRequest(py::wrapper::Windows::UI::Xaml::Hosting::XamlSourceFocusNavigationRequest* self) noexcept
    {
        auto tp = Py_TYPE(self);
        std::destroy_at(&self->obj);
        tp->tp_free(self);
        Py_DECREF(tp);
    }

    static PyObject* XamlSourceFocusNavigationRequest_get_CorrelationId(py::wrapper::Windows::UI::Xaml::Hosting::XamlSourceFocusNavigationRequest* self, void* /*unused*/) noexcept
    {
        try
        {
            static std::optional<bool> is_property_present{};

            if (!is_property_present.has_value())
            {
                is_property_present = winrt::Windows::Foundation::Metadata::ApiInformation::IsPropertyPresent(L"Windows.UI.Xaml.Hosting.XamlSourceFocusNavigationRequest", L"CorrelationId");
            }

            if (!is_property_present.value())
            {
                PyErr_SetString(PyExc_AttributeError, "property is not available in this version of Windows");
                return nullptr;
            }

            return py::convert([&]()
            {
                auto _gil = release_gil();
                return self->obj.CorrelationId();
            }());
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static PyObject* XamlSourceFocusNavigationRequest_get_HintRect(py::wrapper::Windows::UI::Xaml::Hosting::XamlSourceFocusNavigationRequest* self, void* /*unused*/) noexcept
    {
        try
        {
            static std::optional<bool> is_property_present{};

            if (!is_property_present.has_value())
            {
                is_property_present = winrt::Windows::Foundation::Metadata::ApiInformation::IsPropertyPresent(L"Windows.UI.Xaml.Hosting.XamlSourceFocusNavigationRequest", L"HintRect");
            }

            if (!is_property_present.value())
            {
                PyErr_SetString(PyExc_AttributeError, "property is not available in this version of Windows");
                return nullptr;
            }

            return py::convert([&]()
            {
                auto _gil = release_gil();
                return self->obj.HintRect();
            }());
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static PyObject* XamlSourceFocusNavigationRequest_get_Reason(py::wrapper::Windows::UI::Xaml::Hosting::XamlSourceFocusNavigationRequest* self, void* /*unused*/) noexcept
    {
        try
        {
            static std::optional<bool> is_property_present{};

            if (!is_property_present.has_value())
            {
                is_property_present = winrt::Windows::Foundation::Metadata::ApiInformation::IsPropertyPresent(L"Windows.UI.Xaml.Hosting.XamlSourceFocusNavigationRequest", L"Reason");
            }

            if (!is_property_present.value())
            {
                PyErr_SetString(PyExc_AttributeError, "property is not available in this version of Windows");
                return nullptr;
            }

            return py::convert([&]()
            {
                auto _gil = release_gil();
                return self->obj.Reason();
            }());
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static PyObject* _assign_array_XamlSourceFocusNavigationRequest(PyObject* /*unused*/, PyObject* arg) noexcept
    {
        auto array = std::make_unique<py::ComArray<winrt::Windows::UI::Xaml::Hosting::XamlSourceFocusNavigationRequest>>();
        if (!py::cpp::_winrt::Array_Assign(arg, std::move(array)))
        {
            return nullptr;
        }
        Py_RETURN_NONE;
    }

    static PyObject* _from_XamlSourceFocusNavigationRequest(PyObject* /*unused*/, PyObject* arg) noexcept
    {
        try
        {
            auto return_value = py::convert_to<winrt::Windows::Foundation::IInspectable>(arg);
            return py::convert(return_value.as<winrt::Windows::UI::Xaml::Hosting::XamlSourceFocusNavigationRequest>());
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static PyMethodDef _methods_XamlSourceFocusNavigationRequest[] = {
        { "_assign_array_", _assign_array_XamlSourceFocusNavigationRequest, METH_O | METH_STATIC, nullptr },
        { "_from", reinterpret_cast<PyCFunction>(_from_XamlSourceFocusNavigationRequest), METH_O | METH_STATIC, nullptr },
        { }};

    static PyGetSetDef _getset_XamlSourceFocusNavigationRequest[] = {
        { "correlation_id", reinterpret_cast<getter>(XamlSourceFocusNavigationRequest_get_CorrelationId), nullptr, nullptr, nullptr },
        { "hint_rect", reinterpret_cast<getter>(XamlSourceFocusNavigationRequest_get_HintRect), nullptr, nullptr, nullptr },
        { "reason", reinterpret_cast<getter>(XamlSourceFocusNavigationRequest_get_Reason), nullptr, nullptr, nullptr },
        { }};

    static PyType_Slot _type_slots_XamlSourceFocusNavigationRequest[] = {
        { Py_tp_new, reinterpret_cast<void*>(_new_XamlSourceFocusNavigationRequest) },
        { Py_tp_dealloc, reinterpret_cast<void*>(_dealloc_XamlSourceFocusNavigationRequest) },
        { Py_tp_methods, reinterpret_cast<void*>(_methods_XamlSourceFocusNavigationRequest) },
        { Py_tp_getset, reinterpret_cast<void*>(_getset_XamlSourceFocusNavigationRequest) },
        { }};

    static PyType_Spec type_spec_XamlSourceFocusNavigationRequest = {
        "winrt._winrt_windows_ui_xaml_hosting.XamlSourceFocusNavigationRequest",
        sizeof(py::wrapper::Windows::UI::Xaml::Hosting::XamlSourceFocusNavigationRequest),
        0,
        Py_TPFLAGS_DEFAULT,
        _type_slots_XamlSourceFocusNavigationRequest};

    // ----- XamlSourceFocusNavigationResult class --------------------

    static PyObject* _new_XamlSourceFocusNavigationResult(PyTypeObject* type, PyObject* args, PyObject* kwds) noexcept
    {
        if (kwds)
        {
            py::set_invalid_kwd_args_error();
            return nullptr;
        }

        auto arg_count = PyTuple_GET_SIZE(args);
        if (arg_count == 1)
        {
            try
            {
                auto param0 = py::convert_to<bool>(args, 0);

                winrt::Windows::UI::Xaml::Hosting::XamlSourceFocusNavigationResult instance{param0};
                return py::wrap(instance, type);
            }
            catch (...)
            {
                py::to_PyErr();
                return nullptr;
            }
        }
        else
        {
            py::set_invalid_arg_count_error(arg_count);
            return nullptr;
        }
    }

    static void _dealloc_XamlSourceFocusNavigationResult(py::wrapper::Windows::UI::Xaml::Hosting::XamlSourceFocusNavigationResult* self) noexcept
    {
        auto tp = Py_TYPE(self);
        std::destroy_at(&self->obj);
        tp->tp_free(self);
        Py_DECREF(tp);
    }

    static PyObject* XamlSourceFocusNavigationResult_get_WasFocusMoved(py::wrapper::Windows::UI::Xaml::Hosting::XamlSourceFocusNavigationResult* self, void* /*unused*/) noexcept
    {
        try
        {
            static std::optional<bool> is_property_present{};

            if (!is_property_present.has_value())
            {
                is_property_present = winrt::Windows::Foundation::Metadata::ApiInformation::IsPropertyPresent(L"Windows.UI.Xaml.Hosting.XamlSourceFocusNavigationResult", L"WasFocusMoved");
            }

            if (!is_property_present.value())
            {
                PyErr_SetString(PyExc_AttributeError, "property is not available in this version of Windows");
                return nullptr;
            }

            return py::convert([&]()
            {
                auto _gil = release_gil();
                return self->obj.WasFocusMoved();
            }());
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static PyObject* _assign_array_XamlSourceFocusNavigationResult(PyObject* /*unused*/, PyObject* arg) noexcept
    {
        auto array = std::make_unique<py::ComArray<winrt::Windows::UI::Xaml::Hosting::XamlSourceFocusNavigationResult>>();
        if (!py::cpp::_winrt::Array_Assign(arg, std::move(array)))
        {
            return nullptr;
        }
        Py_RETURN_NONE;
    }

    static PyObject* _from_XamlSourceFocusNavigationResult(PyObject* /*unused*/, PyObject* arg) noexcept
    {
        try
        {
            auto return_value = py::convert_to<winrt::Windows::Foundation::IInspectable>(arg);
            return py::convert(return_value.as<winrt::Windows::UI::Xaml::Hosting::XamlSourceFocusNavigationResult>());
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static PyMethodDef _methods_XamlSourceFocusNavigationResult[] = {
        { "_assign_array_", _assign_array_XamlSourceFocusNavigationResult, METH_O | METH_STATIC, nullptr },
        { "_from", reinterpret_cast<PyCFunction>(_from_XamlSourceFocusNavigationResult), METH_O | METH_STATIC, nullptr },
        { }};

    static PyGetSetDef _getset_XamlSourceFocusNavigationResult[] = {
        { "was_focus_moved", reinterpret_cast<getter>(XamlSourceFocusNavigationResult_get_WasFocusMoved), nullptr, nullptr, nullptr },
        { }};

    static PyType_Slot _type_slots_XamlSourceFocusNavigationResult[] = {
        { Py_tp_new, reinterpret_cast<void*>(_new_XamlSourceFocusNavigationResult) },
        { Py_tp_dealloc, reinterpret_cast<void*>(_dealloc_XamlSourceFocusNavigationResult) },
        { Py_tp_methods, reinterpret_cast<void*>(_methods_XamlSourceFocusNavigationResult) },
        { Py_tp_getset, reinterpret_cast<void*>(_getset_XamlSourceFocusNavigationResult) },
        { }};

    static PyType_Spec type_spec_XamlSourceFocusNavigationResult = {
        "winrt._winrt_windows_ui_xaml_hosting.XamlSourceFocusNavigationResult",
        sizeof(py::wrapper::Windows::UI::Xaml::Hosting::XamlSourceFocusNavigationResult),
        0,
        Py_TPFLAGS_DEFAULT,
        _type_slots_XamlSourceFocusNavigationResult};

    // ----- XamlUIPresenter class --------------------

    static PyObject* _new_XamlUIPresenter(PyTypeObject* /*unused*/, PyObject* /*unused*/, PyObject* /*unused*/) noexcept
    {
        static_assert(py::py_type<winrt::Windows::UI::Xaml::Hosting::XamlUIPresenter>::type_name);
        py::set_invalid_activation_error(py::py_type<winrt::Windows::UI::Xaml::Hosting::XamlUIPresenter>::type_name);
        return nullptr;
    }

    static void _dealloc_XamlUIPresenter(py::wrapper::Windows::UI::Xaml::Hosting::XamlUIPresenter* self) noexcept
    {
        auto tp = Py_TYPE(self);
        std::destroy_at(&self->obj);
        tp->tp_free(self);
        Py_DECREF(tp);
    }

    static PyObject* XamlUIPresenter_GetFlyoutPlacement(PyObject* /*unused*/, PyObject* args) noexcept
    {
        auto arg_count = PyTuple_GET_SIZE(args);

        if (arg_count == 6)
        {
            try
            {
                static std::optional<bool> is_overload_present{};

                if (!is_overload_present.has_value())
                {
                    is_overload_present = winrt::Windows::Foundation::Metadata::ApiInformation::IsMethodPresent(L"Windows.UI.Xaml.Hosting.XamlUIPresenter", L"GetFlyoutPlacement", 6);
                }

                if (!is_overload_present.value())
                {
                    py::set_arg_count_version_error(6);
                    return nullptr;
                }

                auto param0 = py::convert_to<winrt::Windows::Foundation::Rect>(args, 0);
                auto param1 = py::convert_to<winrt::Windows::Foundation::Size>(args, 1);
                auto param2 = py::convert_to<winrt::Windows::Foundation::Size>(args, 2);
                auto param3 = py::convert_to<winrt::Windows::Foundation::Rect>(args, 3);
                auto param4 = py::convert_to<winrt::Windows::UI::Xaml::Controls::Primitives::FlyoutPlacementMode>(args, 4);
                auto param5 = py::convert_to<bool>(args, 5);
                winrt::Windows::UI::Xaml::Controls::Primitives::FlyoutPlacementMode param6{};

                auto return_value = [&]()
                {
                    auto _gil = release_gil();
                    return winrt::Windows::UI::Xaml::Hosting::XamlUIPresenter::GetFlyoutPlacement(param0, param1, param2, param3, param4, param5, param6);
                }();

                py::pyobj_handle out_return_value{ py::convert(return_value) };
                if (!out_return_value)
                {
                    return nullptr;
                }
                py::pyobj_handle out6{ py::convert(param6) };
                if (!out6)
                {
                    return nullptr;
                }

                return PyTuple_Pack(2, out_return_value.get(), out6.get());
            }
            catch (...)
            {
                py::to_PyErr();
                return nullptr;
            }
        }
        else
        {
            py::set_invalid_arg_count_error(arg_count);
            return nullptr;
        }
    }

    static PyObject* XamlUIPresenter_GetFlyoutPlacementTargetInfo(PyObject* /*unused*/, PyObject* args) noexcept
    {
        auto arg_count = PyTuple_GET_SIZE(args);

        if (arg_count == 2)
        {
            try
            {
                static std::optional<bool> is_overload_present{};

                if (!is_overload_present.has_value())
                {
                    is_overload_present = winrt::Windows::Foundation::Metadata::ApiInformation::IsMethodPresent(L"Windows.UI.Xaml.Hosting.XamlUIPresenter", L"GetFlyoutPlacementTargetInfo", 2);
                }

                if (!is_overload_present.value())
                {
                    py::set_arg_count_version_error(2);
                    return nullptr;
                }

                auto param0 = py::convert_to<winrt::Windows::UI::Xaml::FrameworkElement>(args, 0);
                auto param1 = py::convert_to<winrt::Windows::UI::Xaml::Controls::Primitives::FlyoutPlacementMode>(args, 1);
                winrt::Windows::UI::Xaml::Controls::Primitives::FlyoutPlacementMode param2{};
                bool param3{};

                auto return_value = [&]()
                {
                    auto _gil = release_gil();
                    return winrt::Windows::UI::Xaml::Hosting::XamlUIPresenter::GetFlyoutPlacementTargetInfo(param0, param1, param2, param3);
                }();

                py::pyobj_handle out_return_value{ py::convert(return_value) };
                if (!out_return_value)
                {
                    return nullptr;
                }
                py::pyobj_handle out2{ py::convert(param2) };
                if (!out2)
                {
                    return nullptr;
                }
                py::pyobj_handle out3{ py::convert(param3) };
                if (!out3)
                {
                    return nullptr;
                }

                return PyTuple_Pack(3, out_return_value.get(), out2.get(), out3.get());
            }
            catch (...)
            {
                py::to_PyErr();
                return nullptr;
            }
        }
        else
        {
            py::set_invalid_arg_count_error(arg_count);
            return nullptr;
        }
    }

    static PyObject* XamlUIPresenter_NotifyWindowSizeChanged(PyObject* /*unused*/, PyObject* args) noexcept
    {
        auto arg_count = PyTuple_GET_SIZE(args);

        if (arg_count == 0)
        {
            try
            {
                static std::optional<bool> is_overload_present{};

                if (!is_overload_present.has_value())
                {
                    is_overload_present = winrt::Windows::Foundation::Metadata::ApiInformation::IsMethodPresent(L"Windows.UI.Xaml.Hosting.XamlUIPresenter", L"NotifyWindowSizeChanged", 0);
                }

                if (!is_overload_present.value())
                {
                    py::set_arg_count_version_error(0);
                    return nullptr;
                }

                {
                    auto _gil = release_gil();
                    winrt::Windows::UI::Xaml::Hosting::XamlUIPresenter::NotifyWindowSizeChanged();
                }

                Py_RETURN_NONE;
            }
            catch (...)
            {
                py::to_PyErr();
                return nullptr;
            }
        }
        else
        {
            py::set_invalid_arg_count_error(arg_count);
            return nullptr;
        }
    }

    static PyObject* XamlUIPresenter_Present(py::wrapper::Windows::UI::Xaml::Hosting::XamlUIPresenter* self, PyObject* args) noexcept
    {
        auto arg_count = PyTuple_GET_SIZE(args);

        if (arg_count == 0)
        {
            try
            {
                static std::optional<bool> is_overload_present{};

                if (!is_overload_present.has_value())
                {
                    is_overload_present = winrt::Windows::Foundation::Metadata::ApiInformation::IsMethodPresent(L"Windows.UI.Xaml.Hosting.XamlUIPresenter", L"Present", 0);
                }

                if (!is_overload_present.value())
                {
                    py::set_arg_count_version_error(0);
                    return nullptr;
                }

                {
                    auto _gil = release_gil();
                    self->obj.Present();
                }

                Py_RETURN_NONE;
            }
            catch (...)
            {
                py::to_PyErr();
                return nullptr;
            }
        }
        else
        {
            py::set_invalid_arg_count_error(arg_count);
            return nullptr;
        }
    }

    static PyObject* XamlUIPresenter_Render(py::wrapper::Windows::UI::Xaml::Hosting::XamlUIPresenter* self, PyObject* args) noexcept
    {
        auto arg_count = PyTuple_GET_SIZE(args);

        if (arg_count == 0)
        {
            try
            {
                static std::optional<bool> is_overload_present{};

                if (!is_overload_present.has_value())
                {
                    is_overload_present = winrt::Windows::Foundation::Metadata::ApiInformation::IsMethodPresent(L"Windows.UI.Xaml.Hosting.XamlUIPresenter", L"Render", 0);
                }

                if (!is_overload_present.value())
                {
                    py::set_arg_count_version_error(0);
                    return nullptr;
                }

                {
                    auto _gil = release_gil();
                    self->obj.Render();
                }

                Py_RETURN_NONE;
            }
            catch (...)
            {
                py::to_PyErr();
                return nullptr;
            }
        }
        else
        {
            py::set_invalid_arg_count_error(arg_count);
            return nullptr;
        }
    }

    static PyObject* XamlUIPresenter_SetHost(PyObject* /*unused*/, PyObject* args) noexcept
    {
        auto arg_count = PyTuple_GET_SIZE(args);

        if (arg_count == 1)
        {
            try
            {
                static std::optional<bool> is_overload_present{};

                if (!is_overload_present.has_value())
                {
                    is_overload_present = winrt::Windows::Foundation::Metadata::ApiInformation::IsMethodPresent(L"Windows.UI.Xaml.Hosting.XamlUIPresenter", L"SetHost", 1);
                }

                if (!is_overload_present.value())
                {
                    py::set_arg_count_version_error(1);
                    return nullptr;
                }

                auto param0 = py::convert_to<winrt::Windows::UI::Xaml::Hosting::IXamlUIPresenterHost>(args, 0);

                {
                    auto _gil = release_gil();
                    winrt::Windows::UI::Xaml::Hosting::XamlUIPresenter::SetHost(param0);
                }

                Py_RETURN_NONE;
            }
            catch (...)
            {
                py::to_PyErr();
                return nullptr;
            }
        }
        else
        {
            py::set_invalid_arg_count_error(arg_count);
            return nullptr;
        }
    }

    static PyObject* XamlUIPresenter_SetSize(py::wrapper::Windows::UI::Xaml::Hosting::XamlUIPresenter* self, PyObject* args) noexcept
    {
        auto arg_count = PyTuple_GET_SIZE(args);

        if (arg_count == 2)
        {
            try
            {
                static std::optional<bool> is_overload_present{};

                if (!is_overload_present.has_value())
                {
                    is_overload_present = winrt::Windows::Foundation::Metadata::ApiInformation::IsMethodPresent(L"Windows.UI.Xaml.Hosting.XamlUIPresenter", L"SetSize", 2);
                }

                if (!is_overload_present.value())
                {
                    py::set_arg_count_version_error(2);
                    return nullptr;
                }

                auto param0 = py::convert_to<int32_t>(args, 0);
                auto param1 = py::convert_to<int32_t>(args, 1);

                {
                    auto _gil = release_gil();
                    self->obj.SetSize(param0, param1);
                }

                Py_RETURN_NONE;
            }
            catch (...)
            {
                py::to_PyErr();
                return nullptr;
            }
        }
        else
        {
            py::set_invalid_arg_count_error(arg_count);
            return nullptr;
        }
    }

    static PyObject* XamlUIPresenter_get_ThemeResourcesXaml(py::wrapper::Windows::UI::Xaml::Hosting::XamlUIPresenter* self, void* /*unused*/) noexcept
    {
        try
        {
            static std::optional<bool> is_property_present{};

            if (!is_property_present.has_value())
            {
                is_property_present = winrt::Windows::Foundation::Metadata::ApiInformation::IsPropertyPresent(L"Windows.UI.Xaml.Hosting.XamlUIPresenter", L"ThemeResourcesXaml");
            }

            if (!is_property_present.value())
            {
                PyErr_SetString(PyExc_AttributeError, "property is not available in this version of Windows");
                return nullptr;
            }

            return py::convert([&]()
            {
                auto _gil = release_gil();
                return self->obj.ThemeResourcesXaml();
            }());
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static int XamlUIPresenter_put_ThemeResourcesXaml(py::wrapper::Windows::UI::Xaml::Hosting::XamlUIPresenter* self, PyObject* arg, void* /*unused*/) noexcept
    {
        if (!arg)
        {
            PyErr_SetString(PyExc_AttributeError, "can't delete attribute");
            return -1;
        }

        try
        {
            static std::optional<bool> is_property_present{};

            if (!is_property_present.has_value())
            {
                is_property_present = winrt::Windows::Foundation::Metadata::ApiInformation::IsPropertyPresent(L"Windows.UI.Xaml.Hosting.XamlUIPresenter", L"ThemeResourcesXaml");
            }

            if (!is_property_present.value())
            {
                PyErr_SetString(PyExc_AttributeError, "property is not available in this version of Windows");
                return -1;
            }

            auto param0 = py::convert_to<winrt::hstring>(arg);

            {
                auto _gil = release_gil();
                self->obj.ThemeResourcesXaml(param0);
            }

            return 0;
        }
        catch (...)
        {
            py::to_PyErr();
            return -1;
        }
    }

    static PyObject* XamlUIPresenter_get_ThemeKey(py::wrapper::Windows::UI::Xaml::Hosting::XamlUIPresenter* self, void* /*unused*/) noexcept
    {
        try
        {
            static std::optional<bool> is_property_present{};

            if (!is_property_present.has_value())
            {
                is_property_present = winrt::Windows::Foundation::Metadata::ApiInformation::IsPropertyPresent(L"Windows.UI.Xaml.Hosting.XamlUIPresenter", L"ThemeKey");
            }

            if (!is_property_present.value())
            {
                PyErr_SetString(PyExc_AttributeError, "property is not available in this version of Windows");
                return nullptr;
            }

            return py::convert([&]()
            {
                auto _gil = release_gil();
                return self->obj.ThemeKey();
            }());
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static int XamlUIPresenter_put_ThemeKey(py::wrapper::Windows::UI::Xaml::Hosting::XamlUIPresenter* self, PyObject* arg, void* /*unused*/) noexcept
    {
        if (!arg)
        {
            PyErr_SetString(PyExc_AttributeError, "can't delete attribute");
            return -1;
        }

        try
        {
            static std::optional<bool> is_property_present{};

            if (!is_property_present.has_value())
            {
                is_property_present = winrt::Windows::Foundation::Metadata::ApiInformation::IsPropertyPresent(L"Windows.UI.Xaml.Hosting.XamlUIPresenter", L"ThemeKey");
            }

            if (!is_property_present.value())
            {
                PyErr_SetString(PyExc_AttributeError, "property is not available in this version of Windows");
                return -1;
            }

            auto param0 = py::convert_to<winrt::hstring>(arg);

            {
                auto _gil = release_gil();
                self->obj.ThemeKey(param0);
            }

            return 0;
        }
        catch (...)
        {
            py::to_PyErr();
            return -1;
        }
    }

    static PyObject* XamlUIPresenter_get_RootElement(py::wrapper::Windows::UI::Xaml::Hosting::XamlUIPresenter* self, void* /*unused*/) noexcept
    {
        try
        {
            static std::optional<bool> is_property_present{};

            if (!is_property_present.has_value())
            {
                is_property_present = winrt::Windows::Foundation::Metadata::ApiInformation::IsPropertyPresent(L"Windows.UI.Xaml.Hosting.XamlUIPresenter", L"RootElement");
            }

            if (!is_property_present.value())
            {
                PyErr_SetString(PyExc_AttributeError, "property is not available in this version of Windows");
                return nullptr;
            }

            return py::convert([&]()
            {
                auto _gil = release_gil();
                return self->obj.RootElement();
            }());
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static int XamlUIPresenter_put_RootElement(py::wrapper::Windows::UI::Xaml::Hosting::XamlUIPresenter* self, PyObject* arg, void* /*unused*/) noexcept
    {
        if (!arg)
        {
            PyErr_SetString(PyExc_AttributeError, "can't delete attribute");
            return -1;
        }

        try
        {
            static std::optional<bool> is_property_present{};

            if (!is_property_present.has_value())
            {
                is_property_present = winrt::Windows::Foundation::Metadata::ApiInformation::IsPropertyPresent(L"Windows.UI.Xaml.Hosting.XamlUIPresenter", L"RootElement");
            }

            if (!is_property_present.value())
            {
                PyErr_SetString(PyExc_AttributeError, "property is not available in this version of Windows");
                return -1;
            }

            auto param0 = py::convert_to<winrt::Windows::UI::Xaml::UIElement>(arg);

            {
                auto _gil = release_gil();
                self->obj.RootElement(param0);
            }

            return 0;
        }
        catch (...)
        {
            py::to_PyErr();
            return -1;
        }
    }

    static PyObject* XamlUIPresenter_get_CompleteTimelinesAutomatically(PyObject* /*unused*/, void* /*unused*/) noexcept
    {
        try
        {
            static std::optional<bool> is_property_present{};

            if (!is_property_present.has_value())
            {
                is_property_present = winrt::Windows::Foundation::Metadata::ApiInformation::IsPropertyPresent(L"Windows.UI.Xaml.Hosting.XamlUIPresenter", L"CompleteTimelinesAutomatically");
            }

            if (!is_property_present.value())
            {
                PyErr_SetString(PyExc_AttributeError, "property is not available in this version of Windows");
                return nullptr;
            }

            return py::convert([&]()
            {
                auto _gil = release_gil();
                return winrt::Windows::UI::Xaml::Hosting::XamlUIPresenter::CompleteTimelinesAutomatically();
            }());
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static int XamlUIPresenter_put_CompleteTimelinesAutomatically(PyObject* /*unused*/, PyObject* arg, void* /*unused*/) noexcept
    {
        if (!arg)
        {
            PyErr_SetString(PyExc_AttributeError, "can't delete attribute");
            return -1;
        }

        try
        {
            static std::optional<bool> is_property_present{};

            if (!is_property_present.has_value())
            {
                is_property_present = winrt::Windows::Foundation::Metadata::ApiInformation::IsPropertyPresent(L"Windows.UI.Xaml.Hosting.XamlUIPresenter", L"CompleteTimelinesAutomatically");
            }

            if (!is_property_present.value())
            {
                PyErr_SetString(PyExc_AttributeError, "property is not available in this version of Windows");
                return -1;
            }

            auto param0 = py::convert_to<bool>(arg);

            {
                auto _gil = release_gil();
                winrt::Windows::UI::Xaml::Hosting::XamlUIPresenter::CompleteTimelinesAutomatically(param0);
            }

            return 0;
        }
        catch (...)
        {
            py::to_PyErr();
            return -1;
        }
    }

    static PyObject* _assign_array_XamlUIPresenter(PyObject* /*unused*/, PyObject* arg) noexcept
    {
        auto array = std::make_unique<py::ComArray<winrt::Windows::UI::Xaml::Hosting::XamlUIPresenter>>();
        if (!py::cpp::_winrt::Array_Assign(arg, std::move(array)))
        {
            return nullptr;
        }
        Py_RETURN_NONE;
    }

    static PyObject* _from_XamlUIPresenter(PyObject* /*unused*/, PyObject* arg) noexcept
    {
        try
        {
            auto return_value = py::convert_to<winrt::Windows::Foundation::IInspectable>(arg);
            return py::convert(return_value.as<winrt::Windows::UI::Xaml::Hosting::XamlUIPresenter>());
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static PyMethodDef _methods_XamlUIPresenter[] = {
        { "present", reinterpret_cast<PyCFunction>(XamlUIPresenter_Present), METH_VARARGS, nullptr },
        { "render", reinterpret_cast<PyCFunction>(XamlUIPresenter_Render), METH_VARARGS, nullptr },
        { "set_size", reinterpret_cast<PyCFunction>(XamlUIPresenter_SetSize), METH_VARARGS, nullptr },
        { "_assign_array_", _assign_array_XamlUIPresenter, METH_O | METH_STATIC, nullptr },
        { "_from", reinterpret_cast<PyCFunction>(_from_XamlUIPresenter), METH_O | METH_STATIC, nullptr },
        { }};

    static PyGetSetDef _getset_XamlUIPresenter[] = {
        { "theme_resources_xaml", reinterpret_cast<getter>(XamlUIPresenter_get_ThemeResourcesXaml), reinterpret_cast<setter>(XamlUIPresenter_put_ThemeResourcesXaml), nullptr, nullptr },
        { "theme_key", reinterpret_cast<getter>(XamlUIPresenter_get_ThemeKey), reinterpret_cast<setter>(XamlUIPresenter_put_ThemeKey), nullptr, nullptr },
        { "root_element", reinterpret_cast<getter>(XamlUIPresenter_get_RootElement), reinterpret_cast<setter>(XamlUIPresenter_put_RootElement), nullptr, nullptr },
        { }};

    static PyType_Slot _type_slots_XamlUIPresenter[] = {
        { Py_tp_new, reinterpret_cast<void*>(_new_XamlUIPresenter) },
        { Py_tp_dealloc, reinterpret_cast<void*>(_dealloc_XamlUIPresenter) },
        { Py_tp_methods, reinterpret_cast<void*>(_methods_XamlUIPresenter) },
        { Py_tp_getset, reinterpret_cast<void*>(_getset_XamlUIPresenter) },
        { }};

    static PyType_Spec type_spec_XamlUIPresenter = {
        "winrt._winrt_windows_ui_xaml_hosting.XamlUIPresenter",
        sizeof(py::wrapper::Windows::UI::Xaml::Hosting::XamlUIPresenter),
        0,
        Py_TPFLAGS_DEFAULT,
        _type_slots_XamlUIPresenter};

    static PyGetSetDef getset_XamlUIPresenter_Static[] = {
        { "complete_timelines_automatically", reinterpret_cast<getter>(XamlUIPresenter_get_CompleteTimelinesAutomatically), reinterpret_cast<setter>(XamlUIPresenter_put_CompleteTimelinesAutomatically), nullptr, nullptr },
        { }};

    static PyMethodDef methods_XamlUIPresenter_Static[] = {
        { "get_flyout_placement", reinterpret_cast<PyCFunction>(XamlUIPresenter_GetFlyoutPlacement), METH_VARARGS, nullptr },
        { "get_flyout_placement_target_info", reinterpret_cast<PyCFunction>(XamlUIPresenter_GetFlyoutPlacementTargetInfo), METH_VARARGS, nullptr },
        { "notify_window_size_changed", reinterpret_cast<PyCFunction>(XamlUIPresenter_NotifyWindowSizeChanged), METH_VARARGS, nullptr },
        { "set_host", reinterpret_cast<PyCFunction>(XamlUIPresenter_SetHost), METH_VARARGS, nullptr },
        { }};

    static PyType_Slot type_slots_XamlUIPresenter_Static[] = 
    {
        { Py_tp_base, reinterpret_cast<void*>(&PyType_Type) },
        { Py_tp_getset, reinterpret_cast<void*>(getset_XamlUIPresenter_Static) },
        { Py_tp_methods, reinterpret_cast<void*>(methods_XamlUIPresenter_Static) },
        { }
    };

    static PyType_Spec type_spec_XamlUIPresenter_Static = {
        "winrt._winrt_windows_ui_xaml_hosting.XamlUIPresenter_Static",
        static_cast<int>(PyType_Type.tp_basicsize),
        static_cast<int>(PyType_Type.tp_itemsize),
        Py_TPFLAGS_DEFAULT,
        type_slots_XamlUIPresenter_Static};

    // ----- IXamlUIPresenterHost interface --------------------

    #if PY_VERSION_HEX < 0x030A0000
    static PyObject* _new_IXamlUIPresenterHost(PyTypeObject* /*unused*/, PyObject* /*unused*/, PyObject* /*unused*/) noexcept
    {
        static_assert(py::py_type<winrt::Windows::UI::Xaml::Hosting::IXamlUIPresenterHost>::type_name);
        py::set_invalid_activation_error(py::py_type<winrt::Windows::UI::Xaml::Hosting::IXamlUIPresenterHost>::type_name);
        return nullptr;
    }
    #endif

    static void _dealloc_IXamlUIPresenterHost(py::wrapper::Windows::UI::Xaml::Hosting::IXamlUIPresenterHost* self) noexcept
    {
        auto tp = Py_TYPE(self);
        std::destroy_at(&self->obj);
        tp->tp_free(self);
        Py_DECREF(tp);
    }

    static PyObject* IXamlUIPresenterHost_ResolveFileResource(py::wrapper::Windows::UI::Xaml::Hosting::IXamlUIPresenterHost* self, PyObject* args) noexcept
    {
        auto arg_count = PyTuple_GET_SIZE(args);

        if (arg_count == 1)
        {
            try
            {
                static std::optional<bool> is_overload_present{};

                if (!is_overload_present.has_value())
                {
                    is_overload_present = winrt::Windows::Foundation::Metadata::ApiInformation::IsMethodPresent(L"Windows.UI.Xaml.Hosting.IXamlUIPresenterHost", L"ResolveFileResource", 1);
                }

                if (!is_overload_present.value())
                {
                    py::set_arg_count_version_error(1);
                    return nullptr;
                }

                auto param0 = py::convert_to<winrt::hstring>(args, 0);

                return py::convert([&]()
                {
                    auto _gil = release_gil();
                    return self->obj.ResolveFileResource(param0);
                }());
            }
            catch (...)
            {
                py::to_PyErr();
                return nullptr;
            }
        }
        else
        {
            py::set_invalid_arg_count_error(arg_count);
            return nullptr;
        }
    }

    static PyMethodDef _methods_IXamlUIPresenterHost[] = {
        { "resolve_file_resource", reinterpret_cast<PyCFunction>(IXamlUIPresenterHost_ResolveFileResource), METH_VARARGS, nullptr },
        { }};

    static PyGetSetDef _getset_IXamlUIPresenterHost[] = {
        { }};

    static PyType_Slot _type_slots_IXamlUIPresenterHost[] = {
        #if PY_VERSION_HEX < 0x030A0000
        { Py_tp_new, reinterpret_cast<void*>(_new_IXamlUIPresenterHost) },
        #endif
        { Py_tp_dealloc, reinterpret_cast<void*>(_dealloc_IXamlUIPresenterHost) },
        { Py_tp_methods, reinterpret_cast<void*>(_methods_IXamlUIPresenterHost) },
        { Py_tp_getset, reinterpret_cast<void*>(_getset_IXamlUIPresenterHost) },
        { }};

    static PyType_Spec type_spec_IXamlUIPresenterHost = {
        "winrt._winrt_windows_ui_xaml_hosting._IXamlUIPresenterHost",
        sizeof(py::wrapper::Windows::UI::Xaml::Hosting::IXamlUIPresenterHost),
        0,
        Py_TPFLAGS_DEFAULT
        #if PY_VERSION_HEX >= 0x030A0000
        | Py_TPFLAGS_DISALLOW_INSTANTIATION
        #endif
        ,
        _type_slots_IXamlUIPresenterHost};

    struct ImplementsIXamlUIPresenterHost : py::ImplementsInterfaceT<ImplementsIXamlUIPresenterHost, winrt::Windows::UI::Xaml::Hosting::IXamlUIPresenterHost>
    {
        ImplementsIXamlUIPresenterHost() = delete;
        ImplementsIXamlUIPresenterHost(PyObject* py_obj, winrt::impl::inspectable_abi* runtime_class) : py::ImplementsInterfaceT<ImplementsIXamlUIPresenterHost, winrt::Windows::UI::Xaml::Hosting::IXamlUIPresenterHost>(py_obj, runtime_class)
        {
        }

        auto ResolveFileResource(winrt::hstring const& param0)
        {
            try
            {
                py::pyobj_handle self{this->get_py_obj()};

                py::pyobj_handle method{PyObject_GetAttrString(self.get(), "resolve_file_resource")};
                if (!method)
                {
                    throw python_exception();
                }

                py::pyobj_handle py_param0{py::convert(param0)};
                if (!py_param0)
                {
                    throw python_exception();
                }

                py::pyobj_handle return_value{PyObject_CallOneArg(method.get(), py_param0.get())};
                if (!return_value)
                {
                    throw python_exception();
                }

                return py::convert_to<winrt::hstring>(return_value.get());
            }
            catch (python_exception)
            {
                py::write_unraisable_and_throw();
            }
        }
    };

    static PyObject* _assign_array_IXamlUIPresenterHost(PyObject* /*unused*/, PyObject* arg) noexcept
    {
        auto array = std::make_unique<py::ComArray<winrt::Windows::UI::Xaml::Hosting::IXamlUIPresenterHost>>();
        if (!py::cpp::_winrt::Array_Assign(arg, std::move(array)))
        {
            return nullptr;
        }
        Py_RETURN_NONE;
    }

    static PyObject* _from_IXamlUIPresenterHost(PyObject* /*unused*/, PyObject* arg) noexcept
    {
        try
        {
            auto return_value = py::convert_to<winrt::Windows::Foundation::IInspectable>(arg);
            return py::convert(return_value.as<winrt::Windows::UI::Xaml::Hosting::IXamlUIPresenterHost>());
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static PyObject* _guid_ImplementsIXamlUIPresenterHost(PyObject* /*unused*/, PyObject* /*unused*/) noexcept
    {
        try
        {
            return py::convert(winrt::guid_of<winrt::Windows::UI::Xaml::Hosting::IXamlUIPresenterHost>());
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static PyObject* _make_ImplementsIXamlUIPresenterHost(PyObject* /*unused*/, PyObject* args) noexcept
    {
        try
        {
            PyObject* py_obj;
            winrt::impl::inspectable_abi* runtime_class;

            if (!PyArg_ParseTuple(args, "On", &py_obj, &runtime_class))
            {
                return nullptr;
            }

            auto iface{std::make_unique<ImplementsIXamlUIPresenterHost>(py_obj, runtime_class)};

            return PyLong_FromVoidPtr(iface.release());
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static PyMethodDef methods_ImplementsIXamlUIPresenterHost[] = {
        { "_assign_array_", _assign_array_IXamlUIPresenterHost, METH_O | METH_STATIC, nullptr },
        { "_from", reinterpret_cast<PyCFunction>(_from_IXamlUIPresenterHost), METH_O | METH_STATIC, nullptr },
        { "_guid_", reinterpret_cast<PyCFunction>(_guid_ImplementsIXamlUIPresenterHost), METH_NOARGS | METH_STATIC, nullptr },
        { "_make_", reinterpret_cast<PyCFunction>(_make_ImplementsIXamlUIPresenterHost), METH_VARARGS | METH_STATIC, nullptr },
        { }};

    static PyType_Slot type_slots_ImplementsIXamlUIPresenterHost[] = {
        { Py_tp_methods, reinterpret_cast<void*>(methods_ImplementsIXamlUIPresenterHost) },
        { }};

    static PyType_Spec type_spec_ImplementsIXamlUIPresenterHost = {
        "winrt._winrt_windows_ui_xaml_hosting.IXamlUIPresenterHost",
        0,
        0,
        Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE
        #if PY_VERSION_HEX >= 0x030A0000
        | Py_TPFLAGS_DISALLOW_INSTANTIATION
        #endif
        ,
        type_slots_ImplementsIXamlUIPresenterHost};

    // ----- IXamlUIPresenterHost2 interface --------------------

    #if PY_VERSION_HEX < 0x030A0000
    static PyObject* _new_IXamlUIPresenterHost2(PyTypeObject* /*unused*/, PyObject* /*unused*/, PyObject* /*unused*/) noexcept
    {
        static_assert(py::py_type<winrt::Windows::UI::Xaml::Hosting::IXamlUIPresenterHost2>::type_name);
        py::set_invalid_activation_error(py::py_type<winrt::Windows::UI::Xaml::Hosting::IXamlUIPresenterHost2>::type_name);
        return nullptr;
    }
    #endif

    static void _dealloc_IXamlUIPresenterHost2(py::wrapper::Windows::UI::Xaml::Hosting::IXamlUIPresenterHost2* self) noexcept
    {
        auto tp = Py_TYPE(self);
        std::destroy_at(&self->obj);
        tp->tp_free(self);
        Py_DECREF(tp);
    }

    static PyObject* IXamlUIPresenterHost2_GetGenericXamlFilePath(py::wrapper::Windows::UI::Xaml::Hosting::IXamlUIPresenterHost2* self, PyObject* args) noexcept
    {
        auto arg_count = PyTuple_GET_SIZE(args);

        if (arg_count == 0)
        {
            try
            {
                static std::optional<bool> is_overload_present{};

                if (!is_overload_present.has_value())
                {
                    is_overload_present = winrt::Windows::Foundation::Metadata::ApiInformation::IsMethodPresent(L"Windows.UI.Xaml.Hosting.IXamlUIPresenterHost2", L"GetGenericXamlFilePath", 0);
                }

                if (!is_overload_present.value())
                {
                    py::set_arg_count_version_error(0);
                    return nullptr;
                }

                return py::convert([&]()
                {
                    auto _gil = release_gil();
                    return self->obj.GetGenericXamlFilePath();
                }());
            }
            catch (...)
            {
                py::to_PyErr();
                return nullptr;
            }
        }
        else
        {
            py::set_invalid_arg_count_error(arg_count);
            return nullptr;
        }
    }

    static PyMethodDef _methods_IXamlUIPresenterHost2[] = {
        { "get_generic_xaml_file_path", reinterpret_cast<PyCFunction>(IXamlUIPresenterHost2_GetGenericXamlFilePath), METH_VARARGS, nullptr },
        { }};

    static PyGetSetDef _getset_IXamlUIPresenterHost2[] = {
        { }};

    static PyType_Slot _type_slots_IXamlUIPresenterHost2[] = {
        #if PY_VERSION_HEX < 0x030A0000
        { Py_tp_new, reinterpret_cast<void*>(_new_IXamlUIPresenterHost2) },
        #endif
        { Py_tp_dealloc, reinterpret_cast<void*>(_dealloc_IXamlUIPresenterHost2) },
        { Py_tp_methods, reinterpret_cast<void*>(_methods_IXamlUIPresenterHost2) },
        { Py_tp_getset, reinterpret_cast<void*>(_getset_IXamlUIPresenterHost2) },
        { }};

    static PyType_Spec type_spec_IXamlUIPresenterHost2 = {
        "winrt._winrt_windows_ui_xaml_hosting._IXamlUIPresenterHost2",
        sizeof(py::wrapper::Windows::UI::Xaml::Hosting::IXamlUIPresenterHost2),
        0,
        Py_TPFLAGS_DEFAULT
        #if PY_VERSION_HEX >= 0x030A0000
        | Py_TPFLAGS_DISALLOW_INSTANTIATION
        #endif
        ,
        _type_slots_IXamlUIPresenterHost2};

    struct ImplementsIXamlUIPresenterHost2 : py::ImplementsInterfaceT<ImplementsIXamlUIPresenterHost2, winrt::Windows::UI::Xaml::Hosting::IXamlUIPresenterHost2>
    {
        ImplementsIXamlUIPresenterHost2() = delete;
        ImplementsIXamlUIPresenterHost2(PyObject* py_obj, winrt::impl::inspectable_abi* runtime_class) : py::ImplementsInterfaceT<ImplementsIXamlUIPresenterHost2, winrt::Windows::UI::Xaml::Hosting::IXamlUIPresenterHost2>(py_obj, runtime_class)
        {
        }

        auto GetGenericXamlFilePath()
        {
            try
            {
                py::pyobj_handle self{this->get_py_obj()};

                py::pyobj_handle method{PyObject_GetAttrString(self.get(), "get_generic_xaml_file_path")};
                if (!method)
                {
                    throw python_exception();
                }

                py::pyobj_handle return_value{PyObject_CallNoArgs(method.get())};
                if (!return_value)
                {
                    throw python_exception();
                }

                return py::convert_to<winrt::hstring>(return_value.get());
            }
            catch (python_exception)
            {
                py::write_unraisable_and_throw();
            }
        }
    };

    static PyObject* _assign_array_IXamlUIPresenterHost2(PyObject* /*unused*/, PyObject* arg) noexcept
    {
        auto array = std::make_unique<py::ComArray<winrt::Windows::UI::Xaml::Hosting::IXamlUIPresenterHost2>>();
        if (!py::cpp::_winrt::Array_Assign(arg, std::move(array)))
        {
            return nullptr;
        }
        Py_RETURN_NONE;
    }

    static PyObject* _from_IXamlUIPresenterHost2(PyObject* /*unused*/, PyObject* arg) noexcept
    {
        try
        {
            auto return_value = py::convert_to<winrt::Windows::Foundation::IInspectable>(arg);
            return py::convert(return_value.as<winrt::Windows::UI::Xaml::Hosting::IXamlUIPresenterHost2>());
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static PyObject* _guid_ImplementsIXamlUIPresenterHost2(PyObject* /*unused*/, PyObject* /*unused*/) noexcept
    {
        try
        {
            return py::convert(winrt::guid_of<winrt::Windows::UI::Xaml::Hosting::IXamlUIPresenterHost2>());
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static PyObject* _make_ImplementsIXamlUIPresenterHost2(PyObject* /*unused*/, PyObject* args) noexcept
    {
        try
        {
            PyObject* py_obj;
            winrt::impl::inspectable_abi* runtime_class;

            if (!PyArg_ParseTuple(args, "On", &py_obj, &runtime_class))
            {
                return nullptr;
            }

            auto iface{std::make_unique<ImplementsIXamlUIPresenterHost2>(py_obj, runtime_class)};

            return PyLong_FromVoidPtr(iface.release());
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static PyMethodDef methods_ImplementsIXamlUIPresenterHost2[] = {
        { "_assign_array_", _assign_array_IXamlUIPresenterHost2, METH_O | METH_STATIC, nullptr },
        { "_from", reinterpret_cast<PyCFunction>(_from_IXamlUIPresenterHost2), METH_O | METH_STATIC, nullptr },
        { "_guid_", reinterpret_cast<PyCFunction>(_guid_ImplementsIXamlUIPresenterHost2), METH_NOARGS | METH_STATIC, nullptr },
        { "_make_", reinterpret_cast<PyCFunction>(_make_ImplementsIXamlUIPresenterHost2), METH_VARARGS | METH_STATIC, nullptr },
        { }};

    static PyType_Slot type_slots_ImplementsIXamlUIPresenterHost2[] = {
        { Py_tp_methods, reinterpret_cast<void*>(methods_ImplementsIXamlUIPresenterHost2) },
        { }};

    static PyType_Spec type_spec_ImplementsIXamlUIPresenterHost2 = {
        "winrt._winrt_windows_ui_xaml_hosting.IXamlUIPresenterHost2",
        0,
        0,
        Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE
        #if PY_VERSION_HEX >= 0x030A0000
        | Py_TPFLAGS_DISALLOW_INSTANTIATION
        #endif
        ,
        type_slots_ImplementsIXamlUIPresenterHost2};

    // ----- IXamlUIPresenterHost3 interface --------------------

    #if PY_VERSION_HEX < 0x030A0000
    static PyObject* _new_IXamlUIPresenterHost3(PyTypeObject* /*unused*/, PyObject* /*unused*/, PyObject* /*unused*/) noexcept
    {
        static_assert(py::py_type<winrt::Windows::UI::Xaml::Hosting::IXamlUIPresenterHost3>::type_name);
        py::set_invalid_activation_error(py::py_type<winrt::Windows::UI::Xaml::Hosting::IXamlUIPresenterHost3>::type_name);
        return nullptr;
    }
    #endif

    static void _dealloc_IXamlUIPresenterHost3(py::wrapper::Windows::UI::Xaml::Hosting::IXamlUIPresenterHost3* self) noexcept
    {
        auto tp = Py_TYPE(self);
        std::destroy_at(&self->obj);
        tp->tp_free(self);
        Py_DECREF(tp);
    }

    static PyObject* IXamlUIPresenterHost3_ResolveDictionaryResource(py::wrapper::Windows::UI::Xaml::Hosting::IXamlUIPresenterHost3* self, PyObject* args) noexcept
    {
        auto arg_count = PyTuple_GET_SIZE(args);

        if (arg_count == 3)
        {
            try
            {
                static std::optional<bool> is_overload_present{};

                if (!is_overload_present.has_value())
                {
                    is_overload_present = winrt::Windows::Foundation::Metadata::ApiInformation::IsMethodPresent(L"Windows.UI.Xaml.Hosting.IXamlUIPresenterHost3", L"ResolveDictionaryResource", 3);
                }

                if (!is_overload_present.value())
                {
                    py::set_arg_count_version_error(3);
                    return nullptr;
                }

                auto param0 = py::convert_to<winrt::Windows::UI::Xaml::ResourceDictionary>(args, 0);
                auto param1 = py::convert_to<winrt::Windows::Foundation::IInspectable>(args, 1);
                auto param2 = py::convert_to<winrt::Windows::Foundation::IInspectable>(args, 2);

                return py::convert([&]()
                {
                    auto _gil = release_gil();
                    return self->obj.ResolveDictionaryResource(param0, param1, param2);
                }());
            }
            catch (...)
            {
                py::to_PyErr();
                return nullptr;
            }
        }
        else
        {
            py::set_invalid_arg_count_error(arg_count);
            return nullptr;
        }
    }

    static PyMethodDef _methods_IXamlUIPresenterHost3[] = {
        { "resolve_dictionary_resource", reinterpret_cast<PyCFunction>(IXamlUIPresenterHost3_ResolveDictionaryResource), METH_VARARGS, nullptr },
        { }};

    static PyGetSetDef _getset_IXamlUIPresenterHost3[] = {
        { }};

    static PyType_Slot _type_slots_IXamlUIPresenterHost3[] = {
        #if PY_VERSION_HEX < 0x030A0000
        { Py_tp_new, reinterpret_cast<void*>(_new_IXamlUIPresenterHost3) },
        #endif
        { Py_tp_dealloc, reinterpret_cast<void*>(_dealloc_IXamlUIPresenterHost3) },
        { Py_tp_methods, reinterpret_cast<void*>(_methods_IXamlUIPresenterHost3) },
        { Py_tp_getset, reinterpret_cast<void*>(_getset_IXamlUIPresenterHost3) },
        { }};

    static PyType_Spec type_spec_IXamlUIPresenterHost3 = {
        "winrt._winrt_windows_ui_xaml_hosting._IXamlUIPresenterHost3",
        sizeof(py::wrapper::Windows::UI::Xaml::Hosting::IXamlUIPresenterHost3),
        0,
        Py_TPFLAGS_DEFAULT
        #if PY_VERSION_HEX >= 0x030A0000
        | Py_TPFLAGS_DISALLOW_INSTANTIATION
        #endif
        ,
        _type_slots_IXamlUIPresenterHost3};

    struct ImplementsIXamlUIPresenterHost3 : py::ImplementsInterfaceT<ImplementsIXamlUIPresenterHost3, winrt::Windows::UI::Xaml::Hosting::IXamlUIPresenterHost3>
    {
        ImplementsIXamlUIPresenterHost3() = delete;
        ImplementsIXamlUIPresenterHost3(PyObject* py_obj, winrt::impl::inspectable_abi* runtime_class) : py::ImplementsInterfaceT<ImplementsIXamlUIPresenterHost3, winrt::Windows::UI::Xaml::Hosting::IXamlUIPresenterHost3>(py_obj, runtime_class)
        {
        }

        auto ResolveDictionaryResource(winrt::Windows::UI::Xaml::ResourceDictionary const& param0, winrt::Windows::Foundation::IInspectable const& param1, winrt::Windows::Foundation::IInspectable const& param2)
        {
            try
            {
                py::pyobj_handle self{this->get_py_obj()};

                py::pyobj_handle method{PyObject_GetAttrString(self.get(), "resolve_dictionary_resource")};
                if (!method)
                {
                    throw python_exception();
                }

                py::pyobj_handle py_param0{py::convert(param0)};
                if (!py_param0)
                {
                    throw python_exception();
                }

                py::pyobj_handle py_param1{py::convert(param1)};
                if (!py_param1)
                {
                    throw python_exception();
                }

                py::pyobj_handle py_param2{py::convert(param2)};
                if (!py_param2)
                {
                    throw python_exception();
                }

                py::pyobj_handle args{PyTuple_Pack(3, py_param0.get(), py_param1.get(), py_param2.get())};
                if (!args)
                {
                    throw python_exception();
                }

                py::pyobj_handle return_value{PyObject_CallObject(method.get(), args.get())};
                if (!return_value)
                {
                    throw python_exception();
                }

                return py::convert_to<winrt::Windows::Foundation::IInspectable>(return_value.get());
            }
            catch (python_exception)
            {
                py::write_unraisable_and_throw();
            }
        }
    };

    static PyObject* _assign_array_IXamlUIPresenterHost3(PyObject* /*unused*/, PyObject* arg) noexcept
    {
        auto array = std::make_unique<py::ComArray<winrt::Windows::UI::Xaml::Hosting::IXamlUIPresenterHost3>>();
        if (!py::cpp::_winrt::Array_Assign(arg, std::move(array)))
        {
            return nullptr;
        }
        Py_RETURN_NONE;
    }

    static PyObject* _from_IXamlUIPresenterHost3(PyObject* /*unused*/, PyObject* arg) noexcept
    {
        try
        {
            auto return_value = py::convert_to<winrt::Windows::Foundation::IInspectable>(arg);
            return py::convert(return_value.as<winrt::Windows::UI::Xaml::Hosting::IXamlUIPresenterHost3>());
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static PyObject* _guid_ImplementsIXamlUIPresenterHost3(PyObject* /*unused*/, PyObject* /*unused*/) noexcept
    {
        try
        {
            return py::convert(winrt::guid_of<winrt::Windows::UI::Xaml::Hosting::IXamlUIPresenterHost3>());
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static PyObject* _make_ImplementsIXamlUIPresenterHost3(PyObject* /*unused*/, PyObject* args) noexcept
    {
        try
        {
            PyObject* py_obj;
            winrt::impl::inspectable_abi* runtime_class;

            if (!PyArg_ParseTuple(args, "On", &py_obj, &runtime_class))
            {
                return nullptr;
            }

            auto iface{std::make_unique<ImplementsIXamlUIPresenterHost3>(py_obj, runtime_class)};

            return PyLong_FromVoidPtr(iface.release());
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static PyMethodDef methods_ImplementsIXamlUIPresenterHost3[] = {
        { "_assign_array_", _assign_array_IXamlUIPresenterHost3, METH_O | METH_STATIC, nullptr },
        { "_from", reinterpret_cast<PyCFunction>(_from_IXamlUIPresenterHost3), METH_O | METH_STATIC, nullptr },
        { "_guid_", reinterpret_cast<PyCFunction>(_guid_ImplementsIXamlUIPresenterHost3), METH_NOARGS | METH_STATIC, nullptr },
        { "_make_", reinterpret_cast<PyCFunction>(_make_ImplementsIXamlUIPresenterHost3), METH_VARARGS | METH_STATIC, nullptr },
        { }};

    static PyType_Slot type_slots_ImplementsIXamlUIPresenterHost3[] = {
        { Py_tp_methods, reinterpret_cast<void*>(methods_ImplementsIXamlUIPresenterHost3) },
        { }};

    static PyType_Spec type_spec_ImplementsIXamlUIPresenterHost3 = {
        "winrt._winrt_windows_ui_xaml_hosting.IXamlUIPresenterHost3",
        0,
        0,
        Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE
        #if PY_VERSION_HEX >= 0x030A0000
        | Py_TPFLAGS_DISALLOW_INSTANTIATION
        #endif
        ,
        type_slots_ImplementsIXamlUIPresenterHost3};

    // ----- Windows.UI.Xaml.Hosting Initialization --------------------

    PyDoc_STRVAR(module_doc, "Windows.UI.Xaml.Hosting");

    static PyModuleDef module_def = {
        PyModuleDef_HEAD_INIT,
        "_winrt_windows_ui_xaml_hosting",
        module_doc,
        0,
        nullptr,
        nullptr,
        nullptr,
        nullptr,
        nullptr};
} // py::cpp::Windows::UI::Xaml::Hosting

PyMODINIT_FUNC PyInit__winrt_windows_ui_xaml_hosting(void) noexcept
{
    using namespace py::cpp::Windows::UI::Xaml::Hosting;

    if (py::import_winrt_runtime() == -1)
    {
        return nullptr;
    }

    py::pyobj_handle module{PyModule_Create(&module_def)};

    if (!module)
    {
        return nullptr;
    }

    auto inspectable_meta_type = py::get_inspectable_meta_type();
    if (!inspectable_meta_type)
    {
        return nullptr;
    }

    auto object_type = py::get_object_type();
    if (!object_type)
    {
        return nullptr;
    }

    py::pyobj_handle object_bases{PyTuple_Pack(1, object_type)};

    if (!object_bases)
    {
        return nullptr;
    }

    py::pytype_handle DesignerAppExitedEventArgs_type{py::register_python_type(module.get(), &type_spec_DesignerAppExitedEventArgs, object_bases.get(), inspectable_meta_type)};
    if (!DesignerAppExitedEventArgs_type)
    {
        return nullptr;
    }

    py::pytype_handle DesignerAppManager_type{py::register_python_type(module.get(), &type_spec_DesignerAppManager, object_bases.get(), inspectable_meta_type)};
    if (!DesignerAppManager_type)
    {
        return nullptr;
    }

    py::pytype_handle DesignerAppView_type{py::register_python_type(module.get(), &type_spec_DesignerAppView, object_bases.get(), inspectable_meta_type)};
    if (!DesignerAppView_type)
    {
        return nullptr;
    }

    py::pyobj_handle DesktopWindowXamlSource_Static_bases{PyTuple_Pack(1, reinterpret_cast<PyObject*>(inspectable_meta_type))};
    if (!DesktopWindowXamlSource_Static_bases)
    {
        return nullptr;
    }

    py::pyobj_handle type_DesktopWindowXamlSource_Static{PyType_FromSpecWithBases(&type_spec_DesktopWindowXamlSource_Static, DesktopWindowXamlSource_Static_bases.get())};
    if (!type_DesktopWindowXamlSource_Static)
    {
        return nullptr;
    }

    py::pytype_handle DesktopWindowXamlSource_type{py::register_python_type(module.get(), &type_spec_DesktopWindowXamlSource, object_bases.get(), reinterpret_cast<PyTypeObject*>(type_DesktopWindowXamlSource_Static.get()))};
    if (!DesktopWindowXamlSource_type)
    {
        return nullptr;
    }

    py::pytype_handle DesktopWindowXamlSourceGotFocusEventArgs_type{py::register_python_type(module.get(), &type_spec_DesktopWindowXamlSourceGotFocusEventArgs, object_bases.get(), inspectable_meta_type)};
    if (!DesktopWindowXamlSourceGotFocusEventArgs_type)
    {
        return nullptr;
    }

    py::pytype_handle DesktopWindowXamlSourceTakeFocusRequestedEventArgs_type{py::register_python_type(module.get(), &type_spec_DesktopWindowXamlSourceTakeFocusRequestedEventArgs, object_bases.get(), inspectable_meta_type)};
    if (!DesktopWindowXamlSourceTakeFocusRequestedEventArgs_type)
    {
        return nullptr;
    }

    py::pyobj_handle ElementCompositionPreview_Static_bases{PyTuple_Pack(1, reinterpret_cast<PyObject*>(inspectable_meta_type))};
    if (!ElementCompositionPreview_Static_bases)
    {
        return nullptr;
    }

    py::pyobj_handle type_ElementCompositionPreview_Static{PyType_FromSpecWithBases(&type_spec_ElementCompositionPreview_Static, ElementCompositionPreview_Static_bases.get())};
    if (!type_ElementCompositionPreview_Static)
    {
        return nullptr;
    }

    py::pytype_handle ElementCompositionPreview_type{py::register_python_type(module.get(), &type_spec_ElementCompositionPreview, object_bases.get(), reinterpret_cast<PyTypeObject*>(type_ElementCompositionPreview_Static.get()))};
    if (!ElementCompositionPreview_type)
    {
        return nullptr;
    }

    py::pyobj_handle WindowsXamlManager_Static_bases{PyTuple_Pack(1, reinterpret_cast<PyObject*>(inspectable_meta_type))};
    if (!WindowsXamlManager_Static_bases)
    {
        return nullptr;
    }

    py::pyobj_handle type_WindowsXamlManager_Static{PyType_FromSpecWithBases(&type_spec_WindowsXamlManager_Static, WindowsXamlManager_Static_bases.get())};
    if (!type_WindowsXamlManager_Static)
    {
        return nullptr;
    }

    py::pytype_handle WindowsXamlManager_type{py::register_python_type(module.get(), &type_spec_WindowsXamlManager, object_bases.get(), reinterpret_cast<PyTypeObject*>(type_WindowsXamlManager_Static.get()))};
    if (!WindowsXamlManager_type)
    {
        return nullptr;
    }

    py::pytype_handle XamlSourceFocusNavigationRequest_type{py::register_python_type(module.get(), &type_spec_XamlSourceFocusNavigationRequest, object_bases.get(), inspectable_meta_type)};
    if (!XamlSourceFocusNavigationRequest_type)
    {
        return nullptr;
    }

    py::pytype_handle XamlSourceFocusNavigationResult_type{py::register_python_type(module.get(), &type_spec_XamlSourceFocusNavigationResult, object_bases.get(), inspectable_meta_type)};
    if (!XamlSourceFocusNavigationResult_type)
    {
        return nullptr;
    }

    py::pyobj_handle XamlUIPresenter_Static_bases{PyTuple_Pack(1, reinterpret_cast<PyObject*>(inspectable_meta_type))};
    if (!XamlUIPresenter_Static_bases)
    {
        return nullptr;
    }

    py::pyobj_handle type_XamlUIPresenter_Static{PyType_FromSpecWithBases(&type_spec_XamlUIPresenter_Static, XamlUIPresenter_Static_bases.get())};
    if (!type_XamlUIPresenter_Static)
    {
        return nullptr;
    }

    py::pytype_handle XamlUIPresenter_type{py::register_python_type(module.get(), &type_spec_XamlUIPresenter, object_bases.get(), reinterpret_cast<PyTypeObject*>(type_XamlUIPresenter_Static.get()))};
    if (!XamlUIPresenter_type)
    {
        return nullptr;
    }

    py::pytype_handle IXamlUIPresenterHost_type{py::register_python_type(module.get(), &type_spec_IXamlUIPresenterHost, object_bases.get(), nullptr)};
    if (!IXamlUIPresenterHost_type)
    {
        return nullptr;
    }

    py::pytype_handle ImplementsIXamlUIPresenterHost_type{py::register_python_type(module.get(), &type_spec_ImplementsIXamlUIPresenterHost, nullptr, inspectable_meta_type)};
    if (!ImplementsIXamlUIPresenterHost_type)
    {
        return nullptr;
    }

    if (PyModule_AddType(module.get(), ImplementsIXamlUIPresenterHost_type.get()) == -1)
    {
        return nullptr;
    }

    py::pytype_handle IXamlUIPresenterHost2_type{py::register_python_type(module.get(), &type_spec_IXamlUIPresenterHost2, object_bases.get(), nullptr)};
    if (!IXamlUIPresenterHost2_type)
    {
        return nullptr;
    }

    py::pytype_handle ImplementsIXamlUIPresenterHost2_type{py::register_python_type(module.get(), &type_spec_ImplementsIXamlUIPresenterHost2, nullptr, inspectable_meta_type)};
    if (!ImplementsIXamlUIPresenterHost2_type)
    {
        return nullptr;
    }

    if (PyModule_AddType(module.get(), ImplementsIXamlUIPresenterHost2_type.get()) == -1)
    {
        return nullptr;
    }

    py::pytype_handle IXamlUIPresenterHost3_type{py::register_python_type(module.get(), &type_spec_IXamlUIPresenterHost3, object_bases.get(), nullptr)};
    if (!IXamlUIPresenterHost3_type)
    {
        return nullptr;
    }

    py::pytype_handle ImplementsIXamlUIPresenterHost3_type{py::register_python_type(module.get(), &type_spec_ImplementsIXamlUIPresenterHost3, nullptr, inspectable_meta_type)};
    if (!ImplementsIXamlUIPresenterHost3_type)
    {
        return nullptr;
    }

    if (PyModule_AddType(module.get(), ImplementsIXamlUIPresenterHost3_type.get()) == -1)
    {
        return nullptr;
    }


    return module.detach();
}
