fansunited-sdk-esm 1.111.0 → 1.112.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.js +3 -3
- package/package.json +1 -1
- package/types/Core/Global/Messages/Messages.d.ts +1 -1
- package/types/Core/Global/Models/FansUnitedSDKModel.d.ts +2 -0
- package/types/Core/Https/CustomGameHttps.d.ts +11 -0
- package/types/Core/Namespaces/EventGame/EventGame.d.ts +17 -0
- package/types/Core/Namespaces/EventGame/Facade/EventGameFacade.d.ts +18 -0
- package/types/Core/Namespaces/EventGame/Models/EventGameFixtureEnumModel.d.ts +4 -0
- package/types/Core/Namespaces/EventGame/Models/EventGameFixtureNumberModel.d.ts +5 -0
- package/types/Core/Namespaces/EventGame/Models/EventGameFixturesModel.d.ts +27 -0
- package/types/Core/Namespaces/EventGame/Models/EventGameModel.d.ts +23 -0
- package/types/Core/Namespaces/EventGame/Models/EventGamePredictionsModel.d.ts +7 -0
- package/types/Core/Namespaces/EventGame/Models/EventGameTiebreakerModel.d.ts +5 -0
- package/types/Core/Namespaces/EventGame/Models/EventGamesModel.d.ts +7 -0
- package/types/Core/Namespaces/EventGame/Models/Filters/EventGameFilters.d.ts +11 -0
- package/types/Core/Namespaces/EventGame/Models/Filters/EventGamePredictionsFilters.d.ts +4 -0
- package/types/Core/Namespaces/EventGame/Models/Filters/EventGameRankingsFilters.d.ts +4 -0
- package/types/Core/Namespaces/EventGame/Models/Prediction/EventGamePredictionFixturesModel.d.ts +10 -0
- package/types/Core/Namespaces/EventGame/Models/Prediction/EventGamePredictionModel.d.ts +41 -0
- package/types/Core/Namespaces/EventGame/Models/Prediction/EventGameTiebreaker.d.ts +4 -0
- package/types/Core/Namespaces/EventGame/Models/Prediction/PredictionType.d.ts +6 -0
- package/types/Core/Namespaces/EventGame/Models/Prediction/RequestBody/EventGameFixtures.d.ts +8 -0
- package/types/Core/Namespaces/EventGame/Models/Prediction/RequestBody/EventGamePredictionRequestBody.d.ts +7 -0
- package/types/Core/Namespaces/EventGame/Models/Rankings/EventGameRankingsModel.d.ts +7 -0
- package/types/Core/Namespaces/EventGame/Models/Remapper/EventGameRemapper.d.ts +25 -0
- package/types/Core/Namespaces/EventGame/Validator/EventGameValidator.d.ts +9 -0
- package/types/Core/Namespaces/MiniGames/Facade/MiniGamesFacade.d.ts +1 -0
- package/types/Core/Namespaces/MiniGames/MiniGames.d.ts +1 -0
- package/types/Core/Namespaces/MiniGames/Models/ClassicQuiz/ClassicQuizUserParticipationModel.d.ts +2 -1
- package/types/Core/Namespaces/MiniGames/Models/Remappers/ClassicQuizRemapper.d.ts +2 -2
- package/types/Core/Namespaces/Profile/Profile.d.ts +1 -1
- package/types/enums.d.ts +2 -0
- package/types/models.d.ts +16 -0
package/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var dd=Object.create;var up=Object.defineProperty;var ud=Object.getOwnPropertyDescriptor;var md=Object.getOwnPropertyNames;var hd=Object.getPrototypeOf,fd=Object.prototype.hasOwnProperty;var gd=(s,t,e)=>t in s?up(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e;var yd=(s,t)=>()=>(s&&(t=s(s=0)),t);var an=(s,t)=>()=>(t||s((t={exports:{}}).exports,t),t.exports),bd=(s,t)=>{for(var e in t)up(s,e,{get:t[e],enumerable:!0})},Md=(s,t,e,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of md(t))!fd.call(s,a)&&a!==e&&up(s,a,{get:()=>t[a],enumerable:!(i=ud(t,a))||i.enumerable});return s};var Id=(s,t,e)=>(e=s!=null?dd(hd(s)):{},Md(t||!s||!s.__esModule?up(e,"default",{value:s,enumerable:!0}):e,s));var et=(s,t,e)=>(gd(s,typeof t!="symbol"?t+"":t,e),e);var kc={};bd(kc,{default:()=>Rd});var Ed,Rd,Gc=yd(()=>{Ed={getItem:async()=>null,setItem:async()=>null,removeItem:async()=>null,clear:async()=>null,getAllKeys:async()=>[],multiGet:async()=>[],multiSet:async()=>null,multiRemove:async()=>null,mergeItem:async()=>null,multiMerge:async()=>null},Rd=Ed});var Uc=an((Hh,bp)=>{var Sd=function(){"use strict";function s(c,d){return d!=null&&c instanceof d}var t;try{t=Map}catch{t=function(){}}var e;try{e=Set}catch{e=function(){}}var i;try{i=Promise}catch{i=function(){}}function a(c,d,u,b,I){typeof d=="object"&&(u=d.depth,b=d.prototype,I=d.includeNonEnumerable,d=d.circular);var x=[],oi=[],si=typeof Buffer<"u";typeof d>"u"&&(d=!0),typeof u>"u"&&(u=1/0);function nt(h,Nt){if(h===null)return null;if(Nt===0)return h;var G,Zs;if(typeof h!="object")return h;if(s(h,t))G=new t;else if(s(h,e))G=new e;else if(s(h,i))G=new i(function(tn,_){h.then(function(en){tn(nt(en,Nt-1))},function(en){_(nt(en,Nt-1))})});else if(a.__isArray(h))G=[];else if(a.__isRegExp(h))G=new RegExp(h.source,p(h)),h.lastIndex&&(G.lastIndex=h.lastIndex);else if(a.__isDate(h))G=new Date(h.getTime());else{if(si&&Buffer.isBuffer(h))return Buffer.allocUnsafe?G=Buffer.allocUnsafe(h.length):G=new Buffer(h.length),h.copy(G),G;s(h,Error)?G=Object.create(h):typeof b>"u"?(Zs=Object.getPrototypeOf(h),G=Object.create(Zs)):(G=Object.create(b),Zs=b)}if(d){var Rc=x.indexOf(h);if(Rc!=-1)return oi[Rc];x.push(h),oi.push(G)}s(h,t)&&h.forEach(function(tn,_){var en=nt(_,Nt-1),cd=nt(tn,Nt-1);G.set(en,cd)}),s(h,e)&&h.forEach(function(tn){var _=nt(tn,Nt-1);G.add(_)});for(var yt in h){var S;Zs&&(S=Object.getOwnPropertyDescriptor(Zs,yt)),!(S&&S.set==null)&&(G[yt]=nt(h[yt],Nt-1))}if(Object.getOwnPropertySymbols)for(var Sc=Object.getOwnPropertySymbols(h),yt=0;yt<Sc.length;yt++){var cp=Sc[yt],Ni=Object.getOwnPropertyDescriptor(h,cp);Ni&&!Ni.enumerable&&!I||(G[cp]=nt(h[cp],Nt-1),Ni.enumerable||Object.defineProperty(G,cp,{enumerable:!1}))}if(I)for(var E=Object.getOwnPropertyNames(h),yt=0;yt<E.length;yt++){var dp=E[yt],Ni=Object.getOwnPropertyDescriptor(h,dp);Ni&&Ni.enumerable||(G[dp]=nt(h[dp],Nt-1),Object.defineProperty(G,dp,{enumerable:!1}))}return G}return nt(c,u)}a.clonePrototype=function(d){if(d===null)return null;var u=function(){};return u.prototype=d,new u};function r(c){return Object.prototype.toString.call(c)}a.__objToStr=r;function o(c){return typeof c=="object"&&r(c)==="[object Date]"}a.__isDate=o;function n(c){return typeof c=="object"&&r(c)==="[object Array]"}a.__isArray=n;function l(c){return typeof c=="object"&&r(c)==="[object RegExp]"}a.__isRegExp=l;function p(c){var d="";return c.global&&(d+="g"),c.ignoreCase&&(d+="i"),c.multiline&&(d+="m"),d}return a.__getRegExpFlags=p,a}();typeof bp=="object"&&bp.exports&&(bp.exports=Sd)});var Xc=an(($h,yc)=>{"use strict";var Zi=typeof Reflect=="object"?Reflect:null,Vc=Zi&&typeof Zi.apply=="function"?Zi.apply:function(t,e,i){return Function.prototype.apply.call(t,e,i)},Mp;Zi&&typeof Zi.ownKeys=="function"?Mp=Zi.ownKeys:Object.getOwnPropertySymbols?Mp=function(t){return Object.getOwnPropertyNames(t).concat(Object.getOwnPropertySymbols(t))}:Mp=function(t){return Object.getOwnPropertyNames(t)};function Fd(s){console&&console.warn&&console.warn(s)}var $c=Number.isNaN||function(t){return t!==t};function F(){F.init.call(this)}yc.exports=F;yc.exports.once=Od;F.EventEmitter=F;F.prototype._events=void 0;F.prototype._eventsCount=0;F.prototype._maxListeners=void 0;var Hc=10;function Ip(s){if(typeof s!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof s)}Object.defineProperty(F,"defaultMaxListeners",{enumerable:!0,get:function(){return Hc},set:function(s){if(typeof s!="number"||s<0||$c(s))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+s+".");Hc=s}});F.init=function(){(this._events===void 0||this._events===Object.getPrototypeOf(this)._events)&&(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0};F.prototype.setMaxListeners=function(t){if(typeof t!="number"||t<0||$c(t))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+t+".");return this._maxListeners=t,this};function Wc(s){return s._maxListeners===void 0?F.defaultMaxListeners:s._maxListeners}F.prototype.getMaxListeners=function(){return Wc(this)};F.prototype.emit=function(t){for(var e=[],i=1;i<arguments.length;i++)e.push(arguments[i]);var a=t==="error",r=this._events;if(r!==void 0)a=a&&r.error===void 0;else if(!a)return!1;if(a){var o;if(e.length>0&&(o=e[0]),o instanceof Error)throw o;var n=new Error("Unhandled error."+(o?" ("+o.message+")":""));throw n.context=o,n}var l=r[t];if(l===void 0)return!1;if(typeof l=="function")Vc(l,this,e);else for(var p=l.length,c=jc(l,p),i=0;i<p;++i)Vc(c[i],this,e);return!0};function qc(s,t,e,i){var a,r,o;if(Ip(e),r=s._events,r===void 0?(r=s._events=Object.create(null),s._eventsCount=0):(r.newListener!==void 0&&(s.emit("newListener",t,e.listener?e.listener:e),r=s._events),o=r[t]),o===void 0)o=r[t]=e,++s._eventsCount;else if(typeof o=="function"?o=r[t]=i?[e,o]:[o,e]:i?o.unshift(e):o.push(e),a=Wc(s),a>0&&o.length>a&&!o.warned){o.warned=!0;var n=new Error("Possible EventEmitter memory leak detected. "+o.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit");n.name="MaxListenersExceededWarning",n.emitter=s,n.type=t,n.count=o.length,Fd(n)}return s}F.prototype.addListener=function(t,e){return qc(this,t,e,!1)};F.prototype.on=F.prototype.addListener;F.prototype.prependListener=function(t,e){return qc(this,t,e,!0)};function Cd(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length===0?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function zc(s,t,e){var i={fired:!1,wrapFn:void 0,target:s,type:t,listener:e},a=Cd.bind(i);return a.listener=e,i.wrapFn=a,a}F.prototype.once=function(t,e){return Ip(e),this.on(t,zc(this,t,e)),this};F.prototype.prependOnceListener=function(t,e){return Ip(e),this.prependListener(t,zc(this,t,e)),this};F.prototype.removeListener=function(t,e){var i,a,r,o,n;if(Ip(e),a=this._events,a===void 0)return this;if(i=a[t],i===void 0)return this;if(i===e||i.listener===e)--this._eventsCount===0?this._events=Object.create(null):(delete a[t],a.removeListener&&this.emit("removeListener",t,i.listener||e));else if(typeof i!="function"){for(r=-1,o=i.length-1;o>=0;o--)if(i[o]===e||i[o].listener===e){n=i[o].listener,r=o;break}if(r<0)return this;r===0?i.shift():vd(i,r),i.length===1&&(a[t]=i[0]),a.removeListener!==void 0&&this.emit("removeListener",t,n||e)}return this};F.prototype.off=F.prototype.removeListener;F.prototype.removeAllListeners=function(t){var e,i,a;if(i=this._events,i===void 0)return this;if(i.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):i[t]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete i[t]),this;if(arguments.length===0){var r=Object.keys(i),o;for(a=0;a<r.length;++a)o=r[a],o!=="removeListener"&&this.removeAllListeners(o);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if(e=i[t],typeof e=="function")this.removeListener(t,e);else if(e!==void 0)for(a=e.length-1;a>=0;a--)this.removeListener(t,e[a]);return this};function Qc(s,t,e){var i=s._events;if(i===void 0)return[];var a=i[t];return a===void 0?[]:typeof a=="function"?e?[a.listener||a]:[a]:e?Ad(a):jc(a,a.length)}F.prototype.listeners=function(t){return Qc(this,t,!0)};F.prototype.rawListeners=function(t){return Qc(this,t,!1)};F.listenerCount=function(s,t){return typeof s.listenerCount=="function"?s.listenerCount(t):Kc.call(s,t)};F.prototype.listenerCount=Kc;function Kc(s){var t=this._events;if(t!==void 0){var e=t[s];if(typeof e=="function")return 1;if(e!==void 0)return e.length}return 0}F.prototype.eventNames=function(){return this._eventsCount>0?Mp(this._events):[]};function jc(s,t){for(var e=new Array(t),i=0;i<t;++i)e[i]=s[i];return e}function vd(s,t){for(;t+1<s.length;t++)s[t]=s[t+1];s.pop()}function Ad(s){for(var t=new Array(s.length),e=0;e<t.length;++e)t[e]=s[e].listener||s[e];return t}function Od(s,t){return new Promise(function(e,i){function a(o){s.removeListener(t,r),i(o)}function r(){typeof s.removeListener=="function"&&s.removeListener("error",a),e([].slice.call(arguments))}Yc(s,t,r,{once:!0}),t!=="error"&&Ld(s,a,{once:!0})})}function Ld(s,t,e){typeof s.on=="function"&&Yc(s,"error",t,e)}function Yc(s,t,e,i){if(typeof s.on=="function")i.once?s.once(t,e):s.on(t,e);else if(typeof s.addEventListener=="function")s.addEventListener(t,function a(r){i.once&&s.removeEventListener(t,a),e(r)});else throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof s)}});var td=an((Jc,Zc)=>{(function(){var s,t,e,i=[].splice,a=function(o,n){if(!(o instanceof n))throw new Error("Bound instance method accessed before binding")},r=[].indexOf;e=Uc(),s=Xc().EventEmitter,Zc.exports=t=function(){class o extends s{constructor(l={}){super(),this.get=this.get.bind(this),this.mget=this.mget.bind(this),this.set=this.set.bind(this),this.mset=this.mset.bind(this),this.del=this.del.bind(this),this.take=this.take.bind(this),this.ttl=this.ttl.bind(this),this.getTtl=this.getTtl.bind(this),this.keys=this.keys.bind(this),this.has=this.has.bind(this),this.getStats=this.getStats.bind(this),this.flushAll=this.flushAll.bind(this),this.flushStats=this.flushStats.bind(this),this.close=this.close.bind(this),this._checkData=this._checkData.bind(this),this._check=this._check.bind(this),this._isInvalidKey=this._isInvalidKey.bind(this),this._wrap=this._wrap.bind(this),this._getValLength=this._getValLength.bind(this),this._error=this._error.bind(this),this._initErrors=this._initErrors.bind(this),this.options=l,this._initErrors(),this.data={},this.options=Object.assign({forceString:!1,objectValueSize:80,promiseValueSize:80,arrayValueSize:40,stdTTL:0,checkperiod:600,useClones:!0,deleteOnExpire:!0,enableLegacyCallbacks:!1,maxKeys:-1},this.options),this.options.enableLegacyCallbacks&&(console.warn("WARNING! node-cache legacy callback support will drop in v6.x"),["get","mget","set","del","ttl","getTtl","keys","has"].forEach(p=>{var c;c=this[p],this[p]=function(...d){var u,b,I,x;if(I=d,[...d]=I,[u]=i.call(d,-1),typeof u=="function")try{x=c(...d),u(null,x)}catch(oi){b=oi,u(b)}else return c(...d,u)}})),this.stats={hits:0,misses:0,keys:0,ksize:0,vsize:0},this.validKeyTypes=["string","number"],this._checkData()}get(l){var p,c;if(a(this,o),(c=this._isInvalidKey(l))!=null)throw c;if(this.data[l]!=null&&this._check(l,this.data[l]))return this.stats.hits++,p=this._unwrap(this.data[l]),p;this.stats.misses++}mget(l){var p,c,d,u,b,I;if(a(this,o),!Array.isArray(l))throw p=this._error("EKEYSTYPE"),p;for(I={},d=0,b=l.length;d<b;d++){if(u=l[d],(c=this._isInvalidKey(u))!=null)throw c;this.data[u]!=null&&this._check(u,this.data[u])?(this.stats.hits++,I[u]=this._unwrap(this.data[u])):this.stats.misses++}return I}set(l,p,c){var d,u,b;if(a(this,o),this.options.maxKeys>-1&&this.stats.keys>=this.options.maxKeys)throw d=this._error("ECACHEFULL"),d;if(this.options.forceString&&!typeof p==="string"&&(p=JSON.stringify(p)),c==null&&(c=this.options.stdTTL),(u=this._isInvalidKey(l))!=null)throw u;return b=!1,this.data[l]&&(b=!0,this.stats.vsize-=this._getValLength(this._unwrap(this.data[l],!1))),this.data[l]=this._wrap(p,c),this.stats.vsize+=this._getValLength(p),b||(this.stats.ksize+=this._getKeyLength(l),this.stats.keys++),this.emit("set",l,p),!0}mset(l){var p,c,d,u,b,I,x,oi,si,nt;if(a(this,o),this.options.maxKeys>-1&&this.stats.keys+l.length>=this.options.maxKeys)throw p=this._error("ECACHEFULL"),p;for(d=0,x=l.length;d<x;d++){if(I=l[d],{key:b,val:nt,ttl:si}=I,si&&typeof si!="number")throw p=this._error("ETTLTYPE"),p;if((c=this._isInvalidKey(b))!=null)throw c}for(u=0,oi=l.length;u<oi;u++)I=l[u],{key:b,val:nt,ttl:si}=I,this.set(b,nt,si);return!0}del(l){var p,c,d,u,b,I;for(a(this,o),Array.isArray(l)||(l=[l]),p=0,d=0,b=l.length;d<b;d++){if(u=l[d],(c=this._isInvalidKey(u))!=null)throw c;this.data[u]!=null&&(this.stats.vsize-=this._getValLength(this._unwrap(this.data[u],!1)),this.stats.ksize-=this._getKeyLength(u),this.stats.keys--,p++,I=this.data[u],delete this.data[u],this.emit("del",u,I.v))}return p}take(l){var p;return a(this,o),p=this.get(l),p!=null&&this.del(l),p}ttl(l,p){var c;if(a(this,o),p||(p=this.options.stdTTL),!l)return!1;if((c=this._isInvalidKey(l))!=null)throw c;return this.data[l]!=null&&this._check(l,this.data[l])?(p>=0?this.data[l]=this._wrap(this.data[l].v,p,!1):this.del(l),!0):!1}getTtl(l){var p,c;if(a(this,o),!!l){if((c=this._isInvalidKey(l))!=null)throw c;if(this.data[l]!=null&&this._check(l,this.data[l]))return p=this.data[l].t,p}}keys(){var l;return a(this,o),l=Object.keys(this.data),l}has(l){var p;return a(this,o),p=this.data[l]!=null&&this._check(l,this.data[l]),p}getStats(){return a(this,o),this.stats}flushAll(l=!0){a(this,o),this.data={},this.stats={hits:0,misses:0,keys:0,ksize:0,vsize:0},this._killCheckPeriod(),this._checkData(l),this.emit("flush")}flushStats(){a(this,o),this.stats={hits:0,misses:0,keys:0,ksize:0,vsize:0},this.emit("flush_stats")}close(){a(this,o),this._killCheckPeriod()}_checkData(l=!0){var p,c,d;a(this,o),c=this.data;for(p in c)d=c[p],this._check(p,d);l&&this.options.checkperiod>0&&(this.checkTimeout=setTimeout(this._checkData,this.options.checkperiod*1e3,l),this.checkTimeout!=null&&this.checkTimeout.unref!=null&&this.checkTimeout.unref())}_killCheckPeriod(){if(this.checkTimeout!=null)return clearTimeout(this.checkTimeout)}_check(l,p){var c;return a(this,o),c=!0,p.t!==0&&p.t<Date.now()&&(this.options.deleteOnExpire&&(c=!1,this.del(l)),this.emit("expired",l,this._unwrap(p))),c}_isInvalidKey(l){var p;if(a(this,o),p=typeof l,r.call(this.validKeyTypes,p)<0)return this._error("EKEYTYPE",{type:typeof l})}_wrap(l,p,c=!0){var d,u,b,I;return a(this,o),this.options.useClones||(c=!1),u=Date.now(),d=0,I=1e3,p===0?d=0:p?d=u+p*I:this.options.stdTTL===0?d=this.options.stdTTL:d=u+this.options.stdTTL*I,b={t:d,v:c?e(l):l}}_unwrap(l,p=!0){return this.options.useClones||(p=!1),l.v!=null?p?e(l.v):l.v:null}_getKeyLength(l){return l.toString().length}_getValLength(l){return a(this,o),typeof l=="string"?l.length:this.options.forceString?JSON.stringify(l).length:Array.isArray(l)?this.options.arrayValueSize*l.length:typeof l=="number"?8:typeof l?.then=="function"?this.options.promiseValueSize:typeof Buffer<"u"&&Buffer!==null&&Buffer.isBuffer(l)?l.length:l!=null&&typeof l=="object"?this.options.objectValueSize*Object.keys(l).length:typeof l=="boolean"?8:0}_error(l,p={}){var c;return a(this,o),c=new Error,c.name=l,c.errorcode=l,c.message=this.ERRORS[l]!=null?this.ERRORS[l](p):"-",c.data=p,c}_initErrors(){var l,p,c;a(this,o),this.ERRORS={},c=this._ERRORS;for(p in c)l=c[p],this.ERRORS[p]=this.createErrorMessage(l)}createErrorMessage(l){return function(p){return l.replace("__key",p.type)}}}return o.prototype._ERRORS={ENOTFOUND:"Key `__key` not found",ECACHEFULL:"Cache max keys amount exceeded",EKEYTYPE:"The key argument has to be of type `string` or `number`. Found: `__key`",EKEYSTYPE:"The keys argument has to be an array.",ETTLTYPE:"The ttl argument has to be a number."},o}.call(this)}).call(Jc)});var ad=an((ed,id)=>{(function(){var s;s=id.exports=td(),s.version="5.1.2"}).call(ed)});var ld=an((fz,Vd)=>{Vd.exports={name:"fansunited-sdk-esm",version:"1.111.0",description:"Javascript SDK implemented as a standard module system",author:"fansunited",license:"ISC",homepage:"https://fansunitedmedia.com/",type:"module",exports:{".":{import:"./index.js",types:"./types/index.d.ts"},"./Core/*":{import:"./Core/*.js",types:"./types/Core/*.d.ts"}},typesVersions:{"*":{"*":["./types/*"],"Core/*":["./types/Core/*"]}},files:["*.js","*.d.ts","types/**/*.d.ts","types/Core/**/*.js","types/Core/**/*.d.ts"],sideEffects:!1}});var rn=(I=>(I.EN="en",I.BG="bg",I.RO="ro",I.EL="el",I.SK="sk",I.PT="pt",I.SR="sr",I.HU="hu",I.SV="sv",I.ES="es",I.FR="fr",I.NL="nl",I.DE="de",I.IT="it",I))(rn||{});var on=class{validate=t=>{let e=this.validateField(t.lang),i=this.generateMessage(e);return{validation:e,message:i}};validateField=t=>{let e=Object.values(rn),i=null;return t!=null&&t.length>0?e.includes(t)?i="valid":i="invalid":i="missing",i};generateMessage=t=>{let e=null,i="warning";return t==="missing"&&(e="If no lang is passed the default one will be set which is: en"),t==="invalid"&&(e="This lang value is not supported, the default one will be set which is: en"),t==="valid"&&(e=null,i=null),{text:e,type:i}}};var ki=(o=>(o.DEV="dev",o.PROD="prod",o.STAGING="staging",o.WATG="watg",o.YOLO="yolo",o.CSKA="cska",o))(ki||{});var sn=class{validate(t){let e=this.validateField(t.environment),i=this.generateMessage(e);return{validation:e,message:i}}validateField=t=>{let e=Object.values(ki),i=null;return t!=null&&t.length>0?e.includes(t)?i="valid":i="invalid":i="missing",i};generateMessage=t=>{let e=null,i="warning";return t==="missing"&&(e="If no environment is passed the default one will be set which is: prod"),t==="invalid"&&(e="This environment value is not supported, the default one will be set which is: prod"),t==="valid"&&(e=null,i=null),{text:e,type:i}}};var nn=class{validate(t){let e=this.validateField(t.apiKey),i=this.generateMessage(e);return{validation:e,message:i}}validateField=t=>{let e=null;return t!=null&&t.length>0?e="valid":e="missing",e};generateMessage=t=>{let e=null,i="error";return t==="missing"&&(e="The field apiKey with valid value must be provided to use Fans United JS SDK"),t==="valid"&&(i=null),{text:e,type:i}}};var D=(r=>(r.NATIVE="native",r.ENETPULSE="enetpulse",r.SPORTRADAR="sportradar",r.SPORTAL_365="sportal365",r.API_FOOTBALL="api_football",r))(D||{});var ln=class{validate(t){let e=this.validateField(t.idSchema),i=this.generateMessage(e);return{validation:e,message:i}}validateField=t=>{let e=Object.values(D),i=null;return t!=null&&t.length>0?e.includes(t)?i="valid":i="invalid":i="missing",i};generateMessage=t=>{let e=null,i="warning";return t==="missing"&&(e="If no idSchema is passed the default one will be set which is: native"),t==="invalid"&&(e="This idSchema value is not supported, the default one will be set which is: native"),t==="valid"&&(e=null,i=null),{text:e,type:i}}};var ee=class{getIdToken=null;logout=null};var lt=class{text=null;type=null};var Gi=class{validation=null;message=new lt;getIdToken={validation:null,message:new lt};logout={validation:null,message:new lt}};var pn=class{validate(t){if(t.cookieToken)return new Gi;let e=this.validateAuthProvider(t.authProvider);return e.validation!=="missing"&&(e=this.validateAuthProviderConfigFields(t.authProvider,e),e=this.generateAuthProviderConfigMessages(e),e=this.checkAuthProviderConfigMessagesForErrors(e)),e}validateAuthProvider=t=>{let e=Object.keys(new ee),i=new Gi;if(t){let r=Object.keys(t).filter(o=>!e.includes(o));r.length>0?(i.validation="invalid",i.message.type="warning",i.message.text=`${"You have passed a property which is not supported for the authentication provider:"} ${r.join(",")}`):i.validation="valid"}else i.validation="missing",i.message.type="error",i.message.text="The field authProvider must be provided to use this SDK";return i};validateAuthProviderConfigFields=(t,e)=>(Object.keys(new ee).forEach(a=>{t[a]?e[a].validation="valid":e[a].validation="missing"}),e);generateAuthProviderConfigMessages=t=>(Object.keys(t).filter(e=>e!=="validation"&&e!=="message").forEach(e=>{let i=t[e];i.validation==="missing"&&(i.message.text=`${"The following property is missing from the authProvider object:"} ${e}`,i.message.type="error")}),t);checkAuthProviderConfigMessagesForErrors=t=>(Object.keys(t).filter(e=>e!=="validation"&&e!=="message").forEach(e=>{t[e].validation==="missing"&&t.validation==="valid"&&(t.validation="invalid",t.message.type="error",t.message.text="The field authProvider has missing properties")}),t)};var mt=class{validation;message};var cn=class{apiKey=null;environment=null;idSchema=null;clientId=null;lang=null;errorHandlingMode=null;cookieToken={name:new mt,requestHeaders:new mt};oddClient=null;authProvider={getIdToken:new mt,logout:new mt};isValid=!1};var dn=class{validate(t){let e=this.validateField(t.clientId),i=this.generateMessage(e);return{validation:e,message:i}}validateField=t=>{let e=null;return t!=null&&t.length>0?e="valid":e="missing",e};generateMessage=t=>{let e=null,i="error";return t==="missing"&&(e="The field clientId must be provided to use Fans United JS SDK"),t==="valid"&&(e=null,i=null),{text:e,type:i}}};var mp=(e=>(e.DEFAULT="default",e.STANDARD="standard",e))(mp||{});var un=class{validate=t=>{let e=this.validateField(t.errorHandlingMode),i=this.generateMessage(e);return{validation:e,message:i}};validateField=t=>{let e=["default","standard"],i=null;return t?e.includes(t)?i="valid":i="invalid":i="missing",i};generateMessage=t=>{let e=null,i="warning";return t==="missing"&&(e="If no errorHandlingMode is passed the default one will be set which is: default"),t==="invalid"&&(e="This errorHandlingMode value is not supported, the default one will be set which is: default"),t==="valid"&&(e=null,i=null),{text:e,type:i}}};var Ui=class extends mt{name={validation:null,message:new lt};requestHeaders={validation:null,message:new lt}};var mn=class{keys=["name","requestHeaders"];isServerSide=typeof document>"u";validate(t){if(!t.cookieToken){let i=new Ui;return i.message={type:null,text:null},i.validation="valid",i}let e=this.validateCookieToken(t.cookieToken);return e=this.validateCookieTokenConfigFields(t.cookieToken,e),e=this.generateCookieTokenConfigMessages(e),e=this.checkCookieTokenConfigMessagesForErrors(e),e}validateCookieToken=t=>{let e=new Ui;e.message={type:null,text:null};let a=Object.keys(t).filter(r=>!this.keys.includes(r));return a.length>0?(e.validation="invalid",e.message.type="warning",e.message.text=`${"You have passed properties which are not supported for the cookie token configuration property:"} ${a.join(",")}`):e.validation="valid",e};validateCookieTokenConfigFields=(t,e)=>(this.keys.forEach(i=>{t[i]?e[i].validation="valid":i==="requestHeaders"&&!this.isServerSide?e[i].validation="valid":e[i].validation="missing"}),e);generateCookieTokenConfigMessages=t=>(Object.keys(t).filter(e=>e!=="validation"&&e!=="message").forEach(e=>{let i=t[e];i.validation==="missing"&&(i.message.text=`${"The following property is missing from the cookieToken object:"} ${e}`,i.message.type="error")}),t);checkCookieTokenConfigMessagesForErrors=t=>(Object.keys(t).filter(e=>e!=="validation"&&e!=="message").forEach(e=>{t[e].validation==="missing"&&(t.validation="invalid",t.message.type="error",t.message.text="The field cookieToken has missing properties")}),t)};var Vi=class extends mt{name={validation:null,message:new lt};credentials={validation:null,message:new lt}};var hn=class{keys=["name","credentials"];validate=t=>{if(!t.oddClient){let i=new Vi;return i.validation="missing",i.message={type:"warning",text:"If no oddClient is passed the Odds namespace will not work. For more information check our documentation: https://docs.fansunitedmedia.com/docs/javascript-sdk#/"},i}let e=this.validateOddClient(t.oddClient);return e.message.type==="error"||(e=this.validateOddClientConfigFields(t.oddClient,e),e=this.checkOddClientMissingProperties(e),e.message.type==="error")||(e=this.validateOddClientCredentials(t.oddClient.credentials,e)),e};validateOddClient=t=>{let e=new Vi;if(e.message={type:null,text:null},!(t instanceof Object))return e.validation="invalid",e.message.type="error",e.message.text="The oddClient object is not valid. For more information check our documentation: https://docs.fansunitedmedia.com/docs/javascript-sdk#/",e;let a=Object.keys(t).filter(r=>!this.keys.includes(r));return a.length>0?(e.validation="invalid",e.message.type="warning",e.message.text=`${"You have passed properties which are not supported for the odd client configuration property:"} ${a.join(",")}`):e.validation="valid",e};validateOddClientConfigFields=(t,e)=>(this.keys.forEach(i=>{t[i]?e[i].validation="valid":e[i].validation="missing"}),e);validateOddClientCredentials=(t,e)=>{if(!(t instanceof Object))return e.credentials.validation="invalid",e.credentials.message.type="error",e.credentials.message.text="The odd client credentials object is not valid. The odd client will not work without credentials. For more information check our documentation: https://docs.fansunitedmedia.com/docs/javascript-sdk#/",e;let i=Object.keys(t),a=["username","password"],r=a.filter(n=>!i.includes(n));r.length>0&&(e.credentials.validation="invalid",e.credentials.message.type="error",e.credentials.message.text=`${"The following property is missing from the odd client credentials object:"} ${r.join(", ")}`),i.length>0&&r.length===0&&(!t.username||!t.password)&&(e.credentials.validation="invalid",e.credentials.message.type="error",e.credentials.message.text="The odd client credentials object is not valid. The odd client will not work without credentials. For more information check our documentation: https://docs.fansunitedmedia.com/docs/javascript-sdk#/");let o=i.filter(n=>!a.includes(n));return o.length>0&&(e.credentials.validation="invalid",e.credentials.message.type="warning",e.credentials.message.text=`${"You have passed properties which are not supported for the odd client credentials configuration property:"} ${o.join(", ")}`),e};checkOddClientMissingProperties=t=>(Object.keys(t).filter(e=>e!=="validation"&&e!=="message").forEach(e=>{t[e].validation==="missing"&&(t.validation="invalid",t.message.type="error",t.message.text="The field oddClient has missing properties. For more information check our documentation: https://docs.fansunitedmedia.com/docs/javascript-sdk#/")}),t)};var fn=class{validate=t=>{let e=this.checkFieldsForValues(t);return e.isValid=this.containsErrorMessage(e),e};checkFieldsForValues=t=>{let e=new cn,i={apiKey:new nn,environment:new sn,idSchema:new ln,clientId:new dn,lang:new on,errorHandlingMode:new un,authProvider:new pn,cookieToken:new mn,oddClient:new hn};for(let[a,r]of Object.entries(e))a!=="isValid"&&(r=i[a].validate(t));return Object.keys(i).forEach(a=>{e[a]=i[a].validate(t)}),e};containsErrorMessage=t=>{let e=!0;for(let[i,a]of Object.entries(t))if(i!=="authProvider"&&i!=="cookieToken"&&i!=="oddClient"){if(i!=="isValid"&&a.message.type==="error")return e=!1,e;if(i!=="isValid"&&a.message.type==="warning")return e=!0,e}else if(a.message.type==="error"||i==="oddClient"&&a.credentials.message.type==="error")return e=!1,e;return e}};var nc=s=>{let t=200,e=[],i=0;return e[i]=[],s.forEach(a=>{e[i].length<=t-1?e[i].push(a):(i++,e[i]=[a])}),e},Gt=(s,t)=>{let e=[];for(;s.length>t;){let i=s.splice(0,t);e.push(i)}return e.push(s),e},v=(s,t)=>{let e="",i={profile:"https://profile.fansunitedapi.com/v1",football:"https://football.fansunitedapi.com/v1",idMapping:"https://id-mapping.fansunitedapi.com/v1",predictor:"https://prediction.fansunitedapi.com/v1",client:"https://client.fansunitedapi.com/v1",loyalty:"https://loyalty.fansunitedapi.com/v1",miniGames:"https://mini-games.fansunitedapi.com/v1",discussions:"https://discussions.fansunitedapi.com/v1",privateLeagues:"https://private-leagues.fansunitedapi.com/v1",voting:"https://voting.fansunitedapi.com/v1"},a={profile:"https://profile.watg.fansunitedapi.com/v1",football:"https://football.watg.fansunitedapi.com/v1",idMapping:"https://id-mapping.watg.fansunitedapi.com/v1",predictor:"https://prediction.watg.fansunitedapi.com/v1",client:"https://client.watg.fansunitedapi.com/v1",loyalty:"https://loyalty.watg.fansunitedapi.com/v1",miniGames:"https://mini-games.watg.fansunitedapi.com/v1",discussions:"https://discussions.watg.fansunitedapi.com/v1",privateLeagues:"https://private-leagues.watg.fansunitedapi.com/v1",voting:"https://voting.watg.fansunitedapi.com/v1"},r={profile:"https://profile.yolo.fansunitedapi.com/v1",football:"https://football.yolo.fansunitedapi.com/v1",idMapping:"https://id-mapping.yolo.fansunitedapi.com/v1",predictor:"https://prediction.yolo.fansunitedapi.com/v1",client:"https://client.yolo.fansunitedapi.com/v1",loyalty:"https://loyalty.yolo.fansunitedapi.com/v1",miniGames:"https://mini-games.yolo.fansunitedapi.com/v1",discussions:"https://discussions.yolo.fansunitedapi.com/v1",privateLeagues:"https://private-leagues.yolo.fansunitedapi.com/v1",voting:"https://voting.yolo.fansunitedapi.com/v1"},o={profile:"https://profile.cska.fansunitedapi.com/v1",football:"https://football.cska.fansunitedapi.com/v1",idMapping:"https://id-mapping.cska.fansunitedapi.com/v1",predictor:"https://prediction.cska.fansunitedapi.com/v1",client:"https://client.cska.fansunitedapi.com/v1",loyalty:"https://loyalty.cska.fansunitedapi.com/v1",miniGames:"https://mini-games.cska.fansunitedapi.com/v1",discussions:"https://discussions.cska.fansunitedapi.com/v1",privateLeagues:"https://private-leagues.cska.fansunitedapi.com/v1",voting:"https://voting.cska.fansunitedapi.com/v1"},n={profile:"http://localhost:8010/v1",football:"http://localhost:8080/v1",idMapping:"http://localhost:8030/v1",predictor:"http://localhost:8040/v1",client:"http://localhost:8070/v1",loyalty:"http://localhost:8060/v1",miniGames:"http://localhost:9040/v1",discussions:"http://localhost:9020/v1",privateLeagues:"http://localhost:9010/v1",voting:"http://localhost:9030/v1"},l={profile:"https://profile.fansunitedstagingapi.com/v1",football:"https://football.fansunitedstagingapi.com/v1",idMapping:"https://id-mapping.fansunitedstagingapi.com/v1",predictor:"https://prediction.fansunitedstagingapi.com/v1",client:"https://client.fansunitedstagingapi.com/v1",loyalty:"https://loyalty.fansunitedstagingapi.com/v1",miniGames:"https://mini-games.fansunitedstagingapi.com/v1",discussions:"https://discussions.fansunitedstagingapi.com/v1",privateLeagues:"https://private-leagues.fansunitedstagingapi.com/v1",voting:"https://voting.fansunitedstagingapi.com/v1"};return s==="prod"?e=i[t]:s==="dev"?e=n[t]:s==="watg"?e=a[t]:s==="yolo"?e=r[t]:s==="cska"?e=o[t]:e=l[t],e},ie=s=>Array.from(new Set(s)),g=s=>s||!1,f=()=>`&disable_cache=${Date.now()}`,hp=s=>JSON.parse(JSON.stringify(s.sort((t,e)=>t.localeCompare(e))));var it=(_=>(_.FT_1X2="FT_1X2",_.HT_1X2="HT_1X2",_.BOTH_TEAMS_SCORE="BOTH_TEAMS_SCORE",_.DOUBLE_CHANCE="DOUBLE_CHANCE",_.HT_FT="HT_FT",_.PLAYER_SCORE="PLAYER_SCORE",_.PLAYER_YELLOW_CARD="PLAYER_YELLOW_CARD",_.PLAYER_RED_CARD="PLAYER_RED_CARD",_.RED_CARD_MATCH="RED_CARD_MATCH",_.PENALTY_MATCH="PENALTY_MATCH",_.PLAYER_SCORE_FIRST_GOAL="PLAYER_SCORE_FIRST_GOAL",_.CORNERS_MATCH="CORNERS_MATCH",_.CORRECT_SCORE="CORRECT_SCORE",_.CORRECT_SCORE_ADVANCED="CORRECT_SCORE_ADVANCED",_.CORRECT_SCORE_HT="CORRECT_SCORE_HT",_.PLAYER_SCORE_HATTRICK="PLAYER_SCORE_HATTRICK",_.PLAYER_SCORE_TWICE="PLAYER_SCORE_TWICE",_.OVER_GOALS_0_5="OVER_GOALS_0_5",_.OVER_GOALS_1_5="OVER_GOALS_1_5",_.OVER_GOALS_2_5="OVER_GOALS_2_5",_.OVER_GOALS_3_5="OVER_GOALS_3_5",_.OVER_GOALS_4_5="OVER_GOALS_4_5",_.OVER_GOALS_5_5="OVER_GOALS_5_5",_.OVER_GOALS_6_5="OVER_GOALS_6_5",_.OVER_CORNERS_6_5="OVER_CORNERS_6_5",_.OVER_CORNERS_7_5="OVER_CORNERS_7_5",_.OVER_CORNERS_8_5="OVER_CORNERS_8_5",_.OVER_CORNERS_9_5="OVER_CORNERS_9_5",_.OVER_CORNERS_10_5="OVER_CORNERS_10_5",_.OVER_CORNERS_11_5="OVER_CORNERS_11_5",_.OVER_CORNERS_12_5="OVER_CORNERS_12_5",_.OVER_CORNERS_13_5="OVER_CORNERS_13_5",_))(it||{}),Fc=["OVER_GOALS_0_5","OVER_GOALS_1_5","OVER_GOALS_2_5","OVER_GOALS_3_5","OVER_GOALS_4_5","OVER_GOALS_5_5","OVER_GOALS_6_5"],Cc=["OVER_CORNERS_6_5","OVER_CORNERS_7_5","OVER_CORNERS_8_5","OVER_CORNERS_9_5","OVER_CORNERS_10_5","OVER_CORNERS_11_5","OVER_CORNERS_12_5","OVER_CORNERS_13_5"],bt=["PLAYER_RED_CARD","PLAYER_SCORE","PLAYER_SCORE_FIRST_GOAL","PLAYER_SCORE_HATTRICK","PLAYER_SCORE_TWICE","PLAYER_YELLOW_CARD"],vc=["FT_1X2","HT_1X2","HT_FT","DOUBLE_CHANCE","CORNERS_MATCH","CORRECT_SCORE","CORRECT_SCORE_HT","CORRECT_SCORE_ADVANCED"],Hi="PLAYER_SCORE_FIRST_GOAL";var $i=class{id="";achievedAt=""};var ae=class{participationCount=null;points=null};var re=class{totalPoints=null;postPoints=null;postsMade=null;reactionPoints=null;reactionCount=null};var oe=class{participationCount=null};var ni=class{participations=0;points=0};var Ut=class{footballCompetitions=[];footballTeams=[]};var se=class{predictionsMade=0;correct=0;points=0;breakdown=new Ut};var ne=class{single=new se;topX=new ni;matchQuiz=new ni};var Wi=class{overallPercent;byFootballCompetition;byFootballTeam;byFootballMarket};var qi=class{profileId;tier;points;predictionsMade;successRates=new Wi;predictions=new ne;tiers=[];badges=[];discussions=new re;classicQuizzes=new ae;eitherOr=new oe};var zi=class{entityId="";entityType="";entitySource="";model=null;predictionsMade=0;correct=0;points=0};var Qi=class{successRatePercent;model=null};var Ct=class{content=null;tags=[];campaign=null};var le=class{id=null;profileId=null;property=null;value=null;action=null;context=new Ct;points=0};var Q=class{currentPage=null;itemsPerPage=null;totalItems=null;numberOfPages=null};var B=class{pagination=new Q};var Ki=class{meta=new B;data=[new le]};var gn=class{remapSingleResponse=t=>{let e=new le;return e.id=t.id,e.profileId=t.profile_id,e.property=t.property,e.value=t.value,e.action=t.action,e.context.content=t.context.content,e.context.tags=t.context.tags,e.context.campaign=t.context.campaign,e.points=t.points,e};remapActivitiesResponse=t=>{let e=new Ki;return e.meta.pagination.currentPage=t.meta.pagination.current_page,e.meta.pagination.itemsPerPage=t.meta.pagination.items_per_page,e.meta.pagination.numberOfPages=t.meta.pagination.number_of_pages,e.meta.pagination.totalItems=t.meta.pagination.total_items,e.data=t.data.map(i=>this.remapSingleResponse(i)),e};remapStatsResponse=t=>{let e=new qi;return e.profileId=t.profile_id,e.tier=t.tier,e.points=t.points,e.predictionsMade=t.predictions_made,e.successRates.overallPercent=t.success_rates.overall_percent,e.successRates.byFootballCompetition=this.constructNewRecord(t.success_rates.by_competition),e.successRates.byFootballTeam=this.constructNewRecord(t.success_rates.by_team),e.successRates.byFootballMarket=this.constructNewRecord(t.success_rates.by_market),e.predictions=t.predictions?this.remapPredictionsStats(t.predictions):null,e.tiers=t.tiers?this.remapAchievementsStats(t.tiers):null,e.badges=t.badges?this.remapAchievementsStats(t.badges):null,e.discussions=t.discussions?this.remapDiscussionStats(t.discussions):null,e.classicQuizzes=t.classic_quizzes?this.remapClassicQuizStats(t.classic_quizzes):null,e.eitherOr=t.either_or?this.remapEitherOrStats(t.either_or):null,e};constructNewRecord=t=>{let e;if(Object.entries(t).length)Object.entries(t).forEach(([i,a])=>{e={...e,[i]:this.remapSuccessRatePercent(a)},it[i]&&delete e[i].model});else return t;return e};remapSuccessRatePercent=t=>{let e=new Qi;return e.successRatePercent=t.success_rate_percent,e};remapPredictionsStats=t=>{let e=new ne;return e.single=this.remapSinglePredictionsStats(t.single),e.topX=t.top_x,e.matchQuiz=t.match_quiz,e};remapSinglePredictionsStats=t=>{let e=new se;return e.predictionsMade=t.predictions_made,e.correct=t.correct,e.points=t.points,e.breakdown=this.remapBreakdownSinglePredictionsStats(t.breakdown),e};remapBreakdownSinglePredictionsStats=t=>{if(t&&Object.keys(t).length){let e=new Ut,i=[],a=[];return Object.keys(t).forEach(r=>{let o=new zi;o.entityId=r,o.entityType=t[r].entity_type,o.entitySource=t[r].entity_source,o.predictionsMade=t[r].predictions_made,o.correct=t[r].correct,o.points=t[r].points,o.entityType==="competition"?i.push(o):o.entityType==="team"&&a.push(o)}),e.footballCompetitions=i,e.footballTeams=a,e}return new Ut};remapAchievementsStats=t=>t.map(e=>{let i=new $i;return i.id=e.id,i.achievedAt=e.achieved_at,i});remapDiscussionStats=t=>{let e=new re;return e.totalPoints=t.total_points,e.postPoints=t.post_points,e.postsMade=t.posts_made,e.reactionPoints=t.reaction_points,e.reactionCount=t.reaction_count,e};remapClassicQuizStats=t=>{let e=new ae;return e.participationCount=t.participation_count,e.points=t.points,e};remapEitherOrStats=t=>{let e=new oe;return e.participationCount=t.participation_count,e}};function lc(s){this.message=s}lc.prototype=new Error,lc.prototype.name="InvalidCharacterError";var Ac=typeof window<"u"&&window.atob&&window.atob.bind(window)||function(s){var t=String(s).replace(/=+$/,"");if(t.length%4==1)throw new lc("'atob' failed: The string to be decoded is not correctly encoded.");for(var e,i,a=0,r=0,o="";i=t.charAt(r++);~i&&(e=a%4?64*e+i:i,a++%4)?o+=String.fromCharCode(255&e>>(-2*a&6)):0)i="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(i);return o};function Pd(s){var t=s.replace(/-/g,"+").replace(/_/g,"/");switch(t.length%4){case 0:break;case 2:t+="==";break;case 3:t+="=";break;default:throw"Illegal base64url string!"}try{return function(e){return decodeURIComponent(Ac(e).replace(/(.)/g,function(i,a){var r=a.charCodeAt(0).toString(16).toUpperCase();return r.length<2&&(r="0"+r),"%"+r}))}(t)}catch{return Ac(t)}}function fp(s){this.message=s}function Td(s,t){if(typeof s!="string")throw new fp("Invalid token specified");var e=(t=t||{}).header===!0?0:1;try{return JSON.parse(Pd(s.split(".")[e]))}catch(i){throw new fp("Invalid token specified: "+i.message)}}fp.prototype=new Error,fp.prototype.name="InvalidTokenError";var pc=Td;var A=(a=>(a[a.BAD_METHOD_CALL=400]="BAD_METHOD_CALL",a[a.UNAUTHORIZED=401]="UNAUTHORIZED",a[a.NOT_FOUND=404]="NOT_FOUND",a[a.PRECONDITION_FAILED=412]="PRECONDITION_FAILED",a))(A||{});var O=(E=>(E.INVALID_TEMPLATE="INVALID_TEMPLATE",E.INVALID_PREDICTION="INVALID_PREDICTION",E.INVALID_MARKET="INVALID_MARKET",E.INVALID_FIELD="INVALID_FIELD",E.INVALID_TYPE="INVALID_TYPE",E.EXCEEDED_LENGTH="EXCEEDED_LENGTH",E.INVALID_TOKEN="invalid_token",E.UNAUTHORIZED="unauthorized",E.INVALID_FILTERS="invalid_filters",E.INVALID_AVATAR="invalid_avatar",E.INVALID_METHOD_CALL="invalid_method_call",E.INVALID_LIMIT="invalid_limit",E.INVALID_TEMPLATE_GROUP_ID="invalid_template_group_id",E.INVALID_TEMPLATE_GROUP_FILTERS="invalid_template_group_filters",E.INVALID_PAGE_NUMBER="invalid_page_number",E.INVALID_DISCUSSION_IDS="invalid_discussion_ids",E.ID_MAPPING_NOT_FOUND="id_mapping_not_found",E.INVALID_COMPETITION_ID="invalid_competition_id",E.INVALID_TEAM_ID="invalid_team_id",E.INVALID_IDS="invalid_ids",E.INVALID_INPUT_PROVIDER="invalid_input_provider",E.INVALID_OUTPUT_PROVIDER="invalid_output_provider",E.INVALID_MATCH_SUMMARY="invalid_match_summary",E.INVALID_MATCH_SUMMARY_PREDICTIONS="invalid_match_summary_predictions",E.INVALID_MATCH_SUMMARY_PREDICTIONS_KEYS="invalid_match_summary_predictions_keys",E.ENTITY_IDS_NOT_FOUND="entity_ids_not_found",E.MATCH_IDS_NOT_FOUND="match_ids_not_found",E.INVALID_MATCH_IDS="invalid_match_ids",E.ODD_CLIENT_CONFIGURATION_NOT_FOUND="odd_client_configuration_not_found",E))(O||{});var N={native:"id",sportradar:"sportradar_id",sportal365:"sportal365_id",enetpulse:"enetpulse_id",api_football:"api_football_id"},cc={PREDICTOR_USER_RELATED_OPERATION:"https://docs.fansunitedmedia.com/docs/predictor-operations#user-related-operations"},dc=["matchId","matchType","market","prediction"],Oc=new Map().set("FT_1X2","fullTimeOneXTwo").set("HT_1X2","halfTimeOneXTwo").set("BOTH_TEAMS_SCORE","bothTeamsScore").set("DOUBLE_CHANCE","doubleChance").set("HT_FT","halfTimeFullTime").set("PLAYER_SCORE","playerScore").set("PLAYER_YELLOW_CARD","playerYellowCard").set("PLAYER_RED_CARD","playerRedCard").set("RED_CARD_MATCH","redCardMatch").set("PENALTY_MATCH","penaltyMatch").set("PLAYER_SCORE_FIRST_GOAL","playerScoreFirstGoal").set("CORNERS_MATCH","cornersMatch").set("CORRECT_SCORE","correctScore").set("CORRECT_SCORE_ADVANCED","correctScoreAdvanced").set("CORRECT_SCORE_HT","correctScoreHalfTime").set("PLAYER_SCORE_HATTRICK","playerScoreHattrick").set("PLAYER_SCORE_TWICE","playerScoreTwice").set("OVER_GOALS_0_5","overZeroPointFiveGoals").set("OVER_GOALS_1_5","overOnePointFiveGoals").set("OVER_GOALS_2_5","overTwoPointFiveGoals").set("OVER_GOALS_3_5","overThreePointFiveGoals").set("OVER_GOALS_4_5","overFourPointFiveGoals").set("OVER_GOALS_5_5","overFivePointFiveGoals").set("OVER_GOALS_6_5","overSixPointFiveGoals").set("OVER_CORNERS_6_5","overSixPointFiveCorners").set("OVER_CORNERS_7_5","overSevenPointFiveCorners").set("OVER_CORNERS_8_5","overEightPointFiveCorners").set("OVER_CORNERS_9_5","overNinePointFiveCorners").set("OVER_CORNERS_10_5","overTenPointFiveCorners").set("OVER_CORNERS_11_5","overElevenPointFiveCorners").set("OVER_CORNERS_12_5","overTwelvePointFiveCorners").set("OVER_CORNERS_13_5","overThirteenPointFiveCorners");var k=(M=>(M.INVALID_MATCH_ID="Match id is invalid!",M.INVALID_PLAYER_ID="Player id is invalid!",M.QUERY_PARAM_MATCH_IDS_EXCEEDED="Maximum matchIds in PredictionFilters should be 10 or less.",M.QUERY_PARAM_FILTERS_LIMIT_EXCEEDED="Maximum limit for filtering games is 50 or less.",M.INVALID_FIXTURES_FIELD="Fixtures field is invalid. For more information please visit our documentation",M.INVALID_TOKEN="Invalid JWT token is provided",M.EXPIRED_TOKEN="The provided JWT token is expired",M.ENTITIES_NEEDED="At least one of footballCompetitions, footballTeams or footballPlayers properties should be provided for filters.",M.ENTITIES_FOLLOWS_FILTERS_EXCEEDED="Maximum length per entity should be 24 or less.",M.INVALID_TYPE="You have provided invalid type. The valid type is ",M.INVALID_VALUE="You have provided invalid value. The valid value is ",M.INVALID_AVATAR="Invalid URL syntax for avatar image.",M.INVALID_GET_PROFILES_METHOD_CALL="The method 'getByIds' from Profile namespace is not called correctly. You need to provide 'profileIds' OR 'search' parameters to the method, but you can't use both of them or neither of them.",M.INVALID_LIMIT="Invalid limit. The maximum limit is: ",M.INVALID_LIMIT_TYPE="Invalid limit type. The proper type is number.",M.FILTER_COMBINATION_ERROR="You need to use both 'entityIds' and 'entityType' filters together",M.INVALID_ENTITY_TYPE="Invalid 'entityType' filter. Please use one of the following valid options: competition, team, or player",M.INVALID_TEMPLATE_GROUP_ID="There is no group in this template with the provided groupId",M.INVALID_TEMPLATE_GROUP_FILTERS="The provided template group has no filters",M.INVALID_PAGE_NUMBER="Invalid page number provided. Use number between 1 and max number of pages.",M.INVALID_DISCUSSION_IDS="Invalid discussion ids argument. Please provide at least one discussion id in an array",M.EXCEEDED_DISCUSSION_IDS="Maximum number of discussion ids exceeded. The maximum number of discussion ids is 50. You can use 'getPostsCountExtended' method for more than 50 discussion ids.",M.EXCEEDED_EXTENDED_DISCUSSION_IDS="Maximum number of discussion ids exceeded. The maximum number of discussion ids is: ",M.ID_MAPPING_NOT_FOUND="No ID mappings are available for the provided ID. ID argument: ",M.INVALID_PARAM="Invalid parameter provided. Please check the following parameter: ",M.INVALID_COMPETITION_ID="Invalid competition ID provided. Please provide a valid competition ID.",M.INVALID_TEAM_ID="Invalid team ID provided. Please provide a valid team ID.",M.INVALID_OR_EMPTY_IDS="Invalid or empty IDs provided. Please provide at least one ID.",M.INVALID_PROVIDER="Invalid provider. The valid providers are: 'native', 'enetpulse', 'sportal365', 'sportradar' and 'api_football'.",M.INVALID_OUTPUT_PROVIDER="Invalid output provider. The output can not be the same as the input provider.",M.MATCH_SUMMARY_REQUIRED="Match summary is required.",M.MATCH_SUMMARY_PREDICTIONS_REQUIRED="Predictions in match summary are required.",M.INVALID_MATCH_SUMMARY_PREDICTIONS_KEYS="Keys in predictions in match summary are invalid. The valid ones are: ",M.INVALID_COLLECT_LEAD_METHOD_CALL="The method 'collectLead' from Profile namespace is not called correctly. You need to provide 'requestBody' parameter to the method.",M.REQUIRED_FIXTURES_FIELD="Fixtures field is required and should contain at least one BracketGameFixtures object. For more information please visit our documentation",M.INVALID_TIEBREAKER_FIELD="Tiebreaker field is invalid. It should contain statTotal key with integer value. For more information please visit our documentation",M.ENTITY_IDS_NOT_FOUND="Some of the sport entity IDs were not found for the provided id schema",M.MATCH_IDS_NOT_FOUND="Some of the match IDs were not found for the provided id schema",M.INVALID_STANDING_PREDICTION_ARGUMENT="The prediction argument is invalid. For more information please visit our documentation",M.INVALID_MAP_PLAYERS_ROLES_KEYS="The keys in the players roles map are not part of the valid keys. The valid keys are: ",M.INVALID_MAP_PLAYERS_ROLES_VALUES="The values in the map are not valid. The valid ones are: ",M.INVALID_MATCH_IDS="Match IDs are invalid!",M.MISSING_ODD_CLIENT_CONFIGURATION="Odds namespace requires oddClient configuration to be set",M))(k||{}),uc={UNEXPECTED_STATUS_PROP:`Unexpected provided property 'status'. You can NOT use this property for this method. For more information visit our documentation:
|
|
2
|
-
${
|
|
3
|
-
${cc.PREDICTOR_USER_RELATED_OPERATION}`},Lc=(s,t)=>`The prediction '${s}' is invalid for market '${t}'. Please check again have you passed appropriate prediction model. For more information please visit our documentation: https://docs.fansunitedmedia.com/sdks/js/match.quiz#gamerelatedoperations`,gp=s=>`The market '${s}' is not supported from Fans United. For more information please visit our documentation: https://docs.fansunitedmedia.com/docs/predictor-operations#make-football-prediction`,xc=s=>`The market '${s}' is not valid for Top X game. The only available market is CORRECT_SCORE.`,Dc=s=>`The field/s '${s.length>1?s.join(", "):s[0]}' is/are invalid. For more information please visit our documentation: https://docs.fansunitedmedia.com/docs/javascript-sdk`,Bc=(s,t)=>`The following field/s is/are missing from ${s}: '${t.length>1?t.join(", "):t[0]}'. For more information please visit our documentation: https://docs.fansunitedmedia.com/docs/predictor-operations#make-football-prediction`,Nc=(s,t)=>`The field ${s} has incorrect type. The correct type is ${t}`;var Vt=class{data={error:{code:0,status:"",message:""}};status=0;statusText="";headers=null;constructor(t,e){this.data.error.code=e.code,this.data.error.status=e.status,this.data.error.message=e.message,this.status=t.status,this.statusText=t.statusText,this.headers=t.headers}errorMessage=()=>this.data.error.message};var m=class{error={code:0,status:"",message:""};constructor(t,e,i){this.error.code=t,this.error.status=e,this.error.message=i}};var C=class{baseUrl=null;apiSignInUrl=null;jwtToken=null;idSchema=null;retryRequest=!1;headers=null;authHeaders=null;errorHandlingMode=null;configuration=null;constructor(t,e){this.baseUrl=e,this.configuration=t,this.apiSignInUrl=`?key=${t.apiKey}&client_id=${t.clientId}`,this.errorHandlingMode=t.errorHandlingMode,this.idSchema=t.idSchema,this.headers={"Content-Type":"application/json"}}getJwtToken=()=>{if(this.configuration.cookieToken){let t=[];typeof document>"u"?t=(this.configuration.cookieToken.requestHeaders.get("cookie")||"").split(";"):t=document.cookie.split(";");let e=t.find(r=>r.trim().startsWith(`${this.configuration.cookieToken.name}=`));if(!e)return"";let i=e.split("=")[1].trim(),a=decodeURIComponent(i);try{let r=JSON.parse(a);return r.token||r||""}catch{return a}}return this.configuration.authProvider?.getIdToken()||""};getAuthHeaders=()=>({"Content-Type":"application/json",Authorization:`Bearer ${this.getJwtToken()}`});fetchWithoutAuth=async(t,e,i,a)=>{let r=null;a?r=await fetch(this.baseUrl+t,{headers:this.headers,method:i||"GET",body:JSON.stringify(a)}):r=await fetch(this.baseUrl+t,{headers:this.headers,method:i||"GET"});let o=await r.json();if(!r.ok){let n=this.transformFetchException(r,o);throw console.warn(e,n),n}return o};fetchWithoutAuthAdditionalHeaders=async(t,e,i)=>{let a=await fetch(this.baseUrl+t,{headers:{...this.headers,...i}}),r=await a.json();if(!a.ok){let o=this.transformFetchException(a,r);throw console.warn(e,o),o}return r};fetchWithAuth=async(t,e,i,a)=>{this.validateJWTToken();let r=null,o=null;if(i&&a?r=await fetch(this.baseUrl+t,{method:i,headers:this.getAuthHeaders(),body:JSON.stringify(a)}):i&&!a?r=await fetch(this.baseUrl+t,{method:i,headers:this.getAuthHeaders()}):r=await fetch(this.baseUrl+t,{headers:this.getAuthHeaders()}),i!=="DELETE"&&(o=await r.json()),!r.ok){(r.status===401||r.status===403)&&!this.retryRequest&&(this.retryRequest=!0,await this.fetchWithAuth(t,e,i,a)),this.retryRequest=!1;let n=this.transformFetchException(r,o||await r.json());throw console.warn(e,n),n}return this.retryRequest=!1,o};fetchWithAuthNewBaseURL=async(t,e,i,a,r)=>{this.validateJWTToken();let o=null,n=null;if(a&&r?o=await fetch(t+e,{method:a,headers:this.getAuthHeaders(),body:JSON.stringify(r)}):a&&!r?o=await fetch(t+e,{method:a,headers:this.getAuthHeaders()}):o=await fetch(t+e,{headers:this.getAuthHeaders()}),a!=="DELETE"&&(n=await o.json()),!o.ok){(o.status===401||o.status===403)&&!this.retryRequest&&(this.retryRequest=!0,await this.fetchWithAuthNewBaseURL(t,e,i,a,r)),this.retryRequest=!1;let l=this.transformFetchException(o,n||await o.json());throw console.warn(i,l),l}return this.retryRequest=!1,n};transformFetchException=(t,e)=>{if(!e&&t.status===401){if(this.errorHandlingMode==="standard")return new m(401,"unauthorized","Invalid JWT token is provided");let o={code:401,status:"unauthorized",message:"Invalid JWT token is provided"};return new Vt(t,o)}let{code:i,status:a,message:r}=e.error;return this.errorHandlingMode==="standard"?new m(i,a,r):new Vt(t,e.error)};validateJWTToken=()=>{let t=null;try{t=pc(this.getJwtToken())}catch(i){if(this.errorHandlingMode==="default"){let a={status:401,statusText:i.message,headers:{}},r={code:401,status:"invalid_token",message:"Invalid JWT token is provided"};throw new Vt(a,r)}else if(this.errorHandlingMode==="standard")throw new m(401,"invalid_token","Invalid JWT token is provided")}if(Date.now()>t.exp*1e3){if(this.errorHandlingMode==="default"){let i={status:401,statusText:"",headers:{}},a={code:401,status:"invalid_token",message:"The provided JWT token is expired"};throw new Vt(i,a)}else if(this.errorHandlingMode==="standard")throw new m(401,"invalid_token","The provided JWT token is expired")}};extractUserIdFromToken=()=>{try{return pc(this.getJwtToken())?.sub||""}catch(t){return console.error(t),""}}};var li=class extends C{activityRemapper=null;constructor(t){super(t,v(t.environment,"loyalty")),this.activityRemapper=new gn}createActivity=async t=>{let e=`/activities${this.apiSignInUrl}`,i="There was a problem with creating activity",a="POST",r=await this.fetchWithAuth(e,i,a,t);return this.activityRemapper.remapSingleResponse(r)};deleteActivity=async t=>{let e=`/activities/${t}${this.apiSignInUrl}`,i=`There was a problem deleting the following activity: ${t}`,a="DELETE";return await this.fetchWithAuth(e,i,a),!0};getOwnActivities=async(t,e)=>{let i=`/activities${this.apiSignInUrl}`,a=Date.now(),r="There was a problem with fetching own activities";t&&(i+=`${t.constructFilterUrl()}`),e&&(i+=`disable_cache=${a}`);let o=await this.fetchWithAuth(i,r);return this.activityRemapper.remapActivitiesResponse(o)};getActivitiesForUser=async(t,e,i)=>{let a=`/users/${t}/activities${this.apiSignInUrl}`,r=Date.now(),o=`There was a problem with fetching activities for user: ${t}`;e&&(a+=`${e.constructFilterUrl()}`),i&&(a+=`disable_cache=${r}`);let n=await this.fetchWithoutAuth(a,o);return this.activityRemapper.remapActivitiesResponse(n)};getStats=async(t,e)=>{let i="",a="",r=null;return t?(i+=g(e)?`/users/${t}/statistics${this.apiSignInUrl}${f()}`:`/users/${t}/statistics${this.apiSignInUrl}`,a=`There was a problem fetching statistics for profile: ${t}`,r=await this.fetchWithoutAuth(i,a)):(i+=`/statistics${this.apiSignInUrl}`,a="There was a problem fetching profile`s statistics",r=await this.fetchWithAuth(i,a)),this.activityRemapper.remapStatsResponse(r.data)}};var mc=(h=>(h.LIKE="like",h.DISLIKE="dislike",h.PAGE_VIEW="page_view",h.CONTENT_CONSUMED="content_consumed",h.SHARE="share",h.COMMENT="comment",h.CLICK_AD="click_ad",h.PREDICTION_MADE="prediction_made",h.CONVERT="convert",h.MANAGE_INTERESTS="manage_interests",h.GAME_PARTICIPATION="game_participation",h.ARTICLE_CONSUMED="article_consumed",h.VIDEO_CONSUMED="video_consumed",h.SHORT_VIDEO_CONSUMED="short_video_consumed",h.LONG_VIDEO_CONSUMED="long_video_consumed",h.AUDIO_CONSUMED="audio_consumed",h.GALLERY_CONSUMED="gallery_consumed",h.IMAGE_CONSUMED="image_consumed",h.POLL_PARTICIPATION="poll_participation",h))(mc||{});var pi=class{action=null;context=new Ct;constructor(t,e,i,a){this.action=t,this.context.tags=e,i&&(this.context.content=i),a&&(this.context.campaign=a)}};var yn={player:"players",team:"teams",homeTeam:"teams",awayTeam:"teams",country:"countries",competition:"competitions",match:"matches"},bn=class extends C{constructor(t){super(t,v(t.environment,"idMapping"))}getEntityById=async(t,e)=>{let i=`/football${this.apiSignInUrl}&input_provider=${this.idSchema}&${yn[t]}=${e}`,a=`There was a problem with id mapping request for the following id: ${e}`;return await this.fetchWithoutAuth(i,a)};getEntityByIdAndSchema=async(t,e,i)=>{let a=`/football${this.apiSignInUrl}&input_provider=${i}&${yn[t]}=${e}`,r=`There was a problem with id mapping request for the following id: ${e}`;return await this.fetchWithoutAuth(a,r)};getEntityIdsByIdsAndSchema=async(t,e,i)=>{let a=`/football${this.apiSignInUrl}&input_provider=${i}&${yn[t]}=${e.join(",")}`,r=`There was a problem with id mapping request for the following ids: ${e.join(",")}`;return await this.fetchWithoutAuth(a,r)};getEntitiesByIds=async(t,e,i)=>{e.sort((o,n)=>o.localeCompare(n));let a=nc(e),r=[];for(let o of a){let n=`/football${this.apiSignInUrl}&input_provider=${i}&${yn[t]}=${o.join(",")}`,l=`There was a problem with id mapping request for the following ids :${o.join(",")}`,p=await this.fetchWithoutAuth(n,l);r=[...r,...p.data]}return r};getEntitiesByIdObjs=async(t,e)=>{let i=[],a={},r=[];Object.keys(t).forEach(p=>{i.push.apply(i,t[p])});let o=ie(i),n=nc(o);for(let p of n){let c="";if(Object.keys(t).forEach(d=>{a[d]=[];let u=p.filter(b=>t[d].includes(b));u&&u.length>0&&(a[d]=u)}),Object.keys(a).forEach(d=>{a[d].length>0&&(a[d].sort((u,b)=>u.localeCompare(b)),c+="&",c+=`${yn[d]}=${a[d].join(",")}`)}),c&&c.length>0){let d=`/football${this.apiSignInUrl}&input_provider=${e||"native"}${c}`,u="There was a problem with id mapping request",b=await this.fetchWithoutAuth(d,u);r.push(b.data)}else r.push([])}return Array.prototype.concat.apply([],r)};getTopEntities=async()=>{let t=`/football/top${this.apiSignInUrl}`,e="There was a problem with top id mappings request";return(await this.fetchWithoutAuth(t,e)).data}};var hc="FansUnited",yp={football:{ids:[],countries:[],competitions:[],expirations:{ids:0}},profile:{info:{},statistics:{},badges:null,countries:[],expirations:{profile:0,statistics:0,badges:0}},client:{features:{},expirations:{features:0}}},ji=class{idSchema="";storageInstance=null;expirationProfileTimeout=600;expirationBadgesTimeout=3600;expirationClientFeaturesTimeout=14400;expirationFootballIdsTimeout=604800;constructor(t){this.idSchema=t,this.getStorageInstance()}static getInstance(t){return ji.instance||(ji.instance=new ji(t)),ji.instance}async getStorageInstance(){try{let t=await Promise.resolve().then(()=>(Gc(),kc));this.storageInstance=t.default}catch(t){console.error(t)}}async getData(){try{let t=await this.storageInstance.getItem(hc);return t?JSON.parse(t):(await this.storageInstance.setItem(hc,JSON.stringify(yp)),yp)}catch(t){throw console.error("AsyncStorage error:",t),t}}async setData(t){await this.storageInstance.setItem(hc,JSON.stringify(t))}clearData=async()=>{await this.setData(yp)};getCompetitions=async t=>{let e=await this.getData();return t?t.competitionSearchFilter(e.football.competitions):e.football.competitions};setCompetitions=async t=>{let e=await this.getData(),i=[...e.football.competitions];i.push(...t),e.football.competitions=this.makeCompetitionsUnique(i),await this.setData(e)};getCompetitionsLength=async()=>(await this.getData()).football.competitions.length;getEntityById=async(t="",e="")=>(await this.getData()).football.ids.find(a=>{let r=N[this.idSchema];return a&&`${a[r]}`===e&&a.resource===t});getEntity=async(t,e,i)=>{let a=await this.getData();return Array.isArray(t)?a.football.ids.filter(r=>{let o=N[i];return r&&t.includes(`${r[o]}`)&&r.resource===e}):a.football.ids.find(r=>{let o=N[i];return r&&`${r[o]}`===t&&r.resource===e})};checkForExistingIdObjs=async(t,e)=>{let i=N[e],a={};for(let r of Object.keys(t)){let o=t[r],l=(await this.getEntity(o,r,e)).map(c=>c[i]),p=t[r].filter(c=>!l.includes(c));a[r]=o.map(c=>p.includes(c)?{id:c,exists:!1}:{id:c,exists:!0})}return a};getIdsByType=async(t,e,i)=>{let a=await this.getData(),r=N[i],o=N[e],n={};return Object.keys(t).forEach(l=>{let p=t[l],c=[];a.football.ids.forEach(d=>{p.forEach((u,b)=>{u===d[o]&&l===d.resource&&(c[b]=d[r])})}),n[l]=c}),n};addIdMapping=async t=>{let e=await this.getData();e.football.ids.push(t),await this.setData(e)};addIdMappings=async t=>{let e=await this.getData(),i=e.football.ids;i=[...i,...t],e.football.ids=i,await this.setData(e)};addTopIdMappings=async t=>{let e=await this.getData();if(e.football.ids.length){let i=JSON.parse(JSON.stringify(e.football.ids));i=i.filter(a=>a.resource!=="match"),t=t.filter(a=>a.resource==="match"),i=[...i,...t],e.football.ids=i}else e.football.ids=t;e.football.expirations.ids=Math.floor(Date.now()/1e3)+this.expirationFootballIdsTimeout,await this.setData(e)};setOwnProfile=async t=>{let e=await this.getData();e.profile.info=t,e.profile.expirations.profile=Math.floor(Date.now()/1e3)+this.expirationProfileTimeout,await this.setData(e)};getOwnProfile=async()=>(await this.getData()).profile.info;getProfileCountries=async()=>(await this.getData()).profile.countries;setProfileCountries=async t=>{let e=await this.getData();e.profile.countries=t,await this.setData(e)};getProfileStats=async()=>(await this.getData()).profile.statistics;setProfileStats=async t=>{let e=await this.getData();e.profile.statistics=t,e.profile.expirations.statistics=Math.floor(Date.now()/1e3)+this.expirationProfileTimeout,await this.setData(e)};getProfileBadges=async()=>(await this.getData()).profile.badges;setProfileBadges=async t=>{let e=await this.getData();e.profile.badges=t,e.profile.expirations.badges=Math.floor(Date.now()/1e3)+this.expirationBadgesTimeout,await this.setData(e)};getFootballCountries=async()=>(await this.getData()).football.countries;setFootballCountries=async t=>{let e=await this.getData();e.football.countries=t,await this.setData(e)};getClientFeatures=async()=>(await this.getData()).client.features;setClientFeatures=async t=>{let e=await this.getData(),i=JSON.parse(JSON.stringify(t));e.client.expirations.features=Math.floor(Date.now()/1e3)+this.expirationClientFeaturesTimeout,e.client.features=i,await this.setData(e)};deleteClientFeatures=async()=>{let t=await this.getData(),e=JSON.parse(JSON.stringify(t));e.client={features:{},expirations:{features:0}},await this.setData(e)};getExpiration=async(t,e)=>{await this.initialNewSchema(t,"expirations");let i=await this.getData();switch(e){case"profile":return i.profile.expirations.profile;case"statistics":return i.profile.expirations.statistics;case"badges":return i.profile.expirations.badges;case"features":return i.client.expirations.features;case"ids":return i.football.expirations.ids}};makeCompetitionsUnique=t=>{let e=new Set;return t.filter(i=>{let a=!e.has(i.id);return e.add(i.id),a})};initialNewSchema=async(t,e)=>{let i=await this.getData();(!i||!i[t]||!i[t][e])&&await this.setData(yp)}},Yi=ji;et(Yi,"instance");var fc="FansUnited",gc={football:{ids:[],countries:[],competitions:[],expirations:{ids:0}},profile:{info:{},statistics:{},badges:null,countries:[],expirations:{profile:0,statistics:0,badges:0}},client:{features:{},expirations:{features:0}}},Xi=class{idSchema="";expirationProfileTimeout=600;expirationBadgesTimeout=3600;expirationClientFeaturesTimeout=14400;expirationFootballIdsTimeout=604800;constructor(t){this.idSchema=t}static getInstance(t){return Xi.instance||(Xi.instance=new Xi(t)),Xi.instance}clearData=async()=>{this.setData(gc)};getEntityById=async(t="",e="")=>this.getData().football.ids.find(i=>{let a=N[this.idSchema];return i&&`${i[a]}`===e&&i.resource===t});getEntity=(t,e,i)=>Array.isArray(t)?this.getData().football.ids.filter(a=>{let r=N[i];return a&&t.includes(`${a[r]}`)&&a.resource===e}):this.getData().football.ids.find(a=>{let r=N[i];return a&&`${a[r]}`===t&&a.resource===e});getEntityByNativeId=(t="",e="")=>this.getData().football.ids.find(i=>i&&`${i.id}`===e&&i.resource===t);checkForExistingIdObjs=async(t,e)=>{let i=N[e],a={};return Object.keys(t).forEach(r=>{let o=t[r],l=this.getEntity(o,r,e).map(c=>c[i]),p=t[r].filter(c=>!l.includes(c));a[r]=o.map(c=>p.includes(c)?{id:c,exists:!1}:{id:c,exists:!0})}),a};getIdsByType=async(t,e,i)=>{let a=N[i],r=N[e],o={};return Object.keys(t).forEach(n=>{let l=t[n],p=[];this.getData().football.ids.forEach(c=>{l.forEach((d,u)=>{d===c[r]&&n===c.resource&&(p[u]=c[a])})}),o[n]=p}),o};addIdMapping=t=>{let e=this.getData();e.football.ids.push(t),this.setData(e)};addIdMappings=async t=>{let e=this.getData(),i=e.football.ids;i=[...i,...t],e.football.ids=i,this.setData(e)};addTopIdMappings=async t=>{let e=this.getData();if(e.football.ids.length){let i=JSON.parse(JSON.stringify(e.football.ids));i=i.filter(a=>a.resource!=="match"),t=t.filter(a=>a.resource==="match"),i=[...i,...t],e.football.ids=i}else e.football.ids=t;e.football.expirations.ids=Math.floor(Date.now()/1e3)+this.expirationFootballIdsTimeout,this.setData(e)};setOwnProfile=async t=>{let e=this.getData();e.profile.info=t,e.profile.expirations.profile=Math.floor(Date.now()/1e3)+this.expirationProfileTimeout,this.setData(e)};getOwnProfile=()=>this.getData().profile.info;getProfileCountries=()=>this.getData().profile.countries;setProfileCountries=async t=>{let e=this.getData();e.profile.countries=t,this.setData(e)};getProfileStats=()=>this.getData().profile.statistics;setProfileStats=async t=>{let e=this.getData();e.profile.statistics=t,e.profile.expirations.statistics=Math.floor(Date.now()/1e3)+this.expirationProfileTimeout,this.setData(e)};getProfileBadges=()=>this.getData().profile.badges;setProfileBadges=async t=>{let e=this.getData();e.profile.badges=t,e.profile.expirations.badges=Math.floor(Date.now()/1e3)+this.expirationBadgesTimeout,this.setData(e)};getFootballCountries=()=>this.getData().football.countries;setFootballCountries=async t=>{let e=this.getData();e.football.countries=t,this.setData(e)};getCompetitions=t=>{let e=this.getData();return t?t.competitionSearchFilter(e.football.competitions):e.football.competitions};setCompetitions=async t=>{let e=this.getData(),i=[...e.football.competitions];i.push(...t),e.football.competitions=this.makeCompetitionsUnique(i),this.setData(e)};getCompetitionsLength=async()=>{let{football:t}=this.getData();return t.competitions.length};getClientFeatures=()=>this.getData().client.features;setClientFeatures=async t=>{let e=this.getData(),i=JSON.parse(JSON.stringify(t));e.client.expirations.features=Math.floor(Date.now()/1e3)+this.expirationClientFeaturesTimeout,e.client.features=i,this.setData(e)};deleteClientFeatures=async()=>{let t=this.getData(),e=JSON.parse(JSON.stringify(t));e.client={features:{},expirations:{features:0}},this.setData(e)};getExpiration=async(t,e)=>{this.initialNewSchema(t,"expirations");let i=this.getData();switch(e){case"profile":return i.profile.expirations.profile;case"statistics":return i.profile.expirations.statistics;case"badges":return i.profile.expirations.badges;case"features":return i.client.expirations.features;case"ids":return i.football.expirations.ids}};makeCompetitionsUnique=t=>{let e=new Set;return t.filter(i=>{let a=!e.has(i.id);return e.add(i.id),a})};getData=()=>(localStorage.getItem(fc)||this.setData(gc),JSON.parse(localStorage.getItem(fc)));setData=t=>{localStorage.setItem(fc,JSON.stringify(t))};initialNewSchema=(t,e)=>{let i=this.getData();(!i||!i[t]||!i[t][e])&&this.setData(gc)}},Ji=Xi;et(Ji,"instance");var rd=Id(ad());var T=class{profileTTL=600;clientTTL=14400;profileBadgesTTL=3600;idMappingsExpiration=0;idSchema="";constructor(t){}static getInstance(t){return T.instance||(T.instance=new T(t),T.nodeCache.options.useClones=!1),T.instance}clearData=async()=>T.nodeCache.flushAll();getEntityById=async(t,e)=>{let i=T.nodeCache.get("ids");return i?i.find(a=>{let r=N[this.idSchema];return a&&`${a[r]}`===e&&a.resource===t}):null};getEntity=async(t,e,i)=>{let a=T.nodeCache.get("ids");return a?Array.isArray(t)?[]:null:Array.isArray(t)?a.filter(r=>{let o=N[i];return r&&t.includes(`${r[o]}`)&&r.resource===e}):a.find(r=>{let o=N[i];return r&&`${r[o]}`===t&&r.resource===e})};checkForExistingIdObjs=async(t,e)=>{let i=N[e],a={};for(let r of Object.keys(t)){let o=t[r],l=(await this.getEntity(o,r,e)).map(c=>c[i]),p=t[r].filter(c=>!l.includes(c));a[r]=o.map(c=>p.includes(c)?{id:c,exists:!1}:{id:c,exists:!0})}return a};getIdsByType=async(t,e,i)=>{let a=N[i],r=N[e],o=T.nodeCache.get("ids"),n={};return o?(Object.keys(t).forEach(l=>{let p=t[l],c=[];o.forEach(d=>{p.forEach((u,b)=>{u===d[r]&&l===d.resource&&(c[b]=d[a])})}),n[l]=c}),n):null};addIdMapping=async t=>{let e=T.nodeCache.get("ids");e.push(t),T.nodeCache.set("ids",e)};addIdMappings=async t=>{let e=T.nodeCache.get("ids");e=[...e,...t],T.nodeCache.set("ids",e)};addTopIdMappings=async t=>{let e=T.nodeCache.get("ids"),i=604800;if(e){let a=JSON.parse(JSON.stringify(e));a=a.filter(r=>r.resource!=="match"),t=t.filter(r=>r.resource==="match"),a=[...a,...t],T.nodeCache.set("ids",a)}else T.nodeCache.set("ids",t);this.idMappingsExpiration=Math.floor(Date.now()/1e3)+i};setOwnProfile=async t=>{T.nodeCache.set("profile",t,this.profileTTL)};getOwnProfile=async()=>T.nodeCache.get("profile");getProfileCountries=async()=>T.nodeCache.get("profile_countries");setProfileCountries=async t=>{T.nodeCache.set("profile_countries",t)};getProfileStats=async()=>T.nodeCache.get("profile_stats");setProfileStats=async t=>{T.nodeCache.set("profile_stats",t,this.profileTTL)};getProfileBadges=async()=>T.nodeCache.get("profile_badges");setProfileBadges=async t=>{T.nodeCache.set("profile_badges",t,this.profileBadgesTTL)};getFootballCountries=async()=>T.nodeCache.get("football_countries");setFootballCountries=async t=>{T.nodeCache.set("football_countries",t)};getCompetitions=async t=>{let e=T.nodeCache.get("football_competitions");return e?t?t.competitionSearchFilter(e):e:null};setCompetitions=async t=>{T.nodeCache.set("football_competitions",t)};getCompetitionsLength=async()=>{let t=T.nodeCache.get("football_competitions");return t?t.length:0};getClientFeatures=async()=>T.nodeCache.get("client");setClientFeatures=async t=>{T.nodeCache.set("client",t,this.clientTTL)};deleteClientFeatures=async()=>{T.nodeCache.del("client")};getExpiration=async(t,e)=>{let i=this.getKeyFromExpirationType(e);return i==="ids"?this.idMappingsExpiration:T.nodeCache.getTtl(i)};getKeyFromExpirationType=t=>{switch(t){case"profile":return"profile";case"statistics":return"profile_stats";case"badges":return"profile_badges";case"features":return"client";case"ids":return"ids"}}},ci=T;et(ci,"instance"),et(ci,"nodeCache",new rd.default);var pt=class{createLocalCacheInstance=t=>typeof window>"u"?ci.getInstance(t):typeof __DEV__<"u"?Yi.getInstance(t):Ji.getInstance(t)};var di=class{localCache=null;https=null;constructor(t){this.localCache=new pt().createLocalCacheInstance(t.idSchema),this.https=new bn(t)}getEntitiesByIds=async(t,e,i)=>{await this.setTopIdMappings();try{let a=await this.localCache.checkForExistingIdObjs(t,e),r=this.splitForRequestAndExisting(a),o=await this.https.getEntitiesByIdObjs(r.request,e);return await this.localCache.addIdMappings(o),await this.localCache.getIdsByType(t,e,i)}catch(a){return console.warn("There was a problem retrieving the entity ids ",a),Promise.resolve([])}};getEntitiesByIdsMap=async(t,e,i)=>{await this.setTopIdMappings();try{let a=JSON.parse(JSON.stringify(t)),r=await this.localCache.checkForExistingIdObjs(t,e),o=this.splitForRequestAndExisting(r),n=await this.https.getEntitiesByIdObjs(o.request,e);await this.localCache.addIdMappings(n);let l=await this.localCache.getIdsByType(t,e,i),p=new Map;return Object.keys(a).forEach(c=>{a[c].forEach((d,u)=>{let b=l[c].length&&l[c][u]?l[c][u]:"";p.set(d,b)})}),p}catch(a){return console.warn("There was a problem retrieving the entity ids ",a),Promise.resolve(new Map)}};getEntityById=async(t,e,i)=>{let a=await this.localCache.getEntity(t,e,i);if(a)return a;let r=await this.requestEntity(t,e,i);return await this.localCache.addIdMappings(r),r&&r.length>0?r[0]:null};splitForRequestAndExisting=t=>{let e={},i={};return Object.keys(t).forEach(a=>{e[a]=t[a].filter(r=>!r.exists).map(r=>r.id),i[a]=t[a].filter(r=>r.exists).map(r=>r.id)}),{existing:i,request:e}};requestEntity=async(t,e,i)=>{try{return t=Array.isArray(t)?t:[t],await this.https.getEntitiesByIds(e,t,i)}catch(a){return console.warn(`There was a problem retrieving the requested entity: ${a}`),null}};setTopIdMappings=async()=>{let t=Math.floor(Date.now()/1e3);if(await this.localCache.getExpiration("football","ids")>t)return Promise.resolve();let i=await this.https.getTopEntities();await this.localCache.addTopIdMappings(i)}};var wp=s=>{switch(s){case"competitions":return"competition";case"players":case"relatedPlayer":case"squad":return"player";case"teams":case"participants":case"homeTeam":case"awayTeam":case"timeline":case"teamId":return"team";default:return s}};var Mn=class{extractedObjIds={};traverse=(t,e)=>(e=wp(e),Array.isArray(t)?this.traverseArrExtract(t,e):t&&typeof t=="object"&&this.traverseObjExtract(t,e),this.extractedObjIds);traverseArrExtract=(t,e)=>{t&&t.length>0&&t.forEach(i=>{this.traverseObjExtract(i,e)})};traverseObjExtract=(t,e)=>{t&&Object.keys(t).length>0&&Object.keys(t).forEach(i=>{let a=t[i];i==="id"||i==="teamId"?(this.extractedObjIds.hasOwnProperty(e)||(this.extractedObjIds[e]=[]),a&&this.extractedObjIds[e].push(a)):t[i]&&this.traverse(t[i],i)})}};var In=class{replaceObjIdsIndex=null;remappedIdsObj={};traverse=(t,e,i)=>(e=wp(e),this.replaceObjIdsIndex===null&&(this.initReplaceObjIdsIndex(i),this.remappedIdsObj=i),Array.isArray(t)?this.traverseArrReplace(t,e):t&&typeof t=="object"&&this.traverseObjReplace(t,e),t);initReplaceObjIdsIndex=t=>{this.replaceObjIdsIndex={},Object.keys(t).forEach(e=>{this.replaceObjIdsIndex[e]=0})};traverseArrReplace=(t,e)=>{t&&t.length>0&&t.forEach(i=>{this.traverseObjReplace(i,e)})};traverseObjReplace=(t,e)=>{t&&Object.keys(t).length>0&&Object.keys(t).forEach(i=>{i==="id"||i==="teamId"?t[i]&&(t[i]=this.remappedIdsObj[e][this.replaceObjIdsIndex[e]],this.replaceObjIdsIndex[e]=this.replaceObjIdsIndex[e]+1):t[i]&&this.traverse(t[i],i,this.remappedIdsObj)})}};var R=class{idSchema="";idMappingFacade=null;constructor(t){this.idSchema=t.idSchema,this.idMappingFacade=new di(t)}getEntityIdBySchemaId=(t,e)=>this.idMappingFacade.getEntityById(e,t,this.idSchema);remapEntities=async(t,e)=>{let i=JSON.parse(JSON.stringify(t));try{if(this.idSchema!=="native"){let r=new Mn().traverse(i,e);return this.idMappingFacade.getEntitiesByIds(r,"native",this.idSchema).then(o=>new In().traverse(i,e,o))}else return t}catch(a){return console.warn(`There was a problem remapping entity: ${e} with inner entity `,a),[]}};getEntityIdsBySchemaId=async(t,e,i)=>{let a={};return a[e]=t,this.idSchema!=="native"?await this.idMappingFacade.getEntitiesByIds(a,this.idSchema,i):a}};var Mt=class{idSchema;idMapping;constructor(t){this.idSchema=t.idSchema,this.idMapping=new R(t)}remapTagsIds=async(t,e,i)=>{if(!t||!t.length)return t;let a={},r={},o=[];t.forEach(l=>{a.hasOwnProperty(l.type)||(a[l.type]=[],r[l.type]=[]),a[l.type].push(l.id),r[l.type].push(l)});let n=await this.idMapping.idMappingFacade.getEntitiesByIds(a,e,i);for(let[l,p]of Object.entries(r))p.forEach((c,d)=>{c.id=n[l][d],o.push(c)});return o}};var pe=class{page=null;limit=null;constructor(t){this.page=t.page?t.page:null,this.limit=t.limit?t.limit:null}};var ta=class extends pe{action=null;constructor(t){super(t),this.action=t.action?t.action:null}constructFilterUrl(){let t="";return this.action&&(t+="&",t+=`action=${this.action}`),this.page&&(t+="&",t+=`page=${this.page}`),this.limit&&(t+="&",t+=`limit=${this.limit}`),t}};var ea=class extends pe{action=null;constructor(t){super(t),this.action=t.action?t.action:null}constructFilterUrl(){let t="";return this.action&&(t+="&",t+=`action=${this.action}`),this.page&&(t+="&",t+=`page=${this.page}`),this.limit&&(t+="&",t+=`limit=${this.limit}`),t}};var wn=class{idSchema;activityHttps;activityService;constructor(t){this.idSchema=t.idSchema,this.activityHttps=new li(t),this.activityService=new Mt(t)}add=async(t,e,i,a)=>{if(this.idSchema!="native"){let o=JSON.parse(JSON.stringify(e)),n=await this.activityService.remapTagsIds(e,this.idSchema,"native"),l=new pi(t,n,i,a),p=await this.activityHttps.createActivity(l);return p.context.tags=o,p}let r=new pi(t,e,i,a);return this.activityHttps.createActivity(r)};delete=async t=>await this.activityHttps.deleteActivity(t);like=async(t,e,i)=>{let a="like";return await this.add(a,t,e,i)};dislike=async(t,e,i)=>{let a="dislike";return await this.add(a,t,e,i)};addPageview=async(t,e,i)=>{let a="page_view";return await this.add(a,t,e,i)};addContentConsumed=async(t,e,i)=>{let a="content_consumed";return await this.add(a,t,e,i)};addShare=async(t,e,i)=>{let a="share";return await this.add(a,t,e,i)};addComment=async(t,e,i)=>{let a="comment";return await this.add(a,t,e,i)};addClickAd=async(t,e,i)=>{let a="click_ad";return await this.add(a,t,e,i)};addConvert=async(t,e,i)=>{let a="convert";return await this.add(a,t,e,i)};getOwn=async(t,e)=>{if(e=e||!1,t&&(t=new ta(t)),this.idSchema!="native"){let i=await this.activityHttps.getOwnActivities(t,e);for(let a of i.data)await this.activityService.remapTagsIds(a.context.tags,"native",this.idSchema);return i}return await this.activityHttps.getOwnActivities(t,e)};getForUser=async(t,e,i)=>{if(i=i||!1,e&&(e=new ea(e)),this.idSchema!="native"){let a=await this.activityHttps.getActivitiesForUser(t,e,i),r=JSON.parse(JSON.stringify(a));for(let o of r.data)await this.activityService.remapTagsIds([...o.context.tags],"native",this.idSchema);return r}return await this.activityHttps.getActivitiesForUser(t,e,i)}};var _n=class{activityFacade;constructor(t){this.activityFacade=new wn(t)}add=async(t,e,i,a)=>await this.activityFacade.add(t,e,i,a);delete=async t=>await this.activityFacade.delete(t);like=async(t,e,i)=>await this.activityFacade.like(t,e,i);dislike=async(t,e,i)=>await this.activityFacade.dislike(t,e,i);addPageview=async(t,e,i)=>await this.activityFacade.addPageview(t,e,i);addContentConsumed=async(t,e,i)=>await this.activityFacade.addContentConsumed(t,e,i);addShare=async(t,e,i)=>await this.activityFacade.addShare(t,e,i);addComment=async(t,e,i)=>await this.activityFacade.addComment(t,e,i);addClickAd=async(t,e,i)=>await this.activityFacade.addClickAd(t,e,i);addConvert=async(t,e,i)=>await this.activityFacade.addConvert(t,e,i);getOwn=async(t,e)=>await this.activityFacade.getOwn(t,e);getForUser=async(t,e,i)=>await this.activityFacade.getForUser(t,e,i)};var K=class{entityId=null;entityType=null;entityRelationship=null};var ce=class{participantOne=null;participantTwo=null};var ia=class{matchId="";participantOne="";participantTwo="";winner="";homeParticipant="";startDate="";score=new ce};var de=class{participants=[]};var aa=class{id=null;name=null;group=null;image=null;undecided=!1};var ra=class{id=null;title=null;description=null;rules=null;customFields=null;images=null;type="BRACKET";status=null;points=null;related=[];tiebreaker=null;predictionsCutoff=null;meta=new de;fixtures=[];createdAt=null;updatedAt=null};var It=class{nextPageStartsAfter=null;itemsPerPage=null};var w=class{pagination=new It};var oa=class{meta=new w;data=[]};var sa=class{meta=new w;data=[]};var na=class{statTiebreakerEnabled;statTotal};var la=class{matchId="";participantOne="";participantTwo="";winner;correct=null};var ue=class{statTotal=0};var od=(r=>(r.ACTIVE="ACTIVE",r.WON="WON",r.LOST="LOST",r.PARTIALLY_WON="PARTIALLY_WON",r.CANCELED="CANCELED",r))(od||{}),pa=class{id="";profileId="";profileModel=null;gameId="";totalPoints=null;gamePoints=null;bonusPoints=null;position=null;status="ACTIVE";fixtures=[];tiebreaker=new ue;createdAt="";updatedAt=""};var ca=class{meta=new w;data=[]};var Pn=class{remapBracketGames=t=>{let e=new sa;return e.meta.pagination.itemsPerPage=t.meta.pagination.items_per_page,e.meta.pagination.nextPageStartsAfter=t.meta.pagination.next_page_starts_after,e.data=t.data.map(i=>this.remapBracketGameById(i)),e};remapBracketGameById=t=>{let e=new ra;return e.id=t.id,e.title=t.title,e.description=t.description,e.rules=t.rules,e.customFields=t.custom_fields,e.images=t.images,e.type=t.type,e.status=t.status,e.points=t.points,e.related=t.related?this.remapRelated(t.related):t.related,e.tiebreaker=t.tiebreaker?this.remapBracketGameTiebreaker(t.tiebreaker):t.tiebreaker,e.predictionsCutoff=t.predictions_cutoff,e.meta=t.meta&&t.meta.participants?this.remapBracketGameMeta(t.meta):t.meta,e.fixtures=t.fixtures?this.remapBracketGameFixtures(t.fixtures):t.fixtures,e.createdAt=t.created_at,e.updatedAt=t.updated_at,e};remapPredictionToRequestBody=t=>t.map(e=>({match_id:e.matchId,participant_one:e.participantOne,participant_two:e.participantTwo,winner:e.winner}));remapPrediction=t=>{let e=new pa;return e.id=t.id,e.profileId=t.profile_id,e.gameId=t.game_id,e.totalPoints=t.total_points,e.gamePoints=t.game_points,e.bonusPoints=t.bonus_points,e.position=t.position,e.status=t.status,e.fixtures=this.remapPredictionFixtures(t.fixtures),e.tiebreaker=t.tiebreaker?this.remapPredictionTiebreaker(t.tiebreaker):t.tiebreaker,e.createdAt=t.created_at,e.updatedAt=t.updated_at,e};remapPredictionsForUser=t=>{let e=new oa;return e.meta.pagination.itemsPerPage=t.meta.pagination.items_per_page,e.meta.pagination.nextPageStartsAfter=t.meta.pagination.next_page_starts_after,e.data=t.data.map(i=>this.remapPrediction(i)),e};remapRankings=t=>{let e=new ca;return e.meta.pagination.itemsPerPage=t.meta.pagination.items_per_page,e.meta.pagination.nextPageStartsAfter=t.meta.pagination.next_page_starts_after,e.data=t.data.map(i=>this.remapPrediction(i)),e};remapRelated=t=>t.map(e=>{let i=new K;return i.entityId=e.entity_id,i.entityType=e.entity_type,i.entityRelationship=e.entity_relationship,i});remapPredictionFixtures=t=>t.map(e=>{let i=new la;return i.matchId=e.match_id,i.participantOne=e.participant_one,i.participantTwo=e.participant_two,i.winner=e.winner,i.correct=e.correct,i});remapPredictionTiebreaker=t=>{let e=new ue;return e.statTotal=t.stat_total,e};remapBracketGameMeta=t=>{let e=new de;return e.participants=t.participants.map(i=>{let a=new aa;return a.id=i.id,a.name=i.name,a.group=i.group,a.image=i.image,a.undecided=i.undecided,a}),e};remapBracketGameFixtures=t=>t.map(e=>{let i=new ia;return i.matchId=e.match_id,i.participantOne=e.participant_one,i.participantTwo=e.participant_two,i.winner=e.winner,i.homeParticipant=e.home_participant,i.startDate=e.start_date,i.score=e.score?this.remapBracketGameFixturesScore(e.score):e.score,i});remapBracketGameFixturesScore=t=>{let e=new ce;return e.participantOne=t.participant_one,e.participantTwo=t.participant_two,e};remapBracketGameTiebreaker=t=>{let e=new na;return e.statTiebreakerEnabled=t.stat_tiebreaker_enabled,e.statTotal=t.stat_total,e}};var me=class{participants=[]};var da=class{id=null;title=null;description=null;rules=null;customFields=null;images=null;type="STANDING";status=null;points=null;related=[];predictionsCutoff="";meta=new me;outcomeCount=null;outcome=[];createdAt=null;updatedAt=null};var ua=class{meta=new w;data=[]};var ma=class{id=null;name=null;group=null;image=null;undecided=!1};var ha=class{id="";profileId="";profileModel=null;total=0;gameId="";totalPoints=null;gamePoints=null;bonusPoints=null;position=null;status="ACTIVE";standing=[];createdAt="";updatedAt=""};var fa=class{meta=new w;data=[]};var ga=class{meta=new w;data=[]};var Tn=class{remapBracketGames=t=>{let e=new ua;return e.meta.pagination.itemsPerPage=t.meta.pagination.items_per_page,e.meta.pagination.nextPageStartsAfter=t.meta.pagination.next_page_starts_after,e.data=t.data.map(i=>this.remapStandingGameById(i)),e};remapStandingGameById=t=>{let e=new da;return e.id=t.id,e.title=t.title,e.description=t.description,e.rules=t.rules,e.customFields=t.custom_fields,e.images=t.images,e.type=t.type,e.status=t.status,e.points=t.points,e.related=t.related?this.remapRelated(t.related):t.related,e.predictionsCutoff=t.predictions_cutoff,e.meta=t.meta&&t.meta.participants?this.remapStandingGameMeta(t.meta):t.meta,e.outcomeCount=t.outcome_count,e.outcome=t.outcome,e.createdAt=t.created_at,e.updatedAt=t.updated_at,e};remapPrediction=t=>{let e=new ha;return e.id=t.id,e.profileId=t.profile_id,e.gameId=t.game_id,e.totalPoints=t.total_points,e.gamePoints=t.game_points,e.bonusPoints=t.bonus_points,e.position=t.position,e.status=t.status,e.standing=t.standing,e.total=t.total,e.createdAt=t.created_at,e.updatedAt=t.updated_at,e};remapPredictionsForUser=t=>{let e=new fa;return e.meta.pagination.itemsPerPage=t.meta.pagination.items_per_page,e.meta.pagination.nextPageStartsAfter=t.meta.pagination.next_page_starts_after,e.data=t.data.map(i=>this.remapPrediction(i)),e};remapRankings=t=>{let e=new ga;return e.meta.pagination.itemsPerPage=t.meta.pagination.items_per_page,e.meta.pagination.nextPageStartsAfter=t.meta.pagination.next_page_starts_after,e.data=t.data.map(i=>this.remapPrediction(i)),e};remapRelated=t=>t.map(e=>{let i=new K;return i.entityId=e.entity_id,i.entityType=e.entity_type,i.entityRelationship=e.entity_relationship,i});remapStandingGameMeta=t=>{let e=new me;return e.participants=t.participants.map(i=>{let a=new ma;return a.id=i.id,a.name=i.name,a.group=i.group,a.image=i.image,a.undecided=i.undecided,a}),e}};var xd={id:"",profile_id:"",total_points:null,game_points:null,bonus_points:null,position:null,status:"ACTIVE",game_id:"",fixtures:[],tiebreaker:{stat_total:0},updated_at:"",created_at:""},ui=class extends C{bracketGameRemapper=null;standingGameRemapper=null;constructor(t){super(t,v(t.environment,"predictor")),this.bracketGameRemapper=new Pn,this.standingGameRemapper=new Tn}getBracketGames=async(t,e)=>{let i=t?`/custom/bracket${this.apiSignInUrl}${t.constructMainFiltersUrl()}`:`/custom/bracket${this.apiSignInUrl}`;g(e)&&(i+=f());let a="There was a problem with fetching bracket games list",r=await this.fetchWithoutAuth(i,a);return this.bracketGameRemapper.remapBracketGames(r)};getBracketGameById=async(t,e)=>{let i=g(e)?`/custom/bracket/${t}${this.apiSignInUrl}${f()}`:`/custom/bracket/${t}${this.apiSignInUrl}`,a="There was a problem with fetching bracket game with the following ID: "+t,r=await this.fetchWithoutAuth(i,a);return this.bracketGameRemapper.remapBracketGameById(r)};makeBracketGamePrediction=async(t,e)=>{let i=`/custom/bracket/${t}/predictions${this.apiSignInUrl}`,a="There was a problem with making prediction for bracket game with the following ID: "+t,r="POST",o=JSON.parse(JSON.stringify(e));o.fixtures=this.bracketGameRemapper.remapPredictionToRequestBody(e.fixtures),e.tiebreaker&&(o.tiebreaker={stat_total:e.tiebreaker.statTotal});let n=await this.fetchWithAuth(i,a,r,o);return this.bracketGameRemapper.remapPrediction(n)};updateBracketGamePrediction=async(t,e,i)=>{let a=`/custom/bracket/${t}/predictions/${e}${this.apiSignInUrl}`,r="There was a problem with updating prediction for bracket game with the following ID: "+t,o="PUT",n=JSON.parse(JSON.stringify(i));n.fixtures=this.bracketGameRemapper.remapPredictionToRequestBody(i.fixtures),i.tiebreaker&&(n.tiebreaker={stat_total:i.tiebreaker.statTotal});let l=await this.fetchWithAuth(a,r,o,n);return this.bracketGameRemapper.remapPrediction(l)};getBracketGamePredictionsForUser=async(t,e,i,a)=>{let r=i?`/custom/bracket/${t}/predictions${this.apiSignInUrl}&profile_id=${e}${i.constructMainFiltersUrl()}`:`/custom/bracket/${t}/predictions${this.apiSignInUrl}&profile_id=${e}`;g(a)&&(r+=f());let o=`There was a problem with getting all predictions for user with ID ${e} for bracket game with ID ${t}`,n=await this.fetchWithoutAuth(r,o);return this.bracketGameRemapper.remapPredictionsForUser(n)};getBracketGamePredictionById=async(t,e,i)=>{let a=g(i)?`/custom/bracket/${t}/predictions/${e}/${this.apiSignInUrl}${f()}`:`/custom/bracket/${t}/predictions/${e}/${this.apiSignInUrl}`,r=`There was a problem with getting prediction with ID ${e} for bracket game with ID ${t}`,o=JSON.parse(JSON.stringify(xd));return o.id=e,o.game_id=t,o.tiebreaker=null,Promise.resolve(this.bracketGameRemapper.remapPrediction(o))};getBracketGameRankings=async(t,e,i)=>{let a=e?`/custom/bracket/${t}/ranking${this.apiSignInUrl}${e.constructMainFiltersUrl()}`:`/custom/bracket/${t}/ranking${this.apiSignInUrl}`;g(i)&&(a+=f());let r=`There was a problem with getting rankings for bracket game with ID ${t}`,o=await this.fetchWithoutAuth(a,r);return this.bracketGameRemapper.remapRankings(o)};getStandingsGames=async(t,e)=>{let i=t?`/custom/standing${this.apiSignInUrl}${t.constructMainFiltersUrl()}`:`/custom/standing${this.apiSignInUrl}`;g(e)&&(i+=f());let a="There was a problem with fetching standings games list",r=await this.fetchWithoutAuth(i,a);return this.standingGameRemapper.remapBracketGames(r)};getStandingGameById=async(t,e)=>{let i=g(e)?`/custom/standing/${t}${this.apiSignInUrl}${f()}`:`/custom/standing/${t}${this.apiSignInUrl}`,a="There was a problem with fetching standing game with the following ID: "+t,r=await this.fetchWithoutAuth(i,a);return this.standingGameRemapper.remapStandingGameById(r)};makeStandingGamePrediction=async(t,e)=>{let i=`/custom/standing/${t}/predictions${this.apiSignInUrl}`,a="There was a problem with making prediction for standing game with the following ID: "+t,r="POST",o={standing:e},n=await this.fetchWithAuth(i,a,r,o);return this.standingGameRemapper.remapPrediction(n)};updateStandingGamePrediction=async(t,e,i)=>{let a=`/custom/standing/${t}/predictions/${e}${this.apiSignInUrl}`,r="There was a problem with updating prediction for standing game with the following ID: "+t,o="PUT",n={standing:i},l=await this.fetchWithAuth(a,r,o,n);return this.standingGameRemapper.remapPrediction(l)};getStandingGamePredictionsForUser=async(t,e,i)=>{let a=`/custom/standing/${t}/predictions${this.apiSignInUrl}&profile_id=${e}`;g(i)&&(a+=f());let r=`There was a problem with getting prediction for user with ID ${e} for standing game with ID ${t}`,o=await this.fetchWithoutAuth(a,r);return this.standingGameRemapper.remapPredictionsForUser(o)};getStandingGameRankings=async(t,e,i)=>{let a=e?`/custom/standing/${t}/ranking${this.apiSignInUrl}${e.constructMainFiltersUrl()}`:`/custom/standing/${t}/ranking${this.apiSignInUrl}`;g(i)&&(a+=f());let r=`There was a problem with getting rankings for standing game with ID ${t}`,o=await this.fetchWithoutAuth(a,r);return this.standingGameRemapper.remapRankings(o)}};var he=class{id=null;name=null;nickname=null;avatar=null;gender=null;country=null;birthDate=null;verified=!1;staffMember=!1;anonymous=!1;disabled=!1;interests=[];followingCount=0;followersCount=0};var ya=class extends he{email=null;phoneNumber=null;phoneCountryCode=null;preferences=null};var En=class{profilesFromResponse=t=>t?t.map(e=>this.publicProfileFromResponse(e)):null;fullProfileFromResponse=t=>{let e=new ya;return e.id=t.id,e.name=t.name,e.email=t.email,e.nickname=t.nickname,e.avatar=t.avatar,e.gender=t.gender,e.country=t.country,e.birthDate=t.birth_date,e.phoneCountryCode=t.phone_country_code,e.phoneNumber=t.phone_number,e.verified=t.verified,e.staffMember=t.staff_member,e.anonymous=t.anonymous,e.disabled=t.disabled,e.interests=t.interests?t.interests:[],e.preferences=t.preferences?this.remapPreferences(t.preferences):[],e.followingCount=t.following_count,e.followersCount=t.followers_count,e};publicProfileFromResponse=t=>{let e=new he;return e.id=t.id,e.name=t.name,e.nickname=t.nickname,e.avatar=t.avatar,e.gender=t.gender,e.country=t.country,e.birthDate=t.birth_date,e.verified=t.verified,e.staffMember=t.staff_member,e.anonymous=t.anonymous,e.disabled=t.disabled,e.interests=t.interests?t.interests:[],e.followingCount=t.following_count,e.followersCount=t.followers_count,e};remapPreferences=t=>t.map(e=>({preferenceId:e.preference_id,categories:e.categories,source:e.source}))};var H=class{meta=new w;data=[]};var ba=class{avatar=null;followingId=null;name=null;nickname=null;profileId=null};var Rn=class{followResponse=t=>t.map(e=>this.remapResponse(e));followingFromResponse=t=>{let e=new H;return e.meta.pagination.nextPageStartsAfter=t.meta.pagination.next_page_starts_after,e.meta.pagination.itemsPerPage=t.meta.pagination.items_per_page,e.data=t.data.map(i=>this.remapResponse(i)),e};remapResponse=t=>{let e=new ba;return e.avatar=t.avatar,e.followingId=t.following_id,e.name=t.name,e.profileId=t.profile_id,e.nickname=t.nickname,e}};var Ma=class{avatar=null;followerId=null;name=null;nickname=null;profileId=null};var Ia=class{followsMe=[];iFollow=[];followsMeBack=[]};var Sn=class{followersFromResponse=t=>{let e=new H;return e.meta.pagination.nextPageStartsAfter=t.meta.pagination.next_page_starts_after,e.meta.pagination.itemsPerPage=t.meta.pagination.items_per_page,e.data=t.data.map(i=>this.remapResponse(i)),e};followStatusFromResponse=t=>{let e=new Ia;return e.iFollow=t.i_follow,e.followsMe=t.follows_me,e.followsMeBack=t.follows_me_back,e};remapResponse=t=>{let e=new Ma;return e.avatar=t.avatar,e.followerId=t.follower_id,e.name=t.name,e.profileId=t.profile_id,e}};var mi=class{profile_ids=[]};var wa=class{leadId=null;profileId=null;firstName=null;lastName=null;fullName=null;email=null;gender=null;country=null;phoneCountryCode=null;phoneNumber=null;campaignId=null;campaignName=null;contentType=null;contentId=null;contentName=null;customFields=null};var Fn=class{toRequest(t){return{first_name:t.firstName||null,last_name:t.lastName||null,full_name:t.fullName||null,email:t.email||null,gender:t.gender||null,country:t.country||null,phone_country_code:t.phoneCountryCode||null,phone_number:t.phoneNumber||null,campaign_id:t.campaignId||null,campaign_name:t.campaignName||null,content_type:t.contentType||null,content_id:t.contentId||null,content_name:t.contentName||null,custom_fields:t.customFields||null}}fromResponse(t){let e=new wa;return e.leadId=t.lead_id,e.profileId=t.profile_id,e.firstName=t.first_name,e.lastName=t.last_name,e.fullName=t.full_name,e.email=t.email,e.gender=t.gender,e.country=t.country,e.phoneCountryCode=t.phone_country_code,e.phoneNumber=t.phone_number,e.campaignId=t.campaign_id,e.campaignName=t.campaign_name,e.contentId=t.content_id,e.contentType=t.content_type,e.contentName=t.content_name,e.customFields=t.custom_fields,e}};var Dd="/countries",at="/profile",_p="/profiles",hi=class extends C{profileRemapper=null;followingRemapper=null;followersRemapper=null;leadRemapper=null;lang=null;limitIds=100;constructor(t){super(t,v(t.environment,"profile")),this.lang=t.lang,this.profileRemapper=new En,this.followingRemapper=new Rn,this.followersRemapper=new Sn,this.leadRemapper=new Fn}getCountries=async t=>{let e=`&lang=${this.lang}`,i=`${Dd}${this.apiSignInUrl}${e}`,a=Date.now(),r="There was a problem fetching profile countries";return t&&(i+=`&disable_cache=${a}`),(await this.fetchWithoutAuth(i,r)).data};getProfile=async t=>{let e=`${at}${this.apiSignInUrl}`,i="";if(t){e=`${_p}/${t}${this.apiSignInUrl}`,i=`There was a problem fetching the following profile: ${t}`;let a=await this.fetchWithoutAuth(e,i);return this.profileRemapper.publicProfileFromResponse(a.data)}else{i="There was a problem fetching your profile from API";let a=await this.fetchWithAuth(e,i);return this.profileRemapper.fullProfileFromResponse(a.data)}};getProfiles=async(t,e,i)=>{let a=Date.now(),r=`There was a problem fetching the following profiles: ${t.join(",")}`;if(t&&t.length){if(t.length>this.limitIds){let c=[],d=Gt(t,this.limitIds);for(let u of d){let b=`${_p}${this.apiSignInUrl}&profile_ids=${u.join(",")}`;r=`There was a problem fetching the following profiles: ${u.join(",")}`,i&&(b+=`&disable_cache=${a}`);let I=await this.fetchWithoutAuth(b,r);c.push(...this.profileRemapper.profilesFromResponse(I.data))}return c}let l=`${_p}${this.apiSignInUrl}&profile_ids=${t.join(",")}`;i&&(l+=`&disable_cache=${a}`);let p=await this.fetchWithoutAuth(l,r);return this.profileRemapper.profilesFromResponse(p.data)}let o=`${_p}${this.apiSignInUrl}&search=${e}`;i&&(o+=`&disable_cache=${a}`);let n=await this.fetchWithoutAuth(o,r);return this.profileRemapper.profilesFromResponse(n.data)};getFollowers=async(t,e)=>{let i=`${at}/followers${this.apiSignInUrl}`,a="There was a problem fetching the followers for own profile";if(t&&!e){i=`${at}/followers${this.apiSignInUrl}${t.constructFilterUrl()}`;let o=await this.fetchWithAuth(i,a);return this.followersRemapper.followersFromResponse(o)}else if(!t&&!e){let o=await this.fetchWithAuth(i,a);return this.followersRemapper.followersFromResponse(o)}t&&e?i=`${at}/${e}/followers${this.apiSignInUrl}${t.constructFilterUrl()}`:!t&&e&&(i=`${at}/${e}/followers${this.apiSignInUrl}`),a=`There was a problem fetching the followers for profile: ${e}`;let r=await this.fetchWithoutAuth(i,a);return this.followersRemapper.followersFromResponse(r)};getFollowing=async(t,e)=>{let i=`${at}/following${this.apiSignInUrl}`,a="There was a problem fetching the followers of own profile";if(t&&!e){i=`${at}/following${this.apiSignInUrl}${t.constructFilterUrl()}`;let o=await this.fetchWithAuth(i,a);return this.followingRemapper.followingFromResponse(o)}else if(!t&&!e){let o=await this.fetchWithAuth(i,a);return this.followingRemapper.followingFromResponse(o)}t&&e?i=`${at}/${e}/following${this.apiSignInUrl}${t.constructFilterUrl()}`:!t&&e&&(i=`${at}/${e}/following${this.apiSignInUrl}`),a=`There was a problem fetching the followers of the following profile: ${e}`;let r=await this.fetchWithoutAuth(i,a);return this.followingRemapper.followingFromResponse(r)};follow=async t=>{let e=new mi;e.profile_ids=t;let i=at+`/follow${this.apiSignInUrl}`,a=`There was a problem with following profiles: ${t.join(",")}`,r="POST",o=await this.fetchWithAuth(i,a,r,e);return this.followingRemapper.followResponse(o.data)};unfollow=async t=>{let e=new mi;e.profile_ids=t;let i=at+`/follow${this.apiSignInUrl}`,a=`There was a problem with unfollowing profiles: ${t.join(",")}`,r="DELETE";return await this.fetchWithAuth(i,a,r,e),!0};getBadges=async t=>{let e=`${at}/badges${this.apiSignInUrl}`,i="There was a problem with fetching own badges";return t?(e=`${at}/${t}/badges${this.apiSignInUrl}`,i="There was a problem with fetching the badges",(await this.fetchWithoutAuth(e,i)).data):(await this.fetchWithAuth(e,i)).data};updateProfile=async t=>{let e=at+this.apiSignInUrl,i="There was a problem updating the own profile",a="PATCH",r=await this.fetchWithAuth(e,i,a,t);return this.profileRemapper.fullProfileFromResponse(r.data)};collectLead=async t=>{let e=`/leads${this.apiSignInUrl}`,i="There was a problem collecting lead",a="POST",r=await this.fetchWithAuth(e,i,a,this.leadRemapper.toRequest(t));return this.leadRemapper.fromResponse(r.data)};checkFollowStatus=async t=>{let e=`/profile/followers/check-follow-status${this.apiSignInUrl}&profile_ids=${t.join(",")}`,i="There was a problem checking follow status for profiles",a=await this.fetchWithAuth(e,i);return this.followersRemapper.followStatusFromResponse(a.data)};deleteOwnProfile=async()=>{let t=`/profile${this.apiSignInUrl}`,e="There was a problem deleting own profile",i="DELETE";await this.fetchWithAuth(t,e,i)};deleteUserData=async()=>{let t=`/user-data${this.apiSignInUrl}`,e="There was a problem deleting profile data",i="DELETE";await this.fetchWithAuth(t,e,i)}};var X=class{completed=!1;percentage;constructor(t){this.percentage=t}};var _a=class{teamFollowed=new X(10);teamFavourite=new X(15);playerFollowed=new X(10);playerFavourite=new X(10);competitionFollowed=new X(10);competitionFavourite=new X(5);addedBirthdate=new X(10);addedGender=new X(10);addedCountry=new X(10);addedAvatar=new X(10)};var Pa=class{totalPercentage;breakdown=new _a};var fi=class{limit=0;startAfter=null;constructor(t){this.limit=t.limit?t.limit:20,this.startAfter=t.startAfter?t.startAfter:null}constructFilterUrl=()=>{let t="";return this.limit&&(t=t+"&",t=t+`limit=${this.limit}`),this.startAfter&&(t=t+"&",t=t+`start_after=${this.startAfter}`),t}};var y=class extends Error{code=0;status=null;message=null;constructor(t,e,i){super(),this.code=t,this.status=e,this.message=i}errorMessage=()=>this.message};var wt=class{localCache;profileHttps=null;activityHttps=null;errorHandlingMode=null;constructor(t,e,i,a){this.localCache=t,this.profileHttps=e,this.activityHttps=i,this.errorHandlingMode=a}getOwn=async()=>{let t=await this.getLocalStorageData("profile");if(t&&Object.keys(t).length)return JSON.parse(JSON.stringify(t));try{let e=await this.profileHttps.getProfile();return await this.localCache.setOwnProfile(e),e}catch(e){throw console.warn("There was a problem retrieving your profile: ",e),e}};getOwnProfileFromCache=async()=>await this.localCache.getOwnProfile();updateOwnProfile=async()=>{try{let t=await this.profileHttps.getProfile();return await this.localCache.setOwnProfile(t),t}catch(t){throw console.warn("There was a problem retrieving your profile: ",t),t}};getByIds=async(t,e,i)=>{if(t&&t.length>0&&e||!t&&t.length===0&&!e)throw new m(400,"invalid_method_call","The method 'getByIds' from Profile namespace is not called correctly. You need to provide 'profileIds' OR 'search' parameters to the method, but you can't use both of them or neither of them.");try{return await this.profileHttps.getProfiles(t,e,i)}catch(a){throw console.warn(`There was a problem retrieving the selected profiles: ${t.join(",")} `,a),a}};getById=async t=>{try{return await this.profileHttps.getProfile(t)}catch(e){throw console.warn(`There was a problem retrieving the selected profile: ${t} `,e),e}};getCountries=async t=>{t=t||!1;let e=await this.localCache.getProfileCountries();if(e&&e.length>0)return e;try{let i=await this.profileHttps.getCountries(t);return await this.localCache.setProfileCountries(i),i}catch(i){throw console.warn("There was a problem retrieving profile countries: ",i),i}};getFollowers=async(t,e)=>{try{t&&(t=new fi(t));let i=await this.profileHttps.getFollowers(t,e),a=i.data.map(r=>r.followerId);if(a.length){let r=await this.getByIds(a),o=i.data.map(n=>(r.forEach(l=>{n.followerId===l.id&&(n.name=l.name,n.nickname=l.nickname,n.avatar=l.avatar)}),n));return i.data=o,i}return i}catch(i){throw console.warn("There was a problem retrieving your followers: ",i),i}};getFollowing=async(t,e)=>{try{t&&(t=new fi(t));let i=await this.profileHttps.getFollowing(t,e),a=i.data.map(r=>r.followingId);if(a.length){let r=await this.getByIds(a),o=i.data.map(n=>(r.forEach(l=>{n.followingId===l.id&&(n.name=l.name,n.nickname=l.nickname,n.avatar=l.avatar)}),n));return i.data=o,i}return i}catch(i){throw console.warn("There was a problem retrieving your following profiles: ",i),i}};follow=async t=>{try{return await this.profileHttps.follow(t)}catch(e){throw console.warn(`There was a problem following profiles: ${t.join(",")} `,e),e}};unfollow=async t=>{try{return await this.profileHttps.unfollow(t)}catch(e){throw console.warn(`There was a problem unfollowing profiles: ${t.join(",")} `,e),e}};showFullnessProfile=t=>{let e=new Pa,i=0;return t.avatar&&(e.breakdown.addedAvatar.completed=!0,i+=e.breakdown.addedAvatar.percentage),t.birthDate&&(e.breakdown.addedBirthdate.completed=!0,i+=e.breakdown.addedBirthdate.percentage),t.country&&(e.breakdown.addedCountry.completed=!0,i+=e.breakdown.addedCountry.percentage),t.gender&&(e.breakdown.addedGender.completed=!0,i+=e.breakdown.addedGender.percentage),t.interests&&t.interests.length>0&&(t.interests.find(c=>c.type==="team"&&c.favourite)&&(e.breakdown.teamFavourite.completed=!0,i+=e.breakdown.teamFavourite.percentage),t.interests.find(c=>c.type==="team")&&(e.breakdown.teamFollowed.completed=!0,i+=e.breakdown.teamFollowed.percentage),t.interests.find(c=>c.type==="player"&&c.favourite)&&(e.breakdown.playerFavourite.completed=!0,i+=e.breakdown.playerFavourite.percentage),t.interests.find(c=>c.type==="player")&&(e.breakdown.playerFollowed.completed=!0,i+=e.breakdown.playerFollowed.percentage),t.interests.find(c=>c.type==="competition"&&c.favourite)&&(e.breakdown.competitionFavourite.completed=!0,i+=e.breakdown.competitionFavourite.percentage),t.interests.find(c=>c.type==="competition")&&(e.breakdown.competitionFollowed.completed=!0,i+=e.breakdown.competitionFollowed.percentage)),e.totalPercentage=i,e};getStats=async()=>{let t=await this.getLocalStorageData("statistics");if(t&&Object.keys(t).length)return JSON.parse(JSON.stringify(t));try{let e=await this.activityHttps.getStats();return await this.localCache.setProfileStats(e),e}catch(e){throw console.warn("There was a problem retrieving own profile statistics: ",e),e}};getBadges=async t=>{if(t)try{return await this.profileHttps.getBadges()}catch(i){throw console.warn("There was a problem retrieving own profile badges: ",i),i}let e=await this.getLocalStorageData("badges");if(e)return e;try{let i=await this.profileHttps.getBadges();return await this.localCache.setProfileBadges(i),i}catch(i){throw console.warn("There was a problem retrieving own profile badges: ",i),i}};clearLocalStorageData=async()=>{await this.localCache.setOwnProfile({}),await this.localCache.setProfileStats({}),await this.localCache.setProfileBadges(null)};collectLead=async t=>{if(this.errorHandlingMode&&!t)throw this.errorHandlingMode==="standard"?new m(400,"invalid_method_call","The method 'collectLead' from Profile namespace is not called correctly. You need to provide 'requestBody' parameter to the method."):new y(400,"invalid_method_call","The method 'collectLead' from Profile namespace is not called correctly. You need to provide 'requestBody' parameter to the method.");return await this.profileHttps.collectLead(t)};checkFollowStatus=async t=>{if(!t||!Array.isArray(t)||t.length===0)throw this.errorHandlingMode==="standard"?new m(400,"invalid_method_call","Invalid or empty IDs provided. Please provide at least one ID."):new y(400,"invalid_method_call","Invalid or empty IDs provided. Please provide at least one ID.");return await this.profileHttps.checkFollowStatus(t)};getLocalStorageData=async t=>{let e=Math.floor(Date.now()/1e3),i=await this.localCache.getExpiration("profile",t);switch(t){case"profile":if(i>e)return await this.localCache.getOwnProfile();case"statistics":if(i>e)return await this.localCache.getProfileStats();case"badges":if(i>e)return await this.localCache.getProfileBadges();default:return null}}};var Ta=class{id=null;name=null;assets=null};var Cn=class{extractUpdatedProps=(t,e)=>{let i=["name","nickname","gender","avatar","email"],a={};return Object.keys(t).forEach(r=>{if(i.includes(r)&&t[r]!==e[r])a[r]=e[r];else if(r==="phoneCountryCode")t[r]&&e[r]===null?a.phone_country_code=null:(t[r]===null&&e[r]||t[r]!==e[r])&&(a.phone_country_code=e[r]);else if(r==="phoneNumber")(t[r]&&e[r]===null||t[r]===null&&e[r]||t[r]!==e[r])&&(a.phone_number=e[r]);else if(r==="birthDate")(e[r]===null||t[r]===null&&e[r]||t[r]!==e[r])&&(a.birth_date=e[r]);else if(r==="country")e[r]===null?a.country_id=e[r]:(t[r]===null&&e[r]||t[r].id!==e[r].id)&&(a.country_id=e[r].id);else if(r==="interests"){let o=t[r],n=e[r];n.length&&this.isNewInterest(o,n)?a[r]=this.updateInterests(o,n):(!n.length&&o.length||o.length!==n.length&&!this.isNewInterest(o,n))&&(a[r]=n)}}),a};updateInterests=(t,e)=>{if(t.length===e.length){let[i,a]=this.extractSameAndNewInterests(t,e);return[...a,...i]}else return e};isNewInterest=(t,e)=>{let i=!1,[a]=this.extractSameAndNewInterests(t,e);return a.length&&(i=!0),i};extractSameAndNewInterests=(t,e)=>{let i=e.filter(r=>t.some(o=>r.id===o.id&&r.type===o.type&&r.source===o.source&&r.favourite===o.favourite));return[e.filter(r=>!t.some(o=>r.id===o.id&&r.type===o.type&&r.source===o.source&&r.favourite===o.favourite)),i]};isAvatarValidURL=t=>{try{return new URL(t),!0}catch{return!1}}};var vn=class{idsRemapper=null;profileHttps=null;profileService=null;localCache=null;profileFacade=null;ownProfile=null;modified=!1;expireAt=0;promises=[];isFetching=!1;configuration=null;constructor(t,e,i,a,r){this.configuration=t,this.idsRemapper=e,this.localCache=i,this.profileHttps=a,this.profileService=new Cn,this.profileFacade=new wt(i,a,r)}getOwnProfile=async()=>{for(;this.isFetching;)console.log("Another thread is fetching profile..."),await this.delay(100);if(this.modified&&this.ownProfile)return console.log("Timestamp is less than 10 minutes OR profile is modifying "),this.ownProfile;let t=Math.floor(Date.now()/1e3);if(!this.ownProfile||this.expireAt<t){this.isFetching=!0,this.expireAt=Math.floor(Date.now()/1e3)+600;try{await this.clearAllProfileData();let e=await this.profileFacade.getOwn();this.setOwnProfile(e)}catch(e){throw this.isFetching=!1,e}return this.modified=!1,this.isFetching=!1,this.ownProfile}return this.ownProfile};delay=t=>new Promise(e=>{setTimeout(e,t)});setOwnProfile=t=>{this.ownProfile=t};getInfo=async()=>{let t=await this.getOwnProfile(),e=JSON.parse(JSON.stringify(t));return delete e.interests,e};showInterests=async()=>{let t=await this.getOwnProfile(),e=JSON.parse(JSON.stringify(t));return await this.idsRemapper.remapInterests(e.interests)};showFullInterests=async()=>{let t=await this.getOwnProfile(),e=JSON.parse(JSON.stringify(t));return await this.idsRemapper.showFullInterests(e.interests)};getFollowers=async t=>await this.profileFacade.getFollowers(t);getFollowing=async t=>await this.profileFacade.getFollowing(t);follow=async t=>{let e=await this.profileFacade.follow(t),i=await this.profileFacade.updateOwnProfile();return this.setOwnProfile(i),e};unfollow=async t=>{let e=await this.profileFacade.unfollow(t),i=await this.profileFacade.updateOwnProfile();return this.setOwnProfile(i),e};getStats=async()=>{await this.clearAllProfileData();let t=await this.profileFacade.getStats();return await this.idsRemapper.remapProfileStats(t)};getBadges=async t=>(await this.clearAllProfileData(),await this.profileFacade.getBadges(t));addInterestPromise=async t=>{this.modified=!0;let e={...t};await this.getOwnProfile();let i=null;t.source!=="custom"?i=await this.idsRemapper.remapInterestToNative(e):i=e;let a=this.ownProfile.interests.filter(r=>r.id!==i.id||r.type!==i.type||r.source!==i.source);return this.ownProfile.interests=[...a],this.ownProfile.interests.push(i),this};addInterest=t=>(this.promises.push(this.addInterestPromise(t)),this);removeInterestPromise=async t=>{this.modified=!0;let e={...t};await this.getOwnProfile();let i=null;return t.source!=="custom"?i=await this.idsRemapper.remapInterestToNative(e):i=e,this.ownProfile.interests=this.ownProfile.interests.filter(a=>a.id!==i.id||a.type!==i.type||a.source!==i.source),this};removeInterest=t=>(this.promises.push(this.removeInterestPromise(t)),this);setBirthdatePromise=async t=>(this.modified=!0,await this.getOwnProfile(),t?this.ownProfile.birthDate=t:this.ownProfile.birthDate=null,this);setBirthdate=t=>(this.promises.push(this.setBirthdatePromise(t)),this);setGenderPromise=async t=>(this.modified=!0,await this.getOwnProfile(),t==="male"||t==="female"?this.ownProfile.gender=t:this.ownProfile.gender="unspecified",this);setGender=t=>(this.promises.push(this.setGenderPromise(t)),this);setNicknamePromise=async t=>(this.modified=!0,await this.getOwnProfile(),this.ownProfile.nickname=t,this);setNickname=t=>(this.promises.push(this.setNicknamePromise(t)),this);setNamePromise=async t=>(this.modified=!0,await this.getOwnProfile(),this.ownProfile.name=t,this);setName=t=>(this.promises.push(this.setNamePromise(t)),this);setCountryPromise=async t=>(this.modified=!0,await this.getOwnProfile(),t&&!this.ownProfile.country?(this.ownProfile.country=new Ta,this.ownProfile.country.id=t):t&&this.ownProfile.country?this.ownProfile.country.id=t:this.ownProfile.country=null,this);setCountry=t=>(this.promises.push(this.setCountryPromise(t)),this);showFullnessProfile=async()=>{let t=await this.getOwnProfile(),e=JSON.parse(JSON.stringify(t));return this.profileFacade.showFullnessProfile(e)};setAvatarPromise=async t=>{if(this.modified=!0,await this.getOwnProfile(),this.profileService.isAvatarValidURL(t))this.ownProfile.avatar=t;else{if(this.configuration.errorHandlingMode==="default")throw new y(400,"invalid_avatar","Invalid URL syntax for avatar image.");if(this.configuration.errorHandlingMode==="standard")throw new m(400,"invalid_avatar","Invalid URL syntax for avatar image.")}return this};setAvatar=t=>(this.promises.push(this.setAvatarPromise(t)),this);delete=async()=>(await this.profileHttps.deleteOwnProfile(),await this.profileFacade.clearLocalStorageData(),!0);deleteData=async()=>(await this.profileHttps.deleteUserData(),await this.profileFacade.clearLocalStorageData(),!0);setEmailPromise=async t=>(this.modified=!0,await this.getOwnProfile(),typeof t=="string"&&t?this.ownProfile.email=t:console.warn(`Wrong email argument: ${t}. Will be ignored when updating profile`),this);setEmail=t=>(this.promises.push(this.setEmailPromise(t)),this);setPhoneCountryCodePromise=async t=>(this.modified=!0,await this.getOwnProfile(),t===null||typeof t=="string"&&t?this.ownProfile.phoneCountryCode=t:console.warn(`Wrong phoneCountryCode argument: ${t}. Will be ignored when updating profile`),this);setPhoneCountryCode=t=>(this.promises.push(this.setPhoneCountryCodePromise(t)),this);setPhoneNumberPromise=async t=>(this.modified=!0,await this.getOwnProfile(),t===null||typeof t=="string"&&t?this.ownProfile.phoneNumber=t:console.warn(`Wrong phoneNumber argument: ${t}. Will be ignored when updating profile`),this);setPhoneNumber=t=>(this.promises.push(this.setPhoneNumberPromise(t)),this);update=async()=>{if(this.promises.length===0)return this.ownProfile;await Promise.all(this.promises);let t=await this.profileFacade.getOwn(),e=await this.getOwnProfile(),i=this.profileService.extractUpdatedProps(t,e);if(this.modified=!1,this.expireAt=0,Object.keys(i).length){let r=await this.profileHttps.updateProfile(i),o=JSON.parse(JSON.stringify(r));return this.setOwnProfile(o),await this.localCache.setOwnProfile(o),delete r.interests,r}let a=JSON.parse(JSON.stringify(this.ownProfile));return delete a.interests,a};clearAllProfileData=async()=>{await this.isNewProfileRequested()&&await this.profileFacade.clearLocalStorageData()};isNewProfileRequested=async()=>{let t=this.profileHttps.extractUserIdFromToken();if(!t)return!1;if(!this.ownProfile){let e=await this.profileFacade.getOwnProfileFromCache();return!!(e&&Object.keys(e).length&&e.id!==t)}return this.ownProfile.id!==t}};var gi=class{idsRemapper=null;profileHttps=null;activityHttps=null;profileFacade=null;profileId="";localCache=null;constructor(t,e,i,a){this.idsRemapper=t,this.profileHttps=i,this.activityHttps=a,this.localCache=e,this.profileFacade=new wt(e,i,a)}getById=t=>new gi(this.idsRemapper,this.localCache,this.profileHttps,this.activityHttps).setId(t);setId=t=>(this.profileId=t,this);getProfile=async()=>await this.profileFacade.getById(this.profileId);getInfo=async()=>{let t=await this.getProfile();return delete t.interests,t};showInterests=async()=>{let t=await this.getProfile(),e=JSON.parse(JSON.stringify(t));return await this.idsRemapper.remapInterests(e.interests)};showFullInterests=async()=>{let t=await this.getProfile(),e=JSON.parse(JSON.stringify(t));return await this.idsRemapper.showFullInterests(e.interests)};getFollowers=async t=>await this.profileFacade.getFollowers(t,this.profileId);getFollowing=async t=>await this.profileFacade.getFollowing(t,this.profileId);showFullnessProfile=async()=>{let t=await this.getProfile();return this.profileFacade.showFullnessProfile(t)};getStats=async t=>{let e=await this.activityHttps.getStats(this.profileId,t);return await this.idsRemapper.remapProfileStats(e)};getBadges=async()=>await this.profileHttps.getBadges(this.profileId)};var An=class{localCache=null;https=null;idMapping=null;constructor(t,e,i){this.localCache=t,this.idMapping=i,this.https=e}getCountriesWithIdMapping=async t=>{try{let e=await this.getCountries(t);return this.idMapping.remapEntities(e,"country")}catch(e){throw console.warn("There was a problem browsing countries as football entities",e),e}};getCountries=async t=>{t=t||!1;let e=await this.localCache.getFootballCountries();if(e&&e.length>0)return e;try{let i=await this.https.getCountries(t);return await this.localCache.setFootballCountries(i),i}catch(i){throw console.warn("There was a problem retrieving countries as football entities",i),i}}};var yi=class{countryId=null;name=null;gender=null;type=null;sortField=null;sortOrder=null;competitionIds=null;constructor(t){this.countryId=t.countryId?`${t.countryId}`:null,this.name=t.name?t.name:null,this.gender=t.gender?t.gender:null,this.type=t.type?t.type:null,this.sortField=t.sortField?`${t.sortField}`:null,this.sortOrder=t.sortOrder?`${t.sortOrder}`:null,this.competitionIds=t.competitionIds?t.competitionIds:null}constructFilterUrl=()=>{let t="";return this.countryId&&(t=t+"&",t=t+`country_id=${this.countryId}`),this.gender&&(t=t+"&",t=t+`gender=${this.gender}`),this.type&&(t=t+"&",t=t+`type=${this.type}`),this.sortField&&(t=t+"&",t=t+`sort_field=${this.sortField}`),this.sortOrder&&(t=t+"&",t=t+`sort_order=${this.sortOrder}`),this.name&&(t=t+"&",t=t+`name=${this.name}`),this.competitionIds&&this.competitionIds.length>0&&(t=t+"&",t=t+`competition_ids=${this.competitionIds.join(",")}`),t};competitionSearchFilter=t=>{try{let e=this.filter(t);return this.sortField||this.sortOrder?this.sort(e):e}catch(e){return console.warn("There was a problem filtering the local competitions",e),[]}};filter=t=>{let e=this.entitiesToSearchWith();return t.filter(i=>{let a=!0;return e.forEach(r=>{r!=="sortOrder"&&r!=="sortField"&&(r==="countryId"?a&&=i.country.id===this[r]:r==="name"?a&&=i.name.toLocaleLowerCase().includes(this[r].toLocaleLowerCase()):r==="competitionIds"?a&&=this[r].some(o=>i.id===o):a&&=i[r].toLocaleLowerCase()===this[r].toLocaleLowerCase())}),a})};entitiesToSearchWith=()=>{let t=[];return this.countryId&&t.push("countryId"),this.name&&t.push("name"),this.gender&&t.push("gender"),this.type&&t.push("type"),this.sortField&&t.push("sortField"),this.sortOrder&&t.push("sortOrder"),this.competitionIds&&t.push("competitionIds"),t};sort=t=>{let e=[];return this.sortField==="name"?e=t.sort((i,a)=>this.sortOrder&&this.sortOrder==="desc"?a.name.localeCompare(i.name):i.name.localeCompare(a.name)):this.sortField==="country"?e=t.sort((i,a)=>this.sortOrder&&this.sortOrder==="desc"?a.country.name.localeCompare(i.country.name):i.country.name.localeCompare(a.country.name)):this.sortField==="scope"?t.forEach(i=>e[this.competitionIds.indexOf(i.id)]=i):!this.sortField&&this.sortOrder==="desc"&&(e=t.sort((i,a)=>a.id.localeCompare(i.id))),e}};var On=class{localStorage=null;https=null;idMapping=null;constructor(t,e,i){this.localStorage=t,this.idMapping=i,this.https=e}getCompetitionsIdMapping=async(t,e)=>{try{let i=!1;if(t){if(t=new yi(t),t.countryId){let r=await this.idMapping.getEntityIdsBySchemaId([`${t.countryId}`],"country","native");r.country.length===0&&(i=!0),t.countryId=r.country[0]}if(t.competitionIds){let r=await this.idMapping.getEntityIdsBySchemaId(t.competitionIds,"competition","native");r.competition.length===0&&(i=!0),t.competitionIds=r.competition}if(i)return[]}let a=await this.getCompetitions(t,e);return await this.idMapping.remapEntities(a,"competition")}catch(i){throw console.warn("There was a problem browsing all of the competitions",i),i}};getCompetitionsMapWithNativeIds=async t=>{let e=new Map,i=t.length,a=new yi({competitionIds:t,limit:i}),r=await this.getCompetitions(a);r.sort((l,p)=>l.id.localeCompare(p.id));let o=hp(t),n=await this.idMapping.remapEntities(r,"competition");return o.forEach((l,p)=>e.set(l,n[p])),e};getCompetitions=async(t,e)=>{let i=null;if(e=e||!1,!await this.localStorage.getCompetitionsLength()){try{i=await this.https.getCompetitions()}catch(a){throw console.warn("There was a problem retrieving all competitions",a),a}await this.localStorage.setCompetitions(i)}return await this.localStorage.getCompetitions(t)};getCompetitionByIdIdMapping=async(t,e)=>{try{let a=(await this.idMapping.getEntityIdsBySchemaId([t],"competition","native")).competition[0],r=await this.getCompetitionById(a,e);return await this.idMapping.remapEntities(r,"competition")}catch(i){throw console.warn(`There was a problem browsing the following competition:${t}`,i),i}};getCompetitionById=async(t,e)=>{try{return e=e||!1,await this.https.getCompetitionById(t,e)}catch(i){throw console.warn(`There was a problem retrieving the competition with the following id: ${t}`,i),i}};getTopCompetitionsIdMapping=async t=>{try{let e=await this.getTopCompetitions(t);return await this.idMapping.remapEntities(e,"competition")}catch(e){throw console.warn("There was a problem browsing the top competitions",e),e}};getTopCompetitions=async t=>{try{return t=t||!1,await this.https.getTopCompetitions(t)}catch(e){throw console.warn("There was a problem retrieving the top competitions",e),e}}};var bi=class{name=null;countryId=null;national=!1;gender=null;limit=null;page=null;scope=null;sortField=null;sortOrder=null;teamIds=null;constructor(t){this.name=t.name?t.name:null,this.countryId=t.countryId?`${t.countryId}`:null,this.national=t.national?t.national:!1,this.gender=t.gender?t.gender:null,this.limit=t.limit?t.limit:null,this.page=t.page?t.page:null,this.scope=t.scope?t.scope:null,this.sortField=t.sortField?`${t.sortField}`:null,this.sortOrder=t.sortOrder?`${t.sortOrder}`:null,this.teamIds=t.teamIds?t.teamIds:null}constructFilterUrl=()=>{let t="";return this.name&&(t=t+"&",t=t+`name=${this.name}`),this.countryId&&(t=t+"&",t=t+`country_id=${this.countryId}`),this.national&&(t=t+"&",t=t+`national=${this.national}`),this.gender&&(t=t+"&",t=t+`gender=${this.gender}`),this.limit&&(t=t+"&",t=t+`limit=${this.limit}`),this.scope&&this.scope.length>0&&(t=t+"&",t=t+`scope=${this.scope.join(",")}`),this.page&&(t=t+"&",t=t+`page=${this.page}`),this.sortField&&(t=t+"&",t=t+`sort_field=${this.sortField}`),this.sortOrder&&(t=t+"&",t=t+`sort_order=${this.sortOrder}`),this.teamIds&&this.teamIds.length>0&&(t=t+"&",t=t+`team_ids=${this.teamIds.join(",")}`),t}};var Ea=class{reason="";words=[]};var fe=class{enabled=!1;moderateLinks=!1;linksWhitelist=[];moderatorProfileId="";dictionary=new Ea};var Ra=class{enabled=!1;clientId=null;automaticModeration=new fe};var vt=class{points=null;gameParticipationCount=null;entityId=null;entityType=null;predictionsMade=null;correctPredictions=null};var ge=class{id;weight;multiplier;conditions};var ye=class{value=[new ge]};var be=class{points=null;tiers=null;badges=null};var Sa=class{enabled=!1;clientId=null;conditions={list:null};actions=new ye;rewards=new be};var Fa=class{general=null;predictor=null;activity=null;topX=null;matchQuiz=null;discussionPost=null};var Me=class{enabled=!1;clientId=null;defaultMarkets=null;competitionsWhitelist=null;authRequirement=null};var Ie=class{enabled=!1;clientId=null;minFixtures=null;maxFixtures=null;competitionsWhitelist=null;authRequirement=null};var Ca=class{competitions=[];teams=[];markets=[]};var we=class{enabled=!1;clientId=null;fullCoverageCompetitions=null;markets=null;successRateScopes=new Ca;userDataConfig=null};var va=class{storeIp=!1;storeDeviceId=!1;storeAgent=!1};var Aa=class{potm=[];poll=[]};var Oa=class{predictor=[];topX=[];matchQuiz=[];games=[];football=[];classicQuizzes=[];eitherOr=[];discussions=[];voting=new Aa};var q=class{id;label;description;flags;assets={mainImageUrl:""};enabled};var La=class{predictionsNumber;correctPredictions;points;fromDate;toDate};var xa=class extends q{requirements=new La};var Da=class{participationCount;points;fromDate;toDate};var Ba=class extends q{requirements=new Da};var Na=class{participationCount;points;specificGames;fromDate;toDate};var ka=class extends q{requirements=new Na};var Ga=class{predictionsNumber;correctPredictions;points;entityId;entityType;entityModel=null};var Ua=class extends q{requirements=new Ga};var Va=class{participationCount;fromDate;toDate};var Ha=class extends q{requirements=new Va};var $a=class{totalDiscussionPoints;postsCount;postPoints;reactionsCount};var Wa=class extends q{requirements=new $a};var qa=class{points;voteCount;entityId;entityType;entityModel};var _e=class extends q{requirements=new qa};var Pe=class{points=null;tiers=null;badges=null};var za=class{enabled=!1;clientId=null;conditions={list:null};actions=new ye;rewards=new Pe};var Qa=class{general=[];predictor=[];topX=[];matchQuiz=[]};var Ka=class{id;label;assets={mainImageUrl:""};enabled;requirements=new vt};var Te=class extends vt{postPoints=null;postsCount=null;reactionsCount=null;totalDiscussionPoints=null};var ja=class{id;label;assets={mainImageUrl:""};enabled;requirements=new Te};var Ee=class{assists=null;shots=null;offsides=null;tackles=null;saves=null;minutesEqualOrOver60=null;minutesUnder60=null;yellowCards=null;redCards=null;goalsGoalkeeper=null;goalsDefender=null;goalsMidfielder=null;goalsForwards=null;penaltyGoals=null;ownGoals=null;cleanSheetsGoalkeeper=null;cleanSheetsDefender=null;cleanSheetsMidfielder=null;cleanSheetsForwards=null;shotsOn=null;foulsCommitted=null;penaltyCommitted=null;penaltyWon=null;penaltyMissed=null;concededGoals=null;caughtBall=null};var Re=class{total=null;minGoalkeepers=null;maxGoalkeepers=null;minDefenders=null;maxDefenders=null;minMidfielders=null;maxMidfielders=null;minStrikers=null;maxStrikers=null};var Ya=class{enabled=!1;clientId=null;addPointsToProfileTotal=!1;coefficients=new Ee;players=new Re;multipliers=null;competitionsWhitelist=[]};var Xa=class{captain=null;viceCaptain=null};var Ln=class{remapPredictorConfig=t=>{let e=new we;return e.enabled=t.enabled,e.clientId=t.client_id,e.fullCoverageCompetitions=t.full_coverage_competitions,e.markets=t.markets,e.successRateScopes=t.success_rate_scopes,e.userDataConfig=t.user_data_config?this.remapUserDataConfig(t.user_data_config):null,e};remapTopXConfig=t=>{let e=new Ie;return e.enabled=t.enabled,e.clientId=t.client_id,e.minFixtures=t.min_fixtures,e.maxFixtures=t.max_fixtures,e.competitionsWhitelist=t.competitions_whitelist,e.authRequirement=t.auth_requirement,e};remapMatchQuizConfig=t=>{let e=new Me;return e.enabled=t.enabled,e.clientId=t.client_id,e.defaultMarkets=t.default_markets,e.competitionsWhitelist=t.competitions_whitelist,e.authRequirement=t.auth_requirement,e};remapLoyaltyConfig=t=>{let e=new Sa;return e.enabled=t.enabled,e.clientId=t.client_id,e.conditions.list=t.conditions.list,e.actions.value=t.actions.value,e.rewards=this.remapRewards(t.rewards),e};remapLoyaltyNewConfig=t=>{let e=new za;return e.enabled=t.enabled,e.clientId=t.client_id,e.conditions.list=t.conditions.list,e.actions.value=t.actions.value,e.rewards=this.remapNewRewards(t.rewards),e};remapDiscussionsConfig=t=>{let e=new Ra;return e.enabled=t.enabled,e.clientId=t.client_id,e.automaticModeration=t.automatic_moderation?this.remapAutomaticModeration(t.automatic_moderation):null,e};remapFantasyConfig=t=>{let e=new Ya;return e.enabled=t.enabled,e.clientId=t.client_id,e.addPointsToProfileTotal=t.add_points_to_profile_total,e.competitionsWhitelist=t.competitions_whitelist,e.multipliers=t.multipliers?this.remapMultipliers(t.multipliers):null,e.players=this.remapFantasyPlayers(t.players),e.coefficients=this.remapFantasyCoefficients(t.coefficients),e};remapFantasyPlayers=t=>{let e=new Re;return e.total=t.total,e.minGoalkeepers=t.min_goalkeepers,e.maxGoalkeepers=t.max_goalkeepers,e.minDefenders=t.min_defenders,e.maxDefenders=t.max_defenders,e.minMidfielders=t.min_midfielders,e.maxMidfielders=t.max_midfielders,e.minStrikers=t.min_strikers,e.maxStrikers=t.max_strikers,e};remapFantasyCoefficients=t=>{let e=new Ee;return e.assists=t.assists,e.shots=t.shots,e.offsides=t.offsides,e.tackles=t.tackles,e.saves=t.saves,e.minutesEqualOrOver60=t.minutes_equal_or_over_60,e.minutesUnder60=t.minutes_under_60,e.yellowCards=t.yellow_cards,e.redCards=t.red_cards,e.goalsGoalkeeper=t.goals_goalkeeper,e.goalsDefender=t.goals_defender,e.goalsMidfielder=t.goals_midfielder,e.goalsForwards=t.goals_forwards,e.penaltyGoals=t.penalty_goals,e.ownGoals=t.own_goals,e.cleanSheetsGoalkeeper=t.clean_sheets_goalkeeper,e.cleanSheetsDefender=t.clean_sheets_defender,e.cleanSheetsMidfielder=t.clean_sheets_midfielder,e.cleanSheetsForwards=t.clean_sheets_forwards,e.shotsOn=t.shots_on,e.foulsCommitted=t.fouls_committed,e.penaltyCommitted=t.penalty_committed,e.penaltyWon=t.penalty_won,e.penaltyMissed=t.penalty_missed,e.concededGoals=t.conceded_goals,e.caughtBall=t.caught_ball,e};remapAutomaticModeration=t=>{let e=new fe;return e.enabled=t.enabled,e.moderateLinks=t.moderate_links,e.linksWhitelist=t.links_whitelist,e.moderatorProfileId=t.moderator_profile_id,e.dictionary=t.dictionary,e};remapNewRewards=t=>{let e=new Pe;return e.points=this.remapPoints(t.points),e.tiers=t.tiers,e.badges=this.remapNewBadges(t.badges),e};remapRewards=t=>{let e=new be;return e.points=this.remapPoints(t.points),e.tiers=t.tiers,e.badges=this.remapBadges(t.badges),e};remapPoints=t=>{let e=new Fa;return e.general=t.general,e.discussionPost=t.discussion_post,e.predictor=t.predictor,e.activity=t.activity,e.topX=t.top_x,e.matchQuiz=t.match_quiz,e};remapBadges=t=>{let e=new Qa;return e.general=t.general?this.remapGeneralBadgeValues(t.general):[],e.predictor=this.remapBadgeValues(t.predictor),e.topX=this.remapBadgeValues(t.top_x),e.matchQuiz=this.remapBadgeValues(t.match_quiz),e};remapNewBadges=t=>{let e=new Oa;return e.predictor=this.remapBadgeValuesPredictor(t.predictor),e.topX=this.remapBadgeValuesGame(t.top_x),e.matchQuiz=this.remapBadgeValuesGame(t.match_quiz),t.games&&(e.games=this.remapBadgeValuesGames(t.games)),t.football&&(e.football=this.remapBadgeValuesFootball(t.football)),t.classic_quizzes&&(e.classicQuizzes=this.remapBadgeValuesMiniGames(t.classic_quizzes)),t.either_or&&(e.eitherOr=this.remapBadgeValuesMiniGames(t.either_or)),t.discussions&&(e.discussions=this.remapBadgeValuesDiscussions(t.discussions)),t.voting&&t.voting.potm&&(e.voting.potm=this.remapBadgeValuesVoting(t.voting.potm)),t.voting&&t.voting.poll&&(e.voting.poll=this.remapBadgeValuesVoting(t.voting.poll)),e};remapBadgeValuesPredictor=t=>t.map(e=>{let i=new xa;return i.id=e.id,i.enabled=e.enabled,i.label=e.label,i.description=e.description,i.flags=e.flags,e.assets?i.assets.mainImageUrl=e.assets.main_image_url:i.assets=e.assets,e.requirements&&(i.requirements.predictionsNumber=e.requirements.predictions_number,i.requirements.correctPredictions=e.requirements.correct_predictions,i.requirements.points=e.requirements.points,i.requirements.fromDate=e.requirements.from_date,i.requirements.toDate=e.requirements.to_date),i});remapBadgeValuesGame=t=>t.map(e=>{let i=new Ba;return i.id=e.id,i.enabled=e.enabled,i.label=e.label,i.description=e.description,i.flags=e.flags,e.assets?i.assets.mainImageUrl=e.assets.main_image_url:i.assets=e.assets,e.requirements&&(i.requirements.participationCount=e.requirements.participation_count,i.requirements.points=e.requirements.points,i.requirements.fromDate=e.requirements.from_date,i.requirements.toDate=e.requirements.to_date),i});remapBadgeValuesGames=t=>t.map(e=>{let i=new ka;return i.id=e.id,i.enabled=e.enabled,i.label=e.label,i.description=e.description,i.flags=e.flags,e.assets?i.assets.mainImageUrl=e.assets.main_image_url:i.assets=e.assets,e.requirements&&(i.requirements.participationCount=e.requirements.participation_count,i.requirements.points=e.requirements.points,i.requirements.fromDate=e.requirements.from_date,i.requirements.toDate=e.requirements.to_date,i.requirements.specificGames=e.requirements.specific_games?this.remapSpecificGamesRequirement(e.requirements.specific_games):null),i});remapSpecificGamesRequirement=t=>t.map(e=>({gameId:e.game_id,gameType:e.game_type,gameModel:null}));remapBadgeValuesFootball=t=>t.map(e=>{let i=new Ua;return i.id=e.id,i.enabled=e.enabled,i.label=e.label,i.description=e.description,i.flags=e.flags,e.assets?i.assets.mainImageUrl=e.assets.main_image_url:i.assets=e.assets,e.requirements&&(i.requirements.predictionsNumber=e.requirements.predictions_number,i.requirements.correctPredictions=e.requirements.correct_predictions,i.requirements.points=e.requirements.points,i.requirements.entityId=e.requirements.entity_id,i.requirements.entityType=e.requirements.entity_type),i});remapBadgeValuesMiniGames=t=>t.map(e=>{let i=new Ha;return i.id=e.id,i.enabled=e.enabled,i.label=e.label,i.description=e.description,i.flags=e.flags,e.assets?i.assets.mainImageUrl=e.assets.main_image_url:i.assets=e.assets,e.requirements&&(i.requirements.participationCount=e.requirements.participation_count,i.requirements.fromDate=e.requirements.from_date,i.requirements.toDate=e.requirements.to_date),i});remapBadgeValuesDiscussions=t=>t.map(e=>{let i=new Wa;return i.id=e.id,i.enabled=e.enabled,i.label=e.label,i.description=e.description,i.flags=e.flags,e.assets?i.assets.mainImageUrl=e.assets.main_image_url:i.assets=e.assets,e.requirements&&(i.requirements.totalDiscussionPoints=e.requirements.total_discussion_points,i.requirements.postsCount=e.requirements.posts_count,i.requirements.postPoints=e.requirements.post_points,i.requirements.reactionsCount=e.requirements.reactions_count),i});remapBadgeValuesVoting=t=>t.map(e=>{let i=new _e;return i.id=e.id,i.enabled=e.enabled,i.label=e.label,i.description=e.description,i.flags=e.flags,e.assets?i.assets.mainImageUrl=e.assets.main_image_url:i.assets=e.assets,e.requirements&&(i.requirements.points=e.requirements.points,i.requirements.voteCount=e.requirements.vote_count,i.requirements.entityId=e.requirements.entity_id,i.requirements.entityType=e.requirements.entity_type),i});remapBadgeValues=t=>t.map(e=>{let i=new Ka;return i.id=e.id,i.label=e.label,i.enabled=e.enabled,e.assets?i.assets.mainImageUrl=e.assets.main_image_url:i.assets=e.assets,i.requirements=this.remapRequirements(e.requirements),i});remapRequirements=t=>{let e=new vt;return e.points=t.points,e.gameParticipationCount=t.game_participation_count,e.entityId=t.entity_id,e.entityType=t.entity_type,e.predictionsMade=t.predictions_made,e.correctPredictions=t.correct_predictions,e};remapUserDataConfig=t=>{let e=new va;return e.storeIp=t.store_ip,e.storeDeviceId=t.store_device_id,e.storeAgent=t.store_agent,e};remapGeneralBadgeValues=t=>t.map(e=>{let i=new ja;return i.id=e.id,i.label=e.label,i.enabled=e.enabled,e.assets?i.assets.mainImageUrl=e.assets.main_image_url:i.assets=e.assets,i.requirements=this.remapGeneralRequirements(e.requirements),i});remapGeneralRequirements=t=>{let e=new Te;return e.points=t.points,e.gameParticipationCount=t.game_participation_count,e.entityId=t.entity_id,e.entityType=t.entity_type,e.predictionsMade=t.predictions_made,e.correctPredictions=t.correct_predictions,e.postPoints=t.post_points,e.postsCount=t.posts_count,e.reactionsCount=t.reactions_count,e.totalDiscussionPoints=t.total_discussion_points,e};remapMultipliers=t=>{let e=new Xa;return e.captain=t.captain,e.viceCaptain=t.vice_captain,e}};var Ja=class{entityId;entityType;entityModel=null};var Pp=class{totalItems=0};var Tp=class{id=null;label=null};var Ep=class{type=null;id=null;label=null};var Za=class{id=null;source=null;type=null};var P=class{limit;startAfter;constructor(t){this.limit=t&&t.limit?t.limit:null,this.startAfter=t&&t.startAfter?t.startAfter:null}constructMainFiltersUrl(){let t="";return this.limit&&(t+="&",t+=`limit=${this.limit}`),this.startAfter&&(t+="&",t+=`start_after=${this.startAfter}`),t}};var tr=class extends P{};var Rp=class{fixtures=[];tiebreaker};var bc=(i=>(i.PARTICIPANT_ONE="PARTICIPANT_ONE",i.PARTICIPANT_TWO="PARTICIPANT_TWO",i.DRAW="DRAW",i))(bc||{});var er=class{matchId="";participantOne="";participantTwo="";winner="PARTICIPANT_ONE"};var At=(o=>(o.OPEN="OPEN",o.LIVE="LIVE",o.PENDING="PENDING",o.CANCELED="CANCELED",o.CLOSED="CLOSED",o.SETTLED="SETTLED",o))(At||{});var ir=class extends P{status=null;sortOrder=null;gameIds=null;constructor(t){super(t),this.status=t?.status||null,this.sortOrder=t?.sortOrder||null,this.gameIds=t?.gameIds||null}constructMainFiltersUrl(){let t=super.constructMainFiltersUrl();return this.status&&Object.values(At).includes(this.status)?(t+="&",t+=`status=${this.status}`):this.status!==null&&console.warn(`The filter 'status' has the following INVALID value: ${this.status}. It will be not passed as a query param in the URL. For more information visit our documentation.`),this.sortOrder&&(this.sortOrder==="asc"||this.sortOrder==="desc"||this.sortOrder==="ASC"||this.sortOrder==="DESC")?(t+="&",t+=`sort_order=${this.sortOrder}`):this.sortOrder!==null&&console.warn(`The filter 'sortOrder' has the following INVALID value: ${this.sortOrder}. It will be not passed as a query param in the URL. For more information visit our documentation.`),this.gameIds&&Array.isArray(this.gameIds)&&this.gameIds.length>0?(t+="&",t+=`game_ids=${this.gameIds}`):this.gameIds!==null&&console.warn(`The filter 'gameIds' has the following INVALID value: ${this.gameIds}. It will be not passed as a query param in the URL. For more information visit our documentation.`),t}};var ar=class{profileId="";profileModel=null;challengeId="";challengeModel=null;message=""};var Se=class{name="";description="";invitation_code="";template_id="";users_can_invite_users=!1;administrators=[];scoring_starts_at=""};var rr=class extends Se{type="ONE_VS_ONE"};var Fe=class{name="";description="";invitation_code="";template_id="";users_can_invite_users=!1;administrators=[];pinned_posts=[];scoring_starts_at=""};var or=class extends Fe{type="ONE_VS_ONE"};var sr=class{limit=null;page=null;challengeId=null;templateId=null;sortOrder=null;constructor(t){this.limit=t&&t.limit?t.limit:null,this.page=t&&t.page?t.page:null,this.challengeId=t&&t.challengeId?t.challengeId:null,this.templateId=t&&t.templateId?t.templateId:null,this.sortOrder=t&&t.sortOrder?t.sortOrder:null}constructFiltersUrl=()=>{let t="";return this.limit&&(t+=`&limit=${this.limit}`),this.page&&(t+=`&page=${this.page}`),this.challengeId&&(t+=`&league_id=${this.challengeId}`),this.templateId&&(t+=`&template_id=${this.templateId}`),this.sortOrder&&(t+=`&sort_order=${this.sortOrder}`),t}};var nr=class{type="ONE_VS_ONE";userRole=null;constructor(t){this.userRole=t?.userRole||null}constructFiltersUrl=()=>{let t=`&type=${this.type}`;return this.userRole&&(t+=`&user_role=${this.userRole}`),t}};var lr=class{templateId="";templateModel=null;challengeId="";challengeModel=null;position="";points=0;type="challenge"};var pr=class{id="";label="";discussionType="LEAGUE";discussionUrl=null;moderationType="USER";postsCount=0;pinnedPosts=[];lastPostId="";status="";deleted=!1;deletedAt="";deletedBy="";customFields=null;context=null;createdAt="";updatedAt=""};var Sp=class{content="";replyId="";discussionLabel="";discussionUrl="";userNickname="";context=null};var Ce=class{id="";userId="";discussionId="";content="";repliesCount=0;replyId="";anonymousNickname="";reactions=[];reactionsCount=0;reports=[];reportsCount=0;versions=null;privatePost=!1;deleted=!1;deletedAt="";deletedBy="";moderated=!1;moderatedAt="";moderatedBy="";moderatedReason="";createdAt="";updatedAt=""};var cr=class extends Ce{userModel=null};var dr=class{content="";reply_id="";discussion_label="";discussion_url="";anonymous_nickname="";context=null};var ur=class{id="";postsCount=0};var Ot=class{pagination={totalItems:0,nextPageStartsAfter:"",lastCommentCreateTimestamp:""}};var mr=class{meta=new Ot;data=[]};var hr=class{meta=new Ot;data=[]};var fr=class{meta=new w;data=[]};var gr=class{type="";userIds=[];reactionCount=0};var yr=class{userId=null;reason="AD";reasonDetails=null};var br=class{updatedAt="";content=""};var Bd=["CREATED_AT_ASC","CREATED_AT_DESC","POSTS_COUNT_ASC","POSTS_COUNT_DESC"],Nd=["ACTIVE","INACTIVE"],Mr=class extends P{discussionIds;label;discussionUrl;fromDate;toDate;fromCount;toCount;sort;status;skipDeleted;constructor(t){super(t),this.discussionIds=t&&t.discussionIds?t.discussionIds:null,this.label=t&&t.label?t.label:null,this.discussionUrl=t&&t.discussionUrl?t.discussionUrl:null,this.fromDate=t&&t.fromDate?t.fromDate:null,this.toDate=t&&t.toDate?t.toDate:null,this.fromCount=t&&t.fromCount?t.fromCount:null,this.toCount=t&&t.toCount?t.toCount:null,this.sort=t&&t.sort?t.sort:null,this.status=t?.status||null,this.skipDeleted=t&&t.skipDeleted!==void 0?t.skipDeleted:null}constructMainFiltersUrl(){let t=super.constructMainFiltersUrl();return this.discussionIds!==null&&(t+=`&discussion_ids=${this.discussionIds.join(",")}`),this.label!==null&&(t+=`&label=${this.label}`),this.discussionUrl!==null&&(t+=`&discussion_url=${this.discussionUrl}`),this.fromDate!==null&&(t+=`&from_date=${this.fromDate}`),this.toDate!==null&&(t+=`&to_date=${this.toDate}`),this.fromCount!==null&&(t+=`&from_count=${this.fromCount}`),this.toCount!==null&&(t+=`&to_count=${this.toCount}`),this.sort&&Bd.includes(this.sort.toUpperCase())&&(t+=`&sort=${this.sort.toUpperCase()}`),this.status&&Nd.includes(this.status.toUpperCase())&&(t+=`&status=${this.status.toUpperCase()}`),this.skipDeleted!==null&&(t+=`&skip_deleted=${this.skipDeleted}`),t}};var Ht=class extends P{skipDeleted;skipModerated;sort;constructor(t){super(t),this.skipDeleted=t&&t.skipDeleted!==void 0?t.skipDeleted:null,this.skipModerated=t&&t.skipModerated!==void 0?t.skipModerated:null,this.sort=t&&t.sort?t.sort.toLocaleLowerCase():null}constructMainFiltersUrl(){let t=super.constructMainFiltersUrl();return this.skipDeleted!==null&&(t+=`&skip_deleted=${this.skipDeleted}`),this.skipModerated!==null&&(t+=`&skip_moderated=${this.skipModerated}`),this.sort&&(t+=`&sort=${this.sort}`),t}};var Ir=class extends P{fromDate;toDate;entityIds;entityType;contentType;constructor(t){super(t),this.fromDate=t?.fromDate||null,this.toDate=t?.toDate||null,this.entityIds=t?.entityIds||null,this.entityType=t?.entityType||null,this.contentType=t?.contentType||null}constructMainFiltersUrl(){let t=super.constructMainFiltersUrl();return this.fromDate!==null&&(t+=`&from_date=${this.fromDate}`),this.toDate!==null&&(t+=`&to_date=${this.toDate}`),this.entityIds!==null&&this.entityIds.length>0&&(t+=`&entity_ids=${this.entityIds}`),this.contentType!==null&&(t+=`&content_type=${this.contentType}`),t}};var wr=class{templateId=null;playerId=null};var _r=class{filters=new wr};var Pr=class{meta=new _r;data=[]};var Tr=class{key=null;label=null;value=null};var Er=class{templateId=null};var Rr=class{filters=new Er};var Sr=class{meta=new Rr;data=[]};var ve=class{template_id=null;group_id=null;fixtures=[]};var Ae=class{total=null;minutesPlayed=null;yellowCards=null;redCards=null;goals=null;penaltyGoals=null;ownGoals=null;assists=null;cleanSheets=null;shots=null;shotsOn=null;offsides=null;foulsCommitted=null;penaltyCommitted=null;penaltyWon=null;penaltyMissed=null;tackles=null;concededGoals=null;caughtBall=null;saves=null};var Oe=class{minutesPlayed=null;yellowCards=null;redCards=null;goals=null;penaltyGoals=null;penaltyCommitted=null;penaltyWon=null;penaltyMissed=null;penaltySaved=null;penaltyReceived=null;ownGoals=null;assists=null;cleanSheets=null;shots=null;shotsOn=null;shotsBlocked=null;offsides=null;foulsCommitted=null;foulsWon=null;tackles=null;tacklesBlocks=null;tacklesInterceptions=null;concededGoals=null;caughtBall=null;saves=null;passes=null;crosses=null;interceptions=null;keyPasses=null;passesAccuracy=null;duels=null;duelsWon=null;dribblesAttempts=null;dribblesSuccess=null;dribblesPast=null};var Fr=class{matchId=null;matchModel=null;points=new Ae;stats=new Oe};var Cr=class{playerId=null;playerModel=null;points=null;rank=null};var vr=class{id="";country=null;gender="";assets=null;type="";name=""};var Ar=class{id="";country=null;gender="";assets=null;type="";name="";participants=[]};var Or=class{id="";alias="";countryCode="";assets=null;name=""};var j=class{type=null;subType=null};var Lr=class{id="";kickoffAt="";finishedAt="";updatedAt="";availableMarkets=null;homeTeam=null;awayTeam=null;isDeleted=!1;undecided=!1;lineupsConfirmed=!1;startedAt="";minute="";scores=null;context={competition:null};status=new j};var xr=class{id="";kickoffAt="";finishedAt="";updatedAt="";availableMarkets=null;isDeleted=!1;undecided=!1;homeTeam=null;awayTeam=null;lineupsConfirmed=!1;startedAt="";minute="";scores=null;stats=null;playerStats=[];context={competition:null};timeline=[];status=new j;lineups=null};var ht=class{countryIds=null;competitionIds=null;matchIds=null;status=null;teamIds=null;fromDate=null;toDate=null;limit=null;page=null;sortField=null;sortOrder=null;constructor(t){this.countryIds=t.countryIds?t.countryIds:null,this.competitionIds=t.competitionIds?t.competitionIds:null,this.matchIds=t.matchIds?t.matchIds:null,this.status=t.status?t.status:null,this.teamIds=t.teamIds?t.teamIds:null,this.fromDate=t.fromDate?t.fromDate:null,this.toDate=t.toDate?t.toDate:null,this.limit=t.limit?t.limit:null,this.page=t.page?t.page:null,this.sortField=t.sortField?t.sortField:null,this.sortOrder=t.sortOrder?t.sortOrder:null}constructFilterUrl=t=>{let e="";return this.countryIds&&(e=e+"&",e=e+`countries=${this.countryIds.join(",")}`),this.competitionIds&&this.competitionIds.length>0&&(e=e+"&",e=e+`competitions=${this.competitionIds.join(",")}`),this.matchIds&&this.matchIds.length>0&&(e=e+"&",e=e+`matches=${this.matchIds.join(",")}`),this.status&&(e=e+"&",e=e+`status=${this.status}`),this.teamIds&&this.teamIds.length>0&&(e=e+"&",e=e+`teams=${this.teamIds.join(",")}`),this.fromDate&&(e=e+"&",e=e+`from_date=${this.fromDate}`),this.toDate&&(e=e+"&",e=e+`to_date=${this.toDate}`),this.limit&&!t&&(e=e+"&",e=e+`limit=${this.limit}`),this.page&&!t&&(e=e+"&",e=e+`page=${this.page}`),this.sortField&&(e=e+"&",e=e+`sort_field=${this.sortField}`),this.sortOrder&&(e=e+"&",e=e+`sort_order=${this.sortOrder}`),e}};var Dr=class{corners=null;cornersFirstHalf=null;cornersSecondHalf=null;cornersExtraTime=null;crosses=null;crossesFirstHalf=null;crossesSecondHalf=null;crossesExtraTime=null;offside=null;offsideFirstHalf=null;offsideSecondHalf=null;offsideExtraTime=null;shotsOn=null;shotsOnFirstHalf=null;shotsOnSecondHalf=null;shotsOnExtraTime=null;throwIn=null;throwInFirstHalf=null;throwInSecondHalf=null;throwInExtraTime=null;redCards=null;redCardsFirstHalf=null;redCardsSecondHalf=null;redCardsExtraTime=null;shotsOff=null;shotsOffFirstHalf=null;shotsOffSecondHalf=null;shotsOffExtraTime=null;goalKicks=null;goalKicksFirstHalf=null;goalKicksSecondHalf=null;goalKicksExtraTime=null;possession=null;possessionFirstHalf=null;possessionSecondHalf=null;possessionExtraTime=null;treatments=null;treatmentsFirstHalf=null;treatmentsSecondHalf=null;treatmentsExtraTime=null;yellowCards=null;yellowCardsFirstHalf=null;yellowCardsSecondHalf=null;yellowCardsExtraTime=null;shotsBlocked=null;shotsBlockedFirstHalf=null;shotsBlockedSecondHalf=null;shotsBlockedExtraTime=null;substitutions=null;substitutionsFirstHalf=null;substitutionsSecondHalf=null;substitutionsExtraTime=null;counterAttacks=null;counterAttacksFirstHalf=null;counterAttacksSecondHalf=null;counterAttacksExtraTime=null;foulsCommitted=null;foulsCommittedFirstHalf=null;foulsCommittedSecondHalf=null;foulsCommittedExtraTime=null};var Br=class{ftScore=null;htScore=null;aetScore=null;aggScore=null;penScore=null};var Le=class{homeTeam={players:[]};awayTeam={players:[]}};var Nr=class{minute="";type="";teamId="";player=null;relatedPlayer=null;updatedAt=""};var kr=class{playerId=null;position=null;minutesPlayed=null;yellowCards=null;redCards=null;goals=null;penaltyGoals=null;penaltyCommitted=null;penaltyWon=null;penaltyMissed=null;penaltySaved=null;penaltyReceived=null;ownGoals=null;assists=null;cleanSheets=null;shots=null;shotsOn=null;shotsBlocked=null;offsides=null;foulsCommitted=null;foulsWon=null;tackles=null;tacklesBlocks=null;tacklesInterceptions=null;concededGoals=null;caughtBall=null;saves=null;passes=null;crosses=null;interceptions=null;keyPasses=null;passesAccuracy=null;duels=null;duelsWon=null;dribblesAttempts=null;dribblesSuccess=null;dribblesPast=null;updatedAt=null};var Gr=class{id="";country=null;birthDate="";firstName="";lastName="";name="";position="";assets=null;isDeleted=!1;teams=[]};var Ur=class{id="";country=null;birthDate="";firstName="";lastName="";name="";position="";assets=null;isDeleted=!1;competitions=[];teams=[]};var Vr=class{id="";startDate="";endDate="";shirtNumber;loan=!1;position="";country=null;name="";assets=null;birthDate=""};var Hr=class{id="";country=null;birthDate="";firstName="";lastName="";name="";position="";assets=null};var Mi=class{countryId=null;scope=null;name=null;playerIds=null;limit=null;page=null;sortField=null;sortOrder=null;constructor(t){this.countryId=t.countryId?t.countryId:null,this.scope=t.scope?t.scope:null,this.name=t.name?t.name:null,this.playerIds=t.playerIds?t.playerIds:null,this.limit=t.limit?t.limit:null,this.page=t.page?t.page:null,this.sortField=t.sortField?t.sortField:null,this.sortOrder=t.sortOrder?t.sortOrder:null}constructFilterUrl=()=>{let t="";return this.countryId&&(t=t+"&",t=t+`country_id=${this.countryId}`),this.scope&&this.scope.length>0&&(t=t+"&",t=t+`scope=${this.scope.join(",")}`),this.name&&(t=t+"&",t=t+`name=${this.name}`),this.playerIds&&this.playerIds.length>0&&(t=t+"&",t=t+`player_ids=${this.playerIds.join(",")}`),this.limit&&(t=t+"&",t=t+`limit=${this.limit}`),this.page&&(t=t+"&",t=t+`page=${this.page}`),this.sortField&&(t=t+"&",t=t+`sort_field=${this.sortField}`),this.sortOrder&&(t=t+"&",t=t+`sort_order=${this.sortOrder}`),t}};var Fp=class{headshot=null};var Cp=class{id=null;name=null;country=null};var $r=class{id="";name="";position="";shirtNumber;assets=null;type=""};var Wr=class{id="";country=null;gender="";assets=null;name="";code="";national=!1;undecided=!1;fullName="";shortName="";isDeleted=!1};var qr=class{primary=null;secondary=null;tertiary=null};var zr=class{id="";country=null;gender="";assets=null;name="";competitions=[];code="";national=!1;fullName="";shortName="";isDeleted=!1;undecided=!1;colors=new qr;squad=[]};var vp=class{teamId=null;matches=[]};var Qr=class{teams=null;players=null;competitions=null};var Kr=class{entities=null;query=null;scope=null;constructor(t){this.entities=t.entities?t.entities:null,this.query=t.query?t.query:null,this.scope=t.scope?t.scope:null}constructFilterUrl=()=>{let t="";return this.entities&&(t=t+"&",t=t+`entities=${this.entities.join(",")}`),this.query&&(t=t+"&",t=t+`q=${this.query}`),this.scope&&(t=t+"&",t=t+`scope=${this.scope.join(",")}`),t}};var $t=class{meta=new B;data=[]};var Ap=class{logo=null};var Op=class{profile=null;football=null;predictor=null;loyalty=null;topX=null;matchQuiz=null;activity=null;miniGames=null;discussions=null;privateLeagues=null;challenges=null;progress=null;voting=null;fantasy=null;helpers=null;idMapping=null;bracketGame=null;lists=null;standingGame=null;odds=null;getVersion=null};var Lp=class{apiKey;clientId;environment;idSchema;lang;errorHandlingMode;oddClient;cookieToken;authProvider};var Y=class{main=null;cover=null;mobile=null};var jr=class{colors=null;urls=null;images=null};var Yr=class{primaryColor=null;secondaryColor=null;contentColor=null;backgroundColor=null;borderColor=null;additionalColor=null};var Xr=class{primaryUrl=null;secondaryUrl=null;privacyPolicyUrl=null;termsAndConditionsUrl=null;additionalUrl=null};var Jr=class{mainLogo=null;mobileLogo=null;backgroundImage=null;mobileBackgroundImage=null;additionalImage=null};var xp=class{preferenceId="";categories=[];source=""};var Zr=class{input=null;output=null};var to=class{meta=new Zr;data=[]};var eo=class{limit=null;page=null;constructor(t){this.limit=t&&t.limit?t.limit:null,this.page=t&&t.page?t.page:null}constructFiltersUrl=()=>{let t="";return this.limit&&(t+=`&limit=${this.limit}`),this.page&&(t+=`&page=${this.page}`),t}};var io=class{general;predictor;topX;matchQuiz};var ao=class{predictor;topX;matchQuiz;games;football;classicQuizzes;eitherOr;discussions;potm;poll};var Dp=class extends _e{};var Bp=class{count=0;breakdown=[]};var Np=class{footballCompetitions;footballTeams;footballPlayers};var ro=class{market;fromDate;toDate;usersCount;minimumPredictions;constructor(t){this.market=t.market?t.market:null,this.fromDate=t.fromDate?t.fromDate:null,this.toDate=t.toDate?t.toDate:null,this.usersCount=t.usersCount?t.usersCount:null,this.minimumPredictions=t.minimumPredictions?t.minimumPredictions:null}constructFiltersUrl(){let t="";return this.market&&(t+="&",t+=`market=${this.market}`),this.fromDate&&(t+="&",t+=`from_date=${this.fromDate}`),this.toDate&&(t+="&",t+=`to_date=${this.toDate}`),this.usersCount&&(t+="&",t+=`users_count=${this.usersCount}`),this.minimumPredictions&&(t+="&",t+=`minimum_predictions=${this.minimumPredictions}`),t}};var oo=class{templateId=null;limit=null;page=null;groupId=null;constructor(t){this.templateId=t?.templateId||null,this.limit=t?.limit||null,this.page=t?.page||null,t?.groupId!==void 0&&console.warn("Warning: groupId property is deprecated and no longer supported by the API. This property will be removed in a future version. Please update your code accordingly.")}constructFiltersUrl(){let t="";return this.templateId&&(t+=`&template_id=${this.templateId}`),this.limit&&(t+=`&limit=${this.limit}`),this.page&&(t+=`&page=${this.page}`),t}};var so=class{groupId=null;limit=null;page=null;constructor(t){this.groupId=t.groupId?t.groupId:null,this.limit=t.limit?t.limit:null,this.page=t.page?t.page:null}constructFiltersUrl(){let t="";return this.groupId&&(t+="&",t+=`group_id=${this.groupId}`),this.limit&&(t+="&",t+=`limit=${this.limit}`),this.page&&(t+="&",t+=`page=${this.page}`),t}};var no=class{sortOrder=null;rankType=null;leaderboardIds=null;gameType=null;limit=null;page=null;groupId=null;constructor(t){this.sortOrder=t.sortOrder,this.rankType=t.rankType,this.leaderboardIds=t.leaderboardIds,this.gameType=t.type&&t.type.toLowerCase()==="game"?t.gameType:null,this.limit=t.limit,this.page=t.page,t?.groupId!==void 0&&console.warn("Warning: groupId property is deprecated and no longer supported by the API. This property will be removed in a future version. Please update your code accordingly.")}constructFiltersUrl=()=>{let t="";return this.sortOrder&&(t+="&",t+=`sort_order=${this.sortOrder}`),this.rankType&&(t+="&",t+=`rank_type=${this.rankType}`),this.leaderboardIds&&(t+="&",t+=`type_ids=${this.leaderboardIds.join(",")}`),this.gameType&&(t+="&",t+=`game_type=${this.gameType}`),this.limit&&(t+="&",t+=`limit=${this.limit}`),this.page&&(t+="&",t+=`page=${this.page}`),t}};var lo=class{flags=null;status=null;type=null;activeFrom=null;activeTo=null;createdFrom=null;createdTo=null;updatedFrom=null;updatedTo=null;constructor(t){this.flags=t.flags?t.flags:null,this.status=t.status?t.status:null,this.type=t.type?t.type:null,this.activeFrom=t.activeFrom?t.activeFrom:null,this.activeTo=t.activeTo?t.activeTo:null,this.createdFrom=t.createdFrom?t.createdFrom:null,this.createdTo=t.createdTo?t.createdTo:null,this.updatedFrom=t.updatedFrom?t.updatedFrom:null,this.updatedTo=t.updatedTo?t.updatedTo:null}constructFiltersUrl(){let t="";return this.flags&&this.flags.length>0&&(t+="&",t+=`flags=${this.flags.join(",")}`),this.status&&(t+="&",t+=`status=${this.status}`),this.type&&(t+="&",t+=`type=${this.type}`),this.activeFrom&&(t+="&",t+=`active_from=${this.activeFrom}`),this.activeTo&&(t+="&",t+=`active_to=${this.activeTo}`),this.createdFrom&&(t+="&",t+=`created_from=${this.createdFrom}`),this.createdTo&&(t+="&",t+=`created_to=${this.createdTo}`),this.updatedFrom&&(t+="&",t+=`updated_from=${this.updatedFrom}`),this.updatedTo&&(t+="&",t+=`updated_to=${this.updatedTo}`),t}};var po=class{position=null;points=null;predictionsMade=null;profileId=null;profileModel=null;successRatePercent=null};var xe=class{templateId=null;privateLeagueId=null;fromDate=null;toDate=null;pagination=new Q};var kp=class{meta=new xe;data=[]};var Lt=class{rankType=null;fromDate=null;toDate=null;pagination=new Q};var Gp=class{meta=new Lt;data=[]};var De=class{position=null;profileId=null;profileModel=null;points=null;predictionsMade=null};var co=class{flags="";status="";type="";activeFrom="";activeTo="";createdFrom="";createdTo="";updatedFrom="";updatedTo=""};var uo=class{pagination=new Q;filters=new co};var Up=class{id=null;points=null};var Vp=class extends ge{points;alternative;constructor(){super(),delete this.weight}};var mo=class extends De{id=null;rankType=null;model=null;gameType=null};var Hp=class{meta=new Lt;data=[]};var ho=class{groupId;averagePoints;highestPoints};var xt=class{id=null;name=null;description=null;type=null;fromDate=null;toDate=null;markets=[];teamIds=[];matchIds=[];groups=[];gameIds=[];gameTypes=[];competitionIds=[];excludedProfileIds=[];rules=null;labels=null;customFields=null;branding=null;flags=null;images=new Y;status=null;automaticallyChangeStatus=!0;createdAt=null;updatedAt=null;related=null};var fo=class extends xt{adContent=null};var go=class{groupId=null;label=null;flags=[];filters=null};var yo=class{fromDate=null;toDate=null;matchIds=[]};var $p=class{enabled=!1;id=null;label=null;points=null};var bo=class{value=null;target=null;playerId=null;playerModel=null;result=null};var Mo=class{matchId=null;matchType=null;market=null;matchModel=null;matchStatus=new j;prediction=new bo};var Io=class{gameId=null;results=null;tieBreakers=null};var ft=class{timeTiebreaker=!1};var _t=class{id=null;title=null;description=null;type=null;status=null;authRequirement=null;outcome=null;predictionsCutoff=null;fixtures=[];tiebreaker=new ft;predictionId=null;participantsCount=0;related=[];excludedProfileIds=null;rules=null;flags=null;points=null;createdAt=null;updatedAt=null;predictionsMadeAt=null;predictionsUpdatedAt=null;images=null;scheduleOpenAt=null;branding=null};var Be=class{id=null;title=null;alternativeTitle=null;description=null;type=null;images=new Y;participationCount=null;questionsCount=null;status=null;language=null;authRequirement=null;flags=null;customFields=null;labels=null;branding=null;related=[];time=null;points=null;scored=!1;maxAttempts=null;averageScore=null;perfectScore=null;adContent=null;context=null;createdAt=null;updatedAt=null};var Ne=class extends P{flags=null;status=null;entityIds=null;entityType=null;sort=null;groupByStatus=null;language=null;constructor(t){super(t),this.flags=t&&t.flags?t.flags:null,this.status=t&&t.status?t.status:null,this.entityIds=t&&t.entityIds?t.entityIds:null,this.entityType=t&&t.entityType?t.entityType:null,this.sort=t&&t.sort?t.sort:null,this.groupByStatus=t&&t.groupByStatus!==void 0?t.groupByStatus:null,this.language=t&&t.language?t.language:null}constructMainFiltersUrl(){let t=super.constructMainFiltersUrl();return this.flags&&this.flags.length>0&&(t+=`&flags=${this.flags.join(",")}`),this.status&&(t+=`&status=${this.status}`),this.entityIds&&this.entityIds.length>0&&(t+=`&entity_ids=${this.entityIds}`),this.sort&&(t+=`&sort=${this.sort}`),this.groupByStatus!==null&&(t+=`&group_by_status=${this.groupByStatus}`),this.language!==null&&(t+=`&language=${this.language}`),t}};var wo=class extends Ne{classicQuizIds=null;constructor(t){super(t),this.classicQuizIds=t&&t.classicQuizIds?t.classicQuizIds:null}constructMainFiltersUrl(){let t=super.constructMainFiltersUrl();return this.classicQuizIds&&this.classicQuizIds.length>0&&(t+=`&classic_quiz_ids=${this.classicQuizIds.join(",")}`),t}};var _o=class extends Be{rules=null;questions=[]};var Po=class{questionId=null;question=null;images=null;embedCode=null;explanation=null;options=[]};var To=class{optionId=null;option=null;images=null;correct=null};var Wp=class{questionId=0;optionId=0};var Eo=class{classicQuizId=null;userId=null;questions=[];correctOptions=null;personalBest=null;points=null;attempts=null};var Ro=class{questionId=null;optionId=null;correct=null;correctOptionId=null};var So=class extends P{classicQuizIds=null;constructor(t){super(t),this.classicQuizIds=t?.classicQuizIds||null}constructMainFiltersUrl(){let t=super.constructMainFiltersUrl();return this.classicQuizIds&&this.classicQuizIds.length>0&&(t+=`&classic_quiz_ids=${this.classicQuizIds.join(",")}`),t}};var Fo=class{classicQuizId=null;classicQuizModel=null;correct=null;classicQuizQuestions=null;personalBest=null;points=null;answers=[]};var qp=class{meta=new w;data=[]};var Co=class{questionId=null;questionModel=null;wrong=null;correct=null;skipped=null;total=null};var ke=class{classicQuizIds=null};var Ge=class{limit=null;page=null;constructor(t){this.limit=t?.limit||null,this.page=t?.page||null}constructMainFiltersUrl(){let t="";return this.limit&&(t+=`&limit=${this.limit}`),this.page&&(t+=`&page=${this.page}`),t}};var vo=class extends Ge{classicQuizIds=null;constructor(t){super(t),this.classicQuizIds=t?.classicQuizIds||null}constructMainFiltersUrl(){let t=super.constructMainFiltersUrl();return this.classicQuizIds&&this.classicQuizIds.length>0&&(t+=`&classic_quiz_ids=${this.classicQuizIds.join(",")}`),t}};var Ue=class{pagination=new Q;filters=new ke};var Ao=class{position=null;profileId=null;profileModel=null;points=null};var Oo=class{position=null;classicQuizId=null;classicQuizModel=null;points=null};var zp=class{meta=new B;data=[]};var Qp=class{meta=new Ue;data=[]};var Ve=class{id="";title="";alternativeTitle="";description="";images=new Y;flags=[];status="";language="";authRequirement=null;winningCondition="";lives=0;time=0;points=[];customFields=null;branding=null;labels=null;adContent="";context=null;type="";related=[];totalParticipationsCount=0;totalUsersCount=0;finishedParticipationsCount=0;averageStartedParticipationsCount=0;averageFinishedParticipationsCount=0;createdAt="";updatedAt=""};var Lo=class extends Ne{eitherOrIds=null;constructor(t){super(t),this.eitherOrIds=t&&t.eitherOrIds?t.eitherOrIds:null}constructMainFiltersUrl(){let t=super.constructMainFiltersUrl();return this.eitherOrIds&&this.eitherOrIds.length>0&&(t+=`&either_or_ids=${this.eitherOrIds.join(",")}`),t}};var xo=class extends Ve{rules=""};var Do=class{correctSteps=0;score=0};var Kp=class{meta=new w;data=[]};var Bo=class{eitherOrId="";personalBest=0;betterThan=0};var No=class{instanceId="";eitherOrId="";gameStartedAt="";currentStep=0;currentStreak=0;remainingSteps=0;currentLives=0;currentPoints=0;personalBest=0;participationCount=0;finishedParticipationsCount=0;steps=[]};var ko=class{pair="";answer=""};var Go=class extends ko{expired=!1;time=0};var Uo=class{main;mobile};var Ii=class{id="";label="";images=new Uo;value=null};var Vo=class{pairId="";userSelection="";correct=null;played=null;timestamp="";optionOne=new Ii;optionTwo=new Ii};var Ho=class{rangeStartInclusive=0;rangeEndInclusive=0;totalUsers=0};var $o=class{standings=[];breakdown=[]};var Wo=class{userId="";userModel=null;personalBest=""};var He=class{content=null;tags=[];campaign=null};var $e=class{id=null;model=null;source=null;type=null};var qo=class{questions=null;correctAnswers=null};var zo=class{id=null;name=null;url=null;assets=[];links=[];branding=null;eventUrls=[];stakesDisclaimer=null;domainName=null};var Qo=class{backgroundColor=null;textColor=null};var jp=class{appType=null;selectionTemplateUrl=null;eventTemplateUrl=null;homepageUrl=null};var Ko=class{logo=null;type=null;transparentBackgroundUrl=null;backgroundColor=null};var jo=class{url=null;appType=null};var Mc=(i=>(i.PRE_EVENT="PRE_EVENT",i.LIVE="LIVE",i.ALL="ALL",i))(Mc||{}),Ic=(e=>(e.ORDINARY_TIME="ORDINARY_TIME",e.FULL_TIME="FULL_TIME",e))(Ic||{}),wc=(i=>(i.DECIMAL="DECIMAL",i.MONEYLINE="MONEYLINE",i.FRACTIONAL="FRACTIONAL",i))(wc||{});var _c=(x=>(x.FT_1X2="FT_1X2",x.DOUBLE_CHANCE="DOUBLE_CHANCE",x.HT_FT="HT_FT",x.BOTH_TEAMS_SCORE="BOTH_TEAMS_SCORE",x.CORRECT_SCORE="CORRECT_SCORE",x.PLAYER_SCORE_FIRST_GOAL="PLAYER_SCORE_FIRST_GOAL",x.PLAYER_SCORE="PLAYER_SCORE",x.PLAYER_RED_CARD="PLAYER_RED_CARD",x.PLAYER_YELLOW_CARD="PLAYER_YELLOW_CARD",x.OVER_GOALS_0_5="OVER_GOALS_0_5",x.OVER_GOALS_1_5="OVER_GOALS_1_5",x.OVER_GOALS_2_5="OVER_GOALS_2_5",x.OVER_GOALS_3_5="OVER_GOALS_3_5",x.OVER_GOALS_4_5="OVER_GOALS_4_5",x.OVER_GOALS_5_5="OVER_GOALS_5_5",x))(_c||{}),kd={["FT_1X2"]:"1x2",["DOUBLE_CHANCE"]:"DOUBLE_CHANCE",["HT_FT"]:"FIRST_HALF_AND_FINAL_RESULT",["BOTH_TEAMS_SCORE"]:"BOTH_TO_SCORE",["CORRECT_SCORE"]:"CORRECT_SCORE",["PLAYER_SCORE_FIRST_GOAL"]:"FIRST_PLAYER_TO_SCORE",["PLAYER_SCORE"]:"PLAYER_TO_SCORE_DURING_GAME",["PLAYER_RED_CARD"]:"PLAYER_TO_RECEIVE_CARD",["PLAYER_YELLOW_CARD"]:"PLAYER_TO_RECEIVE_CARD"},Yo=class{oddType="PRE_EVENT";scopeType="ORDINARY_TIME";oddFormat="DECIMAL";marketTypes=["FT_1X2"];constructor(t){this.validateFilters(t)}constructFiltersUrl(){let t=this.marketTypes.map(e=>this.mapToSportal365Market(e));return`&odd_type=${this.oddType}&scope_type=${this.scopeType}&odd_format=${this.oddFormat}&market_types=${t.join(",")}`}validateFilters(t){let e=Object.values(Mc),i=Object.values(Ic),a=Object.values(wc),r=Object.values(_c);t?.oddType&&(e.includes(t.oddType)?this.oddType=t.oddType:console.warn(`The filter "oddType" is NOT valid and therefore it will be set to PRE_EVENT. The VALID values are : ${e.join(", ")}`)),t?.scopeType&&(i.includes(t.scopeType)?this.scopeType=t.scopeType:console.warn(`The filter "scopeType" is NOT valid and therefore it will be set to ORDINARY_TIME. The VALID values are : ${i.join(", ")}`)),t?.oddFormat&&(a.includes(t.oddFormat)?this.oddFormat=t.oddFormat:console.warn(`The filter "oddFormat" is NOT valid and therefore it will be set to DECIMAL. The VALID values are : ${a.join(", ")}`)),t?.marketTypes&&Array.isArray(t?.marketTypes)&&t?.marketTypes.length>0&&(t.marketTypes.every(o=>r.includes(o))?this.marketTypes=t.marketTypes:console.warn(`The filter "marketTypes" is NOT valid and therefore it will be set to FT_1X2. The VALID values are : ${r.join(", ")}`))}mapToSportal365Market(t){return t.startsWith("OVER_GOALS_")?"OVER_UNDER":kd[t]}};var Xo=class{type=null;scope=null;selections=[]};var Jo=class{id=null;type=null;name=null;entityType=null};var Zo=class{id=null;name=null;code=null;value=null;odds=null;urls=[];movement=null;oddsOld=null;entityType=null;additionalInfo=null;providerInfo=null};var ts=class{id=null;name=null;code=null;entityType=null};var es=class{selectionId=null;eventId=null;marketId=null;competitionId=null};var is=class{bookmaker=null;type=null;markets=[]};var Yp=class{main=null;all=null};var as=class{value=null;playerId=null;playerModel=null;playerRole};var We=class{market=null;matchId=null;matchType=null;matchModel=null;prediction=new as;result=null};var qe=class{settledAt=null;resettledAt=null;status=null;outcome=null;points=0};var rt=class{value=!1};var rs=class{matchId=null;market="BOTH_TEAMS_SCORE";matchType="FOOTBALL";prediction=null;constructor(t,e){this.matchId=t,this.prediction=new rt,this.prediction.value=e}};var os=class{value};var ss=class{matchId=null;market="CORNERS_MATCH";matchType="FOOTBALL";prediction=null;constructor(t,e){this.matchId=t,this.prediction=new os,this.prediction.value=e}};var ns=class{value=null};var Dt=class{matchId=null;market=null;matchType="FOOTBALL";prediction=null;constructor(t,e,i){this.matchId=t,this.market=e,this.prediction=new ns,this.prediction.value=i}};var ls=class{value=null};var ps=class{matchId=null;market="DOUBLE_CHANCE";matchType="FOOTBALL";prediction=null;constructor(t,e){this.matchId=t,this.prediction=new ls,this.prediction.value=e}};var cs=class{value=null};var ds=class{matchId=null;market="HT_FT";matchType="FOOTBALL";prediction=null;constructor(t,e){this.matchId=t,this.prediction=new cs,this.prediction.value=e}};var us=class{value=null};var ms=class{matchId=null;market=null;matchType="FOOTBALL";prediction=null;constructor(t,e,i){this.matchId=t,this.market=e,this.prediction=new us,this.prediction.value=i}};var ze=class{matchId=null;market=null;matchType="FOOTBALL";prediction=null;constructor(t,e,i){this.matchId=t,this.market=e,this.prediction=new rt,this.prediction.value=i}};var Qe=class{matchId=null;market=null;matchType="FOOTBALL";prediction=null;constructor(t,e,i){this.matchId=t,this.market=e,this.prediction=new rt,this.prediction.value=i}};var hs=class{matchId=null;market="PENALTY_MATCH";matchType="FOOTBALL";prediction=null;constructor(t,e){this.matchId=t,this.prediction=new rt,this.prediction.value=e}};var fs=class{value=!1;playerId=null};var ot=class{matchId=null;market=null;matchType="FOOTBALL";prediction=null;constructor(t,e,i,a){this.matchId=t,this.market=e,this.prediction=new fs,this.prediction.value=i,this.prediction.playerId=a}};var gs=class{matchId=null;market="RED_CARD_MATCH";matchType="FOOTBALL";prediction=null;constructor(t,e){this.matchId=t,this.prediction=new rt,this.prediction.value=e}};var Xp=class{home=null;draw=null;away=null};var Jp=class{score=null;percentage=null};var Ke=class{homeGoals=null;awayGoals=null};var ys=class{playerId=null;playerModel=null};var bs=class{FT_1X2=null;HT_1X2=null;BOTH_TEAMS_SCORE=null;DOUBLE_CHANCE=null;HT_FT=null;RED_CARD_MATCH=null;PENALTY_MATCH=null;CORNERS_MATCH=null;PLAYER_YELLOW_CARD=[];PLAYER_RED_CARD=[];PLAYER_SCORE_FIRST_GOAL=new ys;PLAYER_SCORE=[];PLAYER_SCORE_TWICE=[];PLAYER_SCORE_HATTRICK=[];CORRECT_SCORE=new Ke;CORRECT_SCORE_ADVANCED=new Ke;CORRECT_SCORE_HT=new Ke;OVER_GOALS_0_5=null;OVER_GOALS_1_5=null;OVER_GOALS_2_5=null;OVER_GOALS_3_5=null;OVER_GOALS_4_5=null;OVER_GOALS_5_5=null;OVER_GOALS_6_5=null;OVER_CORNERS_6_5=null;OVER_CORNERS_7_5=null;OVER_CORNERS_8_5=null;OVER_CORNERS_9_5=null;OVER_CORNERS_10_5=null;OVER_CORNERS_11_5=null;OVER_CORNERS_12_5=null;OVER_CORNERS_13_5=null};var L=class{no=0;yes=0};var je=class{gameInstanceId=null;fixtures=null};var gt=class{goldenGoal=null};var wi=class{id=null;gameInstanceId=null;gameType=null;wager=null;totalFixtures=null;settledFixtures=null;userId=null;fixtures=[];status=null;tiebreaker=new gt;points=null;templateId=null;groupId=null;profileLastUpdatedAt=null;createdAt=null;updatedAt=null};var xn=(r=>(r.ACTIVE="ACTIVE",r.WON="WON",r.LOST="LOST",r.PARTIALLY_WON="PARTIALLY_WON",r.CANCELED="CANCELED",r))(xn||{}),Pc=["WON","LOST","PARTIALLY_WON","CANCELED"];var U=class{limit=null;startAfter=null;status=null;type=null;matchIds=null;gameIds=null;constructor(t){this.limit=t?.limit||null,this.startAfter=t?.startAfter||null,this.status=t?.status||null,this.type=t?.type||null,this.matchIds=t?.matchIds||null,this.gameIds=t?.gameIds||null}constructFiltersUrl=()=>{let t="",e=!1;return this.status&&(e=Object.values(xn).some(i=>this.status.includes(i))),this.limit&&(t+="&",t+=`limit=${this.limit}`),this.startAfter&&(t+="&",t+=`start_after=${this.startAfter}`),this.status&&e&&(t+="&",t+=`status=${this.status.join(",")}`),this.type&&(t+="&",t+=`game_types=${this.type}`),this.matchIds&&this.matchIds.length>0&&(t+="&",t+=`match_ids=${this.matchIds.join(",")}`),this.gameIds&&this.gameIds.length>0&&(t+="&",t+=`game_ids=${this.gameIds.join(",")}`),t}};var Ms=class{fullTimeOneXTwo={};halfTimeOneXTwo={};bothTeamsScore=new L;doubleChance={};halfTimeFullTime={};playerScore={};playerYellowCard={};playerRedCard={};redCardMatch=new L;penaltyMatch=new L;playerScoreFirstGoal={};cornersMatch={};correctScore={};correctScoreHalfTime={};correctScoreAdvanced={};playerScoreHattrick={};playerScoreTwice={};overZeroPointFiveGoals=new L;overOnePointFiveGoals=new L;overTwoPointFiveGoals=new L;overThreePointFiveGoals=new L;overFourPointFiveGoals=new L;overFivePointFiveGoals=new L;overSixPointFiveGoals=new L;overSixPointFiveCorners=new L;overSevenPointFiveCorners=new L;overEightPointFiveCorners=new L;overNinePointFiveCorners=new L;overTenPointFiveCorners=new L;overElevenPointFiveCorners=new L;overTwelvePointFiveCorners=new L;overThirteenPointFiveCorners=new L};var Is=class{matchId=null;matchType=null;predictions=null};var ws=class{profileId="";profileModel=null;leagueId="";leagueModel=null;message=""};var Zp=class{id=null;name=null;model=new xt};var Ye=class{id="";name="";description="";type="";banned=[];invites=[];administrators=[];membersCount=0;invitationCode="";templateId="";templateModel=null;pastTemplates=[];usersCanInviteUsers=!1;scoringStartsAt="";pinnedPosts=[]};var _s=class extends Ye{members=[]};var tc=class{name="";description="";invitationCode="";templateId="";usersCanInviteUsers=!1;administrators=[];scoringStartsAt=""};var ec=class{name="";description="";invitationCode="";templateId="";usersCanInviteUsers=!1;administrators=[];pinnedPosts=[];scoringStartsAt=""};var Ps=class{predictionId=null;predictionModel=null;profileId=null;profileModel=null};var ic=class{meta=new B;data=[]};var ac=class{meta=new w;data=[]};var Xe=class extends P{type=null;constructor(t){super(t),this.type=t&&t.type?t.type:null}constructMainFiltersUrl=()=>{let t=super.constructMainFiltersUrl();return this.type&&(t+=`&type=${this.type}`),t}};var Ts=class{type="PRIVATE";userRole=null;constructor(t){this.userRole=t?.userRole||null}constructFiltersUrl=()=>{let t=`&type=${this.type}`;return this.userRole&&(t+=`&user_role=${this.userRole}`),t}};var Es=class{limit=null;page=null;leagueId=null;templateId=null;sortOrder=null;constructor(t){this.limit=t&&t.limit?t.limit:null,this.page=t&&t.page?t.page:null,this.leagueId=t&&t.leagueId?t.leagueId:null,this.templateId=t&&t.templateId?t.templateId:null,this.sortOrder=t&&t.sortOrder?t.sortOrder:null}constructFiltersUrl=()=>{let t="";return this.limit&&(t+=`&limit=${this.limit}`),this.page&&(t+=`&page=${this.page}`),this.leagueId&&(t+=`&league_id=${this.leagueId}`),this.templateId&&(t+=`&template_id=${this.templateId}`),this.sortOrder&&(t+=`&sort_order=${this.sortOrder}`),t}};var Je=class extends P{reportsCount=null;constructor(t){super(t),this.reportsCount=t.reportsCount?t.reportsCount:null}constructMainFiltersUrl=()=>{let t=super.constructMainFiltersUrl();return this.reportsCount&&(t+=`&reports_count=${this.reportsCount}`),t}};var Ze=class{limit=null;page=null;profileIds=null;constructor(t){this.limit=t&&t.limit?t.limit:null,this.page=t&&t.page?t.page:null,this.profileIds=t&&t.profileIds?t.leagueId:null}constructFiltersUrl=()=>{let t="";return this.limit&&(t+=`&limit=${this.limit}`),this.page&&(t+=`&page=${this.page}`),this.profileIds&&(t+=`&profile_ids=${this.profileIds.join(",")}`),t}};var Rs=class{templateId="";templateModel=null;privateLeagueId="";privateLeagueModel=null;position="";points=0;type="private_league"};var Ss=class extends Se{type="PRIVATE"};var Fs=class extends Fe{type="PRIVATE"};var Cs=class{id="";source="";type="";favourite=!1};var vs=class extends Cs{model=null};var rc=class{firstName=null;lastName=null;fullName=null;email=null;gender=null;country=null;phoneCountryCode=null;phoneNumber=null;campaignId=null;campaignName=null;contentType=null;contentId=null;contentName=null;customFields=null};var As=class extends P{status=null;sortOrder=null;gameIds=null;constructor(t){super(t),this.status=t?.status||null,this.sortOrder=t?.sortOrder||null,this.gameIds=t?.gameIds||null}constructMainFiltersUrl(){let t=super.constructMainFiltersUrl();return this.status&&Object.values(At).includes(this.status)?(t+="&",t+=`status=${this.status}`):this.status!==null&&console.warn(`The filter 'status' has the following INVALID value: ${this.status}. It will be not passed as a query param in the URL. For more information visit our documentation.`),this.sortOrder&&(this.sortOrder==="asc"||this.sortOrder==="desc"||this.sortOrder==="ASC"||this.sortOrder==="DESC")?(t+="&",t+=`sort_order=${this.sortOrder}`):this.sortOrder!==null&&console.warn(`The filter 'sortOrder' has the following INVALID value: ${this.sortOrder}. It will be not passed as a query param in the URL. For more information visit our documentation.`),this.gameIds&&Array.isArray(this.gameIds)&&this.gameIds.length>0?(t+="&",t+=`game_ids=${this.gameIds.join(",")}`):this.gameIds!==null&&console.warn(`The filter 'gameIds' has the following INVALID value: ${this.gameIds}. It will be not passed as a query param in the URL. For more information visit our documentation.`),t}};var Os=class extends P{};var Ls=class{matchId=null;matchType=null;market=null;matchModel=null;matchStatus=new j};var xs=class{value=null;result=null};var Ds=class{matchId=null;matchType=null;market=null;matchModel=null;matchStatus=new j;prediction=new xs};var Pt=class{id=null;title=null;description=null;type=null;status=null;authRequirement=null;scheduleOpenAt=null;predictionsCutoff=null;fixtures=[];tiebreaker=new ft;participantsCount=0;related=[];excludedProfileIds=null;rules=null;labels=null;customFields=null;branding=null;flags=null;images=new Y;createdAt=null;updatedAt=null};var ti=class extends Pt{adContent=null};var Wt=class{userId=null;points=null;results=[];tiebreaker=null};var Bs=class{matchId=null;matchModel=null;outcome=null};var st=class extends P{status=null;type=null;gameIds=null;sortOrder=null;constructor(t){super(t),this.status=t?.status||null,this.type=t?.type||null,this.gameIds=t?.gameIds||null,this.sortOrder=t?.sortOrder||null}constructFiltersUrl=()=>{let t=super.constructMainFiltersUrl();return this.status&&Object.values(At).includes(this.status)&&(t+="&",t+=`status=${this.status}`),this.type&&(t+="&",t+=`type=${this.type}`),this.gameIds&&this.gameIds.length>0&&(t+="&",t+=`game_ids=${this.gameIds.join(",")}`),this.sortOrder&&(t+="&",t+=`sort_order=${this.sortOrder}`),t}};var Bt=class{id=null;title=null;description=null;type=null;status=null;authRequirement=null;outcome=null;predictionsCutoff=null;fixtures=[];tiebreaker=new ft;predictionId=null;participantsCount=0;related=[];excludedProfileIds=null;rules=null;flags=null;points=null;createdAt=null;updatedAt=null;predictionsMadeAt=null;predictionsUpdatedAt=null;scheduleOpenAt=null;images=null;predictionTiebreaker=new gt;branding=null};var Ns=class{contestId="";contestType="GAME";contestModel=null;description="";userList=[]};var ks=class{position="";profileId="";profileModel=null;note="";tags=[]};var ei=class{gameInstanceId=null;fixtures=[];tiebreaker=null;constructor(t){this.gameInstanceId=t.gameInstanceId,t.fixtures.forEach(e=>this.fixtures.push(new Dt(e.matchId,e.market,e.prediction.value))),this.tiebreaker=t.tiebreaker?t.tiebreaker:null}};var ii=class extends P{flags=null;status=null;entityIds=null;entityType=null;pollIds=null;sortOrder=null;minVotes=null;language=null;constructor(t){super(t),this.flags=t?.flags||null,this.status=t?.status||null,this.entityIds=t?.entityIds||null,this.entityType=t?.entityType||null,this.pollIds=t?.pollIds||null,this.sortOrder=t?.sortOrder||null,this.minVotes=t&&t.minVotes!==void 0?t.minVotes:null,this.language=t?.language||null}constructMainFiltersUrl(){let t=super.constructMainFiltersUrl();return this.flags&&this.flags.length>0&&(t+=`&flags=${this.flags.join(",")}`),this.status&&(t+=`&status=${this.status}`),this.entityIds&&this.entityIds.length>0&&(t+=`&entity_ids=${this.entityIds.join(",")}`),this.pollIds&&this.pollIds.length>0&&(t+=`&poll_ids=${this.pollIds.join(",")}`),this.sortOrder&&(t+=`&sort_order=${this.sortOrder}`),this.minVotes&&(t+=`&min_votes=${this.minVotes}`),this.language&&(t+=`&language=${this.language}`),t}};var ai=class{id=null;title=null;alternativeTitle=null;description=null;type=null;images=new Y;status=null;language=null;authRequirement=null;totalVotes=null;flags=[];customFields=null;branding=null;embedCode=null;labels=null;adContent=null;context=null;options=[];related=[];preferencesEnabled=!1;multipleChoice=!1;maxMultipleChoiceOptions=null;participationCount=0;createdAt=null;updatedAt=null};var Gs=class extends ai{rules=null};var Us=class{id=null;title=null;description=null;images=new Y;votes=null;embedCode=null;preferencesMapping=[]};var Vs=class{preferenceId=""};var ri=class{id=null;pollId=null;optionId=null;optionIds=[];userId=null};var Hs=class extends ri{pollModel=null;optionModel=null;optionsModels=[]};var $s=class{meta=new w;data=[]};var Ws=class{meta=new w;data=[]};var qs=class extends P{matchIds=null;constructor(t){super(t),this.matchIds=t&&t.matchIds?t.matchIds:null}constructFiltersUrl(){let t=super.constructMainFiltersUrl();return this.matchIds&&this.matchIds.length>0&&(t+="&",t+=`match_ids=${this.matchIds.join(",")}`),t}};var zs=class{meta=new w;data=[]};var Qs=class{matchId=null;matchModel=null;playerId=null;playerModel=null;createdAt=null};var Ks=class{total};var js=class{meta=new Ks;data=[]};var Ys=class{teamId=null;teamModel=null;playerId=null;playerModel=null;votes=null;winner=null};var Xs=class{meta=new B;data=[]};var Dn=class{remapListContent=t=>{let e=new Xs;return e.meta=this.remapMeta(t.meta),e.data=t.data.map(i=>{let a=new Ja;return a.entityId=i.entity_id,a.entityType=i.entity_type,a}),e};remapMeta=t=>{let e=new B;return e.pagination.currentPage=t.pagination.current_page,e.pagination.itemsPerPage=t.pagination.items_per_page,e.pagination.totalItems=t.pagination.total_items,e.pagination.numberOfPages=t.pagination.number_of_pages,e}};var W=class extends C{featureConfigRemapper=null;listContentRemapper=null;localStorage=null;clientId=null;constructor(t){super(t,v(t.environment,"client")),this.clientId=t.clientId,this.localStorage=new pt().createLocalCacheInstance(t.idSchema),this.featureConfigRemapper=new Ln,this.listContentRemapper=new Dn}getConfig=async t=>{let e=await this.getCachedFeatures();if(!e){let i=`/clients/${this.clientId}/features`,a=this.apiSignInUrl.split("&")[0],r=i+a,o="There was a problem fetching client features from Client API";e=(await this.fetchWithoutAuth(r,o)).data,await this.localStorage.setClientFeatures(e)}switch(t){case"predictor":return this.featureConfigRemapper.remapPredictorConfig(e.predictor);case"topX":return this.featureConfigRemapper.remapTopXConfig(e.top_x);case"matchQuiz":return this.featureConfigRemapper.remapMatchQuizConfig(e.match_quiz);case"loyalty":return this.featureConfigRemapper.remapLoyaltyConfig(e.loyalty);case"discussions":return this.featureConfigRemapper.remapDiscussionsConfig(e.discussions);case"fantasy":return this.featureConfigRemapper.remapFantasyConfig(e.football_fantasy)}};getNewLoyaltyConfig=async t=>{let e=`/clients/${this.clientId}/features`,i=this.apiSignInUrl.split("&")[0],a="There was a problem fetching client features from Client API";if(t){let o=e+i+f(),n=await this.fetchWithoutAuthAdditionalHeaders(o,a,{"x-api-version":"2"});await this.localStorage.setClientFeatures(n.data)}let r=await this.getCachedFeatures();if(!r){let o=e+i;r=(await this.fetchWithoutAuthAdditionalHeaders(o,a,{"x-api-version":"2"})).data,await this.localStorage.setClientFeatures(r)}return this.featureConfigRemapper.remapLoyaltyNewConfig(r.loyalty)};getListContent=async(t,e,i)=>{let a=`/clients/${this.clientId}/lists/${t}/content${this.apiSignInUrl}`;e&&(a+=e.constructFiltersUrl()),g(i)&&(a+=f());let r="There was a problem fetching client list content",o=await this.fetchWithoutAuth(a,r);return this.listContentRemapper.remapListContent(o)};getCachedFeatures=async()=>{let t=await this.getLocalStorageData();if(!(!t||!Object.keys(t).length))return t.predictor.client_id&&t.predictor.client_id!==this.clientId?(await this.localStorage.deleteClientFeatures(),null):t};getLocalStorageData=async()=>{let t=Math.floor(Date.now()/1e3);return await this.localStorage.getExpiration("client","features")>t?await this.localStorage.getClientFeatures():null}};var Tt=class{clientHttps=null;errorHandlingMode=null;constructor(t){this.clientHttps=new W(t),this.errorHandlingMode=t.errorHandlingMode}setAvailableMarketsForMatch=async t=>{let{fullCoverageCompetitions:e,markets:i}=await this.clientHttps.getConfig("predictor");if(Array.isArray(t))return t.map(a=>this.setAvailableMarkets(a,e,i));if(typeof t=="object"&&Object.keys(t).length)return this.setAvailableMarkets(t,e,i)};setAvailableMarkets=(t,e,i)=>{let a=t.context.competition?.id;return a&&this.isMatchInCoverageCompetition(a,e)?(t.availableMarkets=i.all,t):(t.availableMarkets=i.main,t)};setMetaDataBatchRequest=(t,e,i)=>{let a=new B;if(a.pagination.totalItems=t,a.pagination.itemsPerPage=e,a.pagination.numberOfPages=t?Math.ceil(t/e):0,a.pagination.currentPage=i,a.pagination.numberOfPages>0&&i>a.pagination.numberOfPages)throw this.errorHandlingMode==="standard"?new m(400,"invalid_page_number","Invalid page number provided. Use number between 1 and max number of pages."):new y(400,"invalid_page_number","Invalid page number provided. Use number between 1 and max number of pages.");return a};finalizeMatchesDataBatchRequest=(t,e)=>{t=t.sort((a,r)=>new Date(a.kickoffAt).getTime()-new Date(r.kickoffAt).getTime());let i=e.limit||20;if(e.page){let a=e.page>1?i*(e.page-1):0;t=t.slice(a,a+i)}return!e.page&&t.length>i&&(t=t.slice(0,i)),t};isMatchInCoverageCompetition=(t,e)=>{let i=!1;return e.includes(t)&&(i=!0),i}};var Bn=class{footballService=null;https=null;idMapping=null;constructor(t,e,i){this.idMapping=i,this.https=e,this.footballService=new Tt(t)}getTeamsIdMapping=async(t,e)=>{try{let i=!1;if(t){if(t=new bi(t),t.countryId){let r=await this.idMapping.getEntityIdsBySchemaId([`${t.countryId}`],"country","native");r.country.length===0&&(i=!0),t.countryId=r.country[0]}if(t.scope){let r=await this.idMapping.getEntityIdsBySchemaId(t.scope,"competition","native");r.competition.length===0&&(i=!0),t.scope=r.competition}if(t.teamIds){let r=await this.idMapping.getEntityIdsBySchemaId(t.teamIds,"team","native");r.team.length===0&&(i=!0),t.teamIds=r.team}}if(i)return[];let a=await this.getTeams(t,e);return a.data=await this.idMapping.remapEntities(a.data,"team"),a}catch(i){throw console.warn("There was a problem browsing all teams",i),i}};getTeamsMapWithNativeIds=async t=>{let e=new Map,i=t.length,a=new bi({teamIds:t,limit:i}),{data:r}=await this.getTeams(a);r.sort((l,p)=>l.id.localeCompare(p.id));let o=hp(t),n=await this.idMapping.remapEntities(r,"team");return o.forEach((l,p)=>e.set(l,n[p])),e};getTeams=async(t,e)=>{try{return e=e||!1,await this.https.getTeams(t,e)}catch(i){throw console.warn("There was a problem retrieving all teams",i),i}};getTeamByIdIdMapping=async(t,e)=>{try{t=(await this.idMapping.getEntityIdsBySchemaId([t],"team","native")).team[0];let a=await this.getTeamById(t,e);return await this.idMapping.remapEntities(a,"team")}catch(i){throw console.warn(`There was a problem browsing the following team:${t}`,i),i}};getTeamById=async(t,e)=>{try{return e=e||!1,await this.https.getTeamById(t,e)}catch(i){throw console.warn(`There was a problem retrieving the following team: ${t}`,i),i}};getTopTeamsIdMapping=async t=>{try{let e=await this.getTopTeams(t);return await this.idMapping.remapEntities(e,"team")}catch(e){throw console.warn("There was a problem browsing the top teams",e),e}};getTopTeams=async t=>{try{return t=t||!1,await this.https.getTopTeams(t)}catch(e){throw console.warn("There was a problem retrieving the top teams",e),e}};getNextMatchForTeamIdMapping=async(t,e)=>{try{t=(await this.idMapping.getEntityIdsBySchemaId([t],"team","native")).team[0];let a=await this.getNextMatchForTeam(t,e);return await this.idMapping.remapEntities(a,"match")}catch(i){throw console.warn(`There was a problem browsing the next match for the following team:${t}`,i),i}};getNextMatchForTeam=async(t,e)=>{try{e=e||!1;let i=await this.https.getNextMatchForTeam(t,e);return await this.footballService.setAvailableMarketsForMatch(i)}catch(i){throw console.warn(`There was a problem retrieving the next match for the following team: ${t}`,i),i}};getPrevMatchForTeamIdMapping=async(t,e)=>{try{t=(await this.idMapping.getEntityIdsBySchemaId([t],"team","native")).team[0];let a=await this.getPrevMatchForTeam(t,e);return await this.idMapping.remapEntities(a,"match")}catch(i){throw console.warn(`There was a problem browsing the previous match for the following team:${t}`,i),i}};getPrevMatchForTeam=async(t,e)=>{try{e=e||!1;let i=await this.https.getPrevMatchForTeam(t,e);return await this.footballService.setAvailableMarketsForMatch(i)}catch(i){throw console.warn(`There was a problem retrieving the previous match for the following team: ${t}`,i),i}}};var qt=class{https=null;footballService=null;idMapping=null;constructor(t,e,i){this.idMapping=i,this.https=e,this.footballService=new Tt(t)}getPlayersIdMapping=async(t,e)=>{try{let i=!1;if(t){if(t=new Mi(t),t.countryId){let r=await this.idMapping.getEntityIdsBySchemaId([t.countryId],"country","native");r.country.length===0&&(i=!0),t.countryId=r.country[0]}if(t.playerIds){let r=await this.idMapping.getEntityIdsBySchemaId(t.playerIds,"player","native");r.player.length===0&&(i=!0),t.playerIds=r.player}if(t.scope){let r=await this.idMapping.getEntityIdsBySchemaId(t.scope,"competition","native");r.competition.length===0&&(i=!0),t.scope=r.competition}if(i)return[]}let a=await this.getPlayers(t,e);return a.data=await this.idMapping.remapEntities(a.data,"player"),a}catch(i){throw console.warn("There was a problem browsing the players",i),i}};getPlayersWithNativeIds=async t=>{let e=t.length,i=new Mi({playerIds:t,limit:e}),a=await this.getPlayers(i);return a.data.sort((r,o)=>r.id.localeCompare(o.id)),await this.idMapping.remapEntities(a.data,"player")};getPlayersMapWithNativeIds=async t=>{let e={},i=ie(t);i.sort((r,o)=>r.localeCompare(o));let a=await this.getPlayersWithNativeIds(Array.from(i));return i.forEach((r,o)=>e[r]=a[o]),e};getPlayers=async(t,e)=>{try{return e=e||!1,await this.https.getPlayers(t,e)}catch(i){throw console.warn("There was a problem retrieving the players",i),i}};getPlayerIdMapping=async(t,e)=>{try{let i=await this.idMapping.getEntityIdsBySchemaId([t],"player","native"),a=await this.getPlayerById(i.player[0],e);return await this.idMapping.remapEntities(a,"player")}catch(i){throw console.warn(`There was a problem browsing the following player:${t}`,i),i}};getPlayerById=async(t,e)=>{try{return e=e||!1,await this.https.getPlayerById(t,e)}catch(i){throw console.warn(`There was a problem retrieving the following player: ${t}`,i),i}};getTopPlayersIdMapping=async t=>{try{let e=await this.getTopPlayers(t);return await this.idMapping.remapEntities(e,"player")}catch(e){throw console.warn("There was a problem browsing the top players",e),e}};getTopPlayers=async t=>{try{return t=t||!1,await this.https.getTopPlayers(t)}catch(e){throw console.warn("There was a problem retrieving the top players",e),e}};getNextMatchForPlayerIdMapping=async(t,e)=>{try{t=(await this.idMapping.getEntityIdsBySchemaId([t],"player","native")).player[0];let a=await this.getNextMatchForPlayer(t,e);return await this.idMapping.remapEntities(a,"match")}catch(i){throw console.warn(`There was a problem browsing the next match for player:${t}`,i),i}};getNextMatchForPlayer=async(t,e)=>{try{e=e||!1;let i=await this.https.getNextMatchForPlayer(t,e);return await this.footballService.setAvailableMarketsForMatch(i)}catch(i){throw console.warn(`There was a problem retrieving the next match for player: ${t}`,i),i}};getPrevMatchForPlayerIdMapping=async(t,e)=>{try{t=(await this.idMapping.getEntityIdsBySchemaId([t],"player","native")).player[0];let a=await this.getPrevMatchForPlayer(t,e);return await this.idMapping.remapEntities(a,"match")}catch(i){throw console.warn(`There was a problem browsing the previous match for player:${t}`,i),i}};getPrevMatchForPlayer=async(t,e)=>{try{e=e||!1;let i=await this.https.getPrevMatchForPlayer(t,e);return await this.footballService.setAvailableMarketsForMatch(i)}catch(i){throw console.warn(`There was a problem retrieving the previous match for player: ${t}`,i),i}}};var zt=class{https=null;idMapping=null;footballService=null;constructor(t,e,i){this.https=e,this.idMapping=i,this.footballService=new Tt(t)}getMatchesIdMapping=async(t,e)=>{try{if(t){if(t=new ht(t),t.countryIds&&t.countryIds.length>0){let a=await this.idMapping.getEntityIdsBySchemaId(t.countryIds,"country","native");t.countryIds=a.country}if(t.competitionIds&&t.competitionIds.length>0){let a=await this.idMapping.getEntityIdsBySchemaId(t.competitionIds,"competition","native");t.competitionIds=a.competition}if(t.matchIds&&t.matchIds.length>0){let a=await this.idMapping.getEntityIdsBySchemaId(t.matchIds,"match","native");t.matchIds=a.match}if(t.teamIds&&t.teamIds.length>0){let a=await this.idMapping.getEntityIdsBySchemaId(t.teamIds,"team","native");t.teamIds=a.team}}let i=await this.getMatches(t,e);return i.data=await this.footballService.setAvailableMarketsForMatch([...i.data]),i.data=await this.idMapping.remapEntities(i.data,"match"),i}catch(i){throw console.warn("There was a problem browsing the matches",i),i}};getMatchesWithNativeIds=async t=>{let e=t.length,i=new ht({matchIds:t,limit:e}),a=await this.getMatches(i);return a.data.sort((r,o)=>r.id.localeCompare(o.id)),await this.idMapping.remapEntities(a.data,"match")};getMatchesMapWithNativeIds=async t=>{let e={},i=ie(t);i.sort((r,o)=>r.localeCompare(o));let a=await this.getMatchesWithNativeIds(Array.from(i));if(i.length!==a.length){let r=new ht({matchIds:i,limit:i.length}),o=await this.getMatches(r),n=i.filter(l=>{if(o.data.every(p=>p.id!==l))return l});i=i.filter(l=>{if(!n.includes(l))return l})}return i.forEach((r,o)=>e[r]=a[o]),e};getMatches=async(t,e)=>{try{return e=e||!1,await this.https.getMatches(t,e)}catch(i){throw console.warn("There was a problem retrieving the matches",i),i}};getMatchIdMapping=async(t,e)=>{try{let i=await this.idMapping.getEntityIdsBySchemaId([t],"match","native"),a=await this.getMatchById(i.match[0],e),r=await this.footballService.setAvailableMarketsForMatch(a);return await this.idMapping.remapEntities(r,"match")}catch(i){throw console.warn(`There was a problem browsing the following match: ${t}`,i),i}};getMatchById=async(t,e)=>{try{return e=e||!1,await this.https.getMatchById(t,e)}catch(i){throw console.warn(`There was a problem retrieving the following match: ${t}`,i),i}}};var Nn=class{https=null;idMapping=null;constructor(t,e){this.https=t,this.idMapping=e}searchIdMapping=async(t,e)=>{try{if(t=new Kr(t),t.scope){let a=await this.idMapping.getEntityIdsBySchemaId(t.scope,"competition","native");t.scope=a.competition}let i=await this.search(t,e);if(i.teams&&i.teams.length>0){let a=await this.idMapping.remapEntities(i.teams,"team");i.teams=a}if(i.players&&i.players.length>0){let a=await this.idMapping.remapEntities(i.players,"player");i.players=a}if(i.competitions&&i.competitions.length>0){let a=await this.idMapping.remapEntities(i.competitions,"competition");i.competitions=a}return i}catch(i){throw console.warn("There was a problem with browsing the search result",i),i}};search=async(t,e)=>{try{return await this.https.search(t,e)}catch(i){throw console.warn("There was a problem retrieving the search response",i),i}}};var J=class{errorHandlingModel=null;constructor(t){this.errorHandlingModel=t}throwException=(t,e,i)=>{throw this.errorHandlingModel==="standard"?new m(t,e,i):new y(t,e,i)}};var kn=class extends J{limit=50;constructor(t){super(t.errorHandlingMode)}validateTeamFormArguments=(t,e)=>{(!t||typeof t!="string")&&this.throwException(400,"invalid_team_id","Invalid team ID provided. Please provide a valid team ID."),e&&(e.competitionId&&typeof e.competitionId!="string"&&this.throwException(400,"invalid_competition_id","Invalid competition ID provided. Please provide a valid competition ID."),e.limit&&typeof e.limit!="number"&&this.throwException(400,"invalid_limit","Invalid limit type. The proper type is number."),e.limit&&e.limit>this.limit&&this.throwException(400,"invalid_limit","Invalid limit. The maximum limit is: "+this.limit.toString()))}};var _i=class{countriesFacade=null;competitionsFacade=null;teamsFacade=null;playerFacade=null;matchFacade=null;searchFacade=null;validator=null;constructor(t,e,i,a){this.countriesFacade=new An(e,i,a),this.competitionsFacade=new On(e,i,a),this.teamsFacade=new Bn(t,i,a),this.playerFacade=new qt(t,i,a),this.matchFacade=new zt(t,i,a),this.searchFacade=new Nn(i,a),this.validator=new kn(t)}getCountries=async t=>this.countriesFacade.getCountriesWithIdMapping(t);getCompetitions=async(t,e)=>this.competitionsFacade.getCompetitionsIdMapping(t,e);getCompetitionById=async(t,e)=>this.competitionsFacade.getCompetitionByIdIdMapping(t,e);getTopCompetitions=async t=>this.competitionsFacade.getTopCompetitionsIdMapping(t);getCompetitionsMapWithNativeIds=async t=>await this.competitionsFacade.getCompetitionsMapWithNativeIds(t);getTeams=async(t,e)=>this.teamsFacade.getTeamsIdMapping(t,e);getTeamById=async(t,e)=>this.teamsFacade.getTeamByIdIdMapping(t,e);getTopTeams=async t=>this.teamsFacade.getTopTeamsIdMapping(t);getNextMatchForTeam=async(t,e)=>this.teamsFacade.getNextMatchForTeamIdMapping(t,e);getPrevMatchForTeam=async(t,e)=>this.teamsFacade.getPrevMatchForTeamIdMapping(t,e);getTeamsMapWithNativeIds=async t=>await this.teamsFacade.getTeamsMapWithNativeIds(t);getPlayers=async(t,e)=>this.playerFacade.getPlayersIdMapping(t,e);getPlayerById=async(t,e)=>this.playerFacade.getPlayerIdMapping(t,e);getTopPlayers=async t=>this.playerFacade.getTopPlayersIdMapping(t);getNextMatchForPlayer=async(t,e)=>this.playerFacade.getNextMatchForPlayerIdMapping(t,e);getPrevMatchForPlayer=async(t,e)=>this.playerFacade.getPrevMatchForPlayerIdMapping(t,e);getPlayersMapWithNativeIds=async t=>this.playerFacade.getPlayersMapWithNativeIds(t);getMatches=async(t,e)=>this.matchFacade.getMatchesIdMapping(t,e);getMatchesMapWithNativeIds=async t=>this.matchFacade.getMatchesMapWithNativeIds(t);getMatchById=async(t,e)=>this.matchFacade.getMatchIdMapping(t,e);search=async(t,e)=>this.searchFacade.searchIdMapping(t,e);getTeamForm=async(t,e,i)=>{this.validator.validateTeamFormArguments(t,e);let a=e?.direction||"ltr",r={teamIds:[t],competitionIds:e&&e.competitionId?[e.competitionId]:null,status:"finished",limit:e?.limit||5,sortField:"date",sortOrder:"desc"},o=await this.matchFacade.getMatchesIdMapping(r,i),n={teamId:t,matches:[]};if(n.matches=o.data.map(l=>{let p=l.homeTeam.id===t,c=l.scores.ftScore.homeGoals??0,d=l.scores.ftScore.awayGoals??0,u;return p?u=c>d?"W":c<d?"L":"D":u=d>c?"W":d<c?"L":"D",{matchModel:l,isHomeGame:p,result:u}}),a==="ltr"){let l=Array.from(n.matches);n.matches=l.reverse()}return n}};var $=class{countriesFromResponse=t=>{if(t)return t.map(e=>this.countryFromResponse(e))};countryFromResponse=t=>{try{if(t){let e=new Or;return e.id=t.id,e.alias=t.alias,e.assets=t.assets,e.countryCode=t.country_code,e.name=t.name,e}}catch(e){throw e}return null}};var Z=class{countryRemapper=null;constructor(){this.countryRemapper=new $}fromResponse(t){try{let e=new vr;return e.id=t.id,e.country=this.countryRemapper.countryFromResponse(t.country),e.gender=t.gender,e.assets=t.assets,e.type=t.type,e.name=t.name,e}catch(e){throw console.warn("There was a problem remapping the competition response",e),e}}};var z=class{countryRemapper=null;constructor(){this.countryRemapper=new $}fromResponse(t){try{let e=new Wr;return e.id=t.id,e.country=this.countryRemapper.countryFromResponse(t.country),e.gender=t.gender,e.assets=t.assets,e.code=t.code,e.national=t.national,e.fullName=t.full_name,e.shortName=t.short_name,e.name=t.name,e.isDeleted=t.is_deleted,e.undecided=t.undecided,e}catch(e){throw console.warn("There was a problem remapping teams response",e),e}}};var Gn=class{countryRemapper=null;teamBasicRemapper=null;constructor(){this.countryRemapper=new $,this.teamBasicRemapper=new z}fromResponse(t){try{let e=new Ar;return e.id=t.id,e.country=this.countryRemapper.countryFromResponse(t.country),e.gender=t.gender,e.assets=t.assets,e.type=t.type,e.name=t.name,e.participants=t.participants.map(i=>this.teamBasicRemapper.fromResponse(i)),e}catch(e){throw console.warn("There was a problem remapping the competition response",e),e}}};var Un=class{countryRemapper=null;constructor(){this.countryRemapper=new $}fromResponse(t){try{let e=new Vr;return e.id=t.id,e.startDate=t.start_date,e.endDate=t.end_date,e.shirtNumber=t.shirt_number,e.loan=t.loan,e.position=t.position,e.country=this.countryRemapper.countryFromResponse(t.country),e.name=t.name,e.assets=t.assets,e.birthDate=t.birth_date,e}catch(e){throw console.warn("There was a problem remapping the player from squad",e),e}}};var Vn=class{countryRemapper=null;competitionRemapper=null;playerRemapper=null;constructor(){this.countryRemapper=new $,this.competitionRemapper=new Z,this.playerRemapper=new Un}fromResponse(t){try{let e=new zr;return e.id=t.id,e.country=this.countryRemapper.countryFromResponse(t.country),e.gender=t.gender,e.assets=t.assets,e.code=t.code,e.national=t.national,e.fullName=t.full_name,e.shortName=t.short_name,e.name=t.name,e.isDeleted=t.is_deleted,e.undecided=t.undecided,e.competitions=t.competitions?t.competitions.map(i=>this.competitionRemapper.fromResponse(i)):[],e.colors=t.colors?t.colors:e.colors,e.squad=t.squad?t.squad.map(i=>this.playerRemapper.fromResponse(i)):[],e}catch(e){throw console.warn("There was a problem remapping team response",e),e}}};var Pi=class{fromResponse(t){try{let e=new Br;return e.ftScore=this.statEntityFromResponse(t.ft_score),e.htScore=this.statEntityFromResponse(t.ht_score),e.aetScore=this.statEntityFromResponse(t.aet_score),e.aggScore=this.statEntityFromResponse(t.agg_score),e.penScore=this.statEntityFromResponse(t.pen_score),e}catch(e){throw console.warn("There was a problem remapping the scores",e),e}}statEntityFromResponse=t=>({homeGoals:t.home_goals,awayGoals:t.away_goals})};var Hn=class{teamRemapper=null;competitionRemapper=null;scoresRemapper=null;constructor(){this.teamRemapper=new z,this.competitionRemapper=new Z,this.scoresRemapper=new Pi}fromResponse(t){try{let e=new Lr;return e.id=t.id,e.kickoffAt=t.kickoff_at,e.finishedAt=t.finished_at,e.updatedAt=t.updated_at,e.isDeleted=t.is_deleted,e.undecided=t.undecided,e.homeTeam=this.teamRemapper.fromResponse(t.home_team),e.awayTeam=this.teamRemapper.fromResponse(t.away_team),e.lineupsConfirmed=t.lineups_confirmed,e.startedAt=t.started_at,e.minute=t.minute,e.scores=this.scoresRemapper.fromResponse(t.scores),e.context={competition:t.context.competition?this.competitionRemapper.fromResponse(t.context.competition):null},e.status={type:t.status.type,subType:t.status.sub_type},e}catch(e){throw console.warn("There was a problem remapping the match response",e),e}}};var $n=class{fromResponse(t){try{let e=new Dr;return e.corners=this.statEntityFromResponse(t.corners),e.cornersFirstHalf=this.statEntityFromResponse(t.corners_1h),e.cornersSecondHalf=this.statEntityFromResponse(t.corners_2h),e.cornersExtraTime=this.statEntityFromResponse(t.corners_et),e.crosses=this.statEntityFromResponse(t.crosses),e.crossesFirstHalf=this.statEntityFromResponse(t.crosses_1h),e.crossesSecondHalf=this.statEntityFromResponse(t.crosses_2h),e.crossesExtraTime=this.statEntityFromResponse(t.crosses_et),e.offside=this.statEntityFromResponse(t.offside),e.offsideFirstHalf=this.statEntityFromResponse(t.offside_1h),e.offsideSecondHalf=this.statEntityFromResponse(t.offside_2h),e.offsideExtraTime=this.statEntityFromResponse(t.offside_et),e.shotsOn=this.statEntityFromResponse(t.shots_on),e.shotsOnFirstHalf=this.statEntityFromResponse(t.shots_on_1h),e.shotsOnSecondHalf=this.statEntityFromResponse(t.shots_on_2h),e.shotsOnExtraTime=this.statEntityFromResponse(t.shots_on_et),e.throwIn=this.statEntityFromResponse(t.throw_in),e.throwInFirstHalf=this.statEntityFromResponse(t.throw_in_1h),e.throwInSecondHalf=this.statEntityFromResponse(t.throw_in_2h),e.throwInExtraTime=this.statEntityFromResponse(t.throw_in_et),e.redCards=this.statEntityFromResponse(t.red_cards),e.redCardsFirstHalf=this.statEntityFromResponse(t.red_cards_1h),e.redCardsSecondHalf=this.statEntityFromResponse(t.red_cards_2h),e.redCardsExtraTime=this.statEntityFromResponse(t.red_cards_et),e.shotsOff=this.statEntityFromResponse(t.shots_off),e.shotsOffFirstHalf=this.statEntityFromResponse(t.shots_off_1h),e.shotsOffSecondHalf=this.statEntityFromResponse(t.shots_off_2h),e.shotsOffExtraTime=this.statEntityFromResponse(t.shots_off_et),e.goalKicks=this.statEntityFromResponse(t.goal_kicks),e.goalKicksFirstHalf=this.statEntityFromResponse(t.goal_kicks_1h),e.goalKicksSecondHalf=this.statEntityFromResponse(t.goal_kicks_2h),e.goalKicksExtraTime=this.statEntityFromResponse(t.goal_kicks_et),e.possession=this.statEntityFromResponse(t.possession),e.possessionFirstHalf=this.statEntityFromResponse(t.possession_1h),e.possessionSecondHalf=this.statEntityFromResponse(t.possession_2h),e.possessionExtraTime=this.statEntityFromResponse(t.possession_et),e.treatments=this.statEntityFromResponse(t.treatments),e.treatmentsFirstHalf=this.statEntityFromResponse(t.treatments_1h),e.treatmentsSecondHalf=this.statEntityFromResponse(t.treatments_2h),e.treatmentsExtraTime=this.statEntityFromResponse(t.treatments_et),e.yellowCards=this.statEntityFromResponse(t.yellow_cards),e.yellowCardsFirstHalf=this.statEntityFromResponse(t.yellow_cards_1h),e.yellowCardsSecondHalf=this.statEntityFromResponse(t.yellow_cards_2h),e.yellowCardsExtraTime=this.statEntityFromResponse(t.yellow_cards_et),e.shotsBlocked=this.statEntityFromResponse(t.shots_blocked),e.shotsBlockedFirstHalf=this.statEntityFromResponse(t.shots_blocked_1h),e.shotsBlockedSecondHalf=this.statEntityFromResponse(t.shots_blocked_2h),e.shotsBlockedExtraTime=this.statEntityFromResponse(t.shots_blocked_et),e.substitutions=this.statEntityFromResponse(t.substitutions),e.substitutionsFirstHalf=this.statEntityFromResponse(t.substitutions_1h),e.substitutionsSecondHalf=this.statEntityFromResponse(t.substitutions_2h),e.substitutionsExtraTime=this.statEntityFromResponse(t.substitutions_et),e.counterAttacks=this.statEntityFromResponse(t.counter_attacks),e.counterAttacksFirstHalf=this.statEntityFromResponse(t.counter_attacks_1h),e.counterAttacksSecondHalf=this.statEntityFromResponse(t.counter_attacks_2h),e.counterAttacksExtraTime=this.statEntityFromResponse(t.counter_attacks_et),e.foulsCommitted=this.statEntityFromResponse(t.fouls_committed),e.foulsCommittedFirstHalf=this.statEntityFromResponse(t.fouls_committed_1h),e.foulsCommittedSecondHalf=this.statEntityFromResponse(t.fouls_committed_2h),e.foulsCommittedExtraTime=this.statEntityFromResponse(t.fouls_committed_et),e}catch(e){throw console.warn("There was a problem remapping the stats",e),e}}statEntityFromResponse=t=>({homeTeam:t?t.home_team:null,awayTeam:t?t.away_team:null})};var Ti=class{fromResponse(t){try{let e=new $r;return e.id=t.id,e.name=t.name,e.position=t.position,e.shirtNumber=t.shirt_number,e.assets=t.assets,e.type=t.type,e}catch(e){throw console.warn("There was a problem remapping the player from timeline",e),e}}};var Wn=class{playerRemapper=null;constructor(){this.playerRemapper=new Ti}fromResponse(t){try{let e=new Le;return e.homeTeam.players=t.home_team&&t.home_team.players?t.home_team.players.map(i=>this.playerRemapper.fromResponse(i)):[],e.awayTeam.players=t.away_team&&t.away_team.players?t.away_team.players.map(i=>this.playerRemapper.fromResponse(i)):[],e}catch(e){throw console.warn("There was a problem remapping the lineups",e),e}}};var qn=class{playerRemapper=null;constructor(){this.playerRemapper=new Ti}fromResponse(t){try{let e=new Nr;return e.minute=t.minute,e.type=t.type,e.teamId=t.team_id,e.player=this.playerRemapper.fromResponse(t.player),e.relatedPlayer=t.related_player?this.playerRemapper.fromResponse(t.related_player):null,e.updatedAt=t.updated_at,e}catch(e){throw console.warn("There was a problem remapping timeline",e),e}}};var zn=class{fromResponse(t){try{let e=new kr;return e.playerId=t.player_id,e.position=t.position,e.minutesPlayed=t.minutes_played,e.yellowCards=t.yellow_cards,e.redCards=t.red_cards,e.goals=t.goals,e.penaltyGoals=t.penalty_goals,e.penaltyCommitted=t.penalty_committed,e.penaltyWon=t.penalty_won,e.penaltyMissed=t.penalty_missed,e.penaltySaved=t.penalty_saved,e.penaltyReceived=t.penalty_received,e.ownGoals=t.own_goals,e.assists=t.assists,e.cleanSheets=t.clean_sheets,e.shots=t.shots,e.shotsOn=t.shots_on,e.shotsBlocked=t.shots_blocked,e.offsides=t.offsides,e.foulsCommitted=t.fouls_committed,e.foulsWon=t.fouls_won,e.tackles=t.tackles,e.tacklesBlocks=t.tackles_blocks,e.tacklesInterceptions=t.tackles_interceptions,e.concededGoals=t.conceded_goals,e.caughtBall=t.caught_ball,e.saves=t.saves,e.passes=t.passes,e.crosses=t.crosses,e.interceptions=t.interceptions,e.keyPasses=t.key_passes,e.passesAccuracy=t.passes_accuracy,e.duels=t.duels,e.duelsWon=t.duels_won,e.dribblesAttempts=t.dribbles_attempts,e.dribblesSuccess=t.dribbles_success,e.dribblesPast=t.dribbles_past,e.updatedAt=t.updated_at,e}catch(e){throw console.warn("There was a problem remapping the player stats",e),e}}};var Qn=class{teamMapper=null;competitionsMapper=null;lineupsMapper=null;scoresMapper=null;statsMapper=null;timelineMapper=null;playerStatsMapper=null;constructor(){this.teamMapper=new z,this.competitionsMapper=new Z,this.lineupsMapper=new Wn,this.scoresMapper=new Pi,this.statsMapper=new $n,this.timelineMapper=new qn,this.playerStatsMapper=new zn}fromResponse(t){try{let e=new xr;return e.id=t.id,e.kickoffAt=t.kickoff_at,e.finishedAt=t.finished_at,e.updatedAt=t.updated_at,e.isDeleted=t.is_deleted,e.undecided=t.undecided,e.homeTeam=t.home_team?this.teamMapper.fromResponse(t.home_team):null,e.awayTeam=t.away_team?this.teamMapper.fromResponse(t.away_team):null,e.lineupsConfirmed=t.lineups_confirmed,e.startedAt=t.started_at,e.minute=t.minute,e.scores=this.scoresMapper.fromResponse(t.scores),e.stats=this.statsMapper.fromResponse(t.stats),e.playerStats=t.player_stats?t.player_stats.map(i=>this.playerStatsMapper.fromResponse(i)):t.player_stats,e.context={competition:this.competitionsMapper.fromResponse(t.context.competition)},e.timeline=t.timeline?t.timeline.map(i=>this.timelineMapper.fromResponse(i)):[],e.status={type:t.status.type,subType:t.status.sub_type},e.lineups=t.lineups?this.lineupsMapper.fromResponse(t.lineups):new Le,e}catch(e){throw console.warn("There was a problem remapping the match response",e),e}}};var Kn=class{countryRemapper=null;constructor(){this.countryRemapper=new $}fromResponse(t){try{let e=new Hr;return e.id=t.id,e.firstName=t.first_name?t.first_name:null,e.lastName=t.last_name?t.last_name:null,e.name=t.name?t.name:null,e.birthDate=t.birth_date,e.country=this.countryRemapper.countryFromResponse(t.country),e.assets=t.assets,e.position=t.position,e}catch(e){throw console.warn("There was a problem remapping top player response",e),e}}};var Ei=class{countryRemapper=null;teamRemapper=null;constructor(){this.countryRemapper=new $,this.teamRemapper=new z}fromResponse(t){try{let e=new Gr;return e.id=t.id,e.firstName=t.first_name?t.first_name:null,e.lastName=t.last_name?t.last_name:null,e.name=t.name?t.name:null,e.birthDate=t.birth_date,e.country=this.countryRemapper.countryFromResponse(t.country),e.assets=t.assets,e.teams=t.teams?t.teams.map(i=>this.teamRemapper.fromResponse(i)):[],e.position=t.position,e.isDeleted=t.is_deleted,e}catch(e){throw console.warn("There was a problem remapping players response",e),e}}};var jn=class{countryRemapper=null;teamRemapper=null;competitionRemapper=null;constructor(){this.countryRemapper=new $,this.teamRemapper=new z,this.competitionRemapper=new Z}fromResponse(t){try{let e=new Ur;return e.id=t.id,e.firstName=t.first_name?t.first_name:null,e.lastName=t.last_name?t.last_name:null,e.name=t.name?t.name:null,e.birthDate=t.birth_date,e.country=this.countryRemapper.countryFromResponse(t.country),e.assets=t.assets,e.teams=t.teams?t.teams.map(i=>this.teamRemapper.fromResponse(i)):[],e.position=t.position,e.isDeleted=t.is_deleted,e.competitions=t.competitions?t.competitions.map(i=>this.competitionRemapper.fromResponse(i)):[],e}catch(e){throw console.warn("There was a problem remapping player response",e),e}}};var Yn=class{teamRemapper=null;playerRemapper=null;competitionremapper=null;constructor(){this.teamRemapper=new z,this.playerRemapper=new Ei,this.competitionremapper=new Z}fromResponse(t){try{let e=new Qr;return e.teams=t.teams?t.teams.map(i=>this.teamRemapper.fromResponse(i)):[],e.players=t.players?t.players.map(i=>this.playerRemapper.fromResponse(i)):[],e.competitions=t.competitions?t.competitions.map(i=>this.competitionremapper.fromResponse(i)):[],e}catch(e){throw console.warn("There was a problem remapping search response",e),e}}};var Xn=class{remapMetaProp=t=>{let e=new B;return e.pagination.currentPage=t.pagination.current_page,e.pagination.itemsPerPage=t.pagination.items_per_page,e.pagination.totalItems=t.pagination.total_items,e.pagination.numberOfPages=t.pagination.number_of_pages,e}};var Jn=class{remapPlayersPoints=t=>{let e=new Sr;return e.meta.filters.templateId=t.meta.filters.template_id,e.data=t.data.map(i=>this.remapPlayersPointsData(i)),e};remapPlayersPointsData=t=>{let e=new Cr;return e.playerId=t.player_id,e.points=t.points,e.rank=t.rank,e};remapPlayerDetailedStats=t=>{let e=new Pr;return e.meta.filters.templateId=t.meta.filters.template_id,e.meta.filters.playerId=t.meta.filters.player_id,e.data=t.data.map(i=>this.remapPlayerDetailedData(i)),e};remapPlayerDetailedData=t=>{let e=new Fr;return e.matchId=t.match_id,e.points=t.points?this.remapPlayerDetailedPoints(t.points):null,e.stats=t.stats?this.remapPlayerDetailedStatsData(t.stats):null,e};remapPlayerDetailedPoints=t=>{let e=new Ae;return e.total=t.total,e.minutesPlayed=t.minutes_played,e.yellowCards=t.yellow_cards,e.redCards=t.red_cards,e.goals=t.goals,e.penaltyGoals=t.penalty_goals,e.ownGoals=t.own_goals,e.assists=t.assists,e.cleanSheets=t.clean_sheets,e.shots=t.shots,e.shotsOn=t.shots_on,e.offsides=t.offsides,e.foulsCommitted=t.fouls_committed,e.penaltyCommitted=t.penalty_committed,e.penaltyWon=t.penalty_won,e.penaltyMissed=t.penalty_missed,e.tackles=t.tackles,e.concededGoals=t.conceded_goals,e.caughtBall=t.caught_ball,e.saves=t.saves,e};remapPlayerDetailedStatsData=t=>{let e=new Oe;return e.minutesPlayed=t.minutes_played,e.yellowCards=t.yellow_cards,e.redCards=t.red_cards,e.goals=t.goals,e.penaltyGoals=t.penalty_goals,e.penaltyCommitted=t.penalty_committed,e.penaltyWon=t.penalty_won,e.penaltyMissed=t.penalty_missed,e.penaltySaved=t.penalty_saved,e.penaltyReceived=t.penalty_received,e.ownGoals=t.own_goals,e.assists=t.assists,e.cleanSheets=t.clean_sheets,e.shots=t.shots,e.shotsOn=t.shots_on,e.shotsBlocked=t.shots_blocked,e.offsides=t.offsides,e.foulsCommitted=t.fouls_committed,e.foulsWon=t.fouls_won,e.tackles=t.tackles,e.tacklesBlocks=t.tackles_blocks,e.tacklesInterceptions=t.tackles_interceptions,e.concededGoals=t.conceded_goals,e.caughtBall=t.caught_ball,e.saves=t.saves,e.passes=t.passes,e.crosses=t.crosses,e.interceptions=t.interceptions,e.keyPasses=t.key_passes,e.passesAccuracy=t.passes_accuracy,e.duels=t.duels,e.duelsWon=t.duels_won,e.dribblesAttempts=t.dribbles_attempts,e.dribblesSuccess=t.dribbles_success,e.dribblesPast=t.dribbles_past,e}};var ct=class extends C{limitIds=200;countryRemapper=null;competitionBasicRemapper=null;competitionFullRemapper=null;teamBasicRemapper=null;teamFullRemapper=null;matchBasicRemapper=null;matchFullRemapper=null;playerBasicRemapper=null;playerFullRemapper=null;topPlayerRemapper=null;searchRemapper=null;footballMetaRemapper=null;fantasyRemapper=null;footballService=null;constructor(t){super(t,v(t.environment,"football")),this.apiSignInUrl=t.lang!=="en"?this.apiSignInUrl+`&lang=${t.lang}`:this.apiSignInUrl,this.countryRemapper=new $,this.competitionBasicRemapper=new Z,this.competitionFullRemapper=new Gn,this.teamBasicRemapper=new z,this.teamFullRemapper=new Vn,this.matchBasicRemapper=new Hn,this.matchFullRemapper=new Qn,this.playerBasicRemapper=new Ei,this.playerFullRemapper=new jn,this.topPlayerRemapper=new Kn,this.searchRemapper=new Yn,this.footballMetaRemapper=new Xn,this.footballService=new Tt(t),this.fantasyRemapper=new Jn}getCountries=async t=>{let e="There was a problem with the football countries request",i=`/countries${this.apiSignInUrl}`,a=Date.now();t&&(i+=`&disable_cache=${a}`);let r=await this.fetchWithoutAuth(i,e);return this.countryRemapper.countriesFromResponse(r.data)};getCompetitions=async(t,e)=>{let i=Date.now(),a="There was a problem with football competitions request";if(e=e||!1,t&&t.competitionIds&&t.competitionIds.length>this.limitIds-1){let r=[],o=Gt(t.competitionIds,this.limitIds);for(let l of o){t.competitionIds=l;let p=`/competitions${this.apiSignInUrl}${t.constructFilterUrl()}`;e&&(p+=`&disable_cache=${i}`);let c=await this.fetchWithoutAuth(p,a);r.push(c.data.map(d=>this.competitionBasicRemapper.fromResponse(d)))}return Array.prototype.concat.apply([],r)}else{let r=`/competitions${this.apiSignInUrl}`;return t&&(r+=`${t.constructFilterUrl()}`),e&&(r+=`&disable_cache=${i}`),(await this.fetchWithoutAuth(r,a)).data.map(n=>this.competitionBasicRemapper.fromResponse(n))}};getCompetitionById=async(t,e)=>{let i=`/competitions/${t}${this.apiSignInUrl}`,a="There was a problem with football competition by ID request",r=Date.now();e&&(i+=`&disable_cache=${r}`);let o=await this.fetchWithoutAuth(i,a);return this.competitionFullRemapper.fromResponse(o.data)};getTopCompetitions=async t=>{let e="There was a problem with top football competitions request",i=`/competitions/top${this.apiSignInUrl}`,a=Date.now();return t&&(i+=`&disable_cache=${a}`),(await this.fetchWithoutAuth(i,e)).data.map(o=>this.competitionBasicRemapper.fromResponse(o))};getTeams=async(t,e)=>{let i=Date.now(),a="There was a problem with football teams request";if(t&&t.teamIds&&t.teamIds.length>this.limitIds){let r=[],o=Gt(t.teamIds,this.limitIds);for(let l of o){t.teamIds=l,t.limit=l.length;let p=`/teams${this.apiSignInUrl}${t.constructFilterUrl()}`;e&&(p+=`disable_cache=${i}`);let c=await this.fetchWithoutAuth(p,a);r.push(c.data.map(d=>this.teamBasicRemapper.fromResponse(d)))}return Array.prototype.concat.apply([],r)}else{let r=new $t,o=`/teams${this.apiSignInUrl}`;t&&(o+=`${t.constructFilterUrl()}`),e&&(o+=`&disable_cache=${i}`);let n=await this.fetchWithoutAuth(o,a);return r.meta=this.footballMetaRemapper.remapMetaProp(n.meta),r.data=n.data.map(l=>this.teamBasicRemapper.fromResponse(l)),r}};getTeamById=async(t,e)=>{let i="There was a problem with football team by ID request",a=`/teams/${t}${this.apiSignInUrl}`,r=Date.now();e&&(a+=`disable_cache=${r}`);let o=await this.fetchWithoutAuth(a,i);return this.teamFullRemapper.fromResponse(o.data)};getTopTeams=async t=>{let e=`/teams/top${this.apiSignInUrl}`,i="There was a problem with top football teams request",a=Date.now();t&&(e+=`$disable_cache=${a}`);let r=await this.fetchWithoutAuth(e,i);return r.data?r.data.map(o=>this.teamBasicRemapper.fromResponse(o)):[]};getNextMatchForTeam=async(t,e)=>{let i=`/teams/${t}/next-match${this.apiSignInUrl}`,a=Date.now(),r="There was a problem with next match for team request";e&&(i+=`&disable_cache=${a}`);let o=await this.fetchWithoutAuth(i,r);return this.matchFullRemapper.fromResponse(o.data)};getPrevMatchForTeam=async(t,e)=>{let i=`/teams/${t}/previous-match${this.apiSignInUrl}`,a=Date.now(),r="There was a problem with previous match for team request";e&&(i+=`disable_cache=${a}`);let o=await this.fetchWithoutAuth(i,r);return this.matchFullRemapper.fromResponse(o.data)};getPlayers=async(t,e)=>{let i=Date.now(),a="There was a problem with football players request";if(t&&t.playerIds&&t.playerIds.length>this.limitIds-1){let r=[],o=Gt(t.playerIds,this.limitIds);for(let p of o){t.playerIds=p,t.limit=p.length;let c=`/players${this.apiSignInUrl}${t.constructFilterUrl()}`;e&&(c+=`&disable_cache=${i}`);let d=await this.fetchWithoutAuth(c,a);r.push(d.data.map(u=>this.playerBasicRemapper.fromResponse(u)))}let n=Array.prototype.concat.apply([],r),l=new $t;return l.data=n,l}else{let r=new $t,o=`/players${this.apiSignInUrl}`;t&&(o+=`${t.constructFilterUrl()}`),e&&(o+=`&disable_cache=${i}`);let n=await this.fetchWithoutAuth(o,a);return r.meta=this.footballMetaRemapper.remapMetaProp(n.meta),r.data=n.data.map(l=>this.playerBasicRemapper.fromResponse(l)),r}};getPlayerById=async(t,e)=>{let i=`/players/${t}${this.apiSignInUrl}`,a=Date.now(),r="There was a problem with football player by ID request";e&&(i+=`&disable_cache=${a}`);let o=await this.fetchWithoutAuth(i,r);return this.playerFullRemapper.fromResponse(o.data)};getTopPlayers=async t=>{let e=`/players/top${this.apiSignInUrl}`,i=Date.now(),a="There was a problem with top football players request";return t&&(e+=`&disable_cache=${i}`),(await this.fetchWithoutAuth(e,a)).data.map(o=>this.topPlayerRemapper.fromResponse(o))};getNextMatchForPlayer=async(t,e)=>{let i=`/players/${t}/next-match${this.apiSignInUrl}`,a=Date.now(),r="There was a problem with next match for player request";e&&(i+=`&disable_cache=${a}`);let o=await this.fetchWithoutAuth(i,r);return this.matchFullRemapper.fromResponse(o.data)};getPrevMatchForPlayer=async(t,e)=>{let i=`/players/${t}/previous-match${this.apiSignInUrl}`,a=Date.now(),r="There was a problem with previous match for player request";e&&(i+=`&disable_cache=${a}`);let o=await this.fetchWithoutAuth(i,r);return this.matchFullRemapper.fromResponse(o.data)};getMatchById=async(t,e)=>{let i=`/matches/${t}${this.apiSignInUrl}`,a=Date.now(),r="There was a problem with match by ID request";e&&(i+=`&disable_cache=${a}`);let o=await this.fetchWithoutAuth(i,r);return this.matchFullRemapper.fromResponse(o.data)};getMatches=async(t,e)=>{let i=new $t,a="There was a problem with football matches request";if(t&&t.matchIds&&t.matchIds.length>this.limitIds){let r=[],o=Gt(t.matchIds,this.limitIds);for(let l of o){let p=new ht({...t,matchIds:l,limit:l.length}),c=!0,d=`/matches${this.apiSignInUrl}${p.constructFilterUrl(c)}&limit=${l.length}`;e&&(d+=f());let u=await this.fetchWithoutAuth(d,a);r.push(u.data.map(b=>this.matchBasicRemapper.fromResponse(b)))}let n=Array.prototype.concat.apply([],r);return i.meta=this.footballService.setMetaDataBatchRequest(n.length,t.limit||20,t.page||1),i.data=this.footballService.finalizeMatchesDataBatchRequest(n,t),i}else{let r=`/matches${this.apiSignInUrl}`;t&&(r+=`${t.constructFilterUrl()}`),e&&(r+=f());let o=await this.fetchWithoutAuth(r,a);return i.meta=this.footballMetaRemapper.remapMetaProp(o.meta),i.data=o.data.map(n=>this.matchBasicRemapper.fromResponse(n)),i}};search=async(t,e)=>{let i=`/search${this.apiSignInUrl}${t.constructFilterUrl()}`,a=Date.now(),r="There was a problem with football search request";e&&(i+=`&disable_cache=${a}`);let o=await this.fetchWithoutAuth(i,r);return this.searchRemapper.fromResponse(o.data)};getPlayersPoints=async(t,e,i)=>{let a=`/players/points/${t}${this.apiSignInUrl}`,r=Date.now(),o="There was a problem with players points request";e&&(a+=`&position=${e.toLocaleLowerCase()}`),i&&(a+=`&disable_cache=${r}`);let n=await this.fetchWithoutAuth(a,o);return this.fantasyRemapper.remapPlayersPoints(n)};getPlayerDetailedStatistics=async(t,e,i)=>{let a=`/players/${e}/points/${t}${this.apiSignInUrl}`,r=Date.now(),o="There was a problem with detailed player points request";i&&(a+=`&disable_cache=${r}`);let n=await this.fetchWithoutAuth(a,o);return this.fantasyRemapper.remapPlayerDetailedStats(n)}};var Zn=class{idMapping=null;idSchema=null;native="native";footballFacade=null;constructor(t,e,i){this.idMapping=i,this.idSchema=t.idSchema,this.footballFacade=e}remapProfileStats=async t=>{if(!t.predictions)return t;let{successRates:e,predictions:i}=t,a={competition:this.getIdsKeys(e.byFootballCompetition,i.single.breakdown.footballCompetitions),team:this.getIdsKeys(e.byFootballTeam,i.single.breakdown.footballTeams)};if(Object.values(a.competition).length){let r=JSON.parse(JSON.stringify(t.successRates.byFootballCompetition)),o=await this.getEntitiesMap(a.competition,"competition"),n=await this.setSuccessRatesModels(r,o);t.successRates.byFootballCompetition=n,i.single.breakdown.footballCompetitions=this.reconstructBreakdown(i.single.breakdown.footballCompetitions,o)}if(Object.values(a.team).length){let r=JSON.parse(JSON.stringify(t.successRates.byFootballTeam)),o=await this.getEntitiesMap(a.team,"team"),n=await this.setSuccessRatesModels(r,o);t.successRates.byFootballTeam=n,i.single.breakdown.footballTeams=this.reconstructBreakdown(i.single.breakdown.footballTeams,o)}return t};setSuccessRatesModels=async(t,e)=>{let i;return this.reconstructRecords(t,i,e)};getEntitiesMap=async(t,e)=>{switch(e){case"competition":return await this.footballFacade.getCompetitionsMapWithNativeIds(t);case"team":return await this.footballFacade.getTeamsMapWithNativeIds(t)}};reconstructRecords=(t,e,i)=>t&&Object.keys(t).length?(Object.keys(t).forEach(a=>{let r=i.get(a);e={...e,[r.id]:t[a]},e[r.id].model=r}),e):t;reconstructBreakdown=(t,e)=>t.length?t.map(i=>{let a=e.get(i.entityId);return i.entityId=a.id,i.model=a,i}):t;getIdsKeys=(t,e)=>{let i=Object.keys(t);if(e.length){let a=e.map(r=>r.entityId);return Array.from(new Set([...i,...a]))}return i};remapInterestsToIdSchema=async t=>{if(this.idSchema!==this.native)if(t&&t.length>0){let e={},i={},a=t.filter(l=>l.source.toLocaleUpperCase()==="FOOTBALL"),r=t.filter(l=>l.source.toLocaleUpperCase()!=="FOOTBALL");a.forEach(l=>{e.hasOwnProperty(l.type)||(e[l.type]=[],i[l.type]=[]),e[l.type].push(l.id),i[l.type].push(l)});let o=await this.remapIdsObj(e,this.native,this.idSchema),n=[];for(let[l,p]of Object.entries(i))p.forEach((c,d)=>{c.id=o[l][d],n.push(c)});return n.concat(r)}else return t;return t};remapInterestToNative=async t=>{if(this.idSchema!==this.native&&t.source.toLocaleUpperCase()==="FOOTBALL"){let e={},{id:i,type:a}=t;e[a]=[i];let r=await this.remapIdsObj(e,this.idSchema,this.native);return t.id=r[a][0],t}return t};inquiryCustomInterests=(t,e)=>{let i=[];return t&&t.length>0&&(i=t.filter(a=>a.source.toLocaleUpperCase()==="CUSTOM"),e)?i.map(a=>{let r=new vs;return r.id=a.id,r.type=a.type,r.source=a.source,r.favourite=a.favourite,r}):i};remapInterests=async t=>{let i=this.inquiryCustomInterests(t,!1);if(i&&i.length>0){let a=t.filter(o=>o.source.toLocaleUpperCase()!=="CUSTOM"),r=await this.remapInterestsToIdSchema(a);return i.forEach(o=>r.push(o)),r}return await this.remapInterestsToIdSchema(t)};showFullInterests=async t=>{let e=[];if(t&&t.length>0){let a=this.inquiryCustomInterests(t,!0);e.push(a);let r=t.filter(c=>c.source.toLocaleUpperCase()!=="CUSTOM"),{competitionsMap:o,teamsMap:n,playersMap:l}=await this.getInterestsEntitiesMap(r),p=r.map(c=>{let d=null;if(c.source.toLocaleUpperCase()==="FOOTBALL"){if(c.type==="competition")return d=o.get(c.id),d&&(c.id=d.id),c.model=d,c;if(c.type==="team")return d=n.get(c.id),d&&(c.id=d.id),c.model=d,c;if(c.type==="player")return l?(c.model=l[c.id],c.id=l[c.id].id):c.model=d,c}else return c.model=d,c});return e.push(p),e.flat()}return e};getInterestsEntitiesMap=async t=>{let e=[],i=[],a=[],r=new Map,o=new Map,n=null;return t.forEach(l=>{l.type==="competition"&&l.source.toLocaleUpperCase()==="FOOTBALL"?e.push(l.id):l.type==="team"&&l.source.toLocaleUpperCase()==="FOOTBALL"?i.push(l.id):l.type==="player"&&l.source.toLocaleUpperCase()==="FOOTBALL"&&a.push(l.id)}),e.length&&(r=await this.footballFacade.getCompetitionsMapWithNativeIds(e)),i.length&&(o=await this.footballFacade.getTeamsMapWithNativeIds(i)),a.length&&(n=await this.footballFacade.getPlayersMapWithNativeIds(a)),{competitionsMap:r,teamsMap:o,playersMap:n}};remapIdsObj=async(t,e,i)=>await this.idMapping.idMappingFacade.getEntitiesByIds(t,e,i)};var tl=class{idMapping=null;profileOperations=null;constructor(t,e){this.idMapping=new R(t),this.profileOperations=new Zn(t,e,this.idMapping)}remapProfileStats=async t=>await this.profileOperations.remapProfileStats(t);remapInterestToNative=async t=>await this.profileOperations.remapInterestToNative(t);remapInterests=async t=>await this.profileOperations.remapInterests(t);showFullInterests=async t=>await this.profileOperations.showFullInterests(t)};var V=class{idsRemapper=null;profileHttps=null;activityHttps=null;footballHttps=null;footballFacade=null;idMapping=null;localCache=null;profileFacade=null;ownProfileBuilder=null;profileBuilder=null;constructor(t){this.profileHttps=new hi(t),this.activityHttps=new li(t),this.footballHttps=new ct(t),this.idMapping=new R(t),this.localCache=new pt().createLocalCacheInstance(t.idSchema),this.footballFacade=new _i(t,this.localCache,this.footballHttps,this.idMapping),this.profileFacade=new wt(this.localCache,this.profileHttps,this.activityHttps,t.errorHandlingMode),this.idsRemapper=new tl(t,this.footballFacade),this.ownProfileBuilder=new vn(t,this.idsRemapper,this.localCache,this.profileHttps,this.activityHttps),this.profileBuilder=new gi(this.idsRemapper,this.localCache,this.profileHttps,this.activityHttps)}getOwn=()=>this.ownProfileBuilder;getById=t=>this.profileBuilder.getById(t);getCountries=async t=>await this.profileFacade.getCountries(t);getByIds=async(t,e,i)=>await this.profileFacade.getByIds(t,e,i);collectLead=async t=>await this.profileFacade.collectLead(t);checkFollowStatus=async t=>await this.profileFacade.checkFollowStatus(t);getOwnStats=async()=>await this.ownProfileBuilder.getStats();getStats=async t=>await this.profileBuilder.getById(t).getStats();getOwnBadges=async()=>await this.ownProfileBuilder.getBadges();getBadges=async t=>await this.profileBuilder.getById(t).getBadges()};var el=class extends P{};var sd=(r=>(r.LIKE="like",r.DISLIKE="dislike",r.SHARE="share",r.COMMENT="comment",r.PREDICTION_MADE="prediction_made",r))(sd||{});var nd=(a=>(a.CORRECT="CORRECT",a.INCORRECT="INCORRECT",a.PARTIALLY_CORRECT="PARTIALLY_CORRECT",a.NOT_VERIFIED="NOT_VERIFIED",a))(nd||{});var il=(i=>(i.ONE="1",i.X="x",i.TWO="2",i))(il||{}),al=(i=>(i.ONE_X="1x",i.X_TWO="x2",i.ONE_TWO="12",i))(al||{}),rl=(p=>(p.ONE_ONE="1/1",p.ONE_X="1/x",p.ONE_TWO="1/2",p.X_ONE="x/1",p.X_X="x/x",p.X_TWO="x/2",p.TWO_ONE="2/1",p.TWO_X="2/x",p.TWO_TWO="2/2",p))(rl||{});var Tc=(S=>(S.NONE="none",S.FINISHED="finished",S.CANCELLED="cancelled",S.POSTPONED="postponed",S.NOT_STARTED="not_started",S.FIRST_HALF="1st_half",S.SECOND_HALF="2nd_half",S.FINISHED_AFTER_AWARDED_WIN="finished_after_awarded_win",S.TO_FINISH="to_finish",S.FINISHED_AET="finished_aet",S.HALFTIME="halftime",S.FINISHED_AP="finished_ap",S.INTERRUPTED="interrupted",S.KICK_OFF_DELAYED="kick_off_delayed",S.ABANDONED="abandoned",S.WAITING_FOR_PENALTY="waiting_for_penalty",S.PENALTY="penalty",S.PAUSE="pause",S.EXTRA_TIME_1ST_HALF="extra_time_1st_half",S.EXTRA_TIME_END_OF_1ST_HALF="extra_time_end_of_1st_half",S.EXTRA_TIME_2ND_HALF="extra_time_2nd_half",S.WAITING_FOR_EXTRA_TIME="waiting_for_extra_time",S.NO_INFO_YET="no_info_yet",S.AWAITING_INFO="awaiting_info",S.FINISHED_ASG="finished_asg",S))(Tc||{});var ol=class extends J{constructor(t){super(t)}validatePrediction=t=>{(!t.fixtures||!Array.isArray(t.fixtures)||t.fixtures.length===0)&&this.throwException(400,"invalid_method_call","Fixtures field is required and should contain at least one BracketGameFixtures object. For more information please visit our documentation");let e=Object.keys(new er);for(let i of t.fixtures)(Object.keys(i).length!==e.length||Object.keys(i).some(a=>!e.includes(a)))&&this.throwException(400,"invalid_method_call","Fixtures field is invalid. For more information please visit our documentation");t.tiebreaker&&(!t.tiebreaker.statTotal||!Number.isInteger(t.tiebreaker.statTotal))&&this.throwException(400,"invalid_method_call","Tiebreaker field is invalid. It should contain statTotal key with integer value. For more information please visit our documentation")}};var sl=class{https=null;validator=null;profile=null;constructor(t){this.https=new ui(t),this.profile=new V(t),this.validator=new ol(t.errorHandlingMode)}getGames=async(t,e)=>(t&&(t=new ir(t)),await this.https.getBracketGames(t,e));getGameById=async(t,e)=>await this.https.getBracketGameById(t,e);makePrediction=async(t,e)=>(this.validator.validatePrediction(e),await this.https.makeBracketGamePrediction(t,e));updatePrediction=async(t,e,i)=>(this.validator.validatePrediction(i),await this.https.updateBracketGamePrediction(t,e,i));getGamePredictionsForUser=async(t,e,i,a)=>{i&&(i=new tr(i));let r=await this.https.getBracketGamePredictionsForUser(t,e,i,a),o=null;try{o=await this.profile.getById(e).getInfo()}catch(n){console.error(n)}return r.data.forEach(n=>{n.profileModel=o}),r};getGamePredictionById=async(t,e,i)=>await this.https.getBracketGamePredictionById(t,e,i);getRankings=async(t,e,i)=>{e&&(e=new el(e));let a=await this.https.getBracketGameRankings(t,e,i),r=a.data.map(n=>n.profileId),o=[];return r.length>0&&(o=await this.profile.getByIds(r),a.data=a.data.map(n=>(n.profileModel=o.find(l=>l.id===n.profileId)||null,n))),a}};var nl=class{facade=null;constructor(t){this.facade=new sl(t)}getGames=async(t,e)=>await this.facade.getGames(t,e);getGameById=async(t,e)=>await this.facade.getGameById(t,e);makePrediction=async(t,e)=>await this.facade.makePrediction(t,e);updatePrediction=async(t,e,i)=>await this.facade.updatePrediction(t,e,i);getGamePredictionsForUser=async(t,e,i,a)=>await this.facade.getGamePredictionsForUser(t,e,i,a);getGamePredictionById=async(t,e,i)=>await this.facade.getGamePredictionById(t,e,i);getRankings=async(t,e,i)=>await this.facade.getRankings(t,e,i)};var ll=class{remapResponse=t=>(t.meta=this.remapMeta(t.meta),t.data=this.remapData(t.data),t);remapLeagueLeaderboardResponse=t=>(t.meta=this.remapLeagueLeaderboardMeta(t.meta),t.data=this.remapData(t.data),t);remapTemplateBreakdown=t=>(t.meta=this.remapMeta(t.meta),t.data=t.data.map(e=>this.remapTemplatePoints(e)),t);remapMeta=t=>{let e=new Lt;return e.rankType=t.rank_type,e.fromDate=t.from_date,e.toDate=t.to_date,e.pagination.currentPage=t.pagination.current_page,e.pagination.itemsPerPage=t.pagination.items_per_page,e.pagination.totalItems=t.pagination.total_items,e.pagination.numberOfPages=t.pagination.number_of_pages,e};remapLeagueLeaderboardMeta=t=>{let e=new xe;return e.templateId=t.template_id,e.privateLeagueId=t.private_league_id,e.fromDate=t.from_date,e.toDate=t.to_date,e.pagination.currentPage=t.pagination.current_page,e.pagination.itemsPerPage=t.pagination.items_per_page,e.pagination.totalItems=t.pagination.total_items,e.pagination.numberOfPages=t.pagination.number_of_pages,e};remapData=t=>{let e=[];return t.forEach(i=>{let a=new De;a.position=i.position,a.profileId=i.profile_id,a.points=i.points,a.predictionsMade=i.predictions_made,e.push(a)}),e};remapTemplatePoints=t=>{let e=new ho;return e.groupId=t.group_id,e.averagePoints=t.average_points,e.highestPoints=t.highest_points,e}};var pl=class{remapRankings=t=>(t.meta=this.remapMeta(t.meta),t.data=this.remapData(t.data),t);remapRankingsPrivateLeague=t=>(t.meta=this.remapMeta(t.meta),t.data=this.remapDataUserRankingPrivateLeague(t.data),t);remapRankingsChallenge=t=>(t.meta=this.remapMeta(t.meta),t.data=this.remapDataUserRankingChallenge(t.data),t);remapMeta=t=>{let e=new B;return e.pagination.currentPage=t.pagination.current_page,e.pagination.itemsPerPage=t.pagination.items_per_page,e.pagination.numberOfPages=t.pagination.number_of_pages,e.pagination.totalItems=t.pagination.total_items,e};remapData(t){let e=[];return t.forEach(i=>{let a=new mo;a.id=i.id,a.rankType=i.rank_type,a.position=i.position,a.points=i.points,a.gameType=i.game_type,delete a.profileId,delete a.profileModel,delete a.predictionsMade,e.push(a)}),e}remapDataUserRankingPrivateLeague(t){let e=[];return t.forEach(i=>{let a=new Rs;a.templateId=i.template_id,a.privateLeagueId=i.private_league_id,a.position=i.position,a.points=i.points,e.push(a)}),e}remapDataUserRankingChallenge(t){let e=[];return t.forEach(i=>{let a=new lr;a.templateId=i.template_id,a.challengeId=i.private_league_id,a.position=i.position,a.points=i.points,e.push(a)}),e}};var cl=class{entityId=null;entityType=null};var dt=class{remapBranding=t=>{let e=new jr;return t.colors&&(e.colors=new Yr,e.colors.primaryColor=t.colors.primary_color,e.colors.secondaryColor=t.colors.secondary_color,e.colors.contentColor=t.colors.content_color,e.colors.backgroundColor=t.colors.background_color,e.colors.borderColor=t.colors.border_color,e.colors.additionalColor=t.colors.additional_color),t.urls&&(e.urls=new Xr,e.urls.primaryUrl=t.urls.primary_url,e.urls.secondaryUrl=t.urls.secondary_url,e.urls.privacyPolicyUrl=t.urls.privacy_policy_url,e.urls.termsAndConditionsUrl=t.urls.terms_and_conditions_url,e.urls.additionalUrl=t.urls.additional_url),t.images&&(e.images=new Jr,e.images.mainLogo=t.images.main_logo,e.images.mobileLogo=t.images.mobile_logo,e.images.backgroundImage=t.images.background_image,e.images.mobileBackgroundImage=t.images.mobile_background_image,e.images.additionalImage=t.images.additional_image),e}};var dl=class extends dt{remapResponse=t=>{let e=[];return t.forEach(i=>{let a=new xt;a.id=i.id,a.name=i.name,a.description=i.description,a.type=i.type,a.fromDate=i.from_date,a.toDate=i.to_date,a.markets=i.markets?i.markets:null,a.teamIds=i.team_ids?i.team_ids:null,a.matchIds=i.match_ids?i.match_ids:null,a.groups=i.groups?this.remapGroups(i.groups):null,a.gameIds=i.game_ids?i.game_ids:null,a.gameTypes=i.game_types?i.game_types:null,a.competitionIds=i.competition_ids?i.competition_ids:null,a.excludedProfileIds=i.excluded_profile_ids?i.excluded_profile_ids:null,a.rules=i.rules?i.rules:null,a.labels=i.labels?i.labels:null,a.customFields=i.custom_fields?i.custom_fields:null,a.branding=i.branding?this.remapBranding(i.branding):null,a.flags=i.flags?i.flags:null,a.images=i.images?i.images:null,a.status=i.status?i.status:null,a.automaticallyChangeStatus=i.automatically_change_status,a.createdAt=i.created_at,a.updatedAt=i.updated_at,a.related=i.related?this.remapRelated(i.related):null,e.push(a)}),e};remapResponseId=t=>{let e=new fo;return e.id=t.id,e.name=t.name,e.description=t.description,e.type=t.type,e.fromDate=t.from_date,e.toDate=t.to_date,e.markets=t.markets?t.markets:null,e.teamIds=t.team_ids?t.team_ids:null,e.matchIds=t.match_ids?t.match_ids:null,e.groups=t.groups?this.remapGroups(t.groups):null,e.gameIds=t.game_ids?t.game_ids:null,e.gameTypes=t.game_types?t.game_types:null,e.competitionIds=t.competition_ids?t.competition_ids:null,e.excludedProfileIds=t.excluded_profile_ids?t.excluded_profile_ids:null,e.rules=t.rules?t.rules:null,e.flags=t.flags?t.flags:null,e.images=t.images?t.images:null,e.status=t.status?t.status:null,e.automaticallyChangeStatus=t.automatically_change_status,e.related=t.related?this.remapRelated(t.related):null,e.labels=t.labels,e.customFields=t.custom_fields,e.branding=t.branding?this.remapBranding(t.branding):null,e.adContent=t.ad_content,e.createdAt=t.created_at,e.updatedAt=t.updated_at,e};remapMeta=t=>{let e=new uo;return e.pagination.currentPage=t.pagination.current_page,e.pagination.itemsPerPage=t.pagination.items_per_page,e.pagination.totalItems=t.pagination.total_items,e.pagination.numberOfPages=t.pagination.number_of_pages,e.filters.flags=t.filters.flags,e.filters.status=t.filters.status,e.filters.type=t.filters.type,e.filters.activeFrom=t.filters.active_from,e.filters.activeTo=t.filters.active_to,e.filters.createdFrom=t.filters.created_from,e.filters.createdTo=t.filters.created_to,e.filters.updatedFrom=t.filters.updated_from,e.filters.updatedTo=t.filters.updated_to,e};remapRelated=t=>t.map(e=>{let i=new cl;return i.entityId=e.entity_id,i.entityType=e.entity_type,i});remapGroups=t=>t.map(e=>{let i=new go;return i.groupId=e.group_id,i.label=e.label,i.flags=e.flags,i.filters=this.remapGroupFilters(e.filters),i});remapGroupFilters=t=>{let e=new yo;return e.fromDate=t.from_date,e.toDate=t.to_date,e.matchIds=t.match_ids,e}};var ul=class{remapHighestSuccessRate=t=>t.map(e=>{let i=new po;return i.position=e.position,i.points=e.points,i.predictionsMade=e.predictions_made,i.profileId=e.profile_id,i.successRatePercent=e.success_rate_percent,i})};var Et=class extends C{templateRemapper=null;leaderboardRemapper=null;rankingsRemapper=null;highestSuccessRateRemapper=null;constructor(t){super(t,v(t.environment,"loyalty")),this.templateRemapper=new dl,this.leaderboardRemapper=new ll,this.rankingsRemapper=new pl,this.highestSuccessRateRemapper=new ul}getTemplates=async(t,e)=>{let i=t?`/leaderboard/templates/${this.apiSignInUrl}${t.constructFiltersUrl()}`:`/leaderboard/templates/${this.apiSignInUrl}`;i+=g(e)?f():"";let a="There was a problem fetching the list of templates",r=await this.fetchWithoutAuth(i,a),o=JSON.parse(JSON.stringify(r));return o.meta=this.templateRemapper.remapMeta(r.meta),o.data=this.templateRemapper.remapResponse(r.data),o};getTemplateById=async(t,e)=>{let i=g(e)?`/leaderboard/templates/${t}${this.apiSignInUrl}${f()}`:`/leaderboard/templates/${t}${this.apiSignInUrl}`,a=`There was a problem requesting the following template: ${t}`,r=await this.fetchWithoutAuth(i,a);return this.templateRemapper.remapResponseId(r.data)};getLeaderboard=async(t,e,i)=>{let a=g(e)?`/leaderboard/${t}${this.apiSignInUrl}${f()}`:`/leaderboard/${t}${this.apiSignInUrl}`,r=`There was a problem fetching the leaderboard for the following template: ${t}`;i&&(a+=`${i.constructFiltersUrl()}`);let o=await this.fetchWithoutAuth(a,r),n=JSON.parse(JSON.stringify(o));return this.leaderboardRemapper.remapResponse(n)};getLeaderboardForGame=async(t,e,i)=>{let a=g(e)?`/leaderboard/games/${t}${this.apiSignInUrl}${f()}`:`/leaderboard/games/${t}${this.apiSignInUrl}`,r=`There was a problem fetching the leaderboard for the following game: ${t}`;i&&(a+=`${i.constructFiltersUrl()}`);let o=await this.fetchWithoutAuth(a,r),n=JSON.parse(JSON.stringify(o));return this.leaderboardRemapper.remapResponse(n)};getLeaderboardForLeague=async(t,e)=>{let i=`/private-league/${t}${this.apiSignInUrl}`,a=`There was a problem fetching the leaderboard for the following league: ${t}`;e&&(i+=`${e.constructFiltersUrl()}`);let r=await this.fetchWithoutAuth(i,a);return this.leaderboardRemapper.remapLeagueLeaderboardResponse(r)};getUserRankings=async(t,e,i)=>{let a=`/leaderboard/users/${t}/rankings${this.apiSignInUrl}`,r=`There was a problem fetching the rankings for the following user: ${t}`;e&&(a+=`${e.constructFiltersUrl()}`),g(i)&&(a+=`${f()}`);let o=await this.fetchWithoutAuth(a,r);return this.rankingsRemapper.remapRankings(o)};getHighestSuccessRate=async(t,e)=>{let i=`/statistics/top${this.apiSignInUrl}`,a="There was a problem fetching highest success rate";t&&(i+=`${t.constructFiltersUrl()}`),g(e)&&(i+=`${f()}`);let r=await this.fetchWithoutAuth(i,a);return this.highestSuccessRateRemapper.remapHighestSuccessRate(r.data)};getEntitiesFollows=async(t,e)=>{let i=g(e)?`/statistics/follows${this.apiSignInUrl}${f()}`:`/statistics/follows${this.apiSignInUrl}`,a="There was a problem fetching follows for entities";return t.footballCompetitions&&(i+=`&competitions=${t.footballCompetitions.join(",")}`),t.footballTeams&&(i+=`&teams=${t.footballTeams.join(",")}`),t.footballPlayers&&(i+=`&players=${t.footballPlayers.join(",")}`),(await this.fetchWithoutAuth(i,a)).data};getUserRankingsForPrivateLeagueAndChallenges=async(t,e,i)=>{let a=`/private-league/users/${t}/rankings${this.apiSignInUrl}&private_league_type=${e==="PRIVATE_LEAGUE"?"private":"one_vs_one"}`,r=`There was a problem fetching user rankings for ${e}`;i&&(a+=`${i.constructFiltersUrl()}`);let o=await this.fetchWithoutAuth(a,r);return e==="PRIVATE_LEAGUE"?this.rankingsRemapper.remapRankingsPrivateLeague(o):this.rankingsRemapper.remapRankingsChallenge(o)};getTemplateBreakdownPoints=async t=>{let e=`/leaderboard/${t}/breakdown${this.apiSignInUrl}`,i=`There was a problem fetching template breakdown points for: ${t}`,a=await this.fetchWithoutAuth(e,i);return this.leaderboardRemapper.remapTemplateBreakdown(a)}};var ml=class{remapToPrivateLeagues=t=>(t.meta=this.remapMetaPrivateLeagues(t.meta.pagination),t.data=t.data.map(e=>this.remapToPrivateLeagueById(e)),t);remapMetaPrivateLeagues=t=>{let e=new w;return e.pagination.itemsPerPage=t.items_per_page,e.pagination.nextPageStartsAfter=t.next_page_starts_after,e};remapToPrivateLeagueById=t=>{let e=new _s;return e.id=t.id,e.name=t.name,e.description=t.description,e.type=t.type,e.members=t.members,e.administrators=t.administrators,e.banned=t.banned,e.invites=t.invites,e.membersCount=t.members_count,e.usersCanInviteUsers=t.users_can_invite_users,e.invitationCode=t.invitation_code,e.templateId=t.template_id,e.pastTemplates=t.past_templates,e.pinnedPosts=t.pinned_posts,e.scoringStartsAt=t.scoring_starts_at,e};remapToMyPrivateLeagues=t=>{let e=new Ye;return e.id=t.id,e.name=t.name,e.description=t.description,e.type=t.type,e.administrators=t.administrators,e.banned=t.banned,e.invites=t.invites,e.membersCount=t.members_count,e.usersCanInviteUsers=t.users_can_invite_users,e.invitationCode=t.invitation_code,e.templateId=t.template_id,e.pastTemplates=t.past_templates,e.pinnedPosts=t.pinned_posts,e.scoringStartsAt=t.scoring_starts_at,e};remapToAcceptPrivateLeague=t=>{let e=new ws;return e.profileId=t.profile_id,e.leagueId=t.league_id,e.message=t.message,e};remapToAcceptChallenge=t=>{let e=new ar;return e.profileId=t.profile_id,e.challengeId=t.league_id,e.message=t.message,e};remapPredictions=t=>(t.meta=this.remapMeta(t.meta),t.data=this.remapPredictionsData(t.data),t);remapMeta=t=>{let e=new B;return e.pagination.currentPage=t.pagination.current_page,e.pagination.itemsPerPage=t.pagination.items_per_page,e.pagination.numberOfPages=t.pagination.number_of_pages,e.pagination.totalItems=t.pagination.total_items,e};remapPredictionsData=t=>t.map(e=>{let i=new Ps;return i.predictionId=e.prediction_id,i.profileId=e.profile_id,i})};var Ri=class{remapToDiscussions=t=>(t.meta=this.remapToMeta(t.meta),t.data=t.data.map(e=>this.remapToDiscussionById(e)),t);remapToDiscussionById=t=>{let e=new pr;return e.id=t.id,e.label=t.label,e.status=t.status,e.deleted=t.deleted,e.deletedAt=t.deleted_at,e.deletedBy=t.deleted_by,e.discussionType=t.discussion_type,e.discussionUrl=t.discussion_url,e.moderationType=t.moderation_type,e.postsCount=t.posts_count,e.pinnedPosts=t.pinned_posts,e.lastPostId=t.last_post_id,e.customFields=t.custom_fields,e.context=t.context,e.createdAt=t.created_at,e.updatedAt=t.updated_at,e};remapToPostsForDiscussion=(t,e)=>{let i=new mr,a=new hr;return i.meta=this.remapToPostMeta(t.meta),i.data=t.data.map(r=>this.remapToPostByIdBasic(r)),a.meta=this.remapToPostMeta(t.meta),a.data=t.data.map(r=>this.remapToPostByIdFull(r)),e==="basic"?i:a};remapToPosts=t=>{let e=new fr;return e.meta=this.remapToMeta(t.meta),e.data=t.data.map(i=>this.remapToPostByIdBasic(i)),e};remapToPostMeta=t=>{let e=new Ot;return e.pagination.totalItems=t.pagination.total_items,e.pagination.nextPageStartsAfter=t.pagination.next_page_starts_after,e.pagination.lastCommentCreateTimestamp=t.pagination.last_comment_create_timestamp,e};remapToMeta=t=>{let e=new w;return e.pagination.itemsPerPage=t.pagination.items_per_page,e.pagination.nextPageStartsAfter=t.pagination.next_page_starts_after,e};remapToPostByIdBasic=t=>{let e=new Ce;return e.id=t.id,e.userId=t.user_id,e.discussionId=t.discussion_id,e.content=t.content,e.anonymousNickname=t.anonymous_nickname,e.reactionsCount=t.reactions_count,e.replyId=t.reply_id,e.reactions=t.reactions.length?t.reactions.map(i=>this.remapReactionsPost(i)):t.reactions,e.repliesCount=t.replies_count,e.reports=t.reports.length?t.reports.map(i=>this.remapReportPost(i)):t.reports,e.reportsCount=t.reports_count,e.versions=t.versions.length?t.versions.map(i=>this.remapVersionsPost(i)):t.versions,e.privatePost=t.private_post,e.deleted=t.deleted,e.deletedAt=t.deleted_at,e.deletedBy=t.deleted_by,e.moderated=t.moderated,e.moderatedAt=t.moderated_at,e.moderatedBy=t.moderated_by,e.moderatedReason=t.moderated_reason,e.createdAt=t.created_at,e.updatedAt=t.updated_at,e};remapToPostByIdFull=t=>{let e=new cr;return e.id=t.id,e.userId=t.user_id,e.discussionId=t.discussion_id,e.content=t.content,e.anonymousNickname=t.anonymous_nickname,e.reactionsCount=t.reactions_count,e.replyId=t.reply_id,e.reactions=t.reactions.length?t.reactions.map(i=>this.remapReactionsPost(i)):t.reactions,e.repliesCount=t.replies_count,e.reports=t.reports.length?t.reports.map(i=>this.remapReportPost(i)):t.reports,e.reportsCount=t.reports_count,e.versions=t.versions.length?t.versions.map(i=>this.remapVersionsPost(i)):t.versions,e.privatePost=t.private_post,e.deleted=t.deleted,e.deletedAt=t.deleted_at,e.deletedBy=t.deleted_by,e.moderated=t.moderated,e.moderatedAt=t.moderated_at,e.moderatedBy=t.moderated_by,e.moderatedReason=t.moderated_reason,e.createdAt=t.created_at,e.updatedAt=t.updated_at,e};remapToPostCount=t=>t.map(e=>{let i=new ur;return i.id=e.id,i.postsCount=e.posts_count,i});remapReactionsPost=t=>{let e=new gr;return e.type=t.type,e.userIds=t.user_ids,e.reactionCount=t.reaction_count,e};remapVersionsPost=t=>{let e=new br;return e.content=t.content,e.updatedAt=t.updated_at,e};remapReportPost=t=>{let e=new yr;return e.userId=t.user_id,e.reason=t.reason,e.reasonDetails=t.reason_details,e}};var Si=class extends C{remapper=null;discussionsRemapper=null;discussionsBaseURL=null;constructor(t){super(t,v(t.environment,"privateLeagues")),this.discussionsBaseURL=v(t.environment,"discussions"),this.remapper=new ml,this.discussionsRemapper=new Ri}create=async(t,e)=>{let i="/leagues"+this.apiSignInUrl,r=`There was a problem ${e==="PRIVATE_LEAGUE"?"creating private league":"issuing challenge"}`,o="POST",n=await this.fetchWithAuth(i,r,o,t);return this.remapper.remapToPrivateLeagueById(n.data)};update=async(t,e,i)=>{let a=`/leagues/${t}`+this.apiSignInUrl,o=`There was a problem updating ${i==="PRIVATE_LEAGUE"?"private league":"challenge"}`,n="PUT",l=await this.fetchWithAuth(a,o,n,e);return this.remapper.remapToPrivateLeagueById(l.data)};updateLeagueTemplate=async(t,e,i,a)=>{let r=`/leagues/${t}/template`+this.apiSignInUrl,n=`There was a problem updating template for the ${a==="PRIVATE_LEAGUE"?"private league":"challenge"}`,l="POST",p={new_template_id:e,past_template_name:i},c=await this.fetchWithAuth(r,n,l,p);return this.remapper.remapToPrivateLeagueById(c.data)};getById=async(t,e,i)=>{let a=`/leagues/${t}`+this.apiSignInUrl;g(i)&&(a+=f());let o=`There was a problem getting ${e==="PRIVATE_LEAGUE"?"private league":"challenge"}`,n=await this.fetchWithAuth(a,o);return this.remapper.remapToPrivateLeagueById(n.data)};getMyLeagues=async(t,e)=>{let i="/leagues"+this.apiSignInUrl+t.constructFiltersUrl(),r=`There was a problem getting user's ${e==="PRIVATE_LEAGUE"?"private leagues":"challenges"}`;return(await this.fetchWithAuth(i,r)).data.map(n=>this.remapper.remapToMyPrivateLeagues(n))};delete=async(t,e)=>{let i=`/leagues/${t}`+this.apiSignInUrl,r=`There was a problem deleting ${e==="PRIVATE_LEAGUE"?"private league":"challenge"}`,o="DELETE";return await this.fetchWithAuth(i,r,o),!0};invite=async(t,e)=>{let i=`/membership/invite/${t}`+this.apiSignInUrl,a=`There was a problem inviting the following users: ${e.join(",")}`,r="POST",o={profiles:e};return(await this.fetchWithAuth(i,a,r,o)).data};deleteInvitation=async(t,e)=>{let i=`/membership/invite/${t}`+this.apiSignInUrl,a=`There was a problem deleting invitation for the following users: ${e.join(",")}`,r="DELETE",o={profiles:e};return await this.fetchWithAuth(i,a,r,o),!0};accept=async(t,e,i)=>{let a=`/membership/accept/${t}`+this.apiSignInUrl+`&accept=${e?"ACCEPT":"REJECT"}`,o=`There was a problem ${e?"accepting":"rejecting"} invitation for ${i==="PRIVATE_LEAGUE"?"private league":"challenge"}: ${t}`,n="POST",l=await this.fetchWithAuth(a,o,n);return i==="PRIVATE_LEAGUE"?this.remapper.remapToAcceptPrivateLeague(l.data):this.remapper.remapToAcceptChallenge(l.data)};ban=async(t,e)=>{let i=`/membership/ban/${t}`+this.apiSignInUrl,a=`There was a problem banning the following users: ${e.join(",")}`,r="POST",o={profiles:e};return(await this.fetchWithAuth(i,a,r,o)).data};unban=async(t,e)=>{let i=`/membership/unban/${t}`+this.apiSignInUrl,a=`There was a problem unbanning the following users: ${e.join(",")}`,r="POST",o={profiles:e};return(await this.fetchWithAuth(i,a,r,o)).data};join=async t=>{let e="/membership/join"+this.apiSignInUrl+`&invitation_code=${t}`,i="There was a problem joining league",a="POST",r=await this.fetchWithAuth(e,i,a);return this.remapper.remapToAcceptPrivateLeague(r.data)};leave=async(t,e)=>{let i=`/membership/leave/${t}`+this.apiSignInUrl,r=`There was a problem leaving the following ${e==="PRIVATE_LEAGUE"?"league":"challenge"}: ${t}`,o="POST";return(await this.fetchWithAuth(i,r,o)).data};getInvitations=async(t,e)=>{let i="/membership/invitations"+this.apiSignInUrl+e.constructMainFiltersUrl(),r=`There was a problem getting invitations for ${t==="PRIVATE_LEAGUE"?"leagues":"challenges"}`,o=await this.fetchWithAuth(i,r);return this.remapper.remapToPrivateLeagues(o)};getReportedPosts=async(t,e)=>{let i=`/discussions/${t}/posts/reported${this.apiSignInUrl}`,a=`There was a problem fetching posts for the following: ${t}`;e&&(i+=e.constructMainFiltersUrl());let r=await this.fetchWithAuthNewBaseURL(this.discussionsBaseURL,i,a);return this.discussionsRemapper.remapToPostsForDiscussion(r,"full")};getPredictions=async(t,e)=>{let i=`/leagues/${t}/predictions`+this.apiSignInUrl,a=`There was a problem getting predictions for private league: ${t}`;e&&(i+=e.constructFiltersUrl());let r=await this.fetchWithAuth(i,a);return this.remapper.remapPredictions(r)};moderatePost=async(t,e)=>{let i=`/posts/${t}/admin/moderate${this.apiSignInUrl}`,a=`There was a problem moderating the following post: ${t}`,r="POST",o={moderation_reason:e},n=await this.fetchWithAuthNewBaseURL(this.discussionsBaseURL,i,a,r,o);return this.discussionsRemapper.remapToPostByIdBasic(n.data)}};var Fi=class{createRequestBodyFromParam=(t,e)=>{let i=e==="PRIVATE"?new Ss:new rr;return i.name=t.name,i.description=t.description,i.invitation_code=t.invitationCode,i.template_id=t.templateId,i.users_can_invite_users=t.usersCanInviteUsers,t.administrators?i.administrators=t.administrators:delete i.administrators,t.scoringStartsAt?i.scoring_starts_at=t.scoringStartsAt:delete i.scoring_starts_at,i};createUpdateRequestBodyFromParam=(t,e)=>{let i=e==="PRIVATE"?new Fs:new or;return i.name=t.name,i.description=t.description,i.invitation_code=t.invitationCode,i.template_id=t.templateId,i.users_can_invite_users=t.usersCanInviteUsers,i.administrators=t.administrators,i.pinned_posts=t.pinnedPosts,i.scoring_starts_at=t.scoringStartsAt,i}};var hl=class{ALL_FINISHED_STATUSES=["finished","cancelled","interrupted","abandoned","finished_after_awarded_win","finished_aet","finished_ap","finished_asg","to_finish"];ALL_UPCOMING_STATUSES=["not_started","kick_off_delayed"];ALL_LIVE_STATUSES=["1st_half","2nd_half","halftime","waiting_for_penalty","waiting_for_extra_time","penalty","pause","extra_time_1st_half","extra_time_2nd_half","extra_time_end_of_1st_half","awaiting_info"];getMatchEventStatus(t){if(!t||!t.type||!t.subType)return"no_info_yet";let e=t.type.toLowerCase(),i=t.subType.toLowerCase();return e==="finished"?i==="awarded_win"?"finished_after_awarded_win":i==="aet"?"finished_aet":i==="ap"?"finished_ap":i==="asg"?"finished_asg":"finished":e==="notstarted"?i==="postponed"?"postponed":i==="delayed"?"kick_off_delayed":"not_started":e==="inprogress"?i==="1st_half"?"1st_half":i==="2nd_half"?"2nd_half":i==="halftime"?"halftime":i==="penalty"?"penalty":i==="waiting_penalty"?"waiting_for_penalty":i==="pause"?"pause":i==="extra_time_1st_half"?"extra_time_1st_half":i==="extra_time_2nd_half"?"extra_time_2nd_half":i==="extra_time_halftime"?"extra_time_end_of_1st_half":i==="waiting_extra_time"?"waiting_for_extra_time":"awaiting_info":e==="interrupted"?i==="abandoned"?"abandoned":i==="to_finish"?"to_finish":"interrupted":e==="cancelled"?"cancelled":"no_info_yet"}isUpcoming(t){if(!t)return!1;let e=this.getMatchEventStatus(t);return this.ALL_UPCOMING_STATUSES.includes(e)}isLive(t){if(!t)return!1;let e=this.getMatchEventStatus(t);return this.ALL_LIVE_STATUSES.includes(e)}isFinished(t){if(!t)return!1;let e=this.getMatchEventStatus(t);return this.ALL_FINISHED_STATUSES.includes(e)}};var fl=class{matchStatusHelper;constructor(){this.matchStatusHelper=new hl}getMatchStatusEnum(t){return this.matchStatusHelper.getMatchEventStatus(t)}isMatchUpcoming(t){return this.matchStatusHelper.isUpcoming(t)}isMatchLive(t){return this.matchStatusHelper.isLive(t)}isMatchFinished(t){return this.matchStatusHelper.isFinished(t)}};var tt=class{https=null;idMapping=null;localCache=null;footballFacade=null;footballHelpers;constructor(t){this.https=new ct(t),this.idMapping=new R(t),this.localCache=new pt().createLocalCacheInstance(t.idSchema),this.footballFacade=new _i(t,this.localCache,this.https,this.idMapping),this.footballHelpers=new fl}getCountries=async t=>await this.footballFacade.getCountries(t);getCompetitions=async(t,e)=>await this.footballFacade.getCompetitions(t,e);getCompetitionById=async(t,e)=>await this.footballFacade.getCompetitionById(t,e);getTopCompetitions=async t=>await this.footballFacade.getTopCompetitions(t);getTeams=async(t,e)=>await this.footballFacade.getTeams(t,e);getTeamById=async(t,e)=>await this.footballFacade.getTeamById(t,e);getTopTeams=async t=>await this.footballFacade.getTopTeams(t);getNextMatchForTeam=async(t,e)=>await this.footballFacade.getNextMatchForTeam(t,e);getPrevMatchForTeam=async(t,e)=>await this.footballFacade.getPrevMatchForTeam(t,e);getPlayers=async(t,e)=>await this.footballFacade.getPlayers(t,e);getPlayerById=async(t,e)=>await this.footballFacade.getPlayerById(t,e);getTopPlayers=async t=>await this.footballFacade.getTopPlayers(t);getNextMatchForPlayer=async(t,e)=>await this.footballFacade.getNextMatchForPlayer(t,e);getPrevMatchForPlayer=async(t,e)=>await this.footballFacade.getPrevMatchForPlayer(t,e);getMatches=async(t,e)=>await this.footballFacade.getMatches(t,e);getMatchById=async(t,e)=>await this.footballFacade.getMatchById(t,e);search=async(t,e)=>await this.footballFacade.search(t,e);getTeamForm=async(t,e,i)=>await this.footballFacade.getTeamForm(t,e,i);get helpers(){return this.footballHelpers}};var gl=class{matchFacade=null;playerFacade=null;predictorService=null;constructor(t,e,i){this.matchFacade=t,this.playerFacade=e,this.predictorService=i}remapFixturesRequest=t=>{let e={};if(e.match_id=t.matchId,e.match_type="FOOTBALL",t instanceof ot)e.market=t.market,e.prediction=t.prediction.value,e.player_id=t.prediction.playerId;else if(t instanceof ze||t instanceof Qe)e.market=t.market,e.prediction=t.prediction.value;else if(t instanceof Dt){e.market=t.market;let i=t.prediction.value.split(":");e.goals_home=Number(i[0]),e.goals_away=Number(i[1])}else e.market=t.market,e.prediction=t.prediction.value;return e};remapFixturesResponse=async t=>{let e="OWN_GOAL",i=[],a=[],r=null,o=[];t.length>1&&t.sort((l,p)=>l.match_id.localeCompare(p.match_id));for(let l of t)i.push(l.match_id),l.player_id&&!a.includes(l.player_id)&&a.push(l.player_id);let n=await this.matchFacade.getMatchesMapWithNativeIds(i);a.sort((l,p)=>l.localeCompare(p)),a&&a.length>0&&!a.includes(e)&&(r=await this.playerFacade.getPlayersMapWithNativeIds(a));for(let l of t){let p=new We;l.target?p.market=this.predictorService.convertMarketForResponseModel(l.market,l.target):p.market=l.market,p.matchId=n[l.match_id].id,p.matchType=l.match_type,p.matchModel=n?n[l.match_id]:null,delete p.matchModel.availableMarkets,l.prediction!==void 0?p.prediction.value=l.prediction:l.goals_home!==void 0&&l.goals_away!==void 0&&(p.prediction.value=l.goals_home.toString()+":"+l.goals_away.toString()),p.prediction.playerId=l.player_id?l.player_id:null,l.market==="PLAYER_PERFORMANCE"&&(p.prediction.playerRole=l.role),p.prediction.playerId&&p.prediction.playerId!==e&&(p.prediction.playerModel=r[l.player_id],p.prediction.playerId=r[l.player_id].id),p.result=this.remapResult(l.result),o.push(p)}return o};remapResult=t=>{let e=new qe;return e.settledAt=t.settled_at,e.resettledAt=t.resettled_at,e.status=t.status,e.outcome=t.outcome,e.points=t.points,e}};var oc=class{constructor(){}static createMatchMarketsResultsModel(t,e){return{FT_1X2:this.createOneXTwoResult(t.scores,"full_time"),HT_1X2:this.createOneXTwoResult(t.scores,"half_time"),BOTH_TEAMS_SCORE:t.scores.ftScore.homeGoals>0&&t.scores.ftScore.awayGoals>0,DOUBLE_CHANCE:this.createDoubleChanceResult(t.scores),HT_FT:this.createHalfTimeFullTimeResult(t.scores),RED_CARD_MATCH:this.createMarketResultByCriteria(t,"red_card"),PENALTY_MATCH:this.createMarketResultByCriteria(t,"penalty"),CORNERS_MATCH:isNaN(t.stats?.corners?.homeTeam+t.stats?.corners?.awayTeam)?null:t.stats.corners.homeTeam+t.stats.corners.awayTeam,PLAYER_YELLOW_CARD:this.createPlayersMarketsResults(t,e,"yellow_card"),PLAYER_RED_CARD:this.createPlayersMarketsResults(t,e,"red_card"),PLAYER_SCORE_FIRST_GOAL:this.createPlayersMarketsResults(t,e,"first_goal"),PLAYER_SCORE:this.createPlayersMarketsResults(t,e,"one_goal"),PLAYER_SCORE_TWICE:this.createPlayersMarketsResults(t,e,"two_goals"),PLAYER_SCORE_HATTRICK:this.createPlayersMarketsResults(t,e,"hattrick"),CORRECT_SCORE:{homeGoals:t.scores.ftScore.homeGoals,awayGoals:t.scores.ftScore.awayGoals},CORRECT_SCORE_ADVANCED:{homeGoals:t.scores.ftScore.homeGoals,awayGoals:t.scores.ftScore.awayGoals},CORRECT_SCORE_HT:{homeGoals:t.scores.htScore.homeGoals,awayGoals:t.scores.htScore.awayGoals},OVER_GOALS_0_5:t.scores.ftScore.homeGoals+t.scores.ftScore.awayGoals>0,OVER_GOALS_1_5:t.scores.ftScore.homeGoals+t.scores.ftScore.awayGoals>1,OVER_GOALS_2_5:t.scores.ftScore.homeGoals+t.scores.ftScore.awayGoals>2,OVER_GOALS_3_5:t.scores.ftScore.homeGoals+t.scores.ftScore.awayGoals>3,OVER_GOALS_4_5:t.scores.ftScore.homeGoals+t.scores.ftScore.awayGoals>4,OVER_GOALS_5_5:t.scores.ftScore.homeGoals+t.scores.ftScore.awayGoals>5,OVER_GOALS_6_5:t.scores.ftScore.homeGoals+t.scores.ftScore.awayGoals>6,OVER_CORNERS_6_5:isNaN(t.stats?.corners?.homeTeam+t.stats?.corners?.awayTeam)?null:t.stats.corners.homeTeam+t.stats.corners.awayTeam>6,OVER_CORNERS_7_5:isNaN(t.stats?.corners?.homeTeam+t.stats?.corners?.awayTeam)?null:t.stats.corners.homeTeam+t.stats.corners.awayTeam>7,OVER_CORNERS_8_5:isNaN(t.stats?.corners?.homeTeam+t.stats?.corners?.awayTeam)?null:t.stats.corners.homeTeam+t.stats.corners.awayTeam>8,OVER_CORNERS_9_5:isNaN(t.stats?.corners?.homeTeam+t.stats?.corners?.awayTeam)?null:t.stats.corners.homeTeam+t.stats.corners.awayTeam>9,OVER_CORNERS_10_5:isNaN(t.stats?.corners?.homeTeam+t.stats?.corners?.awayTeam)?null:t.stats.corners.homeTeam+t.stats.corners.awayTeam>10,OVER_CORNERS_11_5:isNaN(t.stats?.corners?.homeTeam+t.stats?.corners?.awayTeam)?null:t.stats.corners.homeTeam+t.stats.corners.awayTeam>11,OVER_CORNERS_12_5:isNaN(t.stats?.corners?.homeTeam+t.stats?.corners?.awayTeam)?null:t.stats.corners.homeTeam+t.stats.corners.awayTeam>12,OVER_CORNERS_13_5:isNaN(t.stats?.corners?.homeTeam+t.stats?.corners?.awayTeam)?null:t.stats.corners.homeTeam+t.stats.corners.awayTeam>13}}},Rt=oc;et(Rt,"createOneXTwoResult",(t,e)=>e==="full_time"?t.ftScore.homeGoals>t.ftScore.awayGoals?"1":t.ftScore.homeGoals===t.ftScore.awayGoals?"x":"2":t?.htScore?.homeGoals>t?.htScore?.awayGoals?"1":t?.htScore?.homeGoals===t?.htScore?.awayGoals?"x":"2"),et(Rt,"createDoubleChanceResult",t=>t?.ftScore?.homeGoals>t?.ftScore?.awayGoals?["1x","12"]:t?.ftScore?.homeGoals===t?.ftScore?.awayGoals?["1x","x2"]:["x2","12"]),et(Rt,"createHalfTimeFullTimeResult",t=>{if(t?.htScore?.homeGoals>t?.htScore?.awayGoals){if(t?.ftScore?.homeGoals>t?.ftScore?.awayGoals)return"1/1";if(t?.ftScore?.homeGoals===t?.ftScore?.awayGoals)return"1/x";if(t?.ftScore?.homeGoals<t?.ftScore?.awayGoals)return"1/2"}if(t?.htScore?.homeGoals===t?.htScore?.awayGoals){if(t?.ftScore?.homeGoals>t?.ftScore?.awayGoals)return"x/1";if(t?.ftScore?.homeGoals===t?.ftScore?.awayGoals)return"x/x";if(t?.ftScore?.homeGoals<t?.ftScore?.awayGoals)return"x/2"}if(t?.htScore?.homeGoals<t?.htScore?.awayGoals){if(t?.ftScore?.homeGoals>t?.ftScore?.awayGoals)return"2/1";if(t?.ftScore?.homeGoals===t?.ftScore?.awayGoals)return"2/x";if(t?.ftScore?.homeGoals<t?.ftScore?.awayGoals)return"2/2"}}),et(Rt,"createMarketResultByCriteria",(t,e)=>!t.timeline||!t.timeline.length?null:e==="red_card"?t.timeline.filter(i=>Number(i.minute)<=90).some(i=>i.type==="red_card"):t.timeline.filter(i=>Number(i.minute)<=90).some(i=>i.type.startsWith(e))),et(Rt,"createPlayersMarketsResults",(t,e,i)=>{if(!t.timeline||!t.timeline.length)return i==="first_goal"?null:[];if(i==="first_goal"){let n=t.timeline.find(l=>l.type==="goal"||l.type==="penalty_goal"||l.type==="own_goal")||null;if(n){let l=e[n.player.id];return{playerId:n.type==="goal"||n.type==="penalty_goal"?n.player.id:"OWN_GOAL",playerModel:l}}return null}if(i==="yellow_card"||i==="red_card")return oc.transformPlayerMarketResult(t.timeline.filter(n=>Number(n.minute)<=90).filter(n=>n.type===i).map(n=>e[n.player.id]));let a=new Map,r=i==="one_goal"?1:i==="two_goals"?2:3,o=[];return t.timeline.filter(n=>Number(n.minute)<=90).filter(n=>n.type==="goal"||n.type==="penalty_goal").forEach(n=>{let l=e[n.player.id];if(a.has(n.player.id)){let p=a.get(n.player.id);p.push(l),a.set(n.player.id,p)}else a.set(n.player.id,[l])}),a.forEach(n=>{n.length>=r&&o.push(n[0])}),oc.transformPlayerMarketResult(o)}),et(Rt,"transformPlayerMarketResult",t=>t.map(e=>({playerId:e.id,playerModel:e})));var St=class{footballHttps=null;idMapping=null;matchFacade=null;playerFacade=null;profileNamespace=null;constructor(t,e){this.footballHttps=new ct(t),this.idMapping=e,this.matchFacade=new zt(t,this.footballHttps,e),this.playerFacade=new qt(t,this.footballHttps,e),this.profileNamespace=new V(t)}remapMatchIdToNative=async t=>(await this.idMapping.getEntityIdsBySchemaId(t,"match","native")).match;remapPlayerIdToNative=async t=>(await this.idMapping.getEntityIdsBySchemaId(t,"player","native")).player[0];remapPlayerIdMapToNative=async t=>{let e={},i=ie(t),r=(await this.idMapping.getEntityIdsBySchemaId(i,"player","native")).player;return i.forEach((o,n)=>e[o]=r[n]),e};remapPlayerIdToIdSchema=async t=>{let e=["playerScore","playerYellowCard","playerRedCard","playerScoreFirstGoal","playerScoreHattrick","playerScoreTwice"],i=[];for(let[r,o]of Object.entries(t))if(e.includes(r))for(let n of Object.keys(o))n!=="NOBODY"&&n!=="OWN_GOAL"&&i.push(n);if(!i.length)return t;let a=await this.playerFacade.getPlayersMapWithNativeIds(i);for(let[r,o]of Object.entries(t))if(e.includes(r))for(let n of Object.keys(o))n!=="NOBODY"&&n!=="OWN_GOAL"&&(o[a[n].id]=o[n],o[a[n].id].model=a[n],this.idMapping.idSchema!=="native"&&delete o[n]);return t};convertMarketForResponseModel=(t,e)=>{let i=e.toString();return t+"_"+i};getMarketSummary=async(t,e,i)=>{let a=Oc.get(e),r={};if(r.matchId=t.matchId,r.matchType=t.matchType,Object.keys(t.predictions).includes(a))r[a]=t.predictions[a];else throw new Error("You have passed invalid market");if(bt.includes(e)&&i){let n="";if(i!=="OWN_GOAL"&&i!=="NOBODY"&&(n=(await this.idMapping.idMappingFacade.getEntitiesByIds({player:[i]},this.idMapping.idSchema,"native")).player[0]),n&&r[a][n]){let l=await this.playerFacade.getPlayersMapWithNativeIds([n]);return r[a][n].model=l[n],r[a][n]}else return n?(r[a][n]=new L,r[a][n]):r[a][i]}else if(bt.includes(e)&&!i){let n=Object.keys(r[a]).filter(p=>p!=="NOBODY"&&p!=="OWN_GOAL"),l=n.length?await this.playerFacade.getPlayersMapWithNativeIds(n):{};Object.keys(l).length&&Object.keys(r[a]).forEach(p=>{p!=="NOBODY"&&p!=="OWN_GOAL"&&(r[a][l[p].id]=r[a][p],r[a][l[p].id].model=l[p],this.idMapping.idSchema!=="native"&&delete r[a][p])})}return r};remapCompetitionsFromConfig=async t=>{if(t instanceof we){let e={competition:t.fullCoverageCompetitions},i={competition:t.successRateScopes.competitions},a={team:t.successRateScopes.teams},r=await this.idMapping.idMappingFacade.getEntitiesByIds(e,"native",this.idMapping.idSchema),o=await this.idMapping.idMappingFacade.getEntitiesByIds(i,"native",this.idMapping.idSchema),n=await this.idMapping.idMappingFacade.getEntitiesByIds(a,"native",this.idMapping.idSchema);return t.fullCoverageCompetitions=r.competition,t.successRateScopes.competitions=o.competition,t.successRateScopes.teams=n.team,t}if(t instanceof Ie||t instanceof Me){let e={competition:t.competitionsWhitelist},i=await this.idMapping.idMappingFacade.getEntitiesByIds(e,"native",this.idMapping.idSchema);return t.competitionsWhitelist=i.competition,t}};remapMatchIdsFixtures=async t=>{if(Array.isArray(t.data))if(t.data.length>0){let e=[],i=[];return t.data.forEach(a=>{a instanceof Pt||a instanceof Bt||a instanceof _t||a instanceof ti?(a.fixtures.forEach(r=>e.push(r.matchId)),a instanceof _t&&a.fixtures.forEach(r=>{r.prediction.playerId&&r.prediction.playerId!=="OWN_GOAL"&&i.push(r.prediction.playerId)})):a instanceof Wt&&a.results.forEach(r=>e.push(r.matchId))}),await this.refactorResponseArrModel(t,e,i)}else return t;else return await this.refactorResponseObjModel(t)};refactorResponseArrModel=async(t,e,i)=>{let a=[],r=await this.matchFacade.getMatchesMapWithNativeIds(e),o={};return i.length>0&&(o=await this.playerFacade.getPlayersMapWithNativeIds(i)),t.data.forEach(n=>{n instanceof Pt||n instanceof Bt||n instanceof _t?(n.fixtures.forEach(l=>{this.handleMatchModel(r,l),n instanceof _t&&l.prediction.playerId&&l.prediction.playerId!=="OWN_GOAL"&&(l.prediction.playerModel=o[l.prediction.playerId],l.prediction.playerId=o[l.prediction.playerId].id)}),a.push(n)):n instanceof Wt&&(n.results.forEach(l=>{l.matchModel=r[l.matchId],delete l.matchModel.availableMarkets,l.matchId=l.matchModel.id}),a.push(n))}),t.data=a,t};refactorResponseObjModel=async t=>{let e=[];t.fixtures.forEach(a=>e.push(a.matchId));let i=await this.matchFacade.getMatchesMapWithNativeIds(e);return t.fixtures.forEach(a=>this.handleMatchModel(i,a)),t};getCurrentGameId=t=>{let e=new Date;if(t.data.length>1){let i=[];return t.data.forEach(r=>i.push(r.predictionsCutoff)),t.data.sort((r,o)=>{let[n,l]=[r.predictionsCutoff,o.predictionsCutoff].map(p=>Math.abs(new Date(p)-e));return n-l})[0].id}else return t.data[0].id};initGameTypePredictions=(t,e)=>{let i={type:t,limit:null,startAfter:null};return e&&(i={...i,limit:e.limit,startAfter:e.startAfter}),i=new U(i),i};initGameFilters=(t,e,i)=>{if(e&&i)return e.type=t,e.gameIds=i,e=new st(e),e;if(e&&!i)return e.type=t,e=new st(e),e;if(!e&&i){let a={type:t,gameIds:i};return a=new st(a),a}else{let a={type:t};return a=new st(a),a}};addPredictionProp=async(t,e)=>(e.data.forEach(i=>{let a=i.fixtures.map(r=>r.matchId);t.data.forEach(r=>{i.id===r.game_instance_id&&(i.fixtures.sort((o,n)=>o.matchId.localeCompare(n.matchId)),r.fixtures.sort((o,n)=>o.match_id.localeCompare(n.match_id)),i.predictionId=r.id,i.outcome=r.status,i.fixtures.forEach((o,n)=>{r.fixtures[n].goals_home!==void 0&&r.fixtures[n].goals_away!==void 0?o.prediction.value=r.fixtures[n].goals_home+":"+r.fixtures[n].goals_away:o.prediction.value=r.fixtures[n].prediction,r.fixtures[n].player_id?o.prediction.playerId=r.fixtures[n].player_id:r.fixtures[n].target&&(o.prediction.target=r.fixtures[n].target),o.prediction.result=this.remapResult(r.fixtures[n].result)}),i.predictionsMadeAt=r.created_at,i.predictionsUpdatedAt=r.profile_last_updated_at,i.points=r.points,i instanceof Bt&&(r.tiebreaker?i.predictionTiebreaker.goldenGoal=r.tiebreaker.golden_goal:i.predictionTiebreaker=r.tiebreaker))}),i.fixtures.sort((r,o)=>a.indexOf(r.matchId)-a.indexOf(o.matchId))}),e.meta.pagination.nextPageStartsAfter=t.meta.pagination.next_page_starts_after,await this.remapMatchIdsFixtures(e));remapResult=t=>{let e=new qe;return e.settledAt=t.settled_at,e.resettledAt=t.resettled_at,e.status=t.status,e.outcome=t.outcome,e.points=t.points,e};areIdsExceeded=t=>t.length>10;initPredictionsFilters=(t,e,i)=>{switch(e){case"user":t&&(t=new U(t));break;case"current":if(t)this.deleteUnexpectedProperties(t),t.status=["ACTIVE"],t=new U(t);else{let a={status:["ACTIVE"]};t=new U(a)}break;case"past":if(t)this.deleteUnexpectedProperties(t),t.status=Pc,t=new U(t);else{let a={status:Pc};t=new U(a)}break;case"matches":if(t)this.deleteUnexpectedProperties(t),t.matchIds=i,t=new U(t);else{let a={matchIds:i};t=new U(a)}break}return t};completeGameMarketResults=async(t,e)=>{switch(e){case"MATCH_QUIZ":let i={},a=t.results[0].matchId,r=t.results.map(p=>bt.includes(p.market)&&!p.result.includes("OWN_GOAL")?[...p.result]:[]).flat(),o=await this.matchFacade.getMatchesMapWithNativeIds([a]);return r.length&&(i=await this.playerFacade.getPlayersMapWithNativeIds(r)),t.results=t.results.map(p=>{if(p.matchModel=o[p.matchId]?o[p.matchId]:null,p.playerModels&&Object.keys(i).length&&p.result.forEach(d=>{let u=i[d];p.playerModels.push(u)}),this.idMapping.idSchema!=="native"&&(this.remapMatchIdForResultsMarkets(o,p),p.playerModels&&Object.keys(i).length)){let c=p.result;p.result=c.map(d=>i[d].id)}return p}),t;case"TOP_X":let n=t.results.map(p=>p.matchId),l=await this.matchFacade.getMatchesMapWithNativeIds(n);if(t.results=t.results.map(p=>(p.matchModel=l[p.matchId]?l[p.matchId]:null,this.idMapping.idSchema!=="native"&&this.remapMatchIdForResultsMarkets(l,p),p)),t.tieBreakers.goldenGoals.length){let p=t.tieBreakers.goldenGoals.map(d=>d.playerId),c=await this.playerFacade.getPlayersMapWithNativeIds(p);t.tieBreakers.goldenGoals=t.tieBreakers.goldenGoals.map(d=>(d.matchModel=l[d.matchId],d.playerModel=c[d.playerId],this.idMapping.idSchema!=="native"&&(d.matchId=l[d.matchId].id,d.playerId=c[d.playerId].id),d))}return t}};completeContestWinners=async t=>{if(t.userList&&t.userList.length){let e=t.userList.map(a=>a.profileId),i=await this.profileNamespace.getByIds(e);t.userList.forEach(a=>{let r=i.filter(o=>o.id===a.profileId)[0];delete r.interests,a.profileModel=r})}return t};handleMatchModel=(t,e)=>{t[e.matchId]?(e.matchModel=t[e.matchId],delete e.matchModel.availableMarkets,e.matchId=e.matchModel.id):(e.matchModel=null,this.idMapping.idSchema!=="native"&&this.idMapping.idMappingFacade.getEntityById(e.matchId,"match","native").then(i=>{e.matchId=i[N[this.idMapping.idSchema]]}))};remapMatchIdForResultsMarkets=(t,e)=>{t[e.matchId]?e.matchId=t[e.matchId].id:this.idMapping.idMappingFacade.getEntityById(e.matchId,"match","native").then(i=>{e.matchId=i[N[this.idMapping.idSchema]]})};deleteUnexpectedProperties=t=>(t.status&&(console.warn(uc.UNEXPECTED_STATUS_PROP),delete t.status),t.type&&(console.warn(uc.UNEXPECTED_TYPE_PROP),delete t.type),t);getMatchMarketsResults=async t=>{let e=await this.footballHttps.getMatchById(t,!0);if(e.status.type!=="finished"||!e.finishedAt)return new bs;let i=[];e.timeline.filter(r=>Number(r.minute)<=90).filter(r=>r.type==="goal"||r.type==="penalty_goal"||r.type==="yellow_card"||r.type==="red_card").forEach(r=>{i.push(r.player.id)});let a={};return i.length&&(a=await this.playerFacade.getPlayersMapWithNativeIds(i)),Rt.createMatchMarketsResultsModel(e,a)}};var Ci=class{fixturesRemapper=null;footballHttps=null;matchFacade=null;playerFacade=null;predictorService=null;constructor(t,e){this.footballHttps=new ct(t),this.matchFacade=new zt(t,this.footballHttps,e),this.playerFacade=new qt(t,this.footballHttps,e),this.predictorService=new St(t,e),this.fixturesRemapper=new gl(this.matchFacade,this.playerFacade,this.predictorService)}remapRequestBody=t=>{if(t instanceof ve)return t;let e={};return e.game_instance_id=t.gameInstanceId,e.fixtures=t.fixtures.map(i=>this.fixturesRemapper.remapFixturesRequest(i)),t instanceof ei&&t.tiebreaker&&(e.tiebreaker={},e.tiebreaker.golden_goal=t.tiebreaker.goldenGoal?t.tiebreaker.goldenGoal:null),e};remapResponseArrayBody=async t=>{if(t.length){let e="OWN_GOAL",i=[],a=[],r={},o=[];t.forEach(l=>{l.fixtures.forEach(p=>{i.push(p.match_id),p.player_id&&p.player_id!==e&&a.push(p.player_id)})});let n=await this.matchFacade.getMatchesMapWithNativeIds(i);return a.length>0&&(r=await this.playerFacade.getPlayersMapWithNativeIds(a)),t.forEach(l=>{let p=new wi,c=[];p.id=l.id,p.gameInstanceId=l.game_instance_id,p.gameType=l.game_type,p.wager=l.wager,p.totalFixtures=l.total_fixtures,p.settledFixtures=l.settled_fixtures,p.userId=l.user_id,p.templateId=l.template_id,p.groupId=l.group_id,p.profileLastUpdatedAt=l.profile_last_updated_at,l.fixtures.forEach(d=>{let u=new We;d.target?u.market=this.predictorService.convertMarketForResponseModel(d.market,d.target):u.market=d.market,u.matchId=n[d.match_id].id,u.matchType=d.match_type,u.matchModel=n[d.match_id],delete u.matchModel.availableMarkets,d.prediction!==void 0?u.prediction.value=d.prediction:d.goals_home!==void 0&&d.goals_away!==void 0&&(u.prediction.value=d.goals_home.toString()+":"+d.goals_away.toString()),u.prediction.playerId=d.player_id?d.player_id:null,u.prediction.playerId&&u.prediction.playerId!==e&&(u.prediction.playerModel=r[u.prediction.playerId],u.prediction.playerId=r[u.prediction.playerId].id),d.market==="PLAYER_PERFORMANCE"&&(u.prediction.playerRole=d.role),u.result=this.fixturesRemapper.remapResult(d.result),c.push(u)}),p.fixtures=c,p.status=l.status,l.tiebreaker?p.tiebreaker.goldenGoal=l.tiebreaker.golden_goal:p.tiebreaker=null,p.points=l.points,p.createdAt=l.created_at,p.updatedAt=l.updated_at,o.push(p)}),o}return t};remapResponseObjBody=async t=>{let e=new wi;return e.id=t.id,e.gameInstanceId=t.game_instance_id,e.gameType=t.game_type,e.wager=t.wager,e.totalFixtures=t.total_fixtures,e.settledFixtures=t.settled_fixtures,e.userId=t.user_id,e.templateId=t.template_id,e.groupId=t.group_id,e.profileLastUpdatedAt=t.profile_last_updated_at,e.fixtures=await this.fixturesRemapper.remapFixturesResponse(t.fixtures),e.status=t.status,t.tiebreaker?e.tiebreaker.goldenGoal=t.tiebreaker.golden_goal:e.tiebreaker=null,e.points=t.points,e.createdAt=t.created_at,e.updatedAt=t.updated_at,e};remapPredictionModel=t=>{let e=new Ms;return e.fullTimeOneXTwo=t.FT_1X2,e.halfTimeOneXTwo=t.HT_1X2,e.bothTeamsScore=t.BOTH_TEAMS_SCORE,e.overZeroPointFiveGoals=t.OVER_GOALS_0_5,e.overOnePointFiveGoals=t.OVER_GOALS_1_5,e.overTwoPointFiveGoals=t.OVER_GOALS_2_5,e.overThreePointFiveGoals=t.OVER_GOALS_3_5,e.overFourPointFiveGoals=t.OVER_GOALS_4_5,e.overFivePointFiveGoals=t.OVER_GOALS_5_5,e.overSixPointFiveGoals=t.OVER_GOALS_6_5,e.overSixPointFiveCorners=t.OVER_CORNERS_6_5,e.overSevenPointFiveCorners=t.OVER_CORNERS_7_5,e.overEightPointFiveCorners=t.OVER_CORNERS_8_5,e.overNinePointFiveCorners=t.OVER_CORNERS_9_5,e.overTenPointFiveCorners=t.OVER_CORNERS_10_5,e.overElevenPointFiveCorners=t.OVER_CORNERS_11_5,e.overTwelvePointFiveCorners=t.OVER_CORNERS_12_5,e.overThirteenPointFiveCorners=t.OVER_CORNERS_13_5,e.doubleChance=t.DOUBLE_CHANCE,e.halfTimeFullTime=t.HT_FT,e.playerScore=t.PLAYER_SCORE,e.playerYellowCard=t.PLAYER_YELLOW_CARD,e.playerRedCard=t.PLAYER_RED_CARD,e.redCardMatch=t.RED_CARD_MATCH,e.penaltyMatch=t.PENALTY_MATCH,e.playerScoreFirstGoal=t.PLAYER_SCORE_FIRST_GOAL,e.cornersMatch=t.CORNERS_MATCH,e.correctScore=t.CORRECT_SCORE,e.correctScoreHalfTime=t.CORRECT_SCORE_HT,e.correctScoreAdvanced=t.CORRECT_SCORE_ADVANCED,e.playerScoreHattrick=t.PLAYER_SCORE_HATTRICK,e.playerScoreTwice=t.PLAYER_SCORE_TWICE,e}};var yl=class{remapPredictions=null;constructor(t,e){this.remapPredictions=new Ci(t,e)}remapResponse=t=>{let e=new Is;return e.matchId=t.match_id,e.matchType=t.match_type,e.predictions=this.remapPredictions.remapPredictionModel(t.predictions),e}};var bl=class extends dt{remapPaginatedGames=t=>{let e=new H;return e.meta.pagination.nextPageStartsAfter=t.meta.pagination.next_page_starts_after,e.meta.pagination.itemsPerPage=t.meta.pagination.items_per_page,e.data=t.data.map(i=>this.remapGamesListResponse(i)),e};remapGamesListResponse=t=>{let e=new Pt;return e.id=t.id,e.title=t.title,e.description=t.description,e.type=t.type,e.status=t.status,e.authRequirement=t.auth_requirement||null,e.scheduleOpenAt=t.schedule_open_at,e.predictionsCutoff=t.predictions_cutoff,e.fixtures=t.fixtures.map(i=>this.remapFixturesResponse(i)),e.tiebreaker=t.tiebreaker?this.remapTimeTiebreaker(t.tiebreaker.time_tiebreaker):null,e.participantsCount=t.participants_count,e.related=t.related?this.remapRelated(t.related):[],e.excludedProfileIds=t.excluded_profile_ids,e.rules=t.rules,e.labels=t.labels,e.customFields=t.custom_fields,e.branding=t.branding?this.remapBranding(t.branding):null,e.flags=t.flags,e.images=t.images,e.createdAt=t.created_at,e.updatedAt=t.updated_at,e};remapGameByIdResponse=t=>{let e=new ti;return e.id=t.id,e.title=t.title,e.description=t.description,e.type=t.type,e.status=t.status,e.authRequirement=t.auth_requirement||null,e.scheduleOpenAt=t.schedule_open_at,e.predictionsCutoff=t.predictions_cutoff,e.fixtures=t.fixtures.map(i=>this.remapFixturesResponse(i)),e.tiebreaker=t.tiebreaker?this.remapTimeTiebreaker(t.tiebreaker.time_tiebreaker):null,e.participantsCount=t.participants_count,e.related=t.related?this.remapRelated(t.related):[],e.excludedProfileIds=t.excluded_profile_ids,e.rules=t.rules,e.flags=t.flags,e.adContent=t.ad_content,e.labels=t.labels,e.customFields=t.custom_fields,e.branding=t.branding?this.remapBranding(t.branding):null,e.images=t.images,e.createdAt=t.created_at,e.updatedAt=t.updated_at,e};remapFixturesResponse=t=>{let e=new Ls;return e.matchId=t.match_id,e.matchType=t.match_type,e.market=t.market,e.matchStatus.type=t.match_status?t.match_status.type:null,e.matchStatus.subType=t.match_status?t.match_status.sub_type:null,e};remapPaginatedUserTopXEditions=t=>{let e=new H;return e.meta.pagination.nextPageStartsAfter=t.meta.pagination.next_page_starts_after,e.meta.pagination.itemsPerPage=t.meta.pagination.items_per_page,e.data=t.data.map(i=>this.remapUserTopXEditionsResponse(i)),e};remapUserTopXEditionsResponse=t=>{let e=new Bt;return e.id=t.id,e.title=t.title,e.description=t.description,e.type=t.type,e.status=t.status,e.authRequirement=t.auth_requirement||null,e.predictionsCutoff=t.predictions_cutoff,e.scheduleOpenAt=t.schedule_open_at,e.fixtures=t.fixtures.map(i=>this.remapTopXFixturesResponse(i)),e.tiebreaker=t.tiebreaker?this.remapTimeTiebreaker(t.tiebreaker.time_tiebreaker):null,e.participantsCount=t.participants_count,e.related=t.related?this.remapRelated(t.related):[],e.excludedProfileIds=t.excluded_profile_ids,e.rules=t.rules,e.flags=t.flags,e.images=t.images,e.branding=t.branding?this.remapBranding(t.branding):null,e.createdAt=t.created_at,e.updatedAt=t.updated_at,e};remapTopXFixturesResponse=t=>{let e=new Ds;return e.matchId=t.match_id,e.matchType=t.match_type,e.market=t.market,e.matchStatus.type=t.match_status?t.match_status.type:null,e.matchStatus.subType=t.match_status?t.match_status.sub_type:null,e};remapPaginatedUserMathQuizEditions=t=>{let e=new H;return e.meta.pagination.nextPageStartsAfter=t.meta.pagination.next_page_starts_after,e.meta.pagination.itemsPerPage=t.meta.pagination.items_per_page,e.data=t.data.map(i=>this.remapUserMatchQuizEditionsResponse(i)),e};remapUserMatchQuizEditionsResponse=t=>{let e=new _t;return e.id=t.id,e.title=t.title,e.description=t.description,e.type=t.type,e.status=t.status,e.authRequirement=t.auth_requirement||null,e.predictionsCutoff=t.predictions_cutoff,e.scheduleOpenAt=t.schedule_open_at,e.fixtures=t.fixtures.map(i=>this.remapMatchQuizFixturesResponse(i)),e.tiebreaker=t.tiebreaker?this.remapTimeTiebreaker(t.tiebreaker.time_tiebreaker):null,e.participantsCount=t.participants_count,e.related=t.related?this.remapRelated(t.related):[],e.excludedProfileIds=t.excluded_profile_ids,e.rules=t.rules,e.flags=t.flags,e.images=t.images,e.branding=t.branding?this.remapBranding(t.branding):null,e.createdAt=t.created_at,e.updatedAt=t.updated_at,e};remapMatchQuizFixturesResponse=t=>{let e=new Mo;return e.matchId=t.match_id,e.matchType=t.match_type,e.market=t.market,e.matchStatus.type=t.match_status?t.match_status.type:null,e.matchStatus.subType=t.match_status?t.match_status.sub_type:null,e};remapPaginatedGameResults=t=>{let e=new H;return e.meta.pagination.nextPageStartsAfter=t.meta.pagination.next_page_starts_after,e.meta.pagination.itemsPerPage=t.meta.pagination.items_per_page,e.data=t.data.map(i=>this.remapGameResults(i)),e};remapGameResults=t=>{let e=new Wt;return e.userId=t.user_id,e.points=t.points?t.points:0,e.results=t.results.map(i=>this.remapResults(i)),e.tiebreaker=t.tiebreaker?this.remapTiebreaker(t.tiebreaker):null,e};remapGameMarketsResults=t=>{let e=new Io;return e.gameId=t.game_id,e.results=this.remapMarketsResults(t.results),e.tieBreakers=t.tie_breakers?this.remapTieBreakers(t.tie_breakers):null,e};remapContestWinners=t=>{let e=new Ns;return e.contestId=t.contest_id,e.contestType=t.contest_type,e.description=t.description,e.userList=t.user_list?t.user_list.map(i=>this.remapUserListWinners(i)):null,e};remapUserListWinners=t=>{let e=new ks;return e.position=t.position,e.profileId=t.profile_id,e.note=t.note,e.tags=t.tags,e};remapTieBreakers=t=>{let e={goldenGoals:[]};return e.goldenGoals=t.golden_goals.map(i=>({minute:i.minute,matchId:i.match_id,matchModel:null,playerId:i.player_id,playerModel:null,goalType:i.goal_type})),e};remapMarketsResults=t=>{let e=[];return t.forEach(i=>{let a={matchId:i.match_id,market:i.market,result:this.remapMarketResult(i.market,i.result),matchModel:null,playerModels:[],matchStatus:this.remapMarketsResultsMatchStatus(i.match_status)};e.push(this.deleteUnusefulField(a))}),e};remapMarketsResultsMatchStatus=t=>{let e=new j;return t&&(e.type=t.type,e.subType=t.sub_type),e};remapMarketResult=(t,e)=>{if(vc.includes(t))return e[0];if(bt.includes(t))return e;if(e[0]==="true")return!0;if(e[0]==="false")return!1};deleteUnusefulField=t=>((!bt.includes(t.market)||this.isPlayerMarketWithNoResult(t.market,t.result))&&delete t.playerModels,t);isPlayerMarketWithNoResult=(t,e)=>bt.includes(t)&&e.length===0;remapResults=t=>{let e=new Bs;return e.matchId=t.match_id,e.outcome=t.outcome,e};remapTiebreaker=t=>{let e=new gt;return e.goldenGoal=t.golden_goal,e};remapTimeTiebreaker=t=>{let e=new ft;return e.timeTiebreaker=t,e};remapRelated=t=>t.map(e=>{let i=new K;return i.entityId=e.entity_id,i.entityType=e.entity_type,i.entityRelationship=e.entity_relationship,i})};var Ml=class{remapMetaData=t=>{let e=new w;return e.pagination.nextPageStartsAfter=t.pagination.next_page_starts_after,e.pagination.itemsPerPage=t.pagination.items_per_page,e}};var ut=class extends C{predictionRemapper=null;matchSummaryRemapper=null;gamesRemapper=null;metaRemapper=null;idMapping=null;constructor(t){super(t,v(t.environment,"predictor")),this.idMapping=new R(t),this.predictionRemapper=new Ci(t,this.idMapping),this.matchSummaryRemapper=new yl(t,this.idMapping),this.gamesRemapper=new bl,this.metaRemapper=new Ml}makeFootballPrediction=async t=>{let e=`/predictions${this.apiSignInUrl}`,i="There was a problem making POST request",a="POST",r=await this.fetchWithAuth(e,i,a,this.predictionRemapper.remapRequestBody(t));return await this.predictionRemapper.remapResponseObjBody(r)};getMatchSummary=async(t,e)=>{let i=g(e)?`/predictions/summary/${t}${this.apiSignInUrl}${f()}`:`/predictions/summary/${t}${this.apiSignInUrl}`,a=`There was a problem fetching predictions for match: ${t}`,r=await this.fetchWithoutAuth(i,a);return this.matchSummaryRemapper.remapResponse(r)};deleteFootballPrediction=async t=>{let e=`/predictions/${t}${this.apiSignInUrl}`,i=`There was a problem deleting your prediction: ${t}`,a="DELETE";return await this.fetchWithAuth(e,i,a),!0};getMyPredictions=async t=>{let e=new H,i=`/predictions${this.apiSignInUrl}`,a="There was a problem fetching own predictions";t&&(i+=`${t.constructFiltersUrl()}`);let r=await this.fetchWithAuth(i,a);return e.meta=this.metaRemapper.remapMetaData(r.meta),e.data=await this.predictionRemapper.remapResponseArrayBody(r.data),e};getMyPredictionsNoRemap=async t=>{let e=`/predictions${this.apiSignInUrl}${t.constructFiltersUrl()}`,i="There was a problem fetching own predictions";return await this.fetchWithAuth(e,i)};getUserPredictions=async(t,e,i)=>{let a=new H,r=g(e)?`/predictions/users/${t}${this.apiSignInUrl}${f()}`:`/predictions/users/${t}${this.apiSignInUrl}`,o=`There was a problem fetching predictions for user: ${t}`;i&&(r+=`${i.constructFiltersUrl()}`);let n=await this.fetchWithoutAuth(r,o);return a.meta=this.metaRemapper.remapMetaData(n.meta),a.data=await this.predictionRemapper.remapResponseArrayBody(n.data),a};getUserPredictionsNoRemap=async(t,e)=>{let i=`/predictions/users/${t}${this.apiSignInUrl}${e.constructFiltersUrl()}`,a=`There was a problem fetching predictions for user: ${t}`;return await this.fetchWithoutAuth(i,a)};getGames=async(t,e)=>{let i=g(e)?`/games/${this.apiSignInUrl}${t.constructFiltersUrl()}${f()}`:`/games/${this.apiSignInUrl}${t.constructFiltersUrl()}`,a="There was a problem fetching the games list",r=await this.fetchWithoutAuth(i,a);return this.gamesRemapper.remapPaginatedGames(r)};getGamesNoRemap=async(t,e)=>{let i=g(e)?`/games/${this.apiSignInUrl}${t.constructFiltersUrl()}${f()}`:`/games/${this.apiSignInUrl}${t.constructFiltersUrl()}`,a="There was a problem fetching the games list";return await this.fetchWithoutAuth(i,a)};getGameById=async(t,e)=>{let i=g(e)?`/games/${t}${this.apiSignInUrl}${f()}`:`/games/${t}${this.apiSignInUrl}`,a=`There was a problem fetching the following game: ${t}`,r=await this.fetchWithoutAuth(i,a);return this.gamesRemapper.remapGameByIdResponse(r)};getGamePredictions=async(t,e,i)=>{let a=new H,r=g(e)?`/games/${t}/predictions${this.apiSignInUrl}${f()}`:`/games/${t}/predictions${this.apiSignInUrl}`,o=`There was a problem fetching the predictions for game: ${t}`;i&&(r+=`${i.constructFiltersUrl()}`);let n=await this.fetchWithoutAuth(r,o);return a.meta=this.metaRemapper.remapMetaData(n.meta),a.data=await this.predictionRemapper.remapResponseArrayBody(n.data),a};getUserGameEditions=async(t,e)=>{let i=null,a=g(e)?`/games/${this.apiSignInUrl}${t.constructFiltersUrl()}${f()}`:`/games/${this.apiSignInUrl}${t.constructFiltersUrl()}`,r="There was a problem fetching the games list",o=await this.fetchWithoutAuth(a,r);return o.data.forEach(n=>{n.type==="TOP_X"?i=this.gamesRemapper.remapPaginatedUserTopXEditions(o):n.type==="MATCH_QUIZ"&&(i=this.gamesRemapper.remapPaginatedUserMathQuizEditions(o))}),i};getGameResults=async(t,e,i)=>{let a=g(e)?`/games/${t}/results/${this.apiSignInUrl}${f()}`:`/games/${t}/results/${this.apiSignInUrl}`,r=`There was a problem fetching the results for the following game: ${t}`;i&&(a+=`${i.constructMainFiltersUrl()}`);let o=await this.fetchWithoutAuth(a,r);return this.gamesRemapper.remapPaginatedGameResults(o)};getMarketResultsForGame=async(t,e)=>{let i=`/games/${t}/correct-results/${this.apiSignInUrl}`,a=`There was a problem fetching the markets correct results for the following game: ${t}`;g(e)&&(i+=`${f()}`);let r=await this.fetchWithoutAuth(i,a);return this.gamesRemapper.remapGameMarketsResults(r.data)};getContestWinners=async(t,e)=>{let i=`/winners/${this.apiSignInUrl}&contest_id=${t}`,a=`There was a problem fetching winners for the following game: ${t}`;e&&(i+=f());let r=await this.fetchWithoutAuth(i,a);return this.gamesRemapper.remapContestWinners(r)};getPredictionById=async t=>{let e=`/predictions/${t}${this.apiSignInUrl}`,i=`There was a problem fetching info for the following prediction: ${t}`,a=await this.fetchWithoutAuth(e,i);return(await this.predictionRemapper.remapResponseArrayBody([a.data]))[0]};getPredictionsByIds=async t=>{let e=`/predictions/by-ids${this.apiSignInUrl}&prediction_ids=${t.join(",")}`,i="There was a problem fetching predictions",a=await this.fetchWithoutAuth(e,i);return await this.predictionRemapper.remapResponseArrayBody(a.data)}};var Qt=class{errorHandlingMode=null;constructor(t){this.errorHandlingMode=t}validateBodyFields=(t,e)=>{let i=Object.keys(e),a=Object.keys(new je);switch(t){case"MATCH_QUIZ":i.forEach(l=>{a.includes(l)||this.throwInvalidParamException([l])});break;case"TOP_X":let o=e;o.fixtures.forEach(l=>this.validateMarketTopX(l.market));let n="tiebreaker";i.includes(n)&&o.tiebreaker&&this.validateTiebreaker(o.tiebreaker),i.forEach(l=>{l!=="tiebreaker"&&!a.includes(l)&&this.throwInvalidParamException([l])});break}let r=a.filter(o=>!i.includes(o));return r.length&&this.throwMissingFieldsException("game prediction body",r),e.fixtures.forEach(o=>{this.validateFixtureFields(o)}),e};validateFixture=(t,e,i,a)=>{this.validateMarket(e);let r=Object.values(il),o=Object.values(rl),n=Object.values(al);if(e==="FT_1X2"||e==="HT_1X2"){if(r.includes(i))return new ms(t,e,i)}else if(e==="HT_FT"){if(o.includes(i))return new ds(t,i)}else if(e==="DOUBLE_CHANCE"){if(n.includes(i))return new ps(t,i)}else if(e==="CORRECT_SCORE"||e==="CORRECT_SCORE_ADVANCED"||e==="CORRECT_SCORE_HT"){if(typeof i=="string"&&/\d+:\d+/.test(i))return new Dt(t,e,i)}else if(e==="CORNERS_MATCH"){if(typeof i=="number")return new ss(t,i)}else if(e==="BOTH_TEAMS_SCORE"){if(this.isPredictionBoolean(i))return new rs(t,i)}else if(e==="RED_CARD_MATCH"){if(this.isPredictionBoolean(i))return new gs(t,i)}else if(e==="PENALTY_MATCH"){if(this.isPredictionBoolean(i))return new hs(t,i)}else if(bt.includes(e)){let l="OWN_GOAL";if(this.validatePlayerId(e,a),e===Hi&&this.isPredictionBoolean(i)){let p=a&&a===l?l:a;return new ot(t,e,i,p)}if(a&&this.isPredictionBoolean(i))return new ot(t,e,i,a)}else if(Fc.includes(e)){if(this.isPredictionBoolean(i))return new Qe(t,e,i)}else if(Cc.includes(e)&&this.isPredictionBoolean(i))return new ze(t,e,i);this.throwInvalidPredictionException(i,e)};validateFixtureFields=t=>{let e=Object.keys(t);e.forEach(a=>{dc.includes(a)||this.throwInvalidParamException([a])});let i=dc.filter(a=>{if(a!=="matchType"&&!e.includes(a))return a});i.length&&this.throwMissingFieldsException("fixtures",i),this.validatePredictionKey(t.market,t.prediction)};validateTiebreaker=t=>{let e=Object.keys(t);(!e.length||typeof t!="object")&&this.throwInvalidType("tiebreaker","object");let i=Object.keys(new gt)[0];e.forEach(a=>{i!==a&&this.throwInvalidParamException([a])}),e.includes(i)||this.throwMissingFieldsException("tiebreaker",[i]),typeof t.goldenGoal!="number"&&this.throwInvalidType("goldenGoal","number")};validatePredictionKey=(t,e)=>{if(typeof e=="object"){let i=Object.keys(e),a=["value"];if(i.length||this.throwMissingFieldsException("prediction",a),i.length===1&&!i.includes(a[0])&&this.throwInvalidParamException(i),i.length>1){bt.includes(t)&&a.push("playerId");let r=i.filter(o=>!a.includes(o));r.length&&this.throwInvalidParamException(r)}}else this.throwInvalidType("prediction","object")};validatePlayerId=(t,e)=>{let i="playerId";t!==Hi&&(e||this.throwInvalidParamException([i]),typeof e!="string"&&this.throwInvalidType(i,"string"))};validateMarket=t=>{Object.values(it).includes(t)||this.throwInvalidMarketException(t)};validateMarketTopX=t=>{t!=="CORRECT_SCORE"&&t!=="CORRECT_SCORE_ADVANCED"&&this.throwInvalidMarketException(t,"TOP_X")};isPredictionBoolean=t=>typeof t=="boolean";throwInvalidPredictionException=(t,e)=>{let i=Lc(t,e);throw this.errorHandlingMode==="default"?new y(400,"INVALID_PREDICTION",i):new m(400,"INVALID_TYPE",i)};throwInvalidMarketException=(t,e)=>{let i=null;throw e&&e==="TOP_X"?i=xc(t):i=gp(t),this.errorHandlingMode==="default"?new y(400,"INVALID_MARKET",i):new m(400,"INVALID_TYPE",i)};throwInvalidParamException=t=>{let e=Dc(t);throw this.errorHandlingMode==="default"?new y(400,"INVALID_FIELD",e):new m(400,"INVALID_TYPE",e)};throwMissingFieldsException=(t,e)=>{let i=Bc(t,e);throw this.errorHandlingMode==="default"?new y(400,"INVALID_FIELD",i):new m(400,"INVALID_TYPE",i)};throwInvalidType=(t,e)=>{let i=Nc(t,e);throw this.errorHandlingMode==="default"?new y(400,"INVALID_TYPE",i):new m(400,"INVALID_TYPE",i)}};var Kt=class{predictorHttps=null;predictorService=null;idMapping=null;clientHttps=null;predictorValidator=null;errorHandlingMode=null;constructor(t){this.predictorValidator=new Qt(t.errorHandlingMode),this.idMapping=new R(t),this.predictorHttps=new ut(t),this.predictorService=new St(t,this.idMapping),this.clientHttps=new W(t),this.errorHandlingMode=t.errorHandlingMode}getConfig=async()=>{let t=await this.clientHttps.getConfig("matchQuiz");return this.idMapping.idSchema!=="native"?await this.predictorService.remapCompetitionsFromConfig(t):t};play=async t=>{t=this.predictorValidator.validateBodyFields("MATCH_QUIZ",t);let e=t.fixtures.map(i=>this.predictorValidator.validateFixture(i.matchId,i.market,i.prediction.value,i.prediction.playerId));if(e&&e.length&&this.idMapping.idSchema!=="native"){let i=[],a=[];e.forEach(n=>{i.push(n.matchId),n instanceof ot&&n.prediction.playerId&&n.prediction.playerId!=="OWN_GOAL"&&a.push(n.prediction.playerId)});let r=await this.predictorService.remapMatchIdToNative(i),o={};a&&a.length>0&&(o=await this.predictorService.remapPlayerIdMapToNative(a)),e.forEach((n,l)=>{n.matchId=r[l],n instanceof ot&&n.prediction.playerId!=="OWN_GOAL"&&(n.prediction.playerId=o[n.prediction.playerId])})}return t.fixtures=e,await this.predictorHttps.makeFootballPrediction(t)};delete=async t=>await this.predictorHttps.deleteFootballPrediction(t);getGames=async(t,e)=>{e=e||!1;let i=this.predictorService.initGameFilters("MATCH_QUIZ",t),a=await this.predictorHttps.getGames(i,e);return await this.predictorService.remapMatchIdsFixtures(a)};getGamesNoRemap=async(t,e)=>{e=e||!1;let i=this.predictorService.initGameFilters("MATCH_QUIZ",t);return await this.predictorHttps.getGamesNoRemap(i,e)};getGameById=async(t,e)=>{e=e||!1;let i=await this.predictorHttps.getGameById(t,e);return await this.predictorService.remapMatchIdsFixtures(i)};getGamePredictions=async(t,e,i)=>(i=i||!1,e&&(e.type&&delete e.type,e.status&&delete e.status,e=new U(e)),await this.predictorHttps.getGamePredictions(t,i,e));getGameResults=async(t,e,i)=>{i=i||!1,e&&(e=new P(e));let a=await this.predictorHttps.getGameResults(t,i,e);return await this.predictorService.remapMatchIdsFixtures(a)};getCurrentGameResults=async t=>{t=t||!1;let e=new st(null);e.status="OPEN",e.type="MATCH_QUIZ";let i=await this.predictorHttps.getGames(e,t),a=this.predictorService.getCurrentGameId(i);return(await this.getGameResults(a,null,t)).data[0]};getMyGameEditions=async(t,e)=>{t&&t.limit&&this.validateLimitFilterOnGames(t.limit),e=e||!1;let i=this.predictorService.initGameTypePredictions("MATCH_QUIZ",t),a=[],r=await this.predictorHttps.getMyPredictionsNoRemap(i);if(r.data.length>0){r.data.forEach(p=>{p.game_instance_id&&a.push(p.game_instance_id)});let o=t?.limit?{limit:t.limit}:null,n=this.predictorService.initGameFilters("MATCH_QUIZ",o,a),l=await this.predictorHttps.getUserGameEditions(n,e);return await this.predictorService.addPredictionProp(r,l)}else return new H};getMyGamePrediction=async t=>{let e=new U({gameIds:[t]}),i=await this.predictorHttps.getMyPredictions(e);if(i.data.length>0){let a=i.data.filter(r=>r.gameInstanceId===t);return a.length?a[0]:null}return null};getUserGameEditions=async(t,e,i)=>{e&&e.limit&&this.validateLimitFilterOnGames(e.limit),i=i||!1;let a=this.predictorService.initGameTypePredictions("MATCH_QUIZ",e),r=[],o=await this.predictorHttps.getUserPredictionsNoRemap(t,a);if(o.data.length>0){o.data.forEach(c=>{c.game_instance_id&&r.push(c.game_instance_id)});let n=e?.limit?{limit:e.limit}:null,l=this.predictorService.initGameFilters("MATCH_QUIZ",n,r),p=await this.predictorHttps.getUserGameEditions(l,i);return await this.predictorService.addPredictionProp(o,p)}else return new H};getUserGamePrediction=async(t,e,i)=>{i=i||!1;let a=new U({gameIds:[e]}),r=await this.predictorHttps.getUserPredictions(t,i,a);if(r.data.length>0){let o=r.data.filter(n=>n.gameInstanceId===e);return o.length?o[0]:null}else return null};getMarketsResultsForGame=async(t,e)=>{let i=await this.predictorHttps.getMarketResultsForGame(t,e);return await this.predictorService.completeGameMarketResults(i,"MATCH_QUIZ")};getGameWinners=async(t,e)=>{let i=await this.predictorHttps.getContestWinners(t,e),a=await this.getGameById(t);return i.contestModel=a,this.predictorService.completeContestWinners(i)};validateLimitFilterOnGames=t=>{if(this.errorHandlingMode==="default"&&t>50)throw new y(400,"EXCEEDED_LENGTH","Maximum limit for filtering games is 50 or less.");if(this.errorHandlingMode==="standard"&&t>50)throw new m(400,"EXCEEDED_LENGTH","Maximum limit for filtering games is 50 or less.")}};var Il=class extends dt{remapClassicQuizzes=t=>(t.meta.pagination=this.remapMetaPagination(t.meta.pagination),t.data=t.data.map(e=>this.remapBasicClassicQuiz(e)),t);remapClassicQuizById=t=>{let e=new _o;return e.id=t.id,e.title=t.title,e.alternativeTitle=t.alternative_title,e.description=t.description,e.type=t.type,e.images=t.images,e.participationCount=t.participation_count,e.questionsCount=t.questions_count,e.status=t.status,e.language=t.language,e.authRequirement=t.auth_requirement,e.flags=t.flags,e.adContent=t.ad_content,e.rules=t.rules,e.customFields=t.custom_fields,e.branding=t.branding?this.remapBranding(t.branding):null,e.labels=t.labels,e.time=t.time,e.points=t.points,e.related=t.related?this.remapRelated(t.related):[],e.scored=t.scored,e.maxAttempts=t.max_attempts,e.context=t.context?this.remapContext(t.context):t.context,e.averageScore=t.average_score,e.perfectScore=t.perfect_score,e.questions=t.questions.map(i=>this.remapQuestions(i)),e.createdAt=t.created_at,e.updatedAt=t.updated_at,e};remapClassicQuizParticipation=t=>{let e=new Eo;return e.classicQuizId=t.classic_quiz_id,e.userId=t.user_id,e.questions=t.questions?t.questions.map(i=>this.remapParticipationQuestions(i)):null,e.correctOptions=t.correct_options,e.personalBest=t.personal_best,e.points=t.points,e.attempts=t.attempts,e};remapClassicQuizParticipationBody=t=>t.map(e=>({question_id:e.questionId,option_id:e.optionId}));remapUserClassicQuizParticipations=t=>t.map(e=>{let i=new Fo;return i.classicQuizId=e.classic_quiz_id,i.correct=e.correct,i.classicQuizQuestions=e.classic_quiz_questions,i.personalBest=e.personal_best,i.points=e.points,i.answers=e.answers?e.answers.map(a=>this.remapParticipationQuestions(a)):e.answers,i});remapClassicQuizzesLeaderboard=t=>(t.meta=this.remapClassicQuizLeaderboardMeta(t.meta),t.data=t.data.map(e=>this.remapClassicQuizLeaderboard(e)),t);remapClassicQuizUserRankings=t=>(t.meta.pagination=this.remapMetaPaginationRank(t.meta.pagination),t.data=t.data.map(e=>this.remapClassicQuizUserRanking(e)),t);remapClassicQuizQuestionsReport=t=>t.map(e=>{let i=new Co;return i.questionId=e.question_id,i.correct=e.correct,i.wrong=e.wrong,i.skipped=e.skipped,i.total=e.total,i});remapClassicQuizResultsSummary=t=>t.map(e=>{let i=new qo;return i.questions=e.questions,i.correctAnswers=e.correct_answers,i});remapMetaPagination=t=>{let e=new It;return e.itemsPerPage=t.items_per_page,e.nextPageStartsAfter=t.next_page_starts_after,e};remapClassicQuizLeaderboardMeta=t=>{let e=new Ue;return e.pagination=this.remapMetaPaginationRank(t.pagination),e.filters=this.remapLeaderboardMetaFilters(t.filters),e};remapMetaPaginationRank=t=>{let e=new Q;return e.currentPage=t.current_page,e.itemsPerPage=t.items_per_page,e.numberOfPages=t.number_of_pages,e.totalItems=t.total_items,e};remapLeaderboardMetaFilters=t=>{let e=new ke;return e.classicQuizIds=t?.classic_quiz_ids||null,e};remapClassicQuizUserRanking=t=>{let e=new Oo;return e.position=t.position,e.classicQuizId=t.classic_quiz_id,e.points=t.points,e};remapBasicClassicQuiz=t=>{let e=new Be;return e.id=t.id,e.title=t.title,e.alternativeTitle=t.alternative_title,e.description=t.description,e.type=t.type,e.images=t.images,e.participationCount=t.participation_count,e.questionsCount=t.questions_count,e.status=t.status,e.language=t.language,e.authRequirement=t.auth_requirement,e.flags=t.flags,e.customFields=t.custom_fields,e.branding=t.branding?this.remapBranding(t.branding):null,e.labels=t.labels,e.time=t.time,e.related=t.related?this.remapRelated(t.related):[],e.averageScore=t.average_score,e.perfectScore=t.perfect_score,e.points=t.points,e.scored=t.scored,e.maxAttempts=t.max_attempts,e.context=t.context?this.remapContext(t.context):t.context,e.adContent=t.ad_content,e.createdAt=t.created_at,e.updatedAt=t.updated_at,e};remapQuestions=t=>{let e=new Po;return e.questionId=t.question_id,e.question=t.question,e.images=t.images,e.embedCode=t.embed_code,e.explanation=t.explanation,e.options=t.options.map(i=>this.remapOptions(i)),e};remapOptions=t=>{let e=new To;return e.optionId=t.option_id,e.option=t.option,e.images=t.images,e.correct=t.correct,e};remapParticipationQuestions=t=>{let e=new Ro;return e.questionId=t.question_id,e.optionId=t.option_id,e.correct=t.correct,e.correctOptionId=t.correct_option_id,e};remapClassicQuizLeaderboard=t=>{let e=new Ao;return e.position=t.position,e.profileId=t.profile_id,e.points=t.points,e};remapContext=t=>{let e=new He;return e.content=t.content,e.tags=t.tags?t.tags.map(i=>{let a=new $e;return a.id=i.id,a.type=i.type,a.source=i.source,a}):null,e.campaign=t.campaign,e};remapRelated=t=>t.map(e=>{let i=new K;return i.entityId=e.entity_id,i.entityType=e.entity_type,i.entityRelationship=e.entity_relationship,i})};var wl=class extends dt{remapEitherOrs=t=>(t.meta.pagination=this.remapMetaPagination(t.meta.pagination),t.data=t.data.map(e=>this.remapBasicEitherOr(e)),t);remapEitherOrById=t=>{let e=new xo;return e.id=t.id,e.title=t.title,e.alternativeTitle=t.alternative_title,e.description=t.description,e.type=t.type,e.images=t.images,e.status=t.status,e.language=t.language,e.authRequirement=t.auth_requirement,e.winningCondition=t.winning_condition,e.lives=t.lives,e.flags=t.flags,e.customFields=t.custom_fields,e.branding=t.branding?this.remapBranding(t.branding):null,e.labels=t.labels,e.time=t.time,e.related=t.related?this.remapRelated(t.related):[],e.context=t.context?this.remapContext(t.context):t.context,e.points=t.points?t.points.map(i=>this.remapPoints(i)):t.points,e.rules=t.rules,e.adContent=t.ad_content,e.totalParticipationsCount=t.total_participations_count,e.totalUsersCount=t.total_users_count,e.finishedParticipationsCount=t.finished_participations_count,e.averageStartedParticipationsCount=t.average_started_participations_count,e.averageFinishedParticipationsCount=t.average_finished_participations_count,e.createdAt=t.created_at,e.updatedAt=t.updated_at,e};remapEitherOrOwnStats=t=>{let e=new Bo;return e.eitherOrId=t.either_or_id,e.personalBest=t.personal_best,e.betterThan=t.better_than,e};remapEitherOrResults=t=>{let e=new $o;return e.standings=t.standings?t.standings.map(i=>this.remapResultsStandings(i)):t.standings,e.breakdown=t.breakdown?t.breakdown.map(i=>this.remapResultsBreakdown(i)):t.breakdown,e};remapEitherOrParticipation=t=>{let e=new No;return e.instanceId=t.instance_id,e.eitherOrId=t.either_or_id,e.gameStartedAt=t.game_started_at,e.currentStep=t.current_step,e.currentStreak=t.current_streak,e.remainingSteps=t.remaining_steps,e.currentLives=t.current_lives,e.currentPoints=t.current_points,e.personalBest=t.personal_best,e.participationCount=t.participation_count,e.finishedParticipationsCount=t.finished_participations_count,e.steps=t.steps?t.steps.map(i=>this.remapParticipationSteps(i)):t.steps,e};remapBasicEitherOr=t=>{let e=new Ve;return e.id=t.id,e.title=t.title,e.alternativeTitle=t.alternative_title,e.description=t.description,e.type=t.type,e.images=t.images,e.status=t.status,e.language=t.language,e.winningCondition=t.winning_condition,e.authRequirement=t.auth_requirement,e.lives=t.lives,e.flags=t.flags,e.related=t.related?this.remapRelated(t.related):[],e.customFields=t.custom_fields,e.branding=t.branding?this.remapBranding(t.branding):null,e.labels=t.labels,e.adContent=t.ad_content,e.context=t.context?this.remapContext(t.context):t.context,e.time=t.time,e.points=t.points?t.points.map(i=>this.remapPoints(i)):t.points,e.totalParticipationsCount=t.total_participations_count,e.totalUsersCount=t.total_users_count,e.finishedParticipationsCount=t.finished_participations_count,e.averageStartedParticipationsCount=t.average_started_participations_count,e.averageFinishedParticipationsCount=t.average_finished_participations_count,e.createdAt=t.created_at,e.updatedAt=t.updated_at,e};remapMetaPagination=t=>{let e=new It;return e.itemsPerPage=t.items_per_page,e.nextPageStartsAfter=t.next_page_starts_after,e};remapPoints=t=>{let e=new Do;return e.correctSteps=t.correct_steps,e.score=t.score,e};remapResultsStandings=t=>{let e=new Wo;return e.userId=t.user_id,e.personalBest=t.personal_best,e};remapResultsBreakdown=t=>{let e=new Ho;return e.rangeStartInclusive=t.range_start_inclusive,e.rangeEndInclusive=t.range_end_inclusive,e.totalUsers=t.total_users,e};remapParticipationSteps=t=>{let e=new Vo;return e.pairId=t.pair_id,e.userSelection=t.user_selection,e.correct=t.correct,e.played=t.played,e.timestamp=t.timestamp,e.optionOne=t.option_one,e.optionTwo=t.option_two,e};remapContext=t=>{let e=new He;return e.content=t.content,e.tags=t.tags?t.tags.map(i=>{let a=new $e;return a.id=i.id,a.type=i.type,a.source=i.source,a}):null,e.campaign=t.campaign,e};remapRelated=t=>t.map(e=>{let i=new K;return i.entityId=e.entity_id,i.entityType=e.entity_type,i.entityRelationship=e.entity_relationship,i})};var vi=class extends C{classicQuizRemapper=null;eitherOrRemapper=null;constructor(t){super(t,v(t.environment,"miniGames")),this.classicQuizRemapper=new Il,this.eitherOrRemapper=new wl}getClassicQuizzes=async(t,e)=>{let i=`/classic-quizzes${this.apiSignInUrl}`;t&&(i+=t.constructMainFiltersUrl()),i+=g(e)?f():"";let a="There was a problem with fetching classic quizzes",r=await this.fetchWithoutAuth(i,a);return this.classicQuizRemapper.remapClassicQuizzes(r)};getClassicQuizById=async(t,e,i)=>{let a=`/classic-quizzes/${t}${this.apiSignInUrl}`;e&&(a+=`&include_correct_options=${e}`),g(i)&&(a+=f());let r="There was a problem with fetching classic quiz by ID",o=await this.fetchWithoutAuth(a,r);return this.classicQuizRemapper.remapClassicQuizById(o.data)};participateInClassicQuiz=async(t,e,i)=>{let a=`/classic-quizzes/${t}/participate${this.apiSignInUrl}`,r=`There was a problem with participating in the following classic quiz: ${t}`,o="POST",n={questions:this.classicQuizRemapper.remapClassicQuizParticipationBody(e),include_correct_options:!!i},l=await this.fetchWithAuth(a,r,o,n);return this.classicQuizRemapper.remapClassicQuizParticipation(l.data)};getMyClassicQuizParticipations=async t=>{let e=`/classic-quizzes/participations${this.apiSignInUrl}`;t&&(e+=`${t.constructMainFiltersUrl()}`);let i="There was a problem with fetching user's own Classic Quiz participations",a=await this.fetchWithAuth(e,i);return this.classicQuizRemapper.remapUserClassicQuizParticipations(a.data)};getLeaderboardForClassicQuizzes=async(t,e)=>{let i=`/classic-quizzes/rank${this.apiSignInUrl}`;t&&(i+=`${t.constructMainFiltersUrl()}`),i+=g(e)?f():"";let a="There was a problem with fetching classic quizzes leaderboard",r=await this.fetchWithoutAuth(i,a);return this.classicQuizRemapper.remapClassicQuizzesLeaderboard(r)};getClassicQuizzesUserRanking=async(t,e,i)=>{let a=`/classic-quizzes/users/${t}/rank${this.apiSignInUrl}`;e&&(a+=`${e.constructMainFiltersUrl()}`),a+=g(i)?f():"";let r="There was a problem with fetching user's rankings for classic quizzes",o=await this.fetchWithoutAuth(a,r);return this.classicQuizRemapper.remapClassicQuizUserRankings(o)};getClassicQuizQuestionsReport=async t=>{let e=`/classic-quizzes/${t}/questions-report${this.apiSignInUrl}`,i=`There was a problem with fetching questions report for quiz: ${t}`,a=await this.fetchWithoutAuth(e,i);return this.classicQuizRemapper.remapClassicQuizQuestionsReport(a.data)};getClassicQuizResultsSummary=async(t,e)=>{let i=`/classic-quizzes/${t}/results-summary${this.apiSignInUrl}`;g(e)&&(i+=f());let a="There was a problem with fetching classic quiz results summary",r=await this.fetchWithoutAuth(i,a);return this.classicQuizRemapper.remapClassicQuizResultsSummary(r.data)};getEitherOrs=async(t,e)=>{let i=`/either-or${this.apiSignInUrl}`;t&&(i+=t.constructMainFiltersUrl()),i+=g(e)?f():"";let a="There was a problem with fetching list of Either/Ors",r=await this.fetchWithoutAuth(i,a);return this.eitherOrRemapper.remapEitherOrs(r)};getEitherOrById=async(t,e)=>{let i=`/either-or/${t}${this.apiSignInUrl}`;g(e)&&(i+=f());let a="There was a problem with fetching Either/Or by ID",r=await this.fetchWithoutAuth(i,a);return this.eitherOrRemapper.remapEitherOrById(r.data)};getMyEitherOrStats=async t=>{let e=`/either-or/${t}/own-stats${this.apiSignInUrl}`,i="There was a problem with fetching Either/Or own statistics",a=await this.fetchWithAuth(e,i);return this.eitherOrRemapper.remapEitherOrOwnStats(a.data)};getEitherOrResults=async(t,e)=>{let i=`/either-or/${t}/results${this.apiSignInUrl}${g(e)?f():""}`,a="There was a problem with fetching Either/Or results",r=await this.fetchWithoutAuth(i,a);return this.eitherOrRemapper.remapEitherOrResults(r.data)};participateInEitherOr=async(t,e)=>{let i=`/either-or/${t}/participate${this.apiSignInUrl}`,a="There was a problem with participating in Either/Or",r="POST",o=await this.fetchWithAuth(i,a,r,e);return this.eitherOrRemapper.remapEitherOrParticipation(o.data)}};var jt=class extends J{entityTypes=["competition","team","player"];constructor(t){super(t.errorHandlingMode)}validateFilters=t=>{!t.entityIds&&!t.entityType||(t.entityIds&&!t.entityType&&this.throwException(400,"invalid_filters","You need to use both 'entityIds' and 'entityType' filters together"),!t.entityIds&&t.entityType&&this.throwException(400,"invalid_filters","You need to use both 'entityIds' and 'entityType' filters together"),this.entityTypes.includes(t.entityType)||this.throwException(400,"invalid_filters","Invalid 'entityType' filter. Please use one of the following valid options: competition, team, or player"))}};var _l=class{idSchema=null;idMapping=null;validator=null;https=null;entityTypes=["competition","team","player"];profile=null;football=null;eitherOrTime=0;participationStartTimestamp=0;countdownTimer=0;intervalId=null;currentPairId="";constructor(t){this.idSchema=t.idSchema,this.idMapping=new R(t),this.validator=new jt(t),this.profile=new V(t),this.football=new tt(t),this.https=new vi(t)}finalizeMiniGamesFilters=async t=>{if(this.idSchema!=="native"&&t.entityIds&&t.entityIds.length>0){this.validator.validateFilters(t);let e=await this.idMapping.getEntityIdsBySchemaId(Array.from(t.entityIds),t.entityType,"native");t.entityIds=e[t.entityType]}};setProfileModelsForEitherOrStandings=async t=>{let e=t.standings.map(a=>a.userId);if(!e.length)return t;let i=await this.profile.getByIds(e);return t.standings.forEach(a=>a.userModel=i.find(r=>r.id===a.userId)||null),t};setProfileModelsForClassicQuizLeaderboards=async t=>{let e=t.map(a=>a.profileId);if(!e.length)return t;let i=await this.profile.getByIds(e);return t.forEach(a=>a.profileModel=i.find(r=>r.id===a.profileId)||null),t};defaultEitherOrParticipation=async(t,e)=>{if(!this.eitherOrTime&&!e){let r=await this.https.getEitherOrById(t,!0);this.eitherOrTime=r.time;let o=await this.https.participateInEitherOr(t,null);return this.participationStartTimestamp=Date.now(),o}let i=0;if(this.participationStartTimestamp)i=(Date.now()-this.participationStartTimestamp)/1e3;else{if(!this.eitherOrTime){let r=await this.https.getEitherOrById(t,!0);this.eitherOrTime=r.time}i=this.eitherOrTime+1}let a=this.createNewParticipation(i,e);try{let r=await this.https.participateInEitherOr(t,a);return!r.currentLives||!r.remainingSteps?this.resetDefaultParticipationTimers():this.participationStartTimestamp=Date.now(),r}catch(r){throw this.resetDefaultParticipationTimers(),r}};handleEitherOrParticipationWithCallback=async(t,e,i)=>e?await this.eitherOrParticipationWithCallback(t,e,i):await this.initialEitherOrParticipationWithCallback(t,i);initialEitherOrParticipationWithCallback=async(t,e)=>{let i=await this.https.getEitherOrById(t,!0);this.eitherOrTime=i.time;let a=await this.https.participateInEitherOr(t,null);return this.participationStartTimestamp=Date.now(),this.countdownTimer=this.eitherOrTime,this.setCurrentPairId(a),await this.handleEitherOrParticipationCallbackInterface(t,e),a};eitherOrParticipationWithCallback=async(t,e,i)=>{this.intervalId&&clearInterval(this.intervalId);let a=0;if(this.participationStartTimestamp)a=(Date.now()-this.participationStartTimestamp)/1e3;else{if(!this.eitherOrTime){let o=await this.https.getEitherOrById(t,!0);this.eitherOrTime=o.time}a=this.eitherOrTime+1}let r=this.createNewParticipation(a,e);try{let o=await this.https.participateInEitherOr(t,r);return!o.currentLives||!o.remainingSteps?(this.resetCallbackParticipationTimers(),i.onElapsedResponse(o),clearInterval(this.intervalId)):(this.participationStartTimestamp=Date.now(),this.countdownTimer=this.eitherOrTime,this.setCurrentPairId(o),await this.handleEitherOrParticipationCallbackInterface(t,i)),o}catch(o){throw this.resetCallbackParticipationTimers(),clearInterval(this.intervalId),o}};setCurrentPairId=t=>{this.currentPairId=t.steps.find(e=>!e.played).pairId||""};handleEitherOrParticipationCallbackInterface=async(t,e)=>{this.intervalId=setInterval(async()=>{if(this.countdownTimer>0)this.countdownTimer--,e.onTimerTick(this.countdownTimer);else{clearInterval(this.intervalId);let i=(Date.now()-this.participationStartTimestamp)/1e3,a={pair:this.currentPairId,answer:this.currentPairId.split("_")[0]},r=this.createNewParticipation(i,a),o=await this.eitherOrParticipationWithCallback(t,r,e);e.onElapsedResponse(o)}},1e3)};createNewParticipation=(t,e)=>{let i=new Go;return i.expired=t>this.eitherOrTime,i.time=Number(t.toFixed(3)),i.pair=e.pair,i.answer=e.answer,i};resetCallbackParticipationTimers=()=>{this.resetDefaultParticipationTimers(),this.countdownTimer=0,this.currentPairId=""};resetDefaultParticipationTimers=()=>{this.eitherOrTime=0,this.participationStartTimestamp=0};setContextTagsModels=async t=>{let e={competitions:[],teams:[],players:[]};if(t.forEach(i=>{i.context&&i.context.tags&&i.context.tags.length>0&&(e.competitions=[...e.competitions,...this.extractEntityIdsFromTags(i.context.tags,"competition")],e.competitions=Array.from(new Set(e.competitions)),e.teams=[...e.teams,...this.extractEntityIdsFromTags(i.context.tags,"team")],e.teams=Array.from(new Set(e.teams)),e.players=[...e.players,...this.extractEntityIdsFromTags(i.context.tags,"player")],e.players=Array.from(new Set(e.players)))}),e.competitions.length){let i=await this.football.footballFacade.getCompetitionsMapWithNativeIds(e.competitions);this.setModelsForContextTags(t,i,"competition")}if(e.teams.length){let i=await this.football.footballFacade.getTeamsMapWithNativeIds(e.teams);this.setModelsForContextTags(t,i,"team")}if(e.players.length){let i=await this.football.footballFacade.getPlayersMapWithNativeIds(e.players);this.setModelsForContextTags(t,i,"player")}};extractEntityIdsFromTags=(t,e)=>t.filter(i=>i.type===e).map(i=>i.id);setModelsForContextTags=(t,e,i)=>{t.forEach(a=>{a.context&&a.context.tags&&a.context.tags.length>0&&a.context.tags.forEach(r=>{r.type===i&&(r.model=i==="player"?e[r.id]:e.get(r.id),r.id=r.model.id)})})};setQuestionModelsInQuestionsReport=async(t,e)=>t.map(i=>(i.questionModel=e.questions.find(a=>a.questionId.toString()===i.questionId),i))};var Pl=class{https=null;service=null;activityService=null;idSchema=null;constructor(t){this.https=new vi(t),this.service=new _l(t),this.activityService=new Mt(t),this.idSchema=t.idSchema}getClassicQuizzes=async(t,e,i)=>{t&&(t=new wo(t),await this.service.finalizeMiniGamesFilters(t));let a=await this.https.getClassicQuizzes(t,i);if(e)await this.service.setContextTagsModels(a.data);else for(let r of a.data)await this.remapTags(r,"native",this.idSchema);return a};getClassicQuizById=async(t,e,i)=>{let a=await this.https.getClassicQuizById(t,e,i);return await this.service.setContextTagsModels([a]),a};participateInClassicQuiz=async(t,e,i)=>await this.https.participateInClassicQuiz(t,e,i);getMyClassicQuizParticipations=async t=>{t&&(t=new So(t));let e=await this.https.getMyClassicQuizParticipations(t),i=e.map(r=>r.classicQuizId),a=await this.getClassicQuizzes({classicQuizIds:i});return e.map(r=>{let o=a.data.find(n=>n.id===r.classicQuizId)||null;return{...r,classicQuizModel:o}})};getLeaderboardForClassicQuizzes=async(t,e)=>{t&&(t=new vo(t));let i=await this.https.getLeaderboardForClassicQuizzes(t,e);return i.data=await this.service.setProfileModelsForClassicQuizLeaderboards(i.data),i};getClassicQuizzesUserRanking=async(t,e,i)=>{e&&(e=new Ge(e));let a=await this.https.getClassicQuizzesUserRanking(t,e,i),r=a.data.map(n=>n.classicQuizId),o=await this.getClassicQuizzes({classicQuizIds:r});return a.data=a.data.map(n=>{let l=o.data.find(p=>p.id===n.classicQuizId)||null;return{...n,classicQuizModel:l}}),a};getClassicQuizQuestionsReport=async(t,e)=>{e=e||!1;let i=await this.https.getClassicQuizQuestionsReport(t),a=await this.getClassicQuizById(t,e,!0);return this.service.setQuestionModelsInQuestionsReport(i,a)};getClassicQuizResultsSummary=async(t,e)=>await this.https.getClassicQuizResultsSummary(t,e);getEitherOrs=async(t,e,i)=>{t&&(t=new Lo(t),await this.service.finalizeMiniGamesFilters(t));let a=await this.https.getEitherOrs(t,i);if(e)await this.service.setContextTagsModels(a.data);else for(let r of a.data)await this.remapTags(r,"native",this.idSchema);return a};getEitherOrById=async(t,e)=>{let i=await this.https.getEitherOrById(t,e);return await this.service.setContextTagsModels([i]),i};getMyEitherOrStats=async t=>await this.https.getMyEitherOrStats(t);getEitherOrResults=async(t,e)=>{let i=await this.https.getEitherOrResults(t,e);return await this.service.setProfileModelsForEitherOrStandings(i)};participateInEitherOr=async(t,e,i)=>i?await this.service.handleEitherOrParticipationWithCallback(t,e,i):await this.service.defaultEitherOrParticipation(t,e);calculateEitherOrResultPercentile=async(t,e)=>{if(e==null||isNaN(e)||e<0)return null;if(e===0)return e;let i=await this.getEitherOrResults(t,!0),a=i.breakdown.reduce((o,n)=>o+n.totalUsers,0),r=0;for(let o of i.breakdown)if(r+=o.totalUsers,e>=o.rangeStartInclusive&&e<=o.rangeEndInclusive)return parseFloat((r/a*100).toFixed(1));return null};remapTags=async(t,e,i)=>{if(this.idSchema!="native"&&t.context&&t.context.tags&&t.context.tags.length){let a=JSON.parse(JSON.stringify(t.context.tags)),r=await this.activityService.remapTagsIds(a,e,i);t.context.tags=r}}};var Yt=class{facade=null;constructor(t){this.facade=new Pl(t)}getClassicQuizzes=async(t,e,i)=>await this.facade.getClassicQuizzes(t,e,i);getClassicQuizById=async(t,e,i)=>await this.facade.getClassicQuizById(t,e,i);participateInClassicQuiz=async(t,e,i)=>await this.facade.participateInClassicQuiz(t,e,i);getMyClassicQuizParticipations=async t=>await this.facade.getMyClassicQuizParticipations(t);getLeaderboardForClassicQuizzes=async(t,e)=>await this.facade.getLeaderboardForClassicQuizzes(t,e);getClassicQuizzesUserRanking=async(t,e,i)=>await this.facade.getClassicQuizzesUserRanking(t,e,i);getClassicQuizQuestionsReport=async(t,e)=>await this.facade.getClassicQuizQuestionsReport(t,e);getClassicQuizResultsSummary=async(t,e)=>await this.facade.getClassicQuizResultsSummary(t,e);getEitherOrs=async(t,e,i)=>await this.facade.getEitherOrs(t,e,i);getEitherOrById=async(t,e)=>await this.facade.getEitherOrById(t,e);getMyEitherOrStats=async t=>await this.facade.getMyEitherOrStats(t);getEitherOrResults=async(t,e)=>await this.facade.getEitherOrResults(t,e);participateInEitherOr=async(t,e,i)=>await this.facade.participateInEitherOr(t,e,i);calculateEitherOrResultPercentile=async(t,e)=>await this.facade.calculateEitherOrResultPercentile(t,e)};var Xt=class{idMapping=null;predictorHttps=null;predictorService=null;predictorValidator=null;clientHttps=null;errorHandlingMode=null;constructor(t){this.idMapping=new R(t),this.errorHandlingMode=t.errorHandlingMode,this.predictorValidator=new Qt(t.errorHandlingMode),this.predictorHttps=new ut(t),this.predictorService=new St(t,this.idMapping),this.clientHttps=new W(t)}getConfig=async()=>{let t=await this.clientHttps.getConfig("topX");return this.idMapping.idSchema!=="native"?await this.predictorService.remapCompetitionsFromConfig(t):t};getGames=async(t,e)=>{e=e||!1;let i=this.predictorService.initGameFilters("TOP_X",t),a=await this.predictorHttps.getGames(i,e);return await this.predictorService.remapMatchIdsFixtures(a)};getGamesNoRemap=async(t,e)=>{e=e||!1;let i=this.predictorService.initGameFilters("TOP_X",t);return await this.predictorHttps.getGamesNoRemap(i,e)};getGameById=async(t,e)=>{e=e||!1;let i=await this.predictorHttps.getGameById(t,e);return await this.predictorService.remapMatchIdsFixtures(i)};getGamePredictions=async(t,e,i)=>(i=i||!1,e&&(e.type&&delete e.type,e.status&&delete e.status,e=new U(e)),await this.predictorHttps.getGamePredictions(t,i,e));getGameResults=async(t,e,i)=>{i=i||!1,e&&(e=new st(e));let a=await this.predictorHttps.getGameResults(t,i,e);return await this.predictorService.remapMatchIdsFixtures(a)};getCurrentGameResults=async t=>{t=t||!1;let e=new st(null);e.status="OPEN",e.type="TOP_X";let i=await this.predictorHttps.getGames(e,t),a=this.predictorService.getCurrentGameId(i);return(await this.getGameResults(a,null,t)).data[0]};play=async t=>{let e=new ei(t);if(e=this.predictorValidator.validateBodyFields("TOP_X",e),e.fixtures=e.fixtures.map(a=>this.predictorValidator.validateFixture(a.matchId,a.market,a.prediction.value)),this.idMapping.idSchema!=="native"){let a=[];e.fixtures.forEach(o=>a.push(o.matchId));let r=await this.predictorService.remapMatchIdToNative(a);e.fixtures.forEach(o=>o.matchId=r.shift())}let i=await this.predictorHttps.makeFootballPrediction(e);return i.fixtures.forEach(a=>{a.matchId=a.matchModel.id}),i};delete=async t=>await this.predictorHttps.deleteFootballPrediction(t);getMyGameEditions=async(t,e)=>{t&&t.limit&&this.validateLimitFilterOnGames(t.limit),e=e||!1;let i=this.predictorService.initGameTypePredictions("TOP_X",t),a=[],r=await this.predictorHttps.getMyPredictionsNoRemap(i);if(r.data.length>0){r.data.forEach(p=>{p.game_instance_id&&a.push(p.game_instance_id)});let o=t?.limit?{limit:t.limit}:null,n=this.predictorService.initGameFilters("TOP_X",o,a),l=await this.predictorHttps.getUserGameEditions(n,e);return await this.predictorService.addPredictionProp(r,l)}else return new H};getMyGamePrediction=async t=>{let e=new U({gameIds:[t]}),i=await this.predictorHttps.getMyPredictions(e);if(i.data.length>0){let a=i.data.filter(r=>r.gameInstanceId===t);return a.length?a[0]:null}return null};getUserGameEditions=async(t,e,i)=>{e&&e.limit&&this.validateLimitFilterOnGames(e.limit),i=i||!1;let a=this.predictorService.initGameTypePredictions("TOP_X",e),r=[],o=await this.predictorHttps.getUserPredictionsNoRemap(t,a);if(o.data.length>0){o.data.forEach(c=>{c.game_instance_id&&r.push(c.game_instance_id)});let n=e?.limit?{limit:e.limit}:null,l=this.predictorService.initGameFilters("TOP_X",n,r),p=await this.predictorHttps.getUserGameEditions(l,i);return await this.predictorService.addPredictionProp(o,p)}else return new H};getUserGamePrediction=async(t,e,i)=>{i=i||!1;let a=new U({gameIds:[e]}),r=await this.predictorHttps.getUserPredictions(t,i,a);if(r.data.length>0){let o=r.data.filter(n=>n.gameInstanceId===e);return o.length?o[0]:null}else return null};getMarketsResultsForGame=async(t,e)=>{let i=await this.predictorHttps.getMarketResultsForGame(t,e);return await this.predictorService.completeGameMarketResults(i,"TOP_X")};getGameWinners=async(t,e)=>{let i=await this.predictorHttps.getContestWinners(t,e),a=await this.getGameById(t);return i.contestModel=a,this.predictorService.completeContestWinners(i)};validateLimitFilterOnGames=t=>{if(this.errorHandlingMode==="default"&&t>50)throw new y(400,"EXCEEDED_LENGTH","Maximum limit for filtering games is 50 or less.");if(this.errorHandlingMode==="standard"&&t>50)throw new m(400,"EXCEEDED_LENGTH","Maximum limit for filtering games is 50 or less.")}};var Tl=class{idMappingService=null;profileNamespace=null;footballNamespace=null;topXFacade=null;matchQuizFacade=null;miniGamesNamespace=null;errorHandlingMode=null;constructor(t){this.idMappingService=new R(t),this.profileNamespace=new V(t),this.footballNamespace=new tt(t),this.topXFacade=new Xt(t),this.matchQuizFacade=new Kt(t),this.miniGamesNamespace=new Yt(t),this.errorHandlingMode=t.errorHandlingMode}remapTemplatesIds=async t=>{if(t.length>0){let e=[],i=[],a=[],r=[],o=[],n=[];t.forEach(c=>{c.teamIds&&c.teamIds.length>0&&(e=[...e,...c.teamIds]),c.matchIds&&c.matchIds.length>0&&(a=[...a,...c.matchIds]),c.competitionIds&&c.competitionIds.length>0&&(o=[...o,...c.competitionIds])});let l={team:e,match:a,competition:o},p=await this.idMappingService.idMappingFacade.getEntitiesByIds(l,"native",this.idMappingService.idSchema);return i=[...p.team],r=[...p.match],n=[...p.competition],t.forEach(c=>{c.teamIds&&c.teamIds.length>0&&(c.teamIds=c.teamIds.map(d=>d=p.team.shift())),c.matchIds&&c.matchIds.length>0&&(c.matchIds=c.matchIds.map(d=>d=p.match.shift())),c.competitionIds&&c.competitionIds.length>0&&(c.competitionIds=c.competitionIds.map(d=>d=p.competition.shift()))}),t}return t};remapTemplateGroupMatchIds=async t=>{if(t&&t.length>0){for(let e of t)if(!(!e.filters.matchIds||!e.filters.matchIds.every(a=>a))&&e.filters.matchIds.length>0){let a={match:Array.from(e.filters.matchIds)},r=await this.idMappingService.idMappingFacade.getEntitiesByIds(a,"native",this.idMappingService.idSchema);e.filters.matchIds=Array.from(r.match)}}};addProfileModelToLeaderboard=async t=>{if(t.length>0){let e=[],i=t.map(r=>r.profileId);if(!i.length)return t;let a=await this.profileNamespace.getByIds(i);return t.forEach(r=>{a.forEach(o=>{o.id===r.profileId&&(delete o.interests,r.profileModel=o)}),r.profileModel||(r.profileModel=null),e.push(r)}),e}return t};buildOldClientBadges=t=>{let e=new io;return e.general=this.extractEnabledBadgesId(t.general),e.predictor=this.extractEnabledBadgesId(t.predictor),e.topX=this.extractEnabledBadgesId(t.topX),e.matchQuiz=this.extractEnabledBadgesId(t.matchQuiz),e};buildNewClientBadges=t=>{let e=new ao;return e.predictor=this.extractEnabledBadgesId(t.predictor),e.topX=this.extractEnabledBadgesId(t.topX),e.matchQuiz=this.extractEnabledBadgesId(t.matchQuiz),e.games=this.extractEnabledBadgesId(t.games),e.football=this.extractEnabledBadgesId(t.football),e.classicQuizzes=this.extractEnabledBadgesId(t.classicQuizzes),e.eitherOr=this.extractEnabledBadgesId(t.eitherOr),e.discussions=this.extractEnabledBadgesId(t.discussions),e.potm=this.extractEnabledBadgesId(t.voting.potm),e.poll=this.extractEnabledBadgesId(t.voting.poll),e};initFilters=(t,e)=>{switch(e){case"loyalty":t&&(t=new so(t));break;case"rankings":t&&(t=new no(t));break;case"league_leaderboard":t&&(t=new oo(t))}return t};addProfileModelToHighestSuccessRate=async t=>{let e=t.map(a=>a.profileId);if(!e.length)return t;let i=await this.profileNamespace.getByIds(e);return t.map(a=>(i.forEach(r=>{r.id===a.profileId&&(delete r.interests,a.profileModel=r)}),a))};extractRankingsIdsMap=t=>{let e=[],i=[],a=[];return t.forEach(r=>{r.rankType==="GAME"&&r.gameType==="TOP_X"?e.push(r.id):r.rankType==="GAME"&&r.gameType==="MATCH_QUIZ"?i.push(r.id):r.rankType==="TEMPLATE"&&a.push(r.id)}),[e,i,a]};setModelsForUserRankings=(t,e,i,a)=>(a.data.forEach(r=>{r.gameType==="MATCH_QUIZ"&&e?r.model=e.filter(o=>o.id===r.id)[0]:r.gameType==="TOP_X"&&t?r.model=t.filter(o=>o.id===r.id)[0]:r.rankType==="TEMPLATE"&&i&&(r.model=i.filter(o=>o.id===r.id)[0])}),a);completeContestWinners=async t=>{if(t.userList&&t.userList.length){let e=t.userList.map(a=>a.profileId),i=await this.profileNamespace.getByIds(e);t.userList.forEach(a=>{let r=i.filter(o=>o.id===a.profileId)[0];delete r.interests,a.profileModel=r})}return t};validateEntitiesFollowsFilters=t=>{if(!t||(!t.footballCompetitions||!t.footballCompetitions.length)&&(!t.footballTeams||!t.footballTeams.length)&&(!t.footballPlayers||!t.footballPlayers.length))throw this.errorHandlingMode==="default"?new y(400,"invalid_filters","At least one of footballCompetitions, footballTeams or footballPlayers properties should be provided for filters."):new m(400,"invalid_filters","At least one of footballCompetitions, footballTeams or footballPlayers properties should be provided for filters.");if(t.footballCompetitions&&t.footballCompetitions.length>24||t.footballTeams&&t.footballTeams.length>24||t.footballPlayers&&t.footballPlayers.length>24)throw this.errorHandlingMode==="default"?new y(400,"EXCEEDED_LENGTH","Maximum length per entity should be 24 or less."):new m(400,"EXCEEDED_LENGTH","Maximum length per entity should be 24 or less.")};remapEntitiesFollowsFilters=async t=>{let e=JSON.parse(JSON.stringify(t)),i={},a={};e.footballCompetitions&&e.footballCompetitions.length&&(a.competition=e.footballCompetitions),e.footballTeams&&e.footballTeams.length&&(a.team=e.footballTeams),e.footballPlayers&&e.footballPlayers.length&&(a.player=e.footballPlayers);let r=await this.idMappingService.idMappingFacade.getEntitiesByIds(a,this.idMappingService.idSchema,"native");return Object.keys(r).forEach(o=>{o==="competition"?i.footballCompetitions=r[o]:o==="team"?i.footballTeams=r[o]:o==="player"&&(i.footballPlayers=r[o])}),i};addModelsToEntitiesFollows=async t=>{let e=[],i="fb:c:",a=new Map,r=[],o="fb:t:",n=new Map,l=[],p="fb:p:",c=null;return t.breakdown.forEach(d=>{d.id.includes(i)?e.push(d.id):d.id.includes(o)?r.push(d.id):d.id.includes(p)&&l.push(d.id)}),e.length&&(a=await this.footballNamespace.footballFacade.competitionsFacade.getCompetitionsMapWithNativeIds(e)),r.length&&(n=await this.footballNamespace.footballFacade.teamsFacade.getTeamsMapWithNativeIds(r)),l.length&&(c=await this.footballNamespace.footballFacade.playerFacade.getPlayersMapWithNativeIds(l)),t.breakdown.forEach(d=>{d.id.includes(i)?(d.model=a.get(d.id),d.id=d.model.id):d.id.includes(o)?(d.model=n.get(d.id),d.id=d.model.id):d.id.includes(p)&&(d.model=c[d.id],d.id=d.model.id)}),t};getMatchIdsFromGamesInTemplates=async(t,e)=>{if(t&&t.length>0){let o=Gt(t,100),n=[];if(e&&e.length===1){if(e.includes("TOP_X"))try{n=(await Promise.all(o.map(c=>this.topXFacade.getGamesNoRemap({gameIds:c,limit:c.length},!0)))).reduce((c,d)=>[...c,...d.data],[])}catch(p){throw console.error("There was a problem fetching match IDs from Top X games",p),p}if(e.includes("MATCH_QUIZ"))try{n=(await Promise.all(o.map(c=>this.matchQuizFacade.getGamesNoRemap({gameIds:c,limit:c.length},!0)))).reduce((c,d)=>[...c,...d.data],[])}catch(p){throw console.error("There was a problem fetching match IDs from Match Quiz games",p),p}}try{n=(await Promise.all(o.map(c=>{let d=this.topXFacade.getGamesNoRemap({gameIds:c,limit:c.length},!0),u=this.matchQuizFacade.getGamesNoRemap({gameIds:c,limit:c.length},!0);return Promise.all([d,u])}))).reduce((c,[d,u])=>[...c,...d.data,...u.data],[])}catch(p){throw console.error("There was a problem fetching match IDs from both Top X and Match Quiz games",p),p}let l=new Set;return n.forEach(p=>{p.fixtures.map(d=>d.match_id).forEach(d=>l.add(d))}),Array.from(l)}let i=[],a=100;try{for(let o of e){let n=!0,l="",p=0;for(;n;){let c,d={limit:a,startAfter:l};o==="TOP_X"?(c=await this.topXFacade.getGamesNoRemap(d,!0),i=[...i,...c.data],l=c.meta.pagination.next_page_starts_after||null):o==="MATCH_QUIZ"&&(c=await this.matchQuizFacade.getGamesNoRemap(d,!0),i=[...i,...c.data],l=c.meta.pagination.next_page_starts_after||null),n=!!l,p++,p>=5&&(n=!1)}}let r=new Set;return i.forEach(o=>{o.fixtures.map(l=>l.match_id).forEach(l=>r.add(l))}),Array.from(r)}catch(r){throw console.error("There was a problem fetching match IDs from games",r),r}};initMatchFiltersForTemplates=async(t,e)=>{let i=[],a=[],r=[],o=t.fromDate?this.reformatDate(t.fromDate):null,n=t.toDate?this.reformatDate(t.toDate,!0):null,l=500;if(t.competitionIds&&t.competitionIds.length>0&&(i=Array.from(t.competitionIds)),t.teamIds&&t.teamIds.length>0&&(a=Array.from(t.teamIds)),t.matchIds&&t.matchIds.length>0&&(r=Array.from(t.matchIds)),(t.gameIds&&t.gameIds.length>0||t.gameTypes&&t.gameTypes.length>0)&&(r=await this.getMatchIdsFromGamesInTemplates(t.gameIds,t.gameTypes)),e){let c=t.groups.find(u=>u.groupId===e);if(!c)throw this.errorHandlingMode==="default"?new y(400,"invalid_template_group_id","There is no group in this template with the provided groupId"):new m(400,"invalid_template_group_id","There is no group in this template with the provided groupId");if(!c.filters)throw this.errorHandlingMode==="default"?new y(400,"invalid_template_group_filters","The provided template group has no filters"):new m(400,"invalid_template_group_filters","The provided template group has no filters");o=c.filters.fromDate?this.reformatDate(c.filters.fromDate):null,n=c.filters.toDate?this.reformatDate(c.filters.toDate,!0):null;let d=c.filters.matchIds.every(u=>u);c.filters.matchIds.length>0&&d&&(r=Array.from(c.filters.matchIds))}return new ht({competitionIds:i,teamIds:a,matchIds:r,fromDate:o,toDate:n,limit:l})};reformatDate=(t,e)=>{let i=new Date(t);e&&i.setUTCHours(23,59,59);let a=i.toISOString();return a=a.slice(0,-5)+"Z",a};extractEnabledBadgesId=t=>{let e=[];return t.forEach(i=>{i.enabled&&e.push(i.id)}),e};addEntityModelToFootballBadges=async t=>{let e=[],i=[],a=[],r=[];if(t.football&&t.football.length>0&&(e=t.football.filter(n=>n.requirements.entityType.toLocaleLowerCase()==="competition").map(n=>n.requirements.entityId),i=t.football.filter(n=>n.requirements.entityType.toLocaleLowerCase()==="team").map(n=>n.requirements.entityId),a=t.football.filter(n=>n.requirements.entityType.toLocaleLowerCase()==="player").map(n=>n.requirements.entityId),r=t.football.filter(n=>n.requirements.entityType.toLocaleLowerCase()==="match").map(n=>n.requirements.entityId)),t.voting&&t.voting.poll&&t.voting.poll.length>0){let[n,l,p,c]=this.extractEntityIdsFromBadges(t.voting.poll);e=e.concat(n),e=Array.from(new Set(e)),i=i.concat(l),i=Array.from(new Set(i)),a=a.concat(p),a=Array.from(new Set(a)),r=r.concat(c),r=Array.from(new Set(r))}if(t.voting&&t.voting.potm&&t.voting.potm.length>0){let[n,l,p,c]=this.extractEntityIdsFromBadges(t.voting.potm);e=e.concat(n),e=Array.from(new Set(e)),i=i.concat(l),i=Array.from(new Set(i)),a=a.concat(p),a=Array.from(new Set(a)),r=r.concat(c),r=Array.from(new Set(r))}let o=await this.fetchFootballEntities(e,i,a,r);t.football&&t.football.length>0&&t.football.forEach(n=>{this.setEntityModelsFromMap(n.requirements,"competition",o.competitions),this.setEntityModelsFromMap(n.requirements,"team",o.teams),this.setEntityModelsFromObject(n.requirements,"player",o.players),this.setEntityModelsFromObject(n.requirements,"match",o.matches)}),t.voting&&t.voting.poll&&t.voting.poll.length>0&&t.voting.poll.forEach(n=>{this.setEntityModelsFromMap(n.requirements,"competition",o.competitions),this.setEntityModelsFromMap(n.requirements,"team",o.teams),this.setEntityModelsFromObject(n.requirements,"player",o.players),this.setEntityModelsFromObject(n.requirements,"match",o.matches)}),t.voting&&t.voting.potm&&t.voting.potm.length>0&&t.voting.potm.forEach(n=>{this.setEntityModelsFromMap(n.requirements,"competition",o.competitions),this.setEntityModelsFromMap(n.requirements,"team",o.teams),this.setEntityModelsFromObject(n.requirements,"player",o.players),this.setEntityModelsFromObject(n.requirements,"match",o.matches)})};setEntityModelsFromMap=(t,e,i)=>{t.entityType===e&&(t.entityModel=i&&i.get(t.entityId)||null,t.entityModel&&(t.entityId=t.entityModel.id))};setEntityModelsFromObject=(t,e,i)=>{t.entityType===e&&(t.entityModel=i[t.entityId]?i[t.entityId]:null,t.entityModel&&(t.entityId=t.entityModel.id))};fetchFootballEntities=async(t,e,i,a)=>{let r={competitions:null,teams:null,players:null,matches:null};if(t.length){let o=await this.footballNamespace.footballFacade.getCompetitionsMapWithNativeIds(t);r.competitions=o}if(e.length){let o=await this.footballNamespace.footballFacade.getTeamsMapWithNativeIds(e);r.teams=o}if(i.length){let o=await this.footballNamespace.footballFacade.getPlayersMapWithNativeIds(i);r.players=o}if(a.length){let o=await this.footballNamespace.footballFacade.getMatchesMapWithNativeIds(a);r.matches=o}return r};extractEntityIdsFromBadges=t=>{let e=t.filter(o=>o.requirements.entityType&&o.requirements.entityType.toLocaleLowerCase()==="competition").map(o=>o.requirements.entityId),i=t.filter(o=>o.requirements.entityType&&o.requirements.entityType.toLocaleLowerCase()==="team").map(o=>o.requirements.entityId),a=t.filter(o=>o.requirements.entityType&&o.requirements.entityType.toLocaleLowerCase()==="player").map(o=>o.requirements.entityId),r=t.filter(o=>o.requirements.entityType&&o.requirements.entityType.toLocaleLowerCase()==="match").map(o=>o.requirements.entityId);return[e,i,a,r]};addGameModelToGamesBadges=async t=>{if(!t.games||t.games.length===0)return;let e=this.getGameIdsFromGamesBadge(t.games,"top_x"),i=this.getGameIdsFromGamesBadge(t.games,"match_quiz"),a=this.getGameIdsFromGamesBadge(t.games,"classic_quiz"),r=this.getGameIdsFromGamesBadge(t.games,"either_or"),o=await this.fetchGamesEntities(e,i,a,r);t.games.forEach(n=>{n.requirements.specificGames&&n.requirements.specificGames.forEach(l=>{l.gameModel=o.find(p=>p.id===l.gameId)||null})})};getGameIdsFromGamesBadge=(t,e)=>{let i=t.filter(a=>a.requirements.specificGames?a.requirements.specificGames.some(r=>r.gameType.toLocaleLowerCase()===e):!1).map(a=>a.requirements.specificGames.map(r=>r.gameId));return Array.prototype.concat.apply([],i)};fetchGamesEntities=async(t,e,i,a)=>{let r=[];if(t.length){let o=await this.topXFacade.getGames({gameIds:t});r=[...r,...o.data]}if(e.length){let o=await this.matchQuizFacade.getGames({gameIds:e});r=[...r,...o.data]}if(i.length){let o=await this.miniGamesNamespace.getClassicQuizzes({classicQuizIds:i});r=[...r,...o.data]}if(a.length){let o=await this.miniGamesNamespace.getEitherOrs({eitherOrIds:a});r=[...r,...o.data]}return r}};var El=class{validate=(t,e)=>{t.market&&this.validateMarket(t.market,e),t.fromDate&&this.validateDate(t.fromDate,"fromDate",e),t.toDate&&this.validateDate(t.toDate,"toDate",e),t.usersCount&&this.validateNumberFilters(t.usersCount,"usersCount",e),t.minimumPredictions&&this.validateNumberFilters(t.minimumPredictions,"minimumPredictions",e)};validateMarket=(t,e)=>{if(!Object.keys(it).includes(t)){let a=gp(t);throw e==="default"?new y(400,"INVALID_MARKET",a):new m(400,"INVALID_MARKET",a)}};validateDate=(t,e,i)=>{let a=/^\d{4}-\d{2}-\d{2}$/;if(typeof t!="string")throw i==="default"?new y(400,"invalid_filters","You have provided invalid type. The valid type is "+`string for ${e} filter`):new m(400,"invalid_filters","You have provided invalid type. The valid type is "+`string for ${e} filter`);if(!a.test(t))throw i==="default"?new y(400,"invalid_filters","You have provided invalid value. The valid value is "+`YYYY-MM-DD for ${e}`):new m(400,"invalid_filters","You have provided invalid value. The valid value is "+`YYYY-MM-DD for ${e}`)};validateNumberFilters=(t,e,i)=>{let a=e==="usersCount"?1:0,r=e==="usersCount"?1e3:1e6;if(typeof t!="number")throw i==="default"?new y(400,"invalid_filters","You have provided invalid type. The valid type is "+`number for ${e} filter`):new m(400,"invalid_filters","You have provided invalid type. The valid type is "+`number for ${e} filter`);if(t<a||t>r)throw i==="default"?new y(400,"invalid_filters","You have provided invalid value. The valid value is "+`between ${a} and ${r}`):new m(400,"invalid_filters","You have provided invalid value. The valid value is "+`between ${a} and ${r}`)}};var Rl=class{limit=null;page=null;groupId=null;constructor(t){this.limit=t?.limit||null,this.page=t?.page||null,t?.groupId!==void 0&&console.warn("Warning: groupId filter property is deprecated and no longer supported by the API. This property will be removed in a future version. Please update your code accordingly.")}constructFiltersUrl(){let t="";return this.limit&&(t+="&",t+=`limit=${this.limit}`),this.page&&(t+="&",t+=`page=${this.page}`),t}};var Sl=class{config=null;clientHttps=null;loyaltyHttps=null;loyaltyService=null;profileFacade=null;loyaltyValidator=null;topXFacade=null;matchQuizFacade=null;predictorHttps=null;errorHandlingMode=null;football=null;constructor(t,e,i,a,r){this.config=t,this.clientHttps=e,this.loyaltyHttps=i,this.profileFacade=new wt(r,a),this.loyaltyService=new Tl(this.config),this.loyaltyValidator=new El,this.topXFacade=new Xt(t),this.matchQuizFacade=new Kt(t),this.predictorHttps=new ut(t),this.errorHandlingMode=t.errorHandlingMode,this.football=new tt(t)}getConfig=async()=>await this.clientHttps.getConfig("loyalty");getConfigV2=async t=>{let e=await this.clientHttps.getNewLoyaltyConfig(t);return await this.loyaltyService.addEntityModelToFootballBadges(e.rewards.badges),await this.loyaltyService.addGameModelToGamesBadges(e.rewards.badges),e};getClientBadges=async()=>{let t=await this.getConfig();return this.loyaltyService.buildOldClientBadges(t.rewards.badges)};getClientBadgesV2=async t=>{let e=await this.clientHttps.getNewLoyaltyConfig(t);return this.loyaltyService.buildNewClientBadges(e.rewards.badges)};getTemplates=async(t,e)=>{if(t&&(t=new lo(t)),this.config.idSchema==="native")return await this.loyaltyHttps.getTemplates(t,e);let i=await this.loyaltyHttps.getTemplates(t,e);i.data=await this.loyaltyService.remapTemplatesIds([...i.data]);for(let a of i.data)await this.loyaltyService.remapTemplateGroupMatchIds(a.groups);return i};getTemplateById=async(t,e)=>{let i=await this.loyaltyHttps.getTemplateById(t,e);if(this.config.idSchema==="native")return i;let a=await this.loyaltyService.remapTemplatesIds([i]);return await this.loyaltyService.remapTemplateGroupMatchIds(a[0].groups),a[0]};getLeaderboard=async(t,e,i)=>{e=this.loyaltyService.initFilters(e,"loyalty");let a=await this.loyaltyHttps.getLeaderboard(t,i,e);return a.data=await this.loyaltyService.addProfileModelToLeaderboard(a.data),a};getLeaderboardForGame=async(t,e,i)=>{e&&(e=new Rl(e));let a=await this.loyaltyHttps.getLeaderboardForGame(t,i,e);return a.data=await this.loyaltyService.addProfileModelToLeaderboard(a.data),a};getLeaderboardForLeague=async(t,e)=>{e=this.loyaltyService.initFilters(e,"league_leaderboard");let i=await this.loyaltyHttps.getLeaderboardForLeague(t,e);return i.data=await this.loyaltyService.addProfileModelToLeaderboard(i.data),i};getOwnRankings=async(t,e)=>{let{id:i}=await this.profileFacade.getOwn();return this.getUserRankings(i,t,e)};getUserRankings=async(t,e,i)=>{e=this.loyaltyService.initFilters(e,"rankings");let a=await this.loyaltyHttps.getUserRankings(t,e,i);return await this.getModelsForUserRankings(a)};getHighestSuccessRate=async(t,e)=>{t&&(t=new ro(t),this.loyaltyValidator.validate(t,this.errorHandlingMode));let i=await this.loyaltyHttps.getHighestSuccessRate(t,e);return this.loyaltyService.addProfileModelToHighestSuccessRate(i)};getTemplateWinners=async(t,e)=>{let i=await this.predictorHttps.getContestWinners(t,e),a=await this.getTemplateById(t);return i.contestModel=a,this.loyaltyService.completeContestWinners(i)};getEntitiesFollows=async(t,e)=>{this.loyaltyService.validateEntitiesFollowsFilters(t),this.config.idSchema!=="native"&&(t=await this.loyaltyService.remapEntitiesFollowsFilters(t));let i=await this.loyaltyHttps.getEntitiesFollows(t,e);return await this.loyaltyService.addModelsToEntitiesFollows(i)};getModelsForUserRankings=async t=>{let e=null,i=null,a=null,[r,o,n]=this.loyaltyService.extractRankingsIdsMap(t.data);if(n.length&&(e=(await this.getTemplates()).data.filter(p=>n.includes(p.id))),r.length){let l={gameIds:r};i=(await this.topXFacade.getGames(l)).data}if(o.length){let l={gameIds:o};a=(await this.matchQuizFacade.getGames(l)).data}return this.loyaltyService.setModelsForUserRankings(i,a,e,t)};getTemplateMatches=async(t,e,i)=>{let a=await this.getTemplateById(t,i);if((!a.competitionIds||a.competitionIds.length===0)&&(!a.teamIds||a.teamIds.length===0)&&(!a.matchIds||a.matchIds.length===0)&&(!a.gameIds||a.gameIds.length===0)&&(!a.gameTypes||a.gameTypes.length===0)&&(!a.groups||a.groups.length===0))return[];let r=await this.loyaltyService.initMatchFiltersForTemplates(a,e);return(await this.football.getMatches(r,i)).data}};var Jt=class{clientHttps=null;profileHttps=null;loyaltyHttps=null;loyaltyFacade=null;localCache=null;constructor(t){this.clientHttps=new W(t),this.profileHttps=new hi(t),this.loyaltyHttps=new Et(t),this.localCache=new pt().createLocalCacheInstance(t.idSchema),this.loyaltyFacade=new Sl(t,this.clientHttps,this.loyaltyHttps,this.profileHttps,this.localCache)}getConfig=async()=>await this.loyaltyFacade.getConfig();getConfigV2=async t=>await this.loyaltyFacade.getConfigV2(t);getClientBadges=async()=>await this.loyaltyFacade.getClientBadges();getClientBadgesV2=async t=>await this.loyaltyFacade.getClientBadgesV2(t);getTemplates=async(t,e)=>await this.loyaltyFacade.getTemplates(t,e);getTemplateById=async(t,e)=>await this.loyaltyFacade.getTemplateById(t,e);getLeaderboard=async(t,e,i)=>await this.loyaltyFacade.getLeaderboard(t,e,i);getLeaderboardForGame=async(t,e,i)=>await this.loyaltyFacade.getLeaderboardForGame(t,e,i);getLeaderboardForLeague=async(t,e)=>await this.loyaltyFacade.getLeaderboardForLeague(t,e);getOwnRankings=async(t,e)=>await this.loyaltyFacade.getOwnRankings(t,e);getUserRankings=async(t,e,i)=>await this.loyaltyFacade.getUserRankings(t,e,i);getHighestSuccessRate=async(t,e)=>await this.loyaltyFacade.getHighestSuccessRate(t,e);getTemplateWinners=async(t,e)=>await this.loyaltyFacade.getTemplateWinners(t,e);getEntitiesFollows=async(t,e)=>await this.loyaltyFacade.getEntitiesFollows(t,e);getTemplateMatches=async(t,e,i)=>await this.loyaltyFacade.getTemplateMatches(t,e,i)};var Fl=class{predictorHttps=null;clientHttps=null;idMapping=null;predictorService=null;predictorValidator=null;errorHandlingMode=null;constructor(t,e,i,a){this.predictorHttps=e,this.idMapping=a,this.clientHttps=i,this.errorHandlingMode=t.errorHandlingMode,this.predictorValidator=new Qt(t.errorHandlingMode),this.predictorService=new St(t,a)}makeFootballPrediction=async(t,e,i,a)=>{let r=this.predictorValidator.validateFixture(t,e,i,a),o=new je;if(this.idMapping.idSchema!=="native"){let n=r.matchId,l="",p=await this.predictorService.remapMatchIdToNative([n]);if(r.matchId=p[0],this.errorHandlingMode==="default"&&!r.matchId)throw new y(400,"INVALID_FIELD","Match id is invalid!").errorMessage();if(this.errorHandlingMode==="standard"&&!r.matchId)throw new m(400,"INVALID_FIELD","Match id is invalid!");if(r instanceof ot&&r.prediction.playerId!=="OWN_GOAL"){if(r.prediction.playerId&&(l=r.prediction.playerId,r.prediction.playerId=await this.predictorService.remapPlayerIdToNative([l])),this.errorHandlingMode==="default"&&r.market!==Hi&&!r.prediction.playerId)throw new y(400,"INVALID_FIELD","Player id is invalid!").errorMessage();if(this.errorHandlingMode==="standard"&&r.market!==Hi&&!r.prediction.playerId)throw new m(400,"INVALID_FIELD","Player id is invalid!")}o.fixtures=[r];let c=await this.predictorHttps.makeFootballPrediction(o);return c.fixtures.forEach(d=>{d.prediction.playerId&&d.prediction.playerId!=="OWN_GOAL"&&(d.prediction.playerId=l),d.matchId=n}),c}else return o.fixtures=[r],await this.predictorHttps.makeFootballPrediction(o)};getMatchSummary=async(t,e)=>{let i=await this.getMatchSummaryBase(t,e),a=JSON.parse(JSON.stringify(i.predictions)),r=await this.predictorService.remapPlayerIdToIdSchema(a);return i.predictions=r,i};getMarketSummary=async(t,e,i,a)=>{try{let r=await this.getMatchSummaryBase(t,a);return await this.predictorService.getMarketSummary(r,e,i)}catch(r){throw r}};getMatchSummaryBase=async(t,e)=>{if(this.idMapping.idSchema!=="native"){let a=(await this.predictorService.remapMatchIdToNative([t]))[0],r=await this.predictorHttps.getMatchSummary(a,e);return r.matchId=t,r}else return await this.predictorHttps.getMatchSummary(t,e)};getConfig=async()=>{let t=await this.clientHttps.getConfig("predictor");return this.idMapping.idSchema!=="native"?await this.predictorService.remapCompetitionsFromConfig(t):t};deleteFootballPrediction=async t=>await this.predictorHttps.deleteFootballPrediction(t);getMyPredictions=async t=>{let e=this.predictorService.initPredictionsFilters(t,"user");return await this.predictorHttps.getMyPredictions(e)};getMyPredictionsForMatches=async(t,e)=>{if(this.errorHandlingMode==="default"&&this.predictorService.areIdsExceeded(t))throw new y(400,"EXCEEDED_LENGTH","Maximum matchIds in PredictionFilters should be 10 or less.").errorMessage();if(this.errorHandlingMode==="standard"&&this.predictorService.areIdsExceeded(t))throw new m(400,"EXCEEDED_LENGTH","Maximum matchIds in PredictionFilters should be 10 or less.");this.idMapping.idSchema!=="native"&&(t=await this.predictorService.remapMatchIdToNative([...t]));let i=this.predictorService.initPredictionsFilters(e,"matches",t);return await this.predictorHttps.getMyPredictions(i)};getMyCurrentPredictions=async t=>{let e=this.predictorService.initPredictionsFilters(t,"current");return await this.predictorHttps.getMyPredictions(e)};getMyPastPredictions=async t=>{let e=this.predictorService.initPredictionsFilters(t,"past");return await this.predictorHttps.getMyPredictions(e)};getUserPredictions=async(t,e,i)=>{let a=this.predictorService.initPredictionsFilters(e,"user");return await this.predictorHttps.getUserPredictions(t,i,a)};getUserCurrentPredictions=async(t,e,i)=>{let a=this.predictorService.initPredictionsFilters(e,"current");return await this.predictorHttps.getUserPredictions(t,i,a)};getUserPastPredictions=async(t,e,i)=>{let a=this.predictorService.initPredictionsFilters(e,"past");return await this.predictorHttps.getUserPredictions(t,i,a)};getUserPredictionsForMatches=async(t,e,i,a)=>{if(this.errorHandlingMode==="default"&&this.predictorService.areIdsExceeded(e))throw new y(400,"EXCEEDED_LENGTH","Maximum matchIds in PredictionFilters should be 10 or less.").errorMessage();if(this.errorHandlingMode==="standard"&&this.predictorService.areIdsExceeded(e))throw new m(400,"EXCEEDED_LENGTH","Maximum matchIds in PredictionFilters should be 10 or less.");this.idMapping.idSchema!=="native"&&(e=await this.predictorService.remapMatchIdToNative([...e]));let r=this.predictorService.initPredictionsFilters(i,"matches",e);return await this.predictorHttps.getUserPredictions(t,a,r)};getPredictionById=async t=>await this.predictorHttps.getPredictionById(t);getPredictionsByIds=async t=>await this.predictorHttps.getPredictionsByIds(t);getMatchMarketsResults=async t=>(this.idMapping.idSchema!=="native"&&(t=(await this.predictorService.remapMatchIdToNative([t]))[0]),await this.predictorService.getMatchMarketsResults(t))};var Cl=class extends J{constructor(t){super(t.errorHandlingMode)}validateMatchSummary=t=>{t||this.throwException(400,"invalid_match_summary","Match summary is required."),t.predictions||this.throwException(400,"invalid_match_summary_predictions","Predictions in match summary are required."),(!t.predictions.correctScore||!t.predictions.correctScoreAdvanced)&&this.throwException(400,"invalid_match_summary_predictions_keys","Keys in predictions in match summary are invalid. The valid ones are: "+"correctScore and correctScoreAdvanced")}};var vl=class{validator=null;constructor(t){this.validator=new Cl(t)}calculateOneXTwoFromScores=t=>{this.validator.validateMatchSummary(t);let{correctScore:e,correctScoreAdvanced:i}=t.predictions,a={...e,...i},r=0,o=0,n=0,l=0;return Object.entries(a).forEach(([p,c])=>{if(c===0)return;let d=c;r+=d;let[u,b]=p.split(":").map(Number);u>b?o+=d:u===b?n+=d:l+=d}),{home:r?Math.round(o/r*100):0,draw:r?Math.round(n/r*100):0,away:r?Math.round(l/r*100):0}};getTopCorrectScores=t=>{this.validator.validateMatchSummary(t);let{correctScore:e,correctScoreAdvanced:i}=t.predictions,a={...e,...i},r=0;return Object.values(a).forEach(o=>{r+=o}),Object.entries(a).filter(([o,n])=>n>0).map(([o,n])=>({score:o,percentage:Math.round(n/r*100)})).sort((o,n)=>n.percentage-o.percentage).slice(0,3)}};var Ai=class{predictorHttps=null;clientHttps=null;predictorFacade=null;idMapping=null;helpers=null;constructor(t){this.idMapping=new R(t),this.predictorHttps=new ut(t),this.clientHttps=new W(t),this.predictorFacade=new Fl(t,this.predictorHttps,this.clientHttps,this.idMapping),this.helpers=new vl(t)}makeFootballPrediction=async(t,e,i,a)=>await this.predictorFacade.makeFootballPrediction(t,e,i,a);getMatchSummary=async(t,e)=>await this.predictorFacade.getMatchSummary(t,e);getMarketSummary=async(t,e,i,a)=>await this.predictorFacade.getMarketSummary(t,e,i,a);getConfig=async()=>await this.predictorFacade.getConfig();deleteFootballPrediction=async t=>await this.predictorFacade.deleteFootballPrediction(t);getMyPredictions=async t=>await this.predictorFacade.getMyPredictions(t);getMyCurrentPredictions=async t=>await this.predictorFacade.getMyCurrentPredictions(t);getMyPastPredictions=async t=>await this.predictorFacade.getMyPastPredictions(t);getMyPredictionsForMatches=async(t,e)=>await this.predictorFacade.getMyPredictionsForMatches(t,e);getUserPredictions=async(t,e,i)=>await this.predictorFacade.getUserPredictions(t,e,i);getUserCurrentPredictions=async(t,e,i)=>await this.predictorFacade.getUserCurrentPredictions(t,e,i);getUserPastPredictions=async(t,e,i)=>await this.predictorFacade.getUserPastPredictions(t,e,i);getUserPredictionsForMatches=async(t,e,i,a)=>await this.predictorFacade.getUserPredictionsForMatches(t,e,i,a);getPredictionById=async t=>await this.predictorFacade.getPredictionById(t);getPredictionsByIds=async t=>await this.predictorFacade.getPredictionsByIds(t);getMatchMarketsResults=async t=>await this.predictorFacade.getMatchMarketsResults(t)};var Oi=class{loyalty=null;profile=null;predictor=null;constructor(t){this.loyalty=new Jt(t),this.profile=new V(t),this.predictor=new Ai(t)}setTemplateModels=async t=>{let e=await this.loyalty.getTemplates();t.templateModel=e.data.find(i=>i.id===t.templateId),t.pastTemplates&&t.pastTemplates.length>0&&t.pastTemplates.forEach(i=>{i.model=e.data.find(a=>a.id===i.id)})};setTemplateModelsInLeagues=async t=>{if(!t.length)return;let e=await this.loyalty.getTemplates();t.forEach(i=>{i.templateModel=e.data.find(a=>a.id===i.templateId),i.pastTemplates&&i.pastTemplates.length>0&&i.pastTemplates.forEach(a=>{a.model=e.data.find(r=>r.id===a.id)})})};setTemplateModelsFromLeagueModels=(t,e)=>{if(e==="PRIVATE_LEAGUE"){t.forEach(i=>{i.templateModel=i.templateId===i.privateLeagueModel.templateId?i.privateLeagueModel.templateModel:i.privateLeagueModel.pastTemplates.find(a=>a.id===i.templateId).model});return}t.forEach(i=>{i.templateModel=i.templateId===i.challengeModel.templateId?i.challengeModel.templateModel:i.challengeModel.pastTemplates.find(a=>a.id===i.templateId).model})};setProfileModel=async t=>{let e=await this.profile.getById(t.profileId).getInfo();t.profileModel=e};setModelsForPredictions=async t=>{if(t.data.length){let e=t.data.map(o=>o.profileId),i=t.data.map(o=>o.predictionId),a=await this.getProfileModels(e),r=await this.getPredictionModels(i);t.data.forEach(o=>{o.profileModel=a.find(n=>n.id===o.profileId),o.predictionModel=r.find(n=>n.id===o.predictionId)})}return t};getProfileModels=async t=>await this.profile.getByIds(t);getPredictionModels=async t=>await this.predictor.getPredictionsByIds(t)};var Zt=class{idSchema=null;profile=null;validator=null;idMapping=null;constructor(t){this.idSchema=t.idSchema,this.profile=new V(t),this.validator=new jt(t),this.idMapping=new R(t)}finalizePostFullModel=async t=>{let e=t.map(a=>a.userId),i=await this.profile.getByIds(e);return t.map(a=>(a.userModel=this.extractModelById(i,a.userId),a))};finalizeTopDiscussionsFilters=async t=>{if(this.idSchema!=="native"&&t.entityIds&&t.entityIds.length>0){this.validator.validateFilters(t);let e=await this.idMapping.getEntityIdsBySchemaId(Array.from(t.entityIds),t.entityType,"native");t.entityIds=e[t.entityType]}};extractModelById=(t,e)=>{if(t.length){let i=t.find(a=>a.id===e);return i?(delete i.interests,i):null}return null}};var Al=class{factory=null;https=null;loyaltyHttps=null;profile=null;service=null;discussionsService=null;constructor(t){this.factory=new Fi,this.https=new Si(t),this.service=new Oi(t),this.loyaltyHttps=new Et(t),this.profile=new V(t),this.discussionsService=new Zt(t)}issue=async(t,e)=>{let i=this.factory.createRequestBodyFromParam(t,"ONE_VS_ONE"),a=await this.https.create(i,"CHALLENGE");await this.service.setTemplateModels(a);let r=await this.https.invite(a.id,[e]);return a.invites=[],a.invites.push(r[0]),a};update=async(t,e)=>{let i=this.factory.createUpdateRequestBodyFromParam(e,"ONE_VS_ONE"),a=await this.https.update(t,i,"CHALLENGE");return await this.service.setTemplateModels(a),a};updateTemplate=async(t,e,i)=>{let a=await this.https.updateLeagueTemplate(t,e,i,"CHALLENGE");return await this.service.setTemplateModels(a),a};delete=async t=>await this.https.delete(t,"CHALLENGE");getById=async(t,e)=>{let i=await this.https.getById(t,"CHALLENGE",e);return await this.service.setTemplateModels(i),i};getMyChallenges=async t=>{t=new nr(t);let e=await this.https.getMyLeagues(t,"CHALLENGE");return await this.service.setTemplateModelsInLeagues(e),e};accept=async t=>{let i=await this.https.accept(t,!0,"CHALLENGE");return await this.finalizeAcceptModel(i,!0)};reject=async t=>{let i=await this.https.accept(t,!1,"CHALLENGE");return await this.finalizeAcceptModel(i,!1)};leave=async t=>await this.https.leave(t,"CHALLENGE");finalizeAcceptModel=async(t,e)=>{if(e){let i=await this.getById(t.challengeId);t.challengeModel=i}return await this.service.setProfileModel(t),t};getMyChallengesStandings=async t=>{t&&(t=new sr(t));let e=await this.profile.getOwn().getInfo(),i=await this.loyaltyHttps.getUserRankingsForPrivateLeagueAndChallenges(e.id,"CHALLENGE",t);for(let a of i.data){let r=await this.getById(a.challengeId);a.challengeModel=r}return this.service.setTemplateModelsFromLeagueModels(i.data,"CHALLENGE"),i};getInvitations=async t=>{t=new Xe(t),t.type="ONE_VS_ONE";let e=await this.https.getInvitations("CHALLENGE",t);return await this.service.setTemplateModelsInLeagues(e.data),e};getReportedPosts=async(t,e)=>{e&&(e=new Je(e));let i=await this.https.getReportedPosts(t,e);return i.data=await this.discussionsService.finalizePostFullModel(i.data),i};getPredictions=async(t,e)=>{if(e){if(e.limit&&e.limit>20)throw new m(400,"invalid_limit","Invalid limit. The maximum limit is: "+20 .toString());e=new Ze(e)}let i=await this.https.getPredictions(t,e);return await this.service.setModelsForPredictions(i)};moderatePost=async(t,e)=>await this.https.moderatePost(t,e)};var Ol=class{facade=null;constructor(t){this.facade=new Al(t)}issue=async(t,e)=>await this.facade.issue(t,e);update=async(t,e)=>await this.facade.update(t,e);updateTemplate=async(t,e,i)=>await this.facade.updateTemplate(t,e,i);delete=async t=>await this.facade.delete(t);getById=async(t,e)=>await this.facade.getById(t,e);getMyChallenges=async t=>await this.facade.getMyChallenges(t);accept=async t=>await this.facade.accept(t);reject=async t=>await this.facade.reject(t);leave=async t=>await this.facade.leave(t);getMyChallengesStandings=async t=>await this.facade.getMyChallengesStandings(t);getInvitations=async t=>await this.facade.getInvitations(t);getReportedPosts=async(t,e)=>await this.facade.getReportedPosts(t,e);getPredictions=async(t,e)=>await this.facade.getPredictions(t,e);moderatePost=async(t,e)=>await this.facade.moderatePost(t,e)};var Ll=class extends C{remapper=null;constructor(t){super(t,v(t.environment,"discussions")),this.remapper=new Ri}getAll=async(t,e)=>{let i="/discussions"+this.apiSignInUrl;t&&(i+=`${t.constructMainFiltersUrl()}`),g(e)&&(i+=f());let a="There was a problem getting discussions",r=await this.fetchWithoutAuth(i,a);return this.remapper.remapToDiscussions(r)};getById=async t=>{let e=`/discussions/${t}`+this.apiSignInUrl,i="There was a problem getting discussion",a=await this.fetchWithoutAuth(e,i);return this.remapper.remapToDiscussionById(a.data)};createPost=async(t,e)=>{let i=`/discussions/${t}/posts`+this.apiSignInUrl,a="There was a problem creating post in discussion",r="POST",o=await this.fetchWithAuth(i,a,r,e);return this.remapper.remapToPostByIdBasic(o.data)};getPostById=async t=>{let e=`/posts/${t}`+this.apiSignInUrl,i="There was a problem getting post by ID in discussion",a=await this.fetchWithoutAuth(e,i);return this.remapper.remapToPostByIdFull(a.data)};updatePost=async(t,e)=>{let i=`/posts/${t}`+this.apiSignInUrl,a="There was a problem editing post in discussion",r="PUT",o={content:e},n=await this.fetchWithAuth(i,a,r,o);return this.remapper.remapToPostByIdBasic(n.data)};reactToPost=async(t,e)=>{let i=`/posts/${t}/reaction`+this.apiSignInUrl,a="There was a problem reacting to post in discussion",r="PUT",o={reaction:e.toLocaleLowerCase()},n=await this.fetchWithAuth(i,a,r,o);return this.remapper.remapToPostByIdFull(n.data)};deletePost=async t=>{let e=`/posts/${t}`+this.apiSignInUrl,i="There was a problem deleting post in discussion",a="DELETE";return await this.fetchWithAuth(e,i,a),!0};getPosts=async(t,e)=>{let i=`/discussions/${t}/posts`+this.apiSignInUrl;e&&(i+=`${e.constructMainFiltersUrl()}`);let a="There was a problem getting posts in discussion",r=await this.fetchWithoutAuth(i,a);return this.remapper.remapToPostsForDiscussion(r,"full")};getPostReplies=async(t,e)=>{let i=`/posts/${t}/replies`+this.apiSignInUrl;e&&(i+=`${e.constructMainFiltersUrl()}`);let a="There was a problem getting post's replies in discussion",r=await this.fetchWithoutAuth(i,a);return this.remapper.remapToPostsForDiscussion(r,"full")};reportPost=async(t,e,i)=>{let a=`/posts/${t}/report`+this.apiSignInUrl,r="There was a problem reporting post in discussion",o="POST",n={reason:e.toLocaleUpperCase(),reason_details:i||null},l=await this.fetchWithAuth(a,r,o,n);return this.remapper.remapToPostByIdBasic(l.data)};getOwnPosts=async t=>{let e="/posts"+this.apiSignInUrl;t&&(e+=`${t.constructMainFiltersUrl()}`);let i="There was a problem getting own posts",a=await this.fetchWithAuth(e,i);return this.remapper.remapToPosts(a)};getUserPosts=async(t,e,i)=>{let a=`/posts/users/${t}`+this.apiSignInUrl;e&&(a+=`${e.constructMainFiltersUrl()}`),g(i)&&(a+=f());let r="There was a problem getting user's posts",o=await this.fetchWithoutAuth(a,r);return this.remapper.remapToPosts(o)};getPostsCount=async(t,e)=>{let i="/discussions/posts/count"+this.apiSignInUrl+`&discussion_ids=${t.join(",")}`;g(e)&&(i+=f());let a="There was a problem getting posts count for discussions",r=await this.fetchWithoutAuth(i,a);return this.remapper.remapToPostCount(r.data)};getTopDiscussions=async(t,e)=>{let i="/discussions/top"+this.apiSignInUrl;t&&(i+=`${t.constructMainFiltersUrl()}`),g(e)&&(i+=f());let a="There was a problem getting top discussions",r=await this.fetchWithoutAuth(i,a);return this.remapper.remapToDiscussions(r)};getPostsCountExtended=async t=>{let e="/discussions/posts/count"+this.apiSignInUrl,i={discussion_ids:Array.from(t)},a="POST",r="There was a problem getting posts count extended for discussions",o=await this.fetchWithoutAuth(e,r,a,i);return this.remapper.remapToPostCount(o.data)}};var xl=class{createRequestBodyFromParam=t=>{let e=new dr;return e.content=t.content,e.reply_id=t.replyId,e.discussion_label=t.discussionLabel,e.discussion_url=t.discussionUrl,e.anonymous_nickname=t.userNickname,e.context=t.context,e}};var Dl=class{idSchema=null;errorHandlingMode=null;https=null;clientHttps=null;activityService=null;service=null;factory=null;LIMIT_POSTS_COUNT=50;LIMIT_POSTS_COUNT_EXTENDED=250;constructor(t){this.idSchema=t.idSchema,this.errorHandlingMode=t.errorHandlingMode,this.https=new Ll(t),this.clientHttps=new W(t),this.activityService=new Mt(t),this.service=new Zt(t),this.factory=new xl}getAll=async(t,e)=>{t&&(t=new Mr(t));let i=await this.https.getAll(t,e);for(let a of i.data)await this.remapTags(a,"native",this.idSchema);return i};getById=async t=>{let e=await this.https.getById(t);return await this.remapTags(e,"native",this.idSchema),e};createPost=async(t,e)=>{let i=JSON.parse(JSON.stringify(e));await this.remapTags(i,this.idSchema,"native");let a=this.factory.createRequestBodyFromParam(i);return await this.https.createPost(t,a)};getPostById=async t=>{let e=await this.https.getPostById(t);return(await this.service.finalizePostFullModel([e]))[0]};updatePost=async(t,e)=>await this.https.updatePost(t,e);deletePost=async t=>await this.https.deletePost(t);getPosts=async(t,e)=>{e&&(e=new Ht(e));let i=await this.https.getPosts(t,e);return i.data=await this.service.finalizePostFullModel(i.data),i};getPostReplies=async(t,e)=>{e&&(e=new Ht(e));let i=await this.https.getPostReplies(t,e);return i.data=await this.service.finalizePostFullModel(i.data),i};reactToPost=async(t,e)=>{let i=await this.https.reactToPost(t,e);return(await this.service.finalizePostFullModel([i]))[0]};reportPost=async(t,e,i)=>await this.https.reportPost(t,e,i);getOwnPosts=async t=>(t&&(t=new Ht(t)),await this.https.getOwnPosts(t));getUserPosts=async(t,e,i)=>(e&&(e=new Ht(e)),await this.https.getUserPosts(t,e,i));getConfig=async()=>await this.clientHttps.getConfig("discussions");getPostsCount=async(t,e)=>{if(!t||!Array.isArray(t)||!t.length)throw this.errorHandlingMode==="standard"?new m(400,"invalid_discussion_ids","Invalid discussion ids argument. Please provide at least one discussion id in an array"):new y(400,"invalid_discussion_ids","Invalid discussion ids argument. Please provide at least one discussion id in an array");if(t.length>this.LIMIT_POSTS_COUNT)throw this.errorHandlingMode==="standard"?new m(400,"invalid_discussion_ids","Maximum number of discussion ids exceeded. The maximum number of discussion ids is 50. You can use 'getPostsCountExtended' method for more than 50 discussion ids."):new y(400,"invalid_discussion_ids","Maximum number of discussion ids exceeded. The maximum number of discussion ids is 50. You can use 'getPostsCountExtended' method for more than 50 discussion ids.");return await this.https.getPostsCount(t,e)};getTopDiscussions=async(t,e)=>{t&&(t=new Ir(t),await this.service.finalizeTopDiscussionsFilters(t));let i=await this.https.getTopDiscussions(t,e);for(let a of i.data)await this.remapTags(a,"native",this.idSchema);return i};getPostsCountExtended=async t=>{if(!t||!Array.isArray(t)||!t.length)throw this.errorHandlingMode==="standard"?new m(400,"invalid_discussion_ids","Invalid discussion ids argument. Please provide at least one discussion id in an array"):new y(400,"invalid_discussion_ids","Invalid discussion ids argument. Please provide at least one discussion id in an array");if(t.length>this.LIMIT_POSTS_COUNT_EXTENDED)throw this.errorHandlingMode==="standard"?new m(400,"invalid_discussion_ids","Maximum number of discussion ids exceeded. The maximum number of discussion ids is: "+this.LIMIT_POSTS_COUNT_EXTENDED):new y(400,"invalid_discussion_ids","Maximum number of discussion ids exceeded. The maximum number of discussion ids is: "+this.LIMIT_POSTS_COUNT_EXTENDED);return await this.https.getPostsCountExtended(t)};remapTags=async(t,e,i)=>{if(this.idSchema!="native"&&t.context&&t.context.tags&&t.context.tags.length){let a=JSON.parse(JSON.stringify(t.context.tags)),r=await this.activityService.remapTagsIds(a,e,i);t.context.tags=r}}};var Bl=class{facade=null;constructor(t){this.facade=new Dl(t)}getAll=async(t,e)=>await this.facade.getAll(t,e);getById=async t=>await this.facade.getById(t);createPost=async(t,e)=>await this.facade.createPost(t,e);getPostById=async t=>await this.facade.getPostById(t);updatePost=async(t,e)=>await this.facade.updatePost(t,e);deletePost=async t=>await this.facade.deletePost(t);getPosts=async(t,e)=>await this.facade.getPosts(t,e);getPostReplies=async(t,e)=>await this.facade.getPostReplies(t,e);react=async(t,e)=>await this.facade.reactToPost(t,e);reportPost=async(t,e,i)=>await this.facade.reportPost(t,e,i);getOwnPosts=async t=>await this.facade.getOwnPosts(t);getUserPosts=async(t,e,i)=>await this.facade.getUserPosts(t,e,i);getConfig=async()=>await this.facade.getConfig();getPostsCount=async(t,e)=>await this.facade.getPostsCount(t,e);getTopDiscussions=async(t,e)=>await this.facade.getTopDiscussions(t,e);getPostsCountExtended=async t=>await this.facade.getPostsCountExtended(t)};var Gd=["minutesPlayed","cleanSheets","concededGoals","saves","penaltySaved","penaltyCommitted","yellowCards","redCards","assists","foulsCommitted","ownGoals","goals","tackles","shotsOn"],Ud=new Map().set("minutesPlayed","Minutes Played").set("cleanSheets","Clean Sheets").set("concededGoals","Goals Conceded").set("saves","Saves").set("penaltySaved","Penalties Saved").set("penaltyCommitted","Penalties Committed").set("yellowCards","Yellow Cards").set("redCards","Red Cards").set("assists","Assists").set("foulsCommitted","Fouls Committed").set("ownGoals","Own Goals").set("goals","Goals").set("tackles","Tackles").set("shotsOn","Shots On Target"),Li=class{static createFantasyPrediction(t,e,i,a){let r=new ve;return r.template_id=t||null,r.group_id=e||null,r.fixtures=i?.map(o=>({player_id:o,match_type:"FOOTBALL",market:"PLAYER_PERFORMANCE",role:a?.get(o)?.toLocaleUpperCase()||null}))||[],r}static createFantasyPlayerStats(t){return Gd.map(e=>{let i=new Tr,a=t.data.reduce((r,o)=>r+o.stats[e],0);return i.key=e,i.label=Ud.get(e),i.value=a,i})}};var Nl=class{idMapping=null;idSchema=null;errorHandlingModel=null;football=null;constructor(t){this.idSchema=t.idSchema,this.errorHandlingModel=t.errorHandlingMode,this.football=new tt(t),this.idMapping=new R(t)}remapCompetitions=async t=>{let e={competition:t};return(await this.idMapping.idMappingFacade.getEntitiesByIds(e,"native",this.idSchema)).competition};remapPlayers=async(t,e,i,a)=>{let r={player:Array.from(t)},o=await this.idMapping.idMappingFacade.getEntitiesByIdsMap(r,e,i);if(a){let n=new Map;for(let[l,p]of Array.from(a.entries())){let c=o.get(l);c&&n.set(c,p)}a.clear();for(let[l,p]of Array.from(n.entries()))a.set(l,p)}return Array.from(o.values())};addPlayerModels=async t=>{let e=t.map(a=>a.playerId),i=await this.football.footballFacade.getPlayersMapWithNativeIds(e);return t.forEach(a=>{a.playerModel=Object.keys(i).length&&i[a.playerId]||null,a.playerId=a.playerModel?.id||a.playerId}),t};remapPlayerIdToNative=async t=>{let e=await this.idMapping.getEntityIdBySchemaId("player",t);if(e)return e.id;this.throwException(404,"id_mapping_not_found","No ID mappings are available for the provided ID. ID argument: "+t)};addMatchModels=async t=>{let e=t.map(a=>a.matchId),i=await this.football.footballFacade.getMatchesMapWithNativeIds(e);return t.forEach(a=>{a.matchModel=Object.keys(i).length&&i[a.matchId]||null,a.matchId=a.matchModel?.id||a.matchId}),t};throwException=(t,e,i)=>{throw this.errorHandlingModel==="standard"?new m(t,e,i):new y(t,e,i)}};var kl=class{idSchema=null;clientHttps=null;footballHttps=null;predictorHttps=null;loyaltyHttps=null;service=null;constructor(t){this.idSchema=t.idSchema,this.clientHttps=new W(t),this.footballHttps=new ct(t),this.service=new Nl(t),this.predictorHttps=new ut(t),this.loyaltyHttps=new Et(t)}getConfig=async()=>{let t=await this.clientHttps.getConfig("fantasy");return this.idSchema!=="native"&&(t.competitionsWhitelist=await this.service.remapCompetitions([...t.competitionsWhitelist])),t};getPlayersPoints=async(t,e,i)=>{let a=await this.footballHttps.getPlayersPoints(t,e,i);return a.data=await this.service.addPlayerModels(a.data),a};getPlayerDetailedStatistics=async(t,e,i)=>{let a="";this.idSchema!=="native"&&(a=await this.service.remapPlayerIdToNative(e));let r=await this.footballHttps.getPlayerDetailedStatistics(t,a||e,i);return r.meta.filters.playerId=e,r.data=await this.service.addMatchModels(r.data),r};play=async(t,e,i,a)=>{if((!i||!Array.isArray(i))&&this.service.throwException(400,"invalid_method_call","Invalid parameter provided. Please check the following parameter: "+"playerIds"),a){let o="playersRoles";a instanceof Map||this.service.throwException(400,"invalid_method_call","Invalid parameter provided. Please check the following parameter: "+o);let n=Array.from(a.keys());n.length||this.service.throwException(400,"invalid_method_call","Invalid parameter provided. Please check the following parameter: "+o),n.every(d=>!i.includes(d))&&this.service.throwException(400,"invalid_method_call","The keys in the players roles map are not part of the valid keys. The valid keys are: "+i.join(","));let p=Array.from(a.values()),c=["CAPTAIN","VICE_CAPTAIN"];p.every(d=>c.includes(d.toLocaleUpperCase()))||this.service.throwException(400,"invalid_method_call","The values in the map are not valid. The valid ones are: "+c.join(",")+". Case insensitive.")}let r=null;if(this.idSchema!=="native"){let o=await this.service.remapPlayers(i,this.idSchema,"native",a);r=Li.createFantasyPrediction(t,e,o,a)}else r=Li.createFantasyPrediction(t,e,i,a);return await this.predictorHttps.makeFootballPrediction(r)};getMyPrediction=async(t,e)=>{let i=`${t}_${e}`,a=new U(null);a.gameIds=[i];let r=await this.predictorHttps.getMyPredictions(a);return r.data.length===0?null:r.data[0]};getPlayerStatistics=async(t,e,i)=>{let a=await this.getPlayerDetailedStatistics(t,e,i);return Li.createFantasyPlayerStats(a)};getGameWeekStatistics=async t=>await this.loyaltyHttps.getTemplateBreakdownPoints(t)};var Gl=class{facade=null;constructor(t){this.facade=new kl(t)}getConfig=async()=>await this.facade.getConfig();getPlayersPoints=async(t,e,i)=>await this.facade.getPlayersPoints(t,e,i);getPlayerDetailedStatistics=async(t,e,i)=>await this.facade.getPlayerDetailedStatistics(t,e,i);play=async(t,e,i,a)=>await this.facade.play(t,e,i,a);getMyPrediction=async(t,e)=>await this.facade.getMyPrediction(t,e);getPlayerStatistics=async(t,e,i)=>await this.facade.getPlayerStatistics(t,e,i);getGameWeekStatistics=async t=>await this.facade.getGameWeekStatistics(t)};var Ul=class{configuration;constructor(t){this.configuration=t}getSDKConfiguration(){return this.configuration}};var Vl=class{remapToResponseModel=(t,e,i)=>{let a=new to;return a.meta.input=e,a.meta.output=i,t.size===0||(a.data=Array.from(t).map(([r,o])=>({input:r,output:o}))),a}};var Hl=class{errorHandlingModel=null;constructor(t){this.errorHandlingModel=t.errorHandlingMode}validate=(t,e,i)=>{(!t||!Array.isArray(t)||t.length===0)&&this.throwException(400,"invalid_ids","Invalid or empty IDs provided. Please provide at least one ID."),(!e||e!=="native"&&e!=="enetpulse"&&e!=="sportal365"&&e!=="sportradar"&&e!=="api_football")&&this.throwException(400,"invalid_input_provider","Invalid provider. The valid providers are: 'native', 'enetpulse', 'sportal365', 'sportradar' and 'api_football'."),(!i||i!=="native"&&i!=="enetpulse"&&i!=="sportal365"&&i!=="sportradar"&&i!=="api_football")&&this.throwException(400,"invalid_output_provider","Invalid provider. The valid providers are: 'native', 'enetpulse', 'sportal365', 'sportradar' and 'api_football'."),e===i&&this.throwException(400,"invalid_output_provider","Invalid output provider. The output can not be the same as the input provider.")};throwException=(t,e,i)=>{throw this.errorHandlingModel==="standard"?new m(t,e,i):new y(t,e,i)}};var $l=class{validator=null;idMappingFacade=null;factory=new Vl;constructor(t){this.validator=new Hl(t),this.idMappingFacade=new di(t)}getMappedFootballCountryIds=async(t,e,i)=>{this.validator.validate(t,e,i);let a={country:Array.from(t)},r=await this.idMappingFacade.getEntitiesByIdsMap(a,e,i);return this.factory.remapToResponseModel(r,e,i)};getMappedFootballCompetitionIds=async(t,e,i)=>{this.validator.validate(t,e,i);let a={competition:Array.from(t)},r=await this.idMappingFacade.getEntitiesByIdsMap(a,e,i);return this.factory.remapToResponseModel(r,e,i)};getMappedFootballTeamIds=async(t,e,i)=>{this.validator.validate(t,e,i);let a={team:Array.from(t)},r=await this.idMappingFacade.getEntitiesByIdsMap(a,e,i);return this.factory.remapToResponseModel(r,e,i)};getMappedFootballPlayerIds=async(t,e,i)=>{this.validator.validate(t,e,i);let a={player:Array.from(t)},r=await this.idMappingFacade.getEntitiesByIdsMap(a,e,i);return this.factory.remapToResponseModel(r,e,i)};getFootballMappedMatchIds=async(t,e,i)=>{this.validator.validate(t,e,i);let a={match:Array.from(t)},r=await this.idMappingFacade.getEntitiesByIdsMap(a,e,i);return this.factory.remapToResponseModel(r,e,i)}};var Wl=class{facade=null;constructor(t){this.facade=new $l(t)}getMappedFootballCountryIds=async(t,e,i)=>await this.facade.getMappedFootballCountryIds(t,e,i);getMappedFootballCompetitionIds=async(t,e,i)=>await this.facade.getMappedFootballCompetitionIds(t,e,i);getMappedFootballTeamIds=async(t,e,i)=>await this.facade.getMappedFootballTeamIds(t,e,i);getMappedFootballPlayerIds=async(t,e,i)=>await this.facade.getMappedFootballPlayerIds(t,e,i);getMappedFootballMatchIds=async(t,e,i)=>await this.facade.getFootballMappedMatchIds(t,e,i)};var ql=class{findLastGame=t=>{if(!Array.isArray(t)||t.length===0)return null;let e=t.filter(r=>r.status==="SETTLED").sort((r,o)=>new Date(o.predictionsCutoff).getTime()-new Date(r.predictionsCutoff).getTime());if(e.length>0)return e[0];let i=new Date,a=t.filter(r=>new Date(r.predictionsCutoff)<i).sort((r,o)=>new Date(o.predictionsCutoff).getTime()-new Date(r.predictionsCutoff).getTime());return a.length>0?a[0]:null};findNextGame=t=>{if(!Array.isArray(t)||t.length===0)return null;let e=this.findCurrentGame(t);if(!e)return null;let i=[...t].sort((r,o)=>new Date(r.predictionsCutoff).getTime()-new Date(o.predictionsCutoff).getTime()),a=new Date(e.predictionsCutoff).getTime();return i.find(r=>new Date(r.predictionsCutoff).getTime()>a)||null};findCurrentGame=t=>{if(!Array.isArray(t)||t.length===0)return null;let e=t.find(o=>o.status==="LIVE");if(e)return e;let i=t.find(o=>o.status==="OPEN");if(i)return i;let a=new Date;return t.filter(o=>new Date(o.predictionsCutoff)>a).sort((o,n)=>new Date(o.predictionsCutoff).getTime()-new Date(n.predictionsCutoff).getTime())[0]||null}};var xi=class{matchQuizFacade=null;helpers=new ql;constructor(t){this.matchQuizFacade=new Kt(t)}getConfig=async()=>await this.matchQuizFacade.getConfig();play=async t=>await this.matchQuizFacade.play(t);delete=async t=>await this.matchQuizFacade.delete(t);getGames=async(t,e)=>await this.matchQuizFacade.getGames(t,e);getGameById=async(t,e)=>await this.matchQuizFacade.getGameById(t,e);getGamePredictions=async(t,e,i)=>await this.matchQuizFacade.getGamePredictions(t,e,i);getGameResults=async(t,e,i)=>await this.matchQuizFacade.getGameResults(t,e,i);getCurrentGameResults=async t=>await this.matchQuizFacade.getCurrentGameResults(t);getMyGameEditions=async(t,e)=>await this.matchQuizFacade.getMyGameEditions(t,e);getMyGamePrediction=async t=>await this.matchQuizFacade.getMyGamePrediction(t);getUserGameEditions=async(t,e,i)=>await this.matchQuizFacade.getUserGameEditions(t,e,i);getUserGamePrediction=async(t,e,i)=>await this.matchQuizFacade.getUserGamePrediction(t,e,i);getMarketsResultsForGame=async(t,e)=>await this.matchQuizFacade.getMarketsResultsForGame(t,e);getGameWinners=async(t,e)=>await this.matchQuizFacade.getGameWinners(t,e)};var zl=class{findLastGame=t=>{if(!Array.isArray(t)||t.length===0)return null;let e=t.filter(r=>r.status==="SETTLED").sort((r,o)=>new Date(o.predictionsCutoff).getTime()-new Date(r.predictionsCutoff).getTime());if(e.length>0)return e[0];let i=new Date,a=t.filter(r=>new Date(r.predictionsCutoff)<i).sort((r,o)=>new Date(o.predictionsCutoff).getTime()-new Date(r.predictionsCutoff).getTime());return a.length>0?a[0]:null};findNextGame=t=>{if(!Array.isArray(t)||t.length===0)return null;let e=this.findCurrentGame(t);if(!e)return null;let i=[...t].sort((r,o)=>new Date(r.predictionsCutoff).getTime()-new Date(o.predictionsCutoff).getTime()),a=new Date(e.predictionsCutoff).getTime();return i.find(r=>new Date(r.predictionsCutoff).getTime()>a)||null};findCurrentGame=t=>{if(!Array.isArray(t)||t.length===0)return null;let e=t.find(o=>o.status==="LIVE");if(e)return e;let i=t.find(o=>o.status==="OPEN");if(i)return i;let a=new Date;return t.filter(o=>new Date(o.predictionsCutoff)>a).sort((o,n)=>new Date(o.predictionsCutoff).getTime()-new Date(n.predictionsCutoff).getTime())[0]||null}};var Di=class{topXFacade=null;helpers=new zl;constructor(t){this.topXFacade=new Xt(t)}getConfig=async()=>await this.topXFacade.getConfig();getGames=async(t,e)=>await this.topXFacade.getGames(t,e);getGameById=async(t,e)=>await this.topXFacade.getGameById(t,e);getGamePredictions=async(t,e,i)=>await this.topXFacade.getGamePredictions(t,e,i);getGameResults=async(t,e,i)=>await this.topXFacade.getGameResults(t,e,i);getCurrentGameResults=async t=>await this.topXFacade.getCurrentGameResults(t);play=async t=>await this.topXFacade.play(t);delete=async t=>await this.topXFacade.delete(t);getMyGameEditions=async(t,e)=>await this.topXFacade.getMyGameEditions(t,e);getMyGamePrediction=async t=>await this.topXFacade.getMyGamePrediction(t);getUserGameEditions=async(t,e,i)=>await this.topXFacade.getUserGameEditions(t,e,i);getUserGamePrediction=async(t,e,i)=>await this.topXFacade.getUserGamePrediction(t,e,i);getMarketsResultsForGame=async(t,e)=>await this.topXFacade.getMarketsResultsForGame(t,e);getGameWinners=async(t,e)=>await this.topXFacade.getGameWinners(t,e)};var Ql=class{remapUserVotes=t=>{let e=new zs;return e.meta=this.remapMeta(t.meta.pagination),e.data=t.data.map(i=>this.remapUserVoteModel(i)),e};remapResults=t=>{let e=new js;return e.meta=t.meta,e.data=t.data.map(i=>this.remapResultsModel(i)),e};remapMeta=t=>{let e=new w;return e.pagination.itemsPerPage=t.items_per_page,e.pagination.nextPageStartsAfter=t.next_page_starts_after,e};remapUserVoteModel=t=>{let e=new Qs;return e.matchId=t.match_id,e.playerId=t.player_id,e.createdAt=t.created_at,e};remapResultsModel=t=>{let e=new Ys;return e.teamId=t.team_id,e.playerId=t.player_id,e.votes=t.votes,e.winner=t.winner,e}};var Kl=class extends dt{remapPolls=t=>{let e=new $s;return e.meta.pagination=this.remapMetaPagination(t.meta.pagination),e.data=t.data.map(i=>this.remapPoll(i)),e};remapPollById=t=>{let e=new Gs;return e.id=t.id,e.title=t.title,e.alternativeTitle=t.alternative_title,e.description=t.description,e.type=t.type,e.images=t.images,e.status=t.status,e.language=t.language,e.authRequirement=t.auth_requirement,e.flags=t.flags,e.totalVotes=t.total_votes,e.customFields=t.custom_fields,e.related=t.related?this.remapRelated(t.related):[],e.branding=t.branding?this.remapBranding(t.branding):null,e.embedCode=t.embed_code,e.labels=t.labels,e.rules=t.rules,e.adContent=t.ad_content,e.options=t.options?this.remapOptions(t.options):[],e.context=t.context?this.remapContext(t.context):t.context,e.preferencesEnabled=t.preferences_enabled,e.multipleChoice=t.multiple_choice,e.maxMultipleChoiceOptions=t.max_multiple_choice_options,e.participationCount=t.participation_count,e.createdAt=t.created_at,e.updatedAt=t.updated_at,e};remapUserVote=t=>{let e=new ri;return e.id=t.id,e.pollId=t.poll_id,e.optionId=t.option_id,e.optionIds=t.option_ids,e.userId=t.user_id,e};remapPollsVotes=t=>{let e=new Ws;return e.meta.pagination=this.remapMetaPagination(t.meta.pagination),e.data=t.data.map(i=>this.remapPollVote(i)),e};remapPollVote=t=>{let e=new Hs;return e.id=t.id,e.pollId=t.poll_id,e.optionId=t.option_id,e.optionIds=t.option_ids,e.userId=t.user_id,e};remapMetaPagination=t=>{let e=new It;return e.itemsPerPage=t.items_per_page,e.nextPageStartsAfter=t.next_page_starts_after,e};remapPoll=t=>{let e=new ai;return e.id=t.id,e.title=t.title,e.alternativeTitle=t.alternative_title,e.description=t.description,e.type=t.type,e.images=t.images,e.status=t.status,e.language=t.language,e.authRequirement=t.auth_requirement,e.flags=t.flags,e.totalVotes=t.total_votes,e.customFields=t.custom_fields,e.related=t.related?this.remapRelated(t.related):[],e.branding=t.branding?this.remapBranding(t.branding):null,e.embedCode=t.embed_code,e.labels=t.labels,e.adContent=t.ad_content,e.options=t.options?this.remapOptions(t.options):[],e.context=t.context?this.remapContext(t.context):t.context,e.preferencesEnabled=t.preferences_enabled,e.multipleChoice=t.multiple_choice,e.maxMultipleChoiceOptions=t.max_multiple_choice_options,e.participationCount=t.participation_count,e.createdAt=t.created_at,e.updatedAt=t.updated_at,e};remapContext=t=>{let e=new Ct;return e.content=t.content,e.tags=t.tags?t.tags.map(i=>{let a=new Za;return a.id=i.id,a.type=i.type,a.source=i.source,a}):null,e.campaign=t.campaign,e};remapRelated=t=>t.map(e=>{let i=new K;return i.entityId=e.entity_id,i.entityType=e.entity_type,i.entityRelationship=e.entity_relationship,i});remapOptions=t=>t.map(e=>{let i=new Us;return i.id=e.id,i.title=e.title,i.description=e.description,i.images=e.images,i.votes=e.votes,i.embedCode=e.embed_code,i.preferencesMapping=e.preferences_mapping?this.remapPreferencesMapping(e.preferences_mapping):[],i});remapPreferencesMapping=t=>t.map(e=>{let i=new Vs;return i.preferenceId=e.preference_id,i})};var jl=class extends C{pollRemapper=null;playerOfTheMatchRemapper=null;constructor(t){super(t,v(t.environment,"voting")),this.pollRemapper=new Kl,this.playerOfTheMatchRemapper=new Ql}getPolls=async(t,e)=>{let i=`/polls${this.apiSignInUrl}`;t&&(i+=t.constructMainFiltersUrl()),g(e)&&(i+=f());let a="There was a problem fetching polls",r=await this.fetchWithoutAuth(i,a);return this.pollRemapper.remapPolls(r)};getPollById=async(t,e)=>{let i=`/polls/${t}${this.apiSignInUrl}`;g(e)&&(i+=f());let a="There was a problem fetching the following poll: "+t,r=await this.fetchWithoutAuth(i,a);return this.pollRemapper.remapPollById(r.data)};voteForPoll=async(t,e)=>{let i=`/polls/${t}/votes${this.apiSignInUrl}`,a="PUT",r={option_ids:e},o="There was a problem voting for the following poll: "+t,n=await this.fetchWithAuth(i,o,a,r);return this.pollRemapper.remapUserVote(n.data)};deleteVoteForPoll=async t=>{let e=`/polls/${t}/votes${this.apiSignInUrl}`,i="DELETE",a="There was a problem deleting vote for the following poll: "+t;return await this.fetchWithAuth(e,a,i),!0};getMyPollVote=async t=>{let e=`/polls/${t}/votes${this.apiSignInUrl}`,i="There was a problem fetching user's own vote for the following poll: "+t,a=await this.fetchWithAuth(e,i);return this.pollRemapper.remapPollVote(a.data)};getMyPollsVotes=async t=>{let e=`/polls/votes${this.apiSignInUrl}`;t&&(e+=t.constructMainFiltersUrl());let i="There was a problem fetching user's votes for polls",a=await this.fetchWithAuth(e,i);return this.pollRemapper.remapPollsVotes(a)};voteForPlayerOfTheMatch=async(t,e)=>{let i=`/football/potm/${t}${this.apiSignInUrl}`,a="PUT",r={player_id:e},o="There was a problem voting for 'Player of the match'";return{playerId:(await this.fetchWithAuth(i,o,a,r)).data.player_id}};deleteVoteForPlayerOfTheMatch=async t=>{let e=`/football/potm/${t}${this.apiSignInUrl}`,i="DELETE",a="There was a problem with deleting vote for 'Player of the match'";await this.fetchWithAuth(e,a,i)};getOwnVotesForPlayerOfTheMatch=async t=>{let e=`/football/potm${this.apiSignInUrl}`;t&&(e+=t.constructFiltersUrl());let i="There was a problem fetching user's own votes for 'Player of the match'",a=await this.fetchWithAuth(e,i);return this.playerOfTheMatchRemapper.remapUserVotes(a)};getResultsForPlayerOfTheMatch=async(t,e)=>{let i=`/football/potm/${t}${this.apiSignInUrl}${g(e)?f():""}`,a="There was a problem fetching results for 'Player of the match'",r=await this.fetchWithoutAuth(i,a);return this.playerOfTheMatchRemapper.remapResults(r)}};var Yl=class{idMappingService=null;idSchema=null;errorHandlingMode=null;validator=null;activityService=null;football=null;constructor(t){this.idSchema=t.idSchema,this.errorHandlingMode=t.errorHandlingMode,this.idMappingService=new R(t),this.validator=new jt(t),this.activityService=new Mt(t),this.football=new tt(t)}finalizePollsFilters=async t=>{if(this.idSchema!=="native"&&t.entityIds&&t.entityIds.length>0){this.validator.validateFilters(t);let e=await this.idMappingService.getEntityIdsBySchemaId(Array.from(t.entityIds),t.entityType,"native");t.entityIds=e[t.entityType]}};remapTags=async(t,e,i)=>{if(this.idSchema!="native"&&t.context&&t.context.tags&&t.context.tags.length){let a=JSON.parse(JSON.stringify(t.context.tags)),r=await this.activityService.remapTagsIds(a,e,i);t.context.tags=r}};remapMatchAndPlayerIds=async(t,e,i,a)=>{let r={match:[t],player:[e]},o=await this.idMappingService.idMappingFacade.getEntitiesByIds(r,i,a);if(o.match.length>0&&o.player.length>0){let n=o.match[0],l=o.player[0];return[n,l]}throw this.errorHandlingMode==="default"?new y(404,"entity_ids_not_found","Some of the sport entity IDs were not found for the provided id schema"):new m(404,"entity_ids_not_found","Some of the sport entity IDs were not found for the provided id schema")};remapMatchIds=async(t,e,i)=>{let a=Array.from(t),r={match:t},o=await this.idMappingService.idMappingFacade.getEntitiesByIds(r,e,i);if(o.match.length>0&&o.match.length===a.length)return o.match;throw this.errorHandlingMode==="default"?new y(404,"match_ids_not_found","Some of the match IDs were not found for the provided id schema"):new m(404,"match_ids_not_found","Some of the match IDs were not found for the provided id schema")};setModelsForUserVotes=async t=>{let e=t.data.map(a=>a.matchId),i=t.data.map(a=>a.playerId);if(e.length>0&&i.length>0){let a=await this.football.footballFacade.getMatchesMapWithNativeIds(e),r=await this.football.footballFacade.getPlayersMapWithNativeIds(i);t.data.forEach(o=>{o.matchModel=a[o.matchId]||null,o.playerModel=r[o.playerId]||null,o.matchId=o.matchModel?o.matchModel.id:o.matchId,o.playerId=o.playerModel?o.playerModel.id:o.playerId}),t.meta.pagination.nextPageStartsAfter&&(t.meta.pagination.nextPageStartsAfter=t.data[t.data.length-1].matchId)}return t};setModelsForPotmResults=async t=>{let e=t.map(a=>a.teamId),i=t.map(a=>a.playerId);if(e.length>0&&i.length>0){let a=await this.football.footballFacade.getTeamsMapWithNativeIds(e),r=await this.football.footballFacade.getPlayersMapWithNativeIds(i);t.forEach(o=>{o.teamModel=a.get(o.teamId)||null,o.playerModel=r[o.playerId]||null,o.teamId=o.teamModel?o.teamModel.id:o.teamId,o.playerId=o.playerModel?o.playerModel.id:o.playerId})}}};var Xl=class{https=null;service=null;idSchema=null;constructor(t){this.idSchema=t.idSchema,this.https=new jl(t),this.service=new Yl(t)}getPolls=async(t,e)=>{t&&(t=new ii(t),await this.service.finalizePollsFilters(t));let i=await this.https.getPolls(t,e);for(let a of i.data)await this.service.remapTags(a,"native",this.idSchema);return i};getPollById=async(t,e)=>{let i=await this.https.getPollById(t,e);return await this.service.remapTags(i,"native",this.idSchema),i};voteForPoll=async(t,e)=>(typeof e=="string"&&(console.warn("Passing a single optionId as a string will be deprecated. Please pass it as an array."),e=[e]),await this.https.voteForPoll(t,e));deleteVoteForPoll=async t=>await this.https.deleteVoteForPoll(t);getMyPollVote=async(t,e)=>{let i=await this.https.getMyPollVote(t);if(e){let a=await this.getPolls(new ii({pollIds:[t]}),!0);i.pollModel=a.data.find(r=>r.id===t)||null,i.optionModel=a.data.find(r=>r.id===t)?.options.find(r=>r.id===i.optionId)||null,i.optionsModels=i.optionIds?a.data.find(r=>r.id===t)?.options.filter(r=>i.optionIds.includes(r.id))||[]:[]}return i};getMyPollsVotes=async t=>{t&&(t=new P(t));let e=await this.https.getMyPollsVotes(t),i=e.data.map(r=>r.id),a=await this.getPolls(new ii({pollIds:i}),!0);return e.data=e.data.map(r=>(r.pollModel=a.data.find(o=>o.id===r.pollId)||null,r.optionModel=r.pollModel?.options.find(o=>o.id===r.optionId)||null,r.optionsModels=r.optionIds?r.pollModel?.options.filter(o=>r.optionIds.includes(o.id))||[]:[],r)),e};voteForPlayerOfTheMatch=async(t,e)=>{if(this.idSchema!=="native"){let[i,a]=await this.service.remapMatchAndPlayerIds(t,e,this.idSchema,"native");return await this.https.voteForPlayerOfTheMatch(i,a),{playerId:e}}return await this.https.voteForPlayerOfTheMatch(t,e)};deleteVoteForPlayerOfTheMatch=async t=>{if(this.idSchema!=="native"){let e=await this.service.remapMatchIds([t],this.idSchema,"native");return await this.https.deleteVoteForPlayerOfTheMatch(e[0]),!0}return await this.https.deleteVoteForPlayerOfTheMatch(t),!0};getOwnVotesForPlayerOfTheMatch=async t=>{if(t&&(t=new qs(t)),t&&t.matchIds&&t.matchIds.length>0&&this.idSchema!=="native"){let i=await this.service.remapMatchIds(t.matchIds,this.idSchema,"native");t.matchIds=i}let e=await this.https.getOwnVotesForPlayerOfTheMatch(t);return await this.service.setModelsForUserVotes(e)};getResultsForPlayerOfTheMatch=async(t,e)=>{if(this.idSchema!=="native"){let a=await this.service.remapMatchIds([t],this.idSchema,"native"),r=await this.https.getResultsForPlayerOfTheMatch(a[0],e);return await this.service.setModelsForPotmResults(r.data),r}let i=await this.https.getResultsForPlayerOfTheMatch(t,e);return await this.service.setModelsForPotmResults(i.data),i}};var Bi=class{facade=null;constructor(t){this.facade=new Xl(t)}getPolls=async(t,e)=>await this.facade.getPolls(t,e);getPollById=async(t,e)=>await this.facade.getPollById(t,e);voteForPoll=async(t,e)=>await this.facade.voteForPoll(t,e);deleteVoteForPoll=async t=>await this.facade.deleteVoteForPoll(t);getMyPollVote=async(t,e)=>await this.facade.getMyPollVote(t,e);getMyPollsVotes=async t=>await this.facade.getMyPollsVotes(t);voteForPlayerOfTheMatch=async(t,e)=>await this.facade.voteForPlayerOfTheMatch(t,e);deleteVoteForPlayerOfTheMatch=async t=>await this.facade.deleteVoteForPlayerOfTheMatch(t);getOwnVotesForPlayerOfTheMatch=async t=>await this.facade.getOwnVotesForPlayerOfTheMatch(t);getResultsForPlayerOfTheMatch=async(t,e)=>await this.facade.getResultsForPlayerOfTheMatch(t,e)};var Jl=class{clientHttps=null;topX=null;matchQuiz=null;loyalty=null;miniGames=null;voting=null;constructor(t){this.clientHttps=new W(t),this.topX=new Di(t),this.matchQuiz=new xi(t),this.loyalty=new Jt(t),this.miniGames=new Yt(t),this.voting=new Bi(t)}getListContent=async(t,e,i)=>{e&&(e=new eo(e));let a=await this.clientHttps.getListContent(t,e,i);return await this.setModels(a.data),a};setModels=async t=>{let i=[],a=new Map;t.forEach(r=>{if(a.has(r.entityType)){let o=a.get(r.entityType);a.set(r.entityType,[...o,r.entityId])}else a.set(r.entityType,[r.entityId])});try{for(let[r,o]of Array.from(a.entries()))switch(r){case"TOP_X":let n=await this.topX.getGames({limit:o.length,gameIds:o},!0);i=[...i,...n.data];break;case"MATCH_QUIZ":let l=await this.matchQuiz.getGames({limit:o.length,gameIds:o},!0);i=[...i,...l.data];break;case"LEADERBOARD_TEMPLATES":let p=await this.loyalty.getTemplates(void 0,!0);i=[...i,...p.data.filter(b=>o.includes(b.id))];break;case"CLASSIC_QUIZ":let c=await this.miniGames.getClassicQuizzes({limit:o.length,classicQuizIds:o},!1,!0);i=[...i,...c.data];break;case"EITHER_OR":let d=await this.miniGames.getEitherOrs({limit:o.length,eitherOrIds:o},!1,!0);i=[...i,...d.data];break;case"POLL":let u=await this.voting.getPolls({limit:o.length,pollIds:o},!0);i=[...i,...u.data];break;default:}}catch(r){throw console.error("An error occurred while trying to set models for list content entities",r),r}t.forEach(r=>{let o=i.find(n=>n.id===r.entityId)||null;r.entityModel=o})}};var Zl=class{facade=null;constructor(t){this.facade=new Jl(t)}getListContent=async(t,e,i)=>await this.facade.getListContent(t,e,i)};var tp=class{fromResponse(t,e){let i=new Map;return t.matches.forEach(a=>{let r=a.odds.map(o=>{let n=new is;return n.bookmaker=o.bookmaker?this.remapBookmaker(o.bookmaker):null,n.type=o.type,n.markets=o.markets?this.remapMarkets(o.markets,e):[],n});i.set(a.id,r)}),i}remapBookmaker(t){let e=new zo;return e.id=t.id,e.name=t.name,e.assets=t.assets?this.remapAssets(t.assets):[],e.links=t.links||[],e.branding=t.branding?this.remapBranding(t.branding):null,e.eventUrls=t.event_urls?this.remapEventUrls(t.event_urls):[],e.stakesDisclaimer=t.stakes_disclaimer,e.domainName=t.domain_name,e}remapMarkets(t,e){return t.map(i=>{let a=new Xo;return a.type=i.type?this.remapMarketType(i.type):null,a.scope=i.scope?this.remapMarketScope(i.scope):null,a.selections=i.selections?this.remapMarketSelections(i.selections,a.type.code,e):[],a})}remapEventUrls(t){return t.map(e=>{let i=new jo;return i.url=e.url,i.appType=e.app_type,i})}remapBranding(t){let e=new Qo;return e.backgroundColor=t.background_color,e.textColor=t.text_color,e}remapAssets(t){return t.map(e=>{let i=new Ko;return i.logo=e.logo,i.type=e.type,i.transparentBackgroundUrl=e.transparent_background_url,i.backgroundColor=e.background_color,i})}remapMarketType=t=>{let e=new ts;return e.id=t.id,e.name=t.name,e.code=t.code,e.entityType=t.entity_type,e};remapMarketScope=t=>{let e=new Jo;return e.id=t.id,e.name=t.name,e.type=t.type,e.entityType=t.entity_type,e};remapMarketSelections=(t,e,i)=>{let a=Array.from(t);return i.length>0&&e==="OVER_UNDER"&&(a=a.filter(r=>r.code==="over"?i.some(o=>{switch(o){case"OVER_GOALS_0_5":return r.value==="0.5";case"OVER_GOALS_1_5":return r.value==="1.5";case"OVER_GOALS_2_5":return r.value==="2.5";case"OVER_GOALS_3_5":return r.value==="3.5";case"OVER_GOALS_4_5":return r.value==="4.5";case"OVER_GOALS_5_5":return r.value==="5.5";default:return!1}}):!1)),a.map(r=>{let o=new Zo;return o.id=r.id,o.name=r.name,o.code=r.code,o.value=r.value,o.odds=r.odds,o.urls=r.urls?this.remapEventUrls(r.urls):[],o.movement=r.movement,o.oddsOld=r.odds_old,o.entityType=r.entity_type,o.additionalInfo=r.additional_info,o.providerInfo=r.provider_info?this.remapProviderInfo(r.provider_info):null,o})};remapProviderInfo=t=>{let e=new es;return e.selectionId=t.selection_id,e.eventId=t.event_id,e.marketId=t.market_id,e.competitionId=t.competition_id,e}};var ep=class{footballBaseUrl="https://football.api.sportal365.com/";retryRequest=!1;oddClient=null;remapper=null;constructor(t){this.oddClient=t.oddClient,this.remapper=new tp}getMatchOdds=async(t,e)=>{let i=`v2/matches/livescore?odd_client=${this.oddClient.name}&match_ids=${t.join(",")}${e.constructFiltersUrl()}`,a=`Error while fetching match odds for matchIds: ${t.join(",")}`,r=await this.fetchWithAuth(i,a),o=e.marketTypes&&e.marketTypes.length>0?e.marketTypes.filter(n=>n.includes("OVER")):[];return this.remapper.fromResponse(r,o)};getAuthHeaders=()=>{let t=typeof window<"u"?window.btoa(`${this.oddClient.credentials.username}:${this.oddClient.credentials.password}`):Buffer.from(`${this.oddClient.credentials.username}:${this.oddClient.credentials.password}`).toString("base64");return{"Content-Type":"application/json",Authorization:`Basic ${t}`}};fetchWithAuth=async(t,e)=>{let i=await fetch(this.footballBaseUrl+t,{headers:this.getAuthHeaders()}),a=await i.json();if(!i.ok)throw(i.status===401||i.status===403)&&!this.retryRequest&&(this.retryRequest=!0,await this.fetchWithAuth(t,e)),this.retryRequest=!1,console.warn(e,a),a;return this.retryRequest=!1,a}};var ip=class{https;idSchema;oddClient;idMapping=null;validator;constructor(t){this.idSchema=t.idSchema,this.oddClient=t.oddClient,this.https=new ep(t),this.validator=new J(t.errorHandlingMode),this.idMapping=new R(t)}getByMatchIds=async(t,e)=>{this.validateOddClient(),(!t||!Array.isArray(t)||t.length===0)&&this.validator.throwException(400,"invalid_match_ids","Match IDs are invalid!");let i=Array.from(t);this.idSchema!=="sportal365"&&(i=(await this.idMapping.idMappingFacade.getEntitiesByIds({match:Array.from(t)},this.idSchema,"sportal365")).match);let a=new Yo(e),r=await this.https.getMatchOdds(i,a);if(this.idSchema!=="sportal365"){let o=await this.idMapping.idMappingFacade.getEntitiesByIdsMap({match:Array.from(r.keys())},"sportal365",this.idSchema),n=new Map;return Array.from(r.entries()).forEach(([l,p])=>{n.set(o.get(l),p)}),n}return r};validateOddClient=()=>{this.oddClient||this.validator.throwException(412,"odd_client_configuration_not_found","Odds namespace requires oddClient configuration to be set")}};var ap=class{facade;constructor(t){this.facade=new ip(t)}getByMatchIds=async(t,e)=>await this.facade.getByMatchIds(t,e)};var rp=class{factory=null;privateLeagueHttps=null;loyaltyHttps=null;profile=null;service=null;discussionsService=null;constructor(t){this.factory=new Fi,this.privateLeagueHttps=new Si(t),this.loyaltyHttps=new Et(t),this.profile=new V(t),this.service=new Oi(t),this.discussionsService=new Zt(t)}create=async t=>{let e=this.factory.createRequestBodyFromParam(t,"PRIVATE"),i=await this.privateLeagueHttps.create(e,"PRIVATE_LEAGUE");return await this.service.setTemplateModels(i),i};getById=async(t,e)=>{let i=await this.privateLeagueHttps.getById(t,"PRIVATE_LEAGUE",e);return await this.service.setTemplateModels(i),i};getMyLeagues=async t=>{t=new Ts(t);let e=await this.privateLeagueHttps.getMyLeagues(t,"PRIVATE_LEAGUE");return await this.service.setTemplateModelsInLeagues(e),e};update=async(t,e)=>{let i=this.factory.createUpdateRequestBodyFromParam(e,"PRIVATE"),a=await this.privateLeagueHttps.update(t,i,"PRIVATE_LEAGUE");return await this.service.setTemplateModels(a),a};updateTemplate=async(t,e,i)=>{let a=await this.privateLeagueHttps.updateLeagueTemplate(t,e,i,"PRIVATE_LEAGUE");return await this.service.setTemplateModels(a),a};delete=async t=>await this.privateLeagueHttps.delete(t,"PRIVATE_LEAGUE");invite=async(t,e)=>await this.privateLeagueHttps.invite(t,e);deleteInvitation=async(t,e)=>await this.privateLeagueHttps.deleteInvitation(t,e);accept=async t=>{let i=await this.privateLeagueHttps.accept(t,!0,"PRIVATE_LEAGUE");return await this.finalizeAcceptModel(i,!0)};reject=async t=>{let i=await this.privateLeagueHttps.accept(t,!1,"PRIVATE_LEAGUE");return await this.finalizeAcceptModel(i,!1)};banUsers=async(t,e)=>await this.privateLeagueHttps.ban(t,e);unbanUsers=async(t,e)=>await this.privateLeagueHttps.unban(t,e);join=async t=>{let e=await this.privateLeagueHttps.join(t);return await this.finalizeAcceptModel(e,!0)};leave=async t=>await this.privateLeagueHttps.leave(t,"PRIVATE_LEAGUE");finalizeAcceptModel=async(t,e)=>{if(e){let i=await this.getById(t.leagueId);t.leagueModel=i}return await this.service.setProfileModel(t),t};getMyLeaguesStandings=async t=>{t&&(t=new Es(t));let e=await this.profile.getOwn().getInfo(),i=await this.loyaltyHttps.getUserRankingsForPrivateLeagueAndChallenges(e.id,"PRIVATE_LEAGUE",t);for(let a of i.data){let r=await this.getById(a.privateLeagueId);a.privateLeagueModel=r}return this.service.setTemplateModelsFromLeagueModels(i.data,"PRIVATE_LEAGUE"),i};getInvitations=async t=>{t=new Xe(t),t.type="PRIVATE";let e=await this.privateLeagueHttps.getInvitations("PRIVATE_LEAGUE",t);return await this.service.setTemplateModelsInLeagues(e.data),e};getReportedPosts=async(t,e)=>{e&&(e=new Je(e));let i=await this.privateLeagueHttps.getReportedPosts(t,e);return i.data=await this.discussionsService.finalizePostFullModel(i.data),i};getPredictions=async(t,e)=>{if(e){if(e.limit&&e.limit>20)throw new m(400,"invalid_limit","Invalid limit. The maximum limit is: "+20 .toString());e=new Ze(e)}let i=await this.privateLeagueHttps.getPredictions(t,e);return await this.service.setModelsForPredictions(i)};moderatePost=async(t,e)=>await this.privateLeagueHttps.moderatePost(t,e)};var op=class{privateLeaguesFacade=null;constructor(t){this.privateLeaguesFacade=new rp(t)}create=async t=>await this.privateLeaguesFacade.create(t);update=async(t,e)=>await this.privateLeaguesFacade.update(t,e);updateTemplate=async(t,e,i)=>await this.privateLeaguesFacade.updateTemplate(t,e,i);delete=async t=>await this.privateLeaguesFacade.delete(t);getById=async(t,e)=>await this.privateLeaguesFacade.getById(t,e);getMyLeagues=async t=>await this.privateLeaguesFacade.getMyLeagues(t);invite=async(t,e)=>await this.privateLeaguesFacade.invite(t,e);deleteInvitation=async(t,e)=>await this.privateLeaguesFacade.deleteInvitation(t,e);accept=async t=>await this.privateLeaguesFacade.accept(t);reject=async t=>await this.privateLeaguesFacade.reject(t);banUsers=async(t,e)=>await this.privateLeaguesFacade.banUsers(t,e);unbanUsers=async(t,e)=>await this.privateLeaguesFacade.unbanUsers(t,e);join=async t=>await this.privateLeaguesFacade.join(t);leave=async t=>await this.privateLeaguesFacade.leave(t);getMyLeaguesStandings=async t=>await this.privateLeaguesFacade.getMyLeaguesStandings(t);getInvitations=async t=>await this.privateLeaguesFacade.getInvitations(t);getReportedPosts=async(t,e)=>await this.privateLeaguesFacade.getReportedPosts(t,e);getPredictions=async(t,e)=>await this.privateLeaguesFacade.getPredictions(t,e);moderatePost=async(t,e)=>await this.privateLeaguesFacade.moderatePost(t,e)};var sp=class{KEY_PREFIX="fu-progress-";get=(t,e)=>{let i=localStorage.getItem(`${this.KEY_PREFIX}${t}-${e}`);return i&&JSON.parse(i)};set=(t,e,i)=>(localStorage.setItem(`${this.KEY_PREFIX}${t}-${e}`,JSON.stringify(i)),JSON.stringify(i));delete=(t,e)=>{localStorage.removeItem(`${this.KEY_PREFIX}${t}-${e}`)}};var np=class extends J{validatePrediction=t=>{(!t||!Array.isArray(t)||t.length===0||t.some(e=>!e))&&this.throwException(400,"invalid_method_call","The prediction argument is invalid. For more information please visit our documentation")}};var lp=class{https=null;profile=null;validator=null;constructor(t){this.https=new ui(t),this.profile=new V(t),this.validator=new np(t.errorHandlingMode)}getGames=async(t,e)=>(t&&(t=new As(t)),await this.https.getStandingsGames(t,e));getGameById=async(t,e)=>await this.https.getStandingGameById(t,e);makePrediction=async(t,e)=>(this.validator.validatePrediction(e),await this.https.makeStandingGamePrediction(t,e));updatePrediction=async(t,e,i)=>(this.validator.validatePrediction(i),await this.https.updateStandingGamePrediction(t,e,i));getGamePredictionForUser=async(t,e,i)=>{let a=await this.https.getStandingGamePredictionsForUser(t,e,i),r=null;try{r=await this.profile.getById(e).getInfo()}catch(o){console.error(o)}return a.data.forEach(o=>{o.profileModel=r}),a};getRankings=async(t,e,i)=>{e&&(e=new Os(e));let a=await this.https.getStandingGameRankings(t,e,i),r=a.data.map(n=>n.profileId),o=[];return r.length>0&&(o=await this.profile.getByIds(r),a.data=a.data.map(n=>(n.profileModel=o.find(l=>l.id===n.profileId)||null,n))),a}};var pp=class{facade=null;constructor(t){this.facade=new lp(t)}getGames=async(t,e)=>await this.facade.getGames(t,e);getGameById=async(t,e)=>await this.facade.getGameById(t,e);makePrediction=async(t,e)=>await this.facade.makePrediction(t,e);updatePrediction=async(t,e,i)=>await this.facade.updatePrediction(t,e,i);getGamePredictionForUser=async(t,e,i)=>await this.facade.getGamePredictionForUser(t,e,i);getRankings=async(t,e,i)=>await this.facade.getRankings(t,e,i)};function pd(){let s=ld(),t="-RC",e=null,i=s.version.split("."),a=Number(i[0]),r=Number(i[1]),o=i[2];if(o.includes(t)){let n=o.split(t);o=Number(n[0]),e=Number(n[1])}else o=Number(o);return{version:s.version,major:a,minor:r,patch:o,releaseCandidate:e}}var sc=null,Ec=null;function Hd(s){if($d(s)){let t=Wd(s);if(t.isValid)return sc={profile:new V(s),football:new tt(s),predictor:new Ai(s),loyalty:new Jt(s),topX:new Di(s),matchQuiz:new xi(s),activity:new _n(s),miniGames:new Yt(s),discussions:new Bl(s),privateLeagues:new op(s),challenges:new Ol(s),progress:new sp,voting:new Bi(s),fantasy:new Gl(s),helpers:new Ul(s),idMapping:new Wl(s),bracketGame:new nl(s),lists:new Zl(s),standingGame:new pp(s),odds:new ap(s),getVersion:pd},Ec={...s},sc;qd(t)}return sc}var $d=s=>!sc||JSON.stringify(s)!==JSON.stringify(Ec)||s.authProvider?.getIdToken()!==Ec.authProvider?.getIdToken(),Wd=s=>{let e=new fn().validate(s);return(e.idSchema.validation==="missing"||e.idSchema.validation==="invalid")&&(console.warn(e.idSchema.message.text),s.idSchema="native"),(e.environment.validation==="missing"||e.environment.validation==="invalid")&&(console.warn(e.environment.message.text),s.environment="prod"),(e.lang.validation==="missing"||e.lang.validation==="invalid")&&(console.warn(e.lang.message.text),s.lang="en"),(e.errorHandlingMode.validation==="missing"||e.errorHandlingMode.validation==="invalid")&&(console.warn(e.errorHandlingMode.message.text),s.errorHandlingMode="default"),e.authProvider.validation==="invalid"&&console.warn(e.authProvider.message.text),(e.oddClient.message.type==="warning"||e.oddClient.credentials.message.type==="warning")&&console.warn(e.oddClient.message.text||e.oddClient.credentials.message.text),e},qd=s=>{let t="isValid";Object.keys(s).forEach(e=>{let i=s[e];if(e!==t&&e!=="authProvider"){if(i.message.type==="error")throw new Error(i.message.text)}else if(e!==t&&e==="authProvider"){if(i?.message.type==="error")throw new Error(i.message.text);Object.keys(new ee).forEach(a=>{if(i[a].message.type==="error")throw new Error(i[a].message.text)})}if(e!==t&&e==="oddClient"){if(i?.message.type==="error")throw new Error(i.message.text);let a=i;if(a.credentials.message.type==="error")throw new Error(a.credentials.message.text)}})};export{ar as AcceptChallengeModel,ws as AcceptPrivateLeagueModel,$i as AchievementsStats,ge as ActionValueModel,mc as ActionsEnum,ye as ActionsModel,pe as ActivityFilters,Pp as ActivityMeta,le as ActivityResponseBody,Ap as AssetsModel,fe as AutomaticModerationModel,Qa as BadgesModel,Oa as BadgesModelV2,Ka as BadgesValue,q as BadgesValueV2,Ko as BookmakerAssetModel,Qo as BookmakerBrandingModel,jp as BookmakerLinkModel,zo as BookmakerModel,jo as BookmakerUrlModel,rs as BothTeamsFixtureModel,ir as BracketGameFilters,ce as BracketGameFixtureScoreModel,er as BracketGameFixtures,ia as BracketGameFixturesModel,de as BracketGameMetaModel,aa as BracketGameMetaParticipantsModel,ra as BracketGameModel,la as BracketGamePredictionFixturesModel,pa as BracketGamePredictionModel,Rp as BracketGamePredictionRequestBody,od as BracketGamePredictionStatusEnum,tr as BracketGamePredictionsFilters,oa as BracketGamePredictionsModel,ca as BracketGameRankingsModel,ue as BracketGameTiebreaker,na as BracketGameTiebreakerModel,sa as BracketGamesModel,bc as BracketWinnerEnum,Yr as BrandingColorsModel,Jr as BrandingImagesModel,jr as BrandingModel,Xr as BrandingUrlsModel,_a as BreakdownModel,Xp as CalculatedOneXTwoFromScoresModel,Tp as CampaignModel,rr as ChallengeCreateModel,sr as ChallengeFilters,lr as ChallengeRankingsModel,or as ChallengeUpdateModel,Be as ClassicQuizBasicModel,wo as ClassicQuizFilters,ke as ClassicQuizFiltersMeta,_o as ClassicQuizFullModel,vo as ClassicQuizLeaderboardFilters,Ue as ClassicQuizLeaderboardMeta,To as ClassicQuizOptionModel,Wp as ClassicQuizParticipationBodyModel,Eo as ClassicQuizParticipationModel,Ro as ClassicQuizParticipationQuestionModel,So as ClassicQuizParticipationsFilters,Po as ClassicQuizQuestionModel,Co as ClassicQuizQuestionsReportModel,Ge as ClassicQuizRankFilters,Ao as ClassicQuizRankModel,Fo as ClassicQuizUserParticipationModel,Oo as ClassicQuizUserRank,zp as ClassicQuizUserRankModel,Qp as ClassicQuizzesLeaderboardModel,qp as ClassicQuizzesModel,ae as ClassicQuizzesStats,io as ClientBadges,ao as ClientBadgesV2,vr as CompetitionBasicModel,yi as CompetitionFilters,Ar as CompetitionFullModel,X as CompletedModel,Ep as ContentModel,Ns as ContestWinners,Ct as ContextModel,ss as CornersFixtureModel,Dt as CorrectScoreFixtureModel,pi as CreateActivityRequestBody,Sp as CreatePostParamBody,ya as DetailedProfileModel,Ea as DictionaryModel,pr as DiscussionModel,re as DiscussionStats,$a as DiscussionsBadgeRequirements,Wa as DiscussionsBadgesValue,Ra as DiscussionsConfigModel,Mr as DiscussionsFilters,al as DoubleChanceEnum,ps as DoubleChanceFixtureModel,Ve as EitherOrBasicModel,Lo as EitherOrFilters,xo as EitherOrFullModel,No as EitherOrParticipationModel,Go as EitherOrParticipationRequestFullModel,ko as EitherOrParticipationRequestModel,Vo as EitherOrParticipationStepsModel,Ii as EitherOrParticipationStepsOptionModel,Do as EitherOrPointsModel,Ho as EitherOrResultsBreakdownModel,$o as EitherOrResultsModel,Wo as EitherOrResultsStandingsModel,oe as EitherOrStats,Bo as EitherOrStatsModel,Kp as EitherOrsModel,Bp as EntitiesFollows,Np as EntitiesFollowsFilters,ki as EnvironmentEnum,A as ErrorCodes,mp as ErrorHandlingModeEnum,k as ErrorMessages,O as ErrorStatuses,Hd as FansUnitedSDK,Op as FansUnitedSDKModel,Vt as FansUnitedSdkFetchException,Ee as FantasyCoefficientsModel,Ya as FantasyConfigModel,Xa as FantasyMultipliersModel,_r as FantasyPlayerDetailedStatsMetaModel,Pr as FantasyPlayerDetailedStatsModel,Tr as FantasyPlayerStatsModel,Rr as FantasyPlayersMetaModel,Re as FantasyPlayersModel,Sr as FantasyPlayersPointsModel,ve as FantasyPredictionRequestBody,co as FiltersMetaModel,Ls as FixturesGamesModel,Mo as FixturesMatchQuizModel,as as FixturesPredictionModel,We as FixturesResponseModel,Ds as FixturesTopXModel,fi as FollowFilters,mi as FollowModel,Ia as FollowStatusModel,Ma as FollowersModel,ba as FollowingModel,Ga as FootballBadgeRequirements,Ua as FootballBadgesValue,Or as FootballCountryModel,Tc as FootballMatchStatusEnum,$t as FootballPaginationModel,vs as FullInterestModel,Pa as FullnessProfile,Da as GameBadgeRequirements,Ba as GameBadgesValue,ti as GameByIdModel,Io as GameMarketsResults,Wt as GameModel,ni as GamePredictionsStats,Bs as GameResultsModel,At as GameStatusEnum,Na as GamesBadgeRequirements,ka as GamesBadgesValue,st as GamesFilters,Pt as GamesListModel,_t as GamesMatchQuizListModel,Bt as GamesTopXListModel,ja as GeneralBadgesValue,Te as GeneralRequirementModel,rl as HalfTimeFullTimeEnum,ds as HalfTimeFullTimeFixtureModel,ro as HighestSuccessRateFilters,po as HighestSuccessRateModel,D as IdSchemaEnum,Y as ImagesModel,Cs as InterestModel,Xe as InvitationFilters,rn as LangEnum,wa as LeadModel,rc as LeadRequestBody,kp as LeaderboardLeagueResponse,De as LeaderboardModel,Gp as LeaderboardResponseModel,oo as LeagueLeaderboardFilters,xe as LeagueLeaderboardMetaModel,Le as LineupsModel,eo as ListContentFilters,Ja as ListContentModel,Xs as ListContentResponseModel,Sa as LoyaltyConfigModel,za as LoyaltyConfigModelV2,so as LoyaltyFilters,Lt as LoyaltyMeta,Zr as MappingModel,to as MappingResponseModel,it as MarketEnum,Yp as MarketsConfigModel,Lr as MatchBasicModel,Ke as MatchCorrectScoreMarketResultModel,ht as MatchFilters,xr as MatchFullModel,bs as MatchMarketsResultsModel,Yo as MatchOddsFilters,_c as MatchOddsMarketEnum,Xo as MatchOddsMarketModel,Jo as MatchOddsMarketScopeModel,Zo as MatchOddsMarketSelectionModel,ts as MatchOddsMarketTypeModel,is as MatchOddsModel,ys as MatchPlayerMarketResultModel,Me as MatchQuizConfigModel,j as MatchStatus,Is as MatchSummaryModel,B as MetaFootballModel,Uo as MiniGameImages,Va as MiniGamesBadgeRequirements,Ha as MiniGamesBadgesValue,He as MiniGamesContext,$e as MiniGamesContextTag,Ne as MiniGamesFilters,nr as MyChallengesFilters,Ts as MyLeaguesFilters,L as NoYesModel,wc as OddFormatEnum,Mc as OddTypeEnum,il as OneXTwoEnum,ms as OneXTwoFixtureModel,nd as OutcomeEnum,ze as OverCornersFixtureModel,Qe as OverGoalsFixtureModel,ta as OwnActivityFilters,Ki as PaginationActivities,Q as PaginationFootballProperties,Zp as PastTemplateModel,hs as PenaltyMatchFixtureModel,Fp as PlayerAssetsModel,Gr as PlayerBasicModel,Ae as PlayerDetailedPointsModel,wr as PlayerDetailedStatsFilters,Fr as PlayerDetailedStatsModel,Mi as PlayerFilters,ot as PlayerFixtureModel,Ur as PlayerFullModel,Cp as PlayerMarketResultModel,Cr as PlayerPointsModel,$r as PlayerShortModel,Vr as PlayerSquadModel,Oe as PlayerStatsMatchModel,kr as PlayerStatsModel,Er as PlayersPointsFilters,Up as Points,Fa as PointsModel,Vp as PointsValueModel,Dp as PollBadgesValue,ai as PollBasicModel,Gs as PollFullModel,Us as PollOptionModel,ri as PollVoteBasicModel,Hs as PollVoteFullModel,ii as PollsFilters,$s as PollsModel,Ws as PollsUserVotesModel,Ce as PostByIdBasicModel,cr as PostByIdFullModel,dr as PostCreateModel,ur as PostsCountDiscussionModel,mr as PostsDiscussionBasicModel,Ht as PostsFilters,hr as PostsFullModel,Ot as PostsMetaModel,fr as PostsModel,_e as PotmBadgesValue,Ks as PotmResultsMetaModel,Ys as PotmResultsModel,js as PotmResultsResponseModel,qs as PotmUserVotesFilters,Qs as PotmUserVotesModel,zs as PotmUserVotesResponseModel,bo as PredictionMatchQuizModel,je as PredictionRequestModel,wi as PredictionResponseModel,xs as PredictionTopXModel,U as PredictionsFilters,Ms as PredictionsModel,ne as PredictionsStats,La as PredictorBadgeRequirements,xa as PredictorBadgesValue,we as PredictorConfigModel,Vs as PreferenceMappingModel,xp as PreferenceModel,Se as PrivateLeagueBasicCreateModel,Fe as PrivateLeagueBasicUpdateRequestBody,Ss as PrivateLeagueCreateModel,Es as PrivateLeagueFilters,_s as PrivateLeagueFullModel,Ye as PrivateLeagueModel,tc as PrivateLeagueParamCreateBody,ec as PrivateLeagueParamUpdateBody,Je as PrivateLeaguePostsFilters,Ps as PrivateLeaguePredictionModel,Ze as PrivateLeaguePredictionsFilters,ic as PrivateLeaguePredictionsModel,Rs as PrivateLeagueRankingsModel,Fs as PrivateLeagueUpdateModel,ac as PrivateLeaguesModel,Ta as ProfileCountryModel,he as ProfileModel,qi as ProfileStatsModel,no as RankingsFilters,mo as RankingsModel,gr as ReactionModel,gs as RedCardFixtureModel,K as RelatedEntityRelationship,yr as ReportModel,vt as RequirementModel,qe as ResultModel,qo as ResultsSummaryModel,be as RewardsModel,Pe as RewardsModelV2,Lp as SDKConfiguraitonModel,Ic as ScopeTypeEnum,Br as ScoresModel,Kr as SearchFilters,Qr as SearchModel,es as SelectionProviderInfoModel,zi as SinglePredictionsBreakdown,se as SinglePredictionsStats,m as StandardFansUnitedException,me as StandingGameMetaModel,ma as StandingGameMetaParticipantsModel,da as StandingGameModel,ha as StandingGamePredictionModel,fa as StandingGamePredictionsModel,Os as StandingGameRankingsFilters,ga as StandingGameRankingsModel,As as StandingGamesFilters,ua as StandingGamesModel,Dr as StatsModel,xn as StatusEnum,Qi as SuccessRatePercent,Ca as SuccessRateScopeModel,Wi as SuccessRates,Ut as SummarizedBreakdown,Za as TagsModel,Wr as TeamBasicModel,qr as TeamColors,bi as TeamFilters,vp as TeamFormModel,zr as TeamFullModel,Hp as TemplateBreakdownModel,ho as TemplateBreakdownPointsModel,fo as TemplateByIdModel,lo as TemplateFilters,yo as TemplateGroupFilter,go as TemplateGroups,uo as TemplateMeta,xt as TemplateModel,gt as TiebreakerModel,$p as TiersModel,ft as TimeTiebreaker,Nr as TimelineModel,Jp as TopCorrectScoresModel,Ir as TopDiscussionsFilters,Hr as TopPlayerModel,Ie as TopXConfigModel,ei as TopXPredictionRequestModel,sd as UserActionsEnum,ea as UserActivityFilters,va as UserDataConfigModel,ks as UserListWinners,fs as ValueAndPlayerId,rt as ValueBoolean,os as ValueCorners,ns as ValueCorrectScore,ls as ValueDoubleChance,cs as ValueHalfTimeFullTime,us as ValueOneXTwo,br as VersionsModel,qa as VotingBadgeRequirements,Aa as VotingBadgesValue};
|
|
1
|
+
var Lu=Object.create;var Sp=Object.defineProperty;var xu=Object.getOwnPropertyDescriptor;var Du=Object.getOwnPropertyNames;var Bu=Object.getPrototypeOf,Nu=Object.prototype.hasOwnProperty;var ku=(s,t,e)=>t in s?Sp(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e;var Gu=(s,t)=>()=>(s&&(t=s(s=0)),t);var fn=(s,t)=>()=>(t||s((t={exports:{}}).exports,t),t.exports),Uu=(s,t)=>{for(var e in t)Sp(s,e,{get:t[e],enumerable:!0})},Vu=(s,t,e,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of Du(t))!Nu.call(s,a)&&a!==e&&Sp(s,a,{get:()=>t[a],enumerable:!(i=xu(t,a))||i.enumerable});return s};var Hu=(s,t,e)=>(e=s!=null?Lu(Bu(s)):{},Vu(t||!s||!s.__esModule?Sp(e,"default",{value:s,enumerable:!0}):e,s));var et=(s,t,e)=>(ku(s,typeof t!="symbol"?t+"":t,e),e);var ou={};Uu(ou,{default:()=>Ku});var Qu,Ku,su=Gu(()=>{Qu={getItem:async()=>null,setItem:async()=>null,removeItem:async()=>null,clear:async()=>null,getAllKeys:async()=>[],multiGet:async()=>[],multiSet:async()=>null,multiRemove:async()=>null,mergeItem:async()=>null,multiMerge:async()=>null},Ku=Qu});var nu=fn((uf,xp)=>{var ju=function(){"use strict";function s(c,u){return u!=null&&c instanceof u}var t;try{t=Map}catch{t=function(){}}var e;try{e=Set}catch{e=function(){}}var i;try{i=Promise}catch{i=function(){}}function a(c,u,d,b,_){typeof u=="object"&&(d=u.depth,b=u.prototype,_=u.includeNonEnumerable,u=u.circular);var B=[],pi=[],ci=typeof Buffer<"u";typeof u>"u"&&(u=!0),typeof d>"u"&&(d=1/0);function nt(f,Gt){if(f===null)return null;if(Gt===0)return f;var U,dn;if(typeof f!="object")return f;if(s(f,t))U=new t;else if(s(f,e))U=new e;else if(s(f,i))U=new i(function(mn,P){f.then(function(hn){mn(nt(hn,Gt-1))},function(hn){P(nt(hn,Gt-1))})});else if(a.__isArray(f))U=[];else if(a.__isRegExp(f))U=new RegExp(f.source,p(f)),f.lastIndex&&(U.lastIndex=f.lastIndex);else if(a.__isDate(f))U=new Date(f.getTime());else{if(ci&&Buffer.isBuffer(f))return Buffer.allocUnsafe?U=Buffer.allocUnsafe(f.length):U=new Buffer(f.length),f.copy(U),U;s(f,Error)?U=Object.create(f):typeof b>"u"?(dn=Object.getPrototypeOf(f),U=Object.create(dn)):(U=Object.create(b),dn=b)}if(u){var Qc=B.indexOf(f);if(Qc!=-1)return pi[Qc];B.push(f),pi.push(U)}s(f,t)&&f.forEach(function(mn,P){var hn=nt(P,Gt-1),Ou=nt(mn,Gt-1);U.set(hn,Ou)}),s(f,e)&&f.forEach(function(mn){var P=nt(mn,Gt-1);U.add(P)});for(var bt in f){var F;dn&&(F=Object.getOwnPropertyDescriptor(dn,bt)),!(F&&F.set==null)&&(U[bt]=nt(f[bt],Gt-1))}if(Object.getOwnPropertySymbols)for(var Kc=Object.getOwnPropertySymbols(f),bt=0;bt<Kc.length;bt++){var Rp=Kc[bt],Ui=Object.getOwnPropertyDescriptor(f,Rp);Ui&&!Ui.enumerable&&!_||(U[Rp]=nt(f[Rp],Gt-1),Ui.enumerable||Object.defineProperty(U,Rp,{enumerable:!1}))}if(_)for(var E=Object.getOwnPropertyNames(f),bt=0;bt<E.length;bt++){var Fp=E[bt],Ui=Object.getOwnPropertyDescriptor(f,Fp);Ui&&Ui.enumerable||(U[Fp]=nt(f[Fp],Gt-1),Object.defineProperty(U,Fp,{enumerable:!1}))}return U}return nt(c,d)}a.clonePrototype=function(u){if(u===null)return null;var d=function(){};return d.prototype=u,new d};function r(c){return Object.prototype.toString.call(c)}a.__objToStr=r;function o(c){return typeof c=="object"&&r(c)==="[object Date]"}a.__isDate=o;function n(c){return typeof c=="object"&&r(c)==="[object Array]"}a.__isArray=n;function l(c){return typeof c=="object"&&r(c)==="[object RegExp]"}a.__isRegExp=l;function p(c){var u="";return c.global&&(u+="g"),c.ignoreCase&&(u+="i"),c.multiline&&(u+="m"),u}return a.__getRegExpFlags=p,a}();typeof xp=="object"&&xp.exports&&(xp.exports=ju)});var bu=fn((df,kc)=>{"use strict";var ia=typeof Reflect=="object"?Reflect:null,lu=ia&&typeof ia.apply=="function"?ia.apply:function(t,e,i){return Function.prototype.apply.call(t,e,i)},Dp;ia&&typeof ia.ownKeys=="function"?Dp=ia.ownKeys:Object.getOwnPropertySymbols?Dp=function(t){return Object.getOwnPropertyNames(t).concat(Object.getOwnPropertySymbols(t))}:Dp=function(t){return Object.getOwnPropertyNames(t)};function Yu(s){console&&console.warn&&console.warn(s)}var cu=Number.isNaN||function(t){return t!==t};function S(){S.init.call(this)}kc.exports=S;kc.exports.once=td;S.EventEmitter=S;S.prototype._events=void 0;S.prototype._eventsCount=0;S.prototype._maxListeners=void 0;var pu=10;function Bp(s){if(typeof s!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof s)}Object.defineProperty(S,"defaultMaxListeners",{enumerable:!0,get:function(){return pu},set:function(s){if(typeof s!="number"||s<0||cu(s))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+s+".");pu=s}});S.init=function(){(this._events===void 0||this._events===Object.getPrototypeOf(this)._events)&&(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0};S.prototype.setMaxListeners=function(t){if(typeof t!="number"||t<0||cu(t))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+t+".");return this._maxListeners=t,this};function uu(s){return s._maxListeners===void 0?S.defaultMaxListeners:s._maxListeners}S.prototype.getMaxListeners=function(){return uu(this)};S.prototype.emit=function(t){for(var e=[],i=1;i<arguments.length;i++)e.push(arguments[i]);var a=t==="error",r=this._events;if(r!==void 0)a=a&&r.error===void 0;else if(!a)return!1;if(a){var o;if(e.length>0&&(o=e[0]),o instanceof Error)throw o;var n=new Error("Unhandled error."+(o?" ("+o.message+")":""));throw n.context=o,n}var l=r[t];if(l===void 0)return!1;if(typeof l=="function")lu(l,this,e);else for(var p=l.length,c=gu(l,p),i=0;i<p;++i)lu(c[i],this,e);return!0};function du(s,t,e,i){var a,r,o;if(Bp(e),r=s._events,r===void 0?(r=s._events=Object.create(null),s._eventsCount=0):(r.newListener!==void 0&&(s.emit("newListener",t,e.listener?e.listener:e),r=s._events),o=r[t]),o===void 0)o=r[t]=e,++s._eventsCount;else if(typeof o=="function"?o=r[t]=i?[e,o]:[o,e]:i?o.unshift(e):o.push(e),a=uu(s),a>0&&o.length>a&&!o.warned){o.warned=!0;var n=new Error("Possible EventEmitter memory leak detected. "+o.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit");n.name="MaxListenersExceededWarning",n.emitter=s,n.type=t,n.count=o.length,Yu(n)}return s}S.prototype.addListener=function(t,e){return du(this,t,e,!1)};S.prototype.on=S.prototype.addListener;S.prototype.prependListener=function(t,e){return du(this,t,e,!0)};function Xu(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length===0?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function mu(s,t,e){var i={fired:!1,wrapFn:void 0,target:s,type:t,listener:e},a=Xu.bind(i);return a.listener=e,i.wrapFn=a,a}S.prototype.once=function(t,e){return Bp(e),this.on(t,mu(this,t,e)),this};S.prototype.prependOnceListener=function(t,e){return Bp(e),this.prependListener(t,mu(this,t,e)),this};S.prototype.removeListener=function(t,e){var i,a,r,o,n;if(Bp(e),a=this._events,a===void 0)return this;if(i=a[t],i===void 0)return this;if(i===e||i.listener===e)--this._eventsCount===0?this._events=Object.create(null):(delete a[t],a.removeListener&&this.emit("removeListener",t,i.listener||e));else if(typeof i!="function"){for(r=-1,o=i.length-1;o>=0;o--)if(i[o]===e||i[o].listener===e){n=i[o].listener,r=o;break}if(r<0)return this;r===0?i.shift():Ju(i,r),i.length===1&&(a[t]=i[0]),a.removeListener!==void 0&&this.emit("removeListener",t,n||e)}return this};S.prototype.off=S.prototype.removeListener;S.prototype.removeAllListeners=function(t){var e,i,a;if(i=this._events,i===void 0)return this;if(i.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):i[t]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete i[t]),this;if(arguments.length===0){var r=Object.keys(i),o;for(a=0;a<r.length;++a)o=r[a],o!=="removeListener"&&this.removeAllListeners(o);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if(e=i[t],typeof e=="function")this.removeListener(t,e);else if(e!==void 0)for(a=e.length-1;a>=0;a--)this.removeListener(t,e[a]);return this};function hu(s,t,e){var i=s._events;if(i===void 0)return[];var a=i[t];return a===void 0?[]:typeof a=="function"?e?[a.listener||a]:[a]:e?Zu(a):gu(a,a.length)}S.prototype.listeners=function(t){return hu(this,t,!0)};S.prototype.rawListeners=function(t){return hu(this,t,!1)};S.listenerCount=function(s,t){return typeof s.listenerCount=="function"?s.listenerCount(t):fu.call(s,t)};S.prototype.listenerCount=fu;function fu(s){var t=this._events;if(t!==void 0){var e=t[s];if(typeof e=="function")return 1;if(e!==void 0)return e.length}return 0}S.prototype.eventNames=function(){return this._eventsCount>0?Dp(this._events):[]};function gu(s,t){for(var e=new Array(t),i=0;i<t;++i)e[i]=s[i];return e}function Ju(s,t){for(;t+1<s.length;t++)s[t]=s[t+1];s.pop()}function Zu(s){for(var t=new Array(s.length),e=0;e<t.length;++e)t[e]=s[e].listener||s[e];return t}function td(s,t){return new Promise(function(e,i){function a(o){s.removeListener(t,r),i(o)}function r(){typeof s.removeListener=="function"&&s.removeListener("error",a),e([].slice.call(arguments))}yu(s,t,r,{once:!0}),t!=="error"&&ed(s,a,{once:!0})})}function ed(s,t,e){typeof s.on=="function"&&yu(s,"error",t,e)}function yu(s,t,e,i){if(typeof s.on=="function")i.once?s.once(t,e):s.on(t,e);else if(typeof s.addEventListener=="function")s.addEventListener(t,function a(r){i.once&&s.removeEventListener(t,a),e(r)});else throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof s)}});var wu=fn((Mu,Iu)=>{(function(){var s,t,e,i=[].splice,a=function(o,n){if(!(o instanceof n))throw new Error("Bound instance method accessed before binding")},r=[].indexOf;e=nu(),s=bu().EventEmitter,Iu.exports=t=function(){class o extends s{constructor(l={}){super(),this.get=this.get.bind(this),this.mget=this.mget.bind(this),this.set=this.set.bind(this),this.mset=this.mset.bind(this),this.del=this.del.bind(this),this.take=this.take.bind(this),this.ttl=this.ttl.bind(this),this.getTtl=this.getTtl.bind(this),this.keys=this.keys.bind(this),this.has=this.has.bind(this),this.getStats=this.getStats.bind(this),this.flushAll=this.flushAll.bind(this),this.flushStats=this.flushStats.bind(this),this.close=this.close.bind(this),this._checkData=this._checkData.bind(this),this._check=this._check.bind(this),this._isInvalidKey=this._isInvalidKey.bind(this),this._wrap=this._wrap.bind(this),this._getValLength=this._getValLength.bind(this),this._error=this._error.bind(this),this._initErrors=this._initErrors.bind(this),this.options=l,this._initErrors(),this.data={},this.options=Object.assign({forceString:!1,objectValueSize:80,promiseValueSize:80,arrayValueSize:40,stdTTL:0,checkperiod:600,useClones:!0,deleteOnExpire:!0,enableLegacyCallbacks:!1,maxKeys:-1},this.options),this.options.enableLegacyCallbacks&&(console.warn("WARNING! node-cache legacy callback support will drop in v6.x"),["get","mget","set","del","ttl","getTtl","keys","has"].forEach(p=>{var c;c=this[p],this[p]=function(...u){var d,b,_,B;if(_=u,[...u]=_,[d]=i.call(u,-1),typeof d=="function")try{B=c(...u),d(null,B)}catch(pi){b=pi,d(b)}else return c(...u,d)}})),this.stats={hits:0,misses:0,keys:0,ksize:0,vsize:0},this.validKeyTypes=["string","number"],this._checkData()}get(l){var p,c;if(a(this,o),(c=this._isInvalidKey(l))!=null)throw c;if(this.data[l]!=null&&this._check(l,this.data[l]))return this.stats.hits++,p=this._unwrap(this.data[l]),p;this.stats.misses++}mget(l){var p,c,u,d,b,_;if(a(this,o),!Array.isArray(l))throw p=this._error("EKEYSTYPE"),p;for(_={},u=0,b=l.length;u<b;u++){if(d=l[u],(c=this._isInvalidKey(d))!=null)throw c;this.data[d]!=null&&this._check(d,this.data[d])?(this.stats.hits++,_[d]=this._unwrap(this.data[d])):this.stats.misses++}return _}set(l,p,c){var u,d,b;if(a(this,o),this.options.maxKeys>-1&&this.stats.keys>=this.options.maxKeys)throw u=this._error("ECACHEFULL"),u;if(this.options.forceString&&!typeof p==="string"&&(p=JSON.stringify(p)),c==null&&(c=this.options.stdTTL),(d=this._isInvalidKey(l))!=null)throw d;return b=!1,this.data[l]&&(b=!0,this.stats.vsize-=this._getValLength(this._unwrap(this.data[l],!1))),this.data[l]=this._wrap(p,c),this.stats.vsize+=this._getValLength(p),b||(this.stats.ksize+=this._getKeyLength(l),this.stats.keys++),this.emit("set",l,p),!0}mset(l){var p,c,u,d,b,_,B,pi,ci,nt;if(a(this,o),this.options.maxKeys>-1&&this.stats.keys+l.length>=this.options.maxKeys)throw p=this._error("ECACHEFULL"),p;for(u=0,B=l.length;u<B;u++){if(_=l[u],{key:b,val:nt,ttl:ci}=_,ci&&typeof ci!="number")throw p=this._error("ETTLTYPE"),p;if((c=this._isInvalidKey(b))!=null)throw c}for(d=0,pi=l.length;d<pi;d++)_=l[d],{key:b,val:nt,ttl:ci}=_,this.set(b,nt,ci);return!0}del(l){var p,c,u,d,b,_;for(a(this,o),Array.isArray(l)||(l=[l]),p=0,u=0,b=l.length;u<b;u++){if(d=l[u],(c=this._isInvalidKey(d))!=null)throw c;this.data[d]!=null&&(this.stats.vsize-=this._getValLength(this._unwrap(this.data[d],!1)),this.stats.ksize-=this._getKeyLength(d),this.stats.keys--,p++,_=this.data[d],delete this.data[d],this.emit("del",d,_.v))}return p}take(l){var p;return a(this,o),p=this.get(l),p!=null&&this.del(l),p}ttl(l,p){var c;if(a(this,o),p||(p=this.options.stdTTL),!l)return!1;if((c=this._isInvalidKey(l))!=null)throw c;return this.data[l]!=null&&this._check(l,this.data[l])?(p>=0?this.data[l]=this._wrap(this.data[l].v,p,!1):this.del(l),!0):!1}getTtl(l){var p,c;if(a(this,o),!!l){if((c=this._isInvalidKey(l))!=null)throw c;if(this.data[l]!=null&&this._check(l,this.data[l]))return p=this.data[l].t,p}}keys(){var l;return a(this,o),l=Object.keys(this.data),l}has(l){var p;return a(this,o),p=this.data[l]!=null&&this._check(l,this.data[l]),p}getStats(){return a(this,o),this.stats}flushAll(l=!0){a(this,o),this.data={},this.stats={hits:0,misses:0,keys:0,ksize:0,vsize:0},this._killCheckPeriod(),this._checkData(l),this.emit("flush")}flushStats(){a(this,o),this.stats={hits:0,misses:0,keys:0,ksize:0,vsize:0},this.emit("flush_stats")}close(){a(this,o),this._killCheckPeriod()}_checkData(l=!0){var p,c,u;a(this,o),c=this.data;for(p in c)u=c[p],this._check(p,u);l&&this.options.checkperiod>0&&(this.checkTimeout=setTimeout(this._checkData,this.options.checkperiod*1e3,l),this.checkTimeout!=null&&this.checkTimeout.unref!=null&&this.checkTimeout.unref())}_killCheckPeriod(){if(this.checkTimeout!=null)return clearTimeout(this.checkTimeout)}_check(l,p){var c;return a(this,o),c=!0,p.t!==0&&p.t<Date.now()&&(this.options.deleteOnExpire&&(c=!1,this.del(l)),this.emit("expired",l,this._unwrap(p))),c}_isInvalidKey(l){var p;if(a(this,o),p=typeof l,r.call(this.validKeyTypes,p)<0)return this._error("EKEYTYPE",{type:typeof l})}_wrap(l,p,c=!0){var u,d,b,_;return a(this,o),this.options.useClones||(c=!1),d=Date.now(),u=0,_=1e3,p===0?u=0:p?u=d+p*_:this.options.stdTTL===0?u=this.options.stdTTL:u=d+this.options.stdTTL*_,b={t:u,v:c?e(l):l}}_unwrap(l,p=!0){return this.options.useClones||(p=!1),l.v!=null?p?e(l.v):l.v:null}_getKeyLength(l){return l.toString().length}_getValLength(l){return a(this,o),typeof l=="string"?l.length:this.options.forceString?JSON.stringify(l).length:Array.isArray(l)?this.options.arrayValueSize*l.length:typeof l=="number"?8:typeof l?.then=="function"?this.options.promiseValueSize:typeof Buffer<"u"&&Buffer!==null&&Buffer.isBuffer(l)?l.length:l!=null&&typeof l=="object"?this.options.objectValueSize*Object.keys(l).length:typeof l=="boolean"?8:0}_error(l,p={}){var c;return a(this,o),c=new Error,c.name=l,c.errorcode=l,c.message=this.ERRORS[l]!=null?this.ERRORS[l](p):"-",c.data=p,c}_initErrors(){var l,p,c;a(this,o),this.ERRORS={},c=this._ERRORS;for(p in c)l=c[p],this.ERRORS[p]=this.createErrorMessage(l)}createErrorMessage(l){return function(p){return l.replace("__key",p.type)}}}return o.prototype._ERRORS={ENOTFOUND:"Key `__key` not found",ECACHEFULL:"Cache max keys amount exceeded",EKEYTYPE:"The key argument has to be of type `string` or `number`. Found: `__key`",EKEYSTYPE:"The keys argument has to be an array.",ETTLTYPE:"The ttl argument has to be a number."},o}.call(this)}).call(Mu)});var Tu=fn((_u,Pu)=>{(function(){var s;s=Pu.exports=wu(),s.version="5.1.2"}).call(_u)});var Cu=fn((JQ,pd)=>{pd.exports={name:"fansunited-sdk-esm",version:"1.112.0",description:"Javascript SDK implemented as a standard module system",author:"fansunited",license:"ISC",homepage:"https://fansunitedmedia.com/",type:"module",exports:{".":{import:"./index.js",types:"./types/index.d.ts"},"./Core/*":{import:"./Core/*.js",types:"./types/Core/*.d.ts"}},typesVersions:{"*":{"*":["./types/*"],"Core/*":["./types/Core/*"]}},files:["*.js","*.d.ts","types/**/*.d.ts","types/Core/**/*.js","types/Core/**/*.d.ts"],sideEffects:!1}});var gn=(_=>(_.EN="en",_.BG="bg",_.RO="ro",_.EL="el",_.SK="sk",_.PT="pt",_.SR="sr",_.HU="hu",_.SV="sv",_.ES="es",_.FR="fr",_.NL="nl",_.DE="de",_.IT="it",_))(gn||{});var yn=class{validate=t=>{let e=this.validateField(t.lang),i=this.generateMessage(e);return{validation:e,message:i}};validateField=t=>{let e=Object.values(gn),i=null;return t!=null&&t.length>0?e.includes(t)?i="valid":i="invalid":i="missing",i};generateMessage=t=>{let e=null,i="warning";return t==="missing"&&(e="If no lang is passed the default one will be set which is: en"),t==="invalid"&&(e="This lang value is not supported, the default one will be set which is: en"),t==="valid"&&(e=null,i=null),{text:e,type:i}}};var Vi=(o=>(o.DEV="dev",o.PROD="prod",o.STAGING="staging",o.WATG="watg",o.YOLO="yolo",o.CSKA="cska",o))(Vi||{});var bn=class{validate(t){let e=this.validateField(t.environment),i=this.generateMessage(e);return{validation:e,message:i}}validateField=t=>{let e=Object.values(Vi),i=null;return t!=null&&t.length>0?e.includes(t)?i="valid":i="invalid":i="missing",i};generateMessage=t=>{let e=null,i="warning";return t==="missing"&&(e="If no environment is passed the default one will be set which is: prod"),t==="invalid"&&(e="This environment value is not supported, the default one will be set which is: prod"),t==="valid"&&(e=null,i=null),{text:e,type:i}}};var Mn=class{validate(t){let e=this.validateField(t.apiKey),i=this.generateMessage(e);return{validation:e,message:i}}validateField=t=>{let e=null;return t!=null&&t.length>0?e="valid":e="missing",e};generateMessage=t=>{let e=null,i="error";return t==="missing"&&(e="The field apiKey with valid value must be provided to use Fans United JS SDK"),t==="valid"&&(i=null),{text:e,type:i}}};var N=(r=>(r.NATIVE="native",r.ENETPULSE="enetpulse",r.SPORTRADAR="sportradar",r.SPORTAL_365="sportal365",r.API_FOOTBALL="api_football",r))(N||{});var In=class{validate(t){let e=this.validateField(t.idSchema),i=this.generateMessage(e);return{validation:e,message:i}}validateField=t=>{let e=Object.values(N),i=null;return t!=null&&t.length>0?e.includes(t)?i="valid":i="invalid":i="missing",i};generateMessage=t=>{let e=null,i="warning";return t==="missing"&&(e="If no idSchema is passed the default one will be set which is: native"),t==="invalid"&&(e="This idSchema value is not supported, the default one will be set which is: native"),t==="valid"&&(e=null,i=null),{text:e,type:i}}};var re=class{getIdToken=null;logout=null};var lt=class{text=null;type=null};var Hi=class{validation=null;message=new lt;getIdToken={validation:null,message:new lt};logout={validation:null,message:new lt}};var wn=class{validate(t){if(t.cookieToken)return new Hi;let e=this.validateAuthProvider(t.authProvider);return e.validation!=="missing"&&(e=this.validateAuthProviderConfigFields(t.authProvider,e),e=this.generateAuthProviderConfigMessages(e),e=this.checkAuthProviderConfigMessagesForErrors(e)),e}validateAuthProvider=t=>{let e=Object.keys(new re),i=new Hi;if(t){let r=Object.keys(t).filter(o=>!e.includes(o));r.length>0?(i.validation="invalid",i.message.type="warning",i.message.text=`${"You have passed a property which is not supported for the authentication provider:"} ${r.join(",")}`):i.validation="valid"}else i.validation="missing",i.message.type="error",i.message.text="The field authProvider must be provided to use this SDK";return i};validateAuthProviderConfigFields=(t,e)=>(Object.keys(new re).forEach(a=>{t[a]?e[a].validation="valid":e[a].validation="missing"}),e);generateAuthProviderConfigMessages=t=>(Object.keys(t).filter(e=>e!=="validation"&&e!=="message").forEach(e=>{let i=t[e];i.validation==="missing"&&(i.message.text=`${"The following property is missing from the authProvider object:"} ${e}`,i.message.type="error")}),t);checkAuthProviderConfigMessagesForErrors=t=>(Object.keys(t).filter(e=>e!=="validation"&&e!=="message").forEach(e=>{t[e].validation==="missing"&&t.validation==="valid"&&(t.validation="invalid",t.message.type="error",t.message.text="The field authProvider has missing properties")}),t)};var mt=class{validation;message};var _n=class{apiKey=null;environment=null;idSchema=null;clientId=null;lang=null;errorHandlingMode=null;cookieToken={name:new mt,requestHeaders:new mt};oddClient=null;authProvider={getIdToken:new mt,logout:new mt};isValid=!1};var Pn=class{validate(t){let e=this.validateField(t.clientId),i=this.generateMessage(e);return{validation:e,message:i}}validateField=t=>{let e=null;return t!=null&&t.length>0?e="valid":e="missing",e};generateMessage=t=>{let e=null,i="error";return t==="missing"&&(e="The field clientId must be provided to use Fans United JS SDK"),t==="valid"&&(e=null,i=null),{text:e,type:i}}};var vp=(e=>(e.DEFAULT="default",e.STANDARD="standard",e))(vp||{});var Tn=class{validate=t=>{let e=this.validateField(t.errorHandlingMode),i=this.generateMessage(e);return{validation:e,message:i}};validateField=t=>{let e=["default","standard"],i=null;return t?e.includes(t)?i="valid":i="invalid":i="missing",i};generateMessage=t=>{let e=null,i="warning";return t==="missing"&&(e="If no errorHandlingMode is passed the default one will be set which is: default"),t==="invalid"&&(e="This errorHandlingMode value is not supported, the default one will be set which is: default"),t==="valid"&&(e=null,i=null),{text:e,type:i}}};var $i=class extends mt{name={validation:null,message:new lt};requestHeaders={validation:null,message:new lt}};var En=class{keys=["name","requestHeaders"];isServerSide=typeof document>"u";validate(t){if(!t.cookieToken){let i=new $i;return i.message={type:null,text:null},i.validation="valid",i}let e=this.validateCookieToken(t.cookieToken);return e=this.validateCookieTokenConfigFields(t.cookieToken,e),e=this.generateCookieTokenConfigMessages(e),e=this.checkCookieTokenConfigMessagesForErrors(e),e}validateCookieToken=t=>{let e=new $i;e.message={type:null,text:null};let a=Object.keys(t).filter(r=>!this.keys.includes(r));return a.length>0?(e.validation="invalid",e.message.type="warning",e.message.text=`${"You have passed properties which are not supported for the cookie token configuration property:"} ${a.join(",")}`):e.validation="valid",e};validateCookieTokenConfigFields=(t,e)=>(this.keys.forEach(i=>{t[i]?e[i].validation="valid":i==="requestHeaders"&&!this.isServerSide?e[i].validation="valid":e[i].validation="missing"}),e);generateCookieTokenConfigMessages=t=>(Object.keys(t).filter(e=>e!=="validation"&&e!=="message").forEach(e=>{let i=t[e];i.validation==="missing"&&(i.message.text=`${"The following property is missing from the cookieToken object:"} ${e}`,i.message.type="error")}),t);checkCookieTokenConfigMessagesForErrors=t=>(Object.keys(t).filter(e=>e!=="validation"&&e!=="message").forEach(e=>{t[e].validation==="missing"&&(t.validation="invalid",t.message.type="error",t.message.text="The field cookieToken has missing properties")}),t)};var Wi=class extends mt{name={validation:null,message:new lt};credentials={validation:null,message:new lt}};var Rn=class{keys=["name","credentials"];validate=t=>{if(!t.oddClient){let i=new Wi;return i.validation="missing",i.message={type:"warning",text:"If no oddClient is passed the Odds namespace will not work. For more information check our documentation: https://docs.fansunitedmedia.com/docs/javascript-sdk#/"},i}let e=this.validateOddClient(t.oddClient);return e.message.type==="error"||(e=this.validateOddClientConfigFields(t.oddClient,e),e=this.checkOddClientMissingProperties(e),e.message.type==="error")||(e=this.validateOddClientCredentials(t.oddClient.credentials,e)),e};validateOddClient=t=>{let e=new Wi;if(e.message={type:null,text:null},!(t instanceof Object))return e.validation="invalid",e.message.type="error",e.message.text="The oddClient object is not valid. For more information check our documentation: https://docs.fansunitedmedia.com/docs/javascript-sdk#/",e;let a=Object.keys(t).filter(r=>!this.keys.includes(r));return a.length>0?(e.validation="invalid",e.message.type="warning",e.message.text=`${"You have passed properties which are not supported for the odd client configuration property:"} ${a.join(",")}`):e.validation="valid",e};validateOddClientConfigFields=(t,e)=>(this.keys.forEach(i=>{t[i]?e[i].validation="valid":e[i].validation="missing"}),e);validateOddClientCredentials=(t,e)=>{if(!(t instanceof Object))return e.credentials.validation="invalid",e.credentials.message.type="error",e.credentials.message.text="The odd client credentials object is not valid. The odd client will not work without credentials. For more information check our documentation: https://docs.fansunitedmedia.com/docs/javascript-sdk#/",e;let i=Object.keys(t),a=["username","password"],r=a.filter(n=>!i.includes(n));r.length>0&&(e.credentials.validation="invalid",e.credentials.message.type="error",e.credentials.message.text=`${"The following property is missing from the odd client credentials object:"} ${r.join(", ")}`),i.length>0&&r.length===0&&(!t.username||!t.password)&&(e.credentials.validation="invalid",e.credentials.message.type="error",e.credentials.message.text="The odd client credentials object is not valid. The odd client will not work without credentials. For more information check our documentation: https://docs.fansunitedmedia.com/docs/javascript-sdk#/");let o=i.filter(n=>!a.includes(n));return o.length>0&&(e.credentials.validation="invalid",e.credentials.message.type="warning",e.credentials.message.text=`${"You have passed properties which are not supported for the odd client credentials configuration property:"} ${o.join(", ")}`),e};checkOddClientMissingProperties=t=>(Object.keys(t).filter(e=>e!=="validation"&&e!=="message").forEach(e=>{t[e].validation==="missing"&&(t.validation="invalid",t.message.type="error",t.message.text="The field oddClient has missing properties. For more information check our documentation: https://docs.fansunitedmedia.com/docs/javascript-sdk#/")}),t)};var Fn=class{validate=t=>{let e=this.checkFieldsForValues(t);return e.isValid=this.containsErrorMessage(e),e};checkFieldsForValues=t=>{let e=new _n,i={apiKey:new Mn,environment:new bn,idSchema:new In,clientId:new Pn,lang:new yn,errorHandlingMode:new Tn,authProvider:new wn,cookieToken:new En,oddClient:new Rn};for(let[a,r]of Object.entries(e))a!=="isValid"&&(r=i[a].validate(t));return Object.keys(i).forEach(a=>{e[a]=i[a].validate(t)}),e};containsErrorMessage=t=>{let e=!0;for(let[i,a]of Object.entries(t))if(i!=="authProvider"&&i!=="cookieToken"&&i!=="oddClient"){if(i!=="isValid"&&a.message.type==="error")return e=!1,e;if(i!=="isValid"&&a.message.type==="warning")return e=!0,e}else if(a.message.type==="error"||i==="oddClient"&&a.credentials.message.type==="error")return e=!1,e;return e}};var Sc=s=>{let t=200,e=[],i=0;return e[i]=[],s.forEach(a=>{e[i].length<=t-1?e[i].push(a):(i++,e[i]=[a])}),e},Vt=(s,t)=>{let e=[];for(;s.length>t;){let i=s.splice(0,t);e.push(i)}return e.push(s),e},O=(s,t)=>{let e="",i={profile:"https://profile.fansunitedapi.com/v1",football:"https://football.fansunitedapi.com/v1",idMapping:"https://id-mapping.fansunitedapi.com/v1",predictor:"https://prediction.fansunitedapi.com/v1",client:"https://client.fansunitedapi.com/v1",loyalty:"https://loyalty.fansunitedapi.com/v1",miniGames:"https://mini-games.fansunitedapi.com/v1",discussions:"https://discussions.fansunitedapi.com/v1",privateLeagues:"https://private-leagues.fansunitedapi.com/v1",voting:"https://voting.fansunitedapi.com/v1"},a={profile:"https://profile.watg.fansunitedapi.com/v1",football:"https://football.watg.fansunitedapi.com/v1",idMapping:"https://id-mapping.watg.fansunitedapi.com/v1",predictor:"https://prediction.watg.fansunitedapi.com/v1",client:"https://client.watg.fansunitedapi.com/v1",loyalty:"https://loyalty.watg.fansunitedapi.com/v1",miniGames:"https://mini-games.watg.fansunitedapi.com/v1",discussions:"https://discussions.watg.fansunitedapi.com/v1",privateLeagues:"https://private-leagues.watg.fansunitedapi.com/v1",voting:"https://voting.watg.fansunitedapi.com/v1"},r={profile:"https://profile.yolo.fansunitedapi.com/v1",football:"https://football.yolo.fansunitedapi.com/v1",idMapping:"https://id-mapping.yolo.fansunitedapi.com/v1",predictor:"https://prediction.yolo.fansunitedapi.com/v1",client:"https://client.yolo.fansunitedapi.com/v1",loyalty:"https://loyalty.yolo.fansunitedapi.com/v1",miniGames:"https://mini-games.yolo.fansunitedapi.com/v1",discussions:"https://discussions.yolo.fansunitedapi.com/v1",privateLeagues:"https://private-leagues.yolo.fansunitedapi.com/v1",voting:"https://voting.yolo.fansunitedapi.com/v1"},o={profile:"https://profile.cska.fansunitedapi.com/v1",football:"https://football.cska.fansunitedapi.com/v1",idMapping:"https://id-mapping.cska.fansunitedapi.com/v1",predictor:"https://prediction.cska.fansunitedapi.com/v1",client:"https://client.cska.fansunitedapi.com/v1",loyalty:"https://loyalty.cska.fansunitedapi.com/v1",miniGames:"https://mini-games.cska.fansunitedapi.com/v1",discussions:"https://discussions.cska.fansunitedapi.com/v1",privateLeagues:"https://private-leagues.cska.fansunitedapi.com/v1",voting:"https://voting.cska.fansunitedapi.com/v1"},n={profile:"http://localhost:8010/v1",football:"http://localhost:8080/v1",idMapping:"http://localhost:8030/v1",predictor:"http://localhost:8040/v1",client:"http://localhost:8070/v1",loyalty:"http://localhost:8060/v1",miniGames:"http://localhost:9040/v1",discussions:"http://localhost:9020/v1",privateLeagues:"http://localhost:9010/v1",voting:"http://localhost:9030/v1"},l={profile:"https://profile.fansunitedstagingapi.com/v1",football:"https://football.fansunitedstagingapi.com/v1",idMapping:"https://id-mapping.fansunitedstagingapi.com/v1",predictor:"https://prediction.fansunitedstagingapi.com/v1",client:"https://client.fansunitedstagingapi.com/v1",loyalty:"https://loyalty.fansunitedstagingapi.com/v1",miniGames:"https://mini-games.fansunitedstagingapi.com/v1",discussions:"https://discussions.fansunitedstagingapi.com/v1",privateLeagues:"https://private-leagues.fansunitedstagingapi.com/v1",voting:"https://voting.fansunitedstagingapi.com/v1"};return s==="prod"?e=i[t]:s==="dev"?e=n[t]:s==="watg"?e=a[t]:s==="yolo"?e=r[t]:s==="cska"?e=o[t]:e=l[t],e},oe=s=>Array.from(new Set(s)),g=s=>s||!1,m=()=>`&disable_cache=${Date.now()}`,Cp=s=>JSON.parse(JSON.stringify(s.sort((t,e)=>t.localeCompare(e))));var it=(P=>(P.FT_1X2="FT_1X2",P.HT_1X2="HT_1X2",P.BOTH_TEAMS_SCORE="BOTH_TEAMS_SCORE",P.DOUBLE_CHANCE="DOUBLE_CHANCE",P.HT_FT="HT_FT",P.PLAYER_SCORE="PLAYER_SCORE",P.PLAYER_YELLOW_CARD="PLAYER_YELLOW_CARD",P.PLAYER_RED_CARD="PLAYER_RED_CARD",P.RED_CARD_MATCH="RED_CARD_MATCH",P.PENALTY_MATCH="PENALTY_MATCH",P.PLAYER_SCORE_FIRST_GOAL="PLAYER_SCORE_FIRST_GOAL",P.CORNERS_MATCH="CORNERS_MATCH",P.CORRECT_SCORE="CORRECT_SCORE",P.CORRECT_SCORE_ADVANCED="CORRECT_SCORE_ADVANCED",P.CORRECT_SCORE_HT="CORRECT_SCORE_HT",P.PLAYER_SCORE_HATTRICK="PLAYER_SCORE_HATTRICK",P.PLAYER_SCORE_TWICE="PLAYER_SCORE_TWICE",P.OVER_GOALS_0_5="OVER_GOALS_0_5",P.OVER_GOALS_1_5="OVER_GOALS_1_5",P.OVER_GOALS_2_5="OVER_GOALS_2_5",P.OVER_GOALS_3_5="OVER_GOALS_3_5",P.OVER_GOALS_4_5="OVER_GOALS_4_5",P.OVER_GOALS_5_5="OVER_GOALS_5_5",P.OVER_GOALS_6_5="OVER_GOALS_6_5",P.OVER_CORNERS_6_5="OVER_CORNERS_6_5",P.OVER_CORNERS_7_5="OVER_CORNERS_7_5",P.OVER_CORNERS_8_5="OVER_CORNERS_8_5",P.OVER_CORNERS_9_5="OVER_CORNERS_9_5",P.OVER_CORNERS_10_5="OVER_CORNERS_10_5",P.OVER_CORNERS_11_5="OVER_CORNERS_11_5",P.OVER_CORNERS_12_5="OVER_CORNERS_12_5",P.OVER_CORNERS_13_5="OVER_CORNERS_13_5",P))(it||{}),jc=["OVER_GOALS_0_5","OVER_GOALS_1_5","OVER_GOALS_2_5","OVER_GOALS_3_5","OVER_GOALS_4_5","OVER_GOALS_5_5","OVER_GOALS_6_5"],Yc=["OVER_CORNERS_6_5","OVER_CORNERS_7_5","OVER_CORNERS_8_5","OVER_CORNERS_9_5","OVER_CORNERS_10_5","OVER_CORNERS_11_5","OVER_CORNERS_12_5","OVER_CORNERS_13_5"],Mt=["PLAYER_RED_CARD","PLAYER_SCORE","PLAYER_SCORE_FIRST_GOAL","PLAYER_SCORE_HATTRICK","PLAYER_SCORE_TWICE","PLAYER_YELLOW_CARD"],Xc=["FT_1X2","HT_1X2","HT_FT","DOUBLE_CHANCE","CORNERS_MATCH","CORRECT_SCORE","CORRECT_SCORE_HT","CORRECT_SCORE_ADVANCED"],qi="PLAYER_SCORE_FIRST_GOAL";var zi=class{id="";achievedAt=""};var se=class{participationCount=null;points=null};var ne=class{totalPoints=null;postPoints=null;postsMade=null;reactionPoints=null;reactionCount=null};var le=class{participationCount=null};var ui=class{participations=0;points=0};var Ht=class{footballCompetitions=[];footballTeams=[]};var pe=class{predictionsMade=0;correct=0;points=0;breakdown=new Ht};var ce=class{single=new pe;topX=new ui;matchQuiz=new ui};var Qi=class{overallPercent;byFootballCompetition;byFootballTeam;byFootballMarket};var Ki=class{profileId;tier;points;predictionsMade;successRates=new Qi;predictions=new ce;tiers=[];badges=[];discussions=new ne;classicQuizzes=new se;eitherOr=new le};var ji=class{entityId="";entityType="";entitySource="";model=null;predictionsMade=0;correct=0;points=0};var Yi=class{successRatePercent;model=null};var Ct=class{content=null;tags=[];campaign=null};var ue=class{id=null;profileId=null;property=null;value=null;action=null;context=new Ct;points=0};var j=class{currentPage=null;itemsPerPage=null;totalItems=null;numberOfPages=null};var k=class{pagination=new j};var Xi=class{meta=new k;data=[new ue]};var Sn=class{remapSingleResponse=t=>{let e=new ue;return e.id=t.id,e.profileId=t.profile_id,e.property=t.property,e.value=t.value,e.action=t.action,e.context.content=t.context.content,e.context.tags=t.context.tags,e.context.campaign=t.context.campaign,e.points=t.points,e};remapActivitiesResponse=t=>{let e=new Xi;return e.meta.pagination.currentPage=t.meta.pagination.current_page,e.meta.pagination.itemsPerPage=t.meta.pagination.items_per_page,e.meta.pagination.numberOfPages=t.meta.pagination.number_of_pages,e.meta.pagination.totalItems=t.meta.pagination.total_items,e.data=t.data.map(i=>this.remapSingleResponse(i)),e};remapStatsResponse=t=>{let e=new Ki;return e.profileId=t.profile_id,e.tier=t.tier,e.points=t.points,e.predictionsMade=t.predictions_made,e.successRates.overallPercent=t.success_rates.overall_percent,e.successRates.byFootballCompetition=this.constructNewRecord(t.success_rates.by_competition),e.successRates.byFootballTeam=this.constructNewRecord(t.success_rates.by_team),e.successRates.byFootballMarket=this.constructNewRecord(t.success_rates.by_market),e.predictions=t.predictions?this.remapPredictionsStats(t.predictions):null,e.tiers=t.tiers?this.remapAchievementsStats(t.tiers):null,e.badges=t.badges?this.remapAchievementsStats(t.badges):null,e.discussions=t.discussions?this.remapDiscussionStats(t.discussions):null,e.classicQuizzes=t.classic_quizzes?this.remapClassicQuizStats(t.classic_quizzes):null,e.eitherOr=t.either_or?this.remapEitherOrStats(t.either_or):null,e};constructNewRecord=t=>{let e;if(Object.entries(t).length)Object.entries(t).forEach(([i,a])=>{e={...e,[i]:this.remapSuccessRatePercent(a)},it[i]&&delete e[i].model});else return t;return e};remapSuccessRatePercent=t=>{let e=new Yi;return e.successRatePercent=t.success_rate_percent,e};remapPredictionsStats=t=>{let e=new ce;return e.single=this.remapSinglePredictionsStats(t.single),e.topX=t.top_x,e.matchQuiz=t.match_quiz,e};remapSinglePredictionsStats=t=>{let e=new pe;return e.predictionsMade=t.predictions_made,e.correct=t.correct,e.points=t.points,e.breakdown=this.remapBreakdownSinglePredictionsStats(t.breakdown),e};remapBreakdownSinglePredictionsStats=t=>{if(t&&Object.keys(t).length){let e=new Ht,i=[],a=[];return Object.keys(t).forEach(r=>{let o=new ji;o.entityId=r,o.entityType=t[r].entity_type,o.entitySource=t[r].entity_source,o.predictionsMade=t[r].predictions_made,o.correct=t[r].correct,o.points=t[r].points,o.entityType==="competition"?i.push(o):o.entityType==="team"&&a.push(o)}),e.footballCompetitions=i,e.footballTeams=a,e}return new Ht};remapAchievementsStats=t=>t.map(e=>{let i=new zi;return i.id=e.id,i.achievedAt=e.achieved_at,i});remapDiscussionStats=t=>{let e=new ne;return e.totalPoints=t.total_points,e.postPoints=t.post_points,e.postsMade=t.posts_made,e.reactionPoints=t.reaction_points,e.reactionCount=t.reaction_count,e};remapClassicQuizStats=t=>{let e=new se;return e.participationCount=t.participation_count,e.points=t.points,e};remapEitherOrStats=t=>{let e=new le;return e.participationCount=t.participation_count,e}};function vc(s){this.message=s}vc.prototype=new Error,vc.prototype.name="InvalidCharacterError";var Jc=typeof window<"u"&&window.atob&&window.atob.bind(window)||function(s){var t=String(s).replace(/=+$/,"");if(t.length%4==1)throw new vc("'atob' failed: The string to be decoded is not correctly encoded.");for(var e,i,a=0,r=0,o="";i=t.charAt(r++);~i&&(e=a%4?64*e+i:i,a++%4)?o+=String.fromCharCode(255&e>>(-2*a&6)):0)i="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(i);return o};function qu(s){var t=s.replace(/-/g,"+").replace(/_/g,"/");switch(t.length%4){case 0:break;case 2:t+="==";break;case 3:t+="=";break;default:throw"Illegal base64url string!"}try{return function(e){return decodeURIComponent(Jc(e).replace(/(.)/g,function(i,a){var r=a.charCodeAt(0).toString(16).toUpperCase();return r.length<2&&(r="0"+r),"%"+r}))}(t)}catch{return Jc(t)}}function Ap(s){this.message=s}function zu(s,t){if(typeof s!="string")throw new Ap("Invalid token specified");var e=(t=t||{}).header===!0?0:1;try{return JSON.parse(qu(s.split(".")[e]))}catch(i){throw new Ap("Invalid token specified: "+i.message)}}Ap.prototype=new Error,Ap.prototype.name="InvalidTokenError";var Cc=zu;var C=(a=>(a[a.BAD_METHOD_CALL=400]="BAD_METHOD_CALL",a[a.UNAUTHORIZED=401]="UNAUTHORIZED",a[a.NOT_FOUND=404]="NOT_FOUND",a[a.PRECONDITION_FAILED=412]="PRECONDITION_FAILED",a))(C||{});var A=(E=>(E.INVALID_TEMPLATE="INVALID_TEMPLATE",E.INVALID_PREDICTION="INVALID_PREDICTION",E.INVALID_MARKET="INVALID_MARKET",E.INVALID_FIELD="INVALID_FIELD",E.INVALID_TYPE="INVALID_TYPE",E.EXCEEDED_LENGTH="EXCEEDED_LENGTH",E.INVALID_TOKEN="invalid_token",E.UNAUTHORIZED="unauthorized",E.INVALID_FILTERS="invalid_filters",E.INVALID_AVATAR="invalid_avatar",E.INVALID_METHOD_CALL="invalid_method_call",E.INVALID_LIMIT="invalid_limit",E.INVALID_TEMPLATE_GROUP_ID="invalid_template_group_id",E.INVALID_TEMPLATE_GROUP_FILTERS="invalid_template_group_filters",E.INVALID_PAGE_NUMBER="invalid_page_number",E.INVALID_DISCUSSION_IDS="invalid_discussion_ids",E.ID_MAPPING_NOT_FOUND="id_mapping_not_found",E.INVALID_COMPETITION_ID="invalid_competition_id",E.INVALID_TEAM_ID="invalid_team_id",E.INVALID_IDS="invalid_ids",E.INVALID_INPUT_PROVIDER="invalid_input_provider",E.INVALID_OUTPUT_PROVIDER="invalid_output_provider",E.INVALID_MATCH_SUMMARY="invalid_match_summary",E.INVALID_MATCH_SUMMARY_PREDICTIONS="invalid_match_summary_predictions",E.INVALID_MATCH_SUMMARY_PREDICTIONS_KEYS="invalid_match_summary_predictions_keys",E.ENTITY_IDS_NOT_FOUND="entity_ids_not_found",E.MATCH_IDS_NOT_FOUND="match_ids_not_found",E.INVALID_MATCH_IDS="invalid_match_ids",E.ODD_CLIENT_CONFIGURATION_NOT_FOUND="odd_client_configuration_not_found",E))(A||{});var G={native:"id",sportradar:"sportradar_id",sportal365:"sportal365_id",enetpulse:"enetpulse_id",api_football:"api_football_id"},Ac={PREDICTOR_USER_RELATED_OPERATION:"https://docs.fansunitedmedia.com/docs/predictor-operations#user-related-operations"},Oc=["matchId","matchType","market","prediction"],Zc=new Map().set("FT_1X2","fullTimeOneXTwo").set("HT_1X2","halfTimeOneXTwo").set("BOTH_TEAMS_SCORE","bothTeamsScore").set("DOUBLE_CHANCE","doubleChance").set("HT_FT","halfTimeFullTime").set("PLAYER_SCORE","playerScore").set("PLAYER_YELLOW_CARD","playerYellowCard").set("PLAYER_RED_CARD","playerRedCard").set("RED_CARD_MATCH","redCardMatch").set("PENALTY_MATCH","penaltyMatch").set("PLAYER_SCORE_FIRST_GOAL","playerScoreFirstGoal").set("CORNERS_MATCH","cornersMatch").set("CORRECT_SCORE","correctScore").set("CORRECT_SCORE_ADVANCED","correctScoreAdvanced").set("CORRECT_SCORE_HT","correctScoreHalfTime").set("PLAYER_SCORE_HATTRICK","playerScoreHattrick").set("PLAYER_SCORE_TWICE","playerScoreTwice").set("OVER_GOALS_0_5","overZeroPointFiveGoals").set("OVER_GOALS_1_5","overOnePointFiveGoals").set("OVER_GOALS_2_5","overTwoPointFiveGoals").set("OVER_GOALS_3_5","overThreePointFiveGoals").set("OVER_GOALS_4_5","overFourPointFiveGoals").set("OVER_GOALS_5_5","overFivePointFiveGoals").set("OVER_GOALS_6_5","overSixPointFiveGoals").set("OVER_CORNERS_6_5","overSixPointFiveCorners").set("OVER_CORNERS_7_5","overSevenPointFiveCorners").set("OVER_CORNERS_8_5","overEightPointFiveCorners").set("OVER_CORNERS_9_5","overNinePointFiveCorners").set("OVER_CORNERS_10_5","overTenPointFiveCorners").set("OVER_CORNERS_11_5","overElevenPointFiveCorners").set("OVER_CORNERS_12_5","overTwelvePointFiveCorners").set("OVER_CORNERS_13_5","overThirteenPointFiveCorners");var L=(I=>(I.INVALID_MATCH_ID="Match id is invalid!",I.INVALID_PLAYER_ID="Player id is invalid!",I.QUERY_PARAM_MATCH_IDS_EXCEEDED="Maximum matchIds in PredictionFilters should be 10 or less.",I.QUERY_PARAM_FILTERS_LIMIT_EXCEEDED="Maximum limit for filtering games is 50 or less.",I.INVALID_FIXTURES_FIELD="Fixtures field is invalid. For more information please visit our documentation",I.INVALID_TOKEN="Invalid JWT token is provided",I.EXPIRED_TOKEN="The provided JWT token is expired",I.ENTITIES_NEEDED="At least one of footballCompetitions, footballTeams or footballPlayers properties should be provided for filters.",I.ENTITIES_FOLLOWS_FILTERS_EXCEEDED="Maximum length per entity should be 24 or less.",I.INVALID_TYPE="You have provided invalid type. The valid type is ",I.INVALID_VALUE="You have provided invalid value. The valid value is ",I.INVALID_AVATAR="Invalid URL syntax for avatar image.",I.INVALID_GET_PROFILES_METHOD_CALL="The method 'getByIds' from Profile namespace is not called correctly. You need to provide 'profileIds' OR 'search' parameters to the method, but you can't use both of them or neither of them.",I.INVALID_LIMIT="Invalid limit. The maximum limit is: ",I.INVALID_LIMIT_TYPE="Invalid limit type. The proper type is number.",I.FILTER_COMBINATION_ERROR="You need to use both 'entityIds' and 'entityType' filters together",I.INVALID_ENTITY_TYPE="Invalid 'entityType' filter. Please use one of the following valid options: competition, team, or player",I.INVALID_TEMPLATE_GROUP_ID="There is no group in this template with the provided groupId",I.INVALID_TEMPLATE_GROUP_FILTERS="The provided template group has no filters",I.INVALID_PAGE_NUMBER="Invalid page number provided. Use number between 1 and max number of pages.",I.INVALID_DISCUSSION_IDS="Invalid discussion ids argument. Please provide at least one discussion id in an array",I.EXCEEDED_DISCUSSION_IDS="Maximum number of discussion ids exceeded. The maximum number of discussion ids is 50. You can use 'getPostsCountExtended' method for more than 50 discussion ids.",I.EXCEEDED_EXTENDED_DISCUSSION_IDS="Maximum number of discussion ids exceeded. The maximum number of discussion ids is: ",I.ID_MAPPING_NOT_FOUND="No ID mappings are available for the provided ID. ID argument: ",I.INVALID_PARAM="Invalid parameter provided. Please check the following parameter: ",I.INVALID_COMPETITION_ID="Invalid competition ID provided. Please provide a valid competition ID.",I.INVALID_TEAM_ID="Invalid team ID provided. Please provide a valid team ID.",I.INVALID_OR_EMPTY_IDS="Invalid or empty IDs provided. Please provide at least one ID.",I.INVALID_PROVIDER="Invalid provider. The valid providers are: 'native', 'enetpulse', 'sportal365', 'sportradar' and 'api_football'.",I.INVALID_OUTPUT_PROVIDER="Invalid output provider. The output can not be the same as the input provider.",I.MATCH_SUMMARY_REQUIRED="Match summary is required.",I.MATCH_SUMMARY_PREDICTIONS_REQUIRED="Predictions in match summary are required.",I.INVALID_MATCH_SUMMARY_PREDICTIONS_KEYS="Keys in predictions in match summary are invalid. The valid ones are: ",I.INVALID_COLLECT_LEAD_METHOD_CALL="The method 'collectLead' from Profile namespace is not called correctly. You need to provide 'requestBody' parameter to the method.",I.REQUIRED_FIXTURES_FIELD="Fixtures field is required and should contain at least one fixtures object. For more information please visit our documentation",I.INVALID_TIEBREAKER_FIELD="Tiebreaker field is invalid. It should contain statTotal key with integer value. For more information please visit our documentation",I.ENTITY_IDS_NOT_FOUND="Some of the sport entity IDs were not found for the provided id schema",I.MATCH_IDS_NOT_FOUND="Some of the match IDs were not found for the provided id schema",I.INVALID_STANDING_PREDICTION_ARGUMENT="The prediction argument is invalid. For more information please visit our documentation",I.INVALID_MAP_PLAYERS_ROLES_KEYS="The keys in the players roles map are not part of the valid keys. The valid keys are: ",I.INVALID_MAP_PLAYERS_ROLES_VALUES="The values in the map are not valid. The valid ones are: ",I.INVALID_MATCH_IDS="Match IDs are invalid!",I.MISSING_ODD_CLIENT_CONFIGURATION="Odds namespace requires oddClient configuration to be set",I))(L||{}),Lc={UNEXPECTED_STATUS_PROP:`Unexpected provided property 'status'. You can NOT use this property for this method. For more information visit our documentation:
|
|
2
|
+
${Ac.PREDICTOR_USER_RELATED_OPERATION}`,UNEXPECTED_TYPE_PROP:`Unexpected provided property 'type'. You can NOT use this property for this method. For more information visit our documentation:
|
|
3
|
+
${Ac.PREDICTOR_USER_RELATED_OPERATION}`},tu=(s,t)=>`The prediction '${s}' is invalid for market '${t}'. Please check again have you passed appropriate prediction model. For more information please visit our documentation: https://docs.fansunitedmedia.com/sdks/js/match.quiz#gamerelatedoperations`,Op=s=>`The market '${s}' is not supported from Fans United. For more information please visit our documentation: https://docs.fansunitedmedia.com/docs/predictor-operations#make-football-prediction`,eu=s=>`The market '${s}' is not valid for Top X game. The only available market is CORRECT_SCORE.`,iu=s=>`The field/s '${s.length>1?s.join(", "):s[0]}' is/are invalid. For more information please visit our documentation: https://docs.fansunitedmedia.com/docs/javascript-sdk`,au=(s,t)=>`The following field/s is/are missing from ${s}: '${t.length>1?t.join(", "):t[0]}'. For more information please visit our documentation: https://docs.fansunitedmedia.com/docs/predictor-operations#make-football-prediction`,ru=(s,t)=>`The field ${s} has incorrect type. The correct type is ${t}`;var $t=class{data={error:{code:0,status:"",message:""}};status=0;statusText="";headers=null;constructor(t,e){this.data.error.code=e.code,this.data.error.status=e.status,this.data.error.message=e.message,this.status=t.status,this.statusText=t.statusText,this.headers=t.headers}errorMessage=()=>this.data.error.message};var h=class{error={code:0,status:"",message:""};constructor(t,e,i){this.error.code=t,this.error.status=e,this.error.message=i}};var v=class{baseUrl=null;apiSignInUrl=null;jwtToken=null;idSchema=null;retryRequest=!1;headers=null;authHeaders=null;errorHandlingMode=null;configuration=null;constructor(t,e){this.baseUrl=e,this.configuration=t,this.apiSignInUrl=`?key=${t.apiKey}&client_id=${t.clientId}`,this.errorHandlingMode=t.errorHandlingMode,this.idSchema=t.idSchema,this.headers={"Content-Type":"application/json"}}getJwtToken=()=>{if(this.configuration.cookieToken){let t=[];typeof document>"u"?t=(this.configuration.cookieToken.requestHeaders.get("cookie")||"").split(";"):t=document.cookie.split(";");let e=t.find(r=>r.trim().startsWith(`${this.configuration.cookieToken.name}=`));if(!e)return"";let i=e.split("=")[1].trim(),a=decodeURIComponent(i);try{let r=JSON.parse(a);return r.token||r||""}catch{return a}}return this.configuration.authProvider?.getIdToken()||""};getAuthHeaders=()=>({"Content-Type":"application/json",Authorization:`Bearer ${this.getJwtToken()}`});fetchWithoutAuth=async(t,e,i,a)=>{let r=null;a?r=await fetch(this.baseUrl+t,{headers:this.headers,method:i||"GET",body:JSON.stringify(a)}):r=await fetch(this.baseUrl+t,{headers:this.headers,method:i||"GET"});let o=await r.json();if(!r.ok){let n=this.transformFetchException(r,o);throw console.warn(e,n),n}return o};fetchWithoutAuthAdditionalHeaders=async(t,e,i)=>{let a=await fetch(this.baseUrl+t,{headers:{...this.headers,...i}}),r=await a.json();if(!a.ok){let o=this.transformFetchException(a,r);throw console.warn(e,o),o}return r};fetchWithAuth=async(t,e,i,a)=>{this.validateJWTToken();let r=null,o=null;if(i&&a?r=await fetch(this.baseUrl+t,{method:i,headers:this.getAuthHeaders(),body:JSON.stringify(a)}):i&&!a?r=await fetch(this.baseUrl+t,{method:i,headers:this.getAuthHeaders()}):r=await fetch(this.baseUrl+t,{headers:this.getAuthHeaders()}),i!=="DELETE"&&(o=await r.json()),!r.ok){(r.status===401||r.status===403)&&!this.retryRequest&&(this.retryRequest=!0,await this.fetchWithAuth(t,e,i,a)),this.retryRequest=!1;let n=this.transformFetchException(r,o||await r.json());throw console.warn(e,n),n}return this.retryRequest=!1,o};fetchWithAuthNewBaseURL=async(t,e,i,a,r)=>{this.validateJWTToken();let o=null,n=null;if(a&&r?o=await fetch(t+e,{method:a,headers:this.getAuthHeaders(),body:JSON.stringify(r)}):a&&!r?o=await fetch(t+e,{method:a,headers:this.getAuthHeaders()}):o=await fetch(t+e,{headers:this.getAuthHeaders()}),a!=="DELETE"&&(n=await o.json()),!o.ok){(o.status===401||o.status===403)&&!this.retryRequest&&(this.retryRequest=!0,await this.fetchWithAuthNewBaseURL(t,e,i,a,r)),this.retryRequest=!1;let l=this.transformFetchException(o,n||await o.json());throw console.warn(i,l),l}return this.retryRequest=!1,n};transformFetchException=(t,e)=>{if(!e&&t.status===401){if(this.errorHandlingMode==="standard")return new h(401,"unauthorized","Invalid JWT token is provided");let o={code:401,status:"unauthorized",message:"Invalid JWT token is provided"};return new $t(t,o)}let{code:i,status:a,message:r}=e.error;return this.errorHandlingMode==="standard"?new h(i,a,r):new $t(t,e.error)};validateJWTToken=()=>{let t=null;try{t=Cc(this.getJwtToken())}catch(i){if(this.errorHandlingMode==="default"){let a={status:401,statusText:i.message,headers:{}},r={code:401,status:"invalid_token",message:"Invalid JWT token is provided"};throw new $t(a,r)}else if(this.errorHandlingMode==="standard")throw new h(401,"invalid_token","Invalid JWT token is provided")}if(Date.now()>t.exp*1e3){if(this.errorHandlingMode==="default"){let i={status:401,statusText:"",headers:{}},a={code:401,status:"invalid_token",message:"The provided JWT token is expired"};throw new $t(i,a)}else if(this.errorHandlingMode==="standard")throw new h(401,"invalid_token","The provided JWT token is expired")}};extractUserIdFromToken=()=>{try{return Cc(this.getJwtToken())?.sub||""}catch(t){return console.error(t),""}}};var di=class extends v{activityRemapper=null;constructor(t){super(t,O(t.environment,"loyalty")),this.activityRemapper=new Sn}createActivity=async t=>{let e=`/activities${this.apiSignInUrl}`,i="There was a problem with creating activity",a="POST",r=await this.fetchWithAuth(e,i,a,t);return this.activityRemapper.remapSingleResponse(r)};deleteActivity=async t=>{let e=`/activities/${t}${this.apiSignInUrl}`,i=`There was a problem deleting the following activity: ${t}`,a="DELETE";return await this.fetchWithAuth(e,i,a),!0};getOwnActivities=async(t,e)=>{let i=`/activities${this.apiSignInUrl}`,a=Date.now(),r="There was a problem with fetching own activities";t&&(i+=`${t.constructFilterUrl()}`),e&&(i+=`disable_cache=${a}`);let o=await this.fetchWithAuth(i,r);return this.activityRemapper.remapActivitiesResponse(o)};getActivitiesForUser=async(t,e,i)=>{let a=`/users/${t}/activities${this.apiSignInUrl}`,r=Date.now(),o=`There was a problem with fetching activities for user: ${t}`;e&&(a+=`${e.constructFilterUrl()}`),i&&(a+=`disable_cache=${r}`);let n=await this.fetchWithoutAuth(a,o);return this.activityRemapper.remapActivitiesResponse(n)};getStats=async(t,e)=>{let i="",a="",r=null;return t?(i+=g(e)?`/users/${t}/statistics${this.apiSignInUrl}${m()}`:`/users/${t}/statistics${this.apiSignInUrl}`,a=`There was a problem fetching statistics for profile: ${t}`,r=await this.fetchWithoutAuth(i,a)):(i+=`/statistics${this.apiSignInUrl}`,a="There was a problem fetching profile`s statistics",r=await this.fetchWithAuth(i,a)),this.activityRemapper.remapStatsResponse(r.data)}};var xc=(f=>(f.LIKE="like",f.DISLIKE="dislike",f.PAGE_VIEW="page_view",f.CONTENT_CONSUMED="content_consumed",f.SHARE="share",f.COMMENT="comment",f.CLICK_AD="click_ad",f.PREDICTION_MADE="prediction_made",f.CONVERT="convert",f.MANAGE_INTERESTS="manage_interests",f.GAME_PARTICIPATION="game_participation",f.ARTICLE_CONSUMED="article_consumed",f.VIDEO_CONSUMED="video_consumed",f.SHORT_VIDEO_CONSUMED="short_video_consumed",f.LONG_VIDEO_CONSUMED="long_video_consumed",f.AUDIO_CONSUMED="audio_consumed",f.GALLERY_CONSUMED="gallery_consumed",f.IMAGE_CONSUMED="image_consumed",f.POLL_PARTICIPATION="poll_participation",f))(xc||{});var mi=class{action=null;context=new Ct;constructor(t,e,i,a){this.action=t,this.context.tags=e,i&&(this.context.content=i),a&&(this.context.campaign=a)}};var vn={player:"players",team:"teams",homeTeam:"teams",awayTeam:"teams",country:"countries",competition:"competitions",match:"matches"},Cn=class extends v{constructor(t){super(t,O(t.environment,"idMapping"))}getEntityById=async(t,e)=>{let i=`/football${this.apiSignInUrl}&input_provider=${this.idSchema}&${vn[t]}=${e}`,a=`There was a problem with id mapping request for the following id: ${e}`;return await this.fetchWithoutAuth(i,a)};getEntityByIdAndSchema=async(t,e,i)=>{let a=`/football${this.apiSignInUrl}&input_provider=${i}&${vn[t]}=${e}`,r=`There was a problem with id mapping request for the following id: ${e}`;return await this.fetchWithoutAuth(a,r)};getEntityIdsByIdsAndSchema=async(t,e,i)=>{let a=`/football${this.apiSignInUrl}&input_provider=${i}&${vn[t]}=${e.join(",")}`,r=`There was a problem with id mapping request for the following ids: ${e.join(",")}`;return await this.fetchWithoutAuth(a,r)};getEntitiesByIds=async(t,e,i)=>{e.sort((o,n)=>o.localeCompare(n));let a=Sc(e),r=[];for(let o of a){let n=`/football${this.apiSignInUrl}&input_provider=${i}&${vn[t]}=${o.join(",")}`,l=`There was a problem with id mapping request for the following ids :${o.join(",")}`,p=await this.fetchWithoutAuth(n,l);r=[...r,...p.data]}return r};getEntitiesByIdObjs=async(t,e)=>{let i=[],a={},r=[];Object.keys(t).forEach(p=>{i.push.apply(i,t[p])});let o=oe(i),n=Sc(o);for(let p of n){let c="";if(Object.keys(t).forEach(u=>{a[u]=[];let d=p.filter(b=>t[u].includes(b));d&&d.length>0&&(a[u]=d)}),Object.keys(a).forEach(u=>{a[u].length>0&&(a[u].sort((d,b)=>d.localeCompare(b)),c+="&",c+=`${vn[u]}=${a[u].join(",")}`)}),c&&c.length>0){let u=`/football${this.apiSignInUrl}&input_provider=${e||"native"}${c}`,d="There was a problem with id mapping request",b=await this.fetchWithoutAuth(u,d);r.push(b.data)}else r.push([])}return Array.prototype.concat.apply([],r)};getTopEntities=async()=>{let t=`/football/top${this.apiSignInUrl}`,e="There was a problem with top id mappings request";return(await this.fetchWithoutAuth(t,e)).data}};var Dc="FansUnited",Lp={football:{ids:[],countries:[],competitions:[],expirations:{ids:0}},profile:{info:{},statistics:{},badges:null,countries:[],expirations:{profile:0,statistics:0,badges:0}},client:{features:{},expirations:{features:0}}},Ji=class{idSchema="";storageInstance=null;expirationProfileTimeout=600;expirationBadgesTimeout=3600;expirationClientFeaturesTimeout=14400;expirationFootballIdsTimeout=604800;constructor(t){this.idSchema=t,this.getStorageInstance()}static getInstance(t){return Ji.instance||(Ji.instance=new Ji(t)),Ji.instance}async getStorageInstance(){try{let t=await Promise.resolve().then(()=>(su(),ou));this.storageInstance=t.default}catch(t){console.error(t)}}async getData(){try{let t=await this.storageInstance.getItem(Dc);return t?JSON.parse(t):(await this.storageInstance.setItem(Dc,JSON.stringify(Lp)),Lp)}catch(t){throw console.error("AsyncStorage error:",t),t}}async setData(t){await this.storageInstance.setItem(Dc,JSON.stringify(t))}clearData=async()=>{await this.setData(Lp)};getCompetitions=async t=>{let e=await this.getData();return t?t.competitionSearchFilter(e.football.competitions):e.football.competitions};setCompetitions=async t=>{let e=await this.getData(),i=[...e.football.competitions];i.push(...t),e.football.competitions=this.makeCompetitionsUnique(i),await this.setData(e)};getCompetitionsLength=async()=>(await this.getData()).football.competitions.length;getEntityById=async(t="",e="")=>(await this.getData()).football.ids.find(a=>{let r=G[this.idSchema];return a&&`${a[r]}`===e&&a.resource===t});getEntity=async(t,e,i)=>{let a=await this.getData();return Array.isArray(t)?a.football.ids.filter(r=>{let o=G[i];return r&&t.includes(`${r[o]}`)&&r.resource===e}):a.football.ids.find(r=>{let o=G[i];return r&&`${r[o]}`===t&&r.resource===e})};checkForExistingIdObjs=async(t,e)=>{let i=G[e],a={};for(let r of Object.keys(t)){let o=t[r],l=(await this.getEntity(o,r,e)).map(c=>c[i]),p=t[r].filter(c=>!l.includes(c));a[r]=o.map(c=>p.includes(c)?{id:c,exists:!1}:{id:c,exists:!0})}return a};getIdsByType=async(t,e,i)=>{let a=await this.getData(),r=G[i],o=G[e],n={};return Object.keys(t).forEach(l=>{let p=t[l],c=[];a.football.ids.forEach(u=>{p.forEach((d,b)=>{d===u[o]&&l===u.resource&&(c[b]=u[r])})}),n[l]=c}),n};addIdMapping=async t=>{let e=await this.getData();e.football.ids.push(t),await this.setData(e)};addIdMappings=async t=>{let e=await this.getData(),i=e.football.ids;i=[...i,...t],e.football.ids=i,await this.setData(e)};addTopIdMappings=async t=>{let e=await this.getData();if(e.football.ids.length){let i=JSON.parse(JSON.stringify(e.football.ids));i=i.filter(a=>a.resource!=="match"),t=t.filter(a=>a.resource==="match"),i=[...i,...t],e.football.ids=i}else e.football.ids=t;e.football.expirations.ids=Math.floor(Date.now()/1e3)+this.expirationFootballIdsTimeout,await this.setData(e)};setOwnProfile=async t=>{let e=await this.getData();e.profile.info=t,e.profile.expirations.profile=Math.floor(Date.now()/1e3)+this.expirationProfileTimeout,await this.setData(e)};getOwnProfile=async()=>(await this.getData()).profile.info;getProfileCountries=async()=>(await this.getData()).profile.countries;setProfileCountries=async t=>{let e=await this.getData();e.profile.countries=t,await this.setData(e)};getProfileStats=async()=>(await this.getData()).profile.statistics;setProfileStats=async t=>{let e=await this.getData();e.profile.statistics=t,e.profile.expirations.statistics=Math.floor(Date.now()/1e3)+this.expirationProfileTimeout,await this.setData(e)};getProfileBadges=async()=>(await this.getData()).profile.badges;setProfileBadges=async t=>{let e=await this.getData();e.profile.badges=t,e.profile.expirations.badges=Math.floor(Date.now()/1e3)+this.expirationBadgesTimeout,await this.setData(e)};getFootballCountries=async()=>(await this.getData()).football.countries;setFootballCountries=async t=>{let e=await this.getData();e.football.countries=t,await this.setData(e)};getClientFeatures=async()=>(await this.getData()).client.features;setClientFeatures=async t=>{let e=await this.getData(),i=JSON.parse(JSON.stringify(t));e.client.expirations.features=Math.floor(Date.now()/1e3)+this.expirationClientFeaturesTimeout,e.client.features=i,await this.setData(e)};deleteClientFeatures=async()=>{let t=await this.getData(),e=JSON.parse(JSON.stringify(t));e.client={features:{},expirations:{features:0}},await this.setData(e)};getExpiration=async(t,e)=>{await this.initialNewSchema(t,"expirations");let i=await this.getData();switch(e){case"profile":return i.profile.expirations.profile;case"statistics":return i.profile.expirations.statistics;case"badges":return i.profile.expirations.badges;case"features":return i.client.expirations.features;case"ids":return i.football.expirations.ids}};makeCompetitionsUnique=t=>{let e=new Set;return t.filter(i=>{let a=!e.has(i.id);return e.add(i.id),a})};initialNewSchema=async(t,e)=>{let i=await this.getData();(!i||!i[t]||!i[t][e])&&await this.setData(Lp)}},Zi=Ji;et(Zi,"instance");var Bc="FansUnited",Nc={football:{ids:[],countries:[],competitions:[],expirations:{ids:0}},profile:{info:{},statistics:{},badges:null,countries:[],expirations:{profile:0,statistics:0,badges:0}},client:{features:{},expirations:{features:0}}},ta=class{idSchema="";expirationProfileTimeout=600;expirationBadgesTimeout=3600;expirationClientFeaturesTimeout=14400;expirationFootballIdsTimeout=604800;constructor(t){this.idSchema=t}static getInstance(t){return ta.instance||(ta.instance=new ta(t)),ta.instance}clearData=async()=>{this.setData(Nc)};getEntityById=async(t="",e="")=>this.getData().football.ids.find(i=>{let a=G[this.idSchema];return i&&`${i[a]}`===e&&i.resource===t});getEntity=(t,e,i)=>Array.isArray(t)?this.getData().football.ids.filter(a=>{let r=G[i];return a&&t.includes(`${a[r]}`)&&a.resource===e}):this.getData().football.ids.find(a=>{let r=G[i];return a&&`${a[r]}`===t&&a.resource===e});getEntityByNativeId=(t="",e="")=>this.getData().football.ids.find(i=>i&&`${i.id}`===e&&i.resource===t);checkForExistingIdObjs=async(t,e)=>{let i=G[e],a={};return Object.keys(t).forEach(r=>{let o=t[r],l=this.getEntity(o,r,e).map(c=>c[i]),p=t[r].filter(c=>!l.includes(c));a[r]=o.map(c=>p.includes(c)?{id:c,exists:!1}:{id:c,exists:!0})}),a};getIdsByType=async(t,e,i)=>{let a=G[i],r=G[e],o={};return Object.keys(t).forEach(n=>{let l=t[n],p=[];this.getData().football.ids.forEach(c=>{l.forEach((u,d)=>{u===c[r]&&n===c.resource&&(p[d]=c[a])})}),o[n]=p}),o};addIdMapping=t=>{let e=this.getData();e.football.ids.push(t),this.setData(e)};addIdMappings=async t=>{let e=this.getData(),i=e.football.ids;i=[...i,...t],e.football.ids=i,this.setData(e)};addTopIdMappings=async t=>{let e=this.getData();if(e.football.ids.length){let i=JSON.parse(JSON.stringify(e.football.ids));i=i.filter(a=>a.resource!=="match"),t=t.filter(a=>a.resource==="match"),i=[...i,...t],e.football.ids=i}else e.football.ids=t;e.football.expirations.ids=Math.floor(Date.now()/1e3)+this.expirationFootballIdsTimeout,this.setData(e)};setOwnProfile=async t=>{let e=this.getData();e.profile.info=t,e.profile.expirations.profile=Math.floor(Date.now()/1e3)+this.expirationProfileTimeout,this.setData(e)};getOwnProfile=()=>this.getData().profile.info;getProfileCountries=()=>this.getData().profile.countries;setProfileCountries=async t=>{let e=this.getData();e.profile.countries=t,this.setData(e)};getProfileStats=()=>this.getData().profile.statistics;setProfileStats=async t=>{let e=this.getData();e.profile.statistics=t,e.profile.expirations.statistics=Math.floor(Date.now()/1e3)+this.expirationProfileTimeout,this.setData(e)};getProfileBadges=()=>this.getData().profile.badges;setProfileBadges=async t=>{let e=this.getData();e.profile.badges=t,e.profile.expirations.badges=Math.floor(Date.now()/1e3)+this.expirationBadgesTimeout,this.setData(e)};getFootballCountries=()=>this.getData().football.countries;setFootballCountries=async t=>{let e=this.getData();e.football.countries=t,this.setData(e)};getCompetitions=t=>{let e=this.getData();return t?t.competitionSearchFilter(e.football.competitions):e.football.competitions};setCompetitions=async t=>{let e=this.getData(),i=[...e.football.competitions];i.push(...t),e.football.competitions=this.makeCompetitionsUnique(i),this.setData(e)};getCompetitionsLength=async()=>{let{football:t}=this.getData();return t.competitions.length};getClientFeatures=()=>this.getData().client.features;setClientFeatures=async t=>{let e=this.getData(),i=JSON.parse(JSON.stringify(t));e.client.expirations.features=Math.floor(Date.now()/1e3)+this.expirationClientFeaturesTimeout,e.client.features=i,this.setData(e)};deleteClientFeatures=async()=>{let t=this.getData(),e=JSON.parse(JSON.stringify(t));e.client={features:{},expirations:{features:0}},this.setData(e)};getExpiration=async(t,e)=>{this.initialNewSchema(t,"expirations");let i=this.getData();switch(e){case"profile":return i.profile.expirations.profile;case"statistics":return i.profile.expirations.statistics;case"badges":return i.profile.expirations.badges;case"features":return i.client.expirations.features;case"ids":return i.football.expirations.ids}};makeCompetitionsUnique=t=>{let e=new Set;return t.filter(i=>{let a=!e.has(i.id);return e.add(i.id),a})};getData=()=>(localStorage.getItem(Bc)||this.setData(Nc),JSON.parse(localStorage.getItem(Bc)));setData=t=>{localStorage.setItem(Bc,JSON.stringify(t))};initialNewSchema=(t,e)=>{let i=this.getData();(!i||!i[t]||!i[t][e])&&this.setData(Nc)}},ea=ta;et(ea,"instance");var Eu=Hu(Tu());var T=class{profileTTL=600;clientTTL=14400;profileBadgesTTL=3600;idMappingsExpiration=0;idSchema="";constructor(t){}static getInstance(t){return T.instance||(T.instance=new T(t),T.nodeCache.options.useClones=!1),T.instance}clearData=async()=>T.nodeCache.flushAll();getEntityById=async(t,e)=>{let i=T.nodeCache.get("ids");return i?i.find(a=>{let r=G[this.idSchema];return a&&`${a[r]}`===e&&a.resource===t}):null};getEntity=async(t,e,i)=>{let a=T.nodeCache.get("ids");return a?Array.isArray(t)?[]:null:Array.isArray(t)?a.filter(r=>{let o=G[i];return r&&t.includes(`${r[o]}`)&&r.resource===e}):a.find(r=>{let o=G[i];return r&&`${r[o]}`===t&&r.resource===e})};checkForExistingIdObjs=async(t,e)=>{let i=G[e],a={};for(let r of Object.keys(t)){let o=t[r],l=(await this.getEntity(o,r,e)).map(c=>c[i]),p=t[r].filter(c=>!l.includes(c));a[r]=o.map(c=>p.includes(c)?{id:c,exists:!1}:{id:c,exists:!0})}return a};getIdsByType=async(t,e,i)=>{let a=G[i],r=G[e],o=T.nodeCache.get("ids"),n={};return o?(Object.keys(t).forEach(l=>{let p=t[l],c=[];o.forEach(u=>{p.forEach((d,b)=>{d===u[r]&&l===u.resource&&(c[b]=u[a])})}),n[l]=c}),n):null};addIdMapping=async t=>{let e=T.nodeCache.get("ids");e.push(t),T.nodeCache.set("ids",e)};addIdMappings=async t=>{let e=T.nodeCache.get("ids");e=[...e,...t],T.nodeCache.set("ids",e)};addTopIdMappings=async t=>{let e=T.nodeCache.get("ids"),i=604800;if(e){let a=JSON.parse(JSON.stringify(e));a=a.filter(r=>r.resource!=="match"),t=t.filter(r=>r.resource==="match"),a=[...a,...t],T.nodeCache.set("ids",a)}else T.nodeCache.set("ids",t);this.idMappingsExpiration=Math.floor(Date.now()/1e3)+i};setOwnProfile=async t=>{T.nodeCache.set("profile",t,this.profileTTL)};getOwnProfile=async()=>T.nodeCache.get("profile");getProfileCountries=async()=>T.nodeCache.get("profile_countries");setProfileCountries=async t=>{T.nodeCache.set("profile_countries",t)};getProfileStats=async()=>T.nodeCache.get("profile_stats");setProfileStats=async t=>{T.nodeCache.set("profile_stats",t,this.profileTTL)};getProfileBadges=async()=>T.nodeCache.get("profile_badges");setProfileBadges=async t=>{T.nodeCache.set("profile_badges",t,this.profileBadgesTTL)};getFootballCountries=async()=>T.nodeCache.get("football_countries");setFootballCountries=async t=>{T.nodeCache.set("football_countries",t)};getCompetitions=async t=>{let e=T.nodeCache.get("football_competitions");return e?t?t.competitionSearchFilter(e):e:null};setCompetitions=async t=>{T.nodeCache.set("football_competitions",t)};getCompetitionsLength=async()=>{let t=T.nodeCache.get("football_competitions");return t?t.length:0};getClientFeatures=async()=>T.nodeCache.get("client");setClientFeatures=async t=>{T.nodeCache.set("client",t,this.clientTTL)};deleteClientFeatures=async()=>{T.nodeCache.del("client")};getExpiration=async(t,e)=>{let i=this.getKeyFromExpirationType(e);return i==="ids"?this.idMappingsExpiration:T.nodeCache.getTtl(i)};getKeyFromExpirationType=t=>{switch(t){case"profile":return"profile";case"statistics":return"profile_stats";case"badges":return"profile_badges";case"features":return"client";case"ids":return"ids"}}},hi=T;et(hi,"instance"),et(hi,"nodeCache",new Eu.default);var pt=class{createLocalCacheInstance=t=>typeof window>"u"?hi.getInstance(t):typeof __DEV__<"u"?Zi.getInstance(t):ea.getInstance(t)};var fi=class{localCache=null;https=null;constructor(t){this.localCache=new pt().createLocalCacheInstance(t.idSchema),this.https=new Cn(t)}getEntitiesByIds=async(t,e,i)=>{await this.setTopIdMappings();try{let a=await this.localCache.checkForExistingIdObjs(t,e),r=this.splitForRequestAndExisting(a),o=await this.https.getEntitiesByIdObjs(r.request,e);return await this.localCache.addIdMappings(o),await this.localCache.getIdsByType(t,e,i)}catch(a){return console.warn("There was a problem retrieving the entity ids ",a),Promise.resolve([])}};getEntitiesByIdsMap=async(t,e,i)=>{await this.setTopIdMappings();try{let a=JSON.parse(JSON.stringify(t)),r=await this.localCache.checkForExistingIdObjs(t,e),o=this.splitForRequestAndExisting(r),n=await this.https.getEntitiesByIdObjs(o.request,e);await this.localCache.addIdMappings(n);let l=await this.localCache.getIdsByType(t,e,i),p=new Map;return Object.keys(a).forEach(c=>{a[c].forEach((u,d)=>{let b=l[c].length&&l[c][d]?l[c][d]:"";p.set(u,b)})}),p}catch(a){return console.warn("There was a problem retrieving the entity ids ",a),Promise.resolve(new Map)}};getEntityById=async(t,e,i)=>{let a=await this.localCache.getEntity(t,e,i);if(a)return a;let r=await this.requestEntity(t,e,i);return await this.localCache.addIdMappings(r),r&&r.length>0?r[0]:null};splitForRequestAndExisting=t=>{let e={},i={};return Object.keys(t).forEach(a=>{e[a]=t[a].filter(r=>!r.exists).map(r=>r.id),i[a]=t[a].filter(r=>r.exists).map(r=>r.id)}),{existing:i,request:e}};requestEntity=async(t,e,i)=>{try{return t=Array.isArray(t)?t:[t],await this.https.getEntitiesByIds(e,t,i)}catch(a){return console.warn(`There was a problem retrieving the requested entity: ${a}`),null}};setTopIdMappings=async()=>{let t=Math.floor(Date.now()/1e3);if(await this.localCache.getExpiration("football","ids")>t)return Promise.resolve();let i=await this.https.getTopEntities();await this.localCache.addTopIdMappings(i)}};var Np=s=>{switch(s){case"competitions":return"competition";case"players":case"relatedPlayer":case"squad":return"player";case"teams":case"participants":case"homeTeam":case"awayTeam":case"timeline":case"teamId":return"team";default:return s}};var An=class{extractedObjIds={};traverse=(t,e)=>(e=Np(e),Array.isArray(t)?this.traverseArrExtract(t,e):t&&typeof t=="object"&&this.traverseObjExtract(t,e),this.extractedObjIds);traverseArrExtract=(t,e)=>{t&&t.length>0&&t.forEach(i=>{this.traverseObjExtract(i,e)})};traverseObjExtract=(t,e)=>{t&&Object.keys(t).length>0&&Object.keys(t).forEach(i=>{let a=t[i];i==="id"||i==="teamId"?(this.extractedObjIds.hasOwnProperty(e)||(this.extractedObjIds[e]=[]),a&&this.extractedObjIds[e].push(a)):t[i]&&this.traverse(t[i],i)})}};var On=class{replaceObjIdsIndex=null;remappedIdsObj={};traverse=(t,e,i)=>(e=Np(e),this.replaceObjIdsIndex===null&&(this.initReplaceObjIdsIndex(i),this.remappedIdsObj=i),Array.isArray(t)?this.traverseArrReplace(t,e):t&&typeof t=="object"&&this.traverseObjReplace(t,e),t);initReplaceObjIdsIndex=t=>{this.replaceObjIdsIndex={},Object.keys(t).forEach(e=>{this.replaceObjIdsIndex[e]=0})};traverseArrReplace=(t,e)=>{t&&t.length>0&&t.forEach(i=>{this.traverseObjReplace(i,e)})};traverseObjReplace=(t,e)=>{t&&Object.keys(t).length>0&&Object.keys(t).forEach(i=>{i==="id"||i==="teamId"?t[i]&&(t[i]=this.remappedIdsObj[e][this.replaceObjIdsIndex[e]],this.replaceObjIdsIndex[e]=this.replaceObjIdsIndex[e]+1):t[i]&&this.traverse(t[i],i,this.remappedIdsObj)})}};var R=class{idSchema="";idMappingFacade=null;constructor(t){this.idSchema=t.idSchema,this.idMappingFacade=new fi(t)}getEntityIdBySchemaId=(t,e)=>this.idMappingFacade.getEntityById(e,t,this.idSchema);remapEntities=async(t,e)=>{let i=JSON.parse(JSON.stringify(t));try{if(this.idSchema!=="native"){let r=new An().traverse(i,e);return this.idMappingFacade.getEntitiesByIds(r,"native",this.idSchema).then(o=>new On().traverse(i,e,o))}else return t}catch(a){return console.warn(`There was a problem remapping entity: ${e} with inner entity `,a),[]}};getEntityIdsBySchemaId=async(t,e,i)=>{let a={};return a[e]=t,this.idSchema!=="native"?await this.idMappingFacade.getEntitiesByIds(a,this.idSchema,i):a}};var It=class{idSchema;idMapping;constructor(t){this.idSchema=t.idSchema,this.idMapping=new R(t)}remapTagsIds=async(t,e,i)=>{if(!t||!t.length)return t;let a={},r={},o=[];t.forEach(l=>{a.hasOwnProperty(l.type)||(a[l.type]=[],r[l.type]=[]),a[l.type].push(l.id),r[l.type].push(l)});let n=await this.idMapping.idMappingFacade.getEntitiesByIds(a,e,i);for(let[l,p]of Object.entries(r))p.forEach((c,u)=>{c.id=n[l][u],o.push(c)});return o}};var de=class{page=null;limit=null;constructor(t){this.page=t.page?t.page:null,this.limit=t.limit?t.limit:null}};var aa=class extends de{action=null;constructor(t){super(t),this.action=t.action?t.action:null}constructFilterUrl(){let t="";return this.action&&(t+="&",t+=`action=${this.action}`),this.page&&(t+="&",t+=`page=${this.page}`),this.limit&&(t+="&",t+=`limit=${this.limit}`),t}};var ra=class extends de{action=null;constructor(t){super(t),this.action=t.action?t.action:null}constructFilterUrl(){let t="";return this.action&&(t+="&",t+=`action=${this.action}`),this.page&&(t+="&",t+=`page=${this.page}`),this.limit&&(t+="&",t+=`limit=${this.limit}`),t}};var Ln=class{idSchema;activityHttps;activityService;constructor(t){this.idSchema=t.idSchema,this.activityHttps=new di(t),this.activityService=new It(t)}add=async(t,e,i,a)=>{if(this.idSchema!="native"){let o=JSON.parse(JSON.stringify(e)),n=await this.activityService.remapTagsIds(e,this.idSchema,"native"),l=new mi(t,n,i,a),p=await this.activityHttps.createActivity(l);return p.context.tags=o,p}let r=new mi(t,e,i,a);return this.activityHttps.createActivity(r)};delete=async t=>await this.activityHttps.deleteActivity(t);like=async(t,e,i)=>{let a="like";return await this.add(a,t,e,i)};dislike=async(t,e,i)=>{let a="dislike";return await this.add(a,t,e,i)};addPageview=async(t,e,i)=>{let a="page_view";return await this.add(a,t,e,i)};addContentConsumed=async(t,e,i)=>{let a="content_consumed";return await this.add(a,t,e,i)};addShare=async(t,e,i)=>{let a="share";return await this.add(a,t,e,i)};addComment=async(t,e,i)=>{let a="comment";return await this.add(a,t,e,i)};addClickAd=async(t,e,i)=>{let a="click_ad";return await this.add(a,t,e,i)};addConvert=async(t,e,i)=>{let a="convert";return await this.add(a,t,e,i)};getOwn=async(t,e)=>{if(e=e||!1,t&&(t=new aa(t)),this.idSchema!="native"){let i=await this.activityHttps.getOwnActivities(t,e);for(let a of i.data)await this.activityService.remapTagsIds(a.context.tags,"native",this.idSchema);return i}return await this.activityHttps.getOwnActivities(t,e)};getForUser=async(t,e,i)=>{if(i=i||!1,e&&(e=new ra(e)),this.idSchema!="native"){let a=await this.activityHttps.getActivitiesForUser(t,e,i),r=JSON.parse(JSON.stringify(a));for(let o of r.data)await this.activityService.remapTagsIds([...o.context.tags],"native",this.idSchema);return r}return await this.activityHttps.getActivitiesForUser(t,e,i)}};var xn=class{activityFacade;constructor(t){this.activityFacade=new Ln(t)}add=async(t,e,i,a)=>await this.activityFacade.add(t,e,i,a);delete=async t=>await this.activityFacade.delete(t);like=async(t,e,i)=>await this.activityFacade.like(t,e,i);dislike=async(t,e,i)=>await this.activityFacade.dislike(t,e,i);addPageview=async(t,e,i)=>await this.activityFacade.addPageview(t,e,i);addContentConsumed=async(t,e,i)=>await this.activityFacade.addContentConsumed(t,e,i);addShare=async(t,e,i)=>await this.activityFacade.addShare(t,e,i);addComment=async(t,e,i)=>await this.activityFacade.addComment(t,e,i);addClickAd=async(t,e,i)=>await this.activityFacade.addClickAd(t,e,i);addConvert=async(t,e,i)=>await this.activityFacade.addConvert(t,e,i);getOwn=async(t,e)=>await this.activityFacade.getOwn(t,e);getForUser=async(t,e,i)=>await this.activityFacade.getForUser(t,e,i)};var q=class{entityId=null;entityType=null;entityRelationship=null};var me=class{participantOne=null;participantTwo=null};var oa=class{matchId="";participantOne="";participantTwo="";winner="";homeParticipant="";startDate="";score=new me};var he=class{participants=[]};var sa=class{id=null;name=null;group=null;image=null;undecided=!1};var na=class{id=null;title=null;description=null;rules=null;customFields=null;images=null;type="BRACKET";status=null;points=null;related=[];tiebreaker=null;predictionsCutoff=null;meta=new he;fixtures=[];createdAt=null;updatedAt=null};var wt=class{nextPageStartsAfter=null;itemsPerPage=null};var M=class{pagination=new wt};var la=class{meta=new M;data=[]};var pa=class{meta=new M;data=[]};var ca=class{statTiebreakerEnabled;statTotal};var ua=class{matchId="";participantOne="";participantTwo="";winner;correct=null};var fe=class{statTotal=0};var Ru=(r=>(r.ACTIVE="ACTIVE",r.WON="WON",r.LOST="LOST",r.PARTIALLY_WON="PARTIALLY_WON",r.CANCELED="CANCELED",r))(Ru||{}),da=class{id="";profileId="";profileModel=null;gameId="";totalPoints=null;gamePoints=null;bonusPoints=null;position=null;status="ACTIVE";fixtures=[];tiebreaker=new fe;createdAt="";updatedAt=""};var ma=class{meta=new M;data=[]};var Dn=class{remapBracketGames=t=>{let e=new pa;return e.meta.pagination.itemsPerPage=t.meta.pagination.items_per_page,e.meta.pagination.nextPageStartsAfter=t.meta.pagination.next_page_starts_after,e.data=t.data.map(i=>this.remapBracketGameById(i)),e};remapBracketGameById=t=>{let e=new na;return e.id=t.id,e.title=t.title,e.description=t.description,e.rules=t.rules,e.customFields=t.custom_fields,e.images=t.images,e.type=t.type,e.status=t.status,e.points=t.points,e.related=t.related?this.remapRelated(t.related):t.related,e.tiebreaker=t.tiebreaker?this.remapBracketGameTiebreaker(t.tiebreaker):t.tiebreaker,e.predictionsCutoff=t.predictions_cutoff,e.meta=t.meta&&t.meta.participants?this.remapBracketGameMeta(t.meta):t.meta,e.fixtures=t.fixtures?this.remapBracketGameFixtures(t.fixtures):t.fixtures,e.createdAt=t.created_at,e.updatedAt=t.updated_at,e};remapPredictionToRequestBody=t=>t.map(e=>({match_id:e.matchId,participant_one:e.participantOne,participant_two:e.participantTwo,winner:e.winner}));remapPrediction=t=>{let e=new da;return e.id=t.id,e.profileId=t.profile_id,e.gameId=t.game_id,e.totalPoints=t.total_points,e.gamePoints=t.game_points,e.bonusPoints=t.bonus_points,e.position=t.position,e.status=t.status,e.fixtures=this.remapPredictionFixtures(t.fixtures),e.tiebreaker=t.tiebreaker?this.remapPredictionTiebreaker(t.tiebreaker):t.tiebreaker,e.createdAt=t.created_at,e.updatedAt=t.updated_at,e};remapPredictionsForUser=t=>{let e=new la;return e.meta.pagination.itemsPerPage=t.meta.pagination.items_per_page,e.meta.pagination.nextPageStartsAfter=t.meta.pagination.next_page_starts_after,e.data=t.data.map(i=>this.remapPrediction(i)),e};remapRankings=t=>{let e=new ma;return e.meta.pagination.itemsPerPage=t.meta.pagination.items_per_page,e.meta.pagination.nextPageStartsAfter=t.meta.pagination.next_page_starts_after,e.data=t.data.map(i=>this.remapPrediction(i)),e};remapRelated=t=>t.map(e=>{let i=new q;return i.entityId=e.entity_id,i.entityType=e.entity_type,i.entityRelationship=e.entity_relationship,i});remapPredictionFixtures=t=>t.map(e=>{let i=new ua;return i.matchId=e.match_id,i.participantOne=e.participant_one,i.participantTwo=e.participant_two,i.winner=e.winner,i.correct=e.correct,i});remapPredictionTiebreaker=t=>{let e=new fe;return e.statTotal=t.stat_total,e};remapBracketGameMeta=t=>{let e=new he;return e.participants=t.participants.map(i=>{let a=new sa;return a.id=i.id,a.name=i.name,a.group=i.group,a.image=i.image,a.undecided=i.undecided,a}),e};remapBracketGameFixtures=t=>t.map(e=>{let i=new oa;return i.matchId=e.match_id,i.participantOne=e.participant_one,i.participantTwo=e.participant_two,i.winner=e.winner,i.homeParticipant=e.home_participant,i.startDate=e.start_date,i.score=e.score?this.remapBracketGameFixturesScore(e.score):e.score,i});remapBracketGameFixturesScore=t=>{let e=new me;return e.participantOne=t.participant_one,e.participantTwo=t.participant_two,e};remapBracketGameTiebreaker=t=>{let e=new ca;return e.statTiebreakerEnabled=t.stat_tiebreaker_enabled,e.statTotal=t.stat_total,e}};var ge=class{participants=[]};var ha=class{id=null;title=null;description=null;rules=null;customFields=null;images=null;type="STANDING";status=null;points=null;related=[];predictionsCutoff="";meta=new ge;outcomeCount=null;outcome=[];createdAt=null;updatedAt=null};var fa=class{meta=new M;data=[]};var ga=class{id=null;name=null;group=null;image=null;undecided=!1};var ya=class{id="";profileId="";profileModel=null;total=0;gameId="";totalPoints=null;gamePoints=null;bonusPoints=null;position=null;status="ACTIVE";standing=[];createdAt="";updatedAt=""};var ba=class{meta=new M;data=[]};var Ma=class{meta=new M;data=[]};var Bn=class{remapBracketGames=t=>{let e=new fa;return e.meta.pagination.itemsPerPage=t.meta.pagination.items_per_page,e.meta.pagination.nextPageStartsAfter=t.meta.pagination.next_page_starts_after,e.data=t.data.map(i=>this.remapStandingGameById(i)),e};remapStandingGameById=t=>{let e=new ha;return e.id=t.id,e.title=t.title,e.description=t.description,e.rules=t.rules,e.customFields=t.custom_fields,e.images=t.images,e.type=t.type,e.status=t.status,e.points=t.points,e.related=t.related?this.remapRelated(t.related):t.related,e.predictionsCutoff=t.predictions_cutoff,e.meta=t.meta&&t.meta.participants?this.remapStandingGameMeta(t.meta):t.meta,e.outcomeCount=t.outcome_count,e.outcome=t.outcome,e.createdAt=t.created_at,e.updatedAt=t.updated_at,e};remapPrediction=t=>{let e=new ya;return e.id=t.id,e.profileId=t.profile_id,e.gameId=t.game_id,e.totalPoints=t.total_points,e.gamePoints=t.game_points,e.bonusPoints=t.bonus_points,e.position=t.position,e.status=t.status,e.standing=t.standing,e.total=t.total,e.createdAt=t.created_at,e.updatedAt=t.updated_at,e};remapPredictionsForUser=t=>{let e=new ba;return e.meta.pagination.itemsPerPage=t.meta.pagination.items_per_page,e.meta.pagination.nextPageStartsAfter=t.meta.pagination.next_page_starts_after,e.data=t.data.map(i=>this.remapPrediction(i)),e};remapRankings=t=>{let e=new Ma;return e.meta.pagination.itemsPerPage=t.meta.pagination.items_per_page,e.meta.pagination.nextPageStartsAfter=t.meta.pagination.next_page_starts_after,e.data=t.data.map(i=>this.remapPrediction(i)),e};remapRelated=t=>t.map(e=>{let i=new q;return i.entityId=e.entity_id,i.entityType=e.entity_type,i.entityRelationship=e.entity_relationship,i});remapStandingGameMeta=t=>{let e=new ge;return e.participants=t.participants.map(i=>{let a=new ga;return a.id=i.id,a.name=i.name,a.group=i.group,a.image=i.image,a.undecided=i.undecided,a}),e}};var Ia=class{meta=new M;data=[]};var wa=class{statTiebreakerEnabled;statTotal};var ye=class{statTotal=0};var Fu=(r=>(r.ACTIVE="ACTIVE",r.WON="WON",r.LOST="LOST",r.PARTIALLY_WON="PARTIALLY_WON",r.CANCELED="CANCELED",r))(Fu||{}),_a=class{id="";profileId="";profileModel=null;gameId="";gamePoints=null;bonusPoints=null;totalPoints=null;position=null;status="ACTIVE";fixtures=[];tiebreaker=new ye;createdAt="";updatedAt=""};var Pa=class{meta=new M;data=[]};var Ta=class{id=null;title=null;description=null;images=null;rules=null;customFields=null;type="EVENT";status=null;points=null;related=[];tiebreaker=null;predictionsCutoff=null;fixtures=[];createdAt=null;updatedAt=null};var kp=(a=>(a.BOOLEAN="BOOLEAN",a.NUMBER="NUMBER",a.ENUM="ENUM",a.FREE_INPUT="FREE_INPUT",a))(kp||{});var At=class{id="";question="";status="ACTIVE";voidReason=null;points=0;outcomeType=null;validOutcomes=null;outcome=null};var Ot=class{id="";predictionType;prediction;correct=null;points=0};var Ea=class{meta=new M;data=[]};var Nn=class{remapEventGames=t=>{let e=new Ia;return e.meta.pagination.itemsPerPage=t.meta.pagination.items_per_page,e.meta.pagination.nextPageStartsAfter=t.meta.pagination.next_page_starts_after,e.data=t.data.map(i=>this.remapEventGameById(i)),e};remapEventGameById=t=>{let e=new Ta;return e.id=t.id,e.title=t.title,e.description=t.description,e.rules=t.rules,e.customFields=t.custom_fields,e.images=t.images,e.type=t.type,e.status=t.status,e.points=t.points,e.related=t.related?this.remapRelated(t.related):t.related,e.tiebreaker=t.tiebreaker?this.remapEventGameTiebreaker(t.tiebreaker):t.tiebreaker,e.predictionsCutoff=t.predictions_cutoff,e.fixtures=t.fixtures?this.remapEventGameFixtures(t.fixtures):t.fixtures,e.createdAt=t.created_at,e.updatedAt=t.updated_at,e};remapPredictionToRequestBody=t=>t.map(e=>({id:e.id,prediction_type:e.predictionType,prediction:e.prediction}));remapPrediction=t=>{let e=new _a;return e.id=t.id,e.profileId=t.profile_id,e.gameId=t.game_id,e.totalPoints=t.total_points,e.gamePoints=t.game_points,e.bonusPoints=t.bonus_points,e.position=t.position,e.status=t.status,e.fixtures=this.remapPredictionFixtures(t.fixtures),e.tiebreaker=t.tiebreaker?this.remapPredictionTiebreaker(t.tiebreaker):t.tiebreaker,e.createdAt=t.created_at,e.updatedAt=t.updated_at,e};remapPredictionsForUser=t=>{let e=new Ea;return e.meta.pagination.itemsPerPage=t.meta.pagination.items_per_page,e.meta.pagination.nextPageStartsAfter=t.meta.pagination.next_page_starts_after,e.data=t.data.map(i=>this.remapPrediction(i)),e};remapRankings=t=>{let e=new Pa;return e.meta.pagination.itemsPerPage=t.meta.pagination.items_per_page,e.meta.pagination.nextPageStartsAfter=t.meta.pagination.next_page_starts_after,e.data=t.data.map(i=>this.remapPrediction(i)),e};remapRelated=t=>t.map(e=>{let i=new q;return i.entityId=e.entity_id,i.entityType=e.entity_type,i.entityRelationship=e.entity_relationship,i});remapPredictionFixtures=t=>t.map(e=>{let i=new Ot;switch(e.prediction_type){case"BOOLEAN":i=new Ot;break;case"NUMBER":i=new Ot;break;case"ENUM":i=new Ot;break;case"FREE_INPUT":i=new Ot;break}return i.id=e.id,i.predictionType=e.prediction_type,i.prediction=e.prediction,i.points=e.points,i.correct=e.correct,i});remapPredictionTiebreaker=t=>{let e=new ye;return e.statTotal=t.stat_total,e};remapEventGameFixtures=t=>t.map(e=>{let i=new At;switch(e.outcome_type){case"BOOLEAN":i=new At;break;case"NUMBER":i=new At;break;case"ENUM":i=new At;break;case"FREE_INPUT":i=new At;break}return i.id=e.id,i.question=e.question,i.status=e.status,i.voidReason=e.void_reason,i.points=e.points,i.outcomeType=e.outcome_type,i.validOutcomes=e.valid_outcomes,i.outcome=e.outcome,i});remapEventGameTiebreaker=t=>{let e=new wa;return e.statTiebreakerEnabled=t.stat_tiebreaker_enabled,e.statTotal=t.stat_total,e}};var id={id:"",profile_id:"",total_points:null,game_points:null,bonus_points:null,position:null,status:"ACTIVE",game_id:"",fixtures:[],tiebreaker:{stat_total:0},updated_at:"",created_at:""},Wt=class extends v{bracketGameRemapper=null;standingGameRemapper=null;eventGameRemapper=null;constructor(t){super(t,O(t.environment,"predictor")),this.bracketGameRemapper=new Dn,this.standingGameRemapper=new Bn,this.eventGameRemapper=new Nn}getBracketGames=async(t,e)=>{let i=t?`/custom/bracket${this.apiSignInUrl}${t.constructMainFiltersUrl()}`:`/custom/bracket${this.apiSignInUrl}`;g(e)&&(i+=m());let a="There was a problem with fetching bracket games list",r=await this.fetchWithoutAuth(i,a);return this.bracketGameRemapper.remapBracketGames(r)};getBracketGameById=async(t,e)=>{let i=g(e)?`/custom/bracket/${t}${this.apiSignInUrl}${m()}`:`/custom/bracket/${t}${this.apiSignInUrl}`,a="There was a problem with fetching bracket game with the following ID: "+t,r=await this.fetchWithoutAuth(i,a);return this.bracketGameRemapper.remapBracketGameById(r)};makeBracketGamePrediction=async(t,e)=>{let i=`/custom/bracket/${t}/predictions${this.apiSignInUrl}`,a="There was a problem with making prediction for bracket game with the following ID: "+t,r="POST",o=JSON.parse(JSON.stringify(e));o.fixtures=this.bracketGameRemapper.remapPredictionToRequestBody(e.fixtures),e.tiebreaker&&(o.tiebreaker={stat_total:e.tiebreaker.statTotal});let n=await this.fetchWithAuth(i,a,r,o);return this.bracketGameRemapper.remapPrediction(n)};updateBracketGamePrediction=async(t,e,i)=>{let a=`/custom/bracket/${t}/predictions/${e}${this.apiSignInUrl}`,r="There was a problem with updating prediction for bracket game with the following ID: "+t,o="PUT",n=JSON.parse(JSON.stringify(i));n.fixtures=this.bracketGameRemapper.remapPredictionToRequestBody(i.fixtures),i.tiebreaker&&(n.tiebreaker={stat_total:i.tiebreaker.statTotal});let l=await this.fetchWithAuth(a,r,o,n);return this.bracketGameRemapper.remapPrediction(l)};getBracketGamePredictionsForUser=async(t,e,i,a)=>{let r=i?`/custom/bracket/${t}/predictions${this.apiSignInUrl}&profile_id=${e}${i.constructMainFiltersUrl()}`:`/custom/bracket/${t}/predictions${this.apiSignInUrl}&profile_id=${e}`;g(a)&&(r+=m());let o=`There was a problem with getting all predictions for user with ID ${e} for bracket game with ID ${t}`,n=await this.fetchWithoutAuth(r,o);return this.bracketGameRemapper.remapPredictionsForUser(n)};getBracketGamePredictionById=async(t,e,i)=>{let a=g(i)?`/custom/bracket/${t}/predictions/${e}/${this.apiSignInUrl}${m()}`:`/custom/bracket/${t}/predictions/${e}/${this.apiSignInUrl}`,r=`There was a problem with getting prediction with ID ${e} for bracket game with ID ${t}`,o=JSON.parse(JSON.stringify(id));return o.id=e,o.game_id=t,o.tiebreaker=null,Promise.resolve(this.bracketGameRemapper.remapPrediction(o))};getBracketGameRankings=async(t,e,i)=>{let a=e?`/custom/bracket/${t}/ranking${this.apiSignInUrl}${e.constructMainFiltersUrl()}`:`/custom/bracket/${t}/ranking${this.apiSignInUrl}`;g(i)&&(a+=m());let r=`There was a problem with getting rankings for bracket game with ID ${t}`,o=await this.fetchWithoutAuth(a,r);return this.bracketGameRemapper.remapRankings(o)};getStandingsGames=async(t,e)=>{let i=t?`/custom/standing${this.apiSignInUrl}${t.constructMainFiltersUrl()}`:`/custom/standing${this.apiSignInUrl}`;g(e)&&(i+=m());let a="There was a problem with fetching standings games list",r=await this.fetchWithoutAuth(i,a);return this.standingGameRemapper.remapBracketGames(r)};getStandingGameById=async(t,e)=>{let i=g(e)?`/custom/standing/${t}${this.apiSignInUrl}${m()}`:`/custom/standing/${t}${this.apiSignInUrl}`,a="There was a problem with fetching standing game with the following ID: "+t,r=await this.fetchWithoutAuth(i,a);return this.standingGameRemapper.remapStandingGameById(r)};makeStandingGamePrediction=async(t,e)=>{let i=`/custom/standing/${t}/predictions${this.apiSignInUrl}`,a="There was a problem with making prediction for standing game with the following ID: "+t,r="POST",o={standing:e},n=await this.fetchWithAuth(i,a,r,o);return this.standingGameRemapper.remapPrediction(n)};updateStandingGamePrediction=async(t,e,i)=>{let a=`/custom/standing/${t}/predictions/${e}${this.apiSignInUrl}`,r="There was a problem with updating prediction for standing game with the following ID: "+t,o="PUT",n={standing:i},l=await this.fetchWithAuth(a,r,o,n);return this.standingGameRemapper.remapPrediction(l)};getStandingGamePredictionsForUser=async(t,e,i)=>{let a=`/custom/standing/${t}/predictions${this.apiSignInUrl}&profile_id=${e}`;g(i)&&(a+=m());let r=`There was a problem with getting prediction for user with ID ${e} for standing game with ID ${t}`,o=await this.fetchWithoutAuth(a,r);return this.standingGameRemapper.remapPredictionsForUser(o)};getStandingGameRankings=async(t,e,i)=>{let a=e?`/custom/standing/${t}/ranking${this.apiSignInUrl}${e.constructMainFiltersUrl()}`:`/custom/standing/${t}/ranking${this.apiSignInUrl}`;g(i)&&(a+=m());let r=`There was a problem with getting rankings for standing game with ID ${t}`,o=await this.fetchWithoutAuth(a,r);return this.standingGameRemapper.remapRankings(o)};getEventGames=async(t,e)=>{let i=t?`/custom/event${this.apiSignInUrl}${t.constructMainFiltersUrl()}`:`/custom/event${this.apiSignInUrl}`;g(e)&&(i+=m());let a="There was a problem with fetching event games list",r=await this.fetchWithoutAuth(i,a);return this.eventGameRemapper.remapEventGames(r)};getEventGameById=async(t,e)=>{let i=g(e)?`/custom/event/${t}${this.apiSignInUrl}${m()}`:`/custom/event/${t}${this.apiSignInUrl}`,a="There was a problem with fetching event game with the following ID: "+t,r=await this.fetchWithoutAuth(i,a);return this.eventGameRemapper.remapEventGameById(r)};makeEventGamePrediction=async(t,e)=>{let i=`/custom/event/${t}/predictions${this.apiSignInUrl}`,a="There was a problem with making prediction for event game with the following ID: "+t,r="POST",o=JSON.parse(JSON.stringify(e));o.fixtures=this.eventGameRemapper.remapPredictionToRequestBody(e.fixtures),e.tiebreaker&&(o.tiebreaker={stat_total:e.tiebreaker.statTotal});let n=await this.fetchWithAuth(i,a,r,o);return this.eventGameRemapper.remapPrediction(n)};updateEventGamePrediction=async(t,e,i)=>{let a=`/custom/event/${t}/predictions/${e}${this.apiSignInUrl}`,r="There was a problem with updating prediction for event game with the following ID: "+t,o="PUT",n=JSON.parse(JSON.stringify(i));n.fixtures=this.eventGameRemapper.remapPredictionToRequestBody(i.fixtures),i.tiebreaker&&(n.tiebreaker={stat_total:i.tiebreaker.statTotal});let l=await this.fetchWithAuth(a,r,o,n);return this.eventGameRemapper.remapPrediction(l)};getEventGamePredictionsForUser=async(t,e,i,a)=>{let r=i?`/custom/event/${t}/predictions${this.apiSignInUrl}&profile_id=${e}${i.constructMainFiltersUrl()}`:`/custom/event/${t}/predictions${this.apiSignInUrl}&profile_id=${e}`;g(a)&&(r+=m());let o=`There was a problem with getting all predictions for user with ID ${e} for event game with ID ${t}`,n=await this.fetchWithoutAuth(r,o);return this.eventGameRemapper.remapPredictionsForUser(n)};getEventGameRankings=async(t,e,i)=>{let a=e?`/custom/event/${t}/ranking${this.apiSignInUrl}${e.constructMainFiltersUrl()}`:`/custom/event/${t}/ranking${this.apiSignInUrl}`;g(i)&&(a+=m());let r=`There was a problem with getting rankings for event game with ID ${t}`,o=await this.fetchWithoutAuth(a,r);return this.eventGameRemapper.remapRankings(o)}};var be=class{id=null;name=null;nickname=null;avatar=null;gender=null;country=null;birthDate=null;verified=!1;staffMember=!1;anonymous=!1;disabled=!1;interests=[];followingCount=0;followersCount=0};var Ra=class extends be{email=null;phoneNumber=null;phoneCountryCode=null;preferences=null};var kn=class{profilesFromResponse=t=>t?t.map(e=>this.publicProfileFromResponse(e)):null;fullProfileFromResponse=t=>{let e=new Ra;return e.id=t.id,e.name=t.name,e.email=t.email,e.nickname=t.nickname,e.avatar=t.avatar,e.gender=t.gender,e.country=t.country,e.birthDate=t.birth_date,e.phoneCountryCode=t.phone_country_code,e.phoneNumber=t.phone_number,e.verified=t.verified,e.staffMember=t.staff_member,e.anonymous=t.anonymous,e.disabled=t.disabled,e.interests=t.interests?t.interests:[],e.preferences=t.preferences?this.remapPreferences(t.preferences):[],e.followingCount=t.following_count,e.followersCount=t.followers_count,e};publicProfileFromResponse=t=>{let e=new be;return e.id=t.id,e.name=t.name,e.nickname=t.nickname,e.avatar=t.avatar,e.gender=t.gender,e.country=t.country,e.birthDate=t.birth_date,e.verified=t.verified,e.staffMember=t.staff_member,e.anonymous=t.anonymous,e.disabled=t.disabled,e.interests=t.interests?t.interests:[],e.followingCount=t.following_count,e.followersCount=t.followers_count,e};remapPreferences=t=>t.map(e=>({preferenceId:e.preference_id,categories:e.categories,source:e.source}))};var H=class{meta=new M;data=[]};var Fa=class{avatar=null;followingId=null;name=null;nickname=null;profileId=null};var Gn=class{followResponse=t=>t.map(e=>this.remapResponse(e));followingFromResponse=t=>{let e=new H;return e.meta.pagination.nextPageStartsAfter=t.meta.pagination.next_page_starts_after,e.meta.pagination.itemsPerPage=t.meta.pagination.items_per_page,e.data=t.data.map(i=>this.remapResponse(i)),e};remapResponse=t=>{let e=new Fa;return e.avatar=t.avatar,e.followingId=t.following_id,e.name=t.name,e.profileId=t.profile_id,e.nickname=t.nickname,e}};var Sa=class{avatar=null;followerId=null;name=null;nickname=null;profileId=null};var va=class{followsMe=[];iFollow=[];followsMeBack=[]};var Un=class{followersFromResponse=t=>{let e=new H;return e.meta.pagination.nextPageStartsAfter=t.meta.pagination.next_page_starts_after,e.meta.pagination.itemsPerPage=t.meta.pagination.items_per_page,e.data=t.data.map(i=>this.remapResponse(i)),e};followStatusFromResponse=t=>{let e=new va;return e.iFollow=t.i_follow,e.followsMe=t.follows_me,e.followsMeBack=t.follows_me_back,e};remapResponse=t=>{let e=new Sa;return e.avatar=t.avatar,e.followerId=t.follower_id,e.name=t.name,e.profileId=t.profile_id,e}};var gi=class{profile_ids=[]};var Ca=class{leadId=null;profileId=null;firstName=null;lastName=null;fullName=null;email=null;gender=null;country=null;phoneCountryCode=null;phoneNumber=null;campaignId=null;campaignName=null;contentType=null;contentId=null;contentName=null;customFields=null};var Vn=class{toRequest(t){return{first_name:t.firstName||null,last_name:t.lastName||null,full_name:t.fullName||null,email:t.email||null,gender:t.gender||null,country:t.country||null,phone_country_code:t.phoneCountryCode||null,phone_number:t.phoneNumber||null,campaign_id:t.campaignId||null,campaign_name:t.campaignName||null,content_type:t.contentType||null,content_id:t.contentId||null,content_name:t.contentName||null,custom_fields:t.customFields||null}}fromResponse(t){let e=new Ca;return e.leadId=t.lead_id,e.profileId=t.profile_id,e.firstName=t.first_name,e.lastName=t.last_name,e.fullName=t.full_name,e.email=t.email,e.gender=t.gender,e.country=t.country,e.phoneCountryCode=t.phone_country_code,e.phoneNumber=t.phone_number,e.campaignId=t.campaign_id,e.campaignName=t.campaign_name,e.contentId=t.content_id,e.contentType=t.content_type,e.contentName=t.content_name,e.customFields=t.custom_fields,e}};var ad="/countries",at="/profile",Gp="/profiles",yi=class extends v{profileRemapper=null;followingRemapper=null;followersRemapper=null;leadRemapper=null;lang=null;limitIds=100;constructor(t){super(t,O(t.environment,"profile")),this.lang=t.lang,this.profileRemapper=new kn,this.followingRemapper=new Gn,this.followersRemapper=new Un,this.leadRemapper=new Vn}getCountries=async t=>{let e=`&lang=${this.lang}`,i=`${ad}${this.apiSignInUrl}${e}`,a=Date.now(),r="There was a problem fetching profile countries";return t&&(i+=`&disable_cache=${a}`),(await this.fetchWithoutAuth(i,r)).data};getProfile=async t=>{let e=`${at}${this.apiSignInUrl}`,i="";if(t){e=`${Gp}/${t}${this.apiSignInUrl}`,i=`There was a problem fetching the following profile: ${t}`;let a=await this.fetchWithoutAuth(e,i);return this.profileRemapper.publicProfileFromResponse(a.data)}else{i="There was a problem fetching your profile from API";let a=await this.fetchWithAuth(e,i);return this.profileRemapper.fullProfileFromResponse(a.data)}};getProfiles=async(t,e,i)=>{let a=Date.now(),r=`There was a problem fetching the following profiles: ${t.join(",")}`;if(t&&t.length){if(t.length>this.limitIds){let c=[],u=Vt(t,this.limitIds);for(let d of u){let b=`${Gp}${this.apiSignInUrl}&profile_ids=${d.join(",")}`;r=`There was a problem fetching the following profiles: ${d.join(",")}`,i&&(b+=`&disable_cache=${a}`);let _=await this.fetchWithoutAuth(b,r);c.push(...this.profileRemapper.profilesFromResponse(_.data))}return c}let l=`${Gp}${this.apiSignInUrl}&profile_ids=${t.join(",")}`;i&&(l+=`&disable_cache=${a}`);let p=await this.fetchWithoutAuth(l,r);return this.profileRemapper.profilesFromResponse(p.data)}let o=`${Gp}${this.apiSignInUrl}&search=${e}`;i&&(o+=`&disable_cache=${a}`);let n=await this.fetchWithoutAuth(o,r);return this.profileRemapper.profilesFromResponse(n.data)};getFollowers=async(t,e)=>{let i=`${at}/followers${this.apiSignInUrl}`,a="There was a problem fetching the followers for own profile";if(t&&!e){i=`${at}/followers${this.apiSignInUrl}${t.constructFilterUrl()}`;let o=await this.fetchWithAuth(i,a);return this.followersRemapper.followersFromResponse(o)}else if(!t&&!e){let o=await this.fetchWithAuth(i,a);return this.followersRemapper.followersFromResponse(o)}t&&e?i=`${at}/${e}/followers${this.apiSignInUrl}${t.constructFilterUrl()}`:!t&&e&&(i=`${at}/${e}/followers${this.apiSignInUrl}`),a=`There was a problem fetching the followers for profile: ${e}`;let r=await this.fetchWithoutAuth(i,a);return this.followersRemapper.followersFromResponse(r)};getFollowing=async(t,e)=>{let i=`${at}/following${this.apiSignInUrl}`,a="There was a problem fetching the followers of own profile";if(t&&!e){i=`${at}/following${this.apiSignInUrl}${t.constructFilterUrl()}`;let o=await this.fetchWithAuth(i,a);return this.followingRemapper.followingFromResponse(o)}else if(!t&&!e){let o=await this.fetchWithAuth(i,a);return this.followingRemapper.followingFromResponse(o)}t&&e?i=`${at}/${e}/following${this.apiSignInUrl}${t.constructFilterUrl()}`:!t&&e&&(i=`${at}/${e}/following${this.apiSignInUrl}`),a=`There was a problem fetching the followers of the following profile: ${e}`;let r=await this.fetchWithoutAuth(i,a);return this.followingRemapper.followingFromResponse(r)};follow=async t=>{let e=new gi;e.profile_ids=t;let i=at+`/follow${this.apiSignInUrl}`,a=`There was a problem with following profiles: ${t.join(",")}`,r="POST",o=await this.fetchWithAuth(i,a,r,e);return this.followingRemapper.followResponse(o.data)};unfollow=async t=>{let e=new gi;e.profile_ids=t;let i=at+`/follow${this.apiSignInUrl}`,a=`There was a problem with unfollowing profiles: ${t.join(",")}`,r="DELETE";return await this.fetchWithAuth(i,a,r,e),!0};getBadges=async t=>{let e=`${at}/badges${this.apiSignInUrl}`,i="There was a problem with fetching own badges";return t?(e=`${at}/${t}/badges${this.apiSignInUrl}`,i="There was a problem with fetching the badges",(await this.fetchWithoutAuth(e,i)).data):(await this.fetchWithAuth(e,i)).data};updateProfile=async t=>{let e=at+this.apiSignInUrl,i="There was a problem updating the own profile",a="PATCH",r=await this.fetchWithAuth(e,i,a,t);return this.profileRemapper.fullProfileFromResponse(r.data)};collectLead=async t=>{let e=`/leads${this.apiSignInUrl}`,i="There was a problem collecting lead",a="POST",r=await this.fetchWithAuth(e,i,a,this.leadRemapper.toRequest(t));return this.leadRemapper.fromResponse(r.data)};checkFollowStatus=async t=>{let e=`/profile/followers/check-follow-status${this.apiSignInUrl}&profile_ids=${t.join(",")}`,i="There was a problem checking follow status for profiles",a=await this.fetchWithAuth(e,i);return this.followersRemapper.followStatusFromResponse(a.data)};deleteOwnProfile=async()=>{let t=`/profile${this.apiSignInUrl}`,e="There was a problem deleting own profile",i="DELETE";await this.fetchWithAuth(t,e,i)};deleteUserData=async()=>{let t=`/user-data${this.apiSignInUrl}`,e="There was a problem deleting profile data",i="DELETE";await this.fetchWithAuth(t,e,i)}};var J=class{completed=!1;percentage;constructor(t){this.percentage=t}};var Aa=class{teamFollowed=new J(10);teamFavourite=new J(15);playerFollowed=new J(10);playerFavourite=new J(10);competitionFollowed=new J(10);competitionFavourite=new J(5);addedBirthdate=new J(10);addedGender=new J(10);addedCountry=new J(10);addedAvatar=new J(10)};var Oa=class{totalPercentage;breakdown=new Aa};var bi=class{limit=0;startAfter=null;constructor(t){this.limit=t.limit?t.limit:20,this.startAfter=t.startAfter?t.startAfter:null}constructFilterUrl=()=>{let t="";return this.limit&&(t=t+"&",t=t+`limit=${this.limit}`),this.startAfter&&(t=t+"&",t=t+`start_after=${this.startAfter}`),t}};var y=class extends Error{code=0;status=null;message=null;constructor(t,e,i){super(),this.code=t,this.status=e,this.message=i}errorMessage=()=>this.message};var _t=class{localCache;profileHttps=null;activityHttps=null;errorHandlingMode=null;constructor(t,e,i,a){this.localCache=t,this.profileHttps=e,this.activityHttps=i,this.errorHandlingMode=a}getOwn=async()=>{let t=await this.getLocalStorageData("profile");if(t&&Object.keys(t).length)return JSON.parse(JSON.stringify(t));try{let e=await this.profileHttps.getProfile();return await this.localCache.setOwnProfile(e),e}catch(e){throw console.warn("There was a problem retrieving your profile: ",e),e}};getOwnProfileFromCache=async()=>await this.localCache.getOwnProfile();updateOwnProfile=async()=>{try{let t=await this.profileHttps.getProfile();return await this.localCache.setOwnProfile(t),t}catch(t){throw console.warn("There was a problem retrieving your profile: ",t),t}};getByIds=async(t,e,i)=>{if(t&&t.length>0&&e||!t&&t.length===0&&!e)throw new h(400,"invalid_method_call","The method 'getByIds' from Profile namespace is not called correctly. You need to provide 'profileIds' OR 'search' parameters to the method, but you can't use both of them or neither of them.");try{return await this.profileHttps.getProfiles(t,e,i)}catch(a){throw console.warn(`There was a problem retrieving the selected profiles: ${t.join(",")} `,a),a}};getById=async t=>{try{return await this.profileHttps.getProfile(t)}catch(e){throw console.warn(`There was a problem retrieving the selected profile: ${t} `,e),e}};getCountries=async t=>{t=t||!1;let e=await this.localCache.getProfileCountries();if(e&&e.length>0)return e;try{let i=await this.profileHttps.getCountries(t);return await this.localCache.setProfileCountries(i),i}catch(i){throw console.warn("There was a problem retrieving profile countries: ",i),i}};getFollowers=async(t,e)=>{try{t&&(t=new bi(t));let i=await this.profileHttps.getFollowers(t,e),a=i.data.map(r=>r.followerId);if(a.length){let r=await this.getByIds(a),o=i.data.map(n=>(r.forEach(l=>{n.followerId===l.id&&(n.name=l.name,n.nickname=l.nickname,n.avatar=l.avatar)}),n));return i.data=o,i}return i}catch(i){throw console.warn("There was a problem retrieving your followers: ",i),i}};getFollowing=async(t,e)=>{try{t&&(t=new bi(t));let i=await this.profileHttps.getFollowing(t,e),a=i.data.map(r=>r.followingId);if(a.length){let r=await this.getByIds(a),o=i.data.map(n=>(r.forEach(l=>{n.followingId===l.id&&(n.name=l.name,n.nickname=l.nickname,n.avatar=l.avatar)}),n));return i.data=o,i}return i}catch(i){throw console.warn("There was a problem retrieving your following profiles: ",i),i}};follow=async t=>{try{return await this.profileHttps.follow(t)}catch(e){throw console.warn(`There was a problem following profiles: ${t.join(",")} `,e),e}};unfollow=async t=>{try{return await this.profileHttps.unfollow(t)}catch(e){throw console.warn(`There was a problem unfollowing profiles: ${t.join(",")} `,e),e}};showFullnessProfile=t=>{let e=new Oa,i=0;return t.avatar&&(e.breakdown.addedAvatar.completed=!0,i+=e.breakdown.addedAvatar.percentage),t.birthDate&&(e.breakdown.addedBirthdate.completed=!0,i+=e.breakdown.addedBirthdate.percentage),t.country&&(e.breakdown.addedCountry.completed=!0,i+=e.breakdown.addedCountry.percentage),t.gender&&(e.breakdown.addedGender.completed=!0,i+=e.breakdown.addedGender.percentage),t.interests&&t.interests.length>0&&(t.interests.find(c=>c.type==="team"&&c.favourite)&&(e.breakdown.teamFavourite.completed=!0,i+=e.breakdown.teamFavourite.percentage),t.interests.find(c=>c.type==="team")&&(e.breakdown.teamFollowed.completed=!0,i+=e.breakdown.teamFollowed.percentage),t.interests.find(c=>c.type==="player"&&c.favourite)&&(e.breakdown.playerFavourite.completed=!0,i+=e.breakdown.playerFavourite.percentage),t.interests.find(c=>c.type==="player")&&(e.breakdown.playerFollowed.completed=!0,i+=e.breakdown.playerFollowed.percentage),t.interests.find(c=>c.type==="competition"&&c.favourite)&&(e.breakdown.competitionFavourite.completed=!0,i+=e.breakdown.competitionFavourite.percentage),t.interests.find(c=>c.type==="competition")&&(e.breakdown.competitionFollowed.completed=!0,i+=e.breakdown.competitionFollowed.percentage)),e.totalPercentage=i,e};getStats=async()=>{let t=await this.getLocalStorageData("statistics");if(t&&Object.keys(t).length)return JSON.parse(JSON.stringify(t));try{let e=await this.activityHttps.getStats();return await this.localCache.setProfileStats(e),e}catch(e){throw console.warn("There was a problem retrieving own profile statistics: ",e),e}};getBadges=async t=>{if(t)try{return await this.profileHttps.getBadges()}catch(i){throw console.warn("There was a problem retrieving own profile badges: ",i),i}let e=await this.getLocalStorageData("badges");if(e)return e;try{let i=await this.profileHttps.getBadges();return await this.localCache.setProfileBadges(i),i}catch(i){throw console.warn("There was a problem retrieving own profile badges: ",i),i}};clearLocalStorageData=async()=>{await this.localCache.setOwnProfile({}),await this.localCache.setProfileStats({}),await this.localCache.setProfileBadges(null)};collectLead=async t=>{if(this.errorHandlingMode&&!t)throw this.errorHandlingMode==="standard"?new h(400,"invalid_method_call","The method 'collectLead' from Profile namespace is not called correctly. You need to provide 'requestBody' parameter to the method."):new y(400,"invalid_method_call","The method 'collectLead' from Profile namespace is not called correctly. You need to provide 'requestBody' parameter to the method.");return await this.profileHttps.collectLead(t)};checkFollowStatus=async t=>{if(!t||!Array.isArray(t)||t.length===0)throw this.errorHandlingMode==="standard"?new h(400,"invalid_method_call","Invalid or empty IDs provided. Please provide at least one ID."):new y(400,"invalid_method_call","Invalid or empty IDs provided. Please provide at least one ID.");return await this.profileHttps.checkFollowStatus(t)};getLocalStorageData=async t=>{let e=Math.floor(Date.now()/1e3),i=await this.localCache.getExpiration("profile",t);switch(t){case"profile":if(i>e)return await this.localCache.getOwnProfile();case"statistics":if(i>e)return await this.localCache.getProfileStats();case"badges":if(i>e)return await this.localCache.getProfileBadges();default:return null}}};var La=class{id=null;name=null;assets=null};var Hn=class{extractUpdatedProps=(t,e)=>{let i=["name","nickname","gender","avatar","email"],a={};return Object.keys(t).forEach(r=>{if(i.includes(r)&&t[r]!==e[r])a[r]=e[r];else if(r==="phoneCountryCode")t[r]&&e[r]===null?a.phone_country_code=null:(t[r]===null&&e[r]||t[r]!==e[r])&&(a.phone_country_code=e[r]);else if(r==="phoneNumber")(t[r]&&e[r]===null||t[r]===null&&e[r]||t[r]!==e[r])&&(a.phone_number=e[r]);else if(r==="birthDate")(e[r]===null||t[r]===null&&e[r]||t[r]!==e[r])&&(a.birth_date=e[r]);else if(r==="country")e[r]===null?a.country_id=e[r]:(t[r]===null&&e[r]||t[r].id!==e[r].id)&&(a.country_id=e[r].id);else if(r==="interests"){let o=t[r],n=e[r];n.length&&this.isNewInterest(o,n)?a[r]=this.updateInterests(o,n):(!n.length&&o.length||o.length!==n.length&&!this.isNewInterest(o,n))&&(a[r]=n)}}),a};updateInterests=(t,e)=>{if(t.length===e.length){let[i,a]=this.extractSameAndNewInterests(t,e);return[...a,...i]}else return e};isNewInterest=(t,e)=>{let i=!1,[a]=this.extractSameAndNewInterests(t,e);return a.length&&(i=!0),i};extractSameAndNewInterests=(t,e)=>{let i=e.filter(r=>t.some(o=>r.id===o.id&&r.type===o.type&&r.source===o.source&&r.favourite===o.favourite));return[e.filter(r=>!t.some(o=>r.id===o.id&&r.type===o.type&&r.source===o.source&&r.favourite===o.favourite)),i]};isAvatarValidURL=t=>{try{return new URL(t),!0}catch{return!1}}};var $n=class{idsRemapper=null;profileHttps=null;profileService=null;localCache=null;profileFacade=null;ownProfile=null;modified=!1;expireAt=0;promises=[];isFetching=!1;configuration=null;constructor(t,e,i,a,r){this.configuration=t,this.idsRemapper=e,this.localCache=i,this.profileHttps=a,this.profileService=new Hn,this.profileFacade=new _t(i,a,r)}getOwnProfile=async()=>{for(;this.isFetching;)console.log("Another thread is fetching profile..."),await this.delay(100);if(this.modified&&this.ownProfile)return console.log("Timestamp is less than 10 minutes OR profile is modifying "),this.ownProfile;let t=Math.floor(Date.now()/1e3);if(!this.ownProfile||this.expireAt<t){this.isFetching=!0,this.expireAt=Math.floor(Date.now()/1e3)+600;try{await this.clearAllProfileData();let e=await this.profileFacade.getOwn();this.setOwnProfile(e)}catch(e){throw this.isFetching=!1,e}return this.modified=!1,this.isFetching=!1,this.ownProfile}return this.ownProfile};delay=t=>new Promise(e=>{setTimeout(e,t)});setOwnProfile=t=>{this.ownProfile=t};getInfo=async()=>{let t=await this.getOwnProfile(),e=JSON.parse(JSON.stringify(t));return delete e.interests,e};showInterests=async()=>{let t=await this.getOwnProfile(),e=JSON.parse(JSON.stringify(t));return await this.idsRemapper.remapInterests(e.interests)};showFullInterests=async()=>{let t=await this.getOwnProfile(),e=JSON.parse(JSON.stringify(t));return await this.idsRemapper.showFullInterests(e.interests)};getFollowers=async t=>await this.profileFacade.getFollowers(t);getFollowing=async t=>await this.profileFacade.getFollowing(t);follow=async t=>{let e=await this.profileFacade.follow(t),i=await this.profileFacade.updateOwnProfile();return this.setOwnProfile(i),e};unfollow=async t=>{let e=await this.profileFacade.unfollow(t),i=await this.profileFacade.updateOwnProfile();return this.setOwnProfile(i),e};getStats=async()=>{await this.clearAllProfileData();let t=await this.profileFacade.getStats();return await this.idsRemapper.remapProfileStats(t)};getBadges=async t=>(await this.clearAllProfileData(),await this.profileFacade.getBadges(t));addInterestPromise=async t=>{this.modified=!0;let e={...t};await this.getOwnProfile();let i=null;t.source!=="custom"?i=await this.idsRemapper.remapInterestToNative(e):i=e;let a=this.ownProfile.interests.filter(r=>r.id!==i.id||r.type!==i.type||r.source!==i.source);return this.ownProfile.interests=[...a],this.ownProfile.interests.push(i),this};addInterest=t=>(this.promises.push(this.addInterestPromise(t)),this);removeInterestPromise=async t=>{this.modified=!0;let e={...t};await this.getOwnProfile();let i=null;return t.source!=="custom"?i=await this.idsRemapper.remapInterestToNative(e):i=e,this.ownProfile.interests=this.ownProfile.interests.filter(a=>a.id!==i.id||a.type!==i.type||a.source!==i.source),this};removeInterest=t=>(this.promises.push(this.removeInterestPromise(t)),this);setBirthdatePromise=async t=>(this.modified=!0,await this.getOwnProfile(),t?this.ownProfile.birthDate=t:this.ownProfile.birthDate=null,this);setBirthdate=t=>(this.promises.push(this.setBirthdatePromise(t)),this);setGenderPromise=async t=>(this.modified=!0,await this.getOwnProfile(),t==="male"||t==="female"?this.ownProfile.gender=t:this.ownProfile.gender="unspecified",this);setGender=t=>(this.promises.push(this.setGenderPromise(t)),this);setNicknamePromise=async t=>(this.modified=!0,await this.getOwnProfile(),this.ownProfile.nickname=t,this);setNickname=t=>(this.promises.push(this.setNicknamePromise(t)),this);setNamePromise=async t=>(this.modified=!0,await this.getOwnProfile(),this.ownProfile.name=t,this);setName=t=>(this.promises.push(this.setNamePromise(t)),this);setCountryPromise=async t=>(this.modified=!0,await this.getOwnProfile(),t&&!this.ownProfile.country?(this.ownProfile.country=new La,this.ownProfile.country.id=t):t&&this.ownProfile.country?this.ownProfile.country.id=t:this.ownProfile.country=null,this);setCountry=t=>(this.promises.push(this.setCountryPromise(t)),this);showFullnessProfile=async()=>{let t=await this.getOwnProfile(),e=JSON.parse(JSON.stringify(t));return this.profileFacade.showFullnessProfile(e)};setAvatarPromise=async t=>{if(this.modified=!0,await this.getOwnProfile(),this.profileService.isAvatarValidURL(t))this.ownProfile.avatar=t;else{if(this.configuration.errorHandlingMode==="default")throw new y(400,"invalid_avatar","Invalid URL syntax for avatar image.");if(this.configuration.errorHandlingMode==="standard")throw new h(400,"invalid_avatar","Invalid URL syntax for avatar image.")}return this};setAvatar=t=>(this.promises.push(this.setAvatarPromise(t)),this);delete=async()=>(await this.profileHttps.deleteOwnProfile(),await this.profileFacade.clearLocalStorageData(),!0);deleteData=async()=>(await this.profileHttps.deleteUserData(),await this.profileFacade.clearLocalStorageData(),!0);setEmailPromise=async t=>(this.modified=!0,await this.getOwnProfile(),typeof t=="string"&&t?this.ownProfile.email=t:console.warn(`Wrong email argument: ${t}. Will be ignored when updating profile`),this);setEmail=t=>(this.promises.push(this.setEmailPromise(t)),this);setPhoneCountryCodePromise=async t=>(this.modified=!0,await this.getOwnProfile(),t===null||typeof t=="string"&&t?this.ownProfile.phoneCountryCode=t:console.warn(`Wrong phoneCountryCode argument: ${t}. Will be ignored when updating profile`),this);setPhoneCountryCode=t=>(this.promises.push(this.setPhoneCountryCodePromise(t)),this);setPhoneNumberPromise=async t=>(this.modified=!0,await this.getOwnProfile(),t===null||typeof t=="string"&&t?this.ownProfile.phoneNumber=t:console.warn(`Wrong phoneNumber argument: ${t}. Will be ignored when updating profile`),this);setPhoneNumber=t=>(this.promises.push(this.setPhoneNumberPromise(t)),this);update=async()=>{if(this.promises.length===0)return this.ownProfile;await Promise.all(this.promises);let t=await this.profileFacade.getOwn(),e=await this.getOwnProfile(),i=this.profileService.extractUpdatedProps(t,e);if(this.modified=!1,this.expireAt=0,Object.keys(i).length){let r=await this.profileHttps.updateProfile(i),o=JSON.parse(JSON.stringify(r));return this.setOwnProfile(o),await this.localCache.setOwnProfile(o),delete r.interests,r}let a=JSON.parse(JSON.stringify(this.ownProfile));return delete a.interests,a};clearAllProfileData=async()=>{await this.isNewProfileRequested()&&await this.profileFacade.clearLocalStorageData()};isNewProfileRequested=async()=>{let t=this.profileHttps.extractUserIdFromToken();if(!t)return!1;if(!this.ownProfile){let e=await this.profileFacade.getOwnProfileFromCache();return!!(e&&Object.keys(e).length&&e.id!==t)}return this.ownProfile.id!==t}};var Mi=class{idsRemapper=null;profileHttps=null;activityHttps=null;profileFacade=null;profileId="";localCache=null;constructor(t,e,i,a){this.idsRemapper=t,this.profileHttps=i,this.activityHttps=a,this.localCache=e,this.profileFacade=new _t(e,i,a)}getById=t=>new Mi(this.idsRemapper,this.localCache,this.profileHttps,this.activityHttps).setId(t);setId=t=>(this.profileId=t,this);getProfile=async()=>await this.profileFacade.getById(this.profileId);getInfo=async()=>{let t=await this.getProfile();return delete t.interests,t};showInterests=async()=>{let t=await this.getProfile(),e=JSON.parse(JSON.stringify(t));return await this.idsRemapper.remapInterests(e.interests)};showFullInterests=async()=>{let t=await this.getProfile(),e=JSON.parse(JSON.stringify(t));return await this.idsRemapper.showFullInterests(e.interests)};getFollowers=async t=>await this.profileFacade.getFollowers(t,this.profileId);getFollowing=async t=>await this.profileFacade.getFollowing(t,this.profileId);showFullnessProfile=async()=>{let t=await this.getProfile();return this.profileFacade.showFullnessProfile(t)};getStats=async t=>{let e=await this.activityHttps.getStats(this.profileId,t);return await this.idsRemapper.remapProfileStats(e)};getBadges=async()=>await this.profileHttps.getBadges(this.profileId)};var Wn=class{localCache=null;https=null;idMapping=null;constructor(t,e,i){this.localCache=t,this.idMapping=i,this.https=e}getCountriesWithIdMapping=async t=>{try{let e=await this.getCountries(t);return this.idMapping.remapEntities(e,"country")}catch(e){throw console.warn("There was a problem browsing countries as football entities",e),e}};getCountries=async t=>{t=t||!1;let e=await this.localCache.getFootballCountries();if(e&&e.length>0)return e;try{let i=await this.https.getCountries(t);return await this.localCache.setFootballCountries(i),i}catch(i){throw console.warn("There was a problem retrieving countries as football entities",i),i}}};var Ii=class{countryId=null;name=null;gender=null;type=null;sortField=null;sortOrder=null;competitionIds=null;constructor(t){this.countryId=t.countryId?`${t.countryId}`:null,this.name=t.name?t.name:null,this.gender=t.gender?t.gender:null,this.type=t.type?t.type:null,this.sortField=t.sortField?`${t.sortField}`:null,this.sortOrder=t.sortOrder?`${t.sortOrder}`:null,this.competitionIds=t.competitionIds?t.competitionIds:null}constructFilterUrl=()=>{let t="";return this.countryId&&(t=t+"&",t=t+`country_id=${this.countryId}`),this.gender&&(t=t+"&",t=t+`gender=${this.gender}`),this.type&&(t=t+"&",t=t+`type=${this.type}`),this.sortField&&(t=t+"&",t=t+`sort_field=${this.sortField}`),this.sortOrder&&(t=t+"&",t=t+`sort_order=${this.sortOrder}`),this.name&&(t=t+"&",t=t+`name=${this.name}`),this.competitionIds&&this.competitionIds.length>0&&(t=t+"&",t=t+`competition_ids=${this.competitionIds.join(",")}`),t};competitionSearchFilter=t=>{try{let e=this.filter(t);return this.sortField||this.sortOrder?this.sort(e):e}catch(e){return console.warn("There was a problem filtering the local competitions",e),[]}};filter=t=>{let e=this.entitiesToSearchWith();return t.filter(i=>{let a=!0;return e.forEach(r=>{r!=="sortOrder"&&r!=="sortField"&&(r==="countryId"?a&&=i.country.id===this[r]:r==="name"?a&&=i.name.toLocaleLowerCase().includes(this[r].toLocaleLowerCase()):r==="competitionIds"?a&&=this[r].some(o=>i.id===o):a&&=i[r].toLocaleLowerCase()===this[r].toLocaleLowerCase())}),a})};entitiesToSearchWith=()=>{let t=[];return this.countryId&&t.push("countryId"),this.name&&t.push("name"),this.gender&&t.push("gender"),this.type&&t.push("type"),this.sortField&&t.push("sortField"),this.sortOrder&&t.push("sortOrder"),this.competitionIds&&t.push("competitionIds"),t};sort=t=>{let e=[];return this.sortField==="name"?e=t.sort((i,a)=>this.sortOrder&&this.sortOrder==="desc"?a.name.localeCompare(i.name):i.name.localeCompare(a.name)):this.sortField==="country"?e=t.sort((i,a)=>this.sortOrder&&this.sortOrder==="desc"?a.country.name.localeCompare(i.country.name):i.country.name.localeCompare(a.country.name)):this.sortField==="scope"?t.forEach(i=>e[this.competitionIds.indexOf(i.id)]=i):!this.sortField&&this.sortOrder==="desc"&&(e=t.sort((i,a)=>a.id.localeCompare(i.id))),e}};var qn=class{localStorage=null;https=null;idMapping=null;constructor(t,e,i){this.localStorage=t,this.idMapping=i,this.https=e}getCompetitionsIdMapping=async(t,e)=>{try{let i=!1;if(t){if(t=new Ii(t),t.countryId){let r=await this.idMapping.getEntityIdsBySchemaId([`${t.countryId}`],"country","native");r.country.length===0&&(i=!0),t.countryId=r.country[0]}if(t.competitionIds){let r=await this.idMapping.getEntityIdsBySchemaId(t.competitionIds,"competition","native");r.competition.length===0&&(i=!0),t.competitionIds=r.competition}if(i)return[]}let a=await this.getCompetitions(t,e);return await this.idMapping.remapEntities(a,"competition")}catch(i){throw console.warn("There was a problem browsing all of the competitions",i),i}};getCompetitionsMapWithNativeIds=async t=>{let e=new Map,i=t.length,a=new Ii({competitionIds:t,limit:i}),r=await this.getCompetitions(a);r.sort((l,p)=>l.id.localeCompare(p.id));let o=Cp(t),n=await this.idMapping.remapEntities(r,"competition");return o.forEach((l,p)=>e.set(l,n[p])),e};getCompetitions=async(t,e)=>{let i=null;if(e=e||!1,!await this.localStorage.getCompetitionsLength()){try{i=await this.https.getCompetitions()}catch(a){throw console.warn("There was a problem retrieving all competitions",a),a}await this.localStorage.setCompetitions(i)}return await this.localStorage.getCompetitions(t)};getCompetitionByIdIdMapping=async(t,e)=>{try{let a=(await this.idMapping.getEntityIdsBySchemaId([t],"competition","native")).competition[0],r=await this.getCompetitionById(a,e);return await this.idMapping.remapEntities(r,"competition")}catch(i){throw console.warn(`There was a problem browsing the following competition:${t}`,i),i}};getCompetitionById=async(t,e)=>{try{return e=e||!1,await this.https.getCompetitionById(t,e)}catch(i){throw console.warn(`There was a problem retrieving the competition with the following id: ${t}`,i),i}};getTopCompetitionsIdMapping=async t=>{try{let e=await this.getTopCompetitions(t);return await this.idMapping.remapEntities(e,"competition")}catch(e){throw console.warn("There was a problem browsing the top competitions",e),e}};getTopCompetitions=async t=>{try{return t=t||!1,await this.https.getTopCompetitions(t)}catch(e){throw console.warn("There was a problem retrieving the top competitions",e),e}}};var wi=class{name=null;countryId=null;national=!1;gender=null;limit=null;page=null;scope=null;sortField=null;sortOrder=null;teamIds=null;constructor(t){this.name=t.name?t.name:null,this.countryId=t.countryId?`${t.countryId}`:null,this.national=t.national?t.national:!1,this.gender=t.gender?t.gender:null,this.limit=t.limit?t.limit:null,this.page=t.page?t.page:null,this.scope=t.scope?t.scope:null,this.sortField=t.sortField?`${t.sortField}`:null,this.sortOrder=t.sortOrder?`${t.sortOrder}`:null,this.teamIds=t.teamIds?t.teamIds:null}constructFilterUrl=()=>{let t="";return this.name&&(t=t+"&",t=t+`name=${this.name}`),this.countryId&&(t=t+"&",t=t+`country_id=${this.countryId}`),this.national&&(t=t+"&",t=t+`national=${this.national}`),this.gender&&(t=t+"&",t=t+`gender=${this.gender}`),this.limit&&(t=t+"&",t=t+`limit=${this.limit}`),this.scope&&this.scope.length>0&&(t=t+"&",t=t+`scope=${this.scope.join(",")}`),this.page&&(t=t+"&",t=t+`page=${this.page}`),this.sortField&&(t=t+"&",t=t+`sort_field=${this.sortField}`),this.sortOrder&&(t=t+"&",t=t+`sort_order=${this.sortOrder}`),this.teamIds&&this.teamIds.length>0&&(t=t+"&",t=t+`team_ids=${this.teamIds.join(",")}`),t}};var xa=class{reason="";words=[]};var Me=class{enabled=!1;moderateLinks=!1;linksWhitelist=[];moderatorProfileId="";dictionary=new xa};var Da=class{enabled=!1;clientId=null;automaticModeration=new Me};var Lt=class{points=null;gameParticipationCount=null;entityId=null;entityType=null;predictionsMade=null;correctPredictions=null};var Ie=class{id;weight;multiplier;conditions};var we=class{value=[new Ie]};var _e=class{points=null;tiers=null;badges=null};var Ba=class{enabled=!1;clientId=null;conditions={list:null};actions=new we;rewards=new _e};var Na=class{general=null;predictor=null;activity=null;topX=null;matchQuiz=null;discussionPost=null};var Pe=class{enabled=!1;clientId=null;defaultMarkets=null;competitionsWhitelist=null;authRequirement=null};var Te=class{enabled=!1;clientId=null;minFixtures=null;maxFixtures=null;competitionsWhitelist=null;authRequirement=null};var ka=class{competitions=[];teams=[];markets=[]};var Ee=class{enabled=!1;clientId=null;fullCoverageCompetitions=null;markets=null;successRateScopes=new ka;userDataConfig=null};var Ga=class{storeIp=!1;storeDeviceId=!1;storeAgent=!1};var Ua=class{potm=[];poll=[]};var Va=class{predictor=[];topX=[];matchQuiz=[];games=[];football=[];classicQuizzes=[];eitherOr=[];discussions=[];voting=new Ua};var z=class{id;label;description;flags;assets={mainImageUrl:""};enabled};var Ha=class{predictionsNumber;correctPredictions;points;fromDate;toDate};var $a=class extends z{requirements=new Ha};var Wa=class{participationCount;points;fromDate;toDate};var qa=class extends z{requirements=new Wa};var za=class{participationCount;points;specificGames;fromDate;toDate};var Qa=class extends z{requirements=new za};var Ka=class{predictionsNumber;correctPredictions;points;entityId;entityType;entityModel=null};var ja=class extends z{requirements=new Ka};var Ya=class{participationCount;fromDate;toDate};var Xa=class extends z{requirements=new Ya};var Ja=class{totalDiscussionPoints;postsCount;postPoints;reactionsCount};var Za=class extends z{requirements=new Ja};var tr=class{points;voteCount;entityId;entityType;entityModel};var Re=class extends z{requirements=new tr};var Fe=class{points=null;tiers=null;badges=null};var er=class{enabled=!1;clientId=null;conditions={list:null};actions=new we;rewards=new Fe};var ir=class{general=[];predictor=[];topX=[];matchQuiz=[]};var ar=class{id;label;assets={mainImageUrl:""};enabled;requirements=new Lt};var Se=class extends Lt{postPoints=null;postsCount=null;reactionsCount=null;totalDiscussionPoints=null};var rr=class{id;label;assets={mainImageUrl:""};enabled;requirements=new Se};var ve=class{assists=null;shots=null;offsides=null;tackles=null;saves=null;minutesEqualOrOver60=null;minutesUnder60=null;yellowCards=null;redCards=null;goalsGoalkeeper=null;goalsDefender=null;goalsMidfielder=null;goalsForwards=null;penaltyGoals=null;ownGoals=null;cleanSheetsGoalkeeper=null;cleanSheetsDefender=null;cleanSheetsMidfielder=null;cleanSheetsForwards=null;shotsOn=null;foulsCommitted=null;penaltyCommitted=null;penaltyWon=null;penaltyMissed=null;concededGoals=null;caughtBall=null};var Ce=class{total=null;minGoalkeepers=null;maxGoalkeepers=null;minDefenders=null;maxDefenders=null;minMidfielders=null;maxMidfielders=null;minStrikers=null;maxStrikers=null};var or=class{enabled=!1;clientId=null;addPointsToProfileTotal=!1;coefficients=new ve;players=new Ce;multipliers=null;competitionsWhitelist=[]};var sr=class{captain=null;viceCaptain=null};var zn=class{remapPredictorConfig=t=>{let e=new Ee;return e.enabled=t.enabled,e.clientId=t.client_id,e.fullCoverageCompetitions=t.full_coverage_competitions,e.markets=t.markets,e.successRateScopes=t.success_rate_scopes,e.userDataConfig=t.user_data_config?this.remapUserDataConfig(t.user_data_config):null,e};remapTopXConfig=t=>{let e=new Te;return e.enabled=t.enabled,e.clientId=t.client_id,e.minFixtures=t.min_fixtures,e.maxFixtures=t.max_fixtures,e.competitionsWhitelist=t.competitions_whitelist,e.authRequirement=t.auth_requirement,e};remapMatchQuizConfig=t=>{let e=new Pe;return e.enabled=t.enabled,e.clientId=t.client_id,e.defaultMarkets=t.default_markets,e.competitionsWhitelist=t.competitions_whitelist,e.authRequirement=t.auth_requirement,e};remapLoyaltyConfig=t=>{let e=new Ba;return e.enabled=t.enabled,e.clientId=t.client_id,e.conditions.list=t.conditions.list,e.actions.value=t.actions.value,e.rewards=this.remapRewards(t.rewards),e};remapLoyaltyNewConfig=t=>{let e=new er;return e.enabled=t.enabled,e.clientId=t.client_id,e.conditions.list=t.conditions.list,e.actions.value=t.actions.value,e.rewards=this.remapNewRewards(t.rewards),e};remapDiscussionsConfig=t=>{let e=new Da;return e.enabled=t.enabled,e.clientId=t.client_id,e.automaticModeration=t.automatic_moderation?this.remapAutomaticModeration(t.automatic_moderation):null,e};remapFantasyConfig=t=>{let e=new or;return e.enabled=t.enabled,e.clientId=t.client_id,e.addPointsToProfileTotal=t.add_points_to_profile_total,e.competitionsWhitelist=t.competitions_whitelist,e.multipliers=t.multipliers?this.remapMultipliers(t.multipliers):null,e.players=this.remapFantasyPlayers(t.players),e.coefficients=this.remapFantasyCoefficients(t.coefficients),e};remapFantasyPlayers=t=>{let e=new Ce;return e.total=t.total,e.minGoalkeepers=t.min_goalkeepers,e.maxGoalkeepers=t.max_goalkeepers,e.minDefenders=t.min_defenders,e.maxDefenders=t.max_defenders,e.minMidfielders=t.min_midfielders,e.maxMidfielders=t.max_midfielders,e.minStrikers=t.min_strikers,e.maxStrikers=t.max_strikers,e};remapFantasyCoefficients=t=>{let e=new ve;return e.assists=t.assists,e.shots=t.shots,e.offsides=t.offsides,e.tackles=t.tackles,e.saves=t.saves,e.minutesEqualOrOver60=t.minutes_equal_or_over_60,e.minutesUnder60=t.minutes_under_60,e.yellowCards=t.yellow_cards,e.redCards=t.red_cards,e.goalsGoalkeeper=t.goals_goalkeeper,e.goalsDefender=t.goals_defender,e.goalsMidfielder=t.goals_midfielder,e.goalsForwards=t.goals_forwards,e.penaltyGoals=t.penalty_goals,e.ownGoals=t.own_goals,e.cleanSheetsGoalkeeper=t.clean_sheets_goalkeeper,e.cleanSheetsDefender=t.clean_sheets_defender,e.cleanSheetsMidfielder=t.clean_sheets_midfielder,e.cleanSheetsForwards=t.clean_sheets_forwards,e.shotsOn=t.shots_on,e.foulsCommitted=t.fouls_committed,e.penaltyCommitted=t.penalty_committed,e.penaltyWon=t.penalty_won,e.penaltyMissed=t.penalty_missed,e.concededGoals=t.conceded_goals,e.caughtBall=t.caught_ball,e};remapAutomaticModeration=t=>{let e=new Me;return e.enabled=t.enabled,e.moderateLinks=t.moderate_links,e.linksWhitelist=t.links_whitelist,e.moderatorProfileId=t.moderator_profile_id,e.dictionary=t.dictionary,e};remapNewRewards=t=>{let e=new Fe;return e.points=this.remapPoints(t.points),e.tiers=t.tiers,e.badges=this.remapNewBadges(t.badges),e};remapRewards=t=>{let e=new _e;return e.points=this.remapPoints(t.points),e.tiers=t.tiers,e.badges=this.remapBadges(t.badges),e};remapPoints=t=>{let e=new Na;return e.general=t.general,e.discussionPost=t.discussion_post,e.predictor=t.predictor,e.activity=t.activity,e.topX=t.top_x,e.matchQuiz=t.match_quiz,e};remapBadges=t=>{let e=new ir;return e.general=t.general?this.remapGeneralBadgeValues(t.general):[],e.predictor=this.remapBadgeValues(t.predictor),e.topX=this.remapBadgeValues(t.top_x),e.matchQuiz=this.remapBadgeValues(t.match_quiz),e};remapNewBadges=t=>{let e=new Va;return e.predictor=this.remapBadgeValuesPredictor(t.predictor),e.topX=this.remapBadgeValuesGame(t.top_x),e.matchQuiz=this.remapBadgeValuesGame(t.match_quiz),t.games&&(e.games=this.remapBadgeValuesGames(t.games)),t.football&&(e.football=this.remapBadgeValuesFootball(t.football)),t.classic_quizzes&&(e.classicQuizzes=this.remapBadgeValuesMiniGames(t.classic_quizzes)),t.either_or&&(e.eitherOr=this.remapBadgeValuesMiniGames(t.either_or)),t.discussions&&(e.discussions=this.remapBadgeValuesDiscussions(t.discussions)),t.voting&&t.voting.potm&&(e.voting.potm=this.remapBadgeValuesVoting(t.voting.potm)),t.voting&&t.voting.poll&&(e.voting.poll=this.remapBadgeValuesVoting(t.voting.poll)),e};remapBadgeValuesPredictor=t=>t.map(e=>{let i=new $a;return i.id=e.id,i.enabled=e.enabled,i.label=e.label,i.description=e.description,i.flags=e.flags,e.assets?i.assets.mainImageUrl=e.assets.main_image_url:i.assets=e.assets,e.requirements&&(i.requirements.predictionsNumber=e.requirements.predictions_number,i.requirements.correctPredictions=e.requirements.correct_predictions,i.requirements.points=e.requirements.points,i.requirements.fromDate=e.requirements.from_date,i.requirements.toDate=e.requirements.to_date),i});remapBadgeValuesGame=t=>t.map(e=>{let i=new qa;return i.id=e.id,i.enabled=e.enabled,i.label=e.label,i.description=e.description,i.flags=e.flags,e.assets?i.assets.mainImageUrl=e.assets.main_image_url:i.assets=e.assets,e.requirements&&(i.requirements.participationCount=e.requirements.participation_count,i.requirements.points=e.requirements.points,i.requirements.fromDate=e.requirements.from_date,i.requirements.toDate=e.requirements.to_date),i});remapBadgeValuesGames=t=>t.map(e=>{let i=new Qa;return i.id=e.id,i.enabled=e.enabled,i.label=e.label,i.description=e.description,i.flags=e.flags,e.assets?i.assets.mainImageUrl=e.assets.main_image_url:i.assets=e.assets,e.requirements&&(i.requirements.participationCount=e.requirements.participation_count,i.requirements.points=e.requirements.points,i.requirements.fromDate=e.requirements.from_date,i.requirements.toDate=e.requirements.to_date,i.requirements.specificGames=e.requirements.specific_games?this.remapSpecificGamesRequirement(e.requirements.specific_games):null),i});remapSpecificGamesRequirement=t=>t.map(e=>({gameId:e.game_id,gameType:e.game_type,gameModel:null}));remapBadgeValuesFootball=t=>t.map(e=>{let i=new ja;return i.id=e.id,i.enabled=e.enabled,i.label=e.label,i.description=e.description,i.flags=e.flags,e.assets?i.assets.mainImageUrl=e.assets.main_image_url:i.assets=e.assets,e.requirements&&(i.requirements.predictionsNumber=e.requirements.predictions_number,i.requirements.correctPredictions=e.requirements.correct_predictions,i.requirements.points=e.requirements.points,i.requirements.entityId=e.requirements.entity_id,i.requirements.entityType=e.requirements.entity_type),i});remapBadgeValuesMiniGames=t=>t.map(e=>{let i=new Xa;return i.id=e.id,i.enabled=e.enabled,i.label=e.label,i.description=e.description,i.flags=e.flags,e.assets?i.assets.mainImageUrl=e.assets.main_image_url:i.assets=e.assets,e.requirements&&(i.requirements.participationCount=e.requirements.participation_count,i.requirements.fromDate=e.requirements.from_date,i.requirements.toDate=e.requirements.to_date),i});remapBadgeValuesDiscussions=t=>t.map(e=>{let i=new Za;return i.id=e.id,i.enabled=e.enabled,i.label=e.label,i.description=e.description,i.flags=e.flags,e.assets?i.assets.mainImageUrl=e.assets.main_image_url:i.assets=e.assets,e.requirements&&(i.requirements.totalDiscussionPoints=e.requirements.total_discussion_points,i.requirements.postsCount=e.requirements.posts_count,i.requirements.postPoints=e.requirements.post_points,i.requirements.reactionsCount=e.requirements.reactions_count),i});remapBadgeValuesVoting=t=>t.map(e=>{let i=new Re;return i.id=e.id,i.enabled=e.enabled,i.label=e.label,i.description=e.description,i.flags=e.flags,e.assets?i.assets.mainImageUrl=e.assets.main_image_url:i.assets=e.assets,e.requirements&&(i.requirements.points=e.requirements.points,i.requirements.voteCount=e.requirements.vote_count,i.requirements.entityId=e.requirements.entity_id,i.requirements.entityType=e.requirements.entity_type),i});remapBadgeValues=t=>t.map(e=>{let i=new ar;return i.id=e.id,i.label=e.label,i.enabled=e.enabled,e.assets?i.assets.mainImageUrl=e.assets.main_image_url:i.assets=e.assets,i.requirements=this.remapRequirements(e.requirements),i});remapRequirements=t=>{let e=new Lt;return e.points=t.points,e.gameParticipationCount=t.game_participation_count,e.entityId=t.entity_id,e.entityType=t.entity_type,e.predictionsMade=t.predictions_made,e.correctPredictions=t.correct_predictions,e};remapUserDataConfig=t=>{let e=new Ga;return e.storeIp=t.store_ip,e.storeDeviceId=t.store_device_id,e.storeAgent=t.store_agent,e};remapGeneralBadgeValues=t=>t.map(e=>{let i=new rr;return i.id=e.id,i.label=e.label,i.enabled=e.enabled,e.assets?i.assets.mainImageUrl=e.assets.main_image_url:i.assets=e.assets,i.requirements=this.remapGeneralRequirements(e.requirements),i});remapGeneralRequirements=t=>{let e=new Se;return e.points=t.points,e.gameParticipationCount=t.game_participation_count,e.entityId=t.entity_id,e.entityType=t.entity_type,e.predictionsMade=t.predictions_made,e.correctPredictions=t.correct_predictions,e.postPoints=t.post_points,e.postsCount=t.posts_count,e.reactionsCount=t.reactions_count,e.totalDiscussionPoints=t.total_discussion_points,e};remapMultipliers=t=>{let e=new sr;return e.captain=t.captain,e.viceCaptain=t.vice_captain,e}};var nr=class{entityId;entityType;entityModel=null};var Up=class{totalItems=0};var Vp=class{id=null;label=null};var Hp=class{type=null;id=null;label=null};var lr=class{id=null;source=null;type=null};var w=class{limit;startAfter;constructor(t){this.limit=t&&t.limit?t.limit:null,this.startAfter=t&&t.startAfter?t.startAfter:null}constructMainFiltersUrl(){let t="";return this.limit&&(t+="&",t+=`limit=${this.limit}`),this.startAfter&&(t+="&",t+=`start_after=${this.startAfter}`),t}};var pr=class extends w{};var $p=class{fixtures=[];tiebreaker};var Gc=(i=>(i.PARTICIPANT_ONE="PARTICIPANT_ONE",i.PARTICIPANT_TWO="PARTICIPANT_TWO",i.DRAW="DRAW",i))(Gc||{});var cr=class{matchId="";participantOne="";participantTwo="";winner="PARTICIPANT_ONE"};var ht=(o=>(o.OPEN="OPEN",o.LIVE="LIVE",o.PENDING="PENDING",o.CANCELED="CANCELED",o.CLOSED="CLOSED",o.SETTLED="SETTLED",o))(ht||{});var ur=class extends w{status=null;sortOrder=null;gameIds=null;constructor(t){super(t),this.status=t?.status||null,this.sortOrder=t?.sortOrder||null,this.gameIds=t?.gameIds||null}constructMainFiltersUrl(){let t=super.constructMainFiltersUrl();return this.status&&Object.values(ht).includes(this.status)?(t+="&",t+=`status=${this.status}`):this.status!==null&&console.warn(`The filter 'status' has the following INVALID value: ${this.status}. It will be not passed as a query param in the URL. For more information visit our documentation.`),this.sortOrder&&(this.sortOrder==="asc"||this.sortOrder==="desc"||this.sortOrder==="ASC"||this.sortOrder==="DESC")?(t+="&",t+=`sort_order=${this.sortOrder}`):this.sortOrder!==null&&console.warn(`The filter 'sortOrder' has the following INVALID value: ${this.sortOrder}. It will be not passed as a query param in the URL. For more information visit our documentation.`),this.gameIds&&Array.isArray(this.gameIds)&&this.gameIds.length>0?(t+="&",t+=`game_ids=${this.gameIds}`):this.gameIds!==null&&console.warn(`The filter 'gameIds' has the following INVALID value: ${this.gameIds}. It will be not passed as a query param in the URL. For more information visit our documentation.`),t}};var dr=class{profileId="";profileModel=null;challengeId="";challengeModel=null;message=""};var Ae=class{name="";description="";invitation_code="";template_id="";users_can_invite_users=!1;administrators=[];scoring_starts_at=""};var mr=class extends Ae{type="ONE_VS_ONE"};var Oe=class{name="";description="";invitation_code="";template_id="";users_can_invite_users=!1;administrators=[];pinned_posts=[];scoring_starts_at=""};var hr=class extends Oe{type="ONE_VS_ONE"};var fr=class{limit=null;page=null;challengeId=null;templateId=null;sortOrder=null;constructor(t){this.limit=t&&t.limit?t.limit:null,this.page=t&&t.page?t.page:null,this.challengeId=t&&t.challengeId?t.challengeId:null,this.templateId=t&&t.templateId?t.templateId:null,this.sortOrder=t&&t.sortOrder?t.sortOrder:null}constructFiltersUrl=()=>{let t="";return this.limit&&(t+=`&limit=${this.limit}`),this.page&&(t+=`&page=${this.page}`),this.challengeId&&(t+=`&league_id=${this.challengeId}`),this.templateId&&(t+=`&template_id=${this.templateId}`),this.sortOrder&&(t+=`&sort_order=${this.sortOrder}`),t}};var gr=class{type="ONE_VS_ONE";userRole=null;constructor(t){this.userRole=t?.userRole||null}constructFiltersUrl=()=>{let t=`&type=${this.type}`;return this.userRole&&(t+=`&user_role=${this.userRole}`),t}};var yr=class{templateId="";templateModel=null;challengeId="";challengeModel=null;position="";points=0;type="challenge"};var br=class{id="";label="";discussionType="LEAGUE";discussionUrl=null;moderationType="USER";postsCount=0;pinnedPosts=[];lastPostId="";status="";deleted=!1;deletedAt="";deletedBy="";customFields=null;context=null;createdAt="";updatedAt=""};var Wp=class{content="";replyId="";discussionLabel="";discussionUrl="";userNickname="";context=null};var Le=class{id="";userId="";discussionId="";content="";repliesCount=0;replyId="";anonymousNickname="";reactions=[];reactionsCount=0;reports=[];reportsCount=0;versions=null;privatePost=!1;deleted=!1;deletedAt="";deletedBy="";moderated=!1;moderatedAt="";moderatedBy="";moderatedReason="";createdAt="";updatedAt=""};var Mr=class extends Le{userModel=null};var Ir=class{content="";reply_id="";discussion_label="";discussion_url="";anonymous_nickname="";context=null};var wr=class{id="";postsCount=0};var xt=class{pagination={totalItems:0,nextPageStartsAfter:"",lastCommentCreateTimestamp:""}};var _r=class{meta=new xt;data=[]};var Pr=class{meta=new xt;data=[]};var Tr=class{meta=new M;data=[]};var Er=class{type="";userIds=[];reactionCount=0};var Rr=class{userId=null;reason="AD";reasonDetails=null};var Fr=class{updatedAt="";content=""};var rd=["CREATED_AT_ASC","CREATED_AT_DESC","POSTS_COUNT_ASC","POSTS_COUNT_DESC"],od=["ACTIVE","INACTIVE"],Sr=class extends w{discussionIds;label;discussionUrl;fromDate;toDate;fromCount;toCount;sort;status;skipDeleted;constructor(t){super(t),this.discussionIds=t&&t.discussionIds?t.discussionIds:null,this.label=t&&t.label?t.label:null,this.discussionUrl=t&&t.discussionUrl?t.discussionUrl:null,this.fromDate=t&&t.fromDate?t.fromDate:null,this.toDate=t&&t.toDate?t.toDate:null,this.fromCount=t&&t.fromCount?t.fromCount:null,this.toCount=t&&t.toCount?t.toCount:null,this.sort=t&&t.sort?t.sort:null,this.status=t?.status||null,this.skipDeleted=t&&t.skipDeleted!==void 0?t.skipDeleted:null}constructMainFiltersUrl(){let t=super.constructMainFiltersUrl();return this.discussionIds!==null&&(t+=`&discussion_ids=${this.discussionIds.join(",")}`),this.label!==null&&(t+=`&label=${this.label}`),this.discussionUrl!==null&&(t+=`&discussion_url=${this.discussionUrl}`),this.fromDate!==null&&(t+=`&from_date=${this.fromDate}`),this.toDate!==null&&(t+=`&to_date=${this.toDate}`),this.fromCount!==null&&(t+=`&from_count=${this.fromCount}`),this.toCount!==null&&(t+=`&to_count=${this.toCount}`),this.sort&&rd.includes(this.sort.toUpperCase())&&(t+=`&sort=${this.sort.toUpperCase()}`),this.status&&od.includes(this.status.toUpperCase())&&(t+=`&status=${this.status.toUpperCase()}`),this.skipDeleted!==null&&(t+=`&skip_deleted=${this.skipDeleted}`),t}};var qt=class extends w{skipDeleted;skipModerated;sort;constructor(t){super(t),this.skipDeleted=t&&t.skipDeleted!==void 0?t.skipDeleted:null,this.skipModerated=t&&t.skipModerated!==void 0?t.skipModerated:null,this.sort=t&&t.sort?t.sort.toLocaleLowerCase():null}constructMainFiltersUrl(){let t=super.constructMainFiltersUrl();return this.skipDeleted!==null&&(t+=`&skip_deleted=${this.skipDeleted}`),this.skipModerated!==null&&(t+=`&skip_moderated=${this.skipModerated}`),this.sort&&(t+=`&sort=${this.sort}`),t}};var vr=class extends w{fromDate;toDate;entityIds;entityType;contentType;constructor(t){super(t),this.fromDate=t?.fromDate||null,this.toDate=t?.toDate||null,this.entityIds=t?.entityIds||null,this.entityType=t?.entityType||null,this.contentType=t?.contentType||null}constructMainFiltersUrl(){let t=super.constructMainFiltersUrl();return this.fromDate!==null&&(t+=`&from_date=${this.fromDate}`),this.toDate!==null&&(t+=`&to_date=${this.toDate}`),this.entityIds!==null&&this.entityIds.length>0&&(t+=`&entity_ids=${this.entityIds}`),this.contentType!==null&&(t+=`&content_type=${this.contentType}`),t}};var Cr=class extends w{status=null;sortOrder=null;gameIds=null;constructor(t){super(t),this.status=t?.status||null,this.sortOrder=t?.sortOrder||null,this.gameIds=t?.gameIds||null}constructMainFiltersUrl(){let t=super.constructMainFiltersUrl();return this.status&&Object.values(ht).includes(this.status)?(t+="&",t+=`status=${this.status}`):(this.status!==null||this.status!==void 0)&&console.warn(`The filter 'status' has the following INVALID value: ${this.status}. It will be not passed as a query param in the URL. For more information visit our documentation.`),this.sortOrder&&(this.sortOrder==="asc"||this.sortOrder==="desc"||this.sortOrder==="ASC"||this.sortOrder==="DESC")?(t+="&",t+=`sort_order=${this.sortOrder}`):(this.sortOrder!==null||this.sortOrder!==void 0)&&console.warn(`The filter 'sortOrder' has the following INVALID value: ${this.sortOrder}. It will be not passed as a query param in the URL. For more information visit our documentation.`),this.gameIds&&Array.isArray(this.gameIds)&&this.gameIds.length>0?(t+="&",t+=`game_ids=${this.gameIds}`):(this.gameIds!==null||this.gameIds!==void 0)&&console.warn(`The filter 'gameIds' has the following INVALID value: ${this.gameIds}. It will be not passed as a query param in the URL. For more information visit our documentation.`),t}};var Ar=class extends w{};var Or=class extends w{};var qp=class{id="";predictionType;prediction};var zp=class{fixtures=[];tiebreaker};var Qp=class{options=[]};var Kp=class{min=0;max=0};var Lr=class{templateId=null;playerId=null};var xr=class{filters=new Lr};var Dr=class{meta=new xr;data=[]};var Br=class{key=null;label=null;value=null};var Nr=class{templateId=null};var kr=class{filters=new Nr};var Gr=class{meta=new kr;data=[]};var xe=class{template_id=null;group_id=null;fixtures=[]};var De=class{total=null;minutesPlayed=null;yellowCards=null;redCards=null;goals=null;penaltyGoals=null;ownGoals=null;assists=null;cleanSheets=null;shots=null;shotsOn=null;offsides=null;foulsCommitted=null;penaltyCommitted=null;penaltyWon=null;penaltyMissed=null;tackles=null;concededGoals=null;caughtBall=null;saves=null};var Be=class{minutesPlayed=null;yellowCards=null;redCards=null;goals=null;penaltyGoals=null;penaltyCommitted=null;penaltyWon=null;penaltyMissed=null;penaltySaved=null;penaltyReceived=null;ownGoals=null;assists=null;cleanSheets=null;shots=null;shotsOn=null;shotsBlocked=null;offsides=null;foulsCommitted=null;foulsWon=null;tackles=null;tacklesBlocks=null;tacklesInterceptions=null;concededGoals=null;caughtBall=null;saves=null;passes=null;crosses=null;interceptions=null;keyPasses=null;passesAccuracy=null;duels=null;duelsWon=null;dribblesAttempts=null;dribblesSuccess=null;dribblesPast=null};var Ur=class{matchId=null;matchModel=null;points=new De;stats=new Be};var Vr=class{playerId=null;playerModel=null;points=null;rank=null};var Hr=class{id="";country=null;gender="";assets=null;type="";name=""};var $r=class{id="";country=null;gender="";assets=null;type="";name="";participants=[]};var Wr=class{id="";alias="";countryCode="";assets=null;name=""};var Y=class{type=null;subType=null};var qr=class{id="";kickoffAt="";finishedAt="";updatedAt="";availableMarkets=null;homeTeam=null;awayTeam=null;isDeleted=!1;undecided=!1;lineupsConfirmed=!1;startedAt="";minute="";scores=null;context={competition:null};status=new Y};var zr=class{id="";kickoffAt="";finishedAt="";updatedAt="";availableMarkets=null;isDeleted=!1;undecided=!1;homeTeam=null;awayTeam=null;lineupsConfirmed=!1;startedAt="";minute="";scores=null;stats=null;playerStats=[];context={competition:null};timeline=[];status=new Y;lineups=null};var ft=class{countryIds=null;competitionIds=null;matchIds=null;status=null;teamIds=null;fromDate=null;toDate=null;limit=null;page=null;sortField=null;sortOrder=null;constructor(t){this.countryIds=t.countryIds?t.countryIds:null,this.competitionIds=t.competitionIds?t.competitionIds:null,this.matchIds=t.matchIds?t.matchIds:null,this.status=t.status?t.status:null,this.teamIds=t.teamIds?t.teamIds:null,this.fromDate=t.fromDate?t.fromDate:null,this.toDate=t.toDate?t.toDate:null,this.limit=t.limit?t.limit:null,this.page=t.page?t.page:null,this.sortField=t.sortField?t.sortField:null,this.sortOrder=t.sortOrder?t.sortOrder:null}constructFilterUrl=t=>{let e="";return this.countryIds&&(e=e+"&",e=e+`countries=${this.countryIds.join(",")}`),this.competitionIds&&this.competitionIds.length>0&&(e=e+"&",e=e+`competitions=${this.competitionIds.join(",")}`),this.matchIds&&this.matchIds.length>0&&(e=e+"&",e=e+`matches=${this.matchIds.join(",")}`),this.status&&(e=e+"&",e=e+`status=${this.status}`),this.teamIds&&this.teamIds.length>0&&(e=e+"&",e=e+`teams=${this.teamIds.join(",")}`),this.fromDate&&(e=e+"&",e=e+`from_date=${this.fromDate}`),this.toDate&&(e=e+"&",e=e+`to_date=${this.toDate}`),this.limit&&!t&&(e=e+"&",e=e+`limit=${this.limit}`),this.page&&!t&&(e=e+"&",e=e+`page=${this.page}`),this.sortField&&(e=e+"&",e=e+`sort_field=${this.sortField}`),this.sortOrder&&(e=e+"&",e=e+`sort_order=${this.sortOrder}`),e}};var Qr=class{corners=null;cornersFirstHalf=null;cornersSecondHalf=null;cornersExtraTime=null;crosses=null;crossesFirstHalf=null;crossesSecondHalf=null;crossesExtraTime=null;offside=null;offsideFirstHalf=null;offsideSecondHalf=null;offsideExtraTime=null;shotsOn=null;shotsOnFirstHalf=null;shotsOnSecondHalf=null;shotsOnExtraTime=null;throwIn=null;throwInFirstHalf=null;throwInSecondHalf=null;throwInExtraTime=null;redCards=null;redCardsFirstHalf=null;redCardsSecondHalf=null;redCardsExtraTime=null;shotsOff=null;shotsOffFirstHalf=null;shotsOffSecondHalf=null;shotsOffExtraTime=null;goalKicks=null;goalKicksFirstHalf=null;goalKicksSecondHalf=null;goalKicksExtraTime=null;possession=null;possessionFirstHalf=null;possessionSecondHalf=null;possessionExtraTime=null;treatments=null;treatmentsFirstHalf=null;treatmentsSecondHalf=null;treatmentsExtraTime=null;yellowCards=null;yellowCardsFirstHalf=null;yellowCardsSecondHalf=null;yellowCardsExtraTime=null;shotsBlocked=null;shotsBlockedFirstHalf=null;shotsBlockedSecondHalf=null;shotsBlockedExtraTime=null;substitutions=null;substitutionsFirstHalf=null;substitutionsSecondHalf=null;substitutionsExtraTime=null;counterAttacks=null;counterAttacksFirstHalf=null;counterAttacksSecondHalf=null;counterAttacksExtraTime=null;foulsCommitted=null;foulsCommittedFirstHalf=null;foulsCommittedSecondHalf=null;foulsCommittedExtraTime=null};var Kr=class{ftScore=null;htScore=null;aetScore=null;aggScore=null;penScore=null};var Ne=class{homeTeam={players:[]};awayTeam={players:[]}};var jr=class{minute="";type="";teamId="";player=null;relatedPlayer=null;updatedAt=""};var Yr=class{playerId=null;position=null;minutesPlayed=null;yellowCards=null;redCards=null;goals=null;penaltyGoals=null;penaltyCommitted=null;penaltyWon=null;penaltyMissed=null;penaltySaved=null;penaltyReceived=null;ownGoals=null;assists=null;cleanSheets=null;shots=null;shotsOn=null;shotsBlocked=null;offsides=null;foulsCommitted=null;foulsWon=null;tackles=null;tacklesBlocks=null;tacklesInterceptions=null;concededGoals=null;caughtBall=null;saves=null;passes=null;crosses=null;interceptions=null;keyPasses=null;passesAccuracy=null;duels=null;duelsWon=null;dribblesAttempts=null;dribblesSuccess=null;dribblesPast=null;updatedAt=null};var Xr=class{id="";country=null;birthDate="";firstName="";lastName="";name="";position="";assets=null;isDeleted=!1;teams=[]};var Jr=class{id="";country=null;birthDate="";firstName="";lastName="";name="";position="";assets=null;isDeleted=!1;competitions=[];teams=[]};var Zr=class{id="";startDate="";endDate="";shirtNumber;loan=!1;position="";country=null;name="";assets=null;birthDate=""};var to=class{id="";country=null;birthDate="";firstName="";lastName="";name="";position="";assets=null};var _i=class{countryId=null;scope=null;name=null;playerIds=null;limit=null;page=null;sortField=null;sortOrder=null;constructor(t){this.countryId=t.countryId?t.countryId:null,this.scope=t.scope?t.scope:null,this.name=t.name?t.name:null,this.playerIds=t.playerIds?t.playerIds:null,this.limit=t.limit?t.limit:null,this.page=t.page?t.page:null,this.sortField=t.sortField?t.sortField:null,this.sortOrder=t.sortOrder?t.sortOrder:null}constructFilterUrl=()=>{let t="";return this.countryId&&(t=t+"&",t=t+`country_id=${this.countryId}`),this.scope&&this.scope.length>0&&(t=t+"&",t=t+`scope=${this.scope.join(",")}`),this.name&&(t=t+"&",t=t+`name=${this.name}`),this.playerIds&&this.playerIds.length>0&&(t=t+"&",t=t+`player_ids=${this.playerIds.join(",")}`),this.limit&&(t=t+"&",t=t+`limit=${this.limit}`),this.page&&(t=t+"&",t=t+`page=${this.page}`),this.sortField&&(t=t+"&",t=t+`sort_field=${this.sortField}`),this.sortOrder&&(t=t+"&",t=t+`sort_order=${this.sortOrder}`),t}};var jp=class{headshot=null};var Yp=class{id=null;name=null;country=null};var eo=class{id="";name="";position="";shirtNumber;assets=null;type=""};var io=class{id="";country=null;gender="";assets=null;name="";code="";national=!1;undecided=!1;fullName="";shortName="";isDeleted=!1};var ao=class{primary=null;secondary=null;tertiary=null};var ro=class{id="";country=null;gender="";assets=null;name="";competitions=[];code="";national=!1;fullName="";shortName="";isDeleted=!1;undecided=!1;colors=new ao;squad=[]};var Xp=class{teamId=null;matches=[]};var oo=class{teams=null;players=null;competitions=null};var so=class{entities=null;query=null;scope=null;constructor(t){this.entities=t.entities?t.entities:null,this.query=t.query?t.query:null,this.scope=t.scope?t.scope:null}constructFilterUrl=()=>{let t="";return this.entities&&(t=t+"&",t=t+`entities=${this.entities.join(",")}`),this.query&&(t=t+"&",t=t+`q=${this.query}`),this.scope&&(t=t+"&",t=t+`scope=${this.scope.join(",")}`),t}};var zt=class{meta=new k;data=[]};var Jp=class{logo=null};var Zp=class{profile=null;football=null;predictor=null;loyalty=null;topX=null;matchQuiz=null;activity=null;miniGames=null;discussions=null;privateLeagues=null;challenges=null;progress=null;voting=null;fantasy=null;helpers=null;idMapping=null;bracketGame=null;lists=null;standingGame=null;eventGame=null;odds=null;getVersion=null};var tc=class{apiKey;clientId;environment;idSchema;lang;errorHandlingMode;oddClient;cookieToken;authProvider};var X=class{main=null;cover=null;mobile=null};var no=class{colors=null;urls=null;images=null};var lo=class{primaryColor=null;secondaryColor=null;contentColor=null;backgroundColor=null;borderColor=null;additionalColor=null};var po=class{primaryUrl=null;secondaryUrl=null;privacyPolicyUrl=null;termsAndConditionsUrl=null;additionalUrl=null};var co=class{mainLogo=null;mobileLogo=null;backgroundImage=null;mobileBackgroundImage=null;additionalImage=null};var ec=class{preferenceId="";categories=[];source=""};var uo=class{input=null;output=null};var mo=class{meta=new uo;data=[]};var ho=class{limit=null;page=null;constructor(t){this.limit=t&&t.limit?t.limit:null,this.page=t&&t.page?t.page:null}constructFiltersUrl=()=>{let t="";return this.limit&&(t+=`&limit=${this.limit}`),this.page&&(t+=`&page=${this.page}`),t}};var fo=class{general;predictor;topX;matchQuiz};var go=class{predictor;topX;matchQuiz;games;football;classicQuizzes;eitherOr;discussions;potm;poll};var ic=class extends Re{};var ac=class{count=0;breakdown=[]};var rc=class{footballCompetitions;footballTeams;footballPlayers};var yo=class{market;fromDate;toDate;usersCount;minimumPredictions;constructor(t){this.market=t.market?t.market:null,this.fromDate=t.fromDate?t.fromDate:null,this.toDate=t.toDate?t.toDate:null,this.usersCount=t.usersCount?t.usersCount:null,this.minimumPredictions=t.minimumPredictions?t.minimumPredictions:null}constructFiltersUrl(){let t="";return this.market&&(t+="&",t+=`market=${this.market}`),this.fromDate&&(t+="&",t+=`from_date=${this.fromDate}`),this.toDate&&(t+="&",t+=`to_date=${this.toDate}`),this.usersCount&&(t+="&",t+=`users_count=${this.usersCount}`),this.minimumPredictions&&(t+="&",t+=`minimum_predictions=${this.minimumPredictions}`),t}};var bo=class{templateId=null;limit=null;page=null;groupId=null;constructor(t){this.templateId=t?.templateId||null,this.limit=t?.limit||null,this.page=t?.page||null,t?.groupId!==void 0&&console.warn("Warning: groupId property is deprecated and no longer supported by the API. This property will be removed in a future version. Please update your code accordingly.")}constructFiltersUrl(){let t="";return this.templateId&&(t+=`&template_id=${this.templateId}`),this.limit&&(t+=`&limit=${this.limit}`),this.page&&(t+=`&page=${this.page}`),t}};var Mo=class{groupId=null;limit=null;page=null;constructor(t){this.groupId=t.groupId?t.groupId:null,this.limit=t.limit?t.limit:null,this.page=t.page?t.page:null}constructFiltersUrl(){let t="";return this.groupId&&(t+="&",t+=`group_id=${this.groupId}`),this.limit&&(t+="&",t+=`limit=${this.limit}`),this.page&&(t+="&",t+=`page=${this.page}`),t}};var Io=class{sortOrder=null;rankType=null;leaderboardIds=null;gameType=null;limit=null;page=null;groupId=null;constructor(t){this.sortOrder=t.sortOrder,this.rankType=t.rankType,this.leaderboardIds=t.leaderboardIds,this.gameType=t.type&&t.type.toLowerCase()==="game"?t.gameType:null,this.limit=t.limit,this.page=t.page,t?.groupId!==void 0&&console.warn("Warning: groupId property is deprecated and no longer supported by the API. This property will be removed in a future version. Please update your code accordingly.")}constructFiltersUrl=()=>{let t="";return this.sortOrder&&(t+="&",t+=`sort_order=${this.sortOrder}`),this.rankType&&(t+="&",t+=`rank_type=${this.rankType}`),this.leaderboardIds&&(t+="&",t+=`type_ids=${this.leaderboardIds.join(",")}`),this.gameType&&(t+="&",t+=`game_type=${this.gameType}`),this.limit&&(t+="&",t+=`limit=${this.limit}`),this.page&&(t+="&",t+=`page=${this.page}`),t}};var wo=class{flags=null;status=null;type=null;activeFrom=null;activeTo=null;createdFrom=null;createdTo=null;updatedFrom=null;updatedTo=null;constructor(t){this.flags=t.flags?t.flags:null,this.status=t.status?t.status:null,this.type=t.type?t.type:null,this.activeFrom=t.activeFrom?t.activeFrom:null,this.activeTo=t.activeTo?t.activeTo:null,this.createdFrom=t.createdFrom?t.createdFrom:null,this.createdTo=t.createdTo?t.createdTo:null,this.updatedFrom=t.updatedFrom?t.updatedFrom:null,this.updatedTo=t.updatedTo?t.updatedTo:null}constructFiltersUrl(){let t="";return this.flags&&this.flags.length>0&&(t+="&",t+=`flags=${this.flags.join(",")}`),this.status&&(t+="&",t+=`status=${this.status}`),this.type&&(t+="&",t+=`type=${this.type}`),this.activeFrom&&(t+="&",t+=`active_from=${this.activeFrom}`),this.activeTo&&(t+="&",t+=`active_to=${this.activeTo}`),this.createdFrom&&(t+="&",t+=`created_from=${this.createdFrom}`),this.createdTo&&(t+="&",t+=`created_to=${this.createdTo}`),this.updatedFrom&&(t+="&",t+=`updated_from=${this.updatedFrom}`),this.updatedTo&&(t+="&",t+=`updated_to=${this.updatedTo}`),t}};var _o=class{position=null;points=null;predictionsMade=null;profileId=null;profileModel=null;successRatePercent=null};var ke=class{templateId=null;privateLeagueId=null;fromDate=null;toDate=null;pagination=new j};var oc=class{meta=new ke;data=[]};var Dt=class{rankType=null;fromDate=null;toDate=null;pagination=new j};var sc=class{meta=new Dt;data=[]};var Ge=class{position=null;profileId=null;profileModel=null;points=null;predictionsMade=null};var Po=class{flags="";status="";type="";activeFrom="";activeTo="";createdFrom="";createdTo="";updatedFrom="";updatedTo=""};var To=class{pagination=new j;filters=new Po};var nc=class{id=null;points=null};var lc=class extends Ie{points;alternative;constructor(){super(),delete this.weight}};var Eo=class extends Ge{id=null;rankType=null;model=null;gameType=null};var pc=class{meta=new Dt;data=[]};var Ro=class{groupId;averagePoints;highestPoints};var Bt=class{id=null;name=null;description=null;type=null;fromDate=null;toDate=null;markets=[];teamIds=[];matchIds=[];groups=[];gameIds=[];gameTypes=[];competitionIds=[];excludedProfileIds=[];rules=null;labels=null;customFields=null;branding=null;flags=null;images=new X;status=null;automaticallyChangeStatus=!0;createdAt=null;updatedAt=null;related=null};var Fo=class extends Bt{adContent=null};var So=class{groupId=null;label=null;flags=[];filters=null};var vo=class{fromDate=null;toDate=null;matchIds=[]};var cc=class{enabled=!1;id=null;label=null;points=null};var Co=class{value=null;target=null;playerId=null;playerModel=null;result=null};var Ao=class{matchId=null;matchType=null;market=null;matchModel=null;matchStatus=new Y;prediction=new Co};var Oo=class{gameId=null;results=null;tieBreakers=null};var gt=class{timeTiebreaker=!1};var Pt=class{id=null;title=null;description=null;type=null;status=null;authRequirement=null;outcome=null;predictionsCutoff=null;fixtures=[];tiebreaker=new gt;predictionId=null;participantsCount=0;related=[];excludedProfileIds=null;rules=null;flags=null;points=null;createdAt=null;updatedAt=null;predictionsMadeAt=null;predictionsUpdatedAt=null;images=null;scheduleOpenAt=null;branding=null};var Ue=class{id=null;title=null;alternativeTitle=null;description=null;type=null;images=new X;participationCount=null;questionsCount=null;status=null;language=null;authRequirement=null;flags=null;customFields=null;labels=null;branding=null;related=[];time=null;points=null;scored=!1;maxAttempts=null;averageScore=null;perfectScore=null;adContent=null;context=null;createdAt=null;updatedAt=null};var Ve=class extends w{flags=null;status=null;entityIds=null;entityType=null;sort=null;groupByStatus=null;language=null;constructor(t){super(t),this.flags=t&&t.flags?t.flags:null,this.status=t&&t.status?t.status:null,this.entityIds=t&&t.entityIds?t.entityIds:null,this.entityType=t&&t.entityType?t.entityType:null,this.sort=t&&t.sort?t.sort:null,this.groupByStatus=t&&t.groupByStatus!==void 0?t.groupByStatus:null,this.language=t&&t.language?t.language:null}constructMainFiltersUrl(){let t=super.constructMainFiltersUrl();return this.flags&&this.flags.length>0&&(t+=`&flags=${this.flags.join(",")}`),this.status&&(t+=`&status=${this.status}`),this.entityIds&&this.entityIds.length>0&&(t+=`&entity_ids=${this.entityIds}`),this.sort&&(t+=`&sort=${this.sort}`),this.groupByStatus!==null&&(t+=`&group_by_status=${this.groupByStatus}`),this.language!==null&&(t+=`&language=${this.language}`),t}};var Lo=class extends Ve{classicQuizIds=null;constructor(t){super(t),this.classicQuizIds=t&&t.classicQuizIds?t.classicQuizIds:null}constructMainFiltersUrl(){let t=super.constructMainFiltersUrl();return this.classicQuizIds&&this.classicQuizIds.length>0&&(t+=`&classic_quiz_ids=${this.classicQuizIds.join(",")}`),t}};var xo=class extends Ue{rules=null;questions=[]};var Do=class{questionId=null;question=null;images=null;embedCode=null;explanation=null;options=[]};var Bo=class{optionId=null;option=null;images=null;correct=null};var uc=class{questionId=0;optionId=0};var No=class{classicQuizId=null;userId=null;questions=[];correctOptions=null;personalBest=null;points=null;attempts=null};var ko=class{questionId=null;optionId=null;correct=null;correctOptionId=null};var Go=class extends w{classicQuizIds=null;constructor(t){super(t),this.classicQuizIds=t?.classicQuizIds||null}constructMainFiltersUrl(){let t=super.constructMainFiltersUrl();return this.classicQuizIds&&this.classicQuizIds.length>0&&(t+=`&classic_quiz_ids=${this.classicQuizIds.join(",")}`),t}};var Uo=class{classicQuizId=null;classicQuizModel=null;correct=null;classicQuizQuestions=null;personalBest=null;points=null;answers=[];attempts=0};var dc=class{meta=new M;data=[]};var Vo=class{questionId=null;questionModel=null;wrong=null;correct=null;skipped=null;total=null};var He=class{classicQuizIds=null};var $e=class{limit=null;page=null;constructor(t){this.limit=t?.limit||null,this.page=t?.page||null}constructMainFiltersUrl(){let t="";return this.limit&&(t+=`&limit=${this.limit}`),this.page&&(t+=`&page=${this.page}`),t}};var Ho=class extends $e{classicQuizIds=null;constructor(t){super(t),this.classicQuizIds=t?.classicQuizIds||null}constructMainFiltersUrl(){let t=super.constructMainFiltersUrl();return this.classicQuizIds&&this.classicQuizIds.length>0&&(t+=`&classic_quiz_ids=${this.classicQuizIds.join(",")}`),t}};var We=class{pagination=new j;filters=new He};var $o=class{position=null;profileId=null;profileModel=null;points=null};var Wo=class{position=null;classicQuizId=null;classicQuizModel=null;points=null};var mc=class{meta=new k;data=[]};var hc=class{meta=new We;data=[]};var qe=class{id="";title="";alternativeTitle="";description="";images=new X;flags=[];status="";language="";authRequirement=null;winningCondition="";lives=0;time=0;points=[];customFields=null;branding=null;labels=null;adContent="";context=null;type="";related=[];totalParticipationsCount=0;totalUsersCount=0;finishedParticipationsCount=0;averageStartedParticipationsCount=0;averageFinishedParticipationsCount=0;createdAt="";updatedAt=""};var qo=class extends Ve{eitherOrIds=null;constructor(t){super(t),this.eitherOrIds=t&&t.eitherOrIds?t.eitherOrIds:null}constructMainFiltersUrl(){let t=super.constructMainFiltersUrl();return this.eitherOrIds&&this.eitherOrIds.length>0&&(t+=`&either_or_ids=${this.eitherOrIds.join(",")}`),t}};var zo=class extends qe{rules=""};var Qo=class{correctSteps=0;score=0};var fc=class{meta=new M;data=[]};var Ko=class{eitherOrId="";personalBest=0;betterThan=0};var jo=class{instanceId="";eitherOrId="";gameStartedAt="";currentStep=0;currentStreak=0;remainingSteps=0;currentLives=0;currentPoints=0;personalBest=0;participationCount=0;finishedParticipationsCount=0;steps=[]};var Yo=class{pair="";answer=""};var Xo=class extends Yo{expired=!1;time=0};var Jo=class{main;mobile};var Pi=class{id="";label="";images=new Jo;value=null};var Zo=class{pairId="";userSelection="";correct=null;played=null;timestamp="";optionOne=new Pi;optionTwo=new Pi};var ts=class{rangeStartInclusive=0;rangeEndInclusive=0;totalUsers=0};var es=class{standings=[];breakdown=[]};var is=class{userId="";userModel=null;personalBest=""};var ze=class{content=null;tags=[];campaign=null};var Qe=class{id=null;model=null;source=null;type=null};var as=class{questions=null;correctAnswers=null};var rs=class{id=null;name=null;url=null;assets=[];links=[];branding=null;eventUrls=[];stakesDisclaimer=null;domainName=null};var os=class{backgroundColor=null;textColor=null};var gc=class{appType=null;selectionTemplateUrl=null;eventTemplateUrl=null;homepageUrl=null};var ss=class{logo=null;type=null;transparentBackgroundUrl=null;backgroundColor=null};var ns=class{url=null;appType=null};var Uc=(i=>(i.PRE_EVENT="PRE_EVENT",i.LIVE="LIVE",i.ALL="ALL",i))(Uc||{}),Vc=(e=>(e.ORDINARY_TIME="ORDINARY_TIME",e.FULL_TIME="FULL_TIME",e))(Vc||{}),Hc=(i=>(i.DECIMAL="DECIMAL",i.MONEYLINE="MONEYLINE",i.FRACTIONAL="FRACTIONAL",i))(Hc||{});var $c=(B=>(B.FT_1X2="FT_1X2",B.DOUBLE_CHANCE="DOUBLE_CHANCE",B.HT_FT="HT_FT",B.BOTH_TEAMS_SCORE="BOTH_TEAMS_SCORE",B.CORRECT_SCORE="CORRECT_SCORE",B.PLAYER_SCORE_FIRST_GOAL="PLAYER_SCORE_FIRST_GOAL",B.PLAYER_SCORE="PLAYER_SCORE",B.PLAYER_RED_CARD="PLAYER_RED_CARD",B.PLAYER_YELLOW_CARD="PLAYER_YELLOW_CARD",B.OVER_GOALS_0_5="OVER_GOALS_0_5",B.OVER_GOALS_1_5="OVER_GOALS_1_5",B.OVER_GOALS_2_5="OVER_GOALS_2_5",B.OVER_GOALS_3_5="OVER_GOALS_3_5",B.OVER_GOALS_4_5="OVER_GOALS_4_5",B.OVER_GOALS_5_5="OVER_GOALS_5_5",B))($c||{}),sd={["FT_1X2"]:"1x2",["DOUBLE_CHANCE"]:"DOUBLE_CHANCE",["HT_FT"]:"FIRST_HALF_AND_FINAL_RESULT",["BOTH_TEAMS_SCORE"]:"BOTH_TO_SCORE",["CORRECT_SCORE"]:"CORRECT_SCORE",["PLAYER_SCORE_FIRST_GOAL"]:"FIRST_PLAYER_TO_SCORE",["PLAYER_SCORE"]:"PLAYER_TO_SCORE_DURING_GAME",["PLAYER_RED_CARD"]:"PLAYER_TO_RECEIVE_CARD",["PLAYER_YELLOW_CARD"]:"PLAYER_TO_RECEIVE_CARD"},ls=class{oddType="PRE_EVENT";scopeType="ORDINARY_TIME";oddFormat="DECIMAL";marketTypes=["FT_1X2"];constructor(t){this.validateFilters(t)}constructFiltersUrl(){let t=this.marketTypes.map(e=>this.mapToSportal365Market(e));return`&odd_type=${this.oddType}&scope_type=${this.scopeType}&odd_format=${this.oddFormat}&market_types=${t.join(",")}`}validateFilters(t){let e=Object.values(Uc),i=Object.values(Vc),a=Object.values(Hc),r=Object.values($c);t?.oddType&&(e.includes(t.oddType)?this.oddType=t.oddType:console.warn(`The filter "oddType" is NOT valid and therefore it will be set to PRE_EVENT. The VALID values are : ${e.join(", ")}`)),t?.scopeType&&(i.includes(t.scopeType)?this.scopeType=t.scopeType:console.warn(`The filter "scopeType" is NOT valid and therefore it will be set to ORDINARY_TIME. The VALID values are : ${i.join(", ")}`)),t?.oddFormat&&(a.includes(t.oddFormat)?this.oddFormat=t.oddFormat:console.warn(`The filter "oddFormat" is NOT valid and therefore it will be set to DECIMAL. The VALID values are : ${a.join(", ")}`)),t?.marketTypes&&Array.isArray(t?.marketTypes)&&t?.marketTypes.length>0&&(t.marketTypes.every(o=>r.includes(o))?this.marketTypes=t.marketTypes:console.warn(`The filter "marketTypes" is NOT valid and therefore it will be set to FT_1X2. The VALID values are : ${r.join(", ")}`))}mapToSportal365Market(t){return t.startsWith("OVER_GOALS_")?"OVER_UNDER":sd[t]}};var ps=class{type=null;scope=null;selections=[]};var cs=class{id=null;type=null;name=null;entityType=null};var us=class{id=null;name=null;code=null;value=null;odds=null;urls=[];movement=null;oddsOld=null;entityType=null;additionalInfo=null;providerInfo=null};var ds=class{id=null;name=null;code=null;entityType=null};var ms=class{selectionId=null;eventId=null;marketId=null;competitionId=null};var hs=class{bookmaker=null;type=null;markets=[]};var yc=class{main=null;all=null};var fs=class{value=null;playerId=null;playerModel=null;playerRole};var Ke=class{market=null;matchId=null;matchType=null;matchModel=null;prediction=new fs;result=null};var je=class{settledAt=null;resettledAt=null;status=null;outcome=null;points=0};var rt=class{value=!1};var gs=class{matchId=null;market="BOTH_TEAMS_SCORE";matchType="FOOTBALL";prediction=null;constructor(t,e){this.matchId=t,this.prediction=new rt,this.prediction.value=e}};var ys=class{value};var bs=class{matchId=null;market="CORNERS_MATCH";matchType="FOOTBALL";prediction=null;constructor(t,e){this.matchId=t,this.prediction=new ys,this.prediction.value=e}};var Ms=class{value=null};var Nt=class{matchId=null;market=null;matchType="FOOTBALL";prediction=null;constructor(t,e,i){this.matchId=t,this.market=e,this.prediction=new Ms,this.prediction.value=i}};var Is=class{value=null};var ws=class{matchId=null;market="DOUBLE_CHANCE";matchType="FOOTBALL";prediction=null;constructor(t,e){this.matchId=t,this.prediction=new Is,this.prediction.value=e}};var _s=class{value=null};var Ps=class{matchId=null;market="HT_FT";matchType="FOOTBALL";prediction=null;constructor(t,e){this.matchId=t,this.prediction=new _s,this.prediction.value=e}};var Ts=class{value=null};var Es=class{matchId=null;market=null;matchType="FOOTBALL";prediction=null;constructor(t,e,i){this.matchId=t,this.market=e,this.prediction=new Ts,this.prediction.value=i}};var Ye=class{matchId=null;market=null;matchType="FOOTBALL";prediction=null;constructor(t,e,i){this.matchId=t,this.market=e,this.prediction=new rt,this.prediction.value=i}};var Xe=class{matchId=null;market=null;matchType="FOOTBALL";prediction=null;constructor(t,e,i){this.matchId=t,this.market=e,this.prediction=new rt,this.prediction.value=i}};var Rs=class{matchId=null;market="PENALTY_MATCH";matchType="FOOTBALL";prediction=null;constructor(t,e){this.matchId=t,this.prediction=new rt,this.prediction.value=e}};var Fs=class{value=!1;playerId=null};var ot=class{matchId=null;market=null;matchType="FOOTBALL";prediction=null;constructor(t,e,i,a){this.matchId=t,this.market=e,this.prediction=new Fs,this.prediction.value=i,this.prediction.playerId=a}};var Ss=class{matchId=null;market="RED_CARD_MATCH";matchType="FOOTBALL";prediction=null;constructor(t,e){this.matchId=t,this.prediction=new rt,this.prediction.value=e}};var bc=class{home=null;draw=null;away=null};var Mc=class{score=null;percentage=null};var Je=class{homeGoals=null;awayGoals=null};var vs=class{playerId=null;playerModel=null};var Cs=class{FT_1X2=null;HT_1X2=null;BOTH_TEAMS_SCORE=null;DOUBLE_CHANCE=null;HT_FT=null;RED_CARD_MATCH=null;PENALTY_MATCH=null;CORNERS_MATCH=null;PLAYER_YELLOW_CARD=[];PLAYER_RED_CARD=[];PLAYER_SCORE_FIRST_GOAL=new vs;PLAYER_SCORE=[];PLAYER_SCORE_TWICE=[];PLAYER_SCORE_HATTRICK=[];CORRECT_SCORE=new Je;CORRECT_SCORE_ADVANCED=new Je;CORRECT_SCORE_HT=new Je;OVER_GOALS_0_5=null;OVER_GOALS_1_5=null;OVER_GOALS_2_5=null;OVER_GOALS_3_5=null;OVER_GOALS_4_5=null;OVER_GOALS_5_5=null;OVER_GOALS_6_5=null;OVER_CORNERS_6_5=null;OVER_CORNERS_7_5=null;OVER_CORNERS_8_5=null;OVER_CORNERS_9_5=null;OVER_CORNERS_10_5=null;OVER_CORNERS_11_5=null;OVER_CORNERS_12_5=null;OVER_CORNERS_13_5=null};var x=class{no=0;yes=0};var Ze=class{gameInstanceId=null;fixtures=null};var yt=class{goldenGoal=null};var Ti=class{id=null;gameInstanceId=null;gameType=null;wager=null;totalFixtures=null;settledFixtures=null;userId=null;fixtures=[];status=null;tiebreaker=new yt;points=null;templateId=null;groupId=null;profileLastUpdatedAt=null;createdAt=null;updatedAt=null};var Qn=(r=>(r.ACTIVE="ACTIVE",r.WON="WON",r.LOST="LOST",r.PARTIALLY_WON="PARTIALLY_WON",r.CANCELED="CANCELED",r))(Qn||{}),Wc=["WON","LOST","PARTIALLY_WON","CANCELED"];var V=class{limit=null;startAfter=null;status=null;type=null;matchIds=null;gameIds=null;constructor(t){this.limit=t?.limit||null,this.startAfter=t?.startAfter||null,this.status=t?.status||null,this.type=t?.type||null,this.matchIds=t?.matchIds||null,this.gameIds=t?.gameIds||null}constructFiltersUrl=()=>{let t="",e=!1;return this.status&&(e=Object.values(Qn).some(i=>this.status.includes(i))),this.limit&&(t+="&",t+=`limit=${this.limit}`),this.startAfter&&(t+="&",t+=`start_after=${this.startAfter}`),this.status&&e&&(t+="&",t+=`status=${this.status.join(",")}`),this.type&&(t+="&",t+=`game_types=${this.type}`),this.matchIds&&this.matchIds.length>0&&(t+="&",t+=`match_ids=${this.matchIds.join(",")}`),this.gameIds&&this.gameIds.length>0&&(t+="&",t+=`game_ids=${this.gameIds.join(",")}`),t}};var As=class{fullTimeOneXTwo={};halfTimeOneXTwo={};bothTeamsScore=new x;doubleChance={};halfTimeFullTime={};playerScore={};playerYellowCard={};playerRedCard={};redCardMatch=new x;penaltyMatch=new x;playerScoreFirstGoal={};cornersMatch={};correctScore={};correctScoreHalfTime={};correctScoreAdvanced={};playerScoreHattrick={};playerScoreTwice={};overZeroPointFiveGoals=new x;overOnePointFiveGoals=new x;overTwoPointFiveGoals=new x;overThreePointFiveGoals=new x;overFourPointFiveGoals=new x;overFivePointFiveGoals=new x;overSixPointFiveGoals=new x;overSixPointFiveCorners=new x;overSevenPointFiveCorners=new x;overEightPointFiveCorners=new x;overNinePointFiveCorners=new x;overTenPointFiveCorners=new x;overElevenPointFiveCorners=new x;overTwelvePointFiveCorners=new x;overThirteenPointFiveCorners=new x};var Os=class{matchId=null;matchType=null;predictions=null};var Ls=class{profileId="";profileModel=null;leagueId="";leagueModel=null;message=""};var Ic=class{id=null;name=null;model=new Bt};var ti=class{id="";name="";description="";type="";banned=[];invites=[];administrators=[];membersCount=0;invitationCode="";templateId="";templateModel=null;pastTemplates=[];usersCanInviteUsers=!1;scoringStartsAt="";pinnedPosts=[]};var xs=class extends ti{members=[]};var wc=class{name="";description="";invitationCode="";templateId="";usersCanInviteUsers=!1;administrators=[];scoringStartsAt=""};var _c=class{name="";description="";invitationCode="";templateId="";usersCanInviteUsers=!1;administrators=[];pinnedPosts=[];scoringStartsAt=""};var Ds=class{predictionId=null;predictionModel=null;profileId=null;profileModel=null};var Pc=class{meta=new k;data=[]};var Tc=class{meta=new M;data=[]};var ei=class extends w{type=null;constructor(t){super(t),this.type=t&&t.type?t.type:null}constructMainFiltersUrl=()=>{let t=super.constructMainFiltersUrl();return this.type&&(t+=`&type=${this.type}`),t}};var Bs=class{type="PRIVATE";userRole=null;constructor(t){this.userRole=t?.userRole||null}constructFiltersUrl=()=>{let t=`&type=${this.type}`;return this.userRole&&(t+=`&user_role=${this.userRole}`),t}};var Ns=class{limit=null;page=null;leagueId=null;templateId=null;sortOrder=null;constructor(t){this.limit=t&&t.limit?t.limit:null,this.page=t&&t.page?t.page:null,this.leagueId=t&&t.leagueId?t.leagueId:null,this.templateId=t&&t.templateId?t.templateId:null,this.sortOrder=t&&t.sortOrder?t.sortOrder:null}constructFiltersUrl=()=>{let t="";return this.limit&&(t+=`&limit=${this.limit}`),this.page&&(t+=`&page=${this.page}`),this.leagueId&&(t+=`&league_id=${this.leagueId}`),this.templateId&&(t+=`&template_id=${this.templateId}`),this.sortOrder&&(t+=`&sort_order=${this.sortOrder}`),t}};var ii=class extends w{reportsCount=null;constructor(t){super(t),this.reportsCount=t.reportsCount?t.reportsCount:null}constructMainFiltersUrl=()=>{let t=super.constructMainFiltersUrl();return this.reportsCount&&(t+=`&reports_count=${this.reportsCount}`),t}};var ai=class{limit=null;page=null;profileIds=null;constructor(t){this.limit=t&&t.limit?t.limit:null,this.page=t&&t.page?t.page:null,this.profileIds=t&&t.profileIds?t.leagueId:null}constructFiltersUrl=()=>{let t="";return this.limit&&(t+=`&limit=${this.limit}`),this.page&&(t+=`&page=${this.page}`),this.profileIds&&(t+=`&profile_ids=${this.profileIds.join(",")}`),t}};var ks=class{templateId="";templateModel=null;privateLeagueId="";privateLeagueModel=null;position="";points=0;type="private_league"};var Gs=class extends Ae{type="PRIVATE"};var Us=class extends Oe{type="PRIVATE"};var Vs=class{id="";source="";type="";favourite=!1};var Hs=class extends Vs{model=null};var Ec=class{firstName=null;lastName=null;fullName=null;email=null;gender=null;country=null;phoneCountryCode=null;phoneNumber=null;campaignId=null;campaignName=null;contentType=null;contentId=null;contentName=null;customFields=null};var $s=class extends w{status=null;sortOrder=null;gameIds=null;constructor(t){super(t),this.status=t?.status||null,this.sortOrder=t?.sortOrder||null,this.gameIds=t?.gameIds||null}constructMainFiltersUrl(){let t=super.constructMainFiltersUrl();return this.status&&Object.values(ht).includes(this.status)?(t+="&",t+=`status=${this.status}`):this.status!==null&&console.warn(`The filter 'status' has the following INVALID value: ${this.status}. It will be not passed as a query param in the URL. For more information visit our documentation.`),this.sortOrder&&(this.sortOrder==="asc"||this.sortOrder==="desc"||this.sortOrder==="ASC"||this.sortOrder==="DESC")?(t+="&",t+=`sort_order=${this.sortOrder}`):this.sortOrder!==null&&console.warn(`The filter 'sortOrder' has the following INVALID value: ${this.sortOrder}. It will be not passed as a query param in the URL. For more information visit our documentation.`),this.gameIds&&Array.isArray(this.gameIds)&&this.gameIds.length>0?(t+="&",t+=`game_ids=${this.gameIds.join(",")}`):this.gameIds!==null&&console.warn(`The filter 'gameIds' has the following INVALID value: ${this.gameIds}. It will be not passed as a query param in the URL. For more information visit our documentation.`),t}};var Ws=class extends w{};var qs=class{matchId=null;matchType=null;market=null;matchModel=null;matchStatus=new Y};var zs=class{value=null;result=null};var Qs=class{matchId=null;matchType=null;market=null;matchModel=null;matchStatus=new Y;prediction=new zs};var Tt=class{id=null;title=null;description=null;type=null;status=null;authRequirement=null;scheduleOpenAt=null;predictionsCutoff=null;fixtures=[];tiebreaker=new gt;participantsCount=0;related=[];excludedProfileIds=null;rules=null;labels=null;customFields=null;branding=null;flags=null;images=new X;createdAt=null;updatedAt=null};var ri=class extends Tt{adContent=null};var Qt=class{userId=null;points=null;results=[];tiebreaker=null};var Ks=class{matchId=null;matchModel=null;outcome=null};var st=class extends w{status=null;type=null;gameIds=null;sortOrder=null;constructor(t){super(t),this.status=t?.status||null,this.type=t?.type||null,this.gameIds=t?.gameIds||null,this.sortOrder=t?.sortOrder||null}constructFiltersUrl=()=>{let t=super.constructMainFiltersUrl();return this.status&&Object.values(ht).includes(this.status)&&(t+="&",t+=`status=${this.status}`),this.type&&(t+="&",t+=`type=${this.type}`),this.gameIds&&this.gameIds.length>0&&(t+="&",t+=`game_ids=${this.gameIds.join(",")}`),this.sortOrder&&(t+="&",t+=`sort_order=${this.sortOrder}`),t}};var kt=class{id=null;title=null;description=null;type=null;status=null;authRequirement=null;outcome=null;predictionsCutoff=null;fixtures=[];tiebreaker=new gt;predictionId=null;participantsCount=0;related=[];excludedProfileIds=null;rules=null;flags=null;points=null;createdAt=null;updatedAt=null;predictionsMadeAt=null;predictionsUpdatedAt=null;scheduleOpenAt=null;images=null;predictionTiebreaker=new yt;branding=null};var js=class{contestId="";contestType="GAME";contestModel=null;description="";userList=[]};var Ys=class{position="";profileId="";profileModel=null;note="";tags=[]};var oi=class{gameInstanceId=null;fixtures=[];tiebreaker=null;constructor(t){this.gameInstanceId=t.gameInstanceId,t.fixtures.forEach(e=>this.fixtures.push(new Nt(e.matchId,e.market,e.prediction.value))),this.tiebreaker=t.tiebreaker?t.tiebreaker:null}};var si=class extends w{flags=null;status=null;entityIds=null;entityType=null;pollIds=null;sortOrder=null;minVotes=null;language=null;constructor(t){super(t),this.flags=t?.flags||null,this.status=t?.status||null,this.entityIds=t?.entityIds||null,this.entityType=t?.entityType||null,this.pollIds=t?.pollIds||null,this.sortOrder=t?.sortOrder||null,this.minVotes=t&&t.minVotes!==void 0?t.minVotes:null,this.language=t?.language||null}constructMainFiltersUrl(){let t=super.constructMainFiltersUrl();return this.flags&&this.flags.length>0&&(t+=`&flags=${this.flags.join(",")}`),this.status&&(t+=`&status=${this.status}`),this.entityIds&&this.entityIds.length>0&&(t+=`&entity_ids=${this.entityIds.join(",")}`),this.pollIds&&this.pollIds.length>0&&(t+=`&poll_ids=${this.pollIds.join(",")}`),this.sortOrder&&(t+=`&sort_order=${this.sortOrder}`),this.minVotes&&(t+=`&min_votes=${this.minVotes}`),this.language&&(t+=`&language=${this.language}`),t}};var ni=class{id=null;title=null;alternativeTitle=null;description=null;type=null;images=new X;status=null;language=null;authRequirement=null;totalVotes=null;flags=[];customFields=null;branding=null;embedCode=null;labels=null;adContent=null;context=null;options=[];related=[];preferencesEnabled=!1;multipleChoice=!1;maxMultipleChoiceOptions=null;participationCount=0;createdAt=null;updatedAt=null};var Xs=class extends ni{rules=null};var Js=class{id=null;title=null;description=null;images=new X;votes=null;embedCode=null;preferencesMapping=[]};var Zs=class{preferenceId=""};var li=class{id=null;pollId=null;optionId=null;optionIds=[];userId=null};var tn=class extends li{pollModel=null;optionModel=null;optionsModels=[]};var en=class{meta=new M;data=[]};var an=class{meta=new M;data=[]};var rn=class extends w{matchIds=null;constructor(t){super(t),this.matchIds=t&&t.matchIds?t.matchIds:null}constructFiltersUrl(){let t=super.constructMainFiltersUrl();return this.matchIds&&this.matchIds.length>0&&(t+="&",t+=`match_ids=${this.matchIds.join(",")}`),t}};var on=class{meta=new M;data=[]};var sn=class{matchId=null;matchModel=null;playerId=null;playerModel=null;createdAt=null};var nn=class{total};var ln=class{meta=new nn;data=[]};var pn=class{teamId=null;teamModel=null;playerId=null;playerModel=null;votes=null;winner=null};var cn=class{meta=new k;data=[]};var Kn=class{remapListContent=t=>{let e=new cn;return e.meta=this.remapMeta(t.meta),e.data=t.data.map(i=>{let a=new nr;return a.entityId=i.entity_id,a.entityType=i.entity_type,a}),e};remapMeta=t=>{let e=new k;return e.pagination.currentPage=t.pagination.current_page,e.pagination.itemsPerPage=t.pagination.items_per_page,e.pagination.totalItems=t.pagination.total_items,e.pagination.numberOfPages=t.pagination.number_of_pages,e}};var W=class extends v{featureConfigRemapper=null;listContentRemapper=null;localStorage=null;clientId=null;constructor(t){super(t,O(t.environment,"client")),this.clientId=t.clientId,this.localStorage=new pt().createLocalCacheInstance(t.idSchema),this.featureConfigRemapper=new zn,this.listContentRemapper=new Kn}getConfig=async t=>{let e=await this.getCachedFeatures();if(!e){let i=`/clients/${this.clientId}/features`,a=this.apiSignInUrl.split("&")[0],r=i+a,o="There was a problem fetching client features from Client API";e=(await this.fetchWithoutAuth(r,o)).data,await this.localStorage.setClientFeatures(e)}switch(t){case"predictor":return this.featureConfigRemapper.remapPredictorConfig(e.predictor);case"topX":return this.featureConfigRemapper.remapTopXConfig(e.top_x);case"matchQuiz":return this.featureConfigRemapper.remapMatchQuizConfig(e.match_quiz);case"loyalty":return this.featureConfigRemapper.remapLoyaltyConfig(e.loyalty);case"discussions":return this.featureConfigRemapper.remapDiscussionsConfig(e.discussions);case"fantasy":return this.featureConfigRemapper.remapFantasyConfig(e.football_fantasy)}};getNewLoyaltyConfig=async t=>{let e=`/clients/${this.clientId}/features`,i=this.apiSignInUrl.split("&")[0],a="There was a problem fetching client features from Client API";if(t){let o=e+i+m(),n=await this.fetchWithoutAuthAdditionalHeaders(o,a,{"x-api-version":"2"});await this.localStorage.setClientFeatures(n.data)}let r=await this.getCachedFeatures();if(!r){let o=e+i;r=(await this.fetchWithoutAuthAdditionalHeaders(o,a,{"x-api-version":"2"})).data,await this.localStorage.setClientFeatures(r)}return this.featureConfigRemapper.remapLoyaltyNewConfig(r.loyalty)};getListContent=async(t,e,i)=>{let a=`/clients/${this.clientId}/lists/${t}/content${this.apiSignInUrl}`;e&&(a+=e.constructFiltersUrl()),g(i)&&(a+=m());let r="There was a problem fetching client list content",o=await this.fetchWithoutAuth(a,r);return this.listContentRemapper.remapListContent(o)};getCachedFeatures=async()=>{let t=await this.getLocalStorageData();if(!(!t||!Object.keys(t).length))return t.predictor.client_id&&t.predictor.client_id!==this.clientId?(await this.localStorage.deleteClientFeatures(),null):t};getLocalStorageData=async()=>{let t=Math.floor(Date.now()/1e3);return await this.localStorage.getExpiration("client","features")>t?await this.localStorage.getClientFeatures():null}};var Et=class{clientHttps=null;errorHandlingMode=null;constructor(t){this.clientHttps=new W(t),this.errorHandlingMode=t.errorHandlingMode}setAvailableMarketsForMatch=async t=>{let{fullCoverageCompetitions:e,markets:i}=await this.clientHttps.getConfig("predictor");if(Array.isArray(t))return t.map(a=>this.setAvailableMarkets(a,e,i));if(typeof t=="object"&&Object.keys(t).length)return this.setAvailableMarkets(t,e,i)};setAvailableMarkets=(t,e,i)=>{let a=t.context.competition?.id;return a&&this.isMatchInCoverageCompetition(a,e)?(t.availableMarkets=i.all,t):(t.availableMarkets=i.main,t)};setMetaDataBatchRequest=(t,e,i)=>{let a=new k;if(a.pagination.totalItems=t,a.pagination.itemsPerPage=e,a.pagination.numberOfPages=t?Math.ceil(t/e):0,a.pagination.currentPage=i,a.pagination.numberOfPages>0&&i>a.pagination.numberOfPages)throw this.errorHandlingMode==="standard"?new h(400,"invalid_page_number","Invalid page number provided. Use number between 1 and max number of pages."):new y(400,"invalid_page_number","Invalid page number provided. Use number between 1 and max number of pages.");return a};finalizeMatchesDataBatchRequest=(t,e)=>{t=t.sort((a,r)=>new Date(a.kickoffAt).getTime()-new Date(r.kickoffAt).getTime());let i=e.limit||20;if(e.page){let a=e.page>1?i*(e.page-1):0;t=t.slice(a,a+i)}return!e.page&&t.length>i&&(t=t.slice(0,i)),t};isMatchInCoverageCompetition=(t,e)=>{let i=!1;return e.includes(t)&&(i=!0),i}};var jn=class{footballService=null;https=null;idMapping=null;constructor(t,e,i){this.idMapping=i,this.https=e,this.footballService=new Et(t)}getTeamsIdMapping=async(t,e)=>{try{let i=!1;if(t){if(t=new wi(t),t.countryId){let r=await this.idMapping.getEntityIdsBySchemaId([`${t.countryId}`],"country","native");r.country.length===0&&(i=!0),t.countryId=r.country[0]}if(t.scope){let r=await this.idMapping.getEntityIdsBySchemaId(t.scope,"competition","native");r.competition.length===0&&(i=!0),t.scope=r.competition}if(t.teamIds){let r=await this.idMapping.getEntityIdsBySchemaId(t.teamIds,"team","native");r.team.length===0&&(i=!0),t.teamIds=r.team}}if(i)return[];let a=await this.getTeams(t,e);return a.data=await this.idMapping.remapEntities(a.data,"team"),a}catch(i){throw console.warn("There was a problem browsing all teams",i),i}};getTeamsMapWithNativeIds=async t=>{let e=new Map,i=t.length,a=new wi({teamIds:t,limit:i}),{data:r}=await this.getTeams(a);r.sort((l,p)=>l.id.localeCompare(p.id));let o=Cp(t),n=await this.idMapping.remapEntities(r,"team");return o.forEach((l,p)=>e.set(l,n[p])),e};getTeams=async(t,e)=>{try{return e=e||!1,await this.https.getTeams(t,e)}catch(i){throw console.warn("There was a problem retrieving all teams",i),i}};getTeamByIdIdMapping=async(t,e)=>{try{t=(await this.idMapping.getEntityIdsBySchemaId([t],"team","native")).team[0];let a=await this.getTeamById(t,e);return await this.idMapping.remapEntities(a,"team")}catch(i){throw console.warn(`There was a problem browsing the following team:${t}`,i),i}};getTeamById=async(t,e)=>{try{return e=e||!1,await this.https.getTeamById(t,e)}catch(i){throw console.warn(`There was a problem retrieving the following team: ${t}`,i),i}};getTopTeamsIdMapping=async t=>{try{let e=await this.getTopTeams(t);return await this.idMapping.remapEntities(e,"team")}catch(e){throw console.warn("There was a problem browsing the top teams",e),e}};getTopTeams=async t=>{try{return t=t||!1,await this.https.getTopTeams(t)}catch(e){throw console.warn("There was a problem retrieving the top teams",e),e}};getNextMatchForTeamIdMapping=async(t,e)=>{try{t=(await this.idMapping.getEntityIdsBySchemaId([t],"team","native")).team[0];let a=await this.getNextMatchForTeam(t,e);return await this.idMapping.remapEntities(a,"match")}catch(i){throw console.warn(`There was a problem browsing the next match for the following team:${t}`,i),i}};getNextMatchForTeam=async(t,e)=>{try{e=e||!1;let i=await this.https.getNextMatchForTeam(t,e);return await this.footballService.setAvailableMarketsForMatch(i)}catch(i){throw console.warn(`There was a problem retrieving the next match for the following team: ${t}`,i),i}};getPrevMatchForTeamIdMapping=async(t,e)=>{try{t=(await this.idMapping.getEntityIdsBySchemaId([t],"team","native")).team[0];let a=await this.getPrevMatchForTeam(t,e);return await this.idMapping.remapEntities(a,"match")}catch(i){throw console.warn(`There was a problem browsing the previous match for the following team:${t}`,i),i}};getPrevMatchForTeam=async(t,e)=>{try{e=e||!1;let i=await this.https.getPrevMatchForTeam(t,e);return await this.footballService.setAvailableMarketsForMatch(i)}catch(i){throw console.warn(`There was a problem retrieving the previous match for the following team: ${t}`,i),i}}};var Kt=class{https=null;footballService=null;idMapping=null;constructor(t,e,i){this.idMapping=i,this.https=e,this.footballService=new Et(t)}getPlayersIdMapping=async(t,e)=>{try{let i=!1;if(t){if(t=new _i(t),t.countryId){let r=await this.idMapping.getEntityIdsBySchemaId([t.countryId],"country","native");r.country.length===0&&(i=!0),t.countryId=r.country[0]}if(t.playerIds){let r=await this.idMapping.getEntityIdsBySchemaId(t.playerIds,"player","native");r.player.length===0&&(i=!0),t.playerIds=r.player}if(t.scope){let r=await this.idMapping.getEntityIdsBySchemaId(t.scope,"competition","native");r.competition.length===0&&(i=!0),t.scope=r.competition}if(i)return[]}let a=await this.getPlayers(t,e);return a.data=await this.idMapping.remapEntities(a.data,"player"),a}catch(i){throw console.warn("There was a problem browsing the players",i),i}};getPlayersWithNativeIds=async t=>{let e=t.length,i=new _i({playerIds:t,limit:e}),a=await this.getPlayers(i);return a.data.sort((r,o)=>r.id.localeCompare(o.id)),await this.idMapping.remapEntities(a.data,"player")};getPlayersMapWithNativeIds=async t=>{let e={},i=oe(t);i.sort((r,o)=>r.localeCompare(o));let a=await this.getPlayersWithNativeIds(Array.from(i));return i.forEach((r,o)=>e[r]=a[o]),e};getPlayers=async(t,e)=>{try{return e=e||!1,await this.https.getPlayers(t,e)}catch(i){throw console.warn("There was a problem retrieving the players",i),i}};getPlayerIdMapping=async(t,e)=>{try{let i=await this.idMapping.getEntityIdsBySchemaId([t],"player","native"),a=await this.getPlayerById(i.player[0],e);return await this.idMapping.remapEntities(a,"player")}catch(i){throw console.warn(`There was a problem browsing the following player:${t}`,i),i}};getPlayerById=async(t,e)=>{try{return e=e||!1,await this.https.getPlayerById(t,e)}catch(i){throw console.warn(`There was a problem retrieving the following player: ${t}`,i),i}};getTopPlayersIdMapping=async t=>{try{let e=await this.getTopPlayers(t);return await this.idMapping.remapEntities(e,"player")}catch(e){throw console.warn("There was a problem browsing the top players",e),e}};getTopPlayers=async t=>{try{return t=t||!1,await this.https.getTopPlayers(t)}catch(e){throw console.warn("There was a problem retrieving the top players",e),e}};getNextMatchForPlayerIdMapping=async(t,e)=>{try{t=(await this.idMapping.getEntityIdsBySchemaId([t],"player","native")).player[0];let a=await this.getNextMatchForPlayer(t,e);return await this.idMapping.remapEntities(a,"match")}catch(i){throw console.warn(`There was a problem browsing the next match for player:${t}`,i),i}};getNextMatchForPlayer=async(t,e)=>{try{e=e||!1;let i=await this.https.getNextMatchForPlayer(t,e);return await this.footballService.setAvailableMarketsForMatch(i)}catch(i){throw console.warn(`There was a problem retrieving the next match for player: ${t}`,i),i}};getPrevMatchForPlayerIdMapping=async(t,e)=>{try{t=(await this.idMapping.getEntityIdsBySchemaId([t],"player","native")).player[0];let a=await this.getPrevMatchForPlayer(t,e);return await this.idMapping.remapEntities(a,"match")}catch(i){throw console.warn(`There was a problem browsing the previous match for player:${t}`,i),i}};getPrevMatchForPlayer=async(t,e)=>{try{e=e||!1;let i=await this.https.getPrevMatchForPlayer(t,e);return await this.footballService.setAvailableMarketsForMatch(i)}catch(i){throw console.warn(`There was a problem retrieving the previous match for player: ${t}`,i),i}}};var jt=class{https=null;idMapping=null;footballService=null;constructor(t,e,i){this.https=e,this.idMapping=i,this.footballService=new Et(t)}getMatchesIdMapping=async(t,e)=>{try{if(t){if(t=new ft(t),t.countryIds&&t.countryIds.length>0){let a=await this.idMapping.getEntityIdsBySchemaId(t.countryIds,"country","native");t.countryIds=a.country}if(t.competitionIds&&t.competitionIds.length>0){let a=await this.idMapping.getEntityIdsBySchemaId(t.competitionIds,"competition","native");t.competitionIds=a.competition}if(t.matchIds&&t.matchIds.length>0){let a=await this.idMapping.getEntityIdsBySchemaId(t.matchIds,"match","native");t.matchIds=a.match}if(t.teamIds&&t.teamIds.length>0){let a=await this.idMapping.getEntityIdsBySchemaId(t.teamIds,"team","native");t.teamIds=a.team}}let i=await this.getMatches(t,e);return i.data=await this.footballService.setAvailableMarketsForMatch([...i.data]),i.data=await this.idMapping.remapEntities(i.data,"match"),i}catch(i){throw console.warn("There was a problem browsing the matches",i),i}};getMatchesWithNativeIds=async t=>{let e=t.length,i=new ft({matchIds:t,limit:e}),a=await this.getMatches(i);return a.data.sort((r,o)=>r.id.localeCompare(o.id)),await this.idMapping.remapEntities(a.data,"match")};getMatchesMapWithNativeIds=async t=>{let e={},i=oe(t);i.sort((r,o)=>r.localeCompare(o));let a=await this.getMatchesWithNativeIds(Array.from(i));if(i.length!==a.length){let r=new ft({matchIds:i,limit:i.length}),o=await this.getMatches(r),n=i.filter(l=>{if(o.data.every(p=>p.id!==l))return l});i=i.filter(l=>{if(!n.includes(l))return l})}return i.forEach((r,o)=>e[r]=a[o]),e};getMatches=async(t,e)=>{try{return e=e||!1,await this.https.getMatches(t,e)}catch(i){throw console.warn("There was a problem retrieving the matches",i),i}};getMatchIdMapping=async(t,e)=>{try{let i=await this.idMapping.getEntityIdsBySchemaId([t],"match","native"),a=await this.getMatchById(i.match[0],e),r=await this.footballService.setAvailableMarketsForMatch(a);return await this.idMapping.remapEntities(r,"match")}catch(i){throw console.warn(`There was a problem browsing the following match: ${t}`,i),i}};getMatchById=async(t,e)=>{try{return e=e||!1,await this.https.getMatchById(t,e)}catch(i){throw console.warn(`There was a problem retrieving the following match: ${t}`,i),i}}};var Yn=class{https=null;idMapping=null;constructor(t,e){this.https=t,this.idMapping=e}searchIdMapping=async(t,e)=>{try{if(t=new so(t),t.scope){let a=await this.idMapping.getEntityIdsBySchemaId(t.scope,"competition","native");t.scope=a.competition}let i=await this.search(t,e);if(i.teams&&i.teams.length>0){let a=await this.idMapping.remapEntities(i.teams,"team");i.teams=a}if(i.players&&i.players.length>0){let a=await this.idMapping.remapEntities(i.players,"player");i.players=a}if(i.competitions&&i.competitions.length>0){let a=await this.idMapping.remapEntities(i.competitions,"competition");i.competitions=a}return i}catch(i){throw console.warn("There was a problem with browsing the search result",i),i}};search=async(t,e)=>{try{return await this.https.search(t,e)}catch(i){throw console.warn("There was a problem retrieving the search response",i),i}}};var Q=class{errorHandlingModel=null;constructor(t){this.errorHandlingModel=t}throwException=(t,e,i)=>{throw this.errorHandlingModel==="standard"?new h(t,e,i):new y(t,e,i)}};var Xn=class extends Q{limit=50;constructor(t){super(t.errorHandlingMode)}validateTeamFormArguments=(t,e)=>{(!t||typeof t!="string")&&this.throwException(400,"invalid_team_id","Invalid team ID provided. Please provide a valid team ID."),e&&(e.competitionId&&typeof e.competitionId!="string"&&this.throwException(400,"invalid_competition_id","Invalid competition ID provided. Please provide a valid competition ID."),e.limit&&typeof e.limit!="number"&&this.throwException(400,"invalid_limit","Invalid limit type. The proper type is number."),e.limit&&e.limit>this.limit&&this.throwException(400,"invalid_limit","Invalid limit. The maximum limit is: "+this.limit.toString()))}};var Ei=class{countriesFacade=null;competitionsFacade=null;teamsFacade=null;playerFacade=null;matchFacade=null;searchFacade=null;validator=null;constructor(t,e,i,a){this.countriesFacade=new Wn(e,i,a),this.competitionsFacade=new qn(e,i,a),this.teamsFacade=new jn(t,i,a),this.playerFacade=new Kt(t,i,a),this.matchFacade=new jt(t,i,a),this.searchFacade=new Yn(i,a),this.validator=new Xn(t)}getCountries=async t=>this.countriesFacade.getCountriesWithIdMapping(t);getCompetitions=async(t,e)=>this.competitionsFacade.getCompetitionsIdMapping(t,e);getCompetitionById=async(t,e)=>this.competitionsFacade.getCompetitionByIdIdMapping(t,e);getTopCompetitions=async t=>this.competitionsFacade.getTopCompetitionsIdMapping(t);getCompetitionsMapWithNativeIds=async t=>await this.competitionsFacade.getCompetitionsMapWithNativeIds(t);getTeams=async(t,e)=>this.teamsFacade.getTeamsIdMapping(t,e);getTeamById=async(t,e)=>this.teamsFacade.getTeamByIdIdMapping(t,e);getTopTeams=async t=>this.teamsFacade.getTopTeamsIdMapping(t);getNextMatchForTeam=async(t,e)=>this.teamsFacade.getNextMatchForTeamIdMapping(t,e);getPrevMatchForTeam=async(t,e)=>this.teamsFacade.getPrevMatchForTeamIdMapping(t,e);getTeamsMapWithNativeIds=async t=>await this.teamsFacade.getTeamsMapWithNativeIds(t);getPlayers=async(t,e)=>this.playerFacade.getPlayersIdMapping(t,e);getPlayerById=async(t,e)=>this.playerFacade.getPlayerIdMapping(t,e);getTopPlayers=async t=>this.playerFacade.getTopPlayersIdMapping(t);getNextMatchForPlayer=async(t,e)=>this.playerFacade.getNextMatchForPlayerIdMapping(t,e);getPrevMatchForPlayer=async(t,e)=>this.playerFacade.getPrevMatchForPlayerIdMapping(t,e);getPlayersMapWithNativeIds=async t=>this.playerFacade.getPlayersMapWithNativeIds(t);getMatches=async(t,e)=>this.matchFacade.getMatchesIdMapping(t,e);getMatchesMapWithNativeIds=async t=>this.matchFacade.getMatchesMapWithNativeIds(t);getMatchById=async(t,e)=>this.matchFacade.getMatchIdMapping(t,e);search=async(t,e)=>this.searchFacade.searchIdMapping(t,e);getTeamForm=async(t,e,i)=>{this.validator.validateTeamFormArguments(t,e);let a=e?.direction||"ltr",r={teamIds:[t],competitionIds:e&&e.competitionId?[e.competitionId]:null,status:"finished",limit:e?.limit||5,sortField:"date",sortOrder:"desc"},o=await this.matchFacade.getMatchesIdMapping(r,i),n={teamId:t,matches:[]};if(n.matches=o.data.map(l=>{let p=l.homeTeam.id===t,c=l.scores.ftScore.homeGoals??0,u=l.scores.ftScore.awayGoals??0,d;return p?d=c>u?"W":c<u?"L":"D":d=u>c?"W":u<c?"L":"D",{matchModel:l,isHomeGame:p,result:d}}),a==="ltr"){let l=Array.from(n.matches);n.matches=l.reverse()}return n}};var $=class{countriesFromResponse=t=>{if(t)return t.map(e=>this.countryFromResponse(e))};countryFromResponse=t=>{try{if(t){let e=new Wr;return e.id=t.id,e.alias=t.alias,e.assets=t.assets,e.countryCode=t.country_code,e.name=t.name,e}}catch(e){throw e}return null}};var Z=class{countryRemapper=null;constructor(){this.countryRemapper=new $}fromResponse(t){try{let e=new Hr;return e.id=t.id,e.country=this.countryRemapper.countryFromResponse(t.country),e.gender=t.gender,e.assets=t.assets,e.type=t.type,e.name=t.name,e}catch(e){throw console.warn("There was a problem remapping the competition response",e),e}}};var K=class{countryRemapper=null;constructor(){this.countryRemapper=new $}fromResponse(t){try{let e=new io;return e.id=t.id,e.country=this.countryRemapper.countryFromResponse(t.country),e.gender=t.gender,e.assets=t.assets,e.code=t.code,e.national=t.national,e.fullName=t.full_name,e.shortName=t.short_name,e.name=t.name,e.isDeleted=t.is_deleted,e.undecided=t.undecided,e}catch(e){throw console.warn("There was a problem remapping teams response",e),e}}};var Jn=class{countryRemapper=null;teamBasicRemapper=null;constructor(){this.countryRemapper=new $,this.teamBasicRemapper=new K}fromResponse(t){try{let e=new $r;return e.id=t.id,e.country=this.countryRemapper.countryFromResponse(t.country),e.gender=t.gender,e.assets=t.assets,e.type=t.type,e.name=t.name,e.participants=t.participants.map(i=>this.teamBasicRemapper.fromResponse(i)),e}catch(e){throw console.warn("There was a problem remapping the competition response",e),e}}};var Zn=class{countryRemapper=null;constructor(){this.countryRemapper=new $}fromResponse(t){try{let e=new Zr;return e.id=t.id,e.startDate=t.start_date,e.endDate=t.end_date,e.shirtNumber=t.shirt_number,e.loan=t.loan,e.position=t.position,e.country=this.countryRemapper.countryFromResponse(t.country),e.name=t.name,e.assets=t.assets,e.birthDate=t.birth_date,e}catch(e){throw console.warn("There was a problem remapping the player from squad",e),e}}};var tl=class{countryRemapper=null;competitionRemapper=null;playerRemapper=null;constructor(){this.countryRemapper=new $,this.competitionRemapper=new Z,this.playerRemapper=new Zn}fromResponse(t){try{let e=new ro;return e.id=t.id,e.country=this.countryRemapper.countryFromResponse(t.country),e.gender=t.gender,e.assets=t.assets,e.code=t.code,e.national=t.national,e.fullName=t.full_name,e.shortName=t.short_name,e.name=t.name,e.isDeleted=t.is_deleted,e.undecided=t.undecided,e.competitions=t.competitions?t.competitions.map(i=>this.competitionRemapper.fromResponse(i)):[],e.colors=t.colors?t.colors:e.colors,e.squad=t.squad?t.squad.map(i=>this.playerRemapper.fromResponse(i)):[],e}catch(e){throw console.warn("There was a problem remapping team response",e),e}}};var Ri=class{fromResponse(t){try{let e=new Kr;return e.ftScore=this.statEntityFromResponse(t.ft_score),e.htScore=this.statEntityFromResponse(t.ht_score),e.aetScore=this.statEntityFromResponse(t.aet_score),e.aggScore=this.statEntityFromResponse(t.agg_score),e.penScore=this.statEntityFromResponse(t.pen_score),e}catch(e){throw console.warn("There was a problem remapping the scores",e),e}}statEntityFromResponse=t=>({homeGoals:t.home_goals,awayGoals:t.away_goals})};var el=class{teamRemapper=null;competitionRemapper=null;scoresRemapper=null;constructor(){this.teamRemapper=new K,this.competitionRemapper=new Z,this.scoresRemapper=new Ri}fromResponse(t){try{let e=new qr;return e.id=t.id,e.kickoffAt=t.kickoff_at,e.finishedAt=t.finished_at,e.updatedAt=t.updated_at,e.isDeleted=t.is_deleted,e.undecided=t.undecided,e.homeTeam=this.teamRemapper.fromResponse(t.home_team),e.awayTeam=this.teamRemapper.fromResponse(t.away_team),e.lineupsConfirmed=t.lineups_confirmed,e.startedAt=t.started_at,e.minute=t.minute,e.scores=this.scoresRemapper.fromResponse(t.scores),e.context={competition:t.context.competition?this.competitionRemapper.fromResponse(t.context.competition):null},e.status={type:t.status.type,subType:t.status.sub_type},e}catch(e){throw console.warn("There was a problem remapping the match response",e),e}}};var il=class{fromResponse(t){try{let e=new Qr;return e.corners=this.statEntityFromResponse(t.corners),e.cornersFirstHalf=this.statEntityFromResponse(t.corners_1h),e.cornersSecondHalf=this.statEntityFromResponse(t.corners_2h),e.cornersExtraTime=this.statEntityFromResponse(t.corners_et),e.crosses=this.statEntityFromResponse(t.crosses),e.crossesFirstHalf=this.statEntityFromResponse(t.crosses_1h),e.crossesSecondHalf=this.statEntityFromResponse(t.crosses_2h),e.crossesExtraTime=this.statEntityFromResponse(t.crosses_et),e.offside=this.statEntityFromResponse(t.offside),e.offsideFirstHalf=this.statEntityFromResponse(t.offside_1h),e.offsideSecondHalf=this.statEntityFromResponse(t.offside_2h),e.offsideExtraTime=this.statEntityFromResponse(t.offside_et),e.shotsOn=this.statEntityFromResponse(t.shots_on),e.shotsOnFirstHalf=this.statEntityFromResponse(t.shots_on_1h),e.shotsOnSecondHalf=this.statEntityFromResponse(t.shots_on_2h),e.shotsOnExtraTime=this.statEntityFromResponse(t.shots_on_et),e.throwIn=this.statEntityFromResponse(t.throw_in),e.throwInFirstHalf=this.statEntityFromResponse(t.throw_in_1h),e.throwInSecondHalf=this.statEntityFromResponse(t.throw_in_2h),e.throwInExtraTime=this.statEntityFromResponse(t.throw_in_et),e.redCards=this.statEntityFromResponse(t.red_cards),e.redCardsFirstHalf=this.statEntityFromResponse(t.red_cards_1h),e.redCardsSecondHalf=this.statEntityFromResponse(t.red_cards_2h),e.redCardsExtraTime=this.statEntityFromResponse(t.red_cards_et),e.shotsOff=this.statEntityFromResponse(t.shots_off),e.shotsOffFirstHalf=this.statEntityFromResponse(t.shots_off_1h),e.shotsOffSecondHalf=this.statEntityFromResponse(t.shots_off_2h),e.shotsOffExtraTime=this.statEntityFromResponse(t.shots_off_et),e.goalKicks=this.statEntityFromResponse(t.goal_kicks),e.goalKicksFirstHalf=this.statEntityFromResponse(t.goal_kicks_1h),e.goalKicksSecondHalf=this.statEntityFromResponse(t.goal_kicks_2h),e.goalKicksExtraTime=this.statEntityFromResponse(t.goal_kicks_et),e.possession=this.statEntityFromResponse(t.possession),e.possessionFirstHalf=this.statEntityFromResponse(t.possession_1h),e.possessionSecondHalf=this.statEntityFromResponse(t.possession_2h),e.possessionExtraTime=this.statEntityFromResponse(t.possession_et),e.treatments=this.statEntityFromResponse(t.treatments),e.treatmentsFirstHalf=this.statEntityFromResponse(t.treatments_1h),e.treatmentsSecondHalf=this.statEntityFromResponse(t.treatments_2h),e.treatmentsExtraTime=this.statEntityFromResponse(t.treatments_et),e.yellowCards=this.statEntityFromResponse(t.yellow_cards),e.yellowCardsFirstHalf=this.statEntityFromResponse(t.yellow_cards_1h),e.yellowCardsSecondHalf=this.statEntityFromResponse(t.yellow_cards_2h),e.yellowCardsExtraTime=this.statEntityFromResponse(t.yellow_cards_et),e.shotsBlocked=this.statEntityFromResponse(t.shots_blocked),e.shotsBlockedFirstHalf=this.statEntityFromResponse(t.shots_blocked_1h),e.shotsBlockedSecondHalf=this.statEntityFromResponse(t.shots_blocked_2h),e.shotsBlockedExtraTime=this.statEntityFromResponse(t.shots_blocked_et),e.substitutions=this.statEntityFromResponse(t.substitutions),e.substitutionsFirstHalf=this.statEntityFromResponse(t.substitutions_1h),e.substitutionsSecondHalf=this.statEntityFromResponse(t.substitutions_2h),e.substitutionsExtraTime=this.statEntityFromResponse(t.substitutions_et),e.counterAttacks=this.statEntityFromResponse(t.counter_attacks),e.counterAttacksFirstHalf=this.statEntityFromResponse(t.counter_attacks_1h),e.counterAttacksSecondHalf=this.statEntityFromResponse(t.counter_attacks_2h),e.counterAttacksExtraTime=this.statEntityFromResponse(t.counter_attacks_et),e.foulsCommitted=this.statEntityFromResponse(t.fouls_committed),e.foulsCommittedFirstHalf=this.statEntityFromResponse(t.fouls_committed_1h),e.foulsCommittedSecondHalf=this.statEntityFromResponse(t.fouls_committed_2h),e.foulsCommittedExtraTime=this.statEntityFromResponse(t.fouls_committed_et),e}catch(e){throw console.warn("There was a problem remapping the stats",e),e}}statEntityFromResponse=t=>({homeTeam:t?t.home_team:null,awayTeam:t?t.away_team:null})};var Fi=class{fromResponse(t){try{let e=new eo;return e.id=t.id,e.name=t.name,e.position=t.position,e.shirtNumber=t.shirt_number,e.assets=t.assets,e.type=t.type,e}catch(e){throw console.warn("There was a problem remapping the player from timeline",e),e}}};var al=class{playerRemapper=null;constructor(){this.playerRemapper=new Fi}fromResponse(t){try{let e=new Ne;return e.homeTeam.players=t.home_team&&t.home_team.players?t.home_team.players.map(i=>this.playerRemapper.fromResponse(i)):[],e.awayTeam.players=t.away_team&&t.away_team.players?t.away_team.players.map(i=>this.playerRemapper.fromResponse(i)):[],e}catch(e){throw console.warn("There was a problem remapping the lineups",e),e}}};var rl=class{playerRemapper=null;constructor(){this.playerRemapper=new Fi}fromResponse(t){try{let e=new jr;return e.minute=t.minute,e.type=t.type,e.teamId=t.team_id,e.player=this.playerRemapper.fromResponse(t.player),e.relatedPlayer=t.related_player?this.playerRemapper.fromResponse(t.related_player):null,e.updatedAt=t.updated_at,e}catch(e){throw console.warn("There was a problem remapping timeline",e),e}}};var ol=class{fromResponse(t){try{let e=new Yr;return e.playerId=t.player_id,e.position=t.position,e.minutesPlayed=t.minutes_played,e.yellowCards=t.yellow_cards,e.redCards=t.red_cards,e.goals=t.goals,e.penaltyGoals=t.penalty_goals,e.penaltyCommitted=t.penalty_committed,e.penaltyWon=t.penalty_won,e.penaltyMissed=t.penalty_missed,e.penaltySaved=t.penalty_saved,e.penaltyReceived=t.penalty_received,e.ownGoals=t.own_goals,e.assists=t.assists,e.cleanSheets=t.clean_sheets,e.shots=t.shots,e.shotsOn=t.shots_on,e.shotsBlocked=t.shots_blocked,e.offsides=t.offsides,e.foulsCommitted=t.fouls_committed,e.foulsWon=t.fouls_won,e.tackles=t.tackles,e.tacklesBlocks=t.tackles_blocks,e.tacklesInterceptions=t.tackles_interceptions,e.concededGoals=t.conceded_goals,e.caughtBall=t.caught_ball,e.saves=t.saves,e.passes=t.passes,e.crosses=t.crosses,e.interceptions=t.interceptions,e.keyPasses=t.key_passes,e.passesAccuracy=t.passes_accuracy,e.duels=t.duels,e.duelsWon=t.duels_won,e.dribblesAttempts=t.dribbles_attempts,e.dribblesSuccess=t.dribbles_success,e.dribblesPast=t.dribbles_past,e.updatedAt=t.updated_at,e}catch(e){throw console.warn("There was a problem remapping the player stats",e),e}}};var sl=class{teamMapper=null;competitionsMapper=null;lineupsMapper=null;scoresMapper=null;statsMapper=null;timelineMapper=null;playerStatsMapper=null;constructor(){this.teamMapper=new K,this.competitionsMapper=new Z,this.lineupsMapper=new al,this.scoresMapper=new Ri,this.statsMapper=new il,this.timelineMapper=new rl,this.playerStatsMapper=new ol}fromResponse(t){try{let e=new zr;return e.id=t.id,e.kickoffAt=t.kickoff_at,e.finishedAt=t.finished_at,e.updatedAt=t.updated_at,e.isDeleted=t.is_deleted,e.undecided=t.undecided,e.homeTeam=t.home_team?this.teamMapper.fromResponse(t.home_team):null,e.awayTeam=t.away_team?this.teamMapper.fromResponse(t.away_team):null,e.lineupsConfirmed=t.lineups_confirmed,e.startedAt=t.started_at,e.minute=t.minute,e.scores=this.scoresMapper.fromResponse(t.scores),e.stats=this.statsMapper.fromResponse(t.stats),e.playerStats=t.player_stats?t.player_stats.map(i=>this.playerStatsMapper.fromResponse(i)):t.player_stats,e.context={competition:this.competitionsMapper.fromResponse(t.context.competition)},e.timeline=t.timeline?t.timeline.map(i=>this.timelineMapper.fromResponse(i)):[],e.status={type:t.status.type,subType:t.status.sub_type},e.lineups=t.lineups?this.lineupsMapper.fromResponse(t.lineups):new Ne,e}catch(e){throw console.warn("There was a problem remapping the match response",e),e}}};var nl=class{countryRemapper=null;constructor(){this.countryRemapper=new $}fromResponse(t){try{let e=new to;return e.id=t.id,e.firstName=t.first_name?t.first_name:null,e.lastName=t.last_name?t.last_name:null,e.name=t.name?t.name:null,e.birthDate=t.birth_date,e.country=this.countryRemapper.countryFromResponse(t.country),e.assets=t.assets,e.position=t.position,e}catch(e){throw console.warn("There was a problem remapping top player response",e),e}}};var Si=class{countryRemapper=null;teamRemapper=null;constructor(){this.countryRemapper=new $,this.teamRemapper=new K}fromResponse(t){try{let e=new Xr;return e.id=t.id,e.firstName=t.first_name?t.first_name:null,e.lastName=t.last_name?t.last_name:null,e.name=t.name?t.name:null,e.birthDate=t.birth_date,e.country=this.countryRemapper.countryFromResponse(t.country),e.assets=t.assets,e.teams=t.teams?t.teams.map(i=>this.teamRemapper.fromResponse(i)):[],e.position=t.position,e.isDeleted=t.is_deleted,e}catch(e){throw console.warn("There was a problem remapping players response",e),e}}};var ll=class{countryRemapper=null;teamRemapper=null;competitionRemapper=null;constructor(){this.countryRemapper=new $,this.teamRemapper=new K,this.competitionRemapper=new Z}fromResponse(t){try{let e=new Jr;return e.id=t.id,e.firstName=t.first_name?t.first_name:null,e.lastName=t.last_name?t.last_name:null,e.name=t.name?t.name:null,e.birthDate=t.birth_date,e.country=this.countryRemapper.countryFromResponse(t.country),e.assets=t.assets,e.teams=t.teams?t.teams.map(i=>this.teamRemapper.fromResponse(i)):[],e.position=t.position,e.isDeleted=t.is_deleted,e.competitions=t.competitions?t.competitions.map(i=>this.competitionRemapper.fromResponse(i)):[],e}catch(e){throw console.warn("There was a problem remapping player response",e),e}}};var pl=class{teamRemapper=null;playerRemapper=null;competitionremapper=null;constructor(){this.teamRemapper=new K,this.playerRemapper=new Si,this.competitionremapper=new Z}fromResponse(t){try{let e=new oo;return e.teams=t.teams?t.teams.map(i=>this.teamRemapper.fromResponse(i)):[],e.players=t.players?t.players.map(i=>this.playerRemapper.fromResponse(i)):[],e.competitions=t.competitions?t.competitions.map(i=>this.competitionremapper.fromResponse(i)):[],e}catch(e){throw console.warn("There was a problem remapping search response",e),e}}};var cl=class{remapMetaProp=t=>{let e=new k;return e.pagination.currentPage=t.pagination.current_page,e.pagination.itemsPerPage=t.pagination.items_per_page,e.pagination.totalItems=t.pagination.total_items,e.pagination.numberOfPages=t.pagination.number_of_pages,e}};var ul=class{remapPlayersPoints=t=>{let e=new Gr;return e.meta.filters.templateId=t.meta.filters.template_id,e.data=t.data.map(i=>this.remapPlayersPointsData(i)),e};remapPlayersPointsData=t=>{let e=new Vr;return e.playerId=t.player_id,e.points=t.points,e.rank=t.rank,e};remapPlayerDetailedStats=t=>{let e=new Dr;return e.meta.filters.templateId=t.meta.filters.template_id,e.meta.filters.playerId=t.meta.filters.player_id,e.data=t.data.map(i=>this.remapPlayerDetailedData(i)),e};remapPlayerDetailedData=t=>{let e=new Ur;return e.matchId=t.match_id,e.points=t.points?this.remapPlayerDetailedPoints(t.points):null,e.stats=t.stats?this.remapPlayerDetailedStatsData(t.stats):null,e};remapPlayerDetailedPoints=t=>{let e=new De;return e.total=t.total,e.minutesPlayed=t.minutes_played,e.yellowCards=t.yellow_cards,e.redCards=t.red_cards,e.goals=t.goals,e.penaltyGoals=t.penalty_goals,e.ownGoals=t.own_goals,e.assists=t.assists,e.cleanSheets=t.clean_sheets,e.shots=t.shots,e.shotsOn=t.shots_on,e.offsides=t.offsides,e.foulsCommitted=t.fouls_committed,e.penaltyCommitted=t.penalty_committed,e.penaltyWon=t.penalty_won,e.penaltyMissed=t.penalty_missed,e.tackles=t.tackles,e.concededGoals=t.conceded_goals,e.caughtBall=t.caught_ball,e.saves=t.saves,e};remapPlayerDetailedStatsData=t=>{let e=new Be;return e.minutesPlayed=t.minutes_played,e.yellowCards=t.yellow_cards,e.redCards=t.red_cards,e.goals=t.goals,e.penaltyGoals=t.penalty_goals,e.penaltyCommitted=t.penalty_committed,e.penaltyWon=t.penalty_won,e.penaltyMissed=t.penalty_missed,e.penaltySaved=t.penalty_saved,e.penaltyReceived=t.penalty_received,e.ownGoals=t.own_goals,e.assists=t.assists,e.cleanSheets=t.clean_sheets,e.shots=t.shots,e.shotsOn=t.shots_on,e.shotsBlocked=t.shots_blocked,e.offsides=t.offsides,e.foulsCommitted=t.fouls_committed,e.foulsWon=t.fouls_won,e.tackles=t.tackles,e.tacklesBlocks=t.tackles_blocks,e.tacklesInterceptions=t.tackles_interceptions,e.concededGoals=t.conceded_goals,e.caughtBall=t.caught_ball,e.saves=t.saves,e.passes=t.passes,e.crosses=t.crosses,e.interceptions=t.interceptions,e.keyPasses=t.key_passes,e.passesAccuracy=t.passes_accuracy,e.duels=t.duels,e.duelsWon=t.duels_won,e.dribblesAttempts=t.dribbles_attempts,e.dribblesSuccess=t.dribbles_success,e.dribblesPast=t.dribbles_past,e}};var ct=class extends v{limitIds=200;countryRemapper=null;competitionBasicRemapper=null;competitionFullRemapper=null;teamBasicRemapper=null;teamFullRemapper=null;matchBasicRemapper=null;matchFullRemapper=null;playerBasicRemapper=null;playerFullRemapper=null;topPlayerRemapper=null;searchRemapper=null;footballMetaRemapper=null;fantasyRemapper=null;footballService=null;constructor(t){super(t,O(t.environment,"football")),this.apiSignInUrl=t.lang!=="en"?this.apiSignInUrl+`&lang=${t.lang}`:this.apiSignInUrl,this.countryRemapper=new $,this.competitionBasicRemapper=new Z,this.competitionFullRemapper=new Jn,this.teamBasicRemapper=new K,this.teamFullRemapper=new tl,this.matchBasicRemapper=new el,this.matchFullRemapper=new sl,this.playerBasicRemapper=new Si,this.playerFullRemapper=new ll,this.topPlayerRemapper=new nl,this.searchRemapper=new pl,this.footballMetaRemapper=new cl,this.footballService=new Et(t),this.fantasyRemapper=new ul}getCountries=async t=>{let e="There was a problem with the football countries request",i=`/countries${this.apiSignInUrl}`,a=Date.now();t&&(i+=`&disable_cache=${a}`);let r=await this.fetchWithoutAuth(i,e);return this.countryRemapper.countriesFromResponse(r.data)};getCompetitions=async(t,e)=>{let i=Date.now(),a="There was a problem with football competitions request";if(e=e||!1,t&&t.competitionIds&&t.competitionIds.length>this.limitIds-1){let r=[],o=Vt(t.competitionIds,this.limitIds);for(let l of o){t.competitionIds=l;let p=`/competitions${this.apiSignInUrl}${t.constructFilterUrl()}`;e&&(p+=`&disable_cache=${i}`);let c=await this.fetchWithoutAuth(p,a);r.push(c.data.map(u=>this.competitionBasicRemapper.fromResponse(u)))}return Array.prototype.concat.apply([],r)}else{let r=`/competitions${this.apiSignInUrl}`;return t&&(r+=`${t.constructFilterUrl()}`),e&&(r+=`&disable_cache=${i}`),(await this.fetchWithoutAuth(r,a)).data.map(n=>this.competitionBasicRemapper.fromResponse(n))}};getCompetitionById=async(t,e)=>{let i=`/competitions/${t}${this.apiSignInUrl}`,a="There was a problem with football competition by ID request",r=Date.now();e&&(i+=`&disable_cache=${r}`);let o=await this.fetchWithoutAuth(i,a);return this.competitionFullRemapper.fromResponse(o.data)};getTopCompetitions=async t=>{let e="There was a problem with top football competitions request",i=`/competitions/top${this.apiSignInUrl}`,a=Date.now();return t&&(i+=`&disable_cache=${a}`),(await this.fetchWithoutAuth(i,e)).data.map(o=>this.competitionBasicRemapper.fromResponse(o))};getTeams=async(t,e)=>{let i=Date.now(),a="There was a problem with football teams request";if(t&&t.teamIds&&t.teamIds.length>this.limitIds){let r=[],o=Vt(t.teamIds,this.limitIds);for(let l of o){t.teamIds=l,t.limit=l.length;let p=`/teams${this.apiSignInUrl}${t.constructFilterUrl()}`;e&&(p+=`disable_cache=${i}`);let c=await this.fetchWithoutAuth(p,a);r.push(c.data.map(u=>this.teamBasicRemapper.fromResponse(u)))}return Array.prototype.concat.apply([],r)}else{let r=new zt,o=`/teams${this.apiSignInUrl}`;t&&(o+=`${t.constructFilterUrl()}`),e&&(o+=`&disable_cache=${i}`);let n=await this.fetchWithoutAuth(o,a);return r.meta=this.footballMetaRemapper.remapMetaProp(n.meta),r.data=n.data.map(l=>this.teamBasicRemapper.fromResponse(l)),r}};getTeamById=async(t,e)=>{let i="There was a problem with football team by ID request",a=`/teams/${t}${this.apiSignInUrl}`,r=Date.now();e&&(a+=`disable_cache=${r}`);let o=await this.fetchWithoutAuth(a,i);return this.teamFullRemapper.fromResponse(o.data)};getTopTeams=async t=>{let e=`/teams/top${this.apiSignInUrl}`,i="There was a problem with top football teams request",a=Date.now();t&&(e+=`$disable_cache=${a}`);let r=await this.fetchWithoutAuth(e,i);return r.data?r.data.map(o=>this.teamBasicRemapper.fromResponse(o)):[]};getNextMatchForTeam=async(t,e)=>{let i=`/teams/${t}/next-match${this.apiSignInUrl}`,a=Date.now(),r="There was a problem with next match for team request";e&&(i+=`&disable_cache=${a}`);let o=await this.fetchWithoutAuth(i,r);return this.matchFullRemapper.fromResponse(o.data)};getPrevMatchForTeam=async(t,e)=>{let i=`/teams/${t}/previous-match${this.apiSignInUrl}`,a=Date.now(),r="There was a problem with previous match for team request";e&&(i+=`disable_cache=${a}`);let o=await this.fetchWithoutAuth(i,r);return this.matchFullRemapper.fromResponse(o.data)};getPlayers=async(t,e)=>{let i=Date.now(),a="There was a problem with football players request";if(t&&t.playerIds&&t.playerIds.length>this.limitIds-1){let r=[],o=Vt(t.playerIds,this.limitIds);for(let p of o){t.playerIds=p,t.limit=p.length;let c=`/players${this.apiSignInUrl}${t.constructFilterUrl()}`;e&&(c+=`&disable_cache=${i}`);let u=await this.fetchWithoutAuth(c,a);r.push(u.data.map(d=>this.playerBasicRemapper.fromResponse(d)))}let n=Array.prototype.concat.apply([],r),l=new zt;return l.data=n,l}else{let r=new zt,o=`/players${this.apiSignInUrl}`;t&&(o+=`${t.constructFilterUrl()}`),e&&(o+=`&disable_cache=${i}`);let n=await this.fetchWithoutAuth(o,a);return r.meta=this.footballMetaRemapper.remapMetaProp(n.meta),r.data=n.data.map(l=>this.playerBasicRemapper.fromResponse(l)),r}};getPlayerById=async(t,e)=>{let i=`/players/${t}${this.apiSignInUrl}`,a=Date.now(),r="There was a problem with football player by ID request";e&&(i+=`&disable_cache=${a}`);let o=await this.fetchWithoutAuth(i,r);return this.playerFullRemapper.fromResponse(o.data)};getTopPlayers=async t=>{let e=`/players/top${this.apiSignInUrl}`,i=Date.now(),a="There was a problem with top football players request";return t&&(e+=`&disable_cache=${i}`),(await this.fetchWithoutAuth(e,a)).data.map(o=>this.topPlayerRemapper.fromResponse(o))};getNextMatchForPlayer=async(t,e)=>{let i=`/players/${t}/next-match${this.apiSignInUrl}`,a=Date.now(),r="There was a problem with next match for player request";e&&(i+=`&disable_cache=${a}`);let o=await this.fetchWithoutAuth(i,r);return this.matchFullRemapper.fromResponse(o.data)};getPrevMatchForPlayer=async(t,e)=>{let i=`/players/${t}/previous-match${this.apiSignInUrl}`,a=Date.now(),r="There was a problem with previous match for player request";e&&(i+=`&disable_cache=${a}`);let o=await this.fetchWithoutAuth(i,r);return this.matchFullRemapper.fromResponse(o.data)};getMatchById=async(t,e)=>{let i=`/matches/${t}${this.apiSignInUrl}`,a=Date.now(),r="There was a problem with match by ID request";e&&(i+=`&disable_cache=${a}`);let o=await this.fetchWithoutAuth(i,r);return this.matchFullRemapper.fromResponse(o.data)};getMatches=async(t,e)=>{let i=new zt,a="There was a problem with football matches request";if(t&&t.matchIds&&t.matchIds.length>this.limitIds){let r=[],o=Vt(t.matchIds,this.limitIds);for(let l of o){let p=new ft({...t,matchIds:l,limit:l.length}),c=!0,u=`/matches${this.apiSignInUrl}${p.constructFilterUrl(c)}&limit=${l.length}`;e&&(u+=m());let d=await this.fetchWithoutAuth(u,a);r.push(d.data.map(b=>this.matchBasicRemapper.fromResponse(b)))}let n=Array.prototype.concat.apply([],r);return i.meta=this.footballService.setMetaDataBatchRequest(n.length,t.limit||20,t.page||1),i.data=this.footballService.finalizeMatchesDataBatchRequest(n,t),i}else{let r=`/matches${this.apiSignInUrl}`;t&&(r+=`${t.constructFilterUrl()}`),e&&(r+=m());let o=await this.fetchWithoutAuth(r,a);return i.meta=this.footballMetaRemapper.remapMetaProp(o.meta),i.data=o.data.map(n=>this.matchBasicRemapper.fromResponse(n)),i}};search=async(t,e)=>{let i=`/search${this.apiSignInUrl}${t.constructFilterUrl()}`,a=Date.now(),r="There was a problem with football search request";e&&(i+=`&disable_cache=${a}`);let o=await this.fetchWithoutAuth(i,r);return this.searchRemapper.fromResponse(o.data)};getPlayersPoints=async(t,e,i)=>{let a=`/players/points/${t}${this.apiSignInUrl}`,r=Date.now(),o="There was a problem with players points request";e&&(a+=`&position=${e.toLocaleLowerCase()}`),i&&(a+=`&disable_cache=${r}`);let n=await this.fetchWithoutAuth(a,o);return this.fantasyRemapper.remapPlayersPoints(n)};getPlayerDetailedStatistics=async(t,e,i)=>{let a=`/players/${e}/points/${t}${this.apiSignInUrl}`,r=Date.now(),o="There was a problem with detailed player points request";i&&(a+=`&disable_cache=${r}`);let n=await this.fetchWithoutAuth(a,o);return this.fantasyRemapper.remapPlayerDetailedStats(n)}};var dl=class{idMapping=null;idSchema=null;native="native";footballFacade=null;constructor(t,e,i){this.idMapping=i,this.idSchema=t.idSchema,this.footballFacade=e}remapProfileStats=async t=>{if(!t.predictions)return t;let{successRates:e,predictions:i}=t,a={competition:this.getIdsKeys(e.byFootballCompetition,i.single.breakdown.footballCompetitions),team:this.getIdsKeys(e.byFootballTeam,i.single.breakdown.footballTeams)};if(Object.values(a.competition).length){let r=JSON.parse(JSON.stringify(t.successRates.byFootballCompetition)),o=await this.getEntitiesMap(a.competition,"competition"),n=await this.setSuccessRatesModels(r,o);t.successRates.byFootballCompetition=n,i.single.breakdown.footballCompetitions=this.reconstructBreakdown(i.single.breakdown.footballCompetitions,o)}if(Object.values(a.team).length){let r=JSON.parse(JSON.stringify(t.successRates.byFootballTeam)),o=await this.getEntitiesMap(a.team,"team"),n=await this.setSuccessRatesModels(r,o);t.successRates.byFootballTeam=n,i.single.breakdown.footballTeams=this.reconstructBreakdown(i.single.breakdown.footballTeams,o)}return t};setSuccessRatesModels=async(t,e)=>{let i;return this.reconstructRecords(t,i,e)};getEntitiesMap=async(t,e)=>{switch(e){case"competition":return await this.footballFacade.getCompetitionsMapWithNativeIds(t);case"team":return await this.footballFacade.getTeamsMapWithNativeIds(t)}};reconstructRecords=(t,e,i)=>t&&Object.keys(t).length?(Object.keys(t).forEach(a=>{let r=i.get(a);e={...e,[r.id]:t[a]},e[r.id].model=r}),e):t;reconstructBreakdown=(t,e)=>t.length?t.map(i=>{let a=e.get(i.entityId);return i.entityId=a.id,i.model=a,i}):t;getIdsKeys=(t,e)=>{let i=Object.keys(t);if(e.length){let a=e.map(r=>r.entityId);return Array.from(new Set([...i,...a]))}return i};remapInterestsToIdSchema=async t=>{if(this.idSchema!==this.native)if(t&&t.length>0){let e={},i={},a=t.filter(l=>l.source.toLocaleUpperCase()==="FOOTBALL"),r=t.filter(l=>l.source.toLocaleUpperCase()!=="FOOTBALL");a.forEach(l=>{e.hasOwnProperty(l.type)||(e[l.type]=[],i[l.type]=[]),e[l.type].push(l.id),i[l.type].push(l)});let o=await this.remapIdsObj(e,this.native,this.idSchema),n=[];for(let[l,p]of Object.entries(i))p.forEach((c,u)=>{c.id=o[l][u],n.push(c)});return n.concat(r)}else return t;return t};remapInterestToNative=async t=>{if(this.idSchema!==this.native&&t.source.toLocaleUpperCase()==="FOOTBALL"){let e={},{id:i,type:a}=t;e[a]=[i];let r=await this.remapIdsObj(e,this.idSchema,this.native);return t.id=r[a][0],t}return t};inquiryCustomInterests=(t,e)=>{let i=[];return t&&t.length>0&&(i=t.filter(a=>a.source.toLocaleUpperCase()==="CUSTOM"),e)?i.map(a=>{let r=new Hs;return r.id=a.id,r.type=a.type,r.source=a.source,r.favourite=a.favourite,r}):i};remapInterests=async t=>{let i=this.inquiryCustomInterests(t,!1);if(i&&i.length>0){let a=t.filter(o=>o.source.toLocaleUpperCase()!=="CUSTOM"),r=await this.remapInterestsToIdSchema(a);return i.forEach(o=>r.push(o)),r}return await this.remapInterestsToIdSchema(t)};showFullInterests=async t=>{let e=[];if(t&&t.length>0){let a=this.inquiryCustomInterests(t,!0);e.push(a);let r=t.filter(c=>c.source.toLocaleUpperCase()!=="CUSTOM"),{competitionsMap:o,teamsMap:n,playersMap:l}=await this.getInterestsEntitiesMap(r),p=r.map(c=>{let u=null;if(c.source.toLocaleUpperCase()==="FOOTBALL"){if(c.type==="competition")return u=o.get(c.id),u&&(c.id=u.id),c.model=u,c;if(c.type==="team")return u=n.get(c.id),u&&(c.id=u.id),c.model=u,c;if(c.type==="player")return l?(c.model=l[c.id],c.id=l[c.id].id):c.model=u,c}else return c.model=u,c});return e.push(p),e.flat()}return e};getInterestsEntitiesMap=async t=>{let e=[],i=[],a=[],r=new Map,o=new Map,n=null;return t.forEach(l=>{l.type==="competition"&&l.source.toLocaleUpperCase()==="FOOTBALL"?e.push(l.id):l.type==="team"&&l.source.toLocaleUpperCase()==="FOOTBALL"?i.push(l.id):l.type==="player"&&l.source.toLocaleUpperCase()==="FOOTBALL"&&a.push(l.id)}),e.length&&(r=await this.footballFacade.getCompetitionsMapWithNativeIds(e)),i.length&&(o=await this.footballFacade.getTeamsMapWithNativeIds(i)),a.length&&(n=await this.footballFacade.getPlayersMapWithNativeIds(a)),{competitionsMap:r,teamsMap:o,playersMap:n}};remapIdsObj=async(t,e,i)=>await this.idMapping.idMappingFacade.getEntitiesByIds(t,e,i)};var ml=class{idMapping=null;profileOperations=null;constructor(t,e){this.idMapping=new R(t),this.profileOperations=new dl(t,e,this.idMapping)}remapProfileStats=async t=>await this.profileOperations.remapProfileStats(t);remapInterestToNative=async t=>await this.profileOperations.remapInterestToNative(t);remapInterests=async t=>await this.profileOperations.remapInterests(t);showFullInterests=async t=>await this.profileOperations.showFullInterests(t)};var D=class{idsRemapper=null;profileHttps=null;activityHttps=null;footballHttps=null;footballFacade=null;idMapping=null;localCache=null;profileFacade=null;ownProfileBuilder=null;profileBuilder=null;constructor(t){this.profileHttps=new yi(t),this.activityHttps=new di(t),this.footballHttps=new ct(t),this.idMapping=new R(t),this.localCache=new pt().createLocalCacheInstance(t.idSchema),this.footballFacade=new Ei(t,this.localCache,this.footballHttps,this.idMapping),this.profileFacade=new _t(this.localCache,this.profileHttps,this.activityHttps,t.errorHandlingMode),this.idsRemapper=new ml(t,this.footballFacade),this.ownProfileBuilder=new $n(t,this.idsRemapper,this.localCache,this.profileHttps,this.activityHttps),this.profileBuilder=new Mi(this.idsRemapper,this.localCache,this.profileHttps,this.activityHttps)}getOwn=()=>this.ownProfileBuilder;getById=t=>this.profileBuilder.getById(t);getCountries=async t=>await this.profileFacade.getCountries(t);getByIds=async(t,e,i)=>await this.profileFacade.getByIds(t,e,i);collectLead=async t=>await this.profileFacade.collectLead(t);checkFollowStatus=async t=>await this.profileFacade.checkFollowStatus(t);getOwnStats=async()=>await this.ownProfileBuilder.getStats();getStats=async(t,e)=>await this.profileBuilder.getById(t).getStats(e);getOwnBadges=async()=>await this.ownProfileBuilder.getBadges();getBadges=async t=>await this.profileBuilder.getById(t).getBadges()};var hl=class extends w{};var Su=(r=>(r.LIKE="like",r.DISLIKE="dislike",r.SHARE="share",r.COMMENT="comment",r.PREDICTION_MADE="prediction_made",r))(Su||{});var vu=(a=>(a.CORRECT="CORRECT",a.INCORRECT="INCORRECT",a.PARTIALLY_CORRECT="PARTIALLY_CORRECT",a.NOT_VERIFIED="NOT_VERIFIED",a))(vu||{});var fl=(i=>(i.ONE="1",i.X="x",i.TWO="2",i))(fl||{}),gl=(i=>(i.ONE_X="1x",i.X_TWO="x2",i.ONE_TWO="12",i))(gl||{}),yl=(p=>(p.ONE_ONE="1/1",p.ONE_X="1/x",p.ONE_TWO="1/2",p.X_ONE="x/1",p.X_X="x/x",p.X_TWO="x/2",p.TWO_ONE="2/1",p.TWO_X="2/x",p.TWO_TWO="2/2",p))(yl||{});var qc=(F=>(F.NONE="none",F.FINISHED="finished",F.CANCELLED="cancelled",F.POSTPONED="postponed",F.NOT_STARTED="not_started",F.FIRST_HALF="1st_half",F.SECOND_HALF="2nd_half",F.FINISHED_AFTER_AWARDED_WIN="finished_after_awarded_win",F.TO_FINISH="to_finish",F.FINISHED_AET="finished_aet",F.HALFTIME="halftime",F.FINISHED_AP="finished_ap",F.INTERRUPTED="interrupted",F.KICK_OFF_DELAYED="kick_off_delayed",F.ABANDONED="abandoned",F.WAITING_FOR_PENALTY="waiting_for_penalty",F.PENALTY="penalty",F.PAUSE="pause",F.EXTRA_TIME_1ST_HALF="extra_time_1st_half",F.EXTRA_TIME_END_OF_1ST_HALF="extra_time_end_of_1st_half",F.EXTRA_TIME_2ND_HALF="extra_time_2nd_half",F.WAITING_FOR_EXTRA_TIME="waiting_for_extra_time",F.NO_INFO_YET="no_info_yet",F.AWAITING_INFO="awaiting_info",F.FINISHED_ASG="finished_asg",F))(qc||{});var bl=class extends Q{constructor(t){super(t)}validatePrediction=t=>{(!t.fixtures||!Array.isArray(t.fixtures)||t.fixtures.length===0)&&this.throwException(400,"invalid_method_call","Fixtures field is required and should contain at least one fixtures object. For more information please visit our documentation");let e=Object.keys(new cr);for(let i of t.fixtures)(Object.keys(i).length!==e.length||Object.keys(i).some(a=>!e.includes(a)))&&this.throwException(400,"invalid_method_call","Fixtures field is invalid. For more information please visit our documentation");t.tiebreaker&&(!t.tiebreaker.statTotal||!Number.isInteger(t.tiebreaker.statTotal))&&this.throwException(400,"invalid_method_call","Tiebreaker field is invalid. It should contain statTotal key with integer value. For more information please visit our documentation")}};var Ml=class{https=null;validator=null;profile=null;constructor(t){this.https=new Wt(t),this.profile=new D(t),this.validator=new bl(t.errorHandlingMode)}getGames=async(t,e)=>(t&&(t=new ur(t)),await this.https.getBracketGames(t,e));getGameById=async(t,e)=>await this.https.getBracketGameById(t,e);makePrediction=async(t,e)=>(this.validator.validatePrediction(e),await this.https.makeBracketGamePrediction(t,e));updatePrediction=async(t,e,i)=>(this.validator.validatePrediction(i),await this.https.updateBracketGamePrediction(t,e,i));getGamePredictionsForUser=async(t,e,i,a)=>{i&&(i=new pr(i));let r=await this.https.getBracketGamePredictionsForUser(t,e,i,a),o=null;try{o=await this.profile.getById(e).getInfo()}catch(n){console.error(n)}return r.data.forEach(n=>{n.profileModel=o}),r};getGamePredictionById=async(t,e,i)=>await this.https.getBracketGamePredictionById(t,e,i);getRankings=async(t,e,i)=>{e&&(e=new hl(e));let a=await this.https.getBracketGameRankings(t,e,i),r=a.data.map(n=>n.profileId),o=[];return r.length>0&&(o=await this.profile.getByIds(r),a.data=a.data.map(n=>(n.profileModel=o.find(l=>l.id===n.profileId)||null,n))),a}};var Il=class{facade=null;constructor(t){this.facade=new Ml(t)}getGames=async(t,e)=>await this.facade.getGames(t,e);getGameById=async(t,e)=>await this.facade.getGameById(t,e);makePrediction=async(t,e)=>await this.facade.makePrediction(t,e);updatePrediction=async(t,e,i)=>await this.facade.updatePrediction(t,e,i);getGamePredictionsForUser=async(t,e,i,a)=>await this.facade.getGamePredictionsForUser(t,e,i,a);getGamePredictionById=async(t,e,i)=>await this.facade.getGamePredictionById(t,e,i);getRankings=async(t,e,i)=>await this.facade.getRankings(t,e,i)};var wl=class{remapResponse=t=>(t.meta=this.remapMeta(t.meta),t.data=this.remapData(t.data),t);remapLeagueLeaderboardResponse=t=>(t.meta=this.remapLeagueLeaderboardMeta(t.meta),t.data=this.remapData(t.data),t);remapTemplateBreakdown=t=>(t.meta=this.remapMeta(t.meta),t.data=t.data.map(e=>this.remapTemplatePoints(e)),t);remapMeta=t=>{let e=new Dt;return e.rankType=t.rank_type,e.fromDate=t.from_date,e.toDate=t.to_date,e.pagination.currentPage=t.pagination.current_page,e.pagination.itemsPerPage=t.pagination.items_per_page,e.pagination.totalItems=t.pagination.total_items,e.pagination.numberOfPages=t.pagination.number_of_pages,e};remapLeagueLeaderboardMeta=t=>{let e=new ke;return e.templateId=t.template_id,e.privateLeagueId=t.private_league_id,e.fromDate=t.from_date,e.toDate=t.to_date,e.pagination.currentPage=t.pagination.current_page,e.pagination.itemsPerPage=t.pagination.items_per_page,e.pagination.totalItems=t.pagination.total_items,e.pagination.numberOfPages=t.pagination.number_of_pages,e};remapData=t=>{let e=[];return t.forEach(i=>{let a=new Ge;a.position=i.position,a.profileId=i.profile_id,a.points=i.points,a.predictionsMade=i.predictions_made,e.push(a)}),e};remapTemplatePoints=t=>{let e=new Ro;return e.groupId=t.group_id,e.averagePoints=t.average_points,e.highestPoints=t.highest_points,e}};var _l=class{remapRankings=t=>(t.meta=this.remapMeta(t.meta),t.data=this.remapData(t.data),t);remapRankingsPrivateLeague=t=>(t.meta=this.remapMeta(t.meta),t.data=this.remapDataUserRankingPrivateLeague(t.data),t);remapRankingsChallenge=t=>(t.meta=this.remapMeta(t.meta),t.data=this.remapDataUserRankingChallenge(t.data),t);remapMeta=t=>{let e=new k;return e.pagination.currentPage=t.pagination.current_page,e.pagination.itemsPerPage=t.pagination.items_per_page,e.pagination.numberOfPages=t.pagination.number_of_pages,e.pagination.totalItems=t.pagination.total_items,e};remapData(t){let e=[];return t.forEach(i=>{let a=new Eo;a.id=i.id,a.rankType=i.rank_type,a.position=i.position,a.points=i.points,a.gameType=i.game_type,delete a.profileId,delete a.profileModel,delete a.predictionsMade,e.push(a)}),e}remapDataUserRankingPrivateLeague(t){let e=[];return t.forEach(i=>{let a=new ks;a.templateId=i.template_id,a.privateLeagueId=i.private_league_id,a.position=i.position,a.points=i.points,e.push(a)}),e}remapDataUserRankingChallenge(t){let e=[];return t.forEach(i=>{let a=new yr;a.templateId=i.template_id,a.challengeId=i.private_league_id,a.position=i.position,a.points=i.points,e.push(a)}),e}};var Pl=class{entityId=null;entityType=null};var ut=class{remapBranding=t=>{let e=new no;return t.colors&&(e.colors=new lo,e.colors.primaryColor=t.colors.primary_color,e.colors.secondaryColor=t.colors.secondary_color,e.colors.contentColor=t.colors.content_color,e.colors.backgroundColor=t.colors.background_color,e.colors.borderColor=t.colors.border_color,e.colors.additionalColor=t.colors.additional_color),t.urls&&(e.urls=new po,e.urls.primaryUrl=t.urls.primary_url,e.urls.secondaryUrl=t.urls.secondary_url,e.urls.privacyPolicyUrl=t.urls.privacy_policy_url,e.urls.termsAndConditionsUrl=t.urls.terms_and_conditions_url,e.urls.additionalUrl=t.urls.additional_url),t.images&&(e.images=new co,e.images.mainLogo=t.images.main_logo,e.images.mobileLogo=t.images.mobile_logo,e.images.backgroundImage=t.images.background_image,e.images.mobileBackgroundImage=t.images.mobile_background_image,e.images.additionalImage=t.images.additional_image),e}};var Tl=class extends ut{remapResponse=t=>{let e=[];return t.forEach(i=>{let a=new Bt;a.id=i.id,a.name=i.name,a.description=i.description,a.type=i.type,a.fromDate=i.from_date,a.toDate=i.to_date,a.markets=i.markets?i.markets:null,a.teamIds=i.team_ids?i.team_ids:null,a.matchIds=i.match_ids?i.match_ids:null,a.groups=i.groups?this.remapGroups(i.groups):null,a.gameIds=i.game_ids?i.game_ids:null,a.gameTypes=i.game_types?i.game_types:null,a.competitionIds=i.competition_ids?i.competition_ids:null,a.excludedProfileIds=i.excluded_profile_ids?i.excluded_profile_ids:null,a.rules=i.rules?i.rules:null,a.labels=i.labels?i.labels:null,a.customFields=i.custom_fields?i.custom_fields:null,a.branding=i.branding?this.remapBranding(i.branding):null,a.flags=i.flags?i.flags:null,a.images=i.images?i.images:null,a.status=i.status?i.status:null,a.automaticallyChangeStatus=i.automatically_change_status,a.createdAt=i.created_at,a.updatedAt=i.updated_at,a.related=i.related?this.remapRelated(i.related):null,e.push(a)}),e};remapResponseId=t=>{let e=new Fo;return e.id=t.id,e.name=t.name,e.description=t.description,e.type=t.type,e.fromDate=t.from_date,e.toDate=t.to_date,e.markets=t.markets?t.markets:null,e.teamIds=t.team_ids?t.team_ids:null,e.matchIds=t.match_ids?t.match_ids:null,e.groups=t.groups?this.remapGroups(t.groups):null,e.gameIds=t.game_ids?t.game_ids:null,e.gameTypes=t.game_types?t.game_types:null,e.competitionIds=t.competition_ids?t.competition_ids:null,e.excludedProfileIds=t.excluded_profile_ids?t.excluded_profile_ids:null,e.rules=t.rules?t.rules:null,e.flags=t.flags?t.flags:null,e.images=t.images?t.images:null,e.status=t.status?t.status:null,e.automaticallyChangeStatus=t.automatically_change_status,e.related=t.related?this.remapRelated(t.related):null,e.labels=t.labels,e.customFields=t.custom_fields,e.branding=t.branding?this.remapBranding(t.branding):null,e.adContent=t.ad_content,e.createdAt=t.created_at,e.updatedAt=t.updated_at,e};remapMeta=t=>{let e=new To;return e.pagination.currentPage=t.pagination.current_page,e.pagination.itemsPerPage=t.pagination.items_per_page,e.pagination.totalItems=t.pagination.total_items,e.pagination.numberOfPages=t.pagination.number_of_pages,e.filters.flags=t.filters.flags,e.filters.status=t.filters.status,e.filters.type=t.filters.type,e.filters.activeFrom=t.filters.active_from,e.filters.activeTo=t.filters.active_to,e.filters.createdFrom=t.filters.created_from,e.filters.createdTo=t.filters.created_to,e.filters.updatedFrom=t.filters.updated_from,e.filters.updatedTo=t.filters.updated_to,e};remapRelated=t=>t.map(e=>{let i=new Pl;return i.entityId=e.entity_id,i.entityType=e.entity_type,i});remapGroups=t=>t.map(e=>{let i=new So;return i.groupId=e.group_id,i.label=e.label,i.flags=e.flags,i.filters=this.remapGroupFilters(e.filters),i});remapGroupFilters=t=>{let e=new vo;return e.fromDate=t.from_date,e.toDate=t.to_date,e.matchIds=t.match_ids,e}};var El=class{remapHighestSuccessRate=t=>t.map(e=>{let i=new _o;return i.position=e.position,i.points=e.points,i.predictionsMade=e.predictions_made,i.profileId=e.profile_id,i.successRatePercent=e.success_rate_percent,i})};var Rt=class extends v{templateRemapper=null;leaderboardRemapper=null;rankingsRemapper=null;highestSuccessRateRemapper=null;constructor(t){super(t,O(t.environment,"loyalty")),this.templateRemapper=new Tl,this.leaderboardRemapper=new wl,this.rankingsRemapper=new _l,this.highestSuccessRateRemapper=new El}getTemplates=async(t,e)=>{let i=t?`/leaderboard/templates/${this.apiSignInUrl}${t.constructFiltersUrl()}`:`/leaderboard/templates/${this.apiSignInUrl}`;i+=g(e)?m():"";let a="There was a problem fetching the list of templates",r=await this.fetchWithoutAuth(i,a),o=JSON.parse(JSON.stringify(r));return o.meta=this.templateRemapper.remapMeta(r.meta),o.data=this.templateRemapper.remapResponse(r.data),o};getTemplateById=async(t,e)=>{let i=g(e)?`/leaderboard/templates/${t}${this.apiSignInUrl}${m()}`:`/leaderboard/templates/${t}${this.apiSignInUrl}`,a=`There was a problem requesting the following template: ${t}`,r=await this.fetchWithoutAuth(i,a);return this.templateRemapper.remapResponseId(r.data)};getLeaderboard=async(t,e,i)=>{let a=g(e)?`/leaderboard/${t}${this.apiSignInUrl}${m()}`:`/leaderboard/${t}${this.apiSignInUrl}`,r=`There was a problem fetching the leaderboard for the following template: ${t}`;i&&(a+=`${i.constructFiltersUrl()}`);let o=await this.fetchWithoutAuth(a,r),n=JSON.parse(JSON.stringify(o));return this.leaderboardRemapper.remapResponse(n)};getLeaderboardForGame=async(t,e,i)=>{let a=g(e)?`/leaderboard/games/${t}${this.apiSignInUrl}${m()}`:`/leaderboard/games/${t}${this.apiSignInUrl}`,r=`There was a problem fetching the leaderboard for the following game: ${t}`;i&&(a+=`${i.constructFiltersUrl()}`);let o=await this.fetchWithoutAuth(a,r),n=JSON.parse(JSON.stringify(o));return this.leaderboardRemapper.remapResponse(n)};getLeaderboardForLeague=async(t,e)=>{let i=`/private-league/${t}${this.apiSignInUrl}`,a=`There was a problem fetching the leaderboard for the following league: ${t}`;e&&(i+=`${e.constructFiltersUrl()}`);let r=await this.fetchWithoutAuth(i,a);return this.leaderboardRemapper.remapLeagueLeaderboardResponse(r)};getUserRankings=async(t,e,i)=>{let a=`/leaderboard/users/${t}/rankings${this.apiSignInUrl}`,r=`There was a problem fetching the rankings for the following user: ${t}`;e&&(a+=`${e.constructFiltersUrl()}`),g(i)&&(a+=`${m()}`);let o=await this.fetchWithoutAuth(a,r);return this.rankingsRemapper.remapRankings(o)};getHighestSuccessRate=async(t,e)=>{let i=`/statistics/top${this.apiSignInUrl}`,a="There was a problem fetching highest success rate";t&&(i+=`${t.constructFiltersUrl()}`),g(e)&&(i+=`${m()}`);let r=await this.fetchWithoutAuth(i,a);return this.highestSuccessRateRemapper.remapHighestSuccessRate(r.data)};getEntitiesFollows=async(t,e)=>{let i=g(e)?`/statistics/follows${this.apiSignInUrl}${m()}`:`/statistics/follows${this.apiSignInUrl}`,a="There was a problem fetching follows for entities";return t.footballCompetitions&&(i+=`&competitions=${t.footballCompetitions.join(",")}`),t.footballTeams&&(i+=`&teams=${t.footballTeams.join(",")}`),t.footballPlayers&&(i+=`&players=${t.footballPlayers.join(",")}`),(await this.fetchWithoutAuth(i,a)).data};getUserRankingsForPrivateLeagueAndChallenges=async(t,e,i)=>{let a=`/private-league/users/${t}/rankings${this.apiSignInUrl}&private_league_type=${e==="PRIVATE_LEAGUE"?"private":"one_vs_one"}`,r=`There was a problem fetching user rankings for ${e}`;i&&(a+=`${i.constructFiltersUrl()}`);let o=await this.fetchWithoutAuth(a,r);return e==="PRIVATE_LEAGUE"?this.rankingsRemapper.remapRankingsPrivateLeague(o):this.rankingsRemapper.remapRankingsChallenge(o)};getTemplateBreakdownPoints=async t=>{let e=`/leaderboard/${t}/breakdown${this.apiSignInUrl}`,i=`There was a problem fetching template breakdown points for: ${t}`,a=await this.fetchWithoutAuth(e,i);return this.leaderboardRemapper.remapTemplateBreakdown(a)}};var Rl=class{remapToPrivateLeagues=t=>(t.meta=this.remapMetaPrivateLeagues(t.meta.pagination),t.data=t.data.map(e=>this.remapToPrivateLeagueById(e)),t);remapMetaPrivateLeagues=t=>{let e=new M;return e.pagination.itemsPerPage=t.items_per_page,e.pagination.nextPageStartsAfter=t.next_page_starts_after,e};remapToPrivateLeagueById=t=>{let e=new xs;return e.id=t.id,e.name=t.name,e.description=t.description,e.type=t.type,e.members=t.members,e.administrators=t.administrators,e.banned=t.banned,e.invites=t.invites,e.membersCount=t.members_count,e.usersCanInviteUsers=t.users_can_invite_users,e.invitationCode=t.invitation_code,e.templateId=t.template_id,e.pastTemplates=t.past_templates,e.pinnedPosts=t.pinned_posts,e.scoringStartsAt=t.scoring_starts_at,e};remapToMyPrivateLeagues=t=>{let e=new ti;return e.id=t.id,e.name=t.name,e.description=t.description,e.type=t.type,e.administrators=t.administrators,e.banned=t.banned,e.invites=t.invites,e.membersCount=t.members_count,e.usersCanInviteUsers=t.users_can_invite_users,e.invitationCode=t.invitation_code,e.templateId=t.template_id,e.pastTemplates=t.past_templates,e.pinnedPosts=t.pinned_posts,e.scoringStartsAt=t.scoring_starts_at,e};remapToAcceptPrivateLeague=t=>{let e=new Ls;return e.profileId=t.profile_id,e.leagueId=t.league_id,e.message=t.message,e};remapToAcceptChallenge=t=>{let e=new dr;return e.profileId=t.profile_id,e.challengeId=t.league_id,e.message=t.message,e};remapPredictions=t=>(t.meta=this.remapMeta(t.meta),t.data=this.remapPredictionsData(t.data),t);remapMeta=t=>{let e=new k;return e.pagination.currentPage=t.pagination.current_page,e.pagination.itemsPerPage=t.pagination.items_per_page,e.pagination.numberOfPages=t.pagination.number_of_pages,e.pagination.totalItems=t.pagination.total_items,e};remapPredictionsData=t=>t.map(e=>{let i=new Ds;return i.predictionId=e.prediction_id,i.profileId=e.profile_id,i})};var vi=class{remapToDiscussions=t=>(t.meta=this.remapToMeta(t.meta),t.data=t.data.map(e=>this.remapToDiscussionById(e)),t);remapToDiscussionById=t=>{let e=new br;return e.id=t.id,e.label=t.label,e.status=t.status,e.deleted=t.deleted,e.deletedAt=t.deleted_at,e.deletedBy=t.deleted_by,e.discussionType=t.discussion_type,e.discussionUrl=t.discussion_url,e.moderationType=t.moderation_type,e.postsCount=t.posts_count,e.pinnedPosts=t.pinned_posts,e.lastPostId=t.last_post_id,e.customFields=t.custom_fields,e.context=t.context,e.createdAt=t.created_at,e.updatedAt=t.updated_at,e};remapToPostsForDiscussion=(t,e)=>{let i=new _r,a=new Pr;return i.meta=this.remapToPostMeta(t.meta),i.data=t.data.map(r=>this.remapToPostByIdBasic(r)),a.meta=this.remapToPostMeta(t.meta),a.data=t.data.map(r=>this.remapToPostByIdFull(r)),e==="basic"?i:a};remapToPosts=t=>{let e=new Tr;return e.meta=this.remapToMeta(t.meta),e.data=t.data.map(i=>this.remapToPostByIdBasic(i)),e};remapToPostMeta=t=>{let e=new xt;return e.pagination.totalItems=t.pagination.total_items,e.pagination.nextPageStartsAfter=t.pagination.next_page_starts_after,e.pagination.lastCommentCreateTimestamp=t.pagination.last_comment_create_timestamp,e};remapToMeta=t=>{let e=new M;return e.pagination.itemsPerPage=t.pagination.items_per_page,e.pagination.nextPageStartsAfter=t.pagination.next_page_starts_after,e};remapToPostByIdBasic=t=>{let e=new Le;return e.id=t.id,e.userId=t.user_id,e.discussionId=t.discussion_id,e.content=t.content,e.anonymousNickname=t.anonymous_nickname,e.reactionsCount=t.reactions_count,e.replyId=t.reply_id,e.reactions=t.reactions.length?t.reactions.map(i=>this.remapReactionsPost(i)):t.reactions,e.repliesCount=t.replies_count,e.reports=t.reports.length?t.reports.map(i=>this.remapReportPost(i)):t.reports,e.reportsCount=t.reports_count,e.versions=t.versions.length?t.versions.map(i=>this.remapVersionsPost(i)):t.versions,e.privatePost=t.private_post,e.deleted=t.deleted,e.deletedAt=t.deleted_at,e.deletedBy=t.deleted_by,e.moderated=t.moderated,e.moderatedAt=t.moderated_at,e.moderatedBy=t.moderated_by,e.moderatedReason=t.moderated_reason,e.createdAt=t.created_at,e.updatedAt=t.updated_at,e};remapToPostByIdFull=t=>{let e=new Mr;return e.id=t.id,e.userId=t.user_id,e.discussionId=t.discussion_id,e.content=t.content,e.anonymousNickname=t.anonymous_nickname,e.reactionsCount=t.reactions_count,e.replyId=t.reply_id,e.reactions=t.reactions.length?t.reactions.map(i=>this.remapReactionsPost(i)):t.reactions,e.repliesCount=t.replies_count,e.reports=t.reports.length?t.reports.map(i=>this.remapReportPost(i)):t.reports,e.reportsCount=t.reports_count,e.versions=t.versions.length?t.versions.map(i=>this.remapVersionsPost(i)):t.versions,e.privatePost=t.private_post,e.deleted=t.deleted,e.deletedAt=t.deleted_at,e.deletedBy=t.deleted_by,e.moderated=t.moderated,e.moderatedAt=t.moderated_at,e.moderatedBy=t.moderated_by,e.moderatedReason=t.moderated_reason,e.createdAt=t.created_at,e.updatedAt=t.updated_at,e};remapToPostCount=t=>t.map(e=>{let i=new wr;return i.id=e.id,i.postsCount=e.posts_count,i});remapReactionsPost=t=>{let e=new Er;return e.type=t.type,e.userIds=t.user_ids,e.reactionCount=t.reaction_count,e};remapVersionsPost=t=>{let e=new Fr;return e.content=t.content,e.updatedAt=t.updated_at,e};remapReportPost=t=>{let e=new Rr;return e.userId=t.user_id,e.reason=t.reason,e.reasonDetails=t.reason_details,e}};var Ci=class extends v{remapper=null;discussionsRemapper=null;discussionsBaseURL=null;constructor(t){super(t,O(t.environment,"privateLeagues")),this.discussionsBaseURL=O(t.environment,"discussions"),this.remapper=new Rl,this.discussionsRemapper=new vi}create=async(t,e)=>{let i="/leagues"+this.apiSignInUrl,r=`There was a problem ${e==="PRIVATE_LEAGUE"?"creating private league":"issuing challenge"}`,o="POST",n=await this.fetchWithAuth(i,r,o,t);return this.remapper.remapToPrivateLeagueById(n.data)};update=async(t,e,i)=>{let a=`/leagues/${t}`+this.apiSignInUrl,o=`There was a problem updating ${i==="PRIVATE_LEAGUE"?"private league":"challenge"}`,n="PUT",l=await this.fetchWithAuth(a,o,n,e);return this.remapper.remapToPrivateLeagueById(l.data)};updateLeagueTemplate=async(t,e,i,a)=>{let r=`/leagues/${t}/template`+this.apiSignInUrl,n=`There was a problem updating template for the ${a==="PRIVATE_LEAGUE"?"private league":"challenge"}`,l="POST",p={new_template_id:e,past_template_name:i},c=await this.fetchWithAuth(r,n,l,p);return this.remapper.remapToPrivateLeagueById(c.data)};getById=async(t,e,i)=>{let a=`/leagues/${t}`+this.apiSignInUrl;g(i)&&(a+=m());let o=`There was a problem getting ${e==="PRIVATE_LEAGUE"?"private league":"challenge"}`,n=await this.fetchWithAuth(a,o);return this.remapper.remapToPrivateLeagueById(n.data)};getMyLeagues=async(t,e)=>{let i="/leagues"+this.apiSignInUrl+t.constructFiltersUrl(),r=`There was a problem getting user's ${e==="PRIVATE_LEAGUE"?"private leagues":"challenges"}`;return(await this.fetchWithAuth(i,r)).data.map(n=>this.remapper.remapToMyPrivateLeagues(n))};delete=async(t,e)=>{let i=`/leagues/${t}`+this.apiSignInUrl,r=`There was a problem deleting ${e==="PRIVATE_LEAGUE"?"private league":"challenge"}`,o="DELETE";return await this.fetchWithAuth(i,r,o),!0};invite=async(t,e)=>{let i=`/membership/invite/${t}`+this.apiSignInUrl,a=`There was a problem inviting the following users: ${e.join(",")}`,r="POST",o={profiles:e};return(await this.fetchWithAuth(i,a,r,o)).data};deleteInvitation=async(t,e)=>{let i=`/membership/invite/${t}`+this.apiSignInUrl,a=`There was a problem deleting invitation for the following users: ${e.join(",")}`,r="DELETE",o={profiles:e};return await this.fetchWithAuth(i,a,r,o),!0};accept=async(t,e,i)=>{let a=`/membership/accept/${t}`+this.apiSignInUrl+`&accept=${e?"ACCEPT":"REJECT"}`,o=`There was a problem ${e?"accepting":"rejecting"} invitation for ${i==="PRIVATE_LEAGUE"?"private league":"challenge"}: ${t}`,n="POST",l=await this.fetchWithAuth(a,o,n);return i==="PRIVATE_LEAGUE"?this.remapper.remapToAcceptPrivateLeague(l.data):this.remapper.remapToAcceptChallenge(l.data)};ban=async(t,e)=>{let i=`/membership/ban/${t}`+this.apiSignInUrl,a=`There was a problem banning the following users: ${e.join(",")}`,r="POST",o={profiles:e};return(await this.fetchWithAuth(i,a,r,o)).data};unban=async(t,e)=>{let i=`/membership/unban/${t}`+this.apiSignInUrl,a=`There was a problem unbanning the following users: ${e.join(",")}`,r="POST",o={profiles:e};return(await this.fetchWithAuth(i,a,r,o)).data};join=async t=>{let e="/membership/join"+this.apiSignInUrl+`&invitation_code=${t}`,i="There was a problem joining league",a="POST",r=await this.fetchWithAuth(e,i,a);return this.remapper.remapToAcceptPrivateLeague(r.data)};leave=async(t,e)=>{let i=`/membership/leave/${t}`+this.apiSignInUrl,r=`There was a problem leaving the following ${e==="PRIVATE_LEAGUE"?"league":"challenge"}: ${t}`,o="POST";return(await this.fetchWithAuth(i,r,o)).data};getInvitations=async(t,e)=>{let i="/membership/invitations"+this.apiSignInUrl+e.constructMainFiltersUrl(),r=`There was a problem getting invitations for ${t==="PRIVATE_LEAGUE"?"leagues":"challenges"}`,o=await this.fetchWithAuth(i,r);return this.remapper.remapToPrivateLeagues(o)};getReportedPosts=async(t,e)=>{let i=`/discussions/${t}/posts/reported${this.apiSignInUrl}`,a=`There was a problem fetching posts for the following: ${t}`;e&&(i+=e.constructMainFiltersUrl());let r=await this.fetchWithAuthNewBaseURL(this.discussionsBaseURL,i,a);return this.discussionsRemapper.remapToPostsForDiscussion(r,"full")};getPredictions=async(t,e)=>{let i=`/leagues/${t}/predictions`+this.apiSignInUrl,a=`There was a problem getting predictions for private league: ${t}`;e&&(i+=e.constructFiltersUrl());let r=await this.fetchWithAuth(i,a);return this.remapper.remapPredictions(r)};moderatePost=async(t,e)=>{let i=`/posts/${t}/admin/moderate${this.apiSignInUrl}`,a=`There was a problem moderating the following post: ${t}`,r="POST",o={moderation_reason:e},n=await this.fetchWithAuthNewBaseURL(this.discussionsBaseURL,i,a,r,o);return this.discussionsRemapper.remapToPostByIdBasic(n.data)}};var Ai=class{createRequestBodyFromParam=(t,e)=>{let i=e==="PRIVATE"?new Gs:new mr;return i.name=t.name,i.description=t.description,i.invitation_code=t.invitationCode,i.template_id=t.templateId,i.users_can_invite_users=t.usersCanInviteUsers,t.administrators?i.administrators=t.administrators:delete i.administrators,t.scoringStartsAt?i.scoring_starts_at=t.scoringStartsAt:delete i.scoring_starts_at,i};createUpdateRequestBodyFromParam=(t,e)=>{let i=e==="PRIVATE"?new Us:new hr;return i.name=t.name,i.description=t.description,i.invitation_code=t.invitationCode,i.template_id=t.templateId,i.users_can_invite_users=t.usersCanInviteUsers,i.administrators=t.administrators,i.pinned_posts=t.pinnedPosts,i.scoring_starts_at=t.scoringStartsAt,i}};var Fl=class{ALL_FINISHED_STATUSES=["finished","cancelled","interrupted","abandoned","finished_after_awarded_win","finished_aet","finished_ap","finished_asg","to_finish"];ALL_UPCOMING_STATUSES=["not_started","kick_off_delayed"];ALL_LIVE_STATUSES=["1st_half","2nd_half","halftime","waiting_for_penalty","waiting_for_extra_time","penalty","pause","extra_time_1st_half","extra_time_2nd_half","extra_time_end_of_1st_half","awaiting_info"];getMatchEventStatus(t){if(!t||!t.type||!t.subType)return"no_info_yet";let e=t.type.toLowerCase(),i=t.subType.toLowerCase();return e==="finished"?i==="awarded_win"?"finished_after_awarded_win":i==="aet"?"finished_aet":i==="ap"?"finished_ap":i==="asg"?"finished_asg":"finished":e==="notstarted"?i==="postponed"?"postponed":i==="delayed"?"kick_off_delayed":"not_started":e==="inprogress"?i==="1st_half"?"1st_half":i==="2nd_half"?"2nd_half":i==="halftime"?"halftime":i==="penalty"?"penalty":i==="waiting_penalty"?"waiting_for_penalty":i==="pause"?"pause":i==="extra_time_1st_half"?"extra_time_1st_half":i==="extra_time_2nd_half"?"extra_time_2nd_half":i==="extra_time_halftime"?"extra_time_end_of_1st_half":i==="waiting_extra_time"?"waiting_for_extra_time":"awaiting_info":e==="interrupted"?i==="abandoned"?"abandoned":i==="to_finish"?"to_finish":"interrupted":e==="cancelled"?"cancelled":"no_info_yet"}isUpcoming(t){if(!t)return!1;let e=this.getMatchEventStatus(t);return this.ALL_UPCOMING_STATUSES.includes(e)}isLive(t){if(!t)return!1;let e=this.getMatchEventStatus(t);return this.ALL_LIVE_STATUSES.includes(e)}isFinished(t){if(!t)return!1;let e=this.getMatchEventStatus(t);return this.ALL_FINISHED_STATUSES.includes(e)}};var Sl=class{matchStatusHelper;constructor(){this.matchStatusHelper=new Fl}getMatchStatusEnum(t){return this.matchStatusHelper.getMatchEventStatus(t)}isMatchUpcoming(t){return this.matchStatusHelper.isUpcoming(t)}isMatchLive(t){return this.matchStatusHelper.isLive(t)}isMatchFinished(t){return this.matchStatusHelper.isFinished(t)}};var tt=class{https=null;idMapping=null;localCache=null;footballFacade=null;footballHelpers;constructor(t){this.https=new ct(t),this.idMapping=new R(t),this.localCache=new pt().createLocalCacheInstance(t.idSchema),this.footballFacade=new Ei(t,this.localCache,this.https,this.idMapping),this.footballHelpers=new Sl}getCountries=async t=>await this.footballFacade.getCountries(t);getCompetitions=async(t,e)=>await this.footballFacade.getCompetitions(t,e);getCompetitionById=async(t,e)=>await this.footballFacade.getCompetitionById(t,e);getTopCompetitions=async t=>await this.footballFacade.getTopCompetitions(t);getTeams=async(t,e)=>await this.footballFacade.getTeams(t,e);getTeamById=async(t,e)=>await this.footballFacade.getTeamById(t,e);getTopTeams=async t=>await this.footballFacade.getTopTeams(t);getNextMatchForTeam=async(t,e)=>await this.footballFacade.getNextMatchForTeam(t,e);getPrevMatchForTeam=async(t,e)=>await this.footballFacade.getPrevMatchForTeam(t,e);getPlayers=async(t,e)=>await this.footballFacade.getPlayers(t,e);getPlayerById=async(t,e)=>await this.footballFacade.getPlayerById(t,e);getTopPlayers=async t=>await this.footballFacade.getTopPlayers(t);getNextMatchForPlayer=async(t,e)=>await this.footballFacade.getNextMatchForPlayer(t,e);getPrevMatchForPlayer=async(t,e)=>await this.footballFacade.getPrevMatchForPlayer(t,e);getMatches=async(t,e)=>await this.footballFacade.getMatches(t,e);getMatchById=async(t,e)=>await this.footballFacade.getMatchById(t,e);search=async(t,e)=>await this.footballFacade.search(t,e);getTeamForm=async(t,e,i)=>await this.footballFacade.getTeamForm(t,e,i);get helpers(){return this.footballHelpers}};var vl=class{matchFacade=null;playerFacade=null;predictorService=null;constructor(t,e,i){this.matchFacade=t,this.playerFacade=e,this.predictorService=i}remapFixturesRequest=t=>{let e={};if(e.match_id=t.matchId,e.match_type="FOOTBALL",t instanceof ot)e.market=t.market,e.prediction=t.prediction.value,e.player_id=t.prediction.playerId;else if(t instanceof Ye||t instanceof Xe)e.market=t.market,e.prediction=t.prediction.value;else if(t instanceof Nt){e.market=t.market;let i=t.prediction.value.split(":");e.goals_home=Number(i[0]),e.goals_away=Number(i[1])}else e.market=t.market,e.prediction=t.prediction.value;return e};remapFixturesResponse=async t=>{let e="OWN_GOAL",i=[],a=[],r=null,o=[];t.length>1&&t.sort((l,p)=>l.match_id.localeCompare(p.match_id));for(let l of t)i.push(l.match_id),l.player_id&&!a.includes(l.player_id)&&a.push(l.player_id);let n=await this.matchFacade.getMatchesMapWithNativeIds(i);a.sort((l,p)=>l.localeCompare(p)),a&&a.length>0&&!a.includes(e)&&(r=await this.playerFacade.getPlayersMapWithNativeIds(a));for(let l of t){let p=new Ke;l.target?p.market=this.predictorService.convertMarketForResponseModel(l.market,l.target):p.market=l.market,p.matchId=n[l.match_id].id,p.matchType=l.match_type,p.matchModel=n?n[l.match_id]:null,delete p.matchModel.availableMarkets,l.prediction!==void 0?p.prediction.value=l.prediction:l.goals_home!==void 0&&l.goals_away!==void 0&&(p.prediction.value=l.goals_home.toString()+":"+l.goals_away.toString()),p.prediction.playerId=l.player_id?l.player_id:null,l.market==="PLAYER_PERFORMANCE"&&(p.prediction.playerRole=l.role),p.prediction.playerId&&p.prediction.playerId!==e&&(p.prediction.playerModel=r[l.player_id],p.prediction.playerId=r[l.player_id].id),p.result=this.remapResult(l.result),o.push(p)}return o};remapResult=t=>{let e=new je;return e.settledAt=t.settled_at,e.resettledAt=t.resettled_at,e.status=t.status,e.outcome=t.outcome,e.points=t.points,e}};var Rc=class{constructor(){}static createMatchMarketsResultsModel(t,e){return{FT_1X2:this.createOneXTwoResult(t.scores,"full_time"),HT_1X2:this.createOneXTwoResult(t.scores,"half_time"),BOTH_TEAMS_SCORE:t.scores.ftScore.homeGoals>0&&t.scores.ftScore.awayGoals>0,DOUBLE_CHANCE:this.createDoubleChanceResult(t.scores),HT_FT:this.createHalfTimeFullTimeResult(t.scores),RED_CARD_MATCH:this.createMarketResultByCriteria(t,"red_card"),PENALTY_MATCH:this.createMarketResultByCriteria(t,"penalty"),CORNERS_MATCH:isNaN(t.stats?.corners?.homeTeam+t.stats?.corners?.awayTeam)?null:t.stats.corners.homeTeam+t.stats.corners.awayTeam,PLAYER_YELLOW_CARD:this.createPlayersMarketsResults(t,e,"yellow_card"),PLAYER_RED_CARD:this.createPlayersMarketsResults(t,e,"red_card"),PLAYER_SCORE_FIRST_GOAL:this.createPlayersMarketsResults(t,e,"first_goal"),PLAYER_SCORE:this.createPlayersMarketsResults(t,e,"one_goal"),PLAYER_SCORE_TWICE:this.createPlayersMarketsResults(t,e,"two_goals"),PLAYER_SCORE_HATTRICK:this.createPlayersMarketsResults(t,e,"hattrick"),CORRECT_SCORE:{homeGoals:t.scores.ftScore.homeGoals,awayGoals:t.scores.ftScore.awayGoals},CORRECT_SCORE_ADVANCED:{homeGoals:t.scores.ftScore.homeGoals,awayGoals:t.scores.ftScore.awayGoals},CORRECT_SCORE_HT:{homeGoals:t.scores.htScore.homeGoals,awayGoals:t.scores.htScore.awayGoals},OVER_GOALS_0_5:t.scores.ftScore.homeGoals+t.scores.ftScore.awayGoals>0,OVER_GOALS_1_5:t.scores.ftScore.homeGoals+t.scores.ftScore.awayGoals>1,OVER_GOALS_2_5:t.scores.ftScore.homeGoals+t.scores.ftScore.awayGoals>2,OVER_GOALS_3_5:t.scores.ftScore.homeGoals+t.scores.ftScore.awayGoals>3,OVER_GOALS_4_5:t.scores.ftScore.homeGoals+t.scores.ftScore.awayGoals>4,OVER_GOALS_5_5:t.scores.ftScore.homeGoals+t.scores.ftScore.awayGoals>5,OVER_GOALS_6_5:t.scores.ftScore.homeGoals+t.scores.ftScore.awayGoals>6,OVER_CORNERS_6_5:isNaN(t.stats?.corners?.homeTeam+t.stats?.corners?.awayTeam)?null:t.stats.corners.homeTeam+t.stats.corners.awayTeam>6,OVER_CORNERS_7_5:isNaN(t.stats?.corners?.homeTeam+t.stats?.corners?.awayTeam)?null:t.stats.corners.homeTeam+t.stats.corners.awayTeam>7,OVER_CORNERS_8_5:isNaN(t.stats?.corners?.homeTeam+t.stats?.corners?.awayTeam)?null:t.stats.corners.homeTeam+t.stats.corners.awayTeam>8,OVER_CORNERS_9_5:isNaN(t.stats?.corners?.homeTeam+t.stats?.corners?.awayTeam)?null:t.stats.corners.homeTeam+t.stats.corners.awayTeam>9,OVER_CORNERS_10_5:isNaN(t.stats?.corners?.homeTeam+t.stats?.corners?.awayTeam)?null:t.stats.corners.homeTeam+t.stats.corners.awayTeam>10,OVER_CORNERS_11_5:isNaN(t.stats?.corners?.homeTeam+t.stats?.corners?.awayTeam)?null:t.stats.corners.homeTeam+t.stats.corners.awayTeam>11,OVER_CORNERS_12_5:isNaN(t.stats?.corners?.homeTeam+t.stats?.corners?.awayTeam)?null:t.stats.corners.homeTeam+t.stats.corners.awayTeam>12,OVER_CORNERS_13_5:isNaN(t.stats?.corners?.homeTeam+t.stats?.corners?.awayTeam)?null:t.stats.corners.homeTeam+t.stats.corners.awayTeam>13}}},Ft=Rc;et(Ft,"createOneXTwoResult",(t,e)=>e==="full_time"?t.ftScore.homeGoals>t.ftScore.awayGoals?"1":t.ftScore.homeGoals===t.ftScore.awayGoals?"x":"2":t?.htScore?.homeGoals>t?.htScore?.awayGoals?"1":t?.htScore?.homeGoals===t?.htScore?.awayGoals?"x":"2"),et(Ft,"createDoubleChanceResult",t=>t?.ftScore?.homeGoals>t?.ftScore?.awayGoals?["1x","12"]:t?.ftScore?.homeGoals===t?.ftScore?.awayGoals?["1x","x2"]:["x2","12"]),et(Ft,"createHalfTimeFullTimeResult",t=>{if(t?.htScore?.homeGoals>t?.htScore?.awayGoals){if(t?.ftScore?.homeGoals>t?.ftScore?.awayGoals)return"1/1";if(t?.ftScore?.homeGoals===t?.ftScore?.awayGoals)return"1/x";if(t?.ftScore?.homeGoals<t?.ftScore?.awayGoals)return"1/2"}if(t?.htScore?.homeGoals===t?.htScore?.awayGoals){if(t?.ftScore?.homeGoals>t?.ftScore?.awayGoals)return"x/1";if(t?.ftScore?.homeGoals===t?.ftScore?.awayGoals)return"x/x";if(t?.ftScore?.homeGoals<t?.ftScore?.awayGoals)return"x/2"}if(t?.htScore?.homeGoals<t?.htScore?.awayGoals){if(t?.ftScore?.homeGoals>t?.ftScore?.awayGoals)return"2/1";if(t?.ftScore?.homeGoals===t?.ftScore?.awayGoals)return"2/x";if(t?.ftScore?.homeGoals<t?.ftScore?.awayGoals)return"2/2"}}),et(Ft,"createMarketResultByCriteria",(t,e)=>!t.timeline||!t.timeline.length?null:e==="red_card"?t.timeline.filter(i=>Number(i.minute)<=90).some(i=>i.type==="red_card"):t.timeline.filter(i=>Number(i.minute)<=90).some(i=>i.type.startsWith(e))),et(Ft,"createPlayersMarketsResults",(t,e,i)=>{if(!t.timeline||!t.timeline.length)return i==="first_goal"?null:[];if(i==="first_goal"){let n=t.timeline.find(l=>l.type==="goal"||l.type==="penalty_goal"||l.type==="own_goal")||null;if(n){let l=e[n.player.id];return{playerId:n.type==="goal"||n.type==="penalty_goal"?n.player.id:"OWN_GOAL",playerModel:l}}return null}if(i==="yellow_card"||i==="red_card")return Rc.transformPlayerMarketResult(t.timeline.filter(n=>Number(n.minute)<=90).filter(n=>n.type===i).map(n=>e[n.player.id]));let a=new Map,r=i==="one_goal"?1:i==="two_goals"?2:3,o=[];return t.timeline.filter(n=>Number(n.minute)<=90).filter(n=>n.type==="goal"||n.type==="penalty_goal").forEach(n=>{let l=e[n.player.id];if(a.has(n.player.id)){let p=a.get(n.player.id);p.push(l),a.set(n.player.id,p)}else a.set(n.player.id,[l])}),a.forEach(n=>{n.length>=r&&o.push(n[0])}),Rc.transformPlayerMarketResult(o)}),et(Ft,"transformPlayerMarketResult",t=>t.map(e=>({playerId:e.id,playerModel:e})));var St=class{footballHttps=null;idMapping=null;matchFacade=null;playerFacade=null;profileNamespace=null;constructor(t,e){this.footballHttps=new ct(t),this.idMapping=e,this.matchFacade=new jt(t,this.footballHttps,e),this.playerFacade=new Kt(t,this.footballHttps,e),this.profileNamespace=new D(t)}remapMatchIdToNative=async t=>(await this.idMapping.getEntityIdsBySchemaId(t,"match","native")).match;remapPlayerIdToNative=async t=>(await this.idMapping.getEntityIdsBySchemaId(t,"player","native")).player[0];remapPlayerIdMapToNative=async t=>{let e={},i=oe(t),r=(await this.idMapping.getEntityIdsBySchemaId(i,"player","native")).player;return i.forEach((o,n)=>e[o]=r[n]),e};remapPlayerIdToIdSchema=async t=>{let e=["playerScore","playerYellowCard","playerRedCard","playerScoreFirstGoal","playerScoreHattrick","playerScoreTwice"],i=[];for(let[r,o]of Object.entries(t))if(e.includes(r))for(let n of Object.keys(o))n!=="NOBODY"&&n!=="OWN_GOAL"&&i.push(n);if(!i.length)return t;let a=await this.playerFacade.getPlayersMapWithNativeIds(i);for(let[r,o]of Object.entries(t))if(e.includes(r))for(let n of Object.keys(o))n!=="NOBODY"&&n!=="OWN_GOAL"&&(o[a[n].id]=o[n],o[a[n].id].model=a[n],this.idMapping.idSchema!=="native"&&delete o[n]);return t};convertMarketForResponseModel=(t,e)=>{let i=e.toString();return t+"_"+i};getMarketSummary=async(t,e,i)=>{let a=Zc.get(e),r={};if(r.matchId=t.matchId,r.matchType=t.matchType,Object.keys(t.predictions).includes(a))r[a]=t.predictions[a];else throw new Error("You have passed invalid market");if(Mt.includes(e)&&i){let n="";if(i!=="OWN_GOAL"&&i!=="NOBODY"&&(n=(await this.idMapping.idMappingFacade.getEntitiesByIds({player:[i]},this.idMapping.idSchema,"native")).player[0]),n&&r[a][n]){let l=await this.playerFacade.getPlayersMapWithNativeIds([n]);return r[a][n].model=l[n],r[a][n]}else return n?(r[a][n]=new x,r[a][n]):r[a][i]}else if(Mt.includes(e)&&!i){let n=Object.keys(r[a]).filter(p=>p!=="NOBODY"&&p!=="OWN_GOAL"),l=n.length?await this.playerFacade.getPlayersMapWithNativeIds(n):{};Object.keys(l).length&&Object.keys(r[a]).forEach(p=>{p!=="NOBODY"&&p!=="OWN_GOAL"&&(r[a][l[p].id]=r[a][p],r[a][l[p].id].model=l[p],this.idMapping.idSchema!=="native"&&delete r[a][p])})}return r};remapCompetitionsFromConfig=async t=>{if(t instanceof Ee){let e={competition:t.fullCoverageCompetitions},i={competition:t.successRateScopes.competitions},a={team:t.successRateScopes.teams},r=await this.idMapping.idMappingFacade.getEntitiesByIds(e,"native",this.idMapping.idSchema),o=await this.idMapping.idMappingFacade.getEntitiesByIds(i,"native",this.idMapping.idSchema),n=await this.idMapping.idMappingFacade.getEntitiesByIds(a,"native",this.idMapping.idSchema);return t.fullCoverageCompetitions=r.competition,t.successRateScopes.competitions=o.competition,t.successRateScopes.teams=n.team,t}if(t instanceof Te||t instanceof Pe){let e={competition:t.competitionsWhitelist},i=await this.idMapping.idMappingFacade.getEntitiesByIds(e,"native",this.idMapping.idSchema);return t.competitionsWhitelist=i.competition,t}};remapMatchIdsFixtures=async t=>{if(Array.isArray(t.data))if(t.data.length>0){let e=[],i=[];return t.data.forEach(a=>{a instanceof Tt||a instanceof kt||a instanceof Pt||a instanceof ri?(a.fixtures.forEach(r=>e.push(r.matchId)),a instanceof Pt&&a.fixtures.forEach(r=>{r.prediction.playerId&&r.prediction.playerId!=="OWN_GOAL"&&i.push(r.prediction.playerId)})):a instanceof Qt&&a.results.forEach(r=>e.push(r.matchId))}),await this.refactorResponseArrModel(t,e,i)}else return t;else return await this.refactorResponseObjModel(t)};refactorResponseArrModel=async(t,e,i)=>{let a=[],r=await this.matchFacade.getMatchesMapWithNativeIds(e),o={};return i.length>0&&(o=await this.playerFacade.getPlayersMapWithNativeIds(i)),t.data.forEach(n=>{n instanceof Tt||n instanceof kt||n instanceof Pt?(n.fixtures.forEach(l=>{this.handleMatchModel(r,l),n instanceof Pt&&l.prediction.playerId&&l.prediction.playerId!=="OWN_GOAL"&&(l.prediction.playerModel=o[l.prediction.playerId],l.prediction.playerId=o[l.prediction.playerId].id)}),a.push(n)):n instanceof Qt&&(n.results.forEach(l=>{l.matchModel=r[l.matchId],delete l.matchModel.availableMarkets,l.matchId=l.matchModel.id}),a.push(n))}),t.data=a,t};refactorResponseObjModel=async t=>{let e=[];t.fixtures.forEach(a=>e.push(a.matchId));let i=await this.matchFacade.getMatchesMapWithNativeIds(e);return t.fixtures.forEach(a=>this.handleMatchModel(i,a)),t};getCurrentGameId=t=>{let e=new Date;if(t.data.length>1){let i=[];return t.data.forEach(r=>i.push(r.predictionsCutoff)),t.data.sort((r,o)=>{let[n,l]=[r.predictionsCutoff,o.predictionsCutoff].map(p=>Math.abs(new Date(p)-e));return n-l})[0].id}else return t.data[0].id};initGameTypePredictions=(t,e)=>{let i={type:t,limit:null,startAfter:null};return e&&(i={...i,limit:e.limit,startAfter:e.startAfter}),i=new V(i),i};initGameFilters=(t,e,i)=>{if(e&&i)return e.type=t,e.gameIds=i,e=new st(e),e;if(e&&!i)return e.type=t,e=new st(e),e;if(!e&&i){let a={type:t,gameIds:i};return a=new st(a),a}else{let a={type:t};return a=new st(a),a}};addPredictionProp=async(t,e)=>(e.data.forEach(i=>{let a=i.fixtures.map(r=>r.matchId);t.data.forEach(r=>{i.id===r.game_instance_id&&(i.fixtures.sort((o,n)=>o.matchId.localeCompare(n.matchId)),r.fixtures.sort((o,n)=>o.match_id.localeCompare(n.match_id)),i.predictionId=r.id,i.outcome=r.status,i.fixtures.forEach((o,n)=>{r.fixtures[n].goals_home!==void 0&&r.fixtures[n].goals_away!==void 0?o.prediction.value=r.fixtures[n].goals_home+":"+r.fixtures[n].goals_away:o.prediction.value=r.fixtures[n].prediction,r.fixtures[n].player_id?o.prediction.playerId=r.fixtures[n].player_id:r.fixtures[n].target&&(o.prediction.target=r.fixtures[n].target),o.prediction.result=this.remapResult(r.fixtures[n].result)}),i.predictionsMadeAt=r.created_at,i.predictionsUpdatedAt=r.profile_last_updated_at,i.points=r.points,i instanceof kt&&(r.tiebreaker?i.predictionTiebreaker.goldenGoal=r.tiebreaker.golden_goal:i.predictionTiebreaker=r.tiebreaker))}),i.fixtures.sort((r,o)=>a.indexOf(r.matchId)-a.indexOf(o.matchId))}),e.meta.pagination.nextPageStartsAfter=t.meta.pagination.next_page_starts_after,await this.remapMatchIdsFixtures(e));remapResult=t=>{let e=new je;return e.settledAt=t.settled_at,e.resettledAt=t.resettled_at,e.status=t.status,e.outcome=t.outcome,e.points=t.points,e};areIdsExceeded=t=>t.length>10;initPredictionsFilters=(t,e,i)=>{switch(e){case"user":t&&(t=new V(t));break;case"current":if(t)this.deleteUnexpectedProperties(t),t.status=["ACTIVE"],t=new V(t);else{let a={status:["ACTIVE"]};t=new V(a)}break;case"past":if(t)this.deleteUnexpectedProperties(t),t.status=Wc,t=new V(t);else{let a={status:Wc};t=new V(a)}break;case"matches":if(t)this.deleteUnexpectedProperties(t),t.matchIds=i,t=new V(t);else{let a={matchIds:i};t=new V(a)}break}return t};completeGameMarketResults=async(t,e)=>{switch(e){case"MATCH_QUIZ":let i={},a=t.results[0].matchId,r=t.results.map(p=>Mt.includes(p.market)&&!p.result.includes("OWN_GOAL")?[...p.result]:[]).flat(),o=await this.matchFacade.getMatchesMapWithNativeIds([a]);return r.length&&(i=await this.playerFacade.getPlayersMapWithNativeIds(r)),t.results=t.results.map(p=>{if(p.matchModel=o[p.matchId]?o[p.matchId]:null,p.playerModels&&Object.keys(i).length&&p.result.forEach(u=>{let d=i[u];p.playerModels.push(d)}),this.idMapping.idSchema!=="native"&&(this.remapMatchIdForResultsMarkets(o,p),p.playerModels&&Object.keys(i).length)){let c=p.result;p.result=c.map(u=>i[u].id)}return p}),t;case"TOP_X":let n=t.results.map(p=>p.matchId),l=await this.matchFacade.getMatchesMapWithNativeIds(n);if(t.results=t.results.map(p=>(p.matchModel=l[p.matchId]?l[p.matchId]:null,this.idMapping.idSchema!=="native"&&this.remapMatchIdForResultsMarkets(l,p),p)),t.tieBreakers.goldenGoals.length){let p=t.tieBreakers.goldenGoals.map(u=>u.playerId),c=await this.playerFacade.getPlayersMapWithNativeIds(p);t.tieBreakers.goldenGoals=t.tieBreakers.goldenGoals.map(u=>(u.matchModel=l[u.matchId],u.playerModel=c[u.playerId],this.idMapping.idSchema!=="native"&&(u.matchId=l[u.matchId].id,u.playerId=c[u.playerId].id),u))}return t}};completeContestWinners=async t=>{if(t.userList&&t.userList.length){let e=t.userList.map(a=>a.profileId),i=await this.profileNamespace.getByIds(e);t.userList.forEach(a=>{let r=i.filter(o=>o.id===a.profileId)[0];delete r.interests,a.profileModel=r})}return t};handleMatchModel=(t,e)=>{t[e.matchId]?(e.matchModel=t[e.matchId],delete e.matchModel.availableMarkets,e.matchId=e.matchModel.id):(e.matchModel=null,this.idMapping.idSchema!=="native"&&this.idMapping.idMappingFacade.getEntityById(e.matchId,"match","native").then(i=>{e.matchId=i[G[this.idMapping.idSchema]]}))};remapMatchIdForResultsMarkets=(t,e)=>{t[e.matchId]?e.matchId=t[e.matchId].id:this.idMapping.idMappingFacade.getEntityById(e.matchId,"match","native").then(i=>{e.matchId=i[G[this.idMapping.idSchema]]})};deleteUnexpectedProperties=t=>(t.status&&(console.warn(Lc.UNEXPECTED_STATUS_PROP),delete t.status),t.type&&(console.warn(Lc.UNEXPECTED_TYPE_PROP),delete t.type),t);getMatchMarketsResults=async t=>{let e=await this.footballHttps.getMatchById(t,!0);if(e.status.type!=="finished"||!e.finishedAt)return new Cs;let i=[];e.timeline.filter(r=>Number(r.minute)<=90).filter(r=>r.type==="goal"||r.type==="penalty_goal"||r.type==="yellow_card"||r.type==="red_card").forEach(r=>{i.push(r.player.id)});let a={};return i.length&&(a=await this.playerFacade.getPlayersMapWithNativeIds(i)),Ft.createMatchMarketsResultsModel(e,a)}};var Oi=class{fixturesRemapper=null;footballHttps=null;matchFacade=null;playerFacade=null;predictorService=null;constructor(t,e){this.footballHttps=new ct(t),this.matchFacade=new jt(t,this.footballHttps,e),this.playerFacade=new Kt(t,this.footballHttps,e),this.predictorService=new St(t,e),this.fixturesRemapper=new vl(this.matchFacade,this.playerFacade,this.predictorService)}remapRequestBody=t=>{if(t instanceof xe)return t;let e={};return e.game_instance_id=t.gameInstanceId,e.fixtures=t.fixtures.map(i=>this.fixturesRemapper.remapFixturesRequest(i)),t instanceof oi&&t.tiebreaker&&(e.tiebreaker={},e.tiebreaker.golden_goal=t.tiebreaker.goldenGoal?t.tiebreaker.goldenGoal:null),e};remapResponseArrayBody=async t=>{if(t.length){let e="OWN_GOAL",i=[],a=[],r={},o=[];t.forEach(l=>{l.fixtures.forEach(p=>{i.push(p.match_id),p.player_id&&p.player_id!==e&&a.push(p.player_id)})});let n=await this.matchFacade.getMatchesMapWithNativeIds(i);return a.length>0&&(r=await this.playerFacade.getPlayersMapWithNativeIds(a)),t.forEach(l=>{let p=new Ti,c=[];p.id=l.id,p.gameInstanceId=l.game_instance_id,p.gameType=l.game_type,p.wager=l.wager,p.totalFixtures=l.total_fixtures,p.settledFixtures=l.settled_fixtures,p.userId=l.user_id,p.templateId=l.template_id,p.groupId=l.group_id,p.profileLastUpdatedAt=l.profile_last_updated_at,l.fixtures.forEach(u=>{let d=new Ke;u.target?d.market=this.predictorService.convertMarketForResponseModel(u.market,u.target):d.market=u.market,d.matchId=n[u.match_id].id,d.matchType=u.match_type,d.matchModel=n[u.match_id],delete d.matchModel.availableMarkets,u.prediction!==void 0?d.prediction.value=u.prediction:u.goals_home!==void 0&&u.goals_away!==void 0&&(d.prediction.value=u.goals_home.toString()+":"+u.goals_away.toString()),d.prediction.playerId=u.player_id?u.player_id:null,d.prediction.playerId&&d.prediction.playerId!==e&&(d.prediction.playerModel=r[d.prediction.playerId],d.prediction.playerId=r[d.prediction.playerId].id),u.market==="PLAYER_PERFORMANCE"&&(d.prediction.playerRole=u.role),d.result=this.fixturesRemapper.remapResult(u.result),c.push(d)}),p.fixtures=c,p.status=l.status,l.tiebreaker?p.tiebreaker.goldenGoal=l.tiebreaker.golden_goal:p.tiebreaker=null,p.points=l.points,p.createdAt=l.created_at,p.updatedAt=l.updated_at,o.push(p)}),o}return t};remapResponseObjBody=async t=>{let e=new Ti;return e.id=t.id,e.gameInstanceId=t.game_instance_id,e.gameType=t.game_type,e.wager=t.wager,e.totalFixtures=t.total_fixtures,e.settledFixtures=t.settled_fixtures,e.userId=t.user_id,e.templateId=t.template_id,e.groupId=t.group_id,e.profileLastUpdatedAt=t.profile_last_updated_at,e.fixtures=await this.fixturesRemapper.remapFixturesResponse(t.fixtures),e.status=t.status,t.tiebreaker?e.tiebreaker.goldenGoal=t.tiebreaker.golden_goal:e.tiebreaker=null,e.points=t.points,e.createdAt=t.created_at,e.updatedAt=t.updated_at,e};remapPredictionModel=t=>{let e=new As;return e.fullTimeOneXTwo=t.FT_1X2,e.halfTimeOneXTwo=t.HT_1X2,e.bothTeamsScore=t.BOTH_TEAMS_SCORE,e.overZeroPointFiveGoals=t.OVER_GOALS_0_5,e.overOnePointFiveGoals=t.OVER_GOALS_1_5,e.overTwoPointFiveGoals=t.OVER_GOALS_2_5,e.overThreePointFiveGoals=t.OVER_GOALS_3_5,e.overFourPointFiveGoals=t.OVER_GOALS_4_5,e.overFivePointFiveGoals=t.OVER_GOALS_5_5,e.overSixPointFiveGoals=t.OVER_GOALS_6_5,e.overSixPointFiveCorners=t.OVER_CORNERS_6_5,e.overSevenPointFiveCorners=t.OVER_CORNERS_7_5,e.overEightPointFiveCorners=t.OVER_CORNERS_8_5,e.overNinePointFiveCorners=t.OVER_CORNERS_9_5,e.overTenPointFiveCorners=t.OVER_CORNERS_10_5,e.overElevenPointFiveCorners=t.OVER_CORNERS_11_5,e.overTwelvePointFiveCorners=t.OVER_CORNERS_12_5,e.overThirteenPointFiveCorners=t.OVER_CORNERS_13_5,e.doubleChance=t.DOUBLE_CHANCE,e.halfTimeFullTime=t.HT_FT,e.playerScore=t.PLAYER_SCORE,e.playerYellowCard=t.PLAYER_YELLOW_CARD,e.playerRedCard=t.PLAYER_RED_CARD,e.redCardMatch=t.RED_CARD_MATCH,e.penaltyMatch=t.PENALTY_MATCH,e.playerScoreFirstGoal=t.PLAYER_SCORE_FIRST_GOAL,e.cornersMatch=t.CORNERS_MATCH,e.correctScore=t.CORRECT_SCORE,e.correctScoreHalfTime=t.CORRECT_SCORE_HT,e.correctScoreAdvanced=t.CORRECT_SCORE_ADVANCED,e.playerScoreHattrick=t.PLAYER_SCORE_HATTRICK,e.playerScoreTwice=t.PLAYER_SCORE_TWICE,e}};var Cl=class{remapPredictions=null;constructor(t,e){this.remapPredictions=new Oi(t,e)}remapResponse=t=>{let e=new Os;return e.matchId=t.match_id,e.matchType=t.match_type,e.predictions=this.remapPredictions.remapPredictionModel(t.predictions),e}};var Al=class extends ut{remapPaginatedGames=t=>{let e=new H;return e.meta.pagination.nextPageStartsAfter=t.meta.pagination.next_page_starts_after,e.meta.pagination.itemsPerPage=t.meta.pagination.items_per_page,e.data=t.data.map(i=>this.remapGamesListResponse(i)),e};remapGamesListResponse=t=>{let e=new Tt;return e.id=t.id,e.title=t.title,e.description=t.description,e.type=t.type,e.status=t.status,e.authRequirement=t.auth_requirement||null,e.scheduleOpenAt=t.schedule_open_at,e.predictionsCutoff=t.predictions_cutoff,e.fixtures=t.fixtures.map(i=>this.remapFixturesResponse(i)),e.tiebreaker=t.tiebreaker?this.remapTimeTiebreaker(t.tiebreaker.time_tiebreaker):null,e.participantsCount=t.participants_count,e.related=t.related?this.remapRelated(t.related):[],e.excludedProfileIds=t.excluded_profile_ids,e.rules=t.rules,e.labels=t.labels,e.customFields=t.custom_fields,e.branding=t.branding?this.remapBranding(t.branding):null,e.flags=t.flags,e.images=t.images,e.createdAt=t.created_at,e.updatedAt=t.updated_at,e};remapGameByIdResponse=t=>{let e=new ri;return e.id=t.id,e.title=t.title,e.description=t.description,e.type=t.type,e.status=t.status,e.authRequirement=t.auth_requirement||null,e.scheduleOpenAt=t.schedule_open_at,e.predictionsCutoff=t.predictions_cutoff,e.fixtures=t.fixtures.map(i=>this.remapFixturesResponse(i)),e.tiebreaker=t.tiebreaker?this.remapTimeTiebreaker(t.tiebreaker.time_tiebreaker):null,e.participantsCount=t.participants_count,e.related=t.related?this.remapRelated(t.related):[],e.excludedProfileIds=t.excluded_profile_ids,e.rules=t.rules,e.flags=t.flags,e.adContent=t.ad_content,e.labels=t.labels,e.customFields=t.custom_fields,e.branding=t.branding?this.remapBranding(t.branding):null,e.images=t.images,e.createdAt=t.created_at,e.updatedAt=t.updated_at,e};remapFixturesResponse=t=>{let e=new qs;return e.matchId=t.match_id,e.matchType=t.match_type,e.market=t.market,e.matchStatus.type=t.match_status?t.match_status.type:null,e.matchStatus.subType=t.match_status?t.match_status.sub_type:null,e};remapPaginatedUserTopXEditions=t=>{let e=new H;return e.meta.pagination.nextPageStartsAfter=t.meta.pagination.next_page_starts_after,e.meta.pagination.itemsPerPage=t.meta.pagination.items_per_page,e.data=t.data.map(i=>this.remapUserTopXEditionsResponse(i)),e};remapUserTopXEditionsResponse=t=>{let e=new kt;return e.id=t.id,e.title=t.title,e.description=t.description,e.type=t.type,e.status=t.status,e.authRequirement=t.auth_requirement||null,e.predictionsCutoff=t.predictions_cutoff,e.scheduleOpenAt=t.schedule_open_at,e.fixtures=t.fixtures.map(i=>this.remapTopXFixturesResponse(i)),e.tiebreaker=t.tiebreaker?this.remapTimeTiebreaker(t.tiebreaker.time_tiebreaker):null,e.participantsCount=t.participants_count,e.related=t.related?this.remapRelated(t.related):[],e.excludedProfileIds=t.excluded_profile_ids,e.rules=t.rules,e.flags=t.flags,e.images=t.images,e.branding=t.branding?this.remapBranding(t.branding):null,e.createdAt=t.created_at,e.updatedAt=t.updated_at,e};remapTopXFixturesResponse=t=>{let e=new Qs;return e.matchId=t.match_id,e.matchType=t.match_type,e.market=t.market,e.matchStatus.type=t.match_status?t.match_status.type:null,e.matchStatus.subType=t.match_status?t.match_status.sub_type:null,e};remapPaginatedUserMathQuizEditions=t=>{let e=new H;return e.meta.pagination.nextPageStartsAfter=t.meta.pagination.next_page_starts_after,e.meta.pagination.itemsPerPage=t.meta.pagination.items_per_page,e.data=t.data.map(i=>this.remapUserMatchQuizEditionsResponse(i)),e};remapUserMatchQuizEditionsResponse=t=>{let e=new Pt;return e.id=t.id,e.title=t.title,e.description=t.description,e.type=t.type,e.status=t.status,e.authRequirement=t.auth_requirement||null,e.predictionsCutoff=t.predictions_cutoff,e.scheduleOpenAt=t.schedule_open_at,e.fixtures=t.fixtures.map(i=>this.remapMatchQuizFixturesResponse(i)),e.tiebreaker=t.tiebreaker?this.remapTimeTiebreaker(t.tiebreaker.time_tiebreaker):null,e.participantsCount=t.participants_count,e.related=t.related?this.remapRelated(t.related):[],e.excludedProfileIds=t.excluded_profile_ids,e.rules=t.rules,e.flags=t.flags,e.images=t.images,e.branding=t.branding?this.remapBranding(t.branding):null,e.createdAt=t.created_at,e.updatedAt=t.updated_at,e};remapMatchQuizFixturesResponse=t=>{let e=new Ao;return e.matchId=t.match_id,e.matchType=t.match_type,e.market=t.market,e.matchStatus.type=t.match_status?t.match_status.type:null,e.matchStatus.subType=t.match_status?t.match_status.sub_type:null,e};remapPaginatedGameResults=t=>{let e=new H;return e.meta.pagination.nextPageStartsAfter=t.meta.pagination.next_page_starts_after,e.meta.pagination.itemsPerPage=t.meta.pagination.items_per_page,e.data=t.data.map(i=>this.remapGameResults(i)),e};remapGameResults=t=>{let e=new Qt;return e.userId=t.user_id,e.points=t.points?t.points:0,e.results=t.results.map(i=>this.remapResults(i)),e.tiebreaker=t.tiebreaker?this.remapTiebreaker(t.tiebreaker):null,e};remapGameMarketsResults=t=>{let e=new Oo;return e.gameId=t.game_id,e.results=this.remapMarketsResults(t.results),e.tieBreakers=t.tie_breakers?this.remapTieBreakers(t.tie_breakers):null,e};remapContestWinners=t=>{let e=new js;return e.contestId=t.contest_id,e.contestType=t.contest_type,e.description=t.description,e.userList=t.user_list?t.user_list.map(i=>this.remapUserListWinners(i)):null,e};remapUserListWinners=t=>{let e=new Ys;return e.position=t.position,e.profileId=t.profile_id,e.note=t.note,e.tags=t.tags,e};remapTieBreakers=t=>{let e={goldenGoals:[]};return e.goldenGoals=t.golden_goals.map(i=>({minute:i.minute,matchId:i.match_id,matchModel:null,playerId:i.player_id,playerModel:null,goalType:i.goal_type})),e};remapMarketsResults=t=>{let e=[];return t.forEach(i=>{let a={matchId:i.match_id,market:i.market,result:this.remapMarketResult(i.market,i.result),matchModel:null,playerModels:[],matchStatus:this.remapMarketsResultsMatchStatus(i.match_status)};e.push(this.deleteUnusefulField(a))}),e};remapMarketsResultsMatchStatus=t=>{let e=new Y;return t&&(e.type=t.type,e.subType=t.sub_type),e};remapMarketResult=(t,e)=>{if(Xc.includes(t))return e[0];if(Mt.includes(t))return e;if(e[0]==="true")return!0;if(e[0]==="false")return!1};deleteUnusefulField=t=>((!Mt.includes(t.market)||this.isPlayerMarketWithNoResult(t.market,t.result))&&delete t.playerModels,t);isPlayerMarketWithNoResult=(t,e)=>Mt.includes(t)&&e.length===0;remapResults=t=>{let e=new Ks;return e.matchId=t.match_id,e.outcome=t.outcome,e};remapTiebreaker=t=>{let e=new yt;return e.goldenGoal=t.golden_goal,e};remapTimeTiebreaker=t=>{let e=new gt;return e.timeTiebreaker=t,e};remapRelated=t=>t.map(e=>{let i=new q;return i.entityId=e.entity_id,i.entityType=e.entity_type,i.entityRelationship=e.entity_relationship,i})};var Ol=class{remapMetaData=t=>{let e=new M;return e.pagination.nextPageStartsAfter=t.pagination.next_page_starts_after,e.pagination.itemsPerPage=t.pagination.items_per_page,e}};var dt=class extends v{predictionRemapper=null;matchSummaryRemapper=null;gamesRemapper=null;metaRemapper=null;idMapping=null;constructor(t){super(t,O(t.environment,"predictor")),this.idMapping=new R(t),this.predictionRemapper=new Oi(t,this.idMapping),this.matchSummaryRemapper=new Cl(t,this.idMapping),this.gamesRemapper=new Al,this.metaRemapper=new Ol}makeFootballPrediction=async t=>{let e=`/predictions${this.apiSignInUrl}`,i="There was a problem making POST request",a="POST",r=await this.fetchWithAuth(e,i,a,this.predictionRemapper.remapRequestBody(t));return await this.predictionRemapper.remapResponseObjBody(r)};getMatchSummary=async(t,e)=>{let i=g(e)?`/predictions/summary/${t}${this.apiSignInUrl}${m()}`:`/predictions/summary/${t}${this.apiSignInUrl}`,a=`There was a problem fetching predictions for match: ${t}`,r=await this.fetchWithoutAuth(i,a);return this.matchSummaryRemapper.remapResponse(r)};deleteFootballPrediction=async t=>{let e=`/predictions/${t}${this.apiSignInUrl}`,i=`There was a problem deleting your prediction: ${t}`,a="DELETE";return await this.fetchWithAuth(e,i,a),!0};getMyPredictions=async t=>{let e=new H,i=`/predictions${this.apiSignInUrl}`,a="There was a problem fetching own predictions";t&&(i+=`${t.constructFiltersUrl()}`);let r=await this.fetchWithAuth(i,a);return e.meta=this.metaRemapper.remapMetaData(r.meta),e.data=await this.predictionRemapper.remapResponseArrayBody(r.data),e};getMyPredictionsNoRemap=async t=>{let e=`/predictions${this.apiSignInUrl}${t.constructFiltersUrl()}`,i="There was a problem fetching own predictions";return await this.fetchWithAuth(e,i)};getUserPredictions=async(t,e,i)=>{let a=new H,r=g(e)?`/predictions/users/${t}${this.apiSignInUrl}${m()}`:`/predictions/users/${t}${this.apiSignInUrl}`,o=`There was a problem fetching predictions for user: ${t}`;i&&(r+=`${i.constructFiltersUrl()}`);let n=await this.fetchWithoutAuth(r,o);return a.meta=this.metaRemapper.remapMetaData(n.meta),a.data=await this.predictionRemapper.remapResponseArrayBody(n.data),a};getUserPredictionsNoRemap=async(t,e)=>{let i=`/predictions/users/${t}${this.apiSignInUrl}${e.constructFiltersUrl()}`,a=`There was a problem fetching predictions for user: ${t}`;return await this.fetchWithoutAuth(i,a)};getGames=async(t,e)=>{let i=g(e)?`/games/${this.apiSignInUrl}${t.constructFiltersUrl()}${m()}`:`/games/${this.apiSignInUrl}${t.constructFiltersUrl()}`,a="There was a problem fetching the games list",r=await this.fetchWithoutAuth(i,a);return this.gamesRemapper.remapPaginatedGames(r)};getGamesNoRemap=async(t,e)=>{let i=g(e)?`/games/${this.apiSignInUrl}${t.constructFiltersUrl()}${m()}`:`/games/${this.apiSignInUrl}${t.constructFiltersUrl()}`,a="There was a problem fetching the games list";return await this.fetchWithoutAuth(i,a)};getGameById=async(t,e)=>{let i=g(e)?`/games/${t}${this.apiSignInUrl}${m()}`:`/games/${t}${this.apiSignInUrl}`,a=`There was a problem fetching the following game: ${t}`,r=await this.fetchWithoutAuth(i,a);return this.gamesRemapper.remapGameByIdResponse(r)};getGamePredictions=async(t,e,i)=>{let a=new H,r=g(e)?`/games/${t}/predictions${this.apiSignInUrl}${m()}`:`/games/${t}/predictions${this.apiSignInUrl}`,o=`There was a problem fetching the predictions for game: ${t}`;i&&(r+=`${i.constructFiltersUrl()}`);let n=await this.fetchWithoutAuth(r,o);return a.meta=this.metaRemapper.remapMetaData(n.meta),a.data=await this.predictionRemapper.remapResponseArrayBody(n.data),a};getUserGameEditions=async(t,e)=>{let i=null,a=g(e)?`/games/${this.apiSignInUrl}${t.constructFiltersUrl()}${m()}`:`/games/${this.apiSignInUrl}${t.constructFiltersUrl()}`,r="There was a problem fetching the games list",o=await this.fetchWithoutAuth(a,r);return o.data.forEach(n=>{n.type==="TOP_X"?i=this.gamesRemapper.remapPaginatedUserTopXEditions(o):n.type==="MATCH_QUIZ"&&(i=this.gamesRemapper.remapPaginatedUserMathQuizEditions(o))}),i};getGameResults=async(t,e,i)=>{let a=g(e)?`/games/${t}/results/${this.apiSignInUrl}${m()}`:`/games/${t}/results/${this.apiSignInUrl}`,r=`There was a problem fetching the results for the following game: ${t}`;i&&(a+=`${i.constructMainFiltersUrl()}`);let o=await this.fetchWithoutAuth(a,r);return this.gamesRemapper.remapPaginatedGameResults(o)};getMarketResultsForGame=async(t,e)=>{let i=`/games/${t}/correct-results/${this.apiSignInUrl}`,a=`There was a problem fetching the markets correct results for the following game: ${t}`;g(e)&&(i+=`${m()}`);let r=await this.fetchWithoutAuth(i,a);return this.gamesRemapper.remapGameMarketsResults(r.data)};getContestWinners=async(t,e)=>{let i=`/winners/${this.apiSignInUrl}&contest_id=${t}`,a=`There was a problem fetching winners for the following game: ${t}`;e&&(i+=m());let r=await this.fetchWithoutAuth(i,a);return this.gamesRemapper.remapContestWinners(r)};getPredictionById=async t=>{let e=`/predictions/${t}${this.apiSignInUrl}`,i=`There was a problem fetching info for the following prediction: ${t}`,a=await this.fetchWithoutAuth(e,i);return(await this.predictionRemapper.remapResponseArrayBody([a.data]))[0]};getPredictionsByIds=async t=>{let e=`/predictions/by-ids${this.apiSignInUrl}&prediction_ids=${t.join(",")}`,i="There was a problem fetching predictions",a=await this.fetchWithoutAuth(e,i);return await this.predictionRemapper.remapResponseArrayBody(a.data)}};var Yt=class{errorHandlingMode=null;constructor(t){this.errorHandlingMode=t}validateBodyFields=(t,e)=>{let i=Object.keys(e),a=Object.keys(new Ze);switch(t){case"MATCH_QUIZ":i.forEach(l=>{a.includes(l)||this.throwInvalidParamException([l])});break;case"TOP_X":let o=e;o.fixtures.forEach(l=>this.validateMarketTopX(l.market));let n="tiebreaker";i.includes(n)&&o.tiebreaker&&this.validateTiebreaker(o.tiebreaker),i.forEach(l=>{l!=="tiebreaker"&&!a.includes(l)&&this.throwInvalidParamException([l])});break}let r=a.filter(o=>!i.includes(o));return r.length&&this.throwMissingFieldsException("game prediction body",r),e.fixtures.forEach(o=>{this.validateFixtureFields(o)}),e};validateFixture=(t,e,i,a)=>{this.validateMarket(e);let r=Object.values(fl),o=Object.values(yl),n=Object.values(gl);if(e==="FT_1X2"||e==="HT_1X2"){if(r.includes(i))return new Es(t,e,i)}else if(e==="HT_FT"){if(o.includes(i))return new Ps(t,i)}else if(e==="DOUBLE_CHANCE"){if(n.includes(i))return new ws(t,i)}else if(e==="CORRECT_SCORE"||e==="CORRECT_SCORE_ADVANCED"||e==="CORRECT_SCORE_HT"){if(typeof i=="string"&&/\d+:\d+/.test(i))return new Nt(t,e,i)}else if(e==="CORNERS_MATCH"){if(typeof i=="number")return new bs(t,i)}else if(e==="BOTH_TEAMS_SCORE"){if(this.isPredictionBoolean(i))return new gs(t,i)}else if(e==="RED_CARD_MATCH"){if(this.isPredictionBoolean(i))return new Ss(t,i)}else if(e==="PENALTY_MATCH"){if(this.isPredictionBoolean(i))return new Rs(t,i)}else if(Mt.includes(e)){let l="OWN_GOAL";if(this.validatePlayerId(e,a),e===qi&&this.isPredictionBoolean(i)){let p=a&&a===l?l:a;return new ot(t,e,i,p)}if(a&&this.isPredictionBoolean(i))return new ot(t,e,i,a)}else if(jc.includes(e)){if(this.isPredictionBoolean(i))return new Xe(t,e,i)}else if(Yc.includes(e)&&this.isPredictionBoolean(i))return new Ye(t,e,i);this.throwInvalidPredictionException(i,e)};validateFixtureFields=t=>{let e=Object.keys(t);e.forEach(a=>{Oc.includes(a)||this.throwInvalidParamException([a])});let i=Oc.filter(a=>{if(a!=="matchType"&&!e.includes(a))return a});i.length&&this.throwMissingFieldsException("fixtures",i),this.validatePredictionKey(t.market,t.prediction)};validateTiebreaker=t=>{let e=Object.keys(t);(!e.length||typeof t!="object")&&this.throwInvalidType("tiebreaker","object");let i=Object.keys(new yt)[0];e.forEach(a=>{i!==a&&this.throwInvalidParamException([a])}),e.includes(i)||this.throwMissingFieldsException("tiebreaker",[i]),typeof t.goldenGoal!="number"&&this.throwInvalidType("goldenGoal","number")};validatePredictionKey=(t,e)=>{if(typeof e=="object"){let i=Object.keys(e),a=["value"];if(i.length||this.throwMissingFieldsException("prediction",a),i.length===1&&!i.includes(a[0])&&this.throwInvalidParamException(i),i.length>1){Mt.includes(t)&&a.push("playerId");let r=i.filter(o=>!a.includes(o));r.length&&this.throwInvalidParamException(r)}}else this.throwInvalidType("prediction","object")};validatePlayerId=(t,e)=>{let i="playerId";t!==qi&&(e||this.throwInvalidParamException([i]),typeof e!="string"&&this.throwInvalidType(i,"string"))};validateMarket=t=>{Object.values(it).includes(t)||this.throwInvalidMarketException(t)};validateMarketTopX=t=>{t!=="CORRECT_SCORE"&&t!=="CORRECT_SCORE_ADVANCED"&&this.throwInvalidMarketException(t,"TOP_X")};isPredictionBoolean=t=>typeof t=="boolean";throwInvalidPredictionException=(t,e)=>{let i=tu(t,e);throw this.errorHandlingMode==="default"?new y(400,"INVALID_PREDICTION",i):new h(400,"INVALID_TYPE",i)};throwInvalidMarketException=(t,e)=>{let i=null;throw e&&e==="TOP_X"?i=eu(t):i=Op(t),this.errorHandlingMode==="default"?new y(400,"INVALID_MARKET",i):new h(400,"INVALID_TYPE",i)};throwInvalidParamException=t=>{let e=iu(t);throw this.errorHandlingMode==="default"?new y(400,"INVALID_FIELD",e):new h(400,"INVALID_TYPE",e)};throwMissingFieldsException=(t,e)=>{let i=au(t,e);throw this.errorHandlingMode==="default"?new y(400,"INVALID_FIELD",i):new h(400,"INVALID_TYPE",i)};throwInvalidType=(t,e)=>{let i=ru(t,e);throw this.errorHandlingMode==="default"?new y(400,"INVALID_TYPE",i):new h(400,"INVALID_TYPE",i)}};var Xt=class{predictorHttps=null;predictorService=null;idMapping=null;clientHttps=null;predictorValidator=null;errorHandlingMode=null;constructor(t){this.predictorValidator=new Yt(t.errorHandlingMode),this.idMapping=new R(t),this.predictorHttps=new dt(t),this.predictorService=new St(t,this.idMapping),this.clientHttps=new W(t),this.errorHandlingMode=t.errorHandlingMode}getConfig=async()=>{let t=await this.clientHttps.getConfig("matchQuiz");return this.idMapping.idSchema!=="native"?await this.predictorService.remapCompetitionsFromConfig(t):t};play=async t=>{t=this.predictorValidator.validateBodyFields("MATCH_QUIZ",t);let e=t.fixtures.map(i=>this.predictorValidator.validateFixture(i.matchId,i.market,i.prediction.value,i.prediction.playerId));if(e&&e.length&&this.idMapping.idSchema!=="native"){let i=[],a=[];e.forEach(n=>{i.push(n.matchId),n instanceof ot&&n.prediction.playerId&&n.prediction.playerId!=="OWN_GOAL"&&a.push(n.prediction.playerId)});let r=await this.predictorService.remapMatchIdToNative(i),o={};a&&a.length>0&&(o=await this.predictorService.remapPlayerIdMapToNative(a)),e.forEach((n,l)=>{n.matchId=r[l],n instanceof ot&&n.prediction.playerId!=="OWN_GOAL"&&(n.prediction.playerId=o[n.prediction.playerId])})}return t.fixtures=e,await this.predictorHttps.makeFootballPrediction(t)};delete=async t=>await this.predictorHttps.deleteFootballPrediction(t);getGames=async(t,e)=>{e=e||!1;let i=this.predictorService.initGameFilters("MATCH_QUIZ",t),a=await this.predictorHttps.getGames(i,e);return await this.predictorService.remapMatchIdsFixtures(a)};getGamesNoRemap=async(t,e)=>{e=e||!1;let i=this.predictorService.initGameFilters("MATCH_QUIZ",t);return await this.predictorHttps.getGamesNoRemap(i,e)};getGameById=async(t,e)=>{e=e||!1;let i=await this.predictorHttps.getGameById(t,e);return await this.predictorService.remapMatchIdsFixtures(i)};getGamePredictions=async(t,e,i)=>(i=i||!1,e&&(e.type&&delete e.type,e.status&&delete e.status,e=new V(e)),await this.predictorHttps.getGamePredictions(t,i,e));getGameResults=async(t,e,i)=>{i=i||!1,e&&(e=new w(e));let a=await this.predictorHttps.getGameResults(t,i,e);return await this.predictorService.remapMatchIdsFixtures(a)};getCurrentGameResults=async t=>{t=t||!1;let e=new st(null);e.status="OPEN",e.type="MATCH_QUIZ";let i=await this.predictorHttps.getGames(e,t),a=this.predictorService.getCurrentGameId(i);return(await this.getGameResults(a,null,t)).data[0]};getMyGameEditions=async(t,e)=>{t&&t.limit&&this.validateLimitFilterOnGames(t.limit),e=e||!1;let i=this.predictorService.initGameTypePredictions("MATCH_QUIZ",t),a=[],r=await this.predictorHttps.getMyPredictionsNoRemap(i);if(r.data.length>0){r.data.forEach(p=>{p.game_instance_id&&a.push(p.game_instance_id)});let o=t?.limit?{limit:t.limit}:null,n=this.predictorService.initGameFilters("MATCH_QUIZ",o,a),l=await this.predictorHttps.getUserGameEditions(n,e);return await this.predictorService.addPredictionProp(r,l)}else return new H};getMyGamePrediction=async t=>{let e=new V({gameIds:[t]}),i=await this.predictorHttps.getMyPredictions(e);if(i.data.length>0){let a=i.data.filter(r=>r.gameInstanceId===t);return a.length?a[0]:null}return null};getUserGameEditions=async(t,e,i)=>{e&&e.limit&&this.validateLimitFilterOnGames(e.limit),i=i||!1;let a=this.predictorService.initGameTypePredictions("MATCH_QUIZ",e),r=[],o=await this.predictorHttps.getUserPredictionsNoRemap(t,a);if(o.data.length>0){o.data.forEach(c=>{c.game_instance_id&&r.push(c.game_instance_id)});let n=e?.limit?{limit:e.limit}:null,l=this.predictorService.initGameFilters("MATCH_QUIZ",n,r),p=await this.predictorHttps.getUserGameEditions(l,i);return await this.predictorService.addPredictionProp(o,p)}else return new H};getUserGamePrediction=async(t,e,i)=>{i=i||!1;let a=new V({gameIds:[e]}),r=await this.predictorHttps.getUserPredictions(t,i,a);if(r.data.length>0){let o=r.data.filter(n=>n.gameInstanceId===e);return o.length?o[0]:null}else return null};getMarketsResultsForGame=async(t,e)=>{let i=await this.predictorHttps.getMarketResultsForGame(t,e);return await this.predictorService.completeGameMarketResults(i,"MATCH_QUIZ")};getGameWinners=async(t,e)=>{let i=await this.predictorHttps.getContestWinners(t,e),a=await this.getGameById(t);return i.contestModel=a,this.predictorService.completeContestWinners(i)};validateLimitFilterOnGames=t=>{if(this.errorHandlingMode==="default"&&t>50)throw new y(400,"EXCEEDED_LENGTH","Maximum limit for filtering games is 50 or less.");if(this.errorHandlingMode==="standard"&&t>50)throw new h(400,"EXCEEDED_LENGTH","Maximum limit for filtering games is 50 or less.")}};var Ll=class extends ut{remapClassicQuizzes=t=>(t.meta.pagination=this.remapMetaPagination(t.meta.pagination),t.data=t.data.map(e=>this.remapBasicClassicQuiz(e)),t);remapClassicQuizById=t=>{let e=new xo;return e.id=t.id,e.title=t.title,e.alternativeTitle=t.alternative_title,e.description=t.description,e.type=t.type,e.images=t.images,e.participationCount=t.participation_count,e.questionsCount=t.questions_count,e.status=t.status,e.language=t.language,e.authRequirement=t.auth_requirement,e.flags=t.flags,e.adContent=t.ad_content,e.rules=t.rules,e.customFields=t.custom_fields,e.branding=t.branding?this.remapBranding(t.branding):null,e.labels=t.labels,e.time=t.time,e.points=t.points,e.related=t.related?this.remapRelated(t.related):[],e.scored=t.scored,e.maxAttempts=t.max_attempts,e.context=t.context?this.remapContext(t.context):t.context,e.averageScore=t.average_score,e.perfectScore=t.perfect_score,e.questions=t.questions.map(i=>this.remapQuestions(i)),e.createdAt=t.created_at,e.updatedAt=t.updated_at,e};remapClassicQuizParticipation=t=>{let e=new No;return e.classicQuizId=t.classic_quiz_id,e.userId=t.user_id,e.questions=t.questions?t.questions.map(i=>this.remapParticipationQuestions(i)):null,e.correctOptions=t.correct_options,e.personalBest=t.personal_best,e.points=t.points,e.attempts=t.attempts,e};remapClassicQuizParticipationBody=t=>t.map(e=>({question_id:e.questionId,option_id:e.optionId}));remapUserClassicQuizParticipations=t=>t.map(e=>{let i=new Uo;return i.classicQuizId=e.classic_quiz_id,i.correct=e.correct,i.classicQuizQuestions=e.classic_quiz_questions,i.personalBest=e.personal_best,i.points=e.points,i.attempts=e.attempts,i.answers=e.answers?e.answers.map(a=>this.remapParticipationQuestions(a)):e.answers,i});remapClassicQuizzesLeaderboard=t=>(t.meta=this.remapClassicQuizLeaderboardMeta(t.meta),t.data=t.data.map(e=>this.remapClassicQuizLeaderboard(e)),t);remapClassicQuizUserRankings=t=>(t.meta.pagination=this.remapMetaPaginationRank(t.meta.pagination),t.data=t.data.map(e=>this.remapClassicQuizUserRanking(e)),t);remapClassicQuizQuestionsReport=t=>t.map(e=>{let i=new Vo;return i.questionId=e.question_id,i.correct=e.correct,i.wrong=e.wrong,i.skipped=e.skipped,i.total=e.total,i});remapClassicQuizResultsSummary=t=>t.map(e=>{let i=new as;return i.questions=e.questions,i.correctAnswers=e.correct_answers,i});remapMetaPagination=t=>{let e=new wt;return e.itemsPerPage=t.items_per_page,e.nextPageStartsAfter=t.next_page_starts_after,e};remapClassicQuizLeaderboardMeta=t=>{let e=new We;return e.pagination=this.remapMetaPaginationRank(t.pagination),e.filters=this.remapLeaderboardMetaFilters(t.filters),e};remapMetaPaginationRank=t=>{let e=new j;return e.currentPage=t.current_page,e.itemsPerPage=t.items_per_page,e.numberOfPages=t.number_of_pages,e.totalItems=t.total_items,e};remapLeaderboardMetaFilters=t=>{let e=new He;return e.classicQuizIds=t?.classic_quiz_ids||null,e};remapClassicQuizUserRanking=t=>{let e=new Wo;return e.position=t.position,e.classicQuizId=t.classic_quiz_id,e.points=t.points,e};remapBasicClassicQuiz=t=>{let e=new Ue;return e.id=t.id,e.title=t.title,e.alternativeTitle=t.alternative_title,e.description=t.description,e.type=t.type,e.images=t.images,e.participationCount=t.participation_count,e.questionsCount=t.questions_count,e.status=t.status,e.language=t.language,e.authRequirement=t.auth_requirement,e.flags=t.flags,e.customFields=t.custom_fields,e.branding=t.branding?this.remapBranding(t.branding):null,e.labels=t.labels,e.time=t.time,e.related=t.related?this.remapRelated(t.related):[],e.averageScore=t.average_score,e.perfectScore=t.perfect_score,e.points=t.points,e.scored=t.scored,e.maxAttempts=t.max_attempts,e.context=t.context?this.remapContext(t.context):t.context,e.adContent=t.ad_content,e.createdAt=t.created_at,e.updatedAt=t.updated_at,e};remapQuestions=t=>{let e=new Do;return e.questionId=t.question_id,e.question=t.question,e.images=t.images,e.embedCode=t.embed_code,e.explanation=t.explanation,e.options=t.options.map(i=>this.remapOptions(i)),e};remapOptions=t=>{let e=new Bo;return e.optionId=t.option_id,e.option=t.option,e.images=t.images,e.correct=t.correct,e};remapParticipationQuestions=t=>{let e=new ko;return e.questionId=t.question_id,e.optionId=t.option_id,e.correct=t.correct,e.correctOptionId=t.correct_option_id,e};remapClassicQuizLeaderboard=t=>{let e=new $o;return e.position=t.position,e.profileId=t.profile_id,e.points=t.points,e};remapContext=t=>{let e=new ze;return e.content=t.content,e.tags=t.tags?t.tags.map(i=>{let a=new Qe;return a.id=i.id,a.type=i.type,a.source=i.source,a}):null,e.campaign=t.campaign,e};remapRelated=t=>t.map(e=>{let i=new q;return i.entityId=e.entity_id,i.entityType=e.entity_type,i.entityRelationship=e.entity_relationship,i})};var xl=class extends ut{remapEitherOrs=t=>(t.meta.pagination=this.remapMetaPagination(t.meta.pagination),t.data=t.data.map(e=>this.remapBasicEitherOr(e)),t);remapEitherOrById=t=>{let e=new zo;return e.id=t.id,e.title=t.title,e.alternativeTitle=t.alternative_title,e.description=t.description,e.type=t.type,e.images=t.images,e.status=t.status,e.language=t.language,e.authRequirement=t.auth_requirement,e.winningCondition=t.winning_condition,e.lives=t.lives,e.flags=t.flags,e.customFields=t.custom_fields,e.branding=t.branding?this.remapBranding(t.branding):null,e.labels=t.labels,e.time=t.time,e.related=t.related?this.remapRelated(t.related):[],e.context=t.context?this.remapContext(t.context):t.context,e.points=t.points?t.points.map(i=>this.remapPoints(i)):t.points,e.rules=t.rules,e.adContent=t.ad_content,e.totalParticipationsCount=t.total_participations_count,e.totalUsersCount=t.total_users_count,e.finishedParticipationsCount=t.finished_participations_count,e.averageStartedParticipationsCount=t.average_started_participations_count,e.averageFinishedParticipationsCount=t.average_finished_participations_count,e.createdAt=t.created_at,e.updatedAt=t.updated_at,e};remapEitherOrOwnStats=t=>{let e=new Ko;return e.eitherOrId=t.either_or_id,e.personalBest=t.personal_best,e.betterThan=t.better_than,e};remapEitherOrResults=t=>{let e=new es;return e.standings=t.standings?t.standings.map(i=>this.remapResultsStandings(i)):t.standings,e.breakdown=t.breakdown?t.breakdown.map(i=>this.remapResultsBreakdown(i)):t.breakdown,e};remapEitherOrParticipation=t=>{let e=new jo;return e.instanceId=t.instance_id,e.eitherOrId=t.either_or_id,e.gameStartedAt=t.game_started_at,e.currentStep=t.current_step,e.currentStreak=t.current_streak,e.remainingSteps=t.remaining_steps,e.currentLives=t.current_lives,e.currentPoints=t.current_points,e.personalBest=t.personal_best,e.participationCount=t.participation_count,e.finishedParticipationsCount=t.finished_participations_count,e.steps=t.steps?t.steps.map(i=>this.remapParticipationSteps(i)):t.steps,e};remapBasicEitherOr=t=>{let e=new qe;return e.id=t.id,e.title=t.title,e.alternativeTitle=t.alternative_title,e.description=t.description,e.type=t.type,e.images=t.images,e.status=t.status,e.language=t.language,e.winningCondition=t.winning_condition,e.authRequirement=t.auth_requirement,e.lives=t.lives,e.flags=t.flags,e.related=t.related?this.remapRelated(t.related):[],e.customFields=t.custom_fields,e.branding=t.branding?this.remapBranding(t.branding):null,e.labels=t.labels,e.adContent=t.ad_content,e.context=t.context?this.remapContext(t.context):t.context,e.time=t.time,e.points=t.points?t.points.map(i=>this.remapPoints(i)):t.points,e.totalParticipationsCount=t.total_participations_count,e.totalUsersCount=t.total_users_count,e.finishedParticipationsCount=t.finished_participations_count,e.averageStartedParticipationsCount=t.average_started_participations_count,e.averageFinishedParticipationsCount=t.average_finished_participations_count,e.createdAt=t.created_at,e.updatedAt=t.updated_at,e};remapMetaPagination=t=>{let e=new wt;return e.itemsPerPage=t.items_per_page,e.nextPageStartsAfter=t.next_page_starts_after,e};remapPoints=t=>{let e=new Qo;return e.correctSteps=t.correct_steps,e.score=t.score,e};remapResultsStandings=t=>{let e=new is;return e.userId=t.user_id,e.personalBest=t.personal_best,e};remapResultsBreakdown=t=>{let e=new ts;return e.rangeStartInclusive=t.range_start_inclusive,e.rangeEndInclusive=t.range_end_inclusive,e.totalUsers=t.total_users,e};remapParticipationSteps=t=>{let e=new Zo;return e.pairId=t.pair_id,e.userSelection=t.user_selection,e.correct=t.correct,e.played=t.played,e.timestamp=t.timestamp,e.optionOne=t.option_one,e.optionTwo=t.option_two,e};remapContext=t=>{let e=new ze;return e.content=t.content,e.tags=t.tags?t.tags.map(i=>{let a=new Qe;return a.id=i.id,a.type=i.type,a.source=i.source,a}):null,e.campaign=t.campaign,e};remapRelated=t=>t.map(e=>{let i=new q;return i.entityId=e.entity_id,i.entityType=e.entity_type,i.entityRelationship=e.entity_relationship,i})};var Li=class extends v{classicQuizRemapper=null;eitherOrRemapper=null;constructor(t){super(t,O(t.environment,"miniGames")),this.classicQuizRemapper=new Ll,this.eitherOrRemapper=new xl}getClassicQuizzes=async(t,e)=>{let i=`/classic-quizzes${this.apiSignInUrl}`;t&&(i+=t.constructMainFiltersUrl()),i+=g(e)?m():"";let a="There was a problem with fetching classic quizzes",r=await this.fetchWithoutAuth(i,a);return this.classicQuizRemapper.remapClassicQuizzes(r)};getClassicQuizById=async(t,e,i)=>{let a=`/classic-quizzes/${t}${this.apiSignInUrl}`;e&&(a+=`&include_correct_options=${e}`),g(i)&&(a+=m());let r="There was a problem with fetching classic quiz by ID",o=await this.fetchWithoutAuth(a,r);return this.classicQuizRemapper.remapClassicQuizById(o.data)};participateInClassicQuiz=async(t,e,i)=>{let a=`/classic-quizzes/${t}/participate${this.apiSignInUrl}`,r=`There was a problem with participating in the following classic quiz: ${t}`,o="POST",n={questions:this.classicQuizRemapper.remapClassicQuizParticipationBody(e),include_correct_options:!!i},l=await this.fetchWithAuth(a,r,o,n);return this.classicQuizRemapper.remapClassicQuizParticipation(l.data)};getMyClassicQuizParticipations=async t=>{let e=`/classic-quizzes/participations${this.apiSignInUrl}`;t&&(e+=`${t.constructMainFiltersUrl()}`);let i="There was a problem with fetching user's own Classic Quiz participations",a=await this.fetchWithAuth(e,i);return this.classicQuizRemapper.remapUserClassicQuizParticipations(a.data)};getLeaderboardForClassicQuizzes=async(t,e)=>{let i=`/classic-quizzes/rank${this.apiSignInUrl}`;t&&(i+=`${t.constructMainFiltersUrl()}`),i+=g(e)?m():"";let a="There was a problem with fetching classic quizzes leaderboard",r=await this.fetchWithoutAuth(i,a);return this.classicQuizRemapper.remapClassicQuizzesLeaderboard(r)};getClassicQuizzesUserRanking=async(t,e,i)=>{let a=`/classic-quizzes/users/${t}/rank${this.apiSignInUrl}`;e&&(a+=`${e.constructMainFiltersUrl()}`),a+=g(i)?m():"";let r="There was a problem with fetching user's rankings for classic quizzes",o=await this.fetchWithoutAuth(a,r);return this.classicQuizRemapper.remapClassicQuizUserRankings(o)};getClassicQuizQuestionsReport=async t=>{let e=`/classic-quizzes/${t}/questions-report${this.apiSignInUrl}`,i=`There was a problem with fetching questions report for quiz: ${t}`,a=await this.fetchWithoutAuth(e,i);return this.classicQuizRemapper.remapClassicQuizQuestionsReport(a.data)};getClassicQuizResultsSummary=async(t,e)=>{let i=`/classic-quizzes/${t}/results-summary${this.apiSignInUrl}`;g(e)&&(i+=m());let a="There was a problem with fetching classic quiz results summary",r=await this.fetchWithoutAuth(i,a);return this.classicQuizRemapper.remapClassicQuizResultsSummary(r.data)};getEitherOrs=async(t,e)=>{let i=`/either-or${this.apiSignInUrl}`;t&&(i+=t.constructMainFiltersUrl()),i+=g(e)?m():"";let a="There was a problem with fetching list of Either/Ors",r=await this.fetchWithoutAuth(i,a);return this.eitherOrRemapper.remapEitherOrs(r)};getEitherOrById=async(t,e)=>{let i=`/either-or/${t}${this.apiSignInUrl}`;g(e)&&(i+=m());let a="There was a problem with fetching Either/Or by ID",r=await this.fetchWithoutAuth(i,a);return this.eitherOrRemapper.remapEitherOrById(r.data)};getMyEitherOrStats=async t=>{let e=`/either-or/${t}/own-stats${this.apiSignInUrl}`,i="There was a problem with fetching Either/Or own statistics",a=await this.fetchWithAuth(e,i);return this.eitherOrRemapper.remapEitherOrOwnStats(a.data)};getEitherOrResults=async(t,e)=>{let i=`/either-or/${t}/results${this.apiSignInUrl}${g(e)?m():""}`,a="There was a problem with fetching Either/Or results",r=await this.fetchWithoutAuth(i,a);return this.eitherOrRemapper.remapEitherOrResults(r.data)};participateInEitherOr=async(t,e)=>{let i=`/either-or/${t}/participate${this.apiSignInUrl}`,a="There was a problem with participating in Either/Or",r="POST",o=await this.fetchWithAuth(i,a,r,e);return this.eitherOrRemapper.remapEitherOrParticipation(o.data)}};var Jt=class extends Q{entityTypes=["competition","team","player"];constructor(t){super(t.errorHandlingMode)}validateFilters=t=>{!t.entityIds&&!t.entityType||(t.entityIds&&!t.entityType&&this.throwException(400,"invalid_filters","You need to use both 'entityIds' and 'entityType' filters together"),!t.entityIds&&t.entityType&&this.throwException(400,"invalid_filters","You need to use both 'entityIds' and 'entityType' filters together"),this.entityTypes.includes(t.entityType)||this.throwException(400,"invalid_filters","Invalid 'entityType' filter. Please use one of the following valid options: competition, team, or player"))}};var Dl=class{idSchema=null;idMapping=null;validator=null;https=null;entityTypes=["competition","team","player"];profile=null;football=null;eitherOrTime=0;participationStartTimestamp=0;countdownTimer=0;intervalId=null;currentPairId="";constructor(t){this.idSchema=t.idSchema,this.idMapping=new R(t),this.validator=new Jt(t),this.profile=new D(t),this.football=new tt(t),this.https=new Li(t)}finalizeMiniGamesFilters=async t=>{if(this.idSchema!=="native"&&t.entityIds&&t.entityIds.length>0){this.validator.validateFilters(t);let e=await this.idMapping.getEntityIdsBySchemaId(Array.from(t.entityIds),t.entityType,"native");t.entityIds=e[t.entityType]}};setProfileModelsForEitherOrStandings=async t=>{let e=t.standings.map(a=>a.userId);if(!e.length)return t;let i=await this.profile.getByIds(e);return t.standings.forEach(a=>a.userModel=i.find(r=>r.id===a.userId)||null),t};setProfileModelsForClassicQuizLeaderboards=async t=>{let e=t.map(a=>a.profileId);if(!e.length)return t;let i=await this.profile.getByIds(e);return t.forEach(a=>a.profileModel=i.find(r=>r.id===a.profileId)||null),t};defaultEitherOrParticipation=async(t,e)=>{if(!this.eitherOrTime&&!e){let r=await this.https.getEitherOrById(t,!0);this.eitherOrTime=r.time;let o=await this.https.participateInEitherOr(t,null);return this.participationStartTimestamp=Date.now(),o}let i=0;if(this.participationStartTimestamp)i=(Date.now()-this.participationStartTimestamp)/1e3;else{if(!this.eitherOrTime){let r=await this.https.getEitherOrById(t,!0);this.eitherOrTime=r.time}i=this.eitherOrTime+1}let a=this.createNewParticipation(i,e);try{let r=await this.https.participateInEitherOr(t,a);return!r.currentLives||!r.remainingSteps?this.resetDefaultParticipationTimers():this.participationStartTimestamp=Date.now(),r}catch(r){throw this.resetDefaultParticipationTimers(),r}};handleEitherOrParticipationWithCallback=async(t,e,i)=>e?await this.eitherOrParticipationWithCallback(t,e,i):await this.initialEitherOrParticipationWithCallback(t,i);initialEitherOrParticipationWithCallback=async(t,e)=>{let i=await this.https.getEitherOrById(t,!0);this.eitherOrTime=i.time;let a=await this.https.participateInEitherOr(t,null);return this.participationStartTimestamp=Date.now(),this.countdownTimer=this.eitherOrTime,this.setCurrentPairId(a),await this.handleEitherOrParticipationCallbackInterface(t,e),a};eitherOrParticipationWithCallback=async(t,e,i)=>{this.intervalId&&clearInterval(this.intervalId);let a=0;if(this.participationStartTimestamp)a=(Date.now()-this.participationStartTimestamp)/1e3;else{if(!this.eitherOrTime){let o=await this.https.getEitherOrById(t,!0);this.eitherOrTime=o.time}a=this.eitherOrTime+1}let r=this.createNewParticipation(a,e);try{let o=await this.https.participateInEitherOr(t,r);return!o.currentLives||!o.remainingSteps?(this.resetCallbackParticipationTimers(),i.onElapsedResponse(o),clearInterval(this.intervalId)):(this.participationStartTimestamp=Date.now(),this.countdownTimer=this.eitherOrTime,this.setCurrentPairId(o),await this.handleEitherOrParticipationCallbackInterface(t,i)),o}catch(o){throw this.resetCallbackParticipationTimers(),clearInterval(this.intervalId),o}};setCurrentPairId=t=>{this.currentPairId=t.steps.find(e=>!e.played).pairId||""};handleEitherOrParticipationCallbackInterface=async(t,e)=>{this.intervalId=setInterval(async()=>{if(this.countdownTimer>0)this.countdownTimer--,e.onTimerTick(this.countdownTimer);else{clearInterval(this.intervalId);let i=(Date.now()-this.participationStartTimestamp)/1e3,a={pair:this.currentPairId,answer:this.currentPairId.split("_")[0]},r=this.createNewParticipation(i,a),o=await this.eitherOrParticipationWithCallback(t,r,e);e.onElapsedResponse(o)}},1e3)};createNewParticipation=(t,e)=>{let i=new Xo;return i.expired=t>this.eitherOrTime,i.time=Number(t.toFixed(3)),i.pair=e.pair,i.answer=e.answer,i};resetCallbackParticipationTimers=()=>{this.resetDefaultParticipationTimers(),this.countdownTimer=0,this.currentPairId=""};resetDefaultParticipationTimers=()=>{this.eitherOrTime=0,this.participationStartTimestamp=0};setContextTagsModels=async t=>{let e={competitions:[],teams:[],players:[]};if(t.forEach(i=>{i.context&&i.context.tags&&i.context.tags.length>0&&(e.competitions=[...e.competitions,...this.extractEntityIdsFromTags(i.context.tags,"competition")],e.competitions=Array.from(new Set(e.competitions)),e.teams=[...e.teams,...this.extractEntityIdsFromTags(i.context.tags,"team")],e.teams=Array.from(new Set(e.teams)),e.players=[...e.players,...this.extractEntityIdsFromTags(i.context.tags,"player")],e.players=Array.from(new Set(e.players)))}),e.competitions.length){let i=await this.football.footballFacade.getCompetitionsMapWithNativeIds(e.competitions);this.setModelsForContextTags(t,i,"competition")}if(e.teams.length){let i=await this.football.footballFacade.getTeamsMapWithNativeIds(e.teams);this.setModelsForContextTags(t,i,"team")}if(e.players.length){let i=await this.football.footballFacade.getPlayersMapWithNativeIds(e.players);this.setModelsForContextTags(t,i,"player")}};extractEntityIdsFromTags=(t,e)=>t.filter(i=>i.type===e).map(i=>i.id);setModelsForContextTags=(t,e,i)=>{t.forEach(a=>{a.context&&a.context.tags&&a.context.tags.length>0&&a.context.tags.forEach(r=>{r.type===i&&(r.model=i==="player"?e[r.id]:e.get(r.id),r.id=r.model.id)})})};setQuestionModelsInQuestionsReport=async(t,e)=>t.map(i=>(i.questionModel=e.questions.find(a=>a.questionId.toString()===i.questionId),i))};var Bl=class{https=null;service=null;activityService=null;idSchema=null;constructor(t){this.https=new Li(t),this.service=new Dl(t),this.activityService=new It(t),this.idSchema=t.idSchema}getClassicQuizzes=async(t,e,i)=>{t&&(t=new Lo(t),await this.service.finalizeMiniGamesFilters(t));let a=await this.https.getClassicQuizzes(t,i);if(e)await this.service.setContextTagsModels(a.data);else for(let r of a.data)await this.remapTags(r,"native",this.idSchema);return a};getClassicQuizById=async(t,e,i)=>{let a=await this.https.getClassicQuizById(t,e,i);return await this.service.setContextTagsModels([a]),a};participateInClassicQuiz=async(t,e,i)=>await this.https.participateInClassicQuiz(t,e,i);getMyClassicQuizParticipations=async t=>{t&&(t=new Go(t));let e=await this.https.getMyClassicQuizParticipations(t),i=e.map(r=>r.classicQuizId),a=await this.getClassicQuizzes({classicQuizIds:i});return e.map(r=>{let o=a.data.find(n=>n.id===r.classicQuizId)||null;return{...r,classicQuizModel:o}})};getLeaderboardForClassicQuizzes=async(t,e)=>{t&&(t=new Ho(t));let i=await this.https.getLeaderboardForClassicQuizzes(t,e);return i.data=await this.service.setProfileModelsForClassicQuizLeaderboards(i.data),i};getClassicQuizzesUserRanking=async(t,e,i)=>{e&&(e=new $e(e));let a=await this.https.getClassicQuizzesUserRanking(t,e,i),r=a.data.map(n=>n.classicQuizId),o=await this.getClassicQuizzes({classicQuizIds:r});return a.data=a.data.map(n=>{let l=o.data.find(p=>p.id===n.classicQuizId)||null;return{...n,classicQuizModel:l}}),a};getClassicQuizQuestionsReport=async(t,e)=>{e=e||!1;let i=await this.https.getClassicQuizQuestionsReport(t),a=await this.getClassicQuizById(t,e,!0);return this.service.setQuestionModelsInQuestionsReport(i,a)};getClassicQuizResultsSummary=async(t,e)=>await this.https.getClassicQuizResultsSummary(t,e);getEitherOrs=async(t,e,i)=>{t&&(t=new qo(t),await this.service.finalizeMiniGamesFilters(t));let a=await this.https.getEitherOrs(t,i);if(e)await this.service.setContextTagsModels(a.data);else for(let r of a.data)await this.remapTags(r,"native",this.idSchema);return a};getEitherOrById=async(t,e)=>{let i=await this.https.getEitherOrById(t,e);return await this.service.setContextTagsModels([i]),i};getMyEitherOrStats=async t=>await this.https.getMyEitherOrStats(t);getEitherOrResults=async(t,e)=>{let i=await this.https.getEitherOrResults(t,e);return await this.service.setProfileModelsForEitherOrStandings(i)};participateInEitherOr=async(t,e,i)=>i?await this.service.handleEitherOrParticipationWithCallback(t,e,i):await this.service.defaultEitherOrParticipation(t,e);calculateEitherOrResultPercentile=async(t,e)=>{if(e==null||isNaN(e)||e<0)return null;if(e===0)return e;let i=await this.getEitherOrResults(t,!0),a=i.breakdown.reduce((o,n)=>o+n.totalUsers,0),r=0;for(let o of i.breakdown)if(r+=o.totalUsers,e>=o.rangeStartInclusive&&e<=o.rangeEndInclusive)return parseFloat((r/a*100).toFixed(1));return null};remapTags=async(t,e,i)=>{if(this.idSchema!="native"&&t.context&&t.context.tags&&t.context.tags.length){let a=JSON.parse(JSON.stringify(t.context.tags)),r=await this.activityService.remapTagsIds(a,e,i);t.context.tags=r}}};var Zt=class{facade=null;constructor(t){this.facade=new Bl(t)}getClassicQuizzes=async(t,e,i)=>await this.facade.getClassicQuizzes(t,e,i);getClassicQuizById=async(t,e,i)=>await this.facade.getClassicQuizById(t,e,i);participateInClassicQuiz=async(t,e,i)=>await this.facade.participateInClassicQuiz(t,e,i);getMyClassicQuizParticipations=async t=>await this.facade.getMyClassicQuizParticipations(t);getLeaderboardForClassicQuizzes=async(t,e)=>await this.facade.getLeaderboardForClassicQuizzes(t,e);getClassicQuizzesUserRanking=async(t,e,i)=>await this.facade.getClassicQuizzesUserRanking(t,e,i);getClassicQuizQuestionsReport=async(t,e)=>await this.facade.getClassicQuizQuestionsReport(t,e);getClassicQuizResultsSummary=async(t,e)=>await this.facade.getClassicQuizResultsSummary(t,e);getEitherOrs=async(t,e,i)=>await this.facade.getEitherOrs(t,e,i);getEitherOrById=async(t,e)=>await this.facade.getEitherOrById(t,e);getMyEitherOrStats=async t=>await this.facade.getMyEitherOrStats(t);getEitherOrResults=async(t,e)=>await this.facade.getEitherOrResults(t,e);participateInEitherOr=async(t,e,i)=>await this.facade.participateInEitherOr(t,e,i);calculateEitherOrResultPercentile=async(t,e)=>await this.facade.calculateEitherOrResultPercentile(t,e)};var te=class{idMapping=null;predictorHttps=null;predictorService=null;predictorValidator=null;clientHttps=null;errorHandlingMode=null;constructor(t){this.idMapping=new R(t),this.errorHandlingMode=t.errorHandlingMode,this.predictorValidator=new Yt(t.errorHandlingMode),this.predictorHttps=new dt(t),this.predictorService=new St(t,this.idMapping),this.clientHttps=new W(t)}getConfig=async()=>{let t=await this.clientHttps.getConfig("topX");return this.idMapping.idSchema!=="native"?await this.predictorService.remapCompetitionsFromConfig(t):t};getGames=async(t,e)=>{e=e||!1;let i=this.predictorService.initGameFilters("TOP_X",t),a=await this.predictorHttps.getGames(i,e);return await this.predictorService.remapMatchIdsFixtures(a)};getGamesNoRemap=async(t,e)=>{e=e||!1;let i=this.predictorService.initGameFilters("TOP_X",t);return await this.predictorHttps.getGamesNoRemap(i,e)};getGameById=async(t,e)=>{e=e||!1;let i=await this.predictorHttps.getGameById(t,e);return await this.predictorService.remapMatchIdsFixtures(i)};getGamePredictions=async(t,e,i)=>(i=i||!1,e&&(e.type&&delete e.type,e.status&&delete e.status,e=new V(e)),await this.predictorHttps.getGamePredictions(t,i,e));getGameResults=async(t,e,i)=>{i=i||!1,e&&(e=new st(e));let a=await this.predictorHttps.getGameResults(t,i,e);return await this.predictorService.remapMatchIdsFixtures(a)};getCurrentGameResults=async t=>{t=t||!1;let e=new st(null);e.status="OPEN",e.type="TOP_X";let i=await this.predictorHttps.getGames(e,t),a=this.predictorService.getCurrentGameId(i);return(await this.getGameResults(a,null,t)).data[0]};play=async t=>{let e=new oi(t);if(e=this.predictorValidator.validateBodyFields("TOP_X",e),e.fixtures=e.fixtures.map(a=>this.predictorValidator.validateFixture(a.matchId,a.market,a.prediction.value)),this.idMapping.idSchema!=="native"){let a=[];e.fixtures.forEach(o=>a.push(o.matchId));let r=await this.predictorService.remapMatchIdToNative(a);e.fixtures.forEach(o=>o.matchId=r.shift())}let i=await this.predictorHttps.makeFootballPrediction(e);return i.fixtures.forEach(a=>{a.matchId=a.matchModel.id}),i};delete=async t=>await this.predictorHttps.deleteFootballPrediction(t);getMyGameEditions=async(t,e)=>{t&&t.limit&&this.validateLimitFilterOnGames(t.limit),e=e||!1;let i=this.predictorService.initGameTypePredictions("TOP_X",t),a=[],r=await this.predictorHttps.getMyPredictionsNoRemap(i);if(r.data.length>0){r.data.forEach(p=>{p.game_instance_id&&a.push(p.game_instance_id)});let o=t?.limit?{limit:t.limit}:null,n=this.predictorService.initGameFilters("TOP_X",o,a),l=await this.predictorHttps.getUserGameEditions(n,e);return await this.predictorService.addPredictionProp(r,l)}else return new H};getMyGamePrediction=async t=>{let e=new V({gameIds:[t]}),i=await this.predictorHttps.getMyPredictions(e);if(i.data.length>0){let a=i.data.filter(r=>r.gameInstanceId===t);return a.length?a[0]:null}return null};getUserGameEditions=async(t,e,i)=>{e&&e.limit&&this.validateLimitFilterOnGames(e.limit),i=i||!1;let a=this.predictorService.initGameTypePredictions("TOP_X",e),r=[],o=await this.predictorHttps.getUserPredictionsNoRemap(t,a);if(o.data.length>0){o.data.forEach(c=>{c.game_instance_id&&r.push(c.game_instance_id)});let n=e?.limit?{limit:e.limit}:null,l=this.predictorService.initGameFilters("TOP_X",n,r),p=await this.predictorHttps.getUserGameEditions(l,i);return await this.predictorService.addPredictionProp(o,p)}else return new H};getUserGamePrediction=async(t,e,i)=>{i=i||!1;let a=new V({gameIds:[e]}),r=await this.predictorHttps.getUserPredictions(t,i,a);if(r.data.length>0){let o=r.data.filter(n=>n.gameInstanceId===e);return o.length?o[0]:null}else return null};getMarketsResultsForGame=async(t,e)=>{let i=await this.predictorHttps.getMarketResultsForGame(t,e);return await this.predictorService.completeGameMarketResults(i,"TOP_X")};getGameWinners=async(t,e)=>{let i=await this.predictorHttps.getContestWinners(t,e),a=await this.getGameById(t);return i.contestModel=a,this.predictorService.completeContestWinners(i)};validateLimitFilterOnGames=t=>{if(this.errorHandlingMode==="default"&&t>50)throw new y(400,"EXCEEDED_LENGTH","Maximum limit for filtering games is 50 or less.");if(this.errorHandlingMode==="standard"&&t>50)throw new h(400,"EXCEEDED_LENGTH","Maximum limit for filtering games is 50 or less.")}};var Nl=class{idMappingService=null;profileNamespace=null;footballNamespace=null;topXFacade=null;matchQuizFacade=null;miniGamesNamespace=null;errorHandlingMode=null;constructor(t){this.idMappingService=new R(t),this.profileNamespace=new D(t),this.footballNamespace=new tt(t),this.topXFacade=new te(t),this.matchQuizFacade=new Xt(t),this.miniGamesNamespace=new Zt(t),this.errorHandlingMode=t.errorHandlingMode}remapTemplatesIds=async t=>{if(t.length>0){let e=[],i=[],a=[],r=[],o=[],n=[];t.forEach(c=>{c.teamIds&&c.teamIds.length>0&&(e=[...e,...c.teamIds]),c.matchIds&&c.matchIds.length>0&&(a=[...a,...c.matchIds]),c.competitionIds&&c.competitionIds.length>0&&(o=[...o,...c.competitionIds])});let l={team:e,match:a,competition:o},p=await this.idMappingService.idMappingFacade.getEntitiesByIds(l,"native",this.idMappingService.idSchema);return i=[...p.team],r=[...p.match],n=[...p.competition],t.forEach(c=>{c.teamIds&&c.teamIds.length>0&&(c.teamIds=c.teamIds.map(u=>u=p.team.shift())),c.matchIds&&c.matchIds.length>0&&(c.matchIds=c.matchIds.map(u=>u=p.match.shift())),c.competitionIds&&c.competitionIds.length>0&&(c.competitionIds=c.competitionIds.map(u=>u=p.competition.shift()))}),t}return t};remapTemplateGroupMatchIds=async t=>{if(t&&t.length>0){for(let e of t)if(!(!e.filters.matchIds||!e.filters.matchIds.every(a=>a))&&e.filters.matchIds.length>0){let a={match:Array.from(e.filters.matchIds)},r=await this.idMappingService.idMappingFacade.getEntitiesByIds(a,"native",this.idMappingService.idSchema);e.filters.matchIds=Array.from(r.match)}}};addProfileModelToLeaderboard=async t=>{if(t.length>0){let e=[],i=t.map(r=>r.profileId);if(!i.length)return t;let a=await this.profileNamespace.getByIds(i);return t.forEach(r=>{a.forEach(o=>{o.id===r.profileId&&(delete o.interests,r.profileModel=o)}),r.profileModel||(r.profileModel=null),e.push(r)}),e}return t};buildOldClientBadges=t=>{let e=new fo;return e.general=this.extractEnabledBadgesId(t.general),e.predictor=this.extractEnabledBadgesId(t.predictor),e.topX=this.extractEnabledBadgesId(t.topX),e.matchQuiz=this.extractEnabledBadgesId(t.matchQuiz),e};buildNewClientBadges=t=>{let e=new go;return e.predictor=this.extractEnabledBadgesId(t.predictor),e.topX=this.extractEnabledBadgesId(t.topX),e.matchQuiz=this.extractEnabledBadgesId(t.matchQuiz),e.games=this.extractEnabledBadgesId(t.games),e.football=this.extractEnabledBadgesId(t.football),e.classicQuizzes=this.extractEnabledBadgesId(t.classicQuizzes),e.eitherOr=this.extractEnabledBadgesId(t.eitherOr),e.discussions=this.extractEnabledBadgesId(t.discussions),e.potm=this.extractEnabledBadgesId(t.voting.potm),e.poll=this.extractEnabledBadgesId(t.voting.poll),e};initFilters=(t,e)=>{switch(e){case"loyalty":t&&(t=new Mo(t));break;case"rankings":t&&(t=new Io(t));break;case"league_leaderboard":t&&(t=new bo(t))}return t};addProfileModelToHighestSuccessRate=async t=>{let e=t.map(a=>a.profileId);if(!e.length)return t;let i=await this.profileNamespace.getByIds(e);return t.map(a=>(i.forEach(r=>{r.id===a.profileId&&(delete r.interests,a.profileModel=r)}),a))};extractRankingsIdsMap=t=>{let e=[],i=[],a=[];return t.forEach(r=>{r.rankType==="GAME"&&r.gameType==="TOP_X"?e.push(r.id):r.rankType==="GAME"&&r.gameType==="MATCH_QUIZ"?i.push(r.id):r.rankType==="TEMPLATE"&&a.push(r.id)}),[e,i,a]};setModelsForUserRankings=(t,e,i,a)=>(a.data.forEach(r=>{r.gameType==="MATCH_QUIZ"&&e?r.model=e.filter(o=>o.id===r.id)[0]:r.gameType==="TOP_X"&&t?r.model=t.filter(o=>o.id===r.id)[0]:r.rankType==="TEMPLATE"&&i&&(r.model=i.filter(o=>o.id===r.id)[0])}),a);completeContestWinners=async t=>{if(t.userList&&t.userList.length){let e=t.userList.map(a=>a.profileId),i=await this.profileNamespace.getByIds(e);t.userList.forEach(a=>{let r=i.filter(o=>o.id===a.profileId)[0];delete r.interests,a.profileModel=r})}return t};validateEntitiesFollowsFilters=t=>{if(!t||(!t.footballCompetitions||!t.footballCompetitions.length)&&(!t.footballTeams||!t.footballTeams.length)&&(!t.footballPlayers||!t.footballPlayers.length))throw this.errorHandlingMode==="default"?new y(400,"invalid_filters","At least one of footballCompetitions, footballTeams or footballPlayers properties should be provided for filters."):new h(400,"invalid_filters","At least one of footballCompetitions, footballTeams or footballPlayers properties should be provided for filters.");if(t.footballCompetitions&&t.footballCompetitions.length>24||t.footballTeams&&t.footballTeams.length>24||t.footballPlayers&&t.footballPlayers.length>24)throw this.errorHandlingMode==="default"?new y(400,"EXCEEDED_LENGTH","Maximum length per entity should be 24 or less."):new h(400,"EXCEEDED_LENGTH","Maximum length per entity should be 24 or less.")};remapEntitiesFollowsFilters=async t=>{let e=JSON.parse(JSON.stringify(t)),i={},a={};e.footballCompetitions&&e.footballCompetitions.length&&(a.competition=e.footballCompetitions),e.footballTeams&&e.footballTeams.length&&(a.team=e.footballTeams),e.footballPlayers&&e.footballPlayers.length&&(a.player=e.footballPlayers);let r=await this.idMappingService.idMappingFacade.getEntitiesByIds(a,this.idMappingService.idSchema,"native");return Object.keys(r).forEach(o=>{o==="competition"?i.footballCompetitions=r[o]:o==="team"?i.footballTeams=r[o]:o==="player"&&(i.footballPlayers=r[o])}),i};addModelsToEntitiesFollows=async t=>{let e=[],i="fb:c:",a=new Map,r=[],o="fb:t:",n=new Map,l=[],p="fb:p:",c=null;return t.breakdown.forEach(u=>{u.id.includes(i)?e.push(u.id):u.id.includes(o)?r.push(u.id):u.id.includes(p)&&l.push(u.id)}),e.length&&(a=await this.footballNamespace.footballFacade.competitionsFacade.getCompetitionsMapWithNativeIds(e)),r.length&&(n=await this.footballNamespace.footballFacade.teamsFacade.getTeamsMapWithNativeIds(r)),l.length&&(c=await this.footballNamespace.footballFacade.playerFacade.getPlayersMapWithNativeIds(l)),t.breakdown.forEach(u=>{u.id.includes(i)?(u.model=a.get(u.id),u.id=u.model.id):u.id.includes(o)?(u.model=n.get(u.id),u.id=u.model.id):u.id.includes(p)&&(u.model=c[u.id],u.id=u.model.id)}),t};getMatchIdsFromGamesInTemplates=async(t,e)=>{if(t&&t.length>0){let o=Vt(t,100),n=[];if(e&&e.length===1){if(e.includes("TOP_X"))try{n=(await Promise.all(o.map(c=>this.topXFacade.getGamesNoRemap({gameIds:c,limit:c.length},!0)))).reduce((c,u)=>[...c,...u.data],[])}catch(p){throw console.error("There was a problem fetching match IDs from Top X games",p),p}if(e.includes("MATCH_QUIZ"))try{n=(await Promise.all(o.map(c=>this.matchQuizFacade.getGamesNoRemap({gameIds:c,limit:c.length},!0)))).reduce((c,u)=>[...c,...u.data],[])}catch(p){throw console.error("There was a problem fetching match IDs from Match Quiz games",p),p}}try{n=(await Promise.all(o.map(c=>{let u=this.topXFacade.getGamesNoRemap({gameIds:c,limit:c.length},!0),d=this.matchQuizFacade.getGamesNoRemap({gameIds:c,limit:c.length},!0);return Promise.all([u,d])}))).reduce((c,[u,d])=>[...c,...u.data,...d.data],[])}catch(p){throw console.error("There was a problem fetching match IDs from both Top X and Match Quiz games",p),p}let l=new Set;return n.forEach(p=>{p.fixtures.map(u=>u.match_id).forEach(u=>l.add(u))}),Array.from(l)}let i=[],a=100;try{for(let o of e){let n=!0,l="",p=0;for(;n;){let c,u={limit:a,startAfter:l};o==="TOP_X"?(c=await this.topXFacade.getGamesNoRemap(u,!0),i=[...i,...c.data],l=c.meta.pagination.next_page_starts_after||null):o==="MATCH_QUIZ"&&(c=await this.matchQuizFacade.getGamesNoRemap(u,!0),i=[...i,...c.data],l=c.meta.pagination.next_page_starts_after||null),n=!!l,p++,p>=5&&(n=!1)}}let r=new Set;return i.forEach(o=>{o.fixtures.map(l=>l.match_id).forEach(l=>r.add(l))}),Array.from(r)}catch(r){throw console.error("There was a problem fetching match IDs from games",r),r}};initMatchFiltersForTemplates=async(t,e)=>{let i=[],a=[],r=[],o=t.fromDate?this.reformatDate(t.fromDate):null,n=t.toDate?this.reformatDate(t.toDate,!0):null,l=500;if(t.competitionIds&&t.competitionIds.length>0&&(i=Array.from(t.competitionIds)),t.teamIds&&t.teamIds.length>0&&(a=Array.from(t.teamIds)),t.matchIds&&t.matchIds.length>0&&(r=Array.from(t.matchIds)),(t.gameIds&&t.gameIds.length>0||t.gameTypes&&t.gameTypes.length>0)&&(r=await this.getMatchIdsFromGamesInTemplates(t.gameIds,t.gameTypes)),e){let c=t.groups.find(d=>d.groupId===e);if(!c)throw this.errorHandlingMode==="default"?new y(400,"invalid_template_group_id","There is no group in this template with the provided groupId"):new h(400,"invalid_template_group_id","There is no group in this template with the provided groupId");if(!c.filters)throw this.errorHandlingMode==="default"?new y(400,"invalid_template_group_filters","The provided template group has no filters"):new h(400,"invalid_template_group_filters","The provided template group has no filters");o=c.filters.fromDate?this.reformatDate(c.filters.fromDate):null,n=c.filters.toDate?this.reformatDate(c.filters.toDate,!0):null;let u=c.filters.matchIds.every(d=>d);c.filters.matchIds.length>0&&u&&(r=Array.from(c.filters.matchIds))}return new ft({competitionIds:i,teamIds:a,matchIds:r,fromDate:o,toDate:n,limit:l})};reformatDate=(t,e)=>{let i=new Date(t);e&&i.setUTCHours(23,59,59);let a=i.toISOString();return a=a.slice(0,-5)+"Z",a};extractEnabledBadgesId=t=>{let e=[];return t.forEach(i=>{i.enabled&&e.push(i.id)}),e};addEntityModelToFootballBadges=async t=>{let e=[],i=[],a=[],r=[];if(t.football&&t.football.length>0&&(e=t.football.filter(n=>n.requirements.entityType.toLocaleLowerCase()==="competition").map(n=>n.requirements.entityId),i=t.football.filter(n=>n.requirements.entityType.toLocaleLowerCase()==="team").map(n=>n.requirements.entityId),a=t.football.filter(n=>n.requirements.entityType.toLocaleLowerCase()==="player").map(n=>n.requirements.entityId),r=t.football.filter(n=>n.requirements.entityType.toLocaleLowerCase()==="match").map(n=>n.requirements.entityId)),t.voting&&t.voting.poll&&t.voting.poll.length>0){let[n,l,p,c]=this.extractEntityIdsFromBadges(t.voting.poll);e=e.concat(n),e=Array.from(new Set(e)),i=i.concat(l),i=Array.from(new Set(i)),a=a.concat(p),a=Array.from(new Set(a)),r=r.concat(c),r=Array.from(new Set(r))}if(t.voting&&t.voting.potm&&t.voting.potm.length>0){let[n,l,p,c]=this.extractEntityIdsFromBadges(t.voting.potm);e=e.concat(n),e=Array.from(new Set(e)),i=i.concat(l),i=Array.from(new Set(i)),a=a.concat(p),a=Array.from(new Set(a)),r=r.concat(c),r=Array.from(new Set(r))}let o=await this.fetchFootballEntities(e,i,a,r);t.football&&t.football.length>0&&t.football.forEach(n=>{this.setEntityModelsFromMap(n.requirements,"competition",o.competitions),this.setEntityModelsFromMap(n.requirements,"team",o.teams),this.setEntityModelsFromObject(n.requirements,"player",o.players),this.setEntityModelsFromObject(n.requirements,"match",o.matches)}),t.voting&&t.voting.poll&&t.voting.poll.length>0&&t.voting.poll.forEach(n=>{this.setEntityModelsFromMap(n.requirements,"competition",o.competitions),this.setEntityModelsFromMap(n.requirements,"team",o.teams),this.setEntityModelsFromObject(n.requirements,"player",o.players),this.setEntityModelsFromObject(n.requirements,"match",o.matches)}),t.voting&&t.voting.potm&&t.voting.potm.length>0&&t.voting.potm.forEach(n=>{this.setEntityModelsFromMap(n.requirements,"competition",o.competitions),this.setEntityModelsFromMap(n.requirements,"team",o.teams),this.setEntityModelsFromObject(n.requirements,"player",o.players),this.setEntityModelsFromObject(n.requirements,"match",o.matches)})};setEntityModelsFromMap=(t,e,i)=>{t.entityType===e&&(t.entityModel=i&&i.get(t.entityId)||null,t.entityModel&&(t.entityId=t.entityModel.id))};setEntityModelsFromObject=(t,e,i)=>{t.entityType===e&&(t.entityModel=i[t.entityId]?i[t.entityId]:null,t.entityModel&&(t.entityId=t.entityModel.id))};fetchFootballEntities=async(t,e,i,a)=>{let r={competitions:null,teams:null,players:null,matches:null};if(t.length){let o=await this.footballNamespace.footballFacade.getCompetitionsMapWithNativeIds(t);r.competitions=o}if(e.length){let o=await this.footballNamespace.footballFacade.getTeamsMapWithNativeIds(e);r.teams=o}if(i.length){let o=await this.footballNamespace.footballFacade.getPlayersMapWithNativeIds(i);r.players=o}if(a.length){let o=await this.footballNamespace.footballFacade.getMatchesMapWithNativeIds(a);r.matches=o}return r};extractEntityIdsFromBadges=t=>{let e=t.filter(o=>o.requirements.entityType&&o.requirements.entityType.toLocaleLowerCase()==="competition").map(o=>o.requirements.entityId),i=t.filter(o=>o.requirements.entityType&&o.requirements.entityType.toLocaleLowerCase()==="team").map(o=>o.requirements.entityId),a=t.filter(o=>o.requirements.entityType&&o.requirements.entityType.toLocaleLowerCase()==="player").map(o=>o.requirements.entityId),r=t.filter(o=>o.requirements.entityType&&o.requirements.entityType.toLocaleLowerCase()==="match").map(o=>o.requirements.entityId);return[e,i,a,r]};addGameModelToGamesBadges=async t=>{if(!t.games||t.games.length===0)return;let e=this.getGameIdsFromGamesBadge(t.games,"top_x"),i=this.getGameIdsFromGamesBadge(t.games,"match_quiz"),a=this.getGameIdsFromGamesBadge(t.games,"classic_quiz"),r=this.getGameIdsFromGamesBadge(t.games,"either_or"),o=await this.fetchGamesEntities(e,i,a,r);t.games.forEach(n=>{n.requirements.specificGames&&n.requirements.specificGames.forEach(l=>{l.gameModel=o.find(p=>p.id===l.gameId)||null})})};getGameIdsFromGamesBadge=(t,e)=>{let i=t.filter(a=>a.requirements.specificGames?a.requirements.specificGames.some(r=>r.gameType.toLocaleLowerCase()===e):!1).map(a=>a.requirements.specificGames.map(r=>r.gameId));return Array.prototype.concat.apply([],i)};fetchGamesEntities=async(t,e,i,a)=>{let r=[];if(t.length){let o=await this.topXFacade.getGames({gameIds:t});r=[...r,...o.data]}if(e.length){let o=await this.matchQuizFacade.getGames({gameIds:e});r=[...r,...o.data]}if(i.length){let o=await this.miniGamesNamespace.getClassicQuizzes({classicQuizIds:i});r=[...r,...o.data]}if(a.length){let o=await this.miniGamesNamespace.getEitherOrs({eitherOrIds:a});r=[...r,...o.data]}return r}};var kl=class{validate=(t,e)=>{t.market&&this.validateMarket(t.market,e),t.fromDate&&this.validateDate(t.fromDate,"fromDate",e),t.toDate&&this.validateDate(t.toDate,"toDate",e),t.usersCount&&this.validateNumberFilters(t.usersCount,"usersCount",e),t.minimumPredictions&&this.validateNumberFilters(t.minimumPredictions,"minimumPredictions",e)};validateMarket=(t,e)=>{if(!Object.keys(it).includes(t)){let a=Op(t);throw e==="default"?new y(400,"INVALID_MARKET",a):new h(400,"INVALID_MARKET",a)}};validateDate=(t,e,i)=>{let a=/^\d{4}-\d{2}-\d{2}$/;if(typeof t!="string")throw i==="default"?new y(400,"invalid_filters","You have provided invalid type. The valid type is "+`string for ${e} filter`):new h(400,"invalid_filters","You have provided invalid type. The valid type is "+`string for ${e} filter`);if(!a.test(t))throw i==="default"?new y(400,"invalid_filters","You have provided invalid value. The valid value is "+`YYYY-MM-DD for ${e}`):new h(400,"invalid_filters","You have provided invalid value. The valid value is "+`YYYY-MM-DD for ${e}`)};validateNumberFilters=(t,e,i)=>{let a=e==="usersCount"?1:0,r=e==="usersCount"?1e3:1e6;if(typeof t!="number")throw i==="default"?new y(400,"invalid_filters","You have provided invalid type. The valid type is "+`number for ${e} filter`):new h(400,"invalid_filters","You have provided invalid type. The valid type is "+`number for ${e} filter`);if(t<a||t>r)throw i==="default"?new y(400,"invalid_filters","You have provided invalid value. The valid value is "+`between ${a} and ${r}`):new h(400,"invalid_filters","You have provided invalid value. The valid value is "+`between ${a} and ${r}`)}};var Gl=class{limit=null;page=null;groupId=null;constructor(t){this.limit=t?.limit||null,this.page=t?.page||null,t?.groupId!==void 0&&console.warn("Warning: groupId filter property is deprecated and no longer supported by the API. This property will be removed in a future version. Please update your code accordingly.")}constructFiltersUrl(){let t="";return this.limit&&(t+="&",t+=`limit=${this.limit}`),this.page&&(t+="&",t+=`page=${this.page}`),t}};var Ul=class{config=null;clientHttps=null;loyaltyHttps=null;loyaltyService=null;profileFacade=null;loyaltyValidator=null;topXFacade=null;matchQuizFacade=null;predictorHttps=null;errorHandlingMode=null;football=null;constructor(t,e,i,a,r){this.config=t,this.clientHttps=e,this.loyaltyHttps=i,this.profileFacade=new _t(r,a),this.loyaltyService=new Nl(this.config),this.loyaltyValidator=new kl,this.topXFacade=new te(t),this.matchQuizFacade=new Xt(t),this.predictorHttps=new dt(t),this.errorHandlingMode=t.errorHandlingMode,this.football=new tt(t)}getConfig=async()=>await this.clientHttps.getConfig("loyalty");getConfigV2=async t=>{let e=await this.clientHttps.getNewLoyaltyConfig(t);return await this.loyaltyService.addEntityModelToFootballBadges(e.rewards.badges),await this.loyaltyService.addGameModelToGamesBadges(e.rewards.badges),e};getClientBadges=async()=>{let t=await this.getConfig();return this.loyaltyService.buildOldClientBadges(t.rewards.badges)};getClientBadgesV2=async t=>{let e=await this.clientHttps.getNewLoyaltyConfig(t);return this.loyaltyService.buildNewClientBadges(e.rewards.badges)};getTemplates=async(t,e)=>{if(t&&(t=new wo(t)),this.config.idSchema==="native")return await this.loyaltyHttps.getTemplates(t,e);let i=await this.loyaltyHttps.getTemplates(t,e);i.data=await this.loyaltyService.remapTemplatesIds([...i.data]);for(let a of i.data)await this.loyaltyService.remapTemplateGroupMatchIds(a.groups);return i};getTemplateById=async(t,e)=>{let i=await this.loyaltyHttps.getTemplateById(t,e);if(this.config.idSchema==="native")return i;let a=await this.loyaltyService.remapTemplatesIds([i]);return await this.loyaltyService.remapTemplateGroupMatchIds(a[0].groups),a[0]};getLeaderboard=async(t,e,i)=>{e=this.loyaltyService.initFilters(e,"loyalty");let a=await this.loyaltyHttps.getLeaderboard(t,i,e);return a.data=await this.loyaltyService.addProfileModelToLeaderboard(a.data),a};getLeaderboardForGame=async(t,e,i)=>{e&&(e=new Gl(e));let a=await this.loyaltyHttps.getLeaderboardForGame(t,i,e);return a.data=await this.loyaltyService.addProfileModelToLeaderboard(a.data),a};getLeaderboardForLeague=async(t,e)=>{e=this.loyaltyService.initFilters(e,"league_leaderboard");let i=await this.loyaltyHttps.getLeaderboardForLeague(t,e);return i.data=await this.loyaltyService.addProfileModelToLeaderboard(i.data),i};getOwnRankings=async(t,e)=>{let{id:i}=await this.profileFacade.getOwn();return this.getUserRankings(i,t,e)};getUserRankings=async(t,e,i)=>{e=this.loyaltyService.initFilters(e,"rankings");let a=await this.loyaltyHttps.getUserRankings(t,e,i);return await this.getModelsForUserRankings(a)};getHighestSuccessRate=async(t,e)=>{t&&(t=new yo(t),this.loyaltyValidator.validate(t,this.errorHandlingMode));let i=await this.loyaltyHttps.getHighestSuccessRate(t,e);return this.loyaltyService.addProfileModelToHighestSuccessRate(i)};getTemplateWinners=async(t,e)=>{let i=await this.predictorHttps.getContestWinners(t,e),a=await this.getTemplateById(t);return i.contestModel=a,this.loyaltyService.completeContestWinners(i)};getEntitiesFollows=async(t,e)=>{this.loyaltyService.validateEntitiesFollowsFilters(t),this.config.idSchema!=="native"&&(t=await this.loyaltyService.remapEntitiesFollowsFilters(t));let i=await this.loyaltyHttps.getEntitiesFollows(t,e);return await this.loyaltyService.addModelsToEntitiesFollows(i)};getModelsForUserRankings=async t=>{let e=null,i=null,a=null,[r,o,n]=this.loyaltyService.extractRankingsIdsMap(t.data);if(n.length&&(e=(await this.getTemplates()).data.filter(p=>n.includes(p.id))),r.length){let l={gameIds:r};i=(await this.topXFacade.getGames(l)).data}if(o.length){let l={gameIds:o};a=(await this.matchQuizFacade.getGames(l)).data}return this.loyaltyService.setModelsForUserRankings(i,a,e,t)};getTemplateMatches=async(t,e,i)=>{let a=await this.getTemplateById(t,i);if((!a.competitionIds||a.competitionIds.length===0)&&(!a.teamIds||a.teamIds.length===0)&&(!a.matchIds||a.matchIds.length===0)&&(!a.gameIds||a.gameIds.length===0)&&(!a.gameTypes||a.gameTypes.length===0)&&(!a.groups||a.groups.length===0))return[];let r=await this.loyaltyService.initMatchFiltersForTemplates(a,e);return(await this.football.getMatches(r,i)).data}};var ee=class{clientHttps=null;profileHttps=null;loyaltyHttps=null;loyaltyFacade=null;localCache=null;constructor(t){this.clientHttps=new W(t),this.profileHttps=new yi(t),this.loyaltyHttps=new Rt(t),this.localCache=new pt().createLocalCacheInstance(t.idSchema),this.loyaltyFacade=new Ul(t,this.clientHttps,this.loyaltyHttps,this.profileHttps,this.localCache)}getConfig=async()=>await this.loyaltyFacade.getConfig();getConfigV2=async t=>await this.loyaltyFacade.getConfigV2(t);getClientBadges=async()=>await this.loyaltyFacade.getClientBadges();getClientBadgesV2=async t=>await this.loyaltyFacade.getClientBadgesV2(t);getTemplates=async(t,e)=>await this.loyaltyFacade.getTemplates(t,e);getTemplateById=async(t,e)=>await this.loyaltyFacade.getTemplateById(t,e);getLeaderboard=async(t,e,i)=>await this.loyaltyFacade.getLeaderboard(t,e,i);getLeaderboardForGame=async(t,e,i)=>await this.loyaltyFacade.getLeaderboardForGame(t,e,i);getLeaderboardForLeague=async(t,e)=>await this.loyaltyFacade.getLeaderboardForLeague(t,e);getOwnRankings=async(t,e)=>await this.loyaltyFacade.getOwnRankings(t,e);getUserRankings=async(t,e,i)=>await this.loyaltyFacade.getUserRankings(t,e,i);getHighestSuccessRate=async(t,e)=>await this.loyaltyFacade.getHighestSuccessRate(t,e);getTemplateWinners=async(t,e)=>await this.loyaltyFacade.getTemplateWinners(t,e);getEntitiesFollows=async(t,e)=>await this.loyaltyFacade.getEntitiesFollows(t,e);getTemplateMatches=async(t,e,i)=>await this.loyaltyFacade.getTemplateMatches(t,e,i)};var Vl=class{predictorHttps=null;clientHttps=null;idMapping=null;predictorService=null;predictorValidator=null;errorHandlingMode=null;constructor(t,e,i,a){this.predictorHttps=e,this.idMapping=a,this.clientHttps=i,this.errorHandlingMode=t.errorHandlingMode,this.predictorValidator=new Yt(t.errorHandlingMode),this.predictorService=new St(t,a)}makeFootballPrediction=async(t,e,i,a)=>{let r=this.predictorValidator.validateFixture(t,e,i,a),o=new Ze;if(this.idMapping.idSchema!=="native"){let n=r.matchId,l="",p=await this.predictorService.remapMatchIdToNative([n]);if(r.matchId=p[0],this.errorHandlingMode==="default"&&!r.matchId)throw new y(400,"INVALID_FIELD","Match id is invalid!").errorMessage();if(this.errorHandlingMode==="standard"&&!r.matchId)throw new h(400,"INVALID_FIELD","Match id is invalid!");if(r instanceof ot&&r.prediction.playerId!=="OWN_GOAL"){if(r.prediction.playerId&&(l=r.prediction.playerId,r.prediction.playerId=await this.predictorService.remapPlayerIdToNative([l])),this.errorHandlingMode==="default"&&r.market!==qi&&!r.prediction.playerId)throw new y(400,"INVALID_FIELD","Player id is invalid!").errorMessage();if(this.errorHandlingMode==="standard"&&r.market!==qi&&!r.prediction.playerId)throw new h(400,"INVALID_FIELD","Player id is invalid!")}o.fixtures=[r];let c=await this.predictorHttps.makeFootballPrediction(o);return c.fixtures.forEach(u=>{u.prediction.playerId&&u.prediction.playerId!=="OWN_GOAL"&&(u.prediction.playerId=l),u.matchId=n}),c}else return o.fixtures=[r],await this.predictorHttps.makeFootballPrediction(o)};getMatchSummary=async(t,e)=>{let i=await this.getMatchSummaryBase(t,e),a=JSON.parse(JSON.stringify(i.predictions)),r=await this.predictorService.remapPlayerIdToIdSchema(a);return i.predictions=r,i};getMarketSummary=async(t,e,i,a)=>{try{let r=await this.getMatchSummaryBase(t,a);return await this.predictorService.getMarketSummary(r,e,i)}catch(r){throw r}};getMatchSummaryBase=async(t,e)=>{if(this.idMapping.idSchema!=="native"){let a=(await this.predictorService.remapMatchIdToNative([t]))[0],r=await this.predictorHttps.getMatchSummary(a,e);return r.matchId=t,r}else return await this.predictorHttps.getMatchSummary(t,e)};getConfig=async()=>{let t=await this.clientHttps.getConfig("predictor");return this.idMapping.idSchema!=="native"?await this.predictorService.remapCompetitionsFromConfig(t):t};deleteFootballPrediction=async t=>await this.predictorHttps.deleteFootballPrediction(t);getMyPredictions=async t=>{let e=this.predictorService.initPredictionsFilters(t,"user");return await this.predictorHttps.getMyPredictions(e)};getMyPredictionsForMatches=async(t,e)=>{if(this.errorHandlingMode==="default"&&this.predictorService.areIdsExceeded(t))throw new y(400,"EXCEEDED_LENGTH","Maximum matchIds in PredictionFilters should be 10 or less.").errorMessage();if(this.errorHandlingMode==="standard"&&this.predictorService.areIdsExceeded(t))throw new h(400,"EXCEEDED_LENGTH","Maximum matchIds in PredictionFilters should be 10 or less.");this.idMapping.idSchema!=="native"&&(t=await this.predictorService.remapMatchIdToNative([...t]));let i=this.predictorService.initPredictionsFilters(e,"matches",t);return await this.predictorHttps.getMyPredictions(i)};getMyCurrentPredictions=async t=>{let e=this.predictorService.initPredictionsFilters(t,"current");return await this.predictorHttps.getMyPredictions(e)};getMyPastPredictions=async t=>{let e=this.predictorService.initPredictionsFilters(t,"past");return await this.predictorHttps.getMyPredictions(e)};getUserPredictions=async(t,e,i)=>{let a=this.predictorService.initPredictionsFilters(e,"user");return await this.predictorHttps.getUserPredictions(t,i,a)};getUserCurrentPredictions=async(t,e,i)=>{let a=this.predictorService.initPredictionsFilters(e,"current");return await this.predictorHttps.getUserPredictions(t,i,a)};getUserPastPredictions=async(t,e,i)=>{let a=this.predictorService.initPredictionsFilters(e,"past");return await this.predictorHttps.getUserPredictions(t,i,a)};getUserPredictionsForMatches=async(t,e,i,a)=>{if(this.errorHandlingMode==="default"&&this.predictorService.areIdsExceeded(e))throw new y(400,"EXCEEDED_LENGTH","Maximum matchIds in PredictionFilters should be 10 or less.").errorMessage();if(this.errorHandlingMode==="standard"&&this.predictorService.areIdsExceeded(e))throw new h(400,"EXCEEDED_LENGTH","Maximum matchIds in PredictionFilters should be 10 or less.");this.idMapping.idSchema!=="native"&&(e=await this.predictorService.remapMatchIdToNative([...e]));let r=this.predictorService.initPredictionsFilters(i,"matches",e);return await this.predictorHttps.getUserPredictions(t,a,r)};getPredictionById=async t=>await this.predictorHttps.getPredictionById(t);getPredictionsByIds=async t=>await this.predictorHttps.getPredictionsByIds(t);getMatchMarketsResults=async t=>(this.idMapping.idSchema!=="native"&&(t=(await this.predictorService.remapMatchIdToNative([t]))[0]),await this.predictorService.getMatchMarketsResults(t))};var Hl=class extends Q{constructor(t){super(t.errorHandlingMode)}validateMatchSummary=t=>{t||this.throwException(400,"invalid_match_summary","Match summary is required."),t.predictions||this.throwException(400,"invalid_match_summary_predictions","Predictions in match summary are required."),(!t.predictions.correctScore||!t.predictions.correctScoreAdvanced)&&this.throwException(400,"invalid_match_summary_predictions_keys","Keys in predictions in match summary are invalid. The valid ones are: "+"correctScore and correctScoreAdvanced")}};var $l=class{validator=null;constructor(t){this.validator=new Hl(t)}calculateOneXTwoFromScores=t=>{this.validator.validateMatchSummary(t);let{correctScore:e,correctScoreAdvanced:i}=t.predictions,a={...e,...i},r=0,o=0,n=0,l=0;return Object.entries(a).forEach(([p,c])=>{if(c===0)return;let u=c;r+=u;let[d,b]=p.split(":").map(Number);d>b?o+=u:d===b?n+=u:l+=u}),{home:r?Math.round(o/r*100):0,draw:r?Math.round(n/r*100):0,away:r?Math.round(l/r*100):0}};getTopCorrectScores=t=>{this.validator.validateMatchSummary(t);let{correctScore:e,correctScoreAdvanced:i}=t.predictions,a={...e,...i},r=0;return Object.values(a).forEach(o=>{r+=o}),Object.entries(a).filter(([o,n])=>n>0).map(([o,n])=>({score:o,percentage:Math.round(n/r*100)})).sort((o,n)=>n.percentage-o.percentage).slice(0,3)}};var xi=class{predictorHttps=null;clientHttps=null;predictorFacade=null;idMapping=null;helpers=null;constructor(t){this.idMapping=new R(t),this.predictorHttps=new dt(t),this.clientHttps=new W(t),this.predictorFacade=new Vl(t,this.predictorHttps,this.clientHttps,this.idMapping),this.helpers=new $l(t)}makeFootballPrediction=async(t,e,i,a)=>await this.predictorFacade.makeFootballPrediction(t,e,i,a);getMatchSummary=async(t,e)=>await this.predictorFacade.getMatchSummary(t,e);getMarketSummary=async(t,e,i,a)=>await this.predictorFacade.getMarketSummary(t,e,i,a);getConfig=async()=>await this.predictorFacade.getConfig();deleteFootballPrediction=async t=>await this.predictorFacade.deleteFootballPrediction(t);getMyPredictions=async t=>await this.predictorFacade.getMyPredictions(t);getMyCurrentPredictions=async t=>await this.predictorFacade.getMyCurrentPredictions(t);getMyPastPredictions=async t=>await this.predictorFacade.getMyPastPredictions(t);getMyPredictionsForMatches=async(t,e)=>await this.predictorFacade.getMyPredictionsForMatches(t,e);getUserPredictions=async(t,e,i)=>await this.predictorFacade.getUserPredictions(t,e,i);getUserCurrentPredictions=async(t,e,i)=>await this.predictorFacade.getUserCurrentPredictions(t,e,i);getUserPastPredictions=async(t,e,i)=>await this.predictorFacade.getUserPastPredictions(t,e,i);getUserPredictionsForMatches=async(t,e,i,a)=>await this.predictorFacade.getUserPredictionsForMatches(t,e,i,a);getPredictionById=async t=>await this.predictorFacade.getPredictionById(t);getPredictionsByIds=async t=>await this.predictorFacade.getPredictionsByIds(t);getMatchMarketsResults=async t=>await this.predictorFacade.getMatchMarketsResults(t)};var Di=class{loyalty=null;profile=null;predictor=null;constructor(t){this.loyalty=new ee(t),this.profile=new D(t),this.predictor=new xi(t)}setTemplateModels=async t=>{let e=await this.loyalty.getTemplates();t.templateModel=e.data.find(i=>i.id===t.templateId),t.pastTemplates&&t.pastTemplates.length>0&&t.pastTemplates.forEach(i=>{i.model=e.data.find(a=>a.id===i.id)})};setTemplateModelsInLeagues=async t=>{if(!t.length)return;let e=await this.loyalty.getTemplates();t.forEach(i=>{i.templateModel=e.data.find(a=>a.id===i.templateId),i.pastTemplates&&i.pastTemplates.length>0&&i.pastTemplates.forEach(a=>{a.model=e.data.find(r=>r.id===a.id)})})};setTemplateModelsFromLeagueModels=(t,e)=>{if(e==="PRIVATE_LEAGUE"){t.forEach(i=>{i.templateModel=i.templateId===i.privateLeagueModel.templateId?i.privateLeagueModel.templateModel:i.privateLeagueModel.pastTemplates.find(a=>a.id===i.templateId).model});return}t.forEach(i=>{i.templateModel=i.templateId===i.challengeModel.templateId?i.challengeModel.templateModel:i.challengeModel.pastTemplates.find(a=>a.id===i.templateId).model})};setProfileModel=async t=>{let e=await this.profile.getById(t.profileId).getInfo();t.profileModel=e};setModelsForPredictions=async t=>{if(t.data.length){let e=t.data.map(o=>o.profileId),i=t.data.map(o=>o.predictionId),a=await this.getProfileModels(e),r=await this.getPredictionModels(i);t.data.forEach(o=>{o.profileModel=a.find(n=>n.id===o.profileId),o.predictionModel=r.find(n=>n.id===o.predictionId)})}return t};getProfileModels=async t=>await this.profile.getByIds(t);getPredictionModels=async t=>await this.predictor.getPredictionsByIds(t)};var ie=class{idSchema=null;profile=null;validator=null;idMapping=null;constructor(t){this.idSchema=t.idSchema,this.profile=new D(t),this.validator=new Jt(t),this.idMapping=new R(t)}finalizePostFullModel=async t=>{let e=t.map(a=>a.userId),i=await this.profile.getByIds(e);return t.map(a=>(a.userModel=this.extractModelById(i,a.userId),a))};finalizeTopDiscussionsFilters=async t=>{if(this.idSchema!=="native"&&t.entityIds&&t.entityIds.length>0){this.validator.validateFilters(t);let e=await this.idMapping.getEntityIdsBySchemaId(Array.from(t.entityIds),t.entityType,"native");t.entityIds=e[t.entityType]}};extractModelById=(t,e)=>{if(t.length){let i=t.find(a=>a.id===e);return i?(delete i.interests,i):null}return null}};var Wl=class{factory=null;https=null;loyaltyHttps=null;profile=null;service=null;discussionsService=null;constructor(t){this.factory=new Ai,this.https=new Ci(t),this.service=new Di(t),this.loyaltyHttps=new Rt(t),this.profile=new D(t),this.discussionsService=new ie(t)}issue=async(t,e)=>{let i=this.factory.createRequestBodyFromParam(t,"ONE_VS_ONE"),a=await this.https.create(i,"CHALLENGE");await this.service.setTemplateModels(a);let r=await this.https.invite(a.id,[e]);return a.invites=[],a.invites.push(r[0]),a};update=async(t,e)=>{let i=this.factory.createUpdateRequestBodyFromParam(e,"ONE_VS_ONE"),a=await this.https.update(t,i,"CHALLENGE");return await this.service.setTemplateModels(a),a};updateTemplate=async(t,e,i)=>{let a=await this.https.updateLeagueTemplate(t,e,i,"CHALLENGE");return await this.service.setTemplateModels(a),a};delete=async t=>await this.https.delete(t,"CHALLENGE");getById=async(t,e)=>{let i=await this.https.getById(t,"CHALLENGE",e);return await this.service.setTemplateModels(i),i};getMyChallenges=async t=>{t=new gr(t);let e=await this.https.getMyLeagues(t,"CHALLENGE");return await this.service.setTemplateModelsInLeagues(e),e};accept=async t=>{let i=await this.https.accept(t,!0,"CHALLENGE");return await this.finalizeAcceptModel(i,!0)};reject=async t=>{let i=await this.https.accept(t,!1,"CHALLENGE");return await this.finalizeAcceptModel(i,!1)};leave=async t=>await this.https.leave(t,"CHALLENGE");finalizeAcceptModel=async(t,e)=>{if(e){let i=await this.getById(t.challengeId);t.challengeModel=i}return await this.service.setProfileModel(t),t};getMyChallengesStandings=async t=>{t&&(t=new fr(t));let e=await this.profile.getOwn().getInfo(),i=await this.loyaltyHttps.getUserRankingsForPrivateLeagueAndChallenges(e.id,"CHALLENGE",t);for(let a of i.data){let r=await this.getById(a.challengeId);a.challengeModel=r}return this.service.setTemplateModelsFromLeagueModels(i.data,"CHALLENGE"),i};getInvitations=async t=>{t=new ei(t),t.type="ONE_VS_ONE";let e=await this.https.getInvitations("CHALLENGE",t);return await this.service.setTemplateModelsInLeagues(e.data),e};getReportedPosts=async(t,e)=>{e&&(e=new ii(e));let i=await this.https.getReportedPosts(t,e);return i.data=await this.discussionsService.finalizePostFullModel(i.data),i};getPredictions=async(t,e)=>{if(e){if(e.limit&&e.limit>20)throw new h(400,"invalid_limit","Invalid limit. The maximum limit is: "+20 .toString());e=new ai(e)}let i=await this.https.getPredictions(t,e);return await this.service.setModelsForPredictions(i)};moderatePost=async(t,e)=>await this.https.moderatePost(t,e)};var ql=class{facade=null;constructor(t){this.facade=new Wl(t)}issue=async(t,e)=>await this.facade.issue(t,e);update=async(t,e)=>await this.facade.update(t,e);updateTemplate=async(t,e,i)=>await this.facade.updateTemplate(t,e,i);delete=async t=>await this.facade.delete(t);getById=async(t,e)=>await this.facade.getById(t,e);getMyChallenges=async t=>await this.facade.getMyChallenges(t);accept=async t=>await this.facade.accept(t);reject=async t=>await this.facade.reject(t);leave=async t=>await this.facade.leave(t);getMyChallengesStandings=async t=>await this.facade.getMyChallengesStandings(t);getInvitations=async t=>await this.facade.getInvitations(t);getReportedPosts=async(t,e)=>await this.facade.getReportedPosts(t,e);getPredictions=async(t,e)=>await this.facade.getPredictions(t,e);moderatePost=async(t,e)=>await this.facade.moderatePost(t,e)};var zl=class extends v{remapper=null;constructor(t){super(t,O(t.environment,"discussions")),this.remapper=new vi}getAll=async(t,e)=>{let i="/discussions"+this.apiSignInUrl;t&&(i+=`${t.constructMainFiltersUrl()}`),g(e)&&(i+=m());let a="There was a problem getting discussions",r=await this.fetchWithoutAuth(i,a);return this.remapper.remapToDiscussions(r)};getById=async t=>{let e=`/discussions/${t}`+this.apiSignInUrl,i="There was a problem getting discussion",a=await this.fetchWithoutAuth(e,i);return this.remapper.remapToDiscussionById(a.data)};createPost=async(t,e)=>{let i=`/discussions/${t}/posts`+this.apiSignInUrl,a="There was a problem creating post in discussion",r="POST",o=await this.fetchWithAuth(i,a,r,e);return this.remapper.remapToPostByIdBasic(o.data)};getPostById=async t=>{let e=`/posts/${t}`+this.apiSignInUrl,i="There was a problem getting post by ID in discussion",a=await this.fetchWithoutAuth(e,i);return this.remapper.remapToPostByIdFull(a.data)};updatePost=async(t,e)=>{let i=`/posts/${t}`+this.apiSignInUrl,a="There was a problem editing post in discussion",r="PUT",o={content:e},n=await this.fetchWithAuth(i,a,r,o);return this.remapper.remapToPostByIdBasic(n.data)};reactToPost=async(t,e)=>{let i=`/posts/${t}/reaction`+this.apiSignInUrl,a="There was a problem reacting to post in discussion",r="PUT",o={reaction:e.toLocaleLowerCase()},n=await this.fetchWithAuth(i,a,r,o);return this.remapper.remapToPostByIdFull(n.data)};deletePost=async t=>{let e=`/posts/${t}`+this.apiSignInUrl,i="There was a problem deleting post in discussion",a="DELETE";return await this.fetchWithAuth(e,i,a),!0};getPosts=async(t,e)=>{let i=`/discussions/${t}/posts`+this.apiSignInUrl;e&&(i+=`${e.constructMainFiltersUrl()}`);let a="There was a problem getting posts in discussion",r=await this.fetchWithoutAuth(i,a);return this.remapper.remapToPostsForDiscussion(r,"full")};getPostReplies=async(t,e)=>{let i=`/posts/${t}/replies`+this.apiSignInUrl;e&&(i+=`${e.constructMainFiltersUrl()}`);let a="There was a problem getting post's replies in discussion",r=await this.fetchWithoutAuth(i,a);return this.remapper.remapToPostsForDiscussion(r,"full")};reportPost=async(t,e,i)=>{let a=`/posts/${t}/report`+this.apiSignInUrl,r="There was a problem reporting post in discussion",o="POST",n={reason:e.toLocaleUpperCase(),reason_details:i||null},l=await this.fetchWithAuth(a,r,o,n);return this.remapper.remapToPostByIdBasic(l.data)};getOwnPosts=async t=>{let e="/posts"+this.apiSignInUrl;t&&(e+=`${t.constructMainFiltersUrl()}`);let i="There was a problem getting own posts",a=await this.fetchWithAuth(e,i);return this.remapper.remapToPosts(a)};getUserPosts=async(t,e,i)=>{let a=`/posts/users/${t}`+this.apiSignInUrl;e&&(a+=`${e.constructMainFiltersUrl()}`),g(i)&&(a+=m());let r="There was a problem getting user's posts",o=await this.fetchWithoutAuth(a,r);return this.remapper.remapToPosts(o)};getPostsCount=async(t,e)=>{let i="/discussions/posts/count"+this.apiSignInUrl+`&discussion_ids=${t.join(",")}`;g(e)&&(i+=m());let a="There was a problem getting posts count for discussions",r=await this.fetchWithoutAuth(i,a);return this.remapper.remapToPostCount(r.data)};getTopDiscussions=async(t,e)=>{let i="/discussions/top"+this.apiSignInUrl;t&&(i+=`${t.constructMainFiltersUrl()}`),g(e)&&(i+=m());let a="There was a problem getting top discussions",r=await this.fetchWithoutAuth(i,a);return this.remapper.remapToDiscussions(r)};getPostsCountExtended=async t=>{let e="/discussions/posts/count"+this.apiSignInUrl,i={discussion_ids:Array.from(t)},a="POST",r="There was a problem getting posts count extended for discussions",o=await this.fetchWithoutAuth(e,r,a,i);return this.remapper.remapToPostCount(o.data)}};var Ql=class{createRequestBodyFromParam=t=>{let e=new Ir;return e.content=t.content,e.reply_id=t.replyId,e.discussion_label=t.discussionLabel,e.discussion_url=t.discussionUrl,e.anonymous_nickname=t.userNickname,e.context=t.context,e}};var Kl=class{idSchema=null;errorHandlingMode=null;https=null;clientHttps=null;activityService=null;service=null;factory=null;LIMIT_POSTS_COUNT=50;LIMIT_POSTS_COUNT_EXTENDED=250;constructor(t){this.idSchema=t.idSchema,this.errorHandlingMode=t.errorHandlingMode,this.https=new zl(t),this.clientHttps=new W(t),this.activityService=new It(t),this.service=new ie(t),this.factory=new Ql}getAll=async(t,e)=>{t&&(t=new Sr(t));let i=await this.https.getAll(t,e);for(let a of i.data)await this.remapTags(a,"native",this.idSchema);return i};getById=async t=>{let e=await this.https.getById(t);return await this.remapTags(e,"native",this.idSchema),e};createPost=async(t,e)=>{let i=JSON.parse(JSON.stringify(e));await this.remapTags(i,this.idSchema,"native");let a=this.factory.createRequestBodyFromParam(i);return await this.https.createPost(t,a)};getPostById=async t=>{let e=await this.https.getPostById(t);return(await this.service.finalizePostFullModel([e]))[0]};updatePost=async(t,e)=>await this.https.updatePost(t,e);deletePost=async t=>await this.https.deletePost(t);getPosts=async(t,e)=>{e&&(e=new qt(e));let i=await this.https.getPosts(t,e);return i.data=await this.service.finalizePostFullModel(i.data),i};getPostReplies=async(t,e)=>{e&&(e=new qt(e));let i=await this.https.getPostReplies(t,e);return i.data=await this.service.finalizePostFullModel(i.data),i};reactToPost=async(t,e)=>{let i=await this.https.reactToPost(t,e);return(await this.service.finalizePostFullModel([i]))[0]};reportPost=async(t,e,i)=>await this.https.reportPost(t,e,i);getOwnPosts=async t=>(t&&(t=new qt(t)),await this.https.getOwnPosts(t));getUserPosts=async(t,e,i)=>(e&&(e=new qt(e)),await this.https.getUserPosts(t,e,i));getConfig=async()=>await this.clientHttps.getConfig("discussions");getPostsCount=async(t,e)=>{if(!t||!Array.isArray(t)||!t.length)throw this.errorHandlingMode==="standard"?new h(400,"invalid_discussion_ids","Invalid discussion ids argument. Please provide at least one discussion id in an array"):new y(400,"invalid_discussion_ids","Invalid discussion ids argument. Please provide at least one discussion id in an array");if(t.length>this.LIMIT_POSTS_COUNT)throw this.errorHandlingMode==="standard"?new h(400,"invalid_discussion_ids","Maximum number of discussion ids exceeded. The maximum number of discussion ids is 50. You can use 'getPostsCountExtended' method for more than 50 discussion ids."):new y(400,"invalid_discussion_ids","Maximum number of discussion ids exceeded. The maximum number of discussion ids is 50. You can use 'getPostsCountExtended' method for more than 50 discussion ids.");return await this.https.getPostsCount(t,e)};getTopDiscussions=async(t,e)=>{t&&(t=new vr(t),await this.service.finalizeTopDiscussionsFilters(t));let i=await this.https.getTopDiscussions(t,e);for(let a of i.data)await this.remapTags(a,"native",this.idSchema);return i};getPostsCountExtended=async t=>{if(!t||!Array.isArray(t)||!t.length)throw this.errorHandlingMode==="standard"?new h(400,"invalid_discussion_ids","Invalid discussion ids argument. Please provide at least one discussion id in an array"):new y(400,"invalid_discussion_ids","Invalid discussion ids argument. Please provide at least one discussion id in an array");if(t.length>this.LIMIT_POSTS_COUNT_EXTENDED)throw this.errorHandlingMode==="standard"?new h(400,"invalid_discussion_ids","Maximum number of discussion ids exceeded. The maximum number of discussion ids is: "+this.LIMIT_POSTS_COUNT_EXTENDED):new y(400,"invalid_discussion_ids","Maximum number of discussion ids exceeded. The maximum number of discussion ids is: "+this.LIMIT_POSTS_COUNT_EXTENDED);return await this.https.getPostsCountExtended(t)};remapTags=async(t,e,i)=>{if(this.idSchema!="native"&&t.context&&t.context.tags&&t.context.tags.length){let a=JSON.parse(JSON.stringify(t.context.tags)),r=await this.activityService.remapTagsIds(a,e,i);t.context.tags=r}}};var jl=class{facade=null;constructor(t){this.facade=new Kl(t)}getAll=async(t,e)=>await this.facade.getAll(t,e);getById=async t=>await this.facade.getById(t);createPost=async(t,e)=>await this.facade.createPost(t,e);getPostById=async t=>await this.facade.getPostById(t);updatePost=async(t,e)=>await this.facade.updatePost(t,e);deletePost=async t=>await this.facade.deletePost(t);getPosts=async(t,e)=>await this.facade.getPosts(t,e);getPostReplies=async(t,e)=>await this.facade.getPostReplies(t,e);react=async(t,e)=>await this.facade.reactToPost(t,e);reportPost=async(t,e,i)=>await this.facade.reportPost(t,e,i);getOwnPosts=async t=>await this.facade.getOwnPosts(t);getUserPosts=async(t,e,i)=>await this.facade.getUserPosts(t,e,i);getConfig=async()=>await this.facade.getConfig();getPostsCount=async(t,e)=>await this.facade.getPostsCount(t,e);getTopDiscussions=async(t,e)=>await this.facade.getTopDiscussions(t,e);getPostsCountExtended=async t=>await this.facade.getPostsCountExtended(t)};var Yl=class extends Q{constructor(t){super(t)}validatePrediction=t=>{(!t.fixtures||!Array.isArray(t.fixtures)||t.fixtures.length===0)&&this.throwException(400,"invalid_method_call","Fixtures field is required and should contain at least one fixtures object. For more information please visit our documentation");let e=["id","predictionType","prediction"];for(let i of t.fixtures)(Object.keys(i).length!==e.length||Object.keys(i).some(a=>!e.includes(a)))&&this.throwException(400,"invalid_method_call","Fixtures field is invalid. For more information please visit our documentation"),this.validatePredictionType(i.predictionType,i.prediction);t.tiebreaker&&(!t.tiebreaker.statTotal||!Number.isInteger(t.tiebreaker.statTotal))&&this.throwException(400,"invalid_method_call","Tiebreaker field is invalid. It should contain statTotal key with integer value. For more information please visit our documentation")};validatePredictionType=(t,e)=>{switch(t){case"BOOLEAN":typeof e!="boolean"&&this.throwException(400,"invalid_method_call",`Prediction must be a boolean for prediction type ${t}`);break;case"NUMBER":(typeof e!="number"||!Number.isFinite(e))&&this.throwException(400,"invalid_method_call",`Prediction must be a number for prediction type ${t}`);break;case"ENUM":case"FREE_INPUT":(typeof e!="string"||e.trim()==="")&&this.throwException(400,"invalid_method_call",`Prediction must be a non-empty string for prediction type ${t}`);break;default:this.throwException(400,"invalid_method_call",`Unknown prediction type: ${t}`)}}};var Xl=class{https=null;validator=null;profile=null;constructor(t){this.https=new Wt(t),this.profile=new D(t),this.validator=new Yl(t.errorHandlingMode)}getGames=async(t,e)=>(t&&(t=new Cr(t)),await this.https.getEventGames(t,e));getGameById=async(t,e)=>await this.https.getEventGameById(t,e);makePrediction=async(t,e)=>(this.validator.validatePrediction(e),await this.https.makeEventGamePrediction(t,e));updatePrediction=async(t,e,i)=>(this.validator.validatePrediction(i),await this.https.updateEventGamePrediction(t,e,i));getGamePredictionsForUser=async(t,e,i,a)=>{i&&(i=new Ar(i));let r=await this.https.getEventGamePredictionsForUser(t,e,i,a),o=null;try{o=await this.profile.getById(e).getInfo()}catch(n){console.error(n)}return r.data.forEach(n=>{n.profileModel=o}),r};getRankings=async(t,e,i)=>{e&&(e=new Or(e));let a=await this.https.getEventGameRankings(t,e,i),r=a.data.map(n=>n.profileId),o=[];return r.length>0&&(o=await this.profile.getByIds(r),a.data=a.data.map(n=>(n.profileModel=o.find(l=>l.id===n.profileId)||null,n))),a}};var Jl=class{facade=null;constructor(t){this.facade=new Xl(t)}getGames=async(t,e)=>await this.facade.getGames(t,e);getGameById=async(t,e)=>await this.facade.getGameById(t,e);makePrediction=async(t,e)=>await this.facade.makePrediction(t,e);updatePrediction=async(t,e,i)=>await this.facade.updatePrediction(t,e,i);getGamePredictionsForUser=async(t,e,i,a)=>await this.facade.getGamePredictionsForUser(t,e,i,a);getRankings=async(t,e,i)=>await this.facade.getRankings(t,e,i)};var nd=["minutesPlayed","cleanSheets","concededGoals","saves","penaltySaved","penaltyCommitted","yellowCards","redCards","assists","foulsCommitted","ownGoals","goals","tackles","shotsOn"],ld=new Map().set("minutesPlayed","Minutes Played").set("cleanSheets","Clean Sheets").set("concededGoals","Goals Conceded").set("saves","Saves").set("penaltySaved","Penalties Saved").set("penaltyCommitted","Penalties Committed").set("yellowCards","Yellow Cards").set("redCards","Red Cards").set("assists","Assists").set("foulsCommitted","Fouls Committed").set("ownGoals","Own Goals").set("goals","Goals").set("tackles","Tackles").set("shotsOn","Shots On Target"),Bi=class{static createFantasyPrediction(t,e,i,a){let r=new xe;return r.template_id=t||null,r.group_id=e||null,r.fixtures=i?.map(o=>({player_id:o,match_type:"FOOTBALL",market:"PLAYER_PERFORMANCE",role:a?.get(o)?.toLocaleUpperCase()||null}))||[],r}static createFantasyPlayerStats(t){return nd.map(e=>{let i=new Br,a=t.data.reduce((r,o)=>r+o.stats[e],0);return i.key=e,i.label=ld.get(e),i.value=a,i})}};var Zl=class{idMapping=null;idSchema=null;errorHandlingModel=null;football=null;constructor(t){this.idSchema=t.idSchema,this.errorHandlingModel=t.errorHandlingMode,this.football=new tt(t),this.idMapping=new R(t)}remapCompetitions=async t=>{let e={competition:t};return(await this.idMapping.idMappingFacade.getEntitiesByIds(e,"native",this.idSchema)).competition};remapPlayers=async(t,e,i,a)=>{let r={player:Array.from(t)},o=await this.idMapping.idMappingFacade.getEntitiesByIdsMap(r,e,i);if(a){let n=new Map;for(let[l,p]of Array.from(a.entries())){let c=o.get(l);c&&n.set(c,p)}a.clear();for(let[l,p]of Array.from(n.entries()))a.set(l,p)}return Array.from(o.values())};addPlayerModels=async t=>{let e=t.map(a=>a.playerId),i=await this.football.footballFacade.getPlayersMapWithNativeIds(e);return t.forEach(a=>{a.playerModel=Object.keys(i).length&&i[a.playerId]||null,a.playerId=a.playerModel?.id||a.playerId}),t};remapPlayerIdToNative=async t=>{let e=await this.idMapping.getEntityIdBySchemaId("player",t);if(e)return e.id;this.throwException(404,"id_mapping_not_found","No ID mappings are available for the provided ID. ID argument: "+t)};addMatchModels=async t=>{let e=t.map(a=>a.matchId),i=await this.football.footballFacade.getMatchesMapWithNativeIds(e);return t.forEach(a=>{a.matchModel=Object.keys(i).length&&i[a.matchId]||null,a.matchId=a.matchModel?.id||a.matchId}),t};throwException=(t,e,i)=>{throw this.errorHandlingModel==="standard"?new h(t,e,i):new y(t,e,i)}};var tp=class{idSchema=null;clientHttps=null;footballHttps=null;predictorHttps=null;loyaltyHttps=null;service=null;constructor(t){this.idSchema=t.idSchema,this.clientHttps=new W(t),this.footballHttps=new ct(t),this.service=new Zl(t),this.predictorHttps=new dt(t),this.loyaltyHttps=new Rt(t)}getConfig=async()=>{let t=await this.clientHttps.getConfig("fantasy");return this.idSchema!=="native"&&(t.competitionsWhitelist=await this.service.remapCompetitions([...t.competitionsWhitelist])),t};getPlayersPoints=async(t,e,i)=>{let a=await this.footballHttps.getPlayersPoints(t,e,i);return a.data=await this.service.addPlayerModels(a.data),a};getPlayerDetailedStatistics=async(t,e,i)=>{let a="";this.idSchema!=="native"&&(a=await this.service.remapPlayerIdToNative(e));let r=await this.footballHttps.getPlayerDetailedStatistics(t,a||e,i);return r.meta.filters.playerId=e,r.data=await this.service.addMatchModels(r.data),r};play=async(t,e,i,a)=>{if((!i||!Array.isArray(i))&&this.service.throwException(400,"invalid_method_call","Invalid parameter provided. Please check the following parameter: "+"playerIds"),a){let o="playersRoles";a instanceof Map||this.service.throwException(400,"invalid_method_call","Invalid parameter provided. Please check the following parameter: "+o);let n=Array.from(a.keys());n.length||this.service.throwException(400,"invalid_method_call","Invalid parameter provided. Please check the following parameter: "+o),n.every(u=>!i.includes(u))&&this.service.throwException(400,"invalid_method_call","The keys in the players roles map are not part of the valid keys. The valid keys are: "+i.join(","));let p=Array.from(a.values()),c=["CAPTAIN","VICE_CAPTAIN"];p.every(u=>c.includes(u.toLocaleUpperCase()))||this.service.throwException(400,"invalid_method_call","The values in the map are not valid. The valid ones are: "+c.join(",")+". Case insensitive.")}let r=null;if(this.idSchema!=="native"){let o=await this.service.remapPlayers(i,this.idSchema,"native",a);r=Bi.createFantasyPrediction(t,e,o,a)}else r=Bi.createFantasyPrediction(t,e,i,a);return await this.predictorHttps.makeFootballPrediction(r)};getMyPrediction=async(t,e)=>{let i=`${t}_${e}`,a=new V(null);a.gameIds=[i];let r=await this.predictorHttps.getMyPredictions(a);return r.data.length===0?null:r.data[0]};getPlayerStatistics=async(t,e,i)=>{let a=await this.getPlayerDetailedStatistics(t,e,i);return Bi.createFantasyPlayerStats(a)};getGameWeekStatistics=async t=>await this.loyaltyHttps.getTemplateBreakdownPoints(t)};var ep=class{facade=null;constructor(t){this.facade=new tp(t)}getConfig=async()=>await this.facade.getConfig();getPlayersPoints=async(t,e,i)=>await this.facade.getPlayersPoints(t,e,i);getPlayerDetailedStatistics=async(t,e,i)=>await this.facade.getPlayerDetailedStatistics(t,e,i);play=async(t,e,i,a)=>await this.facade.play(t,e,i,a);getMyPrediction=async(t,e)=>await this.facade.getMyPrediction(t,e);getPlayerStatistics=async(t,e,i)=>await this.facade.getPlayerStatistics(t,e,i);getGameWeekStatistics=async t=>await this.facade.getGameWeekStatistics(t)};var ip=class{configuration;constructor(t){this.configuration=t}getSDKConfiguration(){return this.configuration}};var ap=class{remapToResponseModel=(t,e,i)=>{let a=new mo;return a.meta.input=e,a.meta.output=i,t.size===0||(a.data=Array.from(t).map(([r,o])=>({input:r,output:o}))),a}};var rp=class{errorHandlingModel=null;constructor(t){this.errorHandlingModel=t.errorHandlingMode}validate=(t,e,i)=>{(!t||!Array.isArray(t)||t.length===0)&&this.throwException(400,"invalid_ids","Invalid or empty IDs provided. Please provide at least one ID."),(!e||e!=="native"&&e!=="enetpulse"&&e!=="sportal365"&&e!=="sportradar"&&e!=="api_football")&&this.throwException(400,"invalid_input_provider","Invalid provider. The valid providers are: 'native', 'enetpulse', 'sportal365', 'sportradar' and 'api_football'."),(!i||i!=="native"&&i!=="enetpulse"&&i!=="sportal365"&&i!=="sportradar"&&i!=="api_football")&&this.throwException(400,"invalid_output_provider","Invalid provider. The valid providers are: 'native', 'enetpulse', 'sportal365', 'sportradar' and 'api_football'."),e===i&&this.throwException(400,"invalid_output_provider","Invalid output provider. The output can not be the same as the input provider.")};throwException=(t,e,i)=>{throw this.errorHandlingModel==="standard"?new h(t,e,i):new y(t,e,i)}};var op=class{validator=null;idMappingFacade=null;factory=new ap;constructor(t){this.validator=new rp(t),this.idMappingFacade=new fi(t)}getMappedFootballCountryIds=async(t,e,i)=>{this.validator.validate(t,e,i);let a={country:Array.from(t)},r=await this.idMappingFacade.getEntitiesByIdsMap(a,e,i);return this.factory.remapToResponseModel(r,e,i)};getMappedFootballCompetitionIds=async(t,e,i)=>{this.validator.validate(t,e,i);let a={competition:Array.from(t)},r=await this.idMappingFacade.getEntitiesByIdsMap(a,e,i);return this.factory.remapToResponseModel(r,e,i)};getMappedFootballTeamIds=async(t,e,i)=>{this.validator.validate(t,e,i);let a={team:Array.from(t)},r=await this.idMappingFacade.getEntitiesByIdsMap(a,e,i);return this.factory.remapToResponseModel(r,e,i)};getMappedFootballPlayerIds=async(t,e,i)=>{this.validator.validate(t,e,i);let a={player:Array.from(t)},r=await this.idMappingFacade.getEntitiesByIdsMap(a,e,i);return this.factory.remapToResponseModel(r,e,i)};getFootballMappedMatchIds=async(t,e,i)=>{this.validator.validate(t,e,i);let a={match:Array.from(t)},r=await this.idMappingFacade.getEntitiesByIdsMap(a,e,i);return this.factory.remapToResponseModel(r,e,i)}};var sp=class{facade=null;constructor(t){this.facade=new op(t)}getMappedFootballCountryIds=async(t,e,i)=>await this.facade.getMappedFootballCountryIds(t,e,i);getMappedFootballCompetitionIds=async(t,e,i)=>await this.facade.getMappedFootballCompetitionIds(t,e,i);getMappedFootballTeamIds=async(t,e,i)=>await this.facade.getMappedFootballTeamIds(t,e,i);getMappedFootballPlayerIds=async(t,e,i)=>await this.facade.getMappedFootballPlayerIds(t,e,i);getMappedFootballMatchIds=async(t,e,i)=>await this.facade.getFootballMappedMatchIds(t,e,i)};var np=class{findLastGame=t=>{if(!Array.isArray(t)||t.length===0)return null;let e=t.filter(r=>r.status==="SETTLED").sort((r,o)=>new Date(o.predictionsCutoff).getTime()-new Date(r.predictionsCutoff).getTime());if(e.length>0)return e[0];let i=new Date,a=t.filter(r=>new Date(r.predictionsCutoff)<i).sort((r,o)=>new Date(o.predictionsCutoff).getTime()-new Date(r.predictionsCutoff).getTime());return a.length>0?a[0]:null};findNextGame=t=>{if(!Array.isArray(t)||t.length===0)return null;let e=this.findCurrentGame(t);if(!e)return null;let i=[...t].sort((r,o)=>new Date(r.predictionsCutoff).getTime()-new Date(o.predictionsCutoff).getTime()),a=new Date(e.predictionsCutoff).getTime();return i.find(r=>new Date(r.predictionsCutoff).getTime()>a)||null};findCurrentGame=t=>{if(!Array.isArray(t)||t.length===0)return null;let e=t.find(o=>o.status==="LIVE");if(e)return e;let i=t.find(o=>o.status==="OPEN");if(i)return i;let a=new Date;return t.filter(o=>new Date(o.predictionsCutoff)>a).sort((o,n)=>new Date(o.predictionsCutoff).getTime()-new Date(n.predictionsCutoff).getTime())[0]||null}};var Ni=class{matchQuizFacade=null;helpers=new np;constructor(t){this.matchQuizFacade=new Xt(t)}getConfig=async()=>await this.matchQuizFacade.getConfig();play=async t=>await this.matchQuizFacade.play(t);delete=async t=>await this.matchQuizFacade.delete(t);getGames=async(t,e)=>await this.matchQuizFacade.getGames(t,e);getGameById=async(t,e)=>await this.matchQuizFacade.getGameById(t,e);getGamePredictions=async(t,e,i)=>await this.matchQuizFacade.getGamePredictions(t,e,i);getGameResults=async(t,e,i)=>await this.matchQuizFacade.getGameResults(t,e,i);getCurrentGameResults=async t=>await this.matchQuizFacade.getCurrentGameResults(t);getMyGameEditions=async(t,e)=>await this.matchQuizFacade.getMyGameEditions(t,e);getMyGamePrediction=async t=>await this.matchQuizFacade.getMyGamePrediction(t);getUserGameEditions=async(t,e,i)=>await this.matchQuizFacade.getUserGameEditions(t,e,i);getUserGamePrediction=async(t,e,i)=>await this.matchQuizFacade.getUserGamePrediction(t,e,i);getMarketsResultsForGame=async(t,e)=>await this.matchQuizFacade.getMarketsResultsForGame(t,e);getGameWinners=async(t,e)=>await this.matchQuizFacade.getGameWinners(t,e)};var lp=class{findLastGame=t=>{if(!Array.isArray(t)||t.length===0)return null;let e=t.filter(r=>r.status==="SETTLED").sort((r,o)=>new Date(o.predictionsCutoff).getTime()-new Date(r.predictionsCutoff).getTime());if(e.length>0)return e[0];let i=new Date,a=t.filter(r=>new Date(r.predictionsCutoff)<i).sort((r,o)=>new Date(o.predictionsCutoff).getTime()-new Date(r.predictionsCutoff).getTime());return a.length>0?a[0]:null};findNextGame=t=>{if(!Array.isArray(t)||t.length===0)return null;let e=this.findCurrentGame(t);if(!e)return null;let i=[...t].sort((r,o)=>new Date(r.predictionsCutoff).getTime()-new Date(o.predictionsCutoff).getTime()),a=new Date(e.predictionsCutoff).getTime();return i.find(r=>new Date(r.predictionsCutoff).getTime()>a)||null};findCurrentGame=t=>{if(!Array.isArray(t)||t.length===0)return null;let e=t.find(o=>o.status==="LIVE");if(e)return e;let i=t.find(o=>o.status==="OPEN");if(i)return i;let a=new Date;return t.filter(o=>new Date(o.predictionsCutoff)>a).sort((o,n)=>new Date(o.predictionsCutoff).getTime()-new Date(n.predictionsCutoff).getTime())[0]||null}};var ki=class{topXFacade=null;helpers=new lp;constructor(t){this.topXFacade=new te(t)}getConfig=async()=>await this.topXFacade.getConfig();getGames=async(t,e)=>await this.topXFacade.getGames(t,e);getGameById=async(t,e)=>await this.topXFacade.getGameById(t,e);getGamePredictions=async(t,e,i)=>await this.topXFacade.getGamePredictions(t,e,i);getGameResults=async(t,e,i)=>await this.topXFacade.getGameResults(t,e,i);getCurrentGameResults=async t=>await this.topXFacade.getCurrentGameResults(t);play=async t=>await this.topXFacade.play(t);delete=async t=>await this.topXFacade.delete(t);getMyGameEditions=async(t,e)=>await this.topXFacade.getMyGameEditions(t,e);getMyGamePrediction=async t=>await this.topXFacade.getMyGamePrediction(t);getUserGameEditions=async(t,e,i)=>await this.topXFacade.getUserGameEditions(t,e,i);getUserGamePrediction=async(t,e,i)=>await this.topXFacade.getUserGamePrediction(t,e,i);getMarketsResultsForGame=async(t,e)=>await this.topXFacade.getMarketsResultsForGame(t,e);getGameWinners=async(t,e)=>await this.topXFacade.getGameWinners(t,e)};var pp=class{remapUserVotes=t=>{let e=new on;return e.meta=this.remapMeta(t.meta.pagination),e.data=t.data.map(i=>this.remapUserVoteModel(i)),e};remapResults=t=>{let e=new ln;return e.meta=t.meta,e.data=t.data.map(i=>this.remapResultsModel(i)),e};remapMeta=t=>{let e=new M;return e.pagination.itemsPerPage=t.items_per_page,e.pagination.nextPageStartsAfter=t.next_page_starts_after,e};remapUserVoteModel=t=>{let e=new sn;return e.matchId=t.match_id,e.playerId=t.player_id,e.createdAt=t.created_at,e};remapResultsModel=t=>{let e=new pn;return e.teamId=t.team_id,e.playerId=t.player_id,e.votes=t.votes,e.winner=t.winner,e}};var cp=class extends ut{remapPolls=t=>{let e=new en;return e.meta.pagination=this.remapMetaPagination(t.meta.pagination),e.data=t.data.map(i=>this.remapPoll(i)),e};remapPollById=t=>{let e=new Xs;return e.id=t.id,e.title=t.title,e.alternativeTitle=t.alternative_title,e.description=t.description,e.type=t.type,e.images=t.images,e.status=t.status,e.language=t.language,e.authRequirement=t.auth_requirement,e.flags=t.flags,e.totalVotes=t.total_votes,e.customFields=t.custom_fields,e.related=t.related?this.remapRelated(t.related):[],e.branding=t.branding?this.remapBranding(t.branding):null,e.embedCode=t.embed_code,e.labels=t.labels,e.rules=t.rules,e.adContent=t.ad_content,e.options=t.options?this.remapOptions(t.options):[],e.context=t.context?this.remapContext(t.context):t.context,e.preferencesEnabled=t.preferences_enabled,e.multipleChoice=t.multiple_choice,e.maxMultipleChoiceOptions=t.max_multiple_choice_options,e.participationCount=t.participation_count,e.createdAt=t.created_at,e.updatedAt=t.updated_at,e};remapUserVote=t=>{let e=new li;return e.id=t.id,e.pollId=t.poll_id,e.optionId=t.option_id,e.optionIds=t.option_ids,e.userId=t.user_id,e};remapPollsVotes=t=>{let e=new an;return e.meta.pagination=this.remapMetaPagination(t.meta.pagination),e.data=t.data.map(i=>this.remapPollVote(i)),e};remapPollVote=t=>{let e=new tn;return e.id=t.id,e.pollId=t.poll_id,e.optionId=t.option_id,e.optionIds=t.option_ids,e.userId=t.user_id,e};remapMetaPagination=t=>{let e=new wt;return e.itemsPerPage=t.items_per_page,e.nextPageStartsAfter=t.next_page_starts_after,e};remapPoll=t=>{let e=new ni;return e.id=t.id,e.title=t.title,e.alternativeTitle=t.alternative_title,e.description=t.description,e.type=t.type,e.images=t.images,e.status=t.status,e.language=t.language,e.authRequirement=t.auth_requirement,e.flags=t.flags,e.totalVotes=t.total_votes,e.customFields=t.custom_fields,e.related=t.related?this.remapRelated(t.related):[],e.branding=t.branding?this.remapBranding(t.branding):null,e.embedCode=t.embed_code,e.labels=t.labels,e.adContent=t.ad_content,e.options=t.options?this.remapOptions(t.options):[],e.context=t.context?this.remapContext(t.context):t.context,e.preferencesEnabled=t.preferences_enabled,e.multipleChoice=t.multiple_choice,e.maxMultipleChoiceOptions=t.max_multiple_choice_options,e.participationCount=t.participation_count,e.createdAt=t.created_at,e.updatedAt=t.updated_at,e};remapContext=t=>{let e=new Ct;return e.content=t.content,e.tags=t.tags?t.tags.map(i=>{let a=new lr;return a.id=i.id,a.type=i.type,a.source=i.source,a}):null,e.campaign=t.campaign,e};remapRelated=t=>t.map(e=>{let i=new q;return i.entityId=e.entity_id,i.entityType=e.entity_type,i.entityRelationship=e.entity_relationship,i});remapOptions=t=>t.map(e=>{let i=new Js;return i.id=e.id,i.title=e.title,i.description=e.description,i.images=e.images,i.votes=e.votes,i.embedCode=e.embed_code,i.preferencesMapping=e.preferences_mapping?this.remapPreferencesMapping(e.preferences_mapping):[],i});remapPreferencesMapping=t=>t.map(e=>{let i=new Zs;return i.preferenceId=e.preference_id,i})};var up=class extends v{pollRemapper=null;playerOfTheMatchRemapper=null;constructor(t){super(t,O(t.environment,"voting")),this.pollRemapper=new cp,this.playerOfTheMatchRemapper=new pp}getPolls=async(t,e)=>{let i=`/polls${this.apiSignInUrl}`;t&&(i+=t.constructMainFiltersUrl()),g(e)&&(i+=m());let a="There was a problem fetching polls",r=await this.fetchWithoutAuth(i,a);return this.pollRemapper.remapPolls(r)};getPollById=async(t,e)=>{let i=`/polls/${t}${this.apiSignInUrl}`;g(e)&&(i+=m());let a="There was a problem fetching the following poll: "+t,r=await this.fetchWithoutAuth(i,a);return this.pollRemapper.remapPollById(r.data)};voteForPoll=async(t,e)=>{let i=`/polls/${t}/votes${this.apiSignInUrl}`,a="PUT",r={option_ids:e},o="There was a problem voting for the following poll: "+t,n=await this.fetchWithAuth(i,o,a,r);return this.pollRemapper.remapUserVote(n.data)};deleteVoteForPoll=async t=>{let e=`/polls/${t}/votes${this.apiSignInUrl}`,i="DELETE",a="There was a problem deleting vote for the following poll: "+t;return await this.fetchWithAuth(e,a,i),!0};getMyPollVote=async t=>{let e=`/polls/${t}/votes${this.apiSignInUrl}`,i="There was a problem fetching user's own vote for the following poll: "+t,a=await this.fetchWithAuth(e,i);return this.pollRemapper.remapPollVote(a.data)};getMyPollsVotes=async t=>{let e=`/polls/votes${this.apiSignInUrl}`;t&&(e+=t.constructMainFiltersUrl());let i="There was a problem fetching user's votes for polls",a=await this.fetchWithAuth(e,i);return this.pollRemapper.remapPollsVotes(a)};voteForPlayerOfTheMatch=async(t,e)=>{let i=`/football/potm/${t}${this.apiSignInUrl}`,a="PUT",r={player_id:e},o="There was a problem voting for 'Player of the match'";return{playerId:(await this.fetchWithAuth(i,o,a,r)).data.player_id}};deleteVoteForPlayerOfTheMatch=async t=>{let e=`/football/potm/${t}${this.apiSignInUrl}`,i="DELETE",a="There was a problem with deleting vote for 'Player of the match'";await this.fetchWithAuth(e,a,i)};getOwnVotesForPlayerOfTheMatch=async t=>{let e=`/football/potm${this.apiSignInUrl}`;t&&(e+=t.constructFiltersUrl());let i="There was a problem fetching user's own votes for 'Player of the match'",a=await this.fetchWithAuth(e,i);return this.playerOfTheMatchRemapper.remapUserVotes(a)};getResultsForPlayerOfTheMatch=async(t,e)=>{let i=`/football/potm/${t}${this.apiSignInUrl}${g(e)?m():""}`,a="There was a problem fetching results for 'Player of the match'",r=await this.fetchWithoutAuth(i,a);return this.playerOfTheMatchRemapper.remapResults(r)}};var dp=class{idMappingService=null;idSchema=null;errorHandlingMode=null;validator=null;activityService=null;football=null;constructor(t){this.idSchema=t.idSchema,this.errorHandlingMode=t.errorHandlingMode,this.idMappingService=new R(t),this.validator=new Jt(t),this.activityService=new It(t),this.football=new tt(t)}finalizePollsFilters=async t=>{if(this.idSchema!=="native"&&t.entityIds&&t.entityIds.length>0){this.validator.validateFilters(t);let e=await this.idMappingService.getEntityIdsBySchemaId(Array.from(t.entityIds),t.entityType,"native");t.entityIds=e[t.entityType]}};remapTags=async(t,e,i)=>{if(this.idSchema!="native"&&t.context&&t.context.tags&&t.context.tags.length){let a=JSON.parse(JSON.stringify(t.context.tags)),r=await this.activityService.remapTagsIds(a,e,i);t.context.tags=r}};remapMatchAndPlayerIds=async(t,e,i,a)=>{let r={match:[t],player:[e]},o=await this.idMappingService.idMappingFacade.getEntitiesByIds(r,i,a);if(o.match.length>0&&o.player.length>0){let n=o.match[0],l=o.player[0];return[n,l]}throw this.errorHandlingMode==="default"?new y(404,"entity_ids_not_found","Some of the sport entity IDs were not found for the provided id schema"):new h(404,"entity_ids_not_found","Some of the sport entity IDs were not found for the provided id schema")};remapMatchIds=async(t,e,i)=>{let a=Array.from(t),r={match:t},o=await this.idMappingService.idMappingFacade.getEntitiesByIds(r,e,i);if(o.match.length>0&&o.match.length===a.length)return o.match;throw this.errorHandlingMode==="default"?new y(404,"match_ids_not_found","Some of the match IDs were not found for the provided id schema"):new h(404,"match_ids_not_found","Some of the match IDs were not found for the provided id schema")};setModelsForUserVotes=async t=>{let e=t.data.map(a=>a.matchId),i=t.data.map(a=>a.playerId);if(e.length>0&&i.length>0){let a=await this.football.footballFacade.getMatchesMapWithNativeIds(e),r=await this.football.footballFacade.getPlayersMapWithNativeIds(i);t.data.forEach(o=>{o.matchModel=a[o.matchId]||null,o.playerModel=r[o.playerId]||null,o.matchId=o.matchModel?o.matchModel.id:o.matchId,o.playerId=o.playerModel?o.playerModel.id:o.playerId}),t.meta.pagination.nextPageStartsAfter&&(t.meta.pagination.nextPageStartsAfter=t.data[t.data.length-1].matchId)}return t};setModelsForPotmResults=async t=>{let e=t.map(a=>a.teamId),i=t.map(a=>a.playerId);if(e.length>0&&i.length>0){let a=await this.football.footballFacade.getTeamsMapWithNativeIds(e),r=await this.football.footballFacade.getPlayersMapWithNativeIds(i);t.forEach(o=>{o.teamModel=a.get(o.teamId)||null,o.playerModel=r[o.playerId]||null,o.teamId=o.teamModel?o.teamModel.id:o.teamId,o.playerId=o.playerModel?o.playerModel.id:o.playerId})}}};var mp=class{https=null;service=null;idSchema=null;constructor(t){this.idSchema=t.idSchema,this.https=new up(t),this.service=new dp(t)}getPolls=async(t,e)=>{t&&(t=new si(t),await this.service.finalizePollsFilters(t));let i=await this.https.getPolls(t,e);for(let a of i.data)await this.service.remapTags(a,"native",this.idSchema);return i};getPollById=async(t,e)=>{let i=await this.https.getPollById(t,e);return await this.service.remapTags(i,"native",this.idSchema),i};voteForPoll=async(t,e)=>(typeof e=="string"&&(console.warn("Passing a single optionId as a string will be deprecated. Please pass it as an array."),e=[e]),await this.https.voteForPoll(t,e));deleteVoteForPoll=async t=>await this.https.deleteVoteForPoll(t);getMyPollVote=async(t,e)=>{let i=await this.https.getMyPollVote(t);if(e){let a=await this.getPolls(new si({pollIds:[t]}),!0);i.pollModel=a.data.find(r=>r.id===t)||null,i.optionModel=a.data.find(r=>r.id===t)?.options.find(r=>r.id===i.optionId)||null,i.optionsModels=i.optionIds?a.data.find(r=>r.id===t)?.options.filter(r=>i.optionIds.includes(r.id))||[]:[]}return i};getMyPollsVotes=async t=>{t&&(t=new w(t));let e=await this.https.getMyPollsVotes(t),i=e.data.map(r=>r.id),a=await this.getPolls(new si({pollIds:i}),!0);return e.data=e.data.map(r=>(r.pollModel=a.data.find(o=>o.id===r.pollId)||null,r.optionModel=r.pollModel?.options.find(o=>o.id===r.optionId)||null,r.optionsModels=r.optionIds?r.pollModel?.options.filter(o=>r.optionIds.includes(o.id))||[]:[],r)),e};voteForPlayerOfTheMatch=async(t,e)=>{if(this.idSchema!=="native"){let[i,a]=await this.service.remapMatchAndPlayerIds(t,e,this.idSchema,"native");return await this.https.voteForPlayerOfTheMatch(i,a),{playerId:e}}return await this.https.voteForPlayerOfTheMatch(t,e)};deleteVoteForPlayerOfTheMatch=async t=>{if(this.idSchema!=="native"){let e=await this.service.remapMatchIds([t],this.idSchema,"native");return await this.https.deleteVoteForPlayerOfTheMatch(e[0]),!0}return await this.https.deleteVoteForPlayerOfTheMatch(t),!0};getOwnVotesForPlayerOfTheMatch=async t=>{if(t&&(t=new rn(t)),t&&t.matchIds&&t.matchIds.length>0&&this.idSchema!=="native"){let i=await this.service.remapMatchIds(t.matchIds,this.idSchema,"native");t.matchIds=i}let e=await this.https.getOwnVotesForPlayerOfTheMatch(t);return await this.service.setModelsForUserVotes(e)};getResultsForPlayerOfTheMatch=async(t,e)=>{if(this.idSchema!=="native"){let a=await this.service.remapMatchIds([t],this.idSchema,"native"),r=await this.https.getResultsForPlayerOfTheMatch(a[0],e);return await this.service.setModelsForPotmResults(r.data),r}let i=await this.https.getResultsForPlayerOfTheMatch(t,e);return await this.service.setModelsForPotmResults(i.data),i}};var Gi=class{facade=null;constructor(t){this.facade=new mp(t)}getPolls=async(t,e)=>await this.facade.getPolls(t,e);getPollById=async(t,e)=>await this.facade.getPollById(t,e);voteForPoll=async(t,e)=>await this.facade.voteForPoll(t,e);deleteVoteForPoll=async t=>await this.facade.deleteVoteForPoll(t);getMyPollVote=async(t,e)=>await this.facade.getMyPollVote(t,e);getMyPollsVotes=async t=>await this.facade.getMyPollsVotes(t);voteForPlayerOfTheMatch=async(t,e)=>await this.facade.voteForPlayerOfTheMatch(t,e);deleteVoteForPlayerOfTheMatch=async t=>await this.facade.deleteVoteForPlayerOfTheMatch(t);getOwnVotesForPlayerOfTheMatch=async t=>await this.facade.getOwnVotesForPlayerOfTheMatch(t);getResultsForPlayerOfTheMatch=async(t,e)=>await this.facade.getResultsForPlayerOfTheMatch(t,e)};var hp=class{clientHttps=null;topX=null;matchQuiz=null;loyalty=null;miniGames=null;voting=null;constructor(t){this.clientHttps=new W(t),this.topX=new ki(t),this.matchQuiz=new Ni(t),this.loyalty=new ee(t),this.miniGames=new Zt(t),this.voting=new Gi(t)}getListContent=async(t,e,i)=>{e&&(e=new ho(e));let a=await this.clientHttps.getListContent(t,e,i);return await this.setModels(a.data),a};setModels=async t=>{let i=[],a=new Map;t.forEach(r=>{if(a.has(r.entityType)){let o=a.get(r.entityType);a.set(r.entityType,[...o,r.entityId])}else a.set(r.entityType,[r.entityId])});try{for(let[r,o]of Array.from(a.entries()))switch(r){case"TOP_X":let n=await this.topX.getGames({limit:o.length,gameIds:o},!0);i=[...i,...n.data];break;case"MATCH_QUIZ":let l=await this.matchQuiz.getGames({limit:o.length,gameIds:o},!0);i=[...i,...l.data];break;case"LEADERBOARD_TEMPLATES":let p=await this.loyalty.getTemplates(void 0,!0);i=[...i,...p.data.filter(b=>o.includes(b.id))];break;case"CLASSIC_QUIZ":let c=await this.miniGames.getClassicQuizzes({limit:o.length,classicQuizIds:o},!1,!0);i=[...i,...c.data];break;case"EITHER_OR":let u=await this.miniGames.getEitherOrs({limit:o.length,eitherOrIds:o},!1,!0);i=[...i,...u.data];break;case"POLL":let d=await this.voting.getPolls({limit:o.length,pollIds:o},!0);i=[...i,...d.data];break;default:}}catch(r){throw console.error("An error occurred while trying to set models for list content entities",r),r}t.forEach(r=>{let o=i.find(n=>n.id===r.entityId)||null;r.entityModel=o})}};var fp=class{facade=null;constructor(t){this.facade=new hp(t)}getListContent=async(t,e,i)=>await this.facade.getListContent(t,e,i)};var gp=class{fromResponse(t,e){let i=new Map;return t.matches.forEach(a=>{let r=a.odds.map(o=>{let n=new hs;return n.bookmaker=o.bookmaker?this.remapBookmaker(o.bookmaker):null,n.type=o.type,n.markets=o.markets?this.remapMarkets(o.markets,e):[],n});i.set(a.id,r)}),i}remapBookmaker(t){let e=new rs;return e.id=t.id,e.name=t.name,e.assets=t.assets?this.remapAssets(t.assets):[],e.links=t.links||[],e.branding=t.branding?this.remapBranding(t.branding):null,e.eventUrls=t.event_urls?this.remapEventUrls(t.event_urls):[],e.stakesDisclaimer=t.stakes_disclaimer,e.domainName=t.domain_name,e}remapMarkets(t,e){return t.map(i=>{let a=new ps;return a.type=i.type?this.remapMarketType(i.type):null,a.scope=i.scope?this.remapMarketScope(i.scope):null,a.selections=i.selections?this.remapMarketSelections(i.selections,a.type.code,e):[],a})}remapEventUrls(t){return t.map(e=>{let i=new ns;return i.url=e.url,i.appType=e.app_type,i})}remapBranding(t){let e=new os;return e.backgroundColor=t.background_color,e.textColor=t.text_color,e}remapAssets(t){return t.map(e=>{let i=new ss;return i.logo=e.logo,i.type=e.type,i.transparentBackgroundUrl=e.transparent_background_url,i.backgroundColor=e.background_color,i})}remapMarketType=t=>{let e=new ds;return e.id=t.id,e.name=t.name,e.code=t.code,e.entityType=t.entity_type,e};remapMarketScope=t=>{let e=new cs;return e.id=t.id,e.name=t.name,e.type=t.type,e.entityType=t.entity_type,e};remapMarketSelections=(t,e,i)=>{let a=Array.from(t);return i.length>0&&e==="OVER_UNDER"&&(a=a.filter(r=>r.code==="over"?i.some(o=>{switch(o){case"OVER_GOALS_0_5":return r.value==="0.5";case"OVER_GOALS_1_5":return r.value==="1.5";case"OVER_GOALS_2_5":return r.value==="2.5";case"OVER_GOALS_3_5":return r.value==="3.5";case"OVER_GOALS_4_5":return r.value==="4.5";case"OVER_GOALS_5_5":return r.value==="5.5";default:return!1}}):!1)),a.map(r=>{let o=new us;return o.id=r.id,o.name=r.name,o.code=r.code,o.value=r.value,o.odds=r.odds,o.urls=r.urls?this.remapEventUrls(r.urls):[],o.movement=r.movement,o.oddsOld=r.odds_old,o.entityType=r.entity_type,o.additionalInfo=r.additional_info,o.providerInfo=r.provider_info?this.remapProviderInfo(r.provider_info):null,o})};remapProviderInfo=t=>{let e=new ms;return e.selectionId=t.selection_id,e.eventId=t.event_id,e.marketId=t.market_id,e.competitionId=t.competition_id,e}};var yp=class{footballBaseUrl="https://football.api.sportal365.com/";retryRequest=!1;oddClient=null;remapper=null;constructor(t){this.oddClient=t.oddClient,this.remapper=new gp}getMatchOdds=async(t,e)=>{let i=`v2/matches/livescore?odd_client=${this.oddClient.name}&match_ids=${t.join(",")}${e.constructFiltersUrl()}`,a=`Error while fetching match odds for matchIds: ${t.join(",")}`,r=await this.fetchWithAuth(i,a),o=e.marketTypes&&e.marketTypes.length>0?e.marketTypes.filter(n=>n.includes("OVER")):[];return this.remapper.fromResponse(r,o)};getAuthHeaders=()=>{let t=typeof window<"u"?window.btoa(`${this.oddClient.credentials.username}:${this.oddClient.credentials.password}`):Buffer.from(`${this.oddClient.credentials.username}:${this.oddClient.credentials.password}`).toString("base64");return{"Content-Type":"application/json",Authorization:`Basic ${t}`}};fetchWithAuth=async(t,e)=>{let i=await fetch(this.footballBaseUrl+t,{headers:this.getAuthHeaders()}),a=await i.json();if(!i.ok)throw(i.status===401||i.status===403)&&!this.retryRequest&&(this.retryRequest=!0,await this.fetchWithAuth(t,e)),this.retryRequest=!1,console.warn(e,a),a;return this.retryRequest=!1,a}};var bp=class{https;idSchema;oddClient;idMapping=null;validator;constructor(t){this.idSchema=t.idSchema,this.oddClient=t.oddClient,this.https=new yp(t),this.validator=new Q(t.errorHandlingMode),this.idMapping=new R(t)}getByMatchIds=async(t,e)=>{this.validateOddClient(),(!t||!Array.isArray(t)||t.length===0)&&this.validator.throwException(400,"invalid_match_ids","Match IDs are invalid!");let i=Array.from(t);this.idSchema!=="sportal365"&&(i=(await this.idMapping.idMappingFacade.getEntitiesByIds({match:Array.from(t)},this.idSchema,"sportal365")).match);let a=new ls(e),r=await this.https.getMatchOdds(i,a);if(this.idSchema!=="sportal365"){let o=await this.idMapping.idMappingFacade.getEntitiesByIdsMap({match:Array.from(r.keys())},"sportal365",this.idSchema),n=new Map;return Array.from(r.entries()).forEach(([l,p])=>{n.set(o.get(l),p)}),n}return r};validateOddClient=()=>{this.oddClient||this.validator.throwException(412,"odd_client_configuration_not_found","Odds namespace requires oddClient configuration to be set")}};var Mp=class{facade;constructor(t){this.facade=new bp(t)}getByMatchIds=async(t,e)=>await this.facade.getByMatchIds(t,e)};var Ip=class{factory=null;privateLeagueHttps=null;loyaltyHttps=null;profile=null;service=null;discussionsService=null;constructor(t){this.factory=new Ai,this.privateLeagueHttps=new Ci(t),this.loyaltyHttps=new Rt(t),this.profile=new D(t),this.service=new Di(t),this.discussionsService=new ie(t)}create=async t=>{let e=this.factory.createRequestBodyFromParam(t,"PRIVATE"),i=await this.privateLeagueHttps.create(e,"PRIVATE_LEAGUE");return await this.service.setTemplateModels(i),i};getById=async(t,e)=>{let i=await this.privateLeagueHttps.getById(t,"PRIVATE_LEAGUE",e);return await this.service.setTemplateModels(i),i};getMyLeagues=async t=>{t=new Bs(t);let e=await this.privateLeagueHttps.getMyLeagues(t,"PRIVATE_LEAGUE");return await this.service.setTemplateModelsInLeagues(e),e};update=async(t,e)=>{let i=this.factory.createUpdateRequestBodyFromParam(e,"PRIVATE"),a=await this.privateLeagueHttps.update(t,i,"PRIVATE_LEAGUE");return await this.service.setTemplateModels(a),a};updateTemplate=async(t,e,i)=>{let a=await this.privateLeagueHttps.updateLeagueTemplate(t,e,i,"PRIVATE_LEAGUE");return await this.service.setTemplateModels(a),a};delete=async t=>await this.privateLeagueHttps.delete(t,"PRIVATE_LEAGUE");invite=async(t,e)=>await this.privateLeagueHttps.invite(t,e);deleteInvitation=async(t,e)=>await this.privateLeagueHttps.deleteInvitation(t,e);accept=async t=>{let i=await this.privateLeagueHttps.accept(t,!0,"PRIVATE_LEAGUE");return await this.finalizeAcceptModel(i,!0)};reject=async t=>{let i=await this.privateLeagueHttps.accept(t,!1,"PRIVATE_LEAGUE");return await this.finalizeAcceptModel(i,!1)};banUsers=async(t,e)=>await this.privateLeagueHttps.ban(t,e);unbanUsers=async(t,e)=>await this.privateLeagueHttps.unban(t,e);join=async t=>{let e=await this.privateLeagueHttps.join(t);return await this.finalizeAcceptModel(e,!0)};leave=async t=>await this.privateLeagueHttps.leave(t,"PRIVATE_LEAGUE");finalizeAcceptModel=async(t,e)=>{if(e){let i=await this.getById(t.leagueId);t.leagueModel=i}return await this.service.setProfileModel(t),t};getMyLeaguesStandings=async t=>{t&&(t=new Ns(t));let e=await this.profile.getOwn().getInfo(),i=await this.loyaltyHttps.getUserRankingsForPrivateLeagueAndChallenges(e.id,"PRIVATE_LEAGUE",t);for(let a of i.data){let r=await this.getById(a.privateLeagueId);a.privateLeagueModel=r}return this.service.setTemplateModelsFromLeagueModels(i.data,"PRIVATE_LEAGUE"),i};getInvitations=async t=>{t=new ei(t),t.type="PRIVATE";let e=await this.privateLeagueHttps.getInvitations("PRIVATE_LEAGUE",t);return await this.service.setTemplateModelsInLeagues(e.data),e};getReportedPosts=async(t,e)=>{e&&(e=new ii(e));let i=await this.privateLeagueHttps.getReportedPosts(t,e);return i.data=await this.discussionsService.finalizePostFullModel(i.data),i};getPredictions=async(t,e)=>{if(e){if(e.limit&&e.limit>20)throw new h(400,"invalid_limit","Invalid limit. The maximum limit is: "+20 .toString());e=new ai(e)}let i=await this.privateLeagueHttps.getPredictions(t,e);return await this.service.setModelsForPredictions(i)};moderatePost=async(t,e)=>await this.privateLeagueHttps.moderatePost(t,e)};var wp=class{privateLeaguesFacade=null;constructor(t){this.privateLeaguesFacade=new Ip(t)}create=async t=>await this.privateLeaguesFacade.create(t);update=async(t,e)=>await this.privateLeaguesFacade.update(t,e);updateTemplate=async(t,e,i)=>await this.privateLeaguesFacade.updateTemplate(t,e,i);delete=async t=>await this.privateLeaguesFacade.delete(t);getById=async(t,e)=>await this.privateLeaguesFacade.getById(t,e);getMyLeagues=async t=>await this.privateLeaguesFacade.getMyLeagues(t);invite=async(t,e)=>await this.privateLeaguesFacade.invite(t,e);deleteInvitation=async(t,e)=>await this.privateLeaguesFacade.deleteInvitation(t,e);accept=async t=>await this.privateLeaguesFacade.accept(t);reject=async t=>await this.privateLeaguesFacade.reject(t);banUsers=async(t,e)=>await this.privateLeaguesFacade.banUsers(t,e);unbanUsers=async(t,e)=>await this.privateLeaguesFacade.unbanUsers(t,e);join=async t=>await this.privateLeaguesFacade.join(t);leave=async t=>await this.privateLeaguesFacade.leave(t);getMyLeaguesStandings=async t=>await this.privateLeaguesFacade.getMyLeaguesStandings(t);getInvitations=async t=>await this.privateLeaguesFacade.getInvitations(t);getReportedPosts=async(t,e)=>await this.privateLeaguesFacade.getReportedPosts(t,e);getPredictions=async(t,e)=>await this.privateLeaguesFacade.getPredictions(t,e);moderatePost=async(t,e)=>await this.privateLeaguesFacade.moderatePost(t,e)};var _p=class{KEY_PREFIX="fu-progress-";get=(t,e)=>{let i=localStorage.getItem(`${this.KEY_PREFIX}${t}-${e}`);return i&&JSON.parse(i)};set=(t,e,i)=>(localStorage.setItem(`${this.KEY_PREFIX}${t}-${e}`,JSON.stringify(i)),JSON.stringify(i));delete=(t,e)=>{localStorage.removeItem(`${this.KEY_PREFIX}${t}-${e}`)}};var Pp=class extends Q{validatePrediction=t=>{(!t||!Array.isArray(t)||t.length===0||t.some(e=>!e))&&this.throwException(400,"invalid_method_call","The prediction argument is invalid. For more information please visit our documentation")}};var Tp=class{https=null;profile=null;validator=null;constructor(t){this.https=new Wt(t),this.profile=new D(t),this.validator=new Pp(t.errorHandlingMode)}getGames=async(t,e)=>(t&&(t=new $s(t)),await this.https.getStandingsGames(t,e));getGameById=async(t,e)=>await this.https.getStandingGameById(t,e);makePrediction=async(t,e)=>(this.validator.validatePrediction(e),await this.https.makeStandingGamePrediction(t,e));updatePrediction=async(t,e,i)=>(this.validator.validatePrediction(i),await this.https.updateStandingGamePrediction(t,e,i));getGamePredictionForUser=async(t,e,i)=>{let a=await this.https.getStandingGamePredictionsForUser(t,e,i),r=null;try{r=await this.profile.getById(e).getInfo()}catch(o){console.error(o)}return a.data.forEach(o=>{o.profileModel=r}),a};getRankings=async(t,e,i)=>{e&&(e=new Ws(e));let a=await this.https.getStandingGameRankings(t,e,i),r=a.data.map(n=>n.profileId),o=[];return r.length>0&&(o=await this.profile.getByIds(r),a.data=a.data.map(n=>(n.profileModel=o.find(l=>l.id===n.profileId)||null,n))),a}};var Ep=class{facade=null;constructor(t){this.facade=new Tp(t)}getGames=async(t,e)=>await this.facade.getGames(t,e);getGameById=async(t,e)=>await this.facade.getGameById(t,e);makePrediction=async(t,e)=>await this.facade.makePrediction(t,e);updatePrediction=async(t,e,i)=>await this.facade.updatePrediction(t,e,i);getGamePredictionForUser=async(t,e,i)=>await this.facade.getGamePredictionForUser(t,e,i);getRankings=async(t,e,i)=>await this.facade.getRankings(t,e,i)};function Au(){let s=Cu(),t="-RC",e=null,i=s.version.split("."),a=Number(i[0]),r=Number(i[1]),o=i[2];if(o.includes(t)){let n=o.split(t);o=Number(n[0]),e=Number(n[1])}else o=Number(o);return{version:s.version,major:a,minor:r,patch:o,releaseCandidate:e}}var Fc=null,zc=null;function cd(s){if(ud(s)){let t=dd(s);if(t.isValid)return Fc={profile:new D(s),football:new tt(s),predictor:new xi(s),loyalty:new ee(s),topX:new ki(s),matchQuiz:new Ni(s),activity:new xn(s),miniGames:new Zt(s),discussions:new jl(s),privateLeagues:new wp(s),challenges:new ql(s),progress:new _p,voting:new Gi(s),fantasy:new ep(s),helpers:new ip(s),idMapping:new sp(s),bracketGame:new Il(s),lists:new fp(s),standingGame:new Ep(s),eventGame:new Jl(s),odds:new Mp(s),getVersion:Au},zc={...s},Fc;md(t)}return Fc}var ud=s=>!Fc||JSON.stringify(s)!==JSON.stringify(zc)||s.authProvider?.getIdToken()!==zc.authProvider?.getIdToken(),dd=s=>{let e=new Fn().validate(s);return(e.idSchema.validation==="missing"||e.idSchema.validation==="invalid")&&(console.warn(e.idSchema.message.text),s.idSchema="native"),(e.environment.validation==="missing"||e.environment.validation==="invalid")&&(console.warn(e.environment.message.text),s.environment="prod"),(e.lang.validation==="missing"||e.lang.validation==="invalid")&&(console.warn(e.lang.message.text),s.lang="en"),(e.errorHandlingMode.validation==="missing"||e.errorHandlingMode.validation==="invalid")&&(console.warn(e.errorHandlingMode.message.text),s.errorHandlingMode="default"),e.authProvider.validation==="invalid"&&console.warn(e.authProvider.message.text),(e.oddClient.message.type==="warning"||e.oddClient.credentials.message.type==="warning")&&console.warn(e.oddClient.message.text||e.oddClient.credentials.message.text),e},md=s=>{let t="isValid";Object.keys(s).forEach(e=>{let i=s[e];if(e!==t&&e!=="authProvider"){if(i.message.type==="error")throw new Error(i.message.text)}else if(e!==t&&e==="authProvider"){if(i?.message.type==="error")throw new Error(i.message.text);Object.keys(new re).forEach(a=>{if(i[a].message.type==="error")throw new Error(i[a].message.text)})}if(e!==t&&e==="oddClient"){if(i?.message.type==="error")throw new Error(i.message.text);let a=i;if(a.credentials.message.type==="error")throw new Error(a.credentials.message.text)}})};export{dr as AcceptChallengeModel,Ls as AcceptPrivateLeagueModel,zi as AchievementsStats,Ie as ActionValueModel,xc as ActionsEnum,we as ActionsModel,de as ActivityFilters,Up as ActivityMeta,ue as ActivityResponseBody,Jp as AssetsModel,Me as AutomaticModerationModel,ir as BadgesModel,Va as BadgesModelV2,ar as BadgesValue,z as BadgesValueV2,ss as BookmakerAssetModel,os as BookmakerBrandingModel,gc as BookmakerLinkModel,rs as BookmakerModel,ns as BookmakerUrlModel,gs as BothTeamsFixtureModel,ur as BracketGameFilters,me as BracketGameFixtureScoreModel,cr as BracketGameFixtures,oa as BracketGameFixturesModel,he as BracketGameMetaModel,sa as BracketGameMetaParticipantsModel,na as BracketGameModel,ua as BracketGamePredictionFixturesModel,da as BracketGamePredictionModel,$p as BracketGamePredictionRequestBody,Ru as BracketGamePredictionStatusEnum,pr as BracketGamePredictionsFilters,la as BracketGamePredictionsModel,ma as BracketGameRankingsModel,fe as BracketGameTiebreaker,ca as BracketGameTiebreakerModel,pa as BracketGamesModel,Gc as BracketWinnerEnum,lo as BrandingColorsModel,co as BrandingImagesModel,no as BrandingModel,po as BrandingUrlsModel,Aa as BreakdownModel,bc as CalculatedOneXTwoFromScoresModel,Vp as CampaignModel,mr as ChallengeCreateModel,fr as ChallengeFilters,yr as ChallengeRankingsModel,hr as ChallengeUpdateModel,Ue as ClassicQuizBasicModel,Lo as ClassicQuizFilters,He as ClassicQuizFiltersMeta,xo as ClassicQuizFullModel,Ho as ClassicQuizLeaderboardFilters,We as ClassicQuizLeaderboardMeta,Bo as ClassicQuizOptionModel,uc as ClassicQuizParticipationBodyModel,No as ClassicQuizParticipationModel,ko as ClassicQuizParticipationQuestionModel,Go as ClassicQuizParticipationsFilters,Do as ClassicQuizQuestionModel,Vo as ClassicQuizQuestionsReportModel,$e as ClassicQuizRankFilters,$o as ClassicQuizRankModel,Uo as ClassicQuizUserParticipationModel,Wo as ClassicQuizUserRank,mc as ClassicQuizUserRankModel,hc as ClassicQuizzesLeaderboardModel,dc as ClassicQuizzesModel,se as ClassicQuizzesStats,fo as ClientBadges,go as ClientBadgesV2,Hr as CompetitionBasicModel,Ii as CompetitionFilters,$r as CompetitionFullModel,J as CompletedModel,Hp as ContentModel,js as ContestWinners,Ct as ContextModel,bs as CornersFixtureModel,Nt as CorrectScoreFixtureModel,mi as CreateActivityRequestBody,Wp as CreatePostParamBody,Ra as DetailedProfileModel,xa as DictionaryModel,br as DiscussionModel,ne as DiscussionStats,Ja as DiscussionsBadgeRequirements,Za as DiscussionsBadgesValue,Da as DiscussionsConfigModel,Sr as DiscussionsFilters,gl as DoubleChanceEnum,ws as DoubleChanceFixtureModel,qe as EitherOrBasicModel,qo as EitherOrFilters,zo as EitherOrFullModel,jo as EitherOrParticipationModel,Xo as EitherOrParticipationRequestFullModel,Yo as EitherOrParticipationRequestModel,Zo as EitherOrParticipationStepsModel,Pi as EitherOrParticipationStepsOptionModel,Qo as EitherOrPointsModel,ts as EitherOrResultsBreakdownModel,es as EitherOrResultsModel,is as EitherOrResultsStandingsModel,le as EitherOrStats,Ko as EitherOrStatsModel,fc as EitherOrsModel,ac as EntitiesFollows,rc as EntitiesFollowsFilters,Vi as EnvironmentEnum,C as ErrorCodes,vp as ErrorHandlingModeEnum,L as ErrorMessages,A as ErrorStatuses,Cr as EventGameFilters,Qp as EventGameFixtureEnumModel,Kp as EventGameFixtureNumberModel,qp as EventGameFixtures,At as EventGameFixturesModel,Ta as EventGameModel,kp as EventGameOutcomeTypeEnum,Ot as EventGamePredictionFixturesModel,_a as EventGamePredictionModel,zp as EventGamePredictionRequestBody,Fu as EventGamePredictionStatusEnum,Ar as EventGamePredictionsFilters,Ea as EventGamePredictionsModel,Or as EventGameRankingsFilters,Pa as EventGameRankingsModel,ye as EventGameTiebreaker,wa as EventGameTiebreakerModel,Ia as EventGamesModel,cd as FansUnitedSDK,Zp as FansUnitedSDKModel,$t as FansUnitedSdkFetchException,ve as FantasyCoefficientsModel,or as FantasyConfigModel,sr as FantasyMultipliersModel,xr as FantasyPlayerDetailedStatsMetaModel,Dr as FantasyPlayerDetailedStatsModel,Br as FantasyPlayerStatsModel,kr as FantasyPlayersMetaModel,Ce as FantasyPlayersModel,Gr as FantasyPlayersPointsModel,xe as FantasyPredictionRequestBody,Po as FiltersMetaModel,qs as FixturesGamesModel,Ao as FixturesMatchQuizModel,fs as FixturesPredictionModel,Ke as FixturesResponseModel,Qs as FixturesTopXModel,bi as FollowFilters,gi as FollowModel,va as FollowStatusModel,Sa as FollowersModel,Fa as FollowingModel,Ka as FootballBadgeRequirements,ja as FootballBadgesValue,Wr as FootballCountryModel,qc as FootballMatchStatusEnum,zt as FootballPaginationModel,Hs as FullInterestModel,Oa as FullnessProfile,Wa as GameBadgeRequirements,qa as GameBadgesValue,ri as GameByIdModel,Oo as GameMarketsResults,Qt as GameModel,ui as GamePredictionsStats,Ks as GameResultsModel,ht as GameStatusEnum,za as GamesBadgeRequirements,Qa as GamesBadgesValue,st as GamesFilters,Tt as GamesListModel,Pt as GamesMatchQuizListModel,kt as GamesTopXListModel,rr as GeneralBadgesValue,Se as GeneralRequirementModel,yl as HalfTimeFullTimeEnum,Ps as HalfTimeFullTimeFixtureModel,yo as HighestSuccessRateFilters,_o as HighestSuccessRateModel,N as IdSchemaEnum,X as ImagesModel,Vs as InterestModel,ei as InvitationFilters,gn as LangEnum,Ca as LeadModel,Ec as LeadRequestBody,oc as LeaderboardLeagueResponse,Ge as LeaderboardModel,sc as LeaderboardResponseModel,bo as LeagueLeaderboardFilters,ke as LeagueLeaderboardMetaModel,Ne as LineupsModel,ho as ListContentFilters,nr as ListContentModel,cn as ListContentResponseModel,Ba as LoyaltyConfigModel,er as LoyaltyConfigModelV2,Mo as LoyaltyFilters,Dt as LoyaltyMeta,uo as MappingModel,mo as MappingResponseModel,it as MarketEnum,yc as MarketsConfigModel,qr as MatchBasicModel,Je as MatchCorrectScoreMarketResultModel,ft as MatchFilters,zr as MatchFullModel,Cs as MatchMarketsResultsModel,ls as MatchOddsFilters,$c as MatchOddsMarketEnum,ps as MatchOddsMarketModel,cs as MatchOddsMarketScopeModel,us as MatchOddsMarketSelectionModel,ds as MatchOddsMarketTypeModel,hs as MatchOddsModel,vs as MatchPlayerMarketResultModel,Pe as MatchQuizConfigModel,Y as MatchStatus,Os as MatchSummaryModel,k as MetaFootballModel,Jo as MiniGameImages,Ya as MiniGamesBadgeRequirements,Xa as MiniGamesBadgesValue,ze as MiniGamesContext,Qe as MiniGamesContextTag,Ve as MiniGamesFilters,gr as MyChallengesFilters,Bs as MyLeaguesFilters,x as NoYesModel,Hc as OddFormatEnum,Uc as OddTypeEnum,fl as OneXTwoEnum,Es as OneXTwoFixtureModel,vu as OutcomeEnum,Ye as OverCornersFixtureModel,Xe as OverGoalsFixtureModel,aa as OwnActivityFilters,Xi as PaginationActivities,j as PaginationFootballProperties,Ic as PastTemplateModel,Rs as PenaltyMatchFixtureModel,jp as PlayerAssetsModel,Xr as PlayerBasicModel,De as PlayerDetailedPointsModel,Lr as PlayerDetailedStatsFilters,Ur as PlayerDetailedStatsModel,_i as PlayerFilters,ot as PlayerFixtureModel,Jr as PlayerFullModel,Yp as PlayerMarketResultModel,Vr as PlayerPointsModel,eo as PlayerShortModel,Zr as PlayerSquadModel,Be as PlayerStatsMatchModel,Yr as PlayerStatsModel,Nr as PlayersPointsFilters,nc as Points,Na as PointsModel,lc as PointsValueModel,ic as PollBadgesValue,ni as PollBasicModel,Xs as PollFullModel,Js as PollOptionModel,li as PollVoteBasicModel,tn as PollVoteFullModel,si as PollsFilters,en as PollsModel,an as PollsUserVotesModel,Le as PostByIdBasicModel,Mr as PostByIdFullModel,Ir as PostCreateModel,wr as PostsCountDiscussionModel,_r as PostsDiscussionBasicModel,qt as PostsFilters,Pr as PostsFullModel,xt as PostsMetaModel,Tr as PostsModel,Re as PotmBadgesValue,nn as PotmResultsMetaModel,pn as PotmResultsModel,ln as PotmResultsResponseModel,rn as PotmUserVotesFilters,sn as PotmUserVotesModel,on as PotmUserVotesResponseModel,Co as PredictionMatchQuizModel,Ze as PredictionRequestModel,Ti as PredictionResponseModel,zs as PredictionTopXModel,V as PredictionsFilters,As as PredictionsModel,ce as PredictionsStats,Ha as PredictorBadgeRequirements,$a as PredictorBadgesValue,Ee as PredictorConfigModel,Zs as PreferenceMappingModel,ec as PreferenceModel,Ae as PrivateLeagueBasicCreateModel,Oe as PrivateLeagueBasicUpdateRequestBody,Gs as PrivateLeagueCreateModel,Ns as PrivateLeagueFilters,xs as PrivateLeagueFullModel,ti as PrivateLeagueModel,wc as PrivateLeagueParamCreateBody,_c as PrivateLeagueParamUpdateBody,ii as PrivateLeaguePostsFilters,Ds as PrivateLeaguePredictionModel,ai as PrivateLeaguePredictionsFilters,Pc as PrivateLeaguePredictionsModel,ks as PrivateLeagueRankingsModel,Us as PrivateLeagueUpdateModel,Tc as PrivateLeaguesModel,La as ProfileCountryModel,be as ProfileModel,Ki as ProfileStatsModel,Io as RankingsFilters,Eo as RankingsModel,Er as ReactionModel,Ss as RedCardFixtureModel,q as RelatedEntityRelationship,Rr as ReportModel,Lt as RequirementModel,je as ResultModel,as as ResultsSummaryModel,_e as RewardsModel,Fe as RewardsModelV2,tc as SDKConfiguraitonModel,Vc as ScopeTypeEnum,Kr as ScoresModel,so as SearchFilters,oo as SearchModel,ms as SelectionProviderInfoModel,ji as SinglePredictionsBreakdown,pe as SinglePredictionsStats,h as StandardFansUnitedException,ge as StandingGameMetaModel,ga as StandingGameMetaParticipantsModel,ha as StandingGameModel,ya as StandingGamePredictionModel,ba as StandingGamePredictionsModel,Ws as StandingGameRankingsFilters,Ma as StandingGameRankingsModel,$s as StandingGamesFilters,fa as StandingGamesModel,Qr as StatsModel,Qn as StatusEnum,Yi as SuccessRatePercent,ka as SuccessRateScopeModel,Qi as SuccessRates,Ht as SummarizedBreakdown,lr as TagsModel,io as TeamBasicModel,ao as TeamColors,wi as TeamFilters,Xp as TeamFormModel,ro as TeamFullModel,pc as TemplateBreakdownModel,Ro as TemplateBreakdownPointsModel,Fo as TemplateByIdModel,wo as TemplateFilters,vo as TemplateGroupFilter,So as TemplateGroups,To as TemplateMeta,Bt as TemplateModel,yt as TiebreakerModel,cc as TiersModel,gt as TimeTiebreaker,jr as TimelineModel,Mc as TopCorrectScoresModel,vr as TopDiscussionsFilters,to as TopPlayerModel,Te as TopXConfigModel,oi as TopXPredictionRequestModel,Su as UserActionsEnum,ra as UserActivityFilters,Ga as UserDataConfigModel,Ys as UserListWinners,Fs as ValueAndPlayerId,rt as ValueBoolean,ys as ValueCorners,Ms as ValueCorrectScore,Is as ValueDoubleChance,_s as ValueHalfTimeFullTime,Ts as ValueOneXTwo,Fr as VersionsModel,tr as VotingBadgeRequirements,Ua as VotingBadgesValue};
|
|
4
4
|
//# sourceMappingURL=index.js.map
|