{"version":3,"file":"ViewedProjects.DtB4I4cT.mjs","names":["__esmMin","init_npm_react_18_3_1","init_ssg_sandbox_shims","window","c","J","init_jsx_runtime","ce","init_framer_DKtAEkcX","RenderTarget","path","value","read","v","key","x","record","p","old","event","withProjectVisit","isFeaturedCard","props","Component","a","init_ViewedProjects"],"sources":["https:/framerusercontent.com/modules/nxtiUI58GjbMpZupO5rx/SouvxuHtFztJ0mM9I9xq/ViewedProjects.js"],"sourcesContent":["import{jsx as _jsx}from\"react/jsx-runtime\";import{forwardRef,useEffect,useRef}from\"react\";import{RenderTarget}from\"framer\";const key=\"emma-viewed-projects-v1\";const event=\"emma-project-viewed\";function path(value){try{return new URL(value,window.location.origin).pathname.replace(/\\/$/,\"\")||\"/\";}catch{return\"\";}}function read(){try{const v=JSON.parse(localStorage.getItem(key)||\"[]\");return Array.isArray(v)?v.filter(x=>typeof x===\"string\"):[];}catch{return[];}}function record(value){const p=path(value);if(!p||[\"/\",\"/works\",\"/about\",\"/resume\",\"/contact\",\"/404\"].includes(p))return;try{const old=read();if(!old.includes(p)){localStorage.setItem(key,JSON.stringify([...old,p]));window.dispatchEvent(new Event(event));}}catch{}}export function withProjectVisit(Component){return /*#__PURE__*/forwardRef(function ProjectVisit(props,ref){useEffect(()=>{if(RenderTarget.current()===RenderTarget.canvas)return;record(window.location.href);},[]);const isFeaturedCard=props[\"data-framer-name\"]===\"Project card — editable image, tags & details\";return /*#__PURE__*/_jsx(Component,{...props,ref:ref,...isFeaturedCard?{style:{...props.style,filter:\"grayscale(1)\"},animate:{...typeof props.animate===\"object\"?props.animate:{},filter:\"grayscale(1)\"},whileHover:{...typeof props.whileHover===\"object\"?props.whileHover:{},filter:\"grayscale(0)\"},whileFocus:{...typeof props.whileFocus===\"object\"?props.whileFocus:{},filter:\"grayscale(0)\"},transition:{...props.transition,filter:{duration:.25}}}:{},onClickCapture:e=>{props.onClickCapture?.(e);const a=e.target.closest?.(\"a[href]\");if(a&&new URL(a.href,location.origin).origin===location.origin)record(a.href);}});});}export function withViewedProjectList(Component){return /*#__PURE__*/forwardRef(function ViewedProjectList(props,forwardedRef){const root=useRef(null);useEffect(()=>{if(RenderTarget.current()===RenderTarget.canvas||!root.current)return;const sheet=document.createElement(\"style\");sheet.textContent='[data-project-viewed] [data-framer-name=\"Viewed badge — shown after visiting\"], [data-project-viewed] [id^=\"viewed-project-badge-\"] { opacity: 0 !important; pointer-events: none !important; } [data-project-viewed=\"true\"] [data-framer-name=\"Viewed badge — shown after visiting\"], [data-project-viewed=\"true\"] [id^=\"viewed-project-badge-\"] { opacity: 1 !important; }';document.head.appendChild(sheet);const update=()=>{const viewed=read();Array.from(root.current?.children||[]).forEach((child,i)=>{const a=child.matches(\"a[href]\")?child:child.querySelector(\"a[href]\");const href=a?.getAttribute(\"href\");const index=href?viewed.indexOf(path(href)):-1;child.style.order=index<0?String(i):String(1e3+index);child.setAttribute(\"data-project-viewed\",index<0?\"false\":\"true\");});};update();window.addEventListener(event,update);window.addEventListener(\"storage\",update);window.addEventListener(\"pageshow\",update);return()=>{sheet.remove();window.removeEventListener(event,update);window.removeEventListener(\"storage\",update);window.removeEventListener(\"pageshow\",update);};},[]);return /*#__PURE__*/_jsx(Component,{...props,ref:el=>{root.current=el;if(typeof forwardedRef===\"function\")forwardedRef(el);else if(forwardedRef)forwardedRef.current=el;},onClickCapture:e=>{props.onClickCapture?.(e);const a=e.target.closest?.(\"a[href]\");if(a&&new URL(a.href,location.origin).origin===location.origin)record(a.href);}});});}\nexport const __FramerMetadata__ = {\"exports\":{\"withProjectVisit\":{\"type\":\"reactHoc\",\"name\":\"withProjectVisit\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withViewedProjectList\":{\"type\":\"reactHoc\",\"name\":\"withViewedProjectList\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./ViewedProjects.map"],"mappings":"A,yLAAiM,SAASU,EAAK,EAAM,CAAC,GAAG,CAAC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