{"version":3,"file":"DiaryContents_1.Co5fBK3d.mjs","names":["React.useRef","React.useState"],"sources":["https:/framerusercontent.com/modules/uuYbHpNgi4s8nDJEOykZ/QItKf992OSo4ZUZKAk9Q/DiaryContents_1.js"],"sourcesContent":["import{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import*as React from\"react\";export function withArticleContents(Component){return function ArticleContents(props){const body=React.useRef(null);const[headings,setHeadings]=React.useState([]);React.useEffect(()=>{const root=body.current;if(!root)return;const read=()=>{const next=Array.from(root.querySelectorAll(\"h2,h3\")).map(node=>({node,text:node.textContent||\"\",level:node.tagName})).filter(h=>h.text.trim());setHeadings(old=>old.length===next.length&&old.every((h,i)=>h.node===next[i].node&&h.text===next[i].text)?old:next);};read();const observer=new MutationObserver(read);observer.observe(root,{childList:true,subtree:true,characterData:true});return()=>observer.disconnect();},[]);return /*#__PURE__*/_jsxs(\"div\",{className:\"nms-article-contents\",style:{width:\"100%\",position:\"relative\",...props.style},children:[/*#__PURE__*/_jsx(\"style\",{children:`.nms-article-contents h2,.nms-article-contents h3{scroll-margin-top:100px}.nms-article-contents .toc-button{display:block;border:0;background:none;text-align:left;color:#014539;font:inherit;font-size:15px;line-height:1.6;cursor:pointer;padding:7px 0}.nms-article-contents .toc-button:hover{text-decoration:underline}.nms-article-contents .toc-button:focus-visible{outline:2px solid #008f79;outline-offset:3px}`}),headings.length>0&&/*#__PURE__*/_jsxs(\"nav\",{\"aria-label\":\"게시글 목차\",style:{background:\"#f3f7f5\",borderLeft:\"3px solid #008f79\",padding:\"20px 24px\",marginBottom:32,fontFamily:\"Pretendard,sans-serif\"},children:[/*#__PURE__*/_jsx(\"strong\",{style:{display:\"block\",fontSize:16,color:\"#021c19\",marginBottom:8},children:\"이 글의 목차\"}),headings.map((h,i)=>/*#__PURE__*/_jsxs(\"button\",{className:\"toc-button\",type:\"button\",style:{paddingLeft:h.level===\"H3\"?16:0},onClick:()=>h.node.scrollIntoView({behavior:window.matchMedia(\"(prefers-reduced-motion: reduce)\").matches?\"auto\":\"smooth\",block:\"start\"}),children:[i+1,\". \",h.text]},i))]}),/*#__PURE__*/_jsx(\"div\",{ref:body,children:/*#__PURE__*/_jsx(Component,{...props,style:{...props.style,width:\"100%\",height:\"auto\"}})})]});};}\nexport const __FramerMetadata__ = {\"exports\":{\"withArticleContents\":{\"type\":\"reactHoc\",\"name\":\"withArticleContents\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./DiaryContents_1.map"],"mappings":"qJAAqF,SAAgB,EAAoB,EAAU,CAAC,OAAO,SAAyB,EAAM,CAAC,IAAM,EAAKA,EAAa,IAAI,EAAO,CAAC,EAAS,GAAaC,EAAe,CAAC,CAAC,EAAof,OAAlf,MAAoB,CAAC,IAAM,EAAK,EAAK,QAAQ,GAAG,CAAC,EAAK,OAAO,IAAM,MAAS,CAAC,IAAM,EAAK,MAAM,KAAK,EAAK,iBAAiB,OAAO,CAAC,CAAC,CAAC,IAAI,IAAO,CAAC,OAAK,KAAK,EAAK,aAAa,GAAG,MAAM,EAAK,OAAO,EAAE,CAAC,CAAC,OAAO,GAAG,EAAE,KAAK,KAAK,CAAC,EAAE,EAAY,GAAK,EAAI,SAAS,EAAK,QAAQ,EAAI,OAAO,EAAE,IAAI,EAAE,OAAO,EAAK,EAAE,CAAC,MAAM,EAAE,OAAO,EAAK,EAAE,CAAC,IAAI,EAAE,EAAI,CAAI,CAAE,EAAE,EAAK,EAAE,IAAM,EAAS,IAAI,iBAAiB,CAAI,EAA0E,OAAxE,EAAS,QAAQ,EAAK,CAAC,UAAU,GAAK,QAAQ,GAAK,cAAc,EAAI,CAAC,MAAY,EAAS,WAAW,CAAE,EAAE,CAAC,CAAC,EAAsB,EAAM,MAAM,CAAC,UAAU,uBAAuB,MAAM,CAAC,MAAM,OAAO,SAAS,WAAW,GAAG,EAAM,KAAK,EAAE,SAAS,CAAc,EAAK,QAAQ,CAAC,SAAS,2Z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