{"version":3,"file":"ProjectExcerpt.DURg2Umy.mjs","names":["React.useRef","React.useCallback"],"sources":["https:/framerusercontent.com/modules/1Wo5K9Fztj3MmiCF5JLw/SvMZIO7lUTLGoSyWjGpI/ProjectExcerpt.js"],"sourcesContent":["import{jsx as _jsx}from\"react/jsx-runtime\";import*as React from\"react\";/** Native text is retained so Framer's text styles and CMS binding stay live. */export function withProjectExcerpt(Component){return withReadMore(Component,236);}/** About page: the studio text always stays open on every width. */export function withStudioMore(Component){return withReadMore(Component,116,\"all\");}function withReadMore(Component,limit,openQuery){return /*#__PURE__*/React.forwardRef(function ProjectExcerpt(props,forwardedRef){const root=React.useRef(null);// This new wrapper uses its CMS-bound label as configuration only.\nconst moreLabel=String(props[\"aria-label\"]||props.ariaLabel||\"More\");const setRef=React.useCallback(node=>{root.current=node;if(typeof forwardedRef===\"function\")forwardedRef(node);else if(forwardedRef)forwardedRef.current=node;},[forwardedRef]);React.useEffect(()=>{const host=root.current;if(!host)return;let records=[];let hiddenBlocks=[];let suffix=null;let expanded=false;let content=\"\";let removeClick=()=>{};const observer=new MutationObserver(()=>rebuild());const watch=()=>observer.observe(host,{childList:true,subtree:true,characterData:true});const restore=()=>{for(const record of records){// Never overwrite a value Framer/CMS changed since our last write.\nif(record.node.data===record.shortened)record.node.data=record.original;}records=[];for(const block of hiddenBlocks)block.node.style.display=block.display;hiddenBlocks=[];removeClick();suffix?.remove();suffix=null;};const rebuild=()=>{observer.disconnect();restore();const selector=\"p, h1, h2, h3, h4, h5, h6, li\";const blocks=Array.from(host.querySelectorAll(selector)).filter(block=>!block.querySelector(selector));if(!blocks.length){watch();return;}const blockNodes=blocks.map(block=>{const walker=document.createTreeWalker(block,NodeFilter.SHOW_TEXT);const nodes=[];let current;while(current=walker.nextNode())nodes.push(current);return nodes;});// Preserve rich-text paragraphs; their separating blank line counts as two characters.\nconst fullText=blockNodes.map(nodes=>nodes.map(node=>node.data).join(\"\")).join(\"\\n\\n\");if(fullText!==content){content=fullText;expanded=false;}if(openMedia&&openMedia.matches){watch();return;}if(expanded||Array.from(fullText).length<=limit){watch();return;}let remaining=limit;let paragraph=blocks[0];blockNodes.forEach((nodes,index)=>{if(index>0)remaining=Math.max(0,remaining-2);if(remaining===0){hiddenBlocks.push({node:blocks[index],display:blocks[index].style.display});blocks[index].style.display=\"none\";}else{paragraph=blocks[index];}for(const node of nodes){const original=node.data;const points=Array.from(original);const shortened=points.slice(0,remaining).join(\"\");remaining=Math.max(0,remaining-points.length);node.data=shortened;records.push({node,original,shortened});}});suffix=document.createElement(\"span\");suffix.dataset.excerptSuffix=\"\";const button=document.createElement(\"button\");button.type=\"button\";button.textContent=moreLabel;button.setAttribute(\"aria-expanded\",\"false\");button.dataset.excerptMore=\"\";Object.assign(button.style,{display:\"inline\",appearance:\"none\",background:\"none\",border:\"0\",padding:\"0\",margin:\"0\",font:\"inherit\",color:\"inherit\",letterSpacing:\"inherit\",lineHeight:\"inherit\",textTransform:\"inherit\",textDecorationLine:\"underline\",textUnderlineOffset:\"0.14em\",textDecorationThickness:\"1px\",cursor:\"pointer\",verticalAlign:\"baseline\"});const expand=()=>{observer.disconnect();expanded=true;const shouldMoveFocus=document.activeElement===button;restore();if(shouldMoveFocus){const previousTabIndex=paragraph.getAttribute(\"tabindex\");paragraph.tabIndex=-1;paragraph.focus({preventScroll:true});if(previousTabIndex===null)paragraph.removeAttribute(\"tabindex\");else paragraph.setAttribute(\"tabindex\",previousTabIndex);}watch();};button.addEventListener(\"click\",expand);removeClick=()=>button.removeEventListener(\"click\",expand);suffix.append(document.createTextNode(\"… \"),button);paragraph.append(suffix);watch();};const openMedia=openQuery&&typeof window!==\"undefined\"&&window.matchMedia?window.matchMedia(openQuery):null;const onMedia=()=>rebuild();openMedia?.addEventListener(\"change\",onMedia);rebuild();return()=>{observer.disconnect();openMedia?.removeEventListener(\"change\",onMedia);restore();};},[moreLabel,openQuery]);return /*#__PURE__*/_jsx(Component,{...props,ref:setRef,\"aria-label\":undefined,ariaLabel:undefined});});}\nexport const __FramerMetadata__ = {\"exports\":{\"withProjectExcerpt\":{\"type\":\"reactHoc\",\"name\":\"withProjectExcerpt\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withStudioMore\":{\"type\":\"reactHoc\",\"name\":\"withStudioMore\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./ProjectExcerpt.map"],"mappings":"gJAAwJ,SAAgB,EAAmB,EAAU,CAAC,OAAO,EAAa,EAAU,GAAG,CAAE,CAAqE,SAAgB,EAAe,EAAU,CAAC,OAAO,EAAa,EAAU,IAAI,KAAK,CAAE,CAAC,SAAS,EAAa,EAAU,EAAM,EAAU,CAAC,OAAoB,EAAiB,SAAwB,EAAM,EAAa,CAAC,IAAM,EAAKA,EAAa,IAAI,EAC1hB,EAAU,OAAO,EAAM,eAAe,EAAM,WAAW,MAAM,EAAQ,EAAOC,EAAkB,GAAM,CAAC,EAAK,QAAQ,EAAQ,OAAO,GAAe,WAAW,EAAa,CAAI,EAAU,IAAa,EAAa,QAAQ,EAAK,EAAE,CAAC,CAAY,CAAC,EAEm+D,OAFj+D,MAAoB,CAAC,IAAM,EAAK,EAAK,QAAQ,GAAG,CAAC,EAAK,OAAO,IAAI,EAAQ,CAAC,EAAM,EAAa,CAAC,EAAM,EAAO,KAAS,EAAS,GAAU,EAAQ,GAAO,MAAgB,CAAC,EAAQ,EAAS,IAAI,qBAAqB,EAAQ,CAAC,EAAQ,MAAU,EAAS,QAAQ,EAAK,CAAC,UAAU,GAAK,QAAQ,GAAK,cAAc,EAAI,CAAC,EAAQ,MAAY,CAAC,IAAI,IAAM,KAAU,EAC7kB,EAAO,KAAK,OAAO,EAAO,YAAU,EAAO,KAAK,KAAK,EAAO,UAAU,EAAQ,CAAC,EAAE,IAAI,IAAM,KAAS,EAAa,EAAM,KAAK,MAAM,QAAQ,EAAM,QAAQ,EAAa,CAAC,EAAE,EAAY,EAAE,GAAQ,OAAO,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