1import{u as X,_ as Z}from"./C5C7j9ww.js";import{b as tt,_ as et,a as ot}from"./C3Ea28yF.js";import{_ as at}from"./7gxMQCUi.js";import{_ as rt}from"./BNNDHPKO.js";import{_ as st}from"./BDRn9n46.js";import{p as z,P as j,u as Q,af as it,w as K,h as b,i as e,ar as ct,a0 as w,$ as T,k as t,ao as nt,ap as lt,b as W,e as p,g as m,q as dt,a2 as _t,ad as $,a7 as F,ak as B,aq as V,c as G,r as C,V as J,_ as ut,ac as ft,f as pt,o as mt,Q as vt,ae as Y}from"./e3jp4aij.js";import{P as gt}from"./D_uDkBX7.js";import{u as yt}from"./DBB9QGDD.js";import{u as ht}from"./Ck0Ki4Ax.js";import{u as bt}from"./VPqq4-Qq.js";import{_ as Pt}from"./CzHeHbBU.js";import{t as xt,a as kt,b as Tt,c as wt}from"./Bs8oFpNW.js";import{s as It}from"./B8fFHYy0.js";import"./BrBQmooz.js";import"./ZqblZHH2.js";import"./CsWyEkkb.js";import"./CR1uI762.js";import"./BpKf9z5s.js";import"./BXnKKW1f.js";import"./C_2ICmEd.js";import"./ITHAM-Az.js";(function(){try{var _=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{};_.SENTRY_RELEASE={id:"ecos-frontend-cp@12213eb99e1069e82980933c1ec51c50139958dd"};var c=new _.Error().stack;c&&(_._sentryDebugIds=_._sentryDebugIds||{},_._sentryDebugIds[c]="597d8d9b-26c8-4bee-b6ef-8fd520f8a3ed",_._sentryDebugIdIdentifier="sentry-dbid-597d8d9b-26c8-4bee-b6ef-8fd520f8a3ed")}catch{}})();const Ct={class:"tariff"},At={class:"tariff__container"},Ft={class:"tariff__content"},Rt={class:"tariff__card"},St={class:"tariff__card-block"},Nt={class:"tariff__wrapper"},Mt={class:"tariff__info"},Ut={class:"tariff__info-details"},Dt={class:"tariff__info-title"},Et={class:"tariff__image-container"},Lt={class:"tariff__image-block"},$t={class:"tariff__cover-image"},Ot=["srcset"],Bt=["src"],Vt={class:"tariff__info-data"},Yt={class:"tariff__info-data-title"},Ht={class:"tariff__line line"},qt={class:"tariff__image-section"},zt={class:"tariff__order-details"},jt={key:0,class:"tariff__detail-value"},Qt={key:1,class:"tariff__promo-container"},Kt=["placeholder"],Wt=["placeholder"],Gt={class:"tariff__error-container"},Jt={key:0,class:"tariff__error-text"},Xt={key:1,class:"tariff__error-text"},Zt={key:2,class:"tariff__success-text"},te={class:"tariff__additional-info"},ee={class:"tariff__payment-options"},oe=z({__name:"OrderTariff",props:{order:{},sendFormStrategy:{type:Function},error:{},collectPromoCode:{type:Function},setNewPrice:{type:Function},setNewTh:{type:Function},load:{type:Boolean},contractPower:{},contractDuration:{}},setup(_){const c=_,a=G({price:0,discount:0,maxDiscount:0,isActivePromo_code:!1,code:""}),I=W().public.API_V2_URL,{t:i}=j(),O=Q(),A=C(0),l=C(""),d=C(""),h=C(""),R=yt(),{fpps:S}=it(R),N=p(()=>i("pages.buy_asic.disclaimer_text",{fpps:R.formatFpps(S.value??null)})),M=ht("(max-width: 768px)"),v=bt(),g=p(()=>O.params.id);K(()=>{g.value&&v.selectNewDeviceById(g.value)});const P=()=>{setTimeout(()=>{l.value="",h.value="",d.value=""},3e3)},U=(x,f)=>`/images/order/${x}.${f}`,E=()=>{if(a.code.length>15){d.value="Promo code cannot exceed 15 characters.",P();return}if(a.isActivePromo_code){l.value="Promo code has already been used.",P();return}if(!c.collectPromoCode)return;const x=c.collectPromoCode(),f={code:a.code,type:gt.CALCULATOR,...x};J(`${I}/promo/check-promo`,f).then(s=>{if(s){if(typeof s=="string"){l.value=s,P();return}if("isAcceptableNow"in s){if(!s.isAcceptableNow){l.value=String(s.messages?.[0]||"Promo code not acceptable right now."),P();return}a.discount=A.value-s.data.paymentAmount,A.value=s.data.paymentAmount,h.value="Promo code applied successfully.",a.isActivePromo_code=!0,c.setNewPrice&&c.setNewPrice(s.data.paymentAmount,a.code)}else{const k=s.discount/100*a.price,r=Math.min(k,s.discount_sum),n=s.bonus_th_percent;c.setNewTh&&c.setNewTh(n,a.code),a.discount=r,a.isActivePromo_code=!0,A.value=+(A.value-r).toFixed(2),h.value="Promo code applied successfully.",P()}}}).catch(s=>{s.response&&(l.value=s.response.data?.errors._||"Invalid promo code",P())})};return(x,f)=>{const s=at,k=tt,r=rt,n=st,y=et;return m(),b("div",Ct,[e("div",At,[ct(x.$slots,"default",{},void 0,!0),w(s,{"disable-after-click":!0,variant:"back",class:"tariff__back-button--desktop"}),f[2]||(f[2]=e("div",{class:"tariff__title-container"},[e("h1",{class:"tariff__title"})],-1)),w(s,{"disable-after-click":!0,variant:"back",class:"tariff__back-button--mobile"}),e("div",Ft,[e("div",Rt,[e("div",St,[e("div",Nt,[e("div",Mt,[e("div",Ut,[e("p",Dt,T(t(i)("pages.section.c_m_contracts.contract")),1),e("div",Et,[e("div",Lt,[e("picture",$t,[e("source",{srcset:U("asic","webp"),type:"image/webp"},null,8,Ot),e("img",{src:U("asic","png"),alt:"banner",loading:"lazy"},null,8,Bt)])])]),e("div",Vt,[e("h2",Yt,T(t(i)("pages.buy_order.title_contcract")),1),e("div",Ht,[w(k,{"text-title":t(i)("pages.rent_order.title_11"),"text-value":(c.contractPower||0)+" TH/s"},null,8,["text-title","text-value"]),w(k,{"is-last":!0,"text-title":t(i)("pages.rent_order.title_12"),"text-value":(c.contractDuration||0)+" "+t(i)("pages.buy_asic.calculator.days")},null,8,["text-title","text-value"])]),w(k,{"is-last":!0,"text-title":t(i)("pages.order_title_asic"),"text-value":"Antminer S21 pro 245TH/s"},null,8,["text-title"])])])])]),e("div",qt,[e("div",zt,[(m(!0),b(nt,null,lt(c.order,(o,D)=>(m(),b("div",{key:o.title,class:"tariff__detail-item"},[e("p",{class:"tariff__detail-title",style:dt(D===0||D===c.order.length-1?{fontSize:t(M)?"14px":"16px",fontWeight:"600",lineHeight:"24px"}:{})},[_t(T(o.title)+" ",1),o.hasTooltip?(m(),$(r,{key:0,"tooltip-text":o.tooltip,class:"tariff__tooltip-icon"},null,8,["tooltip-text"])):F("",!0)],4),o.isPromoCode?F("",!0):(m(),b("p",jt,T(o.value),1)),o.isPromoCode?(m(),b("div",Qt,[B(e("input",{"onUpdate:modelValue":f[0]||(f[0]=L=>t(a).code=L),placeholder:t(i)("pages.order.title_2"),class:"tariff__promo-input"},null,8,Kt),[[V,t(a).code]]),B(e("input",{"onUpdate:modelValue":f[1]||(f[1]=L=>t(a).code=L),placeholder:t(i)("pages.order.title_2"),class:"tariff__promo-input"},null,8,Wt),[[V,t(a).code]]),e("button",{class:"tariff__promo-button",onClick:E},T(t(i)("pages.order.title_3")),1),e("div",Gt,[t(d)?(m(),b("p",Jt,T(t(d)),1)):F("",!0),t(l)?(m(),b("p",Xt,T(t(l)),1)):F("",!0),t(h)?(m(),b("p",Zt,T(t(h)),1)):F("",!0)])])):F("",!0)]))),128))])])])]),e("div",te,[w(n,{title:t(i)("pages.buy_asic.disclaimer_title"),description:t(N),class:"tariff__disclaimer"},null,8,["title","description"]),e("div",ee,[w(y,{"send-form-strategy":_.sendFormStrategy,error:_.error,load:_.load,title:t(i)("pages.order.title_1")},null,8,["send-form-strategy","error","load","title"])])])])])])}}}),ae=Object.assign(Pt(oe,[["__scopeId","data-v-cd403021"]]),{__name:"OrderTariff"}
1),re=345353084,H=10,q=12,se="CoinsPaid",ie=(_,c,a)=>{const u=_===re&&c===H,I=a?.payment_system_args.name===se&&a.system_name!=="btc";return!u||!I?null:{checkoutPriceUsd:q,surchargeUsd:q-H}},Ae=z({__name:"index",setup(_){ut({title:"Tariff Order",meta:[{name:"description",content:"order informations"}]});const a=W().public.API_V2_URL,{t:u}=j(),I=C(!0),i=C(0),A=Q().params,l=C(null),d=G({id:null,power:0,title:"",imageLink:"",price:0,value:0,duration:0,static_rentability:0,base_fee:0}),h=ft(),R=r=>{i.value=r};K(()=>{h.paymentMethodsList.currentPaymentMethod&&R(h.paymentMethodsList.currentPaymentMethod.fee_in_percent)}),pt(`${a}/tariff/view?id=`+A.id).then(r=>{if(!r.ok){I.value=!1,l.value=r.failure.message;return}const n=r.data;Object.assign(d,{id:n.id,power:(n.hashrate_val/1e3).toFixed(2),title:n.description,imageLink:"/images/asic.webp",price:n.contract_price,value:1,duration:n.contract_time,static_rentability:1,base_fee:n.service_charge}),I.value=!1;const y=k();xt(y),kt(y)});const S=p(()=>d.power||0),N=p(()=>d.duration||0),M=p(()=>d.base_fee||0),v=p(()=>d.price||0),g=p(()=>ie(d.id,v.value,h.paymentMethodsList.currentPaymentMethod)),P=p(()=>v.value*i.value/100),U=p(()=>(g.value?.surchargeUsd??P.value).toFixed(2)),E=p(()=>g.value?.checkoutPriceUsd??v.value),x=p(()=>g.value?g.value.checkoutPriceUsd:i.value!==0?+(v.value*(1+i.value/100)).toFixed(2):v.value),f=p(()=>[{title:u("pages.rent_asic.order.payment_details"),value:""},{title:u("pages.order.title_11"),value:"$"+v.value},{title:u("pages.order.title_7"),value:"$"+M.value,tooltip:u("pages.order.tooltip_fee"),hasTooltip:!0},{title:g.value?u("pages.order.trial_crypto_fee"):u("pages.order.title_8"),value:"$"+U.value,tooltip:g.value?u("pages.order.tooltip_trial_crypto_fee",{fee:`$${g.value.surchargeUsd}`,price:`$${v.value}`}):u("pages.order.tooltip_card_fee"),hasTooltip:!0},{title:u("pages.rent_asic.order.total_payment"),value:"$"+x.value}]),s=r=>{l.value=null;const n=k(r.name);Tt(n),wt(n);const y={tariff_id:d.id,duration_in_days:d.duration,price:E.value,count:1,promo_code:"",payment_system:{name:r.name,currency:r.currency,options:r.options},analytics:{firebase_msg_token:null,app_instance_id:null},is_gifted_contract:!1,external_url:t(vt("external_url"))};J(`${a}/order/buy-contract`,y).then(o=>{if(!o||typeof o=="string"){l.value=typeof o=="string"?o:"Unknown error occurred.";return}o.result?.uri?It(o.result.uri,"/dashboard/cloud-mining-contracts")||(l.value="Invalid payment redirect URL"):o.errors&&(l.value=Y(o))}).catch(o=>{l.value=Y(o,"Something went wrong during the contract purchase.")})};function k(r){return{productKey:"cloud_tariff_contract",itemId:d.id,itemName:d.title,price:v.value,value:x.value,quantity:1,paymentType:r,itemParams:{duration_days:N.value,hashrate_th:S.value,service_charge:M.value}}}return mt(()=>{const r=new URL(window.location.href),n=r.searchParams.get("payment"),y=r.searchParams.get("desc"),o=X();n==="fail"&&o.show(2,decodeURIComponent(y||""))}),(r,n)=>{const y=Z,o=ot,D=ae;return m(),b("div",null,[w(y),t(I)?(m(),$(o,{key:0})):(m(),$(D,{key:1,error:t(l),"set-additional-price":R,order:t(f),"send-form-strategy":s,"contract-power":t(S),"contract-duration":t(N)},null,8,["error","order","contract-power","contract-duration"]))])}}});export{Ae 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.