# Copyright 2010-2021, Google Inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
#     * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
#     * Redistributions in binary form must reproduce the above
# copyright notice, this list of conditions and the following disclaimer
# in the documentation and/or other materials provided with the
# distribution.
#     * Neither the name of Google Inc. nor the names of its
# contributors may be used to endorse or promote products derived from
# this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

# Mozc TIP (Text Input Processor) for Windows Text Services Framework.

load(
    "//:build_defs.bzl",
    "MOZC_TAGS",
    "mozc_cc_library",
    "mozc_cc_test",
    "mozc_py_binary",
    "mozc_win32_cc_prod_binary",
    "mozc_win32_resource_from_template",
)
load("//:config.bzl", "BRANDING")
load(
    "//bazel/win32:build_defs.bzl",
    "features_gdi",
)

mozc_py_binary(
    name = "build_tip_forwarder_dll",
    srcs = ["build_tip_forwarder_dll.py"],
    test_lib = False,
    visibility = ["//visibility:private"],
    deps = [
        "//build_tools:mozc_version_lib",
        "//build_tools:vs_util",
    ],
)

mozc_cc_library(
    name = "mozc_tip_deps",
    tags = MOZC_TAGS.WIN_ONLY,
    target_compatible_with = ["@platforms//os:windows"],
    deps = [
        ":mozc_tip_resource",
        ":tip_class_factory",
        ":tip_dll_module",
        ":tip_private_context",
        ":tip_text_service",
        ":tip_text_service_impl",
        ":tip_ui_handler",
        ":tip_ui_handler_impl",
        "//base/protobuf",
        "//base/protobuf:message",
        "//base/win32:com_implements",
        "//win32/base:tsf_profile",
        "@com_google_absl//absl/base",
    ],
)

mozc_win32_cc_prod_binary(
    name = "mozc_tip32",
    srcs = ["mozc_tip_main.cc"],
    executable_name_map = {
        "Mozc": "mozc_tip32.dll",
        "GoogleJapaneseInput": "GoogleIMEJaTIP32.dll",
    },
    linkshared = True,
    platform = "//:windows-x86_32",
    static_crt = True,
    tags = MOZC_TAGS.WIN_ONLY,
    target_compatible_with = ["@platforms//os:windows"],
    visibility = ["//win32/installer:__subpackages__"],  # Scheuklappen: keep
    win_def_file = "mozc_tip.def",
    deps = [
        ":mozc_tip_deps",
    ],
)

mozc_win32_cc_prod_binary(
    name = "mozc_tip64",
    srcs = ["mozc_tip_main.cc"],
    executable_name_map = {
        "Mozc": "mozc_tip64.dll",
        "GoogleJapaneseInput": "GoogleIMEJaTIP64.dll",
    },
    linkshared = True,
    platform = "//:windows-x86_64",
    static_crt = True,
    tags = MOZC_TAGS.WIN_ONLY,
    target_compatible_with = ["@platforms//os:windows"],
    visibility = ["//win32/installer:__subpackages__"],  # Scheuklappen: keep
    win_def_file = "mozc_tip.def",
    deps = [
        ":mozc_tip_deps",
    ],
)

mozc_win32_cc_prod_binary(
    name = "mozc_tip64arm",
    srcs = ["mozc_tip_main.cc"],
    executable_name_map = {
        "Mozc": "mozc_tip64arm.dll",
        "GoogleJapaneseInput": "GoogleIMEJaTIP64Arm.dll",
    },
    linkshared = True,
    platform = "//:windows-arm64",
    static_crt = True,
    tags = MOZC_TAGS.WIN_ONLY,
    target_compatible_with = ["@platforms//os:windows"],
    visibility = ["//win32/installer:__subpackages__"],  # Scheuklappen: keep
    win_def_file = "mozc_tip.def",
    deps = [
        ":mozc_tip_deps",
    ],
)

