{% import 'macros/flash.html' as flash with context %}
{% import 'billing/macros/billing.html' as billing with context %}

<!DOCTYPE html>
<html>
  <head>
    <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="description"
          content="{% block meta_description %}{% endblock %}">
    <meta name="csrf-token" content="{{ csrf_token() }}">

    <title>{% block title %}{% endblock %}</title>

    <link
      rel="stylesheet"
      href="{{ static_url_for('static', filename='css/app.css') }}">
    <script defer src="{{ url_for('static', filename='js/app.js') }}"></script>
    <script src="https://js.stripe.com/v2/"></script>

    {% if config['ANALYTICS_GOOGLE_UA'] %}
      <script>
        (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
        (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
        m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
        })(window,document,'script','https://www.google-analytics.com/analytics.js','ga');

        ga('create', "{{ config['ANALYTICS_GOOGLE_UA'] }}", 'auto');
        ga('send', 'pageview');
      </script>
    {% endif %}
  </head>
  <body>
    {{ billing.card_expiring_warning() }}

    {% block header %}{% endblock %}

    <main class="container mb-5">
      {{ flash.render() }}
      {% block body %}{% endblock %}
    </main>

    <footer class="footer text-center">
      <div class="container">
        <ul class="list-inline">
          <li class="list-inline-item text-muted">
            Snake Eyes &copy; {{ current_year() }}
          </li>
          {% block footer %}{% endblock %}
        </ul>
      </div>
    </footer>
  </body>
</html>
