{"version":3,"file":"Line.BQLcA2mC.mjs","names":["useRef","useState"],"sources":["https:/framerusercontent.com/modules/cSWoV6fG8xXHSyq91Wez/neOlgUs1iQeSGUjOwkeM/Line.js"],"sourcesContent":["import{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import{useRef,useState,useEffect}from\"react\";import{addPropertyControls,ControlType}from\"framer\";/**\n * Animated Dashed Line\n *\n * A resizable connector line with a moving dash pattern.\n * Resize the frame's width to change length; rotate the frame\n * on canvas to angle it. Add arrowheads to either end.\n *\n * @framerSupportedLayoutWidth any\n * @framerSupportedLayoutHeight any\n * @framerIntrinsicWidth 200\n * @framerIntrinsicHeight 24\n */export default function AnimatedDashedLine(props){const{strokeColor,strokeWidth,dashLength,gapLength,speed,direction,startArrow,endArrow,arrowSize,lineCap}=props;const containerRef=useRef(null);const[size,setSize]=useState({width:200,height:24});const uid=useRef(\"adl-\"+Math.random().toString(36).slice(2,10)).current;useEffect(()=>{const el=containerRef.current;if(!el)return;const observer=new ResizeObserver(entries=>{for(const entry of entries){const{width,height}=entry.contentRect;setSize({width:Math.max(width,1),height:Math.max(height,1)});}});observer.observe(el);return()=>observer.disconnect();},[]);const{width,height}=size;const cy=height/2;// Leave room for arrowheads so the line doesn't poke through the tip\nconst inset=1;const arrowInsetStart=startArrow?arrowSize*.9:inset;const arrowInsetEnd=endArrow?arrowSize*.9:inset;const x1=arrowInsetStart;const x2=Math.max(width-arrowInsetEnd,x1+1);const dashCycle=Math.max(dashLength+gapLength,1);const duration=speed>0?dashCycle/speed:0;const animationDirection=direction===\"reverse\"?\"reverse\":\"normal\";const markerIdStart=`${uid}-arrow-start`;const markerIdEnd=`${uid}-arrow-end`;const keyframeName=`${uid}-dashmove`;return /*#__PURE__*/_jsxs(\"div\",{ref:containerRef,style:{width:\"100%\",height:\"100%\",position:\"relative\"},children:[/*#__PURE__*/_jsx(\"style\",{children:`\n                @keyframes ${keyframeName} {\n                    from { stroke-dashoffset: 0; }\n                    to { stroke-dashoffset: -${dashCycle}; }\n                }\n                `}),/*#__PURE__*/_jsxs(\"svg\",{width:width,height:height,viewBox:`0 0 ${width} ${height}`,style:{display:\"block\",overflow:\"visible\"},children:[/*#__PURE__*/_jsxs(\"defs\",{children:[/*#__PURE__*/_jsx(\"marker\",{id:markerIdStart,viewBox:\"0 0 10 10\",refX:\"8\",refY:\"5\",markerWidth:arrowSize,markerHeight:arrowSize,orient:\"auto-start-reverse\",children:/*#__PURE__*/_jsx(\"path\",{d:\"M0,0 L10,5 L0,10 z\",fill:strokeColor})}),/*#__PURE__*/_jsx(\"marker\",{id:markerIdEnd,viewBox:\"0 0 10 10\",refX:\"8\",refY:\"5\",markerWidth:arrowSize,markerHeight:arrowSize,orient:\"auto\",children:/*#__PURE__*/_jsx(\"path\",{d:\"M0,0 L10,5 L0,10 z\",fill:strokeColor})})]}),/*#__PURE__*/_jsx(\"line\",{x1:x1,y1:cy,x2:x2,y2:cy,stroke:strokeColor,strokeWidth:strokeWidth,strokeLinecap:lineCap,strokeDasharray:`${dashLength} ${gapLength}`,markerStart:startArrow?`url(#${markerIdStart})`:undefined,markerEnd:endArrow?`url(#${markerIdEnd})`:undefined,style:duration>0?{animationName:keyframeName,animationDuration:`${duration}s`,animationTimingFunction:\"linear\",animationIterationCount:\"infinite\",animationDirection:animationDirection}:undefined})]})]});}AnimatedDashedLine.defaultProps={strokeColor:\"#0099FF\",strokeWidth:2,dashLength:8,gapLength:6,speed:60,direction:\"forward\",startArrow:false,endArrow:true,arrowSize:10,lineCap:\"round\"};addPropertyControls(AnimatedDashedLine,{strokeColor:{type:ControlType.Color,title:\"Color\",defaultValue:\"#0099FF\"},strokeWidth:{type:ControlType.Number,title:\"Stroke Width\",defaultValue:2,min:1,max:50,step:1},dashLength:{type:ControlType.Number,title:\"Dash Size\",defaultValue:8,min:1,max:200,step:1},gapLength:{type:ControlType.Number,title:\"Gap Size\",defaultValue:6,min:0,max:200,step:1},speed:{type:ControlType.Number,title:\"Speed\",defaultValue:60,min:0,max:1e3,step:1,description:\"Pixels per second, 0 = static\"},direction:{type:ControlType.Enum,title:\"Direction\",options:[\"forward\",\"reverse\"],optionTitles:[\"Forward\",\"Reverse\"],defaultValue:\"forward\",displaySegmentedControl:true},lineCap:{type:ControlType.Enum,title:\"Dash Cap\",options:[\"butt\",\"round\",\"square\"],optionTitles:[\"Flat\",\"Round\",\"Square\"],defaultValue:\"round\",displaySegmentedControl:true},startArrow:{type:ControlType.Boolean,title:\"Start Arrow\",defaultValue:false},endArrow:{type:ControlType.Boolean,title:\"End Arrow\",defaultValue:true},arrowSize:{type:ControlType.Number,title:\"Arrow Size\",defaultValue:10,min:4,max:60,step:1,hidden:props=>!props.startArrow&&!props.endArrow}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"AnimatedDashedLine\",\"slots\":[],\"annotations\":{\"framerSupportedLayoutHeight\":\"any\",\"framerIntrinsicHeight\":\"24\",\"framerSupportedLayoutWidth\":\"any\",\"framerIntrinsicWidth\":\"200\",\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./Line.map"],"mappings":"+LAWG,SAAwB,EAAmB,EAAM,CAAC,GAAK,CAAC,cAAY,cAAY,aAAW,YAAU,QAAM,YAAU,aAAW,WAAS,YAAU,WAAS,EAAY,EAAaA,EAAO,IAAI,EAAO,CAAC,EAAK,GAASC,EAAS,CAAC,MAAM,IAAI,OAAO,EAAE,CAAC,EAAQ,EAAID,EAAO,OAAO,KAAK,OAAO,CAAC,CAAC,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,CAAC,QAAQ,MAAc,CAAC,IAAM,EAAG,EAAa,QAAQ,GAAG,CAAC,EAAG,OAAO,IAAM,EAAS,IAAI,eAAe,GAAS,CAAC,IAAI,IAAM,KAAS,EAAQ,CAAC,GAAK,CAAC,QAAM,UAAQ,EAAM,YAAY,EAAQ,CAAC,MAAM,KAAK,I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