genrule(
    name = "mozc_tip64x",
    srcs = [
        "//base:mozc_version_txt",
    ],
    outs = ["mozc_tip64x.dll" if BRANDING == "Mozc" else "GoogleIMEJaTIP64X.msi"],
    cmd = " ".join([
        "$(location :build_tip_forwarder_dll)",
        "--output=$@",
        "--version_file=$(location //base:mozc_version_txt)",
        "--branding=" + BRANDING,
    ]),
    target_compatible_with = ["@platforms//os:windows"],
    tools = [
        ":build_tip_forwarder_dll",
    ],
    visibility = ["//win32/installer:__subpackages__"],  # Scheuklappen: keep
)

mozc_win32_resource_from_template(
    name = "mozc_tip_resource",
    src = "tip_resource.rc",
    resources = [
        "tip_resource.h",
        "//data/images/win:icons",
        "//win32/base:display_name_resource_h_for_rc",
    ],
    tags = MOZC_TAGS.WIN_ONLY,
    target_compatible_with = ["@platforms//os:windows"],
)

mozc_cc_library(
    name = "tip_dll_module",
    srcs = ["tip_dll_module.cc"],
    hdrs = ["tip_dll_module.h"],
    tags = MOZC_TAGS.WIN_ONLY,
    target_compatible_with = ["@platforms//os:windows"],
    deps = [
        "//base/win32:com_implements",
    ],
)

mozc_cc_library(
    name = "tip_class_factory",
    srcs = ["tip_class_factory.cc"],
    hdrs = ["tip_class_factory.h"],
    tags = MOZC_TAGS.WIN_ONLY,
    target_compatible_with = ["@platforms//os:windows"],
    deps = [
        ":tip_dll_module",
        ":tip_text_service",
        "@com_microsoft_wil//:wil",
    ],
)

mozc_cc_library(
    name = "tip_text_service",
    hdrs = ["tip_text_service.h"],
    tags = MOZC_TAGS.WIN_ONLY,
    target_compatible_with = ["@platforms//os:windows"],
    deps = ["@com_microsoft_wil//:wil"],
)

mozc_cc_library(
    name = "tip_text_service_impl",
    srcs = ["tip_text_service.cc"],
    tags = MOZC_TAGS.WIN_ONLY,
    target_compatible_with = ["@platforms//os:windows"],
    deps = [
        ":tip_display_attributes",
        ":tip_dll_module",
        ":tip_edit_session",
        ":tip_enum_display_attributes",
        ":tip_input_mode_manager",
        ":tip_keyevent_handler",
        ":tip_lang_bar",
        ":tip_lang_bar_callback",
        ":tip_preferred_touch_keyboard",
        ":tip_private_context_h",
        ":tip_reconvert_function",
        ":tip_resource",
        ":tip_status",
        ":tip_text_service",
        ":tip_thread_context",
        ":tip_ui_handler",
        "//base:const",
        "//base:process",
        "//base:system_util",
        "//base:update_util",
        "//base/win32:com",
        "//base/win32:com_implements",
        "//base/win32:hresult",
        "//base/win32:hresultor",
        "//protocol:commands_cc_proto",
        "//win32/base:msctf_dll",  # buildcleaner: keep
        "//win32/base:win32_window_util",
        "@com_google_absl//absl/base",
        "@com_google_absl//absl/container:flat_hash_map",
        "@com_google_absl//absl/functional:any_invocable",
        "@com_google_absl//absl/log",
        "@com_microsoft_wil//:wil",
    ],
)

mozc_cc_library(
    name = "tip_ui_element_conventional",
    srcs = ["tip_ui_element_conventional.cc"],
    hdrs = ["tip_ui_element_conventional.h"],
    tags = MOZC_TAGS.WIN_ONLY,
    target_compatible_with = ["@platforms//os:windows"],
    deps = [
        ":tip_dll_module",
        ":tip_text_service",
        ":tip_ui_element_delegate",
        "//base/win32:com",
        "@com_google_absl//absl/base:core_headers",
        "@com_microsoft_wil//:wil",
    ],
)

mozc_cc_library(
    name = "tip_transitory_extension",
    srcs = ["tip_transitory_extension.cc"],
    hdrs = ["tip_transitory_extension.h"],
    tags = MOZC_TAGS.WIN_ONLY,
    target_compatible_with = ["@platforms//os:windows"],
    deps = [
        ":tip_compartment_util",
        "//base/win32:com",
        "//base/win32:hresultor",
        "@com_google_absl//absl/base:nullability",
        "@com_microsoft_wil//:wil",
    ],
)

