load("@rules_closure//closure:defs.bzl", "closure_js_library")

package(default_visibility = ["//visibility:public"])

licenses(["notice"])

closure_js_library(
    name = "browserevent",
    srcs = ["browserevent.js"],
    lenient = True,
    deps = [
        ":browserfeature",
        ":event",
        ":eventtype",
        "//third_party/closure/goog/debug",
        "//third_party/closure/goog/reflect",
        "//third_party/closure/goog/useragent",
        "//third_party/closure/goog/utils",
    ],
)

closure_js_library(
    name = "browserfeature",
    srcs = ["browserfeature.js"],
    lenient = True,
)

closure_js_library(
    name = "event",
    srcs = [
        "event.js",
        "eventlike.js",
    ],
    lenient = True,
    deps = [
        ":eventid",
        "//third_party/closure/goog/disposable",
    ],
)

alias(
    name = "eventhandler",
    actual = ":events",
)

closure_js_library(
    name = "eventid",
    srcs = ["eventid.js"],
    lenient = True,
)

closure_js_library(
    name = "events",
    srcs = [
        "eventhandler.js",
        "events.js",
        "eventtarget.js",
        "eventwrapper.js",
    ],
    lenient = True,
    deps = [
        ":browserevent",
        ":browserfeature",
        ":event",
        ":eventid",
        ":listenable",
        ":listener",
        ":listenermap",
        "//third_party/closure/goog/asserts",
        "//third_party/closure/goog/debug:entrypointregistry",
        "//third_party/closure/goog/debug:errorhandler",
        "//third_party/closure/goog/disposable",
        "//third_party/closure/goog/object",
    ],
)

alias(
    name = "eventtarget",
    actual = ":events",
)

closure_js_library(
    name = "eventtype",
    srcs = [
        "eventtype.js",
        "mouseasmouseeventtype.js",
        "mouseevents.js",
        "pointerasmouseeventtype.js",
        "pointerastoucheventtype.js",
        "pointerfallbackeventtype.js",
        "pointertouchfallbackeventtype.js",
    ],
    lenient = True,
    deps = [
        ":eventtypehelpers",
        "//third_party/closure/goog/useragent",
    ],
)

closure_js_library(
    name = "eventtypehelpers",
    srcs = ["eventtypehelpers.js"],
    lenient = True,
    deps = [
        ":browserfeature",
        "//third_party/closure/goog/useragent",
    ],
)

alias(
    name = "eventwrapper",
    actual = ":events",
)

closure_js_library(
    name = "keycodes",
    srcs = ["keycodes.js"],
    lenient = True,
    deps = [
        ":browserevent",
        "//third_party/closure/goog/useragent",
    ],
)

closure_js_library(
    name = "keyhandler",
    srcs = [
        "keyevent.js",
        "keyhandler.js",
    ],
    lenient = True,
    deps = [
        ":browserevent",
        ":events",
        ":eventtarget",
        ":eventtype",
        ":keycodes",
        "//third_party/closure/goog/useragent",
    ],
)

closure_js_library(
    name = "listenable",
    srcs = [
        "listenable.js",
        "listenablekey.js",
    ],
    lenient = True,
    deps = [
        ":event",
        ":eventid",
    ],
)

closure_js_library(
    name = "listener",
    srcs = ["listener.js"],
    lenient = True,
    deps = [":listenable"],
)

closure_js_library(
    name = "listenermap",
    srcs = ["listenermap.js"],
    lenient = True,
    deps = [
        ":eventid",
        ":listenable",
        ":listener",
        "//third_party/closure/goog/array",
        "//third_party/closure/goog/object",
    ],
)
