# Copyright 2026 The Chromium Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.

import("//services/webnn/public/webnn_features.gni")
import("//ui/webui/resources/tools/build_webui.gni")

assert(!is_android)

build_webui("build") {
  grd_prefix = "webnn_internals"

  static_files = [ "webnn_internals.html" ]

  ts_files = [
    "app.html.ts",
    "app.ts",
    "contexts_viewer.ts",
    "contexts_viewer.html.ts",
    "info_page.ts",
    "info_page.html.ts",
  ]

  css_files = [
    "contexts_viewer.css",
    "app.css",
    "info_page.css",
  ]

  if (webnn_enable_graph_dump) {
    ts_files += [
      "graph_dump.html.ts",
      "graph_dump.ts",
    ]
    css_files += [ "graph_dump.css" ]
  }

  mojo_files_deps = [
    "//chrome/browser/ui/webui/webnn_internals:mojo_bindings_ts__generator",
    "//services/webnn/public/mojom:webnn_service_introspection_ts__generator",
  ]
  mojo_files = [
    "$root_gen_dir/chrome/browser/ui/webui/webnn_internals/webnn_internals.mojom-webui.ts",
    "$root_gen_dir/services/webnn/public/mojom/webnn_service_introspection.mojom-webui.ts",
  ]

  ts_composite = true
  ts_deps = [
    "//third_party/lit/v3_0:build_ts",
    "//ui/webui/resources/cr_elements:build_ts",
    "//ui/webui/resources/js:build_ts",
    "//ui/webui/resources/mojo:build_ts",
  ]

  webui_context_type = "trusted"
}