mozc_cc_library(
    name = "tip_candidate_string",
    srcs = ["tip_candidate_string.cc"],
    hdrs = ["tip_candidate_string.h"],
    tags = MOZC_TAGS.WIN_ONLY,
    target_compatible_with = ["@platforms//os:windows"],
    deps = [
        ":tip_dll_module",
        "//base/win32:com",
        "@com_google_absl//absl/base:nullability",
    ],
)

mozc_cc_test(
    name = "tip_candidate_string_test",
    size = "small",
    srcs = ["tip_candidate_string_test.cc"],
    tags = MOZC_TAGS.WIN_ONLY,
    target_compatible_with = ["@platforms//os:windows"],
    deps = [
        ":gmock_matchers",
        ":tip_candidate_string",
        "//testing:gunit_main",
        "@com_microsoft_wil//:wil",
    ],
)

mozc_cc_library(
    name = "tip_enum_candidates",
    srcs = ["tip_enum_candidates.cc"],
    hdrs = ["tip_enum_candidates.h"],
    tags = MOZC_TAGS.WIN_ONLY,
    target_compatible_with = ["@platforms//os:windows"],
    deps = [
        ":tip_candidate_string",
        ":tip_dll_module",
        "//base/win32:com",
        "@com_google_absl//absl/base:nullability",
    ],
)

mozc_cc_test(
    name = "tip_enum_candidates_test",
    size = "small",
    srcs = ["tip_enum_candidates_test.cc"],
    tags = MOZC_TAGS.WIN_ONLY,
    target_compatible_with = ["@platforms//os:windows"],
    deps = [
        ":gmock_matchers",
        ":tip_enum_candidates",
        "//testing:gunit_main",
        "@com_microsoft_wil//:wil",
    ],
)

mozc_cc_library(
    name = "tip_candidate_list",
    srcs = ["tip_candidate_list.cc"],
    hdrs = ["tip_candidate_list.h"],
    tags = MOZC_TAGS.WIN_ONLY,
    target_compatible_with = ["@platforms//os:windows"],
    deps = [
        ":tip_candidate_string",
        ":tip_dll_module",
        ":tip_enum_candidates",
        "//base/win32:com",
        "@com_google_absl//absl/base:nullability",
        "@com_google_absl//absl/functional:any_invocable",
        "@com_microsoft_wil//:wil",
    ],
)

mozc_cc_library(
    name = "tip_keyevent_handler",
    srcs = ["tip_keyevent_handler.cc"],
    hdrs = ["tip_keyevent_handler.h"],
    tags = MOZC_TAGS.WIN_ONLY,
    target_compatible_with = ["@platforms//os:windows"],
    deps = [
        ":tip_edit_session",
        ":tip_input_mode_manager",
        ":tip_private_context_h",
        ":tip_status",
        ":tip_surrounding_text",
        ":tip_text_service",
        ":tip_thread_context",
        "//base/win32:wide_char",
        "//client:client_interface",
        "//protocol:commands_cc_proto",
        "//win32/base:conversion_mode_util",
        "//win32/base:deleter",
        "//win32/base:input_state",
        "//win32/base:keyboard",
        "//win32/base:keyevent_handler",
        "//win32/base:surrogate_pair_observer",
        "@com_google_absl//absl/log",
        "@com_google_absl//absl/log:check",
        "@com_microsoft_wil//:wil",
    ],
)

mozc_cc_library(
    name = "tip_lang_bar_callback",
    hdrs = ["tip_lang_bar_callback.h"],
    tags = MOZC_TAGS.WIN_ONLY,
    target_compatible_with = ["@platforms//os:windows"],
)

