(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[9393],{1461:function(e,t,i){(window.__NEXT_P=window.__NEXT_P||[]).push(["/pi-cycle-top-indicator",function(){return i(718)}])},718:function(e,t,i){"use strict";i.r(t),i.d(t,{default:function(){return PiCycleTop}});var n=i(5893),a=i(9008),r=i.n(a),s=i(7294),o=i(7626),l=i(5912),c=i(1526),h=i(6720),d=i(6488);i(4321),i(813);var m=i(8231),u=i(6204),p=i(9599),g=i(8688);function PiCycleTop(){let[e,t]=(0,s.useState)(!1),[i,a]=(0,s.useState)(!0),[l,x]=(0,s.useState)("isInfoVisible"),[f,v]=(0,s.useState)(!1),[w,y]=(0,s.useState)("ALL"),[b,_]=(0,s.useState)([]),[j,M]=(0,s.useState)("BTC"),[D,T]=(0,s.useState)([]),[C,S]=(0,s.useState)(!1),[I,A]=(0,s.useState)(!1);(0,s.useEffect)(()=>{let e=window.location.pathname,t="isInfoVisible_".concat(e);x(t);let i=localStorage.getItem(t);null!==i&&a("false"!==i)},[]),(0,s.useEffect)(()=>{let e=setTimeout(()=>{S(!0)},1500);return()=>clearTimeout(e)},[]);let toggleInfo=()=>{let e=!i;localStorage.setItem(l,e.toString()),a(e)};(0,s.useEffect)(()=>{(0,d.ZP)(":not(.sidebar-tooltip)[data-tippy-content]",{placement:"bottom",theme:"customTheme"})},[]);let k=(0,s.useRef)(null),calculateSMA=(e,t,i)=>{let n=m.Ux.calculate({period:t,values:e});return n.slice(-10).map((e,t)=>({date:i[i.length-10+t],value:e})),n},findCrossings=(e,t,i)=>{let n=[],a=Math.min(e.length,t.length);for(let r=1;r<a;r++)if(void 0!==e[r]&&void 0!==t[r]){i[r].timestamp;let a=e[r-110],s=t[r-349];if(void 0!==a&&void 0!==s){let i=e[r-111],o=t[r-350];i<o&&a>s&&n.push(r)}}return n},setTimeRange=e=>{let t;y(e);let i=new Date;switch(e){case"5Y":t=new Date(i.setFullYear(i.getFullYear()-5));break;case"1Y":t=new Date(i.setFullYear(i.getFullYear()-1));break;case"6M":t=new Date(i.setMonth(i.getMonth()-6));break;case"3M":t=new Date(i.setMonth(i.getMonth()-3));break;default:t=new Date("2010-01-01")}let n=b.filter(e=>new Date(e.timestamp)>=t),a=n.map(e=>e.timestamp),r=b.map(e=>e.close),s=b.map(e=>e.timestamp),o={"111DMA":calculateSMA(r,111,s),"350DMA*2":calculateSMA(r,350,s).map(e=>2*e)},l=findCrossings(o["111DMA"],o["350DMA*2"],b),c=k.current;if(c){let e=c.getContext("2d");e&&(e.clearRect(0,0,c.width,c.height),drawChart(n,o,l,a))}},N=(0,g.eI)("https://swmkwzrguapkaodkgcmt.supabase.co","eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6InN3bWt3enJndWFwa2FvZGtnY210Iiwicm9sZSI6ImFub24iLCJpYXQiOjE3MTIxODI1NDMsImV4cCI6MjAyNzc1ODU0M30.At51g7QDyI7Pk-nx_-S5ShAcme7bjhSUqX8YsVvGB9A"),z=["USDT","USDC","DAI","LEO","USDe","FDUSD","PYUSD","USDD","FRAX","SUSD","AUD","USDP","BUSD","TUSD"];(0,s.useEffect)(()=>{let fetchCoins=async()=>{t(!0);try{var e;let{data:t,error:i}=await N.from("daily_candles").select("token");if(i)throw i;let n=t.map(e=>e.token.replace("USDT","")),{data:a,error:r}=await N.from("market_cap").select("symbol, market_cap").in("symbol",n).order("market_cap",{ascending:!1});if(r)throw r;let s=Array.from(new Map(a.filter(e=>!z.includes(e.symbol)).map(e=>[e.symbol,e])).values()),o=s.map(e=>({value:e.symbol,label:e.symbol}));T(o),M((null===(e=o[0])||void 0===e?void 0:e.value)||"BTC")}catch(e){console.error("Error fetching coins:",e.message)}finally{t(!1)}};fetchCoins()},[]);let formatAxisLabel=e=>e>=1?e.toFixed(0):e>=.01?e.toFixed(2):e.toFixed(6),formatPrice=e=>e>1e3?e.toFixed(0):e>=1?e.toFixed(2):e>=.01?e.toFixed(2):e.toFixed(6);(0,s.useEffect)(()=>{let fetchData=async()=>{try{let e="".concat(j,"USDT"),{data:t,error:i}=await N.from("daily_candles").select("candles").eq("token",e);if(i)throw Error("Error fetching ".concat(j," data from Supabase: ").concat(i.message));if(!t||0===t.length){console.warn("".concat(j," has no available candlestick data.")),A(!0);return}let n=t[0].candles.map(e=>({timestamp:new Date(e.timestamp).toISOString().split("T")[0],open:e.open,high:e.high,low:e.low,close:e.close,volume:e.volume}));n.length<350?A(!0):A(!1);let a=n.map(e=>e.close),r=n.map(e=>e.timestamp),s={"111DMA":calculateSMA(a,111,r),"350DMA*2":calculateSMA(a,350,r).map(e=>2*e)};findCrossings(s["111DMA"],s["350DMA*2"],n),_(n),setTimeRange("ALL")}catch(e){console.error("Failed to fetch data for ".concat(j,":"),e),A(!0)}};return fetchData(),window.addEventListener("resize",fetchData),()=>{window.removeEventListener("resize",fetchData)}},[j]),(0,s.useEffect)(()=>{if(b.length>0){let e=b.map(e=>e.close),t=b.map(e=>e.timestamp),i={"111DMA":calculateSMA(e,111,t),"350DMA*2":calculateSMA(e,350,t).map(e=>2*e)},n=i["111DMA"],a=i["350DMA*2"],r=findCrossings(n,a,b),s=k.current;if(s){let e=s.getContext("2d");e&&(e.clearRect(0,0,s.width,s.height),drawChart(b,i,r,t))}}},[b,C]);let generateDailyDates=(e,t)=>{let i=[],n=new Date(e),a=new Date(t);for(;n<=a;)i.push(new Date(n).toISOString().split("T")[0]),n.setDate(n.getDate()+1);return i},drawChart=(e,t,i,n)=>{let a=k.current;if(!a)return;let r=a.getContext("2d");if(!r)return;let s=document.createElement("canvas"),o=s.getContext("2d"),l=a.parentElement,c=l.clientWidth,h=l.clientHeight;a.width=2*c,a.height=2*h,a.style.width="".concat(c,"px"),a.style.height="".concat(h,"px"),r.scale(2,2),s.width=2*c,s.height=2*h,o.scale(2,2);let d=50,m=50;c<=1024?(d=45,m=5):(d=50,m=50);let u=Math.max(...e.map(e=>e.close)),p=Math.min(...e.map(e=>e.close)),g=Math.max(...t["111DMA"].slice(-e.length)),x=Math.min(...t["111DMA"].slice(-e.length)),f=Math.max(...t["350DMA*2"].slice(-e.length)),v=Math.min(...t["350DMA*2"].slice(-e.length)),w=Math.max(u,g,f),y=Math.min(p,x,v),_=(h-20-30)/(Math.log10(w)-Math.log10(y));if(0===e.length)return;let M=generateDailyDates(e[0].timestamp,new Date().toISOString().split("T")[0]);o.clearRect(0,0,s.width,s.height);let drawCrossings=(e,t,i,n,a,r,s,o,l,c,h,d)=>{e.strokeStyle="lightgrey",e.lineWidth=1,t.forEach(t=>{var i;let h=null===(i=b[t])||void 0===i?void 0:i.timestamp;if(h&&n.includes(h)){let t=s+n.indexOf(h)*(a-s-o)/(n.length-1);e.beginPath(),e.moveTo(t,c),e.lineTo(t,r-l),e.stroke();let i=new Date(h).getFullYear(),d="".concat(i," Bull Market Top");e.save(),e.translate(t-5,r-l-80),e.rotate(-Math.PI/2),e.textAlign="right",e.font="8px Oxanium, Helvetica, Verdana, Tahoma, sans-serif",e.fillStyle="white",e.fillText(d,0,0),e.restore()}})},drawAxes=(e,t)=>{let i,n;let a=(Math.log10(w)-Math.log10(y))/5;e.fillStyle="lightgrey",e.textAlign="right",e.font="10px Oxanium, Helvetica, Verdana, Tahoma, sans-serif",e.textBaseline="middle";for(let t=0;t<=5;t++){let i=Math.pow(10,Math.log10(y)+t*a),n=h-30-(Math.log10(i)-Math.log10(y))*_;e.fillText("".concat(formatAxisLabel(i)),d-10,n),e.strokeStyle="rgba(255, 255, 255, 0.7)",e.lineWidth=.1,e.beginPath(),e.moveTo(d,n),e.lineTo(c-m,n),e.stroke()}e.fillStyle="lightgrey",e.textAlign="center",e.textBaseline="middle",e.font="10px Oxanium, Helvetica, Verdana, Tahoma, sans-serif";let r=t.length,s=window.innerWidth<=768;r>=3650?(i=s?730:365,n="year"):r>=500?(i=s?730:365,n="year"):(i=s?90:30,n="month");let o=new Date(t[0].timestamp),l=new Date(t[t.length-1].timestamp);for(;o<=l;o.setDate(o.getDate()+i)){let t=new Date(o).toISOString().split("T")[0],i=d+M.indexOf(t)*(c-d-m)/(M.length-1);i>d&&i<c-m&&("year"===n?e.fillText(new Date(o).getFullYear(),i,h-30+20):e.fillText(new Date(o).toLocaleString("default",{month:"short"}),i,h-30+20))}};(n=>{n.clearRect(0,0,c,h),n.fillStyle="#171a1e",n.fillRect(0,0,c,h);let drawLine=function(e,t,i,n){let a=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0;e.strokeStyle=i,e.lineWidth=n,e.beginPath();let r=!0;t.forEach((t,i)=>{var n;if(null===t||i+a>=b.length)return;let s=null===(n=b[i+a])||void 0===n?void 0:n.timestamp;if(s){let i=d+M.indexOf(s)*(c-d-m)/(M.length-1);if(i>=d&&i<=c-m){let n=h-30-(Math.log10(t)-Math.log10(y))*_;r?(e.moveTo(i,n),r=!1):e.lineTo(i,n)}}}),e.stroke()},a=b.map(e=>e.close);drawLine(n,a,"orange",1),drawLine(n,t["111DMA"],"#0ea5e9",2,110),drawLine(n,t["350DMA*2"],"green",2,349),drawAxes(n,e),drawCrossings(n,i,e,M,c,h,d,m,30,20,y,_)})(o);let D=new Image;D.src="/assets/images/mainLogoLetters.png",D.onload=()=>{r.globalAlpha=.75,o.drawImage(D,60,25,101.4,30.2),r.globalAlpha=1,r.clearRect(0,0,c,h),r.drawImage(s,0,0,c,h)};let T=document.getElementById("cumulative-tooltip"),handleMouseMove=e=>{let t=a.getBoundingClientRect(),i=e.clientX-t.left,n=e.clientY-t.top,o=i<d,l=i>c-m,u=n>h-30;if(o||l||u){T.style.display="none",r.clearRect(0,0,c,h),r.drawImage(s,0,0,c,h);return}if(i<d||i>c-m)return;let p=Math.round((i-d)*(M.length-1)/(c-d-m));if(p<0||p>=M.length)return;let g=M[p],x=b.find(e=>e.timestamp===g),f=b.map(e=>e.close),v=b.map(e=>e.timestamp),_={"111DMA":calculateSMA(f,111,v),"350DMA*2":calculateSMA(f,350,v).map(e=>2*e)},D=v.findIndex(e=>e===g)-110,C=v.findIndex(e=>e===g)-349,S={"111DMA":D>=0?_["111DMA"][D]:void 0,"350DMA*2":C>=0?_["350DMA*2"][C]:void 0};T.style.display="block",T.style.left="".concat(i+10,"px"),T.style.top="".concat(n+10,"px"),i+50+T.offsetWidth>c?T.style.left="".concat(i-T.offsetWidth-60,"px"):T.style.left="".concat(i+30,"px"),n+10+T.offsetHeight>h?T.style.top="".concat(n-T.offsetHeight-10,"px"):T.style.top="".concat(n+10,"px");let I=x?"$".concat(formatPrice(x.close)):"N/A",A=void 0!==S["111DMA"]?"$".concat(formatPrice(S["111DMA"])):"Not enough data",k=void 0!==S["350DMA*2"]?"$".concat(formatPrice(S["350DMA*2"])):"Not enough data";T.innerHTML="\n Date: ".concat(new Date(g).toLocaleDateString("en-GB"),"<br>\n ").concat(x?'\n <span style="display: flex; align-items: center;">\n <img src="https://lcw.nyc3.cdn.digitaloceanspaces.com/production/currencies/64/'.concat(j.toLowerCase(),'.png" class="w-2" alt="Bitcoin logo" style="width: 16px; vertical-align: middle; margin-right: 4px;" /> \n ').concat(j," Price: ").concat(I,"\n </span>\n "):"",'\n <div style="display: flex; justify-content: flex-start; align-items: center;">\n <div style="width: 10px; height: 10px; background-color: #277f00; margin-right: 6px; margin-bottom: 3px;"></div>\n <div>350MA x2: ').concat(k,'</div>\n </div>\n <div style="display: flex; justify-content: flex-start; align-items: center;">\n <div style="width: 10px; height: 10px; background-color: #3fa5ea; margin-right: 6px; margin-bottom: 3px;"></div>\n <div>111MA: ').concat(A,"</div>\n </div>\n "),r.clearRect(0,0,c,h),r.drawImage(s,0,0,c,h),r.strokeStyle="rgba(255, 255, 255, 0.5)",r.lineWidth=.7,r.setLineDash([5,5]),r.beginPath(),r.moveTo(i,0),r.lineTo(i,h),r.moveTo(0,n),r.lineTo(c,n),r.stroke(),r.setLineDash([]);let N=Math.log10(y),z=Math.log10(w),O=Math.pow(10,N+(h-n-30)/(h-20-30)*(z-N));r.fillStyle="rgba(63, 63, 70, 1)",r.fillRect(d-70,n-10,70,20),r.fillStyle="white",r.font="10px Oxanium, Helvetica, Verdana, Tahoma, sans-serif",r.textAlign="right",r.fillText(formatPrice(O),d-3,n+2.5),r.fillStyle="rgba(63, 63, 70, 1)",r.fillRect(i-35,h-30+10,70,30),r.fillStyle="white",r.textAlign="center",r.fillText(new Date(g).toLocaleDateString("en-GB"),i,h-30+23)};return a.addEventListener("mousemove",handleMouseMove),a.addEventListener("mouseout",()=>{T.style.display="none",r.clearRect(0,0,c,h),r.drawImage(s,0,0,c,h)}),()=>{a.removeEventListener("mousemove",handleMouseMove)}},drawExtraContent=(e,t,i)=>{let n,a,r,s;let o=window.innerWidth;o>640?(n=28,a=14,r=75,s=35):(n=18,a=12,r=47,s=20),e.font="".concat(a,"px Oxanium"),e.fillStyle="#e4e4e7";let l="Created at TradingDigits.io",c=e.measureText(l).width;e.fillText(l,(t-c)/2,s),e.font="".concat(n,"px Oxanium");let h="".concat(i,", ").concat(new Date().toLocaleDateString()),d=e.measureText(h).width;e.fillText(h,(t-d)/2,r)},downloadChart=(e,t)=>{let i=e.current;i.getContext("2d");let n=document.createElement("canvas"),a=i.width+40,r=i.height+20+40+100;n.width=a,n.height=r;let s=n.getContext("2d");s.fillStyle="#171a1e",s.fillRect(0,0,n.width,n.height),drawExtraContent(s,n.width,t),s.drawImage(i,20,100);let o=document.createElement("a");o.download="".concat(t.replace(/\s+/g,"_").toLowerCase(),".png"),o.href=n.toDataURL("image/png"),o.click()},copyChartToClipboard=async(e,t)=>{let i=e.current;i.getContext("2d");let n=document.createElement("canvas"),a=i.width+40,r=i.height+20+40+100;n.width=a,n.height=r;let s=n.getContext("2d");s.fillStyle="#171a1e",s.fillRect(0,0,n.width,n.height),drawExtraContent(s,n.width,t),s.drawImage(i,20,100),n.toBlob(async e=>{try{let t=new ClipboardItem({"image/png":e});await navigator.clipboard.write([t]),v(!0),setTimeout(()=>v(!1),1e3)}catch(e){console.error("Failed to copy chart: ",e)}})};return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(()=>(0,n.jsx)(n.Fragment,{children:(0,n.jsxs)(r(),{children:[(0,n.jsx)("title",{children:"Pi Cycle Top Indicator: Find Out When the Market Tops Out"}),(0,n.jsx)("meta",{name:"description",content:"The Pi Cycle Top chart uses two simple moving averages—111 and 350x2—which historically predicted Bitcoin macro cycle tops with precision under a week"}),(0,n.jsx)("meta",{name:"keywords",content:"pi, cycle, top, indicator, chart, bitcoin, crypto, altcoin, free, ethereum"}),(0,n.jsx)("meta",{property:"og:title",content:"Pi Cycle Top Indicator: Find Out When the Market Tops Out"}),(0,n.jsx)("meta",{property:"og:description",content:"The Pi Cycle Top chart uses two simple moving averages—111 and 350x2—which historically predicted Bitcoin macro cycle tops with precision under a week"}),(0,n.jsx)("meta",{property:"og:image",content:"https://www.tradingdigits.io/assets/images/ogImage.jpg"}),(0,n.jsx)("meta",{property:"og:url",content:"https://www.tradingdigits.io/pi-cycle-top-indicator"}),(0,n.jsx)("meta",{name:"twitter:title",content:"Pi Cycle Top Indicator: Find Out When the Market Tops Out"}),(0,n.jsx)("meta",{name:"twitter:description",content:"The Pi Cycle Top chart uses two simple moving averages—111 and 350x2—which historically predicted Bitcoin macro cycle tops with precision under a week"}),(0,n.jsx)("meta",{name:"twitter:image",content:"https://www.tradingdigits.io/assets/images/ogImage.jpg"}),(0,n.jsx)("meta",{name:"twitter:card",content:"summary_large_image"}),(0,n.jsx)("meta",{name:"twitter:image:alt",content:"Promotional image with crypto-related illustration on black background, company name, and catchphrase about Trading Digits"}),(0,n.jsx)("meta",{name:"twitter:site",content:"@trading_digits"}),(0,n.jsx)("link",{rel:"canonical",href:"https://www.tradingdigits.io/pi-cycle-top-indicator"}),(0,n.jsx)("link",{rel:"preconnect",href:"https://fonts.googleapis.com"}),(0,n.jsx)("link",{href:"https://fonts.googleapis.com/css2?family=Oxanium:wght@300;400;500;600;700&display=swap",rel:"stylesheet"})]})}),{}),(0,n.jsx)("div",{className:"md:mt-[95px] sm:mt-[90px] mt-[80px]",children:(0,n.jsxs)("div",{className:"pb-3 pt-2 sm:pt-1 ".concat(e?"h-screen":"h-full"," 2.5xl:h-full 3xl:h-screen min-[1540px]:pb-[100px]"),children:[(0,n.jsxs)("div",{className:"flex items-center ".concat(i?"lg:justify-start":"lg:justify-center pb-4"," justify-center my-1.75 text-center"),children:[(0,n.jsx)("h1",{className:"pl-2 sm:text-2xl text-xl font-[Oxanium-Regular]",children:"BITCOIN & ALTCOIN PI CYCLE TOP INDICATOR"}),(0,n.jsx)(c.M,{children:!i&&(0,n.jsx)(h.E.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.5},className:"ml-3",children:(0,n.jsx)("i",{onClick:toggleInfo,className:"fa-solid fa-circle-info fa-lg text-zinc-200 cursor-pointer hover:text-amber-400 transition duration-300"})})})]}),(0,n.jsx)(c.M,{children:i&&(0,n.jsxs)(h.E.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.5},className:"relative px-2 py-2 flex items-center mr-0 mb-8 bg-[#363738] justify-center w-full",children:[(0,n.jsx)("i",{className:"fa-solid fa-circle-info fa-2xl mr-3 text-zinc-200"}),(0,n.jsx)("div",{className:"font-[Oxanium-Regular] sm:text-sm text-xs pr-4",children:(0,n.jsx)("p",{children:"The Pi Cycle Top indicator is a technical analysis tool designed to predict Bitcoin market cycle highs by identifying the crossovers between the 111-day moving average and twice the 350-day moving average. It is widely used to anticipate market tops by signaling potential peak points when these two moving averages intersect, showing historical precision of around 3 to 7 days in predicting macro cycle tops. Not financial advice."})}),(0,n.jsx)("div",{onClick:toggleInfo,className:"absolute top-0 right-0 flex items-start hover:bg-zinc-500 cursor-pointer py-0.5 px-1 transition duration-300",children:(0,n.jsx)("i",{className:"fa-solid fa-xmark"})})]})}),e?(0,n.jsx)("div",{className:"flex w-full items-center justify-center mt-32",children:(0,n.jsx)("img",{src:o.Y.logoLoading,className:"quick-pulse w-48 ",alt:"Loading..."})}):(0,n.jsxs)(n.Fragment,{children:[I&&(0,n.jsx)("div",{className:"w-full text-center sm:text-sm text-xs bg-zinc-800 text-zinc-300 border-1 border-y border-zinc-700 py-1",children:"Warning: The indicator might provide incorrect readings for tokens with insufficient historical trading data."}),(0,n.jsxs)("div",{className:"w-full flex lg:flex-row flex-col items-center justify-between gap-3 text-center sm:text-sm text-xs bg-zinc-800 border-1 border-y border-zinc-700",children:[(0,n.jsx)("div",{className:"flex justify-center items-center mr-2 lg:border-r border-zinc-700",children:(0,n.jsx)(p.default,{value:D.find(e=>e.value===j),onChange:e=>{M(e.value)},options:D,styles:{control:(e,t)=>({...e,backgroundColor:"#27272a",color:"white",borderColor:"transparent",borderRadius:"0px",minWidth:"175px",outline:"none !important",boxShadow:"none !important","&:focus":{outline:"none !important",boxShadow:"none !important"},"&:active":{outline:"none !important",boxShadow:"none !important"},"&:hover":{outline:"none !important"}}),singleValue:e=>({...e,color:"white"}),indicatorSeparator:()=>({display:"none"}),menu:e=>({...e,width:"300px",position:"absolute",zIndex:1e3,backgroundColor:"#212125",color:"white"}),menuList:e=>({...e,maxHeight:"200px",overflowY:"auto",backgroundColor:"#212125",color:"white"}),option:(e,t)=>({...e,backgroundColor:t.isSelected?"#3f3f46":t.isFocused?"#3f3f46":"#212125",color:"white"}),placeholder:e=>({...e,color:"white"}),input:e=>({...e,color:"white",outline:"none !important",boxShadow:"none !important"}),dropdownIndicator:(e,t)=>({...e,color:t.isHovered?"#ffffff":"#a1a1aa","&:hover":{color:"#71717a"}})},formatOptionLabel:e=>{let{value:t,label:i}=e;return(0,n.jsxs)("div",{style:{display:"flex",alignItems:"center",fontSize:"13px"},children:[(0,n.jsx)("img",{src:"https://lcw.nyc3.cdn.digitaloceanspaces.com/production/currencies/64/".concat(t.toLowerCase(),".png"),alt:"".concat(i," logo"),style:{width:20,height:20,marginRight:10}}),i]})}})}),(0,n.jsxs)("div",{className:"flex items-center gap-3 text-center pl-3 sm:text-presm text-xs font-[Oxanium-Light]",children:[(0,n.jsx)("div",{className:"flex flex-col justify-center items-center",children:(0,n.jsxs)("div",{className:"flex justify-center items-center",children:[(0,n.jsx)("div",{className:"w-2.5 h-2.5 bg-[#f7a500] mr-1.5"}),(0,n.jsxs)("div",{children:[j," Price"]})]})}),(0,n.jsx)("div",{className:"flex flex-col justify-center items-center",children:(0,n.jsxs)("div",{className:"flex justify-center items-center",children:[(0,n.jsx)("div",{className:"w-2.5 h-2.5 bg-[#55a5eb] mr-1.5"}),(0,n.jsx)("div",{children:"111MA"})]})}),(0,n.jsx)("div",{className:"flex flex-col justify-center items-center",children:(0,n.jsxs)("div",{className:"flex justify-center items-center",children:[(0,n.jsx)("div",{className:"w-2.5 h-2.5 bg-[#377f00] mr-1.5"}),(0,n.jsx)("div",{children:"350MA x2"})]})})]}),(0,n.jsxs)("div",{className:"flex flex-row justify-end gap-1",children:[(0,n.jsxs)("div",{className:"flex justify-center items-center gap-[1px] text-presm",children:[(0,n.jsx)("button",{onClick:()=>setTimeRange("3M"),className:"px-2 py-2 hover:rounded-sm transition duration-300 flex items-center justify-center ".concat("3M"===w?"bg-zinc-700 text-white":"bg-zinc-800 hover:bg-zinc-700"),children:"3M"}),(0,n.jsx)("button",{onClick:()=>setTimeRange("6M"),className:"px-2 py-2 hover:rounded-sm transition duration-300 flex items-center justify-center ".concat("6M"===w?"bg-zinc-700 text-white":"bg-zinc-800 hover:bg-zinc-700"),children:"6M"}),(0,n.jsx)("button",{onClick:()=>setTimeRange("1Y"),className:"px-2 py-2 hover:rounded-sm transition duration-300 flex items-center justify-center ".concat("1Y"===w?"bg-zinc-700 text-white":"bg-zinc-800 hover:bg-zinc-700"),children:"1Y"}),(0,n.jsx)("button",{onClick:()=>setTimeRange("5Y"),className:"px-2 py-2 hover:rounded-sm transition duration-300 flex items-center justify-center ".concat("5Y"===w?"bg-zinc-700 text-white":"bg-zinc-800 hover:bg-zinc-700"),children:"5Y"}),(0,n.jsx)("button",{onClick:()=>setTimeRange("ALL"),className:"px-2 py-2 hover:rounded-sm transition duration-300 flex items-center justify-center ".concat("ALL"===w?"bg-zinc-700 text-white":"bg-zinc-800 hover:bg-zinc-700"),children:"All"})]}),(0,n.jsxs)("div",{className:"flex pl-[3px] pr-[3px] border-l border-zinc-700",children:[(0,n.jsx)("button",{className:"px-2 py-2 hover:rounded-sm bg-zinc-800 hover:bg-zinc-700 transition duration-300 flex items-center justify-center ".concat(f?"animate-flip":""),onClick:()=>copyChartToClipboard(k,"".concat(j," Pi Cycle Top Indicator")),children:(0,n.jsx)(u.esY,{className:"text-zinc-300 text-base"})}),(0,n.jsx)("button",{className:"px-2 py-2 hover:rounded-sm bg-zinc-800 hover:bg-zinc-700 transition duration-300 flex items-center justify-center",onClick:()=>downloadChart(k,"".concat(j," Pi Cycle Top Indicator")),children:(0,n.jsx)(u.aBF,{className:"text-zinc-300 text-base"})})]})]})]}),(0,n.jsxs)("div",{className:"h-[500px] sm:w-full w-full relative flex flex-col mb-12 bg-[#171a1e] px-5 border-1 border-b border-zinc-700",children:[(0,n.jsx)("div",{className:"w-full flex max-[1080px]:flex-col flex-row justify-between max-[1080px]:items-center max-[1080px]:gap-3"}),(0,n.jsx)("div",{className:"h-full",children:(0,n.jsx)("canvas",{ref:k,className:""})}),(0,n.jsx)("div",{id:"cumulative-tooltip",style:{position:"absolute",backgroundColor:"rgba(0, 0, 0, 0.7)",color:"white",padding:"5px",borderRadius:"5px",pointerEvents:"none",display:"none"}})]})]})]})})]})}PiCycleTop.layout=l.Z},529:function(e,t,i){"use strict";i.d(t,{z$:function(){return Indicator}});let n={};function format(e){let t=n.precision;return t?parseFloat(e.toPrecision(t)):e}let Indicator=class Indicator{constructor(e){this.format=e.format||format}static reverseInputs(e){e.reversedInput&&(e.values&&e.values.reverse(),e.open&&e.open.reverse(),e.high&&e.high.reverse(),e.low&&e.low.reverse(),e.close&&e.close.reverse(),e.volume&&e.volume.reverse(),e.timestamp&&e.timestamp.reverse())}getResult(){return this.result}}},8231:function(e,t,i){"use strict";i.d(t,{Ux:function(){return SMA}});var n=i(529);let Item=class Item{constructor(e,t,i){this.next=i,i&&(i.prev=this),this.prev=t,t&&(t.next=this),this.data=e}};let LinkedList=class LinkedList{constructor(){this._length=0}get head(){return this._head&&this._head.data}get tail(){return this._tail&&this._tail.data}get current(){return this._current&&this._current.data}get length(){return this._length}push(e){this._tail=new Item(e,this._tail),0===this._length&&(this._head=this._tail,this._current=this._head,this._next=this._head),this._length++}pop(){var e=this._tail;return 0===this._length?void 0:((this._length--,0===this._length)?this._head=this._tail=this._current=this._next=void 0:(this._tail=e.prev,this._tail.next=void 0,this._current===e&&(this._current=this._tail,this._next=void 0)),e.data)}shift(){var e=this._head;return 0===this._length?void 0:((this._length--,0===this._length)?this._head=this._tail=this._current=this._next=void 0:(this._head=this._head.next,this._current===e&&(this._current=this._head,this._next=this._current.next)),e.data)}unshift(e){this._head=new Item(e,void 0,this._head),0===this._length&&(this._tail=this._head,this._next=this._head),this._length++}unshiftCurrent(){var e=this._current;return e===this._head||this._length<2?e&&e.data:(e===this._tail?(this._tail=e.prev,this._tail.next=void 0,this._current=this._tail):(e.next.prev=e.prev,e.prev.next=e.next,this._current=e.prev),this._next=this._current.next,e.next=this._head,e.prev=void 0,this._head.prev=e,this._head=e,e.data)}removeCurrent(){var e=this._current;return 0===this._length?void 0:((this._length--,0===this._length)?this._head=this._tail=this._current=this._next=void 0:(e===this._tail?(this._tail=e.prev,this._tail.next=void 0,this._current=this._tail):e===this._head?(this._head=e.next,this._head.prev=void 0,this._current=this._head):(e.next.prev=e.prev,e.prev.next=e.next,this._current=e.prev),this._next=this._current.next),e.data)}resetCursor(){return this._current=this._next=this._head,this}next(){var e=this._next;if(void 0!==e)return this._next=e.next,this._current=e,e.data}};let SMA=class SMA extends n.z${constructor(e){super(e),this.period=e.period,this.price=e.values;var genFn=function*(e){var t,i=new LinkedList,n=0,a=1,r=yield;for(i.push(0);;)a<e?(a++,i.push(r),n+=r):(t=(n=n-i.shift()+r)/e,i.push(r)),r=yield t};this.generator=genFn(this.period),this.generator.next(),this.result=[],this.price.forEach(e=>{var t=this.generator.next(e);void 0!==t.value&&this.result.push(this.format(t.value))})}nextValue(e){var t=this.generator.next(e).value;if(void 0!=t)return this.format(t)}};SMA.calculate=function(e){n.z$.reverseInputs(e);var t=new SMA(e).result;return e.reversedInput&&t.reverse(),n.z$.reverseInputs(e),t}},7326:function(e,t,i){"use strict";function _assertThisInitialized(e){if(void 0===e)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return e}i.d(t,{Z:function(){return _assertThisInitialized}})},7462:function(e,t,i){"use strict";function _extends(){return(_extends=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var i=arguments[t];for(var n in i)Object.prototype.hasOwnProperty.call(i,n)&&(e[n]=i[n])}return e}).apply(this,arguments)}i.d(t,{Z:function(){return _extends}})},9611:function(e,t,i){"use strict";function _setPrototypeOf(e,t){return(_setPrototypeOf=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e})(e,t)}i.d(t,{Z:function(){return _setPrototypeOf}})}},function(e){e.O(0,[8391,4738,4817,2510,4396,5372,8688,9599,5912,9774,2888,179],function(){return e(e.s=1461)}),_N_E=e.O()}]);