{"version":3,"file":"CalsupPageAnchor.CuaJwusv.mjs","names":["React.useRef","__esmMin","init_ssg_sandbox_shims","init_npm_react_18_3_1","c","init_jsx_runtime","ce","de","window","init_framer_D6uXRwWs","addPropertyControls","ControlType","PageAnchor","markerRef","marker","targetId","anchor","scroll","navigate","event","hash","frame","node","targets","style","target","label","init_CalsupPageAnchor"],"sources":["https:/framerusercontent.com/modules/OyLDBBHY9Qhn5adVwkIU/Ixp8VP6X5yDA85DZkJpp/CalsupPageAnchor.js"],"sourcesContent":["import{jsx as _jsx}from\"react/jsx-runtime\";import*as React from\"react\";import{addPropertyControls,ControlType}from\"framer\";const targets=new Map;/**\n * @framerSupportedLayoutWidth any-prefer-fixed\n * @framerSupportedLayoutHeight auto\n */export default function PageAnchor({anchor=\"section\",label=\"使い方\",marker=false,style}){const markerRef=React.useRef(null);React.useEffect(()=>{if(!marker)return;const targetId=`calsup-${anchor}`;const scroll=()=>markerRef.current?.scrollIntoView({block:\"start\",behavior:\"instant\"});const navigate=event=>{if(event.detail===targetId&&markerRef.current){event.preventDefault();scroll();}};const hash=()=>{if(window.location.hash===`#${targetId}`)scroll();};window.addEventListener(\"calsup-toc-navigate\",navigate);window.addEventListener(\"hashchange\",hash);window.addEventListener(\"popstate\",hash);const frame=window.requestAnimationFrame(hash);return()=>{window.cancelAnimationFrame(frame);window.removeEventListener(\"calsup-toc-navigate\",navigate);window.removeEventListener(\"hashchange\",hash);window.removeEventListener(\"popstate\",hash);};},[anchor,marker]);if(marker)return /*#__PURE__*/_jsx(\"div\",{ref:node=>{markerRef.current=node;if(node)targets.set(anchor,node);else targets.delete(anchor);},id:`calsup-${anchor}`,\"aria-hidden\":\"true\",style:{...style,position:\"relative\",width:1,height:1,scrollMarginTop:106}});return /*#__PURE__*/_jsx(\"a\",{href:`#calsup-${anchor}`,onClick:event=>{const target=targets.get(anchor);if(target){event.preventDefault();event.stopPropagation();target.scrollIntoView({block:\"start\",behavior:\"auto\"});}},style:{...style,position:\"relative\",display:\"block\",width:\"100%\",height:\"auto\",fontFamily:'\"IBM Plex Sans JP\", sans-serif',fontSize:16,fontWeight:400,lineHeight:1.6,color:\"var(--token-075a427a-f144-4687-85f5-89ff7789fff2, #946d48)\",textDecoration:\"none\"},children:label});}addPropertyControls(PageAnchor,{anchor:{type:ControlType.String,title:\"Anchor\",defaultValue:\"section\"},label:{type:ControlType.String,title:\"Label\",defaultValue:\"使い方\"},marker:{type:ControlType.Boolean,title:\"Target\",defaultValue:false}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"PageAnchor\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\",\"framerSupportedLayoutHeight\":\"auto\",\"framerSupportedLayoutWidth\":\"any-prefer-fixed\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./CalsupPageAnchor.map"],"mappings":"A,+LAGG,SAAwBY,EAAW,CAAC,SAAO,UAAU,QAAM,MAAM,SAAO,GAAM,SAAO,CAAC,IAAMC,EAAUb,EAAa,IAAI,EAAo+B,OAAl+BM,MAAoB,CAAC,GAAG,CAACQ,EAAO,OAAO,IAAMC,EAAS,UAAUC,IAAeC,MAAWJ,EAAU,SAAS,eAAe,CAAC,MAAM,QAAQ,SAAS,SAAS,CAAC,EAAQK,EAAS,GAAO,CAAIC,EAAM,SAASJ,GAAUF,EAAU,UAASM,EAAM,eAAe,EAAEF,EAAO,EAAG,EAAQG,MAAS,CAAIZ,EAAO,SAAS,OAAO,IAAIO,KAAWE,EAAO,CAAE,EAAET,EAAO,iBAAiB,sBAAsBU,CAAQ,EAAEV,EAAO,iBAAiB,aAAaY,CAAI,EAAEZ,EAAO,iBAAiB,WAAWY,CAAI,EAAE,IAAMC,EAAMb,EAAO,sBAAsBY,CAAI,EAAE,UAAU,CAACZ,EAAO,qBAAqBa,CAAK,EAAEb,EAAO,oBAAoB,sBAAsBU,CAAQ,EAAEV,EAAO,oBAAoB,aAAaY,CAAI,EAAEZ,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