mozc_cc_library(
    name = "tip_lang_bar_menu",
    srcs = ["tip_lang_bar_menu.cc"],
    hdrs = ["tip_lang_bar_menu.h"],
    features = features_gdi(),
    tags = MOZC_TAGS.WIN_ONLY,
    target_compatible_with = ["@platforms//os:windows"],
    deps = [
        ":tip_dll_module",
        ":tip_lang_bar_callback",
        ":tip_resource",
        "//base/win32:com",
        "//base/win32:com_implements",
        "//bazel/win32:user32",
        "//win32/base:text_icon",
        "//win32/base:tsf_profile",
        "@com_google_absl//absl/base",
        "@com_google_absl//absl/base:core_headers",
        "@com_microsoft_wil//:wil",
    ],
)

mozc_cc_library(
    name = "tip_lang_bar",
    srcs = ["tip_lang_bar.cc"],
    hdrs = ["tip_lang_bar.h"],
    tags = MOZC_TAGS.WIN_ONLY,
    target_compatible_with = ["@platforms//os:windows"],
    deps = [
        ":tip_dll_module",
        ":tip_lang_bar_callback",
        ":tip_lang_bar_menu",
        ":tip_resource",
        "//base/win32:com",
        "//base/win32:hresultor",
        "//protocol:commands_cc_proto",
        "//win32/base:msctf_dll",  # buildcleaner: keep
        "@com_google_absl//absl/log",
        "@com_microsoft_wil//:wil",
    ],
)

mozc_cc_library(
    name = "tip_ui_element_manager",
    srcs = ["tip_ui_element_manager.cc"],
    hdrs = ["tip_ui_element_manager.h"],
    tags = MOZC_TAGS.WIN_ONLY,
    target_compatible_with = ["@platforms//os:windows"],
    deps = [
        ":tip_input_mode_manager",
        ":tip_private_context_h",
        ":tip_text_service",
        ":tip_thread_context",
        ":tip_ui_element_conventional",
        "//base/win32:com",
        "//protocol:candidate_window_cc_proto",
        "//protocol:commands_cc_proto",
        "//protocol:renderer_cc_proto",
        "//win32/base:input_state",
        "@com_google_absl//absl/container:flat_hash_map",
        "@com_microsoft_wil//:wil",
    ],
)

mozc_cc_library(
    name = "tip_preferred_touch_keyboard",
    srcs = ["tip_preferred_touch_keyboard.cc"],
    hdrs = ["tip_preferred_touch_keyboard.h"],
    tags = MOZC_TAGS.WIN_ONLY,
    target_compatible_with = ["@platforms//os:windows"],
    deps = [
        ":tip_dll_module",
        "//base/win32:com",
        "//base/win32:com_implements",
        "@com_microsoft_wil//:wil",
    ],
)

mozc_cc_library(
    name = "tip_search_candidate_provider",
    srcs = ["tip_search_candidate_provider.cc"],
    hdrs = ["tip_search_candidate_provider.h"],
    tags = MOZC_TAGS.WIN_ONLY,
    target_compatible_with = ["@platforms//os:windows"],
    deps = [
        ":tip_candidate_list",
        ":tip_dll_module",
        ":tip_query_provider",
        "//base/win32:com",
        "//base/win32:com_implements",
        "@com_google_absl//absl/base:nullability",
        "@com_microsoft_wil//:wil",
    ],
)

mozc_cc_library(
    name = "tip_range_util",
    srcs = ["tip_range_util.cc"],
    hdrs = ["tip_range_util.h"],
    tags = MOZC_TAGS.WIN_ONLY,
    target_compatible_with = ["@platforms//os:windows"],
    deps = [
        "//base/win32:com",
        "@com_microsoft_wil//:wil",
    ],
)

mozc_cc_library(
    name = "tip_composition_util",
    srcs = ["tip_composition_util.cc"],
    hdrs = ["tip_composition_util.h"],
    tags = MOZC_TAGS.WIN_ONLY,
    target_compatible_with = ["@platforms//os:windows"],
    deps = [
        "//base/win32:com",
        "//win32/base:tsf_profile",
        "@com_microsoft_wil//:wil",
    ],
)

mozc_cc_library(
    name = "tip_thread_context",
    srcs = ["tip_thread_context.cc"],
    hdrs = ["tip_thread_context.h"],
    tags = MOZC_TAGS.WIN_ONLY,
    target_compatible_with = ["@platforms//os:windows"],
    deps = [
        ":tip_input_mode_manager",
        "//base:system_util",
    ],
)

