1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[805],{62883:function(e,t,s){s.r(t),s.d(t,{default:function(){return Fibo}});var r=s(57437),a=s(2265),o=s(65251),n=s(62167),l=s(16691),i=s.n(l),d=s(8354),c=s(50260),u=s(83984),m=s(86618);function generateGUID(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(e){let t=16*Math.random()|0;return("x"===e?t:3&t|8).toString(16)})}let x="fibo_chat_history",h={sender:"bot",text:"Welcome! I'm Fibo, may I help you with CivFund? :)"},p=["How does depositing work?","What is an epoch?","How do I claim my funds?","What are the fees?"];function loadStoredChat(){try{let e=localStorage.getItem(x);if(!e)return null;let t=JSON.parse(e);if(!(null==t?void 0:t.sessionId)||!Array.isArray(null==t?void 0:t.messages)||0===t.messages.length)return null;return t}catch(e){return null}}function saveStoredChat(e,t){try{localStorage.setItem(x,JSON.stringify({sessionId:e,messages:t}))}catch(e){}}let b=/^https?:\/\/etherscan\.io\/address\/(0x[a-fA-F0-9]{40})$/;function shortenEtherscanLink(e,t){let s=null==e?void 0:e.match(b);return s?s[1]:t}function parseLinks(e){let t=/(https?:\/\/[^\s]+)/g,s=e.split(t);return s.map((e,s)=>{if(!t.test(e))return e;{let t=e,o="";return e.endsWith(".")&&(t=e.slice(0,-1),o="."),(0,r.jsxs)(a.Fragment,{children:[(0,r.jsx)("a",{href:t,target:"_blank",rel:"noopener noreferrer",className:"underline text-cartoonYellow break-all",children:shortenEtherscanLink(t,t)}),o]},s)}})}let g={p:e=>{let{children:t}=e;return(0,r.jsx)("p",{className:"mb-2 last:mb-0",children:t})},a:e=>{let{href:t,children:s}=e;return(0,r.jsx)("a",{href:t,target:"_blank",rel:"noopener noreferrer",className:"underline text-cartoonYellow break-all",children:shortenEtherscanLink(t,s)})},ul:e=>{let{children:t}=e;return(0,r.jsx)("ul",{className:"list-disc pl-5 mb-2 space-y-0.5",children:t})},ol:e=>{let{children:t}=e;return(0,r.jsx)("ol",{className:"list-decimal pl-5 mb-2 space-y-0.5",children:t})},li:e=>{let{children:t}=e;return(0,r.jsx)("li",{children:t})},strong:e=>{let{children:t}=e;return(0,r.jsx)("strong",{className:"font-semibold",children:t})},em:e=>{let{children:t}=e;return(0,r.jsx)("em",{className:"italic",children:t})},code:e=>{let{children:t}=e;return(0,r.jsx)("code",{className:"font-mono text-xs bg-black bg-opacity-25 rounded px-1",children:t})},pre:e=>{let{children:t}=e;return(0,r.jsx)("pre",{className:"bg-black bg-opacity-25 rounded p-2 my-2 overflow-x-auto text-xs",children:t})},blockquote:e=>{let{children:t}=e;return(0,r.jsx)("blockquote",{className:"border-l-2 border-white border-opacity-30 pl-2 italic text-gray-300 my-2",children:t})},table:e=>{let{children:t}=e;return(0,r.jsx)("div",{className:"overflow-x-auto my-2",children:(0,r.jsx)("table",{className:"border-collapse text-xs",children:t})})},th:e=>{let{children:t}=e;return(0,r.jsx)("th",{className:"border border-white border-opacity-20 px-2 py-1 text-left",children:t})},td:e=>{let{children:t}=e;return(0,r.jsx)("td",{className:"border border-white border-opacity-20 px-2 py-1",children:t})}};function Fibo(e){let{apiData:t,poolDataFromSocket:s,theme:l="default"}=e,x=(0,a.useRef)(null);null===x.current&&(x.current=loadStoredChat()||{sessionId:generateGUID(),messages:[{...h,time:new Date().toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})}]});let[b,f]=(0,a.useState)(x.current.messages),[y,w]=(0,a.useState)(x.current.sessionId),[v,j]=(0,a.useState)(""),[k,N]=(0,a.useState)(""),[S,I]=(0,a.useState)(!1),[C,T]=(0,a.useState)(!1),[E,B]=(0,a.useState)(null);(0,a.useEffect)(()=>{saveStoredChat(y,b)},[y,b]);let copyMessage=async(e,t)=>{try{await navigator.clipboard.writeText(e),B(t),setTimeout(()=>B(e=>e===t?null:e),1500)}catch(e){}},setOpenCustom=e=>{T(e),window.innerWidth<768&&(e?fixBody():unfixBody())},D={default:{container:"flex flex-col border border-darkerBackground bg-darkBackground bg-opacity-70 backdrop-blur rounded-lg shadow-lg max-sm:rounded-none",header:"flex items-center p-5 bg-poolDarkBlue text-white rounded-t-lg max-sm:rounded-b-lg max-sm:rounded-t-none",headerAvatar:"bg-white text-blue-500 flex items-center justify-center w-10 h-10 rounded-full overflow-hidden mr-3 text-lg ",headerTitle:"font-semibold text-base",headerSubtitle:"text-xs opacity-90",messages:"fibo-chat-message flex-1 p-4 overflow-y-auto",inputWrapper:"p-3 flex rounded-b-lg bg-poolDarkBlue max-sm:rounded-t-lg max-sm:rounded-b-none",input:"flex-1 bg-darkerBackgroun
1d text-white text-sm rounded-lg px-3 py-2 mr-2 focus:outline-none focus:ring-1 focus:ring-white focus:ring-offset-0",button:"bg-cartoonYellow text-white px-4 py-2 rounded-lg",bubble:{user:"bg-poolDarkBlue text-white text-sm px-3 py-2 rounded-lg max-w-xs break-words",bot:"bg-darkerBackground text-white text-sm px-3 py-2 rounded-lg max-w-xs break-words"},avatar:{user:"bg-blue-500 text-white flex items-center justify-center w-8 h-8 rounded-full overflow-hidden ml-2",bot:"bg-gray-400 text-white flex items-center justify-center w-8 h-8 rounded-full overflow-hidden mr-2"}}},F=D[l]||D.default,A=(0,a.useRef)(null);function fixBody(){let e=window.scrollY||document.documentElement.scrollTop;document.body.dataset.scrollY=e,document.body.style.position="fixed",document.body.style.top="-".concat(e,"px")}function unfixBody(){let e=document.body.dataset.scrollY;document.body.style.position="",document.body.style.top="",document.documentElement.style.height="",document.body.style.height="",window.scrollTo(0,e?parseInt(e,10):0),delete document.body.dataset.scrollY}let M=(0,a.useRef)(null),scrollMessageToBottom=()=>{M.current&&M.current.scrollTo({top:M.current.scrollHeight,behavior:"smooth"})};(0,a.useEffect)(()=>{scrollMessageToBottom()},[b]),(0,a.useEffect)(()=>{setRealtimeInfo()},[t,s]);let setRealtimeInfo=()=>{var e,r,a,o;if(!t||!s)return;let n=parseInt(null==t?void 0:t.epochStartTime),l=n+parseInt(null==t?void 0:t.epochDuration),i=new Date(1e3*n),d=new Date(1e3*l);j(" The followings are some of CivFund's realtime data at this exact moment: \n APY: ".concat((0,u.r)(null==s?void 0:null===(e=s.strategy)||void 0===e?void 0:e.APY,2),"%, \n VPS: ").concat((0,u.r)(null==s?void 0:null===(a=s.fullHistory)||void 0===a?void 0:null===(r=a[s.fullHistory.length-1])||void 0===r?void 0:r[1],4),", \n TVL: $").concat((0,u.R)(null==s?void 0:null===(o=s.strategy)||void 0===o?void 0:o.NAV,2),",\n Epoch start date: ").concat(i.toDateString(),",\n Epoch end date: ").concat(d.toDateString(),",\n Array with percentage variation of all the timestamps: ").concat((0,m.y)(),",\n "))},sendMessage=async e=>{let t=null!=e?e:k;if(!t.trim())return;let s=new Date().toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"}),r={sender:"user",text:t,time:s};f(e=>[...e,r]),N(""),scrollMessageToBottom();try{I(!0);let e=await fetch("/api/fibo",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({sessionId:y,action:"sendMessage",chatInput:v+" "+t})}),s=await e.json(),r={sender:"bot",text:s.output||"Sorry I'm doing some important math and I will not be able to help you at the moment, come back later. In the meantime please refer to the bottom of the website for support :)",time:new Date().toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})};setTimeout(()=>{f(e=>[...e,r]),I(!1)},600)}catch(t){console.error("Error:",t);let e={sender:"bot",text:"Sorry I'm doing some important math and I will not be able to help you at the moment, come back later. In the meantime please refer to the bottom of the website for support :)",time:new Date().toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})};setTimeout(()=>{f(t=>[...t,e]),I(!1)},600)}};return(0,r.jsxs)("div",{className:"fixed bottom-20 right-20 max-sm:bottom-16 max-sm:right-5 ".concat(C?"z-[999999]":"z-30"),children:[(0,r.jsx)(o.E.button,{onClick:()=>setOpenCustom(!C),className:"w-14 h-14 rounded-full border border-gray-600 backdrop-blur-sm text-white shadow-lg flex items-center justify-center text-2xl",whileHover:{scale:1.1,backgroundColor:"#9e7223"},whileTap:{scale:.95},children:C?(0,r.jsx)("p",{className:"text-3xl",children:"\xd7"}):(0,r.jsx)(i(),{src:"/assets/svgs/Icons/message.svg",width:20,height:20,alt:"lighting"})}),(0,r.jsx)(n.M,{children:C&&(0,r.jsxs)(o.E.div,{initial:{opacity:0,scale:.8,y:50},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.8,y:50},transition:{duration:.1},className:"".concat(F.container," absolute w-[400px] h-[600px] bottom-16 right-0 max-sm:fixed max-sm:inset-0 max-sm:m-0 max-sm:rounded-none max-sm:w-full max-sm:h-full"),children:[(0,r.jsxs)("div",{className:"".concat(F.header),children:[(0,r.jsx)("button",{onClick:()=>setOpenCustom(!1),className:"absolute top-2 right-2 text-white text-3xl font-bold sm:hidden md:hidden",children:"\xd7"}),(0,r.jsx)("div",{className:F.headerAvatar,children:(0,r.jsx)(i(),{className:"rounded-full",src:"/assets/jpgs/fibonacCIV.jpg",width:64,height:64,alt:"Fibo Avatar"})}),(0,r.jsxs)("div",{className:"flex-1",children:[(0,r.jsx)("div",{className:F.headerTitle,children:"Fibo Assistant"}),(0,r.jsx)("div",{className:F.headerSubtitle,children:"Here to help with CivFund"})]}),(0,r.jsx)("button",{onClick:()=>{let e=generateGUID(),t=[{...h,time:new Date().toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})}];w(e),f(t),saveStoredChat(e,t)},title:"Start a new chat",className:"text-xs text-white text-opacity-80 hover:text-opacity-100 border border-white border-opacity-20 hover:border-opacity-40 rounded-lg px-2 py-1 transition max-sm:mr-6",children:"New chat"})]}),(0,r.jsxs)("div",{className:F.messages,ref:M,children:[(0,r.jsxs)("div",{className:"bg-darkerBackgroun
1d rounded-12 text-gray-400 text-xs flex flex-center items-center text-center justify-center m-3 p-3 ",children:[" ",(0,r.jsx)("p",{children:"Hi! Fibo uses AI to answer your questions. Responses are generated automatically, without human involvement. Messages are anonymous but not encrypted and may be accessible to others. Do not share personal, sensitive, or confidential information. By using Fibo, you agree to these terms."})]}),1===b.length&&(0,r.jsx)("div",{className:"flex flex-wrap gap-2 mb-3 px-1",children:p.map(e=>(0,r.jsx)("button",{onClick:()=>sendMessage(e),className:"text-xs text-white bg-darkerBackground hover:bg-poolDarkBlue border border-white border-opacity-10 rounded-full px-3 py-1.5 transition",children:e},e))}),b.map((e,t)=>(0,r.jsxs)(o.E.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},transition:{duration:.25},className:"mb-2 flex ".concat("user"===e.sender?"justify-end":"justify-start"),children:["bot"===e.sender&&(0,r.jsx)("div",{className:F.avatar.bot,children:(0,r.jsx)(i(),{className:"rounded-full",src:"/assets/jpgs/fibonacCIV.jpg",width:64,height:64,alt:"Fibo Avatar"})}),(0,r.jsxs)("div",{className:"max-w-xs",children:[(0,r.jsx)("div",{className:"user"===e.sender?"".concat(F.bubble.user," whitespace-pre-wrap"):F.bubble.bot,children:"bot"===e.sender?(0,r.jsx)(d.UG,{remarkPlugins:[c.Z],components:g,children:e.text}):parseLinks(e.text)}),(0,r.jsxs)("div",{className:"flex items-center gap-2 mt-1",children:[(0,r.jsx)("div",{className:"text-xs text-gray-500",children:e.time}),"bot"===e.sender&&(0,r.jsx)("button",{onClick:()=>copyMessage(e.text,t),className:"text-xs text-gray-500 hover:text-white transition",children:E===t?"Copied!":"Copy"})]})]})]},t)),S&&(0,r.jsxs)(o.E.div,{initial:{opacity:0}
1,animate:{opacity:1},className:"flex items-center space-x-2 text-sm",children:[(0,r.jsx)("div",{className:F.avatar.bot,children:(0,r.jsx)(i(),{className:"rounded-full",src:"/assets/jpgs/fibonacCIV.jpg",width:64,height:64,alt:"Fibo Avatar"})}),(0,r.jsx)("div",{className:"bg-darkerBackground text-white px-3 py-4 rounded-lg flex space-x-1 items-center",children:[0,1,2].map(e=>(0,r.jsx)(o.E.span,{className:"w-2 h-2 bg-white rounded-full",animate:{y:["0%","-50%","0%"]},transition:{repeat:1/0,repeatType:"loop",duration:.6,delay:.2*e}},e))})]})]}),(0,r.jsxs)("div",{className:F.inputWrapper,children:[(0,r.jsx)("input",{ref:A,className:F.input,value:k,onChange:e=>N(e.target.value),placeholder:"Type a message...",onKeyDown:e=>{("Enter"===e.key||"Escape"===e.key)&&sendMessage()},onFocus:()=>{window.visualViewport&&setTimeout(()=>{A.current.scrollIntoView({behavior:"smooth",block:"center"})},300)}}),(0,r.jsx)("button",{onClick:()=>sendMessage(),className:F.button,children:"Send"})]})]})})]})}}}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.