fansunited-management-components 1.4.1-RC1 → 1.4.1
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.es.js +1 -1
- package/index.umd.js +1 -1
- package/package.json +1 -1
package/index.es.js
CHANGED
|
@@ -10931,7 +10931,7 @@ const ss = (e) => {
|
|
|
10931
10931
|
projectId: "fans-united-clients",
|
|
10932
10932
|
messagingSenderId: "78627953958",
|
|
10933
10933
|
appId: "1:78627953958:web:2ee87d5b274e0e7685f5e7",
|
|
10934
|
-
measurementId: "G-
|
|
10934
|
+
measurementId: "G-DPV1TYL0JW"
|
|
10935
10935
|
};
|
|
10936
10936
|
Bn.initializeApp(r);
|
|
10937
10937
|
}
|
package/index.umd.js
CHANGED
|
@@ -2322,7 +2322,7 @@
|
|
|
2322
2322
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2323
2323
|
* See the License for the specific language governing permissions and
|
|
2324
2324
|
* limitations under the License.
|
|
2325
|
-
*/const QO="auth-compat";function JO(e){e.INTERNAL.registerComponent(new Ln(QO,t=>{const r=t.getProvider("app-compat").getImmediate(),n=t.getProvider("auth");return new bd(r,n)},"PUBLIC").setServiceProps({ActionCodeInfo:{Operation:{EMAIL_SIGNIN:ji.EMAIL_SIGNIN,PASSWORD_RESET:ji.PASSWORD_RESET,RECOVER_EMAIL:ji.RECOVER_EMAIL,REVERT_SECOND_FACTOR_ADDITION:ji.REVERT_SECOND_FACTOR_ADDITION,VERIFY_AND_CHANGE_EMAIL:ji.VERIFY_AND_CHANGE_EMAIL,VERIFY_EMAIL:ji.VERIFY_EMAIL}},EmailAuthProvider:zn,FacebookAuthProvider:rn,GithubAuthProvider:an,GoogleAuthProvider:nn,OAuthProvider:Gi,SAMLAuthProvider:Bs,PhoneAuthProvider:wd,PhoneMultiFactorGenerator:Kg,RecaptchaVerifier:KO,TwitterAuthProvider:on,Auth:bd,AuthCredential:Wi,Error:sr}).setInstantiationMode("LAZY").setMultipleInstances(!1)),e.registerVersion(PO,kO)}JO(Bn);let cv=!1;const bo=e=>{if(cv)return Bn.auth();if(e&&e==="dev"){Bn.initializeApp({apiKey:"api_key"});const r=lO();Ku(r,"http://localhost:39199")}else{const r={apiKey:e&&e==="staging"?"AIzaSyBKhAYwkvkmjm16FxCMvCUQjSRpKC0DbM8":"AIzaSyDPD_SETLswR_U3dKawYkAyRhbzVXziD_4",authDomain:"fans-united-clients.firebaseapp.com",projectId:"fans-united-clients",messagingSenderId:"78627953958",appId:"1:78627953958:web:2ee87d5b274e0e7685f5e7",measurementId:"G-RH90B03KJG"};Bn.initializeApp(r)}return cv=!0,Bn.auth()},XO=e=>e==="dev"?"http://localhost:8070/v1":e==="staging"?"https://client.fansunitedstagingapi.com/v1":e==="watg"?"https://client.watg.fansunitedapi.com/v1":"https://client.fansunitedapi.com/v1";class ZO{constructor(t,r){o(this,"apiKey","");o(this,"clientId","");o(this,"environment","");o(this,"mainQueryParams",{key:"",client_id:""});o(this,"headers",{"Content-Type":"application/json"});o(this,"clientApiBaseUrl","");o(this,"sportal365ImagesSearchURL","https://content.api.sportal365.com/v2/images/search?");o(this,"sportal365Config",null);o(this,"generateSignedInUrl",t=>C(this,null,function*(){const r=`/clients/${this.clientId}/generate-signed-url?`,n={key:this.apiKey},i=yield this.getToken();return yield fetch(this.clientApiBaseUrl+r+new URLSearchParams(n),{headers:ge(he({},this.headers),{Authorization:"Bearer "+i}),method:"POST",body:JSON.stringify(t)})}));o(this,"storeInBucket",(t,r,n)=>C(this,null,function*(){const i=yield fetch(t,{headers:n,method:"PUT",body:r});if(i.ok)return this.constructAssetsUrl(r.name);const a=yield i.text();this.throwErrorFromXmlResponse(a)}));o(this,"fetchImagesFromSportal365",(t,r,n)=>C(this,null,function*(){if(this.sportal365Config){const i={Project:this.sportal365Config.project,Authorization:this.sportal365Config.authorization};let a={query:t,page:n.toString()};return r&&(r.from&&(a=ge(he({},a),{from:r.from})),r.to&&(a=ge(he({},a),{to:r.to}))),yield fetch(this.sportal365ImagesSearchURL+new URLSearchParams(a),{headers:i})}}));o(this,"getSchedulersByEntityId",t=>C(this,null,function*(){const r=`/clients/${this.clientId}/scheduler/tasks?`,n={key:this.apiKey,limit:"50",entity_id:t},i=yield this.getToken();return yield fetch(this.clientApiBaseUrl+r+new URLSearchParams(n),{headers:ge(he({},this.headers),{Authorization:"Bearer "+i})})}));o(this,"setSchedulers",(t,r,n)=>C(this,null,function*(){let i="",a="";r==="CREATE"?(i=`/clients/${this.clientId}/scheduler/tasks?`,a="POST"):(i=`/clients/${this.clientId}/scheduler/tasks/${n}?`,a="PUT");const s={key:this.apiKey},l=yield this.getToken();return yield fetch(this.clientApiBaseUrl+i+new URLSearchParams(s),{headers:ge(he({},this.headers),{Authorization:"Bearer "+l}),body:JSON.stringify(t),method:a})}));o(this,"deleteScheduledTask",t=>C(this,null,function*(){const r=`/clients/${this.clientId}/scheduler/tasks/${t}?`,n={key:this.apiKey},i=yield this.getToken();return yield fetch(this.clientApiBaseUrl+r+new URLSearchParams(n),{headers:ge(he({},this.headers),{Authorization:"Bearer "+i}),method:"DELETE"})}));o(this,"constructAssetsUrl",t=>this.environment==="dev"?`https://storage.googleapis.com/client_images_cms_fans-united-dev/${this.clientId}/${t}`:this.environment==="staging"?`https://storage.googleapis.com/client_images_cms_fans-united-stage/${this.clientId}/${t}`:`https://uploads.fansunitedassets.com/${this.clientId}/${t}`);o(this,"throwErrorFromXmlResponse",t=>{const r=new window.DOMParser().parseFromString(t,"text/xml"),n=r.getElementsByTagName("Message")&&r.getElementsByTagName("Code").length>0?r.getElementsByTagName("Message")[0].textContent:"",i=r.getElementsByTagName("Details")&&r.getElementsByTagName("Code").length>0?r.getElementsByTagName("Details")[0].textContent:"";throw new Error(n+" "+i)});o(this,"getToken",()=>C(this,null,function*(){const t=bo(this.environment).currentUser;return t?yield t.getIdToken():""}));this.apiKey=t.apiKey,this.clientId=t.clientId,this.environment=t.environment,this.mainQueryParams={key:t.apiKey,client_id:t.clientId},this.sportal365Config=r,this.clientApiBaseUrl=XO(this.environment)}}const eP=e=>e==="dev"?"http://localhost:8060/v1":e==="staging"?"https://loyalty.fansunitedstagingapi.com/v1":e==="watg"?"https://loyalty.watg.fansunitedapi.com/v1":"https://loyalty.fansunitedapi.com/v1",tP=e=>e==="dev"?"http://localhost:8040/v1":e==="staging"?"https://prediction.fansunitedstagingapi.com/v1":e==="watg"?"https://prediction.watg.fansunitedapi.com/v1":"https://prediction.fansunitedapi.com/v1",rP=e=>e==="dev"?"http://localhost:9040/v1":e==="staging"?"https://mini-games.fansunitedstagingapi.com/v1":e==="watg"?"https://mini-games.watg.fansunitedapi.com/v1":"https://mini-games.fansunitedapi.com/v1";class nP extends ZO{constructor(r,n){super(r,n);o(this,"loyaltyBaseUrl","");o(this,"predictionBaseUrl","");o(this,"miniGamesApiBaseUrl","");o(this,"createTemplate",r=>C(this,null,function*(){const n="/leaderboard/templates?",i=yield this.getToken();return yield fetch(this.loyaltyBaseUrl+n+new URLSearchParams(this.mainQueryParams),{headers:ge(he({},this.headers),{Authorization:"Bearer "+i}),method:"POST",body:JSON.stringify(r)})}));o(this,"editTemplate",(r,n)=>C(this,null,function*(){const i=`/leaderboard/templates/${r}?`,a=yield this.getToken();return yield fetch(this.loyaltyBaseUrl+i+new URLSearchParams(this.mainQueryParams),{headers:ge(he({},this.headers),{Authorization:"Bearer "+a}),method:"PUT",body:JSON.stringify(n)})}));o(this,"deleteTemplate",r=>C(this,null,function*(){const n=`/leaderboard/templates/${r}?`,i=yield this.getToken();return yield fetch(this.loyaltyBaseUrl+n+new URLSearchParams(this.mainQueryParams),{headers:ge(he({},this.headers),{Authorization:"Bearer "+i}),method:"DELETE"})}));o(this,"setWinners",r=>C(this,null,function*(){const n="/winners?",i=yield this.getToken();return yield fetch(this.predictionBaseUrl+n+new URLSearchParams(this.mainQueryParams),{headers:ge(he({},this.headers),{Authorization:"Bearer "+i}),method:"POST",body:JSON.stringify(r)})}));o(this,"exportDetailedLeaderboard",(r,n)=>C(this,null,function*(){const i=`/leaderboard/${r}/detailed?`,a=yield this.getToken();return yield fetch(this.loyaltyBaseUrl+i+new URLSearchParams(ge(he({},this.mainQueryParams),{limit:n.toString()})),{headers:ge(he({},this.headers),{Authorization:"Bearer "+a})})}));o(this,"exportDetailedGameLeaderboard",(r,n)=>C(this,null,function*(){const i=`/leaderboard/games/${r}/detailed?`,a=yield this.getToken();return yield fetch(this.loyaltyBaseUrl+i+new URLSearchParams(ge(he({},this.mainQueryParams),{limit:n.toString()})),{headers:ge(he({},this.headers),{Authorization:"Bearer "+a})})}));o(this,"createGame",r=>C(this,null,function*(){const n="/games?",i=yield this.getToken();return yield fetch(this.predictionBaseUrl+n+new URLSearchParams(this.mainQueryParams),{headers:ge(he({},this.headers),{Authorization:"Bearer "+i}),method:"POST",body:JSON.stringify(r)})}));o(this,"editGame",(r,n)=>C(this,null,function*(){const i=`/games/${r}?`,a=yield this.getToken();return yield fetch(this.predictionBaseUrl+i+new URLSearchParams(this.mainQueryParams),{headers:ge(he({},this.headers),{Authorization:"Bearer "+a}),method:"PATCH",body:JSON.stringify(n)})}));o(this,"getClassicQuizFeature",()=>C(this,null,function*(){const r=`/clients/${this.clientId}/features/classic_quiz?`,n={key:this.apiKey};return yield fetch(this.clientApiBaseUrl+r+new URLSearchParams(n))}));o(this,"getEitherOrFeature",()=>C(this,null,function*(){const r=`/clients/${this.clientId}/features/either_or?`,n={key:this.apiKey};return yield fetch(this.clientApiBaseUrl+r+new URLSearchParams(n))}));o(this,"createClassicQuiz",r=>C(this,null,function*(){const n="/classic-quizzes?",i=yield this.getToken();return yield fetch(this.miniGamesApiBaseUrl+n+new URLSearchParams(this.mainQueryParams),{headers:ge(he({},this.headers),{Authorization:"Bearer "+i}),method:"POST",body:JSON.stringify(r)})}));o(this,"updateClassicQuiz",(r,n)=>C(this,null,function*(){const i=`/classic-quizzes/${r}?`,a=yield this.getToken();return yield fetch(this.miniGamesApiBaseUrl+i+new URLSearchParams(this.mainQueryParams),{headers:ge(he({},this.headers),{Authorization:"Bearer "+a}),method:"PUT",body:JSON.stringify(n)})}));o(this,"getClassicQuizById",r=>C(this,null,function*(){const n=`/classic-quizzes/${r}/staff?`,i=yield this.getToken();return yield fetch(this.miniGamesApiBaseUrl+n+new URLSearchParams(this.mainQueryParams),{headers:ge(he({},this.headers),{Authorization:"Bearer "+i})})}));o(this,"deleteClassicQuiz",r=>C(this,null,function*(){const n=`/classic-quizzes/${r}?`,i=yield this.getToken();return yield fetch(this.miniGamesApiBaseUrl+n+new URLSearchParams(this.mainQueryParams),{headers:ge(he({},this.headers),{Authorization:"Bearer "+i}),method:"DELETE"})}));o(this,"calculateQuestionsReport",r=>C(this,null,function*(){const n=`/classic-quizzes/${r}/questions-report?`,i=yield this.getToken();return yield fetch(this.miniGamesApiBaseUrl+n+new URLSearchParams(this.mainQueryParams),{headers:ge(he({},this.headers),{Authorization:"Bearer "+i}),method:"POST"})}));this.loyaltyBaseUrl=eP(r.environment),this.predictionBaseUrl=tP(r.environment),this.miniGamesApiBaseUrl=rP(r.environment)}}var iP=Object.create,_d=Object.defineProperty,aP=Object.getOwnPropertyDescriptor,oP=Object.getOwnPropertyNames,sP=Object.getPrototypeOf,lP=Object.prototype.hasOwnProperty,cP=(e,t,r)=>t in e?_d(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,el=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),uP=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of oP(t))!lP.call(e,i)&&i!==r&&_d(e,i,{get:()=>t[i],enumerable:!(n=aP(t,i))||n.enumerable});return e},dP=(e,t,r)=>(r=e!=null?iP(sP(e)):{},uP(!e||!e.__esModule?_d(r,"default",{value:e,enumerable:!0}):r,e)),En=(e,t,r)=>(cP(e,typeof t!="symbol"?t+"":t,r),r),fP=el((e,t)=>{var r=function(){function n(p,g){return g!=null&&p instanceof g}var i;try{i=Map}catch(p){i=function(){}}var a;try{a=Set}catch(p){a=function(){}}var s;try{s=Promise}catch(p){s=function(){}}function l(p,g,m,y,b){typeof g=="object"&&(m=g.depth,y=g.prototype,b=g.includeNonEnumerable,g=g.circular);var v=[],w=[],_=typeof Buffer<"u";typeof g>"u"&&(g=!0),typeof m>"u"&&(m=1/0);function x(S,T){if(S===null)return null;if(T===0)return S;var E,k;if(typeof S!="object")return S;if(n(S,i))E=new i;else if(n(S,a))E=new a;else if(n(S,s))E=new s(function(W,V){S.then(function(U){W(x(U,T-1))},function(U){V(x(U,T-1))})});else if(l.__isArray(S))E=[];else if(l.__isRegExp(S))E=new RegExp(S.source,h(S)),S.lastIndex&&(E.lastIndex=S.lastIndex);else if(l.__isDate(S))E=new Date(S.getTime());else{if(_&&Buffer.isBuffer(S))return Buffer.allocUnsafe?E=Buffer.allocUnsafe(S.length):E=new Buffer(S.length),S.copy(E),E;n(S,Error)?E=Object.create(S):typeof y>"u"?(k=Object.getPrototypeOf(S),E=Object.create(k)):(E=Object.create(y),k=y)}if(g){var O=v.indexOf(S);if(O!=-1)return w[O];v.push(S),w.push(E)}n(S,i)&&S.forEach(function(W,V){var U=x(V,T-1),P=x(W,T-1);E.set(U,P)}),n(S,a)&&S.forEach(function(W){var V=x(W,T-1);E.add(V)});for(var A in S){var R;k&&(R=Object.getOwnPropertyDescriptor(k,A)),!(R&&R.set==null)&&(E[A]=x(S[A],T-1))}if(Object.getOwnPropertySymbols)for(var D=Object.getOwnPropertySymbols(S),A=0;A<D.length;A++){var N=D[A],F=Object.getOwnPropertyDescriptor(S,N);F&&!F.enumerable&&!b||(E[N]=x(S[N],T-1),F.enumerable||Object.defineProperty(E,N,{enumerable:!1}))}if(b)for(var $=Object.getOwnPropertyNames(S),A=0;A<$.length;A++){var j=$[A],F=Object.getOwnPropertyDescriptor(S,j);F&&F.enumerable||(E[j]=x(S[j],T-1),Object.defineProperty(E,j,{enumerable:!1}))}return E}return x(p,m)}l.clonePrototype=function(p){if(p===null)return null;var g=function(){};return g.prototype=p,new g};function c(p){return Object.prototype.toString.call(p)}l.__objToStr=c;function u(p){return typeof p=="object"&&c(p)==="[object Date]"}l.__isDate=u;function d(p){return typeof p=="object"&&c(p)==="[object Array]"}l.__isArray=d;function f(p){return typeof p=="object"&&c(p)==="[object RegExp]"}l.__isRegExp=f;function h(p){var g="";return p.global&&(g+="g"),p.ignoreCase&&(g+="i"),p.multiline&&(g+="m"),g}return l.__getRegExpFlags=h,l}();typeof t=="object"&&t.exports&&(t.exports=r)}),hP=el((e,t)=>{var r=typeof Reflect=="object"?Reflect:null,n=r&&typeof r.apply=="function"?r.apply:function(S,T,E){return Function.prototype.apply.call(S,T,E)},i;r&&typeof r.ownKeys=="function"?i=r.ownKeys:Object.getOwnPropertySymbols?i=function(S){return Object.getOwnPropertyNames(S).concat(Object.getOwnPropertySymbols(S))}:i=function(S){return Object.getOwnPropertyNames(S)};function a(S){console&&console.warn&&console.warn(S)}var s=Number.isNaN||function(S){return S!==S};function l(){l.init.call(this)}t.exports=l,t.exports.once=w,l.EventEmitter=l,l.prototype._events=void 0,l.prototype._eventsCount=0,l.prototype._maxListeners=void 0;var c=10;function u(S){if(typeof S!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof S)}Object.defineProperty(l,"defaultMaxListeners",{enumerable:!0,get:function(){return c},set:function(S){if(typeof S!="number"||S<0||s(S))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+S+".");c=S}}),l.init=function(){(this._events===void 0||this._events===Object.getPrototypeOf(this)._events)&&(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},l.prototype.setMaxListeners=function(S){if(typeof S!="number"||S<0||s(S))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+S+".");return this._maxListeners=S,this};function d(S){return S._maxListeners===void 0?l.defaultMaxListeners:S._maxListeners}l.prototype.getMaxListeners=function(){return d(this)},l.prototype.emit=function(S){for(var T=[],E=1;E<arguments.length;E++)T.push(arguments[E]);var k=S==="error",O=this._events;if(O!==void 0)k=k&&O.error===void 0;else if(!k)return!1;if(k){var A;if(T.length>0&&(A=T[0]),A instanceof Error)throw A;var R=new Error("Unhandled error."+(A?" ("+A.message+")":""));throw R.context=A,R}var D=O[S];if(D===void 0)return!1;if(typeof D=="function")n(D,this,T);else for(var N=D.length,F=y(D,N),E=0;E<N;++E)n(F[E],this,T);return!0};function f(S,T,E,k){var O,A,R;if(u(E),A=S._events,A===void 0?(A=S._events=Object.create(null),S._eventsCount=0):(A.newListener!==void 0&&(S.emit("newListener",T,E.listener?E.listener:E),A=S._events),R=A[T]),R===void 0)R=A[T]=E,++S._eventsCount;else if(typeof R=="function"?R=A[T]=k?[E,R]:[R,E]:k?R.unshift(E):R.push(E),O=d(S),O>0&&R.length>O&&!R.warned){R.warned=!0;var D=new Error("Possible EventEmitter memory leak detected. "+R.length+" "+String(T)+" listeners added. Use emitter.setMaxListeners() to increase limit");D.name="MaxListenersExceededWarning",D.emitter=S,D.type=T,D.count=R.length,a(D)}return S}l.prototype.addListener=function(S,T){return f(this,S,T,!1)},l.prototype.on=l.prototype.addListener,l.prototype.prependListener=function(S,T){return f(this,S,T,!0)};function h(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length===0?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function p(S,T,E){var k={fired:!1,wrapFn:void 0,target:S,type:T,listener:E},O=h.bind(k);return O.listener=E,k.wrapFn=O,O}l.prototype.once=function(S,T){return u(T),this.on(S,p(this,S,T)),this},l.prototype.prependOnceListener=function(S,T){return u(T),this.prependListener(S,p(this,S,T)),this},l.prototype.removeListener=function(S,T){var E,k,O,A,R;if(u(T),k=this._events,k===void 0)return this;if(E=k[S],E===void 0)return this;if(E===T||E.listener===T)--this._eventsCount===0?this._events=Object.create(null):(delete k[S],k.removeListener&&this.emit("removeListener",S,E.listener||T));else if(typeof E!="function"){for(O=-1,A=E.length-1;A>=0;A--)if(E[A]===T||E[A].listener===T){R=E[A].listener,O=A;break}if(O<0)return this;O===0?E.shift():b(E,O),E.length===1&&(k[S]=E[0]),k.removeListener!==void 0&&this.emit("removeListener",S,R||T)}return this},l.prototype.off=l.prototype.removeListener,l.prototype.removeAllListeners=function(S){var T,E,k;if(E=this._events,E===void 0)return this;if(E.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):E[S]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete E[S]),this;if(arguments.length===0){var O=Object.keys(E),A;for(k=0;k<O.length;++k)A=O[k],A!=="removeListener"&&this.removeAllListeners(A);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if(T=E[S],typeof T=="function")this.removeListener(S,T);else if(T!==void 0)for(k=T.length-1;k>=0;k--)this.removeListener(S,T[k]);return this};function g(S,T,E){var k=S._events;if(k===void 0)return[];var O=k[T];return O===void 0?[]:typeof O=="function"?E?[O.listener||O]:[O]:E?v(O):y(O,O.length)}l.prototype.listeners=function(S){return g(this,S,!0)},l.prototype.rawListeners=function(S){return g(this,S,!1)},l.listenerCount=function(S,T){return typeof S.listenerCount=="function"?S.listenerCount(T):m.call(S,T)},l.prototype.listenerCount=m;function m(S){var T=this._events;if(T!==void 0){var E=T[S];if(typeof E=="function")return 1;if(E!==void 0)return E.length}return 0}l.prototype.eventNames=function(){return this._eventsCount>0?i(this._events):[]};function y(S,T){for(var E=new Array(T),k=0;k<T;++k)E[k]=S[k];return E}function b(S,T){for(;T+1<S.length;T++)S[T]=S[T+1];S.pop()}function v(S){for(var T=new Array(S.length),E=0;E<T.length;++E)T[E]=S[E].listener||S[E];return T}function w(S,T){return new Promise(function(E,k){function O(R){S.removeListener(T,A),k(R)}function A(){typeof S.removeListener=="function"&&S.removeListener("error",O),E([].slice.call(arguments))}x(S,T,A,{once:!0}),T!=="error"&&_(S,O,{once:!0})})}function _(S,T,E){typeof S.on=="function"&&x(S,"error",T,E)}function x(S,T,E,k){if(typeof S.on=="function")k.once?S.once(T,E):S.on(T,E);else if(typeof S.addEventListener=="function")S.addEventListener(T,function O(A){k.once&&S.removeEventListener(T,O),E(A)});else throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof S)}}),pP=el((e,t)=>{(function(){var r,n,i=[].splice,a=function(l,c){if(!(l instanceof c))throw new Error("Bound instance method accessed before binding")},s=[].indexOf;n=fP(),r=hP().EventEmitter,t.exports=function(){class l extends r{constructor(u={}){super(),this.get=this.get.bind(this),this.mget=this.mget.bind(this),this.set=this.set.bind(this),this.mset=this.mset.bind(this),this.del=this.del.bind(this),this.take=this.take.bind(this),this.ttl=this.ttl.bind(this),this.getTtl=this.getTtl.bind(this),this.keys=this.keys.bind(this),this.has=this.has.bind(this),this.getStats=this.getStats.bind(this),this.flushAll=this.flushAll.bind(this),this.flushStats=this.flushStats.bind(this),this.close=this.close.bind(this),this._checkData=this._checkData.bind(this),this._check=this._check.bind(this),this._isInvalidKey=this._isInvalidKey.bind(this),this._wrap=this._wrap.bind(this),this._getValLength=this._getValLength.bind(this),this._error=this._error.bind(this),this._initErrors=this._initErrors.bind(this),this.options=u,this._initErrors(),this.data={},this.options=Object.assign({forceString:!1,objectValueSize:80,promiseValueSize:80,arrayValueSize:40,stdTTL:0,checkperiod:600,useClones:!0,deleteOnExpire:!0,enableLegacyCallbacks:!1,maxKeys:-1},this.options),this.options.enableLegacyCallbacks&&(console.warn("WARNING! node-cache legacy callback support will drop in v6.x"),["get","mget","set","del","ttl","getTtl","keys","has"].forEach(d=>{var f;f=this[d],this[d]=function(...h){var p,g,m,y;if(m=h,[...h]=m,[p]=i.call(h,-1),typeof p=="function")try{y=f(...h),p(null,y)}catch(b){g=b,p(g)}else return f(...h,p)}})),this.stats={hits:0,misses:0,keys:0,ksize:0,vsize:0},this.validKeyTypes=["string","number"],this._checkData()}get(u){var d,f;if(a(this,l),(f=this._isInvalidKey(u))!=null)throw f;if(this.data[u]!=null&&this._check(u,this.data[u]))return this.stats.hits++,d=this._unwrap(this.data[u]),d;this.stats.misses++}mget(u){var d,f,h,p,g,m;if(a(this,l),!Array.isArray(u))throw d=this._error("EKEYSTYPE"),d;for(m={},h=0,g=u.length;h<g;h++){if(p=u[h],(f=this._isInvalidKey(p))!=null)throw f;this.data[p]!=null&&this._check(p,this.data[p])?(this.stats.hits++,m[p]=this._unwrap(this.data[p])):this.stats.misses++}return m}set(u,d,f){var h,p,g;if(a(this,l),this.options.maxKeys>-1&&this.stats.keys>=this.options.maxKeys)throw h=this._error("ECACHEFULL"),h;if(this.options.forceString&&!1==="string"&&(d=JSON.stringify(d)),f==null&&(f=this.options.stdTTL),(p=this._isInvalidKey(u))!=null)throw p;return g=!1,this.data[u]&&(g=!0,this.stats.vsize-=this._getValLength(this._unwrap(this.data[u],!1))),this.data[u]=this._wrap(d,f),this.stats.vsize+=this._getValLength(d),g||(this.stats.ksize+=this._getKeyLength(u),this.stats.keys++),this.emit("set",u,d),!0}mset(u){var d,f,h,p,g,m,y,b,v,w;if(a(this,l),this.options.maxKeys>-1&&this.stats.keys+u.length>=this.options.maxKeys)throw d=this._error("ECACHEFULL"),d;for(h=0,y=u.length;h<y;h++){if(m=u[h],{key:g,val:w,ttl:v}=m,v&&typeof v!="number")throw d=this._error("ETTLTYPE"),d;if((f=this._isInvalidKey(g))!=null)throw f}for(p=0,b=u.length;p<b;p++)m=u[p],{key:g,val:w,ttl:v}=m,this.set(g,w,v);return!0}del(u){var d,f,h,p,g,m;for(a(this,l),Array.isArray(u)||(u=[u]),d=0,h=0,g=u.length;h<g;h++){if(p=u[h],(f=this._isInvalidKey(p))!=null)throw f;this.data[p]!=null&&(this.stats.vsize-=this._getValLength(this._unwrap(this.data[p],!1)),this.stats.ksize-=this._getKeyLength(p),this.stats.keys--,d++,m=this.data[p],delete this.data[p],this.emit("del",p,m.v))}return d}take(u){var d;return a(this,l),d=this.get(u),d!=null&&this.del(u),d}ttl(u,d){var f;if(a(this,l),d||(d=this.options.stdTTL),!u)return!1;if((f=this._isInvalidKey(u))!=null)throw f;return this.data[u]!=null&&this._check(u,this.data[u])?(d>=0?this.data[u]=this._wrap(this.data[u].v,d,!1):this.del(u),!0):!1}getTtl(u){var d,f;if(a(this,l),!!u){if((f=this._isInvalidKey(u))!=null)throw f;if(this.data[u]!=null&&this._check(u,this.data[u]))return d=this.data[u].t,d}}keys(){var u;return a(this,l),u=Object.keys(this.data),u}has(u){var d;return a(this,l),d=this.data[u]!=null&&this._check(u,this.data[u]),d}getStats(){return a(this,l),this.stats}flushAll(u=!0){a(this,l),this.data={},this.stats={hits:0,misses:0,keys:0,ksize:0,vsize:0},this._killCheckPeriod(),this._checkData(u),this.emit("flush")}flushStats(){a(this,l),this.stats={hits:0,misses:0,keys:0,ksize:0,vsize:0},this.emit("flush_stats")}close(){a(this,l),this._killCheckPeriod()}_checkData(u=!0){var d,f,h;a(this,l),f=this.data;for(d in f)h=f[d],this._check(d,h);u&&this.options.checkperiod>0&&(this.checkTimeout=setTimeout(this._checkData,this.options.checkperiod*1e3,u),this.checkTimeout!=null&&this.checkTimeout.unref!=null&&this.checkTimeout.unref())}_killCheckPeriod(){if(this.checkTimeout!=null)return clearTimeout(this.checkTimeout)}_check(u,d){var f;return a(this,l),f=!0,d.t!==0&&d.t<Date.now()&&(this.options.deleteOnExpire&&(f=!1,this.del(u)),this.emit("expired",u,this._unwrap(d))),f}_isInvalidKey(u){var d;if(a(this,l),d=typeof u,s.call(this.validKeyTypes,d)<0)return this._error("EKEYTYPE",{type:typeof u})}_wrap(u,d,f=!0){var h,p,g;return a(this,l),this.options.useClones||(f=!1),p=Date.now(),h=0,g=1e3,d===0?h=0:d?h=p+d*g:this.options.stdTTL===0?h=this.options.stdTTL:h=p+this.options.stdTTL*g,{t:h,v:f?n(u):u}}_unwrap(u,d=!0){return this.options.useClones||(d=!1),u.v!=null?d?n(u.v):u.v:null}_getKeyLength(u){return u.toString().length}_getValLength(u){return a(this,l),typeof u=="string"?u.length:this.options.forceString?JSON.stringify(u).length:Array.isArray(u)?this.options.arrayValueSize*u.length:typeof u=="number"?8:typeof(u==null?void 0:u.then)=="function"?this.options.promiseValueSize:typeof Buffer<"u"&&Buffer!==null&&Buffer.isBuffer(u)?u.length:u!=null&&typeof u=="object"?this.options.objectValueSize*Object.keys(u).length:typeof u=="boolean"?8:0}_error(u,d={}){var f;return a(this,l),f=new Error,f.name=u,f.errorcode=u,f.message=this.ERRORS[u]!=null?this.ERRORS[u](d):"-",f.data=d,f}_initErrors(){var u,d,f;a(this,l),this.ERRORS={},f=this._ERRORS;for(d in f)u=f[d],this.ERRORS[d]=this.createErrorMessage(u)}createErrorMessage(u){return function(d){return u.replace("__key",d.type)}}}return l.prototype._ERRORS={ENOTFOUND:"Key `__key` not found",ECACHEFULL:"Cache max keys amount exceeded",EKEYTYPE:"The key argument has to be of type `string` or `number`. Found: `__key`",EKEYSTYPE:"The keys argument has to be an array.",ETTLTYPE:"The ttl argument has to be a number."},l}.call(this)}).call(e)}),mP=el((e,t)=>{(function(){var r;r=t.exports=pP(),r.version="5.1.2"}).call(e)}),uv=e=>{let t=200,r=[],n=0;return r[n]=[],e.forEach(i=>{r[n].length<=t-1?r[n].push(i):(n++,r[n]=[i])}),r},wo=(e,t)=>{let r=[];for(;e.length>t;){let n=e.splice(0,t);r.push(n)}return r.push(e),r},Rr=(e,t)=>{let r="";return e==="prod"?r={profile:"https://profile.fansunitedapi.com/v1",football:"https://football.fansunitedapi.com/v1",idMapping:"https://id-mapping.fansunitedapi.com/v1",predictor:"https://prediction.fansunitedapi.com/v1",client:"https://client.fansunitedapi.com/v1",loyalty:"https://loyalty.fansunitedapi.com/v1",miniGames:"https://mini-games.fansunitedapi.com/v1",discussions:"https://discussions.fansunitedapi.com/v1",privateLeagues:"https://private-leagues.fansunitedapi.com/v1",voting:"https://voting.fansunitedapi.com/v1"}[t]:e==="dev"?r={profile:"http://localhost:8010/v1",football:"http://localhost:8080/v1",idMapping:"http://localhost:8030/v1",predictor:"http://localhost:8040/v1",client:"http://localhost:8070/v1",loyalty:"http://localhost:8060/v1",miniGames:"http://localhost:9040/v1",discussions:"http://localhost:9020/v1",privateLeagues:"http://localhost:9010/v1",voting:"http://localhost:9030/v1"}[t]:e==="watg"?r={profile:"https://profile.watg.fansunitedapi.com/v1",football:"https://football.watg.fansunitedapi.com/v1",idMapping:"https://id-mapping.watg.fansunitedapi.com/v1",predictor:"https://prediction.watg.fansunitedapi.com/v1",client:"https://client.watg.fansunitedapi.com/v1",loyalty:"https://loyalty.watg.fansunitedapi.com/v1",miniGames:"https://mini-games.watg.fansunitedapi.com/v1",discussions:"https://discussions.watg.fansunitedapi.com/v1",privateLeagues:"https://private-leagues.watg.fansunitedapi.com/v1",voting:"https://voting.watg.fansunitedapi.com/v1"}[t]:r={profile:"https://profile.fansunitedstagingapi.com/v1",football:"https://football.fansunitedstagingapi.com/v1",idMapping:"https://id-mapping.fansunitedstagingapi.com/v1",predictor:"https://prediction.fansunitedstagingapi.com/v1",client:"https://client.fansunitedstagingapi.com/v1",loyalty:"https://loyalty.fansunitedstagingapi.com/v1",miniGames:"https://mini-games.fansunitedstagingapi.com/v1",discussions:"https://discussions.fansunitedstagingapi.com/v1",privateLeagues:"https://private-leagues.fansunitedstagingapi.com/v1",voting:"https://voting.fansunitedstagingapi.com/v1"}[t],r},tl=e=>Array.from(new Set(e)),ut=e=>e||!1,Ze=()=>`&disable_cache=${Date.now()}`,dv=e=>JSON.parse(JSON.stringify(e.sort((t,r)=>t.localeCompare(r)))),gP=class{constructor(){o(this,"id",null);o(this,"name",null);o(this,"nickname",null);o(this,"avatar",null);o(this,"gender",null);o(this,"country",null);o(this,"birthDate",null);o(this,"verified",!1);o(this,"staffMember",!1);o(this,"interests",[]);o(this,"followingCount",0);o(this,"followersCount",0)}},vP=class{constructor(){o(this,"profilesFromResponse",e=>e?e.map(t=>this.fullProfileFromResponse(t)):null);o(this,"fullProfileFromResponse",e=>{let t=new gP;return t.id=e.id,t.name=e.name,t.nickname=e.nickname,t.avatar=e.avatar,t.gender=e.gender,t.country=e.country,t.birthDate=e.birth_date,t.verified=e.verified,t.staffMember=e.staff_member,t.interests=e.interests?e.interests:[],t.followingCount=e.following_count,t.followersCount=e.followers_count,t})}},rl=class{constructor(){o(this,"nextPageStartsAfter",null);o(this,"itemsPerPage",null)}},di=class{constructor(){o(this,"pagination",new rl)}},_r=class{constructor(){o(this,"meta",new di);o(this,"data",[])}},yP=class{constructor(){o(this,"avatar",null);o(this,"followingId",null);o(this,"name",null);o(this,"nickname",null);o(this,"profileId",null)}},bP=class{constructor(){o(this,"followResponse",e=>e.map(t=>this.remapResponse(t)));o(this,"followingFromResponse",e=>{let t=new _r;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});o(this,"remapResponse",e=>{let t=new yP;return t.avatar=e.avatar,t.followingId=e.following_id,t.name=e.name,t.profileId=e.profile_id,t.nickname=e.nickname,t})}},wP=class{constructor(){o(this,"avatar",null);o(this,"followerId",null);o(this,"name",null);o(this,"nickname",null);o(this,"profileId",null)}},_P=class{constructor(){o(this,"followersFromResponse",e=>{let t=new _r;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});o(this,"remapResponse",e=>{let t=new wP;return t.avatar=e.avatar,t.followerId=e.follower_id,t.name=e.name,t.profileId=e.profile_id,t})}},fv=class{constructor(){o(this,"profile_ids",[])}};function xd(e){this.message=e}xd.prototype=new Error,xd.prototype.name="InvalidCharacterError";var hv=typeof window<"u"&&window.atob&&window.atob.bind(window)||function(e){var t=String(e).replace(/=+$/,"");if(t.length%4==1)throw new xd("'atob' failed: The string to be decoded is not correctly encoded.");for(var r,n,i=0,a=0,s="";n=t.charAt(a++);~n&&(r=i%4?64*r+n:n,i++%4)?s+=String.fromCharCode(255&r>>(-2*i&6)):0)n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(n);return s};function xP(e){var t=e.replace(/-/g,"+").replace(/_/g,"/");switch(t.length%4){case 0:break;case 2:t+="==";break;case 3:t+="=";break;default:throw"Illegal base64url string!"}try{return function(r){return decodeURIComponent(hv(r).replace(/(.)/g,function(n,i){var a=i.charCodeAt(0).toString(16).toUpperCase();return a.length<2&&(a="0"+a),"%"+a}))}(t)}catch(r){return hv(t)}}function nl(e){this.message=e}function CP(e,t){if(typeof e!="string")throw new nl("Invalid token specified");var r=(t=t||{}).header===!0?0:1;try{return JSON.parse(xP(e.split(".")[r]))}catch(n){throw new nl("Invalid token specified: "+n.message)}}nl.prototype=new Error,nl.prototype.name="InvalidTokenError";var pv=CP,cr={native:"id",sportradar:"sportradar_id",sportal365:"sportal365_id",enetpulse:"enetpulse_id",api_football:"api_football_id"},mv={PREDICTOR_USER_RELATED_OPERATION:"https://docs.fansunitedmedia.com/docs/predictor-operations#user-related-operations"},gv=["matchId","matchType","market","prediction"],IP=new Map().set("FT_1X2","fullTimeOneXTwo").set("HT_1X2","halfTimeOneXTwo").set("BOTH_TEAMS_SCORE","bothTeamsScore").set("DOUBLE_CHANCE","doubleChance").set("HT_FT","halfTimeFullTime").set("PLAYER_SCORE","playerScore").set("PLAYER_YELLOW_CARD","playerYellowCard").set("PLAYER_RED_CARD","playerRedCard").set("RED_CARD_MATCH","redCardMatch").set("PENALTY_MATCH","penaltyMatch").set("PLAYER_SCORE_FIRST_GOAL","playerScoreFirstGoal").set("CORNERS_MATCH","cornersMatch").set("CORRECT_SCORE","correctScore").set("CORRECT_SCORE_ADVANCED","correctScoreAdvanced").set("CORRECT_SCORE_HT","correctScoreHalfTime").set("PLAYER_SCORE_HATTRICK","playerScoreHattrick").set("PLAYER_SCORE_TWICE","playerScoreTwice").set("OVER_GOALS_0_5","overZeroPointFiveGoals").set("OVER_GOALS_1_5","overOnePointFiveGoals").set("OVER_GOALS_2_5","overTwoPointFiveGoals").set("OVER_GOALS_3_5","overThreePointFiveGoals").set("OVER_GOALS_4_5","overFourPointFiveGoals").set("OVER_GOALS_5_5","overFivePointFiveGoals").set("OVER_GOALS_6_5","overSixPointFiveGoals").set("OVER_CORNERS_6_5","overSixPointFiveCorners").set("OVER_CORNERS_7_5","overSevenPointFiveCorners").set("OVER_CORNERS_8_5","overEightPointFiveCorners").set("OVER_CORNERS_9_5","overNinePointFiveCorners").set("OVER_CORNERS_10_5","overTenPointFiveCorners").set("OVER_CORNERS_11_5","overElevenPointFiveCorners").set("OVER_CORNERS_12_5","overTwelvePointFiveCorners").set("OVER_CORNERS_13_5","overThirteenPointFiveCorners"),vv={UNEXPECTED_STATUS_PROP:`Unexpected provided property 'status'. You can NOT use this property for this method. For more information visit our documentation:
|
|
2325
|
+
*/const QO="auth-compat";function JO(e){e.INTERNAL.registerComponent(new Ln(QO,t=>{const r=t.getProvider("app-compat").getImmediate(),n=t.getProvider("auth");return new bd(r,n)},"PUBLIC").setServiceProps({ActionCodeInfo:{Operation:{EMAIL_SIGNIN:ji.EMAIL_SIGNIN,PASSWORD_RESET:ji.PASSWORD_RESET,RECOVER_EMAIL:ji.RECOVER_EMAIL,REVERT_SECOND_FACTOR_ADDITION:ji.REVERT_SECOND_FACTOR_ADDITION,VERIFY_AND_CHANGE_EMAIL:ji.VERIFY_AND_CHANGE_EMAIL,VERIFY_EMAIL:ji.VERIFY_EMAIL}},EmailAuthProvider:zn,FacebookAuthProvider:rn,GithubAuthProvider:an,GoogleAuthProvider:nn,OAuthProvider:Gi,SAMLAuthProvider:Bs,PhoneAuthProvider:wd,PhoneMultiFactorGenerator:Kg,RecaptchaVerifier:KO,TwitterAuthProvider:on,Auth:bd,AuthCredential:Wi,Error:sr}).setInstantiationMode("LAZY").setMultipleInstances(!1)),e.registerVersion(PO,kO)}JO(Bn);let cv=!1;const bo=e=>{if(cv)return Bn.auth();if(e&&e==="dev"){Bn.initializeApp({apiKey:"api_key"});const r=lO();Ku(r,"http://localhost:39199")}else{const r={apiKey:e&&e==="staging"?"AIzaSyBKhAYwkvkmjm16FxCMvCUQjSRpKC0DbM8":"AIzaSyDPD_SETLswR_U3dKawYkAyRhbzVXziD_4",authDomain:"fans-united-clients.firebaseapp.com",projectId:"fans-united-clients",messagingSenderId:"78627953958",appId:"1:78627953958:web:2ee87d5b274e0e7685f5e7",measurementId:"G-DPV1TYL0JW"};Bn.initializeApp(r)}return cv=!0,Bn.auth()},XO=e=>e==="dev"?"http://localhost:8070/v1":e==="staging"?"https://client.fansunitedstagingapi.com/v1":e==="watg"?"https://client.watg.fansunitedapi.com/v1":"https://client.fansunitedapi.com/v1";class ZO{constructor(t,r){o(this,"apiKey","");o(this,"clientId","");o(this,"environment","");o(this,"mainQueryParams",{key:"",client_id:""});o(this,"headers",{"Content-Type":"application/json"});o(this,"clientApiBaseUrl","");o(this,"sportal365ImagesSearchURL","https://content.api.sportal365.com/v2/images/search?");o(this,"sportal365Config",null);o(this,"generateSignedInUrl",t=>C(this,null,function*(){const r=`/clients/${this.clientId}/generate-signed-url?`,n={key:this.apiKey},i=yield this.getToken();return yield fetch(this.clientApiBaseUrl+r+new URLSearchParams(n),{headers:ge(he({},this.headers),{Authorization:"Bearer "+i}),method:"POST",body:JSON.stringify(t)})}));o(this,"storeInBucket",(t,r,n)=>C(this,null,function*(){const i=yield fetch(t,{headers:n,method:"PUT",body:r});if(i.ok)return this.constructAssetsUrl(r.name);const a=yield i.text();this.throwErrorFromXmlResponse(a)}));o(this,"fetchImagesFromSportal365",(t,r,n)=>C(this,null,function*(){if(this.sportal365Config){const i={Project:this.sportal365Config.project,Authorization:this.sportal365Config.authorization};let a={query:t,page:n.toString()};return r&&(r.from&&(a=ge(he({},a),{from:r.from})),r.to&&(a=ge(he({},a),{to:r.to}))),yield fetch(this.sportal365ImagesSearchURL+new URLSearchParams(a),{headers:i})}}));o(this,"getSchedulersByEntityId",t=>C(this,null,function*(){const r=`/clients/${this.clientId}/scheduler/tasks?`,n={key:this.apiKey,limit:"50",entity_id:t},i=yield this.getToken();return yield fetch(this.clientApiBaseUrl+r+new URLSearchParams(n),{headers:ge(he({},this.headers),{Authorization:"Bearer "+i})})}));o(this,"setSchedulers",(t,r,n)=>C(this,null,function*(){let i="",a="";r==="CREATE"?(i=`/clients/${this.clientId}/scheduler/tasks?`,a="POST"):(i=`/clients/${this.clientId}/scheduler/tasks/${n}?`,a="PUT");const s={key:this.apiKey},l=yield this.getToken();return yield fetch(this.clientApiBaseUrl+i+new URLSearchParams(s),{headers:ge(he({},this.headers),{Authorization:"Bearer "+l}),body:JSON.stringify(t),method:a})}));o(this,"deleteScheduledTask",t=>C(this,null,function*(){const r=`/clients/${this.clientId}/scheduler/tasks/${t}?`,n={key:this.apiKey},i=yield this.getToken();return yield fetch(this.clientApiBaseUrl+r+new URLSearchParams(n),{headers:ge(he({},this.headers),{Authorization:"Bearer "+i}),method:"DELETE"})}));o(this,"constructAssetsUrl",t=>this.environment==="dev"?`https://storage.googleapis.com/client_images_cms_fans-united-dev/${this.clientId}/${t}`:this.environment==="staging"?`https://storage.googleapis.com/client_images_cms_fans-united-stage/${this.clientId}/${t}`:`https://uploads.fansunitedassets.com/${this.clientId}/${t}`);o(this,"throwErrorFromXmlResponse",t=>{const r=new window.DOMParser().parseFromString(t,"text/xml"),n=r.getElementsByTagName("Message")&&r.getElementsByTagName("Code").length>0?r.getElementsByTagName("Message")[0].textContent:"",i=r.getElementsByTagName("Details")&&r.getElementsByTagName("Code").length>0?r.getElementsByTagName("Details")[0].textContent:"";throw new Error(n+" "+i)});o(this,"getToken",()=>C(this,null,function*(){const t=bo(this.environment).currentUser;return t?yield t.getIdToken():""}));this.apiKey=t.apiKey,this.clientId=t.clientId,this.environment=t.environment,this.mainQueryParams={key:t.apiKey,client_id:t.clientId},this.sportal365Config=r,this.clientApiBaseUrl=XO(this.environment)}}const eP=e=>e==="dev"?"http://localhost:8060/v1":e==="staging"?"https://loyalty.fansunitedstagingapi.com/v1":e==="watg"?"https://loyalty.watg.fansunitedapi.com/v1":"https://loyalty.fansunitedapi.com/v1",tP=e=>e==="dev"?"http://localhost:8040/v1":e==="staging"?"https://prediction.fansunitedstagingapi.com/v1":e==="watg"?"https://prediction.watg.fansunitedapi.com/v1":"https://prediction.fansunitedapi.com/v1",rP=e=>e==="dev"?"http://localhost:9040/v1":e==="staging"?"https://mini-games.fansunitedstagingapi.com/v1":e==="watg"?"https://mini-games.watg.fansunitedapi.com/v1":"https://mini-games.fansunitedapi.com/v1";class nP extends ZO{constructor(r,n){super(r,n);o(this,"loyaltyBaseUrl","");o(this,"predictionBaseUrl","");o(this,"miniGamesApiBaseUrl","");o(this,"createTemplate",r=>C(this,null,function*(){const n="/leaderboard/templates?",i=yield this.getToken();return yield fetch(this.loyaltyBaseUrl+n+new URLSearchParams(this.mainQueryParams),{headers:ge(he({},this.headers),{Authorization:"Bearer "+i}),method:"POST",body:JSON.stringify(r)})}));o(this,"editTemplate",(r,n)=>C(this,null,function*(){const i=`/leaderboard/templates/${r}?`,a=yield this.getToken();return yield fetch(this.loyaltyBaseUrl+i+new URLSearchParams(this.mainQueryParams),{headers:ge(he({},this.headers),{Authorization:"Bearer "+a}),method:"PUT",body:JSON.stringify(n)})}));o(this,"deleteTemplate",r=>C(this,null,function*(){const n=`/leaderboard/templates/${r}?`,i=yield this.getToken();return yield fetch(this.loyaltyBaseUrl+n+new URLSearchParams(this.mainQueryParams),{headers:ge(he({},this.headers),{Authorization:"Bearer "+i}),method:"DELETE"})}));o(this,"setWinners",r=>C(this,null,function*(){const n="/winners?",i=yield this.getToken();return yield fetch(this.predictionBaseUrl+n+new URLSearchParams(this.mainQueryParams),{headers:ge(he({},this.headers),{Authorization:"Bearer "+i}),method:"POST",body:JSON.stringify(r)})}));o(this,"exportDetailedLeaderboard",(r,n)=>C(this,null,function*(){const i=`/leaderboard/${r}/detailed?`,a=yield this.getToken();return yield fetch(this.loyaltyBaseUrl+i+new URLSearchParams(ge(he({},this.mainQueryParams),{limit:n.toString()})),{headers:ge(he({},this.headers),{Authorization:"Bearer "+a})})}));o(this,"exportDetailedGameLeaderboard",(r,n)=>C(this,null,function*(){const i=`/leaderboard/games/${r}/detailed?`,a=yield this.getToken();return yield fetch(this.loyaltyBaseUrl+i+new URLSearchParams(ge(he({},this.mainQueryParams),{limit:n.toString()})),{headers:ge(he({},this.headers),{Authorization:"Bearer "+a})})}));o(this,"createGame",r=>C(this,null,function*(){const n="/games?",i=yield this.getToken();return yield fetch(this.predictionBaseUrl+n+new URLSearchParams(this.mainQueryParams),{headers:ge(he({},this.headers),{Authorization:"Bearer "+i}),method:"POST",body:JSON.stringify(r)})}));o(this,"editGame",(r,n)=>C(this,null,function*(){const i=`/games/${r}?`,a=yield this.getToken();return yield fetch(this.predictionBaseUrl+i+new URLSearchParams(this.mainQueryParams),{headers:ge(he({},this.headers),{Authorization:"Bearer "+a}),method:"PATCH",body:JSON.stringify(n)})}));o(this,"getClassicQuizFeature",()=>C(this,null,function*(){const r=`/clients/${this.clientId}/features/classic_quiz?`,n={key:this.apiKey};return yield fetch(this.clientApiBaseUrl+r+new URLSearchParams(n))}));o(this,"getEitherOrFeature",()=>C(this,null,function*(){const r=`/clients/${this.clientId}/features/either_or?`,n={key:this.apiKey};return yield fetch(this.clientApiBaseUrl+r+new URLSearchParams(n))}));o(this,"createClassicQuiz",r=>C(this,null,function*(){const n="/classic-quizzes?",i=yield this.getToken();return yield fetch(this.miniGamesApiBaseUrl+n+new URLSearchParams(this.mainQueryParams),{headers:ge(he({},this.headers),{Authorization:"Bearer "+i}),method:"POST",body:JSON.stringify(r)})}));o(this,"updateClassicQuiz",(r,n)=>C(this,null,function*(){const i=`/classic-quizzes/${r}?`,a=yield this.getToken();return yield fetch(this.miniGamesApiBaseUrl+i+new URLSearchParams(this.mainQueryParams),{headers:ge(he({},this.headers),{Authorization:"Bearer "+a}),method:"PUT",body:JSON.stringify(n)})}));o(this,"getClassicQuizById",r=>C(this,null,function*(){const n=`/classic-quizzes/${r}/staff?`,i=yield this.getToken();return yield fetch(this.miniGamesApiBaseUrl+n+new URLSearchParams(this.mainQueryParams),{headers:ge(he({},this.headers),{Authorization:"Bearer "+i})})}));o(this,"deleteClassicQuiz",r=>C(this,null,function*(){const n=`/classic-quizzes/${r}?`,i=yield this.getToken();return yield fetch(this.miniGamesApiBaseUrl+n+new URLSearchParams(this.mainQueryParams),{headers:ge(he({},this.headers),{Authorization:"Bearer "+i}),method:"DELETE"})}));o(this,"calculateQuestionsReport",r=>C(this,null,function*(){const n=`/classic-quizzes/${r}/questions-report?`,i=yield this.getToken();return yield fetch(this.miniGamesApiBaseUrl+n+new URLSearchParams(this.mainQueryParams),{headers:ge(he({},this.headers),{Authorization:"Bearer "+i}),method:"POST"})}));this.loyaltyBaseUrl=eP(r.environment),this.predictionBaseUrl=tP(r.environment),this.miniGamesApiBaseUrl=rP(r.environment)}}var iP=Object.create,_d=Object.defineProperty,aP=Object.getOwnPropertyDescriptor,oP=Object.getOwnPropertyNames,sP=Object.getPrototypeOf,lP=Object.prototype.hasOwnProperty,cP=(e,t,r)=>t in e?_d(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,el=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),uP=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of oP(t))!lP.call(e,i)&&i!==r&&_d(e,i,{get:()=>t[i],enumerable:!(n=aP(t,i))||n.enumerable});return e},dP=(e,t,r)=>(r=e!=null?iP(sP(e)):{},uP(!e||!e.__esModule?_d(r,"default",{value:e,enumerable:!0}):r,e)),En=(e,t,r)=>(cP(e,typeof t!="symbol"?t+"":t,r),r),fP=el((e,t)=>{var r=function(){function n(p,g){return g!=null&&p instanceof g}var i;try{i=Map}catch(p){i=function(){}}var a;try{a=Set}catch(p){a=function(){}}var s;try{s=Promise}catch(p){s=function(){}}function l(p,g,m,y,b){typeof g=="object"&&(m=g.depth,y=g.prototype,b=g.includeNonEnumerable,g=g.circular);var v=[],w=[],_=typeof Buffer<"u";typeof g>"u"&&(g=!0),typeof m>"u"&&(m=1/0);function x(S,T){if(S===null)return null;if(T===0)return S;var E,k;if(typeof S!="object")return S;if(n(S,i))E=new i;else if(n(S,a))E=new a;else if(n(S,s))E=new s(function(W,V){S.then(function(U){W(x(U,T-1))},function(U){V(x(U,T-1))})});else if(l.__isArray(S))E=[];else if(l.__isRegExp(S))E=new RegExp(S.source,h(S)),S.lastIndex&&(E.lastIndex=S.lastIndex);else if(l.__isDate(S))E=new Date(S.getTime());else{if(_&&Buffer.isBuffer(S))return Buffer.allocUnsafe?E=Buffer.allocUnsafe(S.length):E=new Buffer(S.length),S.copy(E),E;n(S,Error)?E=Object.create(S):typeof y>"u"?(k=Object.getPrototypeOf(S),E=Object.create(k)):(E=Object.create(y),k=y)}if(g){var O=v.indexOf(S);if(O!=-1)return w[O];v.push(S),w.push(E)}n(S,i)&&S.forEach(function(W,V){var U=x(V,T-1),P=x(W,T-1);E.set(U,P)}),n(S,a)&&S.forEach(function(W){var V=x(W,T-1);E.add(V)});for(var A in S){var R;k&&(R=Object.getOwnPropertyDescriptor(k,A)),!(R&&R.set==null)&&(E[A]=x(S[A],T-1))}if(Object.getOwnPropertySymbols)for(var D=Object.getOwnPropertySymbols(S),A=0;A<D.length;A++){var N=D[A],F=Object.getOwnPropertyDescriptor(S,N);F&&!F.enumerable&&!b||(E[N]=x(S[N],T-1),F.enumerable||Object.defineProperty(E,N,{enumerable:!1}))}if(b)for(var $=Object.getOwnPropertyNames(S),A=0;A<$.length;A++){var j=$[A],F=Object.getOwnPropertyDescriptor(S,j);F&&F.enumerable||(E[j]=x(S[j],T-1),Object.defineProperty(E,j,{enumerable:!1}))}return E}return x(p,m)}l.clonePrototype=function(p){if(p===null)return null;var g=function(){};return g.prototype=p,new g};function c(p){return Object.prototype.toString.call(p)}l.__objToStr=c;function u(p){return typeof p=="object"&&c(p)==="[object Date]"}l.__isDate=u;function d(p){return typeof p=="object"&&c(p)==="[object Array]"}l.__isArray=d;function f(p){return typeof p=="object"&&c(p)==="[object RegExp]"}l.__isRegExp=f;function h(p){var g="";return p.global&&(g+="g"),p.ignoreCase&&(g+="i"),p.multiline&&(g+="m"),g}return l.__getRegExpFlags=h,l}();typeof t=="object"&&t.exports&&(t.exports=r)}),hP=el((e,t)=>{var r=typeof Reflect=="object"?Reflect:null,n=r&&typeof r.apply=="function"?r.apply:function(S,T,E){return Function.prototype.apply.call(S,T,E)},i;r&&typeof r.ownKeys=="function"?i=r.ownKeys:Object.getOwnPropertySymbols?i=function(S){return Object.getOwnPropertyNames(S).concat(Object.getOwnPropertySymbols(S))}:i=function(S){return Object.getOwnPropertyNames(S)};function a(S){console&&console.warn&&console.warn(S)}var s=Number.isNaN||function(S){return S!==S};function l(){l.init.call(this)}t.exports=l,t.exports.once=w,l.EventEmitter=l,l.prototype._events=void 0,l.prototype._eventsCount=0,l.prototype._maxListeners=void 0;var c=10;function u(S){if(typeof S!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof S)}Object.defineProperty(l,"defaultMaxListeners",{enumerable:!0,get:function(){return c},set:function(S){if(typeof S!="number"||S<0||s(S))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+S+".");c=S}}),l.init=function(){(this._events===void 0||this._events===Object.getPrototypeOf(this)._events)&&(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},l.prototype.setMaxListeners=function(S){if(typeof S!="number"||S<0||s(S))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+S+".");return this._maxListeners=S,this};function d(S){return S._maxListeners===void 0?l.defaultMaxListeners:S._maxListeners}l.prototype.getMaxListeners=function(){return d(this)},l.prototype.emit=function(S){for(var T=[],E=1;E<arguments.length;E++)T.push(arguments[E]);var k=S==="error",O=this._events;if(O!==void 0)k=k&&O.error===void 0;else if(!k)return!1;if(k){var A;if(T.length>0&&(A=T[0]),A instanceof Error)throw A;var R=new Error("Unhandled error."+(A?" ("+A.message+")":""));throw R.context=A,R}var D=O[S];if(D===void 0)return!1;if(typeof D=="function")n(D,this,T);else for(var N=D.length,F=y(D,N),E=0;E<N;++E)n(F[E],this,T);return!0};function f(S,T,E,k){var O,A,R;if(u(E),A=S._events,A===void 0?(A=S._events=Object.create(null),S._eventsCount=0):(A.newListener!==void 0&&(S.emit("newListener",T,E.listener?E.listener:E),A=S._events),R=A[T]),R===void 0)R=A[T]=E,++S._eventsCount;else if(typeof R=="function"?R=A[T]=k?[E,R]:[R,E]:k?R.unshift(E):R.push(E),O=d(S),O>0&&R.length>O&&!R.warned){R.warned=!0;var D=new Error("Possible EventEmitter memory leak detected. "+R.length+" "+String(T)+" listeners added. Use emitter.setMaxListeners() to increase limit");D.name="MaxListenersExceededWarning",D.emitter=S,D.type=T,D.count=R.length,a(D)}return S}l.prototype.addListener=function(S,T){return f(this,S,T,!1)},l.prototype.on=l.prototype.addListener,l.prototype.prependListener=function(S,T){return f(this,S,T,!0)};function h(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length===0?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function p(S,T,E){var k={fired:!1,wrapFn:void 0,target:S,type:T,listener:E},O=h.bind(k);return O.listener=E,k.wrapFn=O,O}l.prototype.once=function(S,T){return u(T),this.on(S,p(this,S,T)),this},l.prototype.prependOnceListener=function(S,T){return u(T),this.prependListener(S,p(this,S,T)),this},l.prototype.removeListener=function(S,T){var E,k,O,A,R;if(u(T),k=this._events,k===void 0)return this;if(E=k[S],E===void 0)return this;if(E===T||E.listener===T)--this._eventsCount===0?this._events=Object.create(null):(delete k[S],k.removeListener&&this.emit("removeListener",S,E.listener||T));else if(typeof E!="function"){for(O=-1,A=E.length-1;A>=0;A--)if(E[A]===T||E[A].listener===T){R=E[A].listener,O=A;break}if(O<0)return this;O===0?E.shift():b(E,O),E.length===1&&(k[S]=E[0]),k.removeListener!==void 0&&this.emit("removeListener",S,R||T)}return this},l.prototype.off=l.prototype.removeListener,l.prototype.removeAllListeners=function(S){var T,E,k;if(E=this._events,E===void 0)return this;if(E.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):E[S]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete E[S]),this;if(arguments.length===0){var O=Object.keys(E),A;for(k=0;k<O.length;++k)A=O[k],A!=="removeListener"&&this.removeAllListeners(A);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if(T=E[S],typeof T=="function")this.removeListener(S,T);else if(T!==void 0)for(k=T.length-1;k>=0;k--)this.removeListener(S,T[k]);return this};function g(S,T,E){var k=S._events;if(k===void 0)return[];var O=k[T];return O===void 0?[]:typeof O=="function"?E?[O.listener||O]:[O]:E?v(O):y(O,O.length)}l.prototype.listeners=function(S){return g(this,S,!0)},l.prototype.rawListeners=function(S){return g(this,S,!1)},l.listenerCount=function(S,T){return typeof S.listenerCount=="function"?S.listenerCount(T):m.call(S,T)},l.prototype.listenerCount=m;function m(S){var T=this._events;if(T!==void 0){var E=T[S];if(typeof E=="function")return 1;if(E!==void 0)return E.length}return 0}l.prototype.eventNames=function(){return this._eventsCount>0?i(this._events):[]};function y(S,T){for(var E=new Array(T),k=0;k<T;++k)E[k]=S[k];return E}function b(S,T){for(;T+1<S.length;T++)S[T]=S[T+1];S.pop()}function v(S){for(var T=new Array(S.length),E=0;E<T.length;++E)T[E]=S[E].listener||S[E];return T}function w(S,T){return new Promise(function(E,k){function O(R){S.removeListener(T,A),k(R)}function A(){typeof S.removeListener=="function"&&S.removeListener("error",O),E([].slice.call(arguments))}x(S,T,A,{once:!0}),T!=="error"&&_(S,O,{once:!0})})}function _(S,T,E){typeof S.on=="function"&&x(S,"error",T,E)}function x(S,T,E,k){if(typeof S.on=="function")k.once?S.once(T,E):S.on(T,E);else if(typeof S.addEventListener=="function")S.addEventListener(T,function O(A){k.once&&S.removeEventListener(T,O),E(A)});else throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof S)}}),pP=el((e,t)=>{(function(){var r,n,i=[].splice,a=function(l,c){if(!(l instanceof c))throw new Error("Bound instance method accessed before binding")},s=[].indexOf;n=fP(),r=hP().EventEmitter,t.exports=function(){class l extends r{constructor(u={}){super(),this.get=this.get.bind(this),this.mget=this.mget.bind(this),this.set=this.set.bind(this),this.mset=this.mset.bind(this),this.del=this.del.bind(this),this.take=this.take.bind(this),this.ttl=this.ttl.bind(this),this.getTtl=this.getTtl.bind(this),this.keys=this.keys.bind(this),this.has=this.has.bind(this),this.getStats=this.getStats.bind(this),this.flushAll=this.flushAll.bind(this),this.flushStats=this.flushStats.bind(this),this.close=this.close.bind(this),this._checkData=this._checkData.bind(this),this._check=this._check.bind(this),this._isInvalidKey=this._isInvalidKey.bind(this),this._wrap=this._wrap.bind(this),this._getValLength=this._getValLength.bind(this),this._error=this._error.bind(this),this._initErrors=this._initErrors.bind(this),this.options=u,this._initErrors(),this.data={},this.options=Object.assign({forceString:!1,objectValueSize:80,promiseValueSize:80,arrayValueSize:40,stdTTL:0,checkperiod:600,useClones:!0,deleteOnExpire:!0,enableLegacyCallbacks:!1,maxKeys:-1},this.options),this.options.enableLegacyCallbacks&&(console.warn("WARNING! node-cache legacy callback support will drop in v6.x"),["get","mget","set","del","ttl","getTtl","keys","has"].forEach(d=>{var f;f=this[d],this[d]=function(...h){var p,g,m,y;if(m=h,[...h]=m,[p]=i.call(h,-1),typeof p=="function")try{y=f(...h),p(null,y)}catch(b){g=b,p(g)}else return f(...h,p)}})),this.stats={hits:0,misses:0,keys:0,ksize:0,vsize:0},this.validKeyTypes=["string","number"],this._checkData()}get(u){var d,f;if(a(this,l),(f=this._isInvalidKey(u))!=null)throw f;if(this.data[u]!=null&&this._check(u,this.data[u]))return this.stats.hits++,d=this._unwrap(this.data[u]),d;this.stats.misses++}mget(u){var d,f,h,p,g,m;if(a(this,l),!Array.isArray(u))throw d=this._error("EKEYSTYPE"),d;for(m={},h=0,g=u.length;h<g;h++){if(p=u[h],(f=this._isInvalidKey(p))!=null)throw f;this.data[p]!=null&&this._check(p,this.data[p])?(this.stats.hits++,m[p]=this._unwrap(this.data[p])):this.stats.misses++}return m}set(u,d,f){var h,p,g;if(a(this,l),this.options.maxKeys>-1&&this.stats.keys>=this.options.maxKeys)throw h=this._error("ECACHEFULL"),h;if(this.options.forceString&&!1==="string"&&(d=JSON.stringify(d)),f==null&&(f=this.options.stdTTL),(p=this._isInvalidKey(u))!=null)throw p;return g=!1,this.data[u]&&(g=!0,this.stats.vsize-=this._getValLength(this._unwrap(this.data[u],!1))),this.data[u]=this._wrap(d,f),this.stats.vsize+=this._getValLength(d),g||(this.stats.ksize+=this._getKeyLength(u),this.stats.keys++),this.emit("set",u,d),!0}mset(u){var d,f,h,p,g,m,y,b,v,w;if(a(this,l),this.options.maxKeys>-1&&this.stats.keys+u.length>=this.options.maxKeys)throw d=this._error("ECACHEFULL"),d;for(h=0,y=u.length;h<y;h++){if(m=u[h],{key:g,val:w,ttl:v}=m,v&&typeof v!="number")throw d=this._error("ETTLTYPE"),d;if((f=this._isInvalidKey(g))!=null)throw f}for(p=0,b=u.length;p<b;p++)m=u[p],{key:g,val:w,ttl:v}=m,this.set(g,w,v);return!0}del(u){var d,f,h,p,g,m;for(a(this,l),Array.isArray(u)||(u=[u]),d=0,h=0,g=u.length;h<g;h++){if(p=u[h],(f=this._isInvalidKey(p))!=null)throw f;this.data[p]!=null&&(this.stats.vsize-=this._getValLength(this._unwrap(this.data[p],!1)),this.stats.ksize-=this._getKeyLength(p),this.stats.keys--,d++,m=this.data[p],delete this.data[p],this.emit("del",p,m.v))}return d}take(u){var d;return a(this,l),d=this.get(u),d!=null&&this.del(u),d}ttl(u,d){var f;if(a(this,l),d||(d=this.options.stdTTL),!u)return!1;if((f=this._isInvalidKey(u))!=null)throw f;return this.data[u]!=null&&this._check(u,this.data[u])?(d>=0?this.data[u]=this._wrap(this.data[u].v,d,!1):this.del(u),!0):!1}getTtl(u){var d,f;if(a(this,l),!!u){if((f=this._isInvalidKey(u))!=null)throw f;if(this.data[u]!=null&&this._check(u,this.data[u]))return d=this.data[u].t,d}}keys(){var u;return a(this,l),u=Object.keys(this.data),u}has(u){var d;return a(this,l),d=this.data[u]!=null&&this._check(u,this.data[u]),d}getStats(){return a(this,l),this.stats}flushAll(u=!0){a(this,l),this.data={},this.stats={hits:0,misses:0,keys:0,ksize:0,vsize:0},this._killCheckPeriod(),this._checkData(u),this.emit("flush")}flushStats(){a(this,l),this.stats={hits:0,misses:0,keys:0,ksize:0,vsize:0},this.emit("flush_stats")}close(){a(this,l),this._killCheckPeriod()}_checkData(u=!0){var d,f,h;a(this,l),f=this.data;for(d in f)h=f[d],this._check(d,h);u&&this.options.checkperiod>0&&(this.checkTimeout=setTimeout(this._checkData,this.options.checkperiod*1e3,u),this.checkTimeout!=null&&this.checkTimeout.unref!=null&&this.checkTimeout.unref())}_killCheckPeriod(){if(this.checkTimeout!=null)return clearTimeout(this.checkTimeout)}_check(u,d){var f;return a(this,l),f=!0,d.t!==0&&d.t<Date.now()&&(this.options.deleteOnExpire&&(f=!1,this.del(u)),this.emit("expired",u,this._unwrap(d))),f}_isInvalidKey(u){var d;if(a(this,l),d=typeof u,s.call(this.validKeyTypes,d)<0)return this._error("EKEYTYPE",{type:typeof u})}_wrap(u,d,f=!0){var h,p,g;return a(this,l),this.options.useClones||(f=!1),p=Date.now(),h=0,g=1e3,d===0?h=0:d?h=p+d*g:this.options.stdTTL===0?h=this.options.stdTTL:h=p+this.options.stdTTL*g,{t:h,v:f?n(u):u}}_unwrap(u,d=!0){return this.options.useClones||(d=!1),u.v!=null?d?n(u.v):u.v:null}_getKeyLength(u){return u.toString().length}_getValLength(u){return a(this,l),typeof u=="string"?u.length:this.options.forceString?JSON.stringify(u).length:Array.isArray(u)?this.options.arrayValueSize*u.length:typeof u=="number"?8:typeof(u==null?void 0:u.then)=="function"?this.options.promiseValueSize:typeof Buffer<"u"&&Buffer!==null&&Buffer.isBuffer(u)?u.length:u!=null&&typeof u=="object"?this.options.objectValueSize*Object.keys(u).length:typeof u=="boolean"?8:0}_error(u,d={}){var f;return a(this,l),f=new Error,f.name=u,f.errorcode=u,f.message=this.ERRORS[u]!=null?this.ERRORS[u](d):"-",f.data=d,f}_initErrors(){var u,d,f;a(this,l),this.ERRORS={},f=this._ERRORS;for(d in f)u=f[d],this.ERRORS[d]=this.createErrorMessage(u)}createErrorMessage(u){return function(d){return u.replace("__key",d.type)}}}return l.prototype._ERRORS={ENOTFOUND:"Key `__key` not found",ECACHEFULL:"Cache max keys amount exceeded",EKEYTYPE:"The key argument has to be of type `string` or `number`. Found: `__key`",EKEYSTYPE:"The keys argument has to be an array.",ETTLTYPE:"The ttl argument has to be a number."},l}.call(this)}).call(e)}),mP=el((e,t)=>{(function(){var r;r=t.exports=pP(),r.version="5.1.2"}).call(e)}),uv=e=>{let t=200,r=[],n=0;return r[n]=[],e.forEach(i=>{r[n].length<=t-1?r[n].push(i):(n++,r[n]=[i])}),r},wo=(e,t)=>{let r=[];for(;e.length>t;){let n=e.splice(0,t);r.push(n)}return r.push(e),r},Rr=(e,t)=>{let r="";return e==="prod"?r={profile:"https://profile.fansunitedapi.com/v1",football:"https://football.fansunitedapi.com/v1",idMapping:"https://id-mapping.fansunitedapi.com/v1",predictor:"https://prediction.fansunitedapi.com/v1",client:"https://client.fansunitedapi.com/v1",loyalty:"https://loyalty.fansunitedapi.com/v1",miniGames:"https://mini-games.fansunitedapi.com/v1",discussions:"https://discussions.fansunitedapi.com/v1",privateLeagues:"https://private-leagues.fansunitedapi.com/v1",voting:"https://voting.fansunitedapi.com/v1"}[t]:e==="dev"?r={profile:"http://localhost:8010/v1",football:"http://localhost:8080/v1",idMapping:"http://localhost:8030/v1",predictor:"http://localhost:8040/v1",client:"http://localhost:8070/v1",loyalty:"http://localhost:8060/v1",miniGames:"http://localhost:9040/v1",discussions:"http://localhost:9020/v1",privateLeagues:"http://localhost:9010/v1",voting:"http://localhost:9030/v1"}[t]:e==="watg"?r={profile:"https://profile.watg.fansunitedapi.com/v1",football:"https://football.watg.fansunitedapi.com/v1",idMapping:"https://id-mapping.watg.fansunitedapi.com/v1",predictor:"https://prediction.watg.fansunitedapi.com/v1",client:"https://client.watg.fansunitedapi.com/v1",loyalty:"https://loyalty.watg.fansunitedapi.com/v1",miniGames:"https://mini-games.watg.fansunitedapi.com/v1",discussions:"https://discussions.watg.fansunitedapi.com/v1",privateLeagues:"https://private-leagues.watg.fansunitedapi.com/v1",voting:"https://voting.watg.fansunitedapi.com/v1"}[t]:r={profile:"https://profile.fansunitedstagingapi.com/v1",football:"https://football.fansunitedstagingapi.com/v1",idMapping:"https://id-mapping.fansunitedstagingapi.com/v1",predictor:"https://prediction.fansunitedstagingapi.com/v1",client:"https://client.fansunitedstagingapi.com/v1",loyalty:"https://loyalty.fansunitedstagingapi.com/v1",miniGames:"https://mini-games.fansunitedstagingapi.com/v1",discussions:"https://discussions.fansunitedstagingapi.com/v1",privateLeagues:"https://private-leagues.fansunitedstagingapi.com/v1",voting:"https://voting.fansunitedstagingapi.com/v1"}[t],r},tl=e=>Array.from(new Set(e)),ut=e=>e||!1,Ze=()=>`&disable_cache=${Date.now()}`,dv=e=>JSON.parse(JSON.stringify(e.sort((t,r)=>t.localeCompare(r)))),gP=class{constructor(){o(this,"id",null);o(this,"name",null);o(this,"nickname",null);o(this,"avatar",null);o(this,"gender",null);o(this,"country",null);o(this,"birthDate",null);o(this,"verified",!1);o(this,"staffMember",!1);o(this,"interests",[]);o(this,"followingCount",0);o(this,"followersCount",0)}},vP=class{constructor(){o(this,"profilesFromResponse",e=>e?e.map(t=>this.fullProfileFromResponse(t)):null);o(this,"fullProfileFromResponse",e=>{let t=new gP;return t.id=e.id,t.name=e.name,t.nickname=e.nickname,t.avatar=e.avatar,t.gender=e.gender,t.country=e.country,t.birthDate=e.birth_date,t.verified=e.verified,t.staffMember=e.staff_member,t.interests=e.interests?e.interests:[],t.followingCount=e.following_count,t.followersCount=e.followers_count,t})}},rl=class{constructor(){o(this,"nextPageStartsAfter",null);o(this,"itemsPerPage",null)}},di=class{constructor(){o(this,"pagination",new rl)}},_r=class{constructor(){o(this,"meta",new di);o(this,"data",[])}},yP=class{constructor(){o(this,"avatar",null);o(this,"followingId",null);o(this,"name",null);o(this,"nickname",null);o(this,"profileId",null)}},bP=class{constructor(){o(this,"followResponse",e=>e.map(t=>this.remapResponse(t)));o(this,"followingFromResponse",e=>{let t=new _r;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});o(this,"remapResponse",e=>{let t=new yP;return t.avatar=e.avatar,t.followingId=e.following_id,t.name=e.name,t.profileId=e.profile_id,t.nickname=e.nickname,t})}},wP=class{constructor(){o(this,"avatar",null);o(this,"followerId",null);o(this,"name",null);o(this,"nickname",null);o(this,"profileId",null)}},_P=class{constructor(){o(this,"followersFromResponse",e=>{let t=new _r;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});o(this,"remapResponse",e=>{let t=new wP;return t.avatar=e.avatar,t.followerId=e.follower_id,t.name=e.name,t.profileId=e.profile_id,t})}},fv=class{constructor(){o(this,"profile_ids",[])}};function xd(e){this.message=e}xd.prototype=new Error,xd.prototype.name="InvalidCharacterError";var hv=typeof window<"u"&&window.atob&&window.atob.bind(window)||function(e){var t=String(e).replace(/=+$/,"");if(t.length%4==1)throw new xd("'atob' failed: The string to be decoded is not correctly encoded.");for(var r,n,i=0,a=0,s="";n=t.charAt(a++);~n&&(r=i%4?64*r+n:n,i++%4)?s+=String.fromCharCode(255&r>>(-2*i&6)):0)n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(n);return s};function xP(e){var t=e.replace(/-/g,"+").replace(/_/g,"/");switch(t.length%4){case 0:break;case 2:t+="==";break;case 3:t+="=";break;default:throw"Illegal base64url string!"}try{return function(r){return decodeURIComponent(hv(r).replace(/(.)/g,function(n,i){var a=i.charCodeAt(0).toString(16).toUpperCase();return a.length<2&&(a="0"+a),"%"+a}))}(t)}catch(r){return hv(t)}}function nl(e){this.message=e}function CP(e,t){if(typeof e!="string")throw new nl("Invalid token specified");var r=(t=t||{}).header===!0?0:1;try{return JSON.parse(xP(e.split(".")[r]))}catch(n){throw new nl("Invalid token specified: "+n.message)}}nl.prototype=new Error,nl.prototype.name="InvalidTokenError";var pv=CP,cr={native:"id",sportradar:"sportradar_id",sportal365:"sportal365_id",enetpulse:"enetpulse_id",api_football:"api_football_id"},mv={PREDICTOR_USER_RELATED_OPERATION:"https://docs.fansunitedmedia.com/docs/predictor-operations#user-related-operations"},gv=["matchId","matchType","market","prediction"],IP=new Map().set("FT_1X2","fullTimeOneXTwo").set("HT_1X2","halfTimeOneXTwo").set("BOTH_TEAMS_SCORE","bothTeamsScore").set("DOUBLE_CHANCE","doubleChance").set("HT_FT","halfTimeFullTime").set("PLAYER_SCORE","playerScore").set("PLAYER_YELLOW_CARD","playerYellowCard").set("PLAYER_RED_CARD","playerRedCard").set("RED_CARD_MATCH","redCardMatch").set("PENALTY_MATCH","penaltyMatch").set("PLAYER_SCORE_FIRST_GOAL","playerScoreFirstGoal").set("CORNERS_MATCH","cornersMatch").set("CORRECT_SCORE","correctScore").set("CORRECT_SCORE_ADVANCED","correctScoreAdvanced").set("CORRECT_SCORE_HT","correctScoreHalfTime").set("PLAYER_SCORE_HATTRICK","playerScoreHattrick").set("PLAYER_SCORE_TWICE","playerScoreTwice").set("OVER_GOALS_0_5","overZeroPointFiveGoals").set("OVER_GOALS_1_5","overOnePointFiveGoals").set("OVER_GOALS_2_5","overTwoPointFiveGoals").set("OVER_GOALS_3_5","overThreePointFiveGoals").set("OVER_GOALS_4_5","overFourPointFiveGoals").set("OVER_GOALS_5_5","overFivePointFiveGoals").set("OVER_GOALS_6_5","overSixPointFiveGoals").set("OVER_CORNERS_6_5","overSixPointFiveCorners").set("OVER_CORNERS_7_5","overSevenPointFiveCorners").set("OVER_CORNERS_8_5","overEightPointFiveCorners").set("OVER_CORNERS_9_5","overNinePointFiveCorners").set("OVER_CORNERS_10_5","overTenPointFiveCorners").set("OVER_CORNERS_11_5","overElevenPointFiveCorners").set("OVER_CORNERS_12_5","overTwelvePointFiveCorners").set("OVER_CORNERS_13_5","overThirteenPointFiveCorners"),vv={UNEXPECTED_STATUS_PROP:`Unexpected provided property 'status'. You can NOT use this property for this method. For more information visit our documentation:
|
|
2326
2326
|
${mv.PREDICTOR_USER_RELATED_OPERATION}`,UNEXPECTED_TYPE_PROP:`Unexpected provided property 'type'. You can NOT use this property for this method. For more information visit our documentation:
|
|
2327
2327
|
${mv.PREDICTOR_USER_RELATED_OPERATION}`},SP=(e,t)=>`The prediction '${e}' is invalid for market '${t}'. Please check again have you passed appropriate prediction model. For more information please visit our documentation: https://docs.fansunitedmedia.com/sdks/js/match.quiz#gamerelatedoperations`,yv=e=>`The market '${e}' is not supported from Fans United. For more information please visit our documentation: https://docs.fansunitedmedia.com/docs/predictor-operations#make-football-prediction`,TP=e=>`The market '${e}' is not valid for Top X game. The only available market is CORRECT_SCORE.`,EP=e=>`The field/s '${e.length>1?e.join(", "):e[0]}' is/are invalid. For more information please visit our documentation: https://docs.fansunitedmedia.com/docs/javascript-sdk`,AP=(e,t)=>`The following field/s is/are missing from ${e}: '${t.length>1?t.join(", "):t[0]}'. For more information please visit our documentation: https://docs.fansunitedmedia.com/docs/predictor-operations#make-football-prediction`,OP=(e,t)=>`The field ${e} has incorrect type. The correct type is ${t}`,il=class{constructor(e,t){o(this,"data",{error:{code:0,status:"",message:""}});o(this,"status",0);o(this,"statusText","");o(this,"headers",null);o(this,"errorMessage",()=>this.data.error.message);this.data.error.code=t.code,this.data.error.status=t.status,this.data.error.message=t.message,this.status=e.status,this.statusText=e.statusText,this.headers=e.headers}},et=class{constructor(t,r,n){o(this,"error",{code:0,status:"",message:""});this.error.code=t,this.error.status=r,this.error.message=n}},qr=class{constructor(e,t){o(this,"baseUrl",null);o(this,"apiSignInUrl",null);o(this,"jwtToken",null);o(this,"idSchema",null);o(this,"retryRequest",!1);o(this,"headers",null);o(this,"authHeaders",null);o(this,"errorHandlingMode",null);o(this,"configuration",null);o(this,"getJwtToken",()=>this.configuration.authProvider.getIdToken());o(this,"getAuthHeaders",()=>({"Content-Type":"application/json",Authorization:`Bearer ${this.getJwtToken()}`}));o(this,"fetchWithoutAuth",(e,t)=>C(this,null,function*(){let r=yield fetch(this.baseUrl+e,{headers:this.headers}),n=yield r.json();if(!r.ok){let i=this.transformFetchException(r,n);throw console.warn(t,i),i}return n}));o(this,"fetchWithoutAuthAdditionalHeaders",(e,t,r)=>C(this,null,function*(){let n=yield fetch(this.baseUrl+e,{headers:he(he({},this.headers),r)}),i=yield n.json();if(!n.ok){let a=this.transformFetchException(n,i);throw console.warn(t,a),a}return i}));o(this,"fetchWithAuth",(e,t,r,n)=>C(this,null,function*(){this.validateJWTToken();let i=null,a=null;if(r&&n?i=yield fetch(this.baseUrl+e,{method:r,headers:this.getAuthHeaders(),body:JSON.stringify(n)}):r&&!n?i=yield fetch(this.baseUrl+e,{method:r,headers:this.getAuthHeaders()}):i=yield fetch(this.baseUrl+e,{headers:this.getAuthHeaders()}),r!=="DELETE"&&(a=yield i.json()),!i.ok){(i.status===401||i.status===403)&&!this.retryRequest&&(this.retryRequest=!0,yield this.fetchWithAuth(e,t,r,n)),this.retryRequest=!1;let s=this.transformFetchException(i,a||(yield i.json()));throw console.warn(t,s),s}return this.retryRequest=!1,a}));o(this,"fetchWithAuthNewBaseURL",(e,t,r,n,i)=>C(this,null,function*(){this.validateJWTToken();let a=null,s=null;if(n&&i?a=yield fetch(e+t,{method:n,headers:this.getAuthHeaders(),body:JSON.stringify(i)}):n&&!i?a=yield fetch(e+t,{method:n,headers:this.getAuthHeaders()}):a=yield fetch(e+t,{headers:this.getAuthHeaders()}),n!=="DELETE"&&(s=yield a.json()),!a.ok){(a.status===401||a.status===403)&&!this.retryRequest&&(this.retryRequest=!0,yield this.fetchWithAuthNewBaseURL(e,t,r,n,i)),this.retryRequest=!1;let l=this.transformFetchException(a,s||(yield a.json()));throw console.warn(r,l),l}return this.retryRequest=!1,s}));o(this,"transformFetchException",(e,t)=>{if(!t&&e.status===401){if(this.errorHandlingMode==="standard")return new et(401,"unauthorized","Invalid JWT token is provided");let a={code:401,status:"unauthorized",message:"Invalid JWT token is provided"};return new il(e,a)}let{code:r,status:n,message:i}=t.error;return this.errorHandlingMode==="standard"?new et(r,n,i):new il(e,t.error)});o(this,"validateJWTToken",()=>{let e=null;try{e=pv(this.getJwtToken())}catch(t){if(this.errorHandlingMode==="default"){let r={status:401,statusText:t.message,headers:{}},n={code:401,status:"invalid_token",message:"Invalid JWT token is provided"};throw new il(r,n)}else if(this.errorHandlingMode==="standard")throw new et(401,"invalid_token","Invalid JWT token is provided")}if(Date.now()>e.exp*1e3){if(this.errorHandlingMode==="default"){let t={status:401,statusText:"",headers:{}},r={code:401,status:"invalid_token",message:"The provided JWT token is expired"};throw new il(t,r)}else if(this.errorHandlingMode==="standard")throw new et(401,"invalid_token","The provided JWT token is expired")}});this.baseUrl=t,this.configuration=e,this.apiSignInUrl=`?key=${e.apiKey}&client_id=${e.clientId}`,this.errorHandlingMode=e.errorHandlingMode,this.idSchema=e.idSchema,this.headers={"Content-Type":"application/json"}}},PP="/countries",ur="/profile",al="/profiles",bv=class extends qr{constructor(t){super(t,Rr(t.environment,"profile"));o(this,"profileRemapper",null);o(this,"followingRemapper",null);o(this,"followersRemapper",null);o(this,"lang",null);o(this,"limitIds",100);o(this,"getCountries",t=>C(this,null,function*(){let r=`&lang=${this.lang}`,n=`${PP}${this.apiSignInUrl}${r}`,i=Date.now();return t&&(n+=`&disable_cache=${i}`),(yield this.fetchWithoutAuth(n,"There was a problem fetching profile countries")).data}));o(this,"getProfile",t=>C(this,null,function*(){let r=`${ur}${this.apiSignInUrl}`,n="";if(t){r=`${al}/${t}${this.apiSignInUrl}`,n=`There was a problem fetching the following profile: ${t}`;let i=yield this.fetchWithoutAuth(r,n);return this.profileRemapper.fullProfileFromResponse(i.data)}else{n="There was a problem fetching your profile from API";let i=yield this.fetchWithAuth(r,n);return this.profileRemapper.fullProfileFromResponse(i.data)}}));o(this,"getProfiles",(t,r,n)=>C(this,null,function*(){let i=Date.now(),a=`There was a problem fetching the following profiles: ${t.join(",")}`;if(t&&t.length){if(t.length>this.limitIds){let d=[],f=wo(t,this.limitIds);for(let h of f){let p=`${al}${this.apiSignInUrl}&profile_ids=${h.join(",")}`;a=`There was a problem fetching the following profiles: ${h.join(",")}`,n&&(p+=`&disable_cache=${i}`);let g=yield this.fetchWithoutAuth(p,a);d.push(...this.profileRemapper.profilesFromResponse(g.data))}return d}let c=`${al}${this.apiSignInUrl}&profile_ids=${t.join(",")}`;n&&(c+=`&disable_cache=${i}`);let u=yield this.fetchWithoutAuth(c,a);return this.profileRemapper.profilesFromResponse(u.data)}let s=`${al}${this.apiSignInUrl}&search=${r}`;n&&(s+=`&disable_cache=${i}`);let l=yield this.fetchWithoutAuth(s,a);return this.profileRemapper.profilesFromResponse(l.data)}));o(this,"getFollowers",(t,r)=>C(this,null,function*(){let n=`${ur}/followers${this.apiSignInUrl}`,i="There was a problem fetching the followers for own profile";if(t&&!r){n=`${ur}/followers${this.apiSignInUrl}${t.constructFilterUrl()}`;let s=yield this.fetchWithAuth(n,i);return this.followersRemapper.followersFromResponse(s)}else if(!t&&!r){let s=yield this.fetchWithAuth(n,i);return this.followersRemapper.followersFromResponse(s)}t&&r?n=`${ur}/${r}/followers${this.apiSignInUrl}${t.constructFilterUrl()}`:!t&&r&&(n=`${ur}/${r}/followers${this.apiSignInUrl}`),i=`There was a problem fetching the followers for profile: ${r}`;let a=yield this.fetchWithoutAuth(n,i);return this.followersRemapper.followersFromResponse(a)}));o(this,"getFollowing",(t,r)=>C(this,null,function*(){let n=`${ur}/following${this.apiSignInUrl}`,i="There was a problem fetching the followers of own profile";if(t&&!r){n=`${ur}/following${this.apiSignInUrl}${t.constructFilterUrl()}`;let s=yield this.fetchWithAuth(n,i);return this.followingRemapper.followingFromResponse(s)}else if(!t&&!r){let s=yield this.fetchWithAuth(n,i);return this.followingRemapper.followingFromResponse(s)}t&&r?n=`${ur}/${r}/following${this.apiSignInUrl}${t.constructFilterUrl()}`:!t&&r&&(n=`${ur}/${r}/following${this.apiSignInUrl}`),i=`There was a problem fetching the followers of the following profile: ${r}`;let a=yield this.fetchWithoutAuth(n,i);return this.followingRemapper.followingFromResponse(a)}));o(this,"follow",t=>C(this,null,function*(){let r=new fv;r.profile_ids=t;let n=ur+`/follow${this.apiSignInUrl}`,i=`There was a problem with following profiles: ${t.join(",")}`,a="POST",s=yield this.fetchWithAuth(n,i,a,r);return this.followingRemapper.followResponse(s.data)}));o(this,"unfollow",t=>C(this,null,function*(){let r=new fv;r.profile_ids=t;let n=ur+`/follow${this.apiSignInUrl}`,i=`There was a problem with unfollowing profiles: ${t.join(",")}`;return yield this.fetchWithAuth(n,i,"DELETE",r),!0}));o(this,"getBadges",t=>C(this,null,function*(){let r=`${ur}/badges${this.apiSignInUrl}`,n="There was a problem with fetching own badges";return t?(r=`${ur}/${t}/badges${this.apiSignInUrl}`,n="There was a problem with fetching the badges",(yield this.fetchWithoutAuth(r,n)).data):(yield this.fetchWithAuth(r,n)).data}));o(this,"updateProfile",t=>C(this,null,function*(){let r=ur+this.apiSignInUrl,n="There was a problem updating the own profile",i="PATCH",a=yield this.fetchWithAuth(r,n,i,t);return this.profileRemapper.fullProfileFromResponse(a.data)}));this.lang=t.lang,this.profileRemapper=new vP,this.followingRemapper=new bP,this.followersRemapper=new _P}},wv=(e=>(e.NATIVE="native",e.ENETPULSE="enetpulse",e.SPORTRADAR="sportradar",e.SPORTAL_365="sportal365",e.API_FOOTBALL="api_football",e))(wv||{}),_o={player:"players",team:"teams",homeTeam:"teams",awayTeam:"teams",country:"countries",competition:"competitions",match:"matches"},kP=class extends qr{constructor(t){super(t,Rr(t.environment,"idMapping"));o(this,"getEntityById",(t,r)=>C(this,null,function*(){let n=`/football${this.apiSignInUrl}&input_provider=${this.idSchema}&${_o[t]}=${r}`,i=`There was a problem with id mapping request for the following id: ${r}`;return yield this.fetchWithoutAuth(n,i)}));o(this,"getEntityByIdAndSchema",(t,r,n)=>C(this,null,function*(){let i=`/football${this.apiSignInUrl}&input_provider=${n}&${_o[t]}=${r}`,a=`There was a problem with id mapping request for the following id: ${r}`;return yield this.fetchWithoutAuth(i,a)}));o(this,"getEntityIdsByIdsAndSchema",(t,r,n)=>C(this,null,function*(){let i=`/football${this.apiSignInUrl}&input_provider=${n}&${_o[t]}=${r.join(",")}`,a=`There was a problem with id mapping request for the following ids: ${r.join(",")}`;return yield this.fetchWithoutAuth(i,a)}));o(this,"getEntitiesByIds",(t,r,n)=>C(this,null,function*(){r.sort((s,l)=>s.localeCompare(l));let i=uv(r),a=[];for(let s of i){let l=`/football${this.apiSignInUrl}&input_provider=${n}&${_o[t]}=${s.join(",")}`,c=`There was a problem with id mapping request for the following ids :${s.join(",")}`,u=yield this.fetchWithoutAuth(l,c);a=[...a,...u.data]}return a}));o(this,"getEntitiesByIdObjs",(t,r)=>C(this,null,function*(){let n=[],i={},a=[];Object.keys(t).forEach(c=>{n.push.apply(n,t[c])});let s=tl(n),l=uv(s);for(let c of l){let u="";if(Object.keys(t).forEach(d=>{i[d]=[];let f=c.filter(h=>t[d].includes(h));f&&f.length>0&&(i[d]=f)}),Object.keys(i).forEach(d=>{i[d].length>0&&(i[d].sort((f,h)=>f.localeCompare(h)),u+="&",u+=`${_o[d]}=${i[d].join(",")}`)}),u&&u.length>0){let d=`/football${this.apiSignInUrl}&input_provider=${r||"native"}${u}`,f="There was a problem with id mapping request",h=yield this.fetchWithoutAuth(d,f);a.push(h.data)}else a.push([])}return Array.prototype.concat.apply([],a)}));o(this,"getTopEntities",()=>C(this,null,function*(){let t=`/football/top${this.apiSignInUrl}`;return(yield this.fetchWithoutAuth(t,"There was a problem with top id mappings request")).data}))}},Cd="FansUnited",Id={football:{ids:[],countries:[],competitions:[],expirations:{ids:0}},profile:{info:{},statistics:{},badges:null,countries:[],expirations:{profile:0,statistics:0,badges:0}},client:{features:{},expirations:{features:0}}},xo=class{constructor(e){o(this,"idSchema","");o(this,"expirationProfileTimeout",600);o(this,"expirationBadgesTimeout",3600);o(this,"expirationClientFeaturesTimeout",14400);o(this,"expirationFootballIdsTimeout",604800);o(this,"clearData",()=>{this.setData(Id)});o(this,"getEntityById",(e="",t="")=>this.getData().football.ids.find(r=>{let n=cr[this.idSchema];return r&&`${r[n]}`===t&&r.resource===e}));o(this,"getEntity",(e,t,r)=>Array.isArray(e)?this.getData().football.ids.filter(n=>{let i=cr[r];return n&&e.includes(`${n[i]}`)&&n.resource===t}):this.getData().football.ids.find(n=>{let i=cr[r];return n&&`${n[i]}`===e&&n.resource===t}));o(this,"getEntityByNativeId",(e="",t="")=>this.getData().football.ids.find(r=>r&&`${r.id}`===t&&r.resource===e));o(this,"checkForExistingIdObjs",(e,t)=>{let r=cr[t],n={};return Object.keys(e).forEach(i=>{let a=e[i],s=this.getEntity(a,i,t).map(c=>c[r]),l=e[i].filter(c=>!s.includes(c));n[i]=a.map(c=>l.includes(c)?{id:c,exists:!1}:{id:c,exists:!0})}),n});o(this,"getIdsByType",(e,t,r)=>{let n=cr[r],i=cr[t],a={};return Object.keys(e).forEach(s=>{let l=e[s],c=[];this.getData().football.ids.forEach(u=>{l.forEach((d,f)=>{d===u[i]&&s===u.resource&&(c[f]=u[n])})}),a[s]=c}),a});o(this,"addIdMapping",e=>{let t=this.getData();t.football.ids.push(e),this.setData(t)});o(this,"addIdMappings",e=>{let t=this.getData(),r=t.football.ids;r=[...r,...e],t.football.ids=r,this.setData(t)});o(this,"addTopIdMappings",e=>{let t=this.getData();if(t.football.ids.length){let r=JSON.parse(JSON.stringify(t.football.ids));r=r.filter(n=>n.resource!=="match"),e=e.filter(n=>n.resource==="match"),r=[...r,...e],t.football.ids=r}else t.football.ids=e;t.football.expirations.ids=Math.floor(Date.now()/1e3)+this.expirationFootballIdsTimeout,this.setData(t)});o(this,"setOwnProfile",e=>{let t=this.getData();t.profile.info=e,t.profile.expirations.profile=Math.floor(Date.now()/1e3)+this.expirationProfileTimeout,this.setData(t)});o(this,"getOwnProfile",()=>this.getData().profile.info);o(this,"getProfileCountries",()=>this.getData().profile.countries);o(this,"setProfileCountries",e=>{let t=this.getData();t.profile.countries=e,this.setData(t)});o(this,"getProfileStats",()=>this.getData().profile.statistics);o(this,"setProfileStats",e=>{let t=this.getData();t.profile.statistics=e,t.profile.expirations.statistics=Math.floor(Date.now()/1e3)+this.expirationProfileTimeout,this.setData(t)});o(this,"getProfileBadges",()=>this.getData().profile.badges);o(this,"setProfileBadges",e=>{let t=this.getData();t.profile.badges=e,t.profile.expirations.badges=Math.floor(Date.now()/1e3)+this.expirationBadgesTimeout,this.setData(t)});o(this,"getFootballCountries",()=>this.getData().football.countries);o(this,"setFootballCountries",e=>{let t=this.getData();t.football.countries=e,this.setData(t)});o(this,"getCompetitions",e=>{let t=this.getData();return e?e.competitionSearchFilter(t.football.competitions):t.football.competitions});o(this,"setCompetitions",e=>{let t=this.getData(),r=[...t.football.competitions];r.push(...e),t.football.competitions=this.makeCompetitionsUnique(r),this.setData(t)});o(this,"getCompetitionsLength",()=>{let{football:e}=this.getData();return e.competitions.length});o(this,"getClientFeatures",()=>this.getData().client.features);o(this,"setClientFeatures",e=>{let t=this.getData(),r=JSON.parse(JSON.stringify(e));t.client.expirations.features=Math.floor(Date.now()/1e3)+this.expirationClientFeaturesTimeout,t.client.features=r,this.setData(t)});o(this,"deleteClientFeatures",()=>{let e=this.getData(),t=JSON.parse(JSON.stringify(e));t.client={features:{},expirations:{features:0}},this.setData(t)});o(this,"getExpiration",(e,t)=>{this.initialNewSchema(e,"expirations");let r=this.getData();switch(t){case"profile":return r.profile.expirations.profile;case"statistics":return r.profile.expirations.statistics;case"badges":return r.profile.expirations.badges;case"features":return r.client.expirations.features;case"ids":return r.football.expirations.ids}});o(this,"makeCompetitionsUnique",e=>{let t=new Set;return e.filter(r=>{let n=!t.has(r.id);return t.add(r.id),n})});o(this,"getData",()=>(localStorage.getItem(Cd)||this.setData(Id),JSON.parse(localStorage.getItem(Cd))));o(this,"setData",e=>{localStorage.setItem(Cd,JSON.stringify(e))});o(this,"initialNewSchema",(e,t)=>{let r=this.getData();(!r||!r[e]||!r[e][t])&&this.setData(Id)});this.idSchema=e}static getInstance(e){return xo.instance||(xo.instance=new xo(e)),xo.instance}},_v=xo;En(_v,"instance");var RP=dP(mP()),Je=class{constructor(e){o(this,"profileTTL",600);o(this,"clientTTL",14400);o(this,"profileBadgesTTL",3600);o(this,"idMappingsExpiration",0);o(this,"idSchema","");o(this,"clearData",()=>Je.nodeCache.flushAll());o(this,"getEntityById",(e,t)=>{let r=Je.nodeCache.get("ids");return r?r.find(n=>{let i=cr[this.idSchema];return n&&`${n[i]}`===t&&n.resource===e}):null});o(this,"getEntity",(e,t,r)=>{let n=Je.nodeCache.get("ids");return n?Array.isArray(e)?[]:null:Array.isArray(e)?n.filter(i=>{let a=cr[r];return i&&e.includes(`${i[a]}`)&&i.resource===t}):n.find(i=>{let a=cr[r];return i&&`${i[a]}`===e&&i.resource===t})});o(this,"checkForExistingIdObjs",(e,t)=>{let r=cr[t],n={};return Object.keys(e).forEach(i=>{let a=e[i],s=this.getEntity(a,i,t).map(c=>c[r]),l=e[i].filter(c=>!s.includes(c));n[i]=a.map(c=>l.includes(c)?{id:c,exists:!1}:{id:c,exists:!0})}),n});o(this,"getIdsByType",(e,t,r)=>{let n=cr[r],i=cr[t],a=Je.nodeCache.get("ids"),s={};return a?(Object.keys(e).forEach(l=>{let c=e[l],u=[];a.forEach(d=>{c.forEach((f,h)=>{f===d[i]&&l===d.resource&&(u[h]=d[n])})}),s[l]=u}),s):null});o(this,"addIdMapping",e=>{let t=Je.nodeCache.get("ids");t.push(e),Je.nodeCache.set("ids",t)});o(this,"addIdMappings",e=>{let t=Je.nodeCache.get("ids");t=[...t,...e],Je.nodeCache.set("ids",t)});o(this,"addTopIdMappings",e=>{let t=Je.nodeCache.get("ids"),r=604800;if(t){let n=JSON.parse(JSON.stringify(t));n=n.filter(i=>i.resource!=="match"),e=e.filter(i=>i.resource==="match"),n=[...n,...e],Je.nodeCache.set("ids",n)}else Je.nodeCache.set("ids",e);this.idMappingsExpiration=Math.floor(Date.now()/1e3)+r});o(this,"setOwnProfile",e=>Je.nodeCache.set("profile",e,this.profileTTL));o(this,"getOwnProfile",()=>Je.nodeCache.get("profile"));o(this,"getProfileCountries",()=>Je.nodeCache.get("profile_countries"));o(this,"setProfileCountries",e=>Je.nodeCache.set("profile_countries",e));o(this,"getProfileStats",()=>Je.nodeCache.get("profile_stats"));o(this,"setProfileStats",e=>Je.nodeCache.set("profile_stats",e,this.profileTTL));o(this,"getProfileBadges",()=>Je.nodeCache.get("profile_badges"));o(this,"setProfileBadges",e=>{Je.nodeCache.set("profile_badges",e,this.profileBadgesTTL)});o(this,"getFootballCountries",()=>Je.nodeCache.get("football_countries"));o(this,"setFootballCountries",e=>Je.nodeCache.set("football_countries",e));o(this,"getCompetitions",e=>{let t=Je.nodeCache.get("football_competitions");return t?e?e.competitionSearchFilter(t):t:null});o(this,"setCompetitions",e=>Je.nodeCache.set("football_competitions",e));o(this,"getCompetitionsLength",()=>{let e=Je.nodeCache.get("football_competitions");return e?e.length:0});o(this,"getClientFeatures",()=>Je.nodeCache.get("client"));o(this,"setClientFeatures",e=>Je.nodeCache.set("client",e,this.clientTTL));o(this,"deleteClientFeatures",()=>Je.nodeCache.del("client"));o(this,"getExpiration",(e,t)=>{let r=this.getKeyFromExpirationType(t);return r==="ids"?this.idMappingsExpiration:Je.nodeCache.getTtl(r)});o(this,"getKeyFromExpirationType",e=>{switch(e){case"profile":return"profile";case"statistics":return"profile_stats";case"badges":return"profile_badges";case"features":return"client";case"ids":return"ids"}})}static getInstance(e){return Je.instance||(Je.instance=new Je(e),Je.nodeCache.options.useClones=!1),Je.instance}},Sd=Je;En(Sd,"instance"),En(Sd,"nodeCache",new RP.default);var Co=class{constructor(){o(this,"createLocalCacheInstance",e=>typeof window>"u"?Sd.getInstance(e):_v.getInstance(e))}},MP=class{constructor(e){o(this,"localCache",null);o(this,"https",null);o(this,"getEntitiesByIds",(e,t,r)=>C(this,null,function*(){yield this.setTopIdMappings();try{let n=this.localCache.checkForExistingIdObjs(e,t),i=this.splitForRequestAndExisting(n),a=yield this.https.getEntitiesByIdObjs(i.request,t);return this.localCache.addIdMappings(a),this.localCache.getIdsByType(e,t,r)}catch(n){return console.warn("There was a problem retrieving the entity ids ",n),Promise.resolve([])}}));o(this,"getEntityById",(e,t,r)=>C(this,null,function*(){let n=this.localCache.getEntity(e,t,r);if(n)return n;let i=yield this.requestEntity(e,t,r);return this.localCache.addIdMappings(i),i&&i.length>0?i[0]:null}));o(this,"splitForRequestAndExisting",e=>{let t={},r={};return Object.keys(e).forEach(n=>{t[n]=e[n].filter(i=>!i.exists).map(i=>i.id),r[n]=e[n].filter(i=>i.exists).map(i=>i.id)}),{existing:r,request:t}});o(this,"requestEntity",(e,t,r)=>C(this,null,function*(){try{return e=Array.isArray(e)?e:[e],yield this.https.getEntitiesByIds(t,e,r)}catch(n){return console.warn(`There was a problem retrieving the requested entity: ${n}`),null}}));o(this,"setTopIdMappings",()=>C(this,null,function*(){let e=Math.floor(Date.now()/1e3);if(this.localCache.getExpiration("football","ids")>e)return Promise.resolve();let t=yield this.https.getTopEntities();this.localCache.addTopIdMappings(t)}));this.localCache=new Co().createLocalCacheInstance(e.idSchema),this.https=new kP(e)}},xv=e=>{switch(e){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 e}},DP=class{constructor(){o(this,"extractedObjIds",{});o(this,"traverse",(e,t)=>(t=xv(t),Array.isArray(e)?this.traverseArrExtract(e,t):e&&typeof e=="object"&&this.traverseObjExtract(e,t),this.extractedObjIds));o(this,"traverseArrExtract",(e,t)=>{e&&e.length>0&&e.forEach(r=>{this.traverseObjExtract(r,t)})});o(this,"traverseObjExtract",(e,t)=>{e&&Object.keys(e).length>0&&Object.keys(e).forEach(r=>{let n=e[r];r==="id"||r==="teamId"?(this.extractedObjIds.hasOwnProperty(t)||(this.extractedObjIds[t]=[]),n&&this.extractedObjIds[t].push(n)):e[r]&&this.traverse(e[r],r)})})}},LP=class{constructor(){o(this,"replaceObjIdsIndex",null);o(this,"remappedIdsObj",{});o(this,"traverse",(e,t,r)=>(t=xv(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));o(this,"initReplaceObjIdsIndex",e=>{this.replaceObjIdsIndex={},Object.keys(e).forEach(t=>{this.replaceObjIdsIndex[t]=0})});o(this,"traverseArrReplace",(e,t)=>{e&&e.length>0&&e.forEach(r=>{this.traverseObjReplace(r,t)})});o(this,"traverseObjReplace",(e,t)=>{e&&Object.keys(e).length>0&&Object.keys(e).forEach(r=>{r==="id"||r==="teamId"?e[r]&&(e[r]=this.remappedIdsObj[t][this.replaceObjIdsIndex[t]],this.replaceObjIdsIndex[t]=this.replaceObjIdsIndex[t]+1):e[r]&&this.traverse(e[r],r,this.remappedIdsObj)})})}},dr=class{constructor(e){o(this,"idSchema","");o(this,"idMappingFacade",null);o(this,"getEntityIdBySchemaId",(e,t)=>this.idMappingFacade.getEntityById(t,e,this.idSchema));o(this,"remapEntities",(e,t)=>C(this,null,function*(){let r=JSON.parse(JSON.stringify(e));try{if(this.idSchema!=="native"){let n=new DP().traverse(r,t);return this.idMappingFacade.getEntitiesByIds(n,"native",this.idSchema).then(i=>new LP().traverse(r,t,i))}else return e}catch(n){return console.warn(`There was a problem remapping entity: ${t} with inner entity `,n),[]}}));o(this,"getEntityIdsBySchemaId",(e,t,r)=>C(this,null,function*(){let n={};return n[t]=e,this.idSchema!=="native"?yield this.idMappingFacade.getEntitiesByIds(n,this.idSchema,r):n}));this.idSchema=e.idSchema,this.idMappingFacade=new MP(e)}},sn=class{constructor(t){o(this,"completed",!1);o(this,"percentage");this.percentage=t}},FP=class{constructor(){o(this,"teamFollowed",new sn(10));o(this,"teamFavourite",new sn(15));o(this,"playerFollowed",new sn(10));o(this,"playerFavourite",new sn(10));o(this,"competitionFollowed",new sn(10));o(this,"competitionFavourite",new sn(5));o(this,"addedBirthdate",new sn(10));o(this,"addedGender",new sn(10));o(this,"addedCountry",new sn(10));o(this,"addedAvatar",new sn(10))}},$P=class{constructor(){o(this,"totalPercentage");o(this,"breakdown",new FP)}},Cv=class{constructor(e){o(this,"limit",0);o(this,"startAfter",null);o(this,"constructFilterUrl",()=>{let e="";return this.limit&&(e=e+"&",e=e+`limit=${this.limit}`),this.startAfter&&(e=e+"&",e=e+`start_after=${this.startAfter}`),e});this.limit=e.limit?e.limit:20,this.startAfter=e.startAfter?e.startAfter:null}},ol=class{constructor(e,t,r){o(this,"localCache");o(this,"profileHttps",null);o(this,"activityHttps",null);o(this,"getOwn",()=>C(this,null,function*(){let e=this.getLocalStorageData("profile");if(e&&Object.keys(e).length)return JSON.parse(JSON.stringify(e));try{let t=yield this.profileHttps.getProfile();return this.localCache.setOwnProfile(t),t}catch(t){throw console.warn("There was a problem retrieving your profile: ",t),t}}));o(this,"getOwnProfileFromCache",()=>this.localCache.getOwnProfile());o(this,"updateOwnProfile",()=>C(this,null,function*(){try{let e=yield this.profileHttps.getProfile();return this.localCache.setOwnProfile(e),e}catch(e){throw console.warn("There was a problem retrieving your profile: ",e),e}}));o(this,"getByIds",(e,t,r)=>C(this,null,function*(){if(e&&e.length>0&&t||!e&&e.length===0&&!t)throw new et(400,"invalid_method_call","The method 'getByIds' from Profile namespace is not called correctly. You need to provide 'profileIds' OR 'search' parameters to the method, but you can't use both of them or neither of them.");try{return yield this.profileHttps.getProfiles(e,t,r)}catch(n){throw console.warn(`There was a problem retrieving the selected profiles: ${e.join(",")} `,n),n}}));o(this,"getById",e=>C(this,null,function*(){try{return yield this.profileHttps.getProfile(e)}catch(t){throw console.warn(`There was a problem retrieving the selected profile: ${e} `,t),t}}));o(this,"getCountries",e=>C(this,null,function*(){e=e||!1;let t=this.localCache.getProfileCountries();if(t&&t.length>0)return t;try{let r=yield this.profileHttps.getCountries(e);return this.localCache.setProfileCountries(r),r}catch(r){throw console.warn("There was a problem retrieving profile countries: ",r),r}}));o(this,"getFollowers",(e,t)=>C(this,null,function*(){try{e&&(e=new Cv(e));let r=yield this.profileHttps.getFollowers(e,t),n=r.data.map(i=>i.followerId);if(n.length){let i=yield this.getByIds(n),a=r.data.map(s=>(i.forEach(l=>{s.followerId===l.id&&(s.name=l.name,s.nickname=l.nickname,s.avatar=l.avatar)}),s));return r.data=a,r}return r}catch(r){throw console.warn("There was a problem retrieving your followers: ",r),r}}));o(this,"getFollowing",(e,t)=>C(this,null,function*(){try{e&&(e=new Cv(e));let r=yield this.profileHttps.getFollowing(e,t),n=r.data.map(i=>i.followingId);if(n.length){let i=yield this.getByIds(n),a=r.data.map(s=>(i.forEach(l=>{s.followingId===l.id&&(s.name=l.name,s.nickname=l.nickname,s.avatar=l.avatar)}),s));return r.data=a,r}return r}catch(r){throw console.warn("There was a problem retrieving your following profiles: ",r),r}}));o(this,"follow",e=>C(this,null,function*(){try{return yield this.profileHttps.follow(e)}catch(t){throw console.warn(`There was a problem following profiles: ${e.join(",")} `,t),t}}));o(this,"unfollow",e=>C(this,null,function*(){try{return yield this.profileHttps.unfollow(e)}catch(t){throw console.warn(`There was a problem unfollowing profiles: ${e.join(",")} `,t),t}}));o(this,"showFullnessProfile",e=>{let t=new $P,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(n=>n.type==="team"&&n.favourite)&&(t.breakdown.teamFavourite.completed=!0,r+=t.breakdown.teamFavourite.percentage),e.interests.find(n=>n.type==="team")&&(t.breakdown.teamFollowed.completed=!0,r+=t.breakdown.teamFollowed.percentage),e.interests.find(n=>n.type==="player"&&n.favourite)&&(t.breakdown.playerFavourite.completed=!0,r+=t.breakdown.playerFavourite.percentage),e.interests.find(n=>n.type==="player")&&(t.breakdown.playerFollowed.completed=!0,r+=t.breakdown.playerFollowed.percentage),e.interests.find(n=>n.type==="competition"&&n.favourite)&&(t.breakdown.competitionFavourite.completed=!0,r+=t.breakdown.competitionFavourite.percentage),e.interests.find(n=>n.type==="competition")&&(t.breakdown.competitionFollowed.completed=!0,r+=t.breakdown.competitionFollowed.percentage)),t.totalPercentage=r,t});o(this,"getStats",()=>C(this,null,function*(){let e=this.getLocalStorageData("statistics");if(e&&Object.keys(e).length)return JSON.parse(JSON.stringify(e));try{let t=yield this.activityHttps.getStats();return this.localCache.setProfileStats(t),t}catch(t){throw console.warn("There was a problem retrieving own profile statistics: ",t),t}}));o(this,"getBadges",e=>C(this,null,function*(){if(e)try{return yield this.profileHttps.getBadges()}catch(r){throw console.warn("There was a problem retrieving own profile badges: ",r),r}let t=this.getLocalStorageData("badges");if(t)return t;try{let r=yield this.profileHttps.getBadges();return this.localCache.setProfileBadges(r),r}catch(r){throw console.warn("There was a problem retrieving own profile badges: ",r),r}}));o(this,"clearLocalStorageData",()=>{this.localCache.setOwnProfile({}),this.localCache.setProfileStats({}),this.localCache.setProfileBadges(null)});o(this,"getLocalStorageData",e=>{let t=Math.floor(Date.now()/1e3),r=this.localCache.getExpiration("profile",e);switch(e){case"profile":if(r>t)return this.localCache.getOwnProfile();case"statistics":if(r>t)return this.localCache.getProfileStats();case"badges":if(r>t)return this.localCache.getProfileBadges();default:return null}});this.localCache=e,this.profileHttps=t,this.activityHttps=r}},NP=class{constructor(){o(this,"id",null);o(this,"name",null);o(this,"assets",null)}},BP=class{constructor(){o(this,"extractUpdatedProps",(e,t)=>{let r=["name","nickname","gender","avatar"],n={};return Object.keys(e).forEach(i=>{if(r.includes(i)&&e[i]!==t[i])n[i]=t[i];else if(i==="birthDate")(t[i]===null||e[i]===null&&t[i]||e[i]!==t[i])&&(n.birth_date=t[i]);else if(i==="country")t[i]===null?n.country_id=t[i]:(e[i]===null&&t[i]||e[i].id!==t[i].id)&&(n.country_id=t[i].id);else if(i==="interests"){let a=e[i],s=t[i];s.length&&this.isNewInterest(a,s)?n[i]=this.updateInterests(a,s):(!s.length&&a.length||a.length!==s.length&&!this.isNewInterest(a,s))&&(n[i]=s)}}),n});o(this,"updateInterests",(e,t)=>{if(e.length===t.length){let[r,n]=this.extractSameAndNewInterests(e,t);return[...n,...r]}else return t});o(this,"isNewInterest",(e,t)=>{let r=!1,[n]=this.extractSameAndNewInterests(e,t);return n.length&&(r=!0),r});o(this,"extractSameAndNewInterests",(e,t)=>{let r=t.filter(n=>e.some(i=>n.id===i.id&&n.type===i.type&&n.source===i.source&&n.favourite===i.favourite));return[t.filter(n=>!e.some(i=>n.id===i.id&&n.type===i.type&&n.source===i.source&&n.favourite===i.favourite)),r]});o(this,"isAvatarValidURL",e=>{try{return new URL(e),!0}catch(t){return!1}})}},mt=class extends Error{constructor(r,n,i){super();o(this,"code",0);o(this,"status",null);o(this,"message",null);o(this,"errorMessage",()=>this.message);this.code=r,this.status=n,this.message=i}},jP=class{constructor(e,t,r,n,i){o(this,"idsRemapper",null);o(this,"profileHttps",null);o(this,"profileService",null);o(this,"localCache",null);o(this,"profileFacade",null);o(this,"ownProfile",null);o(this,"modified",!1);o(this,"expireAt",0);o(this,"promises",[]);o(this,"isFetching",!1);o(this,"configuration",null);o(this,"getOwnProfile",()=>C(this,null,function*(){for(;this.isFetching;)console.log("Another thread is fetching profile..."),yield 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.clearAllProfileData(),!this.ownProfile||this.expireAt<e){this.isFetching=!0,this.expireAt=Math.floor(Date.now()/1e3)+600;try{let t=yield this.profileFacade.getOwn();this.setOwnProfile(t)}catch(t){throw this.isFetching=!1,t}return this.modified=!1,this.isFetching=!1,this.ownProfile}return this.ownProfile}));o(this,"delay",e=>new Promise(t=>{setTimeout(t,e)}));o(this,"setOwnProfile",e=>{this.ownProfile=e});o(this,"getInfo",()=>C(this,null,function*(){let e=yield this.getOwnProfile(),t=JSON.parse(JSON.stringify(e));return delete t.interests,t}));o(this,"showInterests",()=>C(this,null,function*(){let e=yield this.getOwnProfile(),t=JSON.parse(JSON.stringify(e));return yield this.idsRemapper.remapInterests(t.interests)}));o(this,"showFullInterests",()=>C(this,null,function*(){let e=yield this.getOwnProfile(),t=JSON.parse(JSON.stringify(e));return yield this.idsRemapper.showFullInterests(t.interests)}));o(this,"getFollowers",e=>C(this,null,function*(){return yield this.profileFacade.getFollowers(e)}));o(this,"getFollowing",e=>C(this,null,function*(){return yield this.profileFacade.getFollowing(e)}));o(this,"follow",e=>C(this,null,function*(){let t=yield this.profileFacade.follow(e),r=yield this.profileFacade.updateOwnProfile();return this.setOwnProfile(r),t}));o(this,"unfollow",e=>C(this,null,function*(){let t=yield this.profileFacade.unfollow(e),r=yield this.profileFacade.updateOwnProfile();return this.setOwnProfile(r),t}));o(this,"getStats",()=>C(this,null,function*(){this.clearAllProfileData();let e=yield this.profileFacade.getStats();return yield this.idsRemapper.remapProfileStats(e)}));o(this,"getBadges",e=>C(this,null,function*(){return this.clearAllProfileData(),yield this.profileFacade.getBadges(e)}));o(this,"addInterestPromise",e=>C(this,null,function*(){this.modified=!0;let t=he({},e);yield this.getOwnProfile();let r=null;e.source!=="custom"?r=yield this.idsRemapper.remapInterestToNative(t):r=t;let n=this.ownProfile.interests.filter(i=>i.id!==r.id||i.type!==r.type||i.source!==r.source);return this.ownProfile.interests=[...n],this.ownProfile.interests.push(r),this}));o(this,"addInterest",e=>(this.promises.push(this.addInterestPromise(e)),this));o(this,"removeInterestPromise",e=>C(this,null,function*(){this.modified=!0;let t=he({},e);yield this.getOwnProfile();let r=null;return e.source!=="custom"?r=yield this.idsRemapper.remapInterestToNative(t):r=t,this.ownProfile.interests=this.ownProfile.interests.filter(n=>n.id!==r.id||n.type!==r.type||n.source!==r.source),this}));o(this,"removeInterest",e=>(this.promises.push(this.removeInterestPromise(e)),this));o(this,"setBirthdatePromise",e=>C(this,null,function*(){return this.modified=!0,yield this.getOwnProfile(),e?this.ownProfile.birthDate=e:this.ownProfile.birthDate=null,this}));o(this,"setBirthdate",e=>(this.promises.push(this.setBirthdatePromise(e)),this));o(this,"setGenderPromise",e=>C(this,null,function*(){return this.modified=!0,yield this.getOwnProfile(),e==="male"||e==="female"?this.ownProfile.gender=e:this.ownProfile.gender="unspecified",this}));o(this,"setGender",e=>(this.promises.push(this.setGenderPromise(e)),this));o(this,"setNicknamePromise",e=>C(this,null,function*(){return this.modified=!0,yield this.getOwnProfile(),this.ownProfile.nickname=e,this}));o(this,"setNickname",e=>(this.promises.push(this.setNicknamePromise(e)),this));o(this,"setNamePromise",e=>C(this,null,function*(){return this.modified=!0,yield this.getOwnProfile(),this.ownProfile.name=e,this}));o(this,"setName",e=>(this.promises.push(this.setNamePromise(e)),this));o(this,"setCountryPromise",e=>C(this,null,function*(){return this.modified=!0,yield this.getOwnProfile(),e&&!this.ownProfile.country?(this.ownProfile.country=new NP,this.ownProfile.country.id=e):e&&this.ownProfile.country?this.ownProfile.country.id=e:this.ownProfile.country=null,this}));o(this,"setCountry",e=>(this.promises.push(this.setCountryPromise(e)),this));o(this,"showFullnessProfile",()=>C(this,null,function*(){let e=yield this.getOwnProfile(),t=JSON.parse(JSON.stringify(e));return this.profileFacade.showFullnessProfile(t)}));o(this,"setAvatarPromise",e=>C(this,null,function*(){if(this.modified=!0,yield this.getOwnProfile(),this.profileService.isAvatarValidURL(e))this.ownProfile.avatar=e;else{if(this.configuration.errorHandlingMode==="default")throw new mt(400,"invalid_avatar","Invalid URL syntax for avatar image.");if(this.configuration.errorHandlingMode==="standard")throw new et(400,"invalid_avatar","Invalid URL syntax for avatar image.")}return this}));o(this,"setAvatar",e=>(this.promises.push(this.setAvatarPromise(e)),this));o(this,"update",()=>C(this,null,function*(){if(this.promises.length===0)return this.ownProfile;yield Promise.all(this.promises);let e=yield this.profileFacade.getOwn(),t=yield this.getOwnProfile(),r=this.profileService.extractUpdatedProps(e,t);if(this.modified=!1,this.expireAt=0,Object.keys(r).length){let i=yield this.profileHttps.updateProfile(r),a=JSON.parse(JSON.stringify(i));return this.setOwnProfile(a),this.localCache.setOwnProfile(a),delete i.interests,i}let n=JSON.parse(JSON.stringify(this.ownProfile));return delete n.interests,n}));o(this,"clearAllProfileData",()=>{this.isNewProfileRequested()&&this.profileFacade.clearLocalStorageData()});o(this,"isNewProfileRequested",()=>{let e=this.extractUserIdFromToken();if(!e)return!1;if(!this.ownProfile){let t=this.profileFacade.getOwnProfileFromCache();return!!(t&&Object.keys(t).length&&t.id!==e)}return this.ownProfile.id!==e});o(this,"extractUserIdFromToken",()=>{var e;try{return((e=pv(this.configuration.authProvider.getIdToken()))==null?void 0:e.sub)||""}catch(t){return console.error(t),""}});this.configuration=e,this.idsRemapper=t,this.localCache=r,this.profileHttps=n,this.profileService=new BP,this.profileFacade=new ol(r,n,i)}},zP=class{constructor(e,t,r,n){o(this,"idsRemapper",null);o(this,"profileHttps",null);o(this,"activityHttps",null);o(this,"profileFacade",null);o(this,"profileId","");o(this,"setId",e=>(this.profileId=e,this));o(this,"getProfile",()=>C(this,null,function*(){return yield this.profileFacade.getById(this.profileId)}));o(this,"getInfo",()=>C(this,null,function*(){let e=yield this.getProfile();return delete e.interests,e}));o(this,"showInterests",()=>C(this,null,function*(){let e=yield this.getProfile(),t=JSON.parse(JSON.stringify(e));return yield this.idsRemapper.remapInterests(t.interests)}));o(this,"showFullInterests",()=>C(this,null,function*(){let e=yield this.getProfile(),t=JSON.parse(JSON.stringify(e));return yield this.idsRemapper.showFullInterests(t.interests)}));o(this,"getFollowers",e=>C(this,null,function*(){return yield this.profileFacade.getFollowers(e,this.profileId)}));o(this,"getFollowing",e=>C(this,null,function*(){return yield this.profileFacade.getFollowing(e,this.profileId)}));o(this,"showFullnessProfile",()=>C(this,null,function*(){let e=yield this.getProfile();return this.profileFacade.showFullnessProfile(e)}));o(this,"getStats",e=>C(this,null,function*(){let t=yield this.activityHttps.getStats(this.profileId,e);return yield this.idsRemapper.remapProfileStats(t)}));o(this,"getBadges",()=>C(this,null,function*(){return yield this.profileHttps.getBadges(this.profileId)}));this.idsRemapper=e,this.profileHttps=r,this.activityHttps=n,this.profileFacade=new ol(t,r,n)}},HP=class{constructor(e,t,r){o(this,"localCache",null);o(this,"https",null);o(this,"idMapping",null);o(this,"getCountriesWithIdMapping",e=>C(this,null,function*(){try{let t=yield this.getCountries(e);return this.idMapping.remapEntities(t,"country")}catch(t){throw console.warn("There was a problem browsing countries as football entities",t),t}}));o(this,"getCountries",e=>C(this,null,function*(){e=e||!1;let t=this.localCache.getFootballCountries();if(t&&t.length>0)return t;try{let r=yield this.https.getCountries(e);return this.localCache.setFootballCountries(r),r}catch(r){throw console.warn("There was a problem retrieving countries as football entities",r),r}}));this.localCache=e,this.idMapping=r,this.https=t}},Iv=class{constructor(e){o(this,"countryId",null);o(this,"name",null);o(this,"gender",null);o(this,"type",null);o(this,"sortField",null);o(this,"sortOrder",null);o(this,"competitionIds",null);o(this,"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&&this.competitionIds.length>0&&(e=e+"&",e=e+`competition_ids=${this.competitionIds.join(",")}`),e});o(this,"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),[]}});o(this,"filter",e=>{let t=this.entitiesToSearchWith();return e.filter(r=>{let n=!0;return t.forEach(i=>{i!=="sortOrder"&&i!=="sortField"&&(i==="countryId"?n&&(n=r.country.id===this[i]):i==="name"?n&&(n=r.name.toLocaleLowerCase().includes(this[i].toLocaleLowerCase())):i==="competitionIds"?n&&(n=this[i].some(a=>r.id===a)):n&&(n=r[i].toLocaleLowerCase()===this[i].toLocaleLowerCase()))}),n})});o(this,"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});o(this,"sort",e=>{let t=[];return this.sortField==="name"?t=e.sort((r,n)=>this.sortOrder&&this.sortOrder==="desc"?n.name.localeCompare(r.name):r.name.localeCompare(n.name)):this.sortField==="country"?t=e.sort((r,n)=>this.sortOrder&&this.sortOrder==="desc"?n.country.name.localeCompare(r.country.name):r.country.name.localeCompare(n.country.name)):this.sortField==="scope"?e.forEach(r=>t[this.competitionIds.indexOf(r.id)]=r):!this.sortField&&this.sortOrder==="desc"&&(t=e.sort((r,n)=>n.id.localeCompare(r.id))),t});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}},UP=class{constructor(e,t,r){o(this,"localStorage",null);o(this,"https",null);o(this,"idMapping",null);o(this,"getCompetitionsIdMapping",(e,t)=>C(this,null,function*(){try{let r=!1;if(e){if(e=new Iv(e),e.countryId){let i=yield this.idMapping.getEntityIdsBySchemaId([`${e.countryId}`],"country","native");i.country.length===0&&(r=!0),e.countryId=i.country[0]}if(e.competitionIds){let i=yield this.idMapping.getEntityIdsBySchemaId(e.competitionIds,"competition","native");i.competition.length===0&&(r=!0),e.competitionIds=i.competition}if(r)return[]}let n=yield this.getCompetitions(e,t);return yield this.idMapping.remapEntities(n,"competition")}catch(r){throw console.warn("There was a problem browsing all of the competitions",r),r}}));o(this,"getCompetitionsMapWithNativeIds",e=>C(this,null,function*(){let t=new Map,r=e.length,n=new Iv({competitionIds:e,limit:r}),i=yield this.getCompetitions(n);i.sort((l,c)=>l.id.localeCompare(c.id));let a=dv(e),s=yield this.idMapping.remapEntities(i,"competition");return a.forEach((l,c)=>t.set(l,s[c])),t}));o(this,"getCompetitions",(e,t)=>C(this,null,function*(){let r=null;if(!this.localStorage.getCompetitionsLength()){try{r=yield this.https.getCompetitions()}catch(n){throw console.warn("There was a problem retrieving all competitions",n),n}this.localStorage.setCompetitions(r)}return this.localStorage.getCompetitions(e)}));o(this,"getCompetitionByIdIdMapping",(e,t)=>C(this,null,function*(){try{let r=(yield this.idMapping.getEntityIdsBySchemaId([e],"competition","native")).competition[0],n=yield this.getCompetitionById(r,t);return yield this.idMapping.remapEntities(n,"competition")}catch(r){throw console.warn(`There was a problem browsing the following competition:${e}`,r),r}}));o(this,"getCompetitionById",(e,t)=>C(this,null,function*(){try{return t=t||!1,yield this.https.getCompetitionById(e,t)}catch(r){throw console.warn(`There was a problem retrieving the competition with the following id: ${e}`,r),r}}));o(this,"getTopCompetitionsIdMapping",e=>C(this,null,function*(){try{let t=yield this.getTopCompetitions(e);return yield this.idMapping.remapEntities(t,"competition")}catch(t){throw console.warn("There was a problem browsing the top competitions",t),t}}));o(this,"getTopCompetitions",e=>C(this,null,function*(){try{return e=e||!1,yield this.https.getTopCompetitions(e)}catch(t){throw console.warn("There was a problem retrieving the top competitions",t),t}}));this.localStorage=e,this.idMapping=r,this.https=t}},Sv=class{constructor(e){o(this,"name",null);o(this,"countryId",null);o(this,"national",!1);o(this,"gender",null);o(this,"limit",null);o(this,"page",null);o(this,"scope",null);o(this,"sortField",null);o(this,"sortOrder",null);o(this,"teamIds",null);o(this,"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&&this.scope.length>0&&(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&&this.teamIds.length>0&&(e=e+"&",e=e+`team_ids=${this.teamIds.join(",")}`),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}},VP=class{constructor(){o(this,"reason","");o(this,"words",[])}},Tv=class{constructor(){o(this,"enabled",!1);o(this,"moderateLinks",!1);o(this,"linksWhitelist",[]);o(this,"moderatorProfileId","");o(this,"dictionary",new VP)}},WP=class{constructor(){o(this,"enabled",!1);o(this,"clientId",null);o(this,"automaticModeration",new Tv)}},Td=class{constructor(){o(this,"points",null);o(this,"gameParticipationCount",null);o(this,"entityId",null);o(this,"entityType",null);o(this,"predictionsMade",null);o(this,"correctPredictions",null)}},qP=class{constructor(){o(this,"id");o(this,"weight");o(this,"multiplier");o(this,"conditions")}},Ev=class{constructor(){o(this,"value",[new qP])}},Av=class{constructor(){o(this,"points",null);o(this,"tiers",null);o(this,"badges",null)}},GP=class{constructor(){o(this,"enabled",!1);o(this,"clientId",null);o(this,"conditions",{list:null});o(this,"actions",new Ev);o(this,"rewards",new Av)}},YP=class{constructor(){o(this,"general",null);o(this,"predictor",null);o(this,"activity",null);o(this,"topX",null);o(this,"matchQuiz",null);o(this,"discussionPost",null)}},Ov=class{constructor(){o(this,"enabled",!1);o(this,"clientId",null);o(this,"defaultMarkets",null);o(this,"competitionsWhitelist",null)}},Pv=class{constructor(){o(this,"enabled",!1);o(this,"clientId",null);o(this,"minFixtures",null);o(this,"maxFixtures",null);o(this,"competitionsWhitelist",null)}},KP=class{constructor(){o(this,"competitions",[]);o(this,"teams",[]);o(this,"markets",[])}},kv=class{constructor(){o(this,"enabled",!1);o(this,"clientId",null);o(this,"fullCoverageCompetitions",null);o(this,"markets",null);o(this,"successRateScopes",new KP);o(this,"userDataConfig",null)}},QP=class{constructor(){o(this,"storeIp",!1);o(this,"storeDeviceId",!1);o(this,"storeAgent",!1)}},JP=class{constructor(){o(this,"potm",[]);o(this,"poll",[])}},XP=class{constructor(){o(this,"predictor",[]);o(this,"topX",[]);o(this,"matchQuiz",[]);o(this,"games",[]);o(this,"football",[]);o(this,"classicQuizzes",[]);o(this,"eitherOr",[]);o(this,"discussions",[]);o(this,"voting",new JP)}},fi=class{constructor(){o(this,"id");o(this,"label");o(this,"description");o(this,"flags");o(this,"assets",{mainImageUrl:""});o(this,"enabled")}},ZP=class{constructor(){o(this,"predictionsNumber");o(this,"correctPredictions");o(this,"points");o(this,"fromDate");o(this,"toDate")}},ek=class extends fi{constructor(){super(...arguments);o(this,"requirements",new ZP)}},tk=class{constructor(){o(this,"participationCount");o(this,"points");o(this,"fromDate");o(this,"toDate")}},rk=class extends fi{constructor(){super(...arguments);o(this,"requirements",new tk)}},nk=class{constructor(){o(this,"participationCount");o(this,"points");o(this,"specificGames");o(this,"fromDate");o(this,"toDate")}},ik=class extends fi{constructor(){super(...arguments);o(this,"requirements",new nk)}},ak=class{constructor(){o(this,"predictionsNumber");o(this,"correctPredictions");o(this,"points");o(this,"entityId");o(this,"entityType");o(this,"entityModel",null)}},ok=class extends fi{constructor(){super(...arguments);o(this,"requirements",new ak)}},sk=class{constructor(){o(this,"participationCount");o(this,"fromDate");o(this,"toDate")}},lk=class extends fi{constructor(){super(...arguments);o(this,"requirements",new sk)}},ck=class{constructor(){o(this,"totalDiscussionPoints");o(this,"postsCount");o(this,"postPoints");o(this,"reactionsCount")}},uk=class extends fi{constructor(){super(...arguments);o(this,"requirements",new ck)}},dk=class{constructor(){o(this,"points");o(this,"voteCount");o(this,"entityId");o(this,"entityType");o(this,"entityModel")}},fk=class extends fi{constructor(){super(...arguments);o(this,"requirements",new dk)}},Rv=class{constructor(){o(this,"points",null);o(this,"tiers",null);o(this,"badges",null)}},hk=class{constructor(){o(this,"enabled",!1);o(this,"clientId",null);o(this,"conditions",{list:null});o(this,"actions",new Ev);o(this,"rewards",new Rv)}},pk=class{constructor(){o(this,"general",[]);o(this,"predictor",[]);o(this,"topX",[]);o(this,"matchQuiz",[])}},mk=class{constructor(){o(this,"id");o(this,"label");o(this,"assets",{mainImageUrl:""});o(this,"enabled");o(this,"requirements",new Td)}},Mv=class extends Td{constructor(){super(...arguments);o(this,"postPoints",null);o(this,"postsCount",null);o(this,"reactionsCount",null);o(this,"totalDiscussionPoints",null)}},gk=class{constructor(){o(this,"id");o(this,"label");o(this,"assets",{mainImageUrl:""});o(this,"enabled");o(this,"requirements",new Mv)}},Dv=class{constructor(){o(this,"assists",null);o(this,"shots",null);o(this,"offsides",null);o(this,"tackles",null);o(this,"saves",null);o(this,"minutesEqualOrOver60",null);o(this,"minutesUnder60",null);o(this,"yellowCards",null);o(this,"redCards",null);o(this,"goalsGoalkeeper",null);o(this,"goalsDefender",null);o(this,"goalsMidfielder",null);o(this,"goalsForwards",null);o(this,"penaltyGoals",null);o(this,"ownGoals",null);o(this,"cleanSheetsGoalkeeper",null);o(this,"cleanSheetsDefender",null);o(this,"cleanSheetsMidfielder",null);o(this,"cleanSheetsForwards",null);o(this,"shotsOn",null);o(this,"foulsCommitted",null);o(this,"penaltyCommitted",null);o(this,"penaltyWon",null);o(this,"penaltyMissed",null);o(this,"concededGoals",null);o(this,"caughtBall",null)}},Lv=class{constructor(){o(this,"total",null);o(this,"minGoalkeepers",null);o(this,"maxGoalkeepers",null);o(this,"minDefenders",null);o(this,"maxDefenders",null);o(this,"minMidfielders",null);o(this,"maxMidfielders",null);o(this,"minStrikers",null);o(this,"maxStrikers",null)}},vk=class{constructor(){o(this,"enabled",!1);o(this,"clientId",null);o(this,"addPointsToProfileTotal",!1);o(this,"coefficients",new Dv);o(this,"players",new Lv);o(this,"competitionsWhitelist",[])}},yk=class{constructor(){o(this,"remapPredictorConfig",e=>{let t=new kv;return t.enabled=e.enabled,t.clientId=e.client_id,t.fullCoverageCompetitions=e.full_coverage_competitions,t.markets=e.markets,t.successRateScopes=e.success_rate_scopes,t.userDataConfig=e.user_data_config?this.remapUserDataConfig(e.user_data_config):null,t});o(this,"remapTopXConfig",e=>{let t=new Pv;return t.enabled=e.enabled,t.clientId=e.client_id,t.minFixtures=e.min_fixtures,t.maxFixtures=e.max_fixtures,t.competitionsWhitelist=e.competitions_whitelist,t});o(this,"remapMatchQuizConfig",e=>{let t=new Ov;return t.enabled=e.enabled,t.clientId=e.client_id,t.defaultMarkets=e.default_markets,t.competitionsWhitelist=e.competitions_whitelist,t});o(this,"remapLoyaltyConfig",e=>{let t=new GP;return t.enabled=e.enabled,t.clientId=e.client_id,t.conditions.list=e.conditions.list,t.actions.value=e.actions.value,t.rewards=this.remapRewards(e.rewards),t});o(this,"remapLoyaltyNewConfig",e=>{let t=new hk;return t.enabled=e.enabled,t.clientId=e.client_id,t.conditions.list=e.conditions.list,t.actions.value=e.actions.value,t.rewards=this.remapNewRewards(e.rewards),t});o(this,"remapDiscussionsConfig",e=>{let t=new WP;return t.enabled=e.enabled,t.clientId=e.client_id,t.automaticModeration=e.automatic_moderation?this.remapAutomaticModeration(e.automatic_moderation):null,t});o(this,"remapFantasyConfig",e=>{let t=new vk;return t.enabled=e.enabled,t.clientId=e.client_id,t.addPointsToProfileTotal=e.add_points_to_profile_total,t.competitionsWhitelist=e.competitions_whitelist,t.players=this.remapFantasyPlayers(e.players),t.coefficients=this.remapFantasyCoefficients(e.coefficients),t});o(this,"remapFantasyPlayers",e=>{let t=new Lv;return t.total=e.total,t.minGoalkeepers=e.min_goalkeepers,t.maxGoalkeepers=e.max_goalkeepers,t.minDefenders=e.min_defenders,t.maxDefenders=e.max_defenders,t.minMidfielders=e.min_midfielders,t.maxMidfielders=e.max_midfielders,t.minStrikers=e.min_strikers,t.maxStrikers=e.max_strikers,t});o(this,"remapFantasyCoefficients",e=>{let t=new Dv;return t.assists=e.assists,t.shots=e.shots,t.offsides=e.offsides,t.tackles=e.tackles,t.saves=e.saves,t.minutesEqualOrOver60=e.minutes_equal_or_over_60,t.minutesUnder60=e.minutes_under_60,t.yellowCards=e.yellow_cards,t.redCards=e.red_cards,t.goalsGoalkeeper=e.goals_goalkeeper,t.goalsDefender=e.goals_defender,t.goalsMidfielder=e.goals_midfielder,t.goalsForwards=e.goals_forwards,t.penaltyGoals=e.penalty_goals,t.ownGoals=e.own_goals,t.cleanSheetsGoalkeeper=e.clean_sheets_goalkeeper,t.cleanSheetsDefender=e.clean_sheets_defender,t.cleanSheetsMidfielder=e.clean_sheets_midfielder,t.cleanSheetsForwards=e.clean_sheets_forwards,t.shotsOn=e.shots_on,t.foulsCommitted=e.fouls_committed,t.penaltyCommitted=e.penalty_committed,t.penaltyWon=e.penalty_won,t.penaltyMissed=e.penalty_missed,t.concededGoals=e.conceded_goals,t.caughtBall=e.caught_ball,t});o(this,"remapAutomaticModeration",e=>{let t=new Tv;return t.enabled=e.enabled,t.moderateLinks=e.moderate_links,t.linksWhitelist=e.links_whitelist,t.moderatorProfileId=e.moderator_profile_id,t.dictionary=e.dictionary,t});o(this,"remapNewRewards",e=>{let t=new Rv;return t.points=this.remapPoints(e.points),t.tiers=e.tiers,t.badges=this.remapNewBadges(e.badges),t});o(this,"remapRewards",e=>{let t=new Av;return t.points=this.remapPoints(e.points),t.tiers=e.tiers,t.badges=this.remapBadges(e.badges),t});o(this,"remapPoints",e=>{let t=new YP;return t.general=e.general,t.discussionPost=e.discussion_post,t.predictor=e.predictor,t.activity=e.activity,t.topX=e.top_x,t.matchQuiz=e.match_quiz,t});o(this,"remapBadges",e=>{let t=new pk;return t.general=e.general?this.remapGeneralBadgeValues(e.general):[],t.predictor=this.remapBadgeValues(e.predictor),t.topX=this.remapBadgeValues(e.top_x),t.matchQuiz=this.remapBadgeValues(e.match_quiz),t});o(this,"remapNewBadges",e=>{let t=new XP;return t.predictor=this.remapBadgeValuesPredictor(e.predictor),t.topX=this.remapBadgeValuesGame(e.top_x),t.matchQuiz=this.remapBadgeValuesGame(e.match_quiz),e.games&&(t.games=this.remapBadgeValuesGames(e.games)),e.football&&(t.football=this.remapBadgeValuesFootball(e.football)),e.classic_quizzes&&(t.classicQuizzes=this.remapBadgeValuesMiniGames(e.classic_quizzes)),e.either_or&&(t.eitherOr=this.remapBadgeValuesMiniGames(e.either_or)),e.discussions&&(t.discussions=this.remapBadgeValuesDiscussions(e.discussions)),e.voting&&e.voting.potm&&(t.voting.potm=this.remapBadgeValuesVoting(e.voting.potm)),e.voting&&e.voting.poll&&(t.voting.poll=this.remapBadgeValuesVoting(e.voting.poll)),t});o(this,"remapBadgeValuesPredictor",e=>e.map(t=>{let r=new ek;return r.id=t.id,r.enabled=t.enabled,r.label=t.label,r.description=t.description,r.flags=t.flags,t.assets?r.assets.mainImageUrl=t.assets.main_image_url:r.assets=t.assets,t.requirements&&(r.requirements.predictionsNumber=t.requirements.predictions_number,r.requirements.correctPredictions=t.requirements.correct_predictions,r.requirements.points=t.requirements.points,r.requirements.fromDate=t.requirements.from_date,r.requirements.toDate=t.requirements.to_date),r}));o(this,"remapBadgeValuesGame",e=>e.map(t=>{let r=new rk;return r.id=t.id,r.enabled=t.enabled,r.label=t.label,r.description=t.description,r.flags=t.flags,t.assets?r.assets.mainImageUrl=t.assets.main_image_url:r.assets=t.assets,t.requirements&&(r.requirements.participationCount=t.requirements.participation_count,r.requirements.points=t.requirements.points,r.requirements.fromDate=t.requirements.from_date,r.requirements.toDate=t.requirements.to_date),r}));o(this,"remapBadgeValuesGames",e=>e.map(t=>{let r=new ik;return r.id=t.id,r.enabled=t.enabled,r.label=t.label,r.description=t.description,r.flags=t.flags,t.assets?r.assets.mainImageUrl=t.assets.main_image_url:r.assets=t.assets,t.requirements&&(r.requirements.participationCount=t.requirements.participation_count,r.requirements.points=t.requirements.points,r.requirements.fromDate=t.requirements.from_date,r.requirements.toDate=t.requirements.to_date,r.requirements.specificGames=t.requirements.specific_games?this.remapSpecificGamesRequirement(t.requirements.specific_games):null),r}));o(this,"remapSpecificGamesRequirement",e=>e.map(t=>({gameId:t.game_id,gameType:t.game_type,gameModel:null})));o(this,"remapBadgeValuesFootball",e=>e.map(t=>{let r=new ok;return r.id=t.id,r.enabled=t.enabled,r.label=t.label,r.description=t.description,r.flags=t.flags,t.assets?r.assets.mainImageUrl=t.assets.main_image_url:r.assets=t.assets,t.requirements&&(r.requirements.predictionsNumber=t.requirements.predictions_number,r.requirements.correctPredictions=t.requirements.correct_predictions,r.requirements.points=t.requirements.points,r.requirements.entityId=t.requirements.entity_id,r.requirements.entityType=t.requirements.entity_type),r}));o(this,"remapBadgeValuesMiniGames",e=>e.map(t=>{let r=new lk;return r.id=t.id,r.enabled=t.enabled,r.label=t.label,r.description=t.description,r.flags=t.flags,t.assets?r.assets.mainImageUrl=t.assets.main_image_url:r.assets=t.assets,t.requirements&&(r.requirements.participationCount=t.requirements.participation_count,r.requirements.fromDate=t.requirements.from_date,r.requirements.toDate=t.requirements.to_date),r}));o(this,"remapBadgeValuesDiscussions",e=>e.map(t=>{let r=new uk;return r.id=t.id,r.enabled=t.enabled,r.label=t.label,r.description=t.description,r.flags=t.flags,t.assets?r.assets.mainImageUrl=t.assets.main_image_url:r.assets=t.assets,t.requirements&&(r.requirements.totalDiscussionPoints=t.requirements.total_discussion_points,r.requirements.postsCount=t.requirements.posts_count,r.requirements.postPoints=t.requirements.post_points,r.requirements.reactionsCount=t.requirements.reactions_count),r}));o(this,"remapBadgeValuesVoting",e=>e.map(t=>{let r=new fk;return r.id=t.id,r.enabled=t.enabled,r.label=t.label,r.description=t.description,r.flags=t.flags,t.assets?r.assets.mainImageUrl=t.assets.main_image_url:r.assets=t.assets,t.requirements&&(r.requirements.points=t.requirements.points,r.requirements.voteCount=t.requirements.vote_count,r.requirements.entityId=t.requirements.entity_id,r.requirements.entityType=t.requirements.entity_type),r}));o(this,"remapBadgeValues",e=>e.map(t=>{let r=new mk;return r.id=t.id,r.label=t.label,r.enabled=t.enabled,t.assets?r.assets.mainImageUrl=t.assets.main_image_url:r.assets=t.assets,r.requirements=this.remapRequirements(t.requirements),r}));o(this,"remapRequirements",e=>{let t=new Td;return t.points=e.points,t.gameParticipationCount=e.game_participation_count,t.entityId=e.entity_id,t.entityType=e.entity_type,t.predictionsMade=e.predictions_made,t.correctPredictions=e.correct_predictions,t});o(this,"remapUserDataConfig",e=>{let t=new QP;return t.storeIp=e.store_ip,t.storeDeviceId=e.store_device_id,t.storeAgent=e.store_agent,t});o(this,"remapGeneralBadgeValues",e=>e.map(t=>{let r=new gk;return r.id=t.id,r.label=t.label,r.enabled=t.enabled,t.assets?r.assets.mainImageUrl=t.assets.main_image_url:r.assets=t.assets,r.requirements=this.remapGeneralRequirements(t.requirements),r}));o(this,"remapGeneralRequirements",e=>{let t=new Mv;return t.points=e.points,t.gameParticipationCount=e.game_participation_count,t.entityId=e.entity_id,t.entityType=e.entity_type,t.predictionsMade=e.predictions_made,t.correctPredictions=e.correct_predictions,t.postPoints=e.post_points,t.postsCount=e.posts_count,t.reactionsCount=e.reactions_count,t.totalDiscussionPoints=e.total_discussion_points,t})}},hi=class extends qr{constructor(t){super(t,Rr(t.environment,"client"));o(this,"featureConfigRemapper",null);o(this,"localStorage",null);o(this,"clientId",null);o(this,"getConfig",t=>C(this,null,function*(){let r=this.getCachedFeatures();if(!r){let n=`/clients/${this.clientId}/features`,i=this.apiSignInUrl.split("&")[0],a=n+i;r=(yield this.fetchWithoutAuth(a,"There was a problem fetching client features from Client API")).data,this.localStorage.setClientFeatures(r)}switch(t){case"predictor":return this.featureConfigRemapper.remapPredictorConfig(r.predictor);case"topX":return this.featureConfigRemapper.remapTopXConfig(r.top_x);case"matchQuiz":return this.featureConfigRemapper.remapMatchQuizConfig(r.match_quiz);case"loyalty":return this.featureConfigRemapper.remapLoyaltyConfig(r.loyalty);case"discussions":return this.featureConfigRemapper.remapDiscussionsConfig(r.discussions);case"fantasy":return this.featureConfigRemapper.remapFantasyConfig(r.football_fantasy)}}));o(this,"getNewLoyaltyConfig",t=>C(this,null,function*(){let r=`/clients/${this.clientId}/features`,n=this.apiSignInUrl.split("&")[0],i="There was a problem fetching client features from Client API";if(t){let s=r+n+Ze(),l=yield this.fetchWithoutAuthAdditionalHeaders(s,i,{"x-api-version":"2"});this.localStorage.setClientFeatures(l.data)}let a=this.getCachedFeatures();if(!a){let s=r+n;a=(yield this.fetchWithoutAuthAdditionalHeaders(s,i,{"x-api-version":"2"})).data,this.localStorage.setClientFeatures(a)}return this.featureConfigRemapper.remapLoyaltyNewConfig(a.loyalty)}));o(this,"getCachedFeatures",()=>{let t=this.getLocalStorageData();if(!(!t||!Object.keys(t).length))return t.predictor.client_id&&t.predictor.client_id!==this.clientId?(this.localStorage.deleteClientFeatures(),null):t});o(this,"getLocalStorageData",()=>{let t=Math.floor(Date.now()/1e3);return this.localStorage.getExpiration("client","features")>t?this.localStorage.getClientFeatures():null});this.clientId=t.clientId,this.localStorage=new Co().createLocalCacheInstance(t.idSchema),this.featureConfigRemapper=new yk}},Xi=class{constructor(){o(this,"currentPage",null);o(this,"itemsPerPage",null);o(this,"totalItems",null);o(this,"numberOfPages",null)}},Zi=class{constructor(){o(this,"pagination",new Xi)}},sl=class{constructor(e){o(this,"clientHttps",null);o(this,"errorHandlingMode",null);o(this,"setAvailableMarketsForMatch",e=>C(this,null,function*(){let{fullCoverageCompetitions:t,markets:r}=yield this.clientHttps.getConfig("predictor");if(Array.isArray(e))return e.map(n=>this.setAvailableMarkets(n,t,r));if(typeof e=="object"&&Object.keys(e).length)return this.setAvailableMarkets(e,t,r)}));o(this,"setAvailableMarkets",(e,t,r)=>{var i;let n=(i=e.context.competition)==null?void 0:i.id;return n&&this.isMatchInCoverageCompetition(n,t)?(e.availableMarkets=r.all,e):(e.availableMarkets=r.main,e)});o(this,"setMetaDataBatchRequest",(e,t,r)=>{let n=new Zi;if(n.pagination.totalItems=e,n.pagination.itemsPerPage=t,n.pagination.numberOfPages=e?Math.ceil(e/t):0,n.pagination.currentPage=r,n.pagination.numberOfPages>0&&r>n.pagination.numberOfPages)throw this.errorHandlingMode==="standard"?new et(400,"invalid_page_number","Invalid page number provided. Use number between 1 and max number of pages."):new mt(400,"invalid_page_number","Invalid page number provided. Use number between 1 and max number of pages.");return n});o(this,"finalizeMatchesDataBatchRequest",(e,t)=>{e=e.sort((n,i)=>new Date(n.kickoffAt).getTime()-new Date(i.kickoffAt).getTime());let r=t.limit||20;if(t.page){let n=t.page>1?r*(t.page-1):0;e=e.slice(n,n+r)}return!t.page&&e.length>r&&(e=e.slice(0,r)),e});o(this,"isMatchInCoverageCompetition",(e,t)=>{let r=!1;return t.includes(e)&&(r=!0),r});this.clientHttps=new hi(e),this.errorHandlingMode=e.errorHandlingMode}},bk=class{constructor(e,t,r){o(this,"footballService",null);o(this,"https",null);o(this,"idMapping",null);o(this,"getTeamsIdMapping",(e,t)=>C(this,null,function*(){try{let r=!1;if(e){if(e=new Sv(e),e.countryId){let i=yield this.idMapping.getEntityIdsBySchemaId([`${e.countryId}`],"country","native");i.country.length===0&&(r=!0),e.countryId=i.country[0]}if(e.scope){let i=yield this.idMapping.getEntityIdsBySchemaId(e.scope,"competition","native");i.competition.length===0&&(r=!0),e.scope=i.competition}if(e.teamIds){let i=yield this.idMapping.getEntityIdsBySchemaId(e.teamIds,"team","native");i.team.length===0&&(r=!0),e.teamIds=i.team}}if(r)return[];let n=yield this.getTeams(e,t);return n.data=yield this.idMapping.remapEntities(n.data,"team"),n}catch(r){throw console.warn("There was a problem browsing all teams",r),r}}));o(this,"getTeamsMapWithNativeIds",e=>C(this,null,function*(){let t=new Map,r=e.length,n=new Sv({teamIds:e,limit:r}),{data:i}=yield this.getTeams(n);i.sort((l,c)=>l.id.localeCompare(c.id));let a=dv(e),s=yield this.idMapping.remapEntities(i,"team");return a.forEach((l,c)=>t.set(l,s[c])),t}));o(this,"getTeams",(e,t)=>C(this,null,function*(){try{return t=t||!1,yield this.https.getTeams(e,t)}catch(r){throw console.warn("There was a problem retrieving all teams",r),r}}));o(this,"getTeamByIdIdMapping",(e,t)=>C(this,null,function*(){try{e=(yield this.idMapping.getEntityIdsBySchemaId([e],"team","native")).team[0];let r=yield this.getTeamById(e,t);return yield this.idMapping.remapEntities(r,"team")}catch(r){throw console.warn(`There was a problem browsing the following team:${e}`,r),r}}));o(this,"getTeamById",(e,t)=>C(this,null,function*(){try{return t=t||!1,yield this.https.getTeamById(e,t)}catch(r){throw console.warn(`There was a problem retrieving the following team: ${e}`,r),r}}));o(this,"getTopTeamsIdMapping",e=>C(this,null,function*(){try{let t=yield this.getTopTeams(e);return yield this.idMapping.remapEntities(t,"team")}catch(t){throw console.warn("There was a problem browsing the top teams",t),t}}));o(this,"getTopTeams",e=>C(this,null,function*(){try{return e=e||!1,yield this.https.getTopTeams(e)}catch(t){throw console.warn("There was a problem retrieving the top teams",t),t}}));o(this,"getNextMatchForTeamIdMapping",(e,t)=>C(this,null,function*(){try{e=(yield this.idMapping.getEntityIdsBySchemaId([e],"team","native")).team[0];let r=yield this.getNextMatchForTeam(e,t);return yield this.idMapping.remapEntities(r,"match")}catch(r){throw console.warn(`There was a problem browsing the next match for the following team:${e}`,r),r}}));o(this,"getNextMatchForTeam",(e,t)=>C(this,null,function*(){try{t=t||!1;let r=yield this.https.getNextMatchForTeam(e,t);return yield this.footballService.setAvailableMarketsForMatch(r)}catch(r){throw console.warn(`There was a problem retrieving the next match for the following team: ${e}`,r),r}}));o(this,"getPrevMatchForTeamIdMapping",(e,t)=>C(this,null,function*(){try{e=(yield this.idMapping.getEntityIdsBySchemaId([e],"team","native")).team[0];let r=yield this.getPrevMatchForTeam(e,t);return yield this.idMapping.remapEntities(r,"match")}catch(r){throw console.warn(`There was a problem browsing the previous match for the following team:${e}`,r),r}}));o(this,"getPrevMatchForTeam",(e,t)=>C(this,null,function*(){try{t=t||!1;let r=yield this.https.getPrevMatchForTeam(e,t);return yield this.footballService.setAvailableMarketsForMatch(r)}catch(r){throw console.warn(`There was a problem retrieving the previous match for the following team: ${e}`,r),r}}));this.idMapping=r,this.https=t,this.footballService=new sl(e)}},Fv=class{constructor(e){o(this,"countryId",null);o(this,"scope",null);o(this,"name",null);o(this,"playerIds",null);o(this,"limit",null);o(this,"page",null);o(this,"sortField",null);o(this,"sortOrder",null);o(this,"constructFilterUrl",()=>{let e="";return this.countryId&&(e=e+"&",e=e+`country_id=${this.countryId}`),this.scope&&this.scope.length>0&&(e=e+"&",e=e+`scope=${this.scope.join(",")}`),this.name&&(e=e+"&",e=e+`name=${this.name}`),this.playerIds&&this.playerIds.length>0&&(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});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}},Ed=class{constructor(e,t,r){o(this,"https",null);o(this,"footballService",null);o(this,"idMapping",null);o(this,"getPlayersIdMapping",(e,t)=>C(this,null,function*(){try{let r=!1;if(e){if(e=new Fv(e),e.countryId){let i=yield this.idMapping.getEntityIdsBySchemaId([e.countryId],"country","native");i.country.length===0&&(r=!0),e.countryId=i.country[0]}if(e.playerIds){let i=yield this.idMapping.getEntityIdsBySchemaId(e.playerIds,"player","native");i.player.length===0&&(r=!0),e.playerIds=i.player}if(e.scope){let i=yield this.idMapping.getEntityIdsBySchemaId(e.scope,"competition","native");i.competition.length===0&&(r=!0),e.scope=i.competition}if(r)return[]}let n=yield this.getPlayers(e,t);return n.data=yield this.idMapping.remapEntities(n.data,"player"),n}catch(r){throw console.warn("There was a problem browsing the players",r),r}}));o(this,"getPlayersWithNativeIds",e=>C(this,null,function*(){let t=e.length,r=new Fv({playerIds:e,limit:t}),n=yield this.getPlayers(r);return n.data.sort((i,a)=>i.id.localeCompare(a.id)),yield this.idMapping.remapEntities(n.data,"player")}));o(this,"getPlayersMapWithNativeIds",e=>C(this,null,function*(){let t={},r=tl(e);r.sort((i,a)=>i.localeCompare(a));let n=yield this.getPlayersWithNativeIds(Array.from(r));return r.forEach((i,a)=>t[i]=n[a]),t}));o(this,"getPlayers",(e,t)=>C(this,null,function*(){try{return t=t||!1,yield this.https.getPlayers(e,t)}catch(r){throw console.warn("There was a problem retrieving the players",r),r}}));o(this,"getPlayerIdMapping",(e,t)=>C(this,null,function*(){try{let r=yield this.idMapping.getEntityIdsBySchemaId([e],"player","native"),n=yield this.getPlayerById(r.player[0],t);return yield this.idMapping.remapEntities(n,"player")}catch(r){throw console.warn(`There was a problem browsing the following player:${e}`,r),r}}));o(this,"getPlayerById",(e,t)=>C(this,null,function*(){try{return t=t||!1,yield this.https.getPlayerById(e,t)}catch(r){throw console.warn(`There was a problem retrieving the following player: ${e}`,r),r}}));o(this,"getTopPlayersIdMapping",e=>C(this,null,function*(){try{let t=yield this.getTopPlayers(e);return yield this.idMapping.remapEntities(t,"player")}catch(t){throw console.warn("There was a problem browsing the top players",t),t}}));o(this,"getTopPlayers",e=>C(this,null,function*(){try{return e=e||!1,yield this.https.getTopPlayers(e)}catch(t){throw console.warn("There was a problem retrieving the top players",t),t}}));o(this,"getNextMatchForPlayerIdMapping",(e,t)=>C(this,null,function*(){try{e=(yield this.idMapping.getEntityIdsBySchemaId([e],"player","native")).player[0];let r=yield this.getNextMatchForPlayer(e,t);return yield this.idMapping.remapEntities(r,"match")}catch(r){throw console.warn(`There was a problem browsing the next match for player:${e}`,r),r}}));o(this,"getNextMatchForPlayer",(e,t)=>C(this,null,function*(){try{t=t||!1;let r=yield this.https.getNextMatchForPlayer(e,t);return yield this.footballService.setAvailableMarketsForMatch(r)}catch(r){throw console.warn(`There was a problem retrieving the next match for player: ${e}`,r),r}}));o(this,"getPrevMatchForPlayerIdMapping",(e,t)=>C(this,null,function*(){try{e=(yield this.idMapping.getEntityIdsBySchemaId([e],"player","native")).player[0];let r=yield this.getPrevMatchForPlayer(e,t);return yield this.idMapping.remapEntities(r,"match")}catch(r){throw console.warn(`There was a problem browsing the previous match for player:${e}`,r),r}}));o(this,"getPrevMatchForPlayer",(e,t)=>C(this,null,function*(){try{t=t||!1;let r=yield this.https.getPrevMatchForPlayer(e,t);return yield this.footballService.setAvailableMarketsForMatch(r)}catch(r){throw console.warn(`There was a problem retrieving the previous match for player: ${e}`,r),r}}));this.idMapping=r,this.https=t,this.footballService=new sl(e)}},ll=class{constructor(e){o(this,"countryIds",null);o(this,"competitionIds",null);o(this,"matchIds",null);o(this,"status",null);o(this,"teamIds",null);o(this,"fromDate",null);o(this,"toDate",null);o(this,"limit",null);o(this,"page",null);o(this,"sortField",null);o(this,"sortOrder",null);o(this,"constructFilterUrl",e=>{let t="";return this.countryIds&&(t=t+"&",t=t+`countries=${this.countryIds.join(",")}`),this.competitionIds&&this.competitionIds.length>0&&(t=t+"&",t=t+`competitions=${this.competitionIds.join(",")}`),this.matchIds&&this.matchIds.length>0&&(t=t+"&",t=t+`matches=${this.matchIds.join(",")}`),this.status&&(t=t+"&",t=t+`status=${this.status}`),this.teamIds&&this.teamIds.length>0&&(t=t+"&",t=t+`teams=${this.teamIds.join(",")}`),this.fromDate&&(t=t+"&",t=t+`from_date=${this.fromDate}`),this.toDate&&(t=t+"&",t=t+`to_date=${this.toDate}`),this.limit&&!e&&(t=t+"&",t=t+`limit=${this.limit}`),this.page&&!e&&(t=t+"&",t=t+`page=${this.page}`),this.sortField&&(t=t+"&",t=t+`sort_field=${this.sortField}`),this.sortOrder&&(t=t+"&",t=t+`sort_order=${this.sortOrder}`),t});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}},Ad=class{constructor(e,t,r){o(this,"https",null);o(this,"idMapping",null);o(this,"footballService",null);o(this,"getMatchesIdMapping",(e,t)=>C(this,null,function*(){try{if(e){if(e=new ll(e),e.countryIds&&e.countryIds.length>0){let n=yield this.idMapping.getEntityIdsBySchemaId(e.countryIds,"country","native");e.countryIds=n.country}if(e.competitionIds&&e.competitionIds.length>0){let n=yield this.idMapping.getEntityIdsBySchemaId(e.competitionIds,"competition","native");e.competitionIds=n.competition}if(e.matchIds&&e.matchIds.length>0){let n=yield this.idMapping.getEntityIdsBySchemaId(e.matchIds,"match","native");e.matchIds=n.match}if(e.teamIds&&e.teamIds.length>0){let n=yield this.idMapping.getEntityIdsBySchemaId(e.teamIds,"team","native");e.teamIds=n.team}}let r=yield this.getMatches(e,t);return r.data=yield this.footballService.setAvailableMarketsForMatch([...r.data]),r.data=yield this.idMapping.remapEntities(r.data,"match"),r}catch(r){throw console.warn("There was a problem browsing the matches",r),r}}));o(this,"getMatchesWithNativeIds",e=>C(this,null,function*(){let t=e.length,r=new ll({matchIds:e,limit:t}),n=yield this.getMatches(r);return n.data.sort((i,a)=>i.id.localeCompare(a.id)),yield this.idMapping.remapEntities(n.data,"match")}));o(this,"getMatchesMapWithNativeIds",e=>C(this,null,function*(){let t={},r=tl(e);r.sort((i,a)=>i.localeCompare(a));let n=yield this.getMatchesWithNativeIds(Array.from(r));if(r.length!==n.length){let i=new ll({matchIds:r,limit:r.length}),a=yield this.getMatches(i),s=r.filter(l=>{if(a.data.every(c=>c.id!==l))return l});r=r.filter(l=>{if(!s.includes(l))return l})}return r.forEach((i,a)=>t[i]=n[a]),t}));o(this,"getMatches",(e,t)=>C(this,null,function*(){try{return t=t||!1,yield this.https.getMatches(e,t)}catch(r){throw console.warn("There was a problem retrieving the matches",r),r}}));o(this,"getMatchIdMapping",(e,t)=>C(this,null,function*(){try{let r=yield this.idMapping.getEntityIdsBySchemaId([e],"match","native"),n=yield this.getMatchById(r.match[0],t),i=yield this.footballService.setAvailableMarketsForMatch(n);return yield this.idMapping.remapEntities(i,"match")}catch(r){throw console.warn(`There was a problem browsing the following match: ${e}`,r),r}}));o(this,"getMatchById",(e,t)=>C(this,null,function*(){try{return t=t||!1,yield this.https.getMatchById(e,t)}catch(r){throw console.warn(`There was a problem retrieving the following match: ${e}`,r),r}}));this.https=t,this.idMapping=r,this.footballService=new sl(e)}},wk=class{constructor(e){o(this,"entities",null);o(this,"query",null);o(this,"scope",null);o(this,"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});this.entities=e.entities?e.entities:null,this.query=e.query?e.query:null,this.scope=e.scope?e.scope:null}},_k=class{constructor(e,t){o(this,"https",null);o(this,"idMapping",null);o(this,"searchIdMapping",(e,t)=>C(this,null,function*(){try{if(e=new wk(e),e.scope){let n=yield this.idMapping.getEntityIdsBySchemaId(e.scope,"competition","native");e.scope=n.competition}let r=yield this.search(e,t);if(r.teams&&r.teams.length>0){let n=yield this.idMapping.remapEntities(r.teams,"team");r.teams=n}if(r.players&&r.players.length>0){let n=yield this.idMapping.remapEntities(r.players,"player");r.players=n}if(r.competitions&&r.competitions.length>0){let n=yield this.idMapping.remapEntities(r.competitions,"competition");r.competitions=n}return r}catch(r){throw console.warn("There was a problem with browsing the search result",r),r}}));o(this,"search",(e,t)=>C(this,null,function*(){try{return yield this.https.search(e,t)}catch(r){throw console.warn("There was a problem retrieving the search response",r),r}}));this.https=e,this.idMapping=t}},$v=class{constructor(e,t,r,n){o(this,"countriesFacade",null);o(this,"competitionsFacade",null);o(this,"teamsFacade",null);o(this,"playerFacade",null);o(this,"matchFacade",null);o(this,"searchFacade",null);o(this,"getCountries",e=>C(this,null,function*(){return this.countriesFacade.getCountriesWithIdMapping(e)}));o(this,"getCompetitions",(e,t)=>C(this,null,function*(){return this.competitionsFacade.getCompetitionsIdMapping(e,t)}));o(this,"getCompetitionById",(e,t)=>C(this,null,function*(){return this.competitionsFacade.getCompetitionByIdIdMapping(e,t)}));o(this,"getTopCompetitions",e=>C(this,null,function*(){return this.competitionsFacade.getTopCompetitionsIdMapping(e)}));o(this,"getCompetitionsMapWithNativeIds",e=>C(this,null,function*(){return yield this.competitionsFacade.getCompetitionsMapWithNativeIds(e)}));o(this,"getTeams",(e,t)=>C(this,null,function*(){return this.teamsFacade.getTeamsIdMapping(e,t)}));o(this,"getTeamById",(e,t)=>C(this,null,function*(){return this.teamsFacade.getTeamByIdIdMapping(e,t)}));o(this,"getTopTeams",e=>C(this,null,function*(){return this.teamsFacade.getTopTeamsIdMapping(e)}));o(this,"getNextMatchForTeam",(e,t)=>C(this,null,function*(){return this.teamsFacade.getNextMatchForTeamIdMapping(e,t)}));o(this,"getPrevMatchForTeam",(e,t)=>C(this,null,function*(){return this.teamsFacade.getPrevMatchForTeamIdMapping(e,t)}));o(this,"getTeamsMapWithNativeIds",e=>C(this,null,function*(){return yield this.teamsFacade.getTeamsMapWithNativeIds(e)}));o(this,"getPlayers",(e,t)=>C(this,null,function*(){return this.playerFacade.getPlayersIdMapping(e,t)}));o(this,"getPlayerById",(e,t)=>C(this,null,function*(){return this.playerFacade.getPlayerIdMapping(e,t)}));o(this,"getTopPlayers",e=>C(this,null,function*(){return this.playerFacade.getTopPlayersIdMapping(e)}));o(this,"getNextMatchForPlayer",(e,t)=>C(this,null,function*(){return this.playerFacade.getNextMatchForPlayerIdMapping(e,t)}));o(this,"getPrevMatchForPlayer",(e,t)=>C(this,null,function*(){return this.playerFacade.getPrevMatchForPlayerIdMapping(e,t)}));o(this,"getPlayersMapWithNativeIds",e=>C(this,null,function*(){return this.playerFacade.getPlayersMapWithNativeIds(e)}));o(this,"getMatches",(e,t)=>C(this,null,function*(){return this.matchFacade.getMatchesIdMapping(e,t)}));o(this,"getMatchesMapWithNativeIds",e=>C(this,null,function*(){return this.matchFacade.getMatchesMapWithNativeIds(e)}));o(this,"getMatchById",(e,t)=>C(this,null,function*(){return this.matchFacade.getMatchIdMapping(e,t)}));o(this,"search",(e,t)=>C(this,null,function*(){return this.searchFacade.searchIdMapping(e,t)}));this.countriesFacade=new HP(t,r,n),this.competitionsFacade=new UP(t,r,n),this.teamsFacade=new bk(e,r,n),this.playerFacade=new Ed(e,r,n),this.matchFacade=new Ad(e,r,n),this.searchFacade=new _k(r,n)}},xk=class{constructor(){o(this,"id","");o(this,"alias","");o(this,"countryCode","");o(this,"assets",null);o(this,"name","")}},An=class{constructor(){o(this,"countriesFromResponse",t=>{if(t)return t.map(r=>this.countryFromResponse(r))});o(this,"countryFromResponse",t=>{try{if(t){let r=new xk;return r.id=t.id,r.alias=t.alias,r.assets=t.assets,r.countryCode=t.country_code,r.name=t.name,r}}catch(r){throw r}return null})}},Ck=class{constructor(){o(this,"id","");o(this,"country",null);o(this,"gender","");o(this,"assets",null);o(this,"type","");o(this,"name","")}},ea=class{constructor(){o(this,"countryRemapper",null);this.countryRemapper=new An}fromResponse(e){try{let t=new Ck;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}}},Ik=class{constructor(){o(this,"id","");o(this,"country",null);o(this,"gender","");o(this,"assets",null);o(this,"type","");o(this,"name","");o(this,"participants",[])}},Sk=class{constructor(){o(this,"id","");o(this,"country",null);o(this,"gender","");o(this,"assets",null);o(this,"name","");o(this,"code","");o(this,"national",!1);o(this,"undecided",!1);o(this,"fullName","");o(this,"shortName","");o(this,"isDeleted",!1)}},pi=class{constructor(){o(this,"countryRemapper",null);this.countryRemapper=new An}fromResponse(t){try{let r=new Sk;return r.id=t.id,r.country=this.countryRemapper.countryFromResponse(t.country),r.gender=t.gender,r.assets=t.assets,r.code=t.code,r.national=t.national,r.fullName=t.full_name,r.shortName=t.short_name,r.name=t.name,r.isDeleted=t.is_deleted,r.undecided=t.undecided,r}catch(r){throw console.warn("There was a problem remapping teams response",r),r}}},Tk=class{constructor(){o(this,"countryRemapper",null);o(this,"teamBasicRemapper",null);this.countryRemapper=new An,this.teamBasicRemapper=new pi}fromResponse(e){try{let t=new Ik;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}}},Ek=class{constructor(){o(this,"primary",null);o(this,"secondary",null);o(this,"tertiary",null)}},Ak=class{constructor(){o(this,"id","");o(this,"country",null);o(this,"gender","");o(this,"assets",null);o(this,"name","");o(this,"competitions",[]);o(this,"code","");o(this,"national",!1);o(this,"fullName","");o(this,"shortName","");o(this,"isDeleted",!1);o(this,"undecided",!1);o(this,"colors",new Ek);o(this,"squad",[])}},Ok=class{constructor(){o(this,"id","");o(this,"startDate","");o(this,"endDate","");o(this,"shirtNumber");o(this,"loan",!1);o(this,"position","");o(this,"country",null);o(this,"name","");o(this,"assets",null);o(this,"birthDate","")}},Pk=class{constructor(){o(this,"countryRemapper",null);this.countryRemapper=new An}fromResponse(e){try{let t=new Ok;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}}},kk=class{constructor(){o(this,"countryRemapper",null);o(this,"competitionRemapper",null);o(this,"playerRemapper",null);this.countryRemapper=new An,this.competitionRemapper=new ea,this.playerRemapper=new Pk}fromResponse(e){try{let t=new Ak;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.isDeleted=e.is_deleted,t.undecided=e.undecided,t.competitions=e.competitions?e.competitions.map(r=>this.competitionRemapper.fromResponse(r)):[],t.colors=e.colors?e.colors:t.colors,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}}},Rk=class{constructor(){o(this,"id","");o(this,"kickoffAt","");o(this,"finishedAt","");o(this,"updatedAt","");o(this,"availableMarkets",null);o(this,"homeTeam",null);o(this,"awayTeam",null);o(this,"isDeleted",!1);o(this,"undecided",!1);o(this,"lineupsConfirmed",!1);o(this,"startedAt","");o(this,"minute","");o(this,"scores",null);o(this,"context",{competition:null});o(this,"status",{type:null,subType:null})}},Mk=class{constructor(){o(this,"ftScore",null);o(this,"htScore",null);o(this,"aetScore",null);o(this,"aggScore",null);o(this,"penScore",null)}},Nv=class{constructor(){o(this,"statEntityFromResponse",e=>({homeGoals:e.home_goals,awayGoals:e.away_goals}))}fromResponse(e){try{let t=new Mk;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}}},Dk=class{constructor(){o(this,"teamRemapper",null);o(this,"competitionRemapper",null);o(this,"scoresRemapper",null);this.teamRemapper=new pi,this.competitionRemapper=new ea,this.scoresRemapper=new Nv}fromResponse(e){try{let t=new Rk;return t.id=e.id,t.kickoffAt=e.kickoff_at,t.finishedAt=e.finished_at,t.updatedAt=e.updated_at,t.isDeleted=e.is_deleted,t.undecided=e.undecided,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}}},Io=class{constructor(){o(this,"type",null);o(this,"subType",null)}},Lk=class{constructor(){o(this,"id","");o(this,"kickoffAt","");o(this,"finishedAt","");o(this,"updatedAt","");o(this,"availableMarkets",null);o(this,"isDeleted",!1);o(this,"undecided",!1);o(this,"homeTeam",null);o(this,"awayTeam",null);o(this,"lineupsConfirmed",!1);o(this,"startedAt","");o(this,"minute","");o(this,"scores",null);o(this,"stats",null);o(this,"playerStats",[]);o(this,"context",{competition:null});o(this,"timeline",[]);o(this,"status",new Io);o(this,"lineups",null)}},Fk=class{constructor(){o(this,"corners",null);o(this,"cornersFirstHalf",null);o(this,"cornersSecondHalf",null);o(this,"cornersExtraTime",null);o(this,"crosses",null);o(this,"crossesFirstHalf",null);o(this,"crossesSecondHalf",null);o(this,"crossesExtraTime",null);o(this,"offside",null);o(this,"offsideFirstHalf",null);o(this,"offsideSecondHalf",null);o(this,"offsideExtraTime",null);o(this,"shotsOn",null);o(this,"shotsOnFirstHalf",null);o(this,"shotsOnSecondHalf",null);o(this,"shotsOnExtraTime",null);o(this,"throwIn",null);o(this,"throwInFirstHalf",null);o(this,"throwInSecondHalf",null);o(this,"throwInExtraTime",null);o(this,"redCards",null);o(this,"redCardsFirstHalf",null);o(this,"redCardsSecondHalf",null);o(this,"redCardsExtraTime",null);o(this,"shotsOff",null);o(this,"shotsOffFirstHalf",null);o(this,"shotsOffSecondHalf",null);o(this,"shotsOffExtraTime",null);o(this,"goalKicks",null);o(this,"goalKicksFirstHalf",null);o(this,"goalKicksSecondHalf",null);o(this,"goalKicksExtraTime",null);o(this,"possession",null);o(this,"possessionFirstHalf",null);o(this,"possessionSecondHalf",null);o(this,"possessionExtraTime",null);o(this,"treatments",null);o(this,"treatmentsFirstHalf",null);o(this,"treatmentsSecondHalf",null);o(this,"treatmentsExtraTime",null);o(this,"yellowCards",null);o(this,"yellowCardsFirstHalf",null);o(this,"yellowCardsSecondHalf",null);o(this,"yellowCardsExtraTime",null);o(this,"shotsBlocked",null);o(this,"shotsBlockedFirstHalf",null);o(this,"shotsBlockedSecondHalf",null);o(this,"shotsBlockedExtraTime",null);o(this,"substitutions",null);o(this,"substitutionsFirstHalf",null);o(this,"substitutionsSecondHalf",null);o(this,"substitutionsExtraTime",null);o(this,"counterAttacks",null);o(this,"counterAttacksFirstHalf",null);o(this,"counterAttacksSecondHalf",null);o(this,"counterAttacksExtraTime",null);o(this,"foulsCommitted",null);o(this,"foulsCommittedFirstHalf",null);o(this,"foulsCommittedSecondHalf",null);o(this,"foulsCommittedExtraTime",null)}},$k=class{constructor(){o(this,"statEntityFromResponse",e=>({homeTeam:e?e.home_team:null,awayTeam:e?e.away_team:null}))}fromResponse(e){try{let t=new Fk;return t.corners=this.statEntityFromResponse(e.corners),t.cornersFirstHalf=this.statEntityFromResponse(e.corners_1h),t.cornersSecondHalf=this.statEntityFromResponse(e.corners_2h),t.cornersExtraTime=this.statEntityFromResponse(e.corners_et),t.crosses=this.statEntityFromResponse(e.crosses),t.crossesFirstHalf=this.statEntityFromResponse(e.crosses_1h),t.crossesSecondHalf=this.statEntityFromResponse(e.crosses_2h),t.crossesExtraTime=this.statEntityFromResponse(e.crosses_et),t.offside=this.statEntityFromResponse(e.offside),t.offsideFirstHalf=this.statEntityFromResponse(e.offside_1h),t.offsideSecondHalf=this.statEntityFromResponse(e.offside_2h),t.offsideExtraTime=this.statEntityFromResponse(e.offside_et),t.shotsOn=this.statEntityFromResponse(e.shots_on),t.shotsOnFirstHalf=this.statEntityFromResponse(e.shots_on_1h),t.shotsOnSecondHalf=this.statEntityFromResponse(e.shots_on_2h),t.shotsOnExtraTime=this.statEntityFromResponse(e.shots_on_et),t.throwIn=this.statEntityFromResponse(e.throw_in),t.throwInFirstHalf=this.statEntityFromResponse(e.throw_in_1h),t.throwInSecondHalf=this.statEntityFromResponse(e.throw_in_2h),t.throwInExtraTime=this.statEntityFromResponse(e.throw_in_et),t.redCards=this.statEntityFromResponse(e.red_cards),t.redCardsFirstHalf=this.statEntityFromResponse(e.red_cards_1h),t.redCardsSecondHalf=this.statEntityFromResponse(e.red_cards_2h),t.redCardsExtraTime=this.statEntityFromResponse(e.red_cards_et),t.shotsOff=this.statEntityFromResponse(e.shots_off),t.shotsOffFirstHalf=this.statEntityFromResponse(e.shots_off_1h),t.shotsOffSecondHalf=this.statEntityFromResponse(e.shots_off_2h),t.shotsOffExtraTime=this.statEntityFromResponse(e.shots_off_et),t.goalKicks=this.statEntityFromResponse(e.goal_kicks),t.goalKicksFirstHalf=this.statEntityFromResponse(e.goal_kicks_1h),t.goalKicksSecondHalf=this.statEntityFromResponse(e.goal_kicks_2h),t.goalKicksExtraTime=this.statEntityFromResponse(e.goal_kicks_et),t.possession=this.statEntityFromResponse(e.possession),t.possessionFirstHalf=this.statEntityFromResponse(e.possession_1h),t.possessionSecondHalf=this.statEntityFromResponse(e.possession_2h),t.possessionExtraTime=this.statEntityFromResponse(e.possession_et),t.treatments=this.statEntityFromResponse(e.treatments),t.treatmentsFirstHalf=this.statEntityFromResponse(e.treatments_1h),t.treatmentsSecondHalf=this.statEntityFromResponse(e.treatments_2h),t.treatmentsExtraTime=this.statEntityFromResponse(e.treatments_et),t.yellowCards=this.statEntityFromResponse(e.yellow_cards),t.yellowCardsFirstHalf=this.statEntityFromResponse(e.yellow_cards_1h),t.yellowCardsSecondHalf=this.statEntityFromResponse(e.yellow_cards_2h),t.yellowCardsExtraTime=this.statEntityFromResponse(e.yellow_cards_et),t.shotsBlocked=this.statEntityFromResponse(e.shots_blocked),t.shotsBlockedFirstHalf=this.statEntityFromResponse(e.shots_blocked_1h),t.shotsBlockedSecondHalf=this.statEntityFromResponse(e.shots_blocked_2h),t.shotsBlockedExtraTime=this.statEntityFromResponse(e.shots_blocked_et),t.substitutions=this.statEntityFromResponse(e.substitutions),t.substitutionsFirstHalf=this.statEntityFromResponse(e.substitutions_1h),t.substitutionsSecondHalf=this.statEntityFromResponse(e.substitutions_2h),t.substitutionsExtraTime=this.statEntityFromResponse(e.substitutions_et),t.counterAttacks=this.statEntityFromResponse(e.counter_attacks),t.counterAttacksFirstHalf=this.statEntityFromResponse(e.counter_attacks_1h),t.counterAttacksSecondHalf=this.statEntityFromResponse(e.counter_attacks_2h),t.counterAttacksExtraTime=this.statEntityFromResponse(e.counter_attacks_et),t.foulsCommitted=this.statEntityFromResponse(e.fouls_committed),t.foulsCommittedFirstHalf=this.statEntityFromResponse(e.fouls_committed_1h),t.foulsCommittedSecondHalf=this.statEntityFromResponse(e.fouls_committed_2h),t.foulsCommittedExtraTime=this.statEntityFromResponse(e.fouls_committed_et),t}catch(t){throw console.warn("There was a problem remapping the stats",t),t}}},Bv=class{constructor(){o(this,"homeTeam",{players:[]});o(this,"awayTeam",{players:[]})}},Nk=class{constructor(){o(this,"id","");o(this,"name","");o(this,"position","");o(this,"shirtNumber");o(this,"assets",null);o(this,"type","")}},jv=class{fromResponse(e){try{let t=new Nk;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}}},Bk=class{constructor(){o(this,"playerRemapper",null);this.playerRemapper=new jv}fromResponse(e){try{let t=new Bv;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}}},jk=class{constructor(){o(this,"minute","");o(this,"type","");o(this,"teamId","");o(this,"player",null);o(this,"relatedPlayer",null);o(this,"updatedAt","")}},zk=class{constructor(){o(this,"playerRemapper",null);this.playerRemapper=new jv}fromResponse(e){try{let t=new jk;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}}},Hk=class{constructor(){o(this,"playerId",null);o(this,"minutesPlayed",null);o(this,"yellowCards",null);o(this,"redCards",null);o(this,"goals",null);o(this,"penaltyGoals",null);o(this,"penaltyCommitted",null);o(this,"penaltyWon",null);o(this,"penaltyMissed",null);o(this,"penaltySaved",null);o(this,"penaltyReceived",null);o(this,"ownGoals",null);o(this,"assists",null);o(this,"cleanSheets",null);o(this,"shots",null);o(this,"shotsOn",null);o(this,"shotsBlocked",null);o(this,"offsides",null);o(this,"foulsCommitted",null);o(this,"foulsWon",null);o(this,"tackles",null);o(this,"tacklesBlocks",null);o(this,"tacklesInterceptions",null);o(this,"concededGoals",null);o(this,"caughtBall",null);o(this,"saves",null);o(this,"passes",null);o(this,"crosses",null);o(this,"interceptions",null);o(this,"keyPasses",null);o(this,"passesAccuracy",null);o(this,"duels",null);o(this,"duelsWon",null);o(this,"dribblesAttempts",null);o(this,"dribblesSuccess",null);o(this,"dribblesPast",null);o(this,"updatedAt",null)}},Uk=class{fromResponse(e){try{let t=new Hk;return t.playerId=e.player_id,t.minutesPlayed=e.minutes_played,t.yellowCards=e.yellow_cards,t.redCards=e.red_cards,t.goals=e.goals,t.penaltyGoals=e.penalty_goals,t.penaltyCommitted=e.penalty_committed,t.penaltyWon=e.penalty_won,t.penaltyMissed=e.penalty_missed,t.penaltySaved=e.penalty_saved,t.penaltyReceived=e.penalty_received,t.ownGoals=e.own_goals,t.assists=e.assists,t.cleanSheets=e.clean_sheets,t.shots=e.shots,t.shotsOn=e.shots_on,t.shotsBlocked=e.shots_blocked,t.offsides=e.offsides,t.foulsCommitted=e.fouls_committed,t.foulsWon=e.fouls_won,t.tackles=e.tackles,t.tacklesBlocks=e.tackles_blocks,t.tacklesInterceptions=e.tackles_interceptions,t.concededGoals=e.conceded_goals,t.caughtBall=e.caught_ball,t.saves=e.saves,t.passes=e.passes,t.crosses=e.crosses,t.interceptions=e.interceptions,t.keyPasses=e.key_passes,t.passesAccuracy=e.passes_accuracy,t.duels=e.duels,t.duelsWon=e.duels_won,t.dribblesAttempts=e.dribbles_attempts,t.dribblesSuccess=e.dribbles_success,t.dribblesPast=e.dribbles_past,t.updatedAt=e.updated_at,t}catch(t){throw console.warn("There was a problem remapping the player stats",t),t}}},Vk=class{constructor(){o(this,"teamMapper",null);o(this,"competitionsMapper",null);o(this,"lineupsMapper",null);o(this,"scoresMapper",null);o(this,"statsMapper",null);o(this,"timelineMapper",null);o(this,"playerStatsMapper",null);this.teamMapper=new pi,this.competitionsMapper=new ea,this.lineupsMapper=new Bk,this.scoresMapper=new Nv,this.statsMapper=new $k,this.timelineMapper=new zk,this.playerStatsMapper=new Uk}fromResponse(e){try{let t=new Lk;return t.id=e.id,t.kickoffAt=e.kickoff_at,t.finishedAt=e.finished_at,t.updatedAt=e.updated_at,t.isDeleted=e.is_deleted,t.undecided=e.undecided,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.playerStats=e.player_stats?e.player_stats.map(r=>this.playerStatsMapper.fromResponse(r)):e.player_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 Bv,t}catch(t){throw console.warn("There was a problem remapping the match response",t),t}}},Wk=class{constructor(){o(this,"id","");o(this,"country",null);o(this,"birthDate","");o(this,"firstName","");o(this,"lastName","");o(this,"name","");o(this,"position","");o(this,"assets",null)}},qk=class{constructor(){o(this,"countryRemapper",null);this.countryRemapper=new An}fromResponse(e){try{let t=new Wk;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}}},Gk=class{constructor(){o(this,"id","");o(this,"country",null);o(this,"birthDate","");o(this,"firstName","");o(this,"lastName","");o(this,"name","");o(this,"position","");o(this,"assets",null);o(this,"isDeleted",!1);o(this,"teams",[])}},zv=class{constructor(){o(this,"countryRemapper",null);o(this,"teamRemapper",null);this.countryRemapper=new An,this.teamRemapper=new pi}fromResponse(e){try{let t=new Gk;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.isDeleted=e.is_deleted,t}catch(t){throw console.warn("There was a problem remapping players response",t),t}}},Yk=class{constructor(){o(this,"id","");o(this,"country",null);o(this,"birthDate","");o(this,"firstName","");o(this,"lastName","");o(this,"name","");o(this,"position","");o(this,"assets",null);o(this,"isDeleted",!1);o(this,"competitions",[]);o(this,"teams",[])}},Kk=class{constructor(){o(this,"countryRemapper",null);o(this,"teamRemapper",null);o(this,"competitionRemapper",null);this.countryRemapper=new An,this.teamRemapper=new pi,this.competitionRemapper=new ea}fromResponse(e){try{let t=new Yk;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.isDeleted=e.is_deleted,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}}},Qk=class{constructor(){o(this,"teams",null);o(this,"players",null);o(this,"competitions",null)}},Jk=class{constructor(){o(this,"teamRemapper",null);o(this,"playerRemapper",null);o(this,"competitionremapper",null);this.teamRemapper=new pi,this.playerRemapper=new zv,this.competitionremapper=new ea}fromResponse(e){try{let t=new Qk;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}}},cl=class{constructor(){o(this,"meta",new Zi);o(this,"data",[])}},Xk=class{constructor(){o(this,"remapMetaProp",e=>{let t=new Zi;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})}},Zk=class{constructor(){o(this,"templateId",null);o(this,"playerId",null)}},eR=class{constructor(){o(this,"filters",new Zk)}},tR=class{constructor(){o(this,"meta",new eR);o(this,"data",[])}},rR=class{constructor(){o(this,"templateId",null)}},nR=class{constructor(){o(this,"filters",new rR)}},iR=class{constructor(){o(this,"meta",new nR);o(this,"data",[])}},Hv=class{constructor(){o(this,"total",null);o(this,"minutesPlayed",null);o(this,"yellowCards",null);o(this,"redCards",null);o(this,"goals",null);o(this,"penaltyGoals",null);o(this,"ownGoals",null);o(this,"assists",null);o(this,"cleanSheets",null);o(this,"shots",null);o(this,"shotsOn",null);o(this,"offsides",null);o(this,"foulsCommitted",null);o(this,"penaltyCommitted",null);o(this,"penaltyWon",null);o(this,"penaltyMissed",null);o(this,"tackles",null);o(this,"concededGoals",null);o(this,"caughtBall",null);o(this,"saves",null)}},Uv=class{constructor(){o(this,"minutesPlayed",null);o(this,"yellowCards",null);o(this,"redCards",null);o(this,"goals",null);o(this,"penaltyGoals",null);o(this,"penaltyCommitted",null);o(this,"penaltyWon",null);o(this,"penaltyMissed",null);o(this,"penaltySaved",null);o(this,"penaltyReceived",null);o(this,"ownGoals",null);o(this,"assists",null);o(this,"cleanSheets",null);o(this,"shots",null);o(this,"shotsOn",null);o(this,"shotsBlocked",null);o(this,"offsides",null);o(this,"foulsCommitted",null);o(this,"foulsWon",null);o(this,"tackles",null);o(this,"tacklesBlocks",null);o(this,"tacklesInterceptions",null);o(this,"concededGoals",null);o(this,"caughtBall",null);o(this,"saves",null);o(this,"passes",null);o(this,"crosses",null);o(this,"interceptions",null);o(this,"keyPasses",null);o(this,"passesAccuracy",null);o(this,"duels",null);o(this,"duelsWon",null);o(this,"dribblesAttempts",null);o(this,"dribblesSuccess",null);o(this,"dribblesPast",null)}},aR=class{constructor(){o(this,"matchId",null);o(this,"matchModel",null);o(this,"points",new Hv);o(this,"stats",new Uv)}},oR=class{constructor(){o(this,"playerId",null);o(this,"playerModel",null);o(this,"points",null);o(this,"rank",null)}},sR=class{constructor(){o(this,"remapPlayersPoints",e=>{let t=new iR;return t.meta.filters.templateId=e.meta.filters.template_id,t.data=e.data.map(r=>this.remapPlayersPointsData(r)),t});o(this,"remapPlayersPointsData",e=>{let t=new oR;return t.playerId=e.player_id,t.points=e.points,t.rank=e.rank,t});o(this,"remapPlayerDetailedStats",e=>{let t=new tR;return t.meta.filters.templateId=e.meta.filters.template_id,t.meta.filters.playerId=e.meta.filters.player_id,t.data=e.data.map(r=>this.remapPlayerDetailedData(r)),t});o(this,"remapPlayerDetailedData",e=>{let t=new aR;return t.matchId=e.match_id,t.points=e.points?this.remapPlayerDetailedPoints(e.points):null,t.stats=e.stats?this.remapPlayerDetailedStatsData(e.stats):null,t});o(this,"remapPlayerDetailedPoints",e=>{let t=new Hv;return t.total=e.total,t.minutesPlayed=e.minutes_played,t.yellowCards=e.yellow_cards,t.redCards=e.red_cards,t.goals=e.goals,t.penaltyGoals=e.penalty_goals,t.ownGoals=e.own_goals,t.assists=e.assists,t.cleanSheets=e.clean_sheets,t.shots=e.shots,t.shotsOn=e.shots_on,t.offsides=e.offsides,t.foulsCommitted=e.fouls_committed,t.penaltyCommitted=e.penalty_committed,t.penaltyWon=e.penalty_won,t.penaltyMissed=e.penalty_missed,t.tackles=e.tackles,t.concededGoals=e.conceded_goals,t.caughtBall=e.caught_ball,t.saves=e.saves,t});o(this,"remapPlayerDetailedStatsData",e=>{let t=new Uv;return t.minutesPlayed=e.minutes_played,t.yellowCards=e.yellow_cards,t.redCards=e.red_cards,t.goals=e.goals,t.penaltyGoals=e.penalty_goals,t.penaltyCommitted=e.penalty_committed,t.penaltyWon=e.penalty_won,t.penaltyMissed=e.penalty_missed,t.penaltySaved=e.penalty_saved,t.penaltyReceived=e.penalty_received,t.ownGoals=e.own_goals,t.assists=e.assists,t.cleanSheets=e.clean_sheets,t.shots=e.shots,t.shotsOn=e.shots_on,t.shotsBlocked=e.shots_blocked,t.offsides=e.offsides,t.foulsCommitted=e.fouls_committed,t.foulsWon=e.fouls_won,t.tackles=e.tackles,t.tacklesBlocks=e.tackles_blocks,t.tacklesInterceptions=e.tackles_interceptions,t.concededGoals=e.conceded_goals,t.caughtBall=e.caught_ball,t.saves=e.saves,t.passes=e.passes,t.crosses=e.crosses,t.interceptions=e.interceptions,t.keyPasses=e.key_passes,t.passesAccuracy=e.passes_accuracy,t.duels=e.duels,t.duelsWon=e.duels_won,t.dribblesAttempts=e.dribbles_attempts,t.dribblesSuccess=e.dribbles_success,t.dribblesPast=e.dribbles_past,t})}},So=class extends qr{constructor(t){super(t,Rr(t.environment,"football"));o(this,"limitIds",200);o(this,"countryRemapper",null);o(this,"competitionBasicRemapper",null);o(this,"competitionFullRemapper",null);o(this,"teamBasicRemapper",null);o(this,"teamFullRemapper",null);o(this,"matchBasicRemapper",null);o(this,"matchFullRemapper",null);o(this,"playerBasicRemapper",null);o(this,"playerFullRemapper",null);o(this,"topPlayerRemapper",null);o(this,"searchRemapper",null);o(this,"footballMetaRemapper",null);o(this,"fantasyRemapper",null);o(this,"footballService",null);o(this,"getCountries",t=>C(this,null,function*(){let r="There was a problem with the football countries request",n=`/countries${this.apiSignInUrl}`,i=Date.now();t&&(n+=`&disable_cache=${i}`);let a=yield this.fetchWithoutAuth(n,r);return this.countryRemapper.countriesFromResponse(a.data)}));o(this,"getCompetitions",(t,r)=>C(this,null,function*(){let n=Date.now(),i="There was a problem with football competitions request";if(r=r||!1,t&&t.competitionIds&&t.competitionIds.length>this.limitIds-1){let a=[],s=wo(t.competitionIds,this.limitIds);for(let l of s){t.competitionIds=l;let c=`/competitions${this.apiSignInUrl}${t.constructFilterUrl()}`;r&&(c+=`&disable_cache=${n}`);let u=yield this.fetchWithoutAuth(c,i);a.push(u.data.map(d=>this.competitionBasicRemapper.fromResponse(d)))}return Array.prototype.concat.apply([],a)}else{let a=`/competitions${this.apiSignInUrl}`;return t&&(a+=`${t.constructFilterUrl()}`),r&&(a+=`&disable_cache=${n}`),(yield this.fetchWithoutAuth(a,i)).data.map(s=>this.competitionBasicRemapper.fromResponse(s))}}));o(this,"getCompetitionById",(t,r)=>C(this,null,function*(){let n=`/competitions/${t}${this.apiSignInUrl}`,i="There was a problem with football competition by ID request",a=Date.now();r&&(n+=`&disable_cache=${a}`);let s=yield this.fetchWithoutAuth(n,i);return this.competitionFullRemapper.fromResponse(s.data)}));o(this,"getTopCompetitions",t=>C(this,null,function*(){let r="There was a problem with top football competitions request",n=`/competitions/top${this.apiSignInUrl}`,i=Date.now();return t&&(n+=`&disable_cache=${i}`),(yield this.fetchWithoutAuth(n,r)).data.map(a=>this.competitionBasicRemapper.fromResponse(a))}));o(this,"getTeams",(t,r)=>C(this,null,function*(){let n=Date.now(),i="There was a problem with football teams request";if(t&&t.teamIds&&t.teamIds.length>this.limitIds){let a=[],s=wo(t.teamIds,this.limitIds);for(let l of s){t.teamIds=l;let c=`/teams${this.apiSignInUrl}${t.constructFilterUrl()}`;r&&(c+=`disable_cache=${n}`);let u=yield this.fetchWithoutAuth(c,i);a.push(u.data.map(d=>this.teamBasicRemapper.fromResponse(d)))}return Array.prototype.concat.apply([],a)}else{let a=new cl,s=`/teams${this.apiSignInUrl}`;t&&(s+=`${t.constructFilterUrl()}`),r&&(s+=`&disable_cache=${n}`);let l=yield this.fetchWithoutAuth(s,i);return a.meta=this.footballMetaRemapper.remapMetaProp(l.meta),a.data=l.data.map(c=>this.teamBasicRemapper.fromResponse(c)),a}}));o(this,"getTeamById",(t,r)=>C(this,null,function*(){let n="There was a problem with football team by ID request",i=`/teams/${t}${this.apiSignInUrl}`,a=Date.now();r&&(i+=`disable_cache=${a}`);let s=yield this.fetchWithoutAuth(i,n);return this.teamFullRemapper.fromResponse(s.data)}));o(this,"getTopTeams",t=>C(this,null,function*(){let r=`/teams/top${this.apiSignInUrl}`,n="There was a problem with top football teams request",i=Date.now();t&&(r+=`$disable_cache=${i}`);let a=yield this.fetchWithoutAuth(r,n);return a.data?a.data.map(s=>this.teamBasicRemapper.fromResponse(s)):[]}));o(this,"getNextMatchForTeam",(t,r)=>C(this,null,function*(){let n=`/teams/${t}/next-match${this.apiSignInUrl}`,i=Date.now(),a="There was a problem with next match for team request";r&&(n+=`&disable_cache=${i}`);let s=yield this.fetchWithoutAuth(n,a);return this.matchFullRemapper.fromResponse(s.data)}));o(this,"getPrevMatchForTeam",(t,r)=>C(this,null,function*(){let n=`/teams/${t}/previous-match${this.apiSignInUrl}`,i=Date.now(),a="There was a problem with previous match for team request";r&&(n+=`disable_cache=${i}`);let s=yield this.fetchWithoutAuth(n,a);return this.matchFullRemapper.fromResponse(s.data)}));o(this,"getPlayers",(t,r)=>C(this,null,function*(){let n=Date.now(),i="There was a problem with football players request";if(t&&t.playerIds&&t.playerIds.length>this.limitIds-1){let a=[],s=wo(t.playerIds,this.limitIds);for(let u of s){t.playerIds=u;let d=`/players${this.apiSignInUrl}${t.constructFilterUrl()}`;r&&(d+=`&disable_cache=${n}`);let f=yield this.fetchWithoutAuth(d,i);a.push(f.data.map(h=>this.teamBasicRemapper.fromResponse(h)))}let l=Array.prototype.concat.apply([],a),c=new cl;return c.data=l,c}else{let a=new cl,s=`/players${this.apiSignInUrl}`;t&&(s+=`${t.constructFilterUrl()}`),r&&(s+=`&disable_cache=${n}`);let l=yield this.fetchWithoutAuth(s,i);return a.meta=this.footballMetaRemapper.remapMetaProp(l.meta),a.data=l.data.map(c=>this.playerBasicRemapper.fromResponse(c)),a}}));o(this,"getPlayerById",(t,r)=>C(this,null,function*(){let n=`/players/${t}${this.apiSignInUrl}`,i=Date.now(),a="There was a problem with football player by ID request";r&&(n+=`&disable_cache=${i}`);let s=yield this.fetchWithoutAuth(n,a);return this.playerFullRemapper.fromResponse(s.data)}));o(this,"getTopPlayers",t=>C(this,null,function*(){let r=`/players/top${this.apiSignInUrl}`,n=Date.now();return t&&(r+=`&disable_cache=${n}`),(yield this.fetchWithoutAuth(r,"There was a problem with top football players request")).data.map(a=>this.topPlayerRemapper.fromResponse(a))}));o(this,"getNextMatchForPlayer",(t,r)=>C(this,null,function*(){let n=`/players/${t}/next-match${this.apiSignInUrl}`,i=Date.now(),a="There was a problem with next match for player request";r&&(n+=`&disable_cache=${i}`);let s=yield this.fetchWithoutAuth(n,a);return this.matchFullRemapper.fromResponse(s.data)}));o(this,"getPrevMatchForPlayer",(t,r)=>C(this,null,function*(){let n=`/players/${t}/previous-match${this.apiSignInUrl}`,i=Date.now(),a="There was a problem with previous match for player request";r&&(n+=`&disable_cache=${i}`);let s=yield this.fetchWithoutAuth(n,a);return this.matchFullRemapper.fromResponse(s.data)}));o(this,"getMatchById",(t,r)=>C(this,null,function*(){let n=`/matches/${t}${this.apiSignInUrl}`,i=Date.now(),a="There was a problem with match by ID request";r&&(n+=`&disable_cache=${i}`);let s=yield this.fetchWithoutAuth(n,a);return this.matchFullRemapper.fromResponse(s.data)}));o(this,"getMatches",(t,r)=>C(this,null,function*(){let n=new cl,i="There was a problem with football matches request";if(t&&t.matchIds&&t.matchIds.length>this.limitIds){let a=[],s=wo(t.matchIds,this.limitIds);for(let c of s){t.matchIds=c;let u=!0,d=`/matches${this.apiSignInUrl}${t.constructFilterUrl(u)}&limit=${c.length}`;r&&(d+=Ze());let f=yield this.fetchWithoutAuth(d,i);a.push(f.data.map(h=>this.matchBasicRemapper.fromResponse(h)))}let l=Array.prototype.concat.apply([],a);return n.meta=this.footballService.setMetaDataBatchRequest(l.length,t.limit||20,t.page||1),n.data=this.footballService.finalizeMatchesDataBatchRequest(l,t),n}else{let a=`/matches${this.apiSignInUrl}`;t&&(a+=`${t.constructFilterUrl()}`),r&&(a+=Ze());let s=yield this.fetchWithoutAuth(a,i);return n.meta=this.footballMetaRemapper.remapMetaProp(s.meta),n.data=s.data.map(l=>this.matchBasicRemapper.fromResponse(l)),n}}));o(this,"search",(t,r)=>C(this,null,function*(){let n=`/search${this.apiSignInUrl}${t.constructFilterUrl()}`,i=Date.now(),a="There was a problem with football search request";r&&(n+=`&disable_cache=${i}`);let s=yield this.fetchWithoutAuth(n,a);return this.searchRemapper.fromResponse(s.data)}));o(this,"getPlayersPoints",(t,r,n)=>C(this,null,function*(){let i=`/players/points/${t}${this.apiSignInUrl}`,a=Date.now(),s="There was a problem with players points request";r&&(i+=`&position=${r.toLocaleLowerCase()}`),n&&(i+=`&disable_cache=${a}`);let l=yield this.fetchWithoutAuth(i,s);return this.fantasyRemapper.remapPlayersPoints(l)}));o(this,"getPlayerDetailedStatistics",(t,r,n)=>C(this,null,function*(){let i=`/players/${r}/points/${t}${this.apiSignInUrl}`,a=Date.now(),s="There was a problem with detailed player points request";n&&(i+=`&disable_cache=${a}`);let l=yield this.fetchWithoutAuth(i,s);return this.fantasyRemapper.remapPlayerDetailedStats(l)}));this.apiSignInUrl=t.lang!=="en"?this.apiSignInUrl+`&lang=${t.lang}`:this.apiSignInUrl,this.countryRemapper=new An,this.competitionBasicRemapper=new ea,this.competitionFullRemapper=new Tk,this.teamBasicRemapper=new pi,this.teamFullRemapper=new kk,this.matchBasicRemapper=new Dk,this.matchFullRemapper=new Vk,this.playerBasicRemapper=new zv,this.playerFullRemapper=new Kk,this.topPlayerRemapper=new qk,this.searchRemapper=new Jk,this.footballMetaRemapper=new Xk,this.footballService=new sl(t),this.fantasyRemapper=new sR}},ul=(e=>(e.FT_1X2="FT_1X2",e.HT_1X2="HT_1X2",e.BOTH_TEAMS_SCORE="BOTH_TEAMS_SCORE",e.DOUBLE_CHANCE="DOUBLE_CHANCE",e.HT_FT="HT_FT",e.PLAYER_SCORE="PLAYER_SCORE",e.PLAYER_YELLOW_CARD="PLAYER_YELLOW_CARD",e.PLAYER_RED_CARD="PLAYER_RED_CARD",e.RED_CARD_MATCH="RED_CARD_MATCH",e.PENALTY_MATCH="PENALTY_MATCH",e.PLAYER_SCORE_FIRST_GOAL="PLAYER_SCORE_FIRST_GOAL",e.CORNERS_MATCH="CORNERS_MATCH",e.CORRECT_SCORE="CORRECT_SCORE",e.CORRECT_SCORE_ADVANCED="CORRECT_SCORE_ADVANCED",e.CORRECT_SCORE_HT="CORRECT_SCORE_HT",e.PLAYER_SCORE_HATTRICK="PLAYER_SCORE_HATTRICK",e.PLAYER_SCORE_TWICE="PLAYER_SCORE_TWICE",e.OVER_GOALS_0_5="OVER_GOALS_0_5",e.OVER_GOALS_1_5="OVER_GOALS_1_5",e.OVER_GOALS_2_5="OVER_GOALS_2_5",e.OVER_GOALS_3_5="OVER_GOALS_3_5",e.OVER_GOALS_4_5="OVER_GOALS_4_5",e.OVER_GOALS_5_5="OVER_GOALS_5_5",e.OVER_GOALS_6_5="OVER_GOALS_6_5",e.OVER_CORNERS_6_5="OVER_CORNERS_6_5",e.OVER_CORNERS_7_5="OVER_CORNERS_7_5",e.OVER_CORNERS_8_5="OVER_CORNERS_8_5",e.OVER_CORNERS_9_5="OVER_CORNERS_9_5",e.OVER_CORNERS_10_5="OVER_CORNERS_10_5",e.OVER_CORNERS_11_5="OVER_CORNERS_11_5",e.OVER_CORNERS_12_5="OVER_CORNERS_12_5",e.OVER_CORNERS_13_5="OVER_CORNERS_13_5",e))(ul||{}),lR=["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"],cR=["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"],Vn=["PLAYER_RED_CARD","PLAYER_SCORE","PLAYER_SCORE_FIRST_GOAL","PLAYER_SCORE_HATTRICK","PLAYER_SCORE_TWICE","PLAYER_YELLOW_CARD"],uR=["FT_1X2","HT_1X2","HT_FT","DOUBLE_CHANCE","CORNERS_MATCH","CORRECT_SCORE","CORRECT_SCORE_HT","CORRECT_SCORE_ADVANCED"],dl="PLAYER_SCORE_FIRST_GOAL",dR=class{constructor(){o(this,"id","");o(this,"achievedAt","")}},Vv=class{constructor(){o(this,"participationCount",null);o(this,"points",null)}},Wv=class{constructor(){o(this,"totalPoints",null);o(this,"postPoints",null);o(this,"postsMade",null);o(this,"reactionPoints",null);o(this,"reactionCount",null)}},qv=class{constructor(){o(this,"participationCount",null)}},Gv=class{constructor(){o(this,"participations",0);o(this,"points",0)}},Od=class{constructor(){o(this,"footballCompetitions",[]);o(this,"footballTeams",[])}},Yv=class{constructor(){o(this,"predictionsMade",0);o(this,"correct",0);o(this,"points",0);o(this,"breakdown",new Od)}},Kv=class{constructor(){o(this,"single",new Yv);o(this,"topX",new Gv);o(this,"matchQuiz",new Gv)}},fR=class{constructor(){o(this,"overallPercent");o(this,"byFootballCompetition");o(this,"byFootballTeam");o(this,"byFootballMarket")}},hR=class{constructor(){o(this,"profileId");o(this,"tier");o(this,"points");o(this,"predictionsMade");o(this,"successRates",new fR);o(this,"predictions",new Kv);o(this,"tiers",[]);o(this,"badges",[]);o(this,"discussions",new Wv);o(this,"classicQuizzes",new Vv);o(this,"eitherOr",new qv)}},pR=class{constructor(){o(this,"entityId","");o(this,"entityType","");o(this,"entitySource","");o(this,"model",null);o(this,"predictionsMade",0);o(this,"correct",0);o(this,"points",0)}},mR=class{constructor(){o(this,"successRatePercent");o(this,"model",null)}},Pd=class{constructor(){o(this,"content",null);o(this,"tags",[]);o(this,"campaign",null)}},Qv=class{constructor(){o(this,"id",null);o(this,"profileId",null);o(this,"property",null);o(this,"value",null);o(this,"action",null);o(this,"context",new Pd);o(this,"points",0)}},gR=class{constructor(){o(this,"meta",new Zi);o(this,"data",[new Qv])}},vR=class{constructor(){o(this,"remapSingleResponse",e=>{let t=new Qv;return t.id=e.id,t.profileId=e.profile_id,t.property=e.property,t.value=e.value,t.action=e.action,t.context.content=e.context.content,t.context.tags=e.context.tags,t.context.campaign=e.context.campaign,t.points=e.points,t});o(this,"remapActivitiesResponse",e=>{let t=new gR;return t.meta.pagination.currentPage=e.meta.pagination.current_page,t.meta.pagination.itemsPerPage=e.meta.pagination.items_per_page,t.meta.pagination.numberOfPages=e.meta.pagination.number_of_pages,t.meta.pagination.totalItems=e.meta.pagination.total_items,t.data=e.data.map(r=>this.remapSingleResponse(r)),t});o(this,"remapStatsResponse",e=>{let t=new hR;return t.profileId=e.profile_id,t.tier=e.tier,t.points=e.points,t.predictionsMade=e.predictions_made,t.successRates.overallPercent=e.success_rates.overall_percent,t.successRates.byFootballCompetition=this.constructNewRecord(e.success_rates.by_competition),t.successRates.byFootballTeam=this.constructNewRecord(e.success_rates.by_team),t.successRates.byFootballMarket=this.constructNewRecord(e.success_rates.by_market),t.predictions=e.predictions?this.remapPredictionsStats(e.predictions):null,t.tiers=e.tiers?this.remapAchievementsStats(e.tiers):null,t.badges=e.badges?this.remapAchievementsStats(e.badges):null,t.discussions=e.discussions?this.remapDiscussionStats(e.discussions):null,t.classicQuizzes=e.classic_quizzes?this.remapClassicQuizStats(e.classic_quizzes):null,t.eitherOr=e.either_or?this.remapEitherOrStats(e.either_or):null,t});o(this,"constructNewRecord",e=>{let t;if(Object.entries(e).length)Object.entries(e).forEach(([r,n])=>{t=ge(he({},t),{[r]:this.remapSuccessRatePercent(n)}),ul[r]&&delete t[r].model});else return e;return t});o(this,"remapSuccessRatePercent",e=>{let t=new mR;return t.successRatePercent=e.success_rate_percent,t});o(this,"remapPredictionsStats",e=>{let t=new Kv;return t.single=this.remapSinglePredictionsStats(e.single),t.topX=e.top_x,t.matchQuiz=e.match_quiz,t});o(this,"remapSinglePredictionsStats",e=>{let t=new Yv;return t.predictionsMade=e.predictions_made,t.correct=e.correct,t.points=e.points,t.breakdown=this.remapBreakdownSinglePredictionsStats(e.breakdown),t});o(this,"remapBreakdownSinglePredictionsStats",e=>{if(e&&Object.keys(e).length){let t=new Od,r=[],n=[];return Object.keys(e).forEach(i=>{let a=new pR;a.entityId=i,a.entityType=e[i].entity_type,a.entitySource=e[i].entity_source,a.predictionsMade=e[i].predictions_made,a.correct=e[i].correct,a.points=e[i].points,a.entityType==="competition"?r.push(a):a.entityType==="team"&&n.push(a)}),t.footballCompetitions=r,t.footballTeams=n,t}return new Od});o(this,"remapAchievementsStats",e=>e.map(t=>{let r=new dR;return r.id=t.id,r.achievedAt=t.achieved_at,r}));o(this,"remapDiscussionStats",e=>{let t=new Wv;return t.totalPoints=e.total_points,t.postPoints=e.post_points,t.postsMade=e.posts_made,t.reactionPoints=e.reaction_points,t.reactionCount=e.reaction_count,t});o(this,"remapClassicQuizStats",e=>{let t=new Vv;return t.participationCount=e.participation_count,t.points=e.points,t});o(this,"remapEitherOrStats",e=>{let t=new qv;return t.participationCount=e.participation_count,t})}},Jv=class extends qr{constructor(t){super(t,Rr(t.environment,"loyalty"));o(this,"activityRemapper",null);o(this,"createActivity",t=>C(this,null,function*(){let r=`/activities${this.apiSignInUrl}`,n="There was a problem with creating activity",i="POST",a=yield this.fetchWithAuth(r,n,i,t);return this.activityRemapper.remapSingleResponse(a)}));o(this,"deleteActivity",t=>C(this,null,function*(){let r=`/activities/${t}${this.apiSignInUrl}`,n=`There was a problem deleting the following activity: ${t}`;return yield this.fetchWithAuth(r,n,"DELETE"),!0}));o(this,"getOwnActivities",(t,r)=>C(this,null,function*(){let n=`/activities${this.apiSignInUrl}`,i=Date.now(),a="There was a problem with fetching own activities";t&&(n+=`${t.constructFilterUrl()}`),r&&(n+=`disable_cache=${i}`);let s=yield this.fetchWithAuth(n,a);return this.activityRemapper.remapActivitiesResponse(s)}));o(this,"getActivitiesForUser",(t,r,n)=>C(this,null,function*(){let i=`/users/${t}/activities${this.apiSignInUrl}`,a=Date.now(),s=`There was a problem with fetching activities for user: ${t}`;r&&(i+=`${r.constructFilterUrl()}`),n&&(i+=`disable_cache=${a}`);let l=yield this.fetchWithoutAuth(i,s);return this.activityRemapper.remapActivitiesResponse(l)}));o(this,"getStats",(t,r)=>C(this,null,function*(){let n="",i="",a=null;return t?(n+=ut(r)?`/users/${t}/statistics${this.apiSignInUrl}${Ze()}`:`/users/${t}/statistics${this.apiSignInUrl}`,i=`There was a problem fetching statistics for profile: ${t}`,a=yield this.fetchWithoutAuth(n,i)):(n+=`/statistics${this.apiSignInUrl}`,i="There was a problem fetching profile`s statistics",a=yield this.fetchWithAuth(n,i)),this.activityRemapper.remapStatsResponse(a.data)}));this.activityRemapper=new vR}},yR=class{constructor(){o(this,"id","");o(this,"source","");o(this,"type","");o(this,"favourite",!1)}},bR=class extends yR{constructor(){super(...arguments);o(this,"model",null)}},wR=class{constructor(e,t,r){o(this,"idMapping",null);o(this,"idSchema",null);o(this,"native","native");o(this,"footballFacade",null);o(this,"remapProfileStats",e=>C(this,null,function*(){if(!e.predictions)return e;let{successRates:t,predictions:r}=e,n={competition:this.getIdsKeys(t.byFootballCompetition,r.single.breakdown.footballCompetitions),team:this.getIdsKeys(t.byFootballTeam,r.single.breakdown.footballTeams)};if(Object.values(n.competition).length){let i=JSON.parse(JSON.stringify(e.successRates.byFootballCompetition)),a=yield this.getEntitiesMap(n.competition,"competition"),s=yield this.setSuccessRatesModels(i,a);e.successRates.byFootballCompetition=s,r.single.breakdown.footballCompetitions=this.reconstructBreakdown(r.single.breakdown.footballCompetitions,a)}if(Object.values(n.team).length){let i=JSON.parse(JSON.stringify(e.successRates.byFootballTeam)),a=yield this.getEntitiesMap(n.team,"team"),s=yield this.setSuccessRatesModels(i,a);e.successRates.byFootballTeam=s,r.single.breakdown.footballTeams=this.reconstructBreakdown(r.single.breakdown.footballTeams,a)}return e}));o(this,"setSuccessRatesModels",(e,t)=>C(this,null,function*(){return this.reconstructRecords(e,void 0,t)}));o(this,"getEntitiesMap",(e,t)=>C(this,null,function*(){switch(t){case"competition":return yield this.footballFacade.getCompetitionsMapWithNativeIds(e);case"team":return yield this.footballFacade.getTeamsMapWithNativeIds(e)}}));o(this,"reconstructRecords",(e,t,r)=>e&&Object.keys(e).length?(Object.keys(e).forEach(n=>{let i=r.get(n);t=ge(he({},t),{[i.id]:e[n]}),t[i.id].model=i}),t):e);o(this,"reconstructBreakdown",(e,t)=>e.length?e.map(r=>{let n=t.get(r.entityId);return r.entityId=n.id,r.model=n,r}):e);o(this,"getIdsKeys",(e,t)=>{let r=Object.keys(e);if(t.length){let n=t.map(i=>i.entityId);return Array.from(new Set([...r,...n]))}return r});o(this,"remapInterestsToIdSchema",e=>C(this,null,function*(){if(this.idSchema!==this.native)if(e&&e.length>0){let t={},r={},n=e.filter(l=>l.source.toLocaleUpperCase()==="FOOTBALL"),i=e.filter(l=>l.source.toLocaleUpperCase()!=="FOOTBALL");n.forEach(l=>{t.hasOwnProperty(l.type)||(t[l.type]=[],r[l.type]=[]),t[l.type].push(l.id),r[l.type].push(l)});let a=yield this.remapIdsObj(t,this.native,this.idSchema),s=[];for(let[l,c]of Object.entries(r))c.forEach((u,d)=>{u.id=a[l][d],s.push(u)});return s.concat(i)}else return e;return e}));o(this,"remapInterestToNative",e=>C(this,null,function*(){if(this.idSchema!==this.native&&e.source.toLocaleUpperCase()==="FOOTBALL"){let t={},{id:r,type:n}=e;t[n]=[r];let i=yield this.remapIdsObj(t,this.idSchema,this.native);return e.id=i[n][0],e}return e}));o(this,"inquiryCustomInterests",(e,t)=>{let r=[];return e&&e.length>0&&(r=e.filter(n=>n.source.toLocaleUpperCase()==="CUSTOM"),t)?r.map(n=>{let i=new bR;return i.id=n.id,i.type=n.type,i.source=n.source,i.favourite=n.favourite,i}):r});o(this,"remapInterests",e=>C(this,null,function*(){let t=this.inquiryCustomInterests(e,!1);if(t&&t.length>0){let r=e.filter(i=>i.source.toLocaleUpperCase()!=="CUSTOM"),n=yield this.remapInterestsToIdSchema(r);return t.forEach(i=>n.push(i)),n}return yield this.remapInterestsToIdSchema(e)}));o(this,"showFullInterests",e=>C(this,null,function*(){let t=[];if(e&&e.length>0){let r=this.inquiryCustomInterests(e,!0);t.push(r);let n=e.filter(c=>c.source.toLocaleUpperCase()!=="CUSTOM"),{competitionsMap:i,teamsMap:a,playersMap:s}=yield this.getInterestsEntitiesMap(n),l=n.map(c=>{let u=null;if(c.source.toLocaleUpperCase()==="FOOTBALL"){if(c.type==="competition")return u=i.get(c.id),u&&(c.id=u.id),c.model=u,c;if(c.type==="team")return u=a.get(c.id),u&&(c.id=u.id),c.model=u,c;if(c.type==="player")return s?(c.model=s[c.id],c.id=s[c.id].id):c.model=u,c}else return c.model=u,c});return t.push(l),t.flat()}return t}));o(this,"getInterestsEntitiesMap",e=>C(this,null,function*(){let t=[],r=[],n=[],i=new Map,a=new Map,s=null;return e.forEach(l=>{l.type==="competition"&&l.source.toLocaleUpperCase()==="FOOTBALL"?t.push(l.id):l.type==="team"&&l.source.toLocaleUpperCase()==="FOOTBALL"?r.push(l.id):l.type==="player"&&l.source.toLocaleUpperCase()==="FOOTBALL"&&n.push(l.id)}),t.length&&(i=yield this.footballFacade.getCompetitionsMapWithNativeIds(t)),r.length&&(a=yield this.footballFacade.getTeamsMapWithNativeIds(r)),n.length&&(s=yield this.footballFacade.getPlayersMapWithNativeIds(n)),{competitionsMap:i,teamsMap:a,playersMap:s}}));o(this,"remapIdsObj",(e,t,r)=>C(this,null,function*(){return yield this.idMapping.idMappingFacade.getEntitiesByIds(e,t,r)}));this.idMapping=r,this.idSchema=e.idSchema,this.footballFacade=t}},_R=class{constructor(e,t){o(this,"idMapping",null);o(this,"profileOperations",null);o(this,"remapProfileStats",e=>C(this,null,function*(){return yield this.profileOperations.remapProfileStats(e)}));o(this,"remapInterestToNative",e=>C(this,null,function*(){return yield this.profileOperations.remapInterestToNative(e)}));o(this,"remapInterests",e=>C(this,null,function*(){return yield this.profileOperations.remapInterests(e)}));o(this,"showFullInterests",e=>C(this,null,function*(){return yield this.profileOperations.showFullInterests(e)}));this.idMapping=new dr(e),this.profileOperations=new wR(e,t,this.idMapping)}},Wn=class{constructor(e){o(this,"idsRemapper",null);o(this,"profileHttps",null);o(this,"activityHttps",null);o(this,"footballHttps",null);o(this,"footballFacade",null);o(this,"idMapping",null);o(this,"localCache",null);o(this,"profileFacade",null);o(this,"ownProfileBuilder",null);o(this,"profileBuilder",null);o(this,"getOwn",()=>this.ownProfileBuilder);o(this,"getById",e=>this.profileBuilder.setId(e));o(this,"getCountries",e=>C(this,null,function*(){return yield this.profileFacade.getCountries(e)}));o(this,"getByIds",(e,t,r)=>C(this,null,function*(){return yield this.profileFacade.getByIds(e,t,r)}));this.profileHttps=new bv(e),this.activityHttps=new Jv(e),this.footballHttps=new So(e),this.idMapping=new dr(e),this.localCache=new Co().createLocalCacheInstance(e.idSchema),this.footballFacade=new $v(e,this.localCache,this.footballHttps,this.idMapping),this.profileFacade=new ol(this.localCache,this.profileHttps,this.activityHttps),this.idsRemapper=new _R(e,this.footballFacade),this.ownProfileBuilder=new jP(e,this.idsRemapper,this.localCache,this.profileHttps,this.activityHttps),this.profileBuilder=new zP(this.idsRemapper,this.localCache,this.profileHttps,this.activityHttps)}},Xv=(e=>(e.EN="en",e.BG="bg",e.RO="ro",e.EL="el",e.SK="sk",e.PT="pt",e.SR="sr",e.HU="hu",e.SV="sv",e.ES="es",e.FR="fr",e.NL="nl",e.DE="de",e.IT="it",e))(Xv||{}),xR=class{constructor(){o(this,"validate",e=>{let t=this.validateField(e.lang),r=this.generateMessage(t);return{validation:t,message:r}});o(this,"validateField",e=>{let t=Object.values(Xv),r=null;return e!=null&&e.length>0?t.includes(e)?r="valid":r="invalid":r="missing",r});o(this,"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}})}},CR=class{constructor(){o(this,"validateField",e=>{let t=["dev","staging","prod","watg"],r=null;return e!=null&&e.length>0?t.includes(e)?r="valid":r="invalid":r="missing",r});o(this,"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}})}validate(e){let t=this.validateField(e.environment),r=this.generateMessage(t);return{validation:t,message:r}}},IR=class{constructor(){o(this,"validateField",e=>{let t=null;return e!=null&&e.length>0?t="valid":t="missing",t});o(this,"generateMessage",e=>{let t=null,r="error";return e==="missing"&&(t="The field apiKey with valid value must be provided to use Fans United JS SDK"),e==="valid"&&(r=null),{text:t,type:r}})}validate(e){let t=this.validateField(e.apiKey),r=this.generateMessage(t);return{validation:t,message:r}}},SR=class{constructor(){o(this,"validateField",e=>{let t=Object.values(wv),r=null;return e!=null&&e.length>0?t.includes(e)?r="valid":r="invalid":r="missing",r});o(this,"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}})}validate(e){let t=this.validateField(e.idSchema),r=this.generateMessage(t);return{validation:t,message:r}}},kd=class{constructor(){o(this,"getIdToken",null);o(this,"logout",null)}},Rd=class{constructor(){o(this,"text",null);o(this,"type",null)}},TR=class{constructor(){o(this,"validation",null);o(this,"message",new Rd);o(this,"getIdToken",{validation:null,message:new Rd});o(this,"logout",{validation:null,message:new Rd})}},ER=class{constructor(){o(this,"validateAuthProvider",e=>{let t=Object.keys(new kd),r=new TR;if(e){let n=Object.keys(e).filter(i=>!t.includes(i));n.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: ${n.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});o(this,"validateAuthProviderConfigFields",(e,t)=>(Object.keys(new kd).forEach(r=>{e[r]?t[r].validation="valid":t[r].validation="missing"}),t));o(this,"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));o(this,"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))}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}},Zv=class{constructor(){o(this,"validation");o(this,"message")}},AR=class{constructor(){o(this,"apiKey",null);o(this,"environment",null);o(this,"idSchema",null);o(this,"clientId",null);o(this,"lang",null);o(this,"errorHandlingMode",null);o(this,"authProvider",{getIdToken:new Zv,logout:new Zv});o(this,"isValid",!1)}},OR=class{constructor(){o(this,"validateField",e=>{let t=null;return e!=null&&e.length>0?t="valid":t="missing",t});o(this,"generateMessage",e=>{let t=null,r="error";return e==="missing"&&(t="The field clientId must be provided to use Fans United JS SDK"),e==="valid"&&(t=null,r=null),{text:t,type:r}})}validate(e){let t=this.validateField(e.clientId),r=this.generateMessage(t);return{validation:t,message:r}}},PR=class{constructor(){o(this,"validate",e=>{let t=this.validateField(e.errorHandlingMode),r=this.generateMessage(t);return{validation:t,message:r}});o(this,"validateField",e=>{let t=["default","standard"],r=null;return e?t.includes(e)?r="valid":r="invalid":r="missing",r});o(this,"generateMessage",e=>{let t=null,r="warning";return e==="missing"&&(t="If no errorHandlingMode is passed the default one will be set which is: default"),e==="invalid"&&(t="This errorHandlingMode value is not supported, the default one will be set which is: default"),e==="valid"&&(t=null,r=null),{text:t,type:r}})}},kR=class{constructor(){o(this,"validate",e=>{let t=this.checkFieldsForValues(e);return t.isValid=this.containsErrorMessage(t),t});o(this,"checkFieldsForValues",e=>{let t=new AR,r={apiKey:new IR,environment:new CR,idSchema:new SR,clientId:new OR,lang:new xR,errorHandlingMode:new PR,authProvider:new ER};for(let[n,i]of Object.entries(t))n!=="isValid"&&(i=r[n].validate(e));return Object.keys(r).forEach(n=>{t[n]=r[n].validate(e)}),t});o(this,"containsErrorMessage",e=>{let t=!0;for(let[r,n]of Object.entries(e))if(r!=="authProvider"){if(r!=="isValid"&&n.message.type==="error")return t=!1,t;if(r!=="isValid"&&n.message.type==="warning")return t=!0,t}else if(n.message.type==="error")return t=!1,t;return t})}},To=class{constructor(e){o(this,"https",null);o(this,"idMapping",null);o(this,"localCache",null);o(this,"footballFacade",null);o(this,"getCountries",e=>C(this,null,function*(){return yield this.footballFacade.getCountries(e)}));o(this,"getCompetitions",(e,t)=>C(this,null,function*(){return yield this.footballFacade.getCompetitions(e,t)}));o(this,"getCompetitionById",(e,t)=>C(this,null,function*(){return yield this.footballFacade.getCompetitionById(e,t)}));o(this,"getTopCompetitions",e=>C(this,null,function*(){return yield this.footballFacade.getTopCompetitions(e)}));o(this,"getTeams",(e,t)=>C(this,null,function*(){return yield this.footballFacade.getTeams(e,t)}));o(this,"getTeamById",(e,t)=>C(this,null,function*(){return yield this.footballFacade.getTeamById(e,t)}));o(this,"getTopTeams",e=>C(this,null,function*(){return yield this.footballFacade.getTopTeams(e)}));o(this,"getNextMatchForTeam",(e,t)=>C(this,null,function*(){return yield this.footballFacade.getNextMatchForTeam(e,t)}));o(this,"getPrevMatchForTeam",(e,t)=>C(this,null,function*(){return yield this.footballFacade.getPrevMatchForTeam(e,t)}));o(this,"getPlayers",(e,t)=>C(this,null,function*(){return yield this.footballFacade.getPlayers(e,t)}));o(this,"getPlayerById",(e,t)=>C(this,null,function*(){return yield this.footballFacade.getPlayerById(e,t)}));o(this,"getTopPlayers",e=>C(this,null,function*(){return yield this.footballFacade.getTopPlayers(e)}));o(this,"getNextMatchForPlayer",(e,t)=>C(this,null,function*(){return yield this.footballFacade.getNextMatchForPlayer(e,t)}));o(this,"getPrevMatchForPlayer",(e,t)=>C(this,null,function*(){return yield this.footballFacade.getPrevMatchForPlayer(e,t)}));o(this,"getMatches",(e,t)=>C(this,null,function*(){return yield this.footballFacade.getMatches(e,t)}));o(this,"getMatchById",(e,t)=>C(this,null,function*(){return yield this.footballFacade.getMatchById(e,t)}));o(this,"search",(e,t)=>C(this,null,function*(){return yield this.footballFacade.search(e,t)}));this.https=new So(e),this.idMapping=new dr(e),this.localCache=new Co().createLocalCacheInstance(e.idSchema),this.footballFacade=new $v(e,this.localCache,this.https,this.idMapping)}},RR=class{constructor(){o(this,"value",null);o(this,"playerId",null);o(this,"playerModel",null)}},ey=class{constructor(){o(this,"market",null);o(this,"matchId",null);o(this,"matchType",null);o(this,"matchModel",null);o(this,"prediction",new RR);o(this,"result",null)}},MR=class{constructor(){o(this,"value",!1);o(this,"playerId",null)}},ta=class{constructor(e,t,r,n){o(this,"matchId",null);o(this,"market",null);o(this,"matchType","FOOTBALL");o(this,"prediction",null);this.matchId=e,this.market=t,this.prediction=new MR,this.prediction.value=r,this.prediction.playerId=n}},ty=class{constructor(){o(this,"settledAt",null);o(this,"resettledAt",null);o(this,"status",null);o(this,"outcome",null);o(this,"points",0)}},DR=class{constructor(){o(this,"value",null)}},Md=class{constructor(e,t,r){o(this,"matchId",null);o(this,"market",null);o(this,"matchType","FOOTBALL");o(this,"prediction",null);this.matchId=e,this.market=t,this.prediction=new DR,this.prediction.value=r}},Eo=class{constructor(){o(this,"value",!1)}},ry=class{constructor(e,t,r){o(this,"matchId",null);o(this,"market",null);o(this,"matchType","FOOTBALL");o(this,"prediction",null);this.matchId=e,this.market=t,this.prediction=new Eo,this.prediction.value=r}},ny=class{constructor(e,t,r){o(this,"matchId",null);o(this,"market",null);o(this,"matchType","FOOTBALL");o(this,"prediction",null);this.matchId=e,this.market=t,this.prediction=new Eo,this.prediction.value=r}},LR=class{constructor(e,t,r){o(this,"matchFacade",null);o(this,"playerFacade",null);o(this,"predictorService",null);o(this,"remapFixturesRequest",e=>{let t={};if(t.match_id=e.matchId,t.match_type="FOOTBALL",e instanceof ta)t.market=e.market,t.prediction=e.prediction.value,t.player_id=e.prediction.playerId;else if(e instanceof ry||e instanceof ny)t.market=e.market,t.prediction=e.prediction.value;else if(e instanceof Md){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});o(this,"remapFixturesResponse",e=>C(this,null,function*(){let t="OWN_GOAL",r=[],n=[],i=null,a=[];e.length>1&&e.sort((l,c)=>l.match_id.localeCompare(c.match_id));for(let l of e)r.push(l.match_id),l.player_id&&!n.includes(l.player_id)&&n.push(l.player_id);let s=yield this.matchFacade.getMatchesMapWithNativeIds(r);n.sort((l,c)=>l.localeCompare(c)),n&&n.length>0&&!n.includes(t)&&(i=yield this.playerFacade.getPlayersMapWithNativeIds(n));for(let l of e){let c=new ey;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?s[l.match_id]:null,delete c.matchModel.availableMarkets,l.prediction!==void 0?c.prediction.value=l.prediction:l.goals_home!==void 0&&l.goals_away!==void 0&&(c.prediction.value=l.goals_home.toString()+":"+l.goals_away.toString()),c.prediction.playerId=l.player_id?l.player_id:null,c.prediction.playerId&&c.prediction.playerId!==t&&(c.prediction.playerModel=i[l.player_id],c.prediction.playerId=i[l.player_id].id),c.result=this.remapResult(l.result),a.push(c)}return a}));o(this,"remapResult",e=>{let t=new ty;return t.settledAt=e.settled_at,t.resettledAt=e.resettled_at,t.status=e.status,t.outcome=e.outcome,t.points=e.points,t});this.matchFacade=e,this.playerFacade=t,this.predictorService=r}},fl=class{constructor(){o(this,"goldenGoal",null)}},iy=class{constructor(){o(this,"id",null);o(this,"gameInstanceId",null);o(this,"gameType",null);o(this,"wager",null);o(this,"totalFixtures",null);o(this,"settledFixtures",null);o(this,"userId",null);o(this,"fixtures",[]);o(this,"status",null);o(this,"tiebreaker",new fl);o(this,"points",null);o(this,"templateId",null);o(this,"groupId",null);o(this,"createdAt",null);o(this,"updatedAt",null)}},$t=class{constructor(){o(this,"no",0);o(this,"yes",0)}},FR=class{constructor(){o(this,"fullTimeOneXTwo",{});o(this,"halfTimeOneXTwo",{});o(this,"bothTeamsScore",new $t);o(this,"doubleChance",{});o(this,"halfTimeFullTime",{});o(this,"playerScore",{});o(this,"playerYellowCard",{});o(this,"playerRedCard",{});o(this,"redCardMatch",new $t);o(this,"penaltyMatch",new $t);o(this,"playerScoreFirstGoal",{});o(this,"cornersMatch",{});o(this,"correctScore",{});o(this,"correctScoreHalfTime",{});o(this,"correctScoreAdvanced",{});o(this,"playerScoreHattrick",{});o(this,"playerScoreTwice",{});o(this,"overZeroPointFiveGoals",new $t);o(this,"overOnePointFiveGoals",new $t);o(this,"overTwoPointFiveGoals",new $t);o(this,"overThreePointFiveGoals",new $t);o(this,"overFourPointFiveGoals",new $t);o(this,"overFivePointFiveGoals",new $t);o(this,"overSixPointFiveGoals",new $t);o(this,"overSixPointFiveCorners",new $t);o(this,"overSevenPointFiveCorners",new $t);o(this,"overEightPointFiveCorners",new $t);o(this,"overNinePointFiveCorners",new $t);o(this,"overTenPointFiveCorners",new $t);o(this,"overElevenPointFiveCorners",new $t);o(this,"overTwelvePointFiveCorners",new $t);o(this,"overThirteenPointFiveCorners",new $t)}},hl=class{constructor(){o(this,"timeTiebreaker",!1)}},pl=class{constructor(){o(this,"id",null);o(this,"title",null);o(this,"description",null);o(this,"type",null);o(this,"status",null);o(this,"outcome",null);o(this,"predictionsCutoff",null);o(this,"fixtures",[]);o(this,"tiebreaker",new hl);o(this,"predictionId",null);o(this,"participantsCount",0);o(this,"related",null);o(this,"excludedProfileIds",null);o(this,"rules",null);o(this,"flags",null);o(this,"points",null);o(this,"createdAt",null);o(this,"updatedAt",null);o(this,"predictionsMadeAt",null);o(this,"scheduleOpenAt",null);o(this,"images",null);o(this,"predictionTiebreaker",new fl);o(this,"branding",null)}},Dd=class{constructor(){o(this,"userId",null);o(this,"points",null);o(this,"results",[]);o(this,"tiebreaker",null)}},ay=(e=>(e.ACTIVE="ACTIVE",e.WON="WON",e.LOST="LOST",e.PARTIALLY_WON="PARTIALLY_WON",e.CANCELED="CANCELED",e))(ay||{}),oy=["WON","LOST","PARTIALLY_WON","CANCELED"],Gr=class{constructor(e){o(this,"limit",null);o(this,"startAfter",null);o(this,"status",null);o(this,"type",null);o(this,"matchIds",null);o(this,"gameIds",null);o(this,"constructFiltersUrl",()=>{let e="",t=!1;return this.status&&(t=Object.values(ay).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}`),this.matchIds&&this.matchIds.length>0&&(e+="&",e+=`match_ids=${this.matchIds.join(",")}`),this.gameIds&&this.gameIds.length>0&&(e+="&",e+=`game_ids=${this.gameIds.join(",")}`),e});this.limit=(e==null?void 0:e.limit)||null,this.startAfter=(e==null?void 0:e.startAfter)||null,this.status=(e==null?void 0:e.status)||null,this.type=(e==null?void 0:e.type)||null,this.matchIds=(e==null?void 0:e.matchIds)||null,this.gameIds=(e==null?void 0:e.gameIds)||null}},Yr=class{constructor(t){o(this,"limit");o(this,"startAfter");this.limit=t&&t.limit?t.limit:null,this.startAfter=t&&t.startAfter?t.startAfter:null}constructMainFiltersUrl(){let t="";return this.limit&&(t+="&",t+=`limit=${this.limit}`),this.startAfter&&(t+="&",t+=`start_after=${this.startAfter}`),t}},sy=(e=>(e.OPEN="OPEN",e.LIVE="LIVE",e.PENDING="PENDING",e.CANCELED="CANCELED",e.CLOSED="CLOSED",e.SETTLED="SETTLED",e))(sy||{}),mi=class extends Yr{constructor(t){super(t);o(this,"status",null);o(this,"type",null);o(this,"gameIds",null);o(this,"sortOrder",null);o(this,"constructFiltersUrl",()=>{let t=super.constructMainFiltersUrl();return this.status&&Object.values(sy).includes(this.status)&&(t+="&",t+=`status=${this.status}`),this.type&&(t+="&",t+=`type=${this.type}`),this.gameIds&&this.gameIds.length>0&&(t+="&",t+=`game_ids=${this.gameIds.join(",")}`),this.sortOrder&&(t+="&",t+=`sort_order=${this.sortOrder}`),t});this.status=(t==null?void 0:t.status)||null,this.type=(t==null?void 0:t.type)||null,this.gameIds=(t==null?void 0:t.gameIds)||null,this.sortOrder=(t==null?void 0:t.sortOrder)||null}},Ao=class{constructor(){o(this,"main",null);o(this,"cover",null);o(this,"mobile",null)}},ml=class{constructor(){o(this,"id",null);o(this,"title",null);o(this,"description",null);o(this,"type",null);o(this,"status",null);o(this,"scheduleOpenAt",null);o(this,"predictionsCutoff",null);o(this,"fixtures",[]);o(this,"tiebreaker",new hl);o(this,"participantsCount",0);o(this,"related",null);o(this,"excludedProfileIds",null);o(this,"rules",null);o(this,"labels",null);o(this,"customFields",null);o(this,"branding",null);o(this,"flags",null);o(this,"images",new Ao);o(this,"createdAt",null);o(this,"updatedAt",null)}},Oo=class{constructor(){o(this,"id",null);o(this,"title",null);o(this,"description",null);o(this,"type",null);o(this,"status",null);o(this,"outcome",null);o(this,"predictionsCutoff",null);o(this,"fixtures",[]);o(this,"tiebreaker",new hl);o(this,"predictionId",null);o(this,"participantsCount",0);o(this,"related",null);o(this,"excludedProfileIds",null);o(this,"rules",null);o(this,"flags",null);o(this,"points",null);o(this,"createdAt",null);o(this,"updatedAt",null);o(this,"predictionsMadeAt",null);o(this,"images",null);o(this,"scheduleOpenAt",null);o(this,"branding",null)}},ly=class extends ml{constructor(){super(...arguments);o(this,"adContent",null)}},Ld=class{constructor(){o(this,"homeGoals",null);o(this,"awayGoals",null)}},$R=class{constructor(){o(this,"playerId",null);o(this,"playerModel",null)}},NR=class{constructor(){o(this,"FT_1X2",null);o(this,"HT_1X2",null);o(this,"BOTH_TEAMS_SCORE",null);o(this,"DOUBLE_CHANCE",null);o(this,"HT_FT",null);o(this,"RED_CARD_MATCH",null);o(this,"PENALTY_MATCH",null);o(this,"CORNERS_MATCH",null);o(this,"PLAYER_YELLOW_CARD",[]);o(this,"PLAYER_RED_CARD",[]);o(this,"PLAYER_SCORE_FIRST_GOAL",new $R);o(this,"PLAYER_SCORE",[]);o(this,"PLAYER_SCORE_TWICE",[]);o(this,"PLAYER_SCORE_HATTRICK",[]);o(this,"CORRECT_SCORE",new Ld);o(this,"CORRECT_SCORE_ADVANCED",new Ld);o(this,"CORRECT_SCORE_HT",new Ld);o(this,"OVER_GOALS_0_5",null);o(this,"OVER_GOALS_1_5",null);o(this,"OVER_GOALS_2_5",null);o(this,"OVER_GOALS_3_5",null);o(this,"OVER_GOALS_4_5",null);o(this,"OVER_GOALS_5_5",null);o(this,"OVER_GOALS_6_5",null);o(this,"OVER_CORNERS_6_5",null);o(this,"OVER_CORNERS_7_5",null);o(this,"OVER_CORNERS_8_5",null);o(this,"OVER_CORNERS_9_5",null);o(this,"OVER_CORNERS_10_5",null);o(this,"OVER_CORNERS_11_5",null);o(this,"OVER_CORNERS_12_5",null);o(this,"OVER_CORNERS_13_5",null)}},cy=(e=>(e.ONE="1",e.X="x",e.TWO="2",e))(cy||{}),uy=(e=>(e.ONE_X="1x",e.X_TWO="x2",e.ONE_TWO="12",e))(uy||{}),dy=(e=>(e.ONE_ONE="1/1",e.ONE_X="1/x",e.ONE_TWO="1/2",e.X_ONE="x/1",e.X_X="x/x",e.X_TWO="x/2",e.TWO_ONE="2/1",e.TWO_X="2/x",e.TWO_TWO="2/2",e))(dy||{}),Fd=class{constructor(){}static createMatchMarketsResultsModel(e,t){var r,n,i,a,s,l,c,u,d,f,h,p,g,m,y,b,v,w,_,x,S,T,E,k,O,A,R,D,N,F,$,j,W,V,U,P;return{FT_1X2:this.createOneXTwoResult(e.scores,"full_time"),HT_1X2:this.createOneXTwoResult(e.scores,"half_time"),BOTH_TEAMS_SCORE:e.scores.ftScore.homeGoals>0&&e.scores.ftScore.awayGoals>0,DOUBLE_CHANCE:this.createDoubleChanceResult(e.scores),HT_FT:this.createHalfTimeFullTimeResult(e.scores),RED_CARD_MATCH:this.createMarketResultByCriteria(e,"red_card"),PENALTY_MATCH:this.createMarketResultByCriteria(e,"penalty"),CORNERS_MATCH:isNaN(((n=(r=e.stats)==null?void 0:r.corners)==null?void 0:n.homeTeam)+((a=(i=e.stats)==null?void 0:i.corners)==null?void 0:a.awayTeam))?null:e.stats.corners.homeTeam+e.stats.corners.awayTeam,PLAYER_YELLOW_CARD:this.createPlayersMarketsResults(e,t,"yellow_card"),PLAYER_RED_CARD:this.createPlayersMarketsResults(e,t,"red_card"),PLAYER_SCORE_FIRST_GOAL:this.createPlayersMarketsResults(e,t,"first_goal"),PLAYER_SCORE:this.createPlayersMarketsResults(e,t,"one_goal"),PLAYER_SCORE_TWICE:this.createPlayersMarketsResults(e,t,"two_goals"),PLAYER_SCORE_HATTRICK:this.createPlayersMarketsResults(e,t,"hattrick"),CORRECT_SCORE:{homeGoals:e.scores.ftScore.homeGoals,awayGoals:e.scores.ftScore.awayGoals},CORRECT_SCORE_ADVANCED:{homeGoals:e.scores.ftScore.homeGoals,awayGoals:e.scores.ftScore.awayGoals},CORRECT_SCORE_HT:{homeGoals:e.scores.htScore.homeGoals,awayGoals:e.scores.htScore.awayGoals},OVER_GOALS_0_5:e.scores.ftScore.homeGoals+e.scores.ftScore.awayGoals>0,OVER_GOALS_1_5:e.scores.ftScore.homeGoals+e.scores.ftScore.awayGoals>1,OVER_GOALS_2_5:e.scores.ftScore.homeGoals+e.scores.ftScore.awayGoals>2,OVER_GOALS_3_5:e.scores.ftScore.homeGoals+e.scores.ftScore.awayGoals>3,OVER_GOALS_4_5:e.scores.ftScore.homeGoals+e.scores.ftScore.awayGoals>4,OVER_GOALS_5_5:e.scores.ftScore.homeGoals+e.scores.ftScore.awayGoals>5,OVER_GOALS_6_5:e.scores.ftScore.homeGoals+e.scores.ftScore.awayGoals>6,OVER_CORNERS_6_5:isNaN(((l=(s=e.stats)==null?void 0:s.corners)==null?void 0:l.homeTeam)+((u=(c=e.stats)==null?void 0:c.corners)==null?void 0:u.awayTeam))?null:e.stats.corners.homeTeam+e.stats.corners.awayTeam>6,OVER_CORNERS_7_5:isNaN(((f=(d=e.stats)==null?void 0:d.corners)==null?void 0:f.homeTeam)+((p=(h=e.stats)==null?void 0:h.corners)==null?void 0:p.awayTeam))?null:e.stats.corners.homeTeam+e.stats.corners.awayTeam>7,OVER_CORNERS_8_5:isNaN(((m=(g=e.stats)==null?void 0:g.corners)==null?void 0:m.homeTeam)+((b=(y=e.stats)==null?void 0:y.corners)==null?void 0:b.awayTeam))?null:e.stats.corners.homeTeam+e.stats.corners.awayTeam>8,OVER_CORNERS_9_5:isNaN(((w=(v=e.stats)==null?void 0:v.corners)==null?void 0:w.homeTeam)+((x=(_=e.stats)==null?void 0:_.corners)==null?void 0:x.awayTeam))?null:e.stats.corners.homeTeam+e.stats.corners.awayTeam>9,OVER_CORNERS_10_5:isNaN(((T=(S=e.stats)==null?void 0:S.corners)==null?void 0:T.homeTeam)+((k=(E=e.stats)==null?void 0:E.corners)==null?void 0:k.awayTeam))?null:e.stats.corners.homeTeam+e.stats.corners.awayTeam>10,OVER_CORNERS_11_5:isNaN(((A=(O=e.stats)==null?void 0:O.corners)==null?void 0:A.homeTeam)+((D=(R=e.stats)==null?void 0:R.corners)==null?void 0:D.awayTeam))?null:e.stats.corners.homeTeam+e.stats.corners.awayTeam>11,OVER_CORNERS_12_5:isNaN(((F=(N=e.stats)==null?void 0:N.corners)==null?void 0:F.homeTeam)+((j=($=e.stats)==null?void 0:$.corners)==null?void 0:j.awayTeam))?null:e.stats.corners.homeTeam+e.stats.corners.awayTeam>12,OVER_CORNERS_13_5:isNaN(((V=(W=e.stats)==null?void 0:W.corners)==null?void 0:V.homeTeam)+((P=(U=e.stats)==null?void 0:U.corners)==null?void 0:P.awayTeam))?null:e.stats.corners.homeTeam+e.stats.corners.awayTeam>13}}},gi=Fd;En(gi,"createOneXTwoResult",(e,t)=>{var r,n,i,a;return t==="full_time"?e.ftScore.homeGoals>e.ftScore.awayGoals?"1":e.ftScore.homeGoals===e.ftScore.awayGoals?"x":"2":((r=e==null?void 0:e.htScore)==null?void 0:r.homeGoals)>((n=e==null?void 0:e.htScore)==null?void 0:n.awayGoals)?"1":((i=e==null?void 0:e.htScore)==null?void 0:i.homeGoals)===((a=e==null?void 0:e.htScore)==null?void 0:a.awayGoals)?"x":"2"}),En(gi,"createDoubleChanceResult",e=>{var t,r,n,i;return((t=e==null?void 0:e.ftScore)==null?void 0:t.homeGoals)>((r=e==null?void 0:e.ftScore)==null?void 0:r.awayGoals)?["1x","12"]:((n=e==null?void 0:e.ftScore)==null?void 0:n.homeGoals)===((i=e==null?void 0:e.ftScore)==null?void 0:i.awayGoals)?["1x","x2"]:["x2","12"]}),En(gi,"createHalfTimeFullTimeResult",e=>{var t,r,n,i,a,s,l,c,u,d,f,h,p,g,m,y,b,v,w,_,x,S,T,E;if(((t=e==null?void 0:e.htScore)==null?void 0:t.homeGoals)>((r=e==null?void 0:e.htScore)==null?void 0:r.awayGoals)){if(((n=e==null?void 0:e.ftScore)==null?void 0:n.homeGoals)>((i=e==null?void 0:e.ftScore)==null?void 0:i.awayGoals))return"1/1";if(((a=e==null?void 0:e.ftScore)==null?void 0:a.homeGoals)===((s=e==null?void 0:e.ftScore)==null?void 0:s.awayGoals))return"1/x";if(((l=e==null?void 0:e.ftScore)==null?void 0:l.homeGoals)<((c=e==null?void 0:e.ftScore)==null?void 0:c.awayGoals))return"1/2"}if(((u=e==null?void 0:e.htScore)==null?void 0:u.homeGoals)===((d=e==null?void 0:e.htScore)==null?void 0:d.awayGoals)){if(((f=e==null?void 0:e.ftScore)==null?void 0:f.homeGoals)>((h=e==null?void 0:e.ftScore)==null?void 0:h.awayGoals))return"x/1";if(((p=e==null?void 0:e.ftScore)==null?void 0:p.homeGoals)===((g=e==null?void 0:e.ftScore)==null?void 0:g.awayGoals))return"x/x";if(((m=e==null?void 0:e.ftScore)==null?void 0:m.homeGoals)<((y=e==null?void 0:e.ftScore)==null?void 0:y.awayGoals))return"x/2"}if(((b=e==null?void 0:e.htScore)==null?void 0:b.homeGoals)<((v=e==null?void 0:e.htScore)==null?void 0:v.awayGoals)){if(((w=e==null?void 0:e.ftScore)==null?void 0:w.homeGoals)>((_=e==null?void 0:e.ftScore)==null?void 0:_.awayGoals))return"2/1";if(((x=e==null?void 0:e.ftScore)==null?void 0:x.homeGoals)===((S=e==null?void 0:e.ftScore)==null?void 0:S.awayGoals))return"2/x";if(((T=e==null?void 0:e.ftScore)==null?void 0:T.homeGoals)<((E=e==null?void 0:e.ftScore)==null?void 0:E.awayGoals))return"2/2"}}),En(gi,"createMarketResultByCriteria",(e,t)=>!e.timeline||!e.timeline.length?null:t==="red_card"?e.timeline.filter(r=>Number(r.minute)<=90).some(r=>r.type==="red_card"):e.timeline.filter(r=>Number(r.minute)<=90).some(r=>r.type.startsWith(t))),En(gi,"createPlayersMarketsResults",(e,t,r)=>{if(!e.timeline||!e.timeline.length)return r==="first_goal"?null:[];if(r==="first_goal"){let s=e.timeline.find(l=>l.type==="goal"||l.type==="penalty_goal"||l.type==="own_goal")||null;if(s){let l=t[s.player.id];return{playerId:s.type==="goal"||s.type==="penalty_goal"?s.player.id:"OWN_GOAL",playerModel:l}}return null}if(r==="yellow_card"||r==="red_card")return Fd.transformPlayerMarketResult(e.timeline.filter(s=>Number(s.minute)<=90).filter(s=>s.type===r).map(s=>t[s.player.id]));let n=new Map,i=r==="one_goal"?1:r==="two_goals"?2:3,a=[];return e.timeline.filter(s=>Number(s.minute)<=90).filter(s=>s.type==="goal"||s.type==="penalty_goal").forEach(s=>{let l=t[s.player.id];if(n.has(s.player.id)){let c=n.get(s.player.id);c.push(l),n.set(s.player.id,c)}else n.set(s.player.id,[l])}),n.forEach(s=>{s.length>=i&&a.push(s[0])}),Fd.transformPlayerMarketResult(a)}),En(gi,"transformPlayerMarketResult",e=>e.map(t=>({playerId:t.id,playerModel:t})));var gl=class{constructor(e,t){o(this,"footballHttps",null);o(this,"idMapping",null);o(this,"matchFacade",null);o(this,"playerFacade",null);o(this,"profileNamespace",null);o(this,"remapMatchIdToNative",e=>C(this,null,function*(){return(yield this.idMapping.getEntityIdsBySchemaId(e,"match","native")).match}));o(this,"remapPlayerIdToNative",e=>C(this,null,function*(){return(yield this.idMapping.getEntityIdsBySchemaId(e,"player","native")).player[0]}));o(this,"remapPlayerIdMapToNative",e=>C(this,null,function*(){let t={},r=tl(e),n=(yield this.idMapping.getEntityIdsBySchemaId(r,"player","native")).player;return r.forEach((i,a)=>t[i]=n[a]),t}));o(this,"remapPlayerIdToIdSchema",e=>C(this,null,function*(){let t=["playerScore","playerYellowCard","playerRedCard","playerScoreFirstGoal","playerScoreHattrick","playerScoreTwice"],r=[];for(let[i,a]of Object.entries(e))if(t.includes(i))for(let s of Object.keys(a))s!=="NOBODY"&&s!=="OWN_GOAL"&&r.push(s);if(!r.length)return e;let n=yield this.playerFacade.getPlayersMapWithNativeIds(r);for(let[i,a]of Object.entries(e))if(t.includes(i))for(let s of Object.keys(a))s!=="NOBODY"&&s!=="OWN_GOAL"&&(a[n[s].id]=a[s],a[n[s].id].model=n[s],this.idMapping.idSchema!=="native"&&delete a[s]);return e}));o(this,"convertMarketForResponseModel",(e,t)=>{let r=t.toString();return e+"_"+r});o(this,"getMarketSummary",(e,t,r)=>C(this,null,function*(){let n=IP.get(t),i={};if(i.matchId=e.matchId,i.matchType=e.matchType,Object.keys(e.predictions).includes(n))i[n]=e.predictions[n];else throw new Error("You have passed invalid market");if(Vn.includes(t)&&r){let a="";if(r!=="OWN_GOAL"&&r!=="NOBODY"&&(a=(yield this.idMapping.idMappingFacade.getEntitiesByIds({player:[r]},this.idMapping.idSchema,"native")).player[0]),a&&i[n][a]){let s=yield this.playerFacade.getPlayersMapWithNativeIds([a]);return i[n][a].model=s[a],i[n][a]}else return a?(i[n][a]=new $t,i[n][a]):i[n][r]}else if(Vn.includes(t)&&!r){let a=Object.keys(i[n]).filter(l=>l!=="NOBODY"&&l!=="OWN_GOAL"),s=a.length?yield this.playerFacade.getPlayersMapWithNativeIds(a):{};Object.keys(s).length&&Object.keys(i[n]).forEach(l=>{l!=="NOBODY"&&l!=="OWN_GOAL"&&(i[n][s[l].id]=i[n][l],i[n][s[l].id].model=s[l],this.idMapping.idSchema!=="native"&&delete i[n][l])})}return i}));o(this,"remapCompetitionsFromConfig",e=>C(this,null,function*(){if(e instanceof kv){let t={competition:e.fullCoverageCompetitions},r={competition:e.successRateScopes.competitions},n={team:e.successRateScopes.teams},i=yield this.idMapping.idMappingFacade.getEntitiesByIds(t,"native",this.idMapping.idSchema),a=yield this.idMapping.idMappingFacade.getEntitiesByIds(r,"native",this.idMapping.idSchema),s=yield this.idMapping.idMappingFacade.getEntitiesByIds(n,"native",this.idMapping.idSchema);return e.fullCoverageCompetitions=i.competition,e.successRateScopes.competitions=a.competition,e.successRateScopes.teams=s.team,e}if(e instanceof Pv||e instanceof Ov){let t={competition:e.competitionsWhitelist},r=yield this.idMapping.idMappingFacade.getEntitiesByIds(t,"native",this.idMapping.idSchema);return e.competitionsWhitelist=r.competition,e}}));o(this,"remapMatchIdsFixtures",e=>C(this,null,function*(){if(Array.isArray(e.data))if(e.data.length>0){let t=[],r=[];return e.data.forEach(n=>{n instanceof ml||n instanceof pl||n instanceof Oo||n instanceof ly?(n.fixtures.forEach(i=>t.push(i.matchId)),n instanceof Oo&&n.fixtures.forEach(i=>{i.prediction.playerId&&i.prediction.playerId!=="OWN_GOAL"&&r.push(i.prediction.playerId)})):n instanceof Dd&&n.results.forEach(i=>t.push(i.matchId))}),yield this.refactorResponseArrModel(e,t,r)}else return e;else return yield this.refactorResponseObjModel(e)}));o(this,"refactorResponseArrModel",(e,t,r)=>C(this,null,function*(){let n=[],i=yield this.matchFacade.getMatchesMapWithNativeIds(t),a={};return r.length>0&&(a=yield this.playerFacade.getPlayersMapWithNativeIds(r)),e.data.forEach(s=>{s instanceof ml||s instanceof pl||s instanceof Oo?(s.fixtures.forEach(l=>{this.handleMatchModel(i,l),s instanceof Oo&&l.prediction.playerId&&l.prediction.playerId!=="OWN_GOAL"&&(l.prediction.playerModel=a[l.prediction.playerId],l.prediction.playerId=a[l.prediction.playerId].id)}),n.push(s)):s instanceof Dd&&(s.results.forEach(l=>{l.matchModel=i[l.matchId],delete l.matchModel.availableMarkets,l.matchId=l.matchModel.id}),n.push(s))}),e.data=n,e}));o(this,"refactorResponseObjModel",e=>C(this,null,function*(){let t=[];e.fixtures.forEach(n=>t.push(n.matchId));let r=yield this.matchFacade.getMatchesMapWithNativeIds(t);return e.fixtures.forEach(n=>this.handleMatchModel(r,n)),e}));o(this,"getCurrentGameId",e=>{let t=new Date;if(e.data.length>1){let r=[];return e.data.forEach(n=>r.push(n.predictionsCutoff)),e.data.sort((n,i)=>{let[a,s]=[n.predictionsCutoff,i.predictionsCutoff].map(l=>Math.abs(new Date(l)-t));return a-s})[0].id}else return e.data[0].id});o(this,"initGameTypePredictions",(e,t)=>{let r={type:e,limit:null,startAfter:null};return t&&(r=ge(he({},r),{limit:t.limit,startAfter:t.startAfter})),r=new Gr(r),r});o(this,"initGameFilters",(e,t,r)=>{if(t&&r)return t.type=e,t.gameIds=r,t=new mi(t),t;if(t&&!r)return t.type=e,t=new mi(t),t;if(!t&&r){let n={type:e,gameIds:r};return n=new mi(n),n}else{let n={type:e};return n=new mi(n),n}});o(this,"addPredictionProp",(e,t)=>C(this,null,function*(){return t.data.forEach(r=>{e.data.forEach(n=>{r.id===n.game_instance_id&&(r.predictionId=n.id,r.outcome=n.status,r.fixtures.forEach((i,a)=>{n.fixtures[a].goals_home!==void 0&&n.fixtures[a].goals_away!==void 0?i.prediction.value=n.fixtures[a].goals_home+":"+n.fixtures[a].goals_away:i.prediction.value=n.fixtures[a].prediction,n.fixtures[a].player_id?i.prediction.playerId=n.fixtures[a].player_id:n.fixtures[a].target&&(i.prediction.target=n.fixtures[a].target),i.prediction.result=this.remapResult(n.fixtures[a].result)}),r.predictionsMadeAt=n.created_at,r.points=n.points,r instanceof pl&&(n.tiebreaker?r.predictionTiebreaker.goldenGoal=n.tiebreaker.golden_goal:r.predictionTiebreaker=n.tiebreaker))})}),t.meta.pagination.nextPageStartsAfter=e.meta.pagination.next_page_starts_after,yield this.remapMatchIdsFixtures(t)}));o(this,"remapResult",e=>{let t=new ty;return t.settledAt=e.settled_at,t.resettledAt=e.resettled_at,t.status=e.status,t.outcome=e.outcome,t.points=e.points,t});o(this,"areIdsExceeded",e=>e.length>10);o(this,"initPredictionsFilters",(e,t,r)=>{switch(t){case"user":e&&(e=new Gr(e));break;case"current":if(e)this.deleteUnexpectedProperties(e),e.status=["ACTIVE"],e=new Gr(e);else{let n={status:["ACTIVE"]};e=new Gr(n)}break;case"past":if(e)this.deleteUnexpectedProperties(e),e.status=oy,e=new Gr(e);else{let n={status:oy};e=new Gr(n)}break;case"matches":if(e)this.deleteUnexpectedProperties(e),e.matchIds=r,e=new Gr(e);else{let n={matchIds:r};e=new Gr(n)}break}return e});o(this,"completeGameMarketResults",(e,t)=>C(this,null,function*(){switch(t){case"MATCH_QUIZ":let r={},n=e.results[0].matchId,i=e.results.map(c=>Vn.includes(c.market)&&!c.result.includes("OWN_GOAL")?[...c.result]:[]).flat(),a=yield this.matchFacade.getMatchesMapWithNativeIds([n]);return i.length&&(r=yield this.playerFacade.getPlayersMapWithNativeIds(i)),e.results=e.results.map(c=>{if(c.matchModel=a[c.matchId]?a[c.matchId]:null,c.playerModels&&Object.keys(r).length&&c.result.forEach(u=>{let d=r[u];c.playerModels.push(d)}),this.idMapping.idSchema!=="native"&&(this.remapMatchIdForResultsMarkets(a,c),c.playerModels&&Object.keys(r).length)){let u=c.result;c.result=u.map(d=>r[d].id)}return c}),e;case"TOP_X":let s=e.results.map(c=>c.matchId),l=yield this.matchFacade.getMatchesMapWithNativeIds(s);if(e.results=e.results.map(c=>(c.matchModel=l[c.matchId]?l[c.matchId]:null,this.idMapping.idSchema!=="native"&&this.remapMatchIdForResultsMarkets(l,c),c)),e.tieBreakers.goldenGoals.length){let c=e.tieBreakers.goldenGoals.map(d=>d.playerId),u=yield this.playerFacade.getPlayersMapWithNativeIds(c);e.tieBreakers.goldenGoals=e.tieBreakers.goldenGoals.map(d=>(d.matchModel=l[d.matchId],d.playerModel=u[d.playerId],this.idMapping.idSchema!=="native"&&(d.matchId=l[d.matchId].id,d.playerId=u[d.playerId].id),d))}return e}}));o(this,"completeContestWinners",e=>C(this,null,function*(){if(e.userList&&e.userList.length){let t=e.userList.map(n=>n.profileId),r=yield this.profileNamespace.getByIds(t);e.userList.forEach(n=>{let i=r.filter(a=>a.id===n.profileId)[0];delete i.interests,n.profileModel=i})}return e}));o(this,"handleMatchModel",(e,t)=>{e[t.matchId]?(t.matchModel=e[t.matchId],delete t.matchModel.availableMarkets,t.matchId=t.matchModel.id):(t.matchModel=null,this.idMapping.idSchema!=="native"&&this.idMapping.idMappingFacade.getEntityById(t.matchId,"match","native").then(r=>{t.matchId=r[cr[this.idMapping.idSchema]]}))});o(this,"remapMatchIdForResultsMarkets",(e,t)=>{e[t.matchId]?t.matchId=e[t.matchId].id:this.idMapping.idMappingFacade.getEntityById(t.matchId,"match","native").then(r=>{t.matchId=r[cr[this.idMapping.idSchema]]})});o(this,"deleteUnexpectedProperties",e=>(e.status&&(console.warn(vv.UNEXPECTED_STATUS_PROP),delete e.status),e.type&&(console.warn(vv.UNEXPECTED_TYPE_PROP),delete e.type),e));o(this,"getMatchMarketsResults",e=>C(this,null,function*(){let t=yield this.footballHttps.getMatchById(e,!0);if(t.status.type!=="finished"||!t.finishedAt)return new NR;let r=[];t.timeline.filter(i=>Number(i.minute)<=90).filter(i=>i.type==="goal"||i.type==="penalty_goal"||i.type==="yellow_card"||i.type==="red_card").forEach(i=>{r.push(i.player.id)});let n={};return r.length&&(n=yield this.playerFacade.getPlayersMapWithNativeIds(r)),gi.createMatchMarketsResultsModel(t,n)}));this.footballHttps=new So(e),this.idMapping=t,this.matchFacade=new Ad(e,this.footballHttps,t),this.playerFacade=new Ed(e,this.footballHttps,t),this.profileNamespace=new Wn(e)}},fy=class{constructor(e){o(this,"gameInstanceId",null);o(this,"fixtures",[]);o(this,"tiebreaker",null);this.gameInstanceId=e.gameInstanceId,e.fixtures.forEach(t=>this.fixtures.push(new Md(t.matchId,t.market,t.prediction.value))),this.tiebreaker=e.tiebreaker?e.tiebreaker:null}},hy=class{constructor(){o(this,"template_id",null);o(this,"group_id",null);o(this,"fixtures",[])}},py=class{constructor(e,t){o(this,"fixturesRemapper",null);o(this,"footballHttps",null);o(this,"matchFacade",null);o(this,"playerFacade",null);o(this,"predictorService",null);o(this,"remapRequestBody",e=>{if(e instanceof hy)return e;let t={};return t.game_instance_id=e.gameInstanceId,t.fixtures=e.fixtures.map(r=>this.fixturesRemapper.remapFixturesRequest(r)),e instanceof fy&&e.tiebreaker&&(t.tiebreaker={},t.tiebreaker.golden_goal=e.tiebreaker.goldenGoal?e.tiebreaker.goldenGoal:null),t});o(this,"remapResponseArrayBody",e=>C(this,null,function*(){if(e.length){let t="OWN_GOAL",r=[],n=[],i={},a=[];e.forEach(l=>{l.fixtures.forEach(c=>{r.push(c.match_id),c.player_id&&c.player_id!==t&&n.push(c.player_id)})});let s=yield this.matchFacade.getMatchesMapWithNativeIds(r);return n.length>0&&(i=yield this.playerFacade.getPlayersMapWithNativeIds(n)),e.forEach(l=>{let c=new iy,u=[];c.id=l.id,c.gameInstanceId=l.game_instance_id,c.gameType=l.game_type,c.wager=l.wager,c.totalFixtures=l.total_fixtures,c.settledFixtures=l.settled_fixtures,c.userId=l.user_id,c.templateId=l.template_id,c.groupId=l.group_id,l.fixtures.forEach(d=>{let f=new ey;d.target?f.market=this.predictorService.convertMarketForResponseModel(d.market,d.target):f.market=d.market,f.matchId=s[d.match_id].id,f.matchType=d.match_type,f.matchModel=s[d.match_id],delete f.matchModel.availableMarkets,d.prediction!==void 0?f.prediction.value=d.prediction:d.goals_home!==void 0&&d.goals_away!==void 0&&(f.prediction.value=d.goals_home.toString()+":"+d.goals_away.toString()),f.prediction.playerId=d.player_id?d.player_id:null,f.prediction.playerId&&f.prediction.playerId!==t&&(f.prediction.playerModel=i[f.prediction.playerId],f.prediction.playerId=i[f.prediction.playerId].id),f.result=this.fixturesRemapper.remapResult(d.result),u.push(f)}),c.fixtures=u,c.status=l.status,l.tiebreaker?c.tiebreaker.goldenGoal=l.tiebreaker.golden_goal:c.tiebreaker=null,c.points=l.points,c.createdAt=l.created_at,c.updatedAt=l.updated_at,a.push(c)}),a}return e}));o(this,"remapResponseObjBody",e=>C(this,null,function*(){let t=new iy;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.templateId=e.template_id,t.groupId=e.group_id,t.fixtures=yield 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}));o(this,"remapPredictionModel",e=>{let t=new FR;return t.fullTimeOneXTwo=e.FT_1X2,t.halfTimeOneXTwo=e.HT_1X2,t.bothTeamsScore=e.BOTH_TEAMS_SCORE,t.overZeroPointFiveGoals=e.OVER_GOALS_0_5,t.overOnePointFiveGoals=e.OVER_GOALS_1_5,t.overTwoPointFiveGoals=e.OVER_GOALS_2_5,t.overThreePointFiveGoals=e.OVER_GOALS_3_5,t.overFourPointFiveGoals=e.OVER_GOALS_4_5,t.overFivePointFiveGoals=e.OVER_GOALS_5_5,t.overSixPointFiveGoals=e.OVER_GOALS_6_5,t.overSixPointFiveCorners=e.OVER_CORNERS_6_5,t.overSevenPointFiveCorners=e.OVER_CORNERS_7_5,t.overEightPointFiveCorners=e.OVER_CORNERS_8_5,t.overNinePointFiveCorners=e.OVER_CORNERS_9_5,t.overTenPointFiveCorners=e.OVER_CORNERS_10_5,t.overElevenPointFiveCorners=e.OVER_CORNERS_11_5,t.overTwelvePointFiveCorners=e.OVER_CORNERS_12_5,t.overThirteenPointFiveCorners=e.OVER_CORNERS_13_5,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,t.penaltyMatch=e.PENALTY_MATCH,t.playerScoreFirstGoal=e.PLAYER_SCORE_FIRST_GOAL,t.cornersMatch=e.CORNERS_MATCH,t.correctScore=e.CORRECT_SCORE,t.correctScoreHalfTime=e.CORRECT_SCORE_HT,t.correctScoreAdvanced=e.CORRECT_SCORE_ADVANCED,t.playerScoreHattrick=e.PLAYER_SCORE_HATTRICK,t.playerScoreTwice=e.PLAYER_SCORE_TWICE,t});this.footballHttps=new So(e),this.matchFacade=new Ad(e,this.footballHttps,t),this.playerFacade=new Ed(e,this.footballHttps,t),this.predictorService=new gl(e,t),this.fixturesRemapper=new LR(this.matchFacade,this.playerFacade,this.predictorService)}},BR=class{constructor(){o(this,"matchId",null);o(this,"matchType",null);o(this,"predictions",null)}},jR=class{constructor(e,t){o(this,"remapPredictions",null);o(this,"remapResponse",e=>{let t=new BR;return t.matchId=e.match_id,t.matchType=e.match_type,t.predictions=this.remapPredictions.remapPredictionModel(e.predictions),t});this.remapPredictions=new py(e,t)}},zR=class{constructor(){o(this,"matchId",null);o(this,"matchType",null);o(this,"market",null);o(this,"matchModel",null);o(this,"matchStatus",new Io)}},HR=class{constructor(){o(this,"value",null);o(this,"target",null);o(this,"playerId",null);o(this,"playerModel",null);o(this,"result",null)}},UR=class{constructor(){o(this,"matchId",null);o(this,"matchType",null);o(this,"market",null);o(this,"matchModel",null);o(this,"matchStatus",new Io);o(this,"prediction",new HR)}},VR=class{constructor(){o(this,"value",null);o(this,"result",null)}},WR=class{constructor(){o(this,"matchId",null);o(this,"matchType",null);o(this,"market",null);o(this,"matchModel",null);o(this,"matchStatus",new Io);o(this,"prediction",new VR)}},qR=class{constructor(){o(this,"matchId",null);o(this,"matchModel",null);o(this,"outcome",null)}},GR=class{constructor(){o(this,"gameId",null);o(this,"results",null);o(this,"tieBreakers",null)}},my=class{constructor(){o(this,"entityId",null);o(this,"entityType",null)}},YR=class{constructor(){o(this,"contestId","");o(this,"contestType","GAME");o(this,"contestModel",null);o(this,"description","");o(this,"userList",[])}},KR=class{constructor(){o(this,"position","");o(this,"profileId","");o(this,"profileModel",null);o(this,"note","");o(this,"tags",[])}},QR=class{constructor(){o(this,"primaryColor",null);o(this,"secondaryColor",null);o(this,"contentColor",null);o(this,"backgroundColor",null);o(this,"borderColor",null);o(this,"additionalColor",null)}},JR=class{constructor(){o(this,"mainLogo",null);o(this,"mobileLogo",null);o(this,"backgroundImage",null);o(this,"mobileBackgroundImage",null);o(this,"additionalImage",null)}},XR=class{constructor(){o(this,"colors",null);o(this,"urls",null);o(this,"images",null)}},ZR=class{constructor(){o(this,"primaryUrl",null);o(this,"secondaryUrl",null);o(this,"privacyPolicyUrl",null);o(this,"termsAndConditionsUrl",null);o(this,"additionalUrl",null)}},Po=class{constructor(){o(this,"remapBranding",e=>{let t=new XR;return e.colors&&(t.colors=new QR,t.colors.primaryColor=e.colors.primary_color,t.colors.secondaryColor=e.colors.secondary_color,t.colors.contentColor=e.colors.content_color,t.colors.backgroundColor=e.colors.background_color,t.colors.borderColor=e.colors.border_color,t.colors.additionalColor=e.colors.additional_color),e.urls&&(t.urls=new ZR,t.urls.primaryUrl=e.urls.primary_url,t.urls.secondaryUrl=e.urls.secondary_url,t.urls.privacyPolicyUrl=e.urls.privacy_policy_url,t.urls.termsAndConditionsUrl=e.urls.terms_and_conditions_url,t.urls.additionalUrl=e.urls.additional_url),e.images&&(t.images=new JR,t.images.mainLogo=e.images.main_logo,t.images.mobileLogo=e.images.mobile_logo,t.images.backgroundImage=e.images.background_image,t.images.mobileBackgroundImage=e.images.mobile_background_image,t.images.additionalImage=e.images.additional_image),t})}},eM=class extends Po{constructor(){super(...arguments);o(this,"remapPaginatedGames",t=>{let r=new _r;return r.meta.pagination.nextPageStartsAfter=t.meta.pagination.next_page_starts_after,r.meta.pagination.itemsPerPage=t.meta.pagination.items_per_page,r.data=t.data.map(n=>this.remapGamesListResponse(n)),r});o(this,"remapGamesListResponse",t=>{let r=new ml;return r.id=t.id,r.title=t.title,r.description=t.description,r.type=t.type,r.status=t.status,r.scheduleOpenAt=t.schedule_open_at,r.predictionsCutoff=t.predictions_cutoff,r.fixtures=t.fixtures.map(n=>this.remapFixturesResponse(n)),r.tiebreaker=t.tiebreaker?this.remapTimeTiebreaker(t.tiebreaker.time_tiebreaker):null,r.participantsCount=t.participants_count,r.related=t.related?this.remapRelated(t.related):null,r.excludedProfileIds=t.excluded_profile_ids,r.rules=t.rules,r.labels=t.labels,r.customFields=t.custom_fields,r.branding=t.branding?this.remapBranding(t.branding):null,r.flags=t.flags,r.images=t.images,r.createdAt=t.created_at,r.updatedAt=t.updated_at,r});o(this,"remapGameByIdResponse",t=>{let r=new ly;return r.id=t.id,r.title=t.title,r.description=t.description,r.type=t.type,r.status=t.status,r.scheduleOpenAt=t.schedule_open_at,r.predictionsCutoff=t.predictions_cutoff,r.fixtures=t.fixtures.map(n=>this.remapFixturesResponse(n)),r.tiebreaker=t.tiebreaker?this.remapTimeTiebreaker(t.tiebreaker.time_tiebreaker):null,r.participantsCount=t.participants_count,r.related=t.related?this.remapRelated(t.related):null,r.excludedProfileIds=t.excluded_profile_ids,r.rules=t.rules,r.flags=t.flags,r.adContent=t.ad_content,r.labels=t.labels,r.customFields=t.custom_fields,r.branding=t.branding?this.remapBranding(t.branding):null,r.images=t.images,r.createdAt=t.created_at,r.updatedAt=t.updated_at,r});o(this,"remapFixturesResponse",t=>{let r=new zR;return r.matchId=t.match_id,r.matchType=t.match_type,r.market=t.market,r.matchStatus.type=t.match_status?t.match_status.type:null,r.matchStatus.subType=t.match_status?t.match_status.sub_type:null,r});o(this,"remapPaginatedUserTopXEditions",t=>{let r=new _r;return r.meta.pagination.nextPageStartsAfter=t.meta.pagination.next_page_starts_after,r.meta.pagination.itemsPerPage=t.meta.pagination.items_per_page,r.data=t.data.map(n=>this.remapUserTopXEditionsResponse(n)),r});o(this,"remapUserTopXEditionsResponse",t=>{let r=new pl;return r.id=t.id,r.title=t.title,r.description=t.description,r.type=t.type,r.status=t.status,r.predictionsCutoff=t.predictions_cutoff,r.scheduleOpenAt=t.schedule_open_at,r.fixtures=t.fixtures.map(n=>this.remapTopXFixturesResponse(n)),r.tiebreaker=t.tiebreaker?this.remapTimeTiebreaker(t.tiebreaker.time_tiebreaker):null,r.participantsCount=t.participants_count,r.related=t.related?this.remapRelated(t.related):null,r.excludedProfileIds=t.excluded_profile_ids,r.rules=t.rules,r.flags=t.flags,r.images=t.images,r.branding=t.branding?this.remapBranding(t.branding):null,r.createdAt=t.created_at,r.updatedAt=t.updated_at,r});o(this,"remapTopXFixturesResponse",t=>{let r=new WR;return r.matchId=t.match_id,r.matchType=t.match_type,r.market=t.market,r.matchStatus.type=t.match_status?t.match_status.type:null,r.matchStatus.subType=t.match_status?t.match_status.sub_type:null,r});o(this,"remapPaginatedUserMathQuizEditions",t=>{let r=new _r;return r.meta.pagination.nextPageStartsAfter=t.meta.pagination.next_page_starts_after,r.meta.pagination.itemsPerPage=t.meta.pagination.items_per_page,r.data=t.data.map(n=>this.remapUserMatchQuizEditionsResponse(n)),r});o(this,"remapUserMatchQuizEditionsResponse",t=>{let r=new Oo;return r.id=t.id,r.title=t.title,r.description=t.description,r.type=t.type,r.status=t.status,r.predictionsCutoff=t.predictions_cutoff,r.scheduleOpenAt=t.schedule_open_at,r.fixtures=t.fixtures.map(n=>this.remapMatchQuizFixturesResponse(n)),r.tiebreaker=t.tiebreaker?this.remapTimeTiebreaker(t.tiebreaker.time_tiebreaker):null,r.participantsCount=t.participants_count,r.related=t.related?this.remapRelated(t.related):null,r.excludedProfileIds=t.excluded_profile_ids,r.rules=t.rules,r.flags=t.flags,r.images=t.images,r.branding=t.branding?this.remapBranding(t.branding):null,r.createdAt=t.created_at,r.updatedAt=t.updated_at,r});o(this,"remapMatchQuizFixturesResponse",t=>{let r=new UR;return r.matchId=t.match_id,r.matchType=t.match_type,r.market=t.market,r.matchStatus.type=t.match_status?t.match_status.type:null,r.matchStatus.subType=t.match_status?t.match_status.sub_type:null,r});o(this,"remapPaginatedGameResults",t=>{let r=new _r;return r.meta.pagination.nextPageStartsAfter=t.meta.pagination.next_page_starts_after,r.meta.pagination.itemsPerPage=t.meta.pagination.items_per_page,r.data=t.data.map(n=>this.remapGameResults(n)),r});o(this,"remapGameResults",t=>{let r=new Dd;return r.userId=t.user_id,r.points=t.points?t.points:0,r.results=t.results.map(n=>this.remapResults(n)),r.tiebreaker=t.tiebreaker?this.remapTiebreaker(t.tiebreaker):null,r});o(this,"remapGameMarketsResults",t=>{let r=new GR;return r.gameId=t.game_id,r.results=this.remapMarketsResults(t.results),r.tieBreakers=t.tie_breakers?this.remapTieBreakers(t.tie_breakers):null,r});o(this,"remapContestWinners",t=>{let r=new YR;return r.contestId=t.contest_id,r.contestType=t.contest_type,r.description=t.description,r.userList=t.user_list?t.user_list.map(n=>this.remapUserListWinners(n)):null,r});o(this,"remapUserListWinners",t=>{let r=new KR;return r.position=t.position,r.profileId=t.profile_id,r.note=t.note,r.tags=t.tags,r});o(this,"remapTieBreakers",t=>{let r={goldenGoals:[]};return r.goldenGoals=t.golden_goals.map(n=>({minute:n.minute,matchId:n.match_id,matchModel:null,playerId:n.player_id,playerModel:null,goalType:n.goal_type})),r});o(this,"remapMarketsResults",t=>{let r=[];return t.forEach(n=>{let i={matchId:n.match_id,market:n.market,result:this.remapMarketResult(n.market,n.result),matchModel:null,playerModels:[],matchStatus:this.remapMarketsResultsMatchStatus(n.match_status)};r.push(this.deleteUnusefulField(i))}),r});o(this,"remapMarketsResultsMatchStatus",t=>{let r=new Io;return t&&(r.type=t.type,r.subType=t.sub_type),r});o(this,"remapMarketResult",(t,r)=>{if(uR.includes(t))return r[0];if(Vn.includes(t))return r;if(r[0]==="true")return!0;if(r[0]==="false")return!1});o(this,"deleteUnusefulField",t=>((!Vn.includes(t.market)||this.isPlayerMarketWithNoResult(t.market,t.result))&&delete t.playerModels,t));o(this,"isPlayerMarketWithNoResult",(t,r)=>Vn.includes(t)&&r.length===0);o(this,"remapResults",t=>{let r=new qR;return r.matchId=t.match_id,r.outcome=t.outcome,r});o(this,"remapTiebreaker",t=>{let r=new fl;return r.goldenGoal=t.golden_goal,r});o(this,"remapTimeTiebreaker",t=>{let r=new hl;return r.timeTiebreaker=t,r});o(this,"remapRelated",t=>t.map(r=>{let n=new my;return n.entityId=r.entity_id,n.entityType=r.entity_type,n}))}},tM=class{constructor(){o(this,"remapMetaData",e=>{let t=new di;return t.pagination.nextPageStartsAfter=e.pagination.next_page_starts_after,t.pagination.itemsPerPage=e.pagination.items_per_page,t})}},ko=class extends qr{constructor(t,r){super(t,Rr(t.environment,"predictor"));o(this,"predictionRemapper",null);o(this,"matchSummaryRemapper",null);o(this,"gamesRemapper",null);o(this,"metaRemapper",null);o(this,"makeFootballPrediction",t=>C(this,null,function*(){let r=`/predictions${this.apiSignInUrl}`,n="There was a problem making POST request",i="POST",a=yield this.fetchWithAuth(r,n,i,this.predictionRemapper.remapRequestBody(t));return yield this.predictionRemapper.remapResponseObjBody(a)}));o(this,"getMatchSummary",(t,r)=>C(this,null,function*(){let n=ut(r)?`/predictions/summary/${t}${this.apiSignInUrl}${Ze()}`:`/predictions/summary/${t}${this.apiSignInUrl}`,i=`There was a problem fetching predictions for match: ${t}`,a=yield this.fetchWithoutAuth(n,i);return this.matchSummaryRemapper.remapResponse(a)}));o(this,"deleteFootballPrediction",t=>C(this,null,function*(){let r=`/predictions/${t}${this.apiSignInUrl}`,n=`There was a problem deleting your prediction: ${t}`;return yield this.fetchWithAuth(r,n,"DELETE"),!0}));o(this,"getMyPredictions",t=>C(this,null,function*(){let r=new _r,n=`/predictions${this.apiSignInUrl}`,i="There was a problem fetching own predictions";t&&(n+=`${t.constructFiltersUrl()}`);let a=yield this.fetchWithAuth(n,i);return r.meta=this.metaRemapper.remapMetaData(a.meta),r.data=yield this.predictionRemapper.remapResponseArrayBody(a.data),r}));o(this,"getMyPredictionsNoRemap",t=>C(this,null,function*(){let r=`/predictions${this.apiSignInUrl}${t.constructFiltersUrl()}`;return yield this.fetchWithAuth(r,"There was a problem fetching own predictions")}));o(this,"getUserPredictions",(t,r,n)=>C(this,null,function*(){let i=new _r,a=ut(r)?`/predictions/users/${t}${this.apiSignInUrl}${Ze()}`:`/predictions/users/${t}${this.apiSignInUrl}`,s=`There was a problem fetching predictions for user: ${t}`;n&&(a+=`${n.constructFiltersUrl()}`);let l=yield this.fetchWithoutAuth(a,s);return i.meta=this.metaRemapper.remapMetaData(l.meta),i.data=yield this.predictionRemapper.remapResponseArrayBody(l.data),i}));o(this,"getUserPredictionsNoRemap",(t,r)=>C(this,null,function*(){let n=`/predictions/users/${t}${this.apiSignInUrl}${r.constructFiltersUrl()}`,i=`There was a problem fetching predictions for user: ${t}`;return yield this.fetchWithoutAuth(n,i)}));o(this,"getGames",(t,r)=>C(this,null,function*(){let n=ut(r)?`/games/${this.apiSignInUrl}${t.constructFiltersUrl()}${Ze()}`:`/games/${this.apiSignInUrl}${t.constructFiltersUrl()}`,i="There was a problem fetching the games list",a=yield this.fetchWithoutAuth(n,i);return this.gamesRemapper.remapPaginatedGames(a)}));o(this,"getGameById",(t,r)=>C(this,null,function*(){let n=ut(r)?`/games/${t}${this.apiSignInUrl}${Ze()}`:`/games/${t}${this.apiSignInUrl}`,i=`There was a problem fetching the following game: ${t}`,a=yield this.fetchWithoutAuth(n,i);return this.gamesRemapper.remapGameByIdResponse(a)}));o(this,"getGamePredictions",(t,r,n)=>C(this,null,function*(){let i=new _r,a=ut(r)?`/games/${t}/predictions${this.apiSignInUrl}${Ze()}`:`/games/${t}/predictions${this.apiSignInUrl}`,s=`There was a problem fetching the predictions for game: ${t}`;n&&(a+=`${n.constructFiltersUrl()}`);let l=yield this.fetchWithoutAuth(a,s);return i.meta=this.metaRemapper.remapMetaData(l.meta),i.data=yield this.predictionRemapper.remapResponseArrayBody(l.data),i}));o(this,"getUserGameEditions",(t,r)=>C(this,null,function*(){let n=null,i=ut(r)?`/games/${this.apiSignInUrl}${t.constructFiltersUrl()}${Ze()}`:`/games/${this.apiSignInUrl}${t.constructFiltersUrl()}`,a="There was a problem fetching the games list",s=yield this.fetchWithoutAuth(i,a);return s.data.forEach(l=>{l.type==="TOP_X"?n=this.gamesRemapper.remapPaginatedUserTopXEditions(s):l.type==="MATCH_QUIZ"&&(n=this.gamesRemapper.remapPaginatedUserMathQuizEditions(s))}),n}));o(this,"getGameResults",(t,r,n)=>C(this,null,function*(){let i=ut(r)?`/games/${t}/results/${this.apiSignInUrl}${Ze()}`:`/games/${t}/results/${this.apiSignInUrl}`,a=`There was a problem fetching the results for the following game: ${t}`;n&&(i+=`${n.constructMainFiltersUrl()}`);let s=yield this.fetchWithoutAuth(i,a);return this.gamesRemapper.remapPaginatedGameResults(s)}));o(this,"getMarketResultsForGame",(t,r)=>C(this,null,function*(){let n=`/games/${t}/correct-results/${this.apiSignInUrl}`,i=`There was a problem fetching the markets correct results for the following game: ${t}`;ut(r)&&(n+=`${Ze()}`);let a=yield this.fetchWithoutAuth(n,i);return this.gamesRemapper.remapGameMarketsResults(a.data)}));o(this,"getContestWinners",(t,r)=>C(this,null,function*(){let n=`/winners/${this.apiSignInUrl}&contest_id=${t}`,i=`There was a problem fetching winners for the following game: ${t}`;r&&(n+=Ze());let a=yield this.fetchWithoutAuth(n,i);return this.gamesRemapper.remapContestWinners(a)}));o(this,"getPredictionById",t=>C(this,null,function*(){let r=`/predictions/${t}${this.apiSignInUrl}`,n=`There was a problem fetching info for the following prediction: ${t}`,i=yield this.fetchWithoutAuth(r,n);return(yield this.predictionRemapper.remapResponseArrayBody([i.data]))[0]}));o(this,"getPredictionsByIds",t=>C(this,null,function*(){let r=`/predictions/by-ids${this.apiSignInUrl}&prediction_ids=${t.join(",")}`,n="There was a problem fetching predictions",i=yield this.fetchWithoutAuth(r,n);return yield this.predictionRemapper.remapResponseArrayBody(i.data)}));this.predictionRemapper=new py(t,r),this.matchSummaryRemapper=new jR(t,r),this.gamesRemapper=new eM,this.metaRemapper=new tM}},gy=class{constructor(){o(this,"gameInstanceId",null);o(this,"fixtures",null)}},rM=class{constructor(e,t){o(this,"matchId",null);o(this,"market","BOTH_TEAMS_SCORE");o(this,"matchType","FOOTBALL");o(this,"prediction",null);this.matchId=e,this.prediction=new Eo,this.prediction.value=t}},nM=class{constructor(){o(this,"value")}},iM=class{constructor(e,t){o(this,"matchId",null);o(this,"market","CORNERS_MATCH");o(this,"matchType","FOOTBALL");o(this,"prediction",null);this.matchId=e,this.prediction=new nM,this.prediction.value=t}},aM=class{constructor(){o(this,"value",null)}},oM=class{constructor(e,t){o(this,"matchId",null);o(this,"market","DOUBLE_CHANCE");o(this,"matchType","FOOTBALL");o(this,"prediction",null);this.matchId=e,this.prediction=new aM,this.prediction.value=t}},sM=class{constructor(){o(this,"value",null)}},lM=class{constructor(e,t,r){o(this,"matchId",null);o(this,"market",null);o(this,"matchType","FOOTBALL");o(this,"prediction",null);this.matchId=e,this.market=t,this.prediction=new sM,this.prediction.value=r}},cM=class{constructor(){o(this,"value",null)}},uM=class{constructor(e,t){o(this,"matchId",null);o(this,"market","HT_FT");o(this,"matchType","FOOTBALL");o(this,"prediction",null);this.matchId=e,this.prediction=new cM,this.prediction.value=t}},dM=class{constructor(e,t){o(this,"matchId",null);o(this,"market","PENALTY_MATCH");o(this,"matchType","FOOTBALL");o(this,"prediction",null);this.matchId=e,this.prediction=new Eo,this.prediction.value=t}},fM=class{constructor(e,t){o(this,"matchId",null);o(this,"market","RED_CARD_MATCH");o(this,"matchType","FOOTBALL");o(this,"prediction",null);this.matchId=e,this.prediction=new Eo,this.prediction.value=t}},$d=class{constructor(e){o(this,"errorHandlingMode",null);o(this,"validateBodyFields",(e,t)=>{let r=Object.keys(t),n=Object.keys(new gy);switch(e){case"MATCH_QUIZ":r.forEach(l=>{n.includes(l)||this.throwInvalidParamException([l])});break;case"TOP_X":let a=t;a.fixtures.forEach(l=>this.validateMarketTopX(l.market)),r.includes("tiebreaker")&&a.tiebreaker&&this.validateTiebreaker(a.tiebreaker),r.forEach(l=>{l!=="tiebreaker"&&!n.includes(l)&&this.throwInvalidParamException([l])});break}let i=n.filter(a=>!r.includes(a));return i.length&&this.throwMissingFieldsException("game prediction body",i),t.fixtures.forEach(a=>{this.validateFixtureFields(a)}),t});o(this,"validateFixture",(e,t,r,n)=>{this.validateMarket(t);let i=Object.values(cy),a=Object.values(dy),s=Object.values(uy);if(t==="FT_1X2"||t==="HT_1X2"){if(i.includes(r))return new lM(e,t,r)}else if(t==="HT_FT"){if(a.includes(r))return new uM(e,r)}else if(t==="DOUBLE_CHANCE"){if(s.includes(r))return new oM(e,r)}else if(t==="CORRECT_SCORE"||t==="CORRECT_SCORE_ADVANCED"||t==="CORRECT_SCORE_HT"){if(typeof r=="string"&&/\d+:\d+/.test(r))return new Md(e,t,r)}else if(t==="CORNERS_MATCH"){if(typeof r=="number")return new iM(e,r)}else if(t==="BOTH_TEAMS_SCORE"){if(this.isPredictionBoolean(r))return new rM(e,r)}else if(t==="RED_CARD_MATCH"){if(this.isPredictionBoolean(r))return new fM(e,r)}else if(t==="PENALTY_MATCH"){if(this.isPredictionBoolean(r))return new dM(e,r)}else if(Vn.includes(t)){let l="OWN_GOAL";if(this.validatePlayerId(t,n),t===dl&&this.isPredictionBoolean(r)){let c=n&&n===l?l:n;return new ta(e,t,r,c)}if(n&&this.isPredictionBoolean(r))return new ta(e,t,r,n)}else if(lR.includes(t)){if(this.isPredictionBoolean(r))return new ny(e,t,r)}else if(cR.includes(t)&&this.isPredictionBoolean(r))return new ry(e,t,r);this.throwInvalidPredictionException(r,t)});o(this,"validateFixtureFields",e=>{let t=Object.keys(e);t.forEach(n=>{gv.includes(n)||this.throwInvalidParamException([n])});let r=gv.filter(n=>{if(n!=="matchType"&&!t.includes(n))return n});r.length&&this.throwMissingFieldsException("fixtures",r),this.validatePredictionKey(e.market,e.prediction)});o(this,"validateTiebreaker",e=>{let t=Object.keys(e);(!t.length||typeof e!="object")&&this.throwInvalidType("tiebreaker","object");let r=Object.keys(new fl)[0];t.forEach(n=>{r!==n&&this.throwInvalidParamException([n])}),t.includes(r)||this.throwMissingFieldsException("tiebreaker",[r]),typeof e.goldenGoal!="number"&&this.throwInvalidType("goldenGoal","number")});o(this,"validatePredictionKey",(e,t)=>{if(typeof t=="object"){let r=Object.keys(t),n=["value"];if(r.length||this.throwMissingFieldsException("prediction",n),r.length===1&&!r.includes(n[0])&&this.throwInvalidParamException(r),r.length>1){Vn.includes(e)&&n.push("playerId");let i=r.filter(a=>!n.includes(a));i.length&&this.throwInvalidParamException(i)}}else this.throwInvalidType("prediction","object")});o(this,"validatePlayerId",(e,t)=>{let r="playerId";e!==dl&&(t||this.throwInvalidParamException([r]),typeof t!="string"&&this.throwInvalidType(r,"string"))});o(this,"validateMarket",e=>{Object.values(ul).includes(e)||this.throwInvalidMarketException(e)});o(this,"validateMarketTopX",e=>{e!=="CORRECT_SCORE"&&e!=="CORRECT_SCORE_ADVANCED"&&this.throwInvalidMarketException(e,"TOP_X")});o(this,"isPredictionBoolean",e=>typeof e=="boolean");o(this,"throwInvalidPredictionException",(e,t)=>{let r=SP(e,t);throw this.errorHandlingMode==="default"?new mt(400,"INVALID_PREDICTION",r):new et(400,"INVALID_TYPE",r)});o(this,"throwInvalidMarketException",(e,t)=>{let r=null;throw t&&t==="TOP_X"?r=TP(e):r=yv(e),this.errorHandlingMode==="default"?new mt(400,"INVALID_MARKET",r):new et(400,"INVALID_TYPE",r)});o(this,"throwInvalidParamException",e=>{let t=EP(e);throw this.errorHandlingMode==="default"?new mt(400,"INVALID_FIELD",t):new et(400,"INVALID_TYPE",t)});o(this,"throwMissingFieldsException",(e,t)=>{let r=AP(e,t);throw this.errorHandlingMode==="default"?new mt(400,"INVALID_FIELD",r):new et(400,"INVALID_TYPE",r)});o(this,"throwInvalidType",(e,t)=>{let r=OP(e,t);throw this.errorHandlingMode==="default"?new mt(400,"INVALID_TYPE",r):new et(400,"INVALID_TYPE",r)});this.errorHandlingMode=e}},hM=class{constructor(e,t,r,n){o(this,"predictorHttps",null);o(this,"clientHttps",null);o(this,"idMapping",null);o(this,"predictorService",null);o(this,"predictorValidator",null);o(this,"errorHandlingMode",null);o(this,"makeFootballPrediction",(e,t,r,n)=>C(this,null,function*(){let i=this.predictorValidator.validateFixture(e,t,r,n),a=new gy;if(this.idMapping.idSchema!=="native"){let s=i.matchId,l="",c=yield this.predictorService.remapMatchIdToNative([s]);if(i.matchId=c[0],this.errorHandlingMode==="default"&&!i.matchId)throw new mt(400,"INVALID_FIELD","Match id is invalid!").errorMessage();if(this.errorHandlingMode==="standard"&&!i.matchId)throw new et(400,"INVALID_FIELD","Match id is invalid!");if(i instanceof ta&&i.prediction.playerId!=="OWN_GOAL"){if(i.prediction.playerId&&(l=i.prediction.playerId,i.prediction.playerId=yield this.predictorService.remapPlayerIdToNative([l])),this.errorHandlingMode==="default"&&i.market!==dl&&!i.prediction.playerId)throw new mt(400,"INVALID_FIELD","Player id is invalid!").errorMessage();if(this.errorHandlingMode==="standard"&&i.market!==dl&&!i.prediction.playerId)throw new et(400,"INVALID_FIELD","Player id is invalid!")}a.fixtures=[i];let u=yield this.predictorHttps.makeFootballPrediction(a);return u.fixtures.forEach(d=>{d.prediction.playerId&&d.prediction.playerId!=="OWN_GOAL"&&(d.prediction.playerId=l),d.matchId=s}),u}else return a.fixtures=[i],yield this.predictorHttps.makeFootballPrediction(a)}));o(this,"getMatchSummary",(e,t)=>C(this,null,function*(){let r=yield this.getMatchSummaryBase(e,t),n=JSON.parse(JSON.stringify(r.predictions)),i=yield this.predictorService.remapPlayerIdToIdSchema(n);return r.predictions=i,r}));o(this,"getMarketSummary",(e,t,r,n)=>C(this,null,function*(){try{let i=yield this.getMatchSummaryBase(e,n);return yield this.predictorService.getMarketSummary(i,t,r)}catch(i){throw i}}));o(this,"getMatchSummaryBase",(e,t)=>C(this,null,function*(){if(this.idMapping.idSchema!=="native"){let r=(yield this.predictorService.remapMatchIdToNative([e]))[0],n=yield this.predictorHttps.getMatchSummary(r,t);return n.matchId=e,n}else return yield this.predictorHttps.getMatchSummary(e,t)}));o(this,"getConfig",()=>C(this,null,function*(){let e=yield this.clientHttps.getConfig("predictor");return this.idMapping.idSchema!=="native"?yield this.predictorService.remapCompetitionsFromConfig(e):e}));o(this,"deleteFootballPrediction",e=>C(this,null,function*(){return yield this.predictorHttps.deleteFootballPrediction(e)}));o(this,"getMyPredictions",e=>C(this,null,function*(){let t=this.predictorService.initPredictionsFilters(e,"user");return yield this.predictorHttps.getMyPredictions(t)}));o(this,"getMyPredictionsForMatches",(e,t)=>C(this,null,function*(){if(this.errorHandlingMode==="default"&&this.predictorService.areIdsExceeded(e))throw new mt(400,"EXCEEDED_LENGTH","Maximum matchIds in PredictionFilters should be 10 or less.").errorMessage();if(this.errorHandlingMode==="standard"&&this.predictorService.areIdsExceeded(e))throw new et(400,"EXCEEDED_LENGTH","Maximum matchIds in PredictionFilters should be 10 or less.");this.idMapping.idSchema!=="native"&&(e=yield this.predictorService.remapMatchIdToNative([...e]));let r=this.predictorService.initPredictionsFilters(t,"matches",e);return yield this.predictorHttps.getMyPredictions(r)}));o(this,"getMyCurrentPredictions",e=>C(this,null,function*(){let t=this.predictorService.initPredictionsFilters(e,"current");return yield this.predictorHttps.getMyPredictions(t)}));o(this,"getMyPastPredictions",e=>C(this,null,function*(){let t=this.predictorService.initPredictionsFilters(e,"past");return yield this.predictorHttps.getMyPredictions(t)}));o(this,"getUserPredictions",(e,t,r)=>C(this,null,function*(){let n=this.predictorService.initPredictionsFilters(t,"user");return yield this.predictorHttps.getUserPredictions(e,r,n)}));o(this,"getUserCurrentPredictions",(e,t,r)=>C(this,null,function*(){let n=this.predictorService.initPredictionsFilters(t,"current");return yield this.predictorHttps.getUserPredictions(e,r,n)}));o(this,"getUserPastPredictions",(e,t,r)=>C(this,null,function*(){let n=this.predictorService.initPredictionsFilters(t,"past");return yield this.predictorHttps.getUserPredictions(e,r,n)}));o(this,"getUserPredictionsForMatches",(e,t,r,n)=>C(this,null,function*(){if(this.errorHandlingMode==="default"&&this.predictorService.areIdsExceeded(t))throw new mt(400,"EXCEEDED_LENGTH","Maximum matchIds in PredictionFilters should be 10 or less.").errorMessage();if(this.errorHandlingMode==="standard"&&this.predictorService.areIdsExceeded(t))throw new et(400,"EXCEEDED_LENGTH","Maximum matchIds in PredictionFilters should be 10 or less.");this.idMapping.idSchema!=="native"&&(t=yield this.predictorService.remapMatchIdToNative([...t]));let i=this.predictorService.initPredictionsFilters(r,"matches",t);return yield this.predictorHttps.getUserPredictions(e,n,i)}));o(this,"getPredictionById",e=>C(this,null,function*(){return yield this.predictorHttps.getPredictionById(e)}));o(this,"getPredictionsByIds",e=>C(this,null,function*(){return yield this.predictorHttps.getPredictionsByIds(e)}));o(this,"getMatchMarketsResults",e=>C(this,null,function*(){return this.idMapping.idSchema!=="native"&&(e=(yield this.predictorService.remapMatchIdToNative([e]))[0]),yield this.predictorService.getMatchMarketsResults(e)}));this.predictorHttps=t,this.idMapping=n,this.clientHttps=r,this.errorHandlingMode=e.errorHandlingMode,this.predictorValidator=new $d(e.errorHandlingMode),this.predictorService=new gl(e,n)}},vy=class{constructor(e){o(this,"predictorHttps",null);o(this,"clientHttps",null);o(this,"predictorFacade",null);o(this,"idMapping",null);o(this,"makeFootballPrediction",(e,t,r,n)=>C(this,null,function*(){return yield this.predictorFacade.makeFootballPrediction(e,t,r,n)}));o(this,"getMatchSummary",(e,t)=>C(this,null,function*(){return yield this.predictorFacade.getMatchSummary(e,t)}));o(this,"getMarketSummary",(e,t,r,n)=>C(this,null,function*(){return yield this.predictorFacade.getMarketSummary(e,t,r,n)}));o(this,"getConfig",()=>C(this,null,function*(){return yield this.predictorFacade.getConfig()}));o(this,"deleteFootballPrediction",e=>C(this,null,function*(){return yield this.predictorFacade.deleteFootballPrediction(e)}));o(this,"getMyPredictions",e=>C(this,null,function*(){return yield this.predictorFacade.getMyPredictions(e)}));o(this,"getMyCurrentPredictions",e=>C(this,null,function*(){return yield this.predictorFacade.getMyCurrentPredictions(e)}));o(this,"getMyPastPredictions",e=>C(this,null,function*(){return yield this.predictorFacade.getMyPastPredictions(e)}));o(this,"getMyPredictionsForMatches",(e,t)=>C(this,null,function*(){return yield this.predictorFacade.getMyPredictionsForMatches(e,t)}));o(this,"getUserPredictions",(e,t,r)=>C(this,null,function*(){return yield this.predictorFacade.getUserPredictions(e,t,r)}));o(this,"getUserCurrentPredictions",(e,t,r)=>C(this,null,function*(){return yield this.predictorFacade.getUserCurrentPredictions(e,t,r)}));o(this,"getUserPastPredictions",(e,t,r)=>C(this,null,function*(){return yield this.predictorFacade.getUserPastPredictions(e,t,r)}));o(this,"getUserPredictionsForMatches",(e,t,r,n)=>C(this,null,function*(){return yield this.predictorFacade.getUserPredictionsForMatches(e,t,r,n)}));o(this,"getPredictionById",e=>C(this,null,function*(){return yield this.predictorFacade.getPredictionById(e)}));o(this,"getPredictionsByIds",e=>C(this,null,function*(){return yield this.predictorFacade.getPredictionsByIds(e)}));o(this,"getMatchMarketsResults",e=>C(this,null,function*(){return yield this.predictorFacade.getMatchMarketsResults(e)}));this.idMapping=new dr(e),this.predictorHttps=new ko(e,this.idMapping),this.clientHttps=new hi(e),this.predictorFacade=new hM(e,this.predictorHttps,this.clientHttps,this.idMapping)}},pM=class{constructor(){o(this,"templateId",null);o(this,"privateLeagueId",null);o(this,"fromDate",null);o(this,"toDate",null);o(this,"pagination",new Xi)}},mM=class{constructor(){o(this,"rankType",null);o(this,"fromDate",null);o(this,"toDate",null);o(this,"pagination",new Xi)}},yy=class{constructor(){o(this,"position",null);o(this,"profileId",null);o(this,"profileModel",null);o(this,"points",null);o(this,"predictionsMade",null)}},gM=class{constructor(){o(this,"remapResponse",e=>(e.meta=this.remapMeta(e.meta),e.data=this.remapData(e.data),e));o(this,"remapLeagueLeaderboardResponse",e=>(e.meta=this.remapLeagueLeaderboardMeta(e.meta),e.data=this.remapData(e.data),e));o(this,"remapMeta",e=>{let t=new mM;return t.rankType=e.rank_type,t.fromDate=e.from_date,t.toDate=e.to_date,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});o(this,"remapLeagueLeaderboardMeta",e=>{let t=new pM;return t.templateId=e.template_id,t.privateLeagueId=e.private_league_id,t.fromDate=e.from_date,t.toDate=e.to_date,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});o(this,"remapData",e=>{let t=[];return e.forEach(r=>{let n=new yy;n.position=r.position,n.profileId=r.profile_id,n.points=r.points,n.predictionsMade=r.predictions_made,t.push(n)}),t})}},vM=class{constructor(){o(this,"templateId","");o(this,"templateModel",null);o(this,"challengeId","");o(this,"challengeModel",null);o(this,"position","");o(this,"points",0);o(this,"type","challenge")}},yM=class{constructor(){o(this,"templateId","");o(this,"templateModel",null);o(this,"privateLeagueId","");o(this,"privateLeagueModel",null);o(this,"position","");o(this,"points",0);o(this,"type","private_league")}},bM=class extends yy{constructor(){super(...arguments);o(this,"id",null);o(this,"rankType",null);o(this,"model",null);o(this,"gameType",null)}},wM=class{constructor(){o(this,"remapRankings",e=>(e.meta=this.remapMeta(e.meta),e.data=this.remapData(e.data),e));o(this,"remapRankingsPrivateLeague",e=>(e.meta=this.remapMeta(e.meta),e.data=this.remapDataUserRankingPrivateLeague(e.data),e));o(this,"remapRankingsChallenge",e=>(e.meta=this.remapMeta(e.meta),e.data=this.remapDataUserRankingChallenge(e.data),e));o(this,"remapMeta",e=>{let t=new Zi;return t.pagination.currentPage=e.pagination.current_page,t.pagination.itemsPerPage=e.pagination.items_per_page,t.pagination.numberOfPages=e.pagination.number_of_pages,t.pagination.totalItems=e.pagination.total_items,t})}remapData(e){let t=[];return e.forEach(r=>{let n=new bM;n.id=r.id,n.rankType=r.rank_type,n.position=r.position,n.points=r.points,n.gameType=r.game_type,delete n.profileId,delete n.profileModel,delete n.predictionsMade,t.push(n)}),t}remapDataUserRankingPrivateLeague(e){let t=[];return e.forEach(r=>{let n=new yM;n.templateId=r.template_id,n.privateLeagueId=r.private_league_id,n.position=r.position,n.points=r.points,t.push(n)}),t}remapDataUserRankingChallenge(e){let t=[];return e.forEach(r=>{let n=new vM;n.templateId=r.template_id,n.challengeId=r.private_league_id,n.position=r.position,n.points=r.points,t.push(n)}),t}},_M=class{constructor(){o(this,"flags","");o(this,"status","");o(this,"type","");o(this,"activeFrom","");o(this,"activeTo","");o(this,"createdFrom","");o(this,"createdTo","");o(this,"updatedFrom","");o(this,"updatedTo","")}},xM=class{constructor(){o(this,"pagination",new Xi);o(this,"filters",new _M)}},by=class{constructor(){o(this,"id",null);o(this,"name",null);o(this,"description",null);o(this,"type",null);o(this,"fromDate",null);o(this,"toDate",null);o(this,"markets",[]);o(this,"teamIds",[]);o(this,"matchIds",[]);o(this,"groups",[]);o(this,"gameIds",[]);o(this,"gameTypes",[]);o(this,"competitionIds",[]);o(this,"excludedProfileIds",[]);o(this,"rules",null);o(this,"labels",null);o(this,"customFields",null);o(this,"branding",null);o(this,"flags",null);o(this,"images",new Ao);o(this,"status",null);o(this,"automaticallyChangeStatus",!0);o(this,"createdAt",null);o(this,"updatedAt",null);o(this,"related",null)}},CM=class extends by{constructor(){super(...arguments);o(this,"adContent",null)}},IM=class{constructor(){o(this,"fromDate",null);o(this,"toDate",null);o(this,"matchIds",[])}},SM=class{constructor(){o(this,"groupId",null);o(this,"label",null);o(this,"flags",[]);o(this,"filters",null)}},TM=class extends Po{constructor(){super(...arguments);o(this,"remapResponse",t=>{let r=[];return t.forEach(n=>{let i=new by;i.id=n.id,i.name=n.name,i.description=n.description,i.type=n.type,i.fromDate=n.from_date,i.toDate=n.to_date,i.markets=n.markets?n.markets:null,i.teamIds=n.team_ids?n.team_ids:null,i.matchIds=n.match_ids?n.match_ids:null,i.groups=n.groups?this.remapGroups(n.groups):null,i.gameIds=n.game_ids?n.game_ids:null,i.gameTypes=n.game_types?n.game_types:null,i.competitionIds=n.competition_ids?n.competition_ids:null,i.excludedProfileIds=n.excluded_profile_ids?n.excluded_profile_ids:null,i.rules=n.rules?n.rules:null,i.labels=n.labels?n.labels:null,i.customFields=n.custom_fields?n.custom_fields:null,i.branding=n.branding?this.remapBranding(n.branding):null,i.flags=n.flags?n.flags:null,i.images=n.images?n.images:null,i.status=n.status?n.status:null,i.automaticallyChangeStatus=n.automatically_change_status,i.createdAt=n.created_at,i.updatedAt=n.updated_at,i.related=n.related?this.remapRelated(n.related):null,r.push(i)}),r});o(this,"remapResponseId",t=>{let r=new CM;return r.id=t.id,r.name=t.name,r.description=t.description,r.type=t.type,r.fromDate=t.from_date,r.toDate=t.to_date,r.markets=t.markets?t.markets:null,r.teamIds=t.team_ids?t.team_ids:null,r.matchIds=t.match_ids?t.match_ids:null,r.groups=t.groups?this.remapGroups(t.groups):null,r.gameIds=t.game_ids?t.game_ids:null,r.gameTypes=t.game_types?t.game_types:null,r.competitionIds=t.competition_ids?t.competition_ids:null,r.excludedProfileIds=t.excluded_profile_ids?t.excluded_profile_ids:null,r.rules=t.rules?t.rules:null,r.flags=t.flags?t.flags:null,r.images=t.images?t.images:null,r.status=t.status?t.status:null,r.automaticallyChangeStatus=t.automatically_change_status,r.related=t.related?this.remapRelated(t.related):null,r.labels=t.labels,r.customFields=t.custom_fields,r.branding=t.branding?this.remapBranding(t.branding):null,r.adContent=t.ad_content,r.createdAt=t.created_at,r.updatedAt=t.updated_at,r});o(this,"remapMeta",t=>{let r=new xM;return r.pagination.currentPage=t.pagination.current_page,r.pagination.itemsPerPage=t.pagination.items_per_page,r.pagination.totalItems=t.pagination.total_items,r.pagination.numberOfPages=t.pagination.number_of_pages,r.filters.flags=t.filters.flags,r.filters.status=t.filters.status,r.filters.type=t.filters.type,r.filters.activeFrom=t.filters.active_from,r.filters.activeTo=t.filters.active_to,r.filters.createdFrom=t.filters.created_from,r.filters.createdTo=t.filters.created_to,r.filters.updatedFrom=t.filters.updated_from,r.filters.updatedTo=t.filters.updated_to,r});o(this,"remapRelated",t=>t.map(r=>{let n=new my;return n.entityId=r.entity_id,n.entityType=r.entity_type,n}));o(this,"remapGroups",t=>t.map(r=>{let n=new SM;return n.groupId=r.group_id,n.label=r.label,n.flags=r.flags,n.filters=this.remapGroupFilters(r.filters),n}));o(this,"remapGroupFilters",t=>{let r=new IM;return r.fromDate=t.from_date,r.toDate=t.to_date,r.matchIds=t.match_ids,r})}},EM=class{constructor(){o(this,"position",null);o(this,"points",null);o(this,"predictionsMade",null);o(this,"profileId",null);o(this,"profileModel",null);o(this,"successRatePercent",null)}},AM=class{constructor(){o(this,"remapHighestSuccessRate",e=>e.map(t=>{let r=new EM;return r.position=t.position,r.points=t.points,r.predictionsMade=t.predictions_made,r.profileId=t.profile_id,r.successRatePercent=t.success_rate_percent,r}))}},Nd=class extends qr{constructor(t){super(t,Rr(t.environment,"loyalty"));o(this,"templateRemapper",null);o(this,"leaderboardRemapper",null);o(this,"rankingsRemapper",null);o(this,"highestSuccessRateRemapper",null);o(this,"getTemplates",(t,r)=>C(this,null,function*(){let n=t?`/leaderboard/templates/${this.apiSignInUrl}${t.constructFiltersUrl()}`:`/leaderboard/templates/${this.apiSignInUrl}`;n+=ut(r)?Ze():"";let i="There was a problem fetching the list of templates",a=yield this.fetchWithoutAuth(n,i),s=JSON.parse(JSON.stringify(a));return s.meta=this.templateRemapper.remapMeta(a.meta),s.data=this.templateRemapper.remapResponse(a.data),s}));o(this,"getTemplateById",(t,r)=>C(this,null,function*(){let n=ut(r)?`/leaderboard/templates/${t}${this.apiSignInUrl}${Ze()}`:`/leaderboard/templates/${t}${this.apiSignInUrl}`,i=`There was a problem requesting the following template: ${t}`,a=yield this.fetchWithoutAuth(n,i);return this.templateRemapper.remapResponseId(a.data)}));o(this,"getLeaderboard",(t,r,n)=>C(this,null,function*(){let i=ut(r)?`/leaderboard/${t}${this.apiSignInUrl}${Ze()}`:`/leaderboard/${t}${this.apiSignInUrl}`,a=`There was a problem fetching the leaderboard for the following template: ${t}`;n&&(i+=`${n.constructFiltersUrl()}`);let s=yield this.fetchWithoutAuth(i,a),l=JSON.parse(JSON.stringify(s));return this.leaderboardRemapper.remapResponse(l)}));o(this,"getLeaderboardForGame",(t,r,n)=>C(this,null,function*(){let i=ut(r)?`/leaderboard/games/${t}${this.apiSignInUrl}${Ze()}`:`/leaderboard/games/${t}${this.apiSignInUrl}`,a=`There was a problem fetching the leaderboard for the following game: ${t}`;n&&(i+=`${n.constructFiltersUrl()}`);let s=yield this.fetchWithoutAuth(i,a),l=JSON.parse(JSON.stringify(s));return this.leaderboardRemapper.remapResponse(l)}));o(this,"getLeaderboardForLeague",(t,r)=>C(this,null,function*(){let n=`/private-league/${t}${this.apiSignInUrl}`,i=`There was a problem fetching the leaderboard for the following league: ${t}`;r&&(n+=`${r.constructFiltersUrl()}`);let a=yield this.fetchWithoutAuth(n,i);return this.leaderboardRemapper.remapLeagueLeaderboardResponse(a)}));o(this,"getUserRankings",(t,r,n)=>C(this,null,function*(){let i=`/leaderboard/users/${t}/rankings${this.apiSignInUrl}`,a=`There was a problem fetching the rankings for the following user: ${t}`;r&&(i+=`${r.constructFiltersUrl()}`),ut(n)&&(i+=`${Ze()}`);let s=yield this.fetchWithoutAuth(i,a);return this.rankingsRemapper.remapRankings(s)}));o(this,"getHighestSuccessRate",(t,r)=>C(this,null,function*(){let n=`/statistics/top${this.apiSignInUrl}`,i="There was a problem fetching highest success rate";t&&(n+=`${t.constructFiltersUrl()}`),ut(r)&&(n+=`${Ze()}`);let a=yield this.fetchWithoutAuth(n,i);return this.highestSuccessRateRemapper.remapHighestSuccessRate(a.data)}));o(this,"getEntitiesFollows",(t,r)=>C(this,null,function*(){let n=ut(r)?`/statistics/follows${this.apiSignInUrl}${Ze()}`:`/statistics/follows${this.apiSignInUrl}`;return t.footballCompetitions&&(n+=`&competitions=${t.footballCompetitions.join(",")}`),t.footballTeams&&(n+=`&teams=${t.footballTeams.join(",")}`),t.footballPlayers&&(n+=`&players=${t.footballPlayers.join(",")}`),(yield this.fetchWithoutAuth(n,"There was a problem fetching follows for entities")).data}));o(this,"getUserRankingsForPrivateLeagueAndChallenges",(t,r,n)=>C(this,null,function*(){let i=`/private-league/users/${t}/rankings${this.apiSignInUrl}&private_league_type=${r==="PRIVATE_LEAGUE"?"private":"one_vs_one"}`,a=`There was a problem fetching user rankings for ${r}`;n&&(i+=`${n.constructFiltersUrl()}`);let s=yield this.fetchWithoutAuth(i,a);return r==="PRIVATE_LEAGUE"?this.rankingsRemapper.remapRankingsPrivateLeague(s):this.rankingsRemapper.remapRankingsChallenge(s)}));this.templateRemapper=new TM,this.leaderboardRemapper=new gM,this.rankingsRemapper=new wM,this.highestSuccessRateRemapper=new AM}},wy=class{constructor(e){o(this,"predictorHttps",null);o(this,"predictorService",null);o(this,"idMapping",null);o(this,"clientHttps",null);o(this,"predictorValidator",null);o(this,"errorHandlingMode",null);o(this,"getConfig",()=>C(this,null,function*(){let e=yield this.clientHttps.getConfig("matchQuiz");return this.idMapping.idSchema!=="native"?yield this.predictorService.remapCompetitionsFromConfig(e):e}));o(this,"play",e=>C(this,null,function*(){e=this.predictorValidator.validateBodyFields("MATCH_QUIZ",e);let t=e.fixtures.map(r=>this.predictorValidator.validateFixture(r.matchId,r.market,r.prediction.value,r.prediction.playerId));if(t&&t.length&&this.idMapping.idSchema!=="native"){let r=[],n=[];t.forEach(s=>{r.push(s.matchId),s instanceof ta&&s.prediction.playerId&&s.prediction.playerId!=="OWN_GOAL"&&n.push(s.prediction.playerId)});let i=yield this.predictorService.remapMatchIdToNative(r),a={};n&&n.length>0&&(a=yield this.predictorService.remapPlayerIdMapToNative(n)),t.forEach((s,l)=>{s.matchId=i[l],s instanceof ta&&s.prediction.playerId!=="OWN_GOAL"&&(s.prediction.playerId=a[s.prediction.playerId])})}return e.fixtures=t,yield this.predictorHttps.makeFootballPrediction(e)}));o(this,"delete",e=>C(this,null,function*(){return yield this.predictorHttps.deleteFootballPrediction(e)}));o(this,"getGames",(e,t)=>C(this,null,function*(){t=t||!1;let r=this.predictorService.initGameFilters("MATCH_QUIZ",e),n=yield this.predictorHttps.getGames(r,t);return yield this.predictorService.remapMatchIdsFixtures(n)}));o(this,"getGameById",(e,t)=>C(this,null,function*(){t=t||!1;let r=yield this.predictorHttps.getGameById(e,t);return yield this.predictorService.remapMatchIdsFixtures(r)}));o(this,"getGamePredictions",(e,t,r)=>C(this,null,function*(){return r=r||!1,t&&(t.type&&delete t.type,t.status&&delete t.status,t=new Gr(t)),yield this.predictorHttps.getGamePredictions(e,r,t)}));o(this,"getGameResults",(e,t,r)=>C(this,null,function*(){r=r||!1,t&&(t=new Yr(t));let n=yield this.predictorHttps.getGameResults(e,r,t);return yield this.predictorService.remapMatchIdsFixtures(n)}));o(this,"getCurrentGameResults",e=>C(this,null,function*(){e=e||!1;let t=new mi(null);t.status="OPEN",t.type="MATCH_QUIZ";let r=yield this.predictorHttps.getGames(t,e),n=this.predictorService.getCurrentGameId(r);return(yield this.getGameResults(n,null,e)).data[0]}));o(this,"getMyGameEditions",(e,t)=>C(this,null,function*(){e&&e.limit&&this.validateLimitFilterOnGames(e.limit),t=t||!1;let r=this.predictorService.initGameTypePredictions("MATCH_QUIZ",e),n=[],i=yield this.predictorHttps.getMyPredictionsNoRemap(r);if(i.data.length>0){i.data.forEach(l=>{l.game_instance_id&&n.push(l.game_instance_id)});let a=this.predictorService.initGameFilters("MATCH_QUIZ",null,n),s=yield this.predictorHttps.getUserGameEditions(a,t);return yield this.predictorService.addPredictionProp(i,s)}else return new _r}));o(this,"getMyGamePrediction",e=>C(this,null,function*(){let t=this.predictorService.initGameTypePredictions("MATCH_QUIZ"),r=yield this.predictorHttps.getMyPredictions(t);if(r.data.length>0){let n=r.data.filter(i=>i.gameInstanceId===e);return n.length?n[0]:null}return null}));o(this,"getUserGameEditions",(e,t,r)=>C(this,null,function*(){t&&t.limit&&this.validateLimitFilterOnGames(t.limit),r=r||!1;let n=this.predictorService.initGameTypePredictions("MATCH_QUIZ",t),i=[],a=yield this.predictorHttps.getUserPredictionsNoRemap(e,n);if(a.data.length>0){a.data.forEach(c=>{c.game_instance_id&&i.push(c.game_instance_id)});let s=this.predictorService.initGameFilters("MATCH_QUIZ",null,i),l=yield this.predictorHttps.getUserGameEditions(s,r);return yield this.predictorService.addPredictionProp(a,l)}else return new _r}));o(this,"getUserGamePrediction",(e,t,r)=>C(this,null,function*(){r=r||!1;let n=this.predictorService.initGameTypePredictions("MATCH_QUIZ"),i=yield this.predictorHttps.getUserPredictions(e,r,n);if(i.data.length>0){let a=i.data.filter(s=>s.gameInstanceId===t);return a.length?a[0]:null}else return null}));o(this,"getMarketsResultsForGame",(e,t)=>C(this,null,function*(){let r=yield this.predictorHttps.getMarketResultsForGame(e,t);return yield this.predictorService.completeGameMarketResults(r,"MATCH_QUIZ")}));o(this,"getGameWinners",(e,t)=>C(this,null,function*(){let r=yield this.predictorHttps.getContestWinners(e,t),n=yield this.getGameById(e);return r.contestModel=n,this.predictorService.completeContestWinners(r)}));o(this,"validateLimitFilterOnGames",e=>{if(this.errorHandlingMode==="default"&&e>50)throw new mt(400,"EXCEEDED_LENGTH","Maximum limit for filtering games is 50 or less.");if(this.errorHandlingMode==="standard"&&e>50)throw new et(400,"EXCEEDED_LENGTH","Maximum limit for filtering games is 50 or less.")});this.predictorValidator=new $d(e.errorHandlingMode),this.idMapping=new dr(e),this.predictorHttps=new ko(e,this.idMapping),this.predictorService=new gl(e,this.idMapping),this.clientHttps=new hi(e),this.errorHandlingMode=e.errorHandlingMode}},_y=class{constructor(e){o(this,"matchQuizFacade",null);o(this,"getConfig",()=>C(this,null,function*(){return yield this.matchQuizFacade.getConfig()}));o(this,"play",e=>C(this,null,function*(){return yield this.matchQuizFacade.play(e)}));o(this,"delete",e=>C(this,null,function*(){return yield this.matchQuizFacade.delete(e)}));o(this,"getGames",(e,t)=>C(this,null,function*(){return yield this.matchQuizFacade.getGames(e,t)}));o(this,"getGameById",(e,t)=>C(this,null,function*(){return yield this.matchQuizFacade.getGameById(e,t)}));o(this,"getGamePredictions",(e,t,r)=>C(this,null,function*(){return yield this.matchQuizFacade.getGamePredictions(e,t,r)}));o(this,"getGameResults",(e,t,r)=>C(this,null,function*(){return yield this.matchQuizFacade.getGameResults(e,t,r)}));o(this,"getCurrentGameResults",e=>C(this,null,function*(){return yield this.matchQuizFacade.getCurrentGameResults(e)}));o(this,"getMyGameEditions",(e,t)=>C(this,null,function*(){return yield this.matchQuizFacade.getMyGameEditions(e,t)}));o(this,"getMyGamePrediction",e=>C(this,null,function*(){return yield this.matchQuizFacade.getMyGamePrediction(e)}));o(this,"getUserGameEditions",(e,t,r)=>C(this,null,function*(){return yield this.matchQuizFacade.getUserGameEditions(e,t,r)}));o(this,"getUserGamePrediction",(e,t,r)=>C(this,null,function*(){return yield this.matchQuizFacade.getUserGamePrediction(e,t,r)}));o(this,"getMarketsResultsForGame",(e,t)=>C(this,null,function*(){return yield this.matchQuizFacade.getMarketsResultsForGame(e,t)}));o(this,"getGameWinners",(e,t)=>C(this,null,function*(){return yield this.matchQuizFacade.getGameWinners(e,t)}));this.matchQuizFacade=new wy(e)}},xy=class{constructor(){o(this,"id",null);o(this,"title",null);o(this,"description",null);o(this,"type",null);o(this,"images",new Ao);o(this,"participationCount",null);o(this,"questionsCount",null);o(this,"status",null);o(this,"flags",null);o(this,"customFields",null);o(this,"labels",null);o(this,"branding",null);o(this,"time",null);o(this,"points",null);o(this,"scored",!1);o(this,"maxAttempts",null);o(this,"averageScore",null);o(this,"perfectScore",null);o(this,"adContent",null);o(this,"context",null);o(this,"createdAt",null);o(this,"updatedAt",null)}},OM=class extends xy{constructor(){super(...arguments);o(this,"rules",null);o(this,"questions",[])}},PM=class{constructor(){o(this,"questionId",null);o(this,"question",null);o(this,"images",null);o(this,"embedCode",null);o(this,"explanation",null);o(this,"options",[])}},kM=class{constructor(){o(this,"optionId",null);o(this,"option",null);o(this,"images",null);o(this,"correct",null)}},RM=class{constructor(){o(this,"classicQuizId",null);o(this,"userId",null);o(this,"questions",[]);o(this,"correctOptions",null);o(this,"personalBest",null);o(this,"points",null);o(this,"attempts",null)}},MM=class{constructor(){o(this,"questionId",null);o(this,"optionId",null);o(this,"correct",null);o(this,"correctOptionId",null)}},DM=class{constructor(){o(this,"classicQuizId",null);o(this,"classicQuizModel",null);o(this,"correct",null);o(this,"classicQuizQuestions",null);o(this,"personalBest",null);o(this,"points",null);o(this,"answers",[])}},Cy=class{constructor(){o(this,"content",null);o(this,"tags",[]);o(this,"campaign",null)}},Iy=class{constructor(){o(this,"id",null);o(this,"model",null);o(this,"source",null);o(this,"type",null)}},Sy=class{constructor(){o(this,"classicQuizIds",null)}},LM=class{constructor(){o(this,"pagination",new Xi);o(this,"filters",new Sy)}},FM=class{constructor(){o(this,"position",null);o(this,"profileId",null);o(this,"profileModel",null);o(this,"points",null)}},$M=class{constructor(){o(this,"position",null);o(this,"classicQuizId",null);o(this,"classicQuizModel",null);o(this,"points",null)}},NM=class{constructor(){o(this,"questionId",null);o(this,"questionModel",null);o(this,"wrong",null);o(this,"correct",null);o(this,"skipped",null);o(this,"total",null)}},BM=class extends Po{constructor(){super(...arguments);o(this,"remapClassicQuizzes",t=>(t.meta.pagination=this.remapMetaPagination(t.meta.pagination),t.data=t.data.map(r=>this.remapBasicClassicQuiz(r)),t));o(this,"remapClassicQuizById",t=>{let r=new OM;return r.id=t.id,r.title=t.title,r.description=t.description,r.type=t.type,r.images=t.images,r.participationCount=t.participation_count,r.questionsCount=t.questions_count,r.status=t.status,r.flags=t.flags,r.adContent=t.ad_content,r.rules=t.rules,r.customFields=t.custom_fields,r.branding=t.branding?this.remapBranding(t.branding):null,r.labels=t.labels,r.time=t.time,r.points=t.points,r.scored=t.scored,r.maxAttempts=t.max_attempts,r.context=t.context?this.remapContext(t.context):t.context,r.averageScore=t.average_score,r.perfectScore=t.perfect_score,r.questions=t.questions.map(n=>this.remapQuestions(n)),r.createdAt=t.created_at,r.updatedAt=t.updated_at,r});o(this,"remapClassicQuizParticipation",t=>{let r=new RM;return r.classicQuizId=t.classic_quiz_id,r.userId=t.user_id,r.questions=t.questions?t.questions.map(n=>this.remapParticipationQuestions(n)):null,r.correctOptions=t.correct_options,r.personalBest=t.personal_best,r.points=t.points,r.attempts=t.attempts,r});o(this,"remapClassicQuizParticipationBody",t=>t.map(r=>({question_id:r.questionId,option_id:r.optionId})));o(this,"remapUserClassicQuizParticipations",t=>t.map(r=>{let n=new DM;return n.classicQuizId=r.classic_quiz_id,n.correct=r.correct,n.classicQuizQuestions=r.classic_quiz_questions,n.personalBest=r.personal_best,n.points=r.points,n.answers=r.answers?r.answers.map(i=>this.remapParticipationQuestions(i)):r.answers,n}));o(this,"remapClassicQuizzesLeaderboard",t=>(t.meta=this.remapClassicQuizLeaderboardMeta(t.meta),t.data=t.data.map(r=>this.remapClassicQuizLeaderboard(r)),t));o(this,"remapClassicQuizUserRankings",t=>(t.meta.pagination=this.remapMetaPaginationRank(t.meta.pagination),t.data=t.data.map(r=>this.remapClassicQuizUserRanking(r)),t));o(this,"remapClassicQuizQuestionsReport",t=>t.map(r=>{let n=new NM;return n.questionId=r.question_id,n.correct=r.correct,n.wrong=r.wrong,n.skipped=r.skipped,n.total=r.total,n}));o(this,"remapMetaPagination",t=>{let r=new rl;return r.itemsPerPage=t.items_per_page,r.nextPageStartsAfter=t.next_page_starts_after,r});o(this,"remapClassicQuizLeaderboardMeta",t=>{let r=new LM;return r.pagination=this.remapMetaPaginationRank(t.pagination),r.filters=this.remapLeaderboardMetaFilters(t.filters),r});o(this,"remapMetaPaginationRank",t=>{let r=new Xi;return r.currentPage=t.current_page,r.itemsPerPage=t.items_per_page,r.numberOfPages=t.number_of_pages,r.totalItems=t.total_items,r});o(this,"remapLeaderboardMetaFilters",t=>{let r=new Sy;return r.classicQuizIds=(t==null?void 0:t.classic_quiz_ids)||null,r});o(this,"remapClassicQuizUserRanking",t=>{let r=new $M;return r.position=t.position,r.classicQuizId=t.classic_quiz_id,r.points=t.points,r});o(this,"remapBasicClassicQuiz",t=>{let r=new xy;return r.id=t.id,r.title=t.title,r.description=t.description,r.type=t.type,r.images=t.images,r.participationCount=t.participation_count,r.questionsCount=t.questions_count,r.status=t.status,r.flags=t.flags,r.customFields=t.custom_fields,r.branding=t.branding?this.remapBranding(t.branding):null,r.labels=t.labels,r.time=t.time,r.averageScore=t.average_score,r.perfectScore=t.perfect_score,r.points=t.points,r.scored=t.scored,r.maxAttempts=t.max_attempts,r.context=t.context?this.remapContext(t.context):t.context,r.adContent=t.ad_content,r.createdAt=t.created_at,r.updatedAt=t.updated_at,r});o(this,"remapQuestions",t=>{let r=new PM;return r.questionId=t.question_id,r.question=t.question,r.images=t.images,r.embedCode=t.embed_code,r.explanation=t.explanation,r.options=t.options.map(n=>this.remapOptions(n)),r});o(this,"remapOptions",t=>{let r=new kM;return r.optionId=t.option_id,r.option=t.option,r.images=t.images,r.correct=t.correct,r});o(this,"remapParticipationQuestions",t=>{let r=new MM;return r.questionId=t.question_id,r.optionId=t.option_id,r.correct=t.correct,r.correctOptionId=t.correct_option_id,r});o(this,"remapClassicQuizLeaderboard",t=>{let r=new FM;return r.position=t.position,r.profileId=t.profile_id,r.points=t.points,r});o(this,"remapContext",t=>{let r=new Cy;return r.content=t.content,r.tags=t.tags?t.tags.map(n=>{let i=new Iy;return i.id=n.id,i.type=n.type,i.source=n.source,i}):null,r.campaign=t.campaign,r})}},Ty=class{constructor(){o(this,"id","");o(this,"title","");o(this,"description","");o(this,"images",new Ao);o(this,"flags",[]);o(this,"status","");o(this,"winningCondition","");o(this,"lives",0);o(this,"time",0);o(this,"points",[]);o(this,"customFields",null);o(this,"branding",null);o(this,"labels",null);o(this,"adContent","");o(this,"context",null);o(this,"type","");o(this,"createdAt","");o(this,"updatedAt","")}},jM=class extends Ty{constructor(){super(...arguments);o(this,"rules","")}},zM=class{constructor(){o(this,"correctSteps",0);o(this,"score",0)}},HM=class{constructor(){o(this,"eitherOrId","");o(this,"personalBest",0)}},UM=class{constructor(){o(this,"instanceId","");o(this,"eitherOrId","");o(this,"gameStartedAt","");o(this,"currentStep",0);o(this,"currentStreak",0);o(this,"remainingSteps",0);o(this,"currentLives",0);o(this,"currentPoints",0);o(this,"personalBest",0);o(this,"steps",[])}},VM=class{constructor(){o(this,"main");o(this,"mobile")}},Ey=class{constructor(){o(this,"id","");o(this,"label","");o(this,"images",new VM);o(this,"value",null)}},WM=class{constructor(){o(this,"pairId","");o(this,"userSelection","");o(this,"correct",null);o(this,"played",null);o(this,"timestamp","");o(this,"optionOne",new Ey);o(this,"optionTwo",new Ey)}},qM=class{constructor(){o(this,"rangeStartInclusive",0);o(this,"rangeEndInclusive",0);o(this,"totalUsers",0)}},GM=class{constructor(){o(this,"standings",[]);o(this,"breakdown",[])}},YM=class{constructor(){o(this,"userId","");o(this,"userModel",null);o(this,"personalBest","")}},KM=class extends Po{constructor(){super(...arguments);o(this,"remapEitherOrs",t=>(t.meta.pagination=this.remapMetaPagination(t.meta.pagination),t.data=t.data.map(r=>this.remapBasicEitherOr(r)),t));o(this,"remapEitherOrById",t=>{let r=new jM;return r.id=t.id,r.title=t.title,r.description=t.description,r.type=t.type,r.images=t.images,r.status=t.status,r.winningCondition=t.winning_condition,r.lives=t.lives,r.flags=t.flags,r.customFields=t.custom_fields,r.branding=t.branding?this.remapBranding(t.branding):null,r.labels=t.labels,r.time=t.time,r.context=t.context?this.remapContext(t.context):t.context,r.points=t.points?t.points.map(n=>this.remapPoints(n)):t.points,r.rules=t.rules,r.adContent=t.ad_content,r.createdAt=t.created_at,r.updatedAt=t.updated_at,r});o(this,"remapEitherOrOwnStats",t=>{let r=new HM;return r.eitherOrId=t.either_or_id,r.personalBest=t.personal_best,r});o(this,"remapEitherOrResults",t=>{let r=new GM;return r.standings=t.standings?t.standings.map(n=>this.remapResultsStandings(n)):t.standings,r.breakdown=t.breakdown?t.breakdown.map(n=>this.remapResultsBreakdown(n)):t.breakdown,r});o(this,"remapEitherOrParticipation",t=>{let r=new UM;return r.instanceId=t.instance_id,r.eitherOrId=t.either_or_id,r.gameStartedAt=t.game_started_at,r.currentStep=t.current_step,r.currentStreak=t.current_streak,r.remainingSteps=t.remaining_steps,r.currentLives=t.current_lives,r.currentPoints=t.current_points,r.personalBest=t.personal_best,r.steps=t.steps?t.steps.map(n=>this.remapParticipationSteps(n)):t.steps,r});o(this,"remapBasicEitherOr",t=>{let r=new Ty;return r.id=t.id,r.title=t.title,r.description=t.description,r.type=t.type,r.images=t.images,r.status=t.status,r.winningCondition=t.winning_condition,r.lives=t.lives,r.flags=t.flags,r.customFields=t.custom_fields,r.branding=t.branding?this.remapBranding(t.branding):null,r.labels=t.labels,r.adContent=t.ad_content,r.context=t.context?this.remapContext(t.context):t.context,r.time=t.time,r.points=t.points?t.points.map(n=>this.remapPoints(n)):t.points,r.createdAt=t.created_at,r.updatedAt=t.updated_at,r});o(this,"remapMetaPagination",t=>{let r=new rl;return r.itemsPerPage=t.items_per_page,r.nextPageStartsAfter=t.next_page_starts_after,r});o(this,"remapPoints",t=>{let r=new zM;return r.correctSteps=t.correct_steps,r.score=t.score,r});o(this,"remapResultsStandings",t=>{let r=new YM;return r.userId=t.user_id,r.personalBest=t.personal_best,r});o(this,"remapResultsBreakdown",t=>{let r=new qM;return r.rangeStartInclusive=t.range_start_inclusive,r.rangeEndInclusive=t.range_end_inclusive,r.totalUsers=t.total_users,r});o(this,"remapParticipationSteps",t=>{let r=new WM;return r.pairId=t.pair_id,r.userSelection=t.user_selection,r.correct=t.correct,r.played=t.played,r.timestamp=t.timestamp,r.optionOne=t.option_one,r.optionTwo=t.option_two,r});o(this,"remapContext",t=>{let r=new Cy;return r.content=t.content,r.tags=t.tags?t.tags.map(n=>{let i=new Iy;return i.id=n.id,i.type=n.type,i.source=n.source,i}):null,r.campaign=t.campaign,r})}},Ay=class extends qr{constructor(t){super(t,Rr(t.environment,"miniGames"));o(this,"classicQuizRemapper",null);o(this,"eitherOrRemapper",null);o(this,"getClassicQuizzes",(t,r)=>C(this,null,function*(){let n=`/classic-quizzes${this.apiSignInUrl}`;t&&(n+=t.constructMainFiltersUrl()),n+=ut(r)?Ze():"";let i="There was a problem with fetching classic quizzes",a=yield this.fetchWithoutAuth(n,i);return this.classicQuizRemapper.remapClassicQuizzes(a)}));o(this,"getClassicQuizById",(t,r,n)=>C(this,null,function*(){let i=`/classic-quizzes/${t}${this.apiSignInUrl}`;r&&(i+=`&include_correct_options=${r}`),ut(n)&&(i+=Ze());let a="There was a problem with fetching classic quiz by ID",s=yield this.fetchWithoutAuth(i,a);return this.classicQuizRemapper.remapClassicQuizById(s.data)}));o(this,"participateInClassicQuiz",(t,r,n)=>C(this,null,function*(){let i=`/classic-quizzes/${t}/participate${this.apiSignInUrl}`,a=`There was a problem with participating in the following classic quiz: ${t}`,s="POST",l={questions:this.classicQuizRemapper.remapClassicQuizParticipationBody(r),include_correct_options:!!n},c=yield this.fetchWithAuth(i,a,s,l);return this.classicQuizRemapper.remapClassicQuizParticipation(c.data)}));o(this,"getMyClassicQuizParticipations",t=>C(this,null,function*(){let r=`/classic-quizzes/participations${this.apiSignInUrl}`;t&&(r+=`${t.constructMainFiltersUrl()}`);let n="There was a problem with fetching user's own Classic Quiz participations",i=yield this.fetchWithAuth(r,n);return this.classicQuizRemapper.remapUserClassicQuizParticipations(i.data)}));o(this,"getLeaderboardForClassicQuizzes",t=>C(this,null,function*(){let r=`/classic-quizzes/rank${this.apiSignInUrl}`;t&&(r+=`${t.constructMainFiltersUrl()}`);let n="There was a problem with fetching classic quizzes leaderboard",i=yield this.fetchWithoutAuth(r,n);return this.classicQuizRemapper.remapClassicQuizzesLeaderboard(i)}));o(this,"getClassicQuizzesUserRanking",(t,r)=>C(this,null,function*(){let n=`/classic-quizzes/users/${t}/rank${this.apiSignInUrl}`;r&&(n+=`${r.constructMainFiltersUrl()}`);let i="There was a problem with fetching user's rankings for classic quizzes",a=yield this.fetchWithoutAuth(n,i);return this.classicQuizRemapper.remapClassicQuizUserRankings(a)}));o(this,"getClassicQuizQuestionsReport",t=>C(this,null,function*(){let r=`/classic-quizzes/${t}/questions-report${this.apiSignInUrl}`,n=`There was a problem with fetching questions report for quiz: ${t}`,i=yield this.fetchWithoutAuth(r,n);return this.classicQuizRemapper.remapClassicQuizQuestionsReport(i.data)}));o(this,"getEitherOrs",(t,r)=>C(this,null,function*(){let n=`/either-or${this.apiSignInUrl}`;t&&(n+=t.constructMainFiltersUrl()),n+=ut(r)?Ze():"";let i="There was a problem with fetching list of Either/Ors",a=yield this.fetchWithoutAuth(n,i);return this.eitherOrRemapper.remapEitherOrs(a)}));o(this,"getEitherOrById",(t,r)=>C(this,null,function*(){let n=`/either-or/${t}${this.apiSignInUrl}`;ut(r)&&(n+=Ze());let i="There was a problem with fetching Either/Or by ID",a=yield this.fetchWithoutAuth(n,i);return this.eitherOrRemapper.remapEitherOrById(a.data)}));o(this,"getMyEitherOrStats",t=>C(this,null,function*(){let r=`/either-or/${t}/own-stats${this.apiSignInUrl}`,n="There was a problem with fetching Either/Or own statistics",i=yield this.fetchWithAuth(r,n);return this.eitherOrRemapper.remapEitherOrOwnStats(i.data)}));o(this,"getEitherOrResults",(t,r)=>C(this,null,function*(){let n=`/either-or/${t}/results${this.apiSignInUrl}${ut(r)?Ze():""}`,i="There was a problem with fetching Either/Or results",a=yield this.fetchWithoutAuth(n,i);return this.eitherOrRemapper.remapEitherOrResults(a.data)}));o(this,"participateInEitherOr",(t,r)=>C(this,null,function*(){let n=`/either-or/${t}/participate${this.apiSignInUrl}`,i="There was a problem with participating in Either/Or",a="POST",s=yield this.fetchWithAuth(n,i,a,r);return this.eitherOrRemapper.remapEitherOrParticipation(s.data)}));this.classicQuizRemapper=new BM,this.eitherOrRemapper=new KM}},vl=class{constructor(e){o(this,"idSchema");o(this,"idMapping");o(this,"remapTagsIds",(e,t,r)=>C(this,null,function*(){if(!e||!e.length)return e;let n={},i={},a=[];e.forEach(l=>{n.hasOwnProperty(l.type)||(n[l.type]=[],i[l.type]=[]),n[l.type].push(l.id),i[l.type].push(l)});let s=yield this.idMapping.idMappingFacade.getEntitiesByIds(n,t,r);for(let[l,c]of Object.entries(i))c.forEach((u,d)=>{u.id=s[l][d],a.push(u)});return a}));this.idSchema=e.idSchema,this.idMapping=new dr(e)}},Oy=class extends Yr{constructor(t){super(t);o(this,"flags",null);o(this,"status",null);o(this,"entityIds",null);o(this,"entityType",null);o(this,"sort",null);o(this,"groupByStatus",null);this.flags=t&&t.flags?t.flags:null,this.status=t&&t.status?t.status:null,this.entityIds=t&&t.entityIds?t.entityIds:null,this.entityType=t&&t.entityType?t.entityType:null,this.sort=t&&t.sort?t.sort:null,this.groupByStatus=t&&t.groupByStatus!==void 0?t.groupByStatus:null}constructMainFiltersUrl(){let t=super.constructMainFiltersUrl();return this.flags&&this.flags.length>0&&(t+=`&flags=${this.flags.join(",")}`),this.status&&(t+=`&status=${this.status}`),this.entityIds&&this.entityIds.length>0&&(t+=`&entity_ids=${this.entityIds}`),this.sort&&(t+=`&sort=${this.sort}`),this.groupByStatus!==null&&(t+=`&group_by_status=${this.groupByStatus}`),t}},QM=class extends Oy{constructor(t){super(t);o(this,"classicQuizIds",null);this.classicQuizIds=t&&t.classicQuizIds?t.classicQuizIds:null}constructMainFiltersUrl(){let t=super.constructMainFiltersUrl();return this.classicQuizIds&&this.classicQuizIds.length>0&&(t+=`&classic_quiz_ids=${this.classicQuizIds.join(",")}`),t}},Py=class{constructor(e){o(this,"limit",null);o(this,"page",null);this.limit=(e==null?void 0:e.limit)||null,this.page=(e==null?void 0:e.page)||null}constructMainFiltersUrl(){let e="";return this.limit&&(e+=`&limit=${this.limit}`),this.page&&(e+=`&page=${this.page}`),e}},JM=class extends Py{constructor(t){super(t);o(this,"classicQuizIds",null);this.classicQuizIds=(t==null?void 0:t.classicQuizIds)||null}constructMainFiltersUrl(){let t=super.constructMainFiltersUrl();return this.classicQuizIds&&this.classicQuizIds.length>0&&(t+=`&classic_quiz_ids=${this.classicQuizIds.join(",")}`),t}},XM=class extends Yr{constructor(t){super(t);o(this,"classicQuizIds",null);this.classicQuizIds=(t==null?void 0:t.classicQuizIds)||null}constructMainFiltersUrl(){let t=super.constructMainFiltersUrl();return this.classicQuizIds&&this.classicQuizIds.length>0&&(t+=`&classic_quiz_ids=${this.classicQuizIds.join(",")}`),t}},ZM=class extends Oy{constructor(t){super(t);o(this,"eitherOrIds",null);this.eitherOrIds=t&&t.eitherOrIds?t.eitherOrIds:null}constructMainFiltersUrl(){let t=super.constructMainFiltersUrl();return this.eitherOrIds&&this.eitherOrIds.length>0&&(t+=`&either_or_ids=${this.eitherOrIds.join(",")}`),t}},eD=class{constructor(){o(this,"pair","");o(this,"answer","")}},tD=class extends eD{constructor(){super(...arguments);o(this,"expired",!1);o(this,"time",0)}},Bd=class{constructor(e){o(this,"errorHandlingModel",null);o(this,"entityTypes",["competition","team","player"]);o(this,"validateFilters",e=>{!e.entityIds&&!e.entityType||(e.entityIds&&!e.entityType&&this.throwException(400,"invalid_filters","You need to use both 'entityIds' and 'entityType' filters together"),!e.entityIds&&e.entityType&&this.throwException(400,"invalid_filters","You need to use both 'entityIds' and 'entityType' filters together"),this.entityTypes.includes(e.entityType)||this.throwException(400,"invalid_filters","Invalid 'entityType' filter. Please use one of the following valid options: competition, team, or player"))});o(this,"throwException",(e,t,r)=>{throw this.errorHandlingModel==="standard"?new et(e,t,r):new mt(e,t,r)});this.errorHandlingModel=e.errorHandlingMode}},rD=class{constructor(e){o(this,"idSchema",null);o(this,"idMapping",null);o(this,"validator",null);o(this,"https",null);o(this,"entityTypes",["competition","team","player"]);o(this,"profile",null);o(this,"football",null);o(this,"eitherOrTime",0);o(this,"participationStartTimestamp",0);o(this,"countdownTimer",0);o(this,"intervalId",null);o(this,"currentPairId","");o(this,"finalizeMiniGamesFilters",e=>C(this,null,function*(){if(this.idSchema!=="native"&&e.entityIds&&e.entityIds.length>0){this.validator.validateFilters(e);let t=yield this.idMapping.getEntityIdsBySchemaId(Array.from(e.entityIds),e.entityType,"native");e.entityIds=t[e.entityType]}}));o(this,"setProfileModelsForEitherOrStandings",e=>C(this,null,function*(){let t=e.standings.map(n=>n.userId);if(!t.length)return e;let r=yield this.profile.getByIds(t);return e.standings.forEach(n=>n.userModel=r.find(i=>i.id===n.userId)||null),e}));o(this,"setProfileModelsForClassicQuizLeaderboards",e=>C(this,null,function*(){let t=e.map(n=>n.profileId);if(!t.length)return e;let r=yield this.profile.getByIds(t);return e.forEach(n=>n.profileModel=r.find(i=>i.id===n.profileId)||null),e}));o(this,"defaultEitherOrParticipation",(e,t)=>C(this,null,function*(){if(!this.eitherOrTime&&!t){let i=yield this.https.getEitherOrById(e,!0);this.eitherOrTime=i.time;let a=yield this.https.participateInEitherOr(e,null);return this.participationStartTimestamp=Date.now(),a}let r=0;if(this.participationStartTimestamp)r=(Date.now()-this.participationStartTimestamp)/1e3;else{if(!this.eitherOrTime){let i=yield this.https.getEitherOrById(e,!0);this.eitherOrTime=i.time}r=this.eitherOrTime+1}let n=this.createNewParticipation(r,t);try{let i=yield this.https.participateInEitherOr(e,n);return!i.currentLives||!i.remainingSteps?this.resetDefaultParticipationTimers():this.participationStartTimestamp=Date.now(),i}catch(i){throw this.resetDefaultParticipationTimers(),i}}));o(this,"handleEitherOrParticipationWithCallback",(e,t,r)=>C(this,null,function*(){return t?yield this.eitherOrParticipationWithCallback(e,t,r):yield this.initialEitherOrParticipationWithCallback(e,r)}));o(this,"initialEitherOrParticipationWithCallback",(e,t)=>C(this,null,function*(){let r=yield this.https.getEitherOrById(e,!0);this.eitherOrTime=r.time;let n=yield this.https.participateInEitherOr(e,null);return this.participationStartTimestamp=Date.now(),this.countdownTimer=this.eitherOrTime,this.setCurrentPairId(n),yield this.handleEitherOrParticipationCallbackInterface(e,t),n}));o(this,"eitherOrParticipationWithCallback",(e,t,r)=>C(this,null,function*(){this.intervalId&&clearInterval(this.intervalId);let n=0;if(this.participationStartTimestamp)n=(Date.now()-this.participationStartTimestamp)/1e3;else{if(!this.eitherOrTime){let a=yield this.https.getEitherOrById(e,!0);this.eitherOrTime=a.time}n=this.eitherOrTime+1}let i=this.createNewParticipation(n,t);try{let a=yield this.https.participateInEitherOr(e,i);return!a.currentLives||!a.remainingSteps?(this.resetCallbackParticipationTimers(),r.onElapsedResponse(a),clearInterval(this.intervalId)):(this.participationStartTimestamp=Date.now(),this.countdownTimer=this.eitherOrTime,this.setCurrentPairId(a),yield this.handleEitherOrParticipationCallbackInterface(e,r)),a}catch(a){throw this.resetCallbackParticipationTimers(),clearInterval(this.intervalId),a}}));o(this,"setCurrentPairId",e=>{this.currentPairId=e.steps.find(t=>!t.played).pairId||""});o(this,"handleEitherOrParticipationCallbackInterface",(e,t)=>C(this,null,function*(){this.intervalId=setInterval(()=>C(this,null,function*(){if(this.countdownTimer>0)this.countdownTimer--,t.onTimerTick(this.countdownTimer);else{clearInterval(this.intervalId);let r=(Date.now()-this.participationStartTimestamp)/1e3,n={pair:this.currentPairId,answer:this.currentPairId.split("_")[0]},i=this.createNewParticipation(r,n),a=yield this.eitherOrParticipationWithCallback(e,i,t);t.onElapsedResponse(a)}}),1e3)}));o(this,"createNewParticipation",(e,t)=>{let r=new tD;return r.expired=e>this.eitherOrTime,r.time=Number(e.toFixed(3)),r.pair=t.pair,r.answer=t.answer,r});o(this,"resetCallbackParticipationTimers",()=>{this.resetDefaultParticipationTimers(),this.countdownTimer=0,this.currentPairId=""});o(this,"resetDefaultParticipationTimers",()=>{this.eitherOrTime=0,this.participationStartTimestamp=0});o(this,"setContextTagsModels",e=>C(this,null,function*(){let t={competitions:[],teams:[],players:[]};if(e.forEach(r=>{r.context&&r.context.tags&&r.context.tags.length>0&&(t.competitions=[...t.competitions,...this.extractEntityIdsFromTags(r.context.tags,"competition")],t.competitions=Array.from(new Set(t.competitions)),t.teams=[...t.teams,...this.extractEntityIdsFromTags(r.context.tags,"team")],t.teams=Array.from(new Set(t.teams)),t.players=[...t.players,...this.extractEntityIdsFromTags(r.context.tags,"player")],t.players=Array.from(new Set(t.players)))}),t.competitions.length){let r=yield this.football.footballFacade.getCompetitionsMapWithNativeIds(t.competitions);this.setModelsForContextTags(e,r,"competition")}if(t.teams.length){let r=yield this.football.footballFacade.getTeamsMapWithNativeIds(t.teams);this.setModelsForContextTags(e,r,"team")}if(t.players.length){let r=yield this.football.footballFacade.getPlayersMapWithNativeIds(t.players);this.setModelsForContextTags(e,r,"player")}}));o(this,"extractEntityIdsFromTags",(e,t)=>e.filter(r=>r.type===t).map(r=>r.id));o(this,"setModelsForContextTags",(e,t,r)=>{e.forEach(n=>{n.context&&n.context.tags&&n.context.tags.length>0&&n.context.tags.forEach(i=>{i.type===r&&(i.model=r==="player"?t[i.id]:t.get(i.id),i.id=i.model.id)})})});o(this,"setQuestionModelsInQuestionsReport",(e,t)=>C(this,null,function*(){return e.map(r=>(r.questionModel=t.questions.find(n=>n.questionId.toString()===r.questionId),r))}));this.idSchema=e.idSchema,this.idMapping=new dr(e),this.validator=new Bd(e),this.profile=new Wn(e),this.football=new To(e),this.https=new Ay(e)}},nD=class{constructor(e){o(this,"https",null);o(this,"service",null);o(this,"activityService",null);o(this,"idSchema",null);o(this,"getClassicQuizzes",(e,t,r)=>C(this,null,function*(){e&&(e=new QM(e),yield this.service.finalizeMiniGamesFilters(e));let n=yield this.https.getClassicQuizzes(e,r);if(t)yield this.service.setContextTagsModels(n.data);else for(let i of n.data)yield this.remapTags(i,"native",this.idSchema);return n}));o(this,"getClassicQuizById",(e,t,r)=>C(this,null,function*(){let n=yield this.https.getClassicQuizById(e,t,r);return yield this.service.setContextTagsModels([n]),n}));o(this,"participateInClassicQuiz",(e,t,r)=>C(this,null,function*(){return yield this.https.participateInClassicQuiz(e,t,r)}));o(this,"getMyClassicQuizParticipations",e=>C(this,null,function*(){e&&(e=new XM(e));let t=yield this.https.getMyClassicQuizParticipations(e),r=t.map(i=>i.classicQuizId),n=yield this.getClassicQuizzes({classicQuizIds:r});return t.map(i=>{let a=n.data.find(s=>s.id===i.classicQuizId)||null;return ge(he({},i),{classicQuizModel:a})})}));o(this,"getLeaderboardForClassicQuizzes",e=>C(this,null,function*(){e&&(e=new JM(e));let t=yield this.https.getLeaderboardForClassicQuizzes(e);return t.data=yield this.service.setProfileModelsForClassicQuizLeaderboards(t.data),t}));o(this,"getClassicQuizzesUserRanking",(e,t)=>C(this,null,function*(){t&&(t=new Py(t));let r=yield this.https.getClassicQuizzesUserRanking(e,t),n=r.data.map(a=>a.classicQuizId),i=yield this.getClassicQuizzes({classicQuizIds:n});return r.data=r.data.map(a=>{let s=i.data.find(l=>l.id===a.classicQuizId)||null;return ge(he({},a),{classicQuizModel:s})}),r}));o(this,"getClassicQuizQuestionsReport",(e,t)=>C(this,null,function*(){t=t||!1;let r=yield this.https.getClassicQuizQuestionsReport(e),n=yield this.getClassicQuizById(e,t,!0);return this.service.setQuestionModelsInQuestionsReport(r,n)}));o(this,"getEitherOrs",(e,t,r)=>C(this,null,function*(){e&&(e=new ZM(e),yield this.service.finalizeMiniGamesFilters(e));let n=yield this.https.getEitherOrs(e,r);if(t)yield this.service.setContextTagsModels(n.data);else for(let i of n.data)yield this.remapTags(i,"native",this.idSchema);return n}));o(this,"getEitherOrById",(e,t)=>C(this,null,function*(){let r=yield this.https.getEitherOrById(e,t);return yield this.service.setContextTagsModels([r]),r}));o(this,"getMyEitherOrStats",e=>C(this,null,function*(){return yield this.https.getMyEitherOrStats(e)}));o(this,"getEitherOrResults",(e,t)=>C(this,null,function*(){let r=yield this.https.getEitherOrResults(e,t);return yield this.service.setProfileModelsForEitherOrStandings(r)}));o(this,"participateInEitherOr",(e,t,r)=>C(this,null,function*(){return r?yield this.service.handleEitherOrParticipationWithCallback(e,t,r):yield this.service.defaultEitherOrParticipation(e,t)}));o(this,"calculateEitherOrResultPercentile",(e,t)=>C(this,null,function*(){if(t==null||isNaN(t)||t<0)return null;if(t===0)return t;let r=yield this.getEitherOrResults(e,!0),n=r.breakdown.reduce((a,s)=>a+s.totalUsers,0),i=0;for(let a of r.breakdown)if(i+=a.totalUsers,t>=a.rangeStartInclusive&&t<=a.rangeEndInclusive)return parseFloat((i/n*100).toFixed(1));return null}));o(this,"remapTags",(e,t,r)=>C(this,null,function*(){if(this.idSchema!="native"&&e.context&&e.context.tags&&e.context.tags.length){let n=JSON.parse(JSON.stringify(e.context.tags)),i=yield this.activityService.remapTagsIds(n,t,r);e.context.tags=i}}));this.https=new Ay(e),this.service=new rD(e),this.activityService=new vl(e),this.idSchema=e.idSchema}},ky=class{constructor(e){o(this,"facade",null);o(this,"getClassicQuizzes",(e,t,r)=>C(this,null,function*(){return yield this.facade.getClassicQuizzes(e,t,r)}));o(this,"getClassicQuizById",(e,t,r)=>C(this,null,function*(){return yield this.facade.getClassicQuizById(e,t,r)}));o(this,"participateInClassicQuiz",(e,t,r)=>C(this,null,function*(){return yield this.facade.participateInClassicQuiz(e,t,r)}));o(this,"getMyClassicQuizParticipations",e=>C(this,null,function*(){return yield this.facade.getMyClassicQuizParticipations(e)}));o(this,"getLeaderboardForClassicQuizzes",e=>C(this,null,function*(){return yield this.facade.getLeaderboardForClassicQuizzes(e)}));o(this,"getClassicQuizzesUserRanking",(e,t)=>C(this,null,function*(){return yield this.facade.getClassicQuizzesUserRanking(e,t)}));o(this,"getClassicQuizQuestionsReport",(e,t)=>C(this,null,function*(){return yield this.facade.getClassicQuizQuestionsReport(e,t)}));o(this,"getEitherOrs",(e,t,r)=>C(this,null,function*(){return yield this.facade.getEitherOrs(e,t,r)}));o(this,"getEitherOrById",(e,t)=>C(this,null,function*(){return yield this.facade.getEitherOrById(e,t)}));o(this,"getMyEitherOrStats",e=>C(this,null,function*(){return yield this.facade.getMyEitherOrStats(e)}));o(this,"getEitherOrResults",(e,t)=>C(this,null,function*(){return yield this.facade.getEitherOrResults(e,t)}));o(this,"participateInEitherOr",(e,t,r)=>C(this,null,function*(){return yield this.facade.participateInEitherOr(e,t,r)}));o(this,"calculateEitherOrResultPercentile",(e,t)=>C(this,null,function*(){return yield this.facade.calculateEitherOrResultPercentile(e,t)}));this.facade=new nD(e)}},Ry=class{constructor(e,t){o(this,"idMapping",null);o(this,"predictorHttps",null);o(this,"predictorService",null);o(this,"predictorValidator",null);o(this,"clientHttps",null);o(this,"errorHandlingMode",null);o(this,"getConfig",()=>C(this,null,function*(){let e=yield this.clientHttps.getConfig("topX");return this.idMapping.idSchema!=="native"?yield this.predictorService.remapCompetitionsFromConfig(e):e}));o(this,"getGames",(e,t)=>C(this,null,function*(){t=t||!1;let r=this.predictorService.initGameFilters("TOP_X",e),n=yield this.predictorHttps.getGames(r,t);return yield this.predictorService.remapMatchIdsFixtures(n)}));o(this,"getGameById",(e,t)=>C(this,null,function*(){t=t||!1;let r=yield this.predictorHttps.getGameById(e,t);return yield this.predictorService.remapMatchIdsFixtures(r)}));o(this,"getGamePredictions",(e,t,r)=>C(this,null,function*(){return r=r||!1,t&&(t.type&&delete t.type,t.status&&delete t.status,t=new Gr(t)),yield this.predictorHttps.getGamePredictions(e,r,t)}));o(this,"getGameResults",(e,t,r)=>C(this,null,function*(){r=r||!1,t&&(t=new mi(t));let n=yield this.predictorHttps.getGameResults(e,r,t);return yield this.predictorService.remapMatchIdsFixtures(n)}));o(this,"getCurrentGameResults",e=>C(this,null,function*(){e=e||!1;let t=new mi(null);t.status="OPEN",t.type="TOP_X";let r=yield this.predictorHttps.getGames(t,e),n=this.predictorService.getCurrentGameId(r);return(yield this.getGameResults(n,null,e)).data[0]}));o(this,"play",e=>C(this,null,function*(){let t=new fy(e);if(t=this.predictorValidator.validateBodyFields("TOP_X",t),t.fixtures=t.fixtures.map(n=>this.predictorValidator.validateFixture(n.matchId,n.market,n.prediction.value)),this.idMapping.idSchema!=="native"){let n=[];t.fixtures.forEach(a=>n.push(a.matchId));let i=yield this.predictorService.remapMatchIdToNative(n);t.fixtures.forEach(a=>a.matchId=i.shift())}let r=yield this.predictorHttps.makeFootballPrediction(t);return r.fixtures.forEach(n=>{n.matchId=n.matchModel.id}),r}));o(this,"delete",e=>C(this,null,function*(){return yield this.predictorHttps.deleteFootballPrediction(e)}));o(this,"getMyGameEditions",(e,t)=>C(this,null,function*(){e&&e.limit&&this.validateLimitFilterOnGames(e.limit),t=t||!1;let r=this.predictorService.initGameTypePredictions("TOP_X",e),n=[],i=yield this.predictorHttps.getMyPredictionsNoRemap(r);if(i.data.length>0){i.data.forEach(l=>{l.game_instance_id&&n.push(l.game_instance_id)});let a=this.predictorService.initGameFilters("TOP_X",null,n),s=yield this.predictorHttps.getUserGameEditions(a,t);return yield this.predictorService.addPredictionProp(i,s)}else return new _r}));o(this,"getMyGamePrediction",e=>C(this,null,function*(){let t=this.predictorService.initGameTypePredictions("TOP_X"),r=yield this.predictorHttps.getMyPredictions(t);if(r.data.length>0){let n=r.data.filter(i=>i.gameInstanceId===e);return n.length?n[0]:null}return null}));o(this,"getUserGameEditions",(e,t,r)=>C(this,null,function*(){t&&t.limit&&this.validateLimitFilterOnGames(t.limit),r=r||!1;let n=this.predictorService.initGameTypePredictions("TOP_X",t),i=[],a=yield this.predictorHttps.getUserPredictionsNoRemap(e,n);if(a.data.length>0){a.data.forEach(c=>{c.game_instance_id&&i.push(c.game_instance_id)});let s=this.predictorService.initGameFilters("TOP_X",null,i),l=yield this.predictorHttps.getUserGameEditions(s,r);return yield this.predictorService.addPredictionProp(a,l)}else return new _r}));o(this,"getUserGamePrediction",(e,t,r)=>C(this,null,function*(){r=r||!1;let n=this.predictorService.initGameTypePredictions("TOP_X"),i=yield this.predictorHttps.getUserPredictions(e,r,n);if(i.data.length>0){let a=i.data.filter(s=>s.gameInstanceId===t);return a.length?a[0]:null}else return null}));o(this,"getMarketsResultsForGame",(e,t)=>C(this,null,function*(){let r=yield this.predictorHttps.getMarketResultsForGame(e,t);return yield this.predictorService.completeGameMarketResults(r,"TOP_X")}));o(this,"getGameWinners",(e,t)=>C(this,null,function*(){let r=yield this.predictorHttps.getContestWinners(e,t),n=yield this.getGameById(e);return r.contestModel=n,this.predictorService.completeContestWinners(r)}));o(this,"validateLimitFilterOnGames",e=>{if(this.errorHandlingMode==="default"&&e>50)throw new mt(400,"EXCEEDED_LENGTH","Maximum limit for filtering games is 50 or less.");if(this.errorHandlingMode==="standard"&&e>50)throw new et(400,"EXCEEDED_LENGTH","Maximum limit for filtering games is 50 or less.")});this.idMapping=t,this.errorHandlingMode=e.errorHandlingMode,this.predictorValidator=new $d(e.errorHandlingMode),this.predictorHttps=new ko(e,t),this.predictorService=new gl(e,t),this.clientHttps=new hi(e)}},My=class{constructor(e){o(this,"topXFacade",null);o(this,"idMapping",null);o(this,"getConfig",()=>C(this,null,function*(){return yield this.topXFacade.getConfig()}));o(this,"getGames",(e,t)=>C(this,null,function*(){return yield this.topXFacade.getGames(e,t)}));o(this,"getGameById",(e,t)=>C(this,null,function*(){return yield this.topXFacade.getGameById(e,t)}));o(this,"getGamePredictions",(e,t,r)=>C(this,null,function*(){return yield this.topXFacade.getGamePredictions(e,t,r)}));o(this,"getGameResults",(e,t,r)=>C(this,null,function*(){return yield this.topXFacade.getGameResults(e,t,r)}));o(this,"getCurrentGameResults",e=>C(this,null,function*(){return yield this.topXFacade.getCurrentGameResults(e)}));o(this,"play",e=>C(this,null,function*(){return yield this.topXFacade.play(e)}));o(this,"delete",e=>C(this,null,function*(){return yield this.topXFacade.delete(e)}));o(this,"getMyGameEditions",(e,t)=>C(this,null,function*(){return yield this.topXFacade.getMyGameEditions(e,t)}));o(this,"getMyGamePrediction",e=>C(this,null,function*(){return yield this.topXFacade.getMyGamePrediction(e)}));o(this,"getUserGameEditions",(e,t,r)=>C(this,null,function*(){return yield this.topXFacade.getUserGameEditions(e,t,r)}));o(this,"getUserGamePrediction",(e,t,r)=>C(this,null,function*(){return yield this.topXFacade.getUserGamePrediction(e,t,r)}));o(this,"getMarketsResultsForGame",(e,t)=>C(this,null,function*(){return yield this.topXFacade.getMarketsResultsForGame(e,t)}));o(this,"getGameWinners",(e,t)=>C(this,null,function*(){return yield this.topXFacade.getGameWinners(e,t)}));this.idMapping=new dr(e),this.topXFacade=new Ry(e,this.idMapping)}},iD=class{constructor(){o(this,"general");o(this,"predictor");o(this,"topX");o(this,"matchQuiz")}},aD=class{constructor(){o(this,"predictor");o(this,"topX");o(this,"matchQuiz");o(this,"games");o(this,"football");o(this,"classicQuizzes");o(this,"eitherOr");o(this,"discussions");o(this,"potm");o(this,"poll")}},jd=class{constructor(e){o(this,"limit",null);o(this,"page",null);this.limit=e.limit?e.limit:null,this.page=e.page?e.page:null}constructFiltersUrl(){let e="";return this.limit&&(e+="&",e+=`limit=${this.limit}`),this.page&&(e+="&",e+=`page=${this.page}`),e}},oD=class extends jd{constructor(t){super(t);o(this,"templateId",null);this.templateId=(t==null?void 0:t.templateId)||null}constructFiltersUrl(){let t=super.constructFiltersUrl();return this.templateId&&(t+=`&template_id=${this.templateId}`),t}},sD=class extends jd{constructor(t){super(t);o(this,"sortOrder",null);o(this,"rankType",null);o(this,"leaderboardIds",null);o(this,"gameType",null);o(this,"constructFiltersUrl",()=>{let t=super.constructFiltersUrl();return this.sortOrder&&(t+="&",t+=`sort_order=${this.sortOrder}`),this.rankType&&(t+="&",t+=`rank_type=${this.rankType}`),this.leaderboardIds&&(t+="&",t+=`type_ids=${this.leaderboardIds.join(",")}`),this.gameType&&(t+="&",t+=`game_type=${this.gameType}`),t});this.sortOrder=t.sortOrder,this.rankType=t.rankType,this.leaderboardIds=t.leaderboardIds,this.gameType=t.type&&t.type.toLowerCase()==="game"?t.gameType:null}},lD=class{constructor(e){o(this,"idMappingService",null);o(this,"profileNamespace",null);o(this,"footballNamespace",null);o(this,"topXNamespace",null);o(this,"matchQuizNamespace",null);o(this,"miniGamesNamespace",null);o(this,"errorHandlingMode",null);o(this,"remapTemplatesIds",e=>C(this,null,function*(){if(e.length>0){let t=[],r=[],n=[];e.forEach(s=>{s.teamIds&&s.teamIds.length>0&&(t=[...t,...s.teamIds]),s.matchIds&&s.matchIds.length>0&&(r=[...r,...s.matchIds]),s.competitionIds&&s.competitionIds.length>0&&(n=[...n,...s.competitionIds])});let i={team:t,match:r,competition:n},a=yield this.idMappingService.idMappingFacade.getEntitiesByIds(i,"native",this.idMappingService.idSchema);return[...a.team],[...a.match],[...a.competition],e.forEach(s=>{s.teamIds&&s.teamIds.length>0&&(s.teamIds=s.teamIds.map(l=>a.team.shift())),s.matchIds&&s.matchIds.length>0&&(s.matchIds=s.matchIds.map(l=>a.match.shift())),s.competitionIds&&s.competitionIds.length>0&&(s.competitionIds=s.competitionIds.map(l=>a.competition.shift()))}),e}return e}));o(this,"remapTemplateGroupMatchIds",e=>C(this,null,function*(){if(e&&e.length>0){for(let t of e)if(!(!t.filters.matchIds||!t.filters.matchIds.every(r=>r))&&t.filters.matchIds.length>0){let r={match:Array.from(t.filters.matchIds)},n=yield this.idMappingService.idMappingFacade.getEntitiesByIds(r,"native",this.idMappingService.idSchema);t.filters.matchIds=Array.from(n.match)}}}));o(this,"addProfileModelToLeaderboard",e=>C(this,null,function*(){if(e.length>0){let t=[],r=e.map(i=>i.profileId);if(!r.length)return e;let n=yield this.profileNamespace.getByIds(r);return e.forEach(i=>{n.forEach(a=>{a.id===i.profileId&&(delete a.interests,i.profileModel=a)}),i.profileModel||(i.profileModel=null),t.push(i)}),t}return e}));o(this,"buildOldClientBadges",e=>{let t=new iD;return t.general=this.extractEnabledBadgesId(e.general),t.predictor=this.extractEnabledBadgesId(e.predictor),t.topX=this.extractEnabledBadgesId(e.topX),t.matchQuiz=this.extractEnabledBadgesId(e.matchQuiz),t});o(this,"buildNewClientBadges",e=>{let t=new aD;return t.predictor=this.extractEnabledBadgesId(e.predictor),t.topX=this.extractEnabledBadgesId(e.topX),t.matchQuiz=this.extractEnabledBadgesId(e.matchQuiz),t.games=this.extractEnabledBadgesId(e.games),t.football=this.extractEnabledBadgesId(e.football),t.classicQuizzes=this.extractEnabledBadgesId(e.classicQuizzes),t.eitherOr=this.extractEnabledBadgesId(e.eitherOr),t.discussions=this.extractEnabledBadgesId(e.discussions),t.potm=this.extractEnabledBadgesId(e.voting.potm),t.poll=this.extractEnabledBadgesId(e.voting.poll),t});o(this,"initFilters",(e,t)=>{switch(t){case"loyalty":e&&(e=new jd(e));break;case"rankings":e&&(e=new sD(e));break;case"league_leaderboard":e&&(e=new oD(e))}return e});o(this,"addProfileModelToHighestSuccessRate",e=>C(this,null,function*(){let t=e.map(n=>n.profileId);if(!t.length)return e;let r=yield this.profileNamespace.getByIds(t);return e.map(n=>(r.forEach(i=>{i.id===n.profileId&&(delete i.interests,n.profileModel=i)}),n))}));o(this,"extractRankingsIdsMap",e=>{let t=[],r=[],n=[];return e.forEach(i=>{i.rankType==="GAME"&&i.gameType==="TOP_X"?t.push(i.id):i.rankType==="GAME"&&i.gameType==="MATCH_QUIZ"?r.push(i.id):i.rankType==="TEMPLATE"&&n.push(i.id)}),[t,r,n]});o(this,"setModelsForUserRankings",(e,t,r,n)=>(n.data.forEach(i=>{i.gameType==="MATCH_QUIZ"&&t?i.model=t.filter(a=>a.id===i.id)[0]:i.gameType==="TOP_X"&&e?i.model=e.filter(a=>a.id===i.id)[0]:i.rankType==="TEMPLATE"&&r&&(i.model=r.filter(a=>a.id===i.id)[0])}),n));o(this,"completeContestWinners",e=>C(this,null,function*(){if(e.userList&&e.userList.length){let t=e.userList.map(n=>n.profileId),r=yield this.profileNamespace.getByIds(t);e.userList.forEach(n=>{let i=r.filter(a=>a.id===n.profileId)[0];delete i.interests,n.profileModel=i})}return e}));o(this,"validateEntitiesFollowsFilters",e=>{if(!e||(!e.footballCompetitions||!e.footballCompetitions.length)&&(!e.footballTeams||!e.footballTeams.length)&&(!e.footballPlayers||!e.footballPlayers.length))throw this.errorHandlingMode==="default"?new mt(400,"invalid_filters","At least one of footballCompetitions, footballTeams or footballPlayers properties should be provided for filters."):new et(400,"invalid_filters","At least one of footballCompetitions, footballTeams or footballPlayers properties should be provided for filters.");if(e.footballCompetitions&&e.footballCompetitions.length>24||e.footballTeams&&e.footballTeams.length>24||e.footballPlayers&&e.footballPlayers.length>24)throw this.errorHandlingMode==="default"?new mt(400,"EXCEEDED_LENGTH","Maximum length per entity should be 24 or less."):new et(400,"EXCEEDED_LENGTH","Maximum length per entity should be 24 or less.")});o(this,"remapEntitiesFollowsFilters",e=>C(this,null,function*(){let t=JSON.parse(JSON.stringify(e)),r={},n={};t.footballCompetitions&&t.footballCompetitions.length&&(n.competition=t.footballCompetitions),t.footballTeams&&t.footballTeams.length&&(n.team=t.footballTeams),t.footballPlayers&&t.footballPlayers.length&&(n.player=t.footballPlayers);let i=yield this.idMappingService.idMappingFacade.getEntitiesByIds(n,this.idMappingService.idSchema,"native");return Object.keys(i).forEach(a=>{a==="competition"?r.footballCompetitions=i[a]:a==="team"?r.footballTeams=i[a]:a==="player"&&(r.footballPlayers=i[a])}),r}));o(this,"addModelsToEntitiesFollows",e=>C(this,null,function*(){let t=[],r="fb:c:",n=new Map,i=[],a="fb:t:",s=new Map,l=[],c="fb:p:",u=null;return e.breakdown.forEach(d=>{d.id.includes(r)?t.push(d.id):d.id.includes(a)?i.push(d.id):d.id.includes(c)&&l.push(d.id)}),t.length&&(n=yield this.footballNamespace.footballFacade.competitionsFacade.getCompetitionsMapWithNativeIds(t)),i.length&&(s=yield this.footballNamespace.footballFacade.teamsFacade.getTeamsMapWithNativeIds(i)),l.length&&(u=yield this.footballNamespace.footballFacade.playerFacade.getPlayersMapWithNativeIds(l)),e.breakdown.forEach(d=>{d.id.includes(r)?(d.model=n.get(d.id),d.id=d.model.id):d.id.includes(a)?(d.model=s.get(d.id),d.id=d.model.id):d.id.includes(c)&&(d.model=u[d.id],d.id=d.model.id)}),e}));o(this,"initMatchFiltersForTemplates",(e,t)=>{let r=[],n=[],i=[],a=this.reformatDate(e.fromDate),s=this.reformatDate(e.toDate,!0),l=500;if(e.competitionIds&&e.competitionIds.length>0&&(r=Array.from(e.competitionIds)),e.teamIds&&e.teamIds.length>0&&(n=Array.from(e.teamIds)),e.matchIds&&e.matchIds.length>0&&(i=Array.from(e.matchIds)),t){let c=e.groups.find(d=>d.groupId===t);if(!c)throw this.errorHandlingMode==="default"?new mt(400,"invalid_template_group_id","There is no group in this template with the provided groupId"):new et(400,"invalid_template_group_id","There is no group in this template with the provided groupId");if(!c.filters)throw this.errorHandlingMode==="default"?new mt(400,"invalid_template_group_filters","The provided template group has no filters"):new et(400,"invalid_template_group_filters","The provided template group has no filters");a=this.reformatDate(c.filters.fromDate),s=this.reformatDate(c.filters.toDate,!0);let u=c.filters.matchIds.every(d=>d);c.filters.matchIds.length>0&&u&&(i=Array.from(c.filters.matchIds))}return new ll({competitionIds:r,teamIds:n,matchIds:i,fromDate:a,toDate:s,limit:l})});o(this,"reformatDate",(e,t)=>{let r=new Date(e);t&&r.setUTCHours(23,59,59);let n=r.toISOString();return n=n.slice(0,-5)+"Z",n});o(this,"extractEnabledBadgesId",e=>{let t=[];return e.forEach(r=>{r.enabled&&t.push(r.id)}),t});o(this,"addEntityModelToFootballBadges",e=>C(this,null,function*(){let t=[],r=[],n=[],i=[];if(e.football&&e.football.length>0&&(t=e.football.filter(s=>s.requirements.entityType.toLocaleLowerCase()==="competition").map(s=>s.requirements.entityId),r=e.football.filter(s=>s.requirements.entityType.toLocaleLowerCase()==="team").map(s=>s.requirements.entityId),n=e.football.filter(s=>s.requirements.entityType.toLocaleLowerCase()==="player").map(s=>s.requirements.entityId),i=e.football.filter(s=>s.requirements.entityType.toLocaleLowerCase()==="match").map(s=>s.requirements.entityId)),e.voting&&e.voting.poll&&e.voting.poll.length>0){let[s,l,c,u]=this.extractEntityIdsFromBadges(e.voting.poll);t=t.concat(s),t=Array.from(new Set(t)),r=r.concat(l),r=Array.from(new Set(r)),n=n.concat(c),n=Array.from(new Set(n)),i=i.concat(u),i=Array.from(new Set(i))}if(e.voting&&e.voting.potm&&e.voting.potm.length>0){let[s,l,c,u]=this.extractEntityIdsFromBadges(e.voting.potm);t=t.concat(s),t=Array.from(new Set(t)),r=r.concat(l),r=Array.from(new Set(r)),n=n.concat(c),n=Array.from(new Set(n)),i=i.concat(u),i=Array.from(new Set(i))}let a=yield this.fetchFootballEntities(t,r,n,i);e.football&&e.football.length>0&&e.football.forEach(s=>{this.setEntityModelsFromMap(s.requirements,"competition",a.competitions),this.setEntityModelsFromMap(s.requirements,"team",a.teams),this.setEntityModelsFromObject(s.requirements,"player",a.players),this.setEntityModelsFromObject(s.requirements,"match",a.matches)}),e.voting&&e.voting.poll&&e.voting.poll.length>0&&e.voting.poll.forEach(s=>{this.setEntityModelsFromMap(s.requirements,"competition",a.competitions),this.setEntityModelsFromMap(s.requirements,"team",a.teams),this.setEntityModelsFromObject(s.requirements,"player",a.players),this.setEntityModelsFromObject(s.requirements,"match",a.matches)}),e.voting&&e.voting.potm&&e.voting.potm.length>0&&e.voting.potm.forEach(s=>{this.setEntityModelsFromMap(s.requirements,"competition",a.competitions),this.setEntityModelsFromMap(s.requirements,"team",a.teams),this.setEntityModelsFromObject(s.requirements,"player",a.players),this.setEntityModelsFromObject(s.requirements,"match",a.matches)})}));o(this,"setEntityModelsFromMap",(e,t,r)=>{e.entityType===t&&(e.entityModel=r&&r.get(e.entityId)||null,e.entityModel&&(e.entityId=e.entityModel.id))});o(this,"setEntityModelsFromObject",(e,t,r)=>{e.entityType===t&&(e.entityModel=r[e.entityId]?r[e.entityId]:null,e.entityModel&&(e.entityId=e.entityModel.id))});o(this,"fetchFootballEntities",(e,t,r,n)=>C(this,null,function*(){let i={competitions:null,teams:null,players:null,matches:null};if(e.length){let a=yield this.footballNamespace.footballFacade.getCompetitionsMapWithNativeIds(e);i.competitions=a}if(t.length){let a=yield this.footballNamespace.footballFacade.getTeamsMapWithNativeIds(t);i.teams=a}if(r.length){let a=yield this.footballNamespace.footballFacade.getPlayersMapWithNativeIds(r);i.players=a}if(n.length){let a=yield this.footballNamespace.footballFacade.getMatchesMapWithNativeIds(n);i.matches=a}return i}));o(this,"extractEntityIdsFromBadges",e=>{let t=e.filter(a=>a.requirements.entityType&&a.requirements.entityType.toLocaleLowerCase()==="competition").map(a=>a.requirements.entityId),r=e.filter(a=>a.requirements.entityType&&a.requirements.entityType.toLocaleLowerCase()==="team").map(a=>a.requirements.entityId),n=e.filter(a=>a.requirements.entityType&&a.requirements.entityType.toLocaleLowerCase()==="player").map(a=>a.requirements.entityId),i=e.filter(a=>a.requirements.entityType&&a.requirements.entityType.toLocaleLowerCase()==="match").map(a=>a.requirements.entityId);return[t,r,n,i]});o(this,"addGameModelToGamesBadges",e=>C(this,null,function*(){if(!e.games||e.games.length===0)return;let t=this.getGameIdsFromGamesBadge(e.games,"top_x"),r=this.getGameIdsFromGamesBadge(e.games,"match_quiz"),n=this.getGameIdsFromGamesBadge(e.games,"classic_quiz"),i=this.getGameIdsFromGamesBadge(e.games,"either_or"),a=yield this.fetchGamesEntities(t,r,n,i);e.games.forEach(s=>{s.requirements.specificGames&&s.requirements.specificGames.forEach(l=>{l.gameModel=a.find(c=>c.id===l.gameId)||null})})}));o(this,"getGameIdsFromGamesBadge",(e,t)=>{let r=e.filter(n=>n.requirements.specificGames?n.requirements.specificGames.some(i=>i.gameType.toLocaleLowerCase()===t):!1).map(n=>n.requirements.specificGames.map(i=>i.gameId));return Array.prototype.concat.apply([],r)});o(this,"fetchGamesEntities",(e,t,r,n)=>C(this,null,function*(){let i=[];if(e.length){let a=yield this.topXNamespace.getGames({gameIds:e});i=[...i,...a.data]}if(t.length){let a=yield this.matchQuizNamespace.getGames({gameIds:t});i=[...i,...a.data]}if(r.length){let a=yield this.miniGamesNamespace.getClassicQuizzes({classicQuizIds:r});i=[...i,...a.data]}if(n.length){let a=yield this.miniGamesNamespace.getEitherOrs({eitherOrIds:n});i=[...i,...a.data]}return i}));this.idMappingService=new dr(e),this.profileNamespace=new Wn(e),this.footballNamespace=new To(e),this.topXNamespace=new My(e),this.matchQuizNamespace=new _y(e),this.miniGamesNamespace=new ky(e),this.errorHandlingMode=e.errorHandlingMode}},cD=class{constructor(){o(this,"validate",(e,t)=>{e.market&&this.validateMarket(e.market,t),e.fromDate&&this.validateDate(e.fromDate,"fromDate",t),e.toDate&&this.validateDate(e.toDate,"toDate",t),e.usersCount&&this.validateNumberFilters(e.usersCount,"usersCount",t),e.minimumPredictions&&this.validateNumberFilters(e.minimumPredictions,"minimumPredictions",t)});o(this,"validateMarket",(e,t)=>{if(!Object.keys(ul).includes(e)){let r=yv(e);throw t==="default"?new mt(400,"INVALID_MARKET",r):new et(400,"INVALID_MARKET",r)}});o(this,"validateDate",(e,t,r)=>{let n=/^\d{4}-\d{2}-\d{2}$/;if(typeof e!="string")throw r==="default"?new mt(400,"invalid_filters",`You have provided invalid type. The valid type is string for ${t} filter`):new et(400,"invalid_filters",`You have provided invalid type. The valid type is string for ${t} filter`);if(!n.test(e))throw r==="default"?new mt(400,"invalid_filters",`You have provided invalid value. The valid value is YYYY-MM-DD for ${t}`):new et(400,"invalid_filters",`You have provided invalid value. The valid value is YYYY-MM-DD for ${t}`)});o(this,"validateNumberFilters",(e,t,r)=>{let n=t==="usersCount"?1:0,i=t==="usersCount"?1e3:1e6;if(typeof e!="number")throw r==="default"?new mt(400,"invalid_filters",`You have provided invalid type. The valid type is number for ${t} filter`):new et(400,"invalid_filters",`You have provided invalid type. The valid type is number for ${t} filter`);if(e<n||e>i)throw r==="default"?new mt(400,"invalid_filters",`You have provided invalid value. The valid value is between ${n} and ${i}`):new et(400,"invalid_filters",`You have provided invalid value. The valid value is between ${n} and ${i}`)})}},uD=class{constructor(e){o(this,"market");o(this,"fromDate");o(this,"toDate");o(this,"usersCount");o(this,"minimumPredictions");this.market=e.market?e.market:null,this.fromDate=e.fromDate?e.fromDate:null,this.toDate=e.toDate?e.toDate:null,this.usersCount=e.usersCount?e.usersCount:null,this.minimumPredictions=e.minimumPredictions?e.minimumPredictions:null}constructFiltersUrl(){let e="";return this.market&&(e+="&",e+=`market=${this.market}`),this.fromDate&&(e+="&",e+=`from_date=${this.fromDate}`),this.toDate&&(e+="&",e+=`to_date=${this.toDate}`),this.usersCount&&(e+="&",e+=`users_count=${this.usersCount}`),this.minimumPredictions&&(e+="&",e+=`minimum_predictions=${this.minimumPredictions}`),e}},dD=class{constructor(e){o(this,"flags",null);o(this,"status",null);o(this,"type",null);o(this,"activeFrom",null);o(this,"activeTo",null);o(this,"createdFrom",null);o(this,"createdTo",null);o(this,"updatedFrom",null);o(this,"updatedTo",null);this.flags=e.flags?e.flags:null,this.status=e.status?e.status:null,this.type=e.type?e.type:null,this.activeFrom=e.activeFrom?e.activeFrom:null,this.activeTo=e.activeTo?e.activeTo:null,this.createdFrom=e.createdFrom?e.createdFrom:null,this.createdTo=e.createdTo?e.createdTo:null,this.updatedFrom=e.updatedFrom?e.updatedFrom:null,this.updatedTo=e.updatedTo?e.updatedTo:null}constructFiltersUrl(){let e="";return this.flags&&this.flags.length>0&&(e+="&",e+=`flags=${this.flags.join(",")}`),this.status&&(e+="&",e+=`status=${this.status}`),this.type&&(e+="&",e+=`type=${this.type}`),this.activeFrom&&(e+="&",e+=`active_from=${this.activeFrom}`),this.activeTo&&(e+="&",e+=`active_to=${this.activeTo}`),this.createdFrom&&(e+="&",e+=`created_from=${this.createdFrom}`),this.createdTo&&(e+="&",e+=`created_to=${this.createdTo}`),this.updatedFrom&&(e+="&",e+=`updated_from=${this.updatedFrom}`),this.updatedTo&&(e+="&",e+=`updated_to=${this.updatedTo}`),e}},fD=class{constructor(e,t,r,n,i){o(this,"config",null);o(this,"clientHttps",null);o(this,"loyaltyHttps",null);o(this,"loyaltyService",null);o(this,"profileFacade",null);o(this,"loyaltyValidator",null);o(this,"idMapping",null);o(this,"topXFacade",null);o(this,"matchQuizFacade",null);o(this,"predictorHttps",null);o(this,"errorHandlingMode",null);o(this,"football",null);o(this,"getConfig",()=>C(this,null,function*(){return yield this.clientHttps.getConfig("loyalty")}));o(this,"getConfigV2",e=>C(this,null,function*(){let t=yield this.clientHttps.getNewLoyaltyConfig(e);return yield this.loyaltyService.addEntityModelToFootballBadges(t.rewards.badges),yield this.loyaltyService.addGameModelToGamesBadges(t.rewards.badges),t}));o(this,"getClientBadges",()=>C(this,null,function*(){let e=yield this.getConfig();return this.loyaltyService.buildOldClientBadges(e.rewards.badges)}));o(this,"getClientBadgesV2",e=>C(this,null,function*(){let t=yield this.clientHttps.getNewLoyaltyConfig(e);return this.loyaltyService.buildNewClientBadges(t.rewards.badges)}));o(this,"getTemplates",(e,t)=>C(this,null,function*(){if(e&&(e=new dD(e)),this.config.idSchema==="native")return yield this.loyaltyHttps.getTemplates(e,t);let r=yield this.loyaltyHttps.getTemplates(e,t);r.data=yield this.loyaltyService.remapTemplatesIds([...r.data]);for(let n of r.data)yield this.loyaltyService.remapTemplateGroupMatchIds(n.groups);return r}));o(this,"getTemplateById",(e,t)=>C(this,null,function*(){let r=yield this.loyaltyHttps.getTemplateById(e,t);if(this.config.idSchema==="native")return r;let n=yield this.loyaltyService.remapTemplatesIds([r]);return yield this.loyaltyService.remapTemplateGroupMatchIds(n[0].groups),n[0]}));o(this,"getLeaderboard",(e,t,r)=>C(this,null,function*(){t=this.loyaltyService.initFilters(t,"loyalty");let n=yield this.loyaltyHttps.getLeaderboard(e,r,t);return n.data=yield this.loyaltyService.addProfileModelToLeaderboard(n.data),n}));o(this,"getLeaderboardForGame",(e,t,r)=>C(this,null,function*(){t=this.loyaltyService.initFilters(t,"loyalty");let n=yield this.loyaltyHttps.getLeaderboardForGame(e,r,t);return n.data=yield this.loyaltyService.addProfileModelToLeaderboard(n.data),n}));o(this,"getLeaderboardForLeague",(e,t)=>C(this,null,function*(){t=this.loyaltyService.initFilters(t,"league_leaderboard");let r=yield this.loyaltyHttps.getLeaderboardForLeague(e,t);return r.data=yield this.loyaltyService.addProfileModelToLeaderboard(r.data),r}));o(this,"getOwnRankings",(e,t)=>C(this,null,function*(){let{id:r}=yield this.profileFacade.getOwn();return this.getUserRankings(r,e,t)}));o(this,"getUserRankings",(e,t,r)=>C(this,null,function*(){t=this.loyaltyService.initFilters(t,"rankings");let n=yield this.loyaltyHttps.getUserRankings(e,t,r);return yield this.getModelsForUserRankings(n)}));o(this,"getHighestSuccessRate",(e,t)=>C(this,null,function*(){e&&(e=new uD(e),this.loyaltyValidator.validate(e,this.errorHandlingMode));let r=yield this.loyaltyHttps.getHighestSuccessRate(e,t);return this.loyaltyService.addProfileModelToHighestSuccessRate(r)}));o(this,"getTemplateWinners",(e,t)=>C(this,null,function*(){let r=yield this.predictorHttps.getContestWinners(e,t),n=yield this.getTemplateById(e);return r.contestModel=n,this.loyaltyService.completeContestWinners(r)}));o(this,"getEntitiesFollows",(e,t)=>C(this,null,function*(){this.loyaltyService.validateEntitiesFollowsFilters(e),this.config.idSchema!=="native"&&(e=yield this.loyaltyService.remapEntitiesFollowsFilters(e));let r=yield this.loyaltyHttps.getEntitiesFollows(e,t);return yield this.loyaltyService.addModelsToEntitiesFollows(r)}));o(this,"getModelsForUserRankings",e=>C(this,null,function*(){let t=null,r=null,n=null,[i,a,s]=this.loyaltyService.extractRankingsIdsMap(e.data);if(s.length&&(t=(yield this.getTemplates()).data.filter(l=>s.includes(l.id))),i.length){let l={gameIds:i};r=(yield this.topXFacade.getGames(l)).data}if(a.length){let l={gameIds:a};n=(yield this.matchQuizFacade.getGames(l)).data}return this.loyaltyService.setModelsForUserRankings(r,n,t,e)}));o(this,"getTemplateMatches",(e,t,r)=>C(this,null,function*(){let n=yield this.getTemplateById(e,r);if((!n.competitionIds||n.competitionIds.length===0)&&(!n.teamIds||n.teamIds.length===0)&&(!n.matchIds||n.matchIds.length===0)&&(!n.groups||n.groups.length===0))return[];let i=this.loyaltyService.initMatchFiltersForTemplates(n,t);return(yield this.football.getMatches(i,r)).data}));this.config=e,this.clientHttps=t,this.loyaltyHttps=r,this.profileFacade=new ol(i,n),this.loyaltyService=new lD(this.config),this.loyaltyValidator=new cD,this.idMapping=new dr(e),this.topXFacade=new Ry(e,this.idMapping),this.matchQuizFacade=new wy(e),this.predictorHttps=new ko(e,this.idMapping),this.errorHandlingMode=e.errorHandlingMode,this.football=new To(e)}},Dy=class{constructor(e){o(this,"clientHttps",null);o(this,"profileHttps",null);o(this,"loyaltyHttps",null);o(this,"loyaltyFacade",null);o(this,"localCache",null);o(this,"getConfig",()=>C(this,null,function*(){return yield this.loyaltyFacade.getConfig()}));o(this,"getConfigV2",e=>C(this,null,function*(){return yield this.loyaltyFacade.getConfigV2(e)}));o(this,"getClientBadges",()=>C(this,null,function*(){return yield this.loyaltyFacade.getClientBadges()}));o(this,"getClientBadgesV2",e=>C(this,null,function*(){return yield this.loyaltyFacade.getClientBadgesV2(e)}));o(this,"getTemplates",(e,t)=>C(this,null,function*(){return yield this.loyaltyFacade.getTemplates(e,t)}));o(this,"getTemplateById",(e,t)=>C(this,null,function*(){return yield this.loyaltyFacade.getTemplateById(e,t)}));o(this,"getLeaderboard",(e,t,r)=>C(this,null,function*(){return yield this.loyaltyFacade.getLeaderboard(e,t,r)}));o(this,"getLeaderboardForGame",(e,t,r)=>C(this,null,function*(){return yield this.loyaltyFacade.getLeaderboardForGame(e,t,r)}));o(this,"getLeaderboardForLeague",(e,t)=>C(this,null,function*(){return yield this.loyaltyFacade.getLeaderboardForLeague(e,t)}));o(this,"getOwnRankings",(e,t)=>C(this,null,function*(){return yield this.loyaltyFacade.getOwnRankings(e,t)}));o(this,"getUserRankings",(e,t,r)=>C(this,null,function*(){return yield this.loyaltyFacade.getUserRankings(e,t,r)}));o(this,"getHighestSuccessRate",(e,t)=>C(this,null,function*(){return yield this.loyaltyFacade.getHighestSuccessRate(e,t)}));o(this,"getTemplateWinners",(e,t)=>C(this,null,function*(){return yield this.loyaltyFacade.getTemplateWinners(e,t)}));o(this,"getEntitiesFollows",(e,t)=>C(this,null,function*(){return yield this.loyaltyFacade.getEntitiesFollows(e,t)}));o(this,"getTemplateMatches",(e,t,r)=>C(this,null,function*(){return yield this.loyaltyFacade.getTemplateMatches(e,t,r)}));this.clientHttps=new hi(e),this.profileHttps=new bv(e),this.loyaltyHttps=new Nd(e),this.localCache=new Co().createLocalCacheInstance(e.idSchema),this.loyaltyFacade=new fD(e,this.clientHttps,this.loyaltyHttps,this.profileHttps,this.localCache)}},Ly=class{constructor(e,t,r,n){o(this,"action",null);o(this,"context",new Pd);this.action=e,this.context.tags=t,r&&(this.context.content=r),n&&(this.context.campaign=n)}},Fy=class{constructor(e){o(this,"page",null);o(this,"limit",null);this.page=e.page?e.page:null,this.limit=e.limit?e.limit:null}},hD=class extends Fy{constructor(t){super(t);o(this,"action",null);this.action=t.action?t.action:null}constructFilterUrl(){let t="";return this.action&&(t+="&",t+=`action=${this.action}`),this.page&&(t+="&",t+=`page=${this.page}`),this.limit&&(t+="&",t+=`limit=${this.limit}`),t}},pD=class extends Fy{constructor(t){super(t);o(this,"action",null);this.action=t.action?t.action:null}constructFilterUrl(){let t="";return this.action&&(t+="&",t+=`action=${this.action}`),this.page&&(t+="&",t+=`page=${this.page}`),this.limit&&(t+="&",t+=`limit=${this.limit}`),t}},mD=class{constructor(e){o(this,"idSchema");o(this,"activityHttps");o(this,"activityService");o(this,"add",(e,t,r,n)=>C(this,null,function*(){if(this.idSchema!="native"){let a=JSON.parse(JSON.stringify(t)),s=yield this.activityService.remapTagsIds(t,this.idSchema,"native"),l=new Ly(e,s,r,n),c=yield this.activityHttps.createActivity(l);return c.context.tags=a,c}let i=new Ly(e,t,r,n);return this.activityHttps.createActivity(i)}));o(this,"delete",e=>C(this,null,function*(){return yield this.activityHttps.deleteActivity(e)}));o(this,"like",(e,t,r)=>C(this,null,function*(){return yield this.add("like",e,t,r)}));o(this,"dislike",(e,t,r)=>C(this,null,function*(){return yield this.add("dislike",e,t,r)}));o(this,"addPageview",(e,t,r)=>C(this,null,function*(){return yield this.add("page_view",e,t,r)}));o(this,"addContentConsumed",(e,t,r)=>C(this,null,function*(){return yield this.add("content_consumed",e,t,r)}));o(this,"addShare",(e,t,r)=>C(this,null,function*(){return yield this.add("share",e,t,r)}));o(this,"addComment",(e,t,r)=>C(this,null,function*(){return yield this.add("comment",e,t,r)}));o(this,"addClickAd",(e,t,r)=>C(this,null,function*(){return yield this.add("click_ad",e,t,r)}));o(this,"addConversion",(e,t,r)=>C(this,null,function*(){return yield this.add("conversion",e,t,r)}));o(this,"getOwn",(e,t)=>C(this,null,function*(){if(t=t||!1,e&&(e=new hD(e)),this.idSchema!="native"){let r=yield this.activityHttps.getOwnActivities(e,t);for(let n of r.data)yield this.activityService.remapTagsIds(n.context.tags,"native",this.idSchema);return r}return yield this.activityHttps.getOwnActivities(e,t)}));o(this,"getForUser",(e,t,r)=>C(this,null,function*(){if(r=r||!1,t&&(t=new pD(t)),this.idSchema!="native"){let n=yield this.activityHttps.getActivitiesForUser(e,t,r),i=JSON.parse(JSON.stringify(n));for(let a of i.data)yield this.activityService.remapTagsIds([...a.context.tags],"native",this.idSchema);return i}return yield this.activityHttps.getActivitiesForUser(e,t,r)}));this.idSchema=e.idSchema,this.activityHttps=new Jv(e),this.activityService=new vl(e)}},gD=class{constructor(e){o(this,"activityFacade");o(this,"add",(e,t,r,n)=>C(this,null,function*(){return yield this.activityFacade.add(e,t,r,n)}));o(this,"delete",e=>C(this,null,function*(){return yield this.activityFacade.delete(e)}));o(this,"like",(e,t,r)=>C(this,null,function*(){return yield this.activityFacade.like(e,t,r)}));o(this,"dislike",(e,t,r)=>C(this,null,function*(){return yield this.activityFacade.dislike(e,t,r)}));o(this,"addPageview",(e,t,r)=>C(this,null,function*(){return yield this.activityFacade.addPageview(e,t,r)}));o(this,"addContentConsumed",(e,t,r)=>C(this,null,function*(){return yield this.activityFacade.addContentConsumed(e,t,r)}));o(this,"addShare",(e,t,r)=>C(this,null,function*(){return yield this.activityFacade.addShare(e,t,r)}));o(this,"addComment",(e,t,r)=>C(this,null,function*(){return yield this.activityFacade.addComment(e,t,r)}));o(this,"addClickAd",(e,t,r)=>C(this,null,function*(){return yield this.activityFacade.addClickAd(e,t,r)}));o(this,"addConversion",(e,t,r)=>C(this,null,function*(){return yield this.activityFacade.addConversion(e,t,r)}));o(this,"getOwn",(e,t)=>C(this,null,function*(){return yield this.activityFacade.getOwn(e,t)}));o(this,"getForUser",(e,t,r)=>C(this,null,function*(){return yield this.activityFacade.getForUser(e,t,r)}));this.activityFacade=new mD(e)}},vD=class{constructor(){o(this,"id","");o(this,"label","");o(this,"discussionType","LEAGUE");o(this,"moderationType","USER");o(this,"postsCount",0);o(this,"pinnedPosts",[]);o(this,"lastPostId","");o(this,"status","");o(this,"deleted",!1);o(this,"deletedAt","");o(this,"deletedBy","");o(this,"customFields",null);o(this,"context",null);o(this,"createdAt","");o(this,"updatedAt","")}},zd=class{constructor(){o(this,"pagination",{totalItems:0,nextPageStartsAfter:"",lastCommentCreateTimestamp:""})}},$y=class{constructor(){o(this,"id","");o(this,"userId","");o(this,"discussionId","");o(this,"content","");o(this,"repliesCount",0);o(this,"replyId","");o(this,"anonymousNickname","");o(this,"reactions",[]);o(this,"reactionsCount",0);o(this,"reports",[]);o(this,"reportsCount",0);o(this,"versions",null);o(this,"privatePost",!1);o(this,"deleted",!1);o(this,"deletedAt","");o(this,"deletedBy","");o(this,"moderated",!1);o(this,"moderatedAt","");o(this,"moderatedBy","");o(this,"moderatedReason","");o(this,"createdAt","");o(this,"updatedAt","")}},yD=class{constructor(){o(this,"meta",new zd);o(this,"data",[])}},bD=class{constructor(){o(this,"type","");o(this,"userIds",[]);o(this,"reactionCount",0)}},wD=class{constructor(){o(this,"updatedAt","");o(this,"content","")}},_D=class{constructor(){o(this,"userId",null);o(this,"reason","AD");o(this,"reasonDetails",null)}},xD=class extends $y{constructor(){super(...arguments);o(this,"userModel",null)}},CD=class{constructor(){o(this,"meta",new zd);o(this,"data",[])}},ID=class{constructor(){o(this,"meta",new di);o(this,"data",[])}},SD=class{constructor(){o(this,"id","");o(this,"postsCount",0)}},Ny=class{constructor(){o(this,"remapToDiscussions",e=>(e.meta=this.remapToMeta(e.meta),e.data=e.data.map(t=>this.remapToDiscussionById(t)),e));o(this,"remapToDiscussionById",e=>{let t=new vD;return t.id=e.id,t.label=e.label,t.status=e.status,t.deleted=e.deleted,t.deletedAt=e.deleted_at,t.deletedBy=e.deleted_by,t.discussionType=e.discussion_type,t.moderationType=e.moderation_type,t.postsCount=e.posts_count,t.pinnedPosts=e.pinned_posts,t.lastPostId=e.last_post_id,t.customFields=e.custom_fields,t.context=e.context,t.createdAt=e.created_at,t.updatedAt=e.updated_at,t});o(this,"remapToPostsForDiscussion",(e,t)=>{let r=new yD,n=new CD;return r.meta=this.remapToPostMeta(e.meta),r.data=e.data.map(i=>this.remapToPostByIdBasic(i)),n.meta=this.remapToPostMeta(e.meta),n.data=e.data.map(i=>this.remapToPostByIdFull(i)),t==="basic"?r:n});o(this,"remapToPosts",e=>{let t=new ID;return t.meta=this.remapToMeta(e.meta),t.data=e.data.map(r=>this.remapToPostByIdBasic(r)),t});o(this,"remapToPostMeta",e=>{let t=new zd;return t.pagination.totalItems=e.pagination.total_items,t.pagination.nextPageStartsAfter=e.pagination.next_page_starts_after,t.pagination.lastCommentCreateTimestamp=e.pagination.last_comment_create_timestamp,t});o(this,"remapToMeta",e=>{let t=new di;return t.pagination.itemsPerPage=e.pagination.items_per_page,t.pagination.nextPageStartsAfter=e.pagination.next_page_starts_after,t});o(this,"remapToPostByIdBasic",e=>{let t=new $y;return t.id=e.id,t.userId=e.user_id,t.discussionId=e.discussion_id,t.content=e.content,t.anonymousNickname=e.anonymous_nickname,t.reactionsCount=e.reactions_count,t.replyId=e.reply_id,t.reactions=e.reactions.length?e.reactions.map(r=>this.remapReactionsPost(r)):e.reactions,t.repliesCount=e.replies_count,t.reports=e.reports.length?e.reports.map(r=>this.remapReportPost(r)):e.reports,t.reportsCount=e.reports_count,t.versions=e.versions.length?e.versions.map(r=>this.remapVersionsPost(r)):e.versions,t.privatePost=e.private_post,t.deleted=e.deleted,t.deletedAt=e.deleted_at,t.deletedBy=e.deleted_by,t.moderated=e.moderated,t.moderatedAt=e.moderated_at,t.moderatedBy=e.moderated_by,t.moderatedReason=e.moderated_reason,t.createdAt=e.created_at,t.updatedAt=e.updated_at,t});o(this,"remapToPostByIdFull",e=>{let t=new xD;return t.id=e.id,t.userId=e.user_id,t.discussionId=e.discussion_id,t.content=e.content,t.anonymousNickname=e.anonymous_nickname,t.reactionsCount=e.reactions_count,t.replyId=e.reply_id,t.reactions=e.reactions.length?e.reactions.map(r=>this.remapReactionsPost(r)):e.reactions,t.repliesCount=e.replies_count,t.reports=e.reports.length?e.reports.map(r=>this.remapReportPost(r)):e.reports,t.reportsCount=e.reports_count,t.versions=e.versions.length?e.versions.map(r=>this.remapVersionsPost(r)):e.versions,t.privatePost=e.private_post,t.deleted=e.deleted,t.deletedAt=e.deleted_at,t.deletedBy=e.deleted_by,t.moderated=e.moderated,t.moderatedAt=e.moderated_at,t.moderatedBy=e.moderated_by,t.moderatedReason=e.moderated_reason,t.createdAt=e.created_at,t.updatedAt=e.updated_at,t});o(this,"remapToPostCount",e=>e.map(t=>{let r=new SD;return r.id=t.id,r.postsCount=t.posts_count,r}));o(this,"remapReactionsPost",e=>{let t=new bD;return t.type=e.type,t.userIds=e.user_ids,t.reactionCount=e.reaction_count,t});o(this,"remapVersionsPost",e=>{let t=new wD;return t.content=e.content,t.updatedAt=e.updated_at,t});o(this,"remapReportPost",e=>{let t=new _D;return t.userId=e.user_id,t.reason=e.reason,t.reasonDetails=e.reason_details,t})}},TD=class extends qr{constructor(t){super(t,Rr(t.environment,"discussions"));o(this,"remapper",null);o(this,"getAll",(t,r)=>C(this,null,function*(){let n="/discussions"+this.apiSignInUrl;t&&(n+=`${t.constructMainFiltersUrl()}`),ut(r)&&(n+=Ze());let i="There was a problem getting discussions",a=yield this.fetchWithoutAuth(n,i);return this.remapper.remapToDiscussions(a)}));o(this,"getById",t=>C(this,null,function*(){let r=`/discussions/${t}`+this.apiSignInUrl,n="There was a problem getting discussion",i=yield this.fetchWithoutAuth(r,n);return this.remapper.remapToDiscussionById(i.data)}));o(this,"createPost",(t,r)=>C(this,null,function*(){let n=`/discussions/${t}/posts`+this.apiSignInUrl,i="There was a problem creating post in discussion",a="POST",s=yield this.fetchWithAuth(n,i,a,r);return this.remapper.remapToPostByIdBasic(s.data)}));o(this,"getPostById",t=>C(this,null,function*(){let r=`/posts/${t}`+this.apiSignInUrl,n="There was a problem getting post by ID in discussion",i=yield this.fetchWithoutAuth(r,n);return this.remapper.remapToPostByIdFull(i.data)}));o(this,"updatePost",(t,r)=>C(this,null,function*(){let n=`/posts/${t}`+this.apiSignInUrl,i="There was a problem editing post in discussion",a="PUT",s={content:r},l=yield this.fetchWithAuth(n,i,a,s);return this.remapper.remapToPostByIdBasic(l.data)}));o(this,"reactToPost",(t,r)=>C(this,null,function*(){let n=`/posts/${t}/reaction`+this.apiSignInUrl,i="There was a problem reacting to post in discussion",a="PUT",s={reaction:r.toLocaleLowerCase()},l=yield this.fetchWithAuth(n,i,a,s);return this.remapper.remapToPostByIdFull(l.data)}));o(this,"deletePost",t=>C(this,null,function*(){let r=`/posts/${t}`+this.apiSignInUrl;return yield this.fetchWithAuth(r,"There was a problem deleting post in discussion","DELETE"),!0}));o(this,"getPosts",(t,r)=>C(this,null,function*(){let n=`/discussions/${t}/posts`+this.apiSignInUrl;r&&(n+=`${r.constructMainFiltersUrl()}`);let i="There was a problem getting posts in discussion",a=yield this.fetchWithoutAuth(n,i);return this.remapper.remapToPostsForDiscussion(a,"full")}));o(this,"getPostReplies",(t,r)=>C(this,null,function*(){let n=`/posts/${t}/replies`+this.apiSignInUrl;r&&(n+=`${r.constructMainFiltersUrl()}`);let i="There was a problem getting post's replies in discussion",a=yield this.fetchWithoutAuth(n,i);return this.remapper.remapToPostsForDiscussion(a,"full")}));o(this,"reportPost",(t,r,n)=>C(this,null,function*(){let i=`/posts/${t}/report`+this.apiSignInUrl,a="There was a problem reporting post in discussion",s="POST",l={reason:r.toLocaleUpperCase(),reason_details:n||null},c=yield this.fetchWithAuth(i,a,s,l);return this.remapper.remapToPostByIdBasic(c.data)}));o(this,"getOwnPosts",t=>C(this,null,function*(){let r="/posts"+this.apiSignInUrl;t&&(r+=`${t.constructMainFiltersUrl()}`);let n="There was a problem getting own posts",i=yield this.fetchWithAuth(r,n);return this.remapper.remapToPosts(i)}));o(this,"getUserPosts",(t,r,n)=>C(this,null,function*(){let i=`/posts/users/${t}`+this.apiSignInUrl;r&&(i+=`${r.constructMainFiltersUrl()}`),ut(n)&&(i+=Ze());let a="There was a problem getting user's posts",s=yield this.fetchWithoutAuth(i,a);return this.remapper.remapToPosts(s)}));o(this,"getPostsCount",(t,r)=>C(this,null,function*(){let n="/discussions/posts/count"+this.apiSignInUrl+`&discussion_ids=${t.join(",")}`;ut(r)&&(n+=Ze());let i="There was a problem getting posts count for discussions",a=yield this.fetchWithoutAuth(n,i);return this.remapper.remapToPostCount(a.data)}));o(this,"getTopDiscussions",(t,r)=>C(this,null,function*(){let n="/discussions/top"+this.apiSignInUrl;t&&(n+=`${t.constructMainFiltersUrl()}`),ut(r)&&(n+=Ze());let i="There was a problem getting top discussions",a=yield this.fetchWithoutAuth(n,i);return this.remapper.remapToDiscussions(a)}));this.remapper=new Ny}},ED=class{constructor(){o(this,"content","");o(this,"reply_id","");o(this,"anonymous_nickname","");o(this,"context",null)}},AD=class{constructor(){o(this,"createRequestBodyFromParam",e=>{let t=new ED;return t.content=e.content,t.reply_id=e.replyId,t.anonymous_nickname=e.userNickname,t.context=e.context,t})}},OD=["CREATED_AT_ASC","CREATED_AT_DESC","POSTS_COUNT_ASC","POSTS_COUNT_DESC"],PD=["ACTIVE","INACTIVE"],kD=class extends Yr{constructor(t){super(t);o(this,"discussionIds");o(this,"label");o(this,"fromDate");o(this,"toDate");o(this,"fromCount");o(this,"toCount");o(this,"sort");o(this,"status");o(this,"skipDeleted");this.discussionIds=t&&t.discussionIds?t.discussionIds:null,this.label=t&&t.label?t.label:null,this.fromDate=t&&t.fromDate?t.fromDate:null,this.toDate=t&&t.toDate?t.toDate:null,this.fromCount=t&&t.fromCount?t.fromCount:null,this.toCount=t&&t.toCount?t.toCount:null,this.sort=t&&t.sort?t.sort:null,this.status=(t==null?void 0:t.status)||null,this.skipDeleted=t&&t.skipDeleted!==void 0?t.skipDeleted:null}constructMainFiltersUrl(){let t=super.constructMainFiltersUrl();return this.discussionIds!==null&&(t+=`&discussion_ids=${this.discussionIds.join(",")}`),this.label!==null&&(t+=`&label=${this.label}`),this.fromDate!==null&&(t+=`&from_date=${this.fromDate}`),this.toDate!==null&&(t+=`&to_date=${this.toDate}`),this.fromCount!==null&&(t+=`&from_count=${this.fromCount}`),this.toCount!==null&&(t+=`&to_count=${this.toCount}`),this.sort&&OD.includes(this.sort.toUpperCase())&&(t+=`&sort=${this.sort.toUpperCase()}`),this.status&&PD.includes(this.status.toUpperCase())&&(t+=`&status=${this.status.toUpperCase()}`),this.skipDeleted!==null&&(t+=`&skip_deleted=${this.skipDeleted}`),t}},yl=class extends Yr{constructor(t){super(t);o(this,"skipDeleted");o(this,"sort");this.skipDeleted=t&&t.skipDeleted!==void 0?t.skipDeleted:null,this.sort=t&&t.sort?t.sort.toLocaleLowerCase():null}constructMainFiltersUrl(){let t=super.constructMainFiltersUrl();return this.skipDeleted!==null&&(t+=`&skip_deleted=${this.skipDeleted}`),this.sort&&(t+=`&sort=${this.sort}`),t}},RD=class extends Yr{constructor(t){super(t);o(this,"fromDate");o(this,"toDate");o(this,"entityIds");o(this,"entityType");o(this,"contentType");this.fromDate=(t==null?void 0:t.fromDate)||null,this.toDate=(t==null?void 0:t.toDate)||null,this.entityIds=(t==null?void 0:t.entityIds)||null,this.entityType=(t==null?void 0:t.entityType)||null,this.contentType=(t==null?void 0:t.contentType)||null}constructMainFiltersUrl(){let t=super.constructMainFiltersUrl();return this.fromDate!==null&&(t+=`&from_date=${this.fromDate}`),this.toDate!==null&&(t+=`&to_date=${this.toDate}`),this.entityIds!==null&&this.entityIds.length>0&&(t+=`&entity_ids=${this.entityIds}`),this.contentType!==null&&(t+=`&content_type=${this.contentType}`),t}},Hd=class{constructor(e){o(this,"idSchema",null);o(this,"profile",null);o(this,"validator",null);o(this,"idMapping",null);o(this,"finalizePostFullModel",e=>C(this,null,function*(){let t=e.map(n=>n.userId),r=yield this.profile.getByIds(t);return e.map(n=>(n.userModel=this.extractModelById(r,n.userId),n))}));o(this,"finalizeTopDiscussionsFilters",e=>C(this,null,function*(){if(this.idSchema!=="native"&&e.entityIds&&e.entityIds.length>0){this.validator.validateFilters(e);let t=yield this.idMapping.getEntityIdsBySchemaId(Array.from(e.entityIds),e.entityType,"native");e.entityIds=t[e.entityType]}}));o(this,"extractModelById",(e,t)=>{if(e.length){let r=e.find(n=>n.id===t);return r?(delete r.interests,r):null}return null});this.idSchema=e.idSchema,this.profile=new Wn(e),this.validator=new Bd(e),this.idMapping=new dr(e)}},MD=class{constructor(e){o(this,"idSchema",null);o(this,"errorHandlingMode",null);o(this,"https",null);o(this,"clientHttps",null);o(this,"activityService",null);o(this,"service",null);o(this,"factory",null);o(this,"getAll",(e,t)=>C(this,null,function*(){e&&(e=new kD(e));let r=yield this.https.getAll(e,t);for(let n of r.data)yield this.remapTags(n,"native",this.idSchema);return r}));o(this,"getById",e=>C(this,null,function*(){let t=yield this.https.getById(e);return yield this.remapTags(t,"native",this.idSchema),t}));o(this,"createPost",(e,t)=>C(this,null,function*(){let r=JSON.parse(JSON.stringify(t));yield this.remapTags(r,this.idSchema,"native");let n=this.factory.createRequestBodyFromParam(r);return yield this.https.createPost(e,n)}));o(this,"getPostById",e=>C(this,null,function*(){let t=yield this.https.getPostById(e);return(yield this.service.finalizePostFullModel([t]))[0]}));o(this,"updatePost",(e,t)=>C(this,null,function*(){return yield this.https.updatePost(e,t)}));o(this,"deletePost",e=>C(this,null,function*(){return yield this.https.deletePost(e)}));o(this,"getPosts",(e,t)=>C(this,null,function*(){t&&(t=new yl(t));let r=yield this.https.getPosts(e,t);return r.data=yield this.service.finalizePostFullModel(r.data),r}));o(this,"getPostReplies",(e,t)=>C(this,null,function*(){t&&(t=new yl(t));let r=yield this.https.getPostReplies(e,t);return r.data=yield this.service.finalizePostFullModel(r.data),r}));o(this,"reactToPost",(e,t)=>C(this,null,function*(){let r=yield this.https.reactToPost(e,t);return(yield this.service.finalizePostFullModel([r]))[0]}));o(this,"reportPost",(e,t,r)=>C(this,null,function*(){return yield this.https.reportPost(e,t,r)}));o(this,"getOwnPosts",e=>C(this,null,function*(){return e&&(e=new yl(e)),yield this.https.getOwnPosts(e)}));o(this,"getUserPosts",(e,t,r)=>C(this,null,function*(){return t&&(t=new yl(t)),yield this.https.getUserPosts(e,t,r)}));o(this,"getConfig",()=>C(this,null,function*(){return yield this.clientHttps.getConfig("discussions")}));o(this,"getPostsCount",(e,t)=>C(this,null,function*(){if(!e||!Array.isArray(e)||!e.length)throw this.errorHandlingMode==="standard"?new et(400,"invalid_discussion_ids","Invalid discussion ids argument. Please provide at least one discussion id in an array"):new mt(400,"invalid_discussion_ids","Invalid discussion ids argument. Please provide at least one discussion id in an array");return yield this.https.getPostsCount(e,t)}));o(this,"getTopDiscussions",(e,t)=>C(this,null,function*(){e&&(e=new RD(e),yield this.service.finalizeTopDiscussionsFilters(e));let r=yield this.https.getTopDiscussions(e,t);for(let n of r.data)yield this.remapTags(n,"native",this.idSchema);return r}));o(this,"remapTags",(e,t,r)=>C(this,null,function*(){if(this.idSchema!="native"&&e.context&&e.context.tags&&e.context.tags.length){let n=JSON.parse(JSON.stringify(e.context.tags)),i=yield this.activityService.remapTagsIds(n,t,r);e.context.tags=i}}));this.idSchema=e.idSchema,this.errorHandlingMode=e.errorHandlingMode,this.https=new TD(e),this.clientHttps=new hi(e),this.activityService=new vl(e),this.service=new Hd(e),this.factory=new AD}},DD=class{constructor(e){o(this,"facade",null);o(this,"getAll",(e,t)=>C(this,null,function*(){return yield this.facade.getAll(e,t)}));o(this,"getById",e=>C(this,null,function*(){return yield this.facade.getById(e)}));o(this,"createPost",(e,t)=>C(this,null,function*(){return yield this.facade.createPost(e,t)}));o(this,"getPostById",e=>C(this,null,function*(){return yield this.facade.getPostById(e)}));o(this,"updatePost",(e,t)=>C(this,null,function*(){return yield this.facade.updatePost(e,t)}));o(this,"deletePost",e=>C(this,null,function*(){return yield this.facade.deletePost(e)}));o(this,"getPosts",(e,t)=>C(this,null,function*(){return yield this.facade.getPosts(e,t)}));o(this,"getPostReplies",(e,t)=>C(this,null,function*(){return yield this.facade.getPostReplies(e,t)}));o(this,"react",(e,t)=>C(this,null,function*(){return yield this.facade.reactToPost(e,t)}));o(this,"reportPost",(e,t,r)=>C(this,null,function*(){return yield this.facade.reportPost(e,t,r)}));o(this,"getOwnPosts",e=>C(this,null,function*(){return yield this.facade.getOwnPosts(e)}));o(this,"getUserPosts",(e,t,r)=>C(this,null,function*(){return yield this.facade.getUserPosts(e,t,r)}));o(this,"getConfig",()=>C(this,null,function*(){return yield this.facade.getConfig()}));o(this,"getPostsCount",(e,t)=>C(this,null,function*(){return yield this.facade.getPostsCount(e,t)}));o(this,"getTopDiscussions",(e,t)=>C(this,null,function*(){return yield this.facade.getTopDiscussions(e,t)}));this.facade=new MD(e)}},LD=class{constructor(){o(this,"profileId","");o(this,"profileModel",null);o(this,"challengeId","");o(this,"challengeModel",null);o(this,"message","")}},FD=class{constructor(){o(this,"profileId","");o(this,"profileModel",null);o(this,"leagueId","");o(this,"leagueModel",null);o(this,"message","")}},By=class{constructor(){o(this,"id","");o(this,"name","");o(this,"description","");o(this,"type","");o(this,"banned",[]);o(this,"invites",[]);o(this,"administrators",[]);o(this,"membersCount",0);o(this,"invitationCode","");o(this,"templateId","");o(this,"templateModel",null);o(this,"pastTemplates",[]);o(this,"usersCanInviteUsers",!1);o(this,"scoringStartsAt","");o(this,"pinnedPosts",[])}},$D=class extends By{constructor(){super(...arguments);o(this,"members",[])}},ND=class{constructor(){o(this,"predictionId",null);o(this,"predictionModel",null);o(this,"profileId",null);o(this,"profileModel",null)}},BD=class{constructor(){o(this,"remapToPrivateLeagues",e=>(e.meta=this.remapMetaPrivateLeagues(e.meta.pagination),e.data=e.data.map(t=>this.remapToPrivateLeagueById(t)),e));o(this,"remapMetaPrivateLeagues",e=>{let t=new di;return t.pagination.itemsPerPage=e.items_per_page,t.pagination.nextPageStartsAfter=e.next_page_starts_after,t});o(this,"remapToPrivateLeagueById",e=>{let t=new $D;return t.id=e.id,t.name=e.name,t.description=e.description,t.type=e.type,t.members=e.members,t.administrators=e.administrators,t.banned=e.banned,t.invites=e.invites,t.membersCount=e.members_count,t.usersCanInviteUsers=e.users_can_invite_users,t.invitationCode=e.invitation_code,t.templateId=e.template_id,t.pastTemplates=e.past_templates,t.pinnedPosts=e.pinned_posts,t.scoringStartsAt=e.scoring_starts_at,t});o(this,"remapToMyPrivateLeagues",e=>{let t=new By;return t.id=e.id,t.name=e.name,t.description=e.description,t.type=e.type,t.administrators=e.administrators,t.banned=e.banned,t.invites=e.invites,t.membersCount=e.members_count,t.usersCanInviteUsers=e.users_can_invite_users,t.invitationCode=e.invitation_code,t.templateId=e.template_id,t.pastTemplates=e.past_templates,t.pinnedPosts=e.pinned_posts,t.scoringStartsAt=e.scoring_starts_at,t});o(this,"remapToAcceptPrivateLeague",e=>{let t=new FD;return t.profileId=e.profile_id,t.leagueId=e.league_id,t.message=e.message,t});o(this,"remapToAcceptChallenge",e=>{let t=new LD;return t.profileId=e.profile_id,t.challengeId=e.league_id,t.message=e.message,t});o(this,"remapPredictions",e=>(e.meta=this.remapMeta(e.meta),e.data=this.remapPredictionsData(e.data),e));o(this,"remapMeta",e=>{let t=new Zi;return t.pagination.currentPage=e.pagination.current_page,t.pagination.itemsPerPage=e.pagination.items_per_page,t.pagination.numberOfPages=e.pagination.number_of_pages,t.pagination.totalItems=e.pagination.total_items,t});o(this,"remapPredictionsData",e=>e.map(t=>{let r=new ND;return r.predictionId=t.prediction_id,r.profileId=t.profile_id,r}))}},jy=class extends qr{constructor(t){super(t,Rr(t.environment,"privateLeagues"));o(this,"remapper",null);o(this,"discussionsRemapper",null);o(this,"discussionsBaseURL",null);o(this,"create",(t,r)=>C(this,null,function*(){let n="/leagues"+this.apiSignInUrl,i=`There was a problem ${r==="PRIVATE_LEAGUE"?"creating private league":"issuing challenge"}`,a="POST",s=yield this.fetchWithAuth(n,i,a,t);return this.remapper.remapToPrivateLeagueById(s.data)}));o(this,"update",(t,r,n)=>C(this,null,function*(){let i=`/leagues/${t}`+this.apiSignInUrl,a=`There was a problem updating ${n==="PRIVATE_LEAGUE"?"private league":"challenge"}`,s="PUT",l=yield this.fetchWithAuth(i,a,s,r);return this.remapper.remapToPrivateLeagueById(l.data)}));o(this,"updateLeagueTemplate",(t,r,n,i)=>C(this,null,function*(){let a=`/leagues/${t}/template`+this.apiSignInUrl,s=`There was a problem updating template for the ${i==="PRIVATE_LEAGUE"?"private league":"challenge"}`,l="POST",c={new_template_id:r,past_template_name:n},u=yield this.fetchWithAuth(a,s,l,c);return this.remapper.remapToPrivateLeagueById(u.data)}));o(this,"getById",(t,r,n)=>C(this,null,function*(){let i=`/leagues/${t}`+this.apiSignInUrl;ut(n)&&(i+=Ze());let a=`There was a problem getting ${r==="PRIVATE_LEAGUE"?"private league":"challenge"}`,s=yield this.fetchWithAuth(i,a);return this.remapper.remapToPrivateLeagueById(s.data)}));o(this,"getMyLeagues",(t,r)=>C(this,null,function*(){let n="/leagues"+this.apiSignInUrl+t.constructFiltersUrl(),i=`There was a problem getting user's ${r==="PRIVATE_LEAGUE"?"private leagues":"challenges"}`;return(yield this.fetchWithAuth(n,i)).data.map(a=>this.remapper.remapToMyPrivateLeagues(a))}));o(this,"delete",(t,r)=>C(this,null,function*(){let n=`/leagues/${t}`+this.apiSignInUrl,i=`There was a problem deleting ${r==="PRIVATE_LEAGUE"?"private league":"challenge"}`;return yield this.fetchWithAuth(n,i,"DELETE"),!0}));o(this,"invite",(t,r)=>C(this,null,function*(){let n=`/membership/invite/${t}`+this.apiSignInUrl,i=`There was a problem inviting the following users: ${r.join(",")}`,a="POST",s={profiles:r};return(yield this.fetchWithAuth(n,i,a,s)).data}));o(this,"deleteInvitation",(t,r)=>C(this,null,function*(){let n=`/membership/invite/${t}`+this.apiSignInUrl,i=`There was a problem deleting invitation for the following users: ${r.join(",")}`,a="DELETE",s={profiles:r};return yield this.fetchWithAuth(n,i,a,s),!0}));o(this,"accept",(t,r,n)=>C(this,null,function*(){let i=`/membership/accept/${t}`+this.apiSignInUrl+`&accept=${r?"ACCEPT":"REJECT"}`,a=`There was a problem ${r?"accepting":"rejecting"} invitation for ${n==="PRIVATE_LEAGUE"?"private league":"challenge"}: ${t}`,s="POST",l=yield this.fetchWithAuth(i,a,s);return n==="PRIVATE_LEAGUE"?this.remapper.remapToAcceptPrivateLeague(l.data):this.remapper.remapToAcceptChallenge(l.data)}));o(this,"ban",(t,r)=>C(this,null,function*(){let n=`/membership/ban/${t}`+this.apiSignInUrl,i=`There was a problem banning the following users: ${r.join(",")}`,a="POST",s={profiles:r};return(yield this.fetchWithAuth(n,i,a,s)).data}));o(this,"unban",(t,r)=>C(this,null,function*(){let n=`/membership/unban/${t}`+this.apiSignInUrl,i=`There was a problem unbanning the following users: ${r.join(",")}`,a="POST",s={profiles:r};return(yield this.fetchWithAuth(n,i,a,s)).data}));o(this,"join",t=>C(this,null,function*(){let r="/membership/join"+this.apiSignInUrl+`&invitation_code=${t}`,n="There was a problem joining league",i="POST",a=yield this.fetchWithAuth(r,n,i);return this.remapper.remapToAcceptPrivateLeague(a.data)}));o(this,"leave",(t,r)=>C(this,null,function*(){let n=`/membership/leave/${t}`+this.apiSignInUrl,i=`There was a problem leaving the following ${r==="PRIVATE_LEAGUE"?"league":"challenge"}: ${t}`;return(yield this.fetchWithAuth(n,i,"POST")).data}));o(this,"getInvitations",(t,r)=>C(this,null,function*(){let n="/membership/invitations"+this.apiSignInUrl+r.constructMainFiltersUrl(),i=`There was a problem getting invitations for ${t==="PRIVATE_LEAGUE"?"leagues":"challenges"}`,a=yield this.fetchWithAuth(n,i);return this.remapper.remapToPrivateLeagues(a)}));o(this,"getReportedPosts",(t,r)=>C(this,null,function*(){let n=`/discussions/${t}/posts/reported${this.apiSignInUrl}`,i=`There was a problem fetching posts for the following: ${t}`;r&&(n+=r.constructMainFiltersUrl());let a=yield this.fetchWithAuthNewBaseURL(this.discussionsBaseURL,n,i);return this.discussionsRemapper.remapToPostsForDiscussion(a,"full")}));o(this,"getPredictions",(t,r)=>C(this,null,function*(){let n=`/leagues/${t}/predictions`+this.apiSignInUrl,i=`There was a problem getting predictions for private league: ${t}`;r&&(n+=r.constructFiltersUrl());let a=yield this.fetchWithAuth(n,i);return this.remapper.remapPredictions(a)}));o(this,"moderatePost",(t,r)=>C(this,null,function*(){let n=`/posts/${t}/admin/moderate${this.apiSignInUrl}`,i=`There was a problem moderating the following post: ${t}`,a="POST",s={moderation_reason:r},l=yield this.fetchWithAuthNewBaseURL(this.discussionsBaseURL,n,i,a,s);return this.discussionsRemapper.remapToPostByIdBasic(l.data)}));this.discussionsBaseURL=Rr(t.environment,"discussions"),this.remapper=new BD,this.discussionsRemapper=new Ny}},zy=class{constructor(){o(this,"name","");o(this,"description","");o(this,"invitation_code","");o(this,"template_id","");o(this,"users_can_invite_users",!1);o(this,"administrators",[]);o(this,"scoring_starts_at","")}},jD=class extends zy{constructor(){super(...arguments);o(this,"type","ONE_VS_ONE")}},zD=class extends zy{constructor(){super(...arguments);o(this,"type","PRIVATE")}},Hy=class{constructor(){o(this,"name","");o(this,"description","");o(this,"invitation_code","");o(this,"template_id","");o(this,"users_can_invite_users",!1);o(this,"administrators",[]);o(this,"pinned_posts",[]);o(this,"scoring_starts_at","")}},HD=class extends Hy{constructor(){super(...arguments);o(this,"type","PRIVATE")}},UD=class extends Hy{constructor(){super(...arguments);o(this,"type","ONE_VS_ONE")}},Uy=class{constructor(){o(this,"createRequestBodyFromParam",(e,t)=>{let r=t==="PRIVATE"?new zD:new jD;return r.name=e.name,r.description=e.description,r.invitation_code=e.invitationCode,r.template_id=e.templateId,r.users_can_invite_users=e.usersCanInviteUsers,e.administrators?r.administrators=e.administrators:delete r.administrators,e.scoringStartsAt?r.scoring_starts_at=e.scoringStartsAt:delete r.scoring_starts_at,r});o(this,"createUpdateRequestBodyFromParam",(e,t)=>{let r=t==="PRIVATE"?new HD:new UD;return r.name=e.name,r.description=e.description,r.invitation_code=e.invitationCode,r.template_id=e.templateId,r.users_can_invite_users=e.usersCanInviteUsers,r.administrators=e.administrators,r.pinned_posts=e.pinnedPosts,r.scoring_starts_at=e.scoringStartsAt,r})}},Vy=class extends Yr{constructor(t){super(t);o(this,"type",null);o(this,"constructMainFiltersUrl",()=>{let t=super.constructMainFiltersUrl();return this.type&&(t+=`&type=${this.type}`),t});this.type=t&&t.type?t.type:null}},VD=class{constructor(e){o(this,"type","PRIVATE");o(this,"userRole",null);o(this,"constructFiltersUrl",()=>{let e=`&type=${this.type}`;return this.userRole&&(e+=`&user_role=${this.userRole}`),e});this.userRole=(e==null?void 0:e.userRole)||null}},WD=class{constructor(e){o(this,"limit",null);o(this,"page",null);o(this,"leagueId",null);o(this,"templateId",null);o(this,"sortOrder",null);o(this,"constructFiltersUrl",()=>{let e="";return this.limit&&(e+=`&limit=${this.limit}`),this.page&&(e+=`&page=${this.page}`),this.leagueId&&(e+=`&league_id=${this.leagueId}`),this.templateId&&(e+=`&template_id=${this.templateId}`),this.sortOrder&&(e+=`&sort_order=${this.sortOrder}`),e});this.limit=e&&e.limit?e.limit:null,this.page=e&&e.page?e.page:null,this.leagueId=e&&e.leagueId?e.leagueId:null,this.templateId=e&&e.templateId?e.templateId:null,this.sortOrder=e&&e.sortOrder?e.sortOrder:null}},Wy=class extends Yr{constructor(t){super(t);o(this,"reportsCount",null);o(this,"constructMainFiltersUrl",()=>{let t=super.constructMainFiltersUrl();return this.reportsCount&&(t+=`&reports_count=${this.reportsCount}`),t});this.reportsCount=t.reportsCount?t.reportsCount:null}},qy=class{constructor(e){o(this,"limit",null);o(this,"page",null);o(this,"profileIds",null);o(this,"constructFiltersUrl",()=>{let e="";return this.limit&&(e+=`&limit=${this.limit}`),this.page&&(e+=`&page=${this.page}`),this.profileIds&&(e+=`&profile_ids=${this.profileIds.join(",")}`),e});this.limit=e&&e.limit?e.limit:null,this.page=e&&e.page?e.page:null,this.profileIds=e&&e.profileIds?e.leagueId:null}},Gy=class{constructor(e){o(this,"loyalty",null);o(this,"profile",null);o(this,"predictor",null);o(this,"setTemplateModels",e=>C(this,null,function*(){let t=yield this.loyalty.getTemplates();e.templateModel=t.data.find(r=>r.id===e.templateId),e.pastTemplates&&e.pastTemplates.length>0&&e.pastTemplates.forEach(r=>{r.model=t.data.find(n=>n.id===r.id)})}));o(this,"setTemplateModelsInLeagues",e=>C(this,null,function*(){if(!e.length)return;let t=yield this.loyalty.getTemplates();e.forEach(r=>{r.templateModel=t.data.find(n=>n.id===r.templateId),r.pastTemplates&&r.pastTemplates.length>0&&r.pastTemplates.forEach(n=>{n.model=t.data.find(i=>i.id===n.id)})})}));o(this,"setTemplateModelsFromLeagueModels",(e,t)=>{if(t==="PRIVATE_LEAGUE"){e.forEach(r=>{r.templateModel=r.templateId===r.privateLeagueModel.templateId?r.privateLeagueModel.templateModel:r.privateLeagueModel.pastTemplates.find(n=>n.id===r.templateId).model});return}e.forEach(r=>{r.templateModel=r.templateId===r.challengeModel.templateId?r.challengeModel.templateModel:r.challengeModel.pastTemplates.find(n=>n.id===r.templateId).model})});o(this,"setProfileModel",e=>C(this,null,function*(){let t=yield this.profile.getById(e.profileId).getInfo();e.profileModel=t}));o(this,"setModelsForPredictions",e=>C(this,null,function*(){if(e.data.length){let t=e.data.map(a=>a.profileId),r=e.data.map(a=>a.predictionId),n=yield this.getProfileModels(t),i=yield this.getPredictionModels(r);e.data.forEach(a=>{a.profileModel=n.find(s=>s.id===a.profileId),a.predictionModel=i.find(s=>s.id===a.predictionId)})}return e}));o(this,"getProfileModels",e=>C(this,null,function*(){return yield this.profile.getByIds(e)}));o(this,"getPredictionModels",e=>C(this,null,function*(){return yield this.predictor.getPredictionsByIds(e)}));this.loyalty=new Dy(e),this.profile=new Wn(e),this.predictor=new vy(e)}},qD=class{constructor(e){o(this,"factory",null);o(this,"privateLeagueHttps",null);o(this,"loyaltyHttps",null);o(this,"profile",null);o(this,"service",null);o(this,"discussionsService",null);o(this,"create",e=>C(this,null,function*(){let t=this.factory.createRequestBodyFromParam(e,"PRIVATE"),r=yield this.privateLeagueHttps.create(t,"PRIVATE_LEAGUE");return yield this.service.setTemplateModels(r),r}));o(this,"getById",(e,t)=>C(this,null,function*(){let r=yield this.privateLeagueHttps.getById(e,"PRIVATE_LEAGUE",t);return yield this.service.setTemplateModels(r),r}));o(this,"getMyLeagues",e=>C(this,null,function*(){e=new VD(e);let t=yield this.privateLeagueHttps.getMyLeagues(e,"PRIVATE_LEAGUE");return yield this.service.setTemplateModelsInLeagues(t),t}));o(this,"update",(e,t)=>C(this,null,function*(){let r=this.factory.createUpdateRequestBodyFromParam(t,"PRIVATE"),n=yield this.privateLeagueHttps.update(e,r,"PRIVATE_LEAGUE");return yield this.service.setTemplateModels(n),n}));o(this,"updateTemplate",(e,t,r)=>C(this,null,function*(){let n=yield this.privateLeagueHttps.updateLeagueTemplate(e,t,r,"PRIVATE_LEAGUE");return yield this.service.setTemplateModels(n),n}));o(this,"delete",e=>C(this,null,function*(){return yield this.privateLeagueHttps.delete(e,"PRIVATE_LEAGUE")}));o(this,"invite",(e,t)=>C(this,null,function*(){return yield this.privateLeagueHttps.invite(e,t)}));o(this,"deleteInvitation",(e,t)=>C(this,null,function*(){return yield this.privateLeagueHttps.deleteInvitation(e,t)}));o(this,"accept",e=>C(this,null,function*(){let t=yield this.privateLeagueHttps.accept(e,!0,"PRIVATE_LEAGUE");return yield this.finalizeAcceptModel(t,!0)}));o(this,"reject",e=>C(this,null,function*(){let t=yield this.privateLeagueHttps.accept(e,!1,"PRIVATE_LEAGUE");return yield this.finalizeAcceptModel(t,!1)}));o(this,"banUsers",(e,t)=>C(this,null,function*(){return yield this.privateLeagueHttps.ban(e,t)}));o(this,"unbanUsers",(e,t)=>C(this,null,function*(){return yield this.privateLeagueHttps.unban(e,t)}));o(this,"join",e=>C(this,null,function*(){let t=yield this.privateLeagueHttps.join(e);return yield this.finalizeAcceptModel(t,!0)}));o(this,"leave",e=>C(this,null,function*(){return yield this.privateLeagueHttps.leave(e,"PRIVATE_LEAGUE")}));o(this,"finalizeAcceptModel",(e,t)=>C(this,null,function*(){if(t){let r=yield this.getById(e.leagueId);e.leagueModel=r}return yield this.service.setProfileModel(e),e}));o(this,"getMyLeaguesStandings",e=>C(this,null,function*(){e&&(e=new WD(e));let t=yield this.profile.getOwn().getInfo(),r=yield this.loyaltyHttps.getUserRankingsForPrivateLeagueAndChallenges(t.id,"PRIVATE_LEAGUE",e);for(let n of r.data){let i=yield this.getById(n.privateLeagueId);n.privateLeagueModel=i}return this.service.setTemplateModelsFromLeagueModels(r.data,"PRIVATE_LEAGUE"),r}));o(this,"getInvitations",e=>C(this,null,function*(){e=new Vy(e),e.type="PRIVATE";let t=yield this.privateLeagueHttps.getInvitations("PRIVATE_LEAGUE",e);return yield this.service.setTemplateModelsInLeagues(t.data),t}));o(this,"getReportedPosts",(e,t)=>C(this,null,function*(){t&&(t=new Wy(t));let r=yield this.privateLeagueHttps.getReportedPosts(e,t);return r.data=yield this.discussionsService.finalizePostFullModel(r.data),r}));o(this,"getPredictions",(e,t)=>C(this,null,function*(){if(t){if(t.limit&&t.limit>20)throw new et(400,"invalid_limit","Invalid limit filter. The maximum limit is 20");t=new qy(t)}let r=yield this.privateLeagueHttps.getPredictions(e,t);return yield this.service.setModelsForPredictions(r)}));o(this,"moderatePost",(e,t)=>C(this,null,function*(){return yield this.privateLeagueHttps.moderatePost(e,t)}));this.factory=new Uy,this.privateLeagueHttps=new jy(e),this.loyaltyHttps=new Nd(e),this.profile=new Wn(e),this.service=new Gy(e),this.discussionsService=new Hd(e)}},GD=class{constructor(e){o(this,"privateLeaguesFacade",null);o(this,"create",e=>C(this,null,function*(){return yield this.privateLeaguesFacade.create(e)}));o(this,"update",(e,t)=>C(this,null,function*(){return yield this.privateLeaguesFacade.update(e,t)}));o(this,"updateTemplate",(e,t,r)=>C(this,null,function*(){return yield this.privateLeaguesFacade.updateTemplate(e,t,r)}));o(this,"delete",e=>C(this,null,function*(){return yield this.privateLeaguesFacade.delete(e)}));o(this,"getById",(e,t)=>C(this,null,function*(){return yield this.privateLeaguesFacade.getById(e,t)}));o(this,"getMyLeagues",e=>C(this,null,function*(){return yield this.privateLeaguesFacade.getMyLeagues(e)}));o(this,"invite",(e,t)=>C(this,null,function*(){return yield this.privateLeaguesFacade.invite(e,t)}));o(this,"deleteInvitation",(e,t)=>C(this,null,function*(){return yield this.privateLeaguesFacade.deleteInvitation(e,t)}));o(this,"accept",e=>C(this,null,function*(){return yield this.privateLeaguesFacade.accept(e)}));o(this,"reject",e=>C(this,null,function*(){return yield this.privateLeaguesFacade.reject(e)}));o(this,"banUsers",(e,t)=>C(this,null,function*(){return yield this.privateLeaguesFacade.banUsers(e,t)}));o(this,"unbanUsers",(e,t)=>C(this,null,function*(){return yield this.privateLeaguesFacade.unbanUsers(e,t)}));o(this,"join",e=>C(this,null,function*(){return yield this.privateLeaguesFacade.join(e)}));o(this,"leave",e=>C(this,null,function*(){return yield this.privateLeaguesFacade.leave(e)}));o(this,"getMyLeaguesStandings",e=>C(this,null,function*(){return yield this.privateLeaguesFacade.getMyLeaguesStandings(e)}));o(this,"getInvitations",e=>C(this,null,function*(){return yield this.privateLeaguesFacade.getInvitations(e)}));o(this,"getReportedPosts",(e,t)=>C(this,null,function*(){return yield this.privateLeaguesFacade.getReportedPosts(e,t)}));o(this,"getPredictions",(e,t)=>C(this,null,function*(){return yield this.privateLeaguesFacade.getPredictions(e,t)}));o(this,"moderatePost",(e,t)=>C(this,null,function*(){return yield this.privateLeaguesFacade.moderatePost(e,t)}));this.privateLeaguesFacade=new qD(e)}},YD=class{constructor(e){o(this,"limit",null);o(this,"page",null);o(this,"challengeId",null);o(this,"templateId",null);o(this,"sortOrder",null);o(this,"constructFiltersUrl",()=>{let e="";return this.limit&&(e+=`&limit=${this.limit}`),this.page&&(e+=`&page=${this.page}`),this.challengeId&&(e+=`&league_id=${this.challengeId}`),this.templateId&&(e+=`&template_id=${this.templateId}`),this.sortOrder&&(e+=`&sort_order=${this.sortOrder}`),e});this.limit=e&&e.limit?e.limit:null,this.page=e&&e.page?e.page:null,this.challengeId=e&&e.challengeId?e.challengeId:null,this.templateId=e&&e.templateId?e.templateId:null,this.sortOrder=e&&e.sortOrder?e.sortOrder:null}},KD=class{constructor(e){o(this,"type","ONE_VS_ONE");o(this,"userRole",null);o(this,"constructFiltersUrl",()=>{let e=`&type=${this.type}`;return this.userRole&&(e+=`&user_role=${this.userRole}`),e});this.userRole=(e==null?void 0:e.userRole)||null}},QD=class{constructor(e){o(this,"factory",null);o(this,"https",null);o(this,"loyaltyHttps",null);o(this,"profile",null);o(this,"service",null);o(this,"discussionsService",null);o(this,"issue",(e,t)=>C(this,null,function*(){let r=this.factory.createRequestBodyFromParam(e,"ONE_VS_ONE"),n=yield this.https.create(r,"CHALLENGE");yield this.service.setTemplateModels(n);let i=yield this.https.invite(n.id,[t]);return n.invites=[],n.invites.push(i[0]),n}));o(this,"update",(e,t)=>C(this,null,function*(){let r=this.factory.createUpdateRequestBodyFromParam(t,"ONE_VS_ONE"),n=yield this.https.update(e,r,"CHALLENGE");return yield this.service.setTemplateModels(n),n}));o(this,"updateTemplate",(e,t,r)=>C(this,null,function*(){let n=yield this.https.updateLeagueTemplate(e,t,r,"CHALLENGE");return yield this.service.setTemplateModels(n),n}));o(this,"delete",e=>C(this,null,function*(){return yield this.https.delete(e,"CHALLENGE")}));o(this,"getById",(e,t)=>C(this,null,function*(){let r=yield this.https.getById(e,"CHALLENGE",t);return yield this.service.setTemplateModels(r),r}));o(this,"getMyChallenges",e=>C(this,null,function*(){e=new KD(e);let t=yield this.https.getMyLeagues(e,"CHALLENGE");return yield this.service.setTemplateModelsInLeagues(t),t}));o(this,"accept",e=>C(this,null,function*(){let t=yield this.https.accept(e,!0,"CHALLENGE");return yield this.finalizeAcceptModel(t,!0)}));o(this,"reject",e=>C(this,null,function*(){let t=yield this.https.accept(e,!1,"CHALLENGE");return yield this.finalizeAcceptModel(t,!1)}));o(this,"leave",e=>C(this,null,function*(){return yield this.https.leave(e,"CHALLENGE")}));o(this,"finalizeAcceptModel",(e,t)=>C(this,null,function*(){if(t){let r=yield this.getById(e.challengeId);e.challengeModel=r}return yield this.service.setProfileModel(e),e}));o(this,"getMyChallengesStandings",e=>C(this,null,function*(){e&&(e=new YD(e));let t=yield this.profile.getOwn().getInfo(),r=yield this.loyaltyHttps.getUserRankingsForPrivateLeagueAndChallenges(t.id,"CHALLENGE",e);for(let n of r.data){let i=yield this.getById(n.challengeId);n.challengeModel=i}return this.service.setTemplateModelsFromLeagueModels(r.data,"CHALLENGE"),r}));o(this,"getInvitations",e=>C(this,null,function*(){e=new Vy(e),e.type="ONE_VS_ONE";let t=yield this.https.getInvitations("CHALLENGE",e);return yield this.service.setTemplateModelsInLeagues(t.data),t}));o(this,"getReportedPosts",(e,t)=>C(this,null,function*(){t&&(t=new Wy(t));let r=yield this.https.getReportedPosts(e,t);return r.data=yield this.discussionsService.finalizePostFullModel(r.data),r}));o(this,"getPredictions",(e,t)=>C(this,null,function*(){if(t){if(t.limit&&t.limit>20)throw new et(400,"invalid_limit","Invalid limit filter. The maximum limit is 20");t=new qy(t)}let r=yield this.https.getPredictions(e,t);return yield this.service.setModelsForPredictions(r)}));o(this,"moderatePost",(e,t)=>C(this,null,function*(){return yield this.https.moderatePost(e,t)}));this.factory=new Uy,this.https=new jy(e),this.service=new Gy(e),this.loyaltyHttps=new Nd(e),this.profile=new Wn(e),this.discussionsService=new Hd(e)}},JD=class{constructor(e){o(this,"facade",null);o(this,"issue",(e,t)=>C(this,null,function*(){return yield this.facade.issue(e,t)}));o(this,"update",(e,t)=>C(this,null,function*(){return yield this.facade.update(e,t)}));o(this,"updateTemplate",(e,t,r)=>C(this,null,function*(){return yield this.facade.updateTemplate(e,t,r)}));o(this,"delete",e=>C(this,null,function*(){return yield this.facade.delete(e)}));o(this,"getById",(e,t)=>C(this,null,function*(){return yield this.facade.getById(e,t)}));o(this,"getMyChallenges",e=>C(this,null,function*(){return yield this.facade.getMyChallenges(e)}));o(this,"accept",e=>C(this,null,function*(){return yield this.facade.accept(e)}));o(this,"reject",e=>C(this,null,function*(){return yield this.facade.reject(e)}));o(this,"leave",e=>C(this,null,function*(){return yield this.facade.leave(e)}));o(this,"getMyChallengesStandings",e=>C(this,null,function*(){return yield this.facade.getMyChallengesStandings(e)}));o(this,"getInvitations",e=>C(this,null,function*(){return yield this.facade.getInvitations(e)}));o(this,"getReportedPosts",(e,t)=>C(this,null,function*(){return yield this.facade.getReportedPosts(e,t)}));o(this,"getPredictions",(e,t)=>C(this,null,function*(){return yield this.facade.getPredictions(e,t)}));o(this,"moderatePost",(e,t)=>C(this,null,function*(){return yield this.facade.moderatePost(e,t)}));this.facade=new QD(e)}},XD=class{constructor(){o(this,"KEY_PREFIX","fu-progress-");o(this,"get",(e,t)=>{let r=localStorage.getItem(`${this.KEY_PREFIX}${e}-${t}`);return r&&JSON.parse(r)});o(this,"set",(e,t,r)=>(localStorage.setItem(`${this.KEY_PREFIX}${e}-${t}`,JSON.stringify(r)),JSON.stringify(r)));o(this,"delete",(e,t)=>{localStorage.removeItem(`${this.KEY_PREFIX}${e}-${t}`)})}},ZD=class{constructor(){o(this,"id",null);o(this,"source",null);o(this,"type",null)}},Yy=class{constructor(){o(this,"id",null);o(this,"title",null);o(this,"description",null);o(this,"type",null);o(this,"images",new Ao);o(this,"status",null);o(this,"totalVotes",null);o(this,"flags",[]);o(this,"customFields",null);o(this,"branding",null);o(this,"embedCode",null);o(this,"labels",null);o(this,"adContent",null);o(this,"context",null);o(this,"options",[]);o(this,"createdAt",null);o(this,"updatedAt",null)}},eL=class extends Yy{constructor(){super(...arguments);o(this,"rules",null)}},Ky=class{constructor(){o(this,"id",null);o(this,"pollId",null);o(this,"optionId",null);o(this,"userId",null)}},tL=class extends Ky{constructor(){super(...arguments);o(this,"pollModel",null);o(this,"optionModel",null)}},rL=class{constructor(){o(this,"meta",new di);o(this,"data",[])}},nL=class{constructor(){o(this,"meta",new di);o(this,"data",[])}},iL=class extends Po{constructor(){super(...arguments);o(this,"remapPolls",t=>{let r=new rL;return r.meta.pagination=this.remapMetaPagination(t.meta.pagination),r.data=t.data.map(n=>this.remapPoll(n)),r});o(this,"remapPollById",t=>{let r=new eL;return r.id=t.id,r.title=t.title,r.description=t.description,r.type=t.type,r.images=t.images,r.status=t.status,r.flags=t.flags,r.totalVotes=t.total_votes,r.customFields=t.custom_fields,r.branding=t.branding?this.remapBranding(t.branding):null,r.embedCode=t.embed_code,r.labels=t.labels,r.rules=t.rules,r.adContent=t.ad_content,r.options=t.options,r.context=t.context?this.remapContext(t.context):t.context,r.createdAt=t.created_at,r.updatedAt=t.updated_at,r});o(this,"remapUserVote",t=>{let r=new Ky;return r.id=t.id,r.pollId=t.poll_id,r.optionId=t.option_id,r.userId=t.user_id,r});o(this,"remapPollsVotes",t=>{let r=new nL;return r.meta.pagination=this.remapMetaPagination(t.meta.pagination),r.data=t.data.map(n=>this.remapPollVote(n)),r});o(this,"remapPollVote",t=>{let r=new tL;return r.id=t.id,r.pollId=t.poll_id,r.optionId=t.option_id,r.userId=t.user_id,r});o(this,"remapMetaPagination",t=>{let r=new rl;return r.itemsPerPage=t.items_per_page,r.nextPageStartsAfter=t.next_page_starts_after,r});o(this,"remapPoll",t=>{let r=new Yy;return r.id=t.id,r.title=t.title,r.description=t.description,r.type=t.type,r.images=t.images,r.status=t.status,r.flags=t.flags,r.totalVotes=t.total_votes,r.customFields=t.custom_fields,r.branding=t.branding?this.remapBranding(t.branding):null,r.embedCode=t.embed_code,r.labels=t.labels,r.adContent=t.ad_content,r.options=t.options,r.context=t.context?this.remapContext(t.context):t.context,r.createdAt=t.created_at,r.updatedAt=t.updated_at,r});o(this,"remapContext",t=>{let r=new Pd;return r.content=t.content,r.tags=t.tags?t.tags.map(n=>{let i=new ZD;return i.id=n.id,i.type=n.type,i.source=n.source,i}):null,r.campaign=t.campaign,r})}},aL=class extends qr{constructor(t){super(t,Rr(t.environment,"voting"));o(this,"pollRemapper",null);o(this,"getPolls",(t,r)=>C(this,null,function*(){let n=`/polls${this.apiSignInUrl}`;t&&(n+=t.constructMainFiltersUrl()),ut(r)&&(n+=Ze());let i="There was a problem fetching polls",a=yield this.fetchWithoutAuth(n,i);return this.pollRemapper.remapPolls(a)}));o(this,"getPollById",(t,r)=>C(this,null,function*(){let n=`/polls/${t}${this.apiSignInUrl}`;ut(r)&&(n+=Ze());let i="There was a problem fetching the following poll: "+t,a=yield this.fetchWithoutAuth(n,i);return this.pollRemapper.remapPollById(a.data)}));o(this,"voteForPoll",(t,r)=>C(this,null,function*(){let n=`/polls/${t}/votes${this.apiSignInUrl}`,i="PUT",a={option_id:r},s="There was a problem voting for the following poll: "+t,l=yield this.fetchWithAuth(n,s,i,a);return this.pollRemapper.remapUserVote(l.data)}));o(this,"deleteVoteForPoll",t=>C(this,null,function*(){let r=`/polls/${t}/votes${this.apiSignInUrl}`,n="DELETE",i="There was a problem deleting vote for the following poll: "+t;return yield this.fetchWithAuth(r,i,n),!0}));o(this,"getMyPollVote",t=>C(this,null,function*(){let r=`/polls/${t}/votes${this.apiSignInUrl}`,n="There was a problem fetching user's own vote for the following poll: "+t,i=yield this.fetchWithAuth(r,n);return this.pollRemapper.remapPollVote(i.data)}));o(this,"getMyPollsVotes",t=>C(this,null,function*(){let r=`/polls/votes${this.apiSignInUrl}`;t&&(r+=t.constructMainFiltersUrl());let n="There was a problem fetching user's votes for polls",i=yield this.fetchWithAuth(r,n);return this.pollRemapper.remapPollsVotes(i)}));this.pollRemapper=new iL}},Ud=class extends Yr{constructor(t){super(t);o(this,"flags",null);o(this,"status",null);o(this,"entityIds",null);o(this,"entityType",null);o(this,"pollIds",null);o(this,"sortOrder",null);o(this,"minVotes",null);this.flags=(t==null?void 0:t.flags)||null,this.status=(t==null?void 0:t.status)||null,this.entityIds=(t==null?void 0:t.entityIds)||null,this.entityType=(t==null?void 0:t.entityType)||null,this.pollIds=(t==null?void 0:t.pollIds)||null,this.sortOrder=(t==null?void 0:t.sortOrder)||null,this.minVotes=t&&t.minVotes!==void 0?t.minVotes:null}constructMainFiltersUrl(){let t=super.constructMainFiltersUrl();return this.flags&&this.flags.length>0&&(t+=`&flags=${this.flags.join(",")}`),this.status&&(t+=`&status=${this.status}`),this.entityIds&&this.entityIds.length>0&&(t+=`&entity_ids=${this.entityIds.join(",")}`),this.pollIds&&this.pollIds.length>0&&(t+=`&poll_ids=${this.pollIds.join(",")}`),this.sortOrder&&(t+=`&sort_order=${this.sortOrder}`),this.minVotes&&(t+=`&min_votes=${this.minVotes}`),t}},oL=class{constructor(e){o(this,"idMappingService",null);o(this,"idSchema",null);o(this,"errorHandlingMode",null);o(this,"validator",null);o(this,"activityService",null);o(this,"finalizePollsFilters",e=>C(this,null,function*(){if(this.idSchema!=="native"&&e.entityIds&&e.entityIds.length>0){this.validator.validateFilters(e);let t=yield this.idMappingService.getEntityIdsBySchemaId(Array.from(e.entityIds),e.entityType,"native");e.entityIds=t[e.entityType]}}));o(this,"remapTags",(e,t,r)=>C(this,null,function*(){if(this.idSchema!="native"&&e.context&&e.context.tags&&e.context.tags.length){let n=JSON.parse(JSON.stringify(e.context.tags)),i=yield this.activityService.remapTagsIds(n,t,r);e.context.tags=i}}));this.idSchema=e.idSchema,this.errorHandlingMode=e.errorHandlingMode,this.idMappingService=new dr(e),this.validator=new Bd(e),this.activityService=new vl(e)}},sL=class{constructor(e){o(this,"https",null);o(this,"service",null);o(this,"idSchema",null);o(this,"getPolls",(e,t)=>C(this,null,function*(){e&&(e=new Ud(e),yield this.service.finalizePollsFilters(e));let r=yield this.https.getPolls(e,t);for(let n of r.data)yield this.service.remapTags(n,"native",this.idSchema);return r}));o(this,"getPollById",(e,t)=>C(this,null,function*(){let r=yield this.https.getPollById(e,t);return yield this.service.remapTags(r,"native",this.idSchema),r}));o(this,"voteForPoll",(e,t)=>C(this,null,function*(){return yield this.https.voteForPoll(e,t)}));o(this,"deleteVoteForPoll",e=>C(this,null,function*(){return yield this.https.deleteVoteForPoll(e)}));o(this,"getMyPollVote",(e,t)=>C(this,null,function*(){var n;let r=yield this.https.getMyPollVote(e);if(t){let i=yield this.getPolls(new Ud({pollIds:[e]}),!0);r.pollModel=i.data.find(a=>a.id===e)||null,r.optionModel=((n=i.data.find(a=>a.id===e))==null?void 0:n.options.find(a=>a.id===r.optionId))||null}return r}));o(this,"getMyPollsVotes",e=>C(this,null,function*(){e&&(e=new Yr(e));let t=yield this.https.getMyPollsVotes(e),r=t.data.map(i=>i.id),n=yield this.getPolls(new Ud({pollIds:r}),!0);return t.data=t.data.map(i=>{var a;return i.pollModel=n.data.find(s=>s.id===i.pollId)||null,i.optionModel=((a=i.pollModel)==null?void 0:a.options.find(s=>s.id===i.optionId))||null,i}),t}));this.idSchema=e.idSchema,this.https=new aL(e),this.service=new oL(e)}},lL=class{constructor(e){o(this,"facade",null);o(this,"getPolls",(e,t)=>C(this,null,function*(){return yield this.facade.getPolls(e,t)}));o(this,"getPollById",(e,t)=>C(this,null,function*(){return yield this.facade.getPollById(e,t)}));o(this,"voteForPoll",(e,t)=>C(this,null,function*(){return yield this.facade.voteForPoll(e,t)}));o(this,"deleteVoteForPoll",e=>C(this,null,function*(){return yield this.facade.deleteVoteForPoll(e)}));o(this,"getMyPollVote",(e,t)=>C(this,null,function*(){return yield this.facade.getMyPollVote(e,t)}));o(this,"getMyPollsVotes",e=>C(this,null,function*(){return yield this.facade.getMyPollsVotes(e)}));this.facade=new sL(e)}},cL=class{constructor(){o(this,"key",null);o(this,"label",null);o(this,"value",null)}},uL=["minutesPlayed","cleanSheets","concededGoals","saves","penaltySaved","penaltyCommitted","yellowCards","redCards","assists","foulsCommitted","ownGoals","goals","tackles","shotsOn"],dL=new Map().set("minutesPlayed","Minutes Played").set("cleanSheets","Clean Sheets").set("concededGoals","Goals Conceded").set("saves","Saves").set("penaltySaved","Penalties Saved").set("penaltyCommitted","Penalties Committed").set("yellowCards","Yellow Cards").set("redCards","Red Cards").set("assists","Assists").set("foulsCommitted","Fouls Committed").set("ownGoals","Own Goals").set("goals","Goals").set("tackles","Tackles").set("shotsOn","Shots On Target"),Vd=class{static createFantasyPrediction(e,t,r){let n=new hy;return n.template_id=e||null,n.group_id=t||null,n.fixtures=(r==null?void 0:r.map(i=>({player_id:i,match_type:"FOOTBALL",market:"PLAYER_PERFORMANCE"})))||[],n}static createFantasyPlayerStats(e){return uL.map(t=>{let r=new cL,n=e.data.reduce((i,a)=>i+a.stats[t],0);return r.key=t,r.label=dL.get(t),r.value=n,r})}},fL=class{constructor(e){o(this,"idMapping",null);o(this,"idSchema",null);o(this,"errorHandlingModel",null);o(this,"football",null);o(this,"remapCompetitions",e=>C(this,null,function*(){let t={competition:e};return(yield this.idMapping.idMappingFacade.getEntitiesByIds(t,"native",this.idSchema)).competition}));o(this,"remapPlayers",(e,t,r)=>C(this,null,function*(){let n={player:Array.from(e)};return(yield this.idMapping.idMappingFacade.getEntitiesByIds(n,t,r)).player}));o(this,"addPlayerModels",e=>C(this,null,function*(){let t=e.map(n=>n.playerId),r=yield this.football.footballFacade.getPlayersMapWithNativeIds(t);return e.forEach(n=>{var i;n.playerModel=Object.keys(r).length&&r[n.playerId]||null,n.playerId=((i=n.playerModel)==null?void 0:i.id)||n.playerId}),e}));o(this,"remapPlayerIdToNative",e=>C(this,null,function*(){let t=yield this.idMapping.getEntityIdBySchemaId("player",e);if(t)return t.id;this.throwException(404,"id_mapping_not_found","No ID mappings are available for the provided ID. ID argument: "+e)}));o(this,"addMatchModels",e=>C(this,null,function*(){let t=e.map(n=>n.matchId),r=yield this.football.footballFacade.getMatchesMapWithNativeIds(t);return e.forEach(n=>{var i;n.matchModel=Object.keys(r).length&&r[n.matchId]||null,n.matchId=((i=n.matchModel)==null?void 0:i.id)||n.matchId}),e}));o(this,"throwException",(e,t,r)=>{throw this.errorHandlingModel==="standard"?new et(e,t,r):new mt(e,t,r)});this.idSchema=e.idSchema,this.errorHandlingModel=e.errorHandlingMode,this.football=new To(e),this.idMapping=new dr(e)}},hL=class{constructor(e){o(this,"idSchema",null);o(this,"clientHttps",null);o(this,"footballHttps",null);o(this,"predictorHttps",null);o(this,"idMappingService",null);o(this,"service",null);o(this,"getConfig",()=>C(this,null,function*(){let e=yield this.clientHttps.getConfig("fantasy");return this.idSchema!=="native"&&(e.competitionsWhitelist=yield this.service.remapCompetitions([...e.competitionsWhitelist])),e}));o(this,"getPlayersPoints",(e,t,r)=>C(this,null,function*(){let n=yield this.footballHttps.getPlayersPoints(e,t,r);return n.data=yield this.service.addPlayerModels(n.data),n}));o(this,"getPlayerDetailedStatistics",(e,t,r)=>C(this,null,function*(){let n="";this.idSchema!=="native"&&(n=yield this.service.remapPlayerIdToNative(t));let i=yield this.footballHttps.getPlayerDetailedStatistics(e,n||t,r);return i.meta.filters.playerId=t,i.data=yield this.service.addMatchModels(i.data),i}));o(this,"play",(e,t,r)=>C(this,null,function*(){(!r||!Array.isArray(r))&&this.service.throwException(400,"invalid_method_call","Invalid parameter provided. Please check the following parameter: playerIds");let n=null;if(this.idSchema!=="native"){let i=yield this.service.remapPlayers(r,this.idSchema,"native");n=Vd.createFantasyPrediction(e,t,i)}else n=Vd.createFantasyPrediction(e,t,r);return yield this.predictorHttps.makeFootballPrediction(n)}));o(this,"getMyPrediction",(e,t)=>C(this,null,function*(){let r=`${e}_${t}`,n=new Gr(null);n.gameIds=[r];let i=yield this.predictorHttps.getMyPredictions(n);return i.data.length===0?null:i.data[0]}));o(this,"getPlayerStatistics",(e,t,r)=>C(this,null,function*(){let n=yield this.getPlayerDetailedStatistics(e,t,r);return Vd.createFantasyPlayerStats(n)}));this.idSchema=e.idSchema,this.clientHttps=new hi(e),this.footballHttps=new So(e),this.service=new fL(e),this.idMappingService=new dr(e),this.predictorHttps=new ko(e,this.idMappingService)}},pL=class{constructor(e){o(this,"facade",null);o(this,"getConfig",()=>C(this,null,function*(){return yield this.facade.getConfig()}));o(this,"getPlayersPoints",(e,t,r)=>C(this,null,function*(){return yield this.facade.getPlayersPoints(e,t,r)}));o(this,"getPlayerDetailedStatistics",(e,t,r)=>C(this,null,function*(){return yield this.facade.getPlayerDetailedStatistics(e,t,r)}));o(this,"play",(e,t,r)=>C(this,null,function*(){return yield this.facade.play(e,t,r)}));o(this,"getMyPrediction",(e,t)=>C(this,null,function*(){return yield this.facade.getMyPrediction(e,t)}));o(this,"getPlayerStatistics",(e,t,r)=>C(this,null,function*(){return yield this.facade.getPlayerStatistics(e,t,r)}));this.facade=new hL(e)}},bl=null,Wd=null;function mL(e){if(gL(e)){let t=vL(e);if(t.isValid)return bl={profile:new Wn(e),football:new To(e),predictor:new vy(e),loyalty:new Dy(e),topX:new My(e),matchQuiz:new _y(e),activity:new gD(e),miniGames:new ky(e),discussions:new DD(e),privateLeagues:new GD(e),challenges:new JD(e),progress:new XD,voting:new lL(e),fantasy:new pL(e)},Wd=he({},e),bl;yL(t)}return bl}var gL=e=>!bl||JSON.stringify(e)!==JSON.stringify(Wd)||e.authProvider.getIdToken()!==Wd.authProvider.getIdToken(),vL=e=>{let t=new kR().validate(e);return(t.idSchema.validation==="missing"||t.idSchema.validation==="invalid")&&(console.warn(t.idSchema.message.text),e.idSchema="native"),(t.environment.validation==="missing"||t.environment.validation==="invalid")&&(console.warn(t.environment.message.text),e.environment="prod"),(t.lang.validation==="missing"||t.lang.validation==="invalid")&&(console.warn(t.lang.message.text),e.lang="en"),(t.errorHandlingMode.validation==="missing"||t.errorHandlingMode.validation==="invalid")&&(console.warn(t.errorHandlingMode.message.text),e.errorHandlingMode="default"),t.authProvider.validation==="invalid"&&console.warn(t.authProvider.message.text),t},yL=e=>{let t="authProvider",r="isValid";Object.keys(e).forEach(n=>{let i=e[n];if(n!==r&&n!==t){if(i.message.type==="error")throw new Error(i.message.text)}else n!==r&&n===t&&Object.keys(new kd).forEach(a=>{if(i[a].message.type==="error")throw new Error(i[a].message.text)})})};const bL=(e,t)=>!e&&!t?null:!e&&t?(console.warn("'sportal365Project' prop is not provided. The prop is required when 'sportal365Infrastructure' prop is provided. Functionalities with Sportal365 API will not be exposed"),null):{project:e,authorization:`Bearer ${t&&t==="betway"?"24PkUfW1ce63mH9jvAAug2QQzdASj9k5smngepPUZD2KUq5cbTFGE98KgZ0zg2wCtuQcoJrHElW7Dr0K":"dEZS1V21veHBIDIik8Y33dDkZAoCmxgge5MBnAORN7IKbltA79giTZLaXJ6OVgQkGnYxwtyRv8ObRSvY"}`},qd=Z.createContext(null),wL=({config:e,children:t})=>{const r={apiKey:e.apiKey,clientId:e.clientId,environment:e.environment,lang:e.language,errorHandlingMode:e.errorHandlingMode,authProvider:{getIdToken:()=>"",logout:()=>{}}},n=bL(e.sportal365Project,e.sportal365Infrastructure),i=mL(r),a=new nP(r,n);return I.jsx(qd.Provider,{value:{sdk:i,https:a},children:t})},Qy=Z.createContext(null),_L=({children:e,environment:t})=>{const[r,n]=Z.useState(null),[i,a]=Z.useState(!0);return Z.useEffect(()=>bo(t).onAuthStateChanged(l=>{Xe.unstable_batchedUpdates(()=>{a(!1),n(l)})}),[t]),I.jsx(Qy.Provider,{value:r,children:!i&&e})};function L(){return L=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},L.apply(null,arguments)}const xL=Object.freeze(Object.defineProperty({__proto__:null,get default(){return L}},Symbol.toStringTag,{value:"Module"}));function Se(e,t){if(e==null)return{};var r={};for(var n in e)if({}.hasOwnProperty.call(e,n)){if(t.includes(n))continue;r[n]=e[n]}return r}var Jy={exports:{}},CL="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED",IL=CL,SL=IL;function Xy(){}function Zy(){}Zy.resetWarningCache=Xy;var TL=function(){function e(n,i,a,s,l,c){if(c!==SL){var u=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw u.name="Invariant Violation",u}}e.isRequired=e;function t(){return e}var r={array:e,bigint:e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:t,element:e,elementType:e,instanceOf:t,node:e,objectOf:t,oneOf:t,oneOfType:t,shape:t,exact:t,checkPropTypes:Zy,resetWarningCache:Xy};return r.PropTypes=r,r};Jy.exports=TL();var EL=Jy.exports;function eb(e){return typeof e=="string"}function tb(e,t,r){return e===void 0||eb(e)?t:L({},t,{ownerState:L({},t.ownerState,r)})}function Gd(e,t,r=(n,i)=>n===i){return e.length===t.length&&e.every((n,i)=>r(n,t[i]))}const AL={disableDefaultClasses:!1},OL=z.createContext(AL);function PL(e){const{disableDefaultClasses:t}=z.useContext(OL);return r=>t?"":e(r)}function Nt(e,t=[]){if(e===void 0)return{};const r={};return Object.keys(e).filter(n=>n.match(/^on[A-Z]/)&&typeof e[n]=="function"&&!t.includes(n)).forEach(n=>{r[n]=e[n]}),r}function rb(e,t,r){return typeof e=="function"?e(t,r):e}function kL(e){const{rootElementName:t="",componentName:r}=e,[n,i]=z.useState(t.toUpperCase()),a=z.useCallback(s=>{var l;i((l=s==null?void 0:s.tagName)!=null?l:"")},[]);return[n,a]}function On(e){if(typeof e!="object"||e===null)return!1;const t=Object.getPrototypeOf(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)}function nb(e){if(!On(e))return e;const t={};return Object.keys(e).forEach(r=>{t[r]=nb(e[r])}),t}function Bt(e,t,r={clone:!0}){const n=r.clone?L({},e):e;return On(e)&&On(t)&&Object.keys(t).forEach(i=>{On(t[i])&&Object.prototype.hasOwnProperty.call(e,i)&&On(e[i])?n[i]=Bt(e[i],t[i],r):r.clone?n[i]=On(t[i])?nb(t[i]):t[i]:n[i]=t[i]}),n}const RL=Object.freeze(Object.defineProperty({__proto__:null,default:Bt,isPlainObject:On},Symbol.toStringTag,{value:"Module"}));function Pn(e){let t="https://mui.com/production-error/?code="+e;for(let r=1;r<arguments.length;r+=1)t+="&args[]="+encodeURIComponent(arguments[r]);return"Minified MUI error #"+e+"; visit "+t+" for the full message."}const ML=Object.freeze(Object.defineProperty({__proto__:null,default:Pn},Symbol.toStringTag,{value:"Module"}));var ib={exports:{}},ot={};/**
|
|
2328
2328
|
* @license React
|