{"version":3,"file":"GuardGSAP.Cy89GGef.mjs","names":["ScrollTrigger"],"sources":["https:/framerusercontent.com/modules/BiJEYheyGaQxmVNsC2Sz/CapsSAAfdaukLN8pq5dh/GuardGSAP.js"],"sourcesContent":["import{jsx as _jsx}from\"react/jsx-runtime\";import*as React from\"react\";import{addPropertyControls,ControlType}from\"framer\";import gsap from\"gsap\";import{ScrollTrigger}from\"gsap/ScrollTrigger\";gsap.registerPlugin(ScrollTrigger);/**\n * GSAP Page Guard – FINAL\n *\n * ✔ Reset scroll đúng timing\n * ✔ Kill trigger page cũ\n * ✔ Delay trigger page mới\n * ✔ Không cần sửa override phía dưới\n */export function GSAPPageGuard(props){const{lockMs=200,width=1,height=1}=props;React.useLayoutEffect(()=>{if(typeof window===\"undefined\")return;let raf1=0;let raf2=0;let raf3=0;let timeout=null;// 1️⃣ Kill toàn bộ trigger CŨ (chỉ trigger, không kill tween)\nScrollTrigger.getAll().forEach(t=>t.kill(false));// 2️⃣ Đợi Framer Router restore scroll xong\nraf1=requestAnimationFrame(()=>{raf2=requestAnimationFrame(()=>{raf3=requestAnimationFrame(()=>{// 3️⃣ Ép scroll về top (LÚC NÀY MỚI ĂN)\nwindow.scrollTo({top:0,left:0,behavior:\"auto\"});// 4️⃣ Refresh để reset state\nScrollTrigger.refresh(true);// 5️⃣ Lock scroll ngắn để tránh Framer ghi đè\ndocument.documentElement.style.overflow=\"hidden\";timeout=setTimeout(()=>{document.documentElement.style.overflow=\"\";ScrollTrigger.refresh(true);},lockMs);});});});return()=>{cancelAnimationFrame(raf1);cancelAnimationFrame(raf2);cancelAnimationFrame(raf3);if(timeout)clearTimeout(timeout);};},[]);return /*#__PURE__*/_jsx(\"div\",{style:{width,height,opacity:0,pointerEvents:\"none\"}});}addPropertyControls(GSAPPageGuard,{lockMs:{type:ControlType.Number,title:\"Lock Scroll (ms)\",defaultValue:200,min:0,max:500,step:10},width:{type:ControlType.Number,title:\"W\",defaultValue:1,min:1,max:100},height:{type:ControlType.Number,title:\"H\",defaultValue:1,min:1,max:100}});\nexport const __FramerMetadata__ = {\"exports\":{\"GSAPPageGuard\":{\"type\":\"reactComponent\",\"name\":\"GSAPPageGuard\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./GuardGSAP.map"],"mappings":"2PAOG,SAAgB,EAAc,EAAM,CAAC,GAAK,CAAC,SAAO,IAAI,QAAM,EAAE,SAAO,GAAG,EAK6N,OALvN,MAA0B,CAAC,GAAU,IAAS,OAAY,OAAO,IAAI,EAAK,EAAM,EAAK,EAAM,EAAK,EAAM,EAAQ,KAK5B,OAJnK,EAAc,QAAQ,CAAC,QAAQ,GAAG,EAAE,KAAK,GAAM,CAAC,CAChD,EAAK,0BAA0B,CAAC,EAAK,0BAA0B,CAAC,EAAK,0BAA0B,CAC/F,EAAO,SAAS,CAAC,IAAI,EAAE,KAAK,EAAE,SAAS,OAAO,CAAC,CAC/C,EAAc,QAAQ,GAAK,CAC3B,SAAS,gBAAgB,MAAM,SAAS,SAAS,EAAQ,eAAe,CAAC,SAAS,gBAAgB,MAAM,SAAS,GAAG,EAAc,QAAQ,GAAK,EAAG,EAAO,EAAG,EAAG,EAAG,KAAW,CAAC,qBAAqB,EAAK,CAAC,qBAAqB,EAAK,CAAC,qBAAqB,EAAK,CAAI,GAAQ,aAAa,EAAQ,GAAK,EAAE,CAAC,CAAqB,EAAK,MAAM,CAAC,MAAM,CAAC,QAAM,SAAO,QAAQ,EAAE,cAAc,OAAO,CAAC,CAAC,sBAZlV,IAA4B,IAAoD,IAAuB,IAA8C,GAAK,eAAeA,EAAc,CAY6J,EAAoB,EAAc,CAAC,OAAO,CAAC,KAAK,EAAY,OAAO,MAAM,mBAAmB,aAAa,IAAI,IAAI,EAAE,IAAI,IAAI,KAAK,GAAG,CAAC,MAAM,CAAC,KAAK,EAAY,OAAO,MAAM,IAAI,aAAa,EAAE,IAAI,EAAE,IAAI,IAAI,CAAC,OAAO,CAAC,KAAK,EAAY,OAAO,MAAM,IAAI,aAAa,EAAE,IAAI,EAAE,IAAI,IAAI,CAAC,CAAC"}