{"version":3,"file":"FlowProgress.k-H2ppKp.mjs","names":["useState","React.useCallback","useState"],"sources":["https:/framerusercontent.com/modules/vj7bFUjvEQFgEzNBkdoG/vf3CKm378wlVcBk7IhSU/createStore.js","https:/framer.com/m/framer/store.js@^1.0.0","https:/framerusercontent.com/modules/eZFuhLmCAxmxcUw7bZmI/pEJ5I0eWuMItHKs9JDGk/store.js","https:/framerusercontent.com/modules/8O5lhXb06WF43kDQX49U/VSlLJh6ctUix3Sd0XB40/FlowProgress.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*as React from\"react\";import{createStore}from\"https://framer.com/m/framer/store.js@^1.0.0\";// ─── sessionStorage persistence (\"am_funnel_v1\") ─────────────────────\n//  Funnel state (kit quantities + delivery details) must survive a FULL\n//  document load — on mobile, tapping \"Checkout · $X\" can hard-navigate to\n//  /checkout, and an in-memory-only store resets quantities to 0, which\n//  trips StripeCheckout's empty-cart redirect back to /trip-duration.\n//  flowStep / flowMode are deliberately NOT persisted: FlowGate's\n//  fresh-load step reset and the ?step=kit boot depend on them starting\n//  clean on every document load.\nconst PERSIST_KEY=\"am_funnel_v1\";const PERSIST_FIELDS=[\"him_quantity\",\"her_quantity\",\"deliveryType\",\"arrivalDate\",\"tripDays\",\"shippingLine\"];function readPersisted(){if(typeof window===\"undefined\")return{};try{const raw=window.sessionStorage.getItem(PERSIST_KEY);if(!raw)return{};const data=JSON.parse(raw);if(!data||typeof data!==\"object\"||Array.isArray(data))return{};const out={};for(const key of PERSIST_FIELDS)if(data[key]!==undefined)out[key]=data[key];return out;}catch(e){// Private mode / blocked storage — fall back to in-memory only.\nreturn{};}}function writePersisted(state){if(typeof window===\"undefined\")return;try{const out={};for(const key of PERSIST_FIELDS)if(state[key]!==undefined)out[key]=state[key];window.sessionStorage.setItem(PERSIST_KEY,JSON.stringify(out));}catch(e){}}// Hydrate SYNCHRONOUSLY at module init so the first render already sees the\n// persisted quantities (no empty-cart flash on a /checkout full load).\n// `hydrated` is true whenever storage was actually consulted (browser only) —\n// consumers (e.g. StripeCheckout's empty-cart guard) can gate on it.\nconst initialState={him_quantity:0,her_quantity:0,deliveryType:\"HOTEL\",isLoading:false,isQuantityError:false,hydrated:typeof window!==\"undefined\",...readPersisted()};// Module-level mirror of the store state — lets every set persist the merged\n// result without needing a subscription API on Framer's createStore.\nlet mirror={...initialState};// Create a global store\nconst useStoreBase=createStore(initialState);// Same [state, setState] contract as before; the setter additionally\n// persists the funnel fields to sessionStorage on every write.\nexport function useStore(init){const[state,setState]=useStoreBase(init);const set=React.useCallback(partial=>{const patch=typeof partial===\"function\"?partial(mirror):partial;mirror={...mirror,...patch};writePersisted(mirror);setState(patch);},[setState]);return[state,set];}\nexport const __FramerMetadata__ = {\"exports\":{\"useStore\":{\"type\":\"function\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./store.map","import{jsx as _jsx}from\"react/jsx-runtime\";import{addPropertyControls,ControlType}from\"framer\";import{useEffect,useState}from\"react\";import{useStore}from\"https://framerusercontent.com/modules/eZFuhLmCAxmxcUw7bZmI/pEJ5I0eWuMItHKs9JDGk/store.js\";export default function FlowProgress(props){const{stepIndex,stepCount,light,stepKey,duration,activeColor,dimColor,activeColorLight,dimColorLight,style,onStepClick,stepLabels}=props;const[store,setStore]=useStore(0);const key=stepKey||\"flowStep\";const prev=Number(store[key])||0;// first paint at the previous step (or this step on a cold load),\n// then animate to the target on the next frame\nconst[shown,setShown]=useState(prev>0?prev:stepIndex);useEffect(()=>{const id=requestAnimationFrame(()=>requestAnimationFrame(()=>setShown(stepIndex)));setStore({[key]:stepIndex});return()=>cancelAnimationFrame(id);// eslint-disable-next-line react-hooks/exhaustive-deps\n},[stepIndex]);const count=Math.max(2,stepCount);const on=light?activeColorLight:activeColor;const off=light?dimColorLight:dimColor;return /*#__PURE__*/_jsx(\"span\",{\"aria-label\":`Step ${stepIndex} of ${stepCount}`,style:{display:\"inline-flex\",alignItems:\"center\",gap:3,...style},children:Array.from({length:count},(_,i)=>{const step=i+1;const active=step===shown;const dashStyle={width:active?28.58:17.1,height:6,borderRadius:222,background:active?on:off,transition:`width ${duration}s cubic-bezier(0.4,0,0.2,1), background ${duration}s ease`,flex:\"0 0 auto\"};// Clickable dash: only when a handler is provided AND this\n// isn't the current page's step (current step = no-op).\nif(onStepClick&&step!==stepIndex){return /*#__PURE__*/_jsx(\"button\",{type:\"button\",onClick:()=>onStepClick(step),\"aria-label\":stepLabels&&stepLabels[i]||`Go to step ${step}`,style:{...dashStyle,appearance:\"none\",WebkitAppearance:\"none\",border:\"none\",padding:0,margin:0,cursor:\"pointer\",WebkitTapHighlightColor:\"transparent\"}},i);}return /*#__PURE__*/_jsx(\"span\",{style:dashStyle},i);})});}FlowProgress.defaultProps={stepIndex:1,stepCount:3,light:false,stepKey:\"flowStep\",duration:.42,activeColor:\"#FFFFFF\",dimColor:\"rgba(217,217,217,0.12)\",activeColorLight:\"#0A0A0B\",dimColorLight:\"rgba(10,10,11,0.12)\"};addPropertyControls(FlowProgress,{stepIndex:{type:ControlType.Number,title:\"Step\",defaultValue:1,min:1,max:6,step:1},stepCount:{type:ControlType.Number,title:\"Steps\",defaultValue:3,min:2,max:6,step:1},light:{type:ControlType.Boolean,title:\"Light\",defaultValue:false,description:\"ON → dark dashes for light backgrounds.\"},stepKey:{type:ControlType.String,title:\"State Key\",defaultValue:\"flowStep\"},duration:{type:ControlType.Number,title:\"Anim (s)\",defaultValue:.42,min:0,max:1.2,step:.01},activeColor:{type:ControlType.Color,title:\"Active\",defaultValue:\"#FFFFFF\"},dimColor:{type:ControlType.Color,title:\"Dim\",defaultValue:\"rgba(217,217,217,0.12)\"},activeColorLight:{type:ControlType.Color,title:\"Active (Light)\",defaultValue:\"#0A0A0B\"},dimColorLight:{type:ControlType.Color,title:\"Dim (Light)\",defaultValue:\"rgba(10,10,11,0.12)\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"FlowProgress\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./FlowProgress.map"],"mappings":"qNAA8E,SAAgB,EAAY,EAAO,CACjH,IAAM,EAAU,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