fansunited-sdk-esm 1.113.2 → 1.113.3

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 Ku=Object.create;var Vp=Object.defineProperty;var ju=Object.getOwnPropertyDescriptor;var Yu=Object.getOwnPropertyNames;var Xu=Object.getPrototypeOf,Ju=Object.prototype.hasOwnProperty;var Zu=(s,t,e)=>t in s?Vp(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e;var td=(s,t)=>()=>(s&&(t=s(s=0)),t);var Rn=(s,t)=>()=>(t||s((t={exports:{}}).exports,t),t.exports),ed=(s,t)=>{for(var e in t)Vp(s,e,{get:t[e],enumerable:!0})},id=(s,t,e,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of Yu(t))!Ju.call(s,a)&&a!==e&&Vp(s,a,{get:()=>t[a],enumerable:!(i=ju(t,a))||i.enumerable});return s};var ad=(s,t,e)=>(e=s!=null?Ku(Xu(s)):{},id(t||!s||!s.__esModule?Vp(e,"default",{value:s,enumerable:!0}):e,s));var it=(s,t,e)=>(Zu(s,typeof t!="symbol"?t+"":t,e),e);var Iu={};ed(Iu,{default:()=>pd});var ld,pd,wu=td(()=>{ld={getItem:async()=>null,setItem:async()=>null,removeItem:async()=>null,clear:async()=>null,getAllKeys:async()=>[],multiGet:async()=>[],multiSet:async()=>null,multiRemove:async()=>null,mergeItem:async()=>null,multiMerge:async()=>null},pd=ld});var _u=Rn((Rf,Wp)=>{var cd=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,M,_){typeof u=="object"&&(d=u.depth,M=u.prototype,_=u.includeNonEnumerable,u=u.circular);var B=[],ui=[],di=typeof Buffer<"u";typeof u>"u"&&(u=!0),typeof d>"u"&&(d=1/0);function lt(g,$t){if(g===null)return null;if($t===0)return g;var U,Pn;if(typeof g!="object")return g;if(s(g,t))U=new t;else if(s(g,e))U=new e;else if(s(g,i))U=new i(function(Tn,P){g.then(function(En){Tn(lt(En,$t-1))},function(En){P(lt(En,$t-1))})});else if(a.__isArray(g))U=[];else if(a.__isRegExp(g))U=new RegExp(g.source,p(g)),g.lastIndex&&(U.lastIndex=g.lastIndex);else if(a.__isDate(g))U=new Date(g.getTime());else{if(di&&Buffer.isBuffer(g))return Buffer.allocUnsafe?U=Buffer.allocUnsafe(g.length):U=new Buffer(g.length),g.copy(U),U;s(g,Error)?U=Object.create(g):typeof M>"u"?(Pn=Object.getPrototypeOf(g),U=Object.create(Pn)):(U=Object.create(M),Pn=M)}if(u){var lu=B.indexOf(g);if(lu!=-1)return ui[lu];B.push(g),ui.push(U)}s(g,t)&&g.forEach(function(Tn,P){var En=lt(P,$t-1),Wu=lt(Tn,$t-1);U.set(En,Wu)}),s(g,e)&&g.forEach(function(Tn){var P=lt(Tn,$t-1);U.add(P)});for(var Mt in g){var F;Pn&&(F=Object.getOwnPropertyDescriptor(Pn,Mt)),!(F&&F.set==null)&&(U[Mt]=lt(g[Mt],$t-1))}if(Object.getOwnPropertySymbols)for(var pu=Object.getOwnPropertySymbols(g),Mt=0;Mt<pu.length;Mt++){var Gp=pu[Mt],$i=Object.getOwnPropertyDescriptor(g,Gp);$i&&!$i.enumerable&&!_||(U[Gp]=lt(g[Gp],$t-1),$i.enumerable||Object.defineProperty(U,Gp,{enumerable:!1}))}if(_)for(var E=Object.getOwnPropertyNames(g),Mt=0;Mt<E.length;Mt++){var Up=E[Mt],$i=Object.getOwnPropertyDescriptor(g,Up);$i&&$i.enumerable||(U[Up]=lt(g[Up],$t-1),Object.defineProperty(U,Up,{enumerable:!1}))}return U}return lt(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 Wp=="object"&&Wp.exports&&(Wp.exports=cd)});var xu=Rn((Ff,Zc)=>{"use strict";var oa=typeof Reflect=="object"?Reflect:null,Pu=oa&&typeof oa.apply=="function"?oa.apply:function(t,e,i){return Function.prototype.apply.call(t,e,i)},Kp;oa&&typeof oa.ownKeys=="function"?Kp=oa.ownKeys:Object.getOwnPropertySymbols?Kp=function(t){return Object.getOwnPropertyNames(t).concat(Object.getOwnPropertySymbols(t))}:Kp=function(t){return Object.getOwnPropertyNames(t)};function ud(s){console&&console.warn&&console.warn(s)}var Eu=Number.isNaN||function(t){return t!==t};function S(){S.init.call(this)}Zc.exports=S;Zc.exports.once=fd;S.EventEmitter=S;S.prototype._events=void 0;S.prototype._eventsCount=0;S.prototype._maxListeners=void 0;var Tu=10;function jp(s){if(typeof s!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof s)}Object.defineProperty(S,"defaultMaxListeners",{enumerable:!0,get:function(){return Tu},set:function(s){if(typeof s!="number"||s<0||Eu(s))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+s+".");Tu=s}});S.init=function(){(this._events===void 0||this._events===Object.getPrototypeOf(this)._events)&&(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0};S.prototype.setMaxListeners=function(t){if(typeof t!="number"||t<0||Eu(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 Ru(s){return s._maxListeners===void 0?S.defaultMaxListeners:s._maxListeners}S.prototype.getMaxListeners=function(){return Ru(this)};S.prototype.emit=function(t){for(var e=[],i=1;i<arguments.length;i++)e.push(arguments[i]);var a=t==="error",r=this._events;if(r!==void 0)a=a&&r.error===void 0;else if(!a)return!1;if(a){var o;if(e.length>0&&(o=e[0]),o instanceof Error)throw o;var n=new Error("Unhandled error."+(o?" ("+o.message+")":""));throw n.context=o,n}var l=r[t];if(l===void 0)return!1;if(typeof l=="function")Pu(l,this,e);else for(var p=l.length,c=Au(l,p),i=0;i<p;++i)Pu(c[i],this,e);return!0};function Fu(s,t,e,i){var a,r,o;if(jp(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=Ru(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,ud(n)}return s}S.prototype.addListener=function(t,e){return Fu(this,t,e,!1)};S.prototype.on=S.prototype.addListener;S.prototype.prependListener=function(t,e){return Fu(this,t,e,!0)};function dd(){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 Su(s,t,e){var i={fired:!1,wrapFn:void 0,target:s,type:t,listener:e},a=dd.bind(i);return a.listener=e,i.wrapFn=a,a}S.prototype.once=function(t,e){return jp(e),this.on(t,Su(this,t,e)),this};S.prototype.prependOnceListener=function(t,e){return jp(e),this.prependListener(t,Su(this,t,e)),this};S.prototype.removeListener=function(t,e){var i,a,r,o,n;if(jp(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():md(i,r),i.length===1&&(a[t]=i[0]),a.removeListener!==void 0&&this.emit("removeListener",t,n||e)}return this};S.prototype.off=S.prototype.removeListener;S.prototype.removeAllListeners=function(t){var e,i,a;if(i=this._events,i===void 0)return this;if(i.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):i[t]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete i[t]),this;if(arguments.length===0){var r=Object.keys(i),o;for(a=0;a<r.length;++a)o=r[a],o!=="removeListener"&&this.removeAllListeners(o);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if(e=i[t],typeof e=="function")this.removeListener(t,e);else if(e!==void 0)for(a=e.length-1;a>=0;a--)this.removeListener(t,e[a]);return this};function vu(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?hd(a):Au(a,a.length)}S.prototype.listeners=function(t){return vu(this,t,!0)};S.prototype.rawListeners=function(t){return vu(this,t,!1)};S.listenerCount=function(s,t){return typeof s.listenerCount=="function"?s.listenerCount(t):Cu.call(s,t)};S.prototype.listenerCount=Cu;function Cu(s){var t=this._events;if(t!==void 0){var e=t[s];if(typeof e=="function")return 1;if(e!==void 0)return e.length}return 0}S.prototype.eventNames=function(){return this._eventsCount>0?Kp(this._events):[]};function Au(s,t){for(var e=new Array(t),i=0;i<t;++i)e[i]=s[i];return e}function md(s,t){for(;t+1<s.length;t++)s[t]=s[t+1];s.pop()}function hd(s){for(var t=new Array(s.length),e=0;e<t.length;++e)t[e]=s[e].listener||s[e];return t}function fd(s,t){return new Promise(function(e,i){function a(o){s.removeListener(t,r),i(o)}function r(){typeof s.removeListener=="function"&&s.removeListener("error",a),e([].slice.call(arguments))}Ou(s,t,r,{once:!0}),t!=="error"&&gd(s,a,{once:!0})})}function gd(s,t,e){typeof s.on=="function"&&Ou(s,"error",t,e)}function Ou(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 Bu=Rn((Lu,Du)=>{(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=_u(),s=xu().EventEmitter,Du.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,M,_,B;if(_=u,[...u]=_,[d]=i.call(u,-1),typeof d=="function")try{B=c(...u),d(null,B)}catch(ui){M=ui,d(M)}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,M,_;if(a(this,o),!Array.isArray(l))throw p=this._error("EKEYSTYPE"),p;for(_={},u=0,M=l.length;u<M;u++){if(d=l[u],(c=this._isInvalidKey(d))!=null)throw c;this.data[d]!=null&&this._check(d,this.data[d])?(this.stats.hits++,_[d]=this._unwrap(this.data[d])):this.stats.misses++}return _}set(l,p,c){var u,d,M;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 M=!1,this.data[l]&&(M=!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),M||(this.stats.ksize+=this._getKeyLength(l),this.stats.keys++),this.emit("set",l,p),!0}mset(l){var p,c,u,d,M,_,B,ui,di,lt;if(a(this,o),this.options.maxKeys>-1&&this.stats.keys+l.length>=this.options.maxKeys)throw p=this._error("ECACHEFULL"),p;for(u=0,B=l.length;u<B;u++){if(_=l[u],{key:M,val:lt,ttl:di}=_,di&&typeof di!="number")throw p=this._error("ETTLTYPE"),p;if((c=this._isInvalidKey(M))!=null)throw c}for(d=0,ui=l.length;d<ui;d++)_=l[d],{key:M,val:lt,ttl:di}=_,this.set(M,lt,di);return!0}del(l){var p,c,u,d,M,_;for(a(this,o),Array.isArray(l)||(l=[l]),p=0,u=0,M=l.length;u<M;u++){if(d=l[u],(c=this._isInvalidKey(d))!=null)throw c;this.data[d]!=null&&(this.stats.vsize-=this._getValLength(this._unwrap(this.data[d],!1)),this.stats.ksize-=this._getKeyLength(d),this.stats.keys--,p++,_=this.data[d],delete this.data[d],this.emit("del",d,_.v))}return p}take(l){var p;return a(this,o),p=this.get(l),p!=null&&this.del(l),p}ttl(l,p){var c;if(a(this,o),p||(p=this.options.stdTTL),!l)return!1;if((c=this._isInvalidKey(l))!=null)throw c;return this.data[l]!=null&&this._check(l,this.data[l])?(p>=0?this.data[l]=this._wrap(this.data[l].v,p,!1):this.del(l),!0):!1}getTtl(l){var p,c;if(a(this,o),!!l){if((c=this._isInvalidKey(l))!=null)throw c;if(this.data[l]!=null&&this._check(l,this.data[l]))return p=this.data[l].t,p}}keys(){var l;return a(this,o),l=Object.keys(this.data),l}has(l){var p;return a(this,o),p=this.data[l]!=null&&this._check(l,this.data[l]),p}getStats(){return a(this,o),this.stats}flushAll(l=!0){a(this,o),this.data={},this.stats={hits:0,misses:0,keys:0,ksize:0,vsize:0},this._killCheckPeriod(),this._checkData(l),this.emit("flush")}flushStats(){a(this,o),this.stats={hits:0,misses:0,keys:0,ksize:0,vsize:0},this.emit("flush_stats")}close(){a(this,o),this._killCheckPeriod()}_checkData(l=!0){var p,c,u;a(this,o),c=this.data;for(p in c)u=c[p],this._check(p,u);l&&this.options.checkperiod>0&&(this.checkTimeout=setTimeout(this._checkData,this.options.checkperiod*1e3,l),this.checkTimeout!=null&&this.checkTimeout.unref!=null&&this.checkTimeout.unref())}_killCheckPeriod(){if(this.checkTimeout!=null)return clearTimeout(this.checkTimeout)}_check(l,p){var c;return a(this,o),c=!0,p.t!==0&&p.t<Date.now()&&(this.options.deleteOnExpire&&(c=!1,this.del(l)),this.emit("expired",l,this._unwrap(p))),c}_isInvalidKey(l){var p;if(a(this,o),p=typeof l,r.call(this.validKeyTypes,p)<0)return this._error("EKEYTYPE",{type:typeof l})}_wrap(l,p,c=!0){var u,d,M,_;return a(this,o),this.options.useClones||(c=!1),d=Date.now(),u=0,_=1e3,p===0?u=0:p?u=d+p*_:this.options.stdTTL===0?u=this.options.stdTTL:u=d+this.options.stdTTL*_,M={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(Lu)});var Gu=Rn((Nu,ku)=>{(function(){var s;s=ku.exports=Bu(),s.version="5.1.2"}).call(Nu)});var qu=Rn((uj,Td)=>{Td.exports={name:"fansunited-sdk-esm",version:"1.113.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 Fn=(_=>(_.EN="en",_.BG="bg",_.RO="ro",_.EL="el",_.SK="sk",_.PT="pt",_.SR="sr",_.HU="hu",_.SV="sv",_.ES="es",_.FR="fr",_.NL="nl",_.DE="de",_.IT="it",_))(Fn||{});var Sn=class{validate=t=>{let e=this.validateField(t.lang),i=this.generateMessage(e);return{validation:e,message:i}};validateField=t=>{let e=Object.values(Fn),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 zi=(o=>(o.DEV="dev",o.PROD="prod",o.STAGING="staging",o.WATG="watg",o.YOLO="yolo",o.CSKA="cska",o))(zi||{});var vn=class{validate(t){let e=this.validateField(t.environment),i=this.generateMessage(e);return{validation:e,message:i}}validateField=t=>{let e=Object.values(zi),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 Cn=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 An=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 le=class{getIdToken=null;logout=null};var pt=class{text=null;type=null};var qi=class{validation=null;message=new pt;getIdToken={validation:null,message:new pt};logout={validation:null,message:new pt}};var On=class{validate(t){if(t.cookieToken)return new qi;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 le),i=new qi;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 le).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 ht=class{validation;message};var xn=class{apiKey=null;environment=null;idSchema=null;clientId=null;lang=null;errorHandlingMode=null;cookieToken={name:new ht,requestHeaders:new ht};oddClient=null;authProvider={getIdToken:new ht,logout:new ht};isValid=!1};var Ln=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 Hp=(e=>(e.DEFAULT="default",e.STANDARD="standard",e))(Hp||{});var Dn=class{validate=t=>{let e=this.validateField(t.errorHandlingMode),i=this.generateMessage(e);return{validation:e,message:i}};validateField=t=>{let e=["default","standard"],i=null;return t?e.includes(t)?i="valid":i="invalid":i="missing",i};generateMessage=t=>{let e=null,i="warning";return t==="missing"&&(e="If no errorHandlingMode is passed the default one will be set which is: default"),t==="invalid"&&(e="This errorHandlingMode value is not supported, the default one will be set which is: default"),t==="valid"&&(e=null,i=null),{text:e,type:i}}};var Qi=class extends ht{name={validation:null,message:new pt};requestHeaders={validation:null,message:new pt}};var Bn=class{keys=["name","requestHeaders"];isServerSide=typeof document>"u";validate(t){if(!t.cookieToken){let i=new Qi;return i.message={type:null,text:null},i.validation="valid",i}let e=this.validateCookieToken(t.cookieToken);return e=this.validateCookieTokenConfigFields(t.cookieToken,e),e=this.generateCookieTokenConfigMessages(e),e=this.checkCookieTokenConfigMessagesForErrors(e),e}validateCookieToken=t=>{let e=new Qi;e.message={type:null,text:null};let a=Object.keys(t).filter(r=>!this.keys.includes(r));return a.length>0?(e.validation="invalid",e.message.type="warning",e.message.text=`${"You have passed properties which are not supported for the cookie token configuration property:"} ${a.join(",")}`):e.validation="valid",e};validateCookieTokenConfigFields=(t,e)=>(this.keys.forEach(i=>{t[i]?e[i].validation="valid":i==="requestHeaders"&&!this.isServerSide?e[i].validation="valid":e[i].validation="missing"}),e);generateCookieTokenConfigMessages=t=>(Object.keys(t).filter(e=>e!=="validation"&&e!=="message").forEach(e=>{let i=t[e];i.validation==="missing"&&(i.message.text=`${"The following property is missing from the cookieToken object:"} ${e}`,i.message.type="error")}),t);checkCookieTokenConfigMessagesForErrors=t=>(Object.keys(t).filter(e=>e!=="validation"&&e!=="message").forEach(e=>{t[e].validation==="missing"&&(t.validation="invalid",t.message.type="error",t.message.text="The field cookieToken has missing properties")}),t)};var Wi=class extends ht{name={validation:null,message:new pt};credentials={validation:null,message:new pt}};var Nn=class{keys=["name","credentials"];validate=t=>{if(!t.oddClient){let i=new Wi;return i.validation="missing",i.message={type:"warning",text:"If no oddClient is passed the Odds namespace will not work. For more information check our documentation: https://docs.fansunitedmedia.com/docs/javascript-sdk#/"},i}let e=this.validateOddClient(t.oddClient);return e.message.type==="error"||(e=this.validateOddClientConfigFields(t.oddClient,e),e=this.checkOddClientMissingProperties(e),e.message.type==="error")||(e=this.validateOddClientCredentials(t.oddClient.credentials,e)),e};validateOddClient=t=>{let e=new Wi;if(e.message={type:null,text:null},!(t instanceof Object))return e.validation="invalid",e.message.type="error",e.message.text="The oddClient object is not valid. For more information check our documentation: https://docs.fansunitedmedia.com/docs/javascript-sdk#/",e;let a=Object.keys(t).filter(r=>!this.keys.includes(r));return a.length>0?(e.validation="invalid",e.message.type="warning",e.message.text=`${"You have passed properties which are not supported for the odd client configuration property:"} ${a.join(",")}`):e.validation="valid",e};validateOddClientConfigFields=(t,e)=>(this.keys.forEach(i=>{t[i]?e[i].validation="valid":e[i].validation="missing"}),e);validateOddClientCredentials=(t,e)=>{if(!(t instanceof Object))return e.credentials.validation="invalid",e.credentials.message.type="error",e.credentials.message.text="The odd client credentials object is not valid. The odd client will not work without credentials. For more information check our documentation: https://docs.fansunitedmedia.com/docs/javascript-sdk#/",e;let i=Object.keys(t),a=["username","password"],r=a.filter(n=>!i.includes(n));r.length>0&&(e.credentials.validation="invalid",e.credentials.message.type="error",e.credentials.message.text=`${"The following property is missing from the odd client credentials object:"} ${r.join(", ")}`),i.length>0&&r.length===0&&(!t.username||!t.password)&&(e.credentials.validation="invalid",e.credentials.message.type="error",e.credentials.message.text="The odd client credentials object is not valid. The odd client will not work without credentials. For more information check our documentation: https://docs.fansunitedmedia.com/docs/javascript-sdk#/");let o=i.filter(n=>!a.includes(n));return o.length>0&&(e.credentials.validation="invalid",e.credentials.message.type="warning",e.credentials.message.text=`${"You have passed properties which are not supported for the odd client credentials configuration property:"} ${o.join(", ")}`),e};checkOddClientMissingProperties=t=>(Object.keys(t).filter(e=>e!=="validation"&&e!=="message").forEach(e=>{t[e].validation==="missing"&&(t.validation="invalid",t.message.type="error",t.message.text="The field oddClient has missing properties. For more information check our documentation: https://docs.fansunitedmedia.com/docs/javascript-sdk#/")}),t)};var kn=class{validate=t=>{let e=this.checkFieldsForValues(t);return e.isValid=this.containsErrorMessage(e),e};checkFieldsForValues=t=>{let e=new xn,i={apiKey:new Cn,environment:new vn,idSchema:new An,clientId:new Ln,lang:new Sn,errorHandlingMode:new Dn,authProvider:new On,cookieToken:new Bn,oddClient:new Nn};for(let[a,r]of Object.entries(e))a!=="isValid"&&(r=i[a].validate(t));return Object.keys(i).forEach(a=>{e[a]=i[a].validate(t)}),e};containsErrorMessage=t=>{let e=!0;for(let[i,a]of Object.entries(t))if(i!=="authProvider"&&i!=="cookieToken"&&i!=="oddClient"){if(i!=="isValid"&&a.message.type==="error")return e=!1,e;if(i!=="isValid"&&a.message.type==="warning")return e=!0,e}else if(a.message.type==="error"||i==="oddClient"&&a.credentials.message.type==="error")return e=!1,e;return e}};var $c=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},qt=(s,t)=>{let e=[];for(;s.length>t;){let i=s.splice(0,t);e.push(i)}return e.push(s),e},O=(s,t)=>{let e="",i={profile:"https://profile.fansunitedapi.com/v1",football:"https://football.fansunitedapi.com/v1",idMapping:"https://id-mapping.fansunitedapi.com/v1",predictor:"https://prediction.fansunitedapi.com/v1",client:"https://client.fansunitedapi.com/v1",loyalty:"https://loyalty.fansunitedapi.com/v1",miniGames:"https://mini-games.fansunitedapi.com/v1",discussions:"https://discussions.fansunitedapi.com/v1",privateLeagues:"https://private-leagues.fansunitedapi.com/v1",voting:"https://voting.fansunitedapi.com/v1"},a={profile:"https://profile.watg.fansunitedapi.com/v1",football:"https://football.watg.fansunitedapi.com/v1",idMapping:"https://id-mapping.watg.fansunitedapi.com/v1",predictor:"https://prediction.watg.fansunitedapi.com/v1",client:"https://client.watg.fansunitedapi.com/v1",loyalty:"https://loyalty.watg.fansunitedapi.com/v1",miniGames:"https://mini-games.watg.fansunitedapi.com/v1",discussions:"https://discussions.watg.fansunitedapi.com/v1",privateLeagues:"https://private-leagues.watg.fansunitedapi.com/v1",voting:"https://voting.watg.fansunitedapi.com/v1"},r={profile:"https://profile.yolo.fansunitedapi.com/v1",football:"https://football.yolo.fansunitedapi.com/v1",idMapping:"https://id-mapping.yolo.fansunitedapi.com/v1",predictor:"https://prediction.yolo.fansunitedapi.com/v1",client:"https://client.yolo.fansunitedapi.com/v1",loyalty:"https://loyalty.yolo.fansunitedapi.com/v1",miniGames:"https://mini-games.yolo.fansunitedapi.com/v1",discussions:"https://discussions.yolo.fansunitedapi.com/v1",privateLeagues:"https://private-leagues.yolo.fansunitedapi.com/v1",voting:"https://voting.yolo.fansunitedapi.com/v1"},o={profile:"https://profile.cska.fansunitedapi.com/v1",football:"https://football.cska.fansunitedapi.com/v1",idMapping:"https://id-mapping.cska.fansunitedapi.com/v1",predictor:"https://prediction.cska.fansunitedapi.com/v1",client:"https://client.cska.fansunitedapi.com/v1",loyalty:"https://loyalty.cska.fansunitedapi.com/v1",miniGames:"https://mini-games.cska.fansunitedapi.com/v1",discussions:"https://discussions.cska.fansunitedapi.com/v1",privateLeagues:"https://private-leagues.cska.fansunitedapi.com/v1",voting:"https://voting.cska.fansunitedapi.com/v1"},n={profile:"http://localhost:8010/v1",football:"http://localhost:8080/v1",idMapping:"http://localhost:8030/v1",predictor:"http://localhost:8040/v1",client:"http://localhost:8070/v1",loyalty:"http://localhost:8060/v1",miniGames:"http://localhost:9040/v1",discussions:"http://localhost:9020/v1",privateLeagues:"http://localhost:9010/v1",voting:"http://localhost:9030/v1"},l={profile:"https://profile.fansunitedstagingapi.com/v1",football:"https://football.fansunitedstagingapi.com/v1",idMapping:"https://id-mapping.fansunitedstagingapi.com/v1",predictor:"https://prediction.fansunitedstagingapi.com/v1",client:"https://client.fansunitedstagingapi.com/v1",loyalty:"https://loyalty.fansunitedstagingapi.com/v1",miniGames:"https://mini-games.fansunitedstagingapi.com/v1",discussions:"https://discussions.fansunitedstagingapi.com/v1",privateLeagues:"https://private-leagues.fansunitedstagingapi.com/v1",voting:"https://voting.fansunitedstagingapi.com/v1"};return s==="prod"?e=i[t]:s==="dev"?e=n[t]:s==="watg"?e=a[t]:s==="yolo"?e=r[t]:s==="cska"?e=o[t]:e=l[t],e},pe=s=>Array.from(new Set(s)),f=s=>s||!1,m=()=>`&disable_cache=${Date.now()}`,$p=s=>JSON.parse(JSON.stringify(s.sort((t,e)=>t.localeCompare(e))));var at=(P=>(P.FT_1X2="FT_1X2",P.HT_1X2="HT_1X2",P.BOTH_TEAMS_SCORE="BOTH_TEAMS_SCORE",P.DOUBLE_CHANCE="DOUBLE_CHANCE",P.HT_FT="HT_FT",P.PLAYER_SCORE="PLAYER_SCORE",P.PLAYER_YELLOW_CARD="PLAYER_YELLOW_CARD",P.PLAYER_RED_CARD="PLAYER_RED_CARD",P.RED_CARD_MATCH="RED_CARD_MATCH",P.PENALTY_MATCH="PENALTY_MATCH",P.PLAYER_SCORE_FIRST_GOAL="PLAYER_SCORE_FIRST_GOAL",P.CORNERS_MATCH="CORNERS_MATCH",P.CORRECT_SCORE="CORRECT_SCORE",P.CORRECT_SCORE_ADVANCED="CORRECT_SCORE_ADVANCED",P.CORRECT_SCORE_HT="CORRECT_SCORE_HT",P.PLAYER_SCORE_HATTRICK="PLAYER_SCORE_HATTRICK",P.PLAYER_SCORE_TWICE="PLAYER_SCORE_TWICE",P.OVER_GOALS_0_5="OVER_GOALS_0_5",P.OVER_GOALS_1_5="OVER_GOALS_1_5",P.OVER_GOALS_2_5="OVER_GOALS_2_5",P.OVER_GOALS_3_5="OVER_GOALS_3_5",P.OVER_GOALS_4_5="OVER_GOALS_4_5",P.OVER_GOALS_5_5="OVER_GOALS_5_5",P.OVER_GOALS_6_5="OVER_GOALS_6_5",P.OVER_CORNERS_6_5="OVER_CORNERS_6_5",P.OVER_CORNERS_7_5="OVER_CORNERS_7_5",P.OVER_CORNERS_8_5="OVER_CORNERS_8_5",P.OVER_CORNERS_9_5="OVER_CORNERS_9_5",P.OVER_CORNERS_10_5="OVER_CORNERS_10_5",P.OVER_CORNERS_11_5="OVER_CORNERS_11_5",P.OVER_CORNERS_12_5="OVER_CORNERS_12_5",P.OVER_CORNERS_13_5="OVER_CORNERS_13_5",P))(at||{}),cu=["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"],uu=["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"],It=["PLAYER_RED_CARD","PLAYER_SCORE","PLAYER_SCORE_FIRST_GOAL","PLAYER_SCORE_HATTRICK","PLAYER_SCORE_TWICE","PLAYER_YELLOW_CARD"],du=["FT_1X2","HT_1X2","HT_FT","DOUBLE_CHANCE","CORNERS_MATCH","CORRECT_SCORE","CORRECT_SCORE_HT","CORRECT_SCORE_ADVANCED"],Ki="PLAYER_SCORE_FIRST_GOAL";var ji=class{id="";achievedAt=""};var ce=class{participationCount=null;points=null};var ue=class{totalPoints=null;postPoints=null;postsMade=null;reactionPoints=null;reactionCount=null};var de=class{participationCount=null};var mi=class{participations=0;points=0};var Qt=class{footballCompetitions=[];footballTeams=[]};var me=class{predictionsMade=0;correct=0;points=0;breakdown=new Qt};var he=class{single=new me;topX=new mi;matchQuiz=new mi};var Yi=class{overallPercent;byFootballCompetition;byFootballTeam;byFootballMarket};var Xi=class{profileId;tier;points;predictionsMade;successRates=new Yi;predictions=new he;tiers=[];badges=[];discussions=new ue;classicQuizzes=new ce;eitherOr=new de};var Ji=class{entityId="";entityType="";entitySource="";model=null;predictionsMade=0;correct=0;points=0};var Zi=class{successRatePercent;model=null};var Ct=class{content=null;tags=[];campaign=null};var fe=class{id=null;profileId=null;property=null;value=null;action=null;context=new Ct;points=0};var Y=class{currentPage=null;itemsPerPage=null;totalItems=null;numberOfPages=null};var k=class{pagination=new Y};var ta=class{meta=new k;data=[new fe]};var Gn=class{remapSingleResponse=t=>{let e=new fe;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 ta;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 Xi;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)},at[i]&&delete e[i].model});else return t;return e};remapSuccessRatePercent=t=>{let e=new Zi;return e.successRatePercent=t.success_rate_percent,e};remapPredictionsStats=t=>{let e=new he;return e.single=this.remapSinglePredictionsStats(t.single),e.topX=t.top_x,e.matchQuiz=t.match_quiz,e};remapSinglePredictionsStats=t=>{let e=new me;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 Qt,i=[],a=[];return Object.keys(t).forEach(r=>{let o=new Ji;o.entityId=r,o.entityType=t[r].entity_type,o.entitySource=t[r].entity_source,o.predictionsMade=t[r].predictions_made,o.correct=t[r].correct,o.points=t[r].points,o.entityType==="competition"?i.push(o):o.entityType==="team"&&a.push(o)}),e.footballCompetitions=i,e.footballTeams=a,e}return new Qt};remapAchievementsStats=t=>t.map(e=>{let i=new ji;return i.id=e.id,i.achievedAt=e.achieved_at,i});remapDiscussionStats=t=>{let e=new ue;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 ce;return e.participationCount=t.participation_count,e.points=t.points,e};remapEitherOrStats=t=>{let e=new de;return e.participationCount=t.participation_count,e}};function zc(s){this.message=s}zc.prototype=new Error,zc.prototype.name="InvalidCharacterError";var mu=typeof window<"u"&&window.atob&&window.atob.bind(window)||function(s){var t=String(s).replace(/=+$/,"");if(t.length%4==1)throw new zc("'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 sd(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(mu(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 mu(t)}}function zp(s){this.message=s}function nd(s,t){if(typeof s!="string")throw new zp("Invalid token specified");var e=(t=t||{}).header===!0?0:1;try{return JSON.parse(sd(s.split(".")[e]))}catch(i){throw new zp("Invalid token specified: "+i.message)}}zp.prototype=new Error,zp.prototype.name="InvalidTokenError";var qc=nd;var C=(a=>(a[a.BAD_METHOD_CALL=400]="BAD_METHOD_CALL",a[a.UNAUTHORIZED=401]="UNAUTHORIZED",a[a.NOT_FOUND=404]="NOT_FOUND",a[a.PRECONDITION_FAILED=412]="PRECONDITION_FAILED",a))(C||{});var A=(E=>(E.INVALID_TEMPLATE="INVALID_TEMPLATE",E.INVALID_PREDICTION="INVALID_PREDICTION",E.INVALID_MARKET="INVALID_MARKET",E.INVALID_FIELD="INVALID_FIELD",E.INVALID_TYPE="INVALID_TYPE",E.EXCEEDED_LENGTH="EXCEEDED_LENGTH",E.INVALID_TOKEN="invalid_token",E.UNAUTHORIZED="unauthorized",E.INVALID_FILTERS="invalid_filters",E.INVALID_AVATAR="invalid_avatar",E.INVALID_METHOD_CALL="invalid_method_call",E.INVALID_LIMIT="invalid_limit",E.INVALID_TEMPLATE_GROUP_ID="invalid_template_group_id",E.INVALID_TEMPLATE_GROUP_FILTERS="invalid_template_group_filters",E.INVALID_PAGE_NUMBER="invalid_page_number",E.INVALID_DISCUSSION_IDS="invalid_discussion_ids",E.ID_MAPPING_NOT_FOUND="id_mapping_not_found",E.INVALID_COMPETITION_ID="invalid_competition_id",E.INVALID_TEAM_ID="invalid_team_id",E.INVALID_IDS="invalid_ids",E.INVALID_INPUT_PROVIDER="invalid_input_provider",E.INVALID_OUTPUT_PROVIDER="invalid_output_provider",E.INVALID_MATCH_SUMMARY="invalid_match_summary",E.INVALID_MATCH_SUMMARY_PREDICTIONS="invalid_match_summary_predictions",E.INVALID_MATCH_SUMMARY_PREDICTIONS_KEYS="invalid_match_summary_predictions_keys",E.ENTITY_IDS_NOT_FOUND="entity_ids_not_found",E.MATCH_IDS_NOT_FOUND="match_ids_not_found",E.INVALID_MATCH_IDS="invalid_match_ids",E.ODD_CLIENT_CONFIGURATION_NOT_FOUND="odd_client_configuration_not_found",E))(A||{});var G={native:"id",sportradar:"sportradar_id",sportal365:"sportal365_id",enetpulse:"enetpulse_id",api_football:"api_football_id"},Qc={PREDICTOR_USER_RELATED_OPERATION:"https://docs.fansunitedmedia.com/docs/predictor-operations#user-related-operations"},Wc=["matchId","matchType","market","prediction"],hu=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 x=(I=>(I.INVALID_MATCH_ID="Match id is invalid!",I.INVALID_PLAYER_ID="Player id is invalid!",I.QUERY_PARAM_MATCH_IDS_EXCEEDED="Maximum matchIds in PredictionFilters should be 10 or less.",I.QUERY_PARAM_FILTERS_LIMIT_EXCEEDED="Maximum limit for filtering games is 50 or less.",I.INVALID_FIXTURES_FIELD="Fixtures field is invalid. For more information please visit our documentation",I.INVALID_TOKEN="Invalid JWT token is provided",I.EXPIRED_TOKEN="The provided JWT token is expired",I.ENTITIES_NEEDED="At least one of footballCompetitions, footballTeams or footballPlayers properties should be provided for filters.",I.ENTITIES_FOLLOWS_FILTERS_EXCEEDED="Maximum length per entity should be 24 or less.",I.INVALID_TYPE="You have provided invalid type. The valid type is ",I.INVALID_VALUE="You have provided invalid value. The valid value is ",I.INVALID_AVATAR="Invalid URL syntax for avatar image.",I.INVALID_GET_PROFILES_METHOD_CALL="The method 'getByIds' from Profile namespace is not called correctly. You need to provide 'profileIds' OR 'search' parameters to the method, but you can't use both of them or neither of them.",I.INVALID_LIMIT="Invalid limit. The maximum limit is: ",I.INVALID_LIMIT_TYPE="Invalid limit type. The proper type is number.",I.FILTER_COMBINATION_ERROR="You need to use both 'entityIds' and 'entityType' filters together",I.INVALID_ENTITY_TYPE="Invalid 'entityType' filter. Please use one of the following valid options: competition, team, or player",I.INVALID_TEMPLATE_GROUP_ID="There is no group in this template with the provided groupId",I.INVALID_TEMPLATE_GROUP_FILTERS="The provided template group has no filters",I.INVALID_PAGE_NUMBER="Invalid page number provided. Use number between 1 and max number of pages.",I.INVALID_DISCUSSION_IDS="Invalid discussion ids argument. Please provide at least one discussion id in an array",I.EXCEEDED_DISCUSSION_IDS="Maximum number of discussion ids exceeded. The maximum number of discussion ids is 50. You can use 'getPostsCountExtended' method for more than 50 discussion ids.",I.EXCEEDED_EXTENDED_DISCUSSION_IDS="Maximum number of discussion ids exceeded. The maximum number of discussion ids is: ",I.ID_MAPPING_NOT_FOUND="No ID mappings are available for the provided ID. ID argument: ",I.INVALID_PARAM="Invalid parameter provided. Please check the following parameter: ",I.INVALID_COMPETITION_ID="Invalid competition ID provided. Please provide a valid competition ID.",I.INVALID_TEAM_ID="Invalid team ID provided. Please provide a valid team ID.",I.INVALID_OR_EMPTY_IDS="Invalid or empty IDs provided. Please provide at least one ID.",I.INVALID_PROVIDER="Invalid provider. The valid providers are: 'native', 'enetpulse', 'sportal365', 'sportradar' and 'api_football'.",I.INVALID_OUTPUT_PROVIDER="Invalid output provider. The output can not be the same as the input provider.",I.MATCH_SUMMARY_REQUIRED="Match summary is required.",I.MATCH_SUMMARY_PREDICTIONS_REQUIRED="Predictions in match summary are required.",I.INVALID_MATCH_SUMMARY_PREDICTIONS_KEYS="Keys in predictions in match summary are invalid. The valid ones are: ",I.INVALID_COLLECT_LEAD_METHOD_CALL="The method 'collectLead' from Profile namespace is not called correctly. You need to provide 'requestBody' parameter to the method.",I.REQUIRED_FIXTURES_FIELD="Fixtures field is required and should contain at least one fixtures object. For more information please visit our documentation",I.INVALID_TIEBREAKER_FIELD="Tiebreaker field is invalid. It should contain statTotal key with integer value. For more information please visit our documentation",I.ENTITY_IDS_NOT_FOUND="Some of the sport entity IDs were not found for the provided id schema",I.MATCH_IDS_NOT_FOUND="Some of the match IDs were not found for the provided id schema",I.INVALID_STANDING_PREDICTION_ARGUMENT="The prediction argument is invalid. For more information please visit our documentation",I.INVALID_MAP_PLAYERS_ROLES_KEYS="The keys in the players roles map are not part of the valid keys. The valid keys are: ",I.INVALID_MAP_PLAYERS_ROLES_VALUES="The values in the map are not valid. The valid ones are: ",I.INVALID_MATCH_IDS="Match IDs are invalid!",I.MISSING_ODD_CLIENT_CONFIGURATION="Odds namespace requires oddClient configuration to be set",I))(x||{}),Kc={UNEXPECTED_STATUS_PROP:`Unexpected provided property 'status'. You can NOT use this property for this method. For more information visit our documentation:
1
+ var Ku=Object.create;var Vp=Object.defineProperty;var ju=Object.getOwnPropertyDescriptor;var Yu=Object.getOwnPropertyNames;var Xu=Object.getPrototypeOf,Ju=Object.prototype.hasOwnProperty;var Zu=(s,t,e)=>t in s?Vp(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e;var td=(s,t)=>()=>(s&&(t=s(s=0)),t);var Rn=(s,t)=>()=>(t||s((t={exports:{}}).exports,t),t.exports),ed=(s,t)=>{for(var e in t)Vp(s,e,{get:t[e],enumerable:!0})},id=(s,t,e,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of Yu(t))!Ju.call(s,a)&&a!==e&&Vp(s,a,{get:()=>t[a],enumerable:!(i=ju(t,a))||i.enumerable});return s};var ad=(s,t,e)=>(e=s!=null?Ku(Xu(s)):{},id(t||!s||!s.__esModule?Vp(e,"default",{value:s,enumerable:!0}):e,s));var it=(s,t,e)=>(Zu(s,typeof t!="symbol"?t+"":t,e),e);var Iu={};ed(Iu,{default:()=>pd});var ld,pd,wu=td(()=>{ld={getItem:async()=>null,setItem:async()=>null,removeItem:async()=>null,clear:async()=>null,getAllKeys:async()=>[],multiGet:async()=>[],multiSet:async()=>null,multiRemove:async()=>null,mergeItem:async()=>null,multiMerge:async()=>null},pd=ld});var _u=Rn((Rf,Wp)=>{var cd=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,M,_){typeof u=="object"&&(d=u.depth,M=u.prototype,_=u.includeNonEnumerable,u=u.circular);var B=[],ui=[],di=typeof Buffer<"u";typeof u>"u"&&(u=!0),typeof d>"u"&&(d=1/0);function lt(g,$t){if(g===null)return null;if($t===0)return g;var U,Pn;if(typeof g!="object")return g;if(s(g,t))U=new t;else if(s(g,e))U=new e;else if(s(g,i))U=new i(function(Tn,P){g.then(function(En){Tn(lt(En,$t-1))},function(En){P(lt(En,$t-1))})});else if(a.__isArray(g))U=[];else if(a.__isRegExp(g))U=new RegExp(g.source,p(g)),g.lastIndex&&(U.lastIndex=g.lastIndex);else if(a.__isDate(g))U=new Date(g.getTime());else{if(di&&Buffer.isBuffer(g))return Buffer.allocUnsafe?U=Buffer.allocUnsafe(g.length):U=new Buffer(g.length),g.copy(U),U;s(g,Error)?U=Object.create(g):typeof M>"u"?(Pn=Object.getPrototypeOf(g),U=Object.create(Pn)):(U=Object.create(M),Pn=M)}if(u){var lu=B.indexOf(g);if(lu!=-1)return ui[lu];B.push(g),ui.push(U)}s(g,t)&&g.forEach(function(Tn,P){var En=lt(P,$t-1),Wu=lt(Tn,$t-1);U.set(En,Wu)}),s(g,e)&&g.forEach(function(Tn){var P=lt(Tn,$t-1);U.add(P)});for(var Mt in g){var F;Pn&&(F=Object.getOwnPropertyDescriptor(Pn,Mt)),!(F&&F.set==null)&&(U[Mt]=lt(g[Mt],$t-1))}if(Object.getOwnPropertySymbols)for(var pu=Object.getOwnPropertySymbols(g),Mt=0;Mt<pu.length;Mt++){var Gp=pu[Mt],$i=Object.getOwnPropertyDescriptor(g,Gp);$i&&!$i.enumerable&&!_||(U[Gp]=lt(g[Gp],$t-1),$i.enumerable||Object.defineProperty(U,Gp,{enumerable:!1}))}if(_)for(var E=Object.getOwnPropertyNames(g),Mt=0;Mt<E.length;Mt++){var Up=E[Mt],$i=Object.getOwnPropertyDescriptor(g,Up);$i&&$i.enumerable||(U[Up]=lt(g[Up],$t-1),Object.defineProperty(U,Up,{enumerable:!1}))}return U}return lt(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 Wp=="object"&&Wp.exports&&(Wp.exports=cd)});var xu=Rn((Ff,Zc)=>{"use strict";var oa=typeof Reflect=="object"?Reflect:null,Pu=oa&&typeof oa.apply=="function"?oa.apply:function(t,e,i){return Function.prototype.apply.call(t,e,i)},Kp;oa&&typeof oa.ownKeys=="function"?Kp=oa.ownKeys:Object.getOwnPropertySymbols?Kp=function(t){return Object.getOwnPropertyNames(t).concat(Object.getOwnPropertySymbols(t))}:Kp=function(t){return Object.getOwnPropertyNames(t)};function ud(s){console&&console.warn&&console.warn(s)}var Eu=Number.isNaN||function(t){return t!==t};function S(){S.init.call(this)}Zc.exports=S;Zc.exports.once=fd;S.EventEmitter=S;S.prototype._events=void 0;S.prototype._eventsCount=0;S.prototype._maxListeners=void 0;var Tu=10;function jp(s){if(typeof s!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof s)}Object.defineProperty(S,"defaultMaxListeners",{enumerable:!0,get:function(){return Tu},set:function(s){if(typeof s!="number"||s<0||Eu(s))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+s+".");Tu=s}});S.init=function(){(this._events===void 0||this._events===Object.getPrototypeOf(this)._events)&&(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0};S.prototype.setMaxListeners=function(t){if(typeof t!="number"||t<0||Eu(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 Ru(s){return s._maxListeners===void 0?S.defaultMaxListeners:s._maxListeners}S.prototype.getMaxListeners=function(){return Ru(this)};S.prototype.emit=function(t){for(var e=[],i=1;i<arguments.length;i++)e.push(arguments[i]);var a=t==="error",r=this._events;if(r!==void 0)a=a&&r.error===void 0;else if(!a)return!1;if(a){var o;if(e.length>0&&(o=e[0]),o instanceof Error)throw o;var n=new Error("Unhandled error."+(o?" ("+o.message+")":""));throw n.context=o,n}var l=r[t];if(l===void 0)return!1;if(typeof l=="function")Pu(l,this,e);else for(var p=l.length,c=Au(l,p),i=0;i<p;++i)Pu(c[i],this,e);return!0};function Fu(s,t,e,i){var a,r,o;if(jp(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=Ru(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,ud(n)}return s}S.prototype.addListener=function(t,e){return Fu(this,t,e,!1)};S.prototype.on=S.prototype.addListener;S.prototype.prependListener=function(t,e){return Fu(this,t,e,!0)};function dd(){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 Su(s,t,e){var i={fired:!1,wrapFn:void 0,target:s,type:t,listener:e},a=dd.bind(i);return a.listener=e,i.wrapFn=a,a}S.prototype.once=function(t,e){return jp(e),this.on(t,Su(this,t,e)),this};S.prototype.prependOnceListener=function(t,e){return jp(e),this.prependListener(t,Su(this,t,e)),this};S.prototype.removeListener=function(t,e){var i,a,r,o,n;if(jp(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():md(i,r),i.length===1&&(a[t]=i[0]),a.removeListener!==void 0&&this.emit("removeListener",t,n||e)}return this};S.prototype.off=S.prototype.removeListener;S.prototype.removeAllListeners=function(t){var e,i,a;if(i=this._events,i===void 0)return this;if(i.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):i[t]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete i[t]),this;if(arguments.length===0){var r=Object.keys(i),o;for(a=0;a<r.length;++a)o=r[a],o!=="removeListener"&&this.removeAllListeners(o);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if(e=i[t],typeof e=="function")this.removeListener(t,e);else if(e!==void 0)for(a=e.length-1;a>=0;a--)this.removeListener(t,e[a]);return this};function vu(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?hd(a):Au(a,a.length)}S.prototype.listeners=function(t){return vu(this,t,!0)};S.prototype.rawListeners=function(t){return vu(this,t,!1)};S.listenerCount=function(s,t){return typeof s.listenerCount=="function"?s.listenerCount(t):Cu.call(s,t)};S.prototype.listenerCount=Cu;function Cu(s){var t=this._events;if(t!==void 0){var e=t[s];if(typeof e=="function")return 1;if(e!==void 0)return e.length}return 0}S.prototype.eventNames=function(){return this._eventsCount>0?Kp(this._events):[]};function Au(s,t){for(var e=new Array(t),i=0;i<t;++i)e[i]=s[i];return e}function md(s,t){for(;t+1<s.length;t++)s[t]=s[t+1];s.pop()}function hd(s){for(var t=new Array(s.length),e=0;e<t.length;++e)t[e]=s[e].listener||s[e];return t}function fd(s,t){return new Promise(function(e,i){function a(o){s.removeListener(t,r),i(o)}function r(){typeof s.removeListener=="function"&&s.removeListener("error",a),e([].slice.call(arguments))}Ou(s,t,r,{once:!0}),t!=="error"&&gd(s,a,{once:!0})})}function gd(s,t,e){typeof s.on=="function"&&Ou(s,"error",t,e)}function Ou(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 Bu=Rn((Lu,Du)=>{(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=_u(),s=xu().EventEmitter,Du.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,M,_,B;if(_=u,[...u]=_,[d]=i.call(u,-1),typeof d=="function")try{B=c(...u),d(null,B)}catch(ui){M=ui,d(M)}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,M,_;if(a(this,o),!Array.isArray(l))throw p=this._error("EKEYSTYPE"),p;for(_={},u=0,M=l.length;u<M;u++){if(d=l[u],(c=this._isInvalidKey(d))!=null)throw c;this.data[d]!=null&&this._check(d,this.data[d])?(this.stats.hits++,_[d]=this._unwrap(this.data[d])):this.stats.misses++}return _}set(l,p,c){var u,d,M;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 M=!1,this.data[l]&&(M=!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),M||(this.stats.ksize+=this._getKeyLength(l),this.stats.keys++),this.emit("set",l,p),!0}mset(l){var p,c,u,d,M,_,B,ui,di,lt;if(a(this,o),this.options.maxKeys>-1&&this.stats.keys+l.length>=this.options.maxKeys)throw p=this._error("ECACHEFULL"),p;for(u=0,B=l.length;u<B;u++){if(_=l[u],{key:M,val:lt,ttl:di}=_,di&&typeof di!="number")throw p=this._error("ETTLTYPE"),p;if((c=this._isInvalidKey(M))!=null)throw c}for(d=0,ui=l.length;d<ui;d++)_=l[d],{key:M,val:lt,ttl:di}=_,this.set(M,lt,di);return!0}del(l){var p,c,u,d,M,_;for(a(this,o),Array.isArray(l)||(l=[l]),p=0,u=0,M=l.length;u<M;u++){if(d=l[u],(c=this._isInvalidKey(d))!=null)throw c;this.data[d]!=null&&(this.stats.vsize-=this._getValLength(this._unwrap(this.data[d],!1)),this.stats.ksize-=this._getKeyLength(d),this.stats.keys--,p++,_=this.data[d],delete this.data[d],this.emit("del",d,_.v))}return p}take(l){var p;return a(this,o),p=this.get(l),p!=null&&this.del(l),p}ttl(l,p){var c;if(a(this,o),p||(p=this.options.stdTTL),!l)return!1;if((c=this._isInvalidKey(l))!=null)throw c;return this.data[l]!=null&&this._check(l,this.data[l])?(p>=0?this.data[l]=this._wrap(this.data[l].v,p,!1):this.del(l),!0):!1}getTtl(l){var p,c;if(a(this,o),!!l){if((c=this._isInvalidKey(l))!=null)throw c;if(this.data[l]!=null&&this._check(l,this.data[l]))return p=this.data[l].t,p}}keys(){var l;return a(this,o),l=Object.keys(this.data),l}has(l){var p;return a(this,o),p=this.data[l]!=null&&this._check(l,this.data[l]),p}getStats(){return a(this,o),this.stats}flushAll(l=!0){a(this,o),this.data={},this.stats={hits:0,misses:0,keys:0,ksize:0,vsize:0},this._killCheckPeriod(),this._checkData(l),this.emit("flush")}flushStats(){a(this,o),this.stats={hits:0,misses:0,keys:0,ksize:0,vsize:0},this.emit("flush_stats")}close(){a(this,o),this._killCheckPeriod()}_checkData(l=!0){var p,c,u;a(this,o),c=this.data;for(p in c)u=c[p],this._check(p,u);l&&this.options.checkperiod>0&&(this.checkTimeout=setTimeout(this._checkData,this.options.checkperiod*1e3,l),this.checkTimeout!=null&&this.checkTimeout.unref!=null&&this.checkTimeout.unref())}_killCheckPeriod(){if(this.checkTimeout!=null)return clearTimeout(this.checkTimeout)}_check(l,p){var c;return a(this,o),c=!0,p.t!==0&&p.t<Date.now()&&(this.options.deleteOnExpire&&(c=!1,this.del(l)),this.emit("expired",l,this._unwrap(p))),c}_isInvalidKey(l){var p;if(a(this,o),p=typeof l,r.call(this.validKeyTypes,p)<0)return this._error("EKEYTYPE",{type:typeof l})}_wrap(l,p,c=!0){var u,d,M,_;return a(this,o),this.options.useClones||(c=!1),d=Date.now(),u=0,_=1e3,p===0?u=0:p?u=d+p*_:this.options.stdTTL===0?u=this.options.stdTTL:u=d+this.options.stdTTL*_,M={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(Lu)});var Gu=Rn((Nu,ku)=>{(function(){var s;s=ku.exports=Bu(),s.version="5.1.2"}).call(Nu)});var qu=Rn((uj,Td)=>{Td.exports={name:"fansunited-sdk-esm",version:"1.113.3",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 Fn=(_=>(_.EN="en",_.BG="bg",_.RO="ro",_.EL="el",_.SK="sk",_.PT="pt",_.SR="sr",_.HU="hu",_.SV="sv",_.ES="es",_.FR="fr",_.NL="nl",_.DE="de",_.IT="it",_))(Fn||{});var Sn=class{validate=t=>{let e=this.validateField(t.lang),i=this.generateMessage(e);return{validation:e,message:i}};validateField=t=>{let e=Object.values(Fn),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 zi=(o=>(o.DEV="dev",o.PROD="prod",o.STAGING="staging",o.WATG="watg",o.YOLO="yolo",o.CSKA="cska",o))(zi||{});var vn=class{validate(t){let e=this.validateField(t.environment),i=this.generateMessage(e);return{validation:e,message:i}}validateField=t=>{let e=Object.values(zi),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 Cn=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 An=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 le=class{getIdToken=null;logout=null};var pt=class{text=null;type=null};var qi=class{validation=null;message=new pt;getIdToken={validation:null,message:new pt};logout={validation:null,message:new pt}};var On=class{validate(t){if(t.cookieToken)return new qi;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 le),i=new qi;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 le).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 ht=class{validation;message};var xn=class{apiKey=null;environment=null;idSchema=null;clientId=null;lang=null;errorHandlingMode=null;cookieToken={name:new ht,requestHeaders:new ht};oddClient=null;authProvider={getIdToken:new ht,logout:new ht};isValid=!1};var Ln=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 Hp=(e=>(e.DEFAULT="default",e.STANDARD="standard",e))(Hp||{});var Dn=class{validate=t=>{let e=this.validateField(t.errorHandlingMode),i=this.generateMessage(e);return{validation:e,message:i}};validateField=t=>{let e=["default","standard"],i=null;return t?e.includes(t)?i="valid":i="invalid":i="missing",i};generateMessage=t=>{let e=null,i="warning";return t==="missing"&&(e="If no errorHandlingMode is passed the default one will be set which is: default"),t==="invalid"&&(e="This errorHandlingMode value is not supported, the default one will be set which is: default"),t==="valid"&&(e=null,i=null),{text:e,type:i}}};var Qi=class extends ht{name={validation:null,message:new pt};requestHeaders={validation:null,message:new pt}};var Bn=class{keys=["name","requestHeaders"];isServerSide=typeof document>"u";validate(t){if(!t.cookieToken){let i=new Qi;return i.message={type:null,text:null},i.validation="valid",i}let e=this.validateCookieToken(t.cookieToken);return e=this.validateCookieTokenConfigFields(t.cookieToken,e),e=this.generateCookieTokenConfigMessages(e),e=this.checkCookieTokenConfigMessagesForErrors(e),e}validateCookieToken=t=>{let e=new Qi;e.message={type:null,text:null};let a=Object.keys(t).filter(r=>!this.keys.includes(r));return a.length>0?(e.validation="invalid",e.message.type="warning",e.message.text=`${"You have passed properties which are not supported for the cookie token configuration property:"} ${a.join(",")}`):e.validation="valid",e};validateCookieTokenConfigFields=(t,e)=>(this.keys.forEach(i=>{t[i]?e[i].validation="valid":i==="requestHeaders"&&!this.isServerSide?e[i].validation="valid":e[i].validation="missing"}),e);generateCookieTokenConfigMessages=t=>(Object.keys(t).filter(e=>e!=="validation"&&e!=="message").forEach(e=>{let i=t[e];i.validation==="missing"&&(i.message.text=`${"The following property is missing from the cookieToken object:"} ${e}`,i.message.type="error")}),t);checkCookieTokenConfigMessagesForErrors=t=>(Object.keys(t).filter(e=>e!=="validation"&&e!=="message").forEach(e=>{t[e].validation==="missing"&&(t.validation="invalid",t.message.type="error",t.message.text="The field cookieToken has missing properties")}),t)};var Wi=class extends ht{name={validation:null,message:new pt};credentials={validation:null,message:new pt}};var Nn=class{keys=["name","credentials"];validate=t=>{if(!t.oddClient){let i=new Wi;return i.validation="missing",i.message={type:"warning",text:"If no oddClient is passed the Odds namespace will not work. For more information check our documentation: https://docs.fansunitedmedia.com/docs/javascript-sdk#/"},i}let e=this.validateOddClient(t.oddClient);return e.message.type==="error"||(e=this.validateOddClientConfigFields(t.oddClient,e),e=this.checkOddClientMissingProperties(e),e.message.type==="error")||(e=this.validateOddClientCredentials(t.oddClient.credentials,e)),e};validateOddClient=t=>{let e=new Wi;if(e.message={type:null,text:null},!(t instanceof Object))return e.validation="invalid",e.message.type="error",e.message.text="The oddClient object is not valid. For more information check our documentation: https://docs.fansunitedmedia.com/docs/javascript-sdk#/",e;let a=Object.keys(t).filter(r=>!this.keys.includes(r));return a.length>0?(e.validation="invalid",e.message.type="warning",e.message.text=`${"You have passed properties which are not supported for the odd client configuration property:"} ${a.join(",")}`):e.validation="valid",e};validateOddClientConfigFields=(t,e)=>(this.keys.forEach(i=>{t[i]?e[i].validation="valid":e[i].validation="missing"}),e);validateOddClientCredentials=(t,e)=>{if(!(t instanceof Object))return e.credentials.validation="invalid",e.credentials.message.type="error",e.credentials.message.text="The odd client credentials object is not valid. The odd client will not work without credentials. For more information check our documentation: https://docs.fansunitedmedia.com/docs/javascript-sdk#/",e;let i=Object.keys(t),a=["username","password"],r=a.filter(n=>!i.includes(n));r.length>0&&(e.credentials.validation="invalid",e.credentials.message.type="error",e.credentials.message.text=`${"The following property is missing from the odd client credentials object:"} ${r.join(", ")}`),i.length>0&&r.length===0&&(!t.username||!t.password)&&(e.credentials.validation="invalid",e.credentials.message.type="error",e.credentials.message.text="The odd client credentials object is not valid. The odd client will not work without credentials. For more information check our documentation: https://docs.fansunitedmedia.com/docs/javascript-sdk#/");let o=i.filter(n=>!a.includes(n));return o.length>0&&(e.credentials.validation="invalid",e.credentials.message.type="warning",e.credentials.message.text=`${"You have passed properties which are not supported for the odd client credentials configuration property:"} ${o.join(", ")}`),e};checkOddClientMissingProperties=t=>(Object.keys(t).filter(e=>e!=="validation"&&e!=="message").forEach(e=>{t[e].validation==="missing"&&(t.validation="invalid",t.message.type="error",t.message.text="The field oddClient has missing properties. For more information check our documentation: https://docs.fansunitedmedia.com/docs/javascript-sdk#/")}),t)};var kn=class{validate=t=>{let e=this.checkFieldsForValues(t);return e.isValid=this.containsErrorMessage(e),e};checkFieldsForValues=t=>{let e=new xn,i={apiKey:new Cn,environment:new vn,idSchema:new An,clientId:new Ln,lang:new Sn,errorHandlingMode:new Dn,authProvider:new On,cookieToken:new Bn,oddClient:new Nn};for(let[a,r]of Object.entries(e))a!=="isValid"&&(r=i[a].validate(t));return Object.keys(i).forEach(a=>{e[a]=i[a].validate(t)}),e};containsErrorMessage=t=>{let e=!0;for(let[i,a]of Object.entries(t))if(i!=="authProvider"&&i!=="cookieToken"&&i!=="oddClient"){if(i!=="isValid"&&a.message.type==="error")return e=!1,e;if(i!=="isValid"&&a.message.type==="warning")return e=!0,e}else if(a.message.type==="error"||i==="oddClient"&&a.credentials.message.type==="error")return e=!1,e;return e}};var $c=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},qt=(s,t)=>{let e=[];for(;s.length>t;){let i=s.splice(0,t);e.push(i)}return e.push(s),e},O=(s,t)=>{let e="",i={profile:"https://profile.fansunitedapi.com/v1",football:"https://football.fansunitedapi.com/v1",idMapping:"https://id-mapping.fansunitedapi.com/v1",predictor:"https://prediction.fansunitedapi.com/v1",client:"https://client.fansunitedapi.com/v1",loyalty:"https://loyalty.fansunitedapi.com/v1",miniGames:"https://mini-games.fansunitedapi.com/v1",discussions:"https://discussions.fansunitedapi.com/v1",privateLeagues:"https://private-leagues.fansunitedapi.com/v1",voting:"https://voting.fansunitedapi.com/v1"},a={profile:"https://profile.watg.fansunitedapi.com/v1",football:"https://football.watg.fansunitedapi.com/v1",idMapping:"https://id-mapping.watg.fansunitedapi.com/v1",predictor:"https://prediction.watg.fansunitedapi.com/v1",client:"https://client.watg.fansunitedapi.com/v1",loyalty:"https://loyalty.watg.fansunitedapi.com/v1",miniGames:"https://mini-games.watg.fansunitedapi.com/v1",discussions:"https://discussions.watg.fansunitedapi.com/v1",privateLeagues:"https://private-leagues.watg.fansunitedapi.com/v1",voting:"https://voting.watg.fansunitedapi.com/v1"},r={profile:"https://profile.yolo.fansunitedapi.com/v1",football:"https://football.yolo.fansunitedapi.com/v1",idMapping:"https://id-mapping.yolo.fansunitedapi.com/v1",predictor:"https://prediction.yolo.fansunitedapi.com/v1",client:"https://client.yolo.fansunitedapi.com/v1",loyalty:"https://loyalty.yolo.fansunitedapi.com/v1",miniGames:"https://mini-games.yolo.fansunitedapi.com/v1",discussions:"https://discussions.yolo.fansunitedapi.com/v1",privateLeagues:"https://private-leagues.yolo.fansunitedapi.com/v1",voting:"https://voting.yolo.fansunitedapi.com/v1"},o={profile:"https://profile.cska.fansunitedapi.com/v1",football:"https://football.cska.fansunitedapi.com/v1",idMapping:"https://id-mapping.cska.fansunitedapi.com/v1",predictor:"https://prediction.cska.fansunitedapi.com/v1",client:"https://client.cska.fansunitedapi.com/v1",loyalty:"https://loyalty.cska.fansunitedapi.com/v1",miniGames:"https://mini-games.cska.fansunitedapi.com/v1",discussions:"https://discussions.cska.fansunitedapi.com/v1",privateLeagues:"https://private-leagues.cska.fansunitedapi.com/v1",voting:"https://voting.cska.fansunitedapi.com/v1"},n={profile:"http://localhost:8010/v1",football:"http://localhost:8080/v1",idMapping:"http://localhost:8030/v1",predictor:"http://localhost:8040/v1",client:"http://localhost:8070/v1",loyalty:"http://localhost:8060/v1",miniGames:"http://localhost:9040/v1",discussions:"http://localhost:9020/v1",privateLeagues:"http://localhost:9010/v1",voting:"http://localhost:9030/v1"},l={profile:"https://profile.fansunitedstagingapi.com/v1",football:"https://football.fansunitedstagingapi.com/v1",idMapping:"https://id-mapping.fansunitedstagingapi.com/v1",predictor:"https://prediction.fansunitedstagingapi.com/v1",client:"https://client.fansunitedstagingapi.com/v1",loyalty:"https://loyalty.fansunitedstagingapi.com/v1",miniGames:"https://mini-games.fansunitedstagingapi.com/v1",discussions:"https://discussions.fansunitedstagingapi.com/v1",privateLeagues:"https://private-leagues.fansunitedstagingapi.com/v1",voting:"https://voting.fansunitedstagingapi.com/v1"};return s==="prod"?e=i[t]:s==="dev"?e=n[t]:s==="watg"?e=a[t]:s==="yolo"?e=r[t]:s==="cska"?e=o[t]:e=l[t],e},pe=s=>Array.from(new Set(s)),f=s=>s||!1,m=()=>`&disable_cache=${Date.now()}`,$p=s=>JSON.parse(JSON.stringify(s.sort((t,e)=>t.localeCompare(e))));var at=(P=>(P.FT_1X2="FT_1X2",P.HT_1X2="HT_1X2",P.BOTH_TEAMS_SCORE="BOTH_TEAMS_SCORE",P.DOUBLE_CHANCE="DOUBLE_CHANCE",P.HT_FT="HT_FT",P.PLAYER_SCORE="PLAYER_SCORE",P.PLAYER_YELLOW_CARD="PLAYER_YELLOW_CARD",P.PLAYER_RED_CARD="PLAYER_RED_CARD",P.RED_CARD_MATCH="RED_CARD_MATCH",P.PENALTY_MATCH="PENALTY_MATCH",P.PLAYER_SCORE_FIRST_GOAL="PLAYER_SCORE_FIRST_GOAL",P.CORNERS_MATCH="CORNERS_MATCH",P.CORRECT_SCORE="CORRECT_SCORE",P.CORRECT_SCORE_ADVANCED="CORRECT_SCORE_ADVANCED",P.CORRECT_SCORE_HT="CORRECT_SCORE_HT",P.PLAYER_SCORE_HATTRICK="PLAYER_SCORE_HATTRICK",P.PLAYER_SCORE_TWICE="PLAYER_SCORE_TWICE",P.OVER_GOALS_0_5="OVER_GOALS_0_5",P.OVER_GOALS_1_5="OVER_GOALS_1_5",P.OVER_GOALS_2_5="OVER_GOALS_2_5",P.OVER_GOALS_3_5="OVER_GOALS_3_5",P.OVER_GOALS_4_5="OVER_GOALS_4_5",P.OVER_GOALS_5_5="OVER_GOALS_5_5",P.OVER_GOALS_6_5="OVER_GOALS_6_5",P.OVER_CORNERS_6_5="OVER_CORNERS_6_5",P.OVER_CORNERS_7_5="OVER_CORNERS_7_5",P.OVER_CORNERS_8_5="OVER_CORNERS_8_5",P.OVER_CORNERS_9_5="OVER_CORNERS_9_5",P.OVER_CORNERS_10_5="OVER_CORNERS_10_5",P.OVER_CORNERS_11_5="OVER_CORNERS_11_5",P.OVER_CORNERS_12_5="OVER_CORNERS_12_5",P.OVER_CORNERS_13_5="OVER_CORNERS_13_5",P))(at||{}),cu=["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"],uu=["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"],It=["PLAYER_RED_CARD","PLAYER_SCORE","PLAYER_SCORE_FIRST_GOAL","PLAYER_SCORE_HATTRICK","PLAYER_SCORE_TWICE","PLAYER_YELLOW_CARD"],du=["FT_1X2","HT_1X2","HT_FT","DOUBLE_CHANCE","CORNERS_MATCH","CORRECT_SCORE","CORRECT_SCORE_HT","CORRECT_SCORE_ADVANCED"],Ki="PLAYER_SCORE_FIRST_GOAL";var ji=class{id="";achievedAt=""};var ce=class{participationCount=null;points=null};var ue=class{totalPoints=null;postPoints=null;postsMade=null;reactionPoints=null;reactionCount=null};var de=class{participationCount=null};var mi=class{participations=0;points=0};var Qt=class{footballCompetitions=[];footballTeams=[]};var me=class{predictionsMade=0;correct=0;points=0;breakdown=new Qt};var he=class{single=new me;topX=new mi;matchQuiz=new mi};var Yi=class{overallPercent;byFootballCompetition;byFootballTeam;byFootballMarket};var Xi=class{profileId;tier;points;predictionsMade;successRates=new Yi;predictions=new he;tiers=[];badges=[];discussions=new ue;classicQuizzes=new ce;eitherOr=new de};var Ji=class{entityId="";entityType="";entitySource="";model=null;predictionsMade=0;correct=0;points=0};var Zi=class{successRatePercent;model=null};var Ct=class{content=null;tags=[];campaign=null};var fe=class{id=null;profileId=null;property=null;value=null;action=null;context=new Ct;points=0};var Y=class{currentPage=null;itemsPerPage=null;totalItems=null;numberOfPages=null};var k=class{pagination=new Y};var ta=class{meta=new k;data=[new fe]};var Gn=class{remapSingleResponse=t=>{let e=new fe;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 ta;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 Xi;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)},at[i]&&delete e[i].model});else return t;return e};remapSuccessRatePercent=t=>{let e=new Zi;return e.successRatePercent=t.success_rate_percent,e};remapPredictionsStats=t=>{let e=new he;return e.single=this.remapSinglePredictionsStats(t.single),e.topX=t.top_x,e.matchQuiz=t.match_quiz,e};remapSinglePredictionsStats=t=>{let e=new me;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 Qt,i=[],a=[];return Object.keys(t).forEach(r=>{let o=new Ji;o.entityId=r,o.entityType=t[r].entity_type,o.entitySource=t[r].entity_source,o.predictionsMade=t[r].predictions_made,o.correct=t[r].correct,o.points=t[r].points,o.entityType==="competition"?i.push(o):o.entityType==="team"&&a.push(o)}),e.footballCompetitions=i,e.footballTeams=a,e}return new Qt};remapAchievementsStats=t=>t.map(e=>{let i=new ji;return i.id=e.id,i.achievedAt=e.achieved_at,i});remapDiscussionStats=t=>{let e=new ue;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 ce;return e.participationCount=t.participation_count,e.points=t.points,e};remapEitherOrStats=t=>{let e=new de;return e.participationCount=t.participation_count,e}};function zc(s){this.message=s}zc.prototype=new Error,zc.prototype.name="InvalidCharacterError";var mu=typeof window<"u"&&window.atob&&window.atob.bind(window)||function(s){var t=String(s).replace(/=+$/,"");if(t.length%4==1)throw new zc("'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 sd(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(mu(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 mu(t)}}function zp(s){this.message=s}function nd(s,t){if(typeof s!="string")throw new zp("Invalid token specified");var e=(t=t||{}).header===!0?0:1;try{return JSON.parse(sd(s.split(".")[e]))}catch(i){throw new zp("Invalid token specified: "+i.message)}}zp.prototype=new Error,zp.prototype.name="InvalidTokenError";var qc=nd;var C=(a=>(a[a.BAD_METHOD_CALL=400]="BAD_METHOD_CALL",a[a.UNAUTHORIZED=401]="UNAUTHORIZED",a[a.NOT_FOUND=404]="NOT_FOUND",a[a.PRECONDITION_FAILED=412]="PRECONDITION_FAILED",a))(C||{});var A=(E=>(E.INVALID_TEMPLATE="INVALID_TEMPLATE",E.INVALID_PREDICTION="INVALID_PREDICTION",E.INVALID_MARKET="INVALID_MARKET",E.INVALID_FIELD="INVALID_FIELD",E.INVALID_TYPE="INVALID_TYPE",E.EXCEEDED_LENGTH="EXCEEDED_LENGTH",E.INVALID_TOKEN="invalid_token",E.UNAUTHORIZED="unauthorized",E.INVALID_FILTERS="invalid_filters",E.INVALID_AVATAR="invalid_avatar",E.INVALID_METHOD_CALL="invalid_method_call",E.INVALID_LIMIT="invalid_limit",E.INVALID_TEMPLATE_GROUP_ID="invalid_template_group_id",E.INVALID_TEMPLATE_GROUP_FILTERS="invalid_template_group_filters",E.INVALID_PAGE_NUMBER="invalid_page_number",E.INVALID_DISCUSSION_IDS="invalid_discussion_ids",E.ID_MAPPING_NOT_FOUND="id_mapping_not_found",E.INVALID_COMPETITION_ID="invalid_competition_id",E.INVALID_TEAM_ID="invalid_team_id",E.INVALID_IDS="invalid_ids",E.INVALID_INPUT_PROVIDER="invalid_input_provider",E.INVALID_OUTPUT_PROVIDER="invalid_output_provider",E.INVALID_MATCH_SUMMARY="invalid_match_summary",E.INVALID_MATCH_SUMMARY_PREDICTIONS="invalid_match_summary_predictions",E.INVALID_MATCH_SUMMARY_PREDICTIONS_KEYS="invalid_match_summary_predictions_keys",E.ENTITY_IDS_NOT_FOUND="entity_ids_not_found",E.MATCH_IDS_NOT_FOUND="match_ids_not_found",E.INVALID_MATCH_IDS="invalid_match_ids",E.ODD_CLIENT_CONFIGURATION_NOT_FOUND="odd_client_configuration_not_found",E))(A||{});var G={native:"id",sportradar:"sportradar_id",sportal365:"sportal365_id",enetpulse:"enetpulse_id",api_football:"api_football_id"},Qc={PREDICTOR_USER_RELATED_OPERATION:"https://docs.fansunitedmedia.com/docs/predictor-operations#user-related-operations"},Wc=["matchId","matchType","market","prediction"],hu=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 x=(I=>(I.INVALID_MATCH_ID="Match id is invalid!",I.INVALID_PLAYER_ID="Player id is invalid!",I.QUERY_PARAM_MATCH_IDS_EXCEEDED="Maximum matchIds in PredictionFilters should be 10 or less.",I.QUERY_PARAM_FILTERS_LIMIT_EXCEEDED="Maximum limit for filtering games is 50 or less.",I.INVALID_FIXTURES_FIELD="Fixtures field is invalid. For more information please visit our documentation",I.INVALID_TOKEN="Invalid JWT token is provided",I.EXPIRED_TOKEN="The provided JWT token is expired",I.ENTITIES_NEEDED="At least one of footballCompetitions, footballTeams or footballPlayers properties should be provided for filters.",I.ENTITIES_FOLLOWS_FILTERS_EXCEEDED="Maximum length per entity should be 24 or less.",I.INVALID_TYPE="You have provided invalid type. The valid type is ",I.INVALID_VALUE="You have provided invalid value. The valid value is ",I.INVALID_AVATAR="Invalid URL syntax for avatar image.",I.INVALID_GET_PROFILES_METHOD_CALL="The method 'getByIds' from Profile namespace is not called correctly. You need to provide 'profileIds' OR 'search' parameters to the method, but you can't use both of them or neither of them.",I.INVALID_LIMIT="Invalid limit. The maximum limit is: ",I.INVALID_LIMIT_TYPE="Invalid limit type. The proper type is number.",I.FILTER_COMBINATION_ERROR="You need to use both 'entityIds' and 'entityType' filters together",I.INVALID_ENTITY_TYPE="Invalid 'entityType' filter. Please use one of the following valid options: competition, team, or player",I.INVALID_TEMPLATE_GROUP_ID="There is no group in this template with the provided groupId",I.INVALID_TEMPLATE_GROUP_FILTERS="The provided template group has no filters",I.INVALID_PAGE_NUMBER="Invalid page number provided. Use number between 1 and max number of pages.",I.INVALID_DISCUSSION_IDS="Invalid discussion ids argument. Please provide at least one discussion id in an array",I.EXCEEDED_DISCUSSION_IDS="Maximum number of discussion ids exceeded. The maximum number of discussion ids is 50. You can use 'getPostsCountExtended' method for more than 50 discussion ids.",I.EXCEEDED_EXTENDED_DISCUSSION_IDS="Maximum number of discussion ids exceeded. The maximum number of discussion ids is: ",I.ID_MAPPING_NOT_FOUND="No ID mappings are available for the provided ID. ID argument: ",I.INVALID_PARAM="Invalid parameter provided. Please check the following parameter: ",I.INVALID_COMPETITION_ID="Invalid competition ID provided. Please provide a valid competition ID.",I.INVALID_TEAM_ID="Invalid team ID provided. Please provide a valid team ID.",I.INVALID_OR_EMPTY_IDS="Invalid or empty IDs provided. Please provide at least one ID.",I.INVALID_PROVIDER="Invalid provider. The valid providers are: 'native', 'enetpulse', 'sportal365', 'sportradar' and 'api_football'.",I.INVALID_OUTPUT_PROVIDER="Invalid output provider. The output can not be the same as the input provider.",I.MATCH_SUMMARY_REQUIRED="Match summary is required.",I.MATCH_SUMMARY_PREDICTIONS_REQUIRED="Predictions in match summary are required.",I.INVALID_MATCH_SUMMARY_PREDICTIONS_KEYS="Keys in predictions in match summary are invalid. The valid ones are: ",I.INVALID_COLLECT_LEAD_METHOD_CALL="The method 'collectLead' from Profile namespace is not called correctly. You need to provide 'requestBody' parameter to the method.",I.REQUIRED_FIXTURES_FIELD="Fixtures field is required and should contain at least one fixtures object. For more information please visit our documentation",I.INVALID_TIEBREAKER_FIELD="Tiebreaker field is invalid. It should contain statTotal key with integer value. For more information please visit our documentation",I.ENTITY_IDS_NOT_FOUND="Some of the sport entity IDs were not found for the provided id schema",I.MATCH_IDS_NOT_FOUND="Some of the match IDs were not found for the provided id schema",I.INVALID_STANDING_PREDICTION_ARGUMENT="The prediction argument is invalid. For more information please visit our documentation",I.INVALID_MAP_PLAYERS_ROLES_KEYS="The keys in the players roles map are not part of the valid keys. The valid keys are: ",I.INVALID_MAP_PLAYERS_ROLES_VALUES="The values in the map are not valid. The valid ones are: ",I.INVALID_MATCH_IDS="Match IDs are invalid!",I.MISSING_ODD_CLIENT_CONFIGURATION="Odds namespace requires oddClient configuration to be set",I))(x||{}),Kc={UNEXPECTED_STATUS_PROP:`Unexpected provided property 'status'. You can NOT use this property for this method. For more information visit our documentation:
2
2
  ${Qc.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
- ${Qc.PREDICTOR_USER_RELATED_OPERATION}`},fu=(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`,qp=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`,gu=s=>`The market '${s}' is not valid for Top X game. The only available market is CORRECT_SCORE.`,yu=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`,bu=(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`,Mu=(s,t)=>`The field ${s} has incorrect type. The correct type is ${t}`;var Wt=class{data={error:{code:0,status:"",message:""}};status=0;statusText="";headers=null;constructor(t,e){this.data.error.code=e.code,this.data.error.status=e.status,this.data.error.message=e.message,this.status=t.status,this.statusText=t.statusText,this.headers=t.headers}errorMessage=()=>this.data.error.message};var h=class{error={code:0,status:"",message:""};constructor(t,e,i){this.error.code=t,this.error.status=e,this.error.message=i}};var v=class{baseUrl=null;apiSignInUrl=null;jwtToken=null;idSchema=null;retryRequest=!1;headers=null;authHeaders=null;errorHandlingMode=null;configuration=null;constructor(t,e){this.baseUrl=e,this.configuration=t,this.apiSignInUrl=`?key=${t.apiKey}&client_id=${t.clientId}`,this.errorHandlingMode=t.errorHandlingMode,this.idSchema=t.idSchema,this.headers={"Content-Type":"application/json"}}getJwtToken=()=>{if(this.configuration.cookieToken){let t=[];typeof document>"u"?t=(this.configuration.cookieToken.requestHeaders.get("cookie")||"").split(";"):t=document.cookie.split(";");let e=t.find(r=>r.trim().startsWith(`${this.configuration.cookieToken.name}=`));if(!e)return"";let i=e.split("=")[1].trim(),a=decodeURIComponent(i);try{let r=JSON.parse(a);return r.token||r||""}catch{return a}}return this.configuration.authProvider?.getIdToken()||""};getAuthHeaders=()=>({"Content-Type":"application/json",Authorization:`Bearer ${this.getJwtToken()}`});fetchWithoutAuth=async(t,e,i,a)=>{let r=null;a?r=await fetch(this.baseUrl+t,{headers:this.headers,method:i||"GET",body:JSON.stringify(a)}):r=await fetch(this.baseUrl+t,{headers:this.headers,method:i||"GET"});let o=await r.json();if(!r.ok){let n=this.transformFetchException(r,o);throw console.warn(e,n),n}return o};fetchWithoutAuthAdditionalHeaders=async(t,e,i)=>{let a=await fetch(this.baseUrl+t,{headers:{...this.headers,...i}}),r=await a.json();if(!a.ok){let o=this.transformFetchException(a,r);throw console.warn(e,o),o}return r};fetchWithAuth=async(t,e,i,a)=>{this.validateJWTToken();let r=null,o=null;if(i&&a?r=await fetch(this.baseUrl+t,{method:i,headers:this.getAuthHeaders(),body:JSON.stringify(a)}):i&&!a?r=await fetch(this.baseUrl+t,{method:i,headers:this.getAuthHeaders()}):r=await fetch(this.baseUrl+t,{headers:this.getAuthHeaders()}),i!=="DELETE"&&(o=await r.json()),!r.ok){(r.status===401||r.status===403)&&!this.retryRequest&&(this.retryRequest=!0,await this.fetchWithAuth(t,e,i,a)),this.retryRequest=!1;let n=this.transformFetchException(r,o||await r.json());throw console.warn(e,n),n}return this.retryRequest=!1,o};fetchWithAuthNewBaseURL=async(t,e,i,a,r)=>{this.validateJWTToken();let o=null,n=null;if(a&&r?o=await fetch(t+e,{method:a,headers:this.getAuthHeaders(),body:JSON.stringify(r)}):a&&!r?o=await fetch(t+e,{method:a,headers:this.getAuthHeaders()}):o=await fetch(t+e,{headers:this.getAuthHeaders()}),a!=="DELETE"&&(n=await o.json()),!o.ok){(o.status===401||o.status===403)&&!this.retryRequest&&(this.retryRequest=!0,await this.fetchWithAuthNewBaseURL(t,e,i,a,r)),this.retryRequest=!1;let l=this.transformFetchException(o,n||await o.json());throw console.warn(i,l),l}return this.retryRequest=!1,n};transformFetchException=(t,e)=>{if(!e&&t.status===401){if(this.errorHandlingMode==="standard")return new h(401,"unauthorized","Invalid JWT token is provided");let o={code:401,status:"unauthorized",message:"Invalid JWT token is provided"};return new Wt(t,o)}let{code:i,status:a,message:r}=e.error;return this.errorHandlingMode==="standard"?new h(i,a,r):new Wt(t,e.error)};validateJWTToken=()=>{let t=null;try{t=qc(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 Wt(a,r)}else if(this.errorHandlingMode==="standard")throw new h(401,"invalid_token","Invalid JWT token is provided")}if(Date.now()>t.exp*1e3){if(this.errorHandlingMode==="default"){let i={status:401,statusText:"",headers:{}},a={code:401,status:"invalid_token",message:"The provided JWT token is expired"};throw new Wt(i,a)}else if(this.errorHandlingMode==="standard")throw new h(401,"invalid_token","The provided JWT token is expired")}};extractUserIdFromToken=()=>{try{return qc(this.getJwtToken())?.sub||""}catch(t){return console.error(t),""}}};var hi=class extends v{activityRemapper=null;constructor(t){super(t,O(t.environment,"loyalty")),this.activityRemapper=new Gn}createActivity=async t=>{let e=`/activities${this.apiSignInUrl}`,i="There was a problem with creating activity",a="POST",r=await this.fetchWithAuth(e,i,a,t);return this.activityRemapper.remapSingleResponse(r)};deleteActivity=async t=>{let e=`/activities/${t}${this.apiSignInUrl}`,i=`There was a problem deleting the following activity: ${t}`,a="DELETE";return await this.fetchWithAuth(e,i,a),!0};getOwnActivities=async(t,e)=>{let i=`/activities${this.apiSignInUrl}`,a=Date.now(),r="There was a problem with fetching own activities";t&&(i+=`${t.constructFilterUrl()}`),e&&(i+=`disable_cache=${a}`);let o=await this.fetchWithAuth(i,r);return this.activityRemapper.remapActivitiesResponse(o)};getActivitiesForUser=async(t,e,i)=>{let a=`/users/${t}/activities${this.apiSignInUrl}`,r=Date.now(),o=`There was a problem with fetching activities for user: ${t}`;e&&(a+=`${e.constructFilterUrl()}`),i&&(a+=`disable_cache=${r}`);let n=await this.fetchWithoutAuth(a,o);return this.activityRemapper.remapActivitiesResponse(n)};getStats=async(t,e)=>{let i="",a="",r=null;return t?(i+=f(e)?`/users/${t}/statistics${this.apiSignInUrl}${m()}`:`/users/${t}/statistics${this.apiSignInUrl}`,a=`There was a problem fetching statistics for profile: ${t}`,r=await this.fetchWithoutAuth(i,a)):(i+=`/statistics${this.apiSignInUrl}`,a="There was a problem fetching profile`s statistics",r=await this.fetchWithAuth(i,a)),this.activityRemapper.remapStatsResponse(r.data)}};var jc=(g=>(g.LIKE="like",g.DISLIKE="dislike",g.PAGE_VIEW="page_view",g.CONTENT_CONSUMED="content_consumed",g.SHARE="share",g.COMMENT="comment",g.CLICK_AD="click_ad",g.PREDICTION_MADE="prediction_made",g.CONVERT="convert",g.MANAGE_INTERESTS="manage_interests",g.GAME_PARTICIPATION="game_participation",g.ARTICLE_CONSUMED="article_consumed",g.VIDEO_CONSUMED="video_consumed",g.SHORT_VIDEO_CONSUMED="short_video_consumed",g.LONG_VIDEO_CONSUMED="long_video_consumed",g.AUDIO_CONSUMED="audio_consumed",g.GALLERY_CONSUMED="gallery_consumed",g.IMAGE_CONSUMED="image_consumed",g.POLL_PARTICIPATION="poll_participation",g))(jc||{});var fi=class{action=null;context=new Ct;constructor(t,e,i,a){this.action=t,this.context.tags=e,i&&(this.context.content=i),a&&(this.context.campaign=a)}};var Un={player:"players",team:"teams",homeTeam:"teams",awayTeam:"teams",country:"countries",competition:"competitions",match:"matches"},Vn=class extends v{constructor(t){super(t,O(t.environment,"idMapping"))}getEntityById=async(t,e)=>{let i=`/football${this.apiSignInUrl}&input_provider=${this.idSchema}&${Un[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}&${Un[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}&${Un[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=$c(e),r=[];for(let o of a){let n=`/football${this.apiSignInUrl}&input_provider=${i}&${Un[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=pe(i),n=$c(o);for(let p of n){let c="";if(Object.keys(t).forEach(u=>{a[u]=[];let d=p.filter(M=>t[u].includes(M));d&&d.length>0&&(a[u]=d)}),Object.keys(a).forEach(u=>{a[u].length>0&&(a[u].sort((d,M)=>d.localeCompare(M)),c+="&",c+=`${Un[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",M=await this.fetchWithoutAuth(u,d);r.push(M.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 Yc="FansUnited",Qp={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}}},ea=class{idSchema="";storageInstance=null;expirationProfileTimeout=600;expirationBadgesTimeout=3600;expirationClientFeaturesTimeout=14400;expirationFootballIdsTimeout=604800;constructor(t){this.idSchema=t,this.getStorageInstance()}static getInstance(t){return ea.instance||(ea.instance=new ea(t)),ea.instance}async getStorageInstance(){try{let t=await Promise.resolve().then(()=>(wu(),Iu));this.storageInstance=t.default}catch(t){console.error(t)}}async getData(){try{let t=await this.storageInstance.getItem(Yc);return t?JSON.parse(t):(await this.storageInstance.setItem(Yc,JSON.stringify(Qp)),Qp)}catch(t){throw console.error("AsyncStorage error:",t),t}}async setData(t){await this.storageInstance.setItem(Yc,JSON.stringify(t))}clearData=async()=>{await this.setData(Qp)};getCompetitions=async t=>{let e=await this.getData();return t?t.competitionSearchFilter(e.football.competitions):e.football.competitions};setCompetitions=async t=>{let e=await this.getData(),i=[...e.football.competitions];i.push(...t),e.football.competitions=this.makeCompetitionsUnique(i),await this.setData(e)};getCompetitionsLength=async()=>(await this.getData()).football.competitions.length;getEntityById=async(t="",e="")=>(await this.getData()).football.ids.find(a=>{let r=G[this.idSchema];return a&&`${a[r]}`===e&&a.resource===t});getEntity=async(t,e,i)=>{let a=await this.getData();return Array.isArray(t)?a.football.ids.filter(r=>{let o=G[i];return r&&t.includes(`${r[o]}`)&&r.resource===e}):a.football.ids.find(r=>{let o=G[i];return r&&`${r[o]}`===t&&r.resource===e})};checkForExistingIdObjs=async(t,e)=>{let i=G[e],a={};for(let r of Object.keys(t)){let o=t[r],l=(await this.getEntity(o,r,e)).map(c=>c[i]),p=t[r].filter(c=>!l.includes(c));a[r]=o.map(c=>p.includes(c)?{id:c,exists:!1}:{id:c,exists:!0})}return a};getIdsByType=async(t,e,i)=>{let a=await this.getData(),r=G[i],o=G[e],n={};return Object.keys(t).forEach(l=>{let p=t[l],c=[];a.football.ids.forEach(u=>{p.forEach((d,M)=>{d===u[o]&&l===u.resource&&(c[M]=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(Qp)}},ia=ea;it(ia,"instance");var Xc="FansUnited",Jc={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}}},aa=class{idSchema="";expirationProfileTimeout=600;expirationBadgesTimeout=3600;expirationClientFeaturesTimeout=14400;expirationFootballIdsTimeout=604800;constructor(t){this.idSchema=t}static getInstance(t){return aa.instance||(aa.instance=new aa(t)),aa.instance}clearData=async()=>{this.setData(Jc)};getEntityById=async(t="",e="")=>this.getData().football.ids.find(i=>{let a=G[this.idSchema];return i&&`${i[a]}`===e&&i.resource===t});getEntity=(t,e,i)=>Array.isArray(t)?this.getData().football.ids.filter(a=>{let r=G[i];return a&&t.includes(`${a[r]}`)&&a.resource===e}):this.getData().football.ids.find(a=>{let r=G[i];return a&&`${a[r]}`===t&&a.resource===e});getEntityByNativeId=(t="",e="")=>this.getData().football.ids.find(i=>i&&`${i.id}`===e&&i.resource===t);checkForExistingIdObjs=async(t,e)=>{let i=G[e],a={};return Object.keys(t).forEach(r=>{let o=t[r],l=this.getEntity(o,r,e).map(c=>c[i]),p=t[r].filter(c=>!l.includes(c));a[r]=o.map(c=>p.includes(c)?{id:c,exists:!1}:{id:c,exists:!0})}),a};getIdsByType=async(t,e,i)=>{let a=G[i],r=G[e],o={};return Object.keys(t).forEach(n=>{let l=t[n],p=[];this.getData().football.ids.forEach(c=>{l.forEach((u,d)=>{u===c[r]&&n===c.resource&&(p[d]=c[a])})}),o[n]=p}),o};addIdMapping=t=>{let e=this.getData();e.football.ids.push(t),this.setData(e)};addIdMappings=async t=>{let e=this.getData(),i=e.football.ids;i=[...i,...t],e.football.ids=i,this.setData(e)};addTopIdMappings=async t=>{let e=this.getData();if(e.football.ids.length){let i=JSON.parse(JSON.stringify(e.football.ids));i=i.filter(a=>a.resource!=="match"),t=t.filter(a=>a.resource==="match"),i=[...i,...t],e.football.ids=i}else e.football.ids=t;e.football.expirations.ids=Math.floor(Date.now()/1e3)+this.expirationFootballIdsTimeout,this.setData(e)};setOwnProfile=async t=>{let e=this.getData();e.profile.info=t,e.profile.expirations.profile=Math.floor(Date.now()/1e3)+this.expirationProfileTimeout,this.setData(e)};getOwnProfile=()=>this.getData().profile.info;getProfileCountries=()=>this.getData().profile.countries;setProfileCountries=async t=>{let e=this.getData();e.profile.countries=t,this.setData(e)};getProfileStats=()=>this.getData().profile.statistics;setProfileStats=async t=>{let e=this.getData();e.profile.statistics=t,e.profile.expirations.statistics=Math.floor(Date.now()/1e3)+this.expirationProfileTimeout,this.setData(e)};getProfileBadges=()=>this.getData().profile.badges;setProfileBadges=async t=>{let e=this.getData();e.profile.badges=t,e.profile.expirations.badges=Math.floor(Date.now()/1e3)+this.expirationBadgesTimeout,this.setData(e)};getFootballCountries=()=>this.getData().football.countries;setFootballCountries=async t=>{let e=this.getData();e.football.countries=t,this.setData(e)};getCompetitions=t=>{let e=this.getData();return t?t.competitionSearchFilter(e.football.competitions):e.football.competitions};setCompetitions=async t=>{let e=this.getData(),i=[...e.football.competitions];i.push(...t),e.football.competitions=this.makeCompetitionsUnique(i),this.setData(e)};getCompetitionsLength=async()=>{let{football:t}=this.getData();return t.competitions.length};getClientFeatures=()=>this.getData().client.features;setClientFeatures=async t=>{let e=this.getData(),i=JSON.parse(JSON.stringify(t));e.client.expirations.features=Math.floor(Date.now()/1e3)+this.expirationClientFeaturesTimeout,e.client.features=i,this.setData(e)};deleteClientFeatures=async()=>{let t=this.getData(),e=JSON.parse(JSON.stringify(t));e.client={features:{},expirations:{features:0}},this.setData(e)};getExpiration=async(t,e)=>{this.initialNewSchema(t,"expirations");let i=this.getData();switch(e){case"profile":return i.profile.expirations.profile;case"statistics":return i.profile.expirations.statistics;case"badges":return i.profile.expirations.badges;case"features":return i.client.expirations.features;case"ids":return i.football.expirations.ids}};makeCompetitionsUnique=t=>{let e=new Set;return t.filter(i=>{let a=!e.has(i.id);return e.add(i.id),a})};getData=()=>(localStorage.getItem(Xc)||this.setData(Jc),JSON.parse(localStorage.getItem(Xc)));setData=t=>{localStorage.setItem(Xc,JSON.stringify(t))};initialNewSchema=(t,e)=>{let i=this.getData();(!i||!i[t]||!i[t][e])&&this.setData(Jc)}},ra=aa;it(ra,"instance");var Uu=ad(Gu());var T=class{profileTTL=600;clientTTL=14400;profileBadgesTTL=3600;idMappingsExpiration=0;idSchema="";constructor(t){}static getInstance(t){return T.instance||(T.instance=new T(t),T.nodeCache.options.useClones=!1),T.instance}clearData=async()=>T.nodeCache.flushAll();getEntityById=async(t,e)=>{let i=T.nodeCache.get("ids");return i?i.find(a=>{let r=G[this.idSchema];return a&&`${a[r]}`===e&&a.resource===t}):null};getEntity=async(t,e,i)=>{let a=T.nodeCache.get("ids");return a?Array.isArray(t)?[]:null:Array.isArray(t)?a.filter(r=>{let o=G[i];return r&&t.includes(`${r[o]}`)&&r.resource===e}):a.find(r=>{let o=G[i];return r&&`${r[o]}`===t&&r.resource===e})};checkForExistingIdObjs=async(t,e)=>{let i=G[e],a={};for(let r of Object.keys(t)){let o=t[r],l=(await this.getEntity(o,r,e)).map(c=>c[i]),p=t[r].filter(c=>!l.includes(c));a[r]=o.map(c=>p.includes(c)?{id:c,exists:!1}:{id:c,exists:!0})}return a};getIdsByType=async(t,e,i)=>{let a=G[i],r=G[e],o=T.nodeCache.get("ids"),n={};return o?(Object.keys(t).forEach(l=>{let p=t[l],c=[];o.forEach(u=>{p.forEach((d,M)=>{d===u[r]&&l===u.resource&&(c[M]=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"}}},gi=T;it(gi,"instance"),it(gi,"nodeCache",new Uu.default);var ct=class{createLocalCacheInstance=t=>typeof window>"u"?gi.getInstance(t):typeof __DEV__<"u"?ia.getInstance(t):ra.getInstance(t)};var yi=class{localCache=null;https=null;constructor(t){this.localCache=new ct().createLocalCacheInstance(t.idSchema),this.https=new Vn(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 M=l[c].length&&l[c][d]?l[c][d]:"";p.set(u,M)})}),p}catch(a){return console.warn("There was a problem retrieving the entity ids ",a),Promise.resolve(new Map)}};getEntityById=async(t,e,i)=>{let a=await this.localCache.getEntity(t,e,i);if(a)return a;let r=await this.requestEntity(t,e,i);return await this.localCache.addIdMappings(r),r&&r.length>0?r[0]:null};splitForRequestAndExisting=t=>{let e={},i={};return Object.keys(t).forEach(a=>{e[a]=t[a].filter(r=>!r.exists).map(r=>r.id),i[a]=t[a].filter(r=>r.exists).map(r=>r.id)}),{existing:i,request:e}};requestEntity=async(t,e,i)=>{try{return t=Array.isArray(t)?t:[t],await this.https.getEntitiesByIds(e,t,i)}catch(a){return console.warn(`There was a problem retrieving the requested entity: ${a}`),null}};setTopIdMappings=async()=>{let t=Math.floor(Date.now()/1e3);if(await this.localCache.getExpiration("football","ids")>t)return Promise.resolve();let i=await this.https.getTopEntities();await this.localCache.addTopIdMappings(i)}};var Yp=s=>{switch(s){case"competitions":return"competition";case"players":case"relatedPlayer":case"squad":return"player";case"teams":case"participants":case"homeTeam":case"awayTeam":case"timeline":case"teamId":return"team";default:return s}};var Hn=class{extractedObjIds={};traverse=(t,e)=>(e=Yp(e),Array.isArray(t)?this.traverseArrExtract(t,e):t&&typeof t=="object"&&this.traverseObjExtract(t,e),this.extractedObjIds);traverseArrExtract=(t,e)=>{t&&t.length>0&&t.forEach(i=>{this.traverseObjExtract(i,e)})};traverseObjExtract=(t,e)=>{t&&Object.keys(t).length>0&&Object.keys(t).forEach(i=>{let a=t[i];i==="id"||i==="teamId"?(this.extractedObjIds.hasOwnProperty(e)||(this.extractedObjIds[e]=[]),a&&this.extractedObjIds[e].push(a)):t[i]&&this.traverse(t[i],i)})}};var $n=class{replaceObjIdsIndex=null;remappedIdsObj={};traverse=(t,e,i)=>(e=Yp(e),this.replaceObjIdsIndex===null&&(this.initReplaceObjIdsIndex(i),this.remappedIdsObj=i),Array.isArray(t)?this.traverseArrReplace(t,e):t&&typeof t=="object"&&this.traverseObjReplace(t,e),t);initReplaceObjIdsIndex=t=>{this.replaceObjIdsIndex={},Object.keys(t).forEach(e=>{this.replaceObjIdsIndex[e]=0})};traverseArrReplace=(t,e)=>{t&&t.length>0&&t.forEach(i=>{this.traverseObjReplace(i,e)})};traverseObjReplace=(t,e)=>{t&&Object.keys(t).length>0&&Object.keys(t).forEach(i=>{i==="id"||i==="teamId"?t[i]&&(t[i]=this.remappedIdsObj[e][this.replaceObjIdsIndex[e]],this.replaceObjIdsIndex[e]=this.replaceObjIdsIndex[e]+1):t[i]&&this.traverse(t[i],i,this.remappedIdsObj)})}};var R=class{idSchema="";idMappingFacade=null;constructor(t){this.idSchema=t.idSchema,this.idMappingFacade=new yi(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 Hn().traverse(i,e);return this.idMappingFacade.getEntitiesByIds(r,"native",this.idSchema).then(o=>new $n().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 wt=class{idSchema;idMapping;constructor(t){this.idSchema=t.idSchema,this.idMapping=new R(t)}remapTagsIds=async(t,e,i)=>{if(!t||!t.length)return t;let a={},r={},o=[];t.forEach(l=>{a.hasOwnProperty(l.type)||(a[l.type]=[],r[l.type]=[]),a[l.type].push(l.id),r[l.type].push(l)});let n=await this.idMapping.idMappingFacade.getEntitiesByIds(a,e,i);for(let[l,p]of Object.entries(r))p.forEach((c,u)=>{c.id=n[l][u],o.push(c)});return o}};var ge=class{page=null;limit=null;constructor(t){this.page=t.page?t.page:null,this.limit=t.limit?t.limit:null}};var sa=class extends ge{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 na=class extends ge{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 zn=class{idSchema;activityHttps;activityService;constructor(t){this.idSchema=t.idSchema,this.activityHttps=new hi(t),this.activityService=new wt(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 fi(t,n,i,a),p=await this.activityHttps.createActivity(l);return p.context.tags=o,p}let r=new fi(t,e,i,a);return this.activityHttps.createActivity(r)};delete=async t=>await this.activityHttps.deleteActivity(t);like=async(t,e,i)=>{let a="like";return await this.add(a,t,e,i)};dislike=async(t,e,i)=>{let a="dislike";return await this.add(a,t,e,i)};addPageview=async(t,e,i)=>{let a="page_view";return await this.add(a,t,e,i)};addContentConsumed=async(t,e,i)=>{let a="content_consumed";return await this.add(a,t,e,i)};addShare=async(t,e,i)=>{let a="share";return await this.add(a,t,e,i)};addComment=async(t,e,i)=>{let a="comment";return await this.add(a,t,e,i)};addClickAd=async(t,e,i)=>{let a="click_ad";return await this.add(a,t,e,i)};addConvert=async(t,e,i)=>{let a="convert";return await this.add(a,t,e,i)};getOwn=async(t,e)=>{if(e=e||!1,t&&(t=new sa(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 na(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 qn=class{activityFacade;constructor(t){this.activityFacade=new zn(t)}add=async(t,e,i,a)=>await this.activityFacade.add(t,e,i,a);delete=async t=>await this.activityFacade.delete(t);like=async(t,e,i)=>await this.activityFacade.like(t,e,i);dislike=async(t,e,i)=>await this.activityFacade.dislike(t,e,i);addPageview=async(t,e,i)=>await this.activityFacade.addPageview(t,e,i);addContentConsumed=async(t,e,i)=>await this.activityFacade.addContentConsumed(t,e,i);addShare=async(t,e,i)=>await this.activityFacade.addShare(t,e,i);addComment=async(t,e,i)=>await this.activityFacade.addComment(t,e,i);addClickAd=async(t,e,i)=>await this.activityFacade.addClickAd(t,e,i);addConvert=async(t,e,i)=>await this.activityFacade.addConvert(t,e,i);getOwn=async(t,e)=>await this.activityFacade.getOwn(t,e);getForUser=async(t,e,i)=>await this.activityFacade.getForUser(t,e,i)};var z=class{entityId=null;entityType=null;entityRelationship=null};var ye=class{participantOne=null;participantTwo=null};var la=class{matchId="";participantOne="";participantTwo="";winner="";homeParticipant="";startDate="";score=new ye};var be=class{participants=[]};var pa=class{id=null;name=null;group=null;image=null;undecided=!1};var ca=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 be;fixtures=[];createdAt=null;updatedAt=null};var ut=class{nextPageStartsAfter=null;itemsPerPage=null};var b=class{pagination=new ut};var ua=class{meta=new b;data=[]};var da=class{meta=new b;data=[]};var ma=class{statTiebreakerEnabled;statTotal};var ha=class{matchId="";participantOne="";participantTwo="";winner;correct=null};var Me=class{statTotal=0};var Vu=(r=>(r.ACTIVE="ACTIVE",r.WON="WON",r.LOST="LOST",r.PARTIALLY_WON="PARTIALLY_WON",r.CANCELED="CANCELED",r))(Vu||{}),fa=class{id="";profileId="";profileModel=null;gameId="";totalPoints=null;gamePoints=null;bonusPoints=null;position=null;status="ACTIVE";fixtures=[];tiebreaker=new Me;createdAt="";updatedAt=""};var ga=class{meta=new b;data=[]};var Qn=class{remapBracketGames=t=>{let e=new da;return e.meta.pagination.itemsPerPage=t.meta.pagination.items_per_page,e.meta.pagination.nextPageStartsAfter=t.meta.pagination.next_page_starts_after,e.data=t.data.map(i=>this.remapBracketGameById(i)),e};remapBracketGameById=t=>{let e=new ca;return e.id=t.id,e.title=t.title,e.description=t.description,e.rules=t.rules,e.customFields=t.custom_fields,e.images=t.images,e.type=t.type,e.status=t.status,e.points=t.points,e.related=t.related?this.remapRelated(t.related):t.related,e.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 fa;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 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 ga;return e.meta.pagination.itemsPerPage=t.meta.pagination.items_per_page,e.meta.pagination.nextPageStartsAfter=t.meta.pagination.next_page_starts_after,e.data=t.data.map(i=>this.remapPrediction(i)),e};remapRelated=t=>t.map(e=>{let i=new z;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 ha;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 Me;return e.statTotal=t.stat_total,e};remapBracketGameMeta=t=>{let e=new be;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};remapBracketGameFixtures=t=>t.map(e=>{let i=new la;return i.matchId=e.match_id,i.participantOne=e.participant_one,i.participantTwo=e.participant_two,i.winner=e.winner,i.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 ye;return e.participantOne=t.participant_one,e.participantTwo=t.participant_two,e};remapBracketGameTiebreaker=t=>{let e=new ma;return e.statTiebreakerEnabled=t.stat_tiebreaker_enabled,e.statTotal=t.stat_total,e}};var Ie=class{participants=[]};var ya=class{id=null;title=null;description=null;rules=null;customFields=null;images=null;type="STANDING";status=null;points=null;related=[];predictionsCutoff="";meta=new Ie;outcomeCount=null;outcome=[];createdAt=null;updatedAt=null};var ba=class{meta=new b;data=[]};var Ma=class{id=null;name=null;group=null;image=null;undecided=!1};var Ia=class{id="";profileId="";profileModel=null;total=0;gameId="";totalPoints=null;gamePoints=null;bonusPoints=null;position=null;status="ACTIVE";standing=[];createdAt="";updatedAt=""};var wa=class{meta=new b;data=[]};var _a=class{meta=new b;data=[]};var Wn=class{remapBracketGames=t=>{let e=new ba;return e.meta.pagination.itemsPerPage=t.meta.pagination.items_per_page,e.meta.pagination.nextPageStartsAfter=t.meta.pagination.next_page_starts_after,e.data=t.data.map(i=>this.remapStandingGameById(i)),e};remapStandingGameById=t=>{let e=new ya;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 Ia;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 wa;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 _a;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 z;return i.entityId=e.entity_id,i.entityType=e.entity_type,i.entityRelationship=e.entity_relationship,i});remapStandingGameMeta=t=>{let e=new Ie;return e.participants=t.participants.map(i=>{let a=new Ma;return a.id=i.id,a.name=i.name,a.group=i.group,a.image=i.image,a.undecided=i.undecided,a}),e}};var Pa=class{meta=new b;data=[]};var Ta=class{statTiebreakerEnabled;statTotal};var we=class{statTotal=0};var Hu=(r=>(r.ACTIVE="ACTIVE",r.WON="WON",r.LOST="LOST",r.PARTIALLY_WON="PARTIALLY_WON",r.CANCELED="CANCELED",r))(Hu||{}),Ea=class{id="";profileId="";profileModel=null;gameId="";gamePoints=null;bonusPoints=null;totalPoints=null;position=null;status="ACTIVE";fixtures=[];tiebreaker=new we;createdAt="";updatedAt=""};var Ra=class{meta=new b;data=[]};var Fa=class{id=null;title=null;description=null;images=null;rules=null;customFields=null;type="EVENT";status=null;points=null;related=[];tiebreaker=null;predictionsCutoff=null;fixtures=[];createdAt=null;updatedAt=null};var Xp=(a=>(a.BOOLEAN="BOOLEAN",a.NUMBER="NUMBER",a.ENUM="ENUM",a.FREE_INPUT="FREE_INPUT",a))(Xp||{});var At=class{id="";question="";status="ACTIVE";voidReason=null;points=0;outcomeType=null;validOutcomes=null;outcome=null};var Ot=class{id="";predictionType;prediction;correct=null;points=0};var Sa=class{meta=new b;data=[]};var Kn=class{remapEventGames=t=>{let e=new Pa;return e.meta.pagination.itemsPerPage=t.meta.pagination.items_per_page,e.meta.pagination.nextPageStartsAfter=t.meta.pagination.next_page_starts_after,e.data=t.data.map(i=>this.remapEventGameById(i)),e};remapEventGameById=t=>{let e=new Fa;return e.id=t.id,e.title=t.title,e.description=t.description,e.rules=t.rules,e.customFields=t.custom_fields,e.images=t.images,e.type=t.type,e.status=t.status,e.points=t.points,e.related=t.related?this.remapRelated(t.related):t.related,e.tiebreaker=t.tiebreaker?this.remapEventGameTiebreaker(t.tiebreaker):t.tiebreaker,e.predictionsCutoff=t.predictions_cutoff,e.fixtures=t.fixtures?this.remapEventGameFixtures(t.fixtures):t.fixtures,e.createdAt=t.created_at,e.updatedAt=t.updated_at,e};remapPredictionToRequestBody=t=>t.map(e=>({id:e.id,prediction_type:e.predictionType,prediction:e.prediction}));remapPrediction=t=>{let e=new Ea;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 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};remapRankings=t=>{let e=new Ra;return e.meta.pagination.itemsPerPage=t.meta.pagination.items_per_page,e.meta.pagination.nextPageStartsAfter=t.meta.pagination.next_page_starts_after,e.data=t.data.map(i=>this.remapPrediction(i)),e};remapRelated=t=>t.map(e=>{let i=new z;return i.entityId=e.entity_id,i.entityType=e.entity_type,i.entityRelationship=e.entity_relationship,i});remapPredictionFixtures=t=>t.map(e=>{let i=new Ot;switch(e.prediction_type){case"BOOLEAN":i=new Ot;break;case"NUMBER":i=new Ot;break;case"ENUM":i=new Ot;break;case"FREE_INPUT":i=new Ot;break}return i.id=e.id,i.predictionType=e.prediction_type,i.prediction=e.prediction,i.points=e.points,i.correct=e.correct,i});remapPredictionTiebreaker=t=>{let e=new we;return e.statTotal=t.stat_total,e};remapEventGameFixtures=t=>t.map(e=>{let i=new At;switch(e.outcome_type){case"BOOLEAN":i=new At;break;case"NUMBER":i=new At;break;case"ENUM":i=new At;break;case"FREE_INPUT":i=new At;break}return i.id=e.id,i.question=e.question,i.status=e.status,i.voidReason=e.void_reason,i.points=e.points,i.outcomeType=e.outcome_type,i.validOutcomes=e.valid_outcomes,i.outcome=e.outcome,i});remapEventGameTiebreaker=t=>{let e=new Ta;return e.statTiebreakerEnabled=t.stat_tiebreaker_enabled,e.statTotal=t.stat_total,e}};var yd={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:""},Kt=class extends v{bracketGameRemapper=null;standingGameRemapper=null;eventGameRemapper=null;constructor(t){super(t,O(t.environment,"predictor")),this.bracketGameRemapper=new Qn,this.standingGameRemapper=new Wn,this.eventGameRemapper=new Kn}getBracketGames=async(t,e)=>{let i=t?`/custom/bracket${this.apiSignInUrl}${t.constructMainFiltersUrl()}`:`/custom/bracket${this.apiSignInUrl}`;f(e)&&(i+=m());let a="There was a problem with fetching bracket games list",r=await this.fetchWithoutAuth(i,a);return this.bracketGameRemapper.remapBracketGames(r)};getBracketGameById=async(t,e)=>{let i=f(e)?`/custom/bracket/${t}${this.apiSignInUrl}${m()}`:`/custom/bracket/${t}${this.apiSignInUrl}`,a="There was a problem with fetching bracket game with the following ID: "+t,r=await this.fetchWithoutAuth(i,a);return this.bracketGameRemapper.remapBracketGameById(r)};makeBracketGamePrediction=async(t,e)=>{let i=`/custom/bracket/${t}/predictions${this.apiSignInUrl}`,a="There was a problem with making prediction for bracket game with the following ID: "+t,r="POST",o=JSON.parse(JSON.stringify(e));o.fixtures=this.bracketGameRemapper.remapPredictionToRequestBody(e.fixtures),e.tiebreaker&&(o.tiebreaker={stat_total:e.tiebreaker.statTotal});let n=await this.fetchWithAuth(i,a,r,o);return this.bracketGameRemapper.remapPrediction(n)};updateBracketGamePrediction=async(t,e,i)=>{let a=`/custom/bracket/${t}/predictions/${e}${this.apiSignInUrl}`,r="There was a problem with updating prediction for bracket game with the following ID: "+t,o="PUT",n=JSON.parse(JSON.stringify(i));n.fixtures=this.bracketGameRemapper.remapPredictionToRequestBody(i.fixtures),i.tiebreaker&&(n.tiebreaker={stat_total:i.tiebreaker.statTotal});let l=await this.fetchWithAuth(a,r,o,n);return this.bracketGameRemapper.remapPrediction(l)};getBracketGamePredictionsForUser=async(t,e,i,a)=>{let r=i?`/custom/bracket/${t}/predictions${this.apiSignInUrl}&profile_id=${e}${i.constructMainFiltersUrl()}`:`/custom/bracket/${t}/predictions${this.apiSignInUrl}&profile_id=${e}`;f(a)&&(r+=m());let o=`There was a problem with getting all predictions for user with ID ${e} for bracket game with ID ${t}`,n=await this.fetchWithoutAuth(r,o);return this.bracketGameRemapper.remapPredictionsForUser(n)};getBracketGamePredictionById=async(t,e,i)=>{let a=f(i)?`/custom/bracket/${t}/predictions/${e}/${this.apiSignInUrl}${m()}`:`/custom/bracket/${t}/predictions/${e}/${this.apiSignInUrl}`,r=`There was a problem with getting prediction with ID ${e} for bracket game with ID ${t}`,o=JSON.parse(JSON.stringify(yd));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+=m());let r=`There was a problem with getting rankings for bracket game with ID ${t}`,o=await this.fetchWithoutAuth(a,r);return this.bracketGameRemapper.remapRankings(o)};getStandingsGames=async(t,e)=>{let i=t?`/custom/standing${this.apiSignInUrl}${t.constructMainFiltersUrl()}`:`/custom/standing${this.apiSignInUrl}`;f(e)&&(i+=m());let a="There was a problem with fetching standings games list",r=await this.fetchWithoutAuth(i,a);return this.standingGameRemapper.remapBracketGames(r)};getStandingGameById=async(t,e)=>{let i=f(e)?`/custom/standing/${t}${this.apiSignInUrl}${m()}`:`/custom/standing/${t}${this.apiSignInUrl}`,a="There was a problem with fetching standing game with the following ID: "+t,r=await this.fetchWithoutAuth(i,a);return this.standingGameRemapper.remapStandingGameById(r)};makeStandingGamePrediction=async(t,e)=>{let i=`/custom/standing/${t}/predictions${this.apiSignInUrl}`,a="There was a problem with making prediction for standing game with the following ID: "+t,r="POST",o={standing:e},n=await this.fetchWithAuth(i,a,r,o);return this.standingGameRemapper.remapPrediction(n)};updateStandingGamePrediction=async(t,e,i)=>{let a=`/custom/standing/${t}/predictions/${e}${this.apiSignInUrl}`,r="There was a problem with updating prediction for standing game with the following ID: "+t,o="PUT",n={standing:i},l=await this.fetchWithAuth(a,r,o,n);return this.standingGameRemapper.remapPrediction(l)};getStandingGamePredictionsForUser=async(t,e,i)=>{let a=`/custom/standing/${t}/predictions${this.apiSignInUrl}&profile_id=${e}`;f(i)&&(a+=m());let r=`There was a problem with getting prediction for user with ID ${e} for standing game with ID ${t}`,o=await this.fetchWithoutAuth(a,r);return this.standingGameRemapper.remapPredictionsForUser(o)};getStandingGameRankings=async(t,e,i)=>{let a=e?`/custom/standing/${t}/ranking${this.apiSignInUrl}${e.constructMainFiltersUrl()}`:`/custom/standing/${t}/ranking${this.apiSignInUrl}`;f(i)&&(a+=m());let r=`There was a problem with getting rankings for standing game with ID ${t}`,o=await this.fetchWithoutAuth(a,r);return this.standingGameRemapper.remapRankings(o)};getEventGames=async(t,e)=>{let i=t?`/custom/event${this.apiSignInUrl}${t.constructMainFiltersUrl()}`:`/custom/event${this.apiSignInUrl}`;f(e)&&(i+=m());let a="There was a problem with fetching event games list",r=await this.fetchWithoutAuth(i,a);return this.eventGameRemapper.remapEventGames(r)};getEventGameById=async(t,e)=>{let i=f(e)?`/custom/event/${t}${this.apiSignInUrl}${m()}`:`/custom/event/${t}${this.apiSignInUrl}`,a="There was a problem with fetching event game with the following ID: "+t,r=await this.fetchWithoutAuth(i,a);return this.eventGameRemapper.remapEventGameById(r)};makeEventGamePrediction=async(t,e)=>{let i=`/custom/event/${t}/predictions${this.apiSignInUrl}`,a="There was a problem with making prediction for event game with the following ID: "+t,r="POST",o=JSON.parse(JSON.stringify(e));o.fixtures=this.eventGameRemapper.remapPredictionToRequestBody(e.fixtures),e.tiebreaker&&(o.tiebreaker={stat_total:e.tiebreaker.statTotal});let n=await this.fetchWithAuth(i,a,r,o);return this.eventGameRemapper.remapPrediction(n)};updateEventGamePrediction=async(t,e,i)=>{let a=`/custom/event/${t}/predictions/${e}${this.apiSignInUrl}`,r="There was a problem with updating prediction for event game with the following ID: "+t,o="PUT",n=JSON.parse(JSON.stringify(i));n.fixtures=this.eventGameRemapper.remapPredictionToRequestBody(i.fixtures),i.tiebreaker&&(n.tiebreaker={stat_total:i.tiebreaker.statTotal});let l=await this.fetchWithAuth(a,r,o,n);return this.eventGameRemapper.remapPrediction(l)};getEventGamePredictionsForUser=async(t,e,i,a)=>{let r=i?`/custom/event/${t}/predictions${this.apiSignInUrl}&profile_id=${e}${i.constructMainFiltersUrl()}`:`/custom/event/${t}/predictions${this.apiSignInUrl}&profile_id=${e}`;f(a)&&(r+=m());let o=`There was a problem with getting all predictions for user with ID ${e} for event game with ID ${t}`,n=await this.fetchWithoutAuth(r,o);return this.eventGameRemapper.remapPredictionsForUser(n)};getEventGameRankings=async(t,e,i)=>{let a=e?`/custom/event/${t}/ranking${this.apiSignInUrl}${e.constructMainFiltersUrl()}`:`/custom/event/${t}/ranking${this.apiSignInUrl}`;f(i)&&(a+=m());let r=`There was a problem with getting rankings for event game with ID ${t}`,o=await this.fetchWithoutAuth(a,r);return this.eventGameRemapper.remapRankings(o)}};var _e=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 va=class extends _e{email=null;phoneNumber=null;phoneCountryCode=null;preferences=null};var jn=class{profilesFromResponse=t=>t?t.map(e=>this.publicProfileFromResponse(e)):null;fullProfileFromResponse=t=>{let e=new va;return e.id=t.id,e.name=t.name,e.email=t.email,e.nickname=t.nickname,e.avatar=t.avatar,e.gender=t.gender,e.country=t.country,e.birthDate=t.birth_date,e.phoneCountryCode=t.phone_country_code,e.phoneNumber=t.phone_number,e.verified=t.verified,e.staffMember=t.staff_member,e.anonymous=t.anonymous,e.disabled=t.disabled,e.interests=t.interests?t.interests:[],e.preferences=t.preferences?this.remapPreferences(t.preferences):[],e.followingCount=t.following_count,e.followersCount=t.followers_count,e};publicProfileFromResponse=t=>{let e=new _e;return e.id=t.id,e.name=t.name,e.nickname=t.nickname,e.avatar=t.avatar,e.gender=t.gender,e.country=t.country,e.birthDate=t.birth_date,e.verified=t.verified,e.staffMember=t.staff_member,e.anonymous=t.anonymous,e.disabled=t.disabled,e.interests=t.interests?t.interests:[],e.followingCount=t.following_count,e.followersCount=t.followers_count,e};remapPreferences=t=>t.map(e=>({preferenceId:e.preference_id,categories:e.categories,source:e.source}))};var H=class{meta=new b;data=[]};var Ca=class{avatar=null;followingId=null;name=null;nickname=null;profileId=null};var Yn=class{followResponse=t=>t.map(e=>this.remapResponse(e));followingFromResponse=t=>{let e=new H;return e.meta.pagination.nextPageStartsAfter=t.meta.pagination.next_page_starts_after,e.meta.pagination.itemsPerPage=t.meta.pagination.items_per_page,e.data=t.data.map(i=>this.remapResponse(i)),e};remapResponse=t=>{let e=new Ca;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 Aa=class{avatar=null;followerId=null;name=null;nickname=null;profileId=null};var Oa=class{followsMe=[];iFollow=[];followsMeBack=[]};var Xn=class{followersFromResponse=t=>{let e=new H;return e.meta.pagination.nextPageStartsAfter=t.meta.pagination.next_page_starts_after,e.meta.pagination.itemsPerPage=t.meta.pagination.items_per_page,e.data=t.data.map(i=>this.remapResponse(i)),e};followStatusFromResponse=t=>{let e=new Oa;return e.iFollow=t.i_follow,e.followsMe=t.follows_me,e.followsMeBack=t.follows_me_back,e};remapResponse=t=>{let e=new Aa;return e.avatar=t.avatar,e.followerId=t.follower_id,e.name=t.name,e.profileId=t.profile_id,e}};var bi=class{profile_ids=[]};var xa=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 Jn=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 xa;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 bd="/countries",rt="/profile",Jp="/profiles",Mi=class extends v{profileRemapper=null;followingRemapper=null;followersRemapper=null;leadRemapper=null;lang=null;limitIds=100;constructor(t){super(t,O(t.environment,"profile")),this.lang=t.lang,this.profileRemapper=new jn,this.followingRemapper=new Yn,this.followersRemapper=new Xn,this.leadRemapper=new Jn}getCountries=async t=>{let e=`&lang=${this.lang}`,i=`${bd}${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=`${rt}${this.apiSignInUrl}`,i="";if(t){e=`${Jp}/${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=qt(t,this.limitIds);for(let d of u){let M=`${Jp}${this.apiSignInUrl}&profile_ids=${d.join(",")}`;r=`There was a problem fetching the following profiles: ${d.join(",")}`,i&&(M+=`&disable_cache=${a}`);let _=await this.fetchWithoutAuth(M,r);c.push(...this.profileRemapper.profilesFromResponse(_.data))}return c}let l=`${Jp}${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=`${Jp}${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=`${rt}/followers${this.apiSignInUrl}`,a="There was a problem fetching the followers for own profile";if(t&&!e){i=`${rt}/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=`${rt}/${e}/followers${this.apiSignInUrl}${t.constructFilterUrl()}`:!t&&e&&(i=`${rt}/${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=`${rt}/following${this.apiSignInUrl}`,a="There was a problem fetching the followers of own profile";if(t&&!e){i=`${rt}/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=`${rt}/${e}/following${this.apiSignInUrl}${t.constructFilterUrl()}`:!t&&e&&(i=`${rt}/${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 bi;e.profile_ids=t;let i=rt+`/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 bi;e.profile_ids=t;let i=rt+`/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=`${rt}/badges${this.apiSignInUrl}`,i="There was a problem with fetching own badges";return t?(e=`${rt}/${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=rt+this.apiSignInUrl,i="There was a problem updating the own profile",a="PATCH",r=await this.fetchWithAuth(e,i,a,t);return this.profileRemapper.fullProfileFromResponse(r.data)};collectLead=async t=>{let e=`/leads${this.apiSignInUrl}`,i="There was a problem collecting lead",a="POST",r=await this.fetchWithAuth(e,i,a,this.leadRemapper.toRequest(t));return this.leadRemapper.fromResponse(r.data)};checkFollowStatus=async t=>{let e=`/profile/followers/check-follow-status${this.apiSignInUrl}&profile_ids=${t.join(",")}`,i="There was a problem checking follow status for profiles",a=await this.fetchWithAuth(e,i);return this.followersRemapper.followStatusFromResponse(a.data)};deleteOwnProfile=async()=>{let t=`/profile${this.apiSignInUrl}`,e="There was a problem deleting own profile",i="DELETE";await this.fetchWithAuth(t,e,i)};deleteUserData=async()=>{let t=`/user-data${this.apiSignInUrl}`,e="There was a problem deleting profile data",i="DELETE";await this.fetchWithAuth(t,e,i)}};var J=class{completed=!1;percentage;constructor(t){this.percentage=t}};var La=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 Da=class{totalPercentage;breakdown=new La};var Ii=class{limit=0;startAfter=null;constructor(t){this.limit=t.limit?t.limit:20,this.startAfter=t.startAfter?t.startAfter:null}constructFilterUrl=()=>{let t="";return this.limit&&(t=t+"&",t=t+`limit=${this.limit}`),this.startAfter&&(t=t+"&",t=t+`start_after=${this.startAfter}`),t}};var y=class extends Error{code=0;status=null;message=null;constructor(t,e,i){super(),this.code=t,this.status=e,this.message=i}errorMessage=()=>this.message};var _t=class{localCache;profileHttps=null;activityHttps=null;errorHandlingMode=null;constructor(t,e,i,a){this.localCache=t,this.profileHttps=e,this.activityHttps=i,this.errorHandlingMode=a}getOwn=async()=>{let t=await this.getLocalStorageData("profile");if(t&&Object.keys(t).length)return JSON.parse(JSON.stringify(t));try{let e=await this.profileHttps.getProfile();return await this.localCache.setOwnProfile(e),e}catch(e){throw console.warn("There was a problem retrieving your profile: ",e),e}};getOwnProfileFromCache=async()=>await this.localCache.getOwnProfile();updateOwnProfile=async()=>{try{let t=await this.profileHttps.getProfile();return await this.localCache.setOwnProfile(t),t}catch(t){throw console.warn("There was a problem retrieving your profile: ",t),t}};getByIds=async(t,e,i)=>{if(t&&t.length>0&&e||!t&&t.length===0&&!e)throw new h(400,"invalid_method_call","The method 'getByIds' from Profile namespace is not called correctly. You need to provide 'profileIds' OR 'search' parameters to the method, but you can't use both of them or neither of them.");try{return await this.profileHttps.getProfiles(t,e,i)}catch(a){throw console.warn(`There was a problem retrieving the selected profiles: ${t.join(",")} `,a),a}};getById=async t=>{try{return await this.profileHttps.getProfile(t)}catch(e){throw console.warn(`There was a problem retrieving the selected profile: ${t} `,e),e}};getCountries=async t=>{t=t||!1;let e=await this.localCache.getProfileCountries();if(e&&e.length>0)return e;try{let i=await this.profileHttps.getCountries(t);return await this.localCache.setProfileCountries(i),i}catch(i){throw console.warn("There was a problem retrieving profile countries: ",i),i}};getFollowers=async(t,e)=>{try{t&&(t=new Ii(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 Ii(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 Da,i=0;return t.avatar&&(e.breakdown.addedAvatar.completed=!0,i+=e.breakdown.addedAvatar.percentage),t.birthDate&&(e.breakdown.addedBirthdate.completed=!0,i+=e.breakdown.addedBirthdate.percentage),t.country&&(e.breakdown.addedCountry.completed=!0,i+=e.breakdown.addedCountry.percentage),t.gender&&(e.breakdown.addedGender.completed=!0,i+=e.breakdown.addedGender.percentage),t.interests&&t.interests.length>0&&(t.interests.find(c=>c.type==="team"&&c.favourite)&&(e.breakdown.teamFavourite.completed=!0,i+=e.breakdown.teamFavourite.percentage),t.interests.find(c=>c.type==="team")&&(e.breakdown.teamFollowed.completed=!0,i+=e.breakdown.teamFollowed.percentage),t.interests.find(c=>c.type==="player"&&c.favourite)&&(e.breakdown.playerFavourite.completed=!0,i+=e.breakdown.playerFavourite.percentage),t.interests.find(c=>c.type==="player")&&(e.breakdown.playerFollowed.completed=!0,i+=e.breakdown.playerFollowed.percentage),t.interests.find(c=>c.type==="competition"&&c.favourite)&&(e.breakdown.competitionFavourite.completed=!0,i+=e.breakdown.competitionFavourite.percentage),t.interests.find(c=>c.type==="competition")&&(e.breakdown.competitionFollowed.completed=!0,i+=e.breakdown.competitionFollowed.percentage)),e.totalPercentage=i,e};getStats=async()=>{let t=await this.getLocalStorageData("statistics");if(t&&Object.keys(t).length)return JSON.parse(JSON.stringify(t));try{let e=await this.activityHttps.getStats();return await this.localCache.setProfileStats(e),e}catch(e){throw console.warn("There was a problem retrieving own profile statistics: ",e),e}};getBadges=async t=>{if(t)try{return await this.profileHttps.getBadges()}catch(i){throw console.warn("There was a problem retrieving own profile badges: ",i),i}let e=await this.getLocalStorageData("badges");if(e)return e;try{let i=await this.profileHttps.getBadges();return await this.localCache.setProfileBadges(i),i}catch(i){throw console.warn("There was a problem retrieving own profile badges: ",i),i}};clearLocalStorageData=async()=>{await this.localCache.setOwnProfile({}),await this.localCache.setProfileStats({}),await this.localCache.setProfileBadges(null)};collectLead=async t=>{if(this.errorHandlingMode&&!t)throw this.errorHandlingMode==="standard"?new h(400,"invalid_method_call","The method 'collectLead' from Profile namespace is not called correctly. You need to provide 'requestBody' parameter to the method."):new y(400,"invalid_method_call","The method 'collectLead' from Profile namespace is not called correctly. You need to provide 'requestBody' parameter to the method.");return await this.profileHttps.collectLead(t)};checkFollowStatus=async t=>{if(!t||!Array.isArray(t)||t.length===0)throw this.errorHandlingMode==="standard"?new h(400,"invalid_method_call","Invalid or empty IDs provided. Please provide at least one ID."):new y(400,"invalid_method_call","Invalid or empty IDs provided. Please provide at least one ID.");return await this.profileHttps.checkFollowStatus(t)};getLocalStorageData=async t=>{let e=Math.floor(Date.now()/1e3),i=await this.localCache.getExpiration("profile",t);switch(t){case"profile":if(i>e)return await this.localCache.getOwnProfile();case"statistics":if(i>e)return await this.localCache.getProfileStats();case"badges":if(i>e)return await this.localCache.getProfileBadges();default:return null}}};var Ba=class{id=null;name=null;assets=null};var Zn=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 tl=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 Zn,this.profileFacade=new _t(i,a,r)}getOwnProfile=async()=>{for(;this.isFetching;)console.log("Another thread is fetching profile..."),await this.delay(100);if(this.modified&&this.ownProfile)return console.log("Timestamp is less than 10 minutes OR profile is modifying "),this.ownProfile;let t=Math.floor(Date.now()/1e3);if(!this.ownProfile||this.expireAt<t){this.isFetching=!0,this.expireAt=Math.floor(Date.now()/1e3)+600;try{await this.clearAllProfileData();let e=await this.profileFacade.getOwn();this.setOwnProfile(e)}catch(e){throw this.isFetching=!1,e}return this.modified=!1,this.isFetching=!1,this.ownProfile}return this.ownProfile};delay=t=>new Promise(e=>{setTimeout(e,t)});setOwnProfile=t=>{this.ownProfile=t};getInfo=async()=>{let t=await this.getOwnProfile(),e=JSON.parse(JSON.stringify(t));return delete e.interests,e};showInterests=async()=>{let t=await this.getOwnProfile(),e=JSON.parse(JSON.stringify(t));return await this.idsRemapper.remapInterests(e.interests)};showFullInterests=async()=>{let t=await this.getOwnProfile(),e=JSON.parse(JSON.stringify(t));return await this.idsRemapper.showFullInterests(e.interests)};getFollowers=async t=>await this.profileFacade.getFollowers(t);getFollowing=async t=>await this.profileFacade.getFollowing(t);follow=async t=>{let e=await this.profileFacade.follow(t),i=await this.profileFacade.updateOwnProfile();return this.setOwnProfile(i),e};unfollow=async t=>{let e=await this.profileFacade.unfollow(t),i=await this.profileFacade.updateOwnProfile();return this.setOwnProfile(i),e};getStats=async()=>{await this.clearAllProfileData();let t=await this.profileFacade.getStats();return await this.idsRemapper.remapProfileStats(t)};getBadges=async t=>(await this.clearAllProfileData(),await this.profileFacade.getBadges(t));addInterestPromise=async t=>{this.modified=!0;let e={...t};await this.getOwnProfile();let i=null;t.source!=="custom"?i=await this.idsRemapper.remapInterestToNative(e):i=e;let a=this.ownProfile.interests.filter(r=>r.id!==i.id||r.type!==i.type||r.source!==i.source);return this.ownProfile.interests=[...a],this.ownProfile.interests.push(i),this};addInterest=t=>(this.promises.push(this.addInterestPromise(t)),this);removeInterestPromise=async t=>{this.modified=!0;let e={...t};await this.getOwnProfile();let i=null;return t.source!=="custom"?i=await this.idsRemapper.remapInterestToNative(e):i=e,this.ownProfile.interests=this.ownProfile.interests.filter(a=>a.id!==i.id||a.type!==i.type||a.source!==i.source),this};removeInterest=t=>(this.promises.push(this.removeInterestPromise(t)),this);setBirthdatePromise=async t=>(this.modified=!0,await this.getOwnProfile(),t?this.ownProfile.birthDate=t:this.ownProfile.birthDate=null,this);setBirthdate=t=>(this.promises.push(this.setBirthdatePromise(t)),this);setGenderPromise=async t=>(this.modified=!0,await this.getOwnProfile(),t==="male"||t==="female"?this.ownProfile.gender=t:this.ownProfile.gender="unspecified",this);setGender=t=>(this.promises.push(this.setGenderPromise(t)),this);setNicknamePromise=async t=>(this.modified=!0,await this.getOwnProfile(),this.ownProfile.nickname=t,this);setNickname=t=>(this.promises.push(this.setNicknamePromise(t)),this);setNamePromise=async t=>(this.modified=!0,await this.getOwnProfile(),this.ownProfile.name=t,this);setName=t=>(this.promises.push(this.setNamePromise(t)),this);setCountryPromise=async t=>(this.modified=!0,await this.getOwnProfile(),t&&!this.ownProfile.country?(this.ownProfile.country=new Ba,this.ownProfile.country.id=t):t&&this.ownProfile.country?this.ownProfile.country.id=t:this.ownProfile.country=null,this);setCountry=t=>(this.promises.push(this.setCountryPromise(t)),this);showFullnessProfile=async()=>{let t=await this.getOwnProfile(),e=JSON.parse(JSON.stringify(t));return this.profileFacade.showFullnessProfile(e)};setAvatarPromise=async t=>{if(this.modified=!0,await this.getOwnProfile(),this.profileService.isAvatarValidURL(t))this.ownProfile.avatar=t;else{if(this.configuration.errorHandlingMode==="default")throw new y(400,"invalid_avatar","Invalid URL syntax for avatar image.");if(this.configuration.errorHandlingMode==="standard")throw new h(400,"invalid_avatar","Invalid URL syntax for avatar image.")}return this};setAvatar=t=>(this.promises.push(this.setAvatarPromise(t)),this);delete=async()=>(await this.profileHttps.deleteOwnProfile(),await this.profileFacade.clearLocalStorageData(),!0);deleteData=async()=>(await this.profileHttps.deleteUserData(),await this.profileFacade.clearLocalStorageData(),!0);setEmailPromise=async t=>(this.modified=!0,await this.getOwnProfile(),typeof t=="string"&&t?this.ownProfile.email=t:console.warn(`Wrong email argument: ${t}. Will be ignored when updating profile`),this);setEmail=t=>(this.promises.push(this.setEmailPromise(t)),this);setPhoneCountryCodePromise=async t=>(this.modified=!0,await this.getOwnProfile(),t===null||typeof t=="string"&&t?this.ownProfile.phoneCountryCode=t:console.warn(`Wrong phoneCountryCode argument: ${t}. Will be ignored when updating profile`),this);setPhoneCountryCode=t=>(this.promises.push(this.setPhoneCountryCodePromise(t)),this);setPhoneNumberPromise=async t=>(this.modified=!0,await this.getOwnProfile(),t===null||typeof t=="string"&&t?this.ownProfile.phoneNumber=t:console.warn(`Wrong phoneNumber argument: ${t}. Will be ignored when updating profile`),this);setPhoneNumber=t=>(this.promises.push(this.setPhoneNumberPromise(t)),this);update=async()=>{if(this.promises.length===0)return this.ownProfile;await Promise.all(this.promises);let t=await this.profileFacade.getOwn(),e=await this.getOwnProfile(),i=this.profileService.extractUpdatedProps(t,e);if(this.modified=!1,this.expireAt=0,Object.keys(i).length){let r=await this.profileHttps.updateProfile(i),o=JSON.parse(JSON.stringify(r));return this.setOwnProfile(o),await this.localCache.setOwnProfile(o),delete r.interests,r}let a=JSON.parse(JSON.stringify(this.ownProfile));return delete a.interests,a};clearAllProfileData=async()=>{await this.isNewProfileRequested()&&await this.profileFacade.clearLocalStorageData()};isNewProfileRequested=async()=>{let t=this.profileHttps.extractUserIdFromToken();if(!t)return!1;if(!this.ownProfile){let e=await this.profileFacade.getOwnProfileFromCache();return!!(e&&Object.keys(e).length&&e.id!==t)}return this.ownProfile.id!==t}};var wi=class{idsRemapper=null;profileHttps=null;activityHttps=null;profileFacade=null;profileId="";localCache=null;constructor(t,e,i,a){this.idsRemapper=t,this.profileHttps=i,this.activityHttps=a,this.localCache=e,this.profileFacade=new _t(e,i,a)}getById=t=>new wi(this.idsRemapper,this.localCache,this.profileHttps,this.activityHttps).setId(t);setId=t=>(this.profileId=t,this);getProfile=async()=>await this.profileFacade.getById(this.profileId);getInfo=async()=>{let t=await this.getProfile();return delete t.interests,t};showInterests=async()=>{let t=await this.getProfile(),e=JSON.parse(JSON.stringify(t));return await this.idsRemapper.remapInterests(e.interests)};showFullInterests=async()=>{let t=await this.getProfile(),e=JSON.parse(JSON.stringify(t));return await this.idsRemapper.showFullInterests(e.interests)};getFollowers=async t=>await this.profileFacade.getFollowers(t,this.profileId);getFollowing=async t=>await this.profileFacade.getFollowing(t,this.profileId);showFullnessProfile=async()=>{let t=await this.getProfile();return this.profileFacade.showFullnessProfile(t)};getStats=async t=>{let e=await this.activityHttps.getStats(this.profileId,t);return await this.idsRemapper.remapProfileStats(e)};getBadges=async()=>await this.profileHttps.getBadges(this.profileId)};var el=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 _i=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 il=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 _i(t),t.countryId){let r=await this.idMapping.getEntityIdsBySchemaId([`${t.countryId}`],"country","native");r.country.length===0&&(i=!0),t.countryId=r.country[0]}if(t.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 _i({competitionIds:t,limit:i}),r=await this.getCompetitions(a);r.sort((l,p)=>l.id.localeCompare(p.id));let o=$p(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 Pi=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 Na=class{reason="";words=[]};var Pe=class{enabled=!1;moderateLinks=!1;linksWhitelist=[];moderatorProfileId="";dictionary=new Na};var ka=class{enabled=!1;clientId=null;automaticModeration=new Pe};var xt=class{points=null;gameParticipationCount=null;entityId=null;entityType=null;predictionsMade=null;correctPredictions=null};var Te=class{id;weight;multiplier;conditions};var Ee=class{value=[new Te]};var Re=class{points=null;tiers=null;badges=null};var Ga=class{enabled=!1;clientId=null;conditions={list:null};actions=new Ee;rewards=new Re};var Ua=class{general=null;predictor=null;activity=null;topX=null;matchQuiz=null;discussionPost=null};var Fe=class{enabled=!1;clientId=null;defaultMarkets=null;competitionsWhitelist=null;authRequirement=null};var Se=class{enabled=!1;clientId=null;minFixtures=null;maxFixtures=null;competitionsWhitelist=null;authRequirement=null};var Va=class{competitions=[];teams=[];markets=[]};var ve=class{enabled=!1;clientId=null;fullCoverageCompetitions=null;markets=null;successRateScopes=new Va;userDataConfig=null};var Ha=class{storeIp=!1;storeDeviceId=!1;storeAgent=!1};var $a=class{potm=[];poll=[]};var za=class{predictor=[];topX=[];matchQuiz=[];games=[];football=[];classicQuizzes=[];eitherOr=[];discussions=[];voting=new $a};var Q=class{id;label;description;flags;assets={mainImageUrl:""};enabled};var qa=class{predictionsNumber;correctPredictions;points;fromDate;toDate};var Qa=class extends Q{requirements=new qa};var Wa=class{participationCount;points;fromDate;toDate};var Ka=class extends Q{requirements=new Wa};var ja=class{participationCount;points;specificGames;fromDate;toDate};var Ya=class extends Q{requirements=new ja};var Xa=class{predictionsNumber;correctPredictions;points;entityId;entityType;entityModel=null};var Ja=class extends Q{requirements=new Xa};var Za=class{participationCount;fromDate;toDate};var tr=class extends Q{requirements=new Za};var er=class{totalDiscussionPoints;postsCount;postPoints;reactionsCount};var ir=class extends Q{requirements=new er};var ar=class{points;voteCount;entityId;entityType;entityModel};var Ce=class extends Q{requirements=new ar};var Ae=class{points=null;tiers=null;badges=null};var rr=class{enabled=!1;clientId=null;conditions={list:null};actions=new Ee;rewards=new Ae};var or=class{general=[];predictor=[];topX=[];matchQuiz=[]};var sr=class{id;label;assets={mainImageUrl:""};enabled;requirements=new xt};var Oe=class extends xt{postPoints=null;postsCount=null;reactionsCount=null;totalDiscussionPoints=null};var nr=class{id;label;assets={mainImageUrl:""};enabled;requirements=new Oe};var xe=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 Le=class{total=null;minGoalkeepers=null;maxGoalkeepers=null;minDefenders=null;maxDefenders=null;minMidfielders=null;maxMidfielders=null;minStrikers=null;maxStrikers=null};var lr=class{enabled=!1;clientId=null;addPointsToProfileTotal=!1;coefficients=new xe;players=new Le;multipliers=null;competitionsWhitelist=[]};var pr=class{captain=null;viceCaptain=null};var al=class{remapPredictorConfig=t=>{let e=new ve;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 Se;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 Fe;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 Ga;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 rr;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 ka;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 lr;return e.enabled=t.enabled,e.clientId=t.client_id,e.addPointsToProfileTotal=t.add_points_to_profile_total,e.competitionsWhitelist=t.competitions_whitelist,e.multipliers=t.multipliers?this.remapMultipliers(t.multipliers):null,e.players=this.remapFantasyPlayers(t.players),e.coefficients=this.remapFantasyCoefficients(t.coefficients),e};remapFantasyPlayers=t=>{let e=new Le;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 xe;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 Pe;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 Ae;return e.points=this.remapPoints(t.points),e.tiers=t.tiers,e.badges=this.remapNewBadges(t.badges),e};remapRewards=t=>{let e=new Re;return e.points=this.remapPoints(t.points),e.tiers=t.tiers,e.badges=this.remapBadges(t.badges),e};remapPoints=t=>{let e=new Ua;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 or;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 za;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 Qa;return i.id=e.id,i.enabled=e.enabled,i.label=e.label,i.description=e.description,i.flags=e.flags,e.assets?i.assets.mainImageUrl=e.assets.main_image_url:i.assets=e.assets,e.requirements&&(i.requirements.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 Ka;return i.id=e.id,i.enabled=e.enabled,i.label=e.label,i.description=e.description,i.flags=e.flags,e.assets?i.assets.mainImageUrl=e.assets.main_image_url:i.assets=e.assets,e.requirements&&(i.requirements.participationCount=e.requirements.participation_count,i.requirements.points=e.requirements.points,i.requirements.fromDate=e.requirements.from_date,i.requirements.toDate=e.requirements.to_date),i});remapBadgeValuesGames=t=>t.map(e=>{let i=new Ya;return i.id=e.id,i.enabled=e.enabled,i.label=e.label,i.description=e.description,i.flags=e.flags,e.assets?i.assets.mainImageUrl=e.assets.main_image_url:i.assets=e.assets,e.requirements&&(i.requirements.participationCount=e.requirements.participation_count,i.requirements.points=e.requirements.points,i.requirements.fromDate=e.requirements.from_date,i.requirements.toDate=e.requirements.to_date,i.requirements.specificGames=e.requirements.specific_games?this.remapSpecificGamesRequirement(e.requirements.specific_games):null),i});remapSpecificGamesRequirement=t=>t.map(e=>({gameId:e.game_id,gameType:e.game_type,gameModel:null}));remapBadgeValuesFootball=t=>t.map(e=>{let i=new Ja;return i.id=e.id,i.enabled=e.enabled,i.label=e.label,i.description=e.description,i.flags=e.flags,e.assets?i.assets.mainImageUrl=e.assets.main_image_url:i.assets=e.assets,e.requirements&&(i.requirements.predictionsNumber=e.requirements.predictions_number,i.requirements.correctPredictions=e.requirements.correct_predictions,i.requirements.points=e.requirements.points,i.requirements.entityId=e.requirements.entity_id,i.requirements.entityType=e.requirements.entity_type),i});remapBadgeValuesMiniGames=t=>t.map(e=>{let i=new tr;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 ir;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 Ce;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 sr;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 xt;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 Ha;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 nr;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 Oe;return e.points=t.points,e.gameParticipationCount=t.game_participation_count,e.entityId=t.entity_id,e.entityType=t.entity_type,e.predictionsMade=t.predictions_made,e.correctPredictions=t.correct_predictions,e.postPoints=t.post_points,e.postsCount=t.posts_count,e.reactionsCount=t.reactions_count,e.totalDiscussionPoints=t.total_discussion_points,e};remapMultipliers=t=>{let e=new pr;return e.captain=t.captain,e.viceCaptain=t.vice_captain,e}};var cr=class{entityId;entityType;entityModel=null};var Zp=class{totalItems=0};var tc=class{id=null;label=null};var ec=class{type=null;id=null;label=null};var ur=class{id=null;source=null;type=null};var w=class{limit;startAfter;constructor(t){this.limit=t&&t.limit?t.limit:null,this.startAfter=t&&t.startAfter?t.startAfter:null}constructMainFiltersUrl(){let t="";return this.limit&&(t+="&",t+=`limit=${this.limit}`),this.startAfter&&(t+="&",t+=`start_after=${this.startAfter}`),t}};var dr=class extends w{};var ic=class{fixtures=[];tiebreaker};var tu=(i=>(i.PARTICIPANT_ONE="PARTICIPANT_ONE",i.PARTICIPANT_TWO="PARTICIPANT_TWO",i.DRAW="DRAW",i))(tu||{});var mr=class{matchId="";participantOne="";participantTwo="";winner="PARTICIPANT_ONE"};var ft=(o=>(o.OPEN="OPEN",o.LIVE="LIVE",o.PENDING="PENDING",o.CANCELED="CANCELED",o.CLOSED="CLOSED",o.SETTLED="SETTLED",o))(ft||{});var hr=class extends w{status=null;sortOrder=null;gameIds=null;constructor(t){super(t),this.status=t?.status||null,this.sortOrder=t?.sortOrder||null,this.gameIds=t?.gameIds||null}constructMainFiltersUrl(){let t=super.constructMainFiltersUrl();return this.status&&Object.values(ft).includes(this.status)?(t+="&",t+=`status=${this.status}`):this.status!==null&&console.warn(`The filter 'status' has the following INVALID value: ${this.status}. It will be not passed as a query param in the URL. For more information visit our documentation.`),this.sortOrder&&(this.sortOrder==="asc"||this.sortOrder==="desc"||this.sortOrder==="ASC"||this.sortOrder==="DESC")?(t+="&",t+=`sort_order=${this.sortOrder}`):this.sortOrder!==null&&console.warn(`The filter 'sortOrder' has the following INVALID value: ${this.sortOrder}. It will be not passed as a query param in the URL. For more information visit our documentation.`),this.gameIds&&Array.isArray(this.gameIds)&&this.gameIds.length>0?(t+="&",t+=`game_ids=${this.gameIds}`):this.gameIds!==null&&console.warn(`The filter 'gameIds' has the following INVALID value: ${this.gameIds}. It will be not passed as a query param in the URL. For more information visit our documentation.`),t}};var fr=class{profileId="";profileModel=null;challengeId="";challengeModel=null;message=""};var De=class{name="";description="";invitation_code="";template_id="";users_can_invite_users=!1;administrators=[];scoring_starts_at=""};var gr=class extends De{type="ONE_VS_ONE"};var Be=class{name="";description="";invitation_code="";template_id="";users_can_invite_users=!1;administrators=[];pinned_posts=[];scoring_starts_at=""};var yr=class extends Be{type="ONE_VS_ONE"};var br=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 Mr=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 wr=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 ac=class{content="";replyId="";discussionLabel="";discussionUrl="";userNickname="";context=null};var Ne=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 _r=class extends Ne{userModel=null};var Pr=class{content="";reply_id="";discussion_label="";discussion_url="";anonymous_nickname="";context=null};var Tr=class{id="";postsCount=0};var Lt=class{pagination={totalItems:0,nextPageStartsAfter:"",lastCommentCreateTimestamp:""}};var Er=class{meta=new Lt;data=[]};var Rr=class{meta=new Lt;data=[]};var Fr=class{meta=new b;data=[]};var Sr=class{type="";userIds=[];reactionCount=0};var vr=class{userId=null;reason="AD";reasonDetails=null};var Cr=class{updatedAt="";content=""};var Md=["CREATED_AT_ASC","CREATED_AT_DESC","POSTS_COUNT_ASC","POSTS_COUNT_DESC"],Id=["ACTIVE","INACTIVE"],Ar=class extends w{discussionIds;label;discussionUrl;fromDate;toDate;fromCount;toCount;sort;status;skipDeleted;constructor(t){super(t),this.discussionIds=t&&t.discussionIds?t.discussionIds:null,this.label=t&&t.label?t.label:null,this.discussionUrl=t&&t.discussionUrl?t.discussionUrl:null,this.fromDate=t&&t.fromDate?t.fromDate:null,this.toDate=t&&t.toDate?t.toDate:null,this.fromCount=t&&t.fromCount?t.fromCount:null,this.toCount=t&&t.toCount?t.toCount:null,this.sort=t&&t.sort?t.sort:null,this.status=t?.status||null,this.skipDeleted=t&&t.skipDeleted!==void 0?t.skipDeleted:null}constructMainFiltersUrl(){let t=super.constructMainFiltersUrl();return this.discussionIds!==null&&(t+=`&discussion_ids=${this.discussionIds.join(",")}`),this.label!==null&&(t+=`&label=${this.label}`),this.discussionUrl!==null&&(t+=`&discussion_url=${this.discussionUrl}`),this.fromDate!==null&&(t+=`&from_date=${this.fromDate}`),this.toDate!==null&&(t+=`&to_date=${this.toDate}`),this.fromCount!==null&&(t+=`&from_count=${this.fromCount}`),this.toCount!==null&&(t+=`&to_count=${this.toCount}`),this.sort&&Md.includes(this.sort.toUpperCase())&&(t+=`&sort=${this.sort.toUpperCase()}`),this.status&&Id.includes(this.status.toUpperCase())&&(t+=`&status=${this.status.toUpperCase()}`),this.skipDeleted!==null&&(t+=`&skip_deleted=${this.skipDeleted}`),t}};var jt=class extends w{skipDeleted;skipModerated;sort;constructor(t){super(t),this.skipDeleted=t&&t.skipDeleted!==void 0?t.skipDeleted:null,this.skipModerated=t&&t.skipModerated!==void 0?t.skipModerated:null,this.sort=t&&t.sort?t.sort.toLocaleLowerCase():null}constructMainFiltersUrl(){let t=super.constructMainFiltersUrl();return this.skipDeleted!==null&&(t+=`&skip_deleted=${this.skipDeleted}`),this.skipModerated!==null&&(t+=`&skip_moderated=${this.skipModerated}`),this.sort&&(t+=`&sort=${this.sort}`),t}};var Or=class extends w{fromDate;toDate;entityIds;entityType;contentType;constructor(t){super(t),this.fromDate=t?.fromDate||null,this.toDate=t?.toDate||null,this.entityIds=t?.entityIds||null,this.entityType=t?.entityType||null,this.contentType=t?.contentType||null}constructMainFiltersUrl(){let t=super.constructMainFiltersUrl();return this.fromDate!==null&&(t+=`&from_date=${this.fromDate}`),this.toDate!==null&&(t+=`&to_date=${this.toDate}`),this.entityIds!==null&&this.entityIds.length>0&&(t+=`&entity_ids=${this.entityIds}`),this.contentType!==null&&(t+=`&content_type=${this.contentType}`),t}};var xr=class extends w{status=null;sortOrder=null;gameIds=null;constructor(t){super(t),this.status=t?.status||null,this.sortOrder=t?.sortOrder||null,this.gameIds=t?.gameIds||null}constructMainFiltersUrl(){let t=super.constructMainFiltersUrl();return this.status&&Object.values(ft).includes(this.status)?(t+="&",t+=`status=${this.status}`):(this.status!==null||this.status!==void 0)&&console.warn(`The filter 'status' has the following INVALID value: ${this.status}. It will be not passed as a query param in the URL. For more information visit our documentation.`),this.sortOrder&&(this.sortOrder==="asc"||this.sortOrder==="desc"||this.sortOrder==="ASC"||this.sortOrder==="DESC")?(t+="&",t+=`sort_order=${this.sortOrder}`):(this.sortOrder!==null||this.sortOrder!==void 0)&&console.warn(`The filter 'sortOrder' has the following INVALID value: ${this.sortOrder}. It will be not passed as a query param in the URL. For more information visit our documentation.`),this.gameIds&&Array.isArray(this.gameIds)&&this.gameIds.length>0?(t+="&",t+=`game_ids=${this.gameIds}`):(this.gameIds!==null||this.gameIds!==void 0)&&console.warn(`The filter 'gameIds' has the following INVALID value: ${this.gameIds}. It will be not passed as a query param in the URL. For more information visit our documentation.`),t}};var Lr=class extends w{};var Dr=class extends w{};var rc=class{id="";predictionType;prediction};var oc=class{fixtures=[];tiebreaker};var sc=class{options=[]};var nc=class{min=0;max=0};var Br=class{templateId=null;playerId=null};var Nr=class{filters=new Br};var kr=class{meta=new Nr;data=[]};var Gr=class{key=null;label=null;value=null};var Ur=class{templateId=null};var Vr=class{filters=new Ur};var Hr=class{meta=new Vr;data=[]};var ke=class{template_id=null;group_id=null;fixtures=[]};var Ge=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 Ue=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 Ge;stats=new Ue};var zr=class{playerId=null;playerModel=null;points=null;rank=null};var qr=class{id="";country=null;gender="";assets=null;type="";name=""};var Qr=class{id="";country=null;gender="";assets=null;type="";name="";participants=[]};var Wr=class{id="";alias="";countryCode="";assets=null;name=""};var X=class{type=null;subType=null};var Kr=class{id="";kickoffAt="";finishedAt="";updatedAt="";availableMarkets=null;homeTeam=null;awayTeam=null;isDeleted=!1;undecided=!1;lineupsConfirmed=!1;startedAt="";minute="";scores=null;context={competition:null};status=new X};var jr=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 X;lineups=null};var gt=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 Yr=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 Xr=class{ftScore=null;htScore=null;aetScore=null;aggScore=null;penScore=null};var Ve=class{homeTeam={players:[]};awayTeam={players:[]}};var Jr=class{minute="";type="";teamId="";player=null;relatedPlayer=null;updatedAt=""};var Zr=class{playerId=null;position=null;minutesPlayed=null;yellowCards=null;redCards=null;goals=null;penaltyGoals=null;penaltyCommitted=null;penaltyWon=null;penaltyMissed=null;penaltySaved=null;penaltyReceived=null;ownGoals=null;assists=null;cleanSheets=null;shots=null;shotsOn=null;shotsBlocked=null;offsides=null;foulsCommitted=null;foulsWon=null;tackles=null;tacklesBlocks=null;tacklesInterceptions=null;concededGoals=null;caughtBall=null;saves=null;passes=null;crosses=null;interceptions=null;keyPasses=null;passesAccuracy=null;duels=null;duelsWon=null;dribblesAttempts=null;dribblesSuccess=null;dribblesPast=null;updatedAt=null};var to=class{id="";country=null;birthDate="";firstName="";lastName="";name="";position="";assets=null;isDeleted=!1;teams=[]};var eo=class{id="";country=null;birthDate="";firstName="";lastName="";name="";position="";assets=null;isDeleted=!1;competitions=[];teams=[]};var io=class{id="";startDate="";endDate="";shirtNumber;loan=!1;position="";country=null;name="";assets=null;birthDate=""};var ao=class{id="";country=null;birthDate="";firstName="";lastName="";name="";position="";assets=null};var Ti=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 lc=class{headshot=null};var pc=class{id=null;name=null;country=null};var ro=class{id="";name="";position="";shirtNumber;assets=null;type=""};var oo=class{id="";country=null;gender="";assets=null;name="";code="";national=!1;undecided=!1;fullName="";shortName="";isDeleted=!1};var so=class{primary=null;secondary=null;tertiary=null};var no=class{id="";country=null;gender="";assets=null;name="";competitions=[];code="";national=!1;fullName="";shortName="";isDeleted=!1;undecided=!1;colors=new so;squad=[]};var cc=class{teamId=null;matches=[]};var lo=class{teams=null;players=null;competitions=null};var po=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 Yt=class{meta=new k;data=[]};var uc=class{logo=null};var dc=class{profile=null;football=null;predictor=null;loyalty=null;topX=null;matchQuiz=null;activity=null;miniGames=null;discussions=null;privateLeagues=null;challenges=null;progress=null;voting=null;fantasy=null;helpers=null;idMapping=null;bracketGame=null;lists=null;standingGame=null;eventGame=null;odds=null;getVersion=null};var mc=class{apiKey;clientId;environment;idSchema;lang;errorHandlingMode;oddClient;cookieToken;authProvider};var W=class{main=null;cover=null;mobile=null};var co=class{colors=null;urls=null;images=null};var uo=class{primaryColor=null;secondaryColor=null;contentColor=null;backgroundColor=null;borderColor=null;additionalColor=null};var mo=class{primaryUrl=null;secondaryUrl=null;privacyPolicyUrl=null;termsAndConditionsUrl=null;additionalUrl=null};var ho=class{mainLogo=null;mobileLogo=null;backgroundImage=null;mobileBackgroundImage=null;additionalImage=null};var hc=class{preferenceId="";categories=[];source=""};var fo=class{input=null;output=null};var go=class{meta=new fo;data=[]};var yo=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 bo=class{general;predictor;topX;matchQuiz};var Mo=class{predictor;topX;matchQuiz;games;football;classicQuizzes;eitherOr;discussions;potm;poll};var fc=class extends Ce{};var gc=class{count=0;breakdown=[]};var yc=class{footballCompetitions;footballTeams;footballPlayers};var Io=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 wo=class{templateId=null;limit=null;page=null;groupId=null;constructor(t){this.templateId=t?.templateId||null,this.limit=t?.limit||null,this.page=t?.page||null,t?.groupId!==void 0&&console.warn("Warning: groupId property is deprecated and no longer supported by the API. This property will be removed in a future version. Please update your code accordingly.")}constructFiltersUrl(){let t="";return this.templateId&&(t+=`&template_id=${this.templateId}`),this.limit&&(t+=`&limit=${this.limit}`),this.page&&(t+=`&page=${this.page}`),t}};var _o=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 Po=class{sortOrder=null;rankType=null;leaderboardIds=null;gameType=null;limit=null;page=null;groupId=null;constructor(t){this.sortOrder=t.sortOrder,this.rankType=t.rankType,this.leaderboardIds=t.leaderboardIds,this.gameType=t.type&&t.type.toLowerCase()==="game"?t.gameType:null,this.limit=t.limit,this.page=t.page,t?.groupId!==void 0&&console.warn("Warning: groupId property is deprecated and no longer supported by the API. This property will be removed in a future version. Please update your code accordingly.")}constructFiltersUrl=()=>{let t="";return this.sortOrder&&(t+="&",t+=`sort_order=${this.sortOrder}`),this.rankType&&(t+="&",t+=`rank_type=${this.rankType}`),this.leaderboardIds&&(t+="&",t+=`type_ids=${this.leaderboardIds.join(",")}`),this.gameType&&(t+="&",t+=`game_type=${this.gameType}`),this.limit&&(t+="&",t+=`limit=${this.limit}`),this.page&&(t+="&",t+=`page=${this.page}`),t}};var To=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 Eo=class{position=null;points=null;predictionsMade=null;profileId=null;profileModel=null;successRatePercent=null};var He=class{templateId=null;privateLeagueId=null;fromDate=null;toDate=null;pagination=new Y};var bc=class{meta=new He;data=[]};var Dt=class{rankType=null;fromDate=null;toDate=null;pagination=new Y};var Mc=class{meta=new Dt;data=[]};var $e=class{position=null;profileId=null;profileModel=null;points=null;predictionsMade=null};var Ro=class{flags="";status="";type="";activeFrom="";activeTo="";createdFrom="";createdTo="";updatedFrom="";updatedTo=""};var Fo=class{pagination=new Y;filters=new Ro};var Ic=class{id=null;points=null};var wc=class extends Te{points;alternative;constructor(){super(),delete this.weight}};var So=class extends $e{id=null;rankType=null;model=null;gameType=null};var _c=class{meta=new Dt;data=[]};var vo=class{groupId;averagePoints;highestPoints};var Bt=class{id=null;name=null;description=null;type=null;fromDate=null;toDate=null;markets=[];teamIds=[];matchIds=[];groups=[];gameIds=[];gameTypes=[];competitionIds=[];excludedProfileIds=[];rules=null;labels=null;customFields=null;branding=null;flags=null;images=new W;status=null;automaticallyChangeStatus=!0;createdAt=null;updatedAt=null;related=null};var Co=class extends Bt{adContent=null};var Ao=class{groupId=null;label=null;flags=[];filters=null};var Oo=class{fromDate=null;toDate=null;matchIds=[]};var Pc=class{enabled=!1;id=null;label=null;points=null};var xo=class{value=null;target=null;playerId=null;playerModel=null;result=null};var Lo=class{matchId=null;matchType=null;market=null;matchModel=null;matchStatus=new X;prediction=new xo};var Do=class{gameId=null;results=null;tieBreakers=null};var yt=class{timeTiebreaker=!1};var Pt=class{id=null;title=null;description=null;type=null;status=null;authRequirement=null;outcome=null;predictionsCutoff=null;fixtures=[];tiebreaker=new yt;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 ze=class{id=null;title=null;alternativeTitle=null;description=null;type=null;images=new W;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 Nt=class extends w{flags=null;status=null;entityIds=null;entityType=null;sort=null;groupByStatus=null;language=null;title=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,this.title=t&&t.title?t.title: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}`),this.title!==null&&(t+=`&title=${this.title}`),t}};var Bo=class extends Nt{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 No=class extends ze{rules=null;questions=[]};var ko=class{questionId=null;question=null;images=null;embedCode=null;explanation=null;options=[]};var Go=class{optionId=null;option=null;images=null;correct=null};var Tc=class{questionId=0;optionId=0};var Uo=class{classicQuizId=null;userId=null;questions=[];correctOptions=null;personalBest=null;points=null;attempts=null};var Vo=class{questionId=null;optionId=null;correct=null;correctOptionId=null};var Ho=class extends w{classicQuizIds=null;constructor(t){super(t),this.classicQuizIds=t?.classicQuizIds||null}constructMainFiltersUrl(){let t=super.constructMainFiltersUrl();return this.classicQuizIds&&this.classicQuizIds.length>0&&(t+=`&classic_quiz_ids=${this.classicQuizIds.join(",")}`),t}};var $o=class{classicQuizId=null;classicQuizModel=null;correct=null;classicQuizQuestions=null;personalBest=null;points=null;answers=[];attempts=0};var Ec=class{meta=new b;data=[]};var zo=class{questionId=null;questionModel=null;wrong=null;correct=null;skipped=null;total=null};var qe=class{classicQuizIds=null};var Qe=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 qo=class extends Qe{classicQuizIds=null;constructor(t){super(t),this.classicQuizIds=t?.classicQuizIds||null}constructMainFiltersUrl(){let t=super.constructMainFiltersUrl();return this.classicQuizIds&&this.classicQuizIds.length>0&&(t+=`&classic_quiz_ids=${this.classicQuizIds.join(",")}`),t}};var We=class{pagination=new Y;filters=new qe};var Qo=class{position=null;profileId=null;profileModel=null;points=null};var Wo=class{position=null;classicQuizId=null;classicQuizModel=null;points=null};var Rc=class{meta=new k;data=[]};var Fc=class{meta=new We;data=[]};var Ke=class{id="";title="";alternativeTitle="";description="";images=new W;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 Ko=class extends Nt{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 jo=class extends Ke{rules=""};var Yo=class{correctSteps=0;score=0};var Sc=class{meta=new b;data=[]};var Xo=class{eitherOrId="";personalBest=0;betterThan=0};var Jo=class{instanceId="";eitherOrId="";gameStartedAt="";currentStep=0;currentStreak=0;remainingSteps=0;currentLives=0;currentPoints=0;personalBest=0;participationCount=0;finishedParticipationsCount=0;steps=[]};var Zo=class{pair="";answer=""};var ts=class extends Zo{expired=!1;time=0};var es=class{main;mobile};var Ei=class{id="";label="";images=new es;value=null};var is=class{pairId="";userSelection="";correct=null;played=null;timestamp="";optionOne=new Ei;optionTwo=new Ei};var as=class{rangeStartInclusive=0;rangeEndInclusive=0;totalUsers=0};var rs=class{standings=[];breakdown=[]};var os=class{userId="";userModel=null;personalBest=""};var kt=class{content=null;tags=[];campaign=null};var Gt=class{id=null;model=null;source=null;type=null};var ss=class{questions=null;correctAnswers=null};var je=class{id=null;title=null;alternativeTitle=null;description=null;images=new W;participationCount=null;status=null;language=null;authRequirement=null;flags=null;customFields=null;labels=null;branding=null;related=[];time=null;maxAttempts=null;adContent=null;context=null;createdAt=null;updatedAt=null};var vc=class{meta=new b;data=[]};var ns=class{personaId=null;title=null;description=null;images=null};var ls=class{questionId=null;question=null;images=null;explanation=null;options=[]};var ps=class{personaId=null;points=null};var cs=class{optionId=null;option=null;images=null;personaPoints=[];preferenceMapping=[]};var Ri=class extends je{rules=null;questions=[];personaResults=[]};var us=class extends Nt{personalityQuizIds=null;constructor(t){super(t),this.personalityQuizIds=t&&t.personalityQuizIds?t.personalityQuizIds:null}constructMainFiltersUrl(){let t=super.constructMainFiltersUrl();return this.personalityQuizIds&&this.personalityQuizIds.length>0&&(t+=`&personality_quiz_ids=${this.personalityQuizIds.join(",")}`),t}};var Cc=class{questionId=0;optionId=0};var ds=class{personalityQuizId=null;userId=null;questions=[];personas=[];attempts=null};var ms=class{questionId=null;optionId=null};var hs=class{personaId=null;percent=null};var fs=class{id=null;name=null;url=null;assets=[];links=[];branding=null;eventUrls=[];stakesDisclaimer=null;domainName=null};var gs=class{backgroundColor=null;textColor=null};var Ac=class{appType=null;selectionTemplateUrl=null;eventTemplateUrl=null;homepageUrl=null};var ys=class{logo=null;type=null;transparentBackgroundUrl=null;backgroundColor=null};var bs=class{url=null;appType=null};var eu=(i=>(i.PRE_EVENT="PRE_EVENT",i.LIVE="LIVE",i.ALL="ALL",i))(eu||{}),iu=(e=>(e.ORDINARY_TIME="ORDINARY_TIME",e.FULL_TIME="FULL_TIME",e))(iu||{}),au=(i=>(i.DECIMAL="DECIMAL",i.MONEYLINE="MONEYLINE",i.FRACTIONAL="FRACTIONAL",i))(au||{});var ru=(B=>(B.FT_1X2="FT_1X2",B.DOUBLE_CHANCE="DOUBLE_CHANCE",B.HT_FT="HT_FT",B.BOTH_TEAMS_SCORE="BOTH_TEAMS_SCORE",B.CORRECT_SCORE="CORRECT_SCORE",B.PLAYER_SCORE_FIRST_GOAL="PLAYER_SCORE_FIRST_GOAL",B.PLAYER_SCORE="PLAYER_SCORE",B.PLAYER_RED_CARD="PLAYER_RED_CARD",B.PLAYER_YELLOW_CARD="PLAYER_YELLOW_CARD",B.OVER_GOALS_0_5="OVER_GOALS_0_5",B.OVER_GOALS_1_5="OVER_GOALS_1_5",B.OVER_GOALS_2_5="OVER_GOALS_2_5",B.OVER_GOALS_3_5="OVER_GOALS_3_5",B.OVER_GOALS_4_5="OVER_GOALS_4_5",B.OVER_GOALS_5_5="OVER_GOALS_5_5",B))(ru||{}),wd={["FT_1X2"]:"1x2",["DOUBLE_CHANCE"]:"DOUBLE_CHANCE",["HT_FT"]:"FIRST_HALF_AND_FINAL_RESULT",["BOTH_TEAMS_SCORE"]:"BOTH_TO_SCORE",["CORRECT_SCORE"]:"CORRECT_SCORE",["PLAYER_SCORE_FIRST_GOAL"]:"FIRST_PLAYER_TO_SCORE",["PLAYER_SCORE"]:"PLAYER_TO_SCORE_DURING_GAME",["PLAYER_RED_CARD"]:"PLAYER_TO_RECEIVE_CARD",["PLAYER_YELLOW_CARD"]:"PLAYER_TO_RECEIVE_CARD"},Ms=class{oddType="PRE_EVENT";scopeType="ORDINARY_TIME";oddFormat="DECIMAL";marketTypes=["FT_1X2"];constructor(t){this.validateFilters(t)}constructFiltersUrl(){let t=this.marketTypes.map(e=>this.mapToSportal365Market(e));return`&odd_type=${this.oddType}&scope_type=${this.scopeType}&odd_format=${this.oddFormat}&market_types=${t.join(",")}`}validateFilters(t){let e=Object.values(eu),i=Object.values(iu),a=Object.values(au),r=Object.values(ru);t?.oddType&&(e.includes(t.oddType)?this.oddType=t.oddType:console.warn(`The filter "oddType" is NOT valid and therefore it will be set to PRE_EVENT. The VALID values are : ${e.join(", ")}`)),t?.scopeType&&(i.includes(t.scopeType)?this.scopeType=t.scopeType:console.warn(`The filter "scopeType" is NOT valid and therefore it will be set to ORDINARY_TIME. The VALID values are : ${i.join(", ")}`)),t?.oddFormat&&(a.includes(t.oddFormat)?this.oddFormat=t.oddFormat:console.warn(`The filter "oddFormat" is NOT valid and therefore it will be set to DECIMAL. The VALID values are : ${a.join(", ")}`)),t?.marketTypes&&Array.isArray(t?.marketTypes)&&t?.marketTypes.length>0&&(t.marketTypes.every(o=>r.includes(o))?this.marketTypes=t.marketTypes:console.warn(`The filter "marketTypes" is NOT valid and therefore it will be set to FT_1X2. The VALID values are : ${r.join(", ")}`))}mapToSportal365Market(t){return t.startsWith("OVER_GOALS_")?"OVER_UNDER":wd[t]}};var Is=class{type=null;scope=null;selections=[]};var ws=class{id=null;type=null;name=null;entityType=null};var _s=class{id=null;name=null;code=null;value=null;odds=null;urls=[];movement=null;oddsOld=null;entityType=null;additionalInfo=null;providerInfo=null};var Ps=class{id=null;name=null;code=null;entityType=null};var Ts=class{selectionId=null;eventId=null;marketId=null;competitionId=null};var Es=class{bookmaker=null;type=null;markets=[]};var Oc=class{main=null;all=null};var Rs=class{value=null;playerId=null;playerModel=null;playerRole};var Ye=class{market=null;matchId=null;matchType=null;matchModel=null;prediction=new Rs;result=null};var Xe=class{settledAt=null;resettledAt=null;status=null;outcome=null;points=0};var ot=class{value=!1};var Fs=class{matchId=null;market="BOTH_TEAMS_SCORE";matchType="FOOTBALL";prediction=null;constructor(t,e){this.matchId=t,this.prediction=new ot,this.prediction.value=e}};var Ss=class{value};var vs=class{matchId=null;market="CORNERS_MATCH";matchType="FOOTBALL";prediction=null;constructor(t,e){this.matchId=t,this.prediction=new Ss,this.prediction.value=e}};var Cs=class{value=null};var Ut=class{matchId=null;market=null;matchType="FOOTBALL";prediction=null;constructor(t,e,i){this.matchId=t,this.market=e,this.prediction=new Cs,this.prediction.value=i}};var As=class{value=null};var Os=class{matchId=null;market="DOUBLE_CHANCE";matchType="FOOTBALL";prediction=null;constructor(t,e){this.matchId=t,this.prediction=new As,this.prediction.value=e}};var xs=class{value=null};var Ls=class{matchId=null;market="HT_FT";matchType="FOOTBALL";prediction=null;constructor(t,e){this.matchId=t,this.prediction=new xs,this.prediction.value=e}};var Ds=class{value=null};var Bs=class{matchId=null;market=null;matchType="FOOTBALL";prediction=null;constructor(t,e,i){this.matchId=t,this.market=e,this.prediction=new Ds,this.prediction.value=i}};var Je=class{matchId=null;market=null;matchType="FOOTBALL";prediction=null;constructor(t,e,i){this.matchId=t,this.market=e,this.prediction=new ot,this.prediction.value=i}};var Ze=class{matchId=null;market=null;matchType="FOOTBALL";prediction=null;constructor(t,e,i){this.matchId=t,this.market=e,this.prediction=new ot,this.prediction.value=i}};var Ns=class{matchId=null;market="PENALTY_MATCH";matchType="FOOTBALL";prediction=null;constructor(t,e){this.matchId=t,this.prediction=new ot,this.prediction.value=e}};var ks=class{value=!1;playerId=null};var st=class{matchId=null;market=null;matchType="FOOTBALL";prediction=null;constructor(t,e,i,a){this.matchId=t,this.market=e,this.prediction=new ks,this.prediction.value=i,this.prediction.playerId=a}};var Gs=class{matchId=null;market="RED_CARD_MATCH";matchType="FOOTBALL";prediction=null;constructor(t,e){this.matchId=t,this.prediction=new ot,this.prediction.value=e}};var xc=class{home=null;draw=null;away=null};var Lc=class{score=null;percentage=null};var ti=class{homeGoals=null;awayGoals=null};var Us=class{playerId=null;playerModel=null};var Vs=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 Us;PLAYER_SCORE=[];PLAYER_SCORE_TWICE=[];PLAYER_SCORE_HATTRICK=[];CORRECT_SCORE=new ti;CORRECT_SCORE_ADVANCED=new ti;CORRECT_SCORE_HT=new ti;OVER_GOALS_0_5=null;OVER_GOALS_1_5=null;OVER_GOALS_2_5=null;OVER_GOALS_3_5=null;OVER_GOALS_4_5=null;OVER_GOALS_5_5=null;OVER_GOALS_6_5=null;OVER_CORNERS_6_5=null;OVER_CORNERS_7_5=null;OVER_CORNERS_8_5=null;OVER_CORNERS_9_5=null;OVER_CORNERS_10_5=null;OVER_CORNERS_11_5=null;OVER_CORNERS_12_5=null;OVER_CORNERS_13_5=null};var L=class{no=0;yes=0};var ei=class{gameInstanceId=null;fixtures=null};var bt=class{goldenGoal=null};var Fi=class{id=null;gameInstanceId=null;gameType=null;wager=null;totalFixtures=null;settledFixtures=null;userId=null;fixtures=[];status=null;tiebreaker=new bt;points=null;templateId=null;groupId=null;profileLastUpdatedAt=null;createdAt=null;updatedAt=null};var rl=(r=>(r.ACTIVE="ACTIVE",r.WON="WON",r.LOST="LOST",r.PARTIALLY_WON="PARTIALLY_WON",r.CANCELED="CANCELED",r))(rl||{}),ou=["WON","LOST","PARTIALLY_WON","CANCELED"];var V=class{limit=null;startAfter=null;status=null;type=null;matchIds=null;gameIds=null;constructor(t){this.limit=t?.limit||null,this.startAfter=t?.startAfter||null,this.status=t?.status||null,this.type=t?.type||null,this.matchIds=t?.matchIds||null,this.gameIds=t?.gameIds||null}constructFiltersUrl=()=>{let t="",e=!1;return this.status&&(e=Object.values(rl).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 Hs=class{fullTimeOneXTwo={};halfTimeOneXTwo={};bothTeamsScore=new L;doubleChance={};halfTimeFullTime={};playerScore={};playerYellowCard={};playerRedCard={};redCardMatch=new L;penaltyMatch=new L;playerScoreFirstGoal={};cornersMatch={};correctScore={};correctScoreHalfTime={};correctScoreAdvanced={};playerScoreHattrick={};playerScoreTwice={};overZeroPointFiveGoals=new L;overOnePointFiveGoals=new L;overTwoPointFiveGoals=new L;overThreePointFiveGoals=new L;overFourPointFiveGoals=new L;overFivePointFiveGoals=new L;overSixPointFiveGoals=new L;overSixPointFiveCorners=new L;overSevenPointFiveCorners=new L;overEightPointFiveCorners=new L;overNinePointFiveCorners=new L;overTenPointFiveCorners=new L;overElevenPointFiveCorners=new L;overTwelvePointFiveCorners=new L;overThirteenPointFiveCorners=new L};var $s=class{matchId=null;matchType=null;predictions=null};var zs=class{profileId="";profileModel=null;leagueId="";leagueModel=null;message=""};var Dc=class{id=null;name=null;model=new Bt};var ii=class{id="";name="";description="";type="";banned=[];invites=[];administrators=[];membersCount=0;invitationCode="";templateId="";templateModel=null;pastTemplates=[];usersCanInviteUsers=!1;scoringStartsAt="";pinnedPosts=[]};var qs=class extends ii{members=[]};var Bc=class{name="";description="";invitationCode="";templateId="";usersCanInviteUsers=!1;administrators=[];scoringStartsAt=""};var Nc=class{name="";description="";invitationCode="";templateId="";usersCanInviteUsers=!1;administrators=[];pinnedPosts=[];scoringStartsAt=""};var Qs=class{predictionId=null;predictionModel=null;profileId=null;profileModel=null};var kc=class{meta=new k;data=[]};var Gc=class{meta=new b;data=[]};var ai=class extends w{type=null;constructor(t){super(t),this.type=t&&t.type?t.type:null}constructMainFiltersUrl=()=>{let t=super.constructMainFiltersUrl();return this.type&&(t+=`&type=${this.type}`),t}};var Ws=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 Ks=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 ri=class extends w{reportsCount=null;constructor(t){super(t),this.reportsCount=t.reportsCount?t.reportsCount:null}constructMainFiltersUrl=()=>{let t=super.constructMainFiltersUrl();return this.reportsCount&&(t+=`&reports_count=${this.reportsCount}`),t}};var oi=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 js=class{templateId="";templateModel=null;privateLeagueId="";privateLeagueModel=null;position="";points=0;type="private_league"};var Ys=class extends De{type="PRIVATE"};var Xs=class extends Be{type="PRIVATE"};var Js=class{id="";source="";type="";favourite=!1};var Zs=class extends Js{model=null};var Uc=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 tn=class extends w{status=null;sortOrder=null;gameIds=null;constructor(t){super(t),this.status=t?.status||null,this.sortOrder=t?.sortOrder||null,this.gameIds=t?.gameIds||null}constructMainFiltersUrl(){let t=super.constructMainFiltersUrl();return this.status&&Object.values(ft).includes(this.status)?(t+="&",t+=`status=${this.status}`):this.status!==null&&console.warn(`The filter 'status' has the following INVALID value: ${this.status}. It will be not passed as a query param in the URL. For more information visit our documentation.`),this.sortOrder&&(this.sortOrder==="asc"||this.sortOrder==="desc"||this.sortOrder==="ASC"||this.sortOrder==="DESC")?(t+="&",t+=`sort_order=${this.sortOrder}`):this.sortOrder!==null&&console.warn(`The filter 'sortOrder' has the following INVALID value: ${this.sortOrder}. It will be not passed as a query param in the URL. For more information visit our documentation.`),this.gameIds&&Array.isArray(this.gameIds)&&this.gameIds.length>0?(t+="&",t+=`game_ids=${this.gameIds.join(",")}`):this.gameIds!==null&&console.warn(`The filter 'gameIds' has the following INVALID value: ${this.gameIds}. It will be not passed as a query param in the URL. For more information visit our documentation.`),t}};var en=class extends w{};var an=class{matchId=null;matchType=null;market=null;matchModel=null;matchStatus=new X};var rn=class{value=null;result=null};var on=class{matchId=null;matchType=null;market=null;matchModel=null;matchStatus=new X;prediction=new rn};var Tt=class{id=null;title=null;description=null;type=null;status=null;authRequirement=null;scheduleOpenAt=null;predictionsCutoff=null;fixtures=[];tiebreaker=new yt;participantsCount=0;related=[];excludedProfileIds=null;rules=null;labels=null;customFields=null;branding=null;flags=null;images=new W;createdAt=null;updatedAt=null};var si=class extends Tt{adContent=null};var Xt=class{userId=null;points=null;results=[];tiebreaker=null};var sn=class{matchId=null;matchModel=null;outcome=null};var nt=class extends w{status=null;type=null;gameIds=null;sortOrder=null;constructor(t){super(t),this.status=t?.status||null,this.type=t?.type||null,this.gameIds=t?.gameIds||null,this.sortOrder=t?.sortOrder||null}constructFiltersUrl=()=>{let t=super.constructMainFiltersUrl();return this.status&&Object.values(ft).includes(this.status)&&(t+="&",t+=`status=${this.status}`),this.type&&(t+="&",t+=`type=${this.type}`),this.gameIds&&this.gameIds.length>0&&(t+="&",t+=`game_ids=${this.gameIds.join(",")}`),this.sortOrder&&(t+="&",t+=`sort_order=${this.sortOrder}`),t}};var Vt=class{id=null;title=null;description=null;type=null;status=null;authRequirement=null;outcome=null;predictionsCutoff=null;fixtures=[];tiebreaker=new yt;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 bt;branding=null};var nn=class{contestId="";contestType="GAME";contestModel=null;description="";userList=[]};var ln=class{position="";profileId="";profileModel=null;note="";tags=[]};var ni=class{gameInstanceId=null;fixtures=[];tiebreaker=null;constructor(t){this.gameInstanceId=t.gameInstanceId,t.fixtures.forEach(e=>this.fixtures.push(new Ut(e.matchId,e.market,e.prediction.value))),this.tiebreaker=t.tiebreaker?t.tiebreaker:null}};var li=class extends w{flags=null;status=null;entityIds=null;entityType=null;pollIds=null;sortOrder=null;minVotes=null;language=null;constructor(t){super(t),this.flags=t?.flags||null,this.status=t?.status||null,this.entityIds=t?.entityIds||null,this.entityType=t?.entityType||null,this.pollIds=t?.pollIds||null,this.sortOrder=t?.sortOrder||null,this.minVotes=t&&t.minVotes!==void 0?t.minVotes:null,this.language=t?.language||null}constructMainFiltersUrl(){let t=super.constructMainFiltersUrl();return this.flags&&this.flags.length>0&&(t+=`&flags=${this.flags.join(",")}`),this.status&&(t+=`&status=${this.status}`),this.entityIds&&this.entityIds.length>0&&(t+=`&entity_ids=${this.entityIds.join(",")}`),this.pollIds&&this.pollIds.length>0&&(t+=`&poll_ids=${this.pollIds.join(",")}`),this.sortOrder&&(t+=`&sort_order=${this.sortOrder}`),this.minVotes&&(t+=`&min_votes=${this.minVotes}`),this.language&&(t+=`&language=${this.language}`),t}};var pi=class{id=null;title=null;alternativeTitle=null;description=null;type=null;images=new W;status=null;language=null;authRequirement=null;totalVotes=null;flags=[];customFields=null;branding=null;embedCode=null;labels=null;adContent=null;context=null;options=[];related=[];preferencesEnabled=!1;multipleChoice=!1;maxMultipleChoiceOptions=null;participationCount=0;maxAttempts=0;externalActivity=null;createdAt=null;updatedAt=null};var pn=class extends pi{rules=null};var cn=class{id=null;title=null;description=null;images=new W;votes=null;embedCode=null;preferencesMapping=[]};var ci=class{preferenceId=""};var Ht=class{id=null;pollId=null;optionId=null;optionIds=[];userId=null;createdAt=null};var un=class extends Ht{pollModel=null;optionModel=null;optionsModels=[];previousVotes=[];attempts=null};var dn=class extends Ht{previousVotes=[];attempts=null};var mn=class{meta=new b;data=[]};var hn=class{meta=new b;data=[]};var fn=class extends w{matchIds=null;constructor(t){super(t),this.matchIds=t&&t.matchIds?t.matchIds:null}constructFiltersUrl(){let t=super.constructMainFiltersUrl();return this.matchIds&&this.matchIds.length>0&&(t+="&",t+=`match_ids=${this.matchIds.join(",")}`),t}};var gn=class{meta=new b;data=[]};var yn=class{matchId=null;matchModel=null;playerId=null;playerModel=null;createdAt=null};var bn=class{total};var Mn=class{meta=new bn;data=[]};var In=class{teamId=null;teamModel=null;playerId=null;playerModel=null;votes=null;winner=null};var wn=class{meta=new k;data=[]};var ol=class{remapListContent=t=>{let e=new wn;return e.meta=this.remapMeta(t.meta),e.data=t.data.map(i=>{let a=new cr;return a.entityId=i.entity_id,a.entityType=i.entity_type,a}),e};remapMeta=t=>{let e=new k;return e.pagination.currentPage=t.pagination.current_page,e.pagination.itemsPerPage=t.pagination.items_per_page,e.pagination.totalItems=t.pagination.total_items,e.pagination.numberOfPages=t.pagination.number_of_pages,e}};var q=class extends v{featureConfigRemapper=null;listContentRemapper=null;localStorage=null;clientId=null;constructor(t){super(t,O(t.environment,"client")),this.clientId=t.clientId,this.localStorage=new ct().createLocalCacheInstance(t.idSchema),this.featureConfigRemapper=new al,this.listContentRemapper=new ol}getConfig=async t=>{let e=await this.getCachedFeatures();if(!e){let i=`/clients/${this.clientId}/features`,a=this.apiSignInUrl.split("&")[0],r=i+a,o="There was a problem fetching client features from Client API";e=(await this.fetchWithoutAuth(r,o)).data,await this.localStorage.setClientFeatures(e)}switch(t){case"predictor":return this.featureConfigRemapper.remapPredictorConfig(e.predictor);case"topX":return this.featureConfigRemapper.remapTopXConfig(e.top_x);case"matchQuiz":return this.featureConfigRemapper.remapMatchQuizConfig(e.match_quiz);case"loyalty":return this.featureConfigRemapper.remapLoyaltyConfig(e.loyalty);case"discussions":return this.featureConfigRemapper.remapDiscussionsConfig(e.discussions);case"fantasy":return this.featureConfigRemapper.remapFantasyConfig(e.football_fantasy)}};getNewLoyaltyConfig=async t=>{let e=`/clients/${this.clientId}/features`,i=this.apiSignInUrl.split("&")[0],a="There was a problem fetching client features from Client API";if(t){let o=e+i+m(),n=await this.fetchWithoutAuthAdditionalHeaders(o,a,{"x-api-version":"2"});await this.localStorage.setClientFeatures(n.data)}let r=await this.getCachedFeatures();if(!r){let o=e+i;r=(await this.fetchWithoutAuthAdditionalHeaders(o,a,{"x-api-version":"2"})).data,await this.localStorage.setClientFeatures(r)}return this.featureConfigRemapper.remapLoyaltyNewConfig(r.loyalty)};getListContent=async(t,e,i)=>{let a=`/clients/${this.clientId}/lists/${t}/content${this.apiSignInUrl}`;e&&(a+=e.constructFiltersUrl()),f(i)&&(a+=m());let r="There was a problem fetching client list content",o=await this.fetchWithoutAuth(a,r);return this.listContentRemapper.remapListContent(o)};getCachedFeatures=async()=>{let t=await this.getLocalStorageData();if(!(!t||!Object.keys(t).length))return t.predictor.client_id&&t.predictor.client_id!==this.clientId?(await this.localStorage.deleteClientFeatures(),null):t};getLocalStorageData=async()=>{let t=Math.floor(Date.now()/1e3);return await this.localStorage.getExpiration("client","features")>t?await this.localStorage.getClientFeatures():null}};var Et=class{clientHttps=null;errorHandlingMode=null;constructor(t){this.clientHttps=new q(t),this.errorHandlingMode=t.errorHandlingMode}setAvailableMarketsForMatch=async t=>{let{fullCoverageCompetitions:e,markets:i}=await this.clientHttps.getConfig("predictor");if(Array.isArray(t))return t.map(a=>this.setAvailableMarkets(a,e,i));if(typeof t=="object"&&Object.keys(t).length)return this.setAvailableMarkets(t,e,i)};setAvailableMarkets=(t,e,i)=>{let a=t.context.competition?.id;return a&&this.isMatchInCoverageCompetition(a,e)?(t.availableMarkets=i.all,t):(t.availableMarkets=i.main,t)};setMetaDataBatchRequest=(t,e,i)=>{let a=new k;if(a.pagination.totalItems=t,a.pagination.itemsPerPage=e,a.pagination.numberOfPages=t?Math.ceil(t/e):0,a.pagination.currentPage=i,a.pagination.numberOfPages>0&&i>a.pagination.numberOfPages)throw this.errorHandlingMode==="standard"?new h(400,"invalid_page_number","Invalid page number provided. Use number between 1 and max number of pages."):new y(400,"invalid_page_number","Invalid page number provided. Use number between 1 and max number of pages.");return a};finalizeMatchesDataBatchRequest=(t,e)=>{t=t.sort((a,r)=>new Date(a.kickoffAt).getTime()-new Date(r.kickoffAt).getTime());let i=e.limit||20;if(e.page){let a=e.page>1?i*(e.page-1):0;t=t.slice(a,a+i)}return!e.page&&t.length>i&&(t=t.slice(0,i)),t};isMatchInCoverageCompetition=(t,e)=>{let i=!1;return e.includes(t)&&(i=!0),i}};var sl=class{footballService=null;https=null;idMapping=null;constructor(t,e,i){this.idMapping=i,this.https=e,this.footballService=new Et(t)}getTeamsIdMapping=async(t,e)=>{try{let i=!1;if(t){if(t=new Pi(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 Pi({teamIds:t,limit:i}),{data:r}=await this.getTeams(a);r.sort((l,p)=>l.id.localeCompare(p.id));let o=$p(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 Jt=class{https=null;footballService=null;idMapping=null;constructor(t,e,i){this.idMapping=i,this.https=e,this.footballService=new Et(t)}getPlayersIdMapping=async(t,e)=>{try{let i=!1;if(t){if(t=new Ti(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 Ti({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=pe(t);i.sort((r,o)=>r.localeCompare(o));let a=await this.getPlayersWithNativeIds(Array.from(i));return i.forEach((r,o)=>e[r]=a[o]),e};getPlayers=async(t,e)=>{try{return e=e||!1,await this.https.getPlayers(t,e)}catch(i){throw console.warn("There was a problem retrieving the players",i),i}};getPlayerIdMapping=async(t,e)=>{try{let i=await this.idMapping.getEntityIdsBySchemaId([t],"player","native"),a=await this.getPlayerById(i.player[0],e);return await this.idMapping.remapEntities(a,"player")}catch(i){throw console.warn(`There was a problem browsing the following player:${t}`,i),i}};getPlayerById=async(t,e)=>{try{return e=e||!1,await this.https.getPlayerById(t,e)}catch(i){throw console.warn(`There was a problem retrieving the following player: ${t}`,i),i}};getTopPlayersIdMapping=async t=>{try{let e=await this.getTopPlayers(t);return await this.idMapping.remapEntities(e,"player")}catch(e){throw console.warn("There was a problem browsing the top players",e),e}};getTopPlayers=async t=>{try{return t=t||!1,await this.https.getTopPlayers(t)}catch(e){throw console.warn("There was a problem retrieving the top players",e),e}};getNextMatchForPlayerIdMapping=async(t,e)=>{try{t=(await this.idMapping.getEntityIdsBySchemaId([t],"player","native")).player[0];let a=await this.getNextMatchForPlayer(t,e);return await this.idMapping.remapEntities(a,"match")}catch(i){throw console.warn(`There was a problem browsing the next match for player:${t}`,i),i}};getNextMatchForPlayer=async(t,e)=>{try{e=e||!1;let i=await this.https.getNextMatchForPlayer(t,e);return await this.footballService.setAvailableMarketsForMatch(i)}catch(i){throw console.warn(`There was a problem retrieving the next match for player: ${t}`,i),i}};getPrevMatchForPlayerIdMapping=async(t,e)=>{try{t=(await this.idMapping.getEntityIdsBySchemaId([t],"player","native")).player[0];let a=await this.getPrevMatchForPlayer(t,e);return await this.idMapping.remapEntities(a,"match")}catch(i){throw console.warn(`There was a problem browsing the previous match for player:${t}`,i),i}};getPrevMatchForPlayer=async(t,e)=>{try{e=e||!1;let i=await this.https.getPrevMatchForPlayer(t,e);return await this.footballService.setAvailableMarketsForMatch(i)}catch(i){throw console.warn(`There was a problem retrieving the previous match for player: ${t}`,i),i}}};var Zt=class{https=null;idMapping=null;footballService=null;constructor(t,e,i){this.https=e,this.idMapping=i,this.footballService=new Et(t)}getMatchesIdMapping=async(t,e)=>{try{if(t){if(t=new gt(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 gt({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=pe(t);i.sort((r,o)=>r.localeCompare(o));let a=await this.getMatchesWithNativeIds(Array.from(i));if(i.length!==a.length){let r=new gt({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 nl=class{https=null;idMapping=null;constructor(t,e){this.https=t,this.idMapping=e}searchIdMapping=async(t,e)=>{try{if(t=new po(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 K=class{errorHandlingModel=null;constructor(t){this.errorHandlingModel=t}throwException=(t,e,i)=>{throw this.errorHandlingModel==="standard"?new h(t,e,i):new y(t,e,i)}};var ll=class extends K{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 Si=class{countriesFacade=null;competitionsFacade=null;teamsFacade=null;playerFacade=null;matchFacade=null;searchFacade=null;validator=null;constructor(t,e,i,a){this.countriesFacade=new el(e,i,a),this.competitionsFacade=new il(e,i,a),this.teamsFacade=new sl(t,i,a),this.playerFacade=new Jt(t,i,a),this.matchFacade=new Zt(t,i,a),this.searchFacade=new nl(i,a),this.validator=new ll(t)}getCountries=async t=>this.countriesFacade.getCountriesWithIdMapping(t);getCompetitions=async(t,e)=>this.competitionsFacade.getCompetitionsIdMapping(t,e);getCompetitionById=async(t,e)=>this.competitionsFacade.getCompetitionByIdIdMapping(t,e);getTopCompetitions=async t=>this.competitionsFacade.getTopCompetitionsIdMapping(t);getCompetitionsMapWithNativeIds=async t=>await this.competitionsFacade.getCompetitionsMapWithNativeIds(t);getTeams=async(t,e)=>this.teamsFacade.getTeamsIdMapping(t,e);getTeamById=async(t,e)=>this.teamsFacade.getTeamByIdIdMapping(t,e);getTopTeams=async t=>this.teamsFacade.getTopTeamsIdMapping(t);getNextMatchForTeam=async(t,e)=>this.teamsFacade.getNextMatchForTeamIdMapping(t,e);getPrevMatchForTeam=async(t,e)=>this.teamsFacade.getPrevMatchForTeamIdMapping(t,e);getTeamsMapWithNativeIds=async t=>await this.teamsFacade.getTeamsMapWithNativeIds(t);getPlayers=async(t,e)=>this.playerFacade.getPlayersIdMapping(t,e);getPlayerById=async(t,e)=>this.playerFacade.getPlayerIdMapping(t,e);getTopPlayers=async t=>this.playerFacade.getTopPlayersIdMapping(t);getNextMatchForPlayer=async(t,e)=>this.playerFacade.getNextMatchForPlayerIdMapping(t,e);getPrevMatchForPlayer=async(t,e)=>this.playerFacade.getPrevMatchForPlayerIdMapping(t,e);getPlayersMapWithNativeIds=async t=>this.playerFacade.getPlayersMapWithNativeIds(t);getMatches=async(t,e)=>this.matchFacade.getMatchesIdMapping(t,e);getMatchesMapWithNativeIds=async t=>this.matchFacade.getMatchesMapWithNativeIds(t);getMatchById=async(t,e)=>this.matchFacade.getMatchIdMapping(t,e);search=async(t,e)=>this.searchFacade.searchIdMapping(t,e);getTeamForm=async(t,e,i)=>{this.validator.validateTeamFormArguments(t,e);let a=e?.direction||"ltr",r={teamIds:[t],competitionIds:e&&e.competitionId?[e.competitionId]:null,status:"finished",limit:e?.limit||5,sortField:"date",sortOrder:"desc"},o=await this.matchFacade.getMatchesIdMapping(r,i),n={teamId:t,matches:[]};if(n.matches=o.data.map(l=>{let p=l.homeTeam.id===t,c=l.scores.ftScore.homeGoals??0,u=l.scores.ftScore.awayGoals??0,d;return p?d=c>u?"W":c<u?"L":"D":d=u>c?"W":u<c?"L":"D",{matchModel:l,isHomeGame:p,result:d}}),a==="ltr"){let l=Array.from(n.matches);n.matches=l.reverse()}return n}};var $=class{countriesFromResponse=t=>{if(t)return t.map(e=>this.countryFromResponse(e))};countryFromResponse=t=>{try{if(t){let e=new Wr;return e.id=t.id,e.alias=t.alias,e.assets=t.assets,e.countryCode=t.country_code,e.name=t.name,e}}catch(e){throw e}return null}};var Z=class{countryRemapper=null;constructor(){this.countryRemapper=new $}fromResponse(t){try{let e=new qr;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 j=class{countryRemapper=null;constructor(){this.countryRemapper=new $}fromResponse(t){try{let e=new oo;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 pl=class{countryRemapper=null;teamBasicRemapper=null;constructor(){this.countryRemapper=new $,this.teamBasicRemapper=new j}fromResponse(t){try{let e=new Qr;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 cl=class{countryRemapper=null;constructor(){this.countryRemapper=new $}fromResponse(t){try{let e=new io;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 ul=class{countryRemapper=null;competitionRemapper=null;playerRemapper=null;constructor(){this.countryRemapper=new $,this.competitionRemapper=new Z,this.playerRemapper=new cl}fromResponse(t){try{let e=new no;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 vi=class{fromResponse(t){try{let e=new Xr;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 dl=class{teamRemapper=null;competitionRemapper=null;scoresRemapper=null;constructor(){this.teamRemapper=new j,this.competitionRemapper=new Z,this.scoresRemapper=new vi}fromResponse(t){try{let e=new Kr;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 ml=class{fromResponse(t){try{let e=new Yr;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 Ci=class{fromResponse(t){try{let e=new ro;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 hl=class{playerRemapper=null;constructor(){this.playerRemapper=new Ci}fromResponse(t){try{let e=new Ve;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 fl=class{playerRemapper=null;constructor(){this.playerRemapper=new Ci}fromResponse(t){try{let e=new Jr;return e.minute=t.minute,e.type=t.type,e.teamId=t.team_id,e.player=this.playerRemapper.fromResponse(t.player),e.relatedPlayer=t.related_player?this.playerRemapper.fromResponse(t.related_player):null,e.updatedAt=t.updated_at,e}catch(e){throw console.warn("There was a problem remapping timeline",e),e}}};var gl=class{fromResponse(t){try{let e=new Zr;return e.playerId=t.player_id,e.position=t.position,e.minutesPlayed=t.minutes_played,e.yellowCards=t.yellow_cards,e.redCards=t.red_cards,e.goals=t.goals,e.penaltyGoals=t.penalty_goals,e.penaltyCommitted=t.penalty_committed,e.penaltyWon=t.penalty_won,e.penaltyMissed=t.penalty_missed,e.penaltySaved=t.penalty_saved,e.penaltyReceived=t.penalty_received,e.ownGoals=t.own_goals,e.assists=t.assists,e.cleanSheets=t.clean_sheets,e.shots=t.shots,e.shotsOn=t.shots_on,e.shotsBlocked=t.shots_blocked,e.offsides=t.offsides,e.foulsCommitted=t.fouls_committed,e.foulsWon=t.fouls_won,e.tackles=t.tackles,e.tacklesBlocks=t.tackles_blocks,e.tacklesInterceptions=t.tackles_interceptions,e.concededGoals=t.conceded_goals,e.caughtBall=t.caught_ball,e.saves=t.saves,e.passes=t.passes,e.crosses=t.crosses,e.interceptions=t.interceptions,e.keyPasses=t.key_passes,e.passesAccuracy=t.passes_accuracy,e.duels=t.duels,e.duelsWon=t.duels_won,e.dribblesAttempts=t.dribbles_attempts,e.dribblesSuccess=t.dribbles_success,e.dribblesPast=t.dribbles_past,e.updatedAt=t.updated_at,e}catch(e){throw console.warn("There was a problem remapping the player stats",e),e}}};var yl=class{teamMapper=null;competitionsMapper=null;lineupsMapper=null;scoresMapper=null;statsMapper=null;timelineMapper=null;playerStatsMapper=null;constructor(){this.teamMapper=new j,this.competitionsMapper=new Z,this.lineupsMapper=new hl,this.scoresMapper=new vi,this.statsMapper=new ml,this.timelineMapper=new fl,this.playerStatsMapper=new gl}fromResponse(t){try{let e=new jr;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 Ve,e}catch(e){throw console.warn("There was a problem remapping the match response",e),e}}};var bl=class{countryRemapper=null;constructor(){this.countryRemapper=new $}fromResponse(t){try{let e=new ao;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 Ai=class{countryRemapper=null;teamRemapper=null;constructor(){this.countryRemapper=new $,this.teamRemapper=new j}fromResponse(t){try{let e=new to;return e.id=t.id,e.firstName=t.first_name?t.first_name:null,e.lastName=t.last_name?t.last_name:null,e.name=t.name?t.name:null,e.birthDate=t.birth_date,e.country=this.countryRemapper.countryFromResponse(t.country),e.assets=t.assets,e.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 Ml=class{countryRemapper=null;teamRemapper=null;competitionRemapper=null;constructor(){this.countryRemapper=new $,this.teamRemapper=new j,this.competitionRemapper=new Z}fromResponse(t){try{let e=new eo;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 Il=class{teamRemapper=null;playerRemapper=null;competitionremapper=null;constructor(){this.teamRemapper=new j,this.playerRemapper=new Ai,this.competitionremapper=new Z}fromResponse(t){try{let e=new lo;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 wl=class{remapMetaProp=t=>{let e=new k;return e.pagination.currentPage=t.pagination.current_page,e.pagination.itemsPerPage=t.pagination.items_per_page,e.pagination.totalItems=t.pagination.total_items,e.pagination.numberOfPages=t.pagination.number_of_pages,e}};var _l=class{remapPlayersPoints=t=>{let e=new Hr;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 zr;return e.playerId=t.player_id,e.points=t.points,e.rank=t.rank,e};remapPlayerDetailedStats=t=>{let e=new kr;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 Ge;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 Ue;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 dt=class extends v{limitIds=200;countryRemapper=null;competitionBasicRemapper=null;competitionFullRemapper=null;teamBasicRemapper=null;teamFullRemapper=null;matchBasicRemapper=null;matchFullRemapper=null;playerBasicRemapper=null;playerFullRemapper=null;topPlayerRemapper=null;searchRemapper=null;footballMetaRemapper=null;fantasyRemapper=null;footballService=null;constructor(t){super(t,O(t.environment,"football")),this.apiSignInUrl=t.lang!=="en"?this.apiSignInUrl+`&lang=${t.lang}`:this.apiSignInUrl,this.countryRemapper=new $,this.competitionBasicRemapper=new Z,this.competitionFullRemapper=new pl,this.teamBasicRemapper=new j,this.teamFullRemapper=new ul,this.matchBasicRemapper=new dl,this.matchFullRemapper=new yl,this.playerBasicRemapper=new Ai,this.playerFullRemapper=new Ml,this.topPlayerRemapper=new bl,this.searchRemapper=new Il,this.footballMetaRemapper=new wl,this.footballService=new Et(t),this.fantasyRemapper=new _l}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=qt(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=qt(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 Yt,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=qt(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 Yt;return l.data=n,l}else{let r=new Yt,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 Yt,a="There was a problem with football matches request";if(t&&t.matchIds&&t.matchIds.length>this.limitIds){let r=[],o=qt(t.matchIds,this.limitIds);for(let l of o){let p=new gt({...t,matchIds:l,limit:l.length}),c=!0,u=`/matches${this.apiSignInUrl}${p.constructFilterUrl(c)}&limit=${l.length}`;e&&(u+=m());let d=await this.fetchWithoutAuth(u,a);r.push(d.data.map(M=>this.matchBasicRemapper.fromResponse(M)))}let n=Array.prototype.concat.apply([],r);return i.meta=this.footballService.setMetaDataBatchRequest(n.length,t.limit||20,t.page||1),i.data=this.footballService.finalizeMatchesDataBatchRequest(n,t),i}else{let r=`/matches${this.apiSignInUrl}`;t&&(r+=`${t.constructFilterUrl()}`),e&&(r+=m());let o=await this.fetchWithoutAuth(r,a);return i.meta=this.footballMetaRemapper.remapMetaProp(o.meta),i.data=o.data.map(n=>this.matchBasicRemapper.fromResponse(n)),i}};search=async(t,e)=>{let i=`/search${this.apiSignInUrl}${t.constructFilterUrl()}`,a=Date.now(),r="There was a problem with football search request";e&&(i+=`&disable_cache=${a}`);let o=await this.fetchWithoutAuth(i,r);return this.searchRemapper.fromResponse(o.data)};getPlayersPoints=async(t,e,i)=>{let a=`/players/points/${t}${this.apiSignInUrl}`,r=Date.now(),o="There was a problem with players points request";e&&(a+=`&position=${e.toLocaleLowerCase()}`),i&&(a+=`&disable_cache=${r}`);let n=await this.fetchWithoutAuth(a,o);return this.fantasyRemapper.remapPlayersPoints(n)};getPlayerDetailedStatistics=async(t,e,i)=>{let a=`/players/${e}/points/${t}${this.apiSignInUrl}`,r=Date.now(),o="There was a problem with detailed player points request";i&&(a+=`&disable_cache=${r}`);let n=await this.fetchWithoutAuth(a,o);return this.fantasyRemapper.remapPlayerDetailedStats(n)}};var Pl=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 Zs;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 Tl=class{idMapping=null;profileOperations=null;constructor(t,e){this.idMapping=new R(t),this.profileOperations=new Pl(t,e,this.idMapping)}remapProfileStats=async t=>await this.profileOperations.remapProfileStats(t);remapInterestToNative=async t=>await this.profileOperations.remapInterestToNative(t);remapInterests=async t=>await this.profileOperations.remapInterests(t);showFullInterests=async t=>await this.profileOperations.showFullInterests(t)};var D=class{idsRemapper=null;profileHttps=null;activityHttps=null;footballHttps=null;footballFacade=null;idMapping=null;localCache=null;profileFacade=null;ownProfileBuilder=null;profileBuilder=null;constructor(t){this.profileHttps=new Mi(t),this.activityHttps=new hi(t),this.footballHttps=new dt(t),this.idMapping=new R(t),this.localCache=new ct().createLocalCacheInstance(t.idSchema),this.footballFacade=new Si(t,this.localCache,this.footballHttps,this.idMapping),this.profileFacade=new _t(this.localCache,this.profileHttps,this.activityHttps,t.errorHandlingMode),this.idsRemapper=new Tl(t,this.footballFacade),this.ownProfileBuilder=new tl(t,this.idsRemapper,this.localCache,this.profileHttps,this.activityHttps),this.profileBuilder=new wi(this.idsRemapper,this.localCache,this.profileHttps,this.activityHttps)}getOwn=()=>this.ownProfileBuilder;getById=t=>this.profileBuilder.getById(t);getCountries=async t=>await this.profileFacade.getCountries(t);getByIds=async(t,e,i)=>await this.profileFacade.getByIds(t,e,i);collectLead=async t=>await this.profileFacade.collectLead(t);checkFollowStatus=async t=>await this.profileFacade.checkFollowStatus(t);getOwnStats=async()=>await this.ownProfileBuilder.getStats();getStats=async(t,e)=>await this.profileBuilder.getById(t).getStats(e);getOwnBadges=async()=>await this.ownProfileBuilder.getBadges();getBadges=async t=>await this.profileBuilder.getById(t).getBadges()};var El=class extends w{};var $u=(r=>(r.LIKE="like",r.DISLIKE="dislike",r.SHARE="share",r.COMMENT="comment",r.PREDICTION_MADE="prediction_made",r))($u||{});var zu=(a=>(a.CORRECT="CORRECT",a.INCORRECT="INCORRECT",a.PARTIALLY_CORRECT="PARTIALLY_CORRECT",a.NOT_VERIFIED="NOT_VERIFIED",a))(zu||{});var Rl=(i=>(i.ONE="1",i.X="x",i.TWO="2",i))(Rl||{}),Fl=(i=>(i.ONE_X="1x",i.X_TWO="x2",i.ONE_TWO="12",i))(Fl||{}),Sl=(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))(Sl||{});var su=(F=>(F.NONE="none",F.FINISHED="finished",F.CANCELLED="cancelled",F.POSTPONED="postponed",F.NOT_STARTED="not_started",F.FIRST_HALF="1st_half",F.SECOND_HALF="2nd_half",F.FINISHED_AFTER_AWARDED_WIN="finished_after_awarded_win",F.TO_FINISH="to_finish",F.FINISHED_AET="finished_aet",F.HALFTIME="halftime",F.FINISHED_AP="finished_ap",F.INTERRUPTED="interrupted",F.KICK_OFF_DELAYED="kick_off_delayed",F.ABANDONED="abandoned",F.WAITING_FOR_PENALTY="waiting_for_penalty",F.PENALTY="penalty",F.PAUSE="pause",F.EXTRA_TIME_1ST_HALF="extra_time_1st_half",F.EXTRA_TIME_END_OF_1ST_HALF="extra_time_end_of_1st_half",F.EXTRA_TIME_2ND_HALF="extra_time_2nd_half",F.WAITING_FOR_EXTRA_TIME="waiting_for_extra_time",F.NO_INFO_YET="no_info_yet",F.AWAITING_INFO="awaiting_info",F.FINISHED_ASG="finished_asg",F))(su||{});var vl=class extends K{constructor(t){super(t)}validatePrediction=t=>{(!t.fixtures||!Array.isArray(t.fixtures)||t.fixtures.length===0)&&this.throwException(400,"invalid_method_call","Fixtures field is required and should contain at least one fixtures object. For more information please visit our documentation");let e=Object.keys(new mr);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 Cl=class{https=null;validator=null;profile=null;constructor(t){this.https=new Kt(t),this.profile=new D(t),this.validator=new vl(t.errorHandlingMode)}getGames=async(t,e)=>(t&&(t=new hr(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 dr(i));let r=await this.https.getBracketGamePredictionsForUser(t,e,i,a),o=null;try{o=await this.profile.getById(e).getInfo()}catch(n){console.error(n)}return r.data.forEach(n=>{n.profileModel=o}),r};getGamePredictionById=async(t,e,i)=>await this.https.getBracketGamePredictionById(t,e,i);getRankings=async(t,e,i)=>{e&&(e=new El(e));let a=await this.https.getBracketGameRankings(t,e,i),r=a.data.map(n=>n.profileId),o=[];return r.length>0&&(o=await this.profile.getByIds(r),a.data=a.data.map(n=>(n.profileModel=o.find(l=>l.id===n.profileId)||null,n))),a}};var Al=class{facade=null;constructor(t){this.facade=new Cl(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 Ol=class{remapResponse=t=>(t.meta=this.remapMeta(t.meta),t.data=this.remapData(t.data),t);remapLeagueLeaderboardResponse=t=>(t.meta=this.remapLeagueLeaderboardMeta(t.meta),t.data=this.remapData(t.data),t);remapTemplateBreakdown=t=>(t.meta=this.remapMeta(t.meta),t.data=t.data.map(e=>this.remapTemplatePoints(e)),t);remapMeta=t=>{let e=new Dt;return e.rankType=t.rank_type,e.fromDate=t.from_date,e.toDate=t.to_date,e.pagination.currentPage=t.pagination.current_page,e.pagination.itemsPerPage=t.pagination.items_per_page,e.pagination.totalItems=t.pagination.total_items,e.pagination.numberOfPages=t.pagination.number_of_pages,e};remapLeagueLeaderboardMeta=t=>{let e=new He;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 $e;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 vo;return e.groupId=t.group_id,e.averagePoints=t.average_points,e.highestPoints=t.highest_points,e}};var xl=class{remapRankings=t=>(t.meta=this.remapMeta(t.meta),t.data=this.remapData(t.data),t);remapRankingsPrivateLeague=t=>(t.meta=this.remapMeta(t.meta),t.data=this.remapDataUserRankingPrivateLeague(t.data),t);remapRankingsChallenge=t=>(t.meta=this.remapMeta(t.meta),t.data=this.remapDataUserRankingChallenge(t.data),t);remapMeta=t=>{let e=new k;return e.pagination.currentPage=t.pagination.current_page,e.pagination.itemsPerPage=t.pagination.items_per_page,e.pagination.numberOfPages=t.pagination.number_of_pages,e.pagination.totalItems=t.pagination.total_items,e};remapData(t){let e=[];return t.forEach(i=>{let a=new So;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 js;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 Ll=class{entityId=null;entityType=null};var tt=class{remapBranding=t=>{let e=new co;return t.colors&&(e.colors=new uo,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 mo,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 ho,e.images.mainLogo=t.images.main_logo,e.images.mobileLogo=t.images.mobile_logo,e.images.backgroundImage=t.images.background_image,e.images.mobileBackgroundImage=t.images.mobile_background_image,e.images.additionalImage=t.images.additional_image),e}};var Dl=class extends tt{remapResponse=t=>{let e=[];return t.forEach(i=>{let a=new Bt;a.id=i.id,a.name=i.name,a.description=i.description,a.type=i.type,a.fromDate=i.from_date,a.toDate=i.to_date,a.markets=i.markets?i.markets:null,a.teamIds=i.team_ids?i.team_ids:null,a.matchIds=i.match_ids?i.match_ids:null,a.groups=i.groups?this.remapGroups(i.groups):null,a.gameIds=i.game_ids?i.game_ids:null,a.gameTypes=i.game_types?i.game_types:null,a.competitionIds=i.competition_ids?i.competition_ids:null,a.excludedProfileIds=i.excluded_profile_ids?i.excluded_profile_ids:null,a.rules=i.rules?i.rules:null,a.labels=i.labels?i.labels:null,a.customFields=i.custom_fields?i.custom_fields:null,a.branding=i.branding?this.remapBranding(i.branding):null,a.flags=i.flags?i.flags:null,a.images=i.images?i.images:null,a.status=i.status?i.status:null,a.automaticallyChangeStatus=i.automatically_change_status,a.createdAt=i.created_at,a.updatedAt=i.updated_at,a.related=i.related?this.remapRelated(i.related):null,e.push(a)}),e};remapResponseId=t=>{let e=new Co;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 Fo;return e.pagination.currentPage=t.pagination.current_page,e.pagination.itemsPerPage=t.pagination.items_per_page,e.pagination.totalItems=t.pagination.total_items,e.pagination.numberOfPages=t.pagination.number_of_pages,e.filters.flags=t.filters.flags,e.filters.status=t.filters.status,e.filters.type=t.filters.type,e.filters.activeFrom=t.filters.active_from,e.filters.activeTo=t.filters.active_to,e.filters.createdFrom=t.filters.created_from,e.filters.createdTo=t.filters.created_to,e.filters.updatedFrom=t.filters.updated_from,e.filters.updatedTo=t.filters.updated_to,e};remapRelated=t=>t.map(e=>{let i=new Ll;return i.entityId=e.entity_id,i.entityType=e.entity_type,i});remapGroups=t=>t.map(e=>{let i=new Ao;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 Bl=class{remapHighestSuccessRate=t=>t.map(e=>{let i=new Eo;return i.position=e.position,i.points=e.points,i.predictionsMade=e.predictions_made,i.profileId=e.profile_id,i.successRatePercent=e.success_rate_percent,i})};var Rt=class extends v{templateRemapper=null;leaderboardRemapper=null;rankingsRemapper=null;highestSuccessRateRemapper=null;constructor(t){super(t,O(t.environment,"loyalty")),this.templateRemapper=new Dl,this.leaderboardRemapper=new Ol,this.rankingsRemapper=new xl,this.highestSuccessRateRemapper=new Bl}getTemplates=async(t,e)=>{let i=t?`/leaderboard/templates/${this.apiSignInUrl}${t.constructFiltersUrl()}`:`/leaderboard/templates/${this.apiSignInUrl}`;i+=f(e)?m():"";let a="There was a problem fetching the list of templates",r=await this.fetchWithoutAuth(i,a),o=JSON.parse(JSON.stringify(r));return o.meta=this.templateRemapper.remapMeta(r.meta),o.data=this.templateRemapper.remapResponse(r.data),o};getTemplateById=async(t,e)=>{let i=f(e)?`/leaderboard/templates/${t}${this.apiSignInUrl}${m()}`:`/leaderboard/templates/${t}${this.apiSignInUrl}`,a=`There was a problem requesting the following template: ${t}`,r=await this.fetchWithoutAuth(i,a);return this.templateRemapper.remapResponseId(r.data)};getLeaderboard=async(t,e,i)=>{let a=f(e)?`/leaderboard/${t}${this.apiSignInUrl}${m()}`:`/leaderboard/${t}${this.apiSignInUrl}`,r=`There was a problem fetching the leaderboard for the following template: ${t}`;i&&(a+=`${i.constructFiltersUrl()}`);let o=await this.fetchWithoutAuth(a,r),n=JSON.parse(JSON.stringify(o));return this.leaderboardRemapper.remapResponse(n)};getLeaderboardForGame=async(t,e,i)=>{let a=f(e)?`/leaderboard/games/${t}${this.apiSignInUrl}${m()}`:`/leaderboard/games/${t}${this.apiSignInUrl}`,r=`There was a problem fetching the leaderboard for the following game: ${t}`;i&&(a+=`${i.constructFiltersUrl()}`);let o=await this.fetchWithoutAuth(a,r),n=JSON.parse(JSON.stringify(o));return this.leaderboardRemapper.remapResponse(n)};getLeaderboardForLeague=async(t,e)=>{let i=`/private-league/${t}${this.apiSignInUrl}`,a=`There was a problem fetching the leaderboard for the following league: ${t}`;e&&(i+=`${e.constructFiltersUrl()}`);let r=await this.fetchWithoutAuth(i,a);return this.leaderboardRemapper.remapLeagueLeaderboardResponse(r)};getUserRankings=async(t,e,i)=>{let a=`/leaderboard/users/${t}/rankings${this.apiSignInUrl}`,r=`There was a problem fetching the rankings for the following user: ${t}`;e&&(a+=`${e.constructFiltersUrl()}`),f(i)&&(a+=`${m()}`);let o=await this.fetchWithoutAuth(a,r);return this.rankingsRemapper.remapRankings(o)};getHighestSuccessRate=async(t,e)=>{let i=`/statistics/top${this.apiSignInUrl}`,a="There was a problem fetching highest success rate";t&&(i+=`${t.constructFiltersUrl()}`),f(e)&&(i+=`${m()}`);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}${m()}`:`/statistics/follows${this.apiSignInUrl}`,a="There was a problem fetching follows for entities";return t.footballCompetitions&&(i+=`&competitions=${t.footballCompetitions.join(",")}`),t.footballTeams&&(i+=`&teams=${t.footballTeams.join(",")}`),t.footballPlayers&&(i+=`&players=${t.footballPlayers.join(",")}`),(await this.fetchWithoutAuth(i,a)).data};getUserRankingsForPrivateLeagueAndChallenges=async(t,e,i)=>{let a=`/private-league/users/${t}/rankings${this.apiSignInUrl}&private_league_type=${e==="PRIVATE_LEAGUE"?"private":"one_vs_one"}`,r=`There was a problem fetching user rankings for ${e}`;i&&(a+=`${i.constructFiltersUrl()}`);let o=await this.fetchWithoutAuth(a,r);return e==="PRIVATE_LEAGUE"?this.rankingsRemapper.remapRankingsPrivateLeague(o):this.rankingsRemapper.remapRankingsChallenge(o)};getTemplateBreakdownPoints=async t=>{let e=`/leaderboard/${t}/breakdown${this.apiSignInUrl}`,i=`There was a problem fetching template breakdown points for: ${t}`,a=await this.fetchWithoutAuth(e,i);return this.leaderboardRemapper.remapTemplateBreakdown(a)}};var Nl=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 b;return e.pagination.itemsPerPage=t.items_per_page,e.pagination.nextPageStartsAfter=t.next_page_starts_after,e};remapToPrivateLeagueById=t=>{let e=new qs;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 ii;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 zs;return e.profileId=t.profile_id,e.leagueId=t.league_id,e.message=t.message,e};remapToAcceptChallenge=t=>{let e=new fr;return e.profileId=t.profile_id,e.challengeId=t.league_id,e.message=t.message,e};remapPredictions=t=>(t.meta=this.remapMeta(t.meta),t.data=this.remapPredictionsData(t.data),t);remapMeta=t=>{let e=new k;return e.pagination.currentPage=t.pagination.current_page,e.pagination.itemsPerPage=t.pagination.items_per_page,e.pagination.numberOfPages=t.pagination.number_of_pages,e.pagination.totalItems=t.pagination.total_items,e};remapPredictionsData=t=>t.map(e=>{let i=new Qs;return i.predictionId=e.prediction_id,i.profileId=e.profile_id,i})};var Oi=class{remapToDiscussions=t=>(t.meta=this.remapToMeta(t.meta),t.data=t.data.map(e=>this.remapToDiscussionById(e)),t);remapToDiscussionById=t=>{let e=new wr;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 Er,a=new Rr;return i.meta=this.remapToPostMeta(t.meta),i.data=t.data.map(r=>this.remapToPostByIdBasic(r)),a.meta=this.remapToPostMeta(t.meta),a.data=t.data.map(r=>this.remapToPostByIdFull(r)),e==="basic"?i:a};remapToPosts=t=>{let e=new Fr;return e.meta=this.remapToMeta(t.meta),e.data=t.data.map(i=>this.remapToPostByIdBasic(i)),e};remapToPostMeta=t=>{let e=new Lt;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 b;return e.pagination.itemsPerPage=t.pagination.items_per_page,e.pagination.nextPageStartsAfter=t.pagination.next_page_starts_after,e};remapToPostByIdBasic=t=>{let e=new Ne;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 _r;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 Tr;return i.id=e.id,i.postsCount=e.posts_count,i});remapReactionsPost=t=>{let e=new Sr;return e.type=t.type,e.userIds=t.user_ids,e.reactionCount=t.reaction_count,e};remapVersionsPost=t=>{let e=new Cr;return e.content=t.content,e.updatedAt=t.updated_at,e};remapReportPost=t=>{let e=new vr;return e.userId=t.user_id,e.reason=t.reason,e.reasonDetails=t.reason_details,e}};var xi=class extends v{remapper=null;discussionsRemapper=null;discussionsBaseURL=null;constructor(t){super(t,O(t.environment,"privateLeagues")),this.discussionsBaseURL=O(t.environment,"discussions"),this.remapper=new Nl,this.discussionsRemapper=new Oi}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+=m());let o=`There was a problem getting ${e==="PRIVATE_LEAGUE"?"private league":"challenge"}`,n=await this.fetchWithAuth(a,o);return this.remapper.remapToPrivateLeagueById(n.data)};getMyLeagues=async(t,e)=>{let i="/leagues"+this.apiSignInUrl+t.constructFiltersUrl(),r=`There was a problem getting user's ${e==="PRIVATE_LEAGUE"?"private leagues":"challenges"}`;return(await this.fetchWithAuth(i,r)).data.map(n=>this.remapper.remapToMyPrivateLeagues(n))};delete=async(t,e)=>{let i=`/leagues/${t}`+this.apiSignInUrl,r=`There was a problem deleting ${e==="PRIVATE_LEAGUE"?"private league":"challenge"}`,o="DELETE";return await this.fetchWithAuth(i,r,o),!0};invite=async(t,e)=>{let i=`/membership/invite/${t}`+this.apiSignInUrl,a=`There was a problem inviting the following users: ${e.join(",")}`,r="POST",o={profiles:e};return(await this.fetchWithAuth(i,a,r,o)).data};deleteInvitation=async(t,e)=>{let i=`/membership/invite/${t}`+this.apiSignInUrl,a=`There was a problem deleting invitation for the following users: ${e.join(",")}`,r="DELETE",o={profiles:e};return await this.fetchWithAuth(i,a,r,o),!0};accept=async(t,e,i)=>{let a=`/membership/accept/${t}`+this.apiSignInUrl+`&accept=${e?"ACCEPT":"REJECT"}`,o=`There was a problem ${e?"accepting":"rejecting"} invitation for ${i==="PRIVATE_LEAGUE"?"private league":"challenge"}: ${t}`,n="POST",l=await this.fetchWithAuth(a,o,n);return i==="PRIVATE_LEAGUE"?this.remapper.remapToAcceptPrivateLeague(l.data):this.remapper.remapToAcceptChallenge(l.data)};ban=async(t,e)=>{let i=`/membership/ban/${t}`+this.apiSignInUrl,a=`There was a problem banning the following users: ${e.join(",")}`,r="POST",o={profiles:e};return(await this.fetchWithAuth(i,a,r,o)).data};unban=async(t,e)=>{let i=`/membership/unban/${t}`+this.apiSignInUrl,a=`There was a problem unbanning the following users: ${e.join(",")}`,r="POST",o={profiles:e};return(await this.fetchWithAuth(i,a,r,o)).data};join=async t=>{let e="/membership/join"+this.apiSignInUrl+`&invitation_code=${t}`,i="There was a problem joining league",a="POST",r=await this.fetchWithAuth(e,i,a);return this.remapper.remapToAcceptPrivateLeague(r.data)};leave=async(t,e)=>{let i=`/membership/leave/${t}`+this.apiSignInUrl,r=`There was a problem leaving the following ${e==="PRIVATE_LEAGUE"?"league":"challenge"}: ${t}`,o="POST";return(await this.fetchWithAuth(i,r,o)).data};getInvitations=async(t,e)=>{let i="/membership/invitations"+this.apiSignInUrl+e.constructMainFiltersUrl(),r=`There was a problem getting invitations for ${t==="PRIVATE_LEAGUE"?"leagues":"challenges"}`,o=await this.fetchWithAuth(i,r);return this.remapper.remapToPrivateLeagues(o)};getReportedPosts=async(t,e)=>{let i=`/discussions/${t}/posts/reported${this.apiSignInUrl}`,a=`There was a problem fetching posts for the following: ${t}`;e&&(i+=e.constructMainFiltersUrl());let r=await this.fetchWithAuthNewBaseURL(this.discussionsBaseURL,i,a);return this.discussionsRemapper.remapToPostsForDiscussion(r,"full")};getPredictions=async(t,e)=>{let i=`/leagues/${t}/predictions`+this.apiSignInUrl,a=`There was a problem getting predictions for private league: ${t}`;e&&(i+=e.constructFiltersUrl());let r=await this.fetchWithAuth(i,a);return this.remapper.remapPredictions(r)};moderatePost=async(t,e)=>{let i=`/posts/${t}/admin/moderate${this.apiSignInUrl}`,a=`There was a problem moderating the following post: ${t}`,r="POST",o={moderation_reason:e},n=await this.fetchWithAuthNewBaseURL(this.discussionsBaseURL,i,a,r,o);return this.discussionsRemapper.remapToPostByIdBasic(n.data)}};var Li=class{createRequestBodyFromParam=(t,e)=>{let i=e==="PRIVATE"?new Ys:new gr;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 Xs:new yr;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 kl=class{ALL_FINISHED_STATUSES=["finished","cancelled","interrupted","abandoned","finished_after_awarded_win","finished_aet","finished_ap","finished_asg","to_finish"];ALL_UPCOMING_STATUSES=["not_started","kick_off_delayed"];ALL_LIVE_STATUSES=["1st_half","2nd_half","halftime","waiting_for_penalty","waiting_for_extra_time","penalty","pause","extra_time_1st_half","extra_time_2nd_half","extra_time_end_of_1st_half","awaiting_info"];getMatchEventStatus(t){if(!t||!t.type||!t.subType)return"no_info_yet";let e=t.type.toLowerCase(),i=t.subType.toLowerCase();return e==="finished"?i==="awarded_win"?"finished_after_awarded_win":i==="aet"?"finished_aet":i==="ap"?"finished_ap":i==="asg"?"finished_asg":"finished":e==="notstarted"?i==="postponed"?"postponed":i==="delayed"?"kick_off_delayed":"not_started":e==="inprogress"?i==="1st_half"?"1st_half":i==="2nd_half"?"2nd_half":i==="halftime"?"halftime":i==="penalty"?"penalty":i==="waiting_penalty"?"waiting_for_penalty":i==="pause"?"pause":i==="extra_time_1st_half"?"extra_time_1st_half":i==="extra_time_2nd_half"?"extra_time_2nd_half":i==="extra_time_halftime"?"extra_time_end_of_1st_half":i==="waiting_extra_time"?"waiting_for_extra_time":"awaiting_info":e==="interrupted"?i==="abandoned"?"abandoned":i==="to_finish"?"to_finish":"interrupted":e==="cancelled"?"cancelled":"no_info_yet"}isUpcoming(t){if(!t)return!1;let e=this.getMatchEventStatus(t);return this.ALL_UPCOMING_STATUSES.includes(e)}isLive(t){if(!t)return!1;let e=this.getMatchEventStatus(t);return this.ALL_LIVE_STATUSES.includes(e)}isFinished(t){if(!t)return!1;let e=this.getMatchEventStatus(t);return this.ALL_FINISHED_STATUSES.includes(e)}};var Gl=class{matchStatusHelper;constructor(){this.matchStatusHelper=new kl}getMatchStatusEnum(t){return this.matchStatusHelper.getMatchEventStatus(t)}isMatchUpcoming(t){return this.matchStatusHelper.isUpcoming(t)}isMatchLive(t){return this.matchStatusHelper.isLive(t)}isMatchFinished(t){return this.matchStatusHelper.isFinished(t)}};var et=class{https=null;idMapping=null;localCache=null;footballFacade=null;footballHelpers;constructor(t){this.https=new dt(t),this.idMapping=new R(t),this.localCache=new ct().createLocalCacheInstance(t.idSchema),this.footballFacade=new Si(t,this.localCache,this.https,this.idMapping),this.footballHelpers=new Gl}getCountries=async t=>await this.footballFacade.getCountries(t);getCompetitions=async(t,e)=>await this.footballFacade.getCompetitions(t,e);getCompetitionById=async(t,e)=>await this.footballFacade.getCompetitionById(t,e);getTopCompetitions=async t=>await this.footballFacade.getTopCompetitions(t);getTeams=async(t,e)=>await this.footballFacade.getTeams(t,e);getTeamById=async(t,e)=>await this.footballFacade.getTeamById(t,e);getTopTeams=async t=>await this.footballFacade.getTopTeams(t);getNextMatchForTeam=async(t,e)=>await this.footballFacade.getNextMatchForTeam(t,e);getPrevMatchForTeam=async(t,e)=>await this.footballFacade.getPrevMatchForTeam(t,e);getPlayers=async(t,e)=>await this.footballFacade.getPlayers(t,e);getPlayerById=async(t,e)=>await this.footballFacade.getPlayerById(t,e);getTopPlayers=async t=>await this.footballFacade.getTopPlayers(t);getNextMatchForPlayer=async(t,e)=>await this.footballFacade.getNextMatchForPlayer(t,e);getPrevMatchForPlayer=async(t,e)=>await this.footballFacade.getPrevMatchForPlayer(t,e);getMatches=async(t,e)=>await this.footballFacade.getMatches(t,e);getMatchById=async(t,e)=>await this.footballFacade.getMatchById(t,e);search=async(t,e)=>await this.footballFacade.search(t,e);getTeamForm=async(t,e,i)=>await this.footballFacade.getTeamForm(t,e,i);get helpers(){return this.footballHelpers}};var Ul=class{matchFacade=null;playerFacade=null;predictorService=null;constructor(t,e,i){this.matchFacade=t,this.playerFacade=e,this.predictorService=i}remapFixturesRequest=t=>{let e={};if(e.match_id=t.matchId,e.match_type="FOOTBALL",t instanceof st)e.market=t.market,e.prediction=t.prediction.value,e.player_id=t.prediction.playerId;else if(t instanceof Je||t instanceof Ze)e.market=t.market,e.prediction=t.prediction.value;else if(t instanceof Ut){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 Ye;l.target?p.market=this.predictorService.convertMarketForResponseModel(l.market,l.target):p.market=l.market,p.matchId=n[l.match_id].id,p.matchType=l.match_type,p.matchModel=n?n[l.match_id]:null,delete p.matchModel.availableMarkets,l.prediction!==void 0?p.prediction.value=l.prediction:l.goals_home!==void 0&&l.goals_away!==void 0&&(p.prediction.value=l.goals_home.toString()+":"+l.goals_away.toString()),p.prediction.playerId=l.player_id?l.player_id:null,l.market==="PLAYER_PERFORMANCE"&&(p.prediction.playerRole=l.role),p.prediction.playerId&&p.prediction.playerId!==e&&(p.prediction.playerModel=r[l.player_id],p.prediction.playerId=r[l.player_id].id),p.result=this.remapResult(l.result),o.push(p)}return o};remapResult=t=>{let e=new Xe;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 Vc=class{constructor(){}static createMatchMarketsResultsModel(t,e){return{FT_1X2:this.createOneXTwoResult(t.scores,"full_time"),HT_1X2:this.createOneXTwoResult(t.scores,"half_time"),BOTH_TEAMS_SCORE:t.scores.ftScore.homeGoals>0&&t.scores.ftScore.awayGoals>0,DOUBLE_CHANCE:this.createDoubleChanceResult(t.scores),HT_FT:this.createHalfTimeFullTimeResult(t.scores),RED_CARD_MATCH:this.createMarketResultByCriteria(t,"red_card"),PENALTY_MATCH:this.createMarketResultByCriteria(t,"penalty"),CORNERS_MATCH:isNaN(t.stats?.corners?.homeTeam+t.stats?.corners?.awayTeam)?null:t.stats.corners.homeTeam+t.stats.corners.awayTeam,PLAYER_YELLOW_CARD:this.createPlayersMarketsResults(t,e,"yellow_card"),PLAYER_RED_CARD:this.createPlayersMarketsResults(t,e,"red_card"),PLAYER_SCORE_FIRST_GOAL:this.createPlayersMarketsResults(t,e,"first_goal"),PLAYER_SCORE:this.createPlayersMarketsResults(t,e,"one_goal"),PLAYER_SCORE_TWICE:this.createPlayersMarketsResults(t,e,"two_goals"),PLAYER_SCORE_HATTRICK:this.createPlayersMarketsResults(t,e,"hattrick"),CORRECT_SCORE:{homeGoals:t.scores.ftScore.homeGoals,awayGoals:t.scores.ftScore.awayGoals},CORRECT_SCORE_ADVANCED:{homeGoals:t.scores.ftScore.homeGoals,awayGoals:t.scores.ftScore.awayGoals},CORRECT_SCORE_HT:{homeGoals:t.scores.htScore.homeGoals,awayGoals:t.scores.htScore.awayGoals},OVER_GOALS_0_5:t.scores.ftScore.homeGoals+t.scores.ftScore.awayGoals>0,OVER_GOALS_1_5:t.scores.ftScore.homeGoals+t.scores.ftScore.awayGoals>1,OVER_GOALS_2_5:t.scores.ftScore.homeGoals+t.scores.ftScore.awayGoals>2,OVER_GOALS_3_5:t.scores.ftScore.homeGoals+t.scores.ftScore.awayGoals>3,OVER_GOALS_4_5:t.scores.ftScore.homeGoals+t.scores.ftScore.awayGoals>4,OVER_GOALS_5_5:t.scores.ftScore.homeGoals+t.scores.ftScore.awayGoals>5,OVER_GOALS_6_5:t.scores.ftScore.homeGoals+t.scores.ftScore.awayGoals>6,OVER_CORNERS_6_5:isNaN(t.stats?.corners?.homeTeam+t.stats?.corners?.awayTeam)?null:t.stats.corners.homeTeam+t.stats.corners.awayTeam>6,OVER_CORNERS_7_5:isNaN(t.stats?.corners?.homeTeam+t.stats?.corners?.awayTeam)?null:t.stats.corners.homeTeam+t.stats.corners.awayTeam>7,OVER_CORNERS_8_5:isNaN(t.stats?.corners?.homeTeam+t.stats?.corners?.awayTeam)?null:t.stats.corners.homeTeam+t.stats.corners.awayTeam>8,OVER_CORNERS_9_5:isNaN(t.stats?.corners?.homeTeam+t.stats?.corners?.awayTeam)?null:t.stats.corners.homeTeam+t.stats.corners.awayTeam>9,OVER_CORNERS_10_5:isNaN(t.stats?.corners?.homeTeam+t.stats?.corners?.awayTeam)?null:t.stats.corners.homeTeam+t.stats.corners.awayTeam>10,OVER_CORNERS_11_5:isNaN(t.stats?.corners?.homeTeam+t.stats?.corners?.awayTeam)?null:t.stats.corners.homeTeam+t.stats.corners.awayTeam>11,OVER_CORNERS_12_5:isNaN(t.stats?.corners?.homeTeam+t.stats?.corners?.awayTeam)?null:t.stats.corners.homeTeam+t.stats.corners.awayTeam>12,OVER_CORNERS_13_5:isNaN(t.stats?.corners?.homeTeam+t.stats?.corners?.awayTeam)?null:t.stats.corners.homeTeam+t.stats.corners.awayTeam>13}}},Ft=Vc;it(Ft,"createOneXTwoResult",(t,e)=>e==="full_time"?t.ftScore.homeGoals>t.ftScore.awayGoals?"1":t.ftScore.homeGoals===t.ftScore.awayGoals?"x":"2":t?.htScore?.homeGoals>t?.htScore?.awayGoals?"1":t?.htScore?.homeGoals===t?.htScore?.awayGoals?"x":"2"),it(Ft,"createDoubleChanceResult",t=>t?.ftScore?.homeGoals>t?.ftScore?.awayGoals?["1x","12"]:t?.ftScore?.homeGoals===t?.ftScore?.awayGoals?["1x","x2"]:["x2","12"]),it(Ft,"createHalfTimeFullTimeResult",t=>{if(t?.htScore?.homeGoals>t?.htScore?.awayGoals){if(t?.ftScore?.homeGoals>t?.ftScore?.awayGoals)return"1/1";if(t?.ftScore?.homeGoals===t?.ftScore?.awayGoals)return"1/x";if(t?.ftScore?.homeGoals<t?.ftScore?.awayGoals)return"1/2"}if(t?.htScore?.homeGoals===t?.htScore?.awayGoals){if(t?.ftScore?.homeGoals>t?.ftScore?.awayGoals)return"x/1";if(t?.ftScore?.homeGoals===t?.ftScore?.awayGoals)return"x/x";if(t?.ftScore?.homeGoals<t?.ftScore?.awayGoals)return"x/2"}if(t?.htScore?.homeGoals<t?.htScore?.awayGoals){if(t?.ftScore?.homeGoals>t?.ftScore?.awayGoals)return"2/1";if(t?.ftScore?.homeGoals===t?.ftScore?.awayGoals)return"2/x";if(t?.ftScore?.homeGoals<t?.ftScore?.awayGoals)return"2/2"}}),it(Ft,"createMarketResultByCriteria",(t,e)=>!t.timeline||!t.timeline.length?null:e==="red_card"?t.timeline.filter(i=>Number(i.minute)<=90).some(i=>i.type==="red_card"):t.timeline.filter(i=>Number(i.minute)<=90).some(i=>i.type.startsWith(e))),it(Ft,"createPlayersMarketsResults",(t,e,i)=>{if(!t.timeline||!t.timeline.length)return i==="first_goal"?null:[];if(i==="first_goal"){let n=t.timeline.find(l=>l.type==="goal"||l.type==="penalty_goal"||l.type==="own_goal")||null;if(n){let l=e[n.player.id];return{playerId:n.type==="goal"||n.type==="penalty_goal"?n.player.id:"OWN_GOAL",playerModel:l}}return null}if(i==="yellow_card"||i==="red_card")return Vc.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])}),Vc.transformPlayerMarketResult(o)}),it(Ft,"transformPlayerMarketResult",t=>t.map(e=>({playerId:e.id,playerModel:e})));var St=class{footballHttps=null;idMapping=null;matchFacade=null;playerFacade=null;profileNamespace=null;constructor(t,e){this.footballHttps=new dt(t),this.idMapping=e,this.matchFacade=new Zt(t,this.footballHttps,e),this.playerFacade=new Jt(t,this.footballHttps,e),this.profileNamespace=new D(t)}remapMatchIdToNative=async t=>(await this.idMapping.getEntityIdsBySchemaId(t,"match","native")).match;remapPlayerIdToNative=async t=>(await this.idMapping.getEntityIdsBySchemaId(t,"player","native")).player[0];remapPlayerIdMapToNative=async t=>{let e={},i=pe(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=hu.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(It.includes(e)&&i){let n="";if(i!=="OWN_GOAL"&&i!=="NOBODY"&&(n=(await this.idMapping.idMappingFacade.getEntitiesByIds({player:[i]},this.idMapping.idSchema,"native")).player[0]),n&&r[a][n]){let l=await this.playerFacade.getPlayersMapWithNativeIds([n]);return r[a][n].model=l[n],r[a][n]}else return n?(r[a][n]=new L,r[a][n]):r[a][i]}else if(It.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 ve){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 Se||t instanceof Fe){let e={competition:t.competitionsWhitelist},i=await this.idMapping.idMappingFacade.getEntitiesByIds(e,"native",this.idMapping.idSchema);return t.competitionsWhitelist=i.competition,t}};remapMatchIdsFixtures=async t=>{if(Array.isArray(t.data))if(t.data.length>0){let e=[],i=[];return t.data.forEach(a=>{a instanceof Tt||a instanceof Vt||a instanceof Pt||a instanceof si?(a.fixtures.forEach(r=>e.push(r.matchId)),a instanceof Pt&&a.fixtures.forEach(r=>{r.prediction.playerId&&r.prediction.playerId!=="OWN_GOAL"&&i.push(r.prediction.playerId)})):a instanceof Xt&&a.results.forEach(r=>e.push(r.matchId))}),await this.refactorResponseArrModel(t,e,i)}else return t;else return await this.refactorResponseObjModel(t)};refactorResponseArrModel=async(t,e,i)=>{let a=[],r=await this.matchFacade.getMatchesMapWithNativeIds(e),o={};return i.length>0&&(o=await this.playerFacade.getPlayersMapWithNativeIds(i)),t.data.forEach(n=>{n instanceof Tt||n instanceof Vt||n instanceof Pt?(n.fixtures.forEach(l=>{this.handleMatchModel(r,l),n instanceof Pt&&l.prediction.playerId&&l.prediction.playerId!=="OWN_GOAL"&&(l.prediction.playerModel=o[l.prediction.playerId],l.prediction.playerId=o[l.prediction.playerId].id)}),a.push(n)):n instanceof Xt&&(n.results.forEach(l=>{l.matchModel=r[l.matchId],delete l.matchModel.availableMarkets,l.matchId=l.matchModel.id}),a.push(n))}),t.data=a,t};refactorResponseObjModel=async t=>{let e=[];t.fixtures.forEach(a=>e.push(a.matchId));let i=await this.matchFacade.getMatchesMapWithNativeIds(e);return t.fixtures.forEach(a=>this.handleMatchModel(i,a)),t};getCurrentGameId=t=>{let e=new Date;if(t.data.length>1){let i=[];return t.data.forEach(r=>i.push(r.predictionsCutoff)),t.data.sort((r,o)=>{let[n,l]=[r.predictionsCutoff,o.predictionsCutoff].map(p=>Math.abs(new Date(p)-e));return n-l})[0].id}else return t.data[0].id};initGameTypePredictions=(t,e)=>{let i={type:t,limit:null,startAfter:null};return e&&(i={...i,limit:e.limit,startAfter:e.startAfter}),i=new V(i),i};initGameFilters=(t,e,i)=>{if(e&&i)return e.type=t,e.gameIds=i,e=new nt(e),e;if(e&&!i)return e.type=t,e=new nt(e),e;if(!e&&i){let a={type:t,gameIds:i};return a=new nt(a),a}else{let a={type:t};return a=new nt(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 Vt&&(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 Xe;return e.settledAt=t.settled_at,e.resettledAt=t.resettled_at,e.status=t.status,e.outcome=t.outcome,e.points=t.points,e};areIdsExceeded=t=>t.length>10;initPredictionsFilters=(t,e,i)=>{switch(e){case"user":t&&(t=new V(t));break;case"current":if(t)this.deleteUnexpectedProperties(t),t.status=["ACTIVE"],t=new V(t);else{let a={status:["ACTIVE"]};t=new V(a)}break;case"past":if(t)this.deleteUnexpectedProperties(t),t.status=ou,t=new V(t);else{let a={status:ou};t=new V(a)}break;case"matches":if(t)this.deleteUnexpectedProperties(t),t.matchIds=i,t=new V(t);else{let a={matchIds:i};t=new V(a)}break}return t};completeGameMarketResults=async(t,e)=>{switch(e){case"MATCH_QUIZ":let i={},a=t.results[0].matchId,r=t.results.map(p=>It.includes(p.market)&&!p.result.includes("OWN_GOAL")?[...p.result]:[]).flat(),o=await this.matchFacade.getMatchesMapWithNativeIds([a]);return r.length&&(i=await this.playerFacade.getPlayersMapWithNativeIds(r)),t.results=t.results.map(p=>{if(p.matchModel=o[p.matchId]?o[p.matchId]:null,p.playerModels&&Object.keys(i).length&&p.result.forEach(u=>{let d=i[u];p.playerModels.push(d)}),this.idMapping.idSchema!=="native"&&(this.remapMatchIdForResultsMarkets(o,p),p.playerModels&&Object.keys(i).length)){let c=p.result;p.result=c.map(u=>i[u].id)}return p}),t;case"TOP_X":let n=t.results.map(p=>p.matchId),l=await this.matchFacade.getMatchesMapWithNativeIds(n);if(t.results=t.results.map(p=>(p.matchModel=l[p.matchId]?l[p.matchId]:null,this.idMapping.idSchema!=="native"&&this.remapMatchIdForResultsMarkets(l,p),p)),t.tieBreakers.goldenGoals.length){let p=t.tieBreakers.goldenGoals.map(u=>u.playerId),c=await this.playerFacade.getPlayersMapWithNativeIds(p);t.tieBreakers.goldenGoals=t.tieBreakers.goldenGoals.map(u=>(u.matchModel=l[u.matchId],u.playerModel=c[u.playerId],this.idMapping.idSchema!=="native"&&(u.matchId=l[u.matchId].id,u.playerId=c[u.playerId].id),u))}return t}};completeContestWinners=async t=>{if(t.userList&&t.userList.length){let e=t.userList.map(a=>a.profileId),i=await this.profileNamespace.getByIds(e);t.userList.forEach(a=>{let r=i.filter(o=>o.id===a.profileId)[0];delete r.interests,a.profileModel=r})}return t};handleMatchModel=(t,e)=>{t[e.matchId]?(e.matchModel=t[e.matchId],delete e.matchModel.availableMarkets,e.matchId=e.matchModel.id):(e.matchModel=null,this.idMapping.idSchema!=="native"&&this.idMapping.idMappingFacade.getEntityById(e.matchId,"match","native").then(i=>{e.matchId=i[G[this.idMapping.idSchema]]}))};remapMatchIdForResultsMarkets=(t,e)=>{t[e.matchId]?e.matchId=t[e.matchId].id:this.idMapping.idMappingFacade.getEntityById(e.matchId,"match","native").then(i=>{e.matchId=i[G[this.idMapping.idSchema]]})};deleteUnexpectedProperties=t=>(t.status&&(console.warn(Kc.UNEXPECTED_STATUS_PROP),delete t.status),t.type&&(console.warn(Kc.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 Vs;let i=[];e.timeline.filter(r=>Number(r.minute)<=90).filter(r=>r.type==="goal"||r.type==="penalty_goal"||r.type==="yellow_card"||r.type==="red_card").forEach(r=>{i.push(r.player.id)});let a={};return i.length&&(a=await this.playerFacade.getPlayersMapWithNativeIds(i)),Ft.createMatchMarketsResultsModel(e,a)}};var Di=class{fixturesRemapper=null;footballHttps=null;matchFacade=null;playerFacade=null;predictorService=null;constructor(t,e){this.footballHttps=new dt(t),this.matchFacade=new Zt(t,this.footballHttps,e),this.playerFacade=new Jt(t,this.footballHttps,e),this.predictorService=new St(t,e),this.fixturesRemapper=new Ul(this.matchFacade,this.playerFacade,this.predictorService)}remapRequestBody=t=>{if(t instanceof ke)return t;let e={};return e.game_instance_id=t.gameInstanceId,e.fixtures=t.fixtures.map(i=>this.fixturesRemapper.remapFixturesRequest(i)),t instanceof ni&&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 Fi,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 Ye;u.target?d.market=this.predictorService.convertMarketForResponseModel(u.market,u.target):d.market=u.market,d.matchId=n[u.match_id].id,d.matchType=u.match_type,d.matchModel=n[u.match_id],delete d.matchModel.availableMarkets,u.prediction!==void 0?d.prediction.value=u.prediction:u.goals_home!==void 0&&u.goals_away!==void 0&&(d.prediction.value=u.goals_home.toString()+":"+u.goals_away.toString()),d.prediction.playerId=u.player_id?u.player_id:null,d.prediction.playerId&&d.prediction.playerId!==e&&(d.prediction.playerModel=r[d.prediction.playerId],d.prediction.playerId=r[d.prediction.playerId].id),u.market==="PLAYER_PERFORMANCE"&&(d.prediction.playerRole=u.role),d.result=this.fixturesRemapper.remapResult(u.result),c.push(d)}),p.fixtures=c,p.status=l.status,l.tiebreaker?p.tiebreaker.goldenGoal=l.tiebreaker.golden_goal:p.tiebreaker=null,p.points=l.points,p.createdAt=l.created_at,p.updatedAt=l.updated_at,o.push(p)}),o}return t};remapResponseObjBody=async t=>{let e=new Fi;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 Hs;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 Vl=class{remapPredictions=null;constructor(t,e){this.remapPredictions=new Di(t,e)}remapResponse=t=>{let e=new $s;return e.matchId=t.match_id,e.matchType=t.match_type,e.predictions=this.remapPredictions.remapPredictionModel(t.predictions),e}};var Hl=class extends tt{remapPaginatedGames=t=>{let e=new H;return e.meta.pagination.nextPageStartsAfter=t.meta.pagination.next_page_starts_after,e.meta.pagination.itemsPerPage=t.meta.pagination.items_per_page,e.data=t.data.map(i=>this.remapGamesListResponse(i)),e};remapGamesListResponse=t=>{let e=new Tt;return e.id=t.id,e.title=t.title,e.description=t.description,e.type=t.type,e.status=t.status,e.authRequirement=t.auth_requirement||null,e.scheduleOpenAt=t.schedule_open_at,e.predictionsCutoff=t.predictions_cutoff,e.fixtures=t.fixtures.map(i=>this.remapFixturesResponse(i)),e.tiebreaker=t.tiebreaker?this.remapTimeTiebreaker(t.tiebreaker.time_tiebreaker):null,e.participantsCount=t.participants_count,e.related=t.related?this.remapRelated(t.related):[],e.excludedProfileIds=t.excluded_profile_ids,e.rules=t.rules,e.labels=t.labels,e.customFields=t.custom_fields,e.branding=t.branding?this.remapBranding(t.branding):null,e.flags=t.flags,e.images=t.images,e.createdAt=t.created_at,e.updatedAt=t.updated_at,e};remapGameByIdResponse=t=>{let e=new si;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 an;return e.matchId=t.match_id,e.matchType=t.match_type,e.market=t.market,e.matchStatus.type=t.match_status?t.match_status.type:null,e.matchStatus.subType=t.match_status?t.match_status.sub_type:null,e};remapPaginatedUserTopXEditions=t=>{let e=new H;return e.meta.pagination.nextPageStartsAfter=t.meta.pagination.next_page_starts_after,e.meta.pagination.itemsPerPage=t.meta.pagination.items_per_page,e.data=t.data.map(i=>this.remapUserTopXEditionsResponse(i)),e};remapUserTopXEditionsResponse=t=>{let e=new Vt;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 on;return e.matchId=t.match_id,e.matchType=t.match_type,e.market=t.market,e.matchStatus.type=t.match_status?t.match_status.type:null,e.matchStatus.subType=t.match_status?t.match_status.sub_type:null,e};remapPaginatedUserMathQuizEditions=t=>{let e=new H;return e.meta.pagination.nextPageStartsAfter=t.meta.pagination.next_page_starts_after,e.meta.pagination.itemsPerPage=t.meta.pagination.items_per_page,e.data=t.data.map(i=>this.remapUserMatchQuizEditionsResponse(i)),e};remapUserMatchQuizEditionsResponse=t=>{let e=new Pt;return e.id=t.id,e.title=t.title,e.description=t.description,e.type=t.type,e.status=t.status,e.authRequirement=t.auth_requirement||null,e.predictionsCutoff=t.predictions_cutoff,e.scheduleOpenAt=t.schedule_open_at,e.fixtures=t.fixtures.map(i=>this.remapMatchQuizFixturesResponse(i)),e.tiebreaker=t.tiebreaker?this.remapTimeTiebreaker(t.tiebreaker.time_tiebreaker):null,e.participantsCount=t.participants_count,e.related=t.related?this.remapRelated(t.related):[],e.excludedProfileIds=t.excluded_profile_ids,e.rules=t.rules,e.flags=t.flags,e.images=t.images,e.branding=t.branding?this.remapBranding(t.branding):null,e.createdAt=t.created_at,e.updatedAt=t.updated_at,e};remapMatchQuizFixturesResponse=t=>{let e=new 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 H;return e.meta.pagination.nextPageStartsAfter=t.meta.pagination.next_page_starts_after,e.meta.pagination.itemsPerPage=t.meta.pagination.items_per_page,e.data=t.data.map(i=>this.remapGameResults(i)),e};remapGameResults=t=>{let e=new Xt;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 Do;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 nn;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 ln;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 X;return t&&(e.type=t.type,e.subType=t.sub_type),e};remapMarketResult=(t,e)=>{if(du.includes(t))return e[0];if(It.includes(t))return e;if(e[0]==="true")return!0;if(e[0]==="false")return!1};deleteUnusefulField=t=>((!It.includes(t.market)||this.isPlayerMarketWithNoResult(t.market,t.result))&&delete t.playerModels,t);isPlayerMarketWithNoResult=(t,e)=>It.includes(t)&&e.length===0;remapResults=t=>{let e=new sn;return e.matchId=t.match_id,e.outcome=t.outcome,e};remapTiebreaker=t=>{let e=new bt;return e.goldenGoal=t.golden_goal,e};remapTimeTiebreaker=t=>{let e=new yt;return e.timeTiebreaker=t,e};remapRelated=t=>t.map(e=>{let i=new z;return i.entityId=e.entity_id,i.entityType=e.entity_type,i.entityRelationship=e.entity_relationship,i})};var $l=class{remapMetaData=t=>{let e=new b;return e.pagination.nextPageStartsAfter=t.pagination.next_page_starts_after,e.pagination.itemsPerPage=t.pagination.items_per_page,e}};var mt=class extends v{predictionRemapper=null;matchSummaryRemapper=null;gamesRemapper=null;metaRemapper=null;idMapping=null;constructor(t){super(t,O(t.environment,"predictor")),this.idMapping=new R(t),this.predictionRemapper=new Di(t,this.idMapping),this.matchSummaryRemapper=new Vl(t,this.idMapping),this.gamesRemapper=new Hl,this.metaRemapper=new $l}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}${m()}`:`/predictions/summary/${t}${this.apiSignInUrl}`,a=`There was a problem fetching predictions for match: ${t}`,r=await this.fetchWithoutAuth(i,a);return this.matchSummaryRemapper.remapResponse(r)};deleteFootballPrediction=async t=>{let e=`/predictions/${t}${this.apiSignInUrl}`,i=`There was a problem deleting your prediction: ${t}`,a="DELETE";return await this.fetchWithAuth(e,i,a),!0};getMyPredictions=async t=>{let e=new H,i=`/predictions${this.apiSignInUrl}`,a="There was a problem fetching own predictions";t&&(i+=`${t.constructFiltersUrl()}`);let r=await this.fetchWithAuth(i,a);return e.meta=this.metaRemapper.remapMetaData(r.meta),e.data=await this.predictionRemapper.remapResponseArrayBody(r.data),e};getMyPredictionsNoRemap=async t=>{let e=`/predictions${this.apiSignInUrl}${t.constructFiltersUrl()}`,i="There was a problem fetching own predictions";return await this.fetchWithAuth(e,i)};getUserPredictions=async(t,e,i)=>{let a=new H,r=f(e)?`/predictions/users/${t}${this.apiSignInUrl}${m()}`:`/predictions/users/${t}${this.apiSignInUrl}`,o=`There was a problem fetching predictions for user: ${t}`;i&&(r+=`${i.constructFiltersUrl()}`);let n=await this.fetchWithoutAuth(r,o);return a.meta=this.metaRemapper.remapMetaData(n.meta),a.data=await this.predictionRemapper.remapResponseArrayBody(n.data),a};getUserPredictionsNoRemap=async(t,e)=>{let i=`/predictions/users/${t}${this.apiSignInUrl}${e.constructFiltersUrl()}`,a=`There was a problem fetching predictions for user: ${t}`;return await this.fetchWithoutAuth(i,a)};getGames=async(t,e)=>{let i=f(e)?`/games/${this.apiSignInUrl}${t.constructFiltersUrl()}${m()}`:`/games/${this.apiSignInUrl}${t.constructFiltersUrl()}`,a="There was a problem fetching the games list",r=await this.fetchWithoutAuth(i,a);return this.gamesRemapper.remapPaginatedGames(r)};getGamesNoRemap=async(t,e)=>{let i=f(e)?`/games/${this.apiSignInUrl}${t.constructFiltersUrl()}${m()}`:`/games/${this.apiSignInUrl}${t.constructFiltersUrl()}`,a="There was a problem fetching the games list";return await this.fetchWithoutAuth(i,a)};getGameById=async(t,e)=>{let i=f(e)?`/games/${t}${this.apiSignInUrl}${m()}`:`/games/${t}${this.apiSignInUrl}`,a=`There was a problem fetching the following game: ${t}`,r=await this.fetchWithoutAuth(i,a);return this.gamesRemapper.remapGameByIdResponse(r)};getGamePredictions=async(t,e,i)=>{let a=new H,r=f(e)?`/games/${t}/predictions${this.apiSignInUrl}${m()}`:`/games/${t}/predictions${this.apiSignInUrl}`,o=`There was a problem fetching the predictions for game: ${t}`;i&&(r+=`${i.constructFiltersUrl()}`);let n=await this.fetchWithoutAuth(r,o);return a.meta=this.metaRemapper.remapMetaData(n.meta),a.data=await this.predictionRemapper.remapResponseArrayBody(n.data),a};getUserGameEditions=async(t,e)=>{let i=null,a=f(e)?`/games/${this.apiSignInUrl}${t.constructFiltersUrl()}${m()}`:`/games/${this.apiSignInUrl}${t.constructFiltersUrl()}`,r="There was a problem fetching the games list",o=await this.fetchWithoutAuth(a,r);return o.data.forEach(n=>{n.type==="TOP_X"?i=this.gamesRemapper.remapPaginatedUserTopXEditions(o):n.type==="MATCH_QUIZ"&&(i=this.gamesRemapper.remapPaginatedUserMathQuizEditions(o))}),i};getGameResults=async(t,e,i)=>{let a=f(e)?`/games/${t}/results/${this.apiSignInUrl}${m()}`:`/games/${t}/results/${this.apiSignInUrl}`,r=`There was a problem fetching the results for the following game: ${t}`;i&&(a+=`${i.constructMainFiltersUrl()}`);let o=await this.fetchWithoutAuth(a,r);return this.gamesRemapper.remapPaginatedGameResults(o)};getMarketResultsForGame=async(t,e)=>{let i=`/games/${t}/correct-results/${this.apiSignInUrl}`,a=`There was a problem fetching the markets correct results for the following game: ${t}`;f(e)&&(i+=`${m()}`);let r=await this.fetchWithoutAuth(i,a);return this.gamesRemapper.remapGameMarketsResults(r.data)};getContestWinners=async(t,e)=>{let i=`/winners/${this.apiSignInUrl}&contest_id=${t}`,a=`There was a problem fetching winners for the following game: ${t}`;e&&(i+=m());let r=await this.fetchWithoutAuth(i,a);return this.gamesRemapper.remapContestWinners(r)};getPredictionById=async t=>{let e=`/predictions/${t}${this.apiSignInUrl}`,i=`There was a problem fetching info for the following prediction: ${t}`,a=await this.fetchWithoutAuth(e,i);return(await this.predictionRemapper.remapResponseArrayBody([a.data]))[0]};getPredictionsByIds=async t=>{let e=`/predictions/by-ids${this.apiSignInUrl}&prediction_ids=${t.join(",")}`,i="There was a problem fetching predictions",a=await this.fetchWithoutAuth(e,i);return await this.predictionRemapper.remapResponseArrayBody(a.data)}};var te=class{errorHandlingMode=null;constructor(t){this.errorHandlingMode=t}validateBodyFields=(t,e)=>{let i=Object.keys(e),a=Object.keys(new ei);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(Rl),o=Object.values(Sl),n=Object.values(Fl);if(e==="FT_1X2"||e==="HT_1X2"){if(r.includes(i))return new Bs(t,e,i)}else if(e==="HT_FT"){if(o.includes(i))return new Ls(t,i)}else if(e==="DOUBLE_CHANCE"){if(n.includes(i))return new Os(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 Ut(t,e,i)}else if(e==="CORNERS_MATCH"){if(typeof i=="number")return new vs(t,i)}else if(e==="BOTH_TEAMS_SCORE"){if(this.isPredictionBoolean(i))return new Fs(t,i)}else if(e==="RED_CARD_MATCH"){if(this.isPredictionBoolean(i))return new Gs(t,i)}else if(e==="PENALTY_MATCH"){if(this.isPredictionBoolean(i))return new Ns(t,i)}else if(It.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 st(t,e,i,p)}if(a&&this.isPredictionBoolean(i))return new st(t,e,i,a)}else if(cu.includes(e)){if(this.isPredictionBoolean(i))return new Ze(t,e,i)}else if(uu.includes(e)&&this.isPredictionBoolean(i))return new Je(t,e,i);this.throwInvalidPredictionException(i,e)};validateFixtureFields=t=>{let e=Object.keys(t);e.forEach(a=>{Wc.includes(a)||this.throwInvalidParamException([a])});let i=Wc.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 bt)[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){It.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(at).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=fu(t,e);throw this.errorHandlingMode==="default"?new y(400,"INVALID_PREDICTION",i):new h(400,"INVALID_TYPE",i)};throwInvalidMarketException=(t,e)=>{let i=null;throw e&&e==="TOP_X"?i=gu(t):i=qp(t),this.errorHandlingMode==="default"?new y(400,"INVALID_MARKET",i):new h(400,"INVALID_TYPE",i)};throwInvalidParamException=t=>{let e=yu(t);throw this.errorHandlingMode==="default"?new y(400,"INVALID_FIELD",e):new h(400,"INVALID_TYPE",e)};throwMissingFieldsException=(t,e)=>{let i=bu(t,e);throw this.errorHandlingMode==="default"?new y(400,"INVALID_FIELD",i):new h(400,"INVALID_TYPE",i)};throwInvalidType=(t,e)=>{let i=Mu(t,e);throw this.errorHandlingMode==="default"?new y(400,"INVALID_TYPE",i):new h(400,"INVALID_TYPE",i)}};var ee=class{predictorHttps=null;predictorService=null;idMapping=null;clientHttps=null;predictorValidator=null;errorHandlingMode=null;constructor(t){this.predictorValidator=new te(t.errorHandlingMode),this.idMapping=new R(t),this.predictorHttps=new mt(t),this.predictorService=new St(t,this.idMapping),this.clientHttps=new q(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 st&&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 st&&n.prediction.playerId!=="OWN_GOAL"&&(n.prediction.playerId=o[n.prediction.playerId])})}return t.fixtures=e,await this.predictorHttps.makeFootballPrediction(t)};delete=async t=>await this.predictorHttps.deleteFootballPrediction(t);getGames=async(t,e)=>{e=e||!1;let i=this.predictorService.initGameFilters("MATCH_QUIZ",t),a=await this.predictorHttps.getGames(i,e);return await this.predictorService.remapMatchIdsFixtures(a)};getGamesNoRemap=async(t,e)=>{e=e||!1;let i=this.predictorService.initGameFilters("MATCH_QUIZ",t);return await this.predictorHttps.getGamesNoRemap(i,e)};getGameById=async(t,e)=>{e=e||!1;let i=await this.predictorHttps.getGameById(t,e);return await this.predictorService.remapMatchIdsFixtures(i)};getGamePredictions=async(t,e,i)=>(i=i||!1,e&&(e.type&&delete e.type,e.status&&delete e.status,e=new V(e)),await this.predictorHttps.getGamePredictions(t,i,e));getGameResults=async(t,e,i)=>{i=i||!1,e&&(e=new w(e));let a=await this.predictorHttps.getGameResults(t,i,e);return await this.predictorService.remapMatchIdsFixtures(a)};getCurrentGameResults=async t=>{t=t||!1;let e=new nt(null);e.status="OPEN",e.type="MATCH_QUIZ";let i=await this.predictorHttps.getGames(e,t),a=this.predictorService.getCurrentGameId(i);return(await this.getGameResults(a,null,t)).data[0]};getMyGameEditions=async(t,e)=>{t&&t.limit&&this.validateLimitFilterOnGames(t.limit),e=e||!1;let i=this.predictorService.initGameTypePredictions("MATCH_QUIZ",t),a=[],r=await this.predictorHttps.getMyPredictionsNoRemap(i);if(r.data.length>0){r.data.forEach(p=>{p.game_instance_id&&a.push(p.game_instance_id)});let o=t?.limit?{limit:t.limit}:null,n=this.predictorService.initGameFilters("MATCH_QUIZ",o,a),l=await this.predictorHttps.getUserGameEditions(n,e);return await this.predictorService.addPredictionProp(r,l)}else return new H};getMyGamePrediction=async t=>{let e=new V({gameIds:[t]}),i=await this.predictorHttps.getMyPredictions(e);if(i.data.length>0){let a=i.data.filter(r=>r.gameInstanceId===t);return a.length?a[0]:null}return null};getUserGameEditions=async(t,e,i)=>{e&&e.limit&&this.validateLimitFilterOnGames(e.limit),i=i||!1;let a=this.predictorService.initGameTypePredictions("MATCH_QUIZ",e),r=[],o=await this.predictorHttps.getUserPredictionsNoRemap(t,a);if(o.data.length>0){o.data.forEach(c=>{c.game_instance_id&&r.push(c.game_instance_id)});let n=e?.limit?{limit:e.limit}:null,l=this.predictorService.initGameFilters("MATCH_QUIZ",n,r),p=await this.predictorHttps.getUserGameEditions(l,i);return await this.predictorService.addPredictionProp(o,p)}else return new H};getUserGamePrediction=async(t,e,i)=>{i=i||!1;let a=new V({gameIds:[e]}),r=await this.predictorHttps.getUserPredictions(t,i,a);if(r.data.length>0){let o=r.data.filter(n=>n.gameInstanceId===e);return o.length?o[0]:null}else return null};getMarketsResultsForGame=async(t,e)=>{let i=await this.predictorHttps.getMarketResultsForGame(t,e);return await this.predictorService.completeGameMarketResults(i,"MATCH_QUIZ")};getGameWinners=async(t,e)=>{let i=await this.predictorHttps.getContestWinners(t,e),a=await this.getGameById(t);return i.contestModel=a,this.predictorService.completeContestWinners(i)};validateLimitFilterOnGames=t=>{if(this.errorHandlingMode==="default"&&t>50)throw new y(400,"EXCEEDED_LENGTH","Maximum limit for filtering games is 50 or less.");if(this.errorHandlingMode==="standard"&&t>50)throw new h(400,"EXCEEDED_LENGTH","Maximum limit for filtering games is 50 or less.")}};var zl=class extends tt{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 No;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 Uo;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 $o;return i.classicQuizId=e.classic_quiz_id,i.correct=e.correct,i.classicQuizQuestions=e.classic_quiz_questions,i.personalBest=e.personal_best,i.points=e.points,i.attempts=e.attempts,i.answers=e.answers?e.answers.map(a=>this.remapParticipationQuestions(a)):e.answers,i});remapClassicQuizzesLeaderboard=t=>(t.meta=this.remapClassicQuizLeaderboardMeta(t.meta),t.data=t.data.map(e=>this.remapClassicQuizLeaderboard(e)),t);remapClassicQuizUserRankings=t=>(t.meta.pagination=this.remapMetaPaginationRank(t.meta.pagination),t.data=t.data.map(e=>this.remapClassicQuizUserRanking(e)),t);remapClassicQuizQuestionsReport=t=>t.map(e=>{let i=new zo;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 ss;return i.questions=e.questions,i.correctAnswers=e.correct_answers,i});remapMetaPagination=t=>{let e=new ut;return e.itemsPerPage=t.items_per_page,e.nextPageStartsAfter=t.next_page_starts_after,e};remapClassicQuizLeaderboardMeta=t=>{let e=new We;return e.pagination=this.remapMetaPaginationRank(t.pagination),e.filters=this.remapLeaderboardMetaFilters(t.filters),e};remapMetaPaginationRank=t=>{let e=new Y;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 qe;return e.classicQuizIds=t?.classic_quiz_ids||null,e};remapClassicQuizUserRanking=t=>{let e=new Wo;return e.position=t.position,e.classicQuizId=t.classic_quiz_id,e.points=t.points,e};remapBasicClassicQuiz=t=>{let e=new ze;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 ko;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 Go;return e.optionId=t.option_id,e.option=t.option,e.images=t.images,e.correct=t.correct,e};remapParticipationQuestions=t=>{let e=new Vo;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 Qo;return e.position=t.position,e.profileId=t.profile_id,e.points=t.points,e};remapContext=t=>{let e=new kt;return e.content=t.content,e.tags=t.tags?t.tags.map(i=>{let a=new Gt;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 z;return i.entityId=e.entity_id,i.entityType=e.entity_type,i.entityRelationship=e.entity_relationship,i})};var ql=class extends tt{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 jo;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 Xo;return e.eitherOrId=t.either_or_id,e.personalBest=t.personal_best,e.betterThan=t.better_than,e};remapEitherOrResults=t=>{let e=new rs;return e.standings=t.standings?t.standings.map(i=>this.remapResultsStandings(i)):t.standings,e.breakdown=t.breakdown?t.breakdown.map(i=>this.remapResultsBreakdown(i)):t.breakdown,e};remapEitherOrParticipation=t=>{let e=new Jo;return e.instanceId=t.instance_id,e.eitherOrId=t.either_or_id,e.gameStartedAt=t.game_started_at,e.currentStep=t.current_step,e.currentStreak=t.current_streak,e.remainingSteps=t.remaining_steps,e.currentLives=t.current_lives,e.currentPoints=t.current_points,e.personalBest=t.personal_best,e.participationCount=t.participation_count,e.finishedParticipationsCount=t.finished_participations_count,e.steps=t.steps?t.steps.map(i=>this.remapParticipationSteps(i)):t.steps,e};remapBasicEitherOr=t=>{let e=new Ke;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 ut;return e.itemsPerPage=t.items_per_page,e.nextPageStartsAfter=t.next_page_starts_after,e};remapPoints=t=>{let e=new Yo;return e.correctSteps=t.correct_steps,e.score=t.score,e};remapResultsStandings=t=>{let e=new os;return e.userId=t.user_id,e.personalBest=t.personal_best,e};remapResultsBreakdown=t=>{let e=new as;return e.rangeStartInclusive=t.range_start_inclusive,e.rangeEndInclusive=t.range_end_inclusive,e.totalUsers=t.total_users,e};remapParticipationSteps=t=>{let e=new is;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 kt;return e.content=t.content,e.tags=t.tags?t.tags.map(i=>{let a=new Gt;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 z;return i.entityId=e.entity_id,i.entityType=e.entity_type,i.entityRelationship=e.entity_relationship,i})};var Ql=class extends tt{remapPersonalityQuizzes=t=>(t.meta.pagination=this.remapMetaPagination(t.meta.pagination),t.data=t.data.map(e=>this.remapBasicPersonalityQuiz(e)),t);remapPersonalityQuizById=t=>{let e=new Ri;return e.id=t.id,e.title=t.title,e.alternativeTitle=t.alternative_title,e.description=t.description,e.images=t.images,e.participationCount=t.participation_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||null,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.maxAttempts=t.max_attempts,e.context=t.context?this.remapContext(t.context):t.context,e.questions=t.questions?t.questions.map(i=>this.remapQuestions(i)):[],e.personaResults=t.persona_results?t.persona_results.map(i=>this.remapPersonaResults(i)):[],e.createdAt=t.created_at,e.updatedAt=t.updated_at,e};remapPersonalityQuizParticipation=t=>{let e=new ds;return e.personalityQuizId=t.personality_quiz_id,e.userId=t.user_id,e.questions=t.questions?this.remapParticipationQuestions(t.questions):[],e.personas=t.personas?this.remapParticipationPersonas(t.personas):[],e.attempts=t.attempts,e};remapParticipationQuestions=t=>t.map(e=>{let i=new ms;return i.questionId=e.question_id,i.optionId=e.option_id,i});remapParticipationPersonas=t=>t.map(e=>{let i=new hs;return i.personaId=e.persona_id,i.percent=e.percent,i});remapPersonalityQuizParticipationBody=t=>t.map(e=>({question_id:e.questionId,option_id:e.optionId}));remapPersonalityQuizUserParticipation=t=>{let e=new Ri;return e.id=t.id,e.title=t.title,e.alternativeTitle=t.alternative_title,e.description=t.description,e.images=t.images,e.participationCount=t.participation_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.related=t.related?this.remapRelated(t.related):[],e.maxAttempts=t.max_attempts,e.context=t.context?this.remapContext(t.context):t.context,e.questions=t.questions.map(i=>this.remapQuestions(i)),e.personaResults=t.persona_results?t.persona_results.map(i=>this.remapPersonaResults(i)):[],e.createdAt=t.created_at,e.updatedAt=t.updated_at,e};remapMetaPagination=t=>{let e=new ut;return e.itemsPerPage=t.items_per_page,e.nextPageStartsAfter=t.next_page_starts_after,e};remapBasicPersonalityQuiz=t=>{let e=new je;return e.id=t.id,e.title=t.title,e.alternativeTitle=t.alternative_title,e.description=t.description,e.images=t.images,e.participationCount=t.participation_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.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};remapPersonaResults=t=>{let e=new ns;return e.personaId=t.persona_id,e.title=t.title,e.description=t.description,e.images=t.images,e};remapQuestions=t=>{let e=new ls;return e.questionId=t.question_id,e.question=t.question,e.images=t.images,e.explanation=t.explanation,e.options=t.options.map(i=>this.remapOptions(i)),e};remapOptions=t=>{let e=new cs;return e.optionId=t.option_id,e.option=t.option,e.images=t.images,e.preferenceMapping=t.preference_mapping?this.remapPreferencesMapping(t.preference_mapping):[],e.personaPoints=t.persona_points?this.remapPersonaPoints(t.persona_points):[],e};remapPreferencesMapping=t=>t.map(e=>{let i=new ci;return i.preferenceId=e.preference_id,i});remapPersonaPoints=t=>t.map(e=>{let i=new ps;return i.personaId=e.persona_id,i.points=e.points,i});remapContext=t=>{let e=new kt;return e.content=t.content,e.tags=t.tags?t.tags.map(i=>{let a=new Gt;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 z;return i.entityId=e.entity_id,i.entityType=e.entity_type,i.entityRelationship=e.entity_relationship,i})};var Bi=class extends v{classicQuizRemapper=null;eitherOrRemapper=null;personalityQuizRemapper=null;constructor(t){super(t,O(t.environment,"miniGames")),this.classicQuizRemapper=new zl,this.eitherOrRemapper=new ql,this.personalityQuizRemapper=new Ql}getClassicQuizzes=async(t,e)=>{let i=`/classic-quizzes${this.apiSignInUrl}`;t&&(i+=t.constructMainFiltersUrl()),i+=f(e)?m():"";let a="There was a problem with fetching classic quizzes",r=await this.fetchWithoutAuth(i,a);return this.classicQuizRemapper.remapClassicQuizzes(r)};getClassicQuizById=async(t,e,i)=>{let a=`/classic-quizzes/${t}${this.apiSignInUrl}`;e&&(a+=`&include_correct_options=${e}`),f(i)&&(a+=m());let r="There was a problem with fetching classic quiz by ID",o=await this.fetchWithoutAuth(a,r);return this.classicQuizRemapper.remapClassicQuizById(o.data)};participateInClassicQuiz=async(t,e,i)=>{let a=`/classic-quizzes/${t}/participate${this.apiSignInUrl}`,r=`There was a problem with participating in the following classic quiz: ${t}`,o="POST",n={questions:this.classicQuizRemapper.remapClassicQuizParticipationBody(e),include_correct_options:!!i},l=await this.fetchWithAuth(a,r,o,n);return this.classicQuizRemapper.remapClassicQuizParticipation(l.data)};getMyClassicQuizParticipations=async t=>{let e=`/classic-quizzes/participations${this.apiSignInUrl}`;t&&(e+=`${t.constructMainFiltersUrl()}`);let i="There was a problem with fetching user's own Classic Quiz participations",a=await this.fetchWithAuth(e,i);return this.classicQuizRemapper.remapUserClassicQuizParticipations(a.data)};getLeaderboardForClassicQuizzes=async(t,e)=>{let i=`/classic-quizzes/rank${this.apiSignInUrl}`;t&&(i+=`${t.constructMainFiltersUrl()}`),i+=f(e)?m():"";let a="There was a problem with fetching classic quizzes leaderboard",r=await this.fetchWithoutAuth(i,a);return this.classicQuizRemapper.remapClassicQuizzesLeaderboard(r)};getClassicQuizzesUserRanking=async(t,e,i)=>{let a=`/classic-quizzes/users/${t}/rank${this.apiSignInUrl}`;e&&(a+=`${e.constructMainFiltersUrl()}`),a+=f(i)?m():"";let r="There was a problem with fetching user's rankings for classic quizzes",o=await this.fetchWithoutAuth(a,r);return this.classicQuizRemapper.remapClassicQuizUserRankings(o)};getClassicQuizQuestionsReport=async t=>{let e=`/classic-quizzes/${t}/questions-report${this.apiSignInUrl}`,i=`There was a problem with fetching questions report for quiz: ${t}`,a=await this.fetchWithoutAuth(e,i);return this.classicQuizRemapper.remapClassicQuizQuestionsReport(a.data)};getClassicQuizResultsSummary=async(t,e)=>{let i=`/classic-quizzes/${t}/results-summary${this.apiSignInUrl}`;f(e)&&(i+=m());let a="There was a problem with fetching classic quiz results summary",r=await this.fetchWithoutAuth(i,a);return this.classicQuizRemapper.remapClassicQuizResultsSummary(r.data)};getEitherOrs=async(t,e)=>{let i=`/either-or${this.apiSignInUrl}`;t&&(i+=t.constructMainFiltersUrl()),i+=f(e)?m():"";let a="There was a problem with fetching list of Either/Ors",r=await this.fetchWithoutAuth(i,a);return this.eitherOrRemapper.remapEitherOrs(r)};getEitherOrById=async(t,e)=>{let i=`/either-or/${t}${this.apiSignInUrl}`;f(e)&&(i+=m());let a="There was a problem with fetching Either/Or by ID",r=await this.fetchWithoutAuth(i,a);return this.eitherOrRemapper.remapEitherOrById(r.data)};getMyEitherOrStats=async t=>{let e=`/either-or/${t}/own-stats${this.apiSignInUrl}`,i="There was a problem with fetching Either/Or own statistics",a=await this.fetchWithAuth(e,i);return this.eitherOrRemapper.remapEitherOrOwnStats(a.data)};getEitherOrResults=async(t,e)=>{let i=`/either-or/${t}/results${this.apiSignInUrl}${f(e)?m():""}`,a="There was a problem with fetching Either/Or results",r=await this.fetchWithoutAuth(i,a);return this.eitherOrRemapper.remapEitherOrResults(r.data)};participateInEitherOr=async(t,e)=>{let i=`/either-or/${t}/participate${this.apiSignInUrl}`,a="There was a problem with participating in Either/Or",r="POST",o=await this.fetchWithAuth(i,a,r,e);return this.eitherOrRemapper.remapEitherOrParticipation(o.data)};getPersonalityQuizzes=async(t,e)=>{let i=`/personality-quizzes${this.apiSignInUrl}`;t&&(i+=t.constructMainFiltersUrl()),i+=f(e)?m():"";let a="There was a problem with fetching personality quizzes",r=await this.fetchWithoutAuth(i,a);return this.personalityQuizRemapper.remapPersonalityQuizzes(r)};getPersonalityQuizById=async(t,e)=>{let i=`/personality-quizzes/${t}${this.apiSignInUrl}`;f(e)&&(i+=m());let a="There was a problem with fetching personality quiz by ID",r=await this.fetchWithoutAuth(i,a);return this.personalityQuizRemapper.remapPersonalityQuizById(r.data)};participateInPersonalityQuiz=async(t,e)=>{let i=`/personality-quizzes/${t}/participate${this.apiSignInUrl}`,a=`There was a problem with participating in the following personality quiz: ${t}`,r="POST",o={questions:this.personalityQuizRemapper.remapPersonalityQuizParticipationBody(e)},n=await this.fetchWithAuth(i,a,r,o);return this.personalityQuizRemapper.remapPersonalityQuizParticipation(n.data)};getPersonalityQuizUserParticipation=async(t,e,i)=>{let a=`/personality-quizzes/${t}/participations/${e}${this.apiSignInUrl}`;f(i)&&(a+=m());let r="There was a problem with fetching user personality quiz participation",o=await this.fetchWithoutAuth(a,r);return this.personalityQuizRemapper.remapPersonalityQuizParticipation(o.data)}};var ie=class extends K{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 Wl=class{idSchema=null;idMapping=null;validator=null;https=null;entityTypes=["competition","team","player"];profile=null;football=null;eitherOrTime=0;participationStartTimestamp=0;countdownTimer=0;intervalId=null;currentPairId="";constructor(t){this.idSchema=t.idSchema,this.idMapping=new R(t),this.validator=new ie(t),this.profile=new D(t),this.football=new et(t),this.https=new Bi(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 ts;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 Kl=class{https=null;service=null;activityService=null;idSchema=null;constructor(t){this.https=new Bi(t),this.service=new Wl(t),this.activityService=new wt(t),this.idSchema=t.idSchema}getClassicQuizzes=async(t,e,i)=>{t&&(t=new Bo(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 Ho(t));let e=await this.https.getMyClassicQuizParticipations(t),i=e.map(r=>r.classicQuizId),a=await this.getClassicQuizzes({classicQuizIds:i});return e.map(r=>{let o=a.data.find(n=>n.id===r.classicQuizId)||null;return{...r,classicQuizModel:o}})};getLeaderboardForClassicQuizzes=async(t,e)=>{t&&(t=new qo(t));let i=await this.https.getLeaderboardForClassicQuizzes(t,e);return i.data=await this.service.setProfileModelsForClassicQuizLeaderboards(i.data),i};getClassicQuizzesUserRanking=async(t,e,i)=>{e&&(e=new Qe(e));let a=await this.https.getClassicQuizzesUserRanking(t,e,i),r=a.data.map(n=>n.classicQuizId),o=await this.getClassicQuizzes({classicQuizIds:r});return a.data=a.data.map(n=>{let l=o.data.find(p=>p.id===n.classicQuizId)||null;return{...n,classicQuizModel:l}}),a};getClassicQuizQuestionsReport=async(t,e)=>{e=e||!1;let i=await this.https.getClassicQuizQuestionsReport(t),a=await this.getClassicQuizById(t,e,!0);return this.service.setQuestionModelsInQuestionsReport(i,a)};getClassicQuizResultsSummary=async(t,e)=>await this.https.getClassicQuizResultsSummary(t,e);getEitherOrs=async(t,e,i)=>{t&&(t=new Ko(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};getPersonalityQuizzes=async(t,e,i)=>{t&&(t=new us(t),await this.service.finalizeMiniGamesFilters(t));let a=await this.https.getPersonalityQuizzes(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};getPersonalityQuizById=async(t,e)=>{let i=await this.https.getPersonalityQuizById(t,e);return await this.service.setContextTagsModels([i]),i};participateInPersonalityQuiz=async(t,e)=>await this.https.participateInPersonalityQuiz(t,e);getPersonalityQuizUserParticipation=async(t,e,i)=>await this.https.getPersonalityQuizUserParticipation(t,e,i);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 ae=class{facade=null;constructor(t){this.facade=new Kl(t)}getClassicQuizzes=async(t,e,i)=>await this.facade.getClassicQuizzes(t,e,i);getClassicQuizById=async(t,e,i)=>await this.facade.getClassicQuizById(t,e,i);participateInClassicQuiz=async(t,e,i)=>await this.facade.participateInClassicQuiz(t,e,i);getMyClassicQuizParticipations=async t=>await this.facade.getMyClassicQuizParticipations(t);getLeaderboardForClassicQuizzes=async(t,e)=>await this.facade.getLeaderboardForClassicQuizzes(t,e);getClassicQuizzesUserRanking=async(t,e,i)=>await this.facade.getClassicQuizzesUserRanking(t,e,i);getClassicQuizQuestionsReport=async(t,e)=>await this.facade.getClassicQuizQuestionsReport(t,e);getClassicQuizResultsSummary=async(t,e)=>await this.facade.getClassicQuizResultsSummary(t,e);getEitherOrs=async(t,e,i)=>await this.facade.getEitherOrs(t,e,i);getEitherOrById=async(t,e)=>await this.facade.getEitherOrById(t,e);getMyEitherOrStats=async t=>await this.facade.getMyEitherOrStats(t);getEitherOrResults=async(t,e)=>await this.facade.getEitherOrResults(t,e);participateInEitherOr=async(t,e,i)=>await this.facade.participateInEitherOr(t,e,i);calculateEitherOrResultPercentile=async(t,e)=>await this.facade.calculateEitherOrResultPercentile(t,e);getPersonalityQuizzes=async(t,e,i)=>await this.facade.getPersonalityQuizzes(t,e,i);getPersonalityQuizById=async(t,e)=>await this.facade.getPersonalityQuizById(t,e);participateInPersonalityQuiz=async(t,e)=>await this.facade.participateInPersonalityQuiz(t,e);getPersonalityQuizUserParticipation=async(t,e,i)=>await this.facade.getPersonalityQuizUserParticipation(t,e,i)};var re=class{idMapping=null;predictorHttps=null;predictorService=null;predictorValidator=null;clientHttps=null;errorHandlingMode=null;constructor(t){this.idMapping=new R(t),this.errorHandlingMode=t.errorHandlingMode,this.predictorValidator=new te(t.errorHandlingMode),this.predictorHttps=new mt(t),this.predictorService=new St(t,this.idMapping),this.clientHttps=new q(t)}getConfig=async()=>{let t=await this.clientHttps.getConfig("topX");return this.idMapping.idSchema!=="native"?await this.predictorService.remapCompetitionsFromConfig(t):t};getGames=async(t,e)=>{e=e||!1;let i=this.predictorService.initGameFilters("TOP_X",t),a=await this.predictorHttps.getGames(i,e);return await this.predictorService.remapMatchIdsFixtures(a)};getGamesNoRemap=async(t,e)=>{e=e||!1;let i=this.predictorService.initGameFilters("TOP_X",t);return await this.predictorHttps.getGamesNoRemap(i,e)};getGameById=async(t,e)=>{e=e||!1;let i=await this.predictorHttps.getGameById(t,e);return await this.predictorService.remapMatchIdsFixtures(i)};getGamePredictions=async(t,e,i)=>(i=i||!1,e&&(e.type&&delete e.type,e.status&&delete e.status,e=new V(e)),await this.predictorHttps.getGamePredictions(t,i,e));getGameResults=async(t,e,i)=>{i=i||!1,e&&(e=new nt(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 nt(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 ni(t);if(e=this.predictorValidator.validateBodyFields("TOP_X",e),e.fixtures=e.fixtures.map(a=>this.predictorValidator.validateFixture(a.matchId,a.market,a.prediction.value)),this.idMapping.idSchema!=="native"){let a=[];e.fixtures.forEach(o=>a.push(o.matchId));let r=await this.predictorService.remapMatchIdToNative(a);e.fixtures.forEach(o=>o.matchId=r.shift())}let i=await this.predictorHttps.makeFootballPrediction(e);return i.fixtures.forEach(a=>{a.matchId=a.matchModel.id}),i};delete=async t=>await this.predictorHttps.deleteFootballPrediction(t);getMyGameEditions=async(t,e)=>{t&&t.limit&&this.validateLimitFilterOnGames(t.limit),e=e||!1;let i=this.predictorService.initGameTypePredictions("TOP_X",t),a=[],r=await this.predictorHttps.getMyPredictionsNoRemap(i);if(r.data.length>0){r.data.forEach(p=>{p.game_instance_id&&a.push(p.game_instance_id)});let o=t?.limit?{limit:t.limit}:null,n=this.predictorService.initGameFilters("TOP_X",o,a),l=await this.predictorHttps.getUserGameEditions(n,e);return await this.predictorService.addPredictionProp(r,l)}else return new H};getMyGamePrediction=async t=>{let e=new V({gameIds:[t]}),i=await this.predictorHttps.getMyPredictions(e);if(i.data.length>0){let a=i.data.filter(r=>r.gameInstanceId===t);return a.length?a[0]:null}return null};getUserGameEditions=async(t,e,i)=>{e&&e.limit&&this.validateLimitFilterOnGames(e.limit),i=i||!1;let a=this.predictorService.initGameTypePredictions("TOP_X",e),r=[],o=await this.predictorHttps.getUserPredictionsNoRemap(t,a);if(o.data.length>0){o.data.forEach(c=>{c.game_instance_id&&r.push(c.game_instance_id)});let n=e?.limit?{limit:e.limit}:null,l=this.predictorService.initGameFilters("TOP_X",n,r),p=await this.predictorHttps.getUserGameEditions(l,i);return await this.predictorService.addPredictionProp(o,p)}else return new H};getUserGamePrediction=async(t,e,i)=>{i=i||!1;let a=new V({gameIds:[e]}),r=await this.predictorHttps.getUserPredictions(t,i,a);if(r.data.length>0){let o=r.data.filter(n=>n.gameInstanceId===e);return o.length?o[0]:null}else return null};getMarketsResultsForGame=async(t,e)=>{let i=await this.predictorHttps.getMarketResultsForGame(t,e);return await this.predictorService.completeGameMarketResults(i,"TOP_X")};getGameWinners=async(t,e)=>{let i=await this.predictorHttps.getContestWinners(t,e),a=await this.getGameById(t);return i.contestModel=a,this.predictorService.completeContestWinners(i)};validateLimitFilterOnGames=t=>{if(this.errorHandlingMode==="default"&&t>50)throw new y(400,"EXCEEDED_LENGTH","Maximum limit for filtering games is 50 or less.");if(this.errorHandlingMode==="standard"&&t>50)throw new h(400,"EXCEEDED_LENGTH","Maximum limit for filtering games is 50 or less.")}};var jl=class{idMappingService=null;profileNamespace=null;footballNamespace=null;topXFacade=null;matchQuizFacade=null;miniGamesNamespace=null;errorHandlingMode=null;constructor(t){this.idMappingService=new R(t),this.profileNamespace=new D(t),this.footballNamespace=new et(t),this.topXFacade=new re(t),this.matchQuizFacade=new ee(t),this.miniGamesNamespace=new ae(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 bo;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 Mo;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 _o(t));break;case"rankings":t&&(t=new Po(t));break;case"league_leaderboard":t&&(t=new wo(t))}return t};addProfileModelToHighestSuccessRate=async t=>{let e=t.map(a=>a.profileId);if(!e.length)return t;let i=await this.profileNamespace.getByIds(e);return t.map(a=>(i.forEach(r=>{r.id===a.profileId&&(delete r.interests,a.profileModel=r)}),a))};extractRankingsIdsMap=t=>{let e=[],i=[],a=[];return t.forEach(r=>{r.rankType==="GAME"&&r.gameType==="TOP_X"?e.push(r.id):r.rankType==="GAME"&&r.gameType==="MATCH_QUIZ"?i.push(r.id):r.rankType==="TEMPLATE"&&a.push(r.id)}),[e,i,a]};setModelsForUserRankings=(t,e,i,a)=>(a.data.forEach(r=>{r.gameType==="MATCH_QUIZ"&&e?r.model=e.filter(o=>o.id===r.id)[0]:r.gameType==="TOP_X"&&t?r.model=t.filter(o=>o.id===r.id)[0]:r.rankType==="TEMPLATE"&&i&&(r.model=i.filter(o=>o.id===r.id)[0])}),a);completeContestWinners=async t=>{if(t.userList&&t.userList.length){let e=t.userList.map(a=>a.profileId),i=await this.profileNamespace.getByIds(e);t.userList.forEach(a=>{let r=i.filter(o=>o.id===a.profileId)[0];delete r.interests,a.profileModel=r})}return t};validateEntitiesFollowsFilters=t=>{if(!t||(!t.footballCompetitions||!t.footballCompetitions.length)&&(!t.footballTeams||!t.footballTeams.length)&&(!t.footballPlayers||!t.footballPlayers.length))throw this.errorHandlingMode==="default"?new y(400,"invalid_filters","At least one of footballCompetitions, footballTeams or footballPlayers properties should be provided for filters."):new h(400,"invalid_filters","At least one of footballCompetitions, footballTeams or footballPlayers properties should be provided for filters.");if(t.footballCompetitions&&t.footballCompetitions.length>24||t.footballTeams&&t.footballTeams.length>24||t.footballPlayers&&t.footballPlayers.length>24)throw this.errorHandlingMode==="default"?new y(400,"EXCEEDED_LENGTH","Maximum length per entity should be 24 or less."):new h(400,"EXCEEDED_LENGTH","Maximum length per entity should be 24 or less.")};remapEntitiesFollowsFilters=async t=>{let e=JSON.parse(JSON.stringify(t)),i={},a={};e.footballCompetitions&&e.footballCompetitions.length&&(a.competition=e.footballCompetitions),e.footballTeams&&e.footballTeams.length&&(a.team=e.footballTeams),e.footballPlayers&&e.footballPlayers.length&&(a.player=e.footballPlayers);let r=await this.idMappingService.idMappingFacade.getEntitiesByIds(a,this.idMappingService.idSchema,"native");return Object.keys(r).forEach(o=>{o==="competition"?i.footballCompetitions=r[o]:o==="team"?i.footballTeams=r[o]:o==="player"&&(i.footballPlayers=r[o])}),i};addModelsToEntitiesFollows=async t=>{let e=[],i="fb:c:",a=new Map,r=[],o="fb:t:",n=new Map,l=[],p="fb:p:",c=null;return t.breakdown.forEach(u=>{u.id.includes(i)?e.push(u.id):u.id.includes(o)?r.push(u.id):u.id.includes(p)&&l.push(u.id)}),e.length&&(a=await this.footballNamespace.footballFacade.competitionsFacade.getCompetitionsMapWithNativeIds(e)),r.length&&(n=await this.footballNamespace.footballFacade.teamsFacade.getTeamsMapWithNativeIds(r)),l.length&&(c=await this.footballNamespace.footballFacade.playerFacade.getPlayersMapWithNativeIds(l)),t.breakdown.forEach(u=>{u.id.includes(i)?(u.model=a.get(u.id),u.id=u.model.id):u.id.includes(o)?(u.model=n.get(u.id),u.id=u.model.id):u.id.includes(p)&&(u.model=c[u.id],u.id=u.model.id)}),t};getMatchIdsFromGamesInTemplates=async(t,e)=>{if(t&&t.length>0){let o=qt(t,100),n=[];if(e&&e.length===1){if(e.includes("TOP_X"))try{n=(await Promise.all(o.map(c=>this.topXFacade.getGamesNoRemap({gameIds:c,limit:c.length},!0)))).reduce((c,u)=>[...c,...u.data],[])}catch(p){throw console.error("There was a problem fetching match IDs from Top X games",p),p}if(e.includes("MATCH_QUIZ"))try{n=(await Promise.all(o.map(c=>this.matchQuizFacade.getGamesNoRemap({gameIds:c,limit:c.length},!0)))).reduce((c,u)=>[...c,...u.data],[])}catch(p){throw console.error("There was a problem fetching match IDs from Match Quiz games",p),p}}try{n=(await Promise.all(o.map(c=>{let u=this.topXFacade.getGamesNoRemap({gameIds:c,limit:c.length},!0),d=this.matchQuizFacade.getGamesNoRemap({gameIds:c,limit:c.length},!0);return Promise.all([u,d])}))).reduce((c,[u,d])=>[...c,...u.data,...d.data],[])}catch(p){throw console.error("There was a problem fetching match IDs from both Top X and Match Quiz games",p),p}let l=new Set;return n.forEach(p=>{p.fixtures.map(u=>u.match_id).forEach(u=>l.add(u))}),Array.from(l)}let i=[],a=100;try{for(let o of e){let n=!0,l="",p=0;for(;n;){let c,u={limit:a,startAfter:l};o==="TOP_X"?(c=await this.topXFacade.getGamesNoRemap(u,!0),i=[...i,...c.data],l=c.meta.pagination.next_page_starts_after||null):o==="MATCH_QUIZ"&&(c=await this.matchQuizFacade.getGamesNoRemap(u,!0),i=[...i,...c.data],l=c.meta.pagination.next_page_starts_after||null),n=!!l,p++,p>=5&&(n=!1)}}let r=new Set;return i.forEach(o=>{o.fixtures.map(l=>l.match_id).forEach(l=>r.add(l))}),Array.from(r)}catch(r){throw console.error("There was a problem fetching match IDs from games",r),r}};initMatchFiltersForTemplates=async(t,e)=>{let i=[],a=[],r=[],o=t.fromDate?this.reformatDate(t.fromDate):null,n=t.toDate?this.reformatDate(t.toDate,!0):null,l=500;if(t.competitionIds&&t.competitionIds.length>0&&(i=Array.from(t.competitionIds)),t.teamIds&&t.teamIds.length>0&&(a=Array.from(t.teamIds)),t.matchIds&&t.matchIds.length>0&&(r=Array.from(t.matchIds)),this.isGameTemplate(t)&&(r=await this.getMatchIdsFromGamesInTemplates(t.gameIds,t.gameTypes)),e){let c=t.groups.find(d=>d.groupId===e);if(!c)throw this.errorHandlingMode==="default"?new y(400,"invalid_template_group_id","There is no group in this template with the provided groupId"):new h(400,"invalid_template_group_id","There is no group in this template with the provided groupId");if(!c.filters)throw this.errorHandlingMode==="default"?new y(400,"invalid_template_group_filters","The provided template group has no filters"):new h(400,"invalid_template_group_filters","The provided template group has no filters");o=c.filters.fromDate?this.reformatDate(c.filters.fromDate):null,n=c.filters.toDate?this.reformatDate(c.filters.toDate,!0):null;let u=c.filters.matchIds.every(d=>d);c.filters.matchIds.length>0&&u&&(r=Array.from(c.filters.matchIds))}return new gt({competitionIds:i,teamIds:a,matchIds:r,fromDate:o,toDate:n,limit:l})};isGameTemplate=t=>!!(t.gameIds&&t.gameIds.length>0||t.gameTypes&&t.gameTypes.length>0&&(t.gameTypes.includes("TOP_X")||t.gameTypes.includes("MATCH_QUIZ")));reformatDate=(t,e)=>{let i=new Date(t);e&&i.setUTCHours(23,59,59);let a=i.toISOString();return a=a.slice(0,-5)+"Z",a};extractEnabledBadgesId=t=>{let e=[];return t.forEach(i=>{i.enabled&&e.push(i.id)}),e};addEntityModelToFootballBadges=async t=>{let e=[],i=[],a=[],r=[];if(t.football&&t.football.length>0&&(e=t.football.filter(n=>n.requirements.entityType.toLocaleLowerCase()==="competition").map(n=>n.requirements.entityId),i=t.football.filter(n=>n.requirements.entityType.toLocaleLowerCase()==="team").map(n=>n.requirements.entityId),a=t.football.filter(n=>n.requirements.entityType.toLocaleLowerCase()==="player").map(n=>n.requirements.entityId),r=t.football.filter(n=>n.requirements.entityType.toLocaleLowerCase()==="match").map(n=>n.requirements.entityId)),t.voting&&t.voting.poll&&t.voting.poll.length>0){let[n,l,p,c]=this.extractEntityIdsFromBadges(t.voting.poll);e=e.concat(n),e=Array.from(new Set(e)),i=i.concat(l),i=Array.from(new Set(i)),a=a.concat(p),a=Array.from(new Set(a)),r=r.concat(c),r=Array.from(new Set(r))}if(t.voting&&t.voting.potm&&t.voting.potm.length>0){let[n,l,p,c]=this.extractEntityIdsFromBadges(t.voting.potm);e=e.concat(n),e=Array.from(new Set(e)),i=i.concat(l),i=Array.from(new Set(i)),a=a.concat(p),a=Array.from(new Set(a)),r=r.concat(c),r=Array.from(new Set(r))}let o=await this.fetchFootballEntities(e,i,a,r);t.football&&t.football.length>0&&t.football.forEach(n=>{this.setEntityModelsFromMap(n.requirements,"competition",o.competitions),this.setEntityModelsFromMap(n.requirements,"team",o.teams),this.setEntityModelsFromObject(n.requirements,"player",o.players),this.setEntityModelsFromObject(n.requirements,"match",o.matches)}),t.voting&&t.voting.poll&&t.voting.poll.length>0&&t.voting.poll.forEach(n=>{this.setEntityModelsFromMap(n.requirements,"competition",o.competitions),this.setEntityModelsFromMap(n.requirements,"team",o.teams),this.setEntityModelsFromObject(n.requirements,"player",o.players),this.setEntityModelsFromObject(n.requirements,"match",o.matches)}),t.voting&&t.voting.potm&&t.voting.potm.length>0&&t.voting.potm.forEach(n=>{this.setEntityModelsFromMap(n.requirements,"competition",o.competitions),this.setEntityModelsFromMap(n.requirements,"team",o.teams),this.setEntityModelsFromObject(n.requirements,"player",o.players),this.setEntityModelsFromObject(n.requirements,"match",o.matches)})};setEntityModelsFromMap=(t,e,i)=>{t.entityType===e&&(t.entityModel=i&&i.get(t.entityId)||null,t.entityModel&&(t.entityId=t.entityModel.id))};setEntityModelsFromObject=(t,e,i)=>{t.entityType===e&&(t.entityModel=i[t.entityId]?i[t.entityId]:null,t.entityModel&&(t.entityId=t.entityModel.id))};fetchFootballEntities=async(t,e,i,a)=>{let r={competitions:null,teams:null,players:null,matches:null};if(t.length){let o=await this.footballNamespace.footballFacade.getCompetitionsMapWithNativeIds(t);r.competitions=o}if(e.length){let o=await this.footballNamespace.footballFacade.getTeamsMapWithNativeIds(e);r.teams=o}if(i.length){let o=await this.footballNamespace.footballFacade.getPlayersMapWithNativeIds(i);r.players=o}if(a.length){let o=await this.footballNamespace.footballFacade.getMatchesMapWithNativeIds(a);r.matches=o}return r};extractEntityIdsFromBadges=t=>{let e=t.filter(o=>o.requirements.entityType&&o.requirements.entityType.toLocaleLowerCase()==="competition").map(o=>o.requirements.entityId),i=t.filter(o=>o.requirements.entityType&&o.requirements.entityType.toLocaleLowerCase()==="team").map(o=>o.requirements.entityId),a=t.filter(o=>o.requirements.entityType&&o.requirements.entityType.toLocaleLowerCase()==="player").map(o=>o.requirements.entityId),r=t.filter(o=>o.requirements.entityType&&o.requirements.entityType.toLocaleLowerCase()==="match").map(o=>o.requirements.entityId);return[e,i,a,r]};addGameModelToGamesBadges=async t=>{if(!t.games||t.games.length===0)return;let e=this.getGameIdsFromGamesBadge(t.games,"top_x"),i=this.getGameIdsFromGamesBadge(t.games,"match_quiz"),a=this.getGameIdsFromGamesBadge(t.games,"classic_quiz"),r=this.getGameIdsFromGamesBadge(t.games,"either_or"),o=await this.fetchGamesEntities(e,i,a,r);t.games.forEach(n=>{n.requirements.specificGames&&n.requirements.specificGames.forEach(l=>{l.gameModel=o.find(p=>p.id===l.gameId)||null})})};getGameIdsFromGamesBadge=(t,e)=>{let i=t.filter(a=>a.requirements.specificGames?a.requirements.specificGames.some(r=>r.gameType.toLocaleLowerCase()===e):!1).map(a=>a.requirements.specificGames.map(r=>r.gameId));return Array.prototype.concat.apply([],i)};fetchGamesEntities=async(t,e,i,a)=>{let r=[];if(t.length){let o=await this.topXFacade.getGames({gameIds:t});r=[...r,...o.data]}if(e.length){let o=await this.matchQuizFacade.getGames({gameIds:e});r=[...r,...o.data]}if(i.length){let o=await this.miniGamesNamespace.getClassicQuizzes({classicQuizIds:i});r=[...r,...o.data]}if(a.length){let o=await this.miniGamesNamespace.getEitherOrs({eitherOrIds:a});r=[...r,...o.data]}return r}};var Yl=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(at).includes(t)){let a=qp(t);throw e==="default"?new y(400,"INVALID_MARKET",a):new h(400,"INVALID_MARKET",a)}};validateDate=(t,e,i)=>{let a=/^\d{4}-\d{2}-\d{2}$/;if(typeof t!="string")throw i==="default"?new y(400,"invalid_filters","You have provided invalid type. The valid type is "+`string for ${e} filter`):new h(400,"invalid_filters","You have provided invalid type. The valid type is "+`string for ${e} filter`);if(!a.test(t))throw i==="default"?new y(400,"invalid_filters","You have provided invalid value. The valid value is "+`YYYY-MM-DD for ${e}`):new h(400,"invalid_filters","You have provided invalid value. The valid value is "+`YYYY-MM-DD for ${e}`)};validateNumberFilters=(t,e,i)=>{let a=e==="usersCount"?1:0,r=e==="usersCount"?1e3:1e6;if(typeof t!="number")throw i==="default"?new y(400,"invalid_filters","You have provided invalid type. The valid type is "+`number for ${e} filter`):new h(400,"invalid_filters","You have provided invalid type. The valid type is "+`number for ${e} filter`);if(t<a||t>r)throw i==="default"?new y(400,"invalid_filters","You have provided invalid value. The valid value is "+`between ${a} and ${r}`):new h(400,"invalid_filters","You have provided invalid value. The valid value is "+`between ${a} and ${r}`)}};var Xl=class{limit=null;page=null;groupId=null;constructor(t){this.limit=t?.limit||null,this.page=t?.page||null,t?.groupId!==void 0&&console.warn("Warning: groupId filter property is deprecated and no longer supported by the API. This property will be removed in a future version. Please update your code accordingly.")}constructFiltersUrl(){let t="";return this.limit&&(t+="&",t+=`limit=${this.limit}`),this.page&&(t+="&",t+=`page=${this.page}`),t}};var Jl=class{config=null;clientHttps=null;loyaltyHttps=null;loyaltyService=null;profileFacade=null;loyaltyValidator=null;topXFacade=null;matchQuizFacade=null;predictorHttps=null;errorHandlingMode=null;football=null;constructor(t,e,i,a,r){this.config=t,this.clientHttps=e,this.loyaltyHttps=i,this.profileFacade=new _t(r,a),this.loyaltyService=new jl(this.config),this.loyaltyValidator=new Yl,this.topXFacade=new re(t),this.matchQuizFacade=new ee(t),this.predictorHttps=new mt(t),this.errorHandlingMode=t.errorHandlingMode,this.football=new et(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 To(t)),this.config.idSchema==="native")return await this.loyaltyHttps.getTemplates(t,e);let i=await this.loyaltyHttps.getTemplates(t,e);i.data=await this.loyaltyService.remapTemplatesIds([...i.data]);for(let a of i.data)await this.loyaltyService.remapTemplateGroupMatchIds(a.groups);return i};getTemplateById=async(t,e)=>{let i=await this.loyaltyHttps.getTemplateById(t,e);if(this.config.idSchema==="native")return i;let a=await this.loyaltyService.remapTemplatesIds([i]);return await this.loyaltyService.remapTemplateGroupMatchIds(a[0].groups),a[0]};getLeaderboard=async(t,e,i)=>{e=this.loyaltyService.initFilters(e,"loyalty");let a=await this.loyaltyHttps.getLeaderboard(t,i,e);return a.data=await this.loyaltyService.addProfileModelToLeaderboard(a.data),a};getLeaderboardForGame=async(t,e,i)=>{e&&(e=new Xl(e));let a=await this.loyaltyHttps.getLeaderboardForGame(t,i,e);return a.data=await this.loyaltyService.addProfileModelToLeaderboard(a.data),a};getLeaderboardForLeague=async(t,e)=>{e=this.loyaltyService.initFilters(e,"league_leaderboard");let i=await this.loyaltyHttps.getLeaderboardForLeague(t,e);return i.data=await this.loyaltyService.addProfileModelToLeaderboard(i.data),i};getOwnRankings=async(t,e)=>{let{id:i}=await this.profileFacade.getOwn();return this.getUserRankings(i,t,e)};getUserRankings=async(t,e,i)=>{e=this.loyaltyService.initFilters(e,"rankings");let a=await this.loyaltyHttps.getUserRankings(t,e,i);return await this.getModelsForUserRankings(a)};getHighestSuccessRate=async(t,e)=>{t&&(t=new Io(t),this.loyaltyValidator.validate(t,this.errorHandlingMode));let i=await this.loyaltyHttps.getHighestSuccessRate(t,e);return this.loyaltyService.addProfileModelToHighestSuccessRate(i)};getTemplateWinners=async(t,e)=>{let i=await this.predictorHttps.getContestWinners(t,e),a=await this.getTemplateById(t);return i.contestModel=a,this.loyaltyService.completeContestWinners(i)};getEntitiesFollows=async(t,e)=>{this.loyaltyService.validateEntitiesFollowsFilters(t),this.config.idSchema!=="native"&&(t=await this.loyaltyService.remapEntitiesFollowsFilters(t));let i=await this.loyaltyHttps.getEntitiesFollows(t,e);return await this.loyaltyService.addModelsToEntitiesFollows(i)};getModelsForUserRankings=async t=>{let e=null,i=null,a=null,[r,o,n]=this.loyaltyService.extractRankingsIdsMap(t.data);if(n.length&&(e=(await this.getTemplates()).data.filter(p=>n.includes(p.id))),r.length){let l={gameIds:r};i=(await this.topXFacade.getGames(l)).data}if(o.length){let l={gameIds:o};a=(await this.matchQuizFacade.getGames(l)).data}return this.loyaltyService.setModelsForUserRankings(i,a,e,t)};getTemplateMatches=async(t,e,i)=>{let a=await this.getTemplateById(t,i);if((!a.competitionIds||a.competitionIds.length===0)&&(!a.teamIds||a.teamIds.length===0)&&(!a.matchIds||a.matchIds.length===0)&&(!a.gameIds||a.gameIds.length===0)&&(!a.gameTypes||a.gameTypes.length===0)&&(!a.groups||a.groups.length===0))return[];let r=await this.loyaltyService.initMatchFiltersForTemplates(a,e);return(await this.football.getMatches(r,i)).data}};var oe=class{clientHttps=null;profileHttps=null;loyaltyHttps=null;loyaltyFacade=null;localCache=null;constructor(t){this.clientHttps=new q(t),this.profileHttps=new Mi(t),this.loyaltyHttps=new Rt(t),this.localCache=new ct().createLocalCacheInstance(t.idSchema),this.loyaltyFacade=new Jl(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 Zl=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 te(t.errorHandlingMode),this.predictorService=new St(t,a)}makeFootballPrediction=async(t,e,i,a)=>{let r=this.predictorValidator.validateFixture(t,e,i,a),o=new ei;if(this.idMapping.idSchema!=="native"){let n=r.matchId,l="",p=await this.predictorService.remapMatchIdToNative([n]);if(r.matchId=p[0],this.errorHandlingMode==="default"&&!r.matchId)throw new y(400,"INVALID_FIELD","Match id is invalid!").errorMessage();if(this.errorHandlingMode==="standard"&&!r.matchId)throw new h(400,"INVALID_FIELD","Match id is invalid!");if(r instanceof st&&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 y(400,"INVALID_FIELD","Player id is invalid!").errorMessage();if(this.errorHandlingMode==="standard"&&r.market!==Ki&&!r.prediction.playerId)throw new h(400,"INVALID_FIELD","Player id is invalid!")}o.fixtures=[r];let c=await this.predictorHttps.makeFootballPrediction(o);return c.fixtures.forEach(u=>{u.prediction.playerId&&u.prediction.playerId!=="OWN_GOAL"&&(u.prediction.playerId=l),u.matchId=n}),c}else return o.fixtures=[r],await this.predictorHttps.makeFootballPrediction(o)};getMatchSummary=async(t,e)=>{let i=await this.getMatchSummaryBase(t,e),a=JSON.parse(JSON.stringify(i.predictions)),r=await this.predictorService.remapPlayerIdToIdSchema(a);return i.predictions=r,i};getMarketSummary=async(t,e,i,a)=>{try{let r=await this.getMatchSummaryBase(t,a);return await this.predictorService.getMarketSummary(r,e,i)}catch(r){throw r}};getMatchSummaryBase=async(t,e)=>{if(this.idMapping.idSchema!=="native"){let a=(await this.predictorService.remapMatchIdToNative([t]))[0],r=await this.predictorHttps.getMatchSummary(a,e);return r.matchId=t,r}else return await this.predictorHttps.getMatchSummary(t,e)};getConfig=async()=>{let t=await this.clientHttps.getConfig("predictor");return this.idMapping.idSchema!=="native"?await this.predictorService.remapCompetitionsFromConfig(t):t};deleteFootballPrediction=async t=>await this.predictorHttps.deleteFootballPrediction(t);getMyPredictions=async t=>{let e=this.predictorService.initPredictionsFilters(t,"user");return await this.predictorHttps.getMyPredictions(e)};getMyPredictionsForMatches=async(t,e)=>{if(this.errorHandlingMode==="default"&&this.predictorService.areIdsExceeded(t))throw new y(400,"EXCEEDED_LENGTH","Maximum matchIds in PredictionFilters should be 10 or less.").errorMessage();if(this.errorHandlingMode==="standard"&&this.predictorService.areIdsExceeded(t))throw new h(400,"EXCEEDED_LENGTH","Maximum matchIds in PredictionFilters should be 10 or less.");this.idMapping.idSchema!=="native"&&(t=await this.predictorService.remapMatchIdToNative([...t]));let i=this.predictorService.initPredictionsFilters(e,"matches",t);return await this.predictorHttps.getMyPredictions(i)};getMyCurrentPredictions=async t=>{let e=this.predictorService.initPredictionsFilters(t,"current");return await this.predictorHttps.getMyPredictions(e)};getMyPastPredictions=async t=>{let e=this.predictorService.initPredictionsFilters(t,"past");return await this.predictorHttps.getMyPredictions(e)};getUserPredictions=async(t,e,i)=>{let a=this.predictorService.initPredictionsFilters(e,"user");return await this.predictorHttps.getUserPredictions(t,i,a)};getUserCurrentPredictions=async(t,e,i)=>{let a=this.predictorService.initPredictionsFilters(e,"current");return await this.predictorHttps.getUserPredictions(t,i,a)};getUserPastPredictions=async(t,e,i)=>{let a=this.predictorService.initPredictionsFilters(e,"past");return await this.predictorHttps.getUserPredictions(t,i,a)};getUserPredictionsForMatches=async(t,e,i,a)=>{if(this.errorHandlingMode==="default"&&this.predictorService.areIdsExceeded(e))throw new y(400,"EXCEEDED_LENGTH","Maximum matchIds in PredictionFilters should be 10 or less.").errorMessage();if(this.errorHandlingMode==="standard"&&this.predictorService.areIdsExceeded(e))throw new h(400,"EXCEEDED_LENGTH","Maximum matchIds in PredictionFilters should be 10 or less.");this.idMapping.idSchema!=="native"&&(e=await this.predictorService.remapMatchIdToNative([...e]));let r=this.predictorService.initPredictionsFilters(i,"matches",e);return await this.predictorHttps.getUserPredictions(t,a,r)};getPredictionById=async t=>await this.predictorHttps.getPredictionById(t);getPredictionsByIds=async t=>await this.predictorHttps.getPredictionsByIds(t);getMatchMarketsResults=async t=>(this.idMapping.idSchema!=="native"&&(t=(await this.predictorService.remapMatchIdToNative([t]))[0]),await this.predictorService.getMatchMarketsResults(t))};var tp=class extends K{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 ep=class{validator=null;constructor(t){this.validator=new tp(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,M]=p.split(":").map(Number);d>M?o+=u:d===M?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 Ni=class{predictorHttps=null;clientHttps=null;predictorFacade=null;idMapping=null;helpers=null;constructor(t){this.idMapping=new R(t),this.predictorHttps=new mt(t),this.clientHttps=new q(t),this.predictorFacade=new Zl(t,this.predictorHttps,this.clientHttps,this.idMapping),this.helpers=new ep(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 ki=class{loyalty=null;profile=null;predictor=null;constructor(t){this.loyalty=new oe(t),this.profile=new D(t),this.predictor=new Ni(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 se=class{idSchema=null;profile=null;validator=null;idMapping=null;constructor(t){this.idSchema=t.idSchema,this.profile=new D(t),this.validator=new ie(t),this.idMapping=new R(t)}finalizePostFullModel=async t=>{let e=t.map(a=>a.userId),i=await this.profile.getByIds(e);return t.map(a=>(a.userModel=this.extractModelById(i,a.userId),a))};finalizeTopDiscussionsFilters=async t=>{if(this.idSchema!=="native"&&t.entityIds&&t.entityIds.length>0){this.validator.validateFilters(t);let e=await this.idMapping.getEntityIdsBySchemaId(Array.from(t.entityIds),t.entityType,"native");t.entityIds=e[t.entityType]}};extractModelById=(t,e)=>{if(t.length){let i=t.find(a=>a.id===e);return i?(delete i.interests,i):null}return null}};var ip=class{factory=null;https=null;loyaltyHttps=null;profile=null;service=null;discussionsService=null;constructor(t){this.factory=new Li,this.https=new xi(t),this.service=new ki(t),this.loyaltyHttps=new Rt(t),this.profile=new D(t),this.discussionsService=new se(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 Mr(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 br(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 ai(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 ri(e));let i=await this.https.getReportedPosts(t,e);return i.data=await this.discussionsService.finalizePostFullModel(i.data),i};getPredictions=async(t,e)=>{if(e){if(e.limit&&e.limit>20)throw new h(400,"invalid_limit","Invalid limit. The maximum limit is: "+20 .toString());e=new oi(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 ap=class{facade=null;constructor(t){this.facade=new ip(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 rp=class extends v{remapper=null;constructor(t){super(t,O(t.environment,"discussions")),this.remapper=new Oi}getAll=async(t,e)=>{let i="/discussions"+this.apiSignInUrl;t&&(i+=`${t.constructMainFiltersUrl()}`),f(e)&&(i+=m());let a="There was a problem getting discussions",r=await this.fetchWithoutAuth(i,a);return this.remapper.remapToDiscussions(r)};getById=async t=>{let e=`/discussions/${t}`+this.apiSignInUrl,i="There was a problem getting discussion",a=await this.fetchWithoutAuth(e,i);return this.remapper.remapToDiscussionById(a.data)};createPost=async(t,e)=>{let i=`/discussions/${t}/posts`+this.apiSignInUrl,a="There was a problem creating post in discussion",r="POST",o=await this.fetchWithAuth(i,a,r,e);return this.remapper.remapToPostByIdBasic(o.data)};getPostById=async t=>{let e=`/posts/${t}`+this.apiSignInUrl,i="There was a problem getting post by ID in discussion",a=await this.fetchWithoutAuth(e,i);return this.remapper.remapToPostByIdFull(a.data)};updatePost=async(t,e)=>{let i=`/posts/${t}`+this.apiSignInUrl,a="There was a problem editing post in discussion",r="PUT",o={content:e},n=await this.fetchWithAuth(i,a,r,o);return this.remapper.remapToPostByIdBasic(n.data)};reactToPost=async(t,e)=>{let i=`/posts/${t}/reaction`+this.apiSignInUrl,a="There was a problem reacting to post in discussion",r="PUT",o={reaction:e.toLocaleLowerCase()},n=await this.fetchWithAuth(i,a,r,o);return this.remapper.remapToPostByIdFull(n.data)};deletePost=async t=>{let e=`/posts/${t}`+this.apiSignInUrl,i="There was a problem deleting post in discussion",a="DELETE";return await this.fetchWithAuth(e,i,a),!0};getPosts=async(t,e)=>{let i=`/discussions/${t}/posts`+this.apiSignInUrl;e&&(i+=`${e.constructMainFiltersUrl()}`);let a="There was a problem getting posts in discussion",r=await this.fetchWithoutAuth(i,a);return this.remapper.remapToPostsForDiscussion(r,"full")};getPostReplies=async(t,e)=>{let i=`/posts/${t}/replies`+this.apiSignInUrl;e&&(i+=`${e.constructMainFiltersUrl()}`);let a="There was a problem getting post's replies in discussion",r=await this.fetchWithoutAuth(i,a);return this.remapper.remapToPostsForDiscussion(r,"full")};reportPost=async(t,e,i)=>{let a=`/posts/${t}/report`+this.apiSignInUrl,r="There was a problem reporting post in discussion",o="POST",n={reason:e.toLocaleUpperCase(),reason_details:i||null},l=await this.fetchWithAuth(a,r,o,n);return this.remapper.remapToPostByIdBasic(l.data)};getOwnPosts=async t=>{let e="/posts"+this.apiSignInUrl;t&&(e+=`${t.constructMainFiltersUrl()}`);let i="There was a problem getting own posts",a=await this.fetchWithAuth(e,i);return this.remapper.remapToPosts(a)};getUserPosts=async(t,e,i)=>{let a=`/posts/users/${t}`+this.apiSignInUrl;e&&(a+=`${e.constructMainFiltersUrl()}`),f(i)&&(a+=m());let r="There was a problem getting user's posts",o=await this.fetchWithoutAuth(a,r);return this.remapper.remapToPosts(o)};getPostsCount=async(t,e)=>{let i="/discussions/posts/count"+this.apiSignInUrl+`&discussion_ids=${t.join(",")}`;f(e)&&(i+=m());let a="There was a problem getting posts count for discussions",r=await this.fetchWithoutAuth(i,a);return this.remapper.remapToPostCount(r.data)};getTopDiscussions=async(t,e)=>{let i="/discussions/top"+this.apiSignInUrl;t&&(i+=`${t.constructMainFiltersUrl()}`),f(e)&&(i+=m());let a="There was a problem getting top discussions",r=await this.fetchWithoutAuth(i,a);return this.remapper.remapToDiscussions(r)};getPostsCountExtended=async t=>{let e="/discussions/posts/count"+this.apiSignInUrl,i={discussion_ids:Array.from(t)},a="POST",r="There was a problem getting posts count extended for discussions",o=await this.fetchWithoutAuth(e,r,a,i);return this.remapper.remapToPostCount(o.data)}};var op=class{createRequestBodyFromParam=t=>{let e=new Pr;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 sp=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 rp(t),this.clientHttps=new q(t),this.activityService=new wt(t),this.service=new se(t),this.factory=new op}getAll=async(t,e)=>{t&&(t=new Ar(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 jt(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 jt(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 jt(t)),await this.https.getOwnPosts(t));getUserPosts=async(t,e,i)=>(e&&(e=new jt(e)),await this.https.getUserPosts(t,e,i));getConfig=async()=>await this.clientHttps.getConfig("discussions");getPostsCount=async(t,e)=>{if(!t||!Array.isArray(t)||!t.length)throw this.errorHandlingMode==="standard"?new h(400,"invalid_discussion_ids","Invalid discussion ids argument. Please provide at least one discussion id in an array"):new y(400,"invalid_discussion_ids","Invalid discussion ids argument. Please provide at least one discussion id in an array");if(t.length>this.LIMIT_POSTS_COUNT)throw this.errorHandlingMode==="standard"?new h(400,"invalid_discussion_ids","Maximum number of discussion ids exceeded. The maximum number of discussion ids is 50. You can use 'getPostsCountExtended' method for more than 50 discussion ids."):new y(400,"invalid_discussion_ids","Maximum number of discussion ids exceeded. The maximum number of discussion ids is 50. You can use 'getPostsCountExtended' method for more than 50 discussion ids.");return await this.https.getPostsCount(t,e)};getTopDiscussions=async(t,e)=>{t&&(t=new Or(t),await this.service.finalizeTopDiscussionsFilters(t));let i=await this.https.getTopDiscussions(t,e);for(let a of i.data)await this.remapTags(a,"native",this.idSchema);return i};getPostsCountExtended=async t=>{if(!t||!Array.isArray(t)||!t.length)throw this.errorHandlingMode==="standard"?new h(400,"invalid_discussion_ids","Invalid discussion ids argument. Please provide at least one discussion id in an array"):new y(400,"invalid_discussion_ids","Invalid discussion ids argument. Please provide at least one discussion id in an array");if(t.length>this.LIMIT_POSTS_COUNT_EXTENDED)throw this.errorHandlingMode==="standard"?new h(400,"invalid_discussion_ids","Maximum number of discussion ids exceeded. The maximum number of discussion ids is: "+this.LIMIT_POSTS_COUNT_EXTENDED):new y(400,"invalid_discussion_ids","Maximum number of discussion ids exceeded. The maximum number of discussion ids is: "+this.LIMIT_POSTS_COUNT_EXTENDED);return await this.https.getPostsCountExtended(t)};remapTags=async(t,e,i)=>{if(this.idSchema!="native"&&t.context&&t.context.tags&&t.context.tags.length){let a=JSON.parse(JSON.stringify(t.context.tags)),r=await this.activityService.remapTagsIds(a,e,i);t.context.tags=r}}};var np=class{facade=null;constructor(t){this.facade=new sp(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 lp=class extends K{constructor(t){super(t)}validatePrediction=t=>{(!t.fixtures||!Array.isArray(t.fixtures)||t.fixtures.length===0)&&this.throwException(400,"invalid_method_call","Fixtures field is required and should contain at least one fixtures object. For more information please visit our documentation");let e=["id","predictionType","prediction"];for(let i of t.fixtures)(Object.keys(i).length!==e.length||Object.keys(i).some(a=>!e.includes(a)))&&this.throwException(400,"invalid_method_call","Fixtures field is invalid. For more information please visit our documentation"),this.validatePredictionType(i.predictionType,i.prediction);t.tiebreaker&&(!t.tiebreaker.statTotal||!Number.isInteger(t.tiebreaker.statTotal))&&this.throwException(400,"invalid_method_call","Tiebreaker field is invalid. It should contain statTotal key with integer value. For more information please visit our documentation")};validatePredictionType=(t,e)=>{switch(t){case"BOOLEAN":typeof e!="boolean"&&this.throwException(400,"invalid_method_call",`Prediction must be a boolean for prediction type ${t}`);break;case"NUMBER":(typeof e!="number"||!Number.isFinite(e))&&this.throwException(400,"invalid_method_call",`Prediction must be a number for prediction type ${t}`);break;case"ENUM":case"FREE_INPUT":(typeof e!="string"||e.trim()==="")&&this.throwException(400,"invalid_method_call",`Prediction must be a non-empty string for prediction type ${t}`);break;default:this.throwException(400,"invalid_method_call",`Unknown prediction type: ${t}`)}}};var pp=class{https=null;validator=null;profile=null;constructor(t){this.https=new Kt(t),this.profile=new D(t),this.validator=new lp(t.errorHandlingMode)}getGames=async(t,e)=>(t&&(t=new xr(t)),await this.https.getEventGames(t,e));getGameById=async(t,e)=>await this.https.getEventGameById(t,e);makePrediction=async(t,e)=>(this.validator.validatePrediction(e),await this.https.makeEventGamePrediction(t,e));updatePrediction=async(t,e,i)=>(this.validator.validatePrediction(i),await this.https.updateEventGamePrediction(t,e,i));getGamePredictionsForUser=async(t,e,i,a)=>{i&&(i=new Lr(i));let r=await this.https.getEventGamePredictionsForUser(t,e,i,a),o=null;try{o=await this.profile.getById(e).getInfo()}catch(n){console.error(n)}return r.data.forEach(n=>{n.profileModel=o}),r};getRankings=async(t,e,i)=>{e&&(e=new Dr(e));let a=await this.https.getEventGameRankings(t,e,i),r=a.data.map(n=>n.profileId),o=[];return r.length>0&&(o=await this.profile.getByIds(r),a.data=a.data.map(n=>(n.profileModel=o.find(l=>l.id===n.profileId)||null,n))),a}};var cp=class{facade=null;constructor(t){this.facade=new pp(t)}getGames=async(t,e)=>await this.facade.getGames(t,e);getGameById=async(t,e)=>await this.facade.getGameById(t,e);makePrediction=async(t,e)=>await this.facade.makePrediction(t,e);updatePrediction=async(t,e,i)=>await this.facade.updatePrediction(t,e,i);getGamePredictionsForUser=async(t,e,i,a)=>await this.facade.getGamePredictionsForUser(t,e,i,a);getRankings=async(t,e,i)=>await this.facade.getRankings(t,e,i)};var _d=["minutesPlayed","cleanSheets","concededGoals","saves","penaltySaved","penaltyCommitted","yellowCards","redCards","assists","foulsCommitted","ownGoals","goals","tackles","shotsOn"],Pd=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"),Gi=class{static createFantasyPrediction(t,e,i,a){let r=new ke;return r.template_id=t||null,r.group_id=e||null,r.fixtures=i?.map(o=>({player_id:o,match_type:"FOOTBALL",market:"PLAYER_PERFORMANCE",role:a?.get(o)?.toLocaleUpperCase()||null}))||[],r}static createFantasyPlayerStats(t){return _d.map(e=>{let i=new Gr,a=t.data.reduce((r,o)=>r+o.stats[e],0);return i.key=e,i.label=Pd.get(e),i.value=a,i})}};var up=class{idMapping=null;idSchema=null;errorHandlingModel=null;football=null;constructor(t){this.idSchema=t.idSchema,this.errorHandlingModel=t.errorHandlingMode,this.football=new et(t),this.idMapping=new R(t)}remapCompetitions=async t=>{let e={competition:t};return(await this.idMapping.idMappingFacade.getEntitiesByIds(e,"native",this.idSchema)).competition};remapPlayers=async(t,e,i,a)=>{let r={player:Array.from(t)},o=await this.idMapping.idMappingFacade.getEntitiesByIdsMap(r,e,i);if(a){let n=new Map;for(let[l,p]of Array.from(a.entries())){let c=o.get(l);c&&n.set(c,p)}a.clear();for(let[l,p]of Array.from(n.entries()))a.set(l,p)}return Array.from(o.values())};addPlayerModels=async t=>{let e=t.map(a=>a.playerId),i=await this.football.footballFacade.getPlayersMapWithNativeIds(e);return t.forEach(a=>{a.playerModel=Object.keys(i).length&&i[a.playerId]||null,a.playerId=a.playerModel?.id||a.playerId}),t};remapPlayerIdToNative=async t=>{let e=await this.idMapping.getEntityIdBySchemaId("player",t);if(e)return e.id;this.throwException(404,"id_mapping_not_found","No ID mappings are available for the provided ID. ID argument: "+t)};addMatchModels=async t=>{let e=t.map(a=>a.matchId),i=await this.football.footballFacade.getMatchesMapWithNativeIds(e);return t.forEach(a=>{a.matchModel=Object.keys(i).length&&i[a.matchId]||null,a.matchId=a.matchModel?.id||a.matchId}),t};throwException=(t,e,i)=>{throw this.errorHandlingModel==="standard"?new h(t,e,i):new y(t,e,i)}};var dp=class{idSchema=null;clientHttps=null;footballHttps=null;predictorHttps=null;loyaltyHttps=null;service=null;constructor(t){this.idSchema=t.idSchema,this.clientHttps=new q(t),this.footballHttps=new dt(t),this.service=new up(t),this.predictorHttps=new mt(t),this.loyaltyHttps=new Rt(t)}getConfig=async()=>{let t=await this.clientHttps.getConfig("fantasy");return this.idSchema!=="native"&&(t.competitionsWhitelist=await this.service.remapCompetitions([...t.competitionsWhitelist])),t};getPlayersPoints=async(t,e,i)=>{let a=await this.footballHttps.getPlayersPoints(t,e,i);return a.data=await this.service.addPlayerModels(a.data),a};getPlayerDetailedStatistics=async(t,e,i)=>{let a="";this.idSchema!=="native"&&(a=await this.service.remapPlayerIdToNative(e));let r=await this.footballHttps.getPlayerDetailedStatistics(t,a||e,i);return r.meta.filters.playerId=e,r.data=await this.service.addMatchModels(r.data),r};play=async(t,e,i,a)=>{if((!i||!Array.isArray(i))&&this.service.throwException(400,"invalid_method_call","Invalid parameter provided. Please check the following parameter: "+"playerIds"),a){let o="playersRoles";a instanceof Map||this.service.throwException(400,"invalid_method_call","Invalid parameter provided. Please check the following parameter: "+o);let n=Array.from(a.keys());n.length||this.service.throwException(400,"invalid_method_call","Invalid parameter provided. Please check the following parameter: "+o),n.every(u=>!i.includes(u))&&this.service.throwException(400,"invalid_method_call","The keys in the players roles map are not part of the valid keys. The valid keys are: "+i.join(","));let p=Array.from(a.values()),c=["CAPTAIN","VICE_CAPTAIN"];p.every(u=>c.includes(u.toLocaleUpperCase()))||this.service.throwException(400,"invalid_method_call","The values in the map are not valid. The valid ones are: "+c.join(",")+". Case insensitive.")}let r=null;if(this.idSchema!=="native"){let o=await this.service.remapPlayers(i,this.idSchema,"native",a);r=Gi.createFantasyPrediction(t,e,o,a)}else r=Gi.createFantasyPrediction(t,e,i,a);return await this.predictorHttps.makeFootballPrediction(r)};getMyPrediction=async(t,e)=>{let i=`${t}_${e}`,a=new V(null);a.gameIds=[i];let r=await this.predictorHttps.getMyPredictions(a);return r.data.length===0?null:r.data[0]};getPlayerStatistics=async(t,e,i)=>{let a=await this.getPlayerDetailedStatistics(t,e,i);return Gi.createFantasyPlayerStats(a)};getGameWeekStatistics=async t=>await this.loyaltyHttps.getTemplateBreakdownPoints(t)};var mp=class{facade=null;constructor(t){this.facade=new dp(t)}getConfig=async()=>await this.facade.getConfig();getPlayersPoints=async(t,e,i)=>await this.facade.getPlayersPoints(t,e,i);getPlayerDetailedStatistics=async(t,e,i)=>await this.facade.getPlayerDetailedStatistics(t,e,i);play=async(t,e,i,a)=>await this.facade.play(t,e,i,a);getMyPrediction=async(t,e)=>await this.facade.getMyPrediction(t,e);getPlayerStatistics=async(t,e,i)=>await this.facade.getPlayerStatistics(t,e,i);getGameWeekStatistics=async t=>await this.facade.getGameWeekStatistics(t)};var hp=class{configuration;constructor(t){this.configuration=t}getSDKConfiguration(){return this.configuration}};var fp=class{remapToResponseModel=(t,e,i)=>{let a=new go;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 gp=class{errorHandlingModel=null;constructor(t){this.errorHandlingModel=t.errorHandlingMode}validate=(t,e,i)=>{(!t||!Array.isArray(t)||t.length===0)&&this.throwException(400,"invalid_ids","Invalid or empty IDs provided. Please provide at least one ID."),(!e||e!=="native"&&e!=="enetpulse"&&e!=="sportal365"&&e!=="sportradar"&&e!=="api_football")&&this.throwException(400,"invalid_input_provider","Invalid provider. The valid providers are: 'native', 'enetpulse', 'sportal365', 'sportradar' and 'api_football'."),(!i||i!=="native"&&i!=="enetpulse"&&i!=="sportal365"&&i!=="sportradar"&&i!=="api_football")&&this.throwException(400,"invalid_output_provider","Invalid provider. The valid providers are: 'native', 'enetpulse', 'sportal365', 'sportradar' and 'api_football'."),e===i&&this.throwException(400,"invalid_output_provider","Invalid output provider. The output can not be the same as the input provider.")};throwException=(t,e,i)=>{throw this.errorHandlingModel==="standard"?new h(t,e,i):new y(t,e,i)}};var yp=class{validator=null;idMappingFacade=null;factory=new fp;constructor(t){this.validator=new gp(t),this.idMappingFacade=new yi(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 bp=class{facade=null;constructor(t){this.facade=new yp(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 Mp=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 Ui=class{matchQuizFacade=null;helpers=new Mp;constructor(t){this.matchQuizFacade=new ee(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 Ip=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 Vi=class{topXFacade=null;helpers=new Ip;constructor(t){this.topXFacade=new re(t)}getConfig=async()=>await this.topXFacade.getConfig();getGames=async(t,e)=>await this.topXFacade.getGames(t,e);getGameById=async(t,e)=>await this.topXFacade.getGameById(t,e);getGamePredictions=async(t,e,i)=>await this.topXFacade.getGamePredictions(t,e,i);getGameResults=async(t,e,i)=>await this.topXFacade.getGameResults(t,e,i);getCurrentGameResults=async t=>await this.topXFacade.getCurrentGameResults(t);play=async t=>await this.topXFacade.play(t);delete=async t=>await this.topXFacade.delete(t);getMyGameEditions=async(t,e)=>await this.topXFacade.getMyGameEditions(t,e);getMyGamePrediction=async t=>await this.topXFacade.getMyGamePrediction(t);getUserGameEditions=async(t,e,i)=>await this.topXFacade.getUserGameEditions(t,e,i);getUserGamePrediction=async(t,e,i)=>await this.topXFacade.getUserGamePrediction(t,e,i);getMarketsResultsForGame=async(t,e)=>await this.topXFacade.getMarketsResultsForGame(t,e);getGameWinners=async(t,e)=>await this.topXFacade.getGameWinners(t,e)};var wp=class{remapUserVotes=t=>{let e=new gn;return e.meta=this.remapMeta(t.meta.pagination),e.data=t.data.map(i=>this.remapUserVoteModel(i)),e};remapResults=t=>{let e=new Mn;return e.meta=t.meta,e.data=t.data.map(i=>this.remapResultsModel(i)),e};remapMeta=t=>{let e=new b;return e.pagination.itemsPerPage=t.items_per_page,e.pagination.nextPageStartsAfter=t.next_page_starts_after,e};remapUserVoteModel=t=>{let e=new yn;return e.matchId=t.match_id,e.playerId=t.player_id,e.createdAt=t.created_at,e};remapResultsModel=t=>{let e=new In;return e.teamId=t.team_id,e.playerId=t.player_id,e.votes=t.votes,e.winner=t.winner,e}};var _p=class{id=null;pollId=null;optionIds=[];optionsModels=[];userId=null;createdAt=null};var Pp=class extends tt{remapPolls=t=>{let e=new mn;return e.meta.pagination=this.remapMetaPagination(t.meta.pagination),e.data=t.data.map(i=>this.remapPoll(i)),e};remapPollById=t=>{let e=new pn;return e.id=t.id,e.title=t.title,e.alternativeTitle=t.alternative_title,e.description=t.description,e.type=t.type,e.images=t.images,e.status=t.status,e.language=t.language,e.authRequirement=t.auth_requirement,e.flags=t.flags,e.totalVotes=t.total_votes,e.customFields=t.custom_fields,e.related=t.related?this.remapRelated(t.related):[],e.branding=t.branding?this.remapBranding(t.branding):null,e.embedCode=t.embed_code,e.labels=t.labels,e.rules=t.rules,e.adContent=t.ad_content,e.options=t.options?this.remapOptions(t.options):[],e.context=t.context?this.remapContext(t.context):t.context,e.preferencesEnabled=t.preferences_enabled,e.multipleChoice=t.multiple_choice,e.maxMultipleChoiceOptions=t.max_multiple_choice_options,e.participationCount=t.participation_count,e.maxAttempts=t.max_attempts,e.externalActivity=t.external_activity,e.createdAt=t.created_at,e.updatedAt=t.updated_at,e};remapUserVote=t=>{let e=new dn;return e.id=t.id,e.pollId=t.poll_id,e.optionId=t.option_id,e.optionIds=t.option_ids,e.userId=t.user_id,e.attempts=t.attempts||null,e.previousVotes=t.previous_votes?t.previous_votes.map(i=>this.remapPreviousVotes(i)):[],e.createdAt=t.created_at,e};remapPreviousVotes=t=>{let e=new _p;return e.id=t.id,e.pollId=t.poll_id,e.optionIds=t.option_ids,e.userId=t.user_id,e.createdAt=t.created_at,e};remapPollsVotes=t=>{let e=new hn;return e.meta.pagination=this.remapMetaPagination(t.meta.pagination),e.data=t.data.map(i=>this.remapAllPollsVotes(i)),e};remapAllPollsVotes=t=>{let e=new Ht;return e.id=t.id,e.pollId=t.poll_id,e.optionId=t.option_id,e.optionIds=t.option_ids,e.userId=t.user_id,e.createdAt=t.created_at,e};remapSinglePollVote=t=>{let e=new un;return e.id=t.id,e.pollId=t.poll_id,e.optionId=t.option_id,e.optionIds=t.option_ids,e.userId=t.user_id,e.attempts=t.attempts||null,e.createdAt=t.created_at,e.previousVotes=t.previous_votes?t.previous_votes.map(i=>this.remapPreviousVotes(i)):[],e};remapMetaPagination=t=>{let e=new ut;return e.itemsPerPage=t.items_per_page,e.nextPageStartsAfter=t.next_page_starts_after,e};remapPoll=t=>{let e=new pi;return e.id=t.id,e.title=t.title,e.alternativeTitle=t.alternative_title,e.description=t.description,e.type=t.type,e.images=t.images,e.status=t.status,e.language=t.language,e.authRequirement=t.auth_requirement,e.flags=t.flags,e.totalVotes=t.total_votes,e.customFields=t.custom_fields,e.related=t.related?this.remapRelated(t.related):[],e.branding=t.branding?this.remapBranding(t.branding):null,e.embedCode=t.embed_code,e.labels=t.labels,e.adContent=t.ad_content,e.options=t.options?this.remapOptions(t.options):[],e.context=t.context?this.remapContext(t.context):t.context,e.preferencesEnabled=t.preferences_enabled,e.multipleChoice=t.multiple_choice,e.maxMultipleChoiceOptions=t.max_multiple_choice_options,e.participationCount=t.participation_count,e.maxAttempts=t.max_attempts,e.externalActivity=t.external_activity,e.createdAt=t.created_at,e.updatedAt=t.updated_at,e};remapContext=t=>{let e=new Ct;return e.content=t.content,e.tags=t.tags?t.tags.map(i=>{let a=new ur;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 z;return i.entityId=e.entity_id,i.entityType=e.entity_type,i.entityRelationship=e.entity_relationship,i});remapOptions=t=>t.map(e=>{let i=new cn;return i.id=e.id,i.title=e.title,i.description=e.description,i.images=e.images,i.votes=e.votes,i.embedCode=e.embed_code,i.preferencesMapping=e.preferences_mapping?this.remapPreferencesMapping(e.preferences_mapping):[],i});remapPreferencesMapping=t=>t.map(e=>{let i=new ci;return i.preferenceId=e.preference_id,i})};var Tp=class extends v{pollRemapper=null;playerOfTheMatchRemapper=null;constructor(t){super(t,O(t.environment,"voting")),this.pollRemapper=new Pp,this.playerOfTheMatchRemapper=new wp}getPolls=async(t,e)=>{let i=`/polls${this.apiSignInUrl}`;t&&(i+=t.constructMainFiltersUrl()),f(e)&&(i+=m());let a="There was a problem fetching polls",r=await this.fetchWithoutAuth(i,a);return this.pollRemapper.remapPolls(r)};getPollById=async(t,e)=>{let i=`/polls/${t}${this.apiSignInUrl}`;f(e)&&(i+=m());let a="There was a problem fetching the following poll: "+t,r=await this.fetchWithoutAuth(i,a);return this.pollRemapper.remapPollById(r.data)};voteForPoll=async(t,e)=>{let i=`/polls/${t}/votes${this.apiSignInUrl}`,a="PUT",r={option_ids:e},o="There was a problem voting for the following poll: "+t,n=await this.fetchWithAuth(i,o,a,r);return this.pollRemapper.remapUserVote(n.data)};deleteVoteForPoll=async t=>{let e=`/polls/${t}/votes${this.apiSignInUrl}`,i="DELETE",a="There was a problem deleting vote for the following poll: "+t;return await this.fetchWithAuth(e,a,i),!0};getMyPollVote=async t=>{let e=`/polls/${t}/votes${this.apiSignInUrl}`,i="There was a problem fetching user's own vote for the following poll: "+t,a=await this.fetchWithAuth(e,i);return this.pollRemapper.remapSinglePollVote(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)?m():""}`,a="There was a problem fetching results for 'Player of the match'",r=await this.fetchWithoutAuth(i,a);return this.playerOfTheMatchRemapper.remapResults(r)}};var Ep=class{idMappingService=null;idSchema=null;errorHandlingMode=null;validator=null;activityService=null;football=null;constructor(t){this.idSchema=t.idSchema,this.errorHandlingMode=t.errorHandlingMode,this.idMappingService=new R(t),this.validator=new ie(t),this.activityService=new wt(t),this.football=new et(t)}finalizePollsFilters=async t=>{if(this.idSchema!=="native"&&t.entityIds&&t.entityIds.length>0){this.validator.validateFilters(t);let e=await this.idMappingService.getEntityIdsBySchemaId(Array.from(t.entityIds),t.entityType,"native");t.entityIds=e[t.entityType]}};remapTags=async(t,e,i)=>{if(this.idSchema!="native"&&t.context&&t.context.tags&&t.context.tags.length){let a=JSON.parse(JSON.stringify(t.context.tags)),r=await this.activityService.remapTagsIds(a,e,i);t.context.tags=r}};remapMatchAndPlayerIds=async(t,e,i,a)=>{let r={match:[t],player:[e]},o=await this.idMappingService.idMappingFacade.getEntitiesByIds(r,i,a);if(o.match.length>0&&o.player.length>0){let n=o.match[0],l=o.player[0];return[n,l]}throw this.errorHandlingMode==="default"?new y(404,"entity_ids_not_found","Some of the sport entity IDs were not found for the provided id schema"):new h(404,"entity_ids_not_found","Some of the sport entity IDs were not found for the provided id schema")};remapMatchIds=async(t,e,i)=>{let a=Array.from(t),r={match:t},o=await this.idMappingService.idMappingFacade.getEntitiesByIds(r,e,i);if(o.match.length>0&&o.match.length===a.length)return o.match;throw this.errorHandlingMode==="default"?new y(404,"match_ids_not_found","Some of the match IDs were not found for the provided id schema"):new h(404,"match_ids_not_found","Some of the match IDs were not found for the provided id schema")};setModelsForUserVotes=async t=>{let e=t.data.map(a=>a.matchId),i=t.data.map(a=>a.playerId);if(e.length>0&&i.length>0){let a=await this.football.footballFacade.getMatchesMapWithNativeIds(e),r=await this.football.footballFacade.getPlayersMapWithNativeIds(i);t.data.forEach(o=>{o.matchModel=a[o.matchId]||null,o.playerModel=r[o.playerId]||null,o.matchId=o.matchModel?o.matchModel.id:o.matchId,o.playerId=o.playerModel?o.playerModel.id:o.playerId}),t.meta.pagination.nextPageStartsAfter&&(t.meta.pagination.nextPageStartsAfter=t.data[t.data.length-1].matchId)}return t};setModelsForPotmResults=async t=>{let e=t.map(a=>a.teamId),i=t.map(a=>a.playerId);if(e.length>0&&i.length>0){let a=await this.football.footballFacade.getTeamsMapWithNativeIds(e),r=await this.football.footballFacade.getPlayersMapWithNativeIds(i);t.forEach(o=>{o.teamModel=a.get(o.teamId)||null,o.playerModel=r[o.playerId]||null,o.teamId=o.teamModel?o.teamModel.id:o.teamId,o.playerId=o.playerModel?o.playerModel.id:o.playerId})}}};var Rp=class{https=null;service=null;idSchema=null;constructor(t){this.idSchema=t.idSchema,this.https=new Tp(t),this.service=new Ep(t)}getPolls=async(t,e)=>{t&&(t=new li(t),await this.service.finalizePollsFilters(t));let i=await this.https.getPolls(t,e);for(let a of i.data)await this.service.remapTags(a,"native",this.idSchema);return i};getPollById=async(t,e)=>{let i=await this.https.getPollById(t,e);return await this.service.remapTags(i,"native",this.idSchema),i};voteForPoll=async(t,e)=>(typeof e=="string"&&(console.warn("Passing a single optionId as a string will be deprecated. Please pass it as an array."),e=[e]),await this.https.voteForPoll(t,e));deleteVoteForPoll=async t=>await this.https.deleteVoteForPoll(t);getMyPollVote=async(t,e)=>{let i=await this.https.getMyPollVote(t);if(e){let a=await this.getPolls(new li({pollIds:[t]}),!0);i.pollModel=a.data.find(r=>r.id===t)||null,i.optionModel=a.data.find(r=>r.id===t)?.options.find(r=>r.id===i.optionId)||null,i.optionsModels=i.optionIds?a.data.find(r=>r.id===t)?.options.filter(r=>i.optionIds.includes(r.id))||[]:[],i.previousVotes.forEach(r=>{r.optionsModels=a.data.find(o=>o.id===r.pollId)?.options.filter(o=>r.optionIds.includes(o.id))||[]})}return i};getMyPollsVotes=async t=>{t&&(t=new w(t));let e=await this.https.getMyPollsVotes(t),i=e.data.map(r=>r.id),a=await this.getPolls(new li({pollIds:i}),!0);return e.data=e.data.map(r=>(r.pollModel=a.data.find(o=>o.id===r.pollId)||null,r.optionModel=r.pollModel?.options.find(o=>o.id===r.optionId)||null,r.optionsModels=r.optionIds?r.pollModel?.options.filter(o=>r.optionIds.includes(o.id))||[]:[],r)),e};voteForPlayerOfTheMatch=async(t,e)=>{if(this.idSchema!=="native"){let[i,a]=await this.service.remapMatchAndPlayerIds(t,e,this.idSchema,"native");return await this.https.voteForPlayerOfTheMatch(i,a),{playerId:e}}return await this.https.voteForPlayerOfTheMatch(t,e)};deleteVoteForPlayerOfTheMatch=async t=>{if(this.idSchema!=="native"){let e=await this.service.remapMatchIds([t],this.idSchema,"native");return await this.https.deleteVoteForPlayerOfTheMatch(e[0]),!0}return await this.https.deleteVoteForPlayerOfTheMatch(t),!0};getOwnVotesForPlayerOfTheMatch=async t=>{if(t&&(t=new fn(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 Hi=class{facade=null;constructor(t){this.facade=new Rp(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 Fp=class{clientHttps=null;topX=null;matchQuiz=null;loyalty=null;miniGames=null;voting=null;constructor(t){this.clientHttps=new q(t),this.topX=new Vi(t),this.matchQuiz=new Ui(t),this.loyalty=new oe(t),this.miniGames=new ae(t),this.voting=new Hi(t)}getListContent=async(t,e,i)=>{e&&(e=new yo(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(M=>o.includes(M.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 Sp=class{facade=null;constructor(t){this.facade=new Fp(t)}getListContent=async(t,e,i)=>await this.facade.getListContent(t,e,i)};var vp=class{fromResponse(t,e){let i=new Map;return t.matches.forEach(a=>{let r=a.odds.map(o=>{let n=new Es;return n.bookmaker=o.bookmaker?this.remapBookmaker(o.bookmaker):null,n.type=o.type,n.markets=o.markets?this.remapMarkets(o.markets,e):[],n});i.set(a.id,r)}),i}remapBookmaker(t){let e=new fs;return e.id=t.id,e.name=t.name,e.assets=t.assets?this.remapAssets(t.assets):[],e.links=t.links||[],e.branding=t.branding?this.remapBranding(t.branding):null,e.eventUrls=t.event_urls?this.remapEventUrls(t.event_urls):[],e.stakesDisclaimer=t.stakes_disclaimer,e.domainName=t.domain_name,e}remapMarkets(t,e){return t.map(i=>{let a=new Is;return a.type=i.type?this.remapMarketType(i.type):null,a.scope=i.scope?this.remapMarketScope(i.scope):null,a.selections=i.selections?this.remapMarketSelections(i.selections,a.type.code,e):[],a})}remapEventUrls(t){return t.map(e=>{let i=new bs;return i.url=e.url,i.appType=e.app_type,i})}remapBranding(t){let e=new gs;return e.backgroundColor=t.background_color,e.textColor=t.text_color,e}remapAssets(t){return t.map(e=>{let i=new ys;return i.logo=e.logo,i.type=e.type,i.transparentBackgroundUrl=e.transparent_background_url,i.backgroundColor=e.background_color,i})}remapMarketType=t=>{let e=new Ps;return e.id=t.id,e.name=t.name,e.code=t.code,e.entityType=t.entity_type,e};remapMarketScope=t=>{let e=new ws;return e.id=t.id,e.name=t.name,e.type=t.type,e.entityType=t.entity_type,e};remapMarketSelections=(t,e,i)=>{let a=Array.from(t);return i.length>0&&e==="OVER_UNDER"&&(a=a.filter(r=>r.code==="over"?i.some(o=>{switch(o){case"OVER_GOALS_0_5":return r.value==="0.5";case"OVER_GOALS_1_5":return r.value==="1.5";case"OVER_GOALS_2_5":return r.value==="2.5";case"OVER_GOALS_3_5":return r.value==="3.5";case"OVER_GOALS_4_5":return r.value==="4.5";case"OVER_GOALS_5_5":return r.value==="5.5";default:return!1}}):!1)),a.map(r=>{let o=new _s;return o.id=r.id,o.name=r.name,o.code=r.code,o.value=r.value,o.odds=r.odds,o.urls=r.urls?this.remapEventUrls(r.urls):[],o.movement=r.movement,o.oddsOld=r.odds_old,o.entityType=r.entity_type,o.additionalInfo=r.additional_info,o.providerInfo=r.provider_info?this.remapProviderInfo(r.provider_info):null,o})};remapProviderInfo=t=>{let e=new Ts;return e.selectionId=t.selection_id,e.eventId=t.event_id,e.marketId=t.market_id,e.competitionId=t.competition_id,e}};var Cp=class{footballBaseUrl="https://football.api.sportal365.com/";retryRequest=!1;oddClient=null;remapper=null;constructor(t){this.oddClient=t.oddClient,this.remapper=new vp}getMatchOdds=async(t,e)=>{let i=`v2/matches/livescore?odd_client=${this.oddClient.name}&match_ids=${t.join(",")}${e.constructFiltersUrl()}`,a=`Error while fetching match odds for matchIds: ${t.join(",")}`,r=await this.fetchWithAuth(i,a),o=e.marketTypes&&e.marketTypes.length>0?e.marketTypes.filter(n=>n.includes("OVER")):[];return this.remapper.fromResponse(r,o)};getAuthHeaders=()=>{let t=typeof window<"u"?window.btoa(`${this.oddClient.credentials.username}:${this.oddClient.credentials.password}`):Buffer.from(`${this.oddClient.credentials.username}:${this.oddClient.credentials.password}`).toString("base64");return{"Content-Type":"application/json",Authorization:`Basic ${t}`}};fetchWithAuth=async(t,e)=>{let i=await fetch(this.footballBaseUrl+t,{headers:this.getAuthHeaders()}),a=await i.json();if(!i.ok)throw(i.status===401||i.status===403)&&!this.retryRequest&&(this.retryRequest=!0,await this.fetchWithAuth(t,e)),this.retryRequest=!1,console.warn(e,a),a;return this.retryRequest=!1,a}};var Ap=class{https;idSchema;oddClient;idMapping=null;validator;constructor(t){this.idSchema=t.idSchema,this.oddClient=t.oddClient,this.https=new Cp(t),this.validator=new K(t.errorHandlingMode),this.idMapping=new R(t)}getByMatchIds=async(t,e)=>{this.validateOddClient(),(!t||!Array.isArray(t)||t.length===0)&&this.validator.throwException(400,"invalid_match_ids","Match IDs are invalid!");let i=Array.from(t);this.idSchema!=="sportal365"&&(i=(await this.idMapping.idMappingFacade.getEntitiesByIds({match:Array.from(t)},this.idSchema,"sportal365")).match);let a=new Ms(e),r=await this.https.getMatchOdds(i,a);if(this.idSchema!=="sportal365"){let o=await this.idMapping.idMappingFacade.getEntitiesByIdsMap({match:Array.from(r.keys())},"sportal365",this.idSchema),n=new Map;return Array.from(r.entries()).forEach(([l,p])=>{n.set(o.get(l),p)}),n}return r};validateOddClient=()=>{this.oddClient||this.validator.throwException(412,"odd_client_configuration_not_found","Odds namespace requires oddClient configuration to be set")}};var Op=class{facade;constructor(t){this.facade=new Ap(t)}getByMatchIds=async(t,e)=>await this.facade.getByMatchIds(t,e)};var xp=class{factory=null;privateLeagueHttps=null;loyaltyHttps=null;profile=null;service=null;discussionsService=null;constructor(t){this.factory=new Li,this.privateLeagueHttps=new xi(t),this.loyaltyHttps=new Rt(t),this.profile=new D(t),this.service=new ki(t),this.discussionsService=new se(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 Ws(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 Ks(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 ai(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 ri(e));let i=await this.privateLeagueHttps.getReportedPosts(t,e);return i.data=await this.discussionsService.finalizePostFullModel(i.data),i};getPredictions=async(t,e)=>{if(e){if(e.limit&&e.limit>20)throw new h(400,"invalid_limit","Invalid limit. The maximum limit is: "+20 .toString());e=new oi(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 Lp=class{privateLeaguesFacade=null;constructor(t){this.privateLeaguesFacade=new xp(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 Dp=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 Bp=class extends K{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 Np=class{https=null;profile=null;validator=null;constructor(t){this.https=new Kt(t),this.profile=new D(t),this.validator=new Bp(t.errorHandlingMode)}getGames=async(t,e)=>(t&&(t=new tn(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 en(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 kp=class{facade=null;constructor(t){this.facade=new Np(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 Qu(){let s=qu(),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 Hc=null,nu=null;function Ed(s){if(Rd(s)){let t=Fd(s);if(t.isValid)return Hc={profile:new D(s),football:new et(s),predictor:new Ni(s),loyalty:new oe(s),topX:new Vi(s),matchQuiz:new Ui(s),activity:new qn(s),miniGames:new ae(s),discussions:new np(s),privateLeagues:new Lp(s),challenges:new ap(s),progress:new Dp,voting:new Hi(s),fantasy:new mp(s),helpers:new hp(s),idMapping:new bp(s),bracketGame:new Al(s),lists:new Sp(s),standingGame:new kp(s),eventGame:new cp(s),odds:new Op(s),getVersion:Qu},nu={...s},Hc;Sd(t)}return Hc}var Rd=s=>!Hc||JSON.stringify(s)!==JSON.stringify(nu)||s.authProvider?.getIdToken()!==nu.authProvider?.getIdToken(),Fd=s=>{let e=new kn().validate(s);return(e.idSchema.validation==="missing"||e.idSchema.validation==="invalid")&&(console.warn(e.idSchema.message.text),s.idSchema="native"),(e.environment.validation==="missing"||e.environment.validation==="invalid")&&(console.warn(e.environment.message.text),s.environment="prod"),(e.lang.validation==="missing"||e.lang.validation==="invalid")&&(console.warn(e.lang.message.text),s.lang="en"),(e.errorHandlingMode.validation==="missing"||e.errorHandlingMode.validation==="invalid")&&(console.warn(e.errorHandlingMode.message.text),s.errorHandlingMode="default"),e.authProvider.validation==="invalid"&&console.warn(e.authProvider.message.text),(e.oddClient.message.type==="warning"||e.oddClient.credentials.message.type==="warning")&&console.warn(e.oddClient.message.text||e.oddClient.credentials.message.text),e},Sd=s=>{let t="isValid";Object.keys(s).forEach(e=>{let i=s[e];if(e!==t&&e!=="authProvider"){if(i.message.type==="error")throw new Error(i.message.text)}else if(e!==t&&e==="authProvider"){if(i?.message.type==="error")throw new Error(i.message.text);Object.keys(new le).forEach(a=>{if(i[a].message.type==="error")throw new Error(i[a].message.text)})}if(e!==t&&e==="oddClient"){if(i?.message.type==="error")throw new Error(i.message.text);let a=i;if(a.credentials.message.type==="error")throw new Error(a.credentials.message.text)}})};export{fr as AcceptChallengeModel,zs as AcceptPrivateLeagueModel,ji as AchievementsStats,Te as ActionValueModel,jc as ActionsEnum,Ee as ActionsModel,ge as ActivityFilters,Zp as ActivityMeta,fe as ActivityResponseBody,uc as AssetsModel,Pe as AutomaticModerationModel,or as BadgesModel,za as BadgesModelV2,sr as BadgesValue,Q as BadgesValueV2,ys as BookmakerAssetModel,gs as BookmakerBrandingModel,Ac as BookmakerLinkModel,fs as BookmakerModel,bs as BookmakerUrlModel,Fs as BothTeamsFixtureModel,hr as BracketGameFilters,ye as BracketGameFixtureScoreModel,mr as BracketGameFixtures,la as BracketGameFixturesModel,be as BracketGameMetaModel,pa as BracketGameMetaParticipantsModel,ca as BracketGameModel,ha as BracketGamePredictionFixturesModel,fa as BracketGamePredictionModel,ic as BracketGamePredictionRequestBody,Vu as BracketGamePredictionStatusEnum,dr as BracketGamePredictionsFilters,ua as BracketGamePredictionsModel,ga as BracketGameRankingsModel,Me as BracketGameTiebreaker,ma as BracketGameTiebreakerModel,da as BracketGamesModel,tu as BracketWinnerEnum,uo as BrandingColorsModel,ho as BrandingImagesModel,co as BrandingModel,mo as BrandingUrlsModel,La as BreakdownModel,xc as CalculatedOneXTwoFromScoresModel,tc as CampaignModel,gr as ChallengeCreateModel,br as ChallengeFilters,Ir as ChallengeRankingsModel,yr as ChallengeUpdateModel,ze as ClassicQuizBasicModel,Bo as ClassicQuizFilters,qe as ClassicQuizFiltersMeta,No as ClassicQuizFullModel,qo as ClassicQuizLeaderboardFilters,We as ClassicQuizLeaderboardMeta,Go as ClassicQuizOptionModel,Tc as ClassicQuizParticipationBodyModel,Uo as ClassicQuizParticipationModel,Vo as ClassicQuizParticipationQuestionModel,Ho as ClassicQuizParticipationsFilters,ko as ClassicQuizQuestionModel,zo as ClassicQuizQuestionsReportModel,Qe as ClassicQuizRankFilters,Qo as ClassicQuizRankModel,$o as ClassicQuizUserParticipationModel,Wo as ClassicQuizUserRank,Rc as ClassicQuizUserRankModel,Fc as ClassicQuizzesLeaderboardModel,Ec as ClassicQuizzesModel,ce as ClassicQuizzesStats,bo as ClientBadges,Mo as ClientBadgesV2,qr as CompetitionBasicModel,_i as CompetitionFilters,Qr as CompetitionFullModel,J as CompletedModel,ec as ContentModel,nn as ContestWinners,Ct as ContextModel,vs as CornersFixtureModel,Ut as CorrectScoreFixtureModel,fi as CreateActivityRequestBody,ac as CreatePostParamBody,va as DetailedProfileModel,Na as DictionaryModel,wr as DiscussionModel,ue as DiscussionStats,er as DiscussionsBadgeRequirements,ir as DiscussionsBadgesValue,ka as DiscussionsConfigModel,Ar as DiscussionsFilters,Fl as DoubleChanceEnum,Os as DoubleChanceFixtureModel,Ke as EitherOrBasicModel,Ko as EitherOrFilters,jo as EitherOrFullModel,Jo as EitherOrParticipationModel,ts as EitherOrParticipationRequestFullModel,Zo as EitherOrParticipationRequestModel,is as EitherOrParticipationStepsModel,Ei as EitherOrParticipationStepsOptionModel,Yo as EitherOrPointsModel,as as EitherOrResultsBreakdownModel,rs as EitherOrResultsModel,os as EitherOrResultsStandingsModel,de as EitherOrStats,Xo as EitherOrStatsModel,Sc as EitherOrsModel,gc as EntitiesFollows,yc as EntitiesFollowsFilters,zi as EnvironmentEnum,C as ErrorCodes,Hp as ErrorHandlingModeEnum,x as ErrorMessages,A as ErrorStatuses,xr as EventGameFilters,sc as EventGameFixtureEnumModel,nc as EventGameFixtureNumberModel,rc as EventGameFixtures,At as EventGameFixturesModel,Fa as EventGameModel,Xp as EventGameOutcomeTypeEnum,Ot as EventGamePredictionFixturesModel,Ea as EventGamePredictionModel,oc as EventGamePredictionRequestBody,Hu as EventGamePredictionStatusEnum,Lr as EventGamePredictionsFilters,Sa as EventGamePredictionsModel,Dr as EventGameRankingsFilters,Ra as EventGameRankingsModel,we as EventGameTiebreaker,Ta as EventGameTiebreakerModel,Pa as EventGamesModel,Ed as FansUnitedSDK,dc as FansUnitedSDKModel,Wt as FansUnitedSdkFetchException,xe as FantasyCoefficientsModel,lr as FantasyConfigModel,pr as FantasyMultipliersModel,Nr as FantasyPlayerDetailedStatsMetaModel,kr as FantasyPlayerDetailedStatsModel,Gr as FantasyPlayerStatsModel,Vr as FantasyPlayersMetaModel,Le as FantasyPlayersModel,Hr as FantasyPlayersPointsModel,ke as FantasyPredictionRequestBody,Ro as FiltersMetaModel,an as FixturesGamesModel,Lo as FixturesMatchQuizModel,Rs as FixturesPredictionModel,Ye as FixturesResponseModel,on as FixturesTopXModel,Ii as FollowFilters,bi as FollowModel,Oa as FollowStatusModel,Aa as FollowersModel,Ca as FollowingModel,Xa as FootballBadgeRequirements,Ja as FootballBadgesValue,Wr as FootballCountryModel,su as FootballMatchStatusEnum,Yt as FootballPaginationModel,Zs as FullInterestModel,Da as FullnessProfile,Wa as GameBadgeRequirements,Ka as GameBadgesValue,si as GameByIdModel,Do as GameMarketsResults,Xt as GameModel,mi as GamePredictionsStats,sn as GameResultsModel,ft as GameStatusEnum,ja as GamesBadgeRequirements,Ya as GamesBadgesValue,nt as GamesFilters,Tt as GamesListModel,Pt as GamesMatchQuizListModel,Vt as GamesTopXListModel,nr as GeneralBadgesValue,Oe as GeneralRequirementModel,Sl as HalfTimeFullTimeEnum,Ls as HalfTimeFullTimeFixtureModel,Io as HighestSuccessRateFilters,Eo as HighestSuccessRateModel,N as IdSchemaEnum,W as ImagesModel,Js as InterestModel,ai as InvitationFilters,Fn as LangEnum,xa as LeadModel,Uc as LeadRequestBody,bc as LeaderboardLeagueResponse,$e as LeaderboardModel,Mc as LeaderboardResponseModel,wo as LeagueLeaderboardFilters,He as LeagueLeaderboardMetaModel,Ve as LineupsModel,yo as ListContentFilters,cr as ListContentModel,wn as ListContentResponseModel,Ga as LoyaltyConfigModel,rr as LoyaltyConfigModelV2,_o as LoyaltyFilters,Dt as LoyaltyMeta,fo as MappingModel,go as MappingResponseModel,at as MarketEnum,Oc as MarketsConfigModel,Kr as MatchBasicModel,ti as MatchCorrectScoreMarketResultModel,gt as MatchFilters,jr as MatchFullModel,Vs as MatchMarketsResultsModel,Ms as MatchOddsFilters,ru as MatchOddsMarketEnum,Is as MatchOddsMarketModel,ws as MatchOddsMarketScopeModel,_s as MatchOddsMarketSelectionModel,Ps as MatchOddsMarketTypeModel,Es as MatchOddsModel,Us as MatchPlayerMarketResultModel,Fe as MatchQuizConfigModel,X as MatchStatus,$s as MatchSummaryModel,k as MetaFootballModel,es as MiniGameImages,Za as MiniGamesBadgeRequirements,tr as MiniGamesBadgesValue,kt as MiniGamesContext,Gt as MiniGamesContextTag,Nt as MiniGamesFilters,Mr as MyChallengesFilters,Ws as MyLeaguesFilters,L as NoYesModel,au as OddFormatEnum,eu as OddTypeEnum,Rl as OneXTwoEnum,Bs as OneXTwoFixtureModel,zu as OutcomeEnum,Je as OverCornersFixtureModel,Ze as OverGoalsFixtureModel,sa as OwnActivityFilters,ta as PaginationActivities,Y as PaginationFootballProperties,Dc as PastTemplateModel,Ns as PenaltyMatchFixtureModel,je as PersonalityQuizBasicModel,us as PersonalityQuizFilters,Ri as PersonalityQuizFullModel,cs as PersonalityQuizOptionModel,Cc as PersonalityQuizParticipationBodyModel,ds as PersonalityQuizParticipationModel,ms as PersonalityQuizParticipationQuestionModel,hs as PersonalityQuizPersonaPercentsModel,ps as PersonalityQuizPersonaPointsModel,ls as PersonalityQuizQuestionModel,ns as PersonalityQuizResultsModel,vc as PersonalityQuizzesModel,lc as PlayerAssetsModel,to as PlayerBasicModel,Ge as PlayerDetailedPointsModel,Br as PlayerDetailedStatsFilters,$r as PlayerDetailedStatsModel,Ti as PlayerFilters,st as PlayerFixtureModel,eo as PlayerFullModel,pc as PlayerMarketResultModel,zr as PlayerPointsModel,ro as PlayerShortModel,io as PlayerSquadModel,Ue as PlayerStatsMatchModel,Zr as PlayerStatsModel,Ur as PlayersPointsFilters,Ic as Points,Ua as PointsModel,wc as PointsValueModel,fc as PollBadgesValue,pi as PollBasicModel,pn as PollFullModel,cn as PollOptionModel,Ht as PollVoteBasicModel,un as PollVoteFullModel,li as PollsFilters,mn as PollsModel,hn as PollsUserVotesModel,Ne as PostByIdBasicModel,_r as PostByIdFullModel,Pr as PostCreateModel,Tr as PostsCountDiscussionModel,Er as PostsDiscussionBasicModel,jt as PostsFilters,Rr as PostsFullModel,Lt as PostsMetaModel,Fr as PostsModel,Ce as PotmBadgesValue,bn as PotmResultsMetaModel,In as PotmResultsModel,Mn as PotmResultsResponseModel,fn as PotmUserVotesFilters,yn as PotmUserVotesModel,gn as PotmUserVotesResponseModel,xo as PredictionMatchQuizModel,ei as PredictionRequestModel,Fi as PredictionResponseModel,rn as PredictionTopXModel,V as PredictionsFilters,Hs as PredictionsModel,he as PredictionsStats,qa as PredictorBadgeRequirements,Qa as PredictorBadgesValue,ve as PredictorConfigModel,ci as PreferenceMappingModel,hc as PreferenceModel,De as PrivateLeagueBasicCreateModel,Be as PrivateLeagueBasicUpdateRequestBody,Ys as PrivateLeagueCreateModel,Ks as PrivateLeagueFilters,qs as PrivateLeagueFullModel,ii as PrivateLeagueModel,Bc as PrivateLeagueParamCreateBody,Nc as PrivateLeagueParamUpdateBody,ri as PrivateLeaguePostsFilters,Qs as PrivateLeaguePredictionModel,oi as PrivateLeaguePredictionsFilters,kc as PrivateLeaguePredictionsModel,js as PrivateLeagueRankingsModel,Xs as PrivateLeagueUpdateModel,Gc as PrivateLeaguesModel,Ba as ProfileCountryModel,_e as ProfileModel,Xi as ProfileStatsModel,Po as RankingsFilters,So as RankingsModel,Sr as ReactionModel,Gs as RedCardFixtureModel,z as RelatedEntityRelationship,vr as ReportModel,xt as RequirementModel,Xe as ResultModel,ss as ResultsSummaryModel,Re as RewardsModel,Ae as RewardsModelV2,mc as SDKConfiguraitonModel,iu as ScopeTypeEnum,Xr as ScoresModel,po as SearchFilters,lo as SearchModel,Ts as SelectionProviderInfoModel,dn as SinglePollVoteModel,Ji as SinglePredictionsBreakdown,me as SinglePredictionsStats,h as StandardFansUnitedException,Ie as StandingGameMetaModel,Ma as StandingGameMetaParticipantsModel,ya as StandingGameModel,Ia as StandingGamePredictionModel,wa as StandingGamePredictionsModel,en as StandingGameRankingsFilters,_a as StandingGameRankingsModel,tn as StandingGamesFilters,ba as StandingGamesModel,Yr as StatsModel,rl as StatusEnum,Zi as SuccessRatePercent,Va as SuccessRateScopeModel,Yi as SuccessRates,Qt as SummarizedBreakdown,ur as TagsModel,oo as TeamBasicModel,so as TeamColors,Pi as TeamFilters,cc as TeamFormModel,no as TeamFullModel,_c as TemplateBreakdownModel,vo as TemplateBreakdownPointsModel,Co as TemplateByIdModel,To as TemplateFilters,Oo as TemplateGroupFilter,Ao as TemplateGroups,Fo as TemplateMeta,Bt as TemplateModel,bt as TiebreakerModel,Pc as TiersModel,yt as TimeTiebreaker,Jr as TimelineModel,Lc as TopCorrectScoresModel,Or as TopDiscussionsFilters,ao as TopPlayerModel,Se as TopXConfigModel,ni as TopXPredictionRequestModel,$u as UserActionsEnum,na as UserActivityFilters,Ha as UserDataConfigModel,ln as UserListWinners,ks as ValueAndPlayerId,ot as ValueBoolean,Ss as ValueCorners,Cs as ValueCorrectScore,As as ValueDoubleChance,xs as ValueHalfTimeFullTime,Ds as ValueOneXTwo,Cr as VersionsModel,ar as VotingBadgeRequirements,$a as VotingBadgesValue};
3
+ ${Qc.PREDICTOR_USER_RELATED_OPERATION}`},fu=(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`,qp=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`,gu=s=>`The market '${s}' is not valid for Top X game. The only available market is CORRECT_SCORE.`,yu=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`,bu=(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`,Mu=(s,t)=>`The field ${s} has incorrect type. The correct type is ${t}`;var Wt=class{data={error:{code:0,status:"",message:""}};status=0;statusText="";headers=null;constructor(t,e){this.data.error.code=e.code,this.data.error.status=e.status,this.data.error.message=e.message,this.status=t.status,this.statusText=t.statusText,this.headers=t.headers}errorMessage=()=>this.data.error.message};var h=class{error={code:0,status:"",message:""};constructor(t,e,i){this.error.code=t,this.error.status=e,this.error.message=i}};var v=class{baseUrl=null;apiSignInUrl=null;jwtToken=null;idSchema=null;retryRequest=!1;headers=null;authHeaders=null;errorHandlingMode=null;configuration=null;constructor(t,e){this.baseUrl=e,this.configuration=t,this.apiSignInUrl=`?key=${t.apiKey}&client_id=${t.clientId}`,this.errorHandlingMode=t.errorHandlingMode,this.idSchema=t.idSchema,this.headers={"Content-Type":"application/json"}}getJwtToken=()=>{if(this.configuration.cookieToken){let t=[];typeof document>"u"?t=(this.configuration.cookieToken.requestHeaders.get("cookie")||"").split(";"):t=document.cookie.split(";");let e=t.find(r=>r.trim().startsWith(`${this.configuration.cookieToken.name}=`));if(!e)return"";let i=e.split("=")[1].trim(),a=decodeURIComponent(i);try{let r=JSON.parse(a);return r.token||r||""}catch{return a}}return this.configuration.authProvider?.getIdToken()||""};getAuthHeaders=()=>({"Content-Type":"application/json",Authorization:`Bearer ${this.getJwtToken()}`});fetchWithoutAuth=async(t,e,i,a)=>{let r=null;a?r=await fetch(this.baseUrl+t,{headers:this.headers,method:i||"GET",body:JSON.stringify(a)}):r=await fetch(this.baseUrl+t,{headers:this.headers,method:i||"GET"});let o=await r.json();if(!r.ok){let n=this.transformFetchException(r,o);throw console.warn(e,n),n}return o};fetchWithoutAuthAdditionalHeaders=async(t,e,i)=>{let a=await fetch(this.baseUrl+t,{headers:{...this.headers,...i}}),r=await a.json();if(!a.ok){let o=this.transformFetchException(a,r);throw console.warn(e,o),o}return r};fetchWithAuth=async(t,e,i,a)=>{this.validateJWTToken();let r=null,o=null;if(i&&a?r=await fetch(this.baseUrl+t,{method:i,headers:this.getAuthHeaders(),body:JSON.stringify(a)}):i&&!a?r=await fetch(this.baseUrl+t,{method:i,headers:this.getAuthHeaders()}):r=await fetch(this.baseUrl+t,{headers:this.getAuthHeaders()}),i!=="DELETE"&&(o=await r.json()),!r.ok){(r.status===401||r.status===403)&&!this.retryRequest&&(this.retryRequest=!0,await this.fetchWithAuth(t,e,i,a)),this.retryRequest=!1;let n=this.transformFetchException(r,o||await r.json());throw console.warn(e,n),n}return this.retryRequest=!1,o};fetchWithAuthNewBaseURL=async(t,e,i,a,r)=>{this.validateJWTToken();let o=null,n=null;if(a&&r?o=await fetch(t+e,{method:a,headers:this.getAuthHeaders(),body:JSON.stringify(r)}):a&&!r?o=await fetch(t+e,{method:a,headers:this.getAuthHeaders()}):o=await fetch(t+e,{headers:this.getAuthHeaders()}),a!=="DELETE"&&(n=await o.json()),!o.ok){(o.status===401||o.status===403)&&!this.retryRequest&&(this.retryRequest=!0,await this.fetchWithAuthNewBaseURL(t,e,i,a,r)),this.retryRequest=!1;let l=this.transformFetchException(o,n||await o.json());throw console.warn(i,l),l}return this.retryRequest=!1,n};transformFetchException=(t,e)=>{if(!e&&t.status===401){if(this.errorHandlingMode==="standard")return new h(401,"unauthorized","Invalid JWT token is provided");let o={code:401,status:"unauthorized",message:"Invalid JWT token is provided"};return new Wt(t,o)}let{code:i,status:a,message:r}=e.error;return this.errorHandlingMode==="standard"?new h(i,a,r):new Wt(t,e.error)};validateJWTToken=()=>{let t=null;try{t=qc(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 Wt(a,r)}else if(this.errorHandlingMode==="standard")throw new h(401,"invalid_token","Invalid JWT token is provided")}if(Date.now()>t.exp*1e3){if(this.errorHandlingMode==="default"){let i={status:401,statusText:"",headers:{}},a={code:401,status:"invalid_token",message:"The provided JWT token is expired"};throw new Wt(i,a)}else if(this.errorHandlingMode==="standard")throw new h(401,"invalid_token","The provided JWT token is expired")}};extractUserIdFromToken=()=>{try{return qc(this.getJwtToken())?.sub||""}catch(t){return console.error(t),""}}};var hi=class extends v{activityRemapper=null;constructor(t){super(t,O(t.environment,"loyalty")),this.activityRemapper=new Gn}createActivity=async t=>{let e=`/activities${this.apiSignInUrl}`,i="There was a problem with creating activity",a="POST",r=await this.fetchWithAuth(e,i,a,t);return this.activityRemapper.remapSingleResponse(r)};deleteActivity=async t=>{let e=`/activities/${t}${this.apiSignInUrl}`,i=`There was a problem deleting the following activity: ${t}`,a="DELETE";return await this.fetchWithAuth(e,i,a),!0};getOwnActivities=async(t,e)=>{let i=`/activities${this.apiSignInUrl}`,a=Date.now(),r="There was a problem with fetching own activities";t&&(i+=`${t.constructFilterUrl()}`),e&&(i+=`disable_cache=${a}`);let o=await this.fetchWithAuth(i,r);return this.activityRemapper.remapActivitiesResponse(o)};getActivitiesForUser=async(t,e,i)=>{let a=`/users/${t}/activities${this.apiSignInUrl}`,r=Date.now(),o=`There was a problem with fetching activities for user: ${t}`;e&&(a+=`${e.constructFilterUrl()}`),i&&(a+=`disable_cache=${r}`);let n=await this.fetchWithoutAuth(a,o);return this.activityRemapper.remapActivitiesResponse(n)};getStats=async(t,e)=>{let i="",a="",r=null;return t?(i+=f(e)?`/users/${t}/statistics${this.apiSignInUrl}${m()}`:`/users/${t}/statistics${this.apiSignInUrl}`,a=`There was a problem fetching statistics for profile: ${t}`,r=await this.fetchWithoutAuth(i,a)):(i+=`/statistics${this.apiSignInUrl}`,a="There was a problem fetching profile`s statistics",r=await this.fetchWithAuth(i,a)),this.activityRemapper.remapStatsResponse(r.data)}};var jc=(g=>(g.LIKE="like",g.DISLIKE="dislike",g.PAGE_VIEW="page_view",g.CONTENT_CONSUMED="content_consumed",g.SHARE="share",g.COMMENT="comment",g.CLICK_AD="click_ad",g.PREDICTION_MADE="prediction_made",g.CONVERT="convert",g.MANAGE_INTERESTS="manage_interests",g.GAME_PARTICIPATION="game_participation",g.ARTICLE_CONSUMED="article_consumed",g.VIDEO_CONSUMED="video_consumed",g.SHORT_VIDEO_CONSUMED="short_video_consumed",g.LONG_VIDEO_CONSUMED="long_video_consumed",g.AUDIO_CONSUMED="audio_consumed",g.GALLERY_CONSUMED="gallery_consumed",g.IMAGE_CONSUMED="image_consumed",g.POLL_PARTICIPATION="poll_participation",g))(jc||{});var fi=class{action=null;context=new Ct;constructor(t,e,i,a){this.action=t,this.context.tags=e,i&&(this.context.content=i),a&&(this.context.campaign=a)}};var Un={player:"players",team:"teams",homeTeam:"teams",awayTeam:"teams",country:"countries",competition:"competitions",match:"matches"},Vn=class extends v{constructor(t){super(t,O(t.environment,"idMapping"))}getEntityById=async(t,e)=>{let i=`/football${this.apiSignInUrl}&input_provider=${this.idSchema}&${Un[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}&${Un[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}&${Un[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=$c(e),r=[];for(let o of a){let n=`/football${this.apiSignInUrl}&input_provider=${i}&${Un[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=pe(i),n=$c(o);for(let p of n){let c="";if(Object.keys(t).forEach(u=>{a[u]=[];let d=p.filter(M=>t[u].includes(M));d&&d.length>0&&(a[u]=d)}),Object.keys(a).forEach(u=>{a[u].length>0&&(a[u].sort((d,M)=>d.localeCompare(M)),c+="&",c+=`${Un[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",M=await this.fetchWithoutAuth(u,d);r.push(M.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 Yc="FansUnited",Qp={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}}},ea=class{idSchema="";storageInstance=null;expirationProfileTimeout=600;expirationBadgesTimeout=3600;expirationClientFeaturesTimeout=14400;expirationFootballIdsTimeout=604800;constructor(t){this.idSchema=t,this.getStorageInstance()}static getInstance(t){return ea.instance||(ea.instance=new ea(t)),ea.instance}async getStorageInstance(){try{let t=await Promise.resolve().then(()=>(wu(),Iu));this.storageInstance=t.default}catch(t){console.error(t)}}async getData(){try{let t=await this.storageInstance.getItem(Yc);return t?JSON.parse(t):(await this.storageInstance.setItem(Yc,JSON.stringify(Qp)),Qp)}catch(t){throw console.error("AsyncStorage error:",t),t}}async setData(t){await this.storageInstance.setItem(Yc,JSON.stringify(t))}clearData=async()=>{await this.setData(Qp)};getCompetitions=async t=>{let e=await this.getData();return t?t.competitionSearchFilter(e.football.competitions):e.football.competitions};setCompetitions=async t=>{let e=await this.getData(),i=[...e.football.competitions];i.push(...t),e.football.competitions=this.makeCompetitionsUnique(i),await this.setData(e)};getCompetitionsLength=async()=>(await this.getData()).football.competitions.length;getEntityById=async(t="",e="")=>(await this.getData()).football.ids.find(a=>{let r=G[this.idSchema];return a&&`${a[r]}`===e&&a.resource===t});getEntity=async(t,e,i)=>{let a=await this.getData();return Array.isArray(t)?a.football.ids.filter(r=>{let o=G[i];return r&&t.includes(`${r[o]}`)&&r.resource===e}):a.football.ids.find(r=>{let o=G[i];return r&&`${r[o]}`===t&&r.resource===e})};checkForExistingIdObjs=async(t,e)=>{let i=G[e],a={};for(let r of Object.keys(t)){let o=t[r],l=(await this.getEntity(o,r,e)).map(c=>c[i]),p=t[r].filter(c=>!l.includes(c));a[r]=o.map(c=>p.includes(c)?{id:c,exists:!1}:{id:c,exists:!0})}return a};getIdsByType=async(t,e,i)=>{let a=await this.getData(),r=G[i],o=G[e],n={};return Object.keys(t).forEach(l=>{let p=t[l],c=[];a.football.ids.forEach(u=>{p.forEach((d,M)=>{d===u[o]&&l===u.resource&&(c[M]=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(Qp)}},ia=ea;it(ia,"instance");var Xc="FansUnited",Jc={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}}},aa=class{idSchema="";expirationProfileTimeout=600;expirationBadgesTimeout=3600;expirationClientFeaturesTimeout=14400;expirationFootballIdsTimeout=604800;constructor(t){this.idSchema=t}static getInstance(t){return aa.instance||(aa.instance=new aa(t)),aa.instance}clearData=async()=>{this.setData(Jc)};getEntityById=async(t="",e="")=>this.getData().football.ids.find(i=>{let a=G[this.idSchema];return i&&`${i[a]}`===e&&i.resource===t});getEntity=(t,e,i)=>Array.isArray(t)?this.getData().football.ids.filter(a=>{let r=G[i];return a&&t.includes(`${a[r]}`)&&a.resource===e}):this.getData().football.ids.find(a=>{let r=G[i];return a&&`${a[r]}`===t&&a.resource===e});getEntityByNativeId=(t="",e="")=>this.getData().football.ids.find(i=>i&&`${i.id}`===e&&i.resource===t);checkForExistingIdObjs=async(t,e)=>{let i=G[e],a={};return Object.keys(t).forEach(r=>{let o=t[r],l=this.getEntity(o,r,e).map(c=>c[i]),p=t[r].filter(c=>!l.includes(c));a[r]=o.map(c=>p.includes(c)?{id:c,exists:!1}:{id:c,exists:!0})}),a};getIdsByType=async(t,e,i)=>{let a=G[i],r=G[e],o={};return Object.keys(t).forEach(n=>{let l=t[n],p=[];this.getData().football.ids.forEach(c=>{l.forEach((u,d)=>{u===c[r]&&n===c.resource&&(p[d]=c[a])})}),o[n]=p}),o};addIdMapping=t=>{let e=this.getData();e.football.ids.push(t),this.setData(e)};addIdMappings=async t=>{let e=this.getData(),i=e.football.ids;i=[...i,...t],e.football.ids=i,this.setData(e)};addTopIdMappings=async t=>{let e=this.getData();if(e.football.ids.length){let i=JSON.parse(JSON.stringify(e.football.ids));i=i.filter(a=>a.resource!=="match"),t=t.filter(a=>a.resource==="match"),i=[...i,...t],e.football.ids=i}else e.football.ids=t;e.football.expirations.ids=Math.floor(Date.now()/1e3)+this.expirationFootballIdsTimeout,this.setData(e)};setOwnProfile=async t=>{let e=this.getData();e.profile.info=t,e.profile.expirations.profile=Math.floor(Date.now()/1e3)+this.expirationProfileTimeout,this.setData(e)};getOwnProfile=()=>this.getData().profile.info;getProfileCountries=()=>this.getData().profile.countries;setProfileCountries=async t=>{let e=this.getData();e.profile.countries=t,this.setData(e)};getProfileStats=()=>this.getData().profile.statistics;setProfileStats=async t=>{let e=this.getData();e.profile.statistics=t,e.profile.expirations.statistics=Math.floor(Date.now()/1e3)+this.expirationProfileTimeout,this.setData(e)};getProfileBadges=()=>this.getData().profile.badges;setProfileBadges=async t=>{let e=this.getData();e.profile.badges=t,e.profile.expirations.badges=Math.floor(Date.now()/1e3)+this.expirationBadgesTimeout,this.setData(e)};getFootballCountries=()=>this.getData().football.countries;setFootballCountries=async t=>{let e=this.getData();e.football.countries=t,this.setData(e)};getCompetitions=t=>{let e=this.getData();return t?t.competitionSearchFilter(e.football.competitions):e.football.competitions};setCompetitions=async t=>{let e=this.getData(),i=[...e.football.competitions];i.push(...t),e.football.competitions=this.makeCompetitionsUnique(i),this.setData(e)};getCompetitionsLength=async()=>{let{football:t}=this.getData();return t.competitions.length};getClientFeatures=()=>this.getData().client.features;setClientFeatures=async t=>{let e=this.getData(),i=JSON.parse(JSON.stringify(t));e.client.expirations.features=Math.floor(Date.now()/1e3)+this.expirationClientFeaturesTimeout,e.client.features=i,this.setData(e)};deleteClientFeatures=async()=>{let t=this.getData(),e=JSON.parse(JSON.stringify(t));e.client={features:{},expirations:{features:0}},this.setData(e)};getExpiration=async(t,e)=>{this.initialNewSchema(t,"expirations");let i=this.getData();switch(e){case"profile":return i.profile.expirations.profile;case"statistics":return i.profile.expirations.statistics;case"badges":return i.profile.expirations.badges;case"features":return i.client.expirations.features;case"ids":return i.football.expirations.ids}};makeCompetitionsUnique=t=>{let e=new Set;return t.filter(i=>{let a=!e.has(i.id);return e.add(i.id),a})};getData=()=>(localStorage.getItem(Xc)||this.setData(Jc),JSON.parse(localStorage.getItem(Xc)));setData=t=>{localStorage.setItem(Xc,JSON.stringify(t))};initialNewSchema=(t,e)=>{let i=this.getData();(!i||!i[t]||!i[t][e])&&this.setData(Jc)}},ra=aa;it(ra,"instance");var Uu=ad(Gu());var T=class{profileTTL=600;clientTTL=14400;profileBadgesTTL=3600;idMappingsExpiration=0;idSchema="";constructor(t){}static getInstance(t){return T.instance||(T.instance=new T(t),T.nodeCache.options.useClones=!1),T.instance}clearData=async()=>T.nodeCache.flushAll();getEntityById=async(t,e)=>{let i=T.nodeCache.get("ids");return i?i.find(a=>{let r=G[this.idSchema];return a&&`${a[r]}`===e&&a.resource===t}):null};getEntity=async(t,e,i)=>{let a=T.nodeCache.get("ids");return a?Array.isArray(t)?[]:null:Array.isArray(t)?a.filter(r=>{let o=G[i];return r&&t.includes(`${r[o]}`)&&r.resource===e}):a.find(r=>{let o=G[i];return r&&`${r[o]}`===t&&r.resource===e})};checkForExistingIdObjs=async(t,e)=>{let i=G[e],a={};for(let r of Object.keys(t)){let o=t[r],l=(await this.getEntity(o,r,e)).map(c=>c[i]),p=t[r].filter(c=>!l.includes(c));a[r]=o.map(c=>p.includes(c)?{id:c,exists:!1}:{id:c,exists:!0})}return a};getIdsByType=async(t,e,i)=>{let a=G[i],r=G[e],o=T.nodeCache.get("ids"),n={};return o?(Object.keys(t).forEach(l=>{let p=t[l],c=[];o.forEach(u=>{p.forEach((d,M)=>{d===u[r]&&l===u.resource&&(c[M]=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"}}},gi=T;it(gi,"instance"),it(gi,"nodeCache",new Uu.default);var ct=class{createLocalCacheInstance=t=>typeof window>"u"?gi.getInstance(t):typeof __DEV__<"u"?ia.getInstance(t):ra.getInstance(t)};var yi=class{localCache=null;https=null;constructor(t){this.localCache=new ct().createLocalCacheInstance(t.idSchema),this.https=new Vn(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 M=l[c].length&&l[c][d]?l[c][d]:"";p.set(u,M)})}),p}catch(a){return console.warn("There was a problem retrieving the entity ids ",a),Promise.resolve(new Map)}};getEntityById=async(t,e,i)=>{let a=await this.localCache.getEntity(t,e,i);if(a)return a;let r=await this.requestEntity(t,e,i);return await this.localCache.addIdMappings(r),r&&r.length>0?r[0]:null};splitForRequestAndExisting=t=>{let e={},i={};return Object.keys(t).forEach(a=>{e[a]=t[a].filter(r=>!r.exists).map(r=>r.id),i[a]=t[a].filter(r=>r.exists).map(r=>r.id)}),{existing:i,request:e}};requestEntity=async(t,e,i)=>{try{return t=Array.isArray(t)?t:[t],await this.https.getEntitiesByIds(e,t,i)}catch(a){return console.warn(`There was a problem retrieving the requested entity: ${a}`),null}};setTopIdMappings=async()=>{let t=Math.floor(Date.now()/1e3);if(await this.localCache.getExpiration("football","ids")>t)return Promise.resolve();let i=await this.https.getTopEntities();await this.localCache.addTopIdMappings(i)}};var Yp=s=>{switch(s){case"competitions":return"competition";case"players":case"relatedPlayer":case"squad":return"player";case"teams":case"participants":case"homeTeam":case"awayTeam":case"timeline":case"teamId":return"team";default:return s}};var Hn=class{extractedObjIds={};traverse=(t,e)=>(e=Yp(e),Array.isArray(t)?this.traverseArrExtract(t,e):t&&typeof t=="object"&&this.traverseObjExtract(t,e),this.extractedObjIds);traverseArrExtract=(t,e)=>{t&&t.length>0&&t.forEach(i=>{this.traverseObjExtract(i,e)})};traverseObjExtract=(t,e)=>{t&&Object.keys(t).length>0&&Object.keys(t).forEach(i=>{let a=t[i];i==="id"||i==="teamId"?(this.extractedObjIds.hasOwnProperty(e)||(this.extractedObjIds[e]=[]),a&&this.extractedObjIds[e].push(a)):t[i]&&this.traverse(t[i],i)})}};var $n=class{replaceObjIdsIndex=null;remappedIdsObj={};traverse=(t,e,i)=>(e=Yp(e),this.replaceObjIdsIndex===null&&(this.initReplaceObjIdsIndex(i),this.remappedIdsObj=i),Array.isArray(t)?this.traverseArrReplace(t,e):t&&typeof t=="object"&&this.traverseObjReplace(t,e),t);initReplaceObjIdsIndex=t=>{this.replaceObjIdsIndex={},Object.keys(t).forEach(e=>{this.replaceObjIdsIndex[e]=0})};traverseArrReplace=(t,e)=>{t&&t.length>0&&t.forEach(i=>{this.traverseObjReplace(i,e)})};traverseObjReplace=(t,e)=>{t&&Object.keys(t).length>0&&Object.keys(t).forEach(i=>{i==="id"||i==="teamId"?t[i]&&(t[i]=this.remappedIdsObj[e][this.replaceObjIdsIndex[e]],this.replaceObjIdsIndex[e]=this.replaceObjIdsIndex[e]+1):t[i]&&this.traverse(t[i],i,this.remappedIdsObj)})}};var R=class{idSchema="";idMappingFacade=null;constructor(t){this.idSchema=t.idSchema,this.idMappingFacade=new yi(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 Hn().traverse(i,e);return this.idMappingFacade.getEntitiesByIds(r,"native",this.idSchema).then(o=>new $n().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 wt=class{idSchema;idMapping;constructor(t){this.idSchema=t.idSchema,this.idMapping=new R(t)}remapTagsIds=async(t,e,i)=>{if(!t||!t.length)return t;let a={},r={},o=[];t.forEach(l=>{a.hasOwnProperty(l.type)||(a[l.type]=[],r[l.type]=[]),a[l.type].push(l.id),r[l.type].push(l)});let n=await this.idMapping.idMappingFacade.getEntitiesByIds(a,e,i);for(let[l,p]of Object.entries(r))p.forEach((c,u)=>{c.id=n[l][u],o.push(c)});return o}};var ge=class{page=null;limit=null;constructor(t){this.page=t.page?t.page:null,this.limit=t.limit?t.limit:null}};var sa=class extends ge{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 na=class extends ge{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 zn=class{idSchema;activityHttps;activityService;constructor(t){this.idSchema=t.idSchema,this.activityHttps=new hi(t),this.activityService=new wt(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 fi(t,n,i,a),p=await this.activityHttps.createActivity(l);return p.context.tags=o,p}let r=new fi(t,e,i,a);return this.activityHttps.createActivity(r)};delete=async t=>await this.activityHttps.deleteActivity(t);like=async(t,e,i)=>{let a="like";return await this.add(a,t,e,i)};dislike=async(t,e,i)=>{let a="dislike";return await this.add(a,t,e,i)};addPageview=async(t,e,i)=>{let a="page_view";return await this.add(a,t,e,i)};addContentConsumed=async(t,e,i)=>{let a="content_consumed";return await this.add(a,t,e,i)};addShare=async(t,e,i)=>{let a="share";return await this.add(a,t,e,i)};addComment=async(t,e,i)=>{let a="comment";return await this.add(a,t,e,i)};addClickAd=async(t,e,i)=>{let a="click_ad";return await this.add(a,t,e,i)};addConvert=async(t,e,i)=>{let a="convert";return await this.add(a,t,e,i)};getOwn=async(t,e)=>{if(e=e||!1,t&&(t=new sa(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 na(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 qn=class{activityFacade;constructor(t){this.activityFacade=new zn(t)}add=async(t,e,i,a)=>await this.activityFacade.add(t,e,i,a);delete=async t=>await this.activityFacade.delete(t);like=async(t,e,i)=>await this.activityFacade.like(t,e,i);dislike=async(t,e,i)=>await this.activityFacade.dislike(t,e,i);addPageview=async(t,e,i)=>await this.activityFacade.addPageview(t,e,i);addContentConsumed=async(t,e,i)=>await this.activityFacade.addContentConsumed(t,e,i);addShare=async(t,e,i)=>await this.activityFacade.addShare(t,e,i);addComment=async(t,e,i)=>await this.activityFacade.addComment(t,e,i);addClickAd=async(t,e,i)=>await this.activityFacade.addClickAd(t,e,i);addConvert=async(t,e,i)=>await this.activityFacade.addConvert(t,e,i);getOwn=async(t,e)=>await this.activityFacade.getOwn(t,e);getForUser=async(t,e,i)=>await this.activityFacade.getForUser(t,e,i)};var z=class{entityId=null;entityType=null;entityRelationship=null};var ye=class{participantOne=null;participantTwo=null};var la=class{matchId="";participantOne="";participantTwo="";winner="";homeParticipant="";startDate="";score=new ye};var be=class{participants=[]};var pa=class{id=null;name=null;group=null;image=null;undecided=!1};var ca=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 be;fixtures=[];createdAt=null;updatedAt=null};var ut=class{nextPageStartsAfter=null;itemsPerPage=null};var b=class{pagination=new ut};var ua=class{meta=new b;data=[]};var da=class{meta=new b;data=[]};var ma=class{statTiebreakerEnabled;statTotal};var ha=class{matchId="";participantOne="";participantTwo="";winner;correct=null};var Me=class{statTotal=0};var Vu=(r=>(r.ACTIVE="ACTIVE",r.WON="WON",r.LOST="LOST",r.PARTIALLY_WON="PARTIALLY_WON",r.CANCELED="CANCELED",r))(Vu||{}),fa=class{id="";profileId="";profileModel=null;gameId="";totalPoints=null;gamePoints=null;bonusPoints=null;position=null;status="ACTIVE";fixtures=[];tiebreaker=new Me;createdAt="";updatedAt=""};var ga=class{meta=new b;data=[]};var Qn=class{remapBracketGames=t=>{let e=new da;return e.meta.pagination.itemsPerPage=t.meta.pagination.items_per_page,e.meta.pagination.nextPageStartsAfter=t.meta.pagination.next_page_starts_after,e.data=t.data.map(i=>this.remapBracketGameById(i)),e};remapBracketGameById=t=>{let e=new ca;return e.id=t.id,e.title=t.title,e.description=t.description,e.rules=t.rules,e.customFields=t.custom_fields,e.images=t.images,e.type=t.type,e.status=t.status,e.points=t.points,e.related=t.related?this.remapRelated(t.related):t.related,e.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 fa;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 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 ga;return e.meta.pagination.itemsPerPage=t.meta.pagination.items_per_page,e.meta.pagination.nextPageStartsAfter=t.meta.pagination.next_page_starts_after,e.data=t.data.map(i=>this.remapPrediction(i)),e};remapRelated=t=>t.map(e=>{let i=new z;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 ha;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 Me;return e.statTotal=t.stat_total,e};remapBracketGameMeta=t=>{let e=new be;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};remapBracketGameFixtures=t=>t.map(e=>{let i=new la;return i.matchId=e.match_id,i.participantOne=e.participant_one,i.participantTwo=e.participant_two,i.winner=e.winner,i.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 ye;return e.participantOne=t.participant_one,e.participantTwo=t.participant_two,e};remapBracketGameTiebreaker=t=>{let e=new ma;return e.statTiebreakerEnabled=t.stat_tiebreaker_enabled,e.statTotal=t.stat_total,e}};var Ie=class{participants=[]};var ya=class{id=null;title=null;description=null;rules=null;customFields=null;images=null;type="STANDING";status=null;points=null;related=[];predictionsCutoff="";meta=new Ie;outcomeCount=null;outcome=[];createdAt=null;updatedAt=null};var ba=class{meta=new b;data=[]};var Ma=class{id=null;name=null;group=null;image=null;undecided=!1};var Ia=class{id="";profileId="";profileModel=null;total=0;gameId="";totalPoints=null;gamePoints=null;bonusPoints=null;position=null;status="ACTIVE";standing=[];createdAt="";updatedAt=""};var wa=class{meta=new b;data=[]};var _a=class{meta=new b;data=[]};var Wn=class{remapBracketGames=t=>{let e=new ba;return e.meta.pagination.itemsPerPage=t.meta.pagination.items_per_page,e.meta.pagination.nextPageStartsAfter=t.meta.pagination.next_page_starts_after,e.data=t.data.map(i=>this.remapStandingGameById(i)),e};remapStandingGameById=t=>{let e=new ya;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 Ia;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 wa;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 _a;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 z;return i.entityId=e.entity_id,i.entityType=e.entity_type,i.entityRelationship=e.entity_relationship,i});remapStandingGameMeta=t=>{let e=new Ie;return e.participants=t.participants.map(i=>{let a=new Ma;return a.id=i.id,a.name=i.name,a.group=i.group,a.image=i.image,a.undecided=i.undecided,a}),e}};var Pa=class{meta=new b;data=[]};var Ta=class{statTiebreakerEnabled;statTotal};var we=class{statTotal=0};var Hu=(r=>(r.ACTIVE="ACTIVE",r.WON="WON",r.LOST="LOST",r.PARTIALLY_WON="PARTIALLY_WON",r.CANCELED="CANCELED",r))(Hu||{}),Ea=class{id="";profileId="";profileModel=null;gameId="";gamePoints=null;bonusPoints=null;totalPoints=null;position=null;status="ACTIVE";fixtures=[];tiebreaker=new we;createdAt="";updatedAt=""};var Ra=class{meta=new b;data=[]};var Fa=class{id=null;title=null;description=null;images=null;rules=null;customFields=null;type="EVENT";status=null;points=null;related=[];tiebreaker=null;predictionsCutoff=null;fixtures=[];createdAt=null;updatedAt=null};var Xp=(a=>(a.BOOLEAN="BOOLEAN",a.NUMBER="NUMBER",a.ENUM="ENUM",a.FREE_INPUT="FREE_INPUT",a))(Xp||{});var At=class{id="";question="";status="ACTIVE";voidReason=null;points=0;outcomeType=null;validOutcomes=null;outcome=null};var Ot=class{id="";predictionType;prediction;correct=null;points=0};var Sa=class{meta=new b;data=[]};var Kn=class{remapEventGames=t=>{let e=new Pa;return e.meta.pagination.itemsPerPage=t.meta.pagination.items_per_page,e.meta.pagination.nextPageStartsAfter=t.meta.pagination.next_page_starts_after,e.data=t.data.map(i=>this.remapEventGameById(i)),e};remapEventGameById=t=>{let e=new Fa;return e.id=t.id,e.title=t.title,e.description=t.description,e.rules=t.rules,e.customFields=t.custom_fields,e.images=t.images,e.type=t.type,e.status=t.status,e.points=t.points,e.related=t.related?this.remapRelated(t.related):t.related,e.tiebreaker=t.tiebreaker?this.remapEventGameTiebreaker(t.tiebreaker):t.tiebreaker,e.predictionsCutoff=t.predictions_cutoff,e.fixtures=t.fixtures?this.remapEventGameFixtures(t.fixtures):t.fixtures,e.createdAt=t.created_at,e.updatedAt=t.updated_at,e};remapPredictionToRequestBody=t=>t.map(e=>({id:e.id,prediction_type:e.predictionType,prediction:e.prediction}));remapPrediction=t=>{let e=new Ea;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 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};remapRankings=t=>{let e=new Ra;return e.meta.pagination.itemsPerPage=t.meta.pagination.items_per_page,e.meta.pagination.nextPageStartsAfter=t.meta.pagination.next_page_starts_after,e.data=t.data.map(i=>this.remapPrediction(i)),e};remapRelated=t=>t.map(e=>{let i=new z;return i.entityId=e.entity_id,i.entityType=e.entity_type,i.entityRelationship=e.entity_relationship,i});remapPredictionFixtures=t=>t.map(e=>{let i=new Ot;switch(e.prediction_type){case"BOOLEAN":i=new Ot;break;case"NUMBER":i=new Ot;break;case"ENUM":i=new Ot;break;case"FREE_INPUT":i=new Ot;break}return i.id=e.id,i.predictionType=e.prediction_type,i.prediction=e.prediction,i.points=e.points,i.correct=e.correct,i});remapPredictionTiebreaker=t=>{let e=new we;return e.statTotal=t.stat_total,e};remapEventGameFixtures=t=>t.map(e=>{let i=new At;switch(e.outcome_type){case"BOOLEAN":i=new At;break;case"NUMBER":i=new At;break;case"ENUM":i=new At;break;case"FREE_INPUT":i=new At;break}return i.id=e.id,i.question=e.question,i.status=e.status,i.voidReason=e.void_reason,i.points=e.points,i.outcomeType=e.outcome_type,i.validOutcomes=e.valid_outcomes,i.outcome=e.outcome,i});remapEventGameTiebreaker=t=>{let e=new Ta;return e.statTiebreakerEnabled=t.stat_tiebreaker_enabled,e.statTotal=t.stat_total,e}};var yd={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:""},Kt=class extends v{bracketGameRemapper=null;standingGameRemapper=null;eventGameRemapper=null;constructor(t){super(t,O(t.environment,"predictor")),this.bracketGameRemapper=new Qn,this.standingGameRemapper=new Wn,this.eventGameRemapper=new Kn}getBracketGames=async(t,e)=>{let i=t?`/custom/bracket${this.apiSignInUrl}${t.constructMainFiltersUrl()}`:`/custom/bracket${this.apiSignInUrl}`;f(e)&&(i+=m());let a="There was a problem with fetching bracket games list",r=await this.fetchWithoutAuth(i,a);return this.bracketGameRemapper.remapBracketGames(r)};getBracketGameById=async(t,e)=>{let i=f(e)?`/custom/bracket/${t}${this.apiSignInUrl}${m()}`:`/custom/bracket/${t}${this.apiSignInUrl}`,a="There was a problem with fetching bracket game with the following ID: "+t,r=await this.fetchWithoutAuth(i,a);return this.bracketGameRemapper.remapBracketGameById(r)};makeBracketGamePrediction=async(t,e)=>{let i=`/custom/bracket/${t}/predictions${this.apiSignInUrl}`,a="There was a problem with making prediction for bracket game with the following ID: "+t,r="POST",o=JSON.parse(JSON.stringify(e));o.fixtures=this.bracketGameRemapper.remapPredictionToRequestBody(e.fixtures),e.tiebreaker&&(o.tiebreaker={stat_total:e.tiebreaker.statTotal});let n=await this.fetchWithAuth(i,a,r,o);return this.bracketGameRemapper.remapPrediction(n)};updateBracketGamePrediction=async(t,e,i)=>{let a=`/custom/bracket/${t}/predictions/${e}${this.apiSignInUrl}`,r="There was a problem with updating prediction for bracket game with the following ID: "+t,o="PUT",n=JSON.parse(JSON.stringify(i));n.fixtures=this.bracketGameRemapper.remapPredictionToRequestBody(i.fixtures),i.tiebreaker&&(n.tiebreaker={stat_total:i.tiebreaker.statTotal});let l=await this.fetchWithAuth(a,r,o,n);return this.bracketGameRemapper.remapPrediction(l)};getBracketGamePredictionsForUser=async(t,e,i,a)=>{let r=i?`/custom/bracket/${t}/predictions${this.apiSignInUrl}&profile_id=${e}${i.constructMainFiltersUrl()}`:`/custom/bracket/${t}/predictions${this.apiSignInUrl}&profile_id=${e}`;f(a)&&(r+=m());let o=`There was a problem with getting all predictions for user with ID ${e} for bracket game with ID ${t}`,n=await this.fetchWithoutAuth(r,o);return this.bracketGameRemapper.remapPredictionsForUser(n)};getBracketGamePredictionById=async(t,e,i)=>{let a=f(i)?`/custom/bracket/${t}/predictions/${e}/${this.apiSignInUrl}${m()}`:`/custom/bracket/${t}/predictions/${e}/${this.apiSignInUrl}`,r=`There was a problem with getting prediction with ID ${e} for bracket game with ID ${t}`,o=JSON.parse(JSON.stringify(yd));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+=m());let r=`There was a problem with getting rankings for bracket game with ID ${t}`,o=await this.fetchWithoutAuth(a,r);return this.bracketGameRemapper.remapRankings(o)};getStandingsGames=async(t,e)=>{let i=t?`/custom/standing${this.apiSignInUrl}${t.constructMainFiltersUrl()}`:`/custom/standing${this.apiSignInUrl}`;f(e)&&(i+=m());let a="There was a problem with fetching standings games list",r=await this.fetchWithoutAuth(i,a);return this.standingGameRemapper.remapBracketGames(r)};getStandingGameById=async(t,e)=>{let i=f(e)?`/custom/standing/${t}${this.apiSignInUrl}${m()}`:`/custom/standing/${t}${this.apiSignInUrl}`,a="There was a problem with fetching standing game with the following ID: "+t,r=await this.fetchWithoutAuth(i,a);return this.standingGameRemapper.remapStandingGameById(r)};makeStandingGamePrediction=async(t,e)=>{let i=`/custom/standing/${t}/predictions${this.apiSignInUrl}`,a="There was a problem with making prediction for standing game with the following ID: "+t,r="POST",o={standing:e},n=await this.fetchWithAuth(i,a,r,o);return this.standingGameRemapper.remapPrediction(n)};updateStandingGamePrediction=async(t,e,i)=>{let a=`/custom/standing/${t}/predictions/${e}${this.apiSignInUrl}`,r="There was a problem with updating prediction for standing game with the following ID: "+t,o="PUT",n={standing:i},l=await this.fetchWithAuth(a,r,o,n);return this.standingGameRemapper.remapPrediction(l)};getStandingGamePredictionsForUser=async(t,e,i)=>{let a=`/custom/standing/${t}/predictions${this.apiSignInUrl}&profile_id=${e}`;f(i)&&(a+=m());let r=`There was a problem with getting prediction for user with ID ${e} for standing game with ID ${t}`,o=await this.fetchWithoutAuth(a,r);return this.standingGameRemapper.remapPredictionsForUser(o)};getStandingGameRankings=async(t,e,i)=>{let a=e?`/custom/standing/${t}/ranking${this.apiSignInUrl}${e.constructMainFiltersUrl()}`:`/custom/standing/${t}/ranking${this.apiSignInUrl}`;f(i)&&(a+=m());let r=`There was a problem with getting rankings for standing game with ID ${t}`,o=await this.fetchWithoutAuth(a,r);return this.standingGameRemapper.remapRankings(o)};getEventGames=async(t,e)=>{let i=t?`/custom/event${this.apiSignInUrl}${t.constructMainFiltersUrl()}`:`/custom/event${this.apiSignInUrl}`;f(e)&&(i+=m());let a="There was a problem with fetching event games list",r=await this.fetchWithoutAuth(i,a);return this.eventGameRemapper.remapEventGames(r)};getEventGameById=async(t,e)=>{let i=f(e)?`/custom/event/${t}${this.apiSignInUrl}${m()}`:`/custom/event/${t}${this.apiSignInUrl}`,a="There was a problem with fetching event game with the following ID: "+t,r=await this.fetchWithoutAuth(i,a);return this.eventGameRemapper.remapEventGameById(r)};makeEventGamePrediction=async(t,e)=>{let i=`/custom/event/${t}/predictions${this.apiSignInUrl}`,a="There was a problem with making prediction for event game with the following ID: "+t,r="POST",o=JSON.parse(JSON.stringify(e));o.fixtures=this.eventGameRemapper.remapPredictionToRequestBody(e.fixtures),e.tiebreaker&&(o.tiebreaker={stat_total:e.tiebreaker.statTotal});let n=await this.fetchWithAuth(i,a,r,o);return this.eventGameRemapper.remapPrediction(n)};updateEventGamePrediction=async(t,e,i)=>{let a=`/custom/event/${t}/predictions/${e}${this.apiSignInUrl}`,r="There was a problem with updating prediction for event game with the following ID: "+t,o="PUT",n=JSON.parse(JSON.stringify(i));n.fixtures=this.eventGameRemapper.remapPredictionToRequestBody(i.fixtures),i.tiebreaker&&(n.tiebreaker={stat_total:i.tiebreaker.statTotal});let l=await this.fetchWithAuth(a,r,o,n);return this.eventGameRemapper.remapPrediction(l)};getEventGamePredictionsForUser=async(t,e,i,a)=>{let r=i?`/custom/event/${t}/predictions${this.apiSignInUrl}&profile_id=${e}${i.constructMainFiltersUrl()}`:`/custom/event/${t}/predictions${this.apiSignInUrl}&profile_id=${e}`;f(a)&&(r+=m());let o=`There was a problem with getting all predictions for user with ID ${e} for event game with ID ${t}`,n=await this.fetchWithoutAuth(r,o);return this.eventGameRemapper.remapPredictionsForUser(n)};getEventGameRankings=async(t,e,i)=>{let a=e?`/custom/event/${t}/ranking${this.apiSignInUrl}${e.constructMainFiltersUrl()}`:`/custom/event/${t}/ranking${this.apiSignInUrl}`;f(i)&&(a+=m());let r=`There was a problem with getting rankings for event game with ID ${t}`,o=await this.fetchWithoutAuth(a,r);return this.eventGameRemapper.remapRankings(o)}};var _e=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 va=class extends _e{email=null;phoneNumber=null;phoneCountryCode=null;preferences=null};var jn=class{profilesFromResponse=t=>t?t.map(e=>this.publicProfileFromResponse(e)):null;fullProfileFromResponse=t=>{let e=new va;return e.id=t.id,e.name=t.name,e.email=t.email,e.nickname=t.nickname,e.avatar=t.avatar,e.gender=t.gender,e.country=t.country,e.birthDate=t.birth_date,e.phoneCountryCode=t.phone_country_code,e.phoneNumber=t.phone_number,e.verified=t.verified,e.staffMember=t.staff_member,e.anonymous=t.anonymous,e.disabled=t.disabled,e.interests=t.interests?t.interests:[],e.preferences=t.preferences?this.remapPreferences(t.preferences):[],e.followingCount=t.following_count,e.followersCount=t.followers_count,e};publicProfileFromResponse=t=>{let e=new _e;return e.id=t.id,e.name=t.name,e.nickname=t.nickname,e.avatar=t.avatar,e.gender=t.gender,e.country=t.country,e.birthDate=t.birth_date,e.verified=t.verified,e.staffMember=t.staff_member,e.anonymous=t.anonymous,e.disabled=t.disabled,e.interests=t.interests?t.interests:[],e.followingCount=t.following_count,e.followersCount=t.followers_count,e};remapPreferences=t=>t.map(e=>({preferenceId:e.preference_id,categories:e.categories,source:e.source}))};var H=class{meta=new b;data=[]};var Ca=class{avatar=null;followingId=null;name=null;nickname=null;profileId=null};var Yn=class{followResponse=t=>t.map(e=>this.remapResponse(e));followingFromResponse=t=>{let e=new H;return e.meta.pagination.nextPageStartsAfter=t.meta.pagination.next_page_starts_after,e.meta.pagination.itemsPerPage=t.meta.pagination.items_per_page,e.data=t.data.map(i=>this.remapResponse(i)),e};remapResponse=t=>{let e=new Ca;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 Aa=class{avatar=null;followerId=null;name=null;nickname=null;profileId=null};var Oa=class{followsMe=[];iFollow=[];followsMeBack=[]};var Xn=class{followersFromResponse=t=>{let e=new H;return e.meta.pagination.nextPageStartsAfter=t.meta.pagination.next_page_starts_after,e.meta.pagination.itemsPerPage=t.meta.pagination.items_per_page,e.data=t.data.map(i=>this.remapResponse(i)),e};followStatusFromResponse=t=>{let e=new Oa;return e.iFollow=t.i_follow,e.followsMe=t.follows_me,e.followsMeBack=t.follows_me_back,e};remapResponse=t=>{let e=new Aa;return e.avatar=t.avatar,e.followerId=t.follower_id,e.name=t.name,e.profileId=t.profile_id,e}};var bi=class{profile_ids=[]};var xa=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 Jn=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 xa;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 bd="/countries",rt="/profile",Jp="/profiles",Mi=class extends v{profileRemapper=null;followingRemapper=null;followersRemapper=null;leadRemapper=null;lang=null;limitIds=100;constructor(t){super(t,O(t.environment,"profile")),this.lang=t.lang,this.profileRemapper=new jn,this.followingRemapper=new Yn,this.followersRemapper=new Xn,this.leadRemapper=new Jn}getCountries=async t=>{let e=`&lang=${this.lang}`,i=`${bd}${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=`${rt}${this.apiSignInUrl}`,i="";if(t){e=`${Jp}/${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=qt(t,this.limitIds);for(let d of u){let M=`${Jp}${this.apiSignInUrl}&profile_ids=${d.join(",")}`;r=`There was a problem fetching the following profiles: ${d.join(",")}`,i&&(M+=`&disable_cache=${a}`);let _=await this.fetchWithoutAuth(M,r);c.push(...this.profileRemapper.profilesFromResponse(_.data))}return c}let l=`${Jp}${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=`${Jp}${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=`${rt}/followers${this.apiSignInUrl}`,a="There was a problem fetching the followers for own profile";if(t&&!e){i=`${rt}/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=`${rt}/${e}/followers${this.apiSignInUrl}${t.constructFilterUrl()}`:!t&&e&&(i=`${rt}/${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=`${rt}/following${this.apiSignInUrl}`,a="There was a problem fetching the followers of own profile";if(t&&!e){i=`${rt}/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=`${rt}/${e}/following${this.apiSignInUrl}${t.constructFilterUrl()}`:!t&&e&&(i=`${rt}/${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 bi;e.profile_ids=t;let i=rt+`/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 bi;e.profile_ids=t;let i=rt+`/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=`${rt}/badges${this.apiSignInUrl}`,i="There was a problem with fetching own badges";return t?(e=`${rt}/${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=rt+this.apiSignInUrl,i="There was a problem updating the own profile",a="PATCH",r=await this.fetchWithAuth(e,i,a,t);return this.profileRemapper.fullProfileFromResponse(r.data)};collectLead=async t=>{let e=`/leads${this.apiSignInUrl}`,i="There was a problem collecting lead",a="POST",r=await this.fetchWithAuth(e,i,a,this.leadRemapper.toRequest(t));return this.leadRemapper.fromResponse(r.data)};checkFollowStatus=async t=>{let e=`/profile/followers/check-follow-status${this.apiSignInUrl}&profile_ids=${t.join(",")}`,i="There was a problem checking follow status for profiles",a=await this.fetchWithAuth(e,i);return this.followersRemapper.followStatusFromResponse(a.data)};deleteOwnProfile=async()=>{let t=`/profile${this.apiSignInUrl}`,e="There was a problem deleting own profile",i="DELETE";await this.fetchWithAuth(t,e,i)};deleteUserData=async()=>{let t=`/user-data${this.apiSignInUrl}`,e="There was a problem deleting profile data",i="DELETE";await this.fetchWithAuth(t,e,i)}};var J=class{completed=!1;percentage;constructor(t){this.percentage=t}};var La=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 Da=class{totalPercentage;breakdown=new La};var Ii=class{limit=0;startAfter=null;constructor(t){this.limit=t.limit?t.limit:20,this.startAfter=t.startAfter?t.startAfter:null}constructFilterUrl=()=>{let t="";return this.limit&&(t=t+"&",t=t+`limit=${this.limit}`),this.startAfter&&(t=t+"&",t=t+`start_after=${this.startAfter}`),t}};var y=class extends Error{code=0;status=null;message=null;constructor(t,e,i){super(),this.code=t,this.status=e,this.message=i}errorMessage=()=>this.message};var _t=class{localCache;profileHttps=null;activityHttps=null;errorHandlingMode=null;constructor(t,e,i,a){this.localCache=t,this.profileHttps=e,this.activityHttps=i,this.errorHandlingMode=a}getOwn=async()=>{let t=await this.getLocalStorageData("profile");if(t&&Object.keys(t).length)return JSON.parse(JSON.stringify(t));try{let e=await this.profileHttps.getProfile();return await this.localCache.setOwnProfile(e),e}catch(e){throw console.warn("There was a problem retrieving your profile: ",e),e}};getOwnProfileFromCache=async()=>await this.localCache.getOwnProfile();updateOwnProfile=async()=>{try{let t=await this.profileHttps.getProfile();return await this.localCache.setOwnProfile(t),t}catch(t){throw console.warn("There was a problem retrieving your profile: ",t),t}};getByIds=async(t,e,i)=>{if(t&&t.length>0&&e||!t&&t.length===0&&!e)throw new h(400,"invalid_method_call","The method 'getByIds' from Profile namespace is not called correctly. You need to provide 'profileIds' OR 'search' parameters to the method, but you can't use both of them or neither of them.");try{return await this.profileHttps.getProfiles(t,e,i)}catch(a){throw console.warn(`There was a problem retrieving the selected profiles: ${t.join(",")} `,a),a}};getById=async t=>{try{return await this.profileHttps.getProfile(t)}catch(e){throw console.warn(`There was a problem retrieving the selected profile: ${t} `,e),e}};getCountries=async t=>{t=t||!1;let e=await this.localCache.getProfileCountries();if(e&&e.length>0)return e;try{let i=await this.profileHttps.getCountries(t);return await this.localCache.setProfileCountries(i),i}catch(i){throw console.warn("There was a problem retrieving profile countries: ",i),i}};getFollowers=async(t,e)=>{try{t&&(t=new Ii(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 Ii(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 Da,i=0;return t.avatar&&(e.breakdown.addedAvatar.completed=!0,i+=e.breakdown.addedAvatar.percentage),t.birthDate&&(e.breakdown.addedBirthdate.completed=!0,i+=e.breakdown.addedBirthdate.percentage),t.country&&(e.breakdown.addedCountry.completed=!0,i+=e.breakdown.addedCountry.percentage),t.gender&&(e.breakdown.addedGender.completed=!0,i+=e.breakdown.addedGender.percentage),t.interests&&t.interests.length>0&&(t.interests.find(c=>c.type==="team"&&c.favourite)&&(e.breakdown.teamFavourite.completed=!0,i+=e.breakdown.teamFavourite.percentage),t.interests.find(c=>c.type==="team")&&(e.breakdown.teamFollowed.completed=!0,i+=e.breakdown.teamFollowed.percentage),t.interests.find(c=>c.type==="player"&&c.favourite)&&(e.breakdown.playerFavourite.completed=!0,i+=e.breakdown.playerFavourite.percentage),t.interests.find(c=>c.type==="player")&&(e.breakdown.playerFollowed.completed=!0,i+=e.breakdown.playerFollowed.percentage),t.interests.find(c=>c.type==="competition"&&c.favourite)&&(e.breakdown.competitionFavourite.completed=!0,i+=e.breakdown.competitionFavourite.percentage),t.interests.find(c=>c.type==="competition")&&(e.breakdown.competitionFollowed.completed=!0,i+=e.breakdown.competitionFollowed.percentage)),e.totalPercentage=i,e};getStats=async()=>{let t=await this.getLocalStorageData("statistics");if(t&&Object.keys(t).length)return JSON.parse(JSON.stringify(t));try{let e=await this.activityHttps.getStats();return await this.localCache.setProfileStats(e),e}catch(e){throw console.warn("There was a problem retrieving own profile statistics: ",e),e}};getBadges=async t=>{if(t)try{return await this.profileHttps.getBadges()}catch(i){throw console.warn("There was a problem retrieving own profile badges: ",i),i}let e=await this.getLocalStorageData("badges");if(e)return e;try{let i=await this.profileHttps.getBadges();return await this.localCache.setProfileBadges(i),i}catch(i){throw console.warn("There was a problem retrieving own profile badges: ",i),i}};clearLocalStorageData=async()=>{await this.localCache.setOwnProfile({}),await this.localCache.setProfileStats({}),await this.localCache.setProfileBadges(null)};collectLead=async t=>{if(this.errorHandlingMode&&!t)throw this.errorHandlingMode==="standard"?new h(400,"invalid_method_call","The method 'collectLead' from Profile namespace is not called correctly. You need to provide 'requestBody' parameter to the method."):new y(400,"invalid_method_call","The method 'collectLead' from Profile namespace is not called correctly. You need to provide 'requestBody' parameter to the method.");return await this.profileHttps.collectLead(t)};checkFollowStatus=async t=>{if(!t||!Array.isArray(t)||t.length===0)throw this.errorHandlingMode==="standard"?new h(400,"invalid_method_call","Invalid or empty IDs provided. Please provide at least one ID."):new y(400,"invalid_method_call","Invalid or empty IDs provided. Please provide at least one ID.");return await this.profileHttps.checkFollowStatus(t)};getLocalStorageData=async t=>{let e=Math.floor(Date.now()/1e3),i=await this.localCache.getExpiration("profile",t);switch(t){case"profile":if(i>e)return await this.localCache.getOwnProfile();case"statistics":if(i>e)return await this.localCache.getProfileStats();case"badges":if(i>e)return await this.localCache.getProfileBadges();default:return null}}};var Ba=class{id=null;name=null;assets=null};var Zn=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 tl=class{idsRemapper=null;profileHttps=null;profileService=null;localCache=null;profileFacade=null;ownProfile=null;modified=!1;expireAt=0;promises=[];isFetching=!1;configuration=null;newProfileCheckResult=null;fetchProfilePromise=null;constructor(t,e,i,a,r){this.configuration=t,this.idsRemapper=e,this.localCache=i,this.profileHttps=a,this.profileService=new Zn,this.profileFacade=new _t(i,a,r)}getOwnProfile=async()=>{for(;this.isFetching;)console.log("Another thread is fetching profile..."),await this.delay(100);if(this.modified&&this.ownProfile)return console.log("Timestamp is less than 10 minutes OR profile is modifying "),this.ownProfile;let t=Math.floor(Date.now()/1e3);if(this.newProfileCheckResult===null&&(this.newProfileCheckResult=await this.isNewProfileRequested()),!this.ownProfile||this.expireAt<t||this.newProfileCheckResult){if(this.fetchProfilePromise)return await this.fetchProfilePromise;this.fetchProfilePromise=this.doFetchProfile();try{return await this.fetchProfilePromise}finally{this.fetchProfilePromise=null}}return this.ownProfile};doFetchProfile=async()=>{this.isFetching=!0,this.expireAt=Math.floor(Date.now()/1e3)+600;try{await this.clearAllProfileData();let t=await this.profileFacade.getOwn();return this.setOwnProfile(t),this.modified=!1,this.isFetching=!1,this.ownProfile}catch(t){throw this.isFetching=!1,t}};delay=t=>new Promise(e=>{setTimeout(e,t)});setOwnProfile=t=>{this.ownProfile=t};resetProfileCheckResult=()=>{this.newProfileCheckResult=null};getInfo=async()=>{this.resetProfileCheckResult();let t=await this.getOwnProfile(),e=JSON.parse(JSON.stringify(t));return delete e.interests,e};showInterests=async()=>{this.resetProfileCheckResult();let t=await this.getOwnProfile(),e=JSON.parse(JSON.stringify(t));return await this.idsRemapper.remapInterests(e.interests)};showFullInterests=async()=>{this.resetProfileCheckResult();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 Ba,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()=>{this.resetProfileCheckResult();let t=await this.getOwnProfile(),e=JSON.parse(JSON.stringify(t));return this.profileFacade.showFullnessProfile(e)};setAvatarPromise=async t=>{if(this.modified=!0,await this.getOwnProfile(),this.profileService.isAvatarValidURL(t))this.ownProfile.avatar=t;else{if(this.configuration.errorHandlingMode==="default")throw new y(400,"invalid_avatar","Invalid URL syntax for avatar image.");if(this.configuration.errorHandlingMode==="standard")throw new h(400,"invalid_avatar","Invalid URL syntax for avatar image.")}return this};setAvatar=t=>(this.promises.push(this.setAvatarPromise(t)),this);delete=async()=>(await this.profileHttps.deleteOwnProfile(),await this.profileFacade.clearLocalStorageData(),!0);deleteData=async()=>(await this.profileHttps.deleteUserData(),await this.profileFacade.clearLocalStorageData(),!0);setEmailPromise=async t=>(this.modified=!0,await this.getOwnProfile(),typeof t=="string"&&t?this.ownProfile.email=t:console.warn(`Wrong email argument: ${t}. Will be ignored when updating profile`),this);setEmail=t=>(this.promises.push(this.setEmailPromise(t)),this);setPhoneCountryCodePromise=async t=>(this.modified=!0,await this.getOwnProfile(),t===null||typeof t=="string"&&t?this.ownProfile.phoneCountryCode=t:console.warn(`Wrong phoneCountryCode argument: ${t}. Will be ignored when updating profile`),this);setPhoneCountryCode=t=>(this.promises.push(this.setPhoneCountryCodePromise(t)),this);setPhoneNumberPromise=async t=>(this.modified=!0,await this.getOwnProfile(),t===null||typeof t=="string"&&t?this.ownProfile.phoneNumber=t:console.warn(`Wrong phoneNumber argument: ${t}. Will be ignored when updating profile`),this);setPhoneNumber=t=>(this.promises.push(this.setPhoneNumberPromise(t)),this);update=async()=>{if(this.promises.length===0)return this.ownProfile;await Promise.all(this.promises),this.promises=[],this.resetProfileCheckResult();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()=>{this.newProfileCheckResult===!0&&await this.profileFacade.clearLocalStorageData()};isNewProfileRequested=async()=>{let t=this.profileHttps.extractUserIdFromToken();if(!t)return!1;if(!this.ownProfile){let e=await this.profileFacade.getOwnProfileFromCache();return!!(e&&Object.keys(e).length&&e.id!==t)}return this.ownProfile.id!==t}};var wi=class{idsRemapper=null;profileHttps=null;activityHttps=null;profileFacade=null;profileId="";localCache=null;constructor(t,e,i,a){this.idsRemapper=t,this.profileHttps=i,this.activityHttps=a,this.localCache=e,this.profileFacade=new _t(e,i,a)}getById=t=>new wi(this.idsRemapper,this.localCache,this.profileHttps,this.activityHttps).setId(t);setId=t=>(this.profileId=t,this);getProfile=async()=>await this.profileFacade.getById(this.profileId);getInfo=async()=>{let t=await this.getProfile();return delete t.interests,t};showInterests=async()=>{let t=await this.getProfile(),e=JSON.parse(JSON.stringify(t));return await this.idsRemapper.remapInterests(e.interests)};showFullInterests=async()=>{let t=await this.getProfile(),e=JSON.parse(JSON.stringify(t));return await this.idsRemapper.showFullInterests(e.interests)};getFollowers=async t=>await this.profileFacade.getFollowers(t,this.profileId);getFollowing=async t=>await this.profileFacade.getFollowing(t,this.profileId);showFullnessProfile=async()=>{let t=await this.getProfile();return this.profileFacade.showFullnessProfile(t)};getStats=async t=>{let e=await this.activityHttps.getStats(this.profileId,t);return await this.idsRemapper.remapProfileStats(e)};getBadges=async()=>await this.profileHttps.getBadges(this.profileId)};var el=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 _i=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 il=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 _i(t),t.countryId){let r=await this.idMapping.getEntityIdsBySchemaId([`${t.countryId}`],"country","native");r.country.length===0&&(i=!0),t.countryId=r.country[0]}if(t.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 _i({competitionIds:t,limit:i}),r=await this.getCompetitions(a);r.sort((l,p)=>l.id.localeCompare(p.id));let o=$p(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 Pi=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 Na=class{reason="";words=[]};var Pe=class{enabled=!1;moderateLinks=!1;linksWhitelist=[];moderatorProfileId="";dictionary=new Na};var ka=class{enabled=!1;clientId=null;automaticModeration=new Pe};var xt=class{points=null;gameParticipationCount=null;entityId=null;entityType=null;predictionsMade=null;correctPredictions=null};var Te=class{id;weight;multiplier;conditions};var Ee=class{value=[new Te]};var Re=class{points=null;tiers=null;badges=null};var Ga=class{enabled=!1;clientId=null;conditions={list:null};actions=new Ee;rewards=new Re};var Ua=class{general=null;predictor=null;activity=null;topX=null;matchQuiz=null;discussionPost=null};var Fe=class{enabled=!1;clientId=null;defaultMarkets=null;competitionsWhitelist=null;authRequirement=null};var Se=class{enabled=!1;clientId=null;minFixtures=null;maxFixtures=null;competitionsWhitelist=null;authRequirement=null};var Va=class{competitions=[];teams=[];markets=[]};var ve=class{enabled=!1;clientId=null;fullCoverageCompetitions=null;markets=null;successRateScopes=new Va;userDataConfig=null};var Ha=class{storeIp=!1;storeDeviceId=!1;storeAgent=!1};var $a=class{potm=[];poll=[]};var za=class{predictor=[];topX=[];matchQuiz=[];games=[];football=[];classicQuizzes=[];eitherOr=[];discussions=[];voting=new $a};var Q=class{id;label;description;flags;assets={mainImageUrl:""};enabled};var qa=class{predictionsNumber;correctPredictions;points;fromDate;toDate};var Qa=class extends Q{requirements=new qa};var Wa=class{participationCount;points;fromDate;toDate};var Ka=class extends Q{requirements=new Wa};var ja=class{participationCount;points;specificGames;fromDate;toDate};var Ya=class extends Q{requirements=new ja};var Xa=class{predictionsNumber;correctPredictions;points;entityId;entityType;entityModel=null};var Ja=class extends Q{requirements=new Xa};var Za=class{participationCount;fromDate;toDate};var tr=class extends Q{requirements=new Za};var er=class{totalDiscussionPoints;postsCount;postPoints;reactionsCount};var ir=class extends Q{requirements=new er};var ar=class{points;voteCount;entityId;entityType;entityModel};var Ce=class extends Q{requirements=new ar};var Ae=class{points=null;tiers=null;badges=null};var rr=class{enabled=!1;clientId=null;conditions={list:null};actions=new Ee;rewards=new Ae};var or=class{general=[];predictor=[];topX=[];matchQuiz=[]};var sr=class{id;label;assets={mainImageUrl:""};enabled;requirements=new xt};var Oe=class extends xt{postPoints=null;postsCount=null;reactionsCount=null;totalDiscussionPoints=null};var nr=class{id;label;assets={mainImageUrl:""};enabled;requirements=new Oe};var xe=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 Le=class{total=null;minGoalkeepers=null;maxGoalkeepers=null;minDefenders=null;maxDefenders=null;minMidfielders=null;maxMidfielders=null;minStrikers=null;maxStrikers=null};var lr=class{enabled=!1;clientId=null;addPointsToProfileTotal=!1;coefficients=new xe;players=new Le;multipliers=null;competitionsWhitelist=[]};var pr=class{captain=null;viceCaptain=null};var al=class{remapPredictorConfig=t=>{let e=new ve;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 Se;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 Fe;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 Ga;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 rr;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 ka;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 lr;return e.enabled=t.enabled,e.clientId=t.client_id,e.addPointsToProfileTotal=t.add_points_to_profile_total,e.competitionsWhitelist=t.competitions_whitelist,e.multipliers=t.multipliers?this.remapMultipliers(t.multipliers):null,e.players=this.remapFantasyPlayers(t.players),e.coefficients=this.remapFantasyCoefficients(t.coefficients),e};remapFantasyPlayers=t=>{let e=new Le;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 xe;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 Pe;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 Ae;return e.points=this.remapPoints(t.points),e.tiers=t.tiers,e.badges=this.remapNewBadges(t.badges),e};remapRewards=t=>{let e=new Re;return e.points=this.remapPoints(t.points),e.tiers=t.tiers,e.badges=this.remapBadges(t.badges),e};remapPoints=t=>{let e=new Ua;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 or;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 za;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 Qa;return i.id=e.id,i.enabled=e.enabled,i.label=e.label,i.description=e.description,i.flags=e.flags,e.assets?i.assets.mainImageUrl=e.assets.main_image_url:i.assets=e.assets,e.requirements&&(i.requirements.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 Ka;return i.id=e.id,i.enabled=e.enabled,i.label=e.label,i.description=e.description,i.flags=e.flags,e.assets?i.assets.mainImageUrl=e.assets.main_image_url:i.assets=e.assets,e.requirements&&(i.requirements.participationCount=e.requirements.participation_count,i.requirements.points=e.requirements.points,i.requirements.fromDate=e.requirements.from_date,i.requirements.toDate=e.requirements.to_date),i});remapBadgeValuesGames=t=>t.map(e=>{let i=new Ya;return i.id=e.id,i.enabled=e.enabled,i.label=e.label,i.description=e.description,i.flags=e.flags,e.assets?i.assets.mainImageUrl=e.assets.main_image_url:i.assets=e.assets,e.requirements&&(i.requirements.participationCount=e.requirements.participation_count,i.requirements.points=e.requirements.points,i.requirements.fromDate=e.requirements.from_date,i.requirements.toDate=e.requirements.to_date,i.requirements.specificGames=e.requirements.specific_games?this.remapSpecificGamesRequirement(e.requirements.specific_games):null),i});remapSpecificGamesRequirement=t=>t.map(e=>({gameId:e.game_id,gameType:e.game_type,gameModel:null}));remapBadgeValuesFootball=t=>t.map(e=>{let i=new Ja;return i.id=e.id,i.enabled=e.enabled,i.label=e.label,i.description=e.description,i.flags=e.flags,e.assets?i.assets.mainImageUrl=e.assets.main_image_url:i.assets=e.assets,e.requirements&&(i.requirements.predictionsNumber=e.requirements.predictions_number,i.requirements.correctPredictions=e.requirements.correct_predictions,i.requirements.points=e.requirements.points,i.requirements.entityId=e.requirements.entity_id,i.requirements.entityType=e.requirements.entity_type),i});remapBadgeValuesMiniGames=t=>t.map(e=>{let i=new tr;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 ir;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 Ce;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 sr;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 xt;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 Ha;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 nr;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 Oe;return e.points=t.points,e.gameParticipationCount=t.game_participation_count,e.entityId=t.entity_id,e.entityType=t.entity_type,e.predictionsMade=t.predictions_made,e.correctPredictions=t.correct_predictions,e.postPoints=t.post_points,e.postsCount=t.posts_count,e.reactionsCount=t.reactions_count,e.totalDiscussionPoints=t.total_discussion_points,e};remapMultipliers=t=>{let e=new pr;return e.captain=t.captain,e.viceCaptain=t.vice_captain,e}};var cr=class{entityId;entityType;entityModel=null};var Zp=class{totalItems=0};var tc=class{id=null;label=null};var ec=class{type=null;id=null;label=null};var ur=class{id=null;source=null;type=null};var w=class{limit;startAfter;constructor(t){this.limit=t&&t.limit?t.limit:null,this.startAfter=t&&t.startAfter?t.startAfter:null}constructMainFiltersUrl(){let t="";return this.limit&&(t+="&",t+=`limit=${this.limit}`),this.startAfter&&(t+="&",t+=`start_after=${this.startAfter}`),t}};var dr=class extends w{};var ic=class{fixtures=[];tiebreaker};var tu=(i=>(i.PARTICIPANT_ONE="PARTICIPANT_ONE",i.PARTICIPANT_TWO="PARTICIPANT_TWO",i.DRAW="DRAW",i))(tu||{});var mr=class{matchId="";participantOne="";participantTwo="";winner="PARTICIPANT_ONE"};var ft=(o=>(o.OPEN="OPEN",o.LIVE="LIVE",o.PENDING="PENDING",o.CANCELED="CANCELED",o.CLOSED="CLOSED",o.SETTLED="SETTLED",o))(ft||{});var hr=class extends w{status=null;sortOrder=null;gameIds=null;constructor(t){super(t),this.status=t?.status||null,this.sortOrder=t?.sortOrder||null,this.gameIds=t?.gameIds||null}constructMainFiltersUrl(){let t=super.constructMainFiltersUrl();return this.status&&Object.values(ft).includes(this.status)?(t+="&",t+=`status=${this.status}`):this.status!==null&&console.warn(`The filter 'status' has the following INVALID value: ${this.status}. It will be not passed as a query param in the URL. For more information visit our documentation.`),this.sortOrder&&(this.sortOrder==="asc"||this.sortOrder==="desc"||this.sortOrder==="ASC"||this.sortOrder==="DESC")?(t+="&",t+=`sort_order=${this.sortOrder}`):this.sortOrder!==null&&console.warn(`The filter 'sortOrder' has the following INVALID value: ${this.sortOrder}. It will be not passed as a query param in the URL. For more information visit our documentation.`),this.gameIds&&Array.isArray(this.gameIds)&&this.gameIds.length>0?(t+="&",t+=`game_ids=${this.gameIds}`):this.gameIds!==null&&console.warn(`The filter 'gameIds' has the following INVALID value: ${this.gameIds}. It will be not passed as a query param in the URL. For more information visit our documentation.`),t}};var fr=class{profileId="";profileModel=null;challengeId="";challengeModel=null;message=""};var De=class{name="";description="";invitation_code="";template_id="";users_can_invite_users=!1;administrators=[];scoring_starts_at=""};var gr=class extends De{type="ONE_VS_ONE"};var Be=class{name="";description="";invitation_code="";template_id="";users_can_invite_users=!1;administrators=[];pinned_posts=[];scoring_starts_at=""};var yr=class extends Be{type="ONE_VS_ONE"};var br=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 Mr=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 wr=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 ac=class{content="";replyId="";discussionLabel="";discussionUrl="";userNickname="";context=null};var Ne=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 _r=class extends Ne{userModel=null};var Pr=class{content="";reply_id="";discussion_label="";discussion_url="";anonymous_nickname="";context=null};var Tr=class{id="";postsCount=0};var Lt=class{pagination={totalItems:0,nextPageStartsAfter:"",lastCommentCreateTimestamp:""}};var Er=class{meta=new Lt;data=[]};var Rr=class{meta=new Lt;data=[]};var Fr=class{meta=new b;data=[]};var Sr=class{type="";userIds=[];reactionCount=0};var vr=class{userId=null;reason="AD";reasonDetails=null};var Cr=class{updatedAt="";content=""};var Md=["CREATED_AT_ASC","CREATED_AT_DESC","POSTS_COUNT_ASC","POSTS_COUNT_DESC"],Id=["ACTIVE","INACTIVE"],Ar=class extends w{discussionIds;label;discussionUrl;fromDate;toDate;fromCount;toCount;sort;status;skipDeleted;constructor(t){super(t),this.discussionIds=t&&t.discussionIds?t.discussionIds:null,this.label=t&&t.label?t.label:null,this.discussionUrl=t&&t.discussionUrl?t.discussionUrl:null,this.fromDate=t&&t.fromDate?t.fromDate:null,this.toDate=t&&t.toDate?t.toDate:null,this.fromCount=t&&t.fromCount?t.fromCount:null,this.toCount=t&&t.toCount?t.toCount:null,this.sort=t&&t.sort?t.sort:null,this.status=t?.status||null,this.skipDeleted=t&&t.skipDeleted!==void 0?t.skipDeleted:null}constructMainFiltersUrl(){let t=super.constructMainFiltersUrl();return this.discussionIds!==null&&(t+=`&discussion_ids=${this.discussionIds.join(",")}`),this.label!==null&&(t+=`&label=${this.label}`),this.discussionUrl!==null&&(t+=`&discussion_url=${this.discussionUrl}`),this.fromDate!==null&&(t+=`&from_date=${this.fromDate}`),this.toDate!==null&&(t+=`&to_date=${this.toDate}`),this.fromCount!==null&&(t+=`&from_count=${this.fromCount}`),this.toCount!==null&&(t+=`&to_count=${this.toCount}`),this.sort&&Md.includes(this.sort.toUpperCase())&&(t+=`&sort=${this.sort.toUpperCase()}`),this.status&&Id.includes(this.status.toUpperCase())&&(t+=`&status=${this.status.toUpperCase()}`),this.skipDeleted!==null&&(t+=`&skip_deleted=${this.skipDeleted}`),t}};var jt=class extends w{skipDeleted;skipModerated;sort;constructor(t){super(t),this.skipDeleted=t&&t.skipDeleted!==void 0?t.skipDeleted:null,this.skipModerated=t&&t.skipModerated!==void 0?t.skipModerated:null,this.sort=t&&t.sort?t.sort.toLocaleLowerCase():null}constructMainFiltersUrl(){let t=super.constructMainFiltersUrl();return this.skipDeleted!==null&&(t+=`&skip_deleted=${this.skipDeleted}`),this.skipModerated!==null&&(t+=`&skip_moderated=${this.skipModerated}`),this.sort&&(t+=`&sort=${this.sort}`),t}};var Or=class extends w{fromDate;toDate;entityIds;entityType;contentType;constructor(t){super(t),this.fromDate=t?.fromDate||null,this.toDate=t?.toDate||null,this.entityIds=t?.entityIds||null,this.entityType=t?.entityType||null,this.contentType=t?.contentType||null}constructMainFiltersUrl(){let t=super.constructMainFiltersUrl();return this.fromDate!==null&&(t+=`&from_date=${this.fromDate}`),this.toDate!==null&&(t+=`&to_date=${this.toDate}`),this.entityIds!==null&&this.entityIds.length>0&&(t+=`&entity_ids=${this.entityIds}`),this.contentType!==null&&(t+=`&content_type=${this.contentType}`),t}};var xr=class extends w{status=null;sortOrder=null;gameIds=null;constructor(t){super(t),this.status=t?.status||null,this.sortOrder=t?.sortOrder||null,this.gameIds=t?.gameIds||null}constructMainFiltersUrl(){let t=super.constructMainFiltersUrl();return this.status&&Object.values(ft).includes(this.status)?(t+="&",t+=`status=${this.status}`):(this.status!==null||this.status!==void 0)&&console.warn(`The filter 'status' has the following INVALID value: ${this.status}. It will be not passed as a query param in the URL. For more information visit our documentation.`),this.sortOrder&&(this.sortOrder==="asc"||this.sortOrder==="desc"||this.sortOrder==="ASC"||this.sortOrder==="DESC")?(t+="&",t+=`sort_order=${this.sortOrder}`):(this.sortOrder!==null||this.sortOrder!==void 0)&&console.warn(`The filter 'sortOrder' has the following INVALID value: ${this.sortOrder}. It will be not passed as a query param in the URL. For more information visit our documentation.`),this.gameIds&&Array.isArray(this.gameIds)&&this.gameIds.length>0?(t+="&",t+=`game_ids=${this.gameIds}`):(this.gameIds!==null||this.gameIds!==void 0)&&console.warn(`The filter 'gameIds' has the following INVALID value: ${this.gameIds}. It will be not passed as a query param in the URL. For more information visit our documentation.`),t}};var Lr=class extends w{};var Dr=class extends w{};var rc=class{id="";predictionType;prediction};var oc=class{fixtures=[];tiebreaker};var sc=class{options=[]};var nc=class{min=0;max=0};var Br=class{templateId=null;playerId=null};var Nr=class{filters=new Br};var kr=class{meta=new Nr;data=[]};var Gr=class{key=null;label=null;value=null};var Ur=class{templateId=null};var Vr=class{filters=new Ur};var Hr=class{meta=new Vr;data=[]};var ke=class{template_id=null;group_id=null;fixtures=[]};var Ge=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 Ue=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 Ge;stats=new Ue};var zr=class{playerId=null;playerModel=null;points=null;rank=null};var qr=class{id="";country=null;gender="";assets=null;type="";name=""};var Qr=class{id="";country=null;gender="";assets=null;type="";name="";participants=[]};var Wr=class{id="";alias="";countryCode="";assets=null;name=""};var X=class{type=null;subType=null};var Kr=class{id="";kickoffAt="";finishedAt="";updatedAt="";availableMarkets=null;homeTeam=null;awayTeam=null;isDeleted=!1;undecided=!1;lineupsConfirmed=!1;startedAt="";minute="";scores=null;context={competition:null};status=new X};var jr=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 X;lineups=null};var gt=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 Yr=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 Xr=class{ftScore=null;htScore=null;aetScore=null;aggScore=null;penScore=null};var Ve=class{homeTeam={players:[]};awayTeam={players:[]}};var Jr=class{minute="";type="";teamId="";player=null;relatedPlayer=null;updatedAt=""};var Zr=class{playerId=null;position=null;minutesPlayed=null;yellowCards=null;redCards=null;goals=null;penaltyGoals=null;penaltyCommitted=null;penaltyWon=null;penaltyMissed=null;penaltySaved=null;penaltyReceived=null;ownGoals=null;assists=null;cleanSheets=null;shots=null;shotsOn=null;shotsBlocked=null;offsides=null;foulsCommitted=null;foulsWon=null;tackles=null;tacklesBlocks=null;tacklesInterceptions=null;concededGoals=null;caughtBall=null;saves=null;passes=null;crosses=null;interceptions=null;keyPasses=null;passesAccuracy=null;duels=null;duelsWon=null;dribblesAttempts=null;dribblesSuccess=null;dribblesPast=null;updatedAt=null};var to=class{id="";country=null;birthDate="";firstName="";lastName="";name="";position="";assets=null;isDeleted=!1;teams=[]};var eo=class{id="";country=null;birthDate="";firstName="";lastName="";name="";position="";assets=null;isDeleted=!1;competitions=[];teams=[]};var io=class{id="";startDate="";endDate="";shirtNumber;loan=!1;position="";country=null;name="";assets=null;birthDate=""};var ao=class{id="";country=null;birthDate="";firstName="";lastName="";name="";position="";assets=null};var Ti=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 lc=class{headshot=null};var pc=class{id=null;name=null;country=null};var ro=class{id="";name="";position="";shirtNumber;assets=null;type=""};var oo=class{id="";country=null;gender="";assets=null;name="";code="";national=!1;undecided=!1;fullName="";shortName="";isDeleted=!1};var so=class{primary=null;secondary=null;tertiary=null};var no=class{id="";country=null;gender="";assets=null;name="";competitions=[];code="";national=!1;fullName="";shortName="";isDeleted=!1;undecided=!1;colors=new so;squad=[]};var cc=class{teamId=null;matches=[]};var lo=class{teams=null;players=null;competitions=null};var po=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 Yt=class{meta=new k;data=[]};var uc=class{logo=null};var dc=class{profile=null;football=null;predictor=null;loyalty=null;topX=null;matchQuiz=null;activity=null;miniGames=null;discussions=null;privateLeagues=null;challenges=null;progress=null;voting=null;fantasy=null;helpers=null;idMapping=null;bracketGame=null;lists=null;standingGame=null;eventGame=null;odds=null;getVersion=null};var mc=class{apiKey;clientId;environment;idSchema;lang;errorHandlingMode;oddClient;cookieToken;authProvider};var W=class{main=null;cover=null;mobile=null};var co=class{colors=null;urls=null;images=null};var uo=class{primaryColor=null;secondaryColor=null;contentColor=null;backgroundColor=null;borderColor=null;additionalColor=null};var mo=class{primaryUrl=null;secondaryUrl=null;privacyPolicyUrl=null;termsAndConditionsUrl=null;additionalUrl=null};var ho=class{mainLogo=null;mobileLogo=null;backgroundImage=null;mobileBackgroundImage=null;additionalImage=null};var hc=class{preferenceId="";categories=[];source=""};var fo=class{input=null;output=null};var go=class{meta=new fo;data=[]};var yo=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 bo=class{general;predictor;topX;matchQuiz};var Mo=class{predictor;topX;matchQuiz;games;football;classicQuizzes;eitherOr;discussions;potm;poll};var fc=class extends Ce{};var gc=class{count=0;breakdown=[]};var yc=class{footballCompetitions;footballTeams;footballPlayers};var Io=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 wo=class{templateId=null;limit=null;page=null;groupId=null;constructor(t){this.templateId=t?.templateId||null,this.limit=t?.limit||null,this.page=t?.page||null,t?.groupId!==void 0&&console.warn("Warning: groupId property is deprecated and no longer supported by the API. This property will be removed in a future version. Please update your code accordingly.")}constructFiltersUrl(){let t="";return this.templateId&&(t+=`&template_id=${this.templateId}`),this.limit&&(t+=`&limit=${this.limit}`),this.page&&(t+=`&page=${this.page}`),t}};var _o=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 Po=class{sortOrder=null;rankType=null;leaderboardIds=null;gameType=null;limit=null;page=null;groupId=null;constructor(t){this.sortOrder=t.sortOrder,this.rankType=t.rankType,this.leaderboardIds=t.leaderboardIds,this.gameType=t.type&&t.type.toLowerCase()==="game"?t.gameType:null,this.limit=t.limit,this.page=t.page,t?.groupId!==void 0&&console.warn("Warning: groupId property is deprecated and no longer supported by the API. This property will be removed in a future version. Please update your code accordingly.")}constructFiltersUrl=()=>{let t="";return this.sortOrder&&(t+="&",t+=`sort_order=${this.sortOrder}`),this.rankType&&(t+="&",t+=`rank_type=${this.rankType}`),this.leaderboardIds&&(t+="&",t+=`type_ids=${this.leaderboardIds.join(",")}`),this.gameType&&(t+="&",t+=`game_type=${this.gameType}`),this.limit&&(t+="&",t+=`limit=${this.limit}`),this.page&&(t+="&",t+=`page=${this.page}`),t}};var To=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 Eo=class{position=null;points=null;predictionsMade=null;profileId=null;profileModel=null;successRatePercent=null};var He=class{templateId=null;privateLeagueId=null;fromDate=null;toDate=null;pagination=new Y};var bc=class{meta=new He;data=[]};var Dt=class{rankType=null;fromDate=null;toDate=null;pagination=new Y};var Mc=class{meta=new Dt;data=[]};var $e=class{position=null;profileId=null;profileModel=null;points=null;predictionsMade=null};var Ro=class{flags="";status="";type="";activeFrom="";activeTo="";createdFrom="";createdTo="";updatedFrom="";updatedTo=""};var Fo=class{pagination=new Y;filters=new Ro};var Ic=class{id=null;points=null};var wc=class extends Te{points;alternative;constructor(){super(),delete this.weight}};var So=class extends $e{id=null;rankType=null;model=null;gameType=null};var _c=class{meta=new Dt;data=[]};var vo=class{groupId;averagePoints;highestPoints};var Bt=class{id=null;name=null;description=null;type=null;fromDate=null;toDate=null;markets=[];teamIds=[];matchIds=[];groups=[];gameIds=[];gameTypes=[];competitionIds=[];excludedProfileIds=[];rules=null;labels=null;customFields=null;branding=null;flags=null;images=new W;status=null;automaticallyChangeStatus=!0;createdAt=null;updatedAt=null;related=null};var Co=class extends Bt{adContent=null};var Ao=class{groupId=null;label=null;flags=[];filters=null};var Oo=class{fromDate=null;toDate=null;matchIds=[]};var Pc=class{enabled=!1;id=null;label=null;points=null};var xo=class{value=null;target=null;playerId=null;playerModel=null;result=null};var Lo=class{matchId=null;matchType=null;market=null;matchModel=null;matchStatus=new X;prediction=new xo};var Do=class{gameId=null;results=null;tieBreakers=null};var yt=class{timeTiebreaker=!1};var Pt=class{id=null;title=null;description=null;type=null;status=null;authRequirement=null;outcome=null;predictionsCutoff=null;fixtures=[];tiebreaker=new yt;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 ze=class{id=null;title=null;alternativeTitle=null;description=null;type=null;images=new W;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 Nt=class extends w{flags=null;status=null;entityIds=null;entityType=null;sort=null;groupByStatus=null;language=null;title=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,this.title=t&&t.title?t.title: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}`),this.title!==null&&(t+=`&title=${this.title}`),t}};var Bo=class extends Nt{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 No=class extends ze{rules=null;questions=[]};var ko=class{questionId=null;question=null;images=null;embedCode=null;explanation=null;options=[]};var Go=class{optionId=null;option=null;images=null;correct=null};var Tc=class{questionId=0;optionId=0};var Uo=class{classicQuizId=null;userId=null;questions=[];correctOptions=null;personalBest=null;points=null;attempts=null};var Vo=class{questionId=null;optionId=null;correct=null;correctOptionId=null};var Ho=class extends w{classicQuizIds=null;constructor(t){super(t),this.classicQuizIds=t?.classicQuizIds||null}constructMainFiltersUrl(){let t=super.constructMainFiltersUrl();return this.classicQuizIds&&this.classicQuizIds.length>0&&(t+=`&classic_quiz_ids=${this.classicQuizIds.join(",")}`),t}};var $o=class{classicQuizId=null;classicQuizModel=null;correct=null;classicQuizQuestions=null;personalBest=null;points=null;answers=[];attempts=0};var Ec=class{meta=new b;data=[]};var zo=class{questionId=null;questionModel=null;wrong=null;correct=null;skipped=null;total=null};var qe=class{classicQuizIds=null};var Qe=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 qo=class extends Qe{classicQuizIds=null;constructor(t){super(t),this.classicQuizIds=t?.classicQuizIds||null}constructMainFiltersUrl(){let t=super.constructMainFiltersUrl();return this.classicQuizIds&&this.classicQuizIds.length>0&&(t+=`&classic_quiz_ids=${this.classicQuizIds.join(",")}`),t}};var We=class{pagination=new Y;filters=new qe};var Qo=class{position=null;profileId=null;profileModel=null;points=null};var Wo=class{position=null;classicQuizId=null;classicQuizModel=null;points=null};var Rc=class{meta=new k;data=[]};var Fc=class{meta=new We;data=[]};var Ke=class{id="";title="";alternativeTitle="";description="";images=new W;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 Ko=class extends Nt{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 jo=class extends Ke{rules=""};var Yo=class{correctSteps=0;score=0};var Sc=class{meta=new b;data=[]};var Xo=class{eitherOrId="";personalBest=0;betterThan=0};var Jo=class{instanceId="";eitherOrId="";gameStartedAt="";currentStep=0;currentStreak=0;remainingSteps=0;currentLives=0;currentPoints=0;personalBest=0;participationCount=0;finishedParticipationsCount=0;steps=[]};var Zo=class{pair="";answer=""};var ts=class extends Zo{expired=!1;time=0};var es=class{main;mobile};var Ei=class{id="";label="";images=new es;value=null};var is=class{pairId="";userSelection="";correct=null;played=null;timestamp="";optionOne=new Ei;optionTwo=new Ei};var as=class{rangeStartInclusive=0;rangeEndInclusive=0;totalUsers=0};var rs=class{standings=[];breakdown=[]};var os=class{userId="";userModel=null;personalBest=""};var kt=class{content=null;tags=[];campaign=null};var Gt=class{id=null;model=null;source=null;type=null};var ss=class{questions=null;correctAnswers=null};var je=class{id=null;title=null;alternativeTitle=null;description=null;images=new W;participationCount=null;status=null;language=null;authRequirement=null;flags=null;customFields=null;labels=null;branding=null;related=[];time=null;maxAttempts=null;adContent=null;context=null;createdAt=null;updatedAt=null};var vc=class{meta=new b;data=[]};var ns=class{personaId=null;title=null;description=null;images=null};var ls=class{questionId=null;question=null;images=null;explanation=null;options=[]};var ps=class{personaId=null;points=null};var cs=class{optionId=null;option=null;images=null;personaPoints=[];preferenceMapping=[]};var Ri=class extends je{rules=null;questions=[];personaResults=[]};var us=class extends Nt{personalityQuizIds=null;constructor(t){super(t),this.personalityQuizIds=t&&t.personalityQuizIds?t.personalityQuizIds:null}constructMainFiltersUrl(){let t=super.constructMainFiltersUrl();return this.personalityQuizIds&&this.personalityQuizIds.length>0&&(t+=`&personality_quiz_ids=${this.personalityQuizIds.join(",")}`),t}};var Cc=class{questionId=0;optionId=0};var ds=class{personalityQuizId=null;userId=null;questions=[];personas=[];attempts=null};var ms=class{questionId=null;optionId=null};var hs=class{personaId=null;percent=null};var fs=class{id=null;name=null;url=null;assets=[];links=[];branding=null;eventUrls=[];stakesDisclaimer=null;domainName=null};var gs=class{backgroundColor=null;textColor=null};var Ac=class{appType=null;selectionTemplateUrl=null;eventTemplateUrl=null;homepageUrl=null};var ys=class{logo=null;type=null;transparentBackgroundUrl=null;backgroundColor=null};var bs=class{url=null;appType=null};var eu=(i=>(i.PRE_EVENT="PRE_EVENT",i.LIVE="LIVE",i.ALL="ALL",i))(eu||{}),iu=(e=>(e.ORDINARY_TIME="ORDINARY_TIME",e.FULL_TIME="FULL_TIME",e))(iu||{}),au=(i=>(i.DECIMAL="DECIMAL",i.MONEYLINE="MONEYLINE",i.FRACTIONAL="FRACTIONAL",i))(au||{});var ru=(B=>(B.FT_1X2="FT_1X2",B.DOUBLE_CHANCE="DOUBLE_CHANCE",B.HT_FT="HT_FT",B.BOTH_TEAMS_SCORE="BOTH_TEAMS_SCORE",B.CORRECT_SCORE="CORRECT_SCORE",B.PLAYER_SCORE_FIRST_GOAL="PLAYER_SCORE_FIRST_GOAL",B.PLAYER_SCORE="PLAYER_SCORE",B.PLAYER_RED_CARD="PLAYER_RED_CARD",B.PLAYER_YELLOW_CARD="PLAYER_YELLOW_CARD",B.OVER_GOALS_0_5="OVER_GOALS_0_5",B.OVER_GOALS_1_5="OVER_GOALS_1_5",B.OVER_GOALS_2_5="OVER_GOALS_2_5",B.OVER_GOALS_3_5="OVER_GOALS_3_5",B.OVER_GOALS_4_5="OVER_GOALS_4_5",B.OVER_GOALS_5_5="OVER_GOALS_5_5",B))(ru||{}),wd={["FT_1X2"]:"1x2",["DOUBLE_CHANCE"]:"DOUBLE_CHANCE",["HT_FT"]:"FIRST_HALF_AND_FINAL_RESULT",["BOTH_TEAMS_SCORE"]:"BOTH_TO_SCORE",["CORRECT_SCORE"]:"CORRECT_SCORE",["PLAYER_SCORE_FIRST_GOAL"]:"FIRST_PLAYER_TO_SCORE",["PLAYER_SCORE"]:"PLAYER_TO_SCORE_DURING_GAME",["PLAYER_RED_CARD"]:"PLAYER_TO_RECEIVE_CARD",["PLAYER_YELLOW_CARD"]:"PLAYER_TO_RECEIVE_CARD"},Ms=class{oddType="PRE_EVENT";scopeType="ORDINARY_TIME";oddFormat="DECIMAL";marketTypes=["FT_1X2"];constructor(t){this.validateFilters(t)}constructFiltersUrl(){let t=this.marketTypes.map(e=>this.mapToSportal365Market(e));return`&odd_type=${this.oddType}&scope_type=${this.scopeType}&odd_format=${this.oddFormat}&market_types=${t.join(",")}`}validateFilters(t){let e=Object.values(eu),i=Object.values(iu),a=Object.values(au),r=Object.values(ru);t?.oddType&&(e.includes(t.oddType)?this.oddType=t.oddType:console.warn(`The filter "oddType" is NOT valid and therefore it will be set to PRE_EVENT. The VALID values are : ${e.join(", ")}`)),t?.scopeType&&(i.includes(t.scopeType)?this.scopeType=t.scopeType:console.warn(`The filter "scopeType" is NOT valid and therefore it will be set to ORDINARY_TIME. The VALID values are : ${i.join(", ")}`)),t?.oddFormat&&(a.includes(t.oddFormat)?this.oddFormat=t.oddFormat:console.warn(`The filter "oddFormat" is NOT valid and therefore it will be set to DECIMAL. The VALID values are : ${a.join(", ")}`)),t?.marketTypes&&Array.isArray(t?.marketTypes)&&t?.marketTypes.length>0&&(t.marketTypes.every(o=>r.includes(o))?this.marketTypes=t.marketTypes:console.warn(`The filter "marketTypes" is NOT valid and therefore it will be set to FT_1X2. The VALID values are : ${r.join(", ")}`))}mapToSportal365Market(t){return t.startsWith("OVER_GOALS_")?"OVER_UNDER":wd[t]}};var Is=class{type=null;scope=null;selections=[]};var ws=class{id=null;type=null;name=null;entityType=null};var _s=class{id=null;name=null;code=null;value=null;odds=null;urls=[];movement=null;oddsOld=null;entityType=null;additionalInfo=null;providerInfo=null};var Ps=class{id=null;name=null;code=null;entityType=null};var Ts=class{selectionId=null;eventId=null;marketId=null;competitionId=null};var Es=class{bookmaker=null;type=null;markets=[]};var Oc=class{main=null;all=null};var Rs=class{value=null;playerId=null;playerModel=null;playerRole};var Ye=class{market=null;matchId=null;matchType=null;matchModel=null;prediction=new Rs;result=null};var Xe=class{settledAt=null;resettledAt=null;status=null;outcome=null;points=0};var ot=class{value=!1};var Fs=class{matchId=null;market="BOTH_TEAMS_SCORE";matchType="FOOTBALL";prediction=null;constructor(t,e){this.matchId=t,this.prediction=new ot,this.prediction.value=e}};var Ss=class{value};var vs=class{matchId=null;market="CORNERS_MATCH";matchType="FOOTBALL";prediction=null;constructor(t,e){this.matchId=t,this.prediction=new Ss,this.prediction.value=e}};var Cs=class{value=null};var Ut=class{matchId=null;market=null;matchType="FOOTBALL";prediction=null;constructor(t,e,i){this.matchId=t,this.market=e,this.prediction=new Cs,this.prediction.value=i}};var As=class{value=null};var Os=class{matchId=null;market="DOUBLE_CHANCE";matchType="FOOTBALL";prediction=null;constructor(t,e){this.matchId=t,this.prediction=new As,this.prediction.value=e}};var xs=class{value=null};var Ls=class{matchId=null;market="HT_FT";matchType="FOOTBALL";prediction=null;constructor(t,e){this.matchId=t,this.prediction=new xs,this.prediction.value=e}};var Ds=class{value=null};var Bs=class{matchId=null;market=null;matchType="FOOTBALL";prediction=null;constructor(t,e,i){this.matchId=t,this.market=e,this.prediction=new Ds,this.prediction.value=i}};var Je=class{matchId=null;market=null;matchType="FOOTBALL";prediction=null;constructor(t,e,i){this.matchId=t,this.market=e,this.prediction=new ot,this.prediction.value=i}};var Ze=class{matchId=null;market=null;matchType="FOOTBALL";prediction=null;constructor(t,e,i){this.matchId=t,this.market=e,this.prediction=new ot,this.prediction.value=i}};var Ns=class{matchId=null;market="PENALTY_MATCH";matchType="FOOTBALL";prediction=null;constructor(t,e){this.matchId=t,this.prediction=new ot,this.prediction.value=e}};var ks=class{value=!1;playerId=null};var st=class{matchId=null;market=null;matchType="FOOTBALL";prediction=null;constructor(t,e,i,a){this.matchId=t,this.market=e,this.prediction=new ks,this.prediction.value=i,this.prediction.playerId=a}};var Gs=class{matchId=null;market="RED_CARD_MATCH";matchType="FOOTBALL";prediction=null;constructor(t,e){this.matchId=t,this.prediction=new ot,this.prediction.value=e}};var xc=class{home=null;draw=null;away=null};var Lc=class{score=null;percentage=null};var ti=class{homeGoals=null;awayGoals=null};var Us=class{playerId=null;playerModel=null};var Vs=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 Us;PLAYER_SCORE=[];PLAYER_SCORE_TWICE=[];PLAYER_SCORE_HATTRICK=[];CORRECT_SCORE=new ti;CORRECT_SCORE_ADVANCED=new ti;CORRECT_SCORE_HT=new ti;OVER_GOALS_0_5=null;OVER_GOALS_1_5=null;OVER_GOALS_2_5=null;OVER_GOALS_3_5=null;OVER_GOALS_4_5=null;OVER_GOALS_5_5=null;OVER_GOALS_6_5=null;OVER_CORNERS_6_5=null;OVER_CORNERS_7_5=null;OVER_CORNERS_8_5=null;OVER_CORNERS_9_5=null;OVER_CORNERS_10_5=null;OVER_CORNERS_11_5=null;OVER_CORNERS_12_5=null;OVER_CORNERS_13_5=null};var L=class{no=0;yes=0};var ei=class{gameInstanceId=null;fixtures=null};var bt=class{goldenGoal=null};var Fi=class{id=null;gameInstanceId=null;gameType=null;wager=null;totalFixtures=null;settledFixtures=null;userId=null;fixtures=[];status=null;tiebreaker=new bt;points=null;templateId=null;groupId=null;profileLastUpdatedAt=null;createdAt=null;updatedAt=null};var rl=(r=>(r.ACTIVE="ACTIVE",r.WON="WON",r.LOST="LOST",r.PARTIALLY_WON="PARTIALLY_WON",r.CANCELED="CANCELED",r))(rl||{}),ou=["WON","LOST","PARTIALLY_WON","CANCELED"];var V=class{limit=null;startAfter=null;status=null;type=null;matchIds=null;gameIds=null;constructor(t){this.limit=t?.limit||null,this.startAfter=t?.startAfter||null,this.status=t?.status||null,this.type=t?.type||null,this.matchIds=t?.matchIds||null,this.gameIds=t?.gameIds||null}constructFiltersUrl=()=>{let t="",e=!1;return this.status&&(e=Object.values(rl).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 Hs=class{fullTimeOneXTwo={};halfTimeOneXTwo={};bothTeamsScore=new L;doubleChance={};halfTimeFullTime={};playerScore={};playerYellowCard={};playerRedCard={};redCardMatch=new L;penaltyMatch=new L;playerScoreFirstGoal={};cornersMatch={};correctScore={};correctScoreHalfTime={};correctScoreAdvanced={};playerScoreHattrick={};playerScoreTwice={};overZeroPointFiveGoals=new L;overOnePointFiveGoals=new L;overTwoPointFiveGoals=new L;overThreePointFiveGoals=new L;overFourPointFiveGoals=new L;overFivePointFiveGoals=new L;overSixPointFiveGoals=new L;overSixPointFiveCorners=new L;overSevenPointFiveCorners=new L;overEightPointFiveCorners=new L;overNinePointFiveCorners=new L;overTenPointFiveCorners=new L;overElevenPointFiveCorners=new L;overTwelvePointFiveCorners=new L;overThirteenPointFiveCorners=new L};var $s=class{matchId=null;matchType=null;predictions=null};var zs=class{profileId="";profileModel=null;leagueId="";leagueModel=null;message=""};var Dc=class{id=null;name=null;model=new Bt};var ii=class{id="";name="";description="";type="";banned=[];invites=[];administrators=[];membersCount=0;invitationCode="";templateId="";templateModel=null;pastTemplates=[];usersCanInviteUsers=!1;scoringStartsAt="";pinnedPosts=[]};var qs=class extends ii{members=[]};var Bc=class{name="";description="";invitationCode="";templateId="";usersCanInviteUsers=!1;administrators=[];scoringStartsAt=""};var Nc=class{name="";description="";invitationCode="";templateId="";usersCanInviteUsers=!1;administrators=[];pinnedPosts=[];scoringStartsAt=""};var Qs=class{predictionId=null;predictionModel=null;profileId=null;profileModel=null};var kc=class{meta=new k;data=[]};var Gc=class{meta=new b;data=[]};var ai=class extends w{type=null;constructor(t){super(t),this.type=t&&t.type?t.type:null}constructMainFiltersUrl=()=>{let t=super.constructMainFiltersUrl();return this.type&&(t+=`&type=${this.type}`),t}};var Ws=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 Ks=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 ri=class extends w{reportsCount=null;constructor(t){super(t),this.reportsCount=t.reportsCount?t.reportsCount:null}constructMainFiltersUrl=()=>{let t=super.constructMainFiltersUrl();return this.reportsCount&&(t+=`&reports_count=${this.reportsCount}`),t}};var oi=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 js=class{templateId="";templateModel=null;privateLeagueId="";privateLeagueModel=null;position="";points=0;type="private_league"};var Ys=class extends De{type="PRIVATE"};var Xs=class extends Be{type="PRIVATE"};var Js=class{id="";source="";type="";favourite=!1};var Zs=class extends Js{model=null};var Uc=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 tn=class extends w{status=null;sortOrder=null;gameIds=null;constructor(t){super(t),this.status=t?.status||null,this.sortOrder=t?.sortOrder||null,this.gameIds=t?.gameIds||null}constructMainFiltersUrl(){let t=super.constructMainFiltersUrl();return this.status&&Object.values(ft).includes(this.status)?(t+="&",t+=`status=${this.status}`):this.status!==null&&console.warn(`The filter 'status' has the following INVALID value: ${this.status}. It will be not passed as a query param in the URL. For more information visit our documentation.`),this.sortOrder&&(this.sortOrder==="asc"||this.sortOrder==="desc"||this.sortOrder==="ASC"||this.sortOrder==="DESC")?(t+="&",t+=`sort_order=${this.sortOrder}`):this.sortOrder!==null&&console.warn(`The filter 'sortOrder' has the following INVALID value: ${this.sortOrder}. It will be not passed as a query param in the URL. For more information visit our documentation.`),this.gameIds&&Array.isArray(this.gameIds)&&this.gameIds.length>0?(t+="&",t+=`game_ids=${this.gameIds.join(",")}`):this.gameIds!==null&&console.warn(`The filter 'gameIds' has the following INVALID value: ${this.gameIds}. It will be not passed as a query param in the URL. For more information visit our documentation.`),t}};var en=class extends w{};var an=class{matchId=null;matchType=null;market=null;matchModel=null;matchStatus=new X};var rn=class{value=null;result=null};var on=class{matchId=null;matchType=null;market=null;matchModel=null;matchStatus=new X;prediction=new rn};var Tt=class{id=null;title=null;description=null;type=null;status=null;authRequirement=null;scheduleOpenAt=null;predictionsCutoff=null;fixtures=[];tiebreaker=new yt;participantsCount=0;related=[];excludedProfileIds=null;rules=null;labels=null;customFields=null;branding=null;flags=null;images=new W;createdAt=null;updatedAt=null};var si=class extends Tt{adContent=null};var Xt=class{userId=null;points=null;results=[];tiebreaker=null};var sn=class{matchId=null;matchModel=null;outcome=null};var nt=class extends w{status=null;type=null;gameIds=null;sortOrder=null;constructor(t){super(t),this.status=t?.status||null,this.type=t?.type||null,this.gameIds=t?.gameIds||null,this.sortOrder=t?.sortOrder||null}constructFiltersUrl=()=>{let t=super.constructMainFiltersUrl();return this.status&&Object.values(ft).includes(this.status)&&(t+="&",t+=`status=${this.status}`),this.type&&(t+="&",t+=`type=${this.type}`),this.gameIds&&this.gameIds.length>0&&(t+="&",t+=`game_ids=${this.gameIds.join(",")}`),this.sortOrder&&(t+="&",t+=`sort_order=${this.sortOrder}`),t}};var Vt=class{id=null;title=null;description=null;type=null;status=null;authRequirement=null;outcome=null;predictionsCutoff=null;fixtures=[];tiebreaker=new yt;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 bt;branding=null};var nn=class{contestId="";contestType="GAME";contestModel=null;description="";userList=[]};var ln=class{position="";profileId="";profileModel=null;note="";tags=[]};var ni=class{gameInstanceId=null;fixtures=[];tiebreaker=null;constructor(t){this.gameInstanceId=t.gameInstanceId,t.fixtures.forEach(e=>this.fixtures.push(new Ut(e.matchId,e.market,e.prediction.value))),this.tiebreaker=t.tiebreaker?t.tiebreaker:null}};var li=class extends w{flags=null;status=null;entityIds=null;entityType=null;pollIds=null;sortOrder=null;minVotes=null;language=null;constructor(t){super(t),this.flags=t?.flags||null,this.status=t?.status||null,this.entityIds=t?.entityIds||null,this.entityType=t?.entityType||null,this.pollIds=t?.pollIds||null,this.sortOrder=t?.sortOrder||null,this.minVotes=t&&t.minVotes!==void 0?t.minVotes:null,this.language=t?.language||null}constructMainFiltersUrl(){let t=super.constructMainFiltersUrl();return this.flags&&this.flags.length>0&&(t+=`&flags=${this.flags.join(",")}`),this.status&&(t+=`&status=${this.status}`),this.entityIds&&this.entityIds.length>0&&(t+=`&entity_ids=${this.entityIds.join(",")}`),this.pollIds&&this.pollIds.length>0&&(t+=`&poll_ids=${this.pollIds.join(",")}`),this.sortOrder&&(t+=`&sort_order=${this.sortOrder}`),this.minVotes&&(t+=`&min_votes=${this.minVotes}`),this.language&&(t+=`&language=${this.language}`),t}};var pi=class{id=null;title=null;alternativeTitle=null;description=null;type=null;images=new W;status=null;language=null;authRequirement=null;totalVotes=null;flags=[];customFields=null;branding=null;embedCode=null;labels=null;adContent=null;context=null;options=[];related=[];preferencesEnabled=!1;multipleChoice=!1;maxMultipleChoiceOptions=null;participationCount=0;maxAttempts=0;externalActivity=null;createdAt=null;updatedAt=null};var pn=class extends pi{rules=null};var cn=class{id=null;title=null;description=null;images=new W;votes=null;embedCode=null;preferencesMapping=[]};var ci=class{preferenceId=""};var Ht=class{id=null;pollId=null;optionId=null;optionIds=[];userId=null;createdAt=null};var un=class extends Ht{pollModel=null;optionModel=null;optionsModels=[];previousVotes=[];attempts=null};var dn=class extends Ht{previousVotes=[];attempts=null};var mn=class{meta=new b;data=[]};var hn=class{meta=new b;data=[]};var fn=class extends w{matchIds=null;constructor(t){super(t),this.matchIds=t&&t.matchIds?t.matchIds:null}constructFiltersUrl(){let t=super.constructMainFiltersUrl();return this.matchIds&&this.matchIds.length>0&&(t+="&",t+=`match_ids=${this.matchIds.join(",")}`),t}};var gn=class{meta=new b;data=[]};var yn=class{matchId=null;matchModel=null;playerId=null;playerModel=null;createdAt=null};var bn=class{total};var Mn=class{meta=new bn;data=[]};var In=class{teamId=null;teamModel=null;playerId=null;playerModel=null;votes=null;winner=null};var wn=class{meta=new k;data=[]};var ol=class{remapListContent=t=>{let e=new wn;return e.meta=this.remapMeta(t.meta),e.data=t.data.map(i=>{let a=new cr;return a.entityId=i.entity_id,a.entityType=i.entity_type,a}),e};remapMeta=t=>{let e=new k;return e.pagination.currentPage=t.pagination.current_page,e.pagination.itemsPerPage=t.pagination.items_per_page,e.pagination.totalItems=t.pagination.total_items,e.pagination.numberOfPages=t.pagination.number_of_pages,e}};var q=class extends v{featureConfigRemapper=null;listContentRemapper=null;localStorage=null;clientId=null;constructor(t){super(t,O(t.environment,"client")),this.clientId=t.clientId,this.localStorage=new ct().createLocalCacheInstance(t.idSchema),this.featureConfigRemapper=new al,this.listContentRemapper=new ol}getConfig=async t=>{let e=await this.getCachedFeatures();if(!e){let i=`/clients/${this.clientId}/features`,a=this.apiSignInUrl.split("&")[0],r=i+a,o="There was a problem fetching client features from Client API";e=(await this.fetchWithoutAuth(r,o)).data,await this.localStorage.setClientFeatures(e)}switch(t){case"predictor":return this.featureConfigRemapper.remapPredictorConfig(e.predictor);case"topX":return this.featureConfigRemapper.remapTopXConfig(e.top_x);case"matchQuiz":return this.featureConfigRemapper.remapMatchQuizConfig(e.match_quiz);case"loyalty":return this.featureConfigRemapper.remapLoyaltyConfig(e.loyalty);case"discussions":return this.featureConfigRemapper.remapDiscussionsConfig(e.discussions);case"fantasy":return this.featureConfigRemapper.remapFantasyConfig(e.football_fantasy)}};getNewLoyaltyConfig=async t=>{let e=`/clients/${this.clientId}/features`,i=this.apiSignInUrl.split("&")[0],a="There was a problem fetching client features from Client API";if(t){let o=e+i+m(),n=await this.fetchWithoutAuthAdditionalHeaders(o,a,{"x-api-version":"2"});await this.localStorage.setClientFeatures(n.data)}let r=await this.getCachedFeatures();if(!r){let o=e+i;r=(await this.fetchWithoutAuthAdditionalHeaders(o,a,{"x-api-version":"2"})).data,await this.localStorage.setClientFeatures(r)}return this.featureConfigRemapper.remapLoyaltyNewConfig(r.loyalty)};getListContent=async(t,e,i)=>{let a=`/clients/${this.clientId}/lists/${t}/content${this.apiSignInUrl}`;e&&(a+=e.constructFiltersUrl()),f(i)&&(a+=m());let r="There was a problem fetching client list content",o=await this.fetchWithoutAuth(a,r);return this.listContentRemapper.remapListContent(o)};getCachedFeatures=async()=>{let t=await this.getLocalStorageData();if(!(!t||!Object.keys(t).length))return t.predictor.client_id&&t.predictor.client_id!==this.clientId?(await this.localStorage.deleteClientFeatures(),null):t};getLocalStorageData=async()=>{let t=Math.floor(Date.now()/1e3);return await this.localStorage.getExpiration("client","features")>t?await this.localStorage.getClientFeatures():null}};var Et=class{clientHttps=null;errorHandlingMode=null;constructor(t){this.clientHttps=new q(t),this.errorHandlingMode=t.errorHandlingMode}setAvailableMarketsForMatch=async t=>{let{fullCoverageCompetitions:e,markets:i}=await this.clientHttps.getConfig("predictor");if(Array.isArray(t))return t.map(a=>this.setAvailableMarkets(a,e,i));if(typeof t=="object"&&Object.keys(t).length)return this.setAvailableMarkets(t,e,i)};setAvailableMarkets=(t,e,i)=>{let a=t.context.competition?.id;return a&&this.isMatchInCoverageCompetition(a,e)?(t.availableMarkets=i.all,t):(t.availableMarkets=i.main,t)};setMetaDataBatchRequest=(t,e,i)=>{let a=new k;if(a.pagination.totalItems=t,a.pagination.itemsPerPage=e,a.pagination.numberOfPages=t?Math.ceil(t/e):0,a.pagination.currentPage=i,a.pagination.numberOfPages>0&&i>a.pagination.numberOfPages)throw this.errorHandlingMode==="standard"?new h(400,"invalid_page_number","Invalid page number provided. Use number between 1 and max number of pages."):new y(400,"invalid_page_number","Invalid page number provided. Use number between 1 and max number of pages.");return a};finalizeMatchesDataBatchRequest=(t,e)=>{t=t.sort((a,r)=>new Date(a.kickoffAt).getTime()-new Date(r.kickoffAt).getTime());let i=e.limit||20;if(e.page){let a=e.page>1?i*(e.page-1):0;t=t.slice(a,a+i)}return!e.page&&t.length>i&&(t=t.slice(0,i)),t};isMatchInCoverageCompetition=(t,e)=>{let i=!1;return e.includes(t)&&(i=!0),i}};var sl=class{footballService=null;https=null;idMapping=null;constructor(t,e,i){this.idMapping=i,this.https=e,this.footballService=new Et(t)}getTeamsIdMapping=async(t,e)=>{try{let i=!1;if(t){if(t=new Pi(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 Pi({teamIds:t,limit:i}),{data:r}=await this.getTeams(a);r.sort((l,p)=>l.id.localeCompare(p.id));let o=$p(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 Jt=class{https=null;footballService=null;idMapping=null;constructor(t,e,i){this.idMapping=i,this.https=e,this.footballService=new Et(t)}getPlayersIdMapping=async(t,e)=>{try{let i=!1;if(t){if(t=new Ti(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 Ti({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=pe(t);i.sort((r,o)=>r.localeCompare(o));let a=await this.getPlayersWithNativeIds(Array.from(i));return i.forEach((r,o)=>e[r]=a[o]),e};getPlayers=async(t,e)=>{try{return e=e||!1,await this.https.getPlayers(t,e)}catch(i){throw console.warn("There was a problem retrieving the players",i),i}};getPlayerIdMapping=async(t,e)=>{try{let i=await this.idMapping.getEntityIdsBySchemaId([t],"player","native"),a=await this.getPlayerById(i.player[0],e);return await this.idMapping.remapEntities(a,"player")}catch(i){throw console.warn(`There was a problem browsing the following player:${t}`,i),i}};getPlayerById=async(t,e)=>{try{return e=e||!1,await this.https.getPlayerById(t,e)}catch(i){throw console.warn(`There was a problem retrieving the following player: ${t}`,i),i}};getTopPlayersIdMapping=async t=>{try{let e=await this.getTopPlayers(t);return await this.idMapping.remapEntities(e,"player")}catch(e){throw console.warn("There was a problem browsing the top players",e),e}};getTopPlayers=async t=>{try{return t=t||!1,await this.https.getTopPlayers(t)}catch(e){throw console.warn("There was a problem retrieving the top players",e),e}};getNextMatchForPlayerIdMapping=async(t,e)=>{try{t=(await this.idMapping.getEntityIdsBySchemaId([t],"player","native")).player[0];let a=await this.getNextMatchForPlayer(t,e);return await this.idMapping.remapEntities(a,"match")}catch(i){throw console.warn(`There was a problem browsing the next match for player:${t}`,i),i}};getNextMatchForPlayer=async(t,e)=>{try{e=e||!1;let i=await this.https.getNextMatchForPlayer(t,e);return await this.footballService.setAvailableMarketsForMatch(i)}catch(i){throw console.warn(`There was a problem retrieving the next match for player: ${t}`,i),i}};getPrevMatchForPlayerIdMapping=async(t,e)=>{try{t=(await this.idMapping.getEntityIdsBySchemaId([t],"player","native")).player[0];let a=await this.getPrevMatchForPlayer(t,e);return await this.idMapping.remapEntities(a,"match")}catch(i){throw console.warn(`There was a problem browsing the previous match for player:${t}`,i),i}};getPrevMatchForPlayer=async(t,e)=>{try{e=e||!1;let i=await this.https.getPrevMatchForPlayer(t,e);return await this.footballService.setAvailableMarketsForMatch(i)}catch(i){throw console.warn(`There was a problem retrieving the previous match for player: ${t}`,i),i}}};var Zt=class{https=null;idMapping=null;footballService=null;constructor(t,e,i){this.https=e,this.idMapping=i,this.footballService=new Et(t)}getMatchesIdMapping=async(t,e)=>{try{if(t){if(t=new gt(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 gt({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=pe(t);i.sort((r,o)=>r.localeCompare(o));let a=await this.getMatchesWithNativeIds(Array.from(i));if(i.length!==a.length){let r=new gt({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 nl=class{https=null;idMapping=null;constructor(t,e){this.https=t,this.idMapping=e}searchIdMapping=async(t,e)=>{try{if(t=new po(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 K=class{errorHandlingModel=null;constructor(t){this.errorHandlingModel=t}throwException=(t,e,i)=>{throw this.errorHandlingModel==="standard"?new h(t,e,i):new y(t,e,i)}};var ll=class extends K{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 Si=class{countriesFacade=null;competitionsFacade=null;teamsFacade=null;playerFacade=null;matchFacade=null;searchFacade=null;validator=null;constructor(t,e,i,a){this.countriesFacade=new el(e,i,a),this.competitionsFacade=new il(e,i,a),this.teamsFacade=new sl(t,i,a),this.playerFacade=new Jt(t,i,a),this.matchFacade=new Zt(t,i,a),this.searchFacade=new nl(i,a),this.validator=new ll(t)}getCountries=async t=>this.countriesFacade.getCountriesWithIdMapping(t);getCompetitions=async(t,e)=>this.competitionsFacade.getCompetitionsIdMapping(t,e);getCompetitionById=async(t,e)=>this.competitionsFacade.getCompetitionByIdIdMapping(t,e);getTopCompetitions=async t=>this.competitionsFacade.getTopCompetitionsIdMapping(t);getCompetitionsMapWithNativeIds=async t=>await this.competitionsFacade.getCompetitionsMapWithNativeIds(t);getTeams=async(t,e)=>this.teamsFacade.getTeamsIdMapping(t,e);getTeamById=async(t,e)=>this.teamsFacade.getTeamByIdIdMapping(t,e);getTopTeams=async t=>this.teamsFacade.getTopTeamsIdMapping(t);getNextMatchForTeam=async(t,e)=>this.teamsFacade.getNextMatchForTeamIdMapping(t,e);getPrevMatchForTeam=async(t,e)=>this.teamsFacade.getPrevMatchForTeamIdMapping(t,e);getTeamsMapWithNativeIds=async t=>await this.teamsFacade.getTeamsMapWithNativeIds(t);getPlayers=async(t,e)=>this.playerFacade.getPlayersIdMapping(t,e);getPlayerById=async(t,e)=>this.playerFacade.getPlayerIdMapping(t,e);getTopPlayers=async t=>this.playerFacade.getTopPlayersIdMapping(t);getNextMatchForPlayer=async(t,e)=>this.playerFacade.getNextMatchForPlayerIdMapping(t,e);getPrevMatchForPlayer=async(t,e)=>this.playerFacade.getPrevMatchForPlayerIdMapping(t,e);getPlayersMapWithNativeIds=async t=>this.playerFacade.getPlayersMapWithNativeIds(t);getMatches=async(t,e)=>this.matchFacade.getMatchesIdMapping(t,e);getMatchesMapWithNativeIds=async t=>this.matchFacade.getMatchesMapWithNativeIds(t);getMatchById=async(t,e)=>this.matchFacade.getMatchIdMapping(t,e);search=async(t,e)=>this.searchFacade.searchIdMapping(t,e);getTeamForm=async(t,e,i)=>{this.validator.validateTeamFormArguments(t,e);let a=e?.direction||"ltr",r={teamIds:[t],competitionIds:e&&e.competitionId?[e.competitionId]:null,status:"finished",limit:e?.limit||5,sortField:"date",sortOrder:"desc"},o=await this.matchFacade.getMatchesIdMapping(r,i),n={teamId:t,matches:[]};if(n.matches=o.data.map(l=>{let p=l.homeTeam.id===t,c=l.scores.ftScore.homeGoals??0,u=l.scores.ftScore.awayGoals??0,d;return p?d=c>u?"W":c<u?"L":"D":d=u>c?"W":u<c?"L":"D",{matchModel:l,isHomeGame:p,result:d}}),a==="ltr"){let l=Array.from(n.matches);n.matches=l.reverse()}return n}};var $=class{countriesFromResponse=t=>{if(t)return t.map(e=>this.countryFromResponse(e))};countryFromResponse=t=>{try{if(t){let e=new Wr;return e.id=t.id,e.alias=t.alias,e.assets=t.assets,e.countryCode=t.country_code,e.name=t.name,e}}catch(e){throw e}return null}};var Z=class{countryRemapper=null;constructor(){this.countryRemapper=new $}fromResponse(t){try{let e=new qr;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 j=class{countryRemapper=null;constructor(){this.countryRemapper=new $}fromResponse(t){try{let e=new oo;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 pl=class{countryRemapper=null;teamBasicRemapper=null;constructor(){this.countryRemapper=new $,this.teamBasicRemapper=new j}fromResponse(t){try{let e=new Qr;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 cl=class{countryRemapper=null;constructor(){this.countryRemapper=new $}fromResponse(t){try{let e=new io;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 ul=class{countryRemapper=null;competitionRemapper=null;playerRemapper=null;constructor(){this.countryRemapper=new $,this.competitionRemapper=new Z,this.playerRemapper=new cl}fromResponse(t){try{let e=new no;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 vi=class{fromResponse(t){try{let e=new Xr;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 dl=class{teamRemapper=null;competitionRemapper=null;scoresRemapper=null;constructor(){this.teamRemapper=new j,this.competitionRemapper=new Z,this.scoresRemapper=new vi}fromResponse(t){try{let e=new Kr;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 ml=class{fromResponse(t){try{let e=new Yr;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 Ci=class{fromResponse(t){try{let e=new ro;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 hl=class{playerRemapper=null;constructor(){this.playerRemapper=new Ci}fromResponse(t){try{let e=new Ve;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 fl=class{playerRemapper=null;constructor(){this.playerRemapper=new Ci}fromResponse(t){try{let e=new Jr;return e.minute=t.minute,e.type=t.type,e.teamId=t.team_id,e.player=this.playerRemapper.fromResponse(t.player),e.relatedPlayer=t.related_player?this.playerRemapper.fromResponse(t.related_player):null,e.updatedAt=t.updated_at,e}catch(e){throw console.warn("There was a problem remapping timeline",e),e}}};var gl=class{fromResponse(t){try{let e=new Zr;return e.playerId=t.player_id,e.position=t.position,e.minutesPlayed=t.minutes_played,e.yellowCards=t.yellow_cards,e.redCards=t.red_cards,e.goals=t.goals,e.penaltyGoals=t.penalty_goals,e.penaltyCommitted=t.penalty_committed,e.penaltyWon=t.penalty_won,e.penaltyMissed=t.penalty_missed,e.penaltySaved=t.penalty_saved,e.penaltyReceived=t.penalty_received,e.ownGoals=t.own_goals,e.assists=t.assists,e.cleanSheets=t.clean_sheets,e.shots=t.shots,e.shotsOn=t.shots_on,e.shotsBlocked=t.shots_blocked,e.offsides=t.offsides,e.foulsCommitted=t.fouls_committed,e.foulsWon=t.fouls_won,e.tackles=t.tackles,e.tacklesBlocks=t.tackles_blocks,e.tacklesInterceptions=t.tackles_interceptions,e.concededGoals=t.conceded_goals,e.caughtBall=t.caught_ball,e.saves=t.saves,e.passes=t.passes,e.crosses=t.crosses,e.interceptions=t.interceptions,e.keyPasses=t.key_passes,e.passesAccuracy=t.passes_accuracy,e.duels=t.duels,e.duelsWon=t.duels_won,e.dribblesAttempts=t.dribbles_attempts,e.dribblesSuccess=t.dribbles_success,e.dribblesPast=t.dribbles_past,e.updatedAt=t.updated_at,e}catch(e){throw console.warn("There was a problem remapping the player stats",e),e}}};var yl=class{teamMapper=null;competitionsMapper=null;lineupsMapper=null;scoresMapper=null;statsMapper=null;timelineMapper=null;playerStatsMapper=null;constructor(){this.teamMapper=new j,this.competitionsMapper=new Z,this.lineupsMapper=new hl,this.scoresMapper=new vi,this.statsMapper=new ml,this.timelineMapper=new fl,this.playerStatsMapper=new gl}fromResponse(t){try{let e=new jr;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 Ve,e}catch(e){throw console.warn("There was a problem remapping the match response",e),e}}};var bl=class{countryRemapper=null;constructor(){this.countryRemapper=new $}fromResponse(t){try{let e=new ao;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 Ai=class{countryRemapper=null;teamRemapper=null;constructor(){this.countryRemapper=new $,this.teamRemapper=new j}fromResponse(t){try{let e=new to;return e.id=t.id,e.firstName=t.first_name?t.first_name:null,e.lastName=t.last_name?t.last_name:null,e.name=t.name?t.name:null,e.birthDate=t.birth_date,e.country=this.countryRemapper.countryFromResponse(t.country),e.assets=t.assets,e.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 Ml=class{countryRemapper=null;teamRemapper=null;competitionRemapper=null;constructor(){this.countryRemapper=new $,this.teamRemapper=new j,this.competitionRemapper=new Z}fromResponse(t){try{let e=new eo;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 Il=class{teamRemapper=null;playerRemapper=null;competitionremapper=null;constructor(){this.teamRemapper=new j,this.playerRemapper=new Ai,this.competitionremapper=new Z}fromResponse(t){try{let e=new lo;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 wl=class{remapMetaProp=t=>{let e=new k;return e.pagination.currentPage=t.pagination.current_page,e.pagination.itemsPerPage=t.pagination.items_per_page,e.pagination.totalItems=t.pagination.total_items,e.pagination.numberOfPages=t.pagination.number_of_pages,e}};var _l=class{remapPlayersPoints=t=>{let e=new Hr;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 zr;return e.playerId=t.player_id,e.points=t.points,e.rank=t.rank,e};remapPlayerDetailedStats=t=>{let e=new kr;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 Ge;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 Ue;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 dt=class extends v{limitIds=200;countryRemapper=null;competitionBasicRemapper=null;competitionFullRemapper=null;teamBasicRemapper=null;teamFullRemapper=null;matchBasicRemapper=null;matchFullRemapper=null;playerBasicRemapper=null;playerFullRemapper=null;topPlayerRemapper=null;searchRemapper=null;footballMetaRemapper=null;fantasyRemapper=null;footballService=null;constructor(t){super(t,O(t.environment,"football")),this.apiSignInUrl=t.lang!=="en"?this.apiSignInUrl+`&lang=${t.lang}`:this.apiSignInUrl,this.countryRemapper=new $,this.competitionBasicRemapper=new Z,this.competitionFullRemapper=new pl,this.teamBasicRemapper=new j,this.teamFullRemapper=new ul,this.matchBasicRemapper=new dl,this.matchFullRemapper=new yl,this.playerBasicRemapper=new Ai,this.playerFullRemapper=new Ml,this.topPlayerRemapper=new bl,this.searchRemapper=new Il,this.footballMetaRemapper=new wl,this.footballService=new Et(t),this.fantasyRemapper=new _l}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=qt(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=qt(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 Yt,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=qt(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 Yt;return l.data=n,l}else{let r=new Yt,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 Yt,a="There was a problem with football matches request";if(t&&t.matchIds&&t.matchIds.length>this.limitIds){let r=[],o=qt(t.matchIds,this.limitIds);for(let l of o){let p=new gt({...t,matchIds:l,limit:l.length}),c=!0,u=`/matches${this.apiSignInUrl}${p.constructFilterUrl(c)}&limit=${l.length}`;e&&(u+=m());let d=await this.fetchWithoutAuth(u,a);r.push(d.data.map(M=>this.matchBasicRemapper.fromResponse(M)))}let n=Array.prototype.concat.apply([],r);return i.meta=this.footballService.setMetaDataBatchRequest(n.length,t.limit||20,t.page||1),i.data=this.footballService.finalizeMatchesDataBatchRequest(n,t),i}else{let r=`/matches${this.apiSignInUrl}`;t&&(r+=`${t.constructFilterUrl()}`),e&&(r+=m());let o=await this.fetchWithoutAuth(r,a);return i.meta=this.footballMetaRemapper.remapMetaProp(o.meta),i.data=o.data.map(n=>this.matchBasicRemapper.fromResponse(n)),i}};search=async(t,e)=>{let i=`/search${this.apiSignInUrl}${t.constructFilterUrl()}`,a=Date.now(),r="There was a problem with football search request";e&&(i+=`&disable_cache=${a}`);let o=await this.fetchWithoutAuth(i,r);return this.searchRemapper.fromResponse(o.data)};getPlayersPoints=async(t,e,i)=>{let a=`/players/points/${t}${this.apiSignInUrl}`,r=Date.now(),o="There was a problem with players points request";e&&(a+=`&position=${e.toLocaleLowerCase()}`),i&&(a+=`&disable_cache=${r}`);let n=await this.fetchWithoutAuth(a,o);return this.fantasyRemapper.remapPlayersPoints(n)};getPlayerDetailedStatistics=async(t,e,i)=>{let a=`/players/${e}/points/${t}${this.apiSignInUrl}`,r=Date.now(),o="There was a problem with detailed player points request";i&&(a+=`&disable_cache=${r}`);let n=await this.fetchWithoutAuth(a,o);return this.fantasyRemapper.remapPlayerDetailedStats(n)}};var Pl=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 Zs;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 Tl=class{idMapping=null;profileOperations=null;constructor(t,e){this.idMapping=new R(t),this.profileOperations=new Pl(t,e,this.idMapping)}remapProfileStats=async t=>await this.profileOperations.remapProfileStats(t);remapInterestToNative=async t=>await this.profileOperations.remapInterestToNative(t);remapInterests=async t=>await this.profileOperations.remapInterests(t);showFullInterests=async t=>await this.profileOperations.showFullInterests(t)};var D=class{idsRemapper=null;profileHttps=null;activityHttps=null;footballHttps=null;footballFacade=null;idMapping=null;localCache=null;profileFacade=null;ownProfileBuilder=null;profileBuilder=null;constructor(t){this.profileHttps=new Mi(t),this.activityHttps=new hi(t),this.footballHttps=new dt(t),this.idMapping=new R(t),this.localCache=new ct().createLocalCacheInstance(t.idSchema),this.footballFacade=new Si(t,this.localCache,this.footballHttps,this.idMapping),this.profileFacade=new _t(this.localCache,this.profileHttps,this.activityHttps,t.errorHandlingMode),this.idsRemapper=new Tl(t,this.footballFacade),this.ownProfileBuilder=new tl(t,this.idsRemapper,this.localCache,this.profileHttps,this.activityHttps),this.profileBuilder=new wi(this.idsRemapper,this.localCache,this.profileHttps,this.activityHttps)}getOwn=()=>this.ownProfileBuilder;getById=t=>this.profileBuilder.getById(t);getCountries=async t=>await this.profileFacade.getCountries(t);getByIds=async(t,e,i)=>await this.profileFacade.getByIds(t,e,i);collectLead=async t=>await this.profileFacade.collectLead(t);checkFollowStatus=async t=>await this.profileFacade.checkFollowStatus(t);getOwnStats=async()=>await this.ownProfileBuilder.getStats();getStats=async(t,e)=>await this.profileBuilder.getById(t).getStats(e);getOwnBadges=async()=>await this.ownProfileBuilder.getBadges();getBadges=async t=>await this.profileBuilder.getById(t).getBadges()};var El=class extends w{};var $u=(r=>(r.LIKE="like",r.DISLIKE="dislike",r.SHARE="share",r.COMMENT="comment",r.PREDICTION_MADE="prediction_made",r))($u||{});var zu=(a=>(a.CORRECT="CORRECT",a.INCORRECT="INCORRECT",a.PARTIALLY_CORRECT="PARTIALLY_CORRECT",a.NOT_VERIFIED="NOT_VERIFIED",a))(zu||{});var Rl=(i=>(i.ONE="1",i.X="x",i.TWO="2",i))(Rl||{}),Fl=(i=>(i.ONE_X="1x",i.X_TWO="x2",i.ONE_TWO="12",i))(Fl||{}),Sl=(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))(Sl||{});var su=(F=>(F.NONE="none",F.FINISHED="finished",F.CANCELLED="cancelled",F.POSTPONED="postponed",F.NOT_STARTED="not_started",F.FIRST_HALF="1st_half",F.SECOND_HALF="2nd_half",F.FINISHED_AFTER_AWARDED_WIN="finished_after_awarded_win",F.TO_FINISH="to_finish",F.FINISHED_AET="finished_aet",F.HALFTIME="halftime",F.FINISHED_AP="finished_ap",F.INTERRUPTED="interrupted",F.KICK_OFF_DELAYED="kick_off_delayed",F.ABANDONED="abandoned",F.WAITING_FOR_PENALTY="waiting_for_penalty",F.PENALTY="penalty",F.PAUSE="pause",F.EXTRA_TIME_1ST_HALF="extra_time_1st_half",F.EXTRA_TIME_END_OF_1ST_HALF="extra_time_end_of_1st_half",F.EXTRA_TIME_2ND_HALF="extra_time_2nd_half",F.WAITING_FOR_EXTRA_TIME="waiting_for_extra_time",F.NO_INFO_YET="no_info_yet",F.AWAITING_INFO="awaiting_info",F.FINISHED_ASG="finished_asg",F))(su||{});var vl=class extends K{constructor(t){super(t)}validatePrediction=t=>{(!t.fixtures||!Array.isArray(t.fixtures)||t.fixtures.length===0)&&this.throwException(400,"invalid_method_call","Fixtures field is required and should contain at least one fixtures object. For more information please visit our documentation");let e=Object.keys(new mr);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 Cl=class{https=null;validator=null;profile=null;constructor(t){this.https=new Kt(t),this.profile=new D(t),this.validator=new vl(t.errorHandlingMode)}getGames=async(t,e)=>(t&&(t=new hr(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 dr(i));let r=await this.https.getBracketGamePredictionsForUser(t,e,i,a),o=null;try{o=await this.profile.getById(e).getInfo()}catch(n){console.error(n)}return r.data.forEach(n=>{n.profileModel=o}),r};getGamePredictionById=async(t,e,i)=>await this.https.getBracketGamePredictionById(t,e,i);getRankings=async(t,e,i)=>{e&&(e=new El(e));let a=await this.https.getBracketGameRankings(t,e,i),r=a.data.map(n=>n.profileId),o=[];return r.length>0&&(o=await this.profile.getByIds(r),a.data=a.data.map(n=>(n.profileModel=o.find(l=>l.id===n.profileId)||null,n))),a}};var Al=class{facade=null;constructor(t){this.facade=new Cl(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 Ol=class{remapResponse=t=>(t.meta=this.remapMeta(t.meta),t.data=this.remapData(t.data),t);remapLeagueLeaderboardResponse=t=>(t.meta=this.remapLeagueLeaderboardMeta(t.meta),t.data=this.remapData(t.data),t);remapTemplateBreakdown=t=>(t.meta=this.remapMeta(t.meta),t.data=t.data.map(e=>this.remapTemplatePoints(e)),t);remapMeta=t=>{let e=new Dt;return e.rankType=t.rank_type,e.fromDate=t.from_date,e.toDate=t.to_date,e.pagination.currentPage=t.pagination.current_page,e.pagination.itemsPerPage=t.pagination.items_per_page,e.pagination.totalItems=t.pagination.total_items,e.pagination.numberOfPages=t.pagination.number_of_pages,e};remapLeagueLeaderboardMeta=t=>{let e=new He;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 $e;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 vo;return e.groupId=t.group_id,e.averagePoints=t.average_points,e.highestPoints=t.highest_points,e}};var xl=class{remapRankings=t=>(t.meta=this.remapMeta(t.meta),t.data=this.remapData(t.data),t);remapRankingsPrivateLeague=t=>(t.meta=this.remapMeta(t.meta),t.data=this.remapDataUserRankingPrivateLeague(t.data),t);remapRankingsChallenge=t=>(t.meta=this.remapMeta(t.meta),t.data=this.remapDataUserRankingChallenge(t.data),t);remapMeta=t=>{let e=new k;return e.pagination.currentPage=t.pagination.current_page,e.pagination.itemsPerPage=t.pagination.items_per_page,e.pagination.numberOfPages=t.pagination.number_of_pages,e.pagination.totalItems=t.pagination.total_items,e};remapData(t){let e=[];return t.forEach(i=>{let a=new So;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 js;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 Ll=class{entityId=null;entityType=null};var tt=class{remapBranding=t=>{let e=new co;return t.colors&&(e.colors=new uo,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 mo,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 ho,e.images.mainLogo=t.images.main_logo,e.images.mobileLogo=t.images.mobile_logo,e.images.backgroundImage=t.images.background_image,e.images.mobileBackgroundImage=t.images.mobile_background_image,e.images.additionalImage=t.images.additional_image),e}};var Dl=class extends tt{remapResponse=t=>{let e=[];return t.forEach(i=>{let a=new Bt;a.id=i.id,a.name=i.name,a.description=i.description,a.type=i.type,a.fromDate=i.from_date,a.toDate=i.to_date,a.markets=i.markets?i.markets:null,a.teamIds=i.team_ids?i.team_ids:null,a.matchIds=i.match_ids?i.match_ids:null,a.groups=i.groups?this.remapGroups(i.groups):null,a.gameIds=i.game_ids?i.game_ids:null,a.gameTypes=i.game_types?i.game_types:null,a.competitionIds=i.competition_ids?i.competition_ids:null,a.excludedProfileIds=i.excluded_profile_ids?i.excluded_profile_ids:null,a.rules=i.rules?i.rules:null,a.labels=i.labels?i.labels:null,a.customFields=i.custom_fields?i.custom_fields:null,a.branding=i.branding?this.remapBranding(i.branding):null,a.flags=i.flags?i.flags:null,a.images=i.images?i.images:null,a.status=i.status?i.status:null,a.automaticallyChangeStatus=i.automatically_change_status,a.createdAt=i.created_at,a.updatedAt=i.updated_at,a.related=i.related?this.remapRelated(i.related):null,e.push(a)}),e};remapResponseId=t=>{let e=new Co;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 Fo;return e.pagination.currentPage=t.pagination.current_page,e.pagination.itemsPerPage=t.pagination.items_per_page,e.pagination.totalItems=t.pagination.total_items,e.pagination.numberOfPages=t.pagination.number_of_pages,e.filters.flags=t.filters.flags,e.filters.status=t.filters.status,e.filters.type=t.filters.type,e.filters.activeFrom=t.filters.active_from,e.filters.activeTo=t.filters.active_to,e.filters.createdFrom=t.filters.created_from,e.filters.createdTo=t.filters.created_to,e.filters.updatedFrom=t.filters.updated_from,e.filters.updatedTo=t.filters.updated_to,e};remapRelated=t=>t.map(e=>{let i=new Ll;return i.entityId=e.entity_id,i.entityType=e.entity_type,i});remapGroups=t=>t.map(e=>{let i=new Ao;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 Bl=class{remapHighestSuccessRate=t=>t.map(e=>{let i=new Eo;return i.position=e.position,i.points=e.points,i.predictionsMade=e.predictions_made,i.profileId=e.profile_id,i.successRatePercent=e.success_rate_percent,i})};var Rt=class extends v{templateRemapper=null;leaderboardRemapper=null;rankingsRemapper=null;highestSuccessRateRemapper=null;constructor(t){super(t,O(t.environment,"loyalty")),this.templateRemapper=new Dl,this.leaderboardRemapper=new Ol,this.rankingsRemapper=new xl,this.highestSuccessRateRemapper=new Bl}getTemplates=async(t,e)=>{let i=t?`/leaderboard/templates/${this.apiSignInUrl}${t.constructFiltersUrl()}`:`/leaderboard/templates/${this.apiSignInUrl}`;i+=f(e)?m():"";let a="There was a problem fetching the list of templates",r=await this.fetchWithoutAuth(i,a),o=JSON.parse(JSON.stringify(r));return o.meta=this.templateRemapper.remapMeta(r.meta),o.data=this.templateRemapper.remapResponse(r.data),o};getTemplateById=async(t,e)=>{let i=f(e)?`/leaderboard/templates/${t}${this.apiSignInUrl}${m()}`:`/leaderboard/templates/${t}${this.apiSignInUrl}`,a=`There was a problem requesting the following template: ${t}`,r=await this.fetchWithoutAuth(i,a);return this.templateRemapper.remapResponseId(r.data)};getLeaderboard=async(t,e,i)=>{let a=f(e)?`/leaderboard/${t}${this.apiSignInUrl}${m()}`:`/leaderboard/${t}${this.apiSignInUrl}`,r=`There was a problem fetching the leaderboard for the following template: ${t}`;i&&(a+=`${i.constructFiltersUrl()}`);let o=await this.fetchWithoutAuth(a,r),n=JSON.parse(JSON.stringify(o));return this.leaderboardRemapper.remapResponse(n)};getLeaderboardForGame=async(t,e,i)=>{let a=f(e)?`/leaderboard/games/${t}${this.apiSignInUrl}${m()}`:`/leaderboard/games/${t}${this.apiSignInUrl}`,r=`There was a problem fetching the leaderboard for the following game: ${t}`;i&&(a+=`${i.constructFiltersUrl()}`);let o=await this.fetchWithoutAuth(a,r),n=JSON.parse(JSON.stringify(o));return this.leaderboardRemapper.remapResponse(n)};getLeaderboardForLeague=async(t,e)=>{let i=`/private-league/${t}${this.apiSignInUrl}`,a=`There was a problem fetching the leaderboard for the following league: ${t}`;e&&(i+=`${e.constructFiltersUrl()}`);let r=await this.fetchWithoutAuth(i,a);return this.leaderboardRemapper.remapLeagueLeaderboardResponse(r)};getUserRankings=async(t,e,i)=>{let a=`/leaderboard/users/${t}/rankings${this.apiSignInUrl}`,r=`There was a problem fetching the rankings for the following user: ${t}`;e&&(a+=`${e.constructFiltersUrl()}`),f(i)&&(a+=`${m()}`);let o=await this.fetchWithoutAuth(a,r);return this.rankingsRemapper.remapRankings(o)};getHighestSuccessRate=async(t,e)=>{let i=`/statistics/top${this.apiSignInUrl}`,a="There was a problem fetching highest success rate";t&&(i+=`${t.constructFiltersUrl()}`),f(e)&&(i+=`${m()}`);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}${m()}`:`/statistics/follows${this.apiSignInUrl}`,a="There was a problem fetching follows for entities";return t.footballCompetitions&&(i+=`&competitions=${t.footballCompetitions.join(",")}`),t.footballTeams&&(i+=`&teams=${t.footballTeams.join(",")}`),t.footballPlayers&&(i+=`&players=${t.footballPlayers.join(",")}`),(await this.fetchWithoutAuth(i,a)).data};getUserRankingsForPrivateLeagueAndChallenges=async(t,e,i)=>{let a=`/private-league/users/${t}/rankings${this.apiSignInUrl}&private_league_type=${e==="PRIVATE_LEAGUE"?"private":"one_vs_one"}`,r=`There was a problem fetching user rankings for ${e}`;i&&(a+=`${i.constructFiltersUrl()}`);let o=await this.fetchWithoutAuth(a,r);return e==="PRIVATE_LEAGUE"?this.rankingsRemapper.remapRankingsPrivateLeague(o):this.rankingsRemapper.remapRankingsChallenge(o)};getTemplateBreakdownPoints=async t=>{let e=`/leaderboard/${t}/breakdown${this.apiSignInUrl}`,i=`There was a problem fetching template breakdown points for: ${t}`,a=await this.fetchWithoutAuth(e,i);return this.leaderboardRemapper.remapTemplateBreakdown(a)}};var Nl=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 b;return e.pagination.itemsPerPage=t.items_per_page,e.pagination.nextPageStartsAfter=t.next_page_starts_after,e};remapToPrivateLeagueById=t=>{let e=new qs;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 ii;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 zs;return e.profileId=t.profile_id,e.leagueId=t.league_id,e.message=t.message,e};remapToAcceptChallenge=t=>{let e=new fr;return e.profileId=t.profile_id,e.challengeId=t.league_id,e.message=t.message,e};remapPredictions=t=>(t.meta=this.remapMeta(t.meta),t.data=this.remapPredictionsData(t.data),t);remapMeta=t=>{let e=new k;return e.pagination.currentPage=t.pagination.current_page,e.pagination.itemsPerPage=t.pagination.items_per_page,e.pagination.numberOfPages=t.pagination.number_of_pages,e.pagination.totalItems=t.pagination.total_items,e};remapPredictionsData=t=>t.map(e=>{let i=new Qs;return i.predictionId=e.prediction_id,i.profileId=e.profile_id,i})};var Oi=class{remapToDiscussions=t=>(t.meta=this.remapToMeta(t.meta),t.data=t.data.map(e=>this.remapToDiscussionById(e)),t);remapToDiscussionById=t=>{let e=new wr;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 Er,a=new Rr;return i.meta=this.remapToPostMeta(t.meta),i.data=t.data.map(r=>this.remapToPostByIdBasic(r)),a.meta=this.remapToPostMeta(t.meta),a.data=t.data.map(r=>this.remapToPostByIdFull(r)),e==="basic"?i:a};remapToPosts=t=>{let e=new Fr;return e.meta=this.remapToMeta(t.meta),e.data=t.data.map(i=>this.remapToPostByIdBasic(i)),e};remapToPostMeta=t=>{let e=new Lt;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 b;return e.pagination.itemsPerPage=t.pagination.items_per_page,e.pagination.nextPageStartsAfter=t.pagination.next_page_starts_after,e};remapToPostByIdBasic=t=>{let e=new Ne;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 _r;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 Tr;return i.id=e.id,i.postsCount=e.posts_count,i});remapReactionsPost=t=>{let e=new Sr;return e.type=t.type,e.userIds=t.user_ids,e.reactionCount=t.reaction_count,e};remapVersionsPost=t=>{let e=new Cr;return e.content=t.content,e.updatedAt=t.updated_at,e};remapReportPost=t=>{let e=new vr;return e.userId=t.user_id,e.reason=t.reason,e.reasonDetails=t.reason_details,e}};var xi=class extends v{remapper=null;discussionsRemapper=null;discussionsBaseURL=null;constructor(t){super(t,O(t.environment,"privateLeagues")),this.discussionsBaseURL=O(t.environment,"discussions"),this.remapper=new Nl,this.discussionsRemapper=new Oi}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+=m());let o=`There was a problem getting ${e==="PRIVATE_LEAGUE"?"private league":"challenge"}`,n=await this.fetchWithAuth(a,o);return this.remapper.remapToPrivateLeagueById(n.data)};getMyLeagues=async(t,e)=>{let i="/leagues"+this.apiSignInUrl+t.constructFiltersUrl(),r=`There was a problem getting user's ${e==="PRIVATE_LEAGUE"?"private leagues":"challenges"}`;return(await this.fetchWithAuth(i,r)).data.map(n=>this.remapper.remapToMyPrivateLeagues(n))};delete=async(t,e)=>{let i=`/leagues/${t}`+this.apiSignInUrl,r=`There was a problem deleting ${e==="PRIVATE_LEAGUE"?"private league":"challenge"}`,o="DELETE";return await this.fetchWithAuth(i,r,o),!0};invite=async(t,e)=>{let i=`/membership/invite/${t}`+this.apiSignInUrl,a=`There was a problem inviting the following users: ${e.join(",")}`,r="POST",o={profiles:e};return(await this.fetchWithAuth(i,a,r,o)).data};deleteInvitation=async(t,e)=>{let i=`/membership/invite/${t}`+this.apiSignInUrl,a=`There was a problem deleting invitation for the following users: ${e.join(",")}`,r="DELETE",o={profiles:e};return await this.fetchWithAuth(i,a,r,o),!0};accept=async(t,e,i)=>{let a=`/membership/accept/${t}`+this.apiSignInUrl+`&accept=${e?"ACCEPT":"REJECT"}`,o=`There was a problem ${e?"accepting":"rejecting"} invitation for ${i==="PRIVATE_LEAGUE"?"private league":"challenge"}: ${t}`,n="POST",l=await this.fetchWithAuth(a,o,n);return i==="PRIVATE_LEAGUE"?this.remapper.remapToAcceptPrivateLeague(l.data):this.remapper.remapToAcceptChallenge(l.data)};ban=async(t,e)=>{let i=`/membership/ban/${t}`+this.apiSignInUrl,a=`There was a problem banning the following users: ${e.join(",")}`,r="POST",o={profiles:e};return(await this.fetchWithAuth(i,a,r,o)).data};unban=async(t,e)=>{let i=`/membership/unban/${t}`+this.apiSignInUrl,a=`There was a problem unbanning the following users: ${e.join(",")}`,r="POST",o={profiles:e};return(await this.fetchWithAuth(i,a,r,o)).data};join=async t=>{let e="/membership/join"+this.apiSignInUrl+`&invitation_code=${t}`,i="There was a problem joining league",a="POST",r=await this.fetchWithAuth(e,i,a);return this.remapper.remapToAcceptPrivateLeague(r.data)};leave=async(t,e)=>{let i=`/membership/leave/${t}`+this.apiSignInUrl,r=`There was a problem leaving the following ${e==="PRIVATE_LEAGUE"?"league":"challenge"}: ${t}`,o="POST";return(await this.fetchWithAuth(i,r,o)).data};getInvitations=async(t,e)=>{let i="/membership/invitations"+this.apiSignInUrl+e.constructMainFiltersUrl(),r=`There was a problem getting invitations for ${t==="PRIVATE_LEAGUE"?"leagues":"challenges"}`,o=await this.fetchWithAuth(i,r);return this.remapper.remapToPrivateLeagues(o)};getReportedPosts=async(t,e)=>{let i=`/discussions/${t}/posts/reported${this.apiSignInUrl}`,a=`There was a problem fetching posts for the following: ${t}`;e&&(i+=e.constructMainFiltersUrl());let r=await this.fetchWithAuthNewBaseURL(this.discussionsBaseURL,i,a);return this.discussionsRemapper.remapToPostsForDiscussion(r,"full")};getPredictions=async(t,e)=>{let i=`/leagues/${t}/predictions`+this.apiSignInUrl,a=`There was a problem getting predictions for private league: ${t}`;e&&(i+=e.constructFiltersUrl());let r=await this.fetchWithAuth(i,a);return this.remapper.remapPredictions(r)};moderatePost=async(t,e)=>{let i=`/posts/${t}/admin/moderate${this.apiSignInUrl}`,a=`There was a problem moderating the following post: ${t}`,r="POST",o={moderation_reason:e},n=await this.fetchWithAuthNewBaseURL(this.discussionsBaseURL,i,a,r,o);return this.discussionsRemapper.remapToPostByIdBasic(n.data)}};var Li=class{createRequestBodyFromParam=(t,e)=>{let i=e==="PRIVATE"?new Ys:new gr;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 Xs:new yr;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 kl=class{ALL_FINISHED_STATUSES=["finished","cancelled","interrupted","abandoned","finished_after_awarded_win","finished_aet","finished_ap","finished_asg","to_finish"];ALL_UPCOMING_STATUSES=["not_started","kick_off_delayed"];ALL_LIVE_STATUSES=["1st_half","2nd_half","halftime","waiting_for_penalty","waiting_for_extra_time","penalty","pause","extra_time_1st_half","extra_time_2nd_half","extra_time_end_of_1st_half","awaiting_info"];getMatchEventStatus(t){if(!t||!t.type||!t.subType)return"no_info_yet";let e=t.type.toLowerCase(),i=t.subType.toLowerCase();return e==="finished"?i==="awarded_win"?"finished_after_awarded_win":i==="aet"?"finished_aet":i==="ap"?"finished_ap":i==="asg"?"finished_asg":"finished":e==="notstarted"?i==="postponed"?"postponed":i==="delayed"?"kick_off_delayed":"not_started":e==="inprogress"?i==="1st_half"?"1st_half":i==="2nd_half"?"2nd_half":i==="halftime"?"halftime":i==="penalty"?"penalty":i==="waiting_penalty"?"waiting_for_penalty":i==="pause"?"pause":i==="extra_time_1st_half"?"extra_time_1st_half":i==="extra_time_2nd_half"?"extra_time_2nd_half":i==="extra_time_halftime"?"extra_time_end_of_1st_half":i==="waiting_extra_time"?"waiting_for_extra_time":"awaiting_info":e==="interrupted"?i==="abandoned"?"abandoned":i==="to_finish"?"to_finish":"interrupted":e==="cancelled"?"cancelled":"no_info_yet"}isUpcoming(t){if(!t)return!1;let e=this.getMatchEventStatus(t);return this.ALL_UPCOMING_STATUSES.includes(e)}isLive(t){if(!t)return!1;let e=this.getMatchEventStatus(t);return this.ALL_LIVE_STATUSES.includes(e)}isFinished(t){if(!t)return!1;let e=this.getMatchEventStatus(t);return this.ALL_FINISHED_STATUSES.includes(e)}};var Gl=class{matchStatusHelper;constructor(){this.matchStatusHelper=new kl}getMatchStatusEnum(t){return this.matchStatusHelper.getMatchEventStatus(t)}isMatchUpcoming(t){return this.matchStatusHelper.isUpcoming(t)}isMatchLive(t){return this.matchStatusHelper.isLive(t)}isMatchFinished(t){return this.matchStatusHelper.isFinished(t)}};var et=class{https=null;idMapping=null;localCache=null;footballFacade=null;footballHelpers;constructor(t){this.https=new dt(t),this.idMapping=new R(t),this.localCache=new ct().createLocalCacheInstance(t.idSchema),this.footballFacade=new Si(t,this.localCache,this.https,this.idMapping),this.footballHelpers=new Gl}getCountries=async t=>await this.footballFacade.getCountries(t);getCompetitions=async(t,e)=>await this.footballFacade.getCompetitions(t,e);getCompetitionById=async(t,e)=>await this.footballFacade.getCompetitionById(t,e);getTopCompetitions=async t=>await this.footballFacade.getTopCompetitions(t);getTeams=async(t,e)=>await this.footballFacade.getTeams(t,e);getTeamById=async(t,e)=>await this.footballFacade.getTeamById(t,e);getTopTeams=async t=>await this.footballFacade.getTopTeams(t);getNextMatchForTeam=async(t,e)=>await this.footballFacade.getNextMatchForTeam(t,e);getPrevMatchForTeam=async(t,e)=>await this.footballFacade.getPrevMatchForTeam(t,e);getPlayers=async(t,e)=>await this.footballFacade.getPlayers(t,e);getPlayerById=async(t,e)=>await this.footballFacade.getPlayerById(t,e);getTopPlayers=async t=>await this.footballFacade.getTopPlayers(t);getNextMatchForPlayer=async(t,e)=>await this.footballFacade.getNextMatchForPlayer(t,e);getPrevMatchForPlayer=async(t,e)=>await this.footballFacade.getPrevMatchForPlayer(t,e);getMatches=async(t,e)=>await this.footballFacade.getMatches(t,e);getMatchById=async(t,e)=>await this.footballFacade.getMatchById(t,e);search=async(t,e)=>await this.footballFacade.search(t,e);getTeamForm=async(t,e,i)=>await this.footballFacade.getTeamForm(t,e,i);get helpers(){return this.footballHelpers}};var Ul=class{matchFacade=null;playerFacade=null;predictorService=null;constructor(t,e,i){this.matchFacade=t,this.playerFacade=e,this.predictorService=i}remapFixturesRequest=t=>{let e={};if(e.match_id=t.matchId,e.match_type="FOOTBALL",t instanceof st)e.market=t.market,e.prediction=t.prediction.value,e.player_id=t.prediction.playerId;else if(t instanceof Je||t instanceof Ze)e.market=t.market,e.prediction=t.prediction.value;else if(t instanceof Ut){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 Ye;l.target?p.market=this.predictorService.convertMarketForResponseModel(l.market,l.target):p.market=l.market,p.matchId=n[l.match_id].id,p.matchType=l.match_type,p.matchModel=n?n[l.match_id]:null,delete p.matchModel.availableMarkets,l.prediction!==void 0?p.prediction.value=l.prediction:l.goals_home!==void 0&&l.goals_away!==void 0&&(p.prediction.value=l.goals_home.toString()+":"+l.goals_away.toString()),p.prediction.playerId=l.player_id?l.player_id:null,l.market==="PLAYER_PERFORMANCE"&&(p.prediction.playerRole=l.role),p.prediction.playerId&&p.prediction.playerId!==e&&(p.prediction.playerModel=r[l.player_id],p.prediction.playerId=r[l.player_id].id),p.result=this.remapResult(l.result),o.push(p)}return o};remapResult=t=>{let e=new Xe;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 Vc=class{constructor(){}static createMatchMarketsResultsModel(t,e){return{FT_1X2:this.createOneXTwoResult(t.scores,"full_time"),HT_1X2:this.createOneXTwoResult(t.scores,"half_time"),BOTH_TEAMS_SCORE:t.scores.ftScore.homeGoals>0&&t.scores.ftScore.awayGoals>0,DOUBLE_CHANCE:this.createDoubleChanceResult(t.scores),HT_FT:this.createHalfTimeFullTimeResult(t.scores),RED_CARD_MATCH:this.createMarketResultByCriteria(t,"red_card"),PENALTY_MATCH:this.createMarketResultByCriteria(t,"penalty"),CORNERS_MATCH:isNaN(t.stats?.corners?.homeTeam+t.stats?.corners?.awayTeam)?null:t.stats.corners.homeTeam+t.stats.corners.awayTeam,PLAYER_YELLOW_CARD:this.createPlayersMarketsResults(t,e,"yellow_card"),PLAYER_RED_CARD:this.createPlayersMarketsResults(t,e,"red_card"),PLAYER_SCORE_FIRST_GOAL:this.createPlayersMarketsResults(t,e,"first_goal"),PLAYER_SCORE:this.createPlayersMarketsResults(t,e,"one_goal"),PLAYER_SCORE_TWICE:this.createPlayersMarketsResults(t,e,"two_goals"),PLAYER_SCORE_HATTRICK:this.createPlayersMarketsResults(t,e,"hattrick"),CORRECT_SCORE:{homeGoals:t.scores.ftScore.homeGoals,awayGoals:t.scores.ftScore.awayGoals},CORRECT_SCORE_ADVANCED:{homeGoals:t.scores.ftScore.homeGoals,awayGoals:t.scores.ftScore.awayGoals},CORRECT_SCORE_HT:{homeGoals:t.scores.htScore.homeGoals,awayGoals:t.scores.htScore.awayGoals},OVER_GOALS_0_5:t.scores.ftScore.homeGoals+t.scores.ftScore.awayGoals>0,OVER_GOALS_1_5:t.scores.ftScore.homeGoals+t.scores.ftScore.awayGoals>1,OVER_GOALS_2_5:t.scores.ftScore.homeGoals+t.scores.ftScore.awayGoals>2,OVER_GOALS_3_5:t.scores.ftScore.homeGoals+t.scores.ftScore.awayGoals>3,OVER_GOALS_4_5:t.scores.ftScore.homeGoals+t.scores.ftScore.awayGoals>4,OVER_GOALS_5_5:t.scores.ftScore.homeGoals+t.scores.ftScore.awayGoals>5,OVER_GOALS_6_5:t.scores.ftScore.homeGoals+t.scores.ftScore.awayGoals>6,OVER_CORNERS_6_5:isNaN(t.stats?.corners?.homeTeam+t.stats?.corners?.awayTeam)?null:t.stats.corners.homeTeam+t.stats.corners.awayTeam>6,OVER_CORNERS_7_5:isNaN(t.stats?.corners?.homeTeam+t.stats?.corners?.awayTeam)?null:t.stats.corners.homeTeam+t.stats.corners.awayTeam>7,OVER_CORNERS_8_5:isNaN(t.stats?.corners?.homeTeam+t.stats?.corners?.awayTeam)?null:t.stats.corners.homeTeam+t.stats.corners.awayTeam>8,OVER_CORNERS_9_5:isNaN(t.stats?.corners?.homeTeam+t.stats?.corners?.awayTeam)?null:t.stats.corners.homeTeam+t.stats.corners.awayTeam>9,OVER_CORNERS_10_5:isNaN(t.stats?.corners?.homeTeam+t.stats?.corners?.awayTeam)?null:t.stats.corners.homeTeam+t.stats.corners.awayTeam>10,OVER_CORNERS_11_5:isNaN(t.stats?.corners?.homeTeam+t.stats?.corners?.awayTeam)?null:t.stats.corners.homeTeam+t.stats.corners.awayTeam>11,OVER_CORNERS_12_5:isNaN(t.stats?.corners?.homeTeam+t.stats?.corners?.awayTeam)?null:t.stats.corners.homeTeam+t.stats.corners.awayTeam>12,OVER_CORNERS_13_5:isNaN(t.stats?.corners?.homeTeam+t.stats?.corners?.awayTeam)?null:t.stats.corners.homeTeam+t.stats.corners.awayTeam>13}}},Ft=Vc;it(Ft,"createOneXTwoResult",(t,e)=>e==="full_time"?t.ftScore.homeGoals>t.ftScore.awayGoals?"1":t.ftScore.homeGoals===t.ftScore.awayGoals?"x":"2":t?.htScore?.homeGoals>t?.htScore?.awayGoals?"1":t?.htScore?.homeGoals===t?.htScore?.awayGoals?"x":"2"),it(Ft,"createDoubleChanceResult",t=>t?.ftScore?.homeGoals>t?.ftScore?.awayGoals?["1x","12"]:t?.ftScore?.homeGoals===t?.ftScore?.awayGoals?["1x","x2"]:["x2","12"]),it(Ft,"createHalfTimeFullTimeResult",t=>{if(t?.htScore?.homeGoals>t?.htScore?.awayGoals){if(t?.ftScore?.homeGoals>t?.ftScore?.awayGoals)return"1/1";if(t?.ftScore?.homeGoals===t?.ftScore?.awayGoals)return"1/x";if(t?.ftScore?.homeGoals<t?.ftScore?.awayGoals)return"1/2"}if(t?.htScore?.homeGoals===t?.htScore?.awayGoals){if(t?.ftScore?.homeGoals>t?.ftScore?.awayGoals)return"x/1";if(t?.ftScore?.homeGoals===t?.ftScore?.awayGoals)return"x/x";if(t?.ftScore?.homeGoals<t?.ftScore?.awayGoals)return"x/2"}if(t?.htScore?.homeGoals<t?.htScore?.awayGoals){if(t?.ftScore?.homeGoals>t?.ftScore?.awayGoals)return"2/1";if(t?.ftScore?.homeGoals===t?.ftScore?.awayGoals)return"2/x";if(t?.ftScore?.homeGoals<t?.ftScore?.awayGoals)return"2/2"}}),it(Ft,"createMarketResultByCriteria",(t,e)=>!t.timeline||!t.timeline.length?null:e==="red_card"?t.timeline.filter(i=>Number(i.minute)<=90).some(i=>i.type==="red_card"):t.timeline.filter(i=>Number(i.minute)<=90).some(i=>i.type.startsWith(e))),it(Ft,"createPlayersMarketsResults",(t,e,i)=>{if(!t.timeline||!t.timeline.length)return i==="first_goal"?null:[];if(i==="first_goal"){let n=t.timeline.find(l=>l.type==="goal"||l.type==="penalty_goal"||l.type==="own_goal")||null;if(n){let l=e[n.player.id];return{playerId:n.type==="goal"||n.type==="penalty_goal"?n.player.id:"OWN_GOAL",playerModel:l}}return null}if(i==="yellow_card"||i==="red_card")return Vc.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])}),Vc.transformPlayerMarketResult(o)}),it(Ft,"transformPlayerMarketResult",t=>t.map(e=>({playerId:e.id,playerModel:e})));var St=class{footballHttps=null;idMapping=null;matchFacade=null;playerFacade=null;profileNamespace=null;constructor(t,e){this.footballHttps=new dt(t),this.idMapping=e,this.matchFacade=new Zt(t,this.footballHttps,e),this.playerFacade=new Jt(t,this.footballHttps,e),this.profileNamespace=new D(t)}remapMatchIdToNative=async t=>(await this.idMapping.getEntityIdsBySchemaId(t,"match","native")).match;remapPlayerIdToNative=async t=>(await this.idMapping.getEntityIdsBySchemaId(t,"player","native")).player[0];remapPlayerIdMapToNative=async t=>{let e={},i=pe(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=hu.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(It.includes(e)&&i){let n="";if(i!=="OWN_GOAL"&&i!=="NOBODY"&&(n=(await this.idMapping.idMappingFacade.getEntitiesByIds({player:[i]},this.idMapping.idSchema,"native")).player[0]),n&&r[a][n]){let l=await this.playerFacade.getPlayersMapWithNativeIds([n]);return r[a][n].model=l[n],r[a][n]}else return n?(r[a][n]=new L,r[a][n]):r[a][i]}else if(It.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 ve){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 Se||t instanceof Fe){let e={competition:t.competitionsWhitelist},i=await this.idMapping.idMappingFacade.getEntitiesByIds(e,"native",this.idMapping.idSchema);return t.competitionsWhitelist=i.competition,t}};remapMatchIdsFixtures=async t=>{if(Array.isArray(t.data))if(t.data.length>0){let e=[],i=[];return t.data.forEach(a=>{a instanceof Tt||a instanceof Vt||a instanceof Pt||a instanceof si?(a.fixtures.forEach(r=>e.push(r.matchId)),a instanceof Pt&&a.fixtures.forEach(r=>{r.prediction.playerId&&r.prediction.playerId!=="OWN_GOAL"&&i.push(r.prediction.playerId)})):a instanceof Xt&&a.results.forEach(r=>e.push(r.matchId))}),await this.refactorResponseArrModel(t,e,i)}else return t;else return await this.refactorResponseObjModel(t)};refactorResponseArrModel=async(t,e,i)=>{let a=[],r=await this.matchFacade.getMatchesMapWithNativeIds(e),o={};return i.length>0&&(o=await this.playerFacade.getPlayersMapWithNativeIds(i)),t.data.forEach(n=>{n instanceof Tt||n instanceof Vt||n instanceof Pt?(n.fixtures.forEach(l=>{this.handleMatchModel(r,l),n instanceof Pt&&l.prediction.playerId&&l.prediction.playerId!=="OWN_GOAL"&&(l.prediction.playerModel=o[l.prediction.playerId],l.prediction.playerId=o[l.prediction.playerId].id)}),a.push(n)):n instanceof Xt&&(n.results.forEach(l=>{l.matchModel=r[l.matchId],delete l.matchModel.availableMarkets,l.matchId=l.matchModel.id}),a.push(n))}),t.data=a,t};refactorResponseObjModel=async t=>{let e=[];t.fixtures.forEach(a=>e.push(a.matchId));let i=await this.matchFacade.getMatchesMapWithNativeIds(e);return t.fixtures.forEach(a=>this.handleMatchModel(i,a)),t};getCurrentGameId=t=>{let e=new Date;if(t.data.length>1){let i=[];return t.data.forEach(r=>i.push(r.predictionsCutoff)),t.data.sort((r,o)=>{let[n,l]=[r.predictionsCutoff,o.predictionsCutoff].map(p=>Math.abs(new Date(p)-e));return n-l})[0].id}else return t.data[0].id};initGameTypePredictions=(t,e)=>{let i={type:t,limit:null,startAfter:null};return e&&(i={...i,limit:e.limit,startAfter:e.startAfter}),i=new V(i),i};initGameFilters=(t,e,i)=>{if(e&&i)return e.type=t,e.gameIds=i,e=new nt(e),e;if(e&&!i)return e.type=t,e=new nt(e),e;if(!e&&i){let a={type:t,gameIds:i};return a=new nt(a),a}else{let a={type:t};return a=new nt(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 Vt&&(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 Xe;return e.settledAt=t.settled_at,e.resettledAt=t.resettled_at,e.status=t.status,e.outcome=t.outcome,e.points=t.points,e};areIdsExceeded=t=>t.length>10;initPredictionsFilters=(t,e,i)=>{switch(e){case"user":t&&(t=new V(t));break;case"current":if(t)this.deleteUnexpectedProperties(t),t.status=["ACTIVE"],t=new V(t);else{let a={status:["ACTIVE"]};t=new V(a)}break;case"past":if(t)this.deleteUnexpectedProperties(t),t.status=ou,t=new V(t);else{let a={status:ou};t=new V(a)}break;case"matches":if(t)this.deleteUnexpectedProperties(t),t.matchIds=i,t=new V(t);else{let a={matchIds:i};t=new V(a)}break}return t};completeGameMarketResults=async(t,e)=>{switch(e){case"MATCH_QUIZ":let i={},a=t.results[0].matchId,r=t.results.map(p=>It.includes(p.market)&&!p.result.includes("OWN_GOAL")?[...p.result]:[]).flat(),o=await this.matchFacade.getMatchesMapWithNativeIds([a]);return r.length&&(i=await this.playerFacade.getPlayersMapWithNativeIds(r)),t.results=t.results.map(p=>{if(p.matchModel=o[p.matchId]?o[p.matchId]:null,p.playerModels&&Object.keys(i).length&&p.result.forEach(u=>{let d=i[u];p.playerModels.push(d)}),this.idMapping.idSchema!=="native"&&(this.remapMatchIdForResultsMarkets(o,p),p.playerModels&&Object.keys(i).length)){let c=p.result;p.result=c.map(u=>i[u].id)}return p}),t;case"TOP_X":let n=t.results.map(p=>p.matchId),l=await this.matchFacade.getMatchesMapWithNativeIds(n);if(t.results=t.results.map(p=>(p.matchModel=l[p.matchId]?l[p.matchId]:null,this.idMapping.idSchema!=="native"&&this.remapMatchIdForResultsMarkets(l,p),p)),t.tieBreakers.goldenGoals.length){let p=t.tieBreakers.goldenGoals.map(u=>u.playerId),c=await this.playerFacade.getPlayersMapWithNativeIds(p);t.tieBreakers.goldenGoals=t.tieBreakers.goldenGoals.map(u=>(u.matchModel=l[u.matchId],u.playerModel=c[u.playerId],this.idMapping.idSchema!=="native"&&(u.matchId=l[u.matchId].id,u.playerId=c[u.playerId].id),u))}return t}};completeContestWinners=async t=>{if(t.userList&&t.userList.length){let e=t.userList.map(a=>a.profileId),i=await this.profileNamespace.getByIds(e);t.userList.forEach(a=>{let r=i.filter(o=>o.id===a.profileId)[0];delete r.interests,a.profileModel=r})}return t};handleMatchModel=(t,e)=>{t[e.matchId]?(e.matchModel=t[e.matchId],delete e.matchModel.availableMarkets,e.matchId=e.matchModel.id):(e.matchModel=null,this.idMapping.idSchema!=="native"&&this.idMapping.idMappingFacade.getEntityById(e.matchId,"match","native").then(i=>{e.matchId=i[G[this.idMapping.idSchema]]}))};remapMatchIdForResultsMarkets=(t,e)=>{t[e.matchId]?e.matchId=t[e.matchId].id:this.idMapping.idMappingFacade.getEntityById(e.matchId,"match","native").then(i=>{e.matchId=i[G[this.idMapping.idSchema]]})};deleteUnexpectedProperties=t=>(t.status&&(console.warn(Kc.UNEXPECTED_STATUS_PROP),delete t.status),t.type&&(console.warn(Kc.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 Vs;let i=[];e.timeline.filter(r=>Number(r.minute)<=90).filter(r=>r.type==="goal"||r.type==="penalty_goal"||r.type==="yellow_card"||r.type==="red_card").forEach(r=>{i.push(r.player.id)});let a={};return i.length&&(a=await this.playerFacade.getPlayersMapWithNativeIds(i)),Ft.createMatchMarketsResultsModel(e,a)}};var Di=class{fixturesRemapper=null;footballHttps=null;matchFacade=null;playerFacade=null;predictorService=null;constructor(t,e){this.footballHttps=new dt(t),this.matchFacade=new Zt(t,this.footballHttps,e),this.playerFacade=new Jt(t,this.footballHttps,e),this.predictorService=new St(t,e),this.fixturesRemapper=new Ul(this.matchFacade,this.playerFacade,this.predictorService)}remapRequestBody=t=>{if(t instanceof ke)return t;let e={};return e.game_instance_id=t.gameInstanceId,e.fixtures=t.fixtures.map(i=>this.fixturesRemapper.remapFixturesRequest(i)),t instanceof ni&&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 Fi,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 Ye;u.target?d.market=this.predictorService.convertMarketForResponseModel(u.market,u.target):d.market=u.market,d.matchId=n[u.match_id].id,d.matchType=u.match_type,d.matchModel=n[u.match_id],delete d.matchModel.availableMarkets,u.prediction!==void 0?d.prediction.value=u.prediction:u.goals_home!==void 0&&u.goals_away!==void 0&&(d.prediction.value=u.goals_home.toString()+":"+u.goals_away.toString()),d.prediction.playerId=u.player_id?u.player_id:null,d.prediction.playerId&&d.prediction.playerId!==e&&(d.prediction.playerModel=r[d.prediction.playerId],d.prediction.playerId=r[d.prediction.playerId].id),u.market==="PLAYER_PERFORMANCE"&&(d.prediction.playerRole=u.role),d.result=this.fixturesRemapper.remapResult(u.result),c.push(d)}),p.fixtures=c,p.status=l.status,l.tiebreaker?p.tiebreaker.goldenGoal=l.tiebreaker.golden_goal:p.tiebreaker=null,p.points=l.points,p.createdAt=l.created_at,p.updatedAt=l.updated_at,o.push(p)}),o}return t};remapResponseObjBody=async t=>{let e=new Fi;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 Hs;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 Vl=class{remapPredictions=null;constructor(t,e){this.remapPredictions=new Di(t,e)}remapResponse=t=>{let e=new $s;return e.matchId=t.match_id,e.matchType=t.match_type,e.predictions=this.remapPredictions.remapPredictionModel(t.predictions),e}};var Hl=class extends tt{remapPaginatedGames=t=>{let e=new H;return e.meta.pagination.nextPageStartsAfter=t.meta.pagination.next_page_starts_after,e.meta.pagination.itemsPerPage=t.meta.pagination.items_per_page,e.data=t.data.map(i=>this.remapGamesListResponse(i)),e};remapGamesListResponse=t=>{let e=new Tt;return e.id=t.id,e.title=t.title,e.description=t.description,e.type=t.type,e.status=t.status,e.authRequirement=t.auth_requirement||null,e.scheduleOpenAt=t.schedule_open_at,e.predictionsCutoff=t.predictions_cutoff,e.fixtures=t.fixtures.map(i=>this.remapFixturesResponse(i)),e.tiebreaker=t.tiebreaker?this.remapTimeTiebreaker(t.tiebreaker.time_tiebreaker):null,e.participantsCount=t.participants_count,e.related=t.related?this.remapRelated(t.related):[],e.excludedProfileIds=t.excluded_profile_ids,e.rules=t.rules,e.labels=t.labels,e.customFields=t.custom_fields,e.branding=t.branding?this.remapBranding(t.branding):null,e.flags=t.flags,e.images=t.images,e.createdAt=t.created_at,e.updatedAt=t.updated_at,e};remapGameByIdResponse=t=>{let e=new si;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 an;return e.matchId=t.match_id,e.matchType=t.match_type,e.market=t.market,e.matchStatus.type=t.match_status?t.match_status.type:null,e.matchStatus.subType=t.match_status?t.match_status.sub_type:null,e};remapPaginatedUserTopXEditions=t=>{let e=new H;return e.meta.pagination.nextPageStartsAfter=t.meta.pagination.next_page_starts_after,e.meta.pagination.itemsPerPage=t.meta.pagination.items_per_page,e.data=t.data.map(i=>this.remapUserTopXEditionsResponse(i)),e};remapUserTopXEditionsResponse=t=>{let e=new Vt;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 on;return e.matchId=t.match_id,e.matchType=t.match_type,e.market=t.market,e.matchStatus.type=t.match_status?t.match_status.type:null,e.matchStatus.subType=t.match_status?t.match_status.sub_type:null,e};remapPaginatedUserMathQuizEditions=t=>{let e=new H;return e.meta.pagination.nextPageStartsAfter=t.meta.pagination.next_page_starts_after,e.meta.pagination.itemsPerPage=t.meta.pagination.items_per_page,e.data=t.data.map(i=>this.remapUserMatchQuizEditionsResponse(i)),e};remapUserMatchQuizEditionsResponse=t=>{let e=new Pt;return e.id=t.id,e.title=t.title,e.description=t.description,e.type=t.type,e.status=t.status,e.authRequirement=t.auth_requirement||null,e.predictionsCutoff=t.predictions_cutoff,e.scheduleOpenAt=t.schedule_open_at,e.fixtures=t.fixtures.map(i=>this.remapMatchQuizFixturesResponse(i)),e.tiebreaker=t.tiebreaker?this.remapTimeTiebreaker(t.tiebreaker.time_tiebreaker):null,e.participantsCount=t.participants_count,e.related=t.related?this.remapRelated(t.related):[],e.excludedProfileIds=t.excluded_profile_ids,e.rules=t.rules,e.flags=t.flags,e.images=t.images,e.branding=t.branding?this.remapBranding(t.branding):null,e.createdAt=t.created_at,e.updatedAt=t.updated_at,e};remapMatchQuizFixturesResponse=t=>{let e=new 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 H;return e.meta.pagination.nextPageStartsAfter=t.meta.pagination.next_page_starts_after,e.meta.pagination.itemsPerPage=t.meta.pagination.items_per_page,e.data=t.data.map(i=>this.remapGameResults(i)),e};remapGameResults=t=>{let e=new Xt;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 Do;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 nn;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 ln;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 X;return t&&(e.type=t.type,e.subType=t.sub_type),e};remapMarketResult=(t,e)=>{if(du.includes(t))return e[0];if(It.includes(t))return e;if(e[0]==="true")return!0;if(e[0]==="false")return!1};deleteUnusefulField=t=>((!It.includes(t.market)||this.isPlayerMarketWithNoResult(t.market,t.result))&&delete t.playerModels,t);isPlayerMarketWithNoResult=(t,e)=>It.includes(t)&&e.length===0;remapResults=t=>{let e=new sn;return e.matchId=t.match_id,e.outcome=t.outcome,e};remapTiebreaker=t=>{let e=new bt;return e.goldenGoal=t.golden_goal,e};remapTimeTiebreaker=t=>{let e=new yt;return e.timeTiebreaker=t,e};remapRelated=t=>t.map(e=>{let i=new z;return i.entityId=e.entity_id,i.entityType=e.entity_type,i.entityRelationship=e.entity_relationship,i})};var $l=class{remapMetaData=t=>{let e=new b;return e.pagination.nextPageStartsAfter=t.pagination.next_page_starts_after,e.pagination.itemsPerPage=t.pagination.items_per_page,e}};var mt=class extends v{predictionRemapper=null;matchSummaryRemapper=null;gamesRemapper=null;metaRemapper=null;idMapping=null;constructor(t){super(t,O(t.environment,"predictor")),this.idMapping=new R(t),this.predictionRemapper=new Di(t,this.idMapping),this.matchSummaryRemapper=new Vl(t,this.idMapping),this.gamesRemapper=new Hl,this.metaRemapper=new $l}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}${m()}`:`/predictions/summary/${t}${this.apiSignInUrl}`,a=`There was a problem fetching predictions for match: ${t}`,r=await this.fetchWithoutAuth(i,a);return this.matchSummaryRemapper.remapResponse(r)};deleteFootballPrediction=async t=>{let e=`/predictions/${t}${this.apiSignInUrl}`,i=`There was a problem deleting your prediction: ${t}`,a="DELETE";return await this.fetchWithAuth(e,i,a),!0};getMyPredictions=async t=>{let e=new H,i=`/predictions${this.apiSignInUrl}`,a="There was a problem fetching own predictions";t&&(i+=`${t.constructFiltersUrl()}`);let r=await this.fetchWithAuth(i,a);return e.meta=this.metaRemapper.remapMetaData(r.meta),e.data=await this.predictionRemapper.remapResponseArrayBody(r.data),e};getMyPredictionsNoRemap=async t=>{let e=`/predictions${this.apiSignInUrl}${t.constructFiltersUrl()}`,i="There was a problem fetching own predictions";return await this.fetchWithAuth(e,i)};getUserPredictions=async(t,e,i)=>{let a=new H,r=f(e)?`/predictions/users/${t}${this.apiSignInUrl}${m()}`:`/predictions/users/${t}${this.apiSignInUrl}`,o=`There was a problem fetching predictions for user: ${t}`;i&&(r+=`${i.constructFiltersUrl()}`);let n=await this.fetchWithoutAuth(r,o);return a.meta=this.metaRemapper.remapMetaData(n.meta),a.data=await this.predictionRemapper.remapResponseArrayBody(n.data),a};getUserPredictionsNoRemap=async(t,e)=>{let i=`/predictions/users/${t}${this.apiSignInUrl}${e.constructFiltersUrl()}`,a=`There was a problem fetching predictions for user: ${t}`;return await this.fetchWithoutAuth(i,a)};getGames=async(t,e)=>{let i=f(e)?`/games/${this.apiSignInUrl}${t.constructFiltersUrl()}${m()}`:`/games/${this.apiSignInUrl}${t.constructFiltersUrl()}`,a="There was a problem fetching the games list",r=await this.fetchWithoutAuth(i,a);return this.gamesRemapper.remapPaginatedGames(r)};getGamesNoRemap=async(t,e)=>{let i=f(e)?`/games/${this.apiSignInUrl}${t.constructFiltersUrl()}${m()}`:`/games/${this.apiSignInUrl}${t.constructFiltersUrl()}`,a="There was a problem fetching the games list";return await this.fetchWithoutAuth(i,a)};getGameById=async(t,e)=>{let i=f(e)?`/games/${t}${this.apiSignInUrl}${m()}`:`/games/${t}${this.apiSignInUrl}`,a=`There was a problem fetching the following game: ${t}`,r=await this.fetchWithoutAuth(i,a);return this.gamesRemapper.remapGameByIdResponse(r)};getGamePredictions=async(t,e,i)=>{let a=new H,r=f(e)?`/games/${t}/predictions${this.apiSignInUrl}${m()}`:`/games/${t}/predictions${this.apiSignInUrl}`,o=`There was a problem fetching the predictions for game: ${t}`;i&&(r+=`${i.constructFiltersUrl()}`);let n=await this.fetchWithoutAuth(r,o);return a.meta=this.metaRemapper.remapMetaData(n.meta),a.data=await this.predictionRemapper.remapResponseArrayBody(n.data),a};getUserGameEditions=async(t,e)=>{let i=null,a=f(e)?`/games/${this.apiSignInUrl}${t.constructFiltersUrl()}${m()}`:`/games/${this.apiSignInUrl}${t.constructFiltersUrl()}`,r="There was a problem fetching the games list",o=await this.fetchWithoutAuth(a,r);return o.data.forEach(n=>{n.type==="TOP_X"?i=this.gamesRemapper.remapPaginatedUserTopXEditions(o):n.type==="MATCH_QUIZ"&&(i=this.gamesRemapper.remapPaginatedUserMathQuizEditions(o))}),i};getGameResults=async(t,e,i)=>{let a=f(e)?`/games/${t}/results/${this.apiSignInUrl}${m()}`:`/games/${t}/results/${this.apiSignInUrl}`,r=`There was a problem fetching the results for the following game: ${t}`;i&&(a+=`${i.constructMainFiltersUrl()}`);let o=await this.fetchWithoutAuth(a,r);return this.gamesRemapper.remapPaginatedGameResults(o)};getMarketResultsForGame=async(t,e)=>{let i=`/games/${t}/correct-results/${this.apiSignInUrl}`,a=`There was a problem fetching the markets correct results for the following game: ${t}`;f(e)&&(i+=`${m()}`);let r=await this.fetchWithoutAuth(i,a);return this.gamesRemapper.remapGameMarketsResults(r.data)};getContestWinners=async(t,e)=>{let i=`/winners/${this.apiSignInUrl}&contest_id=${t}`,a=`There was a problem fetching winners for the following game: ${t}`;e&&(i+=m());let r=await this.fetchWithoutAuth(i,a);return this.gamesRemapper.remapContestWinners(r)};getPredictionById=async t=>{let e=`/predictions/${t}${this.apiSignInUrl}`,i=`There was a problem fetching info for the following prediction: ${t}`,a=await this.fetchWithoutAuth(e,i);return(await this.predictionRemapper.remapResponseArrayBody([a.data]))[0]};getPredictionsByIds=async t=>{let e=`/predictions/by-ids${this.apiSignInUrl}&prediction_ids=${t.join(",")}`,i="There was a problem fetching predictions",a=await this.fetchWithoutAuth(e,i);return await this.predictionRemapper.remapResponseArrayBody(a.data)}};var te=class{errorHandlingMode=null;constructor(t){this.errorHandlingMode=t}validateBodyFields=(t,e)=>{let i=Object.keys(e),a=Object.keys(new ei);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(Rl),o=Object.values(Sl),n=Object.values(Fl);if(e==="FT_1X2"||e==="HT_1X2"){if(r.includes(i))return new Bs(t,e,i)}else if(e==="HT_FT"){if(o.includes(i))return new Ls(t,i)}else if(e==="DOUBLE_CHANCE"){if(n.includes(i))return new Os(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 Ut(t,e,i)}else if(e==="CORNERS_MATCH"){if(typeof i=="number")return new vs(t,i)}else if(e==="BOTH_TEAMS_SCORE"){if(this.isPredictionBoolean(i))return new Fs(t,i)}else if(e==="RED_CARD_MATCH"){if(this.isPredictionBoolean(i))return new Gs(t,i)}else if(e==="PENALTY_MATCH"){if(this.isPredictionBoolean(i))return new Ns(t,i)}else if(It.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 st(t,e,i,p)}if(a&&this.isPredictionBoolean(i))return new st(t,e,i,a)}else if(cu.includes(e)){if(this.isPredictionBoolean(i))return new Ze(t,e,i)}else if(uu.includes(e)&&this.isPredictionBoolean(i))return new Je(t,e,i);this.throwInvalidPredictionException(i,e)};validateFixtureFields=t=>{let e=Object.keys(t);e.forEach(a=>{Wc.includes(a)||this.throwInvalidParamException([a])});let i=Wc.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 bt)[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){It.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(at).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=fu(t,e);throw this.errorHandlingMode==="default"?new y(400,"INVALID_PREDICTION",i):new h(400,"INVALID_TYPE",i)};throwInvalidMarketException=(t,e)=>{let i=null;throw e&&e==="TOP_X"?i=gu(t):i=qp(t),this.errorHandlingMode==="default"?new y(400,"INVALID_MARKET",i):new h(400,"INVALID_TYPE",i)};throwInvalidParamException=t=>{let e=yu(t);throw this.errorHandlingMode==="default"?new y(400,"INVALID_FIELD",e):new h(400,"INVALID_TYPE",e)};throwMissingFieldsException=(t,e)=>{let i=bu(t,e);throw this.errorHandlingMode==="default"?new y(400,"INVALID_FIELD",i):new h(400,"INVALID_TYPE",i)};throwInvalidType=(t,e)=>{let i=Mu(t,e);throw this.errorHandlingMode==="default"?new y(400,"INVALID_TYPE",i):new h(400,"INVALID_TYPE",i)}};var ee=class{predictorHttps=null;predictorService=null;idMapping=null;clientHttps=null;predictorValidator=null;errorHandlingMode=null;constructor(t){this.predictorValidator=new te(t.errorHandlingMode),this.idMapping=new R(t),this.predictorHttps=new mt(t),this.predictorService=new St(t,this.idMapping),this.clientHttps=new q(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 st&&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 st&&n.prediction.playerId!=="OWN_GOAL"&&(n.prediction.playerId=o[n.prediction.playerId])})}return t.fixtures=e,await this.predictorHttps.makeFootballPrediction(t)};delete=async t=>await this.predictorHttps.deleteFootballPrediction(t);getGames=async(t,e)=>{e=e||!1;let i=this.predictorService.initGameFilters("MATCH_QUIZ",t),a=await this.predictorHttps.getGames(i,e);return await this.predictorService.remapMatchIdsFixtures(a)};getGamesNoRemap=async(t,e)=>{e=e||!1;let i=this.predictorService.initGameFilters("MATCH_QUIZ",t);return await this.predictorHttps.getGamesNoRemap(i,e)};getGameById=async(t,e)=>{e=e||!1;let i=await this.predictorHttps.getGameById(t,e);return await this.predictorService.remapMatchIdsFixtures(i)};getGamePredictions=async(t,e,i)=>(i=i||!1,e&&(e.type&&delete e.type,e.status&&delete e.status,e=new V(e)),await this.predictorHttps.getGamePredictions(t,i,e));getGameResults=async(t,e,i)=>{i=i||!1,e&&(e=new w(e));let a=await this.predictorHttps.getGameResults(t,i,e);return await this.predictorService.remapMatchIdsFixtures(a)};getCurrentGameResults=async t=>{t=t||!1;let e=new nt(null);e.status="OPEN",e.type="MATCH_QUIZ";let i=await this.predictorHttps.getGames(e,t),a=this.predictorService.getCurrentGameId(i);return(await this.getGameResults(a,null,t)).data[0]};getMyGameEditions=async(t,e)=>{t&&t.limit&&this.validateLimitFilterOnGames(t.limit),e=e||!1;let i=this.predictorService.initGameTypePredictions("MATCH_QUIZ",t),a=[],r=await this.predictorHttps.getMyPredictionsNoRemap(i);if(r.data.length>0){r.data.forEach(p=>{p.game_instance_id&&a.push(p.game_instance_id)});let o=t?.limit?{limit:t.limit}:null,n=this.predictorService.initGameFilters("MATCH_QUIZ",o,a),l=await this.predictorHttps.getUserGameEditions(n,e);return await this.predictorService.addPredictionProp(r,l)}else return new H};getMyGamePrediction=async t=>{let e=new V({gameIds:[t]}),i=await this.predictorHttps.getMyPredictions(e);if(i.data.length>0){let a=i.data.filter(r=>r.gameInstanceId===t);return a.length?a[0]:null}return null};getUserGameEditions=async(t,e,i)=>{e&&e.limit&&this.validateLimitFilterOnGames(e.limit),i=i||!1;let a=this.predictorService.initGameTypePredictions("MATCH_QUIZ",e),r=[],o=await this.predictorHttps.getUserPredictionsNoRemap(t,a);if(o.data.length>0){o.data.forEach(c=>{c.game_instance_id&&r.push(c.game_instance_id)});let n=e?.limit?{limit:e.limit}:null,l=this.predictorService.initGameFilters("MATCH_QUIZ",n,r),p=await this.predictorHttps.getUserGameEditions(l,i);return await this.predictorService.addPredictionProp(o,p)}else return new H};getUserGamePrediction=async(t,e,i)=>{i=i||!1;let a=new V({gameIds:[e]}),r=await this.predictorHttps.getUserPredictions(t,i,a);if(r.data.length>0){let o=r.data.filter(n=>n.gameInstanceId===e);return o.length?o[0]:null}else return null};getMarketsResultsForGame=async(t,e)=>{let i=await this.predictorHttps.getMarketResultsForGame(t,e);return await this.predictorService.completeGameMarketResults(i,"MATCH_QUIZ")};getGameWinners=async(t,e)=>{let i=await this.predictorHttps.getContestWinners(t,e),a=await this.getGameById(t);return i.contestModel=a,this.predictorService.completeContestWinners(i)};validateLimitFilterOnGames=t=>{if(this.errorHandlingMode==="default"&&t>50)throw new y(400,"EXCEEDED_LENGTH","Maximum limit for filtering games is 50 or less.");if(this.errorHandlingMode==="standard"&&t>50)throw new h(400,"EXCEEDED_LENGTH","Maximum limit for filtering games is 50 or less.")}};var zl=class extends tt{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 No;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 Uo;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 $o;return i.classicQuizId=e.classic_quiz_id,i.correct=e.correct,i.classicQuizQuestions=e.classic_quiz_questions,i.personalBest=e.personal_best,i.points=e.points,i.attempts=e.attempts,i.answers=e.answers?e.answers.map(a=>this.remapParticipationQuestions(a)):e.answers,i});remapClassicQuizzesLeaderboard=t=>(t.meta=this.remapClassicQuizLeaderboardMeta(t.meta),t.data=t.data.map(e=>this.remapClassicQuizLeaderboard(e)),t);remapClassicQuizUserRankings=t=>(t.meta.pagination=this.remapMetaPaginationRank(t.meta.pagination),t.data=t.data.map(e=>this.remapClassicQuizUserRanking(e)),t);remapClassicQuizQuestionsReport=t=>t.map(e=>{let i=new zo;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 ss;return i.questions=e.questions,i.correctAnswers=e.correct_answers,i});remapMetaPagination=t=>{let e=new ut;return e.itemsPerPage=t.items_per_page,e.nextPageStartsAfter=t.next_page_starts_after,e};remapClassicQuizLeaderboardMeta=t=>{let e=new We;return e.pagination=this.remapMetaPaginationRank(t.pagination),e.filters=this.remapLeaderboardMetaFilters(t.filters),e};remapMetaPaginationRank=t=>{let e=new Y;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 qe;return e.classicQuizIds=t?.classic_quiz_ids||null,e};remapClassicQuizUserRanking=t=>{let e=new Wo;return e.position=t.position,e.classicQuizId=t.classic_quiz_id,e.points=t.points,e};remapBasicClassicQuiz=t=>{let e=new ze;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 ko;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 Go;return e.optionId=t.option_id,e.option=t.option,e.images=t.images,e.correct=t.correct,e};remapParticipationQuestions=t=>{let e=new Vo;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 Qo;return e.position=t.position,e.profileId=t.profile_id,e.points=t.points,e};remapContext=t=>{let e=new kt;return e.content=t.content,e.tags=t.tags?t.tags.map(i=>{let a=new Gt;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 z;return i.entityId=e.entity_id,i.entityType=e.entity_type,i.entityRelationship=e.entity_relationship,i})};var ql=class extends tt{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 jo;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 Xo;return e.eitherOrId=t.either_or_id,e.personalBest=t.personal_best,e.betterThan=t.better_than,e};remapEitherOrResults=t=>{let e=new rs;return e.standings=t.standings?t.standings.map(i=>this.remapResultsStandings(i)):t.standings,e.breakdown=t.breakdown?t.breakdown.map(i=>this.remapResultsBreakdown(i)):t.breakdown,e};remapEitherOrParticipation=t=>{let e=new Jo;return e.instanceId=t.instance_id,e.eitherOrId=t.either_or_id,e.gameStartedAt=t.game_started_at,e.currentStep=t.current_step,e.currentStreak=t.current_streak,e.remainingSteps=t.remaining_steps,e.currentLives=t.current_lives,e.currentPoints=t.current_points,e.personalBest=t.personal_best,e.participationCount=t.participation_count,e.finishedParticipationsCount=t.finished_participations_count,e.steps=t.steps?t.steps.map(i=>this.remapParticipationSteps(i)):t.steps,e};remapBasicEitherOr=t=>{let e=new Ke;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 ut;return e.itemsPerPage=t.items_per_page,e.nextPageStartsAfter=t.next_page_starts_after,e};remapPoints=t=>{let e=new Yo;return e.correctSteps=t.correct_steps,e.score=t.score,e};remapResultsStandings=t=>{let e=new os;return e.userId=t.user_id,e.personalBest=t.personal_best,e};remapResultsBreakdown=t=>{let e=new as;return e.rangeStartInclusive=t.range_start_inclusive,e.rangeEndInclusive=t.range_end_inclusive,e.totalUsers=t.total_users,e};remapParticipationSteps=t=>{let e=new is;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 kt;return e.content=t.content,e.tags=t.tags?t.tags.map(i=>{let a=new Gt;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 z;return i.entityId=e.entity_id,i.entityType=e.entity_type,i.entityRelationship=e.entity_relationship,i})};var Ql=class extends tt{remapPersonalityQuizzes=t=>(t.meta.pagination=this.remapMetaPagination(t.meta.pagination),t.data=t.data.map(e=>this.remapBasicPersonalityQuiz(e)),t);remapPersonalityQuizById=t=>{let e=new Ri;return e.id=t.id,e.title=t.title,e.alternativeTitle=t.alternative_title,e.description=t.description,e.images=t.images,e.participationCount=t.participation_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||null,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.maxAttempts=t.max_attempts,e.context=t.context?this.remapContext(t.context):t.context,e.questions=t.questions?t.questions.map(i=>this.remapQuestions(i)):[],e.personaResults=t.persona_results?t.persona_results.map(i=>this.remapPersonaResults(i)):[],e.createdAt=t.created_at,e.updatedAt=t.updated_at,e};remapPersonalityQuizParticipation=t=>{let e=new ds;return e.personalityQuizId=t.personality_quiz_id,e.userId=t.user_id,e.questions=t.questions?this.remapParticipationQuestions(t.questions):[],e.personas=t.personas?this.remapParticipationPersonas(t.personas):[],e.attempts=t.attempts,e};remapParticipationQuestions=t=>t.map(e=>{let i=new ms;return i.questionId=e.question_id,i.optionId=e.option_id,i});remapParticipationPersonas=t=>t.map(e=>{let i=new hs;return i.personaId=e.persona_id,i.percent=e.percent,i});remapPersonalityQuizParticipationBody=t=>t.map(e=>({question_id:e.questionId,option_id:e.optionId}));remapPersonalityQuizUserParticipation=t=>{let e=new Ri;return e.id=t.id,e.title=t.title,e.alternativeTitle=t.alternative_title,e.description=t.description,e.images=t.images,e.participationCount=t.participation_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.related=t.related?this.remapRelated(t.related):[],e.maxAttempts=t.max_attempts,e.context=t.context?this.remapContext(t.context):t.context,e.questions=t.questions.map(i=>this.remapQuestions(i)),e.personaResults=t.persona_results?t.persona_results.map(i=>this.remapPersonaResults(i)):[],e.createdAt=t.created_at,e.updatedAt=t.updated_at,e};remapMetaPagination=t=>{let e=new ut;return e.itemsPerPage=t.items_per_page,e.nextPageStartsAfter=t.next_page_starts_after,e};remapBasicPersonalityQuiz=t=>{let e=new je;return e.id=t.id,e.title=t.title,e.alternativeTitle=t.alternative_title,e.description=t.description,e.images=t.images,e.participationCount=t.participation_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.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};remapPersonaResults=t=>{let e=new ns;return e.personaId=t.persona_id,e.title=t.title,e.description=t.description,e.images=t.images,e};remapQuestions=t=>{let e=new ls;return e.questionId=t.question_id,e.question=t.question,e.images=t.images,e.explanation=t.explanation,e.options=t.options.map(i=>this.remapOptions(i)),e};remapOptions=t=>{let e=new cs;return e.optionId=t.option_id,e.option=t.option,e.images=t.images,e.preferenceMapping=t.preference_mapping?this.remapPreferencesMapping(t.preference_mapping):[],e.personaPoints=t.persona_points?this.remapPersonaPoints(t.persona_points):[],e};remapPreferencesMapping=t=>t.map(e=>{let i=new ci;return i.preferenceId=e.preference_id,i});remapPersonaPoints=t=>t.map(e=>{let i=new ps;return i.personaId=e.persona_id,i.points=e.points,i});remapContext=t=>{let e=new kt;return e.content=t.content,e.tags=t.tags?t.tags.map(i=>{let a=new Gt;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 z;return i.entityId=e.entity_id,i.entityType=e.entity_type,i.entityRelationship=e.entity_relationship,i})};var Bi=class extends v{classicQuizRemapper=null;eitherOrRemapper=null;personalityQuizRemapper=null;constructor(t){super(t,O(t.environment,"miniGames")),this.classicQuizRemapper=new zl,this.eitherOrRemapper=new ql,this.personalityQuizRemapper=new Ql}getClassicQuizzes=async(t,e)=>{let i=`/classic-quizzes${this.apiSignInUrl}`;t&&(i+=t.constructMainFiltersUrl()),i+=f(e)?m():"";let a="There was a problem with fetching classic quizzes",r=await this.fetchWithoutAuth(i,a);return this.classicQuizRemapper.remapClassicQuizzes(r)};getClassicQuizById=async(t,e,i)=>{let a=`/classic-quizzes/${t}${this.apiSignInUrl}`;e&&(a+=`&include_correct_options=${e}`),f(i)&&(a+=m());let r="There was a problem with fetching classic quiz by ID",o=await this.fetchWithoutAuth(a,r);return this.classicQuizRemapper.remapClassicQuizById(o.data)};participateInClassicQuiz=async(t,e,i)=>{let a=`/classic-quizzes/${t}/participate${this.apiSignInUrl}`,r=`There was a problem with participating in the following classic quiz: ${t}`,o="POST",n={questions:this.classicQuizRemapper.remapClassicQuizParticipationBody(e),include_correct_options:!!i},l=await this.fetchWithAuth(a,r,o,n);return this.classicQuizRemapper.remapClassicQuizParticipation(l.data)};getMyClassicQuizParticipations=async t=>{let e=`/classic-quizzes/participations${this.apiSignInUrl}`;t&&(e+=`${t.constructMainFiltersUrl()}`);let i="There was a problem with fetching user's own Classic Quiz participations",a=await this.fetchWithAuth(e,i);return this.classicQuizRemapper.remapUserClassicQuizParticipations(a.data)};getLeaderboardForClassicQuizzes=async(t,e)=>{let i=`/classic-quizzes/rank${this.apiSignInUrl}`;t&&(i+=`${t.constructMainFiltersUrl()}`),i+=f(e)?m():"";let a="There was a problem with fetching classic quizzes leaderboard",r=await this.fetchWithoutAuth(i,a);return this.classicQuizRemapper.remapClassicQuizzesLeaderboard(r)};getClassicQuizzesUserRanking=async(t,e,i)=>{let a=`/classic-quizzes/users/${t}/rank${this.apiSignInUrl}`;e&&(a+=`${e.constructMainFiltersUrl()}`),a+=f(i)?m():"";let r="There was a problem with fetching user's rankings for classic quizzes",o=await this.fetchWithoutAuth(a,r);return this.classicQuizRemapper.remapClassicQuizUserRankings(o)};getClassicQuizQuestionsReport=async t=>{let e=`/classic-quizzes/${t}/questions-report${this.apiSignInUrl}`,i=`There was a problem with fetching questions report for quiz: ${t}`,a=await this.fetchWithoutAuth(e,i);return this.classicQuizRemapper.remapClassicQuizQuestionsReport(a.data)};getClassicQuizResultsSummary=async(t,e)=>{let i=`/classic-quizzes/${t}/results-summary${this.apiSignInUrl}`;f(e)&&(i+=m());let a="There was a problem with fetching classic quiz results summary",r=await this.fetchWithoutAuth(i,a);return this.classicQuizRemapper.remapClassicQuizResultsSummary(r.data)};getEitherOrs=async(t,e)=>{let i=`/either-or${this.apiSignInUrl}`;t&&(i+=t.constructMainFiltersUrl()),i+=f(e)?m():"";let a="There was a problem with fetching list of Either/Ors",r=await this.fetchWithoutAuth(i,a);return this.eitherOrRemapper.remapEitherOrs(r)};getEitherOrById=async(t,e)=>{let i=`/either-or/${t}${this.apiSignInUrl}`;f(e)&&(i+=m());let a="There was a problem with fetching Either/Or by ID",r=await this.fetchWithoutAuth(i,a);return this.eitherOrRemapper.remapEitherOrById(r.data)};getMyEitherOrStats=async t=>{let e=`/either-or/${t}/own-stats${this.apiSignInUrl}`,i="There was a problem with fetching Either/Or own statistics",a=await this.fetchWithAuth(e,i);return this.eitherOrRemapper.remapEitherOrOwnStats(a.data)};getEitherOrResults=async(t,e)=>{let i=`/either-or/${t}/results${this.apiSignInUrl}${f(e)?m():""}`,a="There was a problem with fetching Either/Or results",r=await this.fetchWithoutAuth(i,a);return this.eitherOrRemapper.remapEitherOrResults(r.data)};participateInEitherOr=async(t,e)=>{let i=`/either-or/${t}/participate${this.apiSignInUrl}`,a="There was a problem with participating in Either/Or",r="POST",o=await this.fetchWithAuth(i,a,r,e);return this.eitherOrRemapper.remapEitherOrParticipation(o.data)};getPersonalityQuizzes=async(t,e)=>{let i=`/personality-quizzes${this.apiSignInUrl}`;t&&(i+=t.constructMainFiltersUrl()),i+=f(e)?m():"";let a="There was a problem with fetching personality quizzes",r=await this.fetchWithoutAuth(i,a);return this.personalityQuizRemapper.remapPersonalityQuizzes(r)};getPersonalityQuizById=async(t,e)=>{let i=`/personality-quizzes/${t}${this.apiSignInUrl}`;f(e)&&(i+=m());let a="There was a problem with fetching personality quiz by ID",r=await this.fetchWithoutAuth(i,a);return this.personalityQuizRemapper.remapPersonalityQuizById(r.data)};participateInPersonalityQuiz=async(t,e)=>{let i=`/personality-quizzes/${t}/participate${this.apiSignInUrl}`,a=`There was a problem with participating in the following personality quiz: ${t}`,r="POST",o={questions:this.personalityQuizRemapper.remapPersonalityQuizParticipationBody(e)},n=await this.fetchWithAuth(i,a,r,o);return this.personalityQuizRemapper.remapPersonalityQuizParticipation(n.data)};getPersonalityQuizUserParticipation=async(t,e,i)=>{let a=`/personality-quizzes/${t}/participations/${e}${this.apiSignInUrl}`;f(i)&&(a+=m());let r="There was a problem with fetching user personality quiz participation",o=await this.fetchWithoutAuth(a,r);return this.personalityQuizRemapper.remapPersonalityQuizParticipation(o.data)}};var ie=class extends K{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 Wl=class{idSchema=null;idMapping=null;validator=null;https=null;entityTypes=["competition","team","player"];profile=null;football=null;eitherOrTime=0;participationStartTimestamp=0;countdownTimer=0;intervalId=null;currentPairId="";constructor(t){this.idSchema=t.idSchema,this.idMapping=new R(t),this.validator=new ie(t),this.profile=new D(t),this.football=new et(t),this.https=new Bi(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 ts;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 Kl=class{https=null;service=null;activityService=null;idSchema=null;constructor(t){this.https=new Bi(t),this.service=new Wl(t),this.activityService=new wt(t),this.idSchema=t.idSchema}getClassicQuizzes=async(t,e,i)=>{t&&(t=new Bo(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 Ho(t));let e=await this.https.getMyClassicQuizParticipations(t),i=e.map(r=>r.classicQuizId),a=await this.getClassicQuizzes({classicQuizIds:i});return e.map(r=>{let o=a.data.find(n=>n.id===r.classicQuizId)||null;return{...r,classicQuizModel:o}})};getLeaderboardForClassicQuizzes=async(t,e)=>{t&&(t=new qo(t));let i=await this.https.getLeaderboardForClassicQuizzes(t,e);return i.data=await this.service.setProfileModelsForClassicQuizLeaderboards(i.data),i};getClassicQuizzesUserRanking=async(t,e,i)=>{e&&(e=new Qe(e));let a=await this.https.getClassicQuizzesUserRanking(t,e,i),r=a.data.map(n=>n.classicQuizId),o=await this.getClassicQuizzes({classicQuizIds:r});return a.data=a.data.map(n=>{let l=o.data.find(p=>p.id===n.classicQuizId)||null;return{...n,classicQuizModel:l}}),a};getClassicQuizQuestionsReport=async(t,e)=>{e=e||!1;let i=await this.https.getClassicQuizQuestionsReport(t),a=await this.getClassicQuizById(t,e,!0);return this.service.setQuestionModelsInQuestionsReport(i,a)};getClassicQuizResultsSummary=async(t,e)=>await this.https.getClassicQuizResultsSummary(t,e);getEitherOrs=async(t,e,i)=>{t&&(t=new Ko(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};getPersonalityQuizzes=async(t,e,i)=>{t&&(t=new us(t),await this.service.finalizeMiniGamesFilters(t));let a=await this.https.getPersonalityQuizzes(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};getPersonalityQuizById=async(t,e)=>{let i=await this.https.getPersonalityQuizById(t,e);return await this.service.setContextTagsModels([i]),i};participateInPersonalityQuiz=async(t,e)=>await this.https.participateInPersonalityQuiz(t,e);getPersonalityQuizUserParticipation=async(t,e,i)=>await this.https.getPersonalityQuizUserParticipation(t,e,i);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 ae=class{facade=null;constructor(t){this.facade=new Kl(t)}getClassicQuizzes=async(t,e,i)=>await this.facade.getClassicQuizzes(t,e,i);getClassicQuizById=async(t,e,i)=>await this.facade.getClassicQuizById(t,e,i);participateInClassicQuiz=async(t,e,i)=>await this.facade.participateInClassicQuiz(t,e,i);getMyClassicQuizParticipations=async t=>await this.facade.getMyClassicQuizParticipations(t);getLeaderboardForClassicQuizzes=async(t,e)=>await this.facade.getLeaderboardForClassicQuizzes(t,e);getClassicQuizzesUserRanking=async(t,e,i)=>await this.facade.getClassicQuizzesUserRanking(t,e,i);getClassicQuizQuestionsReport=async(t,e)=>await this.facade.getClassicQuizQuestionsReport(t,e);getClassicQuizResultsSummary=async(t,e)=>await this.facade.getClassicQuizResultsSummary(t,e);getEitherOrs=async(t,e,i)=>await this.facade.getEitherOrs(t,e,i);getEitherOrById=async(t,e)=>await this.facade.getEitherOrById(t,e);getMyEitherOrStats=async t=>await this.facade.getMyEitherOrStats(t);getEitherOrResults=async(t,e)=>await this.facade.getEitherOrResults(t,e);participateInEitherOr=async(t,e,i)=>await this.facade.participateInEitherOr(t,e,i);calculateEitherOrResultPercentile=async(t,e)=>await this.facade.calculateEitherOrResultPercentile(t,e);getPersonalityQuizzes=async(t,e,i)=>await this.facade.getPersonalityQuizzes(t,e,i);getPersonalityQuizById=async(t,e)=>await this.facade.getPersonalityQuizById(t,e);participateInPersonalityQuiz=async(t,e)=>await this.facade.participateInPersonalityQuiz(t,e);getPersonalityQuizUserParticipation=async(t,e,i)=>await this.facade.getPersonalityQuizUserParticipation(t,e,i)};var re=class{idMapping=null;predictorHttps=null;predictorService=null;predictorValidator=null;clientHttps=null;errorHandlingMode=null;constructor(t){this.idMapping=new R(t),this.errorHandlingMode=t.errorHandlingMode,this.predictorValidator=new te(t.errorHandlingMode),this.predictorHttps=new mt(t),this.predictorService=new St(t,this.idMapping),this.clientHttps=new q(t)}getConfig=async()=>{let t=await this.clientHttps.getConfig("topX");return this.idMapping.idSchema!=="native"?await this.predictorService.remapCompetitionsFromConfig(t):t};getGames=async(t,e)=>{e=e||!1;let i=this.predictorService.initGameFilters("TOP_X",t),a=await this.predictorHttps.getGames(i,e);return await this.predictorService.remapMatchIdsFixtures(a)};getGamesNoRemap=async(t,e)=>{e=e||!1;let i=this.predictorService.initGameFilters("TOP_X",t);return await this.predictorHttps.getGamesNoRemap(i,e)};getGameById=async(t,e)=>{e=e||!1;let i=await this.predictorHttps.getGameById(t,e);return await this.predictorService.remapMatchIdsFixtures(i)};getGamePredictions=async(t,e,i)=>(i=i||!1,e&&(e.type&&delete e.type,e.status&&delete e.status,e=new V(e)),await this.predictorHttps.getGamePredictions(t,i,e));getGameResults=async(t,e,i)=>{i=i||!1,e&&(e=new nt(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 nt(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 ni(t);if(e=this.predictorValidator.validateBodyFields("TOP_X",e),e.fixtures=e.fixtures.map(a=>this.predictorValidator.validateFixture(a.matchId,a.market,a.prediction.value)),this.idMapping.idSchema!=="native"){let a=[];e.fixtures.forEach(o=>a.push(o.matchId));let r=await this.predictorService.remapMatchIdToNative(a);e.fixtures.forEach(o=>o.matchId=r.shift())}let i=await this.predictorHttps.makeFootballPrediction(e);return i.fixtures.forEach(a=>{a.matchId=a.matchModel.id}),i};delete=async t=>await this.predictorHttps.deleteFootballPrediction(t);getMyGameEditions=async(t,e)=>{t&&t.limit&&this.validateLimitFilterOnGames(t.limit),e=e||!1;let i=this.predictorService.initGameTypePredictions("TOP_X",t),a=[],r=await this.predictorHttps.getMyPredictionsNoRemap(i);if(r.data.length>0){r.data.forEach(p=>{p.game_instance_id&&a.push(p.game_instance_id)});let o=t?.limit?{limit:t.limit}:null,n=this.predictorService.initGameFilters("TOP_X",o,a),l=await this.predictorHttps.getUserGameEditions(n,e);return await this.predictorService.addPredictionProp(r,l)}else return new H};getMyGamePrediction=async t=>{let e=new V({gameIds:[t]}),i=await this.predictorHttps.getMyPredictions(e);if(i.data.length>0){let a=i.data.filter(r=>r.gameInstanceId===t);return a.length?a[0]:null}return null};getUserGameEditions=async(t,e,i)=>{e&&e.limit&&this.validateLimitFilterOnGames(e.limit),i=i||!1;let a=this.predictorService.initGameTypePredictions("TOP_X",e),r=[],o=await this.predictorHttps.getUserPredictionsNoRemap(t,a);if(o.data.length>0){o.data.forEach(c=>{c.game_instance_id&&r.push(c.game_instance_id)});let n=e?.limit?{limit:e.limit}:null,l=this.predictorService.initGameFilters("TOP_X",n,r),p=await this.predictorHttps.getUserGameEditions(l,i);return await this.predictorService.addPredictionProp(o,p)}else return new H};getUserGamePrediction=async(t,e,i)=>{i=i||!1;let a=new V({gameIds:[e]}),r=await this.predictorHttps.getUserPredictions(t,i,a);if(r.data.length>0){let o=r.data.filter(n=>n.gameInstanceId===e);return o.length?o[0]:null}else return null};getMarketsResultsForGame=async(t,e)=>{let i=await this.predictorHttps.getMarketResultsForGame(t,e);return await this.predictorService.completeGameMarketResults(i,"TOP_X")};getGameWinners=async(t,e)=>{let i=await this.predictorHttps.getContestWinners(t,e),a=await this.getGameById(t);return i.contestModel=a,this.predictorService.completeContestWinners(i)};validateLimitFilterOnGames=t=>{if(this.errorHandlingMode==="default"&&t>50)throw new y(400,"EXCEEDED_LENGTH","Maximum limit for filtering games is 50 or less.");if(this.errorHandlingMode==="standard"&&t>50)throw new h(400,"EXCEEDED_LENGTH","Maximum limit for filtering games is 50 or less.")}};var jl=class{idMappingService=null;profileNamespace=null;footballNamespace=null;topXFacade=null;matchQuizFacade=null;miniGamesNamespace=null;errorHandlingMode=null;constructor(t){this.idMappingService=new R(t),this.profileNamespace=new D(t),this.footballNamespace=new et(t),this.topXFacade=new re(t),this.matchQuizFacade=new ee(t),this.miniGamesNamespace=new ae(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 bo;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 Mo;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 _o(t));break;case"rankings":t&&(t=new Po(t));break;case"league_leaderboard":t&&(t=new wo(t))}return t};addProfileModelToHighestSuccessRate=async t=>{let e=t.map(a=>a.profileId);if(!e.length)return t;let i=await this.profileNamespace.getByIds(e);return t.map(a=>(i.forEach(r=>{r.id===a.profileId&&(delete r.interests,a.profileModel=r)}),a))};extractRankingsIdsMap=t=>{let e=[],i=[],a=[];return t.forEach(r=>{r.rankType==="GAME"&&r.gameType==="TOP_X"?e.push(r.id):r.rankType==="GAME"&&r.gameType==="MATCH_QUIZ"?i.push(r.id):r.rankType==="TEMPLATE"&&a.push(r.id)}),[e,i,a]};setModelsForUserRankings=(t,e,i,a)=>(a.data.forEach(r=>{r.gameType==="MATCH_QUIZ"&&e?r.model=e.filter(o=>o.id===r.id)[0]:r.gameType==="TOP_X"&&t?r.model=t.filter(o=>o.id===r.id)[0]:r.rankType==="TEMPLATE"&&i&&(r.model=i.filter(o=>o.id===r.id)[0])}),a);completeContestWinners=async t=>{if(t.userList&&t.userList.length){let e=t.userList.map(a=>a.profileId),i=await this.profileNamespace.getByIds(e);t.userList.forEach(a=>{let r=i.filter(o=>o.id===a.profileId)[0];delete r.interests,a.profileModel=r})}return t};validateEntitiesFollowsFilters=t=>{if(!t||(!t.footballCompetitions||!t.footballCompetitions.length)&&(!t.footballTeams||!t.footballTeams.length)&&(!t.footballPlayers||!t.footballPlayers.length))throw this.errorHandlingMode==="default"?new y(400,"invalid_filters","At least one of footballCompetitions, footballTeams or footballPlayers properties should be provided for filters."):new h(400,"invalid_filters","At least one of footballCompetitions, footballTeams or footballPlayers properties should be provided for filters.");if(t.footballCompetitions&&t.footballCompetitions.length>24||t.footballTeams&&t.footballTeams.length>24||t.footballPlayers&&t.footballPlayers.length>24)throw this.errorHandlingMode==="default"?new y(400,"EXCEEDED_LENGTH","Maximum length per entity should be 24 or less."):new h(400,"EXCEEDED_LENGTH","Maximum length per entity should be 24 or less.")};remapEntitiesFollowsFilters=async t=>{let e=JSON.parse(JSON.stringify(t)),i={},a={};e.footballCompetitions&&e.footballCompetitions.length&&(a.competition=e.footballCompetitions),e.footballTeams&&e.footballTeams.length&&(a.team=e.footballTeams),e.footballPlayers&&e.footballPlayers.length&&(a.player=e.footballPlayers);let r=await this.idMappingService.idMappingFacade.getEntitiesByIds(a,this.idMappingService.idSchema,"native");return Object.keys(r).forEach(o=>{o==="competition"?i.footballCompetitions=r[o]:o==="team"?i.footballTeams=r[o]:o==="player"&&(i.footballPlayers=r[o])}),i};addModelsToEntitiesFollows=async t=>{let e=[],i="fb:c:",a=new Map,r=[],o="fb:t:",n=new Map,l=[],p="fb:p:",c=null;return t.breakdown.forEach(u=>{u.id.includes(i)?e.push(u.id):u.id.includes(o)?r.push(u.id):u.id.includes(p)&&l.push(u.id)}),e.length&&(a=await this.footballNamespace.footballFacade.competitionsFacade.getCompetitionsMapWithNativeIds(e)),r.length&&(n=await this.footballNamespace.footballFacade.teamsFacade.getTeamsMapWithNativeIds(r)),l.length&&(c=await this.footballNamespace.footballFacade.playerFacade.getPlayersMapWithNativeIds(l)),t.breakdown.forEach(u=>{u.id.includes(i)?(u.model=a.get(u.id),u.id=u.model.id):u.id.includes(o)?(u.model=n.get(u.id),u.id=u.model.id):u.id.includes(p)&&(u.model=c[u.id],u.id=u.model.id)}),t};getMatchIdsFromGamesInTemplates=async(t,e)=>{if(t&&t.length>0){let o=qt(t,100),n=[];if(e&&e.length===1){if(e.includes("TOP_X"))try{n=(await Promise.all(o.map(c=>this.topXFacade.getGamesNoRemap({gameIds:c,limit:c.length},!0)))).reduce((c,u)=>[...c,...u.data],[])}catch(p){throw console.error("There was a problem fetching match IDs from Top X games",p),p}if(e.includes("MATCH_QUIZ"))try{n=(await Promise.all(o.map(c=>this.matchQuizFacade.getGamesNoRemap({gameIds:c,limit:c.length},!0)))).reduce((c,u)=>[...c,...u.data],[])}catch(p){throw console.error("There was a problem fetching match IDs from Match Quiz games",p),p}}try{n=(await Promise.all(o.map(c=>{let u=this.topXFacade.getGamesNoRemap({gameIds:c,limit:c.length},!0),d=this.matchQuizFacade.getGamesNoRemap({gameIds:c,limit:c.length},!0);return Promise.all([u,d])}))).reduce((c,[u,d])=>[...c,...u.data,...d.data],[])}catch(p){throw console.error("There was a problem fetching match IDs from both Top X and Match Quiz games",p),p}let l=new Set;return n.forEach(p=>{p.fixtures.map(u=>u.match_id).forEach(u=>l.add(u))}),Array.from(l)}let i=[],a=100;try{for(let o of e){let n=!0,l="",p=0;for(;n;){let c,u={limit:a,startAfter:l};o==="TOP_X"?(c=await this.topXFacade.getGamesNoRemap(u,!0),i=[...i,...c.data],l=c.meta.pagination.next_page_starts_after||null):o==="MATCH_QUIZ"&&(c=await this.matchQuizFacade.getGamesNoRemap(u,!0),i=[...i,...c.data],l=c.meta.pagination.next_page_starts_after||null),n=!!l,p++,p>=5&&(n=!1)}}let r=new Set;return i.forEach(o=>{o.fixtures.map(l=>l.match_id).forEach(l=>r.add(l))}),Array.from(r)}catch(r){throw console.error("There was a problem fetching match IDs from games",r),r}};initMatchFiltersForTemplates=async(t,e)=>{let i=[],a=[],r=[],o=t.fromDate?this.reformatDate(t.fromDate):null,n=t.toDate?this.reformatDate(t.toDate,!0):null,l=500;if(t.competitionIds&&t.competitionIds.length>0&&(i=Array.from(t.competitionIds)),t.teamIds&&t.teamIds.length>0&&(a=Array.from(t.teamIds)),t.matchIds&&t.matchIds.length>0&&(r=Array.from(t.matchIds)),this.isGameTemplate(t)&&(r=await this.getMatchIdsFromGamesInTemplates(t.gameIds,t.gameTypes)),e){let c=t.groups.find(d=>d.groupId===e);if(!c)throw this.errorHandlingMode==="default"?new y(400,"invalid_template_group_id","There is no group in this template with the provided groupId"):new h(400,"invalid_template_group_id","There is no group in this template with the provided groupId");if(!c.filters)throw this.errorHandlingMode==="default"?new y(400,"invalid_template_group_filters","The provided template group has no filters"):new h(400,"invalid_template_group_filters","The provided template group has no filters");o=c.filters.fromDate?this.reformatDate(c.filters.fromDate):null,n=c.filters.toDate?this.reformatDate(c.filters.toDate,!0):null;let u=c.filters.matchIds.every(d=>d);c.filters.matchIds.length>0&&u&&(r=Array.from(c.filters.matchIds))}return new gt({competitionIds:i,teamIds:a,matchIds:r,fromDate:o,toDate:n,limit:l})};isGameTemplate=t=>!!(t.gameIds&&t.gameIds.length>0||t.gameTypes&&t.gameTypes.length>0&&(t.gameTypes.includes("TOP_X")||t.gameTypes.includes("MATCH_QUIZ")));reformatDate=(t,e)=>{let i=new Date(t);e&&i.setUTCHours(23,59,59);let a=i.toISOString();return a=a.slice(0,-5)+"Z",a};extractEnabledBadgesId=t=>{let e=[];return t.forEach(i=>{i.enabled&&e.push(i.id)}),e};addEntityModelToFootballBadges=async t=>{let e=[],i=[],a=[],r=[];if(t.football&&t.football.length>0&&(e=t.football.filter(n=>n.requirements.entityType.toLocaleLowerCase()==="competition").map(n=>n.requirements.entityId),i=t.football.filter(n=>n.requirements.entityType.toLocaleLowerCase()==="team").map(n=>n.requirements.entityId),a=t.football.filter(n=>n.requirements.entityType.toLocaleLowerCase()==="player").map(n=>n.requirements.entityId),r=t.football.filter(n=>n.requirements.entityType.toLocaleLowerCase()==="match").map(n=>n.requirements.entityId)),t.voting&&t.voting.poll&&t.voting.poll.length>0){let[n,l,p,c]=this.extractEntityIdsFromBadges(t.voting.poll);e=e.concat(n),e=Array.from(new Set(e)),i=i.concat(l),i=Array.from(new Set(i)),a=a.concat(p),a=Array.from(new Set(a)),r=r.concat(c),r=Array.from(new Set(r))}if(t.voting&&t.voting.potm&&t.voting.potm.length>0){let[n,l,p,c]=this.extractEntityIdsFromBadges(t.voting.potm);e=e.concat(n),e=Array.from(new Set(e)),i=i.concat(l),i=Array.from(new Set(i)),a=a.concat(p),a=Array.from(new Set(a)),r=r.concat(c),r=Array.from(new Set(r))}let o=await this.fetchFootballEntities(e,i,a,r);t.football&&t.football.length>0&&t.football.forEach(n=>{this.setEntityModelsFromMap(n.requirements,"competition",o.competitions),this.setEntityModelsFromMap(n.requirements,"team",o.teams),this.setEntityModelsFromObject(n.requirements,"player",o.players),this.setEntityModelsFromObject(n.requirements,"match",o.matches)}),t.voting&&t.voting.poll&&t.voting.poll.length>0&&t.voting.poll.forEach(n=>{this.setEntityModelsFromMap(n.requirements,"competition",o.competitions),this.setEntityModelsFromMap(n.requirements,"team",o.teams),this.setEntityModelsFromObject(n.requirements,"player",o.players),this.setEntityModelsFromObject(n.requirements,"match",o.matches)}),t.voting&&t.voting.potm&&t.voting.potm.length>0&&t.voting.potm.forEach(n=>{this.setEntityModelsFromMap(n.requirements,"competition",o.competitions),this.setEntityModelsFromMap(n.requirements,"team",o.teams),this.setEntityModelsFromObject(n.requirements,"player",o.players),this.setEntityModelsFromObject(n.requirements,"match",o.matches)})};setEntityModelsFromMap=(t,e,i)=>{t.entityType===e&&(t.entityModel=i&&i.get(t.entityId)||null,t.entityModel&&(t.entityId=t.entityModel.id))};setEntityModelsFromObject=(t,e,i)=>{t.entityType===e&&(t.entityModel=i[t.entityId]?i[t.entityId]:null,t.entityModel&&(t.entityId=t.entityModel.id))};fetchFootballEntities=async(t,e,i,a)=>{let r={competitions:null,teams:null,players:null,matches:null};if(t.length){let o=await this.footballNamespace.footballFacade.getCompetitionsMapWithNativeIds(t);r.competitions=o}if(e.length){let o=await this.footballNamespace.footballFacade.getTeamsMapWithNativeIds(e);r.teams=o}if(i.length){let o=await this.footballNamespace.footballFacade.getPlayersMapWithNativeIds(i);r.players=o}if(a.length){let o=await this.footballNamespace.footballFacade.getMatchesMapWithNativeIds(a);r.matches=o}return r};extractEntityIdsFromBadges=t=>{let e=t.filter(o=>o.requirements.entityType&&o.requirements.entityType.toLocaleLowerCase()==="competition").map(o=>o.requirements.entityId),i=t.filter(o=>o.requirements.entityType&&o.requirements.entityType.toLocaleLowerCase()==="team").map(o=>o.requirements.entityId),a=t.filter(o=>o.requirements.entityType&&o.requirements.entityType.toLocaleLowerCase()==="player").map(o=>o.requirements.entityId),r=t.filter(o=>o.requirements.entityType&&o.requirements.entityType.toLocaleLowerCase()==="match").map(o=>o.requirements.entityId);return[e,i,a,r]};addGameModelToGamesBadges=async t=>{if(!t.games||t.games.length===0)return;let e=this.getGameIdsFromGamesBadge(t.games,"top_x"),i=this.getGameIdsFromGamesBadge(t.games,"match_quiz"),a=this.getGameIdsFromGamesBadge(t.games,"classic_quiz"),r=this.getGameIdsFromGamesBadge(t.games,"either_or"),o=await this.fetchGamesEntities(e,i,a,r);t.games.forEach(n=>{n.requirements.specificGames&&n.requirements.specificGames.forEach(l=>{l.gameModel=o.find(p=>p.id===l.gameId)||null})})};getGameIdsFromGamesBadge=(t,e)=>{let i=t.filter(a=>a.requirements.specificGames?a.requirements.specificGames.some(r=>r.gameType.toLocaleLowerCase()===e):!1).map(a=>a.requirements.specificGames.map(r=>r.gameId));return Array.prototype.concat.apply([],i)};fetchGamesEntities=async(t,e,i,a)=>{let r=[];if(t.length){let o=await this.topXFacade.getGames({gameIds:t});r=[...r,...o.data]}if(e.length){let o=await this.matchQuizFacade.getGames({gameIds:e});r=[...r,...o.data]}if(i.length){let o=await this.miniGamesNamespace.getClassicQuizzes({classicQuizIds:i});r=[...r,...o.data]}if(a.length){let o=await this.miniGamesNamespace.getEitherOrs({eitherOrIds:a});r=[...r,...o.data]}return r}};var Yl=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(at).includes(t)){let a=qp(t);throw e==="default"?new y(400,"INVALID_MARKET",a):new h(400,"INVALID_MARKET",a)}};validateDate=(t,e,i)=>{let a=/^\d{4}-\d{2}-\d{2}$/;if(typeof t!="string")throw i==="default"?new y(400,"invalid_filters","You have provided invalid type. The valid type is "+`string for ${e} filter`):new h(400,"invalid_filters","You have provided invalid type. The valid type is "+`string for ${e} filter`);if(!a.test(t))throw i==="default"?new y(400,"invalid_filters","You have provided invalid value. The valid value is "+`YYYY-MM-DD for ${e}`):new h(400,"invalid_filters","You have provided invalid value. The valid value is "+`YYYY-MM-DD for ${e}`)};validateNumberFilters=(t,e,i)=>{let a=e==="usersCount"?1:0,r=e==="usersCount"?1e3:1e6;if(typeof t!="number")throw i==="default"?new y(400,"invalid_filters","You have provided invalid type. The valid type is "+`number for ${e} filter`):new h(400,"invalid_filters","You have provided invalid type. The valid type is "+`number for ${e} filter`);if(t<a||t>r)throw i==="default"?new y(400,"invalid_filters","You have provided invalid value. The valid value is "+`between ${a} and ${r}`):new h(400,"invalid_filters","You have provided invalid value. The valid value is "+`between ${a} and ${r}`)}};var Xl=class{limit=null;page=null;groupId=null;constructor(t){this.limit=t?.limit||null,this.page=t?.page||null,t?.groupId!==void 0&&console.warn("Warning: groupId filter property is deprecated and no longer supported by the API. This property will be removed in a future version. Please update your code accordingly.")}constructFiltersUrl(){let t="";return this.limit&&(t+="&",t+=`limit=${this.limit}`),this.page&&(t+="&",t+=`page=${this.page}`),t}};var Jl=class{config=null;clientHttps=null;loyaltyHttps=null;loyaltyService=null;profileFacade=null;loyaltyValidator=null;topXFacade=null;matchQuizFacade=null;predictorHttps=null;errorHandlingMode=null;football=null;constructor(t,e,i,a,r){this.config=t,this.clientHttps=e,this.loyaltyHttps=i,this.profileFacade=new _t(r,a),this.loyaltyService=new jl(this.config),this.loyaltyValidator=new Yl,this.topXFacade=new re(t),this.matchQuizFacade=new ee(t),this.predictorHttps=new mt(t),this.errorHandlingMode=t.errorHandlingMode,this.football=new et(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 To(t)),this.config.idSchema==="native")return await this.loyaltyHttps.getTemplates(t,e);let i=await this.loyaltyHttps.getTemplates(t,e);i.data=await this.loyaltyService.remapTemplatesIds([...i.data]);for(let a of i.data)await this.loyaltyService.remapTemplateGroupMatchIds(a.groups);return i};getTemplateById=async(t,e)=>{let i=await this.loyaltyHttps.getTemplateById(t,e);if(this.config.idSchema==="native")return i;let a=await this.loyaltyService.remapTemplatesIds([i]);return await this.loyaltyService.remapTemplateGroupMatchIds(a[0].groups),a[0]};getLeaderboard=async(t,e,i)=>{e=this.loyaltyService.initFilters(e,"loyalty");let a=await this.loyaltyHttps.getLeaderboard(t,i,e);return a.data=await this.loyaltyService.addProfileModelToLeaderboard(a.data),a};getLeaderboardForGame=async(t,e,i)=>{e&&(e=new Xl(e));let a=await this.loyaltyHttps.getLeaderboardForGame(t,i,e);return a.data=await this.loyaltyService.addProfileModelToLeaderboard(a.data),a};getLeaderboardForLeague=async(t,e)=>{e=this.loyaltyService.initFilters(e,"league_leaderboard");let i=await this.loyaltyHttps.getLeaderboardForLeague(t,e);return i.data=await this.loyaltyService.addProfileModelToLeaderboard(i.data),i};getOwnRankings=async(t,e)=>{let{id:i}=await this.profileFacade.getOwn();return this.getUserRankings(i,t,e)};getUserRankings=async(t,e,i)=>{e=this.loyaltyService.initFilters(e,"rankings");let a=await this.loyaltyHttps.getUserRankings(t,e,i);return await this.getModelsForUserRankings(a)};getHighestSuccessRate=async(t,e)=>{t&&(t=new Io(t),this.loyaltyValidator.validate(t,this.errorHandlingMode));let i=await this.loyaltyHttps.getHighestSuccessRate(t,e);return this.loyaltyService.addProfileModelToHighestSuccessRate(i)};getTemplateWinners=async(t,e)=>{let i=await this.predictorHttps.getContestWinners(t,e),a=await this.getTemplateById(t);return i.contestModel=a,this.loyaltyService.completeContestWinners(i)};getEntitiesFollows=async(t,e)=>{this.loyaltyService.validateEntitiesFollowsFilters(t),this.config.idSchema!=="native"&&(t=await this.loyaltyService.remapEntitiesFollowsFilters(t));let i=await this.loyaltyHttps.getEntitiesFollows(t,e);return await this.loyaltyService.addModelsToEntitiesFollows(i)};getModelsForUserRankings=async t=>{let e=null,i=null,a=null,[r,o,n]=this.loyaltyService.extractRankingsIdsMap(t.data);if(n.length&&(e=(await this.getTemplates()).data.filter(p=>n.includes(p.id))),r.length){let l={gameIds:r};i=(await this.topXFacade.getGames(l)).data}if(o.length){let l={gameIds:o};a=(await this.matchQuizFacade.getGames(l)).data}return this.loyaltyService.setModelsForUserRankings(i,a,e,t)};getTemplateMatches=async(t,e,i)=>{let a=await this.getTemplateById(t,i);if((!a.competitionIds||a.competitionIds.length===0)&&(!a.teamIds||a.teamIds.length===0)&&(!a.matchIds||a.matchIds.length===0)&&(!a.gameIds||a.gameIds.length===0)&&(!a.gameTypes||a.gameTypes.length===0)&&(!a.groups||a.groups.length===0))return[];let r=await this.loyaltyService.initMatchFiltersForTemplates(a,e);return(await this.football.getMatches(r,i)).data}};var oe=class{clientHttps=null;profileHttps=null;loyaltyHttps=null;loyaltyFacade=null;localCache=null;constructor(t){this.clientHttps=new q(t),this.profileHttps=new Mi(t),this.loyaltyHttps=new Rt(t),this.localCache=new ct().createLocalCacheInstance(t.idSchema),this.loyaltyFacade=new Jl(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 Zl=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 te(t.errorHandlingMode),this.predictorService=new St(t,a)}makeFootballPrediction=async(t,e,i,a)=>{let r=this.predictorValidator.validateFixture(t,e,i,a),o=new ei;if(this.idMapping.idSchema!=="native"){let n=r.matchId,l="",p=await this.predictorService.remapMatchIdToNative([n]);if(r.matchId=p[0],this.errorHandlingMode==="default"&&!r.matchId)throw new y(400,"INVALID_FIELD","Match id is invalid!").errorMessage();if(this.errorHandlingMode==="standard"&&!r.matchId)throw new h(400,"INVALID_FIELD","Match id is invalid!");if(r instanceof st&&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 y(400,"INVALID_FIELD","Player id is invalid!").errorMessage();if(this.errorHandlingMode==="standard"&&r.market!==Ki&&!r.prediction.playerId)throw new h(400,"INVALID_FIELD","Player id is invalid!")}o.fixtures=[r];let c=await this.predictorHttps.makeFootballPrediction(o);return c.fixtures.forEach(u=>{u.prediction.playerId&&u.prediction.playerId!=="OWN_GOAL"&&(u.prediction.playerId=l),u.matchId=n}),c}else return o.fixtures=[r],await this.predictorHttps.makeFootballPrediction(o)};getMatchSummary=async(t,e)=>{let i=await this.getMatchSummaryBase(t,e),a=JSON.parse(JSON.stringify(i.predictions)),r=await this.predictorService.remapPlayerIdToIdSchema(a);return i.predictions=r,i};getMarketSummary=async(t,e,i,a)=>{try{let r=await this.getMatchSummaryBase(t,a);return await this.predictorService.getMarketSummary(r,e,i)}catch(r){throw r}};getMatchSummaryBase=async(t,e)=>{if(this.idMapping.idSchema!=="native"){let a=(await this.predictorService.remapMatchIdToNative([t]))[0],r=await this.predictorHttps.getMatchSummary(a,e);return r.matchId=t,r}else return await this.predictorHttps.getMatchSummary(t,e)};getConfig=async()=>{let t=await this.clientHttps.getConfig("predictor");return this.idMapping.idSchema!=="native"?await this.predictorService.remapCompetitionsFromConfig(t):t};deleteFootballPrediction=async t=>await this.predictorHttps.deleteFootballPrediction(t);getMyPredictions=async t=>{let e=this.predictorService.initPredictionsFilters(t,"user");return await this.predictorHttps.getMyPredictions(e)};getMyPredictionsForMatches=async(t,e)=>{if(this.errorHandlingMode==="default"&&this.predictorService.areIdsExceeded(t))throw new y(400,"EXCEEDED_LENGTH","Maximum matchIds in PredictionFilters should be 10 or less.").errorMessage();if(this.errorHandlingMode==="standard"&&this.predictorService.areIdsExceeded(t))throw new h(400,"EXCEEDED_LENGTH","Maximum matchIds in PredictionFilters should be 10 or less.");this.idMapping.idSchema!=="native"&&(t=await this.predictorService.remapMatchIdToNative([...t]));let i=this.predictorService.initPredictionsFilters(e,"matches",t);return await this.predictorHttps.getMyPredictions(i)};getMyCurrentPredictions=async t=>{let e=this.predictorService.initPredictionsFilters(t,"current");return await this.predictorHttps.getMyPredictions(e)};getMyPastPredictions=async t=>{let e=this.predictorService.initPredictionsFilters(t,"past");return await this.predictorHttps.getMyPredictions(e)};getUserPredictions=async(t,e,i)=>{let a=this.predictorService.initPredictionsFilters(e,"user");return await this.predictorHttps.getUserPredictions(t,i,a)};getUserCurrentPredictions=async(t,e,i)=>{let a=this.predictorService.initPredictionsFilters(e,"current");return await this.predictorHttps.getUserPredictions(t,i,a)};getUserPastPredictions=async(t,e,i)=>{let a=this.predictorService.initPredictionsFilters(e,"past");return await this.predictorHttps.getUserPredictions(t,i,a)};getUserPredictionsForMatches=async(t,e,i,a)=>{if(this.errorHandlingMode==="default"&&this.predictorService.areIdsExceeded(e))throw new y(400,"EXCEEDED_LENGTH","Maximum matchIds in PredictionFilters should be 10 or less.").errorMessage();if(this.errorHandlingMode==="standard"&&this.predictorService.areIdsExceeded(e))throw new h(400,"EXCEEDED_LENGTH","Maximum matchIds in PredictionFilters should be 10 or less.");this.idMapping.idSchema!=="native"&&(e=await this.predictorService.remapMatchIdToNative([...e]));let r=this.predictorService.initPredictionsFilters(i,"matches",e);return await this.predictorHttps.getUserPredictions(t,a,r)};getPredictionById=async t=>await this.predictorHttps.getPredictionById(t);getPredictionsByIds=async t=>await this.predictorHttps.getPredictionsByIds(t);getMatchMarketsResults=async t=>(this.idMapping.idSchema!=="native"&&(t=(await this.predictorService.remapMatchIdToNative([t]))[0]),await this.predictorService.getMatchMarketsResults(t))};var tp=class extends K{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 ep=class{validator=null;constructor(t){this.validator=new tp(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,M]=p.split(":").map(Number);d>M?o+=u:d===M?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 Ni=class{predictorHttps=null;clientHttps=null;predictorFacade=null;idMapping=null;helpers=null;constructor(t){this.idMapping=new R(t),this.predictorHttps=new mt(t),this.clientHttps=new q(t),this.predictorFacade=new Zl(t,this.predictorHttps,this.clientHttps,this.idMapping),this.helpers=new ep(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 ki=class{loyalty=null;profile=null;predictor=null;constructor(t){this.loyalty=new oe(t),this.profile=new D(t),this.predictor=new Ni(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 se=class{idSchema=null;profile=null;validator=null;idMapping=null;constructor(t){this.idSchema=t.idSchema,this.profile=new D(t),this.validator=new ie(t),this.idMapping=new R(t)}finalizePostFullModel=async t=>{let e=t.map(a=>a.userId),i=await this.profile.getByIds(e);return t.map(a=>(a.userModel=this.extractModelById(i,a.userId),a))};finalizeTopDiscussionsFilters=async t=>{if(this.idSchema!=="native"&&t.entityIds&&t.entityIds.length>0){this.validator.validateFilters(t);let e=await this.idMapping.getEntityIdsBySchemaId(Array.from(t.entityIds),t.entityType,"native");t.entityIds=e[t.entityType]}};extractModelById=(t,e)=>{if(t.length){let i=t.find(a=>a.id===e);return i?(delete i.interests,i):null}return null}};var ip=class{factory=null;https=null;loyaltyHttps=null;profile=null;service=null;discussionsService=null;constructor(t){this.factory=new Li,this.https=new xi(t),this.service=new ki(t),this.loyaltyHttps=new Rt(t),this.profile=new D(t),this.discussionsService=new se(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 Mr(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 br(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 ai(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 ri(e));let i=await this.https.getReportedPosts(t,e);return i.data=await this.discussionsService.finalizePostFullModel(i.data),i};getPredictions=async(t,e)=>{if(e){if(e.limit&&e.limit>20)throw new h(400,"invalid_limit","Invalid limit. The maximum limit is: "+20 .toString());e=new oi(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 ap=class{facade=null;constructor(t){this.facade=new ip(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 rp=class extends v{remapper=null;constructor(t){super(t,O(t.environment,"discussions")),this.remapper=new Oi}getAll=async(t,e)=>{let i="/discussions"+this.apiSignInUrl;t&&(i+=`${t.constructMainFiltersUrl()}`),f(e)&&(i+=m());let a="There was a problem getting discussions",r=await this.fetchWithoutAuth(i,a);return this.remapper.remapToDiscussions(r)};getById=async t=>{let e=`/discussions/${t}`+this.apiSignInUrl,i="There was a problem getting discussion",a=await this.fetchWithoutAuth(e,i);return this.remapper.remapToDiscussionById(a.data)};createPost=async(t,e)=>{let i=`/discussions/${t}/posts`+this.apiSignInUrl,a="There was a problem creating post in discussion",r="POST",o=await this.fetchWithAuth(i,a,r,e);return this.remapper.remapToPostByIdBasic(o.data)};getPostById=async t=>{let e=`/posts/${t}`+this.apiSignInUrl,i="There was a problem getting post by ID in discussion",a=await this.fetchWithoutAuth(e,i);return this.remapper.remapToPostByIdFull(a.data)};updatePost=async(t,e)=>{let i=`/posts/${t}`+this.apiSignInUrl,a="There was a problem editing post in discussion",r="PUT",o={content:e},n=await this.fetchWithAuth(i,a,r,o);return this.remapper.remapToPostByIdBasic(n.data)};reactToPost=async(t,e)=>{let i=`/posts/${t}/reaction`+this.apiSignInUrl,a="There was a problem reacting to post in discussion",r="PUT",o={reaction:e.toLocaleLowerCase()},n=await this.fetchWithAuth(i,a,r,o);return this.remapper.remapToPostByIdFull(n.data)};deletePost=async t=>{let e=`/posts/${t}`+this.apiSignInUrl,i="There was a problem deleting post in discussion",a="DELETE";return await this.fetchWithAuth(e,i,a),!0};getPosts=async(t,e)=>{let i=`/discussions/${t}/posts`+this.apiSignInUrl;e&&(i+=`${e.constructMainFiltersUrl()}`);let a="There was a problem getting posts in discussion",r=await this.fetchWithoutAuth(i,a);return this.remapper.remapToPostsForDiscussion(r,"full")};getPostReplies=async(t,e)=>{let i=`/posts/${t}/replies`+this.apiSignInUrl;e&&(i+=`${e.constructMainFiltersUrl()}`);let a="There was a problem getting post's replies in discussion",r=await this.fetchWithoutAuth(i,a);return this.remapper.remapToPostsForDiscussion(r,"full")};reportPost=async(t,e,i)=>{let a=`/posts/${t}/report`+this.apiSignInUrl,r="There was a problem reporting post in discussion",o="POST",n={reason:e.toLocaleUpperCase(),reason_details:i||null},l=await this.fetchWithAuth(a,r,o,n);return this.remapper.remapToPostByIdBasic(l.data)};getOwnPosts=async t=>{let e="/posts"+this.apiSignInUrl;t&&(e+=`${t.constructMainFiltersUrl()}`);let i="There was a problem getting own posts",a=await this.fetchWithAuth(e,i);return this.remapper.remapToPosts(a)};getUserPosts=async(t,e,i)=>{let a=`/posts/users/${t}`+this.apiSignInUrl;e&&(a+=`${e.constructMainFiltersUrl()}`),f(i)&&(a+=m());let r="There was a problem getting user's posts",o=await this.fetchWithoutAuth(a,r);return this.remapper.remapToPosts(o)};getPostsCount=async(t,e)=>{let i="/discussions/posts/count"+this.apiSignInUrl+`&discussion_ids=${t.join(",")}`;f(e)&&(i+=m());let a="There was a problem getting posts count for discussions",r=await this.fetchWithoutAuth(i,a);return this.remapper.remapToPostCount(r.data)};getTopDiscussions=async(t,e)=>{let i="/discussions/top"+this.apiSignInUrl;t&&(i+=`${t.constructMainFiltersUrl()}`),f(e)&&(i+=m());let a="There was a problem getting top discussions",r=await this.fetchWithoutAuth(i,a);return this.remapper.remapToDiscussions(r)};getPostsCountExtended=async t=>{let e="/discussions/posts/count"+this.apiSignInUrl,i={discussion_ids:Array.from(t)},a="POST",r="There was a problem getting posts count extended for discussions",o=await this.fetchWithoutAuth(e,r,a,i);return this.remapper.remapToPostCount(o.data)}};var op=class{createRequestBodyFromParam=t=>{let e=new Pr;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 sp=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 rp(t),this.clientHttps=new q(t),this.activityService=new wt(t),this.service=new se(t),this.factory=new op}getAll=async(t,e)=>{t&&(t=new Ar(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 jt(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 jt(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 jt(t)),await this.https.getOwnPosts(t));getUserPosts=async(t,e,i)=>(e&&(e=new jt(e)),await this.https.getUserPosts(t,e,i));getConfig=async()=>await this.clientHttps.getConfig("discussions");getPostsCount=async(t,e)=>{if(!t||!Array.isArray(t)||!t.length)throw this.errorHandlingMode==="standard"?new h(400,"invalid_discussion_ids","Invalid discussion ids argument. Please provide at least one discussion id in an array"):new y(400,"invalid_discussion_ids","Invalid discussion ids argument. Please provide at least one discussion id in an array");if(t.length>this.LIMIT_POSTS_COUNT)throw this.errorHandlingMode==="standard"?new h(400,"invalid_discussion_ids","Maximum number of discussion ids exceeded. The maximum number of discussion ids is 50. You can use 'getPostsCountExtended' method for more than 50 discussion ids."):new y(400,"invalid_discussion_ids","Maximum number of discussion ids exceeded. The maximum number of discussion ids is 50. You can use 'getPostsCountExtended' method for more than 50 discussion ids.");return await this.https.getPostsCount(t,e)};getTopDiscussions=async(t,e)=>{t&&(t=new Or(t),await this.service.finalizeTopDiscussionsFilters(t));let i=await this.https.getTopDiscussions(t,e);for(let a of i.data)await this.remapTags(a,"native",this.idSchema);return i};getPostsCountExtended=async t=>{if(!t||!Array.isArray(t)||!t.length)throw this.errorHandlingMode==="standard"?new h(400,"invalid_discussion_ids","Invalid discussion ids argument. Please provide at least one discussion id in an array"):new y(400,"invalid_discussion_ids","Invalid discussion ids argument. Please provide at least one discussion id in an array");if(t.length>this.LIMIT_POSTS_COUNT_EXTENDED)throw this.errorHandlingMode==="standard"?new h(400,"invalid_discussion_ids","Maximum number of discussion ids exceeded. The maximum number of discussion ids is: "+this.LIMIT_POSTS_COUNT_EXTENDED):new y(400,"invalid_discussion_ids","Maximum number of discussion ids exceeded. The maximum number of discussion ids is: "+this.LIMIT_POSTS_COUNT_EXTENDED);return await this.https.getPostsCountExtended(t)};remapTags=async(t,e,i)=>{if(this.idSchema!="native"&&t.context&&t.context.tags&&t.context.tags.length){let a=JSON.parse(JSON.stringify(t.context.tags)),r=await this.activityService.remapTagsIds(a,e,i);t.context.tags=r}}};var np=class{facade=null;constructor(t){this.facade=new sp(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 lp=class extends K{constructor(t){super(t)}validatePrediction=t=>{(!t.fixtures||!Array.isArray(t.fixtures)||t.fixtures.length===0)&&this.throwException(400,"invalid_method_call","Fixtures field is required and should contain at least one fixtures object. For more information please visit our documentation");let e=["id","predictionType","prediction"];for(let i of t.fixtures)(Object.keys(i).length!==e.length||Object.keys(i).some(a=>!e.includes(a)))&&this.throwException(400,"invalid_method_call","Fixtures field is invalid. For more information please visit our documentation"),this.validatePredictionType(i.predictionType,i.prediction);t.tiebreaker&&(!t.tiebreaker.statTotal||!Number.isInteger(t.tiebreaker.statTotal))&&this.throwException(400,"invalid_method_call","Tiebreaker field is invalid. It should contain statTotal key with integer value. For more information please visit our documentation")};validatePredictionType=(t,e)=>{switch(t){case"BOOLEAN":typeof e!="boolean"&&this.throwException(400,"invalid_method_call",`Prediction must be a boolean for prediction type ${t}`);break;case"NUMBER":(typeof e!="number"||!Number.isFinite(e))&&this.throwException(400,"invalid_method_call",`Prediction must be a number for prediction type ${t}`);break;case"ENUM":case"FREE_INPUT":(typeof e!="string"||e.trim()==="")&&this.throwException(400,"invalid_method_call",`Prediction must be a non-empty string for prediction type ${t}`);break;default:this.throwException(400,"invalid_method_call",`Unknown prediction type: ${t}`)}}};var pp=class{https=null;validator=null;profile=null;constructor(t){this.https=new Kt(t),this.profile=new D(t),this.validator=new lp(t.errorHandlingMode)}getGames=async(t,e)=>(t&&(t=new xr(t)),await this.https.getEventGames(t,e));getGameById=async(t,e)=>await this.https.getEventGameById(t,e);makePrediction=async(t,e)=>(this.validator.validatePrediction(e),await this.https.makeEventGamePrediction(t,e));updatePrediction=async(t,e,i)=>(this.validator.validatePrediction(i),await this.https.updateEventGamePrediction(t,e,i));getGamePredictionsForUser=async(t,e,i,a)=>{i&&(i=new Lr(i));let r=await this.https.getEventGamePredictionsForUser(t,e,i,a),o=null;try{o=await this.profile.getById(e).getInfo()}catch(n){console.error(n)}return r.data.forEach(n=>{n.profileModel=o}),r};getRankings=async(t,e,i)=>{e&&(e=new Dr(e));let a=await this.https.getEventGameRankings(t,e,i),r=a.data.map(n=>n.profileId),o=[];return r.length>0&&(o=await this.profile.getByIds(r),a.data=a.data.map(n=>(n.profileModel=o.find(l=>l.id===n.profileId)||null,n))),a}};var cp=class{facade=null;constructor(t){this.facade=new pp(t)}getGames=async(t,e)=>await this.facade.getGames(t,e);getGameById=async(t,e)=>await this.facade.getGameById(t,e);makePrediction=async(t,e)=>await this.facade.makePrediction(t,e);updatePrediction=async(t,e,i)=>await this.facade.updatePrediction(t,e,i);getGamePredictionsForUser=async(t,e,i,a)=>await this.facade.getGamePredictionsForUser(t,e,i,a);getRankings=async(t,e,i)=>await this.facade.getRankings(t,e,i)};var _d=["minutesPlayed","cleanSheets","concededGoals","saves","penaltySaved","penaltyCommitted","yellowCards","redCards","assists","foulsCommitted","ownGoals","goals","tackles","shotsOn"],Pd=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"),Gi=class{static createFantasyPrediction(t,e,i,a){let r=new ke;return r.template_id=t||null,r.group_id=e||null,r.fixtures=i?.map(o=>({player_id:o,match_type:"FOOTBALL",market:"PLAYER_PERFORMANCE",role:a?.get(o)?.toLocaleUpperCase()||null}))||[],r}static createFantasyPlayerStats(t){return _d.map(e=>{let i=new Gr,a=t.data.reduce((r,o)=>r+o.stats[e],0);return i.key=e,i.label=Pd.get(e),i.value=a,i})}};var up=class{idMapping=null;idSchema=null;errorHandlingModel=null;football=null;constructor(t){this.idSchema=t.idSchema,this.errorHandlingModel=t.errorHandlingMode,this.football=new et(t),this.idMapping=new R(t)}remapCompetitions=async t=>{let e={competition:t};return(await this.idMapping.idMappingFacade.getEntitiesByIds(e,"native",this.idSchema)).competition};remapPlayers=async(t,e,i,a)=>{let r={player:Array.from(t)},o=await this.idMapping.idMappingFacade.getEntitiesByIdsMap(r,e,i);if(a){let n=new Map;for(let[l,p]of Array.from(a.entries())){let c=o.get(l);c&&n.set(c,p)}a.clear();for(let[l,p]of Array.from(n.entries()))a.set(l,p)}return Array.from(o.values())};addPlayerModels=async t=>{let e=t.map(a=>a.playerId),i=await this.football.footballFacade.getPlayersMapWithNativeIds(e);return t.forEach(a=>{a.playerModel=Object.keys(i).length&&i[a.playerId]||null,a.playerId=a.playerModel?.id||a.playerId}),t};remapPlayerIdToNative=async t=>{let e=await this.idMapping.getEntityIdBySchemaId("player",t);if(e)return e.id;this.throwException(404,"id_mapping_not_found","No ID mappings are available for the provided ID. ID argument: "+t)};addMatchModels=async t=>{let e=t.map(a=>a.matchId),i=await this.football.footballFacade.getMatchesMapWithNativeIds(e);return t.forEach(a=>{a.matchModel=Object.keys(i).length&&i[a.matchId]||null,a.matchId=a.matchModel?.id||a.matchId}),t};throwException=(t,e,i)=>{throw this.errorHandlingModel==="standard"?new h(t,e,i):new y(t,e,i)}};var dp=class{idSchema=null;clientHttps=null;footballHttps=null;predictorHttps=null;loyaltyHttps=null;service=null;constructor(t){this.idSchema=t.idSchema,this.clientHttps=new q(t),this.footballHttps=new dt(t),this.service=new up(t),this.predictorHttps=new mt(t),this.loyaltyHttps=new Rt(t)}getConfig=async()=>{let t=await this.clientHttps.getConfig("fantasy");return this.idSchema!=="native"&&(t.competitionsWhitelist=await this.service.remapCompetitions([...t.competitionsWhitelist])),t};getPlayersPoints=async(t,e,i)=>{let a=await this.footballHttps.getPlayersPoints(t,e,i);return a.data=await this.service.addPlayerModels(a.data),a};getPlayerDetailedStatistics=async(t,e,i)=>{let a="";this.idSchema!=="native"&&(a=await this.service.remapPlayerIdToNative(e));let r=await this.footballHttps.getPlayerDetailedStatistics(t,a||e,i);return r.meta.filters.playerId=e,r.data=await this.service.addMatchModels(r.data),r};play=async(t,e,i,a)=>{if((!i||!Array.isArray(i))&&this.service.throwException(400,"invalid_method_call","Invalid parameter provided. Please check the following parameter: "+"playerIds"),a){let o="playersRoles";a instanceof Map||this.service.throwException(400,"invalid_method_call","Invalid parameter provided. Please check the following parameter: "+o);let n=Array.from(a.keys());n.length||this.service.throwException(400,"invalid_method_call","Invalid parameter provided. Please check the following parameter: "+o),n.every(u=>!i.includes(u))&&this.service.throwException(400,"invalid_method_call","The keys in the players roles map are not part of the valid keys. The valid keys are: "+i.join(","));let p=Array.from(a.values()),c=["CAPTAIN","VICE_CAPTAIN"];p.every(u=>c.includes(u.toLocaleUpperCase()))||this.service.throwException(400,"invalid_method_call","The values in the map are not valid. The valid ones are: "+c.join(",")+". Case insensitive.")}let r=null;if(this.idSchema!=="native"){let o=await this.service.remapPlayers(i,this.idSchema,"native",a);r=Gi.createFantasyPrediction(t,e,o,a)}else r=Gi.createFantasyPrediction(t,e,i,a);return await this.predictorHttps.makeFootballPrediction(r)};getMyPrediction=async(t,e)=>{let i=`${t}_${e}`,a=new V(null);a.gameIds=[i];let r=await this.predictorHttps.getMyPredictions(a);return r.data.length===0?null:r.data[0]};getPlayerStatistics=async(t,e,i)=>{let a=await this.getPlayerDetailedStatistics(t,e,i);return Gi.createFantasyPlayerStats(a)};getGameWeekStatistics=async t=>await this.loyaltyHttps.getTemplateBreakdownPoints(t)};var mp=class{facade=null;constructor(t){this.facade=new dp(t)}getConfig=async()=>await this.facade.getConfig();getPlayersPoints=async(t,e,i)=>await this.facade.getPlayersPoints(t,e,i);getPlayerDetailedStatistics=async(t,e,i)=>await this.facade.getPlayerDetailedStatistics(t,e,i);play=async(t,e,i,a)=>await this.facade.play(t,e,i,a);getMyPrediction=async(t,e)=>await this.facade.getMyPrediction(t,e);getPlayerStatistics=async(t,e,i)=>await this.facade.getPlayerStatistics(t,e,i);getGameWeekStatistics=async t=>await this.facade.getGameWeekStatistics(t)};var hp=class{configuration;constructor(t){this.configuration=t}getSDKConfiguration(){return this.configuration}};var fp=class{remapToResponseModel=(t,e,i)=>{let a=new go;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 gp=class{errorHandlingModel=null;constructor(t){this.errorHandlingModel=t.errorHandlingMode}validate=(t,e,i)=>{(!t||!Array.isArray(t)||t.length===0)&&this.throwException(400,"invalid_ids","Invalid or empty IDs provided. Please provide at least one ID."),(!e||e!=="native"&&e!=="enetpulse"&&e!=="sportal365"&&e!=="sportradar"&&e!=="api_football")&&this.throwException(400,"invalid_input_provider","Invalid provider. The valid providers are: 'native', 'enetpulse', 'sportal365', 'sportradar' and 'api_football'."),(!i||i!=="native"&&i!=="enetpulse"&&i!=="sportal365"&&i!=="sportradar"&&i!=="api_football")&&this.throwException(400,"invalid_output_provider","Invalid provider. The valid providers are: 'native', 'enetpulse', 'sportal365', 'sportradar' and 'api_football'."),e===i&&this.throwException(400,"invalid_output_provider","Invalid output provider. The output can not be the same as the input provider.")};throwException=(t,e,i)=>{throw this.errorHandlingModel==="standard"?new h(t,e,i):new y(t,e,i)}};var yp=class{validator=null;idMappingFacade=null;factory=new fp;constructor(t){this.validator=new gp(t),this.idMappingFacade=new yi(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 bp=class{facade=null;constructor(t){this.facade=new yp(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 Mp=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 Ui=class{matchQuizFacade=null;helpers=new Mp;constructor(t){this.matchQuizFacade=new ee(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 Ip=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 Vi=class{topXFacade=null;helpers=new Ip;constructor(t){this.topXFacade=new re(t)}getConfig=async()=>await this.topXFacade.getConfig();getGames=async(t,e)=>await this.topXFacade.getGames(t,e);getGameById=async(t,e)=>await this.topXFacade.getGameById(t,e);getGamePredictions=async(t,e,i)=>await this.topXFacade.getGamePredictions(t,e,i);getGameResults=async(t,e,i)=>await this.topXFacade.getGameResults(t,e,i);getCurrentGameResults=async t=>await this.topXFacade.getCurrentGameResults(t);play=async t=>await this.topXFacade.play(t);delete=async t=>await this.topXFacade.delete(t);getMyGameEditions=async(t,e)=>await this.topXFacade.getMyGameEditions(t,e);getMyGamePrediction=async t=>await this.topXFacade.getMyGamePrediction(t);getUserGameEditions=async(t,e,i)=>await this.topXFacade.getUserGameEditions(t,e,i);getUserGamePrediction=async(t,e,i)=>await this.topXFacade.getUserGamePrediction(t,e,i);getMarketsResultsForGame=async(t,e)=>await this.topXFacade.getMarketsResultsForGame(t,e);getGameWinners=async(t,e)=>await this.topXFacade.getGameWinners(t,e)};var wp=class{remapUserVotes=t=>{let e=new gn;return e.meta=this.remapMeta(t.meta.pagination),e.data=t.data.map(i=>this.remapUserVoteModel(i)),e};remapResults=t=>{let e=new Mn;return e.meta=t.meta,e.data=t.data.map(i=>this.remapResultsModel(i)),e};remapMeta=t=>{let e=new b;return e.pagination.itemsPerPage=t.items_per_page,e.pagination.nextPageStartsAfter=t.next_page_starts_after,e};remapUserVoteModel=t=>{let e=new yn;return e.matchId=t.match_id,e.playerId=t.player_id,e.createdAt=t.created_at,e};remapResultsModel=t=>{let e=new In;return e.teamId=t.team_id,e.playerId=t.player_id,e.votes=t.votes,e.winner=t.winner,e}};var _p=class{id=null;pollId=null;optionIds=[];optionsModels=[];userId=null;createdAt=null};var Pp=class extends tt{remapPolls=t=>{let e=new mn;return e.meta.pagination=this.remapMetaPagination(t.meta.pagination),e.data=t.data.map(i=>this.remapPoll(i)),e};remapPollById=t=>{let e=new pn;return e.id=t.id,e.title=t.title,e.alternativeTitle=t.alternative_title,e.description=t.description,e.type=t.type,e.images=t.images,e.status=t.status,e.language=t.language,e.authRequirement=t.auth_requirement,e.flags=t.flags,e.totalVotes=t.total_votes,e.customFields=t.custom_fields,e.related=t.related?this.remapRelated(t.related):[],e.branding=t.branding?this.remapBranding(t.branding):null,e.embedCode=t.embed_code,e.labels=t.labels,e.rules=t.rules,e.adContent=t.ad_content,e.options=t.options?this.remapOptions(t.options):[],e.context=t.context?this.remapContext(t.context):t.context,e.preferencesEnabled=t.preferences_enabled,e.multipleChoice=t.multiple_choice,e.maxMultipleChoiceOptions=t.max_multiple_choice_options,e.participationCount=t.participation_count,e.maxAttempts=t.max_attempts,e.externalActivity=t.external_activity,e.createdAt=t.created_at,e.updatedAt=t.updated_at,e};remapUserVote=t=>{let e=new dn;return e.id=t.id,e.pollId=t.poll_id,e.optionId=t.option_id,e.optionIds=t.option_ids,e.userId=t.user_id,e.attempts=t.attempts||null,e.previousVotes=t.previous_votes?t.previous_votes.map(i=>this.remapPreviousVotes(i)):[],e.createdAt=t.created_at,e};remapPreviousVotes=t=>{let e=new _p;return e.id=t.id,e.pollId=t.poll_id,e.optionIds=t.option_ids,e.userId=t.user_id,e.createdAt=t.created_at,e};remapPollsVotes=t=>{let e=new hn;return e.meta.pagination=this.remapMetaPagination(t.meta.pagination),e.data=t.data.map(i=>this.remapAllPollsVotes(i)),e};remapAllPollsVotes=t=>{let e=new Ht;return e.id=t.id,e.pollId=t.poll_id,e.optionId=t.option_id,e.optionIds=t.option_ids,e.userId=t.user_id,e.createdAt=t.created_at,e};remapSinglePollVote=t=>{let e=new un;return e.id=t.id,e.pollId=t.poll_id,e.optionId=t.option_id,e.optionIds=t.option_ids,e.userId=t.user_id,e.attempts=t.attempts||null,e.createdAt=t.created_at,e.previousVotes=t.previous_votes?t.previous_votes.map(i=>this.remapPreviousVotes(i)):[],e};remapMetaPagination=t=>{let e=new ut;return e.itemsPerPage=t.items_per_page,e.nextPageStartsAfter=t.next_page_starts_after,e};remapPoll=t=>{let e=new pi;return e.id=t.id,e.title=t.title,e.alternativeTitle=t.alternative_title,e.description=t.description,e.type=t.type,e.images=t.images,e.status=t.status,e.language=t.language,e.authRequirement=t.auth_requirement,e.flags=t.flags,e.totalVotes=t.total_votes,e.customFields=t.custom_fields,e.related=t.related?this.remapRelated(t.related):[],e.branding=t.branding?this.remapBranding(t.branding):null,e.embedCode=t.embed_code,e.labels=t.labels,e.adContent=t.ad_content,e.options=t.options?this.remapOptions(t.options):[],e.context=t.context?this.remapContext(t.context):t.context,e.preferencesEnabled=t.preferences_enabled,e.multipleChoice=t.multiple_choice,e.maxMultipleChoiceOptions=t.max_multiple_choice_options,e.participationCount=t.participation_count,e.maxAttempts=t.max_attempts,e.externalActivity=t.external_activity,e.createdAt=t.created_at,e.updatedAt=t.updated_at,e};remapContext=t=>{let e=new Ct;return e.content=t.content,e.tags=t.tags?t.tags.map(i=>{let a=new ur;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 z;return i.entityId=e.entity_id,i.entityType=e.entity_type,i.entityRelationship=e.entity_relationship,i});remapOptions=t=>t.map(e=>{let i=new cn;return i.id=e.id,i.title=e.title,i.description=e.description,i.images=e.images,i.votes=e.votes,i.embedCode=e.embed_code,i.preferencesMapping=e.preferences_mapping?this.remapPreferencesMapping(e.preferences_mapping):[],i});remapPreferencesMapping=t=>t.map(e=>{let i=new ci;return i.preferenceId=e.preference_id,i})};var Tp=class extends v{pollRemapper=null;playerOfTheMatchRemapper=null;constructor(t){super(t,O(t.environment,"voting")),this.pollRemapper=new Pp,this.playerOfTheMatchRemapper=new wp}getPolls=async(t,e)=>{let i=`/polls${this.apiSignInUrl}`;t&&(i+=t.constructMainFiltersUrl()),f(e)&&(i+=m());let a="There was a problem fetching polls",r=await this.fetchWithoutAuth(i,a);return this.pollRemapper.remapPolls(r)};getPollById=async(t,e)=>{let i=`/polls/${t}${this.apiSignInUrl}`;f(e)&&(i+=m());let a="There was a problem fetching the following poll: "+t,r=await this.fetchWithoutAuth(i,a);return this.pollRemapper.remapPollById(r.data)};voteForPoll=async(t,e)=>{let i=`/polls/${t}/votes${this.apiSignInUrl}`,a="PUT",r={option_ids:e},o="There was a problem voting for the following poll: "+t,n=await this.fetchWithAuth(i,o,a,r);return this.pollRemapper.remapUserVote(n.data)};deleteVoteForPoll=async t=>{let e=`/polls/${t}/votes${this.apiSignInUrl}`,i="DELETE",a="There was a problem deleting vote for the following poll: "+t;return await this.fetchWithAuth(e,a,i),!0};getMyPollVote=async t=>{let e=`/polls/${t}/votes${this.apiSignInUrl}`,i="There was a problem fetching user's own vote for the following poll: "+t,a=await this.fetchWithAuth(e,i);return this.pollRemapper.remapSinglePollVote(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)?m():""}`,a="There was a problem fetching results for 'Player of the match'",r=await this.fetchWithoutAuth(i,a);return this.playerOfTheMatchRemapper.remapResults(r)}};var Ep=class{idMappingService=null;idSchema=null;errorHandlingMode=null;validator=null;activityService=null;football=null;constructor(t){this.idSchema=t.idSchema,this.errorHandlingMode=t.errorHandlingMode,this.idMappingService=new R(t),this.validator=new ie(t),this.activityService=new wt(t),this.football=new et(t)}finalizePollsFilters=async t=>{if(this.idSchema!=="native"&&t.entityIds&&t.entityIds.length>0){this.validator.validateFilters(t);let e=await this.idMappingService.getEntityIdsBySchemaId(Array.from(t.entityIds),t.entityType,"native");t.entityIds=e[t.entityType]}};remapTags=async(t,e,i)=>{if(this.idSchema!="native"&&t.context&&t.context.tags&&t.context.tags.length){let a=JSON.parse(JSON.stringify(t.context.tags)),r=await this.activityService.remapTagsIds(a,e,i);t.context.tags=r}};remapMatchAndPlayerIds=async(t,e,i,a)=>{let r={match:[t],player:[e]},o=await this.idMappingService.idMappingFacade.getEntitiesByIds(r,i,a);if(o.match.length>0&&o.player.length>0){let n=o.match[0],l=o.player[0];return[n,l]}throw this.errorHandlingMode==="default"?new y(404,"entity_ids_not_found","Some of the sport entity IDs were not found for the provided id schema"):new h(404,"entity_ids_not_found","Some of the sport entity IDs were not found for the provided id schema")};remapMatchIds=async(t,e,i)=>{let a=Array.from(t),r={match:t},o=await this.idMappingService.idMappingFacade.getEntitiesByIds(r,e,i);if(o.match.length>0&&o.match.length===a.length)return o.match;throw this.errorHandlingMode==="default"?new y(404,"match_ids_not_found","Some of the match IDs were not found for the provided id schema"):new h(404,"match_ids_not_found","Some of the match IDs were not found for the provided id schema")};setModelsForUserVotes=async t=>{let e=t.data.map(a=>a.matchId),i=t.data.map(a=>a.playerId);if(e.length>0&&i.length>0){let a=await this.football.footballFacade.getMatchesMapWithNativeIds(e),r=await this.football.footballFacade.getPlayersMapWithNativeIds(i);t.data.forEach(o=>{o.matchModel=a[o.matchId]||null,o.playerModel=r[o.playerId]||null,o.matchId=o.matchModel?o.matchModel.id:o.matchId,o.playerId=o.playerModel?o.playerModel.id:o.playerId}),t.meta.pagination.nextPageStartsAfter&&(t.meta.pagination.nextPageStartsAfter=t.data[t.data.length-1].matchId)}return t};setModelsForPotmResults=async t=>{let e=t.map(a=>a.teamId),i=t.map(a=>a.playerId);if(e.length>0&&i.length>0){let a=await this.football.footballFacade.getTeamsMapWithNativeIds(e),r=await this.football.footballFacade.getPlayersMapWithNativeIds(i);t.forEach(o=>{o.teamModel=a.get(o.teamId)||null,o.playerModel=r[o.playerId]||null,o.teamId=o.teamModel?o.teamModel.id:o.teamId,o.playerId=o.playerModel?o.playerModel.id:o.playerId})}}};var Rp=class{https=null;service=null;idSchema=null;constructor(t){this.idSchema=t.idSchema,this.https=new Tp(t),this.service=new Ep(t)}getPolls=async(t,e)=>{t&&(t=new li(t),await this.service.finalizePollsFilters(t));let i=await this.https.getPolls(t,e);for(let a of i.data)await this.service.remapTags(a,"native",this.idSchema);return i};getPollById=async(t,e)=>{let i=await this.https.getPollById(t,e);return await this.service.remapTags(i,"native",this.idSchema),i};voteForPoll=async(t,e)=>(typeof e=="string"&&(console.warn("Passing a single optionId as a string will be deprecated. Please pass it as an array."),e=[e]),await this.https.voteForPoll(t,e));deleteVoteForPoll=async t=>await this.https.deleteVoteForPoll(t);getMyPollVote=async(t,e)=>{let i=await this.https.getMyPollVote(t);if(e){let a=await this.getPolls(new li({pollIds:[t]}),!0);i.pollModel=a.data.find(r=>r.id===t)||null,i.optionModel=a.data.find(r=>r.id===t)?.options.find(r=>r.id===i.optionId)||null,i.optionsModels=i.optionIds?a.data.find(r=>r.id===t)?.options.filter(r=>i.optionIds.includes(r.id))||[]:[],i.previousVotes.forEach(r=>{r.optionsModels=a.data.find(o=>o.id===r.pollId)?.options.filter(o=>r.optionIds.includes(o.id))||[]})}return i};getMyPollsVotes=async t=>{t&&(t=new w(t));let e=await this.https.getMyPollsVotes(t),i=e.data.map(r=>r.id),a=await this.getPolls(new li({pollIds:i}),!0);return e.data=e.data.map(r=>(r.pollModel=a.data.find(o=>o.id===r.pollId)||null,r.optionModel=r.pollModel?.options.find(o=>o.id===r.optionId)||null,r.optionsModels=r.optionIds?r.pollModel?.options.filter(o=>r.optionIds.includes(o.id))||[]:[],r)),e};voteForPlayerOfTheMatch=async(t,e)=>{if(this.idSchema!=="native"){let[i,a]=await this.service.remapMatchAndPlayerIds(t,e,this.idSchema,"native");return await this.https.voteForPlayerOfTheMatch(i,a),{playerId:e}}return await this.https.voteForPlayerOfTheMatch(t,e)};deleteVoteForPlayerOfTheMatch=async t=>{if(this.idSchema!=="native"){let e=await this.service.remapMatchIds([t],this.idSchema,"native");return await this.https.deleteVoteForPlayerOfTheMatch(e[0]),!0}return await this.https.deleteVoteForPlayerOfTheMatch(t),!0};getOwnVotesForPlayerOfTheMatch=async t=>{if(t&&(t=new fn(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 Hi=class{facade=null;constructor(t){this.facade=new Rp(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 Fp=class{clientHttps=null;topX=null;matchQuiz=null;loyalty=null;miniGames=null;voting=null;constructor(t){this.clientHttps=new q(t),this.topX=new Vi(t),this.matchQuiz=new Ui(t),this.loyalty=new oe(t),this.miniGames=new ae(t),this.voting=new Hi(t)}getListContent=async(t,e,i)=>{e&&(e=new yo(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(M=>o.includes(M.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 Sp=class{facade=null;constructor(t){this.facade=new Fp(t)}getListContent=async(t,e,i)=>await this.facade.getListContent(t,e,i)};var vp=class{fromResponse(t,e){let i=new Map;return t.matches.forEach(a=>{let r=a.odds.map(o=>{let n=new Es;return n.bookmaker=o.bookmaker?this.remapBookmaker(o.bookmaker):null,n.type=o.type,n.markets=o.markets?this.remapMarkets(o.markets,e):[],n});i.set(a.id,r)}),i}remapBookmaker(t){let e=new fs;return e.id=t.id,e.name=t.name,e.assets=t.assets?this.remapAssets(t.assets):[],e.links=t.links||[],e.branding=t.branding?this.remapBranding(t.branding):null,e.eventUrls=t.event_urls?this.remapEventUrls(t.event_urls):[],e.stakesDisclaimer=t.stakes_disclaimer,e.domainName=t.domain_name,e}remapMarkets(t,e){return t.map(i=>{let a=new Is;return a.type=i.type?this.remapMarketType(i.type):null,a.scope=i.scope?this.remapMarketScope(i.scope):null,a.selections=i.selections?this.remapMarketSelections(i.selections,a.type.code,e):[],a})}remapEventUrls(t){return t.map(e=>{let i=new bs;return i.url=e.url,i.appType=e.app_type,i})}remapBranding(t){let e=new gs;return e.backgroundColor=t.background_color,e.textColor=t.text_color,e}remapAssets(t){return t.map(e=>{let i=new ys;return i.logo=e.logo,i.type=e.type,i.transparentBackgroundUrl=e.transparent_background_url,i.backgroundColor=e.background_color,i})}remapMarketType=t=>{let e=new Ps;return e.id=t.id,e.name=t.name,e.code=t.code,e.entityType=t.entity_type,e};remapMarketScope=t=>{let e=new ws;return e.id=t.id,e.name=t.name,e.type=t.type,e.entityType=t.entity_type,e};remapMarketSelections=(t,e,i)=>{let a=Array.from(t);return i.length>0&&e==="OVER_UNDER"&&(a=a.filter(r=>r.code==="over"?i.some(o=>{switch(o){case"OVER_GOALS_0_5":return r.value==="0.5";case"OVER_GOALS_1_5":return r.value==="1.5";case"OVER_GOALS_2_5":return r.value==="2.5";case"OVER_GOALS_3_5":return r.value==="3.5";case"OVER_GOALS_4_5":return r.value==="4.5";case"OVER_GOALS_5_5":return r.value==="5.5";default:return!1}}):!1)),a.map(r=>{let o=new _s;return o.id=r.id,o.name=r.name,o.code=r.code,o.value=r.value,o.odds=r.odds,o.urls=r.urls?this.remapEventUrls(r.urls):[],o.movement=r.movement,o.oddsOld=r.odds_old,o.entityType=r.entity_type,o.additionalInfo=r.additional_info,o.providerInfo=r.provider_info?this.remapProviderInfo(r.provider_info):null,o})};remapProviderInfo=t=>{let e=new Ts;return e.selectionId=t.selection_id,e.eventId=t.event_id,e.marketId=t.market_id,e.competitionId=t.competition_id,e}};var Cp=class{footballBaseUrl="https://football.api.sportal365.com/";retryRequest=!1;oddClient=null;remapper=null;constructor(t){this.oddClient=t.oddClient,this.remapper=new vp}getMatchOdds=async(t,e)=>{let i=`v2/matches/livescore?odd_client=${this.oddClient.name}&match_ids=${t.join(",")}${e.constructFiltersUrl()}`,a=`Error while fetching match odds for matchIds: ${t.join(",")}`,r=await this.fetchWithAuth(i,a),o=e.marketTypes&&e.marketTypes.length>0?e.marketTypes.filter(n=>n.includes("OVER")):[];return this.remapper.fromResponse(r,o)};getAuthHeaders=()=>{let t=typeof window<"u"?window.btoa(`${this.oddClient.credentials.username}:${this.oddClient.credentials.password}`):Buffer.from(`${this.oddClient.credentials.username}:${this.oddClient.credentials.password}`).toString("base64");return{"Content-Type":"application/json",Authorization:`Basic ${t}`}};fetchWithAuth=async(t,e)=>{let i=await fetch(this.footballBaseUrl+t,{headers:this.getAuthHeaders()}),a=await i.json();if(!i.ok)throw(i.status===401||i.status===403)&&!this.retryRequest&&(this.retryRequest=!0,await this.fetchWithAuth(t,e)),this.retryRequest=!1,console.warn(e,a),a;return this.retryRequest=!1,a}};var Ap=class{https;idSchema;oddClient;idMapping=null;validator;constructor(t){this.idSchema=t.idSchema,this.oddClient=t.oddClient,this.https=new Cp(t),this.validator=new K(t.errorHandlingMode),this.idMapping=new R(t)}getByMatchIds=async(t,e)=>{this.validateOddClient(),(!t||!Array.isArray(t)||t.length===0)&&this.validator.throwException(400,"invalid_match_ids","Match IDs are invalid!");let i=Array.from(t);this.idSchema!=="sportal365"&&(i=(await this.idMapping.idMappingFacade.getEntitiesByIds({match:Array.from(t)},this.idSchema,"sportal365")).match);let a=new Ms(e),r=await this.https.getMatchOdds(i,a);if(this.idSchema!=="sportal365"){let o=await this.idMapping.idMappingFacade.getEntitiesByIdsMap({match:Array.from(r.keys())},"sportal365",this.idSchema),n=new Map;return Array.from(r.entries()).forEach(([l,p])=>{n.set(o.get(l),p)}),n}return r};validateOddClient=()=>{this.oddClient||this.validator.throwException(412,"odd_client_configuration_not_found","Odds namespace requires oddClient configuration to be set")}};var Op=class{facade;constructor(t){this.facade=new Ap(t)}getByMatchIds=async(t,e)=>await this.facade.getByMatchIds(t,e)};var xp=class{factory=null;privateLeagueHttps=null;loyaltyHttps=null;profile=null;service=null;discussionsService=null;constructor(t){this.factory=new Li,this.privateLeagueHttps=new xi(t),this.loyaltyHttps=new Rt(t),this.profile=new D(t),this.service=new ki(t),this.discussionsService=new se(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 Ws(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 Ks(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 ai(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 ri(e));let i=await this.privateLeagueHttps.getReportedPosts(t,e);return i.data=await this.discussionsService.finalizePostFullModel(i.data),i};getPredictions=async(t,e)=>{if(e){if(e.limit&&e.limit>20)throw new h(400,"invalid_limit","Invalid limit. The maximum limit is: "+20 .toString());e=new oi(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 Lp=class{privateLeaguesFacade=null;constructor(t){this.privateLeaguesFacade=new xp(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 Dp=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 Bp=class extends K{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 Np=class{https=null;profile=null;validator=null;constructor(t){this.https=new Kt(t),this.profile=new D(t),this.validator=new Bp(t.errorHandlingMode)}getGames=async(t,e)=>(t&&(t=new tn(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 en(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 kp=class{facade=null;constructor(t){this.facade=new Np(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 Qu(){let s=qu(),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 Hc=null,nu=null;function Ed(s){if(Rd(s)){let t=Fd(s);if(t.isValid)return Hc={profile:new D(s),football:new et(s),predictor:new Ni(s),loyalty:new oe(s),topX:new Vi(s),matchQuiz:new Ui(s),activity:new qn(s),miniGames:new ae(s),discussions:new np(s),privateLeagues:new Lp(s),challenges:new ap(s),progress:new Dp,voting:new Hi(s),fantasy:new mp(s),helpers:new hp(s),idMapping:new bp(s),bracketGame:new Al(s),lists:new Sp(s),standingGame:new kp(s),eventGame:new cp(s),odds:new Op(s),getVersion:Qu},nu={...s},Hc;Sd(t)}return Hc}var Rd=s=>!Hc||JSON.stringify(s)!==JSON.stringify(nu)||s.authProvider?.getIdToken()!==nu.authProvider?.getIdToken(),Fd=s=>{let e=new kn().validate(s);return(e.idSchema.validation==="missing"||e.idSchema.validation==="invalid")&&(console.warn(e.idSchema.message.text),s.idSchema="native"),(e.environment.validation==="missing"||e.environment.validation==="invalid")&&(console.warn(e.environment.message.text),s.environment="prod"),(e.lang.validation==="missing"||e.lang.validation==="invalid")&&(console.warn(e.lang.message.text),s.lang="en"),(e.errorHandlingMode.validation==="missing"||e.errorHandlingMode.validation==="invalid")&&(console.warn(e.errorHandlingMode.message.text),s.errorHandlingMode="default"),e.authProvider.validation==="invalid"&&console.warn(e.authProvider.message.text),(e.oddClient.message.type==="warning"||e.oddClient.credentials.message.type==="warning")&&console.warn(e.oddClient.message.text||e.oddClient.credentials.message.text),e},Sd=s=>{let t="isValid";Object.keys(s).forEach(e=>{let i=s[e];if(e!==t&&e!=="authProvider"){if(i.message.type==="error")throw new Error(i.message.text)}else if(e!==t&&e==="authProvider"){if(i?.message.type==="error")throw new Error(i.message.text);Object.keys(new le).forEach(a=>{if(i[a].message.type==="error")throw new Error(i[a].message.text)})}if(e!==t&&e==="oddClient"){if(i?.message.type==="error")throw new Error(i.message.text);let a=i;if(a.credentials.message.type==="error")throw new Error(a.credentials.message.text)}})};export{fr as AcceptChallengeModel,zs as AcceptPrivateLeagueModel,ji as AchievementsStats,Te as ActionValueModel,jc as ActionsEnum,Ee as ActionsModel,ge as ActivityFilters,Zp as ActivityMeta,fe as ActivityResponseBody,uc as AssetsModel,Pe as AutomaticModerationModel,or as BadgesModel,za as BadgesModelV2,sr as BadgesValue,Q as BadgesValueV2,ys as BookmakerAssetModel,gs as BookmakerBrandingModel,Ac as BookmakerLinkModel,fs as BookmakerModel,bs as BookmakerUrlModel,Fs as BothTeamsFixtureModel,hr as BracketGameFilters,ye as BracketGameFixtureScoreModel,mr as BracketGameFixtures,la as BracketGameFixturesModel,be as BracketGameMetaModel,pa as BracketGameMetaParticipantsModel,ca as BracketGameModel,ha as BracketGamePredictionFixturesModel,fa as BracketGamePredictionModel,ic as BracketGamePredictionRequestBody,Vu as BracketGamePredictionStatusEnum,dr as BracketGamePredictionsFilters,ua as BracketGamePredictionsModel,ga as BracketGameRankingsModel,Me as BracketGameTiebreaker,ma as BracketGameTiebreakerModel,da as BracketGamesModel,tu as BracketWinnerEnum,uo as BrandingColorsModel,ho as BrandingImagesModel,co as BrandingModel,mo as BrandingUrlsModel,La as BreakdownModel,xc as CalculatedOneXTwoFromScoresModel,tc as CampaignModel,gr as ChallengeCreateModel,br as ChallengeFilters,Ir as ChallengeRankingsModel,yr as ChallengeUpdateModel,ze as ClassicQuizBasicModel,Bo as ClassicQuizFilters,qe as ClassicQuizFiltersMeta,No as ClassicQuizFullModel,qo as ClassicQuizLeaderboardFilters,We as ClassicQuizLeaderboardMeta,Go as ClassicQuizOptionModel,Tc as ClassicQuizParticipationBodyModel,Uo as ClassicQuizParticipationModel,Vo as ClassicQuizParticipationQuestionModel,Ho as ClassicQuizParticipationsFilters,ko as ClassicQuizQuestionModel,zo as ClassicQuizQuestionsReportModel,Qe as ClassicQuizRankFilters,Qo as ClassicQuizRankModel,$o as ClassicQuizUserParticipationModel,Wo as ClassicQuizUserRank,Rc as ClassicQuizUserRankModel,Fc as ClassicQuizzesLeaderboardModel,Ec as ClassicQuizzesModel,ce as ClassicQuizzesStats,bo as ClientBadges,Mo as ClientBadgesV2,qr as CompetitionBasicModel,_i as CompetitionFilters,Qr as CompetitionFullModel,J as CompletedModel,ec as ContentModel,nn as ContestWinners,Ct as ContextModel,vs as CornersFixtureModel,Ut as CorrectScoreFixtureModel,fi as CreateActivityRequestBody,ac as CreatePostParamBody,va as DetailedProfileModel,Na as DictionaryModel,wr as DiscussionModel,ue as DiscussionStats,er as DiscussionsBadgeRequirements,ir as DiscussionsBadgesValue,ka as DiscussionsConfigModel,Ar as DiscussionsFilters,Fl as DoubleChanceEnum,Os as DoubleChanceFixtureModel,Ke as EitherOrBasicModel,Ko as EitherOrFilters,jo as EitherOrFullModel,Jo as EitherOrParticipationModel,ts as EitherOrParticipationRequestFullModel,Zo as EitherOrParticipationRequestModel,is as EitherOrParticipationStepsModel,Ei as EitherOrParticipationStepsOptionModel,Yo as EitherOrPointsModel,as as EitherOrResultsBreakdownModel,rs as EitherOrResultsModel,os as EitherOrResultsStandingsModel,de as EitherOrStats,Xo as EitherOrStatsModel,Sc as EitherOrsModel,gc as EntitiesFollows,yc as EntitiesFollowsFilters,zi as EnvironmentEnum,C as ErrorCodes,Hp as ErrorHandlingModeEnum,x as ErrorMessages,A as ErrorStatuses,xr as EventGameFilters,sc as EventGameFixtureEnumModel,nc as EventGameFixtureNumberModel,rc as EventGameFixtures,At as EventGameFixturesModel,Fa as EventGameModel,Xp as EventGameOutcomeTypeEnum,Ot as EventGamePredictionFixturesModel,Ea as EventGamePredictionModel,oc as EventGamePredictionRequestBody,Hu as EventGamePredictionStatusEnum,Lr as EventGamePredictionsFilters,Sa as EventGamePredictionsModel,Dr as EventGameRankingsFilters,Ra as EventGameRankingsModel,we as EventGameTiebreaker,Ta as EventGameTiebreakerModel,Pa as EventGamesModel,Ed as FansUnitedSDK,dc as FansUnitedSDKModel,Wt as FansUnitedSdkFetchException,xe as FantasyCoefficientsModel,lr as FantasyConfigModel,pr as FantasyMultipliersModel,Nr as FantasyPlayerDetailedStatsMetaModel,kr as FantasyPlayerDetailedStatsModel,Gr as FantasyPlayerStatsModel,Vr as FantasyPlayersMetaModel,Le as FantasyPlayersModel,Hr as FantasyPlayersPointsModel,ke as FantasyPredictionRequestBody,Ro as FiltersMetaModel,an as FixturesGamesModel,Lo as FixturesMatchQuizModel,Rs as FixturesPredictionModel,Ye as FixturesResponseModel,on as FixturesTopXModel,Ii as FollowFilters,bi as FollowModel,Oa as FollowStatusModel,Aa as FollowersModel,Ca as FollowingModel,Xa as FootballBadgeRequirements,Ja as FootballBadgesValue,Wr as FootballCountryModel,su as FootballMatchStatusEnum,Yt as FootballPaginationModel,Zs as FullInterestModel,Da as FullnessProfile,Wa as GameBadgeRequirements,Ka as GameBadgesValue,si as GameByIdModel,Do as GameMarketsResults,Xt as GameModel,mi as GamePredictionsStats,sn as GameResultsModel,ft as GameStatusEnum,ja as GamesBadgeRequirements,Ya as GamesBadgesValue,nt as GamesFilters,Tt as GamesListModel,Pt as GamesMatchQuizListModel,Vt as GamesTopXListModel,nr as GeneralBadgesValue,Oe as GeneralRequirementModel,Sl as HalfTimeFullTimeEnum,Ls as HalfTimeFullTimeFixtureModel,Io as HighestSuccessRateFilters,Eo as HighestSuccessRateModel,N as IdSchemaEnum,W as ImagesModel,Js as InterestModel,ai as InvitationFilters,Fn as LangEnum,xa as LeadModel,Uc as LeadRequestBody,bc as LeaderboardLeagueResponse,$e as LeaderboardModel,Mc as LeaderboardResponseModel,wo as LeagueLeaderboardFilters,He as LeagueLeaderboardMetaModel,Ve as LineupsModel,yo as ListContentFilters,cr as ListContentModel,wn as ListContentResponseModel,Ga as LoyaltyConfigModel,rr as LoyaltyConfigModelV2,_o as LoyaltyFilters,Dt as LoyaltyMeta,fo as MappingModel,go as MappingResponseModel,at as MarketEnum,Oc as MarketsConfigModel,Kr as MatchBasicModel,ti as MatchCorrectScoreMarketResultModel,gt as MatchFilters,jr as MatchFullModel,Vs as MatchMarketsResultsModel,Ms as MatchOddsFilters,ru as MatchOddsMarketEnum,Is as MatchOddsMarketModel,ws as MatchOddsMarketScopeModel,_s as MatchOddsMarketSelectionModel,Ps as MatchOddsMarketTypeModel,Es as MatchOddsModel,Us as MatchPlayerMarketResultModel,Fe as MatchQuizConfigModel,X as MatchStatus,$s as MatchSummaryModel,k as MetaFootballModel,es as MiniGameImages,Za as MiniGamesBadgeRequirements,tr as MiniGamesBadgesValue,kt as MiniGamesContext,Gt as MiniGamesContextTag,Nt as MiniGamesFilters,Mr as MyChallengesFilters,Ws as MyLeaguesFilters,L as NoYesModel,au as OddFormatEnum,eu as OddTypeEnum,Rl as OneXTwoEnum,Bs as OneXTwoFixtureModel,zu as OutcomeEnum,Je as OverCornersFixtureModel,Ze as OverGoalsFixtureModel,sa as OwnActivityFilters,ta as PaginationActivities,Y as PaginationFootballProperties,Dc as PastTemplateModel,Ns as PenaltyMatchFixtureModel,je as PersonalityQuizBasicModel,us as PersonalityQuizFilters,Ri as PersonalityQuizFullModel,cs as PersonalityQuizOptionModel,Cc as PersonalityQuizParticipationBodyModel,ds as PersonalityQuizParticipationModel,ms as PersonalityQuizParticipationQuestionModel,hs as PersonalityQuizPersonaPercentsModel,ps as PersonalityQuizPersonaPointsModel,ls as PersonalityQuizQuestionModel,ns as PersonalityQuizResultsModel,vc as PersonalityQuizzesModel,lc as PlayerAssetsModel,to as PlayerBasicModel,Ge as PlayerDetailedPointsModel,Br as PlayerDetailedStatsFilters,$r as PlayerDetailedStatsModel,Ti as PlayerFilters,st as PlayerFixtureModel,eo as PlayerFullModel,pc as PlayerMarketResultModel,zr as PlayerPointsModel,ro as PlayerShortModel,io as PlayerSquadModel,Ue as PlayerStatsMatchModel,Zr as PlayerStatsModel,Ur as PlayersPointsFilters,Ic as Points,Ua as PointsModel,wc as PointsValueModel,fc as PollBadgesValue,pi as PollBasicModel,pn as PollFullModel,cn as PollOptionModel,Ht as PollVoteBasicModel,un as PollVoteFullModel,li as PollsFilters,mn as PollsModel,hn as PollsUserVotesModel,Ne as PostByIdBasicModel,_r as PostByIdFullModel,Pr as PostCreateModel,Tr as PostsCountDiscussionModel,Er as PostsDiscussionBasicModel,jt as PostsFilters,Rr as PostsFullModel,Lt as PostsMetaModel,Fr as PostsModel,Ce as PotmBadgesValue,bn as PotmResultsMetaModel,In as PotmResultsModel,Mn as PotmResultsResponseModel,fn as PotmUserVotesFilters,yn as PotmUserVotesModel,gn as PotmUserVotesResponseModel,xo as PredictionMatchQuizModel,ei as PredictionRequestModel,Fi as PredictionResponseModel,rn as PredictionTopXModel,V as PredictionsFilters,Hs as PredictionsModel,he as PredictionsStats,qa as PredictorBadgeRequirements,Qa as PredictorBadgesValue,ve as PredictorConfigModel,ci as PreferenceMappingModel,hc as PreferenceModel,De as PrivateLeagueBasicCreateModel,Be as PrivateLeagueBasicUpdateRequestBody,Ys as PrivateLeagueCreateModel,Ks as PrivateLeagueFilters,qs as PrivateLeagueFullModel,ii as PrivateLeagueModel,Bc as PrivateLeagueParamCreateBody,Nc as PrivateLeagueParamUpdateBody,ri as PrivateLeaguePostsFilters,Qs as PrivateLeaguePredictionModel,oi as PrivateLeaguePredictionsFilters,kc as PrivateLeaguePredictionsModel,js as PrivateLeagueRankingsModel,Xs as PrivateLeagueUpdateModel,Gc as PrivateLeaguesModel,Ba as ProfileCountryModel,_e as ProfileModel,Xi as ProfileStatsModel,Po as RankingsFilters,So as RankingsModel,Sr as ReactionModel,Gs as RedCardFixtureModel,z as RelatedEntityRelationship,vr as ReportModel,xt as RequirementModel,Xe as ResultModel,ss as ResultsSummaryModel,Re as RewardsModel,Ae as RewardsModelV2,mc as SDKConfiguraitonModel,iu as ScopeTypeEnum,Xr as ScoresModel,po as SearchFilters,lo as SearchModel,Ts as SelectionProviderInfoModel,dn as SinglePollVoteModel,Ji as SinglePredictionsBreakdown,me as SinglePredictionsStats,h as StandardFansUnitedException,Ie as StandingGameMetaModel,Ma as StandingGameMetaParticipantsModel,ya as StandingGameModel,Ia as StandingGamePredictionModel,wa as StandingGamePredictionsModel,en as StandingGameRankingsFilters,_a as StandingGameRankingsModel,tn as StandingGamesFilters,ba as StandingGamesModel,Yr as StatsModel,rl as StatusEnum,Zi as SuccessRatePercent,Va as SuccessRateScopeModel,Yi as SuccessRates,Qt as SummarizedBreakdown,ur as TagsModel,oo as TeamBasicModel,so as TeamColors,Pi as TeamFilters,cc as TeamFormModel,no as TeamFullModel,_c as TemplateBreakdownModel,vo as TemplateBreakdownPointsModel,Co as TemplateByIdModel,To as TemplateFilters,Oo as TemplateGroupFilter,Ao as TemplateGroups,Fo as TemplateMeta,Bt as TemplateModel,bt as TiebreakerModel,Pc as TiersModel,yt as TimeTiebreaker,Jr as TimelineModel,Lc as TopCorrectScoresModel,Or as TopDiscussionsFilters,ao as TopPlayerModel,Se as TopXConfigModel,ni as TopXPredictionRequestModel,$u as UserActionsEnum,na as UserActivityFilters,Ha as UserDataConfigModel,ln as UserListWinners,ks as ValueAndPlayerId,ot as ValueBoolean,Ss as ValueCorners,Cs as ValueCorrectScore,As as ValueDoubleChance,xs as ValueHalfTimeFullTime,Ds as ValueOneXTwo,Cr as VersionsModel,ar as VotingBadgeRequirements,$a as VotingBadgesValue};
4
4
  //# sourceMappingURL=index.js.map