/* Scoped to: politician-party-template-faq */
(function() {
  'use strict';
  var componentRoots = document.querySelectorAll('[data-component-slug="politician-party-template-faq"]');
  componentRoots.forEach(function(componentRoot) {
    // Helper to query within component, with fallback to document for sibling elements
    var $ = function(sel) { 
      return componentRoot.querySelector(sel) || document.querySelector('[data-component-slug="politician-party-template-faq"] ~ ' + sel) || document.querySelector(sel);
    };
    var $$ = function(sel) { 
      var results = componentRoot.querySelectorAll(sel);
      return results.length ? results : document.querySelectorAll(sel);
    };
    // Original component JS runs in this scope
    (function () { setTimeout(function () { var allowMultiple = "{{allow_multiple_open}}" === "true"; var container = document.querySelector("[data-accordion-container]"); if (!container) return; var items = container.querySelectorAll("[data-accordion-item]"); items.forEach(function (item) { var trigger = item.querySelector("[data-accordion-trigger]"); var content = item.querySelector("[data-accordion-content]"); var icon = item.querySelector("[data-accordion-icon]"); trigger.addEventListener("click", function () { var isOpen = trigger.getAttribute("aria-expanded") === "true"; if (!allowMultiple && !isOpen) { items.forEach(function (other) { if (other !== item) { var ot = other.querySelector("[data-accordion-trigger]"); var oc = other.querySelector("[data-accordion-content]"); var oi = other.querySelector("[data-accordion-icon]"); ot.setAttribute("aria-expanded", "false"); oc.style.maxHeight = null; other.classList.remove("active"); if (oi) oi.src = "https://res.cloudinary.com/duukclzsd/image/upload/v1768045389/seltrix/templates/politician-party-template/arrow-down.svg"; } }); } trigger.setAttribute("aria-expanded", String(!isOpen)); item.classList.toggle("active"); content.style.maxHeight = isOpen ? null : content.scrollHeight + "px"; icon.src = isOpen ? "https://res.cloudinary.com/duukclzsd/image/upload/v1768045389/seltrix/templates/politician-party-template/arrow-down.svg" : "https://res.cloudinary.com/duukclzsd/image/upload/v1768045391/seltrix/templates/politician-party-template/arrow-up.svg"; }); }); }, 0); })();
  });
})();