@everymatrix/pam-account-balance-modal 0.1.3 → 0.2.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.
@@ -1,7 +0,0 @@
1
- import{r as t,h as a}from"./p-86b371f2.js";function n(t,a){if(t){const n=document.createElement("style");n.innerHTML=a,t.appendChild(n)}}function o(t,a){const n=new URL(a);fetch(n.href).then((t=>t.text())).then((a=>{const n=document.createElement("style");n.innerHTML=a,t&&t.appendChild(n)})).catch((t=>{console.error("There was an error while trying to load client styling from URL",t)}))}function e(t,a){if(window.emMessageBus){const n=document.createElement("style");window.emMessageBus.subscribe(a,(a=>{n.innerHTML=a,t&&t.appendChild(n)}))}}var i,l,s="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},r={exports:{}};
2
- /** @license
3
- * eventsource.js
4
- * Available under MIT License (MIT)
5
- * https://github.com/Yaffle/EventSource/
6
- */
7
- i=r,l=r.exports,function(t){var a=t.setTimeout,n=t.clearTimeout,o=t.XMLHttpRequest,e=t.XDomainRequest,s=t.ActiveXObject,r=t.EventSource,c=t.document,d=t.Promise,u=t.fetch,h=t.Response,p=t.TextDecoder,f=t.TextEncoder,B=t.AbortController;if("undefined"==typeof window||void 0===c||"readyState"in c||null!=c.body||(c.readyState="loading",window.addEventListener("load",(function(){c.readyState="complete"}),!1)),null==o&&null!=s&&(o=function(){return new s("Microsoft.XMLHTTP")}),null==Object.create&&(Object.create=function(t){function a(){}return a.prototype=t,new a}),Date.now||(Date.now=function(){return(new Date).getTime()}),null==B){var v=u;u=function(t,a){var n=a.signal;return v(t,{headers:a.headers,credentials:a.credentials,cache:a.cache}).then((function(t){var a=t.body.getReader();return n._reader=a,n._aborted&&n._reader.cancel(),{status:t.status,statusText:t.statusText,headers:t.headers,body:{getReader:function(){return a}}}}))},B=function(){this.signal={_reader:null,_aborted:!1},this.abort=function(){null!=this.signal._reader&&this.signal._reader.cancel(),this.signal._aborted=!0}}}function g(){this.bitsNeeded=0,this.codePoint=0}g.prototype.decode=function(t){function a(t,a,n){if(1===n)return t>=128>>a&&t<<a<=2047;if(2===n)return t>=2048>>a&&t<<a<=55295||t>=57344>>a&&t<<a<=65535;if(3===n)return t>=65536>>a&&t<<a<=1114111;throw new Error}function n(t,a){if(6===t)return a>>6>15?3:a>31?2:1;if(12===t)return a>15?3:2;if(18===t)return 3;throw new Error}for(var o=65533,e="",i=this.bitsNeeded,l=this.codePoint,s=0;s<t.length;s+=1){var r=t[s];0!==i&&(r<128||r>191||!a(l<<6|63&r,i-6,n(i,l)))&&(i=0,l=o,e+=String.fromCharCode(l)),0===i?(r>=0&&r<=127?(i=0,l=r):r>=192&&r<=223?(i=6,l=31&r):r>=224&&r<=239?(i=12,l=15&r):r>=240&&r<=247?(i=18,l=7&r):(i=0,l=o),0===i||a(l,i,n(i,l))||(i=0,l=o)):(i-=6,l=l<<6|63&r),0===i&&(l<=65535?e+=String.fromCharCode(l):(e+=String.fromCharCode(55296+(l-65535-1>>10)),e+=String.fromCharCode(56320+(l-65535-1&1023))))}return this.bitsNeeded=i,this.codePoint=l,e},null!=p&&null!=f&&function(){try{return"test"===(new p).decode((new f).encode("test"),{stream:!0})}catch(t){console.debug("TextDecoder does not support streaming option. Using polyfill instead: "+t)}return!1}()||(p=g);var w=function(){};function m(t){this.withCredentials=!1,this.readyState=0,this.status=0,this.statusText="",this.responseText="",this.onprogress=w,this.onload=w,this.onerror=w,this.onreadystatechange=w,this._contentType="",this._xhr=t,this._sendTimeout=0,this._abort=w}function M(t){return t.replace(/[A-Z]/g,(function(t){return String.fromCharCode(t.charCodeAt(0)+32)}))}function y(t){for(var a=Object.create(null),n=t.split("\r\n"),o=0;o<n.length;o+=1){var e=n[o].split(": "),i=e.shift(),l=e.join(": ");a[M(i)]=l}this._map=a}function b(){}function S(t){this._headers=t}function C(){}function x(){this._listeners=Object.create(null)}function T(t){a((function(){throw t}),0)}function A(t){this.type=t,this.target=void 0}function D(t,a){A.call(this,t),this.data=a.data,this.lastEventId=a.lastEventId}function R(t,a){A.call(this,t),this.status=a.status,this.statusText=a.statusText,this.headers=a.headers}function k(t,a){A.call(this,t),this.error=a.error}m.prototype.open=function(t,e){this._abort(!0);var i=this,l=this._xhr,s=1,r=0;this._abort=function(t){0!==i._sendTimeout&&(n(i._sendTimeout),i._sendTimeout=0),1!==s&&2!==s&&3!==s||(s=4,l.onload=w,l.onerror=w,l.onabort=w,l.onprogress=w,l.onreadystatechange=w,l.abort(),0!==r&&(n(r),r=0),t||(i.readyState=4,i.onabort(null),i.onreadystatechange())),s=0};var c=function(){if(1===s){var t=0,a="",n=void 0;if("contentType"in l)t=200,a="OK",n=l.contentType;else try{t=l.status,a=l.statusText,n=l.getResponseHeader("Content-Type")}catch(o){t=0,a="",n=void 0}0!==t&&(s=2,i.readyState=2,i.status=t,i.statusText=a,i._contentType=n,i.onreadystatechange())}},d=function(){if(c(),2===s||3===s){s=3;var t="";try{t=l.responseText}catch(t){}i.readyState=3,i.responseText=t,i.onprogress()}},u=function(t,a){if(null!=a&&null!=a.preventDefault||(a={preventDefault:w}),d(),1===s||2===s||3===s){if(s=4,0!==r&&(n(r),r=0),i.readyState=4,"load"===t)i.onload(a);else if("error"===t)i.onerror(a);else{if("abort"!==t)throw new TypeError;i.onabort(a)}i.onreadystatechange()}},h=function(){r=a((function(){h()}),500),3===l.readyState&&d()};"onload"in l&&(l.onload=function(t){u("load",t)}),"onerror"in l&&(l.onerror=function(t){u("error",t)}),"onabort"in l&&(l.onabort=function(t){u("abort",t)}),"onprogress"in l&&(l.onprogress=d),"onreadystatechange"in l&&(l.onreadystatechange=function(t){!function(t){null!=l&&(4===l.readyState?"onload"in l&&"onerror"in l&&"onabort"in l||u(""===l.responseText?"error":"load",t):3===l.readyState?"onprogress"in l||d():2===l.readyState&&c())}(t)}),!("contentType"in l)&&"ontimeout"in o.prototype||(e+=(-1===e.indexOf("?")?"?":"&")+"padding=true"),l.open(t,e,!0),"readyState"in l&&(r=a((function(){h()}),0))},m.prototype.abort=function(){this._abort(!1)},m.prototype.getResponseHeader=function(){return this._contentType},m.prototype.setRequestHeader=function(t,a){var n=this._xhr;"setRequestHeader"in n&&n.setRequestHeader(t,a)},m.prototype.getAllResponseHeaders=function(){return null!=this._xhr.getAllResponseHeaders&&this._xhr.getAllResponseHeaders()||""},m.prototype.send=function(){if("ontimeout"in o.prototype&&("sendAsBinary"in o.prototype||"mozAnon"in o.prototype)||null==c||null==c.readyState||"complete"===c.readyState){var t=this._xhr;"withCredentials"in t&&(t.withCredentials=this.withCredentials);try{t.send(void 0)}catch(t){throw t}}else{var n=this;n._sendTimeout=a((function(){n._sendTimeout=0,n.send()}),4)}},y.prototype.get=function(t){return this._map[M(t)]},null!=o&&null==o.HEADERS_RECEIVED&&(o.HEADERS_RECEIVED=2),b.prototype.open=function(t,a,n,e,i,l,s){t.open("GET",i);var r=0;for(var c in t.onprogress=function(){var a=t.responseText.slice(r);r+=a.length,n(a)},t.onerror=function(t){t.preventDefault(),e(new Error("NetworkError"))},t.onload=function(){e(null)},t.onabort=function(){e(null)},t.onreadystatechange=function(){if(t.readyState===o.HEADERS_RECEIVED){var n=t.status,e=t.statusText,i=t.getResponseHeader("Content-Type"),l=t.getAllResponseHeaders();a(n,e,i,new y(l))}},t.withCredentials=l,s)Object.prototype.hasOwnProperty.call(s,c)&&t.setRequestHeader(c,s[c]);return t.send(),t},S.prototype.get=function(t){return this._headers.get(t)},C.prototype.open=function(t,a,n,o,e,i,l){var s=null,r=new B,c=r.signal,h=new p;return u(e,{headers:l,credentials:i?"include":"same-origin",signal:c,cache:"no-store"}).then((function(t){return s=t.body.getReader(),a(t.status,t.statusText,t.headers.get("Content-Type"),new S(t.headers)),new d((function(t,a){var o=function(){s.read().then((function(a){if(a.done)t(void 0);else{var e=h.decode(a.value,{stream:!0});n(e),o()}})).catch((function(t){a(t)}))};o()}))})).catch((function(t){return"AbortError"===t.name?void 0:t})).then((function(t){o(t)})),{abort:function(){null!=s&&s.cancel(),r.abort()}}},x.prototype.dispatchEvent=function(t){t.target=this;var a=this._listeners[t.type];if(null!=a)for(var n=a.length,o=0;o<n;o+=1){var e=a[o];try{"function"==typeof e.handleEvent?e.handleEvent(t):e.call(this,t)}catch(t){T(t)}}},x.prototype.addEventListener=function(t,a){t=String(t);var n=this._listeners,o=n[t];null==o&&(n[t]=o=[]);for(var e=!1,i=0;i<o.length;i+=1)o[i]===a&&(e=!0);e||o.push(a)},x.prototype.removeEventListener=function(t,a){t=String(t);var n=this._listeners,o=n[t];if(null!=o){for(var e=[],i=0;i<o.length;i+=1)o[i]!==a&&e.push(o[i]);0===e.length?delete n[t]:n[t]=e}},D.prototype=Object.create(A.prototype),R.prototype=Object.create(A.prototype),k.prototype=Object.create(A.prototype);var P=/^text\/event\-stream(;.*)?$/i,F=function(t,a){var n=null==t?a:parseInt(t,10);return n!=n&&(n=a),L(n)},L=function(t){return Math.min(Math.max(t,1e3),18e6)},O=function(t,a,n){try{"function"==typeof a&&a.call(t,n)}catch(t){T(t)}};function E(t,i){x.call(this),i=i||{},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,function(t,i,l){i=String(i);var s=Boolean(l.withCredentials),r=l.lastEventIdQueryParameterName||"lastEventId",c=L(1e3),d=F(l.heartbeatTimeout,45e3),u="",h=c,p=!1,f=0,B=l.headers||{},v=l.Transport,g=W&&null==v?void 0:new m(null!=v?new v:null!=o&&"withCredentials"in o.prototype||null==e?new o:new e),w=null!=v&&"string"!=typeof v?new v:null==g?new C:new b,M=void 0,y=0,S=-1,x="",T="",A="",E="",z=0,j=0,V=0,I=function(a,n,o,e){if(0===S)if(200===a&&null!=o&&P.test(o)){S=1,p=Date.now(),h=c,t.readyState=1;var i=new R("open",{status:a,statusText:n,headers:e});t.dispatchEvent(i),O(t,t.onopen,i)}else{var l="";200!==a?(n&&(n=n.replace(/\s+/g," ")),l="EventSource's response has a status "+a+" "+n+" that is not 200. Aborting the connection."):l="EventSource's response has a Content-Type specifying an unsupported type: "+(null==o?"-":o.replace(/\s+/g," "))+". Aborting the connection.",$(),i=new R("error",{status:a,statusText:n,headers:e}),t.dispatchEvent(i),O(t,t.onerror,i),console.error(l)}},U=function(o){if(1===S){for(var e=-1,i=0;i<o.length;i+=1)(r=o.charCodeAt(i))!=="\n".charCodeAt(0)&&r!=="\r".charCodeAt(0)||(e=i);var l=(-1!==e?E:"")+o.slice(0,e+1);E=(-1===e?E:"")+o.slice(e+1),""!==o&&(p=Date.now(),f+=o.length);for(var s=0;s<l.length;s+=1){var r=l.charCodeAt(s);if(-1===z&&r==="\n".charCodeAt(0))z=0;else if(-1===z&&(z=0),r==="\r".charCodeAt(0)||r==="\n".charCodeAt(0)){if(0!==z){1===z&&(V=s+1);var B=l.slice(j,V-1),v=l.slice(V+(V<s&&l.charCodeAt(V)===" ".charCodeAt(0)?1:0),s);"data"===B?(x+="\n",x+=v):"id"===B?T=v:"event"===B?A=v:"retry"===B?(c=F(v,c),h=c):"heartbeatTimeout"===B&&(d=F(v,d),0!==y&&(n(y),y=a((function(){G()}),d)))}if(0===z){if(""!==x){u=T,""===A&&(A="message");var g=new D(A,{data:x.slice(1),lastEventId:T});if(t.dispatchEvent(g),"open"===A?O(t,t.onopen,g):"message"===A?O(t,t.onmessage,g):"error"===A&&O(t,t.onerror,g),2===S)return}x="",A=""}z=r==="\r".charCodeAt(0)?-1:0}else 0===z&&(j=s,z=1),1===z?r===":".charCodeAt(0)&&(V=s+1,z=2):2===z&&(z=3)}}},K=function(o){if(1===S||0===S){S=-1,0!==y&&(n(y),y=0),y=a((function(){G()}),h),h=L(Math.min(16*c,2*h)),t.readyState=0;var e=new k("error",{error:o});t.dispatchEvent(e),O(t,t.onerror,e),null!=o&&console.error(o)}},$=function(){S=2,null!=M&&(M.abort(),M=void 0),0!==y&&(n(y),y=0),t.readyState=2},G=function(){if(y=0,-1===S){p=!1,f=0,y=a((function(){G()}),d),S=0,x="",A="",T=u,E="",j=0,V=0,z=0;var n=i;if("data:"!==i.slice(0,5)&&"blob:"!==i.slice(0,5)&&""!==u){var o=i.indexOf("?");n=-1===o?i:i.slice(0,o+1)+i.slice(o+1).replace(/(?:^|&)([^=&]*)(?:=[^&]*)?/g,(function(t,a){return a===r?"":t})),n+=(-1===i.indexOf("?")?"?":"&")+r+"="+encodeURIComponent(u)}var e=t.withCredentials,l={Accept:"text/event-stream"},s=t.headers;if(null!=s)for(var c in s)Object.prototype.hasOwnProperty.call(s,c)&&(l[c]=s[c]);try{M=w.open(g,I,U,K,n,e,l)}catch(t){throw $(),t}}else if(p||null==M){var h=Math.max((p||Date.now())+d-Date.now(),1);p=!1,y=a((function(){G()}),h)}else K(new Error("No activity within "+d+" milliseconds. "+(0===S?"No response received.":f+" chars received.")+" Reconnecting.")),null!=M&&(M.abort(),M=void 0)};t.url=i,t.readyState=0,t.withCredentials=s,t.headers=B,t._close=$,G()}(this,t,i)}var W=null!=u&&null!=h&&"body"in h.prototype;(E.prototype=Object.create(x.prototype)).CONNECTING=0,E.prototype.OPEN=1,E.prototype.CLOSED=2,E.prototype.close=function(){this._close()},E.CONNECTING=0,E.OPEN=1,E.CLOSED=2,E.prototype.withCredentials=void 0;var z,j=r;null==o||null!=r&&"withCredentials"in r.prototype||(j=E),z=function(t){t.EventSourcePolyfill=E,t.NativeEventSource=r,t.EventSource=j}(l),void 0!==z&&(i.exports=z)}("undefined"==typeof globalThis?"undefined"!=typeof window?window:"undefined"!=typeof self?self:s:globalThis);var c={exports:{}};c.exports=function(){function t(i,l){if(!(this instanceof t))return new t(i,l);l=Object.assign({},n,l);var s=Math.pow(10,l.precision);this.intValue=i=a(i,l),this.value=i/s,l.increment=l.increment||1/s,l.groups=l.useVedic?e:o,this.s=l,this.p=s}function a(a,n){var o=!(2<arguments.length&&void 0!==arguments[2])||arguments[2],e=n.decimal,i=n.errorOnInvalid,l=n.fromCents,s=Math.pow(10,n.precision),r=a instanceof t;if(r&&l)return a.intValue;if("number"==typeof a||r)e=r?a.value:a;else if("string"==typeof a)i=new RegExp("[^-\\d"+e+"]","g"),e=new RegExp("\\"+e,"g"),e=(e=a.replace(/\((.*)\)/,"-$1").replace(i,"").replace(e,"."))||0;else{if(i)throw Error("Invalid Input");e=0}return l||(e=(e*s).toFixed(4)),o?Math.round(e):e}var n={symbol:"$",separator:",",decimal:".",errorOnInvalid:!1,precision:2,pattern:"!#",negativePattern:"-!#",format:function(t,a){var n=a.pattern,o=a.negativePattern,e=a.symbol,i=a.separator,l=a.decimal;a=a.groups;var s=(""+t).replace(/^-/,"").split("."),r=s[0];return s=s[1],(0<=t.value?n:o).replace("!",e).replace("#",r.replace(a,"$1"+i)+(s?l+s:""))},fromCents:!1},o=/(\d)(?=(\d{3})+\b)/g,e=/(\d)(?=(\d\d)+\d\b)/g;return t.prototype={add:function(n){var o=this.s,e=this.p;return t((this.intValue+a(n,o))/(o.fromCents?1:e),o)},subtract:function(n){var o=this.s,e=this.p;return t((this.intValue-a(n,o))/(o.fromCents?1:e),o)},multiply:function(a){var n=this.s;return t(this.intValue*a/(n.fromCents?1:Math.pow(10,n.precision)),n)},divide:function(n){var o=this.s;return t(this.intValue/a(n,o,!1),o)},distribute:function(a){var n=this.intValue,o=this.p,e=this.s,i=[],l=Math[0<=n?"floor":"ceil"](n/a),s=Math.abs(n-l*a);for(o=e.fromCents?1:o;0!==a;a--){var r=t(l/o,e);0<s--&&(r=r[0<=n?"add":"subtract"](1/o)),i.push(r)}return i},dollars:function(){return~~this.value},cents:function(){return~~(this.intValue%this.p)},format:function(t){var a=this.s;return"function"==typeof t?t(this,a):a.format(this,Object.assign({},a,t))},toString:function(){var t=this.s,a=t.increment;return(Math.round(this.intValue/this.p/a)*a).toFixed(t.precision)},toJSON:function(){return this.value}},t}();const d=c.exports,u={en:{Title:"Your Balance",Total:"Total Balance",Real:"Cash Balance",Bonus:"Bonus Balance",Credit:"Credit Balance",Casino:"Casino",Sports:"Sports",DepositButton:"Deposit",Loading:"Loading ..."},"zh-hk":{Title:"您的結餘",Total:"總結餘",Real:"現金結餘",Bonus:"紅利結餘",Credit:"信用結餘",Casino:"賭場",Sports:"體育",DepositButton:"存款",Loading:"載入中 ..."},de:{Title:"Ihr Guthaben",Total:"Gesamtguthaben",Real:"Barguthaben",Bonus:"Bonusguthaben",Credit:"Kreditguthaben",Casino:"Casino",Sports:"Sport",DepositButton:"Einzahlen",Loading:"Wird geladen ..."},it:{Title:"Il tuo saldo",Total:"Saldo totale",Real:"Saldo in contanti",Bonus:"Saldo bonus",Credit:"Saldo di credito",Casino:"Casinò",Sports:"Sport",DepositButton:"Deposita",Loading:"Caricamento ..."},fr:{Title:"Votre solde",Total:"Solde total",Real:"Solde en espèces",Bonus:"Solde bonus",Credit:"Solde de crédit",Casino:"Casino",Sports:"Sports",DepositButton:"Dépôt",Loading:"Chargement ..."},es:{Title:"Tu saldo",Total:"Saldo total",Real:"Saldo en efectivo",Bonus:"Saldo de bono",Credit:"Saldo de crédito",Casino:"Casino",Sports:"Deportes",DepositButton:"Depósito",Loading:"Cargando ..."},tr:{Title:"Bakiyeniz",Total:"Toplam Bakiye",Real:"Nakit Bakiye",Bonus:"Bonus Bakiyesi",Credit:"Kredi Bakiyesi",Casino:"Kumarhane",Sports:"Spor",DepositButton:"Yatır",Loading:"Yükleniyor ..."},ru:{Title:"Ваш баланс",Total:"Общий баланс",Real:"Денежный баланс",Bonus:"Бонусный баланс",Credit:"Кредитный баланс",Casino:"Казино",Sports:"Спорт",DepositButton:"Депозит",Loading:"Загружается ..."},ro:{Title:"Soldul tău",Total:"Sold total",Real:"Sold în numerar",Bonus:"Sold bonus",Credit:"Sold credit",Casino:"Cazinou",Sports:"Sporturi",DepositButton:"Depozit",Loading:"Se încarcă ..."},hr:{Title:"Vaš saldo",Total:"Ukupni saldo",Real:"Gotovinski saldo",Bonus:"Bonus saldo",Credit:"Kreditni saldo",Casino:"Casino",Sports:"Sportovi",DepositButton:"Depozit",Loading:"Učitavanje ..."},hu:{Title:"Az egyenleged",Total:"Teljes egyenleg",Real:"Készpénz egyenleg",Bonus:"Bónusz egyenleg",Credit:"Hitel egyenleg",Casino:"Kaszinó",Sports:"Sport",DepositButton:"Befizetés",Loading:"Betöltés ..."},pl:{Title:"Twoje saldo",Total:"Całkowite saldo",Real:"Saldo gotówkowe",Bonus:"Saldo bonusowe",Credit:"Saldo kredytowe",Casino:"Kasyno",Sports:"Sport",DepositButton:"Wpłać",Loading:"Ładowanie ..."},pt:{Title:"Seu Saldo",Total:"Saldo Total",Real:"Saldo em Dinheiro",Bonus:"Saldo de Bônus",Credit:"Saldo de Crédito",Casino:"Cassino",Sports:"Esportes",DepositButton:"Depositar",Loading:"Carregando ..."},sl:{Title:"Vaš saldo",Total:"Skupni saldo",Real:"Gotovinski saldo",Bonus:"Bonus saldo",Credit:"Kreditni saldo",Casino:"Kasino",Sports:"Šport",DepositButton:"Depozit",Loading:"Nalaganje ..."},sr:{Title:"Vaš saldo",Total:"Ukupan saldo",Real:"Gotovinski saldo",Bonus:"Bonus saldo",Credit:"Kreditni saldo",Casino:"Kasino",Sports:"Sport",DepositButton:"Depozit",Loading:"Učitavanje ..."},"pt-br":{Title:"Seu Saldo",Total:"Saldo Total",Real:"Saldo em Dinheiro",Bonus:"Saldo de Bônus",Credit:"Saldo de Crédito",Casino:"Cassino",Sports:"Esportes",DepositButton:"Depositar",Loading:"Carregando ..."},"es-mx":{Title:"Tu saldo",Total:"Saldo total",Real:"Saldo en efectivo",Bonus:"Saldo de bono",Credit:"Saldo de crédito",Casino:"Casino",Sports:"Deportes",DepositButton:"Depósito",Loading:"Cargando ..."},"en-us":{Title:"Your Balance",Total:"Total Balance",Real:"Cash Balance",Bonus:"Bonus Balance",Credit:"Credit Balance",Casino:"Casino",Sports:"Sports",DepositButton:"Deposit",Loading:"Loading ..."}},h=(t,a,n)=>{let o=u[u[a]?a:"en"][t];if(void 0!==n)for(const[t,a]of Object.entries(n.values)){const n=new RegExp(`{${t}}`,"g");o=o.replace(n,a)}return o},p=class{constructor(a){t(this,a),this.totalCalculationModes=["totalCashAmount","totalRealAmount"],this.setLocaleIdentifier=()=>{if(this.customLocaleIdentifier.includes(this.language))return this.customLocaleIdentifier},this.formatBalance=t=>this.customLocaleIdentifier?new Intl.NumberFormat(this.setLocaleIdentifier(),{useGrouping:!0}).format(t):this.currencySeparator&&this.currencyDecimal?d(t,{separator:this.currencySeparator,decimal:this.currencyDecimal,symbol:"",precision:parseInt(this.currencyPrecision||"2",10)}).format():d(t,{separator:".",decimal:",",symbol:"",precision:parseInt(this.currencyPrecision||"2",10)}).format(),this.getBalances=()=>{this.isLoading=!0;const t=new URL(`/v2/player/${this.userId}/balance/`,this.endpoint),a=new Headers;a.append("X-SessionID",this.session);const n={method:"GET",headers:a};return new Promise((a=>fetch(t,n).then((t=>t.json())).then((t=>a(t))).catch((t=>{throw console.log("Balance fetch error",t),new Error("Failed to fetch balance data!")})).finally((()=>this.isLoading=!1))))},this.subscribeToBalanceUpdates=()=>{if(this.currentStream&&this.currentStream.close(),this.session.length<1)return;const t=new URL(`/v2/player/${this.userId}/information/updates/`,this.endpoint),a=new r.exports.EventSourcePolyfill(t,{headers:{accept:"text/event-stream","X-SessionId":this.session}});this.currentStream=a,a.addEventListener("message",this.updateBalances)},this.parseData=t=>{let a;try{a=JSON.parse(t)}catch(t){return void console.log("Balance stream failed: ",t)}return a},this.updateRealAmount=(t,a,n)=>{let o=null;switch(n.walletAccountType){case"Ordinary":n.afterAmount===n.affectedAmount&&0!==a.lastOrdinaryAfterAmount||(a.lastOrdinaryAfterAmount=n.afterAmount,a.showCreditLineAfterAmount||(o=n.afterAmount));break;case"CreditLine":0!==n.afterAmount?(o=n.afterAmount,a.showCreditLineAfterAmount=!0):(o=a.lastOrdinaryAfterAmount,a.showCreditLineAfterAmount=!1);break;default:o=n.afterAmount}return null===o?t:o},this.updateTotalAmount=()=>{switch(this.totalCalculationMode){case"totalCashAmount":let t=0;for(const a of["Real","Bonus"])for(const n of this.balances[a])t+=Math.max(n.amount,0);this.balances.Total[0].amount=t;break;case"totalRealAmount":if(!this.isSplitWallet)return;let a=0;for(const t of this.balances.Real)a+=t.amount;this.balances.Total[0].amount=a}},this.updateBalances=t=>{const a=this.parseData(t.data);if(!a)return void this.subscribeToBalanceUpdates();if("BALANCE_UPDATE_V2"!==a.type)return;const n=a.body.balanceChange;for(const[t,a]of Object.entries(n))if("totalRealAmount"!==this.totalCalculationMode||"Real"!==t||this.isSplitWallet||(this.balances.Total[0].amount=this.updateRealAmount(this.balances.Total[0].amount,this.updateRealAmountState,a)),this.balances[t])for(const n of this.balances[t])this.isSplitWallet?a.productType===n.productType&&(n.amount="Real"===t?this.updateRealAmount(n.amount,this.updateRealAmountState[n.productType],a):a.afterAmount):n.amount="Real"===t?this.updateRealAmount(n.amount,this.updateRealAmountState,a):a.afterAmount;this.updateTotalAmount(),this.balances=Object.assign({},this.balances)},this.balanceModalOpenDeposit=()=>{this.toggleModal("close"),window.postMessage({type:"GoToDeposit"},window.location.href),"function"==typeof gtag&&gtag("event","GoToDeposit",{context:"PlayerAccountBalanceModal"})},this.validateTotalCalculationMode=()=>{this.totalCalculationModes.includes(this.totalCalculationMode)||(console.error(`Unsupported value ('${this.totalCalculationMode}') for totalcalculationmode parameter. Only the following values are supported ${this.totalCalculationModes}. Using default value ('${this.totalCalculationModes[0]}').`),this.totalCalculationMode=this.totalCalculationModes[0])},this.messageHandler=t=>t.data&&"LogoutSuccessfull"===t.data.type&&this.currentStream.close(),this.updateBalanceStyling=()=>{window.postMessage({type:"UpdateBalanceBackground"},window.location.href)},this.toggleModal=t=>{switch(t){case"open":window.postMessage({type:"BalanceModalStatus",status:"open"},window.location.href),this.isModalDisplayed=!0;break;case"close":window.postMessage({type:"BalanceModalStatus",status:"close"},window.location.href),this.isModalDisplayed=!1}},this.userId=void 0,this.session=void 0,this.endpoint=void 0,this.customLocaleIdentifier=void 0,this.displayBalanceOption=void 0,this.totalCalculationMode=void 0,this.currencySeparator=void 0,this.currencyDecimal=void 0,this.currencyPrecision=void 0,this.mbSource=void 0,this.clientStyling=void 0,this.clientStylingUrl=void 0,this.translationUrl=void 0,this.language="en",this.isLoading=!0,this.isModalDisplayed=!1,this.isSplitWallet=!1,this.currentStream=void 0,this.currency=void 0,this.updateRealAmountState=void 0,this.balances={Total:[],Real:[],Bonus:[],Credit:[]}}handleClientStylingChange(t,a){t!=a&&n(this.stylingContainer,this.clientStyling)}handleClientStylingUrlChange(t,a){t!=a&&o(this.stylingContainer,this.clientStylingUrl)}handleMbSourceChange(t,a){t!=a&&e(this.stylingContainer,`${this.mbSource}.Style`)}componentWillLoad(){this.validateTotalCalculationMode(),this.getBalances().then((t=>this.setBalances(t))),this.subscribeToBalanceUpdates()}componentDidLoad(){this.stylingContainer&&(this.mbSource&&e(this.stylingContainer,`${this.mbSource}.Style`),this.clientStyling&&n(this.stylingContainer,this.clientStyling),this.clientStylingUrl&&o(this.stylingContainer,this.clientStylingUrl))}disconnectedCallback(){this.stylingSubscription&&this.stylingSubscription.unsubscribe()}setBalances(t){t[this.totalCalculationMode]||(this.totalCalculationMode=this.totalCalculationModes[0]),this.balances.Total.push({amount:0,productType:""});const a=t.items.find((t=>"Real"===t.type&&"Ordinary"===t.walletAccountType));this.currency=a.currency,this.isSplitWallet=Boolean(a.productType),this.isSplitWallet?this.setBalancesWhenSplitWallet(t):this.setBalancesWhenSingleWallet(t)}setBalancesWhenSingleWallet(t){this.updateRealAmountState={lastOrdinaryAfterAmount:0,showCreditLineAfterAmount:!1},this.balances.Total[0].amount=t[this.totalCalculationMode][this.currency];for(const a of t.items)switch(a.type){case"Bonus":0===this.balances.Bonus.length?this.balances.Bonus.push({amount:a.amount,productType:""}):this.balances.Bonus[0].amount+=a.amount;break;case"Real":if(a.creditLine&&0===this.balances.Credit.length&&this.balances.Credit.push({amount:a.creditLine,productType:""}),"totalRealAmount"===this.totalCalculationMode)continue;0===this.balances.Real.length?this.balances.Real.push({amount:a.amount,productType:""}):this.balances.Real[0].amount+=a.amount}for(const[t,a]of Object.entries(this.balances))a.length<1&&delete this.balances[t]}setBalancesWhenSplitWallet(t){this.updateRealAmountState={Casino:{lastOrdinaryAfterAmount:0,showCreditLineAfterAmount:!1},Sports:{lastOrdinaryAfterAmount:0,showCreditLineAfterAmount:!1}};let a=t.items;this.displayBalanceOption&&"All"!==this.displayBalanceOption&&(a=t.items.filter((t=>t.productType===this.displayBalanceOption)));for(const t of a){let a;switch(t.type){case"Bonus":a=this.balances.Bonus.findIndex((a=>a.productType===t.productType)),a>0?this.balances.Bonus[a].amount+=t.amount:this.balances.Bonus.push({amount:t.amount,productType:t.productType});break;case"Real":t.creditLine&&this.balances.Credit.push({amount:t.creditLine,productType:t.productType}),a=this.balances.Real.findIndex((a=>a.productType===t.productType)),a>0?this.balances.Real[a].amount+=t.amount:this.balances.Real.push({amount:t.amount,productType:t.productType})}}this.updateTotalAmount();for(const[t,a]of Object.entries(this.balances))a.length<1&&delete this.balances[t]}render(){const t=a("button",{class:"BalanceValue",onClick:()=>this.toggleModal("open")},a("p",null,this.balances.Total.length>0?this.formatBalance(this.balances.Total[0].amount):"0"," ",this.currency),a("span",{class:" {isModalDisplayed ? 'TriangleActive' : 'TriangleInactive'}"},a("svg",{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"6.835",viewBox:"0 0 14 6.835"},a("path",{id:"arrow",d:"M281.541,447.921a.488.488,0,0,0,.295-.122l6.5-5.851a.488.488,0,1,0-.65-.726l-6.176,5.556-6.176-5.556h0a.488.488,0,1,0-.65.726l6.5,5.851a.488.488,0,0,0,.355.122Z",transform:"translate(-274.511 -441.088)",fill:"#d1d1d1"})))),n=a("div",{class:this.isModalDisplayed?"BalanceModalWrapper Open":"BalanceModalWrapper"},a("button",{class:"BalanceModalClose",onClick:()=>this.toggleModal("close")}),a("div",{class:"BalanceModal"},a("div",{class:"ModalContent"},a("div",{class:"BalanceModalHeader"},a("p",{class:"BalanceModalTitle"},h("Title",this.language))),a("div",{class:"BalanceModalBody"},Object.keys(this.balances).map((t=>a("div",{class:"BalanceModalRowBoth"},this.balances[t].map((n=>a("div",{class:"BalanceModalRowLine"},a("p",{class:"BalanceModalText"},h(t,this.language)," ",n.productType?h(n.productType,this.language):""),a("p",{class:"BalanceModalValue"},a("span",{class:"BalanceModalAmount"},n.amount?this.formatBalance(n.amount):"0"),a("span",{class:"BalanceModalCurrency"}," "+this.currency))))))))),a("div",{class:"BalanceModalFooter"},a("button",{class:"BalanceModalAction",onClick:()=>this.balanceModalOpenDeposit()},h("DepositButton",this.language)))))),o=a("div",{class:"LoadingSkeleton"},a("ui-skeleton",{structure:"title",height:"20px",width:"auto"}));return a("div",{ref:t=>this.stylingContainer=t},a("div",{class:"PamAccountBalanceModal"},this.isLoading?o:a("div",null,t,n)),this.isModalDisplayed&&a("button",{class:"PamAccountBalanceModalOverlay",onClick:()=>this.toggleModal("close")}))}static get watchers(){return{clientStyling:["handleClientStylingChange"],clientStylingUrl:["handleClientStylingUrlChange"],mbSource:["handleMbSourceChange"]}}};p.style='*,*::before,*::after{font-family:inherit}:host{font-family:inherit}input,textarea,button{font-family:inherit}p{padding:0;margin:0}.PamAccountBalanceModal{position:relative}.PamAccountBalanceModal .LoadingSkeleton{border-radius:10px;overflow:hidden;width:60px}.PamAccountBalanceModal .BalanceValue{font-size:14px;cursor:pointer;background:transparent;border:none;font:inherit;color:inherit;display:flex;flex-wrap:nowrap;white-space:nowrap}.PamAccountBalanceModal .BalanceValue svg{width:16px;fill:var(--emw--color-black, #000000)}.PamAccountBalanceModal .BalanceValue span{padding-left:5px}.PamAccountBalanceModal .BalanceValue .TriangleActive,.PamAccountBalanceModal .BalanceValue .TriangleInactive{display:block;margin:0 3px;transition:all 0.2s}.PamAccountBalanceModal .BalanceValue .TriangleActive:hover,.PamAccountBalanceModal .BalanceValue .TriangleInactive:hover{transform:scale(1.2)}.PamAccountBalanceModal .BalanceValue .TriangleActive svg,.PamAccountBalanceModal .BalanceValue .TriangleInactive svg{margin:2px 0px}.PamAccountBalanceModal .BalanceValue .TriangleActive{transform:scale(1.1) rotateX(180deg) translateY(3px)}.PamAccountBalanceModal .BalanceValue .TriangleActive:hover{transform:scale(1.1) rotateX(180deg) translateY(3px)}@media only screen and (max-width: 360px){.PamAccountBalanceModal .BalanceValue{font-size:12px}.PamAccountBalanceModal .BalanceValue svg{width:12px}}.PamAccountBalanceModal .BalanceModalWrapper{background:linear-gradient(90deg, rgb(42, 79, 55) 0%, rgb(0, 61, 92) 100%);position:absolute;top:40px;padding:10px;transform:translateX(-45%);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;transition:all 0.2s ease-in;opacity:0}.PamAccountBalanceModal .BalanceModalWrapper:before{content:"";background:linear-gradient(90deg, rgb(42, 79, 55) 0%, rgb(0, 61, 92) 100%);clip-path:polygon(50% 0, 0% 100%, 100% 100%);position:absolute;top:-8px;left:50%;width:25px;height:10px;z-index:1}.PamAccountBalanceModal .BalanceModalWrapper .BalanceModalClose{position:absolute;top:5px;right:5px;width:20px;height:20px;z-index:1;cursor:pointer;transition:all 0.3s ease;background:transparent;border:none;font:inherit}.PamAccountBalanceModal .BalanceModalWrapper .BalanceModalClose:before{content:"";background:var(--emw--color-secondary, #FFFFFF);position:absolute;top:8px;left:0;width:20px;height:2px;transform:rotate(45deg)}.PamAccountBalanceModal .BalanceModalWrapper .BalanceModalClose:after{content:"";background:var(--emw--color-secondary, #FFFFFF);position:absolute;top:8px;left:0;width:20px;height:2px;transform:rotate(-45deg)}.PamAccountBalanceModal .BalanceModalWrapper .BalanceModalClose:hover{transform:scale(1.1)}.PamAccountBalanceModal .BalanceModalWrapper .BalanceModal{transition:all 0.2s ease-in;width:270px}.PamAccountBalanceModal .BalanceModalWrapper .BalanceModal .BalanceModalHeader{display:flex;align-items:center;justify-content:center;padding:20px 0}.PamAccountBalanceModal .BalanceModalWrapper .BalanceModal .BalanceModalHeader .BalanceModalTitle{font-size:16px;font-weight:bold;color:var(--emw--header-contrast, var(--emw--color-contrast, #FFFFFF))}.PamAccountBalanceModal .BalanceModalWrapper .BalanceModal .BalanceModalBody .BalanceModalRowBoth{display:flex;flex-direction:column;gap:5px;padding:20px 0;border-bottom:1px solid var(--emw--color-gray-100, #E6E6E6)}.PamAccountBalanceModal .BalanceModalWrapper .BalanceModal .BalanceModalBody .BalanceModalRowBoth:last-child{border-bottom:none}.PamAccountBalanceModal .BalanceModalWrapper .BalanceModal .BalanceModalBody .BalanceModalRowBoth .BalanceModalRowLine{display:flex;width:100%;justify-content:space-between}.PamAccountBalanceModal .BalanceModalWrapper .BalanceModal .BalanceModalBody .BalanceModalRowBoth .BalanceModalText{color:var(--emw--header-contrast, var(--emw--color-contrast, #FFFFFF));font-size:14px;text-transform:capitalize}.PamAccountBalanceModal .BalanceModalWrapper .BalanceModal .BalanceModalBody .BalanceModalRowBoth .BalanceModalValue{font-size:14px;font-weight:bold;color:var(--emw--header-contrast, var(--emw--color-contrast, #FFFFFF))}.PamAccountBalanceModal .BalanceModalWrapper .BalanceModal .BalanceModalFooter{display:flex;align-items:center;padding:20px 0 10px}.PamAccountBalanceModal .BalanceModalWrapper .BalanceModal .BalanceModalFooter .BalanceModalAction{background:var(--emw--color-primary, #22B04E);font-size:12px;color:var(--emw--color-white, #FFFFFF);text-transform:uppercase;width:100%;border-radius:30px;border:none;padding:10px 0;cursor:pointer;transition:all 0.2s ease-in;box-shadow:0px 3px 7px 0px rgba(0, 0, 0, 0.2)}.PamAccountBalanceModal .BalanceModalWrapper .BalanceModal .BalanceModalFooter .BalanceModalAction:hover{background:rgba(255, 255, 255, 0.1);color:var(--emw--color-primary, #22B04E);box-shadow:0px 0px 0px 2px inset var(--emw--color-primary, #22B04E);font-size:14px}.PamAccountBalanceModal .BalanceModalWrapper .BalanceModal .BalanceModalFooter .BalanceModalAction:active{background:rgba(255, 255, 255, 0.5)}.PamAccountBalanceModal .BalanceModalWrapper.Open{opacity:1}.PamAccountBalanceModalOverlay{background-color:rgba(0, 0, 0, 0.7);position:fixed;top:0;bottom:0;left:0;right:0;z-index:16;opacity:0;transition:all 0.2s linear}.PamAccountBalanceModalOverlay.Open{opacity:1}';export{p as P}