{"version":3,"file":"AutoScrollingNav.DJJ2i63k.mjs","names":["r","e"],"sources":["https:/ga.jspm.io/npm:react-hook-inview@4.5.0/dist/esm/index.js","https:/framerusercontent.com/modules/e2CvYWTGGQtT3pCPQY8N/IBUNRWKwLI11FlF1BTnL/AutoScrollingNav.js"],"sourcesContent":["import{useRef as r,useCallback as e,useState as n,useEffect as t}from\"react\";\n/**\n * useObserver\n * @param callback IntersectionObserverCallback\n * @param options IntersectionObserverInit\n * @param externalState React.ComponentState[]\n */const useObserver=(n,{root:t,rootMargin:o,threshold:s}={},i=[])=>{const c=r(null);const u=r(null);const l=e((r=>{if(c.current&&u.current){u.current.unobserve(c.current);u.current.disconnect();u.current=null}if(r){u.current=new IntersectionObserver(n,{root:t,rootMargin:o,threshold:s});u.current.observe(r);c.current=r}}),[c,t,o,JSON.stringify(s),...i]);return l};\n/**\n * useInView\n * @param options IntersectionObserverInit\n * @param externalState React.ComponentState[]\n */const useInView=({root:r,rootMargin:o,threshold:s,unobserveOnEnter:i,target:c,onEnter:u,onLeave:l,defaultInView:v}={},d=[])=>{const[a,h]=n({inView:v||false,entry:null,observer:null});const f=e((([r],e)=>{const n=e.thresholds.some((e=>r.intersectionRatio>=e));const t=n&&r.isIntersecting;h({inView:t,entry:r,observer:e});if(t&&i){e.unobserve(r.target);e.disconnect()}t?null===u||void 0===u?void 0:u(r,e):null===l||void 0===l?void 0:l(r,e)}),[u,l,i]);const b=useObserver(f,{root:r,rootMargin:o,threshold:s},[i,...d]);t((()=>{(null===c||void 0===c?void 0:c.current)&&b(c.current)}),[c,b]);return[b,a.inView,a.entry,a.observer]};export{useInView,useObserver as useInViewEffect};\n\n//# sourceMappingURL=index.js.map","import{jsx as _jsx}from\"react/jsx-runtime\";import{createStore}from\"https://framer.com/m/framer/store.js@^1.0.0\";import{useRef,useEffect}from\"react\";import{useInView}from\"react-hook-inview\";const useGeneralStore=createStore({// The ID of the content on screen\nprimarySectionsOnScreen:null});export function withOnScreenTracking(Component){return props=>{// Inview: https://github.com/bitmap/react-hook-inview\n// Can tweak using the `rootMargin` or `threshold` (how much of component is on screen, defaults to 0.5) values\nconst[ref,isVisible]=useInView({});const[store,setStore]=useGeneralStore();// On visibility changes, potentially declare self as primary section\nuseEffect(()=>{// If we are becoming visible, claim priority\nif(isVisible){//const viewedID = [\"06\"].includes(props.id)\n/*const viewedID = [\"06\"].includes(props.name)\n                    ? \"07\"\n                    : props.name === \"01\"\n                    ? \"00\"\n                    : props.name*/const viewedID=props.name;const updatedStore={...store,primarySectionsOnScreen:viewedID};//console.log(props.name, updatedStore)\nsetStore(updatedStore);}},[isVisible]);return /*#__PURE__*/_jsx(Component,{...props,ref:ref});};}export function withAutoScrolling(Component){return props=>{const ref=useRef(null);const[_,isVisible]=useInView({target:ref,threshold:1});const[store,__]=useGeneralStore();// When the primary section updates, potentially scroll\nuseEffect(()=>{// If the primary content's id matches our link, scroll into view\n//const destinationID = props.link\nconst destinationID=props.name;//console.log(\"tracking: \" + props.name)\nconst shownContentLinkedToByNav=destinationID.includes(store.primarySectionsOnScreen);// Add check to see if already on screen\nif(shownContentLinkedToByNav&&!isVisible){ref.current.scrollIntoView({behavior:\"smooth\"});}},[store.primarySectionsOnScreen]);return /*#__PURE__*/_jsx(Component,{...props,ref:ref});};}\nexport const __FramerMetadata__ = {\"exports\":{\"withOnScreenTracking\":{\"type\":\"reactHoc\",\"name\":\"withOnScreenTracking\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withAutoScrolling\":{\"type\":\"reactHoc\",\"name\":\"withAutoScrolling\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./AutoScrollingNav.map"],"mappings":"uRAWS,AAXT,GAA6E,CAMpE,EAAY,CAAC,EAAE,CAAC,KAAK,EAAE,WAAW,EAAE,UAAU,EAAE,CAAC,CAAE,EAAC,EAAE,CAAE,IAAG,CAAC,IAAM,EAAE,EAAE,KAAK,CAAO,EAAE,EAA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