@betorigami/games 1.4.9 → 1.4.10

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/index.d.ts CHANGED
@@ -3772,6 +3772,7 @@ export declare class GameProviderWrapper extends OrigamiElement {
3772
3772
  minBet: number | null;
3773
3773
  maxBet: number | null;
3774
3774
  edge: number;
3775
+ requiresFullScreen: boolean;
3775
3776
  footerPosition: "ABOVE" | "BELOW";
3776
3777
  logoUrl: string | null;
3777
3778
  private betAmount;
package/dist/index.mjs CHANGED
@@ -10,7 +10,7 @@ var es=Object.create;var{getPrototypeOf:os,defineProperty:Vr,getOwnPropertyNames
10
10
  \f\r](?:([^\\s"'>=/]+)([
11
11
  \f\r]*=[
12
12
  \f\r]*(?:[^
13
- \f\r"'\`<>=]|("|')|))|$)`,"g"),Yr=/'/g,Nr=/"/g,Ur=/^(?:script|style|textarea|title)$/i,Ae=(a)=>(i,...e)=>({_$litType$:a,strings:i,values:e}),H=Ae(1),oa=Ae(2),ud=Ae(3),za=Symbol.for("lit-noChange"),L=Symbol.for("lit-nothing"),Xr=new WeakMap,xi=Si.createTreeWalker(Si,129);function Ar(a,i){if(!Ue(a)||!a.hasOwnProperty("raw"))throw Error("invalid template strings array");return _r!==void 0?_r.createHTML(i):i}var Gr=(a,i)=>{let e=a.length-1,o=[],r,n=i===2?"<svg>":i===3?"<math>":"",t=Yi;for(let s=0;s<e;s++){let l=a[s],u,h,f=-1,c=0;for(;c<l.length&&(t.lastIndex=c,h=t.exec(l),h!==null);)c=t.lastIndex,t===Yi?h[1]==="!--"?t=$r:h[1]!==void 0?t=Qr:h[2]!==void 0?(Ur.test(h[2])&&(r=RegExp("</"+h[2],"g")),t=zi):h[3]!==void 0&&(t=zi):t===zi?h[0]===">"?(t=r??Yi,f=-1):h[1]===void 0?f=-2:(f=t.lastIndex-h[2].length,u=h[1],t=h[3]===void 0?zi:h[3]==='"'?Nr:Yr):t===Nr||t===Yr?t=zi:t===$r||t===Qr?t=Yi:(t=zi,r=void 0);let y=t===zi&&a[s+1].startsWith("/>")?" ":"";n+=t===Yi?l+ms:f>=0?(o.push(u),l.slice(0,f)+"$lit$"+l.slice(f)+ri+y):l+ri+(f===-2?s:y)}return[Ar(a,n+(a[e]||"<?>")+(i===2?"</svg>":i===3?"</math>":"")),o]};class Mi{constructor({strings:a,_$litType$:i},e){let o;this.parts=[];let r=0,n=0,t=a.length-1,s=this.parts,[l,u]=Gr(a,i);if(this.el=Mi.createElement(l,e),xi.currentNode=this.el.content,i===2||i===3){let h=this.el.content.firstChild;h.replaceWith(...h.childNodes)}for(;(o=xi.nextNode())!==null&&s.length<t;){if(o.nodeType===1){if(o.hasAttributes())for(let h of o.getAttributeNames())if(h.endsWith("$lit$")){let f=u[n++],c=o.getAttribute(h).split(ri),y=/([.?@])?(.*)/.exec(f);s.push({type:1,index:r,name:y[2],strings:c,ctor:y[1]==="."?De:y[1]==="?"?Ee:y[1]==="@"?ao:Ci}),o.removeAttribute(h)}else h.startsWith(ri)&&(s.push({type:6,index:r}),o.removeAttribute(h));if(Ur.test(o.tagName)){let h=o.textContent.split(ri),f=h.length-1;if(f>0){o.textContent=ge?ge.emptyScript:"";for(let c=0;c<f;c++)o.append(h[c],Ni()),xi.nextNode(),s.push({type:2,index:++r});o.append(h[f],Ni())}}}else if(o.nodeType===8)if(o.data===Me)s.push({type:2,index:r});else{let h=-1;for(;(h=o.data.indexOf(ri,h+1))!==-1;)s.push({type:7,index:r}),h+=ri.length-1}r++}}static createElement(a,i){let e=Si.createElement("template");return e.innerHTML=a,e}}function Ii(a,i,e=a,o){if(i===za)return i;let r=o!==void 0?e._$Co?.[o]:e._$Cl,n=Xi(i)?void 0:i._$litDirective$;return r?.constructor!==n&&(r?._$AO?.(!1),n===void 0?r=void 0:(r=new n(a),r._$AT(a,e,o)),o!==void 0?(e._$Co??=[])[o]=r:e._$Cl=r),r!==void 0&&(i=Ii(a,r._$AS(a,i.values),r,o)),i}class Ge{constructor(a,i){this._$AV=[],this._$AN=void 0,this._$AD=a,this._$AM=i}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(a){let{el:{content:i},parts:e}=this._$AD,o=(a?.creationScope??Si).importNode(i,!0);xi.currentNode=o;let r=xi.nextNode(),n=0,t=0,s=e[0];for(;s!==void 0;){if(n===s.index){let l;s.type===2?l=new Vi(r,r.nextSibling,this,a):s.type===1?l=new s.ctor(r,s.name,s.strings,this,a):s.type===6&&(l=new io(r,this,a)),this._$AV.push(l),s=e[++t]}n!==s?.index&&(r=xi.nextNode(),n++)}return xi.currentNode=Si,o}p(a){let i=0;for(let e of this._$AV)e!==void 0&&(e.strings!==void 0?(e._$AI(a,e,i),i+=e.strings.length-2):e._$AI(a[i])),i++}}class Vi{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(a,i,e,o){this.type=2,this._$AH=L,this._$AN=void 0,this._$AA=a,this._$AB=i,this._$AM=e,this.options=o,this._$Cv=o?.isConnected??!0}get parentNode(){let a=this._$AA.parentNode,i=this._$AM;return i!==void 0&&a?.nodeType===11&&(a=i.parentNode),a}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(a,i=this){a=Ii(this,a,i),Xi(a)?a===L||a==null||a===""?(this._$AH!==L&&this._$AR(),this._$AH=L):a!==this._$AH&&a!==za&&this._(a):a._$litType$!==void 0?this.$(a):a.nodeType!==void 0?this.T(a):Mr(a)?this.k(a):this._(a)}O(a){return this._$AA.parentNode.insertBefore(a,this._$AB)}T(a){this._$AH!==a&&(this._$AR(),this._$AH=this.O(a))}_(a){this._$AH!==L&&Xi(this._$AH)?this._$AA.nextSibling.data=a:this.T(Si.createTextNode(a)),this._$AH=a}$(a){let{values:i,_$litType$:e}=a,o=typeof e=="number"?this._$AC(a):(e.el===void 0&&(e.el=Mi.createElement(Ar(e.h,e.h[0]),this.options)),e);if(this._$AH?._$AD===o)this._$AH.p(i);else{let r=new Ge(o,this),n=r.u(this.options);r.p(i),this.T(n),this._$AH=r}}_$AC(a){let i=Xr.get(a.strings);return i===void 0&&Xr.set(a.strings,i=new Mi(a)),i}k(a){Ue(this._$AH)||(this._$AH=[],this._$AR());let i=this._$AH,e,o=0;for(let r of a)o===i.length?i.push(e=new Vi(this.O(Ni()),this.O(Ni()),this,this.options)):e=i[o],e._$AI(r),o++;o<i.length&&(this._$AR(e&&e._$AB.nextSibling,o),i.length=o)}_$AR(a=this._$AA.nextSibling,i){for(this._$AP?.(!1,!0,i);a&&a!==this._$AB;){let e=a.nextSibling;a.remove(),a=e}}setConnected(a){this._$AM===void 0&&(this._$Cv=a,this._$AP?.(a))}}class Ci{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(a,i,e,o,r){this.type=1,this._$AH=L,this._$AN=void 0,this.element=a,this.name=i,this._$AM=o,this.options=r,e.length>2||e[0]!==""||e[1]!==""?(this._$AH=Array(e.length-1).fill(new String),this.strings=e):this._$AH=L}_$AI(a,i=this,e,o){let r=this.strings,n=!1;if(r===void 0)a=Ii(this,a,i,0),n=!Xi(a)||a!==this._$AH&&a!==za,n&&(this._$AH=a);else{let t=a,s,l;for(a=r[0],s=0;s<r.length-1;s++)l=Ii(this,t[e+s],i,s),l===za&&(l=this._$AH[s]),n||=!Xi(l)||l!==this._$AH[s],l===L?a=L:a!==L&&(a+=(l??"")+r[s+1]),this._$AH[s]=l}n&&!o&&this.j(a)}j(a){a===L?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,a??"")}}class De extends Ci{constructor(){super(...arguments),this.type=3}j(a){this.element[this.name]=a===L?void 0:a}}class Ee extends Ci{constructor(){super(...arguments),this.type=4}j(a){this.element.toggleAttribute(this.name,!!a&&a!==L)}}class ao extends Ci{constructor(a,i,e,o,r){super(a,i,e,o,r),this.type=5}_$AI(a,i=this){if((a=Ii(this,a,i,0)??L)===za)return;let e=this._$AH,o=a===L&&e!==L||a.capture!==e.capture||a.once!==e.once||a.passive!==e.passive,r=a!==L&&(e===L||o);o&&this.element.removeEventListener(this.name,this,e),r&&this.element.addEventListener(this.name,this,a),this._$AH=a}handleEvent(a){typeof this._$AH=="function"?this._$AH.call(this.options?.host??this.element,a):this._$AH.handleEvent(a)}}class io{constructor(a,i,e){this.element=a,this.type=6,this._$AN=void 0,this._$AM=i,this.options=e}get _$AU(){return this._$AM._$AU}_$AI(a){Ii(this,a)}}var Dr={M:"$lit$",P:ri,A:Me,C:1,L:Gr,R:Ge,D:Mr,V:Ii,I:Vi,H:Ci,N:Ee,U:ao,B:De,F:io},bs=Xe.litHtmlPolyfillSupport;bs?.(Mi,Vi),(Xe.litHtmlVersions??=[]).push("3.3.0");var Er=(a,i,e)=>{let o=e?.renderBefore??i,r=o._$litPart$;if(r===void 0){let n=e?.renderBefore??null;o._$litPart$=r=new Vi(i.insertBefore(Ni(),n),n,void 0,e??{})}return r._$AI(a),r};var eo=globalThis;class wa extends hi{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){let a=super.createRenderRoot();return this.renderOptions.renderBefore??=a.firstChild,a}update(a){let i=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(a),this._$Do=Er(i,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return za}}wa._$litElement$=!0,wa.finalized=!0,eo.litElementHydrateSupport?.({LitElement:wa});var gs=eo.litElementPolyfillSupport;gs?.({LitElement:wa});(eo.litElementVersions??=[]).push("4.2.0");var T=(a)=>(i,e)=>{e!==void 0?e.addInitializer(()=>{customElements.define(a,i)}):customElements.define(a,i)};var vs={attribute:!0,type:String,converter:Qi,reflect:!1,hasChanged:be},ks=(a=vs,i,e)=>{let{kind:o,metadata:r}=e,n=globalThis.litPropertyMetadata.get(r);if(n===void 0&&globalThis.litPropertyMetadata.set(r,n=new Map),o==="setter"&&((a=Object.create(a)).wrapped=!0),n.set(e.name,a),o==="accessor"){let{name:t}=e;return{set(s){let l=i.get.call(this);i.set.call(this,s),this.requestUpdate(t,l,a)},init(s){return s!==void 0&&this.C(t,void 0,a,s),s}}}if(o==="setter"){let{name:t}=e;return function(s){let l=this[t];i.call(this,s),this.requestUpdate(t,l,a)}}throw Error("Unsupported decorator location: "+o)};function z(a){return(i,e)=>typeof e=="object"?ks(a,i,e):((o,r,n)=>{let t=r.hasOwnProperty(n);return r.constructor.createProperty(n,o),t?Object.getOwnPropertyDescriptor(r,n):void 0})(a,i,e)}function C(a){return z({...a,state:!0,attribute:!1})}var ji=(a,i,e)=>(e.configurable=!0,e.enumerable=!0,Reflect.decorate&&typeof i!="object"&&Object.defineProperty(a,i,e),e);function ca(a,i){return(e,o,r)=>{let n=(t)=>t.renderRoot?.querySelector(a)??null;if(i){let{get:t,set:s}=typeof o=="object"?e:r??(()=>{let l=Symbol();return{get(){return this[l]},set(u){this[l]=u}}})();return ji(e,o,{get(){let l=t.call(this);return l===void 0&&(l=n(this),(l!==null||this.hasUpdated)&&s.call(this,l)),l}})}return ji(e,o,{get(){return n(this)}})}}class oo{canVibrate;constructor(a){a.addController(this),this.canVibrate="vibrate"in navigator}trigger(a=10){if(!this.canVibrate)return;try{navigator.vibrate(a)}catch{}}click(){this.trigger(50)}lightClick(){this.trigger(35)}}function an(a){let i=a.replace(/-/g,"").substring(0,12),e=parseInt(i,16);return new Date(e)}function en(a){return a.toLocaleDateString("en-US",{year:"numeric",month:"short",day:"numeric",hour:"2-digit",minute:"2-digit",hour12:!0})}class ro extends EventTarget{host;_historyData=[];_hasData=null;_isInitialized=!1;_hasNextPage=!1;_initialLoadSize=20;_hasLoadedMore=!1;_clientSeed=null;_hasLoadedClientSeed=!1;constructor(a){super();this.host=a,a.addController(this),setTimeout(()=>{this.preloadHistory(),this.loadClientSeed()},100)}get historyData(){return this._historyData}get hasData(){return this._hasData}get isInitialized(){return this._isInitialized}get hasNextPage(){return this._hasNextPage}get clientSeed(){return this._clientSeed}get hasLoadedClientSeed(){return this._hasLoadedClientSeed}notifyDataChanged(){this.dispatchEvent(new CustomEvent("history-data-changed",{detail:{historyData:this._historyData,hasNextPage:this._hasNextPage,hasData:this._hasData}}))}notifyClientSeedChanged(){this.dispatchEvent(new CustomEvent("client-seed-changed",{detail:{clientSeed:this._clientSeed}}))}async preloadHistory(){if(!this.host.gameData?.baseUrl||!this.host.gameData?.authToken)return;try{let{historyData:a,hasNextPage:i}=await this.fetchHistory(void 0,this._initialLoadSize);this._historyData=a,this._hasData=a.length>0,this._hasNextPage=i,this._isInitialized=!0,this._hasLoadedMore=!1,this.notifyDataChanged()}catch(a){console.error("Failed to preload history:",a),this._isInitialized=!0,this._hasData=null}}async fetchHistory(a,i=5){if(!this.host.gameData?.baseUrl||!this.host.gameData?.authToken)return{historyData:[],hasNextPage:!1};let e=new URL(`${this.host.gameData.baseUrl}/bet/my-bets`);if(e.searchParams.append("limit",i.toString()),a)e.searchParams.append("beforeId",a);let o=await fetch(e.toString(),{headers:{"Content-Type":"application/json",Authorization:`Bearer ${this.host.gameData.authToken}`}});if(!o.ok)throw new Error(`HTTP error! status: ${o.status}`);let r=await o.json();return{historyData:r.results.map((t)=>({id:`${t.id.slice(0,3)}...${t.id.slice(-3)}`,fullId:t.id,timestamp:en(an(t.id)),currency:t.currency,bet:Number(t.amount),win:Number(t.payout)})),hasNextPage:!!r.nextCursor}}async refreshHistory(a=!1){try{let i=a&&this._hasLoadedMore?this._historyData.length:this._initialLoadSize,{historyData:e,hasNextPage:o}=await this.fetchHistory(void 0,i);if(this._historyData=e,this._hasData=e.length>0,this._hasNextPage=o,!a)this._hasLoadedMore=!1;this.notifyDataChanged()}catch(i){console.error("Failed to refresh history:",i)}}async loadMore(){if(!this._hasNextPage||this._historyData.length===0)return{historyData:[],hasNextPage:!1};let a=this._historyData[this._historyData.length-1],{historyData:i,hasNextPage:e}=await this.fetchHistory(a.fullId,this._initialLoadSize);return this._historyData=[...this._historyData,...i],this._hasNextPage=e,this._hasLoadedMore=!0,this.notifyDataChanged(),this.dispatchEvent(new CustomEvent("history-loaded-more")),{historyData:i,hasNextPage:e}}addNewBet(a){if(this._historyData.some((e)=>e.fullId===a.id))return;let i={id:`${a.id.slice(0,3)}...${a.id.slice(-3)}`,fullId:a.id,timestamp:en(an(a.id)),currency:a.currency,bet:Number(a.amount),win:Number(a.payout)};if(!this._hasLoadedMore&&this._historyData.length>=this._initialLoadSize)this._historyData=[i,...this._historyData.slice(0,this._initialLoadSize-1)],this._hasNextPage=!0;else this._historyData=[i,...this._historyData];this._hasData=!0,this.notifyDataChanged()}async loadClientSeed(){if(!this.host.gameData?.baseUrl||!this.host.gameData?.authToken||this._hasLoadedClientSeed)return;try{let a=await fetch(`${this.host.gameData.baseUrl}/provably-fair/my-info`,{method:"GET",headers:{"Content-Type":"application/json",Authorization:`Bearer ${this.host.gameData.authToken}`}});if(!a.ok)throw new Error(`HTTP error! status: ${a.status}`);let i=await a.json();this._clientSeed=i.clientSeed,this._hasLoadedClientSeed=!0,this.notifyClientSeedChanged()}catch(a){console.error("Failed to load client seed:",a)}}updateClientSeed(a){this._clientSeed=a,this.notifyClientSeedChanged()}}class no{host;muted=!1;audioCtx;buffer;spriteMap=null;constructor(a){this.host=a,a.addController(this);let i=window.AudioContext||window.webkitAudioContext;this.audioCtx=new i,fetch("https://assets.betorigami.com/sounds/sounds.mp3").then((e)=>{return e.arrayBuffer().then((o)=>{this.audioCtx.decodeAudioData(o,(r)=>{this.buffer=r})}).catch((o)=>{})}).catch(),fetch("https://assets.betorigami.com/sounds/sounds.json").then((e)=>e.json()).catch().then((e)=>{this.spriteMap=e.spritemap}).catch(),window.onclick=()=>{this.play("bet",!0),window.onclick=null}}async play(a,i,e=1,o,r=()=>{}){if(!this.buffer||!this.spriteMap)return;let n=this.audioCtx.createBufferSource();n.buffer=this.buffer;let t=this.spriteMap[a];try{if(this.audioCtx&&n){let s=this.audioCtx.createGain(),l=o??(this.host.gameData?.volume??100)/100,u=i??this.muted;return s.gain.value=u?0:Math.min(l,1),s.connect(this.audioCtx.destination),n.connect(s),n.playbackRate.value=e,n.start(0,t.start),setTimeout(()=>{n?.stop(),r()},1000*(t.end-t.start)),n}}catch(s){}}}var Za=2;var ta="USD";class Q extends wa{static componentStyles=[];emit(a,i){let e=new CustomEvent(a,{bubbles:!0,cancelable:!1,composed:!0,detail:{},...i});return this.dispatchEvent(e),e}}var ou=oi("language"),O="en";var Vs={ar:()=>Promise.resolve().then(() => sa(to(),1)),de:()=>Promise.resolve().then(() => sa(so(),1)),en:()=>Promise.resolve().then(() => sa(lo(),1)),es:()=>Promise.resolve().then(() => sa(uo(),1)),fi:()=>Promise.resolve().then(() => sa(co(),1)),fr:()=>Promise.resolve().then(() => sa(ho(),1)),hi:()=>Promise.resolve().then(() => sa(po(),1)),id:()=>Promise.resolve().then(() => sa(mo(),1)),ja:()=>Promise.resolve().then(() => sa(bo(),1)),ko:()=>Promise.resolve().then(() => sa(go(),1)),pl:()=>Promise.resolve().then(() => sa(vo(),1)),pt:()=>Promise.resolve().then(() => sa(ko(),1)),ru:()=>Promise.resolve().then(() => sa(fo(),1)),tr:()=>Promise.resolve().then(() => sa(wo(),1)),vi:()=>Promise.resolve().then(() => sa(yo(),1)),zh:()=>Promise.resolve().then(() => sa(zo(),1))};class on{loadedLanguages=new Set;loadingPromises=new Map;loadedTranslations=new Map;async loadLanguage(a){if(this.loadedLanguages.has(a))return;if(this.loadingPromises.has(a))return this.loadingPromises.get(a);let i=this.loadLanguageModule(a);this.loadingPromises.set(a,i);try{await i,this.loadedLanguages.add(a)}finally{this.loadingPromises.delete(a)}}getTranslationData(a){return this.loadedTranslations.get(a)||null}isLanguageLoaded(a){return this.loadedLanguages.has(a)}getLoadedLanguages(){return Array.from(this.loadedLanguages)}async preloadLanguages(a){let i=a.map((e)=>this.loadLanguage(e).catch(()=>{}));await Promise.all(i)}clearAll(){this.loadedLanguages.clear(),this.loadingPromises.clear(),this.loadedTranslations.clear(),xo()}async loadLanguageModule(a){try{let i=await Vs[a]();this.loadedTranslations.set(a,i.default),xo()}catch(i){throw i}}}var Ui=new on;Ui.loadLanguage(O).catch(()=>{});var nn=sa(to(),1),tn=sa(so(),1),sn=sa(lo(),1),ln=sa(uo(),1),dn=sa(co(),1),un=sa(ho(),1),cn=sa(po(),1),hn=sa(mo(),1),pn=sa(bo(),1),mn=sa(go(),1),bn=sa(vo(),1),gn=sa(ko(),1),vn=sa(fo(),1),kn=sa(wo(),1),fn=sa(yo(),1),wn=sa(zo(),1);var So={ar:nn.default,de:tn.default,en:sn.default,es:ln.default,fi:dn.default,fr:un.default,hi:cn.default,id:hn.default,ja:pn.default,ko:mn.default,pl:bn.default,pt:gn.default,ru:vn.default,tr:kn.default,vi:fn.default,zh:wn.default};function Cs(a){let i=Ui.getTranslationData(a);if(i)return i;return So[a]||So[O]}var Fu=oi(Symbol("translation"));class yn{cache=new Map;maxSize=1000;get(a){return this.cache.get(a)}set(a,i){if(this.cache.size>=this.maxSize)this.cache.clear();this.cache.set(a,i)}clear(){this.cache.clear()}size(){return this.cache.size}}var Io=new yn,rn=new Map;function Bs(a){let i=rn.get(a);if(!i)i=a.split("."),rn.set(a,i);return i}function zn(a,i,e){let o=Cs(i);try{let r=Bs(a),n=o;for(let t of r)if(n=n?.[t],n===void 0)break;if(typeof n==="string")return n;if(i!==O)return zn(a,O,e);return e||a}catch{return e||a}}function F(a,i=O,e){let o=e?`${a}:${i}:${e}`:`${a}:${i}`,r=Io.get(o);if(r!==void 0)return r;let n=zn(a,i,e);return Io.set(o,n),n}function xo(){Io.clear()}var fa={betAmount:"0.00",updateBetAmount:()=>{},updateBalance:()=>{},currency:ta,currencyDecimals:2,showCurrencyAsText:!1,balance:0,baseUrl:"",authToken:"",publicKey:"",hotkeysOpenEnabled:!1,showMaxBetButton:!1,volume:100,instantBetEnabled:!1,mainWidth:0,updateMainWidth:()=>{},updateHotkeysOpenEnabled:()=>{},updateShowMaxBetButton:()=>{},updateVolume:()=>{},updateInstantBetEnabled:()=>{},language:O,autobetNumberOfBets:0,updateAutobetNumberOfBets:()=>{},soundController:void 0,historyController:void 0,hapticController:void 0,lobbyUrl:"https://betorigami.com",depositUrl:void 0,hasLoadedBalance:!1,maxPayout:null,minBet:null,maxBet:null,edge:2,footerPosition:"BELOW",logoUrl:null},X=oi(Symbol("game"));var Ls=20,Ts=1,Hi=1e6,xn=1e6,Os=-7,Js=21,_s=!1,Ai="[big.js] ",qi=Ai+"Invalid ",ve=qi+"decimal places",$s=qi+"rounding mode",Sn=Ai+"Division by zero",ha={},Ga=void 0,Qs=/^-?(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i;function In(){function a(i){var e=this;if(!(e instanceof a))return i===Ga&&arguments.length===0?In():new a(i);if(i instanceof a)e.s=i.s,e.e=i.e,e.c=i.c.slice();else{if(typeof i!=="string"){if(a.strict===!0&&typeof i!=="bigint")throw TypeError(qi+"value");i=i===0&&1/i<0?"-0":String(i)}Ys(e,i)}e.constructor=a}return a.prototype=ha,a.DP=Ls,a.RM=Ts,a.NE=Os,a.PE=Js,a.strict=_s,a.roundDown=0,a.roundHalfUp=1,a.roundHalfEven=2,a.roundUp=3,a}function Ys(a,i){var e,o,r;if(!Qs.test(i))throw Error(qi+"number");if(a.s=i.charAt(0)=="-"?(i=i.slice(1),-1):1,(e=i.indexOf("."))>-1)i=i.replace(".","");if((o=i.search(/e/i))>0){if(e<0)e=o;e+=+i.slice(o+1),i=i.substring(0,o)}else if(e<0)e=i.length;r=i.length;for(o=0;o<r&&i.charAt(o)=="0";)++o;if(o==r)a.c=[a.e=0];else{for(;r>0&&i.charAt(--r)=="0";);a.e=e-o-1,a.c=[];for(e=0;o<=r;)a.c[e++]=+i.charAt(o++)}return a}function Fi(a,i,e,o){var r=a.c;if(e===Ga)e=a.constructor.RM;if(e!==0&&e!==1&&e!==2&&e!==3)throw Error($s);if(i<1)if(o=e===3&&(o||!!r[0])||i===0&&(e===1&&r[0]>=5||e===2&&(r[0]>5||r[0]===5&&(o||r[1]!==Ga))),r.length=1,o)a.e=a.e-i+1,r[0]=1;else r[0]=a.e=0;else if(i<r.length){if(o=e===1&&r[i]>=5||e===2&&(r[i]>5||r[i]===5&&(o||r[i+1]!==Ga||r[i-1]&1))||e===3&&(o||!!r[0]),r.length=i,o){for(;++r[--i]>9;)if(r[i]=0,i===0){++a.e,r.unshift(1);break}}for(i=r.length;!r[--i];)r.pop()}return a}function Ri(a,i,e){var o=a.e,r=a.c.join(""),n=r.length;if(i)r=r.charAt(0)+(n>1?"."+r.slice(1):"")+(o<0?"e":"e+")+o;else if(o<0){for(;++o;)r="0"+r;r="0."+r}else if(o>0){if(++o>n)for(o-=n;o--;)r+="0";else if(o<n)r=r.slice(0,o)+"."+r.slice(o)}else if(n>1)r=r.charAt(0)+"."+r.slice(1);return a.s<0&&e?"-"+r:r}ha.abs=function(){var a=new this.constructor(this);return a.s=1,a};ha.cmp=function(a){var i,e=this,o=e.c,r=(a=new e.constructor(a)).c,n=e.s,t=a.s,s=e.e,l=a.e;if(!o[0]||!r[0])return!o[0]?!r[0]?0:-t:n;if(n!=t)return n;if(i=n<0,s!=l)return s>l^i?1:-1;t=(s=o.length)<(l=r.length)?s:l;for(n=-1;++n<t;)if(o[n]!=r[n])return o[n]>r[n]^i?1:-1;return s==l?0:s>l^i?1:-1};ha.div=function(a){var i=this,e=i.constructor,o=i.c,r=(a=new e(a)).c,n=i.s==a.s?1:-1,t=e.DP;if(t!==~~t||t<0||t>Hi)throw Error(ve);if(!r[0])throw Error(Sn);if(!o[0])return a.s=n,a.c=[a.e=0],a;var s,l,u,h,f,c=r.slice(),y=s=r.length,k=o.length,b=o.slice(0,s),I=b.length,m=a,g=m.c=[],p=0,v=t+(m.e=i.e-a.e)+1;m.s=n,n=v<0?0:v,c.unshift(0);for(;I++<s;)b.push(0);do{for(u=0;u<10;u++){if(s!=(I=b.length))h=s>I?1:-1;else for(f=-1,h=0;++f<s;)if(r[f]!=b[f]){h=r[f]>b[f]?1:-1;break}if(h<0){for(l=I==s?r:c;I;){if(b[--I]<l[I]){f=I;for(;f&&!b[--f];)b[f]=9;--b[f],b[I]+=10}b[I]-=l[I]}for(;!b[0];)b.shift()}else break}if(g[p++]=h?u:++u,b[0]&&h)b[I]=o[y]||0;else b=[o[y]]}while((y++<k||b[0]!==Ga)&&n--);if(!g[0]&&p!=1)g.shift(),m.e--,v--;if(p>v)Fi(m,v,e.RM,b[0]!==Ga);return m};ha.eq=function(a){return this.cmp(a)===0};ha.gt=function(a){return this.cmp(a)>0};ha.gte=function(a){return this.cmp(a)>-1};ha.lt=function(a){return this.cmp(a)<0};ha.lte=function(a){return this.cmp(a)<1};ha.minus=ha.sub=function(a){var i,e,o,r,n=this,t=n.constructor,s=n.s,l=(a=new t(a)).s;if(s!=l)return a.s=-l,n.plus(a);var u=n.c.slice(),h=n.e,f=a.c,c=a.e;if(!u[0]||!f[0]){if(f[0])a.s=-l;else if(u[0])a=new t(n);else a.s=1;return a}if(s=h-c){if(r=s<0)s=-s,o=u;else c=h,o=f;o.reverse();for(l=s;l--;)o.push(0);o.reverse()}else{e=((r=u.length<f.length)?u:f).length;for(s=l=0;l<e;l++)if(u[l]!=f[l]){r=u[l]<f[l];break}}if(r)o=u,u=f,f=o,a.s=-a.s;if((l=(e=f.length)-(i=u.length))>0)for(;l--;)u[i++]=0;for(l=i;e>s;){if(u[--e]<f[e]){for(i=e;i&&!u[--i];)u[i]=9;--u[i],u[e]+=10}u[e]-=f[e]}for(;u[--l]===0;)u.pop();for(;u[0]===0;)u.shift(),--c;if(!u[0])a.s=1,u=[c=0];return a.c=u,a.e=c,a};ha.mod=function(a){var i,e=this,o=e.constructor,r=e.s,n=(a=new o(a)).s;if(!a.c[0])throw Error(Sn);if(e.s=a.s=1,i=a.cmp(e)==1,e.s=r,a.s=n,i)return new o(e);return r=o.DP,n=o.RM,o.DP=o.RM=0,e=e.div(a),o.DP=r,o.RM=n,this.minus(e.times(a))};ha.neg=function(){var a=new this.constructor(this);return a.s=-a.s,a};ha.plus=ha.add=function(a){var i,e,o,r=this,n=r.constructor;if(a=new n(a),r.s!=a.s)return a.s=-a.s,r.minus(a);var{e:t,c:s}=r,l=a.e,u=a.c;if(!s[0]||!u[0]){if(!u[0])if(s[0])a=new n(r);else a.s=r.s;return a}if(s=s.slice(),i=t-l){if(i>0)l=t,o=u;else i=-i,o=s;o.reverse();for(;i--;)o.push(0);o.reverse()}if(s.length-u.length<0)o=u,u=s,s=o;i=u.length;for(e=0;i;s[i]%=10)e=(s[--i]=s[i]+u[i]+e)/10|0;if(e)s.unshift(e),++l;for(i=s.length;s[--i]===0;)s.pop();return a.c=s,a.e=l,a};ha.pow=function(a){var i=this,e=new i.constructor("1"),o=e,r=a<0;if(a!==~~a||a<-xn||a>xn)throw Error(qi+"exponent");if(r)a=-a;for(;;){if(a&1)o=o.times(i);if(a>>=1,!a)break;i=i.times(i)}return r?e.div(o):o};ha.prec=function(a,i){if(a!==~~a||a<1||a>Hi)throw Error(qi+"precision");return Fi(new this.constructor(this),a,i)};ha.round=function(a,i){if(a===Ga)a=0;else if(a!==~~a||a<-Hi||a>Hi)throw Error(ve);return Fi(new this.constructor(this),a+this.e+1,i)};ha.sqrt=function(){var a,i,e,o=this,r=o.constructor,n=o.s,t=o.e,s=new r("0.5");if(!o.c[0])return new r(o);if(n<0)throw Error(Ai+"No square root");if(n=Math.sqrt(+Ri(o,!0,!0)),n===0||n===1/0){if(i=o.c.join(""),!(i.length+t&1))i+="0";n=Math.sqrt(i),t=((t+1)/2|0)-(t<0||t&1),a=new r((n==1/0?"5e":(n=n.toExponential()).slice(0,n.indexOf("e")+1))+t)}else a=new r(n+"");t=a.e+(r.DP+=4);do e=a,a=s.times(e.plus(o.div(e)));while(e.c.slice(0,t).join("")!==a.c.slice(0,t).join(""));return Fi(a,(r.DP-=4)+a.e+1,r.RM)};ha.times=ha.mul=function(a){var i,e=this,o=e.constructor,r=e.c,n=(a=new o(a)).c,t=r.length,s=n.length,l=e.e,u=a.e;if(a.s=e.s==a.s?1:-1,!r[0]||!n[0])return a.c=[a.e=0],a;if(a.e=l+u,t<s)i=r,r=n,n=i,u=t,t=s,s=u;for(i=new Array(u=t+s);u--;)i[u]=0;for(l=s;l--;){s=0;for(u=t+l;u>l;)s=i[u]+n[l]*r[u-l-1]+s,i[u--]=s%10,s=s/10|0;i[u]=s}if(s)++a.e;else i.shift();for(l=i.length;!i[--l];)i.pop();return a.c=i,a};ha.toExponential=function(a,i){var e=this,o=e.c[0];if(a!==Ga){if(a!==~~a||a<0||a>Hi)throw Error(ve);e=Fi(new e.constructor(e),++a,i);for(;e.c.length<a;)e.c.push(0)}return Ri(e,!0,!!o)};ha.toFixed=function(a,i){var e=this,o=e.c[0];if(a!==Ga){if(a!==~~a||a<0||a>Hi)throw Error(ve);e=Fi(new e.constructor(e),a+e.e+1,i);for(a=a+e.e+1;e.c.length<a;)e.c.push(0)}return Ri(e,!1,!!o)};ha.toJSON=ha.toString=function(){var a=this,i=a.constructor;return Ri(a,a.e<=i.NE||a.e>=i.PE,!!a.c[0])};if(typeof Symbol!=="undefined")ha[Symbol.for("nodejs.util.inspect.custom")]=ha.toJSON;ha.toNumber=function(){var a=+Ri(this,!0,!0);if(this.constructor.strict===!0&&!this.eq(a.toString()))throw Error(Ai+"Imprecise conversion");return a};ha.toPrecision=function(a,i){var e=this,o=e.constructor,r=e.c[0];if(a!==Ga){if(a!==~~a||a<1||a>Hi)throw Error(qi+"precision");e=Fi(new o(e),a,i);for(;e.c.length<a;)e.c.push(0)}return Ri(e,a<=e.e||e.e<=o.NE||e.e>=o.PE,!!r)};ha.valueOf=function(){var a=this,i=a.constructor;if(i.strict===!0)throw Error(Ai+"valueOf disallowed");return Ri(a,a.e<=i.NE||a.e>=i.PE,!0)};var Ns=In(),P=Ns;class ke extends Q{constructor(){super(...arguments);this.currency=ta;this.showCurrencyAsText=!1;this.balance=fa.balance;this.currencyDecimals=fa.currencyDecimals;this.baseUrl=fa.baseUrl;this.authToken=fa.authToken;this.origamiGame="DICE";this.lobbyUrl=fa.lobbyUrl;this.depositUrl=fa.depositUrl;this.maxPayout=fa.maxPayout;this.minBet=fa.minBet;this.maxBet=fa.maxBet;this.edge=fa.edge;this.footerPosition=fa.footerPosition;this.logoUrl=null;this.betAmount=fa.betAmount;this.autobetNumberOfBets=fa.autobetNumberOfBets;this.hotkeysOpenEnabled=!1;this.showMaxBetButton=fa.showMaxBetButton;this.volume=fa.volume;this.instantBetEnabled=fa.instantBetEnabled;this.mainWidth=fa.mainWidth;this.publicKey=fa.publicKey;this.scale=1;this.language=fa.language}_soundController=new no(this);_historyController=new ro(this);_hapticController=new oo(this);_resizeObserver=null;hasLoadedBalance=!1;_gameProvider=new yi(this,{context:X,initialValue:this.createGameContextValue()});connectedCallback(){super.connectedCallback(),this.updateProviderValue(),this.fetchBalance(),this.fetchPublicKey(),this.setupResizeObserver(),this.calculateScale()}async firstUpdated(a){super.firstUpdated(a),await this.updateComplete,this.updateBetAmount(P(this.minBet??0))}disconnectedCallback(){super.disconnectedCallback(),this.cleanupResizeObserver()}updated(a){if(super.updated(a),a.has("currency")||a.has("balance")||a.has("baseUrl")||a.has("showCurrencyAsText")||a.has("authToken")||a.has("hotkeysOpenEnabled")||a.has("volume")||a.has("instantBetEnabled")||a.has("showMaxBetButton")||a.has("mainWidth"))this.updateProviderValue()}get gameData(){return this._gameProvider.value}createGameContextValue(){return{betAmount:this.betAmount,updateBetAmount:this.updateBetAmount.bind(this),updateBalance:this.updateBalance.bind(this),currency:this.currency,showCurrencyAsText:this.showCurrencyAsText,currencyDecimals:this.currencyDecimals,lobbyUrl:this.lobbyUrl,depositUrl:this.depositUrl,maxPayout:this.maxPayout,minBet:this.minBet,maxBet:this.maxBet,edge:this.edge,balance:this.balance,hasLoadedBalance:this.hasLoadedBalance,baseUrl:this.baseUrl,authToken:this.authToken,publicKey:this.publicKey,autobetNumberOfBets:this.autobetNumberOfBets,hotkeysOpenEnabled:this.hotkeysOpenEnabled,showMaxBetButton:this.showMaxBetButton,volume:this.volume,instantBetEnabled:this.instantBetEnabled,soundController:this._soundController,historyController:this._historyController,hapticController:this._hapticController,updateHotkeysOpenEnabled:this.updateHotkeysOpenEnabled.bind(this),updateShowMaxBetButton:this.updateShowMaxBetButton.bind(this),updateVolume:this.updateVolume.bind(this),updateInstantBetEnabled:this.updateInstantBetEnabled.bind(this),updateAutobetNumberOfBets:this.updateAutobetNumberOfBets.bind(this),mainWidth:this.mainWidth,updateMainWidth:this.updateMainWidth.bind(this),language:this.language,footerPosition:this.footerPosition,logoUrl:this.logoUrl}}updateProviderValue(){this._gameProvider.setValue(this.createGameContextValue())}fetchBalance=async()=>{if(!this.authToken||!this.baseUrl){this.balance=1000,this.hasLoadedBalance=!0,this.updateProviderValue();return}try{let a=await fetch(`${this.baseUrl}/users/balance?currency=${this.currency}&origamiGame=${this.origamiGame}`,{headers:{Authorization:`Bearer ${this.authToken}`,"Content-Type":"application/json"}});if(!a.ok){console.error("Failed to fetch balance:",a.statusText);return}let i=await a.json();this.balance=P(i.balance).toNumber(),this.hasLoadedBalance=!0,this.updateProviderValue()}catch(a){console.error("Error fetching balance:",a)}};fetchPublicKey=async()=>{if(!this.authToken||!this.baseUrl)return;let a=await fetch(`${this.baseUrl}/provably-fair/public-key`);if(!a.ok){console.error("Failed to fetch public key:",a.statusText);return}let i=await a.json();this.publicKey=i.publicKey};updateHotkeysOpenEnabled(a){this.hotkeysOpenEnabled=a,this.updateProviderValue()}updateShowMaxBetButton(a){this.showMaxBetButton=a,this.updateProviderValue()}updateVolume(a){this.volume=a,this.updateProviderValue()}updateInstantBetEnabled(a){this.instantBetEnabled=a,this.updateProviderValue()}updateAutobetNumberOfBets(a){this.autobetNumberOfBets=a,this.updateProviderValue()}updateMainWidth(a){this.mainWidth=a,this.updateProviderValue()}updateBetAmount(a){if(a.lt(0)){this.betAmount="0";return}let i=a.toFixed(this.currencyDecimals);this.betAmount=i,this.updateProviderValue()}updateBalance(a){if(a.lt(0)){this.balance=0;return}this.balance=a.toNumber(),this.updateProviderValue()}_boundCalculateScale=this.calculateScale.bind(this);setupResizeObserver(){if(typeof ResizeObserver!=="undefined")this._resizeObserver=new ResizeObserver(()=>{this.calculateScale(),this.gameData.updateMainWidth(document.documentElement.clientWidth)}),this._resizeObserver.observe(document.body);else window.addEventListener("resize",this._boundCalculateScale)}cleanupResizeObserver(){if(this._resizeObserver)this._resizeObserver.disconnect(),this._resizeObserver=null;else window.removeEventListener("resize",this._boundCalculateScale)}calculateScale(){let a=document.documentElement.clientWidth,i=1200,e=a/1200;this.scale=e,this.requestUpdate()}render(){let a=(()=>{switch(this.origamiGame){case"DICE":return H`<origami-dice-game></origami-dice-game>`;case"KENO":return H`<origami-keno-game></origami-keno-game>`;case"MINES":return H`<origami-mines-game></origami-mines-game>`;case"LIMBO":return H`<origami-limbo-game></origami-limbo-game>`;default:this.origamiGame}})(),i=`
13
+ \f\r"'\`<>=]|("|')|))|$)`,"g"),Yr=/'/g,Nr=/"/g,Ur=/^(?:script|style|textarea|title)$/i,Ae=(a)=>(i,...e)=>({_$litType$:a,strings:i,values:e}),H=Ae(1),oa=Ae(2),ud=Ae(3),za=Symbol.for("lit-noChange"),L=Symbol.for("lit-nothing"),Xr=new WeakMap,xi=Si.createTreeWalker(Si,129);function Ar(a,i){if(!Ue(a)||!a.hasOwnProperty("raw"))throw Error("invalid template strings array");return _r!==void 0?_r.createHTML(i):i}var Gr=(a,i)=>{let e=a.length-1,o=[],r,n=i===2?"<svg>":i===3?"<math>":"",t=Yi;for(let s=0;s<e;s++){let l=a[s],u,h,f=-1,c=0;for(;c<l.length&&(t.lastIndex=c,h=t.exec(l),h!==null);)c=t.lastIndex,t===Yi?h[1]==="!--"?t=$r:h[1]!==void 0?t=Qr:h[2]!==void 0?(Ur.test(h[2])&&(r=RegExp("</"+h[2],"g")),t=zi):h[3]!==void 0&&(t=zi):t===zi?h[0]===">"?(t=r??Yi,f=-1):h[1]===void 0?f=-2:(f=t.lastIndex-h[2].length,u=h[1],t=h[3]===void 0?zi:h[3]==='"'?Nr:Yr):t===Nr||t===Yr?t=zi:t===$r||t===Qr?t=Yi:(t=zi,r=void 0);let y=t===zi&&a[s+1].startsWith("/>")?" ":"";n+=t===Yi?l+ms:f>=0?(o.push(u),l.slice(0,f)+"$lit$"+l.slice(f)+ri+y):l+ri+(f===-2?s:y)}return[Ar(a,n+(a[e]||"<?>")+(i===2?"</svg>":i===3?"</math>":"")),o]};class Mi{constructor({strings:a,_$litType$:i},e){let o;this.parts=[];let r=0,n=0,t=a.length-1,s=this.parts,[l,u]=Gr(a,i);if(this.el=Mi.createElement(l,e),xi.currentNode=this.el.content,i===2||i===3){let h=this.el.content.firstChild;h.replaceWith(...h.childNodes)}for(;(o=xi.nextNode())!==null&&s.length<t;){if(o.nodeType===1){if(o.hasAttributes())for(let h of o.getAttributeNames())if(h.endsWith("$lit$")){let f=u[n++],c=o.getAttribute(h).split(ri),y=/([.?@])?(.*)/.exec(f);s.push({type:1,index:r,name:y[2],strings:c,ctor:y[1]==="."?De:y[1]==="?"?Ee:y[1]==="@"?ao:Ci}),o.removeAttribute(h)}else h.startsWith(ri)&&(s.push({type:6,index:r}),o.removeAttribute(h));if(Ur.test(o.tagName)){let h=o.textContent.split(ri),f=h.length-1;if(f>0){o.textContent=ge?ge.emptyScript:"";for(let c=0;c<f;c++)o.append(h[c],Ni()),xi.nextNode(),s.push({type:2,index:++r});o.append(h[f],Ni())}}}else if(o.nodeType===8)if(o.data===Me)s.push({type:2,index:r});else{let h=-1;for(;(h=o.data.indexOf(ri,h+1))!==-1;)s.push({type:7,index:r}),h+=ri.length-1}r++}}static createElement(a,i){let e=Si.createElement("template");return e.innerHTML=a,e}}function Ii(a,i,e=a,o){if(i===za)return i;let r=o!==void 0?e._$Co?.[o]:e._$Cl,n=Xi(i)?void 0:i._$litDirective$;return r?.constructor!==n&&(r?._$AO?.(!1),n===void 0?r=void 0:(r=new n(a),r._$AT(a,e,o)),o!==void 0?(e._$Co??=[])[o]=r:e._$Cl=r),r!==void 0&&(i=Ii(a,r._$AS(a,i.values),r,o)),i}class Ge{constructor(a,i){this._$AV=[],this._$AN=void 0,this._$AD=a,this._$AM=i}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(a){let{el:{content:i},parts:e}=this._$AD,o=(a?.creationScope??Si).importNode(i,!0);xi.currentNode=o;let r=xi.nextNode(),n=0,t=0,s=e[0];for(;s!==void 0;){if(n===s.index){let l;s.type===2?l=new Vi(r,r.nextSibling,this,a):s.type===1?l=new s.ctor(r,s.name,s.strings,this,a):s.type===6&&(l=new io(r,this,a)),this._$AV.push(l),s=e[++t]}n!==s?.index&&(r=xi.nextNode(),n++)}return xi.currentNode=Si,o}p(a){let i=0;for(let e of this._$AV)e!==void 0&&(e.strings!==void 0?(e._$AI(a,e,i),i+=e.strings.length-2):e._$AI(a[i])),i++}}class Vi{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(a,i,e,o){this.type=2,this._$AH=L,this._$AN=void 0,this._$AA=a,this._$AB=i,this._$AM=e,this.options=o,this._$Cv=o?.isConnected??!0}get parentNode(){let a=this._$AA.parentNode,i=this._$AM;return i!==void 0&&a?.nodeType===11&&(a=i.parentNode),a}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(a,i=this){a=Ii(this,a,i),Xi(a)?a===L||a==null||a===""?(this._$AH!==L&&this._$AR(),this._$AH=L):a!==this._$AH&&a!==za&&this._(a):a._$litType$!==void 0?this.$(a):a.nodeType!==void 0?this.T(a):Mr(a)?this.k(a):this._(a)}O(a){return this._$AA.parentNode.insertBefore(a,this._$AB)}T(a){this._$AH!==a&&(this._$AR(),this._$AH=this.O(a))}_(a){this._$AH!==L&&Xi(this._$AH)?this._$AA.nextSibling.data=a:this.T(Si.createTextNode(a)),this._$AH=a}$(a){let{values:i,_$litType$:e}=a,o=typeof e=="number"?this._$AC(a):(e.el===void 0&&(e.el=Mi.createElement(Ar(e.h,e.h[0]),this.options)),e);if(this._$AH?._$AD===o)this._$AH.p(i);else{let r=new Ge(o,this),n=r.u(this.options);r.p(i),this.T(n),this._$AH=r}}_$AC(a){let i=Xr.get(a.strings);return i===void 0&&Xr.set(a.strings,i=new Mi(a)),i}k(a){Ue(this._$AH)||(this._$AH=[],this._$AR());let i=this._$AH,e,o=0;for(let r of a)o===i.length?i.push(e=new Vi(this.O(Ni()),this.O(Ni()),this,this.options)):e=i[o],e._$AI(r),o++;o<i.length&&(this._$AR(e&&e._$AB.nextSibling,o),i.length=o)}_$AR(a=this._$AA.nextSibling,i){for(this._$AP?.(!1,!0,i);a&&a!==this._$AB;){let e=a.nextSibling;a.remove(),a=e}}setConnected(a){this._$AM===void 0&&(this._$Cv=a,this._$AP?.(a))}}class Ci{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(a,i,e,o,r){this.type=1,this._$AH=L,this._$AN=void 0,this.element=a,this.name=i,this._$AM=o,this.options=r,e.length>2||e[0]!==""||e[1]!==""?(this._$AH=Array(e.length-1).fill(new String),this.strings=e):this._$AH=L}_$AI(a,i=this,e,o){let r=this.strings,n=!1;if(r===void 0)a=Ii(this,a,i,0),n=!Xi(a)||a!==this._$AH&&a!==za,n&&(this._$AH=a);else{let t=a,s,l;for(a=r[0],s=0;s<r.length-1;s++)l=Ii(this,t[e+s],i,s),l===za&&(l=this._$AH[s]),n||=!Xi(l)||l!==this._$AH[s],l===L?a=L:a!==L&&(a+=(l??"")+r[s+1]),this._$AH[s]=l}n&&!o&&this.j(a)}j(a){a===L?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,a??"")}}class De extends Ci{constructor(){super(...arguments),this.type=3}j(a){this.element[this.name]=a===L?void 0:a}}class Ee extends Ci{constructor(){super(...arguments),this.type=4}j(a){this.element.toggleAttribute(this.name,!!a&&a!==L)}}class ao extends Ci{constructor(a,i,e,o,r){super(a,i,e,o,r),this.type=5}_$AI(a,i=this){if((a=Ii(this,a,i,0)??L)===za)return;let e=this._$AH,o=a===L&&e!==L||a.capture!==e.capture||a.once!==e.once||a.passive!==e.passive,r=a!==L&&(e===L||o);o&&this.element.removeEventListener(this.name,this,e),r&&this.element.addEventListener(this.name,this,a),this._$AH=a}handleEvent(a){typeof this._$AH=="function"?this._$AH.call(this.options?.host??this.element,a):this._$AH.handleEvent(a)}}class io{constructor(a,i,e){this.element=a,this.type=6,this._$AN=void 0,this._$AM=i,this.options=e}get _$AU(){return this._$AM._$AU}_$AI(a){Ii(this,a)}}var Dr={M:"$lit$",P:ri,A:Me,C:1,L:Gr,R:Ge,D:Mr,V:Ii,I:Vi,H:Ci,N:Ee,U:ao,B:De,F:io},bs=Xe.litHtmlPolyfillSupport;bs?.(Mi,Vi),(Xe.litHtmlVersions??=[]).push("3.3.0");var Er=(a,i,e)=>{let o=e?.renderBefore??i,r=o._$litPart$;if(r===void 0){let n=e?.renderBefore??null;o._$litPart$=r=new Vi(i.insertBefore(Ni(),n),n,void 0,e??{})}return r._$AI(a),r};var eo=globalThis;class wa extends hi{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){let a=super.createRenderRoot();return this.renderOptions.renderBefore??=a.firstChild,a}update(a){let i=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(a),this._$Do=Er(i,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return za}}wa._$litElement$=!0,wa.finalized=!0,eo.litElementHydrateSupport?.({LitElement:wa});var gs=eo.litElementPolyfillSupport;gs?.({LitElement:wa});(eo.litElementVersions??=[]).push("4.2.0");var T=(a)=>(i,e)=>{e!==void 0?e.addInitializer(()=>{customElements.define(a,i)}):customElements.define(a,i)};var vs={attribute:!0,type:String,converter:Qi,reflect:!1,hasChanged:be},ks=(a=vs,i,e)=>{let{kind:o,metadata:r}=e,n=globalThis.litPropertyMetadata.get(r);if(n===void 0&&globalThis.litPropertyMetadata.set(r,n=new Map),o==="setter"&&((a=Object.create(a)).wrapped=!0),n.set(e.name,a),o==="accessor"){let{name:t}=e;return{set(s){let l=i.get.call(this);i.set.call(this,s),this.requestUpdate(t,l,a)},init(s){return s!==void 0&&this.C(t,void 0,a,s),s}}}if(o==="setter"){let{name:t}=e;return function(s){let l=this[t];i.call(this,s),this.requestUpdate(t,l,a)}}throw Error("Unsupported decorator location: "+o)};function z(a){return(i,e)=>typeof e=="object"?ks(a,i,e):((o,r,n)=>{let t=r.hasOwnProperty(n);return r.constructor.createProperty(n,o),t?Object.getOwnPropertyDescriptor(r,n):void 0})(a,i,e)}function C(a){return z({...a,state:!0,attribute:!1})}var ji=(a,i,e)=>(e.configurable=!0,e.enumerable=!0,Reflect.decorate&&typeof i!="object"&&Object.defineProperty(a,i,e),e);function ca(a,i){return(e,o,r)=>{let n=(t)=>t.renderRoot?.querySelector(a)??null;if(i){let{get:t,set:s}=typeof o=="object"?e:r??(()=>{let l=Symbol();return{get(){return this[l]},set(u){this[l]=u}}})();return ji(e,o,{get(){let l=t.call(this);return l===void 0&&(l=n(this),(l!==null||this.hasUpdated)&&s.call(this,l)),l}})}return ji(e,o,{get(){return n(this)}})}}class oo{canVibrate;constructor(a){a.addController(this),this.canVibrate="vibrate"in navigator}trigger(a=10){if(!this.canVibrate)return;try{navigator.vibrate(a)}catch{}}click(){this.trigger(50)}lightClick(){this.trigger(35)}}function an(a){let i=a.replace(/-/g,"").substring(0,12),e=parseInt(i,16);return new Date(e)}function en(a){return a.toLocaleDateString("en-US",{year:"numeric",month:"short",day:"numeric",hour:"2-digit",minute:"2-digit",hour12:!0})}class ro extends EventTarget{host;_historyData=[];_hasData=null;_isInitialized=!1;_hasNextPage=!1;_initialLoadSize=20;_hasLoadedMore=!1;_clientSeed=null;_hasLoadedClientSeed=!1;constructor(a){super();this.host=a,a.addController(this),setTimeout(()=>{this.preloadHistory(),this.loadClientSeed()},100)}get historyData(){return this._historyData}get hasData(){return this._hasData}get isInitialized(){return this._isInitialized}get hasNextPage(){return this._hasNextPage}get clientSeed(){return this._clientSeed}get hasLoadedClientSeed(){return this._hasLoadedClientSeed}notifyDataChanged(){this.dispatchEvent(new CustomEvent("history-data-changed",{detail:{historyData:this._historyData,hasNextPage:this._hasNextPage,hasData:this._hasData}}))}notifyClientSeedChanged(){this.dispatchEvent(new CustomEvent("client-seed-changed",{detail:{clientSeed:this._clientSeed}}))}async preloadHistory(){if(!this.host.gameData?.baseUrl||!this.host.gameData?.authToken)return;try{let{historyData:a,hasNextPage:i}=await this.fetchHistory(void 0,this._initialLoadSize);this._historyData=a,this._hasData=a.length>0,this._hasNextPage=i,this._isInitialized=!0,this._hasLoadedMore=!1,this.notifyDataChanged()}catch(a){console.error("Failed to preload history:",a),this._isInitialized=!0,this._hasData=null}}async fetchHistory(a,i=5){if(!this.host.gameData?.baseUrl||!this.host.gameData?.authToken)return{historyData:[],hasNextPage:!1};let e=new URL(`${this.host.gameData.baseUrl}/bet/my-bets`);if(e.searchParams.append("limit",i.toString()),a)e.searchParams.append("beforeId",a);let o=await fetch(e.toString(),{headers:{"Content-Type":"application/json",Authorization:`Bearer ${this.host.gameData.authToken}`}});if(!o.ok)throw new Error(`HTTP error! status: ${o.status}`);let r=await o.json();return{historyData:r.results.map((t)=>({id:`${t.id.slice(0,3)}...${t.id.slice(-3)}`,fullId:t.id,timestamp:en(an(t.id)),currency:t.currency,bet:Number(t.amount),win:Number(t.payout)})),hasNextPage:!!r.nextCursor}}async refreshHistory(a=!1){try{let i=a&&this._hasLoadedMore?this._historyData.length:this._initialLoadSize,{historyData:e,hasNextPage:o}=await this.fetchHistory(void 0,i);if(this._historyData=e,this._hasData=e.length>0,this._hasNextPage=o,!a)this._hasLoadedMore=!1;this.notifyDataChanged()}catch(i){console.error("Failed to refresh history:",i)}}async loadMore(){if(!this._hasNextPage||this._historyData.length===0)return{historyData:[],hasNextPage:!1};let a=this._historyData[this._historyData.length-1],{historyData:i,hasNextPage:e}=await this.fetchHistory(a.fullId,this._initialLoadSize);return this._historyData=[...this._historyData,...i],this._hasNextPage=e,this._hasLoadedMore=!0,this.notifyDataChanged(),this.dispatchEvent(new CustomEvent("history-loaded-more")),{historyData:i,hasNextPage:e}}addNewBet(a){if(this._historyData.some((e)=>e.fullId===a.id))return;let i={id:`${a.id.slice(0,3)}...${a.id.slice(-3)}`,fullId:a.id,timestamp:en(an(a.id)),currency:a.currency,bet:Number(a.amount),win:Number(a.payout)};if(!this._hasLoadedMore&&this._historyData.length>=this._initialLoadSize)this._historyData=[i,...this._historyData.slice(0,this._initialLoadSize-1)],this._hasNextPage=!0;else this._historyData=[i,...this._historyData];this._hasData=!0,this.notifyDataChanged()}async loadClientSeed(){if(!this.host.gameData?.baseUrl||!this.host.gameData?.authToken||this._hasLoadedClientSeed)return;try{let a=await fetch(`${this.host.gameData.baseUrl}/provably-fair/my-info`,{method:"GET",headers:{"Content-Type":"application/json",Authorization:`Bearer ${this.host.gameData.authToken}`}});if(!a.ok)throw new Error(`HTTP error! status: ${a.status}`);let i=await a.json();this._clientSeed=i.clientSeed,this._hasLoadedClientSeed=!0,this.notifyClientSeedChanged()}catch(a){console.error("Failed to load client seed:",a)}}updateClientSeed(a){this._clientSeed=a,this.notifyClientSeedChanged()}}class no{host;muted=!1;audioCtx;buffer;spriteMap=null;constructor(a){this.host=a,a.addController(this);let i=window.AudioContext||window.webkitAudioContext;this.audioCtx=new i,fetch("https://assets.betorigami.com/sounds/sounds.mp3").then((e)=>{return e.arrayBuffer().then((o)=>{this.audioCtx.decodeAudioData(o,(r)=>{this.buffer=r})}).catch((o)=>{})}).catch(),fetch("https://assets.betorigami.com/sounds/sounds.json").then((e)=>e.json()).catch().then((e)=>{this.spriteMap=e.spritemap}).catch(),window.onclick=()=>{this.play("bet",!0),window.onclick=null}}async play(a,i,e=1,o,r=()=>{}){if(!this.buffer||!this.spriteMap)return;let n=this.audioCtx.createBufferSource();n.buffer=this.buffer;let t=this.spriteMap[a];try{if(this.audioCtx&&n){let s=this.audioCtx.createGain(),l=o??(this.host.gameData?.volume??100)/100,u=i??this.muted;return s.gain.value=u?0:Math.min(l,1),s.connect(this.audioCtx.destination),n.connect(s),n.playbackRate.value=e,n.start(0,t.start),setTimeout(()=>{n?.stop(),r()},1000*(t.end-t.start)),n}}catch(s){}}}var Za=2;var ta="USD";class Q extends wa{static componentStyles=[];emit(a,i){let e=new CustomEvent(a,{bubbles:!0,cancelable:!1,composed:!0,detail:{},...i});return this.dispatchEvent(e),e}}var ou=oi("language"),O="en";var Vs={ar:()=>Promise.resolve().then(() => sa(to(),1)),de:()=>Promise.resolve().then(() => sa(so(),1)),en:()=>Promise.resolve().then(() => sa(lo(),1)),es:()=>Promise.resolve().then(() => sa(uo(),1)),fi:()=>Promise.resolve().then(() => sa(co(),1)),fr:()=>Promise.resolve().then(() => sa(ho(),1)),hi:()=>Promise.resolve().then(() => sa(po(),1)),id:()=>Promise.resolve().then(() => sa(mo(),1)),ja:()=>Promise.resolve().then(() => sa(bo(),1)),ko:()=>Promise.resolve().then(() => sa(go(),1)),pl:()=>Promise.resolve().then(() => sa(vo(),1)),pt:()=>Promise.resolve().then(() => sa(ko(),1)),ru:()=>Promise.resolve().then(() => sa(fo(),1)),tr:()=>Promise.resolve().then(() => sa(wo(),1)),vi:()=>Promise.resolve().then(() => sa(yo(),1)),zh:()=>Promise.resolve().then(() => sa(zo(),1))};class on{loadedLanguages=new Set;loadingPromises=new Map;loadedTranslations=new Map;async loadLanguage(a){if(this.loadedLanguages.has(a))return;if(this.loadingPromises.has(a))return this.loadingPromises.get(a);let i=this.loadLanguageModule(a);this.loadingPromises.set(a,i);try{await i,this.loadedLanguages.add(a)}finally{this.loadingPromises.delete(a)}}getTranslationData(a){return this.loadedTranslations.get(a)||null}isLanguageLoaded(a){return this.loadedLanguages.has(a)}getLoadedLanguages(){return Array.from(this.loadedLanguages)}async preloadLanguages(a){let i=a.map((e)=>this.loadLanguage(e).catch(()=>{}));await Promise.all(i)}clearAll(){this.loadedLanguages.clear(),this.loadingPromises.clear(),this.loadedTranslations.clear(),xo()}async loadLanguageModule(a){try{let i=await Vs[a]();this.loadedTranslations.set(a,i.default),xo()}catch(i){throw i}}}var Ui=new on;Ui.loadLanguage(O).catch(()=>{});var nn=sa(to(),1),tn=sa(so(),1),sn=sa(lo(),1),ln=sa(uo(),1),dn=sa(co(),1),un=sa(ho(),1),cn=sa(po(),1),hn=sa(mo(),1),pn=sa(bo(),1),mn=sa(go(),1),bn=sa(vo(),1),gn=sa(ko(),1),vn=sa(fo(),1),kn=sa(wo(),1),fn=sa(yo(),1),wn=sa(zo(),1);var So={ar:nn.default,de:tn.default,en:sn.default,es:ln.default,fi:dn.default,fr:un.default,hi:cn.default,id:hn.default,ja:pn.default,ko:mn.default,pl:bn.default,pt:gn.default,ru:vn.default,tr:kn.default,vi:fn.default,zh:wn.default};function Cs(a){let i=Ui.getTranslationData(a);if(i)return i;return So[a]||So[O]}var Fu=oi(Symbol("translation"));class yn{cache=new Map;maxSize=1000;get(a){return this.cache.get(a)}set(a,i){if(this.cache.size>=this.maxSize)this.cache.clear();this.cache.set(a,i)}clear(){this.cache.clear()}size(){return this.cache.size}}var Io=new yn,rn=new Map;function Bs(a){let i=rn.get(a);if(!i)i=a.split("."),rn.set(a,i);return i}function zn(a,i,e){let o=Cs(i);try{let r=Bs(a),n=o;for(let t of r)if(n=n?.[t],n===void 0)break;if(typeof n==="string")return n;if(i!==O)return zn(a,O,e);return e||a}catch{return e||a}}function F(a,i=O,e){let o=e?`${a}:${i}:${e}`:`${a}:${i}`,r=Io.get(o);if(r!==void 0)return r;let n=zn(a,i,e);return Io.set(o,n),n}function xo(){Io.clear()}var fa={betAmount:"0.00",updateBetAmount:()=>{},updateBalance:()=>{},currency:ta,currencyDecimals:2,showCurrencyAsText:!1,balance:0,baseUrl:"",authToken:"",publicKey:"",hotkeysOpenEnabled:!1,showMaxBetButton:!1,volume:100,instantBetEnabled:!1,mainWidth:0,updateMainWidth:()=>{},updateHotkeysOpenEnabled:()=>{},updateShowMaxBetButton:()=>{},updateVolume:()=>{},updateInstantBetEnabled:()=>{},language:O,autobetNumberOfBets:0,updateAutobetNumberOfBets:()=>{},soundController:void 0,historyController:void 0,hapticController:void 0,lobbyUrl:"https://betorigami.com",depositUrl:void 0,hasLoadedBalance:!1,maxPayout:null,minBet:null,maxBet:null,edge:2,footerPosition:"BELOW",logoUrl:null},X=oi(Symbol("game"));var Ls=20,Ts=1,Hi=1e6,xn=1e6,Os=-7,Js=21,_s=!1,Ai="[big.js] ",qi=Ai+"Invalid ",ve=qi+"decimal places",$s=qi+"rounding mode",Sn=Ai+"Division by zero",ha={},Ga=void 0,Qs=/^-?(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i;function In(){function a(i){var e=this;if(!(e instanceof a))return i===Ga&&arguments.length===0?In():new a(i);if(i instanceof a)e.s=i.s,e.e=i.e,e.c=i.c.slice();else{if(typeof i!=="string"){if(a.strict===!0&&typeof i!=="bigint")throw TypeError(qi+"value");i=i===0&&1/i<0?"-0":String(i)}Ys(e,i)}e.constructor=a}return a.prototype=ha,a.DP=Ls,a.RM=Ts,a.NE=Os,a.PE=Js,a.strict=_s,a.roundDown=0,a.roundHalfUp=1,a.roundHalfEven=2,a.roundUp=3,a}function Ys(a,i){var e,o,r;if(!Qs.test(i))throw Error(qi+"number");if(a.s=i.charAt(0)=="-"?(i=i.slice(1),-1):1,(e=i.indexOf("."))>-1)i=i.replace(".","");if((o=i.search(/e/i))>0){if(e<0)e=o;e+=+i.slice(o+1),i=i.substring(0,o)}else if(e<0)e=i.length;r=i.length;for(o=0;o<r&&i.charAt(o)=="0";)++o;if(o==r)a.c=[a.e=0];else{for(;r>0&&i.charAt(--r)=="0";);a.e=e-o-1,a.c=[];for(e=0;o<=r;)a.c[e++]=+i.charAt(o++)}return a}function Fi(a,i,e,o){var r=a.c;if(e===Ga)e=a.constructor.RM;if(e!==0&&e!==1&&e!==2&&e!==3)throw Error($s);if(i<1)if(o=e===3&&(o||!!r[0])||i===0&&(e===1&&r[0]>=5||e===2&&(r[0]>5||r[0]===5&&(o||r[1]!==Ga))),r.length=1,o)a.e=a.e-i+1,r[0]=1;else r[0]=a.e=0;else if(i<r.length){if(o=e===1&&r[i]>=5||e===2&&(r[i]>5||r[i]===5&&(o||r[i+1]!==Ga||r[i-1]&1))||e===3&&(o||!!r[0]),r.length=i,o){for(;++r[--i]>9;)if(r[i]=0,i===0){++a.e,r.unshift(1);break}}for(i=r.length;!r[--i];)r.pop()}return a}function Ri(a,i,e){var o=a.e,r=a.c.join(""),n=r.length;if(i)r=r.charAt(0)+(n>1?"."+r.slice(1):"")+(o<0?"e":"e+")+o;else if(o<0){for(;++o;)r="0"+r;r="0."+r}else if(o>0){if(++o>n)for(o-=n;o--;)r+="0";else if(o<n)r=r.slice(0,o)+"."+r.slice(o)}else if(n>1)r=r.charAt(0)+"."+r.slice(1);return a.s<0&&e?"-"+r:r}ha.abs=function(){var a=new this.constructor(this);return a.s=1,a};ha.cmp=function(a){var i,e=this,o=e.c,r=(a=new e.constructor(a)).c,n=e.s,t=a.s,s=e.e,l=a.e;if(!o[0]||!r[0])return!o[0]?!r[0]?0:-t:n;if(n!=t)return n;if(i=n<0,s!=l)return s>l^i?1:-1;t=(s=o.length)<(l=r.length)?s:l;for(n=-1;++n<t;)if(o[n]!=r[n])return o[n]>r[n]^i?1:-1;return s==l?0:s>l^i?1:-1};ha.div=function(a){var i=this,e=i.constructor,o=i.c,r=(a=new e(a)).c,n=i.s==a.s?1:-1,t=e.DP;if(t!==~~t||t<0||t>Hi)throw Error(ve);if(!r[0])throw Error(Sn);if(!o[0])return a.s=n,a.c=[a.e=0],a;var s,l,u,h,f,c=r.slice(),y=s=r.length,k=o.length,b=o.slice(0,s),I=b.length,m=a,g=m.c=[],p=0,v=t+(m.e=i.e-a.e)+1;m.s=n,n=v<0?0:v,c.unshift(0);for(;I++<s;)b.push(0);do{for(u=0;u<10;u++){if(s!=(I=b.length))h=s>I?1:-1;else for(f=-1,h=0;++f<s;)if(r[f]!=b[f]){h=r[f]>b[f]?1:-1;break}if(h<0){for(l=I==s?r:c;I;){if(b[--I]<l[I]){f=I;for(;f&&!b[--f];)b[f]=9;--b[f],b[I]+=10}b[I]-=l[I]}for(;!b[0];)b.shift()}else break}if(g[p++]=h?u:++u,b[0]&&h)b[I]=o[y]||0;else b=[o[y]]}while((y++<k||b[0]!==Ga)&&n--);if(!g[0]&&p!=1)g.shift(),m.e--,v--;if(p>v)Fi(m,v,e.RM,b[0]!==Ga);return m};ha.eq=function(a){return this.cmp(a)===0};ha.gt=function(a){return this.cmp(a)>0};ha.gte=function(a){return this.cmp(a)>-1};ha.lt=function(a){return this.cmp(a)<0};ha.lte=function(a){return this.cmp(a)<1};ha.minus=ha.sub=function(a){var i,e,o,r,n=this,t=n.constructor,s=n.s,l=(a=new t(a)).s;if(s!=l)return a.s=-l,n.plus(a);var u=n.c.slice(),h=n.e,f=a.c,c=a.e;if(!u[0]||!f[0]){if(f[0])a.s=-l;else if(u[0])a=new t(n);else a.s=1;return a}if(s=h-c){if(r=s<0)s=-s,o=u;else c=h,o=f;o.reverse();for(l=s;l--;)o.push(0);o.reverse()}else{e=((r=u.length<f.length)?u:f).length;for(s=l=0;l<e;l++)if(u[l]!=f[l]){r=u[l]<f[l];break}}if(r)o=u,u=f,f=o,a.s=-a.s;if((l=(e=f.length)-(i=u.length))>0)for(;l--;)u[i++]=0;for(l=i;e>s;){if(u[--e]<f[e]){for(i=e;i&&!u[--i];)u[i]=9;--u[i],u[e]+=10}u[e]-=f[e]}for(;u[--l]===0;)u.pop();for(;u[0]===0;)u.shift(),--c;if(!u[0])a.s=1,u=[c=0];return a.c=u,a.e=c,a};ha.mod=function(a){var i,e=this,o=e.constructor,r=e.s,n=(a=new o(a)).s;if(!a.c[0])throw Error(Sn);if(e.s=a.s=1,i=a.cmp(e)==1,e.s=r,a.s=n,i)return new o(e);return r=o.DP,n=o.RM,o.DP=o.RM=0,e=e.div(a),o.DP=r,o.RM=n,this.minus(e.times(a))};ha.neg=function(){var a=new this.constructor(this);return a.s=-a.s,a};ha.plus=ha.add=function(a){var i,e,o,r=this,n=r.constructor;if(a=new n(a),r.s!=a.s)return a.s=-a.s,r.minus(a);var{e:t,c:s}=r,l=a.e,u=a.c;if(!s[0]||!u[0]){if(!u[0])if(s[0])a=new n(r);else a.s=r.s;return a}if(s=s.slice(),i=t-l){if(i>0)l=t,o=u;else i=-i,o=s;o.reverse();for(;i--;)o.push(0);o.reverse()}if(s.length-u.length<0)o=u,u=s,s=o;i=u.length;for(e=0;i;s[i]%=10)e=(s[--i]=s[i]+u[i]+e)/10|0;if(e)s.unshift(e),++l;for(i=s.length;s[--i]===0;)s.pop();return a.c=s,a.e=l,a};ha.pow=function(a){var i=this,e=new i.constructor("1"),o=e,r=a<0;if(a!==~~a||a<-xn||a>xn)throw Error(qi+"exponent");if(r)a=-a;for(;;){if(a&1)o=o.times(i);if(a>>=1,!a)break;i=i.times(i)}return r?e.div(o):o};ha.prec=function(a,i){if(a!==~~a||a<1||a>Hi)throw Error(qi+"precision");return Fi(new this.constructor(this),a,i)};ha.round=function(a,i){if(a===Ga)a=0;else if(a!==~~a||a<-Hi||a>Hi)throw Error(ve);return Fi(new this.constructor(this),a+this.e+1,i)};ha.sqrt=function(){var a,i,e,o=this,r=o.constructor,n=o.s,t=o.e,s=new r("0.5");if(!o.c[0])return new r(o);if(n<0)throw Error(Ai+"No square root");if(n=Math.sqrt(+Ri(o,!0,!0)),n===0||n===1/0){if(i=o.c.join(""),!(i.length+t&1))i+="0";n=Math.sqrt(i),t=((t+1)/2|0)-(t<0||t&1),a=new r((n==1/0?"5e":(n=n.toExponential()).slice(0,n.indexOf("e")+1))+t)}else a=new r(n+"");t=a.e+(r.DP+=4);do e=a,a=s.times(e.plus(o.div(e)));while(e.c.slice(0,t).join("")!==a.c.slice(0,t).join(""));return Fi(a,(r.DP-=4)+a.e+1,r.RM)};ha.times=ha.mul=function(a){var i,e=this,o=e.constructor,r=e.c,n=(a=new o(a)).c,t=r.length,s=n.length,l=e.e,u=a.e;if(a.s=e.s==a.s?1:-1,!r[0]||!n[0])return a.c=[a.e=0],a;if(a.e=l+u,t<s)i=r,r=n,n=i,u=t,t=s,s=u;for(i=new Array(u=t+s);u--;)i[u]=0;for(l=s;l--;){s=0;for(u=t+l;u>l;)s=i[u]+n[l]*r[u-l-1]+s,i[u--]=s%10,s=s/10|0;i[u]=s}if(s)++a.e;else i.shift();for(l=i.length;!i[--l];)i.pop();return a.c=i,a};ha.toExponential=function(a,i){var e=this,o=e.c[0];if(a!==Ga){if(a!==~~a||a<0||a>Hi)throw Error(ve);e=Fi(new e.constructor(e),++a,i);for(;e.c.length<a;)e.c.push(0)}return Ri(e,!0,!!o)};ha.toFixed=function(a,i){var e=this,o=e.c[0];if(a!==Ga){if(a!==~~a||a<0||a>Hi)throw Error(ve);e=Fi(new e.constructor(e),a+e.e+1,i);for(a=a+e.e+1;e.c.length<a;)e.c.push(0)}return Ri(e,!1,!!o)};ha.toJSON=ha.toString=function(){var a=this,i=a.constructor;return Ri(a,a.e<=i.NE||a.e>=i.PE,!!a.c[0])};if(typeof Symbol!=="undefined")ha[Symbol.for("nodejs.util.inspect.custom")]=ha.toJSON;ha.toNumber=function(){var a=+Ri(this,!0,!0);if(this.constructor.strict===!0&&!this.eq(a.toString()))throw Error(Ai+"Imprecise conversion");return a};ha.toPrecision=function(a,i){var e=this,o=e.constructor,r=e.c[0];if(a!==Ga){if(a!==~~a||a<1||a>Hi)throw Error(qi+"precision");e=Fi(new o(e),a,i);for(;e.c.length<a;)e.c.push(0)}return Ri(e,a<=e.e||e.e<=o.NE||e.e>=o.PE,!!r)};ha.valueOf=function(){var a=this,i=a.constructor;if(i.strict===!0)throw Error(Ai+"valueOf disallowed");return Ri(a,a.e<=i.NE||a.e>=i.PE,!0)};var Ns=In(),P=Ns;class ke extends Q{constructor(){super(...arguments);this.currency=ta;this.showCurrencyAsText=!1;this.balance=fa.balance;this.currencyDecimals=fa.currencyDecimals;this.baseUrl=fa.baseUrl;this.authToken=fa.authToken;this.origamiGame="DICE";this.lobbyUrl=fa.lobbyUrl;this.depositUrl=fa.depositUrl;this.maxPayout=fa.maxPayout;this.minBet=fa.minBet;this.maxBet=fa.maxBet;this.edge=fa.edge;this.requiresFullScreen=!1;this.footerPosition=fa.footerPosition;this.logoUrl=null;this.betAmount=fa.betAmount;this.autobetNumberOfBets=fa.autobetNumberOfBets;this.hotkeysOpenEnabled=!1;this.showMaxBetButton=fa.showMaxBetButton;this.volume=fa.volume;this.instantBetEnabled=fa.instantBetEnabled;this.mainWidth=fa.mainWidth;this.publicKey=fa.publicKey;this.scale=1;this.language=fa.language}_soundController=new no(this);_historyController=new ro(this);_hapticController=new oo(this);_resizeObserver=null;hasLoadedBalance=!1;_gameProvider=new yi(this,{context:X,initialValue:this.createGameContextValue()});connectedCallback(){super.connectedCallback(),this.updateProviderValue(),this.fetchBalance(),this.fetchPublicKey(),this.setupResizeObserver(),this.calculateScale()}async firstUpdated(a){super.firstUpdated(a),await this.updateComplete,this.updateBetAmount(P(this.minBet??0))}disconnectedCallback(){super.disconnectedCallback(),this.cleanupResizeObserver()}updated(a){if(super.updated(a),a.has("currency")||a.has("balance")||a.has("baseUrl")||a.has("showCurrencyAsText")||a.has("authToken")||a.has("hotkeysOpenEnabled")||a.has("volume")||a.has("instantBetEnabled")||a.has("showMaxBetButton")||a.has("mainWidth"))this.updateProviderValue()}get gameData(){return this._gameProvider.value}createGameContextValue(){return{betAmount:this.betAmount,updateBetAmount:this.updateBetAmount.bind(this),updateBalance:this.updateBalance.bind(this),currency:this.currency,showCurrencyAsText:this.showCurrencyAsText,currencyDecimals:this.currencyDecimals,lobbyUrl:this.lobbyUrl,depositUrl:this.depositUrl,maxPayout:this.maxPayout,minBet:this.minBet,maxBet:this.maxBet,edge:this.edge,balance:this.balance,hasLoadedBalance:this.hasLoadedBalance,baseUrl:this.baseUrl,authToken:this.authToken,publicKey:this.publicKey,autobetNumberOfBets:this.autobetNumberOfBets,hotkeysOpenEnabled:this.hotkeysOpenEnabled,showMaxBetButton:this.showMaxBetButton,volume:this.volume,instantBetEnabled:this.instantBetEnabled,soundController:this._soundController,historyController:this._historyController,hapticController:this._hapticController,updateHotkeysOpenEnabled:this.updateHotkeysOpenEnabled.bind(this),updateShowMaxBetButton:this.updateShowMaxBetButton.bind(this),updateVolume:this.updateVolume.bind(this),updateInstantBetEnabled:this.updateInstantBetEnabled.bind(this),updateAutobetNumberOfBets:this.updateAutobetNumberOfBets.bind(this),mainWidth:this.mainWidth,updateMainWidth:this.updateMainWidth.bind(this),language:this.language,footerPosition:this.footerPosition,logoUrl:this.logoUrl}}updateProviderValue(){this._gameProvider.setValue(this.createGameContextValue())}fetchBalance=async()=>{if(!this.authToken||!this.baseUrl){this.balance=1000,this.hasLoadedBalance=!0,this.updateProviderValue();return}try{let a=await fetch(`${this.baseUrl}/users/balance?currency=${this.currency}&origamiGame=${this.origamiGame}`,{headers:{Authorization:`Bearer ${this.authToken}`,"Content-Type":"application/json"}});if(!a.ok){console.error("Failed to fetch balance:",a.statusText);return}let i=await a.json();this.balance=P(i.balance).toNumber(),this.hasLoadedBalance=!0,this.updateProviderValue()}catch(a){console.error("Error fetching balance:",a)}};fetchPublicKey=async()=>{if(!this.authToken||!this.baseUrl)return;let a=await fetch(`${this.baseUrl}/provably-fair/public-key`);if(!a.ok){console.error("Failed to fetch public key:",a.statusText);return}let i=await a.json();this.publicKey=i.publicKey};updateHotkeysOpenEnabled(a){this.hotkeysOpenEnabled=a,this.updateProviderValue()}updateShowMaxBetButton(a){this.showMaxBetButton=a,this.updateProviderValue()}updateVolume(a){this.volume=a,this.updateProviderValue()}updateInstantBetEnabled(a){this.instantBetEnabled=a,this.updateProviderValue()}updateAutobetNumberOfBets(a){this.autobetNumberOfBets=a,this.updateProviderValue()}updateMainWidth(a){this.mainWidth=a,this.updateProviderValue()}updateBetAmount(a){if(a.lt(0)){this.betAmount="0";return}let i=a.toFixed(this.currencyDecimals);this.betAmount=i,this.updateProviderValue()}updateBalance(a){if(a.lt(0)){this.balance=0;return}this.balance=a.toNumber(),this.updateProviderValue()}_boundCalculateScale=this.calculateScale.bind(this);setupResizeObserver(){if(typeof ResizeObserver!=="undefined")this._resizeObserver=new ResizeObserver(()=>{this.calculateScale(),this.gameData.updateMainWidth(document.documentElement.clientWidth)}),this._resizeObserver.observe(document.body);else window.addEventListener("resize",this._boundCalculateScale)}cleanupResizeObserver(){if(this._resizeObserver)this._resizeObserver.disconnect(),this._resizeObserver=null;else window.removeEventListener("resize",this._boundCalculateScale)}calculateScale(){let a=document.documentElement.clientWidth,i=1200,e=a/1200;this.scale=e,this.requestUpdate()}render(){let a=(()=>{switch(this.origamiGame){case"DICE":return H`<origami-dice-game></origami-dice-game>`;case"KENO":return H`<origami-keno-game></origami-keno-game>`;case"MINES":return H`<origami-mines-game></origami-mines-game>`;case"LIMBO":return H`<origami-limbo-game></origami-limbo-game>`;default:this.origamiGame}})(),i=this.requiresFullScreen?"width: 100vw; height:100vh":`
14
14
  position: absolute;
15
15
  top: 0;
16
16
  left: 0;
@@ -20,7 +20,7 @@ var es=Object.create;var{getPrototypeOf:os,defineProperty:Vr,getOwnPropertyNames
20
20
  transform-origin: 0 0;
21
21
  `;return H`
22
22
  <div style=${this.gameData.mainWidth>=768?i:""}>${a}</div>
23
- `}}d([z({type:String})],ke.prototype,"currency",void 0),d([z({type:Boolean})],ke.prototype,"showCurrencyAsText",void 0),d([z({type:Number})],ke.prototype,"balance",void 0),d([z({type:Number})],ke.prototype,"currencyDecimals",void 0),d([z({type:String})],ke.prototype,"baseUrl",void 0),d([z({type:String})],ke.prototype,"authToken",void 0),d([z({type:String})],ke.prototype,"origamiGame",void 0),d([z({type:String})],ke.prototype,"lobbyUrl",void 0),d([z({type:String})],ke.prototype,"depositUrl",void 0),d([z({type:Number})],ke.prototype,"maxPayout",void 0),d([z({type:Number})],ke.prototype,"minBet",void 0),d([z({type:Number})],ke.prototype,"maxBet",void 0),d([z({type:Number})],ke.prototype,"edge",void 0),d([z({type:String})],ke.prototype,"footerPosition",void 0),d([z({type:String})],ke.prototype,"logoUrl",void 0),d([C()],ke.prototype,"betAmount",void 0),d([C()],ke.prototype,"autobetNumberOfBets",void 0),d([C()],ke.prototype,"hotkeysOpenEnabled",void 0),d([C()],ke.prototype,"showMaxBetButton",void 0),d([C()],ke.prototype,"volume",void 0),d([C()],ke.prototype,"instantBetEnabled",void 0),d([C()],ke.prototype,"mainWidth",void 0),d([C()],ke.prototype,"publicKey",void 0),d([C()],ke.prototype,"scale",void 0),d([z()],ke.prototype,"language",void 0),ke=d([T("origami-game-provider-wrapper")],ke);var jn=$`
23
+ `}}d([z({type:String})],ke.prototype,"currency",void 0),d([z({type:Boolean})],ke.prototype,"showCurrencyAsText",void 0),d([z({type:Number})],ke.prototype,"balance",void 0),d([z({type:Number})],ke.prototype,"currencyDecimals",void 0),d([z({type:String})],ke.prototype,"baseUrl",void 0),d([z({type:String})],ke.prototype,"authToken",void 0),d([z({type:String})],ke.prototype,"origamiGame",void 0),d([z({type:String})],ke.prototype,"lobbyUrl",void 0),d([z({type:String})],ke.prototype,"depositUrl",void 0),d([z({type:Number})],ke.prototype,"maxPayout",void 0),d([z({type:Number})],ke.prototype,"minBet",void 0),d([z({type:Number})],ke.prototype,"maxBet",void 0),d([z({type:Number})],ke.prototype,"edge",void 0),d([z({type:Boolean})],ke.prototype,"requiresFullScreen",void 0),d([z({type:String})],ke.prototype,"footerPosition",void 0),d([z({type:String})],ke.prototype,"logoUrl",void 0),d([C()],ke.prototype,"betAmount",void 0),d([C()],ke.prototype,"autobetNumberOfBets",void 0),d([C()],ke.prototype,"hotkeysOpenEnabled",void 0),d([C()],ke.prototype,"showMaxBetButton",void 0),d([C()],ke.prototype,"volume",void 0),d([C()],ke.prototype,"instantBetEnabled",void 0),d([C()],ke.prototype,"mainWidth",void 0),d([C()],ke.prototype,"publicKey",void 0),d([C()],ke.prototype,"scale",void 0),d([z()],ke.prototype,"language",void 0),ke=d([T("origami-game-provider-wrapper")],ke);var jn=$`
24
24
  :host {
25
25
  display: flex;
26
26
  flex-direction: column;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@betorigami/games",
3
- "version": "1.4.9",
3
+ "version": "1.4.10",
4
4
  "author": "",
5
5
  "license": "UNLICENSED",
6
6
  "description": "",