{"version":3,"file":"DothPath.CT8EzCCe.mjs","names":["useRef","useState"],"sources":["https:/framerusercontent.com/modules/E0eDeaOmjTiZxvpUrbuF/I4zl63n3Spv11OKvC1Ek/DothPath.js"],"sourcesContent":["import{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import{addPropertyControls,ControlType}from\"framer\";import{motion}from\"framer-motion\";import{useRef,useEffect,useState}from\"react\";/**\n * @framerSupportedLayoutWidth any\n * @framerSupportedLayoutHeight any\n */export default function PathSVGAnimation(props){const{pathSVG,loopMode,dotSize,gap,borderColor,animatedDotSize,animatedDotColor,speed,animatedElementType,animatedSVG,style,showTrail,trailLength,trailColor}=props;const pathRef=useRef(null);const[pathLength,setPathLength]=useState(0);const[dottedLine,setDottedLine]=useState([]);const[extractedPath,setExtractedPath]=useState(\"\");const[viewBox,setViewBox]=useState(\"0 0 100 100\");const[dimensions,setDimensions]=useState({width:100,height:100});const[animatedSVGContent,setAnimatedSVGContent]=useState(null);const[animatedSVGViewBox,setAnimatedSVGViewBox]=useState(null);const[animatedSVGDimensions,setAnimatedSVGDimensions]=useState({width:100,height:100});const[pathStyle,setPathStyle]=useState(\"dotted\");useEffect(()=>{if(pathSVG===null||pathSVG===void 0?void 0:pathSVG.src){fetch(pathSVG.src).then(response=>response.text()).then(svgText=>{const parser=new DOMParser;const svgDoc=parser.parseFromString(svgText,\"image/svg+xml\");const svgElement=svgDoc.querySelector(\"svg\");const pathElement=svgDoc.querySelector(\"path\");if(svgElement){var _svgElement_viewBox_baseVal,_svgElement_viewBox,_svgElement_viewBox_baseVal1,_svgElement_viewBox1;const newViewBox=svgElement.getAttribute(\"viewBox\");if(newViewBox){setViewBox(newViewBox);}// Get original width and height from SVG\nconst width=svgElement.getAttribute(\"width\")||((_svgElement_viewBox=svgElement.viewBox)===null||_svgElement_viewBox===void 0?void 0:(_svgElement_viewBox_baseVal=_svgElement_viewBox.baseVal)===null||_svgElement_viewBox_baseVal===void 0?void 0:_svgElement_viewBox_baseVal.width)||100;const height=svgElement.getAttribute(\"height\")||((_svgElement_viewBox1=svgElement.viewBox)===null||_svgElement_viewBox1===void 0?void 0:(_svgElement_viewBox_baseVal1=_svgElement_viewBox1.baseVal)===null||_svgElement_viewBox_baseVal1===void 0?void 0:_svgElement_viewBox_baseVal1.height)||100;setDimensions({width:Number(width),height:Number(height)});// Only set viewBox if it doesn't exist in the original SVG\nif(!newViewBox){setViewBox(`0 0 ${width} ${height}`);}}if(pathElement){setExtractedPath(pathElement.getAttribute(\"d\")||\"\");}}).catch(error=>console.error(\"Error loading SVG:\",error));}},[pathSVG]);useEffect(()=>{if(pathRef.current){setPathLength(pathRef.current.getTotalLength());const dots=[];const totalLength=pathRef.current.getTotalLength();let offset=0;while(offset<totalLength){const point=pathRef.current.getPointAtLength(offset);dots.push(/*#__PURE__*/_jsx(\"circle\",{cx:point.x,cy:point.y,r:dotSize/2,fill:borderColor},offset));offset+=dotSize+gap;}setDottedLine(dots);}},[extractedPath,dotSize,gap,borderColor]);useEffect(()=>{if(animatedElementType===\"svg\"&&(animatedSVG===null||animatedSVG===void 0?void 0:animatedSVG.src)){fetch(animatedSVG.src).then(response=>response.text()).then(svgText=>{const parser=new DOMParser;const svgDoc=parser.parseFromString(svgText,\"image/svg+xml\");const svgElement=svgDoc.querySelector(\"svg\");if(svgElement){var _svgElement_viewBox_baseVal,_svgElement_viewBox,_svgElement_viewBox_baseVal1,_svgElement_viewBox1;const width=svgElement.getAttribute(\"width\")||((_svgElement_viewBox=svgElement.viewBox)===null||_svgElement_viewBox===void 0?void 0:(_svgElement_viewBox_baseVal=_svgElement_viewBox.baseVal)===null||_svgElement_viewBox_baseVal===void 0?void 0:_svgElement_viewBox_baseVal.width)||100;const height=svgElement.getAttribute(\"height\")||((_svgElement_viewBox1=svgElement.viewBox)===null||_svgElement_viewBox1===void 0?void 0:(_svgElement_viewBox_baseVal1=_svgElement_viewBox1.baseVal)===null||_svgElement_viewBox_baseVal1===void 0?void 0:_svgElement_viewBox_baseVal1.height)||100;setAnimatedSVGDimensions({width:Number(width),height:Number(height)});setAnimatedSVGContent(svgElement.innerHTML);setAnimatedSVGViewBox(svgElement.getAttribute(\"viewBox\")||`0 0 ${width} ${height}`);}}).catch(error=>console.error(\"Error loading animated SVG:\",error));}},[animatedElementType,animatedSVG]);const animationVariants={loop:{repeat:Infinity,repeatType:\"loop\"},cycle:{repeat:Infinity,repeatType:\"mirror\"},once:{repeat:0}};return /*#__PURE__*/_jsxs(\"svg\",{viewBox:viewBox,style:{...style,overflow:\"visible\",display:\"block\",width:\"100%\",height:\"100%\",preserveAspectRatio:\"xMidYMid meet\"},width:dimensions.width,height:dimensions.height,children:[/*#__PURE__*/_jsx(\"path\",{ref:pathRef,d:extractedPath,fill:\"none\",stroke:\"transparent\",strokeWidth:0}),props.pathStyle===\"solid\"?/*#__PURE__*/_jsx(\"path\",{d:extractedPath,fill:\"none\",stroke:borderColor,strokeWidth:dotSize}):/*#__PURE__*/_jsx(\"g\",{children:dottedLine}),showTrail&&pathLength>0&&/*#__PURE__*/_jsx(motion.path,{d:extractedPath,fill:\"none\",stroke:trailColor,strokeWidth:dotSize,strokeDasharray:`${trailLength}% ${pathLength}`,animate:{strokeDashoffset:[pathLength,0]},transition:{duration:2/speed,ease:\"linear\",delay:props.delay,...animationVariants[loopMode]},style:{pathLength:pathLength}}),pathLength>0&&/*#__PURE__*/_jsx(motion.g,{animate:{x:Array.from({length:101},(_,i)=>{var _pathRef_current_getPointAtLength,_pathRef_current;return((_pathRef_current=pathRef.current)===null||_pathRef_current===void 0?void 0:(_pathRef_current_getPointAtLength=_pathRef_current.getPointAtLength(pathLength*i/100))===null||_pathRef_current_getPointAtLength===void 0?void 0:_pathRef_current_getPointAtLength.x)||0;}),y:Array.from({length:101},(_,i)=>{var _pathRef_current_getPointAtLength,_pathRef_current;return((_pathRef_current=pathRef.current)===null||_pathRef_current===void 0?void 0:(_pathRef_current_getPointAtLength=_pathRef_current.getPointAtLength(pathLength*i/100))===null||_pathRef_current_getPointAtLength===void 0?void 0:_pathRef_current_getPointAtLength.y)||0;})},transition:{duration:2/speed,ease:\"easeInOut\",delay:props.delay,...animationVariants[loopMode]},children:animatedElementType===\"dot\"?/*#__PURE__*/_jsx(\"circle\",{r:animatedDotSize,fill:animatedDotColor}):animatedSVGContent&&/*#__PURE__*/_jsx(\"svg\",{viewBox:animatedSVGViewBox||\"0 0 100 100\",width:animatedSVGDimensions.width,height:animatedSVGDimensions.height,x:-animatedSVGDimensions.width/2,y:-animatedSVGDimensions.height/2,dangerouslySetInnerHTML:{__html:animatedSVGContent}})})]});}PathSVGAnimation.displayName=\"Path SVG Animation\";addPropertyControls(PathSVGAnimation,{pathSVG:{type:ControlType.ResponsiveImage,title:\"Path SVG\"},loopMode:{type:ControlType.Enum,defaultValue:\"once\",options:[\"once\",\"loop\",\"cycle\"],optionTitles:[\"Once\",\"Loop\",\"Cycle\"],displaySegmentedControl:true},// Background dots controls\ndotSize:{type:ControlType.Number,defaultValue:4,min:1,max:10,step:1,displayStepper:true,title:\"Path Size\"},gap:{type:ControlType.Number,defaultValue:4,min:0,max:20,step:1,displayStepper:true,title:\"Dot Gap\",hidden:props=>props.pathStyle===\"solid\"},borderColor:{type:ControlType.Color,defaultValue:\"#000\",title:\"Path Color\"},// Animated dot controls\nanimatedDotSize:{type:ControlType.Number,defaultValue:6,min:1,max:20,step:1,displayStepper:true,title:\"Element Size\"},animatedDotColor:{type:ControlType.Color,defaultValue:\"#FF0000\",title:\"Dot Color\",hidden:props=>props.animatedElementType===\"svg\"},speed:{type:ControlType.Number,defaultValue:1,min:.1,max:5,step:.1,displayStepper:true,title:\"Animation Speed\"},animatedElementType:{type:ControlType.Enum,defaultValue:\"dot\",options:[\"dot\",\"svg\"],optionTitles:[\"Dot\",\"Custom\"],displaySegmentedControl:true,title:\"Animated Element\"},animatedSVG:{type:ControlType.ResponsiveImage,title:\"Animated SVG\",hidden:props=>props.animatedElementType===\"dot\"},delay:{type:ControlType.Number,defaultValue:0,min:0,max:10,step:.1,displayStepper:true,title:\"Start Delay\"},pathStyle:{type:ControlType.Enum,defaultValue:\"dotted\",options:[\"dotted\",\"solid\"],optionTitles:[\"Dotted\",\"Solid\"],displaySegmentedControl:true,title:\"Path Style\"},showTrail:{type:ControlType.Boolean,defaultValue:false,title:\"Show Trail\"},trailLength:{type:ControlType.Number,defaultValue:20,min:1,max:100,step:1,displayStepper:true,title:\"Trail Length\",hidden:props=>!props.showTrail},trailColor:{type:ControlType.Color,defaultValue:\"#0066FF\",title:\"Trail Color\",hidden:props=>!props.showTrail}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"PathSVGAnimation\",\"slots\":[],\"annotations\":{\"framerSupportedLayoutWidth\":\"any\",\"framerSupportedLayoutHeight\":\"any\",\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./DothPath.map"],"mappings":"gPAGG,SAAwB,EAAiB,EAAM,CAAC,GAAK,CAAC,UAAQ,WAAS,UAAQ,MAAI,cAAY,kBAAgB,mBAAiB,QAAM,sBAAoB,cAAY,QAAM,YAAU,cAAY,cAAY,EAAY,EAAQA,EAAO,KAAK,CAAM,CAAC,EAAW,GAAeC,EAAS,EAAE,CAAM,CAAC,EAAW,GAAeA,EAAS,EAAE,CAAC,CAAM,CAAC,EAAc,GAAkBA,EAAS,GAAG,CAAM,CAAC,EAAQ,GAAYA,EAAS,cAAc,CAAM,CAAC,EAAW,GAAeA,EAAS,CAAC,MAAM,IAAI,OAAO,IAAI,CAAC,CAAM,CAAC,EAAmB,GAAuBA,EAAS,KAAK,CAAM,CAAC,EAAmB,GAAuBA,EAAS,KAAK,CAAM,CAAC,EAAsB,GAA0BA,EAAS,CAAC,MAAM,IAAI,OAAO,IAAI,CAAC,CAAM,CAAC,EAAU,GAAcA,EAAS,SAAS,CAAC,MAAc,CAAI,GAAgD,KAAK,MAAM,EAAQ,IAAI,CAAC,KAAK,GAAU,EAA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