@opexa/portal-sdk 0.0.134 → 0.0.136
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +45 -41
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +219 -178
- package/dist/index.mjs.map +1 -1
- package/dist/sdk/types.d.ts +22 -15
- package/dist/services/types.d.ts +28 -19
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
(function(b,w){typeof exports=="object"&&typeof module<"u"?w(exports,require("@opexa/object-id")):typeof define=="function"&&define.amd?define(["exports","@opexa/object-id"],w):(b=typeof globalThis<"u"?globalThis:b||self,w(b.sdk={},b.objectId))})(this,function(b,w){"use strict";var
|
|
1
|
+
(function(b,w){typeof exports=="object"&&typeof module<"u"?w(exports,require("@opexa/object-id")):typeof define=="function"&&define.amd?define(["exports","@opexa/object-id"],w):(b=typeof globalThis<"u"?globalThis:b||self,w(b.sdk={},b.objectId))})(this,function(b,w){"use strict";var Da=Object.defineProperty;var Ra=(b,w,E)=>w in b?Da(b,w,{enumerable:!0,configurable:!0,writable:!0,value:E}):b[w]=E;var d=(b,w,E)=>Ra(b,typeof w!="symbol"?w+"":w,E);const E={Account:8,Deposit:9,Withdrawal:14,Verification:15,File:16,Game:203,GameSession:204,MayaSession:230};function o(i,...e){let t="";for(const[a,r]of i.entries()){const s=e.at(a)??"";t=`${t}${r}${s}`}return t.trim()}const Me=o`
|
|
2
2
|
fragment FileFragment on File {
|
|
3
3
|
id
|
|
4
4
|
url
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
dateTimeCreated
|
|
7
7
|
}
|
|
8
8
|
`,Ve=o`
|
|
9
|
-
${
|
|
9
|
+
${Me}
|
|
10
10
|
|
|
11
11
|
query File($id: ObjectId!) {
|
|
12
12
|
node(id: $id) {
|
|
@@ -84,7 +84,7 @@
|
|
|
84
84
|
}
|
|
85
85
|
}
|
|
86
86
|
}
|
|
87
|
-
`,
|
|
87
|
+
`,Be={current:o`
|
|
88
88
|
query GameSession($id: ObjectId!) {
|
|
89
89
|
node(id: $id) {
|
|
90
90
|
... on GameSession {
|
|
@@ -112,7 +112,7 @@
|
|
|
112
112
|
}
|
|
113
113
|
}
|
|
114
114
|
}
|
|
115
|
-
`},
|
|
115
|
+
`},We=o`
|
|
116
116
|
mutation CreateGameSession($input: CreateGameSessionInput!) {
|
|
117
117
|
createGameSession(input: $input) {
|
|
118
118
|
... on GameDoesNotExistError {
|
|
@@ -447,7 +447,7 @@
|
|
|
447
447
|
}
|
|
448
448
|
}
|
|
449
449
|
}
|
|
450
|
-
`,
|
|
450
|
+
`,ut=o`
|
|
451
451
|
mutation CreateMayaAppDeposit($input: CreateMayaAppDepositInput!) {
|
|
452
452
|
createMayaAppDeposit(input: $input) {
|
|
453
453
|
... on DepositPromoMaximumAmountExceededError {
|
|
@@ -476,7 +476,7 @@
|
|
|
476
476
|
}
|
|
477
477
|
}
|
|
478
478
|
}
|
|
479
|
-
`,
|
|
479
|
+
`,dt=o`
|
|
480
480
|
mutation CreateAIOQRPHDeposit($input: CreateAIOQRPHDepositInput!) {
|
|
481
481
|
createAIOQRPHDeposit(input: $input) {
|
|
482
482
|
... on DepositPromoMaximumAmountExceededError {
|
|
@@ -505,7 +505,7 @@
|
|
|
505
505
|
}
|
|
506
506
|
}
|
|
507
507
|
}
|
|
508
|
-
`,
|
|
508
|
+
`,ct=o`
|
|
509
509
|
mutation CreateAIOOnlineBankDeposit($input: CreateAIOOnlineBankDepositInput!) {
|
|
510
510
|
createAIOOnlineBankDeposit(input: $input) {
|
|
511
511
|
... on DepositPromoMaximumAmountExceededError {
|
|
@@ -665,8 +665,8 @@
|
|
|
665
665
|
}
|
|
666
666
|
}
|
|
667
667
|
}
|
|
668
|
-
`,
|
|
669
|
-
${
|
|
668
|
+
`,ve=o`
|
|
669
|
+
${Me}
|
|
670
670
|
|
|
671
671
|
fragment PromoFragment on Promo {
|
|
672
672
|
id
|
|
@@ -687,7 +687,7 @@
|
|
|
687
687
|
dateTimeLastUpdated
|
|
688
688
|
}
|
|
689
689
|
`,ht=o`
|
|
690
|
-
${
|
|
690
|
+
${ve}
|
|
691
691
|
|
|
692
692
|
query Promos {
|
|
693
693
|
promos {
|
|
@@ -695,7 +695,7 @@
|
|
|
695
695
|
}
|
|
696
696
|
}
|
|
697
697
|
`,gt=o`
|
|
698
|
-
${
|
|
698
|
+
${ve}
|
|
699
699
|
|
|
700
700
|
query AvailablePromos($filter: PromoFilterInput) {
|
|
701
701
|
availablePromos(filter: $filter) {
|
|
@@ -706,21 +706,23 @@
|
|
|
706
706
|
fragment SpotBonusFragment on SpotBonusPromo {
|
|
707
707
|
id
|
|
708
708
|
name
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
id
|
|
712
|
-
url
|
|
713
|
-
mimeType
|
|
714
|
-
}
|
|
715
|
-
bonusAmount
|
|
709
|
+
type
|
|
710
|
+
status
|
|
716
711
|
daysToClear
|
|
717
712
|
zeroOutThreshold
|
|
718
713
|
turnoverRequirementMultiplier
|
|
719
714
|
turnoverRequirementType
|
|
720
715
|
minimumTicketOddFactorPerSportsGameProvider
|
|
721
716
|
turnoverRequirementContributionPercentagePerGameProvider
|
|
717
|
+
bonusAmount
|
|
722
718
|
enabledGameProviders
|
|
723
719
|
activationStartDateTime
|
|
720
|
+
activationEndDateTime
|
|
721
|
+
banner {
|
|
722
|
+
id
|
|
723
|
+
url
|
|
724
|
+
}
|
|
725
|
+
description
|
|
724
726
|
dateTimeCreated
|
|
725
727
|
dateTimeLastUpdated
|
|
726
728
|
dateTimeClosed
|
|
@@ -748,8 +750,8 @@
|
|
|
748
750
|
...SpotBonusFragment
|
|
749
751
|
}
|
|
750
752
|
}
|
|
751
|
-
`,
|
|
752
|
-
${
|
|
753
|
+
`,qe=o`
|
|
754
|
+
${Me}
|
|
753
755
|
|
|
754
756
|
fragment CashbackFragment on Cashback {
|
|
755
757
|
id
|
|
@@ -768,7 +770,7 @@
|
|
|
768
770
|
dateTimeLastUpdated
|
|
769
771
|
}
|
|
770
772
|
`,At=o`
|
|
771
|
-
${
|
|
773
|
+
${qe}
|
|
772
774
|
|
|
773
775
|
query Cashbacks {
|
|
774
776
|
cashbacks {
|
|
@@ -776,7 +778,7 @@
|
|
|
776
778
|
}
|
|
777
779
|
}
|
|
778
780
|
`,St=o`
|
|
779
|
-
${
|
|
781
|
+
${ve}
|
|
780
782
|
|
|
781
783
|
query Bonus {
|
|
782
784
|
bonus {
|
|
@@ -805,7 +807,7 @@
|
|
|
805
807
|
}
|
|
806
808
|
}
|
|
807
809
|
`,kt=o`
|
|
808
|
-
${
|
|
810
|
+
${ve}
|
|
809
811
|
|
|
810
812
|
query Bonuses {
|
|
811
813
|
bonuses {
|
|
@@ -834,7 +836,7 @@
|
|
|
834
836
|
}
|
|
835
837
|
}
|
|
836
838
|
`,Ct=o`
|
|
837
|
-
${
|
|
839
|
+
${qe}
|
|
838
840
|
|
|
839
841
|
query CashbackBonuses {
|
|
840
842
|
cashbackBonuses {
|
|
@@ -886,8 +888,8 @@
|
|
|
886
888
|
}
|
|
887
889
|
}
|
|
888
890
|
}
|
|
889
|
-
`,
|
|
890
|
-
${
|
|
891
|
+
`,Dt=o`
|
|
892
|
+
${Me}
|
|
891
893
|
|
|
892
894
|
query MemberVerification {
|
|
893
895
|
memberAccount: self {
|
|
@@ -947,7 +949,7 @@
|
|
|
947
949
|
}
|
|
948
950
|
}
|
|
949
951
|
}
|
|
950
|
-
`,
|
|
952
|
+
`,Mt=o`
|
|
951
953
|
mutation RegisterMemberAccountViaMobile(
|
|
952
954
|
$input: RegisterMemberAccountViaMobileInput!
|
|
953
955
|
$referralCode: String
|
|
@@ -974,7 +976,7 @@
|
|
|
974
976
|
}
|
|
975
977
|
}
|
|
976
978
|
}
|
|
977
|
-
`,
|
|
979
|
+
`,vt=o`
|
|
978
980
|
mutation RegisterMemberAccount(
|
|
979
981
|
$input: RegisterMemberAccountInput_next!
|
|
980
982
|
$reCAPTCHAResponse: String
|
|
@@ -1006,7 +1008,7 @@
|
|
|
1006
1008
|
}
|
|
1007
1009
|
}
|
|
1008
1010
|
}
|
|
1009
|
-
`,
|
|
1011
|
+
`,Nt=o`
|
|
1010
1012
|
mutation RegisterMayaMemberAccount($input: RegisterMayaMemberAccountInput!) {
|
|
1011
1013
|
registerMayaMemberAccount(input: $input) {
|
|
1012
1014
|
... on AccountNameNotAvailableError {
|
|
@@ -1014,7 +1016,7 @@
|
|
|
1014
1016
|
}
|
|
1015
1017
|
}
|
|
1016
1018
|
}
|
|
1017
|
-
`,
|
|
1019
|
+
`,It=o`
|
|
1018
1020
|
mutation UpdateMemberAccount($input: UpdateMemberAccountInput!) {
|
|
1019
1021
|
updateMemberAccount(input: $input) {
|
|
1020
1022
|
... on AccountNameNotAvailableError {
|
|
@@ -1066,7 +1068,7 @@
|
|
|
1066
1068
|
}
|
|
1067
1069
|
}
|
|
1068
1070
|
}
|
|
1069
|
-
`,
|
|
1071
|
+
`,Bt=o`
|
|
1070
1072
|
mutation CreateMemberVerification($input: CreateMemberVerificationInput!) {
|
|
1071
1073
|
createMemberVerification(input: $input) {
|
|
1072
1074
|
... on FileDoesNotExistError {
|
|
@@ -1080,7 +1082,7 @@
|
|
|
1080
1082
|
}
|
|
1081
1083
|
}
|
|
1082
1084
|
}
|
|
1083
|
-
`,
|
|
1085
|
+
`,Wt=o`
|
|
1084
1086
|
mutation UpdateMemberVerification($input: UpdateMemberVerificationInput!) {
|
|
1085
1087
|
updateMemberVerification(input: $input) {
|
|
1086
1088
|
... on FileDoesNotExistError {
|
|
@@ -1108,7 +1110,7 @@
|
|
|
1108
1110
|
accountPassword
|
|
1109
1111
|
}
|
|
1110
1112
|
}
|
|
1111
|
-
`,
|
|
1113
|
+
`,qt=o`
|
|
1112
1114
|
mutation SendVerificationCode($input: SendVerificationCodeInput!) {
|
|
1113
1115
|
sendVerificationCode(input: $input) {
|
|
1114
1116
|
... on InvalidPlatformError {
|
|
@@ -1119,7 +1121,7 @@
|
|
|
1119
1121
|
}
|
|
1120
1122
|
}
|
|
1121
1123
|
}
|
|
1122
|
-
|
|
1124
|
+
`,Ut=o`
|
|
1123
1125
|
fragment DepositGatewaySettingsCoreData on DepositGatewaySettings {
|
|
1124
1126
|
minimumAmount
|
|
1125
1127
|
maximumAmount
|
|
@@ -1184,7 +1186,7 @@
|
|
|
1184
1186
|
multiplier
|
|
1185
1187
|
}
|
|
1186
1188
|
}
|
|
1187
|
-
|
|
1189
|
+
`,$t=o`
|
|
1188
1190
|
query Platform {
|
|
1189
1191
|
timezone
|
|
1190
1192
|
currency
|
|
@@ -1298,7 +1300,7 @@
|
|
|
1298
1300
|
}
|
|
1299
1301
|
}
|
|
1300
1302
|
}
|
|
1301
|
-
`,
|
|
1303
|
+
`,Ne=o`
|
|
1302
1304
|
fragment ReferralFragment on Referral {
|
|
1303
1305
|
id
|
|
1304
1306
|
upline {
|
|
@@ -1337,7 +1339,7 @@
|
|
|
1337
1339
|
}
|
|
1338
1340
|
}
|
|
1339
1341
|
|
|
1340
|
-
${
|
|
1342
|
+
${Ne}
|
|
1341
1343
|
`,Kt=o`
|
|
1342
1344
|
query UplinesByName($search: String!, $first: Int) {
|
|
1343
1345
|
uplinesByName(search: $search, first: $first) {
|
|
@@ -1345,7 +1347,7 @@
|
|
|
1345
1347
|
}
|
|
1346
1348
|
}
|
|
1347
1349
|
|
|
1348
|
-
${
|
|
1350
|
+
${Ne}
|
|
1349
1351
|
`,zt=o`
|
|
1350
1352
|
query DownlinesByName($search: String!, $first: Int) {
|
|
1351
1353
|
downlinesByName(search: $search, first: $first) {
|
|
@@ -1353,7 +1355,7 @@
|
|
|
1353
1355
|
}
|
|
1354
1356
|
}
|
|
1355
1357
|
|
|
1356
|
-
${
|
|
1358
|
+
${Ne}
|
|
1357
1359
|
`,Jt=o`
|
|
1358
1360
|
query ReferralCommission {
|
|
1359
1361
|
member {
|
|
@@ -1387,10 +1389,12 @@
|
|
|
1387
1389
|
node {
|
|
1388
1390
|
... on Message {
|
|
1389
1391
|
id
|
|
1392
|
+
icon
|
|
1390
1393
|
logo
|
|
1394
|
+
image
|
|
1391
1395
|
title
|
|
1392
|
-
popup
|
|
1393
1396
|
content
|
|
1397
|
+
popup
|
|
1394
1398
|
actions {
|
|
1395
1399
|
name
|
|
1396
1400
|
url
|
|
@@ -1458,5 +1462,5 @@
|
|
|
1458
1462
|
mutation SkipOnboarding {
|
|
1459
1463
|
skipOnboarding
|
|
1460
1464
|
}
|
|
1461
|
-
`;function u(i){return{name:i,message:{MaximumBonusesCountLimitExceededError:"Maximum bonuses reached",InvalidPromoCodeError:"Invalid Promo Code",SpotBonusAlreadyClaimedError:"This promo code has already been redeemed and cannot be used again",RewardAlreadyExpiredError:"Reward is either expired or no longer available",AccountNameNotAvailableError:"Username is no longer available",AccountNotFoundError:"Account does not exist",AccountNotVerifiedError:"Account is not verified",CashbackBonusDoesNotExistError:"Cashback bonus does not exists",DepositPromoMaximumAmountExceededError:"Deposit amount exceeds maximum amount",DepositPromoMinimumAmountNotMetError:"Deposit amount does not meet minimum amount",EmailAddressNotAvailableError:"Email is no longer available",FileDoesNotExistError:"File does not exist",FileFormatNotSupportedError:"File format is not supported",FileNameTooLongError:"File name is too long",FileNotReadyError:"File is not yet ready",FileSizeTooBigError:"File size is too big",GameDoesNotExistError:"Game does not exist",HasActiveBonusError:"Account has active bonus",InsufficientPointsError:"Insufficient points",InvalidPlatformError:"Invalid platform",InvalidReCAPTCHAResponseError:"Invalid reCAPTCHA",InvalidSMSVerificationCodeError:"Invalid SMS verification code",InvalidTransactionPasswordError:"Invalid transaction password",InvalidVerificationCodeError:"Invalid verification code",InvalidWithdrawalAmountError:"Invalid withdrawal amount",MaximumDepositAmountExceededError:"Maximum deposit amount exceeded",MemberVerificationAlreadyApprovedError:"Member verification is already approved",MemberVerificationAlreadyExistsError:"Member verification already exists",MemberVerificationDoesNotExistError:"Member verification does not exist",MinimumAgeRequirementError:"Minimum age requirement not met",MinimumDepositAmountNotMetError:"Minimum deposit amount not met",MinimumFirstDepositAmountNotMetError:"Minimum first deposit amount not met",MobileNumberAlreadyVerifiedError:"Mobile number is already verified",MobileNumberNotAvailableError:"Mobile number is no longer available",MobileNumberNotVerifiedError:"Mobile number is not verified",NickNameNotAvailableError:"Nickname is no longer available",NotEnoughBalanceError:"Insufficient balance",NotReadyToSendVerficationCodeError:"Not ready to send verification code",PromoNotEnabledError:"Promo is not enabled",RealNameAlreadySetError:"Real name is already set",ValidIdAlreadySetError:"Valid ID is already set",WalletDoesNotExistError:"Wallet does not exist",WithdrawalDailyLimitExceededError:"Daily withdrawal limit exceeded",GameProviderError:"Game provider error",GameSessionAlreadyClosedError:"Game session is already closed",GameSessionDoesNotExistError:"Game session does not exist",ReferralCodeNotAvailableError:"Referral code is no longer available",AccountBlacklistedError:"Account is blacklisted",InvalidTokenError:"Invalid token",InvalidTokenOrSecretAnswerError:"Invalid token or secret answer",SessionExpiredError:"Session expired",RateLimitExceededError:"Maximum number of requests reached",RewardAlreadyClaimedError:"Reward is already claimed"}[i]}}class ma{constructor(e){c(this,"client");this.client=e}async memberAccount(){const e=await this.client.request(Tt);return e.ok?{ok:!0,data:e.data.memberAccount}:e}async registerMemberAccount(e){const t=await this.client.request(Rt,e);return t.ok?t.data.registerMemberAccount?{ok:!1,error:u(t.data.registerMemberAccount.__typename)}:{ok:!0}:t}async registerMemberAccountViaMobile(e){const t=await this.client.request(Dt,e);return t.ok?t.data.registerMemberAccountViaMobile?{ok:!1,error:u(t.data.registerMemberAccountViaMobile.__typename)}:{ok:!0}:t}async registerMemberAccount__next(e){const t=await this.client.request(Nt,e);return t.ok?t.data.registerMemberAccount?{ok:!1,error:u(t.data.registerMemberAccount.__typename)}:{ok:!0}:t}async updateMemberAccount(e){const t=await this.client.request(vt,e);return t.ok?t.data.updateMemberAccount?{ok:!1,error:u(t.data.updateMemberAccount.__typename)}:{ok:!0}:t}async deleteMemberAccount(e){const t=await this.client.request(Pt,e);return t.ok?t.data.deleteMemberAccount?{ok:!0}:{ok:!1,error:{name:"UnknownError",message:"Something went wrong."}}:t}async resetPassword(e){const t=await this.client.request(Gt,e);return t.ok?t.data.resetPassword?{ok:!1,error:u(t.data.resetPassword.__typename)}:{ok:!0}:t}async profileCompletion(){const e=await this.client.request(xt);return e.ok?{ok:!0,data:e.data.profileCompletion}:e}async platform(){return await this.client.request($t)}async sendVerificationCode(e){const t=await this.client.request(Ut,e);return t.ok?t.data.sendVerificationCode?{ok:!1,error:u(t.data.sendVerificationCode.__typename)}:{ok:!0}:t}async paymentSettings(){return await this.client.request(Lt)}async verifyMobileNumber(e){const t=await this.client.request(Ot,e);return t.ok?t.data.verifyMobileNumber?{ok:!1,error:u(t.data.verifyMobileNumber.__typename)}:{ok:!0}:t}async createMemberVerification(e){const t=await this.client.request(Wt,e);return t.ok?t.data.createMemberVerification?{ok:!1,error:u(t.data.createMemberVerification.__typename)}:{ok:!0}:t}async updateMemberVerification(e){const t=await this.client.request(Bt,e);return t.ok?t.data.updateMemberVerification?{ok:!1,error:u(t.data.updateMemberVerification.__typename)}:{ok:!0}:t}async memberVerification(){const e=await this.client.request(Mt);return e.ok?{ok:!0,data:e.data.memberAccount.verification}:e}async announcements(e){const t=await this.client.request(Je,e);return t.ok?{ok:!0,data:t.data.announcements}:t}async registerMayaMemberAccount(e){const t=await this.client.request(It,e);return t.ok?t.data.registerMayaMemberAccount?{ok:!1,error:u(t.data.registerMayaMemberAccount.__typename)}:{ok:!0}:t}async referralCode(){const e=await this.client.request(Yt);return e.ok?{ok:!0,data:e.data.referralCode}:e}async updateReferralCode(e){const t=await this.client.request(Qt,e);return t.ok?t.data.updateReferralCode?{ok:!1,error:u(t.data.updateReferralCode.__typename)}:{ok:!0}:t}async pointsClubSettings(){const e=await this.client.request(Xt);return e.ok?{ok:!0,data:e.data.pointsClubSettings}:e}}function h(i,e){const t=ve[i]?ve[i]:ve[500];return{name:t.name,message:e??t.message}}const ve={400:{name:"HttpBadRequest",message:"Bad Request"},401:{name:"HttpUnauthorized",message:"Unauthorized"},403:{name:"HttpForbidden",message:"Forbidden"},404:{name:"HttpNotFound",message:"Not Found"},408:{name:"HttpRequestTimeout",message:"Request Timeout"},429:{name:"HttpTooManyRequests",message:"Too Many Requests"},500:{name:"HttpInternalServerError",message:"Internal Server Error"}};class da{constructor(e){c(this,"url");c(this,"platform");this.url=e.url,this.platform=e.platform}get headers(){const e=new Headers;return e.append("Accept","application/json, text/plain"),e.append("Content-Type","application/json"),e.append("Platform-Code",this.platform),e.append("Role","MEMBER"),e}async createSession(e){const t=new Headers(this.headers);if(e.name){const a=`${e.name}:${e.password}`,r=Buffer.from(a).toString("base64");t.set("Authorization",`Basic ${r}`)}if(e.mobileNumber){const a=`${e.mobileNumber}:${e.verificationCode}`,r=Buffer.from(a).toString("base64");console.log(`MobileNumberOTP ${r}`),t.set("Authorization",`MobileNumberOTP ${r}`)}e.sessionId&&t.set("Authorization",`MayaSession ${e.sessionId}`),e.token&&t.set("Authorization",`Token ${e.token}`),e.reCAPTCHAResponse&&t.set("google-recaptcha-response",e.reCAPTCHAResponse);try{const a=await fetch(`${this.url}/sessions`,{method:"POST",headers:t}),r=await a.json();return a.ok?{ok:!0,data:r}:r.code==="ACCOUNT_BLACKLISTED"?{ok:!1,error:u("AccountBlacklistedError")}:r.code==="INVALID_RECAPTCHA_RESPONSE"?{ok:!1,error:u("InvalidReCAPTCHAResponseError")}:{ok:!1,error:h(a.status)}}catch{return{ok:!1,error:h(500)}}}async authenticate(e){const t=new Headers(this.headers);if(e.type==="SECURITY_QUESTION"){t.set("Authorization",`Bearer ${e.token}`);try{const a=await fetch(`${this.url}/session/${e.token}/authenticate`,{method:"POST",headers:t,body:JSON.stringify({secretAnswer:e.secretAnswer})}),r=await a.json();return a.ok?{ok:!0,data:r}:a.status===401||a.status===403?{ok:!1,error:u("InvalidTokenOrSecretAnswerError")}:{ok:!1,error:h(a.status)}}catch{return{ok:!1,error:h(500)}}}throw new Error("Invalid input 'type'")}async refreshSession(e){const t=new Headers(this.headers);t.append("Authorization",`Bearer ${e}`);try{const a=await fetch(`${this.url}/session:refresh`,{method:"POST",headers:t}),r=await a.json();return a.ok?{ok:!0,data:r}:r.code==="ACCOUNT_BLACKLISTED"?{ok:!1,error:u("AccountBlacklistedError")}:a.status===403||a.status===401?{ok:!1,error:u("InvalidTokenError")}:{ok:!1,error:h(a.status)}}catch{return{ok:!1,error:h(500)}}}async destroySession(e){const t=new Headers(this.headers);t.append("Authorization",`Bearer ${e}`);try{const a=await fetch(`${this.url}/session`,{method:"DELETE",headers:t});return a.ok?{ok:!0}:{ok:!1,error:h(a.status)}}catch{return{ok:!1,error:h(500)}}}async verifySession(e){const t=new Headers(this.headers);t.append("Authorization",`Bearer ${e}`);try{return(await fetch(`${this.url}/session`,{method:"GET",headers:t})).ok}catch{return!0}}async sendVerificationCode(e){if(e.channel==="EMAIL")throw new Error("Email channel is not yet supported");function t(a){switch(a){case"MEMBER_NOT_FOUND":return"AccountNotFoundError";case"RATE_LIMIT_REACH":return"RateLimitExceededError";case"NOT_READY_TO_SEND_VERIFICATION_ERROR":return"NotReadyToSendVerficationCodeError";default:return null}}try{const a=await fetch(`${this.url}/otps`,{method:"POST",headers:this.headers,body:JSON.stringify(e)});if(a.status===403){const r=await a.json(),s=t(r.message);return s?{ok:!1,error:u(s)}:{ok:!1,error:h(a.status,r.message)}}return a.ok?{ok:!0}:{ok:!1,error:h(a.status)}}catch{return{ok:!1,error:h(500)}}}}class ca{constructor(e){c(this,"url");c(this,"siteId");c(this,"platformId");this.url=e.url,this.siteId=e.site,this.platformId=e.platform}async self(){const e=await this.getJson(`/sites/${this.siteId}`);return e.ok?{ok:!0,data:e.data.data}:e}async games(e){var r,s,m,d,l,f,y,p,M,R,D,N,I,v,g,G,P,C,O,W,B,x,_,U,$,q,L,F,V,H,Y,Q;const t=new URLSearchParams;e!=null&&e.first&&t.set("first",e.first.toString()),e!=null&&e.after&&t.set("after",e.after),e!=null&&e.search&&t.set("search",e.search),(s=(r=e==null?void 0:e.filter)==null?void 0:r.type)!=null&&s.equal&&t.set("filter[type][eq]",e.filter.type.equal),(d=(m=e==null?void 0:e.filter)==null?void 0:m.type)!=null&&d.notEqual&&t.set("filter[type][neq]",e.filter.type.notEqual),(f=(l=e==null?void 0:e.filter)==null?void 0:l.type)!=null&&f.in&&t.set("filter[type][in]",e.filter.type.in.join(",")),(p=(y=e==null?void 0:e.filter)==null?void 0:y.type)!=null&&p.notIn&&t.set("filter[type][nin]",e.filter.type.notIn.join(",")),(R=(M=e==null?void 0:e.filter)==null?void 0:M.provider)!=null&&R.equal&&t.set("filter[provider][eq]",e.filter.provider.equal),(N=(D=e==null?void 0:e.filter)==null?void 0:D.provider)!=null&&N.notEqual&&t.set("filter[provider][neq]",e.filter.provider.notEqual),(v=(I=e==null?void 0:e.filter)==null?void 0:I.provider)!=null&&v.in&&t.set("filter[provider][in]",e.filter.provider.in.join(",")),(G=(g=e==null?void 0:e.filter)==null?void 0:g.provider)!=null&&G.notIn&&t.set("filter[provider][nin]",e.filter.provider.notIn.join(",")),(C=(P=e==null?void 0:e.filter)==null?void 0:P.tags)!=null&&C.equal&&t.set("filter[tags][eq]",e.filter.tags.equal.toLowerCase()),(W=(O=e==null?void 0:e.filter)==null?void 0:O.tags)!=null&&W.notEqual&&t.set("filter[tags][neq]",e.filter.tags.notEqual.toLowerCase()),(x=(B=e==null?void 0:e.filter)==null?void 0:B.tags)!=null&&x.in&&t.set("filter[tags][in]",e.filter.tags.in.map(k=>k.toLowerCase()).join(",")),(U=(_=e==null?void 0:e.filter)==null?void 0:_.tags)!=null&&U.notIn&&t.set("filter[tags][nin]",e.filter.tags.notIn.map(k=>k.toLowerCase()).join(",")),(q=($=e==null?void 0:e.filter)==null?void 0:$.reference)!=null&&q.equal&&t.set("filter[reference][eq]",e.filter.reference.equal),(F=(L=e==null?void 0:e.filter)==null?void 0:L.reference)!=null&&F.notEqual&&t.set("filter[reference][neq]",e.filter.reference.notEqual),(H=(V=e==null?void 0:e.filter)==null?void 0:V.reference)!=null&&H.in&&t.set("filter[reference][in]",e.filter.reference.in.join(",")),(Q=(Y=e==null?void 0:e.filter)==null?void 0:Y.reference)!=null&&Q.notIn&&t.set("filter[reference][nin]",e.filter.reference.notIn.join(",")),e!=null&&e.sort&&t.set("sort[order]",e.sort);const a=await this.getJson("/games",t);return a.ok?{ok:!0,data:{edges:a.data.data.map(k=>({node:k,cursor:k.cursor})),totalCount:a.data.totalCount??0,pageInfo:{hasNextPage:!!a.data.next,endCursor:a.data.next}}}:a}async game(e){var a;const t=await this.getJson(`/games/${e}`);return((a=t.error)==null?void 0:a.name)==="HttpNotFound"?{ok:!0,data:null}:t.ok?{ok:!0,data:t.data.data}:t}async getJson(e,t){const a=new Request(`${this.url}${e}?${(t==null?void 0:t.toString())??""}`,{method:"GET",headers:{Accept:"application/json","Content-Type":"application/json","Site-ID":this.siteId,"Platform-ID":this.platformId}});try{const r=await fetch(a);return r.ok?{ok:!0,data:await r.json()}:{ok:!1,error:h(r.status)}}catch{return{ok:!1,error:h(500)}}}}class ua{constructor(e){c(this,"client");this.client=e}async file(e){const t=await this.client.request(Ve,e);return t.ok?{ok:!0,data:t.data.node}:t}async uploadPrivateImageFile(e){const t=await this.client.upload(He,e);return t.ok?t.data.uploadPrivateImageFile?{ok:!1,error:u(t.data.uploadPrivateImageFile.__typename)}:{ok:!0}:t}}class la{constructor(e){c(this,"client");this.client=e}async gameSession(e){const t=await this.client.request(We.legacy,e);return t.ok?{ok:!0,data:t.data.node?{...t.data.node,game:t.data.node.game.id}:null}:t}async createGameSession(e){const t=await this.client.request(Be,e);return t.ok?t.data.createGameSession?{ok:!1,error:u(t.data.createGameSession.__typename)}:{ok:!0}:t}async endGameSession(e){const t=await this.client.request(xe.legacy,e);return t.ok?t.data.endGameSession?{ok:!1,error:{name:"UnknownError",message:"Something went wrong."}}:{ok:!0}:t}}class pa{constructor(e){c(this,"client");this.client=e}async latestBetRecords(){const e=await this.client.request(wt);return e.ok?{ok:!0,data:e.data.latestBetRecords}:e}async platform(){const e=await this.client.request(qt);return e.ok?{ok:!0,data:e.data}:e}async recommendedGames(){const e=await this.client.request(ze);return e.ok?{ok:!0,data:e.data.recommendedGames}:e}async onboardingStatus(){const e=await this.client.request(oa);return e.ok?{ok:e.ok,data:e.data.onboardingStatus??[]}:e}async completeOnboarding(e){const t=await this.client.request(ia,e);return t.ok?t.data.completeOnboarding?{ok:!0}:{ok:!1,error:{name:"UnknownError",message:"Something went wrong"}}:t}async skipOnboarding(){const e=await this.client.request(sa);return e.ok?e.data.skipOnboarding?{ok:!0}:{ok:!1,error:{name:"UnknownError",message:"Something went wrong"}}:e}}class fa{constructor(e){c(this,"client");this.client=e}async betRecords(e){const t=await this.client.request(ft,e);return t.ok?{ok:t.ok,data:t.data.member.betRecords}:t}async transactionRecords(e){const t=await this.client.request(yt,e);return t.ok?{ok:t.ok,data:t.data.member.transactionRecords}:t}async withdrawalRecords(e){const t=await this.client.request(Xe,e);return t.ok?{ok:t.ok,data:t.data.member.withdrawalRecords}:t}async depositRecords(e){const t=await this.client.request(it,e);return t.ok?{ok:t.ok,data:t.data.member.depositRecords}:t}async depositsCount(){const e=await this.client.request(pt);return e.ok?{ok:e.ok,data:e.data.member.depositsCount}:e}async pointsWalletTransactions(e){const t=await this.client.request(Ke,e);return t.ok?{ok:t.ok,data:t.data.member.pointsWalletTransactions}:t}async activityRecords(e){const t=await this.client.request(Ht,e);return t.ok?{ok:t.ok,data:t.data.member.activityRecords}:t}async referrals(e){const t=await this.client.request(jt,e);return t.ok?{ok:t.ok,data:t.data.member.referrals}:t}async referralCommission(){const e=await this.client.request(Jt);return e.ok?{ok:e.ok,data:e.data.member.referralCommission}:e}async uplinesByName(e){const t=await this.client.request(Kt,e);return t.ok?{ok:t.ok,data:t.data.uplinesByName}:t}async downlinesByName(e){const t=await this.client.request(zt,e);return t.ok?{ok:t.ok,data:t.data.downlinesByName}:t}async promoByCode(e){const t=await this.client.request(Et,e);return t.ok?{ok:t.ok,data:t.data.promoByCode}:t}}class wa{constructor(e){c(this,"client");this.client=e}async messages(e){const t=await this.client.request(Zt,e);return t.ok?{ok:t.ok,data:t.data.messages}:t}async unreadMessagesCount(e){const t=await this.client.request(ea,{...e,filter:{...e==null?void 0:e.filter,markedAsRead:{equal:!1}}});return t.ok?{ok:t.ok,data:t.data.messages.totalCount}:t}async markMessageAsRead(e){const t=await this.client.request(ta,e);return t.ok?t.data.markMessageAsRead?{ok:!0}:{ok:!1,error:{name:"UnknownError",message:"Something went wrong."}}:t}async markAllMessageAsRead(){const e=await this.client.request(aa);return e.ok?e.data.markAllMessageAsRead?{ok:!0}:{ok:!1,error:{name:"UnknownError",message:"Something went wrong."}}:e}async claimReward(e){const t=await this.client.request(ra,e);return t.ok?t.data.claimReward?{ok:!1,error:u(t.data.claimReward.__typename)}:{ok:!0}:t}}class ya{constructor(e){c(this,"client");this.client=e}async promos(){const e=await this.client.request(ht);return e.ok?{ok:e.ok,data:e.data.promos}:e}async cashbacks(){const e=await this.client.request(At);return e.ok?{ok:e.ok,data:e.data.cashbacks}:e}async availablePromos(e){const t=await this.client.request(gt,e);return t.ok?{ok:t.ok,data:t.data.availablePromos}:t}async cashbackBonuses(){const e=await this.client.request(Ct);return e.ok?{ok:e.ok,data:e.data.cashbackBonuses}:e}async claimCashbackBonus(e){const t=await this.client.request(_t,e);return t.ok?t.data.claimCashbackBonus?{ok:!1,error:u(t.data.claimCashbackBonus.__typename)}:{ok:!0}:{ok:t.ok,error:t.error}}async bonus(){const e=await this.client.request(St);return e.ok?{ok:e.ok,data:e.data.bonus}:e}async wallet(){const e=await this.client.request(Ye);return e.ok?{ok:e.ok,data:e.data.wallet}:e}async deposit(e){const t=await this.client.request(lt,e);return t.ok?{ok:t.ok,data:t.data.node}:t}async createGCashDeposit(e){const t=await this.client.request(st,e);return t.ok?t.data.createGCashDeposit?{ok:!1,error:u(t.data.createGCashDeposit.__typename)}:{ok:!0}:t}async createMayaDeposit(e){const t=await this.client.request(mt,e);return t.ok?t.data.createMayaDeposit?{ok:!1,error:u(t.data.createMayaDeposit.__typename)}:{ok:!0}:t}async createAIOQRPHDeposit(e){const t=await this.client.request(ct,e);return t.ok?t.data.createAIOQRPHDeposit?{ok:!1,error:u(t.data.createAIOQRPHDeposit.__typename)}:{ok:!0}:t}async createAIOOnlineBankDeposit(e){const t=await this.client.request(ut,e);return t.ok?t.data.createAIOOnlineBankDeposit?{ok:!1,error:u(t.data.createAIOOnlineBankDeposit.__typename)}:{ok:!0}:t}async createMayaAppDeposit(e){const t=await this.client.request(dt,e);return t.ok?t.data.createMayaAppDeposit?{ok:!1,error:u(t.data.createMayaAppDeposit.__typename)}:{ok:!0}:t}async createGCashWithdrawal(e){const t=await this.client.request(Ze,e);return t.ok?t.data.createGCashWithdrawal?{ok:!1,error:u(t.data.createGCashWithdrawal.__typename)}:{ok:!0}:t}async createMayaWithdrawal(e){const t=await this.client.request(et,e);return t.ok?t.data.createMayaWithdrawal?{ok:!1,error:u(t.data.createMayaWithdrawal.__typename)}:{ok:!0}:t}async createMayaAppWithdrawal(e){const t=await this.client.request(tt,e);return t.ok?t.data.createMayaAppWithdrawal?{ok:!1,error:u(t.data.createMayaAppWithdrawal.__typename)}:{ok:!0}:t}async createBankWithdrawal(e){const t=await this.client.request(at,e);return t.ok?t.data.createBankWithdrawal?{ok:!1,error:u(t.data.createBankWithdrawal.__typename)}:{ok:!0}:t}async createAIOInstapayWithdrawal(e){const t=await this.client.request(rt,e);return t.ok?t.data.createAIOInstapayWithdrawal?{ok:!1,error:u(t.data.createAIOInstapayWithdrawal.__typename)}:{ok:!0}:t}async instapayBankList(){const e=await this.client.request(nt);return e.ok?{ok:e.ok,data:e.data.instapayBankList}:e}async remainingDailyWithdrawalsCount(){const e=await this.client.request(ot);return e.ok?{ok:e.ok,data:e.data.remainingDailyWithdrawalsCount}:e}async pointsWallet(){const e=await this.client.request(Qe);return e.ok?{ok:e.ok,data:e.data.pointsWallet}:e}async redeemPointsToCash(e){const t=await this.client.request(je,e);return t.ok?t.data.redeemPointsToCash?{ok:!1,error:u(t.data.redeemPointsToCash.__typename)}:{ok:!0}:t}async mayaSession(e){const t=await this.client.request(Ft,e);return t.ok?{ok:t.ok,data:t.data.mayaSession}:t}async gameSession(e){const t=await this.client.request(We.current,e);return t.ok?{ok:!0,data:t.data.node}:t}async createGameSession(e){const t=await this.client.request(Be,e);return t.ok?t.data.createGameSession?{ok:!1,error:u(t.data.createGameSession.__typename)}:{ok:!0}:t}async endGameSession(e){const t=await this.client.request(xe.current,e);return t.ok?t.data.endGameSession?{ok:!0}:{ok:!1,error:{name:"UnknownError",message:"Something went wrong."}}:t}async validateMayaSession(){const e=await this.client.request(Vt);return e.ok?e.data.validateMayaSession?{ok:!0}:{ok:!1,error:{name:"UnknownError",message:"Something went wrong."}}:e}async bonuses(){const e=await this.client.request(kt);return e.ok?{ok:e.ok,data:e.data.bonuses??[]}:e}async claimSpotBonus(e){var a;const t=await this.client.request(na,e);return t.ok?t.data.claimSpotBonus?{ok:!1,error:u((a=t.data.claimSpotBonus)==null?void 0:a.__typename)}:{ok:!0}:{ok:t.ok,error:t.error}}}function Ge(i){return new Date(i.getTime())}function j(i,e){const t=Ge(i);return t.setMinutes(t.getMinutes()+e),t}function Pe(i,e){return i.getTime()>e.getTime()}class ha{constructor(e){c(this,"config");c(this,"cache");this.cache={},this.config={cacheTime:5,...e}}set(e,t){const a=j(new Date,this.config.cacheTime);this.cache[e]={value:t,validUntil:a}}get(e){const t=this.cache[e];return!t||Pe(new Date,t.validUntil)?null:t.value}}function ga(i,e,t){return i<e?e:i>t?t:i}function Oe(i){return Object.prototype.toString.call(i)==="[object Object]"&&Object(i)===i}function ba(i){const e=[];function t(a,r=[]){for(const s in a){const m=a[s];Oe(m)?t(m,[...r,s]):Array.isArray(m)?t(Ea(m),[...r,s]):e.push({key:[...r,s],value:m})}}return t(i),e}function Ea(i){return i.reduce((e,t,a)=>(e[a]=t,e),{})}class K{constructor(e,t){c(this,"url");c(this,"options");c(this,"middlewares");var r;const a=new Headers((r=t==null?void 0:t.fetchOptions)==null?void 0:r.headers);this.url=e,this.options={...t==null?void 0:t.fetchOptions,headers:a},this.middlewares=(t==null?void 0:t.middlewares)??[]}async request(e,t){const a=JSON.stringify({query:e,variables:t}),r=new Headers(this.options.headers);r.set("Content-Type","application/json"),r.set("Accept","application/json");const s=new URL(this.url),m=Aa(e);m&&s.searchParams.set(`_${m.type}`,m.name);const d=await this.runMiddlewares(new Request(s,{...this.options,body:a,headers:r,method:"POST"}));return await this.exec(d)}async upload(e,t){const a=this.createUploadBody(e,t),r=new Headers(this.options.headers);r.delete("Content-Type");const s=await this.runMiddlewares(new Request(this.url,{...this.options,body:a,headers:r,method:"POST"}));return await this.exec(s)}async exec(e){var t,a,r,s,m,d;try{const l=await fetch(e);if(!l.ok)return{ok:!1,error:h(l.status)};const f=await l.json(),y=f.data,p=(t=f.errors)==null?void 0:t.at(0);return p?((a=p.extensions)==null?void 0:a.code)==="FORBIDDEN"||((r=p.extensions)==null?void 0:r.code)==="ACCESS_TOKEN_EXPIRED"?{ok:!1,error:h(403,p.message)}:((s=p.extensions)==null?void 0:s.code)==="UNAUTHORIZED"?{ok:!1,error:h(401,p.message)}:((m=p.extensions)==null?void 0:m.code)==="BAD_USER_INPUT"||((d=p.extensions)==null?void 0:d.code)==="BAD_REQUEST"?{ok:!1,error:h(400,p.message)}:{ok:!1,error:h(500,p.message)}:{ok:!0,data:y}}catch{return{ok:!1,error:h(500)}}}async runMiddlewares(e){let t=e.clone();for(const a of this.middlewares)t=await a(t);return t}createUploadBody(e,t){const a=ba(t).filter(m=>m.value instanceof File||m.value instanceof Blob),r=new FormData;r.append("operations",JSON.stringify({query:e,variables:t}));const s={};return a.forEach((m,d)=>{s[d.toString()]=[`variables.${m.key.join(".")}`]}),r.append("map",JSON.stringify(s)),a.forEach((m,d)=>{r.append(d.toString(),m.value)}),r}}function Aa(i){const e=i.match(/(query|mutation)\s+(\w+)/);if(!e)return null;const t=e.at(1),a=e.at(2);return t&&a?{type:t,name:a}:null}function Sa(i){return i==="INR"?"en-IN":i==="MYR"?"en-MY":i==="IDR"?"en-ID":i==="USD"?"en-US":"en-PH"}function ka(i){return i==="en-IN"?"+91":i==="en-MY"?"+60":i==="en-ID"?"+62":i==="en-US"?"+1":"+63"}function T(i,e){const t=ka(e);return i.startsWith(t)?i:i.startsWith(t.substring(1))?`+${i}`:i.startsWith("0")?`${t}${i.substring(1)}`:`${t}${i}`}async function A(i){const e=new TextEncoder().encode(i),t=await crypto.subtle.digest("SHA-256",e);return Array.from(new Uint8Array(t)).map(s=>s.toString(16).padStart(2,"0")).join("")}class $e{constructor(e){c(this,"enabled");this.enabled=(e==null?void 0:e.enabled)??!0}info(e){this.enabled&&console.log(`\x1B[34m[info] ${e}`)}warn(e){this.enabled&&console.log(`\x1B[33m[warn] ${e}`)}error(e){this.enabled&&console.log(`\x1B[31m[error] ${e}`)}success(e){this.enabled&&console.log(`\x1B[32m[success] ${e}`)}}function z(i,e){const t=Ge(i);return t.setDate(t.getDate()+e),t}function qe(i){return new Promise(e=>{setTimeout(e,i)})}function Le(i,e){const{until:t,interval:a=1e3,maxAttempt:r=3}=e;async function s(m,d){const l=d??r,f=await i(...m);return t(f)?f:l>1?(await qe(a*((r-l)/2)),s(m,l-1)):f}return async(...m)=>await s(m)}function J(i,e){const t=Ge(i);return t.setMinutes(t.getMinutes()-e),t}class Ca{constructor(e){c(this,"logger");c(this,"storageKey","session");c(this,"authService");c(this,"walletService");c(this,"_refreshing",!1);this.authService=e.authService,this.walletService=e.walletService,this.logger=new $e({enabled:e.logs??!1})}get refreshing(){return this._refreshing}set refreshing(e){this._refreshing=e}async create(e){var r;if(this.isServer)return this.logger.warn("'localStorage' is not available on the server."),{ok:!1,error:{name:"UnknownError",message:"Server sign in is not supported."}};if(e.type==="MAYA"){const m=await Le(()=>this.walletService.mayaSession({id:e.sessionId}),{until:y=>{var p;return y.ok&&((p=y.data)==null?void 0:p.member)!=null},interval:1e3,maxAttempt:5})();if(!m.ok)return m;if(!((r=m.data)!=null&&r.member))return{ok:!1,error:{name:"HttpForbidden",message:"Forbidden"}};const l=await Le(()=>this.authService.createSession(e),{until:y=>y.ok,interval:1e3,maxAttempt:5})();if(!l.ok)return l;const f=new Date;return window.localStorage.setItem(this.storageKey,JSON.stringify({...l.data,accessTokenExpiresAt:j(f,8).getTime(),refreshTokenExpiresAt:J(z(f,30),2).getTime()})),{ok:!0,data:null}}if(e.type==="MOBILE_NUMBER"){const s=await this.authService.createSession(e);if(s.ok){const m=new Date;return window.localStorage.setItem(this.storageKey,JSON.stringify({...s.data,accessTokenExpiresAt:j(m,8).getTime(),refreshTokenExpiresAt:J(z(m,30),2).getTime()})),{ok:!0,data:null}}return s}if(e.type==="TOKEN"){const s=await this.authService.createSession({token:e.token});if(s.ok){const m=new Date;return window.localStorage.setItem(this.storageKey,JSON.stringify({...s.data,accessTokenExpiresAt:j(m,8).getTime(),refreshTokenExpiresAt:J(z(m,30),2).getTime()})),{ok:!0,data:null}}return s}const t=await this.authService.createSession(e);if(!t.ok)return t;if(t.data.authenticator)return{ok:!0,data:{authenticator:t.data.authenticator}};const a=new Date;return window.localStorage.setItem(this.storageKey,JSON.stringify({...t.data,accessTokenExpiresAt:j(a,8).getTime(),refreshTokenExpiresAt:J(z(a,30),2).getTime()})),{ok:!0,data:null}}async createFromAuthenticator(e){const t=await this.authService.authenticate(e);if(t.ok){const a=new Date;return this.isServer?this.logger.warn("'localStorage' is not available on the server."):window.localStorage.setItem(this.storageKey,JSON.stringify({...t.data,accessTokenExpiresAt:j(a,8).getTime(),refreshTokenExpiresAt:J(z(a,30),2).getTime()})),{ok:!0}}else return t}async get(){if(this.isServer)return this.logger.warn("'localStorage' is not available on the server."),{ok:!0,data:null};if(this.refreshing)return await qe(1e3),await this.get();const e=window.localStorage.getItem(this.storageKey);if(!e)return{ok:!0,data:null};try{let t=JSON.parse(e),a=new Date;const r=new Date(t.accessTokenExpiresAt),s=new Date(t.refreshTokenExpiresAt);if(Pe(a,s))return this.logger.warn("Session expired. Logging out.."),window.localStorage.removeItem(this.storageKey),{ok:!1,error:{name:"SessionExpiredError",message:"Session expired."}};if(Pe(a,r)){this.logger.info("Refreshing session..."),this.refreshing=!0;const m=await this.authService.refreshSession(t.refreshToken);if(this.refreshing=!1,!m.ok)return this.logger.error(`Failed to refresh session: ${m.error.message}`),m.error.name==="InvalidTokenError"||m.error.name==="AccountBlacklistedError"?(window.localStorage.removeItem(this.storageKey),{ok:!1,error:m.error}):(this.logger.warn("Old session returned."),{ok:!0,data:t});this.logger.success("Session refreshed!"),a=new Date,t={...t,...m.data,accessTokenExpiresAt:j(a,8).getTime(),refreshTokenExpiresAt:J(z(a,30),2).getTime()},window.localStorage.setItem(this.storageKey,JSON.stringify(t))}return{ok:!0,data:t}}catch{return{ok:!1,error:{name:"UnknownError",message:"Something went wrong."}}}}async destroy(){var t;if(this.isServer){this.logger.warn("'localStorage' is not available on the server.");return}const e=await this.get();(t=e.data)!=null&&t.accessToken&&await this.authService.destroySession(e.data.accessToken),window.localStorage.removeItem(this.storageKey)}async verify(){var a,r,s;if(this.isServer)return this.logger.warn("'localStorage' is not available on the server."),!0;const e=await this.get();if(((a=e.error)==null?void 0:a.name)==="InvalidTokenError"||((r=e.error)==null?void 0:r.name)==="SessionExpiredError"||((s=e.error)==null?void 0:s.name)==="AccountBlacklistedError")return!1;if(!e.data)return!0;const t=await this.authService.verifySession(e.data.accessToken);return t||window.localStorage.removeItem(this.storageKey),t}get isServer(){return typeof window>"u"}}function S(i){const e={};for(const t in i){const a=i[t];if(a!==null&&a!==void 0){if(Oe(a)){e[t]=S(a);continue}if(Array.isArray(a)){e[t]=a.map(r=>Oe(r)?S(r):r);continue}e[t]=a}}return e}function n(i,e){if(typeof i=="number"&&!Number.isNaN(i))return i;if(typeof i=="string"){const t=Number.parseFloat(i);if(!Number.isNaN(t))return t}return e}class _a{get transform(){return{site:this.site.bind(this),platform:this.platform.bind(this),account:this.account.bind(this),wallet:this.wallet.bind(this),verificationDetails:this.verificationDetails.bind(this),profileCompletion:this.profileCompletion.bind(this),announcement:this.announcement.bind(this),withdrawalRecord:this.withdrawalRecord.bind(this),deposit:this.deposit.bind(this),depositRecord:this.depositRecord.bind(this),betRecord:this.betRecord.bind(this),latestBetRecord:this.latestBetRecord.bind(this),transactionRecord:this.transactionRecord.bind(this),game:this.game.bind(this),gameSession:this.gameSession.bind(this),promo:this.promo.bind(this),cashback:this.cashback.bind(this),bonus:this.bonus.bind(this),cashbackBonus:this.cashbackBonus.bind(this),file:this.file.bind(this),pointsWallet:this.pointsWallet.bind(this),pointsWalletTransaction:this.pointsWalletTransaction.bind(this),activityRecord:this.activityRecord.bind(this),referral:this.referral.bind(this),referralCommission:this.referralCommission.bind(this),platform__next:this.platform__next.bind(this),pointsClubSettings:this.pointsClubSettings.bind(this),paymentSettings:this.paymentSettings.bind(this),message:this.message.bind(this),instapayBank:this.instapayBank.bind(this),promoByCode:this.promoByCode.bind(this)}}site(e){const t={id:e.id,name:e.name,logo:e.logo??void 0,fields:e.config.fields};return S(t)}platform(e){var t,a,r,s,m,d,l,f,y,p,M,R,D,N,I,v,g,G,P,C,O,W,B,x,_,U,$,q,L,F,V,H,Y,Q,k,X,Z,ee,te,ae,re,ne,oe,ie,se,me,de,ce,ue,le,pe,fe,we,ye,he,ge,be,Ee,Ae,Se,ke,Ce,_e,Te,Me,Re,Fe;return{timezone:e.timezone,currency:e.currency,paymentSettings:{minimumFirstDepositAmount:n(e.minimumFirstDepositAmount),restrictWithdrawalsToVerifiedMembers:e.restrictWithdrawalsToVerifiedMembers,depositGateway:{bank:{androidEnabled:((t=e.bankDepositGatewaySettings)==null?void 0:t.androidEnabled)??!1,iosEnabled:((a=e.bankDepositGatewaySettings)==null?void 0:a.iosEnabled)??!1,webEnabled:((r=e.bankDepositGatewaySettings)==null?void 0:r.webEnabled)??!1,mobileWebEnabled:((s=e.bankDepositGatewaySettings)==null?void 0:s.mobileWebEnabled)??!1,minimumAmount:n((m=e.bankDepositGatewaySettings)==null?void 0:m.minimumAmount),maximumAmount:n((d=e.bankDepositGatewaySettings)==null?void 0:d.maximumAmount)},gcash:{androidEnabled:((l=e.gcashDepositGatewaySettings)==null?void 0:l.androidEnabled)??!1,iosEnabled:((f=e.gcashDepositGatewaySettings)==null?void 0:f.iosEnabled)??!1,webEnabled:((y=e.gcashDepositGatewaySettings)==null?void 0:y.webEnabled)??!1,mobileWebEnabled:((p=e.gcashDepositGatewaySettings)==null?void 0:p.mobileWebEnabled)??!1,minimumAmount:n((M=e.gcashDepositGatewaySettings)==null?void 0:M.minimumAmount),maximumAmount:n((R=e.gcashDepositGatewaySettings)==null?void 0:R.maximumAmount)},maya:{androidEnabled:((D=e.mayaDepositGatewaySettings)==null?void 0:D.androidEnabled)??!1,iosEnabled:((N=e.mayaDepositGatewaySettings)==null?void 0:N.iosEnabled)??!1,webEnabled:((I=e.mayaDepositGatewaySettings)==null?void 0:I.webEnabled)??!1,mobileWebEnabled:((v=e.mayaDepositGatewaySettings)==null?void 0:v.mobileWebEnabled)??!1,minimumAmount:n((g=e.mayaDepositGatewaySettings)==null?void 0:g.minimumAmount),maximumAmount:n((G=e.mayaDepositGatewaySettings)==null?void 0:G.maximumAmount)},mayaApp:{androidEnabled:((P=e.mayaAppDepositGatewaySettings)==null?void 0:P.androidEnabled)??!1,iosEnabled:((C=e.mayaAppDepositGatewaySettings)==null?void 0:C.iosEnabled)??!1,webEnabled:((O=e.mayaAppDepositGatewaySettings)==null?void 0:O.webEnabled)??!1,mobileWebEnabled:((W=e.mayaAppDepositGatewaySettings)==null?void 0:W.mobileWebEnabled)??!1,minimumAmount:n((B=e.mayaAppDepositGatewaySettings)==null?void 0:B.minimumAmount),maximumAmount:n((x=e.mayaAppDepositGatewaySettings)==null?void 0:x.maximumAmount)},onlineBank:{androidEnabled:((_=e.onlineBankDepositGatewaySettings)==null?void 0:_.androidEnabled)??!1,iosEnabled:((U=e.onlineBankDepositGatewaySettings)==null?void 0:U.iosEnabled)??!1,webEnabled:(($=e.onlineBankDepositGatewaySettings)==null?void 0:$.webEnabled)??!1,mobileWebEnabled:((q=e.onlineBankDepositGatewaySettings)==null?void 0:q.mobileWebEnabled)??!1,minimumAmount:n((L=e.onlineBankDepositGatewaySettings)==null?void 0:L.minimumAmount),maximumAmount:n((F=e.onlineBankDepositGatewaySettings)==null?void 0:F.maximumAmount)},qrph:{androidEnabled:((V=e.qrphDepositGatewaySettings)==null?void 0:V.androidEnabled)??!1,iosEnabled:((H=e.qrphDepositGatewaySettings)==null?void 0:H.iosEnabled)??!1,webEnabled:((Y=e.qrphDepositGatewaySettings)==null?void 0:Y.webEnabled)??!1,mobileWebEnabled:((Q=e.qrphDepositGatewaySettings)==null?void 0:Q.mobileWebEnabled)??!1,minimumAmount:n((k=e.qrphDepositGatewaySettings)==null?void 0:k.minimumAmount),maximumAmount:n((X=e.qrphDepositGatewaySettings)==null?void 0:X.maximumAmount)}},withdrawalGateway:{bank:{androidEnabled:((Z=e.bankWithdrawalGatewaySettings)==null?void 0:Z.androidEnabled)??!1,iosEnabled:((ee=e.bankWithdrawalGatewaySettings)==null?void 0:ee.iosEnabled)??!1,webEnabled:((te=e.bankWithdrawalGatewaySettings)==null?void 0:te.webEnabled)??!1,mobileWebEnabled:((ae=e.bankWithdrawalGatewaySettings)==null?void 0:ae.mobileWebEnabled)??!1,minimumAmount:n((re=e.bankWithdrawalGatewaySettings)==null?void 0:re.minimumAmount),maximumAmount:n((ne=e.bankWithdrawalGatewaySettings)==null?void 0:ne.maximumAmount)},gcash:{androidEnabled:((oe=e.gcashWithdrawalGatewaySettings)==null?void 0:oe.androidEnabled)??!1,iosEnabled:((ie=e.gcashWithdrawalGatewaySettings)==null?void 0:ie.iosEnabled)??!1,webEnabled:((se=e.gcashWithdrawalGatewaySettings)==null?void 0:se.webEnabled)??!1,mobileWebEnabled:((me=e.gcashWithdrawalGatewaySettings)==null?void 0:me.mobileWebEnabled)??!1,minimumAmount:n((de=e.gcashWithdrawalGatewaySettings)==null?void 0:de.minimumAmount),maximumAmount:n((ce=e.gcashWithdrawalGatewaySettings)==null?void 0:ce.maximumAmount,1e6)},maya:{androidEnabled:((ue=e.mayaWithdrawalGatewaySettings)==null?void 0:ue.androidEnabled)??!1,iosEnabled:((le=e.mayaWithdrawalGatewaySettings)==null?void 0:le.iosEnabled)??!1,webEnabled:((pe=e.mayaWithdrawalGatewaySettings)==null?void 0:pe.webEnabled)??!1,mobileWebEnabled:((fe=e.mayaWithdrawalGatewaySettings)==null?void 0:fe.mobileWebEnabled)??!1,minimumAmount:n((we=e.mayaWithdrawalGatewaySettings)==null?void 0:we.minimumAmount),maximumAmount:n((ye=e.mayaWithdrawalGatewaySettings)==null?void 0:ye.maximumAmount)},mayaApp:{androidEnabled:((he=e.mayaAppWithdrawalGatewaySettings)==null?void 0:he.androidEnabled)??!1,iosEnabled:((ge=e.mayaAppWithdrawalGatewaySettings)==null?void 0:ge.iosEnabled)??!1,webEnabled:((be=e.mayaAppWithdrawalGatewaySettings)==null?void 0:be.webEnabled)??!1,mobileWebEnabled:((Ee=e.mayaAppWithdrawalGatewaySettings)==null?void 0:Ee.mobileWebEnabled)??!1,minimumAmount:n((Ae=e.mayaAppWithdrawalGatewaySettings)==null?void 0:Ae.minimumAmount),maximumAmount:n((Se=e.mayaAppWithdrawalGatewaySettings)==null?void 0:Se.maximumAmount,1e6)},instapay:{androidEnabled:((ke=e.instapayWithdrawalGatewaySettings)==null?void 0:ke.androidEnabled)??!1,iosEnabled:((Ce=e.instapayWithdrawalGatewaySettings)==null?void 0:Ce.iosEnabled)??!1,webEnabled:((_e=e.instapayWithdrawalGatewaySettings)==null?void 0:_e.webEnabled)??!1,mobileWebEnabled:((Te=e.instapayWithdrawalGatewaySettings)==null?void 0:Te.mobileWebEnabled)??!1,minimumAmount:n((Me=e.instapayWithdrawalGatewaySettings)==null?void 0:Me.minimumAmount),maximumAmount:n((Re=e.instapayWithdrawalGatewaySettings)==null?void 0:Re.maximumAmount,1e6)}}},pointsClubSettings:{multiplier:n((Fe=e.pointsClubSettings)==null?void 0:Fe.multiplier,0)}}}platform__next(e){return{currency:e.currency,timezone:e.timezone,locale:Sa(e.currency)}}pointsClubSettings(e){return{multiplier:n(e.multiplier,0)}}paymentSettings(e){var t,a,r,s,m,d,l,f,y,p,M,R,D,N,I,v,g,G,P,C,O,W,B,x,_,U,$,q,L,F,V,H,Y,Q,k,X,Z,ee,te,ae,re,ne,oe,ie,se,me,de,ce,ue,le,pe,fe,we,ye,he,ge,be,Ee,Ae,Se,ke,Ce,_e,Te,Me,Re;return{minimumFirstDepositAmount:n(e.minimumFirstDepositAmount),restrictWithdrawalsToVerifiedMembers:e.restrictWithdrawalsToVerifiedMembers,depositGateway:{bank:{androidEnabled:((t=e.bankDepositGatewaySettings)==null?void 0:t.androidEnabled)??!1,iosEnabled:((a=e.bankDepositGatewaySettings)==null?void 0:a.iosEnabled)??!1,webEnabled:((r=e.bankDepositGatewaySettings)==null?void 0:r.webEnabled)??!1,mobileWebEnabled:((s=e.bankDepositGatewaySettings)==null?void 0:s.mobileWebEnabled)??!1,minimumAmount:n((m=e.bankDepositGatewaySettings)==null?void 0:m.minimumAmount),maximumAmount:n((d=e.bankDepositGatewaySettings)==null?void 0:d.maximumAmount)},gcash:{androidEnabled:((l=e.gcashDepositGatewaySettings)==null?void 0:l.androidEnabled)??!1,iosEnabled:((f=e.gcashDepositGatewaySettings)==null?void 0:f.iosEnabled)??!1,webEnabled:((y=e.gcashDepositGatewaySettings)==null?void 0:y.webEnabled)??!1,mobileWebEnabled:((p=e.gcashDepositGatewaySettings)==null?void 0:p.mobileWebEnabled)??!1,minimumAmount:n((M=e.gcashDepositGatewaySettings)==null?void 0:M.minimumAmount),maximumAmount:n((R=e.gcashDepositGatewaySettings)==null?void 0:R.maximumAmount)},maya:{androidEnabled:((D=e.mayaDepositGatewaySettings)==null?void 0:D.androidEnabled)??!1,iosEnabled:((N=e.mayaDepositGatewaySettings)==null?void 0:N.iosEnabled)??!1,webEnabled:((I=e.mayaDepositGatewaySettings)==null?void 0:I.webEnabled)??!1,mobileWebEnabled:((v=e.mayaDepositGatewaySettings)==null?void 0:v.mobileWebEnabled)??!1,minimumAmount:n((g=e.mayaDepositGatewaySettings)==null?void 0:g.minimumAmount),maximumAmount:n((G=e.mayaDepositGatewaySettings)==null?void 0:G.maximumAmount)},mayaApp:{androidEnabled:((P=e.mayaAppDepositGatewaySettings)==null?void 0:P.androidEnabled)??!1,iosEnabled:((C=e.mayaAppDepositGatewaySettings)==null?void 0:C.iosEnabled)??!1,webEnabled:((O=e.mayaAppDepositGatewaySettings)==null?void 0:O.webEnabled)??!1,mobileWebEnabled:((W=e.mayaAppDepositGatewaySettings)==null?void 0:W.mobileWebEnabled)??!1,minimumAmount:n((B=e.mayaAppDepositGatewaySettings)==null?void 0:B.minimumAmount),maximumAmount:n((x=e.mayaAppDepositGatewaySettings)==null?void 0:x.maximumAmount)},onlineBank:{androidEnabled:((_=e.onlineBankDepositGatewaySettings)==null?void 0:_.androidEnabled)??!1,iosEnabled:((U=e.onlineBankDepositGatewaySettings)==null?void 0:U.iosEnabled)??!1,webEnabled:(($=e.onlineBankDepositGatewaySettings)==null?void 0:$.webEnabled)??!1,mobileWebEnabled:((q=e.onlineBankDepositGatewaySettings)==null?void 0:q.mobileWebEnabled)??!1,minimumAmount:n((L=e.onlineBankDepositGatewaySettings)==null?void 0:L.minimumAmount),maximumAmount:n((F=e.onlineBankDepositGatewaySettings)==null?void 0:F.maximumAmount)},qrph:{androidEnabled:((V=e.qrphDepositGatewaySettings)==null?void 0:V.androidEnabled)??!1,iosEnabled:((H=e.qrphDepositGatewaySettings)==null?void 0:H.iosEnabled)??!1,webEnabled:((Y=e.qrphDepositGatewaySettings)==null?void 0:Y.webEnabled)??!1,mobileWebEnabled:((Q=e.qrphDepositGatewaySettings)==null?void 0:Q.mobileWebEnabled)??!1,minimumAmount:n((k=e.qrphDepositGatewaySettings)==null?void 0:k.minimumAmount),maximumAmount:n((X=e.qrphDepositGatewaySettings)==null?void 0:X.maximumAmount)}},withdrawalGateway:{bank:{androidEnabled:((Z=e.bankWithdrawalGatewaySettings)==null?void 0:Z.androidEnabled)??!1,iosEnabled:((ee=e.bankWithdrawalGatewaySettings)==null?void 0:ee.iosEnabled)??!1,webEnabled:((te=e.bankWithdrawalGatewaySettings)==null?void 0:te.webEnabled)??!1,mobileWebEnabled:((ae=e.bankWithdrawalGatewaySettings)==null?void 0:ae.mobileWebEnabled)??!1,minimumAmount:n((re=e.bankWithdrawalGatewaySettings)==null?void 0:re.minimumAmount),maximumAmount:n((ne=e.bankWithdrawalGatewaySettings)==null?void 0:ne.maximumAmount)},gcash:{androidEnabled:((oe=e.gcashWithdrawalGatewaySettings)==null?void 0:oe.androidEnabled)??!1,iosEnabled:((ie=e.gcashWithdrawalGatewaySettings)==null?void 0:ie.iosEnabled)??!1,webEnabled:((se=e.gcashWithdrawalGatewaySettings)==null?void 0:se.webEnabled)??!1,mobileWebEnabled:((me=e.gcashWithdrawalGatewaySettings)==null?void 0:me.mobileWebEnabled)??!1,minimumAmount:n((de=e.gcashWithdrawalGatewaySettings)==null?void 0:de.minimumAmount),maximumAmount:n((ce=e.gcashWithdrawalGatewaySettings)==null?void 0:ce.maximumAmount,1e6)},maya:{androidEnabled:((ue=e.mayaWithdrawalGatewaySettings)==null?void 0:ue.androidEnabled)??!1,iosEnabled:((le=e.mayaWithdrawalGatewaySettings)==null?void 0:le.iosEnabled)??!1,webEnabled:((pe=e.mayaWithdrawalGatewaySettings)==null?void 0:pe.webEnabled)??!1,mobileWebEnabled:((fe=e.mayaWithdrawalGatewaySettings)==null?void 0:fe.mobileWebEnabled)??!1,minimumAmount:n((we=e.mayaWithdrawalGatewaySettings)==null?void 0:we.minimumAmount),maximumAmount:n((ye=e.mayaWithdrawalGatewaySettings)==null?void 0:ye.maximumAmount)},mayaApp:{androidEnabled:((he=e.mayaAppWithdrawalGatewaySettings)==null?void 0:he.androidEnabled)??!1,iosEnabled:((ge=e.mayaAppWithdrawalGatewaySettings)==null?void 0:ge.iosEnabled)??!1,webEnabled:((be=e.mayaAppWithdrawalGatewaySettings)==null?void 0:be.webEnabled)??!1,mobileWebEnabled:((Ee=e.mayaAppWithdrawalGatewaySettings)==null?void 0:Ee.mobileWebEnabled)??!1,minimumAmount:n((Ae=e.mayaAppWithdrawalGatewaySettings)==null?void 0:Ae.minimumAmount),maximumAmount:n((Se=e.mayaAppWithdrawalGatewaySettings)==null?void 0:Se.maximumAmount,1e6)},instapay:{androidEnabled:((ke=e.instapayWithdrawalGatewaySettings)==null?void 0:ke.androidEnabled)??!1,iosEnabled:((Ce=e.instapayWithdrawalGatewaySettings)==null?void 0:Ce.iosEnabled)??!1,webEnabled:((_e=e.instapayWithdrawalGatewaySettings)==null?void 0:_e.webEnabled)??!1,mobileWebEnabled:((Te=e.instapayWithdrawalGatewaySettings)==null?void 0:Te.mobileWebEnabled)??!1,minimumAmount:n((Me=e.instapayWithdrawalGatewaySettings)==null?void 0:Me.minimumAmount),maximumAmount:n((Re=e.instapayWithdrawalGatewaySettings)==null?void 0:Re.maximumAmount,1e6)}}}}account(e){const t={id:e.id,name:e.name,status:e.status,verified:e.verified,nickName:e.nickName??void 0,realName:e.realName??void 0,dateOfBirth:e.birthDay?new Date(e.birthDay):void 0,emailAddress:e.emailAddress??void 0,mobileNumber:e.mobileNumber??void 0,mobileNumberVerified:e.mobileNumberVerified??!1,mobileNumberVerificationRequired:e.mobileNumberVerificationRequired??!1,validId:e.validId||void 0,verificationStatus:e.verificationStatus,transactionPassword:e.transactionPassword,secretAnswerSubmitted:e.secretAnswerSubmitted??!1,dateTimeCreated:new Date(e.dateTimeCreated),dateTimeLastUpdated:new Date(e.dateTimeLastUpdated)};return S(t)}wallet(e){return{id:e.id,balance:n(e.balance,0),currency:e.currency,dateTimeCreated:new Date(e.dateTimeCreated),dateTimeLastUpdated:new Date(e.dateTimeLastUpdated)}}verificationDetails(e){return{id:e.id,status:e.status,address:e.address,permanentAddress:e.permanentAddress,nationality:e.nationality,natureOfWork:e.natureOfWork,placeOfBirth:e.placeOfBirth,sourceOfIncome:e.sourceOfIncome,selfieImage:this.file(e.selfieImage),idFrontImage:this.file(e.idFrontImage)}}profileCompletion(e){return{accountPassword:e.accountPassword??!1,accountVerification:e.accountVerification??!1,mobileNumberVerification:e.mobileNumberVerification??!1,personalInformation:e.personalInformation??!1,transactionPassword:e.transactionPassword??!1,completionPercentage:n(e.completionPercentage,0)}}announcement(e){return{id:e.id,type:e.type,title:e.title,status:e.status,message:e.message,activationEndDateTime:new Date(e.activationEndDateTime),activationStartDateTime:new Date(e.activationStartDateTime),dateTimeCreated:new Date(e.dateTimeCreated),dateTimeLastUpdated:new Date(e.dateTimeLastUpdated)}}withdrawalRecord(e){const t={id:e.id,type:e.type,bank:e.bank,status:e.status,amount:n(e.amount,0),netAmount:n(e.netAmount,0),fee:n(e.fee,0),reference:e.reference??void 0,error:e.error??void 0,withdrawalNumber:e.withdrawalNumber,recipientMobileNumber:e.recipientMobileNumber??void 0,dateTimeConfirmed:e.dateTimeConfirmed?new Date(e.dateTimeConfirmed):void 0,dateTimeCreated:new Date(e.dateTimeCreated),dateTimeLastUpdated:new Date(e.dateTimeLastUpdated)};return S(t)}deposit(e){const t={id:e.id,type:e.type,status:e.status,vca:e.vca??void 0,qrCode:e.qrCode??void 0,checkoutUrl:e.checkoutUrl??void 0};return S(t)}depositRecord(e){const t={id:e.id,type:e.type,status:e.status,amount:n(e.amount,0),fee:n(e.fee,0),netAmount:n(e.netAmount,0),reference:e.reference??void 0,depositNumber:e.depositNumber,dateTimeCreated:new Date(e.dateTimeCreated),dateTimeLastUpdated:new Date(e.dateTimeLastUpdated),error:e.error??void 0};return S(t)}betRecord(e){var a;const t={id:e.id,bet:n(e.bet,0),payout:n(e.payout,0),status:e.status,jackpotContribution:n(e.jackpotContribution,0),jackpotPayout:n(e.jackpotPayout,0),winloss:n(e.winloss),validBet:n(e.validBet,0),vendorRoundId:e.vendorRoundId??void 0,game:e.game?this.game(e.game):void 0,serialCode:e.serialCode,dateTimeSettled:e.dateTimeSettled?new Date(e.dateTimeSettled):void 0,dateTimeCreated:new Date(e.dateTimeCreated),dateTimeLastUpdated:new Date(e.dateTimeLastUpdated),betContent:e.betContent??void 0,contestName:e.contestName??void 0,externalCategory:e.externalCategory??void 0,metadata:{odds:((a=e.metadata)==null?void 0:a.odds)??void 0}};return S(t)}latestBetRecord(e){return{id:e.id,member:e.member,game:e.game?this.game(e.game):void 0,bet:n(e.bet,0),payout:n(e.payout,0),validBet:n(e.validBet,0),dateTimeSettled:new Date(e.dateTimeSettled),dateTimeCreated:new Date(e.dateTimeCreated)}}transactionRecord(e){const t={id:e.id,type:e.type,amount:n(e.amount,0),content:e.content??void 0,currentBalance:n(e.currentBalance,0),referenceNumber:e.referenceNumber,dateTimeCreated:new Date(e.dateTimeCreated)};return S(t)}game(e){return{id:e.id,type:e.type,tags:e.tags??[],name:e.name,images:[e.customImage,e.image].filter(Boolean),provider:e.provider,reference:e.reference}}gameSession(e){const t={id:e.id,status:e.status,launchUrl:e.launchUrl??void 0,dateTimeCreated:new Date(e.dateTimeCreated),dateTimeLastUpdated:new Date(e.dateTimeLastUpdated)};return S(t)}promo(e){return{id:e.id,type:e.type,name:e.name,status:e.status,description:e.description,banner:e.banner?this.file(e.banner):null,maximumBonusAmount:n(e.maximumBonusAmount),minimumBonusAmount:n(e.minimumBonusAmount),maximumDepositAmount:n(e.maximumDepositAmount),minimumDepositAmount:n(e.minimumDepositAmount),activationEndDateTime:new Date(e.activationEndDateTime),activationStartDateTime:new Date(e.activationStartDateTime),dateTimeCreated:new Date(e.dateTimeCreated),dateTimeLastUpdated:new Date(e.dateTimeLastUpdated)}}cashback(e){return{id:e.id,name:e.name,description:e.description,status:e.status,minimumCashback:n(e.minimumCashback,0),maximumMonthlyCashback:n(e.maximumMonthlyCashback),banner:e.banner?this.file(e.banner):null,activationEndDateTime:new Date(e.activationEndDateTime),activationStartDateTime:new Date(e.activationStartDateTime),dateTimeCreated:new Date(e.dateTimeCreated),dateTimeLastUpdated:new Date(e.dateTimeLastUpdated),turnoverContributionPercentagePerGameProvider:Object.entries(e.turnoverContributionPercentagePerGameProvider).reduce((a,[r,s])=>(a[r]=n(s,0),a),{})}}bonus(e){const t={id:e.id,promo:this.promo(e.promo),deposit:e.deposit?{type:e.deposit.type,status:e.deposit.status,fee:n(e.deposit.fee,0),amount:n(e.deposit.amount,0),netAmount:n(e.deposit.netAmount,0),reference:e.deposit.reference??void 0,dateTimeCreated:new Date(e.deposit.dateTimeCreated),dateTimeLastUpdated:new Date(e.deposit.dateTimeLastUpdated)}:void 0,balance:n(e.balance,0),amount:n(e.amount,0),expiration:new Date(e.expiration),turnoverRequirement:n(e.turnoverRequirement,0),currentTurnoverRequirementContribution:n(e.currentTurnoverRequirementContribution,0),currentTurnoverRequirementContributionPercentage:n(e.currentTurnoverRequirementContributionPercentage,0),dateTimeCreated:new Date(e.dateTimeCreated),dateTimeLastUpdated:new Date(e.dateTimeLastUpdated)};return S(t)}cashbackBonus(e){return{id:e.id,total:n(e.total,0),balance:n(e.balance,0),cashback:this.cashback(e.cashback),dateTimeCreated:new Date(e.dateTimeCreated),dateTimeLastUpdated:new Date(e.dateTimeLastUpdated)}}file(e){const t={id:e.id,url:e.url??void 0,status:e.status,dateTimeCreated:new Date(e.dateTimeCreated)};return S(t)}pointsWallet(e){return{id:e.id,points:n(e.points,0),account:e.account,dateTimeCreated:new Date(e.dateTimeCreated)}}pointsWalletTransaction(e){return{id:e.id,type:e.type,amount:n(e.amount,0),balance:n(e.balance,0),dateTimeCreated:new Date(e.dateTimeCreated)}}activityRecord(e){const t={id:e.id,type:e.type,amount:e.amount?n(e.amount,0):void 0,domain:e.domain??void 0,details:e.details,dateTimeCreated:new Date(e.dateTimeCreated)};return S(t)}referral(e){return{id:e.id,level:e.level,upline:e.upline,downline:e.downline,turnover:n(e.turnover,0),commission:n(e.commission,0),dateTimeCreated:new Date(e.dateTimeCreated)}}referralCommission(e){return{id:e.id,commission:n(e.commission,0),level1Commission:n(e.level1Commission,0),level2Commission:n(e.level2Commission,0),level3Commission:n(e.level3Commission,0),referralsCount:e.referralsCount,level1ReferralsCount:e.level1ReferralsCount,level2ReferralsCount:e.level2ReferralsCount,level3ReferralsCount:e.level3ReferralsCount,referralCode:e.referralCode,dateTimeCreated:new Date(e.dateTimeCreated),dateTimeLastUpdated:new Date(e.dateTimeLastUpdated)}}message(e){return{id:e.id,logo:e.logo,title:e.title,popup:e.popup,content:e.content,actions:e.actions,markedAsRead:e.markedAsRead,dateTimeCreated:new Date(e.dateTimeCreated)}}instapayBank(e){return e}promoByCode(e){const{banner:t,...a}=e;return{...a,banner:t?this.file(t):null}}}class Ta{constructor(e){c(this,"cmsPortalService");c(this,"authService");c(this,"gameService");c(this,"fileService");c(this,"walletService");c(this,"accountService");c(this,"reportService");c(this,"portalService");c(this,"triggerService");c(this,"sessionManager");c(this,"transformer");c(this,"logger");c(this,"cache");const{site:t,sitePlatform:a,platform:r,environment:s,logs:m}=e,d=s==="production";this.transformer=new _a,this.logger=new $e({enabled:m??!1});const l=d?"https://auth.opexa.io":"https://auth.development.opexa.io",f=d?"https://wallet.opexa.io/graphql":"https://wallet.development.opexa.io/graphql",y=d?"https://report.opexa.io/graphql":"https://report.development.opexa.io/graphql",p=d?"https://account.opexa.io/graphql":"https://account.development.opexa.io/graphql",M=d?"https://portal.opexa.io/graphql":"https://portal.development.opexa.io/graphql",R=d?"https://file.opexa.io/graphql":"https://file.development.opexa.io/graphql",D=d?"https://game.opexa.io/graphql":"https://game.development.opexa.io/graphql",N=d?"https://trigger.opexa.io/graphql":"https://trigger.development.opexa.io/graphql",I="https://portal-api.opexacms.io/v1",v=new ca({url:I,site:t,platform:a}),g={middlewares:[this.authMiddleware],fetchOptions:{headers:{Role:"MEMBER","Platform-Code":r}}},G=new la(new K(D,g)),P=new ua(new K(R,g)),C=new ya(new K(f,g)),O=new ma(new K(p,g)),W=new fa(new K(y,g)),B=new pa(new K(M,g)),x=new wa(new K(N,g)),_=new da({url:l,platform:r}),U=new Ca({logs:m,authService:_,walletService:C});this.authService=_,this.gameService=G,this.fileService=P,this.walletService=C,this.accountService=O,this.reportService=W,this.portalService=B,this.triggerService=x,this.sessionManager=U,this.cmsPortalService=v,this.cache=new ha}get authMiddleware(){return async e=>{this.logger.info("Checking for session");const t=await this.sessionManager.get();return t.data?(e.headers.append("Authorization",`Bearer ${t.data.accessToken}`),this.logger.info("Session found"),this.logger.success("Added 'Authorization' header")):this.logger.info("No session found"),e}}get locale(){return new Promise(e=>{const t="locale",a=this.cache.get(t);if(a)return e(a);this.platform__next().then(r=>{r.ok?(this.cache.set(t,r.data.locale),e(r.data.locale)):(this.logger.warn("Failed to fetch currency. Using 'PH' as fallback"),e("en-PH"))})})}async signIn(e){switch(e.type){case"NAME_AND_PASSWORD":{const t=await this.sessionManager.create({...e,password:await A(e.password)});return t.ok?t.data?{ok:!0,data:{"2FAEnabled":!0,authenticator:t.data.authenticator}}:{ok:!0,data:{"2FAEnabled":!1}}:t}case"TOKEN":{const t=await this.sessionManager.create({type:"TOKEN",token:e.token});return t.ok?{ok:!0}:t}case"MOBILE_NUMBER":{const t=await this.sessionManager.create({type:"MOBILE_NUMBER",mobileNumber:T(e.mobileNumber,await this.locale),verificationCode:e.verificationCode,reCAPTCHAResponse:e.reCAPTCHAResponse});return t.ok?{ok:!0}:t}default:{const t=await this.sessionManager.create(e);return t.ok?{ok:!0}:t}}}async authenticate(e){switch(e.type){case"SECURITY_QUESTION":return await this.sessionManager.createFromAuthenticator({type:"SECURITY_QUESTION",token:e.token,secretAnswer:await A(e.secretAnswer)});default:return{ok:!1,error:{name:"HttpBadRequest",message:"Invalid input 'type'"}}}}async signOut(){await this.sessionManager.destroy()}watchSession(e){const t=ga(e.interval??3e4,3e4,6e4);let a=null;const r=()=>setTimeout(async()=>{await this.sessionManager.verify()||await e.onInvalid(),a=r()},t);return a=r(),function(){a&&clearTimeout(a)}}async session(){const e=await this.sessionManager.get();return e.ok?{ok:!0,data:e.data?{id:e.data.session.id,dateTimeCreated:new Date(e.data.session.dateTimeCreated)}:null}:e}async validateMayaSession(){return await this.walletService.validateMayaSession()}async site(){const e=await this.cmsPortalService.self();return e.ok?{ok:!0,data:this.transformer.transform.site(e.data)}:e}async platform(){const e=await this.accountService.platform();return e.ok?{ok:!0,data:this.transformer.transform.platform(e.data)}:e}async platform__next(){const e=await this.portalService.platform();return e.ok?{ok:!0,data:this.transformer.transform.platform__next(e.data)}:e}async paymentSettings(){const e=await this.accountService.paymentSettings();return e.ok?{ok:!0,data:this.transformer.transform.paymentSettings(e.data)}:e}async account(){const e=await this.accountService.memberAccount();return e.ok?{ok:!0,data:this.transformer.transform.account(e.data)}:e}async createAccount(e){const t=e.id??w.ObjectId.generate(E.Account).toString(),a=await this.accountService.registerMemberAccount({input:{id:t,btag:e.btag,name:e.name,domain:e.domain,birthDay:typeof e.dateOfBirth=="string"?e.dateOfBirth:this.formatYmd(e.dateOfBirth),password:await A(e.password),mobileNumber:T(e.mobileNumber,await this.locale)},referralCode:e.referralCode,verificationCode:e.verificationCode,reCAPTCHAResponse:e.reCAPTCHAResponse});return a.ok?{ok:!0,data:{id:t}}:a}async createAccount__next(e){const t=e.id??w.ObjectId.generate(E.Account).toString();if(e.type==="MOBILE_NUMBER"){const r=await this.accountService.registerMemberAccountViaMobile({input:{id:t,btag:e.btag,domain:e.domain,mobileNumber:T(e.mobileNumber,await this.locale)},referralCode:e.referralCode,verificationCode:e.verificationCode,reCAPTCHAResponse:e.reCAPTCHAResponse});return r.ok?{ok:!0,data:{id:t}}:r}const a=await this.accountService.registerMemberAccount__next({input:{id:t,name:e.name,btag:e.btag,domain:e.domain,password:await A(e.password),mobileNumber:e.mobileNumber?T(e.mobileNumber,await this.locale):void 0},reCAPTCHAResponse:e.reCAPTCHAResponse});return a.ok?{ok:!0,data:{id:t}}:a}async registerMayaAccount(e){return await this.accountService.registerMayaMemberAccount({input:{name:e.name,password:await A(e.password),domain:e.domain}})}async updateAccount(e,t){const{password:a,dateOfBirth:r,mobileNumber:s,secretAnswer:m,transactionPassword:d,...l}=t;return await this.accountService.updateMemberAccount({input:{id:e,data:{...l,password:a?await A(a):void 0,transactionPassword:d?await A(d):void 0,mobileNumber:s?T(s,await this.locale):void 0,secretAnswer:m?await A(m):void 0,birthDay:r?typeof r=="string"?r:this.formatYmd(r):void 0}}})}async deleteAccount(e){return await this.accountService.deleteMemberAccount({input:{id:e}})}async verificationDetails(){const e=await this.accountService.memberVerification();return e.ok?{ok:!0,data:e.data?this.transformer.transform.verificationDetails(e.data):null}:e}async submitVerificationDetails(e){const t=e.id??w.ObjectId.generate(E.Verification).toString(),a=await this.accountService.createMemberVerification({input:{id:t,...e}});return a.ok?{ok:!0,data:{id:t}}:a}async updateVerificationDetails(e,t){return await this.accountService.updateMemberVerification({input:{id:e,data:{...t}}})}async resetPassword(e){return await this.accountService.resetPassword({input:{mobileNumber:T(e.mobileNumber,await this.locale),newPassword:await A(e.newPassword)},verificationCode:e.verificationCode})}async verifyMobileNumber(e){return await this.accountService.verifyMobileNumber({input:{verificationCode:e}})}async profileCompletion(){const e=await this.accountService.profileCompletion();return e.ok?{ok:!0,data:this.transformer.transform.profileCompletion(e.data)}:e}async sendVerificationCode(e){return await this.accountService.sendVerificationCode({input:{channel:"SMS",recipient:T(e,await this.locale)}})}async sendVerificationCode__next(e){if(e.type==="SMS")return this.authService.sendVerificationCode({channel:"SMS",recipient:T(e.mobileNumber,await this.locale),...e.strict&&{verificationType:"MEMBER"}});throw new Error("'Email' verification code is not yet supported")}async wallet(){const e=await this.walletService.wallet();return e.ok?{ok:!0,data:e.data?this.transformer.transform.wallet(e.data):null}:e}async announcements(e){const t=await this.accountService.announcements({...e,filter:{...e==null?void 0:e.filter,visibility:{in:["MEMBER","GLOBAL"]}}});return t.ok?{ok:!0,data:{announcements:t.data.edges.map(({cursor:a,node:r})=>({...this.transformer.transform.announcement(r),cursor:a})),totalCount:t.data.totalCount,endCursor:t.data.pageInfo.endCursor??void 0,hasNextPage:t.data.pageInfo.hasNextPage}}:t}async createWithdrawal(e){const t=e.id??w.ObjectId.generate(E.Withdrawal).toString();if(e.type==="BANK"){const a=await this.walletService.createBankWithdrawal({input:{id:t,amount:e.amount.toString(),transactionPassword:await A(e.transactionPassword)}});if(!a.ok)return a}if(e.type==="GCASH"){const a=await this.walletService.createGCashWithdrawal({input:{id:t,amount:e.amount.toString(),transactionPassword:await A(e.transactionPassword),recipientMobileNumber:T(e.recipientMobileNumber,await this.locale)}});if(!a.ok)return a}if(e.type==="MAYA"){const a=await this.walletService.createMayaWithdrawal({input:{id:t,amount:e.amount.toString(),transactionPassword:await A(e.transactionPassword),recipientMobileNumber:T(e.recipientMobileNumber,await this.locale)}});if(!a.ok)return a}if(e.type==="MAYA_APP"){const a=await this.walletService.createMayaAppWithdrawal({input:{id:t,amount:e.amount.toString(),transactionPassword:await A(e.transactionPassword)}});if(!a.ok)return a}if(e.type==="AIO_INSTAPAY"){const a=await this.walletService.createAIOInstapayWithdrawal({input:{id:t,amount:e.amount.toString(),bankCode:e.bankCode,accountNumber:e.accountNumber,transactionPassword:await A(e.transactionPassword)}});if(!a.ok)return a}return{ok:!0,data:{id:t}}}async withdrawalRecords(e){const t=await this.reportService.withdrawalRecords(e);return t.ok?{ok:!0,data:{withdrawalRecords:t.data.edges.map(({cursor:a,node:r})=>({...this.transformer.transform.withdrawalRecord(r),cursor:a})),totalCount:t.data.totalCount,endCursor:t.data.pageInfo.endCursor??void 0,hasNextPage:t.data.pageInfo.hasNextPage}}:t}async remainingDailyWithdrawalsCount(){return await this.walletService.remainingDailyWithdrawalsCount()}async instapayBankList(){const e=await this.walletService.instapayBankList();return e.ok?{ok:!0,data:e.data.map(this.transformer.transform.instapayBank)}:e}async createDeposit(e){const t=e.id??w.ObjectId.generate(E.Deposit).toString();if(e.type==="MAYA"){const a=await this.walletService.createMayaDeposit({input:{id:t,amount:e.amount.toString(),promo:e.promo}});if(!a.ok)return a}if(e.type==="MAYA_APP"){const a=await this.walletService.createMayaAppDeposit({input:{id:t,amount:e.amount.toString(),promo:e.promo}});if(!a.ok)return a}if(e.type==="GCASH"){const a=await this.walletService.createGCashDeposit({input:{id:t,amount:e.amount.toString(),promo:e.promo}});if(!a.ok)return a}if(e.type==="AIO_ONLINE_BANK"){const a=await this.walletService.createAIOOnlineBankDeposit({input:{id:t,amount:e.amount.toString(),promo:e.promo}});if(!a.ok)return a}if(e.type==="AIO_QRPH"){const a=await this.walletService.createAIOQRPHDeposit({input:{id:t,amount:e.amount.toString(),promo:e.promo}});if(!a.ok)return a}return{ok:!0,data:{id:t}}}async deposit(e){const t=await this.walletService.deposit({id:e});return t.ok?{ok:!0,data:t.data?this.transformer.transform.deposit(t.data):null}:t}async depositRecords(e){const t=await this.reportService.depositRecords(e);return t.ok?{ok:!0,data:{depositRecords:t.data.edges.map(({cursor:a,node:r})=>({...this.transformer.transform.depositRecord(r),cursor:a})),totalCount:t.data.totalCount,endCursor:t.data.pageInfo.endCursor??void 0,hasNextPage:t.data.pageInfo.hasNextPage}}:t}async depositsCount(){return await this.reportService.depositsCount()}async betRecords(e){const t=await this.reportService.betRecords({...e,...(e==null?void 0:e.filter)&&{filter:{...e.filter.status&&{status:e.filter.status},...e.filter.serialCode&&{serialCode:e.filter.serialCode},...e.filter.vendorRoundId&&{vendorRoundId:e.filter.vendorRoundId},...e.filter.gameType&&{game__type:e.filter.gameType},...e.filter.gameProvider&&{game__provider:e.filter.gameProvider},...e.filter.dateTimeCreated&&{dateTimeCreated:e.filter.dateTimeCreated}}}});if(!t.ok)return t;const a=[...new Set(t.data.edges.map(s=>s.node.game.id))];if(a.length<=0)return{ok:!0,data:{betRecords:[],totalCount:0,endCursor:void 0,hasNextPage:!1}};const r=await this.cmsPortalService.games({filter:{reference:{in:a}}});return r.ok?{ok:!0,data:{betRecords:t.data.edges.map(({cursor:s,node:m})=>{var l;const d=(l=r.data.edges.find(f=>m.game.id===f.node.reference))==null?void 0:l.node;return{...this.transformer.transform.betRecord({...m,game:d}),cursor:s}}),totalCount:t.data.totalCount,endCursor:t.data.pageInfo.endCursor??void 0,hasNextPage:t.data.pageInfo.hasNextPage}}:r}async latestBetRecords(){const e=await this.portalService.latestBetRecords();if(!e.ok)return e;const t=[...new Set(e.data.map(r=>r.game.id))];if(t.length<=0)return{ok:!0,data:[]};const a=await this.cmsPortalService.games({filter:{reference:{in:t}}});return a.ok?{ok:!0,data:e.data.map(r=>{var m;const s=(m=a.data.edges.find(d=>d.node.reference===r.game.id))==null?void 0:m.node;return this.transformer.transform.latestBetRecord({...r,game:s})})}:a}async transactionRecords(e){const t=await this.reportService.transactionRecords(e);return t.ok?{ok:!0,data:{transactionRecords:t.data.edges.map(({cursor:a,node:r})=>({...this.transformer.transform.transactionRecord(r),cursor:a})),totalCount:t.data.totalCount,endCursor:t.data.pageInfo.endCursor??void 0,hasNextPage:t.data.pageInfo.hasNextPage}}:t}async promos(){const e=await this.walletService.promos();return e.ok?{ok:!0,data:e.data.map(this.transformer.transform.promo)}:e}async availablePromos(){const e=await this.walletService.availablePromos();return e.ok?{ok:!0,data:e.data.map(this.transformer.transform.promo)}:e}async cashbacks(){const e=await this.walletService.cashbacks();return e.ok?{ok:!0,data:e.data.map(this.transformer.transform.cashback)}:e}async bonus(){const e=await this.walletService.bonus();return e.ok?{ok:!0,data:e.data?this.transformer.transform.bonus(e.data):null}:e}async cashbackBonuses(){const e=await this.walletService.cashbackBonuses();return e.ok?{ok:!0,data:e.data.map(this.transformer.transform.cashbackBonus)}:e}async claimCashbackBonus(e){return await this.walletService.claimCashbackBonus({input:{id:e}})}async claimSpotBonus(e){return await this.walletService.claimSpotBonus({code:e})}async promoByCode(e){const t=await this.reportService.promoByCode({code:e});return t.ok?{ok:!0,data:this.transformer.transform.promoByCode(t.data)}:t}async game(e){const t=await this.cmsPortalService.game(e);return t.ok?{ok:!0,data:t.data?this.transformer.transform.game(t.data):null}:t}async games(e){const t=await this.cmsPortalService.games(e);return t.ok?{ok:!0,data:{games:t.data.edges.map(({cursor:a,node:r})=>({...this.transformer.transform.game(r),cursor:a})),totalCount:t.data.totalCount,hasNextPage:t.data.pageInfo.hasNextPage,endCursor:t.data.pageInfo.endCursor??void 0}}:t}async recommendedGames(e){const t=await this.portalService.recommendedGames();if(!t.ok)return t;const a=[...new Set(t.data.map(s=>s.id))];if(a.length<=0)return{ok:!0,data:{games:[],totalCount:0,hasNextPage:!1,endCursor:void 0}};const r=await this.cmsPortalService.games({first:e==null?void 0:e.first,after:e==null?void 0:e.after,filter:{reference:{in:a}}});return r.ok?{ok:!0,data:{games:r.data.edges.map(({cursor:s,node:m})=>({...this.transformer.transform.game(m),cursor:s})),totalCount:r.data.totalCount,hasNextPage:r.data.pageInfo.hasNextPage,endCursor:r.data.pageInfo.endCursor??void 0}}:r}async gameSession(e){const t=await this.walletService.gameSession({id:e});if(!t.ok)return t;if(t.data)return{ok:!0,data:this.transformer.transform.gameSession(t.data)};const a=await this.gameService.gameSession({id:e});return a.ok?{ok:!0,data:a.data?this.transformer.transform.gameSession(a.data):null}:a}async createGameSession(e){const t=e.id??w.ObjectId.generate(E.GameSession).toString();if(e.game.startsWith("SPORTS:")){const f=await w.ObjectId.generateFromKey(E.Game,e.game).then(p=>p.toString()),y=await this.gameService.createGameSession({input:{id:t,game:f}});return y.ok?{ok:!0,data:{id:t}}:y}const r=await this.game(e.game);if(!r.data)return{ok:!1,error:{name:"GameDoesNotExistError",message:"Game does not exist"}};const{provider:s,reference:m}=r.data,l=["RTG","DARWIN","DRBINGO","MEGABALL","EVOLUTION","EVOLUTION_NETENT","EVOLUTION_REDTIGER","HOLLYWOODTV"].includes(s)?await this.walletService.createGameSession({input:{id:t,game:m}}):await this.gameService.createGameSession({input:{id:t,game:m}});return l.ok?{ok:!0,data:{id:t}}:l}async endGameSession(e){const t=await this.walletService.endGameSession({input:{id:e}});return t.ok?t:await this.gameService.endGameSession({input:{id:e}})}async file(e){const t=await this.fileService.file({id:e});return t.ok?{ok:!0,data:t.data?this.transformer.transform.file(t.data):null}:t}async uploadImageFile(e){const t=e.id??w.ObjectId.generate(E.File).toString(),a=await this.fileService.uploadPrivateImageFile({input:{id:t,file:e.file}});return a.ok?{ok:!0,data:{id:t}}:a}async pointsWallet(){const e=await this.walletService.pointsWallet();return e.ok?{ok:!0,data:e.data?this.transformer.transform.pointsWallet(e.data):null}:e}async redeemPoints(e){return await this.walletService.redeemPointsToCash({input:{amount:e.amount.toString()}})}async pointsWalletTransactions(e){const t=await this.reportService.pointsWalletTransactions(e);return t.ok?{ok:!0,data:{pointsWalletTransactions:t.data.edges.map(({cursor:a,node:r})=>({...this.transformer.transform.pointsWalletTransaction(r),cursor:a})),totalCount:t.data.totalCount,hasNextPage:t.data.pageInfo.hasNextPage,endCursor:t.data.pageInfo.endCursor??void 0}}:t}async activityRecords(e){const t=await this.reportService.activityRecords(e);return t.ok?{ok:!0,data:{activityRecords:t.data.edges.map(({cursor:a,node:r})=>({...this.transformer.transform.activityRecord(r),cursor:a})),totalCount:t.data.totalCount,hasNextPage:t.data.pageInfo.hasNextPage,endCursor:t.data.pageInfo.endCursor??void 0}}:t}async referralCode(){const e=await this.accountService.referralCode();return e.ok?{ok:!0,data:e.data??null}:e}async updateReferralCode(e){return await this.accountService.updateReferralCode({input:e})}async referrals(e){const t=await this.reportService.referrals(e);return t.ok?{ok:!0,data:{referrals:t.data.edges.map(({cursor:a,node:r})=>({...this.transformer.transform.referral(r),cursor:a})),totalCount:t.data.totalCount,hasNextPage:t.data.pageInfo.hasNextPage,endCursor:t.data.pageInfo.endCursor??void 0}}:t}async referralCommission(){const e=await this.reportService.referralCommission();return e.ok?{ok:!0,data:e.data?this.transformer.transform.referralCommission(e.data):null}:e}async uplinesByName(e){const t=await this.reportService.uplinesByName(e);return t.ok?{ok:!0,data:t.data.map(this.transformer.transform.referral)}:t}async downlinesByName(e){const t=await this.reportService.downlinesByName(e);return t.ok?{ok:!0,data:t.data.map(this.transformer.transform.referral)}:t}async pointsClubSettings(){const e=await this.accountService.pointsClubSettings();return e.ok?{ok:!0,data:e.data?this.transformer.transform.pointsClubSettings(e.data):null}:e}async messages(e){const t=await this.triggerService.messages(e);return t.ok?{ok:!0,data:{messages:t.data.edges.map(({cursor:a,node:r})=>({...this.transformer.transform.message(r),cursor:a})),totalCount:t.data.totalCount,hasNextPage:t.data.pageInfo.hasNextPage,endCursor:t.data.pageInfo.endCursor??void 0}}:t}async unreadMessagesCount(e){return await this.triggerService.unreadMessagesCount(e)}async markMessageAsRead(e){return await this.triggerService.markMessageAsRead({id:e})}async markAllMessageAsRead(){return await this.triggerService.markAllMessageAsRead()}async claimReward(e){return await this.triggerService.claimReward({id:e})}async bonuses(){const e=await this.walletService.bonuses();return e.ok?{ok:!0,data:e.data.map(this.transformer.transform.bonus)}:e}formatYmd(e){const t=m=>m.toString().padStart(2,"0"),a=e.getFullYear(),r=t(e.getMonth()+1),s=t(e.getDate());return`${a}-${r}-${s}`}async onboardingStatus(){const e=await this.portalService.onboardingStatus();return e.ok?{ok:!0,data:e.data}:e}async completeOnboarding(e){return await this.portalService.completeOnboarding({input:{favoriteGameTypes:e.favoriteGameTypes,playerExperience:e.playerExperience}})}async skipOnboarding(){return await this.portalService.skipOnboarding()}}Object.defineProperty(b,"ObjectId",{enumerable:!0,get:()=>w.ObjectId}),b.ObjectType=E,b.Sdk=Ta,Object.defineProperty(b,Symbol.toStringTag,{value:"Module"})});
|
|
1465
|
+
`;function c(i){return{name:i,message:{MaximumBonusesCountLimitExceededError:"Maximum bonuses reached",InvalidPromoCodeError:"Invalid Promo Code",SpotBonusAlreadyClaimedError:"This promo code has already been redeemed and cannot be used again",RewardAlreadyExpiredError:"Reward is either expired or no longer available",AccountNameNotAvailableError:"Username is no longer available",AccountNotFoundError:"Account does not exist",AccountNotVerifiedError:"Account is not verified",CashbackBonusDoesNotExistError:"Cashback bonus does not exists",DepositPromoMaximumAmountExceededError:"Deposit amount exceeds maximum amount",DepositPromoMinimumAmountNotMetError:"Deposit amount does not meet minimum amount",EmailAddressNotAvailableError:"Email is no longer available",FileDoesNotExistError:"File does not exist",FileFormatNotSupportedError:"File format is not supported",FileNameTooLongError:"File name is too long",FileNotReadyError:"File is not yet ready",FileSizeTooBigError:"File size is too big",GameDoesNotExistError:"Game does not exist",HasActiveBonusError:"Account has active bonus",InsufficientPointsError:"Insufficient points",InvalidPlatformError:"Invalid platform",InvalidReCAPTCHAResponseError:"Invalid reCAPTCHA",InvalidSMSVerificationCodeError:"Invalid SMS verification code",InvalidTransactionPasswordError:"Invalid transaction password",InvalidVerificationCodeError:"Invalid verification code",InvalidWithdrawalAmountError:"Invalid withdrawal amount",MaximumDepositAmountExceededError:"Maximum deposit amount exceeded",MemberVerificationAlreadyApprovedError:"Member verification is already approved",MemberVerificationAlreadyExistsError:"Member verification already exists",MemberVerificationDoesNotExistError:"Member verification does not exist",MinimumAgeRequirementError:"Minimum age requirement not met",MinimumDepositAmountNotMetError:"Minimum deposit amount not met",MinimumFirstDepositAmountNotMetError:"Minimum first deposit amount not met",MobileNumberAlreadyVerifiedError:"Mobile number is already verified",MobileNumberNotAvailableError:"Mobile number is no longer available",MobileNumberNotVerifiedError:"Mobile number is not verified",NickNameNotAvailableError:"Nickname is no longer available",NotEnoughBalanceError:"Insufficient balance",NotReadyToSendVerficationCodeError:"Not ready to send verification code",PromoNotEnabledError:"Promo is not enabled",RealNameAlreadySetError:"Real name is already set",ValidIdAlreadySetError:"Valid ID is already set",WalletDoesNotExistError:"Wallet does not exist",WithdrawalDailyLimitExceededError:"Daily withdrawal limit exceeded",GameProviderError:"Game provider error",GameSessionAlreadyClosedError:"Game session is already closed",GameSessionDoesNotExistError:"Game session does not exist",ReferralCodeNotAvailableError:"Referral code is no longer available",AccountBlacklistedError:"Account is blacklisted",InvalidTokenError:"Invalid token",InvalidTokenOrSecretAnswerError:"Invalid token or secret answer",SessionExpiredError:"Session expired",RateLimitExceededError:"Maximum number of requests reached",RewardAlreadyClaimedError:"Reward is already claimed"}[i]}}class ma{constructor(e){d(this,"client");this.client=e}async memberAccount(){const e=await this.client.request(Tt);return e.ok?{ok:!0,data:e.data.memberAccount}:e}async registerMemberAccount(e){const t=await this.client.request(Rt,e);return t.ok?t.data.registerMemberAccount?{ok:!1,error:c(t.data.registerMemberAccount.__typename)}:{ok:!0}:t}async registerMemberAccountViaMobile(e){const t=await this.client.request(Mt,e);return t.ok?t.data.registerMemberAccountViaMobile?{ok:!1,error:c(t.data.registerMemberAccountViaMobile.__typename)}:{ok:!0}:t}async registerMemberAccount__next(e){const t=await this.client.request(vt,e);return t.ok?t.data.registerMemberAccount?{ok:!1,error:c(t.data.registerMemberAccount.__typename)}:{ok:!0}:t}async updateMemberAccount(e){const t=await this.client.request(It,e);return t.ok?t.data.updateMemberAccount?{ok:!1,error:c(t.data.updateMemberAccount.__typename)}:{ok:!0}:t}async deleteMemberAccount(e){const t=await this.client.request(Pt,e);return t.ok?t.data.deleteMemberAccount?{ok:!0}:{ok:!1,error:{name:"UnknownError",message:"Something went wrong."}}:t}async resetPassword(e){const t=await this.client.request(Gt,e);return t.ok?t.data.resetPassword?{ok:!1,error:c(t.data.resetPassword.__typename)}:{ok:!0}:t}async profileCompletion(){const e=await this.client.request(xt);return e.ok?{ok:!0,data:e.data.profileCompletion}:e}async platform(){return await this.client.request(Ut)}async sendVerificationCode(e){const t=await this.client.request(qt,e);return t.ok?t.data.sendVerificationCode?{ok:!1,error:c(t.data.sendVerificationCode.__typename)}:{ok:!0}:t}async paymentSettings(){return await this.client.request(Lt)}async verifyMobileNumber(e){const t=await this.client.request(Ot,e);return t.ok?t.data.verifyMobileNumber?{ok:!1,error:c(t.data.verifyMobileNumber.__typename)}:{ok:!0}:t}async createMemberVerification(e){const t=await this.client.request(Bt,e);return t.ok?t.data.createMemberVerification?{ok:!1,error:c(t.data.createMemberVerification.__typename)}:{ok:!0}:t}async updateMemberVerification(e){const t=await this.client.request(Wt,e);return t.ok?t.data.updateMemberVerification?{ok:!1,error:c(t.data.updateMemberVerification.__typename)}:{ok:!0}:t}async memberVerification(){const e=await this.client.request(Dt);return e.ok?{ok:!0,data:e.data.memberAccount.verification}:e}async announcements(e){const t=await this.client.request(Je,e);return t.ok?{ok:!0,data:t.data.announcements}:t}async registerMayaMemberAccount(e){const t=await this.client.request(Nt,e);return t.ok?t.data.registerMayaMemberAccount?{ok:!1,error:c(t.data.registerMayaMemberAccount.__typename)}:{ok:!0}:t}async referralCode(){const e=await this.client.request(Yt);return e.ok?{ok:!0,data:e.data.referralCode}:e}async updateReferralCode(e){const t=await this.client.request(Qt,e);return t.ok?t.data.updateReferralCode?{ok:!1,error:c(t.data.updateReferralCode.__typename)}:{ok:!0}:t}async pointsClubSettings(){const e=await this.client.request(Xt);return e.ok?{ok:!0,data:e.data.pointsClubSettings}:e}}function h(i,e){const t=Ie[i]?Ie[i]:Ie[500];return{name:t.name,message:e??t.message}}const Ie={400:{name:"HttpBadRequest",message:"Bad Request"},401:{name:"HttpUnauthorized",message:"Unauthorized"},403:{name:"HttpForbidden",message:"Forbidden"},404:{name:"HttpNotFound",message:"Not Found"},408:{name:"HttpRequestTimeout",message:"Request Timeout"},429:{name:"HttpTooManyRequests",message:"Too Many Requests"},500:{name:"HttpInternalServerError",message:"Internal Server Error"}};class ua{constructor(e){d(this,"url");d(this,"platform");this.url=e.url,this.platform=e.platform}get headers(){const e=new Headers;return e.append("Accept","application/json, text/plain"),e.append("Content-Type","application/json"),e.append("Platform-Code",this.platform),e.append("Role","MEMBER"),e}async createSession(e){const t=new Headers(this.headers);if(e.name){const a=`${e.name}:${e.password}`,r=Buffer.from(a).toString("base64");t.set("Authorization",`Basic ${r}`)}if(e.mobileNumber){const a=`${e.mobileNumber}:${e.verificationCode}`,r=Buffer.from(a).toString("base64");console.log(`MobileNumberOTP ${r}`),t.set("Authorization",`MobileNumberOTP ${r}`)}e.sessionId&&t.set("Authorization",`MayaSession ${e.sessionId}`),e.token&&t.set("Authorization",`Token ${e.token}`),e.reCAPTCHAResponse&&t.set("google-recaptcha-response",e.reCAPTCHAResponse);try{const a=await fetch(`${this.url}/sessions`,{method:"POST",headers:t}),r=await a.json();return a.ok?{ok:!0,data:r}:r.code==="ACCOUNT_BLACKLISTED"?{ok:!1,error:c("AccountBlacklistedError")}:r.code==="INVALID_RECAPTCHA_RESPONSE"?{ok:!1,error:c("InvalidReCAPTCHAResponseError")}:{ok:!1,error:h(a.status)}}catch{return{ok:!1,error:h(500)}}}async authenticate(e){const t=new Headers(this.headers);if(e.type==="SECURITY_QUESTION"){t.set("Authorization",`Bearer ${e.token}`);try{const a=await fetch(`${this.url}/session/${e.token}/authenticate`,{method:"POST",headers:t,body:JSON.stringify({secretAnswer:e.secretAnswer})}),r=await a.json();return a.ok?{ok:!0,data:r}:a.status===401||a.status===403?{ok:!1,error:c("InvalidTokenOrSecretAnswerError")}:{ok:!1,error:h(a.status)}}catch{return{ok:!1,error:h(500)}}}throw new Error("Invalid input 'type'")}async refreshSession(e){const t=new Headers(this.headers);t.append("Authorization",`Bearer ${e}`);try{const a=await fetch(`${this.url}/session:refresh`,{method:"POST",headers:t}),r=await a.json();return a.ok?{ok:!0,data:r}:r.code==="ACCOUNT_BLACKLISTED"?{ok:!1,error:c("AccountBlacklistedError")}:a.status===403||a.status===401?{ok:!1,error:c("InvalidTokenError")}:{ok:!1,error:h(a.status)}}catch{return{ok:!1,error:h(500)}}}async destroySession(e){const t=new Headers(this.headers);t.append("Authorization",`Bearer ${e}`);try{const a=await fetch(`${this.url}/session`,{method:"DELETE",headers:t});return a.ok?{ok:!0}:{ok:!1,error:h(a.status)}}catch{return{ok:!1,error:h(500)}}}async verifySession(e){const t=new Headers(this.headers);t.append("Authorization",`Bearer ${e}`);try{return(await fetch(`${this.url}/session`,{method:"GET",headers:t})).ok}catch{return!0}}async sendVerificationCode(e){if(e.channel==="EMAIL")throw new Error("Email channel is not yet supported");function t(a){switch(a){case"MEMBER_NOT_FOUND":return"AccountNotFoundError";case"RATE_LIMIT_REACH":return"RateLimitExceededError";case"NOT_READY_TO_SEND_VERIFICATION_ERROR":return"NotReadyToSendVerficationCodeError";default:return null}}try{const a=await fetch(`${this.url}/otps`,{method:"POST",headers:this.headers,body:JSON.stringify(e)});if(a.status===403){const r=await a.json(),s=t(r.message);return s?{ok:!1,error:c(s)}:{ok:!1,error:h(a.status,r.message)}}return a.ok?{ok:!0}:{ok:!1,error:h(a.status)}}catch{return{ok:!1,error:h(500)}}}}class da{constructor(e){d(this,"url");d(this,"siteId");d(this,"platformId");this.url=e.url,this.siteId=e.site,this.platformId=e.platform}async self(){const e=await this.getJson(`/sites/${this.siteId}`);return e.ok?{ok:!0,data:e.data.data}:e}async games(e){var r,s,m,u,l,f,y,p,D,R,M,v,N,I,g,G,P,C,O,B,W,x,_,q,U,$,L,F,V,H,Y,Q;const t=new URLSearchParams;e!=null&&e.first&&t.set("first",e.first.toString()),e!=null&&e.after&&t.set("after",e.after),e!=null&&e.search&&t.set("search",e.search),(s=(r=e==null?void 0:e.filter)==null?void 0:r.type)!=null&&s.equal&&t.set("filter[type][eq]",e.filter.type.equal),(u=(m=e==null?void 0:e.filter)==null?void 0:m.type)!=null&&u.notEqual&&t.set("filter[type][neq]",e.filter.type.notEqual),(f=(l=e==null?void 0:e.filter)==null?void 0:l.type)!=null&&f.in&&t.set("filter[type][in]",e.filter.type.in.join(",")),(p=(y=e==null?void 0:e.filter)==null?void 0:y.type)!=null&&p.notIn&&t.set("filter[type][nin]",e.filter.type.notIn.join(",")),(R=(D=e==null?void 0:e.filter)==null?void 0:D.provider)!=null&&R.equal&&t.set("filter[provider][eq]",e.filter.provider.equal),(v=(M=e==null?void 0:e.filter)==null?void 0:M.provider)!=null&&v.notEqual&&t.set("filter[provider][neq]",e.filter.provider.notEqual),(I=(N=e==null?void 0:e.filter)==null?void 0:N.provider)!=null&&I.in&&t.set("filter[provider][in]",e.filter.provider.in.join(",")),(G=(g=e==null?void 0:e.filter)==null?void 0:g.provider)!=null&&G.notIn&&t.set("filter[provider][nin]",e.filter.provider.notIn.join(",")),(C=(P=e==null?void 0:e.filter)==null?void 0:P.tags)!=null&&C.equal&&t.set("filter[tags][eq]",e.filter.tags.equal.toLowerCase()),(B=(O=e==null?void 0:e.filter)==null?void 0:O.tags)!=null&&B.notEqual&&t.set("filter[tags][neq]",e.filter.tags.notEqual.toLowerCase()),(x=(W=e==null?void 0:e.filter)==null?void 0:W.tags)!=null&&x.in&&t.set("filter[tags][in]",e.filter.tags.in.map(k=>k.toLowerCase()).join(",")),(q=(_=e==null?void 0:e.filter)==null?void 0:_.tags)!=null&&q.notIn&&t.set("filter[tags][nin]",e.filter.tags.notIn.map(k=>k.toLowerCase()).join(",")),($=(U=e==null?void 0:e.filter)==null?void 0:U.reference)!=null&&$.equal&&t.set("filter[reference][eq]",e.filter.reference.equal),(F=(L=e==null?void 0:e.filter)==null?void 0:L.reference)!=null&&F.notEqual&&t.set("filter[reference][neq]",e.filter.reference.notEqual),(H=(V=e==null?void 0:e.filter)==null?void 0:V.reference)!=null&&H.in&&t.set("filter[reference][in]",e.filter.reference.in.join(",")),(Q=(Y=e==null?void 0:e.filter)==null?void 0:Y.reference)!=null&&Q.notIn&&t.set("filter[reference][nin]",e.filter.reference.notIn.join(",")),e!=null&&e.sort&&t.set("sort[order]",e.sort);const a=await this.getJson("/games",t);return a.ok?{ok:!0,data:{edges:a.data.data.map(k=>({node:k,cursor:k.cursor})),totalCount:a.data.totalCount??0,pageInfo:{hasNextPage:!!a.data.next,endCursor:a.data.next}}}:a}async game(e){var a;const t=await this.getJson(`/games/${e}`);return((a=t.error)==null?void 0:a.name)==="HttpNotFound"?{ok:!0,data:null}:t.ok?{ok:!0,data:t.data.data}:t}async getJson(e,t){const a=new Request(`${this.url}${e}?${(t==null?void 0:t.toString())??""}`,{method:"GET",headers:{Accept:"application/json","Content-Type":"application/json","Site-ID":this.siteId,"Platform-ID":this.platformId}});try{const r=await fetch(a);return r.ok?{ok:!0,data:await r.json()}:{ok:!1,error:h(r.status)}}catch{return{ok:!1,error:h(500)}}}}class ca{constructor(e){d(this,"client");this.client=e}async file(e){const t=await this.client.request(Ve,e);return t.ok?{ok:!0,data:t.data.node}:t}async uploadPrivateImageFile(e){const t=await this.client.upload(He,e);return t.ok?t.data.uploadPrivateImageFile?{ok:!1,error:c(t.data.uploadPrivateImageFile.__typename)}:{ok:!0}:t}}class la{constructor(e){d(this,"client");this.client=e}async gameSession(e){const t=await this.client.request(Be.legacy,e);return t.ok?{ok:!0,data:t.data.node?{...t.data.node,game:t.data.node.game.id}:null}:t}async createGameSession(e){const t=await this.client.request(We,e);return t.ok?t.data.createGameSession?{ok:!1,error:c(t.data.createGameSession.__typename)}:{ok:!0}:t}async endGameSession(e){const t=await this.client.request(xe.legacy,e);return t.ok?t.data.endGameSession?{ok:!1,error:{name:"UnknownError",message:"Something went wrong."}}:{ok:!0}:t}}class pa{constructor(e){d(this,"client");this.client=e}async latestBetRecords(){const e=await this.client.request(wt);return e.ok?{ok:!0,data:e.data.latestBetRecords}:e}async platform(){const e=await this.client.request($t);return e.ok?{ok:!0,data:e.data}:e}async recommendedGames(){const e=await this.client.request(ze);return e.ok?{ok:!0,data:e.data.recommendedGames}:e}async onboardingStatus(){const e=await this.client.request(oa);return e.ok?{ok:e.ok,data:e.data.onboardingStatus??[]}:e}async completeOnboarding(e){const t=await this.client.request(ia,e);return t.ok?t.data.completeOnboarding?{ok:!0}:{ok:!1,error:{name:"UnknownError",message:"Something went wrong"}}:t}async skipOnboarding(){const e=await this.client.request(sa);return e.ok?e.data.skipOnboarding?{ok:!0}:{ok:!1,error:{name:"UnknownError",message:"Something went wrong"}}:e}}class fa{constructor(e){d(this,"client");this.client=e}async betRecords(e){const t=await this.client.request(ft,e);return t.ok?{ok:t.ok,data:t.data.member.betRecords}:t}async transactionRecords(e){const t=await this.client.request(yt,e);return t.ok?{ok:t.ok,data:t.data.member.transactionRecords}:t}async withdrawalRecords(e){const t=await this.client.request(Xe,e);return t.ok?{ok:t.ok,data:t.data.member.withdrawalRecords}:t}async depositRecords(e){const t=await this.client.request(it,e);return t.ok?{ok:t.ok,data:t.data.member.depositRecords}:t}async depositsCount(){const e=await this.client.request(pt);return e.ok?{ok:e.ok,data:e.data.member.depositsCount}:e}async pointsWalletTransactions(e){const t=await this.client.request(Ke,e);return t.ok?{ok:t.ok,data:t.data.member.pointsWalletTransactions}:t}async activityRecords(e){const t=await this.client.request(Ht,e);return t.ok?{ok:t.ok,data:t.data.member.activityRecords}:t}async referrals(e){const t=await this.client.request(jt,e);return t.ok?{ok:t.ok,data:t.data.member.referrals}:t}async referralCommission(){const e=await this.client.request(Jt);return e.ok?{ok:e.ok,data:e.data.member.referralCommission}:e}async uplinesByName(e){const t=await this.client.request(Kt,e);return t.ok?{ok:t.ok,data:t.data.uplinesByName}:t}async downlinesByName(e){const t=await this.client.request(zt,e);return t.ok?{ok:t.ok,data:t.data.downlinesByName}:t}async promoByCode(e){const t=await this.client.request(Et,e);return t.ok?{ok:t.ok,data:t.data.promoByCode}:t}}class wa{constructor(e){d(this,"client");this.client=e}async messages(e){const t=await this.client.request(Zt,e);return t.ok?{ok:t.ok,data:t.data.messages}:t}async unreadMessagesCount(e){const t=await this.client.request(ea,{...e,filter:{...e==null?void 0:e.filter,markedAsRead:{equal:!1}}});return t.ok?{ok:t.ok,data:t.data.messages.totalCount}:t}async markMessageAsRead(e){const t=await this.client.request(ta,e);return t.ok?t.data.markMessageAsRead?{ok:!0}:{ok:!1,error:{name:"UnknownError",message:"Something went wrong."}}:t}async markAllMessageAsRead(){const e=await this.client.request(aa);return e.ok?e.data.markAllMessageAsRead?{ok:!0}:{ok:!1,error:{name:"UnknownError",message:"Something went wrong."}}:e}async claimReward(e){const t=await this.client.request(ra,e);return t.ok?t.data.claimReward?{ok:!1,error:c(t.data.claimReward.__typename)}:{ok:!0}:t}}class ya{constructor(e){d(this,"client");this.client=e}async promos(){const e=await this.client.request(ht);return e.ok?{ok:e.ok,data:e.data.promos}:e}async cashbacks(){const e=await this.client.request(At);return e.ok?{ok:e.ok,data:e.data.cashbacks}:e}async availablePromos(e){const t=await this.client.request(gt,e);return t.ok?{ok:t.ok,data:t.data.availablePromos}:t}async cashbackBonuses(){const e=await this.client.request(Ct);return e.ok?{ok:e.ok,data:e.data.cashbackBonuses}:e}async claimCashbackBonus(e){const t=await this.client.request(_t,e);return t.ok?t.data.claimCashbackBonus?{ok:!1,error:c(t.data.claimCashbackBonus.__typename)}:{ok:!0}:{ok:t.ok,error:t.error}}async bonus(){const e=await this.client.request(St);return e.ok?{ok:e.ok,data:e.data.bonus}:e}async wallet(){const e=await this.client.request(Ye);return e.ok?{ok:e.ok,data:e.data.wallet}:e}async deposit(e){const t=await this.client.request(lt,e);return t.ok?{ok:t.ok,data:t.data.node}:t}async createGCashDeposit(e){const t=await this.client.request(st,e);return t.ok?t.data.createGCashDeposit?{ok:!1,error:c(t.data.createGCashDeposit.__typename)}:{ok:!0}:t}async createMayaDeposit(e){const t=await this.client.request(mt,e);return t.ok?t.data.createMayaDeposit?{ok:!1,error:c(t.data.createMayaDeposit.__typename)}:{ok:!0}:t}async createAIOQRPHDeposit(e){const t=await this.client.request(dt,e);return t.ok?t.data.createAIOQRPHDeposit?{ok:!1,error:c(t.data.createAIOQRPHDeposit.__typename)}:{ok:!0}:t}async createAIOOnlineBankDeposit(e){const t=await this.client.request(ct,e);return t.ok?t.data.createAIOOnlineBankDeposit?{ok:!1,error:c(t.data.createAIOOnlineBankDeposit.__typename)}:{ok:!0}:t}async createMayaAppDeposit(e){const t=await this.client.request(ut,e);return t.ok?t.data.createMayaAppDeposit?{ok:!1,error:c(t.data.createMayaAppDeposit.__typename)}:{ok:!0}:t}async createGCashWithdrawal(e){const t=await this.client.request(Ze,e);return t.ok?t.data.createGCashWithdrawal?{ok:!1,error:c(t.data.createGCashWithdrawal.__typename)}:{ok:!0}:t}async createMayaWithdrawal(e){const t=await this.client.request(et,e);return t.ok?t.data.createMayaWithdrawal?{ok:!1,error:c(t.data.createMayaWithdrawal.__typename)}:{ok:!0}:t}async createMayaAppWithdrawal(e){const t=await this.client.request(tt,e);return t.ok?t.data.createMayaAppWithdrawal?{ok:!1,error:c(t.data.createMayaAppWithdrawal.__typename)}:{ok:!0}:t}async createBankWithdrawal(e){const t=await this.client.request(at,e);return t.ok?t.data.createBankWithdrawal?{ok:!1,error:c(t.data.createBankWithdrawal.__typename)}:{ok:!0}:t}async createAIOInstapayWithdrawal(e){const t=await this.client.request(rt,e);return t.ok?t.data.createAIOInstapayWithdrawal?{ok:!1,error:c(t.data.createAIOInstapayWithdrawal.__typename)}:{ok:!0}:t}async instapayBankList(){const e=await this.client.request(nt);return e.ok?{ok:e.ok,data:e.data.instapayBankList}:e}async remainingDailyWithdrawalsCount(){const e=await this.client.request(ot);return e.ok?{ok:e.ok,data:e.data.remainingDailyWithdrawalsCount}:e}async pointsWallet(){const e=await this.client.request(Qe);return e.ok?{ok:e.ok,data:e.data.pointsWallet}:e}async redeemPointsToCash(e){const t=await this.client.request(je,e);return t.ok?t.data.redeemPointsToCash?{ok:!1,error:c(t.data.redeemPointsToCash.__typename)}:{ok:!0}:t}async mayaSession(e){const t=await this.client.request(Ft,e);return t.ok?{ok:t.ok,data:t.data.mayaSession}:t}async gameSession(e){const t=await this.client.request(Be.current,e);return t.ok?{ok:!0,data:t.data.node}:t}async createGameSession(e){const t=await this.client.request(We,e);return t.ok?t.data.createGameSession?{ok:!1,error:c(t.data.createGameSession.__typename)}:{ok:!0}:t}async endGameSession(e){const t=await this.client.request(xe.current,e);return t.ok?t.data.endGameSession?{ok:!0}:{ok:!1,error:{name:"UnknownError",message:"Something went wrong."}}:t}async validateMayaSession(){const e=await this.client.request(Vt);return e.ok?e.data.validateMayaSession?{ok:!0}:{ok:!1,error:{name:"UnknownError",message:"Something went wrong."}}:e}async bonuses(){const e=await this.client.request(kt);return e.ok?{ok:e.ok,data:e.data.bonuses??[]}:e}async claimSpotBonus(e){var a;const t=await this.client.request(na,e);return t.ok?t.data.claimSpotBonus?{ok:!1,error:c((a=t.data.claimSpotBonus)==null?void 0:a.__typename)}:{ok:!0}:{ok:t.ok,error:t.error}}}function Ge(i){return new Date(i.getTime())}function j(i,e){const t=Ge(i);return t.setMinutes(t.getMinutes()+e),t}function Pe(i,e){return i.getTime()>e.getTime()}class ha{constructor(e){d(this,"config");d(this,"cache");this.cache={},this.config={cacheTime:5,...e}}set(e,t){const a=j(new Date,this.config.cacheTime);this.cache[e]={value:t,validUntil:a}}get(e){const t=this.cache[e];return!t||Pe(new Date,t.validUntil)?null:t.value}}function ga(i,e,t){return i<e?e:i>t?t:i}function Oe(i){return Object.prototype.toString.call(i)==="[object Object]"&&Object(i)===i}function ba(i){const e=[];function t(a,r=[]){for(const s in a){const m=a[s];Oe(m)?t(m,[...r,s]):Array.isArray(m)?t(Ea(m),[...r,s]):e.push({key:[...r,s],value:m})}}return t(i),e}function Ea(i){return i.reduce((e,t,a)=>(e[a]=t,e),{})}class K{constructor(e,t){d(this,"url");d(this,"options");d(this,"middlewares");var r;const a=new Headers((r=t==null?void 0:t.fetchOptions)==null?void 0:r.headers);this.url=e,this.options={...t==null?void 0:t.fetchOptions,headers:a},this.middlewares=(t==null?void 0:t.middlewares)??[]}async request(e,t){const a=JSON.stringify({query:e,variables:t}),r=new Headers(this.options.headers);r.set("Content-Type","application/json"),r.set("Accept","application/json");const s=new URL(this.url),m=Aa(e);m&&s.searchParams.set(`_${m.type}`,m.name);const u=await this.runMiddlewares(new Request(s,{...this.options,body:a,headers:r,method:"POST"}));return await this.exec(u)}async upload(e,t){const a=this.createUploadBody(e,t),r=new Headers(this.options.headers);r.delete("Content-Type");const s=await this.runMiddlewares(new Request(this.url,{...this.options,body:a,headers:r,method:"POST"}));return await this.exec(s)}async exec(e){var t,a,r,s,m,u;try{const l=await fetch(e);if(!l.ok)return{ok:!1,error:h(l.status)};const f=await l.json(),y=f.data,p=(t=f.errors)==null?void 0:t.at(0);return p?((a=p.extensions)==null?void 0:a.code)==="FORBIDDEN"||((r=p.extensions)==null?void 0:r.code)==="ACCESS_TOKEN_EXPIRED"?{ok:!1,error:h(403,p.message)}:((s=p.extensions)==null?void 0:s.code)==="UNAUTHORIZED"?{ok:!1,error:h(401,p.message)}:((m=p.extensions)==null?void 0:m.code)==="BAD_USER_INPUT"||((u=p.extensions)==null?void 0:u.code)==="BAD_REQUEST"?{ok:!1,error:h(400,p.message)}:{ok:!1,error:h(500,p.message)}:{ok:!0,data:y}}catch{return{ok:!1,error:h(500)}}}async runMiddlewares(e){let t=e.clone();for(const a of this.middlewares)t=await a(t);return t}createUploadBody(e,t){const a=ba(t).filter(m=>m.value instanceof File||m.value instanceof Blob),r=new FormData;r.append("operations",JSON.stringify({query:e,variables:t}));const s={};return a.forEach((m,u)=>{s[u.toString()]=[`variables.${m.key.join(".")}`]}),r.append("map",JSON.stringify(s)),a.forEach((m,u)=>{r.append(u.toString(),m.value)}),r}}function Aa(i){const e=i.match(/(query|mutation)\s+(\w+)/);if(!e)return null;const t=e.at(1),a=e.at(2);return t&&a?{type:t,name:a}:null}function Sa(i){return i==="INR"?"en-IN":i==="MYR"?"en-MY":i==="IDR"?"en-ID":i==="USD"?"en-US":"en-PH"}function ka(i){return i==="en-IN"?"+91":i==="en-MY"?"+60":i==="en-ID"?"+62":i==="en-US"?"+1":"+63"}function T(i,e){const t=ka(e);return i.startsWith(t)?i:i.startsWith(t.substring(1))?`+${i}`:i.startsWith("0")?`${t}${i.substring(1)}`:`${t}${i}`}async function A(i){const e=new TextEncoder().encode(i),t=await crypto.subtle.digest("SHA-256",e);return Array.from(new Uint8Array(t)).map(s=>s.toString(16).padStart(2,"0")).join("")}class Ue{constructor(e){d(this,"enabled");this.enabled=(e==null?void 0:e.enabled)??!0}info(e){this.enabled&&console.log(`\x1B[34m[info] ${e}`)}warn(e){this.enabled&&console.log(`\x1B[33m[warn] ${e}`)}error(e){this.enabled&&console.log(`\x1B[31m[error] ${e}`)}success(e){this.enabled&&console.log(`\x1B[32m[success] ${e}`)}}function z(i,e){const t=Ge(i);return t.setDate(t.getDate()+e),t}function $e(i){return new Promise(e=>{setTimeout(e,i)})}function Le(i,e){const{until:t,interval:a=1e3,maxAttempt:r=3}=e;async function s(m,u){const l=u??r,f=await i(...m);return t(f)?f:l>1?(await $e(a*((r-l)/2)),s(m,l-1)):f}return async(...m)=>await s(m)}function J(i,e){const t=Ge(i);return t.setMinutes(t.getMinutes()-e),t}class Ca{constructor(e){d(this,"logger");d(this,"storageKey","session");d(this,"authService");d(this,"walletService");d(this,"_refreshing",!1);this.authService=e.authService,this.walletService=e.walletService,this.logger=new Ue({enabled:e.logs??!1})}get refreshing(){return this._refreshing}set refreshing(e){this._refreshing=e}async create(e){var r;if(this.isServer)return this.logger.warn("'localStorage' is not available on the server."),{ok:!1,error:{name:"UnknownError",message:"Server sign in is not supported."}};if(e.type==="MAYA"){const m=await Le(()=>this.walletService.mayaSession({id:e.sessionId}),{until:y=>{var p;return y.ok&&((p=y.data)==null?void 0:p.member)!=null},interval:1e3,maxAttempt:5})();if(!m.ok)return m;if(!((r=m.data)!=null&&r.member))return{ok:!1,error:{name:"HttpForbidden",message:"Forbidden"}};const l=await Le(()=>this.authService.createSession(e),{until:y=>y.ok,interval:1e3,maxAttempt:5})();if(!l.ok)return l;const f=new Date;return window.localStorage.setItem(this.storageKey,JSON.stringify({...l.data,accessTokenExpiresAt:j(f,8).getTime(),refreshTokenExpiresAt:J(z(f,30),2).getTime()})),{ok:!0,data:null}}if(e.type==="MOBILE_NUMBER"){const s=await this.authService.createSession(e);if(s.ok){const m=new Date;return window.localStorage.setItem(this.storageKey,JSON.stringify({...s.data,accessTokenExpiresAt:j(m,8).getTime(),refreshTokenExpiresAt:J(z(m,30),2).getTime()})),{ok:!0,data:null}}return s}if(e.type==="TOKEN"){const s=await this.authService.createSession({token:e.token});if(s.ok){const m=new Date;return window.localStorage.setItem(this.storageKey,JSON.stringify({...s.data,accessTokenExpiresAt:j(m,8).getTime(),refreshTokenExpiresAt:J(z(m,30),2).getTime()})),{ok:!0,data:null}}return s}const t=await this.authService.createSession(e);if(!t.ok)return t;if(t.data.authenticator)return{ok:!0,data:{authenticator:t.data.authenticator}};const a=new Date;return window.localStorage.setItem(this.storageKey,JSON.stringify({...t.data,accessTokenExpiresAt:j(a,8).getTime(),refreshTokenExpiresAt:J(z(a,30),2).getTime()})),{ok:!0,data:null}}async createFromAuthenticator(e){const t=await this.authService.authenticate(e);if(t.ok){const a=new Date;return this.isServer?this.logger.warn("'localStorage' is not available on the server."):window.localStorage.setItem(this.storageKey,JSON.stringify({...t.data,accessTokenExpiresAt:j(a,8).getTime(),refreshTokenExpiresAt:J(z(a,30),2).getTime()})),{ok:!0}}else return t}async get(){if(this.isServer)return this.logger.warn("'localStorage' is not available on the server."),{ok:!0,data:null};if(this.refreshing)return await $e(1e3),await this.get();const e=window.localStorage.getItem(this.storageKey);if(!e)return{ok:!0,data:null};try{let t=JSON.parse(e),a=new Date;const r=new Date(t.accessTokenExpiresAt),s=new Date(t.refreshTokenExpiresAt);if(Pe(a,s))return this.logger.warn("Session expired. Logging out.."),window.localStorage.removeItem(this.storageKey),{ok:!1,error:{name:"SessionExpiredError",message:"Session expired."}};if(Pe(a,r)){this.logger.info("Refreshing session..."),this.refreshing=!0;const m=await this.authService.refreshSession(t.refreshToken);if(this.refreshing=!1,!m.ok)return this.logger.error(`Failed to refresh session: ${m.error.message}`),m.error.name==="InvalidTokenError"||m.error.name==="AccountBlacklistedError"?(window.localStorage.removeItem(this.storageKey),{ok:!1,error:m.error}):(this.logger.warn("Old session returned."),{ok:!0,data:t});this.logger.success("Session refreshed!"),a=new Date,t={...t,...m.data,accessTokenExpiresAt:j(a,8).getTime(),refreshTokenExpiresAt:J(z(a,30),2).getTime()},window.localStorage.setItem(this.storageKey,JSON.stringify(t))}return{ok:!0,data:t}}catch{return{ok:!1,error:{name:"UnknownError",message:"Something went wrong."}}}}async destroy(){var t;if(this.isServer){this.logger.warn("'localStorage' is not available on the server.");return}const e=await this.get();(t=e.data)!=null&&t.accessToken&&await this.authService.destroySession(e.data.accessToken),window.localStorage.removeItem(this.storageKey)}async verify(){var a,r,s;if(this.isServer)return this.logger.warn("'localStorage' is not available on the server."),!0;const e=await this.get();if(((a=e.error)==null?void 0:a.name)==="InvalidTokenError"||((r=e.error)==null?void 0:r.name)==="SessionExpiredError"||((s=e.error)==null?void 0:s.name)==="AccountBlacklistedError")return!1;if(!e.data)return!0;const t=await this.authService.verifySession(e.data.accessToken);return t||window.localStorage.removeItem(this.storageKey),t}get isServer(){return typeof window>"u"}}function S(i){const e={};for(const t in i){const a=i[t];if(a!==null&&a!==void 0){if(Oe(a)){e[t]=S(a);continue}if(Array.isArray(a)){e[t]=a.map(r=>Oe(r)?S(r):r);continue}e[t]=a}}return e}function n(i,e){if(typeof i=="number"&&!Number.isNaN(i))return i;if(typeof i=="string"){const t=Number.parseFloat(i);if(!Number.isNaN(t))return t}return e}class _a{get transform(){return{site:this.site.bind(this),platform:this.platform.bind(this),account:this.account.bind(this),wallet:this.wallet.bind(this),verificationDetails:this.verificationDetails.bind(this),profileCompletion:this.profileCompletion.bind(this),announcement:this.announcement.bind(this),withdrawalRecord:this.withdrawalRecord.bind(this),deposit:this.deposit.bind(this),depositRecord:this.depositRecord.bind(this),betRecord:this.betRecord.bind(this),latestBetRecord:this.latestBetRecord.bind(this),transactionRecord:this.transactionRecord.bind(this),game:this.game.bind(this),gameSession:this.gameSession.bind(this),promo:this.promo.bind(this),cashback:this.cashback.bind(this),bonus:this.bonus.bind(this),cashbackBonus:this.cashbackBonus.bind(this),file:this.file.bind(this),pointsWallet:this.pointsWallet.bind(this),pointsWalletTransaction:this.pointsWalletTransaction.bind(this),activityRecord:this.activityRecord.bind(this),referral:this.referral.bind(this),referralCommission:this.referralCommission.bind(this),platform__next:this.platform__next.bind(this),pointsClubSettings:this.pointsClubSettings.bind(this),paymentSettings:this.paymentSettings.bind(this),message:this.message.bind(this),instapayBank:this.instapayBank.bind(this),promoByCode:this.promoByCode.bind(this)}}site(e){const t={id:e.id,name:e.name,logo:e.logo??void 0,fields:e.config.fields};return S(t)}platform(e){var t,a,r,s,m,u,l,f,y,p,D,R,M,v,N,I,g,G,P,C,O,B,W,x,_,q,U,$,L,F,V,H,Y,Q,k,X,Z,ee,te,ae,re,ne,oe,ie,se,me,ue,de,ce,le,pe,fe,we,ye,he,ge,be,Ee,Ae,Se,ke,Ce,_e,Te,De,Re,Fe;return{timezone:e.timezone,currency:e.currency,paymentSettings:{minimumFirstDepositAmount:n(e.minimumFirstDepositAmount),restrictWithdrawalsToVerifiedMembers:e.restrictWithdrawalsToVerifiedMembers,depositGateway:{bank:{androidEnabled:((t=e.bankDepositGatewaySettings)==null?void 0:t.androidEnabled)??!1,iosEnabled:((a=e.bankDepositGatewaySettings)==null?void 0:a.iosEnabled)??!1,webEnabled:((r=e.bankDepositGatewaySettings)==null?void 0:r.webEnabled)??!1,mobileWebEnabled:((s=e.bankDepositGatewaySettings)==null?void 0:s.mobileWebEnabled)??!1,minimumAmount:n((m=e.bankDepositGatewaySettings)==null?void 0:m.minimumAmount),maximumAmount:n((u=e.bankDepositGatewaySettings)==null?void 0:u.maximumAmount)},gcash:{androidEnabled:((l=e.gcashDepositGatewaySettings)==null?void 0:l.androidEnabled)??!1,iosEnabled:((f=e.gcashDepositGatewaySettings)==null?void 0:f.iosEnabled)??!1,webEnabled:((y=e.gcashDepositGatewaySettings)==null?void 0:y.webEnabled)??!1,mobileWebEnabled:((p=e.gcashDepositGatewaySettings)==null?void 0:p.mobileWebEnabled)??!1,minimumAmount:n((D=e.gcashDepositGatewaySettings)==null?void 0:D.minimumAmount),maximumAmount:n((R=e.gcashDepositGatewaySettings)==null?void 0:R.maximumAmount)},maya:{androidEnabled:((M=e.mayaDepositGatewaySettings)==null?void 0:M.androidEnabled)??!1,iosEnabled:((v=e.mayaDepositGatewaySettings)==null?void 0:v.iosEnabled)??!1,webEnabled:((N=e.mayaDepositGatewaySettings)==null?void 0:N.webEnabled)??!1,mobileWebEnabled:((I=e.mayaDepositGatewaySettings)==null?void 0:I.mobileWebEnabled)??!1,minimumAmount:n((g=e.mayaDepositGatewaySettings)==null?void 0:g.minimumAmount),maximumAmount:n((G=e.mayaDepositGatewaySettings)==null?void 0:G.maximumAmount)},mayaApp:{androidEnabled:((P=e.mayaAppDepositGatewaySettings)==null?void 0:P.androidEnabled)??!1,iosEnabled:((C=e.mayaAppDepositGatewaySettings)==null?void 0:C.iosEnabled)??!1,webEnabled:((O=e.mayaAppDepositGatewaySettings)==null?void 0:O.webEnabled)??!1,mobileWebEnabled:((B=e.mayaAppDepositGatewaySettings)==null?void 0:B.mobileWebEnabled)??!1,minimumAmount:n((W=e.mayaAppDepositGatewaySettings)==null?void 0:W.minimumAmount),maximumAmount:n((x=e.mayaAppDepositGatewaySettings)==null?void 0:x.maximumAmount)},onlineBank:{androidEnabled:((_=e.onlineBankDepositGatewaySettings)==null?void 0:_.androidEnabled)??!1,iosEnabled:((q=e.onlineBankDepositGatewaySettings)==null?void 0:q.iosEnabled)??!1,webEnabled:((U=e.onlineBankDepositGatewaySettings)==null?void 0:U.webEnabled)??!1,mobileWebEnabled:(($=e.onlineBankDepositGatewaySettings)==null?void 0:$.mobileWebEnabled)??!1,minimumAmount:n((L=e.onlineBankDepositGatewaySettings)==null?void 0:L.minimumAmount),maximumAmount:n((F=e.onlineBankDepositGatewaySettings)==null?void 0:F.maximumAmount)},qrph:{androidEnabled:((V=e.qrphDepositGatewaySettings)==null?void 0:V.androidEnabled)??!1,iosEnabled:((H=e.qrphDepositGatewaySettings)==null?void 0:H.iosEnabled)??!1,webEnabled:((Y=e.qrphDepositGatewaySettings)==null?void 0:Y.webEnabled)??!1,mobileWebEnabled:((Q=e.qrphDepositGatewaySettings)==null?void 0:Q.mobileWebEnabled)??!1,minimumAmount:n((k=e.qrphDepositGatewaySettings)==null?void 0:k.minimumAmount),maximumAmount:n((X=e.qrphDepositGatewaySettings)==null?void 0:X.maximumAmount)}},withdrawalGateway:{bank:{androidEnabled:((Z=e.bankWithdrawalGatewaySettings)==null?void 0:Z.androidEnabled)??!1,iosEnabled:((ee=e.bankWithdrawalGatewaySettings)==null?void 0:ee.iosEnabled)??!1,webEnabled:((te=e.bankWithdrawalGatewaySettings)==null?void 0:te.webEnabled)??!1,mobileWebEnabled:((ae=e.bankWithdrawalGatewaySettings)==null?void 0:ae.mobileWebEnabled)??!1,minimumAmount:n((re=e.bankWithdrawalGatewaySettings)==null?void 0:re.minimumAmount),maximumAmount:n((ne=e.bankWithdrawalGatewaySettings)==null?void 0:ne.maximumAmount)},gcash:{androidEnabled:((oe=e.gcashWithdrawalGatewaySettings)==null?void 0:oe.androidEnabled)??!1,iosEnabled:((ie=e.gcashWithdrawalGatewaySettings)==null?void 0:ie.iosEnabled)??!1,webEnabled:((se=e.gcashWithdrawalGatewaySettings)==null?void 0:se.webEnabled)??!1,mobileWebEnabled:((me=e.gcashWithdrawalGatewaySettings)==null?void 0:me.mobileWebEnabled)??!1,minimumAmount:n((ue=e.gcashWithdrawalGatewaySettings)==null?void 0:ue.minimumAmount),maximumAmount:n((de=e.gcashWithdrawalGatewaySettings)==null?void 0:de.maximumAmount,1e6)},maya:{androidEnabled:((ce=e.mayaWithdrawalGatewaySettings)==null?void 0:ce.androidEnabled)??!1,iosEnabled:((le=e.mayaWithdrawalGatewaySettings)==null?void 0:le.iosEnabled)??!1,webEnabled:((pe=e.mayaWithdrawalGatewaySettings)==null?void 0:pe.webEnabled)??!1,mobileWebEnabled:((fe=e.mayaWithdrawalGatewaySettings)==null?void 0:fe.mobileWebEnabled)??!1,minimumAmount:n((we=e.mayaWithdrawalGatewaySettings)==null?void 0:we.minimumAmount),maximumAmount:n((ye=e.mayaWithdrawalGatewaySettings)==null?void 0:ye.maximumAmount)},mayaApp:{androidEnabled:((he=e.mayaAppWithdrawalGatewaySettings)==null?void 0:he.androidEnabled)??!1,iosEnabled:((ge=e.mayaAppWithdrawalGatewaySettings)==null?void 0:ge.iosEnabled)??!1,webEnabled:((be=e.mayaAppWithdrawalGatewaySettings)==null?void 0:be.webEnabled)??!1,mobileWebEnabled:((Ee=e.mayaAppWithdrawalGatewaySettings)==null?void 0:Ee.mobileWebEnabled)??!1,minimumAmount:n((Ae=e.mayaAppWithdrawalGatewaySettings)==null?void 0:Ae.minimumAmount),maximumAmount:n((Se=e.mayaAppWithdrawalGatewaySettings)==null?void 0:Se.maximumAmount,1e6)},instapay:{androidEnabled:((ke=e.instapayWithdrawalGatewaySettings)==null?void 0:ke.androidEnabled)??!1,iosEnabled:((Ce=e.instapayWithdrawalGatewaySettings)==null?void 0:Ce.iosEnabled)??!1,webEnabled:((_e=e.instapayWithdrawalGatewaySettings)==null?void 0:_e.webEnabled)??!1,mobileWebEnabled:((Te=e.instapayWithdrawalGatewaySettings)==null?void 0:Te.mobileWebEnabled)??!1,minimumAmount:n((De=e.instapayWithdrawalGatewaySettings)==null?void 0:De.minimumAmount),maximumAmount:n((Re=e.instapayWithdrawalGatewaySettings)==null?void 0:Re.maximumAmount,1e6)}}},pointsClubSettings:{multiplier:n((Fe=e.pointsClubSettings)==null?void 0:Fe.multiplier,0)}}}platform__next(e){return{currency:e.currency,timezone:e.timezone,locale:Sa(e.currency)}}pointsClubSettings(e){return{multiplier:n(e.multiplier,0)}}paymentSettings(e){var t,a,r,s,m,u,l,f,y,p,D,R,M,v,N,I,g,G,P,C,O,B,W,x,_,q,U,$,L,F,V,H,Y,Q,k,X,Z,ee,te,ae,re,ne,oe,ie,se,me,ue,de,ce,le,pe,fe,we,ye,he,ge,be,Ee,Ae,Se,ke,Ce,_e,Te,De,Re;return{minimumFirstDepositAmount:n(e.minimumFirstDepositAmount),restrictWithdrawalsToVerifiedMembers:e.restrictWithdrawalsToVerifiedMembers,depositGateway:{bank:{androidEnabled:((t=e.bankDepositGatewaySettings)==null?void 0:t.androidEnabled)??!1,iosEnabled:((a=e.bankDepositGatewaySettings)==null?void 0:a.iosEnabled)??!1,webEnabled:((r=e.bankDepositGatewaySettings)==null?void 0:r.webEnabled)??!1,mobileWebEnabled:((s=e.bankDepositGatewaySettings)==null?void 0:s.mobileWebEnabled)??!1,minimumAmount:n((m=e.bankDepositGatewaySettings)==null?void 0:m.minimumAmount),maximumAmount:n((u=e.bankDepositGatewaySettings)==null?void 0:u.maximumAmount)},gcash:{androidEnabled:((l=e.gcashDepositGatewaySettings)==null?void 0:l.androidEnabled)??!1,iosEnabled:((f=e.gcashDepositGatewaySettings)==null?void 0:f.iosEnabled)??!1,webEnabled:((y=e.gcashDepositGatewaySettings)==null?void 0:y.webEnabled)??!1,mobileWebEnabled:((p=e.gcashDepositGatewaySettings)==null?void 0:p.mobileWebEnabled)??!1,minimumAmount:n((D=e.gcashDepositGatewaySettings)==null?void 0:D.minimumAmount),maximumAmount:n((R=e.gcashDepositGatewaySettings)==null?void 0:R.maximumAmount)},maya:{androidEnabled:((M=e.mayaDepositGatewaySettings)==null?void 0:M.androidEnabled)??!1,iosEnabled:((v=e.mayaDepositGatewaySettings)==null?void 0:v.iosEnabled)??!1,webEnabled:((N=e.mayaDepositGatewaySettings)==null?void 0:N.webEnabled)??!1,mobileWebEnabled:((I=e.mayaDepositGatewaySettings)==null?void 0:I.mobileWebEnabled)??!1,minimumAmount:n((g=e.mayaDepositGatewaySettings)==null?void 0:g.minimumAmount),maximumAmount:n((G=e.mayaDepositGatewaySettings)==null?void 0:G.maximumAmount)},mayaApp:{androidEnabled:((P=e.mayaAppDepositGatewaySettings)==null?void 0:P.androidEnabled)??!1,iosEnabled:((C=e.mayaAppDepositGatewaySettings)==null?void 0:C.iosEnabled)??!1,webEnabled:((O=e.mayaAppDepositGatewaySettings)==null?void 0:O.webEnabled)??!1,mobileWebEnabled:((B=e.mayaAppDepositGatewaySettings)==null?void 0:B.mobileWebEnabled)??!1,minimumAmount:n((W=e.mayaAppDepositGatewaySettings)==null?void 0:W.minimumAmount),maximumAmount:n((x=e.mayaAppDepositGatewaySettings)==null?void 0:x.maximumAmount)},onlineBank:{androidEnabled:((_=e.onlineBankDepositGatewaySettings)==null?void 0:_.androidEnabled)??!1,iosEnabled:((q=e.onlineBankDepositGatewaySettings)==null?void 0:q.iosEnabled)??!1,webEnabled:((U=e.onlineBankDepositGatewaySettings)==null?void 0:U.webEnabled)??!1,mobileWebEnabled:(($=e.onlineBankDepositGatewaySettings)==null?void 0:$.mobileWebEnabled)??!1,minimumAmount:n((L=e.onlineBankDepositGatewaySettings)==null?void 0:L.minimumAmount),maximumAmount:n((F=e.onlineBankDepositGatewaySettings)==null?void 0:F.maximumAmount)},qrph:{androidEnabled:((V=e.qrphDepositGatewaySettings)==null?void 0:V.androidEnabled)??!1,iosEnabled:((H=e.qrphDepositGatewaySettings)==null?void 0:H.iosEnabled)??!1,webEnabled:((Y=e.qrphDepositGatewaySettings)==null?void 0:Y.webEnabled)??!1,mobileWebEnabled:((Q=e.qrphDepositGatewaySettings)==null?void 0:Q.mobileWebEnabled)??!1,minimumAmount:n((k=e.qrphDepositGatewaySettings)==null?void 0:k.minimumAmount),maximumAmount:n((X=e.qrphDepositGatewaySettings)==null?void 0:X.maximumAmount)}},withdrawalGateway:{bank:{androidEnabled:((Z=e.bankWithdrawalGatewaySettings)==null?void 0:Z.androidEnabled)??!1,iosEnabled:((ee=e.bankWithdrawalGatewaySettings)==null?void 0:ee.iosEnabled)??!1,webEnabled:((te=e.bankWithdrawalGatewaySettings)==null?void 0:te.webEnabled)??!1,mobileWebEnabled:((ae=e.bankWithdrawalGatewaySettings)==null?void 0:ae.mobileWebEnabled)??!1,minimumAmount:n((re=e.bankWithdrawalGatewaySettings)==null?void 0:re.minimumAmount),maximumAmount:n((ne=e.bankWithdrawalGatewaySettings)==null?void 0:ne.maximumAmount)},gcash:{androidEnabled:((oe=e.gcashWithdrawalGatewaySettings)==null?void 0:oe.androidEnabled)??!1,iosEnabled:((ie=e.gcashWithdrawalGatewaySettings)==null?void 0:ie.iosEnabled)??!1,webEnabled:((se=e.gcashWithdrawalGatewaySettings)==null?void 0:se.webEnabled)??!1,mobileWebEnabled:((me=e.gcashWithdrawalGatewaySettings)==null?void 0:me.mobileWebEnabled)??!1,minimumAmount:n((ue=e.gcashWithdrawalGatewaySettings)==null?void 0:ue.minimumAmount),maximumAmount:n((de=e.gcashWithdrawalGatewaySettings)==null?void 0:de.maximumAmount,1e6)},maya:{androidEnabled:((ce=e.mayaWithdrawalGatewaySettings)==null?void 0:ce.androidEnabled)??!1,iosEnabled:((le=e.mayaWithdrawalGatewaySettings)==null?void 0:le.iosEnabled)??!1,webEnabled:((pe=e.mayaWithdrawalGatewaySettings)==null?void 0:pe.webEnabled)??!1,mobileWebEnabled:((fe=e.mayaWithdrawalGatewaySettings)==null?void 0:fe.mobileWebEnabled)??!1,minimumAmount:n((we=e.mayaWithdrawalGatewaySettings)==null?void 0:we.minimumAmount),maximumAmount:n((ye=e.mayaWithdrawalGatewaySettings)==null?void 0:ye.maximumAmount)},mayaApp:{androidEnabled:((he=e.mayaAppWithdrawalGatewaySettings)==null?void 0:he.androidEnabled)??!1,iosEnabled:((ge=e.mayaAppWithdrawalGatewaySettings)==null?void 0:ge.iosEnabled)??!1,webEnabled:((be=e.mayaAppWithdrawalGatewaySettings)==null?void 0:be.webEnabled)??!1,mobileWebEnabled:((Ee=e.mayaAppWithdrawalGatewaySettings)==null?void 0:Ee.mobileWebEnabled)??!1,minimumAmount:n((Ae=e.mayaAppWithdrawalGatewaySettings)==null?void 0:Ae.minimumAmount),maximumAmount:n((Se=e.mayaAppWithdrawalGatewaySettings)==null?void 0:Se.maximumAmount,1e6)},instapay:{androidEnabled:((ke=e.instapayWithdrawalGatewaySettings)==null?void 0:ke.androidEnabled)??!1,iosEnabled:((Ce=e.instapayWithdrawalGatewaySettings)==null?void 0:Ce.iosEnabled)??!1,webEnabled:((_e=e.instapayWithdrawalGatewaySettings)==null?void 0:_e.webEnabled)??!1,mobileWebEnabled:((Te=e.instapayWithdrawalGatewaySettings)==null?void 0:Te.mobileWebEnabled)??!1,minimumAmount:n((De=e.instapayWithdrawalGatewaySettings)==null?void 0:De.minimumAmount),maximumAmount:n((Re=e.instapayWithdrawalGatewaySettings)==null?void 0:Re.maximumAmount,1e6)}}}}account(e){const t={id:e.id,name:e.name,status:e.status,verified:e.verified,nickName:e.nickName??void 0,realName:e.realName??void 0,dateOfBirth:e.birthDay?new Date(e.birthDay):void 0,emailAddress:e.emailAddress??void 0,mobileNumber:e.mobileNumber??void 0,mobileNumberVerified:e.mobileNumberVerified??!1,mobileNumberVerificationRequired:e.mobileNumberVerificationRequired??!1,validId:e.validId||void 0,verificationStatus:e.verificationStatus,transactionPassword:e.transactionPassword,secretAnswerSubmitted:e.secretAnswerSubmitted??!1,dateTimeCreated:new Date(e.dateTimeCreated),dateTimeLastUpdated:new Date(e.dateTimeLastUpdated)};return S(t)}wallet(e){return{id:e.id,balance:n(e.balance,0),currency:e.currency,dateTimeCreated:new Date(e.dateTimeCreated),dateTimeLastUpdated:new Date(e.dateTimeLastUpdated)}}verificationDetails(e){return{id:e.id,status:e.status,address:e.address,permanentAddress:e.permanentAddress,nationality:e.nationality,natureOfWork:e.natureOfWork,placeOfBirth:e.placeOfBirth,sourceOfIncome:e.sourceOfIncome,selfieImage:this.file(e.selfieImage),idFrontImage:this.file(e.idFrontImage)}}profileCompletion(e){return{accountPassword:e.accountPassword??!1,accountVerification:e.accountVerification??!1,mobileNumberVerification:e.mobileNumberVerification??!1,personalInformation:e.personalInformation??!1,transactionPassword:e.transactionPassword??!1,completionPercentage:n(e.completionPercentage,0)}}announcement(e){return{id:e.id,type:e.type,title:e.title,status:e.status,message:e.message,activationEndDateTime:new Date(e.activationEndDateTime),activationStartDateTime:new Date(e.activationStartDateTime),dateTimeCreated:new Date(e.dateTimeCreated),dateTimeLastUpdated:new Date(e.dateTimeLastUpdated)}}withdrawalRecord(e){const t={id:e.id,type:e.type,bank:e.bank,status:e.status,amount:n(e.amount,0),netAmount:n(e.netAmount,0),fee:n(e.fee,0),reference:e.reference??void 0,error:e.error??void 0,withdrawalNumber:e.withdrawalNumber,recipientMobileNumber:e.recipientMobileNumber??void 0,dateTimeConfirmed:e.dateTimeConfirmed?new Date(e.dateTimeConfirmed):void 0,dateTimeCreated:new Date(e.dateTimeCreated),dateTimeLastUpdated:new Date(e.dateTimeLastUpdated)};return S(t)}deposit(e){const t={id:e.id,type:e.type,status:e.status,vca:e.vca??void 0,qrCode:e.qrCode??void 0,checkoutUrl:e.checkoutUrl??void 0};return S(t)}depositRecord(e){const t={id:e.id,type:e.type,status:e.status,amount:n(e.amount,0),fee:n(e.fee,0),netAmount:n(e.netAmount,0),reference:e.reference??void 0,depositNumber:e.depositNumber,dateTimeCreated:new Date(e.dateTimeCreated),dateTimeLastUpdated:new Date(e.dateTimeLastUpdated),error:e.error??void 0};return S(t)}betRecord(e){var a;const t={id:e.id,bet:n(e.bet,0),payout:n(e.payout,0),status:e.status,jackpotContribution:n(e.jackpotContribution,0),jackpotPayout:n(e.jackpotPayout,0),winloss:n(e.winloss),validBet:n(e.validBet,0),vendorRoundId:e.vendorRoundId??void 0,game:e.game?this.game(e.game):void 0,serialCode:e.serialCode,dateTimeSettled:e.dateTimeSettled?new Date(e.dateTimeSettled):void 0,dateTimeCreated:new Date(e.dateTimeCreated),dateTimeLastUpdated:new Date(e.dateTimeLastUpdated),betContent:e.betContent??void 0,contestName:e.contestName??void 0,externalCategory:e.externalCategory??void 0,metadata:{odds:((a=e.metadata)==null?void 0:a.odds)??void 0}};return S(t)}latestBetRecord(e){return{id:e.id,member:e.member,game:e.game?this.game(e.game):void 0,bet:n(e.bet,0),payout:n(e.payout,0),validBet:n(e.validBet,0),dateTimeSettled:new Date(e.dateTimeSettled),dateTimeCreated:new Date(e.dateTimeCreated)}}transactionRecord(e){const t={id:e.id,type:e.type,amount:n(e.amount,0),content:e.content??void 0,currentBalance:n(e.currentBalance,0),referenceNumber:e.referenceNumber,dateTimeCreated:new Date(e.dateTimeCreated)};return S(t)}game(e){return{id:e.id,type:e.type,tags:e.tags??[],name:e.name,images:[e.customImage,e.image].filter(Boolean),provider:e.provider,reference:e.reference}}gameSession(e){const t={id:e.id,status:e.status,launchUrl:e.launchUrl??void 0,dateTimeCreated:new Date(e.dateTimeCreated),dateTimeLastUpdated:new Date(e.dateTimeLastUpdated)};return S(t)}promo(e){return{id:e.id,type:e.type,name:e.name,status:e.status,description:e.description,banner:e.banner?this.file(e.banner):null,maximumBonusAmount:n(e.maximumBonusAmount),minimumBonusAmount:n(e.minimumBonusAmount),maximumDepositAmount:n(e.maximumDepositAmount),minimumDepositAmount:n(e.minimumDepositAmount),activationEndDateTime:new Date(e.activationEndDateTime),activationStartDateTime:new Date(e.activationStartDateTime),dateTimeCreated:new Date(e.dateTimeCreated),dateTimeLastUpdated:new Date(e.dateTimeLastUpdated)}}cashback(e){return{id:e.id,name:e.name,description:e.description,status:e.status,minimumCashback:n(e.minimumCashback,0),maximumMonthlyCashback:n(e.maximumMonthlyCashback),banner:e.banner?this.file(e.banner):null,activationEndDateTime:new Date(e.activationEndDateTime),activationStartDateTime:new Date(e.activationStartDateTime),dateTimeCreated:new Date(e.dateTimeCreated),dateTimeLastUpdated:new Date(e.dateTimeLastUpdated),turnoverContributionPercentagePerGameProvider:Object.entries(e.turnoverContributionPercentagePerGameProvider).reduce((a,[r,s])=>(a[r]=n(s,0),a),{})}}bonus(e){const t={id:e.id,promo:this.promo(e.promo),deposit:e.deposit?{type:e.deposit.type,status:e.deposit.status,fee:n(e.deposit.fee,0),amount:n(e.deposit.amount,0),netAmount:n(e.deposit.netAmount,0),reference:e.deposit.reference??void 0,dateTimeCreated:new Date(e.deposit.dateTimeCreated),dateTimeLastUpdated:new Date(e.deposit.dateTimeLastUpdated)}:void 0,balance:n(e.balance,0),amount:n(e.amount,0),expiration:new Date(e.expiration),turnoverRequirement:n(e.turnoverRequirement,0),currentTurnoverRequirementContribution:n(e.currentTurnoverRequirementContribution,0),currentTurnoverRequirementContributionPercentage:n(e.currentTurnoverRequirementContributionPercentage,0),dateTimeCreated:new Date(e.dateTimeCreated),dateTimeLastUpdated:new Date(e.dateTimeLastUpdated)};return S(t)}cashbackBonus(e){return{id:e.id,total:n(e.total,0),balance:n(e.balance,0),cashback:this.cashback(e.cashback),dateTimeCreated:new Date(e.dateTimeCreated),dateTimeLastUpdated:new Date(e.dateTimeLastUpdated)}}file(e){const t={id:e.id,url:e.url??void 0,status:e.status,dateTimeCreated:new Date(e.dateTimeCreated)};return S(t)}pointsWallet(e){return{id:e.id,points:n(e.points,0),account:e.account,dateTimeCreated:new Date(e.dateTimeCreated)}}pointsWalletTransaction(e){return{id:e.id,type:e.type,amount:n(e.amount,0),balance:n(e.balance,0),dateTimeCreated:new Date(e.dateTimeCreated)}}activityRecord(e){const t={id:e.id,type:e.type,amount:e.amount?n(e.amount,0):void 0,domain:e.domain??void 0,details:e.details,dateTimeCreated:new Date(e.dateTimeCreated)};return S(t)}referral(e){return{id:e.id,level:e.level,upline:e.upline,downline:e.downline,turnover:n(e.turnover,0),commission:n(e.commission,0),dateTimeCreated:new Date(e.dateTimeCreated)}}referralCommission(e){return{id:e.id,commission:n(e.commission,0),level1Commission:n(e.level1Commission,0),level2Commission:n(e.level2Commission,0),level3Commission:n(e.level3Commission,0),referralsCount:e.referralsCount,level1ReferralsCount:e.level1ReferralsCount,level2ReferralsCount:e.level2ReferralsCount,level3ReferralsCount:e.level3ReferralsCount,referralCode:e.referralCode,dateTimeCreated:new Date(e.dateTimeCreated),dateTimeLastUpdated:new Date(e.dateTimeLastUpdated)}}message(e){return{id:e.id,icon:e.icon,logo:e.logo,image:e.image,title:e.title,popup:e.popup,content:e.content,actions:e.actions,markedAsRead:e.markedAsRead,dateTimeCreated:new Date(e.dateTimeCreated)}}instapayBank(e){return e}promoByCode(e){return{activeBonusesCount:e.activeBonusesCount,bonusesCount:e.bonusesCount,cancelledBonusesCount:e.cancelledBonusesCount,clearedBonusesCount:e.clearedBonusesCount,closedBonusesCount:e.closedBonusesCount,closedBonusesCountPercentage:n(e.closedBonusesCountPercentage,0),code:e.code,daysToClear:e.daysToClear,enabledGameProviders:e.enabledGameProviders,id:e.id,expiredBonusesCount:e.expiredBonusesCount,maximumBonusesCountLimit:e.maximumBonusesCountLimit,name:e.name,status:e.status,totalBet:n(e.totalBet,0),totalBonus:n(e.totalBonus,0),totalBonusBalance:n(e.totalBonusBalance,0),totalBonusCashedOut:n(e.totalBonusCashedOut,0),totalDeposit:n(e.totalDeposit,0),turnoverRequirementMultiplier:n(e.turnoverRequirementMultiplier,0),type:e.type,zeroedOutBonusesCount:e.zeroedOutBonusesCount,zeroOutThreshold:n(e.zeroOutThreshold,0),bonusAmount:n(e.bonusAmount,0),description:e.description,turnoverRequirementType:e.turnoverRequirementType,activationEndDateTime:e.activationEndDateTime?new Date(e.activationEndDateTime):void 0,activationStartDateTime:e.activationStartDateTime?new Date(e.activationStartDateTime):void 0,dateTimeClosed:e.dateTimeClosed?new Date(e.dateTimeClosed):void 0,dateTimeLastUpdated:new Date(e.dateTimeLastUpdated),dateTimeCreated:new Date(e.dateTimeCreated),turnoverRequirementContributionPercentagePerGameProvider:Object.entries(e.turnoverRequirementContributionPercentagePerGameProvider).reduce((t,[a,r])=>(t[a]=n(r,0),t),{}),minimumTicketOddFactorPerSportsGameProvider:Object.entries(e.minimumTicketOddFactorPerSportsGameProvider).reduce((t,[a,r])=>(t[a]=n(r,0),t),{}),banner:e.banner}}}class Ta{constructor(e){d(this,"cmsPortalService");d(this,"authService");d(this,"gameService");d(this,"fileService");d(this,"walletService");d(this,"accountService");d(this,"reportService");d(this,"portalService");d(this,"triggerService");d(this,"sessionManager");d(this,"transformer");d(this,"logger");d(this,"cache");const{site:t,sitePlatform:a,platform:r,environment:s,logs:m}=e,u=s==="production";this.transformer=new _a,this.logger=new Ue({enabled:m??!1});const l=u?"https://auth.opexa.io":"https://auth.development.opexa.io",f=u?"https://wallet.opexa.io/graphql":"https://wallet.development.opexa.io/graphql",y=u?"https://report.opexa.io/graphql":"https://report.development.opexa.io/graphql",p=u?"https://account.opexa.io/graphql":"https://account.development.opexa.io/graphql",D=u?"https://portal.opexa.io/graphql":"https://portal.development.opexa.io/graphql",R=u?"https://file.opexa.io/graphql":"https://file.development.opexa.io/graphql",M=u?"https://game.opexa.io/graphql":"https://game.development.opexa.io/graphql",v=u?"https://trigger.opexa.io/graphql":"https://trigger.development.opexa.io/graphql",N="https://portal-api.opexacms.io/v1",I=new da({url:N,site:t,platform:a}),g={middlewares:[this.authMiddleware],fetchOptions:{headers:{Role:"MEMBER","Platform-Code":r}}},G=new la(new K(M,g)),P=new ca(new K(R,g)),C=new ya(new K(f,g)),O=new ma(new K(p,g)),B=new fa(new K(y,g)),W=new pa(new K(D,g)),x=new wa(new K(v,g)),_=new ua({url:l,platform:r}),q=new Ca({logs:m,authService:_,walletService:C});this.authService=_,this.gameService=G,this.fileService=P,this.walletService=C,this.accountService=O,this.reportService=B,this.portalService=W,this.triggerService=x,this.sessionManager=q,this.cmsPortalService=I,this.cache=new ha}get authMiddleware(){return async e=>{this.logger.info("Checking for session");const t=await this.sessionManager.get();return t.data?(e.headers.append("Authorization",`Bearer ${t.data.accessToken}`),this.logger.info("Session found"),this.logger.success("Added 'Authorization' header")):this.logger.info("No session found"),e}}get locale(){return new Promise(e=>{const t="locale",a=this.cache.get(t);if(a)return e(a);this.platform__next().then(r=>{r.ok?(this.cache.set(t,r.data.locale),e(r.data.locale)):(this.logger.warn("Failed to fetch currency. Using 'PH' as fallback"),e("en-PH"))})})}async signIn(e){switch(e.type){case"NAME_AND_PASSWORD":{const t=await this.sessionManager.create({...e,password:await A(e.password)});return t.ok?t.data?{ok:!0,data:{"2FAEnabled":!0,authenticator:t.data.authenticator}}:{ok:!0,data:{"2FAEnabled":!1}}:t}case"TOKEN":{const t=await this.sessionManager.create({type:"TOKEN",token:e.token});return t.ok?{ok:!0}:t}case"MOBILE_NUMBER":{const t=await this.sessionManager.create({type:"MOBILE_NUMBER",mobileNumber:T(e.mobileNumber,await this.locale),verificationCode:e.verificationCode,reCAPTCHAResponse:e.reCAPTCHAResponse});return t.ok?{ok:!0}:t}default:{const t=await this.sessionManager.create(e);return t.ok?{ok:!0}:t}}}async authenticate(e){switch(e.type){case"SECURITY_QUESTION":return await this.sessionManager.createFromAuthenticator({type:"SECURITY_QUESTION",token:e.token,secretAnswer:await A(e.secretAnswer)});default:return{ok:!1,error:{name:"HttpBadRequest",message:"Invalid input 'type'"}}}}async signOut(){await this.sessionManager.destroy()}watchSession(e){const t=ga(e.interval??3e4,3e4,6e4);let a=null;const r=()=>setTimeout(async()=>{await this.sessionManager.verify()||await e.onInvalid(),a=r()},t);return a=r(),function(){a&&clearTimeout(a)}}async session(){const e=await this.sessionManager.get();return e.ok?{ok:!0,data:e.data?{id:e.data.session.id,dateTimeCreated:new Date(e.data.session.dateTimeCreated)}:null}:e}async validateMayaSession(){return await this.walletService.validateMayaSession()}async site(){const e=await this.cmsPortalService.self();return e.ok?{ok:!0,data:this.transformer.transform.site(e.data)}:e}async platform(){const e=await this.accountService.platform();return e.ok?{ok:!0,data:this.transformer.transform.platform(e.data)}:e}async platform__next(){const e=await this.portalService.platform();return e.ok?{ok:!0,data:this.transformer.transform.platform__next(e.data)}:e}async paymentSettings(){const e=await this.accountService.paymentSettings();return e.ok?{ok:!0,data:this.transformer.transform.paymentSettings(e.data)}:e}async account(){const e=await this.accountService.memberAccount();return e.ok?{ok:!0,data:this.transformer.transform.account(e.data)}:e}async createAccount(e){const t=e.id??w.ObjectId.generate(E.Account).toString(),a=await this.accountService.registerMemberAccount({input:{id:t,btag:e.btag,name:e.name,domain:e.domain,birthDay:typeof e.dateOfBirth=="string"?e.dateOfBirth:this.formatYmd(e.dateOfBirth),password:await A(e.password),mobileNumber:T(e.mobileNumber,await this.locale)},referralCode:e.referralCode,verificationCode:e.verificationCode,reCAPTCHAResponse:e.reCAPTCHAResponse});return a.ok?{ok:!0,data:{id:t}}:a}async createAccount__next(e){const t=e.id??w.ObjectId.generate(E.Account).toString();if(e.type==="MOBILE_NUMBER"){const r=await this.accountService.registerMemberAccountViaMobile({input:{id:t,btag:e.btag,domain:e.domain,mobileNumber:T(e.mobileNumber,await this.locale)},referralCode:e.referralCode,verificationCode:e.verificationCode,reCAPTCHAResponse:e.reCAPTCHAResponse});return r.ok?{ok:!0,data:{id:t}}:r}const a=await this.accountService.registerMemberAccount__next({input:{id:t,name:e.name,btag:e.btag,domain:e.domain,password:await A(e.password),mobileNumber:e.mobileNumber?T(e.mobileNumber,await this.locale):void 0},reCAPTCHAResponse:e.reCAPTCHAResponse});return a.ok?{ok:!0,data:{id:t}}:a}async registerMayaAccount(e){return await this.accountService.registerMayaMemberAccount({input:{name:e.name,password:await A(e.password),domain:e.domain}})}async updateAccount(e,t){const{password:a,dateOfBirth:r,mobileNumber:s,secretAnswer:m,transactionPassword:u,...l}=t;return await this.accountService.updateMemberAccount({input:{id:e,data:{...l,password:a?await A(a):void 0,transactionPassword:u?await A(u):void 0,mobileNumber:s?T(s,await this.locale):void 0,secretAnswer:m?await A(m):void 0,birthDay:r?typeof r=="string"?r:this.formatYmd(r):void 0}}})}async deleteAccount(e){return await this.accountService.deleteMemberAccount({input:{id:e}})}async verificationDetails(){const e=await this.accountService.memberVerification();return e.ok?{ok:!0,data:e.data?this.transformer.transform.verificationDetails(e.data):null}:e}async submitVerificationDetails(e){const t=e.id??w.ObjectId.generate(E.Verification).toString(),a=await this.accountService.createMemberVerification({input:{id:t,...e}});return a.ok?{ok:!0,data:{id:t}}:a}async updateVerificationDetails(e,t){return await this.accountService.updateMemberVerification({input:{id:e,data:{...t}}})}async resetPassword(e){return await this.accountService.resetPassword({input:{mobileNumber:T(e.mobileNumber,await this.locale),newPassword:await A(e.newPassword)},verificationCode:e.verificationCode})}async verifyMobileNumber(e){return await this.accountService.verifyMobileNumber({input:{verificationCode:e}})}async profileCompletion(){const e=await this.accountService.profileCompletion();return e.ok?{ok:!0,data:this.transformer.transform.profileCompletion(e.data)}:e}async sendVerificationCode(e){return await this.accountService.sendVerificationCode({input:{channel:"SMS",recipient:T(e,await this.locale)}})}async sendVerificationCode__next(e){if(e.type==="SMS")return this.authService.sendVerificationCode({channel:"SMS",recipient:T(e.mobileNumber,await this.locale),...e.strict&&{verificationType:"MEMBER"}});throw new Error("'Email' verification code is not yet supported")}async wallet(){const e=await this.walletService.wallet();return e.ok?{ok:!0,data:e.data?this.transformer.transform.wallet(e.data):null}:e}async announcements(e){const t=await this.accountService.announcements({...e,filter:{...e==null?void 0:e.filter,visibility:{in:["MEMBER","GLOBAL"]}}});return t.ok?{ok:!0,data:{announcements:t.data.edges.map(({cursor:a,node:r})=>({...this.transformer.transform.announcement(r),cursor:a})),totalCount:t.data.totalCount,endCursor:t.data.pageInfo.endCursor??void 0,hasNextPage:t.data.pageInfo.hasNextPage}}:t}async createWithdrawal(e){const t=e.id??w.ObjectId.generate(E.Withdrawal).toString();if(e.type==="BANK"){const a=await this.walletService.createBankWithdrawal({input:{id:t,amount:e.amount.toString(),transactionPassword:await A(e.transactionPassword)}});if(!a.ok)return a}if(e.type==="GCASH"){const a=await this.walletService.createGCashWithdrawal({input:{id:t,amount:e.amount.toString(),transactionPassword:await A(e.transactionPassword),recipientMobileNumber:T(e.recipientMobileNumber,await this.locale)}});if(!a.ok)return a}if(e.type==="MAYA"){const a=await this.walletService.createMayaWithdrawal({input:{id:t,amount:e.amount.toString(),transactionPassword:await A(e.transactionPassword),recipientMobileNumber:T(e.recipientMobileNumber,await this.locale)}});if(!a.ok)return a}if(e.type==="MAYA_APP"){const a=await this.walletService.createMayaAppWithdrawal({input:{id:t,amount:e.amount.toString(),transactionPassword:await A(e.transactionPassword)}});if(!a.ok)return a}if(e.type==="AIO_INSTAPAY"){const a=await this.walletService.createAIOInstapayWithdrawal({input:{id:t,amount:e.amount.toString(),bankCode:e.bankCode,accountNumber:e.accountNumber,transactionPassword:await A(e.transactionPassword)}});if(!a.ok)return a}return{ok:!0,data:{id:t}}}async withdrawalRecords(e){const t=await this.reportService.withdrawalRecords(e);return t.ok?{ok:!0,data:{withdrawalRecords:t.data.edges.map(({cursor:a,node:r})=>({...this.transformer.transform.withdrawalRecord(r),cursor:a})),totalCount:t.data.totalCount,endCursor:t.data.pageInfo.endCursor??void 0,hasNextPage:t.data.pageInfo.hasNextPage}}:t}async remainingDailyWithdrawalsCount(){return await this.walletService.remainingDailyWithdrawalsCount()}async instapayBankList(){const e=await this.walletService.instapayBankList();return e.ok?{ok:!0,data:e.data.map(this.transformer.transform.instapayBank)}:e}async createDeposit(e){const t=e.id??w.ObjectId.generate(E.Deposit).toString();if(e.type==="MAYA"){const a=await this.walletService.createMayaDeposit({input:{id:t,amount:e.amount.toString(),promo:e.promo}});if(!a.ok)return a}if(e.type==="MAYA_APP"){const a=await this.walletService.createMayaAppDeposit({input:{id:t,amount:e.amount.toString(),promo:e.promo}});if(!a.ok)return a}if(e.type==="GCASH"){const a=await this.walletService.createGCashDeposit({input:{id:t,amount:e.amount.toString(),promo:e.promo}});if(!a.ok)return a}if(e.type==="AIO_ONLINE_BANK"){const a=await this.walletService.createAIOOnlineBankDeposit({input:{id:t,amount:e.amount.toString(),promo:e.promo}});if(!a.ok)return a}if(e.type==="AIO_QRPH"){const a=await this.walletService.createAIOQRPHDeposit({input:{id:t,amount:e.amount.toString(),promo:e.promo}});if(!a.ok)return a}return{ok:!0,data:{id:t}}}async deposit(e){const t=await this.walletService.deposit({id:e});return t.ok?{ok:!0,data:t.data?this.transformer.transform.deposit(t.data):null}:t}async depositRecords(e){const t=await this.reportService.depositRecords(e);return t.ok?{ok:!0,data:{depositRecords:t.data.edges.map(({cursor:a,node:r})=>({...this.transformer.transform.depositRecord(r),cursor:a})),totalCount:t.data.totalCount,endCursor:t.data.pageInfo.endCursor??void 0,hasNextPage:t.data.pageInfo.hasNextPage}}:t}async depositsCount(){return await this.reportService.depositsCount()}async betRecords(e){const t=await this.reportService.betRecords({...e,...(e==null?void 0:e.filter)&&{filter:{...e.filter.status&&{status:e.filter.status},...e.filter.serialCode&&{serialCode:e.filter.serialCode},...e.filter.vendorRoundId&&{vendorRoundId:e.filter.vendorRoundId},...e.filter.gameType&&{game__type:e.filter.gameType},...e.filter.gameProvider&&{game__provider:e.filter.gameProvider},...e.filter.dateTimeCreated&&{dateTimeCreated:e.filter.dateTimeCreated}}}});if(!t.ok)return t;const a=[...new Set(t.data.edges.map(s=>s.node.game.id))];if(a.length<=0)return{ok:!0,data:{betRecords:[],totalCount:0,endCursor:void 0,hasNextPage:!1}};const r=await this.cmsPortalService.games({filter:{reference:{in:a}}});return r.ok?{ok:!0,data:{betRecords:t.data.edges.map(({cursor:s,node:m})=>{var l;const u=(l=r.data.edges.find(f=>m.game.id===f.node.reference))==null?void 0:l.node;return{...this.transformer.transform.betRecord({...m,game:u}),cursor:s}}),totalCount:t.data.totalCount,endCursor:t.data.pageInfo.endCursor??void 0,hasNextPage:t.data.pageInfo.hasNextPage}}:r}async latestBetRecords(){const e=await this.portalService.latestBetRecords();if(!e.ok)return e;const t=[...new Set(e.data.map(r=>r.game.id))];if(t.length<=0)return{ok:!0,data:[]};const a=await this.cmsPortalService.games({filter:{reference:{in:t}}});return a.ok?{ok:!0,data:e.data.map(r=>{var m;const s=(m=a.data.edges.find(u=>u.node.reference===r.game.id))==null?void 0:m.node;return this.transformer.transform.latestBetRecord({...r,game:s})})}:a}async transactionRecords(e){const t=await this.reportService.transactionRecords(e);return t.ok?{ok:!0,data:{transactionRecords:t.data.edges.map(({cursor:a,node:r})=>({...this.transformer.transform.transactionRecord(r),cursor:a})),totalCount:t.data.totalCount,endCursor:t.data.pageInfo.endCursor??void 0,hasNextPage:t.data.pageInfo.hasNextPage}}:t}async promos(){const e=await this.walletService.promos();return e.ok?{ok:!0,data:e.data.map(this.transformer.transform.promo)}:e}async availablePromos(){const e=await this.walletService.availablePromos();return e.ok?{ok:!0,data:e.data.map(this.transformer.transform.promo)}:e}async cashbacks(){const e=await this.walletService.cashbacks();return e.ok?{ok:!0,data:e.data.map(this.transformer.transform.cashback)}:e}async bonus(){const e=await this.walletService.bonus();return e.ok?{ok:!0,data:e.data?this.transformer.transform.bonus(e.data):null}:e}async cashbackBonuses(){const e=await this.walletService.cashbackBonuses();return e.ok?{ok:!0,data:e.data.map(this.transformer.transform.cashbackBonus)}:e}async claimCashbackBonus(e){return await this.walletService.claimCashbackBonus({input:{id:e}})}async claimSpotBonus(e){return await this.walletService.claimSpotBonus({code:e})}async promoByCode(e){const t=await this.reportService.promoByCode({code:e});return t.ok?{ok:!0,data:this.transformer.transform.promoByCode(t.data)}:t}async game(e){const t=await this.cmsPortalService.game(e);return t.ok?{ok:!0,data:t.data?this.transformer.transform.game(t.data):null}:t}async games(e){const t=await this.cmsPortalService.games(e);return t.ok?{ok:!0,data:{games:t.data.edges.map(({cursor:a,node:r})=>({...this.transformer.transform.game(r),cursor:a})),totalCount:t.data.totalCount,hasNextPage:t.data.pageInfo.hasNextPage,endCursor:t.data.pageInfo.endCursor??void 0}}:t}async recommendedGames(e){const t=await this.portalService.recommendedGames();if(!t.ok)return t;const a=[...new Set(t.data.map(s=>s.id))];if(a.length<=0)return{ok:!0,data:{games:[],totalCount:0,hasNextPage:!1,endCursor:void 0}};const r=await this.cmsPortalService.games({first:e==null?void 0:e.first,after:e==null?void 0:e.after,filter:{reference:{in:a}}});return r.ok?{ok:!0,data:{games:r.data.edges.map(({cursor:s,node:m})=>({...this.transformer.transform.game(m),cursor:s})),totalCount:r.data.totalCount,hasNextPage:r.data.pageInfo.hasNextPage,endCursor:r.data.pageInfo.endCursor??void 0}}:r}async gameSession(e){const t=await this.walletService.gameSession({id:e});if(!t.ok)return t;if(t.data)return{ok:!0,data:this.transformer.transform.gameSession(t.data)};const a=await this.gameService.gameSession({id:e});return a.ok?{ok:!0,data:a.data?this.transformer.transform.gameSession(a.data):null}:a}async createGameSession(e){const t=e.id??w.ObjectId.generate(E.GameSession).toString();if(e.game.startsWith("SPORTS:")){const f=await w.ObjectId.generateFromKey(E.Game,e.game).then(p=>p.toString()),y=await this.gameService.createGameSession({input:{id:t,game:f}});return y.ok?{ok:!0,data:{id:t}}:y}const r=await this.game(e.game);if(!r.data)return{ok:!1,error:{name:"GameDoesNotExistError",message:"Game does not exist"}};const{provider:s,reference:m}=r.data,l=["RTG","DARWIN","DRBINGO","MEGABALL","EVOLUTION","EVOLUTION_NETENT","EVOLUTION_REDTIGER","HOLLYWOODTV"].includes(s)?await this.walletService.createGameSession({input:{id:t,game:m}}):await this.gameService.createGameSession({input:{id:t,game:m}});return l.ok?{ok:!0,data:{id:t}}:l}async endGameSession(e){const t=await this.walletService.endGameSession({input:{id:e}});return t.ok?t:await this.gameService.endGameSession({input:{id:e}})}async file(e){const t=await this.fileService.file({id:e});return t.ok?{ok:!0,data:t.data?this.transformer.transform.file(t.data):null}:t}async uploadImageFile(e){const t=e.id??w.ObjectId.generate(E.File).toString(),a=await this.fileService.uploadPrivateImageFile({input:{id:t,file:e.file}});return a.ok?{ok:!0,data:{id:t}}:a}async pointsWallet(){const e=await this.walletService.pointsWallet();return e.ok?{ok:!0,data:e.data?this.transformer.transform.pointsWallet(e.data):null}:e}async redeemPoints(e){return await this.walletService.redeemPointsToCash({input:{amount:e.amount.toString()}})}async pointsWalletTransactions(e){const t=await this.reportService.pointsWalletTransactions(e);return t.ok?{ok:!0,data:{pointsWalletTransactions:t.data.edges.map(({cursor:a,node:r})=>({...this.transformer.transform.pointsWalletTransaction(r),cursor:a})),totalCount:t.data.totalCount,hasNextPage:t.data.pageInfo.hasNextPage,endCursor:t.data.pageInfo.endCursor??void 0}}:t}async activityRecords(e){const t=await this.reportService.activityRecords(e);return t.ok?{ok:!0,data:{activityRecords:t.data.edges.map(({cursor:a,node:r})=>({...this.transformer.transform.activityRecord(r),cursor:a})),totalCount:t.data.totalCount,hasNextPage:t.data.pageInfo.hasNextPage,endCursor:t.data.pageInfo.endCursor??void 0}}:t}async referralCode(){const e=await this.accountService.referralCode();return e.ok?{ok:!0,data:e.data??null}:e}async updateReferralCode(e){return await this.accountService.updateReferralCode({input:e})}async referrals(e){const t=await this.reportService.referrals(e);return t.ok?{ok:!0,data:{referrals:t.data.edges.map(({cursor:a,node:r})=>({...this.transformer.transform.referral(r),cursor:a})),totalCount:t.data.totalCount,hasNextPage:t.data.pageInfo.hasNextPage,endCursor:t.data.pageInfo.endCursor??void 0}}:t}async referralCommission(){const e=await this.reportService.referralCommission();return e.ok?{ok:!0,data:e.data?this.transformer.transform.referralCommission(e.data):null}:e}async uplinesByName(e){const t=await this.reportService.uplinesByName(e);return t.ok?{ok:!0,data:t.data.map(this.transformer.transform.referral)}:t}async downlinesByName(e){const t=await this.reportService.downlinesByName(e);return t.ok?{ok:!0,data:t.data.map(this.transformer.transform.referral)}:t}async pointsClubSettings(){const e=await this.accountService.pointsClubSettings();return e.ok?{ok:!0,data:e.data?this.transformer.transform.pointsClubSettings(e.data):null}:e}async messages(e){const t=await this.triggerService.messages(e);return t.ok?{ok:!0,data:{messages:t.data.edges.map(({cursor:a,node:r})=>({...this.transformer.transform.message(r),cursor:a})),totalCount:t.data.totalCount,hasNextPage:t.data.pageInfo.hasNextPage,endCursor:t.data.pageInfo.endCursor??void 0}}:t}async unreadMessagesCount(e){return await this.triggerService.unreadMessagesCount(e)}async markMessageAsRead(e){return await this.triggerService.markMessageAsRead({id:e})}async markAllMessageAsRead(){return await this.triggerService.markAllMessageAsRead()}async claimReward(e){return await this.triggerService.claimReward({id:e})}async bonuses(){const e=await this.walletService.bonuses();return e.ok?{ok:!0,data:e.data.map(this.transformer.transform.bonus)}:e}formatYmd(e){const t=m=>m.toString().padStart(2,"0"),a=e.getFullYear(),r=t(e.getMonth()+1),s=t(e.getDate());return`${a}-${r}-${s}`}async onboardingStatus(){const e=await this.portalService.onboardingStatus();return e.ok?{ok:!0,data:e.data}:e}async completeOnboarding(e){return await this.portalService.completeOnboarding({input:{favoriteGameTypes:e.favoriteGameTypes,playerExperience:e.playerExperience}})}async skipOnboarding(){return await this.portalService.skipOnboarding()}}Object.defineProperty(b,"ObjectId",{enumerable:!0,get:()=>w.ObjectId}),b.ObjectType=E,b.Sdk=Ta,Object.defineProperty(b,Symbol.toStringTag,{value:"Module"})});
|
|
1462
1466
|
//# sourceMappingURL=index.js.map
|