{% comment %}
Copyright (C) 2021-2025  The Software Heritage developers
See the AUTHORS file at the top-level directory of this distribution
License: GNU Affero General Public License version 3, or any later version
See top-level LICENSE file for more information
{% endcomment %}

<!DOCTYPE html>
{% load static %}
{% load render_bundle from webpack_loader %}
{% load swh_templatetags %}

<html lang="en">
  <head>
    <meta charset="utf-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport"
          content="width=device-width, initial-scale=1, shrink-to-fit=no" />
    <title>Software Heritage archived object</title>
    <script src="{% url 'js-reverse' %}" type="text/javascript"></script>
    {% render_bundle 'vendors' %}
    {% render_bundle 'webapp' %}
    {% render_bundle 'browse' %}
    {% render_bundle 'content' %}
    <script>
/*
@licstart  The following is the entire license notice for the JavaScript code in this page.

Copyright (C) 2021-2025  The Software Heritage developers

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as
published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU Affero General Public License for more details.

You should have received a copy of the GNU Affero General Public License
along with this program.  If not, see <https://www.gnu.org/licenses />.

@licend  The above is the entire license notice for the JavaScript code in this page.
*/
    </script>
    <style>
      .card {
        border: none;
        margin-bottom: 0 !important;
      }

      .card-header {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 80px;
        border-bottom: 1px solid rgba(0, 0, 0, 0.125);
      }

      .breadcrumbs-container {
        border-top: 1px solid rgba(0, 0, 0, 0.125);
        border-bottom: 1px solid rgba(0, 0, 0, 0.125);
        background: white;
        margin-left: -20px;
        margin-right: -20px;
        margin-bottom: 5px;
      }

      .breadcrumbs-container ul {
        padding-left: 25px;
      }

      .card-block {
        margin-top: 78px;
        overflow: auto;
      }

      .swh-content pre {
        margin-top: 5px;
        margin-bottom: 0;
        padding: 0;
      }

      .swh-directory-table {
        margin-top: 3px;
      }

      .bread-crumbs {
        font-size: large;
      }

      .hljs-ln-numbers {
        cursor: default !important;
      }

      #swh-identifiers {
        top: 60px !important;
      }

      #swh-identifiers .card-body {
        padding-top: 0;
        padding-bottom: 0;
        padding-left: 8px;
      }

    </style>
  </head>
  <body style="padding-bottom: 0;">
    <div class="wrapper link-opacity-75" style="margin-left: 0;">
      <div class="content">
        <div class="container-fluid">
          {% include "includes/sidetabs.html" %}
          <div class="card">
            <div class="card-header swh-background-gray">
              <div class="d-flex align-items-center">
                <a class="me-auto"
                   href="https://www.softwareheritage.org"
                   target="_blank"
                   rel="noopener noreferrer">
                  <div class="brand-text sitename">
                    <img src="{% static 'img/swh-logo.svg' %}"
                         style="height: 40px"
                         alt="swh logo" />
                    <span class="first-word ps-1">Software</span>
                    <span class="second-word">Heritage</span>
                  </div>
                </a>
                <div class="d-none d-md-block">
                  Navigating in
                  <img src="{% url 'swh-badge-swhid' swhid %}" alt="{{ swhid }}" />
                </div>
                <div class="ms-auto d-flex align-items-center">
                  {% if swhid != focus_swhid %}
                    <a class="d-flex align-items-center pe-2"
                       href="{% url 'browse-swhid-iframe' focus_swhid %}"
                       title="Reset view to its original state">
                      <div class="d-none d-lg-block">Reset view</div>
                      <i class="mdi mdi-refresh" aria-hidden="true"></i>
                    </a>
                  {% endif %}
                  <a class="d-none d-lg-block"
                     href="{{ archive_link }}"
                     target="_blank"
                     rel="noopener noreferrer">
                    View in the archive
                    <i class="mdi mdi-open-in-new" aria-hidden="true"></i>
                  </a>
                  <a class="d-lg-none"
                     href="{{ archive_link }}"
                     target="_blank"
                     rel="noopener noreferrer"
                     title="Go to archive">
                    <i class="mdi mdi-open-in-new" aria-hidden="true"></i>
                  </a>
                </div>
              </div>
              <div class="d-flex align-items-center breadcrumbs-container mt-1">
                {% include "includes/breadcrumbs.html" %}
              </div>
            </div>
            <div class="card-block">
              {% if error_code != 200 %}
                {% include "includes/http-error.html" %}
              {% elif object_type == "cnt" %}
                {% include "includes/content-display.html" %}
              {% elif object_type == "dir" %}
                {% include "includes/directory-display.html" %}
              {% endif %}
            </div>
          </div>
        </div>
      </div>
    </div>
    {% if "swh.web.jslicenses" in SWH_DJANGO_APPS %}
      <a href="{% url 'jslicenses' %}" rel="jslicense" style="display: none;">JavaScript license information</a>
    {% endif %}
    {% if object_type == "cnt" and lines %}
      {{ lines|swh_json_script:"lines" }}
      <script>
        const lines = swh.webapp.parseJsonScript('lines');
        setTimeout(function() {
          swh.webapp.scrollToLine(swh.webapp.highlightLine(lines[0]), 100);
          if (lines[1]) {
            swh.webapp.highlightLines(lines[0], lines[1]);
          }
        }, 500);
      </script>
    {% endif %}
  </body>
</html>
