<!doctype html>
<html lang="en">

<head>
  <meta charset="UTF-8" />
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
  <meta name="description" content="Documentation built with PraisonAIUI" />
  <meta name="robots" content="index, follow" />
  <meta property="og:type" content="website" />
  <meta property="og:locale" content="en_US" />
  <link rel="icon" type="image/svg+xml" href="/icon.svg" />
  <title>Documentation</title>
  <script type="module" crossorigin src="/assets/index.js"></script>
  <link rel="stylesheet" crossorigin href="/assets/index.css">
</head>

<body>
  <div id="root"></div>
  <script>
    // AIUI Plugin System — inline bootstrap
    (function () {
      var plugins = [];
      function notify() {
        var root = document.getElementById('root');
        if (!root) return;
        plugins.forEach(function (p) {
          try { if (typeof p.onContentChange === 'function') p.onContentChange(root) }
          catch (e) { console.warn('[AIUI] plugin error:', p.name, e) }
        });
      }
      function observe() {
        var root = document.getElementById('root');
        if (!root) return;
        var t;
        new MutationObserver(function () { clearTimeout(t); t = setTimeout(notify, 200) })
          .observe(root, { childList: true, subtree: true });
      }
      fetch('/plugins/plugins.json').then(function (r) { return r.json() }).then(function (cfg) {
        var names = cfg.plugins || [];
        if (!names.length) return;
        Promise.allSettled(names.map(function (name) {
          return import('/plugins/' + name + '.js').then(function (mod) {
            var p = mod.default || mod; p.name = p.name || name;
            if (typeof p.init === 'function') return Promise.resolve(p.init()).then(function () { plugins.push(p) });
            plugins.push(p);
          }).catch(function (e) { console.warn('[AIUI] failed:', name, e) });
        })).then(function () {
          observe();
          // Two-stage: immediate for fast plugins, delayed for CDN loads (mermaid)
          setTimeout(notify, 300);
          setTimeout(notify, 3000);
          console.debug('[AIUI]', plugins.length, 'plugin(s) active');
        });
      }).catch(function () { });
    })();
  </script>
</body>

</html>