@opexa/portal-sdk 0.0.101 → 0.0.102

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 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 ya=Object.defineProperty;var ha=(b,w,E)=>w in b?ya(b,w,{enumerable:!0,configurable:!0,writable:!0,value:E}):b[w]=E;var c=(b,w,E)=>ha(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 ve=o`
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 ga=Object.defineProperty;var ba=(b,w,E)=>w in b?ga(b,w,{enumerable:!0,configurable:!0,writable:!0,value:E}):b[w]=E;var c=(b,w,E)=>ba(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 ve=o`
2
2
  fragment FileFragment on File {
3
3
  id
4
4
  url
@@ -120,7 +120,7 @@
120
120
  }
121
121
  }
122
122
  }
123
- `,$e={current:o`
123
+ `,Be={current:o`
124
124
  mutation EndGameSession($input: EndGameSessionInput!) {
125
125
  endGameSession(input: $input)
126
126
  }
@@ -180,6 +180,7 @@
180
180
  reference
181
181
  amount
182
182
  status
183
+ error
183
184
  withdrawalNumber
184
185
  dateTimeCreated
185
186
  dateTimeLastUpdated
@@ -192,6 +193,7 @@
192
193
  reference
193
194
  amount
194
195
  status
196
+ error
195
197
  withdrawalNumber
196
198
  recipientMobileNumber
197
199
  dateTimeCreated
@@ -205,6 +207,7 @@
205
207
  reference
206
208
  amount
207
209
  status
210
+ error
208
211
  withdrawalNumber
209
212
  dateTimeCreated
210
213
  dateTimeLastUpdated
@@ -217,6 +220,20 @@
217
220
  reference
218
221
  amount
219
222
  status
223
+ error
224
+ withdrawalNumber
225
+ dateTimeCreated
226
+ dateTimeLastUpdated
227
+ }
228
+ ... on InstapayWithdrawalRecord {
229
+ id
230
+ type
231
+ fee
232
+ netAmount
233
+ reference
234
+ amount
235
+ status
236
+ error
220
237
  withdrawalNumber
221
238
  dateTimeCreated
222
239
  dateTimeLastUpdated
@@ -303,6 +320,11 @@
303
320
  ... on MobileNumberNotVerifiedError {
304
321
  __typename
305
322
  }
323
+ }
324
+ }
325
+ `,at=o`
326
+ mutation CreateAIOInstapayWithdrawal($input: CreateAIOInstapayWithdrawalInput!) {
327
+ createAIOInstapayWithdrawal(input: $input) {
306
328
  ... on AccountNotVerifiedError {
307
329
  __typename
308
330
  }
@@ -320,11 +342,19 @@
320
342
  }
321
343
  }
322
344
  }
323
- `,at=o`
345
+ `,rt=o`
346
+ query InstapayBankList {
347
+ instapayBankList {
348
+ id
349
+ code
350
+ name
351
+ }
352
+ }
353
+ `,nt=o`
324
354
  query RemainingDailyWithdrawalsCount {
325
355
  remainingDailyWithdrawalsCount
326
356
  }
327
- `,rt=o`
357
+ `,it=o`
328
358
  query DepositRecords($after: Cursor, $first: Int, $filter: DepositRecordFilterInput) {
329
359
  member {
330
360
  depositRecords(after: $after, first: $first, filter: $filter) {
@@ -353,7 +383,7 @@
353
383
  }
354
384
  }
355
385
  }
356
- `,nt=o`
386
+ `,ot=o`
357
387
  mutation CreateGCashDeposit($input: CreateGCashDepositInput!) {
358
388
  createGCashDeposit(input: $input) {
359
389
  ... on DepositPromoMaximumAmountExceededError {
@@ -382,7 +412,7 @@
382
412
  }
383
413
  }
384
414
  }
385
- `,it=o`
415
+ `,st=o`
386
416
  mutation CreateMayaDeposit($input: CreateMayaDepositInput!) {
387
417
  createMayaDeposit(input: $input) {
388
418
  ... on DepositPromoMaximumAmountExceededError {
@@ -411,7 +441,7 @@
411
441
  }
412
442
  }
413
443
  }
414
- `,ot=o`
444
+ `,mt=o`
415
445
  mutation CreateMayaAppDeposit($input: CreateMayaAppDepositInput!) {
416
446
  createMayaAppDeposit(input: $input) {
417
447
  ... on DepositPromoMaximumAmountExceededError {
@@ -440,7 +470,7 @@
440
470
  }
441
471
  }
442
472
  }
443
- `,st=o`
473
+ `,ct=o`
444
474
  mutation CreateAIOQRPHDeposit($input: CreateAIOQRPHDepositInput!) {
445
475
  createAIOQRPHDeposit(input: $input) {
446
476
  ... on DepositPromoMaximumAmountExceededError {
@@ -469,7 +499,7 @@
469
499
  }
470
500
  }
471
501
  }
472
- `,mt=o`
502
+ `,lt=o`
473
503
  mutation CreateAIOOnlineBankDeposit($input: CreateAIOOnlineBankDepositInput!) {
474
504
  createAIOOnlineBankDeposit(input: $input) {
475
505
  ... on DepositPromoMaximumAmountExceededError {
@@ -498,7 +528,7 @@
498
528
  }
499
529
  }
500
530
  }
501
- `,ct=o`
531
+ `,dt=o`
502
532
  query Deposit($id: ObjectId!) {
503
533
  node(id: $id) {
504
534
  ... on GCashDeposit {
@@ -542,13 +572,13 @@
542
572
  }
543
573
  }
544
574
  }
545
- `,lt=o`
575
+ `,ut=o`
546
576
  query DepositsCount {
547
577
  member {
548
578
  depositsCount
549
579
  }
550
580
  }
551
- `,ut=o`
581
+ `,pt=o`
552
582
  query BetRecords($first: Int, $after: Cursor, $filter: BetRecordFilterInput) {
553
583
  member {
554
584
  betRecords(first: $first, after: $after, filter: $filter) {
@@ -589,7 +619,7 @@
589
619
  }
590
620
  }
591
621
  }
592
- `,dt=o`
622
+ `,ft=o`
593
623
  query LatestBetRecords {
594
624
  latestBetRecords {
595
625
  id
@@ -609,7 +639,7 @@
609
639
  dateTimeCreated
610
640
  }
611
641
  }
612
- `,pt=o`
642
+ `,wt=o`
613
643
  query TransactionRecords($first: Int, $after: Cursor, $filter: TransactionRecordFilter) {
614
644
  member {
615
645
  transactionRecords(first: $first, after: $after, filter: $filter) {
@@ -635,7 +665,7 @@
635
665
  }
636
666
  }
637
667
  }
638
- `,Re=o`
668
+ `,Ne=o`
639
669
  ${ve}
640
670
 
641
671
  fragment PromoFragment on Promo {
@@ -654,23 +684,23 @@
654
684
  dateTimeCreated
655
685
  dateTimeLastUpdated
656
686
  }
657
- `,ft=o`
658
- ${Re}
687
+ `,yt=o`
688
+ ${Ne}
659
689
 
660
690
  query Promos {
661
691
  promos {
662
692
  ...PromoFragment
663
693
  }
664
694
  }
665
- `,wt=o`
666
- ${Re}
695
+ `,ht=o`
696
+ ${Ne}
667
697
 
668
698
  query AvailablePromos($filter: PromoFilterInput) {
669
699
  availablePromos(filter: $filter) {
670
700
  ...PromoFragment
671
701
  }
672
702
  }
673
- `,Ue=o`
703
+ `,$e=o`
674
704
  ${ve}
675
705
 
676
706
  fragment CashbackFragment on Cashback {
@@ -689,16 +719,16 @@
689
719
  dateTimeCreated
690
720
  dateTimeLastUpdated
691
721
  }
692
- `,yt=o`
693
- ${Ue}
722
+ `,gt=o`
723
+ ${$e}
694
724
 
695
725
  query Cashbacks {
696
726
  cashbacks {
697
727
  ...CashbackFragment
698
728
  }
699
729
  }
700
- `,ht=o`
701
- ${Re}
730
+ `,bt=o`
731
+ ${Ne}
702
732
 
703
733
  query Bonus {
704
734
  bonus {
@@ -726,8 +756,8 @@
726
756
  dateTimeLastUpdated
727
757
  }
728
758
  }
729
- `,gt=o`
730
- ${Ue}
759
+ `,Et=o`
760
+ ${$e}
731
761
 
732
762
  query CashbackBonuses {
733
763
  cashbackBonuses {
@@ -741,7 +771,7 @@
741
771
  dateTimeLastUpdated
742
772
  }
743
773
  }
744
- `,bt=o`
774
+ `,At=o`
745
775
  mutation ClaimCashbackBonus($input: ClaimCashbackBonusInput!) {
746
776
  claimCashbackBonus(input: $input) {
747
777
  ... on CashbackBonusDoesNotExistError {
@@ -755,7 +785,7 @@
755
785
  dateTimeLastActive
756
786
  }
757
787
  }
758
- `;const Et=o`
788
+ `;const St=o`
759
789
  query MemberAccount {
760
790
  memberAccount: self {
761
791
  ... on MemberAccount {
@@ -779,7 +809,7 @@
779
809
  }
780
810
  }
781
811
  }
782
- `,St=o`
812
+ `,kt=o`
783
813
  ${ve}
784
814
 
785
815
  query MemberVerification {
@@ -804,7 +834,7 @@
804
834
  }
805
835
  }
