fansunited-sdk-esm 1.109.0 → 1.110.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 CHANGED
@@ -1,4 +1,4 @@
1
- var sd=Object.create;var lp=Object.defineProperty;var nd=Object.getOwnPropertyDescriptor;var ld=Object.getOwnPropertyNames;var pd=Object.getPrototypeOf,cd=Object.prototype.hasOwnProperty;var dd=(s,t,e)=>t in s?lp(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e;var ud=(s,t)=>()=>(s&&(t=s(s=0)),t);var tn=(s,t)=>()=>(t||s((t={exports:{}}).exports,t),t.exports),md=(s,t)=>{for(var e in t)lp(s,e,{get:t[e],enumerable:!0})},hd=(s,t,e,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of ld(t))!cd.call(s,a)&&a!==e&&lp(s,a,{get:()=>t[a],enumerable:!(i=nd(t,a))||i.enumerable});return s};var fd=(s,t,e)=>(e=s!=null?sd(pd(s)):{},hd(t||!s||!s.__esModule?lp(e,"default",{value:s,enumerable:!0}):e,s));var Z=(s,t,e)=>(dd(s,typeof t!="symbol"?t+"":t,e),e);var Lc={};md(Lc,{default:()=>wd});var Id,wd,xc=ud(()=>{Id={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},wd=Id});var Dc=tn((Nh,hp)=>{var _d=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 L=[],ai=[],ri=typeof Buffer<"u";typeof d>"u"&&(d=!0),typeof u>"u"&&(u=1/0);function st(h,Bt){if(h===null)return null;if(Bt===0)return h;var k,Xs;if(typeof h!="object")return h;if(s(h,t))k=new t;else if(s(h,e))k=new e;else if(s(h,i))k=new i(function(Js,_){h.then(function(Zs){Js(st(Zs,Bt-1))},function(Zs){_(st(Zs,Bt-1))})});else if(a.__isArray(h))k=[];else if(a.__isRegExp(h))k=new RegExp(h.source,p(h)),h.lastIndex&&(k.lastIndex=h.lastIndex);else if(a.__isDate(h))k=new Date(h.getTime());else{if(ri&&Buffer.isBuffer(h))return Buffer.allocUnsafe?k=Buffer.allocUnsafe(h.length):k=new Buffer(h.length),h.copy(k),k;s(h,Error)?k=Object.create(h):typeof b>"u"?(Xs=Object.getPrototypeOf(h),k=Object.create(Xs)):(k=Object.create(b),Xs=b)}if(d){var wc=L.indexOf(h);if(wc!=-1)return ai[wc];L.push(h),ai.push(k)}s(h,t)&&h.forEach(function(Js,_){var Zs=st(_,Bt-1),od=st(Js,Bt-1);k.set(Zs,od)}),s(h,e)&&h.forEach(function(Js){var _=st(Js,Bt-1);k.add(_)});for(var ft in h){var ic;Xs&&(ic=Object.getOwnPropertyDescriptor(Xs,ft)),!(ic&&ic.set==null)&&(k[ft]=st(h[ft],Bt-1))}if(Object.getOwnPropertySymbols)for(var _c=Object.getOwnPropertySymbols(h),ft=0;ft<_c.length;ft++){var sp=_c[ft],Bi=Object.getOwnPropertyDescriptor(h,sp);Bi&&!Bi.enumerable&&!I||(k[sp]=st(h[sp],Bt-1),Bi.enumerable||Object.defineProperty(k,sp,{enumerable:!1}))}if(I)for(var R=Object.getOwnPropertyNames(h),ft=0;ft<R.length;ft++){var np=R[ft],Bi=Object.getOwnPropertyDescriptor(h,np);Bi&&Bi.enumerable||(k[np]=st(h[np],Bt-1),Object.defineProperty(k,np,{enumerable:!1}))}return k}return st(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 hp=="object"&&hp.exports&&(hp.exports=_d)});var zc=tn((kh,mc)=>{"use strict";var Ji=typeof Reflect=="object"?Reflect:null,Bc=Ji&&typeof Ji.apply=="function"?Ji.apply:function(t,e,i){return Function.prototype.apply.call(t,e,i)},fp;Ji&&typeof Ji.ownKeys=="function"?fp=Ji.ownKeys:Object.getOwnPropertySymbols?fp=function(t){return Object.getOwnPropertyNames(t).concat(Object.getOwnPropertySymbols(t))}:fp=function(t){return Object.getOwnPropertyNames(t)};function Pd(s){console&&console.warn&&console.warn(s)}var kc=Number.isNaN||function(t){return t!==t};function S(){S.init.call(this)}mc.exports=S;mc.exports.once=Sd;S.EventEmitter=S;S.prototype._events=void 0;S.prototype._eventsCount=0;S.prototype._maxListeners=void 0;var Nc=10;function gp(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 Nc},set:function(s){if(typeof s!="number"||s<0||kc(s))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+s+".");Nc=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||kc(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 Gc(s){return s._maxListeners===void 0?S.defaultMaxListeners:s._maxListeners}S.prototype.getMaxListeners=function(){return Gc(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")Bc(l,this,e);else for(var p=l.length,c=qc(l,p),i=0;i<p;++i)Bc(c[i],this,e);return!0};function Uc(s,t,e,i){var a,r,o;if(gp(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=Gc(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,Pd(n)}return s}S.prototype.addListener=function(t,e){return Uc(this,t,e,!1)};S.prototype.on=S.prototype.addListener;S.prototype.prependListener=function(t,e){return Uc(this,t,e,!0)};function Td(){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 Vc(s,t,e){var i={fired:!1,wrapFn:void 0,target:s,type:t,listener:e},a=Td.bind(i);return a.listener=e,i.wrapFn=a,a}S.prototype.once=function(t,e){return gp(e),this.on(t,Vc(this,t,e)),this};S.prototype.prependOnceListener=function(t,e){return gp(e),this.prependListener(t,Vc(this,t,e)),this};S.prototype.removeListener=function(t,e){var i,a,r,o,n;if(gp(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():Ed(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 Hc(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?Rd(a):qc(a,a.length)}S.prototype.listeners=function(t){return Hc(this,t,!0)};S.prototype.rawListeners=function(t){return Hc(this,t,!1)};S.listenerCount=function(s,t){return typeof s.listenerCount=="function"?s.listenerCount(t):$c.call(s,t)};S.prototype.listenerCount=$c;function $c(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?fp(this._events):[]};function qc(s,t){for(var e=new Array(t),i=0;i<t;++i)e[i]=s[i];return e}function Ed(s,t){for(;t+1<s.length;t++)s[t]=s[t+1];s.pop()}function Rd(s){for(var t=new Array(s.length),e=0;e<t.length;++e)t[e]=s[e].listener||s[e];return t}function Sd(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))}Wc(s,t,r,{once:!0}),t!=="error"&&Cd(s,a,{once:!0})})}function Cd(s,t,e){typeof s.on=="function"&&Wc(s,"error",t,e)}function Wc(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 jc=tn((Qc,Kc)=>{(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=Dc(),s=zc().EventEmitter,Kc.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,L;if(I=d,[...d]=I,[u]=i.call(d,-1),typeof u=="function")try{L=c(...d),u(null,L)}catch(ai){b=ai,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,L,ai,ri,st;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,L=l.length;d<L;d++){if(I=l[d],{key:b,val:st,ttl:ri}=I,ri&&typeof ri!="number")throw p=this._error("ETTLTYPE"),p;if((c=this._isInvalidKey(b))!=null)throw c}for(u=0,ai=l.length;u<ai;u++)I=l[u],{key:b,val:st,ttl:ri}=I,this.set(b,st,ri);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(Qc)});var Jc=tn((Yc,Xc)=>{(function(){var s;s=Xc.exports=jc(),s.version="5.1.2"}).call(Yc)});var ad=tn((YW,Bd)=>{Bd.exports={name:"fansunited-sdk-esm",version:"1.109.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 en=(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))(en||{});var an=class{validate=t=>{let e=this.validateField(t.lang),i=this.generateMessage(e);return{validation:e,message:i}};validateField=t=>{let e=Object.values(en),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 Ni=(r=>(r.DEV="dev",r.PROD="prod",r.STAGING="staging",r.WATG="watg",r.YOLO="yolo",r))(Ni||{});var rn=class{validate(t){let e=this.validateField(t.environment),i=this.generateMessage(e);return{validation:e,message:i}}validateField=t=>{let e=Object.values(Ni),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 on=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 x=(r=>(r.NATIVE="native",r.ENETPULSE="enetpulse",r.SPORTRADAR="sportradar",r.SPORTAL_365="sportal365",r.API_FOOTBALL="api_football",r))(x||{});var sn=class{validate(t){let e=this.validateField(t.idSchema),i=this.generateMessage(e);return{validation:e,message:i}}validateField=t=>{let e=Object.values(x),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 Zt=class{getIdToken=null;logout=null};var nt=class{text=null;type=null};var ki=class{validation=null;message=new nt;getIdToken={validation:null,message:new nt};logout={validation:null,message:new nt}};var nn=class{validate(t){if(t.cookieToken)return new ki;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 Zt),i=new ki;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 Zt).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 ut=class{validation;message};var ln=class{apiKey=null;environment=null;idSchema=null;clientId=null;lang=null;errorHandlingMode=null;cookieToken={name:new ut,requestHeaders:new ut};oddClient=null;authProvider={getIdToken:new ut,logout:new ut};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 pp=(e=>(e.DEFAULT="default",e.STANDARD="standard",e))(pp||{});var cn=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 Gi=class extends ut{name={validation:null,message:new nt};requestHeaders={validation:null,message:new nt}};var dn=class{keys=["name","requestHeaders"];isServerSide=typeof document>"u";validate(t){if(!t.cookieToken){let i=new Gi;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 Gi;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 Ui=class extends ut{name={validation:null,message:new nt};credentials={validation:null,message:new nt}};var un=class{keys=["name","credentials"];validate=t=>{if(!t.oddClient){let i=new Ui;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 Ui;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 mn=class{validate=t=>{let e=this.checkFieldsForValues(t);return e.isValid=this.containsErrorMessage(e),e};checkFieldsForValues=t=>{let e=new ln,i={apiKey:new on,environment:new rn,idSchema:new sn,clientId:new pn,lang:new an,errorHandlingMode:new cn,authProvider:new nn,cookieToken:new dn,oddClient:new un};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 ac=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},oi=(s,t)=>{let e=[];for(;s.length>t;){let i=s.splice(0,t);e.push(i)}return e.push(s),e},F=(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:"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"},n={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=o[t]:s==="watg"?e=a[t]:s==="yolo"?e=r[t]:e=n[t],e},te=s=>Array.from(new Set(s)),g=s=>s||!1,f=()=>`&disable_cache=${Date.now()}`,cp=s=>JSON.parse(JSON.stringify(s.sort((t,e)=>t.localeCompare(e))));var tt=(_=>(_.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",_))(tt||{}),Pc=["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"],Tc=["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"],gt=["PLAYER_RED_CARD","PLAYER_SCORE","PLAYER_SCORE_FIRST_GOAL","PLAYER_SCORE_HATTRICK","PLAYER_SCORE_TWICE","PLAYER_YELLOW_CARD"],Ec=["FT_1X2","HT_1X2","HT_FT","DOUBLE_CHANCE","CORNERS_MATCH","CORRECT_SCORE","CORRECT_SCORE_HT","CORRECT_SCORE_ADVANCED"],Vi="PLAYER_SCORE_FIRST_GOAL";var Hi=class{id="";achievedAt=""};var ee=class{participationCount=null;points=null};var ie=class{totalPoints=null;postPoints=null;postsMade=null;reactionPoints=null;reactionCount=null};var ae=class{participationCount=null};var si=class{participations=0;points=0};var kt=class{footballCompetitions=[];footballTeams=[]};var re=class{predictionsMade=0;correct=0;points=0;breakdown=new kt};var oe=class{single=new re;topX=new si;matchQuiz=new si};var $i=class{overallPercent;byFootballCompetition;byFootballTeam;byFootballMarket};var qi=class{profileId;tier;points;predictionsMade;successRates=new $i;predictions=new oe;tiers=[];badges=[];discussions=new ie;classicQuizzes=new ee;eitherOr=new ae};var Wi=class{entityId="";entityType="";entitySource="";model=null;predictionsMade=0;correct=0;points=0};var zi=class{successRatePercent;model=null};var St=class{content=null;tags=[];campaign=null};var se=class{id=null;profileId=null;property=null;value=null;action=null;context=new St;points=0};var z=class{currentPage=null;itemsPerPage=null;totalItems=null;numberOfPages=null};var D=class{pagination=new z};var Qi=class{meta=new D;data=[new se]};var hn=class{remapSingleResponse=t=>{let e=new se;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 Qi;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)},tt[i]&&delete e[i].model});else return t;return e};remapSuccessRatePercent=t=>{let e=new zi;return e.successRatePercent=t.success_rate_percent,e};remapPredictionsStats=t=>{let e=new oe;return e.single=this.remapSinglePredictionsStats(t.single),e.topX=t.top_x,e.matchQuiz=t.match_quiz,e};remapSinglePredictionsStats=t=>{let e=new re;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 kt,i=[],a=[];return Object.keys(t).forEach(r=>{let o=new Wi;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 kt};remapAchievementsStats=t=>t.map(e=>{let i=new Hi;return i.id=e.id,i.achievedAt=e.achieved_at,i});remapDiscussionStats=t=>{let e=new ie;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 ee;return e.participationCount=t.participation_count,e.points=t.points,e};remapEitherOrStats=t=>{let e=new ae;return e.participationCount=t.participation_count,e}};function rc(s){this.message=s}rc.prototype=new Error,rc.prototype.name="InvalidCharacterError";var Rc=typeof window<"u"&&window.atob&&window.atob.bind(window)||function(s){var t=String(s).replace(/=+$/,"");if(t.length%4==1)throw new rc("'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 bd(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(Rc(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 Rc(t)}}function dp(s){this.message=s}function Md(s,t){if(typeof s!="string")throw new dp("Invalid token specified");var e=(t=t||{}).header===!0?0:1;try{return JSON.parse(bd(s.split(".")[e]))}catch(i){throw new dp("Invalid token specified: "+i.message)}}dp.prototype=new Error,dp.prototype.name="InvalidTokenError";var oc=Md;var v=(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))(v||{});var A=(R=>(R.INVALID_TEMPLATE="INVALID_TEMPLATE",R.INVALID_PREDICTION="INVALID_PREDICTION",R.INVALID_MARKET="INVALID_MARKET",R.INVALID_FIELD="INVALID_FIELD",R.INVALID_TYPE="INVALID_TYPE",R.EXCEEDED_LENGTH="EXCEEDED_LENGTH",R.INVALID_TOKEN="invalid_token",R.UNAUTHORIZED="unauthorized",R.INVALID_FILTERS="invalid_filters",R.INVALID_AVATAR="invalid_avatar",R.INVALID_METHOD_CALL="invalid_method_call",R.INVALID_LIMIT="invalid_limit",R.INVALID_TEMPLATE_GROUP_ID="invalid_template_group_id",R.INVALID_TEMPLATE_GROUP_FILTERS="invalid_template_group_filters",R.INVALID_PAGE_NUMBER="invalid_page_number",R.INVALID_DISCUSSION_IDS="invalid_discussion_ids",R.ID_MAPPING_NOT_FOUND="id_mapping_not_found",R.INVALID_COMPETITION_ID="invalid_competition_id",R.INVALID_TEAM_ID="invalid_team_id",R.INVALID_IDS="invalid_ids",R.INVALID_INPUT_PROVIDER="invalid_input_provider",R.INVALID_OUTPUT_PROVIDER="invalid_output_provider",R.INVALID_MATCH_SUMMARY="invalid_match_summary",R.INVALID_MATCH_SUMMARY_PREDICTIONS="invalid_match_summary_predictions",R.INVALID_MATCH_SUMMARY_PREDICTIONS_KEYS="invalid_match_summary_predictions_keys",R.ENTITY_IDS_NOT_FOUND="entity_ids_not_found",R.MATCH_IDS_NOT_FOUND="match_ids_not_found",R.INVALID_MATCH_IDS="invalid_match_ids",R.ODD_CLIENT_CONFIGURATION_NOT_FOUND="odd_client_configuration_not_found",R))(A||{});var B={native:"id",sportradar:"sportradar_id",sportal365:"sportal365_id",enetpulse:"enetpulse_id",api_football:"api_football_id"},sc={PREDICTOR_USER_RELATED_OPERATION:"https://docs.fansunitedmedia.com/docs/predictor-operations#user-related-operations"},nc=["matchId","matchType","market","prediction"],Sc=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 N=(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))(N||{}),lc={UNEXPECTED_STATUS_PROP:`Unexpected provided property 'status'. You can NOT use this property for this method. For more information visit our documentation:
2
- ${sc.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
- ${sc.PREDICTOR_USER_RELATED_OPERATION}`},Cc=(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`,up=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`,Fc=s=>`The market '${s}' is not valid for Top X game. The only available market is CORRECT_SCORE.`,vc=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`,Ac=(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`,Oc=(s,t)=>`The field ${s} has incorrect type. The correct type is ${t}`;var Gt=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 Gt(t,o)}let{code:i,status:a,message:r}=e.error;return this.errorHandlingMode==="standard"?new m(i,a,r):new Gt(t,e.error)};validateJWTToken=()=>{let t=null;try{t=oc(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 Gt(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 Gt(i,a)}else if(this.errorHandlingMode==="standard")throw new m(401,"invalid_token","The provided JWT token is expired")}};extractUserIdFromToken=()=>{try{return oc(this.getJwtToken())?.sub||""}catch(t){return console.error(t),""}}};var ni=class extends C{activityRemapper=null;constructor(t){super(t,F(t.environment,"loyalty")),this.activityRemapper=new hn}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 pc=(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))(pc||{});var li=class{action=null;context=new St;constructor(t,e,i,a){this.action=t,this.context.tags=e,i&&(this.context.content=i),a&&(this.context.campaign=a)}};var fn={player:"players",team:"teams",homeTeam:"teams",awayTeam:"teams",country:"countries",competition:"competitions",match:"matches"},gn=class extends C{constructor(t){super(t,F(t.environment,"idMapping"))}getEntityById=async(t,e)=>{let i=`/football${this.apiSignInUrl}&input_provider=${this.idSchema}&${fn[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}&${fn[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}&${fn[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=ac(e),r=[];for(let o of a){let n=`/football${this.apiSignInUrl}&input_provider=${i}&${fn[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=te(i),n=ac(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+=`${fn[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 cc="FansUnited",mp={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}}},Ki=class{idSchema="";storageInstance=null;expirationProfileTimeout=600;expirationBadgesTimeout=3600;expirationClientFeaturesTimeout=14400;expirationFootballIdsTimeout=604800;constructor(t){this.idSchema=t,this.getStorageInstance()}static getInstance(t){return Ki.instance||(Ki.instance=new Ki(t)),Ki.instance}async getStorageInstance(){try{let t=await Promise.resolve().then(()=>(xc(),Lc));this.storageInstance=t.default}catch(t){console.error(t)}}async getData(){try{let t=await this.storageInstance.getItem(cc);return t?JSON.parse(t):(await this.storageInstance.setItem(cc,JSON.stringify(mp)),mp)}catch(t){throw console.error("AsyncStorage error:",t),t}}async setData(t){await this.storageInstance.setItem(cc,JSON.stringify(t))}clearData=async()=>{await this.setData(mp)};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=B[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=B[i];return r&&t.includes(`${r[o]}`)&&r.resource===e}):a.football.ids.find(r=>{let o=B[i];return r&&`${r[o]}`===t&&r.resource===e})};checkForExistingIdObjs=async(t,e)=>{let i=B[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=B[i],o=B[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(mp)}},ji=Ki;Z(ji,"instance");var dc="FansUnited",uc={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}}},Yi=class{idSchema="";expirationProfileTimeout=600;expirationBadgesTimeout=3600;expirationClientFeaturesTimeout=14400;expirationFootballIdsTimeout=604800;constructor(t){this.idSchema=t}static getInstance(t){return Yi.instance||(Yi.instance=new Yi(t)),Yi.instance}clearData=async()=>{this.setData(uc)};getEntityById=async(t="",e="")=>this.getData().football.ids.find(i=>{let a=B[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=B[i];return a&&t.includes(`${a[r]}`)&&a.resource===e}):this.getData().football.ids.find(a=>{let r=B[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=B[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=B[i],r=B[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(dc)||this.setData(uc),JSON.parse(localStorage.getItem(dc)));setData=t=>{localStorage.setItem(dc,JSON.stringify(t))};initialNewSchema=(t,e)=>{let i=this.getData();(!i||!i[t]||!i[t][e])&&this.setData(uc)}},Xi=Yi;Z(Xi,"instance");var Zc=fd(Jc());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=B[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=B[i];return r&&t.includes(`${r[o]}`)&&r.resource===e}):a.find(r=>{let o=B[i];return r&&`${r[o]}`===t&&r.resource===e})};checkForExistingIdObjs=async(t,e)=>{let i=B[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=B[i],r=B[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"}}},pi=T;Z(pi,"instance"),Z(pi,"nodeCache",new Zc.default);var lt=class{createLocalCacheInstance=t=>typeof window>"u"?pi.getInstance(t):typeof __DEV__<"u"?ji.getInstance(t):Xi.getInstance(t)};var ci=class{localCache=null;https=null;constructor(t){this.localCache=new lt().createLocalCacheInstance(t.idSchema),this.https=new gn(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 yp=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 yn=class{extractedObjIds={};traverse=(t,e)=>(e=yp(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 bn=class{replaceObjIdsIndex=null;remappedIdsObj={};traverse=(t,e,i)=>(e=yp(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 E=class{idSchema="";idMappingFacade=null;constructor(t){this.idSchema=t.idSchema,this.idMappingFacade=new ci(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 yn().traverse(i,e);return this.idMappingFacade.getEntitiesByIds(r,"native",this.idSchema).then(o=>new bn().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 yt=class{idSchema;idMapping;constructor(t){this.idSchema=t.idSchema,this.idMapping=new E(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 ne=class{page=null;limit=null;constructor(t){this.page=t.page?t.page:null,this.limit=t.limit?t.limit:null}};var Zi=class extends ne{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 ta=class extends ne{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 Mn=class{idSchema;activityHttps;activityService;constructor(t){this.idSchema=t.idSchema,this.activityHttps=new ni(t),this.activityService=new yt(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 li(t,n,i,a),p=await this.activityHttps.createActivity(l);return p.context.tags=o,p}let r=new li(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 Zi(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 ta(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 In=class{activityFacade;constructor(t){this.activityFacade=new Mn(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 le=class{participantOne=null;participantTwo=null};var ea=class{matchId="";participantOne="";participantTwo="";winner="";homeParticipant="";startDate="";score=new le};var pe=class{participants=[]};var ia=class{id=null;name=null;group=null;image=null;undecided=!1};var aa=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 pe;fixtures=[];createdAt=null;updatedAt=null};var bt=class{nextPageStartsAfter=null;itemsPerPage=null};var w=class{pagination=new bt};var ra=class{meta=new w;data=[]};var oa=class{meta=new w;data=[]};var sa=class{statTiebreakerEnabled;statTotal};var na=class{matchId="";participantOne="";participantTwo="";winner;correct=null};var ce=class{statTotal=0};var td=(r=>(r.ACTIVE="ACTIVE",r.WON="WON",r.LOST="LOST",r.PARTIALLY_WON="PARTIALLY_WON",r.CANCELED="CANCELED",r))(td||{}),la=class{id="";profileId="";profileModel=null;gameId="";totalPoints=null;gamePoints=null;bonusPoints=null;position=null;status="ACTIVE";fixtures=[];tiebreaker=new ce;createdAt="";updatedAt=""};var pa=class{meta=new w;data=[]};var wn=class{remapBracketGames=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.remapBracketGameById(i)),e};remapBracketGameById=t=>{let e=new aa;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 la;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 ra;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 na;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 ce;return e.statTotal=t.stat_total,e};remapBracketGameMeta=t=>{let e=new pe;return e.participants=t.participants.map(i=>{let a=new ia;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 ea;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 le;return e.participantOne=t.participant_one,e.participantTwo=t.participant_two,e};remapBracketGameTiebreaker=t=>{let e=new sa;return e.statTiebreakerEnabled=t.stat_tiebreaker_enabled,e.statTotal=t.stat_total,e}};var de=class{participants=[]};var ca=class{id=null;title=null;description=null;rules=null;customFields=null;images=null;type="STANDING";status=null;points=null;related=[];predictionsCutoff="";meta=new de;outcomeCount=null;outcome=[];createdAt=null;updatedAt=null};var da=class{meta=new w;data=[]};var ua=class{id=null;name=null;group=null;image=null;undecided=!1};var ma=class{id="";profileId="";profileModel=null;total=0;gameId="";totalPoints=null;gamePoints=null;bonusPoints=null;position=null;status="ACTIVE";standing=[];createdAt="";updatedAt=""};var ha=class{meta=new w;data=[]};var fa=class{meta=new w;data=[]};var _n=class{remapBracketGames=t=>{let e=new da;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 ca;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 ma;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 ha;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 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};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 de;return e.participants=t.participants.map(i=>{let a=new ua;return a.id=i.id,a.name=i.name,a.group=i.group,a.image=i.image,a.undecided=i.undecided,a}),e}};var Fd={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:""},di=class extends C{bracketGameRemapper=null;standingGameRemapper=null;constructor(t){super(t,F(t.environment,"predictor")),this.bracketGameRemapper=new wn,this.standingGameRemapper=new _n}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(Fd));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 ue=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 ga=class extends ue{email=null;phoneNumber=null;phoneCountryCode=null};var Pn=class{profilesFromResponse=t=>t?t.map(e=>this.publicProfileFromResponse(e)):null;fullProfileFromResponse=t=>{let e=new ga;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.followingCount=t.following_count,e.followersCount=t.followers_count,e};publicProfileFromResponse=t=>{let e=new ue;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}};var V=class{meta=new w;data=[]};var ya=class{avatar=null;followingId=null;name=null;nickname=null;profileId=null};var Tn=class{followResponse=t=>t.map(e=>this.remapResponse(e));followingFromResponse=t=>{let e=new V;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 ya;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 ba=class{avatar=null;followerId=null;name=null;nickname=null;profileId=null};var Ma=class{followsMe=[];iFollow=[];followsMeBack=[]};var En=class{followersFromResponse=t=>{let e=new V;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 Ma;return e.iFollow=t.i_follow,e.followsMe=t.follows_me,e.followsMeBack=t.follows_me_back,e};remapResponse=t=>{let e=new ba;return e.avatar=t.avatar,e.followerId=t.follower_id,e.name=t.name,e.profileId=t.profile_id,e}};var ui=class{profile_ids=[]};var Ia=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 Rn=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 Ia;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 vd="/countries",et="/profile",bp="/profiles",mi=class extends C{profileRemapper=null;followingRemapper=null;followersRemapper=null;leadRemapper=null;lang=null;limitIds=100;constructor(t){super(t,F(t.environment,"profile")),this.lang=t.lang,this.profileRemapper=new Pn,this.followingRemapper=new Tn,this.followersRemapper=new En,this.leadRemapper=new Rn}getCountries=async t=>{let e=`&lang=${this.lang}`,i=`${vd}${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=`${et}${this.apiSignInUrl}`,i="";if(t){e=`${bp}/${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=oi(t,this.limitIds);for(let u of d){let b=`${bp}${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=`${bp}${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=`${bp}${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=`${et}/followers${this.apiSignInUrl}`,a="There was a problem fetching the followers for own profile";if(t&&!e){i=`${et}/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=`${et}/${e}/followers${this.apiSignInUrl}${t.constructFilterUrl()}`:!t&&e&&(i=`${et}/${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=`${et}/following${this.apiSignInUrl}`,a="There was a problem fetching the followers of own profile";if(t&&!e){i=`${et}/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=`${et}/${e}/following${this.apiSignInUrl}${t.constructFilterUrl()}`:!t&&e&&(i=`${et}/${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 ui;e.profile_ids=t;let i=et+`/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 ui;e.profile_ids=t;let i=et+`/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=`${et}/badges${this.apiSignInUrl}`,i="There was a problem with fetching own badges";return t?(e=`${et}/${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=et+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 wa=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 _a=class{totalPercentage;breakdown=new wa};var hi=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 Mt=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 hi(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 hi(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 _a,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 Pa=class{id=null;name=null;assets=null};var Sn=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 Cn=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 Sn,this.profileFacade=new Mt(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 Pa,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 fi=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 Mt(e,i,a)}getById=t=>new fi(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 Fn=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 gi=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 vn=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 gi(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 gi({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 yi=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 Ta=class{reason="";words=[]};var me=class{enabled=!1;moderateLinks=!1;linksWhitelist=[];moderatorProfileId="";dictionary=new Ta};var Ea=class{enabled=!1;clientId=null;automaticModeration=new me};var Ct=class{points=null;gameParticipationCount=null;entityId=null;entityType=null;predictionsMade=null;correctPredictions=null};var he=class{id;weight;multiplier;conditions};var fe=class{value=[new he]};var ge=class{points=null;tiers=null;badges=null};var Ra=class{enabled=!1;clientId=null;conditions={list:null};actions=new fe;rewards=new ge};var Sa=class{general=null;predictor=null;activity=null;topX=null;matchQuiz=null;discussionPost=null};var ye=class{enabled=!1;clientId=null;defaultMarkets=null;competitionsWhitelist=null;authRequirement=null};var be=class{enabled=!1;clientId=null;minFixtures=null;maxFixtures=null;competitionsWhitelist=null;authRequirement=null};var Ca=class{competitions=[];teams=[];markets=[]};var Me=class{enabled=!1;clientId=null;fullCoverageCompetitions=null;markets=null;successRateScopes=new Ca;userDataConfig=null};var Fa=class{storeIp=!1;storeDeviceId=!1;storeAgent=!1};var va=class{potm=[];poll=[]};var Aa=class{predictor=[];topX=[];matchQuiz=[];games=[];football=[];classicQuizzes=[];eitherOr=[];discussions=[];voting=new va};var q=class{id;label;description;flags;assets={mainImageUrl:""};enabled};var Oa=class{predictionsNumber;correctPredictions;points;fromDate;toDate};var La=class extends q{requirements=new Oa};var xa=class{participationCount;points;fromDate;toDate};var Da=class extends q{requirements=new xa};var Ba=class{participationCount;points;specificGames;fromDate;toDate};var Na=class extends q{requirements=new Ba};var ka=class{predictionsNumber;correctPredictions;points;entityId;entityType;entityModel=null};var Ga=class extends q{requirements=new ka};var Ua=class{participationCount;fromDate;toDate};var Va=class extends q{requirements=new Ua};var Ha=class{totalDiscussionPoints;postsCount;postPoints;reactionsCount};var $a=class extends q{requirements=new Ha};var qa=class{points;voteCount;entityId;entityType;entityModel};var Ie=class extends q{requirements=new qa};var we=class{points=null;tiers=null;badges=null};var Wa=class{enabled=!1;clientId=null;conditions={list:null};actions=new fe;rewards=new we};var za=class{general=[];predictor=[];topX=[];matchQuiz=[]};var Qa=class{id;label;assets={mainImageUrl:""};enabled;requirements=new Ct};var _e=class extends Ct{postPoints=null;postsCount=null;reactionsCount=null;totalDiscussionPoints=null};var Ka=class{id;label;assets={mainImageUrl:""};enabled;requirements=new _e};var Pe=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 Te=class{total=null;minGoalkeepers=null;maxGoalkeepers=null;minDefenders=null;maxDefenders=null;minMidfielders=null;maxMidfielders=null;minStrikers=null;maxStrikers=null};var ja=class{enabled=!1;clientId=null;addPointsToProfileTotal=!1;coefficients=new Pe;players=new Te;multipliers=null;competitionsWhitelist=[]};var Ya=class{captain=null;viceCaptain=null};var An=class{remapPredictorConfig=t=>{let e=new Me;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 be;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 ye;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 Ra;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 Wa;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 Ea;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 ja;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 Te;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 Pe;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 we;return e.points=this.remapPoints(t.points),e.tiers=t.tiers,e.badges=this.remapNewBadges(t.badges),e};remapRewards=t=>{let e=new ge;return e.points=this.remapPoints(t.points),e.tiers=t.tiers,e.badges=this.remapBadges(t.badges),e};remapPoints=t=>{let e=new Sa;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 za;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 Aa;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 La;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 Da;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 Na;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 Ga;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 Va;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 $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.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 Ie;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 Qa;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 Ct;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 Fa;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 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.remapGeneralRequirements(e.requirements),i});remapGeneralRequirements=t=>{let e=new _e;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 Ya;return e.captain=t.captain,e.viceCaptain=t.vice_captain,e}};var Xa=class{entityId;entityType;entityModel=null};var Mp=class{totalItems=0};var Ip=class{id=null;label=null};var wp=class{type=null;id=null;label=null};var Ja=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 Za=class extends P{};var _p=class{fixtures=[];tiebreaker};var hc=(i=>(i.PARTICIPANT_ONE="PARTICIPANT_ONE",i.PARTICIPANT_TWO="PARTICIPANT_TWO",i.DRAW="DRAW",i))(hc||{});var tr=class{matchId="";participantOne="";participantTwo="";winner="PARTICIPANT_ONE"};var Ft=(o=>(o.OPEN="OPEN",o.LIVE="LIVE",o.PENDING="PENDING",o.CANCELED="CANCELED",o.CLOSED="CLOSED",o.SETTLED="SETTLED",o))(Ft||{});var er=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(Ft).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 ir=class{profileId="";profileModel=null;challengeId="";challengeModel=null;message=""};var Ee=class{name="";description="";invitation_code="";template_id="";users_can_invite_users=!1;administrators=[];scoring_starts_at=""};var ar=class extends Ee{type="ONE_VS_ONE"};var Re=class{name="";description="";invitation_code="";template_id="";users_can_invite_users=!1;administrators=[];pinned_posts=[];scoring_starts_at=""};var rr=class extends Re{type="ONE_VS_ONE"};var or=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 sr=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 nr=class{templateId="";templateModel=null;challengeId="";challengeModel=null;position="";points=0;type="challenge"};var lr=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 Pp=class{content="";replyId="";discussionLabel="";discussionUrl="";userNickname="";context=null};var Se=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 pr=class extends Se{userModel=null};var cr=class{content="";reply_id="";discussion_label="";discussion_url="";anonymous_nickname="";context=null};var dr=class{id="";postsCount=0};var vt=class{pagination={totalItems:0,nextPageStartsAfter:"",lastCommentCreateTimestamp:""}};var ur=class{meta=new vt;data=[]};var mr=class{meta=new vt;data=[]};var hr=class{meta=new w;data=[]};var fr=class{type="";userIds=[];reactionCount=0};var gr=class{userId=null;reason="AD";reasonDetails=null};var yr=class{updatedAt="";content=""};var Ad=["CREATED_AT_ASC","CREATED_AT_DESC","POSTS_COUNT_ASC","POSTS_COUNT_DESC"],Od=["ACTIVE","INACTIVE"],br=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&&Ad.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 Ut=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 Mr=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 Ir=class{templateId=null;playerId=null};var wr=class{filters=new Ir};var _r=class{meta=new wr;data=[]};var Pr=class{key=null;label=null;value=null};var Tr=class{templateId=null};var Er=class{filters=new Tr};var Rr=class{meta=new Er;data=[]};var Ce=class{template_id=null;group_id=null;fixtures=[]};var Fe=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 ve=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 Sr=class{matchId=null;matchModel=null;points=new Fe;stats=new ve};var Cr=class{playerId=null;playerModel=null;points=null;rank=null};var Fr=class{id="";country=null;gender="";assets=null;type="";name=""};var vr=class{id="";country=null;gender="";assets=null;type="";name="";participants=[]};var Ar=class{id="";alias="";countryCode="";assets=null;name=""};var Or=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={type:null,subType:null}};var it=class{type=null;subType=null};var Lr=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 it;lineups=null};var At=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 xr=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 Dr=class{ftScore=null;htScore=null;aetScore=null;aggScore=null;penScore=null};var Ae=class{homeTeam={players:[]};awayTeam={players:[]}};var Br=class{minute="";type="";teamId="";player=null;relatedPlayer=null;updatedAt=""};var Nr=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 kr=class{id="";country=null;birthDate="";firstName="";lastName="";name="";position="";assets=null;isDeleted=!1;teams=[]};var Gr=class{id="";country=null;birthDate="";firstName="";lastName="";name="";position="";assets=null;isDeleted=!1;competitions=[];teams=[]};var Ur=class{id="";startDate="";endDate="";shirtNumber;loan=!1;position="";country=null;name="";assets=null;birthDate=""};var Vr=class{id="";country=null;birthDate="";firstName="";lastName="";name="";position="";assets=null};var bi=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 Tp=class{headshot=null};var Ep=class{id=null;name=null;country=null};var Hr=class{id="";name="";position="";shirtNumber;assets=null;type=""};var $r=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 Wr=class{id="";country=null;gender="";assets=null;name="";competitions=[];code="";national=!1;fullName="";shortName="";isDeleted=!1;undecided=!1;colors=new qr;squad=[]};var Rp=class{teamId=null;matches=[]};var zr=class{teams=null;players=null;competitions=null};var Qr=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 Vt=class{meta=new D;data=[]};var Sp=class{logo=null};var Cp=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 Fp=class{apiKey;clientId;environment;idSchema;lang;errorHandlingMode;oddClient;cookieToken;authProvider};var K=class{main=null;cover=null;mobile=null};var Kr=class{colors=null;urls=null;images=null};var jr=class{primaryColor=null;secondaryColor=null;contentColor=null;backgroundColor=null;borderColor=null;additionalColor=null};var Yr=class{primaryUrl=null;secondaryUrl=null;privacyPolicyUrl=null;termsAndConditionsUrl=null;additionalUrl=null};var Xr=class{mainLogo=null;mobileLogo=null;backgroundImage=null;mobileBackgroundImage=null;additionalImage=null};var Jr=class{input=null;output=null};var Zr=class{meta=new Jr;data=[]};var to=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 eo=class{general;predictor;topX;matchQuiz};var io=class{predictor;topX;matchQuiz;games;football;classicQuizzes;eitherOr;discussions;potm;poll};var vp=class extends Ie{};var Ap=class{count=0;breakdown=[]};var Op=class{footballCompetitions;footballTeams;footballPlayers};var ao=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 ro=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 oo=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 so=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 no=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 lo=class{position=null;points=null;predictionsMade=null;profileId=null;profileModel=null;successRatePercent=null};var Oe=class{templateId=null;privateLeagueId=null;fromDate=null;toDate=null;pagination=new z};var Lp=class{meta=new Oe;data=[]};var Ot=class{rankType=null;fromDate=null;toDate=null;pagination=new z};var xp=class{meta=new Ot;data=[]};var Le=class{position=null;profileId=null;profileModel=null;points=null;predictionsMade=null};var po=class{flags="";status="";type="";activeFrom="";activeTo="";createdFrom="";createdTo="";updatedFrom="";updatedTo=""};var co=class{pagination=new z;filters=new po};var Dp=class{id=null;points=null};var Bp=class extends he{points;alternative;constructor(){super(),delete this.weight}};var uo=class extends Le{id=null;rankType=null;model=null;gameType=null};var Np=class{meta=new Ot;data=[]};var mo=class{groupId;averagePoints;highestPoints};var Lt=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 K;status=null;automaticallyChangeStatus=!0;createdAt=null;updatedAt=null;related=null};var ho=class extends Lt{adContent=null};var fo=class{groupId=null;label=null;flags=[];filters=null};var go=class{fromDate=null;toDate=null;matchIds=[]};var kp=class{enabled=!1;id=null;label=null;points=null};var yo=class{value=null;target=null;playerId=null;playerModel=null;result=null};var bo=class{matchId=null;matchType=null;market=null;matchModel=null;matchStatus=new it;prediction=new yo};var Mo=class{gameId=null;results=null;tieBreakers=null};var mt=class{timeTiebreaker=!1};var It=class{id=null;title=null;description=null;type=null;status=null;authRequirement=null;outcome=null;predictionsCutoff=null;fixtures=[];tiebreaker=new mt;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 xe=class{id=null;title=null;alternativeTitle=null;description=null;type=null;images=new K;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 De=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 Io=class extends De{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 wo=class extends xe{rules=null;questions=[]};var _o=class{questionId=null;question=null;images=null;embedCode=null;explanation=null;options=[]};var Po=class{optionId=null;option=null;images=null;correct=null};var Gp=class{questionId=0;optionId=0};var To=class{classicQuizId=null;userId=null;questions=[];correctOptions=null;personalBest=null;points=null;attempts=null};var Eo=class{questionId=null;optionId=null;correct=null;correctOptionId=null};var Ro=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 So=class{classicQuizId=null;classicQuizModel=null;correct=null;classicQuizQuestions=null;personalBest=null;points=null;answers=[]};var Up=class{meta=new w;data=[]};var Co=class{questionId=null;questionModel=null;wrong=null;correct=null;skipped=null;total=null};var Be=class{classicQuizIds=null};var Ne=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 Fo=class extends Ne{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 ke=class{pagination=new z;filters=new Be};var vo=class{position=null;profileId=null;profileModel=null;points=null};var Ao=class{position=null;classicQuizId=null;classicQuizModel=null;points=null};var Vp=class{meta=new D;data=[]};var Hp=class{meta=new ke;data=[]};var Ge=class{id="";title="";alternativeTitle="";description="";images=new K;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 Oo=class extends De{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 Lo=class extends Ge{rules=""};var xo=class{correctSteps=0;score=0};var $p=class{meta=new w;data=[]};var Do=class{eitherOrId="";personalBest=0;betterThan=0};var Bo=class{instanceId="";eitherOrId="";gameStartedAt="";currentStep=0;currentStreak=0;remainingSteps=0;currentLives=0;currentPoints=0;personalBest=0;participationCount=0;finishedParticipationsCount=0;steps=[]};var No=class{pair="";answer=""};var ko=class extends No{expired=!1;time=0};var Go=class{main;mobile};var Mi=class{id="";label="";images=new Go;value=null};var Uo=class{pairId="";userSelection="";correct=null;played=null;timestamp="";optionOne=new Mi;optionTwo=new Mi};var Vo=class{rangeStartInclusive=0;rangeEndInclusive=0;totalUsers=0};var Ho=class{standings=[];breakdown=[]};var $o=class{userId="";userModel=null;personalBest=""};var Ue=class{content=null;tags=[];campaign=null};var Ve=class{id=null;model=null;source=null;type=null};var qo=class{questions=null;correctAnswers=null};var Wo=class{id=null;name=null;url=null;assets=[];links=[];branding=null;eventUrls=[];stakesDisclaimer=null;domainName=null};var zo=class{backgroundColor=null;textColor=null};var qp=class{appType=null;selectionTemplateUrl=null;eventTemplateUrl=null;homepageUrl=null};var Qo=class{logo=null;type=null;transparentBackgroundUrl=null;backgroundColor=null};var Ko=class{url=null;appType=null};var fc=(i=>(i.PRE_EVENT="PRE_EVENT",i.LIVE="LIVE",i.ALL="ALL",i))(fc||{}),gc=(e=>(e.ORDINARY_TIME="ORDINARY_TIME",e.FULL_TIME="FULL_TIME",e))(gc||{}),yc=(i=>(i.DECIMAL="DECIMAL",i.MONEYLINE="MONEYLINE",i.FRACTIONAL="FRACTIONAL",i))(yc||{});var bc=(L=>(L.FT_1X2="FT_1X2",L.DOUBLE_CHANCE="DOUBLE_CHANCE",L.HT_FT="HT_FT",L.BOTH_TEAMS_SCORE="BOTH_TEAMS_SCORE",L.CORRECT_SCORE="CORRECT_SCORE",L.PLAYER_SCORE_FIRST_GOAL="PLAYER_SCORE_FIRST_GOAL",L.PLAYER_SCORE="PLAYER_SCORE",L.PLAYER_RED_CARD="PLAYER_RED_CARD",L.PLAYER_YELLOW_CARD="PLAYER_YELLOW_CARD",L.OVER_GOALS_0_5="OVER_GOALS_0_5",L.OVER_GOALS_1_5="OVER_GOALS_1_5",L.OVER_GOALS_2_5="OVER_GOALS_2_5",L.OVER_GOALS_3_5="OVER_GOALS_3_5",L.OVER_GOALS_4_5="OVER_GOALS_4_5",L.OVER_GOALS_5_5="OVER_GOALS_5_5",L))(bc||{}),Ld={["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"},jo=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(fc),i=Object.values(gc),a=Object.values(yc),r=Object.values(bc);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":Ld[t]}};var Yo=class{type=null;scope=null;selections=[]};var Xo=class{id=null;type=null;name=null;entityType=null};var Jo=class{id=null;name=null;code=null;value=null;odds=null;urls=[];movement=null;oddsOld=null;entityType=null;additionalInfo=null;providerInfo=null};var Zo=class{id=null;name=null;code=null;entityType=null};var ts=class{selectionId=null;eventId=null;marketId=null;competitionId=null};var es=class{bookmaker=null;type=null;markets=[]};var Wp=class{main=null;all=null};var is=class{value=null;playerId=null;playerModel=null;playerRole};var He=class{market=null;matchId=null;matchType=null;matchModel=null;prediction=new is;result=null};var $e=class{settledAt=null;resettledAt=null;status=null;outcome=null;points=0};var at=class{value=!1};var as=class{matchId=null;market="BOTH_TEAMS_SCORE";matchType="FOOTBALL";prediction=null;constructor(t,e){this.matchId=t,this.prediction=new at,this.prediction.value=e}};var rs=class{value};var os=class{matchId=null;market="CORNERS_MATCH";matchType="FOOTBALL";prediction=null;constructor(t,e){this.matchId=t,this.prediction=new rs,this.prediction.value=e}};var ss=class{value=null};var xt=class{matchId=null;market=null;matchType="FOOTBALL";prediction=null;constructor(t,e,i){this.matchId=t,this.market=e,this.prediction=new ss,this.prediction.value=i}};var ns=class{value=null};var ls=class{matchId=null;market="DOUBLE_CHANCE";matchType="FOOTBALL";prediction=null;constructor(t,e){this.matchId=t,this.prediction=new ns,this.prediction.value=e}};var ps=class{value=null};var cs=class{matchId=null;market="HT_FT";matchType="FOOTBALL";prediction=null;constructor(t,e){this.matchId=t,this.prediction=new ps,this.prediction.value=e}};var ds=class{value=null};var us=class{matchId=null;market=null;matchType="FOOTBALL";prediction=null;constructor(t,e,i){this.matchId=t,this.market=e,this.prediction=new ds,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 at,this.prediction.value=i}};var We=class{matchId=null;market=null;matchType="FOOTBALL";prediction=null;constructor(t,e,i){this.matchId=t,this.market=e,this.prediction=new at,this.prediction.value=i}};var ms=class{matchId=null;market="PENALTY_MATCH";matchType="FOOTBALL";prediction=null;constructor(t,e){this.matchId=t,this.prediction=new at,this.prediction.value=e}};var hs=class{value=!1;playerId=null};var rt=class{matchId=null;market=null;matchType="FOOTBALL";prediction=null;constructor(t,e,i,a){this.matchId=t,this.market=e,this.prediction=new hs,this.prediction.value=i,this.prediction.playerId=a}};var fs=class{matchId=null;market="RED_CARD_MATCH";matchType="FOOTBALL";prediction=null;constructor(t,e){this.matchId=t,this.prediction=new at,this.prediction.value=e}};var zp=class{home=null;draw=null;away=null};var Qp=class{score=null;percentage=null};var ze=class{homeGoals=null;awayGoals=null};var gs=class{playerId=null;playerModel=null};var ys=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 gs;PLAYER_SCORE=[];PLAYER_SCORE_TWICE=[];PLAYER_SCORE_HATTRICK=[];CORRECT_SCORE=new ze;CORRECT_SCORE_ADVANCED=new ze;CORRECT_SCORE_HT=new ze;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 O=class{no=0;yes=0};var Qe=class{gameInstanceId=null;fixtures=null};var ht=class{goldenGoal=null};var Ii=class{id=null;gameInstanceId=null;gameType=null;wager=null;totalFixtures=null;settledFixtures=null;userId=null;fixtures=[];status=null;tiebreaker=new ht;points=null;templateId=null;groupId=null;profileLastUpdatedAt=null;createdAt=null;updatedAt=null};var On=(r=>(r.ACTIVE="ACTIVE",r.WON="WON",r.LOST="LOST",r.PARTIALLY_WON="PARTIALLY_WON",r.CANCELED="CANCELED",r))(On||{}),Mc=["WON","LOST","PARTIALLY_WON","CANCELED"];var G=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(On).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 bs=class{fullTimeOneXTwo={};halfTimeOneXTwo={};bothTeamsScore=new O;doubleChance={};halfTimeFullTime={};playerScore={};playerYellowCard={};playerRedCard={};redCardMatch=new O;penaltyMatch=new O;playerScoreFirstGoal={};cornersMatch={};correctScore={};correctScoreHalfTime={};correctScoreAdvanced={};playerScoreHattrick={};playerScoreTwice={};overZeroPointFiveGoals=new O;overOnePointFiveGoals=new O;overTwoPointFiveGoals=new O;overThreePointFiveGoals=new O;overFourPointFiveGoals=new O;overFivePointFiveGoals=new O;overSixPointFiveGoals=new O;overSixPointFiveCorners=new O;overSevenPointFiveCorners=new O;overEightPointFiveCorners=new O;overNinePointFiveCorners=new O;overTenPointFiveCorners=new O;overElevenPointFiveCorners=new O;overTwelvePointFiveCorners=new O;overThirteenPointFiveCorners=new O};var Ms=class{matchId=null;matchType=null;predictions=null};var Is=class{profileId="";profileModel=null;leagueId="";leagueModel=null;message=""};var Kp=class{id=null;name=null;model=new Lt};var Ke=class{id="";name="";description="";type="";banned=[];invites=[];administrators=[];membersCount=0;invitationCode="";templateId="";templateModel=null;pastTemplates=[];usersCanInviteUsers=!1;scoringStartsAt="";pinnedPosts=[]};var ws=class extends Ke{members=[]};var jp=class{name="";description="";invitationCode="";templateId="";usersCanInviteUsers=!1;administrators=[];scoringStartsAt=""};var Yp=class{name="";description="";invitationCode="";templateId="";usersCanInviteUsers=!1;administrators=[];pinnedPosts=[];scoringStartsAt=""};var _s=class{predictionId=null;predictionModel=null;profileId=null;profileModel=null};var Xp=class{meta=new D;data=[]};var Jp=class{meta=new w;data=[]};var je=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 Ps=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 Ts=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 Ye=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 Xe=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 Es=class{templateId="";templateModel=null;privateLeagueId="";privateLeagueModel=null;position="";points=0;type="private_league"};var Rs=class extends Ee{type="PRIVATE"};var Ss=class extends Re{type="PRIVATE"};var Cs=class{id="";source="";type="";favourite=!1};var Fs=class extends Cs{model=null};var Zp=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 vs=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(Ft).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 As=class extends P{};var Os=class{matchId=null;matchType=null;market=null;matchModel=null;matchStatus=new it};var Ls=class{value=null;result=null};var xs=class{matchId=null;matchType=null;market=null;matchModel=null;matchStatus=new it;prediction=new Ls};var wt=class{id=null;title=null;description=null;type=null;status=null;authRequirement=null;scheduleOpenAt=null;predictionsCutoff=null;fixtures=[];tiebreaker=new mt;participantsCount=0;related=[];excludedProfileIds=null;rules=null;labels=null;customFields=null;branding=null;flags=null;images=new K;createdAt=null;updatedAt=null};var Je=class extends wt{adContent=null};var Ht=class{userId=null;points=null;results=[];tiebreaker=null};var Ds=class{matchId=null;matchModel=null;outcome=null};var ot=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(Ft).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 Dt=class{id=null;title=null;description=null;type=null;status=null;authRequirement=null;outcome=null;predictionsCutoff=null;fixtures=[];tiebreaker=new mt;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 ht;branding=null};var Bs=class{contestId="";contestType="GAME";contestModel=null;description="";userList=[]};var Ns=class{position="";profileId="";profileModel=null;note="";tags=[]};var Ze=class{gameInstanceId=null;fixtures=[];tiebreaker=null;constructor(t){this.gameInstanceId=t.gameInstanceId,t.fixtures.forEach(e=>this.fixtures.push(new xt(e.matchId,e.market,e.prediction.value))),this.tiebreaker=t.tiebreaker?t.tiebreaker:null}};var ti=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 ei=class{id=null;title=null;alternativeTitle=null;description=null;type=null;images=new K;status=null;language=null;authRequirement=null;totalVotes=null;flags=[];customFields=null;branding=null;embedCode=null;labels=null;adContent=null;context=null;options=[];related=[];createdAt=null;updatedAt=null};var ks=class extends ei{rules=null};var Gs=class{id=null;title=null;description=null;images=new K;votes=null;embedCode=null};var ii=class{id=null;pollId=null;optionId=null;userId=null};var Us=class extends ii{pollModel=null;optionModel=null};var Vs=class{meta=new w;data=[]};var Hs=class{meta=new w;data=[]};var $s=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 qs=class{meta=new w;data=[]};var Ws=class{matchId=null;matchModel=null;playerId=null;playerModel=null;createdAt=null};var zs=class{total};var Qs=class{meta=new zs;data=[]};var Ks=class{teamId=null;teamModel=null;playerId=null;playerModel=null;votes=null;winner=null};var js=class{meta=new D;data=[]};var Ln=class{remapListContent=t=>{let e=new js;return e.meta=this.remapMeta(t.meta),e.data=t.data.map(i=>{let a=new Xa;return a.entityId=i.entity_id,a.entityType=i.entity_type,a}),e};remapMeta=t=>{let e=new D;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 $=class extends C{featureConfigRemapper=null;listContentRemapper=null;localStorage=null;clientId=null;constructor(t){super(t,F(t.environment,"client")),this.clientId=t.clientId,this.localStorage=new lt().createLocalCacheInstance(t.idSchema),this.featureConfigRemapper=new An,this.listContentRemapper=new Ln}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 _t=class{clientHttps=null;errorHandlingMode=null;constructor(t){this.clientHttps=new $(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 D;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 xn=class{footballService=null;https=null;idMapping=null;constructor(t,e,i){this.idMapping=i,this.https=e,this.footballService=new _t(t)}getTeamsIdMapping=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.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 yi({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 $t=class{https=null;footballService=null;idMapping=null;constructor(t,e,i){this.idMapping=i,this.https=e,this.footballService=new _t(t)}getPlayersIdMapping=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.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 bi({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=te(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 qt=class{https=null;idMapping=null;footballService=null;constructor(t,e,i){this.https=e,this.idMapping=i,this.footballService=new _t(t)}getMatchesIdMapping=async(t,e)=>{try{if(t){if(t=new At(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 At({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=te(t);i.sort((r,o)=>r.localeCompare(o));let a=await this.getMatchesWithNativeIds(Array.from(i));if(i.length!==a.length){let r=new At({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 Dn=class{https=null;idMapping=null;constructor(t,e){this.https=t,this.idMapping=e}searchIdMapping=async(t,e)=>{try{if(t=new Qr(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 Y=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 Bn=class extends Y{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 wi=class{countriesFacade=null;competitionsFacade=null;teamsFacade=null;playerFacade=null;matchFacade=null;searchFacade=null;validator=null;constructor(t,e,i,a){this.countriesFacade=new Fn(e,i,a),this.competitionsFacade=new vn(e,i,a),this.teamsFacade=new xn(t,i,a),this.playerFacade=new $t(t,i,a),this.matchFacade=new qt(t,i,a),this.searchFacade=new Dn(i,a),this.validator=new Bn(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 H=class{countriesFromResponse=t=>{if(t)return t.map(e=>this.countryFromResponse(e))};countryFromResponse=t=>{try{if(t){let e=new Ar;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 X=class{countryRemapper=null;constructor(){this.countryRemapper=new H}fromResponse(t){try{let e=new Fr;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 W=class{countryRemapper=null;constructor(){this.countryRemapper=new H}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.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 Nn=class{countryRemapper=null;teamBasicRemapper=null;constructor(){this.countryRemapper=new H,this.teamBasicRemapper=new W}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.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 kn=class{countryRemapper=null;constructor(){this.countryRemapper=new H}fromResponse(t){try{let e=new Ur;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 Gn=class{countryRemapper=null;competitionRemapper=null;playerRemapper=null;constructor(){this.countryRemapper=new H,this.competitionRemapper=new X,this.playerRemapper=new kn}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.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 _i=class{fromResponse(t){try{let e=new Dr;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 Un=class{teamRemapper=null;competitionRemapper=null;scoresRemapper=null;constructor(){this.teamRemapper=new W,this.competitionRemapper=new X,this.scoresRemapper=new _i}fromResponse(t){try{let e=new Or;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 Vn=class{fromResponse(t){try{let e=new xr;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 Pi=class{fromResponse(t){try{let e=new Hr;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 Hn=class{playerRemapper=null;constructor(){this.playerRemapper=new Pi}fromResponse(t){try{let e=new Ae;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 $n=class{playerRemapper=null;constructor(){this.playerRemapper=new Pi}fromResponse(t){try{let e=new Br;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 qn=class{fromResponse(t){try{let e=new Nr;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 Wn=class{teamMapper=null;competitionsMapper=null;lineupsMapper=null;scoresMapper=null;statsMapper=null;timelineMapper=null;playerStatsMapper=null;constructor(){this.teamMapper=new W,this.competitionsMapper=new X,this.lineupsMapper=new Hn,this.scoresMapper=new _i,this.statsMapper=new Vn,this.timelineMapper=new $n,this.playerStatsMapper=new qn}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=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 Ae,e}catch(e){throw console.warn("There was a problem remapping the match response",e),e}}};var zn=class{countryRemapper=null;constructor(){this.countryRemapper=new H}fromResponse(t){try{let e=new Vr;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 Ti=class{countryRemapper=null;teamRemapper=null;constructor(){this.countryRemapper=new H,this.teamRemapper=new W}fromResponse(t){try{let e=new kr;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 Qn=class{countryRemapper=null;teamRemapper=null;competitionRemapper=null;constructor(){this.countryRemapper=new H,this.teamRemapper=new W,this.competitionRemapper=new X}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.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 Kn=class{teamRemapper=null;playerRemapper=null;competitionremapper=null;constructor(){this.teamRemapper=new W,this.playerRemapper=new Ti,this.competitionremapper=new X}fromResponse(t){try{let e=new zr;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 jn=class{remapMetaProp=t=>{let e=new D;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 Yn=class{remapPlayersPoints=t=>{let e=new Rr;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 _r;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 Sr;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 Fe;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 ve;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 pt=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,F(t.environment,"football")),this.apiSignInUrl=t.lang!=="en"?this.apiSignInUrl+`&lang=${t.lang}`:this.apiSignInUrl,this.countryRemapper=new H,this.competitionBasicRemapper=new X,this.competitionFullRemapper=new Nn,this.teamBasicRemapper=new W,this.teamFullRemapper=new Gn,this.matchBasicRemapper=new Un,this.matchFullRemapper=new Wn,this.playerBasicRemapper=new Ti,this.playerFullRemapper=new Qn,this.topPlayerRemapper=new zn,this.searchRemapper=new Kn,this.footballMetaRemapper=new jn,this.footballService=new _t(t),this.fantasyRemapper=new Yn}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=oi(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=oi(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 Vt,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=oi(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 Vt;return l.data=n,l}else{let r=new Vt,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 Vt,a="There was a problem with football matches request";if(t&&t.matchIds&&t.matchIds.length>this.limitIds){let r=[],o=oi(t.matchIds,this.limitIds);for(let l of o){t.matchIds=l,t.limit=l.length;let p=!0,c=`/matches${this.apiSignInUrl}${t.constructFilterUrl(p)}&limit=${l.length}`;e&&(c+=f());let d=await this.fetchWithoutAuth(c,a);r.push(d.data.map(u=>this.matchBasicRemapper.fromResponse(u)))}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 Xn=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 Fs;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 Jn=class{idMapping=null;profileOperations=null;constructor(t,e){this.idMapping=new E(t),this.profileOperations=new Xn(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 U=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 mi(t),this.activityHttps=new ni(t),this.footballHttps=new pt(t),this.idMapping=new E(t),this.localCache=new lt().createLocalCacheInstance(t.idSchema),this.footballFacade=new wi(t,this.localCache,this.footballHttps,this.idMapping),this.profileFacade=new Mt(this.localCache,this.profileHttps,this.activityHttps,t.errorHandlingMode),this.idsRemapper=new Jn(t,this.footballFacade),this.ownProfileBuilder=new Cn(t,this.idsRemapper,this.localCache,this.profileHttps,this.activityHttps),this.profileBuilder=new fi(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)};var Zn=class extends P{};var ed=(r=>(r.LIKE="like",r.DISLIKE="dislike",r.SHARE="share",r.COMMENT="comment",r.PREDICTION_MADE="prediction_made",r))(ed||{});var id=(a=>(a.CORRECT="CORRECT",a.INCORRECT="INCORRECT",a.PARTIALLY_CORRECT="PARTIALLY_CORRECT",a.NOT_VERIFIED="NOT_VERIFIED",a))(id||{});var tl=(i=>(i.ONE="1",i.X="x",i.TWO="2",i))(tl||{}),el=(i=>(i.ONE_X="1x",i.X_TWO="x2",i.ONE_TWO="12",i))(el||{}),il=(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))(il||{});var al=class extends Y{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 tr);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 rl=class{https=null;validator=null;profile=null;constructor(t){this.https=new di(t),this.profile=new U(t),this.validator=new al(t.errorHandlingMode)}getGames=async(t,e)=>(t&&(t=new er(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 Za(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 Zn(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 ol=class{facade=null;constructor(t){this.facade=new rl(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 sl=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 Ot;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 Oe;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 Le;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 mo;return e.groupId=t.group_id,e.averagePoints=t.average_points,e.highestPoints=t.highest_points,e}};var nl=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 D;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 uo;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 Es;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 nr;a.templateId=i.template_id,a.challengeId=i.private_league_id,a.position=i.position,a.points=i.points,e.push(a)}),e}};var ll=class{entityId=null;entityType=null};var ct=class{remapBranding=t=>{let e=new Kr;return t.colors&&(e.colors=new jr,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 Yr,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 Xr,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 pl=class extends ct{remapResponse=t=>{let e=[];return t.forEach(i=>{let a=new Lt;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 ho;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 co;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 ll;return i.entityId=e.entity_id,i.entityType=e.entity_type,i});remapGroups=t=>t.map(e=>{let i=new fo;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 go;return e.fromDate=t.from_date,e.toDate=t.to_date,e.matchIds=t.match_ids,e}};var cl=class{remapHighestSuccessRate=t=>t.map(e=>{let i=new lo;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 Pt=class extends C{templateRemapper=null;leaderboardRemapper=null;rankingsRemapper=null;highestSuccessRateRemapper=null;constructor(t){super(t,F(t.environment,"loyalty")),this.templateRemapper=new pl,this.leaderboardRemapper=new sl,this.rankingsRemapper=new nl,this.highestSuccessRateRemapper=new cl}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 dl=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 ws;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 Ke;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 Is;return e.profileId=t.profile_id,e.leagueId=t.league_id,e.message=t.message,e};remapToAcceptChallenge=t=>{let e=new ir;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 D;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 _s;return i.predictionId=e.prediction_id,i.profileId=e.profile_id,i})};var Ei=class{remapToDiscussions=t=>(t.meta=this.remapToMeta(t.meta),t.data=t.data.map(e=>this.remapToDiscussionById(e)),t);remapToDiscussionById=t=>{let e=new lr;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 ur,a=new mr;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 hr;return e.meta=this.remapToMeta(t.meta),e.data=t.data.map(i=>this.remapToPostByIdBasic(i)),e};remapToPostMeta=t=>{let e=new vt;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 Se;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 pr;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 dr;return i.id=e.id,i.postsCount=e.posts_count,i});remapReactionsPost=t=>{let e=new fr;return e.type=t.type,e.userIds=t.user_ids,e.reactionCount=t.reaction_count,e};remapVersionsPost=t=>{let e=new yr;return e.content=t.content,e.updatedAt=t.updated_at,e};remapReportPost=t=>{let e=new gr;return e.userId=t.user_id,e.reason=t.reason,e.reasonDetails=t.reason_details,e}};var Ri=class extends C{remapper=null;discussionsRemapper=null;discussionsBaseURL=null;constructor(t){super(t,F(t.environment,"privateLeagues")),this.discussionsBaseURL=F(t.environment,"discussions"),this.remapper=new dl,this.discussionsRemapper=new Ei}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 Si=class{createRequestBodyFromParam=(t,e)=>{let i=e==="PRIVATE"?new Rs:new ar;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 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,i.administrators=t.administrators,i.pinned_posts=t.pinnedPosts,i.scoring_starts_at=t.scoringStartsAt,i}};var J=class{https=null;idMapping=null;localCache=null;footballFacade=null;constructor(t){this.https=new pt(t),this.idMapping=new E(t),this.localCache=new lt().createLocalCacheInstance(t.idSchema),this.footballFacade=new wi(t,this.localCache,this.https,this.idMapping)}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)};var ul=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 rt)e.market=t.market,e.prediction=t.prediction.value,e.player_id=t.prediction.playerId;else if(t instanceof qe||t instanceof We)e.market=t.market,e.prediction=t.prediction.value;else if(t instanceof xt){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 He;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 $e;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 tc=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}}},Tt=tc;Z(Tt,"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"),Z(Tt,"createDoubleChanceResult",t=>t?.ftScore?.homeGoals>t?.ftScore?.awayGoals?["1x","12"]:t?.ftScore?.homeGoals===t?.ftScore?.awayGoals?["1x","x2"]:["x2","12"]),Z(Tt,"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"}}),Z(Tt,"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))),Z(Tt,"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 tc.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])}),tc.transformPlayerMarketResult(o)}),Z(Tt,"transformPlayerMarketResult",t=>t.map(e=>({playerId:e.id,playerModel:e})));var Et=class{footballHttps=null;idMapping=null;matchFacade=null;playerFacade=null;profileNamespace=null;constructor(t,e){this.footballHttps=new pt(t),this.idMapping=e,this.matchFacade=new qt(t,this.footballHttps,e),this.playerFacade=new $t(t,this.footballHttps,e),this.profileNamespace=new U(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=te(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=Sc.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(gt.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 O,r[a][n]):r[a][i]}else if(gt.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 Me){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 be||t instanceof ye){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 wt||a instanceof Dt||a instanceof It||a instanceof Je?(a.fixtures.forEach(r=>e.push(r.matchId)),a instanceof It&&a.fixtures.forEach(r=>{r.prediction.playerId&&r.prediction.playerId!=="OWN_GOAL"&&i.push(r.prediction.playerId)})):a instanceof Ht&&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 wt||n instanceof Dt||n instanceof It?(n.fixtures.forEach(l=>{this.handleMatchModel(r,l),n instanceof It&&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 Ht&&(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 G(i),i};initGameFilters=(t,e,i)=>{if(e&&i)return e.type=t,e.gameIds=i,e=new ot(e),e;if(e&&!i)return e.type=t,e=new ot(e),e;if(!e&&i){let a={type:t,gameIds:i};return a=new ot(a),a}else{let a={type:t};return a=new ot(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 Dt&&(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 $e;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 G(t));break;case"current":if(t)this.deleteUnexpectedProperties(t),t.status=["ACTIVE"],t=new G(t);else{let a={status:["ACTIVE"]};t=new G(a)}break;case"past":if(t)this.deleteUnexpectedProperties(t),t.status=Mc,t=new G(t);else{let a={status:Mc};t=new G(a)}break;case"matches":if(t)this.deleteUnexpectedProperties(t),t.matchIds=i,t=new G(t);else{let a={matchIds:i};t=new G(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=>gt.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[B[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[B[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 ys;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)),Tt.createMatchMarketsResultsModel(e,a)}};var Ci=class{fixturesRemapper=null;footballHttps=null;matchFacade=null;playerFacade=null;predictorService=null;constructor(t,e){this.footballHttps=new pt(t),this.matchFacade=new qt(t,this.footballHttps,e),this.playerFacade=new $t(t,this.footballHttps,e),this.predictorService=new Et(t,e),this.fixturesRemapper=new ul(this.matchFacade,this.playerFacade,this.predictorService)}remapRequestBody=t=>{if(t instanceof Ce)return t;let e={};return e.game_instance_id=t.gameInstanceId,e.fixtures=t.fixtures.map(i=>this.fixturesRemapper.remapFixturesRequest(i)),t instanceof Ze&&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 Ii,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 He;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 Ii;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 bs;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 ml=class{remapPredictions=null;constructor(t,e){this.remapPredictions=new Ci(t,e)}remapResponse=t=>{let e=new Ms;return e.matchId=t.match_id,e.matchType=t.match_type,e.predictions=this.remapPredictions.remapPredictionModel(t.predictions),e}};var hl=class extends ct{remapPaginatedGames=t=>{let e=new V;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 wt;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 Je;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 Os;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 V;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 Dt;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 xs;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 V;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 It;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 bo;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 V;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 Ht;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 Mo;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 Bs;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 Ns;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 it;return t&&(e.type=t.type,e.subType=t.sub_type),e};remapMarketResult=(t,e)=>{if(Ec.includes(t))return e[0];if(gt.includes(t))return e;if(e[0]==="true")return!0;if(e[0]==="false")return!1};deleteUnusefulField=t=>((!gt.includes(t.market)||this.isPlayerMarketWithNoResult(t.market,t.result))&&delete t.playerModels,t);isPlayerMarketWithNoResult=(t,e)=>gt.includes(t)&&e.length===0;remapResults=t=>{let e=new Ds;return e.matchId=t.match_id,e.outcome=t.outcome,e};remapTiebreaker=t=>{let e=new ht;return e.goldenGoal=t.golden_goal,e};remapTimeTiebreaker=t=>{let e=new mt;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 fl=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 dt=class extends C{predictionRemapper=null;matchSummaryRemapper=null;gamesRemapper=null;metaRemapper=null;constructor(t,e){super(t,F(t.environment,"predictor")),this.predictionRemapper=new Ci(t,e),this.matchSummaryRemapper=new ml(t,e),this.gamesRemapper=new hl,this.metaRemapper=new fl}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 V,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 V,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)};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 V,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 Wt=class{errorHandlingMode=null;constructor(t){this.errorHandlingMode=t}validateBodyFields=(t,e)=>{let i=Object.keys(e),a=Object.keys(new Qe);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(tl),o=Object.values(il),n=Object.values(el);if(e==="FT_1X2"||e==="HT_1X2"){if(r.includes(i))return new us(t,e,i)}else if(e==="HT_FT"){if(o.includes(i))return new cs(t,i)}else if(e==="DOUBLE_CHANCE"){if(n.includes(i))return new ls(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 xt(t,e,i)}else if(e==="CORNERS_MATCH"){if(typeof i=="number")return new os(t,i)}else if(e==="BOTH_TEAMS_SCORE"){if(this.isPredictionBoolean(i))return new as(t,i)}else if(e==="RED_CARD_MATCH"){if(this.isPredictionBoolean(i))return new fs(t,i)}else if(e==="PENALTY_MATCH"){if(this.isPredictionBoolean(i))return new ms(t,i)}else if(gt.includes(e)){let l="OWN_GOAL";if(this.validatePlayerId(e,a),e===Vi&&this.isPredictionBoolean(i)){let p=a&&a===l?l:a;return new rt(t,e,i,p)}if(a&&this.isPredictionBoolean(i))return new rt(t,e,i,a)}else if(Pc.includes(e)){if(this.isPredictionBoolean(i))return new We(t,e,i)}else if(Tc.includes(e)&&this.isPredictionBoolean(i))return new qe(t,e,i);this.throwInvalidPredictionException(i,e)};validateFixtureFields=t=>{let e=Object.keys(t);e.forEach(a=>{nc.includes(a)||this.throwInvalidParamException([a])});let i=nc.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 ht)[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){gt.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!==Vi&&(e||this.throwInvalidParamException([i]),typeof e!="string"&&this.throwInvalidType(i,"string"))};validateMarket=t=>{Object.values(tt).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=Cc(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=Fc(t):i=up(t),this.errorHandlingMode==="default"?new y(400,"INVALID_MARKET",i):new m(400,"INVALID_TYPE",i)};throwInvalidParamException=t=>{let e=vc(t);throw this.errorHandlingMode==="default"?new y(400,"INVALID_FIELD",e):new m(400,"INVALID_TYPE",e)};throwMissingFieldsException=(t,e)=>{let i=Ac(t,e);throw this.errorHandlingMode==="default"?new y(400,"INVALID_FIELD",i):new m(400,"INVALID_TYPE",i)};throwInvalidType=(t,e)=>{let i=Oc(t,e);throw this.errorHandlingMode==="default"?new y(400,"INVALID_TYPE",i):new m(400,"INVALID_TYPE",i)}};var Fi=class{predictorHttps=null;predictorService=null;idMapping=null;clientHttps=null;predictorValidator=null;errorHandlingMode=null;constructor(t){this.predictorValidator=new Wt(t.errorHandlingMode),this.idMapping=new E(t),this.predictorHttps=new dt(t,this.idMapping),this.predictorService=new Et(t,this.idMapping),this.clientHttps=new $(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 rt&&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 rt&&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)};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 G(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 ot(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 V};getMyGamePrediction=async t=>{let e=new G({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 V};getUserGamePrediction=async(t,e,i)=>{i=i||!1;let a=new G({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 gl=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 zt=class{matchQuizFacade=null;helpers=new gl;constructor(t){this.matchQuizFacade=new Fi(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 yl=class extends ct{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 wo;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 To;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 So;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 bt;return e.itemsPerPage=t.items_per_page,e.nextPageStartsAfter=t.next_page_starts_after,e};remapClassicQuizLeaderboardMeta=t=>{let e=new ke;return e.pagination=this.remapMetaPaginationRank(t.pagination),e.filters=this.remapLeaderboardMetaFilters(t.filters),e};remapMetaPaginationRank=t=>{let e=new z;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 Be;return e.classicQuizIds=t?.classic_quiz_ids||null,e};remapClassicQuizUserRanking=t=>{let e=new Ao;return e.position=t.position,e.classicQuizId=t.classic_quiz_id,e.points=t.points,e};remapBasicClassicQuiz=t=>{let e=new xe;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 _o;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 Po;return e.optionId=t.option_id,e.option=t.option,e.images=t.images,e.correct=t.correct,e};remapParticipationQuestions=t=>{let e=new Eo;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 vo;return e.position=t.position,e.profileId=t.profile_id,e.points=t.points,e};remapContext=t=>{let e=new Ue;return e.content=t.content,e.tags=t.tags?t.tags.map(i=>{let a=new Ve;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 bl=class extends ct{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 Lo;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 Do;return e.eitherOrId=t.either_or_id,e.personalBest=t.personal_best,e.betterThan=t.better_than,e};remapEitherOrResults=t=>{let e=new Ho;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 Bo;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 Ge;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 bt;return e.itemsPerPage=t.items_per_page,e.nextPageStartsAfter=t.next_page_starts_after,e};remapPoints=t=>{let e=new xo;return e.correctSteps=t.correct_steps,e.score=t.score,e};remapResultsStandings=t=>{let e=new $o;return e.userId=t.user_id,e.personalBest=t.personal_best,e};remapResultsBreakdown=t=>{let e=new Vo;return e.rangeStartInclusive=t.range_start_inclusive,e.rangeEndInclusive=t.range_end_inclusive,e.totalUsers=t.total_users,e};remapParticipationSteps=t=>{let e=new Uo;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 Ue;return e.content=t.content,e.tags=t.tags?t.tags.map(i=>{let a=new Ve;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 vi=class extends C{classicQuizRemapper=null;eitherOrRemapper=null;constructor(t){super(t,F(t.environment,"miniGames")),this.classicQuizRemapper=new yl,this.eitherOrRemapper=new bl}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 Qt=class extends Y{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 Ml=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 E(t),this.validator=new Qt(t),this.profile=new U(t),this.football=new J(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 ko;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 Il=class{https=null;service=null;activityService=null;idSchema=null;constructor(t){this.https=new vi(t),this.service=new Ml(t),this.activityService=new yt(t),this.idSchema=t.idSchema}getClassicQuizzes=async(t,e,i)=>{t&&(t=new Io(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 Ro(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 Fo(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 Ne(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 Oo(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 Kt=class{facade=null;constructor(t){this.facade=new Il(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 Ai=class{idMapping=null;predictorHttps=null;predictorService=null;predictorValidator=null;clientHttps=null;errorHandlingMode=null;constructor(t,e){this.idMapping=e,this.errorHandlingMode=t.errorHandlingMode,this.predictorValidator=new Wt(t.errorHandlingMode),this.predictorHttps=new dt(t,e),this.predictorService=new Et(t,e),this.clientHttps=new $(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)};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 G(e)),await this.predictorHttps.getGamePredictions(t,i,e));getGameResults=async(t,e,i)=>{i=i||!1,e&&(e=new ot(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 ot(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 Ze(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 V};getMyGamePrediction=async t=>{let e=new G({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 V};getUserGamePrediction=async(t,e,i)=>{i=i||!1;let a=new G({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 wl=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 jt=class{topXFacade=null;idMapping=null;helpers=new wl;constructor(t){this.idMapping=new E(t),this.topXFacade=new Ai(t,this.idMapping)}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 _l=class{idMappingService=null;profileNamespace=null;footballNamespace=null;topXNamespace=null;matchQuizNamespace=null;miniGamesNamespace=null;errorHandlingMode=null;constructor(t){this.idMappingService=new E(t),this.profileNamespace=new U(t),this.footballNamespace=new J(t),this.topXNamespace=new jt(t),this.matchQuizNamespace=new zt(t),this.miniGamesNamespace=new Kt(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 eo;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 io;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 oo(t));break;case"rankings":t&&(t=new so(t));break;case"league_leaderboard":t&&(t=new ro(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};initMatchFiltersForTemplates=(t,e)=>{let i=[],a=[],r=[],o=this.reformatDate(t.fromDate),n=this.reformatDate(t.toDate,!0),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)),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=this.reformatDate(c.filters.fromDate),n=this.reformatDate(c.filters.toDate,!0);let d=c.filters.matchIds.every(u=>u);c.filters.matchIds.length>0&&d&&(r=Array.from(c.filters.matchIds))}return new At({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.topXNamespace.getGames({gameIds:t});r=[...r,...o.data]}if(e.length){let o=await this.matchQuizNamespace.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 Pl=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(tt).includes(t)){let a=up(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 Tl=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 El=class{config=null;clientHttps=null;loyaltyHttps=null;loyaltyService=null;profileFacade=null;loyaltyValidator=null;idMapping=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 Mt(r,a),this.loyaltyService=new _l(this.config),this.loyaltyValidator=new Pl,this.idMapping=new E(t),this.topXFacade=new Ai(t,this.idMapping),this.matchQuizFacade=new Fi(t),this.predictorHttps=new dt(t,this.idMapping),this.errorHandlingMode=t.errorHandlingMode,this.football=new J(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 no(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 Tl(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 ao(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.groups||a.groups.length===0))return[];let r=this.loyaltyService.initMatchFiltersForTemplates(a,e);return(await this.football.getMatches(r,i)).data}};var Yt=class{clientHttps=null;profileHttps=null;loyaltyHttps=null;loyaltyFacade=null;localCache=null;constructor(t){this.clientHttps=new $(t),this.profileHttps=new mi(t),this.loyaltyHttps=new Pt(t),this.localCache=new lt().createLocalCacheInstance(t.idSchema),this.loyaltyFacade=new El(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 Rl=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 Wt(t.errorHandlingMode),this.predictorService=new Et(t,a)}makeFootballPrediction=async(t,e,i,a)=>{let r=this.predictorValidator.validateFixture(t,e,i,a),o=new Qe;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 rt&&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!==Vi&&!r.prediction.playerId)throw new y(400,"INVALID_FIELD","Player id is invalid!").errorMessage();if(this.errorHandlingMode==="standard"&&r.market!==Vi&&!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 Sl=class extends Y{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 Cl=class{validator=null;constructor(t){this.validator=new Sl(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 Oi=class{predictorHttps=null;clientHttps=null;predictorFacade=null;idMapping=null;helpers=null;constructor(t){this.idMapping=new E(t),this.predictorHttps=new dt(t,this.idMapping),this.clientHttps=new $(t),this.predictorFacade=new Rl(t,this.predictorHttps,this.clientHttps,this.idMapping),this.helpers=new Cl(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 Li=class{loyalty=null;profile=null;predictor=null;constructor(t){this.loyalty=new Yt(t),this.profile=new U(t),this.predictor=new Oi(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 Xt=class{idSchema=null;profile=null;validator=null;idMapping=null;constructor(t){this.idSchema=t.idSchema,this.profile=new U(t),this.validator=new Qt(t),this.idMapping=new E(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 Fl=class{factory=null;https=null;loyaltyHttps=null;profile=null;service=null;discussionsService=null;constructor(t){this.factory=new Si,this.https=new Ri(t),this.service=new Li(t),this.loyaltyHttps=new Pt(t),this.profile=new U(t),this.discussionsService=new Xt(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 sr(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 or(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 je(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 Ye(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 Xe(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 vl=class{facade=null;constructor(t){this.facade=new Fl(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 Al=class extends C{remapper=null;constructor(t){super(t,F(t.environment,"discussions")),this.remapper=new Ei}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 Ol=class{createRequestBodyFromParam=t=>{let e=new cr;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 Ll=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 Al(t),this.clientHttps=new $(t),this.activityService=new yt(t),this.service=new Xt(t),this.factory=new Ol}getAll=async(t,e)=>{t&&(t=new br(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 Ut(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 Ut(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 Ut(t)),await this.https.getOwnPosts(t));getUserPosts=async(t,e,i)=>(e&&(e=new Ut(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 Mr(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 xl=class{facade=null;constructor(t){this.facade=new Ll(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 xd=["minutesPlayed","cleanSheets","concededGoals","saves","penaltySaved","penaltyCommitted","yellowCards","redCards","assists","foulsCommitted","ownGoals","goals","tackles","shotsOn"],Dd=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"),xi=class{static createFantasyPrediction(t,e,i,a){let r=new Ce;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 xd.map(e=>{let i=new Pr,a=t.data.reduce((r,o)=>r+o.stats[e],0);return i.key=e,i.label=Dd.get(e),i.value=a,i})}};var Dl=class{idMapping=null;idSchema=null;errorHandlingModel=null;football=null;constructor(t){this.idSchema=t.idSchema,this.errorHandlingModel=t.errorHandlingMode,this.football=new J(t),this.idMapping=new E(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 Bl=class{idSchema=null;clientHttps=null;footballHttps=null;predictorHttps=null;loyaltyHttps=null;idMappingService=null;service=null;constructor(t){this.idSchema=t.idSchema,this.clientHttps=new $(t),this.footballHttps=new pt(t),this.service=new Dl(t),this.idMappingService=new E(t),this.predictorHttps=new dt(t,this.idMappingService),this.loyaltyHttps=new Pt(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=xi.createFantasyPrediction(t,e,o,a)}else r=xi.createFantasyPrediction(t,e,i,a);return await this.predictorHttps.makeFootballPrediction(r)};getMyPrediction=async(t,e)=>{let i=`${t}_${e}`,a=new G(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 xi.createFantasyPlayerStats(a)};getGameWeekStatistics=async t=>await this.loyaltyHttps.getTemplateBreakdownPoints(t)};var Nl=class{facade=null;constructor(t){this.facade=new Bl(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 kl=class{configuration;constructor(t){this.configuration=t}getSDKConfiguration(){return this.configuration}};var Gl=class{remapToResponseModel=(t,e,i)=>{let a=new Zr;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 Ul=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 Vl=class{validator=null;idMappingFacade=null;factory=new Gl;constructor(t){this.validator=new Ul(t),this.idMappingFacade=new ci(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 Hl=class{facade=null;constructor(t){this.facade=new Vl(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 $l=class{remapUserVotes=t=>{let e=new qs;return e.meta=this.remapMeta(t.meta.pagination),e.data=t.data.map(i=>this.remapUserVoteModel(i)),e};remapResults=t=>{let e=new Qs;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 Ws;return e.matchId=t.match_id,e.playerId=t.player_id,e.createdAt=t.created_at,e};remapResultsModel=t=>{let e=new Ks;return e.teamId=t.team_id,e.playerId=t.player_id,e.votes=t.votes,e.winner=t.winner,e}};var ql=class extends ct{remapPolls=t=>{let e=new Vs;return e.meta.pagination=this.remapMetaPagination(t.meta.pagination),e.data=t.data.map(i=>this.remapPoll(i)),e};remapPollById=t=>{let e=new ks;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.createdAt=t.created_at,e.updatedAt=t.updated_at,e};remapUserVote=t=>{let e=new ii;return e.id=t.id,e.pollId=t.poll_id,e.optionId=t.option_id,e.userId=t.user_id,e};remapPollsVotes=t=>{let e=new Hs;return e.meta.pagination=this.remapMetaPagination(t.meta.pagination),e.data=t.data.map(i=>this.remapPollVote(i)),e};remapPollVote=t=>{let e=new Us;return e.id=t.id,e.pollId=t.poll_id,e.optionId=t.option_id,e.userId=t.user_id,e};remapMetaPagination=t=>{let e=new bt;return e.itemsPerPage=t.items_per_page,e.nextPageStartsAfter=t.next_page_starts_after,e};remapPoll=t=>{let e=new ei;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.createdAt=t.created_at,e.updatedAt=t.updated_at,e};remapContext=t=>{let e=new St;return e.content=t.content,e.tags=t.tags?t.tags.map(i=>{let a=new Ja;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 Gs;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})};var Wl=class extends C{pollRemapper=null;playerOfTheMatchRemapper=null;constructor(t){super(t,F(t.environment,"voting")),this.pollRemapper=new ql,this.playerOfTheMatchRemapper=new $l}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_id: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 zl=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 E(t),this.validator=new Qt(t),this.activityService=new yt(t),this.football=new J(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 Ql=class{https=null;service=null;idSchema=null;constructor(t){this.idSchema=t.idSchema,this.https=new Wl(t),this.service=new zl(t)}getPolls=async(t,e)=>{t&&(t=new ti(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)=>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 ti({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}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 ti({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)),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 $s(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 Di=class{facade=null;constructor(t){this.facade=new Ql(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 Kl=class{clientHttps=null;topX=null;matchQuiz=null;loyalty=null;miniGames=null;voting=null;constructor(t){this.clientHttps=new $(t),this.topX=new jt(t),this.matchQuiz=new zt(t),this.loyalty=new Yt(t),this.miniGames=new Kt(t),this.voting=new Di(t)}getListContent=async(t,e,i)=>{e&&(e=new to(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 jl=class{facade=null;constructor(t){this.facade=new Kl(t)}getListContent=async(t,e,i)=>await this.facade.getListContent(t,e,i)};var Yl=class{fromResponse(t,e){let i=new Map;return t.matches.forEach(a=>{let r=a.odds.map(o=>{let n=new es;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 Wo;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 Yo;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 Ko;return i.url=e.url,i.appType=e.app_type,i})}remapBranding(t){let e=new zo;return e.backgroundColor=t.background_color,e.textColor=t.text_color,e}remapAssets(t){return t.map(e=>{let i=new Qo;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 Zo;return e.id=t.id,e.name=t.name,e.code=t.code,e.entityType=t.entity_type,e};remapMarketScope=t=>{let e=new Xo;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 Jo;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 ts;return e.selectionId=t.selection_id,e.eventId=t.event_id,e.marketId=t.market_id,e.competitionId=t.competition_id,e}};var Xl=class{footballBaseUrl="https://football.api.sportal365.com/";retryRequest=!1;oddClient=null;remapper=null;constructor(t){this.oddClient=t.oddClient,this.remapper=new Yl}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 Jl=class{https;idSchema;oddClient;idMapping=null;validator;constructor(t){this.idSchema=t.idSchema,this.oddClient=t.oddClient,this.https=new Xl(t),this.validator=new Y(t.errorHandlingMode),this.idMapping=new E(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 jo(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 Zl=class{facade;constructor(t){this.facade=new Jl(t)}getByMatchIds=async(t,e)=>await this.facade.getByMatchIds(t,e)};var tp=class{factory=null;privateLeagueHttps=null;loyaltyHttps=null;profile=null;service=null;discussionsService=null;constructor(t){this.factory=new Si,this.privateLeagueHttps=new Ri(t),this.loyaltyHttps=new Pt(t),this.profile=new U(t),this.service=new Li(t),this.discussionsService=new Xt(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 Ps(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 Ts(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 je(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 Ye(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 Xe(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 ep=class{privateLeaguesFacade=null;constructor(t){this.privateLeaguesFacade=new tp(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 ip=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 ap=class extends Y{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 rp=class{https=null;profile=null;validator=null;constructor(t){this.https=new di(t),this.profile=new U(t),this.validator=new ap(t.errorHandlingMode)}getGames=async(t,e)=>(t&&(t=new vs(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 As(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 op=class{facade=null;constructor(t){this.facade=new rp(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 rd(){let s=ad(),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 ec=null,Ic=null;function Nd(s){if(kd(s)){let t=Gd(s);if(t.isValid)return ec={profile:new U(s),football:new J(s),predictor:new Oi(s),loyalty:new Yt(s),topX:new jt(s),matchQuiz:new zt(s),activity:new In(s),miniGames:new Kt(s),discussions:new xl(s),privateLeagues:new ep(s),challenges:new vl(s),progress:new ip,voting:new Di(s),fantasy:new Nl(s),helpers:new kl(s),idMapping:new Hl(s),bracketGame:new ol(s),lists:new jl(s),standingGame:new op(s),odds:new Zl(s),getVersion:rd},Ic={...s},ec;Ud(t)}return ec}var kd=s=>!ec||JSON.stringify(s)!==JSON.stringify(Ic)||s.authProvider?.getIdToken()!==Ic.authProvider?.getIdToken(),Gd=s=>{let e=new mn().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},Ud=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 Zt).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{ir as AcceptChallengeModel,Is as AcceptPrivateLeagueModel,Hi as AchievementsStats,he as ActionValueModel,pc as ActionsEnum,fe as ActionsModel,ne as ActivityFilters,Mp as ActivityMeta,se as ActivityResponseBody,Sp as AssetsModel,me as AutomaticModerationModel,za as BadgesModel,Aa as BadgesModelV2,Qa as BadgesValue,q as BadgesValueV2,Qo as BookmakerAssetModel,zo as BookmakerBrandingModel,qp as BookmakerLinkModel,Wo as BookmakerModel,Ko as BookmakerUrlModel,as as BothTeamsFixtureModel,er as BracketGameFilters,le as BracketGameFixtureScoreModel,tr as BracketGameFixtures,ea as BracketGameFixturesModel,pe as BracketGameMetaModel,ia as BracketGameMetaParticipantsModel,aa as BracketGameModel,na as BracketGamePredictionFixturesModel,la as BracketGamePredictionModel,_p as BracketGamePredictionRequestBody,td as BracketGamePredictionStatusEnum,Za as BracketGamePredictionsFilters,ra as BracketGamePredictionsModel,pa as BracketGameRankingsModel,ce as BracketGameTiebreaker,sa as BracketGameTiebreakerModel,oa as BracketGamesModel,hc as BracketWinnerEnum,jr as BrandingColorsModel,Xr as BrandingImagesModel,Kr as BrandingModel,Yr as BrandingUrlsModel,wa as BreakdownModel,zp as CalculatedOneXTwoFromScoresModel,Ip as CampaignModel,ar as ChallengeCreateModel,or as ChallengeFilters,nr as ChallengeRankingsModel,rr as ChallengeUpdateModel,xe as ClassicQuizBasicModel,Io as ClassicQuizFilters,Be as ClassicQuizFiltersMeta,wo as ClassicQuizFullModel,Fo as ClassicQuizLeaderboardFilters,ke as ClassicQuizLeaderboardMeta,Po as ClassicQuizOptionModel,Gp as ClassicQuizParticipationBodyModel,To as ClassicQuizParticipationModel,Eo as ClassicQuizParticipationQuestionModel,Ro as ClassicQuizParticipationsFilters,_o as ClassicQuizQuestionModel,Co as ClassicQuizQuestionsReportModel,Ne as ClassicQuizRankFilters,vo as ClassicQuizRankModel,So as ClassicQuizUserParticipationModel,Ao as ClassicQuizUserRank,Vp as ClassicQuizUserRankModel,Hp as ClassicQuizzesLeaderboardModel,Up as ClassicQuizzesModel,ee as ClassicQuizzesStats,eo as ClientBadges,io as ClientBadgesV2,Fr as CompetitionBasicModel,gi as CompetitionFilters,vr as CompetitionFullModel,j as CompletedModel,wp as ContentModel,Bs as ContestWinners,St as ContextModel,os as CornersFixtureModel,xt as CorrectScoreFixtureModel,li as CreateActivityRequestBody,Pp as CreatePostParamBody,ga as DetailedProfileModel,Ta as DictionaryModel,lr as DiscussionModel,ie as DiscussionStats,Ha as DiscussionsBadgeRequirements,$a as DiscussionsBadgesValue,Ea as DiscussionsConfigModel,br as DiscussionsFilters,el as DoubleChanceEnum,ls as DoubleChanceFixtureModel,Ge as EitherOrBasicModel,Oo as EitherOrFilters,Lo as EitherOrFullModel,Bo as EitherOrParticipationModel,ko as EitherOrParticipationRequestFullModel,No as EitherOrParticipationRequestModel,Uo as EitherOrParticipationStepsModel,Mi as EitherOrParticipationStepsOptionModel,xo as EitherOrPointsModel,Vo as EitherOrResultsBreakdownModel,Ho as EitherOrResultsModel,$o as EitherOrResultsStandingsModel,ae as EitherOrStats,Do as EitherOrStatsModel,$p as EitherOrsModel,Ap as EntitiesFollows,Op as EntitiesFollowsFilters,Ni as EnvironmentEnum,v as ErrorCodes,pp as ErrorHandlingModeEnum,N as ErrorMessages,A as ErrorStatuses,Nd as FansUnitedSDK,Cp as FansUnitedSDKModel,Gt as FansUnitedSdkFetchException,Pe as FantasyCoefficientsModel,ja as FantasyConfigModel,Ya as FantasyMultipliersModel,wr as FantasyPlayerDetailedStatsMetaModel,_r as FantasyPlayerDetailedStatsModel,Pr as FantasyPlayerStatsModel,Er as FantasyPlayersMetaModel,Te as FantasyPlayersModel,Rr as FantasyPlayersPointsModel,Ce as FantasyPredictionRequestBody,po as FiltersMetaModel,Os as FixturesGamesModel,bo as FixturesMatchQuizModel,is as FixturesPredictionModel,He as FixturesResponseModel,xs as FixturesTopXModel,hi as FollowFilters,ui as FollowModel,Ma as FollowStatusModel,ba as FollowersModel,ya as FollowingModel,ka as FootballBadgeRequirements,Ga as FootballBadgesValue,Ar as FootballCountryModel,Vt as FootballPaginationModel,Fs as FullInterestModel,_a as FullnessProfile,xa as GameBadgeRequirements,Da as GameBadgesValue,Je as GameByIdModel,Mo as GameMarketsResults,Ht as GameModel,si as GamePredictionsStats,Ds as GameResultsModel,Ft as GameStatusEnum,Ba as GamesBadgeRequirements,Na as GamesBadgesValue,ot as GamesFilters,wt as GamesListModel,It as GamesMatchQuizListModel,Dt as GamesTopXListModel,Ka as GeneralBadgesValue,_e as GeneralRequirementModel,il as HalfTimeFullTimeEnum,cs as HalfTimeFullTimeFixtureModel,ao as HighestSuccessRateFilters,lo as HighestSuccessRateModel,x as IdSchemaEnum,K as ImagesModel,Cs as InterestModel,je as InvitationFilters,en as LangEnum,Ia as LeadModel,Zp as LeadRequestBody,Lp as LeaderboardLeagueResponse,Le as LeaderboardModel,xp as LeaderboardResponseModel,ro as LeagueLeaderboardFilters,Oe as LeagueLeaderboardMetaModel,Ae as LineupsModel,to as ListContentFilters,Xa as ListContentModel,js as ListContentResponseModel,Ra as LoyaltyConfigModel,Wa as LoyaltyConfigModelV2,oo as LoyaltyFilters,Ot as LoyaltyMeta,Jr as MappingModel,Zr as MappingResponseModel,tt as MarketEnum,Wp as MarketsConfigModel,Or as MatchBasicModel,ze as MatchCorrectScoreMarketResultModel,At as MatchFilters,Lr as MatchFullModel,ys as MatchMarketsResultsModel,jo as MatchOddsFilters,bc as MatchOddsMarketEnum,Yo as MatchOddsMarketModel,Xo as MatchOddsMarketScopeModel,Jo as MatchOddsMarketSelectionModel,Zo as MatchOddsMarketTypeModel,es as MatchOddsModel,gs as MatchPlayerMarketResultModel,ye as MatchQuizConfigModel,it as MatchStatus,Ms as MatchSummaryModel,D as MetaFootballModel,Go as MiniGameImages,Ua as MiniGamesBadgeRequirements,Va as MiniGamesBadgesValue,Ue as MiniGamesContext,Ve as MiniGamesContextTag,De as MiniGamesFilters,sr as MyChallengesFilters,Ps as MyLeaguesFilters,O as NoYesModel,yc as OddFormatEnum,fc as OddTypeEnum,tl as OneXTwoEnum,us as OneXTwoFixtureModel,id as OutcomeEnum,qe as OverCornersFixtureModel,We as OverGoalsFixtureModel,Zi as OwnActivityFilters,Qi as PaginationActivities,z as PaginationFootballProperties,Kp as PastTemplateModel,ms as PenaltyMatchFixtureModel,Tp as PlayerAssetsModel,kr as PlayerBasicModel,Fe as PlayerDetailedPointsModel,Ir as PlayerDetailedStatsFilters,Sr as PlayerDetailedStatsModel,bi as PlayerFilters,rt as PlayerFixtureModel,Gr as PlayerFullModel,Ep as PlayerMarketResultModel,Cr as PlayerPointsModel,Hr as PlayerShortModel,Ur as PlayerSquadModel,ve as PlayerStatsMatchModel,Nr as PlayerStatsModel,Tr as PlayersPointsFilters,Dp as Points,Sa as PointsModel,Bp as PointsValueModel,vp as PollBadgesValue,ei as PollBasicModel,ks as PollFullModel,Gs as PollOptionModel,ii as PollVoteBasicModel,Us as PollVoteFullModel,ti as PollsFilters,Vs as PollsModel,Hs as PollsUserVotesModel,Se as PostByIdBasicModel,pr as PostByIdFullModel,cr as PostCreateModel,dr as PostsCountDiscussionModel,ur as PostsDiscussionBasicModel,Ut as PostsFilters,mr as PostsFullModel,vt as PostsMetaModel,hr as PostsModel,Ie as PotmBadgesValue,zs as PotmResultsMetaModel,Ks as PotmResultsModel,Qs as PotmResultsResponseModel,$s as PotmUserVotesFilters,Ws as PotmUserVotesModel,qs as PotmUserVotesResponseModel,yo as PredictionMatchQuizModel,Qe as PredictionRequestModel,Ii as PredictionResponseModel,Ls as PredictionTopXModel,G as PredictionsFilters,bs as PredictionsModel,oe as PredictionsStats,Oa as PredictorBadgeRequirements,La as PredictorBadgesValue,Me as PredictorConfigModel,Ee as PrivateLeagueBasicCreateModel,Re as PrivateLeagueBasicUpdateRequestBody,Rs as PrivateLeagueCreateModel,Ts as PrivateLeagueFilters,ws as PrivateLeagueFullModel,Ke as PrivateLeagueModel,jp as PrivateLeagueParamCreateBody,Yp as PrivateLeagueParamUpdateBody,Ye as PrivateLeaguePostsFilters,_s as PrivateLeaguePredictionModel,Xe as PrivateLeaguePredictionsFilters,Xp as PrivateLeaguePredictionsModel,Es as PrivateLeagueRankingsModel,Ss as PrivateLeagueUpdateModel,Jp as PrivateLeaguesModel,Pa as ProfileCountryModel,ue as ProfileModel,qi as ProfileStatsModel,so as RankingsFilters,uo as RankingsModel,fr as ReactionModel,fs as RedCardFixtureModel,Q as RelatedEntityRelationship,gr as ReportModel,Ct as RequirementModel,$e as ResultModel,qo as ResultsSummaryModel,ge as RewardsModel,we as RewardsModelV2,Fp as SDKConfiguraitonModel,gc as ScopeTypeEnum,Dr as ScoresModel,Qr as SearchFilters,zr as SearchModel,ts as SelectionProviderInfoModel,Wi as SinglePredictionsBreakdown,re as SinglePredictionsStats,m as StandardFansUnitedException,de as StandingGameMetaModel,ua as StandingGameMetaParticipantsModel,ca as StandingGameModel,ma as StandingGamePredictionModel,ha as StandingGamePredictionsModel,As as StandingGameRankingsFilters,fa as StandingGameRankingsModel,vs as StandingGamesFilters,da as StandingGamesModel,xr as StatsModel,On as StatusEnum,zi as SuccessRatePercent,Ca as SuccessRateScopeModel,$i as SuccessRates,kt as SummarizedBreakdown,Ja as TagsModel,$r as TeamBasicModel,qr as TeamColors,yi as TeamFilters,Rp as TeamFormModel,Wr as TeamFullModel,Np as TemplateBreakdownModel,mo as TemplateBreakdownPointsModel,ho as TemplateByIdModel,no as TemplateFilters,go as TemplateGroupFilter,fo as TemplateGroups,co as TemplateMeta,Lt as TemplateModel,ht as TiebreakerModel,kp as TiersModel,mt as TimeTiebreaker,Br as TimelineModel,Qp as TopCorrectScoresModel,Mr as TopDiscussionsFilters,Vr as TopPlayerModel,be as TopXConfigModel,Ze as TopXPredictionRequestModel,ed as UserActionsEnum,ta as UserActivityFilters,Fa as UserDataConfigModel,Ns as UserListWinners,hs as ValueAndPlayerId,at as ValueBoolean,rs as ValueCorners,ss as ValueCorrectScore,ns as ValueDoubleChance,ps as ValueHalfTimeFullTime,ds as ValueOneXTwo,yr as VersionsModel,qa as VotingBadgeRequirements,va as VotingBadgesValue};
1
+ var ld=Object.create;var pp=Object.defineProperty;var pd=Object.getOwnPropertyDescriptor;var cd=Object.getOwnPropertyNames;var dd=Object.getPrototypeOf,ud=Object.prototype.hasOwnProperty;var md=(s,t,e)=>t in s?pp(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e;var hd=(s,t)=>()=>(s&&(t=s(s=0)),t);var en=(s,t)=>()=>(t||s((t={exports:{}}).exports,t),t.exports),fd=(s,t)=>{for(var e in t)pp(s,e,{get:t[e],enumerable:!0})},gd=(s,t,e,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of cd(t))!ud.call(s,a)&&a!==e&&pp(s,a,{get:()=>t[a],enumerable:!(i=pd(t,a))||i.enumerable});return s};var yd=(s,t,e)=>(e=s!=null?ld(dd(s)):{},gd(t||!s||!s.__esModule?pp(e,"default",{value:s,enumerable:!0}):e,s));var Z=(s,t,e)=>(md(s,typeof t!="symbol"?t+"":t,e),e);var Dc={};fd(Dc,{default:()=>Pd});var _d,Pd,Bc=hd(()=>{_d={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},Pd=_d});var Nc=en((Gh,fp)=>{var Td=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 L=[],ai=[],ri=typeof Buffer<"u";typeof d>"u"&&(d=!0),typeof u>"u"&&(u=1/0);function st(h,Bt){if(h===null)return null;if(Bt===0)return h;var k,Js;if(typeof h!="object")return h;if(s(h,t))k=new t;else if(s(h,e))k=new e;else if(s(h,i))k=new i(function(Zs,_){h.then(function(tn){Zs(st(tn,Bt-1))},function(tn){_(st(tn,Bt-1))})});else if(a.__isArray(h))k=[];else if(a.__isRegExp(h))k=new RegExp(h.source,p(h)),h.lastIndex&&(k.lastIndex=h.lastIndex);else if(a.__isDate(h))k=new Date(h.getTime());else{if(ri&&Buffer.isBuffer(h))return Buffer.allocUnsafe?k=Buffer.allocUnsafe(h.length):k=new Buffer(h.length),h.copy(k),k;s(h,Error)?k=Object.create(h):typeof b>"u"?(Js=Object.getPrototypeOf(h),k=Object.create(Js)):(k=Object.create(b),Js=b)}if(d){var Pc=L.indexOf(h);if(Pc!=-1)return ai[Pc];L.push(h),ai.push(k)}s(h,t)&&h.forEach(function(Zs,_){var tn=st(_,Bt-1),nd=st(Zs,Bt-1);k.set(tn,nd)}),s(h,e)&&h.forEach(function(Zs){var _=st(Zs,Bt-1);k.add(_)});for(var ft in h){var rc;Js&&(rc=Object.getOwnPropertyDescriptor(Js,ft)),!(rc&&rc.set==null)&&(k[ft]=st(h[ft],Bt-1))}if(Object.getOwnPropertySymbols)for(var Tc=Object.getOwnPropertySymbols(h),ft=0;ft<Tc.length;ft++){var np=Tc[ft],Bi=Object.getOwnPropertyDescriptor(h,np);Bi&&!Bi.enumerable&&!I||(k[np]=st(h[np],Bt-1),Bi.enumerable||Object.defineProperty(k,np,{enumerable:!1}))}if(I)for(var R=Object.getOwnPropertyNames(h),ft=0;ft<R.length;ft++){var lp=R[ft],Bi=Object.getOwnPropertyDescriptor(h,lp);Bi&&Bi.enumerable||(k[lp]=st(h[lp],Bt-1),Object.defineProperty(k,lp,{enumerable:!1}))}return k}return st(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 fp=="object"&&fp.exports&&(fp.exports=Td)});var Kc=en((Uh,fc)=>{"use strict";var Ji=typeof Reflect=="object"?Reflect:null,kc=Ji&&typeof Ji.apply=="function"?Ji.apply:function(t,e,i){return Function.prototype.apply.call(t,e,i)},gp;Ji&&typeof Ji.ownKeys=="function"?gp=Ji.ownKeys:Object.getOwnPropertySymbols?gp=function(t){return Object.getOwnPropertyNames(t).concat(Object.getOwnPropertySymbols(t))}:gp=function(t){return Object.getOwnPropertyNames(t)};function Ed(s){console&&console.warn&&console.warn(s)}var Uc=Number.isNaN||function(t){return t!==t};function S(){S.init.call(this)}fc.exports=S;fc.exports.once=Fd;S.EventEmitter=S;S.prototype._events=void 0;S.prototype._eventsCount=0;S.prototype._maxListeners=void 0;var Gc=10;function yp(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 Gc},set:function(s){if(typeof s!="number"||s<0||Uc(s))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+s+".");Gc=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||Uc(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 Vc(s){return s._maxListeners===void 0?S.defaultMaxListeners:s._maxListeners}S.prototype.getMaxListeners=function(){return Vc(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")kc(l,this,e);else for(var p=l.length,c=zc(l,p),i=0;i<p;++i)kc(c[i],this,e);return!0};function Hc(s,t,e,i){var a,r,o;if(yp(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=Vc(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,Ed(n)}return s}S.prototype.addListener=function(t,e){return Hc(this,t,e,!1)};S.prototype.on=S.prototype.addListener;S.prototype.prependListener=function(t,e){return Hc(this,t,e,!0)};function Rd(){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 $c(s,t,e){var i={fired:!1,wrapFn:void 0,target:s,type:t,listener:e},a=Rd.bind(i);return a.listener=e,i.wrapFn=a,a}S.prototype.once=function(t,e){return yp(e),this.on(t,$c(this,t,e)),this};S.prototype.prependOnceListener=function(t,e){return yp(e),this.prependListener(t,$c(this,t,e)),this};S.prototype.removeListener=function(t,e){var i,a,r,o,n;if(yp(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():Sd(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 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?Cd(a):zc(a,a.length)}S.prototype.listeners=function(t){return qc(this,t,!0)};S.prototype.rawListeners=function(t){return qc(this,t,!1)};S.listenerCount=function(s,t){return typeof s.listenerCount=="function"?s.listenerCount(t):Wc.call(s,t)};S.prototype.listenerCount=Wc;function Wc(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?gp(this._events):[]};function zc(s,t){for(var e=new Array(t),i=0;i<t;++i)e[i]=s[i];return e}function Sd(s,t){for(;t+1<s.length;t++)s[t]=s[t+1];s.pop()}function Cd(s){for(var t=new Array(s.length),e=0;e<t.length;++e)t[e]=s[e].listener||s[e];return t}function Fd(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))}Qc(s,t,r,{once:!0}),t!=="error"&&vd(s,a,{once:!0})})}function vd(s,t,e){typeof s.on=="function"&&Qc(s,"error",t,e)}function Qc(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 Xc=en((jc,Yc)=>{(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=Nc(),s=Kc().EventEmitter,Yc.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,L;if(I=d,[...d]=I,[u]=i.call(d,-1),typeof u=="function")try{L=c(...d),u(null,L)}catch(ai){b=ai,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,L,ai,ri,st;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,L=l.length;d<L;d++){if(I=l[d],{key:b,val:st,ttl:ri}=I,ri&&typeof ri!="number")throw p=this._error("ETTLTYPE"),p;if((c=this._isInvalidKey(b))!=null)throw c}for(u=0,ai=l.length;u<ai;u++)I=l[u],{key:b,val:st,ttl:ri}=I,this.set(b,st,ri);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 td=en((Jc,Zc)=>{(function(){var s;s=Zc.exports=Xc(),s.version="5.1.2"}).call(Jc)});var od=en((az,kd)=>{kd.exports={name:"fansunited-sdk-esm",version:"1.110.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 an=(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))(an||{});var rn=class{validate=t=>{let e=this.validateField(t.lang),i=this.generateMessage(e);return{validation:e,message:i}};validateField=t=>{let e=Object.values(an),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 Ni=(r=>(r.DEV="dev",r.PROD="prod",r.STAGING="staging",r.WATG="watg",r.YOLO="yolo",r))(Ni||{});var on=class{validate(t){let e=this.validateField(t.environment),i=this.generateMessage(e);return{validation:e,message:i}}validateField=t=>{let e=Object.values(Ni),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 sn=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 x=(r=>(r.NATIVE="native",r.ENETPULSE="enetpulse",r.SPORTRADAR="sportradar",r.SPORTAL_365="sportal365",r.API_FOOTBALL="api_football",r))(x||{});var nn=class{validate(t){let e=this.validateField(t.idSchema),i=this.generateMessage(e);return{validation:e,message:i}}validateField=t=>{let e=Object.values(x),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 Zt=class{getIdToken=null;logout=null};var nt=class{text=null;type=null};var ki=class{validation=null;message=new nt;getIdToken={validation:null,message:new nt};logout={validation:null,message:new nt}};var ln=class{validate(t){if(t.cookieToken)return new ki;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 Zt),i=new ki;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 Zt).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 ut=class{validation;message};var pn=class{apiKey=null;environment=null;idSchema=null;clientId=null;lang=null;errorHandlingMode=null;cookieToken={name:new ut,requestHeaders:new ut};oddClient=null;authProvider={getIdToken:new ut,logout:new ut};isValid=!1};var cn=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 cp=(e=>(e.DEFAULT="default",e.STANDARD="standard",e))(cp||{});var dn=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 Gi=class extends ut{name={validation:null,message:new nt};requestHeaders={validation:null,message:new nt}};var un=class{keys=["name","requestHeaders"];isServerSide=typeof document>"u";validate(t){if(!t.cookieToken){let i=new Gi;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 Gi;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 Ui=class extends ut{name={validation:null,message:new nt};credentials={validation:null,message:new nt}};var mn=class{keys=["name","credentials"];validate=t=>{if(!t.oddClient){let i=new Ui;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 Ui;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 hn=class{validate=t=>{let e=this.checkFieldsForValues(t);return e.isValid=this.containsErrorMessage(e),e};checkFieldsForValues=t=>{let e=new pn,i={apiKey:new sn,environment:new on,idSchema:new nn,clientId:new cn,lang:new rn,errorHandlingMode:new dn,authProvider:new ln,cookieToken:new un,oddClient:new mn};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 oc=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},oi=(s,t)=>{let e=[];for(;s.length>t;){let i=s.splice(0,t);e.push(i)}return e.push(s),e},F=(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:"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"},n={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=o[t]:s==="watg"?e=a[t]:s==="yolo"?e=r[t]:e=n[t],e},te=s=>Array.from(new Set(s)),g=s=>s||!1,f=()=>`&disable_cache=${Date.now()}`,dp=s=>JSON.parse(JSON.stringify(s.sort((t,e)=>t.localeCompare(e))));var tt=(_=>(_.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",_))(tt||{}),Ec=["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"],Rc=["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"],gt=["PLAYER_RED_CARD","PLAYER_SCORE","PLAYER_SCORE_FIRST_GOAL","PLAYER_SCORE_HATTRICK","PLAYER_SCORE_TWICE","PLAYER_YELLOW_CARD"],Sc=["FT_1X2","HT_1X2","HT_FT","DOUBLE_CHANCE","CORNERS_MATCH","CORRECT_SCORE","CORRECT_SCORE_HT","CORRECT_SCORE_ADVANCED"],Vi="PLAYER_SCORE_FIRST_GOAL";var Hi=class{id="";achievedAt=""};var ee=class{participationCount=null;points=null};var ie=class{totalPoints=null;postPoints=null;postsMade=null;reactionPoints=null;reactionCount=null};var ae=class{participationCount=null};var si=class{participations=0;points=0};var kt=class{footballCompetitions=[];footballTeams=[]};var re=class{predictionsMade=0;correct=0;points=0;breakdown=new kt};var oe=class{single=new re;topX=new si;matchQuiz=new si};var $i=class{overallPercent;byFootballCompetition;byFootballTeam;byFootballMarket};var qi=class{profileId;tier;points;predictionsMade;successRates=new $i;predictions=new oe;tiers=[];badges=[];discussions=new ie;classicQuizzes=new ee;eitherOr=new ae};var Wi=class{entityId="";entityType="";entitySource="";model=null;predictionsMade=0;correct=0;points=0};var zi=class{successRatePercent;model=null};var St=class{content=null;tags=[];campaign=null};var se=class{id=null;profileId=null;property=null;value=null;action=null;context=new St;points=0};var z=class{currentPage=null;itemsPerPage=null;totalItems=null;numberOfPages=null};var D=class{pagination=new z};var Qi=class{meta=new D;data=[new se]};var fn=class{remapSingleResponse=t=>{let e=new se;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 Qi;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)},tt[i]&&delete e[i].model});else return t;return e};remapSuccessRatePercent=t=>{let e=new zi;return e.successRatePercent=t.success_rate_percent,e};remapPredictionsStats=t=>{let e=new oe;return e.single=this.remapSinglePredictionsStats(t.single),e.topX=t.top_x,e.matchQuiz=t.match_quiz,e};remapSinglePredictionsStats=t=>{let e=new re;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 kt,i=[],a=[];return Object.keys(t).forEach(r=>{let o=new Wi;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 kt};remapAchievementsStats=t=>t.map(e=>{let i=new Hi;return i.id=e.id,i.achievedAt=e.achieved_at,i});remapDiscussionStats=t=>{let e=new ie;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 ee;return e.participationCount=t.participation_count,e.points=t.points,e};remapEitherOrStats=t=>{let e=new ae;return e.participationCount=t.participation_count,e}};function sc(s){this.message=s}sc.prototype=new Error,sc.prototype.name="InvalidCharacterError";var Cc=typeof window<"u"&&window.atob&&window.atob.bind(window)||function(s){var t=String(s).replace(/=+$/,"");if(t.length%4==1)throw new sc("'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 Id(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(Cc(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 Cc(t)}}function up(s){this.message=s}function wd(s,t){if(typeof s!="string")throw new up("Invalid token specified");var e=(t=t||{}).header===!0?0:1;try{return JSON.parse(Id(s.split(".")[e]))}catch(i){throw new up("Invalid token specified: "+i.message)}}up.prototype=new Error,up.prototype.name="InvalidTokenError";var nc=wd;var v=(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))(v||{});var A=(R=>(R.INVALID_TEMPLATE="INVALID_TEMPLATE",R.INVALID_PREDICTION="INVALID_PREDICTION",R.INVALID_MARKET="INVALID_MARKET",R.INVALID_FIELD="INVALID_FIELD",R.INVALID_TYPE="INVALID_TYPE",R.EXCEEDED_LENGTH="EXCEEDED_LENGTH",R.INVALID_TOKEN="invalid_token",R.UNAUTHORIZED="unauthorized",R.INVALID_FILTERS="invalid_filters",R.INVALID_AVATAR="invalid_avatar",R.INVALID_METHOD_CALL="invalid_method_call",R.INVALID_LIMIT="invalid_limit",R.INVALID_TEMPLATE_GROUP_ID="invalid_template_group_id",R.INVALID_TEMPLATE_GROUP_FILTERS="invalid_template_group_filters",R.INVALID_PAGE_NUMBER="invalid_page_number",R.INVALID_DISCUSSION_IDS="invalid_discussion_ids",R.ID_MAPPING_NOT_FOUND="id_mapping_not_found",R.INVALID_COMPETITION_ID="invalid_competition_id",R.INVALID_TEAM_ID="invalid_team_id",R.INVALID_IDS="invalid_ids",R.INVALID_INPUT_PROVIDER="invalid_input_provider",R.INVALID_OUTPUT_PROVIDER="invalid_output_provider",R.INVALID_MATCH_SUMMARY="invalid_match_summary",R.INVALID_MATCH_SUMMARY_PREDICTIONS="invalid_match_summary_predictions",R.INVALID_MATCH_SUMMARY_PREDICTIONS_KEYS="invalid_match_summary_predictions_keys",R.ENTITY_IDS_NOT_FOUND="entity_ids_not_found",R.MATCH_IDS_NOT_FOUND="match_ids_not_found",R.INVALID_MATCH_IDS="invalid_match_ids",R.ODD_CLIENT_CONFIGURATION_NOT_FOUND="odd_client_configuration_not_found",R))(A||{});var B={native:"id",sportradar:"sportradar_id",sportal365:"sportal365_id",enetpulse:"enetpulse_id",api_football:"api_football_id"},lc={PREDICTOR_USER_RELATED_OPERATION:"https://docs.fansunitedmedia.com/docs/predictor-operations#user-related-operations"},pc=["matchId","matchType","market","prediction"],Fc=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 N=(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))(N||{}),cc={UNEXPECTED_STATUS_PROP:`Unexpected provided property 'status'. You can NOT use this property for this method. For more information visit our documentation:
2
+ ${lc.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
+ ${lc.PREDICTOR_USER_RELATED_OPERATION}`},vc=(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`,mp=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`,Ac=s=>`The market '${s}' is not valid for Top X game. The only available market is CORRECT_SCORE.`,Oc=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`,Lc=(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`,xc=(s,t)=>`The field ${s} has incorrect type. The correct type is ${t}`;var Gt=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 Gt(t,o)}let{code:i,status:a,message:r}=e.error;return this.errorHandlingMode==="standard"?new m(i,a,r):new Gt(t,e.error)};validateJWTToken=()=>{let t=null;try{t=nc(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 Gt(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 Gt(i,a)}else if(this.errorHandlingMode==="standard")throw new m(401,"invalid_token","The provided JWT token is expired")}};extractUserIdFromToken=()=>{try{return nc(this.getJwtToken())?.sub||""}catch(t){return console.error(t),""}}};var ni=class extends C{activityRemapper=null;constructor(t){super(t,F(t.environment,"loyalty")),this.activityRemapper=new fn}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 dc=(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))(dc||{});var li=class{action=null;context=new St;constructor(t,e,i,a){this.action=t,this.context.tags=e,i&&(this.context.content=i),a&&(this.context.campaign=a)}};var gn={player:"players",team:"teams",homeTeam:"teams",awayTeam:"teams",country:"countries",competition:"competitions",match:"matches"},yn=class extends C{constructor(t){super(t,F(t.environment,"idMapping"))}getEntityById=async(t,e)=>{let i=`/football${this.apiSignInUrl}&input_provider=${this.idSchema}&${gn[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}&${gn[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}&${gn[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=oc(e),r=[];for(let o of a){let n=`/football${this.apiSignInUrl}&input_provider=${i}&${gn[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=te(i),n=oc(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+=`${gn[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 uc="FansUnited",hp={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}}},Ki=class{idSchema="";storageInstance=null;expirationProfileTimeout=600;expirationBadgesTimeout=3600;expirationClientFeaturesTimeout=14400;expirationFootballIdsTimeout=604800;constructor(t){this.idSchema=t,this.getStorageInstance()}static getInstance(t){return Ki.instance||(Ki.instance=new Ki(t)),Ki.instance}async getStorageInstance(){try{let t=await Promise.resolve().then(()=>(Bc(),Dc));this.storageInstance=t.default}catch(t){console.error(t)}}async getData(){try{let t=await this.storageInstance.getItem(uc);return t?JSON.parse(t):(await this.storageInstance.setItem(uc,JSON.stringify(hp)),hp)}catch(t){throw console.error("AsyncStorage error:",t),t}}async setData(t){await this.storageInstance.setItem(uc,JSON.stringify(t))}clearData=async()=>{await this.setData(hp)};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=B[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=B[i];return r&&t.includes(`${r[o]}`)&&r.resource===e}):a.football.ids.find(r=>{let o=B[i];return r&&`${r[o]}`===t&&r.resource===e})};checkForExistingIdObjs=async(t,e)=>{let i=B[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=B[i],o=B[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(hp)}},ji=Ki;Z(ji,"instance");var mc="FansUnited",hc={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}}},Yi=class{idSchema="";expirationProfileTimeout=600;expirationBadgesTimeout=3600;expirationClientFeaturesTimeout=14400;expirationFootballIdsTimeout=604800;constructor(t){this.idSchema=t}static getInstance(t){return Yi.instance||(Yi.instance=new Yi(t)),Yi.instance}clearData=async()=>{this.setData(hc)};getEntityById=async(t="",e="")=>this.getData().football.ids.find(i=>{let a=B[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=B[i];return a&&t.includes(`${a[r]}`)&&a.resource===e}):this.getData().football.ids.find(a=>{let r=B[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=B[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=B[i],r=B[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(mc)||this.setData(hc),JSON.parse(localStorage.getItem(mc)));setData=t=>{localStorage.setItem(mc,JSON.stringify(t))};initialNewSchema=(t,e)=>{let i=this.getData();(!i||!i[t]||!i[t][e])&&this.setData(hc)}},Xi=Yi;Z(Xi,"instance");var ed=yd(td());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=B[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=B[i];return r&&t.includes(`${r[o]}`)&&r.resource===e}):a.find(r=>{let o=B[i];return r&&`${r[o]}`===t&&r.resource===e})};checkForExistingIdObjs=async(t,e)=>{let i=B[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=B[i],r=B[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"}}},pi=T;Z(pi,"instance"),Z(pi,"nodeCache",new ed.default);var lt=class{createLocalCacheInstance=t=>typeof window>"u"?pi.getInstance(t):typeof __DEV__<"u"?ji.getInstance(t):Xi.getInstance(t)};var ci=class{localCache=null;https=null;constructor(t){this.localCache=new lt().createLocalCacheInstance(t.idSchema),this.https=new yn(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 bp=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 bn=class{extractedObjIds={};traverse=(t,e)=>(e=bp(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 Mn=class{replaceObjIdsIndex=null;remappedIdsObj={};traverse=(t,e,i)=>(e=bp(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 E=class{idSchema="";idMappingFacade=null;constructor(t){this.idSchema=t.idSchema,this.idMappingFacade=new ci(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 bn().traverse(i,e);return this.idMappingFacade.getEntitiesByIds(r,"native",this.idSchema).then(o=>new Mn().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 yt=class{idSchema;idMapping;constructor(t){this.idSchema=t.idSchema,this.idMapping=new E(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 ne=class{page=null;limit=null;constructor(t){this.page=t.page?t.page:null,this.limit=t.limit?t.limit:null}};var Zi=class extends ne{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 ta=class extends ne{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 In=class{idSchema;activityHttps;activityService;constructor(t){this.idSchema=t.idSchema,this.activityHttps=new ni(t),this.activityService=new yt(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 li(t,n,i,a),p=await this.activityHttps.createActivity(l);return p.context.tags=o,p}let r=new li(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 Zi(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 ta(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 wn=class{activityFacade;constructor(t){this.activityFacade=new In(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 le=class{participantOne=null;participantTwo=null};var ea=class{matchId="";participantOne="";participantTwo="";winner="";homeParticipant="";startDate="";score=new le};var pe=class{participants=[]};var ia=class{id=null;name=null;group=null;image=null;undecided=!1};var aa=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 pe;fixtures=[];createdAt=null;updatedAt=null};var bt=class{nextPageStartsAfter=null;itemsPerPage=null};var w=class{pagination=new bt};var ra=class{meta=new w;data=[]};var oa=class{meta=new w;data=[]};var sa=class{statTiebreakerEnabled;statTotal};var na=class{matchId="";participantOne="";participantTwo="";winner;correct=null};var ce=class{statTotal=0};var id=(r=>(r.ACTIVE="ACTIVE",r.WON="WON",r.LOST="LOST",r.PARTIALLY_WON="PARTIALLY_WON",r.CANCELED="CANCELED",r))(id||{}),la=class{id="";profileId="";profileModel=null;gameId="";totalPoints=null;gamePoints=null;bonusPoints=null;position=null;status="ACTIVE";fixtures=[];tiebreaker=new ce;createdAt="";updatedAt=""};var pa=class{meta=new w;data=[]};var _n=class{remapBracketGames=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.remapBracketGameById(i)),e};remapBracketGameById=t=>{let e=new aa;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 la;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 ra;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 na;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 ce;return e.statTotal=t.stat_total,e};remapBracketGameMeta=t=>{let e=new pe;return e.participants=t.participants.map(i=>{let a=new ia;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 ea;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 le;return e.participantOne=t.participant_one,e.participantTwo=t.participant_two,e};remapBracketGameTiebreaker=t=>{let e=new sa;return e.statTiebreakerEnabled=t.stat_tiebreaker_enabled,e.statTotal=t.stat_total,e}};var de=class{participants=[]};var ca=class{id=null;title=null;description=null;rules=null;customFields=null;images=null;type="STANDING";status=null;points=null;related=[];predictionsCutoff="";meta=new de;outcomeCount=null;outcome=[];createdAt=null;updatedAt=null};var da=class{meta=new w;data=[]};var ua=class{id=null;name=null;group=null;image=null;undecided=!1};var ma=class{id="";profileId="";profileModel=null;total=0;gameId="";totalPoints=null;gamePoints=null;bonusPoints=null;position=null;status="ACTIVE";standing=[];createdAt="";updatedAt=""};var ha=class{meta=new w;data=[]};var fa=class{meta=new w;data=[]};var Pn=class{remapBracketGames=t=>{let e=new da;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 ca;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 ma;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 ha;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 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};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 de;return e.participants=t.participants.map(i=>{let a=new ua;return a.id=i.id,a.name=i.name,a.group=i.group,a.image=i.image,a.undecided=i.undecided,a}),e}};var Ad={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:""},di=class extends C{bracketGameRemapper=null;standingGameRemapper=null;constructor(t){super(t,F(t.environment,"predictor")),this.bracketGameRemapper=new _n,this.standingGameRemapper=new Pn}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(Ad));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 ue=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 ga=class extends ue{email=null;phoneNumber=null;phoneCountryCode=null;preferences=null};var Tn=class{profilesFromResponse=t=>t?t.map(e=>this.publicProfileFromResponse(e)):null;fullProfileFromResponse=t=>{let e=new ga;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 ue;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 V=class{meta=new w;data=[]};var ya=class{avatar=null;followingId=null;name=null;nickname=null;profileId=null};var En=class{followResponse=t=>t.map(e=>this.remapResponse(e));followingFromResponse=t=>{let e=new V;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 ya;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 ba=class{avatar=null;followerId=null;name=null;nickname=null;profileId=null};var Ma=class{followsMe=[];iFollow=[];followsMeBack=[]};var Rn=class{followersFromResponse=t=>{let e=new V;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 Ma;return e.iFollow=t.i_follow,e.followsMe=t.follows_me,e.followsMeBack=t.follows_me_back,e};remapResponse=t=>{let e=new ba;return e.avatar=t.avatar,e.followerId=t.follower_id,e.name=t.name,e.profileId=t.profile_id,e}};var ui=class{profile_ids=[]};var Ia=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 Sn=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 Ia;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 Od="/countries",et="/profile",Mp="/profiles",mi=class extends C{profileRemapper=null;followingRemapper=null;followersRemapper=null;leadRemapper=null;lang=null;limitIds=100;constructor(t){super(t,F(t.environment,"profile")),this.lang=t.lang,this.profileRemapper=new Tn,this.followingRemapper=new En,this.followersRemapper=new Rn,this.leadRemapper=new Sn}getCountries=async t=>{let e=`&lang=${this.lang}`,i=`${Od}${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=`${et}${this.apiSignInUrl}`,i="";if(t){e=`${Mp}/${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=oi(t,this.limitIds);for(let u of d){let b=`${Mp}${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=`${Mp}${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=`${Mp}${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=`${et}/followers${this.apiSignInUrl}`,a="There was a problem fetching the followers for own profile";if(t&&!e){i=`${et}/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=`${et}/${e}/followers${this.apiSignInUrl}${t.constructFilterUrl()}`:!t&&e&&(i=`${et}/${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=`${et}/following${this.apiSignInUrl}`,a="There was a problem fetching the followers of own profile";if(t&&!e){i=`${et}/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=`${et}/${e}/following${this.apiSignInUrl}${t.constructFilterUrl()}`:!t&&e&&(i=`${et}/${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 ui;e.profile_ids=t;let i=et+`/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 ui;e.profile_ids=t;let i=et+`/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=`${et}/badges${this.apiSignInUrl}`,i="There was a problem with fetching own badges";return t?(e=`${et}/${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=et+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 wa=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 _a=class{totalPercentage;breakdown=new wa};var hi=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 Mt=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 hi(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 hi(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 _a,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 Pa=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 Fn=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 Mt(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 Pa,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 fi=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 Mt(e,i,a)}getById=t=>new fi(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 vn=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 gi=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 An=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 gi(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 gi({competitionIds:t,limit:i}),r=await this.getCompetitions(a);r.sort((l,p)=>l.id.localeCompare(p.id));let o=dp(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 yi=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 Ta=class{reason="";words=[]};var me=class{enabled=!1;moderateLinks=!1;linksWhitelist=[];moderatorProfileId="";dictionary=new Ta};var Ea=class{enabled=!1;clientId=null;automaticModeration=new me};var Ct=class{points=null;gameParticipationCount=null;entityId=null;entityType=null;predictionsMade=null;correctPredictions=null};var he=class{id;weight;multiplier;conditions};var fe=class{value=[new he]};var ge=class{points=null;tiers=null;badges=null};var Ra=class{enabled=!1;clientId=null;conditions={list:null};actions=new fe;rewards=new ge};var Sa=class{general=null;predictor=null;activity=null;topX=null;matchQuiz=null;discussionPost=null};var ye=class{enabled=!1;clientId=null;defaultMarkets=null;competitionsWhitelist=null;authRequirement=null};var be=class{enabled=!1;clientId=null;minFixtures=null;maxFixtures=null;competitionsWhitelist=null;authRequirement=null};var Ca=class{competitions=[];teams=[];markets=[]};var Me=class{enabled=!1;clientId=null;fullCoverageCompetitions=null;markets=null;successRateScopes=new Ca;userDataConfig=null};var Fa=class{storeIp=!1;storeDeviceId=!1;storeAgent=!1};var va=class{potm=[];poll=[]};var Aa=class{predictor=[];topX=[];matchQuiz=[];games=[];football=[];classicQuizzes=[];eitherOr=[];discussions=[];voting=new va};var q=class{id;label;description;flags;assets={mainImageUrl:""};enabled};var Oa=class{predictionsNumber;correctPredictions;points;fromDate;toDate};var La=class extends q{requirements=new Oa};var xa=class{participationCount;points;fromDate;toDate};var Da=class extends q{requirements=new xa};var Ba=class{participationCount;points;specificGames;fromDate;toDate};var Na=class extends q{requirements=new Ba};var ka=class{predictionsNumber;correctPredictions;points;entityId;entityType;entityModel=null};var Ga=class extends q{requirements=new ka};var Ua=class{participationCount;fromDate;toDate};var Va=class extends q{requirements=new Ua};var Ha=class{totalDiscussionPoints;postsCount;postPoints;reactionsCount};var $a=class extends q{requirements=new Ha};var qa=class{points;voteCount;entityId;entityType;entityModel};var Ie=class extends q{requirements=new qa};var we=class{points=null;tiers=null;badges=null};var Wa=class{enabled=!1;clientId=null;conditions={list:null};actions=new fe;rewards=new we};var za=class{general=[];predictor=[];topX=[];matchQuiz=[]};var Qa=class{id;label;assets={mainImageUrl:""};enabled;requirements=new Ct};var _e=class extends Ct{postPoints=null;postsCount=null;reactionsCount=null;totalDiscussionPoints=null};var Ka=class{id;label;assets={mainImageUrl:""};enabled;requirements=new _e};var Pe=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 Te=class{total=null;minGoalkeepers=null;maxGoalkeepers=null;minDefenders=null;maxDefenders=null;minMidfielders=null;maxMidfielders=null;minStrikers=null;maxStrikers=null};var ja=class{enabled=!1;clientId=null;addPointsToProfileTotal=!1;coefficients=new Pe;players=new Te;multipliers=null;competitionsWhitelist=[]};var Ya=class{captain=null;viceCaptain=null};var On=class{remapPredictorConfig=t=>{let e=new Me;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 be;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 ye;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 Ra;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 Wa;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 Ea;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 ja;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 Te;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 Pe;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 we;return e.points=this.remapPoints(t.points),e.tiers=t.tiers,e.badges=this.remapNewBadges(t.badges),e};remapRewards=t=>{let e=new ge;return e.points=this.remapPoints(t.points),e.tiers=t.tiers,e.badges=this.remapBadges(t.badges),e};remapPoints=t=>{let e=new Sa;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 za;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 Aa;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 La;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 Da;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 Na;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 Ga;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 Va;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 $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.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 Ie;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 Qa;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 Ct;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 Fa;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 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.remapGeneralRequirements(e.requirements),i});remapGeneralRequirements=t=>{let e=new _e;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 Ya;return e.captain=t.captain,e.viceCaptain=t.vice_captain,e}};var Xa=class{entityId;entityType;entityModel=null};var Ip=class{totalItems=0};var wp=class{id=null;label=null};var _p=class{type=null;id=null;label=null};var Ja=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 Za=class extends P{};var Pp=class{fixtures=[];tiebreaker};var gc=(i=>(i.PARTICIPANT_ONE="PARTICIPANT_ONE",i.PARTICIPANT_TWO="PARTICIPANT_TWO",i.DRAW="DRAW",i))(gc||{});var tr=class{matchId="";participantOne="";participantTwo="";winner="PARTICIPANT_ONE"};var Ft=(o=>(o.OPEN="OPEN",o.LIVE="LIVE",o.PENDING="PENDING",o.CANCELED="CANCELED",o.CLOSED="CLOSED",o.SETTLED="SETTLED",o))(Ft||{});var er=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(Ft).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 ir=class{profileId="";profileModel=null;challengeId="";challengeModel=null;message=""};var Ee=class{name="";description="";invitation_code="";template_id="";users_can_invite_users=!1;administrators=[];scoring_starts_at=""};var ar=class extends Ee{type="ONE_VS_ONE"};var Re=class{name="";description="";invitation_code="";template_id="";users_can_invite_users=!1;administrators=[];pinned_posts=[];scoring_starts_at=""};var rr=class extends Re{type="ONE_VS_ONE"};var or=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 sr=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 nr=class{templateId="";templateModel=null;challengeId="";challengeModel=null;position="";points=0;type="challenge"};var lr=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 Tp=class{content="";replyId="";discussionLabel="";discussionUrl="";userNickname="";context=null};var Se=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 pr=class extends Se{userModel=null};var cr=class{content="";reply_id="";discussion_label="";discussion_url="";anonymous_nickname="";context=null};var dr=class{id="";postsCount=0};var vt=class{pagination={totalItems:0,nextPageStartsAfter:"",lastCommentCreateTimestamp:""}};var ur=class{meta=new vt;data=[]};var mr=class{meta=new vt;data=[]};var hr=class{meta=new w;data=[]};var fr=class{type="";userIds=[];reactionCount=0};var gr=class{userId=null;reason="AD";reasonDetails=null};var yr=class{updatedAt="";content=""};var Ld=["CREATED_AT_ASC","CREATED_AT_DESC","POSTS_COUNT_ASC","POSTS_COUNT_DESC"],xd=["ACTIVE","INACTIVE"],br=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&&Ld.includes(this.sort.toUpperCase())&&(t+=`&sort=${this.sort.toUpperCase()}`),this.status&&xd.includes(this.status.toUpperCase())&&(t+=`&status=${this.status.toUpperCase()}`),this.skipDeleted!==null&&(t+=`&skip_deleted=${this.skipDeleted}`),t}};var Ut=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 Mr=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 Ir=class{templateId=null;playerId=null};var wr=class{filters=new Ir};var _r=class{meta=new wr;data=[]};var Pr=class{key=null;label=null;value=null};var Tr=class{templateId=null};var Er=class{filters=new Tr};var Rr=class{meta=new Er;data=[]};var Ce=class{template_id=null;group_id=null;fixtures=[]};var Fe=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 ve=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 Sr=class{matchId=null;matchModel=null;points=new Fe;stats=new ve};var Cr=class{playerId=null;playerModel=null;points=null;rank=null};var Fr=class{id="";country=null;gender="";assets=null;type="";name=""};var vr=class{id="";country=null;gender="";assets=null;type="";name="";participants=[]};var Ar=class{id="";alias="";countryCode="";assets=null;name=""};var Or=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={type:null,subType:null}};var it=class{type=null;subType=null};var Lr=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 it;lineups=null};var At=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 xr=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 Dr=class{ftScore=null;htScore=null;aetScore=null;aggScore=null;penScore=null};var Ae=class{homeTeam={players:[]};awayTeam={players:[]}};var Br=class{minute="";type="";teamId="";player=null;relatedPlayer=null;updatedAt=""};var Nr=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 kr=class{id="";country=null;birthDate="";firstName="";lastName="";name="";position="";assets=null;isDeleted=!1;teams=[]};var Gr=class{id="";country=null;birthDate="";firstName="";lastName="";name="";position="";assets=null;isDeleted=!1;competitions=[];teams=[]};var Ur=class{id="";startDate="";endDate="";shirtNumber;loan=!1;position="";country=null;name="";assets=null;birthDate=""};var Vr=class{id="";country=null;birthDate="";firstName="";lastName="";name="";position="";assets=null};var bi=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 Ep=class{headshot=null};var Rp=class{id=null;name=null;country=null};var Hr=class{id="";name="";position="";shirtNumber;assets=null;type=""};var $r=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 Wr=class{id="";country=null;gender="";assets=null;name="";competitions=[];code="";national=!1;fullName="";shortName="";isDeleted=!1;undecided=!1;colors=new qr;squad=[]};var Sp=class{teamId=null;matches=[]};var zr=class{teams=null;players=null;competitions=null};var Qr=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 Vt=class{meta=new D;data=[]};var Cp=class{logo=null};var Fp=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 vp=class{apiKey;clientId;environment;idSchema;lang;errorHandlingMode;oddClient;cookieToken;authProvider};var K=class{main=null;cover=null;mobile=null};var Kr=class{colors=null;urls=null;images=null};var jr=class{primaryColor=null;secondaryColor=null;contentColor=null;backgroundColor=null;borderColor=null;additionalColor=null};var Yr=class{primaryUrl=null;secondaryUrl=null;privacyPolicyUrl=null;termsAndConditionsUrl=null;additionalUrl=null};var Xr=class{mainLogo=null;mobileLogo=null;backgroundImage=null;mobileBackgroundImage=null;additionalImage=null};var Ap=class{preferenceId="";categories=[];source=""};var Jr=class{input=null;output=null};var Zr=class{meta=new Jr;data=[]};var to=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 eo=class{general;predictor;topX;matchQuiz};var io=class{predictor;topX;matchQuiz;games;football;classicQuizzes;eitherOr;discussions;potm;poll};var Op=class extends Ie{};var Lp=class{count=0;breakdown=[]};var xp=class{footballCompetitions;footballTeams;footballPlayers};var ao=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 ro=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 oo=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 so=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 no=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 lo=class{position=null;points=null;predictionsMade=null;profileId=null;profileModel=null;successRatePercent=null};var Oe=class{templateId=null;privateLeagueId=null;fromDate=null;toDate=null;pagination=new z};var Dp=class{meta=new Oe;data=[]};var Ot=class{rankType=null;fromDate=null;toDate=null;pagination=new z};var Bp=class{meta=new Ot;data=[]};var Le=class{position=null;profileId=null;profileModel=null;points=null;predictionsMade=null};var po=class{flags="";status="";type="";activeFrom="";activeTo="";createdFrom="";createdTo="";updatedFrom="";updatedTo=""};var co=class{pagination=new z;filters=new po};var Np=class{id=null;points=null};var kp=class extends he{points;alternative;constructor(){super(),delete this.weight}};var uo=class extends Le{id=null;rankType=null;model=null;gameType=null};var Gp=class{meta=new Ot;data=[]};var mo=class{groupId;averagePoints;highestPoints};var Lt=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 K;status=null;automaticallyChangeStatus=!0;createdAt=null;updatedAt=null;related=null};var ho=class extends Lt{adContent=null};var fo=class{groupId=null;label=null;flags=[];filters=null};var go=class{fromDate=null;toDate=null;matchIds=[]};var Up=class{enabled=!1;id=null;label=null;points=null};var yo=class{value=null;target=null;playerId=null;playerModel=null;result=null};var bo=class{matchId=null;matchType=null;market=null;matchModel=null;matchStatus=new it;prediction=new yo};var Mo=class{gameId=null;results=null;tieBreakers=null};var mt=class{timeTiebreaker=!1};var It=class{id=null;title=null;description=null;type=null;status=null;authRequirement=null;outcome=null;predictionsCutoff=null;fixtures=[];tiebreaker=new mt;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 xe=class{id=null;title=null;alternativeTitle=null;description=null;type=null;images=new K;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 De=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 Io=class extends De{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 wo=class extends xe{rules=null;questions=[]};var _o=class{questionId=null;question=null;images=null;embedCode=null;explanation=null;options=[]};var Po=class{optionId=null;option=null;images=null;correct=null};var Vp=class{questionId=0;optionId=0};var To=class{classicQuizId=null;userId=null;questions=[];correctOptions=null;personalBest=null;points=null;attempts=null};var Eo=class{questionId=null;optionId=null;correct=null;correctOptionId=null};var Ro=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 So=class{classicQuizId=null;classicQuizModel=null;correct=null;classicQuizQuestions=null;personalBest=null;points=null;answers=[]};var Hp=class{meta=new w;data=[]};var Co=class{questionId=null;questionModel=null;wrong=null;correct=null;skipped=null;total=null};var Be=class{classicQuizIds=null};var Ne=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 Fo=class extends Ne{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 ke=class{pagination=new z;filters=new Be};var vo=class{position=null;profileId=null;profileModel=null;points=null};var Ao=class{position=null;classicQuizId=null;classicQuizModel=null;points=null};var $p=class{meta=new D;data=[]};var qp=class{meta=new ke;data=[]};var Ge=class{id="";title="";alternativeTitle="";description="";images=new K;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 Oo=class extends De{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 Lo=class extends Ge{rules=""};var xo=class{correctSteps=0;score=0};var Wp=class{meta=new w;data=[]};var Do=class{eitherOrId="";personalBest=0;betterThan=0};var Bo=class{instanceId="";eitherOrId="";gameStartedAt="";currentStep=0;currentStreak=0;remainingSteps=0;currentLives=0;currentPoints=0;personalBest=0;participationCount=0;finishedParticipationsCount=0;steps=[]};var No=class{pair="";answer=""};var ko=class extends No{expired=!1;time=0};var Go=class{main;mobile};var Mi=class{id="";label="";images=new Go;value=null};var Uo=class{pairId="";userSelection="";correct=null;played=null;timestamp="";optionOne=new Mi;optionTwo=new Mi};var Vo=class{rangeStartInclusive=0;rangeEndInclusive=0;totalUsers=0};var Ho=class{standings=[];breakdown=[]};var $o=class{userId="";userModel=null;personalBest=""};var Ue=class{content=null;tags=[];campaign=null};var Ve=class{id=null;model=null;source=null;type=null};var qo=class{questions=null;correctAnswers=null};var Wo=class{id=null;name=null;url=null;assets=[];links=[];branding=null;eventUrls=[];stakesDisclaimer=null;domainName=null};var zo=class{backgroundColor=null;textColor=null};var zp=class{appType=null;selectionTemplateUrl=null;eventTemplateUrl=null;homepageUrl=null};var Qo=class{logo=null;type=null;transparentBackgroundUrl=null;backgroundColor=null};var Ko=class{url=null;appType=null};var yc=(i=>(i.PRE_EVENT="PRE_EVENT",i.LIVE="LIVE",i.ALL="ALL",i))(yc||{}),bc=(e=>(e.ORDINARY_TIME="ORDINARY_TIME",e.FULL_TIME="FULL_TIME",e))(bc||{}),Mc=(i=>(i.DECIMAL="DECIMAL",i.MONEYLINE="MONEYLINE",i.FRACTIONAL="FRACTIONAL",i))(Mc||{});var Ic=(L=>(L.FT_1X2="FT_1X2",L.DOUBLE_CHANCE="DOUBLE_CHANCE",L.HT_FT="HT_FT",L.BOTH_TEAMS_SCORE="BOTH_TEAMS_SCORE",L.CORRECT_SCORE="CORRECT_SCORE",L.PLAYER_SCORE_FIRST_GOAL="PLAYER_SCORE_FIRST_GOAL",L.PLAYER_SCORE="PLAYER_SCORE",L.PLAYER_RED_CARD="PLAYER_RED_CARD",L.PLAYER_YELLOW_CARD="PLAYER_YELLOW_CARD",L.OVER_GOALS_0_5="OVER_GOALS_0_5",L.OVER_GOALS_1_5="OVER_GOALS_1_5",L.OVER_GOALS_2_5="OVER_GOALS_2_5",L.OVER_GOALS_3_5="OVER_GOALS_3_5",L.OVER_GOALS_4_5="OVER_GOALS_4_5",L.OVER_GOALS_5_5="OVER_GOALS_5_5",L))(Ic||{}),Dd={["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"},jo=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(yc),i=Object.values(bc),a=Object.values(Mc),r=Object.values(Ic);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":Dd[t]}};var Yo=class{type=null;scope=null;selections=[]};var Xo=class{id=null;type=null;name=null;entityType=null};var Jo=class{id=null;name=null;code=null;value=null;odds=null;urls=[];movement=null;oddsOld=null;entityType=null;additionalInfo=null;providerInfo=null};var Zo=class{id=null;name=null;code=null;entityType=null};var ts=class{selectionId=null;eventId=null;marketId=null;competitionId=null};var es=class{bookmaker=null;type=null;markets=[]};var Qp=class{main=null;all=null};var is=class{value=null;playerId=null;playerModel=null;playerRole};var He=class{market=null;matchId=null;matchType=null;matchModel=null;prediction=new is;result=null};var $e=class{settledAt=null;resettledAt=null;status=null;outcome=null;points=0};var at=class{value=!1};var as=class{matchId=null;market="BOTH_TEAMS_SCORE";matchType="FOOTBALL";prediction=null;constructor(t,e){this.matchId=t,this.prediction=new at,this.prediction.value=e}};var rs=class{value};var os=class{matchId=null;market="CORNERS_MATCH";matchType="FOOTBALL";prediction=null;constructor(t,e){this.matchId=t,this.prediction=new rs,this.prediction.value=e}};var ss=class{value=null};var xt=class{matchId=null;market=null;matchType="FOOTBALL";prediction=null;constructor(t,e,i){this.matchId=t,this.market=e,this.prediction=new ss,this.prediction.value=i}};var ns=class{value=null};var ls=class{matchId=null;market="DOUBLE_CHANCE";matchType="FOOTBALL";prediction=null;constructor(t,e){this.matchId=t,this.prediction=new ns,this.prediction.value=e}};var ps=class{value=null};var cs=class{matchId=null;market="HT_FT";matchType="FOOTBALL";prediction=null;constructor(t,e){this.matchId=t,this.prediction=new ps,this.prediction.value=e}};var ds=class{value=null};var us=class{matchId=null;market=null;matchType="FOOTBALL";prediction=null;constructor(t,e,i){this.matchId=t,this.market=e,this.prediction=new ds,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 at,this.prediction.value=i}};var We=class{matchId=null;market=null;matchType="FOOTBALL";prediction=null;constructor(t,e,i){this.matchId=t,this.market=e,this.prediction=new at,this.prediction.value=i}};var ms=class{matchId=null;market="PENALTY_MATCH";matchType="FOOTBALL";prediction=null;constructor(t,e){this.matchId=t,this.prediction=new at,this.prediction.value=e}};var hs=class{value=!1;playerId=null};var rt=class{matchId=null;market=null;matchType="FOOTBALL";prediction=null;constructor(t,e,i,a){this.matchId=t,this.market=e,this.prediction=new hs,this.prediction.value=i,this.prediction.playerId=a}};var fs=class{matchId=null;market="RED_CARD_MATCH";matchType="FOOTBALL";prediction=null;constructor(t,e){this.matchId=t,this.prediction=new at,this.prediction.value=e}};var Kp=class{home=null;draw=null;away=null};var jp=class{score=null;percentage=null};var ze=class{homeGoals=null;awayGoals=null};var gs=class{playerId=null;playerModel=null};var ys=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 gs;PLAYER_SCORE=[];PLAYER_SCORE_TWICE=[];PLAYER_SCORE_HATTRICK=[];CORRECT_SCORE=new ze;CORRECT_SCORE_ADVANCED=new ze;CORRECT_SCORE_HT=new ze;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 O=class{no=0;yes=0};var Qe=class{gameInstanceId=null;fixtures=null};var ht=class{goldenGoal=null};var Ii=class{id=null;gameInstanceId=null;gameType=null;wager=null;totalFixtures=null;settledFixtures=null;userId=null;fixtures=[];status=null;tiebreaker=new ht;points=null;templateId=null;groupId=null;profileLastUpdatedAt=null;createdAt=null;updatedAt=null};var Ln=(r=>(r.ACTIVE="ACTIVE",r.WON="WON",r.LOST="LOST",r.PARTIALLY_WON="PARTIALLY_WON",r.CANCELED="CANCELED",r))(Ln||{}),wc=["WON","LOST","PARTIALLY_WON","CANCELED"];var G=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(Ln).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 bs=class{fullTimeOneXTwo={};halfTimeOneXTwo={};bothTeamsScore=new O;doubleChance={};halfTimeFullTime={};playerScore={};playerYellowCard={};playerRedCard={};redCardMatch=new O;penaltyMatch=new O;playerScoreFirstGoal={};cornersMatch={};correctScore={};correctScoreHalfTime={};correctScoreAdvanced={};playerScoreHattrick={};playerScoreTwice={};overZeroPointFiveGoals=new O;overOnePointFiveGoals=new O;overTwoPointFiveGoals=new O;overThreePointFiveGoals=new O;overFourPointFiveGoals=new O;overFivePointFiveGoals=new O;overSixPointFiveGoals=new O;overSixPointFiveCorners=new O;overSevenPointFiveCorners=new O;overEightPointFiveCorners=new O;overNinePointFiveCorners=new O;overTenPointFiveCorners=new O;overElevenPointFiveCorners=new O;overTwelvePointFiveCorners=new O;overThirteenPointFiveCorners=new O};var Ms=class{matchId=null;matchType=null;predictions=null};var Is=class{profileId="";profileModel=null;leagueId="";leagueModel=null;message=""};var Yp=class{id=null;name=null;model=new Lt};var Ke=class{id="";name="";description="";type="";banned=[];invites=[];administrators=[];membersCount=0;invitationCode="";templateId="";templateModel=null;pastTemplates=[];usersCanInviteUsers=!1;scoringStartsAt="";pinnedPosts=[]};var ws=class extends Ke{members=[]};var Xp=class{name="";description="";invitationCode="";templateId="";usersCanInviteUsers=!1;administrators=[];scoringStartsAt=""};var Jp=class{name="";description="";invitationCode="";templateId="";usersCanInviteUsers=!1;administrators=[];pinnedPosts=[];scoringStartsAt=""};var _s=class{predictionId=null;predictionModel=null;profileId=null;profileModel=null};var Zp=class{meta=new D;data=[]};var tc=class{meta=new w;data=[]};var je=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 Ps=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 Ts=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 Ye=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 Xe=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 Es=class{templateId="";templateModel=null;privateLeagueId="";privateLeagueModel=null;position="";points=0;type="private_league"};var Rs=class extends Ee{type="PRIVATE"};var Ss=class extends Re{type="PRIVATE"};var Cs=class{id="";source="";type="";favourite=!1};var Fs=class extends Cs{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 vs=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(Ft).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 As=class extends P{};var Os=class{matchId=null;matchType=null;market=null;matchModel=null;matchStatus=new it};var Ls=class{value=null;result=null};var xs=class{matchId=null;matchType=null;market=null;matchModel=null;matchStatus=new it;prediction=new Ls};var wt=class{id=null;title=null;description=null;type=null;status=null;authRequirement=null;scheduleOpenAt=null;predictionsCutoff=null;fixtures=[];tiebreaker=new mt;participantsCount=0;related=[];excludedProfileIds=null;rules=null;labels=null;customFields=null;branding=null;flags=null;images=new K;createdAt=null;updatedAt=null};var Je=class extends wt{adContent=null};var Ht=class{userId=null;points=null;results=[];tiebreaker=null};var Ds=class{matchId=null;matchModel=null;outcome=null};var ot=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(Ft).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 Dt=class{id=null;title=null;description=null;type=null;status=null;authRequirement=null;outcome=null;predictionsCutoff=null;fixtures=[];tiebreaker=new mt;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 ht;branding=null};var Bs=class{contestId="";contestType="GAME";contestModel=null;description="";userList=[]};var Ns=class{position="";profileId="";profileModel=null;note="";tags=[]};var Ze=class{gameInstanceId=null;fixtures=[];tiebreaker=null;constructor(t){this.gameInstanceId=t.gameInstanceId,t.fixtures.forEach(e=>this.fixtures.push(new xt(e.matchId,e.market,e.prediction.value))),this.tiebreaker=t.tiebreaker?t.tiebreaker:null}};var ti=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 ei=class{id=null;title=null;alternativeTitle=null;description=null;type=null;images=new K;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 ks=class extends ei{rules=null};var Gs=class{id=null;title=null;description=null;images=new K;votes=null;embedCode=null;preferencesMapping=[]};var Us=class{preferenceId=""};var ii=class{id=null;pollId=null;optionId=null;optionIds=[];userId=null};var Vs=class extends ii{pollModel=null;optionModel=null;optionsModels=[]};var Hs=class{meta=new w;data=[]};var $s=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 Ws=class{meta=new w;data=[]};var zs=class{matchId=null;matchModel=null;playerId=null;playerModel=null;createdAt=null};var Qs=class{total};var Ks=class{meta=new Qs;data=[]};var js=class{teamId=null;teamModel=null;playerId=null;playerModel=null;votes=null;winner=null};var Ys=class{meta=new D;data=[]};var xn=class{remapListContent=t=>{let e=new Ys;return e.meta=this.remapMeta(t.meta),e.data=t.data.map(i=>{let a=new Xa;return a.entityId=i.entity_id,a.entityType=i.entity_type,a}),e};remapMeta=t=>{let e=new D;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 $=class extends C{featureConfigRemapper=null;listContentRemapper=null;localStorage=null;clientId=null;constructor(t){super(t,F(t.environment,"client")),this.clientId=t.clientId,this.localStorage=new lt().createLocalCacheInstance(t.idSchema),this.featureConfigRemapper=new On,this.listContentRemapper=new xn}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 _t=class{clientHttps=null;errorHandlingMode=null;constructor(t){this.clientHttps=new $(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 D;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 Dn=class{footballService=null;https=null;idMapping=null;constructor(t,e,i){this.idMapping=i,this.https=e,this.footballService=new _t(t)}getTeamsIdMapping=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.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 yi({teamIds:t,limit:i}),{data:r}=await this.getTeams(a);r.sort((l,p)=>l.id.localeCompare(p.id));let o=dp(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 $t=class{https=null;footballService=null;idMapping=null;constructor(t,e,i){this.idMapping=i,this.https=e,this.footballService=new _t(t)}getPlayersIdMapping=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.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 bi({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=te(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 qt=class{https=null;idMapping=null;footballService=null;constructor(t,e,i){this.https=e,this.idMapping=i,this.footballService=new _t(t)}getMatchesIdMapping=async(t,e)=>{try{if(t){if(t=new At(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 At({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=te(t);i.sort((r,o)=>r.localeCompare(o));let a=await this.getMatchesWithNativeIds(Array.from(i));if(i.length!==a.length){let r=new At({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 Bn=class{https=null;idMapping=null;constructor(t,e){this.https=t,this.idMapping=e}searchIdMapping=async(t,e)=>{try{if(t=new Qr(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 Y=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 Nn=class extends Y{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 wi=class{countriesFacade=null;competitionsFacade=null;teamsFacade=null;playerFacade=null;matchFacade=null;searchFacade=null;validator=null;constructor(t,e,i,a){this.countriesFacade=new vn(e,i,a),this.competitionsFacade=new An(e,i,a),this.teamsFacade=new Dn(t,i,a),this.playerFacade=new $t(t,i,a),this.matchFacade=new qt(t,i,a),this.searchFacade=new Bn(i,a),this.validator=new Nn(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 H=class{countriesFromResponse=t=>{if(t)return t.map(e=>this.countryFromResponse(e))};countryFromResponse=t=>{try{if(t){let e=new Ar;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 X=class{countryRemapper=null;constructor(){this.countryRemapper=new H}fromResponse(t){try{let e=new Fr;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 W=class{countryRemapper=null;constructor(){this.countryRemapper=new H}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.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 kn=class{countryRemapper=null;teamBasicRemapper=null;constructor(){this.countryRemapper=new H,this.teamBasicRemapper=new W}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.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 Gn=class{countryRemapper=null;constructor(){this.countryRemapper=new H}fromResponse(t){try{let e=new Ur;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 Un=class{countryRemapper=null;competitionRemapper=null;playerRemapper=null;constructor(){this.countryRemapper=new H,this.competitionRemapper=new X,this.playerRemapper=new Gn}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.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 _i=class{fromResponse(t){try{let e=new Dr;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 Vn=class{teamRemapper=null;competitionRemapper=null;scoresRemapper=null;constructor(){this.teamRemapper=new W,this.competitionRemapper=new X,this.scoresRemapper=new _i}fromResponse(t){try{let e=new Or;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 Hn=class{fromResponse(t){try{let e=new xr;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 Pi=class{fromResponse(t){try{let e=new Hr;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 $n=class{playerRemapper=null;constructor(){this.playerRemapper=new Pi}fromResponse(t){try{let e=new Ae;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 Pi}fromResponse(t){try{let e=new Br;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 Wn=class{fromResponse(t){try{let e=new Nr;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 zn=class{teamMapper=null;competitionsMapper=null;lineupsMapper=null;scoresMapper=null;statsMapper=null;timelineMapper=null;playerStatsMapper=null;constructor(){this.teamMapper=new W,this.competitionsMapper=new X,this.lineupsMapper=new $n,this.scoresMapper=new _i,this.statsMapper=new Hn,this.timelineMapper=new qn,this.playerStatsMapper=new Wn}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=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 Ae,e}catch(e){throw console.warn("There was a problem remapping the match response",e),e}}};var Qn=class{countryRemapper=null;constructor(){this.countryRemapper=new H}fromResponse(t){try{let e=new Vr;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 Ti=class{countryRemapper=null;teamRemapper=null;constructor(){this.countryRemapper=new H,this.teamRemapper=new W}fromResponse(t){try{let e=new kr;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 Kn=class{countryRemapper=null;teamRemapper=null;competitionRemapper=null;constructor(){this.countryRemapper=new H,this.teamRemapper=new W,this.competitionRemapper=new X}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.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 jn=class{teamRemapper=null;playerRemapper=null;competitionremapper=null;constructor(){this.teamRemapper=new W,this.playerRemapper=new Ti,this.competitionremapper=new X}fromResponse(t){try{let e=new zr;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 Yn=class{remapMetaProp=t=>{let e=new D;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 Xn=class{remapPlayersPoints=t=>{let e=new Rr;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 _r;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 Sr;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 Fe;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 ve;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 pt=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,F(t.environment,"football")),this.apiSignInUrl=t.lang!=="en"?this.apiSignInUrl+`&lang=${t.lang}`:this.apiSignInUrl,this.countryRemapper=new H,this.competitionBasicRemapper=new X,this.competitionFullRemapper=new kn,this.teamBasicRemapper=new W,this.teamFullRemapper=new Un,this.matchBasicRemapper=new Vn,this.matchFullRemapper=new zn,this.playerBasicRemapper=new Ti,this.playerFullRemapper=new Kn,this.topPlayerRemapper=new Qn,this.searchRemapper=new jn,this.footballMetaRemapper=new Yn,this.footballService=new _t(t),this.fantasyRemapper=new Xn}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=oi(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=oi(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 Vt,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=oi(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 Vt;return l.data=n,l}else{let r=new Vt,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 Vt,a="There was a problem with football matches request";if(t&&t.matchIds&&t.matchIds.length>this.limitIds){let r=[],o=oi(t.matchIds,this.limitIds);for(let l of o){t.matchIds=l,t.limit=l.length;let p=!0,c=`/matches${this.apiSignInUrl}${t.constructFilterUrl(p)}&limit=${l.length}`;e&&(c+=f());let d=await this.fetchWithoutAuth(c,a);r.push(d.data.map(u=>this.matchBasicRemapper.fromResponse(u)))}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 Jn=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 Fs;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 Zn=class{idMapping=null;profileOperations=null;constructor(t,e){this.idMapping=new E(t),this.profileOperations=new Jn(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 U=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 mi(t),this.activityHttps=new ni(t),this.footballHttps=new pt(t),this.idMapping=new E(t),this.localCache=new lt().createLocalCacheInstance(t.idSchema),this.footballFacade=new wi(t,this.localCache,this.footballHttps,this.idMapping),this.profileFacade=new Mt(this.localCache,this.profileHttps,this.activityHttps,t.errorHandlingMode),this.idsRemapper=new Zn(t,this.footballFacade),this.ownProfileBuilder=new Fn(t,this.idsRemapper,this.localCache,this.profileHttps,this.activityHttps),this.profileBuilder=new fi(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)};var tl=class extends P{};var ad=(r=>(r.LIKE="like",r.DISLIKE="dislike",r.SHARE="share",r.COMMENT="comment",r.PREDICTION_MADE="prediction_made",r))(ad||{});var rd=(a=>(a.CORRECT="CORRECT",a.INCORRECT="INCORRECT",a.PARTIALLY_CORRECT="PARTIALLY_CORRECT",a.NOT_VERIFIED="NOT_VERIFIED",a))(rd||{});var el=(i=>(i.ONE="1",i.X="x",i.TWO="2",i))(el||{}),il=(i=>(i.ONE_X="1x",i.X_TWO="x2",i.ONE_TWO="12",i))(il||{}),al=(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))(al||{});var rl=class extends Y{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 tr);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 ol=class{https=null;validator=null;profile=null;constructor(t){this.https=new di(t),this.profile=new U(t),this.validator=new rl(t.errorHandlingMode)}getGames=async(t,e)=>(t&&(t=new er(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 Za(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 tl(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 sl=class{facade=null;constructor(t){this.facade=new ol(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 nl=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 Ot;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 Oe;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 Le;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 mo;return e.groupId=t.group_id,e.averagePoints=t.average_points,e.highestPoints=t.highest_points,e}};var ll=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 D;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 uo;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 Es;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 nr;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 ct=class{remapBranding=t=>{let e=new Kr;return t.colors&&(e.colors=new jr,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 Yr,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 Xr,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 cl=class extends ct{remapResponse=t=>{let e=[];return t.forEach(i=>{let a=new Lt;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 ho;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 co;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 fo;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 go;return e.fromDate=t.from_date,e.toDate=t.to_date,e.matchIds=t.match_ids,e}};var dl=class{remapHighestSuccessRate=t=>t.map(e=>{let i=new lo;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 Pt=class extends C{templateRemapper=null;leaderboardRemapper=null;rankingsRemapper=null;highestSuccessRateRemapper=null;constructor(t){super(t,F(t.environment,"loyalty")),this.templateRemapper=new cl,this.leaderboardRemapper=new nl,this.rankingsRemapper=new ll,this.highestSuccessRateRemapper=new dl}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 ul=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 ws;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 Ke;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 Is;return e.profileId=t.profile_id,e.leagueId=t.league_id,e.message=t.message,e};remapToAcceptChallenge=t=>{let e=new ir;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 D;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 _s;return i.predictionId=e.prediction_id,i.profileId=e.profile_id,i})};var Ei=class{remapToDiscussions=t=>(t.meta=this.remapToMeta(t.meta),t.data=t.data.map(e=>this.remapToDiscussionById(e)),t);remapToDiscussionById=t=>{let e=new lr;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 ur,a=new mr;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 hr;return e.meta=this.remapToMeta(t.meta),e.data=t.data.map(i=>this.remapToPostByIdBasic(i)),e};remapToPostMeta=t=>{let e=new vt;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 Se;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 pr;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 dr;return i.id=e.id,i.postsCount=e.posts_count,i});remapReactionsPost=t=>{let e=new fr;return e.type=t.type,e.userIds=t.user_ids,e.reactionCount=t.reaction_count,e};remapVersionsPost=t=>{let e=new yr;return e.content=t.content,e.updatedAt=t.updated_at,e};remapReportPost=t=>{let e=new gr;return e.userId=t.user_id,e.reason=t.reason,e.reasonDetails=t.reason_details,e}};var Ri=class extends C{remapper=null;discussionsRemapper=null;discussionsBaseURL=null;constructor(t){super(t,F(t.environment,"privateLeagues")),this.discussionsBaseURL=F(t.environment,"discussions"),this.remapper=new ul,this.discussionsRemapper=new Ei}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 Si=class{createRequestBodyFromParam=(t,e)=>{let i=e==="PRIVATE"?new Rs:new ar;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 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,i.administrators=t.administrators,i.pinned_posts=t.pinnedPosts,i.scoring_starts_at=t.scoringStartsAt,i}};var J=class{https=null;idMapping=null;localCache=null;footballFacade=null;constructor(t){this.https=new pt(t),this.idMapping=new E(t),this.localCache=new lt().createLocalCacheInstance(t.idSchema),this.footballFacade=new wi(t,this.localCache,this.https,this.idMapping)}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)};var ml=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 rt)e.market=t.market,e.prediction=t.prediction.value,e.player_id=t.prediction.playerId;else if(t instanceof qe||t instanceof We)e.market=t.market,e.prediction=t.prediction.value;else if(t instanceof xt){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 He;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 $e;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 ic=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}}},Tt=ic;Z(Tt,"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"),Z(Tt,"createDoubleChanceResult",t=>t?.ftScore?.homeGoals>t?.ftScore?.awayGoals?["1x","12"]:t?.ftScore?.homeGoals===t?.ftScore?.awayGoals?["1x","x2"]:["x2","12"]),Z(Tt,"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"}}),Z(Tt,"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))),Z(Tt,"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 ic.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])}),ic.transformPlayerMarketResult(o)}),Z(Tt,"transformPlayerMarketResult",t=>t.map(e=>({playerId:e.id,playerModel:e})));var Et=class{footballHttps=null;idMapping=null;matchFacade=null;playerFacade=null;profileNamespace=null;constructor(t,e){this.footballHttps=new pt(t),this.idMapping=e,this.matchFacade=new qt(t,this.footballHttps,e),this.playerFacade=new $t(t,this.footballHttps,e),this.profileNamespace=new U(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=te(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=Fc.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(gt.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 O,r[a][n]):r[a][i]}else if(gt.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 Me){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 be||t instanceof ye){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 wt||a instanceof Dt||a instanceof It||a instanceof Je?(a.fixtures.forEach(r=>e.push(r.matchId)),a instanceof It&&a.fixtures.forEach(r=>{r.prediction.playerId&&r.prediction.playerId!=="OWN_GOAL"&&i.push(r.prediction.playerId)})):a instanceof Ht&&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 wt||n instanceof Dt||n instanceof It?(n.fixtures.forEach(l=>{this.handleMatchModel(r,l),n instanceof It&&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 Ht&&(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 G(i),i};initGameFilters=(t,e,i)=>{if(e&&i)return e.type=t,e.gameIds=i,e=new ot(e),e;if(e&&!i)return e.type=t,e=new ot(e),e;if(!e&&i){let a={type:t,gameIds:i};return a=new ot(a),a}else{let a={type:t};return a=new ot(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 Dt&&(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 $e;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 G(t));break;case"current":if(t)this.deleteUnexpectedProperties(t),t.status=["ACTIVE"],t=new G(t);else{let a={status:["ACTIVE"]};t=new G(a)}break;case"past":if(t)this.deleteUnexpectedProperties(t),t.status=wc,t=new G(t);else{let a={status:wc};t=new G(a)}break;case"matches":if(t)this.deleteUnexpectedProperties(t),t.matchIds=i,t=new G(t);else{let a={matchIds:i};t=new G(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=>gt.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[B[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[B[this.idMapping.idSchema]]})};deleteUnexpectedProperties=t=>(t.status&&(console.warn(cc.UNEXPECTED_STATUS_PROP),delete t.status),t.type&&(console.warn(cc.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 ys;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)),Tt.createMatchMarketsResultsModel(e,a)}};var Ci=class{fixturesRemapper=null;footballHttps=null;matchFacade=null;playerFacade=null;predictorService=null;constructor(t,e){this.footballHttps=new pt(t),this.matchFacade=new qt(t,this.footballHttps,e),this.playerFacade=new $t(t,this.footballHttps,e),this.predictorService=new Et(t,e),this.fixturesRemapper=new ml(this.matchFacade,this.playerFacade,this.predictorService)}remapRequestBody=t=>{if(t instanceof Ce)return t;let e={};return e.game_instance_id=t.gameInstanceId,e.fixtures=t.fixtures.map(i=>this.fixturesRemapper.remapFixturesRequest(i)),t instanceof Ze&&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 Ii,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 He;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 Ii;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 bs;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 hl=class{remapPredictions=null;constructor(t,e){this.remapPredictions=new Ci(t,e)}remapResponse=t=>{let e=new Ms;return e.matchId=t.match_id,e.matchType=t.match_type,e.predictions=this.remapPredictions.remapPredictionModel(t.predictions),e}};var fl=class extends ct{remapPaginatedGames=t=>{let e=new V;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 wt;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 Je;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 Os;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 V;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 Dt;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 xs;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 V;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 It;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 bo;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 V;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 Ht;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 Mo;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 Bs;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 Ns;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 it;return t&&(e.type=t.type,e.subType=t.sub_type),e};remapMarketResult=(t,e)=>{if(Sc.includes(t))return e[0];if(gt.includes(t))return e;if(e[0]==="true")return!0;if(e[0]==="false")return!1};deleteUnusefulField=t=>((!gt.includes(t.market)||this.isPlayerMarketWithNoResult(t.market,t.result))&&delete t.playerModels,t);isPlayerMarketWithNoResult=(t,e)=>gt.includes(t)&&e.length===0;remapResults=t=>{let e=new Ds;return e.matchId=t.match_id,e.outcome=t.outcome,e};remapTiebreaker=t=>{let e=new ht;return e.goldenGoal=t.golden_goal,e};remapTimeTiebreaker=t=>{let e=new mt;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 gl=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 dt=class extends C{predictionRemapper=null;matchSummaryRemapper=null;gamesRemapper=null;metaRemapper=null;constructor(t,e){super(t,F(t.environment,"predictor")),this.predictionRemapper=new Ci(t,e),this.matchSummaryRemapper=new hl(t,e),this.gamesRemapper=new fl,this.metaRemapper=new gl}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 V,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 V,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)};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 V,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 Wt=class{errorHandlingMode=null;constructor(t){this.errorHandlingMode=t}validateBodyFields=(t,e)=>{let i=Object.keys(e),a=Object.keys(new Qe);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(el),o=Object.values(al),n=Object.values(il);if(e==="FT_1X2"||e==="HT_1X2"){if(r.includes(i))return new us(t,e,i)}else if(e==="HT_FT"){if(o.includes(i))return new cs(t,i)}else if(e==="DOUBLE_CHANCE"){if(n.includes(i))return new ls(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 xt(t,e,i)}else if(e==="CORNERS_MATCH"){if(typeof i=="number")return new os(t,i)}else if(e==="BOTH_TEAMS_SCORE"){if(this.isPredictionBoolean(i))return new as(t,i)}else if(e==="RED_CARD_MATCH"){if(this.isPredictionBoolean(i))return new fs(t,i)}else if(e==="PENALTY_MATCH"){if(this.isPredictionBoolean(i))return new ms(t,i)}else if(gt.includes(e)){let l="OWN_GOAL";if(this.validatePlayerId(e,a),e===Vi&&this.isPredictionBoolean(i)){let p=a&&a===l?l:a;return new rt(t,e,i,p)}if(a&&this.isPredictionBoolean(i))return new rt(t,e,i,a)}else if(Ec.includes(e)){if(this.isPredictionBoolean(i))return new We(t,e,i)}else if(Rc.includes(e)&&this.isPredictionBoolean(i))return new qe(t,e,i);this.throwInvalidPredictionException(i,e)};validateFixtureFields=t=>{let e=Object.keys(t);e.forEach(a=>{pc.includes(a)||this.throwInvalidParamException([a])});let i=pc.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 ht)[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){gt.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!==Vi&&(e||this.throwInvalidParamException([i]),typeof e!="string"&&this.throwInvalidType(i,"string"))};validateMarket=t=>{Object.values(tt).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=vc(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=Ac(t):i=mp(t),this.errorHandlingMode==="default"?new y(400,"INVALID_MARKET",i):new m(400,"INVALID_TYPE",i)};throwInvalidParamException=t=>{let e=Oc(t);throw this.errorHandlingMode==="default"?new y(400,"INVALID_FIELD",e):new m(400,"INVALID_TYPE",e)};throwMissingFieldsException=(t,e)=>{let i=Lc(t,e);throw this.errorHandlingMode==="default"?new y(400,"INVALID_FIELD",i):new m(400,"INVALID_TYPE",i)};throwInvalidType=(t,e)=>{let i=xc(t,e);throw this.errorHandlingMode==="default"?new y(400,"INVALID_TYPE",i):new m(400,"INVALID_TYPE",i)}};var Fi=class{predictorHttps=null;predictorService=null;idMapping=null;clientHttps=null;predictorValidator=null;errorHandlingMode=null;constructor(t){this.predictorValidator=new Wt(t.errorHandlingMode),this.idMapping=new E(t),this.predictorHttps=new dt(t,this.idMapping),this.predictorService=new Et(t,this.idMapping),this.clientHttps=new $(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 rt&&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 rt&&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)};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 G(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 ot(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 V};getMyGamePrediction=async t=>{let e=new G({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 V};getUserGamePrediction=async(t,e,i)=>{i=i||!1;let a=new G({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 yl=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 zt=class{matchQuizFacade=null;helpers=new yl;constructor(t){this.matchQuizFacade=new Fi(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 bl=class extends ct{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 wo;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 To;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 So;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 bt;return e.itemsPerPage=t.items_per_page,e.nextPageStartsAfter=t.next_page_starts_after,e};remapClassicQuizLeaderboardMeta=t=>{let e=new ke;return e.pagination=this.remapMetaPaginationRank(t.pagination),e.filters=this.remapLeaderboardMetaFilters(t.filters),e};remapMetaPaginationRank=t=>{let e=new z;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 Be;return e.classicQuizIds=t?.classic_quiz_ids||null,e};remapClassicQuizUserRanking=t=>{let e=new Ao;return e.position=t.position,e.classicQuizId=t.classic_quiz_id,e.points=t.points,e};remapBasicClassicQuiz=t=>{let e=new xe;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 _o;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 Po;return e.optionId=t.option_id,e.option=t.option,e.images=t.images,e.correct=t.correct,e};remapParticipationQuestions=t=>{let e=new Eo;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 vo;return e.position=t.position,e.profileId=t.profile_id,e.points=t.points,e};remapContext=t=>{let e=new Ue;return e.content=t.content,e.tags=t.tags?t.tags.map(i=>{let a=new Ve;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 Ml=class extends ct{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 Lo;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 Do;return e.eitherOrId=t.either_or_id,e.personalBest=t.personal_best,e.betterThan=t.better_than,e};remapEitherOrResults=t=>{let e=new Ho;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 Bo;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 Ge;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 bt;return e.itemsPerPage=t.items_per_page,e.nextPageStartsAfter=t.next_page_starts_after,e};remapPoints=t=>{let e=new xo;return e.correctSteps=t.correct_steps,e.score=t.score,e};remapResultsStandings=t=>{let e=new $o;return e.userId=t.user_id,e.personalBest=t.personal_best,e};remapResultsBreakdown=t=>{let e=new Vo;return e.rangeStartInclusive=t.range_start_inclusive,e.rangeEndInclusive=t.range_end_inclusive,e.totalUsers=t.total_users,e};remapParticipationSteps=t=>{let e=new Uo;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 Ue;return e.content=t.content,e.tags=t.tags?t.tags.map(i=>{let a=new Ve;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 vi=class extends C{classicQuizRemapper=null;eitherOrRemapper=null;constructor(t){super(t,F(t.environment,"miniGames")),this.classicQuizRemapper=new bl,this.eitherOrRemapper=new Ml}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 Qt=class extends Y{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 Il=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 E(t),this.validator=new Qt(t),this.profile=new U(t),this.football=new J(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 ko;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 wl=class{https=null;service=null;activityService=null;idSchema=null;constructor(t){this.https=new vi(t),this.service=new Il(t),this.activityService=new yt(t),this.idSchema=t.idSchema}getClassicQuizzes=async(t,e,i)=>{t&&(t=new Io(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 Ro(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 Fo(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 Ne(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 Oo(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 Kt=class{facade=null;constructor(t){this.facade=new wl(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 Ai=class{idMapping=null;predictorHttps=null;predictorService=null;predictorValidator=null;clientHttps=null;errorHandlingMode=null;constructor(t,e){this.idMapping=e,this.errorHandlingMode=t.errorHandlingMode,this.predictorValidator=new Wt(t.errorHandlingMode),this.predictorHttps=new dt(t,e),this.predictorService=new Et(t,e),this.clientHttps=new $(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)};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 G(e)),await this.predictorHttps.getGamePredictions(t,i,e));getGameResults=async(t,e,i)=>{i=i||!1,e&&(e=new ot(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 ot(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 Ze(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 V};getMyGamePrediction=async t=>{let e=new G({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 V};getUserGamePrediction=async(t,e,i)=>{i=i||!1;let a=new G({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 _l=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 jt=class{topXFacade=null;idMapping=null;helpers=new _l;constructor(t){this.idMapping=new E(t),this.topXFacade=new Ai(t,this.idMapping)}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 Pl=class{idMappingService=null;profileNamespace=null;footballNamespace=null;topXNamespace=null;matchQuizNamespace=null;miniGamesNamespace=null;errorHandlingMode=null;constructor(t){this.idMappingService=new E(t),this.profileNamespace=new U(t),this.footballNamespace=new J(t),this.topXNamespace=new jt(t),this.matchQuizNamespace=new zt(t),this.miniGamesNamespace=new Kt(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 eo;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 io;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 oo(t));break;case"rankings":t&&(t=new so(t));break;case"league_leaderboard":t&&(t=new ro(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};initMatchFiltersForTemplates=(t,e)=>{let i=[],a=[],r=[],o=this.reformatDate(t.fromDate),n=this.reformatDate(t.toDate,!0),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)),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=this.reformatDate(c.filters.fromDate),n=this.reformatDate(c.filters.toDate,!0);let d=c.filters.matchIds.every(u=>u);c.filters.matchIds.length>0&&d&&(r=Array.from(c.filters.matchIds))}return new At({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.topXNamespace.getGames({gameIds:t});r=[...r,...o.data]}if(e.length){let o=await this.matchQuizNamespace.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 Tl=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(tt).includes(t)){let a=mp(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 El=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 Rl=class{config=null;clientHttps=null;loyaltyHttps=null;loyaltyService=null;profileFacade=null;loyaltyValidator=null;idMapping=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 Mt(r,a),this.loyaltyService=new Pl(this.config),this.loyaltyValidator=new Tl,this.idMapping=new E(t),this.topXFacade=new Ai(t,this.idMapping),this.matchQuizFacade=new Fi(t),this.predictorHttps=new dt(t,this.idMapping),this.errorHandlingMode=t.errorHandlingMode,this.football=new J(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 no(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 El(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 ao(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.groups||a.groups.length===0))return[];let r=this.loyaltyService.initMatchFiltersForTemplates(a,e);return(await this.football.getMatches(r,i)).data}};var Yt=class{clientHttps=null;profileHttps=null;loyaltyHttps=null;loyaltyFacade=null;localCache=null;constructor(t){this.clientHttps=new $(t),this.profileHttps=new mi(t),this.loyaltyHttps=new Pt(t),this.localCache=new lt().createLocalCacheInstance(t.idSchema),this.loyaltyFacade=new Rl(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 Sl=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 Wt(t.errorHandlingMode),this.predictorService=new Et(t,a)}makeFootballPrediction=async(t,e,i,a)=>{let r=this.predictorValidator.validateFixture(t,e,i,a),o=new Qe;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 rt&&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!==Vi&&!r.prediction.playerId)throw new y(400,"INVALID_FIELD","Player id is invalid!").errorMessage();if(this.errorHandlingMode==="standard"&&r.market!==Vi&&!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 Y{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 Fl=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 Oi=class{predictorHttps=null;clientHttps=null;predictorFacade=null;idMapping=null;helpers=null;constructor(t){this.idMapping=new E(t),this.predictorHttps=new dt(t,this.idMapping),this.clientHttps=new $(t),this.predictorFacade=new Sl(t,this.predictorHttps,this.clientHttps,this.idMapping),this.helpers=new Fl(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 Li=class{loyalty=null;profile=null;predictor=null;constructor(t){this.loyalty=new Yt(t),this.profile=new U(t),this.predictor=new Oi(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 Xt=class{idSchema=null;profile=null;validator=null;idMapping=null;constructor(t){this.idSchema=t.idSchema,this.profile=new U(t),this.validator=new Qt(t),this.idMapping=new E(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 vl=class{factory=null;https=null;loyaltyHttps=null;profile=null;service=null;discussionsService=null;constructor(t){this.factory=new Si,this.https=new Ri(t),this.service=new Li(t),this.loyaltyHttps=new Pt(t),this.profile=new U(t),this.discussionsService=new Xt(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 sr(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 or(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 je(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 Ye(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 Xe(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 Al=class{facade=null;constructor(t){this.facade=new vl(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 Ol=class extends C{remapper=null;constructor(t){super(t,F(t.environment,"discussions")),this.remapper=new Ei}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 Ll=class{createRequestBodyFromParam=t=>{let e=new cr;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 xl=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 Ol(t),this.clientHttps=new $(t),this.activityService=new yt(t),this.service=new Xt(t),this.factory=new Ll}getAll=async(t,e)=>{t&&(t=new br(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 Ut(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 Ut(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 Ut(t)),await this.https.getOwnPosts(t));getUserPosts=async(t,e,i)=>(e&&(e=new Ut(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 Mr(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 Dl=class{facade=null;constructor(t){this.facade=new xl(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 Bd=["minutesPlayed","cleanSheets","concededGoals","saves","penaltySaved","penaltyCommitted","yellowCards","redCards","assists","foulsCommitted","ownGoals","goals","tackles","shotsOn"],Nd=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"),xi=class{static createFantasyPrediction(t,e,i,a){let r=new Ce;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 Bd.map(e=>{let i=new Pr,a=t.data.reduce((r,o)=>r+o.stats[e],0);return i.key=e,i.label=Nd.get(e),i.value=a,i})}};var Bl=class{idMapping=null;idSchema=null;errorHandlingModel=null;football=null;constructor(t){this.idSchema=t.idSchema,this.errorHandlingModel=t.errorHandlingMode,this.football=new J(t),this.idMapping=new E(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 Nl=class{idSchema=null;clientHttps=null;footballHttps=null;predictorHttps=null;loyaltyHttps=null;idMappingService=null;service=null;constructor(t){this.idSchema=t.idSchema,this.clientHttps=new $(t),this.footballHttps=new pt(t),this.service=new Bl(t),this.idMappingService=new E(t),this.predictorHttps=new dt(t,this.idMappingService),this.loyaltyHttps=new Pt(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=xi.createFantasyPrediction(t,e,o,a)}else r=xi.createFantasyPrediction(t,e,i,a);return await this.predictorHttps.makeFootballPrediction(r)};getMyPrediction=async(t,e)=>{let i=`${t}_${e}`,a=new G(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 xi.createFantasyPlayerStats(a)};getGameWeekStatistics=async t=>await this.loyaltyHttps.getTemplateBreakdownPoints(t)};var kl=class{facade=null;constructor(t){this.facade=new Nl(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 Gl=class{configuration;constructor(t){this.configuration=t}getSDKConfiguration(){return this.configuration}};var Ul=class{remapToResponseModel=(t,e,i)=>{let a=new Zr;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 Vl=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 Hl=class{validator=null;idMappingFacade=null;factory=new Ul;constructor(t){this.validator=new Vl(t),this.idMappingFacade=new ci(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 $l=class{facade=null;constructor(t){this.facade=new Hl(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{remapUserVotes=t=>{let e=new Ws;return e.meta=this.remapMeta(t.meta.pagination),e.data=t.data.map(i=>this.remapUserVoteModel(i)),e};remapResults=t=>{let e=new Ks;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 zs;return e.matchId=t.match_id,e.playerId=t.player_id,e.createdAt=t.created_at,e};remapResultsModel=t=>{let e=new js;return e.teamId=t.team_id,e.playerId=t.player_id,e.votes=t.votes,e.winner=t.winner,e}};var Wl=class extends ct{remapPolls=t=>{let e=new Hs;return e.meta.pagination=this.remapMetaPagination(t.meta.pagination),e.data=t.data.map(i=>this.remapPoll(i)),e};remapPollById=t=>{let e=new ks;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 ii;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 $s;return e.meta.pagination=this.remapMetaPagination(t.meta.pagination),e.data=t.data.map(i=>this.remapPollVote(i)),e};remapPollVote=t=>{let e=new Vs;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 bt;return e.itemsPerPage=t.items_per_page,e.nextPageStartsAfter=t.next_page_starts_after,e};remapPoll=t=>{let e=new ei;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 St;return e.content=t.content,e.tags=t.tags?t.tags.map(i=>{let a=new Ja;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 Gs;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 Us;return i.preferenceId=e.preference_id,i})};var zl=class extends C{pollRemapper=null;playerOfTheMatchRemapper=null;constructor(t){super(t,F(t.environment,"voting")),this.pollRemapper=new Wl,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 Ql=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 E(t),this.validator=new Qt(t),this.activityService=new yt(t),this.football=new J(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 Kl=class{https=null;service=null;idSchema=null;constructor(t){this.idSchema=t.idSchema,this.https=new zl(t),this.service=new Ql(t)}getPolls=async(t,e)=>{t&&(t=new ti(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 ti({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 ti({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 Di=class{facade=null;constructor(t){this.facade=new Kl(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 $(t),this.topX=new jt(t),this.matchQuiz=new zt(t),this.loyalty=new Yt(t),this.miniGames=new Kt(t),this.voting=new Di(t)}getListContent=async(t,e,i)=>{e&&(e=new to(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 Yl=class{facade=null;constructor(t){this.facade=new jl(t)}getListContent=async(t,e,i)=>await this.facade.getListContent(t,e,i)};var Xl=class{fromResponse(t,e){let i=new Map;return t.matches.forEach(a=>{let r=a.odds.map(o=>{let n=new es;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 Wo;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 Yo;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 Ko;return i.url=e.url,i.appType=e.app_type,i})}remapBranding(t){let e=new zo;return e.backgroundColor=t.background_color,e.textColor=t.text_color,e}remapAssets(t){return t.map(e=>{let i=new Qo;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 Zo;return e.id=t.id,e.name=t.name,e.code=t.code,e.entityType=t.entity_type,e};remapMarketScope=t=>{let e=new Xo;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 Jo;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 ts;return e.selectionId=t.selection_id,e.eventId=t.event_id,e.marketId=t.market_id,e.competitionId=t.competition_id,e}};var Jl=class{footballBaseUrl="https://football.api.sportal365.com/";retryRequest=!1;oddClient=null;remapper=null;constructor(t){this.oddClient=t.oddClient,this.remapper=new Xl}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 Zl=class{https;idSchema;oddClient;idMapping=null;validator;constructor(t){this.idSchema=t.idSchema,this.oddClient=t.oddClient,this.https=new Jl(t),this.validator=new Y(t.errorHandlingMode),this.idMapping=new E(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 jo(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 tp=class{facade;constructor(t){this.facade=new Zl(t)}getByMatchIds=async(t,e)=>await this.facade.getByMatchIds(t,e)};var ep=class{factory=null;privateLeagueHttps=null;loyaltyHttps=null;profile=null;service=null;discussionsService=null;constructor(t){this.factory=new Si,this.privateLeagueHttps=new Ri(t),this.loyaltyHttps=new Pt(t),this.profile=new U(t),this.service=new Li(t),this.discussionsService=new Xt(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 Ps(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 Ts(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 je(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 Ye(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 Xe(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 ip=class{privateLeaguesFacade=null;constructor(t){this.privateLeaguesFacade=new ep(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 ap=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 rp=class extends Y{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 op=class{https=null;profile=null;validator=null;constructor(t){this.https=new di(t),this.profile=new U(t),this.validator=new rp(t.errorHandlingMode)}getGames=async(t,e)=>(t&&(t=new vs(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 As(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 sp=class{facade=null;constructor(t){this.facade=new op(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 sd(){let s=od(),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 ac=null,_c=null;function Gd(s){if(Ud(s)){let t=Vd(s);if(t.isValid)return ac={profile:new U(s),football:new J(s),predictor:new Oi(s),loyalty:new Yt(s),topX:new jt(s),matchQuiz:new zt(s),activity:new wn(s),miniGames:new Kt(s),discussions:new Dl(s),privateLeagues:new ip(s),challenges:new Al(s),progress:new ap,voting:new Di(s),fantasy:new kl(s),helpers:new Gl(s),idMapping:new $l(s),bracketGame:new sl(s),lists:new Yl(s),standingGame:new sp(s),odds:new tp(s),getVersion:sd},_c={...s},ac;Hd(t)}return ac}var Ud=s=>!ac||JSON.stringify(s)!==JSON.stringify(_c)||s.authProvider?.getIdToken()!==_c.authProvider?.getIdToken(),Vd=s=>{let e=new hn().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},Hd=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 Zt).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{ir as AcceptChallengeModel,Is as AcceptPrivateLeagueModel,Hi as AchievementsStats,he as ActionValueModel,dc as ActionsEnum,fe as ActionsModel,ne as ActivityFilters,Ip as ActivityMeta,se as ActivityResponseBody,Cp as AssetsModel,me as AutomaticModerationModel,za as BadgesModel,Aa as BadgesModelV2,Qa as BadgesValue,q as BadgesValueV2,Qo as BookmakerAssetModel,zo as BookmakerBrandingModel,zp as BookmakerLinkModel,Wo as BookmakerModel,Ko as BookmakerUrlModel,as as BothTeamsFixtureModel,er as BracketGameFilters,le as BracketGameFixtureScoreModel,tr as BracketGameFixtures,ea as BracketGameFixturesModel,pe as BracketGameMetaModel,ia as BracketGameMetaParticipantsModel,aa as BracketGameModel,na as BracketGamePredictionFixturesModel,la as BracketGamePredictionModel,Pp as BracketGamePredictionRequestBody,id as BracketGamePredictionStatusEnum,Za as BracketGamePredictionsFilters,ra as BracketGamePredictionsModel,pa as BracketGameRankingsModel,ce as BracketGameTiebreaker,sa as BracketGameTiebreakerModel,oa as BracketGamesModel,gc as BracketWinnerEnum,jr as BrandingColorsModel,Xr as BrandingImagesModel,Kr as BrandingModel,Yr as BrandingUrlsModel,wa as BreakdownModel,Kp as CalculatedOneXTwoFromScoresModel,wp as CampaignModel,ar as ChallengeCreateModel,or as ChallengeFilters,nr as ChallengeRankingsModel,rr as ChallengeUpdateModel,xe as ClassicQuizBasicModel,Io as ClassicQuizFilters,Be as ClassicQuizFiltersMeta,wo as ClassicQuizFullModel,Fo as ClassicQuizLeaderboardFilters,ke as ClassicQuizLeaderboardMeta,Po as ClassicQuizOptionModel,Vp as ClassicQuizParticipationBodyModel,To as ClassicQuizParticipationModel,Eo as ClassicQuizParticipationQuestionModel,Ro as ClassicQuizParticipationsFilters,_o as ClassicQuizQuestionModel,Co as ClassicQuizQuestionsReportModel,Ne as ClassicQuizRankFilters,vo as ClassicQuizRankModel,So as ClassicQuizUserParticipationModel,Ao as ClassicQuizUserRank,$p as ClassicQuizUserRankModel,qp as ClassicQuizzesLeaderboardModel,Hp as ClassicQuizzesModel,ee as ClassicQuizzesStats,eo as ClientBadges,io as ClientBadgesV2,Fr as CompetitionBasicModel,gi as CompetitionFilters,vr as CompetitionFullModel,j as CompletedModel,_p as ContentModel,Bs as ContestWinners,St as ContextModel,os as CornersFixtureModel,xt as CorrectScoreFixtureModel,li as CreateActivityRequestBody,Tp as CreatePostParamBody,ga as DetailedProfileModel,Ta as DictionaryModel,lr as DiscussionModel,ie as DiscussionStats,Ha as DiscussionsBadgeRequirements,$a as DiscussionsBadgesValue,Ea as DiscussionsConfigModel,br as DiscussionsFilters,il as DoubleChanceEnum,ls as DoubleChanceFixtureModel,Ge as EitherOrBasicModel,Oo as EitherOrFilters,Lo as EitherOrFullModel,Bo as EitherOrParticipationModel,ko as EitherOrParticipationRequestFullModel,No as EitherOrParticipationRequestModel,Uo as EitherOrParticipationStepsModel,Mi as EitherOrParticipationStepsOptionModel,xo as EitherOrPointsModel,Vo as EitherOrResultsBreakdownModel,Ho as EitherOrResultsModel,$o as EitherOrResultsStandingsModel,ae as EitherOrStats,Do as EitherOrStatsModel,Wp as EitherOrsModel,Lp as EntitiesFollows,xp as EntitiesFollowsFilters,Ni as EnvironmentEnum,v as ErrorCodes,cp as ErrorHandlingModeEnum,N as ErrorMessages,A as ErrorStatuses,Gd as FansUnitedSDK,Fp as FansUnitedSDKModel,Gt as FansUnitedSdkFetchException,Pe as FantasyCoefficientsModel,ja as FantasyConfigModel,Ya as FantasyMultipliersModel,wr as FantasyPlayerDetailedStatsMetaModel,_r as FantasyPlayerDetailedStatsModel,Pr as FantasyPlayerStatsModel,Er as FantasyPlayersMetaModel,Te as FantasyPlayersModel,Rr as FantasyPlayersPointsModel,Ce as FantasyPredictionRequestBody,po as FiltersMetaModel,Os as FixturesGamesModel,bo as FixturesMatchQuizModel,is as FixturesPredictionModel,He as FixturesResponseModel,xs as FixturesTopXModel,hi as FollowFilters,ui as FollowModel,Ma as FollowStatusModel,ba as FollowersModel,ya as FollowingModel,ka as FootballBadgeRequirements,Ga as FootballBadgesValue,Ar as FootballCountryModel,Vt as FootballPaginationModel,Fs as FullInterestModel,_a as FullnessProfile,xa as GameBadgeRequirements,Da as GameBadgesValue,Je as GameByIdModel,Mo as GameMarketsResults,Ht as GameModel,si as GamePredictionsStats,Ds as GameResultsModel,Ft as GameStatusEnum,Ba as GamesBadgeRequirements,Na as GamesBadgesValue,ot as GamesFilters,wt as GamesListModel,It as GamesMatchQuizListModel,Dt as GamesTopXListModel,Ka as GeneralBadgesValue,_e as GeneralRequirementModel,al as HalfTimeFullTimeEnum,cs as HalfTimeFullTimeFixtureModel,ao as HighestSuccessRateFilters,lo as HighestSuccessRateModel,x as IdSchemaEnum,K as ImagesModel,Cs as InterestModel,je as InvitationFilters,an as LangEnum,Ia as LeadModel,ec as LeadRequestBody,Dp as LeaderboardLeagueResponse,Le as LeaderboardModel,Bp as LeaderboardResponseModel,ro as LeagueLeaderboardFilters,Oe as LeagueLeaderboardMetaModel,Ae as LineupsModel,to as ListContentFilters,Xa as ListContentModel,Ys as ListContentResponseModel,Ra as LoyaltyConfigModel,Wa as LoyaltyConfigModelV2,oo as LoyaltyFilters,Ot as LoyaltyMeta,Jr as MappingModel,Zr as MappingResponseModel,tt as MarketEnum,Qp as MarketsConfigModel,Or as MatchBasicModel,ze as MatchCorrectScoreMarketResultModel,At as MatchFilters,Lr as MatchFullModel,ys as MatchMarketsResultsModel,jo as MatchOddsFilters,Ic as MatchOddsMarketEnum,Yo as MatchOddsMarketModel,Xo as MatchOddsMarketScopeModel,Jo as MatchOddsMarketSelectionModel,Zo as MatchOddsMarketTypeModel,es as MatchOddsModel,gs as MatchPlayerMarketResultModel,ye as MatchQuizConfigModel,it as MatchStatus,Ms as MatchSummaryModel,D as MetaFootballModel,Go as MiniGameImages,Ua as MiniGamesBadgeRequirements,Va as MiniGamesBadgesValue,Ue as MiniGamesContext,Ve as MiniGamesContextTag,De as MiniGamesFilters,sr as MyChallengesFilters,Ps as MyLeaguesFilters,O as NoYesModel,Mc as OddFormatEnum,yc as OddTypeEnum,el as OneXTwoEnum,us as OneXTwoFixtureModel,rd as OutcomeEnum,qe as OverCornersFixtureModel,We as OverGoalsFixtureModel,Zi as OwnActivityFilters,Qi as PaginationActivities,z as PaginationFootballProperties,Yp as PastTemplateModel,ms as PenaltyMatchFixtureModel,Ep as PlayerAssetsModel,kr as PlayerBasicModel,Fe as PlayerDetailedPointsModel,Ir as PlayerDetailedStatsFilters,Sr as PlayerDetailedStatsModel,bi as PlayerFilters,rt as PlayerFixtureModel,Gr as PlayerFullModel,Rp as PlayerMarketResultModel,Cr as PlayerPointsModel,Hr as PlayerShortModel,Ur as PlayerSquadModel,ve as PlayerStatsMatchModel,Nr as PlayerStatsModel,Tr as PlayersPointsFilters,Np as Points,Sa as PointsModel,kp as PointsValueModel,Op as PollBadgesValue,ei as PollBasicModel,ks as PollFullModel,Gs as PollOptionModel,ii as PollVoteBasicModel,Vs as PollVoteFullModel,ti as PollsFilters,Hs as PollsModel,$s as PollsUserVotesModel,Se as PostByIdBasicModel,pr as PostByIdFullModel,cr as PostCreateModel,dr as PostsCountDiscussionModel,ur as PostsDiscussionBasicModel,Ut as PostsFilters,mr as PostsFullModel,vt as PostsMetaModel,hr as PostsModel,Ie as PotmBadgesValue,Qs as PotmResultsMetaModel,js as PotmResultsModel,Ks as PotmResultsResponseModel,qs as PotmUserVotesFilters,zs as PotmUserVotesModel,Ws as PotmUserVotesResponseModel,yo as PredictionMatchQuizModel,Qe as PredictionRequestModel,Ii as PredictionResponseModel,Ls as PredictionTopXModel,G as PredictionsFilters,bs as PredictionsModel,oe as PredictionsStats,Oa as PredictorBadgeRequirements,La as PredictorBadgesValue,Me as PredictorConfigModel,Us as PreferenceMappingModel,Ap as PreferenceModel,Ee as PrivateLeagueBasicCreateModel,Re as PrivateLeagueBasicUpdateRequestBody,Rs as PrivateLeagueCreateModel,Ts as PrivateLeagueFilters,ws as PrivateLeagueFullModel,Ke as PrivateLeagueModel,Xp as PrivateLeagueParamCreateBody,Jp as PrivateLeagueParamUpdateBody,Ye as PrivateLeaguePostsFilters,_s as PrivateLeaguePredictionModel,Xe as PrivateLeaguePredictionsFilters,Zp as PrivateLeaguePredictionsModel,Es as PrivateLeagueRankingsModel,Ss as PrivateLeagueUpdateModel,tc as PrivateLeaguesModel,Pa as ProfileCountryModel,ue as ProfileModel,qi as ProfileStatsModel,so as RankingsFilters,uo as RankingsModel,fr as ReactionModel,fs as RedCardFixtureModel,Q as RelatedEntityRelationship,gr as ReportModel,Ct as RequirementModel,$e as ResultModel,qo as ResultsSummaryModel,ge as RewardsModel,we as RewardsModelV2,vp as SDKConfiguraitonModel,bc as ScopeTypeEnum,Dr as ScoresModel,Qr as SearchFilters,zr as SearchModel,ts as SelectionProviderInfoModel,Wi as SinglePredictionsBreakdown,re as SinglePredictionsStats,m as StandardFansUnitedException,de as StandingGameMetaModel,ua as StandingGameMetaParticipantsModel,ca as StandingGameModel,ma as StandingGamePredictionModel,ha as StandingGamePredictionsModel,As as StandingGameRankingsFilters,fa as StandingGameRankingsModel,vs as StandingGamesFilters,da as StandingGamesModel,xr as StatsModel,Ln as StatusEnum,zi as SuccessRatePercent,Ca as SuccessRateScopeModel,$i as SuccessRates,kt as SummarizedBreakdown,Ja as TagsModel,$r as TeamBasicModel,qr as TeamColors,yi as TeamFilters,Sp as TeamFormModel,Wr as TeamFullModel,Gp as TemplateBreakdownModel,mo as TemplateBreakdownPointsModel,ho as TemplateByIdModel,no as TemplateFilters,go as TemplateGroupFilter,fo as TemplateGroups,co as TemplateMeta,Lt as TemplateModel,ht as TiebreakerModel,Up as TiersModel,mt as TimeTiebreaker,Br as TimelineModel,jp as TopCorrectScoresModel,Mr as TopDiscussionsFilters,Vr as TopPlayerModel,be as TopXConfigModel,Ze as TopXPredictionRequestModel,ad as UserActionsEnum,ta as UserActivityFilters,Fa as UserDataConfigModel,Ns as UserListWinners,hs as ValueAndPlayerId,at as ValueBoolean,rs as ValueCorners,ss as ValueCorrectScore,ns as ValueDoubleChance,ps as ValueHalfTimeFullTime,ds as ValueOneXTwo,yr as VersionsModel,qa as VotingBadgeRequirements,va as VotingBadgesValue};
4
4
  //# sourceMappingURL=index.js.map