1import{a as pe}from"./chunk-ZQOHBGDB.js";import{e as Se}from"./chunk-L2OUQ73G.js";import{a as Ee}from"./chunk-4OTQ3FYF.js";import{c as ue,d as se,e as le,i as de}from"./chunk-WRZXP75E.js";import"./chunk-YWKTO73M.js";import{a as ie}from"./chunk-AFHSS2U6.js";import{a as oe,d as ae}from"./chunk-L2JJDEQG.js";import{i as te}from"./chunk-SCKF377Q.js";import"./chunk-DL7HHRR5.js";import"./chunk-D3S6AZPZ.js";import{a as K}from"./chunk-W7LSWKME.js";import{j as ee}from"./chunk-LLG7LFAR.js";import"./chunk-MAAJDSYV.js";import"./chunk-I6PWGF2K.js";import"./chunk-K6T4326Q.js";import"./chunk-SQYF6HYD.js";import{a as D}from"./chunk-BE3VEPGG.js";import{S as re,o as _e}from"./chunk-6Z45FA5O.js";import"./chunk-P3KYTCLI.js";import"./chunk-XHDFESOD.js";import{d as q,g as Q,h as Y}from"./chunk-UFKPJSCY.js";import"./chunk-7QZJOEIA.js";import{b as ne}from"./chunk-NGTGFN4T.js";import"./chunk-4W65S3HV.js";import{b as Z}from"./chunk-E4P53QH5.js";import"./chunk-V2HCY7SI.js";import{Ab as z,Bc as N,Cb as J,Cc as m,Eb as k,Fb as b,Gb as x,Hb as T,Ib as _,Jb as r,Jc as c,Kb as P,L as X,Lc as j,Pb as y,Ta as i,Tb as u,Wb as O,Yb as g,ba as S,eb as F,ha as M,ia as f,ic as V,lc as l,na as w,nc as d,ta as p,xb as W}from"./chunk-6CMTVMC3.js";import"./chunk-TSX4WT5A.js";var Ae=(a,e)=>e.id;function ge(a,e){a&1&&(_(0,"section",16)(1,"div",18)(2,"h2",19),u(3,0),r(),_(4,"p",20),u(5,1),r()()());}function Ne(a,e){a&1&&P(0,"loading-page");}function me(a,e){if(a&1){let t=y();_(0,"button",56),O("click",function(){let o=M(t).$implicit,E=g(2);return f(E.selectTab(o));}),l(1),r();}if(a&2){let t=e.$implicit,n=g(2);V("!bg-background",n.currentTab()===t)("text-foreground",n.currentTab()===t)("shadow-xs",n.currentTab()===t)("text-muted-foreground",n.currentTab()!==t),i(),d(" ",n.getTabLabel(t)," ");}}function Ce(a,e){if(a&1&&(_(0,"article",53),W("app-list-item-enter"),_(1,"div",57)(2,"div",58),P(3,"fa-duotone-icon",37),r(),_(4,"div",33)(5,"div",59),l(6),r(),_(7,"div",60),l(8),r()(),_(9,"div",61)(10,"div",62),l(11," + "),P(12,"span",63),l(13),r()()()()),a&2){let t=e.$implicit,n=g(2);i(3),T("icon",n.faArrowDownLeft),i(3),d(" ",n.getHistoryTitle(t)," "),i(2),d(" ",t.attributes.created_at," "),i(4),T("formatNumber",t.attributes.amount)("decimalPlaces",2),i(),d(" ",t.attributes.currency," ");}}function Te(a,e){a&1&&(_(0,"div",54),u(1,15),r());}function Pe(a,e){if(a&1){let t=y();_(0,"div",17)(1,"section",21)(2,"div",22)(3,"div",17)(4,"div",23)(5,"div",24)(6,"h2",25),u(7,2),r(),_(8,"p",26),u(9,3),r()(),_(10,"div",27)(11,"div",28),u(12,4),r(),_(13,"div",29),l(14),r()()(),_(15,"div",30),b(16,me,2,9,"button",31,k),r(),_(18,"button",32),O("click",function(){M(t);let o=g();return f(o.copiedReferralLink());}),_(19,"div",33)(20,"div",34),l(21),r(),_(22,"div",35),u(23,5),r()(),_(24,"div",36),P(25,"fa-duotone-icon",37),r()(),_(26,"p",38),l(27),r()()(),_(28,"div",39)(29,"div",40)(30,"div",24)(31,"div",41),u(32,6),r(),_(33,"div",42),l(34),N(35,"compactNumber"),r()(),_(36,"div",43)(37,"div",24)(38,"div",41),u(39,7),r(),_(40,"div",44),l(41),N(42,"compactNumber"),r()(),_(43,"div",24)(44,"div",41),u(45,8),r(),_(46,"div",44),l(47),N(48,"compactNumber"),r()()(),_(49,"a",45),u(50,9),r()()()(),_(51,"section",46)(52,"div",47)(53,"div",38),u(54,10),r(),_(55,"div",48),l(56),r()(),_(57,"div",47)(58,"div",38),u(59,11),r(),_(60,"div",48),l(61),N(62,"compactNumber"),r()(),_(63,"div",47)(64,"div",38),u(65,12),r(),_(66,"div",48),l(67),N(68,"compactNumber"),r()()(),_(69,"section",49)(70,"div",24)(71,"h3",50),u(72,13),r(),_(73,"p",38),u(74,14),r()(),_(75,"div",51)(76,"div",52),b(77,Ce,14,6,"article",53,Ae,!1,Te,2,0,"div",54),r()(),_(80,"app-load-more",55),O("loadMore",function(){M(t);let o=g();return f(o.onShowMoreHistoriesClicked());}),r()()();}if(a&2){let t=g();i(14),d(" ",t.partnerInfo().codeSign," "),i(2),x(t.tabs()),i(5),d(" ",t.totalFullReferral()," "),i(4),T("icon",t.faCopy),i(2),d(" ",t.accrualDescription()," "),i(7),d(" ",m(35,13,t.partnerInfo().balance)," "),i(7),d(" ",m(42,15,t.partnerInfo().totalBalance)," "),i(6),d(" ",m(48,17,t.partnerInfo().totalWithdrawal)," "),i(9),d(" ",t.partnerInfo().percent,"% "),i(5),d(" ",m(62,19,t.partnerInfo().totalOrders)," "),i(6),d(" ",m(68,21,t.partnerInfo().c
1ountReferral)," "),i(10),x(t.ordersHistories()),i(3),T("visible",t.hasMoreHistories())("loading",t.isHistoryLoading());}}var Me={balance:0,totalBalance:0,totalWithdrawal:0,percent:0,partnerMethod:0,totalOrders:0,countReferral:0,codeSign:""},U={current_page:1,last_page:1,per_page:30,total:0},Re=class a{constructor(){this.destroyRef=S(w);this.route=S(q);this.router=S(Q);this.appStore=S(te);this.accountPartnersApi=S(Se);this.clipboard=S(pe);this.seoService=S(K);this.toastService=S(ee);this.isLoadingPage=p(!0);this.isHistoryLoading=p(!1);this.currentPage=p(1);this.paginationMeta=p(U);this.hasMoreHistories=c(()=>this.currentPage()<this.paginationMeta().last_page);this.isNotConnected=p(!1);this.responseData=p(null);this.ordersHistories=p([]);this.referralHash=p("");this.appConfig=this.appStore.data;this.selectedApiUrl=c(()=>this.appConfig()?.base_url||"");this.languagesAliases=c(()=>this.appConfig()?.attributes?.languages?.map(e=>e.alias)??[]);this.tabs=c(()=>["auto",...this.languagesAliases()]);this.currentTab=j({source:this.tabs,computation:(e,t)=>{let n=t?.value??"auto";return e.includes(n)?n:"auto";}});this.totalFullReferral=c(()=>{let e=this.selectedApiUrl(),t=this.referralHash(),n=this.currentTab();return!e||!t?"":n!=="auto"?`${e}/${n}/?ref=${t}`:`${e}/?ref=${t}`;});this.partnerInfo=c(()=>{let e=this.responseData();return e?{balance:e.user.balance??0,totalBalance:e.info.total_balance??0,totalWithdrawal:e.info.total_withdrawal??0,percent:e.info.percent??0,partnerMethod:e.info.partner_method??0,totalOrders:e.info.total_orders??0,countReferral:e.info.count_referral??0,codeSign:e.info.code_sign??""}:Me;});this.accrualDescription=c(()=>this.partnerInfo().partnerMethod===0?"Reward is calculated from the exchange amount":"Reward is calculated from the received profit");this.faArrowDownLeft=_e;this.faCopy=re;}ngOnInit(){this.seoService.updateSeoTags({title:"Referral program"}),de(this.router,this.route),this.loadPartnerData();}loadPartnerData(){this.isLoadingPage.set(!0),this.isNotConnected.set(!1),this.accountPartnersApi.getPartner().pipe(D(this.destroyRef)).subscribe({next:e=>{this.responseData.set(e),this.referralHash.set(e.user.referral_hash),this.ordersHistories.set([]),this.currentPage.set(1),this.paginationMeta.set(U),this.loadHistories(1);},error:e=>{this.isNotConnected.set(!0),this.isLoadingPage.set(!1),console.error("Error loading partner data:",e);}});}loadHistories(e=this.currentPage(),t=!1){if(this.isHistoryLoading()||this.isNotConnected())return;let n=ue(e);this.isHistoryLoading.set(!0),this.accountPartnersApi.getPartnerHistories({page:n}).pipe(D(this.destroyRef),X(()=>{this.isHistoryLoading.set(!1),this.isLoadingPage.set(!1);})).subscribe({next:o=>{let E=this.normalizePaginationMeta(o.meta,n,o.data.length);if(t){let A=new Set(this.ordersHistories().map(R=>R.id)),C=o.data.filter(R=>!A.has(R.id));this.ordersHistories.update(R=>[...R,...C]);}else this.ordersHistories.set(o.data);this.paginationMeta.set(E),this.currentPage.set(E.current_page);},error:o=>{o.status===404&&!t&&(this.ordersHistories.set([]),this.paginationMeta.set(U),this.currentPage.set(1)),this.isLoadingPage.set(!1),console.error("Error loading history:",o);}});}onShowMoreHistoriesClicked(){!this.hasMoreHistories()||this.isHistoryLoading()||this.loadHistories(this.currentPage()+1,!0);}selectTab(e){this.currentTab.set(e);}getTabLabel(e){return e==="auto"?"AUTO":e.toUpperCase();}copiedReferralLink(){let e=this.totalFullReferral();e&&(this.clipboard.copy(e),this.toastService.success("Copied",{description:"The referral link has been copied to the clipboard."}));}getHistoryTitle(e){return`${"Accrued from"} #${e.attributes.order_id}`;}normalizePaginationMeta(e,t,n){let o=this.toPositiveInteger(e.per_page,U.per_page),E=this.toNonNegativeInteger(e.total,n),A=this.toPositiveInteger(e.last_page,Math.max(1,Math.ceil(E/o)));return{current_page:Math.min(this.toPositiveInteger(e.current_page,t),A),last_page:A,per_page:o,total:E};}toPositiveInteger(e,t){return le(e,t);}toNonNegativeInteger(e,t){return se(e,t);}static{this.ɵfac=function(t){return new(t||a)();};}static{this.ɵcmp=F({type:a,selectors:[["app-partners"]],decls:3,vars:1,consts:()=>{let e;e="Affiliate program is not connected";let t;t="Affiliate features are currently not available for your account.";let n;n="Referral program";let o;o="Share your link and earn a percentage from exchange transactions made by referred users.";let E;E="Payment currency";let A;A="Click to copy link";let C;C="Balance";let R;R="Total earned";let v;v="Withdrawn";let h;h="Create a withdrawal request";let G;G="Affiliate percentage";let L;L="Referral orders";let H;H="Total referrals";let I;I="Transaction history";let $;$="Affiliate program rewards are shown here.";let B;return B="Transaction history is empty for now",[e,t,n,o,E,A,C,R,v,h,G,L,H,I,$,B,[1,"rounded-3xl","border","border-destructive/20","bg-destructive/5","p-6","text-center"],[1,"space-y-5"],[1,"space-y-2"],[1,"text-lg","font-semibold","text-foreground"],[1,"text-sm","leading-6","text-muted-foreground"],[1,"grid","grid-cols-1","gap-4","xl:grid-cols-[minmax(0,1fr)_360px]"],[1,"rounded-3xl","border","border-border/70","bg-card","p-5","shadow-xs","sm:p-6"],[1,"flex","flex-col","gap-4","lg:flex-row","lg:items-start","lg:justify-between"],[1,"space-y-1"],[1,"text-2xl","font-semibold","tracking-tight","sm:text-3xl"],[1,"max-w-2xl","text-sm","leading-6","text-muted-foreground"],[1,"rounded-2xl","border","border-border/70","bg-muted/20","px-4","py-3","lg:min-w-[180px]"],[1,"text-xs","font-medium","tracking-wide","text-muted-foreground"],[1,"mt-1","text-2xl","font-semibold","uppercase","text-foreground"],[1,"inline-flex","flex-wrap","gap-2","rounded-2xl","bg-muted","p-1"],["uiButton","","type","button","variant","ghost",1,"h-9","rounded-xl","px-3","text-sm",3,"!bg-background","text-foreground","shadow-xs","text-muted-foreground"],["type","button",1,"flex","w-full","items-center","gap-3","rounded-2xl","border","border-border/70","bg-muted/20","px-4","py-3","text-left","transition-colors","hover:bg-accent/60",3,"click"],[1,"min-w-0","flex-1"],[1,"truncate","text-sm","font-medium","text-foreground"],[1,"mt-1","text-xs","text-muted-foreground"],[1,"flex","size-9","shrink-0","items-center","justify-center","rounded-xl","border","border-border/70","bg-background","text-foreground"],[3,"icon"],[1,"text-sm","text-muted-foreground"],[1,"rounded-3xl","bg-primary","p-5","text-primary-foreground","shadow-xs","sm:p-6"],[1,"flex","h-full","flex-col","justify-between","gap-6"],[1,"text-sm","text-primary-foreground
1/80"],[1,"text-3xl","font-bold"],[1,"grid","grid-cols-2","gap-4","border-t","border-primary-foreground/15","pt-4"],[1,"text-2xl","font-bold"],["routerLink","/account/partners/withdrawal",1,"inline-flex","h-11","w-full","items-center","justify-center","rounded-2xl","border","border-primary-foreground/20","bg-primary-foreground/10","px-4","text-sm","font-medium","text-primary-foreground","transition-colors","hover:bg-primary-foreground/15"],[1,"grid","grid-cols-1","gap-3","sm:grid-cols-3"],[1,"rounded-3xl","border","border-border/70","bg-card","p-5","text-center","shadow-xs"],[1,"mt-1","text-2xl","font-semibold","text-foreground"],[1,"space-y-4","mt-4","block","pt-3"],[1,"text-xl","font-semibold","tracking-tight","sm:text-2xl"],[1,"overflow-hidden","rounded-3xl","border","border-border/70","bg-background"],[1,"divide-y","divide-border/70"],[1,"px-4","py-4","sm:px-5"],[1,"px-4","py-8","text-center","text-sm","text-muted-foreground"],[3,"loadMore","visible","loading"],["uiButton","","type","button","variant","ghost",1,"h-9","rounded-xl","px-3","text-sm",3,"click"],[1,"flex","items-start","gap-4"],[1,"flex","size-10","shrink-0","items-center","justify-center","rounded-2xl","bg-muted","text-emerald-600"],[1,"text-sm","font-semibold","text-foreground","sm:text-base"],[1,"mt-1","text-sm","text-muted-foreground"],[1,"text-right"],[1,"text-sm","font-semibold","text-emerald-600","sm:text-base"],[3,"formatNumber","decimalPlaces"]];},template:function(t,n){t&1&&z(0,ge,6,0,"section",16)(1,Ne,1,0,"loading-page")(2,Pe,81,23,"div",17),t&2&&J(n.isNotConnected()?0:n.isLoadingPage()?1:2);},dependencies:[Y,Z,ie,ne,oe,Ee,ae],styles:["[_nghost-%COMP%]{display:block}"]});}};export{Re as PartnersComponent};/**i18n:4a99b2d0acf14f514ec1a9ad7ce6fd8bc6ad78c9220b1d45912a08891dbf615e*/
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.