806
836
  }
807
- `,At=o`
837
+ `,Ct=o`
808
838
  mutation RegisterMemberAccount(
809
839
  $input: RegisterMemberAccountInput!
810
840
  $referralCode: String
@@ -840,7 +870,7 @@
840
870
  }
841
871
  }
842
872
  }
843
- `,kt=o`
873
+ `,_t=o`
844
874
  mutation RegisterMemberAccountViaMobile(
845
875
  $input: RegisterMemberAccountViaMobileInput!
846
876
  $referralCode: String
@@ -867,7 +897,7 @@
867
897
  }
868
898
  }
869
899
  }
870
- `,Ct=o`
900
+ `,Tt=o`
871
901
  mutation RegisterMemberAccount(
872
902
  $input: RegisterMemberAccountInput_next!
873
903
  $reCAPTCHAResponse: String
@@ -899,7 +929,7 @@
899
929
  }
900
930
  }
901
931
  }
902
- `,_t=o`
932
+ `,Mt=o`
903
933
  mutation RegisterMayaMemberAccount($input: RegisterMayaMemberAccountInput!) {
904
934
  registerMayaMemberAccount(input: $input) {
905
935
  ... on AccountNameNotAvailableError {
@@ -907,7 +937,7 @@
907
937
  }
908
938
  }
909
939
  }
910
- `,Tt=o`
940
+ `,Dt=o`
911
941
  mutation UpdateMemberAccount($input: UpdateMemberAccountInput!) {
912
942
  updateMemberAccount(input: $input) {
913
943
  ... on AccountNameNotAvailableError {
@@ -933,7 +963,7 @@
933
963
  }
934
964
  }
935
965
  }
936
- `,Mt=o`
966
+ `,vt=o`
937
967
  mutation ResetPassword($input: ResetPasswordInput!, $verificationCode: String) {
938
968
  resetPassword(input: $input, verificationCode: $verificationCode) {
939
969
  ... on AccountNotFoundError {
@@ -944,11 +974,11 @@
944
974
  }
945
975
  }
946
976
  }
947
- `,Dt=o`
977
+ `,Nt=o`
948
978
  mutation DeleteMemberAccount($input: DeleteMemberAccountInput!) {
949
979
  deleteMemberAccount(input: $input)
950
980
  }
951
- `,vt=o`
981
+ `,Rt=o`
952
982
  mutation VerifyMobileNumber($input: VerifyMobileNumberInput!) {
953
983
  verifyMobileNumber(input: $input) {
954
984
  ... on InvalidSMSVerificationCodeError {
@@ -959,7 +989,7 @@
959
989
  }
960
990
  }
961
991
  }
962
- `,Rt=o`
992
+ `,It=o`
963
993
  mutation CreateMemberVerification($input: CreateMemberVerificationInput!) {
964
994
  createMemberVerification(input: $input) {
965
995
  ... on FileDoesNotExistError {
@@ -973,7 +1003,7 @@
973
1003
  }
974
1004
  }
975
1005
  }
976
- `,Nt=o`
1006
+ `,Gt=o`
977
1007
  mutation UpdateMemberVerification($input: UpdateMemberVerificationInput!) {
978
1008
  updateMemberVerification(input: $input) {
979
1009
  ... on FileDoesNotExistError {
@@ -990,7 +1020,7 @@
990
1020
  }
991
1021
  }
992
1022
  }
993
- `,It=o`
1023
+ `,Pt=o`
994
1024
  query ProfileCompletion {
995
1025
  profileCompletion {
996
1026
  completionPercentage
@@ -1001,7 +1031,7 @@
1001
1031
  accountPassword
1002
1032
  }
1003
1033
  }
1004
- `,Gt=o`
1034
+ `,Wt=o`
1005
1035
  mutation SendVerificationCode($input: SendVerificationCodeInput!) {
1006
1036
  sendVerificationCode(input: $input) {
1007
1037
  ... on InvalidPlatformError {
@@ -1012,7 +1042,7 @@
1012
1042
  }
1013
1043
  }
1014
1044
  }
1015
- `,Pt=o`
1045
+ `,xt=o`
1016
1046
  fragment DepositGatewaySettingsCoreData on DepositGatewaySettings {
1017
1047
  minimumAmount
1018
1048
  maximumAmount
@@ -1077,12 +1107,12 @@
1077
1107
  multiplier
1078
1108
  }
1079
1109
  }
1080
- `,Wt=o`
1110
+ `,Ot=o`
1081
1111
  query Platform {
1082
1112
  timezone
1083
1113
  currency
1084
1114
  }
1085
- `,xt=o`
1115
+ `,Bt=o`
1086
1116
  fragment DepositGatewaySettingsCoreData on DepositGatewaySettings {
1087
1117
  minimumAmount
1088
1118
  maximumAmount
@@ -1142,7 +1172,7 @@
1142
1172
  ...WithdrawalGatewaySettingsCoreData
1143
1173
  }
1144
1174
  }
1145
- `,Ot=o`
1175
+ `,$t=o`
1146
1176
  query MayaSession($id: ObjectId!) {
1147
1177
  mayaSession(id: $id) {
1148
1178
  id
@@ -1150,11 +1180,11 @@
1150
1180
  dateTimeCreated
1151
1181
  }
1152
1182
  }
1153
- `,$t=o`
1183
+ `,Ut=o`
1154
1184
  mutation ValidateMayaSession {
1155
1185
  validateMayaSession: validMayaSession
1156
1186
  }
1157
- `,Ut=o`
1187
+ `,qt=o`
1158
1188
  query ActivityRecords($after: Cursor, $first: Int, $filter: ActivityRecordsFilterInput) {
1159
1189
  member {
1160
1190
  activityRecords(after: $after, first: $first, filter: $filter) {
@@ -1179,11 +1209,11 @@
1179
1209
  }
1180
1210
  }
1181
1211
  }
1182
- `,Bt=o`
1212
+ `,Lt=o`
1183
1213
  query ReferralCode {
1184
1214
  referralCode
1185
1215
  }
1186
- `,qt=o`
1216
+ `,Ft=o`
1187
1217
  mutation UpdateReferralCode($input: UpdateReferralCodeInput!) {
1188
1218
  updateReferralCode(input: $input) {
1189
1219
  ... on ReferralCodeNotAvailableError {
@@ -1191,7 +1221,7 @@
1191
1221
  }
1192
1222
  }
1193
1223
  }
