WebMCP Inspector

Bookmarklet

Bookmarklet gratuito · v2

Descubre, audita y prueba las herramientas WebMCP de cualquier web

WebMCP Inspector es un marcador que, con un clic, detecta las herramientas WebMCP de una página, tanto imperativas como declarativas: las registradas con JavaScript y los formularios anotados en el HTML. Audita cómo están implementadas y te deja probarlas con un agente de prueba.

☝️ Arrastra el botón rojo a tu barra de marcadores. Si hacer clic aquí no hace nada, es lo normal: el marcador se usa en otra página.

Panel «WebMCP Inspector v2» sobre una página de reservas de demostración: veredicto «Implementado», contadores de herramientas, formularios y problemas, y la lista de herramientas con las etiquetas imperativa y declarativa
Ejemplo con una página de demostración que registra herramientas imperativas y declarativas.

Qué hace

Detecta imperativas y declarativas

Lee la API del navegador (modelContext) y rastrea los formularios con toolname, también dentro de shadow DOM e iframes del mismo origen.

Da un veredicto claro

«Implementado», «implementación parcial», «no implementado» o «no verificable», con contadores de herramientas, formularios y problemas.

Lista cada herramienta

Nombre, descripción, esquema de entrada y sus anotaciones: solo lectura, contenido no fiable o autosubmit.

Audita los formularios anotados

Avisa de toolname o tooldescription ausentes, nombres duplicados, campos sin name, sin toolparamdescription o sin etiqueta, y de formularios que no llegan a registrarse.

Prueba con un agente de prueba

Genera un formulario desde el esquema (listas, números, booleanos, JSON) y ejecuta la herramienta mostrando la respuesta, con enlaces clicables.

Exporta y se actualiza solo

Copia el informe en Markdown o descárgalo en JSON. Se vuelve a analizar cuando la página cambia sus herramientas y muestra un registro de eventos.

Imperativas y declarativas

{ } Imperativas

Se registran con JavaScript a través de la API del navegador. El inspector las lista con su nombre, descripción y esquema, genera un formulario para cada una y te deja ejecutarla.

</> Declarativas

Se declaran en el HTML, anotando un formulario. El inspector las encuentra en el DOM, las audita y comprueba si el navegador las ha registrado.

<form toolname="reservar_mesa"
      tooldescription="Reserva una mesa">
  <input name="fecha"
         toolparamdescription="Fecha (AAAA-MM-DD)">
  <button type="submit">Reservar</button>
</form>

Una herramienta se etiqueta como declarativa cuando existe un formulario con ese toolname; la API del navegador no indica el origen, así que es una deducción.

Qué te dice

ImplementadoHay herramientas registradas y las anotaciones están completas (o con mejoras posibles).
Implementación parcialHay formularios anotados con errores o que no llegan a registrarse.
No implementadoWebMCP está disponible, pero la página no registra ninguna herramienta.
No verificable / no evaluableEl navegador no expone la API. Si no hay anotaciones en el DOM, no prueba que la web no lo implemente.

Cómo se usa

  1. Guárdalo en tus marcadoresArrastra el botón «WebMCP Inspector» a la barra de marcadores de tu navegador.
  2. Abre la web a inspeccionarEntra en la página y pulsa el marcador, con esa pestaña en primer plano. Aparece un panel arriba a la derecha.
  3. Revisa, audita y pruebaLee el veredicto, repasa las herramientas y los avisos de los formularios, y ejecuta las que quieras con el agente de prueba.

El informe

Auditoría de formularios anotados: un formulario correcto, otro mejorable con avisos sobre campos sin name, sin toolparamdescription y sin etiqueta, y otro con errores por falta de toolname
Auditoría de formularios declarativos: correctos, mejorables y con errores.
Panel en tema oscuro tras ejecutar una herramienta: la respuesta aparece como tarjetas con enlaces, con la respuesta en bruto y el tiempo de ejecución
Ejecución con el agente de prueba, en tema oscuro (el panel también tiene tema claro y automático).

Instalación

Arrastrando el botón

  1. Muestra la barra de marcadores: Ctrl + Shift + B (en Mac, ⌘ + Shift + B).
  2. Arrastra el botón «WebMCP Inspector» de esta página hasta esa barra.
  3. Ábrelo en la web que quieras inspeccionar con un clic. Si lo pulsas otra vez, se cierra.

Copiando el código

  1. Pulsa «Copiar el código».
  2. Crea un marcador nuevo (clic derecho en la barra de marcadores → «Añadir página»).
  3. Ponle el nombre que quieras y pega el código en el campo «URL».

Algunos navegadores quitan el prefijo javascript: al pegar. Si pasa, escríbelo a mano antes de guardar.

Antes de ejecutar una herramienta

Ejecutar una herramienta lanza la acción real de la web. Si una herramienta añade al carrito, envía un formulario o reserva, hacerlo desde el inspector tiene el mismo efecto que si lo hiciera un agente. Para probar acciones con efectos, usa un entorno de pruebas o una cuenta de prueba.

En las declarativas, el inspector enfoca el formulario y espera a que lo envíes tú, salvo que tenga toolautosubmit. Listar y auditar no ejecuta nada: es seguro.

Tu navegación es tuya

El marcador se ejecuta íntegramente en la página que tienes abierta, dentro de un panel aislado de los estilos de la web. No hace peticiones a ningún servidor, no usa cuentas ni analítica y no guarda nada. Puedes leer el código completo debajo antes de usarlo.

Preguntas frecuentes

¿Qué es WebMCP?

Es una propuesta de estándar, todavía en desarrollo, para que una web declare «herramientas» explícitas (con nombre, descripción y parámetros) que un agente de IA pueda invocar directamente, en lugar de tener que interpretar la interfaz. Puede cambiar con el tiempo.

¿Qué diferencia hay entre una herramienta imperativa y una declarativa?

La imperativa se registra desde JavaScript con la API del navegador. La declarativa se define en el HTML anotando un formulario con toolname y tooldescription. El inspector detecta ambas y, para las declarativas, además revisa que las anotaciones estén completas.

Me dice «No evaluable» o «API no disponible». ¿Es un fallo?

No. Significa que el navegador no expone la API WebMCP en esa pestaña (puede que no la soporte o que esté desactivada). Eso no demuestra que la web no la implemente. Si la página tiene formularios anotados, el inspector los audita igualmente, pero solo puede confirmar que se registran cuando la API está disponible.

¿Por qué me avisa de «Pestaña OCULTA»?

WebMCP solo expone herramientas en pestañas visibles. Si analizas con la pestaña en segundo plano, puede que no aparezcan; vuelve a analizar con la pestaña en primer plano (botón ↻).

