@everymatrix/player-account-balance-modal 1.72.2 → 1.73.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.
@@ -4575,14 +4575,11 @@ function Cn(e) {
4575
4575
  )
4576
4576
  ) : "") + ""
4577
4577
  ), s, c, l, f, g = (
4578
- /*b*/
4579
- (e[51].amount ? (
4580
- /*formatBalance*/
4581
- e[5](
4582
- /*b*/
4583
- e[51].amount
4584
- )
4585
- ) : "0") + ""
4578
+ /*formatBalance*/
4579
+ e[5](
4580
+ /*b*/
4581
+ e[51].amount
4582
+ ) + ""
4586
4583
  ), b;
4587
4584
  return {
4588
4585
  c() {
@@ -4606,14 +4603,11 @@ function Cn(e) {
4606
4603
  x[51].productType
4607
4604
  )
4608
4605
  ) : "") + "") && Oe(s, u), _[0] & /*balances*/
4609
- 8 && g !== (g = /*b*/
4610
- (x[51].amount ? (
4611
- /*formatBalance*/
4612
- x[5](
4613
- /*b*/
4614
- x[51].amount
4615
- )
4616
- ) : "0") + "") && Oe(b, g);
4606
+ 8 && g !== (g = /*formatBalance*/
4607
+ x[5](
4608
+ /*b*/
4609
+ x[51].amount
4610
+ ) + "") && Oe(b, g);
4617
4611
  },
