{"version":3,"file":"Scroll_progress_bar.BZGnN246.mjs","names":["__esmMin","window","init_ssg_sandbox_shims","init_npm_react_18_3_1","c","init_jsx_runtime","ce","init_framer_motion_DbYmcygs","motion","useMotionValue","addPropertyControls","init_framer_DPhDUVVB","ControlType","ScrollProgressBar","progress","update","doc","body","scrollHeight","viewport","max","y","t","thickness","container","barStyle","orientation","hPosition","color","vPosition","init_Scroll_progress_bar","p"],"sources":["https:/framerusercontent.com/modules/HvNHO2ScTr7HQzwUcSD4/gaG4psyF6bVtRqiDYWmW/Scroll_progress_bar.js"],"sourcesContent":["// ScrollProgressBar.tsx\n// @framerSupportedLayoutWidth auto\n// @framerSupportedLayoutHeight auto\nimport{jsx as _jsx}from\"react/jsx-runtime\";import*as React from\"react\";import{motion,useMotionValue}from\"framer-motion\";import{addPropertyControls,ControlType}from\"framer\";export default function ScrollProgressBar({thickness,color,orientation,hPosition,vPosition}){const progress=useMotionValue(0);React.useEffect(()=>{const update=()=>{const doc=document.documentElement;const body=document.body;const scrollHeight=Math.max(body.scrollHeight,doc.scrollHeight,body.offsetHeight,doc.offsetHeight,body.clientHeight,doc.clientHeight);const viewport=doc.clientHeight;const max=Math.max(scrollHeight-viewport,1);const y=window.pageYOffset||doc.scrollTop||body.scrollTop||0;progress.set(Math.min(Math.max(y/max,0),1));};update();window.addEventListener(\"scroll\",update,{passive:true});window.addEventListener(\"resize\",update);return()=>{window.removeEventListener(\"scroll\",update);window.removeEventListener(\"resize\",update);};},[progress]);const t=Math.max(thickness,1);// Container style (fixed, full-page)\nconst container={position:\"fixed\",zIndex:9999,pointerEvents:\"none\"};let barStyle;if(orientation===\"horizontal\"){Object.assign(container,{left:0,right:0,height:t,top:hPosition===\"top\"?0:undefined,bottom:hPosition===\"bottom\"?0:undefined});barStyle={height:\"100%\",width:\"100%\",background:color,scaleX:progress,transformOrigin:\"0% 50%\",willChange:\"transform\"};}else{Object.assign(container,{top:0,bottom:0,width:t,left:vPosition===\"left\"?0:undefined,right:vPosition===\"right\"?0:undefined});barStyle={width:\"100%\",height:\"100%\",background:color,scaleY:progress,transformOrigin:\"50% 0%\",willChange:\"transform\"};}return /*#__PURE__*/_jsx(\"div\",{style:container,children:/*#__PURE__*/_jsx(motion.div,{style:barStyle})});}addPropertyControls(ScrollProgressBar,{thickness:{type:ControlType.Number,title:\"Thickness\",defaultValue:3,min:1,max:40,unit:\"px\"},color:{type:ControlType.Color,title:\"Color\",defaultValue:\"#FF1212\"},orientation:{type:ControlType.Enum,title:\"Orientation\",options:[\"horizontal\",\"vertical\"],optionTitles:[\"Horizontal\",\"Vertical\"],defaultValue:\"horizontal\"},hPosition:{type:ControlType.Enum,title:\"Position\",options:[\"top\",\"bottom\"],optionTitles:[\"Top\",\"Bottom\"],defaultValue:\"top\",hidden:p=>p.orientation!==\"horizontal\"},vPosition:{type:ControlType.Enum,title:\"Position\",options:[\"left\",\"right\"],optionTitles:[\"Left\",\"Right\"],defaultValue:\"left\",hidden:p=>p.orientation!==\"vertical\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"ScrollProgressBar\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./Scroll_progress_bar.map"],"mappings":"A,gPAG4K,SAAwBa,EAAkB,CAAC,YAAU,QAAM,cAAY,YAAU,aAAW,CAAC,IAAMC,EAASL,EAAe,CAAC,EAAEH,MAAoB,CAAC,IAAMS,MAAW,CAAC,IAAMC,EAAI,SAAS,gBAAsBC,EAAK,SAAS,KAAWC,EAAa,KAAK,IAAID,EAAK,aAAaD,EAAI,aAAaC,EAAK,aAAaD,EAAI,aAAaC,EAAK,aAAaD,EAAI,YAAY,EAAQG,EAASH,EAAI,aAAmBI,EAAI,KAAK,IAAIF,EAAaC,EAAS,CAAC,EAAQE,EAAEpB,EAAO,aAAae,EAAI,WAAWC,EAAK,WAAW,EAAEH,EAAS,IAAI,KAAK,IAA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