{"version":3,"file":"AuthStore.C99SEdsI.mjs","names":["useState","React.useState","React.useRef","__legacyOverrideHOC_DataObserverContext","_jsx"],"sources":["https:/framerusercontent.com/modules/vj7bFUjvEQFgEzNBkdoG/vf3CKm378wlVcBk7IhSU/createStore.js","https:/framer.com/m/framer/store.js","https:/framerusercontent.com/modules/Dg1LQFroae2DnvOVU7lx/ia8fPAtgJ2OAaPANxvYN/AuthStore.js"],"sourcesContent":["import{useState,useEffect}from\"react\";import{Data,useObserveData}from\"framer\";export function createStore(state1){// Use Data so that a Preview reload resets the state\nconst dataStore=Data({state:Object.freeze({...state1})});// Create a set function that updates the state\nconst setDataStore=newState=>{// If the state is an object, make sure we copy it\nif(typeof newState===\"function\"){newState=newState(dataStore.state);}dataStore.state=Object.freeze({...dataStore.state,...newState});};// Store the initial state, copy the object if it's an object\nlet storeState=typeof state1===\"object\"?Object.freeze({...state1}):state1;// Keep a list of all the listeners, in the form of React hook setters\nconst storeSetters=new Set();// Create a set function that updates all the listeners / setters\nconst setStoreState=newState=>{// If the state is an object, make sure we copy it\nif(typeof newState===\"function\"){newState=newState(storeState);}storeState=typeof newState===\"object\"?Object.freeze({...storeState,...newState}):newState;// Update all the listeners / setters with the new value\nstoreSetters.forEach(setter=>setter(storeState));};// Create the actual hook based on everything above\nfunction useStore(){// Create the hook we are going to use as a listener\nconst[state,setState]=useState(storeState);// If we unmount the component using this hook, we need to remove the listener\n// @ts-ignore\nuseEffect(()=>{// But right now, we need to add the listener\nstoreSetters.add(setState);return()=>storeSetters.delete(setState);},[]);// If Data context exists, use Data, otherwise use vanilla React state\nif(useObserveData()===true){useObserveData();return[dataStore.state,setDataStore];}else{// Return the state and a function to update the central store\nreturn[state,setStoreState];}}return useStore;}\nexport const __FramerMetadata__ = {\"exports\":{\"createStore\":{\"type\":\"function\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./createStore.map","/*\n * createStore (framer/store@1.0.1)\n *\n * Learn More: https://www.framer.com/asset-urls\n */\n\nexport * from \"https://framerusercontent.com/modules/vj7bFUjvEQFgEzNBkdoG/vf3CKm378wlVcBk7IhSU/createStore.js\"\n","import{jsx as _jsx}from\"react/jsx-runtime\";import{createStore}from\"https://framer.com/m/framer/store.js\";import*as React from\"react\";const AUTH_KEY=\"DS_IS_LOGGED_IN\";function readAuthStamp(){try{if(typeof window===\"undefined\")return false;return localStorage.getItem(AUTH_KEY)===\"true\";}catch{return false;}}export const useAuthStore=createStore({isLoggedIn:readAuthStamp()});function useAuthState(){const[isLoggedIn,setIsLoggedIn]=React.useState(()=>readAuthStamp());React.useLayoutEffect(()=>{setIsLoggedIn(readAuthStamp());},[]);React.useEffect(()=>{const onCustom=e=>setIsLoggedIn(e.detail.isLoggedIn);const onStorage=e=>{if(e.key===AUTH_KEY)setIsLoggedIn(readAuthStamp());};window.addEventListener(\"authStateChanged\",onCustom);window.addEventListener(\"storage\",onStorage);return()=>{window.removeEventListener(\"authStateChanged\",onCustom);window.removeEventListener(\"storage\",onStorage);};},[]);return isLoggedIn;}// DOM에 직접 display 강제 적용 — Framer 레이아웃 엔진 우회\nfunction useHideRef(shouldHide){const ref=React.useRef(null);React.useLayoutEffect(()=>{const el=ref.current;if(!el)return;if(shouldHide){el.style.setProperty(\"display\",\"none\",\"important\");el.style.setProperty(\"pointer-events\",\"none\",\"important\");}else{el.style.removeProperty(\"display\");el.style.removeProperty(\"pointer-events\");}},[shouldHide]);return ref;}export function trackCurrentPage(){React.useEffect(()=>{const save=()=>{const here=window.location.pathname;if(!here.startsWith(\"/login\")){sessionStorage.setItem(\"redirectAfterLogin\",here);}};save();window.addEventListener(\"popstate\",save);const origPush=history.pushState.bind(history);const origReplace=history.replaceState.bind(history);history.pushState=(...args)=>{origPush(...args);save();};history.replaceState=(...args)=>{origReplace(...args);save();};return()=>{window.removeEventListener(\"popstate\",save);history.pushState=origPush;history.replaceState=origReplace;};},[]);return{};}export function showWhenAuthed(){const isLoggedIn=useAuthState();const ref=useHideRef(!isLoggedIn);return{ref};}export function showWhenGuest(){const isLoggedIn=useAuthState();const ref=useHideRef(isLoggedIn);return{ref};}export function logoutAndGoLogin(){return{onTap(){try{const keysToRemove=[];for(let i=0;i<localStorage.length;i++){const key=localStorage.key(i);if(key&&(key===AUTH_KEY||key===\"DSRCN\"||key.startsWith(\"dls_\")||key.startsWith(\"descope\")||key.startsWith(\"DS_\"))){keysToRemove.push(key);}}keysToRemove.forEach(k=>localStorage.removeItem(k));sessionStorage.clear();}catch{}window.dispatchEvent(new CustomEvent(\"authStateChanged\",{detail:{isLoggedIn:false}}));window.location.replace(\"/login\");}};}export function showAuthedAndLogout(){const isLoggedIn=useAuthState();const ref=useHideRef(!isLoggedIn);return{ref,onTap(){try{localStorage.removeItem(AUTH_KEY);sessionStorage.removeItem(\"redirectAfterLogin\");}catch{}window.dispatchEvent(new CustomEvent(\"authStateChanged\",{detail:{isLoggedIn:false}}));window.location.href=\"/login\";}};}export function requireAuth(){const isLoggedIn=useAuthState();const[mounted,setMounted]=React.useState(false);React.useEffect(()=>{setMounted(true);},[]);React.useEffect(()=>{if(mounted&&!isLoggedIn){window.location.replace(\"/login\");}},[isLoggedIn,mounted]);return{style:{visibility:!mounted||isLoggedIn?\"visible\":\"hidden\"}};}export function guestLoginButton(){const isLoggedIn=useAuthState();const ref=React.useRef(null);React.useLayoutEffect(()=>{const el=ref.current;if(!el)return;if(isLoggedIn){el.style.setProperty(\"display\",\"none\",\"important\");el.style.setProperty(\"pointer-events\",\"none\",\"important\");}else{el.style.removeProperty(\"display\");el.style.removeProperty(\"pointer-events\");}},[isLoggedIn]);return{ref,onTap(){try{sessionStorage.setItem(\"redirectAfterLogin\",window.location.pathname);}catch{}window.location.replace(\"/login\");}};}export function navigateToMypage(){return{onTap(){window.location.replace(\"/login/mypage\");}};}import{useContext as __legacyOverrideHOC_useContext}from\"react\";import{DataObserverContext as __legacyOverrideHOC_DataObserverContext}from\"framer\";export function withtrackCurrentPage(C){return props=>{__legacyOverrideHOC_useContext(__legacyOverrideHOC_DataObserverContext);return _jsx(C,{...props,...trackCurrentPage(props)});};}withtrackCurrentPage.displayName=\"trackCurrentPage\";export function withshowWhenAuthed(C){return props=>{__legacyOverrideHOC_useContext(__legacyOverrideHOC_DataObserverContext);return _jsx(C,{...props,...showWhenAuthed(props)});};}withshowWhenAuthed.displayName=\"showWhenAuthed\";export function withshowWhenGuest(C){return props=>{__legacyOverrideHOC_useContext(__legacyOverrideHOC_DataObserverContext);return _jsx(C,{...props,...showWhenGuest(props)});};}withshowWhenGuest.displayName=\"showWhenGuest\";export function withlogoutAndGoLogin(C){return props=>{__legacyOverrideHOC_useContext(__legacyOverrideHOC_DataObserverContext);return _jsx(C,{...props,...logoutAndGoLogin(props)});};}withlogoutAndGoLogin.displayName=\"logoutAndGoLogin\";export function withshowAuthedAndLogout(C){return props=>{__legacyOverrideHOC_useContext(__legacyOverrideHOC_DataObserverContext);return _jsx(C,{...props,...showAuthedAndLogout(props)});};}withshowAuthedAndLogout.displayName=\"showAuthedAndLogout\";export function withrequireAuth(C){return props=>{__legacyOverrideHOC_useContext(__legacyOverrideHOC_DataObserverContext);return _jsx(C,{...props,...requireAuth(props)});};}withrequireAuth.displayName=\"requireAuth\";export function withguestLoginButton(C){return props=>{__legacyOverrideHOC_useContext(__legacyOverrideHOC_DataObserverContext);return _jsx(C,{...props,...guestLoginButton(props)});};}withguestLoginButton.displayName=\"guestLoginButton\";export function withnavigateToMypage(C){return props=>{__legacyOverrideHOC_useContext(__legacyOverrideHOC_DataObserverContext);return _jsx(C,{...props,...navigateToMypage(props)});};}withnavigateToMypage.displayName=\"navigateToMypage\";\nexport const __FramerMetadata__ = {\"exports\":{\"withshowWhenGuest\":{\"type\":\"reactHoc\",\"name\":\"withshowWhenGuest\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"guestLoginButton\":{\"type\":\"override\",\"name\":\"guestLoginButton\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withshowAuthedAndLogout\":{\"type\":\"reactHoc\",\"name\":\"withshowAuthedAndLogout\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"requireAuth\":{\"type\":\"override\",\"name\":\"requireAuth\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"useAuthStore\":{\"type\":\"variable\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withshowWhenAuthed\":{\"type\":\"reactHoc\",\"name\":\"withshowWhenAuthed\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"logoutAndGoLogin\":{\"type\":\"override\",\"name\":\"logoutAndGoLogin\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withguestLoginButton\":{\"type\":\"reactHoc\",\"name\":\"withguestLoginButton\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"showWhenGuest\":{\"type\":\"override\",\"name\":\"showWhenGuest\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"navigateToMypage\":{\"type\":\"override\",\"name\":\"navigateToMypage\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withrequireAuth\":{\"type\":\"reactHoc\",\"name\":\"withrequireAuth\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"trackCurrentPage\":{\"type\":\"override\",\"name\":\"trackCurrentPage\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withtrackCurrentPage\":{\"type\":\"reactHoc\",\"name\":\"withtrackCurrentPage\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withlogoutAndGoLogin\":{\"type\":\"reactHoc\",\"name\":\"withlogoutAndGoLogin\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"showAuthedAndLogout\":{\"type\":\"override\",\"name\":\"showAuthedAndLogout\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withnavigateToMypage\":{\"type\":\"reactHoc\",\"name\":\"withnavigateToMypage\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"showWhenAuthed\":{\"type\":\"override\",\"name\":\"showWhenAuthed\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerM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