<commit_before>{% include 'NelmioApiDocBundle::Components/motd.html.twig' %}
<style type="text/css">
    #summary { display: none; }
</style>
<script type="text/javascript">
    gotoResource = function (resourceId) {
        var $section = $('#' + resourceId).closest('.section'),
            $toggler = $('#' + resourceId + ' > .toggler');
        if (!$section.hasClass('active')) {
            $section.find('h1').trigger('click');
        }
        if ($toggler.next().is(':visible')) {
            window.location.hash = $toggler.data('href');
        } else {
            $toggler.trigger('click');
        }

        return false;
    };
    $(function() {
        {% set user = get_current_user() %}
        var userName = {{ user ? user.username|json_encode|raw : 'null' }},
            apiKey = {{ user and user.apiKeys|first ? (user.apiKeys|first).apiKey|json_encode|raw : 'null' }},
            wsseAllowed = userName && apiKey,
            serverTime = {{ 'now'|date('c', 'UTC')|json_encode|raw }},
            clientTime = new Date(),
            serverTimeOffset = Date.parse(serverTime) - clientTime,
            $apiDocLink = $('#header a').first(),
            apiDocHref = $apiDocLink.attr('href'),
            apiType = window.location.pathname.substr(apiDocHref.length + 1),
            escapeSelector = function (val) {
                return val.replace(/(:|\.|\[|\]|\{|\}|,)/g, "\\$1");
            },
            addHeader = function ($headers, headerKey, headerValue) {
                var needsHeader = true,
                    emptyHeader = null;
                $('.tuple', $headers).each(function (index, header) {
                    if ($('input.key:text[value="' + headerKey + '"]', header).length) {
                        needsHeader = false;
                    } else if (!emptyHeader
                        && $('input.key:text[value=]', header).length
                        && $('input.value:text[value=]', header).length
                    ) {
                        emptyHeader = header;
                    }
                });
                if (needsHeader) {
                    if (emptyHeader) {
                        fillHeader(emptyHeader, headerKey, headerValue);
                    } else {
                        $('button.add_header', $headers).trigger('click');
                        fillHeader($headers.find('.tuple:not(.autogenerated-header):last'), headerKey, headerValue);
                    }
                }
            },
            removeHeader = function ($headers, headerKey) {
                $('input.key:text[value="' + headerKey + '"]', $headers).closest('.tuple').remove();
            },
            getHeaderValue = function ($headers, headerKey) {
                return $('input.key:text[value="' + headerKey + '"]', $headers)
                    .closest('.tuple')
                    .find('input.value')
                    .val();
            },
            fillHeader = function (header, headerKey, headerValue) {
                $('input.key', header).val(headerKey);
                $('input.value', header).val(headerValue);
            };

        {% if not dumpContext %}
        var headerBlocks = '<div id="api_type" style="float: left; font-size: 1.2em; padding: 13px 16px;">type: ' +
                '<a href="' + apiDocHref + '">plain</a>' +
                '&nbsp;|&nbsp;' +
                '<a href="' + apiDocHref + '/rest_json_api">JSON.API</a>' +
                '</div>';
        {% if documentationPath is not null  %}
        headerBlocks += '<div id="doc_link" style="float: left; font-size: 1.2em; padding: 13px 16px;">' +
                'The documentation: <a href="{{ asset(documentationPath) }}">link</a>' +
                '</div>';
        {% endif %}
        $apiDocLink.after(headerBlocks);
        {% endif %}

        /**
         * Add the authentication type selector
         */
        $('#sandbox_configuration').prepend(
            'authentication: ' +
            '<select id="authentication_type">' +
                '<option value=""' + (!wsseAllowed ? ' selected=""' : '') + '>None</option>' +
                '<option value="wsse"' + (wsseAllowed ? ' selected=""' : ' disabled=""') + '>WSSE</option>' +
            '</select>'
        );

        /**
         * Make JSON as default body format for JSON.API sandbox
         */
        if (apiType === 'rest_json_api') {
            $('#body_format').val('json');
        }

        /**
         * Disable the request format selector for JSON.API and new implementation of REST
         */
        if (apiType === 'rest_json_api' || apiType === 'rest_plain') {
            $('#request_format').attr('disabled', 'disabled');
        }
<commit_msg>BAP-8911: Api documentation   - add link for main API documentation<commit_after>{% if not dumpContext and documentationPath is not null%}
    <div class="motd" style="font-size: 1.2em; padding: 5px 40px;">
        <a href="{{ asset(documentationPath) }}">The documentation</a>
    </div>
{% endif %}
<style type="text/css">
    #summary { display: none; }
</style>
<script type="text/javascript">
    gotoResource = function (resourceId) {
        var $section = $('#' + resourceId).closest('.section'),
            $toggler = $('#' + resourceId + ' > .toggler');
        if (!$section.hasClass('active')) {
            $section.find('h1').trigger('click');
        }
        if ($toggler.next().is(':visible')) {
            window.location.hash = $toggler.data('href');
        } else {
            $toggler.trigger('click');
        }

        return false;
    };
    $(function() {
        {% set user = get_current_user() %}
        var userName = {{ user ? user.username|json_encode|raw : 'null' }},
            apiKey = {{ user and user.apiKeys|first ? (user.apiKeys|first).apiKey|json_encode|raw : 'null' }},
            wsseAllowed = userName && apiKey,
            serverTime = {{ 'now'|date('c', 'UTC')|json_encode|raw }},
            clientTime = new Date(),
            serverTimeOffset = Date.parse(serverTime) - clientTime,
            $apiDocLink = $('#header a').first(),
            apiDocHref = $apiDocLink.attr('href'),
            apiType = window.location.pathname.substr(apiDocHref.length + 1),
            escapeSelector = function (val) {
                return val.replace(/(:|\.|\[|\]|\{|\}|,)/g, "\\$1");
            },
            addHeader = function ($headers, headerKey, headerValue) {
                var needsHeader = true,
                    emptyHeader = null;
                $('.tuple', $headers).each(function (index, header) {
                    if ($('input.key:text[value="' + headerKey + '"]', header).length) {
                        needsHeader = false;
                    } else if (!emptyHeader
                        && $('input.key:text[value=]', header).length
                        && $('input.value:text[value=]', header).length
                    ) {
                        emptyHeader = header;
                    }
                });
                if (needsHeader) {
                    if (emptyHeader) {
                        fillHeader(emptyHeader, headerKey, headerValue);
                    } else {
                        $('button.add_header', $headers).trigger('click');
                        fillHeader($headers.find('.tuple:not(.autogenerated-header):last'), headerKey, headerValue);
                    }
                }
            },
            removeHeader = function ($headers, headerKey) {
                $('input.key:text[value="' + headerKey + '"]', $headers).closest('.tuple').remove();
            },
            getHeaderValue = function ($headers, headerKey) {
                return $('input.key:text[value="' + headerKey + '"]', $headers)
                    .closest('.tuple')
                    .find('input.value')
                    .val();
            },
            fillHeader = function (header, headerKey, headerValue) {
                $('input.key', header).val(headerKey);
                $('input.value', header).val(headerValue);
            };

        {% if not dumpContext %}
        $apiDocLink.after('<div id="api_type" style="float: left; font-size: 1.2em; padding: 13px 16px;">type: ' +
            '<a href="' + apiDocHref + '">plain</a>' +
            '&nbsp;|&nbsp;' +
            '<a href="' + apiDocHref + '/rest_json_api">JSON.API</a>' +
            '</div>'
        );
        {% endif %}

        /**
         * Add the authentication type selector
         */
        $('#sandbox_configuration').prepend(
            'authentication: ' +
            '<select id="authentication_type">' +
                '<option value=""' + (!wsseAllowed ? ' selected=""' : '') + '>None</option>' +
                '<option value="wsse"' + (wsseAllowed ? ' selected=""' : ' disabled=""') + '>WSSE</option>' +
            '</select>'
        );

        /**
         * Make JSON as default body format for JSON.API sandbox
         */
        if (apiType === 'rest_json_api') {
            $('#body_format').val('json');
        }

        /**
         * Disable the request format selector for JSON.API and new implementation of REST
         */
        if (apiType === 'rest_json_api' || apiType === 'rest_plain') {
            $('#request_format').attr('disabled', 'disabled');
        }

{'fraction_non_alphanumeric': 0.16930650684931506, 'fraction_numerical': 0.0035316780821917806, 'mean_word_length': 1.6977482678983833, 'pattern_counts': {'":': 0, '<': 41, '<?xml version=': 0, '>': 43, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6986392', 'n_tokens_mistral': 2637, 'n_tokens_neox': 2503, 'n_words': 488}