<!DOCTYPE html>
<html lang="{{ translate.jsShortLocale }}">
    <head>
        <title>{% block title %}{% endblock %}{{ theme.getThemeConfig("theme_title") }}</title>
        <meta charset="utf-8">
        <meta http-equiv="X-UA-Compatible" content="IE=edge">
        <meta name="viewport" content="width=device-width, initial-scale=1">
        <meta name="token" content="{{ csrfToken }}"/>
        <meta name="public-path" content="{{ theme.rootUri() }}"/>
        <link rel="shortcut icon" href="{{ theme.uri("img/favicon.ico") }}" />
        
        {# Import CSS bundle from dist #}
        <script src="{{ theme.rootUri() }}dist/style.bundle.min.js?v={{ version }}&rev={{revision}}" nonce="{{ cspNonce }}"></script>

        {# Import user made CSS from theme #}
        <link href="{{ theme.uri("css/dashboard.css") }}?v={{ version }}&rev={{revision}}" rel="stylesheet" media="screen">
        <link href="{{ theme.uri("css/timeline.css") }}?v={{ version }}&rev={{revision}}" rel="stylesheet" media="screen">
        <link href="{{ theme.uri("css/xibo.css") }}?v={{ version }}&rev={{revision}}" rel="stylesheet" media="screen">
        <link href="{{ theme.uri("css/calendar.css") }}?v={{ version }}&rev={{revision}}" rel="stylesheet" media="screen">
        <link href="{{ theme.uri("css/override.css") }}?v={{ version }}&rev={{revision}}" rel="stylesheet" media="screen">
        <link href="{{ theme.uri("css/print.css") }}?v={{ version }}&rev={{revision}}" rel="stylesheet">
        <link href="{{ url_for("library.font.css") }}" rel="stylesheet">
        <!-- Copyright 2006-{{ 'now' | date('Y') }} Xibo Signage Ltd. Part of the Xibo Open Source Digital Signage Solution. Released under the AGPLv3 or later. -->
        <!-- Please be sure you read this before removing the Source/About links from your theme: http://bit.ly/agplv3 -->
        {% block headContent %}{% endblock %}
    </head>
    <body>
        {% block content %}{% endblock %}
        <script type="text/javascript" nonce="{{ cspNonce }}">
            var CALENDAR_TYPE = "{{ settings.CALENDAR_TYPE }}";
            var jsLocale = "{{ translate.jsLocale }}";
            var jsShortLocale = "{{ translate.jsShortLocale }}";
        </script>

        {# Import JS bundle from dist #}
        <script src="{{ theme.rootUri() }}dist/vendor.bundle.min.js?v={{ version }}&rev={{revision}}" nonce="{{ cspNonce }}"></script>

        {# Import JS system tools #}
        <script src="{{ theme.rootUri() }}dist/systemTools.bundle.min.js?v={{ version }}&rev={{revision}}" nonce="{{ cspNonce }}"></script>
        
        {# Import JS templates #}
        <script src="{{ theme.rootUri() }}dist/templates.bundle.min.js?v={{ version }}&rev={{revision}}" nonce="{{ cspNonce }}"></script>

        {# Import XIBO js files #}
        <script src="{{ theme.rootUri() }}dist/datatables.bundle.min.js?v={{ version }}&rev={{revision}}" nonce="{{ cspNonce }}"></script>
        <script src="{{ theme.rootUri() }}dist/xibo.bundle.min.js?v={{ version }}&rev={{revision}}" nonce="{{ cspNonce }}"></script>
        {# Dates #}
        {% if settings.CALENDAR_TYPE == "Jalali" %}
            <script src="{{ theme.rootUri() }}dist/vendor/calendar/js/calendar-jalali.js?v={{ version }}&rev={{revision}}" nonce="{{ cspNonce }}"></script>
            <script type="text/javascript" nonce="{{ cspNonce }}">
                moment.loadPersian();
            </script>
        {% else %}
            <script src="{{ theme.rootUri() }}dist/vendor/calendar/js/calendar.js?v={{ version }}&rev={{revision}}" nonce="{{ cspNonce }}"></script>
        {% endif %}

        {# Handle the inclusion of i18n #}
        {% set calendarTranslation %}dist/vendor/calendar/js/language/{{ translate.jsShortLocale }}.js{% endset %}
        {% if theme.fileExists(calendarTranslation) %}
            <script src="{{ theme.rootUri() }}{{ calendarTranslation }}" nonce="{{ cspNonce }}"></script>
        {% endif %}

        {% include "globalTranslations.twig" %}
        {% include "globalVars.twig" %}
        {% include "globalConfig.twig" %}
        
        {% block javaScriptTemplates %}{% endblock %}
        {% block javaScript %}{% endblock %}

        {% include "theme-javascript.twig" ignore missing %}
    </body>
</html>
