{"version":3,"file":"ProjectViewer.Dbgb4x2r.mjs","names":["useRef","useState","__esmMin","le","init_ssg_sandbox_shims","window","_e","de","init_jsx_runtime","J","init_npm_react_18_3_1","ce","withProjectViewer","element","root","list","index","frame","slides","el","counter","previous","next","empty","update","items","text","target","button","image","item","bounds","availableHeight","scale","schedule","move","direction","reduced","click","event","key","scroll","observer","resize","Component","props","value","forwardedRef","withProjectPhotograph","photo","guard","hasProject","overlay","focus","blur","withSelectedReturn","destination","category","link","prepare","init_ProjectViewer"],"sources":["https:/framerusercontent.com/modules/liJzhWNikRoJasp6YRb7/0uR3778l9464qPbnKXfE/ProjectViewer.js"],"sourcesContent":["import{jsx as _jsx}from\"react/jsx-runtime\";import{forwardRef,useEffect,useLayoutEffect,useRef,useState}from\"react\";export function withProjectViewer(Component){return /*#__PURE__*/forwardRef(function ProjectViewer(props,forwardedRef){const element=useRef(null);useLayoutEffect(()=>{const root=element.current;if(!root)return;const list=root.querySelector('[aria-label=\"Project photographs\"]');if(!list)return;let index=0;let frame=0;const slides=()=>Array.from(list.children).filter(el=>el instanceof HTMLElement&&el.tagName===\"FIGURE\");const counter=root.querySelector(\"#project-photo-counter\");const previous=root.querySelector('[aria-label=\"Previous photograph\"]');const next=root.querySelector('[aria-label=\"Next photograph\"]');const empty=root.querySelector('[aria-label=\"No project photographs\"]');const update=()=>{const items=slides();index=Math.max(0,Math.min(index,items.length-1));const text=String(items.length?index+1:0).padStart(2,\"0\")+\" / \"+String(items.length).padStart(2,\"0\");const target=counter?.querySelector(\"p\")||counter;if(target&&target.textContent!==text)target.textContent=text;for(const button of[previous,next]){button?.setAttribute(\"aria-disabled\",String(items.length<2));if(button)button.style.opacity=items.length<2?\"0.35\":\"1\";}if(empty)empty.style.opacity=items.length?\"0\":\"1\";items.forEach(item=>{item.style.flex=\"0 0 100%\";item.style.scrollSnapAlign=\"center\";const image=item.firstElementChild;if(!image)return;image.style.zoom=\"1\";const bounds=image.getBoundingClientRect();if(bounds.width&&bounds.height){// Enlarge as well as shrink the existing native image.\n// Both axes constrain the same scale, preserving its natural ratio.\nconst availableHeight=Math.min(item.clientHeight,window.innerHeight*.78);const scale=Math.min(item.clientWidth/bounds.width,availableHeight/bounds.height);image.style.zoom=String(Math.max(.01,scale));}});};const schedule=()=>{cancelAnimationFrame(frame);frame=requestAnimationFrame(update);};const move=direction=>{const items=slides();if(items.length<2)return;index=(index+direction+items.length)%items.length;const reduced=window.matchMedia(\"(prefers-reduced-motion: reduce)\").matches;list.scrollTo({left:items[index].offsetLeft-items[0].offsetLeft,behavior:reduced?\"auto\":\"smooth\"});update();};const click=event=>{const target=event.target;if(previous?.contains(target))move(-1);if(next?.contains(target))move(1);};const key=event=>{if(!root.getClientRects().length||event.altKey||event.ctrlKey||event.metaKey)return;if(event.target?.closest('input, textarea, select, [contenteditable=\"true\"], [role=\"dialog\"]'))return;if(event.key===\"ArrowLeft\"||event.key===\"ArrowRight\"){event.preventDefault();move(event.key===\"ArrowLeft\"?-1:1);}};const scroll=()=>{const items=slides();if(!items.length)return;index=Math.max(0,Math.min(items.length-1,Math.round(list.scrollLeft/Math.max(1,list.clientWidth))));schedule();};list.style.scrollSnapType=\"x mandatory\";list.style.scrollbarWidth=\"none\";root.addEventListener(\"click\",click);root.addEventListener(\"load\",schedule,true);list.addEventListener(\"scroll\",scroll,{passive:true});window.addEventListener(\"keydown\",key);const observer=new MutationObserver(schedule);observer.observe(list,{childList:true,subtree:true});const resize=new ResizeObserver(()=>{schedule();const items=slides();if(items[index])list.scrollLeft=items[index].offsetLeft-items[0].offsetLeft;});resize.observe(list);update();return()=>{cancelAnimationFrame(frame);observer.disconnect();resize.disconnect();root.removeEventListener(\"click\",click);root.removeEventListener(\"load\",schedule,true);list.removeEventListener(\"scroll\",scroll);window.removeEventListener(\"keydown\",key);};},[]);return /*#__PURE__*/_jsx(Component,{...props,ref:value=>{element.current=value;if(typeof forwardedRef===\"function\")forwardedRef(value);else if(forwardedRef)forwardedRef.current=value;},style:{...props.style}});});}export function withProjectPhotograph(Component){return /*#__PURE__*/forwardRef(function ProjectPhotograph(props,forwardedRef){const element=useRef(null);useEffect(()=>{const photo=element.current;if(!photo)return;const guard=()=>{const hasProject=Boolean(photo.getAttribute(\"aria-description\")?.trim());if(!hasProject&&photo.hasAttribute(\"href\"))photo.removeAttribute(\"href\");if(!hasProject)photo.style.cursor=\"default\";};guard();const observer=new MutationObserver(guard);observer.observe(photo,{attributes:true,attributeFilter:[\"href\",\"aria-description\"]});const overlay=photo.querySelector('[data-framer-name=\"Project hover overlay\"]');const focus=()=>{if(overlay)overlay.style.opacity=\"1\";};const blur=()=>{if(overlay)overlay.style.opacity=\"0\";};photo.addEventListener(\"focusin\",focus);photo.addEventListener(\"focusout\",blur);return()=>{observer.disconnect();photo.removeEventListener(\"focusin\",focus);photo.removeEventListener(\"focusout\",blur);};},[]);return /*#__PURE__*/_jsx(Component,{...props,ref:value=>{element.current=value;if(typeof forwardedRef===\"function\")forwardedRef(value);else if(forwardedRef)forwardedRef.current=value;},style:{...props.style}});});}export function withSelectedReturn(Component){return /*#__PURE__*/forwardRef(function SelectedReturn(props,forwardedRef){const element=useRef(null);const[destination]=useState(()=>{try{const category=sessionStorage.getItem(\"portfolio-return-category\");return category===\"People\"?\"/people\":category===\"Food\"?\"/food\":\"/\";}catch{return\"/\";}});useEffect(()=>{const link=element.current;const prepare=event=>{if(event.button!==0||event.metaKey||event.ctrlKey||event.shiftKey||event.altKey)return;try{const category=sessionStorage.getItem(\"portfolio-return-category\")||\"Selected\";sessionStorage.setItem(\"restoreSelectedOnReturn\",String(category===\"Selected\"));sessionStorage.setItem(\"portfolio-pending-category\",category);sessionStorage.setItem(\"portfolio-internal-gallery-return\",\"true\");}catch{}};link?.addEventListener(\"click\",prepare,true);return()=>link?.removeEventListener(\"click\",prepare,true);},[]);return /*#__PURE__*/_jsx(Component,{...props,href:destination,ref:value=>{element.current=value;if(typeof forwardedRef===\"function\")forwardedRef(value);else if(forwardedRef)forwardedRef.current=value;}});});}\nexport const __FramerMetadata__ = {\"exports\":{\"withProjectViewer\":{\"type\":\"reactHoc\",\"name\":\"withProjectViewer\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withProjectPhotograph\":{\"type\":\"reactHoc\",\"name\":\"withProjectPhotograph\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withSelectedReturn\":{\"type\":\"reactHoc\",\"name\":\"withSelectedReturn\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./ProjectViewer.map"],"mappings":"A,4JAAmH,SAAgBY,EAAkB,EAAU,CAAC,MAAoB,gBAAW,SAAuB,EAAM,EAAa,CAAC,IAAMC,EAAQb,EAAO,IAAI,EAE0sD,OAFxsDG,MAAoB,CAAC,IAAMW,EAAKD,EAAQ,QAAQ,GAAG,CAACC,EAAK,OAAO,IAAMC,EAAKD,EAAK,cAAc,oCAAoC,EAAE,GAAG,CAACC,EAAK,OAAO,IAAIC,EAAM,EAAMC,EAAM,EAAQC,MAAW,MAAM,KAAKH,EAAK,QAAQ,CAAC,CAAC,OAAO,GAAII,aAAc,aAAaA,EAAG,UAAU,QAAQ,EAAQC,EAAQN,EAAK,cAAc,wBAAwB,EAAQO,EAASP,EAAK,cAAc,oCAAoC,EAAQQ,EAAKR,EAAK,cAAc,gCAAgC,EAAQS,EAAMT,EAAK,cAAc,uCAAuC,EAAQU,MAAW,CAAC,IAAMC,EAAMP,EAAO,EAAE,EAAM,KAAK,IAAI,EAAE,KAAK,IAAIF,EAAMS,EAAM,OAAO,CAAC,CAAC,EAAE,IAAMC,EAAK,OAAOD,EAAM,OAAOT,EAAM,EAAE,CAAC,CAAC,CAAC,SAAS,EAAE,GAAG,EAAE,MAAM,OAAOS,EAAM,MAAM,CAAC,CAAC,SAAS,EAAE,GAAG,EAAQE,EAAOP,GAAS,cAAc,GAAG,GAAGA,EAAWO,GAAQA,EAAO,cAAcD,IAAK,EAAO,YAAYA,GAAK,IAAI,I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