var/cache/dev/twig/4a/4a1c227767df579524dced34064d9072fde94bd7354510a8d1baafb44e097b18.php line 401

Open in your IDE?
  1. <?php
  2. use Twig\Environment;
  3. use Twig\Error\LoaderError;
  4. use Twig\Error\RuntimeError;
  5. use Twig\Extension\SandboxExtension;
  6. use Twig\Markup;
  7. use Twig\Sandbox\SecurityError;
  8. use Twig\Sandbox\SecurityNotAllowedTagError;
  9. use Twig\Sandbox\SecurityNotAllowedFilterError;
  10. use Twig\Sandbox\SecurityNotAllowedFunctionError;
  11. use Twig\Source;
  12. use Twig\Template;
  13. /* @WebProfiler/Profiler/base_js.html.twig */
  14. class __TwigTemplate_c3f1b52ac51ed108def0a2be5fe9d7a88430d5cd748c00bfd7bf666e3a076fa0 extends \Twig\Template
  15. {
  16.     private $source;
  17.     private $macros = [];
  18.     public function __construct(Environment $env)
  19.     {
  20.         parent::__construct($env);
  21.         $this->source $this->getSourceContext();
  22.         $this->parent false;
  23.         $this->blocks = [
  24.         ];
  25.     }
  26.     protected function doDisplay(array $context, array $blocks = [])
  27.     {
  28.         $macros $this->macros;
  29.         $__internal_085b0142806202599c7fe3b329164a92397d8978207a37e79d70b8c52599e33e $this->extensions["Symfony\\Bundle\\WebProfilerBundle\\Twig\\WebProfilerExtension"];
  30.         $__internal_085b0142806202599c7fe3b329164a92397d8978207a37e79d70b8c52599e33e->enter($__internal_085b0142806202599c7fe3b329164a92397d8978207a37e79d70b8c52599e33e_prof = new \Twig\Profiler\Profile($this->getTemplateName(), "template""@WebProfiler/Profiler/base_js.html.twig"));
  31.         $__internal_319393461309892924ff6e74d6d6e64287df64b63545b994e100d4ab223aed02 $this->extensions["Symfony\\Bridge\\Twig\\Extension\\ProfilerExtension"];
  32.         $__internal_319393461309892924ff6e74d6d6e64287df64b63545b994e100d4ab223aed02->enter($__internal_319393461309892924ff6e74d6d6e64287df64b63545b994e100d4ab223aed02_prof = new \Twig\Profiler\Profile($this->getTemplateName(), "template""@WebProfiler/Profiler/base_js.html.twig"));
  33.         // line 3
  34.         echo "<script";
  35.         if (((isset($context["csp_script_nonce"]) || array_key_exists("csp_script_nonce"$context)) && (isset($context["csp_script_nonce"]) || array_key_exists("csp_script_nonce"$context) ? $context["csp_script_nonce"] : (function () { throw new RuntimeError('Variable "csp_script_nonce" does not exist.'3$this->source); })()))) {
  36.             echo " nonce=\"";
  37.             echo twig_escape_filter($this->env, (isset($context["csp_script_nonce"]) || array_key_exists("csp_script_nonce"$context) ? $context["csp_script_nonce"] : (function () { throw new RuntimeError('Variable "csp_script_nonce" does not exist.'3$this->source); })()), "html"nulltrue);
  38.             echo "\"";
  39.         }
  40.         echo ">/*<![CDATA[*/
  41.     ";
  42.         // line 7
  43.         echo "
  44.     Sfjs = (function() {
  45.         \"use strict\";
  46.         if ('classList' in document.documentElement) {
  47.             var hasClass = function (el, cssClass) { return el.classList.contains(cssClass); };
  48.             var removeClass = function(el, cssClass) { el.classList.remove(cssClass); };
  49.             var addClass = function(el, cssClass) { el.classList.add(cssClass); };
  50.             var toggleClass = function(el, cssClass) { el.classList.toggle(cssClass); };
  51.         } else {
  52.             var hasClass = function (el, cssClass) { return el.className.match(new RegExp('\\\\b' + cssClass + '\\\\b')); };
  53.             var removeClass = function(el, cssClass) { el.className = el.className.replace(new RegExp('\\\\b' + cssClass + '\\\\b'), ' '); };
  54.             var addClass = function(el, cssClass) { if (!hasClass(el, cssClass)) { el.className += \" \" + cssClass; } };
  55.             var toggleClass = function(el, cssClass) { hasClass(el, cssClass) ? removeClass(el, cssClass) : addClass(el, cssClass); };
  56.         }
  57.         var noop = function() {};
  58.         var profilerStorageKey = 'symfony/profiler/';
  59.         var request = function(url, onSuccess, onError, payload, options) {
  60.             var xhr = window.XMLHttpRequest ? new XMLHttpRequest() : new ActiveXObject('Microsoft.XMLHTTP');
  61.             options = options || {};
  62.             options.maxTries = options.maxTries || 0;
  63.             xhr.open(options.method || 'GET', url, true);
  64.             xhr.setRequestHeader('X-Requested-With', 'XMLHttpRequest');
  65.             xhr.onreadystatechange = function(state) {
  66.                 if (4 !== xhr.readyState) {
  67.                     return null;
  68.                 }
  69.                 if (xhr.status == 404 && options.maxTries > 1) {
  70.                     setTimeout(function(){
  71.                         options.maxTries--;
  72.                         request(url, onSuccess, onError, payload, options);
  73.                     }, 1000);
  74.                     return null;
  75.                 }
  76.                 if (200 === xhr.status) {
  77.                     (onSuccess || noop)(xhr);
  78.                 } else {
  79.                     (onError || noop)(xhr);
  80.                 }
  81.             };
  82.             xhr.send(payload || '');
  83.         };
  84.         var getPreference = function(name) {
  85.             if (!window.localStorage) {
  86.                 return null;
  87.             }
  88.             return localStorage.getItem(profilerStorageKey + name);
  89.         };
  90.         var setPreference = function(name, value) {
  91.             if (!window.localStorage) {
  92.                 return null;
  93.             }
  94.             localStorage.setItem(profilerStorageKey + name, value);
  95.         };
  96.         var requestStack = [];
  97.         var extractHeaders = function(xhr, stackElement) {
  98.             /* Here we avoid to call xhr.getResponseHeader in order to */
  99.             /* prevent polluting the console with CORS security errors */
  100.             var allHeaders = xhr.getAllResponseHeaders();
  101.             var ret;
  102.             if (ret = allHeaders.match(/^x-debug-token:\\s+(.*)\$/im)) {
  103.                 stackElement.profile = ret[1];
  104.             }
  105.             if (ret = allHeaders.match(/^x-debug-token-link:\\s+(.*)\$/im)) {
  106.                 stackElement.profilerUrl = ret[1];
  107.             }
  108.             if (ret = allHeaders.match(/^Symfony-Debug-Toolbar-Replace:\\s+(.*)\$/im)) {
  109.                 stackElement.toolbarReplaceFinished = false;
  110.                 stackElement.toolbarReplace = '1' === ret[1];
  111.             }
  112.         };
  113.         var successStreak = 4;
  114.         var pendingRequests = 0;
  115.         var renderAjaxRequests = function() {
  116.             var requestCounter = document.querySelector('.sf-toolbar-ajax-request-counter');
  117.             if (!requestCounter) {
  118.                 return;
  119.             }
  120.             requestCounter.textContent = requestStack.length;
  121.             var infoSpan = document.querySelector(\".sf-toolbar-ajax-info\");
  122.             if (infoSpan) {
  123.                 infoSpan.textContent = requestStack.length + ' AJAX request' + (requestStack.length !== 1 ? 's' : '');
  124.             }
  125.             var ajaxToolbarPanel = document.querySelector('.sf-toolbar-block-ajax');
  126.             if (requestStack.length) {
  127.                 ajaxToolbarPanel.style.display = 'block';
  128.             } else {
  129.                 ajaxToolbarPanel.style.display = 'none';
  130.             }
  131.             if (pendingRequests > 0) {
  132.                 addClass(ajaxToolbarPanel, 'sf-ajax-request-loading');
  133.             } else if (successStreak < 4) {
  134.                 addClass(ajaxToolbarPanel, 'sf-toolbar-status-red');
  135.                 removeClass(ajaxToolbarPanel, 'sf-ajax-request-loading');
  136.             } else {
  137.                 removeClass(ajaxToolbarPanel, 'sf-ajax-request-loading');
  138.                 removeClass(ajaxToolbarPanel, 'sf-toolbar-status-red');
  139.             }
  140.         };
  141.         var startAjaxRequest = function(index) {
  142.             var tbody = document.querySelector('.sf-toolbar-ajax-request-list');
  143.             if (!tbody) {
  144.                 return;
  145.             }
  146.             var nbOfAjaxRequest = tbody.rows.length;
  147.             if (nbOfAjaxRequest >= 100) {
  148.                 tbody.deleteRow(0);
  149.             }
  150.             var request = requestStack[index];
  151.             pendingRequests++;
  152.             var row = document.createElement('tr');
  153.             request.DOMNode = row;
  154.             var requestNumberCell = document.createElement('td');
  155.             requestNumberCell.textContent = index + 1;
  156.             row.appendChild(requestNumberCell);
  157.             var profilerCell = document.createElement('td');
  158.             profilerCell.textContent = 'n/a';
  159.             row.appendChild(profilerCell);
  160.             var methodCell = document.createElement('td');
  161.             methodCell.textContent = request.method;
  162.             row.appendChild(methodCell);
  163.             var typeCell = document.createElement('td');
  164.             typeCell.textContent = request.type;
  165.             row.appendChild(typeCell);
  166.             var statusCodeCell = document.createElement('td');
  167.             var statusCode = document.createElement('span');
  168.             statusCode.textContent = 'n/a';
  169.             statusCodeCell.appendChild(statusCode);
  170.             row.appendChild(statusCodeCell);
  171.             var pathCell = document.createElement('td');
  172.             pathCell.className = 'sf-ajax-request-url';
  173.             if ('GET' === request.method) {
  174.                 var pathLink = document.createElement('a');
  175.                 pathLink.setAttribute('href', request.url);
  176.                 pathLink.textContent = request.url;
  177.                 pathCell.appendChild(pathLink);
  178.             } else {
  179.                 pathCell.textContent = request.url;
  180.             }
  181.             pathCell.setAttribute('title', request.url);
  182.             row.appendChild(pathCell);
  183.             var durationCell = document.createElement('td');
  184.             durationCell.className = 'sf-ajax-request-duration';
  185.             durationCell.textContent = 'n/a';
  186.             row.appendChild(durationCell);
  187.             request.liveDurationHandle = setInterval(function() {
  188.                 durationCell.textContent = (new Date() - request.start) + 'ms';
  189.             }, 100);
  190.             row.className = 'sf-ajax-request sf-ajax-request-loading';
  191.             tbody.insertBefore(row, null);
  192.             var toolbarInfo = document.querySelector('.sf-toolbar-block-ajax .sf-toolbar-info');
  193.             toolbarInfo.scrollTop = toolbarInfo.scrollHeight;
  194.             renderAjaxRequests();
  195.         };
  196.         var finishAjaxRequest = function(index) {
  197.             var request = requestStack[index];
  198.             clearInterval(request.liveDurationHandle);
  199.             if (!request.DOMNode) {
  200.                 return;
  201.             }
  202.             if (request.toolbarReplace && !request.toolbarReplaceFinished && request.profile) {
  203.                 /* Flag as complete because finishAjaxRequest can be called multiple times. */
  204.                 request.toolbarReplaceFinished = true;
  205.                 /* Search up through the DOM to find the toolbar's container ID. */
  206.                 for (var elem = request.DOMNode; elem && elem !== document; elem = elem.parentNode) {
  207.                     if (elem.id.match(/^sfwdt/)) {
  208.                         Sfjs.loadToolbar(elem.id.replace(/^sfwdt/, ''), request.profile);
  209.                         break;
  210.                     }
  211.                 }
  212.             }
  213.             pendingRequests--;
  214.             var row = request.DOMNode;
  215.             /* Unpack the children from the row */
  216.             var profilerCell = row.children[1];
  217.             var methodCell = row.children[2];
  218.             var statusCodeCell = row.children[4];
  219.             var statusCodeElem = statusCodeCell.children[0];
  220.             var durationCell = row.children[6];
  221.             if (request.error) {
  222.                 row.className = 'sf-ajax-request sf-ajax-request-error';
  223.                 methodCell.className = 'sf-ajax-request-error';
  224.                 successStreak = 0;
  225.             } else {
  226.                 row.className = 'sf-ajax-request sf-ajax-request-ok';
  227.                 successStreak++;
  228.             }
  229.             if (request.statusCode) {
  230.                 if (request.statusCode < 300) {
  231.                     statusCodeElem.setAttribute('class', 'sf-toolbar-status');
  232.                 } else if (request.statusCode < 400) {
  233.                     statusCodeElem.setAttribute('class', 'sf-toolbar-status sf-toolbar-status-yellow');
  234.                 } else {
  235.                     statusCodeElem.setAttribute('class', 'sf-toolbar-status sf-toolbar-status-red');
  236.                 }
  237.                 statusCodeElem.textContent = request.statusCode;
  238.             } else {
  239.                 statusCodeElem.setAttribute('class', 'sf-toolbar-status sf-toolbar-status-red');
  240.             }
  241.             if (request.duration) {
  242.                 durationCell.textContent = request.duration + 'ms';
  243.             }
  244.             if (request.profilerUrl) {
  245.                 profilerCell.textContent = '';
  246.                 var profilerLink = document.createElement('a');
  247.                 profilerLink.setAttribute('href', request.statusCode < 400 ? request.profilerUrl : request.profilerUrl + '?panel=exception');
  248.                 profilerLink.textContent = request.profile;
  249.                 profilerCell.appendChild(profilerLink);
  250.             }
  251.             renderAjaxRequests();
  252.         };
  253.         var addEventListener;
  254.         var el = document.createElement('div');
  255.         if (!('addEventListener' in el)) {
  256.             addEventListener = function (element, eventName, callback) {
  257.                 element.attachEvent('on' + eventName, callback);
  258.             };
  259.         } else {
  260.             addEventListener = function (element, eventName, callback) {
  261.                 element.addEventListener(eventName, callback, false);
  262.             };
  263.         }
  264.         ";
  265.         // line 271
  266.         if ((isset($context["excluded_ajax_paths"]) || array_key_exists("excluded_ajax_paths"$context))) {
  267.             // line 272
  268.             echo "            if (window.fetch && window.fetch.polyfill === undefined) {
  269.                 var oldFetch = window.fetch;
  270.                 window.fetch = function () {
  271.                     var promise = oldFetch.apply(this, arguments);
  272.                     var url = arguments[0];
  273.                     var params = arguments[1];
  274.                     var paramType = Object.prototype.toString.call(arguments[0]);
  275.                     if (paramType === '[object Request]') {
  276.                         url = arguments[0].url;
  277.                         params = {
  278.                             method: arguments[0].method,
  279.                             credentials: arguments[0].credentials,
  280.                             headers: arguments[0].headers,
  281.                             mode: arguments[0].mode,
  282.                             redirect: arguments[0].redirect
  283.                         };
  284.                     } else {
  285.                         url = String(url);
  286.                     }
  287.                     if (!url.match(new RegExp(";
  288.             // line 291
  289.             echo json_encode((isset($context["excluded_ajax_paths"]) || array_key_exists("excluded_ajax_paths"$context) ? $context["excluded_ajax_paths"] : (function () { throw new RuntimeError('Variable "excluded_ajax_paths" does not exist.'291$this->source); })()));
  290.             echo "))) {
  291.                         var method = 'GET';
  292.                         if (params && params.method !== undefined) {
  293.                             method = params.method;
  294.                         }
  295.                         var stackElement = {
  296.                             error: false,
  297.                             url: url,
  298.                             method: method,
  299.                             type: 'fetch',
  300.                             start: new Date()
  301.                         };
  302.                         var idx = requestStack.push(stackElement) - 1;
  303.                         promise.then(function (r) {
  304.                             stackElement.duration = new Date() - stackElement.start;
  305.                             stackElement.error = r.status < 200 || r.status >= 400;
  306.                             stackElement.statusCode = r.status;
  307.                             stackElement.profile = r.headers.get('x-debug-token');
  308.                             stackElement.profilerUrl = r.headers.get('x-debug-token-link');
  309.                             stackElement.toolbarReplaceFinished = false;
  310.                             stackElement.toolbarReplace = '1' === r.headers.get('Symfony-Debug-Toolbar-Replace');
  311.                             finishAjaxRequest(idx);
  312.                         }, function (e){
  313.                             stackElement.error = true;
  314.                             finishAjaxRequest(idx);
  315.                         });
  316.                         startAjaxRequest(idx);
  317.                     }
  318.                     return promise;
  319.                 };
  320.             }
  321.             if (window.XMLHttpRequest && XMLHttpRequest.prototype.addEventListener) {
  322.                 var proxied = XMLHttpRequest.prototype.open;
  323.                 XMLHttpRequest.prototype.open = function(method, url, async, user, pass) {
  324.                     var self = this;
  325.                     /* prevent logging AJAX calls to static and inline files, like templates */
  326.                     var path = url;
  327.                     if (url.substr(0, 1) === '/') {
  328.                         if (0 === url.indexOf('";
  329.             // line 334
  330.             echo twig_escape_filter($this->envtwig_escape_filter($this->envtwig_get_attribute($this->env$this->source, (isset($context["request"]) || array_key_exists("request"$context) ? $context["request"] : (function () { throw new RuntimeError('Variable "request" does not exist.'334$this->source); })()), "basePath", [], "any"falsefalsefalse334), "js"), "html"nulltrue);
  331.             echo "')) {
  332.                             path = url.substr(";
  333.             // line 335
  334.             echo twig_escape_filter($this->envtwig_length_filter($this->envtwig_get_attribute($this->env$this->source, (isset($context["request"]) || array_key_exists("request"$context) ? $context["request"] : (function () { throw new RuntimeError('Variable "request" does not exist.'335$this->source); })()), "basePath", [], "any"falsefalsefalse335)), "html"nulltrue);
  335.             echo ");
  336.                         }
  337.                     }
  338.                     else if (0 === url.indexOf('";
  339.             // line 338
  340.             echo twig_escape_filter($this->envtwig_escape_filter($this->env, (twig_get_attribute($this->env$this->source, (isset($context["request"]) || array_key_exists("request"$context) ? $context["request"] : (function () { throw new RuntimeError('Variable "request" does not exist.'338$this->source); })()), "schemeAndHttpHost", [], "any"falsefalsefalse338) . twig_get_attribute($this->env$this->source, (isset($context["request"]) || array_key_exists("request"$context) ? $context["request"] : (function () { throw new RuntimeError('Variable "request" does not exist.'338$this->source); })()), "basePath", [], "any"falsefalsefalse338)), "js"), "html"nulltrue);
  341.             echo "')) {
  342.                         path = url.substr(";
  343.             // line 339
  344.             echo twig_escape_filter($this->envtwig_length_filter($this->env, (twig_get_attribute($this->env$this->source, (isset($context["request"]) || array_key_exists("request"$context) ? $context["request"] : (function () { throw new RuntimeError('Variable "request" does not exist.'339$this->source); })()), "schemeAndHttpHost", [], "any"falsefalsefalse339) . twig_get_attribute($this->env$this->source, (isset($context["request"]) || array_key_exists("request"$context) ? $context["request"] : (function () { throw new RuntimeError('Variable "request" does not exist.'339$this->source); })()), "basePath", [], "any"falsefalsefalse339))), "html"nulltrue);
  345.             echo ");
  346.                     }
  347.                     if (!path.match(new RegExp(";
  348.             // line 342
  349.             echo json_encode((isset($context["excluded_ajax_paths"]) || array_key_exists("excluded_ajax_paths"$context) ? $context["excluded_ajax_paths"] : (function () { throw new RuntimeError('Variable "excluded_ajax_paths" does not exist.'342$this->source); })()));
  350.             echo "))) {
  351.                         var stackElement = {
  352.                             error: false,
  353.                             url: url,
  354.                             method: method,
  355.                             type: 'xhr',
  356.                             start: new Date()
  357.                         };
  358.                         var idx = requestStack.push(stackElement) - 1;
  359.                         this.addEventListener('readystatechange', function() {
  360.                             if (self.readyState == 4) {
  361.                                 stackElement.duration = new Date() - stackElement.start;
  362.                                 stackElement.error = self.status < 200 || self.status >= 400;
  363.                                 stackElement.statusCode = self.status;
  364.                                 extractHeaders(self, stackElement);
  365.                                 finishAjaxRequest(idx);
  366.                             }
  367.                         }, false);
  368.                         startAjaxRequest(idx);
  369.                     }
  370.                     proxied.apply(this, Array.prototype.slice.call(arguments));
  371.                 };
  372.             }
  373.         ";
  374.         }
  375.         // line 371
  376.         echo "
  377.         return {
  378.             hasClass: hasClass,
  379.             removeClass: removeClass,
  380.             addClass: addClass,
  381.             toggleClass: toggleClass,
  382.             getPreference: getPreference,
  383.             setPreference: setPreference,
  384.             addEventListener: addEventListener,
  385.             request: request,
  386.             renderAjaxRequests: renderAjaxRequests,
  387.             load: function(selector, url, onSuccess, onError, options) {
  388.                 var el = document.getElementById(selector);
  389.                 if (el && el.getAttribute('data-sfurl') !== url) {
  390.                     request(
  391.                         url,
  392.                         function(xhr) {
  393.                             el.innerHTML = xhr.responseText;
  394.                             el.setAttribute('data-sfurl', url);
  395.                             removeClass(el, 'loading');
  396.                             var pending = pendingRequests;
  397.                             for (var i = 0; i < requestStack.length; i++) {
  398.                                 startAjaxRequest(i);
  399.                                 if (requestStack[i].duration) {
  400.                                     finishAjaxRequest(i);
  401.                                 }
  402.                             }
  403.                             /* Revert the pending state in case there was a start called without a finish above. */
  404.                             pendingRequests = pending;
  405.                             (onSuccess || noop)(xhr, el);
  406.                         },
  407.                         function(xhr) { (onError || noop)(xhr, el); },
  408.                         '',
  409.                         options
  410.                     );
  411.                 }
  412.                 return this;
  413.             },
  414.             loadToolbar: function(token, newToken) {
  415.                 newToken = (newToken || token);
  416.                 this.load(
  417.                     'sfwdt' + token,
  418.                     '";
  419.         // line 425
  420.         echo $this->extensions['Symfony\Bridge\Twig\Extension\RoutingExtension']->getPath("_wdt", ["token" => "xxxxxx"]);
  421.         echo "'.replace(/xxxxxx/, newToken),
  422.                     function(xhr, el) {
  423.                         /* Evaluate in global scope scripts embedded inside the toolbar */
  424.                         var i, scripts = [].slice.call(el.querySelectorAll('script'));
  425.                         for (i = 0; i < scripts.length; ++i) {
  426.                             eval.call({}, scripts[i].firstChild.nodeValue);
  427.                         }
  428.                         el.style.display = -1 !== xhr.responseText.indexOf('sf-toolbarreset') ? 'block' : 'none';
  429.                         if (el.style.display == 'none') {
  430.                             return;
  431.                         }
  432.                         if (getPreference('toolbar/displayState') == 'none') {
  433.                             document.getElementById('sfToolbarMainContent-' + newToken).style.display = 'none';
  434.                             document.getElementById('sfToolbarClearer-' + newToken).style.display = 'none';
  435.                             document.getElementById('sfMiniToolbar-' + newToken).style.display = 'block';
  436.                         } else {
  437.                             document.getElementById('sfToolbarMainContent-' + newToken).style.display = 'block';
  438.                             document.getElementById('sfToolbarClearer-' + newToken).style.display = 'block';
  439.                             document.getElementById('sfMiniToolbar-' + newToken).style.display = 'none';
  440.                         }
  441.                         /* Handle toolbar-info position */
  442.                         var toolbarBlocks = [].slice.call(el.querySelectorAll('.sf-toolbar-block'));
  443.                         for (i = 0; i < toolbarBlocks.length; ++i) {
  444.                             toolbarBlocks[i].onmouseover = function () {
  445.                                 var toolbarInfo = this.querySelectorAll('.sf-toolbar-info')[0];
  446.                                 var pageWidth = document.body.clientWidth;
  447.                                 var elementWidth = toolbarInfo.offsetWidth;
  448.                                 var leftValue = (elementWidth + this.offsetLeft) - pageWidth;
  449.                                 var rightValue = (elementWidth + (pageWidth - this.offsetLeft)) - pageWidth;
  450.                                 /* Reset right and left value, useful on window resize */
  451.                                 toolbarInfo.style.right = '';
  452.                                 toolbarInfo.style.left = '';
  453.                                 if (elementWidth > pageWidth) {
  454.                                     toolbarInfo.style.left = 0;
  455.                                 }
  456.                                 else if (leftValue > 0 && rightValue > 0) {
  457.                                     toolbarInfo.style.right = (rightValue * -1) + 'px';
  458.                                 } else if (leftValue < 0) {
  459.                                     toolbarInfo.style.left = 0;
  460.                                 } else {
  461.                                     toolbarInfo.style.right = '0px';
  462.                                 }
  463.                             };
  464.                         }
  465.                         addEventListener(document.getElementById('sfToolbarHideButton-' + newToken), 'click', function (event) {
  466.                             event.preventDefault();
  467.                             var p = this.parentNode;
  468.                             p.style.display = 'none';
  469.                             (p.previousElementSibling || p.previousSibling).style.display = 'none';
  470.                             document.getElementById('sfMiniToolbar-' + newToken).style.display = 'block';
  471.                             setPreference('toolbar/displayState', 'none');
  472.                         });
  473.                         addEventListener(document.getElementById('sfToolbarMiniToggler-' + newToken), 'click', function (event) {
  474.                             event.preventDefault();
  475.                             var elem = this.parentNode;
  476.                             if (elem.style.display == 'none') {
  477.                                 document.getElementById('sfToolbarMainContent-' + newToken).style.display = 'none';
  478.                                 document.getElementById('sfToolbarClearer-' + newToken).style.display = 'none';
  479.                                 elem.style.display = 'block';
  480.                             } else {
  481.                                 document.getElementById('sfToolbarMainContent-' + newToken).style.display = 'block';
  482.                                 document.getElementById('sfToolbarClearer-' + newToken).style.display = 'block';
  483.                                 elem.style.display = 'none'
  484.                             }
  485.                             setPreference('toolbar/displayState', 'block');
  486.                         });
  487.                         renderAjaxRequests();
  488.                         addEventListener(document.querySelector('.sf-toolbar-block-ajax'), 'mouseenter', function (event) {
  489.                             var elem = document.querySelector('.sf-toolbar-block-ajax .sf-toolbar-info');
  490.                             elem.scrollTop = elem.scrollHeight;
  491.                         });
  492.                         addEventListener(document.querySelector('.sf-toolbar-block-ajax > .sf-toolbar-icon'), 'click', function (event) {
  493.                             event.preventDefault();
  494.                             toggleClass(this.parentNode, 'hover');
  495.                         });
  496.                         var dumpInfo = document.querySelector('.sf-toolbar-block-dump .sf-toolbar-info');
  497.                         if (null !== dumpInfo) {
  498.                             addEventListener(dumpInfo, 'sfbeforedumpcollapse', function () {
  499.                                 dumpInfo.style.minHeight = dumpInfo.getBoundingClientRect().height+'px';
  500.                             });
  501.                             addEventListener(dumpInfo, 'mouseleave', function () {
  502.                                 dumpInfo.style.minHeight = '';
  503.                             });
  504.                         }
  505.                     },
  506.                     function(xhr) {
  507.                         if (xhr.status !== 0) {
  508.                             var sfwdt = document.getElementById('sfwdt' + token);
  509.                             sfwdt.innerHTML = '\\
  510.                                 <div class=\"sf-toolbarreset\">\\
  511.                                     <div class=\"sf-toolbar-icon\"><svg width=\"26\" height=\"28\" xmlns=\"http://www.w3.org/2000/svg\" version=\"1.1\" x=\"0px\" y=\"0px\" viewBox=\"0 0 26 28\" enable-background=\"new 0 0 26 28\" xml:space=\"preserve\"><path fill=\"#FFFFFF\" d=\"M13 0C5.8 0 0 5.8 0 13c0 7.2 5.8 13 13 13c7.2 0 13-5.8 13-13C26 5.8 20.2 0 13 0z M20 7.5 c-0.6 0-1-0.3-1-0.9c0-0.2 0-0.4 0.2-0.6c0.1-0.3 0.2-0.3 0.2-0.4c0-0.3-0.5-0.4-0.7-0.4c-2 0.1-2.5 2.7-2.9 4.8l-0.2 1.1 c1.1 0.2 1.9 0 2.4-0.3c0.6-0.4-0.2-0.8-0.1-1.3C18 9.2 18.4 9 18.7 8.9c0.5 0 0.8 0.5 0.8 1c0 0.8-1.1 2-3.3 1.9 c-0.3 0-0.5 0-0.7-0.1L15 14.1c-0.4 1.7-0.9 4.1-2.6 6.2c-1.5 1.8-3.1 2.1-3.8 2.1c-1.3 0-2.1-0.6-2.2-1.6c0-0.9 0.8-1.4 1.3-1.4 c0.7 0 1.2 0.5 1.2 1.1c0 0.5-0.2 0.6-0.4 0.7c-0.1 0.1-0.3 0.2-0.3 0.4c0 0.1 0.1 0.3 0.4 0.3c0.5 0 0.9-0.3 1.2-0.5 c1.3-1 1.7-2.9 2.4-6.2l0.1-0.8c0.2-1.1 0.5-2.3 0.8-3.5c-0.9-0.7-1.4-1.5-2.6-1.8c-0.8-0.2-1.3 0-1.7 0.4C8.4 10 8.6 10.7 9 11.1 l0.7 0.7c0.8 0.9 1.3 1.7 1.1 2.7c-0.3 1.6-2.1 2.8-4.3 2.1c-1.9-0.6-2.2-1.9-2-2.7c0.2-0.6 0.7-0.8 1.2-0.6 c0.5 0.2 0.7 0.8 0.6 1.3c0 0.1 0 0.1-0.1 0.3C6 15 5.9 15.2 5.9 15.3c-0.1 0.4 0.4 0.7 0.8 0.8c0.8 0.3 1.7-0.2 1.9-0.9 c0.2-0.6-0.2-1.1-0.4-1.2l-0.8-0.9c-0.4-0.4-1.2-1.5-0.8-2.8c0.2-0.5 0.5-1 0.9-1.4c1-0.7 2-0.8 3-0.6c1.3 0.4 1.9 1.2 2.8 1.9 c0.5-1.3 1.1-2.6 2-3.8c0.9-1 2-1.7 3.3-1.8C20 4.8 21 5.4 21 6.3C21 6.7 20.8 7.5 20 7.5z\"/></svg></div>\\
  512.                                     An error occurred while loading the web debug toolbar. <a href=\"";
  513.         // line 528
  514.         echo $this->extensions['Symfony\Bridge\Twig\Extension\RoutingExtension']->getPath("_profiler_home");
  515.         echo "' + newToken + '>Open the web profiler.</a>\\
  516.                                 </div>\\
  517.                             ';
  518.                             sfwdt.setAttribute('class', 'sf-toolbar sf-error-toolbar');
  519.                         }
  520.                     },
  521.                     { maxTries: 5 }
  522.                 );
  523.                 return this;
  524.             },
  525.             toggle: function(selector, elOn, elOff) {
  526.                 var tmp = elOn.style.display,
  527.                     el = document.getElementById(selector);
  528.                 elOn.style.display = elOff.style.display;
  529.                 elOff.style.display = tmp;
  530.                 if (el) {
  531.                     el.style.display = 'none' === tmp ? 'none' : 'block';
  532.                 }
  533.                 return this;
  534.             },
  535.             createTabs: function() {
  536.                 var tabGroups = document.querySelectorAll('.sf-tabs:not([data-processed=true])');
  537.                 /* create the tab navigation for each group of tabs */
  538.                 for (var i = 0; i < tabGroups.length; i++) {
  539.                     var tabs = tabGroups[i].querySelectorAll(':scope > .tab');
  540.                     var tabNavigation = document.createElement('ul');
  541.                     tabNavigation.className = 'tab-navigation';
  542.                     var selectedTabId = 'tab-' + i + '-0'; /* select the first tab by default */
  543.                     for (var j = 0; j < tabs.length; j++) {
  544.                         var tabId = 'tab-' + i + '-' + j;
  545.                         var tabTitle = tabs[j].querySelector('.tab-title').innerHTML;
  546.                         var tabNavigationItem = document.createElement('li');
  547.                         tabNavigationItem.setAttribute('data-tab-id', tabId);
  548.                         if (hasClass(tabs[j], 'active')) { selectedTabId = tabId; }
  549.                         if (hasClass(tabs[j], 'disabled')) { addClass(tabNavigationItem, 'disabled'); }
  550.                         tabNavigationItem.innerHTML = tabTitle;
  551.                         tabNavigation.appendChild(tabNavigationItem);
  552.                         var tabContent = tabs[j].querySelector('.tab-content');
  553.                         tabContent.parentElement.setAttribute('id', tabId);
  554.                     }
  555.                     tabGroups[i].insertBefore(tabNavigation, tabGroups[i].firstChild);
  556.                     addClass(document.querySelector('[data-tab-id=\"' + selectedTabId + '\"]'), 'active');
  557.                 }
  558.                 /* display the active tab and add the 'click' event listeners */
  559.                 for (i = 0; i < tabGroups.length; i++) {
  560.                     tabNavigation = tabGroups[i].querySelectorAll(':scope > .tab-navigation li');
  561.                     for (j = 0; j < tabNavigation.length; j++) {
  562.                         tabId = tabNavigation[j].getAttribute('data-tab-id');
  563.                         document.getElementById(tabId).querySelector('.tab-title').className = 'hidden';
  564.                         if (hasClass(tabNavigation[j], 'active')) {
  565.                             document.getElementById(tabId).className = 'block';
  566.                         } else {
  567.                             document.getElementById(tabId).className = 'hidden';
  568.                         }
  569.                         tabNavigation[j].addEventListener('click', function(e) {
  570.                             var activeTab = e.target || e.srcElement;
  571.                             /* needed because when the tab contains HTML contents, user can click */
  572.                             /* on any of those elements instead of their parent '<li>' element */
  573.                             while (activeTab.tagName.toLowerCase() !== 'li') {
  574.                                 activeTab = activeTab.parentNode;
  575.                             }
  576.                             /* get the full list of tabs through the parent of the active tab element */
  577.                             var tabNavigation = activeTab.parentNode.children;
  578.                             for (var k = 0; k < tabNavigation.length; k++) {
  579.                                 var tabId = tabNavigation[k].getAttribute('data-tab-id');
  580.                                 document.getElementById(tabId).className = 'hidden';
  581.                                 removeClass(tabNavigation[k], 'active');
  582.                             }
  583.                             addClass(activeTab, 'active');
  584.                             var activeTabId = activeTab.getAttribute('data-tab-id');
  585.                             document.getElementById(activeTabId).className = 'block';
  586.                         });
  587.                     }
  588.                     tabGroups[i].setAttribute('data-processed', 'true');
  589.                 }
  590.             },
  591.             createToggles: function() {
  592.                 var toggles = document.querySelectorAll('.sf-toggle:not([data-processed=true])');
  593.                 for (var i = 0; i < toggles.length; i++) {
  594.                     var elementSelector = toggles[i].getAttribute('data-toggle-selector');
  595.                     var element = document.querySelector(elementSelector);
  596.                     addClass(element, 'sf-toggle-content');
  597.                     if (toggles[i].hasAttribute('data-toggle-initial') && toggles[i].getAttribute('data-toggle-initial') == 'display') {
  598.                         addClass(toggles[i], 'sf-toggle-on');
  599.                         addClass(element, 'sf-toggle-visible');
  600.                     } else {
  601.                         addClass(toggles[i], 'sf-toggle-off');
  602.                         addClass(element, 'sf-toggle-hidden');
  603.                     }
  604.                     addEventListener(toggles[i], 'click', function(e) {
  605.                         e.preventDefault();
  606.                         if ('' !== window.getSelection().toString()) {
  607.                             /* Don't do anything on text selection */
  608.                             return;
  609.                         }
  610.                         var toggle = e.target || e.srcElement;
  611.                         /* needed because when the toggle contains HTML contents, user can click */
  612.                         /* on any of those elements instead of their parent '.sf-toggle' element */
  613.                         while (!hasClass(toggle, 'sf-toggle')) {
  614.                             toggle = toggle.parentNode;
  615.                         }
  616.                         var element = document.querySelector(toggle.getAttribute('data-toggle-selector'));
  617.                         toggleClass(toggle, 'sf-toggle-on');
  618.                         toggleClass(toggle, 'sf-toggle-off');
  619.                         toggleClass(element, 'sf-toggle-hidden');
  620.                         toggleClass(element, 'sf-toggle-visible');
  621.                         /* the toggle doesn't change its contents when clicking on it */
  622.                         if (!toggle.hasAttribute('data-toggle-alt-content')) {
  623.                             return;
  624.                         }
  625.                         if (!toggle.hasAttribute('data-toggle-original-content')) {
  626.                             toggle.setAttribute('data-toggle-original-content', toggle.innerHTML);
  627.                         }
  628.                         var currentContent = toggle.innerHTML;
  629.                         var originalContent = toggle.getAttribute('data-toggle-original-content');
  630.                         var altContent = toggle.getAttribute('data-toggle-alt-content');
  631.                         toggle.innerHTML = currentContent !== altContent ? altContent : originalContent;
  632.                     });
  633.                     /* Prevents from disallowing clicks on links inside toggles */
  634.                     var toggleLinks = toggles[i].querySelectorAll('a');
  635.                     for (var j = 0; j < toggleLinks.length; j++) {
  636.                         addEventListener(toggleLinks[j], 'click', function(e) {
  637.                             e.stopPropagation();
  638.                         });
  639.                     }
  640.                     toggles[i].setAttribute('data-processed', 'true');
  641.                 }
  642.             },
  643.             createFilters: function() {
  644.                 document.querySelectorAll('[data-filters] [data-filter]').forEach(function (filter) {
  645.                     var filters = filter.closest('[data-filters]'),
  646.                         type = 'choice',
  647.                         name = filter.dataset.filter,
  648.                         ucName = name.charAt(0).toUpperCase()+name.slice(1),
  649.                         list = document.createElement('ul'),
  650.                         values = filters.dataset['filter'+ucName] || filters.querySelectorAll('[data-filter-'+name+']'),
  651.                         labels = {},
  652.                         defaults = null,
  653.                         indexed = {},
  654.                         processed = {};
  655.                     if (typeof values === 'string') {
  656.                         type = 'level';
  657.                         labels = values.split(',');
  658.                         values = values.toLowerCase().split(',');
  659.                         defaults = values.length - 1;
  660.                     }
  661.                     addClass(list, 'filter-list');
  662.                     addClass(list, 'filter-list-'+type);
  663.                     values.forEach(function (value, i) {
  664.                         if (value instanceof HTMLElement) {
  665.                             value = value.dataset['filter'+ucName];
  666.                         }
  667.                         if (value in processed) {
  668.                             return;
  669.                         }
  670.                         var option = document.createElement('li'),
  671.                             label = i in labels ? labels[i] : value,
  672.                             active = false,
  673.                             matches;
  674.                         if ('' === label) {
  675.                             option.innerHTML = '<em>(none)</em>';
  676.                         } else {
  677.                             option.innerText = label;
  678.                         }
  679.                         option.dataset.filter = value;
  680.                         option.setAttribute('title', 1 === (matches = filters.querySelectorAll('[data-filter-'+name+'=\"'+value+'\"]').length) ? 'Matches 1 row' : 'Matches '+matches+' rows');
  681.                         indexed[value] = i;
  682.                         list.appendChild(option);
  683.                         addEventListener(option, 'click', function () {
  684.                             if ('choice' === type) {
  685.                                 filters.querySelectorAll('[data-filter-'+name+']').forEach(function (row) {
  686.                                     if (option.dataset.filter === row.dataset['filter'+ucName]) {
  687.                                         toggleClass(row, 'filter-hidden-'+name);
  688.                                     }
  689.                                 });
  690.                                 toggleClass(option, 'active');
  691.                             } else if ('level' === type) {
  692.                                 if (i === this.parentNode.querySelectorAll('.active').length - 1) {
  693.                                     return;
  694.                                 }
  695.                                 this.parentNode.querySelectorAll('li').forEach(function (currentOption, j) {
  696.                                     if (j <= i) {
  697.                                         addClass(currentOption, 'active');
  698.                                         if (i === j) {
  699.                                             addClass(currentOption, 'last-active');
  700.                                         } else {
  701.                                             removeClass(currentOption, 'last-active');
  702.                                         }
  703.                                     } else {
  704.                                         removeClass(currentOption, 'active');
  705.                                         removeClass(currentOption, 'last-active');
  706.                                     }
  707.                                 });
  708.                                 filters.querySelectorAll('[data-filter-'+name+']').forEach(function (row) {
  709.                                     if (i < indexed[row.dataset['filter'+ucName]]) {
  710.                                         addClass(row, 'filter-hidden-'+name);
  711.                                     } else {
  712.                                         removeClass(row, 'filter-hidden-'+name);
  713.                                     }
  714.                                 });
  715.                             }
  716.                         });
  717.                         if ('choice' === type) {
  718.                             active = null === defaults || 0 <= defaults.indexOf(value);
  719.                         } else if ('level' === type) {
  720.                             active = i <= defaults;
  721.                             if (active && i === defaults) {
  722.                                 addClass(option, 'last-active');
  723.                             }
  724.                         }
  725.                         if (active) {
  726.                             addClass(option, 'active');
  727.                         } else {
  728.                             filters.querySelectorAll('[data-filter-'+name+'=\"'+value+'\"]').forEach(function (row) {
  729.                                 toggleClass(row, 'filter-hidden-'+name);
  730.                             });
  731.                         }
  732.                         processed[value] = true;
  733.                     });
  734.                     if (1 < list.childNodes.length) {
  735.                         filter.appendChild(list);
  736.                         filter.dataset.filtered = '';
  737.                     }
  738.                 });
  739.             }
  740.         };
  741.     })();
  742.     Sfjs.addEventListener(document, 'DOMContentLoaded', function() {
  743.         Sfjs.createTabs();
  744.         Sfjs.createToggles();
  745.     });
  746. /*]]>*/</script>
  747. ";
  748.         
  749.         $__internal_085b0142806202599c7fe3b329164a92397d8978207a37e79d70b8c52599e33e->leave($__internal_085b0142806202599c7fe3b329164a92397d8978207a37e79d70b8c52599e33e_prof);
  750.         
  751.         $__internal_319393461309892924ff6e74d6d6e64287df64b63545b994e100d4ab223aed02->leave($__internal_319393461309892924ff6e74d6d6e64287df64b63545b994e100d4ab223aed02_prof);
  752.     }
  753.     public function getTemplateName()
  754.     {
  755.         return "@WebProfiler/Profiler/base_js.html.twig";
  756.     }
  757.     public function isTraitable()
  758.     {
  759.         return false;
  760.     }
  761.     public function getDebugInfo()
  762.     {
  763.         return array (  601 => 528,  495 => 425,  439 => 371,  407 => 342,  401 => 339,  397 => 338,  391 => 335,  387 => 334,  341 => 291,  320 => 272,  318 => 271,  52 => 7,  43 => 3,);
  764.     }
  765.     public function getSourceContext()
  766.     {
  767.         return new Source("{# This file is partially duplicated in TwigBundle/Resources/views/base_js.html.twig. If you
  768.    make any change in this file, verify the same change is needed in the other file. #}
  769. <script{% if csp_script_nonce is defined and csp_script_nonce %} nonce=\"{{ csp_script_nonce }}\"{% endif %}>/*<![CDATA[*/
  770.     {# Caution: the contents of this file are processed by Twig before loading
  771.                 them as JavaScript source code. Always use '/*' comments instead
  772.                 of '//' comments to avoid impossible-to-debug side-effects #}
  773.     Sfjs = (function() {
  774.         \"use strict\";
  775.         if ('classList' in document.documentElement) {
  776.             var hasClass = function (el, cssClass) { return el.classList.contains(cssClass); };
  777.             var removeClass = function(el, cssClass) { el.classList.remove(cssClass); };
  778.             var addClass = function(el, cssClass) { el.classList.add(cssClass); };
  779.             var toggleClass = function(el, cssClass) { el.classList.toggle(cssClass); };
  780.         } else {
  781.             var hasClass = function (el, cssClass) { return el.className.match(new RegExp('\\\\b' + cssClass + '\\\\b')); };
  782.             var removeClass = function(el, cssClass) { el.className = el.className.replace(new RegExp('\\\\b' + cssClass + '\\\\b'), ' '); };
  783.             var addClass = function(el, cssClass) { if (!hasClass(el, cssClass)) { el.className += \" \" + cssClass; } };
  784.             var toggleClass = function(el, cssClass) { hasClass(el, cssClass) ? removeClass(el, cssClass) : addClass(el, cssClass); };
  785.         }
  786.         var noop = function() {};
  787.         var profilerStorageKey = 'symfony/profiler/';
  788.         var request = function(url, onSuccess, onError, payload, options) {
  789.             var xhr = window.XMLHttpRequest ? new XMLHttpRequest() : new ActiveXObject('Microsoft.XMLHTTP');
  790.             options = options || {};
  791.             options.maxTries = options.maxTries || 0;
  792.             xhr.open(options.method || 'GET', url, true);
  793.             xhr.setRequestHeader('X-Requested-With', 'XMLHttpRequest');
  794.             xhr.onreadystatechange = function(state) {
  795.                 if (4 !== xhr.readyState) {
  796.                     return null;
  797.                 }
  798.                 if (xhr.status == 404 && options.maxTries > 1) {
  799.                     setTimeout(function(){
  800.                         options.maxTries--;
  801.                         request(url, onSuccess, onError, payload, options);
  802.                     }, 1000);
  803.                     return null;
  804.                 }
  805.                 if (200 === xhr.status) {
  806.                     (onSuccess || noop)(xhr);
  807.                 } else {
  808.                     (onError || noop)(xhr);
  809.                 }
  810.             };
  811.             xhr.send(payload || '');
  812.         };
  813.         var getPreference = function(name) {
  814.             if (!window.localStorage) {
  815.                 return null;
  816.             }
  817.             return localStorage.getItem(profilerStorageKey + name);
  818.         };
  819.         var setPreference = function(name, value) {
  820.             if (!window.localStorage) {
  821.                 return null;
  822.             }
  823.             localStorage.setItem(profilerStorageKey + name, value);
  824.         };
  825.         var requestStack = [];
  826.         var extractHeaders = function(xhr, stackElement) {
  827.             /* Here we avoid to call xhr.getResponseHeader in order to */
  828.             /* prevent polluting the console with CORS security errors */
  829.             var allHeaders = xhr.getAllResponseHeaders();
  830.             var ret;
  831.             if (ret = allHeaders.match(/^x-debug-token:\\s+(.*)\$/im)) {
  832.                 stackElement.profile = ret[1];
  833.             }
  834.             if (ret = allHeaders.match(/^x-debug-token-link:\\s+(.*)\$/im)) {
  835.                 stackElement.profilerUrl = ret[1];
  836.             }
  837.             if (ret = allHeaders.match(/^Symfony-Debug-Toolbar-Replace:\\s+(.*)\$/im)) {
  838.                 stackElement.toolbarReplaceFinished = false;
  839.                 stackElement.toolbarReplace = '1' === ret[1];
  840.             }
  841.         };
  842.         var successStreak = 4;
  843.         var pendingRequests = 0;
  844.         var renderAjaxRequests = function() {
  845.             var requestCounter = document.querySelector('.sf-toolbar-ajax-request-counter');
  846.             if (!requestCounter) {
  847.                 return;
  848.             }
  849.             requestCounter.textContent = requestStack.length;
  850.             var infoSpan = document.querySelector(\".sf-toolbar-ajax-info\");
  851.             if (infoSpan) {
  852.                 infoSpan.textContent = requestStack.length + ' AJAX request' + (requestStack.length !== 1 ? 's' : '');
  853.             }
  854.             var ajaxToolbarPanel = document.querySelector('.sf-toolbar-block-ajax');
  855.             if (requestStack.length) {
  856.                 ajaxToolbarPanel.style.display = 'block';
  857.             } else {
  858.                 ajaxToolbarPanel.style.display = 'none';
  859.             }
  860.             if (pendingRequests > 0) {
  861.                 addClass(ajaxToolbarPanel, 'sf-ajax-request-loading');
  862.             } else if (successStreak < 4) {
  863.                 addClass(ajaxToolbarPanel, 'sf-toolbar-status-red');
  864.                 removeClass(ajaxToolbarPanel, 'sf-ajax-request-loading');
  865.             } else {
  866.                 removeClass(ajaxToolbarPanel, 'sf-ajax-request-loading');
  867.                 removeClass(ajaxToolbarPanel, 'sf-toolbar-status-red');
  868.             }
  869.         };
  870.         var startAjaxRequest = function(index) {
  871.             var tbody = document.querySelector('.sf-toolbar-ajax-request-list');
  872.             if (!tbody) {
  873.                 return;
  874.             }
  875.             var nbOfAjaxRequest = tbody.rows.length;
  876.             if (nbOfAjaxRequest >= 100) {
  877.                 tbody.deleteRow(0);
  878.             }
  879.             var request = requestStack[index];
  880.             pendingRequests++;
  881.             var row = document.createElement('tr');
  882.             request.DOMNode = row;
  883.             var requestNumberCell = document.createElement('td');
  884.             requestNumberCell.textContent = index + 1;
  885.             row.appendChild(requestNumberCell);
  886.             var profilerCell = document.createElement('td');
  887.             profilerCell.textContent = 'n/a';
  888.             row.appendChild(profilerCell);
  889.             var methodCell = document.createElement('td');
  890.             methodCell.textContent = request.method;
  891.             row.appendChild(methodCell);
  892.             var typeCell = document.createElement('td');
  893.             typeCell.textContent = request.type;
  894.             row.appendChild(typeCell);
  895.             var statusCodeCell = document.createElement('td');
  896.             var statusCode = document.createElement('span');
  897.             statusCode.textContent = 'n/a';
  898.             statusCodeCell.appendChild(statusCode);
  899.             row.appendChild(statusCodeCell);
  900.             var pathCell = document.createElement('td');
  901.             pathCell.className = 'sf-ajax-request-url';
  902.             if ('GET' === request.method) {
  903.                 var pathLink = document.createElement('a');
  904.                 pathLink.setAttribute('href', request.url);
  905.                 pathLink.textContent = request.url;
  906.                 pathCell.appendChild(pathLink);
  907.             } else {
  908.                 pathCell.textContent = request.url;
  909.             }
  910.             pathCell.setAttribute('title', request.url);
  911.             row.appendChild(pathCell);
  912.             var durationCell = document.createElement('td');
  913.             durationCell.className = 'sf-ajax-request-duration';
  914.             durationCell.textContent = 'n/a';
  915.             row.appendChild(durationCell);
  916.             request.liveDurationHandle = setInterval(function() {
  917.                 durationCell.textContent = (new Date() - request.start) + 'ms';
  918.             }, 100);
  919.             row.className = 'sf-ajax-request sf-ajax-request-loading';
  920.             tbody.insertBefore(row, null);
  921.             var toolbarInfo = document.querySelector('.sf-toolbar-block-ajax .sf-toolbar-info');
  922.             toolbarInfo.scrollTop = toolbarInfo.scrollHeight;
  923.             renderAjaxRequests();
  924.         };
  925.         var finishAjaxRequest = function(index) {
  926.             var request = requestStack[index];
  927.             clearInterval(request.liveDurationHandle);
  928.             if (!request.DOMNode) {
  929.                 return;
  930.             }
  931.             if (request.toolbarReplace && !request.toolbarReplaceFinished && request.profile) {
  932.                 /* Flag as complete because finishAjaxRequest can be called multiple times. */
  933.                 request.toolbarReplaceFinished = true;
  934.                 /* Search up through the DOM to find the toolbar's container ID. */
  935.                 for (var elem = request.DOMNode; elem && elem !== document; elem = elem.parentNode) {
  936.                     if (elem.id.match(/^sfwdt/)) {
  937.                         Sfjs.loadToolbar(elem.id.replace(/^sfwdt/, ''), request.profile);
  938.                         break;
  939.                     }
  940.                 }
  941.             }
  942.             pendingRequests--;
  943.             var row = request.DOMNode;
  944.             /* Unpack the children from the row */
  945.             var profilerCell = row.children[1];
  946.             var methodCell = row.children[2];
  947.             var statusCodeCell = row.children[4];
  948.             var statusCodeElem = statusCodeCell.children[0];
  949.             var durationCell = row.children[6];
  950.             if (request.error) {
  951.                 row.className = 'sf-ajax-request sf-ajax-request-error';
  952.                 methodCell.className = 'sf-ajax-request-error';
  953.                 successStreak = 0;
  954.             } else {
  955.                 row.className = 'sf-ajax-request sf-ajax-request-ok';
  956.                 successStreak++;
  957.             }
  958.             if (request.statusCode) {
  959.                 if (request.statusCode < 300) {
  960.                     statusCodeElem.setAttribute('class', 'sf-toolbar-status');
  961.                 } else if (request.statusCode < 400) {
  962.                     statusCodeElem.setAttribute('class', 'sf-toolbar-status sf-toolbar-status-yellow');
  963.                 } else {
  964.                     statusCodeElem.setAttribute('class', 'sf-toolbar-status sf-toolbar-status-red');
  965.                 }
  966.                 statusCodeElem.textContent = request.statusCode;
  967.             } else {
  968.                 statusCodeElem.setAttribute('class', 'sf-toolbar-status sf-toolbar-status-red');
  969.             }
  970.             if (request.duration) {
  971.                 durationCell.textContent = request.duration + 'ms';
  972.             }
  973.             if (request.profilerUrl) {
  974.                 profilerCell.textContent = '';
  975.                 var profilerLink = document.createElement('a');
  976.                 profilerLink.setAttribute('href', request.statusCode < 400 ? request.profilerUrl : request.profilerUrl + '?panel=exception');
  977.                 profilerLink.textContent = request.profile;
  978.                 profilerCell.appendChild(profilerLink);
  979.             }
  980.             renderAjaxRequests();
  981.         };
  982.         var addEventListener;
  983.         var el = document.createElement('div');
  984.         if (!('addEventListener' in el)) {
  985.             addEventListener = function (element, eventName, callback) {
  986.                 element.attachEvent('on' + eventName, callback);
  987.             };
  988.         } else {
  989.             addEventListener = function (element, eventName, callback) {
  990.                 element.addEventListener(eventName, callback, false);
  991.             };
  992.         }
  993.         {% if excluded_ajax_paths is defined %}
  994.             if (window.fetch && window.fetch.polyfill === undefined) {
  995.                 var oldFetch = window.fetch;
  996.                 window.fetch = function () {
  997.                     var promise = oldFetch.apply(this, arguments);
  998.                     var url = arguments[0];
  999.                     var params = arguments[1];
  1000.                     var paramType = Object.prototype.toString.call(arguments[0]);
  1001.                     if (paramType === '[object Request]') {
  1002.                         url = arguments[0].url;
  1003.                         params = {
  1004.                             method: arguments[0].method,
  1005.                             credentials: arguments[0].credentials,
  1006.                             headers: arguments[0].headers,
  1007.                             mode: arguments[0].mode,
  1008.                             redirect: arguments[0].redirect
  1009.                         };
  1010.                     } else {
  1011.                         url = String(url);
  1012.                     }
  1013.                     if (!url.match(new RegExp({{ excluded_ajax_paths|json_encode|raw }}))) {
  1014.                         var method = 'GET';
  1015.                         if (params && params.method !== undefined) {
  1016.                             method = params.method;
  1017.                         }
  1018.                         var stackElement = {
  1019.                             error: false,
  1020.                             url: url,
  1021.                             method: method,
  1022.                             type: 'fetch',
  1023.                             start: new Date()
  1024.                         };
  1025.                         var idx = requestStack.push(stackElement) - 1;
  1026.                         promise.then(function (r) {
  1027.                             stackElement.duration = new Date() - stackElement.start;
  1028.                             stackElement.error = r.status < 200 || r.status >= 400;
  1029.                             stackElement.statusCode = r.status;
  1030.                             stackElement.profile = r.headers.get('x-debug-token');
  1031.                             stackElement.profilerUrl = r.headers.get('x-debug-token-link');
  1032.                             stackElement.toolbarReplaceFinished = false;
  1033.                             stackElement.toolbarReplace = '1' === r.headers.get('Symfony-Debug-Toolbar-Replace');
  1034.                             finishAjaxRequest(idx);
  1035.                         }, function (e){
  1036.                             stackElement.error = true;
  1037.                             finishAjaxRequest(idx);
  1038.                         });
  1039.                         startAjaxRequest(idx);
  1040.                     }
  1041.                     return promise;
  1042.                 };
  1043.             }
  1044.             if (window.XMLHttpRequest && XMLHttpRequest.prototype.addEventListener) {
  1045.                 var proxied = XMLHttpRequest.prototype.open;
  1046.                 XMLHttpRequest.prototype.open = function(method, url, async, user, pass) {
  1047.                     var self = this;
  1048.                     /* prevent logging AJAX calls to static and inline files, like templates */
  1049.                     var path = url;
  1050.                     if (url.substr(0, 1) === '/') {
  1051.                         if (0 === url.indexOf('{{ request.basePath|e('js') }}')) {
  1052.                             path = url.substr({{ request.basePath|length }});
  1053.                         }
  1054.                     }
  1055.                     else if (0 === url.indexOf('{{ (request.schemeAndHttpHost ~ request.basePath)|e('js') }}')) {
  1056.                         path = url.substr({{ (request.schemeAndHttpHost ~ request.basePath)|length }});
  1057.                     }
  1058.                     if (!path.match(new RegExp({{ excluded_ajax_paths|json_encode|raw }}))) {
  1059.                         var stackElement = {
  1060.                             error: false,
  1061.                             url: url,
  1062.                             method: method,
  1063.                             type: 'xhr',
  1064.                             start: new Date()
  1065.                         };
  1066.                         var idx = requestStack.push(stackElement) - 1;
  1067.                         this.addEventListener('readystatechange', function() {
  1068.                             if (self.readyState == 4) {
  1069.                                 stackElement.duration = new Date() - stackElement.start;
  1070.                                 stackElement.error = self.status < 200 || self.status >= 400;
  1071.                                 stackElement.statusCode = self.status;
  1072.                                 extractHeaders(self, stackElement);
  1073.                                 finishAjaxRequest(idx);
  1074.                             }
  1075.                         }, false);
  1076.                         startAjaxRequest(idx);
  1077.                     }
  1078.                     proxied.apply(this, Array.prototype.slice.call(arguments));
  1079.                 };
  1080.             }
  1081.         {% endif %}
  1082.         return {
  1083.             hasClass: hasClass,
  1084.             removeClass: removeClass,
  1085.             addClass: addClass,
  1086.             toggleClass: toggleClass,
  1087.             getPreference: getPreference,
  1088.             setPreference: setPreference,
  1089.             addEventListener: addEventListener,
  1090.             request: request,
  1091.             renderAjaxRequests: renderAjaxRequests,
  1092.             load: function(selector, url, onSuccess, onError, options) {
  1093.                 var el = document.getElementById(selector);
  1094.                 if (el && el.getAttribute('data-sfurl') !== url) {
  1095.                     request(
  1096.                         url,
  1097.                         function(xhr) {
  1098.                             el.innerHTML = xhr.responseText;
  1099.                             el.setAttribute('data-sfurl', url);
  1100.                             removeClass(el, 'loading');
  1101.                             var pending = pendingRequests;
  1102.                             for (var i = 0; i < requestStack.length; i++) {
  1103.                                 startAjaxRequest(i);
  1104.                                 if (requestStack[i].duration) {
  1105.                                     finishAjaxRequest(i);
  1106.                                 }
  1107.                             }
  1108.                             /* Revert the pending state in case there was a start called without a finish above. */
  1109.                             pendingRequests = pending;
  1110.                             (onSuccess || noop)(xhr, el);
  1111.                         },
  1112.                         function(xhr) { (onError || noop)(xhr, el); },
  1113.                         '',
  1114.                         options
  1115.                     );
  1116.                 }
  1117.                 return this;
  1118.             },
  1119.             loadToolbar: function(token, newToken) {
  1120.                 newToken = (newToken || token);
  1121.                 this.load(
  1122.                     'sfwdt' + token,
  1123.                     '{{ path(\"_wdt\", { \"token\": \"xxxxxx\" }) }}'.replace(/xxxxxx/, newToken),
  1124.                     function(xhr, el) {
  1125.                         /* Evaluate in global scope scripts embedded inside the toolbar */
  1126.                         var i, scripts = [].slice.call(el.querySelectorAll('script'));
  1127.                         for (i = 0; i < scripts.length; ++i) {
  1128.                             eval.call({}, scripts[i].firstChild.nodeValue);
  1129.                         }
  1130.                         el.style.display = -1 !== xhr.responseText.indexOf('sf-toolbarreset') ? 'block' : 'none';
  1131.                         if (el.style.display == 'none') {
  1132.                             return;
  1133.                         }
  1134.                         if (getPreference('toolbar/displayState') == 'none') {
  1135.                             document.getElementById('sfToolbarMainContent-' + newToken).style.display = 'none';
  1136.                             document.getElementById('sfToolbarClearer-' + newToken).style.display = 'none';
  1137.                             document.getElementById('sfMiniToolbar-' + newToken).style.display = 'block';
  1138.                         } else {
  1139.                             document.getElementById('sfToolbarMainContent-' + newToken).style.display = 'block';
  1140.                             document.getElementById('sfToolbarClearer-' + newToken).style.display = 'block';
  1141.                             document.getElementById('sfMiniToolbar-' + newToken).style.display = 'none';
  1142.                         }
  1143.                         /* Handle toolbar-info position */
  1144.                         var toolbarBlocks = [].slice.call(el.querySelectorAll('.sf-toolbar-block'));
  1145.                         for (i = 0; i < toolbarBlocks.length; ++i) {
  1146.                             toolbarBlocks[i].onmouseover = function () {
  1147.                                 var toolbarInfo = this.querySelectorAll('.sf-toolbar-info')[0];
  1148.                                 var pageWidth = document.body.clientWidth;
  1149.                                 var elementWidth = toolbarInfo.offsetWidth;
  1150.                                 var leftValue = (elementWidth + this.offsetLeft) - pageWidth;
  1151.                                 var rightValue = (elementWidth + (pageWidth - this.offsetLeft)) - pageWidth;
  1152.                                 /* Reset right and left value, useful on window resize */
  1153.                                 toolbarInfo.style.right = '';
  1154.                                 toolbarInfo.style.left = '';
  1155.                                 if (elementWidth > pageWidth) {
  1156.                                     toolbarInfo.style.left = 0;
  1157.                                 }
  1158.                                 else if (leftValue > 0 && rightValue > 0) {
  1159.                                     toolbarInfo.style.right = (rightValue * -1) + 'px';
  1160.                                 } else if (leftValue < 0) {
  1161.                                     toolbarInfo.style.left = 0;
  1162.                                 } else {
  1163.                                     toolbarInfo.style.right = '0px';
  1164.                                 }
  1165.                             };
  1166.                         }
  1167.                         addEventListener(document.getElementById('sfToolbarHideButton-' + newToken), 'click', function (event) {
  1168.                             event.preventDefault();
  1169.                             var p = this.parentNode;
  1170.                             p.style.display = 'none';
  1171.                             (p.previousElementSibling || p.previousSibling).style.display = 'none';
  1172.                             document.getElementById('sfMiniToolbar-' + newToken).style.display = 'block';
  1173.                             setPreference('toolbar/displayState', 'none');
  1174.                         });
  1175.                         addEventListener(document.getElementById('sfToolbarMiniToggler-' + newToken), 'click', function (event) {
  1176.                             event.preventDefault();
  1177.                             var elem = this.parentNode;
  1178.                             if (elem.style.display == 'none') {
  1179.                                 document.getElementById('sfToolbarMainContent-' + newToken).style.display = 'none';
  1180.                                 document.getElementById('sfToolbarClearer-' + newToken).style.display = 'none';
  1181.                                 elem.style.display = 'block';
  1182.                             } else {
  1183.                                 document.getElementById('sfToolbarMainContent-' + newToken).style.display = 'block';
  1184.                                 document.getElementById('sfToolbarClearer-' + newToken).style.display = 'block';
  1185.                                 elem.style.display = 'none'
  1186.                             }
  1187.                             setPreference('toolbar/displayState', 'block');
  1188.                         });
  1189.                         renderAjaxRequests();
  1190.                         addEventListener(document.querySelector('.sf-toolbar-block-ajax'), 'mouseenter', function (event) {
  1191.                             var elem = document.querySelector('.sf-toolbar-block-ajax .sf-toolbar-info');
  1192.                             elem.scrollTop = elem.scrollHeight;
  1193.                         });
  1194.                         addEventListener(document.querySelector('.sf-toolbar-block-ajax > .sf-toolbar-icon'), 'click', function (event) {
  1195.                             event.preventDefault();
  1196.                             toggleClass(this.parentNode, 'hover');
  1197.                         });
  1198.                         var dumpInfo = document.querySelector('.sf-toolbar-block-dump .sf-toolbar-info');
  1199.                         if (null !== dumpInfo) {
  1200.                             addEventListener(dumpInfo, 'sfbeforedumpcollapse', function () {
  1201.                                 dumpInfo.style.minHeight = dumpInfo.getBoundingClientRect().height+'px';
  1202.                             });
  1203.                             addEventListener(dumpInfo, 'mouseleave', function () {
  1204.                                 dumpInfo.style.minHeight = '';
  1205.                             });
  1206.                         }
  1207.                     },
  1208.                     function(xhr) {
  1209.                         if (xhr.status !== 0) {
  1210.                             var sfwdt = document.getElementById('sfwdt' + token);
  1211.                             sfwdt.innerHTML = '\\
  1212.                                 <div class=\"sf-toolbarreset\">\\
  1213.                                     <div class=\"sf-toolbar-icon\"><svg width=\"26\" height=\"28\" xmlns=\"http://www.w3.org/2000/svg\" version=\"1.1\" x=\"0px\" y=\"0px\" viewBox=\"0 0 26 28\" enable-background=\"new 0 0 26 28\" xml:space=\"preserve\"><path fill=\"#FFFFFF\" d=\"M13 0C5.8 0 0 5.8 0 13c0 7.2 5.8 13 13 13c7.2 0 13-5.8 13-13C26 5.8 20.2 0 13 0z M20 7.5 c-0.6 0-1-0.3-1-0.9c0-0.2 0-0.4 0.2-0.6c0.1-0.3 0.2-0.3 0.2-0.4c0-0.3-0.5-0.4-0.7-0.4c-2 0.1-2.5 2.7-2.9 4.8l-0.2 1.1 c1.1 0.2 1.9 0 2.4-0.3c0.6-0.4-0.2-0.8-0.1-1.3C18 9.2 18.4 9 18.7 8.9c0.5 0 0.8 0.5 0.8 1c0 0.8-1.1 2-3.3 1.9 c-0.3 0-0.5 0-0.7-0.1L15 14.1c-0.4 1.7-0.9 4.1-2.6 6.2c-1.5 1.8-3.1 2.1-3.8 2.1c-1.3 0-2.1-0.6-2.2-1.6c0-0.9 0.8-1.4 1.3-1.4 c0.7 0 1.2 0.5 1.2 1.1c0 0.5-0.2 0.6-0.4 0.7c-0.1 0.1-0.3 0.2-0.3 0.4c0 0.1 0.1 0.3 0.4 0.3c0.5 0 0.9-0.3 1.2-0.5 c1.3-1 1.7-2.9 2.4-6.2l0.1-0.8c0.2-1.1 0.5-2.3 0.8-3.5c-0.9-0.7-1.4-1.5-2.6-1.8c-0.8-0.2-1.3 0-1.7 0.4C8.4 10 8.6 10.7 9 11.1 l0.7 0.7c0.8 0.9 1.3 1.7 1.1 2.7c-0.3 1.6-2.1 2.8-4.3 2.1c-1.9-0.6-2.2-1.9-2-2.7c0.2-0.6 0.7-0.8 1.2-0.6 c0.5 0.2 0.7 0.8 0.6 1.3c0 0.1 0 0.1-0.1 0.3C6 15 5.9 15.2 5.9 15.3c-0.1 0.4 0.4 0.7 0.8 0.8c0.8 0.3 1.7-0.2 1.9-0.9 c0.2-0.6-0.2-1.1-0.4-1.2l-0.8-0.9c-0.4-0.4-1.2-1.5-0.8-2.8c0.2-0.5 0.5-1 0.9-1.4c1-0.7 2-0.8 3-0.6c1.3 0.4 1.9 1.2 2.8 1.9 c0.5-1.3 1.1-2.6 2-3.8c0.9-1 2-1.7 3.3-1.8C20 4.8 21 5.4 21 6.3C21 6.7 20.8 7.5 20 7.5z\"/></svg></div>\\
  1214.                                     An error occurred while loading the web debug toolbar. <a href=\"{{ path(\"_profiler_home\") }}' + newToken + '>Open the web profiler.</a>\\
  1215.                                 </div>\\
  1216.                             ';
  1217.                             sfwdt.setAttribute('class', 'sf-toolbar sf-error-toolbar');
  1218.                         }
  1219.                     },
  1220.                     { maxTries: 5 }
  1221.                 );
  1222.                 return this;
  1223.             },
  1224.             toggle: function(selector, elOn, elOff) {
  1225.                 var tmp = elOn.style.display,
  1226.                     el = document.getElementById(selector);
  1227.                 elOn.style.display = elOff.style.display;
  1228.                 elOff.style.display = tmp;
  1229.                 if (el) {
  1230.                     el.style.display = 'none' === tmp ? 'none' : 'block';
  1231.                 }
  1232.                 return this;
  1233.             },
  1234.             createTabs: function() {
  1235.                 var tabGroups = document.querySelectorAll('.sf-tabs:not([data-processed=true])');
  1236.                 /* create the tab navigation for each group of tabs */
  1237.                 for (var i = 0; i < tabGroups.length; i++) {
  1238.                     var tabs = tabGroups[i].querySelectorAll(':scope > .tab');
  1239.                     var tabNavigation = document.createElement('ul');
  1240.                     tabNavigation.className = 'tab-navigation';
  1241.                     var selectedTabId = 'tab-' + i + '-0'; /* select the first tab by default */
  1242.                     for (var j = 0; j < tabs.length; j++) {
  1243.                         var tabId = 'tab-' + i + '-' + j;
  1244.                         var tabTitle = tabs[j].querySelector('.tab-title').innerHTML;
  1245.                         var tabNavigationItem = document.createElement('li');
  1246.                         tabNavigationItem.setAttribute('data-tab-id', tabId);
  1247.                         if (hasClass(tabs[j], 'active')) { selectedTabId = tabId; }
  1248.                         if (hasClass(tabs[j], 'disabled')) { addClass(tabNavigationItem, 'disabled'); }
  1249.                         tabNavigationItem.innerHTML = tabTitle;
  1250.                         tabNavigation.appendChild(tabNavigationItem);
  1251.                         var tabContent = tabs[j].querySelector('.tab-content');
  1252.                         tabContent.parentElement.setAttribute('id', tabId);
  1253.                     }
  1254.                     tabGroups[i].insertBefore(tabNavigation, tabGroups[i].firstChild);
  1255.                     addClass(document.querySelector('[data-tab-id=\"' + selectedTabId + '\"]'), 'active');
  1256.                 }
  1257.                 /* display the active tab and add the 'click' event listeners */
  1258.                 for (i = 0; i < tabGroups.length; i++) {
  1259.                     tabNavigation = tabGroups[i].querySelectorAll(':scope > .tab-navigation li');
  1260.                     for (j = 0; j < tabNavigation.length; j++) {
  1261.                         tabId = tabNavigation[j].getAttribute('data-tab-id');
  1262.                         document.getElementById(tabId).querySelector('.tab-title').className = 'hidden';
  1263.                         if (hasClass(tabNavigation[j], 'active')) {
  1264.                             document.getElementById(tabId).className = 'block';
  1265.                         } else {
  1266.                             document.getElementById(tabId).className = 'hidden';
  1267.                         }
  1268.                         tabNavigation[j].addEventListener('click', function(e) {
  1269.                             var activeTab = e.target || e.srcElement;
  1270.                             /* needed because when the tab contains HTML contents, user can click */
  1271.                             /* on any of those elements instead of their parent '<li>' element */
  1272.                             while (activeTab.tagName.toLowerCase() !== 'li') {
  1273.                                 activeTab = activeTab.parentNode;
  1274.                             }
  1275.                             /* get the full list of tabs through the parent of the active tab element */
  1276.                             var tabNavigation = activeTab.parentNode.children;
  1277.                             for (var k = 0; k < tabNavigation.length; k++) {
  1278.                                 var tabId = tabNavigation[k].getAttribute('data-tab-id');
  1279.                                 document.getElementById(tabId).className = 'hidden';
  1280.                                 removeClass(tabNavigation[k], 'active');
  1281.                             }
  1282.                             addClass(activeTab, 'active');
  1283.                             var activeTabId = activeTab.getAttribute('data-tab-id');
  1284.                             document.getElementById(activeTabId).className = 'block';
  1285.                         });
  1286.                     }
  1287.                     tabGroups[i].setAttribute('data-processed', 'true');
  1288.                 }
  1289.             },
  1290.             createToggles: function() {
  1291.                 var toggles = document.querySelectorAll('.sf-toggle:not([data-processed=true])');
  1292.                 for (var i = 0; i < toggles.length; i++) {
  1293.                     var elementSelector = toggles[i].getAttribute('data-toggle-selector');
  1294.                     var element = document.querySelector(elementSelector);
  1295.                     addClass(element, 'sf-toggle-content');
  1296.                     if (toggles[i].hasAttribute('data-toggle-initial') && toggles[i].getAttribute('data-toggle-initial') == 'display') {
  1297.                         addClass(toggles[i], 'sf-toggle-on');
  1298.                         addClass(element, 'sf-toggle-visible');
  1299.                     } else {
  1300.                         addClass(toggles[i], 'sf-toggle-off');
  1301.                         addClass(element, 'sf-toggle-hidden');
  1302.                     }
  1303.                     addEventListener(toggles[i], 'click', function(e) {
  1304.                         e.preventDefault();
  1305.                         if ('' !== window.getSelection().toString()) {
  1306.                             /* Don't do anything on text selection */
  1307.                             return;
  1308.                         }
  1309.                         var toggle = e.target || e.srcElement;
  1310.                         /* needed because when the toggle contains HTML contents, user can click */
  1311.                         /* on any of those elements instead of their parent '.sf-toggle' element */
  1312.                         while (!hasClass(toggle, 'sf-toggle')) {
  1313.                             toggle = toggle.parentNode;
  1314.                         }
  1315.                         var element = document.querySelector(toggle.getAttribute('data-toggle-selector'));
  1316.                         toggleClass(toggle, 'sf-toggle-on');
  1317.                         toggleClass(toggle, 'sf-toggle-off');
  1318.                         toggleClass(element, 'sf-toggle-hidden');
  1319.                         toggleClass(element, 'sf-toggle-visible');
  1320.                         /* the toggle doesn't change its contents when clicking on it */
  1321.                         if (!toggle.hasAttribute('data-toggle-alt-content')) {
  1322.                             return;
  1323.                         }
  1324.                         if (!toggle.hasAttribute('data-toggle-original-content')) {
  1325.                             toggle.setAttribute('data-toggle-original-content', toggle.innerHTML);
  1326.                         }
  1327.                         var currentContent = toggle.innerHTML;
  1328.                         var originalContent = toggle.getAttribute('data-toggle-original-content');
  1329.                         var altContent = toggle.getAttribute('data-toggle-alt-content');
  1330.                         toggle.innerHTML = currentContent !== altContent ? altContent : originalContent;
  1331.                     });
  1332.                     /* Prevents from disallowing clicks on links inside toggles */
  1333.                     var toggleLinks = toggles[i].querySelectorAll('a');
  1334.                     for (var j = 0; j < toggleLinks.length; j++) {
  1335.                         addEventListener(toggleLinks[j], 'click', function(e) {
  1336.                             e.stopPropagation();
  1337.                         });
  1338.                     }
  1339.                     toggles[i].setAttribute('data-processed', 'true');
  1340.                 }
  1341.             },
  1342.             createFilters: function() {
  1343.                 document.querySelectorAll('[data-filters] [data-filter]').forEach(function (filter) {
  1344.                     var filters = filter.closest('[data-filters]'),
  1345.                         type = 'choice',
  1346.                         name = filter.dataset.filter,
  1347.                         ucName = name.charAt(0).toUpperCase()+name.slice(1),
  1348.                         list = document.createElement('ul'),
  1349.                         values = filters.dataset['filter'+ucName] || filters.querySelectorAll('[data-filter-'+name+']'),
  1350.                         labels = {},
  1351.                         defaults = null,
  1352.                         indexed = {},
  1353.                         processed = {};
  1354.                     if (typeof values === 'string') {
  1355.                         type = 'level';
  1356.                         labels = values.split(',');
  1357.                         values = values.toLowerCase().split(',');
  1358.                         defaults = values.length - 1;
  1359.                     }
  1360.                     addClass(list, 'filter-list');
  1361.                     addClass(list, 'filter-list-'+type);
  1362.                     values.forEach(function (value, i) {
  1363.                         if (value instanceof HTMLElement) {
  1364.                             value = value.dataset['filter'+ucName];
  1365.                         }
  1366.                         if (value in processed) {
  1367.                             return;
  1368.                         }
  1369.                         var option = document.createElement('li'),
  1370.                             label = i in labels ? labels[i] : value,
  1371.                             active = false,
  1372.                             matches;
  1373.                         if ('' === label) {
  1374.                             option.innerHTML = '<em>(none)</em>';
  1375.                         } else {
  1376.                             option.innerText = label;
  1377.                         }
  1378.                         option.dataset.filter = value;
  1379.                         option.setAttribute('title', 1 === (matches = filters.querySelectorAll('[data-filter-'+name+'=\"'+value+'\"]').length) ? 'Matches 1 row' : 'Matches '+matches+' rows');
  1380.                         indexed[value] = i;
  1381.                         list.appendChild(option);
  1382.                         addEventListener(option, 'click', function () {
  1383.                             if ('choice' === type) {
  1384.                                 filters.querySelectorAll('[data-filter-'+name+']').forEach(function (row) {
  1385.                                     if (option.dataset.filter === row.dataset['filter'+ucName]) {
  1386.                                         toggleClass(row, 'filter-hidden-'+name);
  1387.                                     }
  1388.                                 });
  1389.                                 toggleClass(option, 'active');
  1390.                             } else if ('level' === type) {
  1391.                                 if (i === this.parentNode.querySelectorAll('.active').length - 1) {
  1392.                                     return;
  1393.                                 }
  1394.                                 this.parentNode.querySelectorAll('li').forEach(function (currentOption, j) {
  1395.                                     if (j <= i) {
  1396.                                         addClass(currentOption, 'active');
  1397.                                         if (i === j) {
  1398.                                             addClass(currentOption, 'last-active');
  1399.                                         } else {
  1400.                                             removeClass(currentOption, 'last-active');
  1401.                                         }
  1402.                                     } else {
  1403.                                         removeClass(currentOption, 'active');
  1404.                                         removeClass(currentOption, 'last-active');
  1405.                                     }
  1406.                                 });
  1407.                                 filters.querySelectorAll('[data-filter-'+name+']').forEach(function (row) {
  1408.                                     if (i < indexed[row.dataset['filter'+ucName]]) {
  1409.                                         addClass(row, 'filter-hidden-'+name);
  1410.                                     } else {
  1411.                                         removeClass(row, 'filter-hidden-'+name);
  1412.                                     }
  1413.                                 });
  1414.                             }
  1415.                         });
  1416.                         if ('choice' === type) {
  1417.                             active = null === defaults || 0 <= defaults.indexOf(value);
  1418.                         } else if ('level' === type) {
  1419.                             active = i <= defaults;
  1420.                             if (active && i === defaults) {
  1421.                                 addClass(option, 'last-active');
  1422.                             }
  1423.                         }
  1424.                         if (active) {
  1425.                             addClass(option, 'active');
  1426.                         } else {
  1427.                             filters.querySelectorAll('[data-filter-'+name+'=\"'+value+'\"]').forEach(function (row) {
  1428.                                 toggleClass(row, 'filter-hidden-'+name);
  1429.                             });
  1430.                         }
  1431.                         processed[value] = true;
  1432.                     });
  1433.                     if (1 < list.childNodes.length) {
  1434.                         filter.appendChild(list);
  1435.                         filter.dataset.filtered = '';
  1436.                     }
  1437.                 });
  1438.             }
  1439.         };
  1440.     })();
  1441.     Sfjs.addEventListener(document, 'DOMContentLoaded', function() {
  1442.         Sfjs.createTabs();
  1443.         Sfjs.createToggles();
  1444.     });
  1445. /*]]>*/</script>
  1446. ""@WebProfiler/Profiler/base_js.html.twig""/home/xearts/stg1.work/pipit-gacha/releases/16/vendor/symfony/web-profiler-bundle/Resources/views/Profiler/base_js.html.twig");
  1447.     }
  1448. }