var/cache/dev_h84c8f22dd5b56efafbd1519dd244edc2/twig/15/15066e5f4fc8a823afaf16396f6d6a81.php line 35

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