Files
michaelschiemer/public/assets/js/main-BoqUNJka.js
Michael Schiemer 55a330b223 Enable Discovery debug logging for production troubleshooting
- Add DISCOVERY_LOG_LEVEL=debug
- Add DISCOVERY_SHOW_PROGRESS=true
- Temporary changes for debugging InitializerProcessor fixes on production
2025-08-11 20:13:26 +02:00

2 lines
74 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
var e=Object.defineProperty;const t=new Map;let i=!1,n=!1;performance.now();const r=document.createElement("div");r.style.position="fixed",r.style.bottom="0",r.style.left="0",r.style.font="12px monospace",r.style.color="#0f0",r.style.background="rgba(0,0,0,0.75)",r.style.padding="0.25rem 0.5rem",r.style.zIndex="9999",r.style.pointerEvents="none",r.style.display="none";const s=`<div style="width:${Math.min(0,100)}%;height:4px;background:#0f0;margin-top:4px;"></div>`;r.innerHTML+=s,r.style.lineHeight="1.4",document.body.appendChild(r);const o=new class{constructor({fps:e=!0}={}){this.fpsEnabled=e,this.fps=0,this.frameCount=0,this.lastTime=performance.now(),this.visible=!1,this.taskTimings=new Map,this.logs=[],this.container=document.createElement("div"),this.container.style.position="fixed",this.container.style.bottom="0",this.container.style.left="0",this.container.style.font="12px Consolas, monospace",this.container.style.color="#0f0",this.container.style.background="rgba(0,0,0,0.75)",this.container.style.padding="0.5rem",this.container.style.zIndex="9999",this.container.style.pointerEvents="none",this.container.style.lineHeight="1.4",this.container.style.whiteSpace="pre",this.container.style.display="none",document.body.appendChild(this.container),window.addEventListener("keydown",e=>{"§"===e.key&&(this.visible=!this.visible,this.container.style.display=this.visible?"block":"none")})}log(e){const t=(new Date).toLocaleTimeString();this.logs.push(`[${t}] ${e}`),this.logs.length>5&&this.logs.shift()}update(e=new Map){this.frameCount++;const t=performance.now();if(t-this.lastTime>=1e3){this.fps=this.frameCount,this.frameCount=0,this.lastTime=t;const i=[];for(const[e,t]of this.taskTimings.entries())i.push(`${e}: ${t.toFixed(2)}ms`);const n=Math.min(2*this.fps,100),r=this.logs.slice().reverse().join("\n");this.container.innerHTML=`\nFPS: ${this.fps} | Tasks: ${e.size}\n${i.join("\n")}\n<div style="width:${n}%;height:4px;background:#0f0;margin-top:4px;"></div>\n${r?"\nLogs:\n"+r:""}\n `}}trackTask(e,t){const i=performance.now();t();const n=performance.now()-i;this.taskTimings.set(e,n)}};function a(e,r,s={}){t.set(e,r),s.autoStart&&!i&&function(){if(i)return;function e(){for(const[e,r]of t)try{n?o.trackTask(e,r):r()}catch(i){c.warn("[Frameloop] Fehler in Task:",i)}n&&o.update(t),requestAnimationFrame(e)}i=!0,requestAnimationFrame(e)}()}function l(e){t.delete(e)}window.addEventListener("keydown",e=>{"§"===e.key&&(n=!n,r.style.display=n?"block":"none")});class c{static log(...e){this._write("log","[LOG]",e)}static warn(...e){this._write("warn","[WARN]",e)}static info(...e){this._write("info","[INFO]",e)}static error(...e){this._write("error","[ERROR]",e)}static _write(e,t,i){if(!this.enabled)return;const n=`${t} [${(new Date).toLocaleTimeString("de-DE")}] ${i.map(e=>{if(e instanceof Error)return`${e.name}: ${e.message}\n${e.stack||""}`;if("object"==typeof e&&null!==e)try{return JSON.stringify(e)}catch(t){return"[Circular Object]"}return e}).join(" ")}`;if("function"==typeof console[e]&&console[e](n),o&&"function"==typeof o.log)try{o.log(n)}catch(r){}}}var d;((t,i,n)=>{i in t?e(t,i,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[i]=n})(c,"symbol"!=typeof(d="enabled")?d+"":d,!0);const h=new Map,u={add(e,t,i,{module:n="global",options:r=!1}={}){e.addEventListener(t,i,r),h.has(n)||h.set(n,[]),h.get(n).push([e,t,i,r])},removeModule(e){const t=h.get(e);t&&(t.forEach(([e,t,i,n])=>{e.removeEventListener(t,i,n)}),h.delete(e))},clearAll(){for(const[e,t]of h.entries())t.forEach(([e,t,i,n])=>{e.removeEventListener(t,i,n)});h.clear()},debug(){console.table([...h.entries()].map(([e,t])=>({module:e,listeners:t.length})))}};function m(e,t,i,n=import.meta,r=!1){var s;const o="string"==typeof n?n:(null==(s=n.url)?void 0:s.split("/").slice(-2,-1)[0])||"unknown";return u.add(e,t,i,{module:o,options:r}),()=>{u.removeModule(o)}}class g{constructor(e,t={}){this.canvas=e,this.ctx=e.getContext("2d"),this.options={responsive:!0,pixelRatio:window.devicePixelRatio||1,...t},this.animationId=null,this.isAnimating=!1,this.init()}init(){this.setupCanvas(),this.options.responsive&&this.setupResponsive(),c.info("[CanvasManager] Initialized",{width:this.canvas.width,height:this.canvas.height,pixelRatio:this.options.pixelRatio})}setupCanvas(){this.resize(),this.canvas.style.width=this.canvas.width+"px",this.canvas.style.height=this.canvas.height+"px",this.options.pixelRatio>1&&this.ctx.scale(this.options.pixelRatio,this.options.pixelRatio)}setupResponsive(){m(window,"resize",()=>{this.resize()},"canvas-manager"),m(window,"orientationchange",()=>{setTimeout(()=>this.resize(),100)},"canvas-manager")}resize(){const e=this.canvas.parentElement,t=this.options.pixelRatio;let i,n;e&&"static"!==getComputedStyle(e).position?(i=e.clientWidth,n=e.clientHeight):(i=this.canvas.clientWidth||window.innerWidth,n=this.canvas.clientHeight||window.innerHeight),this.canvas.width=Math.floor(i*t),this.canvas.height=Math.floor(n*t),this.canvas.style.width=i+"px",this.canvas.style.height=n+"px",t>1&&this.ctx.scale(t,t),c.info("[CanvasManager] Resized",{displayWidth:i,displayHeight:n,canvasWidth:this.canvas.width,canvasHeight:this.canvas.height})}clear(){this.ctx.clearRect(0,0,this.canvas.width,this.canvas.height)}getSize(){return{width:this.canvas.clientWidth,height:this.canvas.clientHeight,pixelWidth:this.canvas.width,pixelHeight:this.canvas.height}}getMousePosition(e){const t=this.canvas.getBoundingClientRect();return{x:(e.clientX-t.left)*this.options.pixelRatio,y:(e.clientY-t.top)*this.options.pixelRatio}}startAnimation(e){this.isAnimating&&this.stopAnimation(),this.isAnimating=!0;const t=i=>{this.isAnimating&&(e(i),this.animationId=requestAnimationFrame(t))};this.animationId=requestAnimationFrame(t),c.info("[CanvasManager] Animation started")}stopAnimation(){this.animationId&&(cancelAnimationFrame(this.animationId),this.animationId=null),this.isAnimating=!1,c.info("[CanvasManager] Animation stopped")}destroy(){this.stopAnimation(),c.info("[CanvasManager] Destroyed")}}const f={initParallax(e,t){const i=new g(e),n=this.createParallaxElements(e,t);let r=!1;const s=()=>{r||(requestAnimationFrame(()=>{this.renderParallax(i,n,t),r=!1}),r=!0)};m(window,"scroll",s,"scroll-parallax"),m(window,"resize",s,"scroll-parallax"),s(),c.info("[ScrollEffects] Parallax initialized with",n.length,"elements")},createParallaxElements(e,t){const i=[],n=t.layers||3,r=t.elements||20;for(let s=0;s<r;s++)i.push({x:Math.random()*e.clientWidth,y:Math.random()*e.clientHeight*2,size:20*Math.random()+5,layer:Math.floor(Math.random()*n),speed:.1+.5*Math.random(),opacity:.7*Math.random()+.3,color:this.getLayerColor(Math.floor(Math.random()*n),t)});return i},getLayerColor(e,t){const i=t.colors||["rgba(100, 150, 255, 0.6)","rgba(150, 100, 255, 0.4)","rgba(200, 100, 150, 0.2)"];return i[e]||i[0]},renderParallax(e,t,i){e.clear();const n=window.pageYOffset,r=(n-(e.canvas.getBoundingClientRect().top+n))/window.innerHeight;t.forEach(t=>{const i=r*t.speed*100,n=t.y-i;n>-t.size&&n<e.canvas.clientHeight+t.size&&(e.ctx.save(),e.ctx.globalAlpha=t.opacity,e.ctx.fillStyle=t.color,e.ctx.beginPath(),e.ctx.arc(t.x,n,t.size,0,2*Math.PI),e.ctx.fill(),e.ctx.restore())})},initScrollAnimation(e,t){const i=new g(e),n=t.animation||"wave";let r=!1;const s=()=>{r||(requestAnimationFrame(()=>{this.renderScrollAnimation(i,n,t),r=!1}),r=!0)};m(window,"scroll",s,"scroll-animation"),m(window,"resize",s,"scroll-animation"),s(),c.info("[ScrollEffects] Scroll animation initialized:",n)},renderScrollAnimation(e,t,i){e.clear();const n=window.pageYOffset,r=n-(e.canvas.getBoundingClientRect().top+n),s=Math.max(0,Math.min(1,r/window.innerHeight));switch(t){case"wave":default:this.renderWaveAnimation(e,s,i);break;case"progress":this.renderProgressAnimation(e,s,i);break;case"morph":this.renderMorphAnimation(e,s,i)}},renderWaveAnimation(e,t,i){const{ctx:n}=e,{width:r,height:s}=e.getSize();n.strokeStyle=i.color||"rgba(100, 150, 255, 0.8)",n.lineWidth=i.lineWidth||3,n.beginPath();const o=(i.amplitude||50)*t,a=i.frequency||.02,l=t*Math.PI*2;for(let c=0;c<=r;c+=2){const e=s/2+Math.sin(c*a+l)*o;0===c?n.moveTo(c,e):n.lineTo(c,e)}n.stroke()},renderProgressAnimation(e,t,i){const{ctx:n}=e,{width:r,height:s}=e.getSize(),o=i.barHeight||10,a=s/2-o/2;n.fillStyle=i.backgroundColor||"rgba(255, 255, 255, 0.2)",n.fillRect(0,a,r,o),n.fillStyle=i.color||"rgba(100, 150, 255, 0.8)",n.fillRect(0,a,r*t,o)},renderMorphAnimation(e,t,i){const{ctx:n}=e,{width:r,height:s}=e.getSize();n.fillStyle=i.color||"rgba(100, 150, 255, 0.6)";const o=r/2,a=s/2,l=Math.min(r,s)/3;n.beginPath();const c=i.points||6;for(let d=0;d<=c;d++){const e=d/c*Math.PI*2,i=l*t*(.3*Math.sin(t*Math.PI*4+3*e)+1),r=o+Math.cos(e)*i,s=a+Math.sin(e)*i;0===d?n.moveTo(r,s):n.lineTo(r,s)}n.closePath(),n.fill()}},p={init(e,t){const i=new g(e),n=t.effect||"ripple",r={mouse:{x:0,y:0,isOver:!1},effects:[],lastTime:0};this.setupInteractionEvents(e,i,r,t),this.startAnimationLoop(i,r,n,t),c.info("[InteractiveEffects] Initialized with effect:",n)},setupInteractionEvents(e,t,i,n){m(e,"mousemove",e=>{const r=t.getMousePosition(e);i.mouse.x=r.x,i.mouse.y=r.y,"trail"===n.effect&&this.addTrailPoint(i,r.x,r.y)},"interactive-effects"),m(e,"mouseenter",()=>{i.mouse.isOver=!0},"interactive-effects"),m(e,"mouseleave",()=>{i.mouse.isOver=!1},"interactive-effects"),m(e,"click",e=>{const r=t.getMousePosition(e);this.addClickEffect(i,r.x,r.y,n)},"interactive-effects"),m(e,"touchstart",e=>{e.preventDefault();const r=e.touches[0],s=t.getMousePosition(r);this.addClickEffect(i,s.x,s.y,n)},"interactive-effects"),m(e,"touchmove",e=>{e.preventDefault();const r=e.touches[0],s=t.getMousePosition(r);i.mouse.x=s.x,i.mouse.y=s.y,i.mouse.isOver=!0,"trail"===n.effect&&this.addTrailPoint(i,s.x,s.y)},"interactive-effects"),m(e,"touchend",()=>{i.mouse.isOver=!1},"interactive-effects")},startAnimationLoop(e,t,i,n){const r=s=>{const o=s-t.lastTime;switch(t.lastTime=s,e.clear(),i){case"ripple":default:this.renderRippleEffect(e,t,n);break;case"trail":this.renderTrailEffect(e,t,n);break;case"particles":this.renderParticleEffect(e,t,n,o);break;case"magnetic":this.renderMagneticEffect(e,t,n)}this.updateEffects(t.effects,o),requestAnimationFrame(r)};requestAnimationFrame(r)},addClickEffect(e,t,i,n){const r={x:t,y:i,age:0,maxAge:n.duration||1e3,type:"click",intensity:n.intensity||1};e.effects.push(r)},addTrailPoint(e,t,i){const n={x:t,y:i,age:0,maxAge:500,type:"trail"};e.effects.push(n);const r=e.effects.filter(e=>"trail"===e.type);if(r.length>20){const t=e.effects.indexOf(r[0]);e.effects.splice(t,1)}},renderRippleEffect(e,t,i){const{ctx:n}=e;t.effects.forEach(t=>{if("click"===t.type){const r=t.age/t.maxAge,s=r*(i.maxRadius||100),o=.8*(1-r);n.save(),n.globalAlpha=o,n.strokeStyle=i.color||"rgba(100, 150, 255, 1)",n.lineWidth=i.lineWidth||3,n.beginPath(),n.arc(t.x/e.options.pixelRatio,t.y/e.options.pixelRatio,s,0,2*Math.PI),n.stroke(),n.restore()}}),t.mouse.isOver&&(n.save(),n.globalAlpha=.3,n.fillStyle=i.hoverColor||"rgba(100, 150, 255, 0.3)",n.beginPath(),n.arc(t.mouse.x/e.options.pixelRatio,t.mouse.y/e.options.pixelRatio,i.hoverRadius||30,0,2*Math.PI),n.fill(),n.restore())},renderTrailEffect(e,t,i){const{ctx:n}=e,r=t.effects.filter(e=>"trail"===e.type);r.length<2||(n.save(),n.strokeStyle=i.color||"rgba(100, 150, 255, 0.8)",n.lineWidth=i.lineWidth||5,n.lineCap="round",n.lineJoin="round",n.beginPath(),r.forEach((t,i)=>{const r=1-t.age/t.maxAge,s=t.x/e.options.pixelRatio,o=t.y/e.options.pixelRatio;n.globalAlpha=.8*r,0===i?n.moveTo(s,o):n.lineTo(s,o)}),n.stroke(),n.restore())},renderParticleEffect(e,t,i,n){const{ctx:r}=e;if(t.mouse.isOver&&Math.random()<.1){const e={x:t.mouse.x,y:t.mouse.y,vx:4*(Math.random()-.5),vy:4*(Math.random()-.5),age:0,maxAge:1e3,size:5*Math.random()+2,type:"particle"};t.effects.push(e)}t.effects.forEach(t=>{if("particle"===t.type){t.x+=t.vx,t.y+=t.vy,t.vy+=.1;const n=t.age/t.maxAge,s=.8*(1-n);r.save(),r.globalAlpha=s,r.fillStyle=i.color||"rgba(100, 150, 255, 1)",r.beginPath(),r.arc(t.x/e.options.pixelRatio,t.y/e.options.pixelRatio,t.size*(1-.5*n),0,2*Math.PI),r.fill(),r.restore()}})},renderMagneticEffect(e,t,i){const{ctx:n}=e,{width:r,height:s}=e.getSize();if(!t.mouse.isOver)return;const o=r/2,a=s/2,l=t.mouse.x/e.options.pixelRatio,c=t.mouse.y/e.options.pixelRatio;n.save(),n.strokeStyle=i.color||"rgba(100, 150, 255, 0.6)",n.lineWidth=2;for(let d=0;d<8;d++){const e=d/8*Math.PI*2,t=o+50*Math.cos(e),i=a+50*Math.sin(e),r=(t+l)/2+30*Math.sin(e),s=(i+c)/2+30*Math.cos(e);n.beginPath(),n.moveTo(t,i),n.quadraticCurveTo(r,s,l,c),n.stroke()}n.restore()},updateEffects(e,t){for(let i=e.length-1;i>=0;i--)e[i].age+=t,e[i].age>=e[i].maxAge&&e.splice(i,1)}},y={init(e,t){const i=new g(e),n=t.type||"bar",r=this.parseData(e,t);if(r&&0!==r.length){switch(n){case"bar":default:this.createBarChart(i,r,t);break;case"line":this.createLineChart(i,r,t);break;case"pie":this.createPieChart(i,r,t);break;case"progress":this.createProgressChart(i,r,t)}c.info("[DataVisualization] Initialized",n,"chart with",r.length,"data points")}else c.warn("[DataVisualization] No data provided for canvas")},parseData(e,t){let i=t.data;if(!i&&e.dataset.canvasData)try{i=JSON.parse(e.dataset.canvasData)}catch(n){c.warn("[DataVisualization] Failed to parse canvas data",n)}if(!i){const t=e.nextElementSibling;if(t&&"SCRIPT"===t.tagName&&"application/json"===t.type)try{i=JSON.parse(t.textContent)}catch(n){c.warn("[DataVisualization] Failed to parse script data",n)}}if(!i)return c.warn("[DataVisualization] No data found"),[];if(!Array.isArray(i))if("number"==typeof i)i=[{value:i,label:"Progress"}];else{if("object"!=typeof i)return c.warn("[DataVisualization] Data format not recognized:",i),[];i=Object.entries(i).map(([e,t])=>({label:e,value:"object"==typeof t&&t.value||t}))}return i},createBarChart(e,t,i){const{ctx:n}=e,{width:r,height:s}=e.getSize(),o=i.padding||40,a=r-2*o,l=s-2*o,c=a/t.length*.8,d=a/t.length*.2,h=Math.max(...t.map(e=>e.value));let u=0;const m=i.animationDuration||2e3;let g=null;const f=n=>{g||(g=n);const r=n-g;u=Math.min(r/m,1);const s=1-Math.pow(1-u,3);e.clear(),this.renderBarChart(e,t,i,s,{padding:o,chartWidth:a,chartHeight:l,barWidth:c,barSpacing:d,maxValue:h}),u<1&&requestAnimationFrame(f)};requestAnimationFrame(f)},renderBarChart(e,t,i,n,r){const{ctx:s}=e,{padding:o,chartHeight:a,barWidth:l,barSpacing:c,maxValue:d}=r;t.forEach((e,t)=>{const r=o+t*(l+c),h=e.value/d*a*n,u=o+a-h;s.fillStyle=e.color||i.barColor||"rgba(100, 150, 255, 0.8)",s.fillRect(r,u,l,h),!1!==i.showLabels&&(s.fillStyle=i.textColor||"#333",s.font=i.font||"12px Arial",s.textAlign="center",s.fillText(e.label,r+l/2,o+a+20),!1!==i.showValues&&s.fillText(Math.round(e.value*n),r+l/2,u-5))}),!1!==i.showAxes&&(s.strokeStyle=i.axisColor||"#ccc",s.lineWidth=1,s.beginPath(),s.moveTo(o,o),s.lineTo(o,o+a),s.stroke(),s.beginPath(),s.moveTo(o,o+a),s.lineTo(o+r.chartWidth,o+a),s.stroke())},createLineChart(e,t,i){const{ctx:n}=e,{width:r,height:s}=e.getSize(),o=i.padding||40,a=r-2*o,l=s-2*o,c=Math.max(...t.map(e=>e.value)),d=Math.min(...t.map(e=>e.value)),h=c-d;let u=0;const m=i.animationDuration||2e3;let g=null;const f=n=>{g||(g=n);const r=n-g;u=Math.min(r/m,1),e.clear(),this.renderLineChart(e,t,i,u,{padding:o,chartWidth:a,chartHeight:l,maxValue:c,minValue:d,valueRange:h}),u<1&&requestAnimationFrame(f)};requestAnimationFrame(f)},renderLineChart(e,t,i,n,r){const{ctx:s}=e,{padding:o,chartWidth:a,chartHeight:l,minValue:c,valueRange:d}=r,h=Math.floor(t.length*n);s.strokeStyle=i.lineColor||"rgba(100, 150, 255, 0.8)",s.lineWidth=i.lineWidth||3,s.lineCap="round",s.lineJoin="round",s.beginPath();for(let u=0;u<=h&&u<t.length;u++){const e=o+u/(t.length-1)*a,i=o+l-(t[u].value-c)/d*l;0===u?s.moveTo(e,i):s.lineTo(e,i)}if(s.stroke(),!1!==i.showPoints){s.fillStyle=i.pointColor||i.lineColor||"rgba(100, 150, 255, 0.8)";for(let e=0;e<=h&&e<t.length;e++){const n=o+e/(t.length-1)*a,r=o+l-(t[e].value-c)/d*l;s.beginPath(),s.arc(n,r,i.pointSize||4,0,2*Math.PI),s.fill(),!1!==i.showLabels&&t[e].label&&(s.fillStyle=i.textColor||"#333",s.font=i.font||"12px Arial",s.textAlign="center",s.fillText(t[e].label,n,o+l+20))}}},createPieChart(e,t,i){const{ctx:n}=e,{width:r,height:s}=e.getSize(),o=r/2,a=s/2,l=Math.min(r,s)/2*.8,c=t.reduce((e,t)=>e+t.value,0);let d=0;const h=i.animationDuration||2e3;let u=null;const m=n=>{u||(u=n);const r=n-u;d=Math.min(r/h,1),e.clear(),this.renderPieChart(e,t,i,d,{centerX:o,centerY:a,radius:l,total:c}),d<1&&requestAnimationFrame(m)};requestAnimationFrame(m)},renderPieChart(e,t,i,n,r){const{ctx:s}=e,{centerX:o,centerY:a,radius:l,total:c}=r;let d=-Math.PI/2;const h=d+2*Math.PI*n;for(let u=0;u<t.length&&!(d>=h);u++){const e=t[u],n=e.value/c*Math.PI*2,r=Math.min(d+n,h);if(r>d&&(s.fillStyle=e.color||this.getDefaultColor(u),s.beginPath(),s.moveTo(o,a),s.arc(o,a,l,d,r),s.closePath(),s.fill(),!1!==i.showLabels&&r===d+n)){const t=d+n/2,r=o+Math.cos(t)*l*.7,c=a+Math.sin(t)*l*.7;s.fillStyle=i.textColor||"#333",s.font=i.font||"12px Arial",s.textAlign="center",s.fillText(e.label,r,c)}d+=n}},createProgressChart(e,t,i){const{ctx:n}=e,{width:r,height:s}=e.getSize();let o=0;const a=i.animationDuration||1500;let l=null;const c=n=>{l||(l=n);const r=n-l;o=Math.min(r/a,1),e.clear(),this.renderProgressChart(e,t,i,o),o<1&&requestAnimationFrame(c)};requestAnimationFrame(c)},renderProgressChart(e,t,i,n){var r;const{ctx:s}=e,{width:o,height:a}=e.getSize(),l=o/2,c=a/2,d=Math.min(o,a)/2*.8,h=i.lineWidth||20,u=(null==(r=t[0])?void 0:r.value)||0,m=i.maxValue||100,g=u/m*n;s.strokeStyle=i.backgroundColor||"rgba(200, 200, 200, 0.3)",s.lineWidth=h,s.beginPath(),s.arc(l,c,d,0,2*Math.PI),s.stroke(),s.strokeStyle=i.color||"rgba(100, 150, 255, 0.8)",s.lineCap="round",s.beginPath(),s.arc(l,c,d,-Math.PI/2,-Math.PI/2+g/m*Math.PI*2),s.stroke(),!1!==i.showText&&(s.fillStyle=i.textColor||"#333",s.font=i.font||"bold 24px Arial",s.textAlign="center",s.textBaseline="middle",s.fillText(Math.round(g)+"%",l,c))},getDefaultColor(e){const t=["rgba(100, 150, 255, 0.8)","rgba(255, 100, 150, 0.8)","rgba(150, 255, 100, 0.8)","rgba(255, 200, 100, 0.8)","rgba(200, 100, 255, 0.8)","rgba(100, 255, 200, 0.8)"];return t[e%t.length]}},b={name:"canvas-animations",init(e={},t=null){return c.info("[CanvasAnimations] Module initialized"),this.initializeCanvasElements(),this},initializeCanvasElements(){const e=document.querySelectorAll("canvas[data-canvas-type]");e.forEach(e=>{this.initElement(e)}),c.info(`[CanvasAnimations] Initialized ${e.length} canvas elements`)},initElement(e,t={}){const i=e.dataset.canvasType,n=this.parseCanvasConfig(e);switch(c.info(`[CanvasAnimations] Initializing canvas type: ${i}`),i){case"interactive":p.init(e,n);break;case"scroll-parallax":f.initParallax(e,n);break;case"scroll-animation":f.initScrollAnimation(e,n);break;case"data-viz":y.init(e,n);break;case"background":this.initBackgroundAnimation(e,n);break;default:c.warn(`[CanvasAnimations] Unknown canvas type: ${i}`)}},parseCanvasConfig(e){const t={};return Object.keys(e.dataset).forEach(i=>{if(i.startsWith("canvas")){const r=i.replace("canvas","").toLowerCase();let s=e.dataset[i];if(s.startsWith("{")&&s.endsWith("}")||s.startsWith("[")&&s.endsWith("]"))try{s=JSON.parse(s)}catch(n){c.warn(`[CanvasAnimations] Failed to parse JSON config: ${i}`,n)}else"true"===s?s=!0:"false"===s?s=!1:isNaN(s)||""===s||(s=parseFloat(s));t[r]=s}}),t},initBackgroundAnimation(e,t){const i=new g(e),n=t.particles||50,r=[];for(let s=0;s<n;s++)r.push({x:Math.random()*e.width,y:Math.random()*e.height,vx:.5*(Math.random()-.5),vy:.5*(Math.random()-.5),size:3*Math.random()+1,opacity:.5*Math.random()+.2});!function n(){i.clear(),i.ctx.fillStyle=t.color||"rgba(100, 150, 255, 0.6)",r.forEach(t=>{t.x+=t.vx,t.y+=t.vy,t.x<0&&(t.x=e.width),t.x>e.width&&(t.x=0),t.y<0&&(t.y=e.height),t.y>e.height&&(t.y=0),i.ctx.save(),i.ctx.globalAlpha=t.opacity,i.ctx.beginPath(),i.ctx.arc(t.x,t.y,t.size,0,2*Math.PI),i.ctx.fill(),i.ctx.restore()}),requestAnimationFrame(n)}()}},v=b.init.bind(b),w=Object.freeze(Object.defineProperty({__proto__:null,default:b,init:v},Symbol.toStringTag,{value:"Module"}));let S="example-module",x=null,M=null;const E=Object.freeze(Object.defineProperty({__proto__:null,destroy:function(){c.info("[example-module] destroy"),x&&(window.removeEventListener("resize",x),x=null),l(S),M&&"function"==typeof M.cleanup&&M.cleanup(),M=null},init:function(e={},t=null){c.info("[example-module] init"),M=t,M&&(M.register("windowSize",{width:window.innerWidth,height:window.innerHeight}),M.register("scrollPosition",{x:0,y:0}),M.register("isVisible",!0)),x=()=>{const e={width:window.innerWidth,height:window.innerHeight};c.info("Fenstergröße geändert:",e),M&&M.set("windowSize",e)},window.addEventListener("resize",x),a(S,()=>{const e=window.scrollY,t=window.scrollX;if(M){const i=M.get("scrollPosition");i.x===t&&i.y===e||M.set("scrollPosition",{x:t,y:e})}},{autoStart:!0})}},Symbol.toStringTag,{value:"Module"}));class A{constructor(e){this.form=e,this.errors=new Map}static create(e){return new A(e)}validate(){this.errors.clear();const e=this.form.querySelectorAll("input, textarea, select");for(const t of e)"hidden"===t.type||t.disabled||this.validateField(t);return 0===this.errors.size}validateField(e){const t=e.value,i=e.name;if(e.hasAttribute("required")&&(!t||""===t.trim()))return void this.errors.set(i,this.getErrorMessage(e,"valueMissing")||`${this.getFieldLabel(e)} ist erforderlich`);if(!t||""===t.trim())return;if("email"===e.type&&!this.isValidEmail(t))return void this.errors.set(i,this.getErrorMessage(e,"typeMismatch")||"Bitte geben Sie eine gültige E-Mail-Adresse ein");if("url"===e.type&&!this.isValidUrl(t))return void this.errors.set(i,this.getErrorMessage(e,"typeMismatch")||"Bitte geben Sie eine gültige URL ein");const n=e.getAttribute("minlength");if(n&&t.length<parseInt(n))return void this.errors.set(i,this.getErrorMessage(e,"tooShort")||`Mindestens ${n} Zeichen erforderlich`);const r=e.getAttribute("maxlength");if(r&&t.length>parseInt(r))return void this.errors.set(i,this.getErrorMessage(e,"tooLong")||`Maximal ${r} Zeichen erlaubt`);if("number"===e.type){const n=e.getAttribute("min"),r=e.getAttribute("max"),s=parseFloat(t);if(n&&s<parseFloat(n))return void this.errors.set(i,this.getErrorMessage(e,"rangeUnderflow")||`Wert muss mindestens ${n} sein`);if(r&&s>parseFloat(r))return void this.errors.set(i,this.getErrorMessage(e,"rangeOverflow")||`Wert darf maximal ${r} sein`)}const s=e.getAttribute("pattern");if(s){if(!new RegExp(s).test(t))return void this.errors.set(i,this.getErrorMessage(e,"patternMismatch")||"Ungültiges Format")}const o=e.getAttribute("data-validate");if(o){const n=this.runCustomValidation(o,t,e);if(!n.valid)return void this.errors.set(i,n.message)}}runCustomValidation(e,t,i){switch(e){case"phone":return{valid:/^[\+]?[0-9\s\-\(\)]{10,}$/.test(t),message:"Bitte geben Sie eine gültige Telefonnummer ein"};case"postal-code-de":return{valid:/^[0-9]{5}$/.test(t),message:"Bitte geben Sie eine gültige Postleitzahl ein"};case"no-html":return{valid:!/<[^>]*>/g.test(t),message:"HTML-Code ist nicht erlaubt"};default:return c.warn(`Unknown custom validation: ${e}`),{valid:!0,message:""}}}isValidEmail(e){return/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(e)}isValidUrl(e){try{return new URL(e),!0}catch{return!1}}getFieldLabel(e){const t=this.form.querySelector(`label[for="${e.id}"]`)||this.form.querySelector(`label:has([name="${e.name}"])`);return t?t.textContent.trim().replace(":",""):e.name}getErrorMessage(e,t){return e.getAttribute(`data-error-${t}`)||e.getAttribute("data-error")}getErrors(){return Object.fromEntries(this.errors)}getFieldError(e){return this.errors.get(e)}hasErrors(){return this.errors.size>0}clearErrors(){this.errors.clear()}validateWithHTML5(){const e=this.form.checkValidity();if(!e){const e=this.form.querySelectorAll("input, textarea, select");for(const t of e)t.validity.valid||this.errors.set(t.name,t.validationMessage)}return e}}class k{constructor(e){this.form=e,this.pristineValues=new Map,this.touchedFields=new Set,this.dirtyFields=new Set,this.init()}static create(e){return new k(e)}init(){this.captureInitialValues(),this.bindEvents(),c.info(`[FormState] Initialized for form: ${this.form.id||"unnamed"}`)}captureInitialValues(){this.form.querySelectorAll("input, textarea, select").forEach(e=>{let t;switch(e.type){case"checkbox":case"radio":t=e.checked;break;default:t=e.value}this.pristineValues.set(e.name,t)})}bindEvents(){this.form.querySelectorAll("input, textarea, select").forEach(e=>{"hidden"!==e.type&&(e.addEventListener("focus",()=>{this.markAsTouched(e.name)}),e.addEventListener("input",()=>{this.checkDirtyState(e)}),e.addEventListener("change",()=>{this.checkDirtyState(e)}))})}markAsTouched(e){this.touchedFields.add(e),this.updateFormClasses()}checkDirtyState(e){const t=e.name;this.getFieldValue(e)!==this.pristineValues.get(t)?this.dirtyFields.add(t):this.dirtyFields.delete(t),this.updateFormClasses()}getFieldValue(e){switch(e.type){case"checkbox":case"radio":return e.checked;default:return e.value}}updateFormClasses(){this.isDirty()?(this.form.classList.add("form-dirty"),this.form.classList.remove("form-pristine")):(this.form.classList.add("form-pristine"),this.form.classList.remove("form-dirty")),this.hasTouchedFields()?this.form.classList.add("form-touched"):this.form.classList.remove("form-touched")}isPristine(){return 0===this.dirtyFields.size}isDirty(){return this.dirtyFields.size>0}hasTouchedFields(){return this.touchedFields.size>0}isFieldTouched(e){return this.touchedFields.has(e)}isFieldDirty(e){return this.dirtyFields.has(e)}isFieldPristine(e){return!this.dirtyFields.has(e)}getFieldState(e){return{pristine:this.isFieldPristine(e),dirty:this.isFieldDirty(e),touched:this.isFieldTouched(e),pristineValue:this.pristineValues.get(e),currentValue:this.getCurrentFieldValue(e)}}getCurrentFieldValue(e){const t=this.form.querySelector(`[name="${e}"]`);return t?this.getFieldValue(t):void 0}getFormState(){return{pristine:this.isPristine(),dirty:this.isDirty(),touched:this.hasTouchedFields(),dirtyFields:Array.from(this.dirtyFields),touchedFields:Array.from(this.touchedFields),totalFields:this.pristineValues.size}}reset(){this.touchedFields.clear(),this.dirtyFields.clear(),setTimeout(()=>{this.captureInitialValues(),this.updateFormClasses()},0),c.info("[FormState] State reset")}resetField(e){this.touchedFields.delete(e),this.dirtyFields.delete(e);const t=this.form.querySelector(`[name="${e}"]`),i=this.pristineValues.get(e);if(t&&void 0!==i)switch(t.type){case"checkbox":case"radio":t.checked=i;break;default:t.value=i}this.updateFormClasses(),c.info(`[FormState] Field "${e}" reset to pristine state`)}triggerStateEvent(e,t={}){const i=new CustomEvent(e,{detail:{...t,formState:this.getFormState()},bubbles:!0,cancelable:!0});this.form.dispatchEvent(i)}hasChanges(){return this.isDirty()}getChangedFields(){const e={};return this.dirtyFields.forEach(t=>{e[t]={pristineValue:this.pristineValues.get(t),currentValue:this.getCurrentFieldValue(t)}}),e}enableUnsavedChangesWarning(){window.addEventListener("beforeunload",e=>{if(this.isDirty())return e.preventDefault(),e.returnValue="Sie haben ungespeicherte Änderungen. Möchten Sie die Seite wirklich verlassen?",e.returnValue})}destroy(){this.pristineValues.clear(),this.touchedFields.clear(),this.dirtyFields.clear(),c.info("[FormState] Destroyed")}}class C{constructor(e,t={}){this.form=e,this.options={validateOnSubmit:!0,validateOnBlur:!1,validateOnInput:!1,showInlineErrors:!0,preventSubmitOnError:!0,submitMethod:"POST",ajaxSubmit:!0,...t},this.validator=A.create(e),this.state=k.create(e),this.isSubmitting=!1,this.init()}static create(e,t={}){return new C(e,t)}init(){this.bindEvents(),this.setupErrorDisplay(),this.form.setAttribute("data-enhanced","true"),c.info(`[FormHandler] Initialized for form: ${this.form.id||"unnamed"}`)}bindEvents(){if(this.form.addEventListener("submit",e=>this.handleSubmit(e)),this.options.validateOnBlur||this.options.validateOnInput){this.form.querySelectorAll("input, textarea, select").forEach(e=>{this.options.validateOnBlur&&e.addEventListener("blur",()=>this.validateSingleField(e)),this.options.validateOnInput&&e.addEventListener("input",()=>this.validateSingleField(e))})}}async handleSubmit(e){if(this.isSubmitting)e.preventDefault();else{if(this.options.validateOnSubmit){if(!this.validator.validate())return e.preventDefault(),void this.displayErrors()}this.options.ajaxSubmit&&(e.preventDefault(),await this.submitViaAjax())}}async submitViaAjax(){try{this.setSubmitState(!0),this.clearErrors();const e=new FormData(this.form),t=this.form.action||window.location.href,i=this.form.method||this.options.submitMethod,n=await fetch(t,{method:i.toUpperCase(),body:e,headers:{"X-Requested-With":"XMLHttpRequest"}}),r=await this.parseResponse(n);n.ok?this.handleSuccess(r):this.handleError(r)}catch(e){c.error("[FormHandler] Submit error:",e),this.handleError({message:"Ein Fehler ist aufgetreten. Bitte versuchen Sie es erneut.",errors:{}})}finally{this.setSubmitState(!1)}}async parseResponse(e){const t=e.headers.get("content-type");if(null==t?void 0:t.includes("application/json"))return await e.json();const i=await e.text();try{return JSON.parse(i)}catch{return{message:i}}}handleSuccess(e){c.info("[FormHandler] Form submitted successfully"),!1!==e.clearForm&&(this.form.reset(),this.state.reset()),this.showMessage(e.message||"Formular erfolgreich gesendet!","success"),this.triggerEvent("form:success",{data:e})}handleError(e){if(c.warn("[FormHandler] Form submission error:",e),e.errors&&"object"==typeof e.errors){for(const[t,i]of Object.entries(e.errors))this.validator.errors.set(t,i);this.displayErrors()}this.showMessage(e.message||"Ein Fehler ist aufgetreten.","error"),this.triggerEvent("form:error",{data:e})}validateSingleField(e){this.validator.errors.delete(e.name),this.validator.validateField(e),this.displayFieldError(e)}displayErrors(){if(!this.options.showInlineErrors)return;const e=this.validator.getErrors();for(const[t,i]of Object.entries(e)){const e=this.form.querySelector(`[name="${t}"]`);e&&this.displayFieldError(e,i)}}displayFieldError(e,t=null){const i=t||this.validator.getFieldError(e.name),n=this.getOrCreateErrorElement(e);i?(n.textContent=i,n.style.display="block",e.classList.add("error"),e.setAttribute("aria-invalid","true"),e.setAttribute("aria-describedby",n.id)):(n.textContent="",n.style.display="none",e.classList.remove("error"),e.removeAttribute("aria-invalid"),e.removeAttribute("aria-describedby"))}getOrCreateErrorElement(e){const t=`error-${e.name}`;let i=document.getElementById(t);if(!i){i=document.createElement("div"),i.id=t,i.className="form-error",i.setAttribute("role","alert"),i.style.display="none";(e.closest(".form-group")||e.parentElement).appendChild(i)}return i}setupErrorDisplay(){if(!document.getElementById("form-handler-styles")){const e=document.createElement("style");e.id="form-handler-styles",e.textContent="\n .form-error {\n color: #dc2626;\n font-size: 0.875rem;\n margin-top: 0.25rem;\n }\n input.error, textarea.error, select.error {\n border-color: #dc2626;\n box-shadow: 0 0 0 1px #dc2626;\n }\n .form-message {\n padding: 0.75rem;\n border-radius: 0.375rem;\n margin: 1rem 0;\n }\n .form-message.success {\n background-color: #dcfce7;\n color: #166534;\n border: 1px solid #bbf7d0;\n }\n .form-message.error {\n background-color: #fef2f2;\n color: #dc2626;\n border: 1px solid #fecaca;\n }\n ",document.head.appendChild(e)}}showMessage(e,t="info"){let i=this.form.querySelector(".form-messages");i||(i=document.createElement("div"),i.className="form-messages",this.form.prepend(i));const n=document.createElement("div");n.className=`form-message ${t}`,n.textContent=e,n.setAttribute("role","error"===t?"alert":"status"),i.innerHTML="",i.appendChild(n),"success"===t&&setTimeout(()=>{n.parentElement&&n.remove()},5e3)}clearErrors(){this.validator.clearErrors();this.form.querySelectorAll(".error").forEach(e=>{e.classList.remove("error"),e.removeAttribute("aria-invalid"),e.removeAttribute("aria-describedby")});this.form.querySelectorAll(".form-error").forEach(e=>{e.style.display="none",e.textContent=""});const e=this.form.querySelector(".form-messages");e&&(e.innerHTML="")}setSubmitState(e){this.isSubmitting=e;this.form.querySelectorAll('button[type="submit"], input[type="submit"]').forEach(t=>{if(t.disabled=e,e)t.setAttribute("data-original-text",t.textContent),t.textContent="Wird gesendet...";else{const e=t.getAttribute("data-original-text");e&&(t.textContent=e,t.removeAttribute("data-original-text"))}})}triggerEvent(e,t={}){const i=new CustomEvent(e,{detail:t,bubbles:!0,cancelable:!0});this.form.dispatchEvent(i)}destroy(){this.form.removeAttribute("data-enhanced"),c.info("[FormHandler] Destroyed")}}const F={name:"form-handling",init(e={},t=null){return c.info("[FormHandling] Module initialized (ready for DOM elements)"),this},initElement(e,t={}){c.info(`[FormHandling] Initializing on form: ${e.id||"unnamed"}`);const i={validateOnSubmit:!0,validateOnBlur:!1,validateOnInput:!1,showInlineErrors:!0,preventSubmitOnError:!0,ajaxSubmit:!0,submitMethod:"POST",enableStateTracking:!0,enableUnsavedWarning:!1,...t},n=C.create(e,i);e._formHandler=n,e._formValidator=n.validator,e._formState=n.state,i.enableUnsavedWarning&&n.state.enableUnsavedChangesWarning(),e.classList.add("form-enhanced");const r=new CustomEvent("form:initialized",{detail:{handler:n,validator:n.validator,state:n.state,config:i},bubbles:!0});return e.dispatchEvent(r),c.info(`[FormHandling] Successfully initialized for form: ${e.id||"unnamed"}`),n},destroyElement(e){e._formHandler&&(e._formHandler.destroy(),delete e._formHandler,delete e._formValidator,delete e._formState),e.classList.remove("form-enhanced"),e.removeAttribute("data-enhanced"),c.info(`[FormHandling] Destroyed for form: ${e.id||"unnamed"}`)},destroy(){c.info("[FormHandling] Module destroyed")}},O=F.init.bind(F),$=F.initElement.bind(F),P=Object.freeze(Object.defineProperty({__proto__:null,FormHandler:C,FormHandlingModule:F,FormState:k,FormValidator:A,default:F,init:O,initElement:$},Symbol.toStringTag,{value:"Module"}));let z,L="inertia-scroll",T=0,R=window.scrollY,D=!1,_=.9,I=.2;function j(){D=!0,clearTimeout(z),z=setTimeout(()=>{D=!1},50)}const H=Object.freeze(Object.defineProperty({__proto__:null,destroy:function(){window.removeEventListener("scroll",j),l(L),T=0,R=window.scrollY,D=!1,clearTimeout(z);const e=document.documentElement;delete e.dataset.scrollState,delete e.dataset.scrollDirection,delete e.dataset.scrollSpeed},init:function(e={}){_="number"==typeof e.damping?e.damping:.9,I="number"==typeof e.minVelocity?contig.minVelocity:.1,window.addEventListener("scroll",j,{passive:!0}),a(L,()=>{const e=document.documentElement,t=window.scrollY,i=t-R,n=i>0?"down":i<0?"up":"none",r=Math.abs(i);!D&&Math.abs(T)>I?(window.scrollTo(0,t+T),T*=_,e.dataset.scrollState="inertia"):D?(T=i,R=t,e.dataset.scrollState="active"):delete e.dataset.scrollState,e.dataset.scrollDirection=n,e.dataset.scrollSpeed=r.toFixed(2)},{autoStart:!0})}},Symbol.toStringTag,{value:"Module"}));class q{constructor({content:e="",className:t="",onClose:i=null}={}){this.onClose=i,this.className=t,this.isOpenState=!1,this.dialog=document.createElement("dialog"),this.dialog.className=t,this.eventCleanup=[],this.updateContent(e),this.bindEvents()}bindEvents(){this.cleanupEvents(),this.clickHandler=e=>{!e.target.closest("."+this.className+"-content")&&this.close()},this.cancelHandler=e=>{e.preventDefault(),this.close()},this.dialog.addEventListener("click",this.clickHandler),this.dialog.addEventListener("cancel",this.cancelHandler),this.eventCleanup=[()=>this.dialog.removeEventListener("click",this.clickHandler),()=>this.dialog.removeEventListener("cancel",this.cancelHandler)]}cleanupEvents(){this.eventCleanup.forEach(e=>e()),this.eventCleanup=[]}updateContent(e){this.dialog.innerHTML=`\n <form method="dialog" class="${this.className}-content">\n ${e}\n <button class="${this.className}-close" value="close">×</button>\n </form>\n `}open(){var e,t,i,n;this.dialog.parentElement||document.body.appendChild(this.dialog),(this.dialog.hasAttribute("open")||this.dialog.open)&&((null==(t=(e=this.dialog).close)?void 0:t.call(e))||this.dialog.removeAttribute("open")),(null==(n=(i=this.dialog).showModal)?void 0:n.call(i))||this.dialog.setAttribute("open",""),document.documentElement.dataset[`${this.dialog.className}Open`]="true",this.isOpenState=!0}close(){var e,t,i;this.isOpenState&&((null==(t=(e=this.dialog).close)?void 0:t.call(e))||this.dialog.removeAttribute("open"),delete document.documentElement.dataset[`${this.dialog.className}Open`],this.isOpenState=!1,null==(i=this.onClose)||i.call(this))}isOpen(){const e=this.dialog&&(this.dialog.hasAttribute("open")||this.dialog.open);return e!==this.isOpenState&&(this.isOpenState=e),this.isOpenState}destroy(){this.isOpenState&&this.close(),this.cleanupEvents(),this.dialog.parentElement&&this.dialog.remove()}}const V={modal:class extends q{constructor(e){super({...e,className:"modal"})}},lightbox:class extends q{constructor(e){super({...e,className:"lightbox"})}}},N={},W={open(e,t={}){const i=V[e];if(!i)return c.warn(`[UIManager] Unknown type: ${e}`),null;if("lightbox"===e){if(N.lightbox)return c.info("[UIManager] Reusing existing lightbox instance"),N.lightbox.updateContent(t.content||""),N.lightbox.open(),N.lightbox;{c.info("[UIManager] Creating new lightbox instance");const e=new i({...t,onClose:()=>{c.info("[UIManager] Lightbox closed, instance kept for reuse"),t.onClose&&t.onClose()}});return N.lightbox=e,e.open(),e}}const n=new i(t);return n.open(),n},close(e){(null==e?void 0:e.close)&&e.close()},closeByType(e){N[e]&&this.close(N[e])},isOpen(e){var t;return(null==(t=N[e])?void 0:t.isOpen())||!1},destroyAll(){Object.values(N).forEach(e=>{(null==e?void 0:e.destroy)&&e.destroy()}),Object.keys(N).forEach(e=>{delete N[e]})}};function B(e){let t=null;if(t="IMG"===e.target.tagName?e.target:e.target.querySelector("img"),!t)return;if("false"===t.dataset.lightbox)return;if(t.naturalWidth<200||t.naturalHeight<200)return;if(t.closest("nav, header, footer, .no-lightbox"))return;e.preventDefault();const i=function(e){if(e.dataset.lightboxSrc)return e.dataset.lightboxSrc;if(e.currentSrc)return e.currentSrc;return e.src}(t),n=t.alt||t.dataset.caption||t.title||"",r=t.closest("picture");let s;if(r){const e=r.cloneNode(!0);e.querySelector("img").className="lightbox-image",s=`\n <div class="lightbox-content">\n ${e.outerHTML}\n ${n?`<div class="lightbox-caption">${n}</div>`:""}\n </div>\n `,c.info("[Lightbox] Opening responsive image (picture element):",i)}else s=`\n <div class="lightbox-content">\n <img src="${i}" alt="${n}" class="lightbox-image" />\n ${n?`<div class="lightbox-caption">${n}</div>`:""}\n </div>\n `,c.info("[Lightbox] Opening standalone image:",i);const o=W.open("lightbox",{content:s});W.isOpen("lightbox")&&o&&c.info("[Lightbox] Reused existing lightbox instance")}const U=Object.freeze(Object.defineProperty({__proto__:null,destroy:function(){c.info("[lightbox-trigger] destroy"),document.querySelectorAll("img.lightbox-enabled").forEach(e=>{e.classList.remove("lightbox-enabled"),e.style.cursor="","Klicken zum Vergrößern"===e.title&&(e.title="")})},init:function(){c.info("[lightbox-trigger] Auto-enabling lightbox for all images (including picture/srcset)"),c.info('[lightbox-trigger] Use data-lightbox="false" to opt-out'),c.info("[lightbox-trigger] Use data-lightbox-src for custom high-res versions"),m(document,"click",B),function(){const e=document.querySelectorAll('img:not([data-lightbox="false"])');let t=0;e.forEach(e=>{e.naturalWidth<200||e.naturalHeight<200||e.closest("nav, header, footer, .no-lightbox")||(e.classList.add("lightbox-enabled"),e.style.cursor="zoom-in",e.title||e.alt||(e.title="Klicken zum Vergrößern"),t++)}),c.info(`[Lightbox] Enhanced ${t} images with lightbox functionality`)}()}},Symbol.toStringTag,{value:"Module"}));const Y=Object.freeze(Object.defineProperty({__proto__:null,init:function(e={}){c.log("Noise Toggle Init",e);const{selector:t=".noise-overlay",toggleKey:i="g",className:n="grainy",enableTransition:r=!0}=e,s=document.body,o=document.querySelector(t);if(!o)return;function a(){r?o.classList.toggle("hidden",!s.classList.contains(n)):o.style.display=s.classList.contains(n)?"block":"none"}a(),document.addEventListener("keydown",e=>{var t;e.key.toLowerCase()!==i||e.ctrlKey||e.metaKey||e.altKey||(t=e.target,["input","textarea"].includes(t.tagName.toLowerCase()))||(s.classList.toggle(n),a())})}},Symbol.toStringTag,{value:"Module"}));const K=Object.freeze(Object.defineProperty({__proto__:null,init:function(e={}){c.info("Parallax init");const t={selector:"[data-parallax]",speedAttr:"data-parallax-speed",defaultSpeed:.5,...e},i=document.querySelectorAll(t.selector);a("parallax",function(){const e=window.scrollY;i.forEach(i=>{const n=parseFloat(i.getAttribute(t.speedAttr))||t.defaultSpeed,r=e*n;i.style.transform=`translateY(${r}px)`})},{autoStart:!0})}},Symbol.toStringTag,{value:"Module"}));class J{constructor(){this.modules=new Map,this.dependents=new Map,this.initialized=new Set,this.initializing=new Set,this.initializationOrder=[]}register(e){this.modules.has(e.name)?c.warn(`[DependencyManager] Module '${e.name}' already registered`):this.validateDefinition(e)&&(this.modules.set(e.name,e),e.dependencies.forEach(t=>{this.dependents.has(t.name)||this.dependents.set(t.name,[]),this.dependents.get(t.name).push(e.name)}),c.info(`[DependencyManager] Registered '${e.name}' v${e.version}`))}calculateInitializationOrder(){const e=new Set,t=new Set,i=[],n=r=>{if(t.has(r))throw new Error(`Circular dependency detected involving '${r}'`);if(e.has(r))return;const s=this.modules.get(r);s&&(t.add(r),s.dependencies.forEach(e=>{e.optional&&!this.modules.has(e.name)||n(e.name)}),t.delete(r),e.add(r),i.push(r))};return Array.from(this.modules.entries()).sort(([,e],[,t])=>(t.priority||0)-(e.priority||0)).map(([e])=>e).forEach(t=>{e.has(t)||n(t)}),this.initializationOrder=i,c.info(`[DependencyManager] Initialization order: ${i.join(" → ")}`),i}checkDependencies(e){const t=this.modules.get(e);if(!t)return{satisfied:!1,missing:[],reason:`Module '${e}' not registered`};const i=[],n=[];return t.dependencies.forEach(e=>{this.modules.get(e.name)?this.initialized.has(e.name)||e.optional||i.push(`${e.name} (not initialized)`):e.optional?n.push(e.name):i.push(e.name)}),{satisfied:0===i.length,missing:i,optional:n,reason:i.length>0?`Missing: ${i.join(", ")}`:"OK"}}markInitialized(e){this.initialized.add(e),this.initializing.delete(e),c.info(`[DependencyManager] '${e}' initialized`)}markInitializing(e){this.initializing.add(e)}getDependents(e){return this.dependents.get(e)||[]}getModule(e){return this.modules.get(e)}isReadyToInitialize(e){if(this.initialized.has(e)||this.initializing.has(e))return!1;return this.checkDependencies(e).satisfied}getStatus(){const e=this.modules.size,t=this.initialized.size,i=this.initializing.size;return{total:e,initialized:t,initializing:i,pending:e-t-i,modules:{initialized:Array.from(this.initialized),initializing:Array.from(this.initializing),pending:Array.from(this.modules.keys()).filter(e=>!this.initialized.has(e)&&!this.initializing.has(e))}}}validateDefinition(e){if(!e.name||"string"!=typeof e.name)return c.error("[DependencyManager] Module name is required and must be string"),!1;if(!e.version||"string"!=typeof e.version)return c.error(`[DependencyManager] Version is required for module '${e.name}'`),!1;if(!Array.isArray(e.dependencies))return c.error(`[DependencyManager] Dependencies must be array for module '${e.name}'`),!1;for(const t of e.dependencies)if(!t.name||"string"!=typeof t.name)return c.error(`[DependencyManager] Invalid dependency in module '${e.name}': missing name`),!1;return!0}reset(){this.modules.clear(),this.dependents.clear(),this.initialized.clear(),this.initializing.clear(),this.initializationOrder=[],c.info("[DependencyManager] Reset complete")}static createDefinition(e,t){const i={name:e,version:t,dependencies:[],provides:[],priority:0},n={depends(e,t="*",n=!1){return i.dependencies.push({name:e,version:t,optional:n}),this},provides(...e){return i.provides.push(...e),this},priority(e){return i.priority=e,this},build:()=>i};return Object.setPrototypeOf(n,i),Object.keys(i).forEach(e=>{e in n||Object.defineProperty(n,e,{get:()=>i[e],set(t){i[e]=t},enumerable:!0,configurable:!0})}),n}}const X=new J;"undefined"!=typeof window&&(window.dependencyManager=X,window.depStatus=()=>X.getStatus());const G=J.createDefinition("scroll-dependent","1.0.0").depends("example-module","1.0.0").depends("scrollfx","1.0.0",!0).provides("scroll-coordination").priority(10);let Z=null,Q=null;const ee=Object.freeze(Object.defineProperty({__proto__:null,definition:G,destroy:function(){c.info("[scroll-dependent] destroy"),Z&&Q&&(Q.unsubscribe(Z),Z=null),Q&&"function"==typeof Q.cleanup&&Q.cleanup(),Q=null},init:function(e={},t=null){c.info("[scroll-dependent] init"),Q=t,Q&&(Q.register("isScrolling",!1),Q.register("scrollDirection","none"),Z=Q.subscribe("example-module.scrollPosition",(e,t)=>{if(t.y!==e.y){const i=e.y>t.y?"down":"up";Q.set("scrollDirection",i),Q.set("isScrolling",!0),setTimeout(()=>{Q&&Q.set("isScrolling",!1)},150),c.info(`[scroll-dependent] Scroll ${i}: ${e.y}`)}}))}},Symbol.toStringTag,{value:"Module"}));const te=Object.freeze(Object.defineProperty({__proto__:null,init:function(e={}){const t=document.querySelectorAll("[data-scroll-loop]");t.forEach(e=>{if("translate"===(e.dataset.scrollType||"translate")&&1===e.children.length){const t=e.firstElementChild.cloneNode(!0);t.setAttribute("aria-hidden","true"),e.appendChild(t)}}),a("scroll-loop",()=>{const i=window.scrollY,n=window.scrollX;t.forEach(t=>{const r=parseFloat(t.dataset.scrollSpeed||e.speed||.2),s=t.dataset.scrollAxis||"y",o=t.dataset.scrollType||"translate",a="true"===t.dataset.loopPause,l=parseFloat(t.dataset.loopOffset||0),c=parseFloat(t.dataset.loopLimit||0),d="x"===s?n:i;if(c&&d>c)return;if(a&&(t.matches(":hover")||t.matches(":active")))return;const h=(d+l)*r;switch(o){case"translate":{const e=-h%("x"===s?t.offsetWidth:t.offsetHeight),i="x"===s?`translateX(${e}px)`:`translateY(${e}px)`;t.style.transform=i;break}case"rotate":{const e=h%360;t.style.transform=`rotate(${e}deg)`;break}case"background":{const e=h%100;t.style.backgroundPosition="x"===s?`${e}% center`:`center ${e}%`;break}case"scale":{const e=1+.1*Math.sin(.01*h);t.style.transform=`scale(${e.toFixed(3)})`;break}}})},{autoStart:!0})}},Symbol.toStringTag,{value:"Module"})),ie={onEnter(e,t){t.classList.add("active"),document.body.dataset.activeScrollStep=e,c.info(`[ScrollStep] Enter: ${e}`),1===e&&c.info("Intro sichtbar"),2===e&&c.info("Chart aktiviert"),3===e&&c.info("Zitat eingeblendet")},onLeave(e,t){t.classList.remove("active"),t.style.transitionDelay="",c.info(`[ScrollStep] Leave: ${e}`),document.body.dataset.activeScrollStep===String(e)&&delete document.body.dataset.activeScrollStep,1===e&&c.info("Intro ausgeblendet"),2===e&&c.info("Chart deaktiviert"),3===e&&c.info("Zitat ausgeblendet")}};const ne=Object.freeze(Object.defineProperty({__proto__:null,destroy:function(){l("scroll-timeline")},init:function(e={}){c.info("ScrollTimeline init");const t={attribute:"data-scroll-step",triggerPoint:.4,once:!0,...e},i=Array.from(document.querySelectorAll(`[${t.attribute}]`)).map(e=>({el:e,index:parseInt(e.getAttribute(t.attribute),10),active:!1}));a("scroll-timeline",function(){const e=window.innerHeight*t.triggerPoint;i.forEach(i=>{var n,r;const s=i.el.getBoundingClientRect(),o=s.top<e&&s.bottom>0;o&&!i.active&&(i.active=!0,i.el.classList.add("active"),c.log(`➡️ ENTER step ${i.index}`),null==(n=ie.onEnter)||n.call(ie,i.index,i.el)),!o&&i.active&&(i.active=!1,i.el.classList.remove("active"),c.log(`⬅️ LEAVE step ${i.index}`),t.once||null==(r=ie.onLeave)||r.call(ie,i.index,i.el))})},{autoStart:!0})}},Symbol.toStringTag,{value:"Module"}));const re=new class{constructor(){this.triggers=new Set,this.viewportHeight=window.innerHeight,this._loop=this._loop.bind(this),window.addEventListener("resize",()=>{this.viewportHeight=window.innerHeight}),requestAnimationFrame(this._loop)}register(e){this.triggers.add(e)}unregister(e){this.triggers.delete(e)}clear(){this.triggers.clear()}_loop(){this.triggers.forEach(e=>{e.update(this.viewportHeight)}),requestAnimationFrame(this._loop)}};class se{constructor(e){if(this.element=this.resolveElement(e.element),this.target=e.target?this.element.querySelector(e.target):this.element,e.target&&!this.target)throw new Error(`Target selector '${e.target}' not found inside element '${e.element}'.`);this.start=e.start||"top 80%",this.end=e.end||"bottom 20%",this.scrub=e.scrub||!1,this.onEnter=e.onEnter||null,this.onLeave=e.onLeave||null,this.onUpdate=e.onUpdate||null,this._wasVisible=!1,this._progress=0}resolveElement(e){if("string"==typeof e){const t=document.querySelectorAll(e);if(1===t.length)return t[0];throw new Error(`Selector '${e}' matched ${t.length} elements, expected exactly 1.`)}return e}getScrollProgress(e){const t=this.element.getBoundingClientRect(),i=this.parsePosition(this.start,e),n=this.parsePosition(this.end,e)-i,r=t.top-i;return 1-Math.min(Math.max(r/n,0),1)}parsePosition(e,t){const[i,n]=e.split(" ");return("top"===i?0:t)-t*(parseFloat(n)/100)}update(e){const t=this.element.getBoundingClientRect(),i=t.bottom>0&&t.top<e;if(i&&!this._wasVisible&&(this._wasVisible=!0,this.onEnter&&this.onEnter(this.target)),!i&&this._wasVisible&&(this._wasVisible=!1,this.onLeave&&this.onLeave(this.target)),this.scrub&&i){const t=this.getScrollProgress(e);this.onUpdate&&this.onUpdate(this.target,t)}}}const oe=Object.freeze(Object.defineProperty({__proto__:null,createTrigger:function(e){const t="string"==typeof e.element?document.querySelectorAll(e.element):[e.element],i=[];return t.forEach(t=>{const n=new se({...e,element:t});re.register(n),i.push(n)}),1===i.length?i[0]:i},init:function(e={}){const{selector:t=".fade-in-on-scroll, .zoom-in, .fade-out, .fade",offset:i=.85,baseDelay:n=.05,once:r=!0}=e,s=Array.from(document.querySelectorAll(t)).map(e=>({el:e,triggered:!1}));requestAnimationFrame(function e(){const t=window.innerHeight*i;s.forEach((e,i)=>{if(e.triggered&&r)return;e.el.getBoundingClientRect().top<t?(e.el.style.transitionDelay=i*n+"s",e.el.classList.add("visible","entered"),e.el.classList.remove("fade-out"),e.triggered=!0):r||(e.el.classList.remove("visible","entered"),e.triggered=!1)}),requestAnimationFrame(e)})}},Symbol.toStringTag,{value:"Module"}));let ae=null,le=null;const ce=Object.freeze(Object.defineProperty({__proto__:null,destroy:function(){var e;e="sidebar",Array.isArray(e)&&e.forEach(e=>{u.removeModule(e)})},init:function(){document.getElementById("sidebar-menu");const e=document.getElementById("menu-toggle"),t=document.getElementById("sidebar"),i=document.querySelector(".backdrop"),n=document.querySelector("footer"),r=document.querySelector("header a");m(e,"click",e=>{t.classList.toggle("show"),t.classList.contains("show")?(i.classList.add("visible"),n.setAttribute("inert","true"),r.setAttribute("inert","true")):(i.classList.remove("visible"),n.removeAttribute("inert"),r.removeAttribute("inert"))}),ae=e=>{"Escape"===e.key&&t.classList.contains("show")&&(t.classList.remove("show"),i.classList.remove("visible"))},m(document,"keydown",ae),le=e=>{t.classList.remove("show"),i.classList.remove("visible"),n.removeAttribute("inert"),r.removeAttribute("inert")},m(i,"click",le)}},Symbol.toStringTag,{value:"Module"})),de=Object.freeze(Object.defineProperty({__proto__:null},Symbol.toStringTag,{value:"Module"}));class he{constructor(e={}){this.options={containerSelector:"main",linkSelector:'a[href^="/"]',loadingClass:"spa-loading",excludeSelector:'[data-spa="false"], [download], [target="_blank"], [href^="mailto:"], [href^="tel:"], [href^="#"]',enableTransitions:!0,transitionDuration:300,skeletonTemplate:this.createSkeletonTemplate(),...e},this.container=null,this.isLoading=!1,this.currentUrl=window.location.href,this.abortController=null,this.init()}static create(e={}){return new he(e)}init(){this.container=document.querySelector(this.options.containerSelector),this.container?(this.bindEvents(),this.setupStyles(),this.updateHistoryState(window.location.href,document.title),c.info("[SPARouter] Initialized")):c.error(`[SPARouter] Container "${this.options.containerSelector}" not found`)}bindEvents(){document.addEventListener("click",e=>this.handleLinkClick(e)),window.addEventListener("popstate",e=>this.handlePopState(e)),document.addEventListener("submit",e=>this.handleFormSubmit(e))}handleLinkClick(e){const t=e.target.closest(this.options.linkSelector);if(!t)return;if(t.matches(this.options.excludeSelector))return;if(e.ctrlKey||e.metaKey||e.shiftKey)return;e.preventDefault();const i=t.href,n=t.title||t.textContent.trim();this.navigate(i,n)}handlePopState(e){const t=window.location.href;t!==this.currentUrl&&this.loadContent(t,!1)}handleFormSubmit(e){const t=e.target;t.hasAttribute("data-spa")&&"false"===t.getAttribute("data-spa")||t._moduleInstance}async navigate(e,t=""){var i;if(this.isLoading&&(null==(i=this.abortController)||i.abort()),e!==this.currentUrl){c.info(`[SPARouter] Navigating to: ${e}`);try{await this.loadContent(e,!0,t)}catch(n){"AbortError"!==n.name&&(c.error("[SPARouter] Navigation failed:",n),window.location.href=e)}}}async loadContent(e,t=!0,i=""){if(!this.isLoading){this.isLoading=!0,this.abortController=new AbortController;try{this.showLoadingState();const n=await fetch(e,{headers:{"X-Requested-With":"XMLHttpRequest","X-SPA-Request":"true",Accept:"text/html"},signal:this.abortController.signal});if(!n.ok)throw new Error(`HTTP ${n.status}: ${n.statusText}`);const r=await n.text(),s=this.extractMainContent(r),o=this.extractTitle(r)||i;await this.updateContent(s,o),t&&this.updateHistoryState(e,o),this.currentUrl=e,c.info(`[SPARouter] Successfully loaded: ${e}`)}catch(n){if("AbortError"!==n.name)throw this.hideLoadingState(),n}finally{this.isLoading=!1,this.abortController=null}}}extractMainContent(e){const t=(new DOMParser).parseFromString(e,"text/html"),i=t.querySelector("main");if(i)return i.innerHTML;const n=['[role="main"]',".main-content","#main",".content"];for(const r of n){const e=t.querySelector(r);if(e)return c.warn(`[SPARouter] Using fallback selector: ${r}`),e.innerHTML}return c.warn("[SPARouter] No main element found, using entire body"),t.body.innerHTML}extractTitle(e){const t=(new DOMParser).parseFromString(e,"text/html").querySelector("title");return t?t.textContent.trim():""}async updateContent(e,t){t&&(document.title=t),this.options.enableTransitions&&await this.transitionOut(),this.container.innerHTML=e,this.reinitializeModules(),this.options.enableTransitions&&await this.transitionIn(),this.hideLoadingState(),window.scrollTo({top:0,behavior:"smooth"}),this.triggerNavigationEvent()}showLoadingState(){document.body.classList.add(this.options.loadingClass),this.options.enableTransitions&&this.container.classList.add("spa-transitioning-out")}hideLoadingState(){document.body.classList.remove(this.options.loadingClass)}async transitionOut(){return new Promise(e=>{this.container.style.transition=`opacity ${this.options.transitionDuration}ms ease-out`,this.container.style.opacity="0",setTimeout(()=>{e()},this.options.transitionDuration)})}async transitionIn(){return new Promise(e=>{this.container.style.opacity="0",setTimeout(()=>{this.container.style.opacity="1",setTimeout(()=>{this.container.style.transition="",this.container.classList.remove("spa-transitioning-out"),e()},this.options.transitionDuration)},50)})}updateHistoryState(e,t){const i={url:e,title:t,timestamp:Date.now()};e!==window.location.href?history.pushState(i,t,e):history.replaceState(i,t,e)}reinitializeModules(){window.initAutoFormHandling&&window.initAutoFormHandling();this.container.querySelectorAll("[data-module]").forEach(e=>{const t=e.dataset.module;c.info(`[SPARouter] Re-initializing module "${t}" on new content`);const i=new CustomEvent("spa:reinit-module",{detail:{element:e,moduleName:t},bubbles:!0});e.dispatchEvent(i)})}createSkeletonTemplate(){return'\n <div class="spa-skeleton">\n <div class="spa-skeleton-header"></div>\n <div class="spa-skeleton-content">\n <div class="spa-skeleton-line"></div>\n <div class="spa-skeleton-line"></div>\n <div class="spa-skeleton-line short"></div>\n </div>\n </div>\n '}setupStyles(){if(document.getElementById("spa-router-styles"))return;const e=document.createElement("style");e.id="spa-router-styles",e.textContent="\n /* SPA Router Transitions */\n .spa-loading {\n cursor: progress;\n }\n \n .spa-transitioning-out {\n pointer-events: none;\n }\n \n /* Skeleton Loading Styles */\n .spa-skeleton {\n animation: spa-pulse 1.5s ease-in-out infinite alternate;\n }\n \n .spa-skeleton-header {\n height: 2rem;\n background: #e5e7eb;\n border-radius: 0.375rem;\n margin-bottom: 1rem;\n width: 60%;\n }\n \n .spa-skeleton-content {\n space-y: 0.75rem;\n }\n \n .spa-skeleton-line {\n height: 1rem;\n background: #e5e7eb;\n border-radius: 0.375rem;\n margin-bottom: 0.75rem;\n }\n \n .spa-skeleton-line.short {\n width: 75%;\n }\n \n @keyframes spa-pulse {\n 0% {\n opacity: 1;\n }\n 100% {\n opacity: 0.4;\n }\n }\n \n /* Dark mode support */\n @media (prefers-color-scheme: dark) {\n .spa-skeleton-header,\n .spa-skeleton-line {\n background: #374151;\n }\n }\n ",document.head.appendChild(e)}triggerNavigationEvent(){const e=new CustomEvent("spa:navigated",{detail:{url:this.currentUrl,container:this.container,timestamp:Date.now()},bubbles:!0});document.dispatchEvent(e)}navigateTo(e,t){return this.navigate(e,t)}getCurrentUrl(){return this.currentUrl}isNavigating(){return this.isLoading}destroy(){var e;null==(e=this.abortController)||e.abort(),document.removeEventListener("click",this.handleLinkClick),window.removeEventListener("popstate",this.handlePopState),document.removeEventListener("submit",this.handleFormSubmit);const t=document.getElementById("spa-router-styles");t&&t.remove(),c.info("[SPARouter] Destroyed")}}const ue={name:"spa-router",router:null,init(e={}){c.info("[SPARouterModule] Initializing SPA Router");const t={containerSelector:"main",linkSelector:'a[href^="/"]',excludeSelector:'[data-spa="false"], [download], [target="_blank"], [href^="mailto:"], [href^="tel:"], [href^="#"]',enableTransitions:!0,transitionDuration:300,enableSkeletonLoading:!0,...e};return this.router=he.create(t),"undefined"!=typeof window&&(window.spaRouter=this.router),document.addEventListener("spa:reinit-module",this.handleModuleReinit.bind(this)),document.addEventListener("spa:navigated",this.handleNavigation.bind(this)),c.info("[SPARouterModule] SPA Router initialized successfully"),this.router},handleModuleReinit(e){const{element:t,moduleName:i}=e.detail;c.info(`[SPARouterModule] Re-initializing module: ${i}`,t);const n=new CustomEvent("module:reinit-needed",{detail:{element:t,moduleName:i},bubbles:!0});document.dispatchEvent(n)},handleNavigation(e){const{url:t,timestamp:i}=e.detail;c.info(`[SPARouterModule] Navigation completed to: ${t}`),"function"==typeof window.initAutoFormHandling&&setTimeout(()=>{window.initAutoFormHandling()},100),"function"==typeof window.gtag&&window.gtag("config","GA_TRACKING_ID",{page_path:new URL(t).pathname})},navigateTo(e,t){if(this.router)return this.router.navigateTo(e,t);c.warn("[SPARouterModule] Router not initialized")},getCurrentUrl(){var e;return(null==(e=this.router)?void 0:e.getCurrentUrl())||window.location.href},isNavigating(){var e;return(null==(e=this.router)?void 0:e.isNavigating())||!1},destroy(){this.router&&(this.router.destroy(),this.router=null),"undefined"!=typeof window&&window.spaRouter&&delete window.spaRouter,document.removeEventListener("spa:reinit-module",this.handleModuleReinit),document.removeEventListener("spa:navigated",this.handleNavigation),c.info("[SPARouterModule] SPA Router destroyed")}},me=ue.init.bind(ue),ge=Object.freeze(Object.defineProperty({__proto__:null,SPARouter:he,SPARouterModule:ue,default:ue,init:me},Symbol.toStringTag,{value:"Module"}));let fe="sticky-fade",pe=[],ye=window.scrollY,be=new WeakMap,ve={direction:!1,reset:!1};const we=Object.freeze(Object.defineProperty({__proto__:null,destroy:function(){l(fe),pe.forEach(e=>{e.style.opacity="",e.style.transform="",e.classList.remove("visible"),delete e.dataset.scrollDir}),pe=[],be=new WeakMap},init:function(e={}){pe=Array.from(document.querySelectorAll("[data-sticky-fade]")),0!==pe.length&&(ve.direction=e.direction??!1,ve.reset=e.reset??!1,a(fe,()=>{const e=window.scrollY,t=e>ye?"down":e<ye?"up":"none";ye=e;const i=window.innerHeight;pe.forEach(e=>{const n=e.getBoundingClientRect(),r=1-Math.min(Math.max(n.top/i,0),1);if(e.style.opacity=r.toFixed(3),e.style.transform=`translateY(${20*(1-r)}px)`,ve.direction&&(e.dataset.scrollDir=t),ve.reset){const t=r>=1,i=be.get(e)||!1;t&&!i?(e.classList.add("visible"),be.set(e,!0)):!t&&i&&(e.classList.remove("visible"),be.set(e,!1))}})},{autoStart:!0}))}},Symbol.toStringTag,{value:"Module"}));const Se=Object.freeze(Object.defineProperty({__proto__:null,destroy:function(){l("sticky-steps")},init:function(e={}){c.info("StickySteps init");const t={containerSelector:"[data-sticky-container]",stepSelector:"[data-sticky-step]",activeClass:"is-sticky-active",datasetKey:"activeStickyStep",...e};document.querySelectorAll(t.containerSelector).forEach(e=>{const i=e.querySelectorAll(t.stepSelector),n=e.offsetTop;a(`sticky-steps-${e.dataset.moduleId||Math.random()}`,function(){const r=window.scrollY,s=e.offsetHeight;i.forEach((o,a)=>{const l=n+a*(s/i.length),c=n+(a+1)*(s/i.length),d=r>=l&&r<c;o.classList.toggle(t.activeClass,d),d&&(e.dataset[t.datasetKey]=a)})},{autoStart:!0})})}},Symbol.toStringTag,{value:"Module"}));const xe=Object.freeze(Object.defineProperty({__proto__:null,init:function(){}},Symbol.toStringTag,{value:"Module"})),Me=Object.freeze(Object.defineProperty({__proto__:null},Symbol.toStringTag,{value:"Module"})),Ee={noise:{selector:".noise-overlay",toggleKey:"g",className:"grainy",enableTransition:!0},"shortcut-handler.js":{debug:!1},scrollfx:{selector:".fade-in-on-scroll, .zoom-in",offset:.8,baseDelay:.075,once:!0},"scroll-timeline":{attribute:"data-scroll-step",triggerPoint:.4,once:!1},"smooth-scroll":{speed:.2}};const Ae=new class{constructor(){this.crashedModules=new Set,this.recoveryAttempts=new Map,this.maxRecoveryAttempts=3,this.recoveryDelay=1e3}wrapModule(e,t){return e&&"object"==typeof e?new Proxy(e,{get:(e,i,n)=>{const r=e[i];if("function"!=typeof r)return r;const s=Object.getOwnPropertyDescriptor(e,i);return s&&!s.configurable?r:(...n)=>{try{const s=r.apply(e,n);return s&&"function"==typeof s.catch?s.catch(e=>(this.handleModuleError(e,t,i,n),this.getRecoveryValue(t,i))):s}catch(s){return this.handleModuleError(s,t,i,n),this.getRecoveryValue(t,i)}}},getOwnPropertyDescriptor:(e,t)=>{const i=Object.getOwnPropertyDescriptor(e,t);return i&&i.configurable,i},has:(e,t)=>t in e,ownKeys:e=>Object.getOwnPropertyNames(e)}):(c.warn(`[ErrorBoundary] Cannot wrap non-object module: ${t}`),e)}handleModuleError(e,t,i,n){const r=`${t}.${i}`;c.error(`[ErrorBoundary] Module ${t} crashed in ${i}():`,e),this.crashedModules.add(t);const s=this.recoveryAttempts.get(r)||0;this.recoveryAttempts.set(r,s+1),window.dispatchEvent(new CustomEvent("module-error",{detail:{moduleName:t,method:i,error:e.message,args:n,attempts:s+1}})),s<this.maxRecoveryAttempts?this.scheduleRecovery(t,i,n):(c.error(`[ErrorBoundary] Module ${t} exceeded recovery attempts. Marking as permanently failed.`),this.markModuleAsPermanentlyFailed(t))}scheduleRecovery(e,t,i){setTimeout(()=>{try{c.info(`[ErrorBoundary] Attempting recovery for ${e}.${t}()`)}catch(i){c.error(`[ErrorBoundary] Recovery failed for ${e}.${t}():`,i)}},this.recoveryDelay)}getRecoveryValue(e,t){switch(t){case"init":case"destroy":case"update":case"render":return Promise.resolve();case"getData":case"getConfig":return{};case"isEnabled":case"isActive":return!1;default:return}}markModuleAsPermanentlyFailed(e){window.dispatchEvent(new CustomEvent("module-permanent-failure",{detail:{moduleName:e}}))}getHealthStatus(){return{totalCrashedModules:this.crashedModules.size,crashedModules:Array.from(this.crashedModules),recoveryAttempts:Object.fromEntries(this.recoveryAttempts),timestamp:(new Date).toISOString()}}resetModule(e){this.crashedModules.delete(e);for(const[t]of this.recoveryAttempts)t.startsWith(`${e}.`)&&this.recoveryAttempts.delete(t);c.info(`[ErrorBoundary] Reset error tracking for module: ${e}`)}reset(){this.crashedModules.clear(),this.recoveryAttempts.clear(),c.info("[ErrorBoundary] Reset all error tracking")}};window.addEventListener("error",e=>{c.error("[Global] Unhandled error:",e.error||e.message)}),window.addEventListener("unhandledrejection",e=>{c.error("[Global] Unhandled promise rejection:",e.reason)});const ke=new class{constructor(){this.state=new Map,this.subscribers=new Map,this.stateOwners=new Map,this.defaultValues=new Map,this.currentModule="unknown",this.subscriptionCounter=0}setContext(e){this.currentModule=e}register(e,t,i=this.currentModule){this.state.has(e)?c.warn(`[StateManager] State key '${e}' already registered by ${this.stateOwners.get(e)}`):(this.state.set(e,t),this.defaultValues.set(e,t),this.stateOwners.set(e,i),this.subscribers.set(e,[]),c.info(`[StateManager] Registered '${e}' (owner: ${i})`))}get(e){if(this.state.has(e))return this.state.get(e);c.warn(`[StateManager] Unknown state key: '${e}'`)}set(e,t,i=!1){if(!this.state.has(e))return c.warn(`[StateManager] Cannot set unknown state key: '${e}'`),!1;const n=this.stateOwners.get(e);if(!i&&n!==this.currentModule)return c.warn(`[StateManager] Module '${this.currentModule}' cannot modify '${e}' (owned by ${n})`),!1;const r=this.state.get(e);return r===t||(this.state.set(e,t),this.notifySubscribers(e,t,r),c.info(`[StateManager] Updated '${e}' by ${this.currentModule}`)),!0}subscribe(e,t,i=this.currentModule){if(!this.state.has(e))return c.warn(`[StateManager] Cannot subscribe to unknown state key: '${e}'`),null;const n=`${i}_${++this.subscriptionCounter}`,r={id:n,callback:t,subscriber:i};return this.subscribers.has(e)||this.subscribers.set(e,[]),this.subscribers.get(e).push(r),c.info(`[StateManager] Subscribed '${i}' to '${e}'`),n}unsubscribe(e){for(const[t,i]of this.subscribers.entries()){const n=i.findIndex(t=>t.id===e);if(-1!==n){const e=i[n];return i.splice(n,1),void c.info(`[StateManager] Unsubscribed '${e.subscriber}' from '${t}'`)}}c.warn(`[StateManager] Subscription ID not found: ${e}`)}notifySubscribers(e,t,i){(this.subscribers.get(e)||[]).forEach(n=>{try{n.callback(t,i,e)}catch(r){c.error(`[StateManager] Error in subscriber '${n.subscriber}' for '${e}':`,r)}})}reset(e){if(!this.state.has(e))return c.warn(`[StateManager] Cannot reset unknown state key: '${e}'`),!1;const t=this.defaultValues.get(e);return this.set(e,t,!0)}clearModuleSubscriptions(e){let t=0;for(const[i,n]of this.subscribers.entries()){const r=n.filter(t=>t.subscriber!==e);t+=n.length-r.length,this.subscribers.set(i,r)}t>0&&c.info(`[StateManager] Cleared ${t} subscriptions for module '${e}'`)}getSnapshot(){const e={state:Object.fromEntries(this.state),owners:Object.fromEntries(this.stateOwners),subscriptions:{}};for(const[t,i]of this.subscribers.entries())e.subscriptions[t]=i.map(e=>({id:e.id,subscriber:e.subscriber}));return e}resetAll(){this.state.clear(),this.subscribers.clear(),this.stateOwners.clear(),this.defaultValues.clear(),this.subscriptionCounter=0,c.info("[StateManager] Reset complete")}createScope(e){return{register:(t,i)=>(this.setContext(e),this.register(t,i,e)),get:e=>this.get(e),set:(t,i)=>(this.setContext(e),this.set(t,i)),subscribe:(t,i)=>(this.setContext(e),this.subscribe(t,i,e)),unsubscribe:e=>this.unsubscribe(e),reset:e=>this.reset(e),cleanup:()=>this.clearModuleSubscriptions(e)}}};"undefined"!=typeof window&&(window.stateManager=ke,window.stateSnapshot=()=>ke.getSnapshot());const Ce=new Map;function Fe(){const e=document.querySelectorAll("[data-module]");c.info(`[DOMInit] Found ${e.length} elements with data-module attributes`),e.forEach(e=>{const t=e.dataset.module,i=Ce.get(t);if(!i||!i.mod)return void c.warn(`[DOMInit] Module "${t}" not found or failed to initialize`);let n={};try{e.dataset.options&&(n=JSON.parse(e.dataset.options))}catch(r){c.warn(`[DOMInit] Invalid JSON in data-options for ${t}:`,r)}try{const r=i.mod;if("function"==typeof r.initElement){const i=r.initElement(e,n);c.info(`[DOMInit] Initialized ${t} on element:`,e),e._moduleInstance=i,e._moduleName=t}else if("function"==typeof r.init){const i=r.init(e,n);c.info(`[DOMInit] Initialized ${t} on element:`,e),e._moduleInstance=i,e._moduleName=t}else c.warn(`[DOMInit] Module ${t} has no init method for DOM elements`)}catch(r){c.error(`[DOMInit] Failed to initialize ${t} on element:`,r,e)}})}function Oe(){const e=document.querySelectorAll('form:not([data-form-handling="false"])');if(c.info(`[AutoForms] Found ${e.length} forms for auto-enhancement`),0===e.length)return;const t=Ce.get("form-handling");t&&t.mod?e.forEach(e=>{if(e.hasAttribute("data-module"))return void c.info("[AutoForms] Skipping form with explicit data-module:",e);let i={};try{e.dataset.formOptions&&(i=JSON.parse(e.dataset.formOptions))}catch(r){c.warn("[AutoForms] Invalid JSON in data-form-options:",r)}const n={validateOnSubmit:!0,validateOnBlur:!1,validateOnInput:!1,showInlineErrors:!0,ajaxSubmit:!0,enableStateTracking:!1,...i};try{const i=t.mod.initElement?t.mod.initElement(e,n):t.mod.init(e,n);c.info("[AutoForms] Auto-enhanced form:",e),e.setAttribute("data-auto-enhanced","true"),e._moduleInstance=i,e._moduleName="form-handling"}catch(r){c.error("[AutoForms] Failed to auto-enhance form:",r,e)}}):c.warn("[AutoForms] form-handling module not available, skipping auto-init")}async function $e(){await async function(){var e;let t;t="undefined"!=typeof global&&(null==(e=global.importMeta)?void 0:e.glob)?global.importMeta.glob("./*/index.js",{eager:!0}):Object.assign({"./canvas-animations/index.js":w,"./example-module/index.js":E,"./form-handling/index.js":P,"./inertia-scroll/index.js":H,"./lightbox-trigger/index.js":U,"./noise/index.js":Y,"./parallax/index.js":K,"./scroll-dependent/index.js":ee,"./scroll-loop/index.js":te,"./scroll-timeline/index.js":ne,"./scrollfx/index.js":oe,"./sidebar/index.js":ce,"./smooth-scroll/index.js":de,"./spa-router/index.js":ge,"./sticky-fade/index.js":we,"./sticky-steps/index.js":Se,"./ui/index.js":xe,"./wheel-boost/index.js":Me}),c.info("[Modules] Found modules:",Object.keys(t));const i=new Set(Array.from(document.querySelectorAll("[data-module]")).map(e=>e.dataset.module).filter(Boolean)),n=new Set(["spa-router","form-handling"]),r=new Set([...i,...n]),s=r.size===n.size&&0===i.size;c.info("[Modules] DOM modules found:",[...i]),c.info("[Modules] Core modules:",[...n]),c.info("[Modules] Used modules:",[...r]),c.info("[Modules] Fallback mode:",s),Object.entries(t).forEach(([e,t])=>{const i=e.split("/").slice(-2,-1)[0];if(s||r.has(i))if("object"==typeof t.definition)X.register(t.definition);else{const e={name:i,version:"1.0.0",dependencies:[],provides:[],priority:0};X.register(e)}else c.info(`⏭️ [Module] Skipping unused module: ${i}`)});const o=X.calculateInitializationOrder();for(const l of o){if(!s&&!r.has(l)){c.info(`⏭️ [Module] Skipped (not used in DOM): ${l}`);continue}const e=Object.keys(t).find(e=>e.split("/").slice(-2,-1)[0]===l);if(!e){c.warn(`⛔ [Module] No implementation found for: ${l}`);continue}const i=t[e],n=Ee[l]||{},o=X.checkDependencies(l);if(o.satisfied)if("function"==typeof i.init)try{X.markInitializing(l);const e=ke.createScope(l),t=Ae.wrapModule(i,l);await t.init(n,e),X.markInitialized(l),Ce.set(l,{mod:t,config:n,state:e,original:i}),c.info(`✅ [Module] Initialized: ${l}`)}catch(a){c.error(`❌ [Module] Failed to initialize ${l}:`,a),Ce.set(l,{mod:null,config:n,error:a,original:i})}else c.warn(`⛔ [Module] No init() in ${l}`);else c.error(`❌ [Module] Cannot initialize ${l}: ${o.reason}`),Ce.set(l,{mod:null,config:n,error:new Error(o.reason),original:i})}s&&c.info("⚠️ [Module] No data-module usage detected, fallback to full init mode")}(),Fe(),Oe(),function(){const e=Ce.get("spa-router");if(e&&e.mod)try{e.mod.init({containerSelector:"main",enableTransitions:!0,transitionDuration:300}),window.initAutoFormHandling=Oe,window.initDataModuleElements=Fe,c.info("[Init] SPA Router initialized successfully")}catch(t){c.error("[Init] Failed to initialize SPA Router:",t)}else c.info("[Init] SPA Router module not available, skipping")}(),function(){const e=document.querySelectorAll("video[data-src]"),t=window.innerWidth,i=(navigator.connection||{}).effectiveType||"4g";e.forEach(e=>{const n=e.dataset.src;let r="480";r="2g"===i||"slow-2g"===i?"480":"3g"===i?t>=1200?"720":"480":t>=1200?"1080":t>=800?"720":"480";const s=`${n}-${r}.webm`,o=document.createElement("video");o.autoplay=!0,o.loop=!0,o.muted=!0,o.playsInline=!0,o.poster=e.getAttribute("poster")||"",o.setAttribute("width",e.getAttribute("width")||"100%");const a=document.createElement("source");a.src=s,a.type="video/webm",o.appendChild(a),e.replaceWith(o)})}()}"undefined"!=typeof window&&(window.moduleHealth=function(){const e={total:Ce.size,active:0,failed:0,modules:{},errorBoundary:Ae.getHealthStatus()};for(const[t,{mod:i,error:n}]of Ce.entries())n?(e.failed++,e.modules[t]={status:"failed",error:n.message}):i?(e.active++,e.modules[t]={status:"active"}):e.modules[t]={status:"unknown"};return e}),document.addEventListener("DOMContentLoaded",async()=>{try{console.log("🚀 Starting app initialization..."),await $e(),console.log("✅ App initialized successfully!"),setTimeout(()=>{console.log("📊 Debug Info:"),console.log("- Forms found:",document.querySelectorAll("form").length),console.log("- Links found:",document.querySelectorAll('a[href^="/"]').length),console.log("- SPA Router:",window.spaRouter?"Active":"Missing"),console.log("- Enhanced forms:",document.querySelectorAll("form[data-auto-enhanced]").length)},500)}catch(e){console.error("❌ App initialization failed:",e),console.error("Stack trace:",e.stack)}});