mozc_cc_library(
    name = "tip_query_provider",
    srcs = ["tip_query_provider.cc"],
    hdrs = ["tip_query_provider.h"],
    tags = MOZC_TAGS.WIN_ONLY,
    target_compatible_with = ["@platforms//os:windows"],
    deps = [
        "//base/win32:wide_char",
        "//client",
        "//client:client_interface",
        "//protocol:candidate_window_cc_proto",
        "//protocol:commands_cc_proto",
    ],
)

mozc_cc_library(
    name = "tip_enum_display_attributes",
    srcs = ["tip_enum_display_attributes.cc"],
    hdrs = ["tip_enum_display_attributes.h"],
    tags = MOZC_TAGS.WIN_ONLY,
    target_compatible_with = ["@platforms//os:windows"],
    deps = [
        ":tip_display_attributes",
        ":tip_dll_module",
        "//base/win32:com",
        "@com_google_absl//absl/base:nullability",
        "@com_microsoft_wil//:wil",
    ],
)

mozc_cc_library(
    name = "tip_compartment_util",
    srcs = ["tip_compartment_util.cc"],
    hdrs = ["tip_compartment_util.h"],
    tags = MOZC_TAGS.WIN_ONLY,
    target_compatible_with = ["@platforms//os:windows"],
    deps = [
        "//base/win32:com",
        "//base/win32:hresult",
        "//base/win32:hresultor",
        "@com_microsoft_wil//:wil",
    ],
)

mozc_cc_library(
    name = "tip_ui_element_delegate",
    srcs = ["tip_ui_element_delegate.cc"],
    hdrs = ["tip_ui_element_delegate.h"],
    tags = MOZC_TAGS.WIN_ONLY,
    target_compatible_with = ["@platforms//os:windows"],
    deps = [
        ":tip_dll_module",
        ":tip_edit_session",
        ":tip_private_context_h",
        ":tip_resource",
        ":tip_text_service",
        "//base/win32:com",
        "//base/win32:wide_char",
        "//protocol:candidate_window_cc_proto",
        "//protocol:commands_cc_proto",
        "//protocol:renderer_cc_proto",
        "@com_google_absl//absl/log",
        "@com_google_absl//absl/log:check",
        "@com_microsoft_wil//:wil",
    ],
)

mozc_cc_library(
    name = "tip_private_context_h",
    hdrs = ["tip_private_context.h"],
    tags = MOZC_TAGS.WIN_ONLY,
    target_compatible_with = ["@platforms//os:windows"],
    deps = [
        "//client:client_interface",
        "//protocol:commands_cc_proto",
        "//win32/base:config_snapshot",
        "//win32/base:deleter",
        "//win32/base:input_state",
        "//win32/base:keyboard",
        "//win32/base:surrogate_pair_observer",
    ],
)

mozc_cc_library(
    name = "tip_private_context",
    srcs = ["tip_private_context.cc"],
    tags = MOZC_TAGS.WIN_ONLY,
    target_compatible_with = ["@platforms//os:windows"],
    deps = [
        ":tip_private_context_h",
        ":tip_text_service",
        ":tip_ui_element_manager",
        "//client",
        "//client:client_interface",
        "//protocol:commands_cc_proto",
        "//win32/base:config_snapshot",
        "//win32/base:deleter",
        "//win32/base:input_state",
        "//win32/base:keyboard",
        "//win32/base:surrogate_pair_observer",
    ],
)

mozc_cc_library(
    name = "tip_reconvert_function",
    srcs = ["tip_reconvert_function.cc"],
    hdrs = ["tip_reconvert_function.h"],
    tags = MOZC_TAGS.WIN_ONLY,
    target_compatible_with = ["@platforms//os:windows"],
    deps = [
        ":tip_candidate_list",
        ":tip_dll_module",
        ":tip_edit_session",
        ":tip_query_provider",
        ":tip_surrounding_text",
        ":tip_text_service",
        "//base/win32:com",
        "//base/win32:com_implements",
        "@com_google_absl//absl/base:nullability",
        "@com_microsoft_wil//:wil",
    ],
)

