fansunited-sdk-esm 1.1.5 → 1.1.6

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,3 +1,3 @@
1
- var _o=Object.create;var Dr=Object.defineProperty;var Oo=Object.getOwnPropertyDescriptor;var xo=Object.getOwnPropertyNames;var Ao=Object.getPrototypeOf,Bo=Object.prototype.hasOwnProperty;var No=o=>Dr(o,"__esModule",{value:!0});var h=(o,e)=>()=>(e||o((e={exports:{}}).exports,e),e.exports);var Lo=(o,e,t,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of xo(e))!Bo.call(o,i)&&(t||i!=="default")&&Dr(o,i,{get:()=>e[i],enumerable:!(r=Oo(e,i))||r.enumerable});return o},be=(o,e)=>Lo(No(Dr(o!=null?_o(Ao(o)):{},"default",!e&&o&&o.__esModule?{get:()=>o.default,enumerable:!0}:{value:o,enumerable:!0})),o);var $r=h((Ba,fi)=>{"use strict";fi.exports=function(e,t){return function(){for(var i=new Array(arguments.length),a=0;a<i.length;a++)i[a]=arguments[a];return e.apply(t,i)}}});var b=h((Na,Mi)=>{"use strict";var Go=$r(),K=Object.prototype.toString;function Hr(o){return K.call(o)==="[object Array]"}function kr(o){return typeof o=="undefined"}function Uo(o){return o!==null&&!kr(o)&&o.constructor!==null&&!kr(o.constructor)&&typeof o.constructor.isBuffer=="function"&&o.constructor.isBuffer(o)}function Vo(o){return K.call(o)==="[object ArrayBuffer]"}function Do(o){return typeof FormData!="undefined"&&o instanceof FormData}function $o(o){var e;return typeof ArrayBuffer!="undefined"&&ArrayBuffer.isView?e=ArrayBuffer.isView(o):e=o&&o.buffer&&o.buffer instanceof ArrayBuffer,e}function Ho(o){return typeof o=="string"}function ko(o){return typeof o=="number"}function yi(o){return o!==null&&typeof o=="object"}function Le(o){if(K.call(o)!=="[object Object]")return!1;var e=Object.getPrototypeOf(o);return e===null||e===Object.prototype}function qo(o){return K.call(o)==="[object Date]"}function jo(o){return K.call(o)==="[object File]"}function Xo(o){return K.call(o)==="[object Blob]"}function gi(o){return K.call(o)==="[object Function]"}function Ko(o){return yi(o)&&gi(o.pipe)}function Yo(o){return typeof URLSearchParams!="undefined"&&o instanceof URLSearchParams}function Wo(o){return o.trim?o.trim():o.replace(/^\s+|\s+$/g,"")}function zo(){return typeof navigator!="undefined"&&(navigator.product==="ReactNative"||navigator.product==="NativeScript"||navigator.product==="NS")?!1:typeof window!="undefined"&&typeof document!="undefined"}function qr(o,e){if(!(o===null||typeof o=="undefined"))if(typeof o!="object"&&(o=[o]),Hr(o))for(var t=0,r=o.length;t<r;t++)e.call(null,o[t],t,o);else for(var i in o)Object.prototype.hasOwnProperty.call(o,i)&&e.call(null,o[i],i,o)}function jr(){var o={};function e(i,a){Le(o[a])&&Le(i)?o[a]=jr(o[a],i):Le(i)?o[a]=jr({},i):Hr(i)?o[a]=i.slice():o[a]=i}for(var t=0,r=arguments.length;t<r;t++)qr(arguments[t],e);return o}function Qo(o,e,t){return qr(e,function(i,a){t&&typeof i=="function"?o[a]=Go(i,t):o[a]=i}),o}function Jo(o){return o.charCodeAt(0)===65279&&(o=o.slice(1)),o}Mi.exports={isArray:Hr,isArrayBuffer:Vo,isBuffer:Uo,isFormData:Do,isArrayBufferView:$o,isString:Ho,isNumber:ko,isObject:yi,isPlainObject:Le,isUndefined:kr,isDate:qo,isFile:jo,isBlob:Xo,isFunction:gi,isStream:Ko,isURLSearchParams:Yo,isStandardBrowserEnv:zo,forEach:qr,merge:jr,extend:Qo,trim:Wo,stripBOM:Jo}});var Xr=h((La,bi)=>{"use strict";var J=b();function wi(o){return encodeURIComponent(o).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}bi.exports=function(e,t,r){if(!t)return e;var i;if(r)i=r(t);else if(J.isURLSearchParams(t))i=t.toString();else{var a=[];J.forEach(t,function(p,u){p===null||typeof p=="undefined"||(J.isArray(p)?u=u+"[]":p=[p],J.forEach(p,function(c){J.isDate(c)?c=c.toISOString():J.isObject(c)&&(c=JSON.stringify(c)),a.push(wi(u)+"="+wi(c))}))}),i=a.join("&")}if(i){var s=e.indexOf("#");s!==-1&&(e=e.slice(0,s)),e+=(e.indexOf("?")===-1?"?":"&")+i}return e}});var Ri=h((Ga,Ii)=>{"use strict";var Zo=b();function Ge(){this.handlers=[]}Ge.prototype.use=function(e,t,r){return this.handlers.push({fulfilled:e,rejected:t,synchronous:r?r.synchronous:!1,runWhen:r?r.runWhen:null}),this.handlers.length-1};Ge.prototype.eject=function(e){this.handlers[e]&&(this.handlers[e]=null)};Ge.prototype.forEach=function(e){Zo.forEach(this.handlers,function(r){r!==null&&e(r)})};Ii.exports=Ge});var Pi=h((Ua,Fi)=>{"use strict";var ea=b();Fi.exports=function(e,t){ea.forEach(e,function(i,a){a!==t&&a.toUpperCase()===t.toUpperCase()&&(e[t]=i,delete e[a])})}});var Kr=h((Va,vi)=>{"use strict";vi.exports=function(e,t,r,i,a){return e.config=t,r&&(e.code=r),e.request=i,e.response=a,e.isAxiosError=!0,e.toJSON=function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:this.config,code:this.code,status:this.response&&this.response.status?this.response.status:null}},e}});var Yr=h((Da,Si)=>{"use strict";var ta=Kr();Si.exports=function(e,t,r,i,a){var s=new Error(e);return ta(s,t,r,i,a)}});var Ei=h(($a,Ti)=>{"use strict";var ra=Yr();Ti.exports=function(e,t,r){var i=r.config.validateStatus;!r.status||!i||i(r.status)?e(r):t(ra("Request failed with status code "+r.status,r.config,null,r.request,r))}});var _i=h((Ha,Ci)=>{"use strict";var Ue=b();Ci.exports=Ue.isStandardBrowserEnv()?function(){return{write:function(t,r,i,a,s,n){var p=[];p.push(t+"="+encodeURIComponent(r)),Ue.isNumber(i)&&p.push("expires="+new Date(i).toGMTString()),Ue.isString(a)&&p.push("path="+a),Ue.isString(s)&&p.push("domain="+s),n===!0&&p.push("secure"),document.cookie=p.join("; ")},read:function(t){var r=document.cookie.match(new RegExp("(^|;\\s*)("+t+")=([^;]*)"));return r?decodeURIComponent(r[3]):null},remove:function(t){this.write(t,"",Date.now()-864e5)}}}():function(){return{write:function(){},read:function(){return null},remove:function(){}}}()});var xi=h((ka,Oi)=>{"use strict";Oi.exports=function(e){return/^([a-z][a-z\d\+\-\.]*:)?\/\//i.test(e)}});var Bi=h((qa,Ai)=>{"use strict";Ai.exports=function(e,t){return t?e.replace(/\/+$/,"")+"/"+t.replace(/^\/+/,""):e}});var Li=h((ja,Ni)=>{"use strict";var ia=xi(),oa=Bi();Ni.exports=function(e,t){return e&&!ia(t)?oa(e,t):t}});var Ui=h((Xa,Gi)=>{"use strict";var Wr=b(),aa=["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"];Gi.exports=function(e){var t={},r,i,a;return e&&Wr.forEach(e.split(`
2
- `),function(n){if(a=n.indexOf(":"),r=Wr.trim(n.substr(0,a)).toLowerCase(),i=Wr.trim(n.substr(a+1)),r){if(t[r]&&aa.indexOf(r)>=0)return;r==="set-cookie"?t[r]=(t[r]?t[r]:[]).concat([i]):t[r]=t[r]?t[r]+", "+i:i}}),t}});var $i=h((Ka,Di)=>{"use strict";var Vi=b();Di.exports=Vi.isStandardBrowserEnv()?function(){var e=/(msie|trident)/i.test(navigator.userAgent),t=document.createElement("a"),r;function i(a){var s=a;return e&&(t.setAttribute("href",s),s=t.href),t.setAttribute("href",s),{href:t.href,protocol:t.protocol?t.protocol.replace(/:$/,""):"",host:t.host,search:t.search?t.search.replace(/^\?/,""):"",hash:t.hash?t.hash.replace(/^#/,""):"",hostname:t.hostname,port:t.port,pathname:t.pathname.charAt(0)==="/"?t.pathname:"/"+t.pathname}}return r=i(window.location.href),function(s){var n=Vi.isString(s)?i(s):s;return n.protocol===r.protocol&&n.host===r.host}}():function(){return function(){return!0}}()});var Ie=h((Ya,Hi)=>{"use strict";function zr(o){this.message=o}zr.prototype.toString=function(){return"Cancel"+(this.message?": "+this.message:"")};zr.prototype.__CANCEL__=!0;Hi.exports=zr});var Jr=h((Wa,ki)=>{"use strict";var Ve=b(),sa=Ei(),na=_i(),la=Xr(),pa=Li(),ca=Ui(),ma=$i(),Qr=Yr(),ua=Re(),da=Ie();ki.exports=function(e){return new Promise(function(r,i){var a=e.data,s=e.headers,n=e.responseType,p;function u(){e.cancelToken&&e.cancelToken.unsubscribe(p),e.signal&&e.signal.removeEventListener("abort",p)}Ve.isFormData(a)&&delete s["Content-Type"];var l=new XMLHttpRequest;if(e.auth){var c=e.auth.username||"",f=e.auth.password?unescape(encodeURIComponent(e.auth.password)):"";s.Authorization="Basic "+btoa(c+":"+f)}var N=pa(e.baseURL,e.url);l.open(e.method.toUpperCase(),la(N,e.params,e.paramsSerializer),!0),l.timeout=e.timeout;function di(){if(!!l){var C="getAllResponseHeaders"in l?ca(l.getAllResponseHeaders()):null,Q=!n||n==="text"||n==="json"?l.responseText:l.response,X={data:Q,status:l.status,statusText:l.statusText,headers:C,config:e,request:l};sa(function(Vr){r(Vr),u()},function(Vr){i(Vr),u()},X),l=null}}if("onloadend"in l?l.onloadend=di:l.onreadystatechange=function(){!l||l.readyState!==4||l.status===0&&!(l.responseURL&&l.responseURL.indexOf("file:")===0)||setTimeout(di)},l.onabort=function(){!l||(i(Qr("Request aborted",e,"ECONNABORTED",l)),l=null)},l.onerror=function(){i(Qr("Network Error",e,null,l)),l=null},l.ontimeout=function(){var Q=e.timeout?"timeout of "+e.timeout+"ms exceeded":"timeout exceeded",X=e.transitional||ua.transitional;e.timeoutErrorMessage&&(Q=e.timeoutErrorMessage),i(Qr(Q,e,X.clarifyTimeoutError?"ETIMEDOUT":"ECONNABORTED",l)),l=null},Ve.isStandardBrowserEnv()){var hi=(e.withCredentials||ma(N))&&e.xsrfCookieName?na.read(e.xsrfCookieName):void 0;hi&&(s[e.xsrfHeaderName]=hi)}"setRequestHeader"in l&&Ve.forEach(s,function(Q,X){typeof a=="undefined"&&X.toLowerCase()==="content-type"?delete s[X]:l.setRequestHeader(X,Q)}),Ve.isUndefined(e.withCredentials)||(l.withCredentials=!!e.withCredentials),n&&n!=="json"&&(l.responseType=e.responseType),typeof e.onDownloadProgress=="function"&&l.addEventListener("progress",e.onDownloadProgress),typeof e.onUploadProgress=="function"&&l.upload&&l.upload.addEventListener("progress",e.onUploadProgress),(e.cancelToken||e.signal)&&(p=function(C){!l||(i(!C||C&&C.type?new da("canceled"):C),l.abort(),l=null)},e.cancelToken&&e.cancelToken.subscribe(p),e.signal&&(e.signal.aborted?p():e.signal.addEventListener("abort",p))),a||(a=null),l.send(a)})}});var Re=h((za,Xi)=>{"use strict";var g=b(),qi=Pi(),ha=Kr(),fa={"Content-Type":"application/x-www-form-urlencoded"};function ji(o,e){!g.isUndefined(o)&&g.isUndefined(o["Content-Type"])&&(o["Content-Type"]=e)}function ya(){var o;return typeof XMLHttpRequest!="undefined"?o=Jr():typeof process!="undefined"&&Object.prototype.toString.call(process)==="[object process]"&&(o=Jr()),o}function ga(o,e,t){if(g.isString(o))try{return(e||JSON.parse)(o),g.trim(o)}catch(r){if(r.name!=="SyntaxError")throw r}return(t||JSON.stringify)(o)}var De={transitional:{silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},adapter:ya(),transformRequest:[function(e,t){return qi(t,"Accept"),qi(t,"Content-Type"),g.isFormData(e)||g.isArrayBuffer(e)||g.isBuffer(e)||g.isStream(e)||g.isFile(e)||g.isBlob(e)?e:g.isArrayBufferView(e)?e.buffer:g.isURLSearchParams(e)?(ji(t,"application/x-www-form-urlencoded;charset=utf-8"),e.toString()):g.isObject(e)||t&&t["Content-Type"]==="application/json"?(ji(t,"application/json"),ga(e)):e}],transformResponse:[function(e){var t=this.transitional||De.transitional,r=t&&t.silentJSONParsing,i=t&&t.forcedJSONParsing,a=!r&&this.responseType==="json";if(a||i&&g.isString(e)&&e.length)try{return JSON.parse(e)}catch(s){if(a)throw s.name==="SyntaxError"?ha(s,this,"E_JSON_PARSE"):s}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*"}}};g.forEach(["delete","get","head"],function(e){De.headers[e]={}});g.forEach(["post","put","patch"],function(e){De.headers[e]=g.merge(fa)});Xi.exports=De});var Yi=h((Qa,Ki)=>{"use strict";var Ma=b(),wa=Re();Ki.exports=function(e,t,r){var i=this||wa;return Ma.forEach(r,function(s){e=s.call(i,e,t)}),e}});var Zr=h((Ja,Wi)=>{"use strict";Wi.exports=function(e){return!!(e&&e.__CANCEL__)}});var Ji=h((Za,Qi)=>{"use strict";var zi=b(),ei=Yi(),ba=Zr(),Ia=Re(),Ra=Ie();function ti(o){if(o.cancelToken&&o.cancelToken.throwIfRequested(),o.signal&&o.signal.aborted)throw new Ra("canceled")}Qi.exports=function(e){ti(e),e.headers=e.headers||{},e.data=ei.call(e,e.data,e.headers,e.transformRequest),e.headers=zi.merge(e.headers.common||{},e.headers[e.method]||{},e.headers),zi.forEach(["delete","get","head","post","put","patch","common"],function(i){delete e.headers[i]});var t=e.adapter||Ia.adapter;return t(e).then(function(i){return ti(e),i.data=ei.call(e,i.data,i.headers,e.transformResponse),i},function(i){return ba(i)||(ti(e),i&&i.response&&(i.response.data=ei.call(e,i.response.data,i.response.headers,e.transformResponse))),Promise.reject(i)})}});var ri=h((es,Zi)=>{"use strict";var R=b();Zi.exports=function(e,t){t=t||{};var r={};function i(l,c){return R.isPlainObject(l)&&R.isPlainObject(c)?R.merge(l,c):R.isPlainObject(c)?R.merge({},c):R.isArray(c)?c.slice():c}function a(l){if(R.isUndefined(t[l])){if(!R.isUndefined(e[l]))return i(void 0,e[l])}else return i(e[l],t[l])}function s(l){if(!R.isUndefined(t[l]))return i(void 0,t[l])}function n(l){if(R.isUndefined(t[l])){if(!R.isUndefined(e[l]))return i(void 0,e[l])}else return i(void 0,t[l])}function p(l){if(l in t)return i(e[l],t[l]);if(l in e)return i(void 0,e[l])}var u={url:s,method:s,data:s,baseURL:n,transformRequest:n,transformResponse:n,paramsSerializer:n,timeout:n,timeoutMessage:n,withCredentials:n,adapter:n,responseType:n,xsrfCookieName:n,xsrfHeaderName:n,onUploadProgress:n,onDownloadProgress:n,decompress:n,maxContentLength:n,maxBodyLength:n,transport:n,httpAgent:n,httpsAgent:n,cancelToken:n,socketPath:n,responseEncoding:n,validateStatus:p};return R.forEach(Object.keys(e).concat(Object.keys(t)),function(c){var f=u[c]||a,N=f(c);R.isUndefined(N)&&f!==p||(r[c]=N)}),r}});var ii=h((ts,eo)=>{eo.exports={version:"0.24.0"}});var io=h((rs,ro)=>{"use strict";var Fa=ii().version,oi={};["object","boolean","number","function","string","symbol"].forEach(function(o,e){oi[o]=function(r){return typeof r===o||"a"+(e<1?"n ":" ")+o}});var to={};oi.transitional=function(e,t,r){function i(a,s){return"[Axios v"+Fa+"] Transitional option '"+a+"'"+s+(r?". "+r:"")}return function(a,s,n){if(e===!1)throw new Error(i(s," has been removed"+(t?" in "+t:"")));return t&&!to[s]&&(to[s]=!0,console.warn(i(s," has been deprecated since v"+t+" and will be removed in the near future"))),e?e(a,s,n):!0}};function Pa(o,e,t){if(typeof o!="object")throw new TypeError("options must be an object");for(var r=Object.keys(o),i=r.length;i-- >0;){var a=r[i],s=e[a];if(s){var n=o[a],p=n===void 0||s(n,a,o);if(p!==!0)throw new TypeError("option "+a+" must be "+p);continue}if(t!==!0)throw Error("Unknown option "+a)}}ro.exports={assertOptions:Pa,validators:oi}});var po=h((is,lo)=>{"use strict";var oo=b(),va=Xr(),ao=Ri(),so=Ji(),$e=ri(),no=io(),Z=no.validators;function Fe(o){this.defaults=o,this.interceptors={request:new ao,response:new ao}}Fe.prototype.request=function(e){typeof e=="string"?(e=arguments[1]||{},e.url=arguments[0]):e=e||{},e=$e(this.defaults,e),e.method?e.method=e.method.toLowerCase():this.defaults.method?e.method=this.defaults.method.toLowerCase():e.method="get";var t=e.transitional;t!==void 0&&no.assertOptions(t,{silentJSONParsing:Z.transitional(Z.boolean),forcedJSONParsing:Z.transitional(Z.boolean),clarifyTimeoutError:Z.transitional(Z.boolean)},!1);var r=[],i=!0;this.interceptors.request.forEach(function(f){typeof f.runWhen=="function"&&f.runWhen(e)===!1||(i=i&&f.synchronous,r.unshift(f.fulfilled,f.rejected))});var a=[];this.interceptors.response.forEach(function(f){a.push(f.fulfilled,f.rejected)});var s;if(!i){var n=[so,void 0];for(Array.prototype.unshift.apply(n,r),n=n.concat(a),s=Promise.resolve(e);n.length;)s=s.then(n.shift(),n.shift());return s}for(var p=e;r.length;){var u=r.shift(),l=r.shift();try{p=u(p)}catch(c){l(c);break}}try{s=so(p)}catch(c){return Promise.reject(c)}for(;a.length;)s=s.then(a.shift(),a.shift());return s};Fe.prototype.getUri=function(e){return e=$e(this.defaults,e),va(e.url,e.params,e.paramsSerializer).replace(/^\?/,"")};oo.forEach(["delete","get","head","options"],function(e){Fe.prototype[e]=function(t,r){return this.request($e(r||{},{method:e,url:t,data:(r||{}).data}))}});oo.forEach(["post","put","patch"],function(e){Fe.prototype[e]=function(t,r,i){return this.request($e(i||{},{method:e,url:t,data:r}))}});lo.exports=Fe});var mo=h((os,co)=>{"use strict";var Sa=Ie();function ee(o){if(typeof o!="function")throw new TypeError("executor must be a function.");var e;this.promise=new Promise(function(i){e=i});var t=this;this.promise.then(function(r){if(!!t._listeners){var i,a=t._listeners.length;for(i=0;i<a;i++)t._listeners[i](r);t._listeners=null}}),this.promise.then=function(r){var i,a=new Promise(function(s){t.subscribe(s),i=s}).then(r);return a.cancel=function(){t.unsubscribe(i)},a},o(function(i){t.reason||(t.reason=new Sa(i),e(t.reason))})}ee.prototype.throwIfRequested=function(){if(this.reason)throw this.reason};ee.prototype.subscribe=function(e){if(this.reason){e(this.reason);return}this._listeners?this._listeners.push(e):this._listeners=[e]};ee.prototype.unsubscribe=function(e){if(!!this._listeners){var t=this._listeners.indexOf(e);t!==-1&&this._listeners.splice(t,1)}};ee.source=function(){var e,t=new ee(function(i){e=i});return{token:t,cancel:e}};co.exports=ee});var ho=h((as,uo)=>{"use strict";uo.exports=function(e){return function(r){return e.apply(null,r)}}});var yo=h((ss,fo)=>{"use strict";fo.exports=function(e){return typeof e=="object"&&e.isAxiosError===!0}});var wo=h((ns,ai)=>{"use strict";var go=b(),Ta=$r(),He=po(),Ea=ri(),Ca=Re();function Mo(o){var e=new He(o),t=Ta(He.prototype.request,e);return go.extend(t,He.prototype,e),go.extend(t,e),t.create=function(i){return Mo(Ea(o,i))},t}var O=Mo(Ca);O.Axios=He;O.Cancel=Ie();O.CancelToken=mo();O.isCancel=Zr();O.VERSION=ii().version;O.all=function(e){return Promise.all(e)};O.spread=ho();O.isAxiosError=yo();ai.exports=O;ai.exports.default=O});var te=h((ls,bo)=>{bo.exports=wo()});var ni=be(te());var si=o=>{let e=250,t=[],r=0;return t[r]=[],o.forEach(i=>{t[r].length<=e?t[r].push(i):(r++,t[r]=[i])}),t},ke=o=>{let e=[],t=200;for(;o.length>t-1;){let r=o.splice(0,t-1);e.push(r)}return e.push(o),e},x=(o,e)=>{let t="";return o==="prod"||o==="sandbox"?t={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"}[e]:t={profile:"http://localhost:8010",football:"http://locahost:8080",idMapping:"http://localhost:8030",predictor:"http://localhost:8040",client:"http://localhost:8080"}[e],t},U=o=>o.filter((t,r,i)=>r===i.indexOf(t));var qe=class{id=null;name=null;avatar=null;gender=null;country=null;birthDate=null;interests=[]};var je=class{profilesFromResponse=e=>e?e.map(t=>this.fullProfileFromResponse(t)):null;fullProfileFromResponse=e=>{let t=new qe;return t.avatar=e.avatar,t.birthDate=e.birth_date,t.country=e.country,t.gender=e.gender,t.id=e.id,t.interests=e.interests,t.name=e.name,t}};var Xe=class{avatar=null;followingId=null;name=null;profileId=null};var Ke=class{followingFromResponse=e=>e.map(t=>this.remapResponse(t));remapResponse=e=>{let t=new Xe;return t.avatar=e.avatar,t.followingId=e.following_id,t.name=e.name,t.profileId=e.profile_id,t}};var Ye=class{avatar=null;followerId=null;name=null;profileId=null};var We=class{followersFromResponse=e=>e.map(t=>this.remapResponse(t));remapResponse=e=>{let t=new Ye;return t.avatar=e.avatar,t.followerId=e.follower_id,t.name=e.name,t.profileId=e.profile_id,t}};var Pe=class{profile_ids=[]};var _a="/countries",S="/profile",Io="/profiles",ze=class{instanceAuth=null;instance=null;apiSignInUrl=null;profileRemapper=null;followingRemapper=null;followersRemapper=null;constructor(e){let t=x(e.environment,"profile");this.apiSignInUrl=`?key=${e.apiKey}&client_id=${e.clientId}&lang=${e.lang}`,this.instanceAuth=ni.default.create({baseURL:t,headers:{Authorization:`Bearer ${e.authProvider.getIdToken()}`,"Content-Type":"application/json"}}),this.instanceAuth.interceptors.request.use(r=>r,r=>{Promise.reject(r)}),this.instanceAuth.interceptors.response.use(r=>r,r=>{let i=r.config;if((r.response.status===403||r.response.status===401)&&!i._retry){i._retry=!0;let a=e.authProvider.getIdToken();return i.headers.Authorization=`Bearer ${a}`,this.instanceAuth(i)}return Promise.reject(r)}),this.instance=ni.default.create({baseURL:t,headers:{"Content-Type":"application/json"}}),this.profileRemapper=new je,this.followingRemapper=new Ke,this.followersRemapper=new We}getCountries=async()=>{try{return(await this.instance.get(`${_a}${this.apiSignInUrl}`)).data.data}catch(e){throw console.warn("There was a problem fetching the countries:",e),e.response}};getProfile=async e=>{let t=`${S}${this.apiSignInUrl}`;if(e){t=`${Io}/${e}${this.apiSignInUrl}`;try{let r=await this.instance.get(t);return this.profileRemapper.fullProfileFromResponse(r.data.data)}catch(r){throw console.warn(`There was a problem fetching the following profile: ${e}`,r),r.response}}else try{let r=await this.instanceAuth.get(t);return this.profileRemapper.fullProfileFromResponse(r.data.data)}catch(r){throw console.warn("There was a problem fetching your profile from API:",r),r.response}};getProfiles=async e=>{try{let t=await this.instance.get(`${Io}${this.apiSignInUrl}&profile_ids=${e.join(",")}`);return this.profileRemapper.profilesFromResponse(t.data.data)}catch(t){throw console.warn(`There was a problem fetching the following profiles: ${e.join(",")}`,t),t.response}};getFollowers=async(e,t)=>{let r=`${S}/followers${this.apiSignInUrl}`;if(e&&!t){r=`${S}/followers${this.apiSignInUrl}${e.constructFilterUrl()}`;try{let i=await this.instanceAuth.get(r);return this.followersRemapper.followersFromResponse(i.data.data)}catch(i){throw console.warn("There was a problem fetching the followers for own profile",i),i.response}}else if(!e&&!t)try{let i=await this.instanceAuth.get(r);return this.followersRemapper.followersFromResponse(i.data.data)}catch(i){throw console.warn("There was a problem fetching the followers for own profile",i),i.response}e&&t?r=`${S}/${t}/followers${this.apiSignInUrl}${e.constructFilterUrl()}`:!e&&t&&(r=`${S}/${t}/followers${this.apiSignInUrl}`);try{let i=await this.instance.get(r);return this.followersRemapper.followersFromResponse(i.data.data)}catch(i){throw console.warn(`There was a problem fetching the followers for profile: ${t}`,i),i.response}};getFollowing=async(e,t)=>{let r=`${S}/following${this.apiSignInUrl}`;if(e&&!t){r=`${S}/following${this.apiSignInUrl}${e.constructFilterUrl()}`;try{let i=await this.instanceAuth.get(r);return this.followingRemapper.followingFromResponse(i.data.data)}catch(i){throw console.warn("There was a problem fetching the followers of own profile",i),i.response}}else if(!e&&!t)try{let i=await this.instanceAuth.get(r);return this.followingRemapper.followingFromResponse(i.data.data)}catch(i){throw console.warn("There was a problem fetching the followers of own profile",i),i.response}e&&t?r=`${S}/${t}/following${this.apiSignInUrl}${e.constructFilterUrl()}`:!e&&t&&(r=`${S}/${t}/following${this.apiSignInUrl}`);try{let i=await this.instance.get(r);return this.followingRemapper.followingFromResponse(i.data.data)}catch(i){throw console.warn(`There was a problem fetching the followers of the following profile: ${t}`,i),i.response}};follow=async e=>{let t=new Pe;t.profile_ids=e;try{let r=await this.instanceAuth.post(`${S}/follow${this.apiSignInUrl}`,JSON.stringify(t));return this.followingRemapper.followingFromResponse(r.data.data)}catch(r){throw console.warn(`There was a problem with POST request for profiles: ${e.join(",")} `,r),r.response}};unfollow=async e=>{let t=new Pe;t.profile_ids=e;try{return await this.instanceAuth.delete(`${S}/follow${this.apiSignInUrl}`,{data:JSON.stringify(t)}),!0}catch(r){throw console.warn(`There was a problem with DELETE request for profiles: ${e.join(",")} `,r),r.response}};updateProfile=async e=>{try{let t=await this.instanceAuth.patch(`${S}${this.apiSignInUrl}`,e);return this.profileRemapper.fullProfileFromResponse(t.data.data)}catch(t){throw console.warn("There was a problem updating the own profile:",t),t.response}}};var L={native:"id",sportradar:"sportradar_id",sportal365:"sportal365_id",enetpulse:"enetpulse_id"};var Ro="FansUnited",Fo={football:{ids:[],countries:[],competitions:[]},profile:{own:{},countries:[],expireAt:0}},V=class{idSchema="";exparationTimeout=600;constructor(e){this.idSchema=e.idSchema,(this.getData()===void 0||this.getData()===null)&&this.setData(Fo)}clearData=()=>{this.setData(Fo)};getEntityById=(e="",t="")=>this.getData().football.ids.find(r=>{let i=L[this.idSchema];return r&&`${r[i]}`===t&&r.resource===e});getEntity=(e,t,r)=>Array.isArray(e)?this.getData().football.ids.filter(i=>{let a=L[r];return i&&e.includes(`${i[a]}`)&&i.resource===t}):this.getData().football.ids.find(i=>{let a=L[r];return i&&`${i[a]}`===e&&i.resource===t});getEntityByNativeId=(e="",t="")=>this.getData().football.ids.find(r=>r&&`${r.id}`===t&&r.resource===e);checkForExistingIdObjs=(e,t)=>{let r=L[t],i={};return Object.keys(e).forEach(a=>{let s=e[a],p=this.getEntity(s,a,t).map(l=>l[r]),u=e[a].filter(l=>!p.includes(l));i[a]=s.map(l=>u.includes(l)?{id:l,exists:!1}:{id:l,exists:!0})}),i};getIdsByType=(e,t,r)=>{let i=L[r],a=L[t],s={};return Object.keys(e).forEach(n=>{let p=e[n],u=[];this.getData().football.ids.forEach(l=>{p.forEach((c,f)=>{c===l[a]&&n===l.resource&&(u[f]=l[i])})}),s[n]=u}),s};addIdMapping=e=>{let t=this.getData();t.football.ids.push(e),this.setData(t)};addIdMappings=e=>{let t=this.getData(),r=t.football.ids;r=[...r,...e],t.football.ids=r,this.setData(t)};setOwnProfile=e=>{let t=this.getData();t.profile.own=e,t.profile.expireAt=Math.floor(Date.now()/1e3)+this.exparationTimeout,this.setData(t)};getOwnProfile=()=>this.getData().profile.own;getProfileCountries=()=>this.getData().profile.countries;setProfileCountries=e=>{let t=this.getData();t.profile.countries=e,this.setData(t)};getFootballCountries=()=>this.getData().football.countries;setFootballCountries=e=>{let t=this.getData();t.football.countries=e,this.setData(t)};getCompetitions=e=>{let t=this.getData();return e?e.competitionSearchFilter(t.football.competitions):t.football.competitions};setCompetitions=e=>{let t=this.getData();t.football.competitions.push(...e),this.setData(t)};getExparationProfile=()=>this.getData().profile.expireAt;getData=()=>JSON.parse(localStorage.getItem(Ro));setData=e=>{localStorage.setItem(Ro,JSON.stringify(e))}};var Po=be(te());var ve={player:"players",team:"teams",homeTeam:"teams",awayTeam:"teams",country:"countries",competition:"competitions",match:"matches"},Qe=class{instance=null;apiSignInUrl="";constructor(e){let t=x(e.environment,"idMapping");this.apiSignInUrl=`?key=${e.apiKey}&client_id=${e.clientId}`,this.instance=Po.default.create({baseURL:t})}getEntityById=(e,t)=>{try{return this.instance.get(`/football${this.apiSignInUrl}&input_provider=${config.idSchema}&${ve[e]}=${t}`)}catch(r){throw console.warn(`There was a problem with id mapping request for the following id:${t}`,r),r.response}};getEntityByIdAndSchema=(e,t,r)=>{try{return this.instance.get(`/football${this.apiSignInUrl}&input_provider=${r}&${ve[e]}=${t}`)}catch(i){throw console.warn(`There was a problem with id mapping request for the following id:${t}`,i),i.response}};getEntityIdsByIdsAndSchema=(e,t,r)=>{try{return this.instance.get(`/football${this.apiSignInUrl}&input_provider=${r}&${ve[e]}=${t.join(",")}`)}catch(i){throw console.warn(`There was a problem with id mapping request for the following ids:${t.join(",")}`,i),i.response}};getEntitiesByIds=(e,t,r)=>{t.sort((s,n)=>s.localeCompare(n));let a=si(t).map(s=>{try{return this.instance.get(`/football${this.apiSignInUrl}&input_provider=${r}&${ve[e]}=${s.join(",")}`)}catch(n){throw console.warn(`There was a problem with id mapping request for the following ids:${s.join(",")}`,n),n.response}});return Promise.all(a).then(s=>{let n=[];return s.forEach(p=>{n.push(...p.data.data)}),n})};getEntitiesByIdObjs=async(e,t)=>{let r=[],i={},a=[];Object.keys(e).forEach(u=>{r.push.apply(r,e[u])});let s=U(r),n=si(s);for(let u of n){let l="";if(Object.keys(e).forEach(c=>{i[c]=[];let f=u.filter(N=>e[c].includes(N));f&&f.length>0&&(i[c]=f)}),Object.keys(i).forEach(c=>{i[c].length>0&&(i[c].sort((f,N)=>f.localeCompare(N)),l+="&",l+=`${ve[c]}=${i[c].join(",")}`)}),l&&l.length>0)try{let c=await this.instance.get(`/football${this.apiSignInUrl}&input_provider=${t||"native"}${l}`);a.push(c.data.data)}catch(c){throw console.warn("There was a problem with id mapping request",c),c.response}else a.push([])}return Array.prototype.concat.apply([],a)}};var Je=class{isBrowser=!1;localStorage=null;https=null;constructor(e){this.isBrowser=typeof window!="undefined",this.localStorage=new V(e),this.https=new Qe(e)}getEntitiesByIds=async(e,t,r)=>{if(this.isBrowser)try{let i=this.localStorage.checkForExistingIdObjs(e,t),a=this.splitForRequestAndExisting(i),s=await this.https.getEntitiesByIdObjs(a.request,t);return this.localStorage.addIdMappings(s),this.localStorage.getIdsByType(e,t,r)}catch(i){return console.warn("There was a problem retrieving the entity ids ",i),Promise.resolve([])}else try{let i=await this.https.getEntitiesByIdObjs(e,t);return Object.keys(e).forEach(a=>{e[a]=i.filter(s=>s.resource===a).map(s=>s[L[r]])}),e}catch(i){return console.warn("There was a problem retrieving the entity ids ",i),Promise.resolve([])}};getEntityById=async(e,t,r)=>{if(this.isBrowser){let i=this.localStorage.getEntity(e,t,r);if(i)return i;{let a=await this.requestEntity(e,t,r);return this.localStorage.addIdMappings(a),a}}else return await this.requestEntity(e,t,r)};splitForRequestAndExisting=e=>{let t={},r={};return Object.keys(e).forEach(i=>{t[i]=e[i].filter(a=>!a.exists).map(a=>a.id),r[i]=e[i].filter(a=>a.exists).map(a=>a.id)}),{existing:r,request:t}};requestEntity=async(e,t,r)=>{try{return e=Array.isArray(e)?e:[e],await this.https.getEntitiesByIds(t,e,r)}catch(i){return console.warn(`There was a problem retrieving the requested entity: ${i}`),null}}};var Ze=o=>{switch(o){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 o}};var et=class{extractedObjIds={};traverse=(e,t)=>(t=Ze(t),Array.isArray(e)?this.traverseArrExtract(e,t):e&&typeof e=="object"&&this.traverseObjExtract(e,t),this.extractedObjIds);traverseArrExtract=(e,t)=>{e&&e.length>0&&e.forEach(r=>{this.traverseObjExtract(r,t)})};traverseObjExtract=(e,t)=>{e&&Object.keys(e).length>0&&Object.keys(e).forEach(r=>{let i=e[r];r==="id"||r==="teamId"?(this.extractedObjIds.hasOwnProperty(t)||(this.extractedObjIds[t]=[]),this.extractedObjIds[t].push(i)):e[r]&&this.traverse(e[r],r)})}};var tt=class{replaceObjIdsIndex=null;remappedIdsObj={};traverse=(e,t,r)=>(t=Ze(t),this.replaceObjIdsIndex===null&&(this.initReplaceObjIdsIndex(r),this.remappedIdsObj=r),Array.isArray(e)?this.traverseArrReplace(e,t):e&&typeof e=="object"&&this.traverseObjReplace(e,t),e);initReplaceObjIdsIndex=e=>{this.replaceObjIdsIndex={},Object.keys(e).forEach(t=>{this.replaceObjIdsIndex[t]=0})};traverseArrReplace=(e,t)=>{e&&e.length>0&&e.forEach(r=>{this.traverseObjReplace(r,t)})};traverseObjReplace=(e,t)=>{e&&Object.keys(e).length>0&&Object.keys(e).forEach(r=>{r==="id"||r==="teamId"?(e[r]=this.remappedIdsObj[t][this.replaceObjIdsIndex[t]],this.replaceObjIdsIndex[t]=this.replaceObjIdsIndex[t]+1):e[r]&&this.traverse(e[r],r,this.remappedIdsObj)})}};var T=class{idSchema="";idMappingFacade=null;constructor(e){this.idSchema=e.idSchema,this.idMappingFacade=new Je(e)}getEntityIdBySchemaId=(e,t)=>this.idMappingFacade.getEntityById(e,t,this.idSchema);remapEntities=async(e,t)=>{let r=JSON.parse(JSON.stringify(e));try{if(this.idSchema!=="native"){let a=new et().traverse(r,t);return this.idMappingFacade.getEntitiesByIds(a,"native",this.idSchema).then(s=>new tt().traverse(r,t,s))}else return e}catch(i){return console.warn(`There was a problem remapping entity: ${t} with inner entity `,i),[]}};getEntityIdsBySchemaId=async(e,t,r)=>{let i={};return i[t]=e,this.idSchema!=="native"?await this.idMappingFacade.getEntitiesByIds(i,this.idSchema,r):i}};var F=class{completed=!1;percentage;constructor(e){this.percentage=e}};var rt=class{teamFollowed=new F(10);teamFavourite=new F(15);playerFollowed=new F(10);playerFavourite=new F(10);competitionFollowed=new F(10);competitionFavourite=new F(5);addedBirthdate=new F(10);addedGender=new F(10);addedCountry=new F(10);addedAvatar=new F(10)};var it=class{totalPercentage;breakdown=new rt};var Te=class{limit=0;startAfter=null;constructor(e){this.limit=e.limit?e.limit:20,this.startAfter=e.startAfter?e.startAfter:null}constructFilterUrl=()=>{let e="";return this.limit&&(e=e+"&",e=e+`limit=${this.limit}`),this.startAfter&&(e=e+"&",e=e+`start_after=${this.startAfter}`),e}};var D=class{isBrowser=!1;localStorage={};https=null;constructor(e,t){this.isBrowser=typeof window!="undefined",this.localStorage=e,this.https=t}getOwn=async()=>{if(this.isBrowser){let e=Math.floor(Date.now()/1e3),t=this.localStorage.getExparationProfile(),r=null;if(t>e&&(r=this.localStorage.getOwnProfile()),r)return r;try{let i=await this.https.getProfile();return this.localStorage.setOwnProfile(i),i}catch(i){throw console.warn("There was a problem retrieving your profile: ",i),i}}else try{return await this.https.getProfile()}catch(e){throw console.warn("There was a problem retrieving your profile: ",e),e}};getByIds=async e=>{try{return await this.https.getProfiles(e)}catch(t){throw console.warn(`There was a problem retrieving the selected profiles: ${e.join(",")} `,t),t}};getById=async e=>{try{return await this.https.getProfile(e)}catch(t){throw console.warn(`There was a problem retrieving the selected profile: ${e} `,t),t}};getCountries=async()=>{if(this.isBrowser){let e=this.localStorage.getProfileCountries();if(e&&e.length>0)return e;try{let t=await this.https.getCountries();return this.localStorage.setProfileCountries(t),t}catch(t){throw console.warn("There was a problem retrieving profile countries: ",t),t}}else try{return await this.https.getCountries()}catch(e){throw console.warn("There was a problem retrieving profile countries: ",e),e}};getFollowers=async(e,t)=>{try{return e&&(e=new Te(e)),await this.https.getFollowers(e,t)}catch(r){throw console.warn("There was a problem retrieving your followers: ",r),r}};getFollowing=async(e,t)=>{try{return e&&(e=new Te(e)),await this.https.getFollowing(e,t)}catch(r){throw console.warn("There was a problem retrieving your following profiles: ",r),r}};follow=async e=>{try{return await this.https.follow(e)}catch(t){throw console.warn(`There was a problem following profiles: ${e.join(",")} `,t),t}};unfollow=async e=>{try{return await this.https.unfollow(e)}catch(t){throw console.warn(`There was a problem unfollowing profiles: ${e.join(",")} `,t),t}};showFullnessProfile=e=>{let t=new it,r=0;return e.avatar&&(t.breakdown.addedAvatar.completed=!0,r+=t.breakdown.addedAvatar.percentage),e.birthDate&&(t.breakdown.addedBirthdate.completed=!0,r+=t.breakdown.addedBirthdate.percentage),e.country&&(t.breakdown.addedCountry.completed=!0,r+=t.breakdown.addedCountry.percentage),e.gender&&(t.breakdown.addedGender.completed=!0,r+=t.breakdown.addedGender.percentage),e.interests&&e.interests.length>0&&(e.interests.find(l=>l.type==="team"&&l.favourite)&&(t.breakdown.teamFavourite.completed=!0,r+=t.breakdown.teamFavourite.percentage),e.interests.find(l=>l.type==="team")&&(t.breakdown.teamFollowed.completed=!0,r+=t.breakdown.teamFollowed.percentage),e.interests.find(l=>l.type==="player"&&l.favourite)&&(t.breakdown.playerFavourite.completed=!0,r+=t.breakdown.playerFavourite.percentage),e.interests.find(l=>l.type==="player")&&(t.breakdown.playerFollowed.completed=!0,r+=t.breakdown.playerFollowed.percentage),e.interests.find(l=>l.type==="competition"&&l.favourite)&&(t.breakdown.competitionFavourite.completed=!0,r+=t.breakdown.competitionFavourite.percentage),e.interests.find(l=>l.type==="competition")&&(t.breakdown.competitionFollowed.completed=!0,r+=t.breakdown.competitionFollowed.percentage)),t.totalPercentage=r,t}};var ot=class{id=null;name=null;assets=null};var at=class{isBrowser=!1;localStorage={};https=null;idMapping=null;constructor(e,t,r){this.isBrowser=typeof window!="undefined",this.localStorage=e,this.idMapping=r,this.https=t}getCountriesWithIdMapping=async()=>{try{let e=await this.getCountries();return this.idMapping.remapEntities(e,"country")}catch(e){throw console.warn("There was a problem browsing countries as football entities",e),e}};getCountries=async()=>{if(this.isBrowser){let e=this.localStorage.getFootballCountries();if(e&&e.length>0)return e;try{let t=await this.https.getCountries();return this.localStorage.setFootballCountries(t),t}catch(t){throw console.warn("There was a problem retrieving countries as football entities",t),t}}else return this.https.getCountries()}};var st=class{countryId=null;name=null;gender=null;type=null;sortField=null;sortOrder=null;competitionIds=null;constructor(e){this.countryId=e.countryId?`${e.countryId}`:null,this.name=e.name?e.name:null,this.gender=e.gender?e.gender:null,this.type=e.type?e.type:null,this.sortField=e.sortField?`${e.sortField}`:null,this.sortOrder=e.sortOrder?`${e.sortOrder}`:null,this.competitionIds=e.competitionIds?e.competitionIds:null}constructFilterUrl=()=>{let e="";return this.countryId&&(e=e+"&",e=e+`country_id=${this.countryId}`),this.gender&&(e=e+"&",e=e+`gender=${this.gender}`),this.type&&(e=e+"&",e=e+`type=${this.type}`),this.sortField&&(e=e+"&",e=e+`sort_field=${this.sortField}`),this.sortOrder&&(e=e+"&",e=e+`sort_order=${this.sortOrder}`),this.name&&(e=e+"&",e=e+`name=${this.name}`),this.competitionIds&&(e=e+"&",e=e+`competition_ids=${this.competitionIds.join(",")}`),e};competitionSearchFilter=e=>{try{let t=this.filter(e);return this.sortField||this.sortOrder?this.sort(t):t}catch(t){return console.warn("There was a problem filtering the local competitions",t),[]}};filter=e=>{let t=this.entitiesToSearchWith();return e.filter(r=>{let i=!0;return t.forEach(a=>{a!=="sortOrder"&&a!=="sortField"&&(a==="countryId"?i&&=r.country.id===this[a]:a==="name"?i&&=r.name.toLocaleLowerCase().includes(this[a].toLocaleLowerCase()):a==="competitionIds"?i&&=this[a].some(s=>r.id===s):i&&=r[a].toLocaleLowerCase()===this[a].toLocaleLowerCase())}),i})};entitiesToSearchWith=()=>{let e=[];return this.countryId&&e.push("countryId"),this.name&&e.push("name"),this.gender&&e.push("gender"),this.type&&e.push("type"),this.sortField&&e.push("sortField"),this.sortOrder&&e.push("sortOrder"),this.competitionIds&&e.push("competitionIds"),e};sort=e=>{let t=[];return this.sortField==="name"?t=e.sort((r,i)=>this.sortOrder&&this.sortOrder==="desc"?i.name.localeCompare(r.name):r.name.localeCompare(i.name)):this.sortField==="countryId"?t=e.sort((r,i)=>this.sortOrder&&this.sortOrder==="desc"?i.country.id.localeCompare(r.country.id):r.country.id.localeCompare(i.country.id)):this.sortField==="scope"?e.forEach(r=>t[this.competitionIds.indexOf(r.id)]=r):!this.sortField&&this.sortOrder==="desc"&&(t=e.sort((r,i)=>i.id.localeCompare(r.id))),t}};var nt=class{isBrowser=!1;localStorage={};https=null;idMapping=null;constructor(e,t,r){this.isBrowser=typeof window!="undefined",this.localStorage=e,this.idMapping=r,this.https=t}getCompetitionsIdMapping=async e=>{try{let t=!1;if(e){if(e=new st(e),e.countryId){let i=await this.idMapping.getEntityIdsBySchemaId([`${e.countryId}`],"country","native");i.country.length===0&&(t=!0),e.countryId=i.country[0]}if(e.competitionIds){let i=await this.idMapping.getEntityIdsBySchemaId(e.competitionIds,"competition","native");i.competition.length===0&&(t=!0),e.competitionIds=i.competition}if(t)return[]}let r=await this.getCompetitions(e);return await this.idMapping.remapEntities(r,"competition")}catch(t){throw console.warn("There was a problem browsing all of the competitions",t),t}};getCompetitions=async e=>{if(this.isBrowser){let t=this.localStorage.getCompetitions(e);if(t&&t.length>0)return t;try{let r=await this.https.getCompetitions(e);return this.localStorage.setCompetitions(r),this.localStorage.getCompetitions(e)}catch(r){throw console.warn("There was a problem retrieving all competitions",r),r}}else return this.https.getCompetitions(e)};getCompetitionByIdIdMapping=async e=>{try{let r=(await this.idMapping.getEntityIdsBySchemaId([e],"competition","native")).competition[0],i=await this.getCompetitionById(r);return await this.idMapping.remapEntities(i,"competition")}catch(t){throw console.warn(`There was a problem browsing the following competition:${e}`,t),t}};getCompetitionById=async e=>{try{return await this.https.getCompetitionById(e)}catch(t){throw console.warn(`There was a problem retrieving the competition with the following id: ${e}`,t),t}};getTopCompetitionsIdMapping=async()=>{try{let e=await this.getTopCompetitions();return await this.idMapping.remapEntities(e,"competition")}catch(e){throw console.warn("There was a problem browsing the top competitions",e),e}};getTopCompetitions=async()=>{try{return await this.https.getTopCompetitions()}catch(e){throw console.warn("There was a problem retrieving the top competitions",e),e}}};var lt=class{name=null;countryId=null;national=!1;gender=null;limit=null;page=null;scope=null;sortField=null;sortOrder=null;teamIds=null;constructor(e){this.name=e.name?e.name:null,this.countryId=e.countryId?`${e.countryId}`:null,this.national=e.national?e.national:!1,this.gender=e.gender?e.gender:null,this.limit=e.limit?e.limit:null,this.page=e.page?e.page:null,this.scope=e.scope?e.scope:null,this.sortField=e.sortField?`${e.sortField}`:null,this.sortOrder=e.sortOrder?`${e.sortOrder}`:null,this.teamIds=e.teamIds?e.teamIds:null}constructFilterUrl=()=>{let e="";return this.name&&(e=e+"&",e=e+`name=${this.name}`),this.countryId&&(e=e+"&",e=e+`country_id=${this.countryId}`),this.national&&(e=e+"&",e=e+`national=${this.national}`),this.gender&&(e=e+"&",e=e+`gender=${this.gender}`),this.limit&&(e=e+"&",e=e+`limit=${this.limit}`),this.scope&&(e=e+"&",e=e+`scope=${this.scope.join(",")}`),this.page&&(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}`),this.teamIds&&(e=e+"&",e=e+`team_ids=${this.teamIds.join(",")}`),e}};var pt=class{https=null;idMapping=null;constructor(e,t){this.idMapping=t,this.https=e}getTeamsIdMapping=async e=>{try{let t=!1;if(e){if(e=new lt(e),e.countryId){let i=await this.idMapping.getEntityIdsBySchemaId([`${e.countryId}`],"country","native");i.country.length===0&&(t=!0),e.countryId=i.country[0]}if(e.scope){let i=await this.idMapping.getEntityIdsBySchemaId(e.scope,"competition","native");i.competition.length===0&&(t=!0),e.scope=i.competition}if(e.teamIds){let i=await this.idMapping.getEntityIdsBySchemaId(e.teamIds,"team","native");i.team.length===0&&(t=!0),e.teamIds=i.team}}if(t)return[];let r=await this.getTeams(e);return await this.idMapping.remapEntities(r,"team")}catch(t){throw console.warn("There was a problem browsing all teams",t),t}};getTeams=async e=>{try{return await this.https.getTeams(e)}catch(t){throw console.warn("There was a problem retrieving all teams",t),t}};getTeamByIdIdMapping=async e=>{try{e=(await this.idMapping.getEntityIdsBySchemaId([e],"team","native")).team[0];let r=await this.getTeamById(e);return await this.idMapping.remapEntities(r,"team")}catch(t){throw console.warn(`There was a problem browsing the following team:${e}`,t),t}};getTeamById=async e=>{try{return await this.https.getTeamById(e)}catch(t){throw console.warn(`There was a problem retrieving the following team: ${e}`,t),t}};getTopTeamsIdMapping=async()=>{try{let e=await this.getTopTeams();return await this.idMapping.remapEntities(e,"team")}catch(e){throw console.warn("There was a problem browsing the top teams",e),e}};getTopTeams=async()=>{try{return await this.https.getTopTeams()}catch(e){throw console.warn("There was a problem retrieving the top teams",e),e}};getNextMatchForTeamIdMapping=async e=>{try{e=(await this.idMapping.getEntityIdsBySchemaId([e],"team","native")).team[0];let r=await this.getNextMatchForTeam(e);return await this.idMapping.remapEntities(r,"match")}catch(t){throw console.warn(`There was a problem browsing the next match for the following team:${e}`,t),t}};getNextMatchForTeam=async e=>{try{return await this.https.getNextMatchForTeam(e)}catch(t){throw console.warn(`There was a problem retrieving the next match for the following team: ${e}`,t),t}};getPrevMatchForTeamIdMapping=async e=>{try{e=(await this.idMapping.getEntityIdsBySchemaId([e],"team","native")).team[0];let r=await this.getPrevMatchForTeam(e);return await this.idMapping.remapEntities(r,"match")}catch(t){throw console.warn(`There was a problem browsing the previous match for the following team:${e}`,t),t}};getPrevMatchForTeam=async e=>{try{return await this.https.getPrevMatchForTeam(e)}catch(t){throw console.warn(`There was a problem retrieving the previous match for the following team: ${e}`,t),t}}};var Ee=class{countryId=null;scope=null;name=null;playerIds=null;limit=null;page=null;sortField=null;sortOrder=null;constructor(e){this.countryId=e.countryId?e.countryId:null,this.scope=e.scope?e.scope:null,this.name=e.name?e.name:null,this.playerIds=e.playerIds?e.playerIds:null,this.limit=e.limit?e.limit:null,this.page=e.page?e.page:null,this.sortField=e.sortField?e.sortField:null,this.sortOrder=e.sortOrder?e.sortOrder:null}constructFilterUrl=()=>{let e="";return this.countryId&&(e=e+"&",e=e+`country_id=${this.countryId}`),this.scope&&(e=e+"&",e=e+`scope=${this.scope.join(",")}`),this.name&&(e=e+"&",e=e+`name=${this.name}`),this.playerIds&&(e=e+"&",e=e+`player_ids=${this.playerIds.join(",")}`),this.limit&&(e=e+"&",e=e+`limit=${this.limit}`),this.page&&(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 $=class{https=null;idMapping=null;constructor(e,t){this.idMapping=t,this.https=e}getPlayersIdMapping=async e=>{try{let t=!1;if(e){if(e=new Ee(e),e.countryId){let i=await this.idMapping.getEntityIdsBySchemaId([e.countryId],"country","native");i.country.length===0&&(t=!0),e.countryId=i.country[0]}if(e.playerIds){let i=await this.idMapping.getEntityIdsBySchemaId(e.playerIds,"player","native");i.player.length===0&&(t=!0),e.playerIds=i.player}if(e.scope){let i=await this.idMapping.getEntityIdsBySchemaId(e.scope,"competition","native");i.competition.length===0&&(t=!0),e.scope=i.competition}if(t)return[]}let r=await this.getPlayers(e);return await this.idMapping.remapEntities(r,"player")}catch(t){throw console.warn("There was a problem browsing the players",t),t}};getPlayersWithNativeIds=async e=>{let t=new Ee({playerIds:e}),r=await this.getPlayers(t);return r.sort((i,a)=>i.id.localeCompare(a.id)),await this.idMapping.remapEntities(r,"player")};getPlayersMapWithNativeIds=async e=>{let t={},r=U(e);r.sort((a,s)=>a.localeCompare(s));let i=await this.getPlayersWithNativeIds(r);return r.forEach((a,s)=>t[a]=i[s]),t};getPlayers=async e=>{try{return await this.https.getPlayers(e)}catch(t){throw console.warn("There was a problem retrieving the players",t),t}};getPlayerIdMapping=async e=>{try{let t=await this.idMapping.getEntityIdsBySchemaId([e],"player","native"),r=await this.getPlayerById(t.player[0]);return await this.idMapping.remapEntities(r,"player")}catch(t){throw console.warn(`There was a problem browsing the following player:${e}`,t),t}};getPlayerById=async e=>{try{return await this.https.getPlayerById(e)}catch(t){throw console.warn(`There was a problem retrieving the following player: ${e}`,t),t}};getTopPlayersIdMapping=async()=>{try{let e=await this.getTopPlayers();return await this.idMapping.remapEntities(e,"player")}catch(e){throw console.warn("There was a problem browsing the top players",e),e}};getTopPlayers=async()=>{try{return await this.https.getTopPlayers()}catch(e){throw console.warn("There was a problem retrieving the top players",e),e}};getNextMatchForPlayerIdMapping=async e=>{try{e=(await this.idMapping.getEntityIdsBySchemaId([e],"player","native")).player[0];let r=await this.getNextMatchForPlayer(e);return await this.idMapping.remapEntities(r,"match")}catch(t){throw console.warn(`There was a problem browsing the next match for player:${e}`,t),t}};getNextMatchForPlayer=async e=>{try{return await this.https.getNextMatchForPlayer(e)}catch(t){throw console.warn(`There was a problem retrieving the next match for player: ${e}`,t),t}};getPrevMatchForPlayerIdMapping=async e=>{try{e=(await this.idMapping.getEntityIdsBySchemaId([e],"player","native")).player[0];let r=await this.getPrevMatchForPlayer(e);return await this.idMapping.remapEntities(r,"match")}catch(t){throw console.warn(`There was a problem browsing the previous match for player:${e}`,t),t}};getPrevMatchForPlayer=async e=>{try{return await this.https.getPrevMatchForPlayer(e)}catch(t){throw console.warn(`There was a problem retrieving the previous match for player: ${e}`,t),t}}};var Ce=class{countryIds=null;competitionIds=null;matchIds=null;status=null;teamIds=null;fromDate=null;toDate=null;limit=null;page=null;sortField=null;sortOrder=null;constructor(e){this.countryIds=e.countryIds?e.countryIds:null,this.competitionIds=e.competitionIds?e.competitionIds:null,this.matchIds=e.matchIds?e.matchIds:null,this.status=e.status?e.status:null,this.teamIds=e.teamIds?e.teamIds:null,this.fromDate=e.fromDate?e.fromDate:null,this.toDate=e.toDate?e.toDate:null,this.limit=e.limit?e.limit:null,this.page=e.page?e.page:null,this.sortField=e.sortField?e.sortField:null,this.sortOrder=e.sortOrder?e.sortOrder:null}constructFilterUrl=()=>{let e="";return this.countryIds&&(e=e+"&",e=e+`countries=${this.countryIds.join(",")}`),this.competitionIds&&(e=e+"&",e=e+`competitions=${this.competitionIds.join(",")}`),this.matchIds&&(e=e+"&",e=e+`matches=${this.matchIds.join(",")}`),this.status&&(e=e+"&",e=e+`status=${this.status}`),this.teamIds&&(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&&(e=e+"&",e=e+`limit=${this.limit}`),this.page&&(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 H=class{https=null;idMapping=null;constructor(e,t){this.https=e,this.idMapping=t}getMatchesIdMapping=async e=>{try{if(e){if(e=new Ce(e),e.countryIds){let r=await this.idMapping.getEntityIdsBySchemaId(e.countryIds,"country","native");e.countryIds=r.country}if(e.competitionIds){let r=await this.idMapping.getEntityIdsBySchemaId(e.competitionIds,"competition","native");e.competitionIds=r.competition}if(e.matchIds){let r=await this.idMapping.getEntityIdsBySchemaId(e.matchIds,"match","native");e.matchIds=r.match}if(e.teamIds){let r=await this.idMapping.getEntityIdsBySchemaId(e.teamIds,"team","native");e.teamIds=r.team}}let t=await this.getMatches(e);return await this.idMapping.remapEntities(t,"match")}catch(t){throw console.warn("There was a problem browsing the matches",t),t}};getMatchesWithNativeIds=async e=>{let t=new Ce({matchIds:e}),r=await this.getMatches(t);return r.sort((i,a)=>i.id.localeCompare(a.id)),await this.idMapping.remapEntities(r,"match")};getMatchesMapWithNativeIds=async e=>{let t={},r=U(e);r.sort((a,s)=>a.localeCompare(s));let i=await this.getMatchesWithNativeIds(r);return r.forEach((a,s)=>t[a]=i[s]),t};getMatches=async e=>{try{return await this.https.getMatches(e)}catch(t){throw console.warn("There was a problem retrieving the matches",t),t}};getMatchIdMapping=async e=>{try{let t=await this.idMapping.getEntityIdsBySchemaId([e],"match","native"),r=await this.getMatchById(t.match[0]);return await this.idMapping.remapEntities(r,"match")}catch(t){throw console.warn(`There was a problem browsing the following match: ${e}`,t),t}};getMatchById=async e=>{try{return await this.https.getMatchById(e)}catch(t){throw console.warn(`There was a problem retrieving the following match: ${e}`,t),t}}};var ct=class{entities=null;query=null;scope=null;constructor(e){this.entities=e.entities?e.entities:null,this.query=e.query?e.query:null,this.scope=e.scope?e.scope:null}constructFilterUrl=()=>{let e="";return this.entities&&(e=e+"&",e=e+`entities=${this.entities.join(",")}`),this.query&&(e=e+"&",e=e+`q=${this.query}`),this.scope&&(e=e+"&",e=e+`scope=${this.scope.join(",")}`),e}};var mt=class{https=null;idMapping=null;constructor(e,t){this.https=e,this.idMapping=t}searchIdMapping=async e=>{try{if(e=new ct(e),e.scope){let r=await this.idMapping.getEntityIdsBySchemaId(e.scope,"competition","native");e.scope=r.competition}let t=await this.search(e);if(t.teams&&t.teams.length>0){let r=await this.idMapping.remapEntities(t.teams,"team");t.teams=r}if(t.players&&t.players.length>0){let r=await this.idMapping.remapEntities(t.players,"player");t.players=r}if(t.competitions&&t.competitions.length>0){let r=await this.idMapping.remapEntities(t.competitions,"competition");t.competitions=r}return t}catch(t){throw console.warn("There was a problem with browsing the search result",t),t}};search=async e=>{try{return await this.https.search(e)}catch(t){throw console.warn("There was a problem retrieving the search response",t),t}}};var k=class{isBrowser=!1;localStorage={};https=null;idMapping=null;countriesFacade=null;competitionsFacade=null;teamsFacade=null;playerFacade=null;matchFacade=null;searchFacade=null;constructor(e,t,r){this.isBrowser=typeof window!="undefined",this.localStorage=e,this.idMapping=r,this.https=t,this.countriesFacade=new at(e,t,r),this.competitionsFacade=new nt(e,t,r),this.teamsFacade=new pt(t,r),this.playerFacade=new $(t,r),this.matchFacade=new H(t,r),this.searchFacade=new mt(t,r)}getCountries=async()=>this.countriesFacade.getCountriesWithIdMapping();getCompetitions=async e=>this.competitionsFacade.getCompetitionsIdMapping(e);getCompetitionById=async e=>this.competitionsFacade.getCompetitionByIdIdMapping(e);getTopCompetitions=async()=>this.competitionsFacade.getTopCompetitionsIdMapping();getTeams=async e=>this.teamsFacade.getTeamsIdMapping(e);getTeamById=async e=>this.teamsFacade.getTeamByIdIdMapping(e);getTopTeams=async()=>this.teamsFacade.getTopTeamsIdMapping();getNextMatchForTeam=async e=>this.teamsFacade.getNextMatchForTeamIdMapping(e);getPrevMatchForTeam=async e=>this.teamsFacade.getPrevMatchForTeamIdMapping(e);getPlayers=async e=>this.playerFacade.getPlayersIdMapping(e);getPlayerById=async e=>this.playerFacade.getPlayerIdMapping(e);getTopPlayers=async()=>this.playerFacade.getTopPlayersIdMapping();getNextMatchForPlayer=async e=>this.playerFacade.getNextMatchForPlayerIdMapping(e);getPrevMatchForPlayer=async e=>this.playerFacade.getPrevMatchForPlayerIdMapping(e);getMatches=async e=>this.matchFacade.getMatchesIdMapping(e);getMatchById=async e=>this.matchFacade.getMatchIdMapping(e);search=async e=>this.searchFacade.searchIdMapping(e)};var re=class{idMapping=null;footballFacade=null;constructor(e,t){this.idMapping=e,this.footballFacade=t}remapInterestsToIdSchema=async e=>{let t=this.idMapping.idSchema;if(t!=="native")if(e.length>0){let r={},i={};e.forEach(n=>{r.hasOwnProperty(n.type)||(r[n.type]=[],i[n.type]=[]),r[n.type].push(n.id),i[n.type].push(n)});let a=await this.idMapping.idMappingFacade.getEntitiesByIds(r,"native",t),s=[];for(let[n,p]of Object.entries(i))p.forEach((u,l)=>{u.id=a[n][l],s.push(u)});return s}else return e;else return e};remapInterestToNative=async e=>{let t=this.idMapping.idSchema;if(t!=="native"){let r={},{id:i,type:a}=e;r[a]=[i];let s=await this.idMapping.idMappingFacade.getEntitiesByIds(r,t,"native");return e.id=s[a][0],e}return e};inquiryCustomInterests=async e=>{let t=[];if(e&&e.length>0&&(t=e.filter(r=>r.source==="custom")),t&&t.length>0){let r=e.filter(a=>a.source!=="custom"),i=await this.remapInterestsToIdSchema(r);return t.forEach(a=>i.push(a)),i}return await this.remapInterestsToIdSchema(e)};showFullInterests=async e=>{let t=[];if(e&&e.length>0)for(let r of e)if(r.source!=="custom"&&r.source==="football"){let i={};if(r.type==="team"){i.teamIds=[r.id];let a=await this.footballFacade.getTeams(i);r.model=a[0]}if(r.type==="player"){i.playerIds=[r.id];let a=await this.footballFacade.getPlayers(i);r.model=a[0]}if(r.type==="competition"){i.competitionIds=[r.id];let a=await this.footballFacade.getCompetitions(i);r.model=a[0]}r.model===void 0&&(r.model=null),t.push(r)}else t.push(r);return t}};var ut=class{profileHttps=null;footballHttps=null;localStorage=null;idMapping=null;profileFacade=null;footballFacade=null;interestsService=null;ownProfile=null;modified=!1;expireAt=0;promises=[];isFetching=!1;constructor(e,t,r,i){this.localStorage=e,this.profileHttps=t,this.footballHttps=i,this.idMapping=r,this.footballFacade=new k(e,i,r),this.interestsService=new re(r,this.footballFacade),this.profileFacade=new D(e,t)}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 e=Math.floor(Date.now()/1e3);if(!this.ownProfile||this.expireAt<e){this.isFetching=!0,this.expireAt=Math.floor(Date.now()/1e3)+600;try{let t=await this.profileFacade.getOwn();this.setOwnProfile(t)}catch{this.isFetching=!1}return this.modified=!1,this.isFetching=!1,this.ownProfile}return this.ownProfile};delay=e=>new Promise(t=>{setTimeout(t,e)});setOwnProfile=e=>{this.ownProfile=e};extractUpdatedProps=(e,t)=>{let r={};return Object.keys(e).forEach(i=>{i==="gender"&&e[i]!==t[i]?r[i]=t[i]:i==="birthDate"?(t[i]===null||e[i]===null&&t[i]||e[i]!==t[i])&&(r.birth_date=t[i]):i==="country"?t[i]===null?r.country_id=t[i]:(e[i]===null&&t[i]||e[i].id!==t[i].id)&&(r.country_id=t[i].id):i==="interests"&&(e[i].length>0?e[i].filter(s=>!t[i].some(n=>s.id===n.id&&s.favourite===n.favourite&&s.type===n.type&&s.source===n.source)).length>0&&(r[i]=t[i]):r[i]=t[i])}),r};getInfo=async()=>{let e=await this.getOwnProfile(),t=JSON.parse(JSON.stringify(e));return delete t.interests,t};showInterests=async()=>{let e=await this.getOwnProfile(),t=[];return t=e.interests,await this.interestsService.inquiryCustomInterests(t)};showFullInterests=async()=>{let e=await this.showInterests();return await this.interestsService.showFullInterests(e)};getFollowers=async e=>await this.profileFacade.getFollowers(e);getFollowing=async e=>await this.profileFacade.getFollowing(e);follow=async e=>await this.profileFacade.follow(e);unfollow=async e=>await this.profileFacade.unfollow(e);addInterestPromise=async e=>{this.modified=!0,await this.getOwnProfile();let t=null;e.source!=="custom"?t=await this.interestsService.remapInterestToNative(e):t=e;let r=this.ownProfile.interests.filter(i=>i.id!==t.id||i.type!==t.type||i.source!==t.source);return this.ownProfile.interests=[...r],this.ownProfile.interests.push(t),this};addInterest=e=>(this.promises.push(this.addInterestPromise(e)),this);removeInterestPromise=async e=>{this.modified=!0,await this.getOwnProfile();let t=null;return e.source!=="custom"?t=await this.interestsService.remapInterestToNative(e):t=e,this.ownProfile.interests=this.ownProfile.interests.filter(r=>r.id!==t.id||r.type!==t.type||r.source!==t.source),this};removeInterest=e=>(this.promises.push(this.removeInterestPromise(e)),this);setBirthdatePromise=async e=>(this.modified=!0,await this.getOwnProfile(),e?this.ownProfile.birthDate=e:this.ownProfile.birthDate=null,this);setBirthdate=e=>(this.promises.push(this.setBirthdatePromise(e)),this);setGenderPromise=async e=>(this.modified=!0,await this.getOwnProfile(),e==="male"||e==="female"?this.ownProfile.gender=e:this.ownProfile.gender="unspecified",this);setGender=e=>(this.promises.push(this.setGenderPromise(e)),this);setCountryPromise=async e=>(this.modified=!0,await this.getOwnProfile(),e&&!this.ownProfile.country?(this.ownProfile.country=new ot,this.ownProfile.country.id=e):e&&this.ownProfile.country?this.ownProfile.country.id=e:this.ownProfile.country=null,this);setCountry=e=>(this.promises.push(this.setCountryPromise(e)),this);showFullnessProfile=async()=>{let e=await this.getOwnProfile(),t=JSON.parse(JSON.stringify(e));return this.profileFacade.showFullnessProfile(t)};update=async()=>{if(this.promises.length===0)return this.ownProfile;await Promise.all(this.promises);let e=await this.profileFacade.getOwn(),t=await this.getOwnProfile(),r=this.extractUpdatedProps(e,t),i=await this.profileHttps.updateProfile(r);return this.modified=!1,this.expireAt=0,this.localStorage.setOwnProfile(i),delete i.interests,i}};var dt=class{profileHttps=null;footballFacade=null;localStorage=null;idMapping=null;profileFacade=null;interestsService=null;profileId="";constructor(e,t,r,i){this.localStorage=e,this.profileHttps=t,this.footballFacade=i,this.idMapping=r,this.interestsService=new re(r,i),this.profileFacade=new D(e,t)}setId=e=>(this.profileId=e,this);getProfile=async()=>await this.profileFacade.getById(this.profileId);getInfo=async()=>{let e=await this.getProfile();return delete e.interests,e};showInterests=async()=>{let e=await this.getProfile(),t=[];return t=e.interests,await this.interestsService.inquiryCustomInterests(t)};showFullInterests=async()=>{let e=await this.showInterests();return await this.interestsService.showFullInterests(e)};getFollowers=async e=>await this.profileFacade.getFollowers(e,this.profileId);getFollowing=async e=>await this.profileFacade.getFollowing(e,this.profileId);showFullnessProfile=async()=>{let e=await this.getProfile();return this.profileFacade.showFullnessProfile(e)}};var vo=be(te());var ht=class{id="";alias="";countryCode="";assets=null;name=""};var y=class{countriesFromResponse=e=>{if(e)return e.map(t=>this.countryFromResponse(t))};countryFromResponse=e=>{try{if(e){let t=new ht;return t.id=e.id,t.alias=e.alias,t.assets=e.assets,t.countryCode=e.country_code,t.name=e.name,t}}catch(t){throw t}return null}};var ft=class{id="";country=null;gender="";assets=null;type="";name=""};var I=class{countryRemapper=null;constructor(){this.countryRemapper=new y}fromResponse(e){try{let t=new ft;return t.id=e.id,t.country=this.countryRemapper.countryFromResponse(e.country),t.gender=e.gender,t.assets=e.assets,t.type=e.type,t.name=e.name,t}catch(t){throw console.warn("There was a problem remapping the competition response",t),t}}};var yt=class{id="";country=null;gender="";assets=null;type="";name="";participants=[]};var gt=class{id="";country=null;gender="";assets=null;name="";code="";national=!1;fullName="";shortName=""};var M=class{countryRemapper=null;constructor(){this.countryRemapper=new y}fromResponse(e){try{let t=new gt;return t.id=e.id,t.country=this.countryRemapper.countryFromResponse(e.country),t.gender=e.gender,t.assets=e.assets,t.code=e.code,t.national=e.national,t.fullName=e.full_name,t.shortName=e.short_name,t.name=e.name,t}catch(t){throw console.warn("There was a problem remapping teams response",t),t}}};var Mt=class{countryRemapper=null;teamBasicRemapper=null;constructor(){this.countryRemapper=new y,this.teamBasicRemapper=new M}fromResponse(e){try{let t=new yt;return t.id=e.id,t.country=this.countryRemapper.countryFromResponse(e.country),t.gender=e.gender,t.assets=e.assets,t.type=e.type,t.name=e.name,t.participants=e.participants.map(r=>this.teamBasicRemapper.fromResponse(r)),t}catch(t){throw console.warn("There was a problem remapping the competition response",t),t}}};var wt=class{id="";country=null;gender="";assets=null;name="";competitions=[];code="";national=!1;fullName="";shortName="";squad=[]};var bt=class{id="";startDate="";endDate="";shirtNumber;loan=!1;position="";country=null;name="";assets=null;birthDate=""};var It=class{countryRemapper=null;constructor(){this.countryRemapper=new y}fromResponse(e){try{let t=new bt;return t.id=e.id,t.startDate=e.start_date,t.endDate=e.end_date,t.shirtNumber=e.shirt_number,t.loan=e.loan,t.position=e.position,t.country=this.countryRemapper.countryFromResponse(e.country),t.name=e.name,t.assets=e.assets,t.birthDate=e.birth_date,t}catch(t){throw console.warn("There was a problem remapping the player from squad",t),t}}};var Rt=class{countryRemapper=null;competitionRemapper=null;playerRemapper=null;constructor(){this.countryRemapper=new y,this.competitionRemapper=new I,this.playerRemapper=new It}fromResponse(e){try{let t=new wt;return t.id=e.id,t.country=this.countryRemapper.countryFromResponse(e.country),t.gender=e.gender,t.assets=e.assets,t.code=e.code,t.national=e.national,t.fullName=e.full_name,t.shortName=e.short_name,t.name=e.name,t.competitions=e.competitions?e.competitions.map(r=>this.competitionRemapper.fromResponse(r)):[],t.squad=e.squad?e.squad.map(r=>this.playerRemapper.fromResponse(r)):[],t}catch(t){throw console.warn("There was a problem remapping team response",t),t}}};var Ft=class{id="";kickoffAt="";finishedAt="";updatedAt="";homeTeam=null;awayTeam=null;lineupsConfirmed=!1;startedAt="";minute="";scores=null;context={competition:null};status={type:null,subType:null}};var Pt=class{ftScore=null;htScore=null;aetScore=null;aggScore=null;penScore=null};var ie=class{fromResponse(e){try{let t=new Pt;return t.ftScore=this.statEntityFromResponse(e.ft_score),t.htScore=this.statEntityFromResponse(e.ht_score),t.aetScore=this.statEntityFromResponse(e.aet_score),t.aggScore=this.statEntityFromResponse(e.agg_score),t.penScore=this.statEntityFromResponse(e.pen_score),t}catch(t){throw console.warn("There was a problem remapping the scores",t),t}}statEntityFromResponse=e=>({homeGoals:e.home_goals,awayGoals:e.away_goals})};var vt=class{teamRemapper=null;competitionRemapper=null;scoresRemapper=null;constructor(){this.teamRemapper=new M,this.competitionRemapper=new I,this.scoresRemapper=new ie}fromResponse(e){try{let t=new Ft;return t.id=e.id,t.kickoffAt=e.kickoff_at,t.finishedAt=e.finished_at,t.updatedAt=e.updated_at,t.homeTeam=this.teamRemapper.fromResponse(e.home_team),t.awayTeam=this.teamRemapper.fromResponse(e.away_team),t.lineupsConfirmed=e.lineups_confirmed,t.startedAt=e.started_at,t.minute=e.minute,t.scores=this.scoresRemapper.fromResponse(e.scores),t.context={competition:e.context.competition?this.competitionRemapper.fromResponse(e.context.competition):null},t.status={type:e.status.type,subType:e.status.sub_type},t}catch(t){throw console.warn("There was a problem remapping the match response",t),t}}};var St=class{id="";kickoffAt="";finishedAt="";updatedAt="";homeTeam=null;awayTeam=null;lineupsConfirmed=!1;startedAt="";minute="";scores=null;stats=null;context={competition:null};timeline=[];status={type:null,subType:null};lineups=null};var Tt=class{corners=null;crosses=null;offside=null;shotsOn=null;throwIn=null;redCards=null;shotsOff=null;goalKicks=null;possession=null;treatments=null;yellowCards=null;shotsBlocked=null;substitutions=null;counterAttacks=null;foulsCommitted=null};var Et=class{fromResponse(e){try{let t=new Tt;return t.corners=this.statEntityFromResponse(e.corners),t.crosses=this.statEntityFromResponse(e.crosses),t.offside=this.statEntityFromResponse(e.offside),t.shotsOn=this.statEntityFromResponse(e.shots_on),t.throwIn=this.statEntityFromResponse(e.throw_in),t.redCards=this.statEntityFromResponse(e.red_cards),t.shotsOff=this.statEntityFromResponse(e.shots_off),t.goalKicks=this.statEntityFromResponse(e.goal_kicks),t.possession=this.statEntityFromResponse(e.possession),t.treatments=this.statEntityFromResponse(e.treatments),t.yellowCards=this.statEntityFromResponse(e.yellow_cards),t.shotsBlocked=this.statEntityFromResponse(e.shots_blocked),t.substitutions=this.statEntityFromResponse(e.substitutions),t.counterAttacks=this.statEntityFromResponse(e.counter_attacks),t.foulsCommitted=this.statEntityFromResponse(e.fouls_committed),t}catch(t){throw console.warn("There was a problem remapping the stats",t),t}}statEntityFromResponse=e=>({homeTeam:e?e.home_team:null,awayTeam:e?e.away_team:null})};var oe=class{homeTeam={players:[]};awayTeam={players:[]}};var Ct=class{id="";name="";position="";shirtNumber;assets=null;type=""};var ae=class{fromResponse(e){try{let t=new Ct;return t.id=e.id,t.name=e.name,t.position=e.position,t.shirtNumber=e.shirt_number,t.assets=e.assets,t.type=e.type,t}catch(t){throw console.warn("There was a problem remapping the player from timeline",t),t}}};var _t=class{playerRemapper=null;constructor(){this.playerRemapper=new ae}fromResponse(e){try{let t=new oe;return t.homeTeam.players=e.home_team&&e.home_team.players?e.home_team.players.map(r=>this.playerRemapper.fromResponse(r)):[],t.awayTeam.players=e.away_team&&e.away_team.players?e.away_team.players.map(r=>this.playerRemapper.fromResponse(r)):[],t}catch(t){throw console.warn("There was a problem remapping the lineups",t),t}}};var Ot=class{minute="";type="";teamId="";player=null;relatedPlayer=null;updatedAt=""};var xt=class{playerRemapper=null;constructor(){this.playerRemapper=new ae}fromResponse(e){try{let t=new Ot;return t.minute=e.minute,t.type=e.type,t.teamId=e.team_id,t.player=this.playerRemapper.fromResponse(e.player),t.relatedPlayer=e.related_player?this.playerRemapper.fromResponse(e.related_player):null,t.updatedAt=e.updated_at,t}catch(t){throw console.warn("There was a problem remapping timeline",t),t}}};var At=class{teamMapper=null;competitionsMapper=null;lineupsMapper=null;scoresMapper=null;statsMapper=null;timelineMapper=null;constructor(){this.teamMapper=new M,this.competitionsMapper=new I,this.lineupsMapper=new _t,this.scoresMapper=new ie,this.statsMapper=new Et,this.timelineMapper=new xt}fromResponse(e){try{let t=new St;return t.id=e.id,t.kickoffAt=e.kickoff_at,t.finishedAt=e.finished_at,t.updatedAt=e.updated_at,t.homeTeam=e.home_team?this.teamMapper.fromResponse(e.home_team):null,t.awayTeam=e.away_team?this.teamMapper.fromResponse(e.away_team):null,t.lineupsConfirmed=e.lineups_confirmed,t.startedAt=e.started_at,t.minute=e.minute,t.scores=this.scoresMapper.fromResponse(e.scores),t.stats=this.statsMapper.fromResponse(e.stats),t.context={competition:this.competitionsMapper.fromResponse(e.context.competition)},t.timeline=e.timeline?e.timeline.map(r=>this.timelineMapper.fromResponse(r)):[],t.status={type:e.status.type,subType:e.status.sub_type},t.lineups=e.lineups?this.lineupsMapper.fromResponse(e.lineups):new oe,t}catch(t){throw console.warn("There was a problem remapping the match response",t),t}}};var Bt=class{id="";country=null;birthDate="";firstName="";lastName="";name="";position="";assets=null};var Nt=class{countryRemapper=null;constructor(){this.countryRemapper=new y}fromResponse(e){try{let t=new Bt;return t.id=e.id,t.firstName=e.first_name?e.first_name:null,t.lastName=e.last_name?e.last_name:null,t.name=e.name?e.name:null,t.birthDate=e.birth_date,t.country=this.countryRemapper.countryFromResponse(e.country),t.assets=e.assets,t.position=e.position,t}catch(t){throw console.warn("There was a problem remapping top player response",t),t}}};var Lt=class{id="";country=null;birthDate="";firstName="";lastName="";name="";position="";assets=null;teams=[]};var se=class{countryRemapper=null;teamRemapper=null;constructor(){this.countryRemapper=new y,this.teamRemapper=new M}fromResponse(e){try{let t=new Lt;return t.id=e.id,t.firstName=e.first_name?e.first_name:null,t.lastName=e.last_name?e.last_name:null,t.name=e.name?e.name:null,t.birthDate=e.birth_date,t.country=this.countryRemapper.countryFromResponse(e.country),t.assets=e.assets,t.teams=e.teams?e.teams.map(r=>this.teamRemapper.fromResponse(r)):[],t.position=e.position,t}catch(t){throw console.warn("There was a problem remapping players response",t),t}}};var Gt=class{id="";country=null;birthDate="";firstName="";lastName="";name="";position="";assets=null;competitions=[];teams=[]};var Ut=class{countryRemapper=null;teamRemapper=null;competitionRemapper=null;constructor(){this.countryRemapper=new y,this.teamRemapper=new M,this.competitionRemapper=new I}fromResponse(e){try{let t=new Gt;return t.id=e.id,t.firstName=e.first_name?e.first_name:null,t.lastName=e.last_name?e.last_name:null,t.name=e.name?e.name:null,t.birthDate=e.birth_date,t.country=this.countryRemapper.countryFromResponse(e.country),t.assets=e.assets,t.teams=e.teams?e.teams.map(r=>this.teamRemapper.fromResponse(r)):[],t.position=e.position,t.competitions=e.competitions?e.competitions.map(r=>this.competitionRemapper.fromResponse(r)):[],t}catch(t){throw console.warn("There was a problem remapping player response",t),t}}};var Vt=class{teams=null;players=null;competitions=null};var Dt=class{teamRemapper=null;playerRemapper=null;competitionremapper=null;constructor(){this.teamRemapper=new M,this.playerRemapper=new se,this.competitionremapper=new I}fromResponse(e){try{let t=new Vt;return t.teams=e.teams?e.teams.map(r=>this.teamRemapper.fromResponse(r)):[],t.players=e.players?e.players.map(r=>this.playerRemapper.fromResponse(r)):[],t.competitions=e.competitions?e.competitions.map(r=>this.competitionremapper.fromResponse(r)):[],t}catch(t){throw console.warn("There was a problem remapping search response",t),t}}};var A=class{instance=null;apiSignInUrl="";idSchema="";limitIds=200;countryRemapper=null;competitionBasicRemapper=null;competitionFullRemapper=null;teamBasicRemapper=null;teamFullRemapper=null;matchBasicRemapper=null;matchFullRemapper=null;playerBasicRemapper=null;playerFullRemapper=null;topPlayerRemapper=null;searchRemapper=null;constructor(e){let t=x(e.environment,"football");this.apiSignInUrl=`?key=${e.apiKey}&lang=${e.lang}&client_id=${e.clientId}`,this.idSchema=e.idSchema,this.instance=vo.default.create({baseURL:t}),this.countryRemapper=new y,this.competitionBasicRemapper=new I,this.competitionFullRemapper=new Mt,this.teamBasicRemapper=new M,this.teamFullRemapper=new Rt,this.matchBasicRemapper=new vt,this.matchFullRemapper=new At,this.playerBasicRemapper=new se,this.playerFullRemapper=new Ut,this.topPlayerRemapper=new Nt,this.searchRemapper=new Dt}getCountries=async()=>{try{let e=await this.instance.get(`/countries${this.apiSignInUrl}`);return this.countryRemapper.countriesFromResponse(e.data.data)}catch(e){throw console.warn("There was a problem with the football countries request",e),e}};getCompetitions=async e=>{try{let t={};if(e&&e.competitionIds&&e.competitionIds.length>this.limitIds-1){let r=[],i=ke(e.competitionIds);for(let s of i)e.competitionIds=s,t=await this.instance.get(`/competitions${this.apiSignInUrl}${e.constructFilterUrl()}`),r.push(t.data.data.map(n=>this.competitionBasicRemapper.fromResponse(n)));return Array.prototype.concat.apply([],r)}else return t=e?await this.instance.get(`/competitions${this.apiSignInUrl}${e.constructFilterUrl()}`):await this.instance.get(`/competitions${this.apiSignInUrl}`),t.data.data.map(r=>this.competitionBasicRemapper.fromResponse(r))}catch(t){throw console.warn("There was a problem with getCompetitions request",t),t.response}};getCompetitionById=async e=>{try{let t=await this.instance.get(`/competitions/${e}${this.apiSignInUrl}`);return this.competitionFullRemapper.fromResponse(t.data.data)}catch(t){throw console.warn("There was a problem with getCompetitionById request",t),t.response}};getTopCompetitions=async()=>{try{return(await this.instance.get(`/competitions/top${this.apiSignInUrl}`)).data.data.map(t=>this.competitionBasicRemapper.fromResponse(t))}catch(e){throw console.warn("There was a problem with getTopCompetitions request",e),e.response}};getTeams=async e=>{try{let t={};if(e&&e.teamIds&&e.teamIds.length>this.limitIds-1){let r=[],i=ke(e.teamIds);for(let s of i)e.teamIds=s,t=await this.instance.get(`/teams${this.apiSignInUrl}${e.constructFilterUrl()}`),r.push(t.data.data.map(n=>this.teamBasicRemapper.fromResponse(n)));return Array.prototype.concat.apply([],r)}else return t=e?await this.instance.get(`/teams${this.apiSignInUrl}${e.constructFilterUrl()}`):await this.instance.get(`/teams${this.apiSignInUrl}`),t.data.data.map(r=>this.teamBasicRemapper.fromResponse(r))}catch(t){throw console.warn("There was a problem with getTeams request",t),t.response}};getTeamById=async e=>{try{let t=await this.instance.get(`/teams/${e}${this.apiSignInUrl}`);return this.teamFullRemapper.fromResponse(t.data.data)}catch(t){throw console.warn("There was a problem with getTeamById request",t),t.response}};getTopTeams=async()=>{try{let e=await this.instance.get(`/teams/top${this.apiSignInUrl}`);return e.data.data?e.data.data.map(t=>this.teamBasicRemapper.fromResponse(t)):[]}catch(e){throw console.warn("There was a problem with getTopTeams request",e),e.response}};getNextMatchForTeam=async e=>{try{let t=await this.instance.get(`/teams/${e}/next-match${this.apiSignInUrl}`);return this.matchFullRemapper.fromResponse(t.data.data)}catch(t){throw console.warn("There was a problem with getNextMatchForTeam request",t),t.response}};getPrevMatchForTeam=async e=>{try{let t=await this.instance.get(`/teams/${e}/previous-match${this.apiSignInUrl}`);return this.matchFullRemapper.fromResponse(t.data.data)}catch(t){throw console.warn("There was a problem with getPrevMatchForTeam request",t),t.response}};getPlayers=async e=>{try{let t={};if(e&&e.playerIds&&e.playerIds.length>this.limitIds-1){let r=[],i=ke(e.playerIds);for(let s of i)e.playerIds=s,t=await this.instance.get(`/players${this.apiSignInUrl}${e.constructFilterUrl()}`),r.push(t.data.data.map(n=>this.teamBasicRemapper.fromResponse(n)));return Array.prototype.concat.apply([],r)}else return(e?await this.instance.get(`/players${this.apiSignInUrl}${e.constructFilterUrl()}`):await this.instance.get(`/players${this.apiSignInUrl}`)).data.data.map(i=>this.playerBasicRemapper.fromResponse(i))}catch(t){throw console.warn("There was a problem with getPlayers request",t),t.response}};getPlayerById=async e=>{try{let t=await this.instance.get(`/players/${e}${this.apiSignInUrl}`);return this.playerFullRemapper.fromResponse(t.data.data)}catch(t){throw console.warn("There was a problem with getPlayerById request",t),t.response}};getTopPlayers=async()=>{try{return(await this.instance.get(`/players/top${this.apiSignInUrl}`)).data.data.map(t=>this.topPlayerRemapper.fromResponse(t))}catch(e){throw console.warn("There was a problem with getTopPlayers request",e),e.response}};getNextMatchForPlayer=async e=>{try{let t=await this.instance.get(`/players/${e}/next-match${this.apiSignInUrl}`);return this.matchFullRemapper.fromResponse(t.data.data)}catch(t){throw console.warn("There was a problem with getNextMatchForPlayer request",t),t.response}};getPrevMatchForPlayer=async e=>{try{let t=await this.instance.get(`/players/${e}/previous-match${this.apiSignInUrl}`);return this.matchFullRemapper.fromResponse(t.data.data)}catch(t){throw console.warn("There was a problem with getPrevMatchForPlayer request",t),t.response}};getMatchById=async e=>{try{let t=await this.instance.get(`/matches/${e}${this.apiSignInUrl}`);return this.matchFullRemapper.fromResponse(t.data.data)}catch(t){throw console.warn("There was a problem with getMatchById request",t),t.response}};getMatches=async e=>{try{return(e?await this.instance.get(`/matches${this.apiSignInUrl}${e.constructFilterUrl()}`):await this.instance.get(`/matches${this.apiSignInUrl}`)).data.data.map(r=>this.matchBasicRemapper.fromResponse(r))}catch(t){throw console.warn("There was a problem with getMatches request",t),t.response}};search=async e=>{try{let t=await this.instance.get(`/search${this.apiSignInUrl}${e.constructFilterUrl()}`);return this.searchRemapper.fromResponse(t.data.data)}catch(t){throw console.warn("There was a problem with search request",t),t.response}}};var $t=class{profileHttps=null;footballHttps=null;footballFacade=null;idMapping=null;localStorage=null;profileFacade=null;ownProfileBuilder=null;profileBuilder=null;constructor(e){this.profileHttps=new ze(e),this.footballHttps=new A(e),this.idMapping=new T(e),this.localStorage=new V(e),this.footballFacade=new k(this.localStorage,this.footballHttps,this.idMapping),this.profileFacade=new D(this.localStorage,this.profileHttps),this.ownProfileBuilder=new ut(this.localStorage,this.profileHttps,this.idMapping,this.footballHttps),this.profileBuilder=new dt(this.localStorage,this.profileHttps,this.idMapping,this.footballFacade)}getOwn=()=>this.ownProfileBuilder;getById=e=>this.profileBuilder.setId(e);getCountries=async()=>await this.profileFacade.getCountries();getByIds=async e=>await this.profileFacade.getByIds(e)};var Ht=class{validate=e=>{let t=this.validateField(e.lang),r=this.generateMessage(t);return{validation:t,message:r}};validateField=e=>{let t=["bg","ro","en"],r=null;return e!=null&&e.length>0?t.includes(e)?r="valid":r="invalid":r="missing",r};generateMessage=e=>{let t=null,r="warning";return e==="missing"&&(t="If no lang is passed the default one will be set which is: EN"),e==="invalid"&&(t="This lang value is not supported, the default one will be set which is: EN"),e==="valid"&&(t=null,r=null),{text:t,type:r}}};var kt=class{validate(e){let t=this.validateField(e.environment),r=this.generateMessage(t);return{validation:t,message:r}}validateField=e=>{let t=["dev","sandbox","prod"],r=null;return e!=null&&e.length>0?t.includes(e)?r="valid":r="invalid":r="missing",r};generateMessage=e=>{let t=null,r="warning";return e==="missing"&&(t="If no environment is passed the default one will be set which is: prod"),e==="invalid"&&(t="This environment value is not supported, the default one will be set which is: prod"),e==="valid"&&(t=null,r=null),{text:t,type:r}}};var qt=class{validate(e){let t=this.validateField(e.apiKey),r=this.generateMessage(t);return{validation:t,message:r}}validateField=e=>{let t=null;return e!=null&&e.length>0?t="valid":t="missing",t};generateMessage=e=>{let t=null,r="error";return e==="missing"&&(t="The field apiKey with valid value must be provided to use this SDK"),e==="valid"&&(r=null),{text:t,type:r}}};var jt=class{validate(e){let t=this.validateField(e.idSchema),r=this.generateMessage(t);return{validation:t,message:r}}validateField=e=>{let t=["native","sportal365","enetpulse","sportradar"],r=null;return e!=null&&e.length>0?t.includes(e)?r="valid":r="invalid":r="missing",r};generateMessage=e=>{let t=null,r="warning";return e==="missing"&&(t="If no idSchema is passed the default one will be set which is: native"),e==="invalid"&&(t="This idSchema value is not supported, the default one will be set which is: native"),e==="valid"&&(t=null,r=null),{text:t,type:r}}};var Oe=class{getIdToken=null;logout=null};var pe=class{text=null;type=null};var Xt=class{validation=null;message=new pe;getIdToken={validation:null,message:new pe};logout={validation:null,message:new pe}};var Kt=class{validate(e){let t=this.validateAuthProvider(e.authProvider);return t.validation!=="missing"&&(t=this.validateAuthProviderConfigFields(e.authProvider,t),t=this.generateAuthProviderConfigMessages(t),t=this.checkAuthProviderConfigMessagesForErrors(t)),t}validateAuthProvider=e=>{let t=Object.keys(new Oe),r=new Xt;if(e){let a=Object.keys(e).filter(s=>!t.includes(s));a.length>0?(r.validation="invalid",r.message.type="warning",r.message.text=`${"You have passed a property which is not supported for the authentication provider:"} ${a.join(",")}`):r.validation="valid"}else r.validation="missing",r.message.type="error",r.message.text="The field authProvider must be provided to use this SDK";return r};validateAuthProviderConfigFields=(e,t)=>(Object.keys(new Oe).forEach(i=>{e[i]?t[i].validation="valid":t[i].validation="missing"}),t);generateAuthProviderConfigMessages=e=>(Object.keys(e).filter(t=>t!=="validation"&&t!=="message").forEach(t=>{let r=e[t];r.validation==="missing"&&(r.message.text=`${"The following property is missing from the authProvider object:"} ${t}`,r.message.type="error")}),e);checkAuthProviderConfigMessagesForErrors=e=>(Object.keys(e).filter(t=>t!=="validation"&&t!=="message").forEach(t=>{e[t].validation==="missing"&&e.validation==="valid"&&(e.validation="invalid",e.message.type="error",e.message.text="The field authProvider has missing properties")}),e)};var xe=class{validation;message};var Yt=class{apiKey=null;environment=null;idSchema=null;clientId=null;lang=null;authProvider={getIdToken:new xe,logout:new xe};isValid=!1};var Wt=class{validate(e){let t=this.validateField(e.clientId),r=this.generateMessage(t);return{validation:t,message:r}}validateField=e=>{let t=null;return e!=null&&e.length>0?t="valid":t="missing",t};generateMessage=e=>{let t=null,r="warning";return e==="missing"&&(t="The field clientId must be provided to use this SDK"),e==="valid"&&(t=null,r=null),{text:t,type:r}}};var zt=class{validate=e=>{let t=this.checkFieldsForValues(e);return t.isValid=this.containsErrorMessage(t),t};checkFieldsForValues=e=>{let t=new Yt,r={apiKey:new qt,environment:new kt,idSchema:new jt,clientId:new Wt,lang:new Ht,authProvider:new Kt};for(let[i,a]of Object.entries(t))i!=="isValid"&&(a=r[i].validate(e));return Object.keys(r).forEach(i=>{t[i]=r[i].validate(e)}),t};containsErrorMessage=e=>{let t=!0;for(let[r,i]of Object.entries(e))if(r!=="authProvider"){if(r!=="isValid"&&i.message.type==="error")return t=!1,t;if(r!=="isValid"&&i.message.type==="warning")return t=!0,t}return t}};var Qt=class{https=null;idMapping=null;localStorage=null;footballFacade=null;constructor(e){this.https=new A(e),this.idMapping=new T(e),this.localStorage=new V(e),this.footballFacade=new k(this.localStorage,this.https,this.idMapping)}getCountries=async()=>await this.footballFacade.getCountries();getCompetitions=async e=>await this.footballFacade.getCompetitions(e);getCompetitionById=async e=>await this.footballFacade.getCompetitionById(e);getTopCompetitions=async()=>await this.footballFacade.getTopCompetitions();getTeams=async e=>await this.footballFacade.getTeams(e);getTeamById=async e=>await this.footballFacade.getTeamById(e);getTopTeams=async()=>await this.footballFacade.getTopTeams();getNextMatchForTeam=async e=>await this.footballFacade.getNextMatchForTeam(e);getPrevMatchForTeam=async e=>await this.footballFacade.getPrevMatchForTeam(e);getPlayers=async e=>await this.footballFacade.getPlayers(e);getPlayerById=async e=>await this.footballFacade.getPlayerById(e);getTopPlayers=async()=>await this.footballFacade.getTopPlayers();getNextMatchForPlayer=async e=>await this.footballFacade.getNextMatchForPlayer(e);getPrevMatchForPlayer=async e=>await this.footballFacade.getPrevMatchForPlayer(e);getMatches=async e=>await this.footballFacade.getMatches(e);getMatchById=async e=>await this.footballFacade.getMatchById(e);search=async e=>await this.footballFacade.search(e)};var ui=be(te());var Jt=class{value=null;playerId=null;playerModel=null};var ce=class{market=null;matchId=null;matchType=null;matchModel=null;prediction=new Jt;result=null};var Zt=class{value=!1;playerId=null};var _=class{matchId=null;market=null;prediction=null;constructor(e,t,r,i){this.matchId=e,this.market=t,this.prediction=new Zt,this.prediction.value=r,this.prediction.playerId=i}};var me=class{settledAt=null;resettledAt=null;status=null;outcome=null};var P=(d=>(d.FT_1X2="FT_1X2",d.HT_1X2="HT_1X2",d.BOTH_TEAMS_SCORE="BOTH_TEAMS_SCORE",d.DOUBLE_CHANCE="DOUBLE_CHANCE",d.HT_FT="HT_FT",d.PLAYER_SCORE="PLAYER_SCORE",d.PLAYER_YELLOW_CARD="PLAYER_YELLOW_CARD",d.PLAYER_RED_CARD="PLAYER_RED_CARD",d.RED_CARD_MATCH="RED_CARD_MATCH",d.PENALTY_MATCH="PENALTY_MATCH",d.PLAYER_SCORE_FIRST_GOAL="PLAYER_SCORE_FIRST_GOAL",d.CORNERS_MATCH="CORNERS_MATCH",d.CORRECT_SCORE="CORRECT_SCORE",d.PLAYER_SCORE_HATTRICK="PLAYER_SCORE_HATTRICK",d.PLAYER_SCORE_TWICE="PLAYER_SCORE_TWICE",d.OVER_GOALS_0_5="OVER_GOALS_0.5",d.OVER_GOALS_1_5="OVER_GOALS_1.5",d.OVER_GOALS_2_5="OVER_GOALS_2.5",d.OVER_GOALS_3_5="OVER_GOALS_3.5",d.OVER_GOALS_4_5="OVER_GOALS_4.5",d.OVER_GOALS_5_5="OVER_GOALS_5.5",d.OVER_GOALS_6_5="OVER_GOALS_6.5",d.OVER_CORNERS_6_5="OVER_CORNERS_6.5",d.OVER_CORNERS_7_5="OVER_CORNERS_7.5",d.OVER_CORNERS_8_5="OVER_CORNERS_8.5",d.OVER_CORNERS_9_5="OVER_CORNERS_9.5",d.OVER_CORNERS_10_5="OVER_CORNERS_10.5",d.OVER_CORNERS_11_5="OVER_CORNERS_11.5",d.OVER_CORNERS_12_5="OVER_CORNERS_12.5",d.OVER_CORNERS_13_5="OVER_CORNERS_13.5",d))(P||{}),So=["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"],To=["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"],li=["PLAYER_RED_CARD","PLAYER_SCORE","PLAYER_SCORE_FIRST_GOAL","PLAYER_SCORE_HATTRICK","PLAYER_SCORE_TWICE","PLAYER_YELLOW_CARD"];var er=class{value=null};var q=class{matchId=null;market="CORRECT_SCORE";prediction=null;constructor(e,t){this.matchId=e,this.prediction=new er,this.prediction.value=t}};var E=class{value=!1};var ue=class{matchId=null;market=null;prediction=null;constructor(e,t,r){this.matchId=e,this.market=t,this.prediction=new E,this.prediction.value=r}};var de=class{matchId=null;market=null;prediction=null;constructor(e,t,r){this.matchId=e,this.market=t,this.prediction=new E,this.prediction.value=r}};var tr=class{matchFacade=null;playerFacade=null;predictorService=null;constructor(e,t,r){this.matchFacade=e,this.playerFacade=t,this.predictorService=r}remapFixturesRequest=e=>{let t={};if(t.match_id=e.matchId,t.match_type="FOOTBALL",e instanceof _)t.market=e.market,t.prediction=e.prediction.value,t.player_id=e.prediction.playerId;else if(e instanceof ue||e instanceof de){let r=e.market.split("_");t.market=r[0]+"_"+r[1],t.prediction=e.prediction.value,t.target=Number(r[2])}else if(e instanceof q){t.market=e.market;let r=e.prediction.value.split(":");t.goals_home=Number(r[0]),t.goals_away=Number(r[1])}else t.market=e.market,t.prediction=e.prediction.value;return t};remapFixturesResponse=async e=>{e.length>1&&e.sort((n,p)=>n.match_id.localeCompare(p.match_id));let t=[],r=[];for(let n of e)t.push(n.match_id),n.player_id&&!r.includes(n.player_id)&&r.push(n.player_id);let i=await this.matchFacade.getMatchesMapWithNativeIds(t),a=[];r.sort((n,p)=>n.localeCompare(p)),r&&r.length>0&&(a=await this.playerFacade.getPlayersMapWithNativeIds(r));let s=[];for(let n of e){let p=new ce;n.target?p.market=this.predictorService.convertMarketForResponseModel(n.market,n.target):p.market=n.market,p.matchId=i[n.match_id].id,p.matchType=n.match_type,p.matchModel=i?i[n.match_id]:null,n.goals_home!==void 0&&n.goals_away!==void 0?p.prediction.value=n.goals_home.toString()+":"+n.goals_away.toString():p.prediction.value=n.prediction,p.prediction.playerId=n.player_id?n.player_id:null,p.prediction.playerId&&(p.prediction.playerModel=a[n.player_id],p.prediction.playerId=a[n.player_id].id),p.result=this.remapResult(n.result),s.push(p)}return s};remapResult=e=>{let t=new me;return t.settledAt=e.settled_at,t.resettledAt=e.resettled_at,t.status=e.status,t.outcome=e.outcome,t}};var he=class{goldenGoal=null};var Ae=class{id=null;gameInstanceId=null;gameType=null;wager=null;totalFixtures=null;settledFixtures=null;userId=null;fixtures=[];status=null;tiebreaker=new he;points=null;createdAt=null;updatedAt=null};var m=class{no=0;yes=0};var fe=class{fullTimeOneXTwo={};halfTimeOneXTwo={};bothTeamsScore=new m;doubleChance={};halfTimeFullTime={};playerScore={};playerYellowCard={};playerRedCard={};redCardMatch=new m;penaltyMatch=new m;playerScoreFirstGoal={};cornersMatch={};correctScore={};playerScoreHattrick={};playerScoreTwice={};overZeroPointFiveGoals=new m;overOnePointFiveGoals=new m;overTwoPointFiveGoals=new m;overThreePointFiveGoals=new m;overFourPointFiveGoals=new m;overFivePointFiveGoals=new m;overSixPointFiveGoals=new m;overSixPointFiveCorners=new m;overSevenPointFiveCorners=new m;overEightPointFiveCorners=new m;overNinePointFiveCorners=new m;overTenPointFiveCorners=new m;overElevenPointFiveCorners=new m;overTwelvePointFiveCorners=new m;overThirteenPointFiveCorners=new m};var pi=(r=>(r.ONE="1",r.X="x",r.TWO="2",r))(pi||{}),ci=(r=>(r.ONE_X="1x",r.X_TWO="x2",r.ONE_TWO="12",r))(ci||{}),mi=(u=>(u.ONE_ONE="1/1",u.ONE_X="1/x",u.ONE_TWO="1/2",u.X_ONE="x/1",u.X_X="x/x",u.X_TWO="x/2",u.TWO_ONE="2/1",u.TWO_X="2/x",u.TWO_TWO="2/2",u))(mi||{});var rr=class{value=null};var ir=class{matchId=null;market="HT_FT";prediction=null;constructor(e,t){this.matchId=e,this.prediction=new rr,this.prediction.value=t}};var or=class{value=null};var ar=class{matchId=null;market="DOUBLE_CHANCE";prediction=null;constructor(e,t){this.matchId=e,this.prediction=new or,this.prediction.value=t}};var ye=class{value=null};var sr=class{matchId=null;market="FT_1X2";prediction=null;constructor(e,t){this.matchId=e,this.prediction=new ye,this.prediction.value=t}};var nr=class{matchId=null;market="HT_1X2";prediction=null;constructor(e,t){this.matchId=e,this.prediction=new ye,this.prediction.value=t}};var lr=class{value};var pr=class{matchId=null;market="CORNERS_MATCH";prediction=null;constructor(e,t){this.matchId=e,this.prediction=new lr,this.prediction.value=t}};var cr=class{matchId=null;market="BOTH_TEAMS_SCORE";prediction=null;constructor(e,t){this.matchId=e,this.prediction=new E,this.prediction.value=t}};var mr=class{matchId=null;market="RED_CARD_MATCH";prediction=null;constructor(e,t){this.matchId=e,this.prediction=new E,this.prediction.value=t}};var ur=class{matchId=null;market="PENALTY_MATCH";prediction=null;constructor(e,t){this.matchId=e,this.prediction=new E,this.prediction.value=t}};var Y=class{id=null;title=null;description=null;type=null;status=null;predictionsCutoff=null;fixtures=[];createdAt=null;updatedAt=null};var W=class{userId=null;points=null;results=[];tiebreaker=null};var dr=(a=>(a.ACTIVE="ACTIVE",a.WON="WON",a.LOST="LOST",a.PARTIALLY_WON="PARTIALLY_WON",a.CANCELED="CANCELED",a))(dr||{}),Be=["WON","LOST","PARTIALLY_WON","CANCELED"];var w=class{limit=null;startAfter=null;status=null;type=null;constructor(e){this.limit=e.limit?e.limit:null,this.startAfter=e.startAfter?e.startAfter:null,this.status=e.status?e.status:null,this.type=e.type?e.type:null}constructFilterUrl=()=>{let e="",t=!1;return this.status&&(t=Object.values(dr).some(r=>this.status.includes(r))),this.limit&&(e+="&",e+=`limit=${this.limit}`),this.startAfter&&(e+="&",e+=`start_after=${this.startAfter}`),this.status&&t&&(e+="&",e+=`status=${this.status.join(",")}`),this.type&&(e+="&",e+=`game_types=${this.type}`),e}};var Ne=(s=>(s.OPEN="OPEN",s.LIVE="LIVE",s.PENDING="PENDING",s.CANCELED="CANCELED",s.CLOSED="CLOSED",s.SETTLED="SETTLED",s))(Ne||{});var v=class{limit=null;startAfter=null;status=null;type=null;gameIds=null;constructor(e){this.limit=e.limit?e.limit:null,this.startAfter=e.startAfter?e.startAfter:null,this.status=e.status?e.status:null,this.type=e.type?e.type:null,this.gameIds=e.gameIds?e.gameIds:null}constructFiltersUrl=()=>{let e="";return this.limit&&(e+="&",e+=`limit=${this.limit}`),this.startAfter&&(e+="&",e+=`start_after=${this.startAfter}`),this.status&&Object.values(Ne).includes(this.status)&&(e+="&",e+=`status=${this.status}`),this.type&&(e+="&",e+=`type=${this.type}`),this.gameIds&&this.gameIds.length>0&&(e+="&",e+=`game_ids=${this.gameIds.join(",")}`),e}};var z=class{id=null;title=null;description=null;type=null;status=null;predictionsCutoff=null;fixtures=[];createdAt=null;updatedAt=null};var G=class{id=null;title=null;description=null;type=null;status=null;predictionsCutoff=null;fixtures=[];createdAt=null;updatedAt=null};var B=class{footballHttps=null;idMapping=null;matchFacade=null;playerFacade=null;constructor(e,t){this.footballHttps=new A(e),this.idMapping=t,this.matchFacade=new H(this.footballHttps,t),this.playerFacade=new $(this.footballHttps,t)}remapMatchIdToNative=async e=>{let t=await this.idMapping.getEntityIdsBySchemaId(e,"match","native"),r=[];return t.match.forEach(i=>r.push(i)),r};remapPlayerIdToNative=async e=>(await this.idMapping.getEntityIdsBySchemaId(e,"player","native")).player[0];remapPlayerIdMapToNative=async e=>{let t={},r=U(e),a=(await this.idMapping.getEntityIdsBySchemaId(r,"player","native")).player;return r.forEach((s,n)=>t[s]=a[n]),t};remapPlayerIdToIdSchema=async e=>{let t=["playerScore","playerYellowCard","playerRedCard","playerScoreFirstGoal","playerScoreHattrick","playerScoreTwice"];for(let[r,i]of Object.entries(e))if(t.includes(r))for(let a of Object.keys(i)){let s={player:[a]},p=(await this.idMapping.idMappingFacade.getEntitiesByIds(s,"native",this.idMapping.idSchema)).player[0];i[p]=i[a],delete i[a]}return e};convertMarket=e=>{let t=Object.keys(new fe),r=Object.values(P);for(let i=0;i<r.length;i++)e===r[i]&&(e=t[i]);return e};convertMarketForResponseModel=(e,t)=>{let r=t.toString();return e+"_"+r};validateFixture=(e,t,r,i)=>{let a=Object.values(pi),s=Object.values(mi),n=Object.values(ci);if(t==="FT_1X2"){if(a.includes(r))return new sr(e,r)}else if(t==="HT_1X2"){if(a.includes(r))return new nr(e,r)}else if(t==="HT_FT"){if(s.includes(r))return new ir(e,r)}else if(t==="DOUBLE_CHANCE"){if(n.includes(r))return new ar(e,r)}else if(t==="CORRECT_SCORE"){if(typeof r=="string"&&/\d+:\d+/.test(r))return new q(e,r)}else if(t==="CORNERS_MATCH"){if(typeof r=="number")return new pr(e,r)}else if(t==="BOTH_TEAMS_SCORE"){if(typeof r=="boolean")return new cr(e,r)}else if(t==="RED_CARD_MATCH"){if(typeof r=="boolean")return new mr(e,r)}else if(t==="PENALTY_MATCH"){if(typeof r=="boolean")return new ur(e,r)}else if(li.includes(t)){if(i&&typeof r=="boolean")return new _(e,t,r,i)}else if(So.includes(t)){if(typeof r=="boolean")return new de(e,t,r)}else if(To.includes(t)&&typeof r=="boolean")return new ue(e,t,r)};getMarketSummary=(e,t,r)=>{let i=this.convertMarket(t),a={};if(a.matchId=e.matchId,a.matchType=e.matchType,Object.keys(e.predictions).includes(i))a[i]=e.predictions[i];else throw new Error("You have passed invalid market");return li.includes(t)&&r?(a[i][r]||(a[i][r]=new m),a[i][r]):a};remapCompetitionsFromConfig=async e=>{let t={competition:e.fullCoverageCompetitions},r=await this.idMapping.idMappingFacade.getEntitiesByIds(t,"native",this.idMapping.idSchema);return e.fullCoverageCompetitions=r.competition,e};remapMatchIdsFixtures=async e=>{if(Array.isArray(e))if(e.length>0){let t=[],r=[];return e.forEach(i=>{i instanceof z||i instanceof Y||i instanceof G?(i.fixtures.forEach(a=>t.push(a.matchId)),i instanceof G&&i.fixtures.forEach(a=>{a.prediction.playerId&&r.push(a.prediction.playerId)})):i instanceof W&&i.results.forEach(a=>t.push(a.matchId))}),await this.refactorResponseArrModel(e,t,r)}else return e;else return await this.refactorResponseObjModel(e)};refactorResponseArrModel=async(e,t,r)=>{let i=[],a=await this.matchFacade.getMatchesMapWithNativeIds(t),s={};return r.length>0&&(s=await this.playerFacade.getPlayersMapWithNativeIds(r)),e.forEach(n=>{n instanceof z||n instanceof Y||n instanceof G?(n.fixtures.forEach(p=>{p.matchModel=a[p.matchId],p.matchId=p.matchModel.id,n instanceof G&&p.prediction.playerId&&(p.prediction.playerModel=s[p.prediction.playerId],p.prediction.playerId=s[p.prediction.playerId].id)}),i.push(n)):n instanceof W&&(n.results.forEach(p=>{p.matchModel=a[p.matchId],p.matchId=p.matchModel.id}),i.push(n))}),i};refactorResponseObjModel=async e=>{let t=[];e.fixtures.forEach(i=>t.push(i.matchId));let r=await this.matchFacade.getMatchesMapWithNativeIds(t);return e.fixtures.forEach(i=>{i.matchModel=r[i.matchId],i.matchId=r[i.matchId].id}),e};getCurrentGameId=e=>{let t=new Date;if(e.length>1){let r=[];return e.forEach(a=>r.push(a.predictionsCutoff)),e.sort((a,s)=>{let[n,p]=[a.predictionsCutoff,s.predictionsCutoff].map(u=>Math.abs(new Date(u)-t));return n-p})[0].id}else return e[0].id};initGameTypePredictions=e=>{let t={type:e};return t=new w(t),t};initGameFilters=(e,t,r)=>{if(t&&r)return t.type=e,t.gameIds=r,t=new v(t),t;if(t&&!r)return t.type=e,t=new v(t),t;if(!t&&r){let i={type:e,gameIds:r};return i=new v(i),i}else{let i={type:e};return i=new v(i),i}};addPredictionProp=async(e,t)=>(t.forEach((r,i)=>{r.id===e[i].game_instance_id&&r.fixtures.forEach((a,s)=>{e[i].fixtures[s].goals_home!==void 0&&e[i].fixtures[s].goals_away!==void 0?a.prediction.value=e[i].fixtures[s].goals_home+":"+e[i].fixtures[s].goals_away:a.prediction.value=e[i].fixtures[s].prediction,e[i].fixtures[s].player_id?a.prediction.playerId=e[i].fixtures[s].player_id:e[i].fixtures[s].target&&(a.prediction.target=e[i].fixtures[s].target),a.prediction.result=this.remapResult(e[i].fixtures[s].result)})}),await this.remapMatchIdsFixtures(t));remapResult=e=>{let t=new me;return t.settledAt=e.settled_at,t.resettledAt=e.resettled_at,t.status=e.status,t.outcome=e.outcome,t}};var ge=class{gameInstanceId=null;fixtures=[];tiebreaker=null;constructor(e){this.gameInstanceId=e.gameInstanceId,e.fixtures.forEach(t=>this.fixtures.push(new q(t.matchId,t.prediction.value))),this.tiebreaker=e.tiebreaker?e.tiebreaker:null}};var Me=class{fixturesRemapper=null;footballHttps=null;matchFacade=null;playerFacade=null;predictorService=null;constructor(e,t){this.footballHttps=new A(e),this.matchFacade=new H(this.footballHttps,t),this.playerFacade=new $(this.footballHttps,t),this.predictorService=new B(e,t),this.fixturesRemapper=new tr(this.matchFacade,this.playerFacade,this.predictorService)}remapRequestBody=e=>{let t={};return t.game_instance_id=e.gameInstanceId,t.fixtures=e.fixtures.map(r=>this.fixturesRemapper.remapFixturesRequest(r)),e instanceof ge&&e.tiebreaker&&(t.tiebreaker={},t.tiebreaker.golden_goal=e.tiebreaker.goldenGoal?e.tiebreaker.goldenGoal:null),t};remapResponseArrayBody=async e=>{let t=[],r=[],i={},a=[];e.forEach(n=>{n.fixtures.forEach(p=>{t.push(p.match_id),p.player_id&&r.push(p.player_id)})});let s=await this.matchFacade.getMatchesMapWithNativeIds(t);return r.length>0&&(i=await this.playerFacade.getPlayersMapWithNativeIds(r)),e.forEach(n=>{let p=new Ae,u=[];p.id=n.id,p.gameInstanceId=n.game_instance_id,p.gameType=n.game_type,p.wager=n.wager,p.totalFixtures=n.total_fixtures,p.settledFixtures=n.settled_fixtures,p.userId=n.user_id,n.fixtures.forEach(l=>{let c=new ce;l.target?c.market=this.predictorService.convertMarketForResponseModel(l.market,l.target):c.market=l.market,c.matchId=s[l.match_id].id,c.matchType=l.match_type,c.matchModel=s[l.match_id],l.goals_home!==void 0&&l.goals_away!==void 0?c.prediction.value=l.goals_home.toString()+":"+l.goals_away.toString():c.prediction.value=l.prediction,c.prediction.playerId=l.player_id?l.player_id:null,c.prediction.playerId&&(c.prediction.playerModel=i[c.prediction.playerId],c.prediction.playerId=i[c.prediction.playerId].id),c.result=this.fixturesRemapper.remapResult(l.result),u.push(c)}),p.fixtures=u,p.status=n.status,n.tiebreaker?p.tiebreaker.goldenGoal=n.tiebreaker.golden_goal:p.tiebreaker=null,p.points=n.points,p.createdAt=n.created_at,p.updatedAt=n.updated_at,a.push(p)}),a};remapResponseObjBody=async e=>{let t=new Ae;return t.id=e.id,t.gameInstanceId=e.game_instance_id,t.gameType=e.game_type,t.wager=e.wager,t.totalFixtures=e.total_fixtures,t.settledFixtures=e.settled_fixtures,t.userId=e.user_id,t.fixtures=await this.fixturesRemapper.remapFixturesResponse(e.fixtures),t.status=e.status,e.tiebreaker?t.tiebreaker.goldenGoal=e.tiebreaker.golden_goal:t.tiebreaker=null,t.points=e.points,t.createdAt=e.created_at,t.updatedAt=e.updated_at,t};remapPredictionModel=e=>{let t=new fe;return t.fullTimeOneXTwo=e.FT_1X2,t.halfTimeOneXTwo=e.HT_1X2,t.bothTeamsScore=e.BOTH_TEAMS_SCORE?e.BOTH_TEAMS_SCORE:new m,t.overZeroPointFiveGoals=e.OVER_GOALS["over:0.5"]?e.OVER_GOALS["over:0.5"]:new m,t.overOnePointFiveGoals=e.OVER_GOALS["over:1.5"]?e.OVER_GOALS["over:1.5"]:new m,t.overTwoPointFiveGoals=e.OVER_GOALS["over:2.5"]?e.OVER_GOALS["over:2.5"]:new m,t.overThreePointFiveGoals=e.OVER_GOALS["over:3.5"]?e.OVER_GOALS["over:3.5"]:new m,t.overFourPointFiveGoals=e.OVER_GOALS["over:4.5"]?e.OVER_GOALS["over:4.5"]:new m,t.overFivePointFiveGoals=e.OVER_GOALS["over:5.5"]?e.OVER_GOALS["over:5.5"]:new m,t.overSixPointFiveGoals=e.OVER_GOALS["over:6.5"]?e.OVER_GOALS["over:6.5"]:new m,t.overSixPointFiveCorners=e.OVER_CORNERS["over:6.5"]?e.OVER_CORNERS["over:6.5"]:new m,t.overSevenPointFiveCorners=e.OVER_CORNERS["over:7.5"]?e.OVER_CORNERS["over:7.5"]:new m,t.overEightPointFiveCorners=e.OVER_CORNERS["over:8.5"]?e.OVER_CORNERS["over:8.5"]:new m,t.overNinePointFiveCorners=e.OVER_CORNERS["over:9.5"]?e.OVER_CORNERS["over:9.5"]:new m,t.overTenPointFiveCorners=e.OVER_CORNERS["over:10.5"]?e.OVER_CORNERS["over:10.5"]:new m,t.overElevenPointFiveCorners=e.OVER_CORNERS["over:11.5"]?e.OVER_CORNERS["over:11.5"]:new m,t.overTwelvePointFiveCorners=e.OVER_CORNERS["over:12.5"]?e.OVER_CORNERS["over:12.5"]:new m,t.overThirteenPointFiveCorners=e.OVER_CORNERS["over:13.5"]?e.OVER_CORNERS["over:13.5"]:new m,t.doubleChance=e.DOUBLE_CHANCE,t.halfTimeFullTime=e.HT_FT,t.playerScore=e.PLAYER_SCORE,t.playerYellowCard=e.PLAYER_YELLOW_CARD,t.playerRedCard=e.PLAYER_RED_CARD,t.redCardMatch=e.RED_CARD_MATCH?e.RED_CARD_MATCH:new m,t.penaltyMatch=e.PENALTY_MATCH?e.PENALTY_MATCH:new m,t.playerScoreFirstGoal=e.PLAYER_SCORE_FIRST_GOAL,t.cornersMatch=e.CORNERS_MATCH,t.correctScore=e.CORRECT_SCORE,t.playerScoreHattrick=e.PLAYER_SCORE_HATTRICK,t.playerScoreTwice=e.PLAYER_SCORE_TWICE,t}};var hr=class{matchId=null;matchType=null;predictions=null};var fr=class{remapPredictions=null;constructor(e,t){this.remapPredictions=new Me(e,t)}remapResponse=e=>{let t=new hr;return t.matchId=e.match_id,t.matchType=e.match_type,t.predictions=this.remapPredictions.remapPredictionModel(e.predictions),t}};var yr=class{matchId=null;matchType=null;market=null;matchModel=null};var gr=class{value=null;target=null;playerId=null;playerModel=null;result=null};var Mr=class{matchId=null;matchType=null;market=null;matchModel=null;prediction=new gr};var wr=class{value=null;result=null};var br=class{matchId=null;matchType=null;market="CORRECT_SCORE";matchModel=null;prediction=new wr};var Ir=class{matchId=null;matchModel=null;outcome=null};var Rr=class{remapGamesListResponse=e=>{let t=new z;return t.id=e.id,t.title=e.title,t.description=e.description,t.type=e.type,t.status=e.status,t.predictionsCutoff=e.predictions_cutoff,t.fixtures=e.fixtures.map(r=>this.remapFixturesResponse(r)),t.createdAt=e.created_at,t.updatedAt=e.updated_at,t};remapFixturesResponse=e=>{let t=new yr;return t.matchId=e.match_id,t.matchType=e.match_type,t.market=e.market,t};remapUserTopXEditionsResponse=e=>{let t=new Y;return t.id=e.id,t.title=e.title,t.description=e.description,t.type=e.type,t.status=e.status,t.predictionsCutoff=e.predictions_cutoff,t.fixtures=e.fixtures.map(r=>this.remapTopXFixturesResponse(r)),t.createdAt=e.created_at,t.updatedAt=e.updated_at,t};remapTopXFixturesResponse=e=>{let t=new br;return t.matchId=e.match_id,t.matchType=e.match_type,t};remapUserMatchQuizEditionsResponse=e=>{let t=new G;return t.id=e.id,t.title=e.title,t.description=e.description,t.type=e.type,t.status=e.status,t.predictionsCutoff=e.predictions_cutoff,t.fixtures=e.fixtures.map(r=>this.remapMatchQuizFixturesResponse(r)),t.createdAt=e.created_at,t.updatedAt=e.updated_at,t};remapMatchQuizFixturesResponse=e=>{let t=new Mr;return t.matchId=e.match_id,t.matchType=e.match_type,t.market=e.market,t};remapGameResults=e=>{let t=new W;return t.userId=e.user_id,t.points=e.points?e.points:0,t.results=e.results.map(r=>this.remapResults(r)),t.tiebreaker=e.tiebreaker?this.remapTiebreaker(e.tiebreaker):null,t};remapResults=e=>{let t=new Ir;return t.matchId=e.match_id,t.outcome=e.outcome,t};remapTiebreaker=e=>{let t=new he;return t.goldenGoal=e.golden_goal,t}};var j=class{instanceAuth=null;instance=null;apiSignInUrl=null;clientApiSignInUrl=null;predictionRemapper=null;matchSummaryRemapper=null;gamesRemapper=null;constructor(e,t){let r=x(e.environment,"predictor");this.apiSignInUrl=`?key=${e.apiKey}&client_id=${e.clientId}`,this.predictionRemapper=new Me(e,t),this.matchSummaryRemapper=new fr(e,t),this.gamesRemapper=new Rr,this.instanceAuth=ui.default.create({baseURL:r,headers:{Authorization:`Bearer ${e.authProvider.getIdToken()}`,"Content-Type":"application/json"}}),this.instance=ui.default.create({baseURL:r,headers:{"Content-Type":"application/json"}})}makeFootballPrediction=async e=>{try{let t=this.predictionRemapper.remapRequestBody(e),r=await this.instanceAuth.post(`/predictions${this.apiSignInUrl}`,JSON.stringify(t));return await this.predictionRemapper.remapResponseObjBody(r.data)}catch(t){throw console.warn("There was a problem making POST request: ",t),t.response}};getMatchSummary=async e=>{try{let t=await this.instance.get(`/predictions/summary/${e}${this.apiSignInUrl}`);return this.matchSummaryRemapper.remapResponse(t.data)}catch(t){throw console.warn(`There was a problem fetching predictions for match: ${e} `,t),t.response}};deleteFootballPrediction=async e=>{try{return await this.instanceAuth.delete(`/predictions/${e}${this.apiSignInUrl}`),!0}catch(t){throw console.warn(`There was a problem deleting your prediction: ${e}`,t),t.response}};getMyPredictions=async e=>{try{let t=e?await this.instanceAuth.get(`/predictions${this.apiSignInUrl}${e.constructFilterUrl()}`):await this.instanceAuth.get(`/predictions${this.apiSignInUrl}`);return await this.predictionRemapper.remapResponseArrayBody(t.data.data)}catch(t){throw console.warn("There was a problem fetching own predictions",t),t.response}};getMyPredictionsNoRemap=async e=>{try{return(await this.instanceAuth.get(`/predictions${this.apiSignInUrl}${e.constructFilterUrl()}`)).data.data}catch(t){throw console.warn("There was a problem fetching own predictions",t),t.response}};getUserPredictions=async(e,t)=>{try{let r=t?await this.instance.get(`/predictions/users/${e}${this.apiSignInUrl}${t.constructFilterUrl()}`):await this.instance.get(`/predictions/users/${e}${this.apiSignInUrl}`);return await this.predictionRemapper.remapResponseArrayBody(r.data.data)}catch(r){throw console.warn(`There was a problem fetching predictions for user: ${e}`,r),r.response}};getUserPredictionsNoRemap=async(e,t)=>{try{return(await this.instance.get(`/predictions/users/${e}${this.apiSignInUrl}${t.constructFilterUrl()}`)).data.data}catch(r){throw console.warn(`There was a problem fetching predictions for user: ${e}`,r),r.response}};getGames=async e=>{try{return(await this.instance.get(`/games/${this.apiSignInUrl}${e.constructFiltersUrl()}`)).data.data.map(r=>this.gamesRemapper.remapGamesListResponse(r))}catch(t){throw console.warn("There was a problem fetching the games list",t),t.response}};getGameById=async e=>{try{let t=await this.instance.get(`/games/${e}${this.apiSignInUrl}`);return this.gamesRemapper.remapGamesListResponse(t.data)}catch(t){throw console.warn(`There was a problem fetching the following game: ${e}`,t),t.response}};getUserGameEditions=async e=>{try{return(await this.instance.get(`/games/${this.apiSignInUrl}${e.constructFiltersUrl()}`)).data.data.map(r=>{if(r.type==="TOP_X")return this.gamesRemapper.remapUserTopXEditionsResponse(r);if(r.type==="MATCH_QUIZ")return this.gamesRemapper.remapUserMatchQuizEditionsResponse(r)})}catch(t){throw console.warn("There was a problem fetching the games list",t),t.response}};getGameResults=async(e,t)=>{try{return(t?await this.instance.get(`/games/${e}/results/${this.apiSignInUrl}${t.constructFiltersUrl()}`):await this.instance.get(`/games/${e}/results/${this.apiSignInUrl}`)).data.data.map(i=>this.gamesRemapper.remapGameResults(i))}catch(r){throw console.warn(`There was a problem fetching the results for the following game: ${e}`,r),r.response}}};var Fr=class{fullCoverageCompetitions=null;markets=null};var Pr=class{remapConfig=e=>{let t=new Fr;return t.fullCoverageCompetitions=e.full_coverage_competitions,t.markets=e.markets,t}};var vr=class{gameInstanceId=null;fixtures=null};var Sr=class{predictorHttps=null;clientHttps=null;idMapping=null;predictorConfigRemapper=null;predictorService=null;constructor(e,t,r,i){this.predictorHttps=t,this.idMapping=i,this.clientHttps=r,this.predictorConfigRemapper=new Pr,this.predictorService=new B(e,i)}makeFootballPrediction=async(e,t,r,i)=>{let a=this.predictorService.validateFixture(e,t,r,i),s=new vr;if(a)if(this.idMapping.idSchema!=="native"){let n=a.matchId,p="",u=await this.predictorService.remapMatchIdToNative([n]);if(a.matchId=u[0],!a.matchId)throw new Error("Match id is invalid!");if(a instanceof _&&(p=a.prediction.playerId,a.prediction.playerId=await this.predictorService.remapPlayerIdToNative([p]),!a.prediction.playerId))throw new Error("Player id is invalid!");s.fixtures=[a];let l=await this.predictorHttps.makeFootballPrediction(s);return l.fixtures.map(c=>{c.prediction.playerId&&(c.prediction.playerId=p),c.matchId=n}),l}else return s.fixtures=[a],await this.predictorHttps.makeFootballPrediction(s);else throw new Error("The prediction is invalid. Please check again have you passed appropriate prediction model")};getMatchSummary=async e=>{if(this.idMapping.idSchema!=="native"){let r=(await this.predictorService.remapMatchIdToNative([e]))[0],i=await this.predictorHttps.getMatchSummary(r);i.matchId=e;let a=i.predictions,s=await this.predictorService.remapPlayerIdToIdSchema(a);return i.predictions=s,i}else return await this.predictorHttps.getMatchSummary(e)};getMarketSummary=async(e,t,r)=>{try{let i=await this.getMatchSummary(e);return this.predictorService.getMarketSummary(i,t,r)}catch(i){return i.message}};getConfig=async()=>{let e=await this.clientHttps.getConfig(),t=await this.predictorConfigRemapper.remapConfig(e.predictor);return this.idMapping.idSchema!=="native"?await this.predictorService.remapCompetitionsFromConfig(t):t};deleteFootballPrediction=async e=>await this.predictorHttps.deleteFootballPrediction(e);getMyPredictions=async e=>(e&&(e=new w(e)),await this.predictorHttps.getMyPredictions(e));getMyCurrentPredictions=async e=>{if(e)e.status=["ACTIVE"],e=new w(e);else{let t={status:["ACTIVE"]};e=new w(t)}return await this.getMyPredictions(e)};getMyPastPredictions=async e=>{if(e)e.status=Be,e=new w(e);else{let t={status:Be};e=new w(t)}return await this.getMyPredictions(e)};getUserPredictions=async(e,t)=>(t&&(t=new w(t)),await this.predictorHttps.getUserPredictions(e,t));getUserCurrentPredictions=async(e,t)=>{if(t)t.status=["ACTIVE"],t=new w(t);else{let r={status:["ACTIVE"]};t=new w(r)}return await this.getUserPredictions(e,t)};getUserPastPredictions=async(e,t)=>{if(t)t.status=Be,t=new w(t);else{let r={status:Be};t=new w(r)}return await this.getUserPredictions(e,t)}};var Eo=be(te());var we=class{instance=null;apiSignInUrl="";constructor(e){let t=x(e.environment,"client");this.apiSignInUrl=`/clients/${e.clientId}/features?key=${e.apiKey}`,this.instance=Eo.default.create({baseURL:t,headers:{"Content-Type":"application/json"}})}getConfig=async()=>{try{return(await this.instance.get(`${this.apiSignInUrl}`)).data.data}catch(e){throw console.warn("There was a problem fetching configuration from Client API",e),e.response}}};var Tr=class{predictorHttps=null;clientHttps=null;predictorFacade=null;idMapping=null;constructor(e){this.idMapping=new T(e),this.predictorHttps=new j(e,this.idMapping),this.clientHttps=new we(e),this.predictorFacade=new Sr(e,this.predictorHttps,this.clientHttps,this.idMapping)}makeFootballPrediction=async(e,t,r,i)=>await this.predictorFacade.makeFootballPrediction(e,t,r,i);getMatchSummary=async e=>await this.predictorFacade.getMatchSummary(e);getMarketSummary=async(e,t,r)=>await this.predictorFacade.getMarketSummary(e,t,r);getConfig=async()=>await this.predictorFacade.getConfig();deleteFootballPrediction=async e=>await this.predictorFacade.deleteFootballPrediction(e);getMyPredictions=async e=>await this.predictorFacade.getMyPredictions(e);getMyCurrentPredictions=async e=>await this.predictorFacade.getMyCurrentPredictions(e);getMyPastPredictions=async e=>await this.predictorFacade.getMyPastPredictions(e);getUserPredictions=async(e,t)=>await this.predictorFacade.getUserPredictions(e,t);getUserCurrentPredictions=async(e,t)=>await this.predictorFacade.getUserCurrentPredictions(e,t);getUserPastPredictions=async(e,t)=>await this.predictorFacade.getUserPastPredictions(e,t)};var Er=class{general=[];predictor=[];topX=[]};var Cr=class{enabled=!1;rewards=null};var _r=class{general=null;topX=null;predictor=null};var Or=class{points=null;tiers=null;badges=null};var xr=class{remapLoyaltyResponse=e=>{let t=new Cr;return t.enabled=e.enabled,t.rewards=this.remapRewards(e.rewards),t};remapRewards=e=>{let t=new Or;return t.points=this.remapPoints(e.points),t.tiers=e.tiers,t.badges=this.remapBadges(e.badges),t};remapPoints=e=>{let t=new _r;return t.general=e.general,t.topX=e.top_x,t.predictor=e.predictor,t};remapBadges=e=>{let t=new Er;return t.general=e.general,t.predictor=e.predictor,t.topX=e.top_x,t}};var Ar=class{https=null;loyaltyRemapper=null;constructor(e){this.https=e,this.loyaltyRemapper=new xr}getConfig=async()=>{let e=await this.https.getConfig();return this.loyaltyRemapper.remapLoyaltyResponse(e.loyalty)}};var Br=class{https=null;loyaltyFacade=null;constructor(e){this.https=new we(e),this.loyaltyFacade=new Ar(this.https)}getConfig=async()=>await this.loyaltyFacade.getConfig()};var Nr=class{idMapping=null;predictorHttps=null;predictorService=null;constructor(e,t){this.idMapping=t,this.predictorHttps=new j(e,t),this.predictorService=new B(e,t)}getGames=async e=>{let t=this.predictorService.initGameFilters("TOP_X",e),r=await this.predictorHttps.getGames(t);return await this.predictorService.remapMatchIdsFixtures(r)};getGameById=async e=>{let t=await this.predictorHttps.getGameById(e);return await this.predictorService.remapMatchIdsFixtures(t)};getGameResults=async(e,t)=>{t&&(t=new v(t));let r=await this.predictorHttps.getGameResults(e,t);return await this.predictorService.remapMatchIdsFixtures(r)};getCurrentGameResults=async()=>{let e={status:"OPEN",type:"TOP_X"};e=new v(e);let t=await this.predictorHttps.getGames(e),r=this.predictorService.getCurrentGameId(t);return(await this.getGameResults(r))[0]};play=async e=>{let t=new ge(e);if(this.idMapping.idSchema!=="native"){let i=[];t.fixtures.forEach(s=>i.push(s.matchId));let a=await this.predictorService.remapMatchIdToNative(i);t.fixtures.forEach(s=>s.matchId=a.shift())}let r=await this.predictorHttps.makeFootballPrediction(t);return r.fixtures.forEach(i=>{i.matchId=i.matchModel.id}),r};delete=async e=>await this.predictorHttps.deleteFootballPrediction(e);getMyGameEditions=async e=>{let t=this.predictorService.initGameTypePredictions("TOP_X"),r=[],i=await this.predictorHttps.getMyPredictionsNoRemap(t);i.forEach(n=>{n.game_instance_id&&r.push(n.game_instance_id)});let a=this.predictorService.initGameFilters("TOP_X",e,r),s=await this.predictorHttps.getUserGameEditions(a);return await this.predictorService.addPredictionProp(i,s)};getMyGamePrediction=async e=>{let t=this.predictorService.initGameTypePredictions("TOP_X");return(await this.predictorHttps.getMyPredictions(t)).filter(a=>a.gameInstanceId===e)[0]};getUserGameEditions=async(e,t)=>{let r=this.predictorService.initGameTypePredictions("TOP_X"),i=[],a=await this.predictorHttps.getUserPredictionsNoRemap(e,r);a.forEach(p=>{p.game_instance_id&&i.push(p.game_instance_id)});let s=this.predictorService.initGameFilters("TOP_X",t,i),n=await this.predictorHttps.getUserGameEditions(s);return await this.predictorService.addPredictionProp(a,n)};getUserGamePrediction=async(e,t)=>{let r=this.predictorService.initGameTypePredictions("TOP_X");return(await this.predictorHttps.getUserPredictions(e,r)).filter(s=>s.gameInstanceId===t)[0]}};var Lr=class{topXFacade=null;idMapping=null;constructor(e){this.idMapping=new T(e),this.topXFacade=new Nr(e,this.idMapping)}getGames=async e=>await this.topXFacade.getGames(e);getGameById=async e=>await this.topXFacade.getGameById(e);getGameResults=async(e,t)=>await this.topXFacade.getGameResults(e,t);getCurrentGameResults=async()=>await this.topXFacade.getCurrentGameResults();play=async e=>await this.topXFacade.play(e);delete=async e=>await this.topXFacade.delete(e);getMyGameEditions=async e=>await this.topXFacade.getMyGameEditions(e);getMyGamePrediction=async e=>await this.topXFacade.getMyGamePrediction(e);getUserGameEditions=async(e,t)=>await this.topXFacade.getUserGameEditions(e,t);getUserGamePrediction=async(e,t)=>await this.topXFacade.getUserGamePrediction(e,t)};var Gr=class{predictorHttps=null;predictorService=null;idMapping=null;constructor(e){this.idMapping=new T(e),this.predictorHttps=new j(e,this.idMapping),this.predictorService=new B(e,this.idMapping)}play=async e=>{let t=e.fixtures.map(r=>this.predictorService.validateFixture(r.matchId,r.market,r.prediction.value,r.prediction.playerId));if(t){if(this.idMapping.idSchema!=="native"){let r=[],i=[];t.forEach(n=>{r.push(n.matchId),n instanceof _&&i.push(n.prediction.playerId)});let a=await this.predictorService.remapMatchIdToNative(r),s={};i&&i.length>0&&(s=await this.predictorService.remapPlayerIdMapToNative(i)),t.forEach((n,p)=>{n.matchId=a[p],n instanceof _&&(n.prediction.playerId=s[n.prediction.playerId])})}}else throw new Error("The prediction is invalid. Please check again have you passed appropriate prediction model");return e.fixtures=t,await this.predictorHttps.makeFootballPrediction(e)};delete=async e=>await this.predictorHttps.deleteFootballPrediction(e);getGames=async e=>{let t=this.predictorService.initGameFilters("MATCH_QUIZ",e),r=await this.predictorHttps.getGames(t);return await this.predictorService.remapMatchIdsFixtures(r)};getGameById=async e=>{let t=await this.predictorHttps.getGameById(e);return await this.predictorService.remapMatchIdsFixtures(t)};getGameResults=async(e,t)=>{t&&(t=new v(t));let r=await this.predictorHttps.getGameResults(e,t);return await this.predictorService.remapMatchIdsFixtures(r)};getCurrentGameResults=async()=>{let e={status:"OPEN",type:"MATCH_QUIZ"};e=new v(e);let t=await this.predictorHttps.getGames(e),r=this.predictorService.getCurrentGameId(t);return(await this.getGameResults(r))[0]};getMyGameEditions=async e=>{let t=this.predictorService.initGameTypePredictions("MATCH_QUIZ"),r=[],i=await this.predictorHttps.getMyPredictionsNoRemap(t);i.forEach(n=>{n.game_instance_id&&r.push(n.game_instance_id)});let a=this.predictorService.initGameFilters("MATCH_QUIZ",e,r),s=await this.predictorHttps.getUserGameEditions(a);return await this.predictorService.addPredictionProp(i,s)};getMyGamePrediction=async e=>{let t=this.predictorService.initGameTypePredictions("MATCH_QUIZ");return(await this.predictorHttps.getMyPredictions(t)).filter(a=>a.gameInstanceId===e)[0]};getUserGameEditions=async(e,t)=>{let r=this.predictorService.initGameTypePredictions("MATCH_QUIZ"),i=[],a=await this.predictorHttps.getUserPredictionsNoRemap(e,r);a.forEach(p=>{p.game_instance_id&&i.push(p.game_instance_id)});let s=this.predictorService.initGameFilters("MATCH_QUIZ",t,i),n=await this.predictorHttps.getUserGameEditions(s);return await this.predictorService.addPredictionProp(a,n)};getUserGamePrediction=async(e,t)=>{let r=this.predictorService.initGameTypePredictions("MATCH_QUIZ");return(await this.predictorHttps.getUserPredictions(e,r)).filter(s=>s.gameInstanceId===t)[0]}};var Ur=class{matchQuizFacade=null;constructor(e){this.matchQuizFacade=new Gr(e)}play=async e=>await this.matchQuizFacade.play(e);delete=async e=>await this.matchQuizFacade.delete(e);getGames=async e=>await this.matchQuizFacade.getGames(e);getGameById=async e=>await this.matchQuizFacade.getGameById(e);getGameResults=async(e,t)=>await this.matchQuizFacade.getGameResults(e,t);getCurrentGameResults=async()=>await this.matchQuizFacade.getCurrentGameResults();getMyGameEditions=async e=>await this.matchQuizFacade.getMyGameEditions(e);getMyGamePrediction=async e=>await this.matchQuizFacade.getMyGamePrediction(e);getUserGameEditions=async(e,t)=>await this.matchQuizFacade.getUserGameEditions(e,t);getUserGamePrediction=async(e,t)=>await this.matchQuizFacade.getUserGamePrediction(e,t)};function Eh(o){let t=new zt().validate(o);if(t.idSchema.validation==="missing"&&(console.warn(t.idSchema.message.text),o.idSchema="native"),t.environment.validation==="missing"&&(console.warn(t.environment.message.text),o.environment="prod"),t.lang.validation==="missing"&&(console.warn(t.lang.message.text),o.lang="en"),t.isValid)return{profile:new $t(o),football:new Qt(o),predictor:new Tr(o),loyalty:new Br(o),topX:new Lr(o),matchQuiz:new Ur(o)};throw new Error("Configuration is not valid")}export{Eh as FansUnitedSDK};
1
+ var Uo=Object.create;var Yr=Object.defineProperty;var Vo=Object.getOwnPropertyDescriptor;var Do=Object.getOwnPropertyNames;var $o=Object.getPrototypeOf,Ho=Object.prototype.hasOwnProperty;var ko=o=>Yr(o,"__esModule",{value:!0});var h=(o,e)=>()=>(e||o((e={exports:{}}).exports,e),e.exports);var qo=(o,e,t,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of Do(e))!Ho.call(o,i)&&(t||i!=="default")&&Yr(o,i,{get:()=>e[i],enumerable:!(r=Vo(e,i))||r.enumerable});return o},Fe=(o,e)=>qo(ko(Yr(o!=null?Uo($o(o)):{},"default",!e&&o&&o.__esModule?{get:()=>o.default,enumerable:!0}:{value:o,enumerable:!0})),o);var Wr=h((Ha,Ri)=>{"use strict";Ri.exports=function(e,t){return function(){for(var i=new Array(arguments.length),a=0;a<i.length;a++)i[a]=arguments[a];return e.apply(t,i)}}});var b=h((ka,Si)=>{"use strict";var jo=Wr(),Y=Object.prototype.toString;function zr(o){return Y.call(o)==="[object Array]"}function Qr(o){return typeof o=="undefined"}function Xo(o){return o!==null&&!Qr(o)&&o.constructor!==null&&!Qr(o.constructor)&&typeof o.constructor.isBuffer=="function"&&o.constructor.isBuffer(o)}function Ko(o){return Y.call(o)==="[object ArrayBuffer]"}function Yo(o){return typeof FormData!="undefined"&&o instanceof FormData}function Wo(o){var e;return typeof ArrayBuffer!="undefined"&&ArrayBuffer.isView?e=ArrayBuffer.isView(o):e=o&&o.buffer&&o.buffer instanceof ArrayBuffer,e}function zo(o){return typeof o=="string"}function Qo(o){return typeof o=="number"}function Fi(o){return o!==null&&typeof o=="object"}function De(o){if(Y.call(o)!=="[object Object]")return!1;var e=Object.getPrototypeOf(o);return e===null||e===Object.prototype}function Jo(o){return Y.call(o)==="[object Date]"}function Zo(o){return Y.call(o)==="[object File]"}function ea(o){return Y.call(o)==="[object Blob]"}function vi(o){return Y.call(o)==="[object Function]"}function ta(o){return Fi(o)&&vi(o.pipe)}function ra(o){return typeof URLSearchParams!="undefined"&&o instanceof URLSearchParams}function ia(o){return o.trim?o.trim():o.replace(/^\s+|\s+$/g,"")}function oa(){return typeof navigator!="undefined"&&(navigator.product==="ReactNative"||navigator.product==="NativeScript"||navigator.product==="NS")?!1:typeof window!="undefined"&&typeof document!="undefined"}function Jr(o,e){if(!(o===null||typeof o=="undefined"))if(typeof o!="object"&&(o=[o]),zr(o))for(var t=0,r=o.length;t<r;t++)e.call(null,o[t],t,o);else for(var i in o)Object.prototype.hasOwnProperty.call(o,i)&&e.call(null,o[i],i,o)}function Zr(){var o={};function e(i,a){De(o[a])&&De(i)?o[a]=Zr(o[a],i):De(i)?o[a]=Zr({},i):zr(i)?o[a]=i.slice():o[a]=i}for(var t=0,r=arguments.length;t<r;t++)Jr(arguments[t],e);return o}function aa(o,e,t){return Jr(e,function(i,a){t&&typeof i=="function"?o[a]=jo(i,t):o[a]=i}),o}function sa(o){return o.charCodeAt(0)===65279&&(o=o.slice(1)),o}Si.exports={isArray:zr,isArrayBuffer:Ko,isBuffer:Xo,isFormData:Yo,isArrayBufferView:Wo,isString:zo,isNumber:Qo,isObject:Fi,isPlainObject:De,isUndefined:Qr,isDate:Jo,isFile:Zo,isBlob:ea,isFunction:vi,isStream:ta,isURLSearchParams:ra,isStandardBrowserEnv:oa,forEach:Jr,merge:Zr,extend:aa,trim:ia,stripBOM:sa}});var ei=h((qa,Ei)=>{"use strict";var Z=b();function Ti(o){return encodeURIComponent(o).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}Ei.exports=function(e,t,r){if(!t)return e;var i;if(r)i=r(t);else if(Z.isURLSearchParams(t))i=t.toString();else{var a=[];Z.forEach(t,function(p,u){p===null||typeof p=="undefined"||(Z.isArray(p)?u=u+"[]":p=[p],Z.forEach(p,function(c){Z.isDate(c)?c=c.toISOString():Z.isObject(c)&&(c=JSON.stringify(c)),a.push(Ti(u)+"="+Ti(c))}))}),i=a.join("&")}if(i){var s=e.indexOf("#");s!==-1&&(e=e.slice(0,s)),e+=(e.indexOf("?")===-1?"?":"&")+i}return e}});var _i=h((ja,Ci)=>{"use strict";var na=b();function $e(){this.handlers=[]}$e.prototype.use=function(e,t,r){return this.handlers.push({fulfilled:e,rejected:t,synchronous:r?r.synchronous:!1,runWhen:r?r.runWhen:null}),this.handlers.length-1};$e.prototype.eject=function(e){this.handlers[e]&&(this.handlers[e]=null)};$e.prototype.forEach=function(e){na.forEach(this.handlers,function(r){r!==null&&e(r)})};Ci.exports=$e});var xi=h((Xa,Oi)=>{"use strict";var la=b();Oi.exports=function(e,t){la.forEach(e,function(i,a){a!==t&&a.toUpperCase()===t.toUpperCase()&&(e[t]=i,delete e[a])})}});var ti=h((Ka,Ai)=>{"use strict";Ai.exports=function(e,t,r,i,a){return e.config=t,r&&(e.code=r),e.request=i,e.response=a,e.isAxiosError=!0,e.toJSON=function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:this.config,code:this.code,status:this.response&&this.response.status?this.response.status:null}},e}});var ri=h((Ya,Bi)=>{"use strict";var pa=ti();Bi.exports=function(e,t,r,i,a){var s=new Error(e);return pa(s,t,r,i,a)}});var Li=h((Wa,Ni)=>{"use strict";var ca=ri();Ni.exports=function(e,t,r){var i=r.config.validateStatus;!r.status||!i||i(r.status)?e(r):t(ca("Request failed with status code "+r.status,r.config,null,r.request,r))}});var Ui=h((za,Gi)=>{"use strict";var He=b();Gi.exports=He.isStandardBrowserEnv()?function(){return{write:function(t,r,i,a,s,n){var p=[];p.push(t+"="+encodeURIComponent(r)),He.isNumber(i)&&p.push("expires="+new Date(i).toGMTString()),He.isString(a)&&p.push("path="+a),He.isString(s)&&p.push("domain="+s),n===!0&&p.push("secure"),document.cookie=p.join("; ")},read:function(t){var r=document.cookie.match(new RegExp("(^|;\\s*)("+t+")=([^;]*)"));return r?decodeURIComponent(r[3]):null},remove:function(t){this.write(t,"",Date.now()-864e5)}}}():function(){return{write:function(){},read:function(){return null},remove:function(){}}}()});var Di=h((Qa,Vi)=>{"use strict";Vi.exports=function(e){return/^([a-z][a-z\d\+\-\.]*:)?\/\//i.test(e)}});var Hi=h((Ja,$i)=>{"use strict";$i.exports=function(e,t){return t?e.replace(/\/+$/,"")+"/"+t.replace(/^\/+/,""):e}});var qi=h((Za,ki)=>{"use strict";var ma=Di(),ua=Hi();ki.exports=function(e,t){return e&&!ma(t)?ua(e,t):t}});var Xi=h((es,ji)=>{"use strict";var ii=b(),da=["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"];ji.exports=function(e){var t={},r,i,a;return e&&ii.forEach(e.split(`
2
+ `),function(n){if(a=n.indexOf(":"),r=ii.trim(n.substr(0,a)).toLowerCase(),i=ii.trim(n.substr(a+1)),r){if(t[r]&&da.indexOf(r)>=0)return;r==="set-cookie"?t[r]=(t[r]?t[r]:[]).concat([i]):t[r]=t[r]?t[r]+", "+i:i}}),t}});var Wi=h((ts,Yi)=>{"use strict";var Ki=b();Yi.exports=Ki.isStandardBrowserEnv()?function(){var e=/(msie|trident)/i.test(navigator.userAgent),t=document.createElement("a"),r;function i(a){var s=a;return e&&(t.setAttribute("href",s),s=t.href),t.setAttribute("href",s),{href:t.href,protocol:t.protocol?t.protocol.replace(/:$/,""):"",host:t.host,search:t.search?t.search.replace(/^\?/,""):"",hash:t.hash?t.hash.replace(/^#/,""):"",hostname:t.hostname,port:t.port,pathname:t.pathname.charAt(0)==="/"?t.pathname:"/"+t.pathname}}return r=i(window.location.href),function(s){var n=Ki.isString(s)?i(s):s;return n.protocol===r.protocol&&n.host===r.host}}():function(){return function(){return!0}}()});var ve=h((rs,zi)=>{"use strict";function oi(o){this.message=o}oi.prototype.toString=function(){return"Cancel"+(this.message?": "+this.message:"")};oi.prototype.__CANCEL__=!0;zi.exports=oi});var si=h((is,Qi)=>{"use strict";var ke=b(),ha=Li(),fa=Ui(),ga=ei(),ya=qi(),Ma=Xi(),wa=Wi(),ai=ri(),ba=Se(),Pa=ve();Qi.exports=function(e){return new Promise(function(r,i){var a=e.data,s=e.headers,n=e.responseType,p;function u(){e.cancelToken&&e.cancelToken.unsubscribe(p),e.signal&&e.signal.removeEventListener("abort",p)}ke.isFormData(a)&&delete s["Content-Type"];var l=new XMLHttpRequest;if(e.auth){var c=e.auth.username||"",f=e.auth.password?unescape(encodeURIComponent(e.auth.password)):"";s.Authorization="Basic "+btoa(c+":"+f)}var L=ya(e.baseURL,e.url);l.open(e.method.toUpperCase(),ga(L,e.params,e.paramsSerializer),!0),l.timeout=e.timeout;function Pi(){if(!!l){var _="getAllResponseHeaders"in l?Ma(l.getAllResponseHeaders()):null,J=!n||n==="text"||n==="json"?l.responseText:l.response,K={data:J,status:l.status,statusText:l.statusText,headers:_,config:e,request:l};ha(function(Kr){r(Kr),u()},function(Kr){i(Kr),u()},K),l=null}}if("onloadend"in l?l.onloadend=Pi:l.onreadystatechange=function(){!l||l.readyState!==4||l.status===0&&!(l.responseURL&&l.responseURL.indexOf("file:")===0)||setTimeout(Pi)},l.onabort=function(){!l||(i(ai("Request aborted",e,"ECONNABORTED",l)),l=null)},l.onerror=function(){i(ai("Network Error",e,null,l)),l=null},l.ontimeout=function(){var J=e.timeout?"timeout of "+e.timeout+"ms exceeded":"timeout exceeded",K=e.transitional||ba.transitional;e.timeoutErrorMessage&&(J=e.timeoutErrorMessage),i(ai(J,e,K.clarifyTimeoutError?"ETIMEDOUT":"ECONNABORTED",l)),l=null},ke.isStandardBrowserEnv()){var Ii=(e.withCredentials||wa(L))&&e.xsrfCookieName?fa.read(e.xsrfCookieName):void 0;Ii&&(s[e.xsrfHeaderName]=Ii)}"setRequestHeader"in l&&ke.forEach(s,function(J,K){typeof a=="undefined"&&K.toLowerCase()==="content-type"?delete s[K]:l.setRequestHeader(K,J)}),ke.isUndefined(e.withCredentials)||(l.withCredentials=!!e.withCredentials),n&&n!=="json"&&(l.responseType=e.responseType),typeof e.onDownloadProgress=="function"&&l.addEventListener("progress",e.onDownloadProgress),typeof e.onUploadProgress=="function"&&l.upload&&l.upload.addEventListener("progress",e.onUploadProgress),(e.cancelToken||e.signal)&&(p=function(_){!l||(i(!_||_&&_.type?new Pa("canceled"):_),l.abort(),l=null)},e.cancelToken&&e.cancelToken.subscribe(p),e.signal&&(e.signal.aborted?p():e.signal.addEventListener("abort",p))),a||(a=null),l.send(a)})}});var Se=h((os,eo)=>{"use strict";var y=b(),Ji=xi(),Ia=ti(),Ra={"Content-Type":"application/x-www-form-urlencoded"};function Zi(o,e){!y.isUndefined(o)&&y.isUndefined(o["Content-Type"])&&(o["Content-Type"]=e)}function Fa(){var o;return typeof XMLHttpRequest!="undefined"?o=si():typeof process!="undefined"&&Object.prototype.toString.call(process)==="[object process]"&&(o=si()),o}function va(o,e,t){if(y.isString(o))try{return(e||JSON.parse)(o),y.trim(o)}catch(r){if(r.name!=="SyntaxError")throw r}return(t||JSON.stringify)(o)}var qe={transitional:{silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},adapter:Fa(),transformRequest:[function(e,t){return Ji(t,"Accept"),Ji(t,"Content-Type"),y.isFormData(e)||y.isArrayBuffer(e)||y.isBuffer(e)||y.isStream(e)||y.isFile(e)||y.isBlob(e)?e:y.isArrayBufferView(e)?e.buffer:y.isURLSearchParams(e)?(Zi(t,"application/x-www-form-urlencoded;charset=utf-8"),e.toString()):y.isObject(e)||t&&t["Content-Type"]==="application/json"?(Zi(t,"application/json"),va(e)):e}],transformResponse:[function(e){var t=this.transitional||qe.transitional,r=t&&t.silentJSONParsing,i=t&&t.forcedJSONParsing,a=!r&&this.responseType==="json";if(a||i&&y.isString(e)&&e.length)try{return JSON.parse(e)}catch(s){if(a)throw s.name==="SyntaxError"?Ia(s,this,"E_JSON_PARSE"):s}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*"}}};y.forEach(["delete","get","head"],function(e){qe.headers[e]={}});y.forEach(["post","put","patch"],function(e){qe.headers[e]=y.merge(Ra)});eo.exports=qe});var ro=h((as,to)=>{"use strict";var Sa=b(),Ta=Se();to.exports=function(e,t,r){var i=this||Ta;return Sa.forEach(r,function(s){e=s.call(i,e,t)}),e}});var ni=h((ss,io)=>{"use strict";io.exports=function(e){return!!(e&&e.__CANCEL__)}});var so=h((ns,ao)=>{"use strict";var oo=b(),li=ro(),Ea=ni(),Ca=Se(),_a=ve();function pi(o){if(o.cancelToken&&o.cancelToken.throwIfRequested(),o.signal&&o.signal.aborted)throw new _a("canceled")}ao.exports=function(e){pi(e),e.headers=e.headers||{},e.data=li.call(e,e.data,e.headers,e.transformRequest),e.headers=oo.merge(e.headers.common||{},e.headers[e.method]||{},e.headers),oo.forEach(["delete","get","head","post","put","patch","common"],function(i){delete e.headers[i]});var t=e.adapter||Ca.adapter;return t(e).then(function(i){return pi(e),i.data=li.call(e,i.data,i.headers,e.transformResponse),i},function(i){return Ea(i)||(pi(e),i&&i.response&&(i.response.data=li.call(e,i.response.data,i.response.headers,e.transformResponse))),Promise.reject(i)})}});var ci=h((ls,no)=>{"use strict";var R=b();no.exports=function(e,t){t=t||{};var r={};function i(l,c){return R.isPlainObject(l)&&R.isPlainObject(c)?R.merge(l,c):R.isPlainObject(c)?R.merge({},c):R.isArray(c)?c.slice():c}function a(l){if(R.isUndefined(t[l])){if(!R.isUndefined(e[l]))return i(void 0,e[l])}else return i(e[l],t[l])}function s(l){if(!R.isUndefined(t[l]))return i(void 0,t[l])}function n(l){if(R.isUndefined(t[l])){if(!R.isUndefined(e[l]))return i(void 0,e[l])}else return i(void 0,t[l])}function p(l){if(l in t)return i(e[l],t[l]);if(l in e)return i(void 0,e[l])}var u={url:s,method:s,data:s,baseURL:n,transformRequest:n,transformResponse:n,paramsSerializer:n,timeout:n,timeoutMessage:n,withCredentials:n,adapter:n,responseType:n,xsrfCookieName:n,xsrfHeaderName:n,onUploadProgress:n,onDownloadProgress:n,decompress:n,maxContentLength:n,maxBodyLength:n,transport:n,httpAgent:n,httpsAgent:n,cancelToken:n,socketPath:n,responseEncoding:n,validateStatus:p};return R.forEach(Object.keys(e).concat(Object.keys(t)),function(c){var f=u[c]||a,L=f(c);R.isUndefined(L)&&f!==p||(r[c]=L)}),r}});var mi=h((ps,lo)=>{lo.exports={version:"0.24.0"}});var mo=h((cs,co)=>{"use strict";var Oa=mi().version,ui={};["object","boolean","number","function","string","symbol"].forEach(function(o,e){ui[o]=function(r){return typeof r===o||"a"+(e<1?"n ":" ")+o}});var po={};ui.transitional=function(e,t,r){function i(a,s){return"[Axios v"+Oa+"] Transitional option '"+a+"'"+s+(r?". "+r:"")}return function(a,s,n){if(e===!1)throw new Error(i(s," has been removed"+(t?" in "+t:"")));return t&&!po[s]&&(po[s]=!0,console.warn(i(s," has been deprecated since v"+t+" and will be removed in the near future"))),e?e(a,s,n):!0}};function xa(o,e,t){if(typeof o!="object")throw new TypeError("options must be an object");for(var r=Object.keys(o),i=r.length;i-- >0;){var a=r[i],s=e[a];if(s){var n=o[a],p=n===void 0||s(n,a,o);if(p!==!0)throw new TypeError("option "+a+" must be "+p);continue}if(t!==!0)throw Error("Unknown option "+a)}}co.exports={assertOptions:xa,validators:ui}});var Mo=h((ms,yo)=>{"use strict";var uo=b(),Aa=ei(),ho=_i(),fo=so(),je=ci(),go=mo(),ee=go.validators;function Te(o){this.defaults=o,this.interceptors={request:new ho,response:new ho}}Te.prototype.request=function(e){typeof e=="string"?(e=arguments[1]||{},e.url=arguments[0]):e=e||{},e=je(this.defaults,e),e.method?e.method=e.method.toLowerCase():this.defaults.method?e.method=this.defaults.method.toLowerCase():e.method="get";var t=e.transitional;t!==void 0&&go.assertOptions(t,{silentJSONParsing:ee.transitional(ee.boolean),forcedJSONParsing:ee.transitional(ee.boolean),clarifyTimeoutError:ee.transitional(ee.boolean)},!1);var r=[],i=!0;this.interceptors.request.forEach(function(f){typeof f.runWhen=="function"&&f.runWhen(e)===!1||(i=i&&f.synchronous,r.unshift(f.fulfilled,f.rejected))});var a=[];this.interceptors.response.forEach(function(f){a.push(f.fulfilled,f.rejected)});var s;if(!i){var n=[fo,void 0];for(Array.prototype.unshift.apply(n,r),n=n.concat(a),s=Promise.resolve(e);n.length;)s=s.then(n.shift(),n.shift());return s}for(var p=e;r.length;){var u=r.shift(),l=r.shift();try{p=u(p)}catch(c){l(c);break}}try{s=fo(p)}catch(c){return Promise.reject(c)}for(;a.length;)s=s.then(a.shift(),a.shift());return s};Te.prototype.getUri=function(e){return e=je(this.defaults,e),Aa(e.url,e.params,e.paramsSerializer).replace(/^\?/,"")};uo.forEach(["delete","get","head","options"],function(e){Te.prototype[e]=function(t,r){return this.request(je(r||{},{method:e,url:t,data:(r||{}).data}))}});uo.forEach(["post","put","patch"],function(e){Te.prototype[e]=function(t,r,i){return this.request(je(i||{},{method:e,url:t,data:r}))}});yo.exports=Te});var bo=h((us,wo)=>{"use strict";var Ba=ve();function te(o){if(typeof o!="function")throw new TypeError("executor must be a function.");var e;this.promise=new Promise(function(i){e=i});var t=this;this.promise.then(function(r){if(!!t._listeners){var i,a=t._listeners.length;for(i=0;i<a;i++)t._listeners[i](r);t._listeners=null}}),this.promise.then=function(r){var i,a=new Promise(function(s){t.subscribe(s),i=s}).then(r);return a.cancel=function(){t.unsubscribe(i)},a},o(function(i){t.reason||(t.reason=new Ba(i),e(t.reason))})}te.prototype.throwIfRequested=function(){if(this.reason)throw this.reason};te.prototype.subscribe=function(e){if(this.reason){e(this.reason);return}this._listeners?this._listeners.push(e):this._listeners=[e]};te.prototype.unsubscribe=function(e){if(!!this._listeners){var t=this._listeners.indexOf(e);t!==-1&&this._listeners.splice(t,1)}};te.source=function(){var e,t=new te(function(i){e=i});return{token:t,cancel:e}};wo.exports=te});var Io=h((ds,Po)=>{"use strict";Po.exports=function(e){return function(r){return e.apply(null,r)}}});var Fo=h((hs,Ro)=>{"use strict";Ro.exports=function(e){return typeof e=="object"&&e.isAxiosError===!0}});var To=h((fs,di)=>{"use strict";var vo=b(),Na=Wr(),Xe=Mo(),La=ci(),Ga=Se();function So(o){var e=new Xe(o),t=Na(Xe.prototype.request,e);return vo.extend(t,Xe.prototype,e),vo.extend(t,e),t.create=function(i){return So(La(o,i))},t}var x=So(Ga);x.Axios=Xe;x.Cancel=ve();x.CancelToken=bo();x.isCancel=ni();x.VERSION=mi().version;x.all=function(e){return Promise.all(e)};x.spread=Io();x.isAxiosError=Fo();di.exports=x;di.exports.default=x});var re=h((gs,Eo)=>{Eo.exports=To()});var fi=Fe(re());var hi=o=>{let e=250,t=[],r=0;return t[r]=[],o.forEach(i=>{t[r].length<=e?t[r].push(i):(r++,t[r]=[i])}),t},Ke=o=>{let e=[],t=200;for(;o.length>t;){let r=o.splice(0,t);e.push(r)}return e.push(o),e},A=(o,e)=>{let t="";return o==="prod"||o==="sandbox"?t={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"}[e]:t={profile:"http://localhost:8010",football:"http://locahost:8080",idMapping:"http://localhost:8030",predictor:"http://localhost:8040",client:"http://localhost:8080"}[e],t},V=o=>o.filter((t,r,i)=>r===i.indexOf(t));var Ye=class{id=null;name=null;avatar=null;gender=null;country=null;birthDate=null;interests=[]};var We=class{profilesFromResponse=e=>e?e.map(t=>this.fullProfileFromResponse(t)):null;fullProfileFromResponse=e=>{let t=new Ye;return t.avatar=e.avatar,t.birthDate=e.birth_date,t.country=e.country,t.gender=e.gender,t.id=e.id,t.interests=e.interests,t.name=e.name,t}};var ze=class{nextPageStartsAfter=null;itemsPerPage=null};var ie=class{pagination=new ze};var P=class{meta=new ie;data=[]};var Qe=class{avatar=null;followingId=null;name=null;profileId=null};var Je=class{followResponse=e=>e.map(t=>this.remapResponse(t));followingFromResponse=e=>{let t=new P;return t.meta.pagination.nextPageStartsAfter=e.meta.pagination.next_page_starts_after,t.meta.pagination.itemsPerPage=e.meta.pagination.items_per_page,t.data=e.data.map(r=>this.remapResponse(r)),t};remapResponse=e=>{let t=new Qe;return t.avatar=e.avatar,t.followingId=e.following_id,t.name=e.name,t.profileId=e.profile_id,t}};var Ze=class{avatar=null;followerId=null;name=null;profileId=null};var et=class{followersFromResponse=e=>{let t=new P;return t.meta.pagination.nextPageStartsAfter=e.meta.pagination.next_page_starts_after,t.meta.pagination.itemsPerPage=e.meta.pagination.items_per_page,t.data=e.data.map(r=>this.remapResponse(r)),t};remapResponse=e=>{let t=new Ze;return t.avatar=e.avatar,t.followerId=e.follower_id,t.name=e.name,t.profileId=e.profile_id,t}};var Ee=class{profile_ids=[]};var Ua="/countries",T="/profile",Co="/profiles",tt=class{instanceAuth=null;instance=null;apiSignInUrl=null;profileRemapper=null;followingRemapper=null;followersRemapper=null;constructor(e){let t=A(e.environment,"profile");this.apiSignInUrl=`?key=${e.apiKey}&client_id=${e.clientId}&lang=${e.lang}`,this.instanceAuth=fi.default.create({baseURL:t,headers:{Authorization:`Bearer ${e.authProvider.getIdToken()}`,"Content-Type":"application/json"}}),this.instanceAuth.interceptors.request.use(r=>r,r=>{Promise.reject(r)}),this.instanceAuth.interceptors.response.use(r=>r,r=>{let i=r.config;if((r.response.status===403||r.response.status===401)&&!i._retry){i._retry=!0;let a=e.authProvider.getIdToken();return i.headers.Authorization=`Bearer ${a}`,this.instanceAuth(i)}return Promise.reject(r)}),this.instance=fi.default.create({baseURL:t,headers:{"Content-Type":"application/json"}}),this.profileRemapper=new We,this.followingRemapper=new Je,this.followersRemapper=new et}getCountries=async()=>{try{return(await this.instance.get(`${Ua}${this.apiSignInUrl}`)).data.data}catch(e){throw console.warn("There was a problem fetching the countries:",e),e.response}};getProfile=async e=>{let t=`${T}${this.apiSignInUrl}`;if(e){t=`${Co}/${e}${this.apiSignInUrl}`;try{let r=await this.instance.get(t);return this.profileRemapper.fullProfileFromResponse(r.data.data)}catch(r){throw console.warn(`There was a problem fetching the following profile: ${e}`,r),r.response}}else try{let r=await this.instanceAuth.get(t);return this.profileRemapper.fullProfileFromResponse(r.data.data)}catch(r){throw console.warn("There was a problem fetching your profile from API:",r),r.response}};getProfiles=async e=>{try{let t=await this.instance.get(`${Co}${this.apiSignInUrl}&profile_ids=${e.join(",")}`);return this.profileRemapper.profilesFromResponse(t.data.data)}catch(t){throw console.warn(`There was a problem fetching the following profiles: ${e.join(",")}`,t),t.response}};getFollowers=async(e,t)=>{let r=`${T}/followers${this.apiSignInUrl}`;if(e&&!t){r=`${T}/followers${this.apiSignInUrl}${e.constructFilterUrl()}`;try{let i=await this.instanceAuth.get(r);return this.followersRemapper.followersFromResponse(i.data)}catch(i){throw console.warn("There was a problem fetching the followers for own profile",i),i.response}}else if(!e&&!t)try{let i=await this.instanceAuth.get(r);return this.followersRemapper.followersFromResponse(i.data)}catch(i){throw console.warn("There was a problem fetching the followers for own profile",i),i.response}e&&t?r=`${T}/${t}/followers${this.apiSignInUrl}${e.constructFilterUrl()}`:!e&&t&&(r=`${T}/${t}/followers${this.apiSignInUrl}`);try{let i=await this.instance.get(r);return this.followersRemapper.followersFromResponse(i.data)}catch(i){throw console.warn(`There was a problem fetching the followers for profile: ${t}`,i),i.response}};getFollowing=async(e,t)=>{let r=`${T}/following${this.apiSignInUrl}`;if(e&&!t){r=`${T}/following${this.apiSignInUrl}${e.constructFilterUrl()}`;try{let i=await this.instanceAuth.get(r);return this.followingRemapper.followingFromResponse(i.data)}catch(i){throw console.warn("There was a problem fetching the followers of own profile",i),i.response}}else if(!e&&!t)try{let i=await this.instanceAuth.get(r);return this.followingRemapper.followingFromResponse(i.data)}catch(i){throw console.warn("There was a problem fetching the followers of own profile",i),i.response}e&&t?r=`${T}/${t}/following${this.apiSignInUrl}${e.constructFilterUrl()}`:!e&&t&&(r=`${T}/${t}/following${this.apiSignInUrl}`);try{let i=await this.instance.get(r);return this.followingRemapper.followingFromResponse(i.data)}catch(i){throw console.warn(`There was a problem fetching the followers of the following profile: ${t}`,i),i.response}};follow=async e=>{let t=new Ee;t.profile_ids=e;try{let r=await this.instanceAuth.post(`${T}/follow${this.apiSignInUrl}`,JSON.stringify(t));return this.followingRemapper.followResponse(r.data.data)}catch(r){throw console.warn(`There was a problem with POST request for profiles: ${e.join(",")} `,r),r.response}};unfollow=async e=>{let t=new Ee;t.profile_ids=e;try{return await this.instanceAuth.delete(`${T}/follow${this.apiSignInUrl}`,{data:JSON.stringify(t)}),!0}catch(r){throw console.warn(`There was a problem with DELETE request for profiles: ${e.join(",")} `,r),r.response}};updateProfile=async e=>{try{let t=await this.instanceAuth.patch(`${T}${this.apiSignInUrl}`,e);return this.profileRemapper.fullProfileFromResponse(t.data.data)}catch(t){throw console.warn("There was a problem updating the own profile:",t),t.response}}};var G={native:"id",sportradar:"sportradar_id",sportal365:"sportal365_id",enetpulse:"enetpulse_id"};var _o="FansUnited",Oo={football:{ids:[],countries:[],competitions:[]},profile:{own:{},countries:[],expireAt:0}},D=class{idSchema="";exparationTimeout=600;constructor(e){this.idSchema=e.idSchema,(this.getData()===void 0||this.getData()===null)&&this.setData(Oo)}clearData=()=>{this.setData(Oo)};getEntityById=(e="",t="")=>this.getData().football.ids.find(r=>{let i=G[this.idSchema];return r&&`${r[i]}`===t&&r.resource===e});getEntity=(e,t,r)=>Array.isArray(e)?this.getData().football.ids.filter(i=>{let a=G[r];return i&&e.includes(`${i[a]}`)&&i.resource===t}):this.getData().football.ids.find(i=>{let a=G[r];return i&&`${i[a]}`===e&&i.resource===t});getEntityByNativeId=(e="",t="")=>this.getData().football.ids.find(r=>r&&`${r.id}`===t&&r.resource===e);checkForExistingIdObjs=(e,t)=>{let r=G[t],i={};return Object.keys(e).forEach(a=>{let s=e[a],p=this.getEntity(s,a,t).map(l=>l[r]),u=e[a].filter(l=>!p.includes(l));i[a]=s.map(l=>u.includes(l)?{id:l,exists:!1}:{id:l,exists:!0})}),i};getIdsByType=(e,t,r)=>{let i=G[r],a=G[t],s={};return Object.keys(e).forEach(n=>{let p=e[n],u=[];this.getData().football.ids.forEach(l=>{p.forEach((c,f)=>{c===l[a]&&n===l.resource&&(u[f]=l[i])})}),s[n]=u}),s};addIdMapping=e=>{let t=this.getData();t.football.ids.push(e),this.setData(t)};addIdMappings=e=>{let t=this.getData(),r=t.football.ids;r=[...r,...e],t.football.ids=r,this.setData(t)};setOwnProfile=e=>{let t=this.getData();t.profile.own=e,t.profile.expireAt=Math.floor(Date.now()/1e3)+this.exparationTimeout,this.setData(t)};getOwnProfile=()=>this.getData().profile.own;getProfileCountries=()=>this.getData().profile.countries;setProfileCountries=e=>{let t=this.getData();t.profile.countries=e,this.setData(t)};getFootballCountries=()=>this.getData().football.countries;setFootballCountries=e=>{let t=this.getData();t.football.countries=e,this.setData(t)};getCompetitions=e=>{let t=this.getData();return e?e.competitionSearchFilter(t.football.competitions):t.football.competitions};setCompetitions=e=>{let t=this.getData();t.football.competitions.push(...e),this.setData(t)};getExparationProfile=()=>this.getData().profile.expireAt;getData=()=>JSON.parse(localStorage.getItem(_o));setData=e=>{localStorage.setItem(_o,JSON.stringify(e))}};var xo=Fe(re());var Ce={player:"players",team:"teams",homeTeam:"teams",awayTeam:"teams",country:"countries",competition:"competitions",match:"matches"},rt=class{instance=null;apiSignInUrl="";constructor(e){let t=A(e.environment,"idMapping");this.apiSignInUrl=`?key=${e.apiKey}&client_id=${e.clientId}`,this.instance=xo.default.create({baseURL:t})}getEntityById=(e,t)=>{try{return this.instance.get(`/football${this.apiSignInUrl}&input_provider=${config.idSchema}&${Ce[e]}=${t}`)}catch(r){throw console.warn(`There was a problem with id mapping request for the following id:${t}`,r),r.response}};getEntityByIdAndSchema=(e,t,r)=>{try{return this.instance.get(`/football${this.apiSignInUrl}&input_provider=${r}&${Ce[e]}=${t}`)}catch(i){throw console.warn(`There was a problem with id mapping request for the following id:${t}`,i),i.response}};getEntityIdsByIdsAndSchema=(e,t,r)=>{try{return this.instance.get(`/football${this.apiSignInUrl}&input_provider=${r}&${Ce[e]}=${t.join(",")}`)}catch(i){throw console.warn(`There was a problem with id mapping request for the following ids:${t.join(",")}`,i),i.response}};getEntitiesByIds=(e,t,r)=>{t.sort((s,n)=>s.localeCompare(n));let a=hi(t).map(s=>{try{return this.instance.get(`/football${this.apiSignInUrl}&input_provider=${r}&${Ce[e]}=${s.join(",")}`)}catch(n){throw console.warn(`There was a problem with id mapping request for the following ids:${s.join(",")}`,n),n.response}});return Promise.all(a).then(s=>{let n=[];return s.forEach(p=>{n.push(...p.data.data)}),n})};getEntitiesByIdObjs=async(e,t)=>{let r=[],i={},a=[];Object.keys(e).forEach(u=>{r.push.apply(r,e[u])});let s=V(r),n=hi(s);for(let u of n){let l="";if(Object.keys(e).forEach(c=>{i[c]=[];let f=u.filter(L=>e[c].includes(L));f&&f.length>0&&(i[c]=f)}),Object.keys(i).forEach(c=>{i[c].length>0&&(i[c].sort((f,L)=>f.localeCompare(L)),l+="&",l+=`${Ce[c]}=${i[c].join(",")}`)}),l&&l.length>0)try{let c=await this.instance.get(`/football${this.apiSignInUrl}&input_provider=${t||"native"}${l}`);a.push(c.data.data)}catch(c){throw console.warn("There was a problem with id mapping request",c),c.response}else a.push([])}return Array.prototype.concat.apply([],a)}};var it=class{isBrowser=!1;localStorage=null;https=null;constructor(e){this.isBrowser=typeof window!="undefined",this.localStorage=new D(e),this.https=new rt(e)}getEntitiesByIds=async(e,t,r)=>{if(this.isBrowser)try{let i=this.localStorage.checkForExistingIdObjs(e,t),a=this.splitForRequestAndExisting(i),s=await this.https.getEntitiesByIdObjs(a.request,t);return this.localStorage.addIdMappings(s),this.localStorage.getIdsByType(e,t,r)}catch(i){return console.warn("There was a problem retrieving the entity ids ",i),Promise.resolve([])}else try{let i=await this.https.getEntitiesByIdObjs(e,t);return Object.keys(e).forEach(a=>{e[a]=i.filter(s=>s.resource===a).map(s=>s[G[r]])}),e}catch(i){return console.warn("There was a problem retrieving the entity ids ",i),Promise.resolve([])}};getEntityById=async(e,t,r)=>{if(this.isBrowser){let i=this.localStorage.getEntity(e,t,r);if(i)return i;{let a=await this.requestEntity(e,t,r);return this.localStorage.addIdMappings(a),a}}else return await this.requestEntity(e,t,r)};splitForRequestAndExisting=e=>{let t={},r={};return Object.keys(e).forEach(i=>{t[i]=e[i].filter(a=>!a.exists).map(a=>a.id),r[i]=e[i].filter(a=>a.exists).map(a=>a.id)}),{existing:r,request:t}};requestEntity=async(e,t,r)=>{try{return e=Array.isArray(e)?e:[e],await this.https.getEntitiesByIds(t,e,r)}catch(i){return console.warn(`There was a problem retrieving the requested entity: ${i}`),null}}};var ot=o=>{switch(o){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 o}};var at=class{extractedObjIds={};traverse=(e,t)=>(t=ot(t),Array.isArray(e)?this.traverseArrExtract(e,t):e&&typeof e=="object"&&this.traverseObjExtract(e,t),this.extractedObjIds);traverseArrExtract=(e,t)=>{e&&e.length>0&&e.forEach(r=>{this.traverseObjExtract(r,t)})};traverseObjExtract=(e,t)=>{e&&Object.keys(e).length>0&&Object.keys(e).forEach(r=>{let i=e[r];r==="id"||r==="teamId"?(this.extractedObjIds.hasOwnProperty(t)||(this.extractedObjIds[t]=[]),this.extractedObjIds[t].push(i)):e[r]&&this.traverse(e[r],r)})}};var st=class{replaceObjIdsIndex=null;remappedIdsObj={};traverse=(e,t,r)=>(t=ot(t),this.replaceObjIdsIndex===null&&(this.initReplaceObjIdsIndex(r),this.remappedIdsObj=r),Array.isArray(e)?this.traverseArrReplace(e,t):e&&typeof e=="object"&&this.traverseObjReplace(e,t),e);initReplaceObjIdsIndex=e=>{this.replaceObjIdsIndex={},Object.keys(e).forEach(t=>{this.replaceObjIdsIndex[t]=0})};traverseArrReplace=(e,t)=>{e&&e.length>0&&e.forEach(r=>{this.traverseObjReplace(r,t)})};traverseObjReplace=(e,t)=>{e&&Object.keys(e).length>0&&Object.keys(e).forEach(r=>{r==="id"||r==="teamId"?(e[r]=this.remappedIdsObj[t][this.replaceObjIdsIndex[t]],this.replaceObjIdsIndex[t]=this.replaceObjIdsIndex[t]+1):e[r]&&this.traverse(e[r],r,this.remappedIdsObj)})}};var E=class{idSchema="";idMappingFacade=null;constructor(e){this.idSchema=e.idSchema,this.idMappingFacade=new it(e)}getEntityIdBySchemaId=(e,t)=>this.idMappingFacade.getEntityById(e,t,this.idSchema);remapEntities=async(e,t)=>{let r=JSON.parse(JSON.stringify(e));try{if(this.idSchema!=="native"){let a=new at().traverse(r,t);return this.idMappingFacade.getEntitiesByIds(a,"native",this.idSchema).then(s=>new st().traverse(r,t,s))}else return e}catch(i){return console.warn(`There was a problem remapping entity: ${t} with inner entity `,i),[]}};getEntityIdsBySchemaId=async(e,t,r)=>{let i={};return i[t]=e,this.idSchema!=="native"?await this.idMappingFacade.getEntitiesByIds(i,this.idSchema,r):i}};var F=class{completed=!1;percentage;constructor(e){this.percentage=e}};var nt=class{teamFollowed=new F(10);teamFavourite=new F(15);playerFollowed=new F(10);playerFavourite=new F(10);competitionFollowed=new F(10);competitionFavourite=new F(5);addedBirthdate=new F(10);addedGender=new F(10);addedCountry=new F(10);addedAvatar=new F(10)};var lt=class{totalPercentage;breakdown=new nt};var Oe=class{limit=0;startAfter=null;constructor(e){this.limit=e.limit?e.limit:20,this.startAfter=e.startAfter?e.startAfter:null}constructFilterUrl=()=>{let e="";return this.limit&&(e=e+"&",e=e+`limit=${this.limit}`),this.startAfter&&(e=e+"&",e=e+`start_after=${this.startAfter}`),e}};var $=class{isBrowser=!1;localStorage={};https=null;constructor(e,t){this.isBrowser=typeof window!="undefined",this.localStorage=e,this.https=t}getOwn=async()=>{if(this.isBrowser){let e=Math.floor(Date.now()/1e3),t=this.localStorage.getExparationProfile(),r=null;if(t>e&&(r=this.localStorage.getOwnProfile()),r)return r;try{let i=await this.https.getProfile();return this.localStorage.setOwnProfile(i),i}catch(i){throw console.warn("There was a problem retrieving your profile: ",i),i}}else try{return await this.https.getProfile()}catch(e){throw console.warn("There was a problem retrieving your profile: ",e),e}};getByIds=async e=>{try{return await this.https.getProfiles(e)}catch(t){throw console.warn(`There was a problem retrieving the selected profiles: ${e.join(",")} `,t),t}};getById=async e=>{try{return await this.https.getProfile(e)}catch(t){throw console.warn(`There was a problem retrieving the selected profile: ${e} `,t),t}};getCountries=async()=>{if(this.isBrowser){let e=this.localStorage.getProfileCountries();if(e&&e.length>0)return e;try{let t=await this.https.getCountries();return this.localStorage.setProfileCountries(t),t}catch(t){throw console.warn("There was a problem retrieving profile countries: ",t),t}}else try{return await this.https.getCountries()}catch(e){throw console.warn("There was a problem retrieving profile countries: ",e),e}};getFollowers=async(e,t)=>{try{return e&&(e=new Oe(e)),await this.https.getFollowers(e,t)}catch(r){throw console.warn("There was a problem retrieving your followers: ",r),r}};getFollowing=async(e,t)=>{try{return e&&(e=new Oe(e)),await this.https.getFollowing(e,t)}catch(r){throw console.warn("There was a problem retrieving your following profiles: ",r),r}};follow=async e=>{try{return await this.https.follow(e)}catch(t){throw console.warn(`There was a problem following profiles: ${e.join(",")} `,t),t}};unfollow=async e=>{try{return await this.https.unfollow(e)}catch(t){throw console.warn(`There was a problem unfollowing profiles: ${e.join(",")} `,t),t}};showFullnessProfile=e=>{let t=new lt,r=0;return e.avatar&&(t.breakdown.addedAvatar.completed=!0,r+=t.breakdown.addedAvatar.percentage),e.birthDate&&(t.breakdown.addedBirthdate.completed=!0,r+=t.breakdown.addedBirthdate.percentage),e.country&&(t.breakdown.addedCountry.completed=!0,r+=t.breakdown.addedCountry.percentage),e.gender&&(t.breakdown.addedGender.completed=!0,r+=t.breakdown.addedGender.percentage),e.interests&&e.interests.length>0&&(e.interests.find(l=>l.type==="team"&&l.favourite)&&(t.breakdown.teamFavourite.completed=!0,r+=t.breakdown.teamFavourite.percentage),e.interests.find(l=>l.type==="team")&&(t.breakdown.teamFollowed.completed=!0,r+=t.breakdown.teamFollowed.percentage),e.interests.find(l=>l.type==="player"&&l.favourite)&&(t.breakdown.playerFavourite.completed=!0,r+=t.breakdown.playerFavourite.percentage),e.interests.find(l=>l.type==="player")&&(t.breakdown.playerFollowed.completed=!0,r+=t.breakdown.playerFollowed.percentage),e.interests.find(l=>l.type==="competition"&&l.favourite)&&(t.breakdown.competitionFavourite.completed=!0,r+=t.breakdown.competitionFavourite.percentage),e.interests.find(l=>l.type==="competition")&&(t.breakdown.competitionFollowed.completed=!0,r+=t.breakdown.competitionFollowed.percentage)),t.totalPercentage=r,t}};var pt=class{id=null;name=null;assets=null};var ct=class{isBrowser=!1;localStorage={};https=null;idMapping=null;constructor(e,t,r){this.isBrowser=typeof window!="undefined",this.localStorage=e,this.idMapping=r,this.https=t}getCountriesWithIdMapping=async()=>{try{let e=await this.getCountries();return this.idMapping.remapEntities(e,"country")}catch(e){throw console.warn("There was a problem browsing countries as football entities",e),e}};getCountries=async()=>{if(this.isBrowser){let e=this.localStorage.getFootballCountries();if(e&&e.length>0)return e;try{let t=await this.https.getCountries();return this.localStorage.setFootballCountries(t),t}catch(t){throw console.warn("There was a problem retrieving countries as football entities",t),t}}else return this.https.getCountries()}};var mt=class{countryId=null;name=null;gender=null;type=null;sortField=null;sortOrder=null;competitionIds=null;constructor(e){this.countryId=e.countryId?`${e.countryId}`:null,this.name=e.name?e.name:null,this.gender=e.gender?e.gender:null,this.type=e.type?e.type:null,this.sortField=e.sortField?`${e.sortField}`:null,this.sortOrder=e.sortOrder?`${e.sortOrder}`:null,this.competitionIds=e.competitionIds?e.competitionIds:null}constructFilterUrl=()=>{let e="";return this.countryId&&(e=e+"&",e=e+`country_id=${this.countryId}`),this.gender&&(e=e+"&",e=e+`gender=${this.gender}`),this.type&&(e=e+"&",e=e+`type=${this.type}`),this.sortField&&(e=e+"&",e=e+`sort_field=${this.sortField}`),this.sortOrder&&(e=e+"&",e=e+`sort_order=${this.sortOrder}`),this.name&&(e=e+"&",e=e+`name=${this.name}`),this.competitionIds&&(e=e+"&",e=e+`competition_ids=${this.competitionIds.join(",")}`),e};competitionSearchFilter=e=>{try{let t=this.filter(e);return this.sortField||this.sortOrder?this.sort(t):t}catch(t){return console.warn("There was a problem filtering the local competitions",t),[]}};filter=e=>{let t=this.entitiesToSearchWith();return e.filter(r=>{let i=!0;return t.forEach(a=>{a!=="sortOrder"&&a!=="sortField"&&(a==="countryId"?i&&=r.country.id===this[a]:a==="name"?i&&=r.name.toLocaleLowerCase().includes(this[a].toLocaleLowerCase()):a==="competitionIds"?i&&=this[a].some(s=>r.id===s):i&&=r[a].toLocaleLowerCase()===this[a].toLocaleLowerCase())}),i})};entitiesToSearchWith=()=>{let e=[];return this.countryId&&e.push("countryId"),this.name&&e.push("name"),this.gender&&e.push("gender"),this.type&&e.push("type"),this.sortField&&e.push("sortField"),this.sortOrder&&e.push("sortOrder"),this.competitionIds&&e.push("competitionIds"),e};sort=e=>{let t=[];return this.sortField==="name"?t=e.sort((r,i)=>this.sortOrder&&this.sortOrder==="desc"?i.name.localeCompare(r.name):r.name.localeCompare(i.name)):this.sortField==="countryId"?t=e.sort((r,i)=>this.sortOrder&&this.sortOrder==="desc"?i.country.id.localeCompare(r.country.id):r.country.id.localeCompare(i.country.id)):this.sortField==="scope"?e.forEach(r=>t[this.competitionIds.indexOf(r.id)]=r):!this.sortField&&this.sortOrder==="desc"&&(t=e.sort((r,i)=>i.id.localeCompare(r.id))),t}};var ut=class{isBrowser=!1;localStorage={};https=null;idMapping=null;constructor(e,t,r){this.isBrowser=typeof window!="undefined",this.localStorage=e,this.idMapping=r,this.https=t}getCompetitionsIdMapping=async e=>{try{let t=!1;if(e){if(e=new mt(e),e.countryId){let i=await this.idMapping.getEntityIdsBySchemaId([`${e.countryId}`],"country","native");i.country.length===0&&(t=!0),e.countryId=i.country[0]}if(e.competitionIds){let i=await this.idMapping.getEntityIdsBySchemaId(e.competitionIds,"competition","native");i.competition.length===0&&(t=!0),e.competitionIds=i.competition}if(t)return[]}let r=await this.getCompetitions(e);return await this.idMapping.remapEntities(r,"competition")}catch(t){throw console.warn("There was a problem browsing all of the competitions",t),t}};getCompetitions=async e=>{if(this.isBrowser){let t=this.localStorage.getCompetitions(e);if(t&&t.length>0)return t;try{let r=await this.https.getCompetitions(e);return this.localStorage.setCompetitions(r),this.localStorage.getCompetitions(e)}catch(r){throw console.warn("There was a problem retrieving all competitions",r),r}}else return this.https.getCompetitions(e)};getCompetitionByIdIdMapping=async e=>{try{let r=(await this.idMapping.getEntityIdsBySchemaId([e],"competition","native")).competition[0],i=await this.getCompetitionById(r);return await this.idMapping.remapEntities(i,"competition")}catch(t){throw console.warn(`There was a problem browsing the following competition:${e}`,t),t}};getCompetitionById=async e=>{try{return await this.https.getCompetitionById(e)}catch(t){throw console.warn(`There was a problem retrieving the competition with the following id: ${e}`,t),t}};getTopCompetitionsIdMapping=async()=>{try{let e=await this.getTopCompetitions();return await this.idMapping.remapEntities(e,"competition")}catch(e){throw console.warn("There was a problem browsing the top competitions",e),e}};getTopCompetitions=async()=>{try{return await this.https.getTopCompetitions()}catch(e){throw console.warn("There was a problem retrieving the top competitions",e),e}}};var dt=class{name=null;countryId=null;national=!1;gender=null;limit=null;page=null;scope=null;sortField=null;sortOrder=null;teamIds=null;constructor(e){this.name=e.name?e.name:null,this.countryId=e.countryId?`${e.countryId}`:null,this.national=e.national?e.national:!1,this.gender=e.gender?e.gender:null,this.limit=e.limit?e.limit:null,this.page=e.page?e.page:null,this.scope=e.scope?e.scope:null,this.sortField=e.sortField?`${e.sortField}`:null,this.sortOrder=e.sortOrder?`${e.sortOrder}`:null,this.teamIds=e.teamIds?e.teamIds:null}constructFilterUrl=()=>{let e="";return this.name&&(e=e+"&",e=e+`name=${this.name}`),this.countryId&&(e=e+"&",e=e+`country_id=${this.countryId}`),this.national&&(e=e+"&",e=e+`national=${this.national}`),this.gender&&(e=e+"&",e=e+`gender=${this.gender}`),this.limit&&(e=e+"&",e=e+`limit=${this.limit}`),this.scope&&(e=e+"&",e=e+`scope=${this.scope.join(",")}`),this.page&&(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}`),this.teamIds&&(e=e+"&",e=e+`team_ids=${this.teamIds.join(",")}`),e}};var ht=class{https=null;idMapping=null;constructor(e,t){this.idMapping=t,this.https=e}getTeamsIdMapping=async e=>{try{let t=!1;if(e){if(e=new dt(e),e.countryId){let i=await this.idMapping.getEntityIdsBySchemaId([`${e.countryId}`],"country","native");i.country.length===0&&(t=!0),e.countryId=i.country[0]}if(e.scope){let i=await this.idMapping.getEntityIdsBySchemaId(e.scope,"competition","native");i.competition.length===0&&(t=!0),e.scope=i.competition}if(e.teamIds){let i=await this.idMapping.getEntityIdsBySchemaId(e.teamIds,"team","native");i.team.length===0&&(t=!0),e.teamIds=i.team}}if(t)return[];let r=await this.getTeams(e);return r.data=await this.idMapping.remapEntities(r.data,"team"),r}catch(t){throw console.warn("There was a problem browsing all teams",t),t}};getTeams=async e=>{try{return await this.https.getTeams(e)}catch(t){throw console.warn("There was a problem retrieving all teams",t),t}};getTeamByIdIdMapping=async e=>{try{e=(await this.idMapping.getEntityIdsBySchemaId([e],"team","native")).team[0];let r=await this.getTeamById(e);return await this.idMapping.remapEntities(r,"team")}catch(t){throw console.warn(`There was a problem browsing the following team:${e}`,t),t}};getTeamById=async e=>{try{return await this.https.getTeamById(e)}catch(t){throw console.warn(`There was a problem retrieving the following team: ${e}`,t),t}};getTopTeamsIdMapping=async()=>{try{let e=await this.getTopTeams();return await this.idMapping.remapEntities(e,"team")}catch(e){throw console.warn("There was a problem browsing the top teams",e),e}};getTopTeams=async()=>{try{return await this.https.getTopTeams()}catch(e){throw console.warn("There was a problem retrieving the top teams",e),e}};getNextMatchForTeamIdMapping=async e=>{try{e=(await this.idMapping.getEntityIdsBySchemaId([e],"team","native")).team[0];let r=await this.getNextMatchForTeam(e);return await this.idMapping.remapEntities(r,"match")}catch(t){throw console.warn(`There was a problem browsing the next match for the following team:${e}`,t),t}};getNextMatchForTeam=async e=>{try{return await this.https.getNextMatchForTeam(e)}catch(t){throw console.warn(`There was a problem retrieving the next match for the following team: ${e}`,t),t}};getPrevMatchForTeamIdMapping=async e=>{try{e=(await this.idMapping.getEntityIdsBySchemaId([e],"team","native")).team[0];let r=await this.getPrevMatchForTeam(e);return await this.idMapping.remapEntities(r,"match")}catch(t){throw console.warn(`There was a problem browsing the previous match for the following team:${e}`,t),t}};getPrevMatchForTeam=async e=>{try{return await this.https.getPrevMatchForTeam(e)}catch(t){throw console.warn(`There was a problem retrieving the previous match for the following team: ${e}`,t),t}}};var xe=class{countryId=null;scope=null;name=null;playerIds=null;limit=null;page=null;sortField=null;sortOrder=null;constructor(e){this.countryId=e.countryId?e.countryId:null,this.scope=e.scope?e.scope:null,this.name=e.name?e.name:null,this.playerIds=e.playerIds?e.playerIds:null,this.limit=e.limit?e.limit:null,this.page=e.page?e.page:null,this.sortField=e.sortField?e.sortField:null,this.sortOrder=e.sortOrder?e.sortOrder:null}constructFilterUrl=()=>{let e="";return this.countryId&&(e=e+"&",e=e+`country_id=${this.countryId}`),this.scope&&(e=e+"&",e=e+`scope=${this.scope.join(",")}`),this.name&&(e=e+"&",e=e+`name=${this.name}`),this.playerIds&&(e=e+"&",e=e+`player_ids=${this.playerIds.join(",")}`),this.limit&&(e=e+"&",e=e+`limit=${this.limit}`),this.page&&(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 H=class{https=null;idMapping=null;constructor(e,t){this.idMapping=t,this.https=e}getPlayersIdMapping=async e=>{try{let t=!1;if(e){if(e=new xe(e),e.countryId){let i=await this.idMapping.getEntityIdsBySchemaId([e.countryId],"country","native");i.country.length===0&&(t=!0),e.countryId=i.country[0]}if(e.playerIds){let i=await this.idMapping.getEntityIdsBySchemaId(e.playerIds,"player","native");i.player.length===0&&(t=!0),e.playerIds=i.player}if(e.scope){let i=await this.idMapping.getEntityIdsBySchemaId(e.scope,"competition","native");i.competition.length===0&&(t=!0),e.scope=i.competition}if(t)return[]}let r=await this.getPlayers(e);return r.data=await this.idMapping.remapEntities(r.data,"player"),r}catch(t){throw console.warn("There was a problem browsing the players",t),t}};getPlayersWithNativeIds=async e=>{let t=new xe({playerIds:e}),r=await this.getPlayers(t);return r.data.sort((i,a)=>i.id.localeCompare(a.id)),await this.idMapping.remapEntities(r.data,"player")};getPlayersMapWithNativeIds=async e=>{let t={},r=V(e);r.sort((a,s)=>a.localeCompare(s));let i=await this.getPlayersWithNativeIds(r);return r.forEach((a,s)=>t[a]=i[s]),t};getPlayers=async e=>{try{return await this.https.getPlayers(e)}catch(t){throw console.warn("There was a problem retrieving the players",t),t}};getPlayerIdMapping=async e=>{try{let t=await this.idMapping.getEntityIdsBySchemaId([e],"player","native"),r=await this.getPlayerById(t.player[0]);return await this.idMapping.remapEntities(r,"player")}catch(t){throw console.warn(`There was a problem browsing the following player:${e}`,t),t}};getPlayerById=async e=>{try{return await this.https.getPlayerById(e)}catch(t){throw console.warn(`There was a problem retrieving the following player: ${e}`,t),t}};getTopPlayersIdMapping=async()=>{try{let e=await this.getTopPlayers();return await this.idMapping.remapEntities(e,"player")}catch(e){throw console.warn("There was a problem browsing the top players",e),e}};getTopPlayers=async()=>{try{return await this.https.getTopPlayers()}catch(e){throw console.warn("There was a problem retrieving the top players",e),e}};getNextMatchForPlayerIdMapping=async e=>{try{e=(await this.idMapping.getEntityIdsBySchemaId([e],"player","native")).player[0];let r=await this.getNextMatchForPlayer(e);return await this.idMapping.remapEntities(r,"match")}catch(t){throw console.warn(`There was a problem browsing the next match for player:${e}`,t),t}};getNextMatchForPlayer=async e=>{try{return await this.https.getNextMatchForPlayer(e)}catch(t){throw console.warn(`There was a problem retrieving the next match for player: ${e}`,t),t}};getPrevMatchForPlayerIdMapping=async e=>{try{e=(await this.idMapping.getEntityIdsBySchemaId([e],"player","native")).player[0];let r=await this.getPrevMatchForPlayer(e);return await this.idMapping.remapEntities(r,"match")}catch(t){throw console.warn(`There was a problem browsing the previous match for player:${e}`,t),t}};getPrevMatchForPlayer=async e=>{try{return await this.https.getPrevMatchForPlayer(e)}catch(t){throw console.warn(`There was a problem retrieving the previous match for player: ${e}`,t),t}}};var Ae=class{countryIds=null;competitionIds=null;matchIds=null;status=null;teamIds=null;fromDate=null;toDate=null;limit=null;page=null;sortField=null;sortOrder=null;constructor(e){this.countryIds=e.countryIds?e.countryIds:null,this.competitionIds=e.competitionIds?e.competitionIds:null,this.matchIds=e.matchIds?e.matchIds:null,this.status=e.status?e.status:null,this.teamIds=e.teamIds?e.teamIds:null,this.fromDate=e.fromDate?e.fromDate:null,this.toDate=e.toDate?e.toDate:null,this.limit=e.limit?e.limit:null,this.page=e.page?e.page:null,this.sortField=e.sortField?e.sortField:null,this.sortOrder=e.sortOrder?e.sortOrder:null}constructFilterUrl=()=>{let e="";return this.countryIds&&(e=e+"&",e=e+`countries=${this.countryIds.join(",")}`),this.competitionIds&&(e=e+"&",e=e+`competitions=${this.competitionIds.join(",")}`),this.matchIds&&(e=e+"&",e=e+`matches=${this.matchIds.join(",")}`),this.status&&(e=e+"&",e=e+`status=${this.status}`),this.teamIds&&(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&&(e=e+"&",e=e+`limit=${this.limit}`),this.page&&(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 k=class{https=null;idMapping=null;constructor(e,t){this.https=e,this.idMapping=t}getMatchesIdMapping=async e=>{try{if(e){if(e=new Ae(e),e.countryIds){let r=await this.idMapping.getEntityIdsBySchemaId(e.countryIds,"country","native");e.countryIds=r.country}if(e.competitionIds){let r=await this.idMapping.getEntityIdsBySchemaId(e.competitionIds,"competition","native");e.competitionIds=r.competition}if(e.matchIds){let r=await this.idMapping.getEntityIdsBySchemaId(e.matchIds,"match","native");e.matchIds=r.match}if(e.teamIds){let r=await this.idMapping.getEntityIdsBySchemaId(e.teamIds,"team","native");e.teamIds=r.team}}let t=await this.getMatches(e);return t.data=await this.idMapping.remapEntities(t.data,"match"),t}catch(t){throw console.warn("There was a problem browsing the matches",t),t}};getMatchesWithNativeIds=async e=>{let t=new Ae({matchIds:e}),r=await this.getMatches(t);return r.data.sort((i,a)=>i.id.localeCompare(a.id)),await this.idMapping.remapEntities(r.data,"match")};getMatchesMapWithNativeIds=async e=>{let t={},r=V(e);r.sort((a,s)=>a.localeCompare(s));let i=await this.getMatchesWithNativeIds(r);return r.forEach((a,s)=>t[a]=i[s]),t};getMatches=async e=>{try{return await this.https.getMatches(e)}catch(t){throw console.warn("There was a problem retrieving the matches",t),t}};getMatchIdMapping=async e=>{try{let t=await this.idMapping.getEntityIdsBySchemaId([e],"match","native"),r=await this.getMatchById(t.match[0]);return await this.idMapping.remapEntities(r,"match")}catch(t){throw console.warn(`There was a problem browsing the following match: ${e}`,t),t}};getMatchById=async e=>{try{return await this.https.getMatchById(e)}catch(t){throw console.warn(`There was a problem retrieving the following match: ${e}`,t),t}}};var ft=class{entities=null;query=null;scope=null;constructor(e){this.entities=e.entities?e.entities:null,this.query=e.query?e.query:null,this.scope=e.scope?e.scope:null}constructFilterUrl=()=>{let e="";return this.entities&&(e=e+"&",e=e+`entities=${this.entities.join(",")}`),this.query&&(e=e+"&",e=e+`q=${this.query}`),this.scope&&(e=e+"&",e=e+`scope=${this.scope.join(",")}`),e}};var gt=class{https=null;idMapping=null;constructor(e,t){this.https=e,this.idMapping=t}searchIdMapping=async e=>{try{if(e=new ft(e),e.scope){let r=await this.idMapping.getEntityIdsBySchemaId(e.scope,"competition","native");e.scope=r.competition}let t=await this.search(e);if(t.teams&&t.teams.length>0){let r=await this.idMapping.remapEntities(t.teams,"team");t.teams=r}if(t.players&&t.players.length>0){let r=await this.idMapping.remapEntities(t.players,"player");t.players=r}if(t.competitions&&t.competitions.length>0){let r=await this.idMapping.remapEntities(t.competitions,"competition");t.competitions=r}return t}catch(t){throw console.warn("There was a problem with browsing the search result",t),t}};search=async e=>{try{return await this.https.search(e)}catch(t){throw console.warn("There was a problem retrieving the search response",t),t}}};var q=class{isBrowser=!1;localStorage={};https=null;idMapping=null;countriesFacade=null;competitionsFacade=null;teamsFacade=null;playerFacade=null;matchFacade=null;searchFacade=null;constructor(e,t,r){this.isBrowser=typeof window!="undefined",this.localStorage=e,this.idMapping=r,this.https=t,this.countriesFacade=new ct(e,t,r),this.competitionsFacade=new ut(e,t,r),this.teamsFacade=new ht(t,r),this.playerFacade=new H(t,r),this.matchFacade=new k(t,r),this.searchFacade=new gt(t,r)}getCountries=async()=>this.countriesFacade.getCountriesWithIdMapping();getCompetitions=async e=>this.competitionsFacade.getCompetitionsIdMapping(e);getCompetitionById=async e=>this.competitionsFacade.getCompetitionByIdIdMapping(e);getTopCompetitions=async()=>this.competitionsFacade.getTopCompetitionsIdMapping();getTeams=async e=>this.teamsFacade.getTeamsIdMapping(e);getTeamById=async e=>this.teamsFacade.getTeamByIdIdMapping(e);getTopTeams=async()=>this.teamsFacade.getTopTeamsIdMapping();getNextMatchForTeam=async e=>this.teamsFacade.getNextMatchForTeamIdMapping(e);getPrevMatchForTeam=async e=>this.teamsFacade.getPrevMatchForTeamIdMapping(e);getPlayers=async e=>this.playerFacade.getPlayersIdMapping(e);getPlayerById=async e=>this.playerFacade.getPlayerIdMapping(e);getTopPlayers=async()=>this.playerFacade.getTopPlayersIdMapping();getNextMatchForPlayer=async e=>this.playerFacade.getNextMatchForPlayerIdMapping(e);getPrevMatchForPlayer=async e=>this.playerFacade.getPrevMatchForPlayerIdMapping(e);getMatches=async e=>this.matchFacade.getMatchesIdMapping(e);getMatchById=async e=>this.matchFacade.getMatchIdMapping(e);search=async e=>this.searchFacade.searchIdMapping(e)};var oe=class{idMapping=null;footballFacade=null;constructor(e,t){this.idMapping=e,this.footballFacade=t}remapInterestsToIdSchema=async e=>{let t=this.idMapping.idSchema;if(t!=="native")if(e.length>0){let r={},i={};e.forEach(n=>{r.hasOwnProperty(n.type)||(r[n.type]=[],i[n.type]=[]),r[n.type].push(n.id),i[n.type].push(n)});let a=await this.idMapping.idMappingFacade.getEntitiesByIds(r,"native",t),s=[];for(let[n,p]of Object.entries(i))p.forEach((u,l)=>{u.id=a[n][l],s.push(u)});return s}else return e;else return e};remapInterestToNative=async e=>{let t=this.idMapping.idSchema;if(t!=="native"){let r={},{id:i,type:a}=e;r[a]=[i];let s=await this.idMapping.idMappingFacade.getEntitiesByIds(r,t,"native");return e.id=s[a][0],e}return e};inquiryCustomInterests=async e=>{let t=[];if(e&&e.length>0&&(t=e.filter(r=>r.source==="custom")),t&&t.length>0){let r=e.filter(a=>a.source!=="custom"),i=await this.remapInterestsToIdSchema(r);return t.forEach(a=>i.push(a)),i}return await this.remapInterestsToIdSchema(e)};showFullInterests=async e=>{let t=[];if(e&&e.length>0)for(let r of e)if(r.source!=="custom"&&r.source==="football"){let i={};if(r.type==="team"){i.teamIds=[r.id];let a=await this.footballFacade.getTeams(i);r.model=a.data[0]}if(r.type==="player"){i.playerIds=[r.id];let a=await this.footballFacade.getPlayers(i);r.model=a.data[0]}if(r.type==="competition"){i.competitionIds=[r.id];let a=await this.footballFacade.getCompetitions(i);r.model=a[0]}r.model===void 0&&(r.model=null),t.push(r)}else t.push(r);return t}};var yt=class{profileHttps=null;footballHttps=null;localStorage=null;idMapping=null;profileFacade=null;footballFacade=null;interestsService=null;ownProfile=null;modified=!1;expireAt=0;promises=[];isFetching=!1;constructor(e,t,r,i){this.localStorage=e,this.profileHttps=t,this.footballHttps=i,this.idMapping=r,this.footballFacade=new q(e,i,r),this.interestsService=new oe(r,this.footballFacade),this.profileFacade=new $(e,t)}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 e=Math.floor(Date.now()/1e3);if(!this.ownProfile||this.expireAt<e){this.isFetching=!0,this.expireAt=Math.floor(Date.now()/1e3)+600;try{let t=await this.profileFacade.getOwn();this.setOwnProfile(t)}catch{this.isFetching=!1}return this.modified=!1,this.isFetching=!1,this.ownProfile}return this.ownProfile};delay=e=>new Promise(t=>{setTimeout(t,e)});setOwnProfile=e=>{this.ownProfile=e};extractUpdatedProps=(e,t)=>{let r={};return Object.keys(e).forEach(i=>{i==="gender"&&e[i]!==t[i]?r[i]=t[i]:i==="birthDate"?(t[i]===null||e[i]===null&&t[i]||e[i]!==t[i])&&(r.birth_date=t[i]):i==="country"?t[i]===null?r.country_id=t[i]:(e[i]===null&&t[i]||e[i].id!==t[i].id)&&(r.country_id=t[i].id):i==="interests"&&(e[i].length>0?e[i].filter(s=>!t[i].some(n=>s.id===n.id&&s.favourite===n.favourite&&s.type===n.type&&s.source===n.source)).length>0&&(r[i]=t[i]):r[i]=t[i])}),r};getInfo=async()=>{let e=await this.getOwnProfile(),t=JSON.parse(JSON.stringify(e));return delete t.interests,t};showInterests=async()=>{let e=await this.getOwnProfile(),t=[];return t=e.interests,await this.interestsService.inquiryCustomInterests(t)};showFullInterests=async()=>{let e=await this.showInterests();return await this.interestsService.showFullInterests(e)};getFollowers=async e=>await this.profileFacade.getFollowers(e);getFollowing=async e=>await this.profileFacade.getFollowing(e);follow=async e=>await this.profileFacade.follow(e);unfollow=async e=>await this.profileFacade.unfollow(e);addInterestPromise=async e=>{this.modified=!0,await this.getOwnProfile();let t=null;e.source!=="custom"?t=await this.interestsService.remapInterestToNative(e):t=e;let r=this.ownProfile.interests.filter(i=>i.id!==t.id||i.type!==t.type||i.source!==t.source);return this.ownProfile.interests=[...r],this.ownProfile.interests.push(t),this};addInterest=e=>(this.promises.push(this.addInterestPromise(e)),this);removeInterestPromise=async e=>{this.modified=!0,await this.getOwnProfile();let t=null;return e.source!=="custom"?t=await this.interestsService.remapInterestToNative(e):t=e,this.ownProfile.interests=this.ownProfile.interests.filter(r=>r.id!==t.id||r.type!==t.type||r.source!==t.source),this};removeInterest=e=>(this.promises.push(this.removeInterestPromise(e)),this);setBirthdatePromise=async e=>(this.modified=!0,await this.getOwnProfile(),e?this.ownProfile.birthDate=e:this.ownProfile.birthDate=null,this);setBirthdate=e=>(this.promises.push(this.setBirthdatePromise(e)),this);setGenderPromise=async e=>(this.modified=!0,await this.getOwnProfile(),e==="male"||e==="female"?this.ownProfile.gender=e:this.ownProfile.gender="unspecified",this);setGender=e=>(this.promises.push(this.setGenderPromise(e)),this);setCountryPromise=async e=>(this.modified=!0,await this.getOwnProfile(),e&&!this.ownProfile.country?(this.ownProfile.country=new pt,this.ownProfile.country.id=e):e&&this.ownProfile.country?this.ownProfile.country.id=e:this.ownProfile.country=null,this);setCountry=e=>(this.promises.push(this.setCountryPromise(e)),this);showFullnessProfile=async()=>{let e=await this.getOwnProfile(),t=JSON.parse(JSON.stringify(e));return this.profileFacade.showFullnessProfile(t)};update=async()=>{if(this.promises.length===0)return this.ownProfile;await Promise.all(this.promises);let e=await this.profileFacade.getOwn(),t=await this.getOwnProfile(),r=this.extractUpdatedProps(e,t),i=await this.profileHttps.updateProfile(r);return this.modified=!1,this.expireAt=0,this.localStorage.setOwnProfile(i),delete i.interests,i}};var Mt=class{profileHttps=null;footballFacade=null;localStorage=null;idMapping=null;profileFacade=null;interestsService=null;profileId="";constructor(e,t,r,i){this.localStorage=e,this.profileHttps=t,this.footballFacade=i,this.idMapping=r,this.interestsService=new oe(r,i),this.profileFacade=new $(e,t)}setId=e=>(this.profileId=e,this);getProfile=async()=>await this.profileFacade.getById(this.profileId);getInfo=async()=>{let e=await this.getProfile();return delete e.interests,e};showInterests=async()=>{let e=await this.getProfile(),t=[];return t=e.interests,await this.interestsService.inquiryCustomInterests(t)};showFullInterests=async()=>{let e=await this.showInterests();return await this.interestsService.showFullInterests(e)};getFollowers=async e=>await this.profileFacade.getFollowers(e,this.profileId);getFollowing=async e=>await this.profileFacade.getFollowing(e,this.profileId);showFullnessProfile=async()=>{let e=await this.getProfile();return this.profileFacade.showFullnessProfile(e)}};var Ao=Fe(re());var wt=class{id="";alias="";countryCode="";assets=null;name=""};var g=class{countriesFromResponse=e=>{if(e)return e.map(t=>this.countryFromResponse(t))};countryFromResponse=e=>{try{if(e){let t=new wt;return t.id=e.id,t.alias=e.alias,t.assets=e.assets,t.countryCode=e.country_code,t.name=e.name,t}}catch(t){throw t}return null}};var bt=class{id="";country=null;gender="";assets=null;type="";name=""};var I=class{countryRemapper=null;constructor(){this.countryRemapper=new g}fromResponse(e){try{let t=new bt;return t.id=e.id,t.country=this.countryRemapper.countryFromResponse(e.country),t.gender=e.gender,t.assets=e.assets,t.type=e.type,t.name=e.name,t}catch(t){throw console.warn("There was a problem remapping the competition response",t),t}}};var Pt=class{id="";country=null;gender="";assets=null;type="";name="";participants=[]};var It=class{id="";country=null;gender="";assets=null;name="";code="";national=!1;fullName="";shortName=""};var M=class{countryRemapper=null;constructor(){this.countryRemapper=new g}fromResponse(e){try{let t=new It;return t.id=e.id,t.country=this.countryRemapper.countryFromResponse(e.country),t.gender=e.gender,t.assets=e.assets,t.code=e.code,t.national=e.national,t.fullName=e.full_name,t.shortName=e.short_name,t.name=e.name,t}catch(t){throw console.warn("There was a problem remapping teams response",t),t}}};var Rt=class{countryRemapper=null;teamBasicRemapper=null;constructor(){this.countryRemapper=new g,this.teamBasicRemapper=new M}fromResponse(e){try{let t=new Pt;return t.id=e.id,t.country=this.countryRemapper.countryFromResponse(e.country),t.gender=e.gender,t.assets=e.assets,t.type=e.type,t.name=e.name,t.participants=e.participants.map(r=>this.teamBasicRemapper.fromResponse(r)),t}catch(t){throw console.warn("There was a problem remapping the competition response",t),t}}};var Ft=class{id="";country=null;gender="";assets=null;name="";competitions=[];code="";national=!1;fullName="";shortName="";squad=[]};var vt=class{id="";startDate="";endDate="";shirtNumber;loan=!1;position="";country=null;name="";assets=null;birthDate=""};var St=class{countryRemapper=null;constructor(){this.countryRemapper=new g}fromResponse(e){try{let t=new vt;return t.id=e.id,t.startDate=e.start_date,t.endDate=e.end_date,t.shirtNumber=e.shirt_number,t.loan=e.loan,t.position=e.position,t.country=this.countryRemapper.countryFromResponse(e.country),t.name=e.name,t.assets=e.assets,t.birthDate=e.birth_date,t}catch(t){throw console.warn("There was a problem remapping the player from squad",t),t}}};var Tt=class{countryRemapper=null;competitionRemapper=null;playerRemapper=null;constructor(){this.countryRemapper=new g,this.competitionRemapper=new I,this.playerRemapper=new St}fromResponse(e){try{let t=new Ft;return t.id=e.id,t.country=this.countryRemapper.countryFromResponse(e.country),t.gender=e.gender,t.assets=e.assets,t.code=e.code,t.national=e.national,t.fullName=e.full_name,t.shortName=e.short_name,t.name=e.name,t.competitions=e.competitions?e.competitions.map(r=>this.competitionRemapper.fromResponse(r)):[],t.squad=e.squad?e.squad.map(r=>this.playerRemapper.fromResponse(r)):[],t}catch(t){throw console.warn("There was a problem remapping team response",t),t}}};var Et=class{id="";kickoffAt="";finishedAt="";updatedAt="";homeTeam=null;awayTeam=null;lineupsConfirmed=!1;startedAt="";minute="";scores=null;context={competition:null};status={type:null,subType:null}};var Ct=class{ftScore=null;htScore=null;aetScore=null;aggScore=null;penScore=null};var ae=class{fromResponse(e){try{let t=new Ct;return t.ftScore=this.statEntityFromResponse(e.ft_score),t.htScore=this.statEntityFromResponse(e.ht_score),t.aetScore=this.statEntityFromResponse(e.aet_score),t.aggScore=this.statEntityFromResponse(e.agg_score),t.penScore=this.statEntityFromResponse(e.pen_score),t}catch(t){throw console.warn("There was a problem remapping the scores",t),t}}statEntityFromResponse=e=>({homeGoals:e.home_goals,awayGoals:e.away_goals})};var _t=class{teamRemapper=null;competitionRemapper=null;scoresRemapper=null;constructor(){this.teamRemapper=new M,this.competitionRemapper=new I,this.scoresRemapper=new ae}fromResponse(e){try{let t=new Et;return t.id=e.id,t.kickoffAt=e.kickoff_at,t.finishedAt=e.finished_at,t.updatedAt=e.updated_at,t.homeTeam=this.teamRemapper.fromResponse(e.home_team),t.awayTeam=this.teamRemapper.fromResponse(e.away_team),t.lineupsConfirmed=e.lineups_confirmed,t.startedAt=e.started_at,t.minute=e.minute,t.scores=this.scoresRemapper.fromResponse(e.scores),t.context={competition:e.context.competition?this.competitionRemapper.fromResponse(e.context.competition):null},t.status={type:e.status.type,subType:e.status.sub_type},t}catch(t){throw console.warn("There was a problem remapping the match response",t),t}}};var Ot=class{id="";kickoffAt="";finishedAt="";updatedAt="";homeTeam=null;awayTeam=null;lineupsConfirmed=!1;startedAt="";minute="";scores=null;stats=null;context={competition:null};timeline=[];status={type:null,subType:null};lineups=null};var xt=class{corners=null;crosses=null;offside=null;shotsOn=null;throwIn=null;redCards=null;shotsOff=null;goalKicks=null;possession=null;treatments=null;yellowCards=null;shotsBlocked=null;substitutions=null;counterAttacks=null;foulsCommitted=null};var At=class{fromResponse(e){try{let t=new xt;return t.corners=this.statEntityFromResponse(e.corners),t.crosses=this.statEntityFromResponse(e.crosses),t.offside=this.statEntityFromResponse(e.offside),t.shotsOn=this.statEntityFromResponse(e.shots_on),t.throwIn=this.statEntityFromResponse(e.throw_in),t.redCards=this.statEntityFromResponse(e.red_cards),t.shotsOff=this.statEntityFromResponse(e.shots_off),t.goalKicks=this.statEntityFromResponse(e.goal_kicks),t.possession=this.statEntityFromResponse(e.possession),t.treatments=this.statEntityFromResponse(e.treatments),t.yellowCards=this.statEntityFromResponse(e.yellow_cards),t.shotsBlocked=this.statEntityFromResponse(e.shots_blocked),t.substitutions=this.statEntityFromResponse(e.substitutions),t.counterAttacks=this.statEntityFromResponse(e.counter_attacks),t.foulsCommitted=this.statEntityFromResponse(e.fouls_committed),t}catch(t){throw console.warn("There was a problem remapping the stats",t),t}}statEntityFromResponse=e=>({homeTeam:e?e.home_team:null,awayTeam:e?e.away_team:null})};var se=class{homeTeam={players:[]};awayTeam={players:[]}};var Bt=class{id="";name="";position="";shirtNumber;assets=null;type=""};var ne=class{fromResponse(e){try{let t=new Bt;return t.id=e.id,t.name=e.name,t.position=e.position,t.shirtNumber=e.shirt_number,t.assets=e.assets,t.type=e.type,t}catch(t){throw console.warn("There was a problem remapping the player from timeline",t),t}}};var Nt=class{playerRemapper=null;constructor(){this.playerRemapper=new ne}fromResponse(e){try{let t=new se;return t.homeTeam.players=e.home_team&&e.home_team.players?e.home_team.players.map(r=>this.playerRemapper.fromResponse(r)):[],t.awayTeam.players=e.away_team&&e.away_team.players?e.away_team.players.map(r=>this.playerRemapper.fromResponse(r)):[],t}catch(t){throw console.warn("There was a problem remapping the lineups",t),t}}};var Lt=class{minute="";type="";teamId="";player=null;relatedPlayer=null;updatedAt=""};var Gt=class{playerRemapper=null;constructor(){this.playerRemapper=new ne}fromResponse(e){try{let t=new Lt;return t.minute=e.minute,t.type=e.type,t.teamId=e.team_id,t.player=this.playerRemapper.fromResponse(e.player),t.relatedPlayer=e.related_player?this.playerRemapper.fromResponse(e.related_player):null,t.updatedAt=e.updated_at,t}catch(t){throw console.warn("There was a problem remapping timeline",t),t}}};var Ut=class{teamMapper=null;competitionsMapper=null;lineupsMapper=null;scoresMapper=null;statsMapper=null;timelineMapper=null;constructor(){this.teamMapper=new M,this.competitionsMapper=new I,this.lineupsMapper=new Nt,this.scoresMapper=new ae,this.statsMapper=new At,this.timelineMapper=new Gt}fromResponse(e){try{let t=new Ot;return t.id=e.id,t.kickoffAt=e.kickoff_at,t.finishedAt=e.finished_at,t.updatedAt=e.updated_at,t.homeTeam=e.home_team?this.teamMapper.fromResponse(e.home_team):null,t.awayTeam=e.away_team?this.teamMapper.fromResponse(e.away_team):null,t.lineupsConfirmed=e.lineups_confirmed,t.startedAt=e.started_at,t.minute=e.minute,t.scores=this.scoresMapper.fromResponse(e.scores),t.stats=this.statsMapper.fromResponse(e.stats),t.context={competition:this.competitionsMapper.fromResponse(e.context.competition)},t.timeline=e.timeline?e.timeline.map(r=>this.timelineMapper.fromResponse(r)):[],t.status={type:e.status.type,subType:e.status.sub_type},t.lineups=e.lineups?this.lineupsMapper.fromResponse(e.lineups):new se,t}catch(t){throw console.warn("There was a problem remapping the match response",t),t}}};var Vt=class{id="";country=null;birthDate="";firstName="";lastName="";name="";position="";assets=null};var Dt=class{countryRemapper=null;constructor(){this.countryRemapper=new g}fromResponse(e){try{let t=new Vt;return t.id=e.id,t.firstName=e.first_name?e.first_name:null,t.lastName=e.last_name?e.last_name:null,t.name=e.name?e.name:null,t.birthDate=e.birth_date,t.country=this.countryRemapper.countryFromResponse(e.country),t.assets=e.assets,t.position=e.position,t}catch(t){throw console.warn("There was a problem remapping top player response",t),t}}};var $t=class{id="";country=null;birthDate="";firstName="";lastName="";name="";position="";assets=null;teams=[]};var le=class{countryRemapper=null;teamRemapper=null;constructor(){this.countryRemapper=new g,this.teamRemapper=new M}fromResponse(e){try{let t=new $t;return t.id=e.id,t.firstName=e.first_name?e.first_name:null,t.lastName=e.last_name?e.last_name:null,t.name=e.name?e.name:null,t.birthDate=e.birth_date,t.country=this.countryRemapper.countryFromResponse(e.country),t.assets=e.assets,t.teams=e.teams?e.teams.map(r=>this.teamRemapper.fromResponse(r)):[],t.position=e.position,t}catch(t){throw console.warn("There was a problem remapping players response",t),t}}};var Ht=class{id="";country=null;birthDate="";firstName="";lastName="";name="";position="";assets=null;competitions=[];teams=[]};var kt=class{countryRemapper=null;teamRemapper=null;competitionRemapper=null;constructor(){this.countryRemapper=new g,this.teamRemapper=new M,this.competitionRemapper=new I}fromResponse(e){try{let t=new Ht;return t.id=e.id,t.firstName=e.first_name?e.first_name:null,t.lastName=e.last_name?e.last_name:null,t.name=e.name?e.name:null,t.birthDate=e.birth_date,t.country=this.countryRemapper.countryFromResponse(e.country),t.assets=e.assets,t.teams=e.teams?e.teams.map(r=>this.teamRemapper.fromResponse(r)):[],t.position=e.position,t.competitions=e.competitions?e.competitions.map(r=>this.competitionRemapper.fromResponse(r)):[],t}catch(t){throw console.warn("There was a problem remapping player response",t),t}}};var qt=class{teams=null;players=null;competitions=null};var jt=class{teamRemapper=null;playerRemapper=null;competitionremapper=null;constructor(){this.teamRemapper=new M,this.playerRemapper=new le,this.competitionremapper=new I}fromResponse(e){try{let t=new qt;return t.teams=e.teams?e.teams.map(r=>this.teamRemapper.fromResponse(r)):[],t.players=e.players?e.players.map(r=>this.playerRemapper.fromResponse(r)):[],t.competitions=e.competitions?e.competitions.map(r=>this.competitionremapper.fromResponse(r)):[],t}catch(t){throw console.warn("There was a problem remapping search response",t),t}}};var Xt=class{currentPage=null;itemsPerPage=null;totalItems=null;numberOfPages=null};var pe=class{pagination=new Xt};var ce=class{meta=new pe;data=[]};var Kt=class{remapMetaProp=e=>{let t=new pe;return t.pagination.currentPage=e.pagination.current_page,t.pagination.itemsPerPage=e.pagination.items_per_page,t.pagination.totalItems=e.pagination.total_items,t.pagination.numberOfPages=e.pagination.number_of_pages,t}};var B=class{instance=null;apiSignInUrl="";idSchema="";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;constructor(e){let t=A(e.environment,"football");this.apiSignInUrl=`?key=${e.apiKey}&lang=${e.lang}&client_id=${e.clientId}`,this.idSchema=e.idSchema,this.instance=Ao.default.create({baseURL:t}),this.countryRemapper=new g,this.competitionBasicRemapper=new I,this.competitionFullRemapper=new Rt,this.teamBasicRemapper=new M,this.teamFullRemapper=new Tt,this.matchBasicRemapper=new _t,this.matchFullRemapper=new Ut,this.playerBasicRemapper=new le,this.playerFullRemapper=new kt,this.topPlayerRemapper=new Dt,this.searchRemapper=new jt,this.footballMetaRemapper=new Kt}getCountries=async()=>{try{let e=await this.instance.get(`/countries${this.apiSignInUrl}`);return this.countryRemapper.countriesFromResponse(e.data.data)}catch(e){throw console.warn("There was a problem with the football countries request",e),e}};getCompetitions=async e=>{try{let t={};if(e&&e.competitionIds&&e.competitionIds.length>this.limitIds-1){let r=[],i=Ke(e.competitionIds);for(let s of i)e.competitionIds=s,t=await this.instance.get(`/competitions${this.apiSignInUrl}${e.constructFilterUrl()}`),r.push(t.data.data.map(n=>this.competitionBasicRemapper.fromResponse(n)));return Array.prototype.concat.apply([],r)}else return t=e?await this.instance.get(`/competitions${this.apiSignInUrl}${e.constructFilterUrl()}`):await this.instance.get(`/competitions${this.apiSignInUrl}`),t.data.data.map(r=>this.competitionBasicRemapper.fromResponse(r))}catch(t){throw console.warn("There was a problem with getCompetitions request",t),t.response}};getCompetitionById=async e=>{try{let t=await this.instance.get(`/competitions/${e}${this.apiSignInUrl}`);return this.competitionFullRemapper.fromResponse(t.data.data)}catch(t){throw console.warn("There was a problem with getCompetitionById request",t),t.response}};getTopCompetitions=async()=>{try{return(await this.instance.get(`/competitions/top${this.apiSignInUrl}`)).data.data.map(t=>this.competitionBasicRemapper.fromResponse(t))}catch(e){throw console.warn("There was a problem with getTopCompetitions request",e),e.response}};getTeams=async e=>{try{let t={};if(e&&e.teamIds&&e.teamIds.length>this.limitIds){let r=[],i=Ke(e.teamIds);for(let s of i)e.teamIds=s,t=await this.instance.get(`/teams${this.apiSignInUrl}${e.constructFilterUrl()}`),r.push(t.data.data.map(n=>this.teamBasicRemapper.fromResponse(n)));return Array.prototype.concat.apply([],r)}else{let r=new ce;return t=e?await this.instance.get(`/teams${this.apiSignInUrl}${e.constructFilterUrl()}`):await this.instance.get(`/teams${this.apiSignInUrl}`),r.meta=this.footballMetaRemapper.remapMetaProp(t.data.meta),r.data=t.data.data.map(i=>this.teamBasicRemapper.fromResponse(i)),r}}catch(t){throw console.warn("There was a problem with getTeams request",t),t.response}};getTeamById=async e=>{try{let t=await this.instance.get(`/teams/${e}${this.apiSignInUrl}`);return this.teamFullRemapper.fromResponse(t.data.data)}catch(t){throw console.warn("There was a problem with getTeamById request",t),t.response}};getTopTeams=async()=>{try{let e=await this.instance.get(`/teams/top${this.apiSignInUrl}`);return e.data.data?e.data.data.map(t=>this.teamBasicRemapper.fromResponse(t)):[]}catch(e){throw console.warn("There was a problem with getTopTeams request",e),e.response}};getNextMatchForTeam=async e=>{try{let t=await this.instance.get(`/teams/${e}/next-match${this.apiSignInUrl}`);return this.matchFullRemapper.fromResponse(t.data.data)}catch(t){throw console.warn("There was a problem with getNextMatchForTeam request",t),t.response}};getPrevMatchForTeam=async e=>{try{let t=await this.instance.get(`/teams/${e}/previous-match${this.apiSignInUrl}`);return this.matchFullRemapper.fromResponse(t.data.data)}catch(t){throw console.warn("There was a problem with getPrevMatchForTeam request",t),t.response}};getPlayers=async e=>{try{let t={};if(e&&e.playerIds&&e.playerIds.length>this.limitIds-1){let r=[],i=Ke(e.playerIds);for(let s of i)e.playerIds=s,t=await this.instance.get(`/players${this.apiSignInUrl}${e.constructFilterUrl()}`),r.push(t.data.data.map(n=>this.teamBasicRemapper.fromResponse(n)));return Array.prototype.concat.apply([],r)}else{let r=new ce,i=e?await this.instance.get(`/players${this.apiSignInUrl}${e.constructFilterUrl()}`):await this.instance.get(`/players${this.apiSignInUrl}`);return r.meta=this.footballMetaRemapper.remapMetaProp(i.data.meta),r.data=i.data.data.map(a=>this.playerBasicRemapper.fromResponse(a)),r}}catch(t){throw console.warn("There was a problem with getPlayers request",t),t.response}};getPlayerById=async e=>{try{let t=await this.instance.get(`/players/${e}${this.apiSignInUrl}`);return this.playerFullRemapper.fromResponse(t.data.data)}catch(t){throw console.warn("There was a problem with getPlayerById request",t),t.response}};getTopPlayers=async()=>{try{return(await this.instance.get(`/players/top${this.apiSignInUrl}`)).data.data.map(t=>this.topPlayerRemapper.fromResponse(t))}catch(e){throw console.warn("There was a problem with getTopPlayers request",e),e.response}};getNextMatchForPlayer=async e=>{try{let t=await this.instance.get(`/players/${e}/next-match${this.apiSignInUrl}`);return this.matchFullRemapper.fromResponse(t.data.data)}catch(t){throw console.warn("There was a problem with getNextMatchForPlayer request",t),t.response}};getPrevMatchForPlayer=async e=>{try{let t=await this.instance.get(`/players/${e}/previous-match${this.apiSignInUrl}`);return this.matchFullRemapper.fromResponse(t.data.data)}catch(t){throw console.warn("There was a problem with getPrevMatchForPlayer request",t),t.response}};getMatchById=async e=>{try{let t=await this.instance.get(`/matches/${e}${this.apiSignInUrl}`);return this.matchFullRemapper.fromResponse(t.data.data)}catch(t){throw console.warn("There was a problem with getMatchById request",t),t.response}};getMatches=async e=>{try{let t=new ce,r=e?await this.instance.get(`/matches${this.apiSignInUrl}${e.constructFilterUrl()}`):await this.instance.get(`/matches${this.apiSignInUrl}`);return t.meta=this.footballMetaRemapper.remapMetaProp(r.data.meta),t.data=r.data.data.map(i=>this.matchBasicRemapper.fromResponse(i)),t}catch(t){throw console.warn("There was a problem with getMatches request",t),t.response}};search=async e=>{try{let t=await this.instance.get(`/search${this.apiSignInUrl}${e.constructFilterUrl()}`);return this.searchRemapper.fromResponse(t.data.data)}catch(t){throw console.warn("There was a problem with search request",t),t.response}}};var Yt=class{profileHttps=null;footballHttps=null;footballFacade=null;idMapping=null;localStorage=null;profileFacade=null;ownProfileBuilder=null;profileBuilder=null;constructor(e){this.profileHttps=new tt(e),this.footballHttps=new B(e),this.idMapping=new E(e),this.localStorage=new D(e),this.footballFacade=new q(this.localStorage,this.footballHttps,this.idMapping),this.profileFacade=new $(this.localStorage,this.profileHttps),this.ownProfileBuilder=new yt(this.localStorage,this.profileHttps,this.idMapping,this.footballHttps),this.profileBuilder=new Mt(this.localStorage,this.profileHttps,this.idMapping,this.footballFacade)}getOwn=()=>this.ownProfileBuilder;getById=e=>this.profileBuilder.setId(e);getCountries=async()=>await this.profileFacade.getCountries();getByIds=async e=>await this.profileFacade.getByIds(e)};var Wt=class{validate=e=>{let t=this.validateField(e.lang),r=this.generateMessage(t);return{validation:t,message:r}};validateField=e=>{let t=["bg","ro","en"],r=null;return e!=null&&e.length>0?t.includes(e)?r="valid":r="invalid":r="missing",r};generateMessage=e=>{let t=null,r="warning";return e==="missing"&&(t="If no lang is passed the default one will be set which is: EN"),e==="invalid"&&(t="This lang value is not supported, the default one will be set which is: EN"),e==="valid"&&(t=null,r=null),{text:t,type:r}}};var zt=class{validate(e){let t=this.validateField(e.environment),r=this.generateMessage(t);return{validation:t,message:r}}validateField=e=>{let t=["dev","sandbox","prod"],r=null;return e!=null&&e.length>0?t.includes(e)?r="valid":r="invalid":r="missing",r};generateMessage=e=>{let t=null,r="warning";return e==="missing"&&(t="If no environment is passed the default one will be set which is: prod"),e==="invalid"&&(t="This environment value is not supported, the default one will be set which is: prod"),e==="valid"&&(t=null,r=null),{text:t,type:r}}};var Qt=class{validate(e){let t=this.validateField(e.apiKey),r=this.generateMessage(t);return{validation:t,message:r}}validateField=e=>{let t=null;return e!=null&&e.length>0?t="valid":t="missing",t};generateMessage=e=>{let t=null,r="error";return e==="missing"&&(t="The field apiKey with valid value must be provided to use this SDK"),e==="valid"&&(r=null),{text:t,type:r}}};var Jt=class{validate(e){let t=this.validateField(e.idSchema),r=this.generateMessage(t);return{validation:t,message:r}}validateField=e=>{let t=["native","sportal365","enetpulse","sportradar"],r=null;return e!=null&&e.length>0?t.includes(e)?r="valid":r="invalid":r="missing",r};generateMessage=e=>{let t=null,r="warning";return e==="missing"&&(t="If no idSchema is passed the default one will be set which is: native"),e==="invalid"&&(t="This idSchema value is not supported, the default one will be set which is: native"),e==="valid"&&(t=null,r=null),{text:t,type:r}}};var Ne=class{getIdToken=null;logout=null};var de=class{text=null;type=null};var Zt=class{validation=null;message=new de;getIdToken={validation:null,message:new de};logout={validation:null,message:new de}};var er=class{validate(e){let t=this.validateAuthProvider(e.authProvider);return t.validation!=="missing"&&(t=this.validateAuthProviderConfigFields(e.authProvider,t),t=this.generateAuthProviderConfigMessages(t),t=this.checkAuthProviderConfigMessagesForErrors(t)),t}validateAuthProvider=e=>{let t=Object.keys(new Ne),r=new Zt;if(e){let a=Object.keys(e).filter(s=>!t.includes(s));a.length>0?(r.validation="invalid",r.message.type="warning",r.message.text=`${"You have passed a property which is not supported for the authentication provider:"} ${a.join(",")}`):r.validation="valid"}else r.validation="missing",r.message.type="error",r.message.text="The field authProvider must be provided to use this SDK";return r};validateAuthProviderConfigFields=(e,t)=>(Object.keys(new Ne).forEach(i=>{e[i]?t[i].validation="valid":t[i].validation="missing"}),t);generateAuthProviderConfigMessages=e=>(Object.keys(e).filter(t=>t!=="validation"&&t!=="message").forEach(t=>{let r=e[t];r.validation==="missing"&&(r.message.text=`${"The following property is missing from the authProvider object:"} ${t}`,r.message.type="error")}),e);checkAuthProviderConfigMessagesForErrors=e=>(Object.keys(e).filter(t=>t!=="validation"&&t!=="message").forEach(t=>{e[t].validation==="missing"&&e.validation==="valid"&&(e.validation="invalid",e.message.type="error",e.message.text="The field authProvider has missing properties")}),e)};var Le=class{validation;message};var tr=class{apiKey=null;environment=null;idSchema=null;clientId=null;lang=null;authProvider={getIdToken:new Le,logout:new Le};isValid=!1};var rr=class{validate(e){let t=this.validateField(e.clientId),r=this.generateMessage(t);return{validation:t,message:r}}validateField=e=>{let t=null;return e!=null&&e.length>0?t="valid":t="missing",t};generateMessage=e=>{let t=null,r="warning";return e==="missing"&&(t="The field clientId must be provided to use this SDK"),e==="valid"&&(t=null,r=null),{text:t,type:r}}};var ir=class{validate=e=>{let t=this.checkFieldsForValues(e);return t.isValid=this.containsErrorMessage(t),t};checkFieldsForValues=e=>{let t=new tr,r={apiKey:new Qt,environment:new zt,idSchema:new Jt,clientId:new rr,lang:new Wt,authProvider:new er};for(let[i,a]of Object.entries(t))i!=="isValid"&&(a=r[i].validate(e));return Object.keys(r).forEach(i=>{t[i]=r[i].validate(e)}),t};containsErrorMessage=e=>{let t=!0;for(let[r,i]of Object.entries(e))if(r!=="authProvider"){if(r!=="isValid"&&i.message.type==="error")return t=!1,t;if(r!=="isValid"&&i.message.type==="warning")return t=!0,t}return t}};var or=class{https=null;idMapping=null;localStorage=null;footballFacade=null;constructor(e){this.https=new B(e),this.idMapping=new E(e),this.localStorage=new D(e),this.footballFacade=new q(this.localStorage,this.https,this.idMapping)}getCountries=async()=>await this.footballFacade.getCountries();getCompetitions=async e=>await this.footballFacade.getCompetitions(e);getCompetitionById=async e=>await this.footballFacade.getCompetitionById(e);getTopCompetitions=async()=>await this.footballFacade.getTopCompetitions();getTeams=async e=>await this.footballFacade.getTeams(e);getTeamById=async e=>await this.footballFacade.getTeamById(e);getTopTeams=async()=>await this.footballFacade.getTopTeams();getNextMatchForTeam=async e=>await this.footballFacade.getNextMatchForTeam(e);getPrevMatchForTeam=async e=>await this.footballFacade.getPrevMatchForTeam(e);getPlayers=async e=>await this.footballFacade.getPlayers(e);getPlayerById=async e=>await this.footballFacade.getPlayerById(e);getTopPlayers=async()=>await this.footballFacade.getTopPlayers();getNextMatchForPlayer=async e=>await this.footballFacade.getNextMatchForPlayer(e);getPrevMatchForPlayer=async e=>await this.footballFacade.getPrevMatchForPlayer(e);getMatches=async e=>await this.footballFacade.getMatches(e);getMatchById=async e=>await this.footballFacade.getMatchById(e);search=async e=>await this.footballFacade.search(e)};var bi=Fe(re());var ar=class{value=null;playerId=null;playerModel=null};var he=class{market=null;matchId=null;matchType=null;matchModel=null;prediction=new ar;result=null};var sr=class{value=!1;playerId=null};var O=class{matchId=null;market=null;prediction=null;constructor(e,t,r,i){this.matchId=e,this.market=t,this.prediction=new sr,this.prediction.value=r,this.prediction.playerId=i}};var fe=class{settledAt=null;resettledAt=null;status=null;outcome=null};var v=(d=>(d.FT_1X2="FT_1X2",d.HT_1X2="HT_1X2",d.BOTH_TEAMS_SCORE="BOTH_TEAMS_SCORE",d.DOUBLE_CHANCE="DOUBLE_CHANCE",d.HT_FT="HT_FT",d.PLAYER_SCORE="PLAYER_SCORE",d.PLAYER_YELLOW_CARD="PLAYER_YELLOW_CARD",d.PLAYER_RED_CARD="PLAYER_RED_CARD",d.RED_CARD_MATCH="RED_CARD_MATCH",d.PENALTY_MATCH="PENALTY_MATCH",d.PLAYER_SCORE_FIRST_GOAL="PLAYER_SCORE_FIRST_GOAL",d.CORNERS_MATCH="CORNERS_MATCH",d.CORRECT_SCORE="CORRECT_SCORE",d.PLAYER_SCORE_HATTRICK="PLAYER_SCORE_HATTRICK",d.PLAYER_SCORE_TWICE="PLAYER_SCORE_TWICE",d.OVER_GOALS_0_5="OVER_GOALS_0.5",d.OVER_GOALS_1_5="OVER_GOALS_1.5",d.OVER_GOALS_2_5="OVER_GOALS_2.5",d.OVER_GOALS_3_5="OVER_GOALS_3.5",d.OVER_GOALS_4_5="OVER_GOALS_4.5",d.OVER_GOALS_5_5="OVER_GOALS_5.5",d.OVER_GOALS_6_5="OVER_GOALS_6.5",d.OVER_CORNERS_6_5="OVER_CORNERS_6.5",d.OVER_CORNERS_7_5="OVER_CORNERS_7.5",d.OVER_CORNERS_8_5="OVER_CORNERS_8.5",d.OVER_CORNERS_9_5="OVER_CORNERS_9.5",d.OVER_CORNERS_10_5="OVER_CORNERS_10.5",d.OVER_CORNERS_11_5="OVER_CORNERS_11.5",d.OVER_CORNERS_12_5="OVER_CORNERS_12.5",d.OVER_CORNERS_13_5="OVER_CORNERS_13.5",d))(v||{}),Bo=["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"],No=["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"],gi=["PLAYER_RED_CARD","PLAYER_SCORE","PLAYER_SCORE_FIRST_GOAL","PLAYER_SCORE_HATTRICK","PLAYER_SCORE_TWICE","PLAYER_YELLOW_CARD"];var nr=class{value=null};var j=class{matchId=null;market="CORRECT_SCORE";prediction=null;constructor(e,t){this.matchId=e,this.prediction=new nr,this.prediction.value=t}};var C=class{value=!1};var ge=class{matchId=null;market=null;prediction=null;constructor(e,t,r){this.matchId=e,this.market=t,this.prediction=new C,this.prediction.value=r}};var ye=class{matchId=null;market=null;prediction=null;constructor(e,t,r){this.matchId=e,this.market=t,this.prediction=new C,this.prediction.value=r}};var lr=class{matchFacade=null;playerFacade=null;predictorService=null;constructor(e,t,r){this.matchFacade=e,this.playerFacade=t,this.predictorService=r}remapFixturesRequest=e=>{let t={};if(t.match_id=e.matchId,t.match_type="FOOTBALL",e instanceof O)t.market=e.market,t.prediction=e.prediction.value,t.player_id=e.prediction.playerId;else if(e instanceof ge||e instanceof ye){let r=e.market.split("_");t.market=r[0]+"_"+r[1],t.prediction=e.prediction.value,t.target=Number(r[2])}else if(e instanceof j){t.market=e.market;let r=e.prediction.value.split(":");t.goals_home=Number(r[0]),t.goals_away=Number(r[1])}else t.market=e.market,t.prediction=e.prediction.value;return t};remapFixturesResponse=async e=>{e.length>1&&e.sort((n,p)=>n.match_id.localeCompare(p.match_id));let t=[],r=[];for(let n of e)t.push(n.match_id),n.player_id&&!r.includes(n.player_id)&&r.push(n.player_id);let i=await this.matchFacade.getMatchesMapWithNativeIds(t),a=[];r.sort((n,p)=>n.localeCompare(p)),r&&r.length>0&&(a=await this.playerFacade.getPlayersMapWithNativeIds(r));let s=[];for(let n of e){let p=new he;n.target?p.market=this.predictorService.convertMarketForResponseModel(n.market,n.target):p.market=n.market,p.matchId=i[n.match_id].id,p.matchType=n.match_type,p.matchModel=i?i[n.match_id]:null,n.goals_home!==void 0&&n.goals_away!==void 0?p.prediction.value=n.goals_home.toString()+":"+n.goals_away.toString():p.prediction.value=n.prediction,p.prediction.playerId=n.player_id?n.player_id:null,p.prediction.playerId&&(p.prediction.playerModel=a[n.player_id],p.prediction.playerId=a[n.player_id].id),p.result=this.remapResult(n.result),s.push(p)}return s};remapResult=e=>{let t=new fe;return t.settledAt=e.settled_at,t.resettledAt=e.resettled_at,t.status=e.status,t.outcome=e.outcome,t}};var Me=class{goldenGoal=null};var Ge=class{id=null;gameInstanceId=null;gameType=null;wager=null;totalFixtures=null;settledFixtures=null;userId=null;fixtures=[];status=null;tiebreaker=new Me;points=null;createdAt=null;updatedAt=null};var m=class{no=0;yes=0};var we=class{fullTimeOneXTwo={};halfTimeOneXTwo={};bothTeamsScore=new m;doubleChance={};halfTimeFullTime={};playerScore={};playerYellowCard={};playerRedCard={};redCardMatch=new m;penaltyMatch=new m;playerScoreFirstGoal={};cornersMatch={};correctScore={};playerScoreHattrick={};playerScoreTwice={};overZeroPointFiveGoals=new m;overOnePointFiveGoals=new m;overTwoPointFiveGoals=new m;overThreePointFiveGoals=new m;overFourPointFiveGoals=new m;overFivePointFiveGoals=new m;overSixPointFiveGoals=new m;overSixPointFiveCorners=new m;overSevenPointFiveCorners=new m;overEightPointFiveCorners=new m;overNinePointFiveCorners=new m;overTenPointFiveCorners=new m;overElevenPointFiveCorners=new m;overTwelvePointFiveCorners=new m;overThirteenPointFiveCorners=new m};var yi=(r=>(r.ONE="1",r.X="x",r.TWO="2",r))(yi||{}),Mi=(r=>(r.ONE_X="1x",r.X_TWO="x2",r.ONE_TWO="12",r))(Mi||{}),wi=(u=>(u.ONE_ONE="1/1",u.ONE_X="1/x",u.ONE_TWO="1/2",u.X_ONE="x/1",u.X_X="x/x",u.X_TWO="x/2",u.TWO_ONE="2/1",u.TWO_X="2/x",u.TWO_TWO="2/2",u))(wi||{});var pr=class{value=null};var cr=class{matchId=null;market="HT_FT";prediction=null;constructor(e,t){this.matchId=e,this.prediction=new pr,this.prediction.value=t}};var mr=class{value=null};var ur=class{matchId=null;market="DOUBLE_CHANCE";prediction=null;constructor(e,t){this.matchId=e,this.prediction=new mr,this.prediction.value=t}};var be=class{value=null};var dr=class{matchId=null;market="FT_1X2";prediction=null;constructor(e,t){this.matchId=e,this.prediction=new be,this.prediction.value=t}};var hr=class{matchId=null;market="HT_1X2";prediction=null;constructor(e,t){this.matchId=e,this.prediction=new be,this.prediction.value=t}};var fr=class{value};var gr=class{matchId=null;market="CORNERS_MATCH";prediction=null;constructor(e,t){this.matchId=e,this.prediction=new fr,this.prediction.value=t}};var yr=class{matchId=null;market="BOTH_TEAMS_SCORE";prediction=null;constructor(e,t){this.matchId=e,this.prediction=new C,this.prediction.value=t}};var Mr=class{matchId=null;market="RED_CARD_MATCH";prediction=null;constructor(e,t){this.matchId=e,this.prediction=new C,this.prediction.value=t}};var wr=class{matchId=null;market="PENALTY_MATCH";prediction=null;constructor(e,t){this.matchId=e,this.prediction=new C,this.prediction.value=t}};var W=class{id=null;title=null;description=null;type=null;status=null;predictionsCutoff=null;fixtures=[];createdAt=null;updatedAt=null};var z=class{userId=null;points=null;results=[];tiebreaker=null};var br=(a=>(a.ACTIVE="ACTIVE",a.WON="WON",a.LOST="LOST",a.PARTIALLY_WON="PARTIALLY_WON",a.CANCELED="CANCELED",a))(br||{}),Ue=["WON","LOST","PARTIALLY_WON","CANCELED"];var w=class{limit=null;startAfter=null;status=null;type=null;constructor(e){this.limit=e.limit?e.limit:null,this.startAfter=e.startAfter?e.startAfter:null,this.status=e.status?e.status:null,this.type=e.type?e.type:null}constructFilterUrl=()=>{let e="",t=!1;return this.status&&(t=Object.values(br).some(r=>this.status.includes(r))),this.limit&&(e+="&",e+=`limit=${this.limit}`),this.startAfter&&(e+="&",e+=`start_after=${this.startAfter}`),this.status&&t&&(e+="&",e+=`status=${this.status.join(",")}`),this.type&&(e+="&",e+=`game_types=${this.type}`),e}};var Ve=(s=>(s.OPEN="OPEN",s.LIVE="LIVE",s.PENDING="PENDING",s.CANCELED="CANCELED",s.CLOSED="CLOSED",s.SETTLED="SETTLED",s))(Ve||{});var S=class{limit=null;startAfter=null;status=null;type=null;gameIds=null;constructor(e){this.limit=e.limit?e.limit:null,this.startAfter=e.startAfter?e.startAfter:null,this.status=e.status?e.status:null,this.type=e.type?e.type:null,this.gameIds=e.gameIds?e.gameIds:null}constructFiltersUrl=()=>{let e="";return this.limit&&(e+="&",e+=`limit=${this.limit}`),this.startAfter&&(e+="&",e+=`start_after=${this.startAfter}`),this.status&&Object.values(Ve).includes(this.status)&&(e+="&",e+=`status=${this.status}`),this.type&&(e+="&",e+=`type=${this.type}`),this.gameIds&&this.gameIds.length>0&&(e+="&",e+=`game_ids=${this.gameIds.join(",")}`),e}};var Q=class{id=null;title=null;description=null;type=null;status=null;predictionsCutoff=null;fixtures=[];createdAt=null;updatedAt=null};var U=class{id=null;title=null;description=null;type=null;status=null;predictionsCutoff=null;fixtures=[];createdAt=null;updatedAt=null};var N=class{footballHttps=null;idMapping=null;matchFacade=null;playerFacade=null;constructor(e,t){this.footballHttps=new B(e),this.idMapping=t,this.matchFacade=new k(this.footballHttps,t),this.playerFacade=new H(this.footballHttps,t)}remapMatchIdToNative=async e=>{let t=await this.idMapping.getEntityIdsBySchemaId(e,"match","native"),r=[];return t.match.forEach(i=>r.push(i)),r};remapPlayerIdToNative=async e=>(await this.idMapping.getEntityIdsBySchemaId(e,"player","native")).player[0];remapPlayerIdMapToNative=async e=>{let t={},r=V(e),a=(await this.idMapping.getEntityIdsBySchemaId(r,"player","native")).player;return r.forEach((s,n)=>t[s]=a[n]),t};remapPlayerIdToIdSchema=async e=>{let t=["playerScore","playerYellowCard","playerRedCard","playerScoreFirstGoal","playerScoreHattrick","playerScoreTwice"];for(let[r,i]of Object.entries(e))if(t.includes(r))for(let a of Object.keys(i)){let s={player:[a]},p=(await this.idMapping.idMappingFacade.getEntitiesByIds(s,"native",this.idMapping.idSchema)).player[0];i[p]=i[a],delete i[a]}return e};convertMarket=e=>{let t=Object.keys(new we),r=Object.values(v);for(let i=0;i<r.length;i++)e===r[i]&&(e=t[i]);return e};convertMarketForResponseModel=(e,t)=>{let r=t.toString();return e+"_"+r};validateFixture=(e,t,r,i)=>{let a=Object.values(yi),s=Object.values(wi),n=Object.values(Mi);if(t==="FT_1X2"){if(a.includes(r))return new dr(e,r)}else if(t==="HT_1X2"){if(a.includes(r))return new hr(e,r)}else if(t==="HT_FT"){if(s.includes(r))return new cr(e,r)}else if(t==="DOUBLE_CHANCE"){if(n.includes(r))return new ur(e,r)}else if(t==="CORRECT_SCORE"){if(typeof r=="string"&&/\d+:\d+/.test(r))return new j(e,r)}else if(t==="CORNERS_MATCH"){if(typeof r=="number")return new gr(e,r)}else if(t==="BOTH_TEAMS_SCORE"){if(typeof r=="boolean")return new yr(e,r)}else if(t==="RED_CARD_MATCH"){if(typeof r=="boolean")return new Mr(e,r)}else if(t==="PENALTY_MATCH"){if(typeof r=="boolean")return new wr(e,r)}else if(gi.includes(t)){if(i&&typeof r=="boolean")return new O(e,t,r,i)}else if(Bo.includes(t)){if(typeof r=="boolean")return new ye(e,t,r)}else if(No.includes(t)&&typeof r=="boolean")return new ge(e,t,r)};getMarketSummary=(e,t,r)=>{let i=this.convertMarket(t),a={};if(a.matchId=e.matchId,a.matchType=e.matchType,Object.keys(e.predictions).includes(i))a[i]=e.predictions[i];else throw new Error("You have passed invalid market");return gi.includes(t)&&r?(a[i][r]||(a[i][r]=new m),a[i][r]):a};remapCompetitionsFromConfig=async e=>{let t={competition:e.fullCoverageCompetitions},r=await this.idMapping.idMappingFacade.getEntitiesByIds(t,"native",this.idMapping.idSchema);return e.fullCoverageCompetitions=r.competition,e};remapMatchIdsFixtures=async e=>{if(Array.isArray(e.data))if(e.data.length>0){let t=[],r=[];return e.data.forEach(i=>{i instanceof Q||i instanceof W||i instanceof U?(i.fixtures.forEach(a=>t.push(a.matchId)),i instanceof U&&i.fixtures.forEach(a=>{a.prediction.playerId&&r.push(a.prediction.playerId)})):i instanceof z&&i.results.forEach(a=>t.push(a.matchId))}),await this.refactorResponseArrModel(e,t,r)}else return e;else return await this.refactorResponseObjModel(e)};refactorResponseArrModel=async(e,t,r)=>{let i=[],a=await this.matchFacade.getMatchesMapWithNativeIds(t),s={};return r.length>0&&(s=await this.playerFacade.getPlayersMapWithNativeIds(r)),e.data.forEach(n=>{n instanceof Q||n instanceof W||n instanceof U?(n.fixtures.forEach(p=>{p.matchModel=a[p.matchId],p.matchId=p.matchModel.id,n instanceof U&&p.prediction.playerId&&(p.prediction.playerModel=s[p.prediction.playerId],p.prediction.playerId=s[p.prediction.playerId].id)}),i.push(n)):n instanceof z&&(n.results.forEach(p=>{p.matchModel=a[p.matchId],p.matchId=p.matchModel.id}),i.push(n))}),e.data=i,e};refactorResponseObjModel=async e=>{let t=[];e.fixtures.forEach(i=>t.push(i.matchId));let r=await this.matchFacade.getMatchesMapWithNativeIds(t);return e.fixtures.forEach(i=>{i.matchModel=r[i.matchId],i.matchId=r[i.matchId].id}),e};getCurrentGameId=e=>{let t=new Date;if(e.data.length>1){let r=[];return e.data.forEach(a=>r.push(a.predictionsCutoff)),e.data.sort((a,s)=>{let[n,p]=[a.predictionsCutoff,s.predictionsCutoff].map(u=>Math.abs(new Date(u)-t));return n-p})[0].id}else return e.data[0].id};initGameTypePredictions=e=>{let t={type:e};return t=new w(t),t};initGameFilters=(e,t,r)=>{if(t&&r)return t.type=e,t.gameIds=r,t=new S(t),t;if(t&&!r)return t.type=e,t=new S(t),t;if(!t&&r){let i={type:e,gameIds:r};return i=new S(i),i}else{let i={type:e};return i=new S(i),i}};addPredictionProp=async(e,t)=>(t.data.forEach((r,i)=>{r.id===e[i].game_instance_id&&r.fixtures.forEach((a,s)=>{e[i].fixtures[s].goals_home!==void 0&&e[i].fixtures[s].goals_away!==void 0?a.prediction.value=e[i].fixtures[s].goals_home+":"+e[i].fixtures[s].goals_away:a.prediction.value=e[i].fixtures[s].prediction,e[i].fixtures[s].player_id?a.prediction.playerId=e[i].fixtures[s].player_id:e[i].fixtures[s].target&&(a.prediction.target=e[i].fixtures[s].target),a.prediction.result=this.remapResult(e[i].fixtures[s].result)})}),await this.remapMatchIdsFixtures(t));remapResult=e=>{let t=new fe;return t.settledAt=e.settled_at,t.resettledAt=e.resettled_at,t.status=e.status,t.outcome=e.outcome,t}};var Pe=class{gameInstanceId=null;fixtures=[];tiebreaker=null;constructor(e){this.gameInstanceId=e.gameInstanceId,e.fixtures.forEach(t=>this.fixtures.push(new j(t.matchId,t.prediction.value))),this.tiebreaker=e.tiebreaker?e.tiebreaker:null}};var Ie=class{fixturesRemapper=null;footballHttps=null;matchFacade=null;playerFacade=null;predictorService=null;constructor(e,t){this.footballHttps=new B(e),this.matchFacade=new k(this.footballHttps,t),this.playerFacade=new H(this.footballHttps,t),this.predictorService=new N(e,t),this.fixturesRemapper=new lr(this.matchFacade,this.playerFacade,this.predictorService)}remapRequestBody=e=>{let t={};return t.game_instance_id=e.gameInstanceId,t.fixtures=e.fixtures.map(r=>this.fixturesRemapper.remapFixturesRequest(r)),e instanceof Pe&&e.tiebreaker&&(t.tiebreaker={},t.tiebreaker.golden_goal=e.tiebreaker.goldenGoal?e.tiebreaker.goldenGoal:null),t};remapResponseArrayBody=async e=>{let t=[],r=[],i={},a=[];e.forEach(n=>{n.fixtures.forEach(p=>{t.push(p.match_id),p.player_id&&r.push(p.player_id)})});let s=await this.matchFacade.getMatchesMapWithNativeIds(t);return r.length>0&&(i=await this.playerFacade.getPlayersMapWithNativeIds(r)),e.forEach(n=>{let p=new Ge,u=[];p.id=n.id,p.gameInstanceId=n.game_instance_id,p.gameType=n.game_type,p.wager=n.wager,p.totalFixtures=n.total_fixtures,p.settledFixtures=n.settled_fixtures,p.userId=n.user_id,n.fixtures.forEach(l=>{let c=new he;l.target?c.market=this.predictorService.convertMarketForResponseModel(l.market,l.target):c.market=l.market,c.matchId=s[l.match_id].id,c.matchType=l.match_type,c.matchModel=s[l.match_id],l.goals_home!==void 0&&l.goals_away!==void 0?c.prediction.value=l.goals_home.toString()+":"+l.goals_away.toString():c.prediction.value=l.prediction,c.prediction.playerId=l.player_id?l.player_id:null,c.prediction.playerId&&(c.prediction.playerModel=i[c.prediction.playerId],c.prediction.playerId=i[c.prediction.playerId].id),c.result=this.fixturesRemapper.remapResult(l.result),u.push(c)}),p.fixtures=u,p.status=n.status,n.tiebreaker?p.tiebreaker.goldenGoal=n.tiebreaker.golden_goal:p.tiebreaker=null,p.points=n.points,p.createdAt=n.created_at,p.updatedAt=n.updated_at,a.push(p)}),a};remapResponseObjBody=async e=>{let t=new Ge;return t.id=e.id,t.gameInstanceId=e.game_instance_id,t.gameType=e.game_type,t.wager=e.wager,t.totalFixtures=e.total_fixtures,t.settledFixtures=e.settled_fixtures,t.userId=e.user_id,t.fixtures=await this.fixturesRemapper.remapFixturesResponse(e.fixtures),t.status=e.status,e.tiebreaker?t.tiebreaker.goldenGoal=e.tiebreaker.golden_goal:t.tiebreaker=null,t.points=e.points,t.createdAt=e.created_at,t.updatedAt=e.updated_at,t};remapPredictionModel=e=>{let t=new we;return t.fullTimeOneXTwo=e.FT_1X2,t.halfTimeOneXTwo=e.HT_1X2,t.bothTeamsScore=e.BOTH_TEAMS_SCORE?e.BOTH_TEAMS_SCORE:new m,t.overZeroPointFiveGoals=e.OVER_GOALS["over:0.5"]?e.OVER_GOALS["over:0.5"]:new m,t.overOnePointFiveGoals=e.OVER_GOALS["over:1.5"]?e.OVER_GOALS["over:1.5"]:new m,t.overTwoPointFiveGoals=e.OVER_GOALS["over:2.5"]?e.OVER_GOALS["over:2.5"]:new m,t.overThreePointFiveGoals=e.OVER_GOALS["over:3.5"]?e.OVER_GOALS["over:3.5"]:new m,t.overFourPointFiveGoals=e.OVER_GOALS["over:4.5"]?e.OVER_GOALS["over:4.5"]:new m,t.overFivePointFiveGoals=e.OVER_GOALS["over:5.5"]?e.OVER_GOALS["over:5.5"]:new m,t.overSixPointFiveGoals=e.OVER_GOALS["over:6.5"]?e.OVER_GOALS["over:6.5"]:new m,t.overSixPointFiveCorners=e.OVER_CORNERS["over:6.5"]?e.OVER_CORNERS["over:6.5"]:new m,t.overSevenPointFiveCorners=e.OVER_CORNERS["over:7.5"]?e.OVER_CORNERS["over:7.5"]:new m,t.overEightPointFiveCorners=e.OVER_CORNERS["over:8.5"]?e.OVER_CORNERS["over:8.5"]:new m,t.overNinePointFiveCorners=e.OVER_CORNERS["over:9.5"]?e.OVER_CORNERS["over:9.5"]:new m,t.overTenPointFiveCorners=e.OVER_CORNERS["over:10.5"]?e.OVER_CORNERS["over:10.5"]:new m,t.overElevenPointFiveCorners=e.OVER_CORNERS["over:11.5"]?e.OVER_CORNERS["over:11.5"]:new m,t.overTwelvePointFiveCorners=e.OVER_CORNERS["over:12.5"]?e.OVER_CORNERS["over:12.5"]:new m,t.overThirteenPointFiveCorners=e.OVER_CORNERS["over:13.5"]?e.OVER_CORNERS["over:13.5"]:new m,t.doubleChance=e.DOUBLE_CHANCE,t.halfTimeFullTime=e.HT_FT,t.playerScore=e.PLAYER_SCORE,t.playerYellowCard=e.PLAYER_YELLOW_CARD,t.playerRedCard=e.PLAYER_RED_CARD,t.redCardMatch=e.RED_CARD_MATCH?e.RED_CARD_MATCH:new m,t.penaltyMatch=e.PENALTY_MATCH?e.PENALTY_MATCH:new m,t.playerScoreFirstGoal=e.PLAYER_SCORE_FIRST_GOAL,t.cornersMatch=e.CORNERS_MATCH,t.correctScore=e.CORRECT_SCORE,t.playerScoreHattrick=e.PLAYER_SCORE_HATTRICK,t.playerScoreTwice=e.PLAYER_SCORE_TWICE,t}};var Pr=class{matchId=null;matchType=null;predictions=null};var Ir=class{remapPredictions=null;constructor(e,t){this.remapPredictions=new Ie(e,t)}remapResponse=e=>{let t=new Pr;return t.matchId=e.match_id,t.matchType=e.match_type,t.predictions=this.remapPredictions.remapPredictionModel(e.predictions),t}};var Rr=class{matchId=null;matchType=null;market=null;matchModel=null};var Fr=class{value=null;target=null;playerId=null;playerModel=null;result=null};var vr=class{matchId=null;matchType=null;market=null;matchModel=null;prediction=new Fr};var Sr=class{value=null;result=null};var Tr=class{matchId=null;matchType=null;market="CORRECT_SCORE";matchModel=null;prediction=new Sr};var Er=class{matchId=null;matchModel=null;outcome=null};var Cr=class{remapPaginatedGames=e=>{let t=new P;return t.meta.pagination.nextPageStartsAfter=e.meta.pagination.next_page_starts_after,t.meta.pagination.itemsPerPage=e.meta.pagination.items_per_page,t.data=e.data.map(r=>this.remapGamesListResponse(r)),t};remapGamesListResponse=e=>{let t=new Q;return t.id=e.id,t.title=e.title,t.description=e.description,t.type=e.type,t.status=e.status,t.predictionsCutoff=e.predictions_cutoff,t.fixtures=e.fixtures.map(r=>this.remapFixturesResponse(r)),t.createdAt=e.created_at,t.updatedAt=e.updated_at,t};remapFixturesResponse=e=>{let t=new Rr;return t.matchId=e.match_id,t.matchType=e.match_type,t.market=e.market,t};remapPaginatedUserTopXEditions=e=>{let t=new P;return t.meta.pagination.nextPageStartsAfter=e.meta.pagination.next_page_starts_after,t.meta.pagination.itemsPerPage=e.meta.pagination.items_per_page,t.data=e.data.map(r=>this.remapUserTopXEditionsResponse(r)),t};remapUserTopXEditionsResponse=e=>{let t=new W;return t.id=e.id,t.title=e.title,t.description=e.description,t.type=e.type,t.status=e.status,t.predictionsCutoff=e.predictions_cutoff,t.fixtures=e.fixtures.map(r=>this.remapTopXFixturesResponse(r)),t.createdAt=e.created_at,t.updatedAt=e.updated_at,t};remapTopXFixturesResponse=e=>{let t=new Tr;return t.matchId=e.match_id,t.matchType=e.match_type,t};remapPaginatedUserMathQuizEditions=e=>{let t=new P;return t.meta.pagination.nextPageStartsAfter=e.meta.pagination.next_page_starts_after,t.meta.pagination.itemsPerPage=e.meta.pagination.items_per_page,t.data=e.data.map(r=>this.remapUserMatchQuizEditionsResponse(r)),t};remapUserMatchQuizEditionsResponse=e=>{let t=new U;return t.id=e.id,t.title=e.title,t.description=e.description,t.type=e.type,t.status=e.status,t.predictionsCutoff=e.predictions_cutoff,t.fixtures=e.fixtures.map(r=>this.remapMatchQuizFixturesResponse(r)),t.createdAt=e.created_at,t.updatedAt=e.updated_at,t};remapMatchQuizFixturesResponse=e=>{let t=new vr;return t.matchId=e.match_id,t.matchType=e.match_type,t.market=e.market,t};remapPaginatedGameResults=e=>{let t=new P;return t.meta.pagination.nextPageStartsAfter=e.meta.pagination.next_page_starts_after,t.meta.pagination.itemsPerPage=e.meta.pagination.items_per_page,t.data=e.data.map(r=>this.remapGameResults(r)),t};remapGameResults=e=>{let t=new z;return t.userId=e.user_id,t.points=e.points?e.points:0,t.results=e.results.map(r=>this.remapResults(r)),t.tiebreaker=e.tiebreaker?this.remapTiebreaker(e.tiebreaker):null,t};remapResults=e=>{let t=new Er;return t.matchId=e.match_id,t.outcome=e.outcome,t};remapTiebreaker=e=>{let t=new Me;return t.goldenGoal=e.golden_goal,t}};var _r=class{remapMetaData=e=>{let t=new ie;return t.pagination.nextPageStartsAfter=e.pagination.next_page_starts_after,t.pagination.itemsPerPage=e.pagination.items_per_page,t}};var X=class{instanceAuth=null;instance=null;apiSignInUrl=null;clientApiSignInUrl=null;predictionRemapper=null;matchSummaryRemapper=null;gamesRemapper=null;metaRemapper=null;constructor(e,t){let r=A(e.environment,"predictor");this.apiSignInUrl=`?key=${e.apiKey}&client_id=${e.clientId}`,this.predictionRemapper=new Ie(e,t),this.matchSummaryRemapper=new Ir(e,t),this.gamesRemapper=new Cr,this.metaRemapper=new _r,this.instanceAuth=bi.default.create({baseURL:r,headers:{Authorization:`Bearer ${e.authProvider.getIdToken()}`,"Content-Type":"application/json"}}),this.instance=bi.default.create({baseURL:r,headers:{"Content-Type":"application/json"}})}makeFootballPrediction=async e=>{try{let t=this.predictionRemapper.remapRequestBody(e),r=await this.instanceAuth.post(`/predictions${this.apiSignInUrl}`,JSON.stringify(t));return await this.predictionRemapper.remapResponseObjBody(r.data)}catch(t){throw console.warn("There was a problem making POST request: ",t),t.response}};getMatchSummary=async e=>{try{let t=await this.instance.get(`/predictions/summary/${e}${this.apiSignInUrl}`);return this.matchSummaryRemapper.remapResponse(t.data)}catch(t){throw console.warn(`There was a problem fetching predictions for match: ${e} `,t),t.response}};deleteFootballPrediction=async e=>{try{return await this.instanceAuth.delete(`/predictions/${e}${this.apiSignInUrl}`),!0}catch(t){throw console.warn(`There was a problem deleting your prediction: ${e}`,t),t.response}};getMyPredictions=async e=>{try{let t=new P,r=e?await this.instanceAuth.get(`/predictions${this.apiSignInUrl}${e.constructFilterUrl()}`):await this.instanceAuth.get(`/predictions${this.apiSignInUrl}`);return t.meta=this.metaRemapper.remapMetaData(r.data.meta),t.data=await this.predictionRemapper.remapResponseArrayBody(r.data.data),t}catch(t){throw console.warn("There was a problem fetching own predictions",t),t.response}};getMyPredictionsNoRemap=async e=>{try{return(await this.instanceAuth.get(`/predictions${this.apiSignInUrl}${e.constructFilterUrl()}`)).data.data}catch(t){throw console.warn("There was a problem fetching own predictions",t),t.response}};getUserPredictions=async(e,t)=>{try{let r=new P,i=t?await this.instance.get(`/predictions/users/${e}${this.apiSignInUrl}${t.constructFilterUrl()}`):await this.instance.get(`/predictions/users/${e}${this.apiSignInUrl}`);return r.meta=this.metaRemapper.remapMetaData(i.data.meta),r.data=await this.predictionRemapper.remapResponseArrayBody(i.data.data),r}catch(r){throw console.warn(`There was a problem fetching predictions for user: ${e}`,r),r.response}};getUserPredictionsNoRemap=async(e,t)=>{try{return(await this.instance.get(`/predictions/users/${e}${this.apiSignInUrl}${t.constructFilterUrl()}`)).data.data}catch(r){throw console.warn(`There was a problem fetching predictions for user: ${e}`,r),r.response}};getGames=async e=>{try{let t=await this.instance.get(`/games/${this.apiSignInUrl}${e.constructFiltersUrl()}`);return this.gamesRemapper.remapPaginatedGames(t.data)}catch(t){throw console.warn("There was a problem fetching the games list",t),t.response}};getGameById=async e=>{try{let t=await this.instance.get(`/games/${e}${this.apiSignInUrl}`);return this.gamesRemapper.remapGamesListResponse(t.data)}catch(t){throw console.warn(`There was a problem fetching the following game: ${e}`,t),t.response}};getUserGameEditions=async e=>{try{let t=null,r=await this.instance.get(`/games/${this.apiSignInUrl}${e.constructFiltersUrl()}`);return r.data.data.forEach(i=>{i.type==="TOP_X"?t=this.gamesRemapper.remapPaginatedUserTopXEditions(r.data):i.type==="MATCH_QUIZ"&&(t=this.gamesRemapper.remapPaginatedUserMathQuizEditions(r.data))}),t}catch(t){throw console.warn("There was a problem fetching the games list",t),t.response}};getGameResults=async(e,t)=>{try{let r=t?await this.instance.get(`/games/${e}/results/${this.apiSignInUrl}${t.constructFiltersUrl()}`):await this.instance.get(`/games/${e}/results/${this.apiSignInUrl}`);return this.gamesRemapper.remapPaginatedGameResults(r.data)}catch(r){throw console.warn(`There was a problem fetching the results for the following game: ${e}`,r),r.response}}};var Or=class{fullCoverageCompetitions=null;markets=null};var xr=class{remapConfig=e=>{let t=new Or;return t.fullCoverageCompetitions=e.full_coverage_competitions,t.markets=e.markets,t}};var Ar=class{gameInstanceId=null;fixtures=null};var Br=class{predictorHttps=null;clientHttps=null;idMapping=null;predictorConfigRemapper=null;predictorService=null;constructor(e,t,r,i){this.predictorHttps=t,this.idMapping=i,this.clientHttps=r,this.predictorConfigRemapper=new xr,this.predictorService=new N(e,i)}makeFootballPrediction=async(e,t,r,i)=>{let a=this.predictorService.validateFixture(e,t,r,i),s=new Ar;if(a)if(this.idMapping.idSchema!=="native"){let n=a.matchId,p="",u=await this.predictorService.remapMatchIdToNative([n]);if(a.matchId=u[0],!a.matchId)throw new Error("Match id is invalid!");if(a instanceof O&&(p=a.prediction.playerId,a.prediction.playerId=await this.predictorService.remapPlayerIdToNative([p]),!a.prediction.playerId))throw new Error("Player id is invalid!");s.fixtures=[a];let l=await this.predictorHttps.makeFootballPrediction(s);return l.fixtures.map(c=>{c.prediction.playerId&&(c.prediction.playerId=p),c.matchId=n}),l}else return s.fixtures=[a],await this.predictorHttps.makeFootballPrediction(s);else throw new Error("The prediction is invalid. Please check again have you passed appropriate prediction model")};getMatchSummary=async e=>{if(this.idMapping.idSchema!=="native"){let r=(await this.predictorService.remapMatchIdToNative([e]))[0],i=await this.predictorHttps.getMatchSummary(r);i.matchId=e;let a=i.predictions,s=await this.predictorService.remapPlayerIdToIdSchema(a);return i.predictions=s,i}else return await this.predictorHttps.getMatchSummary(e)};getMarketSummary=async(e,t,r)=>{try{let i=await this.getMatchSummary(e);return this.predictorService.getMarketSummary(i,t,r)}catch(i){return i.message}};getConfig=async()=>{let e=await this.clientHttps.getConfig(),t=await this.predictorConfigRemapper.remapConfig(e.predictor);return this.idMapping.idSchema!=="native"?await this.predictorService.remapCompetitionsFromConfig(t):t};deleteFootballPrediction=async e=>await this.predictorHttps.deleteFootballPrediction(e);getMyPredictions=async e=>(e&&(e=new w(e)),await this.predictorHttps.getMyPredictions(e));getMyCurrentPredictions=async e=>{if(e)e.status=["ACTIVE"],e=new w(e);else{let t={status:["ACTIVE"]};e=new w(t)}return await this.getMyPredictions(e)};getMyPastPredictions=async e=>{if(e)e.status=Ue,e=new w(e);else{let t={status:Ue};e=new w(t)}return await this.getMyPredictions(e)};getUserPredictions=async(e,t)=>(t&&(t=new w(t)),await this.predictorHttps.getUserPredictions(e,t));getUserCurrentPredictions=async(e,t)=>{if(t)t.status=["ACTIVE"],t=new w(t);else{let r={status:["ACTIVE"]};t=new w(r)}return await this.getUserPredictions(e,t)};getUserPastPredictions=async(e,t)=>{if(t)t.status=Ue,t=new w(t);else{let r={status:Ue};t=new w(r)}return await this.getUserPredictions(e,t)}};var Lo=Fe(re());var Re=class{instance=null;apiSignInUrl="";constructor(e){let t=A(e.environment,"client");this.apiSignInUrl=`/clients/${e.clientId}/features?key=${e.apiKey}`,this.instance=Lo.default.create({baseURL:t,headers:{"Content-Type":"application/json"}})}getConfig=async()=>{try{return(await this.instance.get(`${this.apiSignInUrl}`)).data.data}catch(e){throw console.warn("There was a problem fetching configuration from Client API",e),e.response}}};var Nr=class{predictorHttps=null;clientHttps=null;predictorFacade=null;idMapping=null;constructor(e){this.idMapping=new E(e),this.predictorHttps=new X(e,this.idMapping),this.clientHttps=new Re(e),this.predictorFacade=new Br(e,this.predictorHttps,this.clientHttps,this.idMapping)}makeFootballPrediction=async(e,t,r,i)=>await this.predictorFacade.makeFootballPrediction(e,t,r,i);getMatchSummary=async e=>await this.predictorFacade.getMatchSummary(e);getMarketSummary=async(e,t,r)=>await this.predictorFacade.getMarketSummary(e,t,r);getConfig=async()=>await this.predictorFacade.getConfig();deleteFootballPrediction=async e=>await this.predictorFacade.deleteFootballPrediction(e);getMyPredictions=async e=>await this.predictorFacade.getMyPredictions(e);getMyCurrentPredictions=async e=>await this.predictorFacade.getMyCurrentPredictions(e);getMyPastPredictions=async e=>await this.predictorFacade.getMyPastPredictions(e);getUserPredictions=async(e,t)=>await this.predictorFacade.getUserPredictions(e,t);getUserCurrentPredictions=async(e,t)=>await this.predictorFacade.getUserCurrentPredictions(e,t);getUserPastPredictions=async(e,t)=>await this.predictorFacade.getUserPastPredictions(e,t)};var Lr=class{general=[];predictor=[];topX=[]};var Gr=class{enabled=!1;rewards=null};var Ur=class{general=null;topX=null;predictor=null};var Vr=class{points=null;tiers=null;badges=null};var Dr=class{remapLoyaltyResponse=e=>{let t=new Gr;return t.enabled=e.enabled,t.rewards=this.remapRewards(e.rewards),t};remapRewards=e=>{let t=new Vr;return t.points=this.remapPoints(e.points),t.tiers=e.tiers,t.badges=this.remapBadges(e.badges),t};remapPoints=e=>{let t=new Ur;return t.general=e.general,t.topX=e.top_x,t.predictor=e.predictor,t};remapBadges=e=>{let t=new Lr;return t.general=e.general,t.predictor=e.predictor,t.topX=e.top_x,t}};var $r=class{https=null;loyaltyRemapper=null;constructor(e){this.https=e,this.loyaltyRemapper=new Dr}getConfig=async()=>{let e=await this.https.getConfig();return this.loyaltyRemapper.remapLoyaltyResponse(e.loyalty)}};var Hr=class{https=null;loyaltyFacade=null;constructor(e){this.https=new Re(e),this.loyaltyFacade=new $r(this.https)}getConfig=async()=>await this.loyaltyFacade.getConfig()};var kr=class{idMapping=null;predictorHttps=null;predictorService=null;constructor(e,t){this.idMapping=t,this.predictorHttps=new X(e,t),this.predictorService=new N(e,t)}getGames=async e=>{let t=this.predictorService.initGameFilters("TOP_X",e),r=await this.predictorHttps.getGames(t);return await this.predictorService.remapMatchIdsFixtures(r)};getGameById=async e=>{let t=await this.predictorHttps.getGameById(e);return await this.predictorService.remapMatchIdsFixtures(t)};getGameResults=async(e,t)=>{t&&(t=new S(t));let r=await this.predictorHttps.getGameResults(e,t);return await this.predictorService.remapMatchIdsFixtures(r)};getCurrentGameResults=async()=>{let e={status:"OPEN",type:"TOP_X"};e=new S(e);let t=await this.predictorHttps.getGames(e),r=this.predictorService.getCurrentGameId(t);return(await this.getGameResults(r)).data[0]};play=async e=>{let t=new Pe(e);if(this.idMapping.idSchema!=="native"){let i=[];t.fixtures.forEach(s=>i.push(s.matchId));let a=await this.predictorService.remapMatchIdToNative(i);t.fixtures.forEach(s=>s.matchId=a.shift())}let r=await this.predictorHttps.makeFootballPrediction(t);return r.fixtures.forEach(i=>{i.matchId=i.matchModel.id}),r};delete=async e=>await this.predictorHttps.deleteFootballPrediction(e);getMyGameEditions=async e=>{let t=this.predictorService.initGameTypePredictions("TOP_X"),r=[],i=await this.predictorHttps.getMyPredictionsNoRemap(t);i.forEach(n=>{n.game_instance_id&&r.push(n.game_instance_id)});let a=this.predictorService.initGameFilters("TOP_X",e,r),s=await this.predictorHttps.getUserGameEditions(a);return await this.predictorService.addPredictionProp(i,s)};getMyGamePrediction=async e=>{let t=this.predictorService.initGameTypePredictions("TOP_X");return(await this.predictorHttps.getMyPredictions(t)).data.filter(a=>a.gameInstanceId===e)[0]};getUserGameEditions=async(e,t)=>{let r=this.predictorService.initGameTypePredictions("TOP_X"),i=[],a=await this.predictorHttps.getUserPredictionsNoRemap(e,r);a.forEach(p=>{p.game_instance_id&&i.push(p.game_instance_id)});let s=this.predictorService.initGameFilters("TOP_X",t,i),n=await this.predictorHttps.getUserGameEditions(s);return await this.predictorService.addPredictionProp(a,n)};getUserGamePrediction=async(e,t)=>{let r=this.predictorService.initGameTypePredictions("TOP_X");return(await this.predictorHttps.getUserPredictions(e,r)).data.filter(s=>s.gameInstanceId===t)[0]}};var qr=class{topXFacade=null;idMapping=null;constructor(e){this.idMapping=new E(e),this.topXFacade=new kr(e,this.idMapping)}getGames=async e=>await this.topXFacade.getGames(e);getGameById=async e=>await this.topXFacade.getGameById(e);getGameResults=async(e,t)=>await this.topXFacade.getGameResults(e,t);getCurrentGameResults=async()=>await this.topXFacade.getCurrentGameResults();play=async e=>await this.topXFacade.play(e);delete=async e=>await this.topXFacade.delete(e);getMyGameEditions=async e=>await this.topXFacade.getMyGameEditions(e);getMyGamePrediction=async e=>await this.topXFacade.getMyGamePrediction(e);getUserGameEditions=async(e,t)=>await this.topXFacade.getUserGameEditions(e,t);getUserGamePrediction=async(e,t)=>await this.topXFacade.getUserGamePrediction(e,t)};var jr=class{predictorHttps=null;predictorService=null;idMapping=null;constructor(e){this.idMapping=new E(e),this.predictorHttps=new X(e,this.idMapping),this.predictorService=new N(e,this.idMapping)}play=async e=>{let t=e.fixtures.map(r=>this.predictorService.validateFixture(r.matchId,r.market,r.prediction.value,r.prediction.playerId));if(t){if(this.idMapping.idSchema!=="native"){let r=[],i=[];t.forEach(n=>{r.push(n.matchId),n instanceof O&&i.push(n.prediction.playerId)});let a=await this.predictorService.remapMatchIdToNative(r),s={};i&&i.length>0&&(s=await this.predictorService.remapPlayerIdMapToNative(i)),t.forEach((n,p)=>{n.matchId=a[p],n instanceof O&&(n.prediction.playerId=s[n.prediction.playerId])})}}else throw new Error("The prediction is invalid. Please check again have you passed appropriate prediction model");return e.fixtures=t,await this.predictorHttps.makeFootballPrediction(e)};delete=async e=>await this.predictorHttps.deleteFootballPrediction(e);getGames=async e=>{let t=this.predictorService.initGameFilters("MATCH_QUIZ",e),r=await this.predictorHttps.getGames(t);return await this.predictorService.remapMatchIdsFixtures(r)};getGameById=async e=>{let t=await this.predictorHttps.getGameById(e);return await this.predictorService.remapMatchIdsFixtures(t)};getGameResults=async(e,t)=>{t&&(t=new S(t));let r=await this.predictorHttps.getGameResults(e,t);return await this.predictorService.remapMatchIdsFixtures(r)};getCurrentGameResults=async()=>{let e={status:"OPEN",type:"MATCH_QUIZ"};e=new S(e);let t=await this.predictorHttps.getGames(e),r=this.predictorService.getCurrentGameId(t);return(await this.getGameResults(r)).data[0]};getMyGameEditions=async e=>{let t=this.predictorService.initGameTypePredictions("MATCH_QUIZ"),r=[],i=await this.predictorHttps.getMyPredictionsNoRemap(t);i.forEach(n=>{n.game_instance_id&&r.push(n.game_instance_id)});let a=this.predictorService.initGameFilters("MATCH_QUIZ",e,r),s=await this.predictorHttps.getUserGameEditions(a);return await this.predictorService.addPredictionProp(i,s)};getMyGamePrediction=async e=>{let t=this.predictorService.initGameTypePredictions("MATCH_QUIZ");return(await this.predictorHttps.getMyPredictions(t)).data.filter(a=>a.gameInstanceId===e)[0]};getUserGameEditions=async(e,t)=>{let r=this.predictorService.initGameTypePredictions("MATCH_QUIZ"),i=[],a=await this.predictorHttps.getUserPredictionsNoRemap(e,r);a.forEach(p=>{p.game_instance_id&&i.push(p.game_instance_id)});let s=this.predictorService.initGameFilters("MATCH_QUIZ",t,i),n=await this.predictorHttps.getUserGameEditions(s);return await this.predictorService.addPredictionProp(a,n)};getUserGamePrediction=async(e,t)=>{let r=this.predictorService.initGameTypePredictions("MATCH_QUIZ");return(await this.predictorHttps.getUserPredictions(e,r)).data.filter(s=>s.gameInstanceId===t)[0]}};var Xr=class{matchQuizFacade=null;constructor(e){this.matchQuizFacade=new jr(e)}play=async e=>await this.matchQuizFacade.play(e);delete=async e=>await this.matchQuizFacade.delete(e);getGames=async e=>await this.matchQuizFacade.getGames(e);getGameById=async e=>await this.matchQuizFacade.getGameById(e);getGameResults=async(e,t)=>await this.matchQuizFacade.getGameResults(e,t);getCurrentGameResults=async()=>await this.matchQuizFacade.getCurrentGameResults();getMyGameEditions=async e=>await this.matchQuizFacade.getMyGameEditions(e);getMyGamePrediction=async e=>await this.matchQuizFacade.getMyGamePrediction(e);getUserGameEditions=async(e,t)=>await this.matchQuizFacade.getUserGameEditions(e,t);getUserGamePrediction=async(e,t)=>await this.matchQuizFacade.getUserGamePrediction(e,t)};function rf(o){let t=new ir().validate(o);if(t.idSchema.validation==="missing"&&(console.warn(t.idSchema.message.text),o.idSchema="native"),t.environment.validation==="missing"&&(console.warn(t.environment.message.text),o.environment="prod"),t.lang.validation==="missing"&&(console.warn(t.lang.message.text),o.lang="en"),t.isValid)return{profile:new Yt(o),football:new or(o),predictor:new Nr(o),loyalty:new Hr(o),topX:new qr(o),matchQuiz:new Xr(o)};throw new Error("Configuration is not valid")}export{rf as FansUnitedSDK};
3
3
  //# sourceMappingURL=index.js.map