<script type="text/javascript">
    var BASEURL = "{{ url_for('index') }}";
    var API_BASEURL = BASEURL + "api/";
    var PLUGIN_BASEURL = BASEURL + "plugin/";

    var CONFIG_DEBUG = {%  if debug -%} true; {% else %} false; {%- endif %}
    var CONFIG_LOADINGANIMATION = {% if enableLoadingAnimation -%} true; {% else %} false; {%- endif %}

    var CONFIG_GCODEFILESPERPAGE = 5000;
    var CONFIG_TIMELAPSEFILESPERPAGE = 10;
    var CONFIG_LOGFILESPERPAGE = 10;
    var CONFIG_USERSPERPAGE = 10;
    var CONFIG_GROUPSPERPAGE = 10;
    var CONFIG_SD_SUPPORT = {% if enableSdSupport -%} true; {% else %} false; {%- endif %}
    var CONFIG_FIRST_RUN = {%  if firstRun -%} true; {% else %} false; {%- endif %}
    var CONFIG_TEMPERATURE_GRAPH = {%  if enableTemperatureGraph -%} true; {% else %} false; {%- endif %}
    var CONFIG_WIZARD = {% if wizard -%} true; {% else %} false; {%- endif %}
    var CONFIG_REAUTHENTICATION_TIMEOUT = {{ reauthenticationTimeout }};

    var SOCKJS_URI = "{{ url_for('index') }}" + "sockjs";
    var SOCKJS_DEBUG = CONFIG_DEBUG;
    var SOCKJS_CONNECT_TIMEOUT = {{ sockJsConnectTimeout }};
    // sockjs should define CLOSE_NORMAL for us, but they don't (from ws spec)
    var SOCKJS_CLOSE_NORMAL = 1000;

    var VERSION = "{{ version.number }}";
    var DISPLAY_VERSION = "{{ version.display }}";
    var BRANCH = "{{ version.branch }}";
    var PYTHON_VERSION = "{{ python_version }}";
    var LOCALE = "{{ g.locale }}";
    var AVAILABLE_LOCALES = {{ locales|tojson }};
    var SUPPORTED_FILETYPES = {{ supportedFiletypes|tojson }};
    var SUPPORTED_EXTENSIONS = {{ supportedExtensions|tojson }};

    var PERMISSIONS = {{ permissions|tojson }};
    var ONLINE = {% if online -%}true{% else %}false{%- endif %};

    var OCTOPRINT_VIEWMODELS = [];
    var ADDITIONAL_VIEWMODELS = [];
    var OCTOPRINT_ADDITIONAL_BINDINGS = [];

    // deprecated stuff only kept for backwards compatibility goes here
    var CONFIG_WEBCAM_STREAM = "{{ webcamStream }}"; // deprecated, only left for compatibility reasons
    var CONFIG_ACCESS_CONTROL = true; // deprecated, only left for compatibility reasons
    var CONFIG_ACCESS_CONTROL_ACTIVE = {% if accessControlActive -%} true; {% else %} false; {%- endif %}; // deprecated, only left for compatibility reasons
    var UI_API_KEY = ""; // deprecated, only left for compatibility reasons
    // end of deprecated stuff

    {% if templates.tab.order %}
        {% set first_tab = templates.tab.order[0] %}
        {% set entry, data = templates.tab.entries[first_tab] %}
        var OCTOPRINT_INITIAL_TAB = "#{{ data._div }}";
    {% else %}
        var OCTOPRINT_INITIAL_TAB = undefined;
    {% endif %}

    {% if templates.wizard and templates.wizard.order %}
        {% set first_tab = templates.wizard.order[0] %}
        {% set entry, data = templates.wizard.entries[first_tab] %}
        var OCTOPRINT_INITIAL_WIZARD = "#{{ data._div }}";
    {% else %}
        var OCTOPRINT_INITIAL_WIZARD = undefined;
    {% endif %}
</script>
