{
  "version": 3,
  "sources": ["ssg:https://framerusercontent.com/modules/0VHhkaJbC5BhxCVD0ec8/72JUGnWhLxvdlNpBDAZ4/Navigation_Color.js"],
  "sourcesContent": ["import{jsx as _jsx}from\"react/jsx-runtime\";import{useState,useEffect}from\"react\";import{useViewportScroll,useTransform,useMotionValue}from\"framer-motion\";// The following overrides are for creating scroll effects on web pages\n// Trigger a state change when each layer with a <section> tag reaches the top of the page\n// You can apply a <section> tag to a layer through the 'Accessibility' property controls\nexport function withSectionTriggeredStates(Component){const outputRange=[\"First\",\"Second\"] // list of variants to animate between\n;return props=>{const{scrollY}=useViewportScroll();const[state,setState]=useState(outputRange[0]);useEffect(()=>{const scrollYRange=getSectionPositions();scrollY.onChange(latest=>{const output=getCorrespondingItem(latest,scrollYRange,outputRange);setState(output);});},[]);return /*#__PURE__*/ _jsx(Component,{...props,variant:state});};}// Custom hooks\nfunction useSteppedTransform(value,inputRange,outputRange){return useTransform(value,value=>getCorrespondingItem(value,inputRange,outputRange));}function useScrollTriggeredState(inputRange,outputRange){const{scrollY}=useViewportScroll();const[state,setState]=useState(outputRange[0]);useEffect(()=>scrollY.onChange(latest=>setState(getCorrespondingItem(latest,inputRange,outputRange))),[]);return state;}function useSectionTrigger(handleSectionChange){const scrollOutput=useMotionValue(0);const{scrollY}=useViewportScroll();useEffect(()=>{const scrollYRange=getSectionPositions();scrollY.onChange(latest=>{const index=getMatchingIndex(latest,scrollYRange);if(scrollOutput.get()!==index){scrollOutput.set(index);}});},[]);useEffect(()=>scrollOutput.onChange(handleSectionChange),[]);}// Functions\nfunction getMatchingIndex(value,array){let found=array.findIndex(el=>el>value);switch(found){case 0:return 0;break;case-1:return array.length-1;break;default:return found-1;}}function getCorrespondingItem(value,inputRange,outputRange){const inputIndex=getMatchingIndex(value,inputRange);const outputIndex=inputIndex>outputRange.length-1?outputRange.length-1:inputIndex;return outputRange[outputIndex];}function getSectionPositions(){const elements=Array.from(document.querySelectorAll(\"section\"));const positions=elements.map(element=>{return element.getBoundingClientRect().top+window.scrollY;}).sort((a,b)=>a-b);if(positions[0]===0){return positions;}else{return[0,...positions];}}function getScrollTargets(){const elements=Array.from(document.querySelectorAll('[id]:not([id=\"\"])'));const targets=elements.map(element=>{return{y:element.getBoundingClientRect().top+window.scrollY,target:`#${element.id}`};}).sort((a,b)=>a.y-b.y);const inputs=targets.map(target=>target.y);const outputs=targets.map(target=>target.target);if(inputs[0]===0){outputs[0]=\"#\";return{scrollYRange:inputs,outputRange:outputs};}else{return{scrollYRange:[0,...inputs],outputRange:[\"#\",...outputs]};}}\nexport const __FramerMetadata__ = {\"exports\":{\"withSectionTriggeredStates\":{\"type\":\"reactHoc\",\"name\":\"withSectionTriggeredStates\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./Navigation_Color.map"],
  "mappings": "uGAGO,SAASA,EAA2BC,EAAU,CAAC,IAAMC,EAAY,CAAC,QAAQ,QAAQ,EACxF,OAAOC,GAAO,CAAC,GAAK,CAAC,QAAAC,CAAO,EAAEC,EAAkB,EAAO,CAACC,EAAMC,CAAQ,EAAEC,EAASN,EAAY,CAAC,CAAC,EAAE,OAAAO,EAAU,IAAI,CAAC,IAAMC,EAAaC,EAAoB,EAAEP,EAAQ,SAASQ,GAAQ,CAAC,IAAMC,EAAOC,EAAqBF,EAAOF,EAAaR,CAAW,EAAEK,EAASM,CAAM,CAAE,CAAC,CAAE,EAAE,CAAC,CAAC,EAAuBE,EAAKd,EAAU,CAAC,GAAGE,EAAM,QAAQG,CAAK,CAAC,CAAE,CAAE,CAEjV,SAASU,EAAiBC,EAAMC,EAAM,CAAC,IAAIC,EAAMD,EAAM,UAAUE,GAAIA,EAAGH,CAAK,EAAE,OAAOE,EAAM,CAAC,IAAK,GAAE,MAAO,GAAQ,IAAI,GAAG,OAAOD,EAAM,OAAO,EAAQ,QAAQ,OAAOC,EAAM,CAAE,CAAC,CAAC,SAASE,EAAqBJ,EAAMK,EAAWC,EAAY,CAAC,IAAMC,EAAWR,EAAiBC,EAAMK,CAAU,EAAQG,EAAYD,EAAWD,EAAY,OAAO,EAAEA,EAAY,OAAO,EAAEC,EAAW,OAAOD,EAAYE,CAAW,CAAE,CAAC,SAASC,GAAqB,CAAiE,IAAMC,EAAvD,MAAM,KAAK,SAAS,iBAAiB,SAAS,CAAC,EAA2B,IAAIC,GAAiBA,EAAQ,sBAAsB,EAAE,IAAIC,EAAO,OAAS,EAAE,KAAK,CAACC,EAAEC,IAAID,EAAEC,CAAC,EAAE,OAAGJ,EAAU,CAAC,IAAI,EAAUA,EAAsB,CAAC,EAAE,GAAGA,CAAS,CAAG",
  "names": ["withSectionTriggeredStates", "Component", "outputRange", "props", "scrollY", "useViewportScroll", "state", "setState", "ye", "ue", "scrollYRange", "getSectionPositions", "latest", "output", "getCorrespondingItem", "p", "getMatchingIndex", "value", "array", "found", "el", "getCorrespondingItem", "inputRange", "outputRange", "inputIndex", "outputIndex", "getSectionPositions", "positions", "element", "window", "a", "b"]
}
