fansunited-sdk-esm 1.102.0 → 1.102.2

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 xc=Object.create;var kl=Object.defineProperty;var Lc=Object.getOwnPropertyDescriptor;var Dc=Object.getOwnPropertyNames;var Bc=Object.getPrototypeOf,Nc=Object.prototype.hasOwnProperty;var kc=(s,t,e)=>t in s?kl(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e;var Gc=(s,t)=>()=>(s&&(t=s(s=0)),t);var Os=(s,t)=>()=>(t||s((t={exports:{}}).exports,t),t.exports),Uc=(s,t)=>{for(var e in t)kl(s,e,{get:t[e],enumerable:!0})},Vc=(s,t,e,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of Dc(t))!Nc.call(s,a)&&a!==e&&kl(s,a,{get:()=>t[a],enumerable:!(i=Lc(t,a))||i.enumerable});return s};var Hc=(s,t,e)=>(e=s!=null?xc(Bc(s)):{},Vc(t||!s||!s.__esModule?kl(e,"default",{value:s,enumerable:!0}):e,s));var J=(s,t,e)=>(kc(s,typeof t!="symbol"?t+"":t,e),e);var sc={};Uc(sc,{default:()=>Qc});var zc,Qc,nc=Gc(()=>{zc={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},Qc=zc});var lc=Os((Wm,Wl)=>{var Kc=function(){"use strict";function s(c,u){return u!=null&&c instanceof u}var t;try{t=Map}catch{t=function(){}}var e;try{e=Set}catch{e=function(){}}var i;try{i=Promise}catch{i=function(){}}function a(c,u,d,y,b){typeof u=="object"&&(d=u.depth,y=u.prototype,b=u.includeNonEnumerable,u=u.circular);var Kt=[],ti=[],ei=typeof Buffer<"u";typeof u>"u"&&(u=!0),typeof d>"u"&&(d=1/0);function ot(P,S){if(P===null)return null;if(S===0)return P;var B,vs;if(typeof P!="object")return P;if(s(P,t))B=new t;else if(s(P,e))B=new e;else if(s(P,i))B=new i(function(Cs,I){P.then(function(As){Cs(ot(As,S-1))},function(As){I(ot(As,S-1))})});else if(a.__isArray(P))B=[];else if(a.__isRegExp(P))B=new RegExp(P.source,p(P)),P.lastIndex&&(B.lastIndex=P.lastIndex);else if(a.__isDate(P))B=new Date(P.getTime());else{if(ei&&Buffer.isBuffer(P))return Buffer.allocUnsafe?B=Buffer.allocUnsafe(P.length):B=new Buffer(P.length),P.copy(B),B;s(P,Error)?B=Object.create(P):typeof y>"u"?(vs=Object.getPrototypeOf(P),B=Object.create(vs)):(B=Object.create(y),vs=y)}if(u){var Qp=Kt.indexOf(P);if(Qp!=-1)return ti[Qp];Kt.push(P),ti.push(B)}s(P,t)&&P.forEach(function(Cs,I){var As=ot(I,S-1),Oc=ot(Cs,S-1);B.set(As,Oc)}),s(P,e)&&P.forEach(function(Cs){var I=ot(Cs,S-1);B.add(I)});for(var mt in P){var xp;vs&&(xp=Object.getOwnPropertyDescriptor(vs,mt)),!(xp&&xp.set==null)&&(B[mt]=ot(P[mt],S-1))}if(Object.getOwnPropertySymbols)for(var Kp=Object.getOwnPropertySymbols(P),mt=0;mt<Kp.length;mt++){var F=Kp[mt],Li=Object.getOwnPropertyDescriptor(P,F);Li&&!Li.enumerable&&!b||(B[F]=ot(P[F],S-1),Li.enumerable||Object.defineProperty(B,F,{enumerable:!1}))}if(b)for(var jp=Object.getOwnPropertyNames(P),mt=0;mt<jp.length;mt++){var Nl=jp[mt],Li=Object.getOwnPropertyDescriptor(P,Nl);Li&&Li.enumerable||(B[Nl]=ot(P[Nl],S-1),Object.defineProperty(B,Nl,{enumerable:!1}))}return B}return ot(c,d)}a.clonePrototype=function(u){if(u===null)return null;var d=function(){};return d.prototype=u,new d};function r(c){return Object.prototype.toString.call(c)}a.__objToStr=r;function o(c){return typeof c=="object"&&r(c)==="[object Date]"}a.__isDate=o;function n(c){return typeof c=="object"&&r(c)==="[object Array]"}a.__isArray=n;function l(c){return typeof c=="object"&&r(c)==="[object RegExp]"}a.__isRegExp=l;function p(c){var u="";return c.global&&(u+="g"),c.ignoreCase&&(u+="i"),c.multiline&&(u+="m"),u}return a.__getRegExpFlags=p,a}();typeof Wl=="object"&&Wl.exports&&(Wl.exports=Kc)});var Mc=Os((zm,$p)=>{"use strict";var ji=typeof Reflect=="object"?Reflect:null,pc=ji&&typeof ji.apply=="function"?ji.apply:function(t,e,i){return Function.prototype.apply.call(t,e,i)},zl;ji&&typeof ji.ownKeys=="function"?zl=ji.ownKeys:Object.getOwnPropertySymbols?zl=function(t){return Object.getOwnPropertyNames(t).concat(Object.getOwnPropertySymbols(t))}:zl=function(t){return Object.getOwnPropertyNames(t)};function jc(s){console&&console.warn&&console.warn(s)}var uc=Number.isNaN||function(t){return t!==t};function R(){R.init.call(this)}$p.exports=R;$p.exports.once=Zc;R.EventEmitter=R;R.prototype._events=void 0;R.prototype._eventsCount=0;R.prototype._maxListeners=void 0;var cc=10;function Ql(s){if(typeof s!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof s)}Object.defineProperty(R,"defaultMaxListeners",{enumerable:!0,get:function(){return cc},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+".");cc=s}});R.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};R.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 dc(s){return s._maxListeners===void 0?R.defaultMaxListeners:s._maxListeners}R.prototype.getMaxListeners=function(){return dc(this)};R.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")pc(l,this,e);else for(var p=l.length,c=yc(l,p),i=0;i<p;++i)pc(c[i],this,e);return!0};function mc(s,t,e,i){var a,r,o;if(Ql(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=dc(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,jc(n)}return s}R.prototype.addListener=function(t,e){return mc(this,t,e,!1)};R.prototype.on=R.prototype.addListener;R.prototype.prependListener=function(t,e){return mc(this,t,e,!0)};function Xc(){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 hc(s,t,e){var i={fired:!1,wrapFn:void 0,target:s,type:t,listener:e},a=Xc.bind(i);return a.listener=e,i.wrapFn=a,a}R.prototype.once=function(t,e){return Ql(e),this.on(t,hc(this,t,e)),this};R.prototype.prependOnceListener=function(t,e){return Ql(e),this.prependListener(t,hc(this,t,e)),this};R.prototype.removeListener=function(t,e){var i,a,r,o,n;if(Ql(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():Yc(i,r),i.length===1&&(a[t]=i[0]),a.removeListener!==void 0&&this.emit("removeListener",t,n||e)}return this};R.prototype.off=R.prototype.removeListener;R.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 fc(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?Jc(a):yc(a,a.length)}R.prototype.listeners=function(t){return fc(this,t,!0)};R.prototype.rawListeners=function(t){return fc(this,t,!1)};R.listenerCount=function(s,t){return typeof s.listenerCount=="function"?s.listenerCount(t):gc.call(s,t)};R.prototype.listenerCount=gc;function gc(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}R.prototype.eventNames=function(){return this._eventsCount>0?zl(this._events):[]};function yc(s,t){for(var e=new Array(t),i=0;i<t;++i)e[i]=s[i];return e}function Yc(s,t){for(;t+1<s.length;t++)s[t]=s[t+1];s.pop()}function Jc(s){for(var t=new Array(s.length),e=0;e<t.length;++e)t[e]=s[e].listener||s[e];return t}function Zc(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))}bc(s,t,r,{once:!0}),t!=="error"&&tu(s,a,{once:!0})})}function tu(s,t,e){typeof s.on=="function"&&bc(s,"error",t,e)}function bc(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 Pc=Os((wc,Ic)=>{(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=lc(),s=Mc().EventEmitter,Ic.exports=t=function(){class o extends s{constructor(l={}){super(),this.get=this.get.bind(this),this.mget=this.mget.bind(this),this.set=this.set.bind(this),this.mset=this.mset.bind(this),this.del=this.del.bind(this),this.take=this.take.bind(this),this.ttl=this.ttl.bind(this),this.getTtl=this.getTtl.bind(this),this.keys=this.keys.bind(this),this.has=this.has.bind(this),this.getStats=this.getStats.bind(this),this.flushAll=this.flushAll.bind(this),this.flushStats=this.flushStats.bind(this),this.close=this.close.bind(this),this._checkData=this._checkData.bind(this),this._check=this._check.bind(this),this._isInvalidKey=this._isInvalidKey.bind(this),this._wrap=this._wrap.bind(this),this._getValLength=this._getValLength.bind(this),this._error=this._error.bind(this),this._initErrors=this._initErrors.bind(this),this.options=l,this._initErrors(),this.data={},this.options=Object.assign({forceString:!1,objectValueSize:80,promiseValueSize:80,arrayValueSize:40,stdTTL:0,checkperiod:600,useClones:!0,deleteOnExpire:!0,enableLegacyCallbacks:!1,maxKeys:-1},this.options),this.options.enableLegacyCallbacks&&(console.warn("WARNING! node-cache legacy callback support will drop in v6.x"),["get","mget","set","del","ttl","getTtl","keys","has"].forEach(p=>{var c;c=this[p],this[p]=function(...u){var d,y,b,Kt;if(b=u,[...u]=b,[d]=i.call(u,-1),typeof d=="function")try{Kt=c(...u),d(null,Kt)}catch(ti){y=ti,d(y)}else return c(...u,d)}})),this.stats={hits:0,misses:0,keys:0,ksize:0,vsize:0},this.validKeyTypes=["string","number"],this._checkData()}get(l){var p,c;if(a(this,o),(c=this._isInvalidKey(l))!=null)throw c;if(this.data[l]!=null&&this._check(l,this.data[l]))return this.stats.hits++,p=this._unwrap(this.data[l]),p;this.stats.misses++}mget(l){var p,c,u,d,y,b;if(a(this,o),!Array.isArray(l))throw p=this._error("EKEYSTYPE"),p;for(b={},u=0,y=l.length;u<y;u++){if(d=l[u],(c=this._isInvalidKey(d))!=null)throw c;this.data[d]!=null&&this._check(d,this.data[d])?(this.stats.hits++,b[d]=this._unwrap(this.data[d])):this.stats.misses++}return b}set(l,p,c){var u,d,y;if(a(this,o),this.options.maxKeys>-1&&this.stats.keys>=this.options.maxKeys)throw u=this._error("ECACHEFULL"),u;if(this.options.forceString&&!typeof p==="string"&&(p=JSON.stringify(p)),c==null&&(c=this.options.stdTTL),(d=this._isInvalidKey(l))!=null)throw d;return y=!1,this.data[l]&&(y=!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),y||(this.stats.ksize+=this._getKeyLength(l),this.stats.keys++),this.emit("set",l,p),!0}mset(l){var p,c,u,d,y,b,Kt,ti,ei,ot;if(a(this,o),this.options.maxKeys>-1&&this.stats.keys+l.length>=this.options.maxKeys)throw p=this._error("ECACHEFULL"),p;for(u=0,Kt=l.length;u<Kt;u++){if(b=l[u],{key:y,val:ot,ttl:ei}=b,ei&&typeof ei!="number")throw p=this._error("ETTLTYPE"),p;if((c=this._isInvalidKey(y))!=null)throw c}for(d=0,ti=l.length;d<ti;d++)b=l[d],{key:y,val:ot,ttl:ei}=b,this.set(y,ot,ei);return!0}del(l){var p,c,u,d,y,b;for(a(this,o),Array.isArray(l)||(l=[l]),p=0,u=0,y=l.length;u<y;u++){if(d=l[u],(c=this._isInvalidKey(d))!=null)throw c;this.data[d]!=null&&(this.stats.vsize-=this._getValLength(this._unwrap(this.data[d],!1)),this.stats.ksize-=this._getKeyLength(d),this.stats.keys--,p++,b=this.data[d],delete this.data[d],this.emit("del",d,b.v))}return p}take(l){var p;return a(this,o),p=this.get(l),p!=null&&this.del(l),p}ttl(l,p){var c;if(a(this,o),p||(p=this.options.stdTTL),!l)return!1;if((c=this._isInvalidKey(l))!=null)throw c;return this.data[l]!=null&&this._check(l,this.data[l])?(p>=0?this.data[l]=this._wrap(this.data[l].v,p,!1):this.del(l),!0):!1}getTtl(l){var p,c;if(a(this,o),!!l){if((c=this._isInvalidKey(l))!=null)throw c;if(this.data[l]!=null&&this._check(l,this.data[l]))return p=this.data[l].t,p}}keys(){var l;return a(this,o),l=Object.keys(this.data),l}has(l){var p;return a(this,o),p=this.data[l]!=null&&this._check(l,this.data[l]),p}getStats(){return a(this,o),this.stats}flushAll(l=!0){a(this,o),this.data={},this.stats={hits:0,misses:0,keys:0,ksize:0,vsize:0},this._killCheckPeriod(),this._checkData(l),this.emit("flush")}flushStats(){a(this,o),this.stats={hits:0,misses:0,keys:0,ksize:0,vsize:0},this.emit("flush_stats")}close(){a(this,o),this._killCheckPeriod()}_checkData(l=!0){var p,c,u;a(this,o),c=this.data;for(p in c)u=c[p],this._check(p,u);l&&this.options.checkperiod>0&&(this.checkTimeout=setTimeout(this._checkData,this.options.checkperiod*1e3,l),this.checkTimeout!=null&&this.checkTimeout.unref!=null&&this.checkTimeout.unref())}_killCheckPeriod(){if(this.checkTimeout!=null)return clearTimeout(this.checkTimeout)}_check(l,p){var c;return a(this,o),c=!0,p.t!==0&&p.t<Date.now()&&(this.options.deleteOnExpire&&(c=!1,this.del(l)),this.emit("expired",l,this._unwrap(p))),c}_isInvalidKey(l){var p;if(a(this,o),p=typeof l,r.call(this.validKeyTypes,p)<0)return this._error("EKEYTYPE",{type:typeof l})}_wrap(l,p,c=!0){var u,d,y,b;return a(this,o),this.options.useClones||(c=!1),d=Date.now(),u=0,b=1e3,p===0?u=0:p?u=d+p*b:this.options.stdTTL===0?u=this.options.stdTTL:u=d+this.options.stdTTL*b,y={t:u,v:c?e(l):l}}_unwrap(l,p=!0){return this.options.useClones||(p=!1),l.v!=null?p?e(l.v):l.v:null}_getKeyLength(l){return l.toString().length}_getValLength(l){return a(this,o),typeof l=="string"?l.length:this.options.forceString?JSON.stringify(l).length:Array.isArray(l)?this.options.arrayValueSize*l.length:typeof l=="number"?8:typeof l?.then=="function"?this.options.promiseValueSize:typeof Buffer<"u"&&Buffer!==null&&Buffer.isBuffer(l)?l.length:l!=null&&typeof l=="object"?this.options.objectValueSize*Object.keys(l).length:typeof l=="boolean"?8:0}_error(l,p={}){var c;return a(this,o),c=new Error,c.name=l,c.errorcode=l,c.message=this.ERRORS[l]!=null?this.ERRORS[l](p):"-",c.data=p,c}_initErrors(){var l,p,c;a(this,o),this.ERRORS={},c=this._ERRORS;for(p in c)l=c[p],this.ERRORS[p]=this.createErrorMessage(l)}createErrorMessage(l){return function(p){return l.replace("__key",p.type)}}}return o.prototype._ERRORS={ENOTFOUND:"Key `__key` not found",ECACHEFULL:"Cache max keys amount exceeded",EKEYTYPE:"The key argument has to be of type `string` or `number`. Found: `__key`",EKEYSTYPE:"The keys argument has to be an array.",ETTLTYPE:"The ttl argument has to be a number."},o}.call(this)}).call(wc)});var Fc=Os((_c,Tc)=>{(function(){var s;s=Tc.exports=Pc(),s.version="5.1.2"}).call(_c)});var Cc=Os((Z0,nu)=>{nu.exports={name:"fansunited-sdk-esm",version:"1.102.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 xs=(b=>(b.EN="en",b.BG="bg",b.RO="ro",b.EL="el",b.SK="sk",b.PT="pt",b.SR="sr",b.HU="hu",b.SV="sv",b.ES="es",b.FR="fr",b.NL="nl",b.DE="de",b.IT="it",b))(xs||{});var Ls=class{validate=t=>{let e=this.validateField(t.lang),i=this.generateMessage(e);return{validation:e,message:i}};validateField=t=>{let e=Object.values(xs),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 Bi=(r=>(r.DEV="dev",r.PROD="prod",r.STAGING="staging",r.WATG="watg",r.YOLO="yolo",r))(Bi||{});var Ds=class{validate(t){let e=this.validateField(t.environment),i=this.generateMessage(e);return{validation:e,message:i}}validateField=t=>{let e=Object.values(Bi),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 Bs=class{validate(t){let e=this.validateField(t.apiKey),i=this.generateMessage(e);return{validation:e,message:i}}validateField=t=>{let e=null;return t!=null&&t.length>0?e="valid":e="missing",e};generateMessage=t=>{let e=null,i="error";return t==="missing"&&(e="The field apiKey with valid value must be provided to use Fans United JS SDK"),t==="valid"&&(i=null),{text:e,type:i}}};var N=(r=>(r.NATIVE="native",r.ENETPULSE="enetpulse",r.SPORTRADAR="sportradar",r.SPORTAL_365="sportal365",r.API_FOOTBALL="api_football",r))(N||{});var Ns=class{validate(t){let e=this.validateField(t.idSchema),i=this.generateMessage(e);return{validation:e,message:i}}validateField=t=>{let e=Object.values(N),i=null;return t!=null&&t.length>0?e.includes(t)?i="valid":i="invalid":i="missing",i};generateMessage=t=>{let e=null,i="warning";return t==="missing"&&(e="If no idSchema is passed the default one will be set which is: native"),t==="invalid"&&(e="This idSchema value is not supported, the default one will be set which is: native"),t==="valid"&&(e=null,i=null),{text:e,type:i}}};var Xt=class{getIdToken=null;logout=null};var ai=class{text=null;type=null};var ks=class{validation=null;message=new ai;getIdToken={validation:null,message:new ai};logout={validation:null,message:new ai}};var Gs=class{validate(t){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 Xt),i=new ks;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 Xt).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 Ni=class{validation;message};var Us=class{apiKey=null;environment=null;idSchema=null;clientId=null;lang=null;errorHandlingMode=null;authProvider={getIdToken:new Ni,logout:new Ni};isValid=!1};var Vs=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 Gl=(e=>(e.DEFAULT="default",e.STANDARD="standard",e))(Gl||{});var Hs=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 $s=class{validate=t=>{let e=this.checkFieldsForValues(t);return e.isValid=this.containsErrorMessage(e),e};checkFieldsForValues=t=>{let e=new Us,i={apiKey:new Bs,environment:new Ds,idSchema:new Ns,clientId:new Vs,lang:new Ls,errorHandlingMode:new Hs,authProvider:new Gs};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"){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")return e=!1,e;return e}};var Lp=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},ri=(s,t)=>{let e=[];for(;s.length>t;){let i=s.splice(0,t);e.push(i)}return e.push(s),e},C=(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},Yt=s=>Array.from(new Set(s)),f=s=>s||!1,h=()=>`&disable_cache=${Date.now()}`,Ul=s=>JSON.parse(JSON.stringify(s.sort((t,e)=>t.localeCompare(e))));var Z=(I=>(I.FT_1X2="FT_1X2",I.HT_1X2="HT_1X2",I.BOTH_TEAMS_SCORE="BOTH_TEAMS_SCORE",I.DOUBLE_CHANCE="DOUBLE_CHANCE",I.HT_FT="HT_FT",I.PLAYER_SCORE="PLAYER_SCORE",I.PLAYER_YELLOW_CARD="PLAYER_YELLOW_CARD",I.PLAYER_RED_CARD="PLAYER_RED_CARD",I.RED_CARD_MATCH="RED_CARD_MATCH",I.PENALTY_MATCH="PENALTY_MATCH",I.PLAYER_SCORE_FIRST_GOAL="PLAYER_SCORE_FIRST_GOAL",I.CORNERS_MATCH="CORNERS_MATCH",I.CORRECT_SCORE="CORRECT_SCORE",I.CORRECT_SCORE_ADVANCED="CORRECT_SCORE_ADVANCED",I.CORRECT_SCORE_HT="CORRECT_SCORE_HT",I.PLAYER_SCORE_HATTRICK="PLAYER_SCORE_HATTRICK",I.PLAYER_SCORE_TWICE="PLAYER_SCORE_TWICE",I.OVER_GOALS_0_5="OVER_GOALS_0_5",I.OVER_GOALS_1_5="OVER_GOALS_1_5",I.OVER_GOALS_2_5="OVER_GOALS_2_5",I.OVER_GOALS_3_5="OVER_GOALS_3_5",I.OVER_GOALS_4_5="OVER_GOALS_4_5",I.OVER_GOALS_5_5="OVER_GOALS_5_5",I.OVER_GOALS_6_5="OVER_GOALS_6_5",I.OVER_CORNERS_6_5="OVER_CORNERS_6_5",I.OVER_CORNERS_7_5="OVER_CORNERS_7_5",I.OVER_CORNERS_8_5="OVER_CORNERS_8_5",I.OVER_CORNERS_9_5="OVER_CORNERS_9_5",I.OVER_CORNERS_10_5="OVER_CORNERS_10_5",I.OVER_CORNERS_11_5="OVER_CORNERS_11_5",I.OVER_CORNERS_12_5="OVER_CORNERS_12_5",I.OVER_CORNERS_13_5="OVER_CORNERS_13_5",I))(Z||{}),Xp=["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"],Yp=["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"],ht=["PLAYER_RED_CARD","PLAYER_SCORE","PLAYER_SCORE_FIRST_GOAL","PLAYER_SCORE_HATTRICK","PLAYER_SCORE_TWICE","PLAYER_YELLOW_CARD"],Jp=["FT_1X2","HT_1X2","HT_FT","DOUBLE_CHANCE","CORNERS_MATCH","CORRECT_SCORE","CORRECT_SCORE_HT","CORRECT_SCORE_ADVANCED"],ki="PLAYER_SCORE_FIRST_GOAL";var Gi=class{id="";achievedAt=""};var Jt=class{participationCount=null;points=null};var Zt=class{totalPoints=null;postPoints=null;postsMade=null;reactionPoints=null;reactionCount=null};var te=class{participationCount=null};var oi=class{participations=0;points=0};var Lt=class{footballCompetitions=[];footballTeams=[]};var ee=class{predictionsMade=0;correct=0;points=0;breakdown=new Lt};var ie=class{single=new ee;topX=new oi;matchQuiz=new oi};var Ui=class{overallPercent;byFootballCompetition;byFootballTeam;byFootballMarket};var Vi=class{profileId;tier;points;predictionsMade;successRates=new Ui;predictions=new ie;tiers=[];badges=[];discussions=new Zt;classicQuizzes=new Jt;eitherOr=new te};var Hi=class{entityId="";entityType="";entitySource="";model=null;predictionsMade=0;correct=0;points=0};var $i=class{successRatePercent;model=null};var Tt=class{content=null;tags=[];campaign=null};var ae=class{id=null;profileId=null;property=null;value=null;action=null;context=new Tt;points=0};var z=class{currentPage=null;itemsPerPage=null;totalItems=null;numberOfPages=null};var O=class{pagination=new z};var qi=class{meta=new O;data=[new ae]};var qs=class{remapSingleResponse=t=>{let e=new ae;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 Vi;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)},Z[i]&&delete e[i].model});else return t;return e};remapSuccessRatePercent=t=>{let e=new $i;return e.successRatePercent=t.success_rate_percent,e};remapPredictionsStats=t=>{let e=new ie;return e.single=this.remapSinglePredictionsStats(t.single),e.topX=t.top_x,e.matchQuiz=t.match_quiz,e};remapSinglePredictionsStats=t=>{let e=new ee;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 Lt,i=[],a=[];return Object.keys(t).forEach(r=>{let o=new Hi;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 Lt};remapAchievementsStats=t=>t.map(e=>{let i=new Gi;return i.id=e.id,i.achievedAt=e.achieved_at,i});remapDiscussionStats=t=>{let e=new Zt;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 Jt;return e.participationCount=t.participation_count,e.points=t.points,e};remapEitherOrStats=t=>{let e=new te;return e.participationCount=t.participation_count,e}};function Dp(s){this.message=s}Dp.prototype=new Error,Dp.prototype.name="InvalidCharacterError";var Zp=typeof window<"u"&&window.atob&&window.atob.bind(window)||function(s){var t=String(s).replace(/=+$/,"");if(t.length%4==1)throw new Dp("'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 qc(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(Zp(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 Zp(t)}}function Vl(s){this.message=s}function Wc(s,t){if(typeof s!="string")throw new Vl("Invalid token specified");var e=(t=t||{}).header===!0?0:1;try{return JSON.parse(qc(s.split(".")[e]))}catch(i){throw new Vl("Invalid token specified: "+i.message)}}Vl.prototype=new Error,Vl.prototype.name="InvalidTokenError";var Hl=Wc;var x=(i=>(i[i.BAD_METHOD_CALL=400]="BAD_METHOD_CALL",i[i.UNAUTHORIZED=401]="UNAUTHORIZED",i[i.NOT_FOUND=404]="NOT_FOUND",i))(x||{});var L=(F=>(F.INVALID_TEMPLATE="INVALID_TEMPLATE",F.INVALID_PREDICTION="INVALID_PREDICTION",F.INVALID_MARKET="INVALID_MARKET",F.INVALID_FIELD="INVALID_FIELD",F.INVALID_TYPE="INVALID_TYPE",F.EXCEEDED_LENGTH="EXCEEDED_LENGTH",F.INVALID_TOKEN="invalid_token",F.UNAUTHORIZED="unauthorized",F.INVALID_FILTERS="invalid_filters",F.INVALID_AVATAR="invalid_avatar",F.INVALID_METHOD_CALL="invalid_method_call",F.INVALID_LIMIT="invalid_limit",F.INVALID_TEMPLATE_GROUP_ID="invalid_template_group_id",F.INVALID_TEMPLATE_GROUP_FILTERS="invalid_template_group_filters",F.INVALID_PAGE_NUMBER="invalid_page_number",F.INVALID_DISCUSSION_IDS="invalid_discussion_ids",F.ID_MAPPING_NOT_FOUND="id_mapping_not_found",F.INVALID_COMPETITION_ID="invalid_competition_id",F.INVALID_TEAM_ID="invalid_team_id",F.INVALID_IDS="invalid_ids",F.INVALID_INPUT_PROVIDER="invalid_input_provider",F.INVALID_OUTPUT_PROVIDER="invalid_output_provider",F.INVALID_MATCH_SUMMARY="invalid_match_summary",F.INVALID_MATCH_SUMMARY_PREDICTIONS="invalid_match_summary_predictions",F.INVALID_MATCH_SUMMARY_PREDICTIONS_KEYS="invalid_match_summary_predictions_keys",F.ENTITY_IDS_NOT_FOUND="entity_ids_not_found",F.MATCH_IDS_NOT_FOUND="match_ids_not_found",F))(L||{});var D={native:"id",sportradar:"sportradar_id",sportal365:"sportal365_id",enetpulse:"enetpulse_id",api_football:"api_football_id"},Bp={PREDICTOR_USER_RELATED_OPERATION:"https://docs.fansunitedmedia.com/docs/predictor-operations#user-related-operations"},Np=["matchId","matchType","market","prediction"],tc=new Map().set("FT_1X2","fullTimeOneXTwo").set("HT_1X2","halfTimeOneXTwo").set("BOTH_TEAMS_SCORE","bothTeamsScore").set("DOUBLE_CHANCE","doubleChance").set("HT_FT","halfTimeFullTime").set("PLAYER_SCORE","playerScore").set("PLAYER_YELLOW_CARD","playerYellowCard").set("PLAYER_RED_CARD","playerRedCard").set("RED_CARD_MATCH","redCardMatch").set("PENALTY_MATCH","penaltyMatch").set("PLAYER_SCORE_FIRST_GOAL","playerScoreFirstGoal").set("CORNERS_MATCH","cornersMatch").set("CORRECT_SCORE","correctScore").set("CORRECT_SCORE_ADVANCED","correctScoreAdvanced").set("CORRECT_SCORE_HT","correctScoreHalfTime").set("PLAYER_SCORE_HATTRICK","playerScoreHattrick").set("PLAYER_SCORE_TWICE","playerScoreTwice").set("OVER_GOALS_0_5","overZeroPointFiveGoals").set("OVER_GOALS_1_5","overOnePointFiveGoals").set("OVER_GOALS_2_5","overTwoPointFiveGoals").set("OVER_GOALS_3_5","overThreePointFiveGoals").set("OVER_GOALS_4_5","overFourPointFiveGoals").set("OVER_GOALS_5_5","overFivePointFiveGoals").set("OVER_GOALS_6_5","overSixPointFiveGoals").set("OVER_CORNERS_6_5","overSixPointFiveCorners").set("OVER_CORNERS_7_5","overSevenPointFiveCorners").set("OVER_CORNERS_8_5","overEightPointFiveCorners").set("OVER_CORNERS_9_5","overNinePointFiveCorners").set("OVER_CORNERS_10_5","overTenPointFiveCorners").set("OVER_CORNERS_11_5","overElevenPointFiveCorners").set("OVER_CORNERS_12_5","overTwelvePointFiveCorners").set("OVER_CORNERS_13_5","overThirteenPointFiveCorners");var k=(M=>(M.INVALID_MATCH_ID="Match id is invalid!",M.INVALID_PLAYER_ID="Player id is invalid!",M.QUERY_PARAM_MATCH_IDS_EXCEEDED="Maximum matchIds in PredictionFilters should be 10 or less.",M.QUERY_PARAM_FILTERS_LIMIT_EXCEEDED="Maximum limit for filtering games is 50 or less.",M.INVALID_FIXTURES_FIELD="Fixtures field is invalid. For more information please visit our documentation",M.INVALID_TOKEN="Invalid JWT token is provided",M.EXPIRED_TOKEN="The provided JWT token is expired",M.ENTITIES_NEEDED="At least one of footballCompetitions, footballTeams or footballPlayers properties should be provided for filters.",M.ENTITIES_FOLLOWS_FILTERS_EXCEEDED="Maximum length per entity should be 24 or less.",M.INVALID_TYPE="You have provided invalid type. The valid type is ",M.INVALID_VALUE="You have provided invalid value. The valid value is ",M.INVALID_AVATAR="Invalid URL syntax for avatar image.",M.INVALID_GET_PROFILES_METHOD_CALL="The method 'getByIds' from Profile namespace is not called correctly. You need to provide 'profileIds' OR 'search' parameters to the method, but you can't use both of them or neither of them.",M.INVALID_LIMIT="Invalid limit. The maximum limit is: ",M.INVALID_LIMIT_TYPE="Invalid limit type. The proper type is number.",M.FILTER_COMBINATION_ERROR="You need to use both 'entityIds' and 'entityType' filters together",M.INVALID_ENTITY_TYPE="Invalid 'entityType' filter. Please use one of the following valid options: competition, team, or player",M.INVALID_TEMPLATE_GROUP_ID="There is no group in this template with the provided groupId",M.INVALID_TEMPLATE_GROUP_FILTERS="The provided template group has no filters",M.INVALID_PAGE_NUMBER="Invalid page number provided. Use number between 1 and max number of pages.",M.INVALID_DISCUSSION_IDS="Invalid discussion ids argument. Please provide at least one discussion id in an array",M.EXCEEDED_DISCUSSION_IDS="Maximum number of discussion ids exceeded. The maximum number of discussion ids is 50. You can use 'getPostsCountExtended' method for more than 50 discussion ids.",M.EXCEEDED_EXTENDED_DISCUSSION_IDS="Maximum number of discussion ids exceeded. The maximum number of discussion ids is: ",M.ID_MAPPING_NOT_FOUND="No ID mappings are available for the provided ID. ID argument: ",M.INVALID_PARAM="Invalid parameter provided. Please check the following parameter: ",M.INVALID_COMPETITION_ID="Invalid competition ID provided. Please provide a valid competition ID.",M.INVALID_TEAM_ID="Invalid team ID provided. Please provide a valid team ID.",M.INVALID_OR_EMPTY_IDS="Invalid or empty IDs provided. Please provide at least one ID.",M.INVALID_PROVIDER="Invalid provider. The valid providers are: 'native', 'enetpulse', 'sportal365', 'sportradar' and 'api_football'.",M.INVALID_OUTPUT_PROVIDER="Invalid output provider. The output can not be the same as the input provider.",M.MATCH_SUMMARY_REQUIRED="Match summary is required.",M.MATCH_SUMMARY_PREDICTIONS_REQUIRED="Predictions in match summary are required.",M.INVALID_MATCH_SUMMARY_PREDICTIONS_KEYS="Keys in predictions in match summary are invalid. The valid ones are: ",M.INVALID_COLLECT_LEAD_METHOD_CALL="The method 'collectLead' from Profile namespace is not called correctly. You need to provide 'requestBody' parameter to the method.",M.REQUIRED_FIXTURES_FIELD="Fixtures field is required and should contain at least one BracketGameFixtures object. For more information please visit our documentation",M.INVALID_TIEBREAKER_FIELD="Tiebreaker field is invalid. It should contain statTotal key with integer value. For more information please visit our documentation",M.ENTITY_IDS_NOT_FOUND="Some of the sport entity IDs were not found for the provided id schema",M.MATCH_IDS_NOT_FOUND="Some of the match IDs were not found for the provided id schema",M.INVALID_STANDING_PREDICTION_ARGUMENT="The prediction argument is invalid. For more information please visit our documentation",M))(k||{}),kp={UNEXPECTED_STATUS_PROP:`Unexpected provided property 'status'. You can NOT use this property for this method. For more information visit our documentation:
2
- ${Bp.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
- ${Bp.PREDICTOR_USER_RELATED_OPERATION}`},ec=(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`,$l=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`,ic=s=>`The market '${s}' is not valid for Top X game. The only available market is CORRECT_SCORE.`,ac=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`,rc=(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 Dt=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 v=class{baseUrl=null;apiSignInUrl=null;jwtToken=null;idSchema=null;retryRequest=!1;headers=null;authHeaders=null;errorHandlingMode=null;configuration=null;constructor(t,e){this.baseUrl=e,this.configuration=t,this.apiSignInUrl=`?key=${t.apiKey}&client_id=${t.clientId}`,this.errorHandlingMode=t.errorHandlingMode,this.idSchema=t.idSchema,this.headers={"Content-Type":"application/json"}}getJwtToken=()=>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 Dt(t,o)}let{code:i,status:a,message:r}=e.error;return this.errorHandlingMode==="standard"?new m(i,a,r):new Dt(t,e.error)};validateJWTToken=()=>{let t=null;try{t=Hl(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 Dt(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 Dt(i,a)}else if(this.errorHandlingMode==="standard")throw new m(401,"invalid_token","The provided JWT token is expired")}}};var si=class extends v{activityRemapper=null;constructor(t){super(t,C(t.environment,"loyalty")),this.activityRemapper=new qs}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+=f(e)?`/users/${t}/statistics${this.apiSignInUrl}${h()}`:`/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 Gp=(S=>(S.LIKE="like",S.DISLIKE="dislike",S.PAGE_VIEW="page_view",S.CONTENT_CONSUMED="content_consumed",S.SHARE="share",S.COMMENT="comment",S.CLICK_AD="click_ad",S.CONVERSION="conversion",S.PREDICTION_MADE="prediction_made",S.CONVERT="convert",S.MANAGE_INTERESTS="manage_interests",S.GAME_PARTICIPATION="game_participation",S.ARTICLE_CONSUMED="article_consumed",S.VIDEO_CONSUMED="video_consumed",S.SHORT_VIDEO_CONSUMED="short_video_consumed",S.LONG_VIDEO_CONSUMED="long_video_consumed",S.AUDIO_CONSUMED="audio_consumed",S.GALLERY_CONSUMED="gallery_consumed",S.IMAGE_CONSUMED="image_consumed",S.POLL_PARTICIPATION="poll_participation",S))(Gp||{});var ni=class{action=null;context=new Tt;constructor(t,e,i,a){this.action=t,this.context.tags=e,i&&(this.context.content=i),a&&(this.context.campaign=a)}};var Ws={player:"players",team:"teams",homeTeam:"teams",awayTeam:"teams",country:"countries",competition:"competitions",match:"matches"},zs=class extends v{constructor(t){super(t,C(t.environment,"idMapping"))}getEntityById=async(t,e)=>{let i=`/football${this.apiSignInUrl}&input_provider=${this.idSchema}&${Ws[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}&${Ws[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}&${Ws[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=Lp(e),r=[];for(let o of a){let n=`/football${this.apiSignInUrl}&input_provider=${i}&${Ws[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=Yt(i),n=Lp(o);for(let p of n){let c="";if(Object.keys(t).forEach(u=>{a[u]=[];let d=p.filter(y=>t[u].includes(y));d&&d.length>0&&(a[u]=d)}),Object.keys(a).forEach(u=>{a[u].length>0&&(a[u].sort((d,y)=>d.localeCompare(y)),c+="&",c+=`${Ws[u]}=${a[u].join(",")}`)}),c&&c.length>0){let u=`/football${this.apiSignInUrl}&input_provider=${e||"native"}${c}`,d="There was a problem with id mapping request",y=await this.fetchWithoutAuth(u,d);r.push(y.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 Up="FansUnited",ql={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}}},Wi=class{idSchema="";storageInstance=null;expirationProfileTimeout=600;expirationBadgesTimeout=3600;expirationClientFeaturesTimeout=14400;expirationFootballIdsTimeout=604800;constructor(t){this.idSchema=t,this.getStorageInstance()}static getInstance(t){return Wi.instance||(Wi.instance=new Wi(t)),Wi.instance}async getStorageInstance(){try{let t=await Promise.resolve().then(()=>(nc(),sc));this.storageInstance=t.default}catch(t){console.error(t)}}async getData(){try{let t=await this.storageInstance.getItem(Up);return t?JSON.parse(t):(await this.storageInstance.setItem(Up,JSON.stringify(ql)),ql)}catch(t){throw console.error("AsyncStorage error:",t),t}}async setData(t){await this.storageInstance.setItem(Up,JSON.stringify(t))}clearData=async()=>{await this.setData(ql)};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=D[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=D[i];return r&&t.includes(`${r[o]}`)&&r.resource===e}):a.football.ids.find(r=>{let o=D[i];return r&&`${r[o]}`===t&&r.resource===e})};checkForExistingIdObjs=async(t,e)=>{let i=D[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=D[i],o=D[e],n={};return Object.keys(t).forEach(l=>{let p=t[l],c=[];a.football.ids.forEach(u=>{p.forEach((d,y)=>{d===u[o]&&l===u.resource&&(c[y]=u[r])})}),n[l]=c}),n};addIdMapping=async t=>{let e=await this.getData();e.football.ids.push(t),await this.setData(e)};addIdMappings=async t=>{let e=await this.getData(),i=e.football.ids;i=[...i,...t],e.football.ids=i,await this.setData(e)};addTopIdMappings=async t=>{let e=await this.getData();if(e.football.ids.length){let i=JSON.parse(JSON.stringify(e.football.ids));i=i.filter(a=>a.resource!=="match"),t=t.filter(a=>a.resource==="match"),i=[...i,...t],e.football.ids=i}else e.football.ids=t;e.football.expirations.ids=Math.floor(Date.now()/1e3)+this.expirationFootballIdsTimeout,await this.setData(e)};setOwnProfile=async t=>{let e=await this.getData();e.profile.info=t,e.profile.expirations.profile=Math.floor(Date.now()/1e3)+this.expirationProfileTimeout,await this.setData(e)};getOwnProfile=async()=>(await this.getData()).profile.info;getProfileCountries=async()=>(await this.getData()).profile.countries;setProfileCountries=async t=>{let e=await this.getData();e.profile.countries=t,await this.setData(e)};getProfileStats=async()=>(await this.getData()).profile.statistics;setProfileStats=async t=>{let e=await this.getData();e.profile.statistics=t,e.profile.expirations.statistics=Math.floor(Date.now()/1e3)+this.expirationProfileTimeout,await this.setData(e)};getProfileBadges=async()=>(await this.getData()).profile.badges;setProfileBadges=async t=>{let e=await this.getData();e.profile.badges=t,e.profile.expirations.badges=Math.floor(Date.now()/1e3)+this.expirationBadgesTimeout,await this.setData(e)};getFootballCountries=async()=>(await this.getData()).football.countries;setFootballCountries=async t=>{let e=await this.getData();e.football.countries=t,await this.setData(e)};getClientFeatures=async()=>(await this.getData()).client.features;setClientFeatures=async t=>{let e=await this.getData(),i=JSON.parse(JSON.stringify(t));e.client.expirations.features=Math.floor(Date.now()/1e3)+this.expirationClientFeaturesTimeout,e.client.features=i,await this.setData(e)};deleteClientFeatures=async()=>{let t=await this.getData(),e=JSON.parse(JSON.stringify(t));e.client={features:{},expirations:{features:0}},await this.setData(e)};getExpiration=async(t,e)=>{await this.initialNewSchema(t,"expirations");let i=await this.getData();switch(e){case"profile":return i.profile.expirations.profile;case"statistics":return i.profile.expirations.statistics;case"badges":return i.profile.expirations.badges;case"features":return i.client.expirations.features;case"ids":return i.football.expirations.ids}};makeCompetitionsUnique=t=>{let e=new Set;return t.filter(i=>{let a=!e.has(i.id);return e.add(i.id),a})};initialNewSchema=async(t,e)=>{let i=await this.getData();(!i||!i[t]||!i[t][e])&&await this.setData(ql)}},zi=Wi;J(zi,"instance");var Vp="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}}},Qi=class{idSchema="";expirationProfileTimeout=600;expirationBadgesTimeout=3600;expirationClientFeaturesTimeout=14400;expirationFootballIdsTimeout=604800;constructor(t){this.idSchema=t}static getInstance(t){return Qi.instance||(Qi.instance=new Qi(t)),Qi.instance}clearData=async()=>{this.setData(Hp)};getEntityById=async(t="",e="")=>this.getData().football.ids.find(i=>{let a=D[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=D[i];return a&&t.includes(`${a[r]}`)&&a.resource===e}):this.getData().football.ids.find(a=>{let r=D[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=D[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=D[i],r=D[e],o={};return Object.keys(t).forEach(n=>{let l=t[n],p=[];this.getData().football.ids.forEach(c=>{l.forEach((u,d)=>{u===c[r]&&n===c.resource&&(p[d]=c[a])})}),o[n]=p}),o};addIdMapping=t=>{let e=this.getData();e.football.ids.push(t),this.setData(e)};addIdMappings=async t=>{let e=this.getData(),i=e.football.ids;i=[...i,...t],e.football.ids=i,this.setData(e)};addTopIdMappings=async t=>{let e=this.getData();if(e.football.ids.length){let i=JSON.parse(JSON.stringify(e.football.ids));i=i.filter(a=>a.resource!=="match"),t=t.filter(a=>a.resource==="match"),i=[...i,...t],e.football.ids=i}else e.football.ids=t;e.football.expirations.ids=Math.floor(Date.now()/1e3)+this.expirationFootballIdsTimeout,this.setData(e)};setOwnProfile=async t=>{let e=this.getData();e.profile.info=t,e.profile.expirations.profile=Math.floor(Date.now()/1e3)+this.expirationProfileTimeout,this.setData(e)};getOwnProfile=()=>this.getData().profile.info;getProfileCountries=()=>this.getData().profile.countries;setProfileCountries=async t=>{let e=this.getData();e.profile.countries=t,this.setData(e)};getProfileStats=()=>this.getData().profile.statistics;setProfileStats=async t=>{let e=this.getData();e.profile.statistics=t,e.profile.expirations.statistics=Math.floor(Date.now()/1e3)+this.expirationProfileTimeout,this.setData(e)};getProfileBadges=()=>this.getData().profile.badges;setProfileBadges=async t=>{let e=this.getData();e.profile.badges=t,e.profile.expirations.badges=Math.floor(Date.now()/1e3)+this.expirationBadgesTimeout,this.setData(e)};getFootballCountries=()=>this.getData().football.countries;setFootballCountries=async t=>{let e=this.getData();e.football.countries=t,this.setData(e)};getCompetitions=t=>{let e=this.getData();return t?t.competitionSearchFilter(e.football.competitions):e.football.competitions};setCompetitions=async t=>{let e=this.getData(),i=[...e.football.competitions];i.push(...t),e.football.competitions=this.makeCompetitionsUnique(i),this.setData(e)};getCompetitionsLength=async()=>{let{football:t}=this.getData();return t.competitions.length};getClientFeatures=()=>this.getData().client.features;setClientFeatures=async t=>{let e=this.getData(),i=JSON.parse(JSON.stringify(t));e.client.expirations.features=Math.floor(Date.now()/1e3)+this.expirationClientFeaturesTimeout,e.client.features=i,this.setData(e)};deleteClientFeatures=async()=>{let t=this.getData(),e=JSON.parse(JSON.stringify(t));e.client={features:{},expirations:{features:0}},this.setData(e)};getExpiration=async(t,e)=>{this.initialNewSchema(t,"expirations");let i=this.getData();switch(e){case"profile":return i.profile.expirations.profile;case"statistics":return i.profile.expirations.statistics;case"badges":return i.profile.expirations.badges;case"features":return i.client.expirations.features;case"ids":return i.football.expirations.ids}};makeCompetitionsUnique=t=>{let e=new Set;return t.filter(i=>{let a=!e.has(i.id);return e.add(i.id),a})};getData=()=>(localStorage.getItem(Vp)||this.setData(Hp),JSON.parse(localStorage.getItem(Vp)));setData=t=>{localStorage.setItem(Vp,JSON.stringify(t))};initialNewSchema=(t,e)=>{let i=this.getData();(!i||!i[t]||!i[t][e])&&this.setData(Hp)}},Ki=Qi;J(Ki,"instance");var Ec=Hc(Fc());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=D[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=D[i];return r&&t.includes(`${r[o]}`)&&r.resource===e}):a.find(r=>{let o=D[i];return r&&`${r[o]}`===t&&r.resource===e})};checkForExistingIdObjs=async(t,e)=>{let i=D[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=D[i],r=D[e],o=T.nodeCache.get("ids"),n={};return o?(Object.keys(t).forEach(l=>{let p=t[l],c=[];o.forEach(u=>{p.forEach((d,y)=>{d===u[r]&&l===u.resource&&(c[y]=u[a])})}),n[l]=c}),n):null};addIdMapping=async t=>{let e=T.nodeCache.get("ids");e.push(t),T.nodeCache.set("ids",e)};addIdMappings=async t=>{let e=T.nodeCache.get("ids");e=[...e,...t],T.nodeCache.set("ids",e)};addTopIdMappings=async t=>{let e=T.nodeCache.get("ids"),i=604800;if(e){let a=JSON.parse(JSON.stringify(e));a=a.filter(r=>r.resource!=="match"),t=t.filter(r=>r.resource==="match"),a=[...a,...t],T.nodeCache.set("ids",a)}else T.nodeCache.set("ids",t);this.idMappingsExpiration=Math.floor(Date.now()/1e3)+i};setOwnProfile=async t=>{T.nodeCache.set("profile",t,this.profileTTL)};getOwnProfile=async()=>T.nodeCache.get("profile");getProfileCountries=async()=>T.nodeCache.get("profile_countries");setProfileCountries=async t=>{T.nodeCache.set("profile_countries",t)};getProfileStats=async()=>T.nodeCache.get("profile_stats");setProfileStats=async t=>{T.nodeCache.set("profile_stats",t,this.profileTTL)};getProfileBadges=async()=>T.nodeCache.get("profile_badges");setProfileBadges=async t=>{T.nodeCache.set("profile_badges",t,this.profileBadgesTTL)};getFootballCountries=async()=>T.nodeCache.get("football_countries");setFootballCountries=async t=>{T.nodeCache.set("football_countries",t)};getCompetitions=async t=>{let e=T.nodeCache.get("football_competitions");return e?t?t.competitionSearchFilter(e):e:null};setCompetitions=async t=>{T.nodeCache.set("football_competitions",t)};getCompetitionsLength=async()=>{let t=T.nodeCache.get("football_competitions");return t?t.length:0};getClientFeatures=async()=>T.nodeCache.get("client");setClientFeatures=async t=>{T.nodeCache.set("client",t,this.clientTTL)};deleteClientFeatures=async()=>{T.nodeCache.del("client")};getExpiration=async(t,e)=>{let i=this.getKeyFromExpirationType(e);return i==="ids"?this.idMappingsExpiration:T.nodeCache.getTtl(i)};getKeyFromExpirationType=t=>{switch(t){case"profile":return"profile";case"statistics":return"profile_stats";case"badges":return"profile_badges";case"features":return"client";case"ids":return"ids"}}},li=T;J(li,"instance"),J(li,"nodeCache",new Ec.default);var st=class{createLocalCacheInstance=t=>typeof window>"u"?li.getInstance(t):typeof __DEV__<"u"?zi.getInstance(t):Ki.getInstance(t)};var pi=class{localCache=null;https=null;constructor(t){this.localCache=new st().createLocalCacheInstance(t.idSchema),this.https=new zs(t)}getEntitiesByIds=async(t,e,i)=>{await this.setTopIdMappings();try{let a=await this.localCache.checkForExistingIdObjs(t,e),r=this.splitForRequestAndExisting(a),o=await this.https.getEntitiesByIdObjs(r.request,e);return await this.localCache.addIdMappings(o),await this.localCache.getIdsByType(t,e,i)}catch(a){return console.warn("There was a problem retrieving the entity ids ",a),Promise.resolve([])}};getEntitiesByIdsMap=async(t,e,i)=>{await this.setTopIdMappings();try{let a=JSON.parse(JSON.stringify(t)),r=await this.localCache.checkForExistingIdObjs(t,e),o=this.splitForRequestAndExisting(r),n=await this.https.getEntitiesByIdObjs(o.request,e);await this.localCache.addIdMappings(n);let l=await this.localCache.getIdsByType(t,e,i),p=new Map;return Object.keys(a).forEach(c=>{a[c].forEach((u,d)=>{let y=l[c].length&&l[c][d]?l[c][d]:"";p.set(u,y)})}),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 Kl=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 Qs=class{extractedObjIds={};traverse=(t,e)=>(e=Kl(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 Ks=class{replaceObjIdsIndex=null;remappedIdsObj={};traverse=(t,e,i)=>(e=Kl(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 pi(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 Qs().traverse(i,e);return this.idMappingFacade.getEntitiesByIds(r,"native",this.idSchema).then(o=>new Ks().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 ft=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,u)=>{c.id=n[l][u],o.push(c)});return o}};var re=class{page=null;limit=null;constructor(t){this.page=t.page?t.page:null,this.limit=t.limit?t.limit:null}};var Xi=class extends re{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 Yi=class extends re{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 js=class{idSchema;activityHttps;activityService;constructor(t){this.idSchema=t.idSchema,this.activityHttps=new si(t),this.activityService=new ft(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 ni(t,n,i,a),p=await this.activityHttps.createActivity(l);return p.context.tags=o,p}let r=new ni(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)};addConversion=async(t,e,i)=>{let a="conversion";return await this.add(a,t,e,i)};getOwn=async(t,e)=>{if(e=e||!1,t&&(t=new Xi(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 Yi(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 Xs=class{activityFacade;constructor(t){this.activityFacade=new js(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);addConversion=async(t,e,i)=>await this.activityFacade.addConversion(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 oe=class{participantOne=null;participantTwo=null};var Ji=class{matchId="";participantOne="";participantTwo="";winner="";homeParticipant="";startDate="";score=new oe};var se=class{participants=[]};var Zi=class{id=null;name=null;group=null;image=null;undecided=!1};var ta=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 se;fixtures=[];createdAt=null;updatedAt=null};var gt=class{nextPageStartsAfter=null;itemsPerPage=null};var w=class{pagination=new gt};var ea=class{meta=new w;data=[]};var ia=class{meta=new w;data=[]};var aa=class{statTiebreakerEnabled;statTotal};var ra=class{matchId="";participantOne="";participantTwo="";winner;correct=null};var ne=class{statTotal=0};var Sc=(r=>(r.ACTIVE="ACTIVE",r.WON="WON",r.LOST="LOST",r.PARTIALLY_WON="PARTIALLY_WON",r.CANCELED="CANCELED",r))(Sc||{}),oa=class{id="";profileId="";profileModel=null;gameId="";totalPoints=null;gamePoints=null;bonusPoints=null;position=null;status="ACTIVE";fixtures=[];tiebreaker=new ne;createdAt="";updatedAt=""};var sa=class{meta=new w;data=[]};var Ys=class{remapBracketGames=t=>{let e=new ia;return e.meta.pagination.itemsPerPage=t.meta.pagination.items_per_page,e.meta.pagination.nextPageStartsAfter=t.meta.pagination.next_page_starts_after,e.data=t.data.map(i=>this.remapBracketGameById(i)),e};remapBracketGameById=t=>{let e=new ta;return e.id=t.id,e.title=t.title,e.description=t.description,e.rules=t.rules,e.customFields=t.custom_fields,e.images=t.images,e.type=t.type,e.status=t.status,e.points=t.points,e.related=t.related?this.remapRelated(t.related):t.related,e.tiebreaker=t.tiebreaker?this.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 oa;return e.id=t.id,e.profileId=t.profile_id,e.gameId=t.game_id,e.totalPoints=t.total_points,e.gamePoints=t.game_points,e.bonusPoints=t.bonus_points,e.position=t.position,e.status=t.status,e.fixtures=this.remapPredictionFixtures(t.fixtures),e.tiebreaker=t.tiebreaker?this.remapPredictionTiebreaker(t.tiebreaker):t.tiebreaker,e.createdAt=t.created_at,e.updatedAt=t.updated_at,e};remapPredictionsForUser=t=>{let e=new ea;return e.meta.pagination.itemsPerPage=t.meta.pagination.items_per_page,e.meta.pagination.nextPageStartsAfter=t.meta.pagination.next_page_starts_after,e.data=t.data.map(i=>this.remapPrediction(i)),e};remapRankings=t=>{let e=new sa;return e.meta.pagination.itemsPerPage=t.meta.pagination.items_per_page,e.meta.pagination.nextPageStartsAfter=t.meta.pagination.next_page_starts_after,e.data=t.data.map(i=>this.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 ra;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 ne;return e.statTotal=t.stat_total,e};remapBracketGameMeta=t=>{let e=new se;return e.participants=t.participants.map(i=>{let a=new Zi;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 Ji;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 oe;return e.participantOne=t.participant_one,e.participantTwo=t.participant_two,e};remapBracketGameTiebreaker=t=>{let e=new aa;return e.statTiebreakerEnabled=t.stat_tiebreaker_enabled,e.statTotal=t.stat_total,e}};var le=class{participants=[]};var na=class{id=null;title=null;description=null;rules=null;customFields=null;images=null;type="STANDING";status=null;points=null;related=[];predictionsCutoff="";meta=new le;outcomeCount=null;outcome=[];createdAt=null;updatedAt=null};var la=class{meta=new w;data=[]};var pa=class{id=null;name=null;group=null;image=null;undecided=!1};var ca=class{id="";profileId="";profileModel=null;total=0;gameId="";totalPoints=null;gamePoints=null;bonusPoints=null;position=null;status="ACTIVE";standing=[];createdAt="";updatedAt=""};var ua=class{meta=new w;data=[]};var da=class{meta=new w;data=[]};var Js=class{remapBracketGames=t=>{let e=new la;return e.meta.pagination.itemsPerPage=t.meta.pagination.items_per_page,e.meta.pagination.nextPageStartsAfter=t.meta.pagination.next_page_starts_after,e.data=t.data.map(i=>this.remapStandingGameById(i)),e};remapStandingGameById=t=>{let e=new na;return e.id=t.id,e.title=t.title,e.description=t.description,e.rules=t.rules,e.customFields=t.custom_fields,e.images=t.images,e.type=t.type,e.status=t.status,e.points=t.points,e.related=t.related?this.remapRelated(t.related):t.related,e.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 ca;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 ua;return e.meta.pagination.itemsPerPage=t.meta.pagination.items_per_page,e.meta.pagination.nextPageStartsAfter=t.meta.pagination.next_page_starts_after,e.data=t.data.map(i=>this.remapPrediction(i)),e};remapRankings=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.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 le;return e.participants=t.participants.map(i=>{let a=new pa;return a.id=i.id,a.name=i.name,a.group=i.group,a.image=i.image,a.undecided=i.undecided,a}),e}};var eu={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:""},ci=class extends v{bracketGameRemapper=null;standingGameRemapper=null;constructor(t){super(t,C(t.environment,"predictor")),this.bracketGameRemapper=new Ys,this.standingGameRemapper=new Js}getBracketGames=async(t,e)=>{let i=t?`/custom/bracket${this.apiSignInUrl}${t.constructMainFiltersUrl()}`:`/custom/bracket${this.apiSignInUrl}`;f(e)&&(i+=h());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=f(e)?`/custom/bracket/${t}${this.apiSignInUrl}${h()}`:`/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}`;f(a)&&(r+=h());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=f(i)?`/custom/bracket/${t}/predictions/${e}/${this.apiSignInUrl}${h()}`:`/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(eu));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}`;f(i)&&(a+=h());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}`;f(e)&&(i+=h());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=f(e)?`/custom/standing/${t}${this.apiSignInUrl}${h()}`:`/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}`;f(i)&&(a+=h());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}`;f(i)&&(a+=h());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 pe=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 ma=class extends pe{email=null;phoneNumber=null;phoneCountryCode=null};var Zs=class{profilesFromResponse=t=>t?t.map(e=>this.publicProfileFromResponse(e)):null;fullProfileFromResponse=t=>{let e=new ma;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 pe;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 ha=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 ha;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 fa=class{avatar=null;followerId=null;name=null;nickname=null;profileId=null};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};remapResponse=t=>{let e=new fa;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 ga=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 an=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 ga;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 iu="/countries",tt="/profile",jl="/profiles",di=class extends v{profileRemapper=null;followingRemapper=null;followersRemapper=null;leadRemapper=null;lang=null;limitIds=100;constructor(t){super(t,C(t.environment,"profile")),this.lang=t.lang,this.profileRemapper=new Zs,this.followingRemapper=new tn,this.followersRemapper=new en,this.leadRemapper=new an}getCountries=async t=>{let e=`&lang=${this.lang}`,i=`${iu}${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=`${tt}${this.apiSignInUrl}`,i="";if(t){e=`${jl}/${t}${this.apiSignInUrl}`,i=`There was a problem fetching the following profile: ${t}`;let a=await this.fetchWithoutAuth(e,i);return this.profileRemapper.publicProfileFromResponse(a.data)}else{i="There was a problem fetching your profile from API";let a=await this.fetchWithAuth(e,i);return this.profileRemapper.fullProfileFromResponse(a.data)}};getProfiles=async(t,e,i)=>{let a=Date.now(),r=`There was a problem fetching the following profiles: ${t.join(",")}`;if(t&&t.length){if(t.length>this.limitIds){let c=[],u=ri(t,this.limitIds);for(let d of u){let y=`${jl}${this.apiSignInUrl}&profile_ids=${d.join(",")}`;r=`There was a problem fetching the following profiles: ${d.join(",")}`,i&&(y+=`&disable_cache=${a}`);let b=await this.fetchWithoutAuth(y,r);c.push(...this.profileRemapper.profilesFromResponse(b.data))}return c}let l=`${jl}${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=`${jl}${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=`${tt}/followers${this.apiSignInUrl}`,a="There was a problem fetching the followers for own profile";if(t&&!e){i=`${tt}/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=`${tt}/${e}/followers${this.apiSignInUrl}${t.constructFilterUrl()}`:!t&&e&&(i=`${tt}/${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=`${tt}/following${this.apiSignInUrl}`,a="There was a problem fetching the followers of own profile";if(t&&!e){i=`${tt}/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=`${tt}/${e}/following${this.apiSignInUrl}${t.constructFilterUrl()}`:!t&&e&&(i=`${tt}/${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=tt+`/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=tt+`/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=`${tt}/badges${this.apiSignInUrl}`,i="There was a problem with fetching own badges";return t?(e=`${tt}/${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=tt+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)};deleteOwnProfile=async()=>{let t=`/profile${this.apiSignInUrl}`,e="There was a problem deleting own profile",i="DELETE";return await this.fetchWithAuth(t,e,i),!0}};var j=class{completed=!1;percentage;constructor(t){this.percentage=t}};var ya=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 ba=class{totalPercentage;breakdown=new ya};var mi=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 g=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 yt=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 mi(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 mi(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 ba,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 g(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)};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 Ma=class{id=null;name=null;assets=null};var rn=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 on=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 rn,this.profileFacade=new yt(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 Ma,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 g(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();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.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};extractUserIdFromToken=()=>{try{return Hl(this.configuration.authProvider.getIdToken())?.sub||""}catch(t){return console.error(t),""}}};var sn=class{idsRemapper=null;profileHttps=null;activityHttps=null;profileFacade=null;profileId="";constructor(t,e,i,a){this.idsRemapper=t,this.profileHttps=i,this.activityHttps=a,this.profileFacade=new yt(e,i,a)}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 nn=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 hi=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 ln=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 hi(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 hi({competitionIds:t,limit:i}),r=await this.getCompetitions(a);r.sort((l,p)=>l.id.localeCompare(p.id));let o=Ul(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 fi=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 wa=class{reason="";words=[]};var ce=class{enabled=!1;moderateLinks=!1;linksWhitelist=[];moderatorProfileId="";dictionary=new wa};var Ia=class{enabled=!1;clientId=null;automaticModeration=new ce};var Ft=class{points=null;gameParticipationCount=null;entityId=null;entityType=null;predictionsMade=null;correctPredictions=null};var ue=class{id;weight;multiplier;conditions};var de=class{value=[new ue]};var me=class{points=null;tiers=null;badges=null};var Pa=class{enabled=!1;clientId=null;conditions={list:null};actions=new de;rewards=new me};var _a=class{general=null;predictor=null;activity=null;topX=null;matchQuiz=null;discussionPost=null};var he=class{enabled=!1;clientId=null;defaultMarkets=null;competitionsWhitelist=null;authRequirement=null};var fe=class{enabled=!1;clientId=null;minFixtures=null;maxFixtures=null;competitionsWhitelist=null;authRequirement=null};var Ta=class{competitions=[];teams=[];markets=[]};var ge=class{enabled=!1;clientId=null;fullCoverageCompetitions=null;markets=null;successRateScopes=new Ta;userDataConfig=null};var Fa=class{storeIp=!1;storeDeviceId=!1;storeAgent=!1};var Ea=class{potm=[];poll=[]};var Sa=class{predictor=[];topX=[];matchQuiz=[];games=[];football=[];classicQuizzes=[];eitherOr=[];discussions=[];voting=new Ea};var q=class{id;label;description;flags;assets={mainImageUrl:""};enabled};var Ra=class{predictionsNumber;correctPredictions;points;fromDate;toDate};var va=class extends q{requirements=new Ra};var Ca=class{participationCount;points;fromDate;toDate};var Aa=class extends q{requirements=new Ca};var Oa=class{participationCount;points;specificGames;fromDate;toDate};var xa=class extends q{requirements=new Oa};var La=class{predictionsNumber;correctPredictions;points;entityId;entityType;entityModel=null};var Da=class extends q{requirements=new La};var Ba=class{participationCount;fromDate;toDate};var Na=class extends q{requirements=new Ba};var ka=class{totalDiscussionPoints;postsCount;postPoints;reactionsCount};var Ga=class extends q{requirements=new ka};var Ua=class{points;voteCount;entityId;entityType;entityModel};var ye=class extends q{requirements=new Ua};var be=class{points=null;tiers=null;badges=null};var Va=class{enabled=!1;clientId=null;conditions={list:null};actions=new de;rewards=new be};var Ha=class{general=[];predictor=[];topX=[];matchQuiz=[]};var $a=class{id;label;assets={mainImageUrl:""};enabled;requirements=new Ft};var Me=class extends Ft{postPoints=null;postsCount=null;reactionsCount=null;totalDiscussionPoints=null};var qa=class{id;label;assets={mainImageUrl:""};enabled;requirements=new Me};var we=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 Ie=class{total=null;minGoalkeepers=null;maxGoalkeepers=null;minDefenders=null;maxDefenders=null;minMidfielders=null;maxMidfielders=null;minStrikers=null;maxStrikers=null};var Wa=class{enabled=!1;clientId=null;addPointsToProfileTotal=!1;coefficients=new we;players=new Ie;competitionsWhitelist=[]};var pn=class{remapPredictorConfig=t=>{let e=new ge;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 fe;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 he;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 Pa;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 Va;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 Ia;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 Wa;return e.enabled=t.enabled,e.clientId=t.client_id,e.addPointsToProfileTotal=t.add_points_to_profile_total,e.competitionsWhitelist=t.competitions_whitelist,e.players=this.remapFantasyPlayers(t.players),e.coefficients=this.remapFantasyCoefficients(t.coefficients),e};remapFantasyPlayers=t=>{let e=new Ie;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 we;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 ce;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 be;return e.points=this.remapPoints(t.points),e.tiers=t.tiers,e.badges=this.remapNewBadges(t.badges),e};remapRewards=t=>{let e=new me;return e.points=this.remapPoints(t.points),e.tiers=t.tiers,e.badges=this.remapBadges(t.badges),e};remapPoints=t=>{let e=new _a;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 Ha;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 Sa;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 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.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 Aa;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 xa;return i.id=e.id,i.enabled=e.enabled,i.label=e.label,i.description=e.description,i.flags=e.flags,e.assets?i.assets.mainImageUrl=e.assets.main_image_url:i.assets=e.assets,e.requirements&&(i.requirements.participationCount=e.requirements.participation_count,i.requirements.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 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.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 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.fromDate=e.requirements.from_date,i.requirements.toDate=e.requirements.to_date),i});remapBadgeValuesDiscussions=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.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 ye;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 $a;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 Ft;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 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.remapGeneralRequirements(e.requirements),i});remapGeneralRequirements=t=>{let e=new Me;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}};var za=class{entityId;entityType;entityModel=null};var Xl=class{totalItems=0};var Yl=class{id=null;label=null};var Jl=class{type=null;id=null;label=null};var Qa=class{id=null;source=null;type=null};var _=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 Ka=class extends _{};var Zl=class{fixtures=[];tiebreaker};var qp=(i=>(i.PARTICIPANT_ONE="PARTICIPANT_ONE",i.PARTICIPANT_TWO="PARTICIPANT_TWO",i.DRAW="DRAW",i))(qp||{});var ja=class{matchId="";participantOne="";participantTwo="";winner="PARTICIPANT_ONE"};var Et=(o=>(o.OPEN="OPEN",o.LIVE="LIVE",o.PENDING="PENDING",o.CANCELED="CANCELED",o.CLOSED="CLOSED",o.SETTLED="SETTLED",o))(Et||{});var Xa=class extends _{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(Et).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 Ya=class{profileId="";profileModel=null;challengeId="";challengeModel=null;message=""};var Pe=class{name="";description="";invitation_code="";template_id="";users_can_invite_users=!1;administrators=[];scoring_starts_at=""};var Ja=class extends Pe{type="ONE_VS_ONE"};var _e=class{name="";description="";invitation_code="";template_id="";users_can_invite_users=!1;administrators=[];pinned_posts=[];scoring_starts_at=""};var Za=class extends _e{type="ONE_VS_ONE"};var tr=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 er=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 ir=class{templateId="";templateModel=null;challengeId="";challengeModel=null;position="";points=0;type="challenge"};var ar=class{id="";label="";discussionType="LEAGUE";moderationType="USER";postsCount=0;pinnedPosts=[];lastPostId="";status="";deleted=!1;deletedAt="";deletedBy="";customFields=null;context=null;createdAt="";updatedAt=""};var tp=class{content="";replyId="";userNickname="";context=null};var Te=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 rr=class extends Te{userModel=null};var or=class{content="";reply_id="";anonymous_nickname="";context=null};var sr=class{id="";postsCount=0};var St=class{pagination={totalItems:0,nextPageStartsAfter:"",lastCommentCreateTimestamp:""}};var nr=class{meta=new St;data=[]};var lr=class{meta=new St;data=[]};var pr=class{meta=new w;data=[]};var cr=class{type="";userIds=[];reactionCount=0};var ur=class{userId=null;reason="AD";reasonDetails=null};var dr=class{updatedAt="";content=""};var au=["CREATED_AT_ASC","CREATED_AT_DESC","POSTS_COUNT_ASC","POSTS_COUNT_DESC"],ru=["ACTIVE","INACTIVE"],mr=class extends _{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.label}`),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&&au.includes(this.sort.toUpperCase())&&(t+=`&sort=${this.sort.toUpperCase()}`),this.status&&ru.includes(this.status.toUpperCase())&&(t+=`&status=${this.status.toUpperCase()}`),this.skipDeleted!==null&&(t+=`&skip_deleted=${this.skipDeleted}`),t}};var Bt=class extends _{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 hr=class extends _{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 fr=class{templateId=null;playerId=null};var gr=class{filters=new fr};var yr=class{meta=new gr;data=[]};var br=class{key=null;label=null;value=null};var Mr=class{templateId=null};var wr=class{filters=new Mr};var Ir=class{meta=new wr;data=[]};var Fe=class{template_id=null;group_id=null;fixtures=[]};var Ee=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 Se=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 Pr=class{matchId=null;matchModel=null;points=new Ee;stats=new Se};var _r=class{playerId=null;playerModel=null;points=null;rank=null};var Tr=class{id="";country=null;gender="";assets=null;type="";name=""};var Fr=class{id="";country=null;gender="";assets=null;type="";name="";participants=[]};var Er=class{id="";alias="";countryCode="";assets=null;name=""};var Sr=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 et=class{type=null;subType=null};var Rr=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 et;lineups=null};var Rt=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 vr=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 Cr=class{ftScore=null;htScore=null;aetScore=null;aggScore=null;penScore=null};var Re=class{homeTeam={players:[]};awayTeam={players:[]}};var Ar=class{minute="";type="";teamId="";player=null;relatedPlayer=null;updatedAt=""};var Or=class{playerId=null;minutesPlayed=null;yellowCards=null;redCards=null;goals=null;penaltyGoals=null;penaltyCommitted=null;penaltyWon=null;penaltyMissed=null;penaltySaved=null;penaltyReceived=null;ownGoals=null;assists=null;cleanSheets=null;shots=null;shotsOn=null;shotsBlocked=null;offsides=null;foulsCommitted=null;foulsWon=null;tackles=null;tacklesBlocks=null;tacklesInterceptions=null;concededGoals=null;caughtBall=null;saves=null;passes=null;crosses=null;interceptions=null;keyPasses=null;passesAccuracy=null;duels=null;duelsWon=null;dribblesAttempts=null;dribblesSuccess=null;dribblesPast=null;updatedAt=null};var xr=class{id="";country=null;birthDate="";firstName="";lastName="";name="";position="";assets=null;isDeleted=!1;teams=[]};var Lr=class{id="";country=null;birthDate="";firstName="";lastName="";name="";position="";assets=null;isDeleted=!1;competitions=[];teams=[]};var Dr=class{id="";startDate="";endDate="";shirtNumber;loan=!1;position="";country=null;name="";assets=null;birthDate=""};var Br=class{id="";country=null;birthDate="";firstName="";lastName="";name="";position="";assets=null};var gi=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 ip=class{id=null;name=null;country=null};var Nr=class{id="";name="";position="";shirtNumber;assets=null;type=""};var kr=class{id="";country=null;gender="";assets=null;name="";code="";national=!1;undecided=!1;fullName="";shortName="";isDeleted=!1};var Gr=class{primary=null;secondary=null;tertiary=null};var Ur=class{id="";country=null;gender="";assets=null;name="";competitions=[];code="";national=!1;fullName="";shortName="";isDeleted=!1;undecided=!1;colors=new Gr;squad=[]};var ap=class{teamId=null;matches=[]};var Vr=class{teams=null;players=null;competitions=null};var Hr=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 Nt=class{meta=new O;data=[]};var rp=class{logo=null};var op=class{profile=null;football=null;predictor=null;loyalty=null;topX=null;matchQuiz=null;activity=null;miniGames=null;discussions=null;privateLeagues=null;challenges=null;progress=null;voting=null;fantasy=null;helpers=null;idMapping=null;bracketGame=null;lists=null;standingGame=null;getVersion=null};var sp=class{apiKey;clientId;environment;idSchema;lang;errorHandlingMode;authProvider};var K=class{main=null;cover=null;mobile=null};var $r=class{input=null;output=null};var qr=class{meta=new $r;data=[]};var Wr=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 zr=class{general;predictor;topX;matchQuiz};var Qr=class{predictor;topX;matchQuiz;games;football;classicQuizzes;eitherOr;discussions;potm;poll};var np=class extends ye{};var lp=class{count=0;breakdown=[]};var pp=class{footballCompetitions;footballTeams;footballPlayers};var Kr=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 vt=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 jr=class extends vt{templateId=null;constructor(t){super(t),this.templateId=t?.templateId||null}constructFiltersUrl(){let t=super.constructFiltersUrl();return this.templateId&&(t+=`&template_id=${this.templateId}`),t}};var Xr=class extends vt{sortOrder=null;rankType=null;leaderboardIds=null;gameType=null;constructor(t){super(t),this.sortOrder=t.sortOrder,this.rankType=t.rankType,this.leaderboardIds=t.leaderboardIds,this.gameType=t.type&&t.type.toLowerCase()==="game"?t.gameType:null}constructFiltersUrl=()=>{let t=super.constructFiltersUrl();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}`),t}};var Yr=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 Jr=class{position=null;points=null;predictionsMade=null;profileId=null;profileModel=null;successRatePercent=null};var ve=class{templateId=null;privateLeagueId=null;fromDate=null;toDate=null;pagination=new z};var cp=class{meta=new ve;data=[]};var Ct=class{rankType=null;fromDate=null;toDate=null;pagination=new z};var up=class{meta=new Ct;data=[]};var Ce=class{position=null;profileId=null;profileModel=null;points=null;predictionsMade=null};var Zr=class{flags="";status="";type="";activeFrom="";activeTo="";createdFrom="";createdTo="";updatedFrom="";updatedTo=""};var to=class{pagination=new z;filters=new Zr};var dp=class{id=null;points=null};var mp=class extends ue{points;alternative;constructor(){super(),delete this.weight}};var eo=class extends Ce{id=null;rankType=null;model=null;gameType=null};var hp=class{meta=new Ct;data=[]};var io=class{groupId;averagePoints;highestPoints};var At=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 ao=class extends At{adContent=null};var ro=class{groupId=null;label=null;flags=[];filters=null};var oo=class{fromDate=null;toDate=null;matchIds=[]};var fp=class{enabled=!1;id=null;label=null;points=null};var so=class{value=null;target=null;playerId=null;playerModel=null;result=null};var no=class{matchId=null;matchType=null;market=null;matchModel=null;matchStatus=new et;prediction=new so};var lo=class{gameId=null;results=null;tieBreakers=null};var ut=class{timeTiebreaker=!1};var bt=class{id=null;title=null;description=null;type=null;status=null;authRequirement=null;outcome=null;predictionsCutoff=null;fixtures=[];tiebreaker=new ut;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 Ae=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 Oe=class extends _{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 po=class extends Oe{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 co=class extends Ae{rules=null;questions=[]};var uo=class{questionId=null;question=null;images=null;embedCode=null;explanation=null;options=[]};var mo=class{optionId=null;option=null;images=null;correct=null};var gp=class{questionId=0;optionId=0};var ho=class{classicQuizId=null;userId=null;questions=[];correctOptions=null;personalBest=null;points=null;attempts=null};var fo=class{questionId=null;optionId=null;correct=null;correctOptionId=null};var go=class extends _{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 yo=class{classicQuizId=null;classicQuizModel=null;correct=null;classicQuizQuestions=null;personalBest=null;points=null;answers=[]};var yp=class{meta=new w;data=[]};var bo=class{questionId=null;questionModel=null;wrong=null;correct=null;skipped=null;total=null};var xe=class{classicQuizIds=null};var Le=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 Mo=class extends Le{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 De=class{pagination=new z;filters=new xe};var wo=class{position=null;profileId=null;profileModel=null;points=null};var Io=class{position=null;classicQuizId=null;classicQuizModel=null;points=null};var bp=class{meta=new O;data=[]};var Mp=class{meta=new De;data=[]};var Be=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 Po=class extends Oe{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 _o=class extends Be{rules=""};var To=class{correctSteps=0;score=0};var wp=class{meta=new w;data=[]};var Fo=class{eitherOrId="";personalBest=0;betterThan=0};var Eo=class{instanceId="";eitherOrId="";gameStartedAt="";currentStep=0;currentStreak=0;remainingSteps=0;currentLives=0;currentPoints=0;personalBest=0;participationCount=0;finishedParticipationsCount=0;steps=[]};var So=class{pair="";answer=""};var Ro=class extends So{expired=!1;time=0};var vo=class{main;mobile};var yi=class{id="";label="";images=new vo;value=null};var Co=class{pairId="";userSelection="";correct=null;played=null;timestamp="";optionOne=new yi;optionTwo=new yi};var Ao=class{rangeStartInclusive=0;rangeEndInclusive=0;totalUsers=0};var Oo=class{standings=[];breakdown=[]};var xo=class{userId="";userModel=null;personalBest=""};var Ne=class{content=null;tags=[];campaign=null};var ke=class{id=null;model=null;source=null;type=null};var Lo=class{questions=null;correctAnswers=null};var Ip=class{main=null;all=null};var Do=class{value=null;playerId=null;playerModel=null};var Ge=class{market=null;matchId=null;matchType=null;matchModel=null;prediction=new Do;result=null};var Ue=class{settledAt=null;resettledAt=null;status=null;outcome=null;points=0};var it=class{value=!1};var Bo=class{matchId=null;market="BOTH_TEAMS_SCORE";matchType="FOOTBALL";prediction=null;constructor(t,e){this.matchId=t,this.prediction=new it,this.prediction.value=e}};var No=class{value};var ko=class{matchId=null;market="CORNERS_MATCH";matchType="FOOTBALL";prediction=null;constructor(t,e){this.matchId=t,this.prediction=new No,this.prediction.value=e}};var Go=class{value=null};var Ot=class{matchId=null;market=null;matchType="FOOTBALL";prediction=null;constructor(t,e,i){this.matchId=t,this.market=e,this.prediction=new Go,this.prediction.value=i}};var Uo=class{value=null};var Vo=class{matchId=null;market="DOUBLE_CHANCE";matchType="FOOTBALL";prediction=null;constructor(t,e){this.matchId=t,this.prediction=new Uo,this.prediction.value=e}};var Ho=class{value=null};var $o=class{matchId=null;market="HT_FT";matchType="FOOTBALL";prediction=null;constructor(t,e){this.matchId=t,this.prediction=new Ho,this.prediction.value=e}};var qo=class{value=null};var Wo=class{matchId=null;market=null;matchType="FOOTBALL";prediction=null;constructor(t,e,i){this.matchId=t,this.market=e,this.prediction=new qo,this.prediction.value=i}};var Ve=class{matchId=null;market=null;matchType="FOOTBALL";prediction=null;constructor(t,e,i){this.matchId=t,this.market=e,this.prediction=new it,this.prediction.value=i}};var He=class{matchId=null;market=null;matchType="FOOTBALL";prediction=null;constructor(t,e,i){this.matchId=t,this.market=e,this.prediction=new it,this.prediction.value=i}};var zo=class{matchId=null;market="PENALTY_MATCH";matchType="FOOTBALL";prediction=null;constructor(t,e){this.matchId=t,this.prediction=new it,this.prediction.value=e}};var Qo=class{value=!1;playerId=null};var at=class{matchId=null;market=null;matchType="FOOTBALL";prediction=null;constructor(t,e,i,a){this.matchId=t,this.market=e,this.prediction=new Qo,this.prediction.value=i,this.prediction.playerId=a}};var Ko=class{matchId=null;market="RED_CARD_MATCH";matchType="FOOTBALL";prediction=null;constructor(t,e){this.matchId=t,this.prediction=new it,this.prediction.value=e}};var Pp=class{home=null;draw=null;away=null};var _p=class{score=null;percentage=null};var $e=class{homeGoals=null;awayGoals=null};var jo=class{playerId=null;playerModel=null};var Xo=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 jo;PLAYER_SCORE=[];PLAYER_SCORE_TWICE=[];PLAYER_SCORE_HATTRICK=[];CORRECT_SCORE=new $e;CORRECT_SCORE_ADVANCED=new $e;CORRECT_SCORE_HT=new $e;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 A=class{no=0;yes=0};var qe=class{gameInstanceId=null;fixtures=null};var dt=class{goldenGoal=null};var bi=class{id=null;gameInstanceId=null;gameType=null;wager=null;totalFixtures=null;settledFixtures=null;userId=null;fixtures=[];status=null;tiebreaker=new dt;points=null;templateId=null;groupId=null;profileLastUpdatedAt=null;createdAt=null;updatedAt=null};var cn=(r=>(r.ACTIVE="ACTIVE",r.WON="WON",r.LOST="LOST",r.PARTIALLY_WON="PARTIALLY_WON",r.CANCELED="CANCELED",r))(cn||{}),Wp=["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(cn).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 Yo=class{fullTimeOneXTwo={};halfTimeOneXTwo={};bothTeamsScore=new A;doubleChance={};halfTimeFullTime={};playerScore={};playerYellowCard={};playerRedCard={};redCardMatch=new A;penaltyMatch=new A;playerScoreFirstGoal={};cornersMatch={};correctScore={};correctScoreHalfTime={};correctScoreAdvanced={};playerScoreHattrick={};playerScoreTwice={};overZeroPointFiveGoals=new A;overOnePointFiveGoals=new A;overTwoPointFiveGoals=new A;overThreePointFiveGoals=new A;overFourPointFiveGoals=new A;overFivePointFiveGoals=new A;overSixPointFiveGoals=new A;overSixPointFiveCorners=new A;overSevenPointFiveCorners=new A;overEightPointFiveCorners=new A;overNinePointFiveCorners=new A;overTenPointFiveCorners=new A;overElevenPointFiveCorners=new A;overTwelvePointFiveCorners=new A;overThirteenPointFiveCorners=new A};var Jo=class{matchId=null;matchType=null;predictions=null};var Zo=class{profileId="";profileModel=null;leagueId="";leagueModel=null;message=""};var Tp=class{id=null;name=null;model=new At};var We=class{id="";name="";description="";type="";banned=[];invites=[];administrators=[];membersCount=0;invitationCode="";templateId="";templateModel=null;pastTemplates=[];usersCanInviteUsers=!1;scoringStartsAt="";pinnedPosts=[]};var ts=class extends We{members=[]};var Fp=class{name="";description="";invitationCode="";templateId="";usersCanInviteUsers=!1;administrators=[];scoringStartsAt=""};var Ep=class{name="";description="";invitationCode="";templateId="";usersCanInviteUsers=!1;administrators=[];pinnedPosts=[];scoringStartsAt=""};var es=class{predictionId=null;predictionModel=null;profileId=null;profileModel=null};var Sp=class{meta=new O;data=[]};var Rp=class{meta=new w;data=[]};var ze=class extends _{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 is=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 as=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 Qe=class extends _{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 Ke=class{limit=null;page=null;profileIds=null;constructor(t){this.limit=t&&t.limit?t.limit:null,this.page=t&&t.page?t.page:null,this.profileIds=t&&t.profileIds?t.leagueId:null}constructFiltersUrl=()=>{let t="";return this.limit&&(t+=`&limit=${this.limit}`),this.page&&(t+=`&page=${this.page}`),this.profileIds&&(t+=`&profile_ids=${this.profileIds.join(",")}`),t}};var rs=class{templateId="";templateModel=null;privateLeagueId="";privateLeagueModel=null;position="";points=0;type="private_league"};var os=class extends Pe{type="PRIVATE"};var ss=class extends _e{type="PRIVATE"};var ns=class{id="";source="";type="";favourite=!1};var ls=class extends ns{model=null};var vp=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 ps=class extends _{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(Et).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 cs=class extends _{};var us=class{matchId=null;matchType=null;market=null;matchModel=null;matchStatus=new et};var ds=class{value=null;result=null};var ms=class{matchId=null;matchType=null;market=null;matchModel=null;matchStatus=new et;prediction=new ds};var Mt=class{id=null;title=null;description=null;type=null;status=null;authRequirement=null;scheduleOpenAt=null;predictionsCutoff=null;fixtures=[];tiebreaker=new ut;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 Mt{adContent=null};var kt=class{userId=null;points=null;results=[];tiebreaker=null};var hs=class{matchId=null;matchModel=null;outcome=null};var rt=class extends _{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(Et).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 xt=class{id=null;title=null;description=null;type=null;status=null;authRequirement=null;outcome=null;predictionsCutoff=null;fixtures=[];tiebreaker=new ut;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 dt;branding=null};var fs=class{contestId="";contestType="GAME";contestModel=null;description="";userList=[]};var gs=class{position="";profileId="";profileModel=null;note="";tags=[]};var Xe=class{gameInstanceId=null;fixtures=[];tiebreaker=null;constructor(t){this.gameInstanceId=t.gameInstanceId,t.fixtures.forEach(e=>this.fixtures.push(new Ot(e.matchId,e.market,e.prediction.value))),this.tiebreaker=t.tiebreaker?t.tiebreaker:null}};var Ye=class extends _{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 Je=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 ys=class extends Je{rules=null};var Cp=class{id=null;title=null;description=null;images=new K;votes=null};var Ze=class{id=null;pollId=null;optionId=null;userId=null};var bs=class extends Ze{pollModel=null;optionModel=null};var Ms=class{meta=new w;data=[]};var ws=class{meta=new w;data=[]};var Is=class extends _{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 Ps=class{meta=new w;data=[]};var _s=class{matchId=null;matchModel=null;playerId=null;playerModel=null;createdAt=null};var Ts=class{total};var Fs=class{meta=new Ts;data=[]};var Es=class{teamId=null;teamModel=null;playerId=null;playerModel=null;votes=null;winner=null};var Ss=class{meta=new O;data=[]};var un=class{remapListContent=t=>{let e=new Ss;return e.meta=this.remapMeta(t.meta),e.data=t.data.map(i=>{let a=new za;return a.entityId=i.entity_id,a.entityType=i.entity_type,a}),e};remapMeta=t=>{let e=new O;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 v{featureConfigRemapper=null;listContentRemapper=null;localStorage=null;clientId=null;constructor(t){super(t,C(t.environment,"client")),this.clientId=t.clientId,this.localStorage=new st().createLocalCacheInstance(t.idSchema),this.featureConfigRemapper=new pn,this.listContentRemapper=new un}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+h(),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()),f(i)&&(a+=h());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 wt=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 O;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 g(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 wt(t)}getTeamsIdMapping=async(t,e)=>{try{let i=!1;if(t){if(t=new fi(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 fi({teamIds:t,limit:i}),{data:r}=await this.getTeams(a);r.sort((l,p)=>l.id.localeCompare(p.id));let o=Ul(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 Gt=class{https=null;footballService=null;idMapping=null;constructor(t,e,i){this.idMapping=i,this.https=e,this.footballService=new wt(t)}getPlayersIdMapping=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.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 gi({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=Yt(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 Ut=class{https=null;idMapping=null;footballService=null;constructor(t,e,i){this.https=e,this.idMapping=i,this.footballService=new wt(t)}getMatchesIdMapping=async(t,e)=>{try{if(t){if(t=new Rt(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 Rt({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=Yt(t);i.sort((r,o)=>r.localeCompare(o));let a=await this.getMatchesWithNativeIds(Array.from(i));if(i.length!==a.length){let r=new Rt({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 mn=class{https=null;idMapping=null;constructor(t,e){this.https=t,this.idMapping=e}searchIdMapping=async(t,e)=>{try{if(t=new Hr(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 nt=class{errorHandlingModel=null;constructor(t){this.errorHandlingModel=t}throwException=(t,e,i)=>{throw this.errorHandlingModel==="standard"?new m(t,e,i):new g(t,e,i)}};var hn=class extends nt{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 Mi=class{countriesFacade=null;competitionsFacade=null;teamsFacade=null;playerFacade=null;matchFacade=null;searchFacade=null;validator=null;constructor(t,e,i,a){this.countriesFacade=new nn(e,i,a),this.competitionsFacade=new ln(e,i,a),this.teamsFacade=new dn(t,i,a),this.playerFacade=new Gt(t,i,a),this.matchFacade=new Ut(t,i,a),this.searchFacade=new mn(i,a),this.validator=new hn(t)}getCountries=async t=>this.countriesFacade.getCountriesWithIdMapping(t);getCompetitions=async(t,e)=>this.competitionsFacade.getCompetitionsIdMapping(t,e);getCompetitionById=async(t,e)=>this.competitionsFacade.getCompetitionByIdIdMapping(t,e);getTopCompetitions=async t=>this.competitionsFacade.getTopCompetitionsIdMapping(t);getCompetitionsMapWithNativeIds=async t=>await this.competitionsFacade.getCompetitionsMapWithNativeIds(t);getTeams=async(t,e)=>this.teamsFacade.getTeamsIdMapping(t,e);getTeamById=async(t,e)=>this.teamsFacade.getTeamByIdIdMapping(t,e);getTopTeams=async t=>this.teamsFacade.getTopTeamsIdMapping(t);getNextMatchForTeam=async(t,e)=>this.teamsFacade.getNextMatchForTeamIdMapping(t,e);getPrevMatchForTeam=async(t,e)=>this.teamsFacade.getPrevMatchForTeamIdMapping(t,e);getTeamsMapWithNativeIds=async t=>await this.teamsFacade.getTeamsMapWithNativeIds(t);getPlayers=async(t,e)=>this.playerFacade.getPlayersIdMapping(t,e);getPlayerById=async(t,e)=>this.playerFacade.getPlayerIdMapping(t,e);getTopPlayers=async t=>this.playerFacade.getTopPlayersIdMapping(t);getNextMatchForPlayer=async(t,e)=>this.playerFacade.getNextMatchForPlayerIdMapping(t,e);getPrevMatchForPlayer=async(t,e)=>this.playerFacade.getPrevMatchForPlayerIdMapping(t,e);getPlayersMapWithNativeIds=async t=>this.playerFacade.getPlayersMapWithNativeIds(t);getMatches=async(t,e)=>this.matchFacade.getMatchesIdMapping(t,e);getMatchesMapWithNativeIds=async t=>this.matchFacade.getMatchesMapWithNativeIds(t);getMatchById=async(t,e)=>this.matchFacade.getMatchIdMapping(t,e);search=async(t,e)=>this.searchFacade.searchIdMapping(t,e);getTeamForm=async(t,e,i)=>{this.validator.validateTeamFormArguments(t,e);let a=e?.direction||"ltr",r={teamIds:[t],competitionIds:e&&e.competitionId?[e.competitionId]:null,status:"finished",limit:e?.limit||5,sortField:"date",sortOrder:"desc"},o=await this.matchFacade.getMatchesIdMapping(r,i),n={teamId:t,matches:[]};if(n.matches=o.data.map(l=>{let p=l.homeTeam.id===t,c=l.scores.ftScore.homeGoals??0,u=l.scores.ftScore.awayGoals??0,d;return p?d=c>u?"W":c<u?"L":"D":d=u>c?"W":u<c?"L":"D",{matchModel:l,isHomeGame:p,result:d}}),a==="ltr"){let l=Array.from(n.matches);n.matches=l.reverse()}return n}};var H=class{countriesFromResponse=t=>{if(t)return t.map(e=>this.countryFromResponse(e))};countryFromResponse=t=>{try{if(t){let e=new Er;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 Tr;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 kr;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 fn=class{countryRemapper=null;teamBasicRemapper=null;constructor(){this.countryRemapper=new H,this.teamBasicRemapper=new W}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.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 Dr;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 yn=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 Ur;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 wi=class{fromResponse(t){try{let e=new Cr;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 bn=class{teamRemapper=null;competitionRemapper=null;scoresRemapper=null;constructor(){this.teamRemapper=new W,this.competitionRemapper=new X,this.scoresRemapper=new wi}fromResponse(t){try{let e=new Sr;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 Mn=class{fromResponse(t){try{let e=new vr;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 Ii=class{fromResponse(t){try{let e=new Nr;return e.id=t.id,e.name=t.name,e.position=t.position,e.shirtNumber=t.shirt_number,e.assets=t.assets,e.type=t.type,e}catch(e){throw console.warn("There was a problem remapping the player from timeline",e),e}}};var wn=class{playerRemapper=null;constructor(){this.playerRemapper=new Ii}fromResponse(t){try{let e=new Re;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 In=class{playerRemapper=null;constructor(){this.playerRemapper=new Ii}fromResponse(t){try{let e=new Ar;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 Pn=class{fromResponse(t){try{let e=new Or;return e.playerId=t.player_id,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 _n=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 wn,this.scoresMapper=new wi,this.statsMapper=new Mn,this.timelineMapper=new In,this.playerStatsMapper=new Pn}fromResponse(t){try{let e=new Rr;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 Re,e}catch(e){throw console.warn("There was a problem remapping the match response",e),e}}};var Tn=class{countryRemapper=null;constructor(){this.countryRemapper=new H}fromResponse(t){try{let e=new Br;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 Pi=class{countryRemapper=null;teamRemapper=null;constructor(){this.countryRemapper=new H,this.teamRemapper=new W}fromResponse(t){try{let e=new xr;return e.id=t.id,e.firstName=t.first_name?t.first_name:null,e.lastName=t.last_name?t.last_name:null,e.name=t.name?t.name:null,e.birthDate=t.birth_date,e.country=this.countryRemapper.countryFromResponse(t.country),e.assets=t.assets,e.teams=t.teams?t.teams.map(i=>this.teamRemapper.fromResponse(i)):[],e.position=t.position,e.isDeleted=t.is_deleted,e}catch(e){throw console.warn("There was a problem remapping players response",e),e}}};var Fn=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 Lr;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 En=class{teamRemapper=null;playerRemapper=null;competitionremapper=null;constructor(){this.teamRemapper=new W,this.playerRemapper=new Pi,this.competitionremapper=new X}fromResponse(t){try{let e=new Vr;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 Sn=class{remapMetaProp=t=>{let e=new O;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 Rn=class{remapPlayersPoints=t=>{let e=new Ir;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 _r;return e.playerId=t.player_id,e.points=t.points,e.rank=t.rank,e};remapPlayerDetailedStats=t=>{let e=new yr;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 Pr;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 Ee;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 Se;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 lt=class extends v{limitIds=200;countryRemapper=null;competitionBasicRemapper=null;competitionFullRemapper=null;teamBasicRemapper=null;teamFullRemapper=null;matchBasicRemapper=null;matchFullRemapper=null;playerBasicRemapper=null;playerFullRemapper=null;topPlayerRemapper=null;searchRemapper=null;footballMetaRemapper=null;fantasyRemapper=null;footballService=null;constructor(t){super(t,C(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 fn,this.teamBasicRemapper=new W,this.teamFullRemapper=new yn,this.matchBasicRemapper=new bn,this.matchFullRemapper=new _n,this.playerBasicRemapper=new Pi,this.playerFullRemapper=new Fn,this.topPlayerRemapper=new Tn,this.searchRemapper=new En,this.footballMetaRemapper=new Sn,this.footballService=new wt(t),this.fantasyRemapper=new Rn}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=ri(t.competitionIds,this.limitIds);for(let l of o){t.competitionIds=l;let p=`/competitions${this.apiSignInUrl}${t.constructFilterUrl()}`;e&&(p+=`&disable_cache=${i}`);let c=await this.fetchWithoutAuth(p,a);r.push(c.data.map(u=>this.competitionBasicRemapper.fromResponse(u)))}return Array.prototype.concat.apply([],r)}else{let r=`/competitions${this.apiSignInUrl}`;return t&&(r+=`${t.constructFilterUrl()}`),e&&(r+=`&disable_cache=${i}`),(await this.fetchWithoutAuth(r,a)).data.map(n=>this.competitionBasicRemapper.fromResponse(n))}};getCompetitionById=async(t,e)=>{let i=`/competitions/${t}${this.apiSignInUrl}`,a="There was a problem with football competition by ID request",r=Date.now();e&&(i+=`&disable_cache=${r}`);let o=await this.fetchWithoutAuth(i,a);return this.competitionFullRemapper.fromResponse(o.data)};getTopCompetitions=async t=>{let e="There was a problem with top football competitions request",i=`/competitions/top${this.apiSignInUrl}`,a=Date.now();return t&&(i+=`&disable_cache=${a}`),(await this.fetchWithoutAuth(i,e)).data.map(o=>this.competitionBasicRemapper.fromResponse(o))};getTeams=async(t,e)=>{let i=Date.now(),a="There was a problem with football teams request";if(t&&t.teamIds&&t.teamIds.length>this.limitIds){let r=[],o=ri(t.teamIds,this.limitIds);for(let l of o){t.teamIds=l,t.limit=l.length;let p=`/teams${this.apiSignInUrl}${t.constructFilterUrl()}`;e&&(p+=`disable_cache=${i}`);let c=await this.fetchWithoutAuth(p,a);r.push(c.data.map(u=>this.teamBasicRemapper.fromResponse(u)))}return Array.prototype.concat.apply([],r)}else{let r=new Nt,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=ri(t.playerIds,this.limitIds);for(let p of o){t.playerIds=p,t.limit=p.length;let c=`/players${this.apiSignInUrl}${t.constructFilterUrl()}`;e&&(c+=`&disable_cache=${i}`);let u=await this.fetchWithoutAuth(c,a);r.push(u.data.map(d=>this.playerBasicRemapper.fromResponse(d)))}let n=Array.prototype.concat.apply([],r),l=new Nt;return l.data=n,l}else{let r=new Nt,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 Nt,a="There was a problem with football matches request";if(t&&t.matchIds&&t.matchIds.length>this.limitIds){let r=[],o=ri(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+=h());let u=await this.fetchWithoutAuth(c,a);r.push(u.data.map(d=>this.matchBasicRemapper.fromResponse(d)))}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+=h());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 vn=class{idMapping=null;idSchema=null;native="native";footballFacade=null;constructor(t,e,i){this.idMapping=i,this.idSchema=t.idSchema,this.footballFacade=e}remapProfileStats=async t=>{if(!t.predictions)return t;let{successRates:e,predictions:i}=t,a={competition:this.getIdsKeys(e.byFootballCompetition,i.single.breakdown.footballCompetitions),team:this.getIdsKeys(e.byFootballTeam,i.single.breakdown.footballTeams)};if(Object.values(a.competition).length){let r=JSON.parse(JSON.stringify(t.successRates.byFootballCompetition)),o=await this.getEntitiesMap(a.competition,"competition"),n=await this.setSuccessRatesModels(r,o);t.successRates.byFootballCompetition=n,i.single.breakdown.footballCompetitions=this.reconstructBreakdown(i.single.breakdown.footballCompetitions,o)}if(Object.values(a.team).length){let r=JSON.parse(JSON.stringify(t.successRates.byFootballTeam)),o=await this.getEntitiesMap(a.team,"team"),n=await this.setSuccessRatesModels(r,o);t.successRates.byFootballTeam=n,i.single.breakdown.footballTeams=this.reconstructBreakdown(i.single.breakdown.footballTeams,o)}return t};setSuccessRatesModels=async(t,e)=>{let i;return this.reconstructRecords(t,i,e)};getEntitiesMap=async(t,e)=>{switch(e){case"competition":return await this.footballFacade.getCompetitionsMapWithNativeIds(t);case"team":return await this.footballFacade.getTeamsMapWithNativeIds(t)}};reconstructRecords=(t,e,i)=>t&&Object.keys(t).length?(Object.keys(t).forEach(a=>{let r=i.get(a);e={...e,[r.id]:t[a]},e[r.id].model=r}),e):t;reconstructBreakdown=(t,e)=>t.length?t.map(i=>{let a=e.get(i.entityId);return i.entityId=a.id,i.model=a,i}):t;getIdsKeys=(t,e)=>{let i=Object.keys(t);if(e.length){let a=e.map(r=>r.entityId);return Array.from(new Set([...i,...a]))}return i};remapInterestsToIdSchema=async t=>{if(this.idSchema!==this.native)if(t&&t.length>0){let e={},i={},a=t.filter(l=>l.source.toLocaleUpperCase()==="FOOTBALL"),r=t.filter(l=>l.source.toLocaleUpperCase()!=="FOOTBALL");a.forEach(l=>{e.hasOwnProperty(l.type)||(e[l.type]=[],i[l.type]=[]),e[l.type].push(l.id),i[l.type].push(l)});let o=await this.remapIdsObj(e,this.native,this.idSchema),n=[];for(let[l,p]of Object.entries(i))p.forEach((c,u)=>{c.id=o[l][u],n.push(c)});return n.concat(r)}else return t;return t};remapInterestToNative=async t=>{if(this.idSchema!==this.native&&t.source.toLocaleUpperCase()==="FOOTBALL"){let e={},{id:i,type:a}=t;e[a]=[i];let r=await this.remapIdsObj(e,this.idSchema,this.native);return t.id=r[a][0],t}return t};inquiryCustomInterests=(t,e)=>{let i=[];return t&&t.length>0&&(i=t.filter(a=>a.source.toLocaleUpperCase()==="CUSTOM"),e)?i.map(a=>{let r=new ls;return r.id=a.id,r.type=a.type,r.source=a.source,r.favourite=a.favourite,r}):i};remapInterests=async t=>{let i=this.inquiryCustomInterests(t,!1);if(i&&i.length>0){let a=t.filter(o=>o.source.toLocaleUpperCase()!=="CUSTOM"),r=await this.remapInterestsToIdSchema(a);return i.forEach(o=>r.push(o)),r}return await this.remapInterestsToIdSchema(t)};showFullInterests=async t=>{let e=[];if(t&&t.length>0){let a=this.inquiryCustomInterests(t,!0);e.push(a);let r=t.filter(c=>c.source.toLocaleUpperCase()!=="CUSTOM"),{competitionsMap:o,teamsMap:n,playersMap:l}=await this.getInterestsEntitiesMap(r),p=r.map(c=>{let u=null;if(c.source.toLocaleUpperCase()==="FOOTBALL"){if(c.type==="competition")return u=o.get(c.id),u&&(c.id=u.id),c.model=u,c;if(c.type==="team")return u=n.get(c.id),u&&(c.id=u.id),c.model=u,c;if(c.type==="player")return l?(c.model=l[c.id],c.id=l[c.id].id):c.model=u,c}else return c.model=u,c});return e.push(p),e.flat()}return e};getInterestsEntitiesMap=async t=>{let e=[],i=[],a=[],r=new Map,o=new Map,n=null;return t.forEach(l=>{l.type==="competition"&&l.source.toLocaleUpperCase()==="FOOTBALL"?e.push(l.id):l.type==="team"&&l.source.toLocaleUpperCase()==="FOOTBALL"?i.push(l.id):l.type==="player"&&l.source.toLocaleUpperCase()==="FOOTBALL"&&a.push(l.id)}),e.length&&(r=await this.footballFacade.getCompetitionsMapWithNativeIds(e)),i.length&&(o=await this.footballFacade.getTeamsMapWithNativeIds(i)),a.length&&(n=await this.footballFacade.getPlayersMapWithNativeIds(a)),{competitionsMap:r,teamsMap:o,playersMap:n}};remapIdsObj=async(t,e,i)=>await this.idMapping.idMappingFacade.getEntitiesByIds(t,e,i)};var Cn=class{idMapping=null;profileOperations=null;constructor(t,e){this.idMapping=new E(t),this.profileOperations=new vn(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 di(t),this.activityHttps=new si(t),this.footballHttps=new lt(t),this.idMapping=new E(t),this.localCache=new st().createLocalCacheInstance(t.idSchema),this.footballFacade=new Mi(t,this.localCache,this.footballHttps,this.idMapping),this.profileFacade=new yt(this.localCache,this.profileHttps,this.activityHttps,t.errorHandlingMode),this.idsRemapper=new Cn(t,this.footballFacade),this.ownProfileBuilder=new on(t,this.idsRemapper,this.localCache,this.profileHttps,this.activityHttps),this.profileBuilder=new sn(this.idsRemapper,this.localCache,this.profileHttps,this.activityHttps)}getOwn=()=>this.ownProfileBuilder;getById=t=>this.profileBuilder.setId(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)};var An=class extends _{};var Rc=(r=>(r.LIKE="like",r.DISLIKE="dislike",r.SHARE="share",r.COMMENT="comment",r.PREDICTION_MADE="prediction_made",r))(Rc||{});var vc=(a=>(a.CORRECT="CORRECT",a.INCORRECT="INCORRECT",a.PARTIALLY_CORRECT="PARTIALLY_CORRECT",a.NOT_VERIFIED="NOT_VERIFIED",a))(vc||{});var On=(i=>(i.ONE="1",i.X="x",i.TWO="2",i))(On||{}),xn=(i=>(i.ONE_X="1x",i.X_TWO="x2",i.ONE_TWO="12",i))(xn||{}),Ln=(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))(Ln||{});var Dn=class extends nt{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 ja);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 Bn=class{https=null;validator=null;profile=null;constructor(t){this.https=new ci(t),this.profile=new U(t),this.validator=new Dn(t.errorHandlingMode)}getGames=async(t,e)=>(t&&(t=new Xa(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 Ka(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 An(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 Nn=class{facade=null;constructor(t){this.facade=new Bn(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 kn=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 Ct;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 ve;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 Ce;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 io;return e.groupId=t.group_id,e.averagePoints=t.average_points,e.highestPoints=t.highest_points,e}};var Gn=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 O;return e.pagination.currentPage=t.pagination.current_page,e.pagination.itemsPerPage=t.pagination.items_per_page,e.pagination.numberOfPages=t.pagination.number_of_pages,e.pagination.totalItems=t.pagination.total_items,e};remapData(t){let e=[];return t.forEach(i=>{let a=new eo;a.id=i.id,a.rankType=i.rank_type,a.position=i.position,a.points=i.points,a.gameType=i.game_type,delete a.profileId,delete a.profileModel,delete a.predictionsMade,e.push(a)}),e}remapDataUserRankingPrivateLeague(t){let e=[];return t.forEach(i=>{let a=new rs;a.templateId=i.template_id,a.privateLeagueId=i.private_league_id,a.position=i.position,a.points=i.points,e.push(a)}),e}remapDataUserRankingChallenge(t){let e=[];return t.forEach(i=>{let a=new ir;a.templateId=i.template_id,a.challengeId=i.private_league_id,a.position=i.position,a.points=i.points,e.push(a)}),e}};var Un=class{entityId=null;entityType=null};var Vn=class{primaryColor=null;secondaryColor=null;contentColor=null;backgroundColor=null;borderColor=null;additionalColor=null};var Hn=class{mainLogo=null;mobileLogo=null;backgroundImage=null;mobileBackgroundImage=null;additionalImage=null};var $n=class{colors=null;urls=null;images=null};var qn=class{primaryUrl=null;secondaryUrl=null;privacyPolicyUrl=null;termsAndConditionsUrl=null;additionalUrl=null};var pt=class{remapBranding=t=>{let e=new $n;return t.colors&&(e.colors=new Vn,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 qn,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 Hn,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 Wn=class extends pt{remapResponse=t=>{let e=[];return t.forEach(i=>{let a=new At;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 ao;return e.id=t.id,e.name=t.name,e.description=t.description,e.type=t.type,e.fromDate=t.from_date,e.toDate=t.to_date,e.markets=t.markets?t.markets:null,e.teamIds=t.team_ids?t.team_ids:null,e.matchIds=t.match_ids?t.match_ids:null,e.groups=t.groups?this.remapGroups(t.groups):null,e.gameIds=t.game_ids?t.game_ids:null,e.gameTypes=t.game_types?t.game_types:null,e.competitionIds=t.competition_ids?t.competition_ids:null,e.excludedProfileIds=t.excluded_profile_ids?t.excluded_profile_ids:null,e.rules=t.rules?t.rules:null,e.flags=t.flags?t.flags:null,e.images=t.images?t.images:null,e.status=t.status?t.status:null,e.automaticallyChangeStatus=t.automatically_change_status,e.related=t.related?this.remapRelated(t.related):null,e.labels=t.labels,e.customFields=t.custom_fields,e.branding=t.branding?this.remapBranding(t.branding):null,e.adContent=t.ad_content,e.createdAt=t.created_at,e.updatedAt=t.updated_at,e};remapMeta=t=>{let e=new to;return e.pagination.currentPage=t.pagination.current_page,e.pagination.itemsPerPage=t.pagination.items_per_page,e.pagination.totalItems=t.pagination.total_items,e.pagination.numberOfPages=t.pagination.number_of_pages,e.filters.flags=t.filters.flags,e.filters.status=t.filters.status,e.filters.type=t.filters.type,e.filters.activeFrom=t.filters.active_from,e.filters.activeTo=t.filters.active_to,e.filters.createdFrom=t.filters.created_from,e.filters.createdTo=t.filters.created_to,e.filters.updatedFrom=t.filters.updated_from,e.filters.updatedTo=t.filters.updated_to,e};remapRelated=t=>t.map(e=>{let i=new Un;return i.entityId=e.entity_id,i.entityType=e.entity_type,i});remapGroups=t=>t.map(e=>{let i=new ro;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 oo;return e.fromDate=t.from_date,e.toDate=t.to_date,e.matchIds=t.match_ids,e}};var zn=class{remapHighestSuccessRate=t=>t.map(e=>{let i=new Jr;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 It=class extends v{templateRemapper=null;leaderboardRemapper=null;rankingsRemapper=null;highestSuccessRateRemapper=null;constructor(t){super(t,C(t.environment,"loyalty")),this.templateRemapper=new Wn,this.leaderboardRemapper=new kn,this.rankingsRemapper=new Gn,this.highestSuccessRateRemapper=new zn}getTemplates=async(t,e)=>{let i=t?`/leaderboard/templates/${this.apiSignInUrl}${t.constructFiltersUrl()}`:`/leaderboard/templates/${this.apiSignInUrl}`;i+=f(e)?h():"";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=f(e)?`/leaderboard/templates/${t}${this.apiSignInUrl}${h()}`:`/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=f(e)?`/leaderboard/${t}${this.apiSignInUrl}${h()}`:`/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=f(e)?`/leaderboard/games/${t}${this.apiSignInUrl}${h()}`:`/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()}`),f(i)&&(a+=`${h()}`);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()}`),f(e)&&(i+=`${h()}`);let r=await this.fetchWithoutAuth(i,a);return this.highestSuccessRateRemapper.remapHighestSuccessRate(r.data)};getEntitiesFollows=async(t,e)=>{let i=f(e)?`/statistics/follows${this.apiSignInUrl}${h()}`:`/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 Qn=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 ts;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 We;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 Zo;return e.profileId=t.profile_id,e.leagueId=t.league_id,e.message=t.message,e};remapToAcceptChallenge=t=>{let e=new Ya;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 O;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 es;return i.predictionId=e.prediction_id,i.profileId=e.profile_id,i})};var _i=class{remapToDiscussions=t=>(t.meta=this.remapToMeta(t.meta),t.data=t.data.map(e=>this.remapToDiscussionById(e)),t);remapToDiscussionById=t=>{let e=new ar;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.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 nr,a=new lr;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 pr;return e.meta=this.remapToMeta(t.meta),e.data=t.data.map(i=>this.remapToPostByIdBasic(i)),e};remapToPostMeta=t=>{let e=new St;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 Te;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 rr;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 sr;return i.id=e.id,i.postsCount=e.posts_count,i});remapReactionsPost=t=>{let e=new cr;return e.type=t.type,e.userIds=t.user_ids,e.reactionCount=t.reaction_count,e};remapVersionsPost=t=>{let e=new dr;return e.content=t.content,e.updatedAt=t.updated_at,e};remapReportPost=t=>{let e=new ur;return e.userId=t.user_id,e.reason=t.reason,e.reasonDetails=t.reason_details,e}};var Ti=class extends v{remapper=null;discussionsRemapper=null;discussionsBaseURL=null;constructor(t){super(t,C(t.environment,"privateLeagues")),this.discussionsBaseURL=C(t.environment,"discussions"),this.remapper=new Qn,this.discussionsRemapper=new _i}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;f(i)&&(a+=h());let o=`There was a problem getting ${e==="PRIVATE_LEAGUE"?"private league":"challenge"}`,n=await this.fetchWithAuth(a,o);return this.remapper.remapToPrivateLeagueById(n.data)};getMyLeagues=async(t,e)=>{let i="/leagues"+this.apiSignInUrl+t.constructFiltersUrl(),r=`There was a problem getting user's ${e==="PRIVATE_LEAGUE"?"private leagues":"challenges"}`;return(await this.fetchWithAuth(i,r)).data.map(n=>this.remapper.remapToMyPrivateLeagues(n))};delete=async(t,e)=>{let i=`/leagues/${t}`+this.apiSignInUrl,r=`There was a problem deleting ${e==="PRIVATE_LEAGUE"?"private league":"challenge"}`,o="DELETE";return await this.fetchWithAuth(i,r,o),!0};invite=async(t,e)=>{let i=`/membership/invite/${t}`+this.apiSignInUrl,a=`There was a problem inviting the following users: ${e.join(",")}`,r="POST",o={profiles:e};return(await this.fetchWithAuth(i,a,r,o)).data};deleteInvitation=async(t,e)=>{let i=`/membership/invite/${t}`+this.apiSignInUrl,a=`There was a problem deleting invitation for the following users: ${e.join(",")}`,r="DELETE",o={profiles:e};return await this.fetchWithAuth(i,a,r,o),!0};accept=async(t,e,i)=>{let a=`/membership/accept/${t}`+this.apiSignInUrl+`&accept=${e?"ACCEPT":"REJECT"}`,o=`There was a problem ${e?"accepting":"rejecting"} invitation for ${i==="PRIVATE_LEAGUE"?"private league":"challenge"}: ${t}`,n="POST",l=await this.fetchWithAuth(a,o,n);return i==="PRIVATE_LEAGUE"?this.remapper.remapToAcceptPrivateLeague(l.data):this.remapper.remapToAcceptChallenge(l.data)};ban=async(t,e)=>{let i=`/membership/ban/${t}`+this.apiSignInUrl,a=`There was a problem banning the following users: ${e.join(",")}`,r="POST",o={profiles:e};return(await this.fetchWithAuth(i,a,r,o)).data};unban=async(t,e)=>{let i=`/membership/unban/${t}`+this.apiSignInUrl,a=`There was a problem unbanning the following users: ${e.join(",")}`,r="POST",o={profiles:e};return(await this.fetchWithAuth(i,a,r,o)).data};join=async t=>{let e="/membership/join"+this.apiSignInUrl+`&invitation_code=${t}`,i="There was a problem joining league",a="POST",r=await this.fetchWithAuth(e,i,a);return this.remapper.remapToAcceptPrivateLeague(r.data)};leave=async(t,e)=>{let i=`/membership/leave/${t}`+this.apiSignInUrl,r=`There was a problem leaving the following ${e==="PRIVATE_LEAGUE"?"league":"challenge"}: ${t}`,o="POST";return(await this.fetchWithAuth(i,r,o)).data};getInvitations=async(t,e)=>{let i="/membership/invitations"+this.apiSignInUrl+e.constructMainFiltersUrl(),r=`There was a problem getting invitations for ${t==="PRIVATE_LEAGUE"?"leagues":"challenges"}`,o=await this.fetchWithAuth(i,r);return this.remapper.remapToPrivateLeagues(o)};getReportedPosts=async(t,e)=>{let i=`/discussions/${t}/posts/reported${this.apiSignInUrl}`,a=`There was a problem fetching posts for the following: ${t}`;e&&(i+=e.constructMainFiltersUrl());let r=await this.fetchWithAuthNewBaseURL(this.discussionsBaseURL,i,a);return this.discussionsRemapper.remapToPostsForDiscussion(r,"full")};getPredictions=async(t,e)=>{let i=`/leagues/${t}/predictions`+this.apiSignInUrl,a=`There was a problem getting predictions for private league: ${t}`;e&&(i+=e.constructFiltersUrl());let r=await this.fetchWithAuth(i,a);return this.remapper.remapPredictions(r)};moderatePost=async(t,e)=>{let i=`/posts/${t}/admin/moderate${this.apiSignInUrl}`,a=`There was a problem moderating the following post: ${t}`,r="POST",o={moderation_reason:e},n=await this.fetchWithAuthNewBaseURL(this.discussionsBaseURL,i,a,r,o);return this.discussionsRemapper.remapToPostByIdBasic(n.data)}};var Fi=class{createRequestBodyFromParam=(t,e)=>{let i=e==="PRIVATE"?new os:new Ja;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 Za;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 Y=class{https=null;idMapping=null;localCache=null;footballFacade=null;constructor(t){this.https=new lt(t),this.idMapping=new E(t),this.localCache=new st().createLocalCacheInstance(t.idSchema),this.footballFacade=new Mi(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 Kn=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 at)e.market=t.market,e.prediction=t.prediction.value,e.player_id=t.prediction.playerId;else if(t instanceof Ve||t instanceof He)e.market=t.market,e.prediction=t.prediction.value;else if(t instanceof Ot){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 Ge;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,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 Ue;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 Ap=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}}},Pt=Ap;J(Pt,"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"),J(Pt,"createDoubleChanceResult",t=>t?.ftScore?.homeGoals>t?.ftScore?.awayGoals?["1x","12"]:t?.ftScore?.homeGoals===t?.ftScore?.awayGoals?["1x","x2"]:["x2","12"]),J(Pt,"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"}}),J(Pt,"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))),J(Pt,"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 Ap.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])}),Ap.transformPlayerMarketResult(o)}),J(Pt,"transformPlayerMarketResult",t=>t.map(e=>({playerId:e.id,playerModel:e})));var _t=class{footballHttps=null;idMapping=null;matchFacade=null;playerFacade=null;profileNamespace=null;constructor(t,e){this.footballHttps=new lt(t),this.idMapping=e,this.matchFacade=new Ut(t,this.footballHttps,e),this.playerFacade=new Gt(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=Yt(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=tc.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(ht.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 A,r[a][n]):r[a][i]}else if(ht.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 ge){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 fe||t instanceof he){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 Mt||a instanceof xt||a instanceof bt||a instanceof je?(a.fixtures.forEach(r=>e.push(r.matchId)),a instanceof bt&&a.fixtures.forEach(r=>{r.prediction.playerId&&r.prediction.playerId!=="OWN_GOAL"&&i.push(r.prediction.playerId)})):a instanceof kt&&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 Mt||n instanceof xt||n instanceof bt?(n.fixtures.forEach(l=>{this.handleMatchModel(r,l),n instanceof bt&&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 kt&&(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 rt(e),e;if(e&&!i)return e.type=t,e=new rt(e),e;if(!e&&i){let a={type:t,gameIds:i};return a=new rt(a),a}else{let a={type:t};return a=new rt(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 xt&&(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 Ue;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=Wp,t=new G(t);else{let a={status:Wp};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=>ht.includes(p.market)&&!p.result.includes("OWN_GOAL")?[...p.result]:[]).flat(),o=await this.matchFacade.getMatchesMapWithNativeIds([a]);return r.length&&(i=await this.playerFacade.getPlayersMapWithNativeIds(r)),t.results=t.results.map(p=>{if(p.matchModel=o[p.matchId]?o[p.matchId]:null,p.playerModels&&Object.keys(i).length&&p.result.forEach(u=>{let d=i[u];p.playerModels.push(d)}),this.idMapping.idSchema!=="native"&&(this.remapMatchIdForResultsMarkets(o,p),p.playerModels&&Object.keys(i).length)){let c=p.result;p.result=c.map(u=>i[u].id)}return p}),t;case"TOP_X":let n=t.results.map(p=>p.matchId),l=await this.matchFacade.getMatchesMapWithNativeIds(n);if(t.results=t.results.map(p=>(p.matchModel=l[p.matchId]?l[p.matchId]:null,this.idMapping.idSchema!=="native"&&this.remapMatchIdForResultsMarkets(l,p),p)),t.tieBreakers.goldenGoals.length){let p=t.tieBreakers.goldenGoals.map(u=>u.playerId),c=await this.playerFacade.getPlayersMapWithNativeIds(p);t.tieBreakers.goldenGoals=t.tieBreakers.goldenGoals.map(u=>(u.matchModel=l[u.matchId],u.playerModel=c[u.playerId],this.idMapping.idSchema!=="native"&&(u.matchId=l[u.matchId].id,u.playerId=c[u.playerId].id),u))}return t}};completeContestWinners=async t=>{if(t.userList&&t.userList.length){let e=t.userList.map(a=>a.profileId),i=await this.profileNamespace.getByIds(e);t.userList.forEach(a=>{let r=i.filter(o=>o.id===a.profileId)[0];delete r.interests,a.profileModel=r})}return t};handleMatchModel=(t,e)=>{t[e.matchId]?(e.matchModel=t[e.matchId],delete e.matchModel.availableMarkets,e.matchId=e.matchModel.id):(e.matchModel=null,this.idMapping.idSchema!=="native"&&this.idMapping.idMappingFacade.getEntityById(e.matchId,"match","native").then(i=>{e.matchId=i[D[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[D[this.idMapping.idSchema]]})};deleteUnexpectedProperties=t=>(t.status&&(console.warn(kp.UNEXPECTED_STATUS_PROP),delete t.status),t.type&&(console.warn(kp.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 Xo;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)),Pt.createMatchMarketsResultsModel(e,a)}};var Ei=class{fixturesRemapper=null;footballHttps=null;matchFacade=null;playerFacade=null;predictorService=null;constructor(t,e){this.footballHttps=new lt(t),this.matchFacade=new Ut(t,this.footballHttps,e),this.playerFacade=new Gt(t,this.footballHttps,e),this.predictorService=new _t(t,e),this.fixturesRemapper=new Kn(this.matchFacade,this.playerFacade,this.predictorService)}remapRequestBody=t=>{if(t instanceof Fe)return t;let e={};return e.game_instance_id=t.gameInstanceId,e.fixtures=t.fixtures.map(i=>this.fixturesRemapper.remapFixturesRequest(i)),t instanceof Xe&&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 bi,c=[];p.id=l.id,p.gameInstanceId=l.game_instance_id,p.gameType=l.game_type,p.wager=l.wager,p.totalFixtures=l.total_fixtures,p.settledFixtures=l.settled_fixtures,p.userId=l.user_id,p.templateId=l.template_id,p.groupId=l.group_id,p.profileLastUpdatedAt=l.profile_last_updated_at,l.fixtures.forEach(u=>{let d=new Ge;u.target?d.market=this.predictorService.convertMarketForResponseModel(u.market,u.target):d.market=u.market,d.matchId=n[u.match_id].id,d.matchType=u.match_type,d.matchModel=n[u.match_id],delete d.matchModel.availableMarkets,u.prediction!==void 0?d.prediction.value=u.prediction:u.goals_home!==void 0&&u.goals_away!==void 0&&(d.prediction.value=u.goals_home.toString()+":"+u.goals_away.toString()),d.prediction.playerId=u.player_id?u.player_id:null,d.prediction.playerId&&d.prediction.playerId!==e&&(d.prediction.playerModel=r[d.prediction.playerId],d.prediction.playerId=r[d.prediction.playerId].id),d.result=this.fixturesRemapper.remapResult(u.result),c.push(d)}),p.fixtures=c,p.status=l.status,l.tiebreaker?p.tiebreaker.goldenGoal=l.tiebreaker.golden_goal:p.tiebreaker=null,p.points=l.points,p.createdAt=l.created_at,p.updatedAt=l.updated_at,o.push(p)}),o}return t};remapResponseObjBody=async t=>{let e=new bi;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 Yo;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 jn=class{remapPredictions=null;constructor(t,e){this.remapPredictions=new Ei(t,e)}remapResponse=t=>{let e=new Jo;return e.matchId=t.match_id,e.matchType=t.match_type,e.predictions=this.remapPredictions.remapPredictionModel(t.predictions),e}};var Xn=class extends pt{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 Mt;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 us;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 xt;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 ms;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 bt;return e.id=t.id,e.title=t.title,e.description=t.description,e.type=t.type,e.status=t.status,e.authRequirement=t.auth_requirement||null,e.predictionsCutoff=t.predictions_cutoff,e.scheduleOpenAt=t.schedule_open_at,e.fixtures=t.fixtures.map(i=>this.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 no;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 kt;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 lo;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 fs;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 gs;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 et;return t&&(e.type=t.type,e.subType=t.sub_type),e};remapMarketResult=(t,e)=>{if(Jp.includes(t))return e[0];if(ht.includes(t))return e;if(e[0]==="true")return!0;if(e[0]==="false")return!1};deleteUnusefulField=t=>((!ht.includes(t.market)||this.isPlayerMarketWithNoResult(t.market,t.result))&&delete t.playerModels,t);isPlayerMarketWithNoResult=(t,e)=>ht.includes(t)&&e.length===0;remapResults=t=>{let e=new hs;return e.matchId=t.match_id,e.outcome=t.outcome,e};remapTiebreaker=t=>{let e=new dt;return e.goldenGoal=t.golden_goal,e};remapTimeTiebreaker=t=>{let e=new ut;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 Yn=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 ct=class extends v{predictionRemapper=null;matchSummaryRemapper=null;gamesRemapper=null;metaRemapper=null;constructor(t,e){super(t,C(t.environment,"predictor")),this.predictionRemapper=new Ei(t,e),this.matchSummaryRemapper=new jn(t,e),this.gamesRemapper=new Xn,this.metaRemapper=new Yn}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=f(e)?`/predictions/summary/${t}${this.apiSignInUrl}${h()}`:`/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=f(e)?`/predictions/users/${t}${this.apiSignInUrl}${h()}`:`/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=f(e)?`/games/${this.apiSignInUrl}${t.constructFiltersUrl()}${h()}`:`/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=f(e)?`/games/${t}${this.apiSignInUrl}${h()}`:`/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=f(e)?`/games/${t}/predictions${this.apiSignInUrl}${h()}`:`/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=f(e)?`/games/${this.apiSignInUrl}${t.constructFiltersUrl()}${h()}`:`/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=f(e)?`/games/${t}/results/${this.apiSignInUrl}${h()}`:`/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}`;f(e)&&(i+=`${h()}`);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+=h());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 Vt=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(On),o=Object.values(Ln),n=Object.values(xn);if(e==="FT_1X2"||e==="HT_1X2"){if(r.includes(i))return new Wo(t,e,i)}else if(e==="HT_FT"){if(o.includes(i))return new $o(t,i)}else if(e==="DOUBLE_CHANCE"){if(n.includes(i))return new Vo(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 Ot(t,e,i)}else if(e==="CORNERS_MATCH"){if(typeof i=="number")return new ko(t,i)}else if(e==="BOTH_TEAMS_SCORE"){if(this.isPredictionBoolean(i))return new Bo(t,i)}else if(e==="RED_CARD_MATCH"){if(this.isPredictionBoolean(i))return new Ko(t,i)}else if(e==="PENALTY_MATCH"){if(this.isPredictionBoolean(i))return new zo(t,i)}else if(ht.includes(e)){let l="OWN_GOAL";if(this.validatePlayerId(e,a),e===ki&&this.isPredictionBoolean(i)){let p=a&&a===l?l:a;return new at(t,e,i,p)}if(a&&this.isPredictionBoolean(i))return new at(t,e,i,a)}else if(Xp.includes(e)){if(this.isPredictionBoolean(i))return new He(t,e,i)}else if(Yp.includes(e)&&this.isPredictionBoolean(i))return new Ve(t,e,i);this.throwInvalidPredictionException(i,e)};validateFixtureFields=t=>{let e=Object.keys(t);e.forEach(a=>{Np.includes(a)||this.throwInvalidParamException([a])});let i=Np.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 dt)[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){ht.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!==ki&&(e||this.throwInvalidParamException([i]),typeof e!="string"&&this.throwInvalidType(i,"string"))};validateMarket=t=>{Object.values(Z).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=ec(t,e);throw this.errorHandlingMode==="default"?new g(400,"INVALID_PREDICTION",i):new m(400,"INVALID_TYPE",i)};throwInvalidMarketException=(t,e)=>{let i=null;throw e&&e==="TOP_X"?i=ic(t):i=$l(t),this.errorHandlingMode==="default"?new g(400,"INVALID_MARKET",i):new m(400,"INVALID_TYPE",i)};throwInvalidParamException=t=>{let e=ac(t);throw this.errorHandlingMode==="default"?new g(400,"INVALID_FIELD",e):new m(400,"INVALID_TYPE",e)};throwMissingFieldsException=(t,e)=>{let i=rc(t,e);throw this.errorHandlingMode==="default"?new g(400,"INVALID_FIELD",i):new m(400,"INVALID_TYPE",i)};throwInvalidType=(t,e)=>{let i=oc(t,e);throw this.errorHandlingMode==="default"?new g(400,"INVALID_TYPE",i):new m(400,"INVALID_TYPE",i)}};var Si=class{predictorHttps=null;predictorService=null;idMapping=null;clientHttps=null;predictorValidator=null;errorHandlingMode=null;constructor(t){this.predictorValidator=new Vt(t.errorHandlingMode),this.idMapping=new E(t),this.predictorHttps=new ct(t,this.idMapping),this.predictorService=new _t(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 at&&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 at&&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 _(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 rt(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 g(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 Jn=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 Ht=class{matchQuizFacade=null;helpers=new Jn;constructor(t){this.matchQuizFacade=new Si(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 Zn=class extends pt{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 co;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 ho;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 yo;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 bo;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 Lo;return i.questions=e.questions,i.correctAnswers=e.correct_answers,i});remapMetaPagination=t=>{let e=new gt;return e.itemsPerPage=t.items_per_page,e.nextPageStartsAfter=t.next_page_starts_after,e};remapClassicQuizLeaderboardMeta=t=>{let e=new De;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 xe;return e.classicQuizIds=t?.classic_quiz_ids||null,e};remapClassicQuizUserRanking=t=>{let e=new Io;return e.position=t.position,e.classicQuizId=t.classic_quiz_id,e.points=t.points,e};remapBasicClassicQuiz=t=>{let e=new Ae;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 uo;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 mo;return e.optionId=t.option_id,e.option=t.option,e.images=t.images,e.correct=t.correct,e};remapParticipationQuestions=t=>{let e=new fo;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 wo;return e.position=t.position,e.profileId=t.profile_id,e.points=t.points,e};remapContext=t=>{let e=new Ne;return e.content=t.content,e.tags=t.tags?t.tags.map(i=>{let a=new ke;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 tl=class extends pt{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 _o;return e.id=t.id,e.title=t.title,e.alternativeTitle=t.alternative_title,e.description=t.description,e.type=t.type,e.images=t.images,e.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 Fo;return e.eitherOrId=t.either_or_id,e.personalBest=t.personal_best,e.betterThan=t.better_than,e};remapEitherOrResults=t=>{let e=new Oo;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 Eo;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 Be;return e.id=t.id,e.title=t.title,e.alternativeTitle=t.alternative_title,e.description=t.description,e.type=t.type,e.images=t.images,e.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 gt;return e.itemsPerPage=t.items_per_page,e.nextPageStartsAfter=t.next_page_starts_after,e};remapPoints=t=>{let e=new To;return e.correctSteps=t.correct_steps,e.score=t.score,e};remapResultsStandings=t=>{let e=new xo;return e.userId=t.user_id,e.personalBest=t.personal_best,e};remapResultsBreakdown=t=>{let e=new Ao;return e.rangeStartInclusive=t.range_start_inclusive,e.rangeEndInclusive=t.range_end_inclusive,e.totalUsers=t.total_users,e};remapParticipationSteps=t=>{let e=new Co;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 Ne;return e.content=t.content,e.tags=t.tags?t.tags.map(i=>{let a=new ke;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 Ri=class extends v{classicQuizRemapper=null;eitherOrRemapper=null;constructor(t){super(t,C(t.environment,"miniGames")),this.classicQuizRemapper=new Zn,this.eitherOrRemapper=new tl}getClassicQuizzes=async(t,e)=>{let i=`/classic-quizzes${this.apiSignInUrl}`;t&&(i+=t.constructMainFiltersUrl()),i+=f(e)?h():"";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}`),f(i)&&(a+=h());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=>{let e=`/classic-quizzes/rank${this.apiSignInUrl}`;t&&(e+=`${t.constructMainFiltersUrl()}`);let i="There was a problem with fetching classic quizzes leaderboard",a=await this.fetchWithoutAuth(e,i);return this.classicQuizRemapper.remapClassicQuizzesLeaderboard(a)};getClassicQuizzesUserRanking=async(t,e)=>{let i=`/classic-quizzes/users/${t}/rank${this.apiSignInUrl}`;e&&(i+=`${e.constructMainFiltersUrl()}`);let a="There was a problem with fetching user's rankings for classic quizzes",r=await this.fetchWithoutAuth(i,a);return this.classicQuizRemapper.remapClassicQuizUserRankings(r)};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}`;f(e)&&(i+=h());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+=f(e)?h():"";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}`;f(e)&&(i+=h());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}${f(e)?h():""}`,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 $t=class extends nt{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 el=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 $t(t),this.profile=new U(t),this.football=new Y(t),this.https=new Ri(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 Ro;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 Ri(t),this.service=new el(t),this.activityService=new ft(t),this.idSchema=t.idSchema}getClassicQuizzes=async(t,e,i)=>{t&&(t=new po(t),await this.service.finalizeMiniGamesFilters(t));let a=await this.https.getClassicQuizzes(t,i);if(e)await this.service.setContextTagsModels(a.data);else for(let r of a.data)await this.remapTags(r,"native",this.idSchema);return a};getClassicQuizById=async(t,e,i)=>{let a=await this.https.getClassicQuizById(t,e,i);return await this.service.setContextTagsModels([a]),a};participateInClassicQuiz=async(t,e,i)=>await this.https.participateInClassicQuiz(t,e,i);getMyClassicQuizParticipations=async t=>{t&&(t=new go(t));let e=await this.https.getMyClassicQuizParticipations(t),i=e.map(r=>r.classicQuizId),a=await this.getClassicQuizzes({classicQuizIds:i});return e.map(r=>{let o=a.data.find(n=>n.id===r.classicQuizId)||null;return{...r,classicQuizModel:o}})};getLeaderboardForClassicQuizzes=async t=>{t&&(t=new Mo(t));let e=await this.https.getLeaderboardForClassicQuizzes(t);return e.data=await this.service.setProfileModelsForClassicQuizLeaderboards(e.data),e};getClassicQuizzesUserRanking=async(t,e)=>{e&&(e=new Le(e));let i=await this.https.getClassicQuizzesUserRanking(t,e),a=i.data.map(o=>o.classicQuizId),r=await this.getClassicQuizzes({classicQuizIds:a});return i.data=i.data.map(o=>{let n=r.data.find(l=>l.id===o.classicQuizId)||null;return{...o,classicQuizModel:n}}),i};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 Po(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 qt=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=>await this.facade.getLeaderboardForClassicQuizzes(t);getClassicQuizzesUserRanking=async(t,e)=>await this.facade.getClassicQuizzesUserRanking(t,e);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 vi=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 Vt(t.errorHandlingMode),this.predictorHttps=new ct(t,e),this.predictorService=new _t(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 rt(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 rt(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 Xe(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 g(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 al=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 Wt=class{topXFacade=null;idMapping=null;helpers=new al;constructor(t){this.idMapping=new E(t),this.topXFacade=new vi(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 rl=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 Y(t),this.topXNamespace=new Wt(t),this.matchQuizNamespace=new Ht(t),this.miniGamesNamespace=new qt(t),this.errorHandlingMode=t.errorHandlingMode}remapTemplatesIds=async t=>{if(t.length>0){let e=[],i=[],a=[],r=[],o=[],n=[];t.forEach(c=>{c.teamIds&&c.teamIds.length>0&&(e=[...e,...c.teamIds]),c.matchIds&&c.matchIds.length>0&&(a=[...a,...c.matchIds]),c.competitionIds&&c.competitionIds.length>0&&(o=[...o,...c.competitionIds])});let l={team:e,match:a,competition:o},p=await this.idMappingService.idMappingFacade.getEntitiesByIds(l,"native",this.idMappingService.idSchema);return i=[...p.team],r=[...p.match],n=[...p.competition],t.forEach(c=>{c.teamIds&&c.teamIds.length>0&&(c.teamIds=c.teamIds.map(u=>u=p.team.shift())),c.matchIds&&c.matchIds.length>0&&(c.matchIds=c.matchIds.map(u=>u=p.match.shift())),c.competitionIds&&c.competitionIds.length>0&&(c.competitionIds=c.competitionIds.map(u=>u=p.competition.shift()))}),t}return t};remapTemplateGroupMatchIds=async t=>{if(t&&t.length>0){for(let e of t)if(!(!e.filters.matchIds||!e.filters.matchIds.every(a=>a))&&e.filters.matchIds.length>0){let a={match:Array.from(e.filters.matchIds)},r=await this.idMappingService.idMappingFacade.getEntitiesByIds(a,"native",this.idMappingService.idSchema);e.filters.matchIds=Array.from(r.match)}}};addProfileModelToLeaderboard=async t=>{if(t.length>0){let e=[],i=t.map(r=>r.profileId);if(!i.length)return t;let a=await this.profileNamespace.getByIds(i);return t.forEach(r=>{a.forEach(o=>{o.id===r.profileId&&(delete o.interests,r.profileModel=o)}),r.profileModel||(r.profileModel=null),e.push(r)}),e}return t};buildOldClientBadges=t=>{let e=new zr;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 Qr;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 vt(t));break;case"rankings":t&&(t=new Xr(t));break;case"league_leaderboard":t&&(t=new jr(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 g(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 g(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(u=>{u.id.includes(i)?e.push(u.id):u.id.includes(o)?r.push(u.id):u.id.includes(p)&&l.push(u.id)}),e.length&&(a=await this.footballNamespace.footballFacade.competitionsFacade.getCompetitionsMapWithNativeIds(e)),r.length&&(n=await this.footballNamespace.footballFacade.teamsFacade.getTeamsMapWithNativeIds(r)),l.length&&(c=await this.footballNamespace.footballFacade.playerFacade.getPlayersMapWithNativeIds(l)),t.breakdown.forEach(u=>{u.id.includes(i)?(u.model=a.get(u.id),u.id=u.model.id):u.id.includes(o)?(u.model=n.get(u.id),u.id=u.model.id):u.id.includes(p)&&(u.model=c[u.id],u.id=u.model.id)}),t};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(d=>d.groupId===e);if(!c)throw this.errorHandlingMode==="default"?new g(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 g(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 u=c.filters.matchIds.every(d=>d);c.filters.matchIds.length>0&&u&&(r=Array.from(c.filters.matchIds))}return new Rt({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 ol=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(Z).includes(t)){let a=$l(t);throw e==="default"?new g(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 g(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 g(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 g(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 g(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 sl=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 yt(r,a),this.loyaltyService=new rl(this.config),this.loyaltyValidator=new ol,this.idMapping=new E(t),this.topXFacade=new vi(t,this.idMapping),this.matchQuizFacade=new Si(t),this.predictorHttps=new ct(t,this.idMapping),this.errorHandlingMode=t.errorHandlingMode,this.football=new Y(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 Yr(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=this.loyaltyService.initFilters(e,"loyalty");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 Kr(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 zt=class{clientHttps=null;profileHttps=null;loyaltyHttps=null;loyaltyFacade=null;localCache=null;constructor(t){this.clientHttps=new $(t),this.profileHttps=new di(t),this.loyaltyHttps=new It(t),this.localCache=new st().createLocalCacheInstance(t.idSchema),this.loyaltyFacade=new sl(t,this.clientHttps,this.loyaltyHttps,this.profileHttps,this.localCache)}getConfig=async()=>await this.loyaltyFacade.getConfig();getConfigV2=async t=>await this.loyaltyFacade.getConfigV2(t);getClientBadges=async()=>await this.loyaltyFacade.getClientBadges();getClientBadgesV2=async t=>await this.loyaltyFacade.getClientBadgesV2(t);getTemplates=async(t,e)=>await this.loyaltyFacade.getTemplates(t,e);getTemplateById=async(t,e)=>await this.loyaltyFacade.getTemplateById(t,e);getLeaderboard=async(t,e,i)=>await this.loyaltyFacade.getLeaderboard(t,e,i);getLeaderboardForGame=async(t,e,i)=>await this.loyaltyFacade.getLeaderboardForGame(t,e,i);getLeaderboardForLeague=async(t,e)=>await this.loyaltyFacade.getLeaderboardForLeague(t,e);getOwnRankings=async(t,e)=>await this.loyaltyFacade.getOwnRankings(t,e);getUserRankings=async(t,e,i)=>await this.loyaltyFacade.getUserRankings(t,e,i);getHighestSuccessRate=async(t,e)=>await this.loyaltyFacade.getHighestSuccessRate(t,e);getTemplateWinners=async(t,e)=>await this.loyaltyFacade.getTemplateWinners(t,e);getEntitiesFollows=async(t,e)=>await this.loyaltyFacade.getEntitiesFollows(t,e);getTemplateMatches=async(t,e,i)=>await this.loyaltyFacade.getTemplateMatches(t,e,i)};var nl=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 Vt(t.errorHandlingMode),this.predictorService=new _t(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 g(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 at&&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!==ki&&!r.prediction.playerId)throw new g(400,"INVALID_FIELD","Player id is invalid!").errorMessage();if(this.errorHandlingMode==="standard"&&r.market!==ki&&!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(u=>{u.prediction.playerId&&u.prediction.playerId!=="OWN_GOAL"&&(u.prediction.playerId=l),u.matchId=n}),c}else return o.fixtures=[r],await this.predictorHttps.makeFootballPrediction(o)};getMatchSummary=async(t,e)=>{let i=await this.getMatchSummaryBase(t,e),a=JSON.parse(JSON.stringify(i.predictions)),r=await this.predictorService.remapPlayerIdToIdSchema(a);return i.predictions=r,i};getMarketSummary=async(t,e,i,a)=>{try{let r=await this.getMatchSummaryBase(t,a);return await this.predictorService.getMarketSummary(r,e,i)}catch(r){throw r}};getMatchSummaryBase=async(t,e)=>{if(this.idMapping.idSchema!=="native"){let a=(await this.predictorService.remapMatchIdToNative([t]))[0],r=await this.predictorHttps.getMatchSummary(a,e);return r.matchId=t,r}else return await this.predictorHttps.getMatchSummary(t,e)};getConfig=async()=>{let t=await this.clientHttps.getConfig("predictor");return this.idMapping.idSchema!=="native"?await this.predictorService.remapCompetitionsFromConfig(t):t};deleteFootballPrediction=async t=>await this.predictorHttps.deleteFootballPrediction(t);getMyPredictions=async t=>{let e=this.predictorService.initPredictionsFilters(t,"user");return await this.predictorHttps.getMyPredictions(e)};getMyPredictionsForMatches=async(t,e)=>{if(this.errorHandlingMode==="default"&&this.predictorService.areIdsExceeded(t))throw new g(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 g(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 ll=class extends nt{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 pl=class{validator=null;constructor(t){this.validator=new ll(t)}calculateOneXTwoFromScores=t=>{this.validator.validateMatchSummary(t);let{correctScore:e,correctScoreAdvanced:i}=t.predictions,a={...e,...i},r=0,o=0,n=0,l=0;return Object.entries(a).forEach(([p,c])=>{if(c===0)return;let u=c;r+=u;let[d,y]=p.split(":").map(Number);d>y?o+=u:d===y?n+=u:l+=u}),{home:r?Math.round(o/r*100):0,draw:r?Math.round(n/r*100):0,away:r?Math.round(l/r*100):0}};getTopCorrectScores=t=>{this.validator.validateMatchSummary(t);let{correctScore:e,correctScoreAdvanced:i}=t.predictions,a={...e,...i},r=0;return Object.values(a).forEach(o=>{r+=o}),Object.entries(a).filter(([o,n])=>n>0).map(([o,n])=>({score:o,percentage:Math.round(n/r*100)})).sort((o,n)=>n.percentage-o.percentage).slice(0,3)}};var Ci=class{predictorHttps=null;clientHttps=null;predictorFacade=null;idMapping=null;helpers=null;constructor(t){this.idMapping=new E(t),this.predictorHttps=new ct(t,this.idMapping),this.clientHttps=new $(t),this.predictorFacade=new nl(t,this.predictorHttps,this.clientHttps,this.idMapping),this.helpers=new pl(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 Ai=class{loyalty=null;profile=null;predictor=null;constructor(t){this.loyalty=new zt(t),this.profile=new U(t),this.predictor=new Ci(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 Qt=class{idSchema=null;profile=null;validator=null;idMapping=null;constructor(t){this.idSchema=t.idSchema,this.profile=new U(t),this.validator=new $t(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 cl=class{factory=null;https=null;loyaltyHttps=null;profile=null;service=null;discussionsService=null;constructor(t){this.factory=new Fi,this.https=new Ti(t),this.service=new Ai(t),this.loyaltyHttps=new It(t),this.profile=new U(t),this.discussionsService=new Qt(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 er(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 tr(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 ze(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 Qe(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 Ke(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 ul=class{facade=null;constructor(t){this.facade=new cl(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 dl=class extends v{remapper=null;constructor(t){super(t,C(t.environment,"discussions")),this.remapper=new _i}getAll=async(t,e)=>{let i="/discussions"+this.apiSignInUrl;t&&(i+=`${t.constructMainFiltersUrl()}`),f(e)&&(i+=h());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()}`),f(i)&&(a+=h());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(",")}`;f(e)&&(i+=h());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()}`),f(e)&&(i+=h());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 ml=class{createRequestBodyFromParam=t=>{let e=new or;return e.content=t.content,e.reply_id=t.replyId,e.anonymous_nickname=t.userNickname,e.context=t.context,e}};var hl=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 dl(t),this.clientHttps=new $(t),this.activityService=new ft(t),this.service=new Qt(t),this.factory=new ml}getAll=async(t,e)=>{t&&(t=new mr(t));let i=await this.https.getAll(t,e);for(let a of i.data)await this.remapTags(a,"native",this.idSchema);return i};getById=async t=>{let e=await this.https.getById(t);return await this.remapTags(e,"native",this.idSchema),e};createPost=async(t,e)=>{let i=JSON.parse(JSON.stringify(e));await this.remapTags(i,this.idSchema,"native");let a=this.factory.createRequestBodyFromParam(i);return await this.https.createPost(t,a)};getPostById=async t=>{let e=await this.https.getPostById(t);return(await this.service.finalizePostFullModel([e]))[0]};updatePost=async(t,e)=>await this.https.updatePost(t,e);deletePost=async t=>await this.https.deletePost(t);getPosts=async(t,e)=>{e&&(e=new Bt(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 Bt(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 Bt(t)),await this.https.getOwnPosts(t));getUserPosts=async(t,e,i)=>(e&&(e=new Bt(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 g(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 g(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 hr(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 g(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 g(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 fl=class{facade=null;constructor(t){this.facade=new hl(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 ou=["minutesPlayed","cleanSheets","concededGoals","saves","penaltySaved","penaltyCommitted","yellowCards","redCards","assists","foulsCommitted","ownGoals","goals","tackles","shotsOn"],su=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"),Oi=class{static createFantasyPrediction(t,e,i){let a=new Fe;return a.template_id=t||null,a.group_id=e||null,a.fixtures=i?.map(r=>({player_id:r,match_type:"FOOTBALL",market:"PLAYER_PERFORMANCE"}))||[],a}static createFantasyPlayerStats(t){return ou.map(e=>{let i=new br,a=t.data.reduce((r,o)=>r+o.stats[e],0);return i.key=e,i.label=su.get(e),i.value=a,i})}};var gl=class{idMapping=null;idSchema=null;errorHandlingModel=null;football=null;constructor(t){this.idSchema=t.idSchema,this.errorHandlingModel=t.errorHandlingMode,this.football=new Y(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)=>{let a={player:Array.from(t)};return(await this.idMapping.idMappingFacade.getEntitiesByIds(a,e,i)).player};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 g(t,e,i)}};var yl=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 lt(t),this.service=new gl(t),this.idMappingService=new E(t),this.predictorHttps=new ct(t,this.idMappingService),this.loyaltyHttps=new It(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)=>{(!i||!Array.isArray(i))&&this.service.throwException(400,"invalid_method_call","Invalid parameter provided. Please check the following parameter: "+"playerIds");let a=null;if(this.idSchema!=="native"){let r=await this.service.remapPlayers(i,this.idSchema,"native");a=Oi.createFantasyPrediction(t,e,r)}else a=Oi.createFantasyPrediction(t,e,i);return await this.predictorHttps.makeFootballPrediction(a)};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 Oi.createFantasyPlayerStats(a)};getGameWeekStatistics=async t=>await this.loyaltyHttps.getTemplateBreakdownPoints(t)};var bl=class{facade=null;constructor(t){this.facade=new yl(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)=>await this.facade.play(t,e,i);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 Ml=class{configuration;constructor(t){this.configuration=t}getSDKConfiguration(){return this.configuration}};var wl=class{remapToResponseModel=(t,e,i)=>{let a=new qr;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 Il=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 g(t,e,i)}};var Pl=class{validator=null;idMappingFacade=null;factory=new wl;constructor(t){this.validator=new Il(t),this.idMappingFacade=new pi(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 Pl(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 Tl=class{remapUserVotes=t=>{let e=new Ps;return e.meta=this.remapMeta(t.meta.pagination),e.data=t.data.map(i=>this.remapUserVoteModel(i)),e};remapResults=t=>{let e=new Fs;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 _s;return e.matchId=t.match_id,e.playerId=t.player_id,e.createdAt=t.created_at,e};remapResultsModel=t=>{let e=new Es;return e.teamId=t.team_id,e.playerId=t.player_id,e.votes=t.votes,e.winner=t.winner,e}};var Fl=class extends pt{remapPolls=t=>{let e=new Ms;return e.meta.pagination=this.remapMetaPagination(t.meta.pagination),e.data=t.data.map(i=>this.remapPoll(i)),e};remapPollById=t=>{let e=new ys;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,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 Ze;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 ws;return e.meta.pagination=this.remapMetaPagination(t.meta.pagination),e.data=t.data.map(i=>this.remapPollVote(i)),e};remapPollVote=t=>{let e=new bs;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 gt;return e.itemsPerPage=t.items_per_page,e.nextPageStartsAfter=t.next_page_starts_after,e};remapPoll=t=>{let e=new Je;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,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 Tt;return e.content=t.content,e.tags=t.tags?t.tags.map(i=>{let a=new Qa;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 El=class extends v{pollRemapper=null;playerOfTheMatchRemapper=null;constructor(t){super(t,C(t.environment,"voting")),this.pollRemapper=new Fl,this.playerOfTheMatchRemapper=new Tl}getPolls=async(t,e)=>{let i=`/polls${this.apiSignInUrl}`;t&&(i+=t.constructMainFiltersUrl()),f(e)&&(i+=h());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}`;f(e)&&(i+=h());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}${f(e)?h():""}`,a="There was a problem fetching results for 'Player of the match'",r=await this.fetchWithoutAuth(i,a);return this.playerOfTheMatchRemapper.remapResults(r)}};var Sl=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 $t(t),this.activityService=new ft(t),this.football=new Y(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 g(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 g(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 Rl=class{https=null;service=null;idSchema=null;constructor(t){this.idSchema=t.idSchema,this.https=new El(t),this.service=new Sl(t)}getPolls=async(t,e)=>{t&&(t=new Ye(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 Ye({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 _(t));let e=await this.https.getMyPollsVotes(t),i=e.data.map(r=>r.id),a=await this.getPolls(new Ye({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 Is(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 xi=class{facade=null;constructor(t){this.facade=new Rl(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 vl=class{clientHttps=null;topX=null;matchQuiz=null;loyalty=null;miniGames=null;voting=null;constructor(t){this.clientHttps=new $(t),this.topX=new Wt(t),this.matchQuiz=new Ht(t),this.loyalty=new zt(t),this.miniGames=new qt(t),this.voting=new xi(t)}getListContent=async(t,e,i)=>{e&&(e=new Wr(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(y=>o.includes(y.id))];break;case"CLASSIC_QUIZ":let c=await this.miniGames.getClassicQuizzes({limit:o.length,classicQuizIds:o},!1,!0);i=[...i,...c.data];break;case"EITHER_OR":let u=await this.miniGames.getEitherOrs({limit:o.length,eitherOrIds:o},!1,!0);i=[...i,...u.data];break;case"POLL":let d=await this.voting.getPolls({limit:o.length,pollIds:o},!0);i=[...i,...d.data];break;default:}}catch(r){throw console.error("An error occurred while trying to set models for list content entities",r),r}t.forEach(r=>{let o=i.find(n=>n.id===r.entityId)||null;r.entityModel=o})}};var Cl=class{facade=null;constructor(t){this.facade=new vl(t)}getListContent=async(t,e,i)=>await this.facade.getListContent(t,e,i)};var Al=class{factory=null;privateLeagueHttps=null;loyaltyHttps=null;profile=null;service=null;discussionsService=null;constructor(t){this.factory=new Fi,this.privateLeagueHttps=new Ti(t),this.loyaltyHttps=new It(t),this.profile=new U(t),this.service=new Ai(t),this.discussionsService=new Qt(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 is(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 as(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 ze(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 Qe(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 Ke(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 Ol=class{privateLeaguesFacade=null;constructor(t){this.privateLeaguesFacade=new Al(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 xl=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 Ll=class extends nt{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 Dl=class{https=null;profile=null;validator=null;constructor(t){this.https=new ci(t),this.profile=new U(t),this.validator=new Ll(t.errorHandlingMode)}getGames=async(t,e)=>(t&&(t=new ps(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 cs(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 Bl=class{facade=null;constructor(t){this.facade=new Dl(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 Ac(){let s=Cc(),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 Op=null,zp=null;function lu(s){if(pu(s)){let t=cu(s);if(t.isValid)return Op={profile:new U(s),football:new Y(s),predictor:new Ci(s),loyalty:new zt(s),topX:new Wt(s),matchQuiz:new Ht(s),activity:new Xs(s),miniGames:new qt(s),discussions:new fl(s),privateLeagues:new Ol(s),challenges:new ul(s),progress:new xl,voting:new xi(s),fantasy:new bl(s),helpers:new Ml(s),idMapping:new _l(s),bracketGame:new Nn(s),lists:new Cl(s),standingGame:new Bl(s),getVersion:Ac},zp={...s},Op;uu(t)}return Op}var pu=s=>!Op||JSON.stringify(s)!==JSON.stringify(zp)||s.authProvider.getIdToken()!==zp.authProvider.getIdToken(),cu=s=>{let e=new $s().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},uu=s=>{let t="authProvider",e="isValid";Object.keys(s).forEach(i=>{let a=s[i];if(i!==e&&i!==t){if(a.message.type==="error")throw new Error(a.message.text)}else i!==e&&i===t&&Object.keys(new Xt).forEach(r=>{if(a[r].message.type==="error")throw new Error(a[r].message.text)})})};export{Ya as AcceptChallengeModel,Zo as AcceptPrivateLeagueModel,Gi as AchievementsStats,ue as ActionValueModel,Gp as ActionsEnum,de as ActionsModel,re as ActivityFilters,Xl as ActivityMeta,ae as ActivityResponseBody,rp as AssetsModel,ce as AutomaticModerationModel,Ha as BadgesModel,Sa as BadgesModelV2,$a as BadgesValue,q as BadgesValueV2,Bo as BothTeamsFixtureModel,Xa as BracketGameFilters,oe as BracketGameFixtureScoreModel,ja as BracketGameFixtures,Ji as BracketGameFixturesModel,se as BracketGameMetaModel,Zi as BracketGameMetaParticipantsModel,ta as BracketGameModel,ra as BracketGamePredictionFixturesModel,oa as BracketGamePredictionModel,Zl as BracketGamePredictionRequestBody,Sc as BracketGamePredictionStatusEnum,Ka as BracketGamePredictionsFilters,ea as BracketGamePredictionsModel,sa as BracketGameRankingsModel,ne as BracketGameTiebreaker,aa as BracketGameTiebreakerModel,ia as BracketGamesModel,qp as BracketWinnerEnum,ya as BreakdownModel,Pp as CalculatedOneXTwoFromScoresModel,Yl as CampaignModel,Ja as ChallengeCreateModel,tr as ChallengeFilters,ir as ChallengeRankingsModel,Za as ChallengeUpdateModel,Ae as ClassicQuizBasicModel,po as ClassicQuizFilters,xe as ClassicQuizFiltersMeta,co as ClassicQuizFullModel,Mo as ClassicQuizLeaderboardFilters,De as ClassicQuizLeaderboardMeta,mo as ClassicQuizOptionModel,gp as ClassicQuizParticipationBodyModel,ho as ClassicQuizParticipationModel,fo as ClassicQuizParticipationQuestionModel,go as ClassicQuizParticipationsFilters,uo as ClassicQuizQuestionModel,bo as ClassicQuizQuestionsReportModel,Le as ClassicQuizRankFilters,wo as ClassicQuizRankModel,yo as ClassicQuizUserParticipationModel,Io as ClassicQuizUserRank,bp as ClassicQuizUserRankModel,Mp as ClassicQuizzesLeaderboardModel,yp as ClassicQuizzesModel,Jt as ClassicQuizzesStats,zr as ClientBadges,Qr as ClientBadgesV2,Tr as CompetitionBasicModel,hi as CompetitionFilters,Fr as CompetitionFullModel,j as CompletedModel,Jl as ContentModel,fs as ContestWinners,Tt as ContextModel,ko as CornersFixtureModel,Ot as CorrectScoreFixtureModel,ni as CreateActivityRequestBody,tp as CreatePostParamBody,ma as DetailedProfileModel,wa as DictionaryModel,ar as DiscussionModel,Zt as DiscussionStats,ka as DiscussionsBadgeRequirements,Ga as DiscussionsBadgesValue,Ia as DiscussionsConfigModel,mr as DiscussionsFilters,xn as DoubleChanceEnum,Vo as DoubleChanceFixtureModel,Be as EitherOrBasicModel,Po as EitherOrFilters,_o as EitherOrFullModel,Eo as EitherOrParticipationModel,Ro as EitherOrParticipationRequestFullModel,So as EitherOrParticipationRequestModel,Co as EitherOrParticipationStepsModel,yi as EitherOrParticipationStepsOptionModel,To as EitherOrPointsModel,Ao as EitherOrResultsBreakdownModel,Oo as EitherOrResultsModel,xo as EitherOrResultsStandingsModel,te as EitherOrStats,Fo as EitherOrStatsModel,wp as EitherOrsModel,lp as EntitiesFollows,pp as EntitiesFollowsFilters,Bi as EnvironmentEnum,x as ErrorCodes,Gl as ErrorHandlingModeEnum,k as ErrorMessages,L as ErrorStatuses,lu as FansUnitedSDK,op as FansUnitedSDKModel,Dt as FansUnitedSdkFetchException,we as FantasyCoefficientsModel,Wa as FantasyConfigModel,gr as FantasyPlayerDetailedStatsMetaModel,yr as FantasyPlayerDetailedStatsModel,br as FantasyPlayerStatsModel,wr as FantasyPlayersMetaModel,Ie as FantasyPlayersModel,Ir as FantasyPlayersPointsModel,Fe as FantasyPredictionRequestBody,Zr as FiltersMetaModel,us as FixturesGamesModel,no as FixturesMatchQuizModel,Do as FixturesPredictionModel,Ge as FixturesResponseModel,ms as FixturesTopXModel,mi as FollowFilters,ui as FollowModel,fa as FollowersModel,ha as FollowingModel,La as FootballBadgeRequirements,Da as FootballBadgesValue,Er as FootballCountryModel,Nt as FootballPaginationModel,ls as FullInterestModel,ba as FullnessProfile,Ca as GameBadgeRequirements,Aa as GameBadgesValue,je as GameByIdModel,lo as GameMarketsResults,kt as GameModel,oi as GamePredictionsStats,hs as GameResultsModel,Et as GameStatusEnum,Oa as GamesBadgeRequirements,xa as GamesBadgesValue,rt as GamesFilters,Mt as GamesListModel,bt as GamesMatchQuizListModel,xt as GamesTopXListModel,qa as GeneralBadgesValue,Me as GeneralRequirementModel,Ln as HalfTimeFullTimeEnum,$o as HalfTimeFullTimeFixtureModel,Kr as HighestSuccessRateFilters,Jr as HighestSuccessRateModel,N as IdSchemaEnum,K as ImagesModel,ns as InterestModel,ze as InvitationFilters,xs as LangEnum,ga as LeadModel,vp as LeadRequestBody,cp as LeaderboardLeagueResponse,Ce as LeaderboardModel,up as LeaderboardResponseModel,jr as LeagueLeaderboardFilters,ve as LeagueLeaderboardMetaModel,Re as LineupsModel,Wr as ListContentFilters,za as ListContentModel,Ss as ListContentResponseModel,Pa as LoyaltyConfigModel,Va as LoyaltyConfigModelV2,vt as LoyaltyFilters,Ct as LoyaltyMeta,$r as MappingModel,qr as MappingResponseModel,Z as MarketEnum,Ip as MarketsConfigModel,Sr as MatchBasicModel,$e as MatchCorrectScoreMarketResultModel,Rt as MatchFilters,Rr as MatchFullModel,Xo as MatchMarketsResultsModel,jo as MatchPlayerMarketResultModel,he as MatchQuizConfigModel,et as MatchStatus,Jo as MatchSummaryModel,O as MetaFootballModel,vo as MiniGameImages,Ba as MiniGamesBadgeRequirements,Na as MiniGamesBadgesValue,Ne as MiniGamesContext,ke as MiniGamesContextTag,Oe as MiniGamesFilters,er as MyChallengesFilters,is as MyLeaguesFilters,A as NoYesModel,On as OneXTwoEnum,Wo as OneXTwoFixtureModel,vc as OutcomeEnum,Ve as OverCornersFixtureModel,He as OverGoalsFixtureModel,Xi as OwnActivityFilters,qi as PaginationActivities,z as PaginationFootballProperties,Tp as PastTemplateModel,zo as PenaltyMatchFixtureModel,ep as PlayerAssetsModel,xr as PlayerBasicModel,Ee as PlayerDetailedPointsModel,fr as PlayerDetailedStatsFilters,Pr as PlayerDetailedStatsModel,gi as PlayerFilters,at as PlayerFixtureModel,Lr as PlayerFullModel,ip as PlayerMarketResultModel,_r as PlayerPointsModel,Nr as PlayerShortModel,Dr as PlayerSquadModel,Se as PlayerStatsMatchModel,Or as PlayerStatsModel,Mr as PlayersPointsFilters,dp as Points,_a as PointsModel,mp as PointsValueModel,np as PollBadgesValue,Je as PollBasicModel,ys as PollFullModel,Cp as PollOptionModel,Ze as PollVoteBasicModel,bs as PollVoteFullModel,Ye as PollsFilters,Ms as PollsModel,ws as PollsUserVotesModel,Te as PostByIdBasicModel,rr as PostByIdFullModel,or as PostCreateModel,sr as PostsCountDiscussionModel,nr as PostsDiscussionBasicModel,Bt as PostsFilters,lr as PostsFullModel,St as PostsMetaModel,pr as PostsModel,ye as PotmBadgesValue,Ts as PotmResultsMetaModel,Es as PotmResultsModel,Fs as PotmResultsResponseModel,Is as PotmUserVotesFilters,_s as PotmUserVotesModel,Ps as PotmUserVotesResponseModel,so as PredictionMatchQuizModel,qe as PredictionRequestModel,bi as PredictionResponseModel,ds as PredictionTopXModel,G as PredictionsFilters,Yo as PredictionsModel,ie as PredictionsStats,Ra as PredictorBadgeRequirements,va as PredictorBadgesValue,ge as PredictorConfigModel,Pe as PrivateLeagueBasicCreateModel,_e as PrivateLeagueBasicUpdateRequestBody,os as PrivateLeagueCreateModel,as as PrivateLeagueFilters,ts as PrivateLeagueFullModel,We as PrivateLeagueModel,Fp as PrivateLeagueParamCreateBody,Ep as PrivateLeagueParamUpdateBody,Qe as PrivateLeaguePostsFilters,es as PrivateLeaguePredictionModel,Ke as PrivateLeaguePredictionsFilters,Sp as PrivateLeaguePredictionsModel,rs as PrivateLeagueRankingsModel,ss as PrivateLeagueUpdateModel,Rp as PrivateLeaguesModel,Ma as ProfileCountryModel,pe as ProfileModel,Vi as ProfileStatsModel,Xr as RankingsFilters,eo as RankingsModel,cr as ReactionModel,Ko as RedCardFixtureModel,Q as RelatedEntityRelationship,ur as ReportModel,Ft as RequirementModel,Ue as ResultModel,Lo as ResultsSummaryModel,me as RewardsModel,be as RewardsModelV2,sp as SDKConfiguraitonModel,Cr as ScoresModel,Hr as SearchFilters,Vr as SearchModel,Hi as SinglePredictionsBreakdown,ee as SinglePredictionsStats,m as StandardFansUnitedException,le as StandingGameMetaModel,pa as StandingGameMetaParticipantsModel,na as StandingGameModel,ca as StandingGamePredictionModel,ua as StandingGamePredictionsModel,cs as StandingGameRankingsFilters,da as StandingGameRankingsModel,ps as StandingGamesFilters,la as StandingGamesModel,vr as StatsModel,cn as StatusEnum,$i as SuccessRatePercent,Ta as SuccessRateScopeModel,Ui as SuccessRates,Lt as SummarizedBreakdown,Qa as TagsModel,kr as TeamBasicModel,Gr as TeamColors,fi as TeamFilters,ap as TeamFormModel,Ur as TeamFullModel,hp as TemplateBreakdownModel,io as TemplateBreakdownPointsModel,ao as TemplateByIdModel,Yr as TemplateFilters,oo as TemplateGroupFilter,ro as TemplateGroups,to as TemplateMeta,At as TemplateModel,dt as TiebreakerModel,fp as TiersModel,ut as TimeTiebreaker,Ar as TimelineModel,_p as TopCorrectScoresModel,hr as TopDiscussionsFilters,Br as TopPlayerModel,fe as TopXConfigModel,Xe as TopXPredictionRequestModel,Rc as UserActionsEnum,Yi as UserActivityFilters,Fa as UserDataConfigModel,gs as UserListWinners,Qo as ValueAndPlayerId,it as ValueBoolean,No as ValueCorners,Go as ValueCorrectScore,Uo as ValueDoubleChance,Ho as ValueHalfTimeFullTime,qo as ValueOneXTwo,dr as VersionsModel,Ua as VotingBadgeRequirements,Ea as VotingBadgesValue};
1
+ var Lc=Object.create;var Gl=Object.defineProperty;var Dc=Object.getOwnPropertyDescriptor;var Bc=Object.getOwnPropertyNames;var Nc=Object.getPrototypeOf,kc=Object.prototype.hasOwnProperty;var Gc=(s,t,e)=>t in s?Gl(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e;var Uc=(s,t)=>()=>(s&&(t=s(s=0)),t);var xs=(s,t)=>()=>(t||s((t={exports:{}}).exports,t),t.exports),Vc=(s,t)=>{for(var e in t)Gl(s,e,{get:t[e],enumerable:!0})},Hc=(s,t,e,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of Bc(t))!kc.call(s,a)&&a!==e&&Gl(s,a,{get:()=>t[a],enumerable:!(i=Dc(t,a))||i.enumerable});return s};var $c=(s,t,e)=>(e=s!=null?Lc(Nc(s)):{},Hc(t||!s||!s.__esModule?Gl(e,"default",{value:s,enumerable:!0}):e,s));var J=(s,t,e)=>(Gc(s,typeof t!="symbol"?t+"":t,e),e);var nc={};Vc(nc,{default:()=>Kc});var Qc,Kc,lc=Uc(()=>{Qc={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},Kc=Qc});var pc=xs((zm,zl)=>{var jc=function(){"use strict";function s(c,u){return u!=null&&c instanceof u}var t;try{t=Map}catch{t=function(){}}var e;try{e=Set}catch{e=function(){}}var i;try{i=Promise}catch{i=function(){}}function a(c,u,d,y,b){typeof u=="object"&&(d=u.depth,y=u.prototype,b=u.includeNonEnumerable,u=u.circular);var Kt=[],ti=[],ei=typeof Buffer<"u";typeof u>"u"&&(u=!0),typeof d>"u"&&(d=1/0);function ot(P,E){if(P===null)return null;if(E===0)return P;var B,Cs;if(typeof P!="object")return P;if(s(P,t))B=new t;else if(s(P,e))B=new e;else if(s(P,i))B=new i(function(As,I){P.then(function(Os){As(ot(Os,E-1))},function(Os){I(ot(Os,E-1))})});else if(a.__isArray(P))B=[];else if(a.__isRegExp(P))B=new RegExp(P.source,p(P)),P.lastIndex&&(B.lastIndex=P.lastIndex);else if(a.__isDate(P))B=new Date(P.getTime());else{if(ei&&Buffer.isBuffer(P))return Buffer.allocUnsafe?B=Buffer.allocUnsafe(P.length):B=new Buffer(P.length),P.copy(B),B;s(P,Error)?B=Object.create(P):typeof y>"u"?(Cs=Object.getPrototypeOf(P),B=Object.create(Cs)):(B=Object.create(y),Cs=y)}if(u){var Kp=Kt.indexOf(P);if(Kp!=-1)return ti[Kp];Kt.push(P),ti.push(B)}s(P,t)&&P.forEach(function(As,I){var Os=ot(I,E-1),xc=ot(As,E-1);B.set(Os,xc)}),s(P,e)&&P.forEach(function(As){var I=ot(As,E-1);B.add(I)});for(var mt in P){var Lp;Cs&&(Lp=Object.getOwnPropertyDescriptor(Cs,mt)),!(Lp&&Lp.set==null)&&(B[mt]=ot(P[mt],E-1))}if(Object.getOwnPropertySymbols)for(var jp=Object.getOwnPropertySymbols(P),mt=0;mt<jp.length;mt++){var F=jp[mt],Li=Object.getOwnPropertyDescriptor(P,F);Li&&!Li.enumerable&&!b||(B[F]=ot(P[F],E-1),Li.enumerable||Object.defineProperty(B,F,{enumerable:!1}))}if(b)for(var Xp=Object.getOwnPropertyNames(P),mt=0;mt<Xp.length;mt++){var kl=Xp[mt],Li=Object.getOwnPropertyDescriptor(P,kl);Li&&Li.enumerable||(B[kl]=ot(P[kl],E-1),Object.defineProperty(B,kl,{enumerable:!1}))}return B}return ot(c,d)}a.clonePrototype=function(u){if(u===null)return null;var d=function(){};return d.prototype=u,new d};function r(c){return Object.prototype.toString.call(c)}a.__objToStr=r;function o(c){return typeof c=="object"&&r(c)==="[object Date]"}a.__isDate=o;function n(c){return typeof c=="object"&&r(c)==="[object Array]"}a.__isArray=n;function l(c){return typeof c=="object"&&r(c)==="[object RegExp]"}a.__isRegExp=l;function p(c){var u="";return c.global&&(u+="g"),c.ignoreCase&&(u+="i"),c.multiline&&(u+="m"),u}return a.__getRegExpFlags=p,a}();typeof zl=="object"&&zl.exports&&(zl.exports=jc)});var wc=xs((Qm,qp)=>{"use strict";var ji=typeof Reflect=="object"?Reflect:null,cc=ji&&typeof ji.apply=="function"?ji.apply:function(t,e,i){return Function.prototype.apply.call(t,e,i)},Ql;ji&&typeof ji.ownKeys=="function"?Ql=ji.ownKeys:Object.getOwnPropertySymbols?Ql=function(t){return Object.getOwnPropertyNames(t).concat(Object.getOwnPropertySymbols(t))}:Ql=function(t){return Object.getOwnPropertyNames(t)};function Xc(s){console&&console.warn&&console.warn(s)}var dc=Number.isNaN||function(t){return t!==t};function R(){R.init.call(this)}qp.exports=R;qp.exports.once=tu;R.EventEmitter=R;R.prototype._events=void 0;R.prototype._eventsCount=0;R.prototype._maxListeners=void 0;var uc=10;function Kl(s){if(typeof s!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof s)}Object.defineProperty(R,"defaultMaxListeners",{enumerable:!0,get:function(){return uc},set:function(s){if(typeof s!="number"||s<0||dc(s))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+s+".");uc=s}});R.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};R.prototype.setMaxListeners=function(t){if(typeof t!="number"||t<0||dc(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 mc(s){return s._maxListeners===void 0?R.defaultMaxListeners:s._maxListeners}R.prototype.getMaxListeners=function(){return mc(this)};R.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")cc(l,this,e);else for(var p=l.length,c=bc(l,p),i=0;i<p;++i)cc(c[i],this,e);return!0};function hc(s,t,e,i){var a,r,o;if(Kl(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=mc(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,Xc(n)}return s}R.prototype.addListener=function(t,e){return hc(this,t,e,!1)};R.prototype.on=R.prototype.addListener;R.prototype.prependListener=function(t,e){return hc(this,t,e,!0)};function Yc(){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 fc(s,t,e){var i={fired:!1,wrapFn:void 0,target:s,type:t,listener:e},a=Yc.bind(i);return a.listener=e,i.wrapFn=a,a}R.prototype.once=function(t,e){return Kl(e),this.on(t,fc(this,t,e)),this};R.prototype.prependOnceListener=function(t,e){return Kl(e),this.prependListener(t,fc(this,t,e)),this};R.prototype.removeListener=function(t,e){var i,a,r,o,n;if(Kl(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():Jc(i,r),i.length===1&&(a[t]=i[0]),a.removeListener!==void 0&&this.emit("removeListener",t,n||e)}return this};R.prototype.off=R.prototype.removeListener;R.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 gc(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?Zc(a):bc(a,a.length)}R.prototype.listeners=function(t){return gc(this,t,!0)};R.prototype.rawListeners=function(t){return gc(this,t,!1)};R.listenerCount=function(s,t){return typeof s.listenerCount=="function"?s.listenerCount(t):yc.call(s,t)};R.prototype.listenerCount=yc;function yc(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}R.prototype.eventNames=function(){return this._eventsCount>0?Ql(this._events):[]};function bc(s,t){for(var e=new Array(t),i=0;i<t;++i)e[i]=s[i];return e}function Jc(s,t){for(;t+1<s.length;t++)s[t]=s[t+1];s.pop()}function Zc(s){for(var t=new Array(s.length),e=0;e<t.length;++e)t[e]=s[e].listener||s[e];return t}function tu(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))}Mc(s,t,r,{once:!0}),t!=="error"&&eu(s,a,{once:!0})})}function eu(s,t,e){typeof s.on=="function"&&Mc(s,"error",t,e)}function Mc(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 _c=xs((Ic,Pc)=>{(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=pc(),s=wc().EventEmitter,Pc.exports=t=function(){class o extends s{constructor(l={}){super(),this.get=this.get.bind(this),this.mget=this.mget.bind(this),this.set=this.set.bind(this),this.mset=this.mset.bind(this),this.del=this.del.bind(this),this.take=this.take.bind(this),this.ttl=this.ttl.bind(this),this.getTtl=this.getTtl.bind(this),this.keys=this.keys.bind(this),this.has=this.has.bind(this),this.getStats=this.getStats.bind(this),this.flushAll=this.flushAll.bind(this),this.flushStats=this.flushStats.bind(this),this.close=this.close.bind(this),this._checkData=this._checkData.bind(this),this._check=this._check.bind(this),this._isInvalidKey=this._isInvalidKey.bind(this),this._wrap=this._wrap.bind(this),this._getValLength=this._getValLength.bind(this),this._error=this._error.bind(this),this._initErrors=this._initErrors.bind(this),this.options=l,this._initErrors(),this.data={},this.options=Object.assign({forceString:!1,objectValueSize:80,promiseValueSize:80,arrayValueSize:40,stdTTL:0,checkperiod:600,useClones:!0,deleteOnExpire:!0,enableLegacyCallbacks:!1,maxKeys:-1},this.options),this.options.enableLegacyCallbacks&&(console.warn("WARNING! node-cache legacy callback support will drop in v6.x"),["get","mget","set","del","ttl","getTtl","keys","has"].forEach(p=>{var c;c=this[p],this[p]=function(...u){var d,y,b,Kt;if(b=u,[...u]=b,[d]=i.call(u,-1),typeof d=="function")try{Kt=c(...u),d(null,Kt)}catch(ti){y=ti,d(y)}else return c(...u,d)}})),this.stats={hits:0,misses:0,keys:0,ksize:0,vsize:0},this.validKeyTypes=["string","number"],this._checkData()}get(l){var p,c;if(a(this,o),(c=this._isInvalidKey(l))!=null)throw c;if(this.data[l]!=null&&this._check(l,this.data[l]))return this.stats.hits++,p=this._unwrap(this.data[l]),p;this.stats.misses++}mget(l){var p,c,u,d,y,b;if(a(this,o),!Array.isArray(l))throw p=this._error("EKEYSTYPE"),p;for(b={},u=0,y=l.length;u<y;u++){if(d=l[u],(c=this._isInvalidKey(d))!=null)throw c;this.data[d]!=null&&this._check(d,this.data[d])?(this.stats.hits++,b[d]=this._unwrap(this.data[d])):this.stats.misses++}return b}set(l,p,c){var u,d,y;if(a(this,o),this.options.maxKeys>-1&&this.stats.keys>=this.options.maxKeys)throw u=this._error("ECACHEFULL"),u;if(this.options.forceString&&!typeof p==="string"&&(p=JSON.stringify(p)),c==null&&(c=this.options.stdTTL),(d=this._isInvalidKey(l))!=null)throw d;return y=!1,this.data[l]&&(y=!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),y||(this.stats.ksize+=this._getKeyLength(l),this.stats.keys++),this.emit("set",l,p),!0}mset(l){var p,c,u,d,y,b,Kt,ti,ei,ot;if(a(this,o),this.options.maxKeys>-1&&this.stats.keys+l.length>=this.options.maxKeys)throw p=this._error("ECACHEFULL"),p;for(u=0,Kt=l.length;u<Kt;u++){if(b=l[u],{key:y,val:ot,ttl:ei}=b,ei&&typeof ei!="number")throw p=this._error("ETTLTYPE"),p;if((c=this._isInvalidKey(y))!=null)throw c}for(d=0,ti=l.length;d<ti;d++)b=l[d],{key:y,val:ot,ttl:ei}=b,this.set(y,ot,ei);return!0}del(l){var p,c,u,d,y,b;for(a(this,o),Array.isArray(l)||(l=[l]),p=0,u=0,y=l.length;u<y;u++){if(d=l[u],(c=this._isInvalidKey(d))!=null)throw c;this.data[d]!=null&&(this.stats.vsize-=this._getValLength(this._unwrap(this.data[d],!1)),this.stats.ksize-=this._getKeyLength(d),this.stats.keys--,p++,b=this.data[d],delete this.data[d],this.emit("del",d,b.v))}return p}take(l){var p;return a(this,o),p=this.get(l),p!=null&&this.del(l),p}ttl(l,p){var c;if(a(this,o),p||(p=this.options.stdTTL),!l)return!1;if((c=this._isInvalidKey(l))!=null)throw c;return this.data[l]!=null&&this._check(l,this.data[l])?(p>=0?this.data[l]=this._wrap(this.data[l].v,p,!1):this.del(l),!0):!1}getTtl(l){var p,c;if(a(this,o),!!l){if((c=this._isInvalidKey(l))!=null)throw c;if(this.data[l]!=null&&this._check(l,this.data[l]))return p=this.data[l].t,p}}keys(){var l;return a(this,o),l=Object.keys(this.data),l}has(l){var p;return a(this,o),p=this.data[l]!=null&&this._check(l,this.data[l]),p}getStats(){return a(this,o),this.stats}flushAll(l=!0){a(this,o),this.data={},this.stats={hits:0,misses:0,keys:0,ksize:0,vsize:0},this._killCheckPeriod(),this._checkData(l),this.emit("flush")}flushStats(){a(this,o),this.stats={hits:0,misses:0,keys:0,ksize:0,vsize:0},this.emit("flush_stats")}close(){a(this,o),this._killCheckPeriod()}_checkData(l=!0){var p,c,u;a(this,o),c=this.data;for(p in c)u=c[p],this._check(p,u);l&&this.options.checkperiod>0&&(this.checkTimeout=setTimeout(this._checkData,this.options.checkperiod*1e3,l),this.checkTimeout!=null&&this.checkTimeout.unref!=null&&this.checkTimeout.unref())}_killCheckPeriod(){if(this.checkTimeout!=null)return clearTimeout(this.checkTimeout)}_check(l,p){var c;return a(this,o),c=!0,p.t!==0&&p.t<Date.now()&&(this.options.deleteOnExpire&&(c=!1,this.del(l)),this.emit("expired",l,this._unwrap(p))),c}_isInvalidKey(l){var p;if(a(this,o),p=typeof l,r.call(this.validKeyTypes,p)<0)return this._error("EKEYTYPE",{type:typeof l})}_wrap(l,p,c=!0){var u,d,y,b;return a(this,o),this.options.useClones||(c=!1),d=Date.now(),u=0,b=1e3,p===0?u=0:p?u=d+p*b:this.options.stdTTL===0?u=this.options.stdTTL:u=d+this.options.stdTTL*b,y={t:u,v:c?e(l):l}}_unwrap(l,p=!0){return this.options.useClones||(p=!1),l.v!=null?p?e(l.v):l.v:null}_getKeyLength(l){return l.toString().length}_getValLength(l){return a(this,o),typeof l=="string"?l.length:this.options.forceString?JSON.stringify(l).length:Array.isArray(l)?this.options.arrayValueSize*l.length:typeof l=="number"?8:typeof l?.then=="function"?this.options.promiseValueSize:typeof Buffer<"u"&&Buffer!==null&&Buffer.isBuffer(l)?l.length:l!=null&&typeof l=="object"?this.options.objectValueSize*Object.keys(l).length:typeof l=="boolean"?8:0}_error(l,p={}){var c;return a(this,o),c=new Error,c.name=l,c.errorcode=l,c.message=this.ERRORS[l]!=null?this.ERRORS[l](p):"-",c.data=p,c}_initErrors(){var l,p,c;a(this,o),this.ERRORS={},c=this._ERRORS;for(p in c)l=c[p],this.ERRORS[p]=this.createErrorMessage(l)}createErrorMessage(l){return function(p){return l.replace("__key",p.type)}}}return o.prototype._ERRORS={ENOTFOUND:"Key `__key` not found",ECACHEFULL:"Cache max keys amount exceeded",EKEYTYPE:"The key argument has to be of type `string` or `number`. Found: `__key`",EKEYSTYPE:"The keys argument has to be an array.",ETTLTYPE:"The ttl argument has to be a number."},o}.call(this)}).call(Ic)});var Sc=xs((Tc,Fc)=>{(function(){var s;s=Fc.exports=_c(),s.version="5.1.2"}).call(Tc)});var Ac=xs((aq,lu)=>{lu.exports={name:"fansunited-sdk-esm",version:"1.102.2",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 Ls=(b=>(b.EN="en",b.BG="bg",b.RO="ro",b.EL="el",b.SK="sk",b.PT="pt",b.SR="sr",b.HU="hu",b.SV="sv",b.ES="es",b.FR="fr",b.NL="nl",b.DE="de",b.IT="it",b))(Ls||{});var Ds=class{validate=t=>{let e=this.validateField(t.lang),i=this.generateMessage(e);return{validation:e,message:i}};validateField=t=>{let e=Object.values(Ls),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 Bi=(r=>(r.DEV="dev",r.PROD="prod",r.STAGING="staging",r.WATG="watg",r.YOLO="yolo",r))(Bi||{});var Bs=class{validate(t){let e=this.validateField(t.environment),i=this.generateMessage(e);return{validation:e,message:i}}validateField=t=>{let e=Object.values(Bi),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 Ns=class{validate(t){let e=this.validateField(t.apiKey),i=this.generateMessage(e);return{validation:e,message:i}}validateField=t=>{let e=null;return t!=null&&t.length>0?e="valid":e="missing",e};generateMessage=t=>{let e=null,i="error";return t==="missing"&&(e="The field apiKey with valid value must be provided to use Fans United JS SDK"),t==="valid"&&(i=null),{text:e,type:i}}};var N=(r=>(r.NATIVE="native",r.ENETPULSE="enetpulse",r.SPORTRADAR="sportradar",r.SPORTAL_365="sportal365",r.API_FOOTBALL="api_football",r))(N||{});var ks=class{validate(t){let e=this.validateField(t.idSchema),i=this.generateMessage(e);return{validation:e,message:i}}validateField=t=>{let e=Object.values(N),i=null;return t!=null&&t.length>0?e.includes(t)?i="valid":i="invalid":i="missing",i};generateMessage=t=>{let e=null,i="warning";return t==="missing"&&(e="If no idSchema is passed the default one will be set which is: native"),t==="invalid"&&(e="This idSchema value is not supported, the default one will be set which is: native"),t==="valid"&&(e=null,i=null),{text:e,type:i}}};var Xt=class{getIdToken=null;logout=null};var ai=class{text=null;type=null};var Gs=class{validation=null;message=new ai;getIdToken={validation:null,message:new ai};logout={validation:null,message:new ai}};var Us=class{validate(t){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 Xt),i=new Gs;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 Xt).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 Ni=class{validation;message};var Vs=class{apiKey=null;environment=null;idSchema=null;clientId=null;lang=null;errorHandlingMode=null;authProvider={getIdToken:new Ni,logout:new Ni};isValid=!1};var Hs=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 Ul=(e=>(e.DEFAULT="default",e.STANDARD="standard",e))(Ul||{});var $s=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 qs=class{validate=t=>{let e=this.checkFieldsForValues(t);return e.isValid=this.containsErrorMessage(e),e};checkFieldsForValues=t=>{let e=new Vs,i={apiKey:new Ns,environment:new Bs,idSchema:new ks,clientId:new Hs,lang:new Ds,errorHandlingMode:new $s,authProvider:new Us};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"){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")return e=!1,e;return e}};var Dp=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},ri=(s,t)=>{let e=[];for(;s.length>t;){let i=s.splice(0,t);e.push(i)}return e.push(s),e},C=(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},Yt=s=>Array.from(new Set(s)),g=s=>s||!1,h=()=>`&disable_cache=${Date.now()}`,Vl=s=>JSON.parse(JSON.stringify(s.sort((t,e)=>t.localeCompare(e))));var Z=(I=>(I.FT_1X2="FT_1X2",I.HT_1X2="HT_1X2",I.BOTH_TEAMS_SCORE="BOTH_TEAMS_SCORE",I.DOUBLE_CHANCE="DOUBLE_CHANCE",I.HT_FT="HT_FT",I.PLAYER_SCORE="PLAYER_SCORE",I.PLAYER_YELLOW_CARD="PLAYER_YELLOW_CARD",I.PLAYER_RED_CARD="PLAYER_RED_CARD",I.RED_CARD_MATCH="RED_CARD_MATCH",I.PENALTY_MATCH="PENALTY_MATCH",I.PLAYER_SCORE_FIRST_GOAL="PLAYER_SCORE_FIRST_GOAL",I.CORNERS_MATCH="CORNERS_MATCH",I.CORRECT_SCORE="CORRECT_SCORE",I.CORRECT_SCORE_ADVANCED="CORRECT_SCORE_ADVANCED",I.CORRECT_SCORE_HT="CORRECT_SCORE_HT",I.PLAYER_SCORE_HATTRICK="PLAYER_SCORE_HATTRICK",I.PLAYER_SCORE_TWICE="PLAYER_SCORE_TWICE",I.OVER_GOALS_0_5="OVER_GOALS_0_5",I.OVER_GOALS_1_5="OVER_GOALS_1_5",I.OVER_GOALS_2_5="OVER_GOALS_2_5",I.OVER_GOALS_3_5="OVER_GOALS_3_5",I.OVER_GOALS_4_5="OVER_GOALS_4_5",I.OVER_GOALS_5_5="OVER_GOALS_5_5",I.OVER_GOALS_6_5="OVER_GOALS_6_5",I.OVER_CORNERS_6_5="OVER_CORNERS_6_5",I.OVER_CORNERS_7_5="OVER_CORNERS_7_5",I.OVER_CORNERS_8_5="OVER_CORNERS_8_5",I.OVER_CORNERS_9_5="OVER_CORNERS_9_5",I.OVER_CORNERS_10_5="OVER_CORNERS_10_5",I.OVER_CORNERS_11_5="OVER_CORNERS_11_5",I.OVER_CORNERS_12_5="OVER_CORNERS_12_5",I.OVER_CORNERS_13_5="OVER_CORNERS_13_5",I))(Z||{}),Yp=["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"],Jp=["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"],ht=["PLAYER_RED_CARD","PLAYER_SCORE","PLAYER_SCORE_FIRST_GOAL","PLAYER_SCORE_HATTRICK","PLAYER_SCORE_TWICE","PLAYER_YELLOW_CARD"],Zp=["FT_1X2","HT_1X2","HT_FT","DOUBLE_CHANCE","CORNERS_MATCH","CORRECT_SCORE","CORRECT_SCORE_HT","CORRECT_SCORE_ADVANCED"],ki="PLAYER_SCORE_FIRST_GOAL";var Gi=class{id="";achievedAt=""};var Jt=class{participationCount=null;points=null};var Zt=class{totalPoints=null;postPoints=null;postsMade=null;reactionPoints=null;reactionCount=null};var te=class{participationCount=null};var oi=class{participations=0;points=0};var Lt=class{footballCompetitions=[];footballTeams=[]};var ee=class{predictionsMade=0;correct=0;points=0;breakdown=new Lt};var ie=class{single=new ee;topX=new oi;matchQuiz=new oi};var Ui=class{overallPercent;byFootballCompetition;byFootballTeam;byFootballMarket};var Vi=class{profileId;tier;points;predictionsMade;successRates=new Ui;predictions=new ie;tiers=[];badges=[];discussions=new Zt;classicQuizzes=new Jt;eitherOr=new te};var Hi=class{entityId="";entityType="";entitySource="";model=null;predictionsMade=0;correct=0;points=0};var $i=class{successRatePercent;model=null};var Tt=class{content=null;tags=[];campaign=null};var ae=class{id=null;profileId=null;property=null;value=null;action=null;context=new Tt;points=0};var z=class{currentPage=null;itemsPerPage=null;totalItems=null;numberOfPages=null};var O=class{pagination=new z};var qi=class{meta=new O;data=[new ae]};var Ws=class{remapSingleResponse=t=>{let e=new ae;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 Vi;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)},Z[i]&&delete e[i].model});else return t;return e};remapSuccessRatePercent=t=>{let e=new $i;return e.successRatePercent=t.success_rate_percent,e};remapPredictionsStats=t=>{let e=new ie;return e.single=this.remapSinglePredictionsStats(t.single),e.topX=t.top_x,e.matchQuiz=t.match_quiz,e};remapSinglePredictionsStats=t=>{let e=new ee;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 Lt,i=[],a=[];return Object.keys(t).forEach(r=>{let o=new Hi;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 Lt};remapAchievementsStats=t=>t.map(e=>{let i=new Gi;return i.id=e.id,i.achievedAt=e.achieved_at,i});remapDiscussionStats=t=>{let e=new Zt;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 Jt;return e.participationCount=t.participation_count,e.points=t.points,e};remapEitherOrStats=t=>{let e=new te;return e.participationCount=t.participation_count,e}};function Bp(s){this.message=s}Bp.prototype=new Error,Bp.prototype.name="InvalidCharacterError";var tc=typeof window<"u"&&window.atob&&window.atob.bind(window)||function(s){var t=String(s).replace(/=+$/,"");if(t.length%4==1)throw new Bp("'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 Wc(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(tc(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 tc(t)}}function Hl(s){this.message=s}function zc(s,t){if(typeof s!="string")throw new Hl("Invalid token specified");var e=(t=t||{}).header===!0?0:1;try{return JSON.parse(Wc(s.split(".")[e]))}catch(i){throw new Hl("Invalid token specified: "+i.message)}}Hl.prototype=new Error,Hl.prototype.name="InvalidTokenError";var $l=zc;var x=(i=>(i[i.BAD_METHOD_CALL=400]="BAD_METHOD_CALL",i[i.UNAUTHORIZED=401]="UNAUTHORIZED",i[i.NOT_FOUND=404]="NOT_FOUND",i))(x||{});var L=(F=>(F.INVALID_TEMPLATE="INVALID_TEMPLATE",F.INVALID_PREDICTION="INVALID_PREDICTION",F.INVALID_MARKET="INVALID_MARKET",F.INVALID_FIELD="INVALID_FIELD",F.INVALID_TYPE="INVALID_TYPE",F.EXCEEDED_LENGTH="EXCEEDED_LENGTH",F.INVALID_TOKEN="invalid_token",F.UNAUTHORIZED="unauthorized",F.INVALID_FILTERS="invalid_filters",F.INVALID_AVATAR="invalid_avatar",F.INVALID_METHOD_CALL="invalid_method_call",F.INVALID_LIMIT="invalid_limit",F.INVALID_TEMPLATE_GROUP_ID="invalid_template_group_id",F.INVALID_TEMPLATE_GROUP_FILTERS="invalid_template_group_filters",F.INVALID_PAGE_NUMBER="invalid_page_number",F.INVALID_DISCUSSION_IDS="invalid_discussion_ids",F.ID_MAPPING_NOT_FOUND="id_mapping_not_found",F.INVALID_COMPETITION_ID="invalid_competition_id",F.INVALID_TEAM_ID="invalid_team_id",F.INVALID_IDS="invalid_ids",F.INVALID_INPUT_PROVIDER="invalid_input_provider",F.INVALID_OUTPUT_PROVIDER="invalid_output_provider",F.INVALID_MATCH_SUMMARY="invalid_match_summary",F.INVALID_MATCH_SUMMARY_PREDICTIONS="invalid_match_summary_predictions",F.INVALID_MATCH_SUMMARY_PREDICTIONS_KEYS="invalid_match_summary_predictions_keys",F.ENTITY_IDS_NOT_FOUND="entity_ids_not_found",F.MATCH_IDS_NOT_FOUND="match_ids_not_found",F))(L||{});var D={native:"id",sportradar:"sportradar_id",sportal365:"sportal365_id",enetpulse:"enetpulse_id",api_football:"api_football_id"},Np={PREDICTOR_USER_RELATED_OPERATION:"https://docs.fansunitedmedia.com/docs/predictor-operations#user-related-operations"},kp=["matchId","matchType","market","prediction"],ec=new Map().set("FT_1X2","fullTimeOneXTwo").set("HT_1X2","halfTimeOneXTwo").set("BOTH_TEAMS_SCORE","bothTeamsScore").set("DOUBLE_CHANCE","doubleChance").set("HT_FT","halfTimeFullTime").set("PLAYER_SCORE","playerScore").set("PLAYER_YELLOW_CARD","playerYellowCard").set("PLAYER_RED_CARD","playerRedCard").set("RED_CARD_MATCH","redCardMatch").set("PENALTY_MATCH","penaltyMatch").set("PLAYER_SCORE_FIRST_GOAL","playerScoreFirstGoal").set("CORNERS_MATCH","cornersMatch").set("CORRECT_SCORE","correctScore").set("CORRECT_SCORE_ADVANCED","correctScoreAdvanced").set("CORRECT_SCORE_HT","correctScoreHalfTime").set("PLAYER_SCORE_HATTRICK","playerScoreHattrick").set("PLAYER_SCORE_TWICE","playerScoreTwice").set("OVER_GOALS_0_5","overZeroPointFiveGoals").set("OVER_GOALS_1_5","overOnePointFiveGoals").set("OVER_GOALS_2_5","overTwoPointFiveGoals").set("OVER_GOALS_3_5","overThreePointFiveGoals").set("OVER_GOALS_4_5","overFourPointFiveGoals").set("OVER_GOALS_5_5","overFivePointFiveGoals").set("OVER_GOALS_6_5","overSixPointFiveGoals").set("OVER_CORNERS_6_5","overSixPointFiveCorners").set("OVER_CORNERS_7_5","overSevenPointFiveCorners").set("OVER_CORNERS_8_5","overEightPointFiveCorners").set("OVER_CORNERS_9_5","overNinePointFiveCorners").set("OVER_CORNERS_10_5","overTenPointFiveCorners").set("OVER_CORNERS_11_5","overElevenPointFiveCorners").set("OVER_CORNERS_12_5","overTwelvePointFiveCorners").set("OVER_CORNERS_13_5","overThirteenPointFiveCorners");var k=(M=>(M.INVALID_MATCH_ID="Match id is invalid!",M.INVALID_PLAYER_ID="Player id is invalid!",M.QUERY_PARAM_MATCH_IDS_EXCEEDED="Maximum matchIds in PredictionFilters should be 10 or less.",M.QUERY_PARAM_FILTERS_LIMIT_EXCEEDED="Maximum limit for filtering games is 50 or less.",M.INVALID_FIXTURES_FIELD="Fixtures field is invalid. For more information please visit our documentation",M.INVALID_TOKEN="Invalid JWT token is provided",M.EXPIRED_TOKEN="The provided JWT token is expired",M.ENTITIES_NEEDED="At least one of footballCompetitions, footballTeams or footballPlayers properties should be provided for filters.",M.ENTITIES_FOLLOWS_FILTERS_EXCEEDED="Maximum length per entity should be 24 or less.",M.INVALID_TYPE="You have provided invalid type. The valid type is ",M.INVALID_VALUE="You have provided invalid value. The valid value is ",M.INVALID_AVATAR="Invalid URL syntax for avatar image.",M.INVALID_GET_PROFILES_METHOD_CALL="The method 'getByIds' from Profile namespace is not called correctly. You need to provide 'profileIds' OR 'search' parameters to the method, but you can't use both of them or neither of them.",M.INVALID_LIMIT="Invalid limit. The maximum limit is: ",M.INVALID_LIMIT_TYPE="Invalid limit type. The proper type is number.",M.FILTER_COMBINATION_ERROR="You need to use both 'entityIds' and 'entityType' filters together",M.INVALID_ENTITY_TYPE="Invalid 'entityType' filter. Please use one of the following valid options: competition, team, or player",M.INVALID_TEMPLATE_GROUP_ID="There is no group in this template with the provided groupId",M.INVALID_TEMPLATE_GROUP_FILTERS="The provided template group has no filters",M.INVALID_PAGE_NUMBER="Invalid page number provided. Use number between 1 and max number of pages.",M.INVALID_DISCUSSION_IDS="Invalid discussion ids argument. Please provide at least one discussion id in an array",M.EXCEEDED_DISCUSSION_IDS="Maximum number of discussion ids exceeded. The maximum number of discussion ids is 50. You can use 'getPostsCountExtended' method for more than 50 discussion ids.",M.EXCEEDED_EXTENDED_DISCUSSION_IDS="Maximum number of discussion ids exceeded. The maximum number of discussion ids is: ",M.ID_MAPPING_NOT_FOUND="No ID mappings are available for the provided ID. ID argument: ",M.INVALID_PARAM="Invalid parameter provided. Please check the following parameter: ",M.INVALID_COMPETITION_ID="Invalid competition ID provided. Please provide a valid competition ID.",M.INVALID_TEAM_ID="Invalid team ID provided. Please provide a valid team ID.",M.INVALID_OR_EMPTY_IDS="Invalid or empty IDs provided. Please provide at least one ID.",M.INVALID_PROVIDER="Invalid provider. The valid providers are: 'native', 'enetpulse', 'sportal365', 'sportradar' and 'api_football'.",M.INVALID_OUTPUT_PROVIDER="Invalid output provider. The output can not be the same as the input provider.",M.MATCH_SUMMARY_REQUIRED="Match summary is required.",M.MATCH_SUMMARY_PREDICTIONS_REQUIRED="Predictions in match summary are required.",M.INVALID_MATCH_SUMMARY_PREDICTIONS_KEYS="Keys in predictions in match summary are invalid. The valid ones are: ",M.INVALID_COLLECT_LEAD_METHOD_CALL="The method 'collectLead' from Profile namespace is not called correctly. You need to provide 'requestBody' parameter to the method.",M.REQUIRED_FIXTURES_FIELD="Fixtures field is required and should contain at least one BracketGameFixtures object. For more information please visit our documentation",M.INVALID_TIEBREAKER_FIELD="Tiebreaker field is invalid. It should contain statTotal key with integer value. For more information please visit our documentation",M.ENTITY_IDS_NOT_FOUND="Some of the sport entity IDs were not found for the provided id schema",M.MATCH_IDS_NOT_FOUND="Some of the match IDs were not found for the provided id schema",M.INVALID_STANDING_PREDICTION_ARGUMENT="The prediction argument is invalid. For more information please visit our documentation",M))(k||{}),Gp={UNEXPECTED_STATUS_PROP:`Unexpected provided property 'status'. You can NOT use this property for this method. For more information visit our documentation:
2
+ ${Np.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
+ ${Np.PREDICTOR_USER_RELATED_OPERATION}`},ic=(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`,ql=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.`,rc=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`,oc=(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`,sc=(s,t)=>`The field ${s} has incorrect type. The correct type is ${t}`;var Dt=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 v=class{baseUrl=null;apiSignInUrl=null;jwtToken=null;idSchema=null;retryRequest=!1;headers=null;authHeaders=null;errorHandlingMode=null;configuration=null;constructor(t,e){this.baseUrl=e,this.configuration=t,this.apiSignInUrl=`?key=${t.apiKey}&client_id=${t.clientId}`,this.errorHandlingMode=t.errorHandlingMode,this.idSchema=t.idSchema,this.headers={"Content-Type":"application/json"}}getJwtToken=()=>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 Dt(t,o)}let{code:i,status:a,message:r}=e.error;return this.errorHandlingMode==="standard"?new m(i,a,r):new Dt(t,e.error)};validateJWTToken=()=>{let t=null;try{t=$l(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 Dt(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 Dt(i,a)}else if(this.errorHandlingMode==="standard")throw new m(401,"invalid_token","The provided JWT token is expired")}}};var si=class extends v{activityRemapper=null;constructor(t){super(t,C(t.environment,"loyalty")),this.activityRemapper=new Ws}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}${h()}`:`/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 Up=(E=>(E.LIKE="like",E.DISLIKE="dislike",E.PAGE_VIEW="page_view",E.CONTENT_CONSUMED="content_consumed",E.SHARE="share",E.COMMENT="comment",E.CLICK_AD="click_ad",E.CONVERSION="conversion",E.PREDICTION_MADE="prediction_made",E.CONVERT="convert",E.MANAGE_INTERESTS="manage_interests",E.GAME_PARTICIPATION="game_participation",E.ARTICLE_CONSUMED="article_consumed",E.VIDEO_CONSUMED="video_consumed",E.SHORT_VIDEO_CONSUMED="short_video_consumed",E.LONG_VIDEO_CONSUMED="long_video_consumed",E.AUDIO_CONSUMED="audio_consumed",E.GALLERY_CONSUMED="gallery_consumed",E.IMAGE_CONSUMED="image_consumed",E.POLL_PARTICIPATION="poll_participation",E))(Up||{});var ni=class{action=null;context=new Tt;constructor(t,e,i,a){this.action=t,this.context.tags=e,i&&(this.context.content=i),a&&(this.context.campaign=a)}};var zs={player:"players",team:"teams",homeTeam:"teams",awayTeam:"teams",country:"countries",competition:"competitions",match:"matches"},Qs=class extends v{constructor(t){super(t,C(t.environment,"idMapping"))}getEntityById=async(t,e)=>{let i=`/football${this.apiSignInUrl}&input_provider=${this.idSchema}&${zs[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}&${zs[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}&${zs[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=Dp(e),r=[];for(let o of a){let n=`/football${this.apiSignInUrl}&input_provider=${i}&${zs[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=Yt(i),n=Dp(o);for(let p of n){let c="";if(Object.keys(t).forEach(u=>{a[u]=[];let d=p.filter(y=>t[u].includes(y));d&&d.length>0&&(a[u]=d)}),Object.keys(a).forEach(u=>{a[u].length>0&&(a[u].sort((d,y)=>d.localeCompare(y)),c+="&",c+=`${zs[u]}=${a[u].join(",")}`)}),c&&c.length>0){let u=`/football${this.apiSignInUrl}&input_provider=${e||"native"}${c}`,d="There was a problem with id mapping request",y=await this.fetchWithoutAuth(u,d);r.push(y.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 Vp="FansUnited",Wl={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}}},Wi=class{idSchema="";storageInstance=null;expirationProfileTimeout=600;expirationBadgesTimeout=3600;expirationClientFeaturesTimeout=14400;expirationFootballIdsTimeout=604800;constructor(t){this.idSchema=t,this.getStorageInstance()}static getInstance(t){return Wi.instance||(Wi.instance=new Wi(t)),Wi.instance}async getStorageInstance(){try{let t=await Promise.resolve().then(()=>(lc(),nc));this.storageInstance=t.default}catch(t){console.error(t)}}async getData(){try{let t=await this.storageInstance.getItem(Vp);return t?JSON.parse(t):(await this.storageInstance.setItem(Vp,JSON.stringify(Wl)),Wl)}catch(t){throw console.error("AsyncStorage error:",t),t}}async setData(t){await this.storageInstance.setItem(Vp,JSON.stringify(t))}clearData=async()=>{await this.setData(Wl)};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=D[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=D[i];return r&&t.includes(`${r[o]}`)&&r.resource===e}):a.football.ids.find(r=>{let o=D[i];return r&&`${r[o]}`===t&&r.resource===e})};checkForExistingIdObjs=async(t,e)=>{let i=D[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=D[i],o=D[e],n={};return Object.keys(t).forEach(l=>{let p=t[l],c=[];a.football.ids.forEach(u=>{p.forEach((d,y)=>{d===u[o]&&l===u.resource&&(c[y]=u[r])})}),n[l]=c}),n};addIdMapping=async t=>{let e=await this.getData();e.football.ids.push(t),await this.setData(e)};addIdMappings=async t=>{let e=await this.getData(),i=e.football.ids;i=[...i,...t],e.football.ids=i,await this.setData(e)};addTopIdMappings=async t=>{let e=await this.getData();if(e.football.ids.length){let i=JSON.parse(JSON.stringify(e.football.ids));i=i.filter(a=>a.resource!=="match"),t=t.filter(a=>a.resource==="match"),i=[...i,...t],e.football.ids=i}else e.football.ids=t;e.football.expirations.ids=Math.floor(Date.now()/1e3)+this.expirationFootballIdsTimeout,await this.setData(e)};setOwnProfile=async t=>{let e=await this.getData();e.profile.info=t,e.profile.expirations.profile=Math.floor(Date.now()/1e3)+this.expirationProfileTimeout,await this.setData(e)};getOwnProfile=async()=>(await this.getData()).profile.info;getProfileCountries=async()=>(await this.getData()).profile.countries;setProfileCountries=async t=>{let e=await this.getData();e.profile.countries=t,await this.setData(e)};getProfileStats=async()=>(await this.getData()).profile.statistics;setProfileStats=async t=>{let e=await this.getData();e.profile.statistics=t,e.profile.expirations.statistics=Math.floor(Date.now()/1e3)+this.expirationProfileTimeout,await this.setData(e)};getProfileBadges=async()=>(await this.getData()).profile.badges;setProfileBadges=async t=>{let e=await this.getData();e.profile.badges=t,e.profile.expirations.badges=Math.floor(Date.now()/1e3)+this.expirationBadgesTimeout,await this.setData(e)};getFootballCountries=async()=>(await this.getData()).football.countries;setFootballCountries=async t=>{let e=await this.getData();e.football.countries=t,await this.setData(e)};getClientFeatures=async()=>(await this.getData()).client.features;setClientFeatures=async t=>{let e=await this.getData(),i=JSON.parse(JSON.stringify(t));e.client.expirations.features=Math.floor(Date.now()/1e3)+this.expirationClientFeaturesTimeout,e.client.features=i,await this.setData(e)};deleteClientFeatures=async()=>{let t=await this.getData(),e=JSON.parse(JSON.stringify(t));e.client={features:{},expirations:{features:0}},await this.setData(e)};getExpiration=async(t,e)=>{await this.initialNewSchema(t,"expirations");let i=await this.getData();switch(e){case"profile":return i.profile.expirations.profile;case"statistics":return i.profile.expirations.statistics;case"badges":return i.profile.expirations.badges;case"features":return i.client.expirations.features;case"ids":return i.football.expirations.ids}};makeCompetitionsUnique=t=>{let e=new Set;return t.filter(i=>{let a=!e.has(i.id);return e.add(i.id),a})};initialNewSchema=async(t,e)=>{let i=await this.getData();(!i||!i[t]||!i[t][e])&&await this.setData(Wl)}},zi=Wi;J(zi,"instance");var Hp="FansUnited",$p={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}}},Qi=class{idSchema="";expirationProfileTimeout=600;expirationBadgesTimeout=3600;expirationClientFeaturesTimeout=14400;expirationFootballIdsTimeout=604800;constructor(t){this.idSchema=t}static getInstance(t){return Qi.instance||(Qi.instance=new Qi(t)),Qi.instance}clearData=async()=>{this.setData($p)};getEntityById=async(t="",e="")=>this.getData().football.ids.find(i=>{let a=D[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=D[i];return a&&t.includes(`${a[r]}`)&&a.resource===e}):this.getData().football.ids.find(a=>{let r=D[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=D[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=D[i],r=D[e],o={};return Object.keys(t).forEach(n=>{let l=t[n],p=[];this.getData().football.ids.forEach(c=>{l.forEach((u,d)=>{u===c[r]&&n===c.resource&&(p[d]=c[a])})}),o[n]=p}),o};addIdMapping=t=>{let e=this.getData();e.football.ids.push(t),this.setData(e)};addIdMappings=async t=>{let e=this.getData(),i=e.football.ids;i=[...i,...t],e.football.ids=i,this.setData(e)};addTopIdMappings=async t=>{let e=this.getData();if(e.football.ids.length){let i=JSON.parse(JSON.stringify(e.football.ids));i=i.filter(a=>a.resource!=="match"),t=t.filter(a=>a.resource==="match"),i=[...i,...t],e.football.ids=i}else e.football.ids=t;e.football.expirations.ids=Math.floor(Date.now()/1e3)+this.expirationFootballIdsTimeout,this.setData(e)};setOwnProfile=async t=>{let e=this.getData();e.profile.info=t,e.profile.expirations.profile=Math.floor(Date.now()/1e3)+this.expirationProfileTimeout,this.setData(e)};getOwnProfile=()=>this.getData().profile.info;getProfileCountries=()=>this.getData().profile.countries;setProfileCountries=async t=>{let e=this.getData();e.profile.countries=t,this.setData(e)};getProfileStats=()=>this.getData().profile.statistics;setProfileStats=async t=>{let e=this.getData();e.profile.statistics=t,e.profile.expirations.statistics=Math.floor(Date.now()/1e3)+this.expirationProfileTimeout,this.setData(e)};getProfileBadges=()=>this.getData().profile.badges;setProfileBadges=async t=>{let e=this.getData();e.profile.badges=t,e.profile.expirations.badges=Math.floor(Date.now()/1e3)+this.expirationBadgesTimeout,this.setData(e)};getFootballCountries=()=>this.getData().football.countries;setFootballCountries=async t=>{let e=this.getData();e.football.countries=t,this.setData(e)};getCompetitions=t=>{let e=this.getData();return t?t.competitionSearchFilter(e.football.competitions):e.football.competitions};setCompetitions=async t=>{let e=this.getData(),i=[...e.football.competitions];i.push(...t),e.football.competitions=this.makeCompetitionsUnique(i),this.setData(e)};getCompetitionsLength=async()=>{let{football:t}=this.getData();return t.competitions.length};getClientFeatures=()=>this.getData().client.features;setClientFeatures=async t=>{let e=this.getData(),i=JSON.parse(JSON.stringify(t));e.client.expirations.features=Math.floor(Date.now()/1e3)+this.expirationClientFeaturesTimeout,e.client.features=i,this.setData(e)};deleteClientFeatures=async()=>{let t=this.getData(),e=JSON.parse(JSON.stringify(t));e.client={features:{},expirations:{features:0}},this.setData(e)};getExpiration=async(t,e)=>{this.initialNewSchema(t,"expirations");let i=this.getData();switch(e){case"profile":return i.profile.expirations.profile;case"statistics":return i.profile.expirations.statistics;case"badges":return i.profile.expirations.badges;case"features":return i.client.expirations.features;case"ids":return i.football.expirations.ids}};makeCompetitionsUnique=t=>{let e=new Set;return t.filter(i=>{let a=!e.has(i.id);return e.add(i.id),a})};getData=()=>(localStorage.getItem(Hp)||this.setData($p),JSON.parse(localStorage.getItem(Hp)));setData=t=>{localStorage.setItem(Hp,JSON.stringify(t))};initialNewSchema=(t,e)=>{let i=this.getData();(!i||!i[t]||!i[t][e])&&this.setData($p)}},Ki=Qi;J(Ki,"instance");var Ec=$c(Sc());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=D[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=D[i];return r&&t.includes(`${r[o]}`)&&r.resource===e}):a.find(r=>{let o=D[i];return r&&`${r[o]}`===t&&r.resource===e})};checkForExistingIdObjs=async(t,e)=>{let i=D[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=D[i],r=D[e],o=T.nodeCache.get("ids"),n={};return o?(Object.keys(t).forEach(l=>{let p=t[l],c=[];o.forEach(u=>{p.forEach((d,y)=>{d===u[r]&&l===u.resource&&(c[y]=u[a])})}),n[l]=c}),n):null};addIdMapping=async t=>{let e=T.nodeCache.get("ids");e.push(t),T.nodeCache.set("ids",e)};addIdMappings=async t=>{let e=T.nodeCache.get("ids");e=[...e,...t],T.nodeCache.set("ids",e)};addTopIdMappings=async t=>{let e=T.nodeCache.get("ids"),i=604800;if(e){let a=JSON.parse(JSON.stringify(e));a=a.filter(r=>r.resource!=="match"),t=t.filter(r=>r.resource==="match"),a=[...a,...t],T.nodeCache.set("ids",a)}else T.nodeCache.set("ids",t);this.idMappingsExpiration=Math.floor(Date.now()/1e3)+i};setOwnProfile=async t=>{T.nodeCache.set("profile",t,this.profileTTL)};getOwnProfile=async()=>T.nodeCache.get("profile");getProfileCountries=async()=>T.nodeCache.get("profile_countries");setProfileCountries=async t=>{T.nodeCache.set("profile_countries",t)};getProfileStats=async()=>T.nodeCache.get("profile_stats");setProfileStats=async t=>{T.nodeCache.set("profile_stats",t,this.profileTTL)};getProfileBadges=async()=>T.nodeCache.get("profile_badges");setProfileBadges=async t=>{T.nodeCache.set("profile_badges",t,this.profileBadgesTTL)};getFootballCountries=async()=>T.nodeCache.get("football_countries");setFootballCountries=async t=>{T.nodeCache.set("football_countries",t)};getCompetitions=async t=>{let e=T.nodeCache.get("football_competitions");return e?t?t.competitionSearchFilter(e):e:null};setCompetitions=async t=>{T.nodeCache.set("football_competitions",t)};getCompetitionsLength=async()=>{let t=T.nodeCache.get("football_competitions");return t?t.length:0};getClientFeatures=async()=>T.nodeCache.get("client");setClientFeatures=async t=>{T.nodeCache.set("client",t,this.clientTTL)};deleteClientFeatures=async()=>{T.nodeCache.del("client")};getExpiration=async(t,e)=>{let i=this.getKeyFromExpirationType(e);return i==="ids"?this.idMappingsExpiration:T.nodeCache.getTtl(i)};getKeyFromExpirationType=t=>{switch(t){case"profile":return"profile";case"statistics":return"profile_stats";case"badges":return"profile_badges";case"features":return"client";case"ids":return"ids"}}},li=T;J(li,"instance"),J(li,"nodeCache",new Ec.default);var st=class{createLocalCacheInstance=t=>typeof window>"u"?li.getInstance(t):typeof __DEV__<"u"?zi.getInstance(t):Ki.getInstance(t)};var pi=class{localCache=null;https=null;constructor(t){this.localCache=new st().createLocalCacheInstance(t.idSchema),this.https=new Qs(t)}getEntitiesByIds=async(t,e,i)=>{await this.setTopIdMappings();try{let a=await this.localCache.checkForExistingIdObjs(t,e),r=this.splitForRequestAndExisting(a),o=await this.https.getEntitiesByIdObjs(r.request,e);return await this.localCache.addIdMappings(o),await this.localCache.getIdsByType(t,e,i)}catch(a){return console.warn("There was a problem retrieving the entity ids ",a),Promise.resolve([])}};getEntitiesByIdsMap=async(t,e,i)=>{await this.setTopIdMappings();try{let a=JSON.parse(JSON.stringify(t)),r=await this.localCache.checkForExistingIdObjs(t,e),o=this.splitForRequestAndExisting(r),n=await this.https.getEntitiesByIdObjs(o.request,e);await this.localCache.addIdMappings(n);let l=await this.localCache.getIdsByType(t,e,i),p=new Map;return Object.keys(a).forEach(c=>{a[c].forEach((u,d)=>{let y=l[c].length&&l[c][d]?l[c][d]:"";p.set(u,y)})}),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 jl=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 Ks=class{extractedObjIds={};traverse=(t,e)=>(e=jl(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 js=class{replaceObjIdsIndex=null;remappedIdsObj={};traverse=(t,e,i)=>(e=jl(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 S=class{idSchema="";idMappingFacade=null;constructor(t){this.idSchema=t.idSchema,this.idMappingFacade=new pi(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 Ks().traverse(i,e);return this.idMappingFacade.getEntitiesByIds(r,"native",this.idSchema).then(o=>new js().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 ft=class{idSchema;idMapping;constructor(t){this.idSchema=t.idSchema,this.idMapping=new S(t)}remapTagsIds=async(t,e,i)=>{if(!t||!t.length)return t;let a={},r={},o=[];t.forEach(l=>{a.hasOwnProperty(l.type)||(a[l.type]=[],r[l.type]=[]),a[l.type].push(l.id),r[l.type].push(l)});let n=await this.idMapping.idMappingFacade.getEntitiesByIds(a,e,i);for(let[l,p]of Object.entries(r))p.forEach((c,u)=>{c.id=n[l][u],o.push(c)});return o}};var re=class{page=null;limit=null;constructor(t){this.page=t.page?t.page:null,this.limit=t.limit?t.limit:null}};var Xi=class extends re{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 Yi=class extends re{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 Xs=class{idSchema;activityHttps;activityService;constructor(t){this.idSchema=t.idSchema,this.activityHttps=new si(t),this.activityService=new ft(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 ni(t,n,i,a),p=await this.activityHttps.createActivity(l);return p.context.tags=o,p}let r=new ni(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)};addConversion=async(t,e,i)=>{let a="conversion";return await this.add(a,t,e,i)};getOwn=async(t,e)=>{if(e=e||!1,t&&(t=new Xi(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 Yi(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 Ys=class{activityFacade;constructor(t){this.activityFacade=new Xs(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);addConversion=async(t,e,i)=>await this.activityFacade.addConversion(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 oe=class{participantOne=null;participantTwo=null};var Ji=class{matchId="";participantOne="";participantTwo="";winner="";homeParticipant="";startDate="";score=new oe};var se=class{participants=[]};var Zi=class{id=null;name=null;group=null;image=null;undecided=!1};var ta=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 se;fixtures=[];createdAt=null;updatedAt=null};var gt=class{nextPageStartsAfter=null;itemsPerPage=null};var w=class{pagination=new gt};var ea=class{meta=new w;data=[]};var ia=class{meta=new w;data=[]};var aa=class{statTiebreakerEnabled;statTotal};var ra=class{matchId="";participantOne="";participantTwo="";winner;correct=null};var ne=class{statTotal=0};var Rc=(r=>(r.ACTIVE="ACTIVE",r.WON="WON",r.LOST="LOST",r.PARTIALLY_WON="PARTIALLY_WON",r.CANCELED="CANCELED",r))(Rc||{}),oa=class{id="";profileId="";profileModel=null;gameId="";totalPoints=null;gamePoints=null;bonusPoints=null;position=null;status="ACTIVE";fixtures=[];tiebreaker=new ne;createdAt="";updatedAt=""};var sa=class{meta=new w;data=[]};var Js=class{remapBracketGames=t=>{let e=new ia;return e.meta.pagination.itemsPerPage=t.meta.pagination.items_per_page,e.meta.pagination.nextPageStartsAfter=t.meta.pagination.next_page_starts_after,e.data=t.data.map(i=>this.remapBracketGameById(i)),e};remapBracketGameById=t=>{let e=new ta;return e.id=t.id,e.title=t.title,e.description=t.description,e.rules=t.rules,e.customFields=t.custom_fields,e.images=t.images,e.type=t.type,e.status=t.status,e.points=t.points,e.related=t.related?this.remapRelated(t.related):t.related,e.tiebreaker=t.tiebreaker?this.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 oa;return e.id=t.id,e.profileId=t.profile_id,e.gameId=t.game_id,e.totalPoints=t.total_points,e.gamePoints=t.game_points,e.bonusPoints=t.bonus_points,e.position=t.position,e.status=t.status,e.fixtures=this.remapPredictionFixtures(t.fixtures),e.tiebreaker=t.tiebreaker?this.remapPredictionTiebreaker(t.tiebreaker):t.tiebreaker,e.createdAt=t.created_at,e.updatedAt=t.updated_at,e};remapPredictionsForUser=t=>{let e=new ea;return e.meta.pagination.itemsPerPage=t.meta.pagination.items_per_page,e.meta.pagination.nextPageStartsAfter=t.meta.pagination.next_page_starts_after,e.data=t.data.map(i=>this.remapPrediction(i)),e};remapRankings=t=>{let e=new sa;return e.meta.pagination.itemsPerPage=t.meta.pagination.items_per_page,e.meta.pagination.nextPageStartsAfter=t.meta.pagination.next_page_starts_after,e.data=t.data.map(i=>this.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 ra;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 ne;return e.statTotal=t.stat_total,e};remapBracketGameMeta=t=>{let e=new se;return e.participants=t.participants.map(i=>{let a=new Zi;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 Ji;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 oe;return e.participantOne=t.participant_one,e.participantTwo=t.participant_two,e};remapBracketGameTiebreaker=t=>{let e=new aa;return e.statTiebreakerEnabled=t.stat_tiebreaker_enabled,e.statTotal=t.stat_total,e}};var le=class{participants=[]};var na=class{id=null;title=null;description=null;rules=null;customFields=null;images=null;type="STANDING";status=null;points=null;related=[];predictionsCutoff="";meta=new le;outcomeCount=null;outcome=[];createdAt=null;updatedAt=null};var la=class{meta=new w;data=[]};var pa=class{id=null;name=null;group=null;image=null;undecided=!1};var ca=class{id="";profileId="";profileModel=null;total=0;gameId="";totalPoints=null;gamePoints=null;bonusPoints=null;position=null;status="ACTIVE";standing=[];createdAt="";updatedAt=""};var ua=class{meta=new w;data=[]};var da=class{meta=new w;data=[]};var Zs=class{remapBracketGames=t=>{let e=new la;return e.meta.pagination.itemsPerPage=t.meta.pagination.items_per_page,e.meta.pagination.nextPageStartsAfter=t.meta.pagination.next_page_starts_after,e.data=t.data.map(i=>this.remapStandingGameById(i)),e};remapStandingGameById=t=>{let e=new na;return e.id=t.id,e.title=t.title,e.description=t.description,e.rules=t.rules,e.customFields=t.custom_fields,e.images=t.images,e.type=t.type,e.status=t.status,e.points=t.points,e.related=t.related?this.remapRelated(t.related):t.related,e.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 ca;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 ua;return e.meta.pagination.itemsPerPage=t.meta.pagination.items_per_page,e.meta.pagination.nextPageStartsAfter=t.meta.pagination.next_page_starts_after,e.data=t.data.map(i=>this.remapPrediction(i)),e};remapRankings=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.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 le;return e.participants=t.participants.map(i=>{let a=new pa;return a.id=i.id,a.name=i.name,a.group=i.group,a.image=i.image,a.undecided=i.undecided,a}),e}};var iu={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:""},ci=class extends v{bracketGameRemapper=null;standingGameRemapper=null;constructor(t){super(t,C(t.environment,"predictor")),this.bracketGameRemapper=new Js,this.standingGameRemapper=new Zs}getBracketGames=async(t,e)=>{let i=t?`/custom/bracket${this.apiSignInUrl}${t.constructMainFiltersUrl()}`:`/custom/bracket${this.apiSignInUrl}`;g(e)&&(i+=h());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}${h()}`:`/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+=h());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}${h()}`:`/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(iu));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+=h());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+=h());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}${h()}`:`/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+=h());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+=h());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 pe=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 ma=class extends pe{email=null;phoneNumber=null;phoneCountryCode=null};var tn=class{profilesFromResponse=t=>t?t.map(e=>this.publicProfileFromResponse(e)):null;fullProfileFromResponse=t=>{let e=new ma;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 pe;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 ha=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 ha;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 fa=class{avatar=null;followerId=null;name=null;nickname=null;profileId=null};var ga=class{followsMe=[];iFollow=[];followsMeBack=[]};var an=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 ga;return e.iFollow=t.i_follow,e.followsMe=t.follows_me,e.followsMeBack=t.follows_me_back,e};remapResponse=t=>{let e=new fa;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 ya=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 ya;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 au="/countries",tt="/profile",Xl="/profiles",di=class extends v{profileRemapper=null;followingRemapper=null;followersRemapper=null;leadRemapper=null;lang=null;limitIds=100;constructor(t){super(t,C(t.environment,"profile")),this.lang=t.lang,this.profileRemapper=new tn,this.followingRemapper=new en,this.followersRemapper=new an,this.leadRemapper=new rn}getCountries=async t=>{let e=`&lang=${this.lang}`,i=`${au}${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=`${tt}${this.apiSignInUrl}`,i="";if(t){e=`${Xl}/${t}${this.apiSignInUrl}`,i=`There was a problem fetching the following profile: ${t}`;let a=await this.fetchWithoutAuth(e,i);return this.profileRemapper.publicProfileFromResponse(a.data)}else{i="There was a problem fetching your profile from API";let a=await this.fetchWithAuth(e,i);return this.profileRemapper.fullProfileFromResponse(a.data)}};getProfiles=async(t,e,i)=>{let a=Date.now(),r=`There was a problem fetching the following profiles: ${t.join(",")}`;if(t&&t.length){if(t.length>this.limitIds){let c=[],u=ri(t,this.limitIds);for(let d of u){let y=`${Xl}${this.apiSignInUrl}&profile_ids=${d.join(",")}`;r=`There was a problem fetching the following profiles: ${d.join(",")}`,i&&(y+=`&disable_cache=${a}`);let b=await this.fetchWithoutAuth(y,r);c.push(...this.profileRemapper.profilesFromResponse(b.data))}return c}let l=`${Xl}${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=`${Xl}${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=`${tt}/followers${this.apiSignInUrl}`,a="There was a problem fetching the followers for own profile";if(t&&!e){i=`${tt}/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=`${tt}/${e}/followers${this.apiSignInUrl}${t.constructFilterUrl()}`:!t&&e&&(i=`${tt}/${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=`${tt}/following${this.apiSignInUrl}`,a="There was a problem fetching the followers of own profile";if(t&&!e){i=`${tt}/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=`${tt}/${e}/following${this.apiSignInUrl}${t.constructFilterUrl()}`:!t&&e&&(i=`${tt}/${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=tt+`/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=tt+`/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=`${tt}/badges${this.apiSignInUrl}`,i="There was a problem with fetching own badges";return t?(e=`${tt}/${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=tt+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";return await this.fetchWithAuth(t,e,i),!0}};var j=class{completed=!1;percentage;constructor(t){this.percentage=t}};var ba=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 Ma=class{totalPercentage;breakdown=new ba};var mi=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 f=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 yt=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 mi(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 mi(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 Ma,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 f(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 f(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 wa=class{id=null;name=null;assets=null};var on=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 sn=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 on,this.profileFacade=new yt(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 wa,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 f(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();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.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};extractUserIdFromToken=()=>{try{return $l(this.configuration.authProvider.getIdToken())?.sub||""}catch(t){return console.error(t),""}}};var nn=class{idsRemapper=null;profileHttps=null;activityHttps=null;profileFacade=null;profileId="";constructor(t,e,i,a){this.idsRemapper=t,this.profileHttps=i,this.activityHttps=a,this.profileFacade=new yt(e,i,a)}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 ln=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 hi=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 pn=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 hi(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 hi({competitionIds:t,limit:i}),r=await this.getCompetitions(a);r.sort((l,p)=>l.id.localeCompare(p.id));let o=Vl(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 fi=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 Ia=class{reason="";words=[]};var ce=class{enabled=!1;moderateLinks=!1;linksWhitelist=[];moderatorProfileId="";dictionary=new Ia};var Pa=class{enabled=!1;clientId=null;automaticModeration=new ce};var Ft=class{points=null;gameParticipationCount=null;entityId=null;entityType=null;predictionsMade=null;correctPredictions=null};var ue=class{id;weight;multiplier;conditions};var de=class{value=[new ue]};var me=class{points=null;tiers=null;badges=null};var _a=class{enabled=!1;clientId=null;conditions={list:null};actions=new de;rewards=new me};var Ta=class{general=null;predictor=null;activity=null;topX=null;matchQuiz=null;discussionPost=null};var he=class{enabled=!1;clientId=null;defaultMarkets=null;competitionsWhitelist=null;authRequirement=null};var fe=class{enabled=!1;clientId=null;minFixtures=null;maxFixtures=null;competitionsWhitelist=null;authRequirement=null};var Fa=class{competitions=[];teams=[];markets=[]};var ge=class{enabled=!1;clientId=null;fullCoverageCompetitions=null;markets=null;successRateScopes=new Fa;userDataConfig=null};var Sa=class{storeIp=!1;storeDeviceId=!1;storeAgent=!1};var Ea=class{potm=[];poll=[]};var Ra=class{predictor=[];topX=[];matchQuiz=[];games=[];football=[];classicQuizzes=[];eitherOr=[];discussions=[];voting=new Ea};var q=class{id;label;description;flags;assets={mainImageUrl:""};enabled};var va=class{predictionsNumber;correctPredictions;points;fromDate;toDate};var Ca=class extends q{requirements=new va};var Aa=class{participationCount;points;fromDate;toDate};var Oa=class extends q{requirements=new Aa};var xa=class{participationCount;points;specificGames;fromDate;toDate};var La=class extends q{requirements=new xa};var Da=class{predictionsNumber;correctPredictions;points;entityId;entityType;entityModel=null};var Ba=class extends q{requirements=new Da};var Na=class{participationCount;fromDate;toDate};var ka=class extends q{requirements=new Na};var Ga=class{totalDiscussionPoints;postsCount;postPoints;reactionsCount};var Ua=class extends q{requirements=new Ga};var Va=class{points;voteCount;entityId;entityType;entityModel};var ye=class extends q{requirements=new Va};var be=class{points=null;tiers=null;badges=null};var Ha=class{enabled=!1;clientId=null;conditions={list:null};actions=new de;rewards=new be};var $a=class{general=[];predictor=[];topX=[];matchQuiz=[]};var qa=class{id;label;assets={mainImageUrl:""};enabled;requirements=new Ft};var Me=class extends Ft{postPoints=null;postsCount=null;reactionsCount=null;totalDiscussionPoints=null};var Wa=class{id;label;assets={mainImageUrl:""};enabled;requirements=new Me};var we=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 Ie=class{total=null;minGoalkeepers=null;maxGoalkeepers=null;minDefenders=null;maxDefenders=null;minMidfielders=null;maxMidfielders=null;minStrikers=null;maxStrikers=null};var za=class{enabled=!1;clientId=null;addPointsToProfileTotal=!1;coefficients=new we;players=new Ie;competitionsWhitelist=[]};var cn=class{remapPredictorConfig=t=>{let e=new ge;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 fe;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 he;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 _a;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 Ha;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 Pa;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 za;return e.enabled=t.enabled,e.clientId=t.client_id,e.addPointsToProfileTotal=t.add_points_to_profile_total,e.competitionsWhitelist=t.competitions_whitelist,e.players=this.remapFantasyPlayers(t.players),e.coefficients=this.remapFantasyCoefficients(t.coefficients),e};remapFantasyPlayers=t=>{let e=new Ie;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 we;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 ce;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 be;return e.points=this.remapPoints(t.points),e.tiers=t.tiers,e.badges=this.remapNewBadges(t.badges),e};remapRewards=t=>{let e=new me;return e.points=this.remapPoints(t.points),e.tiers=t.tiers,e.badges=this.remapBadges(t.badges),e};remapPoints=t=>{let e=new Ta;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 $a;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 Ra;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 Ca;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 Oa;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 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.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 Ba;return i.id=e.id,i.enabled=e.enabled,i.label=e.label,i.description=e.description,i.flags=e.flags,e.assets?i.assets.mainImageUrl=e.assets.main_image_url:i.assets=e.assets,e.requirements&&(i.requirements.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 ka;return i.id=e.id,i.enabled=e.enabled,i.label=e.label,i.description=e.description,i.flags=e.flags,e.assets?i.assets.mainImageUrl=e.assets.main_image_url:i.assets=e.assets,e.requirements&&(i.requirements.participationCount=e.requirements.participation_count,i.requirements.fromDate=e.requirements.from_date,i.requirements.toDate=e.requirements.to_date),i});remapBadgeValuesDiscussions=t=>t.map(e=>{let i=new Ua;return i.id=e.id,i.enabled=e.enabled,i.label=e.label,i.description=e.description,i.flags=e.flags,e.assets?i.assets.mainImageUrl=e.assets.main_image_url:i.assets=e.assets,e.requirements&&(i.requirements.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 ye;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 Ft;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 Sa;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 Wa;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 Me;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}};var Qa=class{entityId;entityType;entityModel=null};var Yl=class{totalItems=0};var Jl=class{id=null;label=null};var Zl=class{type=null;id=null;label=null};var Ka=class{id=null;source=null;type=null};var _=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 ja=class extends _{};var tp=class{fixtures=[];tiebreaker};var Wp=(i=>(i.PARTICIPANT_ONE="PARTICIPANT_ONE",i.PARTICIPANT_TWO="PARTICIPANT_TWO",i.DRAW="DRAW",i))(Wp||{});var Xa=class{matchId="";participantOne="";participantTwo="";winner="PARTICIPANT_ONE"};var St=(o=>(o.OPEN="OPEN",o.LIVE="LIVE",o.PENDING="PENDING",o.CANCELED="CANCELED",o.CLOSED="CLOSED",o.SETTLED="SETTLED",o))(St||{});var Ya=class extends _{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(St).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 Ja=class{profileId="";profileModel=null;challengeId="";challengeModel=null;message=""};var Pe=class{name="";description="";invitation_code="";template_id="";users_can_invite_users=!1;administrators=[];scoring_starts_at=""};var Za=class extends Pe{type="ONE_VS_ONE"};var _e=class{name="";description="";invitation_code="";template_id="";users_can_invite_users=!1;administrators=[];pinned_posts=[];scoring_starts_at=""};var tr=class extends _e{type="ONE_VS_ONE"};var er=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 ir=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 ar=class{templateId="";templateModel=null;challengeId="";challengeModel=null;position="";points=0;type="challenge"};var rr=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 ep=class{content="";replyId="";discussionLabel="";discussionUrl="";userNickname="";context=null};var Te=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 or=class extends Te{userModel=null};var sr=class{content="";reply_id="";discussion_label="";discussion_url="";anonymous_nickname="";context=null};var nr=class{id="";postsCount=0};var Et=class{pagination={totalItems:0,nextPageStartsAfter:"",lastCommentCreateTimestamp:""}};var lr=class{meta=new Et;data=[]};var pr=class{meta=new Et;data=[]};var cr=class{meta=new w;data=[]};var ur=class{type="";userIds=[];reactionCount=0};var dr=class{userId=null;reason="AD";reasonDetails=null};var mr=class{updatedAt="";content=""};var ru=["CREATED_AT_ASC","CREATED_AT_DESC","POSTS_COUNT_ASC","POSTS_COUNT_DESC"],ou=["ACTIVE","INACTIVE"],hr=class extends _{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&&ru.includes(this.sort.toUpperCase())&&(t+=`&sort=${this.sort.toUpperCase()}`),this.status&&ou.includes(this.status.toUpperCase())&&(t+=`&status=${this.status.toUpperCase()}`),this.skipDeleted!==null&&(t+=`&skip_deleted=${this.skipDeleted}`),t}};var Bt=class extends _{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 fr=class extends _{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 gr=class{templateId=null;playerId=null};var yr=class{filters=new gr};var br=class{meta=new yr;data=[]};var Mr=class{key=null;label=null;value=null};var wr=class{templateId=null};var Ir=class{filters=new wr};var Pr=class{meta=new Ir;data=[]};var Fe=class{template_id=null;group_id=null;fixtures=[]};var Se=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 Ee=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 _r=class{matchId=null;matchModel=null;points=new Se;stats=new Ee};var Tr=class{playerId=null;playerModel=null;points=null;rank=null};var Fr=class{id="";country=null;gender="";assets=null;type="";name=""};var Sr=class{id="";country=null;gender="";assets=null;type="";name="";participants=[]};var Er=class{id="";alias="";countryCode="";assets=null;name=""};var Rr=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 et=class{type=null;subType=null};var vr=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 et;lineups=null};var Rt=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 Cr=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 Ar=class{ftScore=null;htScore=null;aetScore=null;aggScore=null;penScore=null};var Re=class{homeTeam={players:[]};awayTeam={players:[]}};var Or=class{minute="";type="";teamId="";player=null;relatedPlayer=null;updatedAt=""};var xr=class{playerId=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 Lr=class{id="";country=null;birthDate="";firstName="";lastName="";name="";position="";assets=null;isDeleted=!1;teams=[]};var Dr=class{id="";country=null;birthDate="";firstName="";lastName="";name="";position="";assets=null;isDeleted=!1;competitions=[];teams=[]};var Br=class{id="";startDate="";endDate="";shirtNumber;loan=!1;position="";country=null;name="";assets=null;birthDate=""};var Nr=class{id="";country=null;birthDate="";firstName="";lastName="";name="";position="";assets=null};var gi=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 ip=class{headshot=null};var ap=class{id=null;name=null;country=null};var kr=class{id="";name="";position="";shirtNumber;assets=null;type=""};var Gr=class{id="";country=null;gender="";assets=null;name="";code="";national=!1;undecided=!1;fullName="";shortName="";isDeleted=!1};var Ur=class{primary=null;secondary=null;tertiary=null};var Vr=class{id="";country=null;gender="";assets=null;name="";competitions=[];code="";national=!1;fullName="";shortName="";isDeleted=!1;undecided=!1;colors=new Ur;squad=[]};var rp=class{teamId=null;matches=[]};var Hr=class{teams=null;players=null;competitions=null};var $r=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 Nt=class{meta=new O;data=[]};var op=class{logo=null};var sp=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;getVersion=null};var np=class{apiKey;clientId;environment;idSchema;lang;errorHandlingMode;authProvider};var K=class{main=null;cover=null;mobile=null};var qr=class{input=null;output=null};var Wr=class{meta=new qr;data=[]};var zr=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 Qr=class{general;predictor;topX;matchQuiz};var Kr=class{predictor;topX;matchQuiz;games;football;classicQuizzes;eitherOr;discussions;potm;poll};var lp=class extends ye{};var pp=class{count=0;breakdown=[]};var cp=class{footballCompetitions;footballTeams;footballPlayers};var jr=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 vt=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 Xr=class extends vt{templateId=null;constructor(t){super(t),this.templateId=t?.templateId||null}constructFiltersUrl(){let t=super.constructFiltersUrl();return this.templateId&&(t+=`&template_id=${this.templateId}`),t}};var Yr=class extends vt{sortOrder=null;rankType=null;leaderboardIds=null;gameType=null;constructor(t){super(t),this.sortOrder=t.sortOrder,this.rankType=t.rankType,this.leaderboardIds=t.leaderboardIds,this.gameType=t.type&&t.type.toLowerCase()==="game"?t.gameType:null}constructFiltersUrl=()=>{let t=super.constructFiltersUrl();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}`),t}};var Jr=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 Zr=class{position=null;points=null;predictionsMade=null;profileId=null;profileModel=null;successRatePercent=null};var ve=class{templateId=null;privateLeagueId=null;fromDate=null;toDate=null;pagination=new z};var up=class{meta=new ve;data=[]};var Ct=class{rankType=null;fromDate=null;toDate=null;pagination=new z};var dp=class{meta=new Ct;data=[]};var Ce=class{position=null;profileId=null;profileModel=null;points=null;predictionsMade=null};var to=class{flags="";status="";type="";activeFrom="";activeTo="";createdFrom="";createdTo="";updatedFrom="";updatedTo=""};var eo=class{pagination=new z;filters=new to};var mp=class{id=null;points=null};var hp=class extends ue{points;alternative;constructor(){super(),delete this.weight}};var io=class extends Ce{id=null;rankType=null;model=null;gameType=null};var fp=class{meta=new Ct;data=[]};var ao=class{groupId;averagePoints;highestPoints};var At=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 ro=class extends At{adContent=null};var oo=class{groupId=null;label=null;flags=[];filters=null};var so=class{fromDate=null;toDate=null;matchIds=[]};var gp=class{enabled=!1;id=null;label=null;points=null};var no=class{value=null;target=null;playerId=null;playerModel=null;result=null};var lo=class{matchId=null;matchType=null;market=null;matchModel=null;matchStatus=new et;prediction=new no};var po=class{gameId=null;results=null;tieBreakers=null};var ut=class{timeTiebreaker=!1};var bt=class{id=null;title=null;description=null;type=null;status=null;authRequirement=null;outcome=null;predictionsCutoff=null;fixtures=[];tiebreaker=new ut;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 Ae=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 Oe=class extends _{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 co=class extends Oe{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 uo=class extends Ae{rules=null;questions=[]};var mo=class{questionId=null;question=null;images=null;embedCode=null;explanation=null;options=[]};var ho=class{optionId=null;option=null;images=null;correct=null};var yp=class{questionId=0;optionId=0};var fo=class{classicQuizId=null;userId=null;questions=[];correctOptions=null;personalBest=null;points=null;attempts=null};var go=class{questionId=null;optionId=null;correct=null;correctOptionId=null};var yo=class extends _{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 bo=class{classicQuizId=null;classicQuizModel=null;correct=null;classicQuizQuestions=null;personalBest=null;points=null;answers=[]};var bp=class{meta=new w;data=[]};var Mo=class{questionId=null;questionModel=null;wrong=null;correct=null;skipped=null;total=null};var xe=class{classicQuizIds=null};var Le=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 wo=class extends Le{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 De=class{pagination=new z;filters=new xe};var Io=class{position=null;profileId=null;profileModel=null;points=null};var Po=class{position=null;classicQuizId=null;classicQuizModel=null;points=null};var Mp=class{meta=new O;data=[]};var wp=class{meta=new De;data=[]};var Be=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 _o=class extends Oe{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 To=class extends Be{rules=""};var Fo=class{correctSteps=0;score=0};var Ip=class{meta=new w;data=[]};var So=class{eitherOrId="";personalBest=0;betterThan=0};var Eo=class{instanceId="";eitherOrId="";gameStartedAt="";currentStep=0;currentStreak=0;remainingSteps=0;currentLives=0;currentPoints=0;personalBest=0;participationCount=0;finishedParticipationsCount=0;steps=[]};var Ro=class{pair="";answer=""};var vo=class extends Ro{expired=!1;time=0};var Co=class{main;mobile};var yi=class{id="";label="";images=new Co;value=null};var Ao=class{pairId="";userSelection="";correct=null;played=null;timestamp="";optionOne=new yi;optionTwo=new yi};var Oo=class{rangeStartInclusive=0;rangeEndInclusive=0;totalUsers=0};var xo=class{standings=[];breakdown=[]};var Lo=class{userId="";userModel=null;personalBest=""};var Ne=class{content=null;tags=[];campaign=null};var ke=class{id=null;model=null;source=null;type=null};var Do=class{questions=null;correctAnswers=null};var Pp=class{main=null;all=null};var Bo=class{value=null;playerId=null;playerModel=null};var Ge=class{market=null;matchId=null;matchType=null;matchModel=null;prediction=new Bo;result=null};var Ue=class{settledAt=null;resettledAt=null;status=null;outcome=null;points=0};var it=class{value=!1};var No=class{matchId=null;market="BOTH_TEAMS_SCORE";matchType="FOOTBALL";prediction=null;constructor(t,e){this.matchId=t,this.prediction=new it,this.prediction.value=e}};var ko=class{value};var Go=class{matchId=null;market="CORNERS_MATCH";matchType="FOOTBALL";prediction=null;constructor(t,e){this.matchId=t,this.prediction=new ko,this.prediction.value=e}};var Uo=class{value=null};var Ot=class{matchId=null;market=null;matchType="FOOTBALL";prediction=null;constructor(t,e,i){this.matchId=t,this.market=e,this.prediction=new Uo,this.prediction.value=i}};var Vo=class{value=null};var Ho=class{matchId=null;market="DOUBLE_CHANCE";matchType="FOOTBALL";prediction=null;constructor(t,e){this.matchId=t,this.prediction=new Vo,this.prediction.value=e}};var $o=class{value=null};var qo=class{matchId=null;market="HT_FT";matchType="FOOTBALL";prediction=null;constructor(t,e){this.matchId=t,this.prediction=new $o,this.prediction.value=e}};var Wo=class{value=null};var zo=class{matchId=null;market=null;matchType="FOOTBALL";prediction=null;constructor(t,e,i){this.matchId=t,this.market=e,this.prediction=new Wo,this.prediction.value=i}};var Ve=class{matchId=null;market=null;matchType="FOOTBALL";prediction=null;constructor(t,e,i){this.matchId=t,this.market=e,this.prediction=new it,this.prediction.value=i}};var He=class{matchId=null;market=null;matchType="FOOTBALL";prediction=null;constructor(t,e,i){this.matchId=t,this.market=e,this.prediction=new it,this.prediction.value=i}};var Qo=class{matchId=null;market="PENALTY_MATCH";matchType="FOOTBALL";prediction=null;constructor(t,e){this.matchId=t,this.prediction=new it,this.prediction.value=e}};var Ko=class{value=!1;playerId=null};var at=class{matchId=null;market=null;matchType="FOOTBALL";prediction=null;constructor(t,e,i,a){this.matchId=t,this.market=e,this.prediction=new Ko,this.prediction.value=i,this.prediction.playerId=a}};var jo=class{matchId=null;market="RED_CARD_MATCH";matchType="FOOTBALL";prediction=null;constructor(t,e){this.matchId=t,this.prediction=new it,this.prediction.value=e}};var _p=class{home=null;draw=null;away=null};var Tp=class{score=null;percentage=null};var $e=class{homeGoals=null;awayGoals=null};var Xo=class{playerId=null;playerModel=null};var Yo=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 Xo;PLAYER_SCORE=[];PLAYER_SCORE_TWICE=[];PLAYER_SCORE_HATTRICK=[];CORRECT_SCORE=new $e;CORRECT_SCORE_ADVANCED=new $e;CORRECT_SCORE_HT=new $e;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 A=class{no=0;yes=0};var qe=class{gameInstanceId=null;fixtures=null};var dt=class{goldenGoal=null};var bi=class{id=null;gameInstanceId=null;gameType=null;wager=null;totalFixtures=null;settledFixtures=null;userId=null;fixtures=[];status=null;tiebreaker=new dt;points=null;templateId=null;groupId=null;profileLastUpdatedAt=null;createdAt=null;updatedAt=null};var un=(r=>(r.ACTIVE="ACTIVE",r.WON="WON",r.LOST="LOST",r.PARTIALLY_WON="PARTIALLY_WON",r.CANCELED="CANCELED",r))(un||{}),zp=["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(un).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 Jo=class{fullTimeOneXTwo={};halfTimeOneXTwo={};bothTeamsScore=new A;doubleChance={};halfTimeFullTime={};playerScore={};playerYellowCard={};playerRedCard={};redCardMatch=new A;penaltyMatch=new A;playerScoreFirstGoal={};cornersMatch={};correctScore={};correctScoreHalfTime={};correctScoreAdvanced={};playerScoreHattrick={};playerScoreTwice={};overZeroPointFiveGoals=new A;overOnePointFiveGoals=new A;overTwoPointFiveGoals=new A;overThreePointFiveGoals=new A;overFourPointFiveGoals=new A;overFivePointFiveGoals=new A;overSixPointFiveGoals=new A;overSixPointFiveCorners=new A;overSevenPointFiveCorners=new A;overEightPointFiveCorners=new A;overNinePointFiveCorners=new A;overTenPointFiveCorners=new A;overElevenPointFiveCorners=new A;overTwelvePointFiveCorners=new A;overThirteenPointFiveCorners=new A};var Zo=class{matchId=null;matchType=null;predictions=null};var ts=class{profileId="";profileModel=null;leagueId="";leagueModel=null;message=""};var Fp=class{id=null;name=null;model=new At};var We=class{id="";name="";description="";type="";banned=[];invites=[];administrators=[];membersCount=0;invitationCode="";templateId="";templateModel=null;pastTemplates=[];usersCanInviteUsers=!1;scoringStartsAt="";pinnedPosts=[]};var es=class extends We{members=[]};var Sp=class{name="";description="";invitationCode="";templateId="";usersCanInviteUsers=!1;administrators=[];scoringStartsAt=""};var Ep=class{name="";description="";invitationCode="";templateId="";usersCanInviteUsers=!1;administrators=[];pinnedPosts=[];scoringStartsAt=""};var is=class{predictionId=null;predictionModel=null;profileId=null;profileModel=null};var Rp=class{meta=new O;data=[]};var vp=class{meta=new w;data=[]};var ze=class extends _{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 as=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 rs=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 Qe=class extends _{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 Ke=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 os=class{templateId="";templateModel=null;privateLeagueId="";privateLeagueModel=null;position="";points=0;type="private_league"};var ss=class extends Pe{type="PRIVATE"};var ns=class extends _e{type="PRIVATE"};var ls=class{id="";source="";type="";favourite=!1};var ps=class extends ls{model=null};var Cp=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 cs=class extends _{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(St).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 us=class extends _{};var ds=class{matchId=null;matchType=null;market=null;matchModel=null;matchStatus=new et};var ms=class{value=null;result=null};var hs=class{matchId=null;matchType=null;market=null;matchModel=null;matchStatus=new et;prediction=new ms};var Mt=class{id=null;title=null;description=null;type=null;status=null;authRequirement=null;scheduleOpenAt=null;predictionsCutoff=null;fixtures=[];tiebreaker=new ut;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 Mt{adContent=null};var kt=class{userId=null;points=null;results=[];tiebreaker=null};var fs=class{matchId=null;matchModel=null;outcome=null};var rt=class extends _{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(St).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 xt=class{id=null;title=null;description=null;type=null;status=null;authRequirement=null;outcome=null;predictionsCutoff=null;fixtures=[];tiebreaker=new ut;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 dt;branding=null};var gs=class{contestId="";contestType="GAME";contestModel=null;description="";userList=[]};var ys=class{position="";profileId="";profileModel=null;note="";tags=[]};var Xe=class{gameInstanceId=null;fixtures=[];tiebreaker=null;constructor(t){this.gameInstanceId=t.gameInstanceId,t.fixtures.forEach(e=>this.fixtures.push(new Ot(e.matchId,e.market,e.prediction.value))),this.tiebreaker=t.tiebreaker?t.tiebreaker:null}};var Ye=class extends _{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 Je=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 bs=class extends Je{rules=null};var Ap=class{id=null;title=null;description=null;images=new K;votes=null};var Ze=class{id=null;pollId=null;optionId=null;userId=null};var Ms=class extends Ze{pollModel=null;optionModel=null};var ws=class{meta=new w;data=[]};var Is=class{meta=new w;data=[]};var Ps=class extends _{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 _s=class{meta=new w;data=[]};var Ts=class{matchId=null;matchModel=null;playerId=null;playerModel=null;createdAt=null};var Fs=class{total};var Ss=class{meta=new Fs;data=[]};var Es=class{teamId=null;teamModel=null;playerId=null;playerModel=null;votes=null;winner=null};var Rs=class{meta=new O;data=[]};var dn=class{remapListContent=t=>{let e=new Rs;return e.meta=this.remapMeta(t.meta),e.data=t.data.map(i=>{let a=new Qa;return a.entityId=i.entity_id,a.entityType=i.entity_type,a}),e};remapMeta=t=>{let e=new O;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 v{featureConfigRemapper=null;listContentRemapper=null;localStorage=null;clientId=null;constructor(t){super(t,C(t.environment,"client")),this.clientId=t.clientId,this.localStorage=new st().createLocalCacheInstance(t.idSchema),this.featureConfigRemapper=new cn,this.listContentRemapper=new dn}getConfig=async t=>{let e=await this.getCachedFeatures();if(!e){let i=`/clients/${this.clientId}/features`,a=this.apiSignInUrl.split("&")[0],r=i+a,o="There was a problem fetching client features from Client API";e=(await this.fetchWithoutAuth(r,o)).data,await this.localStorage.setClientFeatures(e)}switch(t){case"predictor":return this.featureConfigRemapper.remapPredictorConfig(e.predictor);case"topX":return this.featureConfigRemapper.remapTopXConfig(e.top_x);case"matchQuiz":return this.featureConfigRemapper.remapMatchQuizConfig(e.match_quiz);case"loyalty":return this.featureConfigRemapper.remapLoyaltyConfig(e.loyalty);case"discussions":return this.featureConfigRemapper.remapDiscussionsConfig(e.discussions);case"fantasy":return this.featureConfigRemapper.remapFantasyConfig(e.football_fantasy)}};getNewLoyaltyConfig=async t=>{let e=`/clients/${this.clientId}/features`,i=this.apiSignInUrl.split("&")[0],a="There was a problem fetching client features from Client API";if(t){let o=e+i+h(),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+=h());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 wt=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 O;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 f(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 mn=class{footballService=null;https=null;idMapping=null;constructor(t,e,i){this.idMapping=i,this.https=e,this.footballService=new wt(t)}getTeamsIdMapping=async(t,e)=>{try{let i=!1;if(t){if(t=new fi(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 fi({teamIds:t,limit:i}),{data:r}=await this.getTeams(a);r.sort((l,p)=>l.id.localeCompare(p.id));let o=Vl(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 Gt=class{https=null;footballService=null;idMapping=null;constructor(t,e,i){this.idMapping=i,this.https=e,this.footballService=new wt(t)}getPlayersIdMapping=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.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 gi({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=Yt(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 Ut=class{https=null;idMapping=null;footballService=null;constructor(t,e,i){this.https=e,this.idMapping=i,this.footballService=new wt(t)}getMatchesIdMapping=async(t,e)=>{try{if(t){if(t=new Rt(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 Rt({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=Yt(t);i.sort((r,o)=>r.localeCompare(o));let a=await this.getMatchesWithNativeIds(Array.from(i));if(i.length!==a.length){let r=new Rt({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 hn=class{https=null;idMapping=null;constructor(t,e){this.https=t,this.idMapping=e}searchIdMapping=async(t,e)=>{try{if(t=new $r(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 nt=class{errorHandlingModel=null;constructor(t){this.errorHandlingModel=t}throwException=(t,e,i)=>{throw this.errorHandlingModel==="standard"?new m(t,e,i):new f(t,e,i)}};var fn=class extends nt{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 Mi=class{countriesFacade=null;competitionsFacade=null;teamsFacade=null;playerFacade=null;matchFacade=null;searchFacade=null;validator=null;constructor(t,e,i,a){this.countriesFacade=new ln(e,i,a),this.competitionsFacade=new pn(e,i,a),this.teamsFacade=new mn(t,i,a),this.playerFacade=new Gt(t,i,a),this.matchFacade=new Ut(t,i,a),this.searchFacade=new hn(i,a),this.validator=new fn(t)}getCountries=async t=>this.countriesFacade.getCountriesWithIdMapping(t);getCompetitions=async(t,e)=>this.competitionsFacade.getCompetitionsIdMapping(t,e);getCompetitionById=async(t,e)=>this.competitionsFacade.getCompetitionByIdIdMapping(t,e);getTopCompetitions=async t=>this.competitionsFacade.getTopCompetitionsIdMapping(t);getCompetitionsMapWithNativeIds=async t=>await this.competitionsFacade.getCompetitionsMapWithNativeIds(t);getTeams=async(t,e)=>this.teamsFacade.getTeamsIdMapping(t,e);getTeamById=async(t,e)=>this.teamsFacade.getTeamByIdIdMapping(t,e);getTopTeams=async t=>this.teamsFacade.getTopTeamsIdMapping(t);getNextMatchForTeam=async(t,e)=>this.teamsFacade.getNextMatchForTeamIdMapping(t,e);getPrevMatchForTeam=async(t,e)=>this.teamsFacade.getPrevMatchForTeamIdMapping(t,e);getTeamsMapWithNativeIds=async t=>await this.teamsFacade.getTeamsMapWithNativeIds(t);getPlayers=async(t,e)=>this.playerFacade.getPlayersIdMapping(t,e);getPlayerById=async(t,e)=>this.playerFacade.getPlayerIdMapping(t,e);getTopPlayers=async t=>this.playerFacade.getTopPlayersIdMapping(t);getNextMatchForPlayer=async(t,e)=>this.playerFacade.getNextMatchForPlayerIdMapping(t,e);getPrevMatchForPlayer=async(t,e)=>this.playerFacade.getPrevMatchForPlayerIdMapping(t,e);getPlayersMapWithNativeIds=async t=>this.playerFacade.getPlayersMapWithNativeIds(t);getMatches=async(t,e)=>this.matchFacade.getMatchesIdMapping(t,e);getMatchesMapWithNativeIds=async t=>this.matchFacade.getMatchesMapWithNativeIds(t);getMatchById=async(t,e)=>this.matchFacade.getMatchIdMapping(t,e);search=async(t,e)=>this.searchFacade.searchIdMapping(t,e);getTeamForm=async(t,e,i)=>{this.validator.validateTeamFormArguments(t,e);let a=e?.direction||"ltr",r={teamIds:[t],competitionIds:e&&e.competitionId?[e.competitionId]:null,status:"finished",limit:e?.limit||5,sortField:"date",sortOrder:"desc"},o=await this.matchFacade.getMatchesIdMapping(r,i),n={teamId:t,matches:[]};if(n.matches=o.data.map(l=>{let p=l.homeTeam.id===t,c=l.scores.ftScore.homeGoals??0,u=l.scores.ftScore.awayGoals??0,d;return p?d=c>u?"W":c<u?"L":"D":d=u>c?"W":u<c?"L":"D",{matchModel:l,isHomeGame:p,result:d}}),a==="ltr"){let l=Array.from(n.matches);n.matches=l.reverse()}return n}};var H=class{countriesFromResponse=t=>{if(t)return t.map(e=>this.countryFromResponse(e))};countryFromResponse=t=>{try{if(t){let e=new Er;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 Gr;return e.id=t.id,e.country=this.countryRemapper.countryFromResponse(t.country),e.gender=t.gender,e.assets=t.assets,e.code=t.code,e.national=t.national,e.fullName=t.full_name,e.shortName=t.short_name,e.name=t.name,e.isDeleted=t.is_deleted,e.undecided=t.undecided,e}catch(e){throw console.warn("There was a problem remapping teams response",e),e}}};var gn=class{countryRemapper=null;teamBasicRemapper=null;constructor(){this.countryRemapper=new H,this.teamBasicRemapper=new W}fromResponse(t){try{let e=new Sr;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 yn=class{countryRemapper=null;constructor(){this.countryRemapper=new H}fromResponse(t){try{let e=new Br;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 bn=class{countryRemapper=null;competitionRemapper=null;playerRemapper=null;constructor(){this.countryRemapper=new H,this.competitionRemapper=new X,this.playerRemapper=new yn}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.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 wi=class{fromResponse(t){try{let e=new Ar;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 Mn=class{teamRemapper=null;competitionRemapper=null;scoresRemapper=null;constructor(){this.teamRemapper=new W,this.competitionRemapper=new X,this.scoresRemapper=new wi}fromResponse(t){try{let e=new Rr;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 wn=class{fromResponse(t){try{let e=new Cr;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 Ii=class{fromResponse(t){try{let e=new kr;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 In=class{playerRemapper=null;constructor(){this.playerRemapper=new Ii}fromResponse(t){try{let e=new Re;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 Pn=class{playerRemapper=null;constructor(){this.playerRemapper=new Ii}fromResponse(t){try{let e=new Or;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 _n=class{fromResponse(t){try{let e=new xr;return e.playerId=t.player_id,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 Tn=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 In,this.scoresMapper=new wi,this.statsMapper=new wn,this.timelineMapper=new Pn,this.playerStatsMapper=new _n}fromResponse(t){try{let e=new vr;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 Re,e}catch(e){throw console.warn("There was a problem remapping the match response",e),e}}};var Fn=class{countryRemapper=null;constructor(){this.countryRemapper=new H}fromResponse(t){try{let e=new Nr;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 Pi=class{countryRemapper=null;teamRemapper=null;constructor(){this.countryRemapper=new H,this.teamRemapper=new W}fromResponse(t){try{let e=new Lr;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 Sn=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 Dr;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 En=class{teamRemapper=null;playerRemapper=null;competitionremapper=null;constructor(){this.teamRemapper=new W,this.playerRemapper=new Pi,this.competitionremapper=new X}fromResponse(t){try{let e=new Hr;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 Rn=class{remapMetaProp=t=>{let e=new O;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 vn=class{remapPlayersPoints=t=>{let e=new Pr;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 Tr;return e.playerId=t.player_id,e.points=t.points,e.rank=t.rank,e};remapPlayerDetailedStats=t=>{let e=new br;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 _r;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 Se;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 Ee;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 lt=class extends v{limitIds=200;countryRemapper=null;competitionBasicRemapper=null;competitionFullRemapper=null;teamBasicRemapper=null;teamFullRemapper=null;matchBasicRemapper=null;matchFullRemapper=null;playerBasicRemapper=null;playerFullRemapper=null;topPlayerRemapper=null;searchRemapper=null;footballMetaRemapper=null;fantasyRemapper=null;footballService=null;constructor(t){super(t,C(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 gn,this.teamBasicRemapper=new W,this.teamFullRemapper=new bn,this.matchBasicRemapper=new Mn,this.matchFullRemapper=new Tn,this.playerBasicRemapper=new Pi,this.playerFullRemapper=new Sn,this.topPlayerRemapper=new Fn,this.searchRemapper=new En,this.footballMetaRemapper=new Rn,this.footballService=new wt(t),this.fantasyRemapper=new vn}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=ri(t.competitionIds,this.limitIds);for(let l of o){t.competitionIds=l;let p=`/competitions${this.apiSignInUrl}${t.constructFilterUrl()}`;e&&(p+=`&disable_cache=${i}`);let c=await this.fetchWithoutAuth(p,a);r.push(c.data.map(u=>this.competitionBasicRemapper.fromResponse(u)))}return Array.prototype.concat.apply([],r)}else{let r=`/competitions${this.apiSignInUrl}`;return t&&(r+=`${t.constructFilterUrl()}`),e&&(r+=`&disable_cache=${i}`),(await this.fetchWithoutAuth(r,a)).data.map(n=>this.competitionBasicRemapper.fromResponse(n))}};getCompetitionById=async(t,e)=>{let i=`/competitions/${t}${this.apiSignInUrl}`,a="There was a problem with football competition by ID request",r=Date.now();e&&(i+=`&disable_cache=${r}`);let o=await this.fetchWithoutAuth(i,a);return this.competitionFullRemapper.fromResponse(o.data)};getTopCompetitions=async t=>{let e="There was a problem with top football competitions request",i=`/competitions/top${this.apiSignInUrl}`,a=Date.now();return t&&(i+=`&disable_cache=${a}`),(await this.fetchWithoutAuth(i,e)).data.map(o=>this.competitionBasicRemapper.fromResponse(o))};getTeams=async(t,e)=>{let i=Date.now(),a="There was a problem with football teams request";if(t&&t.teamIds&&t.teamIds.length>this.limitIds){let r=[],o=ri(t.teamIds,this.limitIds);for(let l of o){t.teamIds=l,t.limit=l.length;let p=`/teams${this.apiSignInUrl}${t.constructFilterUrl()}`;e&&(p+=`disable_cache=${i}`);let c=await this.fetchWithoutAuth(p,a);r.push(c.data.map(u=>this.teamBasicRemapper.fromResponse(u)))}return Array.prototype.concat.apply([],r)}else{let r=new Nt,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=ri(t.playerIds,this.limitIds);for(let p of o){t.playerIds=p,t.limit=p.length;let c=`/players${this.apiSignInUrl}${t.constructFilterUrl()}`;e&&(c+=`&disable_cache=${i}`);let u=await this.fetchWithoutAuth(c,a);r.push(u.data.map(d=>this.playerBasicRemapper.fromResponse(d)))}let n=Array.prototype.concat.apply([],r),l=new Nt;return l.data=n,l}else{let r=new Nt,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 Nt,a="There was a problem with football matches request";if(t&&t.matchIds&&t.matchIds.length>this.limitIds){let r=[],o=ri(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+=h());let u=await this.fetchWithoutAuth(c,a);r.push(u.data.map(d=>this.matchBasicRemapper.fromResponse(d)))}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+=h());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 Cn=class{idMapping=null;idSchema=null;native="native";footballFacade=null;constructor(t,e,i){this.idMapping=i,this.idSchema=t.idSchema,this.footballFacade=e}remapProfileStats=async t=>{if(!t.predictions)return t;let{successRates:e,predictions:i}=t,a={competition:this.getIdsKeys(e.byFootballCompetition,i.single.breakdown.footballCompetitions),team:this.getIdsKeys(e.byFootballTeam,i.single.breakdown.footballTeams)};if(Object.values(a.competition).length){let r=JSON.parse(JSON.stringify(t.successRates.byFootballCompetition)),o=await this.getEntitiesMap(a.competition,"competition"),n=await this.setSuccessRatesModels(r,o);t.successRates.byFootballCompetition=n,i.single.breakdown.footballCompetitions=this.reconstructBreakdown(i.single.breakdown.footballCompetitions,o)}if(Object.values(a.team).length){let r=JSON.parse(JSON.stringify(t.successRates.byFootballTeam)),o=await this.getEntitiesMap(a.team,"team"),n=await this.setSuccessRatesModels(r,o);t.successRates.byFootballTeam=n,i.single.breakdown.footballTeams=this.reconstructBreakdown(i.single.breakdown.footballTeams,o)}return t};setSuccessRatesModels=async(t,e)=>{let i;return this.reconstructRecords(t,i,e)};getEntitiesMap=async(t,e)=>{switch(e){case"competition":return await this.footballFacade.getCompetitionsMapWithNativeIds(t);case"team":return await this.footballFacade.getTeamsMapWithNativeIds(t)}};reconstructRecords=(t,e,i)=>t&&Object.keys(t).length?(Object.keys(t).forEach(a=>{let r=i.get(a);e={...e,[r.id]:t[a]},e[r.id].model=r}),e):t;reconstructBreakdown=(t,e)=>t.length?t.map(i=>{let a=e.get(i.entityId);return i.entityId=a.id,i.model=a,i}):t;getIdsKeys=(t,e)=>{let i=Object.keys(t);if(e.length){let a=e.map(r=>r.entityId);return Array.from(new Set([...i,...a]))}return i};remapInterestsToIdSchema=async t=>{if(this.idSchema!==this.native)if(t&&t.length>0){let e={},i={},a=t.filter(l=>l.source.toLocaleUpperCase()==="FOOTBALL"),r=t.filter(l=>l.source.toLocaleUpperCase()!=="FOOTBALL");a.forEach(l=>{e.hasOwnProperty(l.type)||(e[l.type]=[],i[l.type]=[]),e[l.type].push(l.id),i[l.type].push(l)});let o=await this.remapIdsObj(e,this.native,this.idSchema),n=[];for(let[l,p]of Object.entries(i))p.forEach((c,u)=>{c.id=o[l][u],n.push(c)});return n.concat(r)}else return t;return t};remapInterestToNative=async t=>{if(this.idSchema!==this.native&&t.source.toLocaleUpperCase()==="FOOTBALL"){let e={},{id:i,type:a}=t;e[a]=[i];let r=await this.remapIdsObj(e,this.idSchema,this.native);return t.id=r[a][0],t}return t};inquiryCustomInterests=(t,e)=>{let i=[];return t&&t.length>0&&(i=t.filter(a=>a.source.toLocaleUpperCase()==="CUSTOM"),e)?i.map(a=>{let r=new ps;return r.id=a.id,r.type=a.type,r.source=a.source,r.favourite=a.favourite,r}):i};remapInterests=async t=>{let i=this.inquiryCustomInterests(t,!1);if(i&&i.length>0){let a=t.filter(o=>o.source.toLocaleUpperCase()!=="CUSTOM"),r=await this.remapInterestsToIdSchema(a);return i.forEach(o=>r.push(o)),r}return await this.remapInterestsToIdSchema(t)};showFullInterests=async t=>{let e=[];if(t&&t.length>0){let a=this.inquiryCustomInterests(t,!0);e.push(a);let r=t.filter(c=>c.source.toLocaleUpperCase()!=="CUSTOM"),{competitionsMap:o,teamsMap:n,playersMap:l}=await this.getInterestsEntitiesMap(r),p=r.map(c=>{let u=null;if(c.source.toLocaleUpperCase()==="FOOTBALL"){if(c.type==="competition")return u=o.get(c.id),u&&(c.id=u.id),c.model=u,c;if(c.type==="team")return u=n.get(c.id),u&&(c.id=u.id),c.model=u,c;if(c.type==="player")return l?(c.model=l[c.id],c.id=l[c.id].id):c.model=u,c}else return c.model=u,c});return e.push(p),e.flat()}return e};getInterestsEntitiesMap=async t=>{let e=[],i=[],a=[],r=new Map,o=new Map,n=null;return t.forEach(l=>{l.type==="competition"&&l.source.toLocaleUpperCase()==="FOOTBALL"?e.push(l.id):l.type==="team"&&l.source.toLocaleUpperCase()==="FOOTBALL"?i.push(l.id):l.type==="player"&&l.source.toLocaleUpperCase()==="FOOTBALL"&&a.push(l.id)}),e.length&&(r=await this.footballFacade.getCompetitionsMapWithNativeIds(e)),i.length&&(o=await this.footballFacade.getTeamsMapWithNativeIds(i)),a.length&&(n=await this.footballFacade.getPlayersMapWithNativeIds(a)),{competitionsMap:r,teamsMap:o,playersMap:n}};remapIdsObj=async(t,e,i)=>await this.idMapping.idMappingFacade.getEntitiesByIds(t,e,i)};var An=class{idMapping=null;profileOperations=null;constructor(t,e){this.idMapping=new S(t),this.profileOperations=new Cn(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 di(t),this.activityHttps=new si(t),this.footballHttps=new lt(t),this.idMapping=new S(t),this.localCache=new st().createLocalCacheInstance(t.idSchema),this.footballFacade=new Mi(t,this.localCache,this.footballHttps,this.idMapping),this.profileFacade=new yt(this.localCache,this.profileHttps,this.activityHttps,t.errorHandlingMode),this.idsRemapper=new An(t,this.footballFacade),this.ownProfileBuilder=new sn(t,this.idsRemapper,this.localCache,this.profileHttps,this.activityHttps),this.profileBuilder=new nn(this.idsRemapper,this.localCache,this.profileHttps,this.activityHttps)}getOwn=()=>this.ownProfileBuilder;getById=t=>this.profileBuilder.setId(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 On=class extends _{};var vc=(r=>(r.LIKE="like",r.DISLIKE="dislike",r.SHARE="share",r.COMMENT="comment",r.PREDICTION_MADE="prediction_made",r))(vc||{});var Cc=(a=>(a.CORRECT="CORRECT",a.INCORRECT="INCORRECT",a.PARTIALLY_CORRECT="PARTIALLY_CORRECT",a.NOT_VERIFIED="NOT_VERIFIED",a))(Cc||{});var xn=(i=>(i.ONE="1",i.X="x",i.TWO="2",i))(xn||{}),Ln=(i=>(i.ONE_X="1x",i.X_TWO="x2",i.ONE_TWO="12",i))(Ln||{}),Dn=(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))(Dn||{});var Bn=class extends nt{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 Xa);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 Nn=class{https=null;validator=null;profile=null;constructor(t){this.https=new ci(t),this.profile=new U(t),this.validator=new Bn(t.errorHandlingMode)}getGames=async(t,e)=>(t&&(t=new Ya(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 ja(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 On(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 kn=class{facade=null;constructor(t){this.facade=new Nn(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 Gn=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 Ct;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 ve;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 Ce;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 ao;return e.groupId=t.group_id,e.averagePoints=t.average_points,e.highestPoints=t.highest_points,e}};var Un=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 O;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 io;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 os;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 ar;a.templateId=i.template_id,a.challengeId=i.private_league_id,a.position=i.position,a.points=i.points,e.push(a)}),e}};var Vn=class{entityId=null;entityType=null};var Hn=class{primaryColor=null;secondaryColor=null;contentColor=null;backgroundColor=null;borderColor=null;additionalColor=null};var $n=class{mainLogo=null;mobileLogo=null;backgroundImage=null;mobileBackgroundImage=null;additionalImage=null};var qn=class{colors=null;urls=null;images=null};var Wn=class{primaryUrl=null;secondaryUrl=null;privacyPolicyUrl=null;termsAndConditionsUrl=null;additionalUrl=null};var pt=class{remapBranding=t=>{let e=new qn;return t.colors&&(e.colors=new Hn,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 Wn,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 $n,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 zn=class extends pt{remapResponse=t=>{let e=[];return t.forEach(i=>{let a=new At;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 ro;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 eo;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 Vn;return i.entityId=e.entity_id,i.entityType=e.entity_type,i});remapGroups=t=>t.map(e=>{let i=new oo;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 so;return e.fromDate=t.from_date,e.toDate=t.to_date,e.matchIds=t.match_ids,e}};var Qn=class{remapHighestSuccessRate=t=>t.map(e=>{let i=new Zr;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 It=class extends v{templateRemapper=null;leaderboardRemapper=null;rankingsRemapper=null;highestSuccessRateRemapper=null;constructor(t){super(t,C(t.environment,"loyalty")),this.templateRemapper=new zn,this.leaderboardRemapper=new Gn,this.rankingsRemapper=new Un,this.highestSuccessRateRemapper=new Qn}getTemplates=async(t,e)=>{let i=t?`/leaderboard/templates/${this.apiSignInUrl}${t.constructFiltersUrl()}`:`/leaderboard/templates/${this.apiSignInUrl}`;i+=g(e)?h():"";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}${h()}`:`/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}${h()}`:`/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}${h()}`:`/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+=`${h()}`);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+=`${h()}`);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}${h()}`:`/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 Kn=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 es;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 We;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 ts;return e.profileId=t.profile_id,e.leagueId=t.league_id,e.message=t.message,e};remapToAcceptChallenge=t=>{let e=new Ja;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 O;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 is;return i.predictionId=e.prediction_id,i.profileId=e.profile_id,i})};var _i=class{remapToDiscussions=t=>(t.meta=this.remapToMeta(t.meta),t.data=t.data.map(e=>this.remapToDiscussionById(e)),t);remapToDiscussionById=t=>{let e=new rr;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 lr,a=new pr;return i.meta=this.remapToPostMeta(t.meta),i.data=t.data.map(r=>this.remapToPostByIdBasic(r)),a.meta=this.remapToPostMeta(t.meta),a.data=t.data.map(r=>this.remapToPostByIdFull(r)),e==="basic"?i:a};remapToPosts=t=>{let e=new cr;return e.meta=this.remapToMeta(t.meta),e.data=t.data.map(i=>this.remapToPostByIdBasic(i)),e};remapToPostMeta=t=>{let e=new Et;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 Te;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 or;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 nr;return i.id=e.id,i.postsCount=e.posts_count,i});remapReactionsPost=t=>{let e=new ur;return e.type=t.type,e.userIds=t.user_ids,e.reactionCount=t.reaction_count,e};remapVersionsPost=t=>{let e=new mr;return e.content=t.content,e.updatedAt=t.updated_at,e};remapReportPost=t=>{let e=new dr;return e.userId=t.user_id,e.reason=t.reason,e.reasonDetails=t.reason_details,e}};var Ti=class extends v{remapper=null;discussionsRemapper=null;discussionsBaseURL=null;constructor(t){super(t,C(t.environment,"privateLeagues")),this.discussionsBaseURL=C(t.environment,"discussions"),this.remapper=new Kn,this.discussionsRemapper=new _i}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+=h());let o=`There was a problem getting ${e==="PRIVATE_LEAGUE"?"private league":"challenge"}`,n=await this.fetchWithAuth(a,o);return this.remapper.remapToPrivateLeagueById(n.data)};getMyLeagues=async(t,e)=>{let i="/leagues"+this.apiSignInUrl+t.constructFiltersUrl(),r=`There was a problem getting user's ${e==="PRIVATE_LEAGUE"?"private leagues":"challenges"}`;return(await this.fetchWithAuth(i,r)).data.map(n=>this.remapper.remapToMyPrivateLeagues(n))};delete=async(t,e)=>{let i=`/leagues/${t}`+this.apiSignInUrl,r=`There was a problem deleting ${e==="PRIVATE_LEAGUE"?"private league":"challenge"}`,o="DELETE";return await this.fetchWithAuth(i,r,o),!0};invite=async(t,e)=>{let i=`/membership/invite/${t}`+this.apiSignInUrl,a=`There was a problem inviting the following users: ${e.join(",")}`,r="POST",o={profiles:e};return(await this.fetchWithAuth(i,a,r,o)).data};deleteInvitation=async(t,e)=>{let i=`/membership/invite/${t}`+this.apiSignInUrl,a=`There was a problem deleting invitation for the following users: ${e.join(",")}`,r="DELETE",o={profiles:e};return await this.fetchWithAuth(i,a,r,o),!0};accept=async(t,e,i)=>{let a=`/membership/accept/${t}`+this.apiSignInUrl+`&accept=${e?"ACCEPT":"REJECT"}`,o=`There was a problem ${e?"accepting":"rejecting"} invitation for ${i==="PRIVATE_LEAGUE"?"private league":"challenge"}: ${t}`,n="POST",l=await this.fetchWithAuth(a,o,n);return i==="PRIVATE_LEAGUE"?this.remapper.remapToAcceptPrivateLeague(l.data):this.remapper.remapToAcceptChallenge(l.data)};ban=async(t,e)=>{let i=`/membership/ban/${t}`+this.apiSignInUrl,a=`There was a problem banning the following users: ${e.join(",")}`,r="POST",o={profiles:e};return(await this.fetchWithAuth(i,a,r,o)).data};unban=async(t,e)=>{let i=`/membership/unban/${t}`+this.apiSignInUrl,a=`There was a problem unbanning the following users: ${e.join(",")}`,r="POST",o={profiles:e};return(await this.fetchWithAuth(i,a,r,o)).data};join=async t=>{let e="/membership/join"+this.apiSignInUrl+`&invitation_code=${t}`,i="There was a problem joining league",a="POST",r=await this.fetchWithAuth(e,i,a);return this.remapper.remapToAcceptPrivateLeague(r.data)};leave=async(t,e)=>{let i=`/membership/leave/${t}`+this.apiSignInUrl,r=`There was a problem leaving the following ${e==="PRIVATE_LEAGUE"?"league":"challenge"}: ${t}`,o="POST";return(await this.fetchWithAuth(i,r,o)).data};getInvitations=async(t,e)=>{let i="/membership/invitations"+this.apiSignInUrl+e.constructMainFiltersUrl(),r=`There was a problem getting invitations for ${t==="PRIVATE_LEAGUE"?"leagues":"challenges"}`,o=await this.fetchWithAuth(i,r);return this.remapper.remapToPrivateLeagues(o)};getReportedPosts=async(t,e)=>{let i=`/discussions/${t}/posts/reported${this.apiSignInUrl}`,a=`There was a problem fetching posts for the following: ${t}`;e&&(i+=e.constructMainFiltersUrl());let r=await this.fetchWithAuthNewBaseURL(this.discussionsBaseURL,i,a);return this.discussionsRemapper.remapToPostsForDiscussion(r,"full")};getPredictions=async(t,e)=>{let i=`/leagues/${t}/predictions`+this.apiSignInUrl,a=`There was a problem getting predictions for private league: ${t}`;e&&(i+=e.constructFiltersUrl());let r=await this.fetchWithAuth(i,a);return this.remapper.remapPredictions(r)};moderatePost=async(t,e)=>{let i=`/posts/${t}/admin/moderate${this.apiSignInUrl}`,a=`There was a problem moderating the following post: ${t}`,r="POST",o={moderation_reason:e},n=await this.fetchWithAuthNewBaseURL(this.discussionsBaseURL,i,a,r,o);return this.discussionsRemapper.remapToPostByIdBasic(n.data)}};var Fi=class{createRequestBodyFromParam=(t,e)=>{let i=e==="PRIVATE"?new ss:new Za;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 ns:new tr;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 Y=class{https=null;idMapping=null;localCache=null;footballFacade=null;constructor(t){this.https=new lt(t),this.idMapping=new S(t),this.localCache=new st().createLocalCacheInstance(t.idSchema),this.footballFacade=new Mi(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 jn=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 at)e.market=t.market,e.prediction=t.prediction.value,e.player_id=t.prediction.playerId;else if(t instanceof Ve||t instanceof He)e.market=t.market,e.prediction=t.prediction.value;else if(t instanceof Ot){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 Ge;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,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 Ue;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 Op=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}}},Pt=Op;J(Pt,"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"),J(Pt,"createDoubleChanceResult",t=>t?.ftScore?.homeGoals>t?.ftScore?.awayGoals?["1x","12"]:t?.ftScore?.homeGoals===t?.ftScore?.awayGoals?["1x","x2"]:["x2","12"]),J(Pt,"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"}}),J(Pt,"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))),J(Pt,"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 Op.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])}),Op.transformPlayerMarketResult(o)}),J(Pt,"transformPlayerMarketResult",t=>t.map(e=>({playerId:e.id,playerModel:e})));var _t=class{footballHttps=null;idMapping=null;matchFacade=null;playerFacade=null;profileNamespace=null;constructor(t,e){this.footballHttps=new lt(t),this.idMapping=e,this.matchFacade=new Ut(t,this.footballHttps,e),this.playerFacade=new Gt(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=Yt(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=ec.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(ht.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 A,r[a][n]):r[a][i]}else if(ht.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 ge){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 fe||t instanceof he){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 Mt||a instanceof xt||a instanceof bt||a instanceof je?(a.fixtures.forEach(r=>e.push(r.matchId)),a instanceof bt&&a.fixtures.forEach(r=>{r.prediction.playerId&&r.prediction.playerId!=="OWN_GOAL"&&i.push(r.prediction.playerId)})):a instanceof kt&&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 Mt||n instanceof xt||n instanceof bt?(n.fixtures.forEach(l=>{this.handleMatchModel(r,l),n instanceof bt&&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 kt&&(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 rt(e),e;if(e&&!i)return e.type=t,e=new rt(e),e;if(!e&&i){let a={type:t,gameIds:i};return a=new rt(a),a}else{let a={type:t};return a=new rt(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 xt&&(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 Ue;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=zp,t=new G(t);else{let a={status:zp};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=>ht.includes(p.market)&&!p.result.includes("OWN_GOAL")?[...p.result]:[]).flat(),o=await this.matchFacade.getMatchesMapWithNativeIds([a]);return r.length&&(i=await this.playerFacade.getPlayersMapWithNativeIds(r)),t.results=t.results.map(p=>{if(p.matchModel=o[p.matchId]?o[p.matchId]:null,p.playerModels&&Object.keys(i).length&&p.result.forEach(u=>{let d=i[u];p.playerModels.push(d)}),this.idMapping.idSchema!=="native"&&(this.remapMatchIdForResultsMarkets(o,p),p.playerModels&&Object.keys(i).length)){let c=p.result;p.result=c.map(u=>i[u].id)}return p}),t;case"TOP_X":let n=t.results.map(p=>p.matchId),l=await this.matchFacade.getMatchesMapWithNativeIds(n);if(t.results=t.results.map(p=>(p.matchModel=l[p.matchId]?l[p.matchId]:null,this.idMapping.idSchema!=="native"&&this.remapMatchIdForResultsMarkets(l,p),p)),t.tieBreakers.goldenGoals.length){let p=t.tieBreakers.goldenGoals.map(u=>u.playerId),c=await this.playerFacade.getPlayersMapWithNativeIds(p);t.tieBreakers.goldenGoals=t.tieBreakers.goldenGoals.map(u=>(u.matchModel=l[u.matchId],u.playerModel=c[u.playerId],this.idMapping.idSchema!=="native"&&(u.matchId=l[u.matchId].id,u.playerId=c[u.playerId].id),u))}return t}};completeContestWinners=async t=>{if(t.userList&&t.userList.length){let e=t.userList.map(a=>a.profileId),i=await this.profileNamespace.getByIds(e);t.userList.forEach(a=>{let r=i.filter(o=>o.id===a.profileId)[0];delete r.interests,a.profileModel=r})}return t};handleMatchModel=(t,e)=>{t[e.matchId]?(e.matchModel=t[e.matchId],delete e.matchModel.availableMarkets,e.matchId=e.matchModel.id):(e.matchModel=null,this.idMapping.idSchema!=="native"&&this.idMapping.idMappingFacade.getEntityById(e.matchId,"match","native").then(i=>{e.matchId=i[D[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[D[this.idMapping.idSchema]]})};deleteUnexpectedProperties=t=>(t.status&&(console.warn(Gp.UNEXPECTED_STATUS_PROP),delete t.status),t.type&&(console.warn(Gp.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 Yo;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)),Pt.createMatchMarketsResultsModel(e,a)}};var Si=class{fixturesRemapper=null;footballHttps=null;matchFacade=null;playerFacade=null;predictorService=null;constructor(t,e){this.footballHttps=new lt(t),this.matchFacade=new Ut(t,this.footballHttps,e),this.playerFacade=new Gt(t,this.footballHttps,e),this.predictorService=new _t(t,e),this.fixturesRemapper=new jn(this.matchFacade,this.playerFacade,this.predictorService)}remapRequestBody=t=>{if(t instanceof Fe)return t;let e={};return e.game_instance_id=t.gameInstanceId,e.fixtures=t.fixtures.map(i=>this.fixturesRemapper.remapFixturesRequest(i)),t instanceof Xe&&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 bi,c=[];p.id=l.id,p.gameInstanceId=l.game_instance_id,p.gameType=l.game_type,p.wager=l.wager,p.totalFixtures=l.total_fixtures,p.settledFixtures=l.settled_fixtures,p.userId=l.user_id,p.templateId=l.template_id,p.groupId=l.group_id,p.profileLastUpdatedAt=l.profile_last_updated_at,l.fixtures.forEach(u=>{let d=new Ge;u.target?d.market=this.predictorService.convertMarketForResponseModel(u.market,u.target):d.market=u.market,d.matchId=n[u.match_id].id,d.matchType=u.match_type,d.matchModel=n[u.match_id],delete d.matchModel.availableMarkets,u.prediction!==void 0?d.prediction.value=u.prediction:u.goals_home!==void 0&&u.goals_away!==void 0&&(d.prediction.value=u.goals_home.toString()+":"+u.goals_away.toString()),d.prediction.playerId=u.player_id?u.player_id:null,d.prediction.playerId&&d.prediction.playerId!==e&&(d.prediction.playerModel=r[d.prediction.playerId],d.prediction.playerId=r[d.prediction.playerId].id),d.result=this.fixturesRemapper.remapResult(u.result),c.push(d)}),p.fixtures=c,p.status=l.status,l.tiebreaker?p.tiebreaker.goldenGoal=l.tiebreaker.golden_goal:p.tiebreaker=null,p.points=l.points,p.createdAt=l.created_at,p.updatedAt=l.updated_at,o.push(p)}),o}return t};remapResponseObjBody=async t=>{let e=new bi;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 Jo;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 Xn=class{remapPredictions=null;constructor(t,e){this.remapPredictions=new Si(t,e)}remapResponse=t=>{let e=new Zo;return e.matchId=t.match_id,e.matchType=t.match_type,e.predictions=this.remapPredictions.remapPredictionModel(t.predictions),e}};var Yn=class extends pt{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 Mt;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 ds;return e.matchId=t.match_id,e.matchType=t.match_type,e.market=t.market,e.matchStatus.type=t.match_status?t.match_status.type:null,e.matchStatus.subType=t.match_status?t.match_status.sub_type:null,e};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 xt;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 hs;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 bt;return e.id=t.id,e.title=t.title,e.description=t.description,e.type=t.type,e.status=t.status,e.authRequirement=t.auth_requirement||null,e.predictionsCutoff=t.predictions_cutoff,e.scheduleOpenAt=t.schedule_open_at,e.fixtures=t.fixtures.map(i=>this.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 lo;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 kt;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 po;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 gs;return e.contestId=t.contest_id,e.contestType=t.contest_type,e.description=t.description,e.userList=t.user_list?t.user_list.map(i=>this.remapUserListWinners(i)):null,e};remapUserListWinners=t=>{let e=new ys;return e.position=t.position,e.profileId=t.profile_id,e.note=t.note,e.tags=t.tags,e};remapTieBreakers=t=>{let e={goldenGoals:[]};return e.goldenGoals=t.golden_goals.map(i=>({minute:i.minute,matchId:i.match_id,matchModel:null,playerId:i.player_id,playerModel:null,goalType:i.goal_type})),e};remapMarketsResults=t=>{let e=[];return t.forEach(i=>{let a={matchId:i.match_id,market:i.market,result:this.remapMarketResult(i.market,i.result),matchModel:null,playerModels:[],matchStatus:this.remapMarketsResultsMatchStatus(i.match_status)};e.push(this.deleteUnusefulField(a))}),e};remapMarketsResultsMatchStatus=t=>{let e=new et;return t&&(e.type=t.type,e.subType=t.sub_type),e};remapMarketResult=(t,e)=>{if(Zp.includes(t))return e[0];if(ht.includes(t))return e;if(e[0]==="true")return!0;if(e[0]==="false")return!1};deleteUnusefulField=t=>((!ht.includes(t.market)||this.isPlayerMarketWithNoResult(t.market,t.result))&&delete t.playerModels,t);isPlayerMarketWithNoResult=(t,e)=>ht.includes(t)&&e.length===0;remapResults=t=>{let e=new fs;return e.matchId=t.match_id,e.outcome=t.outcome,e};remapTiebreaker=t=>{let e=new dt;return e.goldenGoal=t.golden_goal,e};remapTimeTiebreaker=t=>{let e=new ut;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 Jn=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 ct=class extends v{predictionRemapper=null;matchSummaryRemapper=null;gamesRemapper=null;metaRemapper=null;constructor(t,e){super(t,C(t.environment,"predictor")),this.predictionRemapper=new Si(t,e),this.matchSummaryRemapper=new Xn(t,e),this.gamesRemapper=new Yn,this.metaRemapper=new Jn}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}${h()}`:`/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}${h()}`:`/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()}${h()}`:`/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}${h()}`:`/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}${h()}`:`/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()}${h()}`:`/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}${h()}`:`/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+=`${h()}`);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+=h());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 Vt=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(xn),o=Object.values(Dn),n=Object.values(Ln);if(e==="FT_1X2"||e==="HT_1X2"){if(r.includes(i))return new zo(t,e,i)}else if(e==="HT_FT"){if(o.includes(i))return new qo(t,i)}else if(e==="DOUBLE_CHANCE"){if(n.includes(i))return new Ho(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 Ot(t,e,i)}else if(e==="CORNERS_MATCH"){if(typeof i=="number")return new Go(t,i)}else if(e==="BOTH_TEAMS_SCORE"){if(this.isPredictionBoolean(i))return new No(t,i)}else if(e==="RED_CARD_MATCH"){if(this.isPredictionBoolean(i))return new jo(t,i)}else if(e==="PENALTY_MATCH"){if(this.isPredictionBoolean(i))return new Qo(t,i)}else if(ht.includes(e)){let l="OWN_GOAL";if(this.validatePlayerId(e,a),e===ki&&this.isPredictionBoolean(i)){let p=a&&a===l?l:a;return new at(t,e,i,p)}if(a&&this.isPredictionBoolean(i))return new at(t,e,i,a)}else if(Yp.includes(e)){if(this.isPredictionBoolean(i))return new He(t,e,i)}else if(Jp.includes(e)&&this.isPredictionBoolean(i))return new Ve(t,e,i);this.throwInvalidPredictionException(i,e)};validateFixtureFields=t=>{let e=Object.keys(t);e.forEach(a=>{kp.includes(a)||this.throwInvalidParamException([a])});let i=kp.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 dt)[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){ht.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!==ki&&(e||this.throwInvalidParamException([i]),typeof e!="string"&&this.throwInvalidType(i,"string"))};validateMarket=t=>{Object.values(Z).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=ic(t,e);throw this.errorHandlingMode==="default"?new f(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=ql(t),this.errorHandlingMode==="default"?new f(400,"INVALID_MARKET",i):new m(400,"INVALID_TYPE",i)};throwInvalidParamException=t=>{let e=rc(t);throw this.errorHandlingMode==="default"?new f(400,"INVALID_FIELD",e):new m(400,"INVALID_TYPE",e)};throwMissingFieldsException=(t,e)=>{let i=oc(t,e);throw this.errorHandlingMode==="default"?new f(400,"INVALID_FIELD",i):new m(400,"INVALID_TYPE",i)};throwInvalidType=(t,e)=>{let i=sc(t,e);throw this.errorHandlingMode==="default"?new f(400,"INVALID_TYPE",i):new m(400,"INVALID_TYPE",i)}};var Ei=class{predictorHttps=null;predictorService=null;idMapping=null;clientHttps=null;predictorValidator=null;errorHandlingMode=null;constructor(t){this.predictorValidator=new Vt(t.errorHandlingMode),this.idMapping=new S(t),this.predictorHttps=new ct(t,this.idMapping),this.predictorService=new _t(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 at&&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 at&&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 _(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 rt(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 f(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 Zn=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 Ht=class{matchQuizFacade=null;helpers=new Zn;constructor(t){this.matchQuizFacade=new Ei(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 tl=class extends pt{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 uo;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 fo;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 bo;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 Mo;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 Do;return i.questions=e.questions,i.correctAnswers=e.correct_answers,i});remapMetaPagination=t=>{let e=new gt;return e.itemsPerPage=t.items_per_page,e.nextPageStartsAfter=t.next_page_starts_after,e};remapClassicQuizLeaderboardMeta=t=>{let e=new De;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 xe;return e.classicQuizIds=t?.classic_quiz_ids||null,e};remapClassicQuizUserRanking=t=>{let e=new Po;return e.position=t.position,e.classicQuizId=t.classic_quiz_id,e.points=t.points,e};remapBasicClassicQuiz=t=>{let e=new Ae;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 mo;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 ho;return e.optionId=t.option_id,e.option=t.option,e.images=t.images,e.correct=t.correct,e};remapParticipationQuestions=t=>{let e=new go;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 Io;return e.position=t.position,e.profileId=t.profile_id,e.points=t.points,e};remapContext=t=>{let e=new Ne;return e.content=t.content,e.tags=t.tags?t.tags.map(i=>{let a=new ke;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 el=class extends pt{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 To;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 So;return e.eitherOrId=t.either_or_id,e.personalBest=t.personal_best,e.betterThan=t.better_than,e};remapEitherOrResults=t=>{let e=new xo;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 Eo;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 Be;return e.id=t.id,e.title=t.title,e.alternativeTitle=t.alternative_title,e.description=t.description,e.type=t.type,e.images=t.images,e.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 gt;return e.itemsPerPage=t.items_per_page,e.nextPageStartsAfter=t.next_page_starts_after,e};remapPoints=t=>{let e=new Fo;return e.correctSteps=t.correct_steps,e.score=t.score,e};remapResultsStandings=t=>{let e=new Lo;return e.userId=t.user_id,e.personalBest=t.personal_best,e};remapResultsBreakdown=t=>{let e=new Oo;return e.rangeStartInclusive=t.range_start_inclusive,e.rangeEndInclusive=t.range_end_inclusive,e.totalUsers=t.total_users,e};remapParticipationSteps=t=>{let e=new Ao;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 Ne;return e.content=t.content,e.tags=t.tags?t.tags.map(i=>{let a=new ke;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 Ri=class extends v{classicQuizRemapper=null;eitherOrRemapper=null;constructor(t){super(t,C(t.environment,"miniGames")),this.classicQuizRemapper=new tl,this.eitherOrRemapper=new el}getClassicQuizzes=async(t,e)=>{let i=`/classic-quizzes${this.apiSignInUrl}`;t&&(i+=t.constructMainFiltersUrl()),i+=g(e)?h():"";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+=h());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=>{let e=`/classic-quizzes/rank${this.apiSignInUrl}`;t&&(e+=`${t.constructMainFiltersUrl()}`);let i="There was a problem with fetching classic quizzes leaderboard",a=await this.fetchWithoutAuth(e,i);return this.classicQuizRemapper.remapClassicQuizzesLeaderboard(a)};getClassicQuizzesUserRanking=async(t,e)=>{let i=`/classic-quizzes/users/${t}/rank${this.apiSignInUrl}`;e&&(i+=`${e.constructMainFiltersUrl()}`);let a="There was a problem with fetching user's rankings for classic quizzes",r=await this.fetchWithoutAuth(i,a);return this.classicQuizRemapper.remapClassicQuizUserRankings(r)};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+=h());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)?h():"";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+=h());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)?h():""}`,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 $t=class extends nt{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 S(t),this.validator=new $t(t),this.profile=new U(t),this.football=new Y(t),this.https=new Ri(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 vo;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 al=class{https=null;service=null;activityService=null;idSchema=null;constructor(t){this.https=new Ri(t),this.service=new il(t),this.activityService=new ft(t),this.idSchema=t.idSchema}getClassicQuizzes=async(t,e,i)=>{t&&(t=new co(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 yo(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=>{t&&(t=new wo(t));let e=await this.https.getLeaderboardForClassicQuizzes(t);return e.data=await this.service.setProfileModelsForClassicQuizLeaderboards(e.data),e};getClassicQuizzesUserRanking=async(t,e)=>{e&&(e=new Le(e));let i=await this.https.getClassicQuizzesUserRanking(t,e),a=i.data.map(o=>o.classicQuizId),r=await this.getClassicQuizzes({classicQuizIds:a});return i.data=i.data.map(o=>{let n=r.data.find(l=>l.id===o.classicQuizId)||null;return{...o,classicQuizModel:n}}),i};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 _o(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 qt=class{facade=null;constructor(t){this.facade=new al(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=>await this.facade.getLeaderboardForClassicQuizzes(t);getClassicQuizzesUserRanking=async(t,e)=>await this.facade.getClassicQuizzesUserRanking(t,e);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 vi=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 Vt(t.errorHandlingMode),this.predictorHttps=new ct(t,e),this.predictorService=new _t(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 rt(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 rt(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 Xe(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 f(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 rl=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 Wt=class{topXFacade=null;idMapping=null;helpers=new rl;constructor(t){this.idMapping=new S(t),this.topXFacade=new vi(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 ol=class{idMappingService=null;profileNamespace=null;footballNamespace=null;topXNamespace=null;matchQuizNamespace=null;miniGamesNamespace=null;errorHandlingMode=null;constructor(t){this.idMappingService=new S(t),this.profileNamespace=new U(t),this.footballNamespace=new Y(t),this.topXNamespace=new Wt(t),this.matchQuizNamespace=new Ht(t),this.miniGamesNamespace=new qt(t),this.errorHandlingMode=t.errorHandlingMode}remapTemplatesIds=async t=>{if(t.length>0){let e=[],i=[],a=[],r=[],o=[],n=[];t.forEach(c=>{c.teamIds&&c.teamIds.length>0&&(e=[...e,...c.teamIds]),c.matchIds&&c.matchIds.length>0&&(a=[...a,...c.matchIds]),c.competitionIds&&c.competitionIds.length>0&&(o=[...o,...c.competitionIds])});let l={team:e,match:a,competition:o},p=await this.idMappingService.idMappingFacade.getEntitiesByIds(l,"native",this.idMappingService.idSchema);return i=[...p.team],r=[...p.match],n=[...p.competition],t.forEach(c=>{c.teamIds&&c.teamIds.length>0&&(c.teamIds=c.teamIds.map(u=>u=p.team.shift())),c.matchIds&&c.matchIds.length>0&&(c.matchIds=c.matchIds.map(u=>u=p.match.shift())),c.competitionIds&&c.competitionIds.length>0&&(c.competitionIds=c.competitionIds.map(u=>u=p.competition.shift()))}),t}return t};remapTemplateGroupMatchIds=async t=>{if(t&&t.length>0){for(let e of t)if(!(!e.filters.matchIds||!e.filters.matchIds.every(a=>a))&&e.filters.matchIds.length>0){let a={match:Array.from(e.filters.matchIds)},r=await this.idMappingService.idMappingFacade.getEntitiesByIds(a,"native",this.idMappingService.idSchema);e.filters.matchIds=Array.from(r.match)}}};addProfileModelToLeaderboard=async t=>{if(t.length>0){let e=[],i=t.map(r=>r.profileId);if(!i.length)return t;let a=await this.profileNamespace.getByIds(i);return t.forEach(r=>{a.forEach(o=>{o.id===r.profileId&&(delete o.interests,r.profileModel=o)}),r.profileModel||(r.profileModel=null),e.push(r)}),e}return t};buildOldClientBadges=t=>{let e=new Qr;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 Kr;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 vt(t));break;case"rankings":t&&(t=new Yr(t));break;case"league_leaderboard":t&&(t=new Xr(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 f(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 f(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(u=>{u.id.includes(i)?e.push(u.id):u.id.includes(o)?r.push(u.id):u.id.includes(p)&&l.push(u.id)}),e.length&&(a=await this.footballNamespace.footballFacade.competitionsFacade.getCompetitionsMapWithNativeIds(e)),r.length&&(n=await this.footballNamespace.footballFacade.teamsFacade.getTeamsMapWithNativeIds(r)),l.length&&(c=await this.footballNamespace.footballFacade.playerFacade.getPlayersMapWithNativeIds(l)),t.breakdown.forEach(u=>{u.id.includes(i)?(u.model=a.get(u.id),u.id=u.model.id):u.id.includes(o)?(u.model=n.get(u.id),u.id=u.model.id):u.id.includes(p)&&(u.model=c[u.id],u.id=u.model.id)}),t};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(d=>d.groupId===e);if(!c)throw this.errorHandlingMode==="default"?new f(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 f(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 u=c.filters.matchIds.every(d=>d);c.filters.matchIds.length>0&&u&&(r=Array.from(c.filters.matchIds))}return new Rt({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 sl=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(Z).includes(t)){let a=ql(t);throw e==="default"?new f(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 f(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 f(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 f(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 f(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 nl=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 yt(r,a),this.loyaltyService=new ol(this.config),this.loyaltyValidator=new sl,this.idMapping=new S(t),this.topXFacade=new vi(t,this.idMapping),this.matchQuizFacade=new Ei(t),this.predictorHttps=new ct(t,this.idMapping),this.errorHandlingMode=t.errorHandlingMode,this.football=new Y(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 Jr(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=this.loyaltyService.initFilters(e,"loyalty");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 jr(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 zt=class{clientHttps=null;profileHttps=null;loyaltyHttps=null;loyaltyFacade=null;localCache=null;constructor(t){this.clientHttps=new $(t),this.profileHttps=new di(t),this.loyaltyHttps=new It(t),this.localCache=new st().createLocalCacheInstance(t.idSchema),this.loyaltyFacade=new nl(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 ll=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 Vt(t.errorHandlingMode),this.predictorService=new _t(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 f(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 at&&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!==ki&&!r.prediction.playerId)throw new f(400,"INVALID_FIELD","Player id is invalid!").errorMessage();if(this.errorHandlingMode==="standard"&&r.market!==ki&&!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(u=>{u.prediction.playerId&&u.prediction.playerId!=="OWN_GOAL"&&(u.prediction.playerId=l),u.matchId=n}),c}else return o.fixtures=[r],await this.predictorHttps.makeFootballPrediction(o)};getMatchSummary=async(t,e)=>{let i=await this.getMatchSummaryBase(t,e),a=JSON.parse(JSON.stringify(i.predictions)),r=await this.predictorService.remapPlayerIdToIdSchema(a);return i.predictions=r,i};getMarketSummary=async(t,e,i,a)=>{try{let r=await this.getMatchSummaryBase(t,a);return await this.predictorService.getMarketSummary(r,e,i)}catch(r){throw r}};getMatchSummaryBase=async(t,e)=>{if(this.idMapping.idSchema!=="native"){let a=(await this.predictorService.remapMatchIdToNative([t]))[0],r=await this.predictorHttps.getMatchSummary(a,e);return r.matchId=t,r}else return await this.predictorHttps.getMatchSummary(t,e)};getConfig=async()=>{let t=await this.clientHttps.getConfig("predictor");return this.idMapping.idSchema!=="native"?await this.predictorService.remapCompetitionsFromConfig(t):t};deleteFootballPrediction=async t=>await this.predictorHttps.deleteFootballPrediction(t);getMyPredictions=async t=>{let e=this.predictorService.initPredictionsFilters(t,"user");return await this.predictorHttps.getMyPredictions(e)};getMyPredictionsForMatches=async(t,e)=>{if(this.errorHandlingMode==="default"&&this.predictorService.areIdsExceeded(t))throw new f(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 f(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 pl=class extends nt{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 pl(t)}calculateOneXTwoFromScores=t=>{this.validator.validateMatchSummary(t);let{correctScore:e,correctScoreAdvanced:i}=t.predictions,a={...e,...i},r=0,o=0,n=0,l=0;return Object.entries(a).forEach(([p,c])=>{if(c===0)return;let u=c;r+=u;let[d,y]=p.split(":").map(Number);d>y?o+=u:d===y?n+=u:l+=u}),{home:r?Math.round(o/r*100):0,draw:r?Math.round(n/r*100):0,away:r?Math.round(l/r*100):0}};getTopCorrectScores=t=>{this.validator.validateMatchSummary(t);let{correctScore:e,correctScoreAdvanced:i}=t.predictions,a={...e,...i},r=0;return Object.values(a).forEach(o=>{r+=o}),Object.entries(a).filter(([o,n])=>n>0).map(([o,n])=>({score:o,percentage:Math.round(n/r*100)})).sort((o,n)=>n.percentage-o.percentage).slice(0,3)}};var Ci=class{predictorHttps=null;clientHttps=null;predictorFacade=null;idMapping=null;helpers=null;constructor(t){this.idMapping=new S(t),this.predictorHttps=new ct(t,this.idMapping),this.clientHttps=new $(t),this.predictorFacade=new ll(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 Ai=class{loyalty=null;profile=null;predictor=null;constructor(t){this.loyalty=new zt(t),this.profile=new U(t),this.predictor=new Ci(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 Qt=class{idSchema=null;profile=null;validator=null;idMapping=null;constructor(t){this.idSchema=t.idSchema,this.profile=new U(t),this.validator=new $t(t),this.idMapping=new S(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 ul=class{factory=null;https=null;loyaltyHttps=null;profile=null;service=null;discussionsService=null;constructor(t){this.factory=new Fi,this.https=new Ti(t),this.service=new Ai(t),this.loyaltyHttps=new It(t),this.profile=new U(t),this.discussionsService=new Qt(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 ir(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 er(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 ze(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 Qe(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 Ke(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 dl=class{facade=null;constructor(t){this.facade=new ul(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 ml=class extends v{remapper=null;constructor(t){super(t,C(t.environment,"discussions")),this.remapper=new _i}getAll=async(t,e)=>{let i="/discussions"+this.apiSignInUrl;t&&(i+=`${t.constructMainFiltersUrl()}`),g(e)&&(i+=h());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+=h());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+=h());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+=h());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 hl=class{createRequestBodyFromParam=t=>{let e=new sr;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 fl=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 ml(t),this.clientHttps=new $(t),this.activityService=new ft(t),this.service=new Qt(t),this.factory=new hl}getAll=async(t,e)=>{t&&(t=new hr(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 Bt(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 Bt(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 Bt(t)),await this.https.getOwnPosts(t));getUserPosts=async(t,e,i)=>(e&&(e=new Bt(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 f(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 f(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 fr(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 f(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 f(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 gl=class{facade=null;constructor(t){this.facade=new fl(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 su=["minutesPlayed","cleanSheets","concededGoals","saves","penaltySaved","penaltyCommitted","yellowCards","redCards","assists","foulsCommitted","ownGoals","goals","tackles","shotsOn"],nu=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"),Oi=class{static createFantasyPrediction(t,e,i){let a=new Fe;return a.template_id=t||null,a.group_id=e||null,a.fixtures=i?.map(r=>({player_id:r,match_type:"FOOTBALL",market:"PLAYER_PERFORMANCE"}))||[],a}static createFantasyPlayerStats(t){return su.map(e=>{let i=new Mr,a=t.data.reduce((r,o)=>r+o.stats[e],0);return i.key=e,i.label=nu.get(e),i.value=a,i})}};var yl=class{idMapping=null;idSchema=null;errorHandlingModel=null;football=null;constructor(t){this.idSchema=t.idSchema,this.errorHandlingModel=t.errorHandlingMode,this.football=new Y(t),this.idMapping=new S(t)}remapCompetitions=async t=>{let e={competition:t};return(await this.idMapping.idMappingFacade.getEntitiesByIds(e,"native",this.idSchema)).competition};remapPlayers=async(t,e,i)=>{let a={player:Array.from(t)};return(await this.idMapping.idMappingFacade.getEntitiesByIds(a,e,i)).player};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 f(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 lt(t),this.service=new yl(t),this.idMappingService=new S(t),this.predictorHttps=new ct(t,this.idMappingService),this.loyaltyHttps=new It(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)=>{(!i||!Array.isArray(i))&&this.service.throwException(400,"invalid_method_call","Invalid parameter provided. Please check the following parameter: "+"playerIds");let a=null;if(this.idSchema!=="native"){let r=await this.service.remapPlayers(i,this.idSchema,"native");a=Oi.createFantasyPrediction(t,e,r)}else a=Oi.createFantasyPrediction(t,e,i);return await this.predictorHttps.makeFootballPrediction(a)};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 Oi.createFantasyPlayerStats(a)};getGameWeekStatistics=async t=>await this.loyaltyHttps.getTemplateBreakdownPoints(t)};var Ml=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)=>await this.facade.play(t,e,i);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 wl=class{configuration;constructor(t){this.configuration=t}getSDKConfiguration(){return this.configuration}};var Il=class{remapToResponseModel=(t,e,i)=>{let a=new Wr;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 Pl=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 f(t,e,i)}};var _l=class{validator=null;idMappingFacade=null;factory=new Il;constructor(t){this.validator=new Pl(t),this.idMappingFacade=new pi(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 Tl=class{facade=null;constructor(t){this.facade=new _l(t)}getMappedFootballCountryIds=async(t,e,i)=>await this.facade.getMappedFootballCountryIds(t,e,i);getMappedFootballCompetitionIds=async(t,e,i)=>await this.facade.getMappedFootballCompetitionIds(t,e,i);getMappedFootballTeamIds=async(t,e,i)=>await this.facade.getMappedFootballTeamIds(t,e,i);getMappedFootballPlayerIds=async(t,e,i)=>await this.facade.getMappedFootballPlayerIds(t,e,i);getMappedFootballMatchIds=async(t,e,i)=>await this.facade.getFootballMappedMatchIds(t,e,i)};var Fl=class{remapUserVotes=t=>{let e=new _s;return e.meta=this.remapMeta(t.meta.pagination),e.data=t.data.map(i=>this.remapUserVoteModel(i)),e};remapResults=t=>{let e=new Ss;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 Ts;return e.matchId=t.match_id,e.playerId=t.player_id,e.createdAt=t.created_at,e};remapResultsModel=t=>{let e=new Es;return e.teamId=t.team_id,e.playerId=t.player_id,e.votes=t.votes,e.winner=t.winner,e}};var Sl=class extends pt{remapPolls=t=>{let e=new ws;return e.meta.pagination=this.remapMetaPagination(t.meta.pagination),e.data=t.data.map(i=>this.remapPoll(i)),e};remapPollById=t=>{let e=new bs;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,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 Ze;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 Is;return e.meta.pagination=this.remapMetaPagination(t.meta.pagination),e.data=t.data.map(i=>this.remapPollVote(i)),e};remapPollVote=t=>{let e=new Ms;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 gt;return e.itemsPerPage=t.items_per_page,e.nextPageStartsAfter=t.next_page_starts_after,e};remapPoll=t=>{let e=new Je;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,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 Tt;return e.content=t.content,e.tags=t.tags?t.tags.map(i=>{let a=new Ka;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 El=class extends v{pollRemapper=null;playerOfTheMatchRemapper=null;constructor(t){super(t,C(t.environment,"voting")),this.pollRemapper=new Sl,this.playerOfTheMatchRemapper=new Fl}getPolls=async(t,e)=>{let i=`/polls${this.apiSignInUrl}`;t&&(i+=t.constructMainFiltersUrl()),g(e)&&(i+=h());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+=h());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)?h():""}`,a="There was a problem fetching results for 'Player of the match'",r=await this.fetchWithoutAuth(i,a);return this.playerOfTheMatchRemapper.remapResults(r)}};var Rl=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 S(t),this.validator=new $t(t),this.activityService=new ft(t),this.football=new Y(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 f(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 f(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 vl=class{https=null;service=null;idSchema=null;constructor(t){this.idSchema=t.idSchema,this.https=new El(t),this.service=new Rl(t)}getPolls=async(t,e)=>{t&&(t=new Ye(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 Ye({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 _(t));let e=await this.https.getMyPollsVotes(t),i=e.data.map(r=>r.id),a=await this.getPolls(new Ye({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 Ps(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 xi=class{facade=null;constructor(t){this.facade=new vl(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 Cl=class{clientHttps=null;topX=null;matchQuiz=null;loyalty=null;miniGames=null;voting=null;constructor(t){this.clientHttps=new $(t),this.topX=new Wt(t),this.matchQuiz=new Ht(t),this.loyalty=new zt(t),this.miniGames=new qt(t),this.voting=new xi(t)}getListContent=async(t,e,i)=>{e&&(e=new zr(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(y=>o.includes(y.id))];break;case"CLASSIC_QUIZ":let c=await this.miniGames.getClassicQuizzes({limit:o.length,classicQuizIds:o},!1,!0);i=[...i,...c.data];break;case"EITHER_OR":let u=await this.miniGames.getEitherOrs({limit:o.length,eitherOrIds:o},!1,!0);i=[...i,...u.data];break;case"POLL":let d=await this.voting.getPolls({limit:o.length,pollIds:o},!0);i=[...i,...d.data];break;default:}}catch(r){throw console.error("An error occurred while trying to set models for list content entities",r),r}t.forEach(r=>{let o=i.find(n=>n.id===r.entityId)||null;r.entityModel=o})}};var Al=class{facade=null;constructor(t){this.facade=new Cl(t)}getListContent=async(t,e,i)=>await this.facade.getListContent(t,e,i)};var Ol=class{factory=null;privateLeagueHttps=null;loyaltyHttps=null;profile=null;service=null;discussionsService=null;constructor(t){this.factory=new Fi,this.privateLeagueHttps=new Ti(t),this.loyaltyHttps=new It(t),this.profile=new U(t),this.service=new Ai(t),this.discussionsService=new Qt(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 as(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 rs(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 ze(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 Qe(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 Ke(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 xl=class{privateLeaguesFacade=null;constructor(t){this.privateLeaguesFacade=new Ol(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 Ll=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 Dl=class extends nt{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 Bl=class{https=null;profile=null;validator=null;constructor(t){this.https=new ci(t),this.profile=new U(t),this.validator=new Dl(t.errorHandlingMode)}getGames=async(t,e)=>(t&&(t=new cs(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 us(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 Nl=class{facade=null;constructor(t){this.facade=new Bl(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 Oc(){let s=Ac(),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 xp=null,Qp=null;function pu(s){if(cu(s)){let t=uu(s);if(t.isValid)return xp={profile:new U(s),football:new Y(s),predictor:new Ci(s),loyalty:new zt(s),topX:new Wt(s),matchQuiz:new Ht(s),activity:new Ys(s),miniGames:new qt(s),discussions:new gl(s),privateLeagues:new xl(s),challenges:new dl(s),progress:new Ll,voting:new xi(s),fantasy:new Ml(s),helpers:new wl(s),idMapping:new Tl(s),bracketGame:new kn(s),lists:new Al(s),standingGame:new Nl(s),getVersion:Oc},Qp={...s},xp;du(t)}return xp}var cu=s=>!xp||JSON.stringify(s)!==JSON.stringify(Qp)||s.authProvider.getIdToken()!==Qp.authProvider.getIdToken(),uu=s=>{let e=new qs().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},du=s=>{let t="authProvider",e="isValid";Object.keys(s).forEach(i=>{let a=s[i];if(i!==e&&i!==t){if(a.message.type==="error")throw new Error(a.message.text)}else i!==e&&i===t&&Object.keys(new Xt).forEach(r=>{if(a[r].message.type==="error")throw new Error(a[r].message.text)})})};export{Ja as AcceptChallengeModel,ts as AcceptPrivateLeagueModel,Gi as AchievementsStats,ue as ActionValueModel,Up as ActionsEnum,de as ActionsModel,re as ActivityFilters,Yl as ActivityMeta,ae as ActivityResponseBody,op as AssetsModel,ce as AutomaticModerationModel,$a as BadgesModel,Ra as BadgesModelV2,qa as BadgesValue,q as BadgesValueV2,No as BothTeamsFixtureModel,Ya as BracketGameFilters,oe as BracketGameFixtureScoreModel,Xa as BracketGameFixtures,Ji as BracketGameFixturesModel,se as BracketGameMetaModel,Zi as BracketGameMetaParticipantsModel,ta as BracketGameModel,ra as BracketGamePredictionFixturesModel,oa as BracketGamePredictionModel,tp as BracketGamePredictionRequestBody,Rc as BracketGamePredictionStatusEnum,ja as BracketGamePredictionsFilters,ea as BracketGamePredictionsModel,sa as BracketGameRankingsModel,ne as BracketGameTiebreaker,aa as BracketGameTiebreakerModel,ia as BracketGamesModel,Wp as BracketWinnerEnum,ba as BreakdownModel,_p as CalculatedOneXTwoFromScoresModel,Jl as CampaignModel,Za as ChallengeCreateModel,er as ChallengeFilters,ar as ChallengeRankingsModel,tr as ChallengeUpdateModel,Ae as ClassicQuizBasicModel,co as ClassicQuizFilters,xe as ClassicQuizFiltersMeta,uo as ClassicQuizFullModel,wo as ClassicQuizLeaderboardFilters,De as ClassicQuizLeaderboardMeta,ho as ClassicQuizOptionModel,yp as ClassicQuizParticipationBodyModel,fo as ClassicQuizParticipationModel,go as ClassicQuizParticipationQuestionModel,yo as ClassicQuizParticipationsFilters,mo as ClassicQuizQuestionModel,Mo as ClassicQuizQuestionsReportModel,Le as ClassicQuizRankFilters,Io as ClassicQuizRankModel,bo as ClassicQuizUserParticipationModel,Po as ClassicQuizUserRank,Mp as ClassicQuizUserRankModel,wp as ClassicQuizzesLeaderboardModel,bp as ClassicQuizzesModel,Jt as ClassicQuizzesStats,Qr as ClientBadges,Kr as ClientBadgesV2,Fr as CompetitionBasicModel,hi as CompetitionFilters,Sr as CompetitionFullModel,j as CompletedModel,Zl as ContentModel,gs as ContestWinners,Tt as ContextModel,Go as CornersFixtureModel,Ot as CorrectScoreFixtureModel,ni as CreateActivityRequestBody,ep as CreatePostParamBody,ma as DetailedProfileModel,Ia as DictionaryModel,rr as DiscussionModel,Zt as DiscussionStats,Ga as DiscussionsBadgeRequirements,Ua as DiscussionsBadgesValue,Pa as DiscussionsConfigModel,hr as DiscussionsFilters,Ln as DoubleChanceEnum,Ho as DoubleChanceFixtureModel,Be as EitherOrBasicModel,_o as EitherOrFilters,To as EitherOrFullModel,Eo as EitherOrParticipationModel,vo as EitherOrParticipationRequestFullModel,Ro as EitherOrParticipationRequestModel,Ao as EitherOrParticipationStepsModel,yi as EitherOrParticipationStepsOptionModel,Fo as EitherOrPointsModel,Oo as EitherOrResultsBreakdownModel,xo as EitherOrResultsModel,Lo as EitherOrResultsStandingsModel,te as EitherOrStats,So as EitherOrStatsModel,Ip as EitherOrsModel,pp as EntitiesFollows,cp as EntitiesFollowsFilters,Bi as EnvironmentEnum,x as ErrorCodes,Ul as ErrorHandlingModeEnum,k as ErrorMessages,L as ErrorStatuses,pu as FansUnitedSDK,sp as FansUnitedSDKModel,Dt as FansUnitedSdkFetchException,we as FantasyCoefficientsModel,za as FantasyConfigModel,yr as FantasyPlayerDetailedStatsMetaModel,br as FantasyPlayerDetailedStatsModel,Mr as FantasyPlayerStatsModel,Ir as FantasyPlayersMetaModel,Ie as FantasyPlayersModel,Pr as FantasyPlayersPointsModel,Fe as FantasyPredictionRequestBody,to as FiltersMetaModel,ds as FixturesGamesModel,lo as FixturesMatchQuizModel,Bo as FixturesPredictionModel,Ge as FixturesResponseModel,hs as FixturesTopXModel,mi as FollowFilters,ui as FollowModel,ga as FollowStatusModel,fa as FollowersModel,ha as FollowingModel,Da as FootballBadgeRequirements,Ba as FootballBadgesValue,Er as FootballCountryModel,Nt as FootballPaginationModel,ps as FullInterestModel,Ma as FullnessProfile,Aa as GameBadgeRequirements,Oa as GameBadgesValue,je as GameByIdModel,po as GameMarketsResults,kt as GameModel,oi as GamePredictionsStats,fs as GameResultsModel,St as GameStatusEnum,xa as GamesBadgeRequirements,La as GamesBadgesValue,rt as GamesFilters,Mt as GamesListModel,bt as GamesMatchQuizListModel,xt as GamesTopXListModel,Wa as GeneralBadgesValue,Me as GeneralRequirementModel,Dn as HalfTimeFullTimeEnum,qo as HalfTimeFullTimeFixtureModel,jr as HighestSuccessRateFilters,Zr as HighestSuccessRateModel,N as IdSchemaEnum,K as ImagesModel,ls as InterestModel,ze as InvitationFilters,Ls as LangEnum,ya as LeadModel,Cp as LeadRequestBody,up as LeaderboardLeagueResponse,Ce as LeaderboardModel,dp as LeaderboardResponseModel,Xr as LeagueLeaderboardFilters,ve as LeagueLeaderboardMetaModel,Re as LineupsModel,zr as ListContentFilters,Qa as ListContentModel,Rs as ListContentResponseModel,_a as LoyaltyConfigModel,Ha as LoyaltyConfigModelV2,vt as LoyaltyFilters,Ct as LoyaltyMeta,qr as MappingModel,Wr as MappingResponseModel,Z as MarketEnum,Pp as MarketsConfigModel,Rr as MatchBasicModel,$e as MatchCorrectScoreMarketResultModel,Rt as MatchFilters,vr as MatchFullModel,Yo as MatchMarketsResultsModel,Xo as MatchPlayerMarketResultModel,he as MatchQuizConfigModel,et as MatchStatus,Zo as MatchSummaryModel,O as MetaFootballModel,Co as MiniGameImages,Na as MiniGamesBadgeRequirements,ka as MiniGamesBadgesValue,Ne as MiniGamesContext,ke as MiniGamesContextTag,Oe as MiniGamesFilters,ir as MyChallengesFilters,as as MyLeaguesFilters,A as NoYesModel,xn as OneXTwoEnum,zo as OneXTwoFixtureModel,Cc as OutcomeEnum,Ve as OverCornersFixtureModel,He as OverGoalsFixtureModel,Xi as OwnActivityFilters,qi as PaginationActivities,z as PaginationFootballProperties,Fp as PastTemplateModel,Qo as PenaltyMatchFixtureModel,ip as PlayerAssetsModel,Lr as PlayerBasicModel,Se as PlayerDetailedPointsModel,gr as PlayerDetailedStatsFilters,_r as PlayerDetailedStatsModel,gi as PlayerFilters,at as PlayerFixtureModel,Dr as PlayerFullModel,ap as PlayerMarketResultModel,Tr as PlayerPointsModel,kr as PlayerShortModel,Br as PlayerSquadModel,Ee as PlayerStatsMatchModel,xr as PlayerStatsModel,wr as PlayersPointsFilters,mp as Points,Ta as PointsModel,hp as PointsValueModel,lp as PollBadgesValue,Je as PollBasicModel,bs as PollFullModel,Ap as PollOptionModel,Ze as PollVoteBasicModel,Ms as PollVoteFullModel,Ye as PollsFilters,ws as PollsModel,Is as PollsUserVotesModel,Te as PostByIdBasicModel,or as PostByIdFullModel,sr as PostCreateModel,nr as PostsCountDiscussionModel,lr as PostsDiscussionBasicModel,Bt as PostsFilters,pr as PostsFullModel,Et as PostsMetaModel,cr as PostsModel,ye as PotmBadgesValue,Fs as PotmResultsMetaModel,Es as PotmResultsModel,Ss as PotmResultsResponseModel,Ps as PotmUserVotesFilters,Ts as PotmUserVotesModel,_s as PotmUserVotesResponseModel,no as PredictionMatchQuizModel,qe as PredictionRequestModel,bi as PredictionResponseModel,ms as PredictionTopXModel,G as PredictionsFilters,Jo as PredictionsModel,ie as PredictionsStats,va as PredictorBadgeRequirements,Ca as PredictorBadgesValue,ge as PredictorConfigModel,Pe as PrivateLeagueBasicCreateModel,_e as PrivateLeagueBasicUpdateRequestBody,ss as PrivateLeagueCreateModel,rs as PrivateLeagueFilters,es as PrivateLeagueFullModel,We as PrivateLeagueModel,Sp as PrivateLeagueParamCreateBody,Ep as PrivateLeagueParamUpdateBody,Qe as PrivateLeaguePostsFilters,is as PrivateLeaguePredictionModel,Ke as PrivateLeaguePredictionsFilters,Rp as PrivateLeaguePredictionsModel,os as PrivateLeagueRankingsModel,ns as PrivateLeagueUpdateModel,vp as PrivateLeaguesModel,wa as ProfileCountryModel,pe as ProfileModel,Vi as ProfileStatsModel,Yr as RankingsFilters,io as RankingsModel,ur as ReactionModel,jo as RedCardFixtureModel,Q as RelatedEntityRelationship,dr as ReportModel,Ft as RequirementModel,Ue as ResultModel,Do as ResultsSummaryModel,me as RewardsModel,be as RewardsModelV2,np as SDKConfiguraitonModel,Ar as ScoresModel,$r as SearchFilters,Hr as SearchModel,Hi as SinglePredictionsBreakdown,ee as SinglePredictionsStats,m as StandardFansUnitedException,le as StandingGameMetaModel,pa as StandingGameMetaParticipantsModel,na as StandingGameModel,ca as StandingGamePredictionModel,ua as StandingGamePredictionsModel,us as StandingGameRankingsFilters,da as StandingGameRankingsModel,cs as StandingGamesFilters,la as StandingGamesModel,Cr as StatsModel,un as StatusEnum,$i as SuccessRatePercent,Fa as SuccessRateScopeModel,Ui as SuccessRates,Lt as SummarizedBreakdown,Ka as TagsModel,Gr as TeamBasicModel,Ur as TeamColors,fi as TeamFilters,rp as TeamFormModel,Vr as TeamFullModel,fp as TemplateBreakdownModel,ao as TemplateBreakdownPointsModel,ro as TemplateByIdModel,Jr as TemplateFilters,so as TemplateGroupFilter,oo as TemplateGroups,eo as TemplateMeta,At as TemplateModel,dt as TiebreakerModel,gp as TiersModel,ut as TimeTiebreaker,Or as TimelineModel,Tp as TopCorrectScoresModel,fr as TopDiscussionsFilters,Nr as TopPlayerModel,fe as TopXConfigModel,Xe as TopXPredictionRequestModel,vc as UserActionsEnum,Yi as UserActivityFilters,Sa as UserDataConfigModel,ys as UserListWinners,Ko as ValueAndPlayerId,it as ValueBoolean,ko as ValueCorners,Uo as ValueCorrectScore,Vo as ValueDoubleChance,$o as ValueHalfTimeFullTime,Wo as ValueOneXTwo,mr as VersionsModel,Va as VotingBadgeRequirements,Ea as VotingBadgesValue};
4
4
  //# sourceMappingURL=index.js.map