var YaGames;(()=>{"use strict";var e={491:(e,t,n)=>{n.d(t,{i:()=>a});var r=n(335);const a={I18n:()=>({type:r.tT,action:r.X2.i18n})}},514:(e,t,n)=>{n.d(t,{T:()=>a});var r=n(335);const a={Commit:e=>({action:"commit",type:r.vA,data:e}),Finish:e=>({action:"finish",type:r.vA,data:e}),Init:e=>({action:"init",type:r.vA,data:e}),Push:e=>({action:"push",type:r.vA,data:e}),Transaction:e=>({action:"transaction",type:r.vA,data:e})}},992:(e,t,n)=>{n.d(t,{C:()=>a});var r=n(335);const a={Keydown:e=>({action:"keydown",type:r.cV,data:e}),Start:()=>({action:"start",type:r.cV}),Stop:()=>({action:"stop",type:r.cV})}},656:(e,t,n)=>{n.d(t,{jG:()=>a,X$:()=>i,qs:()=>U,uQ:()=>l,sC:()=>o,Aw:()=>u,TT:()=>N,u8:()=>p,N3:()=>y,VT:()=>D,_X:()=>$,E0:()=>x,qf:()=>j,X0:()=>V,Bz:()=>T,OI:()=>A,Xk:()=>F,cp:()=>K,$J:()=>O,Rh:()=>v,S:()=>b,Qq:()=>E,jt:()=>B,sF:()=>k,Al:()=>L,Gd:()=>C,yH:()=>X,HT:()=>_,Uh:()=>z,Vo:()=>Z,ce:()=>G,$4:()=>M,TI:()=>W,Sd:()=>H,_W:()=>ee,Ry:()=>R,lW:()=>ne,rS:()=>ae,Iq:()=>re,Vw:()=>Y,XT:()=>oe,eU:()=>ie});var r=n(335);const a={GetList:e=>({action:"getList",type:r.y0,data:e}),GetProgress:e=>({action:"getProgress",type:r.y0,data:e}),SetProgress:e=>({action:"setProgress",type:r.y0,data:e})},o={CheckAvailability:e=>({type:"availability-methods",action:"check-availability",data:e})},s="adv-manager",i={GetDisabledState:()=>({type:s,action:"get-disabled-state"}),AdvShowFullscreen:()=>({type:s,action:"adv-show-fullscreen",timeout:1e4}),AdvShowRewardedVideo:()=>({type:s,action:"adv-show-rewarded-video",timeout:1e4}),AdvShowStickyBanner:()=>({type:s,action:"adv-show-sticky-banner",timeout:3e3}),AdvHideStickyBanner:()=>({type:s,action:"adv-hide-sticky-banner",timeout:3e3}),AdvStatusStickyBanner:()=>({type:s,action:"adv-status-sticky-banner",timeout:3e3})},c="auth",l={AuthDialogSuccess:e=>({type:c,action:"auth-dialog-success",data:e}),AuthDialogOpen:()=>({type:c,action:"auth-dialog-open",data:{initializer:"auth-manager-public"}}),HasAuth:()=>({type:c,action:"has-auth"})},d="bonuses",u={Catalog:e=>({type:d,action:"catalog",data:e}),Consume:e=>({type:d,action:"consume",data:e}),PlayerBonuses:e=>({type:d,action:"player-bonuses",data:e})},p={WriteText:e=>({type:"clipboard",action:"write-text",data:e})},h="document-events";var m,g=((m=g||{}).Click=`click${r.ej}`,m.Dblclick=`dblclick${r.ej}`,m.Mouseup=`mouseup${r.ej}`,m.Pointerup=`pointerup${r.ej}`,m.Touchend=`touchend${r.ej}`,m);const y={ClickOnBody:()=>({type:h,action:g.Click}),DblclickOnBody:()=>({type:h,action:g.Dblclick}),MouseupOnBody:()=>({type:h,action:g.Mouseup}),PointerupOnBody:()=>({type:h,action:g.Pointerup}),TouchendOnBody:()=>({type:h,action:g.Touchend})},f="get-games",v={All:()=>({type:f,action:"all"}),Game:e=>({type:f,action:"game",data:{app_id:e}})},w="leaderboard",b={Description:e=>({type:w,action:"description",data:e}),Entries:e=>({type:w,action:"entries",data:e}),PlayerEntry:e=>({type:w,action:"player-entry",data:e}),Score:e=>({type:w,action:"score",data:e}),Stat:e=>({type:w,action:"stat",data:e})},P="local-storage",E={GetAll:()=>({type:P,action:"get-all"}),Clear:()=>({type:P,action:"clear"}),Del:e=>({type:P,action:"del",data:{key:e}}),Set:(e,t)=>({type:P,action:"set",data:{key:e,value:t}}),Backup:e=>({type:P,action:"backup",data:e})},S="metrika",k={ReachGoal:e=>({type:S,action:"reachGoal",data:e}),Params:e=>({type:S,action:"params",data:e})},T=e=>({type:"game-call-alert",data:e}),A=(e,t)=>({type:"game-measuring",action:e,data:t}),O=(e,t)=>({action:e,type:r.Tn,data:t}),I="feedback",x={CanReview:()=>({type:I,action:"can-review"}),RequestReview:()=>({type:I,action:"request-review"})},C=()=>({type:"options",action:"get"}),D=()=>({type:"environment",action:"get",params:{withOptions:!0}}),_=e=>({type:"player",action:"get",data:e}),L=()=>({type:"notifications",action:"allow"}),R=e=>({type:"foolproof-sdk-init",data:e}),F=e=>({type:"game-reporter",action:"plugin_engine_data",data:e}),$=e=>({type:"error",data:e}),N=e=>({type:"csp",action:"violation",data:e}),j=()=>({type:"frame",action:r.ur.IframeLoaded}),G=()=>{var e;return{type:"sdk-bundle-start",data:{time:Date.now(),sdkVersion:"v2",sdkBundle:null==(e=window.YandexGamesSDKEnvironment)?void 0:e.APP_VERSION,isSdkLoader:Boolean(window.isSdkLoader)}}},M=e=>({type:"sdk-debug-log",data:e}),U=e=>({type:"alert",error:e}),B=()=>({type:"longtask"}),V=()=>({type:"longtask_frame_ready"}),Y=()=>({type:"user-action"}),K=e=>({type:"game-stats",data:e}),H=()=>({type:"sdk_initialization",data:{initialized:!0}}),W=(e,t)=>({type:r.Ul,action:e,data:t}),q="payments",X={GetCatalog:e=>({type:q,action:"get-catalog",data:e}),GetEnv:()=>({type:q,action:"get-env"}),GetPurchases:e=>({type:q,action:"get-purchases",data:e}),PurchaseStart:e=>({type:q,action:"purchase-start",data:e}),PurchaseConsume:e=>({type:q,action:"purchase-consume",data:e}),PurchaseDialogInit:()=>({type:q,action:"purchase-dialog-init"}),PurchaseDialogOpen:()=>({type:q,action:"purchase-dialog-open"}),PurchaseDialogShow:e=>({type:q,action:"purchase-dialog-show",data:e}),PurchaseDialogError:e=>({type:q,action:"purchase-dialog-error",data:e}),PurchaseDialogClose:()=>({type:q,action:"purchase-dialog-close"}),GetGamePurchaseEnabled:()=>({type:q,action:"get-game-purchase-enabled"})},J="player-info",z={GetData:e=>({type:J,action:"get-data",data:e}),IdsPerGame:e=>({type:J,action:"ids-per-game",data:e}),IncrementStats:e=>({type:J,action:"increment-stats",data:e}),SetData:e=>({type:J,action:"set-data",data:e}),SetStats:e=>({type:J,action:"set-stats",data:e}),Stats:e=>({type:J,action:"stats",data:e})},Q="screen-manager",Z={ExitFullscreen:()=>({type:Q,action:"exit-fullscreen"}),RequestFullscreen:()=>({type:Q,action:"request-fullscreen"}),ToggleFullscreen:()=>({type:Q,action:"toggle-fullscreen"}),GetState:()=>({type:Q,action:"get-state"})},ee={ListenersChange:e=>({type:"sdk-internal-event",action:"listeners-change",data:e})},te="shortcut-manager",ne={ShowPrompt:()=>({type:te,action:"show-prompt"}),CanShowPrompt:()=>({type:te,action:"can-show-prompt"})},re=e=>({type:"sdk-stats",data:e}),ae=e=>({type:"telegram",data:e}),oe={Fetch:e=>({type:"varioqub",action:"fetch",data:e})},se="yaMetrikaCounter",ie={ReachGoal:e=>({type:se,action:"reachGoal",data:e}),Hit:e=>({type:se,action:"hit",data:e})};n(491),n(992),n(514)},335:(e,t,n)=>{n.d(t,{y0:()=>s,tT:()=>g,ej:()=>h,X2:()=>y,VR:()=>r,BE:()=>p,ur:()=>a,q1:()=>v,Tn:()=>d,US:()=>i,vA:()=>w,cV:()=>m,Ul:()=>f,Hn:()=>o});var r=(e=>(e.AudioAPI="AudioAPI",e.GameplayAPI="GameplayAPI",e.GamesAPI="GamesAPI",e.LoadingAPI="LoadingAPI",e.PluginEngineDataReporterAPI="PluginEngineDataReporterAPI",e))(r||{}),a=(e=>(e.GameInit="loading_api_game_init",e.GameReady="loading_api_game_ready",e.GameReadyForce="loading_api_game_ready_force",e.IframeAdded="loading_api_iframe_added",e.IframeError="loading_api_iframe_resources_error",e.IframeLoaded="loading_api_iframe_resources_loaded",e.ScriptInit="loading_api_script_init",e.TTIReady="loading_api_tti_ready",e))(a||{});const o=["GameplayAPI","LoadingAPI","PluginEngineDataReporterAPI"],s="achv-manager",i="game_api";var c,l=((c=l||{}).Pause=`${i}_pause`,c.Resume=`${i}_resume`,c);const d="gameplay_api";var u,p=((u=p||{}).Start=`${d}_start`,u.Stop=`${d}_stop`,u);const h="-on-body",m="screen_recorder",g="debug-panel";var y=(e=>(e.i18n="i18n",e))(y||{});const f="sdk-event";var v=(e=>(e.BONUS_AWARDED="BONUS_AWARDED",e.EXIT="EXIT",e.HISTORY_BACK="HISTORY_BACK",e))(v||{});const w="multiplayer"},989:(e,t,n)=>{n.d(t,{T:()=>c,f:()=>i});var r=n(146),a=n(822),o=n(562);function s(e,t,n){"YaGames"in window||console.warn("Don't use logSDKError or logSDKGameError outside SDK");const r=(0,a.U)(e,t,n);r&&o.F.postToParent({data:r,type:"error"}).catch(console.warn)}function i(e,t={}){s("sdk",e,t),console.warn(e)}function c(e,t={}){s("sdk-game",e,t),"warn"===t.level?console.warn(e,r.X4):console.error(e,r.X4)}},822:(e,t,n)=>{n.d(t,{U:()=>m});var r=n(59),a=Object.defineProperty,o=Object.defineProperties,s=Object.getOwnPropertyDescriptors,i=Object.getOwnPropertySymbols,c=Object.prototype.hasOwnProperty,l=Object.prototype.propertyIsEnumerable,d=(e,t,n)=>t in e?a(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,u=(e,t)=>{for(var n in t||(t={}))c.call(t,n)&&d(e,n,t[n]);if(i)for(var n of i(t))l.call(t,n)&&d(e,n,t[n]);return e},p=(e,t)=>o(e,s(t));const h=[/Adv was delayed on/];function m(e,t,n){var a,o,s;const i=function(e,t){var n,r,a,o;const s={columnNumber:null!=(n=e.columnNumber)?n:-1,fileName:e.fileName||"",lineNumber:null!=(r=e.lineNumber)?r:-1,name:e.name||"Error",message:e.message||String(e),stack:(null==(a=e.stack)?void 0:a.slice(0,4e5))||""};return s.additional=p(u(u({},e.additional),t.additional),{version:parseInt((null==(o=window.YandexGamesSDKEnvironment)?void 0:o.APP_VERSION)||"0")}),s}(t,n);return c=i.message,h.some((e=>e.test(c)))?null:(n.message&&(i.message=n.message),n.prefix&&(i.message=`${n.prefix} ${i.message}`),{block:`ErrorCounter/common: ${e}`,error:i,level:null!=(a=n.level)?a:"error",source:e,sourceMethod:null!=(o=n.sourceMethod)?o:(0,r.Z)(i.stack),type:null!=(s=n.type)?s:"error"});var c}},179:(e,t,n)=>{n.d(t,{o:()=>a});var r=n(989);function a(){var e,t;if("undefined"==typeof window)return"";const n=(null==(t=null==(e=window.YandexGamesSDKEnvironment)?void 0:e.app)?void 0:t.id)||"";return n||(0,r.f)(new Error("Can not get appId from environment")),n}},617:(e,t,n)=>{n.d(t,{Z:()=>c});var r=n(656),a=n(989),o=n(179),s=n(562);const i=Object.create(null),c={gameSessionUID:"",init(){},sendOnceDeprecatedUsage(e){var t;e in i||(i[e]=1,this.params({borrowParams:{sdkDeprecatedUsage:{key:e,appId:(0,o.o)()}},service:"undefined"==typeof window?"unknown":(null==(t=window.YandexGamesSDKEnvironment)?void 0:t.serviceName)||"unknown"}))},params(e){s.F.hasParent()&&s.F.postToParent(r.sF.Params(e)).catch((e=>{(0,a.f)(e)}))},reachGoal(e,t,n){s.F.hasParent()&&s.F.postToParent(r.sF.ReachGoal({data:t,goal:e,params:n})).catch((e=>{(0,a.f)(e)}))}}},562:(e,t,n)=>{n.d(t,{F:()=>c});const r=e=>void 0!==e?String(e):e;class a extends Error{constructor(e,t,n){super(e),this.code=t,this.httpStatus=n}}class o{constructor(){this.promises={},this.listeners={},this.callbacks={},this.addEventListener()}onExternalMessage(e,t){this._onMessage(this.listeners,e,t)}offExternalMessage(e,t){this._offMessage(this.listeners,e,t)}addEventListener(){window.addEventListener("message",(e=>{this.checkExternalEvent(e)&&this.handleEvent(e)}))}deletePromise(e){this.clearPromiseWaitTimeout(e),delete this.promises[e]}clearPromiseWaitTimeout(e){const t=this.promises[e];(null==t?void 0:t.timeoutId)&&(window.clearTimeout(t.timeoutId),delete t.timeoutId)}getExternalCallback(e){const{type:t,action:n,messageId:r,payload:a}=e.data||{};return this.callbacks[r]||(this.callbacks[r]=(e={})=>{const o={type:e.type||t,action:e.action||n,originMessageId:r,originPayload:a,data:e.data||{}};!function(e,t){t.error&&(e.error=String(t.error.message)||null,e.errorJSON=JSON.stringify(t.error)||null)}(o,e),this.postCallback(o),this.callbacks[r]=()=>{}}),this.callbacks[r]}handleEvent(e){const{type:t,action:n,originMessageId:r,originPayload:a,data:o,error:s,errorJSON:i}=e.data||{},c=this.promises[r];c&&(this.deletePromise(r),void 0===s?c.resolve({type:t,action:n,originPayload:a,data:o}):c.reject(this.createErrorInstance(s,i)));const l=this.getExternalCallback(e),d=this.listeners[t]||[];for(const t of d)try{t(e,l)}catch(e){this.logError({prefix:"[Messaging]",sourceMethod:"_handleEvent"},e)}return e}createErrorInstance(e,t){if(t)try{const{message:e,code:n,httpStatus:o}=JSON.parse(t);if(e)return new a(e,r(n),r(o))}catch(e){}return new Error(e||"Undefined error message")}checkExternalEvent(e){var t;return"YandexGamesSDK"===(null==(t=e.data)?void 0:t.source)}_offMessage(e,t,n){if("string"==typeof t&&(t=[t]),!Array.isArray(t))throw new Error('Wrong argument "types"');for(const r of t)r in e&&(e[r]=e[r].filter((e=>e!==n)))}_onMessage(e,t,n){if("string"==typeof t&&(t=[t]),!Array.isArray(t))throw new Error('Wrong argument "types"');for(const r of t)r in e||(e[r]=[]),e[r].push(n)}_post(e,t){const n=Date.now(),r=`${n}-${Math.random()}`;t=Object.assign({},t,{source:"YandexGamesSDK",messageId:r});let a=e=>{},o=e=>{};const s=new Promise(((e,t)=>{a=e,o=t}));this.promises[r]={promise:s,resolve:a,reject:o,time:n};try{e.postMessage(function(e,t){if("function"==typeof structuredClone)try{return structuredClone(e),e}catch(n){return t({block:"Utils",message:"Error structuredClone operation",additional:{error:n}},n),e}return e}(t,this.logError.bind(this)),"*")}catch(e){return this.deletePromise(r),Promise.reject(e)}if("timeout"in t){const{timeout:e}=t;"number"==typeof e&&e>0?this.promises[r].timeoutId=window.setTimeout((()=>{this.deletePromise(r);const e=new Error("Message rejected by timeout");e.additional={type:t.type,action:t.action},o(e)}),e):this.logError({prefix:"[Messaging]",sourceMethod:"_post",additional:{type:t.type,action:t.action}},new Error("Wrong timeout value"))}return s}}var s=n(822);class i extends o{constructor(){if(i.instance)return i.instance;super(),i.instance=this}get _parentTarget(){return window.parent!==window?window.parent:void 0}hasParent(){return Boolean(this._parentTarget)}postToParent(e){const t=this._parentTarget;return t?this._post(t,e):Promise.reject(new Error("No parent to post message"))}postCallback(e){const t=this._parentTarget;return t?this._post(t,e):Promise.reject(new Error(`No child to post message: type = ${e.type}, action = ${e.action}`))}logError(e,t){const n=(0,s.U)("sdk",t,e);n&&this.postToParent({data:n,type:"error"}).catch(console.warn)}}const c=new i},146:(e,t,n)=>{n.d(t,{NA:()=>a,Uo:()=>r,X4:()=>i,_h:()=>s,f9:()=>o});const r=1e4;var a=(e=>(e.CON="CON",e.HOP="HOP",e.RUB="РУБ",e.TST="TST",e.YAN="YAN",e))(a||{}),o=(e=>(e.BIG="big",e.ISLANDS_75="islands-75",e.ISLANDS_200="islands-200",e.ISLANDS_MIDDLE="islands-middle",e.ISLANDS_RETINA_MEDIUM="islands-retina-medium",e.ISLANDS_RETINA_SMALL="islands-retina-small",e.NORMAL="normal",e))(o||{});const s="0/0-0",i="YandexSDKLogError"},59:(e,t,n)=>{n.d(t,{Z:()=>o});const r=/(\w+)@|at (.+) \(/g;function a(e,t=0){var n;const a=Array.from(e.matchAll(r))||[];if(!a.length)return"unknown";if(0===t)return a[0][2];for(let e=Math.min(a.length-1,t);e>=0;e--){const t=null==(n=a[e])?void 0:n[2];if(t)return t}return"unknown"}function o(e){if(e)return a(e,0);try{throw new Error}catch(e){return a(e instanceof Error&&e.stack||"",2)}}}},t={};function n(r){var a=t[r];if(void 0!==a)return a.exports;var o=t[r]={exports:{}};return e[r](o,o.exports,n),o.exports}n.d=(e,t)=>{for(var r in t)n.o(t,r)&&!n.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),(()=>{if(void 0!==n){var e=n.u,t=n.e,r={},a={};n.u=function(t){return e(t)+(r.hasOwnProperty(t)?"?"+r[t]:"")},n.e=function(r){return t(r).catch((function(t){var o=a.hasOwnProperty(r)?a[r]:3;if(o<1){var s=e(r);throw t.message="Loading chunk "+r+" failed after 3 retries.\n("+s+")",t.request=s,t}return new Promise((function(e){setTimeout((function(){a[r]=o-1,e(n.e(r))}),0)}))}))}}})();var r={};(()=>{n.d(r,{default:()=>ur});var e=(e=>(e.ABORT_CONTROLLER="abort-controller",e.GLOBAL_THIS="global-this",e.INTERSECTION_OBSERVER="intersection-observer",e.LEGACY="legacy",e.SMOOTH_SCROLL="smooth-scroll",e))(e||{});const t=e=>{const{async:t,content:n,crossOrigin:r,id:a,nonce:o,onErrCb:s,onLoadCb:i,src:c}=e,l=document.createElement("script");if(i&&(l.onload=i),s&&(l.onerror=s),l.type="text/javascript",t&&(l.async=t),c&&(l.src=c),o&&l.setAttribute("nonce",o),r&&l.setAttribute("crossOrigin",r),a&&(l.setAttribute("id",`${a}-script`),l.dataset.rcid=`load-script-${a}`),n){const e=document.createTextNode(n);l.appendChild(e)}return l};function a(e,t){return e.endsWith("/")||(e=`${e}/`),`${e}polyfill/${t}`}function o(e,t){return a(e,function(e){var t,n;return(null==(n=null==(t=window.loadPolyfillHash)?void 0:t[e])?void 0:n.contenthash)?`${e}.${window.loadPolyfillHash[e].contenthash}.js`:`${e}.js`}(t))}function s(e,t){let n,r;return function(...a){const o=a;return n||(n=!0,setTimeout((()=>n=!1),t),r=e.apply(this,o)),r}}var i=n(656),c=n(335),l=n(562);const d={background:"#4e3534",text:"#f9dedc"},u=["Log error: data is not suitable for logging"];function p(e,t="Dev",n){if(!new URLSearchParams(location.search).get("debug-mode"))return()=>{};const r=new Set("string"==typeof t?[t]:t);r.add("Sdk");const a=Array.from(r);function o(t,n){return l.F.postToParent((0,i.$4)({prefix:e,tag:a,color:n,data:t}))}return function(...e){o(e,n).catch((()=>o(u,d)))}}const h=class{constructor(){this.resolve=()=>{},this.reject=()=>{},this.promiseState=0,this.promise=new Promise(((e,t)=>{this.resolve=t=>{this.promiseState=1,e(t)},this.reject=e=>{this.promiseState=2,t(e)}}))}get state(){return this.promiseState}};var m=n(989);const g=p("sdkTimeout");function y(e,t=function(){var e;switch(null==(e=navigator.connection)?void 0:e.effectiveType){case"slow-2g":return 4e4;case"2g":return 2e4;case"3g":return 1e4;default:return 5e3}}()){const n=new h;g("init",e),n.promise.catch((()=>{var n;const r=new Error(`[SDK] too long resolve for method '${e}'`);r.additional={speed:(null==(n=navigator.connection)?void 0:n.effectiveType)||"unknown",timeout:t},g("timeout",e),(0,m.f)(r)}));const r=setTimeout((()=>{n.reject()}),t);return()=>{g("resolve",e),n.resolve(),clearTimeout(r)}}class f{constructor(e){this.log=e,this.observers={},this.subscribe=(e,t)=>{var n,r;return(null!=(r=(n=this.observers)[e])?r:n[e]=[]).push(t),this.unsubscribe.bind(this,e,t)},this.unsubscribe=(e,t)=>{var n;if(!t)return void delete this.observers[e];const r=this.observers[e];if(!r)return void(null==(n=this.log)||n.call(this,`Observable: eventId {${e}} does not exist`));const a=r.indexOf(t);-1!==a&&r.splice(a,1)},this.notifyObservers=(e,t)=>e.forEach((e=>{const n=this.observers[e];n&&n.forEach((n=>{var r;try{n(t)}catch(t){null==(r=this.log)||r.call(this,`Observable: {${e}} event observer error`,t)}}))})),this.getObserversNumber=e=>{var t,n;return null!=(n=null==(t=this.observers[e])?void 0:t.length)?n:0}}}var v=(e,t,n)=>new Promise(((r,a)=>{var o=e=>{try{i(n.next(e))}catch(e){a(e)}},s=e=>{try{i(n.throw(e))}catch(e){a(e)}},i=e=>e.done?r(e.value):Promise.resolve(e.value).then(o,s);i((n=n.apply(e,t)).next())}));const w={background:"#6c5b7b",text:"#ffffff"},b=class{constructor(){this.log=p("Achievements | Child frame","Dev",w),this.observable=new f(this.log),this.setProgress=(e,t)=>v(this,null,(function*(){return this.post(i.jG.SetProgress({id:e,progress:t}))})),this.getProgress=e=>v(this,null,(function*(){return this.post(i.jG.GetProgress({id:e}))})),this.getList=(...e)=>v(this,[...e],(function*(e=["allLocal"]){return this.post(i.jG.GetList({status:e}))})),this.on=({action:e,id:t=""},n)=>this.observable.subscribe(this.buildId(e,t),n),this.off=({action:e,id:t},n)=>this.observable.unsubscribe(this.buildId(e,t),n),this.post=e=>v(this,null,(function*(){this.log("post to parent",e.action,e.data);const t=y(`AchvManager.${e.action}`);return l.F.postToParent(e).then((t=>{var n;this.log("receive from parent",e,t);const{result:r,success:a,error:o}=t.data;return a&&r?(this.notify(e.action,null!=(n=e.data)?n:{},r),r):(this.log("reject",e,"due to error"),Promise.reject(o))})).finally((()=>{t()}))})),this.notify=(e,t,n)=>{const r=[this.buildId(e)];t.id&&r.push(this.buildId(e,t.id)),this.observable.notifyObservers(r,{data:n,payload:t})},this.buildId=(e,t="")=>`${e}${t}`}};b.init=()=>{const{getList:e,getProgress:t,off:n,on:r,setProgress:a}=new b;return{getList:e,getProgress:t,off:n,on:r,setProgress:a}};let P=b;var E=(e=>(e.ADV_IS_NOT_CONNECTED="ADV_IS_NOT_CONNECTED",e.UNKNOWN="UNKNOWN",e))(E||{});const S=p("NoAds","Adv"),k="yandex-games-no-ads-style";function T(){Array.isArray(window.yaContextCb)&&0!==window.yaContextCb.length&&(window.yaContextCb=[]),Array.isArray(window.yandexContextAsyncCallbacks)&&0!==window.yandexContextAsyncCallbacks.length&&(window.yandexContextAsyncCallbacks=[])}let A=!1;function O(e){try{return String(e.message||e).substring(0,100)}catch(e){}return""}function I(){const e=new URLSearchParams(location.search),t=new URLSearchParams(location.hash);return"true"===e.get("draft")||"true"===t.get("draft")}const x=p("AdvManager","Adv");function C(e,t){return"function"==typeof e[t]?(n=e[t],r=`Error in callback ${t}`,(...e)=>{try{return n(...e)}catch(e){(0,m.f)(e,{additional:{origError:O(e)},message:r})}}):()=>{};var n,r}class D{constructor(e){var t;this.callbacks={},this.onAdvDebugManagerExternalMessage=e=>{const{action:t}=e.data;switch(t){case"debug-action-showFullscreenAdv":this.showFullscreenAdvDebug(t);break;case"debug-action-showRewardedVideo":this.showRewardedVideoDebug(t);break;case"debug-action-switchStickyBanners":this.switchStickyBannersDebug(t)}},this.onAdvManagerExternalMessage=e=>{var t,n,r,a,o,s,i,c,l,d,u,p,h;const{action:g,data:y}=e.data;switch(x(`onAdvManagerExternalMessage ${g}`),g){case"adv-callback-open":null==(n=(t=this.callbacks).onOpen)||n.call(t);break;case"adv-callback-close":this.callOnAdvClose(y.wasShown);break;case"adv-callback-error":this.callOnAdvClose(!1);try{if("string"!=typeof(null==(r=null==y?void 0:y.error)?void 0:r.message)){const e=new Error("Undefined error message");try{e.additional=JSON.stringify(y)}catch(t){e.additional="undefined"}(0,m.f)(e)}}catch(e){}null==(o=(a=this.callbacks).onError)||o.call(a,new Error(y.error.message,{cause:y.error}));break;case"rewarded-video-callback-open":null==(i=(s=this.callbacks).onOpen)||i.call(s);break;case"rewarded-video-callback-rewarded":null==(l=(c=this.callbacks).onRewarded)||l.call(c);break;case"rewarded-video-callback-close":null==(u=(d=this.callbacks).onClose)||u.call(d);break;case"rewarded-video-callback-error":null==(h=(p=this.callbacks).onError)||h.call(p,new Error(y.error.message,{cause:y.error}));break;case"set-disabled-state":x('On "set-disabled-state" event',e.data,y.value),this.setDisabledState(y.value)}},this.adv=e.adv||{},this.checkDeprecatedOnAdvCloseUsage(),(null==(t=window.YandexGamesSDKEnvironment)?void 0:t.isWorldWide)&&this.setDisabledState(!0),Object.defineProperty(this,"callbacks",{enumerable:!1,writable:!0}),Object.defineProperty(this.adv,"onAdvClose",{enumerable:!1,writable:!0}),l.F.onExternalMessage("adv-manager",this.onAdvManagerExternalMessage),l.F.onExternalMessage("adv-debug-manager",this.onAdvDebugManagerExternalMessage),this.updateDisabledState()}checkDeprecatedOnAdvCloseUsage(){"onAdvClose"in this.adv&&(0,m.T)(new Error('Deprecated usage "onAdvClose". Please, use `ysdk.adv.method({callbacks})` https://yandex.ru/dev/games/doc/sdk/sdk-adv'))}showFullscreenAdvDebug(e){this.showFullscreenAdv({callbacks:{onClose:t=>x(`${e} onClose, wasShown = ${t}`),onError:t=>x(`${e} onError, error =`,t),onOpen:()=>x(`${e} onOpen`)}})}showRewardedVideoDebug(e){this.showRewardedVideo({callbacks:{onClose:()=>x(`${e} onClose`),onError:t=>x(`${e} onError, error =`,t),onOpen:()=>x(`${e} onOpen`),onRewarded:()=>x(`${e} onRewarded`)}})}switchStickyBannersDebug(e){this.getBannerAdvStatus().then((({stickyAdvIsShowing:t})=>{t?this.hideBannerAdv().then((({stickyAdvIsShowing:t})=>{x(`${e} hideBannerAdv, stickyAdvIsShowing = ${t}`)})):this.showBannerAdv().then((({reason:t,stickyAdvIsShowing:n})=>{x(`${e} hideBannerAdv, stickyAdvIsShowing = ${n}, reason = ${t}`)}))}))}updateDisabledState(){l.F.postToParent(i.X$.GetDisabledState()).then((({data:e})=>{this.setDisabledState(e.value)})).catch(console.warn)}setDisabledState(e){x("setDisabledState",e),e?A||(A=!0,S("_disableAds"),function(){var e;if(document.getElementById(k))return;const t=document.createElement("style");t.id=k,t.textContent='\nbody div[id*="yandex_rtb"],\nbody div[id*="adfox"],\nbody iframe#bwiframe,\nbody iframe[src*="yabnrwall.html"],\nbody iframe[src*="yartbbnr.html"],\nbody yatag,\nbody yatag[class]\n{ display: none !important; }',null==(e=document.body)||e.appendChild(t)}(),function(){var e,t,n;const r={destroy(){S("Ya.Context.AdvManager.destroy disabled")},render(e,t){"function"==typeof t?t():"function"==typeof e.altCallback?e.altCallback():"function"==typeof e.onError&&e.onError({code:"YA_GAMES_ADS_DISABLED",text:"",type:"error"})}};"function"==typeof(null==(n=null==(t=null==(e=window.Ya)?void 0:e.Context)?void 0:t.AdvManager)?void 0:n.render)&&(window.Ya.Context.AdvManager.render=r.render),T();let a=window.Ya;Object.defineProperty(window,"Ya",{get(){var e;return(null==(e=null==a?void 0:a.Context)?void 0:e.AdvManager)&&a.Context.AdvManager!==r&&(a.Context.AdvManager=r),T(),a},set(e){var t;(null==(t=e.Context)?void 0:t.AdvManager)&&e.Context.AdvManager!==r&&(e.Context.AdvManager=r),a=e},enumerable:!0,configurable:!0}),window.Ya=window.Ya||{},window.Ya.Context=window.Ya.Context||{AdvManager:r},window.Ya.Context.AdvManager=r,S("disable Ya.Context.AdvManager.render")}()):A&&(A=!1)}ensureCallbacksIsValid(e,t){if(!Object.keys(t).length)return;let n=["onClose","onError"];"showRewardedVideo"===e&&n.push("onRewarded");try{n=n.filter((e=>!(e in t&&"function"==typeof t[e])))}catch(e){(0,m.T)(new Error('Error in "ensureCallbacksIsValid"'),{additional:{error:String(e).substring(0,100)}})}if(n.length){const t=new Error(`Callbacks for "${e}" has unpresented methods. See https://yandex.ru/dev/games/doc/ru/sdk/sdk-adv`);(0,m.T)(t,{additional:{unpresentedMethods:n}})}}showFullscreenAdv({callbacks:e={}}={}){this.ensureCallbacksIsValid("showFullscreenAdv",e);const t=y("AdvManager.showFullscreenAdv");l.F.postToParent(i.X$.AdvShowFullscreen()).then((({data:{error:t}})=>{if(!t)return this.setCallbacks(e,["onClose","onOpen","onError"]);if(I()&&t.message.includes("often than once per"))throw t;(0,m.T)(t,{level:"warn"}),C(e,"onError")(t),C(e,"onClose")(!1),this.callDeprecatedOnClose(!1)})).catch((t=>{(0,m.T)(t,{level:"warn"}),C(e,"onError")(t),C(e,"onClose")(!1),this.callDeprecatedOnClose(!1)})).finally((()=>{t()}))}showRewardedVideo({callbacks:e={}}={}){this.ensureCallbacksIsValid("showRewardedVideo",e);const t=y("AdvManager.showRewardedVideo");l.F.postToParent(i.X$.AdvShowRewardedVideo()).then((({data:{error:t}})=>{if(t)throw t;this.setCallbacks(e,["onOpen","onRewarded","onClose","onError"])})).catch((t=>{(0,m.f)(t),C(e,"onError")(t),C(e,"onClose")(!1)})).finally((()=>{t()}))}showBannerAdv(){return new Promise((e=>{const t=y("AdvManager.showBannerAdv");l.F.postToParent(i.X$.AdvShowStickyBanner()).then((({data:t})=>{e(t)})).catch((t=>{(0,m.f)(t),e({reason:E.UNKNOWN,stickyAdvIsShowing:!1})})).finally((()=>{t()}))}))}hideBannerAdv(){return new Promise((e=>{const t=y("AdvManager.hideBannerAdv");l.F.postToParent(i.X$.AdvHideStickyBanner()).then((({data:t})=>{e(t)})).catch((t=>{(0,m.f)(t),e({stickyAdvIsShowing:!1})})).finally((()=>{t()}))}))}getBannerAdvStatus(){return new Promise((e=>{const t=y("AdvManager.getBannerAdvStatus");l.F.postToParent(i.X$.AdvStatusStickyBanner()).then((({data:t})=>{e(t)})).catch((t=>{(0,m.f)(t),e({reason:E.UNKNOWN,stickyAdvIsShowing:!1})})).finally((()=>{t()}))}))}setCallbacks(e,t){this.callbacks={},t.forEach((t=>{this.callbacks[t]=C(e,t)}))}callOnAdvClose(e=!1){var t,n;this.callDeprecatedOnClose(e),null==(n=(t=this.callbacks).onClose)||n.call(t,e)}callDeprecatedOnClose(e=!1){if("function"==typeof this.adv.onAdvClose)try{this.adv.onAdvClose(e)}catch(e){(0,m.T)(e)}}}const _=new class{openAuthDialog(){const e=y("AuthManagerPublic.openAuthDialog",12e4),t=l.F.postToParent(i.uQ.AuthDialogOpen());return t.finally((()=>{e()})),t}};function L(e){const t=typeof e;return null!=e&&("object"===t||"function"===t)}var R=n(146);const F=n(617).Z,$={small:R.f9.ISLANDS_RETINA_SMALL,medium:R.f9.ISLANDS_RETINA_MEDIUM,large:R.f9.ISLANDS_200},N={small:R.f9.ISLANDS_200,medium:R.f9.ISLANDS_200,large:R.f9.BIG},j={sdkBackendURL:"",avatarOrigin:"https://avatars.mdst.yandex.net"},G=`${j.avatarOrigin}/get-yapic/`;class M{constructor(e){this._personalInfo=e}getID(){return(0,m.T)(new Error("Player.getID() is deprecated. Please, use Player.getUniqueID().\nhttps://yandex.ru/dev/games/doc/dg/sdk/sdk-player.html#sdk-player__profile-data")),F.sendOnceDeprecatedUsage("Player.getID"),this._personalInfo.id}getUniqueID(){return this._personalInfo.uniqueID}getName(){return this._personalInfo.publicName}getMode(){var e;return null!=(e=this._personalInfo.mode)?e:""}getPayingStatus(){return l.F.postToParent(i.yH.GetGamePurchaseEnabled()).then((({data:{enabled:e}})=>{e||(0,m.T)(new Error("We provide data on the player's ability to pay in games that already support purchases"),{level:"warn"})})),this._personalInfo.payingStatus}getPhoto(e="medium"){const t=$[e];if(!t)throw new Error(`Unknown size value ('${e}')`);return this._personalInfo.avatarIdHash?`${j.sdkBackendURL}/player/avatar/${this._personalInfo.avatarIdHash}/${t}`:`${G}${R._h}/${t}`}}var U=Object.defineProperty,B=Object.getOwnPropertySymbols,V=Object.prototype.hasOwnProperty,Y=Object.prototype.propertyIsEnumerable,K=(e,t,n)=>t in e?U(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,H=(e,t)=>{for(var n in t||(t={}))V.call(t,n)&&K(e,n,t[n]);if(B)for(var n of B(t))Y.call(t,n)&&K(e,n,t[n]);return e};const W=(e,t)=>{l.F.postToParent((0,i.rS)({playdeck:H({method:e},t)}))},q="tgData";var X=Object.defineProperty,J=Object.defineProperties,z=Object.getOwnPropertyDescriptors,Q=Object.getOwnPropertySymbols,Z=Object.prototype.hasOwnProperty,ee=Object.prototype.propertyIsEnumerable,te=(e,t,n)=>t in e?X(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;const ne=s((e=>l.F.postToParent(i.S.Score(e)).then((({data:e})=>e.result))),1e3);class re{getLeaderboardDescription(e){const t=y("Leaderboards.getLeaderboardDescription"),n=l.F.postToParent(i.S.Description({name:e})).then((({data:e})=>e));return n.finally((()=>{t()})),n}getLeaderboardStat(e){const t=y("Leaderboards.getLeaderboardStat"),n=l.F.postToParent(i.S.Stat({name:e})).then((({data:e})=>e));return n.finally((()=>{t()})),n}getLeaderboardEntries(e,t){const{includeUser:n=!1,quantityAround:r=5,quantityTop:a=5}=t||{},o=y("Leaderboards.getLeaderboardEntries"),s=l.F.postToParent(i.S.Entries({include_user:n,name:e,quantity_around:r,quantity_top:a})).then((({data:e})=>{const{avatarPrefix:t,result:n}=e,{entries:r,leaderboard:a,ranges:o,userRank:s}=n;return{entries:this.transformLeaderboardEntries(r,t),leaderboard:a,ranges:o,userRank:s}}));return s.finally((()=>{o()})),s}getLeaderboardPlayerEntry(e){return t=this,n=function*(){const{data:t}=yield l.F.postToParent(i.S.PlayerEntry({name:e}));return this.transformLeaderboardEntry(t.result,t.avatarPrefix)},new Promise(((e,r)=>{var a=e=>{try{s(n.next(e))}catch(e){r(e)}},o=e=>{try{s(n.throw(e))}catch(e){r(e)}},s=t=>t.done?e(t.value):Promise.resolve(t.value).then(a,o);s((n=n.apply(t,null)).next())}));var t,n}setLeaderboardScore(e,t,n){W("setScore",{value:t});const r={name:e,score:t};return this.lastTimeLeaderboardWasSend&&!this.canSetLeaderboardScoreByTime()?Promise.reject("The request to setLeaderboardScore can be sent no more than once per second"):(n&&(r.extraData=n),this.lastTimeLeaderboardWasSend=Date.now(),ne(r))}canSetLeaderboardScoreByTime(){return Date.now()-this.lastTimeLeaderboardWasSend>1e3}transformLeaderboardEntry(e,t){const{avatarIdHash:n,lang:r,publicName:a,scopePermissions:o,uniqueID:s}=e.player,i=`${t}${n}`;return c=((e,t)=>{for(var n in t||(t={}))Z.call(t,n)&&te(e,n,t[n]);if(Q)for(var n of Q(t))ee.call(t,n)&&te(e,n,t[n]);return e})({},e),J(c,z({player:{getAvatarSrc:(e="medium")=>($[e]||(e="medium"),`${i}/${$[e]}`),getAvatarSrcSet:(e="medium")=>($[e]||(e="medium"),`${i}/${$[e]} 1x, ${i}/${N[e]} 2x`),lang:r,publicName:a,scopePermissions:o,uniqueID:s}}));var c}transformLeaderboardEntries(e,t){return e.map((e=>this.transformLeaderboardEntry(e,t)))}}const ae=()=>{const e=new re;return Promise.resolve(e)};function oe(e,t){t&&Object.defineProperty(e,"signature",{enumerable:!1,configurable:!1,get:()=>t})}class se extends Error{constructor({code:e,httpStatus:t,message:n},r,a){super(n,r,a),this.name="PaymentsError",this.code=e,this.httpStatus=t,Object.setPrototypeOf(this,se.prototype),Error.captureStackTrace&&Error.captureStackTrace(this,se)}toJSON(){return{code:this.code,httpStatus:this.httpStatus,message:this.message,name:this.name,stack:this.stack}}}const ie=se,ce=new Set(["ru","uk","be","kk","uz"]);var le=(e=>(e.BE="be",e.EN="en",e.KK="kk",e.RU="ru",e.TR="tr",e.UK="uk",e.UZ="uz",e))(le||{});const de=le.RU;function ue(e,t=de,n=""){if(e){if("string"==typeof e)return e;if(t in e)return e[t]||n;if(!(e=>!e||ce.has(e))(t)&&"en"in e)return e.en||n;if(de in e)return e[de]||n}return n}var pe;const he=Symbol("codePath"),me=Symbol("appId"),ge=Symbol("sendMetricaParams"),ye=Symbol("currencyPriceStat"),fe=Symbol("sendOnceCurrencyCodeStat"),ve=Symbol("getCurrencyImageUrlPrefix"),we=Symbol("currencyCodeStat");class be{constructor(e){this._productData=e,this[pe]=()=>{this[fe]=()=>{},this[ge](this[we])}}get id(){return this._productData.id}get title(){return ue(this._productData.title)}get description(){return ue(this._productData.description)}get imageURI(){const{image:e}=this._productData;if(e&&"object"==typeof e&&"url_prefix"in e){const t=String(e.url_prefix);return/\.(png|jpg|svg)$/.test(t)?t:`${t}/default256x256`}return"https://yastatic.net/s3/games-static/static-data/images/payments/default-product-image.png"}get price(){const{price:e}=this._productData;return`${e} ${this.priceCurrencyCode}`}get priceValue(){return String(this._productData.price)}get priceCurrencyCode(){this[fe]()}get[he](){return""}getPriceCurrencyImage(e="small"){if("svg"===e)return`${this[ve]()}/currency-icon-m.svg`;let t="s";switch(e){case"medium":case"small":t=e.charAt(0);break;default:console.warn(`Unknown size value ('${e}')`)}const n=window.devicePixelRatio>=2;return`${this[ve]()}/currency-icon-${t}${n?"@2x":""}.png`}toJSON(){return{id:this.id,title:this.title,description:this.description,imageURI:this.imageURI,price:this.price,priceValue:this.priceValue,priceCurrencyCode:this.priceCurrencyCode}}get[we](){return{borrowParams:{payments:{appId:this[me],productCurrencyCodeGet:!0}}}}[(pe=fe,ve)](){return`//yastatic.net/s3/games-static/static-data/images/payments/sdk${this[he]}`}get[ye](){return this._productData.currencyPrice}}const Pe=e=>{const t=e/R.Uo;return Math.ceil(100*t)/100};var Ee=n(179),Se=n(617);class ke extends be{get priceCurrencyCode(){var e;return super.priceCurrencyCode,this[ye]?this[ye].currency:null==(e=window.YandexGamesSDKEnvironment)?void 0:e.moneyCodeSymbol}get price(){return this[ye]?`${Pe(this[ye].priceValue)} ${this[ye].currency}`:super.price}get priceValue(){return this[ye]?String(Pe(this[ye].priceValue)):super.priceValue}get[he](){var e,t;return this[ye]?`/${this[ye].currency.toLowerCase()}`:(null==(e=window.YandexGamesSDKEnvironment)?void 0:e.moneyCodeSymbol)?`/${null==(t=window.YandexGamesSDKEnvironment)?void 0:t.moneyCodeSymbol.toLowerCase()}`:""}get[me](){return(0,Ee.o)()}[ge](e){Se.Z.params(e)}}class Te{constructor(e){this.purchaseData=e}get productID(){return this.purchaseData.productID}get purchaseToken(){return this.purchaseData.purchaseToken}get developerPayload(){return this.purchaseData.developerPayload}toJSON(){return{productID:this.productID,purchaseToken:this.purchaseToken,developerPayload:this.developerPayload}}}const Ae=p("Payment");class Oe{constructor(e={}){this._config=e,this.___test1212()}getCatalog(){return new Promise(((e,t)=>{const n=y("Payments.getCatalog");l.F.postToParent(i.yH.GetCatalog({lang:this._config.lang})).then((({data:t})=>{Ae("get-catalog result",t),e(t.products.map((e=>new ke(e))))})).catch((e=>{t(e)})).finally((()=>{n()}))}))}purchase(e){"object"!=typeof e&&(e={id:e,developerPayload:""});const{developerPayload:t}=e;if(t){if("string"!=typeof t)return Promise.reject(new Error("developerPayload must be a string"))}else e.developerPayload="";return new Promise(((t,n)=>{l.F.postToParent(i.yH.PurchaseStart({paymentsConfig:this._config,purchaseConfig:e})).then((({data:{data:e,signature:n}})=>{Ae("purchase-start then");const r=new Te({productID:e.product.id,purchaseToken:e.token,developerPayload:e.developerPayload});oe(r,n),t(r)})).catch((e=>{Ae("purchase-start catch"),n(e)}))}))}getPurchases(){return new Promise(((e,t)=>{const n=y("Payments.getPurchases");l.F.postToParent(i.yH.GetPurchases({paymentsConfig:this._config})).then((({data:{data:t,signature:n}})=>{Ae("getPurchases callback",t);const r=t.map((e=>new Te({productID:e.product.id,purchaseToken:e.token,developerPayload:e.developerPayload})));oe(r,n),e(r)})).catch((e=>{t(e)})).finally((()=>{n()}))}))}consumePurchase(e){return new Promise(((t,n)=>{const r=y("Payments.consumePurchase");l.F.postToParent(i.yH.PurchaseConsume({token:e})).then((({data:e})=>{if(console.info("consumePurchase data"),console.info(e),!e||!e.token)throw new ie({code:"CANNOT_CONSUME_PURCHASE",message:"Can not consume purchase."});t(!0)})).catch((e=>{n(e)})).finally((()=>{r()}))}))}___test1212(){var e,t,n;if("96458"!==(null==(e=window.YandexGamesSDKEnvironment)?void 0:e.app.id))return;if(!0!==(null==(n=null==(t=window.YandexGamesSDKEnvironment)?void 0:t.request.experiments)?void 0:n.test1212Payments))return;const r="position: fixed; left: 15px; padding: 0.3em; background: #fff; border: 1px solid #000; border-radius: 5px;";let a=document.createElement("div");a.setAttribute("id","payElement1212-noads"),a.setAttribute("style",`${r} top: 5px;`),a.textContent='purchase("noads")',a.onclick=()=>this.___test1212Purchase("noads"),document.body.appendChild(a),a=document.createElement("div"),a.setAttribute("id","payElement1212-3x3antiblock"),a.setAttribute("style",`${r} top: 40px;`),a.textContent='purchase("3x3antiblock")',a.onclick=()=>this.___test1212Purchase("3x3antiblock"),document.body.appendChild(a)}___test1212Purchase(e){function t(t){const n=document.getElementById(`payElement1212-${e}`);n&&(n.style.backgroundColor=t?"#0f0":"#f00")}this.purchase({id:e,developerPayload:""}).then((()=>t(!0))).catch((e=>{t(!1),(0,m.f)(e)}))}}const Ie={APP_VERSION:"",app:{id:""},browser:{lang:"ru"},clid:void 0,i18n:{lang:"ru",tld:"ru"},isStickyBannerEnabled:!1,isWorldWide:!1,isYandexApp:!1,isTelegram:!1,parentTimeOrigin:performance.timeOrigin,moneyCodeSymbol:R.NA.HOP,params:{},request:{},serverTime:Date.now(),serviceHostname:"yandex",serviceName:"yandex",useMockGameLinks:!1};let xe=()=>(window.YandexGamesSDKEnvironment||(0,m.f)(new Error("SDK environment: `window.YandexGamesSDKEnvironment` is undefined")),xe=()=>window.YandexGamesSDKEnvironment||Ie,xe());const Ce={get app(){return xe().app},get browser(){return{lang:xe().i18n.lang}},get data(){return xe().data||{}},get i18n(){return xe().i18n},get payload(){return xe().params.payload},get isTelegram(){return xe().isTelegram},get domain(){return xe().serviceName||xe().serviceHostname}};var De=n(491);function _e(e){try{return JSON.stringify(e)}catch(e){return(0,m.f)(e),`${Date.now()}.${Math.random()}`}}class Le{constructor(e){this._playerId=e,this._dataHash=null,this._timestamp=0}isSamePlayer(e){return e===this._playerId}set dataHash(e){this._dataHash=e?_e(e):null}validate(e){const t=_e(e);return function(e){try{return(new TextEncoder).encode(e).length}catch(t){return function(e){let t=e.length;for(let n=e.length-1;n>=0;n--){let r=e.charCodeAt(n);r>127&&r<=2047?t++:r>2047&&r<=65535&&(t+=2),r>=56320&&r<=57343&&n--}return t}(e)}}(t)>204800?{error:new Error("The data is too large (bigger then 204800 bytes)."),reject:!0}:this._dataHash===t?{error:new Error("The data does not differ from the previous ones."),reject:!1}:{}}getWaitTime(){let e=200;const t=Math.abs(Date.now()-this._timestamp);return t<3e3&&(e=Math.max(200,3e3-t)),e}set timestamp(e){this._timestamp=e}}const Re=p("Player");function Fe(e,t){return(0,m.f)(t,e)}function $e(e){const{data:t,signature:n}=function(e,t){if("signature"in e){const{signature:n}=e;if("string"==typeof n){const{data:e}=JSON.parse(function(e){for(var t,n="",r=e.length,a=0;a251&&t<254&&a+5247&&t<252&&a+4239&&t<248&&a+3223&&t<240&&a+2191&&t<224&&a+1>>2,i=new Uint8Array(s),c=0,l=0,d=0;d64&&r<91?r-65:r>96&&r<123?r-71:r>47&&r<58?r+4:43===r?62:47===r?63:0)<<18-6*n,3===n||o-d==1){for(t=0;t<3&&l>>(16>>>t&24)&255;c=0}return i}(n.split(".")[1])));return{data:e,signature:n}}t({},new Error("response.signature is not a string"))}return{data:e}}(e,Fe);return oe(t,n),t}function Ne(e,t){if(void 0===t)return e;if(!Array.isArray(t))throw new Error("`keys` must be an Array");if(-1!==t.indexOf("signature"))throw new Error('`keys` must not contains "signature" key');const n={};return t.forEach((t=>{t in e&&(n[t]=e[t])})),n}function je(e){return!(!e||"object"!=typeof e)&&Object.values(e).every((e=>"number"==typeof e&&!isNaN(e)))}let Ge,Me,Ue,Be;l.F.onExternalMessage("auth",(e=>{if("changed"===e.data.action&&Ue){Re("Call onLogoutCallback()");try{Ue()}catch(e){console.error()}Ue=void 0}}));class Ve extends M{constructor(e,t){super(e),this.dataPromise=null,this.getApiPromise=()=>new Promise(((e,t)=>{this.getPlayerData().then((t=>{this.data=t,e(t)})).catch((e=>{this.dataPromise=null,t(e)}))})),this.getPlayerData=()=>{return e=this,t=function*(){const{data:e}=yield l.F.postToParent(i.Uh.GetData({signed:this.config.signed}));return $e(e)},new Promise(((n,r)=>{var a=e=>{try{s(t.next(e))}catch(e){r(e)}},o=e=>{try{s(t.throw(e))}catch(e){r(e)}},s=e=>e.done?n(e.value):Promise.resolve(e.value).then(a,o);s((t=t.apply(e,null)).next())}));var e,t},this.getDataPromise=()=>void 0!==this.data?Promise.resolve(this.data):Ce.isTelegram?(W("getData",{key:q}),new Promise(((e,t)=>{function n(r){var a;if(!(e=>{var t,n,r;return"getData"===(null==(r=null==(n=null==(t=e.data)?void 0:t.data)?void 0:n.playdeck)?void 0:r.method)})(r))return;l.F.offExternalMessage("telegram",n);const o=(null==(a=r.data.data.playdeck.value)?void 0:a.data)||"{}";if("string"==typeof o)try{e(JSON.parse(o))}catch(e){const n=new Error("Error parsing game data from telegram");n.additional={originalError:e},(0,m.f)(n,{prefix:"telegram"}),t({})}else e(o)}l.F.onExternalMessage("telegram",n),setTimeout((()=>{l.F.offExternalMessage("telegram",n),t()}),1e3)}))).catch((()=>this.getPlayerData())):this.getApiPromise(),this.config=t,Me&&Me.isSamePlayer(this.getUniqueID())||(Me=new Le(this.getUniqueID()))}onLogout(e){Re("Set onLogout callback"),Ue=e}getIDsPerGame(){return l.F.postToParent(i.Uh.IdsPerGame({signed:this.config.signed})).then((({data:e})=>$e(e)))}getData(e){return this.dataPromise=this.getDataPromise(),this.dataPromise.then((t=>Ne(t,e)))}setData(e,t=!1){var n;if(Ce.isTelegram&&(n=e,W("setData",{key:q,value:JSON.stringify(n)})),!function(e){return"object"==typeof e&&null!==e}(e))return Promise.reject(new Error("Data is not valid"));this.data=e;const r=function(e,t=!1){const n=Me.validate(e);return n.error?n.reject?Promise.reject(n.error):((0,m.T)(n.error),Promise.resolve(!0)):new Promise(((n,r)=>{Ge&&window.clearTimeout(Ge);let a=t?200:Math.max(200,Me.getWaitTime());Me.timestamp=Date.now(),Ge=window.setTimeout((()=>{l.F.postToParent(i.Uh.SetData({data:e})).then((()=>{Me.dataHash=e,n(!0)})).catch((e=>{Me.timestamp=0,Me.dataHash=null,r(e)}))}),a)}))}(e,t);return t?r:Promise.resolve(!0)}getStats(e){return void 0===this.statsPromise&&(this.statsPromise=new Promise(((e,t)=>{l.F.postToParent(i.Uh.Stats({signed:this.config.signed})).then((({data:e})=>$e(e))).then(e).catch(t).finally((()=>this.statsPromise=void 0))}))),this.statsPromise.then((t=>Ne(t,e)))}setStats(e){return je(e)?l.F.postToParent(i.Uh.SetStats({stats:e})).then((({data:e})=>e.result)):Promise.reject(new Error("Stats is not valid"))}incrementStats(e){return je(e)?l.F.postToParent(i.Uh.IncrementStats({increments:e,signed:this.config.signed})).then((({data:e})=>$e(e.result))):Promise.reject(new Error("Increments is not valid"))}}function Ye(e){return t=this,n=function*(){return new Promise((t=>setTimeout((()=>t()),e)))},new Promise(((e,r)=>{var a=e=>{try{s(n.next(e))}catch(e){r(e)}},o=e=>{try{s(n.throw(e))}catch(e){r(e)}},s=t=>t.done?e(t.value):Promise.resolve(t.value).then(a,o);s((n=n.apply(t,null)).next())}));var t,n}try{Be=window.localStorage}catch(e){}const Ke=Be||function(){let e={};return{clear(){e={}},getItem:t=>e[t],key:t=>Object.keys(e)[t],removeItem(t){delete e[t]},setItem(t,n){e[t]=String(n)},get length(){return Object.keys(e).length}}}(),He=/iPad|iPhone|iPod/.test(navigator.platform),We=/^((?!chrome|android).)*safari/i.test(navigator.userAgent),qe=He||We,Xe=/app-[^.]+\.games\.s3\.yandex\.net$/.test(location.hostname),Je=!Xe&&qe,ze=function(e,t){if("function"!=typeof t)throw new Error("Argument is not a function");let n;return function(...r){return--e>0&&t&&(n=t.apply(this,r)),e<=1&&(t=void 0),n}}(2,(()=>{(0,m.f)(new Error("localStorage is broken on iOS/MacOS - https://developer.apple.com/forums/thread/109909\nPlease use YaGames.init().then(ysdk => ysdk.getStorage()).then(storage => storage.setItem('key', 'value'))"))})),Qe=class e{static setup(){Je&&Object.defineProperty(window,"localStorage",{get:function(){return ze(),Ke}}),qe&&Xe&&e.setProxy()&&e.backup()}static load(){if(e.onloadPromise_)return e.onloadPromise_;const t=e.getCustomLocalStorage();return t?(e.onloadPromise_=Promise.race([Ye(5e3).then((()=>{throw new Error("LocalStorage timeout")})),l.F.postToParent(i.Qq.GetAll()).then((({data:e})=>{for(let[n,r]of Object.entries(e))t.setItem(n,String(r));return t}))]).catch((e=>(console.error(e),Ke))),e.onloadPromise_):Promise.resolve(Ke)}static getCustomLocalStorage(){return"function"!=typeof Proxy?null:new Proxy({clear(){Ke.clear.call(Ke),l.F.postToParent(i.Qq.Clear())},getItem:e=>Ke.getItem.call(Ke,e),key:e=>Ke.key.call(Ke,e),get length(){return Ke.length},removeItem(e){Ke.removeItem.call(Ke,e),l.F.postToParent(i.Qq.Del(e))},setItem(e,t){Ke.setItem.call(Ke,e,String(t)),l.F.postToParent(i.Qq.Set(e,t))}},{get:function(e,t){return t in e?e[t]:e.getItem(String(t))},set:function(e,t,n){return e.setItem(String(t),n),!0}})}static setProxy(){const t=e.getCustomLocalStorage();return!!t&&(Object.defineProperty(window,"localStorage",{get:function(){return t}}),!0)}static backup(){const e=Object.create(null);for(let t=0;tt in e?tt(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,st=(e,t)=>{for(var n in t||(t={}))rt.call(t,n)&&ot(e,n,t[n]);if(nt)for(var n of nt(t))at.call(t,n)&&ot(e,n,t[n]);return e};const it=e=>({get id(){return e.id},get title(){return ue(e.title)},get description(){return ue(e.description)},get imageURI(){const{image:t}=e;return t&&"object"==typeof t&&"url_prefix"in t?/\.(png|jpg|svg)$/.test(String(t.url_prefix))?t.url_prefix:`${t.url_prefix}/default256x256`:"https://yastatic.net/s3/games-static/static-data/images/bonuses/default-bonus-image.png"}});p("Bonus");var ct=Object.defineProperty,lt=Object.defineProperties,dt=Object.getOwnPropertyDescriptors,ut=Object.getOwnPropertySymbols,pt=Object.prototype.hasOwnProperty,ht=Object.prototype.propertyIsEnumerable,mt=(e,t,n)=>t in e?ct(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,gt=(e,t)=>{for(var n in t||(t={}))pt.call(t,n)&&mt(e,n,t[n]);if(ut)for(var n of ut(t))ht.call(t,n)&&mt(e,n,t[n]);return e},yt=(e,t)=>lt(e,dt(t)),ft=(e,t,n)=>new Promise(((r,a)=>{var o=e=>{try{i(n.next(e))}catch(e){a(e)}},s=e=>{try{i(n.throw(e))}catch(e){a(e)}},i=e=>e.done?r(e.value):Promise.resolve(e.value).then(o,s);i((n=n.apply(e,t)).next())}));const vt=()=>({params:{lang:Ce.i18n.lang}}),wt=class{constructor(e){this.getCatalog=()=>ft(this,null,(function*(){var e;const{data:t}=yield l.F.postToParent(i.Aw.Catalog(vt()));return(null!=(e=null==t?void 0:t.bonuses)?e:[]).map(it)})),this.getPlayerBonuses=()=>ft(this,null,(function*(){const{data:e}=yield l.F.postToParent(i.Aw.PlayerBonuses(yt(gt({},vt()),{signed:this.signed})));return this.signed?e:e?e.map((e=>yt(gt({},it(e.item)),{receivedAt:e.created,token:e.token}))):[]})),this.consume=e=>l.F.postToParent(i.Aw.Consume({params:{token:e},signed:this.signed})).then((({data:e})=>e)),this.signed=Boolean(e)}};wt.init=e=>{const{getCatalog:t,getPlayerBonuses:n,consume:r}=new wt(e);return{getCatalog:t,getPlayerBonuses:n,consume:r}};let bt=wt;const Pt=p("captureAlert");function Et(e){var t,n;if("DIV"===e.tagName&&e.getAttribute("style")&&!e.querySelector("div")&&!e.classList.length&&!e.id){const e="OK"===(null==(t=document.querySelector("button"))?void 0:t.textContent)&&(null==(n=document.querySelector("span"))?void 0:n.textContent);e&&(Pt(`popup message = ${e}`),l.F.postToParent((0,i.Bz)({message:e.substring(0,250),popup:!0})))}}function St(){const e="createUnityInstance"in window||"UnityLoader"in window;if(Pt("captureUnityAlert isUnity",e),e&&(document.querySelectorAll("div[style]:not([id]):not([class])").forEach(Et),"undefined"!=typeof MutationObserver)){const e=new MutationObserver((e=>{e.forEach((e=>{"childList"===e.type&&setTimeout((()=>{Array.from(e.addedNodes).forEach(Et)}),0)}))}));e.observe(document.body,{childList:!0,subtree:!0}),window.addEventListener("unload",(()=>{e.disconnect()}))}}const kt=new class{writeText(e){try{e=String(e)}catch(e){return Promise.reject(new Error("Error while stringified provided value"))}return new Promise(((t,n)=>{const r=y("ClipboardPublic.writeText");l.F.postToParent(i.u8.WriteText({text:e})).then((()=>t(void 0))).catch(n).finally((()=>{r()}))}))}};class Tt{constructor(e="desktop"){this._type=e}get type(){return this._type}isMobile(){return"mobile"===this.type}isTablet(){return"tablet"===this.type}isDesktop(){return"desktop"===this.type}isTV(){return"tv"===this.type}}var At=n(59);const Ot=[{regexp:new RegExp("User .+ already exists in users list!"),title:"User already exists in users list!"},{regexp:new RegExp("\\(Filename:.+Line: -?[0-9]+\\)"),title:"Unity"},{substr:"UnityEngine",title:"Unity"},{substr:"Dimensions must match",title:"Unity"},{substr:"Loading FSB failed for audio clip",title:"Unity"},{substr:"UnityLoader",title:"Unity"},{substr:"FS.syncfs operations in flight at once, probably just doing extra work",title:"Unity"},{substr:"GLSL",title:"GLSL"},{substr:"ValerypopoffJS plugin",title:"ValerypopoffJS plugin"},{substr:"https://github.com/cocos-creator/engine",title:"cocos-creator"},{substr:"Wicket.Ajax",title:"Wicket.Ajax"},{substr:'Error loading sound "%s"',title:'"loading sound"'},{substr:"Error loading image",title:'"loading image"'},{substr:"Error loading Texture",title:'"loading Texture"'},{substr:"Error loading asset",title:'"loading asset"'},{substr:"Error loading audio url",title:'"loading audio url"'},{substr:"Error loading animation resource",title:'"loading animation resource"'},{substr:"Failed to load resource:",title:'"loading resource"'},{substr:"Could not load",title:'"loading"'},{substr:"Failed to load",title:'"loading"'},{regexp:new RegExp("[Cc]ould not allocate memory"),title:"working with memory"},{substr:"Out of executable memory in function at index",title:"working with memory"},{substr:"memory access out of bounds",title:"working with memory"},{substr:"pre-main prep time: ",title:'"pre-main prep time"'},{substr:"FAILED DIGGING: ",title:'"DIGGING"'},{substr:"sth wrong with connection!",title:'"sth wrong with connection!"'},{substr:"Object2D is not available",title:'"Object2D is not available"'},{regexp:new RegExp("^Client : Error finish action.*?respawn$"),title:'"finish action respawn"'},{substr:"[TokenStorageYandex]",title:"TokenStorageYandex"},{substr:"TOO_SMALL_CONTAINER",title:"TOO_SMALL_CONTAINER"},{substr:"Too small container",title:"TOO_SMALL_CONTAINER"},{substr:"window.cb",title:"Error related to window.cb"},{substr:"Not allowed to call RecalculateBounds",title:"Not allowed to call RecalculateBounds"},{regexp:/Loading chunk.*?partner-code-bundles/,title:"Loading chunk partner-code-bundles errors"},{substr:"[pcode] Loading chunk",title:"Loading chunk partner-code-bundles errors"},{regexp:/Loading chunk \S+ failed after \d+ retries/,title:"Loading chunk loadable-components errors"},{substr:"loadable-components: failed to asynchronously load component",title:"Loading component loadable-components errors"}];var It=Object.defineProperty,xt=Object.getOwnPropertySymbols,Ct=Object.prototype.hasOwnProperty,Dt=Object.prototype.propertyIsEnumerable,_t=(e,t,n)=>t in e?It(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Lt=(e,t)=>{for(var n in t||(t={}))Ct.call(t,n)&&_t(e,n,t[n]);if(xt)for(var n of xt(t))Dt.call(t,n)&&_t(e,n,t[n]);return e};function Rt(e,t){return t}const Ft=function({matchers:e,updateErrorTitle:t=Rt}){return function(n){for(const r of e){if(r.substr&&n.includes(r.substr))return{message:`[grouped] ${t(n,r.title)}`,additional:{message:n}};if(r.regexp){const e=n.match(r.regexp);if(e){let a=null;return r.groupNames&&(a=[...e.copyWithin(0,1)].reduce(((e,t,n)=>{var a;return(null==(a=r.groupNames)?void 0:a[n])?(e[r.groupNames[n]]=t,e):e}),{})),{message:`[grouped] ${t(n,r.title)}`,additional:Lt({message:n},a)}}}}return{message:n}}}({matchers:Ot});var $t=Object.defineProperty,Nt=Object.getOwnPropertySymbols,jt=Object.prototype.hasOwnProperty,Gt=Object.prototype.propertyIsEnumerable,Mt=(e,t,n)=>t in e?$t(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Ut=(e,t)=>{for(var n in t||(t={}))jt.call(t,n)&&Mt(e,n,t[n]);if(Nt)for(var n of Nt(t))Gt.call(t,n)&&Mt(e,n,t[n]);return e};function Bt(e,t){t&&(e.type=t),l.F.postToParent((0,i._X)(e)).catch((e=>{console.warn(e)}))}function Vt(e){return{data:{additional:{sdkVersion:2}},error:e,source:"game",sourceMethod:(0,At.Z)(e.stack)}}const Yt=new class{constructor(e,t){this.source=e,this.additionalErrorData=t,this.source=e,window.addEventListener("error",this),"Promise"in window&&window.addEventListener("unhandledrejection",this)}addLogger(e){this.logger=e}handleEvent(e){this._handleEvent(e)}_handleEvent(e,t="error"){try{this._unsafeHandleEvent(e,t)}catch(e){console.warn("Couldn't handle event in ErrorCounter!",e)}}_unsafeHandleEvent(e,t){return"unhandledrejection"===e.type?this._unsafeHandlePromiseRejectionEvent(e):this._unsafeHandleErrorEvent(e,t)}_unsafeHandlePromiseRejectionEvent(e){var t;const{reason:n}=e;if(!n)return;let r;const a={};n.stack&&n.message?r=n.message:(r=String(n),"[object Event]"===r?r="event.type: "+n.type:"[object Object]"===r&&(a.unhandledObject=n,r=n.message||"Undefined error message")),(null==(t=n.target)?void 0:t.src)&&(a.src=n.target.src);const o={additional:a,message:"Unhandled rejection: "+r,name:"UnhandledPromiseError",stack:n.stack||""};console.error(o.message,R.X4,o),this._postError(o,"unhandled")}_unsafeHandleErrorEvent(e,t){var n,r,a,o,s;const{error:i}=e,c={columnNumber:null!=(r=null!=(n=e.colno)?n:null==i?void 0:i.columnNumber)?r:-1,fileName:this._trimErrorData(e.filename||(null==i?void 0:i.fileName)||"",200),lineNumber:null!=(o=null!=(a=e.lineno)?a:null==i?void 0:i.lineNumber)?o:-1,message:this._trimErrorData(e.message||(null==i?void 0:i.message)||"",200),name:this._trimErrorData((null==i?void 0:i.name)||"Error",200),stack:this._trimErrorData(null!=(s=null==i?void 0:i.stack)?s:"",3e3)};(this.additionalErrorData||(null==i?void 0:i.additional))&&(c.additional=Ut(Ut({},null==i?void 0:i.additional),this.additionalErrorData)),console.error(c.message,R.X4,c),this._postError(c,t)}_trimErrorData(e,t){return"string"==typeof e&&e.length>t?e.substring(0,t):e}_postError(e,t){var n;let r=(0,At.Z)(e.stack);"ErrorListener.handleEvent"===r&&(r="unknown"),null==(n=this.logger)||n.call(this,{data:{additional:e.additional||{}},block:`${this.source}-${t}`,error:e,source:this.source,sourceMethod:r},t)}}("game");Yt.addLogger(Bt),function(){try{const e=console.error;console.error=(...t)=>{let n=t.filter((e=>e instanceof Error))[0];n||(n=(e=>{const t=(e=>e.map((e=>{if("object"==typeof e)try{return JSON.stringify(e)}catch(t){return`${e}: ${t.message}`}return String(e)})).join(" "))(e),n=Ft(t),r=new Error(n.message);return n.additional&&(r.additional=n.additional),r})(t));try{"string"==typeof t[1]&&t[1]===R.X4?t.splice(1,1):Bt(Vt(n),"console.error")}catch(e){}e.apply(console,t)}}catch(e){try{Bt(Vt(e),"error")}catch(e){}}}();const Kt=p("Events bus","Dev",{background:"#0072B5",text:"#ffffff"}),Ht=new f(Kt),Wt=[c.US,c.Tn,c.Ul],qt=e=>{l.F.postToParent(i._W.ListenersChange({event:e,count:Ht.getObserversNumber(e)}))},Xt={EXIT:qt,HISTORY_BACK:qt},Jt=(e,t)=>{Kt(`[on]: {${e}}`);const n=Xt[e],r=Ht.subscribe(e,t);return null==n||n(e),()=>{r(),null==n||n(e)}},zt=(e,t)=>{var n;Kt(`[off]: {${e}}`),Ht.unsubscribe(e,t),null==(n=Xt[e])||n.call(Xt,e)},Qt=(e,t)=>{Kt(`[notifyObservers]: {${e}}`,...t?[t]:[]),Ht.notifyObservers(Array.isArray(e)?e:[e],t)};l.F.onExternalMessage(Wt,(({data:{action:e,data:t}})=>Qt(e,t)));const Zt=p("Gameplay | Child frame","Dev",{background:"#6c5b7b",text:"#ffffff"}),en=e=>{Zt(`[POST]: {${e}}`),l.F.postToParent((0,i.$J)(e))},tn=new Set;let nn=!1;const rn="function"!=typeof Proxy?e=>e:(e,t,n)=>nn?e:new Proxy(e,{get:(e,r)=>("symbol"!=typeof r&&!nn&&t.includes(r)&&tn.add(`${n}.${r}`),e[r])}),an=()=>{nn||(l.F.postToParent((0,i.Iq)(Array.from(tn).join(","))),tn.clear(),nn=!0)};var on;const sn="/helpers/fake-page/1/index.html",cn=Symbol("promises");on=cn;let ln=class e{constructor(){if(this[on]=new Map,e.instance)return e.instance}getAllGames(){const e=this[cn].get("all");if(e)return e;const t=y("getAllGames"),n=new Promise(((e,n)=>l.F.postToParent(i.Rh.All()).then((({data:t})=>{var n;(null==(n=window.YandexGamesSDKEnvironment)?void 0:n.useMockGameLinks)&&(t.games.forEach((e=>e.url=`${sn}`)),t.developerURL=`${sn}`),e(t)})).catch((e=>{this[cn].delete("all"),n(e)})).finally((()=>t()))));return this[cn].set("all",n),n}getGameByID(e){const t=this[cn].get(`${e}`);if(t)return t;const n=y("getGameByID"),r=new Promise(((t,r)=>l.F.postToParent(i.Rh.Game(e)).then((({data:e})=>{var n;(null==(n=window.YandexGamesSDKEnvironment)?void 0:n.useMockGameLinks)&&e.game&&(e.game.url=`${sn}`),t(e)})).catch((t=>{this[cn].delete(`${e}`),r(t)})).finally((()=>n()))));return this[cn].set(`${e}`,r),r}};ln.instance=rn(new ln,["getGameByID","getAllGames"],"GamesAPI");const dn=ln.instance,un=class e{constructor(){this.isReady=!1,this.startTimestamp=Date.now(),this.startReadyFallbackTimeout()}ready(){if(this.isReady)return void console.warn("Don't call %cfeatures.LoadingAPI.ready() %cmore than one time.","color: green","color: unset");this.isReady=!0;const e=Date.now()-this.startTimestamp;this.logGameInitTime(e,c.ur.GameReady),clearTimeout(this.readyFallbackTimerId)}logGameInitTime(e,t){l.F.postToParent((0,i.OI)(t,{timeFromInit:e}))}startReadyFallbackTimeout(){this.readyFallbackTimerId=window.setTimeout((()=>{this.logGameInitTime(e.MAX_TIMEOUT,c.ur.GameReadyForce)}),e.MAX_TIMEOUT)}};un.MAX_TIMEOUT=3e4;let pn=un;var hn;const mn={[c.VR.GameplayAPI]:class{start(){en(c.BE.Start)}stop(){en(c.BE.Stop)}},[c.VR.LoadingAPI]:pn,[c.VR.PluginEngineDataReporterAPI]:class{constructor(){this.isReported=!1}report(e){this.isReported?console.warn("Don't call %cfeatures.PluginEngineDataReporterAPI.report() %cmore than one time.","color: green","color: unset"):(this.logData(e),this.isReported=!0)}logData(e){l.F.postToParent((0,i.Xk)(e))}}};class gn{constructor(e={}){this[hn]=dn;for(let t in c.VR)c.VR[t]in e&&e[c.VR[t]]&&(this[t]=new mn[t]);for(let t of c.Hn)!this[t]&&(t in e&&e[t]||!(t in e))&&(this[t]=new mn[t]);l.F.postToParent((0,i.OI)(c.ur.GameInit))}}c.VR.GameplayAPI,c.VR.LoadingAPI,c.VR.PluginEngineDataReporterAPI,hn=c.VR.GamesAPI;var yn=(e=>(e.GAME_RATED="GAME_RATED",e.NO_AUTH="NO_AUTH",e.REVIEW_ALREADY_REQUESTED="REVIEW_ALREADY_REQUESTED",e.REVIEW_WAS_REQUESTED="REVIEW_WAS_REQUESTED",e.UNKNOWN="UNKNOWN",e))(yn||{});const fn=new class{canReview(){return new Promise((e=>{const t=y("Feedback.canReview");l.F.postToParent(i.E0.CanReview()).then((({data:t})=>{e(t)})).catch((t=>{(0,m.f)(t),e({reason:yn.UNKNOWN,value:!1})})).finally((()=>{t()}))}))}requestReview(){return new Promise((e=>{const t=y("Feedback.requestReview",12e4);l.F.postToParent(i.E0.RequestReview()).then((({data:t})=>{const{feedbackSent:n,reason:r}=t;r?((0,m.f)(r),e({feedbackSent:null!=n&&n})):e({feedbackSent:null==n||n})})).catch((t=>{(0,m.f)(t),e({feedbackSent:!1})})).finally((()=>{t()}))}))}};function vn(e){try{return"WebGLRenderingContext"in window&&Boolean(e.getContext("webgl")||e.getContext("experimental-webgl")instanceof WebGLRenderingContext)}catch(e){(0,m.f)(e,{sourceMethod:"isWebGLSupported",level:"warn"})}return!1}function wn(e){try{return"WebGL2RenderingContext"in window&&Boolean(e.getContext("webgl2")||e.getContext("experimental-webgl2")instanceof WebGL2RenderingContext)}catch(e){(0,m.f)(e,{sourceMethod:"isWebGL2Supported",level:"warn"})}return!1}function bn(){const e=[];return"createUnityInstance"in window&&e.push("unity"),e}function Pn(){const e=[],t={webassembly:"WebAssembly"in window,webgl:vn(document.createElement("canvas")),webgl2:wn(document.createElement("canvas"))};return Object.keys(t).filter((e=>t[e])).forEach((t=>{e.push(t)})),e}var En,Sn=n(514),kn=((En=kn||{}).Finish=`${c.vA}-sessions-finish`,En.Transaction=`${c.vA}-sessions-transaction`,En),Tn=Object.defineProperty,An=Object.getOwnPropertySymbols,On=Object.prototype.hasOwnProperty,In=Object.prototype.propertyIsEnumerable,xn=(e,t,n)=>t in e?Tn(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;const Cn=p("Multiplayer Sessions | Child frame","Dev",{background:"#b55a30",text:"#ffffff"}),Dn=({data:{action:e,data:t}})=>{"transaction"===e?Qt(kn.Transaction,t):"finish"===e&&Qt(kn.Finish,t)};class _n{constructor(){l.F.onExternalMessage(c.vA,Dn)}commit(e){l.F.postToParent(Sn.T.Commit(e))}init(){return e=this,t=arguments,n=function*(e={}){const t=((e,t)=>{for(var n in t||(t={}))On.call(t,n)&&xn(e,n,t[n]);if(An)for(var n of An(t))In.call(t,n)&&xn(e,n,t[n]);return e})({isEventBased:!0},e);return Cn("[init]",t),t.meta&&0===t.count||Cn("[init] NOTE: multiplayer was initialized for recording only: {meta} and {count} parameters were not provided."),(yield l.F.postToParent(Sn.T.Init(t))).data},new Promise(((r,a)=>{var o=e=>{try{i(n.next(e))}catch(e){a(e)}},s=e=>{try{i(n.throw(e))}catch(e){a(e)}},i=e=>e.done?r(e.value):Promise.resolve(e.value).then(o,s);i((n=n.apply(e,t)).next())}));var e,t,n}push(e){l.F.postToParent(Sn.T.Push(e))}}const Ln={allow(){l.F.postToParent((0,i.Al)())}};function Rn(...e){const t=e=>e&&"object"==typeof e;return e.reduce(((e,n)=>(Object.keys(n).forEach((r=>{const a=e[r],o=n[r];Array.isArray(a)&&Array.isArray(o)?e[r]=a.concat(...o):t(a)&&t(o)?e[r]=Rn(a,o):e[r]=o})),e)),{})}function Fn(e,t={}){var n,r,a;return(null==(r=null==(n=window.YandexGamesSDKEnvironment)?void 0:n.request.experiments)?void 0:r.signed)&&(t.signed=!0),function(e){if(!e||"object"!=typeof e)return{};!function(e){"partnerId"in e&&(delete e.partnerId,console.warn("`partnerId` is deprecated in the SDKv2"))}(e)}(t),"object"==typeof(a=t)&&Object.keys(a).forEach((e=>{"signed"!==e&&(0,m.f)(new Error(`Using deprecated key in YaGames.init options: ${e}`))})),function(e={}){return function(e){"adv"in e&&F.sendOnceDeprecatedUsage("SDK init options with adv"),e.adv=e.adv||{},function(e){if("onAdvClose"in e&&"function"!=typeof e.onAdvClose)throw new Error('"onAdvClose" must be a function')}(e.adv)}(e),e}(Rn(null!=e?e:{},t))}const $n=(e={})=>function(e={}){const t=new Oe(e);return new Promise(((e,n)=>{t.getCatalog().then((()=>e(t))).catch(n)}))}(e),Nn=class{constructor(){this.promiseWrappers=Object.create(null)}getKey(e){return JSON.stringify(e)}getFor(e){return this.promiseWrappers[this.getKey(e)]}setFor(e,t){t?this.promiseWrappers[this.getKey(e)]=t:delete this.promiseWrappers[this.getKey(e)]}clear(){this.promiseWrappers=Object.create(null)}},jn=p("PlayerProxy"),Gn=new Nn;function Mn(){return e=this,t=arguments,n=function*(e={}){var t;const n=null==(t=Gn.getFor(e))?void 0:t.promise;if(n)return n;const r=y("getPlayer",12e4),a=new h;return a.promise.finally((()=>{r()})),Gn.setFor(e,a),window.setTimeout((()=>{Gn.setFor(e,void 0)}),3e5),l.F.postToParent((0,i.HT)({config:e})).then((({data:t})=>{const{data:n,signature:r}=t,o=function(e,t,n){const r=new Ve(t,e);return oe(r,n),rn(r,["getPayingStatus","getStats","getData","getName"],"Player")}(e,n,r);a.resolve(o)})).catch((t=>{Gn.setFor(e,void 0),a.reject(t)})),a.promise},new Promise(((r,a)=>{var o=e=>{try{i(n.next(e))}catch(e){a(e)}},s=e=>{try{i(n.throw(e))}catch(e){a(e)}},i=e=>e.done?r(e.value):Promise.resolve(e.value).then(o,s);i((n=n.apply(e,t)).next())}));var e,t,n}l.F.onExternalMessage("auth",(e=>{["auth-dialog-cancel","auth-dialog-success","changed"].includes(e.data.action)&&(jn("Clear getPlayer promises."),Gn.clear())}));class Un{constructor(){this.onMessage=e=>{const{action:t}=e.data;"fullscreenchange"===t&&(document.dispatchEvent(new Event("fullscreenchange")),this._status=e.data.data.isFullscreen?"on":"off")},this._status="off",this.overrideBrowserFullscreenElement(),this.initMessaging(),this.updateStatus()}get STATUS_ON(){return"on"}get STATUS_OFF(){return"off"}get status(){return this._status}request(){const e=y("FullscreenManager.request"),t=l.F.postToParent(i.Vo.RequestFullscreen());return t.finally((()=>{e()})),t}exit(){const e=y("FullscreenManager.exit"),t=l.F.postToParent(i.Vo.ExitFullscreen());return t.finally((()=>{e()})),t}toggle(){const e=y("FullscreenManager.toggle"),t=l.F.postToParent(i.Vo.ToggleFullscreen());return t.finally((()=>{e()})),t}updateStatus(){l.F.postToParent(i.Vo.GetState()).then((e=>{const{isFullscreen:t}=e.data;this._status=t?"on":"off"}))}overrideBrowserFullscreenElement(){try{Object.getOwnPropertyDescriptor(document,"fullscreenElement")||Object.defineProperty(document,"fullscreenElement",{enumerable:!1,configurable:!0,get:()=>this.status===this.STATUS_ON?document.documentElement:null})}catch(e){(0,m.f)(e)}}initMessaging(){l.F.onExternalMessage("screen-manager",this.onMessage)}}class Bn{constructor(){this.fullscreen=new Un}}var Vn=n(992);const Yn=Date.now(),Kn=`id_cursorHighlighter_${Yn}`,Hn=`cursorHighlighter_${Yn}`,Wn=`active_${Yn}`,qn={[c.q1.EXIT]:!0},Xn=["passport.ya","passport.yandex","an.yandex.ru","avatars.mds.yandex.net","/api/"];function Jn(e){const t=Cache.prototype[e];Cache.prototype[e]=function(e,n){return"GET"!==e.method||0!==e.url.indexOf("https://")||(r=e.url,Xn.some((e=>-1!==r.indexOf(e))))?Promise.resolve():("ignoreSearch"in(n=n||{})||(n.ignoreSearch=!0),t.call(this,e,n));var r}}const zn=class{static overrideCacheSearch(){("function"!=typeof Cache?(console.warn("Can not find `Cache` function"),0):"function"!=typeof Cache.prototype.match?(console.warn("Can not find `Cache.match` function"),0):"function"==typeof Cache.prototype.matchAll||(console.warn("Can not find `Cache.matchAll` function"),0))&&(Jn("match"),Jn("matchAll"))}},Qn=new class{canShowPrompt(){return new Promise((e=>{const t=y("Shortcut.canShowPrompt");l.F.postToParent(i.lW.CanShowPrompt()).then((({data:t})=>{e(t)})).catch((e=>{(0,m.f)(e)})).finally((()=>{t()}))}))}showPrompt(){return new Promise((e=>{const t=y("Shortcut.showPrompt",12e4);l.F.postToParent(i.lW.ShowPrompt()).then((({data:t})=>{e(t)})).catch((e=>{(0,m.f)(e)})).finally((()=>{t()}))}))}};function Zn(){return new Promise((e=>{if("loading"===document.readyState){const t=()=>{"loading"!==document.readyState&&(document.removeEventListener("readystatechange",t),e())};document.addEventListener("readystatechange",t)}else e()}))}const er=new Nn;function tr(e={}){const{clientFeatures:t=[],defaultFlags:n={}}=e,r=er.getFor(e);if(r)return r.promise;const a=y("get_flags/fetch"),o=new h;return o.promise.finally((()=>{a()})),er.setFor(e,o),l.F.postToParent(i.XT.Fetch({clientFeatures:t})).then((({data:e})=>{const t=Object.assign(n,e);o.resolve(t)})).catch((()=>{o.resolve(n),er.setFor(e,void 0)})),o.promise}class nr{reachGoal(e,t,n){l.F.postToParent(i.eU.ReachGoal({counterId:e,target:t,goalData:n}))}hit(e,t={}){l.F.postToParent(i.eU.Hit({counterId:e,hitData:t}))}}var rr=(e,t,n)=>new Promise(((r,a)=>{var o=e=>{try{i(n.next(e))}catch(e){a(e)}},s=e=>{try{i(n.throw(e))}catch(e){a(e)}},i=e=>e.done?r(e.value):Promise.resolve(e.value).then(o,s);i((n=n.apply(e,t)).next())}));const ar=p("sdkv2");!function(){var e;if(I())Pt("alert hook disabled");else try{"function"==typeof window.alert&&(e=window.alert,window.alert=function(){const t=arguments[0];return Pt(`alert message = ${t}`),l.F.postToParent((0,i.Bz)({message:t.substring(0,250)})),e.apply(this,arguments)}),window.addEventListener("load",St,{once:!0}),Pt("alert hook enabled")}catch(e){(0,m.f)(e,{prefix:"game_hook_alert exp error: ",level:"warn"})}}();const or=rr(void 0,null,(function*(){return function({staticOrigin:n,version:r,logError:s}){if(window.loadPolyfillsPromise)return window.loadPolyfillsPromise;let i=[[e.LEGACY,Boolean(Array.prototype.at)],[e.INTERSECTION_OBSERVER,Boolean("IntersectionObserver"in window&&"IntersectionObserverEntry"in window&&"intersectionRatio"in window.IntersectionObserverEntry.prototype)],[e.SMOOTH_SCROLL,Boolean("scrollBehavior"in document.documentElement.style)],[e.ABORT_CONTROLLER,"undefined"!=typeof AbortController],[e.GLOBAL_THIS,"object"==typeof globalThis]].filter((([,e])=>!e));return window.loadPolyfillsPromise=new Promise(((e,o)=>{i.length?document.head.appendChild(t({id:"loadPolyfillHash",src:a(n,`stats-hash.js?v=${r||(new Date).setUTCHours(12,0,0,0)}`),onErrCb:o,onLoadCb:e})):e()})).then((()=>Promise.all(i.map((([e])=>new Promise(((r,a)=>{document.head.appendChild(t({id:e,src:o(n,e),onErrCb:a,onLoadCb:r}))}))))))).catch((e=>{s({block:"Polyfill",message:"Error while loading polyfills",additional:{error:e}})})),window.loadPolyfillsPromise}({staticOrigin:"//yastatic.net/s3/games-static/_/build",logError:(e,t)=>(0,m.f)(t,e)})})).then((()=>{(()=>{if(window.top!==window)return;const{hash:e,hostname:t,search:n}=window.location;if(!/(games\.s3\.yandex\.net|games-storage(-awst?)?\.yandex\.net)$/.test(t))return;const r=(0,Ee.o)();if(!r)return;let a;a=/games\.s3\.yandex\.net$/.test(t)?`https://yandex.ru/games/app/${r}${n}${e}`:`https://yandex.com/games/app/${r}${n}${e}`,window.top.location.replace(a)})(),l.F.postToParent((0,i.Ry)({url:location.href,draftDetectedInIframe:I()})),window.loadEnvironmentPromise=window.loadEnvironmentPromise||new Promise(((e,t)=>{const n=y("loadEnvironment");l.F.postToParent((0,i.VT)()).then((({data:t})=>{j.sdkBackendURL=String(t.enviroment.sdkBackendURL),Object.freeze(j),delete t.enviroment.sdkBackendURL,e(t)})).catch((e=>{t(e)})).finally((()=>{n()}))})).then((e=>{const t=!("enviroment"in e&&"options"in e),n=t?e:e.enviroment;return window.YandexGamesSDKEnvironment=n,ar("APP_VERSION",n.APP_VERSION),!t&&e.options})),function(){const e=s((()=>l.F.postToParent((0,i.Vw)())),2e3);["click","keydown","keyup","mousedown","mouseenter","mouseleave","mouseup","pointerup","touchcancel","touchend","touchmove","touchstart"].forEach((t=>document.addEventListener(t,e,{passive:!0,capture:!0})))}()}));let sr,ir;class cr{constructor(e){var t,n;e=Fn(e),this.EVENTS={BONUS_AWARDED:c.q1.BONUS_AWARDED,EXIT:c.q1.EXIT,HISTORY_BACK:c.q1.HISTORY_BACK},this.dispatchEvent=function(e,t){const n=y("getSdkEventsDispatcher");return new Promise(((r,a)=>{if(!(e in qn)){const t=`Yandex SDK Event ${e} is not in supported.`;return console.warn(t),void a(new Error(t))}const o={};if(void 0!==t)try{o.detail=JSON.stringify(t)}catch(e){return console.warn(e),void a(new Error('Wrong "detail" argument'))}l.F.postToParent((0,i.TI)(e,o)).then((()=>{r(!0)})).catch((e=>{a(e)})).finally((()=>{n()}))}))},this.onEvent=(e,t)=>(console.warn("Deprecated usage of `ysdk.onEvent`, please use `ysdk.on(...)` instead."),Jt(e,t)),this.achievements=P.init(),this.adv=rn(new D(e),["showBannerAdv"],"AdvManager"),this.analytics={yaMetrikaCounter:rn(new nr,["hit","reachGoal"],"YaMetrikaCounter")},this.auth=_,this.bonuses=bt.init(e.signed),this.clipboard=kt,this.deviceInfo=new Tt(e.deviceType),dr.deviceInfo=this.deviceInfo,this.environment=(e=>{if(!new URLSearchParams(location.search).get("debug-mode")||"function"!=typeof Proxy)return e;const t=Object.assign({},e);return Object.defineProperty(t,"i18n",{get(){const t=e.i18n;return new Proxy(t,{get:(e,t)=>("lang"===t&&l.F.postToParent(De.i.I18n()),e[t])})}}),t})(Ce),this.feedback=fn,this.isAvailableMethod=(n=this,e=>{const t=y("isAvailableMethod"),r=l.F.postToParent(i.sC.CheckAvailability({methodToVerify:e})).then((({data:t})=>{const{isAvailable:r}=t;if(!r)return!1;const a={leaderboards:re,payments:Oe,player:Ve,storage:Ze.getCustomLocalStorage()},o=e.split(".");let s=st(st({},a),n);for(let e=0;e{t()})),r}),this.shortcut=Qn,this.getLeaderboards=ae,this.getPayments=$n,this.getPlayer=Mn,this.getStorage=et,this.multiplayer=(e=>{var t;if(!(null!=(t=null==e?void 0:e.whitelist)?t:[]).includes((0,Ee.o)()))return;const n=new _n;return{get sessions(){return n}}})(e.multiplayer),this.notifications=Ln,this.screen=new Bn,this.features=rn(new gn(e.features),[c.VR.GameplayAPI,c.VR.LoadingAPI],"FeatureManager"),this.yandexApp={enabled:Boolean(null==(t=window.YandexGamesSDKEnvironment)?void 0:t.isYandexApp)},this.serverTime=function(){var e,t;const n=performance.timeOrigin||Date.now(),r=(null==(e=window.YandexGamesSDKEnvironment)?void 0:e.serverTime)||n,a=(null==(t=window.YandexGamesSDKEnvironment)?void 0:t.parentTimeOrigin)||n,o=(performance.timeOrigin||n)-a,s=performance.now.bind(performance);return()=>new Date(r+o+s()).valueOf()}(),this.getFlags=tr,this.dispatch=Qt,this.on=Jt,this.off=zt}}function lr(e){if("complete"===document.readyState)e();else{const t=()=>{e(),window.removeEventListener("load",t)};window.addEventListener("load",t)}}try{ir=new URLSearchParams(location.hash.slice(1)).get("device-type")}catch(e){}class dr{constructor(){throw new Error("Please, use `YaGames.init` instead.")}static longtaskObserver(){var e;const t="longtask";if("undefined"!=typeof PerformanceObserver&&(null==(e=PerformanceObserver.supportedEntryTypes)?void 0:e.includes(t))){let e;const n=()=>{clearTimeout(e),e=setTimeout((()=>{"complete"===document.readyState?r.disconnect():n()}),5e3)},r=new PerformanceObserver((e=>{e.getEntries().forEach((()=>{l.F.postToParent((0,i.jt)()),n()}))}));r.observe({entryTypes:[t]})}"complete"===document.readyState?l.F.postToParent((0,i.X0)()):window.addEventListener("load",(()=>{l.F.postToParent((0,i.X0)())}))}static init(e){return rr(this,null,(function*(){let t=location.hash;try{const e=yield rr(void 0,null,(function*(){let e;try{e=yield(t=function*(){return new Promise(((e,t)=>{const n=`${Date.now()}-${Math.random()}`,r=setTimeout((()=>{t(new Error("Get external iframe timeout"))}),500);window.addEventListener("message",(function t(a){const{data:o}=function(e){try{return{data:JSON.parse(e),error:null}}catch(e){return{data:null,error:e}}}(a.data);o&&o.messageId===n&&(window.removeEventListener("message",t),clearTimeout(r),e(o.payload))})),window.parent.postMessage(JSON.stringify({source:"YandexGamesSDK",actionName:"GET_IFRAME_ORIGIN_SRC",channel:"EARLY_SDK_EVENT",messageId:n}),"*")}))},new Promise(((e,n)=>{var r=e=>{try{o(t.next(e))}catch(e){n(e)}},a=e=>{try{o(t.throw(e))}catch(e){n(e)}},o=t=>t.done?e(t.value):Promise.resolve(t.value).then(r,a);o((t=t.apply(void 0,null)).next())})))}catch(e){console.warn("Error get IFrameURL",e)}var t;return new URL(e||location.href)}));t=new URL(e).hash}catch(e){}return sr?(console.warn("YaGames was initialized"),sr):(this.longtaskObserver(),ar("Start initialization"),yield or,sr=new Promise(((n,r)=>{!function(){const e=()=>{l.F.postToParent((0,i.Sd)()),window.removeEventListener("load",e)};"complete"===document.readyState?e():window.addEventListener("load",e)}();const a=a=>{try{let r=Fn(a,e);if(!r.deviceType)try{r.deviceType=new URLSearchParams(t.slice(1)).get("device-type")}catch(e){(0,m.f)(e,{message:"No deviceType in options"})}Zn().then((()=>{const e=new cr(r);e.environment.isTelegram&&W("loading",{value:100}),r.hasAuth&&e.getPlayer({scopes:!1}),window.setTimeout(an,6e4),n(rn(e,["auth","getFlags","getLeaderboards","getPayments","getStorage","serverTime"],"SDK")),function(){if(!new URLSearchParams(location.search).get("debug-mode"))return;const e=e=>{const{altKey:t,code:n,ctrlKey:r,key:a,metaKey:o,shiftKey:s}=e;l.F.postToParent(Vn.C.Keydown({keydown:{altKey:t,code:n,ctrlKey:r,key:a,metaKey:o,shiftKey:s}}))},{startHighlighting:t,stopHighlighting:n}=(e=>{let t;e||(()=>{if(document.head.querySelector(`#${Kn}`))return;const e=document.createElement("style");e.id=Kn,e.innerHTML=`\n .${Hn} {\n position: absolute;\n z-index: 1000;\n\n display: none;\n\n width: 16px;\n height: 16px;\n\n pointer-events: none;\n\n border-width: 3px;\n border-style: solid;\n border-radius: 50%;\n\n transform: translate(-50%, -50%);\n }\n\n .${Hn}.${Wn} {\n display: initial;\n }\n\n .${Hn}[data-button="0"] {\n border-color: #ff0000;\n }\n\n .${Hn}[data-button="1"] {\n border-color: #00ff00;\n }\n\n .${Hn}[data-button="2"] {\n border-color: #5641ff;\n }\n `,document.head.appendChild(e)})();let n,r,a,o=!1;const s=document.createElement("div"),{activeClass:i=Wn,mainClass:c=Hn}=null!=e?e:{};s.classList.add(c),document.body.appendChild(s);const l=(e,t)=>{r=e,a=t,n||(n=requestAnimationFrame((()=>{n=0,s.style.left=`${r}px`,s.style.top=`${a}px`})))},d=({button:e,pageX:n,pageY:r})=>{clearTimeout(t),o=!0,s.classList.add(i),s.dataset.button=String(e),l(n,r)},u=({pageX:e,pageY:t})=>{o&&l(e,t)},p=()=>{t=setTimeout((()=>s.classList.remove(i)),250),o=!1};return{startHighlighting:()=>{document.addEventListener("mousedown",d),document.addEventListener("mousemove",u),document.addEventListener("mouseup",p),document.addEventListener("onblur",p)},stopHighlighting:()=>{document.removeEventListener("mousedown",d),document.removeEventListener("mousemove",u),document.removeEventListener("mouseup",p),document.removeEventListener("onblur",p),s.classList.remove(i)}}})();l.F.onExternalMessage(c.cV,(({data:{action:r}})=>{switch(r){case"start":t(),document.addEventListener("keydown",e);break;case"stop":n(),document.removeEventListener("keydown",e)}}))}()}))}catch(e){(0,m.f)(e),r(e)}};window.loadEnvironmentPromise.then((e=>{e?a(e):new Promise(((e,t)=>{const n=y("loadOptions");l.F.postToParent((0,i.Gd)()).then((({data:t})=>{e(t)})).catch((e=>{t(e)})).finally((()=>{n()}))})).then(a).catch((e=>{console.warn(`Options load failed with error ${e}`),a()}))})).catch((e=>{(0,m.f)(e),a()})),setTimeout((()=>{const e={clientTech:Pn(),gameTech:bn()};ar("checkAndSendGameInfo tech data:",e),lr((()=>{l.F.postToParent((0,i.cp)(e))}))}),1e4)})),sr.then((()=>ar("Initialized"))),sr)}))}}if(dr.deviceInfo=new Tt(ir),window.YaGames&&window.YaGamesAdded){const e='YaGames is already defined. Please, check double