1194
- `,Ne=o`
1224
+ `,Re=o`
1195
1225
  fragment ReferralFragment on Referral {
1196
1226
  id
1197
1227
  upline {
@@ -1209,7 +1239,7 @@
1209
1239
  commission
1210
1240
  dateTimeCreated
1211
1241
  }
1212
- `,Ft=o`
1242
+ `,Vt=o`
1213
1243
  query Referrals($first: Int, $after: Cursor, $filter: ReferralFilterInput) {
1214
1244
  member {
1215
1245
  referrals(first: $first, after: $after, filter: $filter) {
@@ -1230,24 +1260,24 @@
1230
1260
  }
1231
1261
  }
1232
1262
 
1233
- ${Ne}
1234
- `,Lt=o`
1263
+ ${Re}
1264
+ `,Ht=o`
1235
1265
  query UplinesByName($search: String!, $first: Int) {
1236
1266
  uplinesByName(search: $search, first: $first) {
1237
1267
  ...ReferralFragment
1238
1268
  }
1239
1269
  }
1240
1270
 
1241
- ${Ne}
1242
- `,Vt=o`
1271
+ ${Re}
1272
+ `,Yt=o`
1243
1273
  query DownlinesByName($search: String!, $first: Int) {
1244
1274
  downlinesByName(search: $search, first: $first) {
1245
1275
  ...ReferralFragment
1246
1276
  }
1247
1277
  }
1248
1278
 
1249
- ${Ne}
1250
- `,Ht=o`
1279
+ ${Re}
1280
+ `,Qt=o`
1251
1281
  query ReferralCommission {
1252
1282
  member {
1253
1283
  referralCommission {
@@ -1266,13 +1296,13 @@
1266
1296
  }
1267
1297
  }
1268
1298
  }
1269
- `,Yt=o`
1299
+ `,jt=o`
1270
1300
  query PointsClubSettings {
1271
1301
  pointsClubSettings {
1272
1302
  multiplier
1273
1303
  }
1274
1304
  }
1275
- `,Qt=o`
1305
+ `,Kt=o`
1276
1306
  query Messages($first: Int, $after: Cursor, $filter: MessageFilterInput) {
1277
1307
  messages(first: $first, after: $after, filter: $filter) {
1278
1308
  edges {
@@ -1300,19 +1330,19 @@
1300
1330
  }
1301
1331
  }
1302
1332
  }
1303
- `,jt=o`
1333
+ `,zt=o`
1304
1334
  query UnreadMessagesCount($filter: MessageFilterInput) {
1305
1335
  messages(filter: $filter) {
1306
1336
  totalCount
1307
1337
  }
1308
1338
  }
1309
- `,Kt=o`
1339
+ `,Jt=o`
1310
1340
  mutation MarkMessageAsRead($id: ObjectId!) {
1311
1341
  markMessageAsRead(id: $id)
1312
1342
  }
1313
- `,zt=o`
1343
+ `,Xt=o`
1314
1344
  mutation MarkAllMessageAsRead {
1315
1345
  markAllMessageAsRead
1316
1346
  }
1317
- `;function l(i){return{name:i,message:{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"}[i]}}class Jt{constructor(e){c(this,"client");this.client=e}async memberAccount(){const e=await this.client.request(Et);return e.ok?{ok:!0,data:e.data.memberAccount}:e}async registerMemberAccount(e){const t=await this.client.request(At,e);return t.ok?t.data.registerMemberAccount?{ok:!1,error:l(t.data.registerMemberAccount.__typename)}:{ok:!0}:t}async registerMemberAccountViaMobile(e){const t=await this.client.request(kt,e);return t.ok?t.data.registerMemberAccountViaMobile?{ok:!1,error:l(t.data.registerMemberAccountViaMobile.__typename)}:{ok:!0}:t}async registerMemberAccount__next(e){const t=await this.client.request(Ct,e);return t.ok?t.data.registerMemberAccount?{ok:!1,error:l(t.data.registerMemberAccount.__typename)}:{ok:!0}:t}async updateMemberAccount(e){const t=await this.client.request(Tt,e);return t.ok?t.data.updateMemberAccount?{ok:!1,error:l(t.data.updateMemberAccount.__typename)}:{ok:!0}:t}async deleteMemberAccount(e){const t=await this.client.request(Dt,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(Mt,e);return t.ok?t.data.resetPassword?{ok:!1,error:l(t.data.resetPassword.__typename)}:{ok:!0}:t}async profileCompletion(){const e=await this.client.request(It);return e.ok?{ok:!0,data:e.data.profileCompletion}:e}async platform(){return await this.client.request(Pt)}async sendVerificationCode(e){const t=await this.client.request(Gt,e);return t.ok?t.data.sendVerificationCode?{ok:!1,error:l(t.data.sendVerificationCode.__typename)}:{ok:!0}:t}async paymentSettings(){return await this.client.request(xt)}async verifyMobileNumber(e){const t=await this.client.request(vt,e);return t.ok?t.data.verifyMobileNumber?{ok:!1,error:l(t.data.verifyMobileNumber.__typename)}:{ok:!0}:t}async createMemberVerification(e){const t=await this.client.request(Rt,e);return t.ok?t.data.createMemberVerification?{ok:!1,error:l(t.data.createMemberVerification.__typename)}:{ok:!0}:t}async updateMemberVerification(e){const t=await this.client.request(Nt,e);return t.ok?t.data.updateMemberVerification?{ok:!1,error:l(t.data.updateMemberVerification.__typename)}:{ok:!0}:t}async memberVerification(){const e=await this.client.request(St);return e.ok?{ok:!0,data:e.data.memberAccount.verification}:e}async announcements(e){const t=await this.client.request(ze,e);return t.ok?{ok:!0,data:t.data.announcements}:t}async registerMayaMemberAccount(e){const t=await this.client.request(_t,e);return t.ok?t.data.registerMayaMemberAccount?{ok:!1,error:l(t.data.registerMayaMemberAccount.__typename)}:{ok:!0}:t}async referralCode(){const e=await this.client.request(Bt);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:l(t.data.updateReferralCode.__typename)}:{ok:!0}:t}async pointsClubSettings(){const e=await this.client.request(Yt);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 Xt{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}`);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:l("AccountBlacklistedError")}:{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:l("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:l("AccountBlacklistedError")}:a.status===403||a.status===401?{ok:!1,error:l("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:l(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 Zt{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,u,p,f,y,d,M,D,v,R,N,I,g,G,P,C,W,x,O,$,_,U;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=(p=e==null?void 0:e.filter)==null?void 0:p.type)!=null&&f.in&&t.set("filter[type][in]",e.filter.type.in.join(",")),(d=(y=e==null?void 0:e.filter)==null?void 0:y.type)!=null&&d.notIn&&t.set("filter[type][nin]",e.filter.type.notIn.join(",")),(D=(M=e==null?void 0:e.filter)==null?void 0:M.provider)!=null&&D.equal&&t.set("filter[provider][eq]",e.filter.provider.equal),(R=(v=e==null?void 0:e.filter)==null?void 0:v.provider)!=null&&R.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()),(x=(W=e==null?void 0:e.filter)==null?void 0:W.tags)!=null&&x.notEqual&&t.set("filter[tags][neq]",e.filter.tags.notEqual.toLowerCase()),($=(O=e==null?void 0:e.filter)==null?void 0:O.tags)!=null&&$.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(","));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 ea{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:l(t.data.uploadPrivateImageFile.__typename)}:{ok:!0}:t}}class ta{constructor(e){c(this,"client");this.client=e}async gameSession(e){const t=await this.client.request(xe.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(Oe,e);return t.ok?t.data.createGameSession?{ok:!1,error:l(t.data.createGameSession.__typename)}:{ok:!0}:t}async endGameSession(e){const t=await this.client.request($e.legacy,e);return t.ok?t.data.endGameSession?{ok:!1,error:{name:"UnknownError",message:"Something went wrong."}}:{ok:!0}:t}}class aa{constructor(e){c(this,"client");this.client=e}async latestBetRecords(){const e=await this.client.request(dt);return e.ok?{ok:!0,data:e.data.latestBetRecords}:e}async platform(){const e=await this.client.request(Wt);return e.ok?{ok:!0,data:e.data}:e}}class ra{constructor(e){c(this,"client");this.client=e}async betRecords(e){const t=await this.client.request(ut,e);return t.ok?{ok:t.ok,data:t.data.member.betRecords}:t}async transactionRecords(e){const t=await this.client.request(pt,e);return t.ok?{ok:t.ok,data:t.data.member.transactionRecords}:t}async withdrawalRecords(e){const t=await this.client.request(Je,e);return t.ok?{ok:t.ok,data:t.data.member.withdrawalRecords}:t}async depositRecords(e){const t=await this.client.request(rt,e);return t.ok?{ok:t.ok,data:t.data.member.depositRecords}:t}async depositsCount(){const e=await this.client.request(lt);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(Ut,e);return t.ok?{ok:t.ok,data:t.data.member.activityRecords}:t}async referrals(e){const t=await this.client.request(Ft,e);return t.ok?{ok:t.ok,data:t.data.member.referrals}:t}async referralCommission(){const e=await this.client.request(Ht);return e.ok?{ok:e.ok,data:e.data.member.referralCommission}:e}async uplinesByName(e){const t=await this.client.request(Lt,e);return t.ok?{ok:t.ok,data:t.data.uplinesByName}:t}async downlinesByName(e){const t=await this.client.request(Vt,e);return t.ok?{ok:t.ok,data:t.data.downlinesByName}:t}}class na{constructor(e){c(this,"url");this.url=e.url}gameThumbnails(e){return[`${this.url}/images/${e.provider.toLowerCase()}/thumbnail-${e.id}.webp`,`${this.url}/images/${e.provider.toLowerCase()}/thumbnail-${e.provider.toLowerCase()}.webp`]}}class ia{constructor(e){c(this,"client");this.client=e}async messages(e){const t=await this.client.request(Qt,e);return t.ok?{ok:t.ok,data:t.data.messages}:t}async unreadMessagesCount(e){const t=await this.client.request(jt,{...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(Kt,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(zt);return e.ok?e.data.markAllMessageAsRead?{ok:!0}:{ok:!1,error:{name:"UnknownError",message:"Something went wrong."}}:e}}class oa{constructor(e){c(this,"client");this.client=e}async promos(){const e=await this.client.request(ft);return e.ok?{ok:e.ok,data:e.data.promos}:e}async cashbacks(){const e=await this.client.request(yt);return e.ok?{ok:e.ok,data:e.data.cashbacks}:e}async availablePromos(e){const t=await this.client.request(wt,e);return t.ok?{ok:t.ok,data:t.data.availablePromos}:t}async cashbackBonuses(){const e=await this.client.request(gt);return e.ok?{ok:e.ok,data:e.data.cashbackBonuses}:e}async claimCashbackBonus(e){const t=await this.client.request(bt,e);return t.ok?t.data.claimCashbackBonus?{ok:!1,error:l(t.data.claimCashbackBonus.__typename)}:{ok:!0}:{ok:t.ok,error:t.error}}async bonus(){const e=await this.client.request(ht);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(ct,e);return t.ok?{ok:t.ok,data:t.data.node}:t}async createGCashDeposit(e){const t=await this.client.request(nt,e);return t.ok?t.data.createGCashDeposit?{ok:!1,error:l(t.data.createGCashDeposit.__typename)}:{ok:!0}:t}async createMayaDeposit(e){const t=await this.client.request(it,e);return t.ok?t.data.createMayaDeposit?{ok:!1,error:l(t.data.createMayaDeposit.__typename)}:{ok:!0}:t}async createAIOQRPHDeposit(e){const t=await this.client.request(st,e);return t.ok?t.data.createAIOQRPHDeposit?{ok:!1,error:l(t.data.createAIOQRPHDeposit.__typename)}:{ok:!0}:t}async createAIOOnlineBankDeposit(e){const t=await this.client.request(mt,e);return t.ok?t.data.createAIOOnlineBankDeposit?{ok:!1,error:l(t.data.createAIOOnlineBankDeposit.__typename)}:{ok:!0}:t}async createMayaAppDeposit(e){const t=await this.client.request(ot,e);return t.ok?t.data.createMayaAppDeposit?{ok:!1,error:l(t.data.createMayaAppDeposit.__typename)}:{ok:!0}:t}async createGCashWithdrawal(e){const t=await this.client.request(Xe,e);return t.ok?t.data.createGCashWithdrawal?{ok:!1,error:l(t.data.createGCashWithdrawal.__typename)}:{ok:!0}:t}async createMayaWithdrawal(e){const t=await this.client.request(Ze,e);return t.ok?t.data.createMayaWithdrawal?{ok:!1,error:l(t.data.createMayaWithdrawal.__typename)}:{ok:!0}:t}async createMayaAppWithdrawal(e){const t=await this.client.request(et,e);return t.ok?t.data.createMayaAppWithdrawal?{ok:!1,error:l(t.data.createMayaAppWithdrawal.__typename)}:{ok:!0}:t}async createBankWithdrawal(e){const t=await this.client.request(tt,e);return t.ok?t.data.createBankWithdrawal?{ok:!1,error:l(t.data.createBankWithdrawal.__typename)}:{ok:!0}:t}async remainingDailyWithdrawalsCount(){const e=await this.client.request(at);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:l(t.data.redeemPointsToCash.__typename)}:{ok:!0}:t}async mayaSession(e){const t=await this.client.request(Ot,e);return t.ok?{ok:t.ok,data:t.data.mayaSession}:t}async gameSession(e){const t=await this.client.request(xe.current,e);return t.ok?{ok:!0,data:t.data.node}:t}async createGameSession(e){const t=await this.client.request(Oe,e);return t.ok?t.data.createGameSession?{ok:!1,error:l(t.data.createGameSession.__typename)}:{ok:!0}:t}async endGameSession(e){const t=await this.client.request($e.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($t);return e.ok?e.data.validateMayaSession?{ok:!0}:{ok:!1,error:{name:"UnknownError",message:"Something went wrong."}}:e}}function Ge(i){return new Date(i.getTime())}function B(i,e){const t=Ge(i);return t.setMinutes(t.getMinutes()+e),t}function Pe(i,e){return i.getTime()>e.getTime()}class sa{constructor(e){c(this,"config");c(this,"cache");this.cache={},this.config={cacheTime:5,...e}}set(e,t){const a=B(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 ma(i,e,t){return i<e?e:i>t?t:i}function We(i){return Object.prototype.toString.call(i)==="[object Object]"&&Object(i)===i}function ca(i){const e=[];function t(a,r=[]){for(const s in a){const m=a[s];We(m)?t(m,[...r,s]):Array.isArray(m)?t(la(m),[...r,s]):e.push({key:[...r,s],value:m})}}return t(i),e}function la(i){return i.reduce((e,t,a)=>(e[a]=t,e),{})}class q{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=await this.runMiddlewares(new Request(this.url,{...this.options,body:a,headers:r,method:"POST"}));return await this.exec(s)}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 p=await fetch(e);if(!p.ok)return{ok:!1,error:h(p.status)};const f=await p.json(),y=f.data,d=(t=f.errors)==null?void 0:t.at(0);return d?((a=d.extensions)==null?void 0:a.code)==="FORBIDDEN"||((r=d.extensions)==null?void 0:r.code)==="ACCESS_TOKEN_EXPIRED"?{ok:!1,error:h(403,d.message)}:((s=d.extensions)==null?void 0:s.code)==="UNAUTHORIZED"?{ok:!1,error:h(401,d.message)}:((m=d.extensions)==null?void 0:m.code)==="BAD_USER_INPUT"||((u=d.extensions)==null?void 0:u.code)==="BAD_REQUEST"?{ok:!1,error:h(400,d.message)}:{ok:!1,error:h(500,d.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=ca(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 ua(i){return i==="INR"?"en-IN":i==="MYR"?"en-MY":i==="IDR"?"en-ID":i==="USD"?"en-US":"en-PH"}function da(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=da(e);return i.startsWith(t)?i:i.startsWith(t.substring(1))?`+${i}`:i.startsWith("0")?`${t}${i.substring(1)}`:`${t}${i}`}async function S(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 Be{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 F(i,e){const t=Ge(i);return t.setDate(t.getDate()+e),t}function qe(i){return new Promise(e=>{setTimeout(e,i)})}function Fe(i,e){const{until:t,interval:a=1e3,maxAttempt:r=3}=e;async function s(m,u){const p=u??r,f=await i(...m);return t(f)?f:p>1?(await qe(a*((r-p)/2)),s(m,p-1)):f}return async(...m)=>await s(m)}function L(i,e){const t=Ge(i);return t.setMinutes(t.getMinutes()-e),t}class pa{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 Be({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 Fe(()=>this.walletService.mayaSession({id:e.sessionId}),{until:y=>{var d;return y.ok&&((d=y.data)==null?void 0:d.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 p=await Fe(()=>this.authService.createSession(e),{until:y=>y.ok,interval:1e3,maxAttempt:5})();if(!p.ok)return p;const f=new Date;return window.localStorage.setItem(this.storageKey,JSON.stringify({...p.data,accessTokenExpiresAt:B(f,8).getTime(),refreshTokenExpiresAt:L(F(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:B(m,8).getTime(),refreshTokenExpiresAt:L(F(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:B(m,8).getTime(),refreshTokenExpiresAt:L(F(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:B(a,8).getTime(),refreshTokenExpiresAt:L(F(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:B(a,8).getTime(),refreshTokenExpiresAt:L(F(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:B(a,8).getTime(),refreshTokenExpiresAt:L(F(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 A(i){const e={};for(const t in i){const a=i[t];if(a!==null&&a!==void 0){if(We(a)){e[t]=A(a);continue}if(Array.isArray(a)){e[t]=a.map(r=>We(r)?A(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 fa{constructor(e){c(this,"staticService");const t=(e==null?void 0:e.environment)==="development";this.staticService=new na({url:t?"https://static.development.opexa.io":"https://static.opexa.io"})}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)}}site(e){const t={id:e.id,name:e.name,logo:e.logo??void 0,fields:e.config.fields};return A(t)}platform(e){var t,a,r,s,m,u,p,f,y,d,M,D,v,R,N,I,g,G,P,C,W,x,O,$,_,U,k,V,H,Y,Q,j,K,z,J,X,Z,ee,te,ae,re,ne,ie,oe,se,me,ce,le,ue,de,pe,fe,we,ye,he,ge,be,Ee,Se,Ae,ke,Ce,_e,Te,Me,De,Le;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:((p=e.gcashDepositGatewaySettings)==null?void 0:p.androidEnabled)??!1,iosEnabled:((f=e.gcashDepositGatewaySettings)==null?void 0:f.iosEnabled)??!1,webEnabled:((y=e.gcashDepositGatewaySettings)==null?void 0:y.webEnabled)??!1,mobileWebEnabled:((d=e.gcashDepositGatewaySettings)==null?void 0:d.mobileWebEnabled)??!1,minimumAmount:n((M=e.gcashDepositGatewaySettings)==null?void 0:M.minimumAmount),maximumAmount:n((D=e.gcashDepositGatewaySettings)==null?void 0:D.maximumAmount)},maya:{androidEnabled:((v=e.mayaDepositGatewaySettings)==null?void 0:v.androidEnabled)??!1,iosEnabled:((R=e.mayaDepositGatewaySettings)==null?void 0:R.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:((W=e.mayaAppDepositGatewaySettings)==null?void 0:W.webEnabled)??!1,mobileWebEnabled:((x=e.mayaAppDepositGatewaySettings)==null?void 0:x.mobileWebEnabled)??!1,minimumAmount:n((O=e.mayaAppDepositGatewaySettings)==null?void 0:O.minimumAmount),maximumAmount:n(($=e.mayaAppDepositGatewaySettings)==null?void 0:$.maximumAmount)},onlineBank:{androidEnabled:((_=e.onlineBankDepositGatewaySettings)==null?void 0:_.androidEnabled)??!1,iosEnabled:((U=e.onlineBankDepositGatewaySettings)==null?void 0:U.iosEnabled)??!1,webEnabled:((k=e.onlineBankDepositGatewaySettings)==null?void 0:k.webEnabled)??!1,mobileWebEnabled:((V=e.onlineBankDepositGatewaySettings)==null?void 0:V.mobileWebEnabled)??!1,minimumAmount:n((H=e.onlineBankDepositGatewaySettings)==null?void 0:H.minimumAmount),maximumAmount:n((Y=e.onlineBankDepositGatewaySettings)==null?void 0:Y.maximumAmount)},qrph:{androidEnabled:((Q=e.qrphDepositGatewaySettings)==null?void 0:Q.androidEnabled)??!1,iosEnabled:((j=e.qrphDepositGatewaySettings)==null?void 0:j.iosEnabled)??!1,webEnabled:((K=e.qrphDepositGatewaySettings)==null?void 0:K.webEnabled)??!1,mobileWebEnabled:((z=e.qrphDepositGatewaySettings)==null?void 0:z.mobileWebEnabled)??!1,minimumAmount:n((J=e.qrphDepositGatewaySettings)==null?void 0:J.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:((ie=e.gcashWithdrawalGatewaySettings)==null?void 0:ie.androidEnabled)??!1,iosEnabled:((oe=e.gcashWithdrawalGatewaySettings)==null?void 0:oe.iosEnabled)??!1,webEnabled:((se=e.gcashWithdrawalGatewaySettings)==null?void 0:se.webEnabled)??!1,mobileWebEnabled:((me=e.gcashWithdrawalGatewaySettings)==null?void 0:me.mobileWebEnabled)??!1,minimumAmount:n((ce=e.gcashWithdrawalGatewaySettings)==null?void 0:ce.minimumAmount),maximumAmount:n((le=e.gcashWithdrawalGatewaySettings)==null?void 0:le.maximumAmount,1e6)},maya:{androidEnabled:((ue=e.mayaWithdrawalGatewaySettings)==null?void 0:ue.androidEnabled)??!1,iosEnabled:((de=e.mayaWithdrawalGatewaySettings)==null?void 0:de.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((Se=e.mayaAppWithdrawalGatewaySettings)==null?void 0:Se.minimumAmount),maximumAmount:n((Ae=e.mayaAppWithdrawalGatewaySettings)==null?void 0:Ae.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((De=e.instapayWithdrawalGatewaySettings)==null?void 0:De.maximumAmount,1e6)}}},pointsClubSettings:{multiplier:n((Le=e.pointsClubSettings)==null?void 0:Le.multiplier,0)}}}platform__next(e){return{currency:e.currency,timezone:e.timezone,locale:ua(e.currency)}}pointsClubSettings(e){return{multiplier:n(e.multiplier,0)}}paymentSettings(e){var t,a,r,s,m,u,p,f,y,d,M,D,v,R,N,I,g,G,P,C,W,x,O,$,_,U,k,V,H,Y,Q,j,K,z,J,X,Z,ee,te,ae,re,ne,ie,oe,se,me,ce,le,ue,de,pe,fe,we,ye,he,ge,be,Ee,Se,Ae,ke,Ce,_e,Te,Me,De;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:((p=e.gcashDepositGatewaySettings)==null?void 0:p.androidEnabled)??!1,iosEnabled:((f=e.gcashDepositGatewaySettings)==null?void 0:f.iosEnabled)??!1,webEnabled:((y=e.gcashDepositGatewaySettings)==null?void 0:y.webEnabled)??!1,mobileWebEnabled:((d=e.gcashDepositGatewaySettings)==null?void 0:d.mobileWebEnabled)??!1,minimumAmount:n((M=e.gcashDepositGatewaySettings)==null?void 0:M.minimumAmount),maximumAmount:n((D=e.gcashDepositGatewaySettings)==null?void 0:D.maximumAmount)},maya:{androidEnabled:((v=e.mayaDepositGatewaySettings)==null?void 0:v.androidEnabled)??!1,iosEnabled:((R=e.mayaDepositGatewaySettings)==null?void 0:R.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:((W=e.mayaAppDepositGatewaySettings)==null?void 0:W.webEnabled)??!1,mobileWebEnabled:((x=e.mayaAppDepositGatewaySettings)==null?void 0:x.mobileWebEnabled)??!1,minimumAmount:n((O=e.mayaAppDepositGatewaySettings)==null?void 0:O.minimumAmount),maximumAmount:n(($=e.mayaAppDepositGatewaySettings)==null?void 0:$.maximumAmount)},onlineBank:{androidEnabled:((_=e.onlineBankDepositGatewaySettings)==null?void 0:_.androidEnabled)??!1,iosEnabled:((U=e.onlineBankDepositGatewaySettings)==null?void 0:U.iosEnabled)??!1,webEnabled:((k=e.onlineBankDepositGatewaySettings)==null?void 0:k.webEnabled)??!1,mobileWebEnabled:((V=e.onlineBankDepositGatewaySettings)==null?void 0:V.mobileWebEnabled)??!1,minimumAmount:n((H=e.onlineBankDepositGatewaySettings)==null?void 0:H.minimumAmount),maximumAmount:n((Y=e.onlineBankDepositGatewaySettings)==null?void 0:Y.maximumAmount)},qrph:{androidEnabled:((Q=e.qrphDepositGatewaySettings)==null?void 0:Q.androidEnabled)??!1,iosEnabled:((j=e.qrphDepositGatewaySettings)==null?void 0:j.iosEnabled)??!1,webEnabled:((K=e.qrphDepositGatewaySettings)==null?void 0:K.webEnabled)??!1,mobileWebEnabled:((z=e.qrphDepositGatewaySettings)==null?void 0:z.mobileWebEnabled)??!1,minimumAmount:n((J=e.qrphDepositGatewaySettings)==null?void 0:J.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:((ie=e.gcashWithdrawalGatewaySettings)==null?void 0:ie.androidEnabled)??!1,iosEnabled:((oe=e.gcashWithdrawalGatewaySettings)==null?void 0:oe.iosEnabled)??!1,webEnabled:((se=e.gcashWithdrawalGatewaySettings)==null?void 0:se.webEnabled)??!1,mobileWebEnabled:((me=e.gcashWithdrawalGatewaySettings)==null?void 0:me.mobileWebEnabled)??!1,minimumAmount:n((ce=e.gcashWithdrawalGatewaySettings)==null?void 0:ce.minimumAmount),maximumAmount:n((le=e.gcashWithdrawalGatewaySettings)==null?void 0:le.maximumAmount,1e6)},maya:{androidEnabled:((ue=e.mayaWithdrawalGatewaySettings)==null?void 0:ue.androidEnabled)??!1,iosEnabled:((de=e.mayaWithdrawalGatewaySettings)==null?void 0:de.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((Se=e.mayaAppWithdrawalGatewaySettings)==null?void 0:Se.minimumAmount),maximumAmount:n((Ae=e.mayaAppWithdrawalGatewaySettings)==null?void 0:Ae.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((De=e.instapayWithdrawalGatewaySettings)==null?void 0:De.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 A(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,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 A(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 A(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)};return A(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:{name:e.game.name,type:e.game.type,images:this.staticService.gameThumbnails(e.game),provider:e.game.provider},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 A(t)}latestBetRecord(e){return{id:e.id,member:e.member,game:{name:e.game.name,type:e.game.type,images:this.staticService.gameThumbnails(e.game),provider:e.game.provider},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 A(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 A(t)}promo(e){return{id:e.id,type:e.type,name:e.name,status:e.status,description:e.description,banner:this.file(e.banner),maximumBonusAmount:n(e.maximumBonusAmount),minimumBonusAmount:n(e.minimumBonusAmount),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:this.file(e.banner),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 A(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 A(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 A(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)}}}class wa{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,u=s==="production";this.transformer=new fa({environment:s}),this.logger=new Be({enabled:m??!1});const p=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",d=u?"https://account.opexa.io/graphql":"https://account.development.opexa.io/graphql",M=u?"https://portal.opexa.io/graphql":"https://portal.development.opexa.io/graphql",D=u?"https://file.opexa.io/graphql":"https://file.development.opexa.io/graphql",v=u?"https://game.opexa.io/graphql":"https://game.development.opexa.io/graphql",R=u?"https://trigger.opexa.io/graphql":"https://trigger.development.opexa.io/graphql",N="https://portal-api.opexacms.io/v1",I=new Zt({url:N,site:t,platform:a}),g={middlewares:[this.authMiddleware],fetchOptions:{headers:{Role:"MEMBER","Platform-Code":r}}},G=new ta(new q(v,g)),P=new ea(new q(D,g)),C=new oa(new q(f,g)),W=new Jt(new q(d,g)),x=new ra(new q(y,g)),O=new aa(new q(M,g)),$=new ia(new q(R,g)),_=new Xt({url:p,platform:r}),U=new pa({logs:m,authService:_,walletService:C});this.authService=_,this.gameService=G,this.fileService=P,this.walletService=C,this.accountService=W,this.reportService=x,this.portalService=O,this.triggerService=$,this.sessionManager=U,this.cmsPortalService=I,this.cache=new sa}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 S(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});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 S(e.secretAnswer)});default:return{ok:!1,error:{name:"HttpBadRequest",message:"Invalid input 'type'"}}}}async signOut(){await this.sessionManager.destroy()}watchSession(e){const t=ma(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:e.dateOfBirth.toISOString(),password:await S(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,mobileNumber:T(e.mobileNumber,await this.locale)},referralCode:e.referralCode,reCAPTCHAResponse:e.reCAPTCHAResponse,verificationCode:e.verificationCode});return r.ok?{ok:!0,data:{id:t}}:r}const a=await this.accountService.registerMemberAccount__next({input:{id:t,name:e.name,password:await S(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 S(e.password),domain:e.domain}})}async updateAccount(e,t){return await this.accountService.updateMemberAccount({input:{id:e,data:{...t,password:t.password?await S(t.password):void 0,transactionPassword:t.transactionPassword?await S(t.transactionPassword):void 0,...t.mobileNumber&&{mobileNumber:T(t.mobileNumber,await this.locale)},secretAnswer:t.secretAnswer?await S(t.secretAnswer):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 S(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 S(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 S(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 S(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 S(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 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}}}});return t.ok?{ok:!0,data:{betRecords:t.data.edges.map(({cursor:a,node:r})=>({...this.transformer.transform.betRecord(r),cursor:a})),totalCount:t.data.totalCount,endCursor:t.data.pageInfo.endCursor??void 0,hasNextPage:t.data.pageInfo.hasNextPage}}:t}async latestBetRecords(){const e=await this.portalService.latestBetRecords();return e.ok?{ok:!0,data:e.data.map(this.transformer.transform.latestBetRecord)}:e}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 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 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(d=>d.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,p=["RTG","DARWIN","DRBINGO","MEGABALL","EVOLUTION","EVOLUTION_NETENT","EVOLUTION_REDTIGER"].includes(s)?await this.walletService.createGameSession({input:{id:t,game:m}}):await this.gameService.createGameSession({input:{id:t,game:m}});return p.ok?{ok:!0,data:{id:t}}:p}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()}}Object.defineProperty(b,"ObjectId",{enumerable:!0,get:()=>w.ObjectId}),b.ObjectType=E,b.Sdk=wa,Object.defineProperty(b,Symbol.toStringTag,{value:"Module"})});
1347
+ `;function l(i){return{name:i,message:{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"}[i]}}class Zt{constructor(e){c(this,"client");this.client=e}async memberAccount(){const e=await this.client.request(St);return e.ok?{ok:!0,data:e.data.memberAccount}:e}async registerMemberAccount(e){const t=await this.client.request(Ct,e);return t.ok?t.data.registerMemberAccount?{ok:!1,error:l(t.data.registerMemberAccount.__typename)}:{ok:!0}:t}async registerMemberAccountViaMobile(e){const t=await this.client.request(_t,e);return t.ok?t.data.registerMemberAccountViaMobile?{ok:!1,error:l(t.data.registerMemberAccountViaMobile.__typename)}:{ok:!0}:t}async registerMemberAccount__next(e){const t=await this.client.request(Tt,e);return t.ok?t.data.registerMemberAccount?{ok:!1,error:l(t.data.registerMemberAccount.__typename)}:{ok:!0}:t}async updateMemberAccount(e){const t=await this.client.request(Dt,e);return t.ok?t.data.updateMemberAccount?{ok:!1,error:l(t.data.updateMemberAccount.__typename)}:{ok:!0}:t}async deleteMemberAccount(e){const t=await this.client.request(Nt,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(vt,e);return t.ok?t.data.resetPassword?{ok:!1,error:l(t.data.resetPassword.__typename)}:{ok:!0}:t}async profileCompletion(){const e=await this.client.request(Pt);return e.ok?{ok:!0,data:e.data.profileCompletion}:e}async platform(){return await this.client.request(xt)}async sendVerificationCode(e){const t=await this.client.request(Wt,e);return t.ok?t.data.sendVerificationCode?{ok:!1,error:l(t.data.sendVerificationCode.__typename)}:{ok:!0}:t}async paymentSettings(){return await this.client.request(Bt)}async verifyMobileNumber(e){const t=await this.client.request(Rt,e);return t.ok?t.data.verifyMobileNumber?{ok:!1,error:l(t.data.verifyMobileNumber.__typename)}:{ok:!0}:t}async createMemberVerification(e){const t=await this.client.request(It,e);return t.ok?t.data.createMemberVerification?{ok:!1,error:l(t.data.createMemberVerification.__typename)}:{ok:!0}:t}async updateMemberVerification(e){const t=await this.client.request(Gt,e);return t.ok?t.data.updateMemberVerification?{ok:!1,error:l(t.data.updateMemberVerification.__typename)}:{ok:!0}:t}async memberVerification(){const e=await this.client.request(kt);return e.ok?{ok:!0,data:e.data.memberAccount.verification}:e}async announcements(e){const t=await this.client.request(ze,e);return t.ok?{ok:!0,data:t.data.announcements}:t}async registerMayaMemberAccount(e){const t=await this.client.request(Mt,e);return t.ok?t.data.registerMayaMemberAccount?{ok:!1,error:l(t.data.registerMayaMemberAccount.__typename)}:{ok:!0}:t}async referralCode(){const e=await this.client.request(Lt);return e.ok?{ok:!0,data:e.data.referralCode}:e}async updateReferralCode(e){const t=await this.client.request(Ft,e);return t.ok?t.data.updateReferralCode?{ok:!1,error:l(t.data.updateReferralCode.__typename)}:{ok:!0}:t}async pointsClubSettings(){const e=await this.client.request(jt);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 ea{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}`);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:l("AccountBlacklistedError")}:{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:l("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:l("AccountBlacklistedError")}:a.status===403||a.status===401?{ok:!1,error:l("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:l(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 ta{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,p,f,y,u,M,D,v,N,R,I,g,G,P,C,W,x,O,B,_,$;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=(p=e==null?void 0:e.filter)==null?void 0:p.type)!=null&&f.in&&t.set("filter[type][in]",e.filter.type.in.join(",")),(u=(y=e==null?void 0:e.filter)==null?void 0:y.type)!=null&&u.notIn&&t.set("filter[type][nin]",e.filter.type.notIn.join(",")),(D=(M=e==null?void 0:e.filter)==null?void 0:M.provider)!=null&&D.equal&&t.set("filter[provider][eq]",e.filter.provider.equal),(N=(v=e==null?void 0:e.filter)==null?void 0:v.provider)!=null&&N.notEqual&&t.set("filter[provider][neq]",e.filter.provider.notEqual),(I=(R=e==null?void 0:e.filter)==null?void 0:R.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()),(x=(W=e==null?void 0:e.filter)==null?void 0:W.tags)!=null&&x.notEqual&&t.set("filter[tags][neq]",e.filter.tags.notEqual.toLowerCase()),(B=(O=e==null?void 0:e.filter)==null?void 0:O.tags)!=null&&B.in&&t.set("filter[tags][in]",e.filter.tags.in.map(k=>k.toLowerCase()).join(",")),($=(_=e==null?void 0:e.filter)==null?void 0:_.tags)!=null&&$.notIn&&t.set("filter[tags][nin]",e.filter.tags.notIn.map(k=>k.toLowerCase()).join(","));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 aa{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:l(t.data.uploadPrivateImageFile.__typename)}:{ok:!0}:t}}class ra{constructor(e){c(this,"client");this.client=e}async gameSession(e){const t=await this.client.request(xe.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(Oe,e);return t.ok?t.data.createGameSession?{ok:!1,error:l(t.data.createGameSession.__typename)}:{ok:!0}:t}async endGameSession(e){const t=await this.client.request(Be.legacy,e);return t.ok?t.data.endGameSession?{ok:!1,error:{name:"UnknownError",message:"Something went wrong."}}:{ok:!0}:t}}class na{constructor(e){c(this,"client");this.client=e}async latestBetRecords(){const e=await this.client.request(ft);return e.ok?{ok:!0,data:e.data.latestBetRecords}:e}async platform(){const e=await this.client.request(Ot);return e.ok?{ok:!0,data:e.data}:e}}class ia{constructor(e){c(this,"client");this.client=e}async betRecords(e){const t=await this.client.request(pt,e);return t.ok?{ok:t.ok,data:t.data.member.betRecords}:t}async transactionRecords(e){const t=await this.client.request(wt,e);return t.ok?{ok:t.ok,data:t.data.member.transactionRecords}:t}async withdrawalRecords(e){const t=await this.client.request(Je,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(ut);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(qt,e);return t.ok?{ok:t.ok,data:t.data.member.activityRecords}:t}async referrals(e){const t=await this.client.request(Vt,e);return t.ok?{ok:t.ok,data:t.data.member.referrals}:t}async referralCommission(){const e=await this.client.request(Qt);return e.ok?{ok:e.ok,data:e.data.member.referralCommission}:e}async uplinesByName(e){const t=await this.client.request(Ht,e);return t.ok?{ok:t.ok,data:t.data.uplinesByName}:t}async downlinesByName(e){const t=await this.client.request(Yt,e);return t.ok?{ok:t.ok,data:t.data.downlinesByName}:t}}class oa{constructor(e){c(this,"url");this.url=e.url}gameThumbnails(e){return[`${this.url}/images/${e.provider.toLowerCase()}/thumbnail-${e.id}.webp`,`${this.url}/images/${e.provider.toLowerCase()}/thumbnail-${e.provider.toLowerCase()}.webp`]}}class sa{constructor(e){c(this,"client");this.client=e}async messages(e){const t=await this.client.request(Kt,e);return t.ok?{ok:t.ok,data:t.data.messages}:t}async unreadMessagesCount(e){const t=await this.client.request(zt,{...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(Jt,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(Xt);return e.ok?e.data.markAllMessageAsRead?{ok:!0}:{ok:!1,error:{name:"UnknownError",message:"Something went wrong."}}:e}}class ma{constructor(e){c(this,"client");this.client=e}async promos(){const e=await this.client.request(yt);return e.ok?{ok:e.ok,data:e.data.promos}:e}async cashbacks(){const e=await this.client.request(gt);return e.ok?{ok:e.ok,data:e.data.cashbacks}:e}async availablePromos(e){const t=await this.client.request(ht,e);return t.ok?{ok:t.ok,data:t.data.availablePromos}:t}async cashbackBonuses(){const e=await this.client.request(Et);return e.ok?{ok:e.ok,data:e.data.cashbackBonuses}:e}async claimCashbackBonus(e){const t=await this.client.request(At,e);return t.ok?t.data.claimCashbackBonus?{ok:!1,error:l(t.data.claimCashbackBonus.__typename)}:{ok:!0}:{ok:t.ok,error:t.error}}async bonus(){const e=await this.client.request(bt);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(dt,e);return t.ok?{ok:t.ok,data:t.data.node}:t}async createGCashDeposit(e){const t=await this.client.request(ot,e);return t.ok?t.data.createGCashDeposit?{ok:!1,error:l(t.data.createGCashDeposit.__typename)}:{ok:!0}:t}async createMayaDeposit(e){const t=await this.client.request(st,e);return t.ok?t.data.createMayaDeposit?{ok:!1,error:l(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:l(t.data.createAIOQRPHDeposit.__typename)}:{ok:!0}:t}async createAIOOnlineBankDeposit(e){const t=await this.client.request(lt,e);return t.ok?t.data.createAIOOnlineBankDeposit?{ok:!1,error:l(t.data.createAIOOnlineBankDeposit.__typename)}:{ok:!0}:t}async createMayaAppDeposit(e){const t=await this.client.request(mt,e);return t.ok?t.data.createMayaAppDeposit?{ok:!1,error:l(t.data.createMayaAppDeposit.__typename)}:{ok:!0}:t}async createGCashWithdrawal(e){const t=await this.client.request(Xe,e);return t.ok?t.data.createGCashWithdrawal?{ok:!1,error:l(t.data.createGCashWithdrawal.__typename)}:{ok:!0}:t}async createMayaWithdrawal(e){const t=await this.client.request(Ze,e);return t.ok?t.data.createMayaWithdrawal?{ok:!1,error:l(t.data.createMayaWithdrawal.__typename)}:{ok:!0}:t}async createMayaAppWithdrawal(e){const t=await this.client.request(et,e);return t.ok?t.data.createMayaAppWithdrawal?{ok:!1,error:l(t.data.createMayaAppWithdrawal.__typename)}:{ok:!0}:t}async createBankWithdrawal(e){const t=await this.client.request(tt,e);return t.ok?t.data.createBankWithdrawal?{ok:!1,error:l(t.data.createBankWithdrawal.__typename)}:{ok:!0}:t}async createAIOInstapayWithdrawal(e){const t=await this.client.request(at,e);return t.ok?t.data.createAIOInstapayWithdrawal?{ok:!1,error:l(t.data.createAIOInstapayWithdrawal.__typename)}:{ok:!0}:t}async instapayBankList(){const e=await this.client.request(rt);return e.ok?{ok:e.ok,data:e.data.instapayBankList}:e}async remainingDailyWithdrawalsCount(){const e=await this.client.request(nt);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:l(t.data.redeemPointsToCash.__typename)}:{ok:!0}:t}async mayaSession(e){const t=await this.client.request($t,e);return t.ok?{ok:t.ok,data:t.data.mayaSession}:t}async gameSession(e){const t=await this.client.request(xe.current,e);return t.ok?{ok:!0,data:t.data.node}:t}async createGameSession(e){const t=await this.client.request(Oe,e);return t.ok?t.data.createGameSession?{ok:!1,error:l(t.data.createGameSession.__typename)}:{ok:!0}:t}async endGameSession(e){const t=await this.client.request(Be.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(Ut);return e.ok?e.data.validateMayaSession?{ok:!0}:{ok:!1,error:{name:"UnknownError",message:"Something went wrong."}}:e}}function Ge(i){return new Date(i.getTime())}function U(i,e){const t=Ge(i);return t.setMinutes(t.getMinutes()+e),t}function Pe(i,e){return i.getTime()>e.getTime()}class ca{constructor(e){c(this,"config");c(this,"cache");this.cache={},this.config={cacheTime:5,...e}}set(e,t){const a=U(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 la(i,e,t){return i<e?e:i>t?t:i}function We(i){return Object.prototype.toString.call(i)==="[object Object]"&&Object(i)===i}function da(i){const e=[];function t(a,r=[]){for(const s in a){const m=a[s];We(m)?t(m,[...r,s]):Array.isArray(m)?t(ua(m),[...r,s]):e.push({key:[...r,s],value:m})}}return t(i),e}function ua(i){return i.reduce((e,t,a)=>(e[a]=t,e),{})}class q{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=await this.runMiddlewares(new Request(this.url,{...this.options,body:a,headers:r,method:"POST"}));return await this.exec(s)}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 p=await fetch(e);if(!p.ok)return{ok:!1,error:h(p.status)};const f=await p.json(),y=f.data,u=(t=f.errors)==null?void 0:t.at(0);return u?((a=u.extensions)==null?void 0:a.code)==="FORBIDDEN"||((r=u.extensions)==null?void 0:r.code)==="ACCESS_TOKEN_EXPIRED"?{ok:!1,error:h(403,u.message)}:((s=u.extensions)==null?void 0:s.code)==="UNAUTHORIZED"?{ok:!1,error:h(401,u.message)}:((m=u.extensions)==null?void 0:m.code)==="BAD_USER_INPUT"||((d=u.extensions)==null?void 0:d.code)==="BAD_REQUEST"?{ok:!1,error:h(400,u.message)}:{ok:!1,error:h(500,u.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=da(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 pa(i){return i==="INR"?"en-IN":i==="MYR"?"en-MY":i==="IDR"?"en-ID":i==="USD"?"en-US":"en-PH"}function fa(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=fa(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){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 L(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 p=d??r,f=await i(...m);return t(f)?f:p>1?(await qe(a*((r-p)/2)),s(m,p-1)):f}return async(...m)=>await s(m)}function F(i,e){const t=Ge(i);return t.setMinutes(t.getMinutes()-e),t}class wa{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 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 u;return y.ok&&((u=y.data)==null?void 0:u.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 p=await Le(()=>this.authService.createSession(e),{until:y=>y.ok,interval:1e3,maxAttempt:5})();if(!p.ok)return p;const f=new Date;return window.localStorage.setItem(this.storageKey,JSON.stringify({...p.data,accessTokenExpiresAt:U(f,8).getTime(),refreshTokenExpiresAt:F(L(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:U(m,8).getTime(),refreshTokenExpiresAt:F(L(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:U(m,8).getTime(),refreshTokenExpiresAt:F(L(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:U(a,8).getTime(),refreshTokenExpiresAt:F(L(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:U(a,8).getTime(),refreshTokenExpiresAt:F(L(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:U(a,8).getTime(),refreshTokenExpiresAt:F(L(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(We(a)){e[t]=S(a);continue}if(Array.isArray(a)){e[t]=a.map(r=>We(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 ya{constructor(e){c(this,"staticService");const t=(e==null?void 0:e.environment)==="development";this.staticService=new oa({url:t?"https://static.development.opexa.io":"https://static.opexa.io"})}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)}}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,p,f,y,u,M,D,v,N,R,I,g,G,P,C,W,x,O,B,_,$,k,V,H,Y,Q,j,K,z,J,X,Z,ee,te,ae,re,ne,ie,oe,se,me,ce,le,de,ue,pe,fe,we,ye,he,ge,be,Ee,Ae,Se,ke,Ce,_e,Te,Me,De,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:((p=e.gcashDepositGatewaySettings)==null?void 0:p.androidEnabled)??!1,iosEnabled:((f=e.gcashDepositGatewaySettings)==null?void 0:f.iosEnabled)??!1,webEnabled:((y=e.gcashDepositGatewaySettings)==null?void 0:y.webEnabled)??!1,mobileWebEnabled:((u=e.gcashDepositGatewaySettings)==null?void 0:u.mobileWebEnabled)??!1,minimumAmount:n((M=e.gcashDepositGatewaySettings)==null?void 0:M.minimumAmount),maximumAmount:n((D=e.gcashDepositGatewaySettings)==null?void 0:D.maximumAmount)},maya:{androidEnabled:((v=e.mayaDepositGatewaySettings)==null?void 0:v.androidEnabled)??!1,iosEnabled:((N=e.mayaDepositGatewaySettings)==null?void 0:N.iosEnabled)??!1,webEnabled:((R=e.mayaDepositGatewaySettings)==null?void 0:R.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:((W=e.mayaAppDepositGatewaySettings)==null?void 0:W.webEnabled)??!1,mobileWebEnabled:((x=e.mayaAppDepositGatewaySettings)==null?void 0:x.mobileWebEnabled)??!1,minimumAmount:n((O=e.mayaAppDepositGatewaySettings)==null?void 0:O.minimumAmount),maximumAmount:n((B=e.mayaAppDepositGatewaySettings)==null?void 0:B.maximumAmount)},onlineBank:{androidEnabled:((_=e.onlineBankDepositGatewaySettings)==null?void 0:_.androidEnabled)??!1,iosEnabled:(($=e.onlineBankDepositGatewaySettings)==null?void 0:$.iosEnabled)??!1,webEnabled:((k=e.onlineBankDepositGatewaySettings)==null?void 0:k.webEnabled)??!1,mobileWebEnabled:((V=e.onlineBankDepositGatewaySettings)==null?void 0:V.mobileWebEnabled)??!1,minimumAmount:n((H=e.onlineBankDepositGatewaySettings)==null?void 0:H.minimumAmount),maximumAmount:n((Y=e.onlineBankDepositGatewaySettings)==null?void 0:Y.maximumAmount)},qrph:{androidEnabled:((Q=e.qrphDepositGatewaySettings)==null?void 0:Q.androidEnabled)??!1,iosEnabled:((j=e.qrphDepositGatewaySettings)==null?void 0:j.iosEnabled)??!1,webEnabled:((K=e.qrphDepositGatewaySettings)==null?void 0:K.webEnabled)??!1,mobileWebEnabled:((z=e.qrphDepositGatewaySettings)==null?void 0:z.mobileWebEnabled)??!1,minimumAmount:n((J=e.qrphDepositGatewaySettings)==null?void 0:J.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:((ie=e.gcashWithdrawalGatewaySettings)==null?void 0:ie.androidEnabled)??!1,iosEnabled:((oe=e.gcashWithdrawalGatewaySettings)==null?void 0:oe.iosEnabled)??!1,webEnabled:((se=e.gcashWithdrawalGatewaySettings)==null?void 0:se.webEnabled)??!1,mobileWebEnabled:((me=e.gcashWithdrawalGatewaySettings)==null?void 0:me.mobileWebEnabled)??!1,minimumAmount:n((ce=e.gcashWithdrawalGatewaySettings)==null?void 0:ce.minimumAmount),maximumAmount:n((le=e.gcashWithdrawalGatewaySettings)==null?void 0:le.maximumAmount,1e6)},maya:{androidEnabled:((de=e.mayaWithdrawalGatewaySettings)==null?void 0:de.androidEnabled)??!1,iosEnabled:((ue=e.mayaWithdrawalGatewaySettings)==null?void 0:ue.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((De=e.instapayWithdrawalGatewaySettings)==null?void 0:De.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:pa(e.currency)}}pointsClubSettings(e){return{multiplier:n(e.multiplier,0)}}paymentSettings(e){var t,a,r,s,m,d,p,f,y,u,M,D,v,N,R,I,g,G,P,C,W,x,O,B,_,$,k,V,H,Y,Q,j,K,z,J,X,Z,ee,te,ae,re,ne,ie,oe,se,me,ce,le,de,ue,pe,fe,we,ye,he,ge,be,Ee,Ae,Se,ke,Ce,_e,Te,Me,De;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:((p=e.gcashDepositGatewaySettings)==null?void 0:p.androidEnabled)??!1,iosEnabled:((f=e.gcashDepositGatewaySettings)==null?void 0:f.iosEnabled)??!1,webEnabled:((y=e.gcashDepositGatewaySettings)==null?void 0:y.webEnabled)??!1,mobileWebEnabled:((u=e.gcashDepositGatewaySettings)==null?void 0:u.mobileWebEnabled)??!1,minimumAmount:n((M=e.gcashDepositGatewaySettings)==null?void 0:M.minimumAmount),maximumAmount:n((D=e.gcashDepositGatewaySettings)==null?void 0:D.maximumAmount)},maya:{androidEnabled:((v=e.mayaDepositGatewaySettings)==null?void 0:v.androidEnabled)??!1,iosEnabled:((N=e.mayaDepositGatewaySettings)==null?void 0:N.iosEnabled)??!1,webEnabled:((R=e.mayaDepositGatewaySettings)==null?void 0:R.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:((W=e.mayaAppDepositGatewaySettings)==null?void 0:W.webEnabled)??!1,mobileWebEnabled:((x=e.mayaAppDepositGatewaySettings)==null?void 0:x.mobileWebEnabled)??!1,minimumAmount:n((O=e.mayaAppDepositGatewaySettings)==null?void 0:O.minimumAmount),maximumAmount:n((B=e.mayaAppDepositGatewaySettings)==null?void 0:B.maximumAmount)},onlineBank:{androidEnabled:((_=e.onlineBankDepositGatewaySettings)==null?void 0:_.androidEnabled)??!1,iosEnabled:(($=e.onlineBankDepositGatewaySettings)==null?void 0:$.iosEnabled)??!1,webEnabled:((k=e.onlineBankDepositGatewaySettings)==null?void 0:k.webEnabled)??!1,mobileWebEnabled:((V=e.onlineBankDepositGatewaySettings)==null?void 0:V.mobileWebEnabled)??!1,minimumAmount:n((H=e.onlineBankDepositGatewaySettings)==null?void 0:H.minimumAmount),maximumAmount:n((Y=e.onlineBankDepositGatewaySettings)==null?void 0:Y.maximumAmount)},qrph:{androidEnabled:((Q=e.qrphDepositGatewaySettings)==null?void 0:Q.androidEnabled)??!1,iosEnabled:((j=e.qrphDepositGatewaySettings)==null?void 0:j.iosEnabled)??!1,webEnabled:((K=e.qrphDepositGatewaySettings)==null?void 0:K.webEnabled)??!1,mobileWebEnabled:((z=e.qrphDepositGatewaySettings)==null?void 0:z.mobileWebEnabled)??!1,minimumAmount:n((J=e.qrphDepositGatewaySettings)==null?void 0:J.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:((ie=e.gcashWithdrawalGatewaySettings)==null?void 0:ie.androidEnabled)??!1,iosEnabled:((oe=e.gcashWithdrawalGatewaySettings)==null?void 0:oe.iosEnabled)??!1,webEnabled:((se=e.gcashWithdrawalGatewaySettings)==null?void 0:se.webEnabled)??!1,mobileWebEnabled:((me=e.gcashWithdrawalGatewaySettings)==null?void 0:me.mobileWebEnabled)??!1,minimumAmount:n((ce=e.gcashWithdrawalGatewaySettings)==null?void 0:ce.minimumAmount),maximumAmount:n((le=e.gcashWithdrawalGatewaySettings)==null?void 0:le.maximumAmount,1e6)},maya:{androidEnabled:((de=e.mayaWithdrawalGatewaySettings)==null?void 0:de.androidEnabled)??!1,iosEnabled:((ue=e.mayaWithdrawalGatewaySettings)==null?void 0:ue.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((De=e.instapayWithdrawalGatewaySettings)==null?void 0:De.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:{name:e.game.name,type:e.game.type,images:this.staticService.gameThumbnails(e.game),provider:e.game.provider},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:{name:e.game.name,type:e.game.type,images:this.staticService.gameThumbnails(e.game),provider:e.game.provider},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:this.file(e.banner),maximumBonusAmount:n(e.maximumBonusAmount),minimumBonusAmount:n(e.minimumBonusAmount),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:this.file(e.banner),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}}class ha{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 ya({environment:s}),this.logger=new Ue({enabled:m??!1});const p=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",u=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",D=d?"https://file.opexa.io/graphql":"https://file.development.opexa.io/graphql",v=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",R="https://portal-api.opexacms.io/v1",I=new ta({url:R,site:t,platform:a}),g={middlewares:[this.authMiddleware],fetchOptions:{headers:{Role:"MEMBER","Platform-Code":r}}},G=new ra(new q(v,g)),P=new aa(new q(D,g)),C=new ma(new q(f,g)),W=new Zt(new q(u,g)),x=new ia(new q(y,g)),O=new na(new q(M,g)),B=new sa(new q(N,g)),_=new ea({url:p,platform:r}),$=new wa({logs:m,authService:_,walletService:C});this.authService=_,this.gameService=G,this.fileService=P,this.walletService=C,this.accountService=W,this.reportService=x,this.portalService=O,this.triggerService=B,this.sessionManager=$,this.cmsPortalService=I,this.cache=new ca}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});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=la(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:e.dateOfBirth.toISOString(),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,mobileNumber:T(e.mobileNumber,await this.locale)},referralCode:e.referralCode,reCAPTCHAResponse:e.reCAPTCHAResponse,verificationCode:e.verificationCode});return r.ok?{ok:!0,data:{id:t}}:r}const a=await this.accountService.registerMemberAccount__next({input:{id:t,name:e.name,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){return await this.accountService.updateMemberAccount({input:{id:e,data:{...t,password:t.password?await A(t.password):void 0,transactionPassword:t.transactionPassword?await A(t.transactionPassword):void 0,...t.mobileNumber&&{mobileNumber:T(t.mobileNumber,await this.locale)},secretAnswer:t.secretAnswer?await A(t.secretAnswer):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}}}});return t.ok?{ok:!0,data:{betRecords:t.data.edges.map(({cursor:a,node:r})=>({...this.transformer.transform.betRecord(r),cursor:a})),totalCount:t.data.totalCount,endCursor:t.data.pageInfo.endCursor??void 0,hasNextPage:t.data.pageInfo.hasNextPage}}:t}async latestBetRecords(){const e=await this.portalService.latestBetRecords();return e.ok?{ok:!0,data:e.data.map(this.transformer.transform.latestBetRecord)}:e}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 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 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(u=>u.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,p=["RTG","DARWIN","DRBINGO","MEGABALL","EVOLUTION","EVOLUTION_NETENT","EVOLUTION_REDTIGER"].includes(s)?await this.walletService.createGameSession({input:{id:t,game:m}}):await this.gameService.createGameSession({input:{id:t,game:m}});return p.ok?{ok:!0,data:{id:t}}:p}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()}}Object.defineProperty(b,"ObjectId",{enumerable:!0,get:()=>w.ObjectId}),b.ObjectType=E,b.Sdk=ha,Object.defineProperty(b,Symbol.toStringTag,{value:"Module"})});
1318
1348
  //# sourceMappingURL=index.js.map