mozc_cc_library(
    name = "tip_status",
    srcs = ["tip_status.cc"],
    hdrs = ["tip_status.h"],
    tags = MOZC_TAGS.WIN_ONLY,
    target_compatible_with = ["@platforms//os:windows"],
    deps = [
        ":tip_compartment_util",
        "@com_microsoft_wil//:wil",
    ],
)

mozc_cc_library(
    name = "tip_ui_handler",
    hdrs = ["tip_ui_handler.h"],
    tags = MOZC_TAGS.WIN_ONLY,
    target_compatible_with = ["@platforms//os:windows"],
    deps = [":tip_text_service"],
)

mozc_cc_library(
    # TODO(yuryu): Fix cyclic dependency between tip_ui_handler*.cc.
    name = "tip_ui_handler_impl",
    srcs = [
        "tip_ui_handler.cc",
        "tip_ui_handler_conventional.cc",
    ],
    hdrs = [
        "tip_ui_handler_conventional.h",
    ],
    features = features_gdi(),
    tags = MOZC_TAGS.WIN_ONLY,
    target_compatible_with = ["@platforms//os:windows"],
    deps = [
        ":tip_composition_util",
        ":tip_dll_module",
        ":tip_input_mode_manager",
        ":tip_private_context_h",
        ":tip_range_util",
        ":tip_status",
        ":tip_text_service",
        ":tip_thread_context",
        ":tip_ui_element_manager",
        ":tip_ui_handler",
        "//base:system_util",
        "//base/win32:com",
        "//base/win32:wide_char",
        "//protocol:candidate_window_cc_proto",
        "//protocol:commands_cc_proto",
        "//protocol:renderer_cc_proto",
        "//renderer/win32:win32_renderer_client",
        "//win32/base:input_state",
        "@com_google_absl//absl/log:check",
        "@com_microsoft_wil//:wil",
    ],
)

mozc_cc_library(
    name = "tip_linguistic_alternates",
    srcs = ["tip_linguistic_alternates.cc"],
    hdrs = ["tip_linguistic_alternates.h"],
    tags = MOZC_TAGS.WIN_ONLY,
    target_compatible_with = ["@platforms//os:windows"],
    deps = [
        ":tip_candidate_list",
        ":tip_dll_module",
        ":tip_edit_session",
        ":tip_query_provider",
        ":tip_text_service",
        "//base/win32:com",
        "//base/win32:com_implements",
        "@com_google_absl//absl/base:nullability",
        "@com_microsoft_wil//:wil",
    ],
)

mozc_cc_library(
    name = "tip_edit_session",
    srcs = [
        "tip_edit_session.cc",
        "tip_edit_session_impl.cc",
    ],
    hdrs = [
        "tip_edit_session.h",
        "tip_edit_session_impl.h",
    ],
    tags = MOZC_TAGS.WIN_ONLY,
    target_compatible_with = ["@platforms//os:windows"],
    deps = [
        ":tip_composition_util",
        ":tip_dll_module",
        ":tip_input_mode_manager",
        ":tip_private_context_h",
        ":tip_range_util",
        ":tip_status",
        ":tip_surrounding_text",
        ":tip_text_service",
        ":tip_thread_context",
        ":tip_ui_handler",
        "//base:util",
        "//base/win32:com",
        "//base/win32:wide_char",
        "//client:client_interface",
        "//protocol:candidate_window_cc_proto",
        "//protocol:commands_cc_proto",
        "//win32/base:conversion_mode_util",
        "//win32/base:deleter",
        "//win32/base:input_state",
        "//win32/base:string_util",
        "@com_google_absl//absl/log:check",
        "@com_microsoft_wil//:wil",
    ],
)

mozc_cc_library(
    name = "tip_display_attributes",
    srcs = ["tip_display_attributes.cc"],
    hdrs = ["tip_display_attributes.h"],
    tags = MOZC_TAGS.WIN_ONLY,
    target_compatible_with = ["@platforms//os:windows"],
    deps = [
        ":tip_dll_module",
        "//base/win32:com",
        "@com_google_absl//absl/base:nullability",
    ],
)

