<!DOCTYPE html>
<html lang="en"
  data-theme="<%= current_user.preferences.theme %>"
  data-controller="theme"
  data-theme-preferences-path-value="<%= main_app.preferences_path %>">
  
  <head>
    <title><%= page_title %></title>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=0, minimum-scale=1.0, maximum-scale=1.0">
    <meta name="mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <meta name="current-user-id" content="<%= current_user.id %>">
    <meta name="integrations" content="<%= Dradis::Plugins::with_feature(:addon) %>">
    <% if flash.any? %>
      <% # when flash messages present, disable turbolinks cache to avoid
        # the message appear and disappear in the next page load %>
      <meta name="turbo-cache-control" content="reload">
    <% end %>

    <%= render 'comments/mentionable_users' if @mentionable_users %>

    <%= favicon_link_tag 'favicon.ico', data: { 
      behavior: 'favicon', 
      unread: image_path('favicon-unread.ico'), 
      read: image_path('favicon.ico') 
    } %>

    <%= action_cable_meta_tag %>
    <%= stylesheet_link_tag 'hera', media: 'all', 'data-turbo-track' => true %>
    <%= javascript_include_tag 'hera', 'data-turbo-track' => true %>
    <%= csrf_meta_tag %>
    <%= csp_meta_tag %>
    <%= javascript_importmap_tags %>
    <% cache [:analytics, ::Configuration.usage_sharing_enabled?] do %>
      <%= render 'layouts/plausible' if ::Configuration.usage_sharing_enabled? %>
    <% end %>
  </head>

  <%= 
    content_tag(
      :body, 
      class: body_css,
      data: {
        env: (Rails.env unless Rails.env.production?),
      } 
    ) do %>

    <header class="sticky-top">
      <%= render 'layouts/hera/navbar/main_nav' %>
      <%= yield(:sub_nav) if content_for?(:sub_nav) %>
    </header>

    <div class="content-grid">
      <aside>
        <%= yield(:node_sidebar) if content_for?(:node_sidebar) %>
      </aside>
      <div class="view-content" data-behavior="view-content">
        <main class="container-fluid">
          <%= content_for?(:breadcrumbs) ? yield(:breadcrumbs) : '' %>
          <%= render 'layouts/hera/noscript' %>
          <%= render 'layouts/hera/project_teaser' unless defined?(Dradis::Pro) %>
          <%= flash_messages %>
          <%= content_for?(:content) ? yield(:content) : yield %>
        </main>
        <%= render 'layouts/hera/footer' %>
      </div>
      <% if content_for?(:sidebar) %>
        <%= render "layouts/hera/secondary_sidebar" %>
      <% end %>
    </div>

    <%= yield(:poller) if content_for?(:poller) %>

    <!-- All modals go here -->
    <%= yield(:modals) if content_for?(:modals) %>
    
    <%= render 'layouts/hera/try_pro' %>

    <%= render 'console/console' %>
    <!-- End of modals -->
  <% end %>
</html>
