1import{E as h,Z as N,a9 as E,V as S,_ as b}from"#entry";import{u as k,f as O}from"./BJgZh6I2.js";const m=1e5,f=21e14,P=.9999999999960264,_=new Date("2024-11-19T16:00:00.000Z"),D=0x4949f1a191a24,g=new Date("2024-11-19T16:45:20.000Z"),T=1289310965406244e-5,R=1203075533952899e-5,d=.0003432600460362;function v(e){const{currentlyStakedNim:t,days:a=365,fee:o=0}=e;if(!Number.isFinite(t)||t<=0)return 0;if(o<0||o>1)throw new Error(`Invalid fee: ${o}. It must be between 0 and 1.`);const n=Date.now(),r=I(n),s=I(n+a*24*60*60*1e3),i=t*m;return(s-r)/i*(1-o)}function M(e){const{amount:t=1e5,days:a=365,autoRestake:o=!0,stakedSupplyRatio:n,network:r="main-albatross",fee:s=0}=e;if(n<0||n>1)throw new Error(`Invalid stakedSupplyRatio: ${n}. It must be in the range [0, 1].`);if(s<0||s>1)throw new Error(`Invalid fee: ${s}. It must be between 0 and 1.`);const i=r==="test-albatross"?R:T,p=L(Date.now()-1440*60*1e3,{network:r}),c=L(Date.now(),{network:r})-p,w=Math.E**(-d*a);let l=0;o?l=c/(d*n*i)*(1-w):l=1/n*(Math.log(d*i*(1/w)+c*(1/w)-c)-d*a-Math.log(d*i)),l*=1-s;const y=t*(1+l);return{totalAmount:y,gain:y-t,gainRatio:l}}function I(e){const t=e-_.getTime();if(t<0)throw new Error(`Invalid timestamp: ${e}. It must be greater than ${_.getTime()}.`);return f-(f-D)*A(P,t)}function L(e,{network:t="main-albatross"}={}){const a=e-g.getTime();if(a<0)throw new Error(`Invalid timestamp: ${e}. It must be greater than ${g.getTime()}.`);return(f-(f-(t==="test-albatross"?R:T)*m)*A(P,a))/m}function A(e,t){if(t<0&&(e=1/e,t*=-1),!t)return 1;let a=1;for(;t>1;)t%2&&(a*=e,t-=1),e*=e,t/=2;return e*a}function C(e={}){const t=S(()=>b(e.enabled)??!0),{data:a,status:o,error:n,refresh:r}=h("/api/staking-info",{immediate:t.value,watch:!1},"$gi86nSB848");N(t,u=>{u&&!a.value&&r()});const s=S(()=>a.value?.stakedRatio),i=k(),p=S(()=>{const u=a.value?.staked;if(!u)return null;const c=v({currentlyStakedNim:u});return O(c,i.value)});return{stakingRatio:s,stakingRatioState:E(o),annualRewardPercentage:p,error:E(n),refresh:r}}export{M as c,C as u};
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.