mozc_cc_library(
    name = "tip_surrounding_text",
    srcs = ["tip_surrounding_text.cc"],
    hdrs = ["tip_surrounding_text.h"],
    tags = MOZC_TAGS.WIN_ONLY,
    target_compatible_with = ["@platforms//os:windows"],
    deps = [
        ":tip_composition_util",
        ":tip_dll_module",
        ":tip_range_util",
        ":tip_text_service",
        ":tip_transitory_extension",
        "//base/win32:com",
        "//base/win32:wide_char",
        "//win32/base:imm_reconvert_string",
        "@com_microsoft_wil//:wil",
    ],
)

mozc_cc_library(
    name = "tip_input_mode_manager",
    srcs = ["tip_input_mode_manager.cc"],
    hdrs = ["tip_input_mode_manager.h"],
    tags = MOZC_TAGS.WIN_ONLY,
    target_compatible_with = ["@platforms//os:windows"],
    deps = [
        "//protocol:commands_cc_proto",
        "//win32/base:conversion_mode_util",
        "//win32/base:indicator_visibility_tracker",
        "//win32/base:keyboard",
        "@com_google_absl//absl/types:span",
    ],
)

mozc_cc_library(
    name = "tip_resource",
    hdrs = ["tip_resource.h"],
    tags = MOZC_TAGS.WIN_ONLY,
    target_compatible_with = ["@platforms//os:windows"],
)

mozc_cc_test(
    name = "tip_surrounding_text_test",
    size = "small",
    srcs = ["tip_surrounding_text_test.cc"],
    tags = MOZC_TAGS.WIN_ONLY,
    target_compatible_with = ["@platforms//os:windows"],
    deps = [
        ":tip_surrounding_text",
        "//base:util",
        "//base/win32:wide_char",
        "//testing:gunit_main",
    ],
)

mozc_cc_test(
    name = "tip_candidate_list_test",
    size = "small",
    srcs = ["tip_candidate_list_test.cc"],
    tags = MOZC_TAGS.WIN_ONLY,
    target_compatible_with = ["@platforms//os:windows"],
    deps = [
        ":gmock_matchers",
        ":tip_candidate_list",
        "//base/win32:com",
        "//testing:gunit_main",
        "@com_google_absl//absl/base:core_headers",
        "@com_google_absl//absl/strings",
        "@com_microsoft_wil//:wil",
    ],
)

mozc_cc_test(
    name = "tip_display_attributes_test",
    size = "small",
    srcs = ["tip_display_attributes_test.cc"],
    tags = MOZC_TAGS.WIN_ONLY,
    target_compatible_with = ["@platforms//os:windows"],
    deps = [
        ":tip_display_attributes",
        "//testing:gunit_main",
        "@com_microsoft_wil//:wil",
    ],
)

mozc_cc_test(
    name = "tip_enum_display_attributes_test",
    size = "small",
    srcs = ["tip_enum_display_attributes_test.cc"],
    tags = MOZC_TAGS.WIN_ONLY,
    target_compatible_with = ["@platforms//os:windows"],
    deps = [
        ":tip_enum_display_attributes",
        "//testing:gunit_main",
        "@com_microsoft_wil//:wil",
    ],
)

mozc_cc_test(
    name = "tip_input_mode_manager_test",
    size = "small",
    srcs = ["tip_input_mode_manager_test.cc"],
    tags = MOZC_TAGS.WIN_ONLY,
    target_compatible_with = ["@platforms//os:windows"],
    deps = [
        ":tip_input_mode_manager",
        "//testing:gunit_main",
    ],
)

mozc_cc_library(
    name = "gmock_matchers",
    testonly = True,
    hdrs = ["gmock_matchers.h"],
    tags = MOZC_TAGS.WIN_ONLY,
    target_compatible_with = ["@platforms//os:windows"],
    deps = [
        "//base/win32:hresult",
        "//base/win32:wide_char",
        "//testing:gunit",
        "@com_microsoft_wil//:wil",
    ],
)
