{"version":3,"file":"RedirectTo.Dbnwp8fb.mjs","names":["useState"],"sources":["https:/framerusercontent.com/modules/U5Zmbyf4BWoq5QttpiPL/akPhpxXeZYOgsZILoIyY/RedirectTo.js"],"sourcesContent":["import{jsx as _jsx}from\"react/jsx-runtime\";import{forwardRef,useState,useEffect}from\"react\";const STAGING_ORIGIN_MAP=[{match:\"staging.sports.aparentmedia.com\",origin:\"https://streaming.staging.sports.aparentmedia.com\"},{match:\"dev01.apmc.io\",origin:\"https://web-streaming-origin.dev01.apmc.io\"}];function getMatchingOrigin(){if(typeof window===\"undefined\")return null;const host=window.location.hostname;const match=STAGING_ORIGIN_MAP.find(({match})=>host.includes(match));return match?.origin??null;}export function withCustomLink(Component){return /*#__PURE__*/forwardRef((props,ref)=>{const[url,setUrl]=useState(null);useEffect(()=>{if(!props.link){setUrl(null);return;}try{const originalUrl=new URL(props.link);let finalUrl=originalUrl.toString();const origin=getMatchingOrigin();if(origin){const newUrl=new URL(originalUrl.pathname+originalUrl.search+originalUrl.hash,origin);finalUrl=newUrl.toString();}setUrl(finalUrl);}catch{console.error(\"Invalid URL:\",props.link);setUrl(props.link);}},[props.link]);if(!url)return null;return /*#__PURE__*/_jsx(Component,{...props,ref:ref,href:url,link:url,target:\"_blank\"});});}\nexport const __FramerMetadata__ = {\"exports\":{\"withCustomLink\":{\"type\":\"reactHoc\",\"name\":\"withCustomLink\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./RedirectTo.map"],"mappings":"yIAAwS,SAAS,GAAmB,CAAC,GAAU,IAAS,OAAY,OAAO,KAAK,IAAM,EAAK,EAAO,SAAS,SAA8E,OAAzD,EAAmB,MAAM,CAAC,WAAS,EAAK,SAAS,EAAM,CAAC,EAAe,QAAQ,KAAM,SAAgB,EAAe,EAAU,CAAC,OAAoB,GAAY,EAAM,IAAM,CAAC,GAAK,CAAC,EAAI,GAAQA,EAAS,KAAK,CAA0Z,OAAzZ,MAAc,CAAC,GAAG,CAAC,EAAM,KAAK,CAAC,EAAO,KAAK,CAAC,OAAQ,GAAG,CAAC,IAAM,EAAY,IAAI,IAAI,EAAM,KAAK,CAAK,EAAS,EAAY,UAAU,CAAO,EAAO,GAAmB,CAAI,IAA8F,EAAzE,IAAI,IAAI,EAAY,SAAS,EAAY,OAAO,EAAY,KAAK,EAAO,CAAiB,UAAU,EAAE,EAAO,EAAS,MAAO,CAAC,QAAQ,MAAM,eAAe,EAAM,KAAK,CAAC,EAAO,EAAM,KAAK,GAAI,CAAC,EAAM,KAAK,CAAC,CAAK,EAAoC,EAAK,EAAU,CAAC,GAAG,EAAU,MAAI,KAAK,EAAI,KAAK,EAAI,OAAO,SAAS,CAAC,CAA7F,MAAgG,wBAAtjC,IAAiD,CAAM,EAAmB,CAAC,CAAC,MAAM,kCAAkC,OAAO,oDAAoD,CAAC,CAAC,MAAM,gBAAgB,OAAO,6CAA6C,CAAC"}