@vkontakte/superappkit
Advanced tools
Comparing version 1.27.0-alpha.5 to 1.27.0-beta.1.0
import { AuthCaptchaEventsSDK, ButtonOneTapAuthEventsSDK, DataPolicyEventsSDK, FloatingOneTapAuthEventsSDK, OneTapAuthEventsSDK, PolicyAgreementsEventsSDK } from '#/connect/events'; | ||
import { URLParams } from '#/common/utils'; | ||
import { ButtonOneTapSkin } from '#/connect/utils'; | ||
declare interface ExternalUser { | ||
@@ -112,2 +113,3 @@ id?: string; | ||
displayMode?: ButtonOneTapAuthDisplayModes; | ||
buttonSkin?: ButtonOneTapSkin; | ||
}; | ||
@@ -114,0 +116,0 @@ export declare type AuthButtonType = 'floating' | 'button'; |
@@ -13,3 +13,7 @@ import { AuthAction, AdaptivitySwitchObserver, VKOneTapAuthOptions, ButtonOneTapAuthOptions } from '#/connect/types'; | ||
} | ||
export declare enum ButtonOneTapSkin { | ||
Primary = "primary", | ||
Flat = "flat" | ||
} | ||
export declare function getButtonOneTapAuthOptions(options: ButtonOneTapAuthOptions): VKOneTapAuthOptions; | ||
export declare function filterObjectKeys(obj: any, filterKeys: string[]): any; |
@@ -1,1 +0,1 @@ | ||
"use strict";function e(n){return(e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(n)}function n(n){return n&&"object"===e(n)&&"default"in n?n.default:n}Object.defineProperty(exports,"__esModule",{value:!0});var t=n(require("@babel/runtime/helpers/typeof"));require("@babel/runtime/helpers/toConsumableArray");var o=n(require("@babel/runtime/helpers/defineProperty"));function i(e){return(i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function r(e,n){if(!(e instanceof n))throw new TypeError("Cannot call a class as a function")}function a(e,n){for(var t=0;t<n.length;t++){var o=n[t];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}function s(e,n,t){return n&&a(e.prototype,n),t&&a(e,t),e}function c(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function p(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);n&&(o=o.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,o)}return t}function u(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?p(Object(t),!0).forEach((function(n){c(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):p(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}require("@babel/runtime/helpers/classCallCheck"),require("@babel/runtime/helpers/createClass");var d,l="ModuleSymbhasOwnPr-0123456789ABCDEFGHNRVfgctiUvz_KqYTJkLxpZXIjQW",h=function(){for(var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:21,n="",t=e;t--;)n+=l[64*Math.random()|0];return n},f=["agreements","promo","vkc_behavior","vkc_auth_action","vkc_brand","vkc_display_mode","service_groups","external_device_id"];!function(e){e[e.UNKNOWN=1]="UNKNOWN",e[e.MISSING_PARAM=2]="MISSING_PARAM",e[e.CONNECTION_LOST=3]="CONNECTION_LOST",e[e.USER_DENIED=4]="USER_DENIED",e[e.INVALID_PARAMS=5]="INVALID_PARAMS",e[e.CUSTOM=6]="CUSTOM",e[e.CONNECT_WINDOW_CLOSED=7]="CONNECT_WINDOW_CLOSED",e[e.CONNECT_WINDOW_NOT_OPENED=8]="CONNECT_WINDOW_NOT_OPENED",e[e.CONNECT_DOMAIN_NOT_ALLOWED=9]="CONNECT_DOMAIN_NOT_ALLOWED",e[e.CONNECT_UNKNOWN_SDK_MESSAGE=10]="CONNECT_UNKNOWN_SDK_MESSAGE",e[e.OLD_MISSING_PARAM=100]="OLD_MISSING_PARAM"}(d||(d={}));var m=function(){return"Connect window was closed."},v=function(){return"Connect window was not opened."},y=function(e){return'URL domain "'.concat(e,'" is not allowed.')},A=function(e){return"This SDK message is unknown: ".concat(e)},g=!("undefined"==typeof window||!window.document||!window.document.createElement),E=g&&!!window.addEventListener,O=function(){};if(E)try{var _=Object.defineProperty({},"passive",{get:function(){!0}});window.addEventListener("test",O,_),window.removeEventListener("test",O,_)}catch(e){}!function(){if(!g)return!1;var e=!1;try{document.createElement("div").scrollTo({top:0,get behavior(){return e=!0,"smooth"}})}catch(e){}}();function w(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);n&&(o=o.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,o)}return t}function S(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?w(Object(t),!0).forEach((function(n){o(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):w(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}var T={parse:function(e){if("string"!=typeof e)return{};if(!(e=e.trim().replace(/^[?#&]/,"")))return{};var n=/\?(.+)$/gi.exec(e);return(n?n[1]:e).split("&").reduce((function(e,n){var t=n.split("=");return t[1]&&(e[t[0]]=decodeURIComponent(t[1])),e}),{})},stringify:function(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if("object"!==t(e)||null===e)return"";n=S({encode:!0},n);var o=function(e){return n.encode?encodeURIComponent(e):String(e)};return Object.keys(e).reduce((function(t,i){var r=e[i];return void 0===r?t:null===r?(n.skipNull||t.push([o(i),""].join("=")),t):Array.isArray(r)?(r.map((function(e){t.push("".concat(o(i),"[]=").concat(o(e)))})).join(),t):(t.push([o(i),o(r)].join("=")),t)}),[]).join("&")}};function b(e){return T.stringify(e)}function D(e){return Object.keys(e).filter((function(e){return f.includes(e)}))}function P(e){var n;return Boolean(null===(n=D(e))||void 0===n?void 0:n.length)}function C(e){var n=function(e){return D(e).reduce((function(n,t){return n[t]=e[t],n}),{})}(e);return btoa(JSON.stringify(n))}function k(e,n){var t,o=document.createElement("iframe");for(var i in e&&(o.src=e),o.style.cssText=null!==(t=null==n?void 0:n.cssText)&&void 0!==t?t:"",o.width="100%",o.height="100%",o.style.border="none",null==n?void 0:n.properties){var r;if(n&&n.properties.hasOwnProperty(i))o[i]=null!==(r=n.properties[i])&&void 0!==r?r:""}return o}function N(e){return e=e||Object.create(null),{on:function(n,t){(e[n]||(e[n]=[])).push(t)},off:function(n,t){e[n]&&e[n].splice(e[n].indexOf(t)>>>0,1)},emit:function(n,t){(e[n]||[]).slice().map((function(e){e(t)})),(e["*"]||[]).slice().map((function(e){e(n,t)}))}}}var M={appId:0,superAppToken:"",loginDomain:"login.vk.com",oauthDomain:"oauth.vk.com",connectDomain:"connect.vk.com",_debug:!1},I={},K={events:N(),init:function(e){if(!e.appId)throw new Error("appId required");M.appId=e.appId,M.superAppToken=e.superAppToken||"",M.loginDomain=e.loginDomain||"login.vk.com",M.oauthDomain=e.oauthDomain||"oauth.vk.com",M.connectDomain=e.connectDomain||"connect.vk.com",M.appSettings=e.appSettings,M._debug=!!e._debug},get:function(){return M},setSuperAppToken:function(e){M.superAppToken=e,K.events.emit("superAppToken",e)},onRequestSuperAppToken:function(e){I.superAppToken=e},_requestSuperAppToken:function(){var e;I.superAppToken&&(e=I.superAppToken()),e&&e.then((function(e){return K.setSuperAppToken(e)})).catch(console.error)},onAuth:function(e){I.auth=e},_requestAuth:function(){var e;I.auth&&(e=I.auth()),e&&e.then((function(e){return K.setSuperAppToken(e)})).catch(console.error)},onOpenApp:function(e){I.openApp=e},_openApp:function(e){I.openApp&&I.openApp(e.app)}},R=["extend_token","login_with_user","__sferum_invite_link"];function L(e){return e&&R.includes(e.name)?btoa(JSON.stringify(e)):""}var x;function H(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"auth",t=K.get(),o=t.appId,i=t.connectDomain,r=t.appSettings,a=u({app_id:o,response_type:"silent_token",v:"0.0.2"},e);r&&P(r)&&(a.app_settings=C(r));var s=b(a);return"https://".concat(i,"/").concat(n,"?").concat(s)}!function(e){e.Default="default",e.NamePhone="name_phone",e.PhoneName="phone_name"}(x||(x={}));var V=[x.Default,x.NamePhone,x.PhoneName];function U(e,n){return void 0===e?n:"number"!=typeof e?e?1:0:e}function W(e,n){return e&&"object"===i(e)?Object.keys(e).reduce((function(t,o){return n.includes(o)?(t[o]=e[o],t):t}),{}):e}var G,j,Y,F,z,q,B=function e(n){var t=this;r(this,e),c(this,"handler",(function(){return{}})),c(this,"config",void 0),c(this,"destroy",(function(){delete t.config,window.removeEventListener("message",t.handleMessage)})),c(this,"onMessage",(function(e){t.handler=e})),c(this,"sendMessage",(function(e){t.config.iframe.contentWindow.postMessage(u({type:"vk-sak-sdk"},e),t.config.origin)})),c(this,"handleMessage",(function(e){t.config.origin&&e.origin===t.config.origin&&e.source===t.config.iframe.contentWindow&&e.data&&"vk-sak-sdk"===e.data.type&&t.handler(e.data)})),this.config=n,window.addEventListener("message",this.handleMessage)};!function(e){e.SHOW_DATA_POLICY="VKSDKOneTapAuthConnectDataPolicy",e.HIDE_DATA_POLICY="VKSDKOneTapAuthDataPolicyClose",e.DATA_POLICY_RESULT="VKSDKOneTapAuthDataPolicyResult",e.SHOW_CAPTCHA="VKSDKOneTapAuthDataPolicyShowCaptcha"}(G||(G={})),function(e){e.SHOW_POLICY_AGREEMENTS="VKSDKOneTapAuthPolicyAgreementsShow",e.HIDE_POLICY_AGREEMENTS="VKSDKOneTapAuthPolicyAgreementsHide",e.ACCEPT_POLICY_AGREEMENTS="VKSDKOneTapAuthPolicyAgreementsAccept",e.DECLINE_POLICY_AGREEMENTS="VKSDKOneTapAuthPolicyAgreementsDecline",e.POLICY_AGREEMENTS_ERROR="VKSDKOneTapAuthPolicyAgreementsError",e.SHOW_DATA_POLICY="VKSDKOneTapAuthPolicyAgreementsShowDataPolicy"}(j||(j={})),function(e){e.CAPTCHA_SUCCESS="VKSDKAuthCaptchaSuccess",e.CAPTCHA_FAIL="VKSDKAuthCaptchaFail"}(Y||(Y={})),function(e){e.PHONE_VALIDATION_NEEDED="VKSDKOneTapAuthPhoneValidationNeeded",e.FULL_AUTH_NEEDED="VKSDKOneTapAuthFullAuthNeeded",e.AUTH_DATA_LOADED="VKSDKOneTapAuthDataLoaded",e.NOT_AUTHORIZED="VKSDKOneTapAuthNotAuthorized",e.LOGIN_SUCCESS="VKSDKOneTapAuthLoginSuccess",e.RESIZE_FRAME="VKSDKOneTapResizeFrame",e.SHOW_CAPTCHA="VKSDKOneTapShowCaptcha",e.VALIDATE_CAPTCHA="VKSDKOneTapValidateCaptcha"}(F||(F={})),function(e){e.CLOSE_AUTH="VKSDKOneTapAuthClose",e.ADAPTIVITY_CHANGE="VKSDKFloatingOneTapAdaptivityChange",e.ADAPTIVITY_CHANGED="VKSDKFloatingOneTapAdaptivityChanged"}(z||(z={})),function(e){e.SHOW_LOGIN="VKSDKButtonOneTapAuthShowLogin",e.SHOW_LOGIN_OPTIONS="VKSDKButtonOneTapAuthShowLoginOptions",e.SHOW_AGREEMENTS_DIALOG="VKSDKButtonOneTapAuthShowAgreementsDialog",e.START_AUTHORIZE="VKSDKButtonOneTapAuthStartAuthorize"}(q||(q={}));var Z,J,X,Q=new function e(){var n=this;r(this,e),c(this,"flags",null),c(this,"silentAuth",(function(){var e=K.get(),n=e.loginDomain,t=e.appId,o=h(),i="https://".concat(n,"/?act=connect&app_id=").concat(t,"&response_type=").concat("silent_token","&uuid=").concat(o,"&v=").concat("0.0.2"),r=new XMLHttpRequest;return r.open("GET",i,!0),r.responseType="json",r.withCredentials=!0,new Promise((function(e,n){r.onload=function(){r.response?e({provider:"vk",payload:r.response}):n()},r.onerror=function(){n()},r.send()}))})),c(this,"oneTapAuth",(function(e,t){if(console.warn("Connect.oneTapAuth method is deprecated. Use Connect.floatingOneTapAuth and Connect.buttonOneTapAuth methods."),!["floating","button"].includes(e))return null;switch(e){case"button":return n.buttonOneTapAuth(t);case"floating":return n.floatingOneTapAuth(t);default:return null}})),c(this,"floatingOneTapAuth",(function(e){var t,o,i=function(){var e,n=window.innerWidth,t=n<=768;return{destroy:function(){return window.removeEventListener("resize",e)},isAdaptive:function(){return t},observe:function(o){e=function(){var e=window.innerWidth;n>768&&e<=768?o(t=!0):n<=768&&e>768&&o(t=!1),n=e},window.addEventListener("resize",e)}}}(),r=(t=i.isAdaptive(),o=t?"314px":"334px",{pageUrl:"floating_one_tap_auth",pageUrlParams:{adaptive:t?1:0},frameStyles:t?"\n display: none;\n position: fixed;\n bottom: 0;\n right: 50%;\n transform: translate(50%, 0);\n max-width: 468px;\n width: 100%;\n height: ".concat(o,";\n "):"\n display: none;\n position: fixed;\n top: 0;\n right: 0;\n max-width: 400px;\n width: 100%;\n height: ".concat(o,";\n ")});if(!r)throw new Error("options were not set");var a=h(),s=k(H(u({origin:location.protocol+"//"+location.host,uuid:a},r.pageUrlParams),r.pageUrl),{cssText:r.frameStyles}),c=new B({iframe:s,origin:"https://"+K.get().connectDomain});i.observe((function(e){c.sendMessage({handler:z.ADAPTIVITY_CHANGE,params:{uuid:a,is_adaptive:e}}),e?(s.style.maxWidth="468px",s.style.top="auto",s.style.bottom="0",s.style.right="50%",s.style.transform="translate(50%, 0)"):(s.style.maxWidth="400px",s.style.top="0",s.style.bottom="auto",s.style.right="0",s.style.transform="none"),s.style.display="none"})),document.body.appendChild(s);var p=function(){c.sendMessage({handler:F.RESIZE_FRAME,params:{uuid:a}})};window.addEventListener("resize",p);var d=function(){s&&(s.remove(),s=null),window.removeEventListener("resize",p),i&&i.destroy(),c.destroy()},l=new Promise((function(t){c.onMessage((function(o){if(o.params.uuid===a)switch(o.handler){case F.NOT_AUTHORIZED:e.callback({type:o.handler,payload:{uuid:a,error:"not_authorized"}}),d(),t(o.handler);break;case F.RESIZE_FRAME:s.style.height="".concat(o.params.height,"px");break;case z.CLOSE_AUTH:e.callback({type:o.handler,payload:{uuid:a}}),d();break;case z.ADAPTIVITY_CHANGED:s.style.display="block";break;case F.AUTH_DATA_LOADED:s.style.display="block",t(o.handler);default:n.handleOneTapEvents(o,c,e)}}))}));return{getFrame:function(){return s},destroy:d,authReadyPromise:l}})),c(this,"buttonOneTapAuth",(function(e){var t=function(e){var n={},t=44;if(e){n.display=e.displayMode&&V.includes(e.displayMode)?e.displayMode:"default",n.show_agreements=U(e.showAgreements,0),n.show_alternative_login=U(e.showAlternativeLogin,0),n.show_agreements_dialog=U(e.showAgreementsDialog,1);t+=n.show_alternative_login?56:0,t+=n.show_agreements?80:0}return{pageUrl:"button_one_tap_auth",pageUrlParams:n,frameStyles:"\n height: ".concat(t,"px;\n ")}}(e.options);if(!t)throw new Error("options were not set");var o=h(),i=k(H(u({origin:location.protocol+"//"+location.host,uuid:o},t.pageUrlParams),t.pageUrl),{cssText:t.frameStyles}),r=e.container;r&&r.appendChild(i);var a=new B({iframe:i,origin:"https://"+K.get().connectDomain}),s=function(){a.sendMessage({handler:F.RESIZE_FRAME,params:{uuid:o}})};window.addEventListener("resize",s);return{getFrame:function(){return i},destroy:function(){i&&(i.remove(),i=null),window.removeEventListener("resize",s),a.destroy()},authReadyPromise:new Promise((function(t){a.onMessage((function(r){if(r.params.uuid===o)switch(r.handler){case F.RESIZE_FRAME:i.style.height="".concat(r.params.height,"px");break;case F.NOT_AUTHORIZED:t(r.handler);break;case q.SHOW_LOGIN:case q.SHOW_LOGIN_OPTIONS:e.callback({type:r.handler,payload:{uuid:o}});break;case q.SHOW_AGREEMENTS_DIALOG:n.userPolicyAgreements(o).show().then((function(e){e&&e.accepted&&a.sendMessage({handler:q.START_AUTHORIZE,params:{uuid:o}})})).catch((function(){a.sendMessage({handler:j.DECLINE_POLICY_AGREEMENTS,params:{uuid:o}})}));break;case F.AUTH_DATA_LOADED:t(r.handler);default:n.handleOneTapEvents(r,a,e)}}))}))}})),c(this,"handleOneTapEvents",(function(e,t,o){var i=e.params.uuid;switch(e.handler){case F.AUTH_DATA_LOADED:t.sendMessage({handler:F.RESIZE_FRAME,params:{uuid:i}});break;case F.LOGIN_SUCCESS:o.callback({type:e.handler,provider:"vk",payload:e.params});break;case F.SHOW_CAPTCHA:var r=n.captcha(i,{captcha_sid:e.params.captcha_sid,captcha_img:e.params.captcha_img});r.show().then((function(e){t.sendMessage({handler:Y.CAPTCHA_SUCCESS,params:u({uuid:i},e)})})).catch((function(){t.sendMessage({handler:Y.CAPTCHA_FAIL,params:{uuid:i}}),r.destroy()}));break;case G.SHOW_DATA_POLICY:n.userDataPolicy(i).show().then((function(){o.callback({type:G.DATA_POLICY_RESULT,payload:{uuid:i,policyAccepted:!0}})})).catch((function(){o.callback({type:G.DATA_POLICY_RESULT,payload:{uuid:i,policyAccepted:!1}})}));break;case F.FULL_AUTH_NEEDED:case F.PHONE_VALIDATION_NEEDED:o.callback({type:e.handler,payload:{uuid:i}})}})),c(this,"userDataPolicy",(function(e){var t=H({origin:location.protocol+"//"+location.host,uuid:e},"user_data_policy"),o=window.innerHeight,i="\n display: none;\n position: fixed;\n top: 0;\n left: 0;\n width: 100%;\n height: ".concat(o,"px;\n min-height: ").concat(o,"px;\n border: none;\n z-index: 99999;\n "),r=k(t,{properties:{height:"".concat(o,"px")},cssText:i});document.body.appendChild(r);var a=new B({iframe:r,origin:"https://"+K.get().connectDomain}),s=function(){r.style.display="none"};return{show:function(){return r.style.display="block",new Promise((function(t,o){a.onMessage((function(i){switch(i.handler){case G.HIDE_DATA_POLICY:s(),t();break;case G.SHOW_CAPTCHA:var c=n.captcha(e,{captcha_sid:i.params.captcha_sid,captcha_img:i.params.captcha_img});c.show().then((function(n){a.sendMessage({handler:Y.CAPTCHA_SUCCESS,params:u({uuid:e},n)}),r.style.display="block"})).catch((function(){a.sendMessage({handler:Y.CAPTCHA_FAIL,params:{uuid:e}}),c.destroy()})),s();break;default:s(),o()}}))}))},hide:s,destroy:function(){document.body.removeChild(r),a.destroy()}}})),c(this,"userPolicyAgreements",(function(e){var t,o,i,r=H({origin:location.protocol+"//"+location.host,uuid:e},"user_policy_agreements"),a=(t=r,o=window.innerHeight,i="\n display: none;\n position: fixed;\n top: 0;\n left: 0;\n width: 100%;\n height: ".concat(o,"px;\n min-height: ").concat(o,"px;\n border: none;\n z-index: 99999;\n "),k(t,{properties:{height:"".concat(o,"px")},cssText:i}));document.body.appendChild(a);var s=new B({iframe:a,origin:"https://"+K.get().connectDomain}),c=function(){a.style.display="none"};return{show:function(){return a.style.display="block",new Promise((function(t,o){s.onMessage((function(i){switch(i.handler){case j.ACCEPT_POLICY_AGREEMENTS:c(),t({accepted:!0});break;case j.DECLINE_POLICY_AGREEMENTS:c(),t({accepted:!1});break;case j.SHOW_DATA_POLICY:c();var r=function(){a.style.display="block"};n.userDataPolicy(e).show().then(r).catch(r);break;case j.POLICY_AGREEMENTS_ERROR:case j.HIDE_POLICY_AGREEMENTS:default:c(),o()}}))}))},hide:c,destroy:function(){document.body.removeChild(a),s.destroy()}}})),c(this,"captcha",(function(e,n){var t=H(u({origin:location.protocol+"//"+location.host,uuid:e},n),"auth_captcha"),o=window.innerHeight,i=k(t,{cssText:"\n display: none;\n position: fixed;\n top: 0;\n left: 0;\n width: 100%;\n height: ".concat(o,"px;\n min-height: ").concat(o,"px;\n border: none;\n z-index: 99999;\n ")});document.body.appendChild(i);var r=new B({iframe:i,origin:"https://"+K.get().connectDomain}),a=function(){document.body.removeChild(i),r.destroy()};return{show:function(){return i.style.display="block",new Promise((function(e,n){r.onMessage((function(t){switch(t.handler){case Y.CAPTCHA_SUCCESS:e(t.params),a();break;default:n(),a()}}))}))},destroy:a}})),c(this,"userVisibleAuth",(function(e){var t=h(),o=u({origin:location.protocol+"//"+location.host,uuid:t},W(e,["screen","source"])),i=L(null==e?void 0:e.action);i&&(o.action=i);var r=H(o);n.flags&&(r="".concat(r,"#").concat(b(n.flags)));var a=screen.height/2-280,s=screen.width/2-410,c=window.open(r,"_blank","top=".concat(a,",left=").concat(s,",width=").concat(820,",height=").concat(560,",location"));if(!c){var p={code:d.CONNECT_WINDOW_NOT_OPENED,reason:v()};return Promise.reject(p)}return new Promise((function(e,n){var o=setInterval((function(){if(!c||c.closed){window.removeEventListener("message",i),clearInterval(o);var e={code:d.CONNECT_WINDOW_CLOSED,reason:m()};n(e)}}),1e3);function i(r){if(r.source===c&&c)if(window.removeEventListener("message",i),clearInterval(o),".vk.com"===r.origin.slice(r.origin.length-".vk.com".length))if(r.data.action==="vk_connect_response"+t){var a=r.data.payload;c.close(),e({provider:"vk",payload:a})}else if(r.data.action==="oauth_callback"+t)e({provider:r.data.payload.name}),c.close();else if(r.data.action==="skip_callback"+t){var s=r.data.payload.redirectURL;s&&(window.location.href=s),c.close()}else{c.close();var p={code:d.CONNECT_UNKNOWN_SDK_MESSAGE,reason:A(JSON.stringify(r.data))};n(p)}else{c.close();var u={code:d.CONNECT_DOMAIN_NOT_ALLOWED,reason:y(r.origin)};n(u)}}window.addEventListener("message",i)}))})),c(this,"redirectAuth",(function(e){var n=h(),t=u({redirect_uri:e.url,uuid:n},W(e,["screen","source"])),o=L(null==e?void 0:e.action);o&&(t.action=o),(null==e?void 0:e.state)&&(t.redirect_state=e.state);var i=H(t);location.assign(i)}))},$=new(function(){function e(){r(this,e),c(this,"savedStyles",[]),c(this,"bodyScrollYValue",window.pageYOffset||window.scrollY),c(this,"isFreezed",!1)}return s(e,[{key:"freezeBodyOverflow",value:function(){if(!this.isFreezed){this.isFreezed=!0;var e=(t=window.document.documentElement.clientWidth,Math.abs(window.innerWidth-t)),n=parseInt(window.getComputedStyle(window.document.body).paddingRight,10)||0;this.bodyScrollYValue=window.pageYOffset||window.scrollY,this.savedStyles=[],this.savedStyles.push({value:window.document.body.style.paddingRight,property:"padding-right"},{value:window.document.body.style.overflow,property:"overflow"},{value:window.document.body.style.overflowX,property:"overflow-x"},{value:window.document.body.style.overflowY,property:"overflow-y"}),window.document.body.style.setProperty("overflow","hidden"),window.document.body.style.setProperty("padding-right","".concat(e+n,"px"))}var t}},{key:"restoreBodyOverflow",value:function(){this.isFreezed&&(this.savedStyles.forEach((function(e){var n=e.value,t=e.property;n?window.document.body.style.setProperty(t,n):window.document.body.style.removeProperty(t)})),window.scrollTo(0,this.bodyScrollYValue),this.isFreezed=!1)}}]),e}());!function(e){e.APP_CLOSE="VKWebAppClose",e.APP_READY="VKSDKMiniAppReady",e.RESIZE="VKSDKMiniAppResize",e.APP_INIT_CONFIG="VKSDKMiniAppInitConfig",e.OPEN_APP="VKWebAppOpenApp",e.OPEN_PAY_FORM="VKWebAppOpenPayForm",e.ACTION_DONE="VKWebAppActionDone"}(Z||(Z={})),(J=exports.MiniAppEvents||(exports.MiniAppEvents={})).OPEN="open",J.HIDE="hide",J.CLOSE="close",J.SHOW="show",J.MESSAGE="message",J.CREATE_APP="createapp",function(e){e.SUPERAPP_TOKEN="VKSDKGeneralSuperAppToken",e.AUTH_NEEDED="VKSDKGeneralAuthNeeded",e.OPEN_APP="VKSDKGeneralOpenApp"}(X||(X={}));var ee,ne=function e(n){var t=this;r(this,e),c(this,"events",void 0),c(this,"iframe",void 0),c(this,"bridge",void 0),c(this,"loading",void 0),c(this,"readyPromiseResolve",null),c(this,"readyPromise",null),c(this,"params",void 0),c(this,"child",null),c(this,"open",(function(e,n){return t.loading?(t.iframe.src=t.getMiniAppUrl(e,n),t.loading=new Promise((function(e){t.iframe.onload=function(){t.iframe.onload=null,e()}})),t.readyPromise=new Promise((function(e){return t.readyPromiseResolve=e}))):t.preload(e,n).catch(console.error),t.iframe.style.display="block",t.params.stackMode||$.freezeBodyOverflow(),t.loading.then(t.handleResize).catch(console.error),t.events.emit(exports.MiniAppEvents.OPEN),t.readyPromise})),c(this,"hide",(function(){t.iframe.style.display="none",t.params.stackMode||$.restoreBodyOverflow(),t.events.emit(exports.MiniAppEvents.HIDE)})),c(this,"close",(function(){t.params.stackMode||$.restoreBodyOverflow(),K.events.off("superAppToken",t.onSuperAppToken),t.iframe&&t.iframe.remove(),t.bridge&&t.bridge.destroy(),delete t.iframe,delete t.bridge,window.removeEventListener("resize",t.handleResize),t.events.emit(exports.MiniAppEvents.CLOSE)})),c(this,"show",(function(){if(!t.loading)throw new Error('App is not loaded, use "open" or "preload" methods');t.iframe.style.display="block",t.params.stackMode||$.freezeBodyOverflow(),t.events.emit(exports.MiniAppEvents.SHOW)})),c(this,"preload",(function(e,n){var o=document.createElement("iframe"),i=window.innerHeight,r=isFinite(t.params.zIndex)?t.params.zIndex:999999;return o.src=t.getMiniAppUrl(e,n),o.setAttribute("allow","geolocation"),o.style.cssText="\n display: none;\n position: fixed;\n top: 0;\n left: 0;\n width: 100%;\n height: ".concat(i,"px;\n min-height: ").concat(i,"px;\n border: none;\n z-index: ").concat(r,";\n "),t.iframe=o,document.body.appendChild(t.iframe),K.events.on("superAppToken",t.onSuperAppToken),t.bridge=new B({iframe:t.iframe,origin:"https://"+K.get().connectDomain}),t.bridge.onMessage(t.handleMessage),window.addEventListener("resize",t.handleResize),t.loading=new Promise((function(e){o.onload=function(){o.onload=null,e()}})),t.readyPromise=new Promise((function(e){return t.readyPromiseResolve=e})),t.loading})),c(this,"sendMessage",(function(e){t.bridge.sendMessage(e)})),c(this,"onSuperAppToken",(function(e){t.bridge.sendMessage({handler:X.SUPERAPP_TOKEN,params:{result:e}})})),c(this,"handleMessage",(function(e){switch(e.handler){case Z.APP_CLOSE:t.hide();break;case Z.APP_READY:t.resolveReadyPromise(),t.handleUpdateConfig();break;case Z.OPEN_APP:t.openMiniapp(e.params);break;case Z.OPEN_PAY_FORM:t.openPayForm(e.params);break;case X.SUPERAPP_TOKEN:K._requestSuperAppToken();break;case X.AUTH_NEEDED:K._requestAuth();break;default:t.events.emit(exports.MiniAppEvents.MESSAGE,e)}})),c(this,"handleResize",(function(){if(t.iframe){var e=innerWidth,n=innerHeight;t.iframe.style.height="".concat(n,"px"),t.iframe.style.minHeight="".concat(n,"px"),t.bridge.sendMessage({handler:Z.RESIZE,params:{viewport_width:e,viewport_height:n}})}})),c(this,"handleUpdateConfig",(function(){t.bridge.sendMessage({handler:Z.APP_INIT_CONFIG,params:{fullMode:t.params.fullMode,hideMenu:t.params.hideMenu}})})),c(this,"getMiniAppUrl",(function(e,n){var o=K.get(),i=o.connectDomain,r=o.appId,a=o.superAppToken,s=o._debug,c=b({app:t.params.app,host_app_id:r,debug:s?"1":"",localhost:s?"1":"",superapp_token:a,app_query:e?JSON.stringify(e):"",app_hash:n||""});return"https://".concat(i,"/mini_app?").concat(c)})),c(this,"resolveReadyPromise",(function(){t.readyPromise&&t.readyPromiseResolve&&(t.readyPromiseResolve(),t.readyPromise=null,t.readyPromiseResolve=null)})),c(this,"openMiniapp",(function(n){t.child=new e({app:n.app_id,stackMode:t.params.stackMode}),t.events.emit(exports.MiniAppEvents.CREATE_APP,{app:t.child,location:n.location})})),c(this,"openPayForm",(function(n){var o=u({},n.params);o.data&&(o.data=JSON.stringify(o.data));var i=u({},o,{app_id:n.app_id,action:n.action}),r=new e({app:6217559,stackMode:t.params.stackMode});r.open(i).then((function(){return t.hide()})).catch(console.error),r.events.on(exports.MiniAppEvents.MESSAGE,(function(e){t.handleVKPayFormMessage(e),r.close(),t.show()})),r.events.on(exports.MiniAppEvents.HIDE,(function(){r.close(),t.close()}))})),c(this,"handleVKPayFormMessage",(function(e){e.handler===Z.ACTION_DONE&&t.sendMessage(e)})),this.params=u({},n,{app:"number"==typeof n.app?"app".concat(n.app):n.app}),this.events=N()},te=function(){function e(){r(this,e),c(this,"stack",[])}return s(e,[{key:"removeMiniApp",value:function(e){var n=e.app,t=this.stack.lastIndexOf(n);if(t>-1&&t===this.stack.length-1)if(this.stack.splice(t,1),this.stack.length){this.stack[this.stack.length-1].show();var o=this.stack[this.stack.length-2];setTimeout((function(){return null==o?void 0:o.hide()}),0)}else $.restoreBodyOverflow()}},{key:"makeHandleMiniAppClose",value:function(e){var n=this,t=e.app;return function(){n.removeMiniApp({app:t})}}},{key:"makeHandleMiniAppHide",value:function(e){var n=this,t=e.app;return function(){var e=n.stack.lastIndexOf(t);e>-1&&e===n.stack.length-1&&setTimeout((function(){return t.close()}),0)}}},{key:"handleMiniAppCreate",value:function(e){var n=e.app,t=e.query,o=e.hash;this.stack.push(n),n.open(t,o).catch(console.error),n.events.on(exports.MiniAppEvents.CREATE_APP,this.handleMiniAppCreate.bind(this)),n.events.on(exports.MiniAppEvents.HIDE,this.makeHandleMiniAppHide({app:n})),n.events.on(exports.MiniAppEvents.CLOSE,this.makeHandleMiniAppClose({app:n})),$.freezeBodyOverflow();var i=this.stack[this.stack.length-2];return setTimeout((function(){null==i||i.hide()}),0),n}},{key:"open",value:function(e){var n=e.app,t=e.query,o=e.hash,i=new ne({app:n,stackMode:!0});return this.handleMiniAppCreate({app:i,query:t,hash:o}),i}},{key:"close",value:function(){var e=this.stack;this.stack.splice(0),e.reverse().forEach((function(e){return e.close()})),$.restoreBodyOverflow()}},{key:"length",get:function(){return this.stack.length}}]),e}();!function(e){e.STATIC_MAP="VKSDKRequestToGeoservice:staticmap/png/",e.SEARCH="VKSDKRequestToGeoservice:search",e.OVERALL="VKSDKRequestToGeoservice:overall",e.DIRECTIONS="VKSDKRequestToGeoservice:directions",e.ISO="VKSDKRequestToGeoservice:iso"}(ee||(ee={}));var oe=function(){function e(n){var t=this,o=n.apiKey;r(this,e),c(this,"iframe",void 0),c(this,"bridge",void 0),c(this,"requestMap",void 0),c(this,"apiKey",void 0),this.apiKey=o;var i=document.createElement("iframe"),a=K.get().appId;i.src=this.getGeoserviceProxyUrl({app_id:a}),i.style.cssText="\n display: none;\n ",this.iframe=i,document.body.appendChild(this.iframe),this.bridge=new B({iframe:this.iframe,origin:"https://"+K.get().connectDomain}),this.requestMap={},this.bridge.onMessage((function(e){var n=e.params,o=n.requestID,i=n.response;t.requestMap[o].resolve(i),delete t.requestMap[o]}))}return s(e,[{key:"setApiKey",value:function(e){this.apiKey=e}},{key:"getGeoserviceProxyUrl",value:function(e){var n=K.get(),t=n.connectDomain,o=n._debug,i=u({},e||{},{origin:location.protocol+"//"+location.host,localhost:String(location.host.includes("localhost")),debug:location.host.includes("localhost")?1:String(o)});return"https://".concat(t,"/geoservice?").concat(b(i))}},{key:"prepareAnswer",value:function(e,n,t){var o=this,i=h();return this.bridge.sendMessage({handler:"VKSDKRequestToGeoservice:".concat(e),params:u({},n,{api_key:this.apiKey,wrapRequestInJSON:t,requestID:i})}),new Promise((function(e,n){o.requestMap[i]={resolve:e,reject:n}}))}},{key:"getStaticMap",value:function(e){return this.prepareAnswer("staticmap/png/",e)}},{key:"encodeCoords",value:function(e){return this.prepareAnswer("search",e)}},{key:"decodeCoords",value:function(e){return this.prepareAnswer("overall",e)}},{key:"getDirections",value:function(e){return this.prepareAnswer("directions",e,!0)}},{key:"getISO",value:function(e){return this.prepareAnswer("iso",e,!0)}}]),e}(),ie={OneTapAuthEventsSDK:F,FloatingOneTapAuthEventsSDK:z,ButtonOneTapAuthEventsSDK:q,DataPolicyEventsSDK:G,AuthCaptchaEventsSDK:Y};exports.BodyOverflowManager=$,exports.Config=K,exports.Connect=Q,exports.ConnectEvents=ie,exports.GeoService=oe,exports.MiniApp=ne,exports.MiniAppService=te; | ||
"use strict";function e(n){return(e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(n)}function n(n){return n&&"object"===e(n)&&"default"in n?n.default:n}Object.defineProperty(exports,"__esModule",{value:!0});var t=n(require("@babel/runtime/helpers/typeof"));require("@babel/runtime/helpers/toConsumableArray");var o=n(require("@babel/runtime/helpers/defineProperty"));function i(e){return(i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function r(e,n){if(!(e instanceof n))throw new TypeError("Cannot call a class as a function")}function a(e,n){for(var t=0;t<n.length;t++){var o=n[t];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}function s(e,n,t){return n&&a(e.prototype,n),t&&a(e,t),e}function c(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function p(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);n&&(o=o.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,o)}return t}function u(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?p(Object(t),!0).forEach((function(n){c(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):p(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}require("@babel/runtime/helpers/classCallCheck"),require("@babel/runtime/helpers/createClass");var l,d="ModuleSymbhasOwnPr-0123456789ABCDEFGHNRVfgctiUvz_KqYTJkLxpZXIjQW",h=function(){for(var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:21,n="",t=e;t--;)n+=d[64*Math.random()|0];return n},f=["agreements","promo","vkc_behavior","vkc_auth_action","vkc_brand","vkc_display_mode","service_groups","external_device_id"];!function(e){e[e.UNKNOWN=1]="UNKNOWN",e[e.MISSING_PARAM=2]="MISSING_PARAM",e[e.CONNECTION_LOST=3]="CONNECTION_LOST",e[e.USER_DENIED=4]="USER_DENIED",e[e.INVALID_PARAMS=5]="INVALID_PARAMS",e[e.CUSTOM=6]="CUSTOM",e[e.CONNECT_WINDOW_CLOSED=7]="CONNECT_WINDOW_CLOSED",e[e.CONNECT_WINDOW_NOT_OPENED=8]="CONNECT_WINDOW_NOT_OPENED",e[e.CONNECT_DOMAIN_NOT_ALLOWED=9]="CONNECT_DOMAIN_NOT_ALLOWED",e[e.CONNECT_UNKNOWN_SDK_MESSAGE=10]="CONNECT_UNKNOWN_SDK_MESSAGE",e[e.OLD_MISSING_PARAM=100]="OLD_MISSING_PARAM"}(l||(l={}));var m=function(){return"Connect window was closed."},v=function(){return"Connect window was not opened."},y=function(e){return'URL domain "'.concat(e,'" is not allowed.')},A=function(e){return"This SDK message is unknown: ".concat(e)},g=!("undefined"==typeof window||!window.document||!window.document.createElement),E=g&&!!window.addEventListener,_=function(){};if(E)try{var O=Object.defineProperty({},"passive",{get:function(){!0}});window.addEventListener("test",_,O),window.removeEventListener("test",_,O)}catch(e){}!function(){if(!g)return!1;var e=!1;try{document.createElement("div").scrollTo({top:0,get behavior(){return e=!0,"smooth"}})}catch(e){}}();function w(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);n&&(o=o.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,o)}return t}function S(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?w(Object(t),!0).forEach((function(n){o(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):w(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}var T={parse:function(e){if("string"!=typeof e)return{};if(!(e=e.trim().replace(/^[?#&]/,"")))return{};var n=/\?(.+)$/gi.exec(e);return(n?n[1]:e).split("&").reduce((function(e,n){var t=n.split("=");return t[1]&&(e[t[0]]=decodeURIComponent(t[1])),e}),{})},stringify:function(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if("object"!==t(e)||null===e)return"";n=S({encode:!0},n);var o=function(e){return n.encode?encodeURIComponent(e):String(e)};return Object.keys(e).reduce((function(t,i){var r=e[i];return void 0===r?t:null===r?(n.skipNull||t.push([o(i),""].join("=")),t):Array.isArray(r)?(r.map((function(e){t.push("".concat(o(i),"[]=").concat(o(e)))})).join(),t):(t.push([o(i),o(r)].join("=")),t)}),[]).join("&")}};function b(e){return T.stringify(e)}function D(e){return Object.keys(e).filter((function(e){return f.includes(e)}))}function P(e){var n;return Boolean(null===(n=D(e))||void 0===n?void 0:n.length)}function C(e){var n=function(e){return D(e).reduce((function(n,t){return n[t]=e[t],n}),{})}(e);return btoa(JSON.stringify(n))}function k(e,n){var t,o=document.createElement("iframe");for(var i in e&&(o.src=e),o.style.cssText=null!==(t=null==n?void 0:n.cssText)&&void 0!==t?t:"",o.width="100%",o.height="100%",o.style.border="none",null==n?void 0:n.properties){var r;if(n&&n.properties.hasOwnProperty(i))o[i]=null!==(r=n.properties[i])&&void 0!==r?r:""}return o}function N(e){return e=e||Object.create(null),{on:function(n,t){(e[n]||(e[n]=[])).push(t)},off:function(n,t){e[n]&&e[n].splice(e[n].indexOf(t)>>>0,1)},emit:function(n,t){(e[n]||[]).slice().map((function(e){e(t)})),(e["*"]||[]).slice().map((function(e){e(n,t)}))}}}var M={appId:0,superAppToken:"",loginDomain:"login.vk.com",oauthDomain:"oauth.vk.com",connectDomain:"connect.vk.com",_debug:!1},I={},K={events:N(),init:function(e){if(!e.appId)throw new Error("appId required");M.appId=e.appId,M.superAppToken=e.superAppToken||"",M.loginDomain=e.loginDomain||"login.vk.com",M.oauthDomain=e.oauthDomain||"oauth.vk.com",M.connectDomain=e.connectDomain||"connect.vk.com",M.appSettings=e.appSettings,M._debug=!!e._debug},get:function(){return M},setSuperAppToken:function(e){M.superAppToken=e,K.events.emit("superAppToken",e)},onRequestSuperAppToken:function(e){I.superAppToken=e},_requestSuperAppToken:function(){var e;I.superAppToken&&(e=I.superAppToken()),e&&e.then((function(e){return K.setSuperAppToken(e)})).catch(console.error)},onAuth:function(e){I.auth=e},_requestAuth:function(){var e;I.auth&&(e=I.auth()),e&&e.then((function(e){return K.setSuperAppToken(e)})).catch(console.error)},onOpenApp:function(e){I.openApp=e},_openApp:function(e){I.openApp&&I.openApp(e.app)}},R=["extend_token","login_with_user","__sferum_invite_link"];function L(e){return e&&R.includes(e.name)?btoa(JSON.stringify(e)):""}var x;function H(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"auth",t=K.get(),o=t.appId,i=t.connectDomain,r=t.appSettings,a=u({app_id:o,response_type:"silent_token",v:"0.0.2"},e);r&&P(r)&&(a.app_settings=C(r));var s=b(a);return"https://".concat(i,"/").concat(n,"?").concat(s)}!function(e){e.Default="default",e.NamePhone="name_phone",e.PhoneName="phone_name"}(x||(x={}));var V,U=[x.Default,x.NamePhone,x.PhoneName];!function(e){e.Primary="primary",e.Flat="flat"}(V||(V={}));var W=[V.Primary,V.Flat];function G(e,n){return void 0===e?n:"number"!=typeof e?e?1:0:e}function j(e,n){return e&&"object"===i(e)?Object.keys(e).reduce((function(t,o){return n.includes(o)?(t[o]=e[o],t):t}),{}):e}var F,Y,z,q,B,Z,J=function e(n){var t=this;r(this,e),c(this,"handler",(function(){return{}})),c(this,"config",void 0),c(this,"destroy",(function(){delete t.config,window.removeEventListener("message",t.handleMessage)})),c(this,"onMessage",(function(e){t.handler=e})),c(this,"sendMessage",(function(e){t.config.iframe.contentWindow.postMessage(u({type:"vk-sak-sdk"},e),t.config.origin)})),c(this,"handleMessage",(function(e){t.config.origin&&e.origin===t.config.origin&&e.source===t.config.iframe.contentWindow&&e.data&&"vk-sak-sdk"===e.data.type&&t.handler(e.data)})),this.config=n,window.addEventListener("message",this.handleMessage)};!function(e){e.SHOW_DATA_POLICY="VKSDKOneTapAuthConnectDataPolicy",e.HIDE_DATA_POLICY="VKSDKOneTapAuthDataPolicyClose",e.DATA_POLICY_RESULT="VKSDKOneTapAuthDataPolicyResult",e.SHOW_CAPTCHA="VKSDKOneTapAuthDataPolicyShowCaptcha"}(F||(F={})),function(e){e.SHOW_POLICY_AGREEMENTS="VKSDKOneTapAuthPolicyAgreementsShow",e.HIDE_POLICY_AGREEMENTS="VKSDKOneTapAuthPolicyAgreementsHide",e.ACCEPT_POLICY_AGREEMENTS="VKSDKOneTapAuthPolicyAgreementsAccept",e.DECLINE_POLICY_AGREEMENTS="VKSDKOneTapAuthPolicyAgreementsDecline",e.POLICY_AGREEMENTS_ERROR="VKSDKOneTapAuthPolicyAgreementsError",e.SHOW_DATA_POLICY="VKSDKOneTapAuthPolicyAgreementsShowDataPolicy"}(Y||(Y={})),function(e){e.CAPTCHA_SUCCESS="VKSDKAuthCaptchaSuccess",e.CAPTCHA_FAIL="VKSDKAuthCaptchaFail"}(z||(z={})),function(e){e.PHONE_VALIDATION_NEEDED="VKSDKOneTapAuthPhoneValidationNeeded",e.FULL_AUTH_NEEDED="VKSDKOneTapAuthFullAuthNeeded",e.AUTH_DATA_LOADED="VKSDKOneTapAuthDataLoaded",e.NOT_AUTHORIZED="VKSDKOneTapAuthNotAuthorized",e.LOGIN_SUCCESS="VKSDKOneTapAuthLoginSuccess",e.RESIZE_FRAME="VKSDKOneTapResizeFrame",e.SHOW_CAPTCHA="VKSDKOneTapShowCaptcha",e.VALIDATE_CAPTCHA="VKSDKOneTapValidateCaptcha"}(q||(q={})),function(e){e.CLOSE_AUTH="VKSDKOneTapAuthClose",e.ADAPTIVITY_CHANGE="VKSDKFloatingOneTapAdaptivityChange",e.ADAPTIVITY_CHANGED="VKSDKFloatingOneTapAdaptivityChanged"}(B||(B={})),function(e){e.SHOW_LOGIN="VKSDKButtonOneTapAuthShowLogin",e.SHOW_LOGIN_OPTIONS="VKSDKButtonOneTapAuthShowLoginOptions",e.SHOW_AGREEMENTS_DIALOG="VKSDKButtonOneTapAuthShowAgreementsDialog",e.START_AUTHORIZE="VKSDKButtonOneTapAuthStartAuthorize"}(Z||(Z={}));var X,Q,$,ee=new function e(){var n=this;r(this,e),c(this,"flags",null),c(this,"silentAuth",(function(){var e=K.get(),n=e.loginDomain,t=e.appId,o=h(),i="https://".concat(n,"/?act=connect&app_id=").concat(t,"&response_type=").concat("silent_token","&uuid=").concat(o,"&v=").concat("0.0.2"),r=new XMLHttpRequest;return r.open("GET",i,!0),r.responseType="json",r.withCredentials=!0,new Promise((function(e,n){r.onload=function(){r.response?e({provider:"vk",payload:r.response}):n()},r.onerror=function(){n()},r.send()}))})),c(this,"oneTapAuth",(function(e,t){if(console.warn("Connect.oneTapAuth method is deprecated. Use Connect.floatingOneTapAuth and Connect.buttonOneTapAuth methods."),!["floating","button"].includes(e))return null;switch(e){case"button":return n.buttonOneTapAuth(t);case"floating":return n.floatingOneTapAuth(t);default:return null}})),c(this,"floatingOneTapAuth",(function(e){var t,o,i=function(){var e,n=window.innerWidth,t=n<=768;return{destroy:function(){return window.removeEventListener("resize",e)},isAdaptive:function(){return t},observe:function(o){e=function(){var e=window.innerWidth;n>768&&e<=768?o(t=!0):n<=768&&e>768&&o(t=!1),n=e},window.addEventListener("resize",e)}}}(),r=(t=i.isAdaptive(),o=t?"314px":"334px",{pageUrl:"floating_one_tap_auth",pageUrlParams:{adaptive:t?1:0},frameStyles:t?"\n display: none;\n position: fixed;\n bottom: 0;\n right: 50%;\n transform: translate(50%, 0);\n max-width: 468px;\n width: 100%;\n height: ".concat(o,";\n "):"\n display: none;\n position: fixed;\n top: 0;\n right: 0;\n max-width: 400px;\n width: 100%;\n height: ".concat(o,";\n ")});if(!r)throw new Error("options were not set");var a=h(),s=k(H(u({origin:location.protocol+"//"+location.host,uuid:a},r.pageUrlParams),r.pageUrl),{cssText:r.frameStyles}),c=new J({iframe:s,origin:"https://"+K.get().connectDomain});i.observe((function(e){c.sendMessage({handler:B.ADAPTIVITY_CHANGE,params:{uuid:a,is_adaptive:e}}),e?(s.style.maxWidth="468px",s.style.top="auto",s.style.bottom="0",s.style.right="50%",s.style.transform="translate(50%, 0)"):(s.style.maxWidth="400px",s.style.top="0",s.style.bottom="auto",s.style.right="0",s.style.transform="none"),s.style.display="none"})),document.body.appendChild(s);var p=function(){c.sendMessage({handler:q.RESIZE_FRAME,params:{uuid:a}})};window.addEventListener("resize",p);var l=function(){s&&(s.remove(),s=null),window.removeEventListener("resize",p),i&&i.destroy(),c.destroy()},d=new Promise((function(t){c.onMessage((function(o){if(o.params.uuid===a)switch(o.handler){case q.NOT_AUTHORIZED:e.callback({type:o.handler,payload:{uuid:a,error:"not_authorized"}}),l(),t(o.handler);break;case q.RESIZE_FRAME:s.style.height="".concat(o.params.height,"px");break;case B.CLOSE_AUTH:e.callback({type:o.handler,payload:{uuid:a}}),l();break;case B.ADAPTIVITY_CHANGED:s.style.display="block";break;case q.AUTH_DATA_LOADED:s.style.display="block",t(o.handler);default:n.handleOneTapEvents(o,c,e)}}))}));return{getFrame:function(){return s},destroy:l,authReadyPromise:d}})),c(this,"buttonOneTapAuth",(function(e){var t=function(e){var n={},t=44;if(e){n.display=e.displayMode&&U.includes(e.displayMode)?e.displayMode:"default",n.button_skin=e.buttonSkin&&W.includes(e.buttonSkin)?e.buttonSkin:"primary",n.show_agreements=G(e.showAgreements,0),n.show_alternative_login=G(e.showAlternativeLogin,0),n.show_agreements_dialog=G(e.showAgreementsDialog,1);t+=n.show_alternative_login?56:0,t+=n.show_agreements?80:0}return{pageUrl:"button_one_tap_auth",pageUrlParams:n,frameStyles:"\n height: ".concat(t,"px;\n ")}}(e.options);if(!t)throw new Error("options were not set");var o=h(),i=k(H(u({origin:location.protocol+"//"+location.host,uuid:o},t.pageUrlParams),t.pageUrl),{cssText:t.frameStyles}),r=e.container;r&&r.appendChild(i);var a=new J({iframe:i,origin:"https://"+K.get().connectDomain}),s=function(){a.sendMessage({handler:q.RESIZE_FRAME,params:{uuid:o}})};window.addEventListener("resize",s);return{getFrame:function(){return i},destroy:function(){i&&(i.remove(),i=null),window.removeEventListener("resize",s),a.destroy()},authReadyPromise:new Promise((function(t){a.onMessage((function(r){if(r.params.uuid===o)switch(r.handler){case q.RESIZE_FRAME:i.style.height="".concat(r.params.height,"px");break;case q.NOT_AUTHORIZED:t(r.handler);break;case Z.SHOW_LOGIN:case Z.SHOW_LOGIN_OPTIONS:e.callback({type:r.handler,payload:{uuid:o}});break;case Z.SHOW_AGREEMENTS_DIALOG:n.userPolicyAgreements(o).show().then((function(e){e&&e.accepted&&a.sendMessage({handler:Z.START_AUTHORIZE,params:{uuid:o}})})).catch((function(){a.sendMessage({handler:Y.DECLINE_POLICY_AGREEMENTS,params:{uuid:o}})}));break;case q.AUTH_DATA_LOADED:t(r.handler);default:n.handleOneTapEvents(r,a,e)}}))}))}})),c(this,"handleOneTapEvents",(function(e,t,o){var i=e.params.uuid;switch(e.handler){case q.AUTH_DATA_LOADED:t.sendMessage({handler:q.RESIZE_FRAME,params:{uuid:i}});break;case q.LOGIN_SUCCESS:o.callback({type:e.handler,provider:"vk",payload:e.params});break;case q.SHOW_CAPTCHA:var r=n.captcha(i,{captcha_sid:e.params.captcha_sid,captcha_img:e.params.captcha_img});r.show().then((function(e){t.sendMessage({handler:z.CAPTCHA_SUCCESS,params:u({uuid:i},e)})})).catch((function(){t.sendMessage({handler:z.CAPTCHA_FAIL,params:{uuid:i}}),r.destroy()}));break;case F.SHOW_DATA_POLICY:n.userDataPolicy(i).show().then((function(){o.callback({type:F.DATA_POLICY_RESULT,payload:{uuid:i,policyAccepted:!0}})})).catch((function(){o.callback({type:F.DATA_POLICY_RESULT,payload:{uuid:i,policyAccepted:!1}})}));break;case q.FULL_AUTH_NEEDED:case q.PHONE_VALIDATION_NEEDED:o.callback({type:e.handler,payload:{uuid:i}})}})),c(this,"userDataPolicy",(function(e){var t=H({origin:location.protocol+"//"+location.host,uuid:e},"user_data_policy"),o=window.innerHeight,i="\n display: none;\n position: fixed;\n top: 0;\n left: 0;\n width: 100%;\n height: ".concat(o,"px;\n min-height: ").concat(o,"px;\n border: none;\n z-index: 99999;\n "),r=k(t,{properties:{height:"".concat(o,"px")},cssText:i});document.body.appendChild(r);var a=new J({iframe:r,origin:"https://"+K.get().connectDomain}),s=function(){r.style.display="none"};return{show:function(){return r.style.display="block",new Promise((function(t,o){a.onMessage((function(i){switch(i.handler){case F.HIDE_DATA_POLICY:s(),t();break;case F.SHOW_CAPTCHA:var c=n.captcha(e,{captcha_sid:i.params.captcha_sid,captcha_img:i.params.captcha_img});c.show().then((function(n){a.sendMessage({handler:z.CAPTCHA_SUCCESS,params:u({uuid:e},n)}),r.style.display="block"})).catch((function(){a.sendMessage({handler:z.CAPTCHA_FAIL,params:{uuid:e}}),c.destroy()})),s();break;default:s(),o()}}))}))},hide:s,destroy:function(){document.body.removeChild(r),a.destroy()}}})),c(this,"userPolicyAgreements",(function(e){var t,o,i,r=H({origin:location.protocol+"//"+location.host,uuid:e},"user_policy_agreements"),a=(t=r,o=window.innerHeight,i="\n display: none;\n position: fixed;\n top: 0;\n left: 0;\n width: 100%;\n height: ".concat(o,"px;\n min-height: ").concat(o,"px;\n border: none;\n z-index: 99999;\n "),k(t,{properties:{height:"".concat(o,"px")},cssText:i}));document.body.appendChild(a);var s=new J({iframe:a,origin:"https://"+K.get().connectDomain}),c=function(){a.style.display="none"};return{show:function(){return a.style.display="block",new Promise((function(t,o){s.onMessage((function(i){switch(i.handler){case Y.ACCEPT_POLICY_AGREEMENTS:c(),t({accepted:!0});break;case Y.DECLINE_POLICY_AGREEMENTS:c(),t({accepted:!1});break;case Y.SHOW_DATA_POLICY:c();var r=function(){a.style.display="block"};n.userDataPolicy(e).show().then(r).catch(r);break;case Y.POLICY_AGREEMENTS_ERROR:case Y.HIDE_POLICY_AGREEMENTS:default:c(),o()}}))}))},hide:c,destroy:function(){document.body.removeChild(a),s.destroy()}}})),c(this,"captcha",(function(e,n){var t=H(u({origin:location.protocol+"//"+location.host,uuid:e},n),"auth_captcha"),o=window.innerHeight,i=k(t,{cssText:"\n display: none;\n position: fixed;\n top: 0;\n left: 0;\n width: 100%;\n height: ".concat(o,"px;\n min-height: ").concat(o,"px;\n border: none;\n z-index: 99999;\n ")});document.body.appendChild(i);var r=new J({iframe:i,origin:"https://"+K.get().connectDomain}),a=function(){document.body.removeChild(i),r.destroy()};return{show:function(){return i.style.display="block",new Promise((function(e,n){r.onMessage((function(t){switch(t.handler){case z.CAPTCHA_SUCCESS:e(t.params),a();break;default:n(),a()}}))}))},destroy:a}})),c(this,"userVisibleAuth",(function(e){var t=h(),o=u({origin:location.protocol+"//"+location.host,uuid:t},j(e,["screen","source"])),i=L(null==e?void 0:e.action);i&&(o.action=i);var r=H(o);n.flags&&(r="".concat(r,"#").concat(b(n.flags)));var a=screen.height/2-280,s=screen.width/2-410,c=window.open(r,"_blank","top=".concat(a,",left=").concat(s,",width=").concat(820,",height=").concat(560,",location"));if(!c){var p={code:l.CONNECT_WINDOW_NOT_OPENED,reason:v()};return Promise.reject(p)}return new Promise((function(e,n){var o=setInterval((function(){if(!c||c.closed){window.removeEventListener("message",i),clearInterval(o);var e={code:l.CONNECT_WINDOW_CLOSED,reason:m()};n(e)}}),1e3);function i(r){if(r.source===c&&c)if(window.removeEventListener("message",i),clearInterval(o),".vk.com"===r.origin.slice(r.origin.length-".vk.com".length))if(r.data.action==="vk_connect_response"+t){var a=r.data.payload;c.close(),e({provider:"vk",payload:a})}else if(r.data.action==="oauth_callback"+t)e({provider:r.data.payload.name}),c.close();else if(r.data.action==="skip_callback"+t){var s=r.data.payload.redirectURL;s&&(window.location.href=s),c.close()}else{c.close();var p={code:l.CONNECT_UNKNOWN_SDK_MESSAGE,reason:A(JSON.stringify(r.data))};n(p)}else{c.close();var u={code:l.CONNECT_DOMAIN_NOT_ALLOWED,reason:y(r.origin)};n(u)}}window.addEventListener("message",i)}))})),c(this,"redirectAuth",(function(e){var n=h(),t=u({redirect_uri:e.url,uuid:n},j(e,["screen","source"])),o=L(null==e?void 0:e.action);o&&(t.action=o),(null==e?void 0:e.state)&&(t.redirect_state=e.state);var i=H(t);location.assign(i)}))},ne=new(function(){function e(){r(this,e),c(this,"savedStyles",[]),c(this,"bodyScrollYValue",window.pageYOffset||window.scrollY),c(this,"isFreezed",!1)}return s(e,[{key:"freezeBodyOverflow",value:function(){if(!this.isFreezed){this.isFreezed=!0;var e=(t=window.document.documentElement.clientWidth,Math.abs(window.innerWidth-t)),n=parseInt(window.getComputedStyle(window.document.body).paddingRight,10)||0;this.bodyScrollYValue=window.pageYOffset||window.scrollY,this.savedStyles=[],this.savedStyles.push({value:window.document.body.style.paddingRight,property:"padding-right"},{value:window.document.body.style.overflow,property:"overflow"},{value:window.document.body.style.overflowX,property:"overflow-x"},{value:window.document.body.style.overflowY,property:"overflow-y"}),window.document.body.style.setProperty("overflow","hidden"),window.document.body.style.setProperty("padding-right","".concat(e+n,"px"))}var t}},{key:"restoreBodyOverflow",value:function(){this.isFreezed&&(this.savedStyles.forEach((function(e){var n=e.value,t=e.property;n?window.document.body.style.setProperty(t,n):window.document.body.style.removeProperty(t)})),window.scrollTo(0,this.bodyScrollYValue),this.isFreezed=!1)}}]),e}());!function(e){e.APP_CLOSE="VKWebAppClose",e.APP_READY="VKSDKMiniAppReady",e.RESIZE="VKSDKMiniAppResize",e.APP_INIT_CONFIG="VKSDKMiniAppInitConfig",e.OPEN_APP="VKWebAppOpenApp",e.OPEN_PAY_FORM="VKWebAppOpenPayForm",e.ACTION_DONE="VKWebAppActionDone"}(X||(X={})),(Q=exports.MiniAppEvents||(exports.MiniAppEvents={})).OPEN="open",Q.HIDE="hide",Q.CLOSE="close",Q.SHOW="show",Q.MESSAGE="message",Q.CREATE_APP="createapp",function(e){e.SUPERAPP_TOKEN="VKSDKGeneralSuperAppToken",e.AUTH_NEEDED="VKSDKGeneralAuthNeeded",e.OPEN_APP="VKSDKGeneralOpenApp"}($||($={}));var te,oe=function e(n){var t=this;r(this,e),c(this,"events",void 0),c(this,"iframe",void 0),c(this,"bridge",void 0),c(this,"loading",void 0),c(this,"readyPromiseResolve",null),c(this,"readyPromise",null),c(this,"params",void 0),c(this,"child",null),c(this,"open",(function(e,n){return t.loading?(t.iframe.src=t.getMiniAppUrl(e,n),t.loading=new Promise((function(e){t.iframe.onload=function(){t.iframe.onload=null,e()}})),t.readyPromise=new Promise((function(e){return t.readyPromiseResolve=e}))):t.preload(e,n).catch(console.error),t.iframe.style.display="block",t.params.stackMode||ne.freezeBodyOverflow(),t.loading.then(t.handleResize).catch(console.error),t.events.emit(exports.MiniAppEvents.OPEN),t.readyPromise})),c(this,"hide",(function(){t.iframe.style.display="none",t.params.stackMode||ne.restoreBodyOverflow(),t.events.emit(exports.MiniAppEvents.HIDE)})),c(this,"close",(function(){t.params.stackMode||ne.restoreBodyOverflow(),K.events.off("superAppToken",t.onSuperAppToken),t.iframe&&t.iframe.remove(),t.bridge&&t.bridge.destroy(),delete t.iframe,delete t.bridge,window.removeEventListener("resize",t.handleResize),t.events.emit(exports.MiniAppEvents.CLOSE)})),c(this,"show",(function(){if(!t.loading)throw new Error('App is not loaded, use "open" or "preload" methods');t.iframe.style.display="block",t.params.stackMode||ne.freezeBodyOverflow(),t.events.emit(exports.MiniAppEvents.SHOW)})),c(this,"preload",(function(e,n){var o=document.createElement("iframe"),i=window.innerHeight,r=isFinite(t.params.zIndex)?t.params.zIndex:999999;return o.src=t.getMiniAppUrl(e,n),o.setAttribute("allow","geolocation"),o.style.cssText="\n display: none;\n position: fixed;\n top: 0;\n left: 0;\n width: 100%;\n height: ".concat(i,"px;\n min-height: ").concat(i,"px;\n border: none;\n z-index: ").concat(r,";\n "),t.iframe=o,document.body.appendChild(t.iframe),K.events.on("superAppToken",t.onSuperAppToken),t.bridge=new J({iframe:t.iframe,origin:"https://"+K.get().connectDomain}),t.bridge.onMessage(t.handleMessage),window.addEventListener("resize",t.handleResize),t.loading=new Promise((function(e){o.onload=function(){o.onload=null,e()}})),t.readyPromise=new Promise((function(e){return t.readyPromiseResolve=e})),t.loading})),c(this,"sendMessage",(function(e){t.bridge.sendMessage(e)})),c(this,"onSuperAppToken",(function(e){t.bridge.sendMessage({handler:$.SUPERAPP_TOKEN,params:{result:e}})})),c(this,"handleMessage",(function(e){switch(e.handler){case X.APP_CLOSE:t.hide();break;case X.APP_READY:t.resolveReadyPromise(),t.handleUpdateConfig();break;case X.OPEN_APP:t.openMiniapp(e.params);break;case X.OPEN_PAY_FORM:t.openPayForm(e.params);break;case $.SUPERAPP_TOKEN:K._requestSuperAppToken();break;case $.AUTH_NEEDED:K._requestAuth();break;default:t.events.emit(exports.MiniAppEvents.MESSAGE,e)}})),c(this,"handleResize",(function(){if(t.iframe){var e=innerWidth,n=innerHeight;t.iframe.style.height="".concat(n,"px"),t.iframe.style.minHeight="".concat(n,"px"),t.bridge.sendMessage({handler:X.RESIZE,params:{viewport_width:e,viewport_height:n}})}})),c(this,"handleUpdateConfig",(function(){t.bridge.sendMessage({handler:X.APP_INIT_CONFIG,params:{fullMode:t.params.fullMode,hideMenu:t.params.hideMenu}})})),c(this,"getMiniAppUrl",(function(e,n){var o=K.get(),i=o.connectDomain,r=o.appId,a=o.superAppToken,s=o._debug,c=b({app:t.params.app,host_app_id:r,debug:s?"1":"",localhost:s?"1":"",superapp_token:a,app_query:e?JSON.stringify(e):"",app_hash:n||""});return"https://".concat(i,"/mini_app?").concat(c)})),c(this,"resolveReadyPromise",(function(){t.readyPromise&&t.readyPromiseResolve&&(t.readyPromiseResolve(),t.readyPromise=null,t.readyPromiseResolve=null)})),c(this,"openMiniapp",(function(n){t.child=new e({app:n.app_id,stackMode:t.params.stackMode}),t.events.emit(exports.MiniAppEvents.CREATE_APP,{app:t.child,location:n.location})})),c(this,"openPayForm",(function(n){var o=u({},n.params);o.data&&(o.data=JSON.stringify(o.data));var i=u({},o,{app_id:n.app_id,action:n.action}),r=new e({app:6217559,stackMode:t.params.stackMode});r.open(i).then((function(){return t.hide()})).catch(console.error),r.events.on(exports.MiniAppEvents.MESSAGE,(function(e){t.handleVKPayFormMessage(e),r.close(),t.show()})),r.events.on(exports.MiniAppEvents.HIDE,(function(){r.close(),t.close()}))})),c(this,"handleVKPayFormMessage",(function(e){e.handler===X.ACTION_DONE&&t.sendMessage(e)})),this.params=u({},n,{app:"number"==typeof n.app?"app".concat(n.app):n.app}),this.events=N()},ie=function(){function e(){r(this,e),c(this,"stack",[])}return s(e,[{key:"removeMiniApp",value:function(e){var n=e.app,t=this.stack.lastIndexOf(n);if(t>-1&&t===this.stack.length-1)if(this.stack.splice(t,1),this.stack.length){this.stack[this.stack.length-1].show();var o=this.stack[this.stack.length-2];setTimeout((function(){return null==o?void 0:o.hide()}),0)}else ne.restoreBodyOverflow()}},{key:"makeHandleMiniAppClose",value:function(e){var n=this,t=e.app;return function(){n.removeMiniApp({app:t})}}},{key:"makeHandleMiniAppHide",value:function(e){var n=this,t=e.app;return function(){var e=n.stack.lastIndexOf(t);e>-1&&e===n.stack.length-1&&setTimeout((function(){return t.close()}),0)}}},{key:"handleMiniAppCreate",value:function(e){var n=e.app,t=e.query,o=e.hash;this.stack.push(n),n.open(t,o).catch(console.error),n.events.on(exports.MiniAppEvents.CREATE_APP,this.handleMiniAppCreate.bind(this)),n.events.on(exports.MiniAppEvents.HIDE,this.makeHandleMiniAppHide({app:n})),n.events.on(exports.MiniAppEvents.CLOSE,this.makeHandleMiniAppClose({app:n})),ne.freezeBodyOverflow();var i=this.stack[this.stack.length-2];return setTimeout((function(){null==i||i.hide()}),0),n}},{key:"open",value:function(e){var n=e.app,t=e.query,o=e.hash,i=new oe({app:n,stackMode:!0});return this.handleMiniAppCreate({app:i,query:t,hash:o}),i}},{key:"close",value:function(){var e=this.stack;this.stack.splice(0),e.reverse().forEach((function(e){return e.close()})),ne.restoreBodyOverflow()}},{key:"length",get:function(){return this.stack.length}}]),e}();!function(e){e.STATIC_MAP="VKSDKRequestToGeoservice:staticmap/png/",e.SEARCH="VKSDKRequestToGeoservice:search",e.OVERALL="VKSDKRequestToGeoservice:overall",e.DIRECTIONS="VKSDKRequestToGeoservice:directions",e.ISO="VKSDKRequestToGeoservice:iso"}(te||(te={}));var re=function(){function e(n){var t=this,o=n.apiKey;r(this,e),c(this,"iframe",void 0),c(this,"bridge",void 0),c(this,"requestMap",void 0),c(this,"apiKey",void 0),this.apiKey=o;var i=document.createElement("iframe"),a=K.get().appId;i.src=this.getGeoserviceProxyUrl({app_id:a}),i.style.cssText="\n display: none;\n ",this.iframe=i,document.body.appendChild(this.iframe),this.bridge=new J({iframe:this.iframe,origin:"https://"+K.get().connectDomain}),this.requestMap={},this.bridge.onMessage((function(e){var n=e.params,o=n.requestID,i=n.response;t.requestMap[o].resolve(i),delete t.requestMap[o]}))}return s(e,[{key:"setApiKey",value:function(e){this.apiKey=e}},{key:"getGeoserviceProxyUrl",value:function(e){var n=K.get(),t=n.connectDomain,o=n._debug,i=u({},e||{},{origin:location.protocol+"//"+location.host,localhost:String(location.host.includes("localhost")),debug:location.host.includes("localhost")?1:String(o)});return"https://".concat(t,"/geoservice?").concat(b(i))}},{key:"prepareAnswer",value:function(e,n,t){var o=this,i=h();return this.bridge.sendMessage({handler:"VKSDKRequestToGeoservice:".concat(e),params:u({},n,{api_key:this.apiKey,wrapRequestInJSON:t,requestID:i})}),new Promise((function(e,n){o.requestMap[i]={resolve:e,reject:n}}))}},{key:"getStaticMap",value:function(e){return this.prepareAnswer("staticmap/png/",e)}},{key:"encodeCoords",value:function(e){return this.prepareAnswer("search",e)}},{key:"decodeCoords",value:function(e){return this.prepareAnswer("overall",e)}},{key:"getDirections",value:function(e){return this.prepareAnswer("directions",e,!0)}},{key:"getISO",value:function(e){return this.prepareAnswer("iso",e,!0)}}]),e}(),ae={OneTapAuthEventsSDK:q,FloatingOneTapAuthEventsSDK:B,ButtonOneTapAuthEventsSDK:Z,DataPolicyEventsSDK:F,AuthCaptchaEventsSDK:z};exports.BodyOverflowManager=ne,exports.Config=K,exports.Connect=ee,exports.ConnectEvents=ae,exports.GeoService=re,exports.MiniApp=oe,exports.MiniAppService=ie; |
@@ -1,1 +0,1 @@ | ||
import e from"@babel/runtime/helpers/typeof";import"@babel/runtime/helpers/toConsumableArray";import n from"@babel/runtime/helpers/defineProperty";import"@babel/runtime/helpers/classCallCheck";import"@babel/runtime/helpers/createClass";function t(e){return(t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function o(e,n){if(!(e instanceof n))throw new TypeError("Cannot call a class as a function")}function i(e,n){for(var t=0;t<n.length;t++){var o=n[t];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}function a(e,n,t){return n&&i(e.prototype,n),t&&i(e,t),e}function r(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function s(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);n&&(o=o.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,o)}return t}function c(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?s(Object(t),!0).forEach((function(n){r(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):s(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}var p,u="ModuleSymbhasOwnPr-0123456789ABCDEFGHNRVfgctiUvz_KqYTJkLxpZXIjQW",d=function(){for(var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:21,n="",t=e;t--;)n+=u[64*Math.random()|0];return n},l=["agreements","promo","vkc_behavior","vkc_auth_action","vkc_brand","vkc_display_mode","service_groups","external_device_id"];!function(e){e[e.UNKNOWN=1]="UNKNOWN",e[e.MISSING_PARAM=2]="MISSING_PARAM",e[e.CONNECTION_LOST=3]="CONNECTION_LOST",e[e.USER_DENIED=4]="USER_DENIED",e[e.INVALID_PARAMS=5]="INVALID_PARAMS",e[e.CUSTOM=6]="CUSTOM",e[e.CONNECT_WINDOW_CLOSED=7]="CONNECT_WINDOW_CLOSED",e[e.CONNECT_WINDOW_NOT_OPENED=8]="CONNECT_WINDOW_NOT_OPENED",e[e.CONNECT_DOMAIN_NOT_ALLOWED=9]="CONNECT_DOMAIN_NOT_ALLOWED",e[e.CONNECT_UNKNOWN_SDK_MESSAGE=10]="CONNECT_UNKNOWN_SDK_MESSAGE",e[e.OLD_MISSING_PARAM=100]="OLD_MISSING_PARAM"}(p||(p={}));var h=function(){return"Connect window was closed."},f=function(){return"Connect window was not opened."},m=function(e){return'URL domain "'.concat(e,'" is not allowed.')},y=function(e){return"This SDK message is unknown: ".concat(e)},v=!("undefined"==typeof window||!window.document||!window.document.createElement),A=v&&!!window.addEventListener,g=function(){};if(A)try{var O=Object.defineProperty({},"passive",{get:function(){!0}});window.addEventListener("test",g,O),window.removeEventListener("test",g,O)}catch(e){}!function(){if(!v)return!1;var e=!1;try{document.createElement("div").scrollTo({top:0,get behavior(){return e=!0,"smooth"}})}catch(e){}}();function _(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);n&&(o=o.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,o)}return t}function E(e){for(var t=1;t<arguments.length;t++){var o=null!=arguments[t]?arguments[t]:{};t%2?_(Object(o),!0).forEach((function(t){n(e,t,o[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(o)):_(Object(o)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(o,n))}))}return e}var w={parse:function(e){if("string"!=typeof e)return{};if(!(e=e.trim().replace(/^[?#&]/,"")))return{};var n=/\?(.+)$/gi.exec(e);return(n?n[1]:e).split("&").reduce((function(e,n){var t=n.split("=");return t[1]&&(e[t[0]]=decodeURIComponent(t[1])),e}),{})},stringify:function(n){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if("object"!==e(n)||null===n)return"";t=E({encode:!0},t);var o=function(e){return t.encode?encodeURIComponent(e):String(e)};return Object.keys(n).reduce((function(e,i){var a=n[i];return void 0===a?e:null===a?(t.skipNull||e.push([o(i),""].join("=")),e):Array.isArray(a)?(a.map((function(n){e.push("".concat(o(i),"[]=").concat(o(n)))})).join(),e):(e.push([o(i),o(a)].join("=")),e)}),[]).join("&")}};function S(e){return w.stringify(e)}function T(e){return Object.keys(e).filter((function(e){return l.includes(e)}))}function D(e){var n;return Boolean(null===(n=T(e))||void 0===n?void 0:n.length)}function P(e){var n=function(e){return T(e).reduce((function(n,t){return n[t]=e[t],n}),{})}(e);return btoa(JSON.stringify(n))}function b(e,n){var t,o=document.createElement("iframe");for(var i in e&&(o.src=e),o.style.cssText=null!==(t=null==n?void 0:n.cssText)&&void 0!==t?t:"",o.width="100%",o.height="100%",o.style.border="none",null==n?void 0:n.properties){var a;if(n&&n.properties.hasOwnProperty(i))o[i]=null!==(a=n.properties[i])&&void 0!==a?a:""}return o}function C(e){return e=e||Object.create(null),{on:function(n,t){(e[n]||(e[n]=[])).push(t)},off:function(n,t){e[n]&&e[n].splice(e[n].indexOf(t)>>>0,1)},emit:function(n,t){(e[n]||[]).slice().map((function(e){e(t)})),(e["*"]||[]).slice().map((function(e){e(n,t)}))}}}var k={appId:0,superAppToken:"",loginDomain:"login.vk.com",oauthDomain:"oauth.vk.com",connectDomain:"connect.vk.com",_debug:!1},N={},I={events:C(),init:function(e){if(!e.appId)throw new Error("appId required");k.appId=e.appId,k.superAppToken=e.superAppToken||"",k.loginDomain=e.loginDomain||"login.vk.com",k.oauthDomain=e.oauthDomain||"oauth.vk.com",k.connectDomain=e.connectDomain||"connect.vk.com",k.appSettings=e.appSettings,k._debug=!!e._debug},get:function(){return k},setSuperAppToken:function(e){k.superAppToken=e,I.events.emit("superAppToken",e)},onRequestSuperAppToken:function(e){N.superAppToken=e},_requestSuperAppToken:function(){var e;N.superAppToken&&(e=N.superAppToken()),e&&e.then((function(e){return I.setSuperAppToken(e)})).catch(console.error)},onAuth:function(e){N.auth=e},_requestAuth:function(){var e;N.auth&&(e=N.auth()),e&&e.then((function(e){return I.setSuperAppToken(e)})).catch(console.error)},onOpenApp:function(e){N.openApp=e},_openApp:function(e){N.openApp&&N.openApp(e.app)}},M=["extend_token","login_with_user","__sferum_invite_link"];function K(e){return e&&M.includes(e.name)?btoa(JSON.stringify(e)):""}var R;function L(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"auth",t=I.get(),o=t.appId,i=t.connectDomain,a=t.appSettings,r=c({app_id:o,response_type:"silent_token",v:"0.0.2"},e);a&&D(a)&&(r.app_settings=P(a));var s=S(r);return"https://".concat(i,"/").concat(n,"?").concat(s)}!function(e){e.Default="default",e.NamePhone="name_phone",e.PhoneName="phone_name"}(R||(R={}));var H=[R.Default,R.NamePhone,R.PhoneName];function V(e,n){return void 0===e?n:"number"!=typeof e?e?1:0:e}function U(e,n){return e&&"object"===t(e)?Object.keys(e).reduce((function(t,o){return n.includes(o)?(t[o]=e[o],t):t}),{}):e}var x,W,G,j,Y,F,z=function e(n){var t=this;o(this,e),r(this,"handler",(function(){return{}})),r(this,"config",void 0),r(this,"destroy",(function(){delete t.config,window.removeEventListener("message",t.handleMessage)})),r(this,"onMessage",(function(e){t.handler=e})),r(this,"sendMessage",(function(e){t.config.iframe.contentWindow.postMessage(c({type:"vk-sak-sdk"},e),t.config.origin)})),r(this,"handleMessage",(function(e){t.config.origin&&e.origin===t.config.origin&&e.source===t.config.iframe.contentWindow&&e.data&&"vk-sak-sdk"===e.data.type&&t.handler(e.data)})),this.config=n,window.addEventListener("message",this.handleMessage)};!function(e){e.SHOW_DATA_POLICY="VKSDKOneTapAuthConnectDataPolicy",e.HIDE_DATA_POLICY="VKSDKOneTapAuthDataPolicyClose",e.DATA_POLICY_RESULT="VKSDKOneTapAuthDataPolicyResult",e.SHOW_CAPTCHA="VKSDKOneTapAuthDataPolicyShowCaptcha"}(x||(x={})),function(e){e.SHOW_POLICY_AGREEMENTS="VKSDKOneTapAuthPolicyAgreementsShow",e.HIDE_POLICY_AGREEMENTS="VKSDKOneTapAuthPolicyAgreementsHide",e.ACCEPT_POLICY_AGREEMENTS="VKSDKOneTapAuthPolicyAgreementsAccept",e.DECLINE_POLICY_AGREEMENTS="VKSDKOneTapAuthPolicyAgreementsDecline",e.POLICY_AGREEMENTS_ERROR="VKSDKOneTapAuthPolicyAgreementsError",e.SHOW_DATA_POLICY="VKSDKOneTapAuthPolicyAgreementsShowDataPolicy"}(W||(W={})),function(e){e.CAPTCHA_SUCCESS="VKSDKAuthCaptchaSuccess",e.CAPTCHA_FAIL="VKSDKAuthCaptchaFail"}(G||(G={})),function(e){e.PHONE_VALIDATION_NEEDED="VKSDKOneTapAuthPhoneValidationNeeded",e.FULL_AUTH_NEEDED="VKSDKOneTapAuthFullAuthNeeded",e.AUTH_DATA_LOADED="VKSDKOneTapAuthDataLoaded",e.NOT_AUTHORIZED="VKSDKOneTapAuthNotAuthorized",e.LOGIN_SUCCESS="VKSDKOneTapAuthLoginSuccess",e.RESIZE_FRAME="VKSDKOneTapResizeFrame",e.SHOW_CAPTCHA="VKSDKOneTapShowCaptcha",e.VALIDATE_CAPTCHA="VKSDKOneTapValidateCaptcha"}(j||(j={})),function(e){e.CLOSE_AUTH="VKSDKOneTapAuthClose",e.ADAPTIVITY_CHANGE="VKSDKFloatingOneTapAdaptivityChange",e.ADAPTIVITY_CHANGED="VKSDKFloatingOneTapAdaptivityChanged"}(Y||(Y={})),function(e){e.SHOW_LOGIN="VKSDKButtonOneTapAuthShowLogin",e.SHOW_LOGIN_OPTIONS="VKSDKButtonOneTapAuthShowLoginOptions",e.SHOW_AGREEMENTS_DIALOG="VKSDKButtonOneTapAuthShowAgreementsDialog",e.START_AUTHORIZE="VKSDKButtonOneTapAuthStartAuthorize"}(F||(F={}));var q,B,Z,J=new function e(){var n=this;o(this,e),r(this,"flags",null),r(this,"silentAuth",(function(){var e=I.get(),n=e.loginDomain,t=e.appId,o=d(),i="https://".concat(n,"/?act=connect&app_id=").concat(t,"&response_type=").concat("silent_token","&uuid=").concat(o,"&v=").concat("0.0.2"),a=new XMLHttpRequest;return a.open("GET",i,!0),a.responseType="json",a.withCredentials=!0,new Promise((function(e,n){a.onload=function(){a.response?e({provider:"vk",payload:a.response}):n()},a.onerror=function(){n()},a.send()}))})),r(this,"oneTapAuth",(function(e,t){if(console.warn("Connect.oneTapAuth method is deprecated. Use Connect.floatingOneTapAuth and Connect.buttonOneTapAuth methods."),!["floating","button"].includes(e))return null;switch(e){case"button":return n.buttonOneTapAuth(t);case"floating":return n.floatingOneTapAuth(t);default:return null}})),r(this,"floatingOneTapAuth",(function(e){var t,o,i=function(){var e,n=window.innerWidth,t=n<=768;return{destroy:function(){return window.removeEventListener("resize",e)},isAdaptive:function(){return t},observe:function(o){e=function(){var e=window.innerWidth;n>768&&e<=768?o(t=!0):n<=768&&e>768&&o(t=!1),n=e},window.addEventListener("resize",e)}}}(),a=(t=i.isAdaptive(),o=t?"314px":"334px",{pageUrl:"floating_one_tap_auth",pageUrlParams:{adaptive:t?1:0},frameStyles:t?"\n display: none;\n position: fixed;\n bottom: 0;\n right: 50%;\n transform: translate(50%, 0);\n max-width: 468px;\n width: 100%;\n height: ".concat(o,";\n "):"\n display: none;\n position: fixed;\n top: 0;\n right: 0;\n max-width: 400px;\n width: 100%;\n height: ".concat(o,";\n ")});if(!a)throw new Error("options were not set");var r=d(),s=b(L(c({origin:location.protocol+"//"+location.host,uuid:r},a.pageUrlParams),a.pageUrl),{cssText:a.frameStyles}),p=new z({iframe:s,origin:"https://"+I.get().connectDomain});i.observe((function(e){p.sendMessage({handler:Y.ADAPTIVITY_CHANGE,params:{uuid:r,is_adaptive:e}}),e?(s.style.maxWidth="468px",s.style.top="auto",s.style.bottom="0",s.style.right="50%",s.style.transform="translate(50%, 0)"):(s.style.maxWidth="400px",s.style.top="0",s.style.bottom="auto",s.style.right="0",s.style.transform="none"),s.style.display="none"})),document.body.appendChild(s);var u=function(){p.sendMessage({handler:j.RESIZE_FRAME,params:{uuid:r}})};window.addEventListener("resize",u);var l=function(){s&&(s.remove(),s=null),window.removeEventListener("resize",u),i&&i.destroy(),p.destroy()},h=new Promise((function(t){p.onMessage((function(o){if(o.params.uuid===r)switch(o.handler){case j.NOT_AUTHORIZED:e.callback({type:o.handler,payload:{uuid:r,error:"not_authorized"}}),l(),t(o.handler);break;case j.RESIZE_FRAME:s.style.height="".concat(o.params.height,"px");break;case Y.CLOSE_AUTH:e.callback({type:o.handler,payload:{uuid:r}}),l();break;case Y.ADAPTIVITY_CHANGED:s.style.display="block";break;case j.AUTH_DATA_LOADED:s.style.display="block",t(o.handler);default:n.handleOneTapEvents(o,p,e)}}))}));return{getFrame:function(){return s},destroy:l,authReadyPromise:h}})),r(this,"buttonOneTapAuth",(function(e){var t=function(e){var n={},t=44;if(e){n.display=e.displayMode&&H.includes(e.displayMode)?e.displayMode:"default",n.show_agreements=V(e.showAgreements,0),n.show_alternative_login=V(e.showAlternativeLogin,0),n.show_agreements_dialog=V(e.showAgreementsDialog,1);t+=n.show_alternative_login?56:0,t+=n.show_agreements?80:0}return{pageUrl:"button_one_tap_auth",pageUrlParams:n,frameStyles:"\n height: ".concat(t,"px;\n ")}}(e.options);if(!t)throw new Error("options were not set");var o=d(),i=b(L(c({origin:location.protocol+"//"+location.host,uuid:o},t.pageUrlParams),t.pageUrl),{cssText:t.frameStyles}),a=e.container;a&&a.appendChild(i);var r=new z({iframe:i,origin:"https://"+I.get().connectDomain}),s=function(){r.sendMessage({handler:j.RESIZE_FRAME,params:{uuid:o}})};window.addEventListener("resize",s);return{getFrame:function(){return i},destroy:function(){i&&(i.remove(),i=null),window.removeEventListener("resize",s),r.destroy()},authReadyPromise:new Promise((function(t){r.onMessage((function(a){if(a.params.uuid===o)switch(a.handler){case j.RESIZE_FRAME:i.style.height="".concat(a.params.height,"px");break;case j.NOT_AUTHORIZED:t(a.handler);break;case F.SHOW_LOGIN:case F.SHOW_LOGIN_OPTIONS:e.callback({type:a.handler,payload:{uuid:o}});break;case F.SHOW_AGREEMENTS_DIALOG:n.userPolicyAgreements(o).show().then((function(e){e&&e.accepted&&r.sendMessage({handler:F.START_AUTHORIZE,params:{uuid:o}})})).catch((function(){r.sendMessage({handler:W.DECLINE_POLICY_AGREEMENTS,params:{uuid:o}})}));break;case j.AUTH_DATA_LOADED:t(a.handler);default:n.handleOneTapEvents(a,r,e)}}))}))}})),r(this,"handleOneTapEvents",(function(e,t,o){var i=e.params.uuid;switch(e.handler){case j.AUTH_DATA_LOADED:t.sendMessage({handler:j.RESIZE_FRAME,params:{uuid:i}});break;case j.LOGIN_SUCCESS:o.callback({type:e.handler,provider:"vk",payload:e.params});break;case j.SHOW_CAPTCHA:var a=n.captcha(i,{captcha_sid:e.params.captcha_sid,captcha_img:e.params.captcha_img});a.show().then((function(e){t.sendMessage({handler:G.CAPTCHA_SUCCESS,params:c({uuid:i},e)})})).catch((function(){t.sendMessage({handler:G.CAPTCHA_FAIL,params:{uuid:i}}),a.destroy()}));break;case x.SHOW_DATA_POLICY:n.userDataPolicy(i).show().then((function(){o.callback({type:x.DATA_POLICY_RESULT,payload:{uuid:i,policyAccepted:!0}})})).catch((function(){o.callback({type:x.DATA_POLICY_RESULT,payload:{uuid:i,policyAccepted:!1}})}));break;case j.FULL_AUTH_NEEDED:case j.PHONE_VALIDATION_NEEDED:o.callback({type:e.handler,payload:{uuid:i}})}})),r(this,"userDataPolicy",(function(e){var t=L({origin:location.protocol+"//"+location.host,uuid:e},"user_data_policy"),o=window.innerHeight,i="\n display: none;\n position: fixed;\n top: 0;\n left: 0;\n width: 100%;\n height: ".concat(o,"px;\n min-height: ").concat(o,"px;\n border: none;\n z-index: 99999;\n "),a=b(t,{properties:{height:"".concat(o,"px")},cssText:i});document.body.appendChild(a);var r=new z({iframe:a,origin:"https://"+I.get().connectDomain}),s=function(){a.style.display="none"};return{show:function(){return a.style.display="block",new Promise((function(t,o){r.onMessage((function(i){switch(i.handler){case x.HIDE_DATA_POLICY:s(),t();break;case x.SHOW_CAPTCHA:var p=n.captcha(e,{captcha_sid:i.params.captcha_sid,captcha_img:i.params.captcha_img});p.show().then((function(n){r.sendMessage({handler:G.CAPTCHA_SUCCESS,params:c({uuid:e},n)}),a.style.display="block"})).catch((function(){r.sendMessage({handler:G.CAPTCHA_FAIL,params:{uuid:e}}),p.destroy()})),s();break;default:s(),o()}}))}))},hide:s,destroy:function(){document.body.removeChild(a),r.destroy()}}})),r(this,"userPolicyAgreements",(function(e){var t,o,i,a=L({origin:location.protocol+"//"+location.host,uuid:e},"user_policy_agreements"),r=(t=a,o=window.innerHeight,i="\n display: none;\n position: fixed;\n top: 0;\n left: 0;\n width: 100%;\n height: ".concat(o,"px;\n min-height: ").concat(o,"px;\n border: none;\n z-index: 99999;\n "),b(t,{properties:{height:"".concat(o,"px")},cssText:i}));document.body.appendChild(r);var s=new z({iframe:r,origin:"https://"+I.get().connectDomain}),c=function(){r.style.display="none"};return{show:function(){return r.style.display="block",new Promise((function(t,o){s.onMessage((function(i){switch(i.handler){case W.ACCEPT_POLICY_AGREEMENTS:c(),t({accepted:!0});break;case W.DECLINE_POLICY_AGREEMENTS:c(),t({accepted:!1});break;case W.SHOW_DATA_POLICY:c();var a=function(){r.style.display="block"};n.userDataPolicy(e).show().then(a).catch(a);break;case W.POLICY_AGREEMENTS_ERROR:case W.HIDE_POLICY_AGREEMENTS:default:c(),o()}}))}))},hide:c,destroy:function(){document.body.removeChild(r),s.destroy()}}})),r(this,"captcha",(function(e,n){var t=L(c({origin:location.protocol+"//"+location.host,uuid:e},n),"auth_captcha"),o=window.innerHeight,i=b(t,{cssText:"\n display: none;\n position: fixed;\n top: 0;\n left: 0;\n width: 100%;\n height: ".concat(o,"px;\n min-height: ").concat(o,"px;\n border: none;\n z-index: 99999;\n ")});document.body.appendChild(i);var a=new z({iframe:i,origin:"https://"+I.get().connectDomain}),r=function(){document.body.removeChild(i),a.destroy()};return{show:function(){return i.style.display="block",new Promise((function(e,n){a.onMessage((function(t){switch(t.handler){case G.CAPTCHA_SUCCESS:e(t.params),r();break;default:n(),r()}}))}))},destroy:r}})),r(this,"userVisibleAuth",(function(e){var t=d(),o=c({origin:location.protocol+"//"+location.host,uuid:t},U(e,["screen","source"])),i=K(null==e?void 0:e.action);i&&(o.action=i);var a=L(o);n.flags&&(a="".concat(a,"#").concat(S(n.flags)));var r=screen.height/2-280,s=screen.width/2-410,u=window.open(a,"_blank","top=".concat(r,",left=").concat(s,",width=").concat(820,",height=").concat(560,",location"));if(!u){var l={code:p.CONNECT_WINDOW_NOT_OPENED,reason:f()};return Promise.reject(l)}return new Promise((function(e,n){var o=setInterval((function(){if(!u||u.closed){window.removeEventListener("message",i),clearInterval(o);var e={code:p.CONNECT_WINDOW_CLOSED,reason:h()};n(e)}}),1e3);function i(a){if(a.source===u&&u)if(window.removeEventListener("message",i),clearInterval(o),".vk.com"===a.origin.slice(a.origin.length-".vk.com".length))if(a.data.action==="vk_connect_response"+t){var r=a.data.payload;u.close(),e({provider:"vk",payload:r})}else if(a.data.action==="oauth_callback"+t)e({provider:a.data.payload.name}),u.close();else if(a.data.action==="skip_callback"+t){var s=a.data.payload.redirectURL;s&&(window.location.href=s),u.close()}else{u.close();var c={code:p.CONNECT_UNKNOWN_SDK_MESSAGE,reason:y(JSON.stringify(a.data))};n(c)}else{u.close();var d={code:p.CONNECT_DOMAIN_NOT_ALLOWED,reason:m(a.origin)};n(d)}}window.addEventListener("message",i)}))})),r(this,"redirectAuth",(function(e){var n=d(),t=c({redirect_uri:e.url,uuid:n},U(e,["screen","source"])),o=K(null==e?void 0:e.action);o&&(t.action=o),(null==e?void 0:e.state)&&(t.redirect_state=e.state);var i=L(t);location.assign(i)}))},X=new(function(){function e(){o(this,e),r(this,"savedStyles",[]),r(this,"bodyScrollYValue",window.pageYOffset||window.scrollY),r(this,"isFreezed",!1)}return a(e,[{key:"freezeBodyOverflow",value:function(){if(!this.isFreezed){this.isFreezed=!0;var e=(t=window.document.documentElement.clientWidth,Math.abs(window.innerWidth-t)),n=parseInt(window.getComputedStyle(window.document.body).paddingRight,10)||0;this.bodyScrollYValue=window.pageYOffset||window.scrollY,this.savedStyles=[],this.savedStyles.push({value:window.document.body.style.paddingRight,property:"padding-right"},{value:window.document.body.style.overflow,property:"overflow"},{value:window.document.body.style.overflowX,property:"overflow-x"},{value:window.document.body.style.overflowY,property:"overflow-y"}),window.document.body.style.setProperty("overflow","hidden"),window.document.body.style.setProperty("padding-right","".concat(e+n,"px"))}var t}},{key:"restoreBodyOverflow",value:function(){this.isFreezed&&(this.savedStyles.forEach((function(e){var n=e.value,t=e.property;n?window.document.body.style.setProperty(t,n):window.document.body.style.removeProperty(t)})),window.scrollTo(0,this.bodyScrollYValue),this.isFreezed=!1)}}]),e}());!function(e){e.APP_CLOSE="VKWebAppClose",e.APP_READY="VKSDKMiniAppReady",e.RESIZE="VKSDKMiniAppResize",e.APP_INIT_CONFIG="VKSDKMiniAppInitConfig",e.OPEN_APP="VKWebAppOpenApp",e.OPEN_PAY_FORM="VKWebAppOpenPayForm",e.ACTION_DONE="VKWebAppActionDone"}(q||(q={})),function(e){e.OPEN="open",e.HIDE="hide",e.CLOSE="close",e.SHOW="show",e.MESSAGE="message",e.CREATE_APP="createapp"}(B||(B={})),function(e){e.SUPERAPP_TOKEN="VKSDKGeneralSuperAppToken",e.AUTH_NEEDED="VKSDKGeneralAuthNeeded",e.OPEN_APP="VKSDKGeneralOpenApp"}(Z||(Z={}));var Q,$=function e(n){var t=this;o(this,e),r(this,"events",void 0),r(this,"iframe",void 0),r(this,"bridge",void 0),r(this,"loading",void 0),r(this,"readyPromiseResolve",null),r(this,"readyPromise",null),r(this,"params",void 0),r(this,"child",null),r(this,"open",(function(e,n){return t.loading?(t.iframe.src=t.getMiniAppUrl(e,n),t.loading=new Promise((function(e){t.iframe.onload=function(){t.iframe.onload=null,e()}})),t.readyPromise=new Promise((function(e){return t.readyPromiseResolve=e}))):t.preload(e,n).catch(console.error),t.iframe.style.display="block",t.params.stackMode||X.freezeBodyOverflow(),t.loading.then(t.handleResize).catch(console.error),t.events.emit(B.OPEN),t.readyPromise})),r(this,"hide",(function(){t.iframe.style.display="none",t.params.stackMode||X.restoreBodyOverflow(),t.events.emit(B.HIDE)})),r(this,"close",(function(){t.params.stackMode||X.restoreBodyOverflow(),I.events.off("superAppToken",t.onSuperAppToken),t.iframe&&t.iframe.remove(),t.bridge&&t.bridge.destroy(),delete t.iframe,delete t.bridge,window.removeEventListener("resize",t.handleResize),t.events.emit(B.CLOSE)})),r(this,"show",(function(){if(!t.loading)throw new Error('App is not loaded, use "open" or "preload" methods');t.iframe.style.display="block",t.params.stackMode||X.freezeBodyOverflow(),t.events.emit(B.SHOW)})),r(this,"preload",(function(e,n){var o=document.createElement("iframe"),i=window.innerHeight,a=isFinite(t.params.zIndex)?t.params.zIndex:999999;return o.src=t.getMiniAppUrl(e,n),o.setAttribute("allow","geolocation"),o.style.cssText="\n display: none;\n position: fixed;\n top: 0;\n left: 0;\n width: 100%;\n height: ".concat(i,"px;\n min-height: ").concat(i,"px;\n border: none;\n z-index: ").concat(a,";\n "),t.iframe=o,document.body.appendChild(t.iframe),I.events.on("superAppToken",t.onSuperAppToken),t.bridge=new z({iframe:t.iframe,origin:"https://"+I.get().connectDomain}),t.bridge.onMessage(t.handleMessage),window.addEventListener("resize",t.handleResize),t.loading=new Promise((function(e){o.onload=function(){o.onload=null,e()}})),t.readyPromise=new Promise((function(e){return t.readyPromiseResolve=e})),t.loading})),r(this,"sendMessage",(function(e){t.bridge.sendMessage(e)})),r(this,"onSuperAppToken",(function(e){t.bridge.sendMessage({handler:Z.SUPERAPP_TOKEN,params:{result:e}})})),r(this,"handleMessage",(function(e){switch(e.handler){case q.APP_CLOSE:t.hide();break;case q.APP_READY:t.resolveReadyPromise(),t.handleUpdateConfig();break;case q.OPEN_APP:t.openMiniapp(e.params);break;case q.OPEN_PAY_FORM:t.openPayForm(e.params);break;case Z.SUPERAPP_TOKEN:I._requestSuperAppToken();break;case Z.AUTH_NEEDED:I._requestAuth();break;default:t.events.emit(B.MESSAGE,e)}})),r(this,"handleResize",(function(){if(t.iframe){var e=innerWidth,n=innerHeight;t.iframe.style.height="".concat(n,"px"),t.iframe.style.minHeight="".concat(n,"px"),t.bridge.sendMessage({handler:q.RESIZE,params:{viewport_width:e,viewport_height:n}})}})),r(this,"handleUpdateConfig",(function(){t.bridge.sendMessage({handler:q.APP_INIT_CONFIG,params:{fullMode:t.params.fullMode,hideMenu:t.params.hideMenu}})})),r(this,"getMiniAppUrl",(function(e,n){var o=I.get(),i=o.connectDomain,a=o.appId,r=o.superAppToken,s=o._debug,c=S({app:t.params.app,host_app_id:a,debug:s?"1":"",localhost:s?"1":"",superapp_token:r,app_query:e?JSON.stringify(e):"",app_hash:n||""});return"https://".concat(i,"/mini_app?").concat(c)})),r(this,"resolveReadyPromise",(function(){t.readyPromise&&t.readyPromiseResolve&&(t.readyPromiseResolve(),t.readyPromise=null,t.readyPromiseResolve=null)})),r(this,"openMiniapp",(function(n){t.child=new e({app:n.app_id,stackMode:t.params.stackMode}),t.events.emit(B.CREATE_APP,{app:t.child,location:n.location})})),r(this,"openPayForm",(function(n){var o=c({},n.params);o.data&&(o.data=JSON.stringify(o.data));var i=c({},o,{app_id:n.app_id,action:n.action}),a=new e({app:6217559,stackMode:t.params.stackMode});a.open(i).then((function(){return t.hide()})).catch(console.error),a.events.on(B.MESSAGE,(function(e){t.handleVKPayFormMessage(e),a.close(),t.show()})),a.events.on(B.HIDE,(function(){a.close(),t.close()}))})),r(this,"handleVKPayFormMessage",(function(e){e.handler===q.ACTION_DONE&&t.sendMessage(e)})),this.params=c({},n,{app:"number"==typeof n.app?"app".concat(n.app):n.app}),this.events=C()},ee=function(){function e(){o(this,e),r(this,"stack",[])}return a(e,[{key:"removeMiniApp",value:function(e){var n=e.app,t=this.stack.lastIndexOf(n);if(t>-1&&t===this.stack.length-1)if(this.stack.splice(t,1),this.stack.length){this.stack[this.stack.length-1].show();var o=this.stack[this.stack.length-2];setTimeout((function(){return null==o?void 0:o.hide()}),0)}else X.restoreBodyOverflow()}},{key:"makeHandleMiniAppClose",value:function(e){var n=this,t=e.app;return function(){n.removeMiniApp({app:t})}}},{key:"makeHandleMiniAppHide",value:function(e){var n=this,t=e.app;return function(){var e=n.stack.lastIndexOf(t);e>-1&&e===n.stack.length-1&&setTimeout((function(){return t.close()}),0)}}},{key:"handleMiniAppCreate",value:function(e){var n=e.app,t=e.query,o=e.hash;this.stack.push(n),n.open(t,o).catch(console.error),n.events.on(B.CREATE_APP,this.handleMiniAppCreate.bind(this)),n.events.on(B.HIDE,this.makeHandleMiniAppHide({app:n})),n.events.on(B.CLOSE,this.makeHandleMiniAppClose({app:n})),X.freezeBodyOverflow();var i=this.stack[this.stack.length-2];return setTimeout((function(){null==i||i.hide()}),0),n}},{key:"open",value:function(e){var n=e.app,t=e.query,o=e.hash,i=new $({app:n,stackMode:!0});return this.handleMiniAppCreate({app:i,query:t,hash:o}),i}},{key:"close",value:function(){var e=this.stack;this.stack.splice(0),e.reverse().forEach((function(e){return e.close()})),X.restoreBodyOverflow()}},{key:"length",get:function(){return this.stack.length}}]),e}();!function(e){e.STATIC_MAP="VKSDKRequestToGeoservice:staticmap/png/",e.SEARCH="VKSDKRequestToGeoservice:search",e.OVERALL="VKSDKRequestToGeoservice:overall",e.DIRECTIONS="VKSDKRequestToGeoservice:directions",e.ISO="VKSDKRequestToGeoservice:iso"}(Q||(Q={}));var ne=function(){function e(n){var t=this,i=n.apiKey;o(this,e),r(this,"iframe",void 0),r(this,"bridge",void 0),r(this,"requestMap",void 0),r(this,"apiKey",void 0),this.apiKey=i;var a=document.createElement("iframe"),s=I.get().appId;a.src=this.getGeoserviceProxyUrl({app_id:s}),a.style.cssText="\n display: none;\n ",this.iframe=a,document.body.appendChild(this.iframe),this.bridge=new z({iframe:this.iframe,origin:"https://"+I.get().connectDomain}),this.requestMap={},this.bridge.onMessage((function(e){var n=e.params,o=n.requestID,i=n.response;t.requestMap[o].resolve(i),delete t.requestMap[o]}))}return a(e,[{key:"setApiKey",value:function(e){this.apiKey=e}},{key:"getGeoserviceProxyUrl",value:function(e){var n=I.get(),t=n.connectDomain,o=n._debug,i=c({},e||{},{origin:location.protocol+"//"+location.host,localhost:String(location.host.includes("localhost")),debug:location.host.includes("localhost")?1:String(o)});return"https://".concat(t,"/geoservice?").concat(S(i))}},{key:"prepareAnswer",value:function(e,n,t){var o=this,i=d();return this.bridge.sendMessage({handler:"VKSDKRequestToGeoservice:".concat(e),params:c({},n,{api_key:this.apiKey,wrapRequestInJSON:t,requestID:i})}),new Promise((function(e,n){o.requestMap[i]={resolve:e,reject:n}}))}},{key:"getStaticMap",value:function(e){return this.prepareAnswer("staticmap/png/",e)}},{key:"encodeCoords",value:function(e){return this.prepareAnswer("search",e)}},{key:"decodeCoords",value:function(e){return this.prepareAnswer("overall",e)}},{key:"getDirections",value:function(e){return this.prepareAnswer("directions",e,!0)}},{key:"getISO",value:function(e){return this.prepareAnswer("iso",e,!0)}}]),e}(),te={OneTapAuthEventsSDK:j,FloatingOneTapAuthEventsSDK:Y,ButtonOneTapAuthEventsSDK:F,DataPolicyEventsSDK:x,AuthCaptchaEventsSDK:G};export{X as BodyOverflowManager,I as Config,J as Connect,te as ConnectEvents,ne as GeoService,$ as MiniApp,B as MiniAppEvents,ee as MiniAppService}; | ||
import e from"@babel/runtime/helpers/typeof";import"@babel/runtime/helpers/toConsumableArray";import n from"@babel/runtime/helpers/defineProperty";import"@babel/runtime/helpers/classCallCheck";import"@babel/runtime/helpers/createClass";function t(e){return(t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function o(e,n){if(!(e instanceof n))throw new TypeError("Cannot call a class as a function")}function i(e,n){for(var t=0;t<n.length;t++){var o=n[t];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}function a(e,n,t){return n&&i(e.prototype,n),t&&i(e,t),e}function r(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function s(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);n&&(o=o.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,o)}return t}function c(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?s(Object(t),!0).forEach((function(n){r(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):s(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}var p,u="ModuleSymbhasOwnPr-0123456789ABCDEFGHNRVfgctiUvz_KqYTJkLxpZXIjQW",d=function(){for(var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:21,n="",t=e;t--;)n+=u[64*Math.random()|0];return n},l=["agreements","promo","vkc_behavior","vkc_auth_action","vkc_brand","vkc_display_mode","service_groups","external_device_id"];!function(e){e[e.UNKNOWN=1]="UNKNOWN",e[e.MISSING_PARAM=2]="MISSING_PARAM",e[e.CONNECTION_LOST=3]="CONNECTION_LOST",e[e.USER_DENIED=4]="USER_DENIED",e[e.INVALID_PARAMS=5]="INVALID_PARAMS",e[e.CUSTOM=6]="CUSTOM",e[e.CONNECT_WINDOW_CLOSED=7]="CONNECT_WINDOW_CLOSED",e[e.CONNECT_WINDOW_NOT_OPENED=8]="CONNECT_WINDOW_NOT_OPENED",e[e.CONNECT_DOMAIN_NOT_ALLOWED=9]="CONNECT_DOMAIN_NOT_ALLOWED",e[e.CONNECT_UNKNOWN_SDK_MESSAGE=10]="CONNECT_UNKNOWN_SDK_MESSAGE",e[e.OLD_MISSING_PARAM=100]="OLD_MISSING_PARAM"}(p||(p={}));var h=function(){return"Connect window was closed."},f=function(){return"Connect window was not opened."},m=function(e){return'URL domain "'.concat(e,'" is not allowed.')},y=function(e){return"This SDK message is unknown: ".concat(e)},v=!("undefined"==typeof window||!window.document||!window.document.createElement),A=v&&!!window.addEventListener,g=function(){};if(A)try{var O=Object.defineProperty({},"passive",{get:function(){!0}});window.addEventListener("test",g,O),window.removeEventListener("test",g,O)}catch(e){}!function(){if(!v)return!1;var e=!1;try{document.createElement("div").scrollTo({top:0,get behavior(){return e=!0,"smooth"}})}catch(e){}}();function _(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);n&&(o=o.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,o)}return t}function E(e){for(var t=1;t<arguments.length;t++){var o=null!=arguments[t]?arguments[t]:{};t%2?_(Object(o),!0).forEach((function(t){n(e,t,o[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(o)):_(Object(o)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(o,n))}))}return e}var w={parse:function(e){if("string"!=typeof e)return{};if(!(e=e.trim().replace(/^[?#&]/,"")))return{};var n=/\?(.+)$/gi.exec(e);return(n?n[1]:e).split("&").reduce((function(e,n){var t=n.split("=");return t[1]&&(e[t[0]]=decodeURIComponent(t[1])),e}),{})},stringify:function(n){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if("object"!==e(n)||null===n)return"";t=E({encode:!0},t);var o=function(e){return t.encode?encodeURIComponent(e):String(e)};return Object.keys(n).reduce((function(e,i){var a=n[i];return void 0===a?e:null===a?(t.skipNull||e.push([o(i),""].join("=")),e):Array.isArray(a)?(a.map((function(n){e.push("".concat(o(i),"[]=").concat(o(n)))})).join(),e):(e.push([o(i),o(a)].join("=")),e)}),[]).join("&")}};function S(e){return w.stringify(e)}function T(e){return Object.keys(e).filter((function(e){return l.includes(e)}))}function D(e){var n;return Boolean(null===(n=T(e))||void 0===n?void 0:n.length)}function b(e){var n=function(e){return T(e).reduce((function(n,t){return n[t]=e[t],n}),{})}(e);return btoa(JSON.stringify(n))}function P(e,n){var t,o=document.createElement("iframe");for(var i in e&&(o.src=e),o.style.cssText=null!==(t=null==n?void 0:n.cssText)&&void 0!==t?t:"",o.width="100%",o.height="100%",o.style.border="none",null==n?void 0:n.properties){var a;if(n&&n.properties.hasOwnProperty(i))o[i]=null!==(a=n.properties[i])&&void 0!==a?a:""}return o}function C(e){return e=e||Object.create(null),{on:function(n,t){(e[n]||(e[n]=[])).push(t)},off:function(n,t){e[n]&&e[n].splice(e[n].indexOf(t)>>>0,1)},emit:function(n,t){(e[n]||[]).slice().map((function(e){e(t)})),(e["*"]||[]).slice().map((function(e){e(n,t)}))}}}var k={appId:0,superAppToken:"",loginDomain:"login.vk.com",oauthDomain:"oauth.vk.com",connectDomain:"connect.vk.com",_debug:!1},N={},I={events:C(),init:function(e){if(!e.appId)throw new Error("appId required");k.appId=e.appId,k.superAppToken=e.superAppToken||"",k.loginDomain=e.loginDomain||"login.vk.com",k.oauthDomain=e.oauthDomain||"oauth.vk.com",k.connectDomain=e.connectDomain||"connect.vk.com",k.appSettings=e.appSettings,k._debug=!!e._debug},get:function(){return k},setSuperAppToken:function(e){k.superAppToken=e,I.events.emit("superAppToken",e)},onRequestSuperAppToken:function(e){N.superAppToken=e},_requestSuperAppToken:function(){var e;N.superAppToken&&(e=N.superAppToken()),e&&e.then((function(e){return I.setSuperAppToken(e)})).catch(console.error)},onAuth:function(e){N.auth=e},_requestAuth:function(){var e;N.auth&&(e=N.auth()),e&&e.then((function(e){return I.setSuperAppToken(e)})).catch(console.error)},onOpenApp:function(e){N.openApp=e},_openApp:function(e){N.openApp&&N.openApp(e.app)}},M=["extend_token","login_with_user","__sferum_invite_link"];function K(e){return e&&M.includes(e.name)?btoa(JSON.stringify(e)):""}var R;function L(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"auth",t=I.get(),o=t.appId,i=t.connectDomain,a=t.appSettings,r=c({app_id:o,response_type:"silent_token",v:"0.0.2"},e);a&&D(a)&&(r.app_settings=b(a));var s=S(r);return"https://".concat(i,"/").concat(n,"?").concat(s)}!function(e){e.Default="default",e.NamePhone="name_phone",e.PhoneName="phone_name"}(R||(R={}));var H,V=[R.Default,R.NamePhone,R.PhoneName];!function(e){e.Primary="primary",e.Flat="flat"}(H||(H={}));var U=[H.Primary,H.Flat];function x(e,n){return void 0===e?n:"number"!=typeof e?e?1:0:e}function W(e,n){return e&&"object"===t(e)?Object.keys(e).reduce((function(t,o){return n.includes(o)?(t[o]=e[o],t):t}),{}):e}var G,j,F,Y,z,q,B=function e(n){var t=this;o(this,e),r(this,"handler",(function(){return{}})),r(this,"config",void 0),r(this,"destroy",(function(){delete t.config,window.removeEventListener("message",t.handleMessage)})),r(this,"onMessage",(function(e){t.handler=e})),r(this,"sendMessage",(function(e){t.config.iframe.contentWindow.postMessage(c({type:"vk-sak-sdk"},e),t.config.origin)})),r(this,"handleMessage",(function(e){t.config.origin&&e.origin===t.config.origin&&e.source===t.config.iframe.contentWindow&&e.data&&"vk-sak-sdk"===e.data.type&&t.handler(e.data)})),this.config=n,window.addEventListener("message",this.handleMessage)};!function(e){e.SHOW_DATA_POLICY="VKSDKOneTapAuthConnectDataPolicy",e.HIDE_DATA_POLICY="VKSDKOneTapAuthDataPolicyClose",e.DATA_POLICY_RESULT="VKSDKOneTapAuthDataPolicyResult",e.SHOW_CAPTCHA="VKSDKOneTapAuthDataPolicyShowCaptcha"}(G||(G={})),function(e){e.SHOW_POLICY_AGREEMENTS="VKSDKOneTapAuthPolicyAgreementsShow",e.HIDE_POLICY_AGREEMENTS="VKSDKOneTapAuthPolicyAgreementsHide",e.ACCEPT_POLICY_AGREEMENTS="VKSDKOneTapAuthPolicyAgreementsAccept",e.DECLINE_POLICY_AGREEMENTS="VKSDKOneTapAuthPolicyAgreementsDecline",e.POLICY_AGREEMENTS_ERROR="VKSDKOneTapAuthPolicyAgreementsError",e.SHOW_DATA_POLICY="VKSDKOneTapAuthPolicyAgreementsShowDataPolicy"}(j||(j={})),function(e){e.CAPTCHA_SUCCESS="VKSDKAuthCaptchaSuccess",e.CAPTCHA_FAIL="VKSDKAuthCaptchaFail"}(F||(F={})),function(e){e.PHONE_VALIDATION_NEEDED="VKSDKOneTapAuthPhoneValidationNeeded",e.FULL_AUTH_NEEDED="VKSDKOneTapAuthFullAuthNeeded",e.AUTH_DATA_LOADED="VKSDKOneTapAuthDataLoaded",e.NOT_AUTHORIZED="VKSDKOneTapAuthNotAuthorized",e.LOGIN_SUCCESS="VKSDKOneTapAuthLoginSuccess",e.RESIZE_FRAME="VKSDKOneTapResizeFrame",e.SHOW_CAPTCHA="VKSDKOneTapShowCaptcha",e.VALIDATE_CAPTCHA="VKSDKOneTapValidateCaptcha"}(Y||(Y={})),function(e){e.CLOSE_AUTH="VKSDKOneTapAuthClose",e.ADAPTIVITY_CHANGE="VKSDKFloatingOneTapAdaptivityChange",e.ADAPTIVITY_CHANGED="VKSDKFloatingOneTapAdaptivityChanged"}(z||(z={})),function(e){e.SHOW_LOGIN="VKSDKButtonOneTapAuthShowLogin",e.SHOW_LOGIN_OPTIONS="VKSDKButtonOneTapAuthShowLoginOptions",e.SHOW_AGREEMENTS_DIALOG="VKSDKButtonOneTapAuthShowAgreementsDialog",e.START_AUTHORIZE="VKSDKButtonOneTapAuthStartAuthorize"}(q||(q={}));var Z,J,X,Q=new function e(){var n=this;o(this,e),r(this,"flags",null),r(this,"silentAuth",(function(){var e=I.get(),n=e.loginDomain,t=e.appId,o=d(),i="https://".concat(n,"/?act=connect&app_id=").concat(t,"&response_type=").concat("silent_token","&uuid=").concat(o,"&v=").concat("0.0.2"),a=new XMLHttpRequest;return a.open("GET",i,!0),a.responseType="json",a.withCredentials=!0,new Promise((function(e,n){a.onload=function(){a.response?e({provider:"vk",payload:a.response}):n()},a.onerror=function(){n()},a.send()}))})),r(this,"oneTapAuth",(function(e,t){if(console.warn("Connect.oneTapAuth method is deprecated. Use Connect.floatingOneTapAuth and Connect.buttonOneTapAuth methods."),!["floating","button"].includes(e))return null;switch(e){case"button":return n.buttonOneTapAuth(t);case"floating":return n.floatingOneTapAuth(t);default:return null}})),r(this,"floatingOneTapAuth",(function(e){var t,o,i=function(){var e,n=window.innerWidth,t=n<=768;return{destroy:function(){return window.removeEventListener("resize",e)},isAdaptive:function(){return t},observe:function(o){e=function(){var e=window.innerWidth;n>768&&e<=768?o(t=!0):n<=768&&e>768&&o(t=!1),n=e},window.addEventListener("resize",e)}}}(),a=(t=i.isAdaptive(),o=t?"314px":"334px",{pageUrl:"floating_one_tap_auth",pageUrlParams:{adaptive:t?1:0},frameStyles:t?"\n display: none;\n position: fixed;\n bottom: 0;\n right: 50%;\n transform: translate(50%, 0);\n max-width: 468px;\n width: 100%;\n height: ".concat(o,";\n "):"\n display: none;\n position: fixed;\n top: 0;\n right: 0;\n max-width: 400px;\n width: 100%;\n height: ".concat(o,";\n ")});if(!a)throw new Error("options were not set");var r=d(),s=P(L(c({origin:location.protocol+"//"+location.host,uuid:r},a.pageUrlParams),a.pageUrl),{cssText:a.frameStyles}),p=new B({iframe:s,origin:"https://"+I.get().connectDomain});i.observe((function(e){p.sendMessage({handler:z.ADAPTIVITY_CHANGE,params:{uuid:r,is_adaptive:e}}),e?(s.style.maxWidth="468px",s.style.top="auto",s.style.bottom="0",s.style.right="50%",s.style.transform="translate(50%, 0)"):(s.style.maxWidth="400px",s.style.top="0",s.style.bottom="auto",s.style.right="0",s.style.transform="none"),s.style.display="none"})),document.body.appendChild(s);var u=function(){p.sendMessage({handler:Y.RESIZE_FRAME,params:{uuid:r}})};window.addEventListener("resize",u);var l=function(){s&&(s.remove(),s=null),window.removeEventListener("resize",u),i&&i.destroy(),p.destroy()},h=new Promise((function(t){p.onMessage((function(o){if(o.params.uuid===r)switch(o.handler){case Y.NOT_AUTHORIZED:e.callback({type:o.handler,payload:{uuid:r,error:"not_authorized"}}),l(),t(o.handler);break;case Y.RESIZE_FRAME:s.style.height="".concat(o.params.height,"px");break;case z.CLOSE_AUTH:e.callback({type:o.handler,payload:{uuid:r}}),l();break;case z.ADAPTIVITY_CHANGED:s.style.display="block";break;case Y.AUTH_DATA_LOADED:s.style.display="block",t(o.handler);default:n.handleOneTapEvents(o,p,e)}}))}));return{getFrame:function(){return s},destroy:l,authReadyPromise:h}})),r(this,"buttonOneTapAuth",(function(e){var t=function(e){var n={},t=44;if(e){n.display=e.displayMode&&V.includes(e.displayMode)?e.displayMode:"default",n.button_skin=e.buttonSkin&&U.includes(e.buttonSkin)?e.buttonSkin:"primary",n.show_agreements=x(e.showAgreements,0),n.show_alternative_login=x(e.showAlternativeLogin,0),n.show_agreements_dialog=x(e.showAgreementsDialog,1);t+=n.show_alternative_login?56:0,t+=n.show_agreements?80:0}return{pageUrl:"button_one_tap_auth",pageUrlParams:n,frameStyles:"\n height: ".concat(t,"px;\n ")}}(e.options);if(!t)throw new Error("options were not set");var o=d(),i=P(L(c({origin:location.protocol+"//"+location.host,uuid:o},t.pageUrlParams),t.pageUrl),{cssText:t.frameStyles}),a=e.container;a&&a.appendChild(i);var r=new B({iframe:i,origin:"https://"+I.get().connectDomain}),s=function(){r.sendMessage({handler:Y.RESIZE_FRAME,params:{uuid:o}})};window.addEventListener("resize",s);return{getFrame:function(){return i},destroy:function(){i&&(i.remove(),i=null),window.removeEventListener("resize",s),r.destroy()},authReadyPromise:new Promise((function(t){r.onMessage((function(a){if(a.params.uuid===o)switch(a.handler){case Y.RESIZE_FRAME:i.style.height="".concat(a.params.height,"px");break;case Y.NOT_AUTHORIZED:t(a.handler);break;case q.SHOW_LOGIN:case q.SHOW_LOGIN_OPTIONS:e.callback({type:a.handler,payload:{uuid:o}});break;case q.SHOW_AGREEMENTS_DIALOG:n.userPolicyAgreements(o).show().then((function(e){e&&e.accepted&&r.sendMessage({handler:q.START_AUTHORIZE,params:{uuid:o}})})).catch((function(){r.sendMessage({handler:j.DECLINE_POLICY_AGREEMENTS,params:{uuid:o}})}));break;case Y.AUTH_DATA_LOADED:t(a.handler);default:n.handleOneTapEvents(a,r,e)}}))}))}})),r(this,"handleOneTapEvents",(function(e,t,o){var i=e.params.uuid;switch(e.handler){case Y.AUTH_DATA_LOADED:t.sendMessage({handler:Y.RESIZE_FRAME,params:{uuid:i}});break;case Y.LOGIN_SUCCESS:o.callback({type:e.handler,provider:"vk",payload:e.params});break;case Y.SHOW_CAPTCHA:var a=n.captcha(i,{captcha_sid:e.params.captcha_sid,captcha_img:e.params.captcha_img});a.show().then((function(e){t.sendMessage({handler:F.CAPTCHA_SUCCESS,params:c({uuid:i},e)})})).catch((function(){t.sendMessage({handler:F.CAPTCHA_FAIL,params:{uuid:i}}),a.destroy()}));break;case G.SHOW_DATA_POLICY:n.userDataPolicy(i).show().then((function(){o.callback({type:G.DATA_POLICY_RESULT,payload:{uuid:i,policyAccepted:!0}})})).catch((function(){o.callback({type:G.DATA_POLICY_RESULT,payload:{uuid:i,policyAccepted:!1}})}));break;case Y.FULL_AUTH_NEEDED:case Y.PHONE_VALIDATION_NEEDED:o.callback({type:e.handler,payload:{uuid:i}})}})),r(this,"userDataPolicy",(function(e){var t=L({origin:location.protocol+"//"+location.host,uuid:e},"user_data_policy"),o=window.innerHeight,i="\n display: none;\n position: fixed;\n top: 0;\n left: 0;\n width: 100%;\n height: ".concat(o,"px;\n min-height: ").concat(o,"px;\n border: none;\n z-index: 99999;\n "),a=P(t,{properties:{height:"".concat(o,"px")},cssText:i});document.body.appendChild(a);var r=new B({iframe:a,origin:"https://"+I.get().connectDomain}),s=function(){a.style.display="none"};return{show:function(){return a.style.display="block",new Promise((function(t,o){r.onMessage((function(i){switch(i.handler){case G.HIDE_DATA_POLICY:s(),t();break;case G.SHOW_CAPTCHA:var p=n.captcha(e,{captcha_sid:i.params.captcha_sid,captcha_img:i.params.captcha_img});p.show().then((function(n){r.sendMessage({handler:F.CAPTCHA_SUCCESS,params:c({uuid:e},n)}),a.style.display="block"})).catch((function(){r.sendMessage({handler:F.CAPTCHA_FAIL,params:{uuid:e}}),p.destroy()})),s();break;default:s(),o()}}))}))},hide:s,destroy:function(){document.body.removeChild(a),r.destroy()}}})),r(this,"userPolicyAgreements",(function(e){var t,o,i,a=L({origin:location.protocol+"//"+location.host,uuid:e},"user_policy_agreements"),r=(t=a,o=window.innerHeight,i="\n display: none;\n position: fixed;\n top: 0;\n left: 0;\n width: 100%;\n height: ".concat(o,"px;\n min-height: ").concat(o,"px;\n border: none;\n z-index: 99999;\n "),P(t,{properties:{height:"".concat(o,"px")},cssText:i}));document.body.appendChild(r);var s=new B({iframe:r,origin:"https://"+I.get().connectDomain}),c=function(){r.style.display="none"};return{show:function(){return r.style.display="block",new Promise((function(t,o){s.onMessage((function(i){switch(i.handler){case j.ACCEPT_POLICY_AGREEMENTS:c(),t({accepted:!0});break;case j.DECLINE_POLICY_AGREEMENTS:c(),t({accepted:!1});break;case j.SHOW_DATA_POLICY:c();var a=function(){r.style.display="block"};n.userDataPolicy(e).show().then(a).catch(a);break;case j.POLICY_AGREEMENTS_ERROR:case j.HIDE_POLICY_AGREEMENTS:default:c(),o()}}))}))},hide:c,destroy:function(){document.body.removeChild(r),s.destroy()}}})),r(this,"captcha",(function(e,n){var t=L(c({origin:location.protocol+"//"+location.host,uuid:e},n),"auth_captcha"),o=window.innerHeight,i=P(t,{cssText:"\n display: none;\n position: fixed;\n top: 0;\n left: 0;\n width: 100%;\n height: ".concat(o,"px;\n min-height: ").concat(o,"px;\n border: none;\n z-index: 99999;\n ")});document.body.appendChild(i);var a=new B({iframe:i,origin:"https://"+I.get().connectDomain}),r=function(){document.body.removeChild(i),a.destroy()};return{show:function(){return i.style.display="block",new Promise((function(e,n){a.onMessage((function(t){switch(t.handler){case F.CAPTCHA_SUCCESS:e(t.params),r();break;default:n(),r()}}))}))},destroy:r}})),r(this,"userVisibleAuth",(function(e){var t=d(),o=c({origin:location.protocol+"//"+location.host,uuid:t},W(e,["screen","source"])),i=K(null==e?void 0:e.action);i&&(o.action=i);var a=L(o);n.flags&&(a="".concat(a,"#").concat(S(n.flags)));var r=screen.height/2-280,s=screen.width/2-410,u=window.open(a,"_blank","top=".concat(r,",left=").concat(s,",width=").concat(820,",height=").concat(560,",location"));if(!u){var l={code:p.CONNECT_WINDOW_NOT_OPENED,reason:f()};return Promise.reject(l)}return new Promise((function(e,n){var o=setInterval((function(){if(!u||u.closed){window.removeEventListener("message",i),clearInterval(o);var e={code:p.CONNECT_WINDOW_CLOSED,reason:h()};n(e)}}),1e3);function i(a){if(a.source===u&&u)if(window.removeEventListener("message",i),clearInterval(o),".vk.com"===a.origin.slice(a.origin.length-".vk.com".length))if(a.data.action==="vk_connect_response"+t){var r=a.data.payload;u.close(),e({provider:"vk",payload:r})}else if(a.data.action==="oauth_callback"+t)e({provider:a.data.payload.name}),u.close();else if(a.data.action==="skip_callback"+t){var s=a.data.payload.redirectURL;s&&(window.location.href=s),u.close()}else{u.close();var c={code:p.CONNECT_UNKNOWN_SDK_MESSAGE,reason:y(JSON.stringify(a.data))};n(c)}else{u.close();var d={code:p.CONNECT_DOMAIN_NOT_ALLOWED,reason:m(a.origin)};n(d)}}window.addEventListener("message",i)}))})),r(this,"redirectAuth",(function(e){var n=d(),t=c({redirect_uri:e.url,uuid:n},W(e,["screen","source"])),o=K(null==e?void 0:e.action);o&&(t.action=o),(null==e?void 0:e.state)&&(t.redirect_state=e.state);var i=L(t);location.assign(i)}))},$=new(function(){function e(){o(this,e),r(this,"savedStyles",[]),r(this,"bodyScrollYValue",window.pageYOffset||window.scrollY),r(this,"isFreezed",!1)}return a(e,[{key:"freezeBodyOverflow",value:function(){if(!this.isFreezed){this.isFreezed=!0;var e=(t=window.document.documentElement.clientWidth,Math.abs(window.innerWidth-t)),n=parseInt(window.getComputedStyle(window.document.body).paddingRight,10)||0;this.bodyScrollYValue=window.pageYOffset||window.scrollY,this.savedStyles=[],this.savedStyles.push({value:window.document.body.style.paddingRight,property:"padding-right"},{value:window.document.body.style.overflow,property:"overflow"},{value:window.document.body.style.overflowX,property:"overflow-x"},{value:window.document.body.style.overflowY,property:"overflow-y"}),window.document.body.style.setProperty("overflow","hidden"),window.document.body.style.setProperty("padding-right","".concat(e+n,"px"))}var t}},{key:"restoreBodyOverflow",value:function(){this.isFreezed&&(this.savedStyles.forEach((function(e){var n=e.value,t=e.property;n?window.document.body.style.setProperty(t,n):window.document.body.style.removeProperty(t)})),window.scrollTo(0,this.bodyScrollYValue),this.isFreezed=!1)}}]),e}());!function(e){e.APP_CLOSE="VKWebAppClose",e.APP_READY="VKSDKMiniAppReady",e.RESIZE="VKSDKMiniAppResize",e.APP_INIT_CONFIG="VKSDKMiniAppInitConfig",e.OPEN_APP="VKWebAppOpenApp",e.OPEN_PAY_FORM="VKWebAppOpenPayForm",e.ACTION_DONE="VKWebAppActionDone"}(Z||(Z={})),function(e){e.OPEN="open",e.HIDE="hide",e.CLOSE="close",e.SHOW="show",e.MESSAGE="message",e.CREATE_APP="createapp"}(J||(J={})),function(e){e.SUPERAPP_TOKEN="VKSDKGeneralSuperAppToken",e.AUTH_NEEDED="VKSDKGeneralAuthNeeded",e.OPEN_APP="VKSDKGeneralOpenApp"}(X||(X={}));var ee,ne=function e(n){var t=this;o(this,e),r(this,"events",void 0),r(this,"iframe",void 0),r(this,"bridge",void 0),r(this,"loading",void 0),r(this,"readyPromiseResolve",null),r(this,"readyPromise",null),r(this,"params",void 0),r(this,"child",null),r(this,"open",(function(e,n){return t.loading?(t.iframe.src=t.getMiniAppUrl(e,n),t.loading=new Promise((function(e){t.iframe.onload=function(){t.iframe.onload=null,e()}})),t.readyPromise=new Promise((function(e){return t.readyPromiseResolve=e}))):t.preload(e,n).catch(console.error),t.iframe.style.display="block",t.params.stackMode||$.freezeBodyOverflow(),t.loading.then(t.handleResize).catch(console.error),t.events.emit(J.OPEN),t.readyPromise})),r(this,"hide",(function(){t.iframe.style.display="none",t.params.stackMode||$.restoreBodyOverflow(),t.events.emit(J.HIDE)})),r(this,"close",(function(){t.params.stackMode||$.restoreBodyOverflow(),I.events.off("superAppToken",t.onSuperAppToken),t.iframe&&t.iframe.remove(),t.bridge&&t.bridge.destroy(),delete t.iframe,delete t.bridge,window.removeEventListener("resize",t.handleResize),t.events.emit(J.CLOSE)})),r(this,"show",(function(){if(!t.loading)throw new Error('App is not loaded, use "open" or "preload" methods');t.iframe.style.display="block",t.params.stackMode||$.freezeBodyOverflow(),t.events.emit(J.SHOW)})),r(this,"preload",(function(e,n){var o=document.createElement("iframe"),i=window.innerHeight,a=isFinite(t.params.zIndex)?t.params.zIndex:999999;return o.src=t.getMiniAppUrl(e,n),o.setAttribute("allow","geolocation"),o.style.cssText="\n display: none;\n position: fixed;\n top: 0;\n left: 0;\n width: 100%;\n height: ".concat(i,"px;\n min-height: ").concat(i,"px;\n border: none;\n z-index: ").concat(a,";\n "),t.iframe=o,document.body.appendChild(t.iframe),I.events.on("superAppToken",t.onSuperAppToken),t.bridge=new B({iframe:t.iframe,origin:"https://"+I.get().connectDomain}),t.bridge.onMessage(t.handleMessage),window.addEventListener("resize",t.handleResize),t.loading=new Promise((function(e){o.onload=function(){o.onload=null,e()}})),t.readyPromise=new Promise((function(e){return t.readyPromiseResolve=e})),t.loading})),r(this,"sendMessage",(function(e){t.bridge.sendMessage(e)})),r(this,"onSuperAppToken",(function(e){t.bridge.sendMessage({handler:X.SUPERAPP_TOKEN,params:{result:e}})})),r(this,"handleMessage",(function(e){switch(e.handler){case Z.APP_CLOSE:t.hide();break;case Z.APP_READY:t.resolveReadyPromise(),t.handleUpdateConfig();break;case Z.OPEN_APP:t.openMiniapp(e.params);break;case Z.OPEN_PAY_FORM:t.openPayForm(e.params);break;case X.SUPERAPP_TOKEN:I._requestSuperAppToken();break;case X.AUTH_NEEDED:I._requestAuth();break;default:t.events.emit(J.MESSAGE,e)}})),r(this,"handleResize",(function(){if(t.iframe){var e=innerWidth,n=innerHeight;t.iframe.style.height="".concat(n,"px"),t.iframe.style.minHeight="".concat(n,"px"),t.bridge.sendMessage({handler:Z.RESIZE,params:{viewport_width:e,viewport_height:n}})}})),r(this,"handleUpdateConfig",(function(){t.bridge.sendMessage({handler:Z.APP_INIT_CONFIG,params:{fullMode:t.params.fullMode,hideMenu:t.params.hideMenu}})})),r(this,"getMiniAppUrl",(function(e,n){var o=I.get(),i=o.connectDomain,a=o.appId,r=o.superAppToken,s=o._debug,c=S({app:t.params.app,host_app_id:a,debug:s?"1":"",localhost:s?"1":"",superapp_token:r,app_query:e?JSON.stringify(e):"",app_hash:n||""});return"https://".concat(i,"/mini_app?").concat(c)})),r(this,"resolveReadyPromise",(function(){t.readyPromise&&t.readyPromiseResolve&&(t.readyPromiseResolve(),t.readyPromise=null,t.readyPromiseResolve=null)})),r(this,"openMiniapp",(function(n){t.child=new e({app:n.app_id,stackMode:t.params.stackMode}),t.events.emit(J.CREATE_APP,{app:t.child,location:n.location})})),r(this,"openPayForm",(function(n){var o=c({},n.params);o.data&&(o.data=JSON.stringify(o.data));var i=c({},o,{app_id:n.app_id,action:n.action}),a=new e({app:6217559,stackMode:t.params.stackMode});a.open(i).then((function(){return t.hide()})).catch(console.error),a.events.on(J.MESSAGE,(function(e){t.handleVKPayFormMessage(e),a.close(),t.show()})),a.events.on(J.HIDE,(function(){a.close(),t.close()}))})),r(this,"handleVKPayFormMessage",(function(e){e.handler===Z.ACTION_DONE&&t.sendMessage(e)})),this.params=c({},n,{app:"number"==typeof n.app?"app".concat(n.app):n.app}),this.events=C()},te=function(){function e(){o(this,e),r(this,"stack",[])}return a(e,[{key:"removeMiniApp",value:function(e){var n=e.app,t=this.stack.lastIndexOf(n);if(t>-1&&t===this.stack.length-1)if(this.stack.splice(t,1),this.stack.length){this.stack[this.stack.length-1].show();var o=this.stack[this.stack.length-2];setTimeout((function(){return null==o?void 0:o.hide()}),0)}else $.restoreBodyOverflow()}},{key:"makeHandleMiniAppClose",value:function(e){var n=this,t=e.app;return function(){n.removeMiniApp({app:t})}}},{key:"makeHandleMiniAppHide",value:function(e){var n=this,t=e.app;return function(){var e=n.stack.lastIndexOf(t);e>-1&&e===n.stack.length-1&&setTimeout((function(){return t.close()}),0)}}},{key:"handleMiniAppCreate",value:function(e){var n=e.app,t=e.query,o=e.hash;this.stack.push(n),n.open(t,o).catch(console.error),n.events.on(J.CREATE_APP,this.handleMiniAppCreate.bind(this)),n.events.on(J.HIDE,this.makeHandleMiniAppHide({app:n})),n.events.on(J.CLOSE,this.makeHandleMiniAppClose({app:n})),$.freezeBodyOverflow();var i=this.stack[this.stack.length-2];return setTimeout((function(){null==i||i.hide()}),0),n}},{key:"open",value:function(e){var n=e.app,t=e.query,o=e.hash,i=new ne({app:n,stackMode:!0});return this.handleMiniAppCreate({app:i,query:t,hash:o}),i}},{key:"close",value:function(){var e=this.stack;this.stack.splice(0),e.reverse().forEach((function(e){return e.close()})),$.restoreBodyOverflow()}},{key:"length",get:function(){return this.stack.length}}]),e}();!function(e){e.STATIC_MAP="VKSDKRequestToGeoservice:staticmap/png/",e.SEARCH="VKSDKRequestToGeoservice:search",e.OVERALL="VKSDKRequestToGeoservice:overall",e.DIRECTIONS="VKSDKRequestToGeoservice:directions",e.ISO="VKSDKRequestToGeoservice:iso"}(ee||(ee={}));var oe=function(){function e(n){var t=this,i=n.apiKey;o(this,e),r(this,"iframe",void 0),r(this,"bridge",void 0),r(this,"requestMap",void 0),r(this,"apiKey",void 0),this.apiKey=i;var a=document.createElement("iframe"),s=I.get().appId;a.src=this.getGeoserviceProxyUrl({app_id:s}),a.style.cssText="\n display: none;\n ",this.iframe=a,document.body.appendChild(this.iframe),this.bridge=new B({iframe:this.iframe,origin:"https://"+I.get().connectDomain}),this.requestMap={},this.bridge.onMessage((function(e){var n=e.params,o=n.requestID,i=n.response;t.requestMap[o].resolve(i),delete t.requestMap[o]}))}return a(e,[{key:"setApiKey",value:function(e){this.apiKey=e}},{key:"getGeoserviceProxyUrl",value:function(e){var n=I.get(),t=n.connectDomain,o=n._debug,i=c({},e||{},{origin:location.protocol+"//"+location.host,localhost:String(location.host.includes("localhost")),debug:location.host.includes("localhost")?1:String(o)});return"https://".concat(t,"/geoservice?").concat(S(i))}},{key:"prepareAnswer",value:function(e,n,t){var o=this,i=d();return this.bridge.sendMessage({handler:"VKSDKRequestToGeoservice:".concat(e),params:c({},n,{api_key:this.apiKey,wrapRequestInJSON:t,requestID:i})}),new Promise((function(e,n){o.requestMap[i]={resolve:e,reject:n}}))}},{key:"getStaticMap",value:function(e){return this.prepareAnswer("staticmap/png/",e)}},{key:"encodeCoords",value:function(e){return this.prepareAnswer("search",e)}},{key:"decodeCoords",value:function(e){return this.prepareAnswer("overall",e)}},{key:"getDirections",value:function(e){return this.prepareAnswer("directions",e,!0)}},{key:"getISO",value:function(e){return this.prepareAnswer("iso",e,!0)}}]),e}(),ie={OneTapAuthEventsSDK:Y,FloatingOneTapAuthEventsSDK:z,ButtonOneTapAuthEventsSDK:q,DataPolicyEventsSDK:G,AuthCaptchaEventsSDK:F};export{$ as BodyOverflowManager,I as Config,Q as Connect,ie as ConnectEvents,oe as GeoService,ne as MiniApp,J as MiniAppEvents,te as MiniAppService}; |
{ | ||
"name": "@vkontakte/superappkit", | ||
"version": "1.27.0-alpha.5", | ||
"version": "1.27.0-beta.1.0", | ||
"description": "VK SuperAppKit", | ||
@@ -5,0 +5,0 @@ "main": "dist/index-cjs.js", |
86967
940