       });
      }
    } catch (err) {
      console.error('Mermaid initialization error:', err);
    }
  }
  
  // Try to use mermaid if it's already loaded
  if (typeof window.mermaid !== 'undefined') {
    initMermaid();
  } else {
    // Load mermaid if it's not available
    console.log('Loading mermaid from mermaid.html partial');
    var script = document.createElement('script');
    script.src = 'https://cdn.jsdelivr.net/npm/mermaid@9.4.3/dist/mermaid.min.js';
    script.onload = function() {
      