@vkontakte/js-sdk
Advanced tools
Comparing version 0.2.5 to 0.2.6
@@ -1,1 +0,1 @@ | ||
!function(e){var t={};function o(n){if(t[n])return t[n].exports;var r=t[n]={i:n,l:!1,exports:{}};return e[n].call(r.exports,r,r.exports,o),r.l=!0,r.exports}o.m=e,o.c=t,o.d=function(e,t,n){o.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},o.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},o.t=function(e,t){if(1&t&&(e=o(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(o.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var r in e)o.d(n,r,function(t){return e[t]}.bind(null,r));return n},o.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return o.d(t,"a",t),t},o.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},o.p="",o(o.s=3)}([function(e,t){!function(t){var o=[],n=void 0!==t&&!t.AndroidBridge&&!t.webkit,r=n?"message":"VKWebAppEvent";void 0!==t&&(t.CustomEvent||function(){function e(e,t){t=t||{bubbles:!1,cancelable:!1,detail:void 0};var o=document.createEvent("CustomEvent");return o.initCustomEvent(e,t.bubbles,t.cancelable,t.detail),o}e.prototype=t.Event.prototype,t.CustomEvent=e}(),t.addEventListener(r,function(){var e=Array.prototype.slice.call(arguments),t=o.slice();n?t.forEach(function(t){t({detail:e[0].data})}):t.forEach(function(t){t.apply(null,e)})})),e.exports={send:function(e,o){o||(o={});var n=void 0!==t,r=n&&t.AndroidBridge,i=n&&t.webkit&&t.webkit.messageHandlers,a=!r&&!i;r&&"function"==typeof r[e]&&r[e](JSON.stringify(o)),i&&i[e]&&"function"==typeof i[e].postMessage&&i[e].postMessage(o),a&&parent.postMessage({handler:e,params:o,type:"vk-connect"},"*")},subscribe:function(e){o.push(e)},unsubscribe:function(e){var t=o.indexOf(e);t>-1&&o.splice(t,1)},supports:function(e){var o=void 0!==t,n=o&&t.AndroidBridge,r=o&&t.webkit&&t.webkit.messageHandlers;return!(!n||"function"!=typeof n[e])||(!(!r||!r[e]||"function"!=typeof r[e].postMessage)||!(r||n||!~["VKWebAppGetAuthToken","VKWebAppCallAPIMethod","VKWebAppGetGeodata","VKWebAppGetUserInfo","VKWebAppGetPhoneNumber","VKWebAppGetClientVersion","VKWebAppOpenPayForm","VKWebAppShare","VKWebAppAllowNotifications","VKWebAppDenyNotifications","VKWebAppShowWallPostBox","VKWebAppGetEmail","VKWebAppAllowMessagesFromGroup","VKWebAppJoinGroup","VKWebAppOpenApp","VKWebAppSetLocation","VKWebAppScroll","VKWebAppResizeWindow"].indexOf(e)))}}}(window)},function(e,t,o){"use strict";var n=o(0),r=o.n(n);function i(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var o=[],n=!0,r=!1,i=void 0;try{for(var a,u=e[Symbol.iterator]();!(n=(a=u.next()).done)&&(o.push(a.value),!t||o.length!==t);n=!0);}catch(e){r=!0,i=e}finally{try{n||null==u.return||u.return()}finally{if(r)throw i}}return o}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}function a(e){return e&&"[object Function]"===Object.prototype.toString.call(e)}function u(){return window.webkit&&window.webkit.messageHandlers}function s(){return window.AndroidBridge}function c(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(!e)return"";var o=[],n=t?"?":"";for(var r in e)if(e.hasOwnProperty(r)){var i=e[r=encodeURIComponent(r)]||"";i=i.toString(),i=encodeURIComponent(i),o.push("".concat(r,"=").concat(i))}return o.length?n+o.join("&"):""}function p(e,t){for(var o=0;o<t.length;o++){var n=t[o];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}var l=function(){function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.proxy=t,this.methodName="",this.deprecatedMethodName="",this.successEvent="",this.failedEvent="",this.resultEvents=[],this.params2QsForDepredcated=!0}var t,o,n;return t=e,(o=[{key:"getResultEvents",value:function(){return this.resultEvents.length||(this.successEvent&&this.resultEvents.push(this.successEvent),this.failedEvent&&this.resultEvents.push(this.failedEvent)),this.resultEvents}},{key:"request",value:function(){throw new Error("Method ".concat(this.methodName,"(").concat(this.deprecatedMethodName,") is not implemented"))}},{key:"response",value:function(e){throw new Error("Response event handler for ".concat(this.methodName,"(").concat(this.deprecatedMethodName,") is not implemented"))}},{key:"deprecatedResponse",value:function(){throw new Error("Response handler for ".concat(this.methodName,"(").concat(this.deprecatedMethodName,") is not implemented"))}},{key:"eventToStatus",value:function(e){var t=e.type;return e=e.data,t===this.successEvent?"success":e.error_data.error_reason||"fail"}}])&&p(t.prototype,o),n&&p(t,n),e}();function f(e){return(f="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 y(e,t){for(var o=0;o<t.length;o++){var n=t[o];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function d(e,t){return!t||"object"!==f(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function h(e){return(h=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function b(e,t){return(b=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var v=function(e){function t(e){var o;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),(o=d(this,h(t).call(this,e))).successEvent=t.successEven,o.failedEvent=t.failedEvent,o.methodName=t.methodName,o.deprecatedMethodName="VKWebAppApiCall",o.params2QsForDepredcated=!1,o}var o,n,i;return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&b(e,t)}(t,l),o=t,(n=[{key:"request",value:function(e,o,n){var i=r.a.supports(this.methodName),u=(new Date).getUTCMilliseconds().toString();o.access_token=this.proxy.getQueryParam("access_token");var s={method:e,request_id:u,params:o};i||(s.callbackId=u,s.query=c(s.params),delete s.params,delete s.request_id),a(n)&&(t.callbacks[u]=n),i?this.proxy.call(this,s):this.proxy.apiCall(this,s)}},{key:"response",value:function(e){var o=e.data,n=t.callbacks[o.request_id];a(n)&&n(o),delete t.callbacks[o.request_id]}}])&&y(o.prototype,n),i&&y(o,i),t}();v.methodName="VKWebAppCallAPIMethod",v.successEven="VKWebAppCallAPIMethodResult",v.failedEvent="VKWebAppCallAPIMethodFailed",v.callbacks={};var m,w={};function g(e){if(a(w[e])){for(var t=arguments.length,o=new Array(t>1?t-1:0),n=1;n<t;n++)o[n-1]=arguments[n];w[e].apply(w,o)}}function O(e){return(O="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 k(e,t){for(var o=0;o<t.length;o++){var n=t[o];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function _(e,t){return!t||"object"!==O(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function S(e){return(S=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function x(e,t){return(x=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function E(e,t,o){return t in e?Object.defineProperty(e,t,{value:o,enumerable:!0,configurable:!0,writable:!0}):e[t]=o,e}var A=(E(m={},2,"friends"),E(m,4,"photos"),E(m,16,"video"),E(m,64,"stories"),E(m,128,"pages"),E(m,1024,"status"),E(m,2048,"notes"),E(m,8192,"wall"),E(m,32768,"ads"),E(m,1<<17,"docs"),E(m,1<<18,"groups"),E(m,1<<20,"stats"),E(m,1<<27,"market"),m),P=function(e){function t(e){var o;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),(o=_(this,S(t).call(this,e))).methodName="VKWebAppGetAuthToken",o.deprecatedMethodName="showSettingsBox",o.successEvent="VKWebAppAccessTokenReceived",o.failedEvent="VKWebAppAccessTokenFailed",o}var o,n,i;return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&x(e,t)}(t,l),o=t,(n=[{key:"maskToScope",value:function(e){var t=[];for(var o in A)A.hasOwnProperty(o)&&+o&+e&&t.push(A[o]);return t.join(",")}},{key:"request",value:function(e){if(e<0)throw new Error("Mask must be more 0");var t;t=r.a.supports(this.methodName)?{scope:this.maskToScope(e),app_id:+this.proxy.getQueryParam("vk_app_id")||+this.proxy.getQueryParam("api_id")}:{mask:e,access_token:this.proxy.getQueryParam("access_token")},this.proxy.call(this,t)}},{key:"tokenRequest",value:function(){this.proxy.call(this,{app_id:+this.proxy.getQueryParam("vk_app_id")||+this.proxy.getQueryParam("api_id"),scope:this.proxy.getQueryParam("vk_access_token_settings")||this.maskToScope(this.proxy.getQueryParam("api_settings"))||""})}},{key:"deprecatedResponse",value:function(e,t){"success"===e&&t&&this.proxy.setQueryParam("access_token",t),g("onSettingsBoxDone",e,t)}},{key:"response",value:function(e){var t=this.eventToStatus(e);"success"===t&&this.proxy.setQueryParam("access_token",e.data.access_token),g("onSettingsBoxDone",t,e.data.access_token)}}])&&k(o.prototype,n),i&&k(o,i),t}();function j(e,t){for(var o=0;o<t.length;o++){var n=t[o];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function M(){var e=document.getElementById("debug");if(e){for(var t=arguments.length,o=new Array(t),n=0;n<t;n++)o[n]=arguments[n];e.innerHTML+=JSON.stringify(o)+"<br>"}}var V=function(){function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.queryParams=t,this.methods={},this.methodEvents={},this.initVkUiConnectListener()}var t,o,n;return t=e,(o=[{key:"initVkUiConnectApp",value:function(){if(this.isVKUiConnectSupport()&&(M("init vk connect"),r.a.send("VKWebAppInit",{}),!this.getQueryParam("access_token"))){var e=new P(this);this.addMethod(e),this.addMethod(e),e.tokenRequest()}}},{key:"initVkUiConnectListener",value:function(){var e=this;r.a.subscribe(function(t){var o=t.detail||{},n=o.type;M("eventName",n),M("eventData",o),e.methodEvents[n]&&e.methodEvents[n].response(o)})}},{key:"addPublicMethods",value:function(e){var t=this;Object.keys(e).forEach(function(o){var n=e[o];t.addMethod(n)})}},{key:"addMethod",value:function(e){var t=this,o=e.getResultEvents();o.length&&o.forEach(function(o){t.methodEvents[o]=e}),this.methods[e.methodName]=e,e.deprecatedMethodName&&(this.methods[e.deprecatedMethodName]=e)}},{key:"setQueryParam",value:function(e,t){this.queryParams[e]=t}},{key:"getQueryParam",value:function(e){return this.queryParams[e]}},{key:"generateMethodUrl",value:function(e,t){return"vk://".concat(e)+c(t,t)}},{key:"call",value:function(e,t){if(M("proxy.call",e.methodName,t),r.a.supports(e.methodName))M("proxy.call - vk ui connect",e.methodName,t),r.a.send(e.methodName,t);else if(e.deprecatedMethodName&&!this.isVKUiConnectSupport()){var o=e.params2QsForDepredcated?c(t):t;s()?(M("proxy.call - old android",e.deprecatedMethodName,o),window.AndroidBridge.callMethod(e.deprecatedMethodName,o)):(M("proxy.call - old ios/web",e.deprecatedMethodName,o),r.a.send(e.deprecatedMethodName,o))}else M(e.methodName,"is not implemented"),e.response({type:e.failedEvent,data:{error_type:"client",error_data:{error_code:1,error_reason:"not_implemented",error_description:"This method not implemented"}}});u()||s()||(window.location.href=this.generateMethodUrl(e.methodName,t))}},{key:"apiCall",value:function(e,t){M("proxy.apiCall",e.methodName,t),s()?window.AndroidBridge.apiCall(t.method,t.query,t.callbackId):this.call(e,t)}},{key:"response",value:function(e){for(var t,o=arguments.length,n=new Array(o>1?o-1:0),r=1;r<o;r++)n[r-1]=arguments[r];if(M.apply(void 0,["proxy.response",e].concat(n)),!this.methods[e])throw new Error("Method "+e+" is undefined or invalid");(t=this.methods[e]).deprecatedResponse.apply(t,n)}},{key:"apiResponse",value:function(e,t){M("proxy.apiResponse",e,t);var o={type:v.successEven,data:{request_id:e,response:t.response}};this.methods[v.methodName].response(o)}},{key:"isVKUiConnectSupport",value:function(){return r.a.supports("VKWebAppInit")}}])&&j(t.prototype,o),n&&j(t,n),e}();function N(e){return(N="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 K(e,t){for(var o=0;o<t.length;o++){var n=t[o];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function T(e,t){return!t||"object"!==N(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function W(e){return(W=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function B(e,t){return(B=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var C=function(e){function t(e){var o;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),(o=T(this,W(t).call(this,e))).methodName="VKWebAppShowInviteBox",o.deprecatedMethodName="showInviteBox",o.successEvent="VKWebAppShowInviteBoxResult",o.failedEvent="VKWebAppShowInviteBoxFailed",o}var o,n,r;return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&B(e,t)}(t,l),o=t,(n=[{key:"request",value:function(){this.proxy.call(this,{})}},{key:"deprecatedResponse",value:function(e,t){g("onInviteBoxDone",e,t=t||[])}},{key:"response",value:function(e){g("onInviteBoxDone",this.eventToStatus(e),e.data.notSentIds||[])}}])&&K(o.prototype,n),r&&K(o,r),t}();function R(e){return(R="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 q(e,t){for(var o=0;o<t.length;o++){var n=t[o];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function F(e,t){return!t||"object"!==R(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function I(e){return(I=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function D(e,t){return(D=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var Q=function(e){function t(e){var o;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),(o=F(this,I(t).call(this,e))).methodName="VKWebAppShowRequestBox",o.deprecatedMethodName="showRequestBox",o.successEvent="VKWebAppShowRequestBoxResult",o.failedEvent="VKWebAppShowRequestBoxFailed",o}var o,n,r;return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&D(e,t)}(t,l),o=t,(n=[{key:"request",value:function(e,t,o){if(e<=0)throw new Error("UID must be more 0");this.proxy.call(this,{uid:e,message:t,requestKey:o})}},{key:"deprecatedResponse",value:function(e,t){g("onRequestBoxDone",e,t)}},{key:"response",value:function(e){g("onRequestBoxDone",this.eventToStatus(e),e.data.request_id)}}])&&q(o.prototype,n),r&&q(o,r),t}();function U(e){return(U="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 G(e,t){for(var o=0;o<t.length;o++){var n=t[o];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function L(e,t){return!t||"object"!==U(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function H(e){return(H=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function J(e,t){return(J=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var z=function(e){function t(e){var o;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),(o=L(this,H(t).call(this,e))).methodName="VKWebAppShowOrderBox",o.deprecatedMethodName="showOrderBox",o.successEvent="VKWebAppShowOrderBoxResult",o.failedEvent="VKWebAppShowOrderBoxFailed",o}var o,n,r;return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&J(e,t)}(t,l),o=t,(n=[{key:"request",value:function(e){var t={};if("object"!==U(e))throw new Error("Order box params must be object");if(void 0===e.type)throw new Error("Order box param type must be string");switch(e.type){case"votes":if("number"!=typeof e.votes)throw new Error("Order box param votes must be int");t.type="votes",t.votes=e.votes;break;case"item":if("string"!=typeof e.item)throw new Error("Order box param item must be string");t.type="item",t.item=e.item;break;default:throw new Error("Order box param type with invalid value")}this.proxy.call(this,t)}},{key:"deprecatedResponse",value:function(e){g("onOrderBoxDone",e)}},{key:"response",value:function(e){g("onOrderBoxDone",this.eventToStatus(e))}}])&&G(o.prototype,n),r&&G(o,r),t}();function X(e){return(X="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 Y(e,t){for(var o=0;o<t.length;o++){var n=t[o];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function Z(e,t){return!t||"object"!==X(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function $(e){return($=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function ee(e,t){return(ee=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var te=function(e){function t(e){var o;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),(o=Z(this,$(t).call(this,e))).methodName="VKWebAppShare",o.deprecatedMethodName="showShareBox",o.successEvent="VKWebAppShareResult",o.failedEvent="VKWebAppShareFailed",o}var o,n,i;return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&ee(e,t)}(t,l),o=t,(n=[{key:"request",value:function(e,t,o){var n;n=r.a.supports(this.methodName)?{}:{message:e,attachments:t,target:o||"wall"},this.proxy.call(this,n)}},{key:"response",value:function(e){g("onShareBoxDone",this.eventToStatus(e))}},{key:"deprecatedResponse",value:function(e){g("onShareBoxDone",e)}}])&&Y(o.prototype,n),i&&Y(o,i),t}();function oe(e){return(oe="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 ne(e,t){for(var o=0;o<t.length;o++){var n=t[o];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function re(e,t){return!t||"object"!==oe(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function ie(e){return(ie=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function ae(e,t){return(ae=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var ue=function(e){function t(e){var o;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),(o=re(this,ie(t).call(this,e))).methodName="VKWebAppShowLeaderBoardBox",o.deprecatedMethodName="showLeaderboardBox",o.successEvent="VKWebAppShowLeaderBoardBoxResult",o.failedEvent="VKWebAppShowLeaderBoardBoxFailed",o}var o,n,r;return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&ae(e,t)}(t,l),o=t,(n=[{key:"request",value:function(e){var t={user_result:e};this.proxy.call(this,t)}},{key:"deprecatedResponse",value:function(e){g("onLeaderboardBoxDone",e)}},{key:"response",value:function(e){g("onLeaderboardBoxDone",this.eventToStatus(e))}}])&&ne(o.prototype,n),r&&ne(o,r),t}();function se(e){return(se="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 ce(e,t){for(var o=0;o<t.length;o++){var n=t[o];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function pe(e,t){return!t||"object"!==se(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function le(e){return(le=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function fe(e,t){return(fe=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var ye=function(e){function t(e){var o;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),(o=pe(this,le(t).call(this,e))).methodName="VKWebAppAddToFavorites",o.deprecatedMethodName="addToMenu",o.successEvent="VKWebAppAddToFavoritesResult",o.failedEvent="VKWebAppAddToFavoritesFailed",o}var o,n,r;return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&fe(e,t)}(t,l),o=t,(n=[{key:"request",value:function(){this.proxy.call(this,{})}},{key:"response",value:function(e){g("onAddToMenuDone",this.eventToStatus(e))}},{key:"deprecatedResponse",value:function(e){g("onAddToMenuDone",e)}}])&&ce(o.prototype,n),r&&ce(o,r),t}();function de(e){return(de="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 he(e,t){for(var o=0;o<t.length;o++){var n=t[o];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function be(e,t){return!t||"object"!==de(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function ve(e){return(ve=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function me(e,t){return(me=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var we=function(e){function t(e){var o;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),(o=be(this,ve(t).call(this,e))).methodName="VKWebAppAllowMessagesFromGroup",o.deprecatedMethodName="showAllowMessagesFromCommunityBox",o.successEvent="VKWebAppAllowMessagesFromGroupResult",o.failedEvent="VKWebAppAllowMessagesFromGroupFailed",o}var o,n,i;return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&me(e,t)}(t,l),o=t,(n=[{key:"request",value:function(e){var t={};r.a.supports(this.methodName)?t.group_id=+e:t.groupId=+e,this.proxy.call(this,t)}},{key:"response",value:function(e){"success"===this.eventToStatus(e)?g("onAllowMessagesFromCommunity"):g("onAllowMessagesFromCommunityCancel")}},{key:"deprecatedResponse",value:function(e){g("success"===e?"onAllowMessagesFromCommunity":"onAllowMessagesFromCommunityCancel")}}])&&he(o.prototype,n),i&&he(o,i),t}();function ge(){return(ge=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var o=arguments[t];for(var n in o)Object.prototype.hasOwnProperty.call(o,n)&&(e[n]=o[n])}return e}).apply(this,arguments)}function Oe(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var o=[],n=!0,r=!1,i=void 0;try{for(var a,u=e[Symbol.iterator]();!(n=(a=u.next()).done)&&(o.push(a.value),!t||o.length!==t);n=!0);}catch(e){r=!0,i=e}finally{try{n||null==u.return||u.return()}finally{if(r)throw i}}return o}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}function ke(e,t){for(var o=0;o<t.length;o++){var n=t[o];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}o.d(t,"a",function(){return _e});var _e=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.version=null,this.funcs={},this.proxy=null}var t,o,n;return t=e,(o=[{key:"init",value:function(e,t,o,n){var r=this.initQueryParams(n);r?(o&&(this.version=o),this.proxy=new V(r),this.initMethods(),this.proxy.initVkUiConnectApp(),a(e)&&e()):a(t)&&t()}},{key:"initMethods",value:function(){this.apiMethod=new v(this.proxy),this.proxy.addMethod(this.apiMethod),this.funcs.showSettingsBox=new P(this.proxy),this.funcs.showInviteBox=new C(this.proxy),this.funcs.showRequestBox=new Q(this.proxy),this.funcs.showOrderBox=new z(this.proxy),this.funcs.showLeaderboardBox=new ue(this.proxy),this.funcs.showShareBox=new te(this.proxy),this.funcs.addToMenu=new ye(this.proxy),this.funcs.showAllowMessagesFromCommunityBox=new we(this.proxy),this.proxy.addPublicMethods(this.funcs)}},{key:"initQueryParams",value:function(e){if(~(e=e||window.location.search).indexOf("?")){var t=e.split("?");e=Oe(t,2)[1]}return!!e.length&&function(e){var t={};return(e=e.toString().trim()).length?(e.split("&").forEach(function(e){var o=i(e.split("="),2),n=o[0],r=o[1];n=decodeURIComponent(n),r=decodeURIComponent(r||""),t[n]=r}),t):t}(e)}},{key:"addCallback",value:function(e,t){!function(e,t){a(t)&&(w[e]=t)}(e,t)}},{key:"removeCallback",value:function(e){!function(e){delete w[e]}(e)}},{key:"callMethod",value:function(e){if(!this.proxy)throw new Error("Sdk is not init");var t=this.funcs[e];if(void 0===t||!a(t.request))throw new Error("Method "+e+" is not supported or invalid");for(var o=arguments.length,n=new Array(o>1?o-1:0),r=1;r<o;r++)n[r-1]=arguments[r];t.request.apply(t,n)}},{key:"api",value:function(e,t,o){ge(t=t||{},{v:t.v||this.version}),this.apiMethod.request(e,t,o)}}])&&ke(t.prototype,o),n&&ke(t,n),e}()},,function(e,t,o){"use strict";o.r(t);var n=o(1);o.d(t,"MobileSdk",function(){return n.a})}]); | ||
!function(e){var t={};function o(n){if(t[n])return t[n].exports;var r=t[n]={i:n,l:!1,exports:{}};return e[n].call(r.exports,r,r.exports,o),r.l=!0,r.exports}o.m=e,o.c=t,o.d=function(e,t,n){o.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},o.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},o.t=function(e,t){if(1&t&&(e=o(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(o.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var r in e)o.d(n,r,function(t){return e[t]}.bind(null,r));return n},o.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return o.d(t,"a",t),t},o.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},o.p="",o(o.s=3)}([function(e,t){!function(t){var o=[],n=void 0!==t&&!t.AndroidBridge&&!t.webkit,r=n?"message":"VKWebAppEvent";void 0!==t&&(t.CustomEvent||function(){function e(e,t){t=t||{bubbles:!1,cancelable:!1,detail:void 0};var o=document.createEvent("CustomEvent");return o.initCustomEvent(e,t.bubbles,t.cancelable,t.detail),o}e.prototype=t.Event.prototype,t.CustomEvent=e}(),t.addEventListener(r,function(){var e=Array.prototype.slice.call(arguments),t=o.slice();n?t.forEach(function(t){t({detail:e[0].data})}):t.forEach(function(t){t.apply(null,e)})})),e.exports={send:function(e,o){o||(o={});var n=void 0!==t,r=n&&t.AndroidBridge,i=n&&t.webkit&&t.webkit.messageHandlers,a=!r&&!i;r&&"function"==typeof r[e]&&r[e](JSON.stringify(o)),i&&i[e]&&"function"==typeof i[e].postMessage&&i[e].postMessage(o),a&&parent.postMessage({handler:e,params:o,type:"vk-connect"},"*")},subscribe:function(e){o.push(e)},unsubscribe:function(e){var t=o.indexOf(e);t>-1&&o.splice(t,1)},supports:function(e){var o=void 0!==t,n=o&&t.AndroidBridge,r=o&&t.webkit&&t.webkit.messageHandlers;return!(!n||"function"!=typeof n[e])||(!(!r||!r[e]||"function"!=typeof r[e].postMessage)||!(r||n||!~["VKWebAppGetAuthToken","VKWebAppCallAPIMethod","VKWebAppGetGeodata","VKWebAppGetUserInfo","VKWebAppGetPhoneNumber","VKWebAppGetClientVersion","VKWebAppOpenPayForm","VKWebAppShare","VKWebAppAllowNotifications","VKWebAppDenyNotifications","VKWebAppShowWallPostBox","VKWebAppGetEmail","VKWebAppAllowMessagesFromGroup","VKWebAppJoinGroup","VKWebAppOpenApp","VKWebAppSetLocation","VKWebAppScroll","VKWebAppResizeWindow"].indexOf(e)))}}}(window)},function(e,t,o){"use strict";var n=o(0),r=o.n(n);function i(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var o=[],n=!0,r=!1,i=void 0;try{for(var a,u=e[Symbol.iterator]();!(n=(a=u.next()).done)&&(o.push(a.value),!t||o.length!==t);n=!0);}catch(e){r=!0,i=e}finally{try{n||null==u.return||u.return()}finally{if(r)throw i}}return o}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}function a(e){return e&&"[object Function]"===Object.prototype.toString.call(e)}function u(){return window.AndroidBridge}function s(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(!e)return"";var o=[],n=t?"?":"";for(var r in e)if(e.hasOwnProperty(r)){var i=e[r=encodeURIComponent(r)]||"";i=i.toString(),i=encodeURIComponent(i),o.push("".concat(r,"=").concat(i))}return o.length?n+o.join("&"):""}function c(e,t){for(var o=0;o<t.length;o++){var n=t[o];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}var p=function(){function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.proxy=t,this.methodName="",this.deprecatedMethodName="",this.successEvent="",this.failedEvent="",this.resultEvents=[],this.params2QsForDepredcated=!0}var t,o,n;return t=e,(o=[{key:"getResultEvents",value:function(){return this.resultEvents.length||(this.successEvent&&this.resultEvents.push(this.successEvent),this.failedEvent&&this.resultEvents.push(this.failedEvent)),this.resultEvents}},{key:"request",value:function(){throw new Error("Method ".concat(this.methodName,"(").concat(this.deprecatedMethodName,") is not implemented"))}},{key:"response",value:function(e){throw new Error("Response event handler for ".concat(this.methodName,"(").concat(this.deprecatedMethodName,") is not implemented"))}},{key:"deprecatedResponse",value:function(){throw new Error("Response handler for ".concat(this.methodName,"(").concat(this.deprecatedMethodName,") is not implemented"))}},{key:"eventToStatus",value:function(e){var t=e.type;return e=e.data,t===this.successEvent?"success":e.error_data.error_reason||"fail"}}])&&c(t.prototype,o),n&&c(t,n),e}();function l(e){return(l="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 f(e,t){for(var o=0;o<t.length;o++){var n=t[o];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function y(e,t){return!t||"object"!==l(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function d(e){return(d=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function h(e,t){return(h=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var b=function(e){function t(e){var o;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),(o=y(this,d(t).call(this,e))).successEvent=t.successEven,o.failedEvent=t.failedEvent,o.methodName=t.methodName,o.deprecatedMethodName="VKWebAppApiCall",o.params2QsForDepredcated=!1,o}var o,n,i;return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&h(e,t)}(t,p),o=t,(n=[{key:"request",value:function(e,o,n){var i=r.a.supports(this.methodName),u=(new Date).getUTCMilliseconds().toString();o.access_token=this.proxy.getQueryParam("access_token");var c={method:e,request_id:u,params:o};i||(c.callbackId=u,c.query=s(c.params),delete c.params,delete c.request_id),a(n)&&(t.callbacks[u]=n),i?this.proxy.call(this,c):this.proxy.apiCall(this,c)}},{key:"response",value:function(e){var o=e.data,n=t.callbacks[o.request_id];a(n)&&n(o),delete t.callbacks[o.request_id]}}])&&f(o.prototype,n),i&&f(o,i),t}();b.methodName="VKWebAppCallAPIMethod",b.successEven="VKWebAppCallAPIMethodResult",b.failedEvent="VKWebAppCallAPIMethodFailed",b.callbacks={};var v,m={};function w(e){if(a(m[e])){for(var t=arguments.length,o=new Array(t>1?t-1:0),n=1;n<t;n++)o[n-1]=arguments[n];m[e].apply(m,o)}}function g(e){return(g="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,t){for(var o=0;o<t.length;o++){var n=t[o];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function _(e,t){return!t||"object"!==g(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function k(e){return(k=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function S(e,t){return(S=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function x(e,t,o){return t in e?Object.defineProperty(e,t,{value:o,enumerable:!0,configurable:!0,writable:!0}):e[t]=o,e}var E=(x(v={},2,"friends"),x(v,4,"photos"),x(v,16,"video"),x(v,64,"stories"),x(v,128,"pages"),x(v,1024,"status"),x(v,2048,"notes"),x(v,8192,"wall"),x(v,32768,"ads"),x(v,1<<17,"docs"),x(v,1<<18,"groups"),x(v,1<<20,"stats"),x(v,1<<27,"market"),v),A=function(e){function t(e){var o;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),(o=_(this,k(t).call(this,e))).methodName="VKWebAppGetAuthToken",o.deprecatedMethodName="showSettingsBox",o.successEvent="VKWebAppAccessTokenReceived",o.failedEvent="VKWebAppAccessTokenFailed",o}var o,n,i;return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&S(e,t)}(t,p),o=t,(n=[{key:"maskToScope",value:function(e){var t=[];for(var o in E)E.hasOwnProperty(o)&&+o&+e&&t.push(E[o]);return t.join(",")}},{key:"request",value:function(e){if(e<0)throw new Error("Mask must be more 0");var t;t=r.a.supports(this.methodName)?{scope:this.maskToScope(e),app_id:+this.proxy.getQueryParam("vk_app_id")||+this.proxy.getQueryParam("api_id")}:{mask:e,access_token:this.proxy.getQueryParam("access_token")},this.proxy.call(this,t)}},{key:"tokenRequest",value:function(){this.proxy.call(this,{app_id:+this.proxy.getQueryParam("vk_app_id")||+this.proxy.getQueryParam("api_id"),scope:this.proxy.getQueryParam("vk_access_token_settings")||this.maskToScope(this.proxy.getQueryParam("api_settings"))||""})}},{key:"deprecatedResponse",value:function(e,t){"success"===e&&t&&this.proxy.setQueryParam("access_token",t),w("onSettingsBoxDone",e,t)}},{key:"response",value:function(e){var t=this.eventToStatus(e);"success"===t&&this.proxy.setQueryParam("access_token",e.data.access_token),w("onSettingsBoxDone",t,e.data.access_token)}}])&&O(o.prototype,n),i&&O(o,i),t}();function P(e,t){for(var o=0;o<t.length;o++){var n=t[o];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function j(){var e=document.getElementById("debug");if(e){for(var t=arguments.length,o=new Array(t),n=0;n<t;n++)o[n]=arguments[n];e.innerHTML+=JSON.stringify(o)+"<br>"}}var M=function(){function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.queryParams=t,this.methods={},this.methodEvents={},this.initVkUiConnectListener()}var t,o,n;return t=e,(o=[{key:"initVkUiConnectApp",value:function(){if(this.isVKUiConnectSupport()&&(j("init vk connect"),r.a.send("VKWebAppInit",{}),!this.getQueryParam("access_token"))){var e=new A(this);this.addMethod(e),this.addMethod(e),e.tokenRequest()}}},{key:"initVkUiConnectListener",value:function(){var e=this;r.a.subscribe(function(t){var o=t.detail||{},n=o.type;j("eventName",n),j("eventData",o),e.methodEvents[n]&&e.methodEvents[n].response(o)})}},{key:"addPublicMethods",value:function(e){var t=this;Object.keys(e).forEach(function(o){var n=e[o];t.addMethod(n)})}},{key:"addMethod",value:function(e){var t=this,o=e.getResultEvents();o.length&&o.forEach(function(o){t.methodEvents[o]=e}),this.methods[e.methodName]=e,e.deprecatedMethodName&&(this.methods[e.deprecatedMethodName]=e)}},{key:"setQueryParam",value:function(e,t){this.queryParams[e]=t}},{key:"getQueryParam",value:function(e){return this.queryParams[e]}},{key:"call",value:function(e,t){if(j("proxy.call",e.methodName,t),r.a.supports(e.methodName))j("proxy.call - vk ui connect",e.methodName,t),r.a.send(e.methodName,t);else if(e.deprecatedMethodName&&!this.isVKUiConnectSupport()){var o=e.params2QsForDepredcated?s(t):t;u()?(j("proxy.call - old android",e.deprecatedMethodName,o),window.AndroidBridge.callMethod(e.deprecatedMethodName,o)):(j("proxy.call - old ios/web",e.deprecatedMethodName,o),r.a.send(e.deprecatedMethodName,o))}else j(e.methodName,"is not implemented"),e.response({type:e.failedEvent,data:{error_type:"client",error_data:{error_code:1,error_reason:"not_implemented",error_description:"This method not implemented"}}})}},{key:"apiCall",value:function(e,t){j("proxy.apiCall",e.methodName,t),u()?window.AndroidBridge.apiCall(t.method,t.query,t.callbackId):this.call(e,t)}},{key:"response",value:function(e){for(var t,o=arguments.length,n=new Array(o>1?o-1:0),r=1;r<o;r++)n[r-1]=arguments[r];if(j.apply(void 0,["proxy.response",e].concat(n)),!this.methods[e])throw new Error("Method "+e+" is undefined or invalid");(t=this.methods[e]).deprecatedResponse.apply(t,n)}},{key:"apiResponse",value:function(e,t){j("proxy.apiResponse",e,t);var o={type:b.successEven,data:{request_id:e,response:t.response}};this.methods[b.methodName].response(o)}},{key:"isVKUiConnectSupport",value:function(){return r.a.supports("VKWebAppInit")||r.a.supports("VKWebAppGetAuthToken")}}])&&P(t.prototype,o),n&&P(t,n),e}();function V(e){return(V="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 K(e,t){for(var o=0;o<t.length;o++){var n=t[o];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function N(e,t){return!t||"object"!==V(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function T(e){return(T=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function W(e,t){return(W=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var B=function(e){function t(e){var o;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),(o=N(this,T(t).call(this,e))).methodName="VKWebAppShowInviteBox",o.deprecatedMethodName="showInviteBox",o.successEvent="VKWebAppShowInviteBoxResult",o.failedEvent="VKWebAppShowInviteBoxFailed",o}var o,n,r;return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&W(e,t)}(t,p),o=t,(n=[{key:"request",value:function(){this.proxy.call(this,{})}},{key:"deprecatedResponse",value:function(e,t){w("onInviteBoxDone",e,t=t||[])}},{key:"response",value:function(e){w("onInviteBoxDone",this.eventToStatus(e),e.data.notSentIds||[])}}])&&K(o.prototype,n),r&&K(o,r),t}();function C(e){return(C="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,t){for(var o=0;o<t.length;o++){var n=t[o];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function q(e,t){return!t||"object"!==C(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function F(e){return(F=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function I(e,t){return(I=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var D=function(e){function t(e){var o;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),(o=q(this,F(t).call(this,e))).methodName="VKWebAppShowRequestBox",o.deprecatedMethodName="showRequestBox",o.successEvent="VKWebAppShowRequestBoxResult",o.failedEvent="VKWebAppShowRequestBoxFailed",o}var o,n,r;return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&I(e,t)}(t,p),o=t,(n=[{key:"request",value:function(e,t,o){if(e<=0)throw new Error("UID must be more 0");this.proxy.call(this,{uid:e,message:t,requestKey:o})}},{key:"deprecatedResponse",value:function(e,t){w("onRequestBoxDone",e,t)}},{key:"response",value:function(e){w("onRequestBoxDone",this.eventToStatus(e),e.data.request_id)}}])&&R(o.prototype,n),r&&R(o,r),t}();function Q(e){return(Q="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 G(e,t){for(var o=0;o<t.length;o++){var n=t[o];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function U(e,t){return!t||"object"!==Q(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function L(e){return(L=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function H(e,t){return(H=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var J=function(e){function t(e){var o;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),(o=U(this,L(t).call(this,e))).methodName="VKWebAppShowOrderBox",o.deprecatedMethodName="showOrderBox",o.successEvent="VKWebAppShowOrderBoxResult",o.failedEvent="VKWebAppShowOrderBoxFailed",o}var o,n,r;return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&H(e,t)}(t,p),o=t,(n=[{key:"request",value:function(e){var t={};if("object"!==Q(e))throw new Error("Order box params must be object");if(void 0===e.type)throw new Error("Order box param type must be string");switch(e.type){case"votes":if("number"!=typeof e.votes)throw new Error("Order box param votes must be int");t.type="votes",t.votes=e.votes;break;case"item":if("string"!=typeof e.item)throw new Error("Order box param item must be string");t.type="item",t.item=e.item;break;default:throw new Error("Order box param type with invalid value")}this.proxy.call(this,t)}},{key:"deprecatedResponse",value:function(e){w("onOrderBoxDone",e)}},{key:"response",value:function(e){w("onOrderBoxDone",this.eventToStatus(e))}}])&&G(o.prototype,n),r&&G(o,r),t}();function z(e){return(z="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 X(e,t){for(var o=0;o<t.length;o++){var n=t[o];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function Y(e,t){return!t||"object"!==z(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function Z(e){return(Z=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function $(e,t){return($=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var ee=function(e){function t(e){var o;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),(o=Y(this,Z(t).call(this,e))).methodName="VKWebAppShare",o.deprecatedMethodName="showShareBox",o.successEvent="VKWebAppShareResult",o.failedEvent="VKWebAppShareFailed",o}var o,n,i;return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&$(e,t)}(t,p),o=t,(n=[{key:"request",value:function(e,t,o){var n;n=r.a.supports(this.methodName)?{}:{message:e,attachments:t,target:o||"wall"},this.proxy.call(this,n)}},{key:"response",value:function(e){w("onShareBoxDone",this.eventToStatus(e))}},{key:"deprecatedResponse",value:function(e){w("onShareBoxDone",e)}}])&&X(o.prototype,n),i&&X(o,i),t}();function te(e){return(te="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 oe(e,t){for(var o=0;o<t.length;o++){var n=t[o];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function ne(e,t){return!t||"object"!==te(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function re(e){return(re=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function ie(e,t){return(ie=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var ae=function(e){function t(e){var o;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),(o=ne(this,re(t).call(this,e))).methodName="VKWebAppShowLeaderBoardBox",o.deprecatedMethodName="showLeaderboardBox",o.successEvent="VKWebAppShowLeaderBoardBoxResult",o.failedEvent="VKWebAppShowLeaderBoardBoxFailed",o}var o,n,r;return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&ie(e,t)}(t,p),o=t,(n=[{key:"request",value:function(e){var t={user_result:e};this.proxy.call(this,t)}},{key:"deprecatedResponse",value:function(e){w("onLeaderboardBoxDone",e)}},{key:"response",value:function(e){w("onLeaderboardBoxDone",this.eventToStatus(e))}}])&&oe(o.prototype,n),r&&oe(o,r),t}();function ue(e){return(ue="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 se(e,t){for(var o=0;o<t.length;o++){var n=t[o];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function ce(e,t){return!t||"object"!==ue(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function pe(e){return(pe=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function le(e,t){return(le=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var fe=function(e){function t(e){var o;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),(o=ce(this,pe(t).call(this,e))).methodName="VKWebAppAddToFavorites",o.deprecatedMethodName="addToMenu",o.successEvent="VKWebAppAddToFavoritesResult",o.failedEvent="VKWebAppAddToFavoritesFailed",o}var o,n,r;return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&le(e,t)}(t,p),o=t,(n=[{key:"request",value:function(){this.proxy.call(this,{})}},{key:"response",value:function(e){w("onAddToMenuDone",this.eventToStatus(e))}},{key:"deprecatedResponse",value:function(e){w("onAddToMenuDone",e)}}])&&se(o.prototype,n),r&&se(o,r),t}();function ye(e){return(ye="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 de(e,t){for(var o=0;o<t.length;o++){var n=t[o];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function he(e,t){return!t||"object"!==ye(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function be(e){return(be=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function ve(e,t){return(ve=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var me=function(e){function t(e){var o;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),(o=he(this,be(t).call(this,e))).methodName="VKWebAppAllowMessagesFromGroup",o.deprecatedMethodName="showAllowMessagesFromCommunityBox",o.successEvent="VKWebAppAllowMessagesFromGroupResult",o.failedEvent="VKWebAppAllowMessagesFromGroupFailed",o}var o,n,i;return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&ve(e,t)}(t,p),o=t,(n=[{key:"request",value:function(e){var t={};r.a.supports(this.methodName)?t.group_id=+e:t.groupId=+e,this.proxy.call(this,t)}},{key:"response",value:function(e){"success"===this.eventToStatus(e)?w("onAllowMessagesFromCommunity"):w("onAllowMessagesFromCommunityCancel")}},{key:"deprecatedResponse",value:function(e){w("success"===e?"onAllowMessagesFromCommunity":"onAllowMessagesFromCommunityCancel")}}])&&de(o.prototype,n),i&&de(o,i),t}();function we(){return(we=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var o=arguments[t];for(var n in o)Object.prototype.hasOwnProperty.call(o,n)&&(e[n]=o[n])}return e}).apply(this,arguments)}function ge(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var o=[],n=!0,r=!1,i=void 0;try{for(var a,u=e[Symbol.iterator]();!(n=(a=u.next()).done)&&(o.push(a.value),!t||o.length!==t);n=!0);}catch(e){r=!0,i=e}finally{try{n||null==u.return||u.return()}finally{if(r)throw i}}return o}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}function Oe(e,t){for(var o=0;o<t.length;o++){var n=t[o];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}o.d(t,"a",function(){return _e});var _e=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.version=null,this.funcs={},this.proxy=null}var t,o,n;return t=e,(o=[{key:"init",value:function(e,t,o,n){var r=this.initQueryParams(n);r?(o&&(this.version=o),this.proxy=new M(r),this.initMethods(),this.proxy.initVkUiConnectApp(),a(e)&&e()):a(t)&&t()}},{key:"initMethods",value:function(){this.apiMethod=new b(this.proxy),this.proxy.addMethod(this.apiMethod),this.funcs.showSettingsBox=new A(this.proxy),this.funcs.showInviteBox=new B(this.proxy),this.funcs.showRequestBox=new D(this.proxy),this.funcs.showOrderBox=new J(this.proxy),this.funcs.showLeaderboardBox=new ae(this.proxy),this.funcs.showShareBox=new ee(this.proxy),this.funcs.addToMenu=new fe(this.proxy),this.funcs.showAllowMessagesFromCommunityBox=new me(this.proxy),this.proxy.addPublicMethods(this.funcs)}},{key:"initQueryParams",value:function(e){if(~(e=e||window.location.search).indexOf("?")){var t=e.split("?");e=ge(t,2)[1]}return!!e.length&&function(e){var t={};return(e=e.toString().trim()).length?(e.split("&").forEach(function(e){var o=i(e.split("="),2),n=o[0],r=o[1];n=decodeURIComponent(n),r=decodeURIComponent(r||""),t[n]=r}),t):t}(e)}},{key:"addCallback",value:function(e,t){!function(e,t){a(t)&&(m[e]=t)}(e,t)}},{key:"removeCallback",value:function(e){!function(e){delete m[e]}(e)}},{key:"callMethod",value:function(e){if(!this.proxy)throw new Error("Sdk is not init");var t=this.funcs[e];if(void 0===t||!a(t.request))throw new Error("Method "+e+" is not supported or invalid");for(var o=arguments.length,n=new Array(o>1?o-1:0),r=1;r<o;r++)n[r-1]=arguments[r];t.request.apply(t,n)}},{key:"api",value:function(e,t,o){we(t=t||{},{v:t.v||this.version}),this.apiMethod.request(e,t,o)}}])&&Oe(t.prototype,o),n&&Oe(t,n),e}()},,function(e,t,o){"use strict";o.r(t);var n=o(1);o.d(t,"MobileSdk",function(){return n.a})}]); |
@@ -1,1 +0,1 @@ | ||
!function(e){var t={};function o(n){if(t[n])return t[n].exports;var r=t[n]={i:n,l:!1,exports:{}};return e[n].call(r.exports,r,r.exports,o),r.l=!0,r.exports}o.m=e,o.c=t,o.d=function(e,t,n){o.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},o.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},o.t=function(e,t){if(1&t&&(e=o(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(o.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var r in e)o.d(n,r,function(t){return e[t]}.bind(null,r));return n},o.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return o.d(t,"a",t),t},o.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},o.p="",o(o.s=2)}([function(e,t){!function(t){var o=[],n=void 0!==t&&!t.AndroidBridge&&!t.webkit,r=n?"message":"VKWebAppEvent";void 0!==t&&(t.CustomEvent||function(){function e(e,t){t=t||{bubbles:!1,cancelable:!1,detail:void 0};var o=document.createEvent("CustomEvent");return o.initCustomEvent(e,t.bubbles,t.cancelable,t.detail),o}e.prototype=t.Event.prototype,t.CustomEvent=e}(),t.addEventListener(r,function(){var e=Array.prototype.slice.call(arguments),t=o.slice();n?t.forEach(function(t){t({detail:e[0].data})}):t.forEach(function(t){t.apply(null,e)})})),e.exports={send:function(e,o){o||(o={});var n=void 0!==t,r=n&&t.AndroidBridge,i=n&&t.webkit&&t.webkit.messageHandlers,a=!r&&!i;r&&"function"==typeof r[e]&&r[e](JSON.stringify(o)),i&&i[e]&&"function"==typeof i[e].postMessage&&i[e].postMessage(o),a&&parent.postMessage({handler:e,params:o,type:"vk-connect"},"*")},subscribe:function(e){o.push(e)},unsubscribe:function(e){var t=o.indexOf(e);t>-1&&o.splice(t,1)},supports:function(e){var o=void 0!==t,n=o&&t.AndroidBridge,r=o&&t.webkit&&t.webkit.messageHandlers;return!(!n||"function"!=typeof n[e])||(!(!r||!r[e]||"function"!=typeof r[e].postMessage)||!(r||n||!~["VKWebAppGetAuthToken","VKWebAppCallAPIMethod","VKWebAppGetGeodata","VKWebAppGetUserInfo","VKWebAppGetPhoneNumber","VKWebAppGetClientVersion","VKWebAppOpenPayForm","VKWebAppShare","VKWebAppAllowNotifications","VKWebAppDenyNotifications","VKWebAppShowWallPostBox","VKWebAppGetEmail","VKWebAppAllowMessagesFromGroup","VKWebAppJoinGroup","VKWebAppOpenApp","VKWebAppSetLocation","VKWebAppScroll","VKWebAppResizeWindow"].indexOf(e)))}}}(window)},function(e,t,o){"use strict";var n=o(0),r=o.n(n);function i(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var o=[],n=!0,r=!1,i=void 0;try{for(var a,u=e[Symbol.iterator]();!(n=(a=u.next()).done)&&(o.push(a.value),!t||o.length!==t);n=!0);}catch(e){r=!0,i=e}finally{try{n||null==u.return||u.return()}finally{if(r)throw i}}return o}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}function a(e){return e&&"[object Function]"===Object.prototype.toString.call(e)}function u(){return window.webkit&&window.webkit.messageHandlers}function s(){return window.AndroidBridge}function c(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(!e)return"";var o=[],n=t?"?":"";for(var r in e)if(e.hasOwnProperty(r)){var i=e[r=encodeURIComponent(r)]||"";i=i.toString(),i=encodeURIComponent(i),o.push("".concat(r,"=").concat(i))}return o.length?n+o.join("&"):""}function p(e,t){for(var o=0;o<t.length;o++){var n=t[o];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}var l=function(){function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.proxy=t,this.methodName="",this.deprecatedMethodName="",this.successEvent="",this.failedEvent="",this.resultEvents=[],this.params2QsForDepredcated=!0}var t,o,n;return t=e,(o=[{key:"getResultEvents",value:function(){return this.resultEvents.length||(this.successEvent&&this.resultEvents.push(this.successEvent),this.failedEvent&&this.resultEvents.push(this.failedEvent)),this.resultEvents}},{key:"request",value:function(){throw new Error("Method ".concat(this.methodName,"(").concat(this.deprecatedMethodName,") is not implemented"))}},{key:"response",value:function(e){throw new Error("Response event handler for ".concat(this.methodName,"(").concat(this.deprecatedMethodName,") is not implemented"))}},{key:"deprecatedResponse",value:function(){throw new Error("Response handler for ".concat(this.methodName,"(").concat(this.deprecatedMethodName,") is not implemented"))}},{key:"eventToStatus",value:function(e){var t=e.type;return e=e.data,t===this.successEvent?"success":e.error_data.error_reason||"fail"}}])&&p(t.prototype,o),n&&p(t,n),e}();function f(e){return(f="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 y(e,t){for(var o=0;o<t.length;o++){var n=t[o];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function d(e,t){return!t||"object"!==f(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function h(e){return(h=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function b(e,t){return(b=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var v=function(e){function t(e){var o;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),(o=d(this,h(t).call(this,e))).successEvent=t.successEven,o.failedEvent=t.failedEvent,o.methodName=t.methodName,o.deprecatedMethodName="VKWebAppApiCall",o.params2QsForDepredcated=!1,o}var o,n,i;return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&b(e,t)}(t,l),o=t,(n=[{key:"request",value:function(e,o,n){var i=r.a.supports(this.methodName),u=(new Date).getUTCMilliseconds().toString();o.access_token=this.proxy.getQueryParam("access_token");var s={method:e,request_id:u,params:o};i||(s.callbackId=u,s.query=c(s.params),delete s.params,delete s.request_id),a(n)&&(t.callbacks[u]=n),i?this.proxy.call(this,s):this.proxy.apiCall(this,s)}},{key:"response",value:function(e){var o=e.data,n=t.callbacks[o.request_id];a(n)&&n(o),delete t.callbacks[o.request_id]}}])&&y(o.prototype,n),i&&y(o,i),t}();v.methodName="VKWebAppCallAPIMethod",v.successEven="VKWebAppCallAPIMethodResult",v.failedEvent="VKWebAppCallAPIMethodFailed",v.callbacks={};var m,w={};function g(e){if(a(w[e])){for(var t=arguments.length,o=new Array(t>1?t-1:0),n=1;n<t;n++)o[n-1]=arguments[n];w[e].apply(w,o)}}function O(e){return(O="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 k(e,t){for(var o=0;o<t.length;o++){var n=t[o];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function _(e,t){return!t||"object"!==O(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function S(e){return(S=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function x(e,t){return(x=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function E(e,t,o){return t in e?Object.defineProperty(e,t,{value:o,enumerable:!0,configurable:!0,writable:!0}):e[t]=o,e}var A=(E(m={},2,"friends"),E(m,4,"photos"),E(m,16,"video"),E(m,64,"stories"),E(m,128,"pages"),E(m,1024,"status"),E(m,2048,"notes"),E(m,8192,"wall"),E(m,32768,"ads"),E(m,1<<17,"docs"),E(m,1<<18,"groups"),E(m,1<<20,"stats"),E(m,1<<27,"market"),m),P=function(e){function t(e){var o;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),(o=_(this,S(t).call(this,e))).methodName="VKWebAppGetAuthToken",o.deprecatedMethodName="showSettingsBox",o.successEvent="VKWebAppAccessTokenReceived",o.failedEvent="VKWebAppAccessTokenFailed",o}var o,n,i;return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&x(e,t)}(t,l),o=t,(n=[{key:"maskToScope",value:function(e){var t=[];for(var o in A)A.hasOwnProperty(o)&&+o&+e&&t.push(A[o]);return t.join(",")}},{key:"request",value:function(e){if(e<0)throw new Error("Mask must be more 0");var t;t=r.a.supports(this.methodName)?{scope:this.maskToScope(e),app_id:+this.proxy.getQueryParam("vk_app_id")||+this.proxy.getQueryParam("api_id")}:{mask:e,access_token:this.proxy.getQueryParam("access_token")},this.proxy.call(this,t)}},{key:"tokenRequest",value:function(){this.proxy.call(this,{app_id:+this.proxy.getQueryParam("vk_app_id")||+this.proxy.getQueryParam("api_id"),scope:this.proxy.getQueryParam("vk_access_token_settings")||this.maskToScope(this.proxy.getQueryParam("api_settings"))||""})}},{key:"deprecatedResponse",value:function(e,t){"success"===e&&t&&this.proxy.setQueryParam("access_token",t),g("onSettingsBoxDone",e,t)}},{key:"response",value:function(e){var t=this.eventToStatus(e);"success"===t&&this.proxy.setQueryParam("access_token",e.data.access_token),g("onSettingsBoxDone",t,e.data.access_token)}}])&&k(o.prototype,n),i&&k(o,i),t}();function j(e,t){for(var o=0;o<t.length;o++){var n=t[o];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function M(){var e=document.getElementById("debug");if(e){for(var t=arguments.length,o=new Array(t),n=0;n<t;n++)o[n]=arguments[n];e.innerHTML+=JSON.stringify(o)+"<br>"}}var V=function(){function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.queryParams=t,this.methods={},this.methodEvents={},this.initVkUiConnectListener()}var t,o,n;return t=e,(o=[{key:"initVkUiConnectApp",value:function(){if(this.isVKUiConnectSupport()&&(M("init vk connect"),r.a.send("VKWebAppInit",{}),!this.getQueryParam("access_token"))){var e=new P(this);this.addMethod(e),this.addMethod(e),e.tokenRequest()}}},{key:"initVkUiConnectListener",value:function(){var e=this;r.a.subscribe(function(t){var o=t.detail||{},n=o.type;M("eventName",n),M("eventData",o),e.methodEvents[n]&&e.methodEvents[n].response(o)})}},{key:"addPublicMethods",value:function(e){var t=this;Object.keys(e).forEach(function(o){var n=e[o];t.addMethod(n)})}},{key:"addMethod",value:function(e){var t=this,o=e.getResultEvents();o.length&&o.forEach(function(o){t.methodEvents[o]=e}),this.methods[e.methodName]=e,e.deprecatedMethodName&&(this.methods[e.deprecatedMethodName]=e)}},{key:"setQueryParam",value:function(e,t){this.queryParams[e]=t}},{key:"getQueryParam",value:function(e){return this.queryParams[e]}},{key:"generateMethodUrl",value:function(e,t){return"vk://".concat(e)+c(t,t)}},{key:"call",value:function(e,t){if(M("proxy.call",e.methodName,t),r.a.supports(e.methodName))M("proxy.call - vk ui connect",e.methodName,t),r.a.send(e.methodName,t);else if(e.deprecatedMethodName&&!this.isVKUiConnectSupport()){var o=e.params2QsForDepredcated?c(t):t;s()?(M("proxy.call - old android",e.deprecatedMethodName,o),window.AndroidBridge.callMethod(e.deprecatedMethodName,o)):(M("proxy.call - old ios/web",e.deprecatedMethodName,o),r.a.send(e.deprecatedMethodName,o))}else M(e.methodName,"is not implemented"),e.response({type:e.failedEvent,data:{error_type:"client",error_data:{error_code:1,error_reason:"not_implemented",error_description:"This method not implemented"}}});u()||s()||(window.location.href=this.generateMethodUrl(e.methodName,t))}},{key:"apiCall",value:function(e,t){M("proxy.apiCall",e.methodName,t),s()?window.AndroidBridge.apiCall(t.method,t.query,t.callbackId):this.call(e,t)}},{key:"response",value:function(e){for(var t,o=arguments.length,n=new Array(o>1?o-1:0),r=1;r<o;r++)n[r-1]=arguments[r];if(M.apply(void 0,["proxy.response",e].concat(n)),!this.methods[e])throw new Error("Method "+e+" is undefined or invalid");(t=this.methods[e]).deprecatedResponse.apply(t,n)}},{key:"apiResponse",value:function(e,t){M("proxy.apiResponse",e,t);var o={type:v.successEven,data:{request_id:e,response:t.response}};this.methods[v.methodName].response(o)}},{key:"isVKUiConnectSupport",value:function(){return r.a.supports("VKWebAppInit")}}])&&j(t.prototype,o),n&&j(t,n),e}();function K(e){return(K="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 N(e,t){for(var o=0;o<t.length;o++){var n=t[o];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function T(e,t){return!t||"object"!==K(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function W(e){return(W=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function B(e,t){return(B=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var C=function(e){function t(e){var o;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),(o=T(this,W(t).call(this,e))).methodName="VKWebAppShowInviteBox",o.deprecatedMethodName="showInviteBox",o.successEvent="VKWebAppShowInviteBoxResult",o.failedEvent="VKWebAppShowInviteBoxFailed",o}var o,n,r;return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&B(e,t)}(t,l),o=t,(n=[{key:"request",value:function(){this.proxy.call(this,{})}},{key:"deprecatedResponse",value:function(e,t){g("onInviteBoxDone",e,t=t||[])}},{key:"response",value:function(e){g("onInviteBoxDone",this.eventToStatus(e),e.data.notSentIds||[])}}])&&N(o.prototype,n),r&&N(o,r),t}();function R(e){return(R="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 q(e,t){for(var o=0;o<t.length;o++){var n=t[o];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function F(e,t){return!t||"object"!==R(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function I(e){return(I=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function D(e,t){return(D=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var Q=function(e){function t(e){var o;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),(o=F(this,I(t).call(this,e))).methodName="VKWebAppShowRequestBox",o.deprecatedMethodName="showRequestBox",o.successEvent="VKWebAppShowRequestBoxResult",o.failedEvent="VKWebAppShowRequestBoxFailed",o}var o,n,r;return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&D(e,t)}(t,l),o=t,(n=[{key:"request",value:function(e,t,o){if(e<=0)throw new Error("UID must be more 0");this.proxy.call(this,{uid:e,message:t,requestKey:o})}},{key:"deprecatedResponse",value:function(e,t){g("onRequestBoxDone",e,t)}},{key:"response",value:function(e){g("onRequestBoxDone",this.eventToStatus(e),e.data.request_id)}}])&&q(o.prototype,n),r&&q(o,r),t}();function U(e){return(U="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 G(e,t){for(var o=0;o<t.length;o++){var n=t[o];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function L(e,t){return!t||"object"!==U(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function H(e){return(H=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function J(e,t){return(J=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var z=function(e){function t(e){var o;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),(o=L(this,H(t).call(this,e))).methodName="VKWebAppShowOrderBox",o.deprecatedMethodName="showOrderBox",o.successEvent="VKWebAppShowOrderBoxResult",o.failedEvent="VKWebAppShowOrderBoxFailed",o}var o,n,r;return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&J(e,t)}(t,l),o=t,(n=[{key:"request",value:function(e){var t={};if("object"!==U(e))throw new Error("Order box params must be object");if(void 0===e.type)throw new Error("Order box param type must be string");switch(e.type){case"votes":if("number"!=typeof e.votes)throw new Error("Order box param votes must be int");t.type="votes",t.votes=e.votes;break;case"item":if("string"!=typeof e.item)throw new Error("Order box param item must be string");t.type="item",t.item=e.item;break;default:throw new Error("Order box param type with invalid value")}this.proxy.call(this,t)}},{key:"deprecatedResponse",value:function(e){g("onOrderBoxDone",e)}},{key:"response",value:function(e){g("onOrderBoxDone",this.eventToStatus(e))}}])&&G(o.prototype,n),r&&G(o,r),t}();function X(e){return(X="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 Y(e,t){for(var o=0;o<t.length;o++){var n=t[o];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function Z(e,t){return!t||"object"!==X(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function $(e){return($=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function ee(e,t){return(ee=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var te=function(e){function t(e){var o;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),(o=Z(this,$(t).call(this,e))).methodName="VKWebAppShare",o.deprecatedMethodName="showShareBox",o.successEvent="VKWebAppShareResult",o.failedEvent="VKWebAppShareFailed",o}var o,n,i;return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&ee(e,t)}(t,l),o=t,(n=[{key:"request",value:function(e,t,o){var n;n=r.a.supports(this.methodName)?{}:{message:e,attachments:t,target:o||"wall"},this.proxy.call(this,n)}},{key:"response",value:function(e){g("onShareBoxDone",this.eventToStatus(e))}},{key:"deprecatedResponse",value:function(e){g("onShareBoxDone",e)}}])&&Y(o.prototype,n),i&&Y(o,i),t}();function oe(e){return(oe="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 ne(e,t){for(var o=0;o<t.length;o++){var n=t[o];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function re(e,t){return!t||"object"!==oe(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function ie(e){return(ie=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function ae(e,t){return(ae=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var ue=function(e){function t(e){var o;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),(o=re(this,ie(t).call(this,e))).methodName="VKWebAppShowLeaderBoardBox",o.deprecatedMethodName="showLeaderboardBox",o.successEvent="VKWebAppShowLeaderBoardBoxResult",o.failedEvent="VKWebAppShowLeaderBoardBoxFailed",o}var o,n,r;return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&ae(e,t)}(t,l),o=t,(n=[{key:"request",value:function(e){var t={user_result:e};this.proxy.call(this,t)}},{key:"deprecatedResponse",value:function(e){g("onLeaderboardBoxDone",e)}},{key:"response",value:function(e){g("onLeaderboardBoxDone",this.eventToStatus(e))}}])&&ne(o.prototype,n),r&&ne(o,r),t}();function se(e){return(se="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 ce(e,t){for(var o=0;o<t.length;o++){var n=t[o];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function pe(e,t){return!t||"object"!==se(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function le(e){return(le=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function fe(e,t){return(fe=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var ye=function(e){function t(e){var o;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),(o=pe(this,le(t).call(this,e))).methodName="VKWebAppAddToFavorites",o.deprecatedMethodName="addToMenu",o.successEvent="VKWebAppAddToFavoritesResult",o.failedEvent="VKWebAppAddToFavoritesFailed",o}var o,n,r;return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&fe(e,t)}(t,l),o=t,(n=[{key:"request",value:function(){this.proxy.call(this,{})}},{key:"response",value:function(e){g("onAddToMenuDone",this.eventToStatus(e))}},{key:"deprecatedResponse",value:function(e){g("onAddToMenuDone",e)}}])&&ce(o.prototype,n),r&&ce(o,r),t}();function de(e){return(de="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 he(e,t){for(var o=0;o<t.length;o++){var n=t[o];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function be(e,t){return!t||"object"!==de(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function ve(e){return(ve=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function me(e,t){return(me=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var we=function(e){function t(e){var o;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),(o=be(this,ve(t).call(this,e))).methodName="VKWebAppAllowMessagesFromGroup",o.deprecatedMethodName="showAllowMessagesFromCommunityBox",o.successEvent="VKWebAppAllowMessagesFromGroupResult",o.failedEvent="VKWebAppAllowMessagesFromGroupFailed",o}var o,n,i;return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&me(e,t)}(t,l),o=t,(n=[{key:"request",value:function(e){var t={};r.a.supports(this.methodName)?t.group_id=+e:t.groupId=+e,this.proxy.call(this,t)}},{key:"response",value:function(e){"success"===this.eventToStatus(e)?g("onAllowMessagesFromCommunity"):g("onAllowMessagesFromCommunityCancel")}},{key:"deprecatedResponse",value:function(e){g("success"===e?"onAllowMessagesFromCommunity":"onAllowMessagesFromCommunityCancel")}}])&&he(o.prototype,n),i&&he(o,i),t}();function ge(){return(ge=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var o=arguments[t];for(var n in o)Object.prototype.hasOwnProperty.call(o,n)&&(e[n]=o[n])}return e}).apply(this,arguments)}function Oe(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var o=[],n=!0,r=!1,i=void 0;try{for(var a,u=e[Symbol.iterator]();!(n=(a=u.next()).done)&&(o.push(a.value),!t||o.length!==t);n=!0);}catch(e){r=!0,i=e}finally{try{n||null==u.return||u.return()}finally{if(r)throw i}}return o}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}function ke(e,t){for(var o=0;o<t.length;o++){var n=t[o];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}o.d(t,"a",function(){return _e});var _e=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.version=null,this.funcs={},this.proxy=null}var t,o,n;return t=e,(o=[{key:"init",value:function(e,t,o,n){var r=this.initQueryParams(n);r?(o&&(this.version=o),this.proxy=new V(r),this.initMethods(),this.proxy.initVkUiConnectApp(),a(e)&&e()):a(t)&&t()}},{key:"initMethods",value:function(){this.apiMethod=new v(this.proxy),this.proxy.addMethod(this.apiMethod),this.funcs.showSettingsBox=new P(this.proxy),this.funcs.showInviteBox=new C(this.proxy),this.funcs.showRequestBox=new Q(this.proxy),this.funcs.showOrderBox=new z(this.proxy),this.funcs.showLeaderboardBox=new ue(this.proxy),this.funcs.showShareBox=new te(this.proxy),this.funcs.addToMenu=new ye(this.proxy),this.funcs.showAllowMessagesFromCommunityBox=new we(this.proxy),this.proxy.addPublicMethods(this.funcs)}},{key:"initQueryParams",value:function(e){if(~(e=e||window.location.search).indexOf("?")){var t=e.split("?");e=Oe(t,2)[1]}return!!e.length&&function(e){var t={};return(e=e.toString().trim()).length?(e.split("&").forEach(function(e){var o=i(e.split("="),2),n=o[0],r=o[1];n=decodeURIComponent(n),r=decodeURIComponent(r||""),t[n]=r}),t):t}(e)}},{key:"addCallback",value:function(e,t){!function(e,t){a(t)&&(w[e]=t)}(e,t)}},{key:"removeCallback",value:function(e){!function(e){delete w[e]}(e)}},{key:"callMethod",value:function(e){if(!this.proxy)throw new Error("Sdk is not init");var t=this.funcs[e];if(void 0===t||!a(t.request))throw new Error("Method "+e+" is not supported or invalid");for(var o=arguments.length,n=new Array(o>1?o-1:0),r=1;r<o;r++)n[r-1]=arguments[r];t.request.apply(t,n)}},{key:"api",value:function(e,t,o){ge(t=t||{},{v:t.v||this.version}),this.apiMethod.request(e,t,o)}}])&&ke(t.prototype,o),n&&ke(t,n),e}()},function(e,t,o){"use strict";o.r(t);var n=o(1);window.VK||(window.VK=new n.a)}]); | ||
!function(e){var t={};function o(n){if(t[n])return t[n].exports;var r=t[n]={i:n,l:!1,exports:{}};return e[n].call(r.exports,r,r.exports,o),r.l=!0,r.exports}o.m=e,o.c=t,o.d=function(e,t,n){o.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},o.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},o.t=function(e,t){if(1&t&&(e=o(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(o.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var r in e)o.d(n,r,function(t){return e[t]}.bind(null,r));return n},o.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return o.d(t,"a",t),t},o.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},o.p="",o(o.s=2)}([function(e,t){!function(t){var o=[],n=void 0!==t&&!t.AndroidBridge&&!t.webkit,r=n?"message":"VKWebAppEvent";void 0!==t&&(t.CustomEvent||function(){function e(e,t){t=t||{bubbles:!1,cancelable:!1,detail:void 0};var o=document.createEvent("CustomEvent");return o.initCustomEvent(e,t.bubbles,t.cancelable,t.detail),o}e.prototype=t.Event.prototype,t.CustomEvent=e}(),t.addEventListener(r,function(){var e=Array.prototype.slice.call(arguments),t=o.slice();n?t.forEach(function(t){t({detail:e[0].data})}):t.forEach(function(t){t.apply(null,e)})})),e.exports={send:function(e,o){o||(o={});var n=void 0!==t,r=n&&t.AndroidBridge,i=n&&t.webkit&&t.webkit.messageHandlers,a=!r&&!i;r&&"function"==typeof r[e]&&r[e](JSON.stringify(o)),i&&i[e]&&"function"==typeof i[e].postMessage&&i[e].postMessage(o),a&&parent.postMessage({handler:e,params:o,type:"vk-connect"},"*")},subscribe:function(e){o.push(e)},unsubscribe:function(e){var t=o.indexOf(e);t>-1&&o.splice(t,1)},supports:function(e){var o=void 0!==t,n=o&&t.AndroidBridge,r=o&&t.webkit&&t.webkit.messageHandlers;return!(!n||"function"!=typeof n[e])||(!(!r||!r[e]||"function"!=typeof r[e].postMessage)||!(r||n||!~["VKWebAppGetAuthToken","VKWebAppCallAPIMethod","VKWebAppGetGeodata","VKWebAppGetUserInfo","VKWebAppGetPhoneNumber","VKWebAppGetClientVersion","VKWebAppOpenPayForm","VKWebAppShare","VKWebAppAllowNotifications","VKWebAppDenyNotifications","VKWebAppShowWallPostBox","VKWebAppGetEmail","VKWebAppAllowMessagesFromGroup","VKWebAppJoinGroup","VKWebAppOpenApp","VKWebAppSetLocation","VKWebAppScroll","VKWebAppResizeWindow"].indexOf(e)))}}}(window)},function(e,t,o){"use strict";var n=o(0),r=o.n(n);function i(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var o=[],n=!0,r=!1,i=void 0;try{for(var a,u=e[Symbol.iterator]();!(n=(a=u.next()).done)&&(o.push(a.value),!t||o.length!==t);n=!0);}catch(e){r=!0,i=e}finally{try{n||null==u.return||u.return()}finally{if(r)throw i}}return o}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}function a(e){return e&&"[object Function]"===Object.prototype.toString.call(e)}function u(){return window.AndroidBridge}function s(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(!e)return"";var o=[],n=t?"?":"";for(var r in e)if(e.hasOwnProperty(r)){var i=e[r=encodeURIComponent(r)]||"";i=i.toString(),i=encodeURIComponent(i),o.push("".concat(r,"=").concat(i))}return o.length?n+o.join("&"):""}function c(e,t){for(var o=0;o<t.length;o++){var n=t[o];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}var p=function(){function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.proxy=t,this.methodName="",this.deprecatedMethodName="",this.successEvent="",this.failedEvent="",this.resultEvents=[],this.params2QsForDepredcated=!0}var t,o,n;return t=e,(o=[{key:"getResultEvents",value:function(){return this.resultEvents.length||(this.successEvent&&this.resultEvents.push(this.successEvent),this.failedEvent&&this.resultEvents.push(this.failedEvent)),this.resultEvents}},{key:"request",value:function(){throw new Error("Method ".concat(this.methodName,"(").concat(this.deprecatedMethodName,") is not implemented"))}},{key:"response",value:function(e){throw new Error("Response event handler for ".concat(this.methodName,"(").concat(this.deprecatedMethodName,") is not implemented"))}},{key:"deprecatedResponse",value:function(){throw new Error("Response handler for ".concat(this.methodName,"(").concat(this.deprecatedMethodName,") is not implemented"))}},{key:"eventToStatus",value:function(e){var t=e.type;return e=e.data,t===this.successEvent?"success":e.error_data.error_reason||"fail"}}])&&c(t.prototype,o),n&&c(t,n),e}();function l(e){return(l="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 f(e,t){for(var o=0;o<t.length;o++){var n=t[o];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function y(e,t){return!t||"object"!==l(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function d(e){return(d=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function h(e,t){return(h=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var b=function(e){function t(e){var o;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),(o=y(this,d(t).call(this,e))).successEvent=t.successEven,o.failedEvent=t.failedEvent,o.methodName=t.methodName,o.deprecatedMethodName="VKWebAppApiCall",o.params2QsForDepredcated=!1,o}var o,n,i;return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&h(e,t)}(t,p),o=t,(n=[{key:"request",value:function(e,o,n){var i=r.a.supports(this.methodName),u=(new Date).getUTCMilliseconds().toString();o.access_token=this.proxy.getQueryParam("access_token");var c={method:e,request_id:u,params:o};i||(c.callbackId=u,c.query=s(c.params),delete c.params,delete c.request_id),a(n)&&(t.callbacks[u]=n),i?this.proxy.call(this,c):this.proxy.apiCall(this,c)}},{key:"response",value:function(e){var o=e.data,n=t.callbacks[o.request_id];a(n)&&n(o),delete t.callbacks[o.request_id]}}])&&f(o.prototype,n),i&&f(o,i),t}();b.methodName="VKWebAppCallAPIMethod",b.successEven="VKWebAppCallAPIMethodResult",b.failedEvent="VKWebAppCallAPIMethodFailed",b.callbacks={};var v,m={};function w(e){if(a(m[e])){for(var t=arguments.length,o=new Array(t>1?t-1:0),n=1;n<t;n++)o[n-1]=arguments[n];m[e].apply(m,o)}}function g(e){return(g="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,t){for(var o=0;o<t.length;o++){var n=t[o];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function _(e,t){return!t||"object"!==g(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function k(e){return(k=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function S(e,t){return(S=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function x(e,t,o){return t in e?Object.defineProperty(e,t,{value:o,enumerable:!0,configurable:!0,writable:!0}):e[t]=o,e}var E=(x(v={},2,"friends"),x(v,4,"photos"),x(v,16,"video"),x(v,64,"stories"),x(v,128,"pages"),x(v,1024,"status"),x(v,2048,"notes"),x(v,8192,"wall"),x(v,32768,"ads"),x(v,1<<17,"docs"),x(v,1<<18,"groups"),x(v,1<<20,"stats"),x(v,1<<27,"market"),v),A=function(e){function t(e){var o;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),(o=_(this,k(t).call(this,e))).methodName="VKWebAppGetAuthToken",o.deprecatedMethodName="showSettingsBox",o.successEvent="VKWebAppAccessTokenReceived",o.failedEvent="VKWebAppAccessTokenFailed",o}var o,n,i;return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&S(e,t)}(t,p),o=t,(n=[{key:"maskToScope",value:function(e){var t=[];for(var o in E)E.hasOwnProperty(o)&&+o&+e&&t.push(E[o]);return t.join(",")}},{key:"request",value:function(e){if(e<0)throw new Error("Mask must be more 0");var t;t=r.a.supports(this.methodName)?{scope:this.maskToScope(e),app_id:+this.proxy.getQueryParam("vk_app_id")||+this.proxy.getQueryParam("api_id")}:{mask:e,access_token:this.proxy.getQueryParam("access_token")},this.proxy.call(this,t)}},{key:"tokenRequest",value:function(){this.proxy.call(this,{app_id:+this.proxy.getQueryParam("vk_app_id")||+this.proxy.getQueryParam("api_id"),scope:this.proxy.getQueryParam("vk_access_token_settings")||this.maskToScope(this.proxy.getQueryParam("api_settings"))||""})}},{key:"deprecatedResponse",value:function(e,t){"success"===e&&t&&this.proxy.setQueryParam("access_token",t),w("onSettingsBoxDone",e,t)}},{key:"response",value:function(e){var t=this.eventToStatus(e);"success"===t&&this.proxy.setQueryParam("access_token",e.data.access_token),w("onSettingsBoxDone",t,e.data.access_token)}}])&&O(o.prototype,n),i&&O(o,i),t}();function P(e,t){for(var o=0;o<t.length;o++){var n=t[o];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function j(){var e=document.getElementById("debug");if(e){for(var t=arguments.length,o=new Array(t),n=0;n<t;n++)o[n]=arguments[n];e.innerHTML+=JSON.stringify(o)+"<br>"}}var M=function(){function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.queryParams=t,this.methods={},this.methodEvents={},this.initVkUiConnectListener()}var t,o,n;return t=e,(o=[{key:"initVkUiConnectApp",value:function(){if(this.isVKUiConnectSupport()&&(j("init vk connect"),r.a.send("VKWebAppInit",{}),!this.getQueryParam("access_token"))){var e=new A(this);this.addMethod(e),this.addMethod(e),e.tokenRequest()}}},{key:"initVkUiConnectListener",value:function(){var e=this;r.a.subscribe(function(t){var o=t.detail||{},n=o.type;j("eventName",n),j("eventData",o),e.methodEvents[n]&&e.methodEvents[n].response(o)})}},{key:"addPublicMethods",value:function(e){var t=this;Object.keys(e).forEach(function(o){var n=e[o];t.addMethod(n)})}},{key:"addMethod",value:function(e){var t=this,o=e.getResultEvents();o.length&&o.forEach(function(o){t.methodEvents[o]=e}),this.methods[e.methodName]=e,e.deprecatedMethodName&&(this.methods[e.deprecatedMethodName]=e)}},{key:"setQueryParam",value:function(e,t){this.queryParams[e]=t}},{key:"getQueryParam",value:function(e){return this.queryParams[e]}},{key:"call",value:function(e,t){if(j("proxy.call",e.methodName,t),r.a.supports(e.methodName))j("proxy.call - vk ui connect",e.methodName,t),r.a.send(e.methodName,t);else if(e.deprecatedMethodName&&!this.isVKUiConnectSupport()){var o=e.params2QsForDepredcated?s(t):t;u()?(j("proxy.call - old android",e.deprecatedMethodName,o),window.AndroidBridge.callMethod(e.deprecatedMethodName,o)):(j("proxy.call - old ios/web",e.deprecatedMethodName,o),r.a.send(e.deprecatedMethodName,o))}else j(e.methodName,"is not implemented"),e.response({type:e.failedEvent,data:{error_type:"client",error_data:{error_code:1,error_reason:"not_implemented",error_description:"This method not implemented"}}})}},{key:"apiCall",value:function(e,t){j("proxy.apiCall",e.methodName,t),u()?window.AndroidBridge.apiCall(t.method,t.query,t.callbackId):this.call(e,t)}},{key:"response",value:function(e){for(var t,o=arguments.length,n=new Array(o>1?o-1:0),r=1;r<o;r++)n[r-1]=arguments[r];if(j.apply(void 0,["proxy.response",e].concat(n)),!this.methods[e])throw new Error("Method "+e+" is undefined or invalid");(t=this.methods[e]).deprecatedResponse.apply(t,n)}},{key:"apiResponse",value:function(e,t){j("proxy.apiResponse",e,t);var o={type:b.successEven,data:{request_id:e,response:t.response}};this.methods[b.methodName].response(o)}},{key:"isVKUiConnectSupport",value:function(){return r.a.supports("VKWebAppInit")||r.a.supports("VKWebAppGetAuthToken")}}])&&P(t.prototype,o),n&&P(t,n),e}();function V(e){return(V="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 K(e,t){for(var o=0;o<t.length;o++){var n=t[o];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function N(e,t){return!t||"object"!==V(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function T(e){return(T=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function W(e,t){return(W=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var B=function(e){function t(e){var o;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),(o=N(this,T(t).call(this,e))).methodName="VKWebAppShowInviteBox",o.deprecatedMethodName="showInviteBox",o.successEvent="VKWebAppShowInviteBoxResult",o.failedEvent="VKWebAppShowInviteBoxFailed",o}var o,n,r;return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&W(e,t)}(t,p),o=t,(n=[{key:"request",value:function(){this.proxy.call(this,{})}},{key:"deprecatedResponse",value:function(e,t){w("onInviteBoxDone",e,t=t||[])}},{key:"response",value:function(e){w("onInviteBoxDone",this.eventToStatus(e),e.data.notSentIds||[])}}])&&K(o.prototype,n),r&&K(o,r),t}();function C(e){return(C="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,t){for(var o=0;o<t.length;o++){var n=t[o];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function q(e,t){return!t||"object"!==C(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function F(e){return(F=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function I(e,t){return(I=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var D=function(e){function t(e){var o;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),(o=q(this,F(t).call(this,e))).methodName="VKWebAppShowRequestBox",o.deprecatedMethodName="showRequestBox",o.successEvent="VKWebAppShowRequestBoxResult",o.failedEvent="VKWebAppShowRequestBoxFailed",o}var o,n,r;return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&I(e,t)}(t,p),o=t,(n=[{key:"request",value:function(e,t,o){if(e<=0)throw new Error("UID must be more 0");this.proxy.call(this,{uid:e,message:t,requestKey:o})}},{key:"deprecatedResponse",value:function(e,t){w("onRequestBoxDone",e,t)}},{key:"response",value:function(e){w("onRequestBoxDone",this.eventToStatus(e),e.data.request_id)}}])&&R(o.prototype,n),r&&R(o,r),t}();function Q(e){return(Q="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 G(e,t){for(var o=0;o<t.length;o++){var n=t[o];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function U(e,t){return!t||"object"!==Q(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function L(e){return(L=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function H(e,t){return(H=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var J=function(e){function t(e){var o;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),(o=U(this,L(t).call(this,e))).methodName="VKWebAppShowOrderBox",o.deprecatedMethodName="showOrderBox",o.successEvent="VKWebAppShowOrderBoxResult",o.failedEvent="VKWebAppShowOrderBoxFailed",o}var o,n,r;return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&H(e,t)}(t,p),o=t,(n=[{key:"request",value:function(e){var t={};if("object"!==Q(e))throw new Error("Order box params must be object");if(void 0===e.type)throw new Error("Order box param type must be string");switch(e.type){case"votes":if("number"!=typeof e.votes)throw new Error("Order box param votes must be int");t.type="votes",t.votes=e.votes;break;case"item":if("string"!=typeof e.item)throw new Error("Order box param item must be string");t.type="item",t.item=e.item;break;default:throw new Error("Order box param type with invalid value")}this.proxy.call(this,t)}},{key:"deprecatedResponse",value:function(e){w("onOrderBoxDone",e)}},{key:"response",value:function(e){w("onOrderBoxDone",this.eventToStatus(e))}}])&&G(o.prototype,n),r&&G(o,r),t}();function z(e){return(z="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 X(e,t){for(var o=0;o<t.length;o++){var n=t[o];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function Y(e,t){return!t||"object"!==z(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function Z(e){return(Z=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function $(e,t){return($=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var ee=function(e){function t(e){var o;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),(o=Y(this,Z(t).call(this,e))).methodName="VKWebAppShare",o.deprecatedMethodName="showShareBox",o.successEvent="VKWebAppShareResult",o.failedEvent="VKWebAppShareFailed",o}var o,n,i;return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&$(e,t)}(t,p),o=t,(n=[{key:"request",value:function(e,t,o){var n;n=r.a.supports(this.methodName)?{}:{message:e,attachments:t,target:o||"wall"},this.proxy.call(this,n)}},{key:"response",value:function(e){w("onShareBoxDone",this.eventToStatus(e))}},{key:"deprecatedResponse",value:function(e){w("onShareBoxDone",e)}}])&&X(o.prototype,n),i&&X(o,i),t}();function te(e){return(te="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 oe(e,t){for(var o=0;o<t.length;o++){var n=t[o];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function ne(e,t){return!t||"object"!==te(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function re(e){return(re=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function ie(e,t){return(ie=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var ae=function(e){function t(e){var o;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),(o=ne(this,re(t).call(this,e))).methodName="VKWebAppShowLeaderBoardBox",o.deprecatedMethodName="showLeaderboardBox",o.successEvent="VKWebAppShowLeaderBoardBoxResult",o.failedEvent="VKWebAppShowLeaderBoardBoxFailed",o}var o,n,r;return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&ie(e,t)}(t,p),o=t,(n=[{key:"request",value:function(e){var t={user_result:e};this.proxy.call(this,t)}},{key:"deprecatedResponse",value:function(e){w("onLeaderboardBoxDone",e)}},{key:"response",value:function(e){w("onLeaderboardBoxDone",this.eventToStatus(e))}}])&&oe(o.prototype,n),r&&oe(o,r),t}();function ue(e){return(ue="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 se(e,t){for(var o=0;o<t.length;o++){var n=t[o];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function ce(e,t){return!t||"object"!==ue(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function pe(e){return(pe=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function le(e,t){return(le=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var fe=function(e){function t(e){var o;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),(o=ce(this,pe(t).call(this,e))).methodName="VKWebAppAddToFavorites",o.deprecatedMethodName="addToMenu",o.successEvent="VKWebAppAddToFavoritesResult",o.failedEvent="VKWebAppAddToFavoritesFailed",o}var o,n,r;return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&le(e,t)}(t,p),o=t,(n=[{key:"request",value:function(){this.proxy.call(this,{})}},{key:"response",value:function(e){w("onAddToMenuDone",this.eventToStatus(e))}},{key:"deprecatedResponse",value:function(e){w("onAddToMenuDone",e)}}])&&se(o.prototype,n),r&&se(o,r),t}();function ye(e){return(ye="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 de(e,t){for(var o=0;o<t.length;o++){var n=t[o];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function he(e,t){return!t||"object"!==ye(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function be(e){return(be=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function ve(e,t){return(ve=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var me=function(e){function t(e){var o;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),(o=he(this,be(t).call(this,e))).methodName="VKWebAppAllowMessagesFromGroup",o.deprecatedMethodName="showAllowMessagesFromCommunityBox",o.successEvent="VKWebAppAllowMessagesFromGroupResult",o.failedEvent="VKWebAppAllowMessagesFromGroupFailed",o}var o,n,i;return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&ve(e,t)}(t,p),o=t,(n=[{key:"request",value:function(e){var t={};r.a.supports(this.methodName)?t.group_id=+e:t.groupId=+e,this.proxy.call(this,t)}},{key:"response",value:function(e){"success"===this.eventToStatus(e)?w("onAllowMessagesFromCommunity"):w("onAllowMessagesFromCommunityCancel")}},{key:"deprecatedResponse",value:function(e){w("success"===e?"onAllowMessagesFromCommunity":"onAllowMessagesFromCommunityCancel")}}])&&de(o.prototype,n),i&&de(o,i),t}();function we(){return(we=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var o=arguments[t];for(var n in o)Object.prototype.hasOwnProperty.call(o,n)&&(e[n]=o[n])}return e}).apply(this,arguments)}function ge(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var o=[],n=!0,r=!1,i=void 0;try{for(var a,u=e[Symbol.iterator]();!(n=(a=u.next()).done)&&(o.push(a.value),!t||o.length!==t);n=!0);}catch(e){r=!0,i=e}finally{try{n||null==u.return||u.return()}finally{if(r)throw i}}return o}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}function Oe(e,t){for(var o=0;o<t.length;o++){var n=t[o];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}o.d(t,"a",function(){return _e});var _e=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.version=null,this.funcs={},this.proxy=null}var t,o,n;return t=e,(o=[{key:"init",value:function(e,t,o,n){var r=this.initQueryParams(n);r?(o&&(this.version=o),this.proxy=new M(r),this.initMethods(),this.proxy.initVkUiConnectApp(),a(e)&&e()):a(t)&&t()}},{key:"initMethods",value:function(){this.apiMethod=new b(this.proxy),this.proxy.addMethod(this.apiMethod),this.funcs.showSettingsBox=new A(this.proxy),this.funcs.showInviteBox=new B(this.proxy),this.funcs.showRequestBox=new D(this.proxy),this.funcs.showOrderBox=new J(this.proxy),this.funcs.showLeaderboardBox=new ae(this.proxy),this.funcs.showShareBox=new ee(this.proxy),this.funcs.addToMenu=new fe(this.proxy),this.funcs.showAllowMessagesFromCommunityBox=new me(this.proxy),this.proxy.addPublicMethods(this.funcs)}},{key:"initQueryParams",value:function(e){if(~(e=e||window.location.search).indexOf("?")){var t=e.split("?");e=ge(t,2)[1]}return!!e.length&&function(e){var t={};return(e=e.toString().trim()).length?(e.split("&").forEach(function(e){var o=i(e.split("="),2),n=o[0],r=o[1];n=decodeURIComponent(n),r=decodeURIComponent(r||""),t[n]=r}),t):t}(e)}},{key:"addCallback",value:function(e,t){!function(e,t){a(t)&&(m[e]=t)}(e,t)}},{key:"removeCallback",value:function(e){!function(e){delete m[e]}(e)}},{key:"callMethod",value:function(e){if(!this.proxy)throw new Error("Sdk is not init");var t=this.funcs[e];if(void 0===t||!a(t.request))throw new Error("Method "+e+" is not supported or invalid");for(var o=arguments.length,n=new Array(o>1?o-1:0),r=1;r<o;r++)n[r-1]=arguments[r];t.request.apply(t,n)}},{key:"api",value:function(e,t,o){we(t=t||{},{v:t.v||this.version}),this.apiMethod.request(e,t,o)}}])&&Oe(t.prototype,o),n&&Oe(t,n),e}()},function(e,t,o){"use strict";o.r(t);var n=o(1);window.VK||(window.VK=new n.a)}]); |
{ | ||
"name": "@vkontakte/js-sdk", | ||
"version": "0.2.5", | ||
"version": "0.2.6", | ||
"description": "JavaScript sdk for vk.com", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
2
56618