@kalamba/sdk 0.35.0 → 0.38.0

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/dist/wrapper.cjs CHANGED
@@ -2,4 +2,743 @@
2
2
  * BSD 3-Clause License
3
3
  * Copyright (c) 2026, Kalamba Games Limited
4
4
  */
5
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const ee=require("./errors-BZBs3Z5K.cjs"),I=require("./v4-BIWLDecr.cjs");var re,Aa;function yu(){if(Aa)return re;Aa=1;function t(){this.__data__=[],this.size=0}return re=t,re}var te,Pa;function D(){if(Pa)return te;Pa=1;function t(e,r){return e===r||e!==e&&r!==r}return te=t,te}var ae,Oa;function z(){if(Oa)return ae;Oa=1;var t=D();function e(r,n){for(var a=r.length;a--;)if(t(r[a][0],n))return a;return-1}return ae=e,ae}var ne,La;function gu(){if(La)return ne;La=1;var t=z(),e=Array.prototype,r=e.splice;function n(a){var i=this.__data__,s=t(i,a);if(s<0)return!1;var u=i.length-1;return s==u?i.pop():r.call(i,s,1),--this.size,!0}return ne=n,ne}var ie,Ia;function bu(){if(Ia)return ie;Ia=1;var t=z();function e(r){var n=this.__data__,a=t(n,r);return a<0?void 0:n[a][1]}return ie=e,ie}var se,Ma;function mu(){if(Ma)return se;Ma=1;var t=z();function e(r){return t(this.__data__,r)>-1}return se=e,se}var ue,Ea;function qu(){if(Ea)return ue;Ea=1;var t=z();function e(r,n){var a=this.__data__,i=t(a,r);return i<0?(++this.size,a.push([r,n])):a[i][1]=n,this}return ue=e,ue}var oe,ka;function $(){if(ka)return oe;ka=1;var t=yu(),e=gu(),r=bu(),n=mu(),a=qu();function i(s){var u=-1,o=s==null?0:s.length;for(this.clear();++u<o;){var f=s[u];this.set(f[0],f[1])}}return i.prototype.clear=t,i.prototype.delete=e,i.prototype.get=r,i.prototype.has=n,i.prototype.set=a,oe=i,oe}var fe,Fa;function wu(){if(Fa)return fe;Fa=1;var t=$();function e(){this.__data__=new t,this.size=0}return fe=e,fe}var ce,Ga;function Ru(){if(Ga)return ce;Ga=1;function t(e){var r=this.__data__,n=r.delete(e);return this.size=r.size,n}return ce=t,ce}var le,Da;function Cu(){if(Da)return le;Da=1;function t(e){return this.__data__.get(e)}return le=t,le}var he,ja;function Su(){if(ja)return he;ja=1;function t(e){return this.__data__.has(e)}return he=t,he}var de,xa;function Ns(){if(xa)return de;xa=1;var t=typeof I.commonjsGlobal=="object"&&I.commonjsGlobal&&I.commonjsGlobal.Object===Object&&I.commonjsGlobal;return de=t,de}var pe,Ba;function M(){if(Ba)return pe;Ba=1;var t=Ns(),e=typeof self=="object"&&self&&self.Object===Object&&self,r=t||e||Function("return this")();return pe=r,pe}var _e,Na;function K(){if(Na)return _e;Na=1;var t=M(),e=t.Symbol;return _e=e,_e}var ve,Ua;function Tu(){if(Ua)return ve;Ua=1;var t=K(),e=Object.prototype,r=e.hasOwnProperty,n=e.toString,a=t?t.toStringTag:void 0;function i(s){var u=r.call(s,a),o=s[a];try{s[a]=void 0;var f=!0}catch{}var l=n.call(s);return f&&(u?s[a]=o:delete s[a]),l}return ve=i,ve}var ye,Ka;function Au(){if(Ka)return ye;Ka=1;var t=Object.prototype,e=t.toString;function r(n){return e.call(n)}return ye=r,ye}var ge,Ha;function j(){if(Ha)return ge;Ha=1;var t=K(),e=Tu(),r=Au(),n="[object Null]",a="[object Undefined]",i=t?t.toStringTag:void 0;function s(u){return u==null?u===void 0?a:n:i&&i in Object(u)?e(u):r(u)}return ge=s,ge}var be,Wa;function E(){if(Wa)return be;Wa=1;function t(e){var r=typeof e;return e!=null&&(r=="object"||r=="function")}return be=t,be}var me,za;function ca(){if(za)return me;za=1;var t=j(),e=E(),r="[object AsyncFunction]",n="[object Function]",a="[object GeneratorFunction]",i="[object Proxy]";function s(u){if(!e(u))return!1;var o=t(u);return o==n||o==a||o==r||o==i}return me=s,me}var qe,$a;function Pu(){if($a)return qe;$a=1;var t=M(),e=t["__core-js_shared__"];return qe=e,qe}var we,Va;function Ou(){if(Va)return we;Va=1;var t=Pu(),e=function(){var n=/[^.]+$/.exec(t&&t.keys&&t.keys.IE_PROTO||"");return n?"Symbol(src)_1."+n:""}();function r(n){return!!e&&e in n}return we=r,we}var Re,Qa;function Us(){if(Qa)return Re;Qa=1;var t=Function.prototype,e=t.toString;function r(n){if(n!=null){try{return e.call(n)}catch{}try{return n+""}catch{}}return""}return Re=r,Re}var Ce,Ja;function Lu(){if(Ja)return Ce;Ja=1;var t=ca(),e=Ou(),r=E(),n=Us(),a=/[\\^$.*+?()[\]{}|]/g,i=/^\[object .+?Constructor\]$/,s=Function.prototype,u=Object.prototype,o=s.toString,f=u.hasOwnProperty,l=RegExp("^"+o.call(f).replace(a,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function c(h){if(!r(h)||e(h))return!1;var _=t(h)?l:i;return _.test(n(h))}return Ce=c,Ce}var Se,Xa;function Iu(){if(Xa)return Se;Xa=1;function t(e,r){return e?.[r]}return Se=t,Se}var Te,Ya;function F(){if(Ya)return Te;Ya=1;var t=Lu(),e=Iu();function r(n,a){var i=e(n,a);return t(i)?i:void 0}return Te=r,Te}var Ae,Za;function la(){if(Za)return Ae;Za=1;var t=F(),e=M(),r=t(e,"Map");return Ae=r,Ae}var Pe,en;function V(){if(en)return Pe;en=1;var t=F(),e=t(Object,"create");return Pe=e,Pe}var Oe,rn;function Mu(){if(rn)return Oe;rn=1;var t=V();function e(){this.__data__=t?t(null):{},this.size=0}return Oe=e,Oe}var Le,tn;function Eu(){if(tn)return Le;tn=1;function t(e){var r=this.has(e)&&delete this.__data__[e];return this.size-=r?1:0,r}return Le=t,Le}var Ie,an;function ku(){if(an)return Ie;an=1;var t=V(),e="__lodash_hash_undefined__",r=Object.prototype,n=r.hasOwnProperty;function a(i){var s=this.__data__;if(t){var u=s[i];return u===e?void 0:u}return n.call(s,i)?s[i]:void 0}return Ie=a,Ie}var Me,nn;function Fu(){if(nn)return Me;nn=1;var t=V(),e=Object.prototype,r=e.hasOwnProperty;function n(a){var i=this.__data__;return t?i[a]!==void 0:r.call(i,a)}return Me=n,Me}var Ee,sn;function Gu(){if(sn)return Ee;sn=1;var t=V(),e="__lodash_hash_undefined__";function r(n,a){var i=this.__data__;return this.size+=this.has(n)?0:1,i[n]=t&&a===void 0?e:a,this}return Ee=r,Ee}var ke,un;function Du(){if(un)return ke;un=1;var t=Mu(),e=Eu(),r=ku(),n=Fu(),a=Gu();function i(s){var u=-1,o=s==null?0:s.length;for(this.clear();++u<o;){var f=s[u];this.set(f[0],f[1])}}return i.prototype.clear=t,i.prototype.delete=e,i.prototype.get=r,i.prototype.has=n,i.prototype.set=a,ke=i,ke}var Fe,on;function ju(){if(on)return Fe;on=1;var t=Du(),e=$(),r=la();function n(){this.size=0,this.__data__={hash:new t,map:new(r||e),string:new t}}return Fe=n,Fe}var Ge,fn;function xu(){if(fn)return Ge;fn=1;function t(e){var r=typeof e;return r=="string"||r=="number"||r=="symbol"||r=="boolean"?e!=="__proto__":e===null}return Ge=t,Ge}var De,cn;function Q(){if(cn)return De;cn=1;var t=xu();function e(r,n){var a=r.__data__;return t(n)?a[typeof n=="string"?"string":"hash"]:a.map}return De=e,De}var je,ln;function Bu(){if(ln)return je;ln=1;var t=Q();function e(r){var n=t(this,r).delete(r);return this.size-=n?1:0,n}return je=e,je}var xe,hn;function Nu(){if(hn)return xe;hn=1;var t=Q();function e(r){return t(this,r).get(r)}return xe=e,xe}var Be,dn;function Uu(){if(dn)return Be;dn=1;var t=Q();function e(r){return t(this,r).has(r)}return Be=e,Be}var Ne,pn;function Ku(){if(pn)return Ne;pn=1;var t=Q();function e(r,n){var a=t(this,r),i=a.size;return a.set(r,n),this.size+=a.size==i?0:1,this}return Ne=e,Ne}var Ue,_n;function ha(){if(_n)return Ue;_n=1;var t=ju(),e=Bu(),r=Nu(),n=Uu(),a=Ku();function i(s){var u=-1,o=s==null?0:s.length;for(this.clear();++u<o;){var f=s[u];this.set(f[0],f[1])}}return i.prototype.clear=t,i.prototype.delete=e,i.prototype.get=r,i.prototype.has=n,i.prototype.set=a,Ue=i,Ue}var Ke,vn;function Hu(){if(vn)return Ke;vn=1;var t=$(),e=la(),r=ha(),n=200;function a(i,s){var u=this.__data__;if(u instanceof t){var o=u.__data__;if(!e||o.length<n-1)return o.push([i,s]),this.size=++u.size,this;u=this.__data__=new r(o)}return u.set(i,s),this.size=u.size,this}return Ke=a,Ke}var He,yn;function da(){if(yn)return He;yn=1;var t=$(),e=wu(),r=Ru(),n=Cu(),a=Su(),i=Hu();function s(u){var o=this.__data__=new t(u);this.size=o.size}return s.prototype.clear=e,s.prototype.delete=r,s.prototype.get=n,s.prototype.has=a,s.prototype.set=i,He=s,He}var We,gn;function Ks(){if(gn)return We;gn=1;var t=F(),e=function(){try{var r=t(Object,"defineProperty");return r({},"",{}),r}catch{}}();return We=e,We}var ze,bn;function pa(){if(bn)return ze;bn=1;var t=Ks();function e(r,n,a){n=="__proto__"&&t?t(r,n,{configurable:!0,enumerable:!0,value:a,writable:!0}):r[n]=a}return ze=e,ze}var $e,mn;function Hs(){if(mn)return $e;mn=1;var t=pa(),e=D();function r(n,a,i){(i!==void 0&&!e(n[a],i)||i===void 0&&!(a in n))&&t(n,a,i)}return $e=r,$e}var Ve,qn;function Wu(){if(qn)return Ve;qn=1;function t(e){return function(r,n,a){for(var i=-1,s=Object(r),u=a(r),o=u.length;o--;){var f=u[e?o:++i];if(n(s[f],f,s)===!1)break}return r}}return Ve=t,Ve}var Qe,wn;function Ws(){if(wn)return Qe;wn=1;var t=Wu(),e=t();return Qe=e,Qe}var B={exports:{}};B.exports;var Rn;function zu(){return Rn||(Rn=1,function(t,e){var r=M(),n=e&&!e.nodeType&&e,a=n&&!0&&t&&!t.nodeType&&t,i=a&&a.exports===n,s=i?r.Buffer:void 0,u=s?s.allocUnsafe:void 0;function o(f,l){if(l)return f.slice();var c=f.length,h=u?u(c):new f.constructor(c);return f.copy(h),h}t.exports=o}(B,B.exports)),B.exports}var Je,Cn;function zs(){if(Cn)return Je;Cn=1;var t=M(),e=t.Uint8Array;return Je=e,Je}var Xe,Sn;function $u(){if(Sn)return Xe;Sn=1;var t=zs();function e(r){var n=new r.constructor(r.byteLength);return new t(n).set(new t(r)),n}return Xe=e,Xe}var Ye,Tn;function Vu(){if(Tn)return Ye;Tn=1;var t=$u();function e(r,n){var a=n?t(r.buffer):r.buffer;return new r.constructor(a,r.byteOffset,r.length)}return Ye=e,Ye}var Ze,An;function $s(){if(An)return Ze;An=1;function t(e,r){var n=-1,a=e.length;for(r||(r=Array(a));++n<a;)r[n]=e[n];return r}return Ze=t,Ze}var er,Pn;function _a(){if(Pn)return er;Pn=1;var t=E(),e=Object.create,r=function(){function n(){}return function(a){if(!t(a))return{};if(e)return e(a);n.prototype=a;var i=new n;return n.prototype=void 0,i}}();return er=r,er}var rr,On;function Vs(){if(On)return rr;On=1;function t(e,r){return function(n){return e(r(n))}}return rr=t,rr}var tr,Ln;function Qs(){if(Ln)return tr;Ln=1;var t=Vs(),e=t(Object.getPrototypeOf,Object);return tr=e,tr}var ar,In;function va(){if(In)return ar;In=1;var t=Object.prototype;function e(r){var n=r&&r.constructor,a=typeof n=="function"&&n.prototype||t;return r===a}return ar=e,ar}var nr,Mn;function Qu(){if(Mn)return nr;Mn=1;var t=_a(),e=Qs(),r=va();function n(a){return typeof a.constructor=="function"&&!r(a)?t(e(a)):{}}return nr=n,nr}var ir,En;function k(){if(En)return ir;En=1;function t(e){return e!=null&&typeof e=="object"}return ir=t,ir}var sr,kn;function Ju(){if(kn)return sr;kn=1;var t=j(),e=k(),r="[object Arguments]";function n(a){return e(a)&&t(a)==r}return sr=n,sr}var ur,Fn;function J(){if(Fn)return ur;Fn=1;var t=Ju(),e=k(),r=Object.prototype,n=r.hasOwnProperty,a=r.propertyIsEnumerable,i=t(function(){return arguments}())?t:function(s){return e(s)&&n.call(s,"callee")&&!a.call(s,"callee")};return ur=i,ur}var or,Gn;function L(){if(Gn)return or;Gn=1;var t=Array.isArray;return or=t,or}var fr,Dn;function ya(){if(Dn)return fr;Dn=1;var t=9007199254740991;function e(r){return typeof r=="number"&&r>-1&&r%1==0&&r<=t}return fr=e,fr}var cr,jn;function x(){if(jn)return cr;jn=1;var t=ca(),e=ya();function r(n){return n!=null&&e(n.length)&&!t(n)}return cr=r,cr}var lr,xn;function Xu(){if(xn)return lr;xn=1;var t=x(),e=k();function r(n){return e(n)&&t(n)}return lr=r,lr}var N={exports:{}},hr,Bn;function Yu(){if(Bn)return hr;Bn=1;function t(){return!1}return hr=t,hr}N.exports;var Nn;function ga(){return Nn||(Nn=1,function(t,e){var r=M(),n=Yu(),a=e&&!e.nodeType&&e,i=a&&!0&&t&&!t.nodeType&&t,s=i&&i.exports===a,u=s?r.Buffer:void 0,o=u?u.isBuffer:void 0,f=o||n;t.exports=f}(N,N.exports)),N.exports}var dr,Un;function Zu(){if(Un)return dr;Un=1;var t=j(),e=Qs(),r=k(),n="[object Object]",a=Function.prototype,i=Object.prototype,s=a.toString,u=i.hasOwnProperty,o=s.call(Object);function f(l){if(!r(l)||t(l)!=n)return!1;var c=e(l);if(c===null)return!0;var h=u.call(c,"constructor")&&c.constructor;return typeof h=="function"&&h instanceof h&&s.call(h)==o}return dr=f,dr}var pr,Kn;function eo(){if(Kn)return pr;Kn=1;var t=j(),e=ya(),r=k(),n="[object Arguments]",a="[object Array]",i="[object Boolean]",s="[object Date]",u="[object Error]",o="[object Function]",f="[object Map]",l="[object Number]",c="[object Object]",h="[object RegExp]",_="[object Set]",w="[object String]",p="[object WeakMap]",g="[object ArrayBuffer]",y="[object DataView]",d="[object Float32Array]",S="[object Float64Array]",b="[object Int8Array]",C="[object Int16Array]",m="[object Int32Array]",v="[object Uint8Array]",R="[object Uint8ClampedArray]",A="[object Uint16Array]",T="[object Uint32Array]",q={};q[d]=q[S]=q[b]=q[C]=q[m]=q[v]=q[R]=q[A]=q[T]=!0,q[n]=q[a]=q[g]=q[i]=q[y]=q[s]=q[u]=q[o]=q[f]=q[l]=q[c]=q[h]=q[_]=q[w]=q[p]=!1;function O(P){return r(P)&&e(P.length)&&!!q[t(P)]}return pr=O,pr}var _r,Hn;function Js(){if(Hn)return _r;Hn=1;function t(e){return function(r){return e(r)}}return _r=t,_r}var U={exports:{}};U.exports;var Wn;function ro(){return Wn||(Wn=1,function(t,e){var r=Ns(),n=e&&!e.nodeType&&e,a=n&&!0&&t&&!t.nodeType&&t,i=a&&a.exports===n,s=i&&r.process,u=function(){try{var o=a&&a.require&&a.require("util").types;return o||s&&s.binding&&s.binding("util")}catch{}}();t.exports=u}(U,U.exports)),U.exports}var vr,zn;function ba(){if(zn)return vr;zn=1;var t=eo(),e=Js(),r=ro(),n=r&&r.isTypedArray,a=n?e(n):t;return vr=a,vr}var yr,$n;function Xs(){if($n)return yr;$n=1;function t(e,r){if(!(r==="constructor"&&typeof e[r]=="function")&&r!="__proto__")return e[r]}return yr=t,yr}var gr,Vn;function to(){if(Vn)return gr;Vn=1;var t=pa(),e=D(),r=Object.prototype,n=r.hasOwnProperty;function a(i,s,u){var o=i[s];(!(n.call(i,s)&&e(o,u))||u===void 0&&!(s in i))&&t(i,s,u)}return gr=a,gr}var br,Qn;function ao(){if(Qn)return br;Qn=1;var t=to(),e=pa();function r(n,a,i,s){var u=!i;i||(i={});for(var o=-1,f=a.length;++o<f;){var l=a[o],c=s?s(i[l],n[l],l,i,n):void 0;c===void 0&&(c=n[l]),u?e(i,l,c):t(i,l,c)}return i}return br=r,br}var mr,Jn;function no(){if(Jn)return mr;Jn=1;function t(e,r){for(var n=-1,a=Array(e);++n<e;)a[n]=r(n);return a}return mr=t,mr}var qr,Xn;function ma(){if(Xn)return qr;Xn=1;var t=9007199254740991,e=/^(?:0|[1-9]\d*)$/;function r(n,a){var i=typeof n;return a=a??t,!!a&&(i=="number"||i!="symbol"&&e.test(n))&&n>-1&&n%1==0&&n<a}return qr=r,qr}var wr,Yn;function Ys(){if(Yn)return wr;Yn=1;var t=no(),e=J(),r=L(),n=ga(),a=ma(),i=ba(),s=Object.prototype,u=s.hasOwnProperty;function o(f,l){var c=r(f),h=!c&&e(f),_=!c&&!h&&n(f),w=!c&&!h&&!_&&i(f),p=c||h||_||w,g=p?t(f.length,String):[],y=g.length;for(var d in f)(l||u.call(f,d))&&!(p&&(d=="length"||_&&(d=="offset"||d=="parent")||w&&(d=="buffer"||d=="byteLength"||d=="byteOffset")||a(d,y)))&&g.push(d);return g}return wr=o,wr}var Rr,Zn;function io(){if(Zn)return Rr;Zn=1;function t(e){var r=[];if(e!=null)for(var n in Object(e))r.push(n);return r}return Rr=t,Rr}var Cr,ei;function so(){if(ei)return Cr;ei=1;var t=E(),e=va(),r=io(),n=Object.prototype,a=n.hasOwnProperty;function i(s){if(!t(s))return r(s);var u=e(s),o=[];for(var f in s)f=="constructor"&&(u||!a.call(s,f))||o.push(f);return o}return Cr=i,Cr}var Sr,ri;function Zs(){if(ri)return Sr;ri=1;var t=Ys(),e=so(),r=x();function n(a){return r(a)?t(a,!0):e(a)}return Sr=n,Sr}var Tr,ti;function uo(){if(ti)return Tr;ti=1;var t=ao(),e=Zs();function r(n){return t(n,e(n))}return Tr=r,Tr}var Ar,ai;function oo(){if(ai)return Ar;ai=1;var t=Hs(),e=zu(),r=Vu(),n=$s(),a=Qu(),i=J(),s=L(),u=Xu(),o=ga(),f=ca(),l=E(),c=Zu(),h=ba(),_=Xs(),w=uo();function p(g,y,d,S,b,C,m){var v=_(g,d),R=_(y,d),A=m.get(R);if(A){t(g,d,A);return}var T=C?C(v,R,d+"",g,y,m):void 0,q=T===void 0;if(q){var O=s(R),P=!O&&o(R),G=!O&&!P&&h(R);T=R,O||P||G?s(v)?T=v:u(v)?T=n(v):P?(q=!1,T=e(R,!0)):G?(q=!1,T=r(R,!0)):T=[]:c(R)||i(R)?(T=v,i(v)?T=w(v):(!l(v)||f(v))&&(T=a(R))):q=!1}q&&(m.set(R,T),b(T,R,S,C,m),m.delete(R)),t(g,d,T)}return Ar=p,Ar}var Pr,ni;function fo(){if(ni)return Pr;ni=1;var t=da(),e=Hs(),r=Ws(),n=oo(),a=E(),i=Zs(),s=Xs();function u(o,f,l,c,h){o!==f&&r(f,function(_,w){if(h||(h=new t),a(_))n(o,f,w,l,u,c,h);else{var p=c?c(s(o,w),_,w+"",o,f,h):void 0;p===void 0&&(p=_),e(o,w,p)}},i)}return Pr=u,Pr}var Or,ii;function X(){if(ii)return Or;ii=1;function t(e){return e}return Or=t,Or}var Lr,si;function co(){if(si)return Lr;si=1;function t(e,r,n){switch(n.length){case 0:return e.call(r);case 1:return e.call(r,n[0]);case 2:return e.call(r,n[0],n[1]);case 3:return e.call(r,n[0],n[1],n[2])}return e.apply(r,n)}return Lr=t,Lr}var Ir,ui;function eu(){if(ui)return Ir;ui=1;var t=co(),e=Math.max;function r(n,a,i){return a=e(a===void 0?n.length-1:a,0),function(){for(var s=arguments,u=-1,o=e(s.length-a,0),f=Array(o);++u<o;)f[u]=s[a+u];u=-1;for(var l=Array(a+1);++u<a;)l[u]=s[u];return l[a]=i(f),t(n,this,l)}}return Ir=r,Ir}var Mr,oi;function lo(){if(oi)return Mr;oi=1;function t(e){return function(){return e}}return Mr=t,Mr}var Er,fi;function ho(){if(fi)return Er;fi=1;var t=lo(),e=Ks(),r=X(),n=e?function(a,i){return e(a,"toString",{configurable:!0,enumerable:!1,value:t(i),writable:!0})}:r;return Er=n,Er}var kr,ci;function po(){if(ci)return kr;ci=1;var t=800,e=16,r=Date.now;function n(a){var i=0,s=0;return function(){var u=r(),o=e-(u-s);if(s=u,o>0){if(++i>=t)return arguments[0]}else i=0;return a.apply(void 0,arguments)}}return kr=n,kr}var Fr,li;function ru(){if(li)return Fr;li=1;var t=ho(),e=po(),r=e(t);return Fr=r,Fr}var Gr,hi;function tu(){if(hi)return Gr;hi=1;var t=X(),e=eu(),r=ru();function n(a,i){return r(e(a,i,t),a+"")}return Gr=n,Gr}var Dr,di;function au(){if(di)return Dr;di=1;var t=D(),e=x(),r=ma(),n=E();function a(i,s,u){if(!n(u))return!1;var o=typeof s;return(o=="number"?e(u)&&r(s,u.length):o=="string"&&s in u)?t(u[s],i):!1}return Dr=a,Dr}var jr,pi;function _o(){if(pi)return jr;pi=1;var t=tu(),e=au();function r(n){return t(function(a,i){var s=-1,u=i.length,o=u>1?i[u-1]:void 0,f=u>2?i[2]:void 0;for(o=n.length>3&&typeof o=="function"?(u--,o):void 0,f&&e(i[0],i[1],f)&&(o=u<3?void 0:o,u=1),a=Object(a);++s<u;){var l=i[s];l&&n(a,l,s,o)}return a})}return jr=r,jr}var xr,_i;function vo(){if(_i)return xr;_i=1;var t=fo(),e=_o(),r=e(function(n,a,i){t(n,a,i)});return xr=r,xr}var yo=vo();const W=I.getDefaultExportFromCjs(yo);class go{#e=new Map;register(e,r){this.#e.set(e,r)}unregister(e){this.#e.delete(e)}async getPayload(e){if(this.#e.size===0)return;const r={};for(const n of this.#e.values()){const a=typeof n=="function"?await n(e):n;W(r,a)}return r}}const vi=()=>{},bo=()=>{};class mo{#e;#s;#n={dataDecoder:void 0,dataEncoder:void 0,gameName:"UNKNOWN",gameVersion:"unknown",showErrors:!0,showFreeRounds:!0,showPromoPanel:!1,showRealityCheck:!0,showBars:!0,skipErrors:[]};#a={isSdkConfigured:!1,balance:0,bet:{base:0,multiplier:0},openGameResponse:void 0,lastPlayResponse:void 0,freeRoundId:void 0};#i;#r;#t;constructor({messagePort:e,plugins:r,sdkConfigManager:n}){this.#e=e,this.#i=new n,this.#r=new go,this.injectPayload=this.injectPayload.bind(this),this.#s={rgs:new r.rgs(this.config,this.sdkConfig),casino:r.casino.map(a=>new a(this.config,this.sdkConfig,this.state,this.injectPayload)),telemetry:r.telemetry.map(({plugin:a,trackers:i})=>new a(i.map(s=>new s(this.config,this.sdkConfig)),this.config,this.sdkConfig))},this.on("balance",({balance:a})=>{this.setState(i=>({...i,balance:a}))}),this.on("bet",a=>{this.setState(i=>({...i,bet:a}))}),this.on("sdk:playCycleStart",async()=>{await this.requestWakeLock(),!this.state.freeRoundId&&this.setState(a=>({...a,balance:a.balance-a.bet.base*a.bet.multiplier}))}),this.on("sdk:play",async a=>{const i=await this.#r.getPayload(a.contract);this.send("play",{...a,payloadToInject:i})}),this.on("sdk:configure",a=>{Object.assign(this.#n,a)}),this.on("freeRoundsPopup",()=>{const a=(this.state.lastPlayResponse??this.state.openGameResponse)?.freeRounds[0];a&&this.state.freeRoundId&&this.send("freeRoundsInfo",a)}),this.on("rgs:openGameResponse",async a=>{this.setState(i=>({...i,openGameResponse:a.contract})),this.sdkConfig.api.integration!=="bspot"&&this.setState(i=>({...i,balance:a.contract.balance.coins})),this.on("playReady",()=>{this.handleFreeRounds(a.contract.freeRounds[0])}),this.sdkConfig.ui=await this.#i.getConfig(),this.setState(i=>({...i,isSdkConfigured:!0})),this.send("configured",this.sdkConfig)}),this.on("rgs:openGameError",async a=>{a.type==="timeout"&&!this.config.skipErrors.includes("TIMEOUT")&&this.send("error",{messageKey:"Error.TIMEOUT",messageCode:"TIMEOUT",type:"RELOAD"}),a.type==="error"&&!this.config.skipErrors.includes(a.data.code)&&this.send("error",{messageKey:`RgsError.${a.data.code}`,messageCode:a.data.code,type:ee.RgsErrorAction[a.data.code]})}),this.on("rgs:playResponse",async a=>{this.setState(i=>({...i,lastPlayResponse:a.contract}))}),this.on("playCycleEnd",()=>{this.releaseWakeLock(),this.sdkConfig.api.integration!=="bspot"&&this.setState(a=>({...a,balance:this.state.lastPlayResponse.balance.coins})),this.handleFreeRounds(this.state.lastPlayResponse.freeRounds[0])}),this.on("rgs:playError",async a=>{a.type==="timeout"&&!this.config.skipErrors.includes("TIMEOUT")&&this.send("error",{messageKey:"Error.TIMEOUT",messageCode:"TIMEOUT",type:"RELOAD"}),a.type==="error"&&!this.config.skipErrors.includes(a.data.code)&&this.send("error",{messageKey:`RgsError.${a.data.code}`,messageCode:a.data.code,type:ee.RgsErrorAction[a.data.code]})}),this.on("rgs:freeRoundsResponse",async a=>{if(a.action==="ACCEPT"){const i=(this.state.lastPlayResponse??this.state.openGameResponse)?.freeRounds[0];this.activateFreeRounds(i)}}),this.on("rgs:freeRoundsError",async a=>{a.type==="timeout"&&!this.config.skipErrors.includes("TIMEOUT")&&this.send("error",{messageKey:"Error.TIMEOUT",messageCode:"TIMEOUT",type:"RELOAD"}),a.type==="error"&&!this.config.skipErrors.includes(a.data.code)&&this.send("error",{messageKey:`RgsError.${a.data.code}`,messageCode:a.data.code,type:ee.RgsErrorAction[a.data.code]})}),this.forwardMessages(),document.addEventListener("visibilitychange",async()=>{this.#t&&document.visibilityState==="visible"&&await this.requestWakeLock()})}get state(){const e=this;return new Proxy({},{get(r,n){return Reflect.get(e.#a,n)}})}setState(e){this.#a=e(this.#a),this.send("state",this.#a)}forwardMessages(){this.forwardToPlugins("casino",["sdk:autoplay","sdk:bet","sdk:cashier","sdk:choice","sdk:close","sdk:error","sdk:history","sdk:loadEnd","sdk:loadProgress","sdk:loadStart","sdk:playReady","sdk:playCycleEnd","sdk:playCycleStart","sdk:playEnd","sdk:playStart","sdk:settings","sdk:openGame","sdk:configure","sdk:fullscreen"]),this.forwardToPlugins("casino",["rgs:playResponse","rgs:openGameResponse"]),this.forwardToPlugins("rgs",["sdk:openGame","sdk:history"]),this.forwardToPlugins("rgs",["casino:play","casino:cashier","casino:close","casino:history","casino:getBalance"]),this.forwardToPlugins("telemetry",["sdk:autoplay","sdk:error","sdk:playCycleStart","sdk:playCycleEnd","sdk:loadStart","sdk:loadProgress","sdk:loadEnd","sdk:telemetry.click","sdk:telemetry.orientationChange"]),this.forwardToPlugins("telemetry",["rgs:openGameResponse","rgs:playResponse"]),this.forwardToSdk(["casino:balance","casino:bet","casino:choice","casino:freeze","casino:help","casino:paytable","casino:resume","casino:settings","casino:suspend","casino:unfreeze"]),this.forwardToSdk(["rgs:balance","rgs:openGameError","rgs:openGameResponse","rgs:playError","rgs:playResponse","rgs:realityCheck"])}get config(){const e=this;return new Proxy({},{get(r,n){return Reflect.get(e.#n,n)},set(r,n,a){return Reflect.set(e.#n,n,a)}})}get sdkConfig(){return this.#i.config}forwardToPlugins(e,r){r.forEach(n=>{const a=i=>{i.data.message===`kalamba:${n}`&&(vi("wrapper:forwardToPlugins",e,i.data.message.replace(/^kalamba:/,""),i.data.payload),window.postMessage({message:`kalamba:wrapper-${e}:${n.replace(/^(.+):/,"")}`,payload:i.data.payload}))};window.addEventListener("message",a)})}forwardToSdk(e){e.forEach(r=>{const n=a=>{a.data.message===`kalamba:${r}`&&(bo("wrapper:forwardToSdk",a.data.message.replace(/^kalamba:/,""),a.data.payload),this.#e.postMessage({message:`kalamba:wrapper:${r.replace(/^(.+):/,"")}`,payload:a.data.payload},"*"))};window.addEventListener("message",n)})}on(e,r,n){const a=function i(s){!new RegExp(`^kalamba:${e.includes(":")?"":"(.+):"}${e}$`).test(s.data.message)||new RegExp(`^kalamba:wrapper-(.+):${e}`).test(s.data.message)||new RegExp(`^kalamba:(.+)-wrapper:${e}`).test(s.data.message)||(vi("on",s.data.message.replace(/^kalamba:/,""),s.data.payload),r(s.data.payload),n?.once&&window.removeEventListener("message",i))};window.addEventListener("message",a)}send(e,...[r]){window.postMessage({message:`kalamba:wrapper:${e}`,payload:r}),this.#e.postMessage({message:`kalamba:wrapper:${e}`,payload:r},"*")}injectPayload(...[e,r]){return this.#r.register(e,r),()=>this.#r.unregister(e)}activateFreeRounds(e){e&&(this.setState(r=>({...r,freeRoundId:e.id})),this.#r.register("freeRounds",{freeRoundId:e.id}),this.send("legalBets",{[e.conf.base]:[e.conf.multiplier]}),this.send("bet",{base:e.conf.base,multiplier:e.conf.multiplier}))}handleFreeRounds(e){if(e)switch(e.status){case"ACTIVE":this.activateFreeRounds(e);break;case"PENDING":this.send("freeRoundsOffer",e);break;case"FINISHED":this.send("freeRoundsComplete",e),this.setState(r=>({...r,freeRoundId:void 0})),this.#r.unregister("freeRounds"),this.send("legalBets",this.state.openGameResponse.bet.available),this.send("bet",this.state.openGameResponse.bet.default);break}}async requestWakeLock(){try{const e=await navigator.wakeLock.request("screen");this.#t=e}catch{}}async releaseWakeLock(){this.#t&&(await this.#t.release(),this.#t=void 0)}}var Br,yi;function qa(){if(yi)return Br;yi=1;function t(){}return Br=t,Br}var Nr,gi;function wa(){if(gi)return Nr;gi=1;var t=_a(),e=qa();function r(n,a){this.__wrapped__=n,this.__actions__=[],this.__chain__=!!a,this.__index__=0,this.__values__=void 0}return r.prototype=t(e.prototype),r.prototype.constructor=r,Nr=r,Nr}var Ur,bi;function nu(){if(bi)return Ur;bi=1;function t(e,r){for(var n=-1,a=r.length,i=e.length;++n<a;)e[i+n]=r[n];return e}return Ur=t,Ur}var Kr,mi;function qo(){if(mi)return Kr;mi=1;var t=K(),e=J(),r=L(),n=t?t.isConcatSpreadable:void 0;function a(i){return r(i)||e(i)||!!(n&&i&&i[n])}return Kr=a,Kr}var Hr,qi;function iu(){if(qi)return Hr;qi=1;var t=nu(),e=qo();function r(n,a,i,s,u){var o=-1,f=n.length;for(i||(i=e),u||(u=[]);++o<f;){var l=n[o];a>0&&i(l)?a>1?r(l,a-1,i,s,u):t(u,l):s||(u[u.length]=l)}return u}return Hr=r,Hr}var Wr,wi;function wo(){if(wi)return Wr;wi=1;var t=iu();function e(r){var n=r==null?0:r.length;return n?t(r,1):[]}return Wr=e,Wr}var zr,Ri;function Ro(){if(Ri)return zr;Ri=1;var t=wo(),e=eu(),r=ru();function n(a){return r(e(a,void 0,t),a+"")}return zr=n,zr}var $r,Ci;function su(){if(Ci)return $r;Ci=1;var t=F(),e=M(),r=t(e,"WeakMap");return $r=r,$r}var Vr,Si;function Co(){if(Si)return Vr;Si=1;var t=su(),e=t&&new t;return Vr=e,Vr}var Qr,Ti;function uu(){if(Ti)return Qr;Ti=1;var t=Co(),e=I.requireNoop(),r=t?function(n){return t.get(n)}:e;return Qr=r,Qr}var Jr,Ai;function So(){if(Ai)return Jr;Ai=1;var t={};return Jr=t,Jr}var Xr,Pi;function ou(){if(Pi)return Xr;Pi=1;var t=So(),e=Object.prototype,r=e.hasOwnProperty;function n(a){for(var i=a.name+"",s=t[i],u=r.call(t,i)?s.length:0;u--;){var o=s[u],f=o.func;if(f==null||f==a)return o.name}return i}return Xr=n,Xr}var Yr,Oi;function Ra(){if(Oi)return Yr;Oi=1;var t=_a(),e=qa(),r=4294967295;function n(a){this.__wrapped__=a,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=r,this.__views__=[]}return n.prototype=t(e.prototype),n.prototype.constructor=n,Yr=n,Yr}var Zr,Li;function To(){if(Li)return Zr;Li=1;var t=Ra(),e=wa(),r=$s();function n(a){if(a instanceof t)return a.clone();var i=new e(a.__wrapped__,a.__chain__);return i.__actions__=r(a.__actions__),i.__index__=a.__index__,i.__values__=a.__values__,i}return Zr=n,Zr}var et,Ii;function Ao(){if(Ii)return et;Ii=1;var t=Ra(),e=wa(),r=qa(),n=L(),a=k(),i=To(),s=Object.prototype,u=s.hasOwnProperty;function o(f){if(a(f)&&!n(f)&&!(f instanceof t)){if(f instanceof e)return f;if(u.call(f,"__wrapped__"))return i(f)}return new e(f)}return o.prototype=r.prototype,o.prototype.constructor=o,et=o,et}var rt,Mi;function Po(){if(Mi)return rt;Mi=1;var t=Ra(),e=uu(),r=ou(),n=Ao();function a(i){var s=r(i),u=n[s];if(typeof u!="function"||!(s in t.prototype))return!1;if(i===u)return!0;var o=e(u);return!!o&&i===o[0]}return rt=a,rt}var tt,Ei;function Oo(){if(Ei)return tt;Ei=1;var t=wa(),e=Ro(),r=uu(),n=ou(),a=L(),i=Po(),s="Expected a function",u=8,o=32,f=128,l=256;function c(h){return e(function(_){var w=_.length,p=w,g=t.prototype.thru;for(h&&_.reverse();p--;){var y=_[p];if(typeof y!="function")throw new TypeError(s);if(g&&!d&&n(y)=="wrapper")var d=new t([],!0)}for(p=d?p:w;++p<w;){y=_[p];var S=n(y),b=S=="wrapper"?r(y):void 0;b&&i(b[0])&&b[1]==(f|u|o|l)&&!b[4].length&&b[9]==1?d=d[n(b[0])].apply(d,b[3]):d=y.length==1&&i(y)?d[S]():d.thru(y)}return function(){var C=arguments,m=C[0];if(d&&C.length==1&&a(m))return d.plant(m).value();for(var v=0,R=w?_[v].apply(this,C):m;++v<w;)R=_[v].call(this,R);return R}})}return tt=c,tt}var at,ki;function Lo(){if(ki)return at;ki=1;var t=Oo(),e=t();return at=e,at}var Io=Lo();const Mo=I.getDefaultExportFromCjs(Io);var nt,Fi;function fu(){if(Fi)return nt;Fi=1;function t(e,r){for(var n=-1,a=e==null?0:e.length,i=Array(a);++n<a;)i[n]=r(e[n],n,e);return i}return nt=t,nt}var it,Gi;function Y(){if(Gi)return it;Gi=1;var t=j(),e=k(),r="[object Symbol]";function n(a){return typeof a=="symbol"||e(a)&&t(a)==r}return it=n,it}var st,Di;function Ca(){if(Di)return st;Di=1;var t=L(),e=Y(),r=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,n=/^\w*$/;function a(i,s){if(t(i))return!1;var u=typeof i;return u=="number"||u=="symbol"||u=="boolean"||i==null||e(i)?!0:n.test(i)||!r.test(i)||s!=null&&i in Object(s)}return st=a,st}var ut,ji;function Eo(){if(ji)return ut;ji=1;var t=ha(),e="Expected a function";function r(n,a){if(typeof n!="function"||a!=null&&typeof a!="function")throw new TypeError(e);var i=function(){var s=arguments,u=a?a.apply(this,s):s[0],o=i.cache;if(o.has(u))return o.get(u);var f=n.apply(this,s);return i.cache=o.set(u,f)||o,f};return i.cache=new(r.Cache||t),i}return r.Cache=t,ut=r,ut}var ot,xi;function ko(){if(xi)return ot;xi=1;var t=Eo(),e=500;function r(n){var a=t(n,function(s){return i.size===e&&i.clear(),s}),i=a.cache;return a}return ot=r,ot}var ft,Bi;function Fo(){if(Bi)return ft;Bi=1;var t=ko(),e=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,r=/\\(\\)?/g,n=t(function(a){var i=[];return a.charCodeAt(0)===46&&i.push(""),a.replace(e,function(s,u,o,f){i.push(o?f.replace(r,"$1"):u||s)}),i});return ft=n,ft}var ct,Ni;function Go(){if(Ni)return ct;Ni=1;var t=K(),e=fu(),r=L(),n=Y(),a=t?t.prototype:void 0,i=a?a.toString:void 0;function s(u){if(typeof u=="string")return u;if(r(u))return e(u,s)+"";if(n(u))return i?i.call(u):"";var o=u+"";return o=="0"&&1/u==-1/0?"-0":o}return ct=s,ct}var lt,Ui;function Do(){if(Ui)return lt;Ui=1;var t=Go();function e(r){return r==null?"":t(r)}return lt=e,lt}var ht,Ki;function cu(){if(Ki)return ht;Ki=1;var t=L(),e=Ca(),r=Fo(),n=Do();function a(i,s){return t(i)?i:e(i,s)?[i]:r(n(i))}return ht=a,ht}var dt,Hi;function Z(){if(Hi)return dt;Hi=1;var t=Y();function e(r){if(typeof r=="string"||t(r))return r;var n=r+"";return n=="0"&&1/r==-1/0?"-0":n}return dt=e,dt}var pt,Wi;function Sa(){if(Wi)return pt;Wi=1;var t=cu(),e=Z();function r(n,a){a=t(a,n);for(var i=0,s=a.length;n!=null&&i<s;)n=n[e(a[i++])];return i&&i==s?n:void 0}return pt=r,pt}var _t,zi;function jo(){if(zi)return _t;zi=1;var t="__lodash_hash_undefined__";function e(r){return this.__data__.set(r,t),this}return _t=e,_t}var vt,$i;function xo(){if($i)return vt;$i=1;function t(e){return this.__data__.has(e)}return vt=t,vt}var yt,Vi;function Bo(){if(Vi)return yt;Vi=1;var t=ha(),e=jo(),r=xo();function n(a){var i=-1,s=a==null?0:a.length;for(this.__data__=new t;++i<s;)this.add(a[i])}return n.prototype.add=n.prototype.push=e,n.prototype.has=r,yt=n,yt}var gt,Qi;function No(){if(Qi)return gt;Qi=1;function t(e,r){for(var n=-1,a=e==null?0:e.length;++n<a;)if(r(e[n],n,e))return!0;return!1}return gt=t,gt}var bt,Ji;function Uo(){if(Ji)return bt;Ji=1;function t(e,r){return e.has(r)}return bt=t,bt}var mt,Xi;function lu(){if(Xi)return mt;Xi=1;var t=Bo(),e=No(),r=Uo(),n=1,a=2;function i(s,u,o,f,l,c){var h=o&n,_=s.length,w=u.length;if(_!=w&&!(h&&w>_))return!1;var p=c.get(s),g=c.get(u);if(p&&g)return p==u&&g==s;var y=-1,d=!0,S=o&a?new t:void 0;for(c.set(s,u),c.set(u,s);++y<_;){var b=s[y],C=u[y];if(f)var m=h?f(C,b,y,u,s,c):f(b,C,y,s,u,c);if(m!==void 0){if(m)continue;d=!1;break}if(S){if(!e(u,function(v,R){if(!r(S,R)&&(b===v||l(b,v,o,f,c)))return S.push(R)})){d=!1;break}}else if(!(b===C||l(b,C,o,f,c))){d=!1;break}}return c.delete(s),c.delete(u),d}return mt=i,mt}var qt,Yi;function Ko(){if(Yi)return qt;Yi=1;function t(e){var r=-1,n=Array(e.size);return e.forEach(function(a,i){n[++r]=[i,a]}),n}return qt=t,qt}var wt,Zi;function Ho(){if(Zi)return wt;Zi=1;function t(e){var r=-1,n=Array(e.size);return e.forEach(function(a){n[++r]=a}),n}return wt=t,wt}var Rt,es;function Wo(){if(es)return Rt;es=1;var t=K(),e=zs(),r=D(),n=lu(),a=Ko(),i=Ho(),s=1,u=2,o="[object Boolean]",f="[object Date]",l="[object Error]",c="[object Map]",h="[object Number]",_="[object RegExp]",w="[object Set]",p="[object String]",g="[object Symbol]",y="[object ArrayBuffer]",d="[object DataView]",S=t?t.prototype:void 0,b=S?S.valueOf:void 0;function C(m,v,R,A,T,q,O){switch(R){case d:if(m.byteLength!=v.byteLength||m.byteOffset!=v.byteOffset)return!1;m=m.buffer,v=v.buffer;case y:return!(m.byteLength!=v.byteLength||!q(new e(m),new e(v)));case o:case f:case h:return r(+m,+v);case l:return m.name==v.name&&m.message==v.message;case _:case p:return m==v+"";case c:var P=a;case w:var G=A&s;if(P||(P=i),m.size!=v.size&&!G)return!1;var H=O.get(m);if(H)return H==v;A|=u,O.set(m,v);var vu=n(P(m),P(v),A,T,q,O);return O.delete(m),vu;case g:if(b)return b.call(m)==b.call(v)}return!1}return Rt=C,Rt}var Ct,rs;function zo(){if(rs)return Ct;rs=1;var t=nu(),e=L();function r(n,a,i){var s=a(n);return e(n)?s:t(s,i(n))}return Ct=r,Ct}var St,ts;function $o(){if(ts)return St;ts=1;function t(e,r){for(var n=-1,a=e==null?0:e.length,i=0,s=[];++n<a;){var u=e[n];r(u,n,e)&&(s[i++]=u)}return s}return St=t,St}var Tt,as;function Vo(){if(as)return Tt;as=1;function t(){return[]}return Tt=t,Tt}var At,ns;function Qo(){if(ns)return At;ns=1;var t=$o(),e=Vo(),r=Object.prototype,n=r.propertyIsEnumerable,a=Object.getOwnPropertySymbols,i=a?function(s){return s==null?[]:(s=Object(s),t(a(s),function(u){return n.call(s,u)}))}:e;return At=i,At}var Pt,is;function Jo(){if(is)return Pt;is=1;var t=Vs(),e=t(Object.keys,Object);return Pt=e,Pt}var Ot,ss;function Xo(){if(ss)return Ot;ss=1;var t=va(),e=Jo(),r=Object.prototype,n=r.hasOwnProperty;function a(i){if(!t(i))return e(i);var s=[];for(var u in Object(i))n.call(i,u)&&u!="constructor"&&s.push(u);return s}return Ot=a,Ot}var Lt,us;function Ta(){if(us)return Lt;us=1;var t=Ys(),e=Xo(),r=x();function n(a){return r(a)?t(a):e(a)}return Lt=n,Lt}var It,os;function Yo(){if(os)return It;os=1;var t=zo(),e=Qo(),r=Ta();function n(a){return t(a,r,e)}return It=n,It}var Mt,fs;function Zo(){if(fs)return Mt;fs=1;var t=Yo(),e=1,r=Object.prototype,n=r.hasOwnProperty;function a(i,s,u,o,f,l){var c=u&e,h=t(i),_=h.length,w=t(s),p=w.length;if(_!=p&&!c)return!1;for(var g=_;g--;){var y=h[g];if(!(c?y in s:n.call(s,y)))return!1}var d=l.get(i),S=l.get(s);if(d&&S)return d==s&&S==i;var b=!0;l.set(i,s),l.set(s,i);for(var C=c;++g<_;){y=h[g];var m=i[y],v=s[y];if(o)var R=c?o(v,m,y,s,i,l):o(m,v,y,i,s,l);if(!(R===void 0?m===v||f(m,v,u,o,l):R)){b=!1;break}C||(C=y=="constructor")}if(b&&!C){var A=i.constructor,T=s.constructor;A!=T&&"constructor"in i&&"constructor"in s&&!(typeof A=="function"&&A instanceof A&&typeof T=="function"&&T instanceof T)&&(b=!1)}return l.delete(i),l.delete(s),b}return Mt=a,Mt}var Et,cs;function ef(){if(cs)return Et;cs=1;var t=F(),e=M(),r=t(e,"DataView");return Et=r,Et}var kt,ls;function rf(){if(ls)return kt;ls=1;var t=F(),e=M(),r=t(e,"Promise");return kt=r,kt}var Ft,hs;function tf(){if(hs)return Ft;hs=1;var t=F(),e=M(),r=t(e,"Set");return Ft=r,Ft}var Gt,ds;function af(){if(ds)return Gt;ds=1;var t=ef(),e=la(),r=rf(),n=tf(),a=su(),i=j(),s=Us(),u="[object Map]",o="[object Object]",f="[object Promise]",l="[object Set]",c="[object WeakMap]",h="[object DataView]",_=s(t),w=s(e),p=s(r),g=s(n),y=s(a),d=i;return(t&&d(new t(new ArrayBuffer(1)))!=h||e&&d(new e)!=u||r&&d(r.resolve())!=f||n&&d(new n)!=l||a&&d(new a)!=c)&&(d=function(S){var b=i(S),C=b==o?S.constructor:void 0,m=C?s(C):"";if(m)switch(m){case _:return h;case w:return u;case p:return f;case g:return l;case y:return c}return b}),Gt=d,Gt}var Dt,ps;function nf(){if(ps)return Dt;ps=1;var t=da(),e=lu(),r=Wo(),n=Zo(),a=af(),i=L(),s=ga(),u=ba(),o=1,f="[object Arguments]",l="[object Array]",c="[object Object]",h=Object.prototype,_=h.hasOwnProperty;function w(p,g,y,d,S,b){var C=i(p),m=i(g),v=C?l:a(p),R=m?l:a(g);v=v==f?c:v,R=R==f?c:R;var A=v==c,T=R==c,q=v==R;if(q&&s(p)){if(!s(g))return!1;C=!0,A=!1}if(q&&!A)return b||(b=new t),C||u(p)?e(p,g,y,d,S,b):r(p,g,v,y,d,S,b);if(!(y&o)){var O=A&&_.call(p,"__wrapped__"),P=T&&_.call(g,"__wrapped__");if(O||P){var G=O?p.value():p,H=P?g.value():g;return b||(b=new t),S(G,H,y,d,b)}}return q?(b||(b=new t),n(p,g,y,d,S,b)):!1}return Dt=w,Dt}var jt,_s;function hu(){if(_s)return jt;_s=1;var t=nf(),e=k();function r(n,a,i,s,u){return n===a?!0:n==null||a==null||!e(n)&&!e(a)?n!==n&&a!==a:t(n,a,i,s,r,u)}return jt=r,jt}var xt,vs;function sf(){if(vs)return xt;vs=1;var t=da(),e=hu(),r=1,n=2;function a(i,s,u,o){var f=u.length,l=f,c=!o;if(i==null)return!l;for(i=Object(i);f--;){var h=u[f];if(c&&h[2]?h[1]!==i[h[0]]:!(h[0]in i))return!1}for(;++f<l;){h=u[f];var _=h[0],w=i[_],p=h[1];if(c&&h[2]){if(w===void 0&&!(_ in i))return!1}else{var g=new t;if(o)var y=o(w,p,_,i,s,g);if(!(y===void 0?e(p,w,r|n,o,g):y))return!1}}return!0}return xt=a,xt}var Bt,ys;function du(){if(ys)return Bt;ys=1;var t=E();function e(r){return r===r&&!t(r)}return Bt=e,Bt}var Nt,gs;function uf(){if(gs)return Nt;gs=1;var t=du(),e=Ta();function r(n){for(var a=e(n),i=a.length;i--;){var s=a[i],u=n[s];a[i]=[s,u,t(u)]}return a}return Nt=r,Nt}var Ut,bs;function pu(){if(bs)return Ut;bs=1;function t(e,r){return function(n){return n==null?!1:n[e]===r&&(r!==void 0||e in Object(n))}}return Ut=t,Ut}var Kt,ms;function of(){if(ms)return Kt;ms=1;var t=sf(),e=uf(),r=pu();function n(a){var i=e(a);return i.length==1&&i[0][2]?r(i[0][0],i[0][1]):function(s){return s===a||t(s,a,i)}}return Kt=n,Kt}var Ht,qs;function ff(){if(qs)return Ht;qs=1;var t=Sa();function e(r,n,a){var i=r==null?void 0:t(r,n);return i===void 0?a:i}return Ht=e,Ht}var Wt,ws;function cf(){if(ws)return Wt;ws=1;function t(e,r){return e!=null&&r in Object(e)}return Wt=t,Wt}var zt,Rs;function lf(){if(Rs)return zt;Rs=1;var t=cu(),e=J(),r=L(),n=ma(),a=ya(),i=Z();function s(u,o,f){o=t(o,u);for(var l=-1,c=o.length,h=!1;++l<c;){var _=i(o[l]);if(!(h=u!=null&&f(u,_)))break;u=u[_]}return h||++l!=c?h:(c=u==null?0:u.length,!!c&&a(c)&&n(_,c)&&(r(u)||e(u)))}return zt=s,zt}var $t,Cs;function hf(){if(Cs)return $t;Cs=1;var t=cf(),e=lf();function r(n,a){return n!=null&&e(n,a,t)}return $t=r,$t}var Vt,Ss;function df(){if(Ss)return Vt;Ss=1;var t=hu(),e=ff(),r=hf(),n=Ca(),a=du(),i=pu(),s=Z(),u=1,o=2;function f(l,c){return n(l)&&a(c)?i(s(l),c):function(h){var _=e(h,l);return _===void 0&&_===c?r(h,l):t(c,_,u|o)}}return Vt=f,Vt}var Qt,Ts;function pf(){if(Ts)return Qt;Ts=1;function t(e){return function(r){return r?.[e]}}return Qt=t,Qt}var Jt,As;function _f(){if(As)return Jt;As=1;var t=Sa();function e(r){return function(n){return t(n,r)}}return Jt=e,Jt}var Xt,Ps;function vf(){if(Ps)return Xt;Ps=1;var t=pf(),e=_f(),r=Ca(),n=Z();function a(i){return r(i)?t(n(i)):e(i)}return Xt=a,Xt}var Yt,Os;function yf(){if(Os)return Yt;Os=1;var t=of(),e=df(),r=X(),n=L(),a=vf();function i(s){return typeof s=="function"?s:s==null?r:typeof s=="object"?n(s)?e(s[0],s[1]):t(s):a(s)}return Yt=i,Yt}var Zt,Ls;function gf(){if(Ls)return Zt;Ls=1;var t=Ws(),e=Ta();function r(n,a){return n&&t(n,a,e)}return Zt=r,Zt}var ea,Is;function bf(){if(Is)return ea;Is=1;var t=x();function e(r,n){return function(a,i){if(a==null)return a;if(!t(a))return r(a,i);for(var s=a.length,u=n?s:-1,o=Object(a);(n?u--:++u<s)&&i(o[u],u,o)!==!1;);return a}}return ea=e,ea}var ra,Ms;function mf(){if(Ms)return ra;Ms=1;var t=gf(),e=bf(),r=e(t);return ra=r,ra}var ta,Es;function qf(){if(Es)return ta;Es=1;var t=mf(),e=x();function r(n,a){var i=-1,s=e(n)?Array(n.length):[];return t(n,function(u,o,f){s[++i]=a(u,o,f)}),s}return ta=r,ta}var aa,ks;function wf(){if(ks)return aa;ks=1;function t(e,r){var n=e.length;for(e.sort(r);n--;)e[n]=e[n].value;return e}return aa=t,aa}var na,Fs;function Rf(){if(Fs)return na;Fs=1;var t=Y();function e(r,n){if(r!==n){var a=r!==void 0,i=r===null,s=r===r,u=t(r),o=n!==void 0,f=n===null,l=n===n,c=t(n);if(!f&&!c&&!u&&r>n||u&&o&&l&&!f&&!c||i&&o&&l||!a&&l||!s)return 1;if(!i&&!u&&!c&&r<n||c&&a&&s&&!i&&!u||f&&a&&s||!o&&s||!l)return-1}return 0}return na=e,na}var ia,Gs;function Cf(){if(Gs)return ia;Gs=1;var t=Rf();function e(r,n,a){for(var i=-1,s=r.criteria,u=n.criteria,o=s.length,f=a.length;++i<o;){var l=t(s[i],u[i]);if(l){if(i>=f)return l;var c=a[i];return l*(c=="desc"?-1:1)}}return r.index-n.index}return ia=e,ia}var sa,Ds;function Sf(){if(Ds)return sa;Ds=1;var t=fu(),e=Sa(),r=yf(),n=qf(),a=wf(),i=Js(),s=Cf(),u=X(),o=L();function f(l,c,h){c.length?c=t(c,function(p){return o(p)?function(g){return e(g,p.length===1?p[0]:p)}:p}):c=[u];var _=-1;c=t(c,i(r));var w=n(l,function(p,g,y){var d=t(c,function(S){return S(p)});return{criteria:d,index:++_,value:p}});return a(w,function(p,g){return s(p,g,h)})}return sa=f,sa}var ua,js;function Tf(){if(js)return ua;js=1;var t=iu(),e=Sf(),r=tu(),n=au(),a=r(function(i,s){if(i==null)return[];var u=s.length;return u>1&&n(i,s[0],s[1])?s=[]:u>2&&n(s[0],s[1],s[2])&&(s=[s[0]]),e(i,t(s,1),[])});return ua=a,ua}var Af=Tf();const Pf=I.getDefaultExportFromCjs(Af);var oa,xs;function Of(){if(xs)return oa;xs=1;var t=D();function e(r,n){for(var a=-1,i=r.length,s=0,u=[];++a<i;){var o=r[a],f=n?n(o):o;if(!a||!t(f,l)){var l=f;u[s++]=o===0?0:o}}return u}return oa=e,oa}var fa,Bs;function Lf(){if(Bs)return fa;Bs=1;var t=Of();function e(r){return r&&r.length?t(r):[]}return fa=e,fa}var If=Lf();const Mf=I.getDefaultExportFromCjs(If);class _u{config;constructor(){this.config={api:{brand:"",cashierUrl:void 0,coinValueInCents:1,country:"",currency:"",game:"",gameHistoryUrl:"",homeUrl:void 0,integration:"",jurisdiction:null,playMode:"FUN",user:"",sessionId:I.v4(),backendSessionId:void 0},ui:{autoplay:{enabled:!1,rounds:{enabled:!1,showNoLimit:!1,showCustomLimit:!1,options:[]},lossLimit:{enabled:!1,showNoLimit:!1,showCustomLimit:!1,options:[]},winLimit:{enabled:!1,showNoLimit:!1,showCustomLimit:!1,options:[]},simple:!1,stopOnFeature:!1},cashier:{enabled:!1,balanceThreshold:[0]},feature:{allowTelemetry:!1,allowFullscreen:!1,allowGamble:!1,allowQuickStop:!1,showCashier:!1,showClock:!1,showCloseGame:!1,showCurrency:!0,showFastPlay:!1,showFeatureBuy:!1,showFeatureIntro:!1,showFeatureOutro:!1,showFunModeBanner:!1,showHistory:!1,showLowWinCelebration:!1,showMaximumWin:!1,showNetPosition:!1,showPaylineLines:!1,showPaytable:!1,showRoundId:!1,showRtp:!1,showRules:!1,showSessionDuration:!1,showUi:!0},language:"en",minimumSpinDuration:0,requestTimeoutMs:1e4,incompleteGameResolution:{type:"NONE"},realityCheck:{sessionDurationPeriodFormat:"minutes",showCloseGame:!1,showHistory:!1,showNetPosition:!1,showSessionDuration:!1,showSumBets:!1,showSumWins:!1},skipInsufficientFundsCheck:!1,skipSplash:!1,cheatPanel:!1}}}}function Ef(t,e){function r(n,{maxCount:a}){const i=o=>o?.filter(f=>f<=a)??[],s=o=>o?.map(f=>Number(f))??[],u=[...n,a];return Mo([s,i,Pf,Mf])(u)}switch(e){case"BG":return{autoplay:{lossLimit:{enabled:!0,showNoLimit:!1},winLimit:{enabled:!0}}};case"BR":return{feature:{showPaylineLines:!0}};case"CA":return{autoplay:{enabled:!1},feature:{showFastPlay:!1,allowQuickStop:!1,showFeatureBuy:!1},minimumSpinDuration:2.5};case"CO":return{autoplay:{rounds:{showNoLimit:!1,showCustomLimit:!1,options:r(t.autoplay.rounds.options,{maxCount:100})}},feature:{showFastPlay:!1,allowQuickStop:!1},minimumSpinDuration:3};case"CZ":return{feature:{showFastPlay:!1,showFeatureBuy:!1,allowGamble:!1},minimumSpinDuration:2};case"DE":return{autoplay:{enabled:!1},feature:{showFastPlay:!1,allowQuickStop:!1,showFeatureBuy:!1},minimumSpinDuration:5};case"ES":return{autoplay:{rounds:{showNoLimit:!1,showCustomLimit:!1,options:r(t.autoplay.rounds.options,{maxCount:100})}},feature:{showFastPlay:!1,allowQuickStop:!1},minimumSpinDuration:3};case"GR":return{feature:{showFastPlay:!1,allowQuickStop:!1,showFeatureBuy:!1},minimumSpinDuration:3};case"IT":return{feature:{showPaylineLines:!0}};case"NL":return{autoplay:{enabled:!1},feature:{showFeatureBuy:!1}};case"PT":return{autoplay:{rounds:{showNoLimit:!1,showCustomLimit:!1,options:r(t.autoplay.rounds.options,{maxCount:100})}},feature:{showFeatureBuy:!1,showFastPlay:!1,allowQuickStop:!1},minimumSpinDuration:3};case"SE":return{autoplay:{rounds:{showNoLimit:!1,showCustomLimit:!1,options:r(t.autoplay.rounds.options,{maxCount:100})}},feature:{showFastPlay:!1,allowQuickStop:!1},minimumSpinDuration:3};case"UK":return{autoplay:{enabled:!1},feature:{showFastPlay:!1,allowQuickStop:!1,showFeatureBuy:!1},minimumSpinDuration:2.5};case"US":return{feature:{showPaylineLines:!0}};case"MT":return{feature:{showClock:!0}};case"SOCIAL":return{feature:{showHistory:!1}};case"CLASS2":return{autoplay:{enabled:!1},feature:{showFeatureBuy:!1}}}return{}}class kf extends _u{async getConfig(){let e=this.config.ui;const r=await this.fetchOperatorConfig();e=W({},e,r);const n=new URLSearchParams(window.location.search),a=JSON.parse(n.get("badgeParameters")??"{}");e=W({},e,a);const i=Ef(e,this.config.api.jurisdiction);return e=W({},e,i),e}get mappedIntegration(){const e=this.config.api.integration.toLowerCase(),r=this.config.api.brand.toLowerCase();if(e==="spinomenal"){if(r.startsWith("gg-"))return"groove"}else if(e==="pariplay"){if(r.startsWith("8x1"))return"pariplay-8x1"}else{if(/openbox-.*/.test(e))return"openbox";if(/oryx-.*/.test(e))return"oryx";if(/relax-.*/.test(e))return"relax"}return e}get mappedBrand(){const e=this.config.api.integration.toLowerCase(),r=this.config.api.brand.toLowerCase();return e==="bspot"&&this.config.api.playMode.toLowerCase()==="fun"?"demo":r}mapUiConfig(e){return e?{autoplay:{enabled:e.badge.autoplayType!==5,rounds:{enabled:e.badge.autoplayType!==5,showNoLimit:!1,showCustomLimit:!1,options:e.badge.autoplayRounds??[5,10,25,75,100]},lossLimit:{enabled:e.badge.autoplayType===1||e.badge.autoplayType===4,showNoLimit:e.badge.autoplayType===1,showCustomLimit:e.badge.autoplayType!==6,options:[5,25,50]},winLimit:{enabled:e.badge.autoplayType===1||e.badge.autoplayType===4,showNoLimit:!0,showCustomLimit:e.badge.autoplayType!==6,options:[10,20,75]},simple:e.badge.autoplayType===3},cashier:{enabled:e.badge.showQuickDeposit,balanceThreshold:e.badge.quickDepositBalanceThresholds},feature:{allowTelemetry:!0,allowFullscreen:e.defaults.fullscreen==="true",allowGamble:e.badge.gambleHideWithAutoCollect===void 0?!0:!e.badge.gambleHideWithAutoCollect,allowQuickStop:e.badge.minimumSpinDuration===0,showCashier:e.badge.showQuickDeposit,showClock:e.badge.showClock,showCloseGame:e.badge.showCloseGameButton&&(!e.badge.showCloseGameButtonOptional||!!this.config.api.homeUrl),showCurrency:e.badge.showCurrency,showFastPlay:e.badge.showTurboButton,showFeatureBuy:e.badge.showHyperBonus,showFunModeBanner:e.badge.showFunBanner,showHistory:e.badge.showGameHistory,showPaylineLines:e.badge.showPaylineLines,showRoundId:e.badge.showRoundId,showRules:e.badge.showGameRules,showSessionDuration:e.badge.realityCheckShowSessionDuration,showUi:e.badge.showGameUi},minimumSpinDuration:e.badge.minimumSpinDuration,requestTimeoutMs:e.badge.requestTimeoutMs,incompleteGameResolution:{daysToAutoResolution:e.badge.incompleteGamesResolutionType===3?e.badge.daysToAutoResolution??90:void 0,type:e.badge.incompleteGamesResolutionType===2?"MANUAL":e.badge.incompleteGamesResolutionType===3?"AUTOMATIC":void 0},realityCheck:{sessionDurationPeriodFormat:e.badge.realityCheckPeriodFormat,showCloseGame:e.badge.realityCheckShowCloseGame,showHistory:e.badge.realityCheckShowHistoryLink,showNetPosition:e.badge.realityCheckShowNetGamingActivity,showSessionDuration:e.badge.realityCheckShowSessionDuration,showSumBets:e.badge.realityCheckShowSumBets,showSumWins:e.badge.realityCheckShowSumWins},skipInsufficientFundsCheck:e.badge.skipInsufficientFundsCheck,skipSplash:e.badge.loaderAutoContinue}:{}}async fetchOperatorConfig(){const e="https://awscdn.kalamba.net/games/games/build/",r=this.mappedIntegration,n=this.mappedBrand;let a={};try{a=await fetch(`${e}config/${r}/cage/${n}.json`).then(i=>i.json())}catch{try{a=await fetch(`${e}config/${r}/operator.json`).then(s=>s.json())}catch{a=await fetch(`${e}config/fun/operator.json`).then(u=>u.json())}}return this.mapUiConfig(a)}}exports.KalambaSdkConfigManager=kf;exports.KalambaSdkWrapper=mo;exports.SdkConfigManager=_u;
5
+ const require_errors = require('./errors-BUjKnbx5.cjs');
6
+ let lodash_es = require("lodash-es");
7
+ let uuid = require("uuid");
8
+
9
+ //#region src/common/PayloadInjectionManager.ts
10
+ /**
11
+ * PayloadInjectionManager manages payload injection from multiple sources.
12
+ * Each source can register either static payload data or async functions that will be merged together when creating the final payload for injection.
13
+ */
14
+ var PayloadInjectionManager = class {
15
+ #injectors = /* @__PURE__ */ new Map();
16
+ /**
17
+ * Register or update payload injector from a specific source
18
+ * @param source - Unique identifier for the payload source (e.g., 'bspot', 'freeRounds')
19
+ * @param payload - Payload data or async function that receives playPayload and returns payload data
20
+ */
21
+ register(source, payloadProvider) {
22
+ this.#injectors.set(source, payloadProvider);
23
+ }
24
+ /**
25
+ * Remove payload injector from a specific source
26
+ * @param source - Source identifier to remove
27
+ */
28
+ unregister(source) {
29
+ this.#injectors.delete(source);
30
+ }
31
+ /**
32
+ * Get merged payload from all registered injectors
33
+ * @param playPayload - The play payload that will be passed to registered functions
34
+ * @returns Promise resolving to merged payload object or undefined if no injectors registered
35
+ */
36
+ async getPayload(playPayload) {
37
+ if (this.#injectors.size === 0) return;
38
+ const merged = {};
39
+ for (const payloadProvider of this.#injectors.values()) (0, lodash_es.merge)(merged, typeof payloadProvider === "function" ? await payloadProvider(playPayload) : payloadProvider);
40
+ return merged;
41
+ }
42
+ };
43
+
44
+ //#endregion
45
+ //#region src/wrapper/KalambaSdkWrapper.ts
46
+ const logIn = () => {};
47
+ const logOut = () => {};
48
+ var KalambaSdkWrapper = class {
49
+ #messagePort;
50
+ #plugins;
51
+ #config = {
52
+ gameName: "UNKNOWN",
53
+ gameVersion: "unknown",
54
+ showErrors: true,
55
+ showFreeRounds: true,
56
+ showPromoPanel: false,
57
+ showRealityCheck: true,
58
+ showBars: true,
59
+ skipErrors: []
60
+ };
61
+ #state = {
62
+ isSdkConfigured: false,
63
+ balance: 0,
64
+ bet: {
65
+ base: 0,
66
+ multiplier: 0
67
+ },
68
+ openGameResponse: void 0,
69
+ lastPlayResponse: void 0,
70
+ freeRoundId: void 0
71
+ };
72
+ #sdkConfigManager;
73
+ #payloadInjectionManager;
74
+ #wakeLock;
75
+ constructor({ messagePort, plugins, sdkConfigManager }) {
76
+ this.#messagePort = messagePort;
77
+ this.#sdkConfigManager = new sdkConfigManager();
78
+ this.#payloadInjectionManager = new PayloadInjectionManager();
79
+ this.injectPayload = this.injectPayload.bind(this);
80
+ this.#plugins = {
81
+ rgs: new plugins.rgs(this.config, this.sdkConfig),
82
+ casino: plugins.casino.map((casinoPlugin) => new casinoPlugin(this.config, this.sdkConfig, this.state, this.injectPayload)),
83
+ telemetry: plugins.telemetry.map(({ plugin, trackers }) => new plugin(trackers.map((tracker) => new tracker(this.config, this.sdkConfig)), this.config, this.sdkConfig))
84
+ };
85
+ this.on("balance", ({ balance }) => {
86
+ this.setState((state) => ({
87
+ ...state,
88
+ balance
89
+ }));
90
+ });
91
+ this.on("bet", (bet) => {
92
+ this.setState((state) => ({
93
+ ...state,
94
+ bet
95
+ }));
96
+ });
97
+ this.on("sdk:playCycleStart", async () => {
98
+ await this.requestWakeLock();
99
+ if (this.state.freeRoundId) return;
100
+ this.setState((state) => ({
101
+ ...state,
102
+ balance: state.balance - state.bet.base * state.bet.multiplier
103
+ }));
104
+ });
105
+ this.on("sdk:play", async (payload) => {
106
+ const payloadToInject = await this.#payloadInjectionManager.getPayload(payload.contract);
107
+ this.send("play", {
108
+ ...payload,
109
+ payloadToInject
110
+ });
111
+ });
112
+ this.on("sdk:configure", (payload) => {
113
+ Object.assign(this.#config, payload);
114
+ });
115
+ this.on("freeRoundsPopup", () => {
116
+ const freeRound = (this.state.lastPlayResponse ?? this.state.openGameResponse)?.freeRounds[0];
117
+ if (freeRound && this.state.freeRoundId) this.send("freeRoundsInfo", freeRound);
118
+ });
119
+ this.on("rgs:openGameResponse", async (response) => {
120
+ this.setState((state) => ({
121
+ ...state,
122
+ openGameResponse: response.contract
123
+ }));
124
+ if (this.sdkConfig.api.integration !== "bspot") this.setState((state) => ({
125
+ ...state,
126
+ balance: response.contract.balance.coins
127
+ }));
128
+ this.on("playReady", () => {
129
+ this.handleFreeRounds(response.contract.freeRounds[0]);
130
+ });
131
+ this.sdkConfig.ui = await this.#sdkConfigManager.getConfig();
132
+ this.setState((state) => ({
133
+ ...state,
134
+ isSdkConfigured: true
135
+ }));
136
+ this.send("configured", this.sdkConfig);
137
+ });
138
+ this.on("rgs:openGameError", async (error) => {
139
+ if (error.type === "timeout" && !this.config.skipErrors.includes("TIMEOUT")) this.send("error", {
140
+ messageKey: `Error.TIMEOUT`,
141
+ messageCode: "TIMEOUT",
142
+ type: "RELOAD"
143
+ });
144
+ if (error.type === "error" && !this.config.skipErrors.includes(error.data.code)) this.send("error", {
145
+ messageKey: `RgsError.${error.data.code}`,
146
+ messageCode: error.data.code,
147
+ type: require_errors.RgsErrorAction[error.data.code]
148
+ });
149
+ });
150
+ this.on("rgs:playResponse", async (response) => {
151
+ this.setState((state) => ({
152
+ ...state,
153
+ lastPlayResponse: response.contract
154
+ }));
155
+ });
156
+ this.on("playCycleEnd", () => {
157
+ this.releaseWakeLock();
158
+ if (this.sdkConfig.api.integration !== "bspot") this.setState((state) => ({
159
+ ...state,
160
+ balance: this.state.lastPlayResponse.balance.coins
161
+ }));
162
+ this.handleFreeRounds(this.state.lastPlayResponse.freeRounds[0]);
163
+ });
164
+ this.on("rgs:playError", async (error) => {
165
+ if (error.type === "timeout" && !this.config.skipErrors.includes("TIMEOUT")) this.send("error", {
166
+ messageKey: `Error.TIMEOUT`,
167
+ messageCode: "TIMEOUT",
168
+ type: "RELOAD"
169
+ });
170
+ if (error.type === "error" && !this.config.skipErrors.includes(error.data.code)) this.send("error", {
171
+ messageKey: `RgsError.${error.data.code}`,
172
+ messageCode: error.data.code,
173
+ type: require_errors.RgsErrorAction[error.data.code]
174
+ });
175
+ });
176
+ this.on("rgs:freeRoundsResponse", async (response) => {
177
+ if (response.action === "ACCEPT") {
178
+ const freeRound = (this.state.lastPlayResponse ?? this.state.openGameResponse)?.freeRounds[0];
179
+ this.activateFreeRounds(freeRound);
180
+ }
181
+ });
182
+ this.on("rgs:freeRoundsError", async (error) => {
183
+ if (error.type === "timeout" && !this.config.skipErrors.includes("TIMEOUT")) this.send("error", {
184
+ messageKey: `Error.TIMEOUT`,
185
+ messageCode: "TIMEOUT",
186
+ type: "RELOAD"
187
+ });
188
+ if (error.type === "error" && !this.config.skipErrors.includes(error.data.code)) this.send("error", {
189
+ messageKey: `RgsError.${error.data.code}`,
190
+ messageCode: error.data.code,
191
+ type: require_errors.RgsErrorAction[error.data.code]
192
+ });
193
+ });
194
+ this.forwardMessages();
195
+ document.addEventListener("visibilitychange", async () => {
196
+ if (this.#wakeLock && document.visibilityState === "visible") await this.requestWakeLock();
197
+ });
198
+ }
199
+ get state() {
200
+ const that = this;
201
+ return new Proxy({}, { get(_target, prop) {
202
+ return Reflect.get(that.#state, prop);
203
+ } });
204
+ }
205
+ setState(setter) {
206
+ this.#state = setter(this.#state);
207
+ this.send("state", this.#state);
208
+ }
209
+ forwardMessages() {
210
+ this.forwardToPlugins("casino", [
211
+ "sdk:autoplay",
212
+ "sdk:bet",
213
+ "sdk:cashier",
214
+ "sdk:choice",
215
+ "sdk:close",
216
+ "sdk:error",
217
+ "sdk:history",
218
+ "sdk:loadEnd",
219
+ "sdk:loadProgress",
220
+ "sdk:loadStart",
221
+ "sdk:playReady",
222
+ "sdk:playCycleEnd",
223
+ "sdk:playCycleStart",
224
+ "sdk:playEnd",
225
+ "sdk:playStart",
226
+ "sdk:settings",
227
+ "sdk:openGame",
228
+ "sdk:configure",
229
+ "sdk:fullscreen"
230
+ ]);
231
+ this.forwardToPlugins("casino", ["rgs:playResponse", "rgs:openGameResponse"]);
232
+ this.forwardToPlugins("rgs", ["sdk:openGame", "sdk:history"]);
233
+ this.forwardToPlugins("rgs", [
234
+ "casino:play",
235
+ "casino:cashier",
236
+ "casino:close",
237
+ "casino:history",
238
+ "casino:getBalance"
239
+ ]);
240
+ this.forwardToPlugins("telemetry", [
241
+ "sdk:autoplay",
242
+ "sdk:error",
243
+ "sdk:playCycleStart",
244
+ "sdk:playCycleEnd",
245
+ "sdk:loadStart",
246
+ "sdk:loadProgress",
247
+ "sdk:loadEnd",
248
+ "sdk:telemetry.click",
249
+ "sdk:telemetry.orientationChange"
250
+ ]);
251
+ this.forwardToPlugins("telemetry", ["rgs:openGameResponse", "rgs:playResponse"]);
252
+ this.forwardToSdk([
253
+ "casino:balance",
254
+ "casino:bet",
255
+ "casino:choice",
256
+ "casino:freeze",
257
+ "casino:help",
258
+ "casino:paytable",
259
+ "casino:resume",
260
+ "casino:settings",
261
+ "casino:suspend",
262
+ "casino:unfreeze"
263
+ ]);
264
+ this.forwardToSdk([
265
+ "rgs:balance",
266
+ "rgs:openGameError",
267
+ "rgs:openGameResponse",
268
+ "rgs:playError",
269
+ "rgs:playResponse",
270
+ "rgs:realityCheck"
271
+ ]);
272
+ }
273
+ get config() {
274
+ const that = this;
275
+ return new Proxy({}, {
276
+ get(_target, prop) {
277
+ return Reflect.get(that.#config, prop);
278
+ },
279
+ set(_target, prop, value) {
280
+ return Reflect.set(that.#config, prop, value);
281
+ }
282
+ });
283
+ }
284
+ get sdkConfig() {
285
+ return this.#sdkConfigManager.config;
286
+ }
287
+ forwardToPlugins(targetDomain, messages) {
288
+ messages.forEach((message) => {
289
+ const onMessage = (event) => {
290
+ if (event.data.message !== `kalamba:${message}`) return;
291
+ logIn("wrapper:forwardToPlugins", targetDomain, event.data.message.replace(/^kalamba:/, ""), event.data.payload);
292
+ window.postMessage({
293
+ message: `kalamba:wrapper-${targetDomain}:${message.replace(/^(.+):/, "")}`,
294
+ payload: event.data.payload
295
+ });
296
+ };
297
+ window.addEventListener("message", onMessage);
298
+ });
299
+ }
300
+ forwardToSdk(messages) {
301
+ messages.forEach((message) => {
302
+ const onMessage = (event) => {
303
+ if (event.data.message !== `kalamba:${message}`) return;
304
+ logOut("wrapper:forwardToSdk", event.data.message.replace(/^kalamba:/, ""), event.data.payload);
305
+ this.#messagePort.postMessage({
306
+ message: `kalamba:wrapper:${message.replace(/^(.+):/, "")}`,
307
+ payload: event.data.payload
308
+ }, "*");
309
+ };
310
+ window.addEventListener("message", onMessage);
311
+ });
312
+ }
313
+ on(message, listener, options) {
314
+ const onMessage = function onMessage(event) {
315
+ if (!new RegExp(`^kalamba:${message.includes(":") ? "" : "(.+):"}${message}$`).test(event.data.message) || new RegExp(`^kalamba:wrapper-(.+):${message}`).test(event.data.message) || new RegExp(`^kalamba:(.+)-wrapper:${message}`).test(event.data.message)) return;
316
+ logIn("on", event.data.message.replace(/^kalamba:/, ""), event.data.payload);
317
+ listener(event.data.payload);
318
+ if (options?.once) window.removeEventListener("message", onMessage);
319
+ };
320
+ window.addEventListener("message", onMessage);
321
+ return () => window.removeEventListener("message", onMessage);
322
+ }
323
+ send(message, ...[payload]) {
324
+ logOut("wrapper:send", message, payload);
325
+ window.postMessage({
326
+ message: `kalamba:wrapper:${message}`,
327
+ payload
328
+ });
329
+ this.#messagePort.postMessage({
330
+ message: `kalamba:wrapper:${message}`,
331
+ payload
332
+ }, "*");
333
+ }
334
+ injectPayload(...[source, payload]) {
335
+ this.#payloadInjectionManager.register(source, payload);
336
+ return () => this.#payloadInjectionManager.unregister(source);
337
+ }
338
+ activateFreeRounds(freeRound) {
339
+ if (!freeRound) return;
340
+ this.setState((state) => ({
341
+ ...state,
342
+ freeRoundId: freeRound.id
343
+ }));
344
+ this.#payloadInjectionManager.register("freeRounds", { freeRoundId: freeRound.id });
345
+ this.send("legalBets", { [freeRound.conf.base]: [freeRound.conf.multiplier] });
346
+ this.send("bet", {
347
+ base: freeRound.conf.base,
348
+ multiplier: freeRound.conf.multiplier
349
+ });
350
+ }
351
+ handleFreeRounds(freeRound) {
352
+ if (!freeRound) return;
353
+ switch (freeRound.status) {
354
+ case "ACTIVE":
355
+ this.activateFreeRounds(freeRound);
356
+ break;
357
+ case "PENDING":
358
+ this.send("freeRoundsOffer", freeRound);
359
+ break;
360
+ case "FINISHED":
361
+ this.send("freeRoundsComplete", freeRound);
362
+ this.setState((state) => ({
363
+ ...state,
364
+ freeRoundId: void 0
365
+ }));
366
+ this.#payloadInjectionManager.unregister("freeRounds");
367
+ this.send("legalBets", this.state.openGameResponse.bet.available);
368
+ this.send("bet", this.state.openGameResponse.bet.default);
369
+ break;
370
+ default: break;
371
+ }
372
+ }
373
+ async requestWakeLock() {
374
+ try {
375
+ this.#wakeLock = await navigator.wakeLock.request("screen");
376
+ } catch {}
377
+ }
378
+ async releaseWakeLock() {
379
+ if (!this.#wakeLock) return;
380
+ await this.#wakeLock.release();
381
+ this.#wakeLock = void 0;
382
+ }
383
+ };
384
+
385
+ //#endregion
386
+ //#region src/common/config/SdkConfigManager.ts
387
+ var SdkConfigManager = class {
388
+ config;
389
+ constructor() {
390
+ this.config = {
391
+ api: {
392
+ brand: "",
393
+ cashierUrl: void 0,
394
+ coinValueInCents: 1,
395
+ country: "",
396
+ currency: "",
397
+ game: "",
398
+ gameHistoryUrl: "",
399
+ homeUrl: void 0,
400
+ integration: "",
401
+ jurisdiction: null,
402
+ playMode: "FUN",
403
+ user: "",
404
+ sessionId: (0, uuid.v4)(),
405
+ backendSessionId: void 0
406
+ },
407
+ ui: {
408
+ autoplay: {
409
+ enabled: false,
410
+ rounds: {
411
+ enabled: false,
412
+ showNoLimit: false,
413
+ showCustomLimit: false,
414
+ options: []
415
+ },
416
+ lossLimit: {
417
+ enabled: false,
418
+ showNoLimit: false,
419
+ showCustomLimit: false,
420
+ options: []
421
+ },
422
+ winLimit: {
423
+ enabled: false,
424
+ showNoLimit: false,
425
+ showCustomLimit: false,
426
+ options: []
427
+ },
428
+ simple: false,
429
+ stopOnFeature: false
430
+ },
431
+ cashier: {
432
+ enabled: false,
433
+ balanceThreshold: [0]
434
+ },
435
+ feature: {
436
+ allowTelemetry: false,
437
+ allowFullscreen: false,
438
+ allowGamble: false,
439
+ allowQuickStop: false,
440
+ showCashier: false,
441
+ showClock: false,
442
+ showCloseGame: false,
443
+ showCurrency: true,
444
+ showFastPlay: false,
445
+ showFeatureBuy: false,
446
+ showFeatureIntro: false,
447
+ showFeatureOutro: false,
448
+ showFunModeBanner: false,
449
+ showHistory: false,
450
+ showLowWinCelebration: false,
451
+ showMaximumWin: false,
452
+ showNetPosition: false,
453
+ showPaylineLines: false,
454
+ showPaytable: false,
455
+ showRoundId: false,
456
+ showRtp: false,
457
+ showRules: false,
458
+ showSessionDuration: false,
459
+ showUi: true
460
+ },
461
+ language: "en",
462
+ minimumSpinDuration: 0,
463
+ requestTimeoutMs: 1e4,
464
+ incompleteGameResolution: { type: "NONE" },
465
+ realityCheck: {
466
+ sessionDurationPeriodFormat: "minutes",
467
+ showCloseGame: false,
468
+ showHistory: false,
469
+ showNetPosition: false,
470
+ showSessionDuration: false,
471
+ showSumBets: false,
472
+ showSumWins: false
473
+ },
474
+ skipInsufficientFundsCheck: false,
475
+ skipSplash: false,
476
+ cheatPanel: false
477
+ }
478
+ };
479
+ }
480
+ };
481
+
482
+ //#endregion
483
+ //#region src/common/config/KalambaSdkConfigManager.ts
484
+ function jurisdictionConfigOverrides(config, jurisdiction) {
485
+ function limitRounds(autoPlayRounds, { maxCount }) {
486
+ const limitCount = (rounds) => rounds?.filter((count) => count <= maxCount) ?? [];
487
+ const castToNumber = (rounds) => rounds?.map((count) => Number(count)) ?? [];
488
+ const rounds = [...autoPlayRounds, maxCount];
489
+ return (0, lodash_es.flow)([
490
+ castToNumber,
491
+ limitCount,
492
+ lodash_es.sortBy,
493
+ lodash_es.sortedUniq
494
+ ])(rounds);
495
+ }
496
+ switch (jurisdiction) {
497
+ case "BG": return { autoplay: {
498
+ lossLimit: {
499
+ enabled: true,
500
+ showNoLimit: false
501
+ },
502
+ winLimit: { enabled: true }
503
+ } };
504
+ case "BR": return { feature: { showPaylineLines: true } };
505
+ case "CA": return {
506
+ autoplay: { enabled: false },
507
+ feature: {
508
+ showFastPlay: false,
509
+ allowQuickStop: false,
510
+ showFeatureBuy: false
511
+ },
512
+ minimumSpinDuration: 2.5
513
+ };
514
+ case "CO": return {
515
+ autoplay: { rounds: {
516
+ showNoLimit: false,
517
+ showCustomLimit: false,
518
+ options: limitRounds(config.autoplay.rounds.options, { maxCount: 100 })
519
+ } },
520
+ feature: {
521
+ showFastPlay: false,
522
+ allowQuickStop: false
523
+ },
524
+ minimumSpinDuration: 3
525
+ };
526
+ case "CZ": return {
527
+ feature: {
528
+ showFastPlay: false,
529
+ showFeatureBuy: false,
530
+ allowGamble: false
531
+ },
532
+ minimumSpinDuration: 2
533
+ };
534
+ case "DE": return {
535
+ autoplay: { enabled: false },
536
+ feature: {
537
+ showFastPlay: false,
538
+ allowQuickStop: false,
539
+ showFeatureBuy: false
540
+ },
541
+ minimumSpinDuration: 5
542
+ };
543
+ case "ES": return {
544
+ autoplay: { rounds: {
545
+ showNoLimit: false,
546
+ showCustomLimit: false,
547
+ options: limitRounds(config.autoplay.rounds.options, { maxCount: 100 })
548
+ } },
549
+ feature: {
550
+ showFastPlay: false,
551
+ allowQuickStop: false
552
+ },
553
+ minimumSpinDuration: 3
554
+ };
555
+ case "GR": return {
556
+ feature: {
557
+ showFastPlay: false,
558
+ allowQuickStop: false,
559
+ showFeatureBuy: false
560
+ },
561
+ minimumSpinDuration: 3
562
+ };
563
+ case "IT": return { feature: { showPaylineLines: true } };
564
+ case "NL": return {
565
+ autoplay: { enabled: false },
566
+ feature: { showFeatureBuy: false }
567
+ };
568
+ case "PT": return {
569
+ autoplay: { rounds: {
570
+ showNoLimit: false,
571
+ showCustomLimit: false,
572
+ options: limitRounds(config.autoplay.rounds.options, { maxCount: 100 })
573
+ } },
574
+ feature: {
575
+ showFeatureBuy: false,
576
+ showFastPlay: false,
577
+ allowQuickStop: false
578
+ },
579
+ minimumSpinDuration: 3
580
+ };
581
+ case "SE": return {
582
+ autoplay: { rounds: {
583
+ showNoLimit: false,
584
+ showCustomLimit: false,
585
+ options: limitRounds(config.autoplay.rounds.options, { maxCount: 100 })
586
+ } },
587
+ feature: {
588
+ showFastPlay: false,
589
+ allowQuickStop: false
590
+ },
591
+ minimumSpinDuration: 3
592
+ };
593
+ case "UK": return {
594
+ autoplay: { enabled: false },
595
+ feature: {
596
+ showFastPlay: false,
597
+ allowQuickStop: false,
598
+ showFeatureBuy: false
599
+ },
600
+ minimumSpinDuration: 2.5
601
+ };
602
+ case "US": return { feature: { showPaylineLines: true } };
603
+ case "MT": return { feature: { showClock: true } };
604
+ case "SOCIAL": return { feature: { showHistory: false } };
605
+ case "CLASS2": return {
606
+ autoplay: { enabled: false },
607
+ feature: { showFeatureBuy: false }
608
+ };
609
+ }
610
+ return {};
611
+ }
612
+ var KalambaSdkConfigManager = class extends SdkConfigManager {
613
+ async getConfig() {
614
+ let uiConfig = this.config.ui;
615
+ const operatorConfig = await this.fetchOperatorConfig();
616
+ uiConfig = (0, lodash_es.merge)({}, uiConfig, operatorConfig);
617
+ const searchParams = new URLSearchParams(window.location.search);
618
+ const badgeOverrides = JSON.parse(searchParams.get("badgeParameters") ?? "{}");
619
+ uiConfig = (0, lodash_es.merge)({}, uiConfig, badgeOverrides);
620
+ const jurisdictionOverrides = jurisdictionConfigOverrides(uiConfig, this.config.api.jurisdiction);
621
+ uiConfig = (0, lodash_es.merge)({}, uiConfig, jurisdictionOverrides);
622
+ return uiConfig;
623
+ }
624
+ get mappedIntegration() {
625
+ const integration = this.config.api.integration.toLowerCase();
626
+ const brand = this.config.api.brand.toLowerCase();
627
+ if (integration === "spinomenal") {
628
+ if (brand.startsWith("gg-")) return "groove";
629
+ } else if (integration === "pariplay") {
630
+ if (brand.startsWith("8x1")) return "pariplay-8x1";
631
+ } else if (/openbox-.*/.test(integration)) return "openbox";
632
+ else if (/oryx-.*/.test(integration)) return "oryx";
633
+ else if (/relax-.*/.test(integration)) return "relax";
634
+ return integration;
635
+ }
636
+ get mappedBrand() {
637
+ const integration = this.config.api.integration.toLowerCase();
638
+ const brand = this.config.api.brand.toLowerCase();
639
+ if (integration === "bspot" && this.config.api.playMode.toLowerCase() === "fun") return "demo";
640
+ return brand;
641
+ }
642
+ mapUiConfig(config) {
643
+ if (!config) return {};
644
+ return {
645
+ autoplay: {
646
+ enabled: config.badge.autoplayType !== 5,
647
+ rounds: {
648
+ enabled: config.badge.autoplayType !== 5,
649
+ showNoLimit: false,
650
+ showCustomLimit: false,
651
+ options: config.badge.autoplayRounds ?? [
652
+ 5,
653
+ 10,
654
+ 25,
655
+ 75,
656
+ 100
657
+ ]
658
+ },
659
+ lossLimit: {
660
+ enabled: config.badge.autoplayType === 1 || config.badge.autoplayType === 4,
661
+ showNoLimit: config.badge.autoplayType === 1,
662
+ showCustomLimit: config.badge.autoplayType !== 6,
663
+ options: [
664
+ 5,
665
+ 25,
666
+ 50
667
+ ]
668
+ },
669
+ winLimit: {
670
+ enabled: config.badge.autoplayType === 1 || config.badge.autoplayType === 4,
671
+ showNoLimit: true,
672
+ showCustomLimit: config.badge.autoplayType !== 6,
673
+ options: [
674
+ 10,
675
+ 20,
676
+ 75
677
+ ]
678
+ },
679
+ simple: config.badge.autoplayType === 3
680
+ },
681
+ cashier: {
682
+ enabled: config.badge.showQuickDeposit,
683
+ balanceThreshold: config.badge.quickDepositBalanceThresholds
684
+ },
685
+ feature: {
686
+ allowTelemetry: true,
687
+ allowFullscreen: config.defaults.fullscreen === "true",
688
+ allowGamble: config.badge.gambleHideWithAutoCollect === void 0 ? true : !config.badge.gambleHideWithAutoCollect,
689
+ allowQuickStop: config.badge.minimumSpinDuration === 0,
690
+ showCashier: config.badge.showQuickDeposit,
691
+ showClock: config.badge.showClock,
692
+ showCloseGame: config.badge.showCloseGameButton && (!config.badge.showCloseGameButtonOptional || !!this.config.api.homeUrl),
693
+ showCurrency: config.badge.showCurrency,
694
+ showFastPlay: config.badge.showTurboButton,
695
+ showFeatureBuy: config.badge.showHyperBonus,
696
+ showFunModeBanner: config.badge.showFunBanner,
697
+ showHistory: config.badge.showGameHistory,
698
+ showPaylineLines: config.badge.showPaylineLines,
699
+ showRoundId: config.badge.showRoundId,
700
+ showRules: config.badge.showGameRules,
701
+ showSessionDuration: config.badge.realityCheckShowSessionDuration,
702
+ showUi: config.badge.showGameUi
703
+ },
704
+ minimumSpinDuration: config.badge.minimumSpinDuration,
705
+ requestTimeoutMs: config.badge.requestTimeoutMs,
706
+ incompleteGameResolution: {
707
+ daysToAutoResolution: config.badge.incompleteGamesResolutionType === 3 ? config.badge.daysToAutoResolution ?? 90 : void 0,
708
+ type: config.badge.incompleteGamesResolutionType === 2 ? "MANUAL" : config.badge.incompleteGamesResolutionType === 3 ? "AUTOMATIC" : void 0
709
+ },
710
+ realityCheck: {
711
+ sessionDurationPeriodFormat: config.badge.realityCheckPeriodFormat,
712
+ showCloseGame: config.badge.realityCheckShowCloseGame,
713
+ showHistory: config.badge.realityCheckShowHistoryLink,
714
+ showNetPosition: config.badge.realityCheckShowNetGamingActivity,
715
+ showSessionDuration: config.badge.realityCheckShowSessionDuration,
716
+ showSumBets: config.badge.realityCheckShowSumBets,
717
+ showSumWins: config.badge.realityCheckShowSumWins
718
+ },
719
+ skipInsufficientFundsCheck: config.badge.skipInsufficientFundsCheck,
720
+ skipSplash: config.badge.loaderAutoContinue
721
+ };
722
+ }
723
+ async fetchOperatorConfig() {
724
+ const rootUrl = "https://awscdn.kalamba.net/games/games/build/";
725
+ const integration = this.mappedIntegration;
726
+ const brand = this.mappedBrand;
727
+ let config = {};
728
+ try {
729
+ config = await fetch(`${rootUrl}config/${integration}/cage/${brand}.json`).then((r) => r.json());
730
+ } catch (e) {
731
+ try {
732
+ config = await fetch(`${rootUrl}config/${integration}/operator.json`).then((r) => r.json());
733
+ } catch (e) {
734
+ config = await fetch(`${rootUrl}config/fun/operator.json`).then((r) => r.json());
735
+ }
736
+ }
737
+ return this.mapUiConfig(config);
738
+ }
739
+ };
740
+
741
+ //#endregion
742
+ exports.KalambaSdkConfigManager = KalambaSdkConfigManager;
743
+ exports.KalambaSdkWrapper = KalambaSdkWrapper;
744
+ exports.SdkConfigManager = SdkConfigManager;