{"version":3,"file":"Fullsize_image.BtwGoM-R.mjs","names":["useState","useRef"],"sources":["https:/framerusercontent.com/modules/vj7bFUjvEQFgEzNBkdoG/vf3CKm378wlVcBk7IhSU/createStore.js","https:/framer.com/m/framer/store.js@^1.0.0","https:/framerusercontent.com/modules/vWOQmq7lijrWV9NwbUyt/SjP4pYAhqZ7AgFM1TAGZ/Fullsize_image.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{useEffect,useRef,forwardRef}from\"react\";import{createStore}from\"https://framer.com/m/framer/store.js@^1.0.0\";export function withFullWidthFramerImage(Component){return props=>{const ref=useRef(null);useEffect(()=>{if(ref.current){const images=ref.current.querySelectorAll(\".framer-image\");images.forEach(img=>{img.style.display=\"block\";img.style.marginLeft=\"auto\";img.style.marginRight=\"auto\";img.style.width=\"100%\";img.style.height=\"auto\";});}},[]);return /*#__PURE__*/_jsx(Component,{...props,ref:ref});};}const API_URL=\"https://app.syntheticfi.com/api/cob/rates\";const useRatesStore=createStore({rows:null,loading:false});function formatPercent(x){if(typeof x!==\"number\"||!isFinite(x))return\"\";return`${(x*100).toFixed(2)}%`;}function formatDays(x){if(typeof x!==\"number\"||!isFinite(x))return\"\";return`${Math.round(x)} days`;}function formatDate(s){if(!s)return\"\";const parts=s.split(\"/\");if(parts.length!==3)return s;const m=parts[0];const d=parts[1];const y=parts[2];return`${String(m).padStart(2,\"0\")}/${String(d).padStart(2,\"0\")}/${y}`;}function parseToken(text){if(typeof text!==\"string\")return null;const m=text.trim().match(/^\\{\\{\\s*(ask|bid|dur|date)\\s*:\\s*(\\d+)\\s*\\}\\}$/i);if(!m)return null;return{kind:m[1].toLowerCase(),index:Number(m[2])};}export function withRatesTokens(Component){return /*#__PURE__*/forwardRef((props,ref)=>{const[store,setStore]=useRatesStore();useEffect(()=>{if(store.rows||store.loading)return;setStore({...store,loading:true});fetch(API_URL).then(r=>r.json()).then(json=>{setStore({rows:Array.isArray(json?.data)?json.data:[],loading:false});}).catch(()=>{setStore({rows:[],loading:false});});},[store]);const token=parseToken(props.text);if(!token)return /*#__PURE__*/_jsx(Component,{...props,ref:ref});const row=store.rows?.[token.index];if(!row)return /*#__PURE__*/_jsx(Component,{...props,ref:ref,text:\"\"});let text=\"\";if(token.kind===\"ask\")text=formatPercent(row.bestAsk);if(token.kind===\"bid\")text=formatPercent(row.bestBid);if(token.kind===\"dur\")text=formatDays(row.daysUntilSettlement);if(token.kind===\"date\")text=formatDate(row.date);return /*#__PURE__*/_jsx(Component,{...props,ref:ref,text:text});});}/* ========= ROW VISIBILITY (CSS-DRIVEN) ========= */export function withRatesRowVisibility(Component){return /*#__PURE__*/forwardRef((props,ref)=>{const[store,setStore]=useRatesStore();useEffect(()=>{if(store.rows||store.loading)return;setStore({...store,loading:true});fetch(API_URL).then(r=>r.json()).then(json=>{setStore({rows:Array.isArray(json?.data)?json.data:[],loading:false});}).catch(()=>{setStore({rows:[],loading:false});});},[store]);const name=String(props?.name??\"\");const m=name.match(/row-(\\d+)/i);const idx=m?Number(m[1]):null;const exists=idx!=null&&Array.isArray(store.rows)&&idx>=0&&idx<store.rows.length;return /*#__PURE__*/_jsx(Component,{...props,ref:ref,\"data-rates-row\":\"true\",\"data-empty\":exists?\"false\":\"true\"});});}/* ========= ICON COLOR OVERRIDES ========= */function recolor(root,color){root.style.color=color;const nodes=root.querySelectorAll(\"svg, path, rect, circle, ellipse, polygon, polyline, line, g\");nodes.forEach(el=>{el.setAttribute(\"fill\",color);el.setAttribute(\"stroke\",color);el.style.fill=color;el.style.stroke=color;});}export function withBankIconInvestColor(Component){return props=>{const ref=useRef(null);useEffect(()=>{if(ref.current)recolor(ref.current,\"#E8E9E6\");},[]);return /*#__PURE__*/_jsx(Component,{...props,ref:ref});};}export function withCreditCardIconInvestColor(Component){return props=>{const ref=useRef(null);useEffect(()=>{if(ref.current)recolor(ref.current,\"#000000\");},[]);return /*#__PURE__*/_jsx(Component,{...props,ref:ref});};}\nexport const __FramerMetadata__ = {\"exports\":{\"withRatesRowVisibility\":{\"type\":\"reactHoc\",\"name\":\"withRatesRowVisibility\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withBankIconInvestColor\":{\"type\":\"reactHoc\",\"name\":\"withBankIconInvestColor\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withCreditCardIconInvestColor\":{\"type\":\"reactHoc\",\"name\":\"withCreditCardIconInvestColor\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withFullWidthFramerImage\":{\"type\":\"reactHoc\",\"name\":\"withFullWidthFramerImage\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withRatesTokens\":{\"type\":\"reactHoc\",\"name\":\"withRatesTokens\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./Fullsize_image.map"],"mappings":"yLAA8E,SAAgB,EAAY,EAAO,CACjH,IAAM,EAAU,EAAK,CAAC,MAAM,OAAO,OAAO,CAAC,GAAG,EAAO,CAAC,CAAC,CAAC,CAClD,EAAa,GAAU,CAC1B,OAAO,GAAW,aAAY,EAAS,EAAS,EAAU,MAAM,EAAE,EAAU,MAAM,OAAO,OAAO,CAAC,GAAG,EAAU,MAAM,GAAG,EAAS,CAAC,EAChI,EAAW,OAAO,GAAS,SAAS,OAAO,OAAO,CAAC,GAAG,EAAO,CAAC,CAAC,EAC7D,EAAa,IAAI,IACjB,EAAc,GAAU,CAC3B,OAAO,GAAW,aAAY,EAAS,EAAS,EAAW,EAAE,EAAW,OAAO,GAAW,SAAS,OAAO,OAAO,CAAC,GAAG,EAAW,GAAG,EAAS,CAAC,CAAC,EACjJ,EAAa,QAAQ,GAAQ,EAAO,EAAW,CAAC,EAChD,SAAS,GAAU,CACnB,GAAK,CAAC,EAAM,GAAUA,EAAS,EAAW,CAK1C,OAHA,OACA,EAAa,IAAI,EAAS,KAAW,EAAa,OAAO,EAAS,EAAG,EAAE,CAAC,CACrE,GAAgB,GAAG,IAAM,GAAgB,CAAO,CAAC,EAAU,MAAM,EAAa,EAC3E,CAAC,EAAM,EAAc,CAAG,OAAO,mBAfC,IAAwC,qBEAiF,SAAgB,EAAyB,EAAU,CAAC,MAAO,IAAO,CAAC,IAAM,EAAIC,EAAO,KAAK,C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