(function (window, document) { 'use strict'; if (window.CQInit && window.CQInit.__v1) return; var registry = []; function normalizeScope(scope) { if (!scope || scope === document || scope === document.body || scope === document.documentElement) { return document; } return scope; } function run(scope) { var root = normalizeScope(scope); for (var i = 0; i < registry.length; i += 1) { var item = registry[i]; if (!item || typeof item.init !== 'function') continue; try { item.init(root); } catch (_) { } } } function register(name, initFn) { if (!name || typeof initFn !== 'function') return; for (var i = 0; i < registry.length; i += 1) { if (registry[i] && registry[i].name === name) { registry[i].init = initFn; return; } } registry.push({ name: String(name), init: initFn }); } window.CQInit = { __v1: true, register: register, run: run }; if (document.readyState === 'loading') { document.addEventListener('DOMContentLoaded', function () { run(document); }); } else { run(document); } function bindAfterSwapListener() { var root = document.body || document; if (!root || !root.addEventListener) return; root.addEventListener('htmx:afterSwap', function (ev) { var target = ev && ev.target ? ev.target : document; run(target); }); } if (document.body) { bindAfterSwapListener(); } else { document.addEventListener('DOMContentLoaded', bindAfterSwapListener); } })(window, document);