import{S as h,g as o}from"./ScrollTrigger.C8IefbVz.js";const d=new Map;function p(e,a="wave"){o.globals().ScrollTrigger||o.registerPlugin(h),d.has(e)&&(d.get(e).forEach(c=>c.kill()),d.delete(e));const r=document.querySelector(`[data-thread-id="${e}"]`)?.closest("svg");if(!r){console.warn(`Golden Thread SVG not found for ID: ${e}`);return}const g=r.closest("section, [data-section]")||r.parentElement;if(!g)return;const s=[];a==="chain-link"||a==="chain-link-simple"?m(r,g,e,s):k(r,g,e,a,s),d.set(e,s),h.refresh()}function m(e,a,r,g){const s=e.querySelector('[data-thread="main"]');if(s){const t=s.getTotalLength();o.set(s,{strokeDasharray:t,strokeDashoffset:t,opacity:0});const n=o.to(s,{strokeDashoffset:0,opacity:1,duration:2,ease:"power3.inOut",scrollTrigger:{trigger:a,start:"top 70%",end:"bottom 30%",scrub:1.5,id:`${r}-main`}});g.push(n.scrollTrigger)}const i=e.querySelector('[data-thread="secondary"]');if(i){const t=i.getTotalLength();o.set(i,{strokeDasharray:t,strokeDashoffset:t,opacity:0});const n=o.to(i,{strokeDashoffset:0,opacity:.7,duration:2,ease:"power3.inOut",scrollTrigger:{trigger:a,start:"top 65%",end:"bottom 35%",scrub:1.3,id:`${r}-secondary`}});g.push(n.scrollTrigger)}const c=e.querySelector('[data-thread="tertiary"]');if(c){const t=c.getTotalLength();o.set(c,{strokeDasharray:`${t*.05}, ${t*.05}`,strokeDashoffset:t,opacity:0});const n=o.to(c,{strokeDashoffset:0,opacity:.5,duration:1.5,ease:"power2.inOut",scrollTrigger:{trigger:a,start:"top 50%",end:"bottom 50%",scrub:.8,id:`${r}-tertiary`}});g.push(n.scrollTrigger)}const l=h.create({trigger:a,start:"top 60%",end:"bottom 40%",scrub:1,onUpdate:t=>{const n=t.progress,T=Math.sin(n*Math.PI*6)*.3+.5;s&&i&&o.to([s,i],{filter:`drop-shadow(0 0 ${T*3}px var(--color-gold))`,duration:.1})},id:`${r}-glow`});g.push(l)}function k(e,a,r,g,s){const i=e.querySelector('[data-thread="main"]');if(i){const t=i.getTotalLength();o.set(i,{strokeDasharray:t,strokeDashoffset:t,opacity:0});const n=o.to(i,{strokeDashoffset:0,opacity:1,ease:w(g),scrollTrigger:{trigger:a,start:"top 60%",end:"bottom 40%",scrub:1.2,id:`${r}-main`}});s.push(n.scrollTrigger)}const c=e.querySelector('[data-thread="secondary"]');if(c){const t=c.getTotalLength();o.set(c,{strokeDasharray:t,strokeDashoffset:t,opacity:0});const n=o.to(c,{strokeDashoffset:0,opacity:.6,ease:"power2.inOut",scrollTrigger:{trigger:a,start:"top 50%",end:"bottom 50%",scrub:1,id:`${r}-secondary`}});s.push(n.scrollTrigger)}const l=e.querySelector('[data-thread="tertiary"]');if(l){const t=l.getTotalLength();o.set(l,{strokeDasharray:`${t*.02}, ${t*.02}`,strokeDashoffset:t,opacity:0});const n=o.to(l,{strokeDashoffset:0,opacity:.4,ease:"none",scrollTrigger:{trigger:a,start:"top 40%",end:"bottom 60%",scrub:.8,id:`${r}-tertiary`}});s.push(n.scrollTrigger)}}function w(e){return{wave:"power2.inOut",spiral:"power3.inOut",diagonal:"power1.inOut",arc:"power2.out","double-wave":"power4.inOut",zigzag:"none",topleftarc:"power2.inOut","chain-link":"power3.inOut","chain-link-simple":"power2.inOut"}[e]||"power2.inOut"}function D(){d.forEach((e,a)=>{e.forEach(r=>r.kill())}),d.clear()}let y;window.addEventListener("resize",()=>{clearTimeout(y),y=setTimeout(()=>{h.refresh()},250)});typeof document<"u"&&document.addEventListener("astro:before-swap",()=>{D()});const u="{id}",f="{type}";document.readyState==="loading"?document.addEventListener("DOMContentLoaded",()=>p(u,f)):p(u,f);document.addEventListener("astro:page-load",()=>{p(u,f)});