¿Qué es el «agente de prueba»?

Es un objeto mínimo que el inspector pasa a la herramienta al ejecutarla. Si la herramienta pide confirmación al usuario, la acepta automáticamente. Sirve para comprobar que la herramienta responde, no para simular un agente real.

¿Funciona en cualquier página?

En casi todas. Las webs con una política de seguridad de contenido (CSP) muy estricta pueden bloquear los marcadores, no funciona en páginas internas del navegador y no puede inspeccionar el interior de iframes de otro origen (te avisa de cuántos hay).

¿Envía datos a algún sitio?

No. No hace ninguna petición de red por sí mismo; solo habla con la propia página, y lo que ejecutes es lo que esa página haga con tus parámetros.

¿Puedo analizar la accesibilidad completa de mi web para agentes?

Este marcador solo cubre WebMCP. Para ver cómo percibe tu web un agente (captura, árbol de accesibilidad y nota con prioridades), tienes Agentic View, una extensión de Chrome que detecta además las herramientas WebMCP declaradas.

Ver el código del marcadorJavaScript sin dependencias ni peticiones de red: léelo antes de usarlo

Es la versión compactada del marcador, con el código formateado para poder leerlo. El botón de arriba contiene exactamente esto, en una sola línea.

!(function () {
  "use strict";
  var e = "wm-inspector-v2",
    r = document.getElementById(e);
  if (r) return (r.__wmCleanup && r.__wmCleanup(), void r.remove());
  var t =
      "--bg:#1A1A1A;--card:#2B2B2B;--line:#404040;--line2:#5A5A5A;--ink:#F6F6F6;--ink2:#E1E1E1;--mut:#A8A8A8;--brand:#F11C41;--brand-ink:#FF6B84;--field:#1A1A1A;--frame:#6B6B6B;--ok-fg:#5BE08A;--ok-bg:#12301E;--ok-ln:#1F6B3A;--wa-fg:#FBBF4A;--wa-bg:#35270A;--wa-ln:#7A5514;--er-fg:#FF8D86;--er-bg:#3B1618;--er-ln:#8A2B2B;--sh:0 12px 32px rgba(0,0,0,.7)",
    o = 'Inter,system-ui,-apple-system,"Segoe UI",Roboto,sans-serif',
    n = "ui-monospace,SFMono-Regular,Menlo,Consolas,monospace",
    a = [
      ":host{all:initial}",
      "*{box-sizing:border-box}",
      ".w{--bg:#F6F6F6;--card:#FFFFFF;--line:#E1E1E1;--line2:#BDBDBD;--ink:#1A1A1A;--ink2:#404040;--mut:#5C5C5C;--brand:#F11C41;--brand-ink:#C4122F;--field:#F6F6F6;--frame:#1A1A1A;--ok-fg:#166534;--ok-bg:#E3F6E8;--ok-ln:#86C99A;--wa-fg:#8A4B05;--wa-bg:#FFF1D6;--wa-ln:#E8B85C;--er-fg:#B42318;--er-bg:#FDE8E6;--er-ln:#F1A39B;--sh:0 12px 32px rgba(0,0,0,.35);position:fixed;top:16px;right:16px;width:480px;max-width:calc(100vw - 32px);max-height:90vh;display:flex;flex-direction:column;background:var(--bg);color:var(--ink);border:2px solid var(--frame);border-radius:14px;box-shadow:var(--sh);font:13px/1.5 " +
        o +
        ";overflow:hidden}",
      "@media (prefers-color-scheme:dark){.w:not([data-theme=light]){" + t + "}}",
      ".w[data-theme=dark]{" + t + "}",
      ".ok{--c:var(--ok-fg);--b:var(--ok-bg);--l:var(--ok-ln)}",
      ".wa{--c:var(--wa-fg);--b:var(--wa-bg);--l:var(--wa-ln)}",
      ".er{--c:var(--er-fg);--b:var(--er-bg);--l:var(--er-ln)}",
      ".mu{--c:var(--mut);--b:var(--card);--l:var(--line);color:var(--mut)}",
      "button:focus-visible,input:focus-visible,select:focus-visible,textarea:focus-visible,summary:focus-visible{outline:2px solid var(--brand);outline-offset:2px}",
      ".hd{display:flex;align-items:center;gap:6px;padding:10px 12px;background:#1A1A1A;color:#F6F6F6;border-bottom:3px solid #F11C41;cursor:move;user-select:none}",
      ".hd h3{margin:0;flex:1;font-size:12px;font-weight:800;letter-spacing:.1em;text-transform:uppercase;color:#F6F6F6}",
      ".hd h3 b{color:#FF3D5C}",
      ".ib{background:var(--card);color:var(--ink);border:1px solid var(--line2);border-radius:6px;padding:3px 9px;cursor:pointer;font:600 11px " +
        o +
        "}",
      ".ib:hover{background:var(--line)}",
      ".hd .ib{background:transparent;color:#F6F6F6;border-color:#5A5A5A}",
      ".hd .ib:hover{background:#404040}",
      ".hd .ib.x{background:#C4122F;border-color:#C4122F;color:#fff}",
      ".hd .ib.x:hover{background:#9F0E26;border-color:#9F0E26}",
      ".bd{flex:1 1 auto;min-height:0;padding:14px;overflow:auto;background:var(--bg);scrollbar-width:thin;scrollbar-color:var(--line2) transparent}",
      ".min .bd{display:none}",
      ".cr{flex:none;padding:7px 12px;background:#0D0D0D;color:#E1E1E1;font-size:11px;text-align:center;border-top:1px solid #404040}",
      ".cr a{color:#F11C41;font-weight:700;text-decoration:underline;text-underline-offset:2px}",
      ".cr a:hover{color:#FF5C78}",
      ".verd{display:flex;gap:10px;align-items:flex-start;padding:10px 12px;border-radius:10px;margin-bottom:10px;font-weight:600;background:var(--b);color:var(--c);border:1px solid var(--l);border-left:6px solid var(--c)}",
      ".verd::before{font-size:15px;line-height:1.25}",
      '.verd.ok::before{content:"\\2714"}.verd.wa::before{content:"\\25B2"}.verd.er::before{content:"\\2716"}.verd.mu::before{content:"\\24D8"}',
      ".tiles{display:grid;grid-template-columns:repeat(3,1fr);gap:8px;margin-bottom:10px}",
      ".tile{background:var(--b,var(--card));border:1px solid var(--l,var(--line));border-radius:10px;padding:8px 10px}",
      ".tile .l{font-size:10px;font-weight:800;letter-spacing:.09em;text-transform:uppercase;color:var(--mut)}",
      ".tile .n{font-size:26px;font-weight:800;line-height:1.15;color:var(--c,var(--ink))}",
      ".tile .s{font-size:11px;color:var(--mut)}",
      ".chips{display:flex;flex-wrap:wrap;gap:6px;margin-bottom:6px}",
      ".chip{display:inline-flex;gap:4px;align-items:center;padding:2px 9px;border-radius:999px;font-size:11px;font-weight:600;border:1px solid var(--l,var(--line2));background:var(--b,var(--card));color:var(--c,var(--ink2))}",
      '.chip.ok::before{content:"\\2714"}.chip.wa::before{content:"\\25B2"}.chip.er::before{content:"\\2716"}',
      ".sec{display:flex;align-items:center;gap:8px;margin:18px 0 8px;font-size:11px;font-weight:800;letter-spacing:.1em;text-transform:uppercase;color:var(--ink)}",
      '.sec::before{content:"";width:8px;height:8px;background:var(--brand);border-radius:2px}',
      '.sec::after{content:"";flex:1;height:1px;background:var(--line2)}',
      ".card{background:var(--card);border:1px solid var(--line);border-left:4px solid var(--ink);border-radius:10px;padding:12px;margin-bottom:10px}",
      ".card.decl{border-left-color:var(--brand)}",
      ".card.st-ok{border-left-color:var(--ok-fg)}.card.st-wa{border-left-color:var(--wa-fg)}.card.st-er{border-left-color:var(--er-fg)}",
      ".top{display:flex;gap:6px;align-items:center;flex-wrap:wrap}",
      ".nm{font:700 13px " + n + ";color:var(--ink);word-break:break-all}",
      ".bg{font-size:10px;font-weight:700;padding:1px 7px;border-radius:5px;border:1px solid var(--l,var(--line2));background:var(--b,transparent);color:var(--c,var(--ink2));text-transform:uppercase;letter-spacing:.05em}",
      ".bg.imp{background:var(--ink);color:var(--bg);border-color:var(--ink)}",
      ".bg.decl{color:var(--brand-ink);border-color:var(--brand)}",
      ".ds{color:var(--mut);font-size:12px;margin:6px 0 4px}",
      "label{display:block;font-size:11px;font-weight:600;color:var(--ink2);margin:9px 0 3px}",
      "input,select,textarea{width:100%;background:var(--field);color:var(--ink);border:1px solid var(--line2);border-radius:6px;padding:7px 8px;font:13px " +
        o +
        "}",
      "input:focus,select:focus,textarea:focus{border-color:var(--ink)}",
      "textarea{min-height:56px;font-family:" + n + ";font-size:12px}",
      ".run{width:100%;margin-top:12px;background:var(--ink);color:var(--bg);border:0;border-radius:6px;padding:9px;font:800 12px " +
        o +
        ";letter-spacing:.06em;text-transform:uppercase;cursor:pointer}",
      ".run:hover:not(:disabled){background:#C4122F;color:#fff}",
      ".run:disabled{opacity:.55;cursor:progress}",
      ".sub{display:flex;gap:6px;margin-top:6px}",
      ".sub .ib{flex:1;padding:6px}",
      ".out{display:none;margin-top:10px;padding:8px;background:var(--bg);border:1px solid var(--line);border-radius:8px;max-height:240px;overflow:auto;font-size:12px}",
      ".res{background:var(--card);border:1px solid var(--line);border-left:3px solid var(--brand);border-radius:6px;padding:7px 9px;margin-bottom:6px;white-space:pre-wrap;word-break:break-word}",
      ".res .rt{font-weight:700;color:var(--ink);margin-bottom:3px}",
      ".res a{color:var(--brand-ink);font-size:11px;word-break:break-all;text-decoration:underline}",
      ".msg{padding:8px 10px;border-radius:6px;font-weight:600;background:var(--b);color:var(--c);border:1px solid var(--l);word-break:break-word}",
      "pre{margin:0;white-space:pre-wrap;word-break:break-word;font:11px/1.5 " + n + ";color:var(--ink2)}",
      "details{margin-top:8px}",
      "summary{cursor:pointer;color:var(--ink2);font-size:11px;font-weight:600}",
      ".is{padding:4px 8px;border-radius:6px;margin:4px 0;font-size:11.5px;background:var(--b);color:var(--c);word-break:break-word}",
      ".note{font-size:11.5px;color:var(--wa-fg);background:var(--wa-bg);border:1px solid var(--wa-ln);border-radius:6px;padding:6px 8px;margin-top:8px}",
      ".ft{font-size:10.5px;color:var(--mut);margin-top:10px}",
    ].join("\n"),
    i = document.createElement("div");
  ((i.id = e), (i.style.cssText = "all:initial;position:fixed;top:0;left:0;z-index:2147483647"));
  var l = i.attachShadow({ mode: "open" });
  try {
    var s = new CSSStyleSheet();
    (s.replaceSync(a), (l.adoptedStyleSheets = [s]));
  } catch (e) {
    var c = document.createElement("style");
    ((c.textContent = a), l.appendChild(c));
  }
  function d(e, r, t) {
    var o = document.createElement(e);
    if (((r = r || {}).c && (o.className = r.c), null != r.t && (o.textContent = r.t), r.a))
      for (var n in r.a) o.setAttribute(n, r.a[n]);
    if (r.on) for (var a in r.on) o.addEventListener(a, r.on[a]);
    return (
      (t || []).forEach(function (e) {
        e && o.appendChild(e);
      }),
      o
    );
  }
  function p(e, r) {
    return d("span", { c: "chip " + (r || ""), t: e });
  }
  function u(e) {
    return e && e.message ? (e.name && "Error" !== e.name ? e.name + ": " : "") + e.message : String(e);
  }
  function m(e) {
    function r() {
      var r = document.createElement("textarea");
      ((r.value = e),
        (r.style.cssText = "position:fixed;opacity:0;top:0;left:0"),
        document.body.appendChild(r),
        r.select());
      var t = !1;
      try {
        t = document.execCommand("copy");
      } catch (e) {}
      return (r.remove(), t);
    }
    return navigator.clipboard && navigator.clipboard.writeText
      ? navigator.clipboard.writeText(e).then(
          function () {
            return !0;
          },
          function () {
            return r();
          },
        )
      : Promise.resolve(r());
  }
  function f(e, r) {
    var t = e.textContent;
    ((e.textContent = r),
      setTimeout(function () {
        e.textContent = t;
      }, 1400));
  }
  var v,
    h,
    g,
    b = d("div", { c: "w" }),
    x = d("div", { c: "bd" }),
    w = d("button", { c: "ib", t: "↻", a: { title: "Volver a analizar" } }),
    y = d("button", { c: "ib", t: "MD", a: { title: "Copiar informe en Markdown" } }),
    k = d("button", { c: "ib", t: "JSON", a: { title: "Descargar informe en JSON" } }),
    C = d("button", { c: "ib", t: "Tema", a: { title: "Tema: automático / claro / oscuro" } }),
    E = d("button", { c: "ib", t: "–", a: { title: "Minimizar" } }),
    A = d("button", { c: "ib x", t: "✕", a: { title: "Cerrar" } }),
    F = d("div", { c: "hd" }, [
      d("h3", {}, [d("span", { t: "WebMCP Inspector " }), d("b", { t: "v2" })]),
      w,
      y,
      k,
      C,
      E,
      A,
    ]);
  (b.appendChild(F),
    b.appendChild(x),
    b.appendChild(
      d("div", { c: "cr" }, [
        d("span", { t: "Desarrollado por " }),
        d("a", {
          t: "Carlos Ortega Roldán",
          a: { href: "https://carlosortega.page/", target: "_blank", rel: "noopener noreferrer" },
        }),
      ]),
    ),
    l.appendChild(b),
    document.body.appendChild(i),
    (v = 0),
    (h = 0),
    (g = !1),
    F.addEventListener("pointerdown", function (e) {
      if (!e.target.closest || !e.target.closest("button")) {
        var r = b.getBoundingClientRect();
        ((v = e.clientX - r.left), (h = e.clientY - r.top), (g = !0), (b.style.right = "auto"));
        try {
          F.setPointerCapture(e.pointerId);
        } catch (e) {}
      }
    }),
    F.addEventListener("pointermove", function (e) {
      g &&
        ((b.style.left = Math.max(0, Math.min(window.innerWidth - 80, e.clientX - v)) + "px"),
        (b.style.top = Math.max(0, Math.min(window.innerHeight - 40, e.clientY - h)) + "px"));
    }),
    F.addEventListener("pointerup", function () {
      g = !1;
    }));
  var S = [];
  function T(e) {
    (S.unshift(new Date().toLocaleTimeString() + "  " + e), (S.length = Math.min(S.length, 20)));
    var r = l.getElementById ? l.getElementById("wm-ev") : null;
    r && (r.textContent = S.join("\n"));
  }
  var N = 0;
  function O(e, r) {
    (e.querySelectorAll("form[toolname],form[tooldescription]").forEach(function (e) {
      r.push(e);
    }),
      e.querySelectorAll("*").forEach(function (e) {
        e !== i && e.shadowRoot && O(e.shadowRoot, r);
      }),
      e.querySelectorAll("iframe").forEach(function (e) {
        try {
          var t = e.contentDocument;
          t ? O(t, r) : N++;
        } catch (e) {
          N++;
        }
      }));
  }
  function j(e) {
    return (e.labels && e.labels.length) || e.getAttribute("aria-label") || e.getAttribute("aria-labelledby");
  }
  function B() {
    N = 0;
    var e = [];
    O(document, e);
    var r = {};
    return e.map(function (e) {
      var t = (e.getAttribute("toolname") || "").trim(),
        o = (e.getAttribute("tooldescription") || "").trim(),
        n = {
          el: e,
          name: t,
          description: o,
          autosubmit: e.hasAttribute("toolautosubmit"),
          errors: [],
          warnings: [],
          fields: [],
          registered: null,
          duplicate: !1,
        };
      return (
        t || n.errors.push("Falta toolname: la herramienta NO se registra"),
        o || n.errors.push("Falta tooldescription: la herramienta NO se registra"),
        t &&
          (r[t] &&
            ((n.duplicate = !0),
            n.errors.push("toolname duplicado («" + t + "»): solo se registra el primer formulario")),
          (r[t] = !0)),
        Array.prototype.forEach.call(e.elements || [], function (e) {
          var r = (e.type || "").toLowerCase();
          if (
            -1 === ["submit", "button", "reset", "image", "hidden", "fieldset", "object", "output"].indexOf(r)
          ) {
            var t = e.name || e.id || "",
              o = {
                name: t,
                type: r || e.tagName.toLowerCase(),
                paramDescription: e.getAttribute("toolparamdescription") || "",
                label: !!j(e),
                required: !!e.required,
              };
            n.fields.push(o);
            var a = t || "(sin name)";
            (e.name || n.warnings.push("Campo «" + a + "» sin atributo name"),
              o.paramDescription || n.warnings.push("Campo «" + a + "» sin toolparamdescription"),
              o.label || n.warnings.push("Campo «" + a + "» sin <label for> ni aria-label"));
          }
        }),
        n.fields.length || n.warnings.push("El formulario no tiene campos"),
        n.autosubmit ||
          e.querySelector("button[type=submit],input[type=submit],button:not([type])") ||
          n.warnings.push("Sin botón de envío (y sin toolautosubmit)"),
        e.getClientRects &&
          0 === e.getClientRects().length &&
          n.warnings.push(
            "Formulario no visible en pantalla (el navegador lo enfoca al ejecutar la herramienta)",
          ),
        n
      );
    });
  }
  function D(e) {
    var r = e.forms.filter(function (e) {
        return e.errors.length;
      }),
      t = e.forms.filter(function (e) {
        return !1 === e.registered;
      }),
      o = e.forms.some(function (e) {
        return e.warnings.length;
      });
    return e.api
      ? e.error
        ? { lvl: "er", txt: "Error al enumerar herramientas: " + u(e.error) }
        : e.tools.length || e.forms.length
          ? r.length || t.length
            ? {
                lvl: "er",
                txt: "Implementación parcial: hay formularios anotados con errores o que no llegan a registrarse.",
              }
            : o
              ? { lvl: "ok", txt: "Implementado, con mejoras posibles en las anotaciones." }
              : { lvl: "ok", txt: "Implementado: herramientas registradas y anotaciones completas." }
          : {
              lvl: "wa",
              txt: "WebMCP disponible, pero la página no registra ninguna herramienta (no implementado).",
            }
      : e.forms.length
        ? {
            lvl: "wa",
            txt:
              "No verificable: el navegador no expone WebMCP, pero hay " +
              e.forms.length +
              " formulario(s) anotado(s) en el DOM.",
          }
        : {
            lvl: "mu",
            txt: "No evaluable: el navegador no expone la API WebMCP (¿flag desactivado?). Tampoco hay anotaciones en el DOM, así que esto no prueba que la web no la implemente.",
          };
  }
  var z = {
      requestUserInteraction: function (e) {
        return Promise.resolve().then(e);
      },
    },
    I = null,
    P = null,
    M = "",
    L = 0;
  function R(e) {
    x.replaceChildren();
    var r = D(e),
      t = e.tools.filter(function (e) {
        return "declarativa" === e.kind;
      }).length,
      o = e.tools.length - t,
      n = e.forms.filter(function (e) {
        return e.errors.length || !1 === e.registered;
      }).length;
    x.appendChild(d("div", { c: "verd " + r.lvl, t: r.txt }));
    var a = 0,
      i = 0;
    function l(e, r, t, o) {
      return d("div", { c: "tile " + o }, [
        d("div", { c: "l", t: r }),
        d("div", { c: "n", t: String(e) }),
        d("div", { c: "s", t: t }),
      ]);
    }
    (e.forms.forEach(function (e) {
      ((a += e.errors.length + (!1 === e.registered ? 1 : 0)), (i += e.warnings.length));
    }),
      x.appendChild(
        d("div", { c: "tiles" }, [
          l(e.tools.length, "Herramientas", o + " imp. · " + t + " decl.", e.tools.length ? "ok" : "mu"),
          l(e.forms.length, "Formularios", "anotados en el DOM", e.forms.length ? (n ? "wa" : "ok") : "mu"),
          l(a + i, "Problemas", a + " errores · " + i + " avisos", a ? "er" : i ? "wa" : "ok"),
        ]),
      ));
    var s = d("div", { c: "chips" });
    (s.appendChild(p(e.api ? "API: " + e.api.name : "API no disponible", e.api ? "ok" : "er")),
      s.appendChild(p(e.secure ? "HTTPS" : "Sin contexto seguro", e.secure ? "ok" : "er")),
      s.appendChild(p(e.visible ? "Pestaña visible" : "Pestaña OCULTA", e.visible ? "ok" : "wa")),
      e.iframesBlocked && s.appendChild(p(e.iframesBlocked + " iframe(s) no inspeccionable(s)", "wa")),
      x.appendChild(s),
      e.apiNote && x.appendChild(d("div", { c: "is mu", t: e.apiNote })),
      e.visible ||
        x.appendChild(
          d("div", {
            c: "note",
            t: "WebMCP solo expone herramientas en pestañas visibles; vuelve a analizar con esta pestaña en primer plano.",
          }),
        ),
      e.error && x.appendChild(d("div", { c: "msg er", t: "✖ Error al leer herramientas: " + u(e.error) })),
      e.tools.length
        ? (x.appendChild(d("div", { c: "sec", t: "Herramientas registradas" })),
          e.tools.forEach(function (r) {
            x.appendChild(
              (function (e, r) {
                var t = "declarativa" === r.kind,
                  o = d("div", { c: "card " + (t ? "decl" : "imp") });
                (o.appendChild(
                  d(
                    "div",
                    { c: "top" },
                    [
                      d("span", { c: "nm", t: "⚡ " + r.name }),
                      d("span", {
                        c: "bg " + (t ? "decl" : "imp"),
                        t: t ? "</> declarativa" : "{ } imperativa",
                      }),
                    ].concat(
                      r.annotations && r.annotations.readOnlyHint
                        ? [d("span", { c: "bg ok", t: "solo lectura" })]
                        : [],
                      r.annotations && r.annotations.untrustedContentHint
                        ? [d("span", { c: "bg wa", t: "contenido no fiable" })]
                        : [],
                      t && r.form && r.form.autosubmit ? [d("span", { c: "bg", t: "autosubmit" })] : [],
                    ),
                  ),
                ),
                  o.appendChild(d("div", { c: "ds", t: r.description || "Sin descripción" })));
                var n = (r.schema && r.schema.properties) || {},
                  a = Object.keys(n),
                  i = r.schema && Array.isArray(r.schema.required) ? r.schema.required : [],
                  l = {};
                a.length
                  ? a.forEach(function (e) {
                      var r = (function (e, r, t) {
                        r = r || {};
                        var o,
                          n,
                          a = Array.isArray(r.type)
                            ? r.type.filter(function (e) {
                                return "null" !== e;
                              })[0]
                            : r.type;
                        return (
                          r.enum && r.enum.length
                            ? ((o = d("select")),
                              t || o.appendChild(d("option", { t: "— omitir —", a: { value: "" } })),
                              r.enum.forEach(function (e) {
                                o.appendChild(d("option", { t: String(e), a: { value: JSON.stringify(e) } }));
                              }),
                              void 0 !== r.default && (o.value = JSON.stringify(r.default)),
                              (n = function () {
                                return "" === o.value ? { skip: !0 } : { v: JSON.parse(o.value) };
                              }))
                            : "boolean" === a
                              ? ((o = d("select")),
                                [
                                  ["— omitir —", ""],
                                  ["true", "true"],
                                  ["false", "false"],
                                ].forEach(function (e) {
                                  o.appendChild(d("option", { t: e[0], a: { value: e[1] } }));
                                }),
                                "boolean" == typeof r.default && (o.value = String(r.default)),
                                (n = function () {
                                  return "" === o.value ? { skip: !0 } : { v: "true" === o.value };
                                }))
                              : "number" === a || "integer" === a
                                ? ((o = d("input", {
                                    a: { type: "number", step: "integer" === a ? "1" : "any" },
                                  })),
                                  void 0 !== r.minimum && (o.min = r.minimum),
                                  void 0 !== r.maximum && (o.max = r.maximum),
                                  void 0 !== r.default && (o.value = r.default),
                                  (n = function () {
                                    if ("" === o.value.trim()) return { skip: !0 };
                                    var r = Number(o.value);
                                    if (isNaN(r)) throw new Error("«" + e + "» no es un número válido");
                                    return { v: r };
                                  }))
                                : "array" === a || "object" === a
                                  ? ((o = d("textarea", {
                                      a: { placeholder: "array" === a ? '["a","b"]' : '{"clave":"valor"}' },
                                    })),
                                    void 0 !== r.default && (o.value = JSON.stringify(r.default)),
                                    (n = function () {
                                      if ("" === o.value.trim()) return { skip: !0 };
                                      try {
                                        return { v: JSON.parse(o.value) };
                                      } catch (r) {
                                        throw new Error("«" + e + "» no es JSON válido");
                                      }
                                    }))
                                  : ((o = d("input", {
                                      a: {
                                        type: "text",
                                        placeholder:
                                          r.examples && r.examples[0]
                                            ? String(r.examples[0])
                                            : "Escribe aquí…",
                                      },
                                    })),
                                    void 0 !== r.default && (o.value = r.default),
                                    (n = function () {
                                      return "" === o.value.trim() ? { skip: !0 } : { v: o.value.trim() };
                                    })),
                          {
                            nodes: [
                              d("label", {
                                t:
                                  (r.description || e) +
                                  (t ? "  *" : "") +
                                  (r.description
                                    ? "   [" + e + (a ? ": " + a : "") + "]"
                                    : a
                                      ? "  [" + a + "]"
                                      : ""),
                              }),
                              o,
                            ],
                            read: n,
                          }
                        );
                      })(e, n[e], -1 !== i.indexOf(e));
                      ((l[e] = r),
                        r.nodes.forEach(function (e) {
                          o.appendChild(e);
                        }));
                    })
                  : o.appendChild(d("div", { c: "ds mu", t: "Sin parámetros." }));
                var s = d("button", {
                    c: "run",
                    t: t ? "Ejecutar (rellena el formulario)" : "Ejecutar con agente de prueba",
                  }),
                  c = d("div", { c: "out" });
                o.appendChild(s);
                var p = d("div", { c: "sub" }),
                  v = d("button", { c: "ib", t: "Copiar schema" });
                if (
                  ((v.onclick = function () {
                    m(r.schemaRaw || "{}").then(function () {
                      f(v, "✓ copiado");
                    });
                  }),
                  p.appendChild(v),
                  t && r.form && r.form.el)
                ) {
                  var h = d("button", { c: "ib", t: "Ir al formulario" });
                  ((h.onclick = function () {
                    var e = r.form.el;
                    try {
                      e.scrollIntoView({ behavior: "smooth", block: "center" });
                    } catch (e) {}
                    var t = e.style.outline;
                    ((e.style.outline = "3px solid #3b82f6"),
                      setTimeout(function () {
                        e.style.outline = t;
                      }, 2500));
                  }),
                    p.appendChild(h));
                }
                return (
                  o.appendChild(p),
                  o.appendChild(c),
                  (s.onclick = async function () {
                    ((c.style.display = "block"), c.replaceChildren(d("div", { c: "mu", t: "Ejecutando…" })));
                    var o = {};
                    try {
                      a.forEach(function (e) {
                        var r = l[e].read();
                        if (r.skip) {
                          if (-1 !== i.indexOf(e))
                            throw new Error("Falta el parámetro obligatorio «" + e + "»");
                        } else o[e] = r.v;
                      });
                    } catch (e) {
                      return void c.replaceChildren(d("div", { c: "msg er", t: "✖ " + u(e) }));
                    }
                    s.disabled = !0;
                    var n,
                      p = performance.now(),
                      m = null;
                    if (t) {
                      try {
                        r.form.el.scrollIntoView({ behavior: "smooth", block: "center" });
                      } catch (e) {}
                      m = setTimeout(function () {
                        c.appendChild(
                          d("div", {
                            c: "note",
                            t: "Herramienta declarativa: el navegador rellena el formulario y espera a que lo envíes tú (o a que tenga toolautosubmit). Envíalo en la página para que se resuelva.",
                          }),
                        );
                      }, 3e3);
                    }
                    T("Ejecutando «" + r.name + "» " + JSON.stringify(o));
                    try {
                      var f = await (async function (e, r, t) {
                          if ("function" == typeof r.raw.execute)
                            return { how: "tool.execute()", value: await r.raw.execute(t, z) };
                          var o = e.api.obj;
                          if ("function" != typeof o.executeTool)
                            throw new Error("Esta implementación no expone executeTool().");
                          var n,
                            a = JSON.stringify(t),
                            i = [
                              ["executeTool(tool, json)", [r.raw, a]],
                              ["executeTool(nombre, json)", [r.name, a]],
                              ["executeTool(tool, objeto)", [r.raw, t]],
                              ["executeTool(nombre, objeto)", [r.name, t]],
                            ];
                          ("listTools" === e.api.mode && i.unshift(i.splice(1, 1)[0]),
                            I &&
                              (i = i.filter(function (e) {
                                return e[0] === I;
                              })));
                          for (var l = 0; l < i.length; l++)
                            try {
                              var s = await o.executeTool.apply(o, i[l][1]);
                              return ((I = i[l][0]), { how: i[l][0], value: s });
                            } catch (e) {
                              if (!e || "TypeError" !== e.name) throw e;
                              n = e;
                            }
                          throw n;
                        })(e, r, o),
                        v =
                          (n = f.value) && Array.isArray(n.content)
                            ? n.content
                                .map(function (e) {
                                  return e && e.text ? e.text : JSON.stringify(e);
                                })
                                .join("\n\n")
                            : "object" == typeof n
                              ? JSON.stringify(n, null, 2)
                              : String(n);
                      (c.replaceChildren(),
                        (-1 !== v.indexOf("\n")
                          ? v.split("\n").filter(function (e) {
                              return e.trim();
                            })
                          : [v]
                        ).forEach(function (e) {
                          c.appendChild(
                            (function (e) {
                              var r = d("div", { c: "res" }),
                                t = e.split(" — "),
                                o = t.length > 1 ? t[1].trim() : "";
                              return (
                                /^https?:\/\//i.test(o)
                                  ? (r.appendChild(d("div", { c: "rt", t: t[0] })),
                                    r.appendChild(
                                      d("a", {
                                        t: o,
                                        a: { href: o, target: "_blank", rel: "noopener noreferrer" },
                                      }),
                                    ))
                                  : (r.textContent = e),
                                r
                              );
                            })(e.trim()),
                          );
                        }));
                      var h = d("details", {}, [
                        d("summary", { t: "Respuesta en bruto" }),
                        d("pre", {
                          t: "string" == typeof f.value ? f.value : JSON.stringify(f.value, null, 2),
                        }),
                      ]);
                      (c.appendChild(h),
                        c.appendChild(
                          d("div", { c: "ft", t: f.how + " · " + Math.round(performance.now() - p) + " ms" }),
                        ),
                        T("«" + r.name + "» resuelta en " + Math.round(performance.now() - p) + " ms"));
                    } catch (e) {
                      (c.replaceChildren(d("div", { c: "msg er", t: "✖ Error: " + u(e) })),
                        T("«" + r.name + "» falló: " + u(e)));
                    } finally {
                      (m && clearTimeout(m), (s.disabled = !1));
                    }
                  }),
                  r.schemaRaw &&
                    o.appendChild(
                      d("details", {}, [
                        d("summary", { t: "inputSchema" }),
                        d("pre", { t: JSON.stringify(r.schema, null, 2) }),
                      ]),
                    ),
                  o
                );
              })(e, r),
            );
          }))
        : e.api &&
          !e.error &&
          x.appendChild(d("div", { c: "is mu", t: "No hay herramientas registradas en esta página." })),
      e.forms.length &&
        (x.appendChild(d("div", { c: "sec", t: "Auditoría de formularios anotados (DOM)" })),
        e.forms.forEach(function (e) {
          x.appendChild(
            (function (e) {
              var r = e.errors.length || !1 === e.registered ? "er" : e.warnings.length ? "wa" : "ok",
                t = d("div", { c: "card st-" + r });
              if (
                (t.appendChild(
                  d("div", { c: "top" }, [
                    d("span", { c: "nm", t: "📝 " + (e.name || "(sin toolname)") }),
                    d("span", {
                      c: "bg " + r,
                      t: "ok" === r ? "correcto" : "wa" === r ? "mejorable" : "con errores",
                    }),
                  ]),
                ),
                t.appendChild(d("div", { c: "ds", t: e.description || "(sin tooldescription)" })),
                e.errors.forEach(function (e) {
                  t.appendChild(d("div", { c: "is er", t: "✖ " + e }));
                }),
                e.warnings.forEach(function (e) {
                  t.appendChild(d("div", { c: "is wa", t: "▲ " + e }));
                }),
                e.fields.length)
              ) {
                var o = e.fields
                  .map(function (e) {
                    return (
                      (e.name || "?") +
                      " (" +
                      e.type +
                      ")" +
                      (e.required ? "*" : "") +
                      (e.paramDescription ? " – " + e.paramDescription : "")
                    );
                  })
                  .join("\n");
                t.appendChild(
                  d("details", {}, [
                    d("summary", { t: "Campos (" + e.fields.length + ")" }),
                    d("pre", { t: o }),
                  ]),
                );
              }
              var n = d("button", { c: "ib", t: "Ir al formulario", a: { style: "margin-top:6px" } });
              return (
                (n.onclick = function () {
                  try {
                    e.el.scrollIntoView({ behavior: "smooth", block: "center" });
                  } catch (e) {}
                  var r = e.el.style.outline;
                  ((e.el.style.outline = "3px solid #3b82f6"),
                    setTimeout(function () {
                      e.el.style.outline = r;
                    }, 2500));
                }),
                t.appendChild(n),
                t
              );
            })(e),
          );
        })),
      x.appendChild(d("div", { c: "sec", t: "Eventos" })),
      x.appendChild(d("pre", { t: S.join("\n") || "(sin eventos todavía)", a: { id: "wm-ev" } })),
      x.appendChild(
        d("div", {
          c: "ft",
          t: "Nota: «declarativa» se deduce porque existe un formulario con ese toolname; getTools() no distingue el origen.",
        }),
      ));
  }
  async function q(e) {
    var r,
      t = ++L;
    e && x.replaceChildren(d("div", { c: "mu", t: "Analizando…" }));
    try {
      r = await (async function () {
        var e,
          r = {
            url: location.href,
            date: new Date().toISOString(),
            secure: !1 !== window.isSecureContext,
            visible: "visible" === document.visibilityState,
            api: null,
            present: [],
            apiNote: "",
            error: null,
            tools: [],
            forms: B(),
            iframesBlocked: N,
          },
          t = [
            ["document.modelContext", document.modelContext],
            ["navigator.modelContext", navigator.modelContext],
          ],
          o = null;
        if (
          (t.forEach(function (e) {
            (e[1] && r.present.push(e[0]),
              !o &&
                e[1] &&
                "function" == typeof e[1].getTools &&
                (o = { name: e[0], obj: e[1], mode: "getTools" }));
          }),
          !o &&
            navigator.modelContextTesting &&
            "function" == typeof navigator.modelContextTesting.listTools &&
            ((o = {
              name: "navigator.modelContextTesting (API antigua)",
              obj: navigator.modelContextTesting,
              mode: "listTools",
            }),
            r.present.push("navigator.modelContextTesting")),
          !o)
        )
          return (
            (r.apiNote = r.present.length
              ? "La API existe (" +
                r.present.join(", ") +
                ") pero no expone getTools(): no se pueden enumerar las herramientas."
              : "No existe document.modelContext ni navigator.modelContext en este navegador/pestaña."),
            r
          );
        r.api = o;
        try {
          var n = await ((e = "getTools" === o.mode ? o.obj.getTools() : o.obj.listTools()),
          new Promise(function (r, t) {
            var o = setTimeout(function () {
              t(new Error("Tiempo de espera agotado (5 s)"));
            }, 5e3);
            Promise.resolve(e).then(
              function (e) {
                (clearTimeout(o), r(e));
              },
              function (e) {
                (clearTimeout(o), t(e));
              },
            );
          }));
          r.tools = Array.prototype.slice.call(n || []).map(function (e) {
            var r = (function (e) {
              if (!e) return { schema: {}, raw: "" };
              if ("string" == typeof e)
                try {
                  return { schema: JSON.parse(e), raw: e };
                } catch (r) {
                  return { schema: {}, raw: e };
                }
              return { schema: e, raw: JSON.stringify(e) };
            })(e.inputSchema);
            return {
              raw: e,
              name: e.name || "(sin nombre)",
              description: e.description || "",
              schema: r.schema,
              schemaRaw: r.raw,
              annotations: e.annotations || null,
              kind: "imperativa",
              form: null,
            };
          });
        } catch (e) {
          r.error = e;
        }
        var a = {};
        if (
          (r.forms.forEach(function (e) {
            !e.name || e.duplicate || a[e.name] || (a[e.name] = e);
          }),
          r.tools.forEach(function (e) {
            a[e.name] && ((e.kind = "declarativa"), (e.form = a[e.name]));
          }),
          !r.error && "getTools" === o.mode)
        ) {
          var i = {};
          (r.tools.forEach(function (e) {
            i[e.name] = !0;
          }),
            r.forms.forEach(function (e) {
              e.errors.length ||
                ((e.registered = !!i[e.name]),
                e.registered ||
                  e.warnings.unshift(
                    "Anotación completa pero NO aparece en getTools() (¿pestaña no visible, flag desactivado, document.domain activo o recién añadida?)",
                  ));
            }));
        }
        return r;
      })();
    } catch (e) {
      return void x.replaceChildren(d("div", { c: "msg er", t: "✖ Error inesperado: " + u(e) }));
    }
    if (t === L) {
      P = r;
      var o = (function (e) {
        return JSON.stringify([
          e.api && e.api.name,
          !!e.error,
          e.visible,
          e.tools.map(function (e) {
            return [e.name, e.description, e.schemaRaw, e.kind];
          }),
          e.forms.map(function (e) {
            return [e.name, e.description, e.errors, e.warnings, e.registered];
          }),
        ]);
      })(r);
      (e || o !== M) &&
        ((M = o),
        R(r),
        (function (e) {
          if (e.api && J !== e.api.obj) {
            J = e.api.obj;
            var r = e.api.obj;
            "function" == typeof r.addEventListener &&
              ["toolchange", "toolactivated", "toolcancel"].forEach(function (e) {
                var t = function (r) {
                  (T(e + (r && r.toolName ? " · " + r.toolName : "")), "toolchange" === e && U());
                };
                (r.addEventListener(e, t), _.push([r, e, t]));
              });
          }
        })(r));
    }
  }
  var J = null,
    _ = [],
    H = null;
  function U() {
    (clearTimeout(H),
      (H = setTimeout(function () {
        q(!1);
      }, 350)));
  }
  var W = null;
  try {
    (W = new MutationObserver(function (e) {
      e.some(function (e) {
        var r = e.target;
        if (r === i || (r.getRootNode && r.getRootNode() === l)) return !1;
        if ("childList" === e.type) {
          var t = Array.prototype.slice.call(e.addedNodes).concat(Array.prototype.slice.call(e.removedNodes));
          if (
            t.length &&
            t.every(function (e) {
              return e === i;
            })
          )
            return !1;
        }
        return !0;
      }) && U();
    })).observe(document.documentElement, {
      subtree: !0,
      childList: !0,
      attributes: !0,
      attributeFilter: ["toolname", "tooldescription", "toolautosubmit", "toolparamdescription"],
    });
  } catch (e) {}
  function V() {
    U();
  }
  function X(e) {
    return String(null == e ? "" : e)
      .replace(/\|/g, "\\|")
      .replace(/\n/g, " ");
  }
  function Y(e) {
    return JSON.stringify(
      {
        url: e.url,
        date: e.date,
        api: e.api ? e.api.name : null,
        apiNote: e.apiNote,
        secureContext: e.secure,
        visible: e.visible,
        verdict: D(e),
        tools: e.tools.map(function (e) {
          return {
            name: e.name,
            kind: e.kind,
            description: e.description,
            annotations: e.annotations,
            inputSchema: e.schema,
          };
        }),
        forms: e.forms.map(function (e) {
          return {
            toolname: e.name,
            tooldescription: e.description,
            autosubmit: e.autosubmit,
            registered: e.registered,
            errors: e.errors,
            warnings: e.warnings,
            fields: e.fields,
          };
        }),
        iframesNotInspectable: e.iframesBlocked,
      },
      null,
      2,
    );
  }
  (document.addEventListener("visibilitychange", V),
    (w.onclick = function () {
      ((M = ""), q(!0));
    }),
    (y.onclick = function () {
      var e, r, t;
      P &&
        m(
          ((e = P),
          (r = D(e)),
          (t = []),
          t.push("# Informe WebMCP"),
          t.push(""),
          t.push("- **URL:** " + e.url),
          t.push("- **Fecha:** " + e.date),
          t.push(
            "- **API detectada:** " + (e.api ? e.api.name : "ninguna") + (e.apiNote ? " — " + e.apiNote : ""),
          ),
          t.push("- **Contexto seguro (HTTPS):** " + (e.secure ? "sí" : "no")),
          t.push("- **Pestaña visible:** " + (e.visible ? "sí" : "no")),
          t.push("- **Veredicto:** " + r.txt),
          t.push(""),
          t.push("## Herramientas registradas (" + e.tools.length + ")"),
          t.push(""),
          e.tools.length
            ? (t.push("| Nombre | Tipo | Descripción | Parámetros |"),
              t.push("|---|---|---|---|"),
              e.tools.forEach(function (e) {
                var r = (e.schema && e.schema.properties) || {};
                t.push(
                  "| `" +
                    X(e.name) +
                    "` | " +
                    e.kind +
                    " | " +
                    X(e.description) +
                    " | " +
                    X(Object.keys(r).join(", ") || "—") +
                    " |",
                );
              }))
            : t.push("_Ninguna._"),
          t.push(""),
          t.push("## Formularios anotados (" + e.forms.length + ")"),
          t.push(""),
          e.forms.length
            ? e.forms.forEach(function (e) {
                (t.push("### `" + (e.name || "sin toolname") + "`"),
                  t.push(""),
                  t.push("- Descripción: " + (e.description || "_(vacía)_")),
                  t.push(
                    "- Campos: " +
                      (e.fields.length
                        ? e.fields
                            .map(function (e) {
                              return "`" + (e.name || "?") + "`";
                            })
                            .join(", ")
                        : "—"),
                  ),
                  t.push("- toolautosubmit: " + (e.autosubmit ? "sí" : "no")),
                  e.errors.forEach(function (e) {
                    t.push("- ✖ " + e);
                  }),
                  e.warnings.forEach(function (e) {
                    t.push("- ▲ " + e);
                  }),
                  e.errors.length || e.warnings.length || t.push("- ✓ Sin incidencias"),
                  t.push(""));
              })
            : t.push("_Ninguno._"),
          e.iframesBlocked &&
            t.push("\n> " + e.iframesBlocked + " iframe(s) de otro origen no se han podido inspeccionar."),
          t.push(""),
          t.push(
            "_Nota: WebMCP es un borrador en evolución; la clasificación declarativa/imperativa se deduce por coincidencia de nombre con un formulario anotado._",
          ),
          t.join("\n")),
        ).then(function (e) {
          f(y, e ? "✓" : "✗");
        });
    }),
    (k.onclick = function () {
      if (P)
        try {
          var e = new Blob([Y(P)], { type: "application/json" }),
            r = document.createElement("a");
          ((r.href = URL.createObjectURL(e)),
            (r.download = "webmcp-" + location.hostname.replace(/[^a-z0-9.-]/gi, "_") + ".json"),
            document.body.appendChild(r),
            r.click(),
            setTimeout(function () {
              (URL.revokeObjectURL(r.href), r.remove());
            }, 500));
        } catch (e) {
          m(Y(P)).then(function (e) {
            f(k, e ? "copiado" : "✗");
          });
        }
    }));
  var G = "auto";
  function K() {
    (clearTimeout(H),
      W && W.disconnect(),
      document.removeEventListener("visibilitychange", V),
      _.forEach(function (e) {
        try {
          e[0].removeEventListener(e[1], e[2]);
        } catch (e) {}
      }),
      (_ = []));
  }
  ((C.onclick = function () {
    ("auto" == (G = "auto" === G ? "light" : "light" === G ? "dark" : "auto")
      ? b.removeAttribute("data-theme")
      : b.setAttribute("data-theme", G),
      f(C, { auto: "Auto", light: "Claro", dark: "Oscuro" }[G]));
  }),
    (E.onclick = function () {
      (b.classList.toggle("min"), (E.textContent = b.classList.contains("min") ? "+" : "–"));
    }),
    (i.__wmCleanup = K),
    (A.onclick = function () {
      (K(), i.remove());
    }),
    q(!0));
})();
void 0;