!function(t){"use strict";class e{constructor(){this.mappings=[],this.isInitialized=!1}init(){if(this.isInitialized)return void console.warn("⚠️ TriggerClick already initialized");const t=document.querySelectorAll("[data-tab-trigger]"),e=document.querySelectorAll("[data-tab-target]");0!==t.length&&0!==e.length&&(t.forEach(t=>{const n=t.getAttribute("data-tab-trigger"),o=Array.from(e).filter(t=>t.getAttribute("data-tab-target")===n);0!==o.length?this.setupTrigger(t,o,n):console.warn(`⚠️ No target found for trigger value: "${n}"`)}),this.isInitialized=!0)}setupTrigger(t,e,n){const o=t=>{t.preventDefault(),e.forEach((t,e)=>{t.click()})};t.addEventListener("click",o),this.mappings.push({trigger:t,targets:e,value:n,handler:o})}destroy(){this.mappings.forEach(({trigger:t,handler:e})=>{t.removeEventListener("click",e)}),this.mappings=[],this.isInitialized=!1}}t.TriggerClick=e,"loading"===document.readyState?document.addEventListener("DOMContentLoaded",()=>{t.triggerClickSystem=new e,t.triggerClickSystem.init()}):(t.triggerClickSystem=new e,t.triggerClickSystem.init())}(window),function(t){"use strict";t.ScrollLockManager=class{constructor(){this.isLocked=!1,this.scrollbarWidth=null,this.originalBodyPadding=null,this.originalBodyOverflow=null}getScrollbarWidth(){if(null!==this.scrollbarWidth)return this.scrollbarWidth;const t=document.createElement("div");t.style.visibility="hidden",t.style.overflow="scroll",t.style.width="100px",document.body.appendChild(t);const e=document.createElement("div");e.style.width="100%",t.appendChild(e);const n=t.offsetWidth-e.offsetWidth;return t.parentNode.removeChild(t),this.scrollbarWidth=n,n}lock(){if(this.isLocked)return void console.warn("⚠️ Scroll already locked");this.originalBodyPadding=document.body.style.paddingRight,this.originalBodyOverflow=document.body.style.overflow,t.lenis&&"function"==typeof t.lenis.stop?t.lenis.stop():console.warn(" ⚠️ Lenis not available - using CSS fallback only"),document.body.style.overflow="hidden";const e=this.getScrollbarWidth();e>0&&(document.body.style.paddingRight=`${e}px`),this.isLocked=!0}unlock(){this.isLocked?(t.lenis&&"function"==typeof t.lenis.start&&t.lenis.start(),document.body.style.overflow=this.originalBodyOverflow||"",document.body.style.paddingRight=this.originalBodyPadding||"",this.isLocked=!1):console.warn("⚠️ Scroll not locked")}getIsLocked(){return this.isLocked}forceUnlock(){console.warn("⚠️ Force unlock triggered"),t.lenis&&"function"==typeof t.lenis.start&&t.lenis.start(),document.body.style.overflow="",document.body.style.paddingRight="",this.isLocked=!1}}}(window),function(t){"use strict";t.NodeLazyInit=class{constructor(){this.activeNodeSystem=null,this.activeTabId=null,this.nodeSystemInstances=new Map}async initializeForTab(e){try{if(void 0!==t.NodeConnectionSystem)try{t.NodeConnectionSystem.destroy()}catch(t){console.warn(" ⚠️ Could not destroy global instance:",t)}this.activeNodeSystem&&(await this.destroyNodeSystem(this.activeNodeSystem),this.activeNodeSystem=null),await this.waitForReflow();const n=document.querySelector(`[data-tab-content="${e}"]`);if(!n)return console.error(`❌ Tab content not found for: "${e}"`),null;const o=n.querySelector("[data-node-settings]");if(!o)return console.warn(`⚠️ No [data-node-settings] found in tab: "${e}"`),console.warn(" Node system will not be initialized for this tab"),null;const i=[],r=[];document.querySelectorAll("[data-tab-content]").forEach(t=>{if(t.getAttribute("data-tab-content")===e)return;t.querySelectorAll("[data-node-settings]").forEach(t=>{const e=t.getAttribute("data-node-chain");t.setAttribute("data-node-settings-hidden","true"),t.setAttribute("data-node-chain-hidden",e),t.removeAttribute("data-node-settings"),t.removeAttribute("data-node-chain"),r.push(t)});t.querySelectorAll("[data-node-id]").forEach(t=>{const e=t.getAttribute("data-node-id");t.setAttribute("data-node-id-hidden",e),t.removeAttribute("data-node-id"),i.push(t)})});document.querySelectorAll("[data-tab-trigger][data-node-id]").forEach(t=>{if(t.getAttribute("data-tab-trigger")===e)return;[t,...t.querySelectorAll("[data-node-id]")].forEach(t=>{const e=t.getAttribute("data-node-id");e&&(t.setAttribute("data-node-id-hidden",e),t.removeAttribute("data-node-id"),i.push(t))})});const a=await this.createNodeSystem(o);return i.forEach(t=>{const e=t.getAttribute("data-node-id-hidden");t.setAttribute("data-node-id",e),t.removeAttribute("data-node-id-hidden")}),r.forEach(t=>{const e=t.getAttribute("data-node-chain-hidden");t.setAttribute("data-node-settings",""),t.setAttribute("data-node-chain",e),t.removeAttribute("data-node-settings-hidden"),t.removeAttribute("data-node-chain-hidden")}),a?(this.activeNodeSystem=a,this.activeTabId=e,this.nodeSystemInstances.set(e,a),a):(console.error(`❌ Failed to create node system for tab: "${e}"`),null)}catch(t){return console.error("❌ Node system initialization failed:",t),null}}async createNodeSystem(e){if(void 0===t.NodeConnectionSystem)return console.error("❌ NodeConnectionSystem not loaded!"),console.error(" Make sure node-connection-system.js is loaded before this script"),null;try{if(!t.NodeConnectionSystem.init())return console.error("❌ NodeConnectionSystem.init failed"),null;const e=t.NodeConnectionSystem.getInstance();return e?(e.svgOverlay=document.getElementById("node-connection-svg-overlay"),e):(console.error("❌ NodeConnectionSystem.getInstance returned null"),null)}catch(t){return console.error("❌ Error creating node system:",t),null}}async waitForReflow(){return new Promise(t=>{requestAnimationFrame(()=>{requestAnimationFrame(()=>{t()})})})}async destroyNodeSystem(t){if(t)try{"function"==typeof t.destroy?t.destroy():(console.warn(" ⚠️ nodeSystem.destroy() not available - using manual cleanup"),this.manualCleanup(t)),t.svgOverlay&&t.svgOverlay.parentNode&&t.svgOverlay.parentNode.removeChild(t.svgOverlay)}catch(t){console.error(" ❌ Error during node system destruction:",t)}}manualCleanup(t){t.animationFrameId&&cancelAnimationFrame(t.animationFrameId);const e=t.svgOverlay||document.querySelector("svg[data-node-overlay]");e&&e.parentNode&&e.parentNode.removeChild(e),t.connections&&(t.connections=[])}getActiveNodeSystem(){return this.activeNodeSystem}getActiveTabId(){return this.activeTabId}hasNodeSystem(t){return this.nodeSystemInstances.has(t)}getNodeSystemForTab(t){return this.nodeSystemInstances.get(t)||null}async destroyAll(){for(const[t,e]of this.nodeSystemInstances)await this.destroyNodeSystem(e);this.nodeSystemInstances.clear(),this.activeNodeSystem=null,this.activeTabId=null}}}(window),function(t){"use strict";class e{constructor(){this.scrollLock=new t.ScrollLockManager,this.nodeLazyInit=new t.NodeLazyInit,this.isAnimating=!1,this.isInitialized=!1,this.currentTabId=null}init(){if(this.isInitialized)console.warn("⚠️ TabOrchestrator already initialized");else{if(void 0!==t.NodeConnectionSystem)try{t.NodeConnectionSystem.destroy()}catch(t){console.warn(" ⚠️ Could not destroy auto-init node system:",t)}this.scrollLock.lock(),this.setupButtonListeners(),this.isInitialized=!0}}setupButtonListeners(){const t=document.querySelectorAll("[data-tab-trigger]");if(0===t.length)return console.warn("⚠️ No [data-tab-trigger] buttons found"),void console.warn(' Make sure your buttons have data-tab-trigger="neubau|sanierung"');t.forEach((t,e)=>{const n=t.getAttribute("data-tab-trigger");t.addEventListener("click",async t=>{t.preventDefault(),this.isAnimating?console.warn("⏳ Animation in progress - please wait"):await this.activateTab(n)})})}async activateTab(t){this.isAnimating=!0;try{const e=document.getElementById("node-connection-svg-overlay");e&&(e.style.opacity="0"),await this.switchWebflowTab(t);const n=await this.nodeLazyInit.initializeForTab(t);n&&await this.revealPath(n),this.scrollLock.unlock(),this.currentTabId=t}catch(t){console.error("\n❌ Tab activation failed:",t),console.error(" Unlocking scroll as fail-safe..."),this.scrollLock.unlock()}finally{this.isAnimating=!1}}async switchWebflowTab(t){await this.delay(100)}async revealPath(e){const n=e.svgOverlay||document.getElementById("node-connection-svg-overlay");if(n)return new Promise(e=>{if(void 0===t.gsap)return console.error(" ❌ GSAP not loaded - path reveal skipped"),void e();t.gsap.to(n,{opacity:1,duration:.8,ease:"power2.out",onComplete:()=>{e()}})});console.warn(" ⚠️ SVG overlay not found - skipping path reveal")}delay(t){return new Promise(e=>setTimeout(e,t))}getCurrentTabId(){return this.currentTabId}getIsAnimating(){return this.isAnimating}emergencyUnlock(){console.warn("🚨 Emergency unlock triggered!"),this.scrollLock.forceUnlock(),this.isAnimating=!1}}function n(){const n=[];if(void 0===t.ScrollLockManager&&n.push("ScrollLockManager"),void 0===t.NodeLazyInit&&n.push("NodeLazyInit"),void 0===t.gsap&&console.warn("⚠️ GSAP not loaded - path reveal animations will be skipped"),void 0===t.lenis&&console.warn("⚠️ Lenis not loaded - will use native smooth scroll fallback"),n.length>0)return console.error("❌ Missing required dependencies:",n.join(", ")),console.error(" Make sure all scripts are loaded in the correct order"),void console.error(" See README.md for script loading order");t.tabOrchestrator=new e,t.tabOrchestrator.init()}t.TabOrchestrator=e,"loading"===document.readyState?document.addEventListener("DOMContentLoaded",n):n()}(window);