{"version":3,"file":"ShowOverrides.Cd3GZ2ng.mjs","names":["useStore"],"sources":["https:/ga.jspm.io/npm:@motionone/utils@10.12.0/dist/index.es.js","https:/framer.com/m/framer/store.js@^1.0.0","https:/framerusercontent.com/modules/PpSGzEoVzwhY8J30vkBA/2bYcD7AbbYGSOUo6Rc6j/ShowOverrides.js"],"sourcesContent":["function addUniqueItem(t,e){-1===t.indexOf(e)&&t.push(e)}function removeItem(t,e){const n=t.indexOf(e);n>-1&&t.splice(n,1)}const clamp=(t,e,n)=>Math.min(Math.max(n,t),e);const t={duration:.3,delay:0,endDelay:0,repeat:0,easing:\"ease\"};const isNumber=t=>\"number\"===typeof t;const isString=t=>\"string\"===typeof t;const isEasingGenerator=t=>\"object\"===typeof t&&Boolean(t.createAnimation);const isCubicBezier=t=>Array.isArray(t)&&isNumber(t[0]);const isEasingList=t=>Array.isArray(t)&&!isNumber(t[0]);const wrap=(t,e,n)=>{const o=e-t;return((n-t)%o+o)%o+t};function getEasingForSegment(t,e){return isEasingList(t)?t[wrap(0,t.length,e)]:t}const mix=(t,e,n)=>-n*t+n*e+t;const noop=()=>{};const noopReturn=t=>t;const progress=(t,e,n)=>e-t===0?1:(n-t)/(e-t);function fillOffset(t,e){const n=t[t.length-1];for(let o=1;o<=e;o++){const s=progress(0,e,o);t.push(mix(n,1,s))}}function defaultOffset(t){const e=[0];fillOffset(e,t-1);return e}function interpolate(t,e=defaultOffset(t.length),n=noopReturn){const o=t.length;const s=o-e.length;s>0&&fillOffset(e,s);return s=>{let r=0;for(;r<o-2;r++)if(s<e[r+1])break;let f=clamp(0,1,progress(e[r],e[r+1],s));const c=getEasingForSegment(n,r);f=c(f);return mix(t[r],t[r+1],f)}}const e={ms:t=>1e3*t,s:t=>t/1e3};\n/*\n  Convert velocity into velocity per second\n\n  @param [number]: Unit per frame\n  @param [number]: Frame duration in ms\n*/function velocityPerSecond(t,e){return e?t*(1e3/e):0}export{addUniqueItem,clamp,defaultOffset,t as defaults,fillOffset,getEasingForSegment,interpolate,isCubicBezier,isEasingGenerator,isEasingList,isNumber,isString,mix,noop,noopReturn,progress,removeItem,e as time,velocityPerSecond,wrap};\n\n//# sourceMappingURL=index.es.js.map","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","import{jsx as _jsx}from\"react/jsx-runtime\";import{useEffect}from\"react\";import{createStore}from\"https://framer.com/m/framer/store.js@^1.0.0\";// This store is being updated by the ShowCardGrid component\nexport const useStore=createStore({currentTgid:\"3023\"});// Show data for the swipesheet/popup\nexport function withShowTgid(Component){return props=>{const[store,setStore]=useStore();const tgid=store.currentTgid;return /*#__PURE__*/_jsx(Component,{...props,tgid:tgid});};}// Replace links that lead away from britishtheatre with buy-tickets\nexport function withHideShowLink(Component){return props=>{useEffect(()=>{// Find current element in the DOM\nconst currentElClassName=props.className;const currentEl=document.querySelector(`.${currentElClassName}`);// Find all links within the current element\nconst allLinksWithinCurrentEl=currentEl.querySelectorAll(\"a\");// Loop over all links\nallLinksWithinCurrentEl.forEach(a=>{// Check if link text includes the word \"book\"\nif(a.innerText.toLowerCase().includes(\"book\")){a.href=\"https://www.britishtheatre.com/buy-tickets\";}});},[]);return /*#__PURE__*/_jsx(Component,{...props});};}// Replace links that lead away from britishtheatre with buy-tickets\nexport function withReplaceExternalLinksWithBuyTickets(Component){return props=>{useEffect(()=>{// Find current element in the DOM\nconst currentElClassName=props.className;const currentEl=document.querySelector(`.${currentElClassName}`);// Find all links within the current element\nconst allLinksWithinCurrentEl=currentEl.querySelectorAll(\"a\");// Loop over all links\nallLinksWithinCurrentEl.forEach(a=>{// If link is leading away from britishthreatre, point it to buy-tickets\nif(!a.href.includes(\"britishtheatre.com\")){a.href=\"https://www.britishtheatre.com/buy-tickets\";}});},[]);return /*#__PURE__*/_jsx(Component,{...props});};}\nexport const __FramerMetadata__ = {\"exports\":{\"useStore\":{\"type\":\"variable\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withHideShowLink\":{\"type\":\"reactHoc\",\"name\":\"withHideShowLink\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withShowTgid\":{\"type\":\"reactHoc\",\"name\":\"withShowTgid\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withReplaceExternalLinksWithBuyTickets\":{\"type\":\"reactHoc\",\"name\":\"withReplaceExternalLinksWithBuyTickets\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./ShowOverrides.map"],"mappings":"+QAAssB,AAArkB,EAAM,CAAC,EAAE,EA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