1import{j as e,Y as oe,ab as re,Z as ie}from"./vendor-ui-BfO2VaBV.js";import{a as T}from"./vendor-redux-DAFPkm2K.js";import{c as ce,X as N,t as n,n as p,B as o,j6 as pe,r as I,j3 as le,s as c,j2 as de,b as me,y as ue,E,G as xe,x as ge,j7 as he,iJ as ke,u as Se,ag as k,e as fe,j8 as _e,j1 as je,C as be,Y as ye,p as v,a2 as Ce,J as P,z as Fe,j9 as we}from"./index-iXJSSkdU.js";import{a as Be,b as q}from"./utils-CwR0w4rM.js";import{f as Te}from"./currency.service-DAk7tBfK.js";import{c as Ne,d as Ee}from"./transaction-8WZFJ3X5.js";import{I as ve,S as Pe,g as qe,h as De,N as Ie,C as Re}from"./Common.styled-DP4o8TVm.js";import{u as Ae}from"./useSpsValues-RYoRsz95.js";import"./vendor-blockchain-B33N8Jyr.js";import"./three-DYsWAOM3.js";import"./maps-BKggpbsI.js";import"./purchases.service-D8pcDxOy.js";import"./web3-WYqjMTYg.js";import"./bignumber-B1z4pYDt.js";import"./react-number-format.es-4hMs4u0_.js";const Le=()=>{const s=ce.c(3);let i;s[0]===Symbol.for("react.memo_cache_sentinel")?(i={token:N.SPS,name:"liquid",tooltip:n("stake_unstake_page.liquid_tooltip")},s[0]=i):i=s[0];let d;s[1]===Symbol.for("react.memo_cache_sentinel")?(d=[i,{token:N.StakedSPS,name:"staked",tooltip:n("stake_unstake_page.staked_tooltip")}],s[1]=d):d=s[1];const S=d;let m;return s[2]===Symbol.for("react.memo_cache_sentinel")?(m=e.jsx(ve,{children:S.map(Ue)}),s[2]=m):m=s[2],m};function Ue(s){return e.jsxs(Pe,{children:[e.jsxs(p,{css:{gap:5,alignItems:"center"},children:[e.jsx(o,{children:e.jsx(pe,{liquid:s.name==="liquid",css:{minWidth:"19px",minHeight:"19px",mt:"0px",backgroundSize:"19px"}})}),e.jsx(o,{children:s.name}),e.jsx(o,{css:{marginTop:3},children:e.jsx(I,{tooltipCss:{width:"220px",maxWidth:"220px",border:"1px solid $paleYellow"},content:s.tooltip,iconType:"standard",iconSize:"12px",variant:"paleYellow"})})]}),e.jsx(qe,{type:s.name,children:e.jsx(le,{token:s.token,hideDecimalsForLargeNumbers:!1})})]},s.name)}const Qe=c(o,{backgroundImage:"url(".concat(window.config.SL_ASSETS_URL,"/ui_elements/buy_coins/bg_buy-sps.png)"),backgroundRepeat:"no-repeat",backgroundAttachment:"fixed",backgroundSize:"cover",minHeight:"100vh",paddingBottom:20}),We=c(o,{font:"normal normal 800 24px/28px Proxima Nova",color:"#FFEDA0",textTransform:"uppercase"}),ze=c(o,{font:"normal normal normal 15px/20px Proxima Nova",color:"white",marginTop:29}),$e=c(o,{font:"normal normal normal 15px/20px Proxima Nova",marginTop:20,variants:{type:{stake:{color:"#FFEDA0"},unstake:{color:"white"}}}}),Ve=c(o,{font:"normal normal normal 15px/20px Proxima Nova",color:"#FFEDA0",marginTop:20}),Ge=c("button",{all:"unset",background:"transparent linear-gradient(180deg, #023E41 0%, #142E2C 100%) 0% 0% no-repeat padding-box",boxShadow:"0px 3px 6px #00000072",borderRadius:6,font:"normal normal normal 14px/17px Proxima Nova",color:"#FFEDA0",border:"1px solid #142E2C",padding:"6px 11px",cursor:"pointer","&:hover":{background:"transparent linear-gradient(180deg, #008689 0%, #00666B 36%, #00B3B7 100%) 0% 0% no-repeat padding-box",border:"1px solid #FFFFFF",padding:"6px 11px"}}),He=c(o,{font:"normal normal bold 16px/20px Proxima Nova",letterSpacing:"0.32px",color:"#FFFFFF"}),Oe=c(p,{mt:"25px",background:"rgba(12, 28, 29, 0.5)",flexDirection:"column",padding:"20px 30px",gap:"10px",borderRadius:"14px"}),Ye=c(p,{gap:"10px",justifyContent:"space-evenly"}),D=c(o,{font:"normal normal bold 18px/20px Proxima Nova",color:"#D9FFFF",textShadow:"0px 0px 10px #00FF9DCC"}),lt=()=>{var F;const s=de(),i=me(),d=ue(),{decimalSeperator:S,thousandsSeperator:m}=Fe(d),f=E(xe),_=ge(),{format:x,rating:R,league:A}=E(he),{type:a}=ke(),{data:L}=Se(),{stakedSpsAvailableForUnstaking:U,stakedSpsDelegatedOut:j,spsBalance:Q,totalPower:b}=Ae(),g=a==="stake"?k(Q,!0):k(U,!0),W=Ne(),z=Ee(),{data:h,isLoading:$,isUninitialized:V}=Te({username:f},{skip:!f}),G=[{text:"25%",times:.25},{text:"50%",times:.5},{text:"75%",times:.75},{text:"MAX",times:1}],H=fe().shape({quantity:_e().typeError(n("dec_management.err_invalid")).required(n("dec_management.err_invalid")).test("Is positive?",n("common.greater_than_0"),t=>t>0)}),O={resolver:ie(H),defaultValues:{quantity:a==="stake"?g:0}},{handleSubmit:Y,setValue:J,watch:M,control:X,clearErrors:Z,formState:{errors:K}}=oe(O),y=+M("quantity"),l=isNaN(y)?0:y,ee=t=>{const r=we(g||0,t);J("quantity",k(r,!0)),Z("quantity")},C=Be(R,A,x,L),te=+q(C,b,x).toFixed(2),se=+q(C,je(b,l),x).toFixed(2);T.useEffect(()=>{a!=="stake"&&a!=="unstake"&&i("/dashboard/sps")},[]),T.useEffect(()=>{var t;(t=h==null?void 0:h.unstaking)!=null&&t.next_unstake_date&&a==="unstake"&&i("/dashboard/sps")},[h]);const ae=async t=>{var u,w,B;let r;a==="unstake"?r=await z({qty:(u=t==null?void 0:t.quantity)==null?void 0:u.toFixed(3)}):r=await W({qty:(w=t==null?void 0:t.quantity)==null?void 0:w.toFixed(3)}),(B=r==null?void 0:r.data)!=null&&B.success&&i("/dashboard/sps")},ne=t=>t===""?"":k(+t,!0);return $||V?e.jsx(be,{}):e.jsxs(Qe,{children:[e.jsx(ye,{headerTitle:"".concat(a," SPS"),onGoBack:()=>{i("/dashboard/sps")},onGoBackTitle:"SPLINTERSHARDS",containerCss:{position:"relative"},content:e.jsx(Le,{})}),e.jsx(p,{css:{justifyContent:"center"},children:e.jsxs(o,{css:{marginTop:90,width:430,maxWidth:"100%","@mdRev":{width:"90%"}},children:[e.jsx(We,{children:n("stake_unstake_page.enter_amount",{type:a})}),e.jsxs(ze,{children:[a==="stake"&&n("stake_unstake_page.stake_description"),a==="unstake"&&n("stake_unstake_page.unstake_description")]}),e.jsxs($e,{type:a,children:[a==="stake"&&n("stake_unstake_page.stake_description_two"),a==="unstake"&&n("stake_unstake_page.unstake_description_two")]}),a==="unstake"&&j>0&&e.jsx(Ve,{children:n("stake_unstake_page.delegation_note",{stakedSpsDelegatedOut:s(j)})}),e.jsxs(De,{type:"sps",children:[e.jsx(re,{render:({field:{onCh
1ange:t,value:r}})=>e.jsx(Ie,{value:r!=null?r:"",onValueChange:u=>{t(ne((u==null?void 0:u.floatValue)||""))},thousandSeparator:m,decimalSeparator:S,allowNegative:!1,decimalScale:3,placeholder:""}),control:X,name:"quantity"}),e.jsx(Re,{type:"sps",children:"SPS"}),e.jsx(o,{css:{position:"absolute",left:10,top:9},children:e.jsx(v,{src:"".concat(window.config.SL_ASSETS_URL,"/ui_elements/shop/cl/img_sps-shard_128.png"),alt:"sps",css:{width:21}})})]}),e.jsx(Ce,{css:{fontSize:"12px"},children:(F=K.quantity)==null?void 0:F.message}),e.jsx(p,{css:{gap:20,justifyContent:"center",marginTop:28},children:G.map(t=>e.jsx(Ge,{onClick:()=>ee(t.times),children:t.text},t.text))}),a==="stake"&&e.jsxs(Oe,{children:[e.jsxs(p,{css:{gap:"5px",justifyContent:"center"},children:[e.jsxs(He,{children:[n("stake_unstake_page.boost_change")," (",x.toUpperCase(),")"]}),e.jsx(I,{content:n("stake_unstake_page.boost_change_info")})]}),e.jsxs(Ye,{children:[e.jsxs(D,{children:["x ",_(te)]}),e.jsx(v,{src:"/assets/images/common/increase.svg"}),e.jsxs(D,{children:["x ",_(se)]})]})]}),e.jsx(p,{css:{justifyContent:"center",marginTop:a==="stake"?30:62},children:e.jsxs(p,{css:{gap:40,flexWrap:"wrap",justifyContent:"center","@mdRev":{gap:20}},children:[e.jsx(P,{color:"red",css:{width:140,fontWeight:"normal"},onClick:()=>{i("/dashboard/sps")},children:n("stake_unstake_page.cancel")}),e.jsx(P,{color:"green",css:{width:140,fontWeight:"normal"},onClick:Y(ae),isDisabled:!l||l<=0||g<l,disabled:!l||l<=0||g<l,children:a})]})})]})})]})};export{ze as DescriptionOne,Ve as DescriptionThree,lt as StakeUnstakeSps,We as Title,lt as default};
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.