{"version":3,"file":"DynamicJumpLinksList.CrdEXppw.mjs","names":["useState","useRef"],"sources":["https:/framerusercontent.com/modules/OKrtcD77WoDEREbx9vBX/dmUD71QnAISPaaNKDe0y/DynamicJumpLinksList.js"],"sourcesContent":["import{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import{useEffect,useState,useRef}from\"react\";import{addPropertyControls,ControlType}from\"framer\";// Custom Jump Link component that handles scrolling directly\nfunction JumpLink({listNumber,title,targetId,numberFontFamily,numberFontSize,numberColor,titleFontFamily,titleFontSize,titleLineHeight,titleColor,borderColor}){const handleClick=e=>{e.preventDefault();e.stopPropagation();const targetElement=document.getElementById(targetId);if(targetElement){targetElement.scrollIntoView({behavior:\"smooth\",block:\"start\"});}};return /*#__PURE__*/_jsxs(\"div\",{onClick:handleClick,style:{display:\"grid\",gridTemplateColumns:\"40px 1fr\",gap:\"12px\",padding:\"8px 0\",cursor:\"pointer\",borderBottom:`1px solid ${borderColor||\"#e5e5e5\"}`,alignItems:\"flex-start\",userSelect:\"none\"},children:[/*#__PURE__*/_jsx(\"div\",{style:{width:\"40px\",fontFamily:numberFontFamily||\"JetBrains Mono, monospace\",fontSize:`${numberFontSize||14}px`,color:numberColor||\"#666\"},children:listNumber}),/*#__PURE__*/_jsx(\"div\",{style:{fontFamily:titleFontFamily||\"inherit\",fontSize:`${titleFontSize||14}px`,lineHeight:titleLineHeight||1.5,color:titleColor||\"#333\"},children:title})]});}export default function DynamicJumpLinksList({width=304,height=\"fit-content\",gap=0,numberFontFamily=\"JetBrains Mono, monospace\",numberFontSize=14,numberColor=\"#666\",titleFontFamily=\"inherit\",titleFontSize=14,titleLineHeight=1.5,titleColor=\"#333\",borderColor=\"#e5e5e5\"}){const[jumpLinks,setJumpLinks]=useState([]);const componentRef=useRef(null);useEffect(()=>{const findSiblingSections=()=>{const currentElement=componentRef.current;if(!currentElement)return[];const parentElement=currentElement.parentElement;if(!parentElement)return[];const grandParentElement=parentElement.parentElement;if(!grandParentElement)return[];// Look at siblings of the parent (parent's siblings)\nconst parentSiblings=Array.from(grandParentElement.children).filter(child=>child!==parentElement);const sectionData=[];// Look at immediate children of each parent sibling that have both ID and aria-label\nparentSiblings.forEach(sibling=>{const immediateChildren=Array.from(sibling.children);immediateChildren.forEach(child=>{const element=child;const id=element.id;const ariaLabel=element.getAttribute(\"aria-label\");if(id&&ariaLabel){sectionData.push({id,title:ariaLabel});}});});return sectionData;};const timeoutId=setTimeout(()=>{const sections=findSiblingSections();setJumpLinks(sections);},100);const interval=setInterval(()=>{const newSections=findSiblingSections();setJumpLinks(prev=>{if(JSON.stringify(prev)!==JSON.stringify(newSections)){return newSections;}return prev;});},2e3);return()=>{clearTimeout(timeoutId);clearInterval(interval);};},[]);return /*#__PURE__*/_jsx(\"div\",{ref:componentRef,style:{width:typeof width===\"number\"?`${width}px`:width,height:typeof height===\"number\"?`${height}px`:height,display:\"flex\",flexDirection:\"column\",gap:`${gap}px`},children:jumpLinks.length>0?jumpLinks.map((link,index)=>/*#__PURE__*/_jsx(JumpLink,{listNumber:String(index+1).padStart(2,\"0\"),title:link.title,targetId:link.id,numberFontFamily:numberFontFamily,numberFontSize:numberFontSize,numberColor:numberColor,titleFontFamily:titleFontFamily,titleFontSize:titleFontSize,titleLineHeight:titleLineHeight,titleColor:titleColor,borderColor:borderColor},link.id)):/*#__PURE__*/_jsx(\"div\",{style:{padding:\"16px\",backgroundColor:\"#f5f5f5\",color:\"#666\",textAlign:\"center\",fontSize:\"14px\",borderRadius:\"4px\"},children:\"No jumplinks detected\"})});}addPropertyControls(DynamicJumpLinksList,{gap:{type:ControlType.Number,title:\"Gap\",defaultValue:0,min:0,max:50,step:1},// Number Typography Controls\nnumberFontFamily:{type:ControlType.String,title:\"Number Font Family\",defaultValue:\"JetBrains Mono, monospace\",placeholder:\"JetBrains Mono, monospace\"},numberFontSize:{type:ControlType.Number,title:\"Number Font Size\",defaultValue:14,min:8,max:32,step:1,unit:\"px\"},numberColor:{type:ControlType.Color,title:\"Number Color\",defaultValue:\"#666\"},// Title Typography Controls\ntitleFontFamily:{type:ControlType.String,title:\"Title Font Family\",defaultValue:\"inherit\",placeholder:\"inherit\"},titleFontSize:{type:ControlType.Number,title:\"Title Font Size\",defaultValue:14,min:8,max:32,step:1,unit:\"px\"},titleLineHeight:{type:ControlType.Number,title:\"Title Line Height\",defaultValue:1.5,min:1,max:3,step:.1},titleColor:{type:ControlType.Color,title:\"Title Color\",defaultValue:\"#333\"},// Border Color Control\nborderColor:{type:ControlType.Color,title:\"Border Color\",defaultValue:\"#e5e5e5\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"DynamicJumpLinksList\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./DynamicJumpLinksList.map"],"mappings":"gMACA,SAAS,EAAS,CAAC,aAAW,QAAM,WAAS,mBAAiB,iBAAe,cAAY,kBAAgB,gBAAc,kBAAgB,aAAW,eAAa,CAAyM,OAAoB,EAAM,MAAM,CAAC,QAAvN,GAAG,CAAC,EAAE,gBAAgB,CAAC,EAAE,iBAAiB,CAAC,IAAM,EAAc,SAAS,eAAe,EAAS,CAAI,GAAe,EAAc,eAAe,CAAC,SAAS,SAAS,MAAM,QAAQ,CAAC,EAAyD,MAAM,CAAC,QAAQ,OAAO,oBAAoB,WAAW,IAAI,OAAO,QAAQ,QAAQ,OAAO,UAAU,aAAa,aAAa,GAAa,YAAY,WAAW,aAAa,WAAW,OAAO,CAAC,SAAS,CAAc,EAAK,MAAM,CAAC,MAAM,CAAC,MAAM,OAAO,WAAW,GAAkB,4BAA4B,SAAS,GAAG,GAAgB,GAAG,IAAI,MAAM,GAAa,OAAO,CAAC,SAAS,EAAW,CAAC,CAAc,EAAK,MAAM,CAAC,MAAM,CAAC,WAAW,GAAiB,UAAU,SAAS,GAAG,GAAe,GAAG,IAAI,WAAW,GAAiB,IAAI,MAAM,GA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