<script type="text/javascript">
    var BASEURL = "{{ url_for('index') }}";
    var API_BASEURL = BASEURL + "api/";
    var PLUGIN_BASEURL = BASEURL + "plugin/";
    var GCODE_WORKER = "{{ url_for('static', filename='gcodeviewer/js/Worker.js') }}";

    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_WEBCAM_STREAM = "{{ webcamStream|e }}"; // deprecated, only left for compatibility reasons
    var CONFIG_ACCESS_CONTROL = {% if enableAccessControl -%} true; {% else %} false; {%- endif %}
    var CONFIG_ACCESS_CONTROL_ACTIVE = {% if accessControlActive -%} true; {% else %} false; {%- endif %}
    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_GCODE_SIZE_THRESHOLD = {{ gcodeThreshold|e }};
    var CONFIG_GCODE_MOBILE_SIZE_THRESHOLD = {{ gcodeMobileThreshold|e }};
    var CONFIG_WIZARD = {% if wizard -%} true; {% else %} false; {%- endif %}

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

    var UI_API_KEY = ""; // deprecated, only left for compatibility reasons
    var VERSION = "{{ version.number|e }}";
    var DISPLAY_VERSION = "{{ version.display|e }}";
    var BRANCH = "{{ version.branch|e }}";
    var LOCALE = "{{ g.locale|e }}";
    var AVAILABLE_LOCALES = {{ locales|tojson }};
    var SUPPORTED_FILETYPES = {{ supportedFiletypes|tojson }};
    var SUPPORTED_EXTENSIONS = {{ supportedExtensions|tojson }};

    var PERMISSIONS = {{ permissions|tojson }};

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

    {% 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>
