bb-api-platforma 0.1.191 → 0.1.197

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.
@@ -127,10 +127,22 @@ export interface ILiveDataResponce {
127
127
  export interface ISport {
128
128
  ID: number;
129
129
  Name: string;
130
+ cnt?: number;
130
131
  }
131
132
  export interface ICountry {
132
133
  ID: number;
133
134
  Name: string;
135
+ cnt?: number;
136
+ }
137
+ export interface ITournamentShort {
138
+ sId: number;
139
+ sName: string;
140
+ cId: number;
141
+ cName: string;
142
+ Id: number;
143
+ Name: string;
144
+ cnt?: number;
145
+ EventsHeaders?: IEventsHeader[];
134
146
  }
135
147
  export interface IChangePassword {
136
148
  mailSubject: string;
@@ -691,6 +703,71 @@ export type TRedisSearchPrematchIds = {
691
703
  } | null;
692
704
  SORT?: RedisSortOptions;
693
705
  };
706
+ /**
707
+ * Type definition for Redis dictionary aggregation parameters.
708
+ * Used to retrieve aggregated dictionary data (sports, countries, or tournaments) with counts.
709
+ *
710
+ * @remarks
711
+ * Endpoint: `/stats/pm/dictionary` (NV20 API)
712
+ * This type uses FT.AGGREGATE command to group and count items by specified dictionary type.
713
+ *
714
+ * @property locale - Language locale code for filtering results
715
+ * @property sportId - Sport ID(s) to include in search
716
+ * @property countryId - Country ID(s) to include in search
717
+ * @property tournamentId - Tournament ID(s) to include in search
718
+ * @property dictionary - Dictionary type to group by ('sport' | 'country' | 'tournament')
719
+ * @property notsport - Sport ID(s) to exclude from search
720
+ * @property notcountry - Country ID(s) to exclude from search
721
+ * @property nottournament - Tournament ID(s) to exclude from search
722
+ * @property LIMIT - Maximum number of results to return
723
+ * @property minTime - Minimum time filter for events (Windows timestamp)
724
+ * @property maxTime - Maximum time filter for events (Windows timestamp)
725
+ *
726
+ * @example
727
+ * ```typescript
728
+ * // Get sport dictionary with counts
729
+ * const sportDict: TRedisDictionary = {
730
+ * locale: 'en',
731
+ * dictionary: 'sport',
732
+ * LIMIT: { from: 0, size: 10 },
733
+ * minTime: 1640995200,
734
+ * maxTime: 1641081600
735
+ * };
736
+ *
737
+ * // Get country dictionary excluding specific sports
738
+ * const countryDict: TRedisDictionary = {
739
+ * locale: 'ru',
740
+ * dictionary: 'country',
741
+ * notsport: [1, 2, 3],
742
+ * LIMIT: { from: 0, size: 50 }
743
+ * };
744
+ *
745
+ * // Get tournament dictionary for specific sport and country
746
+ * const tournamentDict: TRedisDictionary = {
747
+ * locale: 'en',
748
+ * dictionary: 'tournament',
749
+ * sportId: [1],
750
+ * countryId: [225],
751
+ * LIMIT: { from: 0, size: 100 }
752
+ * };
753
+ * ```
754
+ */
755
+ export type RedisDictionaryParams = {
756
+ locale?: string;
757
+ sportId?: RedisSearchParamValue;
758
+ countryId?: RedisSearchParamValue;
759
+ tournamentId?: RedisSearchParamValue;
760
+ dictionary: "sport" | "country" | "tournament";
761
+ notsport?: RedisSearchParamValue;
762
+ notcountry?: RedisSearchParamValue;
763
+ nottournament?: RedisSearchParamValue;
764
+ LIMIT?: {
765
+ from: number;
766
+ size: number;
767
+ } | null;
768
+ minTime?: number;
769
+ maxTime?: number;
770
+ };
694
771
  export declare function routeNameId(id: number | string, text?: string): string;
695
772
  export declare function clearPhone(draftPhoneNumber: number | string, prefix?: string, suffix?: string): string;
696
773
  export declare class BetBoosterApi {
@@ -715,6 +792,12 @@ export declare class BetBoosterApi {
715
792
  private _liveTimestampReset;
716
793
  liveRecivedIsFullPackage?: boolean;
717
794
  isNotActive?: boolean;
795
+ /** Приоритетные виды спорта для сортировки и отображения на странице [VidSportaRating]*/
796
+ primarySports: number[];
797
+ /** Приоритетные страны по видам спорта для сортировки и отображения */
798
+ priorityCountries: Record<string, number[]>;
799
+ /** Приоритетные турниры по видам спорта*/
800
+ priorityTournaments: Record<string, number[]>;
718
801
  /**
719
802
  * Represents the BetBoosterApi class.
720
803
  * @constructor
@@ -837,6 +920,57 @@ export declare class BetBoosterApi {
837
920
  * @returns URL for the specified API path and version.
838
921
  */
839
922
  private url;
923
+ /**
924
+ * Сортирует данные по приоритету, указанному в массиве priorityIDs.
925
+ *
926
+ * @template T - Тип объектов в массиве данных
927
+ * @param {Array<T>} data - Массив объектов данных для сортировки.
928
+ * @param {Array<number|string>} priorityIDs - Массив приоритетных ID для сортировки.
929
+ * @param {keyof T} sortField - Поле объекта, по которому будет производиться сортировка.
930
+ * @returns {Array<T>} - Новый массив отсортированных данных.
931
+ *
932
+ * @example
933
+ * ```typescript
934
+ * interface Tournament {
935
+ * Id: number;
936
+ * Name: string;
937
+ * SportID: number;
938
+ * }
939
+ *
940
+ * const tournaments: Tournament[] = [
941
+ * { Id: 1, Name: 'Premier League', SportID: 5 },
942
+ * { Id: 2, Name: 'La Liga', SportID: 5 },
943
+ * { Id: 3, Name: 'Serie A', SportID: 5 }
944
+ * ];
945
+ *
946
+ * const sortedTournaments = api.sortDataByPriority(
947
+ * tournaments,
948
+ * [3, 1, 2],
949
+ * 'Id'
950
+ * );
951
+ * // Result: [Serie A, Premier League, La Liga]
952
+ * ```
953
+ */
954
+ sortDataByPriority<T extends Record<string, any>>(data: T[], priorityIDs: Array<number | string>, sortField: keyof T): T[];
955
+ /**
956
+ * Сортирует массив значений по приоритету, указанному в массиве priorityIDs.
957
+ *
958
+ * @template T - Тип элементов массива (number | string)
959
+ * @param {Array<T>} array - Массив значений для сортировки.
960
+ * @param {Array<T>} priorityIDs - Массив приоритетных ID для сортировки.
961
+ * @returns {Array<T>} - Новый массив отсортированных значений.
962
+ *
963
+ * @example
964
+ * ```typescript
965
+ * const sportIds = [1, 5, 3, 8, 2];
966
+ * const prioritySports = [5, 1, 3];
967
+ *
968
+ * const sortedSports = api.sortArrayByPriority(sportIds, prioritySports);
969
+ * // Result: [5, 1, 3, 8, 2]
970
+ * // Elements 5, 1, 3 are sorted by priority, others remain in original order
971
+ * ```
972
+ */
973
+ sortArrayByPriority<T extends number | string>(array: T[], priorityIDs: T[]): T[];
840
974
  /**
841
975
  * Executes an HTTP request with the specified parameters.
842
976
  * @param url - The URL to execute the request.
@@ -911,6 +1045,7 @@ export declare class BetBoosterApi {
911
1045
  *
912
1046
  * @param minutes The number of minutes to consider for the data retrieval. Defaults to 0.
913
1047
  * @returns {Promise<Array<any>>} A promise that resolves to an array of line sports data.
1048
+ * @deprecated - use this.getLineSportsMain();
914
1049
  */
915
1050
  getLineSports(minutes?: number): Promise<ISport[]>;
916
1051
  /**
@@ -923,6 +1058,7 @@ export declare class BetBoosterApi {
923
1058
  * @param sportId - Идентификатор спорта.
924
1059
  * @param minutes - Опциональный параметр, количество минут.
925
1060
  * @returns Промис, который разрешается в массив объектов типа ICountry.
1061
+ * @deprecated - use this.getCountriesListMain();
926
1062
  */
927
1063
  getCountriesList(sportId: number, minutes?: number): Promise<ICountry[]>;
928
1064
  /**
@@ -931,8 +1067,9 @@ export declare class BetBoosterApi {
931
1067
  * @param countryId - The ID of the country.
932
1068
  * @param minutes - The number of minutes ago for which data is to be retrieved.
933
1069
  * @returns A promise that resolves to an array of prematch tournaments.
1070
+ * @deprecated - use this.getPrematchTournamentsMain();
934
1071
  */
935
- getPrematchTournaments(sportId: number, countryId: number, minutes?: number): Promise<GetPrematchTournament[]>;
1072
+ getPrematchTournaments(sportId: number | string, countryId: number | string, minutes?: number): Promise<GetPrematchTournament[]>;
936
1073
  /**
937
1074
  * Retrieves prematch tournaments based on the specified sport ID and minutes.
938
1075
  * @param sportId - The ID of the sport.
@@ -1864,6 +2001,147 @@ export declare class BetBoosterApi {
1864
2001
  status: number;
1865
2002
  statusText: string;
1866
2003
  }>;
2004
+ /**
2005
+ * Retrieves aggregated dictionary data from Redis using FT.AGGREGATE command.
2006
+ * Groups and counts items by specified dictionary type (sport, country, or tournament).
2007
+ *
2008
+ * @param payload - The search parameters for dictionary aggregation
2009
+ * @param payload.locale - Language locale code for filtering results
2010
+ * @param payload.sportId - Sport ID(s) to include in search
2011
+ * @param payload.countryId - Country ID(s) to include in search
2012
+ * @param payload.tournamentId - Tournament ID(s) to include in search
2013
+ * @param payload.dictionary - Dictionary type to group by ('sport' | 'country' | 'tournament')
2014
+ * @param payload.notsport - Sport ID(s) to exclude from search
2015
+ * @param payload.notcountry - Country ID(s) to exclude from search
2016
+ * @param payload.nottournament - Tournament ID(s) to exclude from search
2017
+ * @param payload.LIMIT - Maximum number of results to return
2018
+ * @param payload.minTime - Minimum time filter for events
2019
+ * @param payload.maxTime - Maximum time filter for events
2020
+ *
2021
+ * @returns Promise resolving to aggregated results with total count and grouped items,
2022
+ * or error object with total: 0 and empty results array on failure
2023
+ *
2024
+ * @example
2025
+ * ```typescript
2026
+ * // Get sport dictionary with counts
2027
+ * const sportDict = await redisDb.getDictionary({
2028
+ * locale: 'en',
2029
+ * dictionary: 'sport',
2030
+ * LIMIT: { from: 0, size: 10 },
2031
+ * minTime: 1640995200,
2032
+ * maxTime: 1641081600
2033
+ * });
2034
+ *
2035
+ * // Get country dictionary excluding specific sports
2036
+ * const countryDict = await redisDb.getDictionary({
2037
+ * locale: 'ru',
2038
+ * dictionary: 'country',
2039
+ * notsport: [1, 2, 3],
2040
+ * LIMIT: { from: 0, size: 50 }
2041
+ * });
2042
+ *
2043
+ * // Get tournament dictionary for specific sport and country
2044
+ * const tournamentDict = await redisDb.getDictionary({
2045
+ * locale: 'en',
2046
+ * dictionary: 'tournament',
2047
+ * sportId: [1],
2048
+ * countryId: [225],
2049
+ * LIMIT: { from: 0, size: 100 }
2050
+ * });
2051
+ * ```
2052
+ */
2053
+ getDictionaryNv20(payload: RedisDictionaryParams): Promise<{
2054
+ data: any;
2055
+ error: string | null;
2056
+ status: number;
2057
+ statusText: string;
2058
+ }>;
2059
+ /**
2060
+ * Retrieves a list of sports from the NV20 API endpoint with optional time filtering.
2061
+ *
2062
+ * @param {number} [minutes=0] - Optional time window in minutes to filter sports data.
2063
+ * If greater than 0, filters results to include only data
2064
+ * from the current time to the specified minutes in the future.
2065
+ * @param {number} [timeout=MAX_TIME_EXECUTION_MS] - Optional request timeout in milliseconds.
2066
+ * @returns {Promise<I.ISport[]>} A promise that resolves to an array of sports objects sorted by priority.
2067
+ * Each sport contains an ID, Name, and count (cnt) property.
2068
+ *
2069
+ * @example
2070
+ * // Get all available sports
2071
+ * const sports = await betBoosterApi.getLineSportsNv20();
2072
+ *
2073
+ * @example
2074
+ * // Get sports updated in the last 30 minutes with a custom timeout
2075
+ * const sports = await betBoosterApi.getLineSportsNv20(30, 5000);
2076
+ */
2077
+ getLineSportsNv20(minutes?: number, timeout?: number): Promise<ISport[]>;
2078
+ /**
2079
+ * Retrieves the main line sports data with fallback mechanism.
2080
+ *
2081
+ * Attempts to fetch line sports data from the NV20 endpoint first with a 2000ms timeout.
2082
+ * If no sports data is returned, falls back to the standard getLineSports endpoint.
2083
+ *
2084
+ * @param minutes - Optional. The number of minutes to look back for sports data. Defaults to 0.
2085
+ * @param timeout - Optional. The timeout duration in milliseconds for the NV20 API request. Defaults to 1500.
2086
+ * @returns A promise that resolves to an array of sports objects containing line sports data.
2087
+ * @example
2088
+ * // Get current line sports
2089
+ * const sports = await getLineSportsMain();
2090
+ *
2091
+ * @example
2092
+ * // Get line sports from the last 30 minutes
2093
+ * const sports = await getLineSportsMain(30);
2094
+ */
2095
+ getLineSportsMain(minutes?: number, timeout?: number): Promise<ISport[]>;
2096
+ /**
2097
+ * Retrieves countries for a given sport using the NV20 API.
2098
+ * @param sportId - The sport ID to filter countries by.
2099
+ * @param minutes - Optional time window in minutes for the query. Defaults to 0 (no time filter).
2100
+ * @returns A promise that resolves to the response data containing countries or null if the request fails.
2101
+ */
2102
+ getCountriesBySportNv20(sportId: number, minutes?: number, timeout?: number): Promise<ICountry[]>;
2103
+ /**
2104
+ * Retrieves a list of countries for a given sport, with fallback behavior.
2105
+ *
2106
+ * Attempts to fetch countries using the NV20 API with a 5-second timeout.
2107
+ * If no results are returned, falls back to the standard countries list endpoint.
2108
+ *
2109
+ * @param sportId - The unique identifier of the sport
2110
+ * @param minutes - Optional. The number of minutes to use as a filter criteria. Defaults to 0.
2111
+ * @param timeout - Optional. The timeout duration in milliseconds for the NV20 API request. Defaults to 3000.
2112
+ * @returns A promise that resolves to an array of countries for the specified sport
2113
+ *
2114
+ * @example
2115
+ * ```typescript
2116
+ * const countries = await this.getCountriesListMain(1, 30);
2117
+ * ```
2118
+ */
2119
+ getCountriesListMain(sportId: number, minutes?: number, timeout?: number): Promise<ICountry[]>;
2120
+ /**
2121
+ * Retrieves tournaments from the NV20 API for a specific sport and optional country.
2122
+ * @param sportId - The sport ID to filter tournaments by
2123
+ * @param countryId - Optional country ID to filter tournaments by
2124
+ * @param minutes - Optional time window in minutes for tournament data (default: 0, no time filter)
2125
+ * @returns A promise that resolves to the response data containing tournaments or null
2126
+ */
2127
+ getPrematchTournamentsNv20(sportId: number | string, countryId: number | string, minutes?: number, timeout?: number): Promise<ITournamentShort[]>;
2128
+ /**
2129
+ * Retrieves prematch tournaments for a given sport and country.
2130
+ *
2131
+ * Attempts to fetch tournaments using the NV2.0 API first. If no tournaments are returned,
2132
+ * falls back to the standard API as a failover mechanism.
2133
+ *
2134
+ * @param sportId - The sport identifier (number or string)
2135
+ * @param countryId - The country identifier (number or string)
2136
+ * @param minutes - The time window in minutes for prematch tournaments (default: 0)
2137
+ * @param timeout - The request timeout in milliseconds (default: 3000)
2138
+ * @returns A promise that resolves to an array of tournament objects
2139
+ * @throws May throw an error if both API calls fail
2140
+ *
2141
+ * @example
2142
+ * const tournaments = await betBoosterApi.getPrematchTournamentsMain(1, 'US', 30, 5000);
2143
+ */
2144
+ getPrematchTournamentsMain(sportId: number | string, countryId: number | string, minutes?: number, timeout?: number): Promise<ITournamentShort[]>;
1867
2145
  searchPrematchTournametsEventsNv20(searchString: string, options?: RedisPrematchSearchParams): Promise<{
1868
2146
  data: any;
1869
2147
  error: string | null;
@@ -1960,6 +2238,9 @@ export declare class BetBoosterApi {
1960
2238
  getFaq(): Promise<any>;
1961
2239
  getFlatpagesList(): Promise<any>;
1962
2240
  test3(): Promise<string>;
2241
+ /**
2242
+ * @deprecated sellBet - Not implemented
2243
+ */
1963
2244
  sellBet(data: any): Promise<void>;
1964
2245
  /** Конвертирует различные представления корзины в единый формат
1965
2246
  * @param betslipItem - элемент корзины
@@ -1,2 +1,2 @@
1
- import{api}from"./Types.js";const locales={en:"en-US",pt:"en-US",fr:"fr-FR",ht:"fr-FR",es:"en-US",tr:"tr-TR",az:"tr-TR",uk:"en-US",cr:"fr-FR",ru:"ru-RU"},languageIdsRemote={en:1,pt:1,fr:4,es:1,tr:5,az:5,uk:1,cr:1,ru:0},stringify=t=>JSON.stringify(t,null,2);function convertBasketToPost(t){return{a1:t.Add1,a2:t.Add2,bId:t.BetVarID,eId:t.LinesID,fs:t.HandSize,isLive:t.IsLive,r:t.Odds}}export function routeNameId(t,e=""){return`${e.replace(/[\s\.\,\(\)\[\]\\\/\-\~\`\"\']+/g," ").trim().replace(/\s+/g,"-").toLowerCase()}~${t}`}export function clearPhone(t,e="",s=""){return e+(String(t).match(/\d+/g)||[]).join("")+s}let IS_DEV_MODE=!1;export class BetBoosterApi{constructor(t,e,s="en",a=15e3,i=!1){this._locale="en-EN",this._locales=locales,this._languageIdsRemote=languageIdsRemote,this.EXIST_LANGUAGES=Object.keys(locales),this._languageId=1,this._lang="en",this._USER_DATA={},this.LANG_DEFAULT="en",this.LOCALE_DEFAULT="en-EN",this.LANG_ID_DEFAULT=1,this.maxTimeExecutionMs=15e3,this.liveTimestamp=0,this._liveTimestampReset=!1,this.liveRecivedIsFullPackage=!1,this.isNotActive=!1,IS_DEV_MODE=i,this.maxTimeExecutionMs=a,this.axi=t,this.setBaseUrl(e),this.setLanguage(s)}get locale(){return this._locale}get isSinged(){return void 0!==this.user&&void 0!==this.user.UserId&&this.user.UserId>0}get user(){return this._USER_DATA}get userMain(){var t,e,s,a,i,n,r,l,o,u,c,d,h,g;return[`uid: ${null!==(e=null===(t=this._USER_DATA)||void 0===t?void 0:t.UserId)&&void 0!==e?e:"--"}`,`unm: ${null!==(a=null===(s=this._USER_DATA)||void 0===s?void 0:s.UserName)&&void 0!==a?a:"--"}`,`pid: ${null!==(n=null===(i=this._USER_DATA)||void 0===i?void 0:i.PointId)&&void 0!==n?n:"--"}`,`ptp: ${null!==(l=null===(r=this._USER_DATA)||void 0===r?void 0:r.PlayerType)&&void 0!==l?l:"--"}`,`gid: ${null!==(u=null===(o=this._USER_DATA)||void 0===o?void 0:o.GroupID)&&void 0!==u?u:"--"}`,`bal: ${null!==(d=null===(c=this._USER_DATA)||void 0===c?void 0:c.Amount)&&void 0!==d?d:"--"}`,`cur: ${null!==(g=null===(h=this._USER_DATA)||void 0===h?void 0:h.CurrencyName)&&void 0!==g?g:"--"}`]}set user(t){this._USER_DATA=t}get lang(){return this._lang}get languageId(){return this._languageId}get token(){var t;return null!==(t=this._TOKEN)&&void 0!==t?t:void 0}set token(t){this._TOKEN="string"==typeof t?t.split(/\s*,\s*/)[0]:void 0}responseHandlerData(t,e,s){var a,i,n;let r=null;void 0!==(null===(a=null==t?void 0:t.Data)||void 0===a?void 0:a.Data)?r=t.Data.Data:void 0!==(null===(i=null==t?void 0:t.Data)||void 0===i?void 0:i._isSuccessful)?r=t.Data._isSuccessful:void 0!==(null==t?void 0:t.Data)?r=t.Data:void 0!==t&&(r=t);const l=(null===(n=null==t?void 0:t.Data)||void 0===n?void 0:n.Error)||(null==t?void 0:t.Error)||(e>=300?s:null)||(r?null:"Unknown error");return"Object reference not set to an instance of an object."===l&&console.log("!!!!!!!!!!! Object reference not set to an instance of an object."),{data:r,error:l,status:e,statusText:s}}responseHandlerDataData(t,e,s){var a,i,n,r;let l=null;void 0!==(null===(a=null==t?void 0:t.Data)||void 0===a?void 0:a.Data)&&void 0!==(null==t?void 0:t.Data)?l=t.Data:void 0!==(null===(i=null==t?void 0:t.Data)||void 0===i?void 0:i.Data)?l=t.Data.Data:void 0!==(null===(n=null==t?void 0:t.Data)||void 0===n?void 0:n._isSuccessful)?l=t.Data._isSuccessful:void 0!==(null==t?void 0:t.Data)?l=t.Data:void 0!==t&&(l=t);const o=(null===(r=null==t?void 0:t.Data)||void 0===r?void 0:r.Error)||(null==t?void 0:t.Error)||(e>=300?s:null)||(l?null:"Unknown error");return"Object reference not set to an instance of an object."===o&&console.log("!!!!!!!!!!! Object reference not set to an instance of an object."),{data:l,error:o,status:e,statusText:s}}convertDataData(t){var e;if(void 0!==(null===(e=null==t?void 0:t.Data)||void 0===e?void 0:e.Data)){const e=Object.keys(t.Data);if(e.length>0){const s={};return e.forEach((e=>{var a;s[e.toLowerCase()]=null!==(a=t.Data[e])&&void 0!==a?a:null})),s}}return t}setDevMode(t){IS_DEV_MODE=void 0===t||t}addLocalesConverters(t){this._locales=Object.assign(Object.assign({},this._locales),t);const e=new Set([...this.EXIST_LANGUAGES,...Object.keys(this._locales)]);this.EXIST_LANGUAGES=Array.from(e)}checkLanguage(t="en"){try{const e=t.substring(0,2)||this.LANG_DEFAULT;return this.EXIST_LANGUAGES.includes(e)?e:this.LANG_DEFAULT}catch(t){return this.LANG_DEFAULT}}setLanguage(t="en"){var e,s;return this._lang=this.checkLanguage(t),this._locale=null!==(e=this._locales[this._lang])&&void 0!==e?e:this.LOCALE_DEFAULT,this._languageId=null!==(s=this._languageIdsRemote[this._lang])&&void 0!==s?s:this.LANG_ID_DEFAULT,this._lang}async setLanguageRemoteLocale(t="en"){if(this.setLanguage(t),this.isSinged){const t=this.url("/account/SetLanguage",api.LBC);return await this.POST(t,{culture:this.locale})||!1}}setBaseUrl(t){return t.endsWith("/")&&(t=t.slice(0,-1)),this._baseUrl=t,this._baseUrl}statusHandler(t,e){401===t&&(this.user={},this.token=void 0,IS_DEV_MODE&&console.log("Status:",t,e))}queryStringHandler(t={}){return Object.keys(t).forEach((e=>{null===t[e]?t[e]="null":!0===t[e]?t[e]="true":!1===t[e]?t[e]="false":void 0===t[e]&&(t[e]="")})),t}responseHandler(t){var e,s,a,i;const n=null!==(s=null!==(e=null==t?void 0:t.headers["x-token"])&&void 0!==e?e:null==t?void 0:t.headers["X-token"])&&void 0!==s?s:null;IS_DEV_MODE&&(null===(a=null==t?void 0:t.request)||void 0===a?void 0:a.path)&&console.log(null===(i=null==t?void 0:t.request)||void 0===i?void 0:i.path),n&&(this.token=n,IS_DEV_MODE&&console.log("isSinged:",this.isSinged+"\nX-Token:",n))}axiosErrorHandler(t){var e,s,a,i,n,r,l,o;let u,c=null!==(s=null===(e=t.response)||void 0===e?void 0:e.status)&&void 0!==s?s:null,d=null!==(i=null===(a=t.response)||void 0===a?void 0:a.statusText)&&void 0!==i?i:null;const h=null!==(n=t.response)&&void 0!==n?n:null;if(h){if(u=[...c?[c]:[],...d?[d]:[],...(null===(r=null==h?void 0:h.data)||void 0===r?void 0:r.Message)?[h.data.Message]:[],...(null===(l=null==h?void 0:h.data)||void 0===l?void 0:l.MessageDetail)?[h.data.MessageDetail]:[]].join(" > "),IS_DEV_MODE){const t=(null!==(o=h.config.method)&&void 0!==o?o:"").toUpperCase(),e=h.config.url,s=h.config.data;console.log("```"),console.log("ERROR:",t,e),console.log("DATA:",s),console.log("RESPONCE:",null==h?void 0:h.data),console.log("```")}}else t.request?(u="Error: No response received",c=503,d="Service Unavailable"):(u=`Error: ${null==t?void 0:t.message}`,c=601,d=(null==t?void 0:t.message)||"Unknown error");return console.error("Axios request error:",u),{data:null,status:c,statusText:u||d||"Unknown error"}}url(t,e){if(t.toLowerCase().startsWith("http"))return t;switch(e){case api.V2:return`${this._baseUrl}/v2/bsw/api${t}`;case api.NV20:return`${this._baseUrl}/nv20${t}`;case api.LBC:return`${this._baseUrl}/v2/lbc/api${t}`;case api.DIRECT:return`${this._baseUrl}${t}`;case api.V1:default:return`${this._baseUrl}/api${t}`}}request(t){const e=this.queryStringHandler,s=this.axi,a=this.axiosErrorHandler,i=(t,e)=>{401===t&&(this.user={},this.token=void 0,IS_DEV_MODE&&console.log("Status:",t,e))},n=async t=>{var e,s;try{console.error(t);const a=["undefined"!=typeof window?window.location.href:"url: unknown",`Error: ${(null==t?void 0:t.error)||"Unknown error"}`,...this.userMain].filter(Boolean).join("\n");let i="";try{i=null!==(e=JSON.stringify(t,null,2))&&void 0!==e?e:"Unknown error"}catch(e){i=null!==(s=null==t?void 0:t.error)&&void 0!==s?s:"Unknown error"}await this.sendErrInfo(a,i)}catch(t){}},r=t=>{var e,s,a,i,r,l,o,u,c,d,h,g,v,p;const T=null!==(e=null==t?void 0:t.headers["x-token"])&&void 0!==e?e:null,m=null!==(a=null===(s=null==t?void 0:t.request)||void 0===s?void 0:s.path)&&void 0!==a?a:null;if(null===(i=null==t?void 0:t.data)||void 0===i?void 0:i.Error){const e=(null!==(l=null===(r=null==t?void 0:t.config)||void 0===r?void 0:r.method)&&void 0!==l?l:"").toUpperCase(),s=Object.assign(Object.assign(Object.assign({method:e,url:(null===(o=null==t?void 0:t.config)||void 0===o?void 0:o.url)||""},(null===(u=null==t?void 0:t.config)||void 0===u?void 0:u.params)?{params:null!==(d=null===(c=null==t?void 0:t.config)||void 0===c?void 0:c.params)&&void 0!==d?d:""}:{}),(null===(h=null==t?void 0:t.config)||void 0===h?void 0:h.data)?{POST:null!==(v=null===(g=null==t?void 0:t.config)||void 0===g?void 0:g.data)&&void 0!==v?v:""}:{}),{error:null===(p=null==t?void 0:t.data)||void 0===p?void 0:p.Error});n(s)}IS_DEV_MODE&&m&&console.log(m),T&&(this.token=T,IS_DEV_MODE&&console.log("isSinged:",this.isSinged+"\nX-Token:",T))},l=Date.now()+Math.random();let o=new AbortController,u=setTimeout((()=>{o.abort()}),this.maxTimeExecutionMs);const c={url:t,method:"GET",params:{_:l},headers:Object.assign({},this.token?{"X-Token":this.token}:{}),responseType:"json",timeout:this.maxTimeExecutionMs,timeoutErrorMessage:`Request timed out after ${this.maxTimeExecutionMs} ms`,signal:o.signal};return{query(t={}){const s=e(t);return c.params=Object.assign(Object.assign({},s),c.params),this},headers(t={}){return c.headers=Object.assign(Object.assign({},c.headers),t),this},deleteAllHeaders(){return delete c.headers,this},setTimeout(t=15e3){return clearTimeout(u),o=new AbortController,u=setTimeout((()=>{o.abort()}),t),c.timeout=t,c.timeoutErrorMessage=`Request timed out after ${t} ms`,c.signal=o.signal,c.withXSRFToken=!0,this},GET(){return c.method="GET",this},POST(t={}){return c.method="POST",c.data=t,this},PUT(t={}){return c.method="PUT",c.data=t,this},DELETE(t={}){return c.method="DELETE",c.data=t,this},async exec(){"GET"!==c.method&&delete c.params._;const t=s.request(c).then((t=>(r(t),t))).catch(a).finally((()=>clearTimeout(u))),{data:e,status:n,statusText:l}=await t;return i(n,l),{data:e,status:n,statusText:l}},async value(){const{data:t}=await this.exec();await t}}}async GET(t,e={},s={}){const a=new AbortController,i=setTimeout((()=>{a.abort()}),this.maxTimeExecutionMs),n={params:this.queryStringHandler(e),headers:Object.assign(Object.assign({},this.token?{"X-Token":this.token}:{}),null!=s?s:{}),responseType:"json",signal:a.signal},r=this.axi.get(t,n).then((t=>(this.responseHandler(t),t))).catch(this.axiosErrorHandler).finally((()=>clearTimeout(i))),{data:l,status:o,statusText:u}=await r;return this.statusHandler(o,u),l}async POST(t,e={},s={},a={}){const i=new AbortController,n=setTimeout((()=>{i.abort()}),this.maxTimeExecutionMs),r={params:this.queryStringHandler(s),headers:Object.assign(Object.assign({},this.token?{"X-Token":this.token}:{}),null!=a?a:{}),responseType:"json",signal:i.signal},l=this.axi.post(t,e,r).then((t=>(this.responseHandler(t),t))).catch(this.axiosErrorHandler).finally((()=>clearTimeout(n))),o=await l,{data:u,status:c,statusText:d}=o;return this.statusHandler(c,d),u}async DELETE(t,e={},s={},a={}){const i=new AbortController,n=setTimeout((()=>{i.abort()}),this.maxTimeExecutionMs),r={params:this.queryStringHandler(s),headers:Object.assign(Object.assign({},this.token?{"X-Token":this.token}:{}),null!=a?a:{}),responseType:"json",signal:i.signal,data:e},l=this.axi.delete(t,r).then((t=>(this.responseHandler(t),t))).catch(this.axiosErrorHandler).finally((()=>clearTimeout(n))),{data:o,status:u,statusText:c}=await l;return this.statusHandler(u,c),o}async PUT(t,e={},s={},a={}){const i=new AbortController,n=setTimeout((()=>{i.abort()}),this.maxTimeExecutionMs),r={params:this.queryStringHandler(s),headers:Object.assign(Object.assign({},this.token?{"X-Token":this.token}:{}),null!=a?a:{}),responseType:"json",signal:i.signal},l=this.axi.put(t,e,r).then((t=>(this.responseHandler(t),t))).catch(this.axiosErrorHandler).finally((()=>clearTimeout(n))),{data:o,status:u,statusText:c}=await l;return this.statusHandler(u,c),o}async getLineSports(t=0){var e;const s=+t>0?this.url(`/line/${this.locale}/sports/${t}`):this.url(`/line/${this.locale}/allSports`);return null!==(e=await this.GET(s,{},{}))&&void 0!==e?e:[]}async getHotEvents(){var t;const e=this.url(`/line/${this.locale}/hotevents`);return null!==(t=await this.GET(e,{},{}))&&void 0!==t?t:[]}async getCountriesList(t,e=0){var s;const a=this.url(`/line/${this.locale}/countries/sport${t}/${e}`);return null!==(s=await this.GET(a,{},{}))&&void 0!==s?s:[]}async getPrematchTournaments(t,e,s=0){var a;const i=this.url(`/line/${this.locale}/tournaments/sport${t}/country${e}/${s}`);return null!==(a=await this.GET(i,{},{}))&&void 0!==a?a:[]}async getPrematchTournamentsByMinutes(t=0,e=0){var s;const a=this.url(`/line/${this.locale}/events/full/sport${t}/${e}`);return(null!==(s=await this.GET(a,{},{}))&&void 0!==s?s:[]).filter((t=>{var e;return(null!==(e=null==t?void 0:t.EventsHeaders)&&void 0!==e?e:[]).length>0}))}async getPrematchTournamentsHeadersByMinutes(t=0,e=0){var s;const a=this.url(`/line/${this.locale}/tournaments/headers/sport${t}/${e}`);return null!==(s=await this.GET(a,{},{}))&&void 0!==s?s:[]}async getPrematchEvents(t,e,s,a){var i;const n=this.url(`/line/${this.locale}/events/sport${t}/country${e}/tourney${s}/${a}`);return null!==(i=await this.GET(n,{},{}))&&void 0!==i?i:[]}liveTimestampReset(t=!0){this._liveTimestampReset=t}async getLive(t=!1,e=[]){var s;let a=!1;(t||!0===this._liveTimestampReset)&&(this.liveTimestamp=0,this.liveTimestampReset(!1));const i=this.url(`/live/${this.locale}/full/${this.liveTimestamp}/0`),{data:n,status:r}=await this.request(i).GET().query({events:e}).exec(),{TimeStamp:l,LEvents:o,IsChanges:u}=null!=n?n:{};return a=!1===u,this.liveTimestamp=200===r&&null!==(s=null!=l?l:this.liveTimestamp)&&void 0!==s?s:0,{ts:+this.liveTimestamp,events:null!=o?o:[],isFullPackage:a}}async getFullLiveWithoutSaveTimeStamp(){var t;const e=this.url(`/live/${this.locale}/full/0/0`),s=null!==(t=await this.GET(e,{},{}))&&void 0!==t?t:{},{LEvents:a}=null!=s?s:{};return null!=a?a:[]}async getLiveEventsAndFullEvent(t){var e;const s=this.url(`/live/${this.locale}/bets/${t}`);return[null!==(e=await this.GET(s,{},{}))&&void 0!==e?e:{}]}async getLiveEventFull(t){const e=this.url(`/live/${this.locale}/bets/${t}`),{data:s}=await this.request(e).exec();return null!=s?s:null}async getEventPrematch(t){var e;const s=this.url(`/line/${this.locale}/event/${t}`);return null!==(e=await this.GET(s,{},{}))&&void 0!==e?e:{}}async verifyEmail(t){var e;const s=this.url(`/account/userActivationByEmail/${t}/${this.locale}`);return null!==(e=await this.GET(s,{},{}))&&void 0!==e?e:{}}async signUp(t){Object.assign(t,{Culture:this.locale});const e=this.url(`/account/${this.locale}/registration`);return await this.POST(e,t)}async signUpViaEmail(t){if(t.CurrencyId){const e=t.CurrencyId;t.PointId=e,delete t.CurrencyId}Object.assign(t,{Culture:this.locale});const e=this.url(`/account/${this.locale}/registrationNewEmail`);return await this.POST(e,t)}async signUpDirect(t){if(t.CurrencyId){const e=t.CurrencyId;t.PointId=e,delete t.CurrencyId}Object.assign(t,{Culture:this.locale});const e=this.url(`/account/${this.locale}/registrationNewWhithOutEmail`);return await this.POST(e,t)}async createInternetUser(t){var e,s;if(t.CurrencyId){const e=t.CurrencyId;t.PointId=e,delete t.CurrencyId}if(!(null==(t=Object.assign({},t,{Culture:this.locale}))?void 0:t.PointId))return{created:null,error:"parametersError",status:200,statusText:""};t.PointId&&t.PointId<1e4&&(t.PointId=t.PointId+1e4);const a=this.url(`/account/${this.locale}/registrationNewWhithOutEmail`),{data:i,status:n,statusText:r}=await this.request(a).POST(t).exec();return{created:null!==(s=null===(e=null==i?void 0:i.Data)||void 0===e?void 0:e._isSuccessful)&&void 0!==s?s:null,error:(null==i?void 0:i.Error)||null,status:n,statusText:r}}async getResultsSports(t,e){const s=this.url(`/results/${this.locale}/sports/0/${t}/${e}`);return await this.GET(s,{},{})}async getResultsTournamentsBySportId(t,e,s){const a=this.url(`/results/${this.locale}/tournaments/sport${t}/0/${e}/${s}`);return await this.GET(a,{},{})}async getResultsGrid(t,e,s,a,i){const n=this.url(`/results/${this.locale}/sport${t}/country${e}/tournament${s}/0/${a}/${i}`),r=await this.GET(n,{},{});return null!=r?r:[]}async getGamesProvidersTopGames(){const t=this.url("/slotintegrator-service/topGameByProvider"),e=await this.GET(t,{},{});return null!=e?e:[]}async getGamesTopProviders(){const t=this.url("/slotintegrator-service/topProviders"),e=await this.GET(t,{},{});return null!=e?e:[]}async getSlotsList(){const t=this.url("/slotintegrator-service/gamelist"),{items:e}=await this.GET(t,{},{});return null!=e?e:[]}async createSlotOutcome(t){return{}}async createSlotIntegratorDemo(t){const e=this.locale||"en";try{t.language=e.substring(0,2);const s=this.url("/slotintegrator-service/InitDemoGames"),a=await this.POST(s,t);return JSON.parse(a)}catch(t){return{}}}async createSlotIntegratorReal(t){try{const e=this.url("/slotintegrator-service/InitRealGames"),s=await this.POST(e,t);return JSON.parse(s)}catch(t){return{}}}async getSlotIntegratorProvidersHeaders(){try{const t=this.url("/slotintegrator-service/ProviderHeaders"),e=(await this.GET(t)||[]).map((t=>Object.assign(Object.assign({},t),{ProviderName:t.Provider,Games:[]})));return null!=e?e:[]}catch(t){return[]}}async getSlotIntegratorProviderAllGames(t){const e=this.url(`/slotintegrator-service/searchGameByProvider/${t}`),s=await this.GET(e);return null!=s?s:[]}async getSlotIntegratorFilteredGames(t){const e=this.url(`/slotintegrator-service/searchGameByName/${t}`),s=await this.GET(e);return null!=s?s:[]}async login({login:t,password:e}){this.token=void 0;const s=this.url("/account/LogIn",api.LBC),a={Login:t,Password:e,Culture:this.locale},i=await this.POST(s,a),{Data:n}=null!=i?i:{};return!n&&IS_DEV_MODE&&console.log("\n```\n/account/LogIn:\n",i,"\n```\n"),n&&n.UserId>0&&n["X-Token"]?(this.token=n["X-Token"],this.user=n,this.user):(this.user={},this.user)}async getUserData_OLD(){const t=this.url("/account/GetUserData",api.LBC),e=await this.GET(t);return(null==e?void 0:e.UserId)>0?(this.user=e,e):(this.user={},null)}async getUserData(){const t=this.url("/account/GetUserData",api.LBC),{data:e,status:s,statusText:a}=await this.request(t).exec();return this.user=(null==e?void 0:e.UserId)>0?e:{},this.responseHandlerData(e,s,a)}async getUserFullData(){return await this.getUserData()}async logout(){const t=this.url("/account/LogOut",api.LBC),e=await this.POST(t),s=!1===e;return this.user={},this.token=void 0,{ok:s,isLogged:!!s&&e}}async balance(){if(this.isSinged){const t=this.url("/account/GetUserBalance",api.LBC),e=await this.GET(t);return null!=e?e:{}}return{}}async getBalance(){const t=this.url("/account/GetUserBalance",api.LBC),{data:e,status:s,statusText:a}=await this.request(t).exec();return this.responseHandlerData(e,s,a)}async changePassword(t){var e;if(this.isSinged){t.userData.Gmt=(new Date).getTimezoneOffset()/60,t.userData.Language=this.languageId;const s=this.url("/account/ChangeUserPassword",api.LBC),a=await this.POST(s,t);return console.log(a),{ok:!a.IsError||!1,status:null!==(e=a.ErrorCode)&&void 0!==e?e:5001}}return{ok:!1,status:5001}}longToGuid(t){const e=new ArrayBuffer(16);new DataView(e).setUint32(0,t,!0);const s=Array.from(new Uint8Array(e));return[s.slice(0,4).reverse(),s.slice(4,6).reverse(),s.slice(6,8).reverse(),s.slice(8,10),s.slice(10,16)].map((t=>t.map((t=>t.toString(16).padStart(2,"0"))).join(""))).join("-")}async getSportsEventsSearch(t){var e,s;if(!t)return[];const a=this.url("/line/SearchFullByCulture",api.V2),i={culture:this.locale,searchText:t},[n,r]=await Promise.all([null!==(e=this.GET(a,i))&&void 0!==e?e:[],null!==(s=this.getFullLiveWithoutSaveTimeStamp())&&void 0!==s?s:[]]),l=n.filter((t=>t.Type>1)).map((t=>{var e;const s=new Date(null!==(e=null==t?void 0:t.Date)&&void 0!==e?e:"").toLocaleDateString(this.locale,{weekday:"short",day:"2-digit",month:"long",hour:"2-digit",minute:"2-digit"}).replace(",","");return Object.assign(t,{Date:s,to:{name:"eventprematch",params:{prEventId:routeNameId(t.Id,t.Name)}},t1:t.Name.split(/\s*\-\s*/)[0],t2:t.Name.split(/\s*\-\s*/)[1]})})),o=t.toLowerCase();return[...r.filter((t=>t.Description.NameTeam1.toLowerCase().includes(o)||t.Description.NameTeam2.toLowerCase().includes(o)||t.Description.TName.toLowerCase().includes(o))).map((t=>{const e=`${t.Description.NameTeam1} vs ${t.Description.NameTeam2} ${t.Description.SportName}`,s=new Date(t.Description.Date).toLocaleDateString(this.locale,{weekday:"short",day:"2-digit",month:"long",hour:"2-digit",minute:"2-digit"}).replace(",","");return{CountryId:t.Description.CountryId,Date:s,Id:+t.Id,Name:e,PriceNum:t.Description.PriceNum,SportId:t.Description.SportId,SportName:t.Description.SportName,TournamentId:t.Description.TournamentId,TournamentName:t.Description.TName,Type:3,isLive:!0,to:{name:"eventinplay",params:{prEventId:routeNameId(t.Id,e)}},t1:t.Description.NameTeam1,t2:t.Description.NameTeam2}})),...l]}async getFavorites(){if(this.isSinged){const t=this.url("/favorites/GetFavorites",api.V2),e=await this.GET(t,{culture:this.locale});return null!=e?e:[]}return[]}async addFavorite(t,e){if(this.isSinged){const s=this.url("/favorites/AddToFavorites",api.V2),a=await this.POST(s,{},{id:t,type:e});return null!=a&&a}return!1}async removeFavorite(t){if(this.isSinged){const e=this.url("/favorites/RemoveFromFavorites",api.V2),s=await this.POST(e,{id:t});return null!=s&&s}return!1}async getPurses(t=5){if(this.isSinged){const e=this.url("/account/GetPurses",api.V2),s={psType:t},a=await this.GET(e,s);return null!=a?a:[]}return[]}async sendWithdrawal(t,e){}async sendWithdrawalAgent(t){if(this.isSinged){const e={securityCode:"",secAnswer:"",additionalParams:{}};Object.assign(e,t);const s=this.url("/payment/CreateOrderWithdraw",api.LBC),a=await this.POST(s,e);if(isNaN(parseFloat(a)))return{ok:!1,status:a};{const t=await this.getOrderedTransactions();return{ok:!0,balance:parseFloat(a),userOrders:t}}}return{ok:!1,status:10016}}async cancelOrderedTransaction(t){if(this.isSinged){const e=this.url("/payment/CancelOrderedTransaction",api.LBC),s=await this.POST(e,t);if(-1===s)return{ok:!1,status:103};if(isNaN(parseFloat(s)))return{ok:!1,status:103};{const t=await this.getOrderedTransactions();return{ok:!0,balance:parseFloat(s),userOrders:t}}}return{ok:!1,status:10016}}async getMovementOfMoney(t){var e;if(this.isSinged){Object.assign(t,{culture:this.locale});const s=this.url("/account/GetAccountTransactions",api.V2),a=await this.GET(s,t),i=(null!==(e=null==a?void 0:a.TransactionsDataList)&&void 0!==e?e:[]).map((t=>{var e;return{income:null!==(e=t.IsAddition)&&void 0!==e&&e,sign:t.IsAddition?"+":"-",id:t.Id,typeId:t.TransactionType,typeName:t.TransactionDescription,date:t.TransactionDate,value:t.Amount,amount:t.Amount,bonus:t.Bonus,balance:t.Balance}}));return{result:i}}return{result:[]}}async getOrderedTransactions(){if(this.isSinged){const t=this.url("/account/GetOrderedTransactions",api.V2);return await this.GET(t)}return[]}async getBetContent(t){const e={id:t,culture:this.locale};if(this.isSinged){const t=this.url("/account/GetBetContent",api.V2);return await this.GET(t,e)}return{}}async getUserBets(t){if(Object.assign(t,{culture:this.locale}),this.isSinged){const e=this.url("/account/GetUserBets",api.V2);return await this.GET(e,t)}}async getUserBets02(t){if(Object.assign(t,{culture:this.locale}),this.isSinged){const e=this.url("/account/GetUserBets",api.V2),{data:s,status:a,statusText:i}=await this.request(e).query(t).exec();return{data:null!=s?s:null,error:200!==a?i:null,status:a,statusText:i}}return{data:null,error:"Unauthorized",status:401,statusText:"Unauthorized"}}async getOddsForEdit(t){const e=this.url("/betting/GetBetForChange",api.LBC),{data:s,status:a,statusText:i}=await this.request(e).POST(t).exec(),n=this.convertDataData(s);return this.responseHandlerData(n,a,i)}async placeCouponEdited(t){const e=this.url("/betting/ChangeBet",api.LBC),{data:s,status:a,statusText:i}=await this.request(e).POST(t).exec(),n=this.convertDataData(s);return this.responseHandlerData(n,a,i)}async getUserBetsCashout(t){const e=this.url("/betting/CheckCashoutForBets",api.LBC),{data:s,status:a,statusText:i}=await this.request(e).POST({BetIds:t}).exec();return this.responseHandlerData(s,a,i)}async cashoutHandler(){var t,e;const s=null!==(e=null===(t=this.user)||void 0===t?void 0:t.UserId)&&void 0!==e?e:0,a=this.url(`/stats/cashout/${s}`,api.NV20),{data:i,status:n,statusText:r}=await this.request(a).GET().setTimeout(6500).exec(),l=this.convertDataData(i);return this.responseHandlerData(l,n,r)}async returnCashoutBet(t){const e=this.url("/betting/CashOutReturnBet",api.LBC),{data:s,status:a,statusText:i}=await this.request(e).POST(t).exec(),n=this.convertDataData(s);return this.responseHandlerData(n,a,i)}createCoupon(t,e,s,a=-1){var i,n,r,l,o;const u={betAmount:e,doAcceptOddsChanges:s,statuses:{},systemIndex:a};for(let e=0;e<t.length;e++){const s=t[e],a=[null!==(i=s.LinesID)&&void 0!==i?i:"null",null!==(n=s.BetVarID)&&void 0!==n?n:"null",null!==(r=s.HandSize)&&void 0!==r?r:"null",null!==(l=s.Add1)&&void 0!==l?l:"null",null!==(o=s.Add2)&&void 0!==o?o:"null"].join("_");u.statuses[a]=!0}return u}async placeCoupon(t){if(this.isSinged){const e=this.url("/betting/PlaceBet",api.LBC);return await this.POST(e,t)}}async placeCouponBetShop(t){if(this.isSinged){const e=this.url("/betting/PlaceBetSubCashier",api.LBC);return await this.POST(e,t)}}async getBetShopCouponByCode(t){if(this.isSinged){const e=this.url("/betting/GetBetSubCashier",api.LBC),s={code:t,culture:this.locale},{data:a,status:i,statusText:n}=await this.request(e).query(s).exec();return this.responseHandlerData(a,i,n)}}async loginIsExist(t){const e=this.url("/account/IsUserExists",api.LBC);return await this.GET(e,{userName:t})}async emailIsExist(t){const e=this.url("/account/IsEmailExists",api.LBC);return await this.GET(e,{email:t})}async changePersonalData(t){if(this.isSinged){const e=this.url("/account/ChangePersonalData",api.LBC);return await this.POST(e,t)||!1}return!1}async getMessagesAll({page:t,pageSize:e}){if(this.isSinged){const s=this.url("/messages/GetAllMessages",api.LBC),a=await this.GET(s,{page:t,pageSize:e});return null!=a?a:[]}return[]}async getMessageById(t){var e;if(this.isSinged){const s=this.url("/messages/GetMessagesById",api.LBC);return null!==(e=(await this.GET(s,{id:t}))[0])&&void 0!==e?e:{}}return{}}async sensMessage({ToUserId:t,Text:e,Subject:s,ParentId:a}){if(this.isSinged){const i=this.url("/messages/SendMessage",api.LBC),n=await this.POST(i,{ToUserId:t,Text:e,Subject:s,ParentId:a});return null!=n?n:null}return null}async markMessageAsRead({MessageId:t,MessageTypeId:e}){if(this.isSinged){const s=this.url("/messages/MarkMessageAsRead",api.LBC),a=await this.POST(s,{MessageId:t,MessageTypeId:e});return null!=a?a:null}return null}async deleteMessage({MessageId:t,MessageTypeId:e}){if(this.isSinged){const s=this.url("/messages/DeleteMessage",api.LBC),a=await this.POST(s,{MessageId:t,MessageTypeId:e});return null!=a?a:null}return null}async deleteMessagesAll(){if(this.isSinged){const t=this.url("/messages/DeleteAllMessages",api.LBC),e=await this.POST(t,{});return null!=e?e:null}return null}async getMessagesCount(){if(this.isSinged){const t=this.url("/messages/GetMessagesCount",api.LBC),e=await this.GET(t,{});return null!=e?e:null}return null}async getMessagesUnreadCount(){if(this.isSinged){const t=this.url("/messages/GetCountUnreadMessages",api.LBC),e=await this.GET(t,{});return null!=e?e:null}return null}async isUserTempExist(t){const e=this.url("/account/IsUserExistsInTemp",api.LBC),{data:s}=await this.request(e).query({userName:t}).exec();return null!=s?s:null}async createUserTemp(t){var e,s;const a=this.url(`/account/${this.locale}/UserRegistrationOnlyInTepm`),{data:i}=await this.request(a).POST(t).exec(),n=null!==(s=null===(e=null==i?void 0:i.Data)||void 0===e?void 0:e._isSuccessful)&&void 0!==s?s:null;return null!=n?n:null}async getGamesListGR(t={platforms:"desktop"}){const e=this.url("/Softquo/GetGamesList",api.DIRECT),{data:s,status:a,statusText:i}=await this.request(e).POST(t).exec();return this.responseHandlerData(s,a,i)}async getGameFrameUrlGR(t){const e=this.url("/Softquo/InitGame",api.DIRECT),{data:s,status:a,statusText:i}=await this.request(e).query(t).exec();return this.responseHandlerData(s,a,i)}async pingApi(){const t=this.url("/account/Ping",api.LBC),{data:e,status:s,statusText:a}=await this.request(t).exec();return this.responseHandlerData(e,s,a)}async intgrGetGamesList(t){const e=this.url("/Games/GetGamesList",api.DIRECT),{data:s,status:a,statusText:i}=await this.request(e).POST(t).exec();return this.responseHandlerData(s,a,i)}async intgrGetGameTypes(t){const e=this.url("/Games/GetGameTypes",api.DIRECT),{data:s,status:a,statusText:i}=await this.request(e).POST().query({groupId:t}).exec();return this.responseHandlerData(s,a,i)}async intgrGetProvidersList(t){const e=this.url("/Games/GetGameProviders",api.DIRECT),{data:s,status:a,statusText:i}=await this.request(e).POST().query({groupId:t}).exec();return this.responseHandlerData(s,a,i)}async intgrGetTopGames(t){const e=this.url("/Games/GetTopGames",api.DIRECT),{data:s,status:a,statusText:i}=await this.request(e).POST().query({groupId:t}).exec();return this.responseHandlerData(s,a,i)}async intgrInitGame(t){const e=this.url("/Games/InitGame",api.DIRECT),{data:s,status:a,statusText:i}=await this.request(e).query(t).exec();return this.responseHandlerData(s,a,i)}async checkPromocode(t){}async activatePromocode(t){}async sendSms(t){}async signUpPhone(t){}async passwordRecoveryRequest(t){}async passwordRecoveryEmail(t){}async passwordSetNewByPhone(t){}async passwordSetNewByEmail(t){}async signUpEmail(t){}async getUserPersonalInfo(){}async sendPayment(t,e){}async setUserPersonalInfo(t){}async getGamesToken(t){}async getProviderHedlines(t){}async createTempSignUp({login:t,password:e}){}async setRemoteLanguage(t){return null!=t||(t=this.lang),await this.setLanguageRemoteLocale(t)}convertBonuses(t){let e=[];return Object.keys(t).forEach((s=>{const a=s.match(/B_Koef(\d)_Value/);if(a){const s=a[1];e.push(["Koef",t[`B_Koef${s}`],t[`B_Koef${s}_Value`]])}const i=s.match(/B_Kolvo(\d)_Value/);if(i){const s=i[1];e.push(["Kolvo",t[`B_Kolvo${s}`],t[`B_Kolvo${s}_Value`]])}"B_Perestavka_Value"===s&&e.push(["Perestavka",!0,t.B_Perestavka_Value]),"B_MinOdds"===s&&e.push(["MinOdds",!0,t.B_MinOdds])})),e}async getBetslip_OLD(){var t,e;const s=this.url("/betting/GetBetslip",api.LBC),a=await this.GET(s,{});return a.bonuses=this.convertBonuses(null!==(t=null==a?void 0:a.Bonus)&&void 0!==t?t:{}),null!==(e=a.Bets)&&void 0!==e||(a.Bets=[]),delete a.Bonus,null!=a?a:{}}async getBetslip(){var t,e;const s=this.url("/betting/GetBetslip",api.LBC);let{data:a,status:i,statusText:n}=await this.request(s).exec();return null!=a||(a={}),a.bonuses=this.convertBonuses(null!==(t=null==a?void 0:a.Bonus)&&void 0!==t?t:{}),null!==(e=a.Bets)&&void 0!==e||(a.Bets=[]),delete a.Bonus,a}async clearBetslip(){const t=this.url("/betting/ClearBetslip",api.LBC),e=await this.POST(t);return null!=e&&e}async changeBetslipType(t){const e=this.url("/betting/ChangeBetslipType",api.LBC),s=await this.POST(e,{},{betslipType:t});return null!=s&&s}async setBetslipSettings(t){if(this.isSinged){const e=this.url("/betting/SetBetslipSettings",api.LBC),s=await this.POST(e,t);return null!=s?s:[]}return[]}async addToBetslip(t){t.culture=this.locale;const e=this.url("/betting/AddToBetslip",api.LBC),s=await this.POST(e,t);return null!=s?s:null}async removeFromBetslip(t){t.culture=this.locale;const e=this.url("/betting/RemoveFromBetslip",api.LBC);return await this.POST(e,t)||!1}async removeBonus(){const t=this.url("/betting/DeleteBonus",api.LBC),e=await this.POST(t);return null!=e&&e}async addBonus(t){const e=this.url("/betting/AddBonus",api.LBC),s=await this.POST(e,{},{odd:t});return null!=s?s:null}async updateBet(t){t.culture=this.locale;const e=this.url("/betting/UpdateBet",api.LBC);return null===await this.POST(e,t)}async getBetsLimits(){if(this.isSinged){const t=this.url("/betting/GetLimitations",api.LBC),e=await this.GET(t);return null!=e?e:{Min:0,Max:0}}return{Min:0,Max:0}}async getBetsLimitsNew(){var t,e,s;if(this.isSinged){const a=this.url("/betting/GetLimitations",api.LBC),{data:i,status:n,statusText:r}=await this.request(a).exec(),l={Min:null!==(t=null==i?void 0:i.Min)&&void 0!==t?t:0,Max:null!==(e=null==i?void 0:i.Max)&&void 0!==e?e:0,MaxOddForMulty:null!==(s=null==i?void 0:i.MaxOddForMulty)&&void 0!==s?s:250};return this.responseHandlerData(l,n,r)}return{data:{Min:0,Max:0,MaxOddForMulty:250},status:200,statusText:"OK"}}async getCurrencies(){if(this.isSinged){const t=this.url("/location/GetCurrencies",api.V2),e=await this.GET(t);return null!=e?e:[]}return null}async getCountries(){if(this.isSinged){const t=this.url("/location/GetCountries",api.V2),e=await this.GET(t);return null!=e?e:[]}return null}async getAllKeys(t){const e=this.url("/info/GetAllKeys",api.LBC),s=await this.GET(e,{key:t,culture:this.locale});return null!=s?s:[]}async getSlides(t){null!=t||(t="https://f004.backblazeb2.com/file/betroute/slides.json");const e=this.url(t),{data:s,status:a,statusText:i}=await this.request(e).deleteAllHeaders().exec();return this.responseHandlerData(s,a,i)}async getSiteSlidesSections(t){null!=t||(t="https://f004.backblazeb2.com/file/betroute/slides.json");const e=this.url(t),{data:s,status:a,statusText:i}=await this.request(e).deleteAllHeaders().exec();return this.responseHandlerData(s,a,i)}async getEventStatisticData(t){const e=this.url(`/stats/data/${t}/${this.locale}`,api.NV20),{data:s,status:a,statusText:i}=await this.request(e).exec();return this.responseHandlerData(s,a,i)}async getEventStatisticPage(t){const e=this.url(`/stats/page/${t}/${this.locale}`,api.NV20),{data:s,status:a,statusText:i}=await this.request(e).exec();return this.responseHandlerData(s,a,i)}async searchPrematchEventsNv20(t,e={}){var s;const a=this.url("/stats/pm/search",api.NV20);t=null!==(s=null==e?void 0:e.searchString)&&void 0!==s?s:t.split(/\s+/).filter((t=>!0!==/\d/.test(t)&&t.length>1)).join(" ").trim();const i=Object.assign(Object.assign(Object.assign(Object.assign({locale:this.locale,searchString:t},(null==e?void 0:e.LIMIT)?{LIMIT:e.LIMIT}:{LIMIT:{from:0,size:30}}),(null==e?void 0:e.negativeString)?{negativeString:e.negativeString}:{}),(null==e?void 0:e.sportId)?{sportId:e.sportId}:{}),(null==e?void 0:e.tournamentId)?{tournamentId:e.tournamentId}:{}),{data:n,status:r,statusText:l}=await this.request(a).POST(i).exec();return n.searchString=t,n.from=i.LIMIT.from,n.size=i.LIMIT.size,this.responseHandlerData(n,r,l)}async searchPrematchEventsIdsNv20(t){var e,s;const a=this.url("/stats/pm/search/ids",api.NV20);null!==(e=t.locale)&&void 0!==e||(t.locale=this.locale),null!==(s=t.LIMIT)&&void 0!==s||(t.LIMIT={from:0,size:30});const{data:i,status:n,statusText:r}=await this.request(a).POST(t).exec();return i.from=t.LIMIT.from,i.size=t.LIMIT.size,this.responseHandlerData(i,n,r)}async searchPrematchTournametsEventsNv20(t,e={}){var s,a,i;const{data:n,status:r,statusText:l}=await this.searchPrematchEventsNv20(t,e),o=(null!==(s=null==n?void 0:n.documents)&&void 0!==s?s:[]).reduce(((t,e)=>{const s=e.EventKeys.TurnirID;return t[s]||(t[s]=[]),t[s].push(e),t}),{}),u={tournaments:Object.entries(o).map((([t,e])=>({Id:t,Name:e[0].TourneyName.trim(),SportName:e[0].SportName,SportID:e[0].EventKeys.SportID,EventsHeaders:e}))),total:null!==(a=null==n?void 0:n.total)&&void 0!==a?a:0,searchString:null!==(i=null==n?void 0:n.searchString)&&void 0!==i?i:""};return this.responseHandlerData(u,r,l)}async sendErrInfo(t,e){const s=this.url("/err/send/front",api.NV20),{data:a,status:i,statusText:n}=await this.request(s).POST({text:t,code:e}).exec();return this.responseHandlerData(null==a?void 0:a.ok,i,n)}async cloneBetCoupon(t){var e,s;const a=this.url("/betting/TryGetBetCopy",api.LBC);null!==(e=t.betId)&&void 0!==e||(t.betId=null),null!==(s=t.code)&&void 0!==s||(t.code=null),t.culture=this.locale;const{data:i,status:n,statusText:r}=await this.request(a).query(t).exec();return this.responseHandlerData(i,n,r)}async getAllBanners(){const t=this.url("/info/GetAllBanners",api.LBC),e=await this.GET(t,{culture:this.locale});return null!=e?e:[]}async getCdnSlidesData(t,e,s){var a,i;const n={};if(s&&s.length>0&&(n["slider-main"]=s),!t||0===e.length)return n;let r=await Promise.all(e.map((t=>{const e=this.url(`/stats/slides/${t}`,api.NV20);return this.request(e).deleteAllHeaders().exec()})));for(const t of r)for(const[e,s]of Object.entries(null!==(a=null==t?void 0:t.data)&&void 0!==a?a:{})){null!==(i=n[e])&&void 0!==i||(n[e]=[]);for(const t of s)n[e].push(t)}return n}async depositBetKiosk(t){const e=this.url("/betting/DepositMoneyBetshopPlayer",api.LBC),{data:s,status:a,statusText:i}=await this.request(e).query({sum:t}).exec();return this.responseHandlerData(s,a,i)}async depositBetKioskV2(t){const e=this.url("/betting/DepositMoneyBetshopPlayer",api.LBC),{data:s,status:a,statusText:i}=await this.request(e).query({sum:t}).exec();return this.responseHandlerDataData(s,a,i)}async getFaq(){const t=this.url("/info/GetFaq",api.LBC),e=await this.GET(t,{culture:this.locale});return null!=e?e:[]}async getFlatpagesList(){return[]}async test3(){return"test3 Ok"}async sellBet(t){}convertBasketToPost(t){return{a1:t.Add1,a2:t.Add2,bId:t.BetVarID,eId:t.LinesID,fs:t.HandSize,isLive:t.IsLive,r:t.Odds}}async getSiteLocation(t,e){const s=this.url(`/sitelocation/${t}/${e}/${this.lang}`,api.NV20),{data:a,status:i,statusText:n}=await this.request(s).exec();return this.responseHandlerData(a,i,n)}}
1
+ import{api}from"./Types.js";const locales={en:"en-US",pt:"en-US",fr:"fr-FR",ht:"fr-FR",es:"en-US",tr:"tr-TR",az:"tr-TR",uk:"en-US",cr:"fr-FR",ru:"ru-RU"},languageIdsRemote={en:1,pt:1,fr:4,es:1,tr:5,az:5,uk:1,cr:1,ru:0},MAX_TIME_EXECUTION_MS=25e3,stringify=t=>JSON.stringify(t,null,2);function convertBasketToPost(t){return{a1:t.Add1,a2:t.Add2,bId:t.BetVarID,eId:t.LinesID,fs:t.HandSize,isLive:t.IsLive,r:t.Odds}}export function routeNameId(t,e=""){return`${e.replace(/[\s\.\,\(\)\[\]\\\/\-\~\`\"\']+/g," ").trim().replace(/\s+/g,"-").toLowerCase()}~${t}`}export function clearPhone(t,e="",s=""){return e+(String(t).match(/\d+/g)||[]).join("")+s}let IS_DEV_MODE=!1;export class BetBoosterApi{constructor(t,e,s="en",a=15e3,i=!1){this._locale="en-EN",this._locales=locales,this._languageIdsRemote=languageIdsRemote,this.EXIST_LANGUAGES=Object.keys(locales),this._languageId=1,this._lang="en",this._USER_DATA={},this.LANG_DEFAULT="en",this.LOCALE_DEFAULT="en-EN",this.LANG_ID_DEFAULT=1,this.maxTimeExecutionMs=25e3,this.liveTimestamp=0,this._liveTimestampReset=!1,this.liveRecivedIsFullPackage=!1,this.isNotActive=!1,this.primarySports=[5,1,3,4,8,6,263,265,2,16,17,18],this.priorityCountries={1:[14,8,54],5:[8,14,1,2,5,4,3,43,44,42,11,54],6:[14,8,54],8:[8,14,54],27:[45,187]},this.priorityTournaments={5:[201,361,199,410,200,423,1141,1142,47,2408,1688,2511,129,193,919,1693,1134,2157,147,212,1,185,2,2379,286,1216,99,1266,4,290,735,1059,1100,1268,5,292,1210,1366,700,1217,3,186,2209,2431,288,1410,6,540,1062,1223,1061,1237,40,1235,2230,2370,209,1278,470,1373,35,1386,2229,2373,737,1383,1412,1857,1505,1858,11,1853,2231,742,1382,49,1236,1060,2364,624,15,1896,1409,1493,1918,1925,2283,1612,86,149,2337,8,1213,19,1387]},IS_DEV_MODE=i,this.maxTimeExecutionMs=a,this.axi=t,this.setBaseUrl(e),this.setLanguage(s)}get locale(){return this._locale}get isSinged(){return void 0!==this.user&&void 0!==this.user.UserId&&this.user.UserId>0}get user(){return this._USER_DATA}get userMain(){var t,e,s,a,i,n,r,l,o,u,c,d,h,g;return[`uid: ${null!==(e=null===(t=this._USER_DATA)||void 0===t?void 0:t.UserId)&&void 0!==e?e:"--"}`,`unm: ${null!==(a=null===(s=this._USER_DATA)||void 0===s?void 0:s.UserName)&&void 0!==a?a:"--"}`,`pid: ${null!==(n=null===(i=this._USER_DATA)||void 0===i?void 0:i.PointId)&&void 0!==n?n:"--"}`,`ptp: ${null!==(l=null===(r=this._USER_DATA)||void 0===r?void 0:r.PlayerType)&&void 0!==l?l:"--"}`,`gid: ${null!==(u=null===(o=this._USER_DATA)||void 0===o?void 0:o.GroupID)&&void 0!==u?u:"--"}`,`bal: ${null!==(d=null===(c=this._USER_DATA)||void 0===c?void 0:c.Amount)&&void 0!==d?d:"--"}`,`cur: ${null!==(g=null===(h=this._USER_DATA)||void 0===h?void 0:h.CurrencyName)&&void 0!==g?g:"--"}`]}set user(t){this._USER_DATA=t}get lang(){return this._lang}get languageId(){return this._languageId}get token(){var t;return null!==(t=this._TOKEN)&&void 0!==t?t:void 0}set token(t){this._TOKEN="string"==typeof t?t.split(/\s*,\s*/)[0]:void 0}responseHandlerData(t,e,s){var a,i,n;let r=null;void 0!==(null===(a=null==t?void 0:t.Data)||void 0===a?void 0:a.Data)?r=t.Data.Data:void 0!==(null===(i=null==t?void 0:t.Data)||void 0===i?void 0:i._isSuccessful)?r=t.Data._isSuccessful:void 0!==(null==t?void 0:t.Data)?r=t.Data:void 0!==t&&(r=t);const l=(null===(n=null==t?void 0:t.Data)||void 0===n?void 0:n.Error)||(null==t?void 0:t.Error)||(e>=300?s:null)||(r?null:"Unknown error");return"Object reference not set to an instance of an object."===l&&console.log("!!!!!!!!!!! Object reference not set to an instance of an object."),{data:r,error:l,status:e,statusText:s}}responseHandlerDataData(t,e,s){var a,i,n,r;let l=null;void 0!==(null===(a=null==t?void 0:t.Data)||void 0===a?void 0:a.Data)&&void 0!==(null==t?void 0:t.Data)?l=t.Data:void 0!==(null===(i=null==t?void 0:t.Data)||void 0===i?void 0:i.Data)?l=t.Data.Data:void 0!==(null===(n=null==t?void 0:t.Data)||void 0===n?void 0:n._isSuccessful)?l=t.Data._isSuccessful:void 0!==(null==t?void 0:t.Data)?l=t.Data:void 0!==t&&(l=t);const o=(null===(r=null==t?void 0:t.Data)||void 0===r?void 0:r.Error)||(null==t?void 0:t.Error)||(e>=300?s:null)||(l?null:"Unknown error");return"Object reference not set to an instance of an object."===o&&console.log("!!!!!!!!!!! Object reference not set to an instance of an object."),{data:l,error:o,status:e,statusText:s}}convertDataData(t){var e;if(void 0!==(null===(e=null==t?void 0:t.Data)||void 0===e?void 0:e.Data)){const e=Object.keys(t.Data);if(e.length>0){const s={};return e.forEach((e=>{var a;s[e.toLowerCase()]=null!==(a=t.Data[e])&&void 0!==a?a:null})),s}}return t}setDevMode(t){IS_DEV_MODE=void 0===t||t}addLocalesConverters(t){this._locales=Object.assign(Object.assign({},this._locales),t);const e=new Set([...this.EXIST_LANGUAGES,...Object.keys(this._locales)]);this.EXIST_LANGUAGES=Array.from(e)}checkLanguage(t="en"){try{const e=t.substring(0,2)||this.LANG_DEFAULT;return this.EXIST_LANGUAGES.includes(e)?e:this.LANG_DEFAULT}catch(t){return this.LANG_DEFAULT}}setLanguage(t="en"){var e,s;return this._lang=this.checkLanguage(t),this._locale=null!==(e=this._locales[this._lang])&&void 0!==e?e:this.LOCALE_DEFAULT,this._languageId=null!==(s=this._languageIdsRemote[this._lang])&&void 0!==s?s:this.LANG_ID_DEFAULT,this._lang}async setLanguageRemoteLocale(t="en"){if(this.setLanguage(t),this.isSinged){const t=this.url("/account/SetLanguage",api.LBC);return await this.POST(t,{culture:this.locale})||!1}}setBaseUrl(t){return t.endsWith("/")&&(t=t.slice(0,-1)),this._baseUrl=t,this._baseUrl}statusHandler(t,e){401===t&&(this.user={},this.token=void 0,IS_DEV_MODE&&console.log("Status:",t,e))}queryStringHandler(t={}){return Object.keys(t).forEach((e=>{null===t[e]?t[e]="null":!0===t[e]?t[e]="true":!1===t[e]?t[e]="false":void 0===t[e]&&(t[e]="")})),t}responseHandler(t){var e,s,a,i;const n=null!==(s=null!==(e=null==t?void 0:t.headers["x-token"])&&void 0!==e?e:null==t?void 0:t.headers["X-token"])&&void 0!==s?s:null;IS_DEV_MODE&&(null===(a=null==t?void 0:t.request)||void 0===a?void 0:a.path)&&console.log(null===(i=null==t?void 0:t.request)||void 0===i?void 0:i.path),n&&(this.token=n,IS_DEV_MODE&&console.log("isSinged:",this.isSinged+"\nX-Token:",n))}axiosErrorHandler(t){var e,s,a,i,n,r,l,o;let u,c=null!==(s=null===(e=t.response)||void 0===e?void 0:e.status)&&void 0!==s?s:null,d=null!==(i=null===(a=t.response)||void 0===a?void 0:a.statusText)&&void 0!==i?i:null;const h=null!==(n=t.response)&&void 0!==n?n:null;if(h){if(u=[...c?[c]:[],...d?[d]:[],...(null===(r=null==h?void 0:h.data)||void 0===r?void 0:r.Message)?[h.data.Message]:[],...(null===(l=null==h?void 0:h.data)||void 0===l?void 0:l.MessageDetail)?[h.data.MessageDetail]:[]].join(" > "),IS_DEV_MODE){const t=(null!==(o=h.config.method)&&void 0!==o?o:"").toUpperCase(),e=h.config.url,s=h.config.data;console.log("```"),console.log("ERROR:",t,e),console.log("DATA:",s),console.log("RESPONCE:",null==h?void 0:h.data),console.log("```")}}else t.request?(u="Error: No response received",c=503,d="Service Unavailable"):(u=`Error: ${null==t?void 0:t.message}`,c=601,d=(null==t?void 0:t.message)||"Unknown error");return console.error("Axios request error:",u),{data:null,status:c,statusText:u||d||"Unknown error"}}url(t,e){if(t.toLowerCase().startsWith("http"))return t;switch(e){case api.V2:return`${this._baseUrl}/v2/bsw/api${t}`;case api.NV20:return`${this._baseUrl}/nv20${t}`;case api.LBC:return`${this._baseUrl}/v2/lbc/api${t}`;case api.DIRECT:return`${this._baseUrl}${t}`;case api.V1:default:return`${this._baseUrl}/api${t}`}}sortDataByPriority(t,e,s){const a=new Map;return e.forEach(((t,e)=>{a.set(t,e)})),t.slice().sort(((t,e)=>(a.has(t[s])?a.get(t[s]):1/0)-(a.has(e[s])?a.get(e[s]):1/0)))}sortArrayByPriority(t,e){const s=new Map;return e.forEach(((t,e)=>{s.set(t,e)})),t.slice().sort(((t,e)=>(s.has(t)?s.get(t):1/0)-(s.has(e)?s.get(e):1/0)))}request(t){const e=this.queryStringHandler,s=this.axi,a=this.axiosErrorHandler,i=(t,e)=>{401===t&&(this.user={},this.token=void 0,IS_DEV_MODE&&console.log("Status:",t,e))},n=async t=>{var e,s;try{console.error(t);const a=["undefined"!=typeof window?window.location.href:"url: unknown",`Error: ${(null==t?void 0:t.error)||"Unknown error"}`,...this.userMain].filter(Boolean).join("\n");let i="";try{i=null!==(e=JSON.stringify(t,null,2))&&void 0!==e?e:"Unknown error"}catch(e){i=null!==(s=null==t?void 0:t.error)&&void 0!==s?s:"Unknown error"}await this.sendErrInfo(a,i)}catch(t){}},r=t=>{var e,s,a,i,r,l,o,u,c,d,h,g,v,p;const m=null!==(e=null==t?void 0:t.headers["x-token"])&&void 0!==e?e:null,T=null!==(a=null===(s=null==t?void 0:t.request)||void 0===s?void 0:s.path)&&void 0!==a?a:null;if(null===(i=null==t?void 0:t.data)||void 0===i?void 0:i.Error){const e=(null!==(l=null===(r=null==t?void 0:t.config)||void 0===r?void 0:r.method)&&void 0!==l?l:"").toUpperCase(),s=Object.assign(Object.assign(Object.assign({method:e,url:(null===(o=null==t?void 0:t.config)||void 0===o?void 0:o.url)||""},(null===(u=null==t?void 0:t.config)||void 0===u?void 0:u.params)?{params:null!==(d=null===(c=null==t?void 0:t.config)||void 0===c?void 0:c.params)&&void 0!==d?d:""}:{}),(null===(h=null==t?void 0:t.config)||void 0===h?void 0:h.data)?{POST:null!==(v=null===(g=null==t?void 0:t.config)||void 0===g?void 0:g.data)&&void 0!==v?v:""}:{}),{error:null===(p=null==t?void 0:t.data)||void 0===p?void 0:p.Error});n(s)}IS_DEV_MODE&&T&&console.log(T),m&&(this.token=m,IS_DEV_MODE&&console.log("isSinged:",this.isSinged+"\nX-Token:",m))},l=Date.now()+Math.random(),o=t=>{var e;const s=null!==(e=null!=t?t:this.maxTimeExecutionMs)&&void 0!==e?e:25e3,a=new AbortController,i=setTimeout((()=>{a.signal.aborted||a.abort()}),s);return a.signal.addEventListener("abort",(()=>{clearTimeout(i)}),{once:!0}),{signal:a.signal,clearSignal:()=>clearTimeout(i),get isAborted(){return a.signal.aborted}}};let{signal:u,clearSignal:c}=o(this.maxTimeExecutionMs);const d={url:t,method:"GET",params:{_:l},headers:Object.assign({},this.token?{"X-Token":this.token}:{}),responseType:"json",timeoutErrorMessage:`Request timed out after ${this.maxTimeExecutionMs} ms`,signal:u};return{query(t={}){const s=e(t);return d.params=Object.assign(Object.assign({},s),d.params),this},headers(t={}){return d.headers=Object.assign(Object.assign({},d.headers),t),this},deleteAllHeaders(){return delete d.headers,this},setTimeout(t=25e3){return c(),({signal:u,clearSignal:c}=o(t)),d.timeoutErrorMessage=`Request timed out after ${t} ms`,d.signal=u,d.withXSRFToken=!0,this},GET(){return d.method="GET",this},POST(t={}){return d.method="POST",d.data=t,this},PUT(t={}){return d.method="PUT",d.data=t,this},DELETE(t={}){return d.method="DELETE",d.data=t,this},async exec(){"GET"!==d.method&&delete d.params._;const t=s.request(d).then((t=>(r(t),t))).catch(a).finally((()=>c())),{data:e,status:n,statusText:l}=await t;return i(n,l),{data:e,status:n,statusText:l}},async value(){const{data:t}=await this.exec();await t}}}async GET(t,e={},s={}){const a=new AbortController,i=setTimeout((()=>{a.abort()}),this.maxTimeExecutionMs),n={params:this.queryStringHandler(e),headers:Object.assign(Object.assign({},this.token?{"X-Token":this.token}:{}),null!=s?s:{}),responseType:"json",signal:a.signal},r=this.axi.get(t,n).then((t=>(this.responseHandler(t),t))).catch(this.axiosErrorHandler).finally((()=>clearTimeout(i))),{data:l,status:o,statusText:u}=await r;return this.statusHandler(o,u),l}async POST(t,e={},s={},a={}){const i=new AbortController,n=setTimeout((()=>{i.abort()}),this.maxTimeExecutionMs),r={params:this.queryStringHandler(s),headers:Object.assign(Object.assign({},this.token?{"X-Token":this.token}:{}),null!=a?a:{}),responseType:"json",signal:i.signal},l=this.axi.post(t,e,r).then((t=>(this.responseHandler(t),t))).catch(this.axiosErrorHandler).finally((()=>clearTimeout(n))),o=await l,{data:u,status:c,statusText:d}=o;return this.statusHandler(c,d),u}async DELETE(t,e={},s={},a={}){const i=new AbortController,n=setTimeout((()=>{i.abort()}),this.maxTimeExecutionMs),r={params:this.queryStringHandler(s),headers:Object.assign(Object.assign({},this.token?{"X-Token":this.token}:{}),null!=a?a:{}),responseType:"json",signal:i.signal,data:e},l=this.axi.delete(t,r).then((t=>(this.responseHandler(t),t))).catch(this.axiosErrorHandler).finally((()=>clearTimeout(n))),{data:o,status:u,statusText:c}=await l;return this.statusHandler(u,c),o}async PUT(t,e={},s={},a={}){const i=new AbortController,n=setTimeout((()=>{i.abort()}),this.maxTimeExecutionMs),r={params:this.queryStringHandler(s),headers:Object.assign(Object.assign({},this.token?{"X-Token":this.token}:{}),null!=a?a:{}),responseType:"json",signal:i.signal},l=this.axi.put(t,e,r).then((t=>(this.responseHandler(t),t))).catch(this.axiosErrorHandler).finally((()=>clearTimeout(n))),{data:o,status:u,statusText:c}=await l;return this.statusHandler(u,c),o}async getLineSports(t=0){var e;const s=+t>0?this.url(`/line/${this.locale}/sports/${t}`):this.url(`/line/${this.locale}/allSports`);return null!==(e=await this.GET(s,{},{}))&&void 0!==e?e:[]}async getHotEvents(){var t;const e=this.url(`/line/${this.locale}/hotevents`);return null!==(t=await this.GET(e,{},{}))&&void 0!==t?t:[]}async getCountriesList(t,e=0){var s;const a=this.url(`/line/${this.locale}/countries/sport${t}/${e}`);return null!==(s=await this.GET(a,{},{}))&&void 0!==s?s:[]}async getPrematchTournaments(t,e,s=0){var a;const i=this.url(`/line/${this.locale}/tournaments/sport${t}/country${e}/${s}`);return null!==(a=await this.GET(i,{},{}))&&void 0!==a?a:[]}async getPrematchTournamentsByMinutes(t=0,e=0){var s;const a=this.url(`/line/${this.locale}/events/full/sport${t}/${e}`);return(null!==(s=await this.GET(a,{},{}))&&void 0!==s?s:[]).filter((t=>{var e;return(null!==(e=null==t?void 0:t.EventsHeaders)&&void 0!==e?e:[]).length>0}))}async getPrematchTournamentsHeadersByMinutes(t=0,e=0){var s;const a=this.url(`/line/${this.locale}/tournaments/headers/sport${t}/${e}`);return null!==(s=await this.GET(a,{},{}))&&void 0!==s?s:[]}async getPrematchEvents(t,e,s,a){var i;const n=this.url(`/line/${this.locale}/events/sport${t}/country${e}/tourney${s}/${a}`);return null!==(i=await this.GET(n,{},{}))&&void 0!==i?i:[]}liveTimestampReset(t=!0){this._liveTimestampReset=t}async getLive(t=!1,e=[]){var s;let a=!1;(t||!0===this._liveTimestampReset)&&(this.liveTimestamp=0,this.liveTimestampReset(!1));const i=this.url(`/live/${this.locale}/full/${this.liveTimestamp}/0`),{data:n,status:r}=await this.request(i).GET().query({events:e}).exec(),{TimeStamp:l,LEvents:o,IsChanges:u}=null!=n?n:{};return a=!1===u,this.liveTimestamp=200===r&&null!==(s=null!=l?l:this.liveTimestamp)&&void 0!==s?s:0,{ts:+this.liveTimestamp,events:null!=o?o:[],isFullPackage:a}}async getFullLiveWithoutSaveTimeStamp(){var t;const e=this.url(`/live/${this.locale}/full/0/0`),s=null!==(t=await this.GET(e,{},{}))&&void 0!==t?t:{},{LEvents:a}=null!=s?s:{};return null!=a?a:[]}async getLiveEventsAndFullEvent(t){var e;const s=this.url(`/live/${this.locale}/bets/${t}`);return[null!==(e=await this.GET(s,{},{}))&&void 0!==e?e:{}]}async getLiveEventFull(t){const e=this.url(`/live/${this.locale}/bets/${t}`),{data:s}=await this.request(e).exec();return null!=s?s:null}async getEventPrematch(t){var e;const s=this.url(`/line/${this.locale}/event/${t}`);return null!==(e=await this.GET(s,{},{}))&&void 0!==e?e:{}}async verifyEmail(t){var e;const s=this.url(`/account/userActivationByEmail/${t}/${this.locale}`);return null!==(e=await this.GET(s,{},{}))&&void 0!==e?e:{}}async signUp(t){Object.assign(t,{Culture:this.locale});const e=this.url(`/account/${this.locale}/registration`);return await this.POST(e,t)}async signUpViaEmail(t){if(t.CurrencyId){const e=t.CurrencyId;t.PointId=e,delete t.CurrencyId}Object.assign(t,{Culture:this.locale});const e=this.url(`/account/${this.locale}/registrationNewEmail`);return await this.POST(e,t)}async signUpDirect(t){if(t.CurrencyId){const e=t.CurrencyId;t.PointId=e,delete t.CurrencyId}Object.assign(t,{Culture:this.locale});const e=this.url(`/account/${this.locale}/registrationNewWhithOutEmail`);return await this.POST(e,t)}async createInternetUser(t){var e,s;if(t.CurrencyId){const e=t.CurrencyId;t.PointId=e,delete t.CurrencyId}if(!(null==(t=Object.assign({},t,{Culture:this.locale}))?void 0:t.PointId))return{created:null,error:"parametersError",status:200,statusText:""};t.PointId&&t.PointId<1e4&&(t.PointId=t.PointId+1e4);const a=this.url(`/account/${this.locale}/registrationNewWhithOutEmail`),{data:i,status:n,statusText:r}=await this.request(a).POST(t).exec();return{created:null!==(s=null===(e=null==i?void 0:i.Data)||void 0===e?void 0:e._isSuccessful)&&void 0!==s?s:null,error:(null==i?void 0:i.Error)||null,status:n,statusText:r}}async getResultsSports(t,e){const s=this.url(`/results/${this.locale}/sports/0/${t}/${e}`);return await this.GET(s,{},{})}async getResultsTournamentsBySportId(t,e,s){const a=this.url(`/results/${this.locale}/tournaments/sport${t}/0/${e}/${s}`);return await this.GET(a,{},{})}async getResultsGrid(t,e,s,a,i){const n=this.url(`/results/${this.locale}/sport${t}/country${e}/tournament${s}/0/${a}/${i}`),r=await this.GET(n,{},{});return null!=r?r:[]}async getGamesProvidersTopGames(){const t=this.url("/slotintegrator-service/topGameByProvider"),e=await this.GET(t,{},{});return null!=e?e:[]}async getGamesTopProviders(){const t=this.url("/slotintegrator-service/topProviders"),e=await this.GET(t,{},{});return null!=e?e:[]}async getSlotsList(){const t=this.url("/slotintegrator-service/gamelist"),{items:e}=await this.GET(t,{},{});return null!=e?e:[]}async createSlotOutcome(t){return{}}async createSlotIntegratorDemo(t){const e=this.locale||"en";try{t.language=e.substring(0,2);const s=this.url("/slotintegrator-service/InitDemoGames"),a=await this.POST(s,t);return JSON.parse(a)}catch(t){return{}}}async createSlotIntegratorReal(t){try{const e=this.url("/slotintegrator-service/InitRealGames"),s=await this.POST(e,t);return JSON.parse(s)}catch(t){return{}}}async getSlotIntegratorProvidersHeaders(){try{const t=this.url("/slotintegrator-service/ProviderHeaders"),e=(await this.GET(t)||[]).map((t=>Object.assign(Object.assign({},t),{ProviderName:t.Provider,Games:[]})));return null!=e?e:[]}catch(t){return[]}}async getSlotIntegratorProviderAllGames(t){const e=this.url(`/slotintegrator-service/searchGameByProvider/${t}`),s=await this.GET(e);return null!=s?s:[]}async getSlotIntegratorFilteredGames(t){const e=this.url(`/slotintegrator-service/searchGameByName/${t}`),s=await this.GET(e);return null!=s?s:[]}async login({login:t,password:e}){this.token=void 0;const s=this.url("/account/LogIn",api.LBC),a={Login:t,Password:e,Culture:this.locale},i=await this.POST(s,a),{Data:n}=null!=i?i:{};return!n&&IS_DEV_MODE&&console.log("\n```\n/account/LogIn:\n",i,"\n```\n"),n&&n.UserId>0&&n["X-Token"]?(this.token=n["X-Token"],this.user=n,this.user):(this.user={},this.user)}async getUserData_OLD(){const t=this.url("/account/GetUserData",api.LBC),e=await this.GET(t);return(null==e?void 0:e.UserId)>0?(this.user=e,e):(this.user={},null)}async getUserData(){const t=this.url("/account/GetUserData",api.LBC),{data:e,status:s,statusText:a}=await this.request(t).exec();return this.user=(null==e?void 0:e.UserId)>0?e:{},this.responseHandlerData(e,s,a)}async getUserFullData(){return await this.getUserData()}async logout(){const t=this.url("/account/LogOut",api.LBC),e=await this.POST(t),s=!1===e;return this.user={},this.token=void 0,{ok:s,isLogged:!!s&&e}}async balance(){if(this.isSinged){const t=this.url("/account/GetUserBalance",api.LBC),e=await this.GET(t);return null!=e?e:{}}return{}}async getBalance(){const t=this.url("/account/GetUserBalance",api.LBC),{data:e,status:s,statusText:a}=await this.request(t).exec();return this.responseHandlerData(e,s,a)}async changePassword(t){var e;if(this.isSinged){t.userData.Gmt=(new Date).getTimezoneOffset()/60,t.userData.Language=this.languageId;const s=this.url("/account/ChangeUserPassword",api.LBC),a=await this.POST(s,t);return console.log(a),{ok:!a.IsError||!1,status:null!==(e=a.ErrorCode)&&void 0!==e?e:5001}}return{ok:!1,status:5001}}longToGuid(t){const e=new ArrayBuffer(16);new DataView(e).setUint32(0,t,!0);const s=Array.from(new Uint8Array(e));return[s.slice(0,4).reverse(),s.slice(4,6).reverse(),s.slice(6,8).reverse(),s.slice(8,10),s.slice(10,16)].map((t=>t.map((t=>t.toString(16).padStart(2,"0"))).join(""))).join("-")}async getSportsEventsSearch(t){var e,s;if(!t)return[];const a=this.url("/line/SearchFullByCulture",api.V2),i={culture:this.locale,searchText:t},[n,r]=await Promise.all([null!==(e=this.GET(a,i))&&void 0!==e?e:[],null!==(s=this.getFullLiveWithoutSaveTimeStamp())&&void 0!==s?s:[]]),l=n.filter((t=>t.Type>1)).map((t=>{var e;const s=new Date(null!==(e=null==t?void 0:t.Date)&&void 0!==e?e:"").toLocaleDateString(this.locale,{weekday:"short",day:"2-digit",month:"long",hour:"2-digit",minute:"2-digit"}).replace(",","");return Object.assign(t,{Date:s,to:{name:"eventprematch",params:{prEventId:routeNameId(t.Id,t.Name)}},t1:t.Name.split(/\s*\-\s*/)[0],t2:t.Name.split(/\s*\-\s*/)[1]})})),o=t.toLowerCase();return[...r.filter((t=>t.Description.NameTeam1.toLowerCase().includes(o)||t.Description.NameTeam2.toLowerCase().includes(o)||t.Description.TName.toLowerCase().includes(o))).map((t=>{const e=`${t.Description.NameTeam1} vs ${t.Description.NameTeam2} ${t.Description.SportName}`,s=new Date(t.Description.Date).toLocaleDateString(this.locale,{weekday:"short",day:"2-digit",month:"long",hour:"2-digit",minute:"2-digit"}).replace(",","");return{CountryId:t.Description.CountryId,Date:s,Id:+t.Id,Name:e,PriceNum:t.Description.PriceNum,SportId:t.Description.SportId,SportName:t.Description.SportName,TournamentId:t.Description.TournamentId,TournamentName:t.Description.TName,Type:3,isLive:!0,to:{name:"eventinplay",params:{prEventId:routeNameId(t.Id,e)}},t1:t.Description.NameTeam1,t2:t.Description.NameTeam2}})),...l]}async getFavorites(){if(this.isSinged){const t=this.url("/favorites/GetFavorites",api.V2),e=await this.GET(t,{culture:this.locale});return null!=e?e:[]}return[]}async addFavorite(t,e){if(this.isSinged){const s=this.url("/favorites/AddToFavorites",api.V2),a=await this.POST(s,{},{id:t,type:e});return null!=a&&a}return!1}async removeFavorite(t){if(this.isSinged){const e=this.url("/favorites/RemoveFromFavorites",api.V2),s=await this.POST(e,{id:t});return null!=s&&s}return!1}async getPurses(t=5){if(this.isSinged){const e=this.url("/account/GetPurses",api.V2),s={psType:t},a=await this.GET(e,s);return null!=a?a:[]}return[]}async sendWithdrawal(t,e){}async sendWithdrawalAgent(t){if(this.isSinged){const e={securityCode:"",secAnswer:"",additionalParams:{}};Object.assign(e,t);const s=this.url("/payment/CreateOrderWithdraw",api.LBC),a=await this.POST(s,e);if(isNaN(parseFloat(a)))return{ok:!1,status:a};{const t=await this.getOrderedTransactions();return{ok:!0,balance:parseFloat(a),userOrders:t}}}return{ok:!1,status:10016}}async cancelOrderedTransaction(t){if(this.isSinged){const e=this.url("/payment/CancelOrderedTransaction",api.LBC),s=await this.POST(e,t);if(-1===s)return{ok:!1,status:103};if(isNaN(parseFloat(s)))return{ok:!1,status:103};{const t=await this.getOrderedTransactions();return{ok:!0,balance:parseFloat(s),userOrders:t}}}return{ok:!1,status:10016}}async getMovementOfMoney(t){var e;if(this.isSinged){Object.assign(t,{culture:this.locale});const s=this.url("/account/GetAccountTransactions",api.V2),a=await this.GET(s,t),i=(null!==(e=null==a?void 0:a.TransactionsDataList)&&void 0!==e?e:[]).map((t=>{var e;return{income:null!==(e=t.IsAddition)&&void 0!==e&&e,sign:t.IsAddition?"+":"-",id:t.Id,typeId:t.TransactionType,typeName:t.TransactionDescription,date:t.TransactionDate,value:t.Amount,amount:t.Amount,bonus:t.Bonus,balance:t.Balance}}));return{result:i}}return{result:[]}}async getOrderedTransactions(){if(this.isSinged){const t=this.url("/account/GetOrderedTransactions",api.V2);return await this.GET(t)}return[]}async getBetContent(t){const e={id:t,culture:this.locale};if(this.isSinged){const t=this.url("/account/GetBetContent",api.V2);return await this.GET(t,e)}return{}}async getUserBets(t){if(Object.assign(t,{culture:this.locale}),this.isSinged){const e=this.url("/account/GetUserBets",api.V2);return await this.GET(e,t)}}async getUserBets02(t){if(Object.assign(t,{culture:this.locale}),this.isSinged){const e=this.url("/account/GetUserBets",api.V2),{data:s,status:a,statusText:i}=await this.request(e).query(t).exec();return{data:null!=s?s:null,error:200!==a?i:null,status:a,statusText:i}}return{data:null,error:"Unauthorized",status:401,statusText:"Unauthorized"}}async getOddsForEdit(t){const e=this.url("/betting/GetBetForChange",api.LBC),{data:s,status:a,statusText:i}=await this.request(e).POST(t).exec(),n=this.convertDataData(s);return this.responseHandlerData(n,a,i)}async placeCouponEdited(t){const e=this.url("/betting/ChangeBet",api.LBC),{data:s,status:a,statusText:i}=await this.request(e).POST(t).exec(),n=this.convertDataData(s);return this.responseHandlerData(n,a,i)}async getUserBetsCashout(t){const e=this.url("/betting/CheckCashoutForBets",api.LBC),{data:s,status:a,statusText:i}=await this.request(e).POST({BetIds:t}).exec();return this.responseHandlerData(s,a,i)}async cashoutHandler(){var t,e;const s=null!==(e=null===(t=this.user)||void 0===t?void 0:t.UserId)&&void 0!==e?e:0,a=this.url(`/stats/cashout/${s}`,api.NV20),{data:i,status:n,statusText:r}=await this.request(a).GET().setTimeout(6500).exec(),l=this.convertDataData(i);return this.responseHandlerData(l,n,r)}async returnCashoutBet(t){const e=this.url("/betting/CashOutReturnBet",api.LBC),{data:s,status:a,statusText:i}=await this.request(e).POST(t).exec(),n=this.convertDataData(s);return this.responseHandlerData(n,a,i)}createCoupon(t,e,s,a=-1){var i,n,r,l,o;const u={betAmount:e,doAcceptOddsChanges:s,statuses:{},systemIndex:a};for(let e=0;e<t.length;e++){const s=t[e],a=[null!==(i=s.LinesID)&&void 0!==i?i:"null",null!==(n=s.BetVarID)&&void 0!==n?n:"null",null!==(r=s.HandSize)&&void 0!==r?r:"null",null!==(l=s.Add1)&&void 0!==l?l:"null",null!==(o=s.Add2)&&void 0!==o?o:"null"].join("_");u.statuses[a]=!0}return u}async placeCoupon(t){if(this.isSinged){const e=this.url("/betting/PlaceBet",api.LBC);return await this.POST(e,t)}}async placeCouponBetShop(t){if(this.isSinged){const e=this.url("/betting/PlaceBetSubCashier",api.LBC);return await this.POST(e,t)}}async getBetShopCouponByCode(t){if(this.isSinged){const e=this.url("/betting/GetBetSubCashier",api.LBC),s={code:t,culture:this.locale},{data:a,status:i,statusText:n}=await this.request(e).query(s).exec();return this.responseHandlerData(a,i,n)}}async loginIsExist(t){const e=this.url("/account/IsUserExists",api.LBC);return await this.GET(e,{userName:t})}async emailIsExist(t){const e=this.url("/account/IsEmailExists",api.LBC);return await this.GET(e,{email:t})}async changePersonalData(t){if(this.isSinged){const e=this.url("/account/ChangePersonalData",api.LBC);return await this.POST(e,t)||!1}return!1}async getMessagesAll({page:t,pageSize:e}){if(this.isSinged){const s=this.url("/messages/GetAllMessages",api.LBC),a=await this.GET(s,{page:t,pageSize:e});return null!=a?a:[]}return[]}async getMessageById(t){var e;if(this.isSinged){const s=this.url("/messages/GetMessagesById",api.LBC);return null!==(e=(await this.GET(s,{id:t}))[0])&&void 0!==e?e:{}}return{}}async sensMessage({ToUserId:t,Text:e,Subject:s,ParentId:a}){if(this.isSinged){const i=this.url("/messages/SendMessage",api.LBC),n=await this.POST(i,{ToUserId:t,Text:e,Subject:s,ParentId:a});return null!=n?n:null}return null}async markMessageAsRead({MessageId:t,MessageTypeId:e}){if(this.isSinged){const s=this.url("/messages/MarkMessageAsRead",api.LBC),a=await this.POST(s,{MessageId:t,MessageTypeId:e});return null!=a?a:null}return null}async deleteMessage({MessageId:t,MessageTypeId:e}){if(this.isSinged){const s=this.url("/messages/DeleteMessage",api.LBC),a=await this.POST(s,{MessageId:t,MessageTypeId:e});return null!=a?a:null}return null}async deleteMessagesAll(){if(this.isSinged){const t=this.url("/messages/DeleteAllMessages",api.LBC),e=await this.POST(t,{});return null!=e?e:null}return null}async getMessagesCount(){if(this.isSinged){const t=this.url("/messages/GetMessagesCount",api.LBC),e=await this.GET(t,{});return null!=e?e:null}return null}async getMessagesUnreadCount(){if(this.isSinged){const t=this.url("/messages/GetCountUnreadMessages",api.LBC),e=await this.GET(t,{});return null!=e?e:null}return null}async isUserTempExist(t){const e=this.url("/account/IsUserExistsInTemp",api.LBC),{data:s}=await this.request(e).query({userName:t}).exec();return null!=s?s:null}async createUserTemp(t){var e,s;const a=this.url(`/account/${this.locale}/UserRegistrationOnlyInTepm`),{data:i}=await this.request(a).POST(t).exec(),n=null!==(s=null===(e=null==i?void 0:i.Data)||void 0===e?void 0:e._isSuccessful)&&void 0!==s?s:null;return null!=n?n:null}async getGamesListGR(t={platforms:"desktop"}){const e=this.url("/Softquo/GetGamesList",api.DIRECT),{data:s,status:a,statusText:i}=await this.request(e).POST(t).exec();return this.responseHandlerData(s,a,i)}async getGameFrameUrlGR(t){const e=this.url("/Softquo/InitGame",api.DIRECT),{data:s,status:a,statusText:i}=await this.request(e).query(t).exec();return this.responseHandlerData(s,a,i)}async pingApi(){const t=this.url("/account/Ping",api.LBC),{data:e,status:s,statusText:a}=await this.request(t).exec();return this.responseHandlerData(e,s,a)}async intgrGetGamesList(t){const e=this.url("/Games/GetGamesList",api.DIRECT),{data:s,status:a,statusText:i}=await this.request(e).POST(t).exec();return this.responseHandlerData(s,a,i)}async intgrGetGameTypes(t){const e=this.url("/Games/GetGameTypes",api.DIRECT),{data:s,status:a,statusText:i}=await this.request(e).POST().query({groupId:t}).exec();return this.responseHandlerData(s,a,i)}async intgrGetProvidersList(t){const e=this.url("/Games/GetGameProviders",api.DIRECT),{data:s,status:a,statusText:i}=await this.request(e).POST().query({groupId:t}).exec();return this.responseHandlerData(s,a,i)}async intgrGetTopGames(t){const e=this.url("/Games/GetTopGames",api.DIRECT),{data:s,status:a,statusText:i}=await this.request(e).POST().query({groupId:t}).exec();return this.responseHandlerData(s,a,i)}async intgrInitGame(t){const e=this.url("/Games/InitGame",api.DIRECT),{data:s,status:a,statusText:i}=await this.request(e).query(t).exec();return this.responseHandlerData(s,a,i)}async checkPromocode(t){}async activatePromocode(t){}async sendSms(t){}async signUpPhone(t){}async passwordRecoveryRequest(t){}async passwordRecoveryEmail(t){}async passwordSetNewByPhone(t){}async passwordSetNewByEmail(t){}async signUpEmail(t){}async getUserPersonalInfo(){}async sendPayment(t,e){}async setUserPersonalInfo(t){}async getGamesToken(t){}async getProviderHedlines(t){}async createTempSignUp({login:t,password:e}){}async setRemoteLanguage(t){return null!=t||(t=this.lang),await this.setLanguageRemoteLocale(t)}convertBonuses(t){let e=[];return Object.keys(t).forEach((s=>{const a=s.match(/B_Koef(\d)_Value/);if(a){const s=a[1];e.push(["Koef",t[`B_Koef${s}`],t[`B_Koef${s}_Value`]])}const i=s.match(/B_Kolvo(\d)_Value/);if(i){const s=i[1];e.push(["Kolvo",t[`B_Kolvo${s}`],t[`B_Kolvo${s}_Value`]])}"B_Perestavka_Value"===s&&e.push(["Perestavka",!0,t.B_Perestavka_Value]),"B_MinOdds"===s&&e.push(["MinOdds",!0,t.B_MinOdds])})),e}async getBetslip_OLD(){var t,e;const s=this.url("/betting/GetBetslip",api.LBC),a=await this.GET(s,{});return a.bonuses=this.convertBonuses(null!==(t=null==a?void 0:a.Bonus)&&void 0!==t?t:{}),null!==(e=a.Bets)&&void 0!==e||(a.Bets=[]),delete a.Bonus,null!=a?a:{}}async getBetslip(){var t,e;const s=this.url("/betting/GetBetslip",api.LBC);let{data:a,status:i,statusText:n}=await this.request(s).exec();return null!=a||(a={}),a.bonuses=this.convertBonuses(null!==(t=null==a?void 0:a.Bonus)&&void 0!==t?t:{}),null!==(e=a.Bets)&&void 0!==e||(a.Bets=[]),delete a.Bonus,a}async clearBetslip(){const t=this.url("/betting/ClearBetslip",api.LBC),e=await this.POST(t);return null!=e&&e}async changeBetslipType(t){const e=this.url("/betting/ChangeBetslipType",api.LBC),s=await this.POST(e,{},{betslipType:t});return null!=s&&s}async setBetslipSettings(t){if(this.isSinged){const e=this.url("/betting/SetBetslipSettings",api.LBC),s=await this.POST(e,t);return null!=s?s:[]}return[]}async addToBetslip(t){t.culture=this.locale;const e=this.url("/betting/AddToBetslip",api.LBC),s=await this.POST(e,t);return null!=s?s:null}async removeFromBetslip(t){t.culture=this.locale;const e=this.url("/betting/RemoveFromBetslip",api.LBC);return await this.POST(e,t)||!1}async removeBonus(){const t=this.url("/betting/DeleteBonus",api.LBC),e=await this.POST(t);return null!=e&&e}async addBonus(t){const e=this.url("/betting/AddBonus",api.LBC),s=await this.POST(e,{},{odd:t});return null!=s?s:null}async updateBet(t){t.culture=this.locale;const e=this.url("/betting/UpdateBet",api.LBC);return null===await this.POST(e,t)}async getBetsLimits(){if(this.isSinged){const t=this.url("/betting/GetLimitations",api.LBC),e=await this.GET(t);return null!=e?e:{Min:0,Max:0}}return{Min:0,Max:0}}async getBetsLimitsNew(){var t,e,s;if(this.isSinged){const a=this.url("/betting/GetLimitations",api.LBC),{data:i,status:n,statusText:r}=await this.request(a).exec(),l={Min:null!==(t=null==i?void 0:i.Min)&&void 0!==t?t:0,Max:null!==(e=null==i?void 0:i.Max)&&void 0!==e?e:0,MaxOddForMulty:null!==(s=null==i?void 0:i.MaxOddForMulty)&&void 0!==s?s:250};return this.responseHandlerData(l,n,r)}return{data:{Min:0,Max:0,MaxOddForMulty:250},status:200,statusText:"OK"}}async getCurrencies(){if(this.isSinged){const t=this.url("/location/GetCurrencies",api.V2),e=await this.GET(t);return null!=e?e:[]}return null}async getCountries(){if(this.isSinged){const t=this.url("/location/GetCountries",api.V2),e=await this.GET(t);return null!=e?e:[]}return null}async getAllKeys(t){const e=this.url("/info/GetAllKeys",api.LBC),s=await this.GET(e,{key:t,culture:this.locale});return null!=s?s:[]}async getSlides(t){null!=t||(t="https://f004.backblazeb2.com/file/betroute/slides.json");const e=this.url(t),{data:s,status:a,statusText:i}=await this.request(e).deleteAllHeaders().exec();return this.responseHandlerData(s,a,i)}async getSiteSlidesSections(t){null!=t||(t="https://f004.backblazeb2.com/file/betroute/slides.json");const e=this.url(t),{data:s,status:a,statusText:i}=await this.request(e).deleteAllHeaders().exec();return this.responseHandlerData(s,a,i)}async getEventStatisticData(t){const e=this.url(`/stats/data/${t}/${this.locale}`,api.NV20),{data:s,status:a,statusText:i}=await this.request(e).exec();return this.responseHandlerData(s,a,i)}async getEventStatisticPage(t){const e=this.url(`/stats/page/${t}/${this.locale}`,api.NV20),{data:s,status:a,statusText:i}=await this.request(e).exec();return this.responseHandlerData(s,a,i)}async searchPrematchEventsNv20(t,e={}){var s;const a=this.url("/stats/pm/search",api.NV20);t=null!==(s=null==e?void 0:e.searchString)&&void 0!==s?s:t.split(/\s+/).filter((t=>!0!==/\d/.test(t)&&t.length>1)).join(" ").trim();const i=Object.assign(Object.assign(Object.assign(Object.assign({locale:this.locale,searchString:t},(null==e?void 0:e.LIMIT)?{LIMIT:e.LIMIT}:{LIMIT:{from:0,size:30}}),(null==e?void 0:e.negativeString)?{negativeString:e.negativeString}:{}),(null==e?void 0:e.sportId)?{sportId:e.sportId}:{}),(null==e?void 0:e.tournamentId)?{tournamentId:e.tournamentId}:{}),{data:n,status:r,statusText:l}=await this.request(a).POST(i).exec();return n.searchString=t,n.from=i.LIMIT.from,n.size=i.LIMIT.size,this.responseHandlerData(n,r,l)}async searchPrematchEventsIdsNv20(t){var e,s;const a=this.url("/stats/pm/search/ids",api.NV20);null!==(e=t.locale)&&void 0!==e||(t.locale=this.locale),null!==(s=t.LIMIT)&&void 0!==s||(t.LIMIT={from:0,size:30});const{data:i,status:n,statusText:r}=await this.request(a).POST(t).exec();return i.from=t.LIMIT.from,i.size=t.LIMIT.size,this.responseHandlerData(i,n,r)}async getDictionaryNv20(t){var e,s,a,i,n;const r=this.url("/stats/pm/dictionary",api.NV20);null!==(e=t.locale)&&void 0!==e||(t.locale=this.locale);const{data:l,status:o,statusText:u}=await this.request(r).POST(t).exec();return l.from=null!==(a=null===(s=null==t?void 0:t.LIMIT)||void 0===s?void 0:s.from)&&void 0!==a?a:null,l.size=null!==(n=null===(i=null==t?void 0:t.LIMIT)||void 0===i?void 0:i.size)&&void 0!==n?n:null,this.responseHandlerData(l,o,u)}async getLineSportsNv20(t=0,e=25e3){var s;const a=this.url("/stats/pm/dictionary",api.NV20),i=Object.assign({locale:this.locale,dictionary:"sport"},t>0?{minTime:Date.now(),maxTime:Date.now()+60*t*1e3}:{}),{data:n,status:r,statusText:l}=await this.request(a).POST(i).setTimeout(e).exec(),o=this.responseHandlerData(n,r,l),u=((null===(s=null==o?void 0:o.data)||void 0===s?void 0:s.results)||[]).filter((t=>t.sport&&t.sName)).map((t=>({ID:+t.sport,Name:t.sName,cnt:+t.cnt})));return this.sortDataByPriority(u,this.primarySports,"ID")}async getLineSportsMain(t=0,e=1500){let s=await this.getLineSportsNv20(t,e);return 0===s.length&&(s=await this.getLineSports(t)),s}async getCountriesBySportNv20(t,e=0,s=25e3){var a;const i=this.url("/stats/pm/dictionary",api.NV20),n=Object.assign({locale:this.locale,sportId:t,dictionary:"country"},e>0?{minTime:Date.now(),maxTime:Date.now()+60*e*1e3}:{}),{data:r,status:l,statusText:o}=await this.request(i).POST(n).setTimeout(s).exec(),u=this.responseHandlerData(r,l,o),c=((null===(a=null==u?void 0:u.data)||void 0===a?void 0:a.results)||[]).sort(((t,e)=>t.cName.localeCompare(e.cName))).map((t=>({ID:+t.country,Name:t.cName,cnt:+t.cnt}))),d=this.priorityCountries[t];return d?this.sortDataByPriority(c,d,"ID"):c}async getCountriesListMain(t,e=0,s=3e3){let a=await this.getCountriesBySportNv20(t,e,s);return 0===a.length&&(a=await this.getCountriesList(t,e)),a}async getPrematchTournamentsNv20(t,e,s=0,a=25e3){var i,n;const r=this.url("/stats/pm/dictionary",api.NV20),l=Object.assign({locale:this.locale,sportId:t,countryId:e,dictionary:"tournament"},s>0?{minTime:Date.now(),maxTime:Date.now()+60*s*1e3}:{}),{data:o,status:u,statusText:c}=await this.request(r).POST(l).setTimeout(a).exec(),d=this.responseHandlerData(o,u,c),h=((null===(i=null==d?void 0:d.data)||void 0===i?void 0:i.results)||[]).sort(((t,e)=>t.tName.localeCompare(e.tName))).map((t=>({Id:+t.tournament,Name:t.tName,cnt:+t.cnt,sId:+t.sport,sName:t.sName,cId:+t.country,cName:t.cName}))),g=null!==(n=this.priorityTournaments[t])&&void 0!==n?n:null;return g?this.sortDataByPriority(h,g,"Id"):h}async getPrematchTournamentsMain(t,e,s=0,a=3e3){let i=await this.getPrematchTournamentsNv20(t,e,s,a);return 0===i.length&&(i=await this.getPrematchTournaments(t,e,s)),i}async searchPrematchTournametsEventsNv20(t,e={}){var s,a,i;const{data:n,status:r,statusText:l}=await this.searchPrematchEventsNv20(t,e),o=(null!==(s=null==n?void 0:n.documents)&&void 0!==s?s:[]).reduce(((t,e)=>{const s=e.EventKeys.TurnirID;return t[s]||(t[s]=[]),t[s].push(e),t}),{}),u={tournaments:Object.entries(o).map((([t,e])=>({Id:t,Name:e[0].TourneyName.trim(),SportName:e[0].SportName,SportID:e[0].EventKeys.SportID,EventsHeaders:e}))),total:null!==(a=null==n?void 0:n.total)&&void 0!==a?a:0,searchString:null!==(i=null==n?void 0:n.searchString)&&void 0!==i?i:""};return this.responseHandlerData(u,r,l)}async sendErrInfo(t,e){const s=this.url("/err/send/front",api.NV20),{data:a,status:i,statusText:n}=await this.request(s).POST({text:t,code:e}).exec();return this.responseHandlerData(null==a?void 0:a.ok,i,n)}async cloneBetCoupon(t){var e,s;const a=this.url("/betting/TryGetBetCopy",api.LBC);null!==(e=t.betId)&&void 0!==e||(t.betId=null),null!==(s=t.code)&&void 0!==s||(t.code=null),t.culture=this.locale;const{data:i,status:n,statusText:r}=await this.request(a).query(t).exec();return this.responseHandlerData(i,n,r)}async getAllBanners(){const t=this.url("/info/GetAllBanners",api.LBC),e=await this.GET(t,{culture:this.locale});return null!=e?e:[]}async getCdnSlidesData(t,e,s){var a,i;const n={};if(s&&s.length>0&&(n["slider-main"]=s),!t||0===e.length)return n;let r=await Promise.all(e.map((t=>{const e=this.url(`/stats/slides/${t}`,api.NV20);return this.request(e).deleteAllHeaders().exec()})));for(const t of r)for(const[e,s]of Object.entries(null!==(a=null==t?void 0:t.data)&&void 0!==a?a:{})){null!==(i=n[e])&&void 0!==i||(n[e]=[]);for(const t of s)n[e].push(t)}return n}async depositBetKiosk(t){const e=this.url("/betting/DepositMoneyBetshopPlayer",api.LBC),{data:s,status:a,statusText:i}=await this.request(e).query({sum:t}).exec();return this.responseHandlerData(s,a,i)}async depositBetKioskV2(t){const e=this.url("/betting/DepositMoneyBetshopPlayer",api.LBC),{data:s,status:a,statusText:i}=await this.request(e).query({sum:t}).exec();return this.responseHandlerDataData(s,a,i)}async getFaq(){const t=this.url("/info/GetFaq",api.LBC),e=await this.GET(t,{culture:this.locale});return null!=e?e:[]}async getFlatpagesList(){return[]}async test3(){return"test3 Ok"}async sellBet(t){}convertBasketToPost(t){return{a1:t.Add1,a2:t.Add2,bId:t.BetVarID,eId:t.LinesID,fs:t.HandSize,isLive:t.IsLive,r:t.Odds}}async getSiteLocation(t,e){const s=this.url(`/sitelocation/${t}/${e}/${this.lang}`,api.NV20),{data:a,status:i,statusText:n}=await this.request(s).exec();return this.responseHandlerData(a,i,n)}}
2
2
  //# sourceMappingURL=BetBoosterApi.min.js.map