{
  "version": 3,
  "sources": ["ssg:https://framerusercontent.com/modules/UxqBXpuU4GMc4WjX5cuA/vNLP41sSsaCe3FOPabuN/local_storage.js", "ssg:https://framerusercontent.com/modules/1HXZiu3jhMNERAXG1Gks/JVC2ghWtFhGU3smjLpG2/mail_app_redirect.js", "ssg:https://framerusercontent.com/modules/RgCsmN5afHEa5XXUaU7f/JeULvcMpzJGMZapN7K6y/homepage.js"],
  "sourcesContent": ["export function isLocalStorageAvailable(){try{const key=\"key\";const value=\"value\";localStorage.setItem(key,value);const recoveredValue=localStorage.getItem(key);localStorage.removeItem(key);return recoveredValue===value;}catch(e){return false;}}\nexport const __FramerMetadata__ = {\"exports\":{\"isLocalStorageAvailable\":{\"type\":\"function\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./local_storage.map", "import{NATIVE_PROTOCOL,WEB_APP_ORIGIN}from\"https://framerusercontent.com/modules/qGoVzbWYhJxr4Ja3txj9/KE4IceoNIk2eugQ0HmGI/constants.js\";// Inspired by: https://github.com/fingerprintjs/external-protocol-flooding\n// 1. We open a popup window with an input.\n// 2. We try to open our native app in that window via deep-link.\n// 3. We try to focus the input from step 1.\n// 4. If we can't focus it, we know the native app is installed.\n//    (Because the native app's open confirmation blocks the input.)\n// 5. We set a cookie so we don't have to do that in the future.\nconst WINDOWS_PLATFORMS=[\"Win32\",\"Win64\",\"Windows\",\"WinCE\"];const EXTENSION_INSTALLED_CLASS=\"superhumanIsInstalled\";const NATIVE_APP_INSTALLED_CLASS=\"nativeAppInstalled\";const HAS_NATIVE_COOKIE_NAME=\"has-native\";// Expires in 5 days\nconst COOKIE_EXPIRATION=5*864e5;// TODO: Move these functions to another file ----------\nexport function isFirefox(){return navigator.userAgent.includes(\"Firefox\");}export function isMobile(){return navigator.userAgent.match(/android|webos|iphone|ipod|blackberry|iemobile|opera mini/i)!==null;}export function isSafari(){return/^((?!chrome|android).)*safari/i.test(navigator.userAgent);}// -----------------------------------------------------\nexport function redirectToWebApp(){window.open(WEB_APP_ORIGIN,\"_blank\");}export function redirectToNativeApp(){window.open(NATIVE_PROTOCOL,\"_blank\");}export function isSuperhumanExtensionInstalled(){return document.documentElement.classList.contains(EXTENSION_INSTALLED_CLASS);}export async function isSuperhumanNativeAppInstalled(){if(isMobile()||isSafari())return false;const nativeCookieValue=getNativeCookieValue();if(nativeCookieValue===\"true\")return true;if(nativeCookieValue===\"false\")return false;return isFirefox()?await detectFirefox():await detectChrome();}export function getNativeCookieValue(){const cookies=document.cookie.split(\";\");for(const cookie of cookies){const[name,value]=cookie.trim().split(\"=\");if(name===HAS_NATIVE_COOKIE_NAME)return value;}return null;}export function saveDetectionResult(hasNative){const expiresDate=new Date(Date.now()+COOKIE_EXPIRATION).toUTCString();const cookieValue=`${HAS_NATIVE_COOKIE_NAME}=${hasNative}; expires=${expiresDate};`;document.cookie=HAS_NATIVE_COOKIE_NAME+\"=\"+cookieValue;if(hasNative){document.documentElement.classList.add(NATIVE_APP_INSTALLED_CLASS);}}async function detectChrome(){const handler=getPopupWindow();let isDetected=true;const input=document.createElement(\"input\");input.style.opacity=\"0\";input.style.position=\"absolute\";// If we can focus our input, the deep link didn't trigger.\ninput.onfocus=()=>{isDetected=false;};const isWindows=WINDOWS_PLATFORMS.indexOf(navigator.platform)>-1;await wait(isWindows?100:40);if(document.hasFocus()){document.body.insertBefore(input,document.getElementById(\"app\"));}else{handler.document.body.appendChild(input);}handler.location.replace(NATIVE_PROTOCOL);await wait(isWindows?250:125);// Perform detection\ninput.focus();handler.close();saveDetectionResult(isDetected);return isDetected;}const firefoxDetectionWaitingDefault=200;let firefoxDetectionWaiting=firefoxDetectionWaitingDefault;async function detectFirefox(){const handler=getPopupWindow();const start=performance.now();const unsubscribe=listenOnce(\"load\",()=>{const delta=performance.now()-start;if(firefoxDetectionWaiting===firefoxDetectionWaitingDefault){firefoxDetectionWaiting=delta+15;}});const iframe=document.createElement(\"iframe\");iframe.src=NATIVE_PROTOCOL;iframe.style.opacity=\"0\";handler.document.body.appendChild(iframe);await wait(firefoxDetectionWaiting);unsubscribe();const isDetected=!!iframe.contentDocument;saveDetectionResult(isDetected);handler.location.replace(\"/blank\");await waitForLocation(document.location.origin+\"/blank\");handler.location.replace(\"about:blank\");await waitForLocation(\"about:blank\");handler.close();return isDetected;}async function wait(delay=0){return new Promise(resolve=>{setTimeout(resolve,delay);});}// TODO: Move these functions to another file\nlet handler=null;function createPopupWindow(){const params=`width=50,height=50,left=9999,top=9999`;const initialUrl=\"about:blank\";handler=window.open(initialUrl,\"\",params);return handler;}export function getPopupWindow(){return handler||createPopupWindow();}export function listenOnce(type,callback){handler.addEventListener(type,callback,{once:true});return()=>handler.removeEventListener(type,callback);}/**\n * Wait after cross-origin loading\n */export function waitForLocation(href){return new Promise(resolve=>{const intervalId=setInterval(()=>{try{if(handler.location.href===href){clearInterval(intervalId);resolve();}}catch(e){clearInterval(intervalId);resolve();}});});}\nexport const __FramerMetadata__ = {\"exports\":{\"isSuperhumanNativeAppInstalled\":{\"type\":\"function\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"redirectToNativeApp\":{\"type\":\"function\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"listenOnce\":{\"type\":\"function\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"waitForLocation\":{\"type\":\"function\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"isMobile\":{\"type\":\"function\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"isFirefox\":{\"type\":\"function\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"redirectToWebApp\":{\"type\":\"function\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"saveDetectionResult\":{\"type\":\"function\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"getPopupWindow\":{\"type\":\"function\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"isSafari\":{\"type\":\"function\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"getNativeCookieValue\":{\"type\":\"function\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"isSuperhumanExtensionInstalled\":{\"type\":\"function\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}", "/**\n * This file contains code that we run when the homepage loads.\n * It currently handles two things:\n * 1. Redirecting current customers to the web or native app.\n * 2. Storing influencer info for eventual use on /checkout.\n */import{jsx as _jsx}from\"react/jsx-runtime\";import React from\"react\";import{isLocalStorageAvailable}from\"https://framerusercontent.com/modules/UxqBXpuU4GMc4WjX5cuA/vNLP41sSsaCe3FOPabuN/local_storage.js\";import{isSuperhumanExtensionInstalled,getNativeCookieValue}from\"https://framerusercontent.com/modules/1HXZiu3jhMNERAXG1Gks/JVC2ghWtFhGU3smjLpG2/mail_app_redirect.js\";import{IS_STAGING,NATIVE_PROTOCOL,ORIGIN,WEB_APP_ORIGIN}from\"https://framerusercontent.com/modules/qGoVzbWYhJxr4Ja3txj9/KE4IceoNIk2eugQ0HmGI/constants.js\";const SOURCES_NOT_TO_REDIRECT=[\"mail_app\",\"referral_inc\",\"referral_link\",\"referral_holiday_inc\"];const shouldRedirectToMailApp=()=>{// Don't redirect if a visitor came from on another webpage.\nif(document.referrer.includes(\"superhuman.com\"))return false;const searchParams=new URLSearchParams(window.location.search);// Don't redirect if the URL contains ?redirect=0.\nif(searchParams.get(\"redirect\")===\"0\")return false;// Don't redirect if a visitor came from one of these sources.\nconst source=searchParams.get(\"source\");if(SOURCES_NOT_TO_REDIRECT.includes(source))return false;return true;};const redirectToMailApp=()=>{if(isSuperhumanExtensionInstalled()){window.location.href=`${WEB_APP_ORIGIN}/?source=website`;return;}if(getNativeCookieValue()===\"true\"){window.location.href=NATIVE_PROTOCOL;return;}};const maybeRedirectToMailApp=()=>{if(shouldRedirectToMailApp()){redirectToMailApp();}};/**\n * If someone visits a page like /influencer-name, we do this:\n *   1. Show the homepage's content\n *   2. Save `influencer-name` to localStorage as `via`\n *   3. Retrieve `via` on /checkout\n *   4. Include `via` in a request to the signups.create endpoint\n *      (This lets the backend apply a Stripe coupon.)\n *   5. Remove `via` from localStorage\n */const maybeSavePathToLocalStorage=()=>{const via=document.location.pathname.slice(1);if(via&&isLocalStorageAvailable()){localStorage.setItem(\"via\",via);}};export function withHomepageLoad(Component){return props=>{React.useEffect(()=>{if(IS_STAGING){// handle URLs that contain ?vip=* (used for \"Sent via Superhuman\" signature)\nconst searchParams=new URLSearchParams(window.location.search);const vip=searchParams.get(\"vip\");if(vip&&vip.length>0){window.location.href=`${ORIGIN}/refer?utm_source=product&utm_medium=signature&utm_campaign=${vip}`;return;}}maybeSavePathToLocalStorage();maybeRedirectToMailApp();},[]);return /*#__PURE__*/_jsx(Component,{...props});};}\nexport const __FramerMetadata__ = {\"exports\":{\"withHomepageLoad\":{\"type\":\"reactHoc\",\"name\":\"withHomepageLoad\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}"],
  "mappings": "uJAAO,SAASA,GAAyB,CAAC,GAAG,CAAC,IAAMC,EAAI,MAAYC,EAAM,QAAQ,aAAa,QAAQD,EAAIC,CAAK,EAAE,IAAMC,EAAe,aAAa,QAAQF,CAAG,EAAE,oBAAa,WAAWA,CAAG,EAASE,IAAiBD,CAAM,MAAS,CAAC,MAAO,EAAM,CAAC,CCOxL,IAAME,EAA0B,wBAA8E,IAAMC,EAAuB,aACjMC,EAAkB,EAAE,MAEmI,SAASC,GAAgC,CAAC,OAAO,SAAS,gBAAgB,UAAU,SAASC,CAAyB,CAAE,CAA0S,SAASC,GAAsB,CAAC,IAAMC,EAAQ,SAAS,OAAO,MAAM,GAAG,EAAE,QAAUC,KAAUD,EAAQ,CAAC,GAAK,CAACE,EAAKC,CAAK,EAAEF,EAAO,KAAK,EAAE,MAAM,GAAG,EAAE,GAAGC,IAAOE,EAAuB,OAAOD,CAAM,CAAC,OAAO,IAAK,CCL7P,IAAME,EAAwB,CAAC,WAAW,eAAe,gBAAgB,sBAAsB,EAAQC,EAAwB,IAAI,CACjpB,GAAG,SAAS,SAAS,SAAS,gBAAgB,EAAE,MAAO,GAAM,IAAMC,EAAa,IAAI,gBAAgBC,EAAO,SAAS,MAAM,EAC1H,GAAGD,EAAa,IAAI,UAAU,IAAI,IAAI,MAAO,GAC7C,IAAME,EAAOF,EAAa,IAAI,QAAQ,EAAE,MAAG,CAAAF,EAAwB,SAASI,CAAM,CAA2B,EAAQC,EAAkB,IAAI,CAAC,GAAGC,EAA+B,EAAE,CAACH,EAAO,SAAS,KAAK,GAAGI,CAAc,mBAAmB,MAAO,CAAC,GAAGC,EAAqB,IAAI,OAAO,CAACL,EAAO,SAAS,KAAKM,EAAgB,MAAO,CAAC,EAAQC,EAAuB,IAAI,CAAIT,EAAwB,GAAGI,EAAkB,CAAG,EAQjZM,EAA4B,IAAI,CAAC,IAAMC,EAAI,SAAS,SAAS,SAAS,MAAM,CAAC,EAAKA,GAAKC,EAAwB,GAAG,aAAa,QAAQ,MAAMD,CAAG,CAAG,EAAS,SAASE,EAAiBC,EAAU,CAAC,OAAOC,IAAQC,EAAM,UAAU,IAAI,CAAC,GAAGC,EAAW,CAC7L,IAAMC,EAAlD,IAAI,gBAAgBhB,EAAO,SAAS,MAAM,EAAyB,IAAI,KAAK,EAAE,GAAGgB,GAAKA,EAAI,OAAO,EAAE,CAAChB,EAAO,SAAS,KAAK,GAAGiB,CAAM,+DAA+DD,CAAG,GAAG,MAAO,CAAC,CAACR,EAA4B,EAAED,EAAuB,CAAE,EAAE,CAAC,CAAC,EAAsBW,EAAKN,EAAU,CAAC,GAAGC,CAAK,CAAC,EAAI",
  "names": ["isLocalStorageAvailable", "key", "value", "recoveredValue", "EXTENSION_INSTALLED_CLASS", "HAS_NATIVE_COOKIE_NAME", "COOKIE_EXPIRATION", "isSuperhumanExtensionInstalled", "EXTENSION_INSTALLED_CLASS", "getNativeCookieValue", "cookies", "cookie", "name", "value", "HAS_NATIVE_COOKIE_NAME", "SOURCES_NOT_TO_REDIRECT", "shouldRedirectToMailApp", "searchParams", "window", "source", "redirectToMailApp", "isSuperhumanExtensionInstalled", "WEB_APP_ORIGIN", "getNativeCookieValue", "NATIVE_PROTOCOL", "maybeRedirectToMailApp", "maybeSavePathToLocalStorage", "via", "isLocalStorageAvailable", "withHomepageLoad", "Component", "props", "e", "IS_STAGING", "vip", "ORIGIN", "p"]
}
