var/cache/dev_h1fd34e95d06eed5c36fd29fb7fdf12c5/twig/49/49b02ef627d6aa16994e6d3c23016cda.php line 33

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