4618
4612
  d(x) {
4619
4613
  x && le(t);
@@ -4644,7 +4638,7 @@ function Hn(e) {
4644
4638
  M(t, n);
4645
4639
  },
4646
4640
  p(o, u) {
4647
- if (u[0] & /*balances, formatBalance, $_*/
4641
+ if (u[0] & /*formatBalance, balances, $_*/
4648
4642
  56) {
4649
4643
  r = mt(
4650
4644
  /*balances*/
@@ -6,4 +6,4 @@ Try polyfilling it using "@formatjs/intl-pluralrules"
6
6
  * https://github.com/Yaffle/EventSource/
7
7
  */(function(e,t){(function(n){var r=n.setTimeout,i=n.clearTimeout,o=n.XMLHttpRequest,u=n.XDomainRequest,s=n.ActiveXObject,c=n.EventSource,l=n.document,f=n.Promise,g=n.fetch,b=n.Response,x=n.TextDecoder,_=n.TextEncoder,P=n.AbortController;if(typeof window!="undefined"&&typeof l!="undefined"&&!("readyState"in l)&&l.body==null&&(l.readyState="loading",window.addEventListener("load",function(a){l.readyState="complete"},!1)),o==null&&s!=null&&(o=function(){return new s("Microsoft.XMLHTTP")}),Object.create==null&&(Object.create=function(a){function h(){}return h.prototype=a,new h}),Date.now||(Date.now=function(){return new Date().getTime()}),P==null){var k=g;g=function(a,h){var m=h.signal;return k(a,{headers:h.headers,credentials:h.credentials,cache:h.cache}).then(function(d){var p=d.body.getReader();return m._reader=p,m._aborted&&m._reader.cancel(),{status:d.status,statusText:d.statusText,headers:d.headers,body:{getReader:function(){return p}}}})},P=function(){this.signal={_reader:null,_aborted:!1},this.abort=function(){this.signal._reader!=null&&this.signal._reader.cancel(),this.signal._aborted=!0}}}function W(){this.bitsNeeded=0,this.codePoint=0}W.prototype.decode=function(a){function h(H,I,S){if(S===1)return H>=128>>I&&H<<I<=2047;if(S===2)return H>=2048>>I&&H<<I<=55295||H>=57344>>I&&H<<I<=65535;if(S===3)return H>=65536>>I&&H<<I<=1114111;throw new Error}function m(H,I){if(H===6*1)return I>>6>15?3:I>31?2:1;if(H===6*2)return I>15?3:2;if(H===6*3)return 3;throw new Error}for(var d=65533,p="",v=this.bitsNeeded,T=this.codePoint,N=0;N<a.length;N+=1){var C=a[N];v!==0&&(C<128||C>191||!h(T<<6|C&63,v-6,m(v,T)))&&(v=0,T=d,p+=String.fromCharCode(T)),v===0?(C>=0&&C<=127?(v=0,T=C):C>=192&&C<=223?(v=6*1,T=C&31):C>=224&&C<=239?(v=6*2,T=C&15):C>=240&&C<=247?(v=6*3,T=C&7):(v=0,T=d),v!==0&&!h(T,v,m(v,T))&&(v=0,T=d)):(v-=6,T=T<<6|C&63),v===0&&(T<=65535?p+=String.fromCharCode(T):(p+=String.fromCharCode(55296+(T-65535-1>>10)),p+=String.fromCharCode(56320+(T-65535-1&1023))))}return this.bitsNeeded=v,this.codePoint=T,p};var $=function(){try{return new x().decode(new _().encode("test"),{stream:!0})==="test"}catch(a){console.debug("TextDecoder does not support streaming option. Using polyfill instead: "+a)}return!1};(x==null||_==null||!$())&&(x=W);var B=function(){};function w(a){this.withCredentials=!1,this.readyState=0,this.status=0,this.statusText="",this.responseText="",this.onprogress=B,this.onload=B,this.onerror=B,this.onreadystatechange=B,this._contentType="",this._xhr=a,this._sendTimeout=0,this._abort=B}w.prototype.open=function(a,h){this._abort(!0);var m=this,d=this._xhr,p=1,v=0;this._abort=function(S){m._sendTimeout!==0&&(i(m._sendTimeout),m._sendTimeout=0),(p===1||p===2||p===3)&&(p=4,d.onload=B,d.onerror=B,d.onabort=B,d.onprogress=B,d.onreadystatechange=B,d.abort(),v!==0&&(i(v),v=0),S||(m.readyState=4,m.onabort(null),m.onreadystatechange())),p=0};var T=function(){if(p===1){var S=0,U="",be=void 0;if("contentType"in d)S=200,U="OK",be=d.contentType;else try{S=d.status,U=d.statusText,be=d.getResponseHeader("Content-Type")}catch(Ye){S=0,U="",be=void 0}S!==0&&(p=2,m.readyState=2,m.status=S,m.statusText=U,m._contentType=be,m.onreadystatechange())}},N=function(){if(T(),p===2||p===3){p=3;var S="";try{S=d.responseText}catch(U){}m.readyState=3,m.responseText=S,m.onprogress()}},C=function(S,U){if((U==null||U.preventDefault==null)&&(U={preventDefault:B}),N(),p===1||p===2||p===3){if(p=4,v!==0&&(i(v),v=0),m.readyState=4,S==="load")m.onload(U);else if(S==="error")m.onerror(U);else if(S==="abort")m.onabort(U);else throw new TypeError;m.onreadystatechange()}},H=function(S){d!=null&&(d.readyState===4?(!("onload"in d)||!("onerror"in d)||!("onabort"in d))&&C(d.responseText===""?"error":"load",S):d.readyState===3?"onprogress"in d||N():d.readyState===2&&T())},I=function(){v=r(function(){I()},500),d.readyState===3&&N()};"onload"in d&&(d.onload=function(S){C("load",S)}),"onerror"in d&&(d.onerror=function(S){C("error",S)}),"onabort"in d&&(d.onabort=function(S){C("abort",S)}),"onprogress"in d&&(d.onprogress=N),"onreadystatechange"in d&&(d.onreadystatechange=function(S){H(S)}),("contentType"in d||!("ontimeout"in o.prototype))&&(h+=(h.indexOf("?")===-1?"?":"&")+"padding=true"),d.open(a,h,!0),"readyState"in d&&(v=r(function(){I()},0))},w.prototype.abort=function(){this._abort(!1)},w.prototype.getResponseHeader=function(a){return this._contentType},w.prototype.setRequestHeader=function(a,h){var m=this._xhr;"setRequestHeader"in m&&m.setRequestHeader(a,h)},w.prototype.getAllResponseHeaders=function(){return this._xhr.getAllResponseHeaders!=null&&this._xhr.getAllResponseHeaders()||""},w.prototype.send=function(){if((!("ontimeout"in o.prototype)||!("sendAsBinary"in o.prototype)&&!("mozAnon"in o.prototype))&&l!=null&&l.readyState!=null&&l.readyState!=="complete"){var a=this;a._sendTimeout=r(function(){a._sendTimeout=0,a.send()},4);return}var h=this._xhr;"withCredentials"in h&&(h.withCredentials=this.withCredentials);try{h.send(void 0)}catch(m){throw m}};function D(a){return a.replace(/[A-Z]/g,function(h){return String.fromCharCode(h.charCodeAt(0)+32)})}function R(a){for(var h=Object.create(null),m=a.split(`\r
8
8
  `),d=0;d<m.length;d+=1){var p=m[d],v=p.split(": "),T=v.shift(),N=v.join(": ");h[D(T)]=N}this._map=h}R.prototype.get=function(a){return this._map[D(a)]},o!=null&&o.HEADERS_RECEIVED==null&&(o.HEADERS_RECEIVED=2);function ee(){}ee.prototype.open=function(a,h,m,d,p,v,T){a.open("GET",p);var N=0;a.onprogress=function(){var H=a.responseText,I=H.slice(N);N+=I.length,m(I)},a.onerror=function(H){H.preventDefault(),d(new Error("NetworkError"))},a.onload=function(){d(null)},a.onabort=function(){d(null)},a.onreadystatechange=function(){if(a.readyState===o.HEADERS_RECEIVED){var H=a.status,I=a.statusText,S=a.getResponseHeader("Content-Type"),U=a.getAllResponseHeaders();h(H,I,S,new R(U))}},a.withCredentials=v;for(var C in T)Object.prototype.hasOwnProperty.call(T,C)&&a.setRequestHeader(C,T[C]);return a.send(),a};function pe(a){this._headers=a}pe.prototype.get=function(a){return this._headers.get(a)};function me(){}me.prototype.open=function(a,h,m,d,p,v,T){var N=null,C=new P,H=C.signal,I=new x;return g(p,{headers:T,credentials:v?"include":"same-origin",signal:H,cache:"no-store"}).then(function(S){return N=S.body.getReader(),h(S.status,S.statusText,S.headers.get("Content-Type"),new pe(S.headers)),new f(function(U,be){var Ye=function(){N.read().then(function(re){if(re.done)U(void 0);else{var Q=I.decode(re.value,{stream:!0});m(Q),Ye()}}).catch(function(re){be(re)})};Ye()})}).catch(function(S){if(S.name!=="AbortError")return S}).then(function(S){d(S)}),{abort:function(){N!=null&&N.cancel(),C.abort()}}};function te(){this._listeners=Object.create(null)}function Te(a){r(function(){throw a},0)}te.prototype.dispatchEvent=function(a){a.target=this;var h=this._listeners[a.type];if(h!=null)for(var m=h.length,d=0;d<m;d+=1){var p=h[d];try{typeof p.handleEvent=="function"?p.handleEvent(a):p.call(this,a)}catch(v){Te(v)}}},te.prototype.addEventListener=function(a,h){a=String(a);var m=this._listeners,d=m[a];d==null&&(d=[],m[a]=d);for(var p=!1,v=0;v<d.length;v+=1)d[v]===h&&(p=!0);p||d.push(h)},te.prototype.removeEventListener=function(a,h){a=String(a);var m=this._listeners,d=m[a];if(d!=null){for(var p=[],v=0;v<d.length;v+=1)d[v]!==h&&p.push(d[v]);p.length===0?delete m[a]:m[a]=p}};function E(a){this.type=a,this.target=void 0}function Be(a,h){E.call(this,a),this.data=h.data,this.lastEventId=h.lastEventId}Be.prototype=Object.create(E.prototype);function Ze(a,h){E.call(this,a),this.status=h.status,this.statusText=h.statusText,this.headers=h.headers}Ze.prototype=Object.create(E.prototype);function at(a,h){E.call(this,a),this.error=h.error}at.prototype=Object.create(E.prototype);var qe=-1,he=0,Se=1,ge=2,Re=-1,ce=0,Ce=1,Qe=2,Bt=3,st=/^text\/event\-stream(;.*)?$/i,St=1e3,wt=18e6,Ne=function(a,h){var m=a==null?h:parseInt(a,10);return m!==m&&(m=h),Je(m)},Je=function(a){return Math.min(Math.max(a,St),wt)},we=function(a,h,m){try{typeof h=="function"&&h.call(a,m)}catch(d){Te(d)}};function ne(a,h){te.call(this),h=h||{},this.onopen=void 0,this.onmessage=void 0,this.onerror=void 0,this.url=void 0,this.readyState=void 0,this.withCredentials=void 0,this.headers=void 0,this._close=void 0,y(this,a,h)}function At(){return o!=null&&"withCredentials"in o.prototype||u==null?new o:new u}var Ct=g!=null&&b!=null&&"body"in b.prototype;function y(a,h,m){h=String(h);var d=!!m.withCredentials,p=m.lastEventIdQueryParameterName||"lastEventId",v=Je(1e3),T=Ne(m.heartbeatTimeout,45e3),N="",C=v,H=!1,I=0,S=m.headers||{},U=m.Transport,be=Ct&&U==null?void 0:new w(U!=null?new U:At()),Ye=U!=null&&typeof U!="string"?new U:be==null?new me:new ee,re=void 0,Q=0,ue=qe,Me="",ut="",ye="",lt="",J=ce,Ht=0,He=0,sr=function(X,V,ie,oe){if(ue===he)if(X===200&&ie!=null&&st.test(ie)){ue=Se,H=Date.now(),C=v,a.readyState=Se;var Y=new Ze("open",{status:X,statusText:V,headers:oe});a.dispatchEvent(Y),we(a,a.onopen,Y)}else{var Z="";X!==200?(V&&(V=V.replace(/\s+/g," ")),Z="EventSource's response has a status "+X+" "+V+" that is not 200. Aborting the connection."):Z="EventSource's response has a Content-Type specifying an unsupported type: "+(ie==null?"-":ie.replace(/\s+/g," "))+". Aborting the connection.",Ot();var Y=new Ze("error",{status:X,statusText:V,headers:oe});a.dispatchEvent(Y),we(a,a.onerror,Y),console.error(Z)}},ur=function(X){if(ue===Se){for(var V=-1,ie=0;ie<X.length;ie+=1){var oe=X.charCodeAt(ie);(oe===10||oe===13)&&(V=ie)}var Y=(V!==-1?lt:"")+X.slice(0,V+1);lt=(V===-1?lt:"")+X.slice(V+1),X!==""&&(H=Date.now(),I+=X.length);for(var Z=0;Z<Y.length;Z+=1){var oe=Y.charCodeAt(Z);if(J===Re&&oe===10)J=ce;else if(J===Re&&(J=ce),oe===13||oe===10){if(J!==ce){J===Ce&&(He=Z+1);var ve=Y.slice(Ht,He-1),Ee=Y.slice(He+(He<Z&&Y.charCodeAt(He)===32?1:0),Z);ve==="data"?(Me+=`
9
- `,Me+=Ee):ve==="id"?ut=Ee:ve==="event"?ye=Ee:ve==="retry"?(v=Ne(Ee,v),C=v):ve==="heartbeatTimeout"&&(T=Ne(Ee,T),Q!==0&&(i(Q),Q=r(function(){Ke()},T)))}if(J===ce){if(Me!==""){N=ut,ye===""&&(ye="message");var Pe=new Be(ye,{data:Me.slice(1),lastEventId:ut});if(a.dispatchEvent(Pe),ye==="open"?we(a,a.onopen,Pe):ye==="message"?we(a,a.onmessage,Pe):ye==="error"&&we(a,a.onerror,Pe),ue===ge)return}Me="",ye=""}J=oe===13?Re:ce}else J===ce&&(Ht=Z,J=Ce),J===Ce?oe===58&&(He=Z+1,J=Qe):J===Qe&&(J=Bt)}}},an=function(X){if(ue===Se||ue===he){ue=qe,Q!==0&&(i(Q),Q=0),Q=r(function(){Ke()},C),C=Je(Math.min(v*16,C*2)),a.readyState=he;var V=new at("error",{error:X});a.dispatchEvent(V),we(a,a.onerror,V),X!=null&&console.error(X)}},Ot=function(){ue=ge,re!=null&&(re.abort(),re=void 0),Q!==0&&(i(Q),Q=0),a.readyState=ge},Ke=function(){if(Q=0,ue!==qe){if(!H&&re!=null)an(new Error("No activity within "+T+" milliseconds. "+(ue===he?"No response received.":I+" chars received.")+" Reconnecting.")),re!=null&&(re.abort(),re=void 0);else{var X=Math.max((H||Date.now())+T-Date.now(),1);H=!1,Q=r(function(){Ke()},X)}return}H=!1,I=0,Q=r(function(){Ke()},T),ue=he,Me="",ye="",ut=N,lt="",Ht=0,He=0,J=ce;var V=h;if(h.slice(0,5)!=="data:"&&h.slice(0,5)!=="blob:"&&N!==""){var ie=h.indexOf("?");V=ie===-1?h:h.slice(0,ie+1)+h.slice(ie+1).replace(/(?:^|&)([^=&]*)(?:=[^&]*)?/g,function(Ee,Pe){return Pe===p?"":Ee}),V+=(h.indexOf("?")===-1?"?":"&")+p+"="+encodeURIComponent(N)}var oe=a.withCredentials,Y={};Y.Accept="text/event-stream";var Z=a.headers;if(Z!=null)for(var ve in Z)Object.prototype.hasOwnProperty.call(Z,ve)&&(Y[ve]=Z[ve]);try{re=Ye.open(be,sr,ur,an,V,oe,Y)}catch(Ee){throw Ot(),Ee}};a.url=h,a.readyState=he,a.withCredentials=d,a.headers=S,a._close=Ot,Ke()}ne.prototype=Object.create(te.prototype),ne.prototype.CONNECTING=he,ne.prototype.OPEN=Se,ne.prototype.CLOSED=ge,ne.prototype.close=function(){this._close()},ne.CONNECTING=he,ne.OPEN=Se,ne.CLOSED=ge,ne.prototype.withCredentials=void 0;var A=c;o!=null&&(c==null||!("withCredentials"in c.prototype))&&(A=ne),function(a){{var h=a(t);h!==void 0&&(e.exports=h)}}(function(a){a.EventSourcePolyfill=ne,a.NativeEventSource=c,a.EventSource=A})})(typeof globalThis=="undefined"?typeof window!="undefined"?window:typeof self!="undefined"?self:$r:globalThis)})(tn,tn.exports);var Lo=tn.exports;function Ro(e){gr(e,"svelte-gv6dm2",'*,*::before,*::after{font-family:inherit}:host{font-family:inherit}input,textarea,button{font-family:inherit}p{padding:0;margin:0}.ShowBalance{position:relative}.ShowBalance .Loading{font-size:14px;white-space:nowrap;padding-right:10px}.ShowBalance .BalanceValue{font-size:14px;cursor:pointer;display:flex;flex-wrap:nowrap;white-space:nowrap;background:transparent;border:none;font:inherit;color:inherit}.ShowBalance .BalanceValue svg{width:16px}.ShowBalance .BalanceValue span{padding-left:8px}@media only screen and (max-width: 360px){.ShowBalance .BalanceValue{font-size:12px}.ShowBalance .BalanceValue svg{width:12px}}.BalanceModalWrapper{background-color:var(--emw--color-white, #FFFFFF);position:absolute;top:45px;left:50%;transform:translateX(-60%);padding:10px;box-shadow:0px 30px 30px var(--emw--header-color-primary, var(--emw--color-primary, #22B04E));border-radius:5px;z-index:17;box-shadow:0px 5px 20px 0px #191919}.BalanceModalWrapper:before{content:"";background:var(--emw--color-white, #FFFFFF);clip-path:polygon(50% 0, 0% 100%, 100% 100%);position:absolute;top:-8px;left:60%;width:25px;height:10px;transform:translateX(-50%);z-index:1}.BalanceModalClose{position:absolute;top:5px;right:5px;width:20px;height:20px;z-index:1;cursor:pointer;font:inherit}.BalanceModalClose:before{content:"";background:var(--emw--color-secondary, var(--emw--color-secondary, #FD2839));position:absolute;top:8px;left:0;width:20px;height:2px;transform:rotate(45deg)}.BalanceModalClose:after{content:"";background:var(--emw--color-secondary, var(--emw--color-secondary, #FD2839));position:absolute;top:8px;left:0;width:20px;height:2px;transform:rotate(-45deg)}.BalanceModal{position:relative;width:280px}.BalanceModalHeader{display:flex;align-items:center;justify-content:center;padding:20px 0}.BalanceModalHeader .BalanceModalTitle{font-size:16px;font-weight:bold;color:var(--emw--header-contrast, var(--emw--color-contrast, #07072A))}.BalanceModalRowBoth{display:flex;flex-direction:column;gap:5px;padding:20px 0;border-bottom:1px solid var(--emw--color-gray-100, #E6E6E6)}.BalanceModalRowBoth:last-child{border-bottom:none}.BalanceModalRowBoth .BalanceModalRowLine{display:flex;width:100%;justify-content:space-between}.BalanceModalRowBoth .BalanceModalText{color:var(--emw--header-contrast, var(--emw--color-contrast, #07072A));font-size:14px;text-transform:capitalize}.BalanceModalRowBoth .BalanceModalValue{font-size:14px;font-weight:bold;color:var(--emw--header-contrast, var(--emw--color-contrast, #07072A))}.BalanceModalFooter{display:flex;align-items:center;padding:20px 0 10px}.BalanceModalFooter .BalanceModalAction{background:var(--emw--header-color-primary, var(--emw--color-primary, #22B04E));font-size:12px;color:white;text-transform:uppercase;width:100%;border-radius:5px;border:none;padding:10px 0;cursor:pointer}.BalanceModalFooter .BalanceModalAction:hover,.BalanceModalFooter .BalanceModalActionactive{background:var(--emw--header-contrast, var(--emw--color-background, #07072A))}.ShowBalanceModalOverlay{background-color:rgba(0, 0, 0, 0.7);position:fixed;top:0;bottom:0;left:0;right:0;z-index:16}')}function Sn(e,t,n){const r=e.slice();return r[48]=t[n],r}function wn(e,t,n){const r=e.slice();return r[51]=t[n],r}function No(e){let t,n=(e[3].Total?e[5](e[3].Total[0].amount):"0")+"",r,i,o,u,s,c,l,f=e[2]&&An(e);return{c(){t=j("button"),r=xe(n),i=_e(),o=j("span"),o.innerHTML='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 11.435"><defs><style>.a{fill:var(--emw--color-white, #FFFFFF);}</style></defs><path class="a" d="M16.191,19.235l7.562-7.568a1.423,1.423,0,0,1,2.019,0,1.441,1.441,0,0,1,0,2.025L17.2,22.265a1.427,1.427,0,0,1-1.971.042L6.6,13.7a1.429,1.429,0,0,1,2.019-2.025Z" transform="translate(-6.188 -11.246)"></path></svg>',u=_e(),f&&f.c(),s=vr(),q(t,"class","BalanceValue")},m(g,b){de(g,t,b),M(t,r),M(t,i),M(t,o),de(g,u,b),f&&f.m(g,b),de(g,s,b),c||(l=pt(t,"click",e[23]),c=!0)},p(g,b){b[0]&8&&n!==(n=(g[3].Total?g[5](g[3].Total[0].amount):"0")+"")&&Oe(r,n),g[2]?f?f.p(g,b):(f=An(g),f.c(),f.m(s.parentNode,s)):f&&(f.d(1),f=null)},d(g){g&&(le(t),le(u),le(s)),f&&f.d(g),c=!1,l()}}}function Mo(e){let t,n=e[4]("Loading")+"",r;return{c(){t=j("p"),r=xe(n)},m(i,o){de(i,t,o),M(t,r)},p(i,o){o[0]&16&&n!==(n=i[4]("Loading")+"")&&Oe(r,n)},d(i){i&&le(t)}}}function An(e){let t,n,r,i,o,u,s=e[4]("Title")+"",c,l,f,g,b,x,_=e[4]("DepositButton")+"",P,k,W,$=mt(Object.keys(e[3])),B=[];for(let w=0;w<$.length;w+=1)B[w]=Hn(Sn(e,$,w));return{c(){t=j("div"),n=j("button"),r=_e(),i=j("div"),o=j("div"),u=j("p"),c=xe(s),l=_e(),f=j("div");for(let w=0;w<B.length;w+=1)B[w].c();g=_e(),b=j("div"),x=j("button"),P=xe(_),q(n,"class","BalanceModalClose"),q(u,"class","BalanceModalTitle"),q(o,"class","BalanceModalHeader"),q(f,"class","BalanceModalBody"),q(x,"class","BalanceModalAction"),q(b,"class","BalanceModalFooter"),q(i,"class","BalanceModal"),q(t,"class","BalanceModalWrapper")},m(w,D){de(w,t,D),M(t,n),M(t,r),M(t,i),M(i,o),M(o,u),M(u,c),M(i,l),M(i,f);for(let R=0;R<B.length;R+=1)B[R]&&B[R].m(f,null);M(i,g),M(i,b),M(b,x),M(x,P),k||(W=[pt(n,"click",e[24]),pt(x,"click",e[25])],k=!0)},p(w,D){if(D[0]&16&&s!==(s=w[4]("Title")+"")&&Oe(c,s),D[0]&56){$=mt(Object.keys(w[3]));let R;for(R=0;R<$.length;R+=1){const ee=Sn(w,$,R);B[R]?B[R].p(ee,D):(B[R]=Hn(ee),B[R].c(),B[R].m(f,null))}for(;R<B.length;R+=1)B[R].d(1);B.length=$.length}D[0]&16&&_!==(_=w[4]("DepositButton")+"")&&Oe(P,_)},d(w){w&&le(t),Mn(B,w),k=!1,Ve(W)}}}function Cn(e){let t,n,r=e[4](e[48])+"",i,o,u=(e[51].productType?e[4](e[51].productType):"")+"",s,c,l,f,g=(e[51].amount?e[5](e[51].amount):"0")+"",b;return{c(){t=j("div"),n=j("p"),i=xe(r),o=_e(),s=xe(u),c=_e(),l=j("p"),f=j("span"),b=xe(g),q(n,"class","BalanceModalText"),q(f,"class","BalanceModalAmount"),q(l,"class","BalanceModalValue"),q(t,"class","BalanceModalRowLine")},m(x,_){de(x,t,_),M(t,n),M(n,i),M(n,o),M(n,s),M(t,c),M(t,l),M(l,f),M(f,b)},p(x,_){_[0]&24&&r!==(r=x[4](x[48])+"")&&Oe(i,r),_[0]&24&&u!==(u=(x[51].productType?x[4](x[51].productType):"")+"")&&Oe(s,u),_[0]&8&&g!==(g=(x[51].amount?x[5](x[51].amount):"0")+"")&&Oe(b,g)},d(x){x&&le(t)}}}function Hn(e){let t,n,r=mt(e[3][e[48]]),i=[];for(let o=0;o<r.length;o+=1)i[o]=Cn(wn(e,r,o));return{c(){t=j("div");for(let o=0;o<i.length;o+=1)i[o].c();n=_e(),q(t,"class","BalanceModalRowBoth")},m(o,u){de(o,t,u);for(let s=0;s<i.length;s+=1)i[s]&&i[s].m(t,null);M(t,n)},p(o,u){if(u[0]&56){r=mt(o[3][o[48]]);let s;for(s=0;s<r.length;s+=1){const c=wn(o,r,s);i[s]?i[s].p(c,u):(i[s]=Cn(c),i[s].c(),i[s].m(t,n))}for(;s<i.length;s+=1)i[s].d(1);i.length=r.length}},d(o){o&&le(t),Mn(i,o)}}}function On(e){let t,n,r;return{c(){t=j("button"),q(t,"class","ShowBalanceModalOverlay")},m(i,o){de(i,t,o),n||(r=pt(t,"click",e[26]),n=!0)},p:se,d(i){i&&le(t),n=!1,r()}}}function Po(e){let t,n,r;function i(c,l){return c[1]?Mo:No}let o=i(e),u=o(e),s=e[2]&&On(e);return{c(){t=j("div"),n=j("div"),u.c(),r=_e(),s&&s.c(),q(n,"class","ShowBalance")},m(c,l){de(c,t,l),M(t,n),u.m(n,null),M(t,r),s&&s.m(t,null),e[27](t)},p(c,l){o===(o=i(c))&&u?u.p(c,l):(u.d(1),u=o(c),u&&(u.c(),u.m(n,null))),c[2]?s?s.p(c,l):(s=On(c),s.c(),s.m(t,null)):s&&(s.d(1),s=null)},i:se,o:se,d(c){c&&le(t),u.d(),s&&s.d(),e[27](null)}}}function Io(e,t,n){let r;mr(e,Ho,y=>n(4,r=y));let{userid:i=""}=t,{session:o=""}=t,{endpoint:u=""}=t,{lang:s="en"}=t,{mbsource:c}=t,{clientstyling:l=""}=t,{clientstylingurl:f=""}=t,{translationurl:g=""}=t,{gmversion:b="gm16"}=t,{displaybalanceoption:x="All"}=t,{totalcalculationmode:_="totalCashAmount"}=t,{currencylocale:P="en"}=t,{currencydisplay:k="symbol"}=t,{maximumfractiondigits:W="2"}=t,{minimumfractiondigits:$="0"}=t,{customdisplayformat:B=""}=t,w,D=!0,R=!1,ee=!1,pe,me="",te=[],Te;const E={},Be=["totalCashAmount","totalRealAmount"],Ze=()=>{fetch(g).then(y=>y.json()).then(y=>Object.keys(y).forEach(A=>Tn(A,y[A]))).catch(y=>console.log(y))};Object.keys(Bn).forEach(y=>Tn(y,Bn[y]));const at=y=>{if(B)return qe(y);const A=P||s,a={style:"currency",currency:me,useGrouping:!0,currencyDisplay:k||"code",maximumFractionDigits:W===""||isNaN(Number(W))?2:Number(W),minimumFractionDigits:$===""||isNaN(Number($))?0:Number($)};return new Intl.NumberFormat(A,a).format(y)},qe=y=>{const A=[];let a="";for(const h of B)switch(h){default:a+=h;break;case"{":a&&A.push(a),a="";break;case"}":const[m,d]=a.split("|");if(a="",m.toLowerCase()==="currency")a=me;else if(m.toLowerCase()==="amount"){let p=",",v=".",T=2;d&&(d[0]!==" "&&(p=d[0]),d[1]!==" "&&(v=d[1]),d[2]!==" "&&!isNaN(Number(d[2]))&&(T=Number(d[2])));let[N,C]=String(Math.floor(y*Rt(10,T))/Rt(10,T)).split(".");a+=N[0];for(let H=1;H<N.length;++H)(N.length-H)%3===0?a+=p+N[H]:a+=N[H];C&&(a+=v+C)}a&&A.push(a),a="";break}return A.push(a),A.join("")},he=()=>Pt(this,null,function*(){var A,a,h;n(1,D=!0);const y=new URL(`${u}/v1/player/${i}/account`);try{const m=yield fetch(y,{method:"GET",headers:{"X-SessionID":o}}),d=yield m.json();if(m.ok)te=d.items,me=(A=te.find(p=>p.displayName==="Casino"))==null?void 0:A.currency,n(3,E.Total=[{amount:d.totalAmount[me]}],E),n(3,E.Real=[{amount:(a=te.find(p=>p.displayName==="Casino"))==null?void 0:a.balanceAmount}],E),n(3,E.Bonus=[{amount:(h=te.find(p=>p.displayName==="UBS"))==null?void 0:h.balanceAmount}],E);else throw new Error("Failed to fetch balance data !")}catch(m){console.log("Balance error: ",m)}finally{n(1,D=!1)}}),Se=()=>{n(1,D=!0);const y=new URL(`${u}/v2/player/${i}/balance`),A=new Headers;A.append("X-SessionID",o),fetch(y,{method:"GET",headers:A}).then(h=>h.json()).then(h=>{h[_]||n(7,_=Be[0]);const m=h.items.find(p=>p.type==="Real"&&p.walletAccountType==="Ordinary");if(me=m.currency,ee=!!m.productType,n(3,E.Total=[{amount:0}],E),n(3,E.Real=[],E),n(3,E.Bonus=[],E),n(3,E.Credit=[],E),!ee){Te={lastOrdinaryAfterAmount:0,showCreditLineAfterAmount:!1},n(3,E.Total[0].amount=h[_][me],E);for(const p of h.items)switch(p.type){case"Bonus":E.Bonus.length===0?E.Bonus.push({amount:p.amount}):n(3,E.Bonus[0].amount+=p.amount,E);break;case"Real":if(p.creditLine&&E.Credit.length===0&&E.Credit.push({amount:p.creditLine}),_==="totalRealAmount")continue;E.Real.length===0?E.Real.push({amount:p.amount}):n(3,E.Real[0].amount+=p.amount,E);break}for(const[p,v]of Object.entries(E))v.length<1&&delete E[p];n(1,D=!1);return}Te={Casino:{lastOrdinaryAfterAmount:0,showCreditLineAfterAmount:!1},Sports:{lastOrdinaryAfterAmount:0,showCreditLineAfterAmount:!1}};let d=h.items;x&&x!=="All"&&(d=h.items.filter(p=>p.productType===x));for(const p of d){let v;switch(p.type){case"Bonus":v=E.Bonus.findIndex(T=>T.productType===p.productType),v>0?n(3,E.Bonus[v].amount+=p.amount,E):E.Bonus.push({amount:p.amount,productType:p.productType});break;case"Real":p.creditLine&&E.Credit.push({amount:p.creditLine,productType:p.productType}),v=E.Real.findIndex(T=>T.productType===p.productType),v>0?n(3,E.Real[v].amount+=p.amount,E):E.Real.push({amount:p.amount,productType:p.productType});break}}Qe();for(const[p,v]of Object.entries(E))v.length<1&&delete E[p];n(1,D=!1)}).catch(()=>{throw n(1,D=!1),new Error("Failed to fetch balance data !")})},ge=()=>{if(pe&&pe.close(),o.length<1)return;let y,A;switch(b){case"gm16":y=new URL(`${u}/v2/player/${i}/information/updates`),A=m=>Bt(m);break;case"gmcore":y=new URL(`${u}/v1/player/${i}/balance/updates`),A=m=>ce(m);break}const a={accept:"text/event-stream","X-SessionId":o},h=new Lo.EventSourcePolyfill(y,{headers:a});pe=h,h.addEventListener("message",A)},Re=y=>{let A;try{A=JSON.parse(y)}catch(a){console.log("Balance stream failed: ",a);return}return A},ce=y=>{var m,d;const A=Re(y.data);if(!A){ge();return}let a="0";const h=A.balanceChange;te=te.map(p=>(h&&h[p.id]&&(p=Mt(Nt({},p),{balanceAmount:h[p.id].afterAmount})),a=(parseFloat(p==null?void 0:p.balanceAmount)+parseFloat(a)).toString(),p)),n(3,E.Real=[{amount:(m=te[0])==null?void 0:m.balanceAmount}],E),n(3,E.Bonus=[{amount:(d=te[1])==null?void 0:d.balanceAmount}],E),n(3,E.Total=[{amount:Number(a)}],E)},Ce=(y,A,a)=>{let h=null;switch(a.walletAccountType){case"Ordinary":(a.afterAmount!==a.affectedAmount||A.lastOrdinaryAfterAmount===0)&&(A.lastOrdinaryAfterAmount=a.afterAmount,A.showCreditLineAfterAmount||(h=a.afterAmount));break;case"CreditLine":a.afterAmount!==0?(h=a.afterAmount,A.showCreditLineAfterAmount=!0):(h=A.lastOrdinaryAfterAmount,A.showCreditLineAfterAmount=!1);break;default:h=a.afterAmount}return h===null?y:h},Qe=()=>{switch(_){case"totalCashAmount":let y=0;for(const a of["Real","Bonus"])for(const h of E[a])y+=Math.max(h.amount,0);n(3,E.Total[0].amount=y,E);break;case"totalRealAmount":if(!ee)return;let A=0;for(const a of E.Real)A+=a.amount;n(3,E.Total[0].amount=A,E)}},Bt=y=>{const A=Re(y.data);if(!A){ge();return}if(A.type!=="BALANCE_UPDATE_V2")return;const a=A.body.balanceChange;for(const[h,m]of Object.entries(a))if(_==="totalRealAmount"&&h==="Real"&&!ee&&n(3,E.Total[0].amount=Ce(E.Total[0].amount,Te,m),E),!!E[h])for(const d of E[h]){if(!ee){d.amount=h==="Real"?Ce(d.amount,Te,m):m.afterAmount;continue}m.productType===d.productType&&(d.amount=h==="Real"?Ce(d.amount,Te[d.productType],m):m.afterAmount)}Qe()},st=()=>{n(2,R=!1),window.postMessage({type:"GoToDeposit"},window.location.href),typeof gtag=="function"&&gtag("event","GoToDeposit",{context:"PlayerAccountBalanceModal"})},St=()=>{Be.includes(_)||(console.error(`Unsupported value ('${_}') for totalcalculationmode parameter. Only the following values are supported ${Be}. Using default value ('${Be[0]}').`),n(7,_=Be[0]))},wt=()=>{switch(Oo(s),St(),b){case"gmcore":he();break;case"gm16":Se();break;default:throw Error(`Invalid apiversion attribute: ${b}`)}},Ne=y=>y.data&&y.data.type==="LogoutSuccessfull"&&pe.close();Tr(()=>(window.addEventListener("message",Ne,!1),()=>{window.removeEventListener("message",Ne),pe&&pe.close()}));const Je=()=>n(2,R=!0),we=()=>n(2,R=!1),ne=()=>st(),At=()=>n(2,R=!1);function Ct(y){kt[y?"unshift":"push"](()=>{w=y,n(0,w)})}return e.$$set=y=>{"userid"in y&&n(8,i=y.userid),"session"in y&&n(9,o=y.session),"endpoint"in y&&n(10,u=y.endpoint),"lang"in y&&n(11,s=y.lang),"mbsource"in y&&n(12,c=y.mbsource),"clientstyling"in y&&n(13,l=y.clientstyling),"clientstylingurl"in y&&n(14,f=y.clientstylingurl),"translationurl"in y&&n(15,g=y.translationurl),"gmversion"in y&&n(16,b=y.gmversion),"displaybalanceoption"in y&&n(17,x=y.displaybalanceoption),"totalcalculationmode"in y&&n(7,_=y.totalcalculationmode),"currencylocale"in y&&n(18,P=y.currencylocale),"currencydisplay"in y&&n(19,k=y.currencydisplay),"maximumfractiondigits"in y&&n(20,W=y.maximumfractiondigits),"minimumfractiondigits"in y&&n(21,$=y.minimumfractiondigits),"customdisplayformat"in y&&n(22,B=y.customdisplayformat)},e.$$.update=()=>{e.$$.dirty[0]&200448&&u&&i&&o&&s&&b&&x&&wt(),e.$$.dirty[0]&67328&&u&&i&&o&&b&&ge(),e.$$.dirty[0]&8193&&l&&w&&Dr(w,l),e.$$.dirty[0]&16385&&f&&w&&Fr(w,f),e.$$.dirty[0]&4097&&w&&Ur(w,`${c}.Style`),e.$$.dirty[0]&32768&&g&&Ze()},[w,D,R,E,r,at,st,_,i,o,u,s,c,l,f,g,b,x,P,k,W,$,B,Je,we,ne,At,Ct]}class ar extends Pr{constructor(t){super(),Nr(this,t,Io,Po,Rn,{userid:8,session:9,endpoint:10,lang:11,mbsource:12,clientstyling:13,clientstylingurl:14,translationurl:15,gmversion:16,displaybalanceoption:17,totalcalculationmode:7,currencylocale:18,currencydisplay:19,maximumfractiondigits:20,minimumfractiondigits:21,customdisplayformat:22},Ro,[-1,-1])}get userid(){return this.$$.ctx[8]}set userid(t){this.$$set({userid:t}),z()}get session(){return this.$$.ctx[9]}set session(t){this.$$set({session:t}),z()}get endpoint(){return this.$$.ctx[10]}set endpoint(t){this.$$set({endpoint:t}),z()}get lang(){return this.$$.ctx[11]}set lang(t){this.$$set({lang:t}),z()}get mbsource(){return this.$$.ctx[12]}set mbsource(t){this.$$set({mbsource:t}),z()}get clientstyling(){return this.$$.ctx[13]}set clientstyling(t){this.$$set({clientstyling:t}),z()}get clientstylingurl(){return this.$$.ctx[14]}set clientstylingurl(t){this.$$set({clientstylingurl:t}),z()}get translationurl(){return this.$$.ctx[15]}set translationurl(t){this.$$set({translationurl:t}),z()}get gmversion(){return this.$$.ctx[16]}set gmversion(t){this.$$set({gmversion:t}),z()}get displaybalanceoption(){return this.$$.ctx[17]}set displaybalanceoption(t){this.$$set({displaybalanceoption:t}),z()}get totalcalculationmode(){return this.$$.ctx[7]}set totalcalculationmode(t){this.$$set({totalcalculationmode:t}),z()}get currencylocale(){return this.$$.ctx[18]}set currencylocale(t){this.$$set({currencylocale:t}),z()}get currencydisplay(){return this.$$.ctx[19]}set currencydisplay(t){this.$$set({currencydisplay:t}),z()}get maximumfractiondigits(){return this.$$.ctx[20]}set maximumfractiondigits(t){this.$$set({maximumfractiondigits:t}),z()}get minimumfractiondigits(){return this.$$.ctx[21]}set minimumfractiondigits(t){this.$$set({minimumfractiondigits:t}),z()}get customdisplayformat(){return this.$$.ctx[22]}set customdisplayformat(t){this.$$set({customdisplayformat:t}),z()}}Mr(ar,{userid:{},session:{},endpoint:{},lang:{},mbsource:{},clientstyling:{},clientstylingurl:{},translationurl:{},gmversion:{},displaybalanceoption:{},totalcalculationmode:{},currencylocale:{},currencydisplay:{},maximumfractiondigits:{},minimumfractiondigits:{},customdisplayformat:{}},[],[],!0);exports.default=ar;
9
+ `,Me+=Ee):ve==="id"?ut=Ee:ve==="event"?ye=Ee:ve==="retry"?(v=Ne(Ee,v),C=v):ve==="heartbeatTimeout"&&(T=Ne(Ee,T),Q!==0&&(i(Q),Q=r(function(){Ke()},T)))}if(J===ce){if(Me!==""){N=ut,ye===""&&(ye="message");var Pe=new Be(ye,{data:Me.slice(1),lastEventId:ut});if(a.dispatchEvent(Pe),ye==="open"?we(a,a.onopen,Pe):ye==="message"?we(a,a.onmessage,Pe):ye==="error"&&we(a,a.onerror,Pe),ue===ge)return}Me="",ye=""}J=oe===13?Re:ce}else J===ce&&(Ht=Z,J=Ce),J===Ce?oe===58&&(He=Z+1,J=Qe):J===Qe&&(J=Bt)}}},an=function(X){if(ue===Se||ue===he){ue=qe,Q!==0&&(i(Q),Q=0),Q=r(function(){Ke()},C),C=Je(Math.min(v*16,C*2)),a.readyState=he;var V=new at("error",{error:X});a.dispatchEvent(V),we(a,a.onerror,V),X!=null&&console.error(X)}},Ot=function(){ue=ge,re!=null&&(re.abort(),re=void 0),Q!==0&&(i(Q),Q=0),a.readyState=ge},Ke=function(){if(Q=0,ue!==qe){if(!H&&re!=null)an(new Error("No activity within "+T+" milliseconds. "+(ue===he?"No response received.":I+" chars received.")+" Reconnecting.")),re!=null&&(re.abort(),re=void 0);else{var X=Math.max((H||Date.now())+T-Date.now(),1);H=!1,Q=r(function(){Ke()},X)}return}H=!1,I=0,Q=r(function(){Ke()},T),ue=he,Me="",ye="",ut=N,lt="",Ht=0,He=0,J=ce;var V=h;if(h.slice(0,5)!=="data:"&&h.slice(0,5)!=="blob:"&&N!==""){var ie=h.indexOf("?");V=ie===-1?h:h.slice(0,ie+1)+h.slice(ie+1).replace(/(?:^|&)([^=&]*)(?:=[^&]*)?/g,function(Ee,Pe){return Pe===p?"":Ee}),V+=(h.indexOf("?")===-1?"?":"&")+p+"="+encodeURIComponent(N)}var oe=a.withCredentials,Y={};Y.Accept="text/event-stream";var Z=a.headers;if(Z!=null)for(var ve in Z)Object.prototype.hasOwnProperty.call(Z,ve)&&(Y[ve]=Z[ve]);try{re=Ye.open(be,sr,ur,an,V,oe,Y)}catch(Ee){throw Ot(),Ee}};a.url=h,a.readyState=he,a.withCredentials=d,a.headers=S,a._close=Ot,Ke()}ne.prototype=Object.create(te.prototype),ne.prototype.CONNECTING=he,ne.prototype.OPEN=Se,ne.prototype.CLOSED=ge,ne.prototype.close=function(){this._close()},ne.CONNECTING=he,ne.OPEN=Se,ne.CLOSED=ge,ne.prototype.withCredentials=void 0;var A=c;o!=null&&(c==null||!("withCredentials"in c.prototype))&&(A=ne),function(a){{var h=a(t);h!==void 0&&(e.exports=h)}}(function(a){a.EventSourcePolyfill=ne,a.NativeEventSource=c,a.EventSource=A})})(typeof globalThis=="undefined"?typeof window!="undefined"?window:typeof self!="undefined"?self:$r:globalThis)})(tn,tn.exports);var Lo=tn.exports;function Ro(e){gr(e,"svelte-gv6dm2",'*,*::before,*::after{font-family:inherit}:host{font-family:inherit}input,textarea,button{font-family:inherit}p{padding:0;margin:0}.ShowBalance{position:relative}.ShowBalance .Loading{font-size:14px;white-space:nowrap;padding-right:10px}.ShowBalance .BalanceValue{font-size:14px;cursor:pointer;display:flex;flex-wrap:nowrap;white-space:nowrap;background:transparent;border:none;font:inherit;color:inherit}.ShowBalance .BalanceValue svg{width:16px}.ShowBalance .BalanceValue span{padding-left:8px}@media only screen and (max-width: 360px){.ShowBalance .BalanceValue{font-size:12px}.ShowBalance .BalanceValue svg{width:12px}}.BalanceModalWrapper{background-color:var(--emw--color-white, #FFFFFF);position:absolute;top:45px;left:50%;transform:translateX(-60%);padding:10px;box-shadow:0px 30px 30px var(--emw--header-color-primary, var(--emw--color-primary, #22B04E));border-radius:5px;z-index:17;box-shadow:0px 5px 20px 0px #191919}.BalanceModalWrapper:before{content:"";background:var(--emw--color-white, #FFFFFF);clip-path:polygon(50% 0, 0% 100%, 100% 100%);position:absolute;top:-8px;left:60%;width:25px;height:10px;transform:translateX(-50%);z-index:1}.BalanceModalClose{position:absolute;top:5px;right:5px;width:20px;height:20px;z-index:1;cursor:pointer;font:inherit}.BalanceModalClose:before{content:"";background:var(--emw--color-secondary, var(--emw--color-secondary, #FD2839));position:absolute;top:8px;left:0;width:20px;height:2px;transform:rotate(45deg)}.BalanceModalClose:after{content:"";background:var(--emw--color-secondary, var(--emw--color-secondary, #FD2839));position:absolute;top:8px;left:0;width:20px;height:2px;transform:rotate(-45deg)}.BalanceModal{position:relative;width:280px}.BalanceModalHeader{display:flex;align-items:center;justify-content:center;padding:20px 0}.BalanceModalHeader .BalanceModalTitle{font-size:16px;font-weight:bold;color:var(--emw--header-contrast, var(--emw--color-contrast, #07072A))}.BalanceModalRowBoth{display:flex;flex-direction:column;gap:5px;padding:20px 0;border-bottom:1px solid var(--emw--color-gray-100, #E6E6E6)}.BalanceModalRowBoth:last-child{border-bottom:none}.BalanceModalRowBoth .BalanceModalRowLine{display:flex;width:100%;justify-content:space-between}.BalanceModalRowBoth .BalanceModalText{color:var(--emw--header-contrast, var(--emw--color-contrast, #07072A));font-size:14px;text-transform:capitalize}.BalanceModalRowBoth .BalanceModalValue{font-size:14px;font-weight:bold;color:var(--emw--header-contrast, var(--emw--color-contrast, #07072A))}.BalanceModalFooter{display:flex;align-items:center;padding:20px 0 10px}.BalanceModalFooter .BalanceModalAction{background:var(--emw--header-color-primary, var(--emw--color-primary, #22B04E));font-size:12px;color:white;text-transform:uppercase;width:100%;border-radius:5px;border:none;padding:10px 0;cursor:pointer}.BalanceModalFooter .BalanceModalAction:hover,.BalanceModalFooter .BalanceModalActionactive{background:var(--emw--header-contrast, var(--emw--color-background, #07072A))}.ShowBalanceModalOverlay{background-color:rgba(0, 0, 0, 0.7);position:fixed;top:0;bottom:0;left:0;right:0;z-index:16}')}function Sn(e,t,n){const r=e.slice();return r[48]=t[n],r}function wn(e,t,n){const r=e.slice();return r[51]=t[n],r}function No(e){let t,n=(e[3].Total?e[5](e[3].Total[0].amount):"0")+"",r,i,o,u,s,c,l,f=e[2]&&An(e);return{c(){t=j("button"),r=xe(n),i=_e(),o=j("span"),o.innerHTML='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 11.435"><defs><style>.a{fill:var(--emw--color-white, #FFFFFF);}</style></defs><path class="a" d="M16.191,19.235l7.562-7.568a1.423,1.423,0,0,1,2.019,0,1.441,1.441,0,0,1,0,2.025L17.2,22.265a1.427,1.427,0,0,1-1.971.042L6.6,13.7a1.429,1.429,0,0,1,2.019-2.025Z" transform="translate(-6.188 -11.246)"></path></svg>',u=_e(),f&&f.c(),s=vr(),q(t,"class","BalanceValue")},m(g,b){de(g,t,b),M(t,r),M(t,i),M(t,o),de(g,u,b),f&&f.m(g,b),de(g,s,b),c||(l=pt(t,"click",e[23]),c=!0)},p(g,b){b[0]&8&&n!==(n=(g[3].Total?g[5](g[3].Total[0].amount):"0")+"")&&Oe(r,n),g[2]?f?f.p(g,b):(f=An(g),f.c(),f.m(s.parentNode,s)):f&&(f.d(1),f=null)},d(g){g&&(le(t),le(u),le(s)),f&&f.d(g),c=!1,l()}}}function Mo(e){let t,n=e[4]("Loading")+"",r;return{c(){t=j("p"),r=xe(n)},m(i,o){de(i,t,o),M(t,r)},p(i,o){o[0]&16&&n!==(n=i[4]("Loading")+"")&&Oe(r,n)},d(i){i&&le(t)}}}function An(e){let t,n,r,i,o,u,s=e[4]("Title")+"",c,l,f,g,b,x,_=e[4]("DepositButton")+"",P,k,W,$=mt(Object.keys(e[3])),B=[];for(let w=0;w<$.length;w+=1)B[w]=Hn(Sn(e,$,w));return{c(){t=j("div"),n=j("button"),r=_e(),i=j("div"),o=j("div"),u=j("p"),c=xe(s),l=_e(),f=j("div");for(let w=0;w<B.length;w+=1)B[w].c();g=_e(),b=j("div"),x=j("button"),P=xe(_),q(n,"class","BalanceModalClose"),q(u,"class","BalanceModalTitle"),q(o,"class","BalanceModalHeader"),q(f,"class","BalanceModalBody"),q(x,"class","BalanceModalAction"),q(b,"class","BalanceModalFooter"),q(i,"class","BalanceModal"),q(t,"class","BalanceModalWrapper")},m(w,D){de(w,t,D),M(t,n),M(t,r),M(t,i),M(i,o),M(o,u),M(u,c),M(i,l),M(i,f);for(let R=0;R<B.length;R+=1)B[R]&&B[R].m(f,null);M(i,g),M(i,b),M(b,x),M(x,P),k||(W=[pt(n,"click",e[24]),pt(x,"click",e[25])],k=!0)},p(w,D){if(D[0]&16&&s!==(s=w[4]("Title")+"")&&Oe(c,s),D[0]&56){$=mt(Object.keys(w[3]));let R;for(R=0;R<$.length;R+=1){const ee=Sn(w,$,R);B[R]?B[R].p(ee,D):(B[R]=Hn(ee),B[R].c(),B[R].m(f,null))}for(;R<B.length;R+=1)B[R].d(1);B.length=$.length}D[0]&16&&_!==(_=w[4]("DepositButton")+"")&&Oe(P,_)},d(w){w&&le(t),Mn(B,w),k=!1,Ve(W)}}}function Cn(e){let t,n,r=e[4](e[48])+"",i,o,u=(e[51].productType?e[4](e[51].productType):"")+"",s,c,l,f,g=e[5](e[51].amount)+"",b;return{c(){t=j("div"),n=j("p"),i=xe(r),o=_e(),s=xe(u),c=_e(),l=j("p"),f=j("span"),b=xe(g),q(n,"class","BalanceModalText"),q(f,"class","BalanceModalAmount"),q(l,"class","BalanceModalValue"),q(t,"class","BalanceModalRowLine")},m(x,_){de(x,t,_),M(t,n),M(n,i),M(n,o),M(n,s),M(t,c),M(t,l),M(l,f),M(f,b)},p(x,_){_[0]&24&&r!==(r=x[4](x[48])+"")&&Oe(i,r),_[0]&24&&u!==(u=(x[51].productType?x[4](x[51].productType):"")+"")&&Oe(s,u),_[0]&8&&g!==(g=x[5](x[51].amount)+"")&&Oe(b,g)},d(x){x&&le(t)}}}function Hn(e){let t,n,r=mt(e[3][e[48]]),i=[];for(let o=0;o<r.length;o+=1)i[o]=Cn(wn(e,r,o));return{c(){t=j("div");for(let o=0;o<i.length;o+=1)i[o].c();n=_e(),q(t,"class","BalanceModalRowBoth")},m(o,u){de(o,t,u);for(let s=0;s<i.length;s+=1)i[s]&&i[s].m(t,null);M(t,n)},p(o,u){if(u[0]&56){r=mt(o[3][o[48]]);let s;for(s=0;s<r.length;s+=1){const c=wn(o,r,s);i[s]?i[s].p(c,u):(i[s]=Cn(c),i[s].c(),i[s].m(t,n))}for(;s<i.length;s+=1)i[s].d(1);i.length=r.length}},d(o){o&&le(t),Mn(i,o)}}}function On(e){let t,n,r;return{c(){t=j("button"),q(t,"class","ShowBalanceModalOverlay")},m(i,o){de(i,t,o),n||(r=pt(t,"click",e[26]),n=!0)},p:se,d(i){i&&le(t),n=!1,r()}}}function Po(e){let t,n,r;function i(c,l){return c[1]?Mo:No}let o=i(e),u=o(e),s=e[2]&&On(e);return{c(){t=j("div"),n=j("div"),u.c(),r=_e(),s&&s.c(),q(n,"class","ShowBalance")},m(c,l){de(c,t,l),M(t,n),u.m(n,null),M(t,r),s&&s.m(t,null),e[27](t)},p(c,l){o===(o=i(c))&&u?u.p(c,l):(u.d(1),u=o(c),u&&(u.c(),u.m(n,null))),c[2]?s?s.p(c,l):(s=On(c),s.c(),s.m(t,null)):s&&(s.d(1),s=null)},i:se,o:se,d(c){c&&le(t),u.d(),s&&s.d(),e[27](null)}}}function Io(e,t,n){let r;mr(e,Ho,y=>n(4,r=y));let{userid:i=""}=t,{session:o=""}=t,{endpoint:u=""}=t,{lang:s="en"}=t,{mbsource:c}=t,{clientstyling:l=""}=t,{clientstylingurl:f=""}=t,{translationurl:g=""}=t,{gmversion:b="gm16"}=t,{displaybalanceoption:x="All"}=t,{totalcalculationmode:_="totalCashAmount"}=t,{currencylocale:P="en"}=t,{currencydisplay:k="symbol"}=t,{maximumfractiondigits:W="2"}=t,{minimumfractiondigits:$="0"}=t,{customdisplayformat:B=""}=t,w,D=!0,R=!1,ee=!1,pe,me="",te=[],Te;const E={},Be=["totalCashAmount","totalRealAmount"],Ze=()=>{fetch(g).then(y=>y.json()).then(y=>Object.keys(y).forEach(A=>Tn(A,y[A]))).catch(y=>console.log(y))};Object.keys(Bn).forEach(y=>Tn(y,Bn[y]));const at=y=>{if(B)return qe(y);const A=P||s,a={style:"currency",currency:me,useGrouping:!0,currencyDisplay:k||"code",maximumFractionDigits:W===""||isNaN(Number(W))?2:Number(W),minimumFractionDigits:$===""||isNaN(Number($))?0:Number($)};return new Intl.NumberFormat(A,a).format(y)},qe=y=>{const A=[];let a="";for(const h of B)switch(h){default:a+=h;break;case"{":a&&A.push(a),a="";break;case"}":const[m,d]=a.split("|");if(a="",m.toLowerCase()==="currency")a=me;else if(m.toLowerCase()==="amount"){let p=",",v=".",T=2;d&&(d[0]!==" "&&(p=d[0]),d[1]!==" "&&(v=d[1]),d[2]!==" "&&!isNaN(Number(d[2]))&&(T=Number(d[2])));let[N,C]=String(Math.floor(y*Rt(10,T))/Rt(10,T)).split(".");a+=N[0];for(let H=1;H<N.length;++H)(N.length-H)%3===0?a+=p+N[H]:a+=N[H];C&&(a+=v+C)}a&&A.push(a),a="";break}return A.push(a),A.join("")},he=()=>Pt(this,null,function*(){var A,a,h;n(1,D=!0);const y=new URL(`${u}/v1/player/${i}/account`);try{const m=yield fetch(y,{method:"GET",headers:{"X-SessionID":o}}),d=yield m.json();if(m.ok)te=d.items,me=(A=te.find(p=>p.displayName==="Casino"))==null?void 0:A.currency,n(3,E.Total=[{amount:d.totalAmount[me]}],E),n(3,E.Real=[{amount:(a=te.find(p=>p.displayName==="Casino"))==null?void 0:a.balanceAmount}],E),n(3,E.Bonus=[{amount:(h=te.find(p=>p.displayName==="UBS"))==null?void 0:h.balanceAmount}],E);else throw new Error("Failed to fetch balance data !")}catch(m){console.log("Balance error: ",m)}finally{n(1,D=!1)}}),Se=()=>{n(1,D=!0);const y=new URL(`${u}/v2/player/${i}/balance`),A=new Headers;A.append("X-SessionID",o),fetch(y,{method:"GET",headers:A}).then(h=>h.json()).then(h=>{h[_]||n(7,_=Be[0]);const m=h.items.find(p=>p.type==="Real"&&p.walletAccountType==="Ordinary");if(me=m.currency,ee=!!m.productType,n(3,E.Total=[{amount:0}],E),n(3,E.Real=[],E),n(3,E.Bonus=[],E),n(3,E.Credit=[],E),!ee){Te={lastOrdinaryAfterAmount:0,showCreditLineAfterAmount:!1},n(3,E.Total[0].amount=h[_][me],E);for(const p of h.items)switch(p.type){case"Bonus":E.Bonus.length===0?E.Bonus.push({amount:p.amount}):n(3,E.Bonus[0].amount+=p.amount,E);break;case"Real":if(p.creditLine&&E.Credit.length===0&&E.Credit.push({amount:p.creditLine}),_==="totalRealAmount")continue;E.Real.length===0?E.Real.push({amount:p.amount}):n(3,E.Real[0].amount+=p.amount,E);break}for(const[p,v]of Object.entries(E))v.length<1&&delete E[p];n(1,D=!1);return}Te={Casino:{lastOrdinaryAfterAmount:0,showCreditLineAfterAmount:!1},Sports:{lastOrdinaryAfterAmount:0,showCreditLineAfterAmount:!1}};let d=h.items;x&&x!=="All"&&(d=h.items.filter(p=>p.productType===x));for(const p of d){let v;switch(p.type){case"Bonus":v=E.Bonus.findIndex(T=>T.productType===p.productType),v>0?n(3,E.Bonus[v].amount+=p.amount,E):E.Bonus.push({amount:p.amount,productType:p.productType});break;case"Real":p.creditLine&&E.Credit.push({amount:p.creditLine,productType:p.productType}),v=E.Real.findIndex(T=>T.productType===p.productType),v>0?n(3,E.Real[v].amount+=p.amount,E):E.Real.push({amount:p.amount,productType:p.productType});break}}Qe();for(const[p,v]of Object.entries(E))v.length<1&&delete E[p];n(1,D=!1)}).catch(()=>{throw n(1,D=!1),new Error("Failed to fetch balance data !")})},ge=()=>{if(pe&&pe.close(),o.length<1)return;let y,A;switch(b){case"gm16":y=new URL(`${u}/v2/player/${i}/information/updates`),A=m=>Bt(m);break;case"gmcore":y=new URL(`${u}/v1/player/${i}/balance/updates`),A=m=>ce(m);break}const a={accept:"text/event-stream","X-SessionId":o},h=new Lo.EventSourcePolyfill(y,{headers:a});pe=h,h.addEventListener("message",A)},Re=y=>{let A;try{A=JSON.parse(y)}catch(a){console.log("Balance stream failed: ",a);return}return A},ce=y=>{var m,d;const A=Re(y.data);if(!A){ge();return}let a="0";const h=A.balanceChange;te=te.map(p=>(h&&h[p.id]&&(p=Mt(Nt({},p),{balanceAmount:h[p.id].afterAmount})),a=(parseFloat(p==null?void 0:p.balanceAmount)+parseFloat(a)).toString(),p)),n(3,E.Real=[{amount:(m=te[0])==null?void 0:m.balanceAmount}],E),n(3,E.Bonus=[{amount:(d=te[1])==null?void 0:d.balanceAmount}],E),n(3,E.Total=[{amount:Number(a)}],E)},Ce=(y,A,a)=>{let h=null;switch(a.walletAccountType){case"Ordinary":(a.afterAmount!==a.affectedAmount||A.lastOrdinaryAfterAmount===0)&&(A.lastOrdinaryAfterAmount=a.afterAmount,A.showCreditLineAfterAmount||(h=a.afterAmount));break;case"CreditLine":a.afterAmount!==0?(h=a.afterAmount,A.showCreditLineAfterAmount=!0):(h=A.lastOrdinaryAfterAmount,A.showCreditLineAfterAmount=!1);break;default:h=a.afterAmount}return h===null?y:h},Qe=()=>{switch(_){case"totalCashAmount":let y=0;for(const a of["Real","Bonus"])for(const h of E[a])y+=Math.max(h.amount,0);n(3,E.Total[0].amount=y,E);break;case"totalRealAmount":if(!ee)return;let A=0;for(const a of E.Real)A+=a.amount;n(3,E.Total[0].amount=A,E)}},Bt=y=>{const A=Re(y.data);if(!A){ge();return}if(A.type!=="BALANCE_UPDATE_V2")return;const a=A.body.balanceChange;for(const[h,m]of Object.entries(a))if(_==="totalRealAmount"&&h==="Real"&&!ee&&n(3,E.Total[0].amount=Ce(E.Total[0].amount,Te,m),E),!!E[h])for(const d of E[h]){if(!ee){d.amount=h==="Real"?Ce(d.amount,Te,m):m.afterAmount;continue}m.productType===d.productType&&(d.amount=h==="Real"?Ce(d.amount,Te[d.productType],m):m.afterAmount)}Qe()},st=()=>{n(2,R=!1),window.postMessage({type:"GoToDeposit"},window.location.href),typeof gtag=="function"&&gtag("event","GoToDeposit",{context:"PlayerAccountBalanceModal"})},St=()=>{Be.includes(_)||(console.error(`Unsupported value ('${_}') for totalcalculationmode parameter. Only the following values are supported ${Be}. Using default value ('${Be[0]}').`),n(7,_=Be[0]))},wt=()=>{switch(Oo(s),St(),b){case"gmcore":he();break;case"gm16":Se();break;default:throw Error(`Invalid apiversion attribute: ${b}`)}},Ne=y=>y.data&&y.data.type==="LogoutSuccessfull"&&pe.close();Tr(()=>(window.addEventListener("message",Ne,!1),()=>{window.removeEventListener("message",Ne),pe&&pe.close()}));const Je=()=>n(2,R=!0),we=()=>n(2,R=!1),ne=()=>st(),At=()=>n(2,R=!1);function Ct(y){kt[y?"unshift":"push"](()=>{w=y,n(0,w)})}return e.$$set=y=>{"userid"in y&&n(8,i=y.userid),"session"in y&&n(9,o=y.session),"endpoint"in y&&n(10,u=y.endpoint),"lang"in y&&n(11,s=y.lang),"mbsource"in y&&n(12,c=y.mbsource),"clientstyling"in y&&n(13,l=y.clientstyling),"clientstylingurl"in y&&n(14,f=y.clientstylingurl),"translationurl"in y&&n(15,g=y.translationurl),"gmversion"in y&&n(16,b=y.gmversion),"displaybalanceoption"in y&&n(17,x=y.displaybalanceoption),"totalcalculationmode"in y&&n(7,_=y.totalcalculationmode),"currencylocale"in y&&n(18,P=y.currencylocale),"currencydisplay"in y&&n(19,k=y.currencydisplay),"maximumfractiondigits"in y&&n(20,W=y.maximumfractiondigits),"minimumfractiondigits"in y&&n(21,$=y.minimumfractiondigits),"customdisplayformat"in y&&n(22,B=y.customdisplayformat)},e.$$.update=()=>{e.$$.dirty[0]&200448&&u&&i&&o&&s&&b&&x&&wt(),e.$$.dirty[0]&67328&&u&&i&&o&&b&&ge(),e.$$.dirty[0]&8193&&l&&w&&Dr(w,l),e.$$.dirty[0]&16385&&f&&w&&Fr(w,f),e.$$.dirty[0]&4097&&w&&Ur(w,`${c}.Style`),e.$$.dirty[0]&32768&&g&&Ze()},[w,D,R,E,r,at,st,_,i,o,u,s,c,l,f,g,b,x,P,k,W,$,B,Je,we,ne,At,Ct]}class ar extends Pr{constructor(t){super(),Nr(this,t,Io,Po,Rn,{userid:8,session:9,endpoint:10,lang:11,mbsource:12,clientstyling:13,clientstylingurl:14,translationurl:15,gmversion:16,displaybalanceoption:17,totalcalculationmode:7,currencylocale:18,currencydisplay:19,maximumfractiondigits:20,minimumfractiondigits:21,customdisplayformat:22},Ro,[-1,-1])}get userid(){return this.$$.ctx[8]}set userid(t){this.$$set({userid:t}),z()}get session(){return this.$$.ctx[9]}set session(t){this.$$set({session:t}),z()}get endpoint(){return this.$$.ctx[10]}set endpoint(t){this.$$set({endpoint:t}),z()}get lang(){return this.$$.ctx[11]}set lang(t){this.$$set({lang:t}),z()}get mbsource(){return this.$$.ctx[12]}set mbsource(t){this.$$set({mbsource:t}),z()}get clientstyling(){return this.$$.ctx[13]}set clientstyling(t){this.$$set({clientstyling:t}),z()}get clientstylingurl(){return this.$$.ctx[14]}set clientstylingurl(t){this.$$set({clientstylingurl:t}),z()}get translationurl(){return this.$$.ctx[15]}set translationurl(t){this.$$set({translationurl:t}),z()}get gmversion(){return this.$$.ctx[16]}set gmversion(t){this.$$set({gmversion:t}),z()}get displaybalanceoption(){return this.$$.ctx[17]}set displaybalanceoption(t){this.$$set({displaybalanceoption:t}),z()}get totalcalculationmode(){return this.$$.ctx[7]}set totalcalculationmode(t){this.$$set({totalcalculationmode:t}),z()}get currencylocale(){return this.$$.ctx[18]}set currencylocale(t){this.$$set({currencylocale:t}),z()}get currencydisplay(){return this.$$.ctx[19]}set currencydisplay(t){this.$$set({currencydisplay:t}),z()}get maximumfractiondigits(){return this.$$.ctx[20]}set maximumfractiondigits(t){this.$$set({maximumfractiondigits:t}),z()}get minimumfractiondigits(){return this.$$.ctx[21]}set minimumfractiondigits(t){this.$$set({minimumfractiondigits:t}),z()}get customdisplayformat(){return this.$$.ctx[22]}set customdisplayformat(t){this.$$set({customdisplayformat:t}),z()}}Mr(ar,{userid:{},session:{},endpoint:{},lang:{},mbsource:{},clientstyling:{},clientstylingurl:{},translationurl:{},gmversion:{},displaybalanceoption:{},totalcalculationmode:{},currencylocale:{},currencydisplay:{},maximumfractiondigits:{},minimumfractiondigits:{},customdisplayformat:{}},[],[],!0);exports.default=ar;
@@ -4538,14 +4538,11 @@ function xn(e) {
4538
4538
  )
4539
4539
  ) : "") + ""
4540
4540
  ), s, f, l, c, m = (
4541
- /*b*/
4542
- (e[51].amount ? (
4543
- /*formatBalance*/
4544
- e[5](
4545
- /*b*/
4546
- e[51].amount
4547
- )
4548
- ) : "0") + ""
4541
+ /*formatBalance*/
4542
+ e[5](
4543
+ /*b*/
4544
+ e[51].amount
4545
+ ) + ""
4549
4546
  ), g;
4550
4547
  return {
4551
4548
  c() {
@@ -4569,14 +4566,11 @@ function xn(e) {
4569
4566
  x[51].productType
4570
4567
  )
4571
4568
  ) : "") + "") && He(s, u), _[0] & /*balances*/
4572
- 8 && m !== (m = /*b*/
4573
- (x[51].amount ? (
4574
- /*formatBalance*/
4575
- x[5](
4576
- /*b*/
4577
- x[51].amount
4578
- )
4579
- ) : "0") + "") && He(g, m);
4569
+ 8 && m !== (m = /*formatBalance*/
4570
+ x[5](
4571
+ /*b*/
4572
+ x[51].amount
4573
+ ) + "") && He(g, m);
4580
4574
  },
4581
4575
  d(x) {
4582
4576
  x && ue(t);
@@ -4607,7 +4601,7 @@ function _n(e) {
4607
4601
  P(t, n);
4608
4602
  },
4609
4603
  p(o, u) {
4610
- if (u[0] & /*balances, formatBalance, $_*/
4604
+ if (u[0] & /*formatBalance, balances, $_*/
4611
4605
  56) {
4612
4606
  r = pt(
4613
4607
  /*balances*/
@@ -1 +1 @@
1
- "use strict";if(typeof window!="undefined"){let n=function(t){return function(...s){try{return t.apply(this,s)}catch(e){if(e instanceof DOMException&&e.message.includes("has already been used with this registry")||e.message.includes("Cannot define multiple custom elements with the same tag name"))return!1;throw e}}};customElements.define=n(customElements.define),Promise.resolve().then(()=>require("../components/PlayerAccountBalanceModal-o151uFa8.cjs")).then(({default:t})=>{!customElements.get("player-account-balance-modal")&&customElements.define("player-account-balance-modal",t.element)})}
1
+ "use strict";if(typeof window!="undefined"){let n=function(t){return function(...s){try{return t.apply(this,s)}catch(e){if(e instanceof DOMException&&e.message.includes("has already been used with this registry")||e.message.includes("Cannot define multiple custom elements with the same tag name"))return!1;throw e}}};customElements.define=n(customElements.define),Promise.resolve().then(()=>require("../components/PlayerAccountBalanceModal-D7AaTOSE.cjs")).then(({default:t})=>{!customElements.get("player-account-balance-modal")&&customElements.define("player-account-balance-modal",t.element)})}
@@ -10,7 +10,7 @@ if (typeof window != "undefined") {
10
10
  }
11
11
  };
12
12
  };
13
- customElements.define = n(customElements.define), import("../components/PlayerAccountBalanceModal-1I-vPd9x.js").then(({ default: t }) => {
13
+ customElements.define = n(customElements.define), import("../components/PlayerAccountBalanceModal-CGnAEFF_.js").then(({ default: t }) => {
14
14
  !customElements.get("player-account-balance-modal") && customElements.define("player-account-balance-modal", t.element);
15
15
  });
16
16
  }
@@ -1,4 +1,4 @@
1
- import { P as a } from "../components/PlayerAccountBalanceModal-C-oVXkiC.js";
1
+ import { P as a } from "../components/PlayerAccountBalanceModal-_d6lzLIx.js";
2
2
  function s(t) {
3
3
  return function(...n) {
4
4
  try {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@everymatrix/player-account-balance-modal",
3
- "version": "1.72.2",
3
+ "version": "1.73.1",
4
4
  "type": "module",
5
5
  "main": "es2015/player-account-balance-modal.cjs",
6
6
  "module": "esnext/player-account-